cesium.js 7.8 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888848898489084891848928489384894848958489684897848988489984900849018490284903849048490584906849078490884909849108491184912849138491484915849168491784918849198492084921849228492384924849258492684927849288492984930849318493284933849348493584936849378493884939849408494184942849438494484945849468494784948849498495084951849528495384954849558495684957849588495984960849618496284963849648496584966849678496884969849708497184972849738497484975849768497784978849798498084981849828498384984849858498684987849888498984990849918499284993849948499584996849978499884999850008500185002850038500485005850068500785008850098501085011850128501385014850158501685017850188501985020850218502285023850248502585026850278502885029850308503185032850338503485035850368503785038850398504085041850428504385044850458504685047850488504985050850518505285053850548505585056850578505885059850608506185062850638506485065850668506785068850698507085071850728507385074850758507685077850788507985080850818508285083850848508585086850878508885089850908509185092850938509485095850968509785098850998510085101851028510385104851058510685107851088510985110851118511285113851148511585116851178511885119851208512185122851238512485125851268512785128851298513085131851328513385134851358513685137851388513985140851418514285143851448514585146851478514885149851508515185152851538515485155851568515785158851598516085161851628516385164851658516685167851688516985170851718517285173851748517585176851778517885179851808518185182851838518485185851868518785188851898519085191851928519385194851958519685197851988519985200852018520285203852048520585206852078520885209852108521185212852138521485215852168521785218852198522085221852228522385224852258522685227852288522985230852318523285233852348523585236852378523885239852408524185242852438524485245852468524785248852498525085251852528525385254852558525685257852588525985260852618526285263852648526585266852678526885269852708527185272852738527485275852768527785278852798528085281852828528385284852858528685287852888528985290852918529285293852948529585296852978529885299853008530185302853038530485305853068530785308853098531085311853128531385314853158531685317853188531985320853218532285323853248532585326853278532885329853308533185332853338533485335853368533785338853398534085341853428534385344853458534685347853488534985350853518535285353853548535585356853578535885359853608536185362853638536485365853668536785368853698537085371853728537385374853758537685377853788537985380853818538285383853848538585386853878538885389853908539185392853938539485395853968539785398853998540085401854028540385404854058540685407854088540985410854118541285413854148541585416854178541885419854208542185422854238542485425854268542785428854298543085431854328543385434854358543685437854388543985440854418544285443854448544585446854478544885449854508545185452854538545485455854568545785458854598546085461854628546385464854658546685467854688546985470854718547285473854748547585476854778547885479854808548185482854838548485485854868548785488854898549085491854928549385494854958549685497854988549985500855018550285503855048550585506855078550885509855108551185512855138551485515855168551785518855198552085521855228552385524855258552685527855288552985530855318553285533855348553585536855378553885539855408554185542855438554485545855468554785548855498555085551855528555385554855558555685557855588555985560855618556285563855648556585566855678556885569855708557185572855738557485575855768557785578855798558085581855828558385584855858558685587855888558985590855918559285593855948559585596855978559885599856008560185602856038560485605856068560785608856098561085611856128561385614856158561685617856188561985620856218562285623856248562585626856278562885629856308563185632856338563485635856368563785638856398564085641856428564385644856458564685647856488564985650856518565285653856548565585656856578565885659856608566185662856638566485665856668566785668856698567085671856728567385674856758567685677856788567985680856818568285683856848568585686856878568885689856908569185692856938569485695856968569785698856998570085701857028570385704857058570685707857088570985710857118571285713857148571585716857178571885719857208572185722857238572485725857268572785728857298573085731857328573385734857358573685737857388573985740857418574285743857448574585746857478574885749857508575185752857538575485755857568575785758857598576085761857628576385764857658576685767857688576985770857718577285773857748577585776857778577885779857808578185782857838578485785857868578785788857898579085791857928579385794857958579685797857988579985800858018580285803858048580585806858078580885809858108581185812858138581485815858168581785818858198582085821858228582385824858258582685827858288582985830858318583285833858348583585836858378583885839858408584185842858438584485845858468584785848858498585085851858528585385854858558585685857858588585985860858618586285863858648586585866858678586885869858708587185872858738587485875858768587785878858798588085881858828588385884858858588685887858888588985890858918589285893858948589585896858978589885899859008590185902859038590485905859068590785908859098591085911859128591385914859158591685917859188591985920859218592285923859248592585926859278592885929859308593185932859338593485935859368593785938859398594085941859428594385944859458594685947859488594985950859518595285953859548595585956859578595885959859608596185962859638596485965859668596785968859698597085971859728597385974859758597685977859788597985980859818598285983859848598585986859878598885989859908599185992859938599485995859968599785998859998600086001860028600386004860058600686007860088600986010860118601286013860148601586016860178601886019860208602186022860238602486025860268602786028860298603086031860328603386034860358603686037860388603986040860418604286043860448604586046860478604886049860508605186052860538605486055860568605786058860598606086061860628606386064860658606686067860688606986070860718607286073860748607586076860778607886079860808608186082860838608486085860868608786088860898609086091860928609386094860958609686097860988609986100861018610286103861048610586106861078610886109861108611186112861138611486115861168611786118861198612086121861228612386124861258612686127861288612986130861318613286133861348613586136861378613886139861408614186142861438614486145861468614786148861498615086151861528615386154861558615686157861588615986160861618616286163861648616586166861678616886169861708617186172861738617486175861768617786178861798618086181861828618386184861858618686187861888618986190861918619286193861948619586196861978619886199862008620186202862038620486205862068620786208862098621086211862128621386214862158621686217862188621986220862218622286223862248622586226862278622886229862308623186232862338623486235862368623786238862398624086241862428624386244862458624686247862488624986250862518625286253862548625586256862578625886259862608626186262862638626486265862668626786268862698627086271862728627386274862758627686277862788627986280862818628286283862848628586286862878628886289862908629186292862938629486295862968629786298862998630086301863028630386304863058630686307863088630986310863118631286313863148631586316863178631886319863208632186322863238632486325863268632786328863298633086331863328633386334863358633686337863388633986340863418634286343863448634586346863478634886349863508635186352863538635486355863568635786358863598636086361863628636386364863658636686367863688636986370863718637286373863748637586376863778637886379863808638186382863838638486385863868638786388863898639086391863928639386394863958639686397863988639986400864018640286403864048640586406864078640886409864108641186412864138641486415864168641786418864198642086421864228642386424864258642686427864288642986430864318643286433864348643586436864378643886439864408644186442864438644486445864468644786448864498645086451864528645386454864558645686457864588645986460864618646286463864648646586466864678646886469864708647186472864738647486475864768647786478864798648086481864828648386484864858648686487864888648986490864918649286493864948649586496864978649886499865008650186502865038650486505865068650786508865098651086511865128651386514865158651686517865188651986520865218652286523865248652586526865278652886529865308653186532865338653486535865368653786538865398654086541865428654386544865458654686547865488654986550865518655286553865548655586556865578655886559865608656186562865638656486565865668656786568865698657086571865728657386574865758657686577865788657986580865818658286583865848658586586865878658886589865908659186592865938659486595865968659786598865998660086601866028660386604866058660686607866088660986610866118661286613866148661586616866178661886619866208662186622866238662486625866268662786628866298663086631866328663386634866358663686637866388663986640866418664286643866448664586646866478664886649866508665186652866538665486655866568665786658866598666086661866628666386664866658666686667866688666986670866718667286673866748667586676866778667886679866808668186682866838668486685866868668786688866898669086691866928669386694866958669686697866988669986700867018670286703867048670586706867078670886709867108671186712867138671486715867168671786718867198672086721867228672386724867258672686727867288672986730867318673286733867348673586736867378673886739867408674186742867438674486745867468674786748867498675086751867528675386754867558675686757867588675986760867618676286763867648676586766867678676886769867708677186772867738677486775867768677786778867798678086781867828678386784867858678686787867888678986790867918679286793867948679586796867978679886799868008680186802868038680486805868068680786808868098681086811868128681386814868158681686817868188681986820868218682286823868248682586826868278682886829868308683186832868338683486835868368683786838868398684086841868428684386844868458684686847868488684986850868518685286853868548685586856868578685886859868608686186862868638686486865868668686786868868698687086871868728687386874868758687686877868788687986880868818688286883868848688586886868878688886889868908689186892868938689486895868968689786898868998690086901869028690386904869058690686907869088690986910869118691286913869148691586916869178691886919869208692186922869238692486925869268692786928869298693086931869328693386934869358693686937869388693986940869418694286943869448694586946869478694886949869508695186952869538695486955869568695786958869598696086961869628696386964869658696686967869688696986970869718697286973869748697586976869778697886979869808698186982869838698486985869868698786988869898699086991869928699386994869958699686997869988699987000870018700287003870048700587006870078700887009870108701187012870138701487015870168701787018870198702087021870228702387024870258702687027870288702987030870318703287033870348703587036870378703887039870408704187042870438704487045870468704787048870498705087051870528705387054870558705687057870588705987060870618706287063870648706587066870678706887069870708707187072870738707487075870768707787078870798708087081870828708387084870858708687087870888708987090870918709287093870948709587096870978709887099871008710187102871038710487105871068710787108871098711087111871128711387114871158711687117871188711987120871218712287123871248712587126871278712887129871308713187132871338713487135871368713787138871398714087141871428714387144871458714687147871488714987150871518715287153871548715587156871578715887159871608716187162871638716487165871668716787168871698717087171871728717387174871758717687177871788717987180871818718287183871848718587186871878718887189871908719187192871938719487195871968719787198871998720087201872028720387204872058720687207872088720987210872118721287213872148721587216872178721887219872208722187222872238722487225872268722787228872298723087231872328723387234872358723687237872388723987240872418724287243872448724587246872478724887249872508725187252872538725487255872568725787258872598726087261872628726387264872658726687267872688726987270872718727287273872748727587276872778727887279872808728187282872838728487285872868728787288872898729087291872928729387294872958729687297872988729987300873018730287303873048730587306873078730887309873108731187312873138731487315873168731787318873198732087321873228732387324873258732687327873288732987330873318733287333873348733587336873378733887339873408734187342873438734487345873468734787348873498735087351873528735387354873558735687357873588735987360873618736287363873648736587366873678736887369873708737187372873738737487375873768737787378873798738087381873828738387384873858738687387873888738987390873918739287393873948739587396873978739887399874008740187402874038740487405874068740787408874098741087411874128741387414874158741687417874188741987420874218742287423874248742587426874278742887429874308743187432874338743487435874368743787438874398744087441874428744387444874458744687447874488744987450874518745287453874548745587456874578745887459874608746187462874638746487465874668746787468874698747087471874728747387474874758747687477874788747987480874818748287483874848748587486874878748887489874908749187492874938749487495874968749787498874998750087501875028750387504875058750687507875088750987510875118751287513875148751587516875178751887519875208752187522875238752487525875268752787528875298753087531875328753387534875358753687537875388753987540875418754287543875448754587546875478754887549875508755187552875538755487555875568755787558875598756087561875628756387564875658756687567875688756987570875718757287573875748757587576875778757887579875808758187582875838758487585875868758787588875898759087591875928759387594875958759687597875988759987600876018760287603876048760587606876078760887609876108761187612876138761487615876168761787618876198762087621876228762387624876258762687627876288762987630876318763287633876348763587636876378763887639876408764187642876438764487645876468764787648876498765087651876528765387654876558765687657876588765987660876618766287663876648766587666876678766887669876708767187672876738767487675876768767787678876798768087681876828768387684876858768687687876888768987690876918769287693876948769587696876978769887699877008770187702877038770487705877068770787708877098771087711877128771387714877158771687717877188771987720877218772287723877248772587726877278772887729877308773187732877338773487735877368773787738877398774087741877428774387744877458774687747877488774987750877518775287753877548775587756877578775887759877608776187762877638776487765877668776787768877698777087771877728777387774877758777687777877788777987780877818778287783877848778587786877878778887789877908779187792877938779487795877968779787798877998780087801878028780387804878058780687807878088780987810878118781287813878148781587816878178781887819878208782187822878238782487825878268782787828878298783087831878328783387834878358783687837878388783987840878418784287843878448784587846878478784887849878508785187852878538785487855878568785787858878598786087861878628786387864878658786687867878688786987870878718787287873878748787587876878778787887879878808788187882878838788487885878868788787888878898789087891878928789387894878958789687897878988789987900879018790287903879048790587906879078790887909879108791187912879138791487915879168791787918879198792087921879228792387924879258792687927879288792987930879318793287933879348793587936879378793887939879408794187942879438794487945879468794787948879498795087951879528795387954879558795687957879588795987960879618796287963879648796587966879678796887969879708797187972879738797487975879768797787978879798798087981879828798387984879858798687987879888798987990879918799287993879948799587996879978799887999880008800188002880038800488005880068800788008880098801088011880128801388014880158801688017880188801988020880218802288023880248802588026880278802888029880308803188032880338803488035880368803788038880398804088041880428804388044880458804688047880488804988050880518805288053880548805588056880578805888059880608806188062880638806488065880668806788068880698807088071880728807388074880758807688077880788807988080880818808288083880848808588086880878808888089880908809188092880938809488095880968809788098880998810088101881028810388104881058810688107881088810988110881118811288113881148811588116881178811888119881208812188122881238812488125881268812788128881298813088131881328813388134881358813688137881388813988140881418814288143881448814588146881478814888149881508815188152881538815488155881568815788158881598816088161881628816388164881658816688167881688816988170881718817288173881748817588176881778817888179881808818188182881838818488185881868818788188881898819088191881928819388194881958819688197881988819988200882018820288203882048820588206882078820888209882108821188212882138821488215882168821788218882198822088221882228822388224882258822688227882288822988230882318823288233882348823588236882378823888239882408824188242882438824488245882468824788248882498825088251882528825388254882558825688257882588825988260882618826288263882648826588266882678826888269882708827188272882738827488275882768827788278882798828088281882828828388284882858828688287882888828988290882918829288293882948829588296882978829888299883008830188302883038830488305883068830788308883098831088311883128831388314883158831688317883188831988320883218832288323883248832588326883278832888329883308833188332883338833488335883368833788338883398834088341883428834388344883458834688347883488834988350883518835288353883548835588356883578835888359883608836188362883638836488365883668836788368883698837088371883728837388374883758837688377883788837988380883818838288383883848838588386883878838888389883908839188392883938839488395883968839788398883998840088401884028840388404884058840688407884088840988410884118841288413884148841588416884178841888419884208842188422884238842488425884268842788428884298843088431884328843388434884358843688437884388843988440884418844288443884448844588446884478844888449884508845188452884538845488455884568845788458884598846088461884628846388464884658846688467884688846988470884718847288473884748847588476884778847888479884808848188482884838848488485884868848788488884898849088491884928849388494884958849688497884988849988500885018850288503885048850588506885078850888509885108851188512885138851488515885168851788518885198852088521885228852388524885258852688527885288852988530885318853288533885348853588536885378853888539885408854188542885438854488545885468854788548885498855088551885528855388554885558855688557885588855988560885618856288563885648856588566885678856888569885708857188572885738857488575885768857788578885798858088581885828858388584885858858688587885888858988590885918859288593885948859588596885978859888599886008860188602886038860488605886068860788608886098861088611886128861388614886158861688617886188861988620886218862288623886248862588626886278862888629886308863188632886338863488635886368863788638886398864088641886428864388644886458864688647886488864988650886518865288653886548865588656886578865888659886608866188662886638866488665886668866788668886698867088671886728867388674886758867688677886788867988680886818868288683886848868588686886878868888689886908869188692886938869488695886968869788698886998870088701887028870388704887058870688707887088870988710887118871288713887148871588716887178871888719887208872188722887238872488725887268872788728887298873088731887328873388734887358873688737887388873988740887418874288743887448874588746887478874888749887508875188752887538875488755887568875788758887598876088761887628876388764887658876688767887688876988770887718877288773887748877588776887778877888779887808878188782887838878488785887868878788788887898879088791887928879388794887958879688797887988879988800888018880288803888048880588806888078880888809888108881188812888138881488815888168881788818888198882088821888228882388824888258882688827888288882988830888318883288833888348883588836888378883888839888408884188842888438884488845888468884788848888498885088851888528885388854888558885688857888588885988860888618886288863888648886588866888678886888869888708887188872888738887488875888768887788878888798888088881888828888388884888858888688887888888888988890888918889288893888948889588896888978889888899889008890188902889038890488905889068890788908889098891088911889128891388914889158891688917889188891988920889218892288923889248892588926889278892888929889308893188932889338893488935889368893788938889398894088941889428894388944889458894688947889488894988950889518895288953889548895588956889578895888959889608896188962889638896488965889668896788968889698897088971889728897388974889758897688977889788897988980889818898288983889848898588986889878898888989889908899188992889938899488995889968899788998889998900089001890028900389004890058900689007890088900989010890118901289013890148901589016890178901889019890208902189022890238902489025890268902789028890298903089031890328903389034890358903689037890388903989040890418904289043890448904589046890478904889049890508905189052890538905489055890568905789058890598906089061890628906389064890658906689067890688906989070890718907289073890748907589076890778907889079890808908189082890838908489085890868908789088890898909089091890928909389094890958909689097890988909989100891018910289103891048910589106891078910889109891108911189112891138911489115891168911789118891198912089121891228912389124891258912689127891288912989130891318913289133891348913589136891378913889139891408914189142891438914489145891468914789148891498915089151891528915389154891558915689157891588915989160891618916289163891648916589166891678916889169891708917189172891738917489175891768917789178891798918089181891828918389184891858918689187891888918989190891918919289193891948919589196891978919889199892008920189202892038920489205892068920789208892098921089211892128921389214892158921689217892188921989220892218922289223892248922589226892278922889229892308923189232892338923489235892368923789238892398924089241892428924389244892458924689247892488924989250892518925289253892548925589256892578925889259892608926189262892638926489265892668926789268892698927089271892728927389274892758927689277892788927989280892818928289283892848928589286892878928889289892908929189292892938929489295892968929789298892998930089301893028930389304893058930689307893088930989310893118931289313893148931589316893178931889319893208932189322893238932489325893268932789328893298933089331893328933389334893358933689337893388933989340893418934289343893448934589346893478934889349893508935189352893538935489355893568935789358893598936089361893628936389364893658936689367893688936989370893718937289373893748937589376893778937889379893808938189382893838938489385893868938789388893898939089391893928939389394893958939689397893988939989400894018940289403894048940589406894078940889409894108941189412894138941489415894168941789418894198942089421894228942389424894258942689427894288942989430894318943289433894348943589436894378943889439894408944189442894438944489445894468944789448894498945089451894528945389454894558945689457894588945989460894618946289463894648946589466894678946889469894708947189472894738947489475894768947789478894798948089481894828948389484894858948689487894888948989490894918949289493894948949589496894978949889499895008950189502895038950489505895068950789508895098951089511895128951389514895158951689517895188951989520895218952289523895248952589526895278952889529895308953189532895338953489535895368953789538895398954089541895428954389544895458954689547895488954989550895518955289553895548955589556895578955889559895608956189562895638956489565895668956789568895698957089571895728957389574895758957689577895788957989580895818958289583895848958589586895878958889589895908959189592895938959489595895968959789598895998960089601896028960389604896058960689607896088960989610896118961289613896148961589616896178961889619896208962189622896238962489625896268962789628896298963089631896328963389634896358963689637896388963989640896418964289643896448964589646896478964889649896508965189652896538965489655896568965789658896598966089661896628966389664896658966689667896688966989670896718967289673896748967589676896778967889679896808968189682896838968489685896868968789688896898969089691896928969389694896958969689697896988969989700897018970289703897048970589706897078970889709897108971189712897138971489715897168971789718897198972089721897228972389724897258972689727897288972989730897318973289733897348973589736897378973889739897408974189742897438974489745897468974789748897498975089751897528975389754897558975689757897588975989760897618976289763897648976589766897678976889769897708977189772897738977489775897768977789778897798978089781897828978389784897858978689787897888978989790897918979289793897948979589796897978979889799898008980189802898038980489805898068980789808898098981089811898128981389814898158981689817898188981989820898218982289823898248982589826898278982889829898308983189832898338983489835898368983789838898398984089841898428984389844898458984689847898488984989850898518985289853898548985589856898578985889859898608986189862898638986489865898668986789868898698987089871898728987389874898758987689877898788987989880898818988289883898848988589886898878988889889898908989189892898938989489895898968989789898898998990089901899028990389904899058990689907899088990989910899118991289913899148991589916899178991889919899208992189922899238992489925899268992789928899298993089931899328993389934899358993689937899388993989940899418994289943899448994589946899478994889949899508995189952899538995489955899568995789958899598996089961899628996389964899658996689967899688996989970899718997289973899748997589976899778997889979899808998189982899838998489985899868998789988899898999089991899928999389994899958999689997899988999990000900019000290003900049000590006900079000890009900109001190012900139001490015900169001790018900199002090021900229002390024900259002690027900289002990030900319003290033900349003590036900379003890039900409004190042900439004490045900469004790048900499005090051900529005390054900559005690057900589005990060900619006290063900649006590066900679006890069900709007190072900739007490075900769007790078900799008090081900829008390084900859008690087900889008990090900919009290093900949009590096900979009890099901009010190102901039010490105901069010790108901099011090111901129011390114901159011690117901189011990120901219012290123901249012590126901279012890129901309013190132901339013490135901369013790138901399014090141901429014390144901459014690147901489014990150901519015290153901549015590156901579015890159901609016190162901639016490165901669016790168901699017090171901729017390174901759017690177901789017990180901819018290183901849018590186901879018890189901909019190192901939019490195901969019790198901999020090201902029020390204902059020690207902089020990210902119021290213902149021590216902179021890219902209022190222902239022490225902269022790228902299023090231902329023390234902359023690237902389023990240902419024290243902449024590246902479024890249902509025190252902539025490255902569025790258902599026090261902629026390264902659026690267902689026990270902719027290273902749027590276902779027890279902809028190282902839028490285902869028790288902899029090291902929029390294902959029690297902989029990300903019030290303903049030590306903079030890309903109031190312903139031490315903169031790318903199032090321903229032390324903259032690327903289032990330903319033290333903349033590336903379033890339903409034190342903439034490345903469034790348903499035090351903529035390354903559035690357903589035990360903619036290363903649036590366903679036890369903709037190372903739037490375903769037790378903799038090381903829038390384903859038690387903889038990390903919039290393903949039590396903979039890399904009040190402904039040490405904069040790408904099041090411904129041390414904159041690417904189041990420904219042290423904249042590426904279042890429904309043190432904339043490435904369043790438904399044090441904429044390444904459044690447904489044990450904519045290453904549045590456904579045890459904609046190462904639046490465904669046790468904699047090471904729047390474904759047690477904789047990480904819048290483904849048590486904879048890489904909049190492904939049490495904969049790498904999050090501905029050390504905059050690507905089050990510905119051290513905149051590516905179051890519905209052190522905239052490525905269052790528905299053090531905329053390534905359053690537905389053990540905419054290543905449054590546905479054890549905509055190552905539055490555905569055790558905599056090561905629056390564905659056690567905689056990570905719057290573905749057590576905779057890579905809058190582905839058490585905869058790588905899059090591905929059390594905959059690597905989059990600906019060290603906049060590606906079060890609906109061190612906139061490615906169061790618906199062090621906229062390624906259062690627906289062990630906319063290633906349063590636906379063890639906409064190642906439064490645906469064790648906499065090651906529065390654906559065690657906589065990660906619066290663906649066590666906679066890669906709067190672906739067490675906769067790678906799068090681906829068390684906859068690687906889068990690906919069290693906949069590696906979069890699907009070190702907039070490705907069070790708907099071090711907129071390714907159071690717907189071990720907219072290723907249072590726907279072890729907309073190732907339073490735907369073790738907399074090741907429074390744907459074690747907489074990750907519075290753907549075590756907579075890759907609076190762907639076490765907669076790768907699077090771907729077390774907759077690777907789077990780907819078290783907849078590786907879078890789907909079190792907939079490795907969079790798907999080090801908029080390804908059080690807908089080990810908119081290813908149081590816908179081890819908209082190822908239082490825908269082790828908299083090831908329083390834908359083690837908389083990840908419084290843908449084590846908479084890849908509085190852908539085490855908569085790858908599086090861908629086390864908659086690867908689086990870908719087290873908749087590876908779087890879908809088190882908839088490885908869088790888908899089090891908929089390894908959089690897908989089990900909019090290903909049090590906909079090890909909109091190912909139091490915909169091790918909199092090921909229092390924909259092690927909289092990930909319093290933909349093590936909379093890939909409094190942909439094490945909469094790948909499095090951909529095390954909559095690957909589095990960909619096290963909649096590966909679096890969909709097190972909739097490975909769097790978909799098090981909829098390984909859098690987909889098990990909919099290993909949099590996909979099890999910009100191002910039100491005910069100791008910099101091011910129101391014910159101691017910189101991020910219102291023910249102591026910279102891029910309103191032910339103491035910369103791038910399104091041910429104391044910459104691047910489104991050910519105291053910549105591056910579105891059910609106191062910639106491065910669106791068910699107091071910729107391074910759107691077910789107991080910819108291083910849108591086910879108891089910909109191092910939109491095910969109791098910999110091101911029110391104911059110691107911089110991110911119111291113911149111591116911179111891119911209112191122911239112491125911269112791128911299113091131911329113391134911359113691137911389113991140911419114291143911449114591146911479114891149911509115191152911539115491155911569115791158911599116091161911629116391164911659116691167911689116991170911719117291173911749117591176911779117891179911809118191182911839118491185911869118791188911899119091191911929119391194911959119691197911989119991200912019120291203912049120591206912079120891209912109121191212912139121491215912169121791218912199122091221912229122391224912259122691227912289122991230912319123291233912349123591236912379123891239912409124191242912439124491245912469124791248912499125091251912529125391254912559125691257912589125991260912619126291263912649126591266912679126891269912709127191272912739127491275912769127791278912799128091281912829128391284912859128691287912889128991290912919129291293912949129591296912979129891299913009130191302913039130491305913069130791308913099131091311913129131391314913159131691317913189131991320913219132291323913249132591326913279132891329913309133191332913339133491335913369133791338913399134091341913429134391344913459134691347913489134991350913519135291353913549135591356913579135891359913609136191362913639136491365913669136791368913699137091371913729137391374913759137691377913789137991380913819138291383913849138591386913879138891389913909139191392913939139491395913969139791398913999140091401914029140391404914059140691407914089140991410914119141291413914149141591416914179141891419914209142191422914239142491425914269142791428914299143091431914329143391434914359143691437914389143991440914419144291443914449144591446914479144891449914509145191452914539145491455914569145791458914599146091461914629146391464914659146691467914689146991470914719147291473914749147591476914779147891479914809148191482914839148491485914869148791488914899149091491914929149391494914959149691497914989149991500915019150291503915049150591506915079150891509915109151191512915139151491515915169151791518915199152091521915229152391524915259152691527915289152991530915319153291533915349153591536915379153891539915409154191542915439154491545915469154791548915499155091551915529155391554915559155691557915589155991560915619156291563915649156591566915679156891569915709157191572915739157491575915769157791578915799158091581915829158391584915859158691587915889158991590915919159291593915949159591596915979159891599916009160191602916039160491605916069160791608916099161091611916129161391614916159161691617916189161991620916219162291623916249162591626916279162891629916309163191632916339163491635916369163791638916399164091641916429164391644916459164691647916489164991650916519165291653916549165591656916579165891659916609166191662916639166491665916669166791668916699167091671916729167391674916759167691677916789167991680916819168291683916849168591686916879168891689916909169191692916939169491695916969169791698916999170091701917029170391704917059170691707917089170991710917119171291713917149171591716917179171891719917209172191722917239172491725917269172791728917299173091731917329173391734917359173691737917389173991740917419174291743917449174591746917479174891749917509175191752917539175491755917569175791758917599176091761917629176391764917659176691767917689176991770917719177291773917749177591776917779177891779917809178191782917839178491785917869178791788917899179091791917929179391794917959179691797917989179991800918019180291803918049180591806918079180891809918109181191812918139181491815918169181791818918199182091821918229182391824918259182691827918289182991830918319183291833918349183591836918379183891839918409184191842918439184491845918469184791848918499185091851918529185391854918559185691857918589185991860918619186291863918649186591866918679186891869918709187191872918739187491875918769187791878918799188091881918829188391884918859188691887918889188991890918919189291893918949189591896918979189891899919009190191902919039190491905919069190791908919099191091911919129191391914919159191691917919189191991920919219192291923919249192591926919279192891929919309193191932919339193491935919369193791938919399194091941919429194391944919459194691947919489194991950919519195291953919549195591956919579195891959919609196191962919639196491965919669196791968919699197091971919729197391974919759197691977919789197991980919819198291983919849198591986919879198891989919909199191992919939199491995919969199791998919999200092001920029200392004920059200692007920089200992010920119201292013920149201592016920179201892019920209202192022920239202492025920269202792028920299203092031920329203392034920359203692037920389203992040920419204292043920449204592046920479204892049920509205192052920539205492055920569205792058920599206092061920629206392064920659206692067920689206992070920719207292073920749207592076920779207892079920809208192082920839208492085920869208792088920899209092091920929209392094920959209692097920989209992100921019210292103921049210592106921079210892109921109211192112921139211492115921169211792118921199212092121921229212392124921259212692127921289212992130921319213292133921349213592136921379213892139921409214192142921439214492145921469214792148921499215092151921529215392154921559215692157921589215992160921619216292163921649216592166921679216892169921709217192172921739217492175921769217792178921799218092181921829218392184921859218692187921889218992190921919219292193921949219592196921979219892199922009220192202922039220492205922069220792208922099221092211922129221392214922159221692217922189221992220922219222292223922249222592226922279222892229922309223192232922339223492235922369223792238922399224092241922429224392244922459224692247922489224992250922519225292253922549225592256922579225892259922609226192262922639226492265922669226792268922699227092271922729227392274922759227692277922789227992280922819228292283922849228592286922879228892289922909229192292922939229492295922969229792298922999230092301923029230392304923059230692307923089230992310923119231292313923149231592316923179231892319923209232192322923239232492325923269232792328923299233092331923329233392334923359233692337923389233992340923419234292343923449234592346923479234892349923509235192352923539235492355923569235792358923599236092361923629236392364923659236692367923689236992370923719237292373923749237592376923779237892379923809238192382923839238492385923869238792388923899239092391923929239392394923959239692397923989239992400924019240292403924049240592406924079240892409924109241192412924139241492415924169241792418924199242092421924229242392424924259242692427924289242992430924319243292433924349243592436924379243892439924409244192442924439244492445924469244792448924499245092451924529245392454924559245692457924589245992460924619246292463924649246592466924679246892469924709247192472924739247492475924769247792478924799248092481924829248392484924859248692487924889248992490924919249292493924949249592496924979249892499925009250192502925039250492505925069250792508925099251092511925129251392514925159251692517925189251992520925219252292523925249252592526925279252892529925309253192532925339253492535925369253792538925399254092541925429254392544925459254692547925489254992550925519255292553925549255592556925579255892559925609256192562925639256492565925669256792568925699257092571925729257392574925759257692577925789257992580925819258292583925849258592586925879258892589925909259192592925939259492595925969259792598925999260092601926029260392604926059260692607926089260992610926119261292613926149261592616926179261892619926209262192622926239262492625926269262792628926299263092631926329263392634926359263692637926389263992640926419264292643926449264592646926479264892649926509265192652926539265492655926569265792658926599266092661926629266392664926659266692667926689266992670926719267292673926749267592676926779267892679926809268192682926839268492685926869268792688926899269092691926929269392694926959269692697926989269992700927019270292703927049270592706927079270892709927109271192712927139271492715927169271792718927199272092721927229272392724927259272692727927289272992730927319273292733927349273592736927379273892739927409274192742927439274492745927469274792748927499275092751927529275392754927559275692757927589275992760927619276292763927649276592766927679276892769927709277192772927739277492775927769277792778927799278092781927829278392784927859278692787927889278992790927919279292793927949279592796927979279892799928009280192802928039280492805928069280792808928099281092811928129281392814928159281692817928189281992820928219282292823928249282592826928279282892829928309283192832928339283492835928369283792838928399284092841928429284392844928459284692847928489284992850928519285292853928549285592856928579285892859928609286192862928639286492865928669286792868928699287092871928729287392874928759287692877928789287992880928819288292883928849288592886928879288892889928909289192892928939289492895928969289792898928999290092901929029290392904929059290692907929089290992910929119291292913929149291592916929179291892919929209292192922929239292492925929269292792928929299293092931929329293392934929359293692937929389293992940929419294292943929449294592946929479294892949929509295192952929539295492955929569295792958929599296092961929629296392964929659296692967929689296992970929719297292973929749297592976929779297892979929809298192982929839298492985929869298792988929899299092991929929299392994929959299692997929989299993000930019300293003930049300593006930079300893009930109301193012930139301493015930169301793018930199302093021930229302393024930259302693027930289302993030930319303293033930349303593036930379303893039930409304193042930439304493045930469304793048930499305093051930529305393054930559305693057930589305993060930619306293063930649306593066930679306893069930709307193072930739307493075930769307793078930799308093081930829308393084930859308693087930889308993090930919309293093930949309593096930979309893099931009310193102931039310493105931069310793108931099311093111931129311393114931159311693117931189311993120931219312293123931249312593126931279312893129931309313193132931339313493135931369313793138931399314093141931429314393144931459314693147931489314993150931519315293153931549315593156931579315893159931609316193162931639316493165931669316793168931699317093171931729317393174931759317693177931789317993180931819318293183931849318593186931879318893189931909319193192931939319493195931969319793198931999320093201932029320393204932059320693207932089320993210932119321293213932149321593216932179321893219932209322193222932239322493225932269322793228932299323093231932329323393234932359323693237932389323993240932419324293243932449324593246932479324893249932509325193252932539325493255932569325793258932599326093261932629326393264932659326693267932689326993270932719327293273932749327593276932779327893279932809328193282932839328493285932869328793288932899329093291932929329393294932959329693297932989329993300933019330293303933049330593306933079330893309933109331193312933139331493315933169331793318933199332093321933229332393324933259332693327933289332993330933319333293333933349333593336933379333893339933409334193342933439334493345933469334793348933499335093351933529335393354933559335693357933589335993360933619336293363933649336593366933679336893369933709337193372933739337493375933769337793378933799338093381933829338393384933859338693387933889338993390933919339293393933949339593396933979339893399934009340193402934039340493405934069340793408934099341093411934129341393414934159341693417934189341993420934219342293423934249342593426934279342893429934309343193432934339343493435934369343793438934399344093441934429344393444934459344693447934489344993450934519345293453934549345593456934579345893459934609346193462934639346493465934669346793468934699347093471934729347393474934759347693477934789347993480934819348293483934849348593486934879348893489934909349193492934939349493495934969349793498934999350093501935029350393504935059350693507935089350993510935119351293513935149351593516935179351893519935209352193522935239352493525935269352793528935299353093531935329353393534935359353693537935389353993540935419354293543935449354593546935479354893549935509355193552935539355493555935569355793558935599356093561935629356393564935659356693567935689356993570935719357293573935749357593576935779357893579935809358193582935839358493585935869358793588935899359093591935929359393594935959359693597935989359993600936019360293603936049360593606936079360893609936109361193612936139361493615936169361793618936199362093621936229362393624936259362693627936289362993630936319363293633936349363593636936379363893639936409364193642936439364493645936469364793648936499365093651936529365393654936559365693657936589365993660936619366293663936649366593666936679366893669936709367193672936739367493675936769367793678936799368093681936829368393684936859368693687936889368993690936919369293693936949369593696936979369893699937009370193702937039370493705937069370793708937099371093711937129371393714937159371693717937189371993720937219372293723937249372593726937279372893729937309373193732937339373493735937369373793738937399374093741937429374393744937459374693747937489374993750937519375293753937549375593756937579375893759937609376193762937639376493765937669376793768937699377093771937729377393774937759377693777937789377993780937819378293783937849378593786937879378893789937909379193792937939379493795937969379793798937999380093801938029380393804938059380693807938089380993810938119381293813938149381593816938179381893819938209382193822938239382493825938269382793828938299383093831938329383393834938359383693837938389383993840938419384293843938449384593846938479384893849938509385193852938539385493855938569385793858938599386093861938629386393864938659386693867938689386993870938719387293873938749387593876938779387893879938809388193882938839388493885938869388793888938899389093891938929389393894938959389693897938989389993900939019390293903939049390593906939079390893909939109391193912939139391493915939169391793918939199392093921939229392393924939259392693927939289392993930939319393293933939349393593936939379393893939939409394193942939439394493945939469394793948939499395093951939529395393954939559395693957939589395993960939619396293963939649396593966939679396893969939709397193972939739397493975939769397793978939799398093981939829398393984939859398693987939889398993990939919399293993939949399593996939979399893999940009400194002940039400494005940069400794008940099401094011940129401394014940159401694017940189401994020940219402294023940249402594026940279402894029940309403194032940339403494035940369403794038940399404094041940429404394044940459404694047940489404994050940519405294053940549405594056940579405894059940609406194062940639406494065940669406794068940699407094071940729407394074940759407694077940789407994080940819408294083940849408594086940879408894089940909409194092940939409494095940969409794098940999410094101941029410394104941059410694107941089410994110941119411294113941149411594116941179411894119941209412194122941239412494125941269412794128941299413094131941329413394134941359413694137941389413994140941419414294143941449414594146941479414894149941509415194152941539415494155941569415794158941599416094161941629416394164941659416694167941689416994170941719417294173941749417594176941779417894179941809418194182941839418494185941869418794188941899419094191941929419394194941959419694197941989419994200942019420294203942049420594206942079420894209942109421194212942139421494215942169421794218942199422094221942229422394224942259422694227942289422994230942319423294233942349423594236942379423894239942409424194242942439424494245942469424794248942499425094251942529425394254942559425694257942589425994260942619426294263942649426594266942679426894269942709427194272942739427494275942769427794278942799428094281942829428394284942859428694287942889428994290942919429294293942949429594296942979429894299943009430194302943039430494305943069430794308943099431094311943129431394314943159431694317943189431994320943219432294323943249432594326943279432894329943309433194332943339433494335943369433794338943399434094341943429434394344943459434694347943489434994350943519435294353943549435594356943579435894359943609436194362943639436494365943669436794368943699437094371943729437394374943759437694377943789437994380943819438294383943849438594386943879438894389943909439194392943939439494395943969439794398943999440094401944029440394404944059440694407944089440994410944119441294413944149441594416944179441894419944209442194422944239442494425944269442794428944299443094431944329443394434944359443694437944389443994440944419444294443944449444594446944479444894449944509445194452944539445494455944569445794458944599446094461944629446394464944659446694467944689446994470944719447294473944749447594476944779447894479944809448194482944839448494485944869448794488944899449094491944929449394494944959449694497944989449994500945019450294503945049450594506945079450894509945109451194512945139451494515945169451794518945199452094521945229452394524945259452694527945289452994530945319453294533945349453594536945379453894539945409454194542945439454494545945469454794548945499455094551945529455394554945559455694557945589455994560945619456294563945649456594566945679456894569945709457194572945739457494575945769457794578945799458094581945829458394584945859458694587945889458994590945919459294593945949459594596945979459894599946009460194602946039460494605946069460794608946099461094611946129461394614946159461694617946189461994620946219462294623946249462594626946279462894629946309463194632946339463494635946369463794638946399464094641946429464394644946459464694647946489464994650946519465294653946549465594656946579465894659946609466194662946639466494665946669466794668946699467094671946729467394674946759467694677946789467994680946819468294683946849468594686946879468894689946909469194692946939469494695946969469794698946999470094701947029470394704947059470694707947089470994710947119471294713947149471594716947179471894719947209472194722947239472494725947269472794728947299473094731947329473394734947359473694737947389473994740947419474294743947449474594746947479474894749947509475194752947539475494755947569475794758947599476094761947629476394764947659476694767947689476994770947719477294773947749477594776947779477894779947809478194782947839478494785947869478794788947899479094791947929479394794947959479694797947989479994800948019480294803948049480594806948079480894809948109481194812948139481494815948169481794818948199482094821948229482394824948259482694827948289482994830948319483294833948349483594836948379483894839948409484194842948439484494845948469484794848948499485094851948529485394854948559485694857948589485994860948619486294863948649486594866948679486894869948709487194872948739487494875948769487794878948799488094881948829488394884948859488694887948889488994890948919489294893948949489594896948979489894899949009490194902949039490494905949069490794908949099491094911949129491394914949159491694917949189491994920949219492294923949249492594926949279492894929949309493194932949339493494935949369493794938949399494094941949429494394944949459494694947949489494994950949519495294953949549495594956949579495894959949609496194962949639496494965949669496794968949699497094971949729497394974949759497694977949789497994980949819498294983949849498594986949879498894989949909499194992949939499494995949969499794998949999500095001950029500395004950059500695007950089500995010950119501295013950149501595016950179501895019950209502195022950239502495025950269502795028950299503095031950329503395034950359503695037950389503995040950419504295043950449504595046950479504895049950509505195052950539505495055950569505795058950599506095061950629506395064950659506695067950689506995070950719507295073950749507595076950779507895079950809508195082950839508495085950869508795088950899509095091950929509395094950959509695097950989509995100951019510295103951049510595106951079510895109951109511195112951139511495115951169511795118951199512095121951229512395124951259512695127951289512995130951319513295133951349513595136951379513895139951409514195142951439514495145951469514795148951499515095151951529515395154951559515695157951589515995160951619516295163951649516595166951679516895169951709517195172951739517495175951769517795178951799518095181951829518395184951859518695187951889518995190951919519295193951949519595196951979519895199952009520195202952039520495205952069520795208952099521095211952129521395214952159521695217952189521995220952219522295223952249522595226952279522895229952309523195232952339523495235952369523795238952399524095241952429524395244952459524695247952489524995250952519525295253952549525595256952579525895259952609526195262952639526495265952669526795268952699527095271952729527395274952759527695277952789527995280952819528295283952849528595286952879528895289952909529195292952939529495295952969529795298952999530095301953029530395304953059530695307953089530995310953119531295313953149531595316953179531895319953209532195322953239532495325953269532795328953299533095331953329533395334953359533695337953389533995340953419534295343953449534595346953479534895349953509535195352953539535495355953569535795358953599536095361953629536395364953659536695367953689536995370953719537295373953749537595376953779537895379953809538195382953839538495385953869538795388953899539095391953929539395394953959539695397953989539995400954019540295403954049540595406954079540895409954109541195412954139541495415954169541795418954199542095421954229542395424954259542695427954289542995430954319543295433954349543595436954379543895439954409544195442954439544495445954469544795448954499545095451954529545395454954559545695457954589545995460954619546295463954649546595466954679546895469954709547195472954739547495475954769547795478954799548095481954829548395484954859548695487954889548995490954919549295493954949549595496954979549895499955009550195502955039550495505955069550795508955099551095511955129551395514955159551695517955189551995520955219552295523955249552595526955279552895529955309553195532955339553495535955369553795538955399554095541955429554395544955459554695547955489554995550955519555295553955549555595556955579555895559955609556195562955639556495565955669556795568955699557095571955729557395574955759557695577955789557995580955819558295583955849558595586955879558895589955909559195592955939559495595955969559795598955999560095601956029560395604956059560695607956089560995610956119561295613956149561595616956179561895619956209562195622956239562495625956269562795628956299563095631956329563395634956359563695637956389563995640956419564295643956449564595646956479564895649956509565195652956539565495655956569565795658956599566095661956629566395664956659566695667956689566995670956719567295673956749567595676956779567895679956809568195682956839568495685956869568795688956899569095691956929569395694956959569695697956989569995700957019570295703957049570595706957079570895709957109571195712957139571495715957169571795718957199572095721957229572395724957259572695727957289572995730957319573295733957349573595736957379573895739957409574195742957439574495745957469574795748957499575095751957529575395754957559575695757957589575995760957619576295763957649576595766957679576895769957709577195772957739577495775957769577795778957799578095781957829578395784957859578695787957889578995790957919579295793957949579595796957979579895799958009580195802958039580495805958069580795808958099581095811958129581395814958159581695817958189581995820958219582295823958249582595826958279582895829958309583195832958339583495835958369583795838958399584095841958429584395844958459584695847958489584995850958519585295853958549585595856958579585895859958609586195862958639586495865958669586795868958699587095871958729587395874958759587695877958789587995880958819588295883958849588595886958879588895889958909589195892958939589495895958969589795898958999590095901959029590395904959059590695907959089590995910959119591295913959149591595916959179591895919959209592195922959239592495925959269592795928959299593095931959329593395934959359593695937959389593995940959419594295943959449594595946959479594895949959509595195952959539595495955959569595795958959599596095961959629596395964959659596695967959689596995970959719597295973959749597595976959779597895979959809598195982959839598495985959869598795988959899599095991959929599395994959959599695997959989599996000960019600296003960049600596006960079600896009960109601196012960139601496015960169601796018960199602096021960229602396024960259602696027960289602996030960319603296033960349603596036960379603896039960409604196042960439604496045960469604796048960499605096051960529605396054960559605696057960589605996060960619606296063960649606596066960679606896069960709607196072960739607496075960769607796078960799608096081960829608396084960859608696087960889608996090960919609296093960949609596096960979609896099961009610196102961039610496105961069610796108961099611096111961129611396114961159611696117961189611996120961219612296123961249612596126961279612896129961309613196132961339613496135961369613796138961399614096141961429614396144961459614696147961489614996150961519615296153961549615596156961579615896159961609616196162961639616496165961669616796168961699617096171961729617396174961759617696177961789617996180961819618296183961849618596186961879618896189961909619196192961939619496195961969619796198961999620096201962029620396204962059620696207962089620996210962119621296213962149621596216962179621896219962209622196222962239622496225962269622796228962299623096231962329623396234962359623696237962389623996240962419624296243962449624596246962479624896249962509625196252962539625496255962569625796258962599626096261962629626396264962659626696267962689626996270962719627296273962749627596276962779627896279962809628196282962839628496285962869628796288962899629096291962929629396294962959629696297962989629996300963019630296303963049630596306963079630896309963109631196312963139631496315963169631796318963199632096321963229632396324963259632696327963289632996330963319633296333963349633596336963379633896339963409634196342963439634496345963469634796348963499635096351963529635396354963559635696357963589635996360963619636296363963649636596366963679636896369963709637196372963739637496375963769637796378963799638096381963829638396384963859638696387963889638996390963919639296393963949639596396963979639896399964009640196402964039640496405964069640796408964099641096411964129641396414964159641696417964189641996420964219642296423964249642596426964279642896429964309643196432964339643496435964369643796438964399644096441964429644396444964459644696447964489644996450964519645296453964549645596456964579645896459964609646196462964639646496465964669646796468964699647096471964729647396474964759647696477964789647996480964819648296483964849648596486964879648896489964909649196492964939649496495964969649796498964999650096501965029650396504965059650696507965089650996510965119651296513965149651596516965179651896519965209652196522965239652496525965269652796528965299653096531965329653396534965359653696537965389653996540965419654296543965449654596546965479654896549965509655196552965539655496555965569655796558965599656096561965629656396564965659656696567965689656996570965719657296573965749657596576965779657896579965809658196582965839658496585965869658796588965899659096591965929659396594965959659696597965989659996600966019660296603966049660596606966079660896609966109661196612966139661496615966169661796618966199662096621966229662396624966259662696627966289662996630966319663296633966349663596636966379663896639966409664196642966439664496645966469664796648966499665096651966529665396654966559665696657966589665996660966619666296663966649666596666966679666896669966709667196672966739667496675966769667796678966799668096681966829668396684966859668696687966889668996690966919669296693966949669596696966979669896699967009670196702967039670496705967069670796708967099671096711967129671396714967159671696717967189671996720967219672296723967249672596726967279672896729967309673196732967339673496735967369673796738967399674096741967429674396744967459674696747967489674996750967519675296753967549675596756967579675896759967609676196762967639676496765967669676796768967699677096771967729677396774967759677696777967789677996780967819678296783967849678596786967879678896789967909679196792967939679496795967969679796798967999680096801968029680396804968059680696807968089680996810968119681296813968149681596816968179681896819968209682196822968239682496825968269682796828968299683096831968329683396834968359683696837968389683996840968419684296843968449684596846968479684896849968509685196852968539685496855968569685796858968599686096861968629686396864968659686696867968689686996870968719687296873968749687596876968779687896879968809688196882968839688496885968869688796888968899689096891968929689396894968959689696897968989689996900969019690296903969049690596906969079690896909969109691196912969139691496915969169691796918969199692096921969229692396924969259692696927969289692996930969319693296933969349693596936969379693896939969409694196942969439694496945969469694796948969499695096951969529695396954969559695696957969589695996960969619696296963969649696596966969679696896969969709697196972969739697496975969769697796978969799698096981969829698396984969859698696987969889698996990969919699296993969949699596996969979699896999970009700197002970039700497005970069700797008970099701097011970129701397014970159701697017970189701997020970219702297023970249702597026970279702897029970309703197032970339703497035970369703797038970399704097041970429704397044970459704697047970489704997050970519705297053970549705597056970579705897059970609706197062970639706497065970669706797068970699707097071970729707397074970759707697077970789707997080970819708297083970849708597086970879708897089970909709197092970939709497095970969709797098970999710097101971029710397104971059710697107971089710997110971119711297113971149711597116971179711897119971209712197122971239712497125971269712797128971299713097131971329713397134971359713697137971389713997140971419714297143971449714597146971479714897149971509715197152971539715497155971569715797158971599716097161971629716397164971659716697167971689716997170971719717297173971749717597176971779717897179971809718197182971839718497185971869718797188971899719097191971929719397194971959719697197971989719997200972019720297203972049720597206972079720897209972109721197212972139721497215972169721797218972199722097221972229722397224972259722697227972289722997230972319723297233972349723597236972379723897239972409724197242972439724497245972469724797248972499725097251972529725397254972559725697257972589725997260972619726297263972649726597266972679726897269972709727197272972739727497275972769727797278972799728097281972829728397284972859728697287972889728997290972919729297293972949729597296972979729897299973009730197302973039730497305973069730797308973099731097311973129731397314973159731697317973189731997320973219732297323973249732597326973279732897329973309733197332973339733497335973369733797338973399734097341973429734397344973459734697347973489734997350973519735297353973549735597356973579735897359973609736197362973639736497365973669736797368973699737097371973729737397374973759737697377973789737997380973819738297383973849738597386973879738897389973909739197392973939739497395973969739797398973999740097401974029740397404974059740697407974089740997410974119741297413974149741597416974179741897419974209742197422974239742497425974269742797428974299743097431974329743397434974359743697437974389743997440974419744297443974449744597446974479744897449974509745197452974539745497455974569745797458974599746097461974629746397464974659746697467974689746997470974719747297473974749747597476974779747897479974809748197482974839748497485974869748797488974899749097491974929749397494974959749697497974989749997500975019750297503975049750597506975079750897509975109751197512975139751497515975169751797518975199752097521975229752397524975259752697527975289752997530975319753297533975349753597536975379753897539975409754197542975439754497545975469754797548975499755097551975529755397554975559755697557975589755997560975619756297563975649756597566975679756897569975709757197572975739757497575975769757797578975799758097581975829758397584975859758697587975889758997590975919759297593975949759597596975979759897599976009760197602976039760497605976069760797608976099761097611976129761397614976159761697617976189761997620976219762297623976249762597626976279762897629976309763197632976339763497635976369763797638976399764097641976429764397644976459764697647976489764997650976519765297653976549765597656976579765897659976609766197662976639766497665976669766797668976699767097671976729767397674976759767697677976789767997680976819768297683976849768597686976879768897689976909769197692976939769497695976969769797698976999770097701977029770397704977059770697707977089770997710977119771297713977149771597716977179771897719977209772197722977239772497725977269772797728977299773097731977329773397734977359773697737977389773997740977419774297743977449774597746977479774897749977509775197752977539775497755977569775797758977599776097761977629776397764977659776697767977689776997770977719777297773977749777597776977779777897779977809778197782977839778497785977869778797788977899779097791977929779397794977959779697797977989779997800978019780297803978049780597806978079780897809978109781197812978139781497815978169781797818978199782097821978229782397824978259782697827978289782997830978319783297833978349783597836978379783897839978409784197842978439784497845978469784797848978499785097851978529785397854978559785697857978589785997860978619786297863978649786597866978679786897869978709787197872978739787497875978769787797878978799788097881978829788397884978859788697887978889788997890978919789297893978949789597896978979789897899979009790197902979039790497905979069790797908979099791097911979129791397914979159791697917979189791997920979219792297923979249792597926979279792897929979309793197932979339793497935979369793797938979399794097941979429794397944979459794697947979489794997950979519795297953979549795597956979579795897959979609796197962979639796497965979669796797968979699797097971979729797397974979759797697977979789797997980979819798297983979849798597986979879798897989979909799197992979939799497995979969799797998979999800098001980029800398004980059800698007980089800998010980119801298013980149801598016980179801898019980209802198022980239802498025980269802798028980299803098031980329803398034980359803698037980389803998040980419804298043980449804598046980479804898049980509805198052980539805498055980569805798058980599806098061980629806398064980659806698067980689806998070980719807298073980749807598076980779807898079980809808198082980839808498085980869808798088980899809098091980929809398094980959809698097980989809998100981019810298103981049810598106981079810898109981109811198112981139811498115981169811798118981199812098121981229812398124981259812698127981289812998130981319813298133981349813598136981379813898139981409814198142981439814498145981469814798148981499815098151981529815398154981559815698157981589815998160981619816298163981649816598166981679816898169981709817198172981739817498175981769817798178981799818098181981829818398184981859818698187981889818998190981919819298193981949819598196981979819898199982009820198202982039820498205982069820798208982099821098211982129821398214982159821698217982189821998220982219822298223982249822598226982279822898229982309823198232982339823498235982369823798238982399824098241982429824398244982459824698247982489824998250982519825298253982549825598256982579825898259982609826198262982639826498265982669826798268982699827098271982729827398274982759827698277982789827998280982819828298283982849828598286982879828898289982909829198292982939829498295982969829798298982999830098301983029830398304983059830698307983089830998310983119831298313983149831598316983179831898319983209832198322983239832498325983269832798328983299833098331983329833398334983359833698337983389833998340983419834298343983449834598346983479834898349983509835198352983539835498355983569835798358983599836098361983629836398364983659836698367983689836998370983719837298373983749837598376983779837898379983809838198382983839838498385983869838798388983899839098391983929839398394983959839698397983989839998400984019840298403984049840598406984079840898409984109841198412984139841498415984169841798418984199842098421984229842398424984259842698427984289842998430984319843298433984349843598436984379843898439984409844198442984439844498445984469844798448984499845098451984529845398454984559845698457984589845998460984619846298463984649846598466984679846898469984709847198472984739847498475984769847798478984799848098481984829848398484984859848698487984889848998490984919849298493984949849598496984979849898499985009850198502985039850498505985069850798508985099851098511985129851398514985159851698517985189851998520985219852298523985249852598526985279852898529985309853198532985339853498535985369853798538985399854098541985429854398544985459854698547985489854998550985519855298553985549855598556985579855898559985609856198562985639856498565985669856798568985699857098571985729857398574985759857698577985789857998580985819858298583985849858598586985879858898589985909859198592985939859498595985969859798598985999860098601986029860398604986059860698607986089860998610986119861298613986149861598616986179861898619986209862198622986239862498625986269862798628986299863098631986329863398634986359863698637986389863998640986419864298643986449864598646986479864898649986509865198652986539865498655986569865798658986599866098661986629866398664986659866698667986689866998670986719867298673986749867598676986779867898679986809868198682986839868498685986869868798688986899869098691986929869398694986959869698697986989869998700987019870298703987049870598706987079870898709987109871198712987139871498715987169871798718987199872098721987229872398724987259872698727987289872998730987319873298733987349873598736987379873898739987409874198742987439874498745987469874798748987499875098751987529875398754987559875698757987589875998760987619876298763987649876598766987679876898769987709877198772987739877498775987769877798778987799878098781987829878398784987859878698787987889878998790987919879298793987949879598796987979879898799988009880198802988039880498805988069880798808988099881098811988129881398814988159881698817988189881998820988219882298823988249882598826988279882898829988309883198832988339883498835988369883798838988399884098841988429884398844988459884698847988489884998850988519885298853988549885598856988579885898859988609886198862988639886498865988669886798868988699887098871988729887398874988759887698877988789887998880988819888298883988849888598886988879888898889988909889198892988939889498895988969889798898988999890098901989029890398904989059890698907989089890998910989119891298913989149891598916989179891898919989209892198922989239892498925989269892798928989299893098931989329893398934989359893698937989389893998940989419894298943989449894598946989479894898949989509895198952989539895498955989569895798958989599896098961989629896398964989659896698967989689896998970989719897298973989749897598976989779897898979989809898198982989839898498985989869898798988989899899098991989929899398994989959899698997989989899999000990019900299003990049900599006990079900899009990109901199012990139901499015990169901799018990199902099021990229902399024990259902699027990289902999030990319903299033990349903599036990379903899039990409904199042990439904499045990469904799048990499905099051990529905399054990559905699057990589905999060990619906299063990649906599066990679906899069990709907199072990739907499075990769907799078990799908099081990829908399084990859908699087990889908999090990919909299093990949909599096990979909899099991009910199102991039910499105991069910799108991099911099111991129911399114991159911699117991189911999120991219912299123991249912599126991279912899129991309913199132991339913499135991369913799138991399914099141991429914399144991459914699147991489914999150991519915299153991549915599156991579915899159991609916199162991639916499165991669916799168991699917099171991729917399174991759917699177991789917999180991819918299183991849918599186991879918899189991909919199192991939919499195991969919799198991999920099201992029920399204992059920699207992089920999210992119921299213992149921599216992179921899219992209922199222992239922499225992269922799228992299923099231992329923399234992359923699237992389923999240992419924299243992449924599246992479924899249992509925199252992539925499255992569925799258992599926099261992629926399264992659926699267992689926999270992719927299273992749927599276992779927899279992809928199282992839928499285992869928799288992899929099291992929929399294992959929699297992989929999300993019930299303993049930599306993079930899309993109931199312993139931499315993169931799318993199932099321993229932399324993259932699327993289932999330993319933299333993349933599336993379933899339993409934199342993439934499345993469934799348993499935099351993529935399354993559935699357993589935999360993619936299363993649936599366993679936899369993709937199372993739937499375993769937799378993799938099381993829938399384993859938699387993889938999390993919939299393993949939599396993979939899399994009940199402994039940499405994069940799408994099941099411994129941399414994159941699417994189941999420994219942299423994249942599426994279942899429994309943199432994339943499435994369943799438994399944099441994429944399444994459944699447994489944999450994519945299453994549945599456994579945899459994609946199462994639946499465994669946799468994699947099471994729947399474994759947699477994789947999480994819948299483994849948599486994879948899489994909949199492994939949499495994969949799498994999950099501995029950399504995059950699507995089950999510995119951299513995149951599516995179951899519995209952199522995239952499525995269952799528995299953099531995329953399534995359953699537995389953999540995419954299543995449954599546995479954899549995509955199552995539955499555995569955799558995599956099561995629956399564995659956699567995689956999570995719957299573995749957599576995779957899579995809958199582995839958499585995869958799588995899959099591995929959399594995959959699597995989959999600996019960299603996049960599606996079960899609996109961199612996139961499615996169961799618996199962099621996229962399624996259962699627996289962999630996319963299633996349963599636996379963899639996409964199642996439964499645996469964799648996499965099651996529965399654996559965699657996589965999660996619966299663996649966599666996679966899669996709967199672996739967499675996769967799678996799968099681996829968399684996859968699687996889968999690996919969299693996949969599696996979969899699997009970199702997039970499705997069970799708997099971099711997129971399714997159971699717997189971999720997219972299723997249972599726997279972899729997309973199732997339973499735997369973799738997399974099741997429974399744997459974699747997489974999750997519975299753997549975599756997579975899759997609976199762997639976499765997669976799768997699977099771997729977399774997759977699777997789977999780997819978299783997849978599786997879978899789997909979199792997939979499795997969979799798997999980099801998029980399804998059980699807998089980999810998119981299813998149981599816998179981899819998209982199822998239982499825998269982799828998299983099831998329983399834998359983699837998389983999840998419984299843998449984599846998479984899849998509985199852998539985499855998569985799858998599986099861998629986399864998659986699867998689986999870998719987299873998749987599876998779987899879998809988199882998839988499885998869988799888998899989099891998929989399894998959989699897998989989999900999019990299903999049990599906999079990899909999109991199912999139991499915999169991799918999199992099921999229992399924999259992699927999289992999930999319993299933999349993599936999379993899939999409994199942999439994499945999469994799948999499995099951999529995399954999559995699957999589995999960999619996299963999649996599966999679996899969999709997199972999739997499975999769997799978999799998099981999829998399984999859998699987999889998999990999919999299993999949999599996999979999899999100000100001100002100003100004100005100006100007100008100009100010100011100012100013100014100015100016100017100018100019100020100021100022100023100024100025100026100027100028100029100030100031100032100033100034100035100036100037100038100039100040100041100042100043100044100045100046100047100048100049100050100051100052100053100054100055100056100057100058100059100060100061100062100063100064100065100066100067100068100069100070100071100072100073100074100075100076100077100078100079100080100081100082100083100084100085100086100087100088100089100090100091100092100093100094100095100096100097100098100099100100100101100102100103100104100105100106100107100108100109100110100111100112100113100114100115100116100117100118100119100120100121100122100123100124100125100126100127100128100129100130100131100132100133100134100135100136100137100138100139100140100141100142100143100144100145100146100147100148100149100150100151100152100153100154100155100156100157100158100159100160100161100162100163100164100165100166100167100168100169100170100171100172100173100174100175100176100177100178100179100180100181100182100183100184100185100186100187100188100189100190100191100192100193100194100195100196100197100198100199100200100201100202100203100204100205100206100207100208100209100210100211100212100213100214100215100216100217100218100219100220100221100222100223100224100225100226100227100228100229100230100231100232100233100234100235100236100237100238100239100240100241100242100243100244100245100246100247100248100249100250100251100252100253100254100255100256100257100258100259100260100261100262100263100264100265100266100267100268100269100270100271100272100273100274100275100276100277100278100279100280100281100282100283100284100285100286100287100288100289100290100291100292100293100294100295100296100297100298100299100300100301100302100303100304100305100306100307100308100309100310100311100312100313100314100315100316100317100318100319100320100321100322100323100324100325100326100327100328100329100330100331100332100333100334100335100336100337100338100339100340100341100342100343100344100345100346100347100348100349100350100351100352100353100354100355100356100357100358100359100360100361100362100363100364100365100366100367100368100369100370100371100372100373100374100375100376100377100378100379100380100381100382100383100384100385100386100387100388100389100390100391100392100393100394100395100396100397100398100399100400100401100402100403100404100405100406100407100408100409100410100411100412100413100414100415100416100417100418100419100420100421100422100423100424100425100426100427100428100429100430100431100432100433100434100435100436100437100438100439100440100441100442100443100444100445100446100447100448100449100450100451100452100453100454100455100456100457100458100459100460100461100462100463100464100465100466100467100468100469100470100471100472100473100474100475100476100477100478100479100480100481100482100483100484100485100486100487100488100489100490100491100492100493100494100495100496100497100498100499100500100501100502100503100504100505100506100507100508100509100510100511100512100513100514100515100516100517100518100519100520100521100522100523100524100525100526100527100528100529100530100531100532100533100534100535100536100537100538100539100540100541100542100543100544100545100546100547100548100549100550100551100552100553100554100555100556100557100558100559100560100561100562100563100564100565100566100567100568100569100570100571100572100573100574100575100576100577100578100579100580100581100582100583100584100585100586100587100588100589100590100591100592100593100594100595100596100597100598100599100600100601100602100603100604100605100606100607100608100609100610100611100612100613100614100615100616100617100618100619100620100621100622100623100624100625100626100627100628100629100630100631100632100633100634100635100636100637100638100639100640100641100642100643100644100645100646100647100648100649100650100651100652100653100654100655100656100657100658100659100660100661100662100663100664100665100666100667100668100669100670100671100672100673100674100675100676100677100678100679100680100681100682100683100684100685100686100687100688100689100690100691100692100693100694100695100696100697100698100699100700100701100702100703100704100705100706100707100708100709100710100711100712100713100714100715100716100717100718100719100720100721100722100723100724100725100726100727100728100729100730100731100732100733100734100735100736100737100738100739100740100741100742100743100744100745100746100747100748100749100750100751100752100753100754100755100756100757100758100759100760100761100762100763100764100765100766100767100768100769100770100771100772100773100774100775100776100777100778100779100780100781100782100783100784100785100786100787100788100789100790100791100792100793100794100795100796100797100798100799100800100801100802100803100804100805100806100807100808100809100810100811100812100813100814100815100816100817100818100819100820100821100822100823100824100825100826100827100828100829100830100831100832100833100834100835100836100837100838100839100840100841100842100843100844100845100846100847100848100849100850100851100852100853100854100855100856100857100858100859100860100861100862100863100864100865100866100867100868100869100870100871100872100873100874100875100876100877100878100879100880100881100882100883100884100885100886100887100888100889100890100891100892100893100894100895100896100897100898100899100900100901100902100903100904100905100906100907100908100909100910100911100912100913100914100915100916100917100918100919100920100921100922100923100924100925100926100927100928100929100930100931100932100933100934100935100936100937100938100939100940100941100942100943100944100945100946100947100948100949100950100951100952100953100954100955100956100957100958100959100960100961100962100963100964100965100966100967100968100969100970100971100972100973100974100975100976100977100978100979100980100981100982100983100984100985100986100987100988100989100990100991100992100993100994100995100996100997100998100999101000101001101002101003101004101005101006101007101008101009101010101011101012101013101014101015101016101017101018101019101020101021101022101023101024101025101026101027101028101029101030101031101032101033101034101035101036101037101038101039101040101041101042101043101044101045101046101047101048101049101050101051101052101053101054101055101056101057101058101059101060101061101062101063101064101065101066101067101068101069101070101071101072101073101074101075101076101077101078101079101080101081101082101083101084101085101086101087101088101089101090101091101092101093101094101095101096101097101098101099101100101101101102101103101104101105101106101107101108101109101110101111101112101113101114101115101116101117101118101119101120101121101122101123101124101125101126101127101128101129101130101131101132101133101134101135101136101137101138101139101140101141101142101143101144101145101146101147101148101149101150101151101152101153101154101155101156101157101158101159101160101161101162101163101164101165101166101167101168101169101170101171101172101173101174101175101176101177101178101179101180101181101182101183101184101185101186101187101188101189101190101191101192101193101194101195101196101197101198101199101200101201101202101203101204101205101206101207101208101209101210101211101212101213101214101215101216101217101218101219101220101221101222101223101224101225101226101227101228101229101230101231101232101233101234101235101236101237101238101239101240101241101242101243101244101245101246101247101248101249101250101251101252101253101254101255101256101257101258101259101260101261101262101263101264101265101266101267101268101269101270101271101272101273101274101275101276101277101278101279101280101281101282101283101284101285101286101287101288101289101290101291101292101293101294101295101296101297101298101299101300101301101302101303101304101305101306101307101308101309101310101311101312101313101314101315101316101317101318101319101320101321101322101323101324101325101326101327101328101329101330101331101332101333101334101335101336101337101338101339101340101341101342101343101344101345101346101347101348101349101350101351101352101353101354101355101356101357101358101359101360101361101362101363101364101365101366101367101368101369101370101371101372101373101374101375101376101377101378101379101380101381101382101383101384101385101386101387101388101389101390101391101392101393101394101395101396101397101398101399101400101401101402101403101404101405101406101407101408101409101410101411101412101413101414101415101416101417101418101419101420101421101422101423101424101425101426101427101428101429101430101431101432101433101434101435101436101437101438101439101440101441101442101443101444101445101446101447101448101449101450101451101452101453101454101455101456101457101458101459101460101461101462101463101464101465101466101467101468101469101470101471101472101473101474101475101476101477101478101479101480101481101482101483101484101485101486101487101488101489101490101491101492101493101494101495101496101497101498101499101500101501101502101503101504101505101506101507101508101509101510101511101512101513101514101515101516101517101518101519101520101521101522101523101524101525101526101527101528101529101530101531101532101533101534101535101536101537101538101539101540101541101542101543101544101545101546101547101548101549101550101551101552101553101554101555101556101557101558101559101560101561101562101563101564101565101566101567101568101569101570101571101572101573101574101575101576101577101578101579101580101581101582101583101584101585101586101587101588101589101590101591101592101593101594101595101596101597101598101599101600101601101602101603101604101605101606101607101608101609101610101611101612101613101614101615101616101617101618101619101620101621101622101623101624101625101626101627101628101629101630101631101632101633101634101635101636101637101638101639101640101641101642101643101644101645101646101647101648101649101650101651101652101653101654101655101656101657101658101659101660101661101662101663101664101665101666101667101668101669101670101671101672101673101674101675101676101677101678101679101680101681101682101683101684101685101686101687101688101689101690101691101692101693101694101695101696101697101698101699101700101701101702101703101704101705101706101707101708101709101710101711101712101713101714101715101716101717101718101719101720101721101722101723101724101725101726101727101728101729101730101731101732101733101734101735101736101737101738101739101740101741101742101743101744101745101746101747101748101749101750101751101752101753101754101755101756101757101758101759101760101761101762101763101764101765101766101767101768101769101770101771101772101773101774101775101776101777101778101779101780101781101782101783101784101785101786101787101788101789101790101791101792101793101794101795101796101797101798101799101800101801101802101803101804101805101806101807101808101809101810101811101812101813101814101815101816101817101818101819101820101821101822101823101824101825101826101827101828101829101830101831101832101833101834101835101836101837101838101839101840101841101842101843101844101845101846101847101848101849101850101851101852101853101854101855101856101857101858101859101860101861101862101863101864101865101866101867101868101869101870101871101872101873101874101875101876101877101878101879101880101881101882101883101884101885101886101887101888101889101890101891101892101893101894101895101896101897101898101899101900101901101902101903101904101905101906101907101908101909101910101911101912101913101914101915101916101917101918101919101920101921101922101923101924101925101926101927101928101929101930101931101932101933101934101935101936101937101938101939101940101941101942101943101944101945101946101947101948101949101950101951101952101953101954101955101956101957101958101959101960101961101962101963101964101965101966101967101968101969101970101971101972101973101974101975101976101977101978101979101980101981101982101983101984101985101986101987101988101989101990101991101992101993101994101995101996101997101998101999102000102001102002102003102004102005102006102007102008102009102010102011102012102013102014102015102016102017102018102019102020102021102022102023102024102025102026102027102028102029102030102031102032102033102034102035102036102037102038102039102040102041102042102043102044102045102046102047102048102049102050102051102052102053102054102055102056102057102058102059102060102061102062102063102064102065102066102067102068102069102070102071102072102073102074102075102076102077102078102079102080102081102082102083102084102085102086102087102088102089102090102091102092102093102094102095102096102097102098102099102100102101102102102103102104102105102106102107102108102109102110102111102112102113102114102115102116102117102118102119102120102121102122102123102124102125102126102127102128102129102130102131102132102133102134102135102136102137102138102139102140102141102142102143102144102145102146102147102148102149102150102151102152102153102154102155102156102157102158102159102160102161102162102163102164102165102166102167102168102169102170102171102172102173102174102175102176102177102178102179102180102181102182102183102184102185102186102187102188102189102190102191102192102193102194102195102196102197102198102199102200102201102202102203102204102205102206102207102208102209102210102211102212102213102214102215102216102217102218102219102220102221102222102223102224102225102226102227102228102229102230102231102232102233102234102235102236102237102238102239102240102241102242102243102244102245102246102247102248102249102250102251102252102253102254102255102256102257102258102259102260102261102262102263102264102265102266102267102268102269102270102271102272102273102274102275102276102277102278102279102280102281102282102283102284102285102286102287102288102289102290102291102292102293102294102295102296102297102298102299102300102301102302102303102304102305102306102307102308102309102310102311102312102313102314102315102316102317102318102319102320102321102322102323102324102325102326102327102328102329102330102331102332102333102334102335102336102337102338102339102340102341102342102343102344102345102346102347102348102349102350102351102352102353102354102355102356102357102358102359102360102361102362102363102364102365102366102367102368102369102370102371102372102373102374102375102376102377102378102379102380102381102382102383102384102385102386102387102388102389102390102391102392102393102394102395102396102397102398102399102400102401102402102403102404102405102406102407102408102409102410102411102412102413102414102415102416102417102418102419102420102421102422102423102424102425102426102427102428102429102430102431102432102433102434102435102436102437102438102439102440102441102442102443102444102445102446102447102448102449102450102451102452102453102454102455102456102457102458102459102460102461102462102463102464102465102466102467102468102469102470102471102472102473102474102475102476102477102478102479102480102481102482102483102484102485102486102487102488102489102490102491102492102493102494102495102496102497102498102499102500102501102502102503102504102505102506102507102508102509102510102511102512102513102514102515102516102517102518102519102520102521102522102523102524102525102526102527102528102529102530102531102532102533102534102535102536102537102538102539102540102541102542102543102544102545102546102547102548102549102550102551102552102553102554102555102556102557102558102559102560102561102562102563102564102565102566102567102568102569102570102571102572102573102574102575102576102577102578102579102580102581102582102583102584102585102586102587102588102589102590102591102592102593102594102595102596102597102598102599102600102601102602102603102604102605102606102607102608102609102610102611102612102613102614102615102616102617102618102619102620102621102622102623102624102625102626102627102628102629102630102631102632102633102634102635102636102637102638102639102640102641102642102643102644102645102646102647102648102649102650102651102652102653102654102655102656102657102658102659102660102661102662102663102664102665102666102667102668102669102670102671102672102673102674102675102676102677102678102679102680102681102682102683102684102685102686102687102688102689102690102691102692102693102694102695102696102697102698102699102700102701102702102703102704102705102706102707102708102709102710102711102712102713102714102715102716102717102718102719102720102721102722102723102724102725102726102727102728102729102730102731102732102733102734102735102736102737102738102739102740102741102742102743102744102745102746102747102748102749102750102751102752102753102754102755102756102757102758102759102760102761102762102763102764102765102766102767102768102769102770102771102772102773102774102775102776102777102778102779102780102781102782102783102784102785102786102787102788102789102790102791102792102793102794102795102796102797102798102799102800102801102802102803102804102805102806102807102808102809102810102811102812102813102814102815102816102817102818102819102820102821102822102823102824102825102826102827102828102829102830102831102832102833102834102835102836102837102838102839102840102841102842102843102844102845102846102847102848102849102850102851102852102853102854102855102856102857102858102859102860102861102862102863102864102865102866102867102868102869102870102871102872102873102874102875102876102877102878102879102880102881102882102883102884102885102886102887102888102889102890102891102892102893102894102895102896102897102898102899102900102901102902102903102904102905102906102907102908102909102910102911102912102913102914102915102916102917102918102919102920102921102922102923102924102925102926102927102928102929102930102931102932102933102934102935102936102937102938102939102940102941102942102943102944102945102946102947102948102949102950102951102952102953102954102955102956102957102958102959102960102961102962102963102964102965102966102967102968102969102970102971102972102973102974102975102976102977102978102979102980102981102982102983102984102985102986102987102988102989102990102991102992102993102994102995102996102997102998102999103000103001103002103003103004103005103006103007103008103009103010103011103012103013103014103015103016103017103018103019103020103021103022103023103024103025103026103027103028103029103030103031103032103033103034103035103036103037103038103039103040103041103042103043103044103045103046103047103048103049103050103051103052103053103054103055103056103057103058103059103060103061103062103063103064103065103066103067103068103069103070103071103072103073103074103075103076103077103078103079103080103081103082103083103084103085103086103087103088103089103090103091103092103093103094103095103096103097103098103099103100103101103102103103103104103105103106103107103108103109103110103111103112103113103114103115103116103117103118103119103120103121103122103123103124103125103126103127103128103129103130103131103132103133103134103135103136103137103138103139103140103141103142103143103144103145103146103147103148103149103150103151103152103153103154103155103156103157103158103159103160103161103162103163103164103165103166103167103168103169103170103171103172103173103174103175103176103177103178103179103180103181103182103183103184103185103186103187103188103189103190103191103192103193103194103195103196103197103198103199103200103201103202103203103204103205103206103207103208103209103210103211103212103213103214103215103216103217103218103219103220103221103222103223103224103225103226103227103228103229103230103231103232103233103234103235103236103237103238103239103240103241103242103243103244103245103246103247103248103249103250103251103252103253103254103255103256103257103258103259103260103261103262103263103264103265103266103267103268103269103270103271103272103273103274103275103276103277103278103279103280103281103282103283103284103285103286103287103288103289103290103291103292103293103294103295103296103297103298103299103300103301103302103303103304103305103306103307103308103309103310103311103312103313103314103315103316103317103318103319103320103321103322103323103324103325103326103327103328103329103330103331103332103333103334103335103336103337103338103339103340103341103342103343103344103345103346103347103348103349103350103351103352103353103354103355103356103357103358103359103360103361103362103363103364103365103366103367103368103369103370103371103372103373103374103375103376103377103378103379103380103381103382103383103384103385103386103387103388103389103390103391103392103393103394103395103396103397103398103399103400103401103402103403103404103405103406103407103408103409103410103411103412103413103414103415103416103417103418103419103420103421103422103423103424103425103426103427103428103429103430103431103432103433103434103435103436103437103438103439103440103441103442103443103444103445103446103447103448103449103450103451103452103453103454103455103456103457103458103459103460103461103462103463103464103465103466103467103468103469103470103471103472103473103474103475103476103477103478103479103480103481103482103483103484103485103486103487103488103489103490103491103492103493103494103495103496103497103498103499103500103501103502103503103504103505103506103507103508103509103510103511103512103513103514103515103516103517103518103519103520103521103522103523103524103525103526103527103528103529103530103531103532103533103534103535103536103537103538103539103540103541103542103543103544103545103546103547103548103549103550103551103552103553103554103555103556103557103558103559103560103561103562103563103564103565103566103567103568103569103570103571103572103573103574103575103576103577103578103579103580103581103582103583103584103585103586103587103588103589103590103591103592103593103594103595103596103597103598103599103600103601103602103603103604103605103606103607103608103609103610103611103612103613103614103615103616103617103618103619103620103621103622103623103624103625103626103627103628103629103630103631103632103633103634103635103636103637103638103639103640103641103642103643103644103645103646103647103648103649103650103651103652103653103654103655103656103657103658103659103660103661103662103663103664103665103666103667103668103669103670103671103672103673103674103675103676103677103678103679103680103681103682103683103684103685103686103687103688103689103690103691103692103693103694103695103696103697103698103699103700103701103702103703103704103705103706103707103708103709103710103711103712103713103714103715103716103717103718103719103720103721103722103723103724103725103726103727103728103729103730103731103732103733103734103735103736103737103738103739103740103741103742103743103744103745103746103747103748103749103750103751103752103753103754103755103756103757103758103759103760103761103762103763103764103765103766103767103768103769103770103771103772103773103774103775103776103777103778103779103780103781103782103783103784103785103786103787103788103789103790103791103792103793103794103795103796103797103798103799103800103801103802103803103804103805103806103807103808103809103810103811103812103813103814103815103816103817103818103819103820103821103822103823103824103825103826103827103828103829103830103831103832103833103834103835103836103837103838103839103840103841103842103843103844103845103846103847103848103849103850103851103852103853103854103855103856103857103858103859103860103861103862103863103864103865103866103867103868103869103870103871103872103873103874103875103876103877103878103879103880103881103882103883103884103885103886103887103888103889103890103891103892103893103894103895103896103897103898103899103900103901103902103903103904103905103906103907103908103909103910103911103912103913103914103915103916103917103918103919103920103921103922103923103924103925103926103927103928103929103930103931103932103933103934103935103936103937103938103939103940103941103942103943103944103945103946103947103948103949103950103951103952103953103954103955103956103957103958103959103960103961103962103963103964103965103966103967103968103969103970103971103972103973103974103975103976103977103978103979103980103981103982103983103984103985103986103987103988103989103990103991103992103993103994103995103996103997103998103999104000104001104002104003104004104005104006104007104008104009104010104011104012104013104014104015104016104017104018104019104020104021104022104023104024104025104026104027104028104029104030104031104032104033104034104035104036104037104038104039104040104041104042104043104044104045104046104047104048104049104050104051104052104053104054104055104056104057104058104059104060104061104062104063104064104065104066104067104068104069104070104071104072104073104074104075104076104077104078104079104080104081104082104083104084104085104086104087104088104089104090104091104092104093104094104095104096104097104098104099104100104101104102104103104104104105104106104107104108104109104110104111104112104113104114104115104116104117104118104119104120104121104122104123104124104125104126104127104128104129104130104131104132104133104134104135104136104137104138104139104140104141104142104143104144104145104146104147104148104149104150104151104152104153104154104155104156104157104158104159104160104161104162104163104164104165104166104167104168104169104170104171104172104173104174104175104176104177104178104179104180104181104182104183104184104185104186104187104188104189104190104191104192104193104194104195104196104197104198104199104200104201104202104203104204104205104206104207104208104209104210104211104212104213104214104215104216104217104218104219104220104221104222104223104224104225104226104227104228104229104230104231104232104233104234104235104236104237104238104239104240104241104242104243104244104245104246104247104248104249104250104251104252104253104254104255104256104257104258104259104260104261104262104263104264104265104266104267104268104269104270104271104272104273104274104275104276104277104278104279104280104281104282104283104284104285104286104287104288104289104290104291104292104293104294104295104296104297104298104299104300104301104302104303104304104305104306104307104308104309104310104311104312104313104314104315104316104317104318104319104320104321104322104323104324104325104326104327104328104329104330104331104332104333104334104335104336104337104338104339104340104341104342104343104344104345104346104347104348104349104350104351104352104353104354104355104356104357104358104359104360104361104362104363104364104365104366104367104368104369104370104371104372104373104374104375104376104377104378104379104380104381104382104383104384104385104386104387104388104389104390104391104392104393104394104395104396104397104398104399104400104401104402104403104404104405104406104407104408104409104410104411104412104413104414104415104416104417104418104419104420104421104422104423104424104425104426104427104428104429104430104431104432104433104434104435104436104437104438104439104440104441104442104443104444104445104446104447104448104449104450104451104452104453104454104455104456104457104458104459104460104461104462104463104464104465104466104467104468104469104470104471104472104473104474104475104476104477104478104479104480104481104482104483104484104485104486104487104488104489104490104491104492104493104494104495104496104497104498104499104500104501104502104503104504104505104506104507104508104509104510104511104512104513104514104515104516104517104518104519104520104521104522104523104524104525104526104527104528104529104530104531104532104533104534104535104536104537104538104539104540104541104542104543104544104545104546104547104548104549104550104551104552104553104554104555104556104557104558104559104560104561104562104563104564104565104566104567104568104569104570104571104572104573104574104575104576104577104578104579104580104581104582104583104584104585104586104587104588104589104590104591104592104593104594104595104596104597104598104599104600104601104602104603104604104605104606104607104608104609104610104611104612104613104614104615104616104617104618104619104620104621104622104623104624104625104626104627104628104629104630104631104632104633104634104635104636104637104638104639104640104641104642104643104644104645104646104647104648104649104650104651104652104653104654104655104656104657104658104659104660104661104662104663104664104665104666104667104668104669104670104671104672104673104674104675104676104677104678104679104680104681104682104683104684104685104686104687104688104689104690104691104692104693104694104695104696104697104698104699104700104701104702104703104704104705104706104707104708104709104710104711104712104713104714104715104716104717104718104719104720104721104722104723104724104725104726104727104728104729104730104731104732104733104734104735104736104737104738104739104740104741104742104743104744104745104746104747104748104749104750104751104752104753104754104755104756104757104758104759104760104761104762104763104764104765104766104767104768104769104770104771104772104773104774104775104776104777104778104779104780104781104782104783104784104785104786104787104788104789104790104791104792104793104794104795104796104797104798104799104800104801104802104803104804104805104806104807104808104809104810104811104812104813104814104815104816104817104818104819104820104821104822104823104824104825104826104827104828104829104830104831104832104833104834104835104836104837104838104839104840104841104842104843104844104845104846104847104848104849104850104851104852104853104854104855104856104857104858104859104860104861104862104863104864104865104866104867104868104869104870104871104872104873104874104875104876104877104878104879104880104881104882104883104884104885104886104887104888104889104890104891104892104893104894104895104896104897104898104899104900104901104902104903104904104905104906104907104908104909104910104911104912104913104914104915104916104917104918104919104920104921104922104923104924104925104926104927104928104929104930104931104932104933104934104935104936104937104938104939104940104941104942104943104944104945104946104947104948104949104950104951104952104953104954104955104956104957104958104959104960104961104962104963104964104965104966104967104968104969104970104971104972104973104974104975104976104977104978104979104980104981104982104983104984104985104986104987104988104989104990104991104992104993104994104995104996104997104998104999105000105001105002105003105004105005105006105007105008105009105010105011105012105013105014105015105016105017105018105019105020105021105022105023105024105025105026105027105028105029105030105031105032105033105034105035105036105037105038105039105040105041105042105043105044105045105046105047105048105049105050105051105052105053105054105055105056105057105058105059105060105061105062105063105064105065105066105067105068105069105070105071105072105073105074105075105076105077105078105079105080105081105082105083105084105085105086105087105088105089105090105091105092105093105094105095105096105097105098105099105100105101105102105103105104105105105106105107105108105109105110105111105112105113105114105115105116105117105118105119105120105121105122105123105124105125105126105127105128105129105130105131105132105133105134105135105136105137105138105139105140105141105142105143105144105145105146105147105148105149105150105151105152105153105154105155105156105157105158105159105160105161105162105163105164105165105166105167105168105169105170105171105172105173105174105175105176105177105178105179105180105181105182105183105184105185105186105187105188105189105190105191105192105193105194105195105196105197105198105199105200105201105202105203105204105205105206105207105208105209105210105211105212105213105214105215105216105217105218105219105220105221105222105223105224105225105226105227105228105229105230105231105232105233105234105235105236105237105238105239105240105241105242105243105244105245105246105247105248105249105250105251105252105253105254105255105256105257105258105259105260105261105262105263105264105265105266105267105268105269105270105271105272105273105274105275105276105277105278105279105280105281105282105283105284105285105286105287105288105289105290105291105292105293105294105295105296105297105298105299105300105301105302105303105304105305105306105307105308105309105310105311105312105313105314105315105316105317105318105319105320105321105322105323105324105325105326105327105328105329105330105331105332105333105334105335105336105337105338105339105340105341105342105343105344105345105346105347105348105349105350105351105352105353105354105355105356105357105358105359105360105361105362105363105364105365105366105367105368105369105370105371105372105373105374105375105376105377105378105379105380105381105382105383105384105385105386105387105388105389105390105391105392105393105394105395105396105397105398105399105400105401105402105403105404105405105406105407105408105409105410105411105412105413105414105415105416105417105418105419105420105421105422105423105424105425105426105427105428105429105430105431105432105433105434105435105436105437105438105439105440105441105442105443105444105445105446105447105448105449105450105451105452105453105454105455105456105457105458105459105460105461105462105463105464105465105466105467105468105469105470105471105472105473105474105475105476105477105478105479105480105481105482105483105484105485105486105487105488105489105490105491105492105493105494105495105496105497105498105499105500105501105502105503105504105505105506105507105508105509105510105511105512105513105514105515105516105517105518105519105520105521105522105523105524105525105526105527105528105529105530105531105532105533105534105535105536105537105538105539105540105541105542105543105544105545105546105547105548105549105550105551105552105553105554105555105556105557105558105559105560105561105562105563105564105565105566105567105568105569105570105571105572105573105574105575105576105577105578105579105580105581105582105583105584105585105586105587105588105589105590105591105592105593105594105595105596105597105598105599105600105601105602105603105604105605105606105607105608105609105610105611105612105613105614105615105616105617105618105619105620105621105622105623105624105625105626105627105628105629105630105631105632105633105634105635105636105637105638105639105640105641105642105643105644105645105646105647105648105649105650105651105652105653105654105655105656105657105658105659105660105661105662105663105664105665105666105667105668105669105670105671105672105673105674105675105676105677105678105679105680105681105682105683105684105685105686105687105688105689105690105691105692105693105694105695105696105697105698105699105700105701105702105703105704105705105706105707105708105709105710105711105712105713105714105715105716105717105718105719105720105721105722105723105724105725105726105727105728105729105730105731105732105733105734105735105736105737105738105739105740105741105742105743105744105745105746105747105748105749105750105751105752105753105754105755105756105757105758105759105760105761105762105763105764105765105766105767105768105769105770105771105772105773105774105775105776105777105778105779105780105781105782105783105784105785105786105787105788105789105790105791105792105793105794105795105796105797105798105799105800105801105802105803105804105805105806105807105808105809105810105811105812105813105814105815105816105817105818105819105820105821105822105823105824105825105826105827105828105829105830105831105832105833105834105835105836105837105838105839105840105841105842105843105844105845105846105847105848105849105850105851105852105853105854105855105856105857105858105859105860105861105862105863105864105865105866105867105868105869105870105871105872105873105874105875105876105877105878105879105880105881105882105883105884105885105886105887105888105889105890105891105892105893105894105895105896105897105898105899105900105901105902105903105904105905105906105907105908105909105910105911105912105913105914105915105916105917105918105919105920105921105922105923105924105925105926105927105928105929105930105931105932105933105934105935105936105937105938105939105940105941105942105943105944105945105946105947105948105949105950105951105952105953105954105955105956105957105958105959105960105961105962105963105964105965105966105967105968105969105970105971105972105973105974105975105976105977105978105979105980105981105982105983105984105985105986105987105988105989105990105991105992105993105994105995105996105997105998105999106000106001106002106003106004106005106006106007106008106009106010106011106012106013106014106015106016106017106018106019106020106021106022106023106024106025106026106027106028106029106030106031106032106033106034106035106036106037106038106039106040106041106042106043106044106045106046106047106048106049106050106051106052106053106054106055106056106057106058106059106060106061106062106063106064106065106066106067106068106069106070106071106072106073106074106075106076106077106078106079106080106081106082106083106084106085106086106087106088106089106090106091106092106093106094106095106096106097106098106099106100106101106102106103106104106105106106106107106108106109106110106111106112106113106114106115106116106117106118106119106120106121106122106123106124106125106126106127106128106129106130106131106132106133106134106135106136106137106138106139106140106141106142106143106144106145106146106147106148106149106150106151106152106153106154106155106156106157106158106159106160106161106162106163106164106165106166106167106168106169106170106171106172106173106174106175106176106177106178106179106180106181106182106183106184106185106186106187106188106189106190106191106192106193106194106195106196106197106198106199106200106201106202106203106204106205106206106207106208106209106210106211106212106213106214106215106216106217106218106219106220106221106222106223106224106225106226106227106228106229106230106231106232106233106234106235106236106237106238106239106240106241106242106243106244106245106246106247106248106249106250106251106252106253106254106255106256106257106258106259106260106261106262106263106264106265106266106267106268106269106270106271106272106273106274106275106276106277106278106279106280106281106282106283106284106285106286106287106288106289106290106291106292106293106294106295106296106297106298106299106300106301106302106303106304106305106306106307106308106309106310106311106312106313106314106315106316106317106318106319106320106321106322106323106324106325106326106327106328106329106330106331106332106333106334106335106336106337106338106339106340106341106342106343106344106345106346106347106348106349106350106351106352106353106354106355106356106357106358106359106360106361106362106363106364106365106366106367106368106369106370106371106372106373106374106375106376106377106378106379106380106381106382106383106384106385106386106387106388106389106390106391106392106393106394106395106396106397106398106399106400106401106402106403106404106405106406106407106408106409106410106411106412106413106414106415106416106417106418106419106420106421106422106423106424106425106426106427106428106429106430106431106432106433106434106435106436106437106438106439106440106441106442106443106444106445106446106447106448106449106450106451106452106453106454106455106456106457106458106459106460106461106462106463106464106465106466106467106468106469106470106471106472106473106474106475106476106477106478106479106480106481106482106483106484106485106486106487106488106489106490106491106492106493106494106495106496106497106498106499106500106501106502106503106504106505106506106507106508106509106510106511106512106513106514106515106516106517106518106519106520106521106522106523106524106525106526106527106528106529106530106531106532106533106534106535106536106537106538106539106540106541106542106543106544106545106546106547106548106549106550106551106552106553106554106555106556106557106558106559106560106561106562106563106564106565106566106567106568106569106570106571106572106573106574106575106576106577106578106579106580106581106582106583106584106585106586106587106588106589106590106591106592106593106594106595106596106597106598106599106600106601106602106603106604106605106606106607106608106609106610106611106612106613106614106615106616106617106618106619106620106621106622106623106624106625106626106627106628106629106630106631106632106633106634106635106636106637106638106639106640106641106642106643106644106645106646106647106648106649106650106651106652106653106654106655106656106657106658106659106660106661106662106663106664106665106666106667106668106669106670106671106672106673106674106675106676106677106678106679106680106681106682106683106684106685106686106687106688106689106690106691106692106693106694106695106696106697106698106699106700106701106702106703106704106705106706106707106708106709106710106711106712106713106714106715106716106717106718106719106720106721106722106723106724106725106726106727106728106729106730106731106732106733106734106735106736106737106738106739106740106741106742106743106744106745106746106747106748106749106750106751106752106753106754106755106756106757106758106759106760106761106762106763106764106765106766106767106768106769106770106771106772106773106774106775106776106777106778106779106780106781106782106783106784106785106786106787106788106789106790106791106792106793106794106795106796106797106798106799106800106801106802106803106804106805106806106807106808106809106810106811106812106813106814106815106816106817106818106819106820106821106822106823106824106825106826106827106828106829106830106831106832106833106834106835106836106837106838106839106840106841106842106843106844106845106846106847106848106849106850106851106852106853106854106855106856106857106858106859106860106861106862106863106864106865106866106867106868106869106870106871106872106873106874106875106876106877106878106879106880106881106882106883106884106885106886106887106888106889106890106891106892106893106894106895106896106897106898106899106900106901106902106903106904106905106906106907106908106909106910106911106912106913106914106915106916106917106918106919106920106921106922106923106924106925106926106927106928106929106930106931106932106933106934106935106936106937106938106939106940106941106942106943106944106945106946106947106948106949106950106951106952106953106954106955106956106957106958106959106960106961106962106963106964106965106966106967106968106969106970106971106972106973106974106975106976106977106978106979106980106981106982106983106984106985106986106987106988106989106990106991106992106993106994106995106996106997106998106999107000107001107002107003107004107005107006107007107008107009107010107011107012107013107014107015107016107017107018107019107020107021107022107023107024107025107026107027107028107029107030107031107032107033107034107035107036107037107038107039107040107041107042107043107044107045107046107047107048107049107050107051107052107053107054107055107056107057107058107059107060107061107062107063107064107065107066107067107068107069107070107071107072107073107074107075107076107077107078107079107080107081107082107083107084107085107086107087107088107089107090107091107092107093107094107095107096107097107098107099107100107101107102107103107104107105107106107107107108107109107110107111107112107113107114107115107116107117107118107119107120107121107122107123107124107125107126107127107128107129107130107131107132107133107134107135107136107137107138107139107140107141107142107143107144107145107146107147107148107149107150107151107152107153107154107155107156107157107158107159107160107161107162107163107164107165107166107167107168107169107170107171107172107173107174107175107176107177107178107179107180107181107182107183107184107185107186107187107188107189107190107191107192107193107194107195107196107197107198107199107200107201107202107203107204107205107206107207107208107209107210107211107212107213107214107215107216107217107218107219107220107221107222107223107224107225107226107227107228107229107230107231107232107233107234107235107236107237107238107239107240107241107242107243107244107245107246107247107248107249107250107251107252107253107254107255107256107257107258107259107260107261107262107263107264107265107266107267107268107269107270107271107272107273107274107275107276107277107278107279107280107281107282107283107284107285107286107287107288107289107290107291107292107293107294107295107296107297107298107299107300107301107302107303107304107305107306107307107308107309107310107311107312107313107314107315107316107317107318107319107320107321107322107323107324107325107326107327107328107329107330107331107332107333107334107335107336107337107338107339107340107341107342107343107344107345107346107347107348107349107350107351107352107353107354107355107356107357107358107359107360107361107362107363107364107365107366107367107368107369107370107371107372107373107374107375107376107377107378107379107380107381107382107383107384107385107386107387107388107389107390107391107392107393107394107395107396107397107398107399107400107401107402107403107404107405107406107407107408107409107410107411107412107413107414107415107416107417107418107419107420107421107422107423107424107425107426107427107428107429107430107431107432107433107434107435107436107437107438107439107440107441107442107443107444107445107446107447107448107449107450107451107452107453107454107455107456107457107458107459107460107461107462107463107464107465107466107467107468107469107470107471107472107473107474107475107476107477107478107479107480107481107482107483107484107485107486107487107488107489107490107491107492107493107494107495107496107497107498107499107500107501107502107503107504107505107506107507107508107509107510107511107512107513107514107515107516107517107518107519107520107521107522107523107524107525107526107527107528107529107530107531107532107533107534107535107536107537107538107539107540107541107542107543107544107545107546107547107548107549107550107551107552107553107554107555107556107557107558107559107560107561107562107563107564107565107566107567107568107569107570107571107572107573107574107575107576107577107578107579107580107581107582107583107584107585107586107587107588107589107590107591107592107593107594107595107596107597107598107599107600107601107602107603107604107605107606107607107608107609107610107611107612107613107614107615107616107617107618107619107620107621107622107623107624107625107626107627107628107629107630107631107632107633107634107635107636107637107638107639107640107641107642107643107644107645107646107647107648107649107650107651107652107653107654107655107656107657107658107659107660107661107662107663107664107665107666107667107668107669107670107671107672107673107674107675107676107677107678107679107680107681107682107683107684107685107686107687107688107689107690107691107692107693107694107695107696107697107698107699107700107701107702107703107704107705107706107707107708107709107710107711107712107713107714107715107716107717107718107719107720107721107722107723107724107725107726107727107728107729107730107731107732107733107734107735107736107737107738107739107740107741107742107743107744107745107746107747107748107749107750107751107752107753107754107755107756107757107758107759107760107761107762107763107764107765107766107767107768107769107770107771107772107773107774107775107776107777107778107779107780107781107782107783107784107785107786107787107788107789107790107791107792107793107794107795107796107797107798107799107800107801107802107803107804107805107806107807107808107809107810107811107812107813107814107815107816107817107818107819107820107821107822107823107824107825107826107827107828107829107830107831107832107833107834107835107836107837107838107839107840107841107842107843107844107845107846107847107848107849107850107851107852107853107854107855107856107857107858107859107860107861107862107863107864107865107866107867107868107869107870107871107872107873107874107875107876107877107878107879107880107881107882107883107884107885107886107887107888107889107890107891107892107893107894107895107896107897107898107899107900107901107902107903107904107905107906107907107908107909107910107911107912107913107914107915107916107917107918107919107920107921107922107923107924107925107926107927107928107929107930107931107932107933107934107935107936107937107938107939107940107941107942107943107944107945107946107947107948107949107950107951107952107953107954107955107956107957107958107959107960107961107962107963107964107965107966107967107968107969107970107971107972107973107974107975107976107977107978107979107980107981107982107983107984107985107986107987107988107989107990107991107992107993107994107995107996107997107998107999108000108001108002108003108004108005108006108007108008108009108010108011108012108013108014108015108016108017108018108019108020108021108022108023108024108025108026108027108028108029108030108031108032108033108034108035108036108037108038108039108040108041108042108043108044108045108046108047108048108049108050108051108052108053108054108055108056108057108058108059108060108061108062108063108064108065108066108067108068108069108070108071108072108073108074108075108076108077108078108079108080108081108082108083108084108085108086108087108088108089108090108091108092108093108094108095108096108097108098108099108100108101108102108103108104108105108106108107108108108109108110108111108112108113108114108115108116108117108118108119108120108121108122108123108124108125108126108127108128108129108130108131108132108133108134108135108136108137108138108139108140108141108142108143108144108145108146108147108148108149108150108151108152108153108154108155108156108157108158108159108160108161108162108163108164108165108166108167108168108169108170108171108172108173108174108175108176108177108178108179108180108181108182108183108184108185108186108187108188108189108190108191108192108193108194108195108196108197108198108199108200108201108202108203108204108205108206108207108208108209108210108211108212108213108214108215108216108217108218108219108220108221108222108223108224108225108226108227108228108229108230108231108232108233108234108235108236108237108238108239108240108241108242108243108244108245108246108247108248108249108250108251108252108253108254108255108256108257108258108259108260108261108262108263108264108265108266108267108268108269108270108271108272108273108274108275108276108277108278108279108280108281108282108283108284108285108286108287108288108289108290108291108292108293108294108295108296108297108298108299108300108301108302108303108304108305108306108307108308108309108310108311108312108313108314108315108316108317108318108319108320108321108322108323108324108325108326108327108328108329108330108331108332108333108334108335108336108337108338108339108340108341108342108343108344108345108346108347108348108349108350108351108352108353108354108355108356108357108358108359108360108361108362108363108364108365108366108367108368108369108370108371108372108373108374108375108376108377108378108379108380108381108382108383108384108385108386108387108388108389108390108391108392108393108394108395108396108397108398108399108400108401108402108403108404108405108406108407108408108409108410108411108412108413108414108415108416108417108418108419108420108421108422108423108424108425108426108427108428108429108430108431108432108433108434108435108436108437108438108439108440108441108442108443108444108445108446108447108448108449108450108451108452108453108454108455108456108457108458108459108460108461108462108463108464108465108466108467108468108469108470108471108472108473108474108475108476108477108478108479108480108481108482108483108484108485108486108487108488108489108490108491108492108493108494108495108496108497108498108499108500108501108502108503108504108505108506108507108508108509108510108511108512108513108514108515108516108517108518108519108520108521108522108523108524108525108526108527108528108529108530108531108532108533108534108535108536108537108538108539108540108541108542108543108544108545108546108547108548108549108550108551108552108553108554108555108556108557108558108559108560108561108562108563108564108565108566108567108568108569108570108571108572108573108574108575108576108577108578108579108580108581108582108583108584108585108586108587108588108589108590108591108592108593108594108595108596108597108598108599108600108601108602108603108604108605108606108607108608108609108610108611108612108613108614108615108616108617108618108619108620108621108622108623108624108625108626108627108628108629108630108631108632108633108634108635108636108637108638108639108640108641108642108643108644108645108646108647108648108649108650108651108652108653108654108655108656108657108658108659108660108661108662108663108664108665108666108667108668108669108670108671108672108673108674108675108676108677108678108679108680108681108682108683108684108685108686108687108688108689108690108691108692108693108694108695108696108697108698108699108700108701108702108703108704108705108706108707108708108709108710108711108712108713108714108715108716108717108718108719108720108721108722108723108724108725108726108727108728108729108730108731108732108733108734108735108736108737108738108739108740108741108742108743108744108745108746108747108748108749108750108751108752108753108754108755108756108757108758108759108760108761108762108763108764108765108766108767108768108769108770108771108772108773108774108775108776108777108778108779108780108781108782108783108784108785108786108787108788108789108790108791108792108793108794108795108796108797108798108799108800108801108802108803108804108805108806108807108808108809108810108811108812108813108814108815108816108817108818108819108820108821108822108823108824108825108826108827108828108829108830108831108832108833108834108835108836108837108838108839108840108841108842108843108844108845108846108847108848108849108850108851108852108853108854108855108856108857108858108859108860108861108862108863108864108865108866108867108868108869108870108871108872108873108874108875108876108877108878108879108880108881108882108883108884108885108886108887108888108889108890108891108892108893108894108895108896108897108898108899108900108901108902108903108904108905108906108907108908108909108910108911108912108913108914108915108916108917108918108919108920108921108922108923108924108925108926108927108928108929108930108931108932108933108934108935108936108937108938108939108940108941108942108943108944108945108946108947108948108949108950108951108952108953108954108955108956108957108958108959108960108961108962108963108964108965108966108967108968108969108970108971108972108973108974108975108976108977108978108979108980108981108982108983108984108985108986108987108988108989108990108991108992108993108994108995108996108997108998108999109000109001109002109003109004109005109006109007109008109009109010109011109012109013109014109015109016109017109018109019109020109021109022109023109024109025109026109027109028109029109030109031109032109033109034109035109036109037109038109039109040109041109042109043109044109045109046109047109048109049109050109051109052109053109054109055109056109057109058109059109060109061109062109063109064109065109066109067109068109069109070109071109072109073109074109075109076109077109078109079109080109081109082109083109084109085109086109087109088109089109090109091109092109093109094109095109096109097109098109099109100109101109102109103109104109105109106109107109108109109109110109111109112109113109114109115109116109117109118109119109120109121109122109123109124109125109126109127109128109129109130109131109132109133109134109135109136109137109138109139109140109141109142109143109144109145109146109147109148109149109150109151109152109153109154109155109156109157109158109159109160109161109162109163109164109165109166109167109168109169109170109171109172109173109174109175109176109177109178109179109180109181109182109183109184109185109186109187109188109189109190109191109192109193109194109195109196109197109198109199109200109201109202109203109204109205109206109207109208109209109210109211109212109213109214109215109216109217109218109219109220109221109222109223109224109225109226109227109228109229109230109231109232109233109234109235109236109237109238109239109240109241109242109243109244109245109246109247109248109249109250109251109252109253109254109255109256109257109258109259109260109261109262109263109264109265109266109267109268109269109270109271109272109273109274109275109276109277109278109279109280109281109282109283109284109285109286109287109288109289109290109291109292109293109294109295109296109297109298109299109300109301109302109303109304109305109306109307109308109309109310109311109312109313109314109315109316109317109318109319109320109321109322109323109324109325109326109327109328109329109330109331109332109333109334109335109336109337109338109339109340109341109342109343109344109345109346109347109348109349109350109351109352109353109354109355109356109357109358109359109360109361109362109363109364109365109366109367109368109369109370109371109372109373109374109375109376109377109378109379109380109381109382109383109384109385109386109387109388109389109390109391109392109393109394109395109396109397109398109399109400109401109402109403109404109405109406109407109408109409109410109411109412109413109414109415109416109417109418109419109420109421109422109423109424109425109426109427109428109429109430109431109432109433109434109435109436109437109438109439109440109441109442109443109444109445109446109447109448109449109450109451109452109453109454109455109456109457109458109459109460109461109462109463109464109465109466109467109468109469109470109471109472109473109474109475109476109477109478109479109480109481109482109483109484109485109486109487109488109489109490109491109492109493109494109495109496109497109498109499109500109501109502109503109504109505109506109507109508109509109510109511109512109513109514109515109516109517109518109519109520109521109522109523109524109525109526109527109528109529109530109531109532109533109534109535109536109537109538109539109540109541109542109543109544109545109546109547109548109549109550109551109552109553109554109555109556109557109558109559109560109561109562109563109564109565109566109567109568109569109570109571109572109573109574109575109576109577109578109579109580109581109582109583109584109585109586109587109588109589109590109591109592109593109594109595109596109597109598109599109600109601109602109603109604109605109606109607109608109609109610109611109612109613109614109615109616109617109618109619109620109621109622109623109624109625109626109627109628109629109630109631109632109633109634109635109636109637109638109639109640109641109642109643109644109645109646109647109648109649109650109651109652109653109654109655109656109657109658109659109660109661109662109663109664109665109666109667109668109669109670109671109672109673109674109675109676109677109678109679109680109681109682109683109684109685109686109687109688109689109690109691109692109693109694109695109696109697109698109699109700109701109702109703109704109705109706109707109708109709109710109711109712109713109714109715109716109717109718109719109720109721109722109723109724109725109726109727109728109729109730109731109732109733109734109735109736109737109738109739109740109741109742109743109744109745109746109747109748109749109750109751109752109753109754109755109756109757109758109759109760109761109762109763109764109765109766109767109768109769109770109771109772109773109774109775109776109777109778109779109780109781109782109783109784109785109786109787109788109789109790109791109792109793109794109795109796109797109798109799109800109801109802109803109804109805109806109807109808109809109810109811109812109813109814109815109816109817109818109819109820109821109822109823109824109825109826109827109828109829109830109831109832109833109834109835109836109837109838109839109840109841109842109843109844109845109846109847109848109849109850109851109852109853109854109855109856109857109858109859109860109861109862109863109864109865109866109867109868109869109870109871109872109873109874109875109876109877109878109879109880109881109882109883109884109885109886109887109888109889109890109891109892109893109894109895109896109897109898109899109900109901109902109903109904109905109906109907109908109909109910109911109912109913109914109915109916109917109918109919109920109921109922109923109924109925109926109927109928109929109930109931109932109933109934109935109936109937109938109939109940109941109942109943109944109945109946109947109948109949109950109951109952109953109954109955109956109957109958109959109960109961109962109963109964109965109966109967109968109969109970109971109972109973109974109975109976109977109978109979109980109981109982109983109984109985109986109987109988109989109990109991109992109993109994109995109996109997109998109999110000110001110002110003110004110005110006110007110008110009110010110011110012110013110014110015110016110017110018110019110020110021110022110023110024110025110026110027110028110029110030110031110032110033110034110035110036110037110038110039110040110041110042110043110044110045110046110047110048110049110050110051110052110053110054110055110056110057110058110059110060110061110062110063110064110065110066110067110068110069110070110071110072110073110074110075110076110077110078110079110080110081110082110083110084110085110086110087110088110089110090110091110092110093110094110095110096110097110098110099110100110101110102110103110104110105110106110107110108110109110110110111110112110113110114110115110116110117110118110119110120110121110122110123110124110125110126110127110128110129110130110131110132110133110134110135110136110137110138110139110140110141110142110143110144110145110146110147110148110149110150110151110152110153110154110155110156110157110158110159110160110161110162110163110164110165110166110167110168110169110170110171110172110173110174110175110176110177110178110179110180110181110182110183110184110185110186110187110188110189110190110191110192110193110194110195110196110197110198110199110200110201110202110203110204110205110206110207110208110209110210110211110212110213110214110215110216110217110218110219110220110221110222110223110224110225110226110227110228110229110230110231110232110233110234110235110236110237110238110239110240110241110242110243110244110245110246110247110248110249110250110251110252110253110254110255110256110257110258110259110260110261110262110263110264110265110266110267110268110269110270110271110272110273110274110275110276110277110278110279110280110281110282110283110284110285110286110287110288110289110290110291110292110293110294110295110296110297110298110299110300110301110302110303110304110305110306110307110308110309110310110311110312110313110314110315110316110317110318110319110320110321110322110323110324110325110326110327110328110329110330110331110332110333110334110335110336110337110338110339110340110341110342110343110344110345110346110347110348110349110350110351110352110353110354110355110356110357110358110359110360110361110362110363110364110365110366110367110368110369110370110371110372110373110374110375110376110377110378110379110380110381110382110383110384110385110386110387110388110389110390110391110392110393110394110395110396110397110398110399110400110401110402110403110404110405110406110407110408110409110410110411110412110413110414110415110416110417110418110419110420110421110422110423110424110425110426110427110428110429110430110431110432110433110434110435110436110437110438110439110440110441110442110443110444110445110446110447110448110449110450110451110452110453110454110455110456110457110458110459110460110461110462110463110464110465110466110467110468110469110470110471110472110473110474110475110476110477110478110479110480110481110482110483110484110485110486110487110488110489110490110491110492110493110494110495110496110497110498110499110500110501110502110503110504110505110506110507110508110509110510110511110512110513110514110515110516110517110518110519110520110521110522110523110524110525110526110527110528110529110530110531110532110533110534110535110536110537110538110539110540110541110542110543110544110545110546110547110548110549110550110551110552110553110554110555110556110557110558110559110560110561110562110563110564110565110566110567110568110569110570110571110572110573110574110575110576110577110578110579110580110581110582110583110584110585110586110587110588110589110590110591110592110593110594110595110596110597110598110599110600110601110602110603110604110605110606110607110608110609110610110611110612110613110614110615110616110617110618110619110620110621110622110623110624110625110626110627110628110629110630110631110632110633110634110635110636110637110638110639110640110641110642110643110644110645110646110647110648110649110650110651110652110653110654110655110656110657110658110659110660110661110662110663110664110665110666110667110668110669110670110671110672110673110674110675110676110677110678110679110680110681110682110683110684110685110686110687110688110689110690110691110692110693110694110695110696110697110698110699110700110701110702110703110704110705110706110707110708110709110710110711110712110713110714110715110716110717110718110719110720110721110722110723110724110725110726110727110728110729110730110731110732110733110734110735110736110737110738110739110740110741110742110743110744110745110746110747110748110749110750110751110752110753110754110755110756110757110758110759110760110761110762110763110764110765110766110767110768110769110770110771110772110773110774110775110776110777110778110779110780110781110782110783110784110785110786110787110788110789110790110791110792110793110794110795110796110797110798110799110800110801110802110803110804110805110806110807110808110809110810110811110812110813110814110815110816110817110818110819110820110821110822110823110824110825110826110827110828110829110830110831110832110833110834110835110836110837110838110839110840110841110842110843110844110845110846110847110848110849110850110851110852110853110854110855110856110857110858110859110860110861110862110863110864110865110866110867110868110869110870110871110872110873110874110875110876110877110878110879110880110881110882110883110884110885110886110887110888110889110890110891110892110893110894110895110896110897110898110899110900110901110902110903110904110905110906110907110908110909110910110911110912110913110914110915110916110917110918110919110920110921110922110923110924110925110926110927110928110929110930110931110932110933110934110935110936110937110938110939110940110941110942110943110944110945110946110947110948110949110950110951110952110953110954110955110956110957110958110959110960110961110962110963110964110965110966110967110968110969110970110971110972110973110974110975110976110977110978110979110980110981110982110983110984110985110986110987110988110989110990110991110992110993110994110995110996110997110998110999111000111001111002111003111004111005111006111007111008111009111010111011111012111013111014111015111016111017111018111019111020111021111022111023111024111025111026111027111028111029111030111031111032111033111034111035111036111037111038111039111040111041111042111043111044111045111046111047111048111049111050111051111052111053111054111055111056111057111058111059111060111061111062111063111064111065111066111067111068111069111070111071111072111073111074111075111076111077111078111079111080111081111082111083111084111085111086111087111088111089111090111091111092111093111094111095111096111097111098111099111100111101111102111103111104111105111106111107111108111109111110111111111112111113111114111115111116111117111118111119111120111121111122111123111124111125111126111127111128111129111130111131111132111133111134111135111136111137111138111139111140111141111142111143111144111145111146111147111148111149111150111151111152111153111154111155111156111157111158111159111160111161111162111163111164111165111166111167111168111169111170111171111172111173111174111175111176111177111178111179111180111181111182111183111184111185111186111187111188111189111190111191111192111193111194111195111196111197111198111199111200111201111202111203111204111205111206111207111208111209111210111211111212111213111214111215111216111217111218111219111220111221111222111223111224111225111226111227111228111229111230111231111232111233111234111235111236111237111238111239111240111241111242111243111244111245111246111247111248111249111250111251111252111253111254111255111256111257111258111259111260111261111262111263111264111265111266111267111268111269111270111271111272111273111274111275111276111277111278111279111280111281111282111283111284111285111286111287111288111289111290111291111292111293111294111295111296111297111298111299111300111301111302111303111304111305111306111307111308111309111310111311111312111313111314111315111316111317111318111319111320111321111322111323111324111325111326111327111328111329111330111331111332111333111334111335111336111337111338111339111340111341111342111343111344111345111346111347111348111349111350111351111352111353111354111355111356111357111358111359111360111361111362111363111364111365111366111367111368111369111370111371111372111373111374111375111376111377111378111379111380111381111382111383111384111385111386111387111388111389111390111391111392111393111394111395111396111397111398111399111400111401111402111403111404111405111406111407111408111409111410111411111412111413111414111415111416111417111418111419111420111421111422111423111424111425111426111427111428111429111430111431111432111433111434111435111436111437111438111439111440111441111442111443111444111445111446111447111448111449111450111451111452111453111454111455111456111457111458111459111460111461111462111463111464111465111466111467111468111469111470111471111472111473111474111475111476111477111478111479111480111481111482111483111484111485111486111487111488111489111490111491111492111493111494111495111496111497111498111499111500111501111502111503111504111505111506111507111508111509111510111511111512111513111514111515111516111517111518111519111520111521111522111523111524111525111526111527111528111529111530111531111532111533111534111535111536111537111538111539111540111541111542111543111544111545111546111547111548111549111550111551111552111553111554111555111556111557111558111559111560111561111562111563111564111565111566111567111568111569111570111571111572111573111574111575111576111577111578111579111580111581111582111583111584111585111586111587111588111589111590111591111592111593111594111595111596111597111598111599111600111601111602111603111604111605111606111607111608111609111610111611111612111613111614111615111616111617111618111619111620111621111622111623111624111625111626111627111628111629111630111631111632111633111634111635111636111637111638111639111640111641111642111643111644111645111646111647111648111649111650111651111652111653111654111655111656111657111658111659111660111661111662111663111664111665111666111667111668111669111670111671111672111673111674111675111676111677111678111679111680111681111682111683111684111685111686111687111688111689111690111691111692111693111694111695111696111697111698111699111700111701111702111703111704111705111706111707111708111709111710111711111712111713111714111715111716111717111718111719111720111721111722111723111724111725111726111727111728111729111730111731111732111733111734111735111736111737111738111739111740111741111742111743111744111745111746111747111748111749111750111751111752111753111754111755111756111757111758111759111760111761111762111763111764111765111766111767111768111769111770111771111772111773111774111775111776111777111778111779111780111781111782111783111784111785111786111787111788111789111790111791111792111793111794111795111796111797111798111799111800111801111802111803111804111805111806111807111808111809111810111811111812111813111814111815111816111817111818111819111820111821111822111823111824111825111826111827111828111829111830111831111832111833111834111835111836111837111838111839111840111841111842111843111844111845111846111847111848111849111850111851111852111853111854111855111856111857111858111859111860111861111862111863111864111865111866111867111868111869111870111871111872111873111874111875111876111877111878111879111880111881111882111883111884111885111886111887111888111889111890111891111892111893111894111895111896111897111898111899111900111901111902111903111904111905111906111907111908111909111910111911111912111913111914111915111916111917111918111919111920111921111922111923111924111925111926111927111928111929111930111931111932111933111934111935111936111937111938111939111940111941111942111943111944111945111946111947111948111949111950111951111952111953111954111955111956111957111958111959111960111961111962111963111964111965111966111967111968111969111970111971111972111973111974111975111976111977111978111979111980111981111982111983111984111985111986111987111988111989111990111991111992111993111994111995111996111997111998111999112000112001112002112003112004112005112006112007112008112009112010112011112012112013112014112015112016112017112018112019112020112021112022112023112024112025112026112027112028112029112030112031112032112033112034112035112036112037112038112039112040112041112042112043112044112045112046112047112048112049112050112051112052112053112054112055112056112057112058112059112060112061112062112063112064112065112066112067112068112069112070112071112072112073112074112075112076112077112078112079112080112081112082112083112084112085112086112087112088112089112090112091112092112093112094112095112096112097112098112099112100112101112102112103112104112105112106112107112108112109112110112111112112112113112114112115112116112117112118112119112120112121112122112123112124112125112126112127112128112129112130112131112132112133112134112135112136112137112138112139112140112141112142112143112144112145112146112147112148112149112150112151112152112153112154112155112156112157112158112159112160112161112162112163112164112165112166112167112168112169112170112171112172112173112174112175112176112177112178112179112180112181112182112183112184112185112186112187112188112189112190112191112192112193112194112195112196112197112198112199112200112201112202112203112204112205112206112207112208112209112210112211112212112213112214112215112216112217112218112219112220112221112222112223112224112225112226112227112228112229112230112231112232112233112234112235112236112237112238112239112240112241112242112243112244112245112246112247112248112249112250112251112252112253112254112255112256112257112258112259112260112261112262112263112264112265112266112267112268112269112270112271112272112273112274112275112276112277112278112279112280112281112282112283112284112285112286112287112288112289112290112291112292112293112294112295112296112297112298112299112300112301112302112303112304112305112306112307112308112309112310112311112312112313112314112315112316112317112318112319112320112321112322112323112324112325112326112327112328112329112330112331112332112333112334112335112336112337112338112339112340112341112342112343112344112345112346112347112348112349112350112351112352112353112354112355112356112357112358112359112360112361112362112363112364112365112366112367112368112369112370112371112372112373112374112375112376112377112378112379112380112381112382112383112384112385112386112387112388112389112390112391112392112393112394112395112396112397112398112399112400112401112402112403112404112405112406112407112408112409112410112411112412112413112414112415112416112417112418112419112420112421112422112423112424112425112426112427112428112429112430112431112432112433112434112435112436112437112438112439112440112441112442112443112444112445112446112447112448112449112450112451112452112453112454112455112456112457112458112459112460112461112462112463112464112465112466112467112468112469112470112471112472112473112474112475112476112477112478112479112480112481112482112483112484112485112486112487112488112489112490112491112492112493112494112495112496112497112498112499112500112501112502112503112504112505112506112507112508112509112510112511112512112513112514112515112516112517112518112519112520112521112522112523112524112525112526112527112528112529112530112531112532112533112534112535112536112537112538112539112540112541112542112543112544112545112546112547112548112549112550112551112552112553112554112555112556112557112558112559112560112561112562112563112564112565112566112567112568112569112570112571112572112573112574112575112576112577112578112579112580112581112582112583112584112585112586112587112588112589112590112591112592112593112594112595112596112597112598112599112600112601112602112603112604112605112606112607112608112609112610112611112612112613112614112615112616112617112618112619112620112621112622112623112624112625112626112627112628112629112630112631112632112633112634112635112636112637112638112639112640112641112642112643112644112645112646112647112648112649112650112651112652112653112654112655112656112657112658112659112660112661112662112663112664112665112666112667112668112669112670112671112672112673112674112675112676112677112678112679112680112681112682112683112684112685112686112687112688112689112690112691112692112693112694112695112696112697112698112699112700112701112702112703112704112705112706112707112708112709112710112711112712112713112714112715112716112717112718112719112720112721112722112723112724112725112726112727112728112729112730112731112732112733112734112735112736112737112738112739112740112741112742112743112744112745112746112747112748112749112750112751112752112753112754112755112756112757112758112759112760112761112762112763112764112765112766112767112768112769112770112771112772112773112774112775112776112777112778112779112780112781112782112783112784112785112786112787112788112789112790112791112792112793112794112795112796112797112798112799112800112801112802112803112804112805112806112807112808112809112810112811112812112813112814112815112816112817112818112819112820112821112822112823112824112825112826112827112828112829112830112831112832112833112834112835112836112837112838112839112840112841112842112843112844112845112846112847112848112849112850112851112852112853112854112855112856112857112858112859112860112861112862112863112864112865112866112867112868112869112870112871112872112873112874112875112876112877112878112879112880112881112882112883112884112885112886112887112888112889112890112891112892112893112894112895112896112897112898112899112900112901112902112903112904112905112906112907112908112909112910112911112912112913112914112915112916112917112918112919112920112921112922112923112924112925112926112927112928112929112930112931112932112933112934112935112936112937112938112939112940112941112942112943112944112945112946112947112948112949112950112951112952112953112954112955112956112957112958112959112960112961112962112963112964112965112966112967112968112969112970112971112972112973112974112975112976112977112978112979112980112981112982112983112984112985112986112987112988112989112990112991112992112993112994112995112996112997112998112999113000113001113002113003113004113005113006113007113008113009113010113011113012113013113014113015113016113017113018113019113020113021113022113023113024113025113026113027113028113029113030113031113032113033113034113035113036113037113038113039113040113041113042113043113044113045113046113047113048113049113050113051113052113053113054113055113056113057113058113059113060113061113062113063113064113065113066113067113068113069113070113071113072113073113074113075113076113077113078113079113080113081113082113083113084113085113086113087113088113089113090113091113092113093113094113095113096113097113098113099113100113101113102113103113104113105113106113107113108113109113110113111113112113113113114113115113116113117113118113119113120113121113122113123113124113125113126113127113128113129113130113131113132113133113134113135113136113137113138113139113140113141113142113143113144113145113146113147113148113149113150113151113152113153113154113155113156113157113158113159113160113161113162113163113164113165113166113167113168113169113170113171113172113173113174113175113176113177113178113179113180113181113182113183113184113185113186113187113188113189113190113191113192113193113194113195113196113197113198113199113200113201113202113203113204113205113206113207113208113209113210113211113212113213113214113215113216113217113218113219113220113221113222113223113224113225113226113227113228113229113230113231113232113233113234113235113236113237113238113239113240113241113242113243113244113245113246113247113248113249113250113251113252113253113254113255113256113257113258113259113260113261113262113263113264113265113266113267113268113269113270113271113272113273113274113275113276113277113278113279113280113281113282113283113284113285113286113287113288113289113290113291113292113293113294113295113296113297113298113299113300113301113302113303113304113305113306113307113308113309113310113311113312113313113314113315113316113317113318113319113320113321113322113323113324113325113326113327113328113329113330113331113332113333113334113335113336113337113338113339113340113341113342113343113344113345113346113347113348113349113350113351113352113353113354113355113356113357113358113359113360113361113362113363113364113365113366113367113368113369113370113371113372113373113374113375113376113377113378113379113380113381113382113383113384113385113386113387113388113389113390113391113392113393113394113395113396113397113398113399113400113401113402113403113404113405113406113407113408113409113410113411113412113413113414113415113416113417113418113419113420113421113422113423113424113425113426113427113428113429113430113431113432113433113434113435113436113437113438113439113440113441113442113443113444113445113446113447113448113449113450113451113452113453113454113455113456113457113458113459113460113461113462113463113464113465113466113467113468113469113470113471113472113473113474113475113476113477113478113479113480113481113482113483113484113485113486113487113488113489113490113491113492113493113494113495113496113497113498113499113500113501113502113503113504113505113506113507113508113509113510113511113512113513113514113515113516113517113518113519113520113521113522113523113524113525113526113527113528113529113530113531113532113533113534113535113536113537113538113539113540113541113542113543113544113545113546113547113548113549113550113551113552113553113554113555113556113557113558113559113560113561113562113563113564113565113566113567113568113569113570113571113572113573113574113575113576113577113578113579113580113581113582113583113584113585113586113587113588113589113590113591113592113593113594113595113596113597113598113599113600113601113602113603113604113605113606113607113608113609113610113611113612113613113614113615113616113617113618113619113620113621113622113623113624113625113626113627113628113629113630113631113632113633113634113635113636113637113638113639113640113641113642113643113644113645113646113647113648113649113650113651113652113653113654113655113656113657113658113659113660113661113662113663113664113665113666113667113668113669113670113671113672113673113674113675113676113677113678113679113680113681113682113683113684113685113686113687113688113689113690113691113692113693113694113695113696113697113698113699113700113701113702113703113704113705113706113707113708113709113710113711113712113713113714113715113716113717113718113719113720113721113722113723113724113725113726113727113728113729113730113731113732113733113734113735113736113737113738113739113740113741113742113743113744113745113746113747113748113749113750113751113752113753113754113755113756113757113758113759113760113761113762113763113764113765113766113767113768113769113770113771113772113773113774113775113776113777113778113779113780113781113782113783113784113785113786113787113788113789113790113791113792113793113794113795113796113797113798113799113800113801113802113803113804113805113806113807113808113809113810113811113812113813113814113815113816113817113818113819113820113821113822113823113824113825113826113827113828113829113830113831113832113833113834113835113836113837113838113839113840113841113842113843113844113845113846113847113848113849113850113851113852113853113854113855113856113857113858113859113860113861113862113863113864113865113866113867113868113869113870113871113872113873113874113875113876113877113878113879113880113881113882113883113884113885113886113887113888113889113890113891113892113893113894113895113896113897113898113899113900113901113902113903113904113905113906113907113908113909113910113911113912113913113914113915113916113917113918113919113920113921113922113923113924113925113926113927113928113929113930113931113932113933113934113935113936113937113938113939113940113941113942113943113944113945113946113947113948113949113950113951113952113953113954113955113956113957113958113959113960113961113962113963113964113965113966113967113968113969113970113971113972113973113974113975113976113977113978113979113980113981113982113983113984113985113986113987113988113989113990113991113992113993113994113995113996113997113998113999114000114001114002114003114004114005114006114007114008114009114010114011114012114013114014114015114016114017114018114019114020114021114022114023114024114025114026114027114028114029114030114031114032114033114034114035114036114037114038114039114040114041114042114043114044114045114046114047114048114049114050114051114052114053114054114055114056114057114058114059114060114061114062114063114064114065114066114067114068114069114070114071114072114073114074114075114076114077114078114079114080114081114082114083114084114085114086114087114088114089114090114091114092114093114094114095114096114097114098114099114100114101114102114103114104114105114106114107114108114109114110114111114112114113114114114115114116114117114118114119114120114121114122114123114124114125114126114127114128114129114130114131114132114133114134114135114136114137114138114139114140114141114142114143114144114145114146114147114148114149114150114151114152114153114154114155114156114157114158114159114160114161114162114163114164114165114166114167114168114169114170114171114172114173114174114175114176114177114178114179114180114181114182114183114184114185114186114187114188114189114190114191114192114193114194114195114196114197114198114199114200114201114202114203114204114205114206114207114208114209114210114211114212114213114214114215114216114217114218114219114220114221114222114223114224114225114226114227114228114229114230114231114232114233114234114235114236114237114238114239114240114241114242114243114244114245114246114247114248114249114250114251114252114253114254114255114256114257114258114259114260114261114262114263114264114265114266114267114268114269114270114271114272114273114274114275114276114277114278114279114280114281114282114283114284114285114286114287114288114289114290114291114292114293114294114295114296114297114298114299114300114301114302114303114304114305114306114307114308114309114310114311114312114313114314114315114316114317114318114319114320114321114322114323114324114325114326114327114328114329114330114331114332114333114334114335114336114337114338114339114340114341114342114343114344114345114346114347114348114349114350114351114352114353114354114355114356114357114358114359114360114361114362114363114364114365114366114367114368114369114370114371114372114373114374114375114376114377114378114379114380114381114382114383114384114385114386114387114388114389114390114391114392114393114394114395114396114397114398114399114400114401114402114403114404114405114406114407114408114409114410114411114412114413114414114415114416114417114418114419114420114421114422114423114424114425114426114427114428114429114430114431114432114433114434114435114436114437114438114439114440114441114442114443114444114445114446114447114448114449114450114451114452114453114454114455114456114457114458114459114460114461114462114463114464114465114466114467114468114469114470114471114472114473114474114475114476114477114478114479114480114481114482114483114484114485114486114487114488114489114490114491114492114493114494114495114496114497114498114499114500114501114502114503114504114505114506114507114508114509114510114511114512114513114514114515114516114517114518114519114520114521114522114523114524114525114526114527114528114529114530114531114532114533114534114535114536114537114538114539114540114541114542114543114544114545114546114547114548114549114550114551114552114553114554114555114556114557114558114559114560114561114562114563114564114565114566114567114568114569114570114571114572114573114574114575114576114577114578114579114580114581114582114583114584114585114586114587114588114589114590114591114592114593114594114595114596114597114598114599114600114601114602114603114604114605114606114607114608114609114610114611114612114613114614114615114616114617114618114619114620114621114622114623114624114625114626114627114628114629114630114631114632114633114634114635114636114637114638114639114640114641114642114643114644114645114646114647114648114649114650114651114652114653114654114655114656114657114658114659114660114661114662114663114664114665114666114667114668114669114670114671114672114673114674114675114676114677114678114679114680114681114682114683114684114685114686114687114688114689114690114691114692114693114694114695114696114697114698114699114700114701114702114703114704114705114706114707114708114709114710114711114712114713114714114715114716114717114718114719114720114721114722114723114724114725114726114727114728114729114730114731114732114733114734114735114736114737114738114739114740114741114742114743114744114745114746114747114748114749114750114751114752114753114754114755114756114757114758114759114760114761114762114763114764114765114766114767114768114769114770114771114772114773114774114775114776114777114778114779114780114781114782114783114784114785114786114787114788114789114790114791114792114793114794114795114796114797114798114799114800114801114802114803114804114805114806114807114808114809114810114811114812114813114814114815114816114817114818114819114820114821114822114823114824114825114826114827114828114829114830114831114832114833114834114835114836114837114838114839114840114841114842114843114844114845114846114847114848114849114850114851114852114853114854114855114856114857114858114859114860114861114862114863114864114865114866114867114868114869114870114871114872114873114874114875114876114877114878114879114880114881114882114883114884114885114886114887114888114889114890114891114892114893114894114895114896114897114898114899114900114901114902114903114904114905114906114907114908114909114910114911114912114913114914114915114916114917114918114919114920114921114922114923114924114925114926114927114928114929114930114931114932114933114934114935114936114937114938114939114940114941114942114943114944114945114946114947114948114949114950114951114952114953114954114955114956114957114958114959114960114961114962114963114964114965114966114967114968114969114970114971114972114973114974114975114976114977114978114979114980114981114982114983114984114985114986114987114988114989114990114991114992114993114994114995114996114997114998114999115000115001115002115003115004115005115006115007115008115009115010115011115012115013115014115015115016115017115018115019115020115021115022115023115024115025115026115027115028115029115030115031115032115033115034115035115036115037115038115039115040115041115042115043115044115045115046115047115048115049115050115051115052115053115054115055115056115057115058115059115060115061115062115063115064115065115066115067115068115069115070115071115072115073115074115075115076115077115078115079115080115081115082115083115084115085115086115087115088115089115090115091115092115093115094115095115096115097115098115099115100115101115102115103115104115105115106115107115108115109115110115111115112115113115114115115115116115117115118115119115120115121115122115123115124115125115126115127115128115129115130115131115132115133115134115135115136115137115138115139115140115141115142115143115144115145115146115147115148115149115150115151115152115153115154115155115156115157115158115159115160115161115162115163115164115165115166115167115168115169115170115171115172115173115174115175115176115177115178115179115180115181115182115183115184115185115186115187115188115189115190115191115192115193115194115195115196115197115198115199115200115201115202115203115204115205115206115207115208115209115210115211115212115213115214115215115216115217115218115219115220115221115222115223115224115225115226115227115228115229115230115231115232115233115234115235115236115237115238115239115240115241115242115243115244115245115246115247115248115249115250115251115252115253115254115255115256115257115258115259115260115261115262115263115264115265115266115267115268115269115270115271115272115273115274115275115276115277115278115279115280115281115282115283115284115285115286115287115288115289115290115291115292115293115294115295115296115297115298115299115300115301115302115303115304115305115306115307115308115309115310115311115312115313115314115315115316115317115318115319115320115321115322115323115324115325115326115327115328115329115330115331115332115333115334115335115336115337115338115339115340115341115342115343115344115345115346115347115348115349115350115351115352115353115354115355115356115357115358115359115360115361115362115363115364115365115366115367115368115369115370115371115372115373115374115375115376115377115378115379115380115381115382115383115384115385115386115387115388115389115390115391115392115393115394115395115396115397115398115399115400115401115402115403115404115405115406115407115408115409115410115411115412115413115414115415115416115417115418115419115420115421115422115423115424115425115426115427115428115429115430115431115432115433115434115435115436115437115438115439115440115441115442115443115444115445115446115447115448115449115450115451115452115453115454115455115456115457115458115459115460115461115462115463115464115465115466115467115468115469115470115471115472115473115474115475115476115477115478115479115480115481115482115483115484115485115486115487115488115489115490115491115492115493115494115495115496115497115498115499115500115501115502115503115504115505115506115507115508115509115510115511115512115513115514115515115516115517115518115519115520115521115522115523115524115525115526115527115528115529115530115531115532115533115534115535115536115537115538115539115540115541115542115543115544115545115546115547115548115549115550115551115552115553115554115555115556115557115558115559115560115561115562115563115564115565115566115567115568115569115570115571115572115573115574115575115576115577115578115579115580115581115582115583115584115585115586115587115588115589115590115591115592115593115594115595115596115597115598115599115600115601115602115603115604115605115606115607115608115609115610115611115612115613115614115615115616115617115618115619115620115621115622115623115624115625115626115627115628115629115630115631115632115633115634115635115636115637115638115639115640115641115642115643115644115645115646115647115648115649115650115651115652115653115654115655115656115657115658115659115660115661115662115663115664115665115666115667115668115669115670115671115672115673115674115675115676115677115678115679115680115681115682115683115684115685115686115687115688115689115690115691115692115693115694115695115696115697115698115699115700115701115702115703115704115705115706115707115708115709115710115711115712115713115714115715115716115717115718115719115720115721115722115723115724115725115726115727115728115729115730115731115732115733115734115735115736115737115738115739115740115741115742115743115744115745115746115747115748115749115750115751115752115753115754115755115756115757115758115759115760115761115762115763115764115765115766115767115768115769115770115771115772115773115774115775115776115777115778115779115780115781115782115783115784115785115786115787115788115789115790115791115792115793115794115795115796115797115798115799115800115801115802115803115804115805115806115807115808115809115810115811115812115813115814115815115816115817115818115819115820115821115822115823115824115825115826115827115828115829115830115831115832115833115834115835115836115837115838115839115840115841115842115843115844115845115846115847115848115849115850115851115852115853115854115855115856115857115858115859115860115861115862115863115864115865115866115867115868115869115870115871115872115873115874115875115876115877115878115879115880115881115882115883115884115885115886115887115888115889115890115891115892115893115894115895115896115897115898115899115900115901115902115903115904115905115906115907115908115909115910115911115912115913115914115915115916115917115918115919115920115921115922115923115924115925115926115927115928115929115930115931115932115933115934115935115936115937115938115939115940115941115942115943115944115945115946115947115948115949115950115951115952115953115954115955115956115957115958115959115960115961115962115963115964115965115966115967115968115969115970115971115972115973115974115975115976115977115978115979115980115981115982115983115984115985115986115987115988115989115990115991115992115993115994115995115996115997115998115999116000116001116002116003116004116005116006116007116008116009116010116011116012116013116014116015116016116017116018116019116020116021116022116023116024116025116026116027116028116029116030116031116032116033116034116035116036116037116038116039116040116041116042116043116044116045116046116047116048116049116050116051116052116053116054116055116056116057116058116059116060116061116062116063116064116065116066116067116068116069116070116071116072116073116074116075116076116077116078116079116080116081116082116083116084116085116086116087116088116089116090116091116092116093116094116095116096116097116098116099116100116101116102116103116104116105116106116107116108116109116110116111116112116113116114116115116116116117116118116119116120116121116122116123116124116125116126116127116128116129116130116131116132116133116134116135116136116137116138116139116140116141116142116143116144116145116146116147116148116149116150116151116152116153116154116155116156116157116158116159116160116161116162116163116164116165116166116167116168116169116170116171116172116173116174116175116176116177116178116179116180116181116182116183116184116185116186116187116188116189116190116191116192116193116194116195116196116197116198116199116200116201116202116203116204116205116206116207116208116209116210116211116212116213116214116215116216116217116218116219116220116221116222116223116224116225116226116227116228116229116230116231116232116233116234116235116236116237116238116239116240116241116242116243116244116245116246116247116248116249116250116251116252116253116254116255116256116257116258116259116260116261116262116263116264116265116266116267116268116269116270116271116272116273116274116275116276116277116278116279116280116281116282116283116284116285116286116287116288116289116290116291116292116293116294116295116296116297116298116299116300116301116302116303116304116305116306116307116308116309116310116311116312116313116314116315116316116317116318116319116320116321116322116323116324116325116326116327116328116329116330116331116332116333116334116335116336116337116338116339116340116341116342116343116344116345116346116347116348116349116350116351116352116353116354116355116356116357116358116359116360116361116362116363116364116365116366116367116368116369116370116371116372116373116374116375116376116377116378116379116380116381116382116383116384116385116386116387116388116389116390116391116392116393116394116395116396116397116398116399116400116401116402116403116404116405116406116407116408116409116410116411116412116413116414116415116416116417116418116419116420116421116422116423116424116425116426116427116428116429116430116431116432116433116434116435116436116437116438116439116440116441116442116443116444116445116446116447116448116449116450116451116452116453116454116455116456116457116458116459116460116461116462116463116464116465116466116467116468116469116470116471116472116473116474116475116476116477116478116479116480116481116482116483116484116485116486116487116488116489116490116491116492116493116494116495116496116497116498116499116500116501116502116503116504116505116506116507116508116509116510116511116512116513116514116515116516116517116518116519116520116521116522116523116524116525116526116527116528116529116530116531116532116533116534116535116536116537116538116539116540116541116542116543116544116545116546116547116548116549116550116551116552116553116554116555116556116557116558116559116560116561116562116563116564116565116566116567116568116569116570116571116572116573116574116575116576116577116578116579116580116581116582116583116584116585116586116587116588116589116590116591116592116593116594116595116596116597116598116599116600116601116602116603116604116605116606116607116608116609116610116611116612116613116614116615116616116617116618116619116620116621116622116623116624116625116626116627116628116629116630116631116632116633116634116635116636116637116638116639116640116641116642116643116644116645116646116647116648116649116650116651116652116653116654116655116656116657116658116659116660116661116662116663116664116665116666116667116668116669116670116671116672116673116674116675116676116677116678116679116680116681116682116683116684116685116686116687116688116689116690116691116692116693116694116695116696116697116698116699116700116701116702116703116704116705116706116707116708116709116710116711116712116713116714116715116716116717116718116719116720116721116722116723116724116725116726116727116728116729116730116731116732116733116734116735116736116737116738116739116740116741116742116743116744116745116746116747116748116749116750116751116752116753116754116755116756116757116758116759116760116761116762116763116764116765116766116767116768116769116770116771116772116773116774116775116776116777116778116779116780116781116782116783116784116785116786116787116788116789116790116791116792116793116794116795116796116797116798116799116800116801116802116803116804116805116806116807116808116809116810116811116812116813116814116815116816116817116818116819116820116821116822116823116824116825116826116827116828116829116830116831116832116833116834116835116836116837116838116839116840116841116842116843116844116845116846116847116848116849116850116851116852116853116854116855116856116857116858116859116860116861116862116863116864116865116866116867116868116869116870116871116872116873116874116875116876116877116878116879116880116881116882116883116884116885116886116887116888116889116890116891116892116893116894116895116896116897116898116899116900116901116902116903116904116905116906116907116908116909116910116911116912116913116914116915116916116917116918116919116920116921116922116923116924116925116926116927116928116929116930116931116932116933116934116935116936116937116938116939116940116941116942116943116944116945116946116947116948116949116950116951116952116953116954116955116956116957116958116959116960116961116962116963116964116965116966116967116968116969116970116971116972116973116974116975116976116977116978116979116980116981116982116983116984116985116986116987116988116989116990116991116992116993116994116995116996116997116998116999117000117001117002117003117004117005117006117007117008117009117010117011117012117013117014117015117016117017117018117019117020117021117022117023117024117025117026117027117028117029117030117031117032117033117034117035117036117037117038117039117040117041117042117043117044117045117046117047117048117049117050117051117052117053117054117055117056117057117058117059117060117061117062117063117064117065117066117067117068117069117070117071117072117073117074117075117076117077117078117079117080117081117082117083117084117085117086117087117088117089117090117091117092117093117094117095117096117097117098117099117100117101117102117103117104117105117106117107117108117109117110117111117112117113117114117115117116117117117118117119117120117121117122117123117124117125117126117127117128117129117130117131117132117133117134117135117136117137117138117139117140117141117142117143117144117145117146117147117148117149117150117151117152117153117154117155117156117157117158117159117160117161117162117163117164117165117166117167117168117169117170117171117172117173117174117175117176117177117178117179117180117181117182117183117184117185117186117187117188117189117190117191117192117193117194117195117196117197117198117199117200117201117202117203117204117205117206117207117208117209117210117211117212117213117214117215117216117217117218117219117220117221117222117223117224117225117226117227117228117229117230117231117232117233117234117235117236117237117238117239117240117241117242117243117244117245117246117247117248117249117250117251117252117253117254117255117256117257117258117259117260117261117262117263117264117265117266117267117268117269117270117271117272117273117274117275117276117277117278117279117280117281117282117283117284117285117286117287117288117289117290117291117292117293117294117295117296117297117298117299117300117301117302117303117304117305117306117307117308117309117310117311117312117313117314117315117316117317117318117319117320117321117322117323117324117325117326117327117328117329117330117331117332117333117334117335117336117337117338117339117340117341117342117343117344117345117346117347117348117349117350117351117352117353117354117355117356117357117358117359117360117361117362117363117364117365117366117367117368117369117370117371117372117373117374117375117376117377117378117379117380117381117382117383117384117385117386117387117388117389117390117391117392117393117394117395117396117397117398117399117400117401117402117403117404117405117406117407117408117409117410117411117412117413117414117415117416117417117418117419117420117421117422117423117424117425117426117427117428117429117430117431117432117433117434117435117436117437117438117439117440117441117442117443117444117445117446117447117448117449117450117451117452117453117454117455117456117457117458117459117460117461117462117463117464117465117466117467117468117469117470117471117472117473117474117475117476117477117478117479117480117481117482117483117484117485117486117487117488117489117490117491117492117493117494117495117496117497117498117499117500117501117502117503117504117505117506117507117508117509117510117511117512117513117514117515117516117517117518117519117520117521117522117523117524117525117526117527117528117529117530117531117532117533117534117535117536117537117538117539117540117541117542117543117544117545117546117547117548117549117550117551117552117553117554117555117556117557117558117559117560117561117562117563117564117565117566117567117568117569117570117571117572117573117574117575117576117577117578117579117580117581117582117583117584117585117586117587117588117589117590117591117592117593117594117595117596117597117598117599117600117601117602117603117604117605117606117607117608117609117610117611117612117613117614117615117616117617117618117619117620117621117622117623117624117625117626117627117628117629117630117631117632117633117634117635117636117637117638117639117640117641117642117643117644117645117646117647117648117649117650117651117652117653117654117655117656117657117658117659117660117661117662117663117664117665117666117667117668117669117670117671117672117673117674117675117676117677117678117679117680117681117682117683117684117685117686117687117688117689117690117691117692117693117694117695117696117697117698117699117700117701117702117703117704117705117706117707117708117709117710117711117712117713117714117715117716117717117718117719117720117721117722117723117724117725117726117727117728117729117730117731117732117733117734117735117736117737117738117739117740117741117742117743117744117745117746117747117748117749117750117751117752117753117754117755117756117757117758117759117760117761117762117763117764117765117766117767117768117769117770117771117772117773117774117775117776117777117778117779117780117781117782117783117784117785117786117787117788117789117790117791117792117793117794117795117796117797117798117799117800117801117802117803117804117805117806117807117808117809117810117811117812117813117814117815117816117817117818117819117820117821117822117823117824117825117826117827117828117829117830117831117832117833117834117835117836117837117838117839117840117841117842117843117844117845117846117847117848117849117850117851117852117853117854117855117856117857117858117859117860117861117862117863117864117865117866117867117868117869117870117871117872117873117874117875117876117877117878117879117880117881117882117883117884117885117886117887117888117889117890117891117892117893117894117895117896117897117898117899117900117901117902117903117904117905117906117907117908117909117910117911117912117913117914117915117916117917117918117919117920117921117922117923117924117925117926117927117928117929117930117931117932117933117934117935117936117937117938117939117940117941117942117943117944117945117946117947117948117949117950117951117952117953117954117955117956117957117958117959117960117961117962117963117964117965117966117967117968117969117970117971117972117973117974117975117976117977117978117979117980117981117982117983117984117985117986117987117988117989117990117991117992117993117994117995117996117997117998117999118000118001118002118003118004118005118006118007118008118009118010118011118012118013118014118015118016118017118018118019118020118021118022118023118024118025118026118027118028118029118030118031118032118033118034118035118036118037118038118039118040118041118042118043118044118045118046118047118048118049118050118051118052118053118054118055118056118057118058118059118060118061118062118063118064118065118066118067118068118069118070118071118072118073118074118075118076118077118078118079118080118081118082118083118084118085118086118087118088118089118090118091118092118093118094118095118096118097118098118099118100118101118102118103118104118105118106118107118108118109118110118111118112118113118114118115118116118117118118118119118120118121118122118123118124118125118126118127118128118129118130118131118132118133118134118135118136118137118138118139118140118141118142118143118144118145118146118147118148118149118150118151118152118153118154118155118156118157118158118159118160118161118162118163118164118165118166118167118168118169118170118171118172118173118174118175118176118177118178118179118180118181118182118183118184118185118186118187118188118189118190118191118192118193118194118195118196118197118198118199118200118201118202118203118204118205118206118207118208118209118210118211118212118213118214118215118216118217118218118219118220118221118222118223118224118225118226118227118228118229118230118231118232118233118234118235118236118237118238118239118240118241118242118243118244118245118246118247118248118249118250118251118252118253118254118255118256118257118258118259118260118261118262118263118264118265118266118267118268118269118270118271118272118273118274118275118276118277118278118279118280118281118282118283118284118285118286118287118288118289118290118291118292118293118294118295118296118297118298118299118300118301118302118303118304118305118306118307118308118309118310118311118312118313118314118315118316118317118318118319118320118321118322118323118324118325118326118327118328118329118330118331118332118333118334118335118336118337118338118339118340118341118342118343118344118345118346118347118348118349118350118351118352118353118354118355118356118357118358118359118360118361118362118363118364118365118366118367118368118369118370118371118372118373118374118375118376118377118378118379118380118381118382118383118384118385118386118387118388118389118390118391118392118393118394118395118396118397118398118399118400118401118402118403118404118405118406118407118408118409118410118411118412118413118414118415118416118417118418118419118420118421118422118423118424118425118426118427118428118429118430118431118432118433118434118435118436118437118438118439118440118441118442118443118444118445118446118447118448118449118450118451118452118453118454118455118456118457118458118459118460118461118462118463118464118465118466118467118468118469118470118471118472118473118474118475118476118477118478118479118480118481118482118483118484118485118486118487118488118489118490118491118492118493118494118495118496118497118498118499118500118501118502118503118504118505118506118507118508118509118510118511118512118513118514118515118516118517118518118519118520118521118522118523118524118525118526118527118528118529118530118531118532118533118534118535118536118537118538118539118540118541118542118543118544118545118546118547118548118549118550118551118552118553118554118555118556118557118558118559118560118561118562118563118564118565118566118567118568118569118570118571118572118573118574118575118576118577118578118579118580118581118582118583118584118585118586118587118588118589118590118591118592118593118594118595118596118597118598118599118600118601118602118603118604118605118606118607118608118609118610118611118612118613118614118615118616118617118618118619118620118621118622118623118624118625118626118627118628118629118630118631118632118633118634118635118636118637118638118639118640118641118642118643118644118645118646118647118648118649118650118651118652118653118654118655118656118657118658118659118660118661118662118663118664118665118666118667118668118669118670118671118672118673118674118675118676118677118678118679118680118681118682118683118684118685118686118687118688118689118690118691118692118693118694118695118696118697118698118699118700118701118702118703118704118705118706118707118708118709118710118711118712118713118714118715118716118717118718118719118720118721118722118723118724118725118726118727118728118729118730118731118732118733118734118735118736118737118738118739118740118741118742118743118744118745118746118747118748118749118750118751118752118753118754118755118756118757118758118759118760118761118762118763118764118765118766118767118768118769118770118771118772118773118774118775118776118777118778118779118780118781118782118783118784118785118786118787118788118789118790118791118792118793118794118795118796118797118798118799118800118801118802118803118804118805118806118807118808118809118810118811118812118813118814118815118816118817118818118819118820118821118822118823118824118825118826118827118828118829118830118831118832118833118834118835118836118837118838118839118840118841118842118843118844118845118846118847118848118849118850118851118852118853118854118855118856118857118858118859118860118861118862118863118864118865118866118867118868118869118870118871118872118873118874118875118876118877118878118879118880118881118882118883118884118885118886118887118888118889118890118891118892118893118894118895118896118897118898118899118900118901118902118903118904118905118906118907118908118909118910118911118912118913118914118915118916118917118918118919118920118921118922118923118924118925118926118927118928118929118930118931118932118933118934118935118936118937118938118939118940118941118942118943118944118945118946118947118948118949118950118951118952118953118954118955118956118957118958118959118960118961118962118963118964118965118966118967118968118969118970118971118972118973118974118975118976118977118978118979118980118981118982118983118984118985118986118987118988118989118990118991118992118993118994118995118996118997118998118999119000119001119002119003119004119005119006119007119008119009119010119011119012119013119014119015119016119017119018119019119020119021119022119023119024119025119026119027119028119029119030119031119032119033119034119035119036119037119038119039119040119041119042119043119044119045119046119047119048119049119050119051119052119053119054119055119056119057119058119059119060119061119062119063119064119065119066119067119068119069119070119071119072119073119074119075119076119077119078119079119080119081119082119083119084119085119086119087119088119089119090119091119092119093119094119095119096119097119098119099119100119101119102119103119104119105119106119107119108119109119110119111119112119113119114119115119116119117119118119119119120119121119122119123119124119125119126119127119128119129119130119131119132119133119134119135119136119137119138119139119140119141119142119143119144119145119146119147119148119149119150119151119152119153119154119155119156119157119158119159119160119161119162119163119164119165119166119167119168119169119170119171119172119173119174119175119176119177119178119179119180119181119182119183119184119185119186119187119188119189119190119191119192119193119194119195119196119197119198119199119200119201119202119203119204119205119206119207119208119209119210119211119212119213119214119215119216119217119218119219119220119221119222119223119224119225119226119227119228119229119230119231119232119233119234119235119236119237119238119239119240119241119242119243119244119245119246119247119248119249119250119251119252119253119254119255119256119257119258119259119260119261119262119263119264119265119266119267119268119269119270119271119272119273119274119275119276119277119278119279119280119281119282119283119284119285119286119287119288119289119290119291119292119293119294119295119296119297119298119299119300119301119302119303119304119305119306119307119308119309119310119311119312119313119314119315119316119317119318119319119320119321119322119323119324119325119326119327119328119329119330119331119332119333119334119335119336119337119338119339119340119341119342119343119344119345119346119347119348119349119350119351119352119353119354119355119356119357119358119359119360119361119362119363119364119365119366119367119368119369119370119371119372119373119374119375119376119377119378119379119380119381119382119383119384119385119386119387119388119389119390119391119392119393119394119395119396119397119398119399119400119401119402119403119404119405119406119407119408119409119410119411119412119413119414119415119416119417119418119419119420119421119422119423119424119425119426119427119428119429119430119431119432119433119434119435119436119437119438119439119440119441119442119443119444119445119446119447119448119449119450119451119452119453119454119455119456119457119458119459119460119461119462119463119464119465119466119467119468119469119470119471119472119473119474119475119476119477119478119479119480119481119482119483119484119485119486119487119488119489119490119491119492119493119494119495119496119497119498119499119500119501119502119503119504119505119506119507119508119509119510119511119512119513119514119515119516119517119518119519119520119521119522119523119524119525119526119527119528119529119530119531119532119533119534119535119536119537119538119539119540119541119542119543119544119545119546119547119548119549119550119551119552119553119554119555119556119557119558119559119560119561119562119563119564119565119566119567119568119569119570119571119572119573119574119575119576119577119578119579119580119581119582119583119584119585119586119587119588119589119590119591119592119593119594119595119596119597119598119599119600119601119602119603119604119605119606119607119608119609119610119611119612119613119614119615119616119617119618119619119620119621119622119623119624119625119626119627119628119629119630119631119632119633119634119635119636119637119638119639119640119641119642119643119644119645119646119647119648119649119650119651119652119653119654119655119656119657119658119659119660119661119662119663119664119665119666119667119668119669119670119671119672119673119674119675119676119677119678119679119680119681119682119683119684119685119686119687119688119689119690119691119692119693119694119695119696119697119698119699119700119701119702119703119704119705119706119707119708119709119710119711119712119713119714119715119716119717119718119719119720119721119722119723119724119725119726119727119728119729119730119731119732119733119734119735119736119737119738119739119740119741119742119743119744119745119746119747119748119749119750119751119752119753119754119755119756119757119758119759119760119761119762119763119764119765119766119767119768119769119770119771119772119773119774119775119776119777119778119779119780119781119782119783119784119785119786119787119788119789119790119791119792119793119794119795119796119797119798119799119800119801119802119803119804119805119806119807119808119809119810119811119812119813119814119815119816119817119818119819119820119821119822119823119824119825119826119827119828119829119830119831119832119833119834119835119836119837119838119839119840119841119842119843119844119845119846119847119848119849119850119851119852119853119854119855119856119857119858119859119860119861119862119863119864119865119866119867119868119869119870119871119872119873119874119875119876119877119878119879119880119881119882119883119884119885119886119887119888119889119890119891119892119893119894119895119896119897119898119899119900119901119902119903119904119905119906119907119908119909119910119911119912119913119914119915119916119917119918119919119920119921119922119923119924119925119926119927119928119929119930119931119932119933119934119935119936119937119938119939119940119941119942119943119944119945119946119947119948119949119950119951119952119953119954119955119956119957119958119959119960119961119962119963119964119965119966119967119968119969119970119971119972119973119974119975119976119977119978119979119980119981119982119983119984119985119986119987119988119989119990119991119992119993119994119995119996119997119998119999120000120001120002120003120004120005120006120007120008120009120010120011120012120013120014120015120016120017120018120019120020120021120022120023120024120025120026120027120028120029120030120031120032120033120034120035120036120037120038120039120040120041120042120043120044120045120046120047120048120049120050120051120052120053120054120055120056120057120058120059120060120061120062120063120064120065120066120067120068120069120070120071120072120073120074120075120076120077120078120079120080120081120082120083120084120085120086120087120088120089120090120091120092120093120094120095120096120097120098120099120100120101120102120103120104120105120106120107120108120109120110120111120112120113120114120115120116120117120118120119120120120121120122120123120124120125120126120127120128120129120130120131120132120133120134120135120136120137120138120139120140120141120142120143120144120145120146120147120148120149120150120151120152120153120154120155120156120157120158120159120160120161120162120163120164120165120166120167120168120169120170120171120172120173120174120175120176120177120178120179120180120181120182120183120184120185120186120187120188120189120190120191120192120193120194120195120196120197120198120199120200120201120202120203120204120205120206120207120208120209120210120211120212120213120214120215120216120217120218120219120220120221120222120223120224120225120226120227120228120229120230120231120232120233120234120235120236120237120238120239120240120241120242120243120244120245120246120247120248120249120250120251120252120253120254120255120256120257120258120259120260120261120262120263120264120265120266120267120268120269120270120271120272120273120274120275120276120277120278120279120280120281120282120283120284120285120286120287120288120289120290120291120292120293120294120295120296120297120298120299120300120301120302120303120304120305120306120307120308120309120310120311120312120313120314120315120316120317120318120319120320120321120322120323120324120325120326120327120328120329120330120331120332120333120334120335120336120337120338120339120340120341120342120343120344120345120346120347120348120349120350120351120352120353120354120355120356120357120358120359120360120361120362120363120364120365120366120367120368120369120370120371120372120373120374120375120376120377120378120379120380120381120382120383120384120385120386120387120388120389120390120391120392120393120394120395120396120397120398120399120400120401120402120403120404120405120406120407120408120409120410120411120412120413120414120415120416120417120418120419120420120421120422120423120424120425120426120427120428120429120430120431120432120433120434120435120436120437120438120439120440120441120442120443120444120445120446120447120448120449120450120451120452120453120454120455120456120457120458120459120460120461120462120463120464120465120466120467120468120469120470120471120472120473120474120475120476120477120478120479120480120481120482120483120484120485120486120487120488120489120490120491120492120493120494120495120496120497120498120499120500120501120502120503120504120505120506120507120508120509120510120511120512120513120514120515120516120517120518120519120520120521120522120523120524120525120526120527120528120529120530120531120532120533120534120535120536120537120538120539120540120541120542120543120544120545120546120547120548120549120550120551120552120553120554120555120556120557120558120559120560120561120562120563120564120565120566120567120568120569120570120571120572120573120574120575120576120577120578120579120580120581120582120583120584120585120586120587120588120589120590120591120592120593120594120595120596120597120598120599120600120601120602120603120604120605120606120607120608120609120610120611120612120613120614120615120616120617120618120619120620120621120622120623120624120625120626120627120628120629120630120631120632120633120634120635120636120637120638120639120640120641120642120643120644120645120646120647120648120649120650120651120652120653120654120655120656120657120658120659120660120661120662120663120664120665120666120667120668120669120670120671120672120673120674120675120676120677120678120679120680120681120682120683120684120685120686120687120688120689120690120691120692120693120694120695120696120697120698120699120700120701120702120703120704120705120706120707120708120709120710120711120712120713120714120715120716120717120718120719120720120721120722120723120724120725120726120727120728120729120730120731120732120733120734120735120736120737120738120739120740120741120742120743120744120745120746120747120748120749120750120751120752120753120754120755120756120757120758120759120760120761120762120763120764120765120766120767120768120769120770120771120772120773120774120775120776120777120778120779120780120781120782120783120784120785120786120787120788120789120790120791120792120793120794120795120796120797120798120799120800120801120802120803120804120805120806120807120808120809120810120811120812120813120814120815120816120817120818120819120820120821120822120823120824120825120826120827120828120829120830120831120832120833120834120835120836120837120838120839120840120841120842120843120844120845120846120847120848120849120850120851120852120853120854120855120856120857120858120859120860120861120862120863120864120865120866120867120868120869120870120871120872120873120874120875120876120877120878120879120880120881120882120883120884120885120886120887120888120889120890120891120892120893120894120895120896120897120898120899120900120901120902120903120904120905120906120907120908120909120910120911120912120913120914120915120916120917120918120919120920120921120922120923120924120925120926120927120928120929120930120931120932120933120934120935120936120937120938120939120940120941120942120943120944120945120946120947120948120949120950120951120952120953120954120955120956120957120958120959120960120961120962120963120964120965120966120967120968120969120970120971120972120973120974120975120976120977120978120979120980120981120982120983120984120985120986120987120988120989120990120991120992120993120994120995120996120997120998120999121000121001121002121003121004121005121006121007121008121009121010121011121012121013121014121015121016121017121018121019121020121021121022121023121024121025121026121027121028121029121030121031121032121033121034121035121036121037121038121039121040121041121042121043121044121045121046121047121048121049121050121051121052121053121054121055121056121057121058121059121060121061121062121063121064121065121066121067121068121069121070121071121072121073121074121075121076121077121078121079121080121081121082121083121084121085121086121087121088121089121090121091121092121093121094121095121096121097121098121099121100121101121102121103121104121105121106121107121108121109121110121111121112121113121114121115121116121117121118121119121120121121121122121123121124121125121126121127121128121129121130121131121132121133121134121135121136121137121138121139121140121141121142121143121144121145121146121147121148121149121150121151121152121153121154121155121156121157121158121159121160121161121162121163121164121165121166121167121168121169121170121171121172121173121174121175121176121177121178121179121180121181121182121183121184121185121186121187121188121189121190121191121192121193121194121195121196121197121198121199121200121201121202121203121204121205121206121207121208121209121210121211121212121213121214121215121216121217121218121219121220121221121222121223121224121225121226121227121228121229121230121231121232121233121234121235121236121237121238121239121240121241121242121243121244121245121246121247121248121249121250121251121252121253121254121255121256121257121258121259121260121261121262121263121264121265121266121267121268121269121270121271121272121273121274121275121276121277121278121279121280121281121282121283121284121285121286121287121288121289121290121291121292121293121294121295121296121297121298121299121300121301121302121303121304121305121306121307121308121309121310121311121312121313121314121315121316121317121318121319121320121321121322121323121324121325121326121327121328121329121330121331121332121333121334121335121336121337121338121339121340121341121342121343121344121345121346121347121348121349121350121351121352121353121354121355121356121357121358121359121360121361121362121363121364121365121366121367121368121369121370121371121372121373121374121375121376121377121378121379121380121381121382121383121384121385121386121387121388121389121390121391121392121393121394121395121396121397121398121399121400121401121402121403121404121405121406121407121408121409121410121411121412121413121414121415121416121417121418121419121420121421121422121423121424121425121426121427121428121429121430121431121432121433121434121435121436121437121438121439121440121441121442121443121444121445121446121447121448121449121450121451121452121453121454121455121456121457121458121459121460121461121462121463121464121465121466121467121468121469121470121471121472121473121474121475121476121477121478121479121480121481121482121483121484121485121486121487121488121489121490121491121492121493121494121495121496121497121498121499121500121501121502121503121504121505121506121507121508121509121510121511121512121513121514121515121516121517121518121519121520121521121522121523121524121525121526121527121528121529121530121531121532121533121534121535121536121537121538121539121540121541121542121543121544121545121546121547121548121549121550121551121552121553121554121555121556121557121558121559121560121561121562121563121564121565121566121567121568121569121570121571121572121573121574121575121576121577121578121579121580121581121582121583121584121585121586121587121588121589121590121591121592121593121594121595121596121597121598121599121600121601121602121603121604121605121606121607121608121609121610121611121612121613121614121615121616121617121618121619121620121621121622121623121624121625121626121627121628121629121630121631121632121633121634121635121636121637121638121639121640121641121642121643121644121645121646121647121648121649121650121651121652121653121654121655121656121657121658121659121660121661121662121663121664121665121666121667121668121669121670121671121672121673121674121675121676121677121678121679121680121681121682121683121684121685121686121687121688121689121690121691121692121693121694121695121696121697121698121699121700121701121702121703121704121705121706121707121708121709121710121711121712121713121714121715121716121717121718121719121720121721121722121723121724121725121726121727121728121729121730121731121732121733121734121735121736121737121738121739121740121741121742121743121744121745121746121747121748121749121750121751121752121753121754121755121756121757121758121759121760121761121762121763121764121765121766121767121768121769121770121771121772121773121774121775121776121777121778121779121780121781121782121783121784121785121786121787121788121789121790121791121792121793121794121795121796121797121798121799121800121801121802121803121804121805121806121807121808121809121810121811121812121813121814121815121816121817121818121819121820121821121822121823121824121825121826121827121828121829121830121831121832121833121834121835121836121837121838121839121840121841121842121843121844121845121846121847121848121849121850121851121852121853121854121855121856121857121858121859121860121861121862121863121864121865121866121867121868121869121870121871121872121873121874121875121876121877121878121879121880121881121882121883121884121885121886121887121888121889121890121891121892121893121894121895121896121897121898121899121900121901121902121903121904121905121906121907121908121909121910121911121912121913121914121915121916121917121918121919121920121921121922121923121924121925121926121927121928121929121930121931121932121933121934121935121936121937121938121939121940121941121942121943121944121945121946121947121948121949121950121951121952121953121954121955121956121957121958121959121960121961121962121963121964121965121966121967121968121969121970121971121972121973121974121975121976121977121978121979121980121981121982121983121984121985121986121987121988121989121990121991121992121993121994121995121996121997121998121999122000122001122002122003122004122005122006122007122008122009122010122011122012122013122014122015122016122017122018122019122020122021122022122023122024122025122026122027122028122029122030122031122032122033122034122035122036122037122038122039122040122041122042122043122044122045122046122047122048122049122050122051122052122053122054122055122056122057122058122059122060122061122062122063122064122065122066122067122068122069122070122071122072122073122074122075122076122077122078122079122080122081122082122083122084122085122086122087122088122089122090122091122092122093122094122095122096122097122098122099122100122101122102122103122104122105122106122107122108122109122110122111122112122113122114122115122116122117122118122119122120122121122122122123122124122125122126122127122128122129122130122131122132122133122134122135122136122137122138122139122140122141122142122143122144122145122146122147122148122149122150122151122152122153122154122155122156122157122158122159122160122161122162122163122164122165122166122167122168122169122170122171122172122173122174122175122176122177122178122179122180122181122182122183122184122185122186122187122188122189122190122191122192122193122194122195122196122197122198122199122200122201122202122203122204122205122206122207122208122209122210122211122212122213122214122215122216122217122218122219122220122221122222122223122224122225122226122227122228122229122230122231122232122233122234122235122236122237122238122239122240122241122242122243122244122245122246122247122248122249122250122251122252122253122254122255122256122257122258122259122260122261122262122263122264122265122266122267122268122269122270122271122272122273122274122275122276122277122278122279122280122281122282122283122284122285122286122287122288122289122290122291122292122293122294122295122296122297122298122299122300122301122302122303122304122305122306122307122308122309122310122311122312122313122314122315122316122317122318122319122320122321122322122323122324122325122326122327122328122329122330122331122332122333122334122335122336122337122338122339122340122341122342122343122344122345122346122347122348122349122350122351122352122353122354122355122356122357122358122359122360122361122362122363122364122365122366122367122368122369122370122371122372122373122374122375122376122377122378122379122380122381122382122383122384122385122386122387122388122389122390122391122392122393122394122395122396122397122398122399122400122401122402122403122404122405122406122407122408122409122410122411122412122413122414122415122416122417122418122419122420122421122422122423122424122425122426122427122428122429122430122431122432122433122434122435122436122437122438122439122440122441122442122443122444122445122446122447122448122449122450122451122452122453122454122455122456122457122458122459122460122461122462122463122464122465122466122467122468122469122470122471122472122473122474122475122476122477122478122479122480122481122482122483122484122485122486122487122488122489122490122491122492122493122494122495122496122497122498122499122500122501122502122503122504122505122506122507122508122509122510122511122512122513122514122515122516122517122518122519122520122521122522122523122524122525122526122527122528122529122530122531122532122533122534122535122536122537122538122539122540122541122542122543122544122545122546122547122548122549122550122551122552122553122554122555122556122557122558122559122560122561122562122563122564122565122566122567122568122569122570122571122572122573122574122575122576122577122578122579122580122581122582122583122584122585122586122587122588122589122590122591122592122593122594122595122596122597122598122599122600122601122602122603122604122605122606122607122608122609122610122611122612122613122614122615122616122617122618122619122620122621122622122623122624122625122626122627122628122629122630122631122632122633122634122635122636122637122638122639122640122641122642122643122644122645122646122647122648122649122650122651122652122653122654122655122656122657122658122659122660122661122662122663122664122665122666122667122668122669122670122671122672122673122674122675122676122677122678122679122680122681122682122683122684122685122686122687122688122689122690122691122692122693122694122695122696122697122698122699122700122701122702122703122704122705122706122707122708122709122710122711122712122713122714122715122716122717122718122719122720122721122722122723122724122725122726122727122728122729122730122731122732122733122734122735122736122737122738122739122740122741122742122743122744122745122746122747122748122749122750122751122752122753122754122755122756122757122758122759122760122761122762122763122764122765122766122767122768122769122770122771122772122773122774122775122776122777122778122779122780122781122782122783122784122785122786122787122788122789122790122791122792122793122794122795122796122797122798122799122800122801122802122803122804122805122806122807122808122809122810122811122812122813122814122815122816122817122818122819122820122821122822122823122824122825122826122827122828122829122830122831122832122833122834122835122836122837122838122839122840122841122842122843122844122845122846122847122848122849122850122851122852122853122854122855122856122857122858122859122860122861122862122863122864122865122866122867122868122869122870122871122872122873122874122875122876122877122878122879122880122881122882122883122884122885122886122887122888122889122890122891122892122893122894122895122896122897122898122899122900122901122902122903122904122905122906122907122908122909122910122911122912122913122914122915122916122917122918122919122920122921122922122923122924122925122926122927122928122929122930122931122932122933122934122935122936122937122938122939122940122941122942122943122944122945122946122947122948122949122950122951122952122953122954122955122956122957122958122959122960122961122962122963122964122965122966122967122968122969122970122971122972122973122974122975122976122977122978122979122980122981122982122983122984122985122986122987122988122989122990122991122992122993122994122995122996122997122998122999123000123001123002123003123004123005123006123007123008123009123010123011123012123013123014123015123016123017123018123019123020123021123022123023123024123025123026123027123028123029123030123031123032123033123034123035123036123037123038123039123040123041123042123043123044123045123046123047123048123049123050123051123052123053123054123055123056123057123058123059123060123061123062123063123064123065123066123067123068123069123070123071123072123073123074123075123076123077123078123079123080123081123082123083123084123085123086123087123088123089123090123091123092123093123094123095123096123097123098123099123100123101123102123103123104123105123106123107123108123109123110123111123112123113123114123115123116123117123118123119123120123121123122123123123124123125123126123127123128123129123130123131123132123133123134123135123136123137123138123139123140123141123142123143123144123145123146123147123148123149123150123151123152123153123154123155123156123157123158123159123160123161123162123163123164123165123166123167123168123169123170123171123172123173123174123175123176123177123178123179123180123181123182123183123184123185123186123187123188123189123190123191123192123193123194123195123196123197123198123199123200123201123202123203123204123205123206123207123208123209123210123211123212123213123214123215123216123217123218123219123220123221123222123223123224123225123226123227123228123229123230123231123232123233123234123235123236123237123238123239123240123241123242123243123244123245123246123247123248123249123250123251123252123253123254123255123256123257123258123259123260123261123262123263123264123265123266123267123268123269123270123271123272123273123274123275123276123277123278123279123280123281123282123283123284123285123286123287123288123289123290123291123292123293123294123295123296123297123298123299123300123301123302123303123304123305123306123307123308123309123310123311123312123313123314123315123316123317123318123319123320123321123322123323123324123325123326123327123328123329123330123331123332123333123334123335123336123337123338123339123340123341123342123343123344123345123346123347123348123349123350123351123352123353123354123355123356123357123358123359123360123361123362123363123364123365123366123367123368123369123370123371123372123373123374123375123376123377123378123379123380123381123382123383123384123385123386123387123388123389123390123391123392123393123394123395123396123397123398123399123400123401123402123403123404123405123406123407123408123409123410123411123412123413123414123415123416123417123418123419123420123421123422123423123424123425123426123427123428123429123430123431123432123433123434123435123436123437123438123439123440123441123442123443123444123445123446123447123448123449123450123451123452123453123454123455123456123457123458123459123460123461123462123463123464123465123466123467123468123469123470123471123472123473123474123475123476123477123478123479123480123481123482123483123484123485123486123487123488123489123490123491123492123493123494123495123496123497123498123499123500123501123502123503123504123505123506123507123508123509123510123511123512123513123514123515123516123517123518123519123520123521123522123523123524123525123526123527123528123529123530123531123532123533123534123535123536123537123538123539123540123541123542123543123544123545123546123547123548123549123550123551123552123553123554123555123556123557123558123559123560123561123562123563123564123565123566123567123568123569123570123571123572123573123574123575123576123577123578123579123580123581123582123583123584123585123586123587123588123589123590123591123592123593123594123595123596123597123598123599123600123601123602123603123604123605123606123607123608123609123610123611123612123613123614123615123616123617123618123619123620123621123622123623123624123625123626123627123628123629123630123631123632123633123634123635123636123637123638123639123640123641123642123643123644123645123646123647123648123649123650123651123652123653123654123655123656123657123658123659123660123661123662123663123664123665123666123667123668123669123670123671123672123673123674123675123676123677123678123679123680123681123682123683123684123685123686123687123688123689123690123691123692123693123694123695123696123697123698123699123700123701123702123703123704123705123706123707123708123709123710123711123712123713123714123715123716123717123718123719123720123721123722123723123724123725123726123727123728123729123730123731123732123733123734123735123736123737123738123739123740123741123742123743123744123745123746123747123748123749123750123751123752123753123754123755123756123757123758123759123760123761123762123763123764123765123766123767123768123769123770123771123772123773123774123775123776123777123778123779123780123781123782123783123784123785123786123787123788123789123790123791123792123793123794123795123796123797123798123799123800123801123802123803123804123805123806123807123808123809123810123811123812123813123814123815123816123817123818123819123820123821123822123823123824123825123826123827123828123829123830123831123832123833123834123835123836123837123838123839123840123841123842123843123844123845123846123847123848123849123850123851123852123853123854123855123856123857123858123859123860123861123862123863123864123865123866123867123868123869123870123871123872123873123874123875123876123877123878123879123880123881123882123883123884123885123886123887123888123889123890123891123892123893123894123895123896123897123898123899123900123901123902123903123904123905123906123907123908123909123910123911123912123913123914123915123916123917123918123919123920123921123922123923123924123925123926123927123928123929123930123931123932123933123934123935123936123937123938123939123940123941123942123943123944123945123946123947123948123949123950123951123952123953123954123955123956123957123958123959123960123961123962123963123964123965123966123967123968123969123970123971123972123973123974123975123976123977123978123979123980123981123982123983123984123985123986123987123988123989123990123991123992123993123994123995123996123997123998123999124000124001124002124003124004124005124006124007124008124009124010124011124012124013124014124015124016124017124018124019124020124021124022124023124024124025124026124027124028124029124030124031124032124033124034124035124036124037124038124039124040124041124042124043124044124045124046124047124048124049124050124051124052124053124054124055124056124057124058124059124060124061124062124063124064124065124066124067124068124069124070124071124072124073124074124075124076124077124078124079124080124081124082124083124084124085124086124087124088124089124090124091124092124093124094124095124096124097124098124099124100124101124102124103124104124105124106124107124108124109124110124111124112124113124114124115124116124117124118124119124120124121124122124123124124124125124126124127124128124129124130124131124132124133124134124135124136124137124138124139124140124141124142124143124144124145124146124147124148124149124150124151124152124153124154124155124156124157124158124159124160124161124162124163124164124165124166124167124168124169124170124171124172124173124174124175124176124177124178124179124180124181124182124183124184124185124186124187124188124189124190124191124192124193124194124195124196124197124198124199124200124201124202124203124204124205124206124207124208124209124210124211124212124213124214124215124216124217124218124219124220124221124222124223124224124225124226124227124228124229124230124231124232124233124234124235124236124237124238124239124240124241124242124243124244124245124246124247124248124249124250124251124252124253124254124255124256124257124258124259124260124261124262124263124264124265124266124267124268124269124270124271124272124273124274124275124276124277124278124279124280124281124282124283124284124285124286124287124288124289124290124291124292124293124294124295124296124297124298124299124300124301124302124303124304124305124306124307124308124309124310124311124312124313124314124315124316124317124318124319124320124321124322124323124324124325124326124327124328124329124330124331124332124333124334124335124336124337124338124339124340124341124342124343124344124345124346124347124348124349124350124351124352124353124354124355124356124357124358124359124360124361124362124363124364124365124366124367124368124369124370124371124372124373124374124375124376124377124378124379124380124381124382124383124384124385124386124387124388124389124390124391124392124393124394124395124396124397124398124399124400124401124402124403124404124405124406124407124408124409124410124411124412124413124414124415124416124417124418124419124420124421124422124423124424124425124426124427124428124429124430124431124432124433124434124435124436124437124438124439124440124441124442124443124444124445124446124447124448124449124450124451124452124453124454124455124456124457124458124459124460124461124462124463124464124465124466124467124468124469124470124471124472124473124474124475124476124477124478124479124480124481124482124483124484124485124486124487124488124489124490124491124492124493124494124495124496124497124498124499124500124501124502124503124504124505124506124507124508124509124510124511124512124513124514124515124516124517124518124519124520124521124522124523124524124525124526124527124528124529124530124531124532124533124534124535124536124537124538124539124540124541124542124543124544124545124546124547124548124549124550124551124552124553124554124555124556124557124558124559124560124561124562124563124564124565124566124567124568124569124570124571124572124573124574124575124576124577124578124579124580124581124582124583124584124585124586124587124588124589124590124591124592124593124594124595124596124597124598124599124600124601124602124603124604124605124606124607124608124609124610124611124612124613124614124615124616124617124618124619124620124621124622124623124624124625124626124627124628124629124630124631124632124633124634124635124636124637124638124639124640124641124642124643124644124645124646124647124648124649124650124651124652124653124654124655124656124657124658124659124660124661124662124663124664124665124666124667124668124669124670124671124672124673124674124675124676124677124678124679124680124681124682124683124684124685124686124687124688124689124690124691124692124693124694124695124696124697124698124699124700124701124702124703124704124705124706124707124708124709124710124711124712124713124714124715124716124717124718124719124720124721124722124723124724124725124726124727124728124729124730124731124732124733124734124735124736124737124738124739124740124741124742124743124744124745124746124747124748124749124750124751124752124753124754124755124756124757124758124759124760124761124762124763124764124765124766124767124768124769124770124771124772124773124774124775124776124777124778124779124780124781124782124783124784124785124786124787124788124789124790124791124792124793124794124795124796124797124798124799124800124801124802124803124804124805124806124807124808124809124810124811124812124813124814124815124816124817124818124819124820124821124822124823124824124825124826124827124828124829124830124831124832124833124834124835124836124837124838124839124840124841124842124843124844124845124846124847124848124849124850124851124852124853124854124855124856124857124858124859124860124861124862124863124864124865124866124867124868124869124870124871124872124873124874124875124876124877124878124879124880124881124882124883124884124885124886124887124888124889124890124891124892124893124894124895124896124897124898124899124900124901124902124903124904124905124906124907124908124909124910124911124912124913124914124915124916124917124918124919124920124921124922124923124924124925124926124927124928124929124930124931124932124933124934124935124936124937124938124939124940124941124942124943124944124945124946124947124948124949124950124951124952124953124954124955124956124957124958124959124960124961124962124963124964124965124966124967124968124969124970124971124972124973124974124975124976124977124978124979124980124981124982124983124984124985124986124987124988124989124990124991124992124993124994124995124996124997124998124999125000125001125002125003125004125005125006125007125008125009125010125011125012125013125014125015125016125017125018125019125020125021125022125023125024125025125026125027125028125029125030125031125032125033125034125035125036125037125038125039125040125041125042125043125044125045125046125047125048125049125050125051125052125053125054125055125056125057125058125059125060125061125062125063125064125065125066125067125068125069125070125071125072125073125074125075125076125077125078125079125080125081125082125083125084125085125086125087125088125089125090125091125092125093125094125095125096125097125098125099125100125101125102125103125104125105125106125107125108125109125110125111125112125113125114125115125116125117125118125119125120125121125122125123125124125125125126125127125128125129125130125131125132125133125134125135125136125137125138125139125140125141125142125143125144125145125146125147125148125149125150125151125152125153125154125155125156125157125158125159125160125161125162125163125164125165125166125167125168125169125170125171125172125173125174125175125176125177125178125179125180125181125182125183125184125185125186125187125188125189125190125191125192125193125194125195125196125197125198125199125200125201125202125203125204125205125206125207125208125209125210125211125212125213125214125215125216125217125218125219125220125221125222125223125224125225125226125227125228125229125230125231125232125233125234125235125236125237125238125239125240125241125242125243125244125245125246125247125248125249125250125251125252125253125254125255125256125257125258125259125260125261125262125263125264125265125266125267125268125269125270125271125272125273125274125275125276125277125278125279125280125281125282125283125284125285125286125287125288125289125290125291125292125293125294125295125296125297125298125299125300125301125302125303125304125305125306125307125308125309125310125311125312125313125314125315125316125317125318125319125320125321125322125323125324125325125326125327125328125329125330125331125332125333125334125335125336125337125338125339125340125341125342125343125344125345125346125347125348125349125350125351125352125353125354125355125356125357125358125359125360125361125362125363125364125365125366125367125368125369125370125371125372125373125374125375125376125377125378125379125380125381125382125383125384125385125386125387125388125389125390125391125392125393125394125395125396125397125398125399125400125401125402125403125404125405125406125407125408125409125410125411125412125413125414125415125416125417125418125419125420125421125422125423125424125425125426125427125428125429125430125431125432125433125434125435125436125437125438125439125440125441125442125443125444125445125446125447125448125449125450125451125452125453125454125455125456125457125458125459125460125461125462125463125464125465125466125467125468125469125470125471125472125473125474125475125476125477125478125479125480125481125482125483125484125485125486125487125488125489125490125491125492125493125494125495125496125497125498125499125500125501125502125503125504125505125506125507125508125509125510125511125512125513125514125515125516125517125518125519125520125521125522125523125524125525125526125527125528125529125530125531125532125533125534125535125536125537125538125539125540125541125542125543125544125545125546125547125548125549125550125551125552125553125554125555125556125557125558125559125560125561125562125563125564125565125566125567125568125569125570125571125572125573125574125575125576125577125578125579125580125581125582125583125584125585125586125587125588125589125590125591125592125593125594125595125596125597125598125599125600125601125602125603125604125605125606125607125608125609125610125611125612125613125614125615125616125617125618125619125620125621125622125623125624125625125626125627125628125629125630125631125632125633125634125635125636125637125638125639125640125641125642125643125644125645125646125647125648125649125650125651125652125653125654125655125656125657125658125659125660125661125662125663125664125665125666125667125668125669125670125671125672125673125674125675125676125677125678125679125680125681125682125683125684125685125686125687125688125689125690125691125692125693125694125695125696125697125698125699125700125701125702125703125704125705125706125707125708125709125710125711125712125713125714125715125716125717125718125719125720125721125722125723125724125725125726125727125728125729125730125731125732125733125734125735125736125737125738125739125740125741125742125743125744125745125746125747125748125749125750125751125752125753125754125755125756125757125758125759125760125761125762125763125764125765125766125767125768125769125770125771125772125773125774125775125776125777125778125779125780125781125782125783125784125785125786125787125788125789125790125791125792125793125794125795125796125797125798125799125800125801125802125803125804125805125806125807125808125809125810125811125812125813125814125815125816125817125818125819125820125821125822125823125824125825125826125827125828125829125830125831125832125833125834125835125836125837125838125839125840125841125842125843125844125845125846125847125848125849125850125851125852125853125854125855125856125857125858125859125860125861125862125863125864125865125866125867125868125869125870125871125872125873125874125875125876125877125878125879125880125881125882125883125884125885125886125887125888125889125890125891125892125893125894125895125896125897125898125899125900125901125902125903125904125905125906125907125908125909125910125911125912125913125914125915125916125917125918125919125920125921125922125923125924125925125926125927125928125929125930125931125932125933125934125935125936125937125938125939125940125941125942125943125944125945125946125947125948125949125950125951125952125953125954125955125956125957125958125959125960125961125962125963125964125965125966125967125968125969125970125971125972125973125974125975125976125977125978125979125980125981125982125983125984125985125986125987125988125989125990125991125992125993125994125995125996125997125998125999126000126001126002126003126004126005126006126007126008126009126010126011126012126013126014126015126016126017126018126019126020126021126022126023126024126025126026126027126028126029126030126031126032126033126034126035126036126037126038126039126040126041126042126043126044126045126046126047126048126049126050126051126052126053126054126055126056126057126058126059126060126061126062126063126064126065126066126067126068126069126070126071126072126073126074126075126076126077126078126079126080126081126082126083126084126085126086126087126088126089126090126091126092126093126094126095126096126097126098126099126100126101126102126103126104126105126106126107126108126109126110126111126112126113126114126115126116126117126118126119126120126121126122126123126124126125126126126127126128126129126130126131126132126133126134126135126136126137126138126139126140126141126142126143126144126145126146126147126148126149126150126151126152126153126154126155126156126157126158126159126160126161126162126163126164126165126166126167126168126169126170126171126172126173126174126175126176126177126178126179126180126181126182126183126184126185126186126187126188126189126190126191126192126193126194126195126196126197126198126199126200126201126202126203126204126205126206126207126208126209126210126211126212126213126214126215126216126217126218126219126220126221126222126223126224126225126226126227126228126229126230126231126232126233126234126235126236126237126238126239126240126241126242126243126244126245126246126247126248126249126250126251126252126253126254126255126256126257126258126259126260126261126262126263126264126265126266126267126268126269126270126271126272126273126274126275126276126277126278126279126280126281126282126283126284126285126286126287126288126289126290126291126292126293126294126295126296126297126298126299126300126301126302126303126304126305126306126307126308126309126310126311126312126313126314126315126316126317126318126319126320126321126322126323126324126325126326126327126328126329126330126331126332126333126334126335126336126337126338126339126340126341126342126343126344126345126346126347126348126349126350126351126352126353126354126355126356126357126358126359126360126361126362126363126364126365126366126367126368126369126370126371126372126373126374126375126376126377126378126379126380126381126382126383126384126385126386126387126388126389126390126391126392126393126394126395126396126397126398126399126400126401126402126403126404126405126406126407126408126409126410126411126412126413126414126415126416126417126418126419126420126421126422126423126424126425126426126427126428126429126430126431126432126433126434126435126436126437126438126439126440126441126442126443126444126445126446126447126448126449126450126451126452126453126454126455126456126457126458126459126460126461126462126463126464126465126466126467126468126469126470126471126472126473126474126475126476126477126478126479126480126481126482126483126484126485126486126487126488126489126490126491126492126493126494126495126496126497126498126499126500126501126502126503126504126505126506126507126508126509126510126511126512126513126514126515126516126517126518126519126520126521126522126523126524126525126526126527126528126529126530126531126532126533126534126535126536126537126538126539126540126541126542126543126544126545126546126547126548126549126550126551126552126553126554126555126556126557126558126559126560126561126562126563126564126565126566126567126568126569126570126571126572126573126574126575126576126577126578126579126580126581126582126583126584126585126586126587126588126589126590126591126592126593126594126595126596126597126598126599126600126601126602126603126604126605126606126607126608126609126610126611126612126613126614126615126616126617126618126619126620126621126622126623126624126625126626126627126628126629126630126631126632126633126634126635126636126637126638126639126640126641126642126643126644126645126646126647126648126649126650126651126652126653126654126655126656126657126658126659126660126661126662126663126664126665126666126667126668126669126670126671126672126673126674126675126676126677126678126679126680126681126682126683126684126685126686126687126688126689126690126691126692126693126694126695126696126697126698126699126700126701126702126703126704126705126706126707126708126709126710126711126712126713126714126715126716126717126718126719126720126721126722126723126724126725126726126727126728126729126730126731126732126733126734126735126736126737126738126739126740126741126742126743126744126745126746126747126748126749126750126751126752126753126754126755126756126757126758126759126760126761126762126763126764126765126766126767126768126769126770126771126772126773126774126775126776126777126778126779126780126781126782126783126784126785126786126787126788126789126790126791126792126793126794126795126796126797126798126799126800126801126802126803126804126805126806126807126808126809126810126811126812126813126814126815126816126817126818126819126820126821126822126823126824126825126826126827126828126829126830126831126832126833126834126835126836126837126838126839126840126841126842126843126844126845126846126847126848126849126850126851126852126853126854126855126856126857126858126859126860126861126862126863126864126865126866126867126868126869126870126871126872126873126874126875126876126877126878126879126880126881126882126883126884126885126886126887126888126889126890126891126892126893126894126895126896126897126898126899126900126901126902126903126904126905126906126907126908126909126910126911126912126913126914126915126916126917126918126919126920126921126922126923126924126925126926126927126928126929126930126931126932126933126934126935126936126937126938126939126940126941126942126943126944126945126946126947126948126949126950126951126952126953126954126955126956126957126958126959126960126961126962126963126964126965126966126967126968126969126970126971126972126973126974126975126976126977126978126979126980126981126982126983126984126985126986126987126988126989126990126991126992126993126994126995126996126997126998126999127000127001127002127003127004127005127006127007127008127009127010127011127012127013127014127015127016127017127018127019127020127021127022127023127024127025127026127027127028127029127030127031127032127033127034127035127036127037127038127039127040127041127042127043127044127045127046127047127048127049127050127051127052127053127054127055127056127057127058127059127060127061127062127063127064127065127066127067127068127069127070127071127072127073127074127075127076127077127078127079127080127081127082127083127084127085127086127087127088127089127090127091127092127093127094127095127096127097127098127099127100127101127102127103127104127105127106127107127108127109127110127111127112127113127114127115127116127117127118127119127120127121127122127123127124127125127126127127127128127129127130127131127132127133127134127135127136127137127138127139127140127141127142127143127144127145127146127147127148127149127150127151127152127153127154127155127156127157127158127159127160127161127162127163127164127165127166127167127168127169127170127171127172127173127174127175127176127177127178127179127180127181127182127183127184127185127186127187127188127189127190127191127192127193127194127195127196127197127198127199127200127201127202127203127204127205127206127207127208127209127210127211127212127213127214127215127216127217127218127219127220127221127222127223127224127225127226127227127228127229127230127231127232127233127234127235127236127237127238127239127240127241127242127243127244127245127246127247127248127249127250127251127252127253127254127255127256127257127258127259127260127261127262127263127264127265127266127267127268127269127270127271127272127273127274127275127276127277127278127279127280127281127282127283127284127285127286127287127288127289127290127291127292127293127294127295127296127297127298127299127300127301127302127303127304127305127306127307127308127309127310127311127312127313127314127315127316127317127318127319127320127321127322127323127324127325127326127327127328127329127330127331127332127333127334127335127336127337127338127339127340127341127342127343127344127345127346127347127348127349127350127351127352127353127354127355127356127357127358127359127360127361127362127363127364127365127366127367127368127369127370127371127372127373127374127375127376127377127378127379127380127381127382127383127384127385127386127387127388127389127390127391127392127393127394127395127396127397127398127399127400127401127402127403127404127405127406127407127408127409127410127411127412127413127414127415127416127417127418127419127420127421127422127423127424127425127426127427127428127429127430127431127432127433127434127435127436127437127438127439127440127441127442127443127444127445127446127447127448127449127450127451127452127453127454127455127456127457127458127459127460127461127462127463127464127465127466127467127468127469127470127471127472127473127474127475127476127477127478127479127480127481127482127483127484127485127486127487127488127489127490127491127492127493127494127495127496127497127498127499127500127501127502127503127504127505127506127507127508127509127510127511127512127513127514127515127516127517127518127519127520127521127522127523127524127525127526127527127528127529127530127531127532127533127534127535127536127537127538127539127540127541127542127543127544127545127546127547127548127549127550127551127552127553127554127555127556127557127558127559127560127561127562127563127564127565127566127567127568127569127570127571127572127573127574127575127576127577127578127579127580127581127582127583127584127585127586127587127588127589127590127591127592127593127594127595127596127597127598127599127600127601127602127603127604127605127606127607127608127609127610127611127612127613127614127615127616127617127618127619127620127621127622127623127624127625127626127627127628127629127630127631127632127633127634127635127636127637127638127639127640127641127642127643127644127645127646127647127648127649127650127651127652127653127654127655127656127657127658127659127660127661127662127663127664127665127666127667127668127669127670127671127672127673127674127675127676127677127678127679127680127681127682127683127684127685127686127687127688127689127690127691127692127693127694127695127696127697127698127699127700127701127702127703127704127705127706127707127708127709127710127711127712127713127714127715127716127717127718127719127720127721127722127723127724127725127726127727127728127729127730127731127732127733127734127735127736127737127738127739127740127741127742127743127744127745127746127747127748127749127750127751127752127753127754127755127756127757127758127759127760127761127762127763127764127765127766127767127768127769127770127771127772127773127774127775127776127777127778127779127780127781127782127783127784127785127786127787127788127789127790127791127792127793127794127795127796127797127798127799127800127801127802127803127804127805127806127807127808127809127810127811127812127813127814127815127816127817127818127819127820127821127822127823127824127825127826127827127828127829127830127831127832127833127834127835127836127837127838127839127840127841127842127843127844127845127846127847127848127849127850127851127852127853127854127855127856127857127858127859127860127861127862127863127864127865127866127867127868127869127870127871127872127873127874127875127876127877127878127879127880127881127882127883127884127885127886127887127888127889127890127891127892127893127894127895127896127897127898127899127900127901127902127903127904127905127906127907127908127909127910127911127912127913127914127915127916127917127918127919127920127921127922127923127924127925127926127927127928127929127930127931127932127933127934127935127936127937127938127939127940127941127942127943127944127945127946127947127948127949127950127951127952127953127954127955127956127957127958127959127960127961127962127963127964127965127966127967127968127969127970127971127972127973127974127975127976127977127978127979127980127981127982127983127984127985127986127987127988127989127990127991127992127993127994127995127996127997127998127999128000128001128002128003128004128005128006128007128008128009128010128011128012128013128014128015128016128017128018128019128020128021128022128023128024128025128026128027128028128029128030128031128032128033128034128035128036128037128038128039128040128041128042128043128044128045128046128047128048128049128050128051128052128053128054128055128056128057128058128059128060128061128062128063128064128065128066128067128068128069128070128071128072128073128074128075128076128077128078128079128080128081128082128083128084128085128086128087128088128089128090128091128092128093128094128095128096128097128098128099128100128101128102128103128104128105128106128107128108128109128110128111128112128113128114128115128116128117128118128119128120128121128122128123128124128125128126128127128128128129128130128131128132128133128134128135128136128137128138128139128140128141128142128143128144128145128146128147128148128149128150128151128152128153128154128155128156128157128158128159128160128161128162128163128164128165128166128167128168128169128170128171128172128173128174128175128176128177128178128179128180128181128182128183128184128185128186128187128188128189128190128191128192128193128194128195128196128197128198128199128200128201128202128203128204128205128206128207128208128209128210128211128212128213128214128215128216128217128218128219128220128221128222128223128224128225128226128227128228128229128230128231128232128233128234128235128236128237128238128239128240128241128242128243128244128245128246128247128248128249128250128251128252128253128254128255128256128257128258128259128260128261128262128263128264128265128266128267128268128269128270128271128272128273128274128275128276128277128278128279128280128281128282128283128284128285128286128287128288128289128290128291128292128293128294128295128296128297128298128299128300128301128302128303128304128305128306128307128308128309128310128311128312128313128314128315128316128317128318128319128320128321128322128323128324128325128326128327128328128329128330128331128332128333128334128335128336128337128338128339128340128341128342128343128344128345128346128347128348128349128350128351128352128353128354128355128356128357128358128359128360128361128362128363128364128365128366128367128368128369128370128371128372128373128374128375128376128377128378128379128380128381128382128383128384128385128386128387128388128389128390128391128392128393128394128395128396128397128398128399128400128401128402128403128404128405128406128407128408128409128410128411128412128413128414128415128416128417128418128419128420128421128422128423128424128425128426128427128428128429128430128431128432128433128434128435128436128437128438128439128440128441128442128443128444128445128446128447128448128449128450128451128452128453128454128455128456128457128458128459128460128461128462128463128464128465128466128467128468128469128470128471128472128473128474128475128476128477128478128479128480128481128482128483128484128485128486128487128488128489128490128491128492128493128494128495128496128497128498128499128500128501128502128503128504128505128506128507128508128509128510128511128512128513128514128515128516128517128518128519128520128521128522128523128524128525128526128527128528128529128530128531128532128533128534128535128536128537128538128539128540128541128542128543128544128545128546128547128548128549128550128551128552128553128554128555128556128557128558128559128560128561128562128563128564128565128566128567128568128569128570128571128572128573128574128575128576128577128578128579128580128581128582128583128584128585128586128587128588128589128590128591128592128593128594128595128596128597128598128599128600128601128602128603128604128605128606128607128608128609128610128611128612128613128614128615128616128617128618128619128620128621128622128623128624128625128626128627128628128629128630128631128632128633128634128635128636128637128638128639128640128641128642128643128644128645128646128647128648128649128650128651128652128653128654128655128656128657128658128659128660128661128662128663128664128665128666128667128668128669128670128671128672128673128674128675128676128677128678128679128680128681128682128683128684128685128686128687128688128689128690128691128692128693128694128695128696128697128698128699128700128701128702128703128704128705128706128707128708128709128710128711128712128713128714128715128716128717128718128719128720128721128722128723128724128725128726128727128728128729128730128731128732128733128734128735128736128737128738128739128740128741128742128743128744128745128746128747128748128749128750128751128752128753128754128755128756128757128758128759128760128761128762128763128764128765128766128767128768128769128770128771128772128773128774128775128776128777128778128779128780128781128782128783128784128785128786128787128788128789128790128791128792128793128794128795128796128797128798128799128800128801128802128803128804128805128806128807128808128809128810128811128812128813128814128815128816128817128818128819128820128821128822128823128824128825128826128827128828128829128830128831128832128833128834128835128836128837128838128839128840128841128842128843128844128845128846128847128848128849128850128851128852128853128854128855128856128857128858128859128860128861128862128863128864128865128866128867128868128869128870128871128872128873128874128875128876128877128878128879128880128881128882128883128884128885128886128887128888128889128890128891128892128893128894128895128896128897128898128899128900128901128902128903128904128905128906128907128908128909128910128911128912128913128914128915128916128917128918128919128920128921128922128923128924128925128926128927128928128929128930128931128932128933128934128935128936128937128938128939128940128941128942128943128944128945128946128947128948128949128950128951128952128953128954128955128956128957128958128959128960128961128962128963128964128965128966128967128968128969128970128971128972128973128974128975128976128977128978128979128980128981128982128983128984128985128986128987128988128989128990128991128992128993128994128995128996128997128998128999129000129001129002129003129004129005129006129007129008129009129010129011129012129013129014129015129016129017129018129019129020129021129022129023129024129025129026129027129028129029129030129031129032129033129034129035129036129037129038129039129040129041129042129043129044129045129046129047129048129049129050129051129052129053129054129055129056129057129058129059129060129061129062129063129064129065129066129067129068129069129070129071129072129073129074129075129076129077129078129079129080129081129082129083129084129085129086129087129088129089129090129091129092129093129094129095129096129097129098129099129100129101129102129103129104129105129106129107129108129109129110129111129112129113129114129115129116129117129118129119129120129121129122129123129124129125129126129127129128129129129130129131129132129133129134129135129136129137129138129139129140129141129142129143129144129145129146129147129148129149129150129151129152129153129154129155129156129157129158129159129160129161129162129163129164129165129166129167129168129169129170129171129172129173129174129175129176129177129178129179129180129181129182129183129184129185129186129187129188129189129190129191129192129193129194129195129196129197129198129199129200129201129202129203129204129205129206129207129208129209129210129211129212129213129214129215129216129217129218129219129220129221129222129223129224129225129226129227129228129229129230129231129232129233129234129235129236129237129238129239129240129241129242129243129244129245129246129247129248129249129250129251129252129253129254129255129256129257129258129259129260129261129262129263129264129265129266129267129268129269129270129271129272129273129274129275129276129277129278129279129280129281129282129283129284129285129286129287129288129289129290129291129292129293129294129295129296129297129298129299129300129301129302129303129304129305129306129307129308129309129310129311129312129313129314129315129316129317129318129319129320129321129322129323129324129325129326129327129328129329129330129331129332129333129334129335129336129337129338129339129340129341129342129343129344129345129346129347129348129349129350129351129352129353129354129355129356129357129358129359129360129361129362129363129364129365129366129367129368129369129370129371129372129373129374129375129376129377129378129379129380129381129382129383129384129385129386129387129388129389129390129391129392129393129394129395129396129397129398129399129400129401129402129403129404129405129406129407129408129409129410129411129412129413129414129415129416129417129418129419129420129421129422129423129424129425129426129427129428129429129430129431129432129433129434129435129436129437129438129439129440129441129442129443129444129445129446129447129448129449129450129451129452129453129454129455129456129457129458129459129460129461129462129463129464129465129466129467129468129469129470129471129472129473129474129475129476129477129478129479129480129481129482129483129484129485129486129487129488129489129490129491129492129493129494129495129496129497129498129499129500129501129502129503129504129505129506129507129508129509129510129511129512129513129514129515129516129517129518129519129520129521129522129523129524129525129526129527129528129529129530129531129532129533129534129535129536129537129538129539129540129541129542129543129544129545129546129547129548129549129550129551129552129553129554129555129556129557129558129559129560129561129562129563129564129565129566129567129568129569129570129571129572129573129574129575129576129577129578129579129580129581129582129583129584129585129586129587129588129589129590129591129592129593129594129595129596129597129598129599129600129601129602129603129604129605129606129607129608129609129610129611129612129613129614129615129616129617129618129619129620129621129622129623129624129625129626129627129628129629129630129631129632129633129634129635129636129637129638129639129640129641129642129643129644129645129646129647129648129649129650129651129652129653129654129655129656129657129658129659129660129661129662129663129664129665129666129667129668129669129670129671129672129673129674129675129676129677129678129679129680129681129682129683129684129685129686129687129688129689129690129691129692129693129694129695129696129697129698129699129700129701129702129703129704129705129706129707129708129709129710129711129712129713129714129715129716129717129718129719129720129721129722129723129724129725129726129727129728129729129730129731129732129733129734129735129736129737129738129739129740129741129742129743129744129745129746129747129748129749129750129751129752129753129754129755129756129757129758129759129760129761129762129763129764129765129766129767129768129769129770129771129772129773129774129775129776129777129778129779129780129781129782129783129784129785129786129787129788129789129790129791129792129793129794129795129796129797129798129799129800129801129802129803129804129805129806129807129808129809129810129811129812129813129814129815129816129817129818129819129820129821129822129823129824129825129826129827129828129829129830129831129832129833129834129835129836129837129838129839129840129841129842129843129844129845129846129847129848129849129850129851129852129853129854129855129856129857129858129859129860129861129862129863129864129865129866129867129868129869129870129871129872129873129874129875129876129877129878129879129880129881129882129883129884129885129886129887129888129889129890129891129892129893129894129895129896129897129898129899129900129901129902129903129904129905129906129907129908129909129910129911129912129913129914129915129916129917129918129919129920129921129922129923129924129925129926129927129928129929129930129931129932129933129934129935129936129937129938129939129940129941129942129943129944129945129946129947129948129949129950129951129952129953129954129955129956129957129958129959129960129961129962129963129964129965129966129967129968129969129970129971129972129973129974129975129976129977129978129979129980129981129982129983129984129985129986129987129988129989129990129991129992129993129994129995129996129997129998129999130000130001130002130003130004130005130006130007130008130009130010130011130012130013130014130015130016130017130018130019130020130021130022130023130024130025130026130027130028130029130030130031130032130033130034130035130036130037130038130039130040130041130042130043130044130045130046130047130048130049130050130051130052130053130054130055130056130057130058130059130060130061130062130063130064130065130066130067130068130069130070130071130072130073130074130075130076130077130078130079130080130081130082130083130084130085130086130087130088130089130090130091130092130093130094130095130096130097130098130099130100130101130102130103130104130105130106130107130108130109130110130111130112130113130114130115130116130117130118130119130120130121130122130123130124130125130126130127130128130129130130130131130132130133130134130135130136130137130138130139130140130141130142130143130144130145130146130147130148130149130150130151130152130153130154130155130156130157130158130159130160130161130162130163130164130165130166130167130168130169130170130171130172130173130174130175130176130177130178130179130180130181130182130183130184130185130186130187130188130189130190130191130192130193130194130195130196130197130198130199130200130201130202130203130204130205130206130207130208130209130210130211130212130213130214130215130216130217130218130219130220130221130222130223130224130225130226130227130228130229130230130231130232130233130234130235130236130237130238130239130240130241130242130243130244130245130246130247130248130249130250130251130252130253130254130255130256130257130258130259130260130261130262130263130264130265130266130267130268130269130270130271130272130273130274130275130276130277130278130279130280130281130282130283130284130285130286130287130288130289130290130291130292130293130294130295130296130297130298130299130300130301130302130303130304130305130306130307130308130309130310130311130312130313130314130315130316130317130318130319130320130321130322130323130324130325130326130327130328130329130330130331130332130333130334130335130336130337130338130339130340130341130342130343130344130345130346130347130348130349130350130351130352130353130354130355130356130357130358130359130360130361130362130363130364130365130366130367130368130369130370130371130372130373130374130375130376130377130378130379130380130381130382130383130384130385130386130387130388130389130390130391130392130393130394130395130396130397130398130399130400130401130402130403130404130405130406130407130408130409130410130411130412130413130414130415130416130417130418130419130420130421130422130423130424130425130426130427130428130429130430130431130432130433130434130435130436130437130438130439130440130441130442130443130444130445130446130447130448130449130450130451130452130453130454130455130456130457130458130459130460130461130462130463130464130465130466130467130468130469130470130471130472130473130474130475130476130477130478130479130480130481130482130483130484130485130486130487130488130489130490130491130492130493130494130495130496130497130498130499130500130501130502130503130504130505130506130507130508130509130510130511130512130513130514130515130516130517130518130519130520130521130522130523130524130525130526130527130528130529130530130531130532130533130534130535130536130537130538130539130540130541130542130543130544130545130546130547130548130549130550130551130552130553130554130555130556130557130558130559130560130561130562130563130564130565130566130567130568130569130570130571130572130573130574130575130576130577130578130579130580130581130582130583130584130585130586130587130588130589130590130591130592130593130594130595130596130597130598130599130600130601130602130603130604130605130606130607130608130609130610130611130612130613130614130615130616130617130618130619130620130621130622130623130624130625130626130627130628130629130630130631130632130633130634130635130636130637130638130639130640130641130642130643130644130645130646130647130648130649130650130651130652130653130654130655130656130657130658130659130660130661130662130663130664130665130666130667130668130669130670130671130672130673130674130675130676130677130678130679130680130681130682130683130684130685130686130687130688130689130690130691130692130693130694130695130696130697130698130699130700130701130702130703130704130705130706130707130708130709130710130711130712130713130714130715130716130717130718130719130720130721130722130723130724130725130726130727130728130729130730130731130732130733130734130735130736130737130738130739130740130741130742130743130744130745130746130747130748130749130750130751130752130753130754130755130756130757130758130759130760130761130762130763130764130765130766130767130768130769130770130771130772130773130774130775130776130777130778130779130780130781130782130783130784130785130786130787130788130789130790130791130792130793130794130795130796130797130798130799130800130801130802130803130804130805130806130807130808130809130810130811130812130813130814130815130816130817130818130819130820130821130822130823130824130825130826130827130828130829130830130831130832130833130834130835130836130837130838130839130840130841130842130843130844130845130846130847130848130849130850130851130852130853130854130855130856130857130858130859130860130861130862130863130864130865130866130867130868130869130870130871130872130873130874130875130876130877130878130879130880130881130882130883130884130885130886130887130888130889130890130891130892130893130894130895130896130897130898130899130900130901130902130903130904130905130906130907130908130909130910130911130912130913130914130915130916130917130918130919130920130921130922130923130924130925130926130927130928130929130930130931130932130933130934130935130936130937130938130939130940130941130942130943130944130945130946130947130948130949130950130951130952130953130954130955130956130957130958130959130960130961130962130963130964130965130966130967130968130969130970130971130972130973130974130975130976130977130978130979130980130981130982130983130984130985130986130987130988130989130990130991130992130993130994130995130996130997130998130999131000131001131002131003131004131005131006131007131008131009131010131011131012131013131014131015131016131017131018131019131020131021131022131023131024131025131026131027131028131029131030131031131032131033131034131035131036131037131038131039131040131041131042131043131044131045131046131047131048131049131050131051131052131053131054131055131056131057131058131059131060131061131062131063131064131065131066131067131068131069131070131071131072131073131074131075131076131077131078131079131080131081131082131083131084131085131086131087131088131089131090131091131092131093131094131095131096131097131098131099131100131101131102131103131104131105131106131107131108131109131110131111131112131113131114131115131116131117131118131119131120131121131122131123131124131125131126131127131128131129131130131131131132131133131134131135131136131137131138131139131140131141131142131143131144131145131146131147131148131149131150131151131152131153131154131155131156131157131158131159131160131161131162131163131164131165131166131167131168131169131170131171131172131173131174131175131176131177131178131179131180131181131182131183131184131185131186131187131188131189131190131191131192131193131194131195131196131197131198131199131200131201131202131203131204131205131206131207131208131209131210131211131212131213131214131215131216131217131218131219131220131221131222131223131224131225131226131227131228131229131230131231131232131233131234131235131236131237131238131239131240131241131242131243131244131245131246131247131248131249131250131251131252131253131254131255131256131257131258131259131260131261131262131263131264131265131266131267131268131269131270131271131272131273131274131275131276131277131278131279131280131281131282131283131284131285131286131287131288131289131290131291131292131293131294131295131296131297131298131299131300131301131302131303131304131305131306131307131308131309131310131311131312131313131314131315131316131317131318131319131320131321131322131323131324131325131326131327131328131329131330131331131332131333131334131335131336131337131338131339131340131341131342131343131344131345131346131347131348131349131350131351131352131353131354131355131356131357131358131359131360131361131362131363131364131365131366131367131368131369131370131371131372131373131374131375131376131377131378131379131380131381131382131383131384131385131386131387131388131389131390131391131392131393131394131395131396131397131398131399131400131401131402131403131404131405131406131407131408131409131410131411131412131413131414131415131416131417131418131419131420131421131422131423131424131425131426131427131428131429131430131431131432131433131434131435131436131437131438131439131440131441131442131443131444131445131446131447131448131449131450131451131452131453131454131455131456131457131458131459131460131461131462131463131464131465131466131467131468131469131470131471131472131473131474131475131476131477131478131479131480131481131482131483131484131485131486131487131488131489131490131491131492131493131494131495131496131497131498131499131500131501131502131503131504131505131506131507131508131509131510131511131512131513131514131515131516131517131518131519131520131521131522131523131524131525131526131527131528131529131530131531131532131533131534131535131536131537131538131539131540131541131542131543131544131545131546131547131548131549131550131551131552131553131554131555131556131557131558131559131560131561131562131563131564131565131566131567131568131569131570131571131572131573131574131575131576131577131578131579131580131581131582131583131584131585131586131587131588131589131590131591131592131593131594131595131596131597131598131599131600131601131602131603131604131605131606131607131608131609131610131611131612131613131614131615131616131617131618131619131620131621131622131623131624131625131626131627131628131629131630131631131632131633131634131635131636131637131638131639131640131641131642131643131644131645131646131647131648131649131650131651131652131653131654131655131656131657131658131659131660131661131662131663131664131665131666131667131668131669131670131671131672131673131674131675131676131677131678131679131680131681131682131683131684131685131686131687131688131689131690131691131692131693131694131695131696131697131698131699131700131701131702131703131704131705131706131707131708131709131710131711131712131713131714131715131716131717131718131719131720131721131722131723131724131725131726131727131728131729131730131731131732131733131734131735131736131737131738131739131740131741131742131743131744131745131746131747131748131749131750131751131752131753131754131755131756131757131758131759131760131761131762131763131764131765131766131767131768131769131770131771131772131773131774131775131776131777131778131779131780131781131782131783131784131785131786131787131788131789131790131791131792131793131794131795131796131797131798131799131800131801131802131803131804131805131806131807131808131809131810131811131812131813131814131815131816131817131818131819131820131821131822131823131824131825131826131827131828131829131830131831131832131833131834131835131836131837131838131839131840131841131842131843131844131845131846131847131848131849131850131851131852131853131854131855131856131857131858131859131860131861131862131863131864131865131866131867131868131869131870131871131872131873131874131875131876131877131878131879131880131881131882131883131884131885131886131887131888131889131890131891131892131893131894131895131896131897131898131899131900131901131902131903131904131905131906131907131908131909131910131911131912131913131914131915131916131917131918131919131920131921131922131923131924131925131926131927131928131929131930131931131932131933131934131935131936131937131938131939131940131941131942131943131944131945131946131947131948131949131950131951131952131953131954131955131956131957131958131959131960131961131962131963131964131965131966131967131968131969131970131971131972131973131974131975131976131977131978131979131980131981131982131983131984131985131986131987131988131989131990131991131992131993131994131995131996131997131998131999132000132001132002132003132004132005132006132007132008132009132010132011132012132013132014132015132016132017132018132019132020132021132022132023132024132025132026132027132028132029132030132031132032132033132034132035132036132037132038132039132040132041132042132043132044132045132046132047132048132049132050132051132052132053132054132055132056132057132058132059132060132061132062132063132064132065132066132067132068132069132070132071132072132073132074132075132076132077132078132079132080132081132082132083132084132085132086132087132088132089132090132091132092132093132094132095132096132097132098132099132100132101132102132103132104132105132106132107132108132109132110132111132112132113132114132115132116132117132118132119132120132121132122132123132124132125132126132127132128132129132130132131132132132133132134132135132136132137132138132139132140132141132142132143132144132145132146132147132148132149132150132151132152132153132154132155132156132157132158132159132160132161132162132163132164132165132166132167132168132169132170132171132172132173132174132175132176132177132178132179132180132181132182132183132184132185132186132187132188132189132190132191132192132193132194132195132196132197132198132199132200132201132202132203132204132205132206132207132208132209132210132211132212132213132214132215132216132217132218132219132220132221132222132223132224132225132226132227132228132229132230132231132232132233132234132235132236132237132238132239132240132241132242132243132244132245132246132247132248132249132250132251132252132253132254132255132256132257132258132259132260132261132262132263132264132265132266132267132268132269132270132271132272132273132274132275132276132277132278132279132280132281132282132283132284132285132286132287132288132289132290132291132292132293132294132295132296132297132298132299132300132301132302132303132304132305132306132307132308132309132310132311132312132313132314132315132316132317132318132319132320132321132322132323132324132325132326132327132328132329132330132331132332132333132334132335132336132337132338132339132340132341132342132343132344132345132346132347132348132349132350132351132352132353132354132355132356132357132358132359132360132361132362132363132364132365132366132367132368132369132370132371132372132373132374132375132376132377132378132379132380132381132382132383132384132385132386132387132388132389132390132391132392132393132394132395132396132397132398132399132400132401132402132403132404132405132406132407132408132409132410132411132412132413132414132415132416132417132418132419132420132421132422132423132424132425132426132427132428132429132430132431132432132433132434132435132436132437132438132439132440132441132442132443132444132445132446132447132448132449132450132451132452132453132454132455132456132457132458132459132460132461132462132463132464132465132466132467132468132469132470132471132472132473132474132475132476132477132478132479132480132481132482132483132484132485132486132487132488132489132490132491132492132493132494132495132496132497132498132499132500132501132502132503132504132505132506132507132508132509132510132511132512132513132514132515132516132517132518132519132520132521132522132523132524132525132526132527132528132529132530132531132532132533132534132535132536132537132538132539132540132541132542132543132544132545132546132547132548132549132550132551132552132553132554132555132556132557132558132559132560132561132562132563132564132565132566132567132568132569132570132571132572132573132574132575132576132577132578132579132580132581132582132583132584132585132586132587132588132589132590132591132592132593132594132595132596132597132598132599132600132601132602132603132604132605132606132607132608132609132610132611132612132613132614132615132616132617132618132619132620132621132622132623132624132625132626132627132628132629132630132631132632132633132634132635132636132637132638132639132640132641132642132643132644132645132646132647132648132649132650132651132652132653132654132655132656132657132658132659132660132661132662132663132664132665132666132667132668132669132670132671132672132673132674132675132676132677132678132679132680132681132682132683132684132685132686132687132688132689132690132691132692132693132694132695132696132697132698132699132700132701132702132703132704132705132706132707132708132709132710132711132712132713132714132715132716132717132718132719132720132721132722132723132724132725132726132727132728132729132730132731132732132733132734132735132736132737132738132739132740132741132742132743132744132745132746132747132748132749132750132751132752132753132754132755132756132757132758132759132760132761132762132763132764132765132766132767132768132769132770132771132772132773132774132775132776132777132778132779132780132781132782132783132784132785132786132787132788132789132790132791132792132793132794132795132796132797132798132799132800132801132802132803132804132805132806132807132808132809132810132811132812132813132814132815132816132817132818132819132820132821132822132823132824132825132826132827132828132829132830132831132832132833132834132835132836132837132838132839132840132841132842132843132844132845132846132847132848132849132850132851132852132853132854132855132856132857132858132859132860132861132862132863132864132865132866132867132868132869132870132871132872132873132874132875132876132877132878132879132880132881132882132883132884132885132886132887132888132889132890132891132892132893132894132895132896132897132898132899132900132901132902132903132904132905132906132907132908132909132910132911132912132913132914132915132916132917132918132919132920132921132922132923132924132925132926132927132928132929132930132931132932132933132934132935132936132937132938132939132940132941132942132943132944132945132946132947132948132949132950132951132952132953132954132955132956132957132958132959132960132961132962132963132964132965132966132967132968132969132970132971132972132973132974132975132976132977132978132979132980132981132982132983132984132985132986132987132988132989132990132991132992132993132994132995132996132997132998132999133000133001133002133003133004133005133006133007133008133009133010133011133012133013133014133015133016133017133018133019133020133021133022133023133024133025133026133027133028133029133030133031133032133033133034133035133036133037133038133039133040133041133042133043133044133045133046133047133048133049133050133051133052133053133054133055133056133057133058133059133060133061133062133063133064133065133066133067133068133069133070133071133072133073133074133075133076133077133078133079133080133081133082133083133084133085133086133087133088133089133090133091133092133093133094133095133096133097133098133099133100133101133102133103133104133105133106133107133108133109133110133111133112133113133114133115133116133117133118133119133120133121133122133123133124133125133126133127133128133129133130133131133132133133133134133135133136133137133138133139133140133141133142133143133144133145133146133147133148133149133150133151133152133153133154133155133156133157133158133159133160133161133162133163133164133165133166133167133168133169133170133171133172133173133174133175133176133177133178133179133180133181133182133183133184133185133186133187133188133189133190133191133192133193133194133195133196133197133198133199133200133201133202133203133204133205133206133207133208133209133210133211133212133213133214133215133216133217133218133219133220133221133222133223133224133225133226133227133228133229133230133231133232133233133234133235133236133237133238133239133240133241133242133243133244133245133246133247133248133249133250133251133252133253133254133255133256133257133258133259133260133261133262133263133264133265133266133267133268133269133270133271133272133273133274133275133276133277133278133279133280133281133282133283133284133285133286133287133288133289133290133291133292133293133294133295133296133297133298133299133300133301133302133303133304133305133306133307133308133309133310133311133312133313133314133315133316133317133318133319133320133321133322133323133324133325133326133327133328133329133330133331133332133333133334133335133336133337133338133339133340133341133342133343133344133345133346133347133348133349133350133351133352133353133354133355133356133357133358133359133360133361133362133363133364133365133366133367133368133369133370133371133372133373133374133375133376133377133378133379133380133381133382133383133384133385133386133387133388133389133390133391133392133393133394133395133396133397133398133399133400133401133402133403133404133405133406133407133408133409133410133411133412133413133414133415133416133417133418133419133420133421133422133423133424133425133426133427133428133429133430133431133432133433133434133435133436133437133438133439133440133441133442133443133444133445133446133447133448133449133450133451133452133453133454133455133456133457133458133459133460133461133462133463133464133465133466133467133468133469133470133471133472133473133474133475133476133477133478133479133480133481133482133483133484133485133486133487133488133489133490133491133492133493133494133495133496133497133498133499133500133501133502133503133504133505133506133507133508133509133510133511133512133513133514133515133516133517133518133519133520133521133522133523133524133525133526133527133528133529133530133531133532133533133534133535133536133537133538133539133540133541133542133543133544133545133546133547133548133549133550133551133552133553133554133555133556133557133558133559133560133561133562133563133564133565133566133567133568133569133570133571133572133573133574133575133576133577133578133579133580133581133582133583133584133585133586133587133588133589133590133591133592133593133594133595133596133597133598133599133600133601133602133603133604133605133606133607133608133609133610133611133612133613133614133615133616133617133618133619133620133621133622133623133624133625133626133627133628133629133630133631133632133633133634133635133636133637133638133639133640133641133642133643133644133645133646133647133648133649133650133651133652133653133654133655133656133657133658133659133660133661133662133663133664133665133666133667133668133669133670133671133672133673133674133675133676133677133678133679133680133681133682133683133684133685133686133687133688133689133690133691133692133693133694133695133696133697133698133699133700133701133702133703133704133705133706133707133708133709133710133711133712133713133714133715133716133717133718133719133720133721133722133723133724133725133726133727133728133729133730133731133732133733133734133735133736133737133738133739133740133741133742133743133744133745133746133747133748133749133750133751133752133753133754133755133756133757133758133759133760133761133762133763133764133765133766133767133768133769133770133771133772133773133774133775133776133777133778133779133780133781133782133783133784133785133786133787133788133789133790133791133792133793133794133795133796133797133798133799133800133801133802133803133804133805133806133807133808133809133810133811133812133813133814133815133816133817133818133819133820133821133822133823133824133825133826133827133828133829133830133831133832133833133834133835133836133837133838133839133840133841133842133843133844133845133846133847133848133849133850133851133852133853133854133855133856133857133858133859133860133861133862133863133864133865133866133867133868133869133870133871133872133873133874133875133876133877133878133879133880133881133882133883133884133885133886133887133888133889133890133891133892133893133894133895133896133897133898133899133900133901133902133903133904133905133906133907133908133909133910133911133912133913133914133915133916133917133918133919133920133921133922133923133924133925133926133927133928133929133930133931133932133933133934133935133936133937133938133939133940133941133942133943133944133945133946133947133948133949133950133951133952133953133954133955133956133957133958133959133960133961133962133963133964133965133966133967133968133969133970133971133972133973133974133975133976133977133978133979133980133981133982133983133984133985133986133987133988133989133990133991133992133993133994133995133996133997133998133999134000134001134002134003134004134005134006134007134008134009134010134011134012134013134014134015134016134017134018134019134020134021134022134023134024134025134026134027134028134029134030134031134032134033134034134035134036134037134038134039134040134041134042134043134044134045134046134047134048134049134050134051134052134053134054134055134056134057134058134059134060134061134062134063134064134065134066134067134068134069134070134071134072134073134074134075134076134077134078134079134080134081134082134083134084134085134086134087134088134089134090134091134092134093134094134095134096134097134098134099134100134101134102134103134104134105134106134107134108134109134110134111134112134113134114134115134116134117134118134119134120134121134122134123134124134125134126134127134128134129134130134131134132134133134134134135134136134137134138134139134140134141134142134143134144134145134146134147134148134149134150134151134152134153134154134155134156134157134158134159134160134161134162134163134164134165134166134167134168134169134170134171134172134173134174134175134176134177134178134179134180134181134182134183134184134185134186134187134188134189134190134191134192134193134194134195134196134197134198134199134200134201134202134203134204134205134206134207134208134209134210134211134212134213134214134215134216134217134218134219134220134221134222134223134224134225134226134227134228134229134230134231134232134233134234134235134236134237134238134239134240134241134242134243134244134245134246134247134248134249134250134251134252134253134254134255134256134257134258134259134260134261134262134263134264134265134266134267134268134269134270134271134272134273134274134275134276134277134278134279134280134281134282134283134284134285134286134287134288134289134290134291134292134293134294134295134296134297134298134299134300134301134302134303134304134305134306134307134308134309134310134311134312134313134314134315134316134317134318134319134320134321134322134323134324134325134326134327134328134329134330134331134332134333134334134335134336134337134338134339134340134341134342134343134344134345134346134347134348134349134350134351134352134353134354134355134356134357134358134359134360134361134362134363134364134365134366134367134368134369134370134371134372134373134374134375134376134377134378134379134380134381134382134383134384134385134386134387134388134389134390134391134392134393134394134395134396134397134398134399134400134401134402134403134404134405134406134407134408134409134410134411134412134413134414134415134416134417134418134419134420134421134422134423134424134425134426134427134428134429134430134431134432134433134434134435134436134437134438134439134440134441134442134443134444134445134446134447134448134449134450134451134452134453134454134455134456134457134458134459134460134461134462134463134464134465134466134467134468134469134470134471134472134473134474134475134476134477134478134479134480134481134482134483134484134485134486134487134488134489134490134491134492134493134494134495134496134497134498134499134500134501134502134503134504134505134506134507134508134509134510134511134512134513134514134515134516134517134518134519134520134521134522134523134524134525134526134527134528134529134530134531134532134533134534134535134536134537134538134539134540134541134542134543134544134545134546134547134548134549134550134551134552134553134554134555134556134557134558134559134560134561134562134563134564134565134566134567134568134569134570134571134572134573134574134575134576134577134578134579134580134581134582134583134584134585134586134587134588134589134590134591134592134593134594134595134596134597134598134599134600134601134602134603134604134605134606134607134608134609134610134611134612134613134614134615134616134617134618134619134620134621134622134623134624134625134626134627134628134629134630134631134632134633134634134635134636134637134638134639134640134641134642134643134644134645134646134647134648134649134650134651134652134653134654134655134656134657134658134659134660134661134662134663134664134665134666134667134668134669134670134671134672134673134674134675134676134677134678134679134680134681134682134683134684134685134686134687134688134689134690134691134692134693134694134695134696134697134698134699134700134701134702134703134704134705134706134707134708134709134710134711134712134713134714134715134716134717134718134719134720134721134722134723134724134725134726134727134728134729134730134731134732134733134734134735134736134737134738134739134740134741134742134743134744134745134746134747134748134749134750134751134752134753134754134755134756134757134758134759134760134761134762134763134764134765134766134767134768134769134770134771134772134773134774134775134776134777134778134779134780134781134782134783134784134785134786134787134788134789134790134791134792134793134794134795134796134797134798134799134800134801134802134803134804134805134806134807134808134809134810134811134812134813134814134815134816134817134818134819134820134821134822134823134824134825134826134827134828134829134830134831134832134833134834134835134836134837134838134839134840134841134842134843134844134845134846134847134848134849134850134851134852134853134854134855134856134857134858134859134860134861134862134863134864134865134866134867134868134869134870134871134872134873134874134875134876134877134878134879134880134881134882134883134884134885134886134887134888134889134890134891134892134893134894134895134896134897134898134899134900134901134902134903134904134905134906134907134908134909134910134911134912134913134914134915134916134917134918134919134920134921134922134923134924134925134926134927134928134929134930134931134932134933134934134935134936134937134938134939134940134941134942134943134944134945134946134947134948134949134950134951134952134953134954134955134956134957134958134959134960134961134962134963134964134965134966134967134968134969134970134971134972134973134974134975134976134977134978134979134980134981134982134983134984134985134986134987134988134989134990134991134992134993134994134995134996134997134998134999135000135001135002135003135004135005135006135007135008135009135010135011135012135013135014135015135016135017135018135019135020135021135022135023135024135025135026135027135028135029135030135031135032135033135034135035135036135037135038135039135040135041135042135043135044135045135046135047135048135049135050135051135052135053135054135055135056135057135058135059135060135061135062135063135064135065135066135067135068135069135070135071135072135073135074135075135076135077135078135079135080135081135082135083135084135085135086135087135088135089135090135091135092135093135094135095135096135097135098135099135100135101135102135103135104135105135106135107135108135109135110135111135112135113135114135115135116135117135118135119135120135121135122135123135124135125135126135127135128135129135130135131135132135133135134135135135136135137135138135139135140135141135142135143135144135145135146135147135148135149135150135151135152135153135154135155135156135157135158135159135160135161135162135163135164135165135166135167135168135169135170135171135172135173135174135175135176135177135178135179135180135181135182135183135184135185135186135187135188135189135190135191135192135193135194135195135196135197135198135199135200135201135202135203135204135205135206135207135208135209135210135211135212135213135214135215135216135217135218135219135220135221135222135223135224135225135226135227135228135229135230135231135232135233135234135235135236135237135238135239135240135241135242135243135244135245135246135247135248135249135250135251135252135253135254135255135256135257135258135259135260135261135262135263135264135265135266135267135268135269135270135271135272135273135274135275135276135277135278135279135280135281135282135283135284135285135286135287135288135289135290135291135292135293135294135295135296135297135298135299135300135301135302135303135304135305135306135307135308135309135310135311135312135313135314135315135316135317135318135319135320135321135322135323135324135325135326135327135328135329135330135331135332135333135334135335135336135337135338135339135340135341135342135343135344135345135346135347135348135349135350135351135352135353135354135355135356135357135358135359135360135361135362135363135364135365135366135367135368135369135370135371135372135373135374135375135376135377135378135379135380135381135382135383135384135385135386135387135388135389135390135391135392135393135394135395135396135397135398135399135400135401135402135403135404135405135406135407135408135409135410135411135412135413135414135415135416135417135418135419135420135421135422135423135424135425135426135427135428135429135430135431135432135433135434135435135436135437135438135439135440135441135442135443135444135445135446135447135448135449135450135451135452135453135454135455135456135457135458135459135460135461135462135463135464135465135466135467135468135469135470135471135472135473135474135475135476135477135478135479135480135481135482135483135484135485135486135487135488135489135490135491135492135493135494135495135496135497135498135499135500135501135502135503135504135505135506135507135508135509135510135511135512135513135514135515135516135517135518135519135520135521135522135523135524135525135526135527135528135529135530135531135532135533135534135535135536135537135538135539135540135541135542135543135544135545135546135547135548135549135550135551135552135553135554135555135556135557135558135559135560135561135562135563135564135565135566135567135568135569135570135571135572135573135574135575135576135577135578135579135580135581135582135583135584135585135586135587135588135589135590135591135592135593135594135595135596135597135598135599135600135601135602135603135604135605135606135607135608135609135610135611135612135613135614135615135616135617135618135619135620135621135622135623135624135625135626135627135628135629135630135631135632135633135634135635135636135637135638135639135640135641135642135643135644135645135646135647135648135649135650135651135652135653135654135655135656135657135658135659135660135661135662135663135664135665135666135667135668135669135670135671135672135673135674135675135676135677135678135679135680135681135682135683135684135685135686135687135688135689135690135691135692135693135694135695135696135697135698135699135700135701135702135703135704135705135706135707135708135709135710135711135712135713135714135715135716135717135718135719135720135721135722135723135724135725135726135727135728135729135730135731135732135733135734135735135736135737135738135739135740135741135742135743135744135745135746135747135748135749135750135751135752135753135754135755135756135757135758135759135760135761135762135763135764135765135766135767135768135769135770135771135772135773135774135775135776135777135778135779135780135781135782135783135784135785135786135787135788135789135790135791135792135793135794135795135796135797135798135799135800135801135802135803135804135805135806135807135808135809135810135811135812135813135814135815135816135817135818135819135820135821135822135823135824135825135826135827135828135829135830135831135832135833135834135835135836135837135838135839135840135841135842135843135844135845135846135847135848135849135850135851135852135853135854135855135856135857135858135859135860135861135862135863135864135865135866135867135868135869135870135871135872135873135874135875135876135877135878135879135880135881135882135883135884135885135886135887135888135889135890135891135892135893135894135895135896135897135898135899135900135901135902135903135904135905135906135907135908135909135910135911135912135913135914135915135916135917135918135919135920135921135922135923135924135925135926135927135928135929135930135931135932135933135934135935135936135937135938135939135940135941135942135943135944135945135946135947135948135949135950135951135952135953135954135955135956135957135958135959135960135961135962135963135964135965135966135967135968135969135970135971135972135973135974135975135976135977135978135979135980135981135982135983135984135985135986135987135988135989135990135991135992135993135994135995135996135997135998135999136000136001136002136003136004136005136006136007136008136009136010136011136012136013136014136015136016136017136018136019136020136021136022136023136024136025136026136027136028136029136030136031136032136033136034136035136036136037136038136039136040136041136042136043136044136045136046136047136048136049136050136051136052136053136054136055136056136057136058136059136060136061136062136063136064136065136066136067136068136069136070136071136072136073136074136075136076136077136078136079136080136081136082136083136084136085136086136087136088136089136090136091136092136093136094136095136096136097136098136099136100136101136102136103136104136105136106136107136108136109136110136111136112136113136114136115136116136117136118136119136120136121136122136123136124136125136126136127136128136129136130136131136132136133136134136135136136136137136138136139136140136141136142136143136144136145136146136147136148136149136150136151136152136153136154136155136156136157136158136159136160136161136162136163136164136165136166136167136168136169136170136171136172136173136174136175136176136177136178136179136180136181136182136183136184136185136186136187136188136189136190136191136192136193136194136195136196136197136198136199136200136201136202136203136204136205136206136207136208136209136210136211136212136213136214136215136216136217136218136219136220136221136222136223136224136225136226136227136228136229136230136231136232136233136234136235136236136237136238136239136240136241136242136243136244136245136246136247136248136249136250136251136252136253136254136255136256136257136258136259136260136261136262136263136264136265136266136267136268136269136270136271136272136273136274136275136276136277136278136279136280136281136282136283136284136285136286136287136288136289136290136291136292136293136294136295136296136297136298136299136300136301136302136303136304136305136306136307136308136309136310136311136312136313136314136315136316136317136318136319136320136321136322136323136324136325136326136327136328136329136330136331136332136333136334136335136336136337136338136339136340136341136342136343136344136345136346136347136348136349136350136351136352136353136354136355136356136357136358136359136360136361136362136363136364136365136366136367136368136369136370136371136372136373136374136375136376136377136378136379136380136381136382136383136384136385136386136387136388136389136390136391136392136393136394136395136396136397136398136399136400136401136402136403136404136405136406136407136408136409136410136411136412136413136414136415136416136417136418136419136420136421136422136423136424136425136426136427136428136429136430136431136432136433136434136435136436136437136438136439136440136441136442136443136444136445136446136447136448136449136450136451136452136453136454136455136456136457136458136459136460136461136462136463136464136465136466136467136468136469136470136471136472136473136474136475136476136477136478136479136480136481136482136483136484136485136486136487136488136489136490136491136492136493136494136495136496136497136498136499136500136501136502136503136504136505136506136507136508136509136510136511136512136513136514136515136516136517136518136519136520136521136522136523136524136525136526136527136528136529136530136531136532136533136534136535136536136537136538136539136540136541136542136543136544136545136546136547136548136549136550136551136552136553136554136555136556136557136558136559136560136561136562136563136564136565136566136567136568136569136570136571136572136573136574136575136576136577136578136579136580136581136582136583136584136585136586136587136588136589136590136591136592136593136594136595136596136597136598136599136600136601136602136603136604136605136606136607136608136609136610136611136612136613136614136615136616136617136618136619136620136621136622136623136624136625136626136627136628136629136630136631136632136633136634136635136636136637136638136639136640136641136642136643136644136645136646136647136648136649136650136651136652136653136654136655136656136657136658136659136660136661136662136663136664136665136666136667136668136669136670136671136672136673136674136675136676136677136678136679136680136681136682136683136684136685136686136687136688136689136690136691136692136693136694136695136696136697136698136699136700136701136702136703136704136705136706136707136708136709136710136711136712136713136714136715136716136717136718136719136720136721136722136723136724136725136726136727136728136729136730136731136732136733136734136735136736136737136738136739136740136741136742136743136744136745136746136747136748136749136750136751136752136753136754136755136756136757136758136759136760136761136762136763136764136765136766136767136768136769136770136771136772136773136774136775136776136777136778136779136780136781136782136783136784136785136786136787136788136789136790136791136792136793136794136795136796136797136798136799136800136801136802136803136804136805136806136807136808136809136810136811136812136813136814136815136816136817136818136819136820136821136822136823136824136825136826136827136828136829136830136831136832136833136834136835136836136837136838136839136840136841136842136843136844136845136846136847136848136849136850136851136852136853136854136855136856136857136858136859136860136861136862136863136864136865136866136867136868136869136870136871136872136873136874136875136876136877136878136879136880136881136882136883136884136885136886136887136888136889136890136891136892136893136894136895136896136897136898136899136900136901136902136903136904136905136906136907136908136909136910136911136912136913136914136915136916136917136918136919136920136921136922136923136924136925136926136927136928136929136930136931136932136933136934136935136936136937136938136939136940136941136942136943136944136945136946136947136948136949136950136951136952136953136954136955136956136957136958136959136960136961136962136963136964136965136966136967136968136969136970136971136972136973136974136975136976136977136978136979136980136981136982136983136984136985136986136987136988136989136990136991136992136993136994136995136996136997136998136999137000137001137002137003137004137005137006137007137008137009137010137011137012137013137014137015137016137017137018137019137020137021137022137023137024137025137026137027137028137029137030137031137032137033137034137035137036137037137038137039137040137041137042137043137044137045137046137047137048137049137050137051137052137053137054137055137056137057137058137059137060137061137062137063137064137065137066137067137068137069137070137071137072137073137074137075137076137077137078137079137080137081137082137083137084137085137086137087137088137089137090137091137092137093137094137095137096137097137098137099137100137101137102137103137104137105137106137107137108137109137110137111137112137113137114137115137116137117137118137119137120137121137122137123137124137125137126137127137128137129137130137131137132137133137134137135137136137137137138137139137140137141137142137143137144137145137146137147137148137149137150137151137152137153137154137155137156137157137158137159137160137161137162137163137164137165137166137167137168137169137170137171137172137173137174137175137176137177137178137179137180137181137182137183137184137185137186137187137188137189137190137191137192137193137194137195137196137197137198137199137200137201137202137203137204137205137206137207137208137209137210137211137212137213137214137215137216137217137218137219137220137221137222137223137224137225137226137227137228137229137230137231137232137233137234137235137236137237137238137239137240137241137242137243137244137245137246137247137248137249137250137251137252137253137254137255137256137257137258137259137260137261137262137263137264137265137266137267137268137269137270137271137272137273137274137275137276137277137278137279137280137281137282137283137284137285137286137287137288137289137290137291137292137293137294137295137296137297137298137299137300137301137302137303137304137305137306137307137308137309137310137311137312137313137314137315137316137317137318137319137320137321137322137323137324137325137326137327137328137329137330137331137332137333137334137335137336137337137338137339137340137341137342137343137344137345137346137347137348137349137350137351137352137353137354137355137356137357137358137359137360137361137362137363137364137365137366137367137368137369137370137371137372137373137374137375137376137377137378137379137380137381137382137383137384137385137386137387137388137389137390137391137392137393137394137395137396137397137398137399137400137401137402137403137404137405137406137407137408137409137410137411137412137413137414137415137416137417137418137419137420137421137422137423137424137425137426137427137428137429137430137431137432137433137434137435137436137437137438137439137440137441137442137443137444137445137446137447137448137449137450137451137452137453137454137455137456137457137458137459137460137461137462137463137464137465137466137467137468137469137470137471137472137473137474137475137476137477137478137479137480137481137482137483137484137485137486137487137488137489137490137491137492137493137494137495137496137497137498137499137500137501137502137503137504137505137506137507137508137509137510137511137512137513137514137515137516137517137518137519137520137521137522137523137524137525137526137527137528137529137530137531137532137533137534137535137536137537137538137539137540137541137542137543137544137545137546137547137548137549137550137551137552137553137554137555137556137557137558137559137560137561137562137563137564137565137566137567137568137569137570137571137572137573137574137575137576137577137578137579137580137581137582137583137584137585137586137587137588137589137590137591137592137593137594137595137596137597137598137599137600137601137602137603137604137605137606137607137608137609137610137611137612137613137614137615137616137617137618137619137620137621137622137623137624137625137626137627137628137629137630137631137632137633137634137635137636137637137638137639137640137641137642137643137644137645137646137647137648137649137650137651137652137653137654137655137656137657137658137659137660137661137662137663137664137665137666137667137668137669137670137671137672137673137674137675137676137677137678137679137680137681137682137683137684137685137686137687137688137689137690137691137692137693137694137695137696137697137698137699137700137701137702137703137704137705137706137707137708137709137710137711137712137713137714137715137716137717137718137719137720137721137722137723137724137725137726137727137728137729137730137731137732137733137734137735137736137737137738137739137740137741137742137743137744137745137746137747137748137749137750137751137752137753137754137755137756137757137758137759137760137761137762137763137764137765137766137767137768137769137770137771137772137773137774137775137776137777137778137779137780137781137782137783137784137785137786137787137788137789137790137791137792137793137794137795137796137797137798137799137800137801137802137803137804137805137806137807137808137809137810137811137812137813137814137815137816137817137818137819137820137821137822137823137824137825137826137827137828137829137830137831137832137833137834137835137836137837137838137839137840137841137842137843137844137845137846137847137848137849137850137851137852137853137854137855137856137857137858137859137860137861137862137863137864137865137866137867137868137869137870137871137872137873137874137875137876137877137878137879137880137881137882137883137884137885137886137887137888137889137890137891137892137893137894137895137896137897137898137899137900137901137902137903137904137905137906137907137908137909137910137911137912137913137914137915137916137917137918137919137920137921137922137923137924137925137926137927137928137929137930137931137932137933137934137935137936137937137938137939137940137941137942137943137944137945137946137947137948137949137950137951137952137953137954137955137956137957137958137959137960137961137962137963137964137965137966137967137968137969137970137971137972137973137974137975137976137977137978137979137980137981137982137983137984137985137986137987137988137989137990137991137992137993137994137995137996137997137998137999138000138001138002138003138004138005138006138007138008138009138010138011138012138013138014138015138016138017138018138019138020138021138022138023138024138025138026138027138028138029138030138031138032138033138034138035138036138037138038138039138040138041138042138043138044138045138046138047138048138049138050138051138052138053138054138055138056138057138058138059138060138061138062138063138064138065138066138067138068138069138070138071138072138073138074138075138076138077138078138079138080138081138082138083138084138085138086138087138088138089138090138091138092138093138094138095138096138097138098138099138100138101138102138103138104138105138106138107138108138109138110138111138112138113138114138115138116138117138118138119138120138121138122138123138124138125138126138127138128138129138130138131138132138133138134138135138136138137138138138139138140138141138142138143138144138145138146138147138148138149138150138151138152138153138154138155138156138157138158138159138160138161138162138163138164138165138166138167138168138169138170138171138172138173138174138175138176138177138178138179138180138181138182138183138184138185138186138187138188138189138190138191138192138193138194138195138196138197138198138199138200138201138202138203138204138205138206138207138208138209138210138211138212138213138214138215138216138217138218138219138220138221138222138223138224138225138226138227138228138229138230138231138232138233138234138235138236138237138238138239138240138241138242138243138244138245138246138247138248138249138250138251138252138253138254138255138256138257138258138259138260138261138262138263138264138265138266138267138268138269138270138271138272138273138274138275138276138277138278138279138280138281138282138283138284138285138286138287138288138289138290138291138292138293138294138295138296138297138298138299138300138301138302138303138304138305138306138307138308138309138310138311138312138313138314138315138316138317138318138319138320138321138322138323138324138325138326138327138328138329138330138331138332138333138334138335138336138337138338138339138340138341138342138343138344138345138346138347138348138349138350138351138352138353138354138355138356138357138358138359138360138361138362138363138364138365138366138367138368138369138370138371138372138373138374138375138376138377138378138379138380138381138382138383138384138385138386138387138388138389138390138391138392138393138394138395138396138397138398138399138400138401138402138403138404138405138406138407138408138409138410138411138412138413138414138415138416138417138418138419138420138421138422138423138424138425138426138427138428138429138430138431138432138433138434138435138436138437138438138439138440138441138442138443138444138445138446138447138448138449138450138451138452138453138454138455138456138457138458138459138460138461138462138463138464138465138466138467138468138469138470138471138472138473138474138475138476138477138478138479138480138481138482138483138484138485138486138487138488138489138490138491138492138493138494138495138496138497138498138499138500138501138502138503138504138505138506138507138508138509138510138511138512138513138514138515138516138517138518138519138520138521138522138523138524138525138526138527138528138529138530138531138532138533138534138535138536138537138538138539138540138541138542138543138544138545138546138547138548138549138550138551138552138553138554138555138556138557138558138559138560138561138562138563138564138565138566138567138568138569138570138571138572138573138574138575138576138577138578138579138580138581138582138583138584138585138586138587138588138589138590138591138592138593138594138595138596138597138598138599138600138601138602138603138604138605138606138607138608138609138610138611138612138613138614138615138616138617138618138619138620138621138622138623138624138625138626138627138628138629138630138631138632138633138634138635138636138637138638138639138640138641138642138643138644138645138646138647138648138649138650138651138652138653138654138655138656138657138658138659138660138661138662138663138664138665138666138667138668138669138670138671138672138673138674138675138676138677138678138679138680138681138682138683138684138685138686138687138688138689138690138691138692138693138694138695138696138697138698138699138700138701138702138703138704138705138706138707138708138709138710138711138712138713138714138715138716138717138718138719138720138721138722138723138724138725138726138727138728138729138730138731138732138733138734138735138736138737138738138739138740138741138742138743138744138745138746138747138748138749138750138751138752138753138754138755138756138757138758138759138760138761138762138763138764138765138766138767138768138769138770138771138772138773138774138775138776138777138778138779138780138781138782138783138784138785138786138787138788138789138790138791138792138793138794138795138796138797138798138799138800138801138802138803138804138805138806138807138808138809138810138811138812138813138814138815138816138817138818138819138820138821138822138823138824138825138826138827138828138829138830138831138832138833138834138835138836138837138838138839138840138841138842138843138844138845138846138847138848138849138850138851138852138853138854138855138856138857138858138859138860138861138862138863138864138865138866138867138868138869138870138871138872138873138874138875138876138877138878138879138880138881138882138883138884138885138886138887138888138889138890138891138892138893138894138895138896138897138898138899138900138901138902138903138904138905138906138907138908138909138910138911138912138913138914138915138916138917138918138919138920138921138922138923138924138925138926138927138928138929138930138931138932138933138934138935138936138937138938138939138940138941138942138943138944138945138946138947138948138949138950138951138952138953138954138955138956138957138958138959138960138961138962138963138964138965138966138967138968138969138970138971138972138973138974138975138976138977138978138979138980138981138982138983138984138985138986138987138988138989138990138991138992138993138994138995138996138997138998138999139000139001139002139003139004139005139006139007139008139009139010139011139012139013139014139015139016139017139018139019139020139021139022139023139024139025139026139027139028139029139030139031139032139033139034139035139036139037139038139039139040139041139042139043139044139045139046139047139048139049139050139051139052139053139054139055139056139057139058139059139060139061139062139063139064139065139066139067139068139069139070139071139072139073139074139075139076139077139078139079139080139081139082139083139084139085139086139087139088139089139090139091139092139093139094139095139096139097139098139099139100139101139102139103139104139105139106139107139108139109139110139111139112139113139114139115139116139117139118139119139120139121139122139123139124139125139126139127139128139129139130139131139132139133139134139135139136139137139138139139139140139141139142139143139144139145139146139147139148139149139150139151139152139153139154139155139156139157139158139159139160139161139162139163139164139165139166139167139168139169139170139171139172139173139174139175139176139177139178139179139180139181139182139183139184139185139186139187139188139189139190139191139192139193139194139195139196139197139198139199139200139201139202139203139204139205139206139207139208139209139210139211139212139213139214139215139216139217139218139219139220139221139222139223139224139225139226139227139228139229139230139231139232139233139234139235139236139237139238139239139240139241139242139243139244139245139246139247139248139249139250139251139252139253139254139255139256139257139258139259139260139261139262139263139264139265139266139267139268139269139270139271139272139273139274139275139276139277139278139279139280139281139282139283139284139285139286139287139288139289139290139291139292139293139294139295139296139297139298139299139300139301139302139303139304139305139306139307139308139309139310139311139312139313139314139315139316139317139318139319139320139321139322139323139324139325139326139327139328139329139330139331139332139333139334139335139336139337139338139339139340139341139342139343139344139345139346139347139348139349139350139351139352139353139354139355139356139357139358139359139360139361139362139363139364139365139366139367139368139369139370139371139372139373139374139375139376139377139378139379139380139381139382139383139384139385139386139387139388139389139390139391139392139393139394139395139396139397139398139399139400139401139402139403139404139405139406139407139408139409139410139411139412139413139414139415139416139417139418139419139420139421139422139423139424139425139426139427139428139429139430139431139432139433139434139435139436139437139438139439139440139441139442139443139444139445139446139447139448139449139450139451139452139453139454139455139456139457139458139459139460139461139462139463139464139465139466139467139468139469139470139471139472139473139474139475139476139477139478139479139480139481139482139483139484139485139486139487139488139489139490139491139492139493139494139495139496139497139498139499139500139501139502139503139504139505139506139507139508139509139510139511139512139513139514139515139516139517139518139519139520139521139522139523139524139525139526139527139528139529139530139531139532139533139534139535139536139537139538139539139540139541139542139543139544139545139546139547139548139549139550139551139552139553139554139555139556139557139558139559139560139561139562139563139564139565139566139567139568139569139570139571139572139573139574139575139576139577139578139579139580139581139582139583139584139585139586139587139588139589139590139591139592139593139594139595139596139597139598139599139600139601139602139603139604139605139606139607139608139609139610139611139612139613139614139615139616139617139618139619139620139621139622139623139624139625139626139627139628139629139630139631139632139633139634139635139636139637139638139639139640139641139642139643139644139645139646139647139648139649139650139651139652139653139654139655139656139657139658139659139660139661139662139663139664139665139666139667139668139669139670139671139672139673139674139675139676139677139678139679139680139681139682139683139684139685139686139687139688139689139690139691139692139693139694139695139696139697139698139699139700139701139702139703139704139705139706139707139708139709139710139711139712139713139714139715139716139717139718139719139720139721139722139723139724139725139726139727139728139729139730139731139732139733139734139735139736139737139738139739139740139741139742139743139744139745139746139747139748139749139750139751139752139753139754139755139756139757139758139759139760139761139762139763139764139765139766139767139768139769139770139771139772139773139774139775139776139777139778139779139780139781139782139783139784139785139786139787139788139789139790139791139792139793139794139795139796139797139798139799139800139801139802139803139804139805139806139807139808139809139810139811139812139813139814139815139816139817139818139819139820139821139822139823139824139825139826139827139828139829139830139831139832139833139834139835139836139837139838139839139840139841139842139843139844139845139846139847139848139849139850139851139852139853139854139855139856139857139858139859139860139861139862139863139864139865139866139867139868139869139870139871139872139873139874139875139876139877139878139879139880139881139882139883139884139885139886139887139888139889139890139891139892139893139894139895139896139897139898139899139900139901139902139903139904139905139906139907139908139909139910139911139912139913139914139915139916139917139918139919139920139921139922139923139924139925139926139927139928139929139930139931139932139933139934139935139936139937139938139939139940139941139942139943139944139945139946139947139948139949139950139951139952139953139954139955139956139957139958139959139960139961139962139963139964139965139966139967139968139969139970139971139972139973139974139975139976139977139978139979139980139981139982139983139984139985139986139987139988139989139990139991139992139993139994139995139996139997139998139999140000140001140002140003140004140005140006140007140008140009140010140011140012140013140014140015140016140017140018140019140020140021140022140023140024140025140026140027140028140029140030140031140032140033140034140035140036140037140038140039140040140041140042140043140044140045140046140047140048140049140050140051140052140053140054140055140056140057140058140059140060140061140062140063140064140065140066140067140068140069140070140071140072140073140074140075140076140077140078140079140080140081140082140083140084140085140086140087140088140089140090140091140092140093140094140095140096140097140098140099140100140101140102140103140104140105140106140107140108140109140110140111140112140113140114140115140116140117140118140119140120140121140122140123140124140125140126140127140128140129140130140131140132140133140134140135140136140137140138140139140140140141140142140143140144140145140146140147140148140149140150140151140152140153140154140155140156140157140158140159140160140161140162140163140164140165140166140167140168140169140170140171140172140173140174140175140176140177140178140179140180140181140182140183140184140185140186140187140188140189140190140191140192140193140194140195140196140197140198140199140200140201140202140203140204140205140206140207140208140209140210140211140212140213140214140215140216140217140218140219140220140221140222140223140224140225140226140227140228140229140230140231140232140233140234140235140236140237140238140239140240140241140242140243140244140245140246140247140248140249140250140251140252140253140254140255140256140257140258140259140260140261140262140263140264140265140266140267140268140269140270140271140272140273140274140275140276140277140278140279140280140281140282140283140284140285140286140287140288140289140290140291140292140293140294140295140296140297140298140299140300140301140302140303140304140305140306140307140308140309140310140311140312140313140314140315140316140317140318140319140320140321140322140323140324140325140326140327140328140329140330140331140332140333140334140335140336140337140338140339140340140341140342140343140344140345140346140347140348140349140350140351140352140353140354140355140356140357140358140359140360140361140362140363140364140365140366140367140368140369140370140371140372140373140374140375140376140377140378140379140380140381140382140383140384140385140386140387140388140389140390140391140392140393140394140395140396140397140398140399140400140401140402140403140404140405140406140407140408140409140410140411140412140413140414140415140416140417140418140419140420140421140422140423140424140425140426140427140428140429140430140431140432140433140434140435140436140437140438140439140440140441140442140443140444140445140446140447140448140449140450140451140452140453140454140455140456140457140458140459140460140461140462140463140464140465140466140467140468140469140470140471140472140473140474140475140476140477140478140479140480140481140482140483140484140485140486140487140488140489140490140491140492140493140494140495140496140497140498140499140500140501140502140503140504140505140506140507140508140509140510140511140512140513140514140515140516140517140518140519140520140521140522140523140524140525140526140527140528140529140530140531140532140533140534140535140536140537140538140539140540140541140542140543140544140545140546140547140548140549140550140551140552140553140554140555140556140557140558140559140560140561140562140563140564140565140566140567140568140569140570140571140572140573140574140575140576140577140578140579140580140581140582140583140584140585140586140587140588140589140590140591140592140593140594140595140596140597140598140599140600140601140602140603140604140605140606140607140608140609140610140611140612140613140614140615140616140617140618140619140620140621140622140623140624140625140626140627140628140629140630140631140632140633140634140635140636140637140638140639140640140641140642140643140644140645140646140647140648140649140650140651140652140653140654140655140656140657140658140659140660140661140662140663140664140665140666140667140668140669140670140671140672140673140674140675140676140677140678140679140680140681140682140683140684140685140686140687140688140689140690140691140692140693140694140695140696140697140698140699140700140701140702140703140704140705140706140707140708140709140710140711140712140713140714140715140716140717140718140719140720140721140722140723140724140725140726140727140728140729140730140731140732140733140734140735140736140737140738140739140740140741140742140743140744140745140746140747140748140749140750140751140752140753140754140755140756140757140758140759140760140761140762140763140764140765140766140767140768140769140770140771140772140773140774140775140776140777140778140779140780140781140782140783140784140785140786140787140788140789140790140791140792140793140794140795140796140797140798140799140800140801140802140803140804140805140806140807140808140809140810140811140812140813140814140815140816140817140818140819140820140821140822140823140824140825140826140827140828140829140830140831140832140833140834140835140836140837140838140839140840140841140842140843140844140845140846140847140848140849140850140851140852140853140854140855140856140857140858140859140860140861140862140863140864140865140866140867140868140869140870140871140872140873140874140875140876140877140878140879140880140881140882140883140884140885140886140887140888140889140890140891140892140893140894140895140896140897140898140899140900140901140902140903140904140905140906140907140908140909140910140911140912140913140914140915140916140917140918140919140920140921140922140923140924140925140926140927140928140929140930140931140932140933140934140935140936140937140938140939140940140941140942140943140944140945140946140947140948140949140950140951140952140953140954140955140956140957140958140959140960140961140962140963140964140965140966140967140968140969140970140971140972140973140974140975140976140977140978140979140980140981140982140983140984140985140986140987140988140989140990140991140992140993140994140995140996140997140998140999141000141001141002141003141004141005141006141007141008141009141010141011141012141013141014141015141016141017141018141019141020141021141022141023141024141025141026141027141028141029141030141031141032141033141034141035141036141037141038141039141040141041141042141043141044141045141046141047141048141049141050141051141052141053141054141055141056141057141058141059141060141061141062141063141064141065141066141067141068141069141070141071141072141073141074141075141076141077141078141079141080141081141082141083141084141085141086141087141088141089141090141091141092141093141094141095141096141097141098141099141100141101141102141103141104141105141106141107141108141109141110141111141112141113141114141115141116141117141118141119141120141121141122141123141124141125141126141127141128141129141130141131141132141133141134141135141136141137141138141139141140141141141142141143141144141145141146141147141148141149141150141151141152141153141154141155141156141157141158141159141160141161141162141163141164141165141166141167141168141169141170141171141172141173141174141175141176141177141178141179141180141181141182141183141184141185141186141187141188141189141190141191141192141193141194141195141196141197141198141199141200141201141202141203141204141205141206141207141208141209141210141211141212141213141214141215141216141217141218141219141220141221141222141223141224141225141226141227141228141229141230141231141232141233141234141235141236141237141238141239141240141241141242141243141244141245141246141247141248141249141250141251141252141253141254141255141256141257141258141259141260141261141262141263141264141265141266141267141268141269141270141271141272141273141274141275141276141277141278141279141280141281141282141283141284141285141286141287141288141289141290141291141292141293141294141295141296141297141298141299141300141301141302141303141304141305141306141307141308141309141310141311141312141313141314141315141316141317141318141319141320141321141322141323141324141325141326141327141328141329141330141331141332141333141334141335141336141337141338141339141340141341141342141343141344141345141346141347141348141349141350141351141352141353141354141355141356141357141358141359141360141361141362141363141364141365141366141367141368141369141370141371141372141373141374141375141376141377141378141379141380141381141382141383141384141385141386141387141388141389141390141391141392141393141394141395141396141397141398141399141400141401141402141403141404141405141406141407141408141409141410141411141412141413141414141415141416141417141418141419141420141421141422141423141424141425141426141427141428141429141430141431141432141433141434141435141436141437141438141439141440141441141442141443141444141445141446141447141448141449141450141451141452141453141454141455141456141457141458141459141460141461141462141463141464141465141466141467141468141469141470141471141472141473141474141475141476141477141478141479141480141481141482141483141484141485141486141487141488141489141490141491141492141493141494141495141496141497141498141499141500141501141502141503141504141505141506141507141508141509141510141511141512141513141514141515141516141517141518141519141520141521141522141523141524141525141526141527141528141529141530141531141532141533141534141535141536141537141538141539141540141541141542141543141544141545141546141547141548141549141550141551141552141553141554141555141556141557141558141559141560141561141562141563141564141565141566141567141568141569141570141571141572141573141574141575141576141577141578141579141580141581141582141583141584141585141586141587141588141589141590141591141592141593141594141595141596141597141598141599141600141601141602141603141604141605141606141607141608141609141610141611141612141613141614141615141616141617141618141619141620141621141622141623141624141625141626141627141628141629141630141631141632141633141634141635141636141637141638141639141640141641141642141643141644141645141646141647141648141649141650141651141652141653141654141655141656141657141658141659141660141661141662141663141664141665141666141667141668141669141670141671141672141673141674141675141676141677141678141679141680141681141682141683141684141685141686141687141688141689141690141691141692141693141694141695141696141697141698141699141700141701141702141703141704141705141706141707141708141709141710141711141712141713141714141715141716141717141718141719141720141721141722141723141724141725141726141727141728141729141730141731141732141733141734141735141736141737141738141739141740141741141742141743141744141745141746141747141748141749141750141751141752141753141754141755141756141757141758141759141760141761141762141763141764141765141766141767141768141769141770141771141772141773141774141775141776141777141778141779141780141781141782141783141784141785141786141787141788141789141790141791141792141793141794141795141796141797141798141799141800141801141802141803141804141805141806141807141808141809141810141811141812141813141814141815141816141817141818141819141820141821141822141823141824141825141826141827141828141829141830141831141832141833141834141835141836141837141838141839141840141841141842141843141844141845141846141847141848141849141850141851141852141853141854141855141856141857141858141859141860141861141862141863141864141865141866141867141868141869141870141871141872141873141874141875141876141877141878141879141880141881141882141883141884141885141886141887141888141889141890141891141892141893141894141895141896141897141898141899141900141901141902141903141904141905141906141907141908141909141910141911141912141913141914141915141916141917141918141919141920141921141922141923141924141925141926141927141928141929141930141931141932141933141934141935141936141937141938141939141940141941141942141943141944141945141946141947141948141949141950141951141952141953141954141955141956141957141958141959141960141961141962141963141964141965141966141967141968141969141970141971141972141973141974141975141976141977141978141979141980141981141982141983141984141985141986141987141988141989141990141991141992141993141994141995141996141997141998141999142000142001142002142003142004142005142006142007142008142009142010142011142012142013142014142015142016142017142018142019142020142021142022142023142024142025142026142027142028142029142030142031142032142033142034142035142036142037142038142039142040142041142042142043142044142045142046142047142048142049142050142051142052142053142054142055142056142057142058142059142060142061142062142063142064142065142066142067142068142069142070142071142072142073142074142075142076142077142078142079142080142081142082142083142084142085142086142087142088142089142090142091142092142093142094142095142096142097142098142099142100142101142102142103142104142105142106142107142108142109142110142111142112142113142114142115142116142117142118142119142120142121142122142123142124142125142126142127142128142129142130142131142132142133142134142135142136142137142138142139142140142141142142142143142144142145142146142147142148142149142150142151142152142153142154142155142156142157142158142159142160142161142162142163142164142165142166142167142168142169142170142171142172142173142174142175142176142177142178142179142180142181142182142183142184142185142186142187142188142189142190142191142192142193142194142195142196142197142198142199142200142201142202142203142204142205142206142207142208142209142210142211142212142213142214142215142216142217142218142219142220142221142222142223142224142225142226142227142228142229142230142231142232142233142234142235142236142237142238142239142240142241142242142243142244142245142246142247142248142249142250142251142252142253142254142255142256142257142258142259142260142261142262142263142264142265142266142267142268142269142270142271142272142273142274142275142276142277142278142279142280142281142282142283142284142285142286142287142288142289142290142291142292142293142294142295142296142297142298142299142300142301142302142303142304142305142306142307142308142309142310142311142312142313142314142315142316142317142318142319142320142321142322142323142324142325142326142327142328142329142330142331142332142333142334142335142336142337142338142339142340142341142342142343142344142345142346142347142348142349142350142351142352142353142354142355142356142357142358142359142360142361142362142363142364142365142366142367142368142369142370142371142372142373142374142375142376142377142378142379142380142381142382142383142384142385142386142387142388142389142390142391142392142393142394142395142396142397142398142399142400142401142402142403142404142405142406142407142408142409142410142411142412142413142414142415142416142417142418142419142420142421142422142423142424142425142426142427142428142429142430142431142432142433142434142435142436142437142438142439142440142441142442142443142444142445142446142447142448142449142450142451142452142453142454142455142456142457142458142459142460142461142462142463142464142465142466142467142468142469142470142471142472142473142474142475142476142477142478142479142480142481142482142483142484142485142486142487142488142489142490142491142492142493142494142495142496142497142498142499142500142501142502142503142504142505142506142507142508142509142510142511142512142513142514142515142516142517142518142519142520142521142522142523142524142525142526142527142528142529142530142531142532142533142534142535142536142537142538142539142540142541142542142543142544142545142546142547142548142549142550142551142552142553142554142555142556142557142558142559142560142561142562142563142564142565142566142567142568142569142570142571142572142573142574142575142576142577142578142579142580142581142582142583142584142585142586142587142588142589142590142591142592142593142594142595142596142597142598142599142600142601142602142603142604142605142606142607142608142609142610142611142612142613142614142615142616142617142618142619142620142621142622142623142624142625142626142627142628142629142630142631142632142633142634142635142636142637142638142639142640142641142642142643142644142645142646142647142648142649142650142651142652142653142654142655142656142657142658142659142660142661142662142663142664142665142666142667142668142669142670142671142672142673142674142675142676142677142678142679142680142681142682142683142684142685142686142687142688142689142690142691142692142693142694142695142696142697142698142699142700142701142702142703142704142705142706142707142708142709142710142711142712142713142714142715142716142717142718142719142720142721142722142723142724142725142726142727142728142729142730142731142732142733142734142735142736142737142738142739142740142741142742142743142744142745142746142747142748142749142750142751142752142753142754142755142756142757142758142759142760142761142762142763142764142765142766142767142768142769142770142771142772142773142774142775142776142777142778142779142780142781142782142783142784142785142786142787142788142789142790142791142792142793142794142795142796142797142798142799142800142801142802142803142804142805142806142807142808142809142810142811142812142813142814142815142816142817142818142819142820142821142822142823142824142825142826142827142828142829142830142831142832142833142834142835142836142837142838142839142840142841142842142843142844142845142846142847142848142849142850142851142852142853142854142855142856142857142858142859142860142861142862142863142864142865142866142867142868142869142870142871142872142873142874142875142876142877142878142879142880142881142882142883142884142885142886142887142888142889142890142891142892142893142894142895142896142897142898142899142900142901142902142903142904142905142906142907142908142909142910142911142912142913142914142915142916142917142918142919142920142921142922142923142924142925142926142927142928142929142930142931142932142933142934142935142936142937142938142939142940142941142942142943142944142945142946142947142948142949142950142951142952142953142954142955142956142957142958142959142960142961142962142963142964142965142966142967142968142969142970142971142972142973142974142975142976142977142978142979142980142981142982142983142984142985142986142987142988142989142990142991142992142993142994142995142996142997142998142999143000143001143002143003143004143005143006143007143008143009143010143011143012143013143014143015143016143017143018143019143020143021143022143023143024143025143026143027143028143029143030143031143032143033143034143035143036143037143038143039143040143041143042143043143044143045143046143047143048143049143050143051143052143053143054143055143056143057143058143059143060143061143062143063143064143065143066143067143068143069143070143071143072143073143074143075143076143077143078143079143080143081143082143083143084143085143086143087143088143089143090143091143092143093143094143095143096143097143098143099143100143101143102143103143104143105143106143107143108143109143110143111143112143113143114143115143116143117143118143119143120143121143122143123143124143125143126143127143128143129143130143131143132143133143134143135143136143137143138143139143140143141143142143143143144143145143146143147143148143149143150143151143152143153143154143155143156143157143158143159143160143161143162143163143164143165143166143167143168143169143170143171143172143173143174143175143176143177143178143179143180143181143182143183143184143185143186143187143188143189143190143191143192143193143194143195143196143197143198143199143200143201143202143203143204143205143206143207143208143209143210143211143212143213143214143215143216143217143218143219143220143221143222143223143224143225143226143227143228143229143230143231143232143233143234143235143236143237143238143239143240143241143242143243143244143245143246143247143248143249143250143251143252143253143254143255143256143257143258143259143260143261143262143263143264143265143266143267143268143269143270143271143272143273143274143275143276143277143278143279143280143281143282143283143284143285143286143287143288143289143290143291143292143293143294143295143296143297143298143299143300143301143302143303143304143305143306143307143308143309143310143311143312143313143314143315143316143317143318143319143320143321143322143323143324143325143326143327143328143329143330143331143332143333143334143335143336143337143338143339143340143341143342143343143344143345143346143347143348143349143350143351143352143353143354143355143356143357143358143359143360143361143362143363143364143365143366143367143368143369143370143371143372143373143374143375143376143377143378143379143380143381143382143383143384143385143386143387143388143389143390143391143392143393143394143395143396143397143398143399143400143401143402143403143404143405143406143407143408143409143410143411143412143413143414143415143416143417143418143419143420143421143422143423143424143425143426143427143428143429143430143431143432143433143434143435143436143437143438143439143440143441143442143443143444143445143446143447143448143449143450143451143452143453143454143455143456143457143458143459143460143461143462143463143464143465143466143467143468143469143470143471143472143473143474143475143476143477143478143479143480143481143482143483143484143485143486143487143488143489143490143491143492143493143494143495143496143497143498143499143500143501143502143503143504143505143506143507143508143509143510143511143512143513143514143515143516143517143518143519143520143521143522143523143524143525143526143527143528143529143530143531143532143533143534143535143536143537143538143539143540143541143542143543143544143545143546143547143548143549143550143551143552143553143554143555143556143557143558143559143560143561143562143563143564143565143566143567143568143569143570143571143572143573143574143575143576143577143578143579143580143581143582143583143584143585143586143587143588143589143590143591143592143593143594143595143596143597143598143599143600143601143602143603143604143605143606143607143608143609143610143611143612143613143614143615143616143617143618143619143620143621143622143623143624143625143626143627143628143629143630143631143632143633143634143635143636143637143638143639143640143641143642143643143644143645143646143647143648143649143650143651143652143653143654143655143656143657143658143659143660143661143662143663143664143665143666143667143668143669143670143671143672143673143674143675143676143677143678143679143680143681143682143683143684143685143686143687143688143689143690143691143692143693143694143695143696143697143698143699143700143701143702143703143704143705143706143707143708143709143710143711143712143713143714143715143716143717143718143719143720143721143722143723143724143725143726143727143728143729143730143731143732143733143734143735143736143737143738143739143740143741143742143743143744143745143746143747143748143749143750143751143752143753143754143755143756143757143758143759143760143761143762143763143764143765143766143767143768143769143770143771143772143773143774143775143776143777143778143779143780143781143782143783143784143785143786143787143788143789143790143791143792143793143794143795143796143797143798143799143800143801143802143803143804143805143806143807143808143809143810143811143812143813143814143815143816143817143818143819143820143821143822143823143824143825143826143827143828143829143830143831143832143833143834143835143836143837143838143839143840143841143842143843143844143845143846143847143848143849143850143851143852143853143854143855143856143857143858143859143860143861143862143863143864143865143866143867143868143869143870143871143872143873143874143875143876143877143878143879143880143881143882143883143884143885143886143887143888143889143890143891143892143893143894143895143896143897143898143899143900143901143902143903143904143905143906143907143908143909143910143911143912143913143914143915143916143917143918143919143920143921143922143923143924143925143926143927143928143929143930143931143932143933143934143935143936143937143938143939143940143941143942143943143944143945143946143947143948143949143950143951143952143953143954143955143956143957143958143959143960143961143962143963143964143965143966143967143968143969143970143971143972143973143974143975143976143977143978143979143980143981143982143983143984143985143986143987143988143989143990143991143992143993143994143995143996143997143998143999144000144001144002144003144004144005144006144007144008144009144010144011144012144013144014144015144016144017144018144019144020144021144022144023144024144025144026144027144028144029144030144031144032144033144034144035144036144037144038144039144040144041144042144043144044144045144046144047144048144049144050144051144052144053144054144055144056144057144058144059144060144061144062144063144064144065144066144067144068144069144070144071144072144073144074144075144076144077144078144079144080144081144082144083144084144085144086144087144088144089144090144091144092144093144094144095144096144097144098144099144100144101144102144103144104144105144106144107144108144109144110144111144112144113144114144115144116144117144118144119144120144121144122144123144124144125144126144127144128144129144130144131144132144133144134144135144136144137144138144139144140144141144142144143144144144145144146144147144148144149144150144151144152144153144154144155144156144157144158144159144160144161144162144163144164144165144166144167144168144169144170144171144172144173144174144175144176144177144178144179144180144181144182144183144184144185144186144187144188144189144190144191144192144193144194144195144196144197144198144199144200144201144202144203144204144205144206144207144208144209144210144211144212144213144214144215144216144217144218144219144220144221144222144223144224144225144226144227144228144229144230144231144232144233144234144235144236144237144238144239144240144241144242144243144244144245144246144247144248144249144250144251144252144253144254144255144256144257144258144259144260144261144262144263144264144265144266144267144268144269144270144271144272144273144274144275144276144277144278144279144280144281144282144283144284144285144286144287144288144289144290144291144292144293144294144295144296144297144298144299144300144301144302144303144304144305144306144307144308144309144310144311144312144313144314144315144316144317144318144319144320144321144322144323144324144325144326144327144328144329144330144331144332144333144334144335144336144337144338144339144340144341144342144343144344144345144346144347144348144349144350144351144352144353144354144355144356144357144358144359144360144361144362144363144364144365144366144367144368144369144370144371144372144373144374144375144376144377144378144379144380144381144382144383144384144385144386144387144388144389144390144391144392144393144394144395144396144397144398144399144400144401144402144403144404144405144406144407144408144409144410144411144412144413144414144415144416144417144418144419144420144421144422144423144424144425144426144427144428144429144430144431144432144433144434144435144436144437144438144439144440144441144442144443144444144445144446144447144448144449144450144451144452144453144454144455144456144457144458144459144460144461144462144463144464144465144466144467144468144469144470144471144472144473144474144475144476144477144478144479144480144481144482144483144484144485144486144487144488144489144490144491144492144493144494144495144496144497144498144499144500144501144502144503144504144505144506144507144508144509144510144511144512144513144514144515144516144517144518144519144520144521144522144523144524144525144526144527144528144529144530144531144532144533144534144535144536144537144538144539144540144541144542144543144544144545144546144547144548144549144550144551144552144553144554144555144556144557144558144559144560144561144562144563144564144565144566144567144568144569144570144571144572144573144574144575144576144577144578144579144580144581144582144583144584144585144586144587144588144589144590144591144592144593144594144595144596144597144598144599144600144601144602144603144604144605144606144607144608144609144610144611144612144613144614144615144616144617144618144619144620144621144622144623144624144625144626144627144628144629144630144631144632144633144634144635144636144637144638144639144640144641144642144643144644144645144646144647144648144649144650144651144652144653144654144655144656144657144658144659144660144661144662144663144664144665144666144667144668144669144670144671144672144673144674144675144676144677144678144679144680144681144682144683144684144685144686144687144688144689144690144691144692144693144694144695144696144697144698144699144700144701144702144703144704144705144706144707144708144709144710144711144712144713144714144715144716144717144718144719144720144721144722144723144724144725144726144727144728144729144730144731144732144733144734144735144736144737144738144739144740144741144742144743144744144745144746144747144748144749144750144751144752144753144754144755144756144757144758144759144760144761144762144763144764144765144766144767144768144769144770144771144772144773144774144775144776144777144778144779144780144781144782144783144784144785144786144787144788144789144790144791144792144793144794144795144796144797144798144799144800144801144802144803144804144805144806144807144808144809144810144811144812144813144814144815144816144817144818144819144820144821144822144823144824144825144826144827144828144829144830144831144832144833144834144835144836144837144838144839144840144841144842144843144844144845144846144847144848144849144850144851144852144853144854144855144856144857144858144859144860144861144862144863144864144865144866144867144868144869144870144871144872144873144874144875144876144877144878144879144880144881144882144883144884144885144886144887144888144889144890144891144892144893144894144895144896144897144898144899144900144901144902144903144904144905144906144907144908144909144910144911144912144913144914144915144916144917144918144919144920144921144922144923144924144925144926144927144928144929144930144931144932144933144934144935144936144937144938144939144940144941144942144943144944144945144946144947144948144949144950144951144952144953144954144955144956144957144958144959144960144961144962144963144964144965144966144967144968144969144970144971144972144973144974144975144976144977144978144979144980144981144982144983144984144985144986144987144988144989144990144991144992144993144994144995144996144997144998144999145000145001145002145003145004145005145006145007145008145009145010145011145012145013145014145015145016145017145018145019145020145021145022145023145024145025145026145027145028145029145030145031145032145033145034145035145036145037145038145039145040145041145042145043145044145045145046145047145048145049145050145051145052145053145054145055145056145057145058145059145060145061145062145063145064145065145066145067145068145069145070145071145072145073145074145075145076145077145078145079145080145081145082145083145084145085145086145087145088145089145090145091145092145093145094145095145096145097145098145099145100145101145102145103145104145105145106145107145108145109145110145111145112145113145114145115145116145117145118145119145120145121145122145123145124145125145126145127145128145129145130145131145132145133145134145135145136145137145138145139145140145141145142145143145144145145145146145147145148145149145150145151145152145153145154145155145156145157145158145159145160145161145162145163145164145165145166145167145168145169145170145171145172145173145174145175145176145177145178145179145180145181145182145183145184145185145186145187145188145189145190145191145192145193145194145195145196145197145198145199145200145201145202145203145204145205145206145207145208145209145210145211145212145213145214145215145216145217145218145219145220145221145222145223145224145225145226145227145228145229145230145231145232145233145234145235145236145237145238145239145240145241145242145243145244145245145246145247145248145249145250145251145252145253145254145255145256145257145258145259145260145261145262145263145264145265145266145267145268145269145270145271145272145273145274145275145276145277145278145279145280145281145282145283145284145285145286145287145288145289145290145291145292145293145294145295145296145297145298145299145300145301145302145303145304145305145306145307145308145309145310145311145312145313145314145315145316145317145318145319145320145321145322145323145324145325145326145327145328145329145330145331145332145333145334145335145336145337145338145339145340145341145342145343145344145345145346145347145348145349145350145351145352145353145354145355145356145357145358145359145360145361145362145363145364145365145366145367145368145369145370145371145372145373145374145375145376145377145378145379145380145381145382145383145384145385145386145387145388145389145390145391145392145393145394145395145396145397145398145399145400145401145402145403145404145405145406145407145408145409145410145411145412145413145414145415145416145417145418145419145420145421145422145423145424145425145426145427145428145429145430145431145432145433145434145435145436145437145438145439145440145441145442145443145444145445145446145447145448145449145450145451145452145453145454145455145456145457145458145459145460145461145462145463145464145465145466145467145468145469145470145471145472145473145474145475145476145477145478145479145480145481145482145483145484145485145486145487145488145489145490145491145492145493145494145495145496145497145498145499145500145501145502145503145504145505145506145507145508145509145510145511145512145513145514145515145516145517145518145519145520145521145522145523145524145525145526145527145528145529145530145531145532145533145534145535145536145537145538145539145540145541145542145543145544145545145546145547145548145549145550145551145552145553145554145555145556145557145558145559145560145561145562145563145564145565145566145567145568145569145570145571145572145573145574145575145576145577145578145579145580145581145582145583145584145585145586145587145588145589145590145591145592145593145594145595145596145597145598145599145600145601145602145603145604145605145606145607145608145609145610145611145612145613145614145615145616145617145618145619145620145621145622145623145624145625145626145627145628145629145630145631145632145633145634145635145636145637145638145639145640145641145642145643145644145645145646145647145648145649145650145651145652145653145654145655145656145657145658145659145660145661145662145663145664145665145666145667145668145669145670145671145672145673145674145675145676145677145678145679145680145681145682145683145684145685145686145687145688145689145690145691145692145693145694145695145696145697145698145699145700145701145702145703145704145705145706145707145708145709145710145711145712145713145714145715145716145717145718145719145720145721145722145723145724145725145726145727145728145729145730145731145732145733145734145735145736145737145738145739145740145741145742145743145744145745145746145747145748145749145750145751145752145753145754145755145756145757145758145759145760145761145762145763145764145765145766145767145768145769145770145771145772145773145774145775145776145777145778145779145780145781145782145783145784145785145786145787145788145789145790145791145792145793145794145795145796145797145798145799145800145801145802145803145804145805145806145807145808145809145810145811145812145813145814145815145816145817145818145819145820145821145822145823145824145825145826145827145828145829145830145831145832145833145834145835145836145837145838145839145840145841145842145843145844145845145846145847145848145849145850145851145852145853145854145855145856145857145858145859145860145861145862145863145864145865145866145867145868145869145870145871145872145873145874145875145876145877145878145879145880145881145882145883145884145885145886145887145888145889145890145891145892145893145894145895145896145897145898145899145900145901145902145903145904145905145906145907145908145909145910145911145912145913145914145915145916145917145918145919145920145921145922145923145924145925145926145927145928145929145930145931145932145933145934145935145936145937145938145939145940145941145942145943145944145945145946145947145948145949145950145951145952145953145954145955145956145957145958145959145960145961145962145963145964145965145966145967145968145969145970145971145972145973145974145975145976145977145978145979145980145981145982145983145984145985145986145987145988145989145990145991145992145993145994145995145996145997145998145999146000146001146002146003146004146005146006146007146008146009146010146011146012146013146014146015146016146017146018146019146020146021146022146023146024146025146026146027146028146029146030146031146032146033146034146035146036146037146038146039146040146041146042146043146044146045146046146047146048146049146050146051146052146053146054146055146056146057146058146059146060146061146062146063146064146065146066146067146068146069146070146071146072146073146074146075146076146077146078146079146080146081146082146083146084146085146086146087146088146089146090146091146092146093146094146095146096146097146098146099146100146101146102146103146104146105146106146107146108146109146110146111146112146113146114146115146116146117146118146119146120146121146122146123146124146125146126146127146128146129146130146131146132146133146134146135146136146137146138146139146140146141146142146143146144146145146146146147146148146149146150146151146152146153146154146155146156146157146158146159146160146161146162146163146164146165146166146167146168146169146170146171146172146173146174146175146176146177146178146179146180146181146182146183146184146185146186146187146188146189146190146191146192146193146194146195146196146197146198146199146200146201146202146203146204146205146206146207146208146209146210146211146212146213146214146215146216146217146218146219146220146221146222146223146224146225146226146227146228146229146230146231146232146233146234146235146236146237146238146239146240146241146242146243146244146245146246146247146248146249146250146251146252146253146254146255146256146257146258146259146260146261146262146263146264146265146266146267146268146269146270146271146272146273146274146275146276146277146278146279146280146281146282146283146284146285146286146287146288146289146290146291146292146293146294146295146296146297146298146299146300146301146302146303146304146305146306146307146308146309146310146311146312146313146314146315146316146317146318146319146320146321146322146323146324146325146326146327146328146329146330146331146332146333146334146335146336146337146338146339146340146341146342146343146344146345146346146347146348146349146350146351146352146353146354146355146356146357146358146359146360146361146362146363146364146365146366146367146368146369146370146371146372146373146374146375146376146377146378146379146380146381146382146383146384146385146386146387146388146389146390146391146392146393146394146395146396146397146398146399146400146401146402146403146404146405146406146407146408146409146410146411146412146413146414146415146416146417146418146419146420146421146422146423146424146425146426146427146428146429146430146431146432146433146434146435146436146437146438146439146440146441146442146443146444146445146446146447146448146449146450146451146452146453146454146455146456146457146458146459146460146461146462146463146464146465146466146467146468146469146470146471146472146473146474146475146476146477146478146479146480146481146482146483146484146485146486146487146488146489146490146491146492146493146494146495146496146497146498146499146500146501146502146503146504146505146506146507146508146509146510146511146512146513146514146515146516146517146518146519146520146521146522146523146524146525146526146527146528146529146530146531146532146533146534146535146536146537146538146539146540146541146542146543146544146545146546146547146548146549146550146551146552146553146554146555146556146557146558146559146560146561146562146563146564146565146566146567146568146569146570146571146572146573146574146575146576146577146578146579146580146581146582146583146584146585146586146587146588146589146590146591146592146593146594146595146596146597146598146599146600146601146602146603146604146605146606146607146608146609146610146611146612146613146614146615146616146617146618146619146620146621146622146623146624146625146626146627146628146629146630146631146632146633146634146635146636146637146638146639146640146641146642146643146644146645146646146647146648146649146650146651146652146653146654146655146656146657146658146659146660146661146662146663146664146665146666146667146668146669146670146671146672146673146674146675146676146677146678146679146680146681146682146683146684146685146686146687146688146689146690146691146692146693146694146695146696146697146698146699146700146701146702146703146704146705146706146707146708146709146710146711146712146713146714146715146716146717146718146719146720146721146722146723146724146725146726146727146728146729146730146731146732146733146734146735146736146737146738146739146740146741146742146743146744146745146746146747146748146749146750146751146752146753146754146755146756146757146758146759146760146761146762146763146764146765146766146767146768146769146770146771146772146773146774146775146776146777146778146779146780146781146782146783146784146785146786146787146788146789146790146791146792146793146794146795146796146797146798146799146800146801146802146803146804146805146806146807146808146809146810146811146812146813146814146815146816146817146818146819146820146821146822146823146824146825146826146827146828146829146830146831146832146833146834146835146836146837146838146839146840146841146842146843146844146845146846146847146848146849146850146851146852146853146854146855146856146857146858146859146860146861146862146863146864146865146866146867146868146869146870146871146872146873146874146875146876146877146878146879146880146881146882146883146884146885146886146887146888146889146890146891146892146893146894146895146896146897146898146899146900146901146902146903146904146905146906146907146908146909146910146911146912146913146914146915146916146917146918146919146920146921146922146923146924146925146926146927146928146929146930146931146932146933146934146935146936146937146938146939146940146941146942146943146944146945146946146947146948146949146950146951146952146953146954146955146956146957146958146959146960146961146962146963146964146965146966146967146968146969146970146971146972146973146974146975146976146977146978146979146980146981146982146983146984146985146986146987146988146989146990146991146992146993146994146995146996146997146998146999147000147001147002147003147004147005147006147007147008147009147010147011147012147013147014147015147016147017147018147019147020147021147022147023147024147025147026147027147028147029147030147031147032147033147034147035147036147037147038147039147040147041147042147043147044147045147046147047147048147049147050147051147052147053147054147055147056147057147058147059147060147061147062147063147064147065147066147067147068147069147070147071147072147073147074147075147076147077147078147079147080147081147082147083147084147085147086147087147088147089147090147091147092147093147094147095147096147097147098147099147100147101147102147103147104147105147106147107147108147109147110147111147112147113147114147115147116147117147118147119147120147121147122147123147124147125147126147127147128147129147130147131147132147133147134147135147136147137147138147139147140147141147142147143147144147145147146147147147148147149147150147151147152147153147154147155147156147157147158147159147160147161147162147163147164147165147166147167147168147169147170147171147172147173147174147175147176147177147178147179147180147181147182147183147184147185147186147187147188147189147190147191147192147193147194147195147196147197147198147199147200147201147202147203147204147205147206147207147208147209147210147211147212147213147214147215147216147217147218147219147220147221147222147223147224147225147226147227147228147229147230147231147232147233147234147235147236147237147238147239147240147241147242147243147244147245147246147247147248147249147250147251147252147253147254147255147256147257147258147259147260147261147262147263147264147265147266147267147268147269147270147271147272147273147274147275147276147277147278147279147280147281147282147283147284147285147286147287147288147289147290147291147292147293147294147295147296147297147298147299147300147301147302147303147304147305147306147307147308147309147310147311147312147313147314147315147316147317147318147319147320147321147322147323147324147325147326147327147328147329147330147331147332147333147334147335147336147337147338147339147340147341147342147343147344147345147346147347147348147349147350147351147352147353147354147355147356147357147358147359147360147361147362147363147364147365147366147367147368147369147370147371147372147373147374147375147376147377147378147379147380147381147382147383147384147385147386147387147388147389147390147391147392147393147394147395147396147397147398147399147400147401147402147403147404147405147406147407147408147409147410147411147412147413147414147415147416147417147418147419147420147421147422147423147424147425147426147427147428147429147430147431147432147433147434147435147436147437147438147439147440147441147442147443147444147445147446147447147448147449147450147451147452147453147454147455147456147457147458147459147460147461147462147463147464147465147466147467147468147469147470147471147472147473147474147475147476147477147478147479147480147481147482147483147484147485147486147487147488147489147490147491147492147493147494147495147496147497147498147499147500147501147502147503147504147505147506147507147508147509147510147511147512147513147514147515147516147517147518147519147520147521147522147523147524147525147526147527147528147529147530147531147532147533147534147535147536147537147538147539147540147541147542147543147544147545147546147547147548147549147550147551147552147553147554147555147556147557147558147559147560147561147562147563147564147565147566147567147568147569147570147571147572147573147574147575147576147577147578147579147580147581147582147583147584147585147586147587147588147589147590147591147592147593147594147595147596147597147598147599147600147601147602147603147604147605147606147607147608147609147610147611147612147613147614147615147616147617147618147619147620147621147622147623147624147625147626147627147628147629147630147631147632147633147634147635147636147637147638147639147640147641147642147643147644147645147646147647147648147649147650147651147652147653147654147655147656147657147658147659147660147661147662147663147664147665147666147667147668147669147670147671147672147673147674147675147676147677147678147679147680147681147682147683147684147685147686147687147688147689147690147691147692147693147694147695147696147697147698147699147700147701147702147703147704147705147706147707147708147709147710147711147712147713147714147715147716147717147718147719147720147721147722147723147724147725147726147727147728147729147730147731147732147733147734147735147736147737147738147739147740147741147742147743147744147745147746147747147748147749147750147751147752147753147754147755147756147757147758147759147760147761147762147763147764147765147766147767147768147769147770147771147772147773147774147775147776147777147778147779147780147781147782147783147784147785147786147787147788147789147790147791147792147793147794147795147796147797147798147799147800147801147802147803147804147805147806147807147808147809147810147811147812147813147814147815147816147817147818147819147820147821147822147823147824147825147826147827147828147829147830147831147832147833147834147835147836147837147838147839147840147841147842147843147844147845147846147847147848147849147850147851147852147853147854147855147856147857147858147859147860147861147862147863147864147865147866147867147868147869147870147871147872147873147874147875147876147877147878147879147880147881147882147883147884147885147886147887147888147889147890147891147892147893147894147895147896147897147898147899147900147901147902147903147904147905147906147907147908147909147910147911147912147913147914147915147916147917147918147919147920147921147922147923147924147925147926147927147928147929147930147931147932147933147934147935147936147937147938147939147940147941147942147943147944147945147946147947147948147949147950147951147952147953147954147955147956147957147958147959147960147961147962147963147964147965147966147967147968147969147970147971147972147973147974147975147976147977147978147979147980147981147982147983147984147985147986147987147988147989147990147991147992147993147994147995147996147997147998147999148000148001148002148003148004148005148006148007148008148009148010148011148012148013148014148015148016148017148018148019148020148021148022148023148024148025148026148027148028148029148030148031148032148033148034148035148036148037148038148039148040148041148042148043148044148045148046148047148048148049148050148051148052148053148054148055148056148057148058148059148060148061148062148063148064148065148066148067148068148069148070148071148072148073148074148075148076148077148078148079148080148081148082148083148084148085148086148087148088148089148090148091148092148093148094148095148096148097148098148099148100148101148102148103148104148105148106148107148108148109148110148111148112148113148114148115148116148117148118148119148120148121148122148123148124148125148126148127148128148129148130148131148132148133148134148135148136148137148138148139148140148141148142148143148144148145148146148147148148148149148150148151148152148153148154148155148156148157148158148159148160148161148162148163148164148165148166148167148168148169148170148171148172148173148174148175148176148177148178148179148180148181148182148183148184148185148186148187148188148189148190148191148192148193148194148195148196148197148198148199148200148201148202148203148204148205148206148207148208148209148210148211148212148213148214148215148216148217148218148219148220148221148222148223148224148225148226148227148228148229148230148231148232148233148234148235148236148237148238148239148240148241148242148243148244148245148246148247148248148249148250148251148252148253148254148255148256148257148258148259148260148261148262148263148264148265148266148267148268148269148270148271148272148273148274148275148276148277148278148279148280148281148282148283148284148285148286148287148288148289148290148291148292148293148294148295148296148297148298148299148300148301148302148303148304148305148306148307148308148309148310148311148312148313148314148315148316148317148318148319148320148321148322148323148324148325148326148327148328148329148330148331148332148333148334148335148336148337148338148339148340148341148342148343148344148345148346148347148348148349148350148351148352148353148354148355148356148357148358148359148360148361148362148363148364148365148366148367148368148369148370148371148372148373148374148375148376148377148378148379148380148381148382148383148384148385148386148387148388148389148390148391148392148393148394148395148396148397148398148399148400148401148402148403148404148405148406148407148408148409148410148411148412148413148414148415148416148417148418148419148420148421148422148423148424148425148426148427148428148429148430148431148432148433148434148435148436148437148438148439148440148441148442148443148444148445148446148447148448148449148450148451148452148453148454148455148456148457148458148459148460148461148462148463148464148465148466148467148468148469148470148471148472148473148474148475148476148477148478148479148480148481148482148483148484148485148486148487148488148489148490148491148492148493148494148495148496148497148498148499148500148501148502148503148504148505148506148507148508148509148510148511148512148513148514148515148516148517148518148519148520148521148522148523148524148525148526148527148528148529148530148531148532148533148534148535148536148537148538148539148540148541148542148543148544148545148546148547148548148549148550148551148552148553148554148555148556148557148558148559148560148561148562148563148564148565148566148567148568148569148570148571148572148573148574148575148576148577148578148579148580148581148582148583148584148585148586148587148588148589148590148591148592148593148594148595148596148597148598148599148600148601148602148603148604148605148606148607148608148609148610148611148612148613148614148615148616148617148618148619148620148621148622148623148624148625148626148627148628148629148630148631148632148633148634148635148636148637148638148639148640148641148642148643148644148645148646148647148648148649148650148651148652148653148654148655148656148657148658148659148660148661148662148663148664148665148666148667148668148669148670148671148672148673148674148675148676148677148678148679148680148681148682148683148684148685148686148687148688148689148690148691148692148693148694148695148696148697148698148699148700148701148702148703148704148705148706148707148708148709148710148711148712148713148714148715148716148717148718148719148720148721148722148723148724148725148726148727148728148729148730148731148732148733148734148735148736148737148738148739148740148741148742148743148744148745148746148747148748148749148750148751148752148753148754148755148756148757148758148759148760148761148762148763148764148765148766148767148768148769148770148771148772148773148774148775148776148777148778148779148780148781148782148783148784148785148786148787148788148789148790148791148792148793148794148795148796148797148798148799148800148801148802148803148804148805148806148807148808148809148810148811148812148813148814148815148816148817148818148819148820148821148822148823148824148825148826148827148828148829148830148831148832148833148834148835148836148837148838148839148840148841148842148843148844148845148846148847148848148849148850148851148852148853148854148855148856148857148858148859148860148861148862148863148864148865148866148867148868148869148870148871148872148873148874148875148876148877148878148879148880148881148882148883148884148885148886148887148888148889148890148891148892148893148894148895148896148897148898148899148900148901148902148903148904148905148906148907148908148909148910148911148912148913148914148915148916148917148918148919148920148921148922148923148924148925148926148927148928148929148930148931148932148933148934148935148936148937148938148939148940148941148942148943148944148945148946148947148948148949148950148951148952148953148954148955148956148957148958148959148960148961148962148963148964148965148966148967148968148969148970148971148972148973148974148975148976148977148978148979148980148981148982148983148984148985148986148987148988148989148990148991148992148993148994148995148996148997148998148999149000149001149002149003149004149005149006149007149008149009149010149011149012149013149014149015149016149017149018149019149020149021149022149023149024149025149026149027149028149029149030149031149032149033149034149035149036149037149038149039149040149041149042149043149044149045149046149047149048149049149050149051149052149053149054149055149056149057149058149059149060149061149062149063149064149065149066149067149068149069149070149071149072149073149074149075149076149077149078149079149080149081149082149083149084149085149086149087149088149089149090149091149092149093149094149095149096149097149098149099149100149101149102149103149104149105149106149107149108149109149110149111149112149113149114149115149116149117149118149119149120149121149122149123149124149125149126149127149128149129149130149131149132149133149134149135149136149137149138149139149140149141149142149143149144149145149146149147149148149149149150149151149152149153149154149155149156149157149158149159149160149161149162149163149164149165149166149167149168149169149170149171149172149173149174149175149176149177149178149179149180149181149182149183149184149185149186149187149188149189149190149191149192149193149194149195149196149197149198149199149200149201149202149203149204149205149206149207149208149209149210149211149212149213149214149215149216149217149218149219149220149221149222149223149224149225149226149227149228149229149230149231149232149233149234149235149236149237149238149239149240149241149242149243149244149245149246149247149248149249149250149251149252149253149254149255149256149257149258149259149260149261149262149263149264149265149266149267149268149269149270149271149272149273149274149275149276149277149278149279149280149281149282149283149284149285149286149287149288149289149290149291149292149293149294149295149296149297149298149299149300149301149302149303149304149305149306149307149308149309149310149311149312149313149314149315149316149317149318149319149320149321149322149323149324149325149326149327149328149329149330149331149332149333149334149335149336149337149338149339149340149341149342149343149344149345149346149347149348149349149350149351149352149353149354149355149356149357149358149359149360149361149362149363149364149365149366149367149368149369149370149371149372149373149374149375149376149377149378149379149380149381149382149383149384149385149386149387149388149389149390149391149392149393149394149395149396149397149398149399149400149401149402149403149404149405149406149407149408149409149410149411149412149413149414149415149416149417149418149419149420149421149422149423149424149425149426149427149428149429149430149431149432149433149434149435149436149437149438149439149440149441149442149443149444149445149446149447149448149449149450149451149452149453149454149455149456149457149458149459149460149461149462149463149464149465149466149467149468149469149470149471149472149473149474149475149476149477149478149479149480149481149482149483149484149485149486149487149488149489149490149491149492149493149494149495149496149497149498149499149500149501149502149503149504149505149506149507149508149509149510149511149512149513149514149515149516149517149518149519149520149521149522149523149524149525149526149527149528149529149530149531149532149533149534149535149536149537149538149539149540149541149542149543149544149545149546149547149548149549149550149551149552149553149554149555149556149557149558149559149560149561149562149563149564149565149566149567149568149569149570149571149572149573149574149575149576149577149578149579149580149581149582149583149584149585149586149587149588149589149590149591149592149593149594149595149596149597149598149599149600149601149602149603149604149605149606149607149608149609149610149611149612149613149614149615149616149617149618149619149620149621149622149623149624149625149626149627149628149629149630149631149632149633149634149635149636149637149638149639149640149641149642149643149644149645149646149647149648149649149650149651149652149653149654149655149656149657149658149659149660149661149662149663149664149665149666149667149668149669149670149671149672149673149674149675149676149677149678149679149680149681149682149683149684149685149686149687149688149689149690149691149692149693149694149695149696149697149698149699149700149701149702149703149704149705149706149707149708149709149710149711149712149713149714149715149716149717149718149719149720149721149722149723149724149725149726149727149728149729149730149731149732149733149734149735149736149737149738149739149740149741149742149743149744149745149746149747149748149749149750149751149752149753149754149755149756149757149758149759149760149761149762149763149764149765149766149767149768149769149770149771149772149773149774149775149776149777149778149779149780149781149782149783149784149785149786149787149788149789149790149791149792149793149794149795149796149797149798149799149800149801149802149803149804149805149806149807149808149809149810149811149812149813149814149815149816149817149818149819149820149821149822149823149824149825149826149827149828149829149830149831149832149833149834149835149836149837149838149839149840149841149842149843149844149845149846149847149848149849149850149851149852149853149854149855149856149857149858149859149860149861149862149863149864149865149866149867149868149869149870149871149872149873149874149875149876149877149878149879149880149881149882149883149884149885149886149887149888149889149890149891149892149893149894149895149896149897149898149899149900149901149902149903149904149905149906149907149908149909149910149911149912149913149914149915149916149917149918149919149920149921149922149923149924149925149926149927149928149929149930149931149932149933149934149935149936149937149938149939149940149941149942149943149944149945149946149947149948149949149950149951149952149953149954149955149956149957149958149959149960149961149962149963149964149965149966149967149968149969149970149971149972149973149974149975149976149977149978149979149980149981149982149983149984149985149986149987149988149989149990149991149992149993149994149995149996149997149998149999150000150001150002150003150004150005150006150007150008150009150010150011150012150013150014150015150016150017150018150019150020150021150022150023150024150025150026150027150028150029150030150031150032150033150034150035150036150037150038150039150040150041150042150043150044150045150046150047150048150049150050150051150052150053150054150055150056150057150058150059150060150061150062150063150064150065150066150067150068150069150070150071150072150073150074150075150076150077150078150079150080150081150082150083150084150085150086150087150088150089150090150091150092150093150094150095150096150097150098150099150100150101150102150103150104150105150106150107150108150109150110150111150112150113150114150115150116150117150118150119150120150121150122150123150124150125150126150127150128150129150130150131150132150133150134150135150136150137150138150139150140150141150142150143150144150145150146150147150148150149150150150151150152150153150154150155150156150157150158150159150160150161150162150163150164150165150166150167150168150169150170150171150172150173150174150175150176150177150178150179150180150181150182150183150184150185150186150187150188150189150190150191150192150193150194150195150196150197150198150199150200150201150202150203150204150205150206150207150208150209150210150211150212150213150214150215150216150217150218150219150220150221150222150223150224150225150226150227150228150229150230150231150232150233150234150235150236150237150238150239150240150241150242150243150244150245150246150247150248150249150250150251150252150253150254150255150256150257150258150259150260150261150262150263150264150265150266150267150268150269150270150271150272150273150274150275150276150277150278150279150280150281150282150283150284150285150286150287150288150289150290150291150292150293150294150295150296150297150298150299150300150301150302150303150304150305150306150307150308150309150310150311150312150313150314150315150316150317150318150319150320150321150322150323150324150325150326150327150328150329150330150331150332150333150334150335150336150337150338150339150340150341150342150343150344150345150346150347150348150349150350150351150352150353150354150355150356150357150358150359150360150361150362150363150364150365150366150367150368150369150370150371150372150373150374150375150376150377150378150379150380150381150382150383150384150385150386150387150388150389150390150391150392150393150394150395150396150397150398150399150400150401150402150403150404150405150406150407150408150409150410150411150412150413150414150415150416150417150418150419150420150421150422150423150424150425150426150427150428150429150430150431150432150433150434150435150436150437150438150439150440150441150442150443150444150445150446150447150448150449150450150451150452150453150454150455150456150457150458150459150460150461150462150463150464150465150466150467150468150469150470150471150472150473150474150475150476150477150478150479150480150481150482150483150484150485150486150487150488150489150490150491150492150493150494150495150496150497150498150499150500150501150502150503150504150505150506150507150508150509150510150511150512150513150514150515150516150517150518150519150520150521150522150523150524150525150526150527150528150529150530150531150532150533150534150535150536150537150538150539150540150541150542150543150544150545150546150547150548150549150550150551150552150553150554150555150556150557150558150559150560150561150562150563150564150565150566150567150568150569150570150571150572150573150574150575150576150577150578150579150580150581150582150583150584150585150586150587150588150589150590150591150592150593150594150595150596150597150598150599150600150601150602150603150604150605150606150607150608150609150610150611150612150613150614150615150616150617150618150619150620150621150622150623150624150625150626150627150628150629150630150631150632150633150634150635150636150637150638150639150640150641150642150643150644150645150646150647150648150649150650150651150652150653150654150655150656150657150658150659150660150661150662150663150664150665150666150667150668150669150670150671150672150673150674150675150676150677150678150679150680150681150682150683150684150685150686150687150688150689150690150691150692150693150694150695150696150697150698150699150700150701150702150703150704150705150706150707150708150709150710150711150712150713150714150715150716150717150718150719150720150721150722150723150724150725150726150727150728150729150730150731150732150733150734150735150736150737150738150739150740150741150742150743150744150745150746150747150748150749150750150751150752150753150754150755150756150757150758150759150760150761150762150763150764150765150766150767150768150769150770150771150772150773150774150775150776150777150778150779150780150781150782150783150784150785150786150787150788150789150790150791150792150793150794150795150796150797150798150799150800150801150802150803150804150805150806150807150808150809150810150811150812150813150814150815150816150817150818150819150820150821150822150823150824150825150826150827150828150829150830150831150832150833150834150835150836150837150838150839150840150841150842150843150844150845150846150847150848150849150850150851150852150853150854150855150856150857150858150859150860150861150862150863150864150865150866150867150868150869150870150871150872150873150874150875150876150877150878150879150880150881150882150883150884150885150886150887150888150889150890150891150892150893150894150895150896150897150898150899150900150901150902150903150904150905150906150907150908150909150910150911150912150913150914150915150916150917150918150919150920150921150922150923150924150925150926150927150928150929150930150931150932150933150934150935150936150937150938150939150940150941150942150943150944150945150946150947150948150949150950150951150952150953150954150955150956150957150958150959150960150961150962150963150964150965150966150967150968150969150970150971150972150973150974150975150976150977150978150979150980150981150982150983150984150985150986150987150988150989150990150991150992150993150994150995150996150997150998150999151000151001151002151003151004151005151006151007151008151009151010151011151012151013151014151015151016151017151018151019151020151021151022151023151024151025151026151027151028151029151030151031151032151033151034151035151036151037151038151039151040151041151042151043151044151045151046151047151048151049151050151051151052151053151054151055151056151057151058151059151060151061151062151063151064151065151066151067151068151069151070151071151072151073151074151075151076151077151078151079151080151081151082151083151084151085151086151087151088151089151090151091151092151093151094151095151096151097151098151099151100151101151102151103151104151105151106151107151108151109151110151111151112151113151114151115151116151117151118151119151120151121151122151123151124151125151126151127151128151129151130151131151132151133151134151135151136151137151138151139151140151141151142151143151144151145151146151147151148151149151150151151151152151153151154151155151156151157151158151159151160151161151162151163151164151165151166151167151168151169151170151171151172151173151174151175151176151177151178151179151180151181151182151183151184151185151186151187151188151189151190151191151192151193151194151195151196151197151198151199151200151201151202151203151204151205151206151207151208151209151210151211151212151213151214151215151216151217151218151219151220151221151222151223151224151225151226151227151228151229151230151231151232151233151234151235151236151237151238151239151240151241151242151243151244151245151246151247151248151249151250151251151252151253151254151255151256151257151258151259151260151261151262151263151264151265151266151267151268151269151270151271151272151273151274151275151276151277151278151279151280151281151282151283151284151285151286151287151288151289151290151291151292151293151294151295151296151297151298151299151300151301151302151303151304151305151306151307151308151309151310151311151312151313151314151315151316151317151318151319151320151321151322151323151324151325151326151327151328151329151330151331151332151333151334151335151336151337151338151339151340151341151342151343151344151345151346151347151348151349151350151351151352151353151354151355151356151357151358151359151360151361151362151363151364151365151366151367151368151369151370151371151372151373151374151375151376151377151378151379151380151381151382151383151384151385151386151387151388151389151390151391151392151393151394151395151396151397151398151399151400151401151402151403151404151405151406151407151408151409151410151411151412151413151414151415151416151417151418151419151420151421151422151423151424151425151426151427151428151429151430151431151432151433151434151435151436151437151438151439151440151441151442151443151444151445151446151447151448151449151450151451151452151453151454151455151456151457151458151459151460151461151462151463151464151465151466151467151468151469151470151471151472151473151474151475151476151477151478151479151480151481151482151483151484151485151486151487151488151489151490151491151492151493151494151495151496151497151498151499151500151501151502151503151504151505151506151507151508151509151510151511151512151513151514151515151516151517151518151519151520151521151522151523151524151525151526151527151528151529151530151531151532151533151534151535151536151537151538151539151540151541151542151543151544151545151546151547151548151549151550151551151552151553151554151555151556151557151558151559151560151561151562151563151564151565151566151567151568151569151570151571151572151573151574151575151576151577151578151579151580151581151582151583151584151585151586151587151588151589151590151591151592151593151594151595151596151597151598151599151600151601151602151603151604151605151606151607151608151609151610151611151612151613151614151615151616151617151618151619151620151621151622151623151624151625151626151627151628151629151630151631151632151633151634151635151636151637151638151639151640151641151642151643151644151645151646151647151648151649151650151651151652151653151654151655151656151657151658151659151660151661151662151663151664151665151666151667151668151669151670151671151672151673151674151675151676151677151678151679151680151681151682151683151684151685151686151687151688151689151690151691151692151693151694151695151696151697151698151699151700151701151702151703151704151705151706151707151708151709151710151711151712151713151714151715151716151717151718151719151720151721151722151723151724151725151726151727151728151729151730151731151732151733151734151735151736151737151738151739151740151741151742151743151744151745151746151747151748151749151750151751151752151753151754151755151756151757151758151759151760151761151762151763151764151765151766151767151768151769151770151771151772151773151774151775151776151777151778151779151780151781151782151783151784151785151786151787151788151789151790151791151792151793151794151795151796151797151798151799151800151801151802151803151804151805151806151807151808151809151810151811151812151813151814151815151816151817151818151819151820151821151822151823151824151825151826151827151828151829151830151831151832151833151834151835151836151837151838151839151840151841151842151843151844151845151846151847151848151849151850151851151852151853151854151855151856151857151858151859151860151861151862151863151864151865151866151867151868151869151870151871151872151873151874151875151876151877151878151879151880151881151882151883151884151885151886151887151888151889151890151891151892151893151894151895151896151897151898151899151900151901151902151903151904151905151906151907151908151909151910151911151912151913151914151915151916151917151918151919151920151921151922151923151924151925151926151927151928151929151930151931151932151933151934151935151936151937151938151939151940151941151942151943151944151945151946151947151948151949151950151951151952151953151954151955151956151957151958151959151960151961151962151963151964151965151966151967151968151969151970151971151972151973151974151975151976151977151978151979151980151981151982151983151984151985151986151987151988151989151990151991151992151993151994151995151996151997151998151999152000152001152002152003152004152005152006152007152008152009152010152011152012152013152014152015152016152017152018152019152020152021152022152023152024152025152026152027152028152029152030152031152032152033152034152035152036152037152038152039152040152041152042152043152044152045152046152047152048152049152050152051152052152053152054152055152056152057152058152059152060152061152062152063152064152065152066152067152068152069152070152071152072152073152074152075152076152077152078152079152080152081152082152083152084152085152086152087152088152089152090152091152092152093152094152095152096152097152098152099152100152101152102152103152104152105152106152107152108152109152110152111152112152113152114152115152116152117152118152119152120152121152122152123152124152125152126152127152128152129152130152131152132152133152134152135152136152137152138152139152140152141152142152143152144152145152146152147152148152149152150152151152152152153152154152155152156152157152158152159152160152161152162152163152164152165152166152167152168152169152170152171152172152173152174152175152176152177152178152179152180152181152182152183152184152185152186152187152188152189152190152191152192152193152194152195152196152197152198152199152200152201152202152203152204152205152206152207152208152209152210152211152212152213152214152215152216152217152218152219152220152221152222152223152224152225152226152227152228152229152230152231152232152233152234152235152236152237152238152239152240152241152242152243152244152245152246152247152248152249152250152251152252152253152254152255152256152257152258152259152260152261152262152263152264152265152266152267152268152269152270152271152272152273152274152275152276152277152278152279152280152281152282152283152284152285152286152287152288152289152290152291152292152293152294152295152296152297152298152299152300152301152302152303152304152305152306152307152308152309152310152311152312152313152314152315152316152317152318152319152320152321152322152323152324152325152326152327152328152329152330152331152332152333152334152335152336152337152338152339152340152341152342152343152344152345152346152347152348152349152350152351152352152353152354152355152356152357152358152359152360152361152362152363152364152365152366152367152368152369152370152371152372152373152374152375152376152377152378152379152380152381152382152383152384152385152386152387152388152389152390152391152392152393152394152395152396152397152398152399152400152401152402152403152404152405152406152407152408152409152410152411152412152413152414152415152416152417152418152419152420152421152422152423152424152425152426152427152428152429152430152431152432152433152434152435152436152437152438152439152440152441152442152443152444152445152446152447152448152449152450152451152452152453152454152455152456152457152458152459152460152461152462152463152464152465152466152467152468152469152470152471152472152473152474152475152476152477152478152479152480152481152482152483152484152485152486152487152488152489152490152491152492152493152494152495152496152497152498152499152500152501152502152503152504152505152506152507152508152509152510152511152512152513152514152515152516152517152518152519152520152521152522152523152524152525152526152527152528152529152530152531152532152533152534152535152536152537152538152539152540152541152542152543152544152545152546152547152548152549152550152551152552152553152554152555152556152557152558152559152560152561152562152563152564152565152566152567152568152569152570152571152572152573152574152575152576152577152578152579152580152581152582152583152584152585152586152587152588152589152590152591152592152593152594152595152596152597152598152599152600152601152602152603152604152605152606152607152608152609152610152611152612152613152614152615152616152617152618152619152620152621152622152623152624152625152626152627152628152629152630152631152632152633152634152635152636152637152638152639152640152641152642152643152644152645152646152647152648152649152650152651152652152653152654152655152656152657152658152659152660152661152662152663152664152665152666152667152668152669152670152671152672152673152674152675152676152677152678152679152680152681152682152683152684152685152686152687152688152689152690152691152692152693152694152695152696152697152698152699152700152701152702152703152704152705152706152707152708152709152710152711152712152713152714152715152716152717152718152719152720152721152722152723152724152725152726152727152728152729152730152731152732152733152734152735152736152737152738152739152740152741152742152743152744152745152746152747152748152749152750152751152752152753152754152755152756152757152758152759152760152761152762152763152764152765152766152767152768152769152770152771152772152773152774152775152776152777152778152779152780152781152782152783152784152785152786152787152788152789152790152791152792152793152794152795152796152797152798152799152800152801152802152803152804152805152806152807152808152809152810152811152812152813152814152815152816152817152818152819152820152821152822152823152824152825152826152827152828152829152830152831152832152833152834152835152836152837152838152839152840152841152842152843152844152845152846152847152848152849152850152851152852152853152854152855152856152857152858152859152860152861152862152863152864152865152866152867152868152869152870152871152872152873152874152875152876152877152878152879152880152881152882152883152884152885152886152887152888152889152890152891152892152893152894152895152896152897152898152899152900152901152902152903152904152905152906152907152908152909152910152911152912152913152914152915152916152917152918152919152920152921152922152923152924152925152926152927152928152929152930152931152932152933152934152935152936152937152938152939152940152941152942152943152944152945152946152947152948152949152950152951152952152953152954152955152956152957152958152959152960152961152962152963152964152965152966152967152968152969152970152971152972152973152974152975152976152977152978152979152980152981152982152983152984152985152986152987152988152989152990152991152992152993152994152995152996152997152998152999153000153001153002153003153004153005153006153007153008153009153010153011153012153013153014153015153016153017153018153019153020153021153022153023153024153025153026153027153028153029153030153031153032153033153034153035153036153037153038153039153040153041153042153043153044153045153046153047153048153049153050153051153052153053153054153055153056153057153058153059153060153061153062153063153064153065153066153067153068153069153070153071153072153073153074153075153076153077153078153079153080153081153082153083153084153085153086153087153088153089153090153091153092153093153094153095153096153097153098153099153100153101153102153103153104153105153106153107153108153109153110153111153112153113153114153115153116153117153118153119153120153121153122153123153124153125153126153127153128153129153130153131153132153133153134153135153136153137153138153139153140153141153142153143153144153145153146153147153148153149153150153151153152153153153154153155153156153157153158153159153160153161153162153163153164153165153166153167153168153169153170153171153172153173153174153175153176153177153178153179153180153181153182153183153184153185153186153187153188153189153190153191153192153193153194153195153196153197153198153199153200153201153202153203153204153205153206153207153208153209153210153211153212153213153214153215153216153217153218153219153220153221153222153223153224153225153226153227153228153229153230153231153232153233153234153235153236153237153238153239153240153241153242153243153244153245153246153247153248153249153250153251153252153253153254153255153256153257153258153259153260153261153262153263153264153265153266153267153268153269153270153271153272153273153274153275153276153277153278153279153280153281153282153283153284153285153286153287153288153289153290153291153292153293153294153295153296153297153298153299153300153301153302153303153304153305153306153307153308153309153310153311153312153313153314153315153316153317153318153319153320153321153322153323153324153325153326153327153328153329153330153331153332153333153334153335153336153337153338153339153340153341153342153343153344153345153346153347153348153349153350153351153352153353153354153355153356153357153358153359153360153361153362153363153364153365153366153367153368153369153370153371153372153373153374153375153376153377153378153379153380153381153382153383153384153385153386153387153388153389153390153391153392153393153394153395153396153397153398153399153400153401153402153403153404153405153406153407153408153409153410153411153412153413153414153415153416153417153418153419153420153421153422153423153424153425153426153427153428153429153430153431153432153433153434153435153436153437153438153439153440153441153442153443153444153445153446153447153448153449153450153451153452153453153454153455153456153457153458153459153460153461153462153463153464153465153466153467153468153469153470153471153472153473153474153475153476153477153478153479153480153481153482153483153484153485153486153487153488153489153490153491153492153493153494153495153496153497153498153499153500153501153502153503153504153505153506153507153508153509153510153511153512153513153514153515153516153517153518153519153520153521153522153523153524153525153526153527153528153529153530153531153532153533153534153535153536153537153538153539153540153541153542153543153544153545153546153547153548153549153550153551153552153553153554153555153556153557153558153559153560153561153562153563153564153565153566153567153568153569153570153571153572153573153574153575153576153577153578153579153580153581153582153583153584153585153586153587153588153589153590153591153592153593153594153595153596153597153598153599153600153601153602153603153604153605153606153607153608153609153610153611153612153613153614153615153616153617153618153619153620153621153622153623153624153625153626153627153628153629153630153631153632153633153634153635153636153637153638153639153640153641153642153643153644153645153646153647153648153649153650153651153652153653153654153655153656153657153658153659153660153661153662153663153664153665153666153667153668153669153670153671153672153673153674153675153676153677153678153679153680153681153682153683153684153685153686153687153688153689153690153691153692153693153694153695153696153697153698153699153700153701153702153703153704153705153706153707153708153709153710153711153712153713153714153715153716153717153718153719153720153721153722153723153724153725153726153727153728153729153730153731153732153733153734153735153736153737153738153739153740153741153742153743153744153745153746153747153748153749153750153751153752153753153754153755153756153757153758153759153760153761153762153763153764153765153766153767153768153769153770153771153772153773153774153775153776153777153778153779153780153781153782153783153784153785153786153787153788153789153790153791153792153793153794153795153796153797153798153799153800153801153802153803153804153805153806153807153808153809153810153811153812153813153814153815153816153817153818153819153820153821153822153823153824153825153826153827153828153829153830153831153832153833153834153835153836153837153838153839153840153841153842153843153844153845153846153847153848153849153850153851153852153853153854153855153856153857153858153859153860153861153862153863153864153865153866153867153868153869153870153871153872153873153874153875153876153877153878153879153880153881153882153883153884153885153886153887153888153889153890153891153892153893153894153895153896153897153898153899153900153901153902153903153904153905153906153907153908153909153910153911153912153913153914153915153916153917153918153919153920153921153922153923153924153925153926153927153928153929153930153931153932153933153934153935153936153937153938153939153940153941153942153943153944153945153946153947153948153949153950153951153952153953153954153955153956153957153958153959153960153961153962153963153964153965153966153967153968153969153970153971153972153973153974153975153976153977153978153979153980153981153982153983153984153985153986153987153988153989153990153991153992153993153994153995153996153997153998153999154000154001154002154003154004154005154006154007154008154009154010154011154012154013154014154015154016154017154018154019154020154021154022154023154024154025154026154027154028154029154030154031154032154033154034154035154036154037154038154039154040154041154042154043154044154045154046154047154048154049154050154051154052154053154054154055154056154057154058154059154060154061154062154063154064154065154066154067154068154069154070154071154072154073154074154075154076154077154078154079154080154081154082154083154084154085154086154087154088154089154090154091154092154093154094154095154096154097154098154099154100154101154102154103154104154105154106154107154108154109154110154111154112154113154114154115154116154117154118154119154120154121154122154123154124154125154126154127154128154129154130154131154132154133154134154135154136154137154138154139154140154141154142154143154144154145154146154147154148154149154150154151154152154153154154154155154156154157154158154159154160154161154162154163154164154165154166154167154168154169154170154171154172154173154174154175154176154177154178154179154180154181154182154183154184154185154186154187154188154189154190154191154192154193154194154195154196154197154198154199154200154201154202154203154204154205154206154207154208154209154210154211154212154213154214154215154216154217154218154219154220154221154222154223154224154225154226154227154228154229154230154231154232154233154234154235154236154237154238154239154240154241154242154243154244154245154246154247154248154249154250154251154252154253154254154255154256154257154258154259154260154261154262154263154264154265154266154267154268154269154270154271154272154273154274154275154276154277154278154279154280154281154282154283154284154285154286154287154288154289154290154291154292154293154294154295154296154297154298154299154300154301154302154303154304154305154306154307154308154309154310154311154312154313154314154315154316154317154318154319154320154321154322154323154324154325154326154327154328154329154330154331154332154333154334154335154336154337154338154339154340154341154342154343154344154345154346154347154348154349154350154351154352154353154354154355154356154357154358154359154360154361154362154363154364154365154366154367154368154369154370154371154372154373154374154375154376154377154378154379154380154381154382154383154384154385154386154387154388154389154390154391154392154393154394154395154396154397154398154399154400154401154402154403154404154405154406154407154408154409154410154411154412154413154414154415154416154417154418154419154420154421154422154423154424154425154426154427154428154429154430154431154432154433154434154435154436154437154438154439154440154441154442154443154444154445154446154447154448154449154450154451154452154453154454154455154456154457154458154459154460154461154462154463154464154465154466154467154468154469154470154471154472154473154474154475154476154477154478154479154480154481154482154483154484154485154486154487154488154489154490154491154492154493154494154495154496154497154498154499154500154501154502154503154504154505154506154507154508154509154510154511154512154513154514154515154516154517154518154519154520154521154522154523154524154525154526154527154528154529154530154531154532154533154534154535154536154537154538154539154540154541154542154543154544154545154546154547154548154549154550154551154552154553154554154555154556154557154558154559154560154561154562154563154564154565154566154567154568154569154570154571154572154573154574154575154576154577154578154579154580154581154582154583154584154585154586154587154588154589154590154591154592154593154594154595154596154597154598154599154600154601154602154603154604154605154606154607154608154609154610154611154612154613154614154615154616154617154618154619154620154621154622154623154624154625154626154627154628154629154630154631154632154633154634154635154636154637154638154639154640154641154642154643154644154645154646154647154648154649154650154651154652154653154654154655154656154657154658154659154660154661154662154663154664154665154666154667154668154669154670154671154672154673154674154675154676154677154678154679154680154681154682154683154684154685154686154687154688154689154690154691154692154693154694154695154696154697154698154699154700154701154702154703154704154705154706154707154708154709154710154711154712154713154714154715154716154717154718154719154720154721154722154723154724154725154726154727154728154729154730154731154732154733154734154735154736154737154738154739154740154741154742154743154744154745154746154747154748154749154750154751154752154753154754154755154756154757154758154759154760154761154762154763154764154765154766154767154768154769154770154771154772154773154774154775154776154777154778154779154780154781154782154783154784154785154786154787154788154789154790154791154792154793154794154795154796154797154798154799154800154801154802154803154804154805154806154807154808154809154810154811154812154813154814154815154816154817154818154819154820154821154822154823154824154825154826154827154828154829154830154831154832154833154834154835154836154837154838154839154840154841154842154843154844154845154846154847154848154849154850154851154852154853154854154855154856154857154858154859154860154861154862154863154864154865154866154867154868154869154870154871154872154873154874154875154876154877154878154879154880154881154882154883154884154885154886154887154888154889154890154891154892154893154894154895154896154897154898154899154900154901154902154903154904154905154906154907154908154909154910154911154912154913154914154915154916154917154918154919154920154921154922154923154924154925154926154927154928154929154930154931154932154933154934154935154936154937154938154939154940154941154942154943154944154945154946154947154948154949154950154951154952154953154954154955154956154957154958154959154960154961154962154963154964154965154966154967154968154969154970154971154972154973154974154975154976154977154978154979154980154981154982154983154984154985154986154987154988154989154990154991154992154993154994154995154996154997154998154999155000155001155002155003155004155005155006155007155008155009155010155011155012155013155014155015155016155017155018155019155020155021155022155023155024155025155026155027155028155029155030155031155032155033155034155035155036155037155038155039155040155041155042155043155044155045155046155047155048155049155050155051155052155053155054155055155056155057155058155059155060155061155062155063155064155065155066155067155068155069155070155071155072155073155074155075155076155077155078155079155080155081155082155083155084155085155086155087155088155089155090155091155092155093155094155095155096155097155098155099155100155101155102155103155104155105155106155107155108155109155110155111155112155113155114155115155116155117155118155119155120155121155122155123155124155125155126155127155128155129155130155131155132155133155134155135155136155137155138155139155140155141155142155143155144155145155146155147155148155149155150155151155152155153155154155155155156155157155158155159155160155161155162155163155164155165155166155167155168155169155170155171155172155173155174155175155176155177155178155179155180155181155182155183155184155185155186155187155188155189155190155191155192155193155194155195155196155197155198155199155200155201155202155203155204155205155206155207155208155209155210155211155212155213155214155215155216155217155218155219155220155221155222155223155224155225155226155227155228155229155230155231155232155233155234155235155236155237155238155239155240155241155242155243155244155245155246155247155248155249155250155251155252155253155254155255155256155257155258155259155260155261155262155263155264155265155266155267155268155269155270155271155272155273155274155275155276155277155278155279155280155281155282155283155284155285155286155287155288155289155290155291155292155293155294155295155296155297155298155299155300155301155302155303155304155305155306155307155308155309155310155311155312155313155314155315155316155317155318155319155320155321155322155323155324155325155326155327155328155329155330155331155332155333155334155335155336155337155338155339155340155341155342155343155344155345155346155347155348155349155350155351155352155353155354155355155356155357155358155359155360155361155362155363155364155365155366155367155368155369155370155371155372155373155374155375155376155377155378155379155380155381155382155383155384155385155386155387155388155389155390155391155392155393155394155395155396155397155398155399155400155401155402155403155404155405155406155407155408155409155410155411155412155413155414155415155416155417155418155419155420155421155422155423155424155425155426155427155428155429155430155431155432155433155434155435155436155437155438155439155440155441155442155443155444155445155446155447155448155449155450155451155452155453155454155455155456155457155458155459155460155461155462155463155464155465155466155467155468155469155470155471155472155473155474155475155476155477155478155479155480155481155482155483155484155485155486155487155488155489155490155491155492155493155494155495155496155497155498155499155500155501155502155503155504155505155506155507155508155509155510155511155512155513155514155515155516155517155518155519155520155521155522155523155524155525155526155527155528155529155530155531155532155533155534155535155536155537155538155539155540155541155542155543155544155545155546155547155548155549155550155551155552155553155554155555155556155557155558155559155560155561155562155563155564155565155566155567155568155569155570155571155572155573155574155575155576155577155578155579155580155581155582155583155584155585155586155587155588155589155590155591155592155593155594155595155596155597155598155599155600155601155602155603155604155605155606155607155608155609155610155611155612155613155614155615155616155617155618155619155620155621155622155623155624155625155626155627155628155629155630155631155632155633155634155635155636155637155638155639155640155641155642155643155644155645155646155647155648155649155650155651155652155653155654155655155656155657155658155659155660155661155662155663155664155665155666155667155668155669155670155671155672155673155674155675155676155677155678155679155680155681155682155683155684155685155686155687155688155689155690155691155692155693155694155695155696155697155698155699155700155701155702155703155704155705155706155707155708155709155710155711155712155713155714155715155716155717155718155719155720155721155722155723155724155725155726155727155728155729155730155731155732155733155734155735155736155737155738155739155740155741155742155743155744155745155746155747155748155749155750155751155752155753155754155755155756155757155758155759155760155761155762155763155764155765155766155767155768155769155770155771155772155773155774155775155776155777155778155779155780155781155782155783155784155785155786155787155788155789155790155791155792155793155794155795155796155797155798155799155800155801155802155803155804155805155806155807155808155809155810155811155812155813155814155815155816155817155818155819155820155821155822155823155824155825155826155827155828155829155830155831155832155833155834155835155836155837155838155839155840155841155842155843155844155845155846155847155848155849155850155851155852155853155854155855155856155857155858155859155860155861155862155863155864155865155866155867155868155869155870155871155872155873155874155875155876155877155878155879155880155881155882155883155884155885155886155887155888155889155890155891155892155893155894155895155896155897155898155899155900155901155902155903155904155905155906155907155908155909155910155911155912155913155914155915155916155917155918155919155920155921155922155923155924155925155926155927155928155929155930155931155932155933155934155935155936155937155938155939155940155941155942155943155944155945155946155947155948155949155950155951155952155953155954155955155956155957155958155959155960155961155962155963155964155965155966155967155968155969155970155971155972155973155974155975155976155977155978155979155980155981155982155983155984155985155986155987155988155989155990155991155992155993155994155995155996155997155998155999156000156001156002156003156004156005156006156007156008156009156010156011156012156013156014156015156016156017156018156019156020156021156022156023156024156025156026156027156028156029156030156031156032156033156034156035156036156037156038156039156040156041156042156043156044156045156046156047156048156049156050156051156052156053156054156055156056156057156058156059156060156061156062156063156064156065156066156067156068156069156070156071156072156073156074156075156076156077156078156079156080156081156082156083156084156085156086156087156088156089156090156091156092156093156094156095156096156097156098156099156100156101156102156103156104156105156106156107156108156109156110156111156112156113156114156115156116156117156118156119156120156121156122156123156124156125156126156127156128156129156130156131156132156133156134156135156136156137156138156139156140156141156142156143156144156145156146156147156148156149156150156151156152156153156154156155156156156157156158156159156160156161156162156163156164156165156166156167156168156169156170156171156172156173156174156175156176156177156178156179156180156181156182156183156184156185156186156187156188156189156190156191156192156193156194156195156196156197156198156199156200156201156202156203156204156205156206156207156208156209156210156211156212156213156214156215156216156217156218156219156220156221156222156223156224156225156226156227156228156229156230156231156232156233156234156235156236156237156238156239156240156241156242156243156244156245156246156247156248156249156250156251156252156253156254156255156256156257156258156259156260156261156262156263156264156265156266156267156268156269156270156271156272156273156274156275156276156277156278156279156280156281156282156283156284156285156286156287156288156289156290156291156292156293156294156295156296156297156298156299156300156301156302156303156304156305156306156307156308156309156310156311156312156313156314156315156316156317156318156319156320156321156322156323156324156325156326156327156328156329156330156331156332156333156334156335156336156337156338156339156340156341156342156343156344156345156346156347156348156349156350156351156352156353156354156355156356156357156358156359156360156361156362156363156364156365156366156367156368156369156370156371156372156373156374156375156376156377156378156379156380156381156382156383156384156385156386156387156388156389156390156391156392156393156394156395156396156397156398156399156400156401156402156403156404156405156406156407156408156409156410156411156412156413156414156415156416156417156418156419156420156421156422156423156424156425156426156427156428156429156430156431156432156433156434156435156436156437156438156439156440156441156442156443156444156445156446156447156448156449156450156451156452156453156454156455156456156457156458156459156460156461156462156463156464156465156466156467156468156469156470156471156472156473156474156475156476156477156478156479156480156481156482156483156484156485156486156487156488156489156490156491156492156493156494156495156496156497156498156499156500156501156502156503156504156505156506156507156508156509156510156511156512156513156514156515156516156517156518156519156520156521156522156523156524156525156526156527156528156529156530156531156532156533156534156535156536156537156538156539156540156541156542156543156544156545156546156547156548156549156550156551156552156553156554156555156556156557156558156559156560156561156562156563156564156565156566156567156568156569156570156571156572156573156574156575156576156577156578156579156580156581156582156583156584156585156586156587156588156589156590156591156592156593156594156595156596156597156598156599156600156601156602156603156604156605156606156607156608156609156610156611156612156613156614156615156616156617156618156619156620156621156622156623156624156625156626156627156628156629156630156631156632156633156634156635156636156637156638156639156640156641156642156643156644156645156646156647156648156649156650156651156652156653156654156655156656156657156658156659156660156661156662156663156664156665156666156667156668156669156670156671156672156673156674156675156676156677156678156679156680156681156682156683156684156685156686156687156688156689156690156691156692156693156694156695156696156697156698156699156700156701156702156703156704156705156706156707156708156709156710156711156712156713156714156715156716156717156718156719156720156721156722156723156724156725156726156727156728156729156730156731156732156733156734156735156736156737156738156739156740156741156742156743156744156745156746156747156748156749156750156751156752156753156754156755156756156757156758156759156760156761156762156763156764156765156766156767156768156769156770156771156772156773156774156775156776156777156778156779156780156781156782156783156784156785156786156787156788156789156790156791156792156793156794156795156796156797156798156799156800156801156802156803156804156805156806156807156808156809156810156811156812156813156814156815156816156817156818156819156820156821156822156823156824156825156826156827156828156829156830156831156832156833156834156835156836156837156838156839156840156841156842156843156844156845156846156847156848156849156850156851156852156853156854156855156856156857156858156859156860156861156862156863156864156865156866156867156868156869156870156871156872156873156874156875156876156877156878156879156880156881156882156883156884156885156886156887156888156889156890156891156892156893156894156895156896156897156898156899156900156901156902156903156904156905156906156907156908156909156910156911156912156913156914156915156916156917156918156919156920156921156922156923156924156925156926156927156928156929156930156931156932156933156934156935156936156937156938156939156940156941156942156943156944156945156946156947156948156949156950156951156952156953156954156955156956156957156958156959156960156961156962156963156964156965156966156967156968156969156970156971156972156973156974156975156976156977156978156979156980156981156982156983156984156985156986156987156988156989156990156991156992156993156994156995156996156997156998156999157000157001157002157003157004157005157006157007157008157009157010157011157012157013157014157015157016157017157018157019157020157021157022157023157024157025157026157027157028157029157030157031157032157033157034157035157036157037157038157039157040157041157042157043157044157045157046157047157048157049157050157051157052157053157054157055157056157057157058157059157060157061157062157063157064157065157066157067157068157069157070157071157072157073157074157075157076157077157078157079157080157081157082157083157084157085157086157087157088157089157090157091157092157093157094157095157096157097157098157099157100157101157102157103157104157105157106157107157108157109157110157111157112157113157114157115157116157117157118157119157120157121157122157123157124157125157126157127157128157129157130157131157132157133157134157135157136157137157138157139157140157141157142157143157144157145157146157147157148157149157150157151157152157153157154157155157156157157157158157159157160157161157162157163157164157165157166157167157168157169157170157171157172157173157174157175157176157177157178157179157180157181157182157183157184157185157186157187157188157189157190157191157192157193157194157195157196157197157198157199157200157201157202157203157204157205157206157207157208157209157210157211157212157213157214157215157216157217157218157219157220157221157222157223157224157225157226157227157228157229157230157231157232157233157234157235157236157237157238157239157240157241157242157243157244157245157246157247157248157249157250157251157252157253157254157255157256157257157258157259157260157261157262157263157264157265157266157267157268157269157270157271157272157273157274157275157276157277157278157279157280157281157282157283157284157285157286157287157288157289157290157291157292157293157294157295157296157297157298157299157300157301157302157303157304157305157306157307157308157309157310157311157312157313157314157315157316157317157318157319157320157321157322157323157324157325157326157327157328157329157330157331157332157333157334157335157336157337157338157339157340157341157342157343157344157345157346157347157348157349157350157351157352157353157354157355157356157357157358157359157360157361157362157363157364157365157366157367157368157369157370157371157372157373157374157375157376157377157378157379157380157381157382157383157384157385157386157387157388157389157390157391157392157393157394157395157396157397157398157399157400157401157402157403157404157405157406157407157408157409157410157411157412157413157414157415157416157417157418157419157420157421157422157423157424157425157426157427157428157429157430157431157432157433157434157435157436157437157438157439157440157441157442157443157444157445157446157447157448157449157450157451157452157453157454157455157456157457157458157459157460157461157462157463157464157465157466157467157468157469157470157471157472157473157474157475157476157477157478157479157480157481157482157483157484157485157486157487157488157489157490157491157492157493157494157495157496157497157498157499157500157501157502157503157504157505157506157507157508157509157510157511157512157513157514157515157516157517157518157519157520157521157522157523157524157525157526157527157528157529157530157531157532157533157534157535157536157537157538157539157540157541157542157543157544157545157546157547157548157549157550157551157552157553157554157555157556157557157558157559157560157561157562157563157564157565157566157567157568157569157570157571157572157573157574157575157576157577157578157579157580157581157582157583157584157585157586157587157588157589157590157591157592157593157594157595157596157597157598157599157600157601157602157603157604157605157606157607157608157609157610157611157612157613157614157615157616157617157618157619157620157621157622157623157624157625157626157627157628157629157630157631157632157633157634157635157636157637157638157639157640157641157642157643157644157645157646157647157648157649157650157651157652157653157654157655157656157657157658157659157660157661157662157663157664157665157666157667157668157669157670157671157672157673157674157675157676157677157678157679157680157681157682157683157684157685157686157687157688157689157690157691157692157693157694157695157696157697157698157699157700157701157702157703157704157705157706157707157708157709157710157711157712157713157714157715157716157717157718157719157720157721157722157723157724157725157726157727157728157729157730157731157732157733157734157735157736157737157738157739157740157741157742157743157744157745157746157747157748157749157750157751157752157753157754157755157756157757157758157759157760157761157762157763157764157765157766157767157768157769157770157771157772157773157774157775157776157777157778157779157780157781157782157783157784157785157786157787157788157789157790157791157792157793157794157795157796157797157798157799157800157801157802157803157804157805157806157807157808157809157810157811157812157813157814157815157816157817157818157819157820157821157822157823157824157825157826157827157828157829157830157831157832157833157834157835157836157837157838157839157840157841157842157843157844157845157846157847157848157849157850157851157852157853157854157855157856157857157858157859157860157861157862157863157864157865157866157867157868157869157870157871157872157873157874157875157876157877157878157879157880157881157882157883157884157885157886157887157888157889157890157891157892157893157894157895157896157897157898157899157900157901157902157903157904157905157906157907157908157909157910157911157912157913157914157915157916157917157918157919157920157921157922157923157924157925157926157927157928157929157930157931157932157933157934157935157936157937157938157939157940157941157942157943157944157945157946157947157948157949157950157951157952157953157954157955157956157957157958157959157960157961157962157963157964157965157966157967157968157969157970157971157972157973157974157975157976157977157978157979157980157981157982157983157984157985157986157987157988157989157990157991157992157993157994157995157996157997157998157999158000158001158002158003158004158005158006158007158008158009158010158011158012158013158014158015158016158017158018158019158020158021158022158023158024158025158026158027158028158029158030158031158032158033158034158035158036158037158038158039158040158041158042158043158044158045158046158047158048158049158050158051158052158053158054158055158056158057158058158059158060158061158062158063158064158065158066158067158068158069158070158071158072158073158074158075158076158077158078158079158080158081158082158083158084158085158086158087158088158089158090158091158092158093158094158095158096158097158098158099158100158101158102158103158104158105158106158107158108158109158110158111158112158113158114158115158116158117158118158119158120158121158122158123158124158125158126158127158128158129158130158131158132158133158134158135158136158137158138158139158140158141158142158143158144158145158146158147158148158149158150158151158152158153158154158155158156158157158158158159158160158161158162158163158164158165158166158167158168158169158170158171158172158173158174158175158176158177158178158179158180158181158182158183158184158185158186158187158188158189158190158191158192158193158194158195158196158197158198158199158200158201158202158203158204158205158206158207158208158209158210158211158212158213158214158215158216158217158218158219158220158221158222158223158224158225158226158227158228158229158230158231158232158233158234158235158236158237158238158239158240158241158242158243158244158245158246158247158248158249158250158251158252158253158254158255158256158257158258158259158260158261158262158263158264158265158266158267158268158269158270158271158272158273158274158275158276158277158278158279158280158281158282158283158284158285158286158287158288158289158290158291158292158293158294158295158296158297158298158299158300158301158302158303158304158305158306158307158308158309158310158311158312158313158314158315158316158317158318158319158320158321158322158323158324158325158326158327158328158329158330158331158332158333158334158335158336158337158338158339158340158341158342158343158344158345158346158347158348158349158350158351158352158353158354158355158356158357158358158359158360158361158362158363158364158365158366158367158368158369158370158371158372158373158374158375158376158377158378158379158380158381158382158383158384158385158386158387158388158389158390158391158392158393158394158395158396158397158398158399158400158401158402158403158404158405158406158407158408158409158410158411158412158413158414158415158416158417158418158419158420158421158422158423158424158425158426158427158428158429158430158431158432158433158434158435158436158437158438158439158440158441158442158443158444158445158446158447158448158449158450158451158452158453158454158455158456158457158458158459158460158461158462158463158464158465158466158467158468158469158470158471158472158473158474158475158476158477158478158479158480158481158482158483158484158485158486158487158488158489158490158491158492158493158494158495158496158497158498158499158500158501158502158503158504158505158506158507158508158509158510158511158512158513158514158515158516158517158518158519158520158521158522158523158524158525158526158527158528158529158530158531158532158533158534158535158536158537158538158539158540158541158542158543158544158545158546158547158548158549158550158551158552158553158554158555158556158557158558158559158560158561158562158563158564158565158566158567158568158569158570158571158572158573158574158575158576158577158578158579158580158581158582158583158584158585158586158587158588158589158590158591158592158593158594158595158596158597158598158599158600158601158602158603158604158605158606158607158608158609158610158611158612158613158614158615158616158617158618158619158620158621158622158623158624158625158626158627158628158629158630158631158632158633158634158635158636158637158638158639158640158641158642158643158644158645158646158647158648158649158650158651158652158653158654158655158656158657158658158659158660158661158662158663158664158665158666158667158668158669158670158671158672158673158674158675158676158677158678158679158680158681158682158683158684158685158686158687158688158689158690158691158692158693158694158695158696158697158698158699158700158701158702158703158704158705158706158707158708158709158710158711158712158713158714158715158716158717158718158719158720158721158722158723158724158725158726158727158728158729158730158731158732158733158734158735158736158737158738158739158740158741158742158743158744158745158746158747158748158749158750158751158752158753158754158755158756158757158758158759158760158761158762158763158764158765158766158767158768158769158770158771158772158773158774158775158776158777158778158779158780158781158782158783158784158785158786158787158788158789158790158791158792158793158794158795158796158797158798158799158800158801158802158803158804158805158806158807158808158809158810158811158812158813158814158815158816158817158818158819158820158821158822158823158824158825158826158827158828158829158830158831158832158833158834158835158836158837158838158839158840158841158842158843158844158845158846158847158848158849158850158851158852158853158854158855158856158857158858158859158860158861158862158863158864158865158866158867158868158869158870158871158872158873158874158875158876158877158878158879158880158881158882158883158884158885158886158887158888158889158890158891158892158893158894158895158896158897158898158899158900158901158902158903158904158905158906158907158908158909158910158911158912158913158914158915158916158917158918158919158920158921158922158923158924158925158926158927158928158929158930158931158932158933158934158935158936158937158938158939158940158941158942158943158944158945158946158947158948158949158950158951158952158953158954158955158956158957158958158959158960158961158962158963158964158965158966158967158968158969158970158971158972158973158974158975158976158977158978158979158980158981158982158983158984158985158986158987158988158989158990158991158992158993158994158995158996158997158998158999159000159001159002159003159004159005159006159007159008159009159010159011159012159013159014159015159016159017159018159019159020159021159022159023159024159025159026159027159028159029159030159031159032159033159034159035159036159037159038159039159040159041159042159043159044159045159046159047159048159049159050159051159052159053159054159055159056159057159058159059159060159061159062159063159064159065159066159067159068159069159070159071159072159073159074159075159076159077159078159079159080159081159082159083159084159085159086159087159088159089159090159091159092159093159094159095159096159097159098159099159100159101159102159103159104159105159106159107159108159109159110159111159112159113159114159115159116159117159118159119159120159121159122159123159124159125159126159127159128159129159130159131159132159133159134159135159136159137159138159139159140159141159142159143159144159145159146159147159148159149159150159151159152159153159154159155159156159157159158159159159160159161159162159163159164159165159166159167159168159169159170159171159172159173159174159175159176159177159178159179159180159181159182159183159184159185159186159187159188159189159190159191159192159193159194159195159196159197159198159199159200159201159202159203159204159205159206159207159208159209159210159211159212159213159214159215159216159217159218159219159220159221159222159223159224159225159226159227159228159229159230159231159232159233159234159235159236159237159238159239159240159241159242159243159244159245159246159247159248159249159250159251159252159253159254159255159256159257159258159259159260159261159262159263159264159265159266159267159268159269159270159271159272159273159274159275159276159277159278159279159280159281159282159283159284159285159286159287159288159289159290159291159292159293159294159295159296159297159298159299159300159301159302159303159304159305159306159307159308159309159310159311159312159313159314159315159316159317159318159319159320159321159322159323159324159325159326159327159328159329159330159331159332159333159334159335159336159337159338159339159340159341159342159343159344159345159346159347159348159349159350159351159352159353159354159355159356159357159358159359159360159361159362159363159364159365159366159367159368159369159370159371159372159373159374159375159376159377159378159379159380159381159382159383159384159385159386159387159388159389159390159391159392159393159394159395159396159397159398159399159400159401159402159403159404159405159406159407159408159409159410159411159412159413159414159415159416159417159418159419159420159421159422159423159424159425159426159427159428159429159430159431159432159433159434159435159436159437159438159439159440159441159442159443159444159445159446159447159448159449159450159451159452159453159454159455159456159457159458159459159460159461159462159463159464159465159466159467159468159469159470159471159472159473159474159475159476159477159478159479159480159481159482159483159484159485159486159487159488159489159490159491159492159493159494159495159496159497159498159499159500159501159502159503159504159505159506159507159508159509159510159511159512159513159514159515159516159517159518159519159520159521159522159523159524159525159526159527159528159529159530159531159532159533159534159535159536159537159538159539159540159541159542159543159544159545159546159547159548159549159550159551159552159553159554159555159556159557159558159559159560159561159562159563159564159565159566159567159568159569159570159571159572159573159574159575159576159577159578159579159580159581159582159583159584159585159586159587159588159589159590159591159592159593159594159595159596159597159598159599159600159601159602159603159604159605159606159607159608159609159610159611159612159613159614159615159616159617159618159619159620159621159622159623159624159625159626159627159628159629159630159631159632159633159634159635159636159637159638159639159640159641159642159643159644159645159646159647159648159649159650159651159652159653159654159655159656159657159658159659159660159661159662159663159664159665159666159667159668159669159670159671159672159673159674159675159676159677159678159679159680159681159682159683159684159685159686159687159688159689159690159691159692159693159694159695159696159697159698159699159700159701159702159703159704159705159706159707159708159709159710159711159712159713159714159715159716159717159718159719159720159721159722159723159724159725159726159727159728159729159730159731159732159733159734159735159736159737159738159739159740159741159742159743159744159745159746159747159748159749159750159751159752159753159754159755159756159757159758159759159760159761159762159763159764159765159766159767159768159769159770159771159772159773159774159775159776159777159778159779159780159781159782159783159784159785159786159787159788159789159790159791159792159793159794159795159796159797159798159799159800159801159802159803159804159805159806159807159808159809159810159811159812159813159814159815159816159817159818159819159820159821159822159823159824159825159826159827159828159829159830159831159832159833159834159835159836159837159838159839159840159841159842159843159844159845159846159847159848159849159850159851159852159853159854159855159856159857159858159859159860159861159862159863159864159865159866159867159868159869159870159871159872159873159874159875159876159877159878159879159880159881159882159883159884159885159886159887159888159889159890159891159892159893159894159895159896159897159898159899159900159901159902159903159904159905159906159907159908159909159910159911159912159913159914159915159916159917159918159919159920159921159922159923159924159925159926159927159928159929159930159931159932159933159934159935159936159937159938159939159940159941159942159943159944159945159946159947159948159949159950159951159952159953159954159955159956159957159958159959159960159961159962159963159964159965159966159967159968159969159970159971159972159973159974159975159976159977159978159979159980159981159982159983159984159985159986159987159988159989159990159991159992159993159994159995159996159997159998159999160000160001160002160003160004160005160006160007160008160009160010160011160012160013160014160015160016160017160018160019160020160021160022160023160024160025160026160027160028160029160030160031160032160033160034160035160036160037160038160039160040160041160042160043160044160045160046160047160048160049160050160051160052160053160054160055160056160057160058160059160060160061160062160063160064160065160066160067160068160069160070160071160072160073160074160075160076160077160078160079160080160081160082160083160084160085160086160087160088160089160090160091160092160093160094160095160096160097160098160099160100160101160102160103160104160105160106160107160108160109160110160111160112160113160114160115160116160117160118160119160120160121160122160123160124160125160126160127160128160129160130160131160132160133160134160135160136160137160138160139160140160141160142160143160144160145160146160147160148160149160150160151160152160153160154160155160156160157160158160159160160160161160162160163160164160165160166160167160168160169160170160171160172160173160174160175160176160177160178160179160180160181160182160183160184160185160186160187160188160189160190160191160192160193160194160195160196160197160198160199160200160201160202160203160204160205160206160207160208160209160210160211160212160213160214160215160216160217160218160219160220160221160222160223160224160225160226160227160228160229160230160231160232160233160234160235160236160237160238160239160240160241160242160243160244160245160246160247160248160249160250160251160252160253160254160255160256160257160258160259160260160261160262160263160264160265160266160267160268160269160270160271160272160273160274160275160276160277160278160279160280160281160282160283160284160285160286160287160288160289160290160291160292160293160294160295160296160297160298160299160300160301160302160303160304160305160306160307160308160309160310160311160312160313160314160315160316160317160318160319160320160321160322160323160324160325160326160327160328160329160330160331160332160333160334160335160336160337160338160339160340160341160342160343160344160345160346160347160348160349160350160351160352160353160354160355160356160357160358160359160360160361160362160363160364160365160366160367160368160369160370160371160372160373160374160375160376160377160378160379160380160381160382160383160384160385160386160387160388160389160390160391160392160393160394160395160396160397160398160399160400160401160402160403160404160405160406160407160408160409160410160411160412160413160414160415160416160417160418160419160420160421160422160423160424160425160426160427160428160429160430160431160432160433160434160435160436160437160438160439160440160441160442160443160444160445160446160447160448160449160450160451160452160453160454160455160456160457160458160459160460160461160462160463160464160465160466160467160468160469160470160471160472160473160474160475160476160477160478160479160480160481160482160483160484160485160486160487160488160489160490160491160492160493160494160495160496160497160498160499160500160501160502160503160504160505160506160507160508160509160510160511160512160513160514160515160516160517160518160519160520160521160522160523160524160525160526160527160528160529160530160531160532160533160534160535160536160537160538160539160540160541160542160543160544160545160546160547160548160549160550160551160552160553160554160555160556160557160558160559160560160561160562160563160564160565160566160567160568160569160570160571160572160573160574160575160576160577160578160579160580160581160582160583160584160585160586160587160588160589160590160591160592160593160594160595160596160597160598160599160600160601160602160603160604160605160606160607160608160609160610160611160612160613160614160615160616160617160618160619160620160621160622160623160624160625160626160627160628160629160630160631160632160633160634160635160636160637160638160639160640160641160642160643160644160645160646160647160648160649160650160651160652160653160654160655160656160657160658160659160660160661160662160663160664160665160666160667160668160669160670160671160672160673160674160675160676160677160678160679160680160681160682160683160684160685160686160687160688160689160690160691160692160693160694160695160696160697160698160699160700160701160702160703160704160705160706160707160708160709160710160711160712160713160714160715160716160717160718160719160720160721160722160723160724160725160726160727160728160729160730160731160732160733160734160735160736160737160738160739160740160741160742160743160744160745160746160747160748160749160750160751160752160753160754160755160756160757160758160759160760160761160762160763160764160765160766160767160768160769160770160771160772160773160774160775160776160777160778160779160780160781160782160783160784160785160786160787160788160789160790160791160792160793160794160795160796160797160798160799160800160801160802160803160804160805160806160807160808160809160810160811160812160813160814160815160816160817160818160819160820160821160822160823160824160825160826160827160828160829160830160831160832160833160834160835160836160837160838160839160840160841160842160843160844160845160846160847160848160849160850160851160852160853160854160855160856160857160858160859160860160861160862160863160864160865160866160867160868160869160870160871160872160873160874160875160876160877160878160879160880160881160882160883160884160885160886160887160888160889160890160891160892160893160894160895160896160897160898160899160900160901160902160903160904160905160906160907160908160909160910160911160912160913160914160915160916160917160918160919160920160921160922160923160924160925160926160927160928160929160930160931160932160933160934160935160936160937160938160939160940160941160942160943160944160945160946160947160948160949160950160951160952160953160954160955160956160957160958160959160960160961160962160963160964160965160966160967160968160969160970160971160972160973160974160975160976160977160978160979160980160981160982160983160984160985160986160987160988160989160990160991160992160993160994160995160996160997160998160999161000161001161002161003161004161005161006161007161008161009161010161011161012161013161014161015161016161017161018161019161020161021161022161023161024161025161026161027161028161029161030161031161032161033161034161035161036161037161038161039161040161041161042161043161044161045161046161047161048161049161050161051161052161053161054161055161056161057161058161059161060161061161062161063161064161065161066161067161068161069161070161071161072161073161074161075161076161077161078161079161080161081161082161083161084161085161086161087161088161089161090161091161092161093161094161095161096161097161098161099161100161101161102161103161104161105161106161107161108161109161110161111161112161113161114161115161116161117161118161119161120161121161122161123161124161125161126161127161128161129161130161131161132161133161134161135161136161137161138161139161140161141161142161143161144161145161146161147161148161149161150161151161152161153161154161155161156161157161158161159161160161161161162161163161164161165161166161167161168161169161170161171161172161173161174161175161176161177161178161179161180161181161182161183161184161185161186161187161188161189161190161191161192161193161194161195161196161197161198161199161200161201161202161203161204161205161206161207161208161209161210161211161212161213161214161215161216161217161218161219161220161221161222161223161224161225161226161227161228161229161230161231161232161233161234161235161236161237161238161239161240161241161242161243161244161245161246161247161248161249161250161251161252161253161254161255161256161257161258161259161260161261161262161263161264161265161266161267161268161269161270161271161272161273161274161275161276161277161278161279161280161281161282161283161284161285161286161287161288161289161290161291161292161293161294161295161296161297161298161299161300161301161302161303161304161305161306161307161308161309161310161311161312161313161314161315161316161317161318161319161320161321161322161323161324161325161326161327161328161329161330161331161332161333161334161335161336161337161338161339161340161341161342161343161344161345161346161347161348161349161350161351161352161353161354161355161356161357161358161359161360161361161362161363161364161365161366161367161368161369161370161371161372161373161374161375161376161377161378161379161380161381161382161383161384161385161386161387161388161389161390161391161392161393161394161395161396161397161398161399161400161401161402161403161404161405161406161407161408161409161410161411161412161413161414161415161416161417161418161419161420161421161422161423161424161425161426161427161428161429161430161431161432161433161434161435161436161437161438161439161440161441161442161443161444161445161446161447161448161449161450161451161452161453161454161455161456161457161458161459161460161461161462161463161464161465161466161467161468161469161470161471161472161473161474161475161476161477161478161479161480161481161482161483161484161485161486161487161488161489161490161491161492161493161494161495161496161497161498161499161500161501161502161503161504161505161506161507161508161509161510161511161512161513161514161515161516161517161518161519161520161521161522161523161524161525161526161527161528161529161530161531161532161533161534161535161536161537161538161539161540161541161542161543161544161545161546161547161548161549161550161551161552161553161554161555161556161557161558161559161560161561161562161563161564161565161566161567161568161569161570161571161572161573161574161575161576161577161578161579161580161581161582161583161584161585161586161587161588161589161590161591161592161593161594161595161596161597161598161599161600161601161602161603161604161605161606161607161608161609161610161611161612161613161614161615161616161617161618161619161620161621161622161623161624161625161626161627161628161629161630161631161632161633161634161635161636161637161638161639161640161641161642161643161644161645161646161647161648161649161650161651161652161653161654161655161656161657161658161659161660161661161662161663161664161665161666161667161668161669161670161671161672161673161674161675161676161677161678161679161680161681161682161683161684161685161686161687161688161689161690161691161692161693161694161695161696161697161698161699161700161701161702161703161704161705161706161707161708161709161710161711161712161713161714161715161716161717161718161719161720161721161722161723161724161725161726161727161728161729161730161731161732161733161734161735161736161737161738161739161740161741161742161743161744161745161746161747161748161749161750161751161752161753161754161755161756161757161758161759161760161761161762161763161764161765161766161767161768161769161770161771161772161773161774161775161776161777161778161779161780161781161782161783161784161785161786161787161788161789161790161791161792161793161794161795161796161797161798161799161800161801161802161803161804161805161806161807161808161809161810161811161812161813161814161815161816161817161818161819161820161821161822161823161824161825161826161827161828161829161830161831161832161833161834161835161836161837161838161839161840161841161842161843161844161845161846161847161848161849161850161851161852161853161854161855161856161857161858161859161860161861161862161863161864161865161866161867161868161869161870161871161872161873161874161875161876161877161878161879161880161881161882161883161884161885161886161887161888161889161890161891161892161893161894161895161896161897161898161899161900161901161902161903161904161905161906161907161908161909161910161911161912161913161914161915161916161917161918161919161920161921161922161923161924161925161926161927161928161929161930161931161932161933161934161935161936161937161938161939161940161941161942161943161944161945161946161947161948161949161950161951161952161953161954161955161956161957161958161959161960161961161962161963161964161965161966161967161968161969161970161971161972161973161974161975161976161977161978161979161980161981161982161983161984161985161986161987161988161989161990161991161992161993161994161995161996161997161998161999162000162001162002162003162004162005162006162007162008162009162010162011162012162013162014162015162016162017162018162019162020162021162022162023162024162025162026162027162028162029162030162031162032162033162034162035162036162037162038162039162040162041162042162043162044162045162046162047162048162049162050162051162052162053162054162055162056162057162058162059162060162061162062162063162064162065162066162067162068162069162070162071162072162073162074162075162076162077162078162079162080162081162082162083162084162085162086162087162088162089162090162091162092162093162094162095162096162097162098162099162100162101162102162103162104162105162106162107162108162109162110162111162112162113162114162115162116162117162118162119162120162121162122162123162124162125162126162127162128162129162130162131162132162133162134162135162136162137162138162139162140162141162142162143162144162145162146162147162148162149162150162151162152162153162154162155162156162157162158162159162160162161162162162163162164162165162166162167162168162169162170162171162172162173162174162175162176162177162178162179162180162181162182162183162184162185162186162187162188162189162190162191162192162193162194162195162196162197162198162199162200162201162202162203162204162205162206162207162208162209162210162211162212162213162214162215162216162217162218162219162220162221162222162223162224162225162226162227162228162229162230162231162232162233162234162235162236162237162238162239162240162241162242162243162244162245162246162247162248162249162250162251162252162253162254162255162256162257162258162259162260162261162262162263162264162265162266162267162268162269162270162271162272162273162274162275162276162277162278162279162280162281162282162283162284162285162286162287162288162289162290162291162292162293162294162295162296162297162298162299162300162301162302162303162304162305162306162307162308162309162310162311162312162313162314162315162316162317162318162319162320162321162322162323162324162325162326162327162328162329162330162331162332162333162334162335162336162337162338162339162340162341162342162343162344162345162346162347162348162349162350162351162352162353162354162355162356162357162358162359162360162361162362162363162364162365162366162367162368162369162370162371162372162373162374162375162376162377162378162379162380162381162382162383162384162385162386162387162388162389162390162391162392162393162394162395162396162397162398162399162400162401162402162403162404162405162406162407162408162409162410162411162412162413162414162415162416162417162418162419162420162421162422162423162424162425162426162427162428162429162430162431162432162433162434162435162436162437162438162439162440162441162442162443162444162445162446162447162448162449162450162451162452162453162454162455162456162457162458162459162460162461162462162463162464162465162466162467162468162469162470162471162472162473162474162475162476162477162478162479162480162481162482162483162484162485162486162487162488162489162490162491162492162493162494162495162496162497162498162499162500162501162502162503162504162505162506162507162508162509162510162511162512162513162514162515162516162517162518162519162520162521162522162523162524162525162526162527162528162529162530162531162532162533162534162535162536162537162538162539162540162541162542162543162544162545162546162547162548162549162550162551162552162553162554162555162556162557162558162559162560162561162562162563162564162565162566162567162568162569162570162571162572162573162574162575162576162577162578162579162580162581162582162583162584162585162586162587162588162589162590162591162592162593162594162595162596162597162598162599162600162601162602162603162604162605162606162607162608162609162610162611162612162613162614162615162616162617162618162619162620162621162622162623162624162625162626162627162628162629162630162631162632162633162634162635162636162637162638162639162640162641162642162643162644162645162646162647162648162649162650162651162652162653162654162655162656162657162658162659162660162661162662162663162664162665162666162667162668162669162670162671162672162673162674162675162676162677162678162679162680162681162682162683162684162685162686162687162688162689162690162691162692162693162694162695162696162697162698162699162700162701162702162703162704162705162706162707162708162709162710162711162712162713162714162715162716162717162718162719162720162721162722162723162724162725162726162727162728162729162730162731162732162733162734162735162736162737162738162739162740162741162742162743162744162745162746162747162748162749162750162751162752162753162754162755162756162757162758162759162760162761162762162763162764162765162766162767162768162769162770162771162772162773162774162775162776162777162778162779162780162781162782162783162784162785162786162787162788162789162790162791162792162793162794162795162796162797162798162799162800162801162802162803162804162805162806162807162808162809162810162811162812162813162814162815162816162817162818162819162820162821162822162823162824162825162826162827162828162829162830162831162832162833162834162835162836162837162838162839162840162841162842162843162844162845162846162847162848162849162850162851162852162853162854162855162856162857162858162859162860162861162862162863162864162865162866162867162868162869162870162871162872162873162874162875162876162877162878162879162880162881162882162883162884162885162886162887162888162889162890162891162892162893162894162895162896162897162898162899162900162901162902162903162904162905162906162907162908162909162910162911162912162913162914162915162916162917162918162919162920162921162922162923162924162925162926162927162928162929162930162931162932162933162934162935162936162937162938162939162940162941162942162943162944162945162946162947162948162949162950162951162952162953162954162955162956162957162958162959162960162961162962162963162964162965162966162967162968162969162970162971162972162973162974162975162976162977162978162979162980162981162982162983162984162985162986162987162988162989162990162991162992162993162994162995162996162997162998162999163000163001163002163003163004163005163006163007163008163009163010163011163012163013163014163015163016163017163018163019163020163021163022163023163024163025163026163027163028163029163030163031163032163033163034163035163036163037163038163039163040163041163042163043163044163045163046163047163048163049163050163051163052163053163054163055163056163057163058163059163060163061163062163063163064163065163066163067163068163069163070163071163072163073163074163075163076163077163078163079163080163081163082163083163084163085163086163087163088163089163090163091163092163093163094163095163096163097163098163099163100163101163102163103163104163105163106163107163108163109163110163111163112163113163114163115163116163117163118163119163120163121163122163123163124163125163126163127163128163129163130163131163132163133163134163135163136163137163138163139163140163141163142163143163144163145163146163147163148163149163150163151163152163153163154163155163156163157163158163159163160163161163162163163163164163165163166163167163168163169163170163171163172163173163174163175163176163177163178163179163180163181163182163183163184163185163186163187163188163189163190163191163192163193163194163195163196163197163198163199163200163201163202163203163204163205163206163207163208163209163210163211163212163213163214163215163216163217163218163219163220163221163222163223163224163225163226163227163228163229163230163231163232163233163234163235163236163237163238163239163240163241163242163243163244163245163246163247163248163249163250163251163252163253163254163255163256163257163258163259163260163261163262163263163264163265163266163267163268163269163270163271163272163273163274163275163276163277163278163279163280163281163282163283163284163285163286163287163288163289163290163291163292163293163294163295163296163297163298163299163300163301163302163303163304163305163306163307163308163309163310163311163312163313163314163315163316163317163318163319163320163321163322163323163324163325163326163327163328163329163330163331163332163333163334163335163336163337163338163339163340163341163342163343163344163345163346163347163348163349163350163351163352163353163354163355163356163357163358163359163360163361163362163363163364163365163366163367163368163369163370163371163372163373163374163375163376163377163378163379163380163381163382163383163384163385163386163387163388163389163390163391163392163393163394163395163396163397163398163399163400163401163402163403163404163405163406163407163408163409163410163411163412163413163414163415163416163417163418163419163420163421163422163423163424163425163426163427163428163429163430163431163432163433163434163435163436163437163438163439163440163441163442163443163444163445163446163447163448163449163450163451163452163453163454163455163456163457163458163459163460163461163462163463163464163465163466163467163468163469163470163471163472163473163474163475163476163477163478163479163480163481163482163483163484163485163486163487163488163489163490163491163492163493163494163495163496163497163498163499163500163501163502163503163504163505163506163507163508163509163510163511163512163513163514163515163516163517163518163519163520163521163522163523163524163525163526163527163528163529163530163531163532163533163534163535163536163537163538163539163540163541163542163543163544163545163546163547163548163549163550163551163552163553163554163555163556163557163558163559163560163561163562163563163564163565163566163567163568163569163570163571163572163573163574163575163576163577163578163579163580163581163582163583163584163585163586163587163588163589163590163591163592163593163594163595163596163597163598163599163600163601163602163603163604163605163606163607163608163609163610163611163612163613163614163615163616163617163618163619163620163621163622163623163624163625163626163627163628163629163630163631163632163633163634163635163636163637163638163639163640163641163642163643163644163645163646163647163648163649163650163651163652163653163654163655163656163657163658163659163660163661163662163663163664163665163666163667163668163669163670163671163672163673163674163675163676163677163678163679163680163681163682163683163684163685163686163687163688163689163690163691163692163693163694163695163696163697163698163699163700163701163702163703163704163705163706163707163708163709163710163711163712163713163714163715163716163717163718163719163720163721163722163723163724163725163726163727163728163729163730163731163732163733163734163735163736163737163738163739163740163741163742163743163744163745163746163747163748163749163750163751163752163753163754163755163756163757163758163759163760163761163762163763163764163765163766163767163768163769163770163771163772163773163774163775163776163777163778163779163780163781163782163783163784163785163786163787163788163789163790163791163792163793163794163795163796163797163798163799163800163801163802163803163804163805163806163807163808163809163810163811163812163813163814163815163816163817163818163819163820163821163822163823163824163825163826163827163828163829163830163831163832163833163834163835163836163837163838163839163840163841163842163843163844163845163846163847163848163849163850163851163852163853163854163855163856163857163858163859163860163861163862163863163864163865163866163867163868163869163870163871163872163873163874163875163876163877163878163879163880163881163882163883163884163885163886163887163888163889163890163891163892163893163894163895163896163897163898163899163900163901163902163903163904163905163906163907163908163909163910163911163912163913163914163915163916163917163918163919163920163921163922163923163924163925163926163927163928163929163930163931163932163933163934163935163936163937163938163939163940163941163942163943163944163945163946163947163948163949163950163951163952163953163954163955163956163957163958163959163960163961163962163963163964163965163966163967163968163969163970163971163972163973163974163975163976163977163978163979163980163981163982163983163984163985163986163987163988163989163990163991163992163993163994163995163996163997163998163999164000164001164002164003164004164005164006164007164008164009164010164011164012164013164014164015164016164017164018164019164020164021164022164023164024164025164026164027164028164029164030164031164032164033164034164035164036164037164038164039164040164041164042164043164044164045164046164047164048164049164050164051164052164053164054164055164056164057164058164059164060164061164062164063164064164065164066164067164068164069164070164071164072164073164074164075164076164077164078164079164080164081164082164083164084164085164086164087164088164089164090164091164092164093164094164095164096164097164098164099164100164101164102164103164104164105164106164107164108164109164110164111164112164113164114164115164116164117164118164119164120164121164122164123164124164125164126164127164128164129164130164131164132164133164134164135164136164137164138164139164140164141164142164143164144164145164146164147164148164149164150164151164152164153164154164155164156164157164158164159164160164161164162164163164164164165164166164167164168164169164170164171164172164173164174164175164176164177164178164179164180164181164182164183164184164185164186164187164188164189164190164191164192164193164194164195164196164197164198164199164200164201164202164203164204164205164206164207164208164209164210164211164212164213164214164215164216164217164218164219164220164221164222164223164224164225164226164227164228164229164230164231164232164233164234164235164236164237164238164239164240164241164242164243164244164245164246164247164248164249164250164251164252164253164254164255164256164257164258164259164260164261164262164263164264164265164266164267164268164269164270164271164272164273164274164275164276164277164278164279164280164281164282164283164284164285164286164287164288164289164290164291164292164293164294164295164296164297164298164299164300164301164302164303164304164305164306164307164308164309164310164311164312164313164314164315164316164317164318164319164320164321164322164323164324164325164326164327164328164329164330164331164332164333164334164335164336164337164338164339164340164341164342164343164344164345164346164347164348164349164350164351164352164353164354164355164356164357164358164359164360164361164362164363164364164365164366164367164368164369164370164371164372164373164374164375164376164377164378164379164380164381164382164383164384164385164386164387164388164389164390164391164392164393164394164395164396164397164398164399164400164401164402164403164404164405164406164407164408164409164410164411164412164413164414164415164416164417164418164419164420164421164422164423164424164425164426164427164428164429164430164431164432164433164434164435164436164437164438164439164440164441164442164443164444164445164446164447164448164449164450164451164452164453164454164455164456164457164458164459164460164461164462164463164464164465164466164467164468164469164470164471164472164473164474164475164476164477164478164479164480164481164482164483164484164485164486164487164488164489164490164491164492164493164494164495164496164497164498164499164500164501164502164503164504164505164506164507164508164509164510164511164512164513164514164515164516164517164518164519164520164521164522164523164524164525164526164527164528164529164530164531164532164533164534164535164536164537164538164539164540164541164542164543164544164545164546164547164548164549164550164551164552164553164554164555164556164557164558164559164560164561164562164563164564164565164566164567164568164569164570164571164572164573164574164575164576164577164578164579164580164581164582164583164584164585164586164587164588164589164590164591164592164593164594164595164596164597164598164599164600164601164602164603164604164605164606164607164608164609164610164611164612164613164614164615164616164617164618164619164620164621164622164623164624164625164626164627164628164629164630164631164632164633164634164635164636164637164638164639164640164641164642164643164644164645164646164647164648164649164650164651164652164653164654164655164656164657164658164659164660164661164662164663164664164665164666164667164668164669164670164671164672164673164674164675164676164677164678164679164680164681164682164683164684164685164686164687164688164689164690164691164692164693164694164695164696164697164698164699164700164701164702164703164704164705164706164707164708164709164710164711164712164713164714164715164716164717164718164719164720164721164722164723164724164725164726164727164728164729164730164731164732164733164734164735164736164737164738164739164740164741164742164743164744164745164746164747164748164749164750164751164752164753164754164755164756164757164758164759164760164761164762164763164764164765164766164767164768164769164770164771164772164773164774164775164776164777164778164779164780164781164782164783164784164785164786164787164788164789164790164791164792164793164794164795164796164797164798164799164800164801164802164803164804164805164806164807164808164809164810164811164812164813164814164815164816164817164818164819164820164821164822164823164824164825164826164827164828164829164830164831164832164833164834164835164836164837164838164839164840164841164842164843164844164845164846164847164848164849164850164851164852164853164854164855164856164857164858164859164860164861164862164863164864164865164866164867164868164869164870164871164872164873164874164875164876164877164878164879164880164881164882164883164884164885164886164887164888164889164890164891164892164893164894164895164896164897164898164899164900164901164902164903164904164905164906164907164908164909164910164911164912164913164914164915164916164917164918164919164920164921164922164923164924164925164926164927164928164929164930164931164932164933164934164935164936164937164938164939164940164941164942164943164944164945164946164947164948164949164950164951164952164953164954164955164956164957164958164959164960164961164962164963164964164965164966164967164968164969164970164971164972164973164974164975164976164977164978164979164980164981164982164983164984164985164986164987164988164989164990164991164992164993164994164995164996164997164998164999165000165001165002165003165004165005165006165007165008165009165010165011165012165013165014165015165016165017165018165019165020165021165022165023165024165025165026165027165028165029165030165031165032165033165034165035165036165037165038165039165040165041165042165043165044165045165046165047165048165049165050165051165052165053165054165055165056165057165058165059165060165061165062165063165064165065165066165067165068165069165070165071165072165073165074165075165076165077165078165079165080165081165082165083165084165085165086165087165088165089165090165091165092165093165094165095165096165097165098165099165100165101165102165103165104165105165106165107165108165109165110165111165112165113165114165115165116165117165118165119165120165121165122165123165124165125165126165127165128165129165130165131165132165133165134165135165136165137165138165139165140165141165142165143165144165145165146165147165148165149165150165151165152165153165154165155165156165157165158165159165160165161165162165163165164165165165166165167165168165169165170165171165172165173165174165175165176165177165178165179165180165181165182165183165184165185165186165187165188165189165190165191165192165193165194165195165196165197165198165199165200165201165202165203165204165205165206165207165208165209165210165211165212165213165214165215165216165217165218165219165220165221165222165223165224165225165226165227165228165229165230165231165232165233165234165235165236165237165238165239165240165241165242165243165244165245165246165247165248165249165250165251165252165253165254165255165256165257165258165259165260165261165262165263165264165265165266165267165268165269165270165271165272165273165274165275165276165277165278165279165280165281165282165283165284165285165286165287165288165289165290165291165292165293165294165295165296165297165298165299165300165301165302165303165304165305165306165307165308165309165310165311165312165313165314165315165316165317165318165319165320165321165322165323165324165325165326165327165328165329165330165331165332165333165334165335165336165337165338165339165340165341165342165343165344165345165346165347165348165349165350165351165352165353165354165355165356165357165358165359165360165361165362165363165364165365165366165367165368165369165370165371165372165373165374165375165376165377165378165379165380165381165382165383165384165385165386165387165388165389165390165391165392165393165394165395165396165397165398165399165400165401165402165403165404165405165406165407165408165409165410165411165412165413165414165415165416165417165418165419165420165421165422165423165424165425165426165427165428165429165430165431165432165433165434165435165436165437165438165439165440165441165442165443165444165445165446165447165448165449165450165451165452165453165454165455165456165457165458165459165460165461165462165463165464165465165466165467165468165469165470165471165472165473165474165475165476165477165478165479165480165481165482165483165484165485165486165487165488165489165490165491165492165493165494165495165496165497165498165499165500165501165502165503165504165505165506165507165508165509165510165511165512165513165514165515165516165517165518165519165520165521165522165523165524165525165526165527165528165529165530165531165532165533165534165535165536165537165538165539165540165541165542165543165544165545165546165547165548165549165550165551165552165553165554165555165556165557165558165559165560165561165562165563165564165565165566165567165568165569165570165571165572165573165574165575165576165577165578165579165580165581165582165583165584165585165586165587165588165589165590165591165592165593165594165595165596165597165598165599165600165601165602165603165604165605165606165607165608165609165610165611165612165613165614165615165616165617165618165619165620165621165622165623165624165625165626165627165628165629165630165631165632165633165634165635165636165637165638165639165640165641165642165643165644165645165646165647165648165649165650165651165652165653165654165655165656165657165658165659165660165661165662165663165664165665165666165667165668165669165670165671165672165673165674165675165676165677165678165679165680165681165682165683165684165685165686165687165688165689165690165691165692165693165694165695165696165697165698165699165700165701165702165703165704165705165706165707165708165709165710165711165712165713165714165715165716165717165718165719165720165721165722165723165724165725165726165727165728165729165730165731165732165733165734165735165736165737165738165739165740165741165742165743165744165745165746165747165748165749165750165751165752165753165754165755165756165757165758165759165760165761165762165763165764165765165766165767165768165769165770165771165772165773165774165775165776165777165778165779165780165781165782165783165784165785165786165787165788165789165790165791165792165793165794165795165796165797165798165799165800165801165802165803165804165805165806165807165808165809165810165811165812165813165814165815165816165817165818165819165820165821165822165823165824165825165826165827165828165829165830165831165832165833165834165835165836165837165838165839165840165841165842165843165844165845165846165847165848165849165850165851165852165853165854165855165856165857165858165859165860165861165862165863165864165865165866165867165868165869165870165871165872165873165874165875165876165877165878165879165880165881165882165883165884165885165886165887165888165889165890165891165892165893165894165895165896165897165898165899165900165901165902165903165904165905165906165907165908165909165910165911165912165913165914165915165916165917165918165919165920165921165922165923165924165925165926165927165928165929165930165931165932165933165934165935165936165937165938165939165940165941165942165943165944165945165946165947165948165949165950165951165952165953165954165955165956165957165958165959165960165961165962165963165964165965165966165967165968165969165970165971165972165973165974165975165976165977165978165979165980165981165982165983165984165985165986165987165988165989165990165991165992165993165994165995165996165997165998165999166000166001166002166003166004166005166006166007166008166009166010166011166012166013166014166015166016166017166018166019166020166021166022166023166024166025166026166027166028166029166030166031166032166033166034166035166036166037166038166039166040166041166042166043166044166045166046166047166048166049166050166051166052166053166054166055166056166057166058166059166060166061166062166063166064166065166066166067166068166069166070166071166072166073166074166075166076166077166078166079166080166081166082166083166084166085166086166087166088166089166090166091166092166093166094166095166096166097166098166099166100166101166102166103166104166105166106166107166108166109166110166111166112166113166114166115166116166117166118166119166120166121166122166123166124166125166126166127166128166129166130166131166132166133166134166135166136166137166138166139166140166141166142166143166144166145166146166147166148166149166150166151166152166153166154166155166156166157166158166159166160166161166162166163166164166165166166166167166168166169166170166171166172166173166174166175166176166177166178166179166180166181166182166183166184166185166186166187166188166189166190166191166192166193166194166195166196166197166198166199166200166201166202166203166204166205166206166207166208166209166210166211166212166213166214166215166216166217166218166219166220166221166222166223166224166225166226166227166228166229166230166231166232166233166234166235166236166237166238166239166240166241166242166243166244166245166246166247166248166249166250166251166252166253166254166255166256166257166258166259166260166261166262166263166264166265166266166267166268166269166270166271166272166273166274166275166276166277166278166279166280166281166282166283166284166285166286166287166288166289166290166291166292166293166294166295166296166297166298166299166300166301166302166303166304166305166306166307166308166309166310166311166312166313166314166315166316166317166318166319166320166321166322166323166324166325166326166327166328166329166330166331166332166333166334166335166336166337166338166339166340166341166342166343166344166345166346166347166348166349166350166351166352166353166354166355166356166357166358166359166360166361166362166363166364166365166366166367166368166369166370166371166372166373166374166375166376166377166378166379166380166381166382166383166384166385166386166387166388166389166390166391166392166393166394166395166396166397166398166399166400166401166402166403166404166405166406166407166408166409166410166411166412166413166414166415166416166417166418166419166420166421166422166423166424166425166426166427166428166429166430166431166432166433166434166435166436166437166438166439166440166441166442166443166444166445166446166447166448166449166450166451166452166453166454166455166456166457166458166459166460166461166462166463166464166465166466166467166468166469166470166471166472166473166474166475166476166477166478166479166480166481166482166483166484166485166486166487166488166489166490166491166492166493166494166495166496166497166498166499166500166501166502166503166504166505166506166507166508166509166510166511166512166513166514166515166516166517166518166519166520166521166522166523166524166525166526166527166528166529166530166531166532166533166534166535166536166537166538166539166540166541166542166543166544166545166546166547166548166549166550166551166552166553166554166555166556166557166558166559166560166561166562166563166564166565166566166567166568166569166570166571166572166573166574166575166576166577166578166579166580166581166582166583166584166585166586166587166588166589166590166591166592166593166594166595166596166597166598166599166600166601166602166603166604166605166606166607166608166609166610166611166612166613166614166615166616166617166618166619166620166621166622166623166624166625166626166627166628166629166630166631166632166633166634166635166636166637166638166639166640166641166642166643166644166645166646166647166648166649166650166651166652166653166654166655166656166657166658166659166660166661166662166663166664166665166666166667166668166669166670166671166672166673166674166675166676166677166678166679166680166681166682166683166684166685166686166687166688166689166690166691166692166693166694166695166696166697166698166699166700166701166702166703166704166705166706166707166708166709166710166711166712166713166714166715166716166717166718166719166720166721166722166723166724166725166726166727166728166729166730166731166732166733166734166735166736166737166738166739166740166741166742166743166744166745166746166747166748166749166750166751166752166753166754166755166756166757166758166759166760166761166762166763166764166765166766166767166768166769166770166771166772166773166774166775166776166777166778166779166780166781166782166783166784166785166786166787166788166789166790166791166792166793166794166795166796166797166798166799166800166801166802166803166804166805166806166807166808166809166810166811166812166813166814166815166816166817166818166819166820166821166822166823166824166825166826166827166828166829166830166831166832166833166834166835166836166837166838166839166840166841166842166843166844166845166846166847166848166849166850166851166852166853166854166855166856166857166858166859166860166861166862166863166864166865166866166867166868166869166870166871166872166873166874166875166876166877166878166879166880166881166882166883166884166885166886166887166888166889166890166891166892166893166894166895166896166897166898166899166900166901166902166903166904166905166906166907166908166909166910166911166912166913166914166915166916166917166918166919166920166921166922166923166924166925166926166927166928166929166930166931166932166933166934166935166936166937166938166939166940166941166942166943166944166945166946166947166948166949166950166951166952166953166954166955166956166957166958166959166960166961166962166963166964166965166966166967166968166969166970166971166972166973166974166975166976166977166978166979166980166981166982166983166984166985166986166987166988166989166990166991166992166993166994166995166996166997166998166999167000167001167002167003167004167005167006167007167008167009167010167011167012167013167014167015167016167017167018167019167020167021167022167023167024167025167026167027167028167029167030167031167032167033167034167035167036167037167038167039167040167041167042167043167044167045167046167047167048167049167050167051167052167053167054167055167056167057167058167059167060167061167062167063167064167065167066167067167068167069167070167071167072167073167074167075167076167077167078167079167080167081167082167083167084167085167086167087167088167089167090167091167092167093167094167095167096167097167098167099167100167101167102167103167104167105167106167107167108167109167110167111167112167113167114167115167116167117167118167119167120167121167122167123167124167125167126167127167128167129167130167131167132167133167134167135167136167137167138167139167140167141167142167143167144167145167146167147167148167149167150167151167152167153167154167155167156167157167158167159167160167161167162167163167164167165167166167167167168167169167170167171167172167173167174167175167176167177167178167179167180167181167182167183167184167185167186167187167188167189167190167191167192167193167194167195167196167197167198167199167200167201167202167203167204167205167206167207167208167209167210167211167212167213167214167215167216167217167218167219167220167221167222167223167224167225167226167227167228167229167230167231167232167233167234167235167236167237167238167239167240167241167242167243167244167245167246167247167248167249167250167251167252167253167254167255167256167257167258167259167260167261167262167263167264167265167266167267167268167269167270167271167272167273167274167275167276167277167278167279167280167281167282167283167284167285167286167287167288167289167290167291167292167293167294167295167296167297167298167299167300167301167302167303167304167305167306167307167308167309167310167311167312167313167314167315167316167317167318167319167320167321167322167323167324167325167326167327167328167329167330167331167332167333167334167335167336167337167338167339167340167341167342167343167344167345167346167347167348167349167350167351167352167353167354167355167356167357167358167359167360167361167362167363167364167365167366167367167368167369167370167371167372167373167374167375167376167377167378167379167380167381167382167383167384167385167386167387167388167389167390167391167392167393167394167395167396167397167398167399167400167401167402167403167404167405167406167407167408167409167410167411167412167413167414167415167416167417167418167419167420167421167422167423167424167425167426167427167428167429167430167431167432167433167434167435167436167437167438167439167440167441167442167443167444167445167446167447167448167449167450167451167452167453167454167455167456167457167458167459167460167461167462167463167464167465167466167467167468167469167470167471167472167473167474167475167476167477167478167479167480167481167482167483167484167485167486167487167488167489167490167491167492167493167494167495167496167497167498167499167500167501167502167503167504167505167506167507167508167509167510167511167512167513167514167515167516167517167518167519167520167521167522167523167524167525167526167527167528167529167530167531167532167533167534167535167536167537167538167539167540167541167542167543167544167545167546167547167548167549167550167551167552167553167554167555167556167557167558167559167560167561167562167563167564167565167566167567167568167569167570167571167572167573167574167575167576167577167578167579167580167581167582167583167584167585167586167587167588167589167590167591167592167593167594167595167596167597167598167599167600167601167602167603167604167605167606167607167608167609167610167611167612167613167614167615167616167617167618167619167620167621167622167623167624167625167626167627167628167629167630167631167632167633167634167635167636167637167638167639167640167641167642167643167644167645167646167647167648167649167650167651167652167653167654167655167656167657167658167659167660167661167662167663167664167665167666167667167668167669167670167671167672167673167674167675167676167677167678167679167680167681167682167683167684167685167686167687167688167689167690167691167692167693167694167695167696167697167698167699167700167701167702167703167704167705167706167707167708167709167710167711167712167713167714167715167716167717167718167719167720167721167722167723167724167725167726167727167728167729167730167731167732167733167734167735167736167737167738167739167740167741167742167743167744167745167746167747167748167749167750167751167752167753167754167755167756167757167758167759167760167761167762167763167764167765167766167767167768167769167770167771167772167773167774167775167776167777167778167779167780167781167782167783167784167785167786167787167788167789167790167791167792167793167794167795167796167797167798167799167800167801167802167803167804167805167806167807167808167809167810167811167812167813167814167815167816167817167818167819167820167821167822167823167824167825167826167827167828167829167830167831167832167833167834167835167836167837167838167839167840167841167842167843167844167845167846167847167848167849167850167851167852167853167854167855167856167857167858167859167860167861167862167863167864167865167866167867167868167869167870167871167872167873167874167875167876167877167878167879167880167881167882167883167884167885167886167887167888167889167890167891167892167893167894167895167896167897167898167899167900167901167902167903167904167905167906167907167908167909167910167911167912167913167914167915167916167917167918167919167920167921167922167923167924167925167926167927167928167929167930167931167932167933167934167935167936167937167938167939167940167941167942167943167944167945167946167947167948167949167950167951167952167953167954167955167956167957167958167959167960167961167962167963167964167965167966167967167968167969167970167971167972167973167974167975167976167977167978167979167980167981167982167983167984167985167986167987167988167989167990167991167992167993167994167995167996167997167998167999168000168001168002168003168004168005168006168007168008168009168010168011168012168013168014168015168016168017168018168019168020168021168022168023168024168025168026168027168028168029168030168031168032168033168034168035168036168037168038168039168040168041168042168043168044168045168046168047168048168049168050168051168052168053168054168055168056168057168058168059168060168061168062168063168064168065168066168067168068168069168070168071168072168073168074168075168076168077168078168079168080168081168082168083168084168085168086168087168088168089168090168091168092168093168094168095168096168097168098168099168100168101168102168103168104168105168106168107168108168109168110168111168112168113168114168115168116168117168118168119168120168121168122168123168124168125168126168127168128168129168130168131168132168133168134168135168136168137168138168139168140168141168142168143168144168145168146168147168148168149168150168151168152168153168154168155168156168157168158168159168160168161168162168163168164168165168166168167168168168169168170168171168172168173168174168175168176168177168178168179168180168181168182168183168184168185168186168187168188168189168190168191168192168193168194168195168196168197168198168199168200168201168202168203168204168205168206168207168208168209168210168211168212168213168214168215168216168217168218168219168220168221168222168223168224168225168226168227168228168229168230168231168232168233168234168235168236168237168238168239168240168241168242168243168244168245168246168247168248168249168250168251168252168253168254168255168256168257168258168259168260168261168262168263168264168265168266168267168268168269168270168271168272168273168274168275168276168277168278168279168280168281168282168283168284168285168286168287168288168289168290168291168292168293168294168295168296168297168298168299168300168301168302168303168304168305168306168307168308168309168310168311168312168313168314168315168316168317168318168319168320168321168322168323168324168325168326168327168328168329168330168331168332168333168334168335168336168337168338168339168340168341168342168343168344168345168346168347168348168349168350168351168352168353168354168355168356168357168358168359168360168361168362168363168364168365168366168367168368168369168370168371168372168373168374168375168376168377168378168379168380168381168382168383168384168385168386168387168388168389168390168391168392168393168394168395168396168397168398168399168400168401168402168403168404168405168406168407168408168409168410168411168412168413168414168415168416168417168418168419168420168421168422168423168424168425168426168427168428168429168430168431168432168433168434168435168436168437168438168439168440168441168442168443168444168445168446168447168448168449168450168451168452168453168454168455168456168457168458168459168460168461168462168463168464168465168466168467168468168469168470168471168472168473168474168475168476168477168478168479168480168481168482168483168484168485168486168487168488168489168490168491168492168493168494168495168496168497168498168499168500168501168502168503168504168505168506168507168508168509168510168511168512168513168514168515168516168517168518168519168520168521168522168523168524168525168526168527168528168529168530168531168532168533168534168535168536168537168538168539168540168541168542168543168544168545168546168547168548168549168550168551168552168553168554168555168556168557168558168559168560168561168562168563168564168565168566168567168568168569168570168571168572168573168574168575168576168577168578168579168580168581168582168583168584168585168586168587168588168589168590168591168592168593168594168595168596168597168598168599168600168601168602168603168604168605168606168607168608168609168610168611168612168613168614168615168616168617168618168619168620168621168622168623168624168625168626168627168628168629168630168631168632168633168634168635168636168637168638168639168640168641168642168643168644168645168646168647168648168649168650168651168652168653168654168655168656168657168658168659168660168661168662168663168664168665168666168667168668168669168670168671168672168673168674168675168676168677168678168679168680168681168682168683168684168685168686168687168688168689168690168691168692168693168694168695168696168697168698168699168700168701168702168703168704168705168706168707168708168709168710168711168712168713168714168715168716168717168718168719168720168721168722168723168724168725168726168727168728168729168730168731168732168733168734168735168736168737168738168739168740168741168742168743168744168745168746168747168748168749168750168751168752168753168754168755168756168757168758168759168760168761168762168763168764168765168766168767168768168769168770168771168772168773168774168775168776168777168778168779168780168781168782168783168784168785168786168787168788168789168790168791168792168793168794168795168796168797168798168799168800168801168802168803168804168805168806168807168808168809168810168811168812168813168814168815168816168817168818168819168820168821168822168823168824168825168826168827168828168829168830168831168832168833168834168835168836168837168838168839168840168841168842168843168844168845168846168847168848168849168850168851168852168853168854168855168856168857168858168859168860168861168862168863168864168865168866168867168868168869168870168871168872168873168874168875168876168877168878168879168880168881168882168883168884168885168886168887168888168889168890168891168892168893168894168895168896168897168898168899168900168901168902168903168904168905168906168907168908168909168910168911168912168913168914168915168916168917168918168919168920168921168922168923168924168925168926168927168928168929168930168931168932168933168934168935168936168937168938168939168940168941168942168943168944168945168946168947168948168949168950168951168952168953168954168955168956168957168958168959168960168961168962168963168964168965168966168967168968168969168970168971168972168973168974168975168976168977168978168979168980168981168982168983168984168985168986168987168988168989168990168991168992168993168994168995168996168997168998168999169000169001169002169003169004169005169006169007169008169009169010169011169012169013169014169015169016169017169018169019169020169021169022169023169024169025169026169027169028169029169030169031169032169033169034169035169036169037169038169039169040169041169042169043169044169045169046169047169048169049169050169051169052169053169054169055169056169057169058169059169060169061169062169063169064169065169066169067169068169069169070169071169072169073169074169075169076169077169078169079169080169081169082169083169084169085169086169087169088169089169090169091169092169093169094169095169096169097169098169099169100169101169102169103169104169105169106169107169108169109169110169111169112169113169114169115169116169117169118169119169120169121169122169123169124169125169126169127169128169129169130169131169132169133169134169135169136169137169138169139169140169141169142169143169144169145169146169147169148169149169150169151169152169153169154169155169156169157169158169159169160169161169162169163169164169165169166169167169168169169169170169171169172169173169174169175169176169177169178169179169180169181169182169183169184169185169186169187169188169189169190169191169192169193169194169195169196169197169198169199169200169201169202169203169204169205169206169207169208169209169210169211169212169213169214169215169216169217169218169219169220169221169222169223169224169225169226169227169228169229169230169231169232169233169234169235169236169237169238169239169240169241169242169243169244169245169246169247169248169249169250169251169252169253169254169255169256169257169258169259169260169261169262169263169264169265169266169267169268169269169270169271169272169273169274169275169276169277169278169279169280169281169282169283169284169285169286169287169288169289169290169291169292169293169294169295169296169297169298169299169300169301169302169303169304169305169306169307169308169309169310169311169312169313169314169315169316169317169318169319169320169321169322169323169324169325169326169327169328169329169330169331169332169333169334169335169336169337169338169339169340169341169342169343169344169345169346169347169348169349169350169351169352169353169354169355169356169357169358169359169360169361169362169363169364169365169366169367169368169369169370169371169372169373169374169375169376169377169378169379169380169381169382169383169384169385169386169387169388169389169390169391169392169393169394169395169396169397169398169399169400169401169402169403169404169405169406169407169408169409169410169411169412169413169414169415169416169417169418169419169420169421169422169423169424169425169426169427169428169429169430169431169432169433169434169435169436169437169438169439169440169441169442169443169444169445169446169447169448169449169450169451169452169453169454169455169456169457169458169459169460169461169462169463169464169465169466169467169468169469169470169471169472169473169474169475169476169477169478169479169480169481169482169483169484169485169486169487169488169489169490169491169492169493169494169495169496169497169498169499169500169501169502169503169504169505169506169507169508169509169510169511169512169513169514169515169516169517169518169519169520169521169522169523169524169525169526169527169528169529169530169531169532169533169534169535169536169537169538169539169540169541169542169543169544169545169546169547169548169549169550169551169552169553169554169555169556169557169558169559169560169561169562169563169564169565169566169567169568169569169570169571169572169573169574169575169576169577169578169579169580169581169582169583169584169585169586169587169588169589169590169591169592169593169594169595169596169597169598169599169600169601169602169603169604169605169606169607169608169609169610169611169612169613169614169615169616169617169618169619169620169621169622169623169624169625169626169627169628169629169630169631169632169633169634169635169636169637169638169639169640169641169642169643169644169645169646169647169648169649169650169651169652169653169654169655169656169657169658169659169660169661169662169663169664169665169666169667169668169669169670169671169672169673169674169675169676169677169678169679169680169681169682169683169684169685169686169687169688169689169690169691169692169693169694169695169696169697169698169699169700169701169702169703169704169705169706169707169708169709169710169711169712169713169714169715169716169717169718169719169720169721169722169723169724169725169726169727169728169729169730169731169732169733169734169735169736169737169738169739169740169741169742169743169744169745169746169747169748169749169750169751169752169753169754169755169756169757169758169759169760169761169762169763169764169765169766169767169768169769169770169771169772169773169774169775169776169777169778169779169780169781169782169783169784169785169786169787169788169789169790169791169792169793169794169795169796169797169798169799169800169801169802169803169804169805169806169807169808169809169810169811169812169813169814169815169816169817169818169819169820169821169822169823169824169825169826169827169828169829169830169831169832169833169834169835169836169837169838169839169840169841169842169843169844169845169846169847169848169849169850169851169852169853169854169855169856169857169858169859169860169861169862169863169864169865169866169867169868169869169870169871169872169873169874169875169876169877169878169879169880169881169882169883169884169885169886169887169888169889169890169891169892169893169894169895169896169897169898169899169900169901169902169903169904169905169906169907169908169909169910169911169912169913169914169915169916169917169918169919169920169921169922169923169924169925169926169927169928169929169930169931169932169933169934169935169936169937169938169939169940169941169942169943169944169945169946169947169948169949169950169951169952169953169954169955169956169957169958169959169960169961169962169963169964169965169966169967169968169969169970169971169972169973169974169975169976169977169978169979169980169981169982169983169984169985169986169987169988169989169990169991169992169993169994169995169996169997169998169999170000170001170002170003170004170005170006170007170008170009170010170011170012170013170014170015170016170017170018170019170020170021170022170023170024170025170026170027170028170029170030170031170032170033170034170035170036170037170038170039170040170041170042170043170044170045170046170047170048170049170050170051170052170053170054170055170056170057170058170059170060170061170062170063170064170065170066170067170068170069170070170071170072170073170074170075170076170077170078170079170080170081170082170083170084170085170086170087170088170089170090170091170092170093170094170095170096170097170098170099170100170101170102170103170104170105170106170107170108170109170110170111170112170113170114170115170116170117170118170119170120170121170122170123170124170125170126170127170128170129170130170131170132170133170134170135170136170137170138170139170140170141170142170143170144170145170146170147170148170149170150170151170152170153170154170155170156170157170158170159170160170161170162170163170164170165170166170167170168170169170170170171170172170173170174170175170176170177170178170179170180170181170182170183170184170185170186170187170188170189170190170191170192170193170194170195170196170197170198170199170200170201170202170203170204170205170206170207170208170209170210170211170212170213170214170215170216170217170218170219170220170221170222170223170224170225170226170227170228170229170230170231170232170233170234170235170236170237170238170239170240170241170242170243170244170245170246170247170248170249170250170251170252170253170254170255170256170257170258170259170260170261170262170263170264170265170266170267170268170269170270170271170272170273170274170275170276170277170278170279170280170281170282170283170284170285170286170287170288170289170290170291170292170293170294170295170296170297170298170299170300170301170302170303170304170305170306170307170308170309170310170311170312170313170314170315170316170317170318170319170320170321170322170323170324170325170326170327170328170329170330170331170332170333170334170335170336170337170338170339170340170341170342170343170344170345170346170347170348170349170350170351170352170353170354170355170356170357170358170359170360170361170362170363170364170365170366170367170368170369170370170371170372170373170374170375170376170377170378170379170380170381170382170383170384170385170386170387170388170389170390170391170392170393170394170395170396170397170398170399170400170401170402170403170404170405170406170407170408170409170410170411170412170413170414170415170416170417170418170419170420170421170422170423170424170425170426170427170428170429170430170431170432170433170434170435170436170437170438170439170440170441170442170443170444170445170446170447170448170449170450170451170452170453170454170455170456170457170458170459170460170461170462170463170464170465170466170467170468170469170470170471170472170473170474170475170476170477170478170479170480170481170482170483170484170485170486170487170488170489170490170491170492170493170494170495170496170497170498170499170500170501170502170503170504170505170506170507170508170509170510170511170512170513170514170515170516170517170518170519170520170521170522170523170524170525170526170527170528170529170530170531170532170533170534170535170536170537170538170539170540170541170542170543170544170545170546170547170548170549170550170551170552170553170554170555170556170557170558170559170560170561170562170563170564170565170566170567170568170569170570170571170572170573170574170575170576170577170578170579170580170581170582170583170584170585170586170587170588170589170590170591170592170593170594170595170596170597170598170599170600170601170602170603170604170605170606170607170608170609170610170611170612170613170614170615170616170617170618170619170620170621170622170623170624170625170626170627170628170629170630170631170632170633170634170635170636170637170638170639170640170641170642170643170644170645170646170647170648170649170650170651170652170653170654170655170656170657170658170659170660170661170662170663170664170665170666170667170668170669170670170671170672170673170674170675170676170677170678170679170680170681170682170683170684170685170686170687170688170689170690170691170692170693170694170695170696170697170698170699170700170701170702170703170704170705170706170707170708170709170710170711170712170713170714170715170716170717170718170719170720170721170722170723170724170725170726170727170728170729170730170731170732170733170734170735170736170737170738170739170740170741170742170743170744170745170746170747170748170749170750170751170752170753170754170755170756170757170758170759170760170761170762170763170764170765170766170767170768170769170770170771170772170773170774170775170776170777170778170779170780170781170782170783170784170785170786170787170788170789170790170791170792170793170794170795170796170797170798170799170800170801170802170803170804170805170806170807170808170809170810170811170812170813170814170815170816170817170818170819170820170821170822170823170824170825170826170827170828170829170830170831170832170833170834170835170836170837170838170839170840170841170842170843170844170845170846170847170848170849170850170851170852170853170854170855170856170857170858170859170860170861170862170863170864170865170866170867170868170869170870170871170872170873170874170875170876170877170878170879170880170881170882170883170884170885170886170887170888170889170890170891170892170893170894170895170896170897170898170899170900170901170902170903170904170905170906170907170908170909170910170911170912170913170914170915170916170917170918170919170920170921170922170923170924170925170926170927170928170929170930170931170932170933170934170935170936170937170938170939170940170941170942170943170944170945170946170947170948170949170950170951170952170953170954170955170956170957170958170959170960170961170962170963170964170965170966170967170968170969170970170971170972170973170974170975170976170977170978170979170980170981170982170983170984170985170986170987170988170989170990170991170992170993170994170995170996170997170998170999171000171001171002171003171004171005171006171007171008171009171010171011171012171013171014171015171016171017171018171019171020171021171022171023171024171025171026171027171028171029171030171031171032171033171034171035171036171037171038171039171040171041171042171043171044171045171046171047171048171049171050171051171052171053171054171055171056171057171058171059171060171061171062171063171064171065171066171067171068171069171070171071171072171073171074171075171076171077171078171079171080171081171082171083171084171085171086171087171088171089171090171091171092171093171094171095171096171097171098171099171100171101171102171103171104171105171106171107171108171109171110171111171112171113171114171115171116171117171118171119171120171121171122171123171124171125171126171127171128171129171130171131171132171133171134171135171136171137171138171139171140171141171142171143171144171145171146171147171148171149171150171151171152171153171154171155171156171157171158171159171160171161171162171163171164171165171166171167171168171169171170171171171172171173171174171175171176171177171178171179171180171181171182171183171184171185171186171187171188171189171190171191171192171193171194171195171196171197171198171199171200171201171202171203171204171205171206171207171208171209171210171211171212171213171214171215171216171217171218171219171220171221171222171223171224171225171226171227171228171229171230171231171232171233171234171235171236171237171238171239171240171241171242171243171244171245171246171247171248171249171250171251171252171253171254171255171256171257171258171259171260171261171262171263171264171265171266171267171268171269171270171271171272171273171274171275171276171277171278171279171280171281171282171283171284171285171286171287171288171289171290171291171292171293171294171295171296171297171298171299171300171301171302171303171304171305171306171307171308171309171310171311171312171313171314171315171316171317171318171319171320171321171322171323171324171325171326171327171328171329171330171331171332171333171334171335171336171337171338171339171340171341171342171343171344171345171346171347171348171349171350171351171352171353171354171355171356171357171358171359171360171361171362171363171364171365171366171367171368171369171370171371171372171373171374171375171376171377171378171379171380171381171382171383171384171385171386171387171388171389171390171391171392171393171394171395171396171397171398171399171400171401171402171403171404171405171406171407171408171409171410171411171412171413171414171415171416171417171418171419171420171421171422171423171424171425171426171427171428171429171430171431171432171433171434171435171436171437171438171439171440171441171442171443171444171445171446171447171448171449171450171451171452171453171454171455171456171457171458171459171460171461171462171463171464171465171466171467171468171469171470171471171472171473171474171475171476171477171478171479171480171481171482171483171484171485171486171487171488171489171490171491171492171493171494171495171496171497171498171499171500171501171502171503171504171505171506171507171508171509171510171511171512171513171514171515171516171517171518171519171520171521171522171523171524171525171526171527171528171529171530171531171532171533171534171535171536171537171538171539171540171541171542171543171544171545171546171547171548171549171550171551171552171553171554171555171556171557171558171559171560171561171562171563171564171565171566171567171568171569171570171571171572171573171574171575171576171577171578171579171580171581171582171583171584171585171586171587171588171589171590171591171592171593171594171595171596171597171598171599171600171601171602171603171604171605171606171607171608171609171610171611171612171613171614171615171616171617171618171619171620171621171622171623171624171625171626171627171628171629171630171631171632171633171634171635171636171637171638171639171640171641171642171643171644171645171646171647171648171649171650171651171652171653171654171655171656171657171658171659171660171661171662171663171664171665171666171667171668171669171670171671171672171673171674171675171676171677171678171679171680171681171682171683171684171685171686171687171688171689171690171691171692171693171694171695171696171697171698171699171700171701171702171703171704171705171706171707171708171709171710171711171712171713171714171715171716171717171718171719171720171721171722171723171724171725171726171727171728171729171730171731171732171733171734171735171736171737171738171739171740171741171742171743171744171745171746171747171748171749171750171751171752171753171754171755171756171757171758171759171760171761171762171763171764171765171766171767171768171769171770171771171772171773171774171775171776171777171778171779171780171781171782171783171784171785171786171787171788171789171790171791171792171793171794171795171796171797171798171799171800171801171802171803171804171805171806171807171808171809171810171811171812171813171814171815171816171817171818171819171820171821171822171823171824171825171826171827171828171829171830171831171832171833171834171835171836171837171838171839171840171841171842171843171844171845171846171847171848171849171850171851171852171853171854171855171856171857171858171859171860171861171862171863171864171865171866171867171868171869171870171871171872171873171874171875171876171877171878171879171880171881171882171883171884171885171886171887171888171889171890171891171892171893171894171895171896171897171898171899171900171901171902171903171904171905171906171907171908171909171910171911171912171913171914171915171916171917171918171919171920171921171922171923171924171925171926171927171928171929171930171931171932171933171934171935171936171937171938171939171940171941171942171943171944171945171946171947171948171949171950171951171952171953171954171955171956171957171958171959171960171961171962171963171964171965171966171967171968171969171970171971171972171973171974171975171976171977171978171979171980171981171982171983171984171985171986171987171988171989171990171991171992171993171994171995171996171997171998171999172000172001172002172003172004172005172006172007172008172009172010172011172012172013172014172015172016172017172018172019172020172021172022172023172024172025172026172027172028172029172030172031172032172033172034172035172036172037172038172039172040172041172042172043172044172045172046172047172048172049172050172051172052172053172054172055172056172057172058172059172060172061172062172063172064172065172066172067172068172069172070172071172072172073172074172075172076172077172078172079172080172081172082172083172084172085172086172087172088172089172090172091172092172093172094172095172096172097172098172099172100172101172102172103172104172105172106172107172108172109172110172111172112172113172114172115172116172117172118172119172120172121172122172123172124172125172126172127172128172129172130172131172132172133172134172135172136172137172138172139172140172141172142172143172144172145172146172147172148172149172150172151172152172153172154172155172156172157172158172159172160172161172162172163172164172165172166172167172168172169172170172171172172172173172174172175172176172177172178172179172180172181172182172183172184172185172186172187172188172189172190172191172192172193172194172195172196172197172198172199172200172201172202172203172204172205172206172207172208172209172210172211172212172213172214172215172216172217172218172219172220172221172222172223172224172225172226172227172228172229172230172231172232172233172234172235172236172237172238172239172240172241172242172243172244172245172246172247172248172249172250172251172252172253172254172255172256172257172258172259172260172261172262172263172264172265172266172267172268172269172270172271172272172273172274172275172276172277172278172279172280172281172282172283172284172285172286172287172288172289172290172291172292172293172294172295172296172297172298172299172300172301172302172303172304172305172306172307172308172309172310172311172312172313172314172315172316172317172318172319172320172321172322172323172324172325172326172327172328172329172330172331172332172333172334172335172336172337172338172339172340172341172342172343172344172345172346172347172348172349172350172351172352172353172354172355172356172357172358172359172360172361172362172363172364172365172366172367172368172369172370172371172372172373172374172375172376172377172378172379172380172381172382172383172384172385172386172387172388172389172390172391172392172393172394172395172396172397172398172399172400172401172402172403172404172405172406172407172408172409172410172411172412172413172414172415172416172417172418172419172420172421172422172423172424172425172426172427172428172429172430172431172432172433172434172435172436172437172438172439172440172441172442172443172444172445172446172447172448172449172450172451172452172453172454172455172456172457172458172459172460172461172462172463172464172465172466172467172468172469172470172471172472172473172474172475172476172477172478172479172480172481172482172483172484172485172486172487172488172489172490172491172492172493172494172495172496172497172498172499172500172501172502172503172504172505172506172507172508172509172510172511172512172513172514172515172516172517172518172519172520172521172522172523172524172525172526172527172528172529172530172531172532172533172534172535172536172537172538172539172540172541172542172543172544172545172546172547172548172549172550172551172552172553172554172555172556172557172558172559172560172561172562172563172564172565172566172567172568172569172570172571172572172573172574172575172576172577172578172579172580172581172582172583172584172585172586172587172588172589172590172591172592172593172594172595172596172597172598172599172600172601172602172603172604172605172606172607172608172609172610172611172612172613172614172615172616172617172618172619172620172621172622172623172624172625172626172627172628172629172630172631172632172633172634172635172636172637172638172639172640172641172642172643172644172645172646172647172648172649172650172651172652172653172654172655172656172657172658172659172660172661172662172663172664172665172666172667172668172669172670172671172672172673172674172675172676172677172678172679172680172681172682172683172684172685172686172687172688172689172690172691172692172693172694172695172696172697172698172699172700172701172702172703172704172705172706172707172708172709172710172711172712172713172714172715172716172717172718172719172720172721172722172723172724172725172726172727172728172729172730172731172732172733172734172735172736172737172738172739172740172741172742172743172744172745172746172747172748172749172750172751172752172753172754172755172756172757172758172759172760172761172762172763172764172765172766172767172768172769172770172771172772172773172774172775172776172777172778172779172780172781172782172783172784172785172786172787172788172789172790172791172792172793172794172795172796172797172798172799172800172801172802172803172804172805172806172807172808172809172810172811172812172813172814172815172816172817172818172819172820172821172822172823172824172825172826172827172828172829172830172831172832172833172834172835172836172837172838172839172840172841172842172843172844172845172846172847172848172849172850172851172852172853172854172855172856172857172858172859172860172861172862172863172864172865172866172867172868172869172870172871172872172873172874172875172876172877172878172879172880172881172882172883172884172885172886172887172888172889172890172891172892172893172894172895172896172897172898172899172900172901172902172903172904172905172906172907172908172909172910172911172912172913172914172915172916172917172918172919172920172921172922172923172924172925172926172927172928172929172930172931172932172933172934172935172936172937172938172939172940172941172942172943172944172945172946172947172948172949172950172951172952172953172954172955172956172957172958172959172960172961172962172963172964172965172966172967172968172969172970172971172972172973172974172975172976172977172978172979172980172981172982172983172984172985172986172987172988172989172990172991172992172993172994172995172996172997172998172999173000173001173002173003173004173005173006173007173008173009173010173011173012173013173014173015173016173017173018173019173020173021173022173023173024173025173026173027173028173029173030173031173032173033173034173035173036173037173038173039173040173041173042173043173044173045173046173047173048173049173050173051173052173053173054173055173056173057173058173059173060173061173062173063173064173065173066173067173068173069173070173071173072173073173074173075173076173077173078173079173080173081173082173083173084173085173086173087173088173089173090173091173092173093173094173095173096173097173098173099173100173101173102173103173104173105173106173107173108173109173110173111173112173113173114173115173116173117173118173119173120173121173122173123173124173125173126173127173128173129173130173131173132173133173134173135173136173137173138173139173140173141173142173143173144173145173146173147173148173149173150173151173152173153173154173155173156173157173158173159173160173161173162173163173164173165173166173167173168173169173170173171173172173173173174173175173176173177173178173179173180173181173182173183173184173185173186173187173188173189173190173191173192173193173194173195173196173197173198173199173200173201173202173203173204173205173206173207173208173209173210173211173212173213173214173215173216173217173218173219173220173221173222173223173224173225173226173227173228173229173230173231173232173233173234173235173236173237173238173239173240173241173242173243173244173245173246173247173248173249173250173251173252173253173254173255173256173257173258173259173260173261173262173263173264173265173266173267173268173269173270173271173272173273173274173275173276173277173278173279173280173281173282173283173284173285173286173287173288173289173290173291173292173293173294173295173296173297173298173299173300173301173302173303173304173305173306173307173308173309173310173311173312173313173314173315173316173317173318173319173320173321173322173323173324173325173326173327173328173329173330173331173332173333173334173335173336173337173338173339173340173341173342173343173344173345173346173347173348173349173350173351173352173353173354173355173356173357173358173359173360173361173362173363173364173365173366173367173368173369173370173371173372173373173374173375173376173377173378173379173380173381173382173383173384173385173386173387173388173389173390173391173392173393173394173395173396173397173398173399173400173401173402173403173404173405173406173407173408173409173410173411173412173413173414173415173416173417173418173419173420173421173422173423173424173425173426173427173428173429173430173431173432173433173434173435173436173437173438173439173440173441173442173443173444173445173446173447173448173449173450173451173452173453173454173455173456173457173458173459173460173461173462173463173464173465173466173467173468173469173470173471173472173473173474173475173476173477173478173479173480173481173482173483173484173485173486173487173488173489173490173491173492173493173494173495173496173497173498173499173500173501173502173503173504173505173506173507173508173509173510173511173512173513173514173515173516173517173518173519173520173521173522173523173524173525173526173527173528173529173530173531173532173533173534173535173536173537173538173539173540173541173542173543173544173545173546173547173548173549173550173551173552173553173554173555173556173557173558173559173560173561173562173563173564173565173566173567173568173569173570173571173572173573173574173575173576173577173578173579173580173581173582173583173584173585173586173587173588173589173590173591173592173593173594173595173596173597173598173599173600173601173602173603173604173605173606173607173608173609173610173611173612173613173614173615173616173617173618173619173620173621173622173623173624173625173626173627173628173629173630173631173632173633173634173635173636173637173638173639173640173641173642173643173644173645173646173647173648173649173650173651173652173653173654173655173656173657173658173659173660173661173662173663173664173665173666173667173668173669173670173671173672173673173674173675173676173677173678173679173680173681173682173683173684173685173686173687173688173689173690173691173692173693173694173695173696173697173698173699173700173701173702173703173704173705173706173707173708173709173710173711173712173713173714173715173716173717173718173719173720173721173722173723173724173725173726173727173728173729173730173731173732173733173734173735173736173737173738173739173740173741173742173743173744173745173746173747173748173749173750173751173752173753173754173755173756173757173758173759173760173761173762173763173764173765173766173767173768173769173770173771173772173773173774173775173776173777173778173779173780173781173782173783173784173785173786173787173788173789173790173791173792173793173794173795173796173797173798173799173800173801173802173803173804173805173806173807173808173809173810173811173812173813173814173815173816173817173818173819173820173821173822173823173824173825173826173827173828173829173830173831173832173833173834173835173836173837173838173839173840173841173842173843173844173845173846173847173848173849173850173851173852173853173854173855173856173857173858173859173860173861173862173863173864173865173866173867173868173869173870173871173872173873173874173875173876173877173878173879173880173881173882173883173884173885173886173887173888173889173890173891173892173893173894173895173896173897173898173899173900173901173902173903173904173905173906173907173908173909173910173911173912173913173914173915173916173917173918173919173920173921173922173923173924173925173926173927173928173929173930173931173932173933173934173935173936173937173938173939173940173941173942173943173944173945173946173947173948173949173950173951173952173953173954173955173956173957173958173959173960173961173962173963173964173965173966173967173968173969173970173971173972173973173974173975173976173977173978173979173980173981173982173983173984173985173986173987173988173989173990173991173992173993173994173995173996173997173998173999174000174001174002174003174004174005174006174007174008174009174010174011174012174013174014174015174016174017174018174019174020174021174022174023174024174025174026174027174028174029174030174031174032174033174034174035174036174037174038174039174040174041174042174043174044174045174046174047174048174049174050174051174052174053174054174055174056174057174058174059174060174061174062174063174064174065174066174067174068174069174070174071174072174073174074174075174076174077174078174079174080174081174082174083174084174085174086174087174088174089174090174091174092174093174094174095174096174097174098174099174100174101174102174103174104174105174106174107174108174109174110174111174112174113174114174115174116174117174118174119174120174121174122174123174124174125174126174127174128174129174130174131174132174133174134174135174136174137174138174139174140174141174142174143174144174145174146174147174148174149174150174151174152174153174154174155174156174157174158174159174160174161174162174163174164174165174166174167174168174169174170174171174172174173174174174175174176174177174178174179174180174181174182174183174184174185174186174187174188174189174190174191174192174193174194174195174196174197174198174199174200174201174202174203174204174205174206174207174208174209174210174211174212174213174214174215174216174217174218174219174220174221174222174223174224174225174226174227174228174229174230174231174232174233174234174235174236174237174238174239174240174241174242174243174244174245174246174247174248174249174250174251174252174253174254174255174256174257174258174259174260174261174262174263174264174265174266174267174268174269174270174271174272174273174274174275174276174277174278174279174280174281174282174283174284174285174286174287174288174289174290174291174292174293174294174295174296174297174298174299174300174301174302174303174304174305174306174307174308174309174310174311174312174313174314174315174316174317174318174319174320174321174322174323174324174325174326174327174328174329174330174331174332174333174334174335174336174337174338174339174340174341174342174343174344174345174346174347174348174349174350174351174352174353174354174355174356174357174358174359174360174361174362174363174364174365174366174367174368174369174370174371174372174373174374174375174376174377174378174379174380174381174382174383174384174385174386174387174388174389174390174391174392174393174394174395174396174397174398174399174400174401174402174403174404174405174406174407174408174409174410174411174412174413174414174415174416174417174418174419174420174421174422174423174424174425174426174427174428174429174430174431174432174433174434174435174436174437174438174439174440174441174442174443174444174445174446174447174448174449174450174451174452174453174454174455174456174457174458174459174460174461174462174463174464174465174466174467174468174469174470174471174472174473174474174475174476174477174478174479174480174481174482174483174484174485174486174487174488174489174490174491174492174493174494174495174496174497174498174499174500174501174502174503174504174505174506174507174508174509174510174511174512174513174514174515174516174517174518174519174520174521174522174523174524174525174526174527174528174529174530174531174532174533174534174535174536174537174538174539174540174541174542174543174544174545174546174547174548174549174550174551174552174553174554174555174556174557174558174559174560174561174562174563174564174565174566174567174568174569174570174571174572174573174574174575174576174577174578174579174580174581174582174583174584174585174586174587174588174589174590174591174592174593174594174595174596174597174598174599174600174601174602174603174604174605174606174607174608174609174610174611174612174613174614174615174616174617174618174619174620174621174622174623174624174625174626174627174628174629174630174631174632174633174634174635174636174637174638174639174640174641174642174643174644174645174646174647174648174649174650174651174652174653174654174655174656174657174658174659174660174661174662174663174664174665174666174667174668174669174670174671174672174673174674174675174676174677174678174679174680174681174682174683174684174685174686174687174688174689174690174691174692174693174694174695174696174697174698174699174700174701174702174703174704174705174706174707174708174709174710174711174712174713174714174715174716174717174718174719174720174721174722174723174724174725174726174727174728174729174730174731174732174733174734174735174736174737174738174739174740174741174742174743174744174745174746174747174748174749174750174751174752174753174754174755174756174757174758174759174760174761174762174763174764174765174766174767174768174769174770174771174772174773174774174775174776174777174778174779174780174781174782174783174784174785174786174787174788174789174790174791174792174793174794174795174796174797174798174799174800174801174802174803174804174805174806174807174808174809174810174811174812174813174814174815174816174817174818174819174820174821174822174823174824174825174826174827174828174829174830174831174832174833174834174835174836174837174838174839174840174841174842174843174844174845174846174847174848174849174850174851174852174853174854174855174856174857174858174859174860174861174862174863174864174865174866174867174868174869174870174871174872174873174874174875174876174877174878174879174880174881174882174883174884174885174886174887174888174889174890174891174892174893174894174895174896174897174898174899174900174901174902174903174904174905174906174907174908174909174910174911174912174913174914174915174916174917174918174919174920174921174922174923174924174925174926174927174928174929174930174931174932174933174934174935174936174937174938174939174940174941174942174943174944174945174946174947174948174949174950174951174952174953174954174955174956174957174958174959174960174961174962174963174964174965174966174967174968174969174970174971174972174973174974174975174976174977174978174979174980174981174982174983174984174985174986174987174988174989174990174991174992174993174994174995174996174997174998174999175000175001175002175003175004175005175006175007175008175009175010175011175012175013175014175015175016175017175018175019175020175021175022175023175024175025175026175027175028175029175030175031175032175033175034175035175036175037175038175039175040175041175042175043175044175045175046175047175048175049175050175051175052175053175054175055175056175057175058175059175060175061175062175063175064175065175066175067175068175069175070175071175072175073175074175075175076175077175078175079175080175081175082175083175084175085175086175087175088175089175090175091175092175093175094175095175096175097175098175099175100175101175102175103175104175105175106175107175108175109175110175111175112175113175114175115175116175117175118175119175120175121175122175123175124175125175126175127175128175129175130175131175132175133175134175135175136175137175138175139175140175141175142175143175144175145175146175147175148175149175150175151175152175153175154175155175156175157175158175159175160175161175162175163175164175165175166175167175168175169175170175171175172175173175174175175175176175177175178175179175180175181175182175183175184175185175186175187175188175189175190175191175192175193175194175195175196175197175198175199175200175201175202175203175204175205175206175207175208175209175210175211175212175213175214175215175216175217175218175219175220175221175222175223175224175225175226175227175228175229175230175231175232175233175234175235175236175237175238175239175240175241175242175243175244175245175246175247175248175249175250175251175252175253175254175255175256175257175258175259175260175261175262175263175264175265175266175267175268175269175270175271175272175273175274175275175276175277175278175279175280175281175282175283175284175285175286175287175288175289175290175291175292175293175294175295175296175297175298175299175300175301175302175303175304175305175306175307175308175309175310175311175312175313175314175315175316175317175318175319175320175321175322175323175324175325175326175327175328175329175330175331175332175333175334175335175336175337175338175339175340175341175342175343175344175345175346175347175348175349175350175351175352175353175354175355175356175357175358175359175360175361175362175363175364175365175366175367175368175369175370175371175372175373175374175375175376175377175378175379175380175381175382175383175384175385175386175387175388175389175390175391175392175393175394175395175396175397175398175399175400175401175402175403175404175405175406175407175408175409175410175411175412175413175414175415175416175417175418175419175420175421175422175423175424175425175426175427175428175429175430175431175432175433175434175435175436175437175438175439175440175441175442175443175444175445175446175447175448175449175450175451175452175453175454175455175456175457175458175459175460175461175462175463175464175465175466175467175468175469175470175471175472175473175474175475175476175477175478175479175480175481175482175483175484175485175486175487175488175489175490175491175492175493175494175495175496175497175498175499175500175501175502175503175504175505175506175507175508175509175510175511175512175513175514175515175516175517175518175519175520175521175522175523175524175525175526175527175528175529175530175531175532175533175534175535175536175537175538175539175540175541175542175543175544175545175546175547175548175549175550175551175552175553175554175555175556175557175558175559175560175561175562175563175564175565175566175567175568175569175570175571175572175573175574175575175576175577175578175579175580175581175582175583175584175585175586175587175588175589175590175591175592175593175594175595175596175597175598175599175600175601175602175603175604175605175606175607175608175609175610175611175612175613175614175615175616175617175618175619175620175621175622175623175624175625175626175627175628175629175630175631175632175633175634175635175636175637175638175639175640175641175642175643175644175645175646175647175648175649175650175651175652175653175654175655175656175657175658175659175660175661175662175663175664175665175666175667175668175669175670175671175672175673175674175675175676175677175678175679175680175681175682175683175684175685175686175687175688175689175690175691175692175693175694175695175696175697175698175699175700175701175702175703175704175705175706175707175708175709175710175711175712175713175714175715175716175717175718175719175720175721175722175723175724175725175726175727175728175729175730175731175732175733175734175735175736175737175738175739175740175741175742175743175744175745175746175747175748175749175750175751175752175753175754175755175756175757175758175759175760175761175762175763175764175765175766175767175768175769175770175771175772175773175774175775175776175777175778175779175780175781175782175783175784175785175786175787175788175789175790175791175792175793175794175795175796175797175798175799175800175801175802175803175804175805175806175807175808175809175810175811175812175813175814175815175816175817175818175819175820175821175822175823175824175825175826175827175828175829175830175831175832175833175834175835175836175837175838175839175840175841175842175843175844175845175846175847175848175849175850175851175852175853175854175855175856175857175858175859175860175861175862175863175864175865175866175867175868175869175870175871175872175873175874175875175876175877175878175879175880175881175882175883175884175885175886175887175888175889175890175891175892175893175894175895175896175897175898175899175900175901175902175903175904175905175906175907175908175909175910175911175912175913175914175915175916175917175918175919175920175921175922175923175924175925175926175927175928175929175930175931175932175933175934175935175936175937175938175939175940175941175942175943175944175945175946175947175948175949175950175951175952175953175954175955175956175957175958175959175960175961175962175963175964175965175966175967175968175969175970175971175972175973175974175975175976175977175978175979175980175981175982175983175984175985175986175987175988175989175990175991175992175993175994175995175996175997175998175999176000176001176002176003176004176005176006176007176008176009176010176011176012176013176014176015176016176017176018176019176020176021176022176023176024176025176026176027176028176029176030176031176032176033176034176035176036176037176038176039176040176041176042176043176044176045176046176047176048176049176050176051176052176053176054176055176056176057176058176059176060176061176062176063176064176065176066176067176068176069176070176071176072176073176074176075176076176077176078176079176080176081176082176083176084176085176086176087176088176089176090176091176092176093176094176095176096176097176098176099176100176101176102176103176104176105176106176107176108176109176110176111176112176113176114176115176116176117176118176119176120176121176122176123176124176125176126176127176128176129176130176131176132176133176134176135176136176137176138176139176140176141176142176143176144176145176146176147176148176149176150176151176152176153176154176155176156176157176158176159176160176161176162176163176164176165176166176167176168176169176170176171176172176173176174176175176176176177176178176179176180176181176182176183176184176185176186176187176188176189176190176191176192176193176194176195176196176197176198176199176200176201176202176203176204176205176206176207176208176209176210176211176212176213176214176215176216176217176218176219176220176221176222176223176224176225176226176227176228176229176230176231176232176233176234176235176236176237176238176239176240176241176242176243176244176245176246176247176248176249176250176251176252176253176254176255176256176257176258176259176260176261176262176263176264176265176266176267176268176269176270176271176272176273176274176275176276176277176278176279176280176281176282176283176284176285176286176287176288176289176290176291176292176293176294176295176296176297176298176299176300176301176302176303176304176305176306176307176308176309176310176311176312176313176314176315176316176317176318176319176320176321176322176323176324176325176326176327176328176329176330176331176332176333176334176335176336176337176338176339176340176341176342176343176344176345176346176347176348176349176350176351176352176353176354176355176356176357176358176359176360176361176362176363176364176365176366176367176368176369176370176371176372176373176374176375176376176377176378176379176380176381176382176383176384176385176386176387176388176389176390176391176392176393176394176395176396176397176398176399176400176401176402176403176404176405176406176407176408176409176410176411176412176413176414176415176416176417176418176419176420176421176422176423176424176425176426176427176428176429176430176431176432176433176434176435176436176437176438176439176440176441176442176443176444176445176446176447176448176449176450176451176452176453176454176455176456176457176458176459176460176461176462176463176464176465176466176467176468176469176470176471176472176473176474176475176476176477176478176479176480176481176482176483176484176485176486176487176488176489176490176491176492176493176494176495176496176497176498176499176500176501176502176503176504176505176506176507176508176509176510176511176512176513176514176515176516176517176518176519176520176521176522176523176524176525176526176527176528176529176530176531176532176533176534176535176536176537176538176539176540176541176542176543176544176545176546176547176548176549176550176551176552176553176554176555176556176557176558176559176560176561176562176563176564176565176566176567176568176569176570176571176572176573176574176575176576176577176578176579176580176581176582176583176584176585176586176587176588176589176590176591176592176593176594176595176596176597176598176599176600176601176602176603176604176605176606176607176608176609176610176611176612176613176614176615176616176617176618176619176620176621176622176623176624176625176626176627176628176629176630176631176632176633176634176635176636176637176638176639176640176641176642176643176644176645176646176647176648176649176650176651176652176653176654176655176656176657176658176659176660176661176662176663176664176665176666176667176668176669176670176671176672176673176674176675176676176677176678176679176680176681176682176683176684176685176686176687176688176689176690176691176692176693176694176695176696176697176698176699176700176701176702176703176704176705176706176707176708176709176710176711176712176713176714176715176716176717176718176719176720176721176722176723176724176725176726176727176728176729176730176731176732176733176734176735176736176737176738176739176740176741176742176743176744176745176746176747176748176749176750176751176752176753176754176755176756176757176758176759176760176761176762176763176764176765176766176767176768176769176770176771176772176773176774176775176776176777176778176779176780176781176782176783176784176785176786176787176788176789176790176791176792176793176794176795176796176797176798176799176800176801176802176803176804176805176806176807176808176809176810176811176812176813176814176815176816176817176818176819176820176821176822176823176824176825176826176827176828176829176830176831176832176833176834176835176836176837176838176839176840176841176842176843176844176845176846176847176848176849176850176851176852176853176854176855176856176857176858176859176860176861176862176863176864176865176866176867176868176869176870176871176872176873176874176875176876176877176878176879176880176881176882176883176884176885176886176887176888176889176890176891176892176893176894176895176896176897176898176899176900176901176902176903176904176905176906176907176908176909176910176911176912176913176914176915176916176917176918176919176920176921176922176923176924176925176926176927176928176929176930176931176932176933176934176935176936176937176938176939176940176941176942176943176944176945176946176947176948176949176950176951176952176953176954176955176956176957176958176959176960176961176962176963176964176965176966176967176968176969176970176971176972176973176974176975176976176977176978176979176980176981176982176983176984176985176986176987176988176989176990176991176992176993176994176995176996176997176998176999177000177001177002177003177004177005177006177007177008177009177010177011177012177013177014177015177016177017177018177019177020177021177022177023177024177025177026177027177028177029177030177031177032177033177034177035177036177037177038177039177040177041177042177043177044177045177046177047177048177049177050177051177052177053177054177055177056177057177058177059177060177061177062177063177064177065177066177067177068177069177070177071177072177073177074177075177076177077177078177079177080177081177082177083177084177085177086177087177088177089177090177091177092177093177094177095177096177097177098177099177100177101177102177103177104177105177106177107177108177109177110177111177112177113177114177115177116177117177118177119177120177121177122177123177124177125177126177127177128177129177130177131177132177133177134177135177136177137177138177139177140177141177142177143177144177145177146177147177148177149177150177151177152177153177154177155177156177157177158177159177160177161177162177163177164177165177166177167177168177169177170177171177172177173177174177175177176177177177178177179177180177181177182177183177184177185177186177187177188177189177190177191177192177193177194177195177196177197177198177199177200177201177202177203177204177205177206177207177208177209177210177211177212177213177214177215177216177217177218177219177220177221177222177223177224177225177226177227177228177229177230177231177232177233177234177235177236177237177238177239177240177241177242177243177244177245177246177247177248177249177250177251177252177253177254177255177256177257177258177259177260177261177262177263177264177265177266177267177268177269177270177271177272177273177274177275177276177277177278177279177280177281177282177283177284177285177286177287177288177289177290177291177292177293177294177295177296177297177298177299177300177301177302177303177304177305177306177307177308177309177310177311177312177313177314177315177316177317177318177319177320177321177322177323177324177325177326177327177328177329177330177331177332177333177334177335177336177337177338177339177340177341177342177343177344177345177346177347177348177349177350177351177352177353177354177355177356177357177358177359177360177361177362177363177364177365177366177367177368177369177370177371177372177373177374177375177376177377177378177379177380177381177382177383177384177385177386177387177388177389177390177391177392177393177394177395177396177397177398177399177400177401177402177403177404177405177406177407177408177409177410177411177412177413177414177415177416177417177418177419177420177421177422177423177424177425177426177427177428177429177430177431177432177433177434177435177436177437177438177439177440177441177442177443177444177445177446177447177448177449177450177451177452177453177454177455177456177457177458177459177460177461177462177463177464177465177466177467177468177469177470177471177472177473177474177475177476177477177478177479177480177481177482177483177484177485177486177487177488177489177490177491177492177493177494177495177496177497177498177499177500177501177502177503177504177505177506177507177508177509177510177511177512177513177514177515177516177517177518177519177520177521177522177523177524177525177526177527177528177529177530177531177532177533177534177535177536177537177538177539177540177541177542177543177544177545177546177547177548177549177550177551177552177553177554177555177556177557177558177559177560177561177562177563177564177565177566177567177568177569177570177571177572177573177574177575177576177577177578177579177580177581177582177583177584177585177586177587177588177589177590177591177592177593177594177595177596177597177598177599177600177601177602177603177604177605177606177607177608177609177610177611177612177613177614177615177616177617177618177619177620177621177622177623177624177625177626177627177628177629177630177631177632177633177634177635177636177637177638177639177640177641177642177643177644177645177646177647177648177649177650177651177652177653177654177655177656177657177658177659177660177661177662177663177664177665177666177667177668177669177670177671177672177673177674177675177676177677177678177679177680177681177682177683177684177685177686177687177688177689177690177691177692177693177694177695177696177697177698177699177700177701177702177703177704177705177706177707177708177709177710177711177712177713177714177715177716177717177718177719177720177721177722177723177724177725177726177727177728177729177730177731177732177733177734177735177736177737177738177739177740177741177742177743177744177745177746177747177748177749177750177751177752177753177754177755177756177757177758177759177760177761177762177763177764177765177766177767177768177769177770177771177772177773177774177775177776177777177778177779177780177781177782177783177784177785177786177787177788177789177790177791177792177793177794177795177796177797177798177799177800177801177802177803177804177805177806177807177808177809177810177811177812177813177814177815177816177817177818177819177820177821177822177823177824177825177826177827177828177829177830177831177832177833177834177835177836177837177838177839177840177841177842177843177844177845177846177847177848177849177850177851177852177853177854177855177856177857177858177859177860177861177862177863177864177865177866177867177868177869177870177871177872177873177874177875177876177877177878177879177880177881177882177883177884177885177886177887177888177889177890177891177892177893177894177895177896177897177898177899177900177901177902177903177904177905177906177907177908177909177910177911177912177913177914177915177916177917177918177919177920177921177922177923177924177925177926177927177928177929177930177931177932177933177934177935177936177937177938177939177940177941177942177943177944177945177946177947177948177949177950177951177952177953177954177955177956177957177958177959177960177961177962177963177964177965177966177967177968177969177970177971177972177973177974177975177976177977177978177979177980177981177982177983177984177985177986177987177988177989177990177991177992177993177994177995177996177997177998177999178000178001178002178003178004178005178006178007178008178009178010178011178012178013178014178015178016178017178018178019178020178021178022178023178024178025178026178027178028178029178030178031178032178033178034178035178036178037178038178039178040178041178042178043178044178045178046178047178048178049178050178051178052178053178054178055178056178057178058178059178060178061178062178063178064178065178066178067178068178069178070178071178072178073178074178075178076178077178078178079178080178081178082178083178084178085178086178087178088178089178090178091178092178093178094178095178096178097178098178099178100178101178102178103178104178105178106178107178108178109178110178111178112178113178114178115178116178117178118178119178120178121178122178123178124178125178126178127178128178129178130178131178132178133178134178135178136178137178138178139178140178141178142178143178144178145178146178147178148178149178150178151178152178153178154178155178156178157178158178159178160178161178162178163178164178165178166178167178168178169178170178171178172178173178174178175178176178177178178178179178180178181178182178183178184178185178186178187178188178189178190178191178192178193178194178195178196178197178198178199178200178201178202178203178204178205178206178207178208178209178210178211178212178213178214178215178216178217178218178219178220178221178222178223178224178225178226178227178228178229178230178231178232178233178234178235178236178237178238178239178240178241178242178243178244178245178246178247178248178249178250178251178252178253178254178255178256178257178258178259178260178261178262178263178264178265178266178267178268178269178270178271178272178273178274178275178276178277178278178279178280178281178282178283178284178285178286178287178288178289178290178291178292178293178294178295178296178297178298178299178300178301178302178303178304178305178306178307178308178309178310178311178312178313178314178315178316178317178318178319178320178321178322178323178324178325178326178327178328178329178330178331178332178333178334178335178336178337178338178339178340178341178342178343178344178345178346178347178348178349178350178351178352178353178354178355178356178357178358178359178360178361178362178363178364178365178366178367178368178369178370178371178372178373178374178375178376178377178378178379178380178381178382178383178384178385178386178387178388178389178390178391178392178393178394178395178396178397178398178399178400178401178402178403178404178405178406178407178408178409178410178411178412178413178414178415178416178417178418178419178420178421178422178423178424178425178426178427178428178429178430178431178432178433178434178435178436178437178438178439178440178441178442178443178444178445178446178447178448178449178450178451178452178453178454178455178456178457178458178459178460178461178462178463178464178465178466178467178468178469178470178471178472178473178474178475178476178477178478178479178480178481178482178483178484178485178486178487178488178489178490178491178492178493178494178495178496178497178498178499178500178501178502178503178504178505178506178507178508178509178510178511178512178513178514178515178516178517178518178519178520178521178522178523178524178525178526178527178528178529178530178531178532178533178534178535178536178537178538178539178540178541178542178543178544178545178546178547178548178549178550178551178552178553178554178555178556178557178558178559178560178561178562178563178564178565178566178567178568178569178570178571178572178573178574178575178576178577178578178579178580178581178582178583178584178585178586178587178588178589178590178591178592178593178594178595178596178597178598178599178600178601178602178603178604178605178606178607178608178609178610178611178612178613178614178615178616178617178618178619178620178621178622178623178624178625178626178627178628178629178630178631178632178633178634178635178636178637178638178639178640178641178642178643178644178645178646178647178648178649178650178651178652178653178654178655178656178657178658178659178660178661178662178663178664178665178666178667178668178669178670178671178672178673178674178675178676178677178678178679178680178681178682178683178684178685178686178687178688178689178690178691178692178693178694178695178696178697178698178699178700178701178702178703178704178705178706178707178708178709178710178711178712178713178714178715178716178717178718178719178720178721178722178723178724178725178726178727178728178729178730178731178732178733178734178735178736178737178738178739178740178741178742178743178744178745178746178747178748178749178750178751178752178753178754178755178756178757178758178759178760178761178762178763178764178765178766178767178768178769178770178771178772178773178774178775178776178777178778178779178780178781178782178783178784178785178786178787178788178789178790178791178792178793178794178795178796178797178798178799178800178801178802178803178804178805178806178807178808178809178810178811178812178813178814178815178816178817178818178819178820178821178822178823178824178825178826178827178828178829178830178831178832178833178834178835178836178837178838178839178840178841178842178843178844178845178846178847178848178849178850178851178852178853178854178855178856178857178858178859178860178861178862178863178864178865178866178867178868178869178870178871178872178873178874178875178876178877178878178879178880178881178882178883178884178885178886178887178888178889178890178891178892178893178894178895178896178897178898178899178900178901178902178903178904178905178906178907178908178909178910178911178912178913178914178915178916178917178918178919178920178921178922178923178924178925178926178927178928178929178930178931178932178933178934178935178936178937178938178939178940178941178942178943178944178945178946178947178948178949178950178951178952178953178954178955178956178957178958178959178960178961178962178963178964178965178966178967178968178969178970178971178972178973178974178975178976178977178978178979178980178981178982178983178984178985178986178987178988178989178990178991178992178993178994178995178996178997178998178999179000179001179002179003179004179005179006179007179008179009179010179011179012179013179014179015179016179017179018179019179020179021179022179023179024179025179026179027179028179029179030179031179032179033179034179035179036179037179038179039179040179041179042179043179044179045179046179047179048179049179050179051179052179053179054179055179056179057179058179059179060179061179062179063179064179065179066179067179068179069179070179071179072179073179074179075179076179077179078179079179080179081179082179083179084179085179086179087179088179089179090179091179092179093179094179095179096179097179098179099179100179101179102179103179104179105179106179107179108179109179110179111179112179113179114179115179116179117179118179119179120179121179122179123179124179125179126179127179128179129179130179131179132179133179134179135179136179137179138179139179140179141179142179143179144179145179146179147179148179149179150179151179152179153179154179155179156179157179158179159179160179161179162179163179164179165179166179167179168179169179170179171179172179173179174179175179176179177179178179179179180179181179182179183179184179185179186179187179188179189179190179191179192179193179194179195179196179197179198179199179200179201179202179203179204179205179206179207179208179209179210179211179212179213179214179215179216179217179218179219179220179221179222179223179224179225179226179227179228179229179230179231179232179233179234179235179236179237179238179239179240179241179242179243179244179245179246179247179248179249179250179251179252179253179254179255179256179257179258179259179260179261179262179263179264179265179266179267179268179269179270179271179272179273179274179275179276179277179278179279179280179281179282179283179284179285179286179287179288179289179290179291179292179293179294179295179296179297179298179299179300179301179302179303179304179305179306179307179308179309179310179311179312179313179314179315179316179317179318179319179320179321179322179323179324179325179326179327179328179329179330179331179332179333179334179335179336179337179338179339179340179341179342179343179344179345179346179347179348179349179350179351179352179353179354179355179356179357179358179359179360179361179362179363179364179365179366179367179368179369179370179371179372179373179374179375179376179377179378179379179380179381179382179383179384179385179386179387179388179389179390179391179392179393179394179395179396179397179398179399179400179401179402179403179404179405179406179407179408179409179410179411179412179413179414179415179416179417179418179419179420179421179422179423179424179425179426179427179428179429179430179431179432179433179434179435179436179437179438179439179440179441179442179443179444179445179446179447179448179449179450179451179452179453179454179455179456179457179458179459179460179461179462179463179464179465179466179467179468179469179470179471179472179473179474179475179476179477179478179479179480179481179482179483179484179485179486179487179488179489179490179491179492179493179494179495179496179497179498179499179500179501179502179503179504179505179506179507179508179509179510179511179512179513179514179515179516179517179518179519179520179521179522179523179524179525179526179527179528179529179530179531179532179533179534179535179536179537179538179539179540179541179542179543179544179545179546179547179548179549179550179551179552179553179554179555179556179557179558179559179560179561179562179563179564179565179566179567179568179569179570179571179572179573179574179575179576179577179578179579179580179581179582179583179584179585179586179587179588179589179590179591179592179593179594179595179596179597179598179599179600179601179602179603179604179605179606179607179608179609179610179611179612179613179614179615179616179617179618179619179620179621179622179623179624179625179626179627179628179629179630179631179632179633179634179635179636179637179638179639179640179641179642179643179644179645179646179647179648179649179650179651179652179653179654179655179656179657179658179659179660179661179662179663179664179665179666179667179668179669179670179671179672179673179674179675179676179677179678179679179680179681179682179683179684179685179686179687179688179689179690179691179692179693179694179695179696179697179698179699179700179701179702179703179704179705179706179707179708179709179710179711179712179713179714179715179716179717179718179719179720179721179722179723179724179725179726179727179728179729179730179731179732179733179734179735179736179737179738179739179740179741179742179743179744179745179746179747179748179749179750179751179752179753179754179755179756179757179758179759179760179761179762179763179764179765179766179767179768179769179770179771179772179773179774179775179776179777179778179779179780179781179782179783179784179785179786179787179788179789179790179791179792179793179794179795179796179797179798179799179800179801179802179803179804179805179806179807179808179809179810179811179812179813179814179815179816179817179818179819179820179821179822179823179824179825179826179827179828179829179830179831179832179833179834179835179836179837179838179839179840179841179842179843179844179845179846179847179848179849179850179851179852179853179854179855179856179857179858179859179860179861179862179863179864179865179866179867179868179869179870179871179872179873179874179875179876179877179878179879179880179881179882179883179884179885179886179887179888179889179890179891179892179893179894179895179896179897179898179899179900179901179902179903179904179905179906179907179908179909179910179911179912179913179914179915179916179917179918179919179920179921179922179923179924179925179926179927179928179929179930179931179932179933179934179935179936179937179938179939179940179941179942179943179944179945179946179947179948179949179950179951179952179953179954179955179956179957179958179959179960179961179962179963179964179965179966179967179968179969179970179971179972179973179974179975179976179977179978179979179980179981179982179983179984179985179986179987179988179989179990179991179992179993179994179995179996179997179998179999180000180001180002180003180004180005180006180007180008180009180010180011180012180013180014180015180016180017180018180019180020180021180022180023180024180025180026180027180028180029180030180031180032180033180034180035180036180037180038180039180040180041180042180043180044180045180046180047180048180049180050180051180052180053180054180055180056180057180058180059180060180061180062180063180064180065180066180067180068180069180070180071180072180073180074180075180076180077180078180079180080180081180082180083180084180085180086180087180088180089180090180091180092180093180094180095180096180097180098180099180100180101180102180103180104180105180106180107180108180109180110180111180112180113180114180115180116180117180118180119180120180121180122180123180124180125180126180127180128180129180130180131180132180133180134180135180136180137180138180139180140180141180142180143180144180145180146180147180148180149180150180151180152180153180154180155180156180157180158180159180160180161180162180163180164180165180166180167180168180169180170180171180172180173180174180175180176180177180178180179180180180181180182180183180184180185180186180187180188180189180190180191180192180193180194180195180196180197180198180199180200180201180202180203180204180205180206180207180208180209180210180211180212180213180214180215180216180217180218180219180220180221180222180223180224180225180226180227180228180229180230180231180232180233180234180235180236180237180238180239180240180241180242180243180244180245180246180247180248180249180250180251180252180253180254180255180256180257180258180259180260180261180262180263180264180265180266180267180268180269180270180271180272180273180274180275180276180277180278180279180280180281180282180283180284180285180286180287180288180289180290180291180292180293180294180295180296180297180298180299180300180301180302180303180304180305180306180307180308180309180310180311180312180313180314180315180316180317180318180319180320180321180322180323180324180325180326180327180328180329180330180331180332180333180334180335180336180337180338180339180340180341180342180343180344180345180346180347180348180349180350180351180352180353180354180355180356180357180358180359180360180361180362180363180364180365180366180367180368180369180370180371180372180373180374180375180376180377180378180379180380180381180382180383180384180385180386180387180388180389180390180391180392180393180394180395180396180397180398180399180400180401180402180403180404180405180406180407180408180409180410180411180412180413180414180415180416180417180418180419180420180421180422180423180424180425180426180427180428180429180430180431180432180433180434180435180436180437180438180439180440180441180442180443180444180445180446180447180448180449180450180451180452180453180454180455180456180457180458180459180460180461180462180463180464180465180466180467180468180469180470180471180472180473180474180475180476180477180478180479180480180481180482180483180484180485180486180487180488180489180490180491180492180493180494180495180496180497180498180499180500180501180502180503180504180505180506180507180508180509180510180511180512180513180514180515180516180517180518180519180520180521180522180523180524180525180526180527180528180529180530180531180532180533180534180535180536180537180538180539180540180541180542180543180544180545180546180547180548180549180550180551180552180553180554180555180556180557180558180559180560180561180562180563180564180565180566180567180568180569180570180571180572180573180574180575180576180577180578180579180580180581180582180583180584180585180586180587180588180589180590180591180592180593180594180595180596180597180598180599180600180601180602180603180604180605180606180607180608180609180610180611180612180613180614180615180616180617180618180619180620180621180622180623180624180625180626180627180628180629180630180631180632180633180634180635180636180637180638180639180640180641180642180643180644180645180646180647180648180649180650180651180652180653180654180655180656180657180658180659180660180661180662180663180664180665180666180667180668180669180670180671180672180673180674180675180676180677180678180679180680180681180682180683180684180685180686180687180688180689180690180691180692180693180694180695180696180697180698180699180700180701180702180703180704180705180706180707180708180709180710180711180712180713180714180715180716180717180718180719180720180721180722180723180724180725180726180727180728180729180730180731180732180733180734180735180736180737180738180739180740180741180742180743180744180745180746180747180748180749180750180751180752180753180754180755180756180757180758180759180760180761180762180763180764180765180766180767180768180769180770180771180772180773180774180775180776180777180778180779180780180781180782180783180784180785180786180787180788180789180790180791180792180793180794180795180796180797180798180799180800180801180802180803180804180805180806180807180808180809180810180811180812180813180814180815180816180817180818180819180820180821180822180823180824180825180826180827180828180829180830180831180832180833180834180835180836180837180838180839180840180841180842180843180844180845180846180847180848180849180850180851180852180853180854180855180856180857180858180859180860180861180862180863180864180865180866180867180868180869180870180871180872180873180874180875180876180877180878180879180880180881180882180883180884180885180886180887180888180889180890180891180892180893180894180895180896180897180898180899180900180901180902180903180904180905180906180907180908180909180910180911180912180913180914180915180916180917180918180919180920180921180922180923180924180925180926180927180928180929180930180931180932180933180934180935180936180937180938180939180940180941180942180943180944180945180946180947180948180949180950180951180952180953180954180955180956180957180958180959180960180961180962180963180964180965180966180967180968180969180970180971180972180973180974180975180976180977180978180979180980180981180982180983180984180985180986180987180988180989180990180991180992180993180994180995180996180997180998180999181000181001181002181003181004181005181006181007181008181009181010181011181012181013181014181015181016181017181018181019181020181021181022181023181024181025181026181027181028181029181030181031181032181033181034181035181036181037181038181039181040181041181042181043181044181045181046181047181048181049181050181051181052181053181054181055181056181057181058181059181060181061181062181063181064181065181066181067181068181069181070181071181072181073181074181075181076181077181078181079181080181081181082181083181084181085181086181087181088181089181090181091181092181093181094181095181096181097181098181099181100181101181102181103181104181105181106181107181108181109181110181111181112181113181114181115181116181117181118181119181120181121181122181123181124181125181126181127181128181129181130181131181132181133181134181135181136181137181138181139181140181141181142181143181144181145181146181147181148181149181150181151181152181153181154181155181156181157181158181159181160181161181162181163181164181165181166181167181168181169181170181171181172181173181174181175181176181177181178181179181180181181181182181183181184181185181186181187181188181189181190181191181192181193181194181195181196181197181198181199181200181201181202181203181204181205181206181207181208181209181210181211181212181213181214181215181216181217181218181219181220181221181222181223181224181225181226181227181228181229181230181231181232181233181234181235181236181237181238181239181240181241181242181243181244181245181246181247181248181249181250181251181252181253181254181255181256181257181258181259181260181261181262181263181264181265181266181267181268181269181270181271181272181273181274181275181276181277181278181279181280181281181282181283181284181285181286181287181288181289181290181291181292181293181294181295181296181297181298181299181300181301181302181303181304181305181306181307181308181309181310181311181312181313181314181315181316181317181318181319181320181321181322181323181324181325181326181327181328181329181330181331181332181333181334181335181336181337181338181339181340181341181342181343181344181345181346181347181348181349181350181351181352181353181354181355181356181357181358181359181360181361181362181363181364181365181366181367181368181369181370181371181372181373181374181375181376181377181378181379181380181381181382181383181384181385181386181387181388181389181390181391181392181393181394181395181396181397181398181399181400181401181402181403181404181405181406181407181408181409181410181411181412181413181414181415181416181417181418181419181420181421181422181423181424181425181426181427181428181429181430181431181432181433181434181435181436181437181438181439181440181441181442181443181444181445181446181447181448181449181450181451181452181453181454181455181456181457181458181459181460181461181462181463181464181465181466181467181468181469181470181471181472181473181474181475181476181477181478181479181480181481181482181483181484181485181486181487181488181489181490181491181492181493181494181495181496181497181498181499181500181501181502181503181504181505181506181507181508181509181510181511181512181513181514181515181516181517181518181519181520181521181522181523181524181525181526181527181528181529181530181531181532181533181534181535181536181537181538181539181540181541181542181543181544181545181546181547181548181549181550181551181552181553181554181555181556181557181558181559181560181561181562181563181564181565181566181567181568181569181570181571181572181573181574181575181576181577181578181579181580181581181582181583181584181585181586181587181588181589181590181591181592181593181594181595181596181597181598181599181600181601181602181603181604181605181606181607181608181609181610181611181612181613181614181615181616181617181618181619181620181621181622181623181624181625181626181627181628181629181630181631181632181633181634181635181636181637181638181639181640181641181642181643181644181645181646181647181648181649181650181651181652181653181654181655181656181657181658181659181660181661181662181663181664181665181666181667181668181669181670181671181672181673181674181675181676181677181678181679181680181681181682181683181684181685181686181687181688181689181690181691181692181693181694181695181696181697181698181699181700181701181702181703181704181705181706181707181708181709181710181711181712181713181714181715181716181717181718181719181720181721181722181723181724181725181726181727181728181729181730181731181732181733181734181735181736181737181738181739181740181741181742181743181744181745181746181747181748181749181750181751181752181753181754181755181756181757181758181759181760181761181762181763181764181765181766181767181768181769181770181771181772181773181774181775181776181777181778181779181780181781181782181783181784181785181786181787181788181789181790181791181792181793181794181795181796181797181798181799181800181801181802181803181804181805181806181807181808181809181810181811181812181813181814181815181816181817181818181819181820181821181822181823181824181825181826181827181828181829181830181831181832181833181834181835181836181837181838181839181840181841181842181843181844181845181846181847181848181849181850181851181852181853181854181855181856181857181858181859181860181861181862181863181864181865181866181867181868181869181870181871181872181873181874181875181876181877181878181879181880181881181882181883181884181885181886181887181888181889181890181891181892181893181894181895181896181897181898181899181900181901181902181903181904181905181906181907181908181909181910181911181912181913181914181915181916181917181918181919181920181921181922181923181924181925181926181927181928181929181930181931181932181933181934181935181936181937181938181939181940181941181942181943181944181945181946181947181948181949181950181951181952181953181954181955181956181957181958181959181960181961181962181963181964181965181966181967181968181969181970181971181972181973181974181975181976181977181978181979181980181981181982181983181984181985181986181987181988181989181990181991181992181993181994181995181996181997181998181999182000182001182002182003182004182005182006182007182008182009182010182011182012182013182014182015182016182017182018182019182020182021182022182023182024182025182026182027182028182029182030182031182032182033182034182035182036182037182038182039182040182041182042182043182044182045182046182047182048182049182050182051182052182053182054182055182056182057182058182059182060182061182062182063182064182065182066182067182068182069182070182071182072182073182074182075182076182077182078182079182080182081182082182083182084182085182086182087182088182089182090182091182092182093182094182095182096182097182098182099182100182101182102182103182104182105182106182107182108182109182110182111182112182113182114182115182116182117182118182119182120182121182122182123182124182125182126182127182128182129182130182131182132182133182134182135182136182137182138182139182140182141182142182143182144182145182146182147182148182149182150182151182152182153182154182155182156182157182158182159182160182161182162182163182164182165182166182167182168182169182170182171182172182173182174182175182176182177182178182179182180182181182182182183182184182185182186182187182188182189182190182191182192182193182194182195182196182197182198182199182200182201182202182203182204182205182206182207182208182209182210182211182212182213182214182215182216182217182218182219182220182221182222182223182224182225182226182227182228182229182230182231182232182233182234182235182236182237182238182239182240182241182242182243182244182245182246182247182248182249182250182251182252182253182254182255182256182257182258182259182260182261182262182263182264182265182266182267182268182269182270182271182272182273182274182275182276182277182278182279182280182281182282182283182284182285182286182287182288182289182290182291182292182293182294182295182296182297182298182299182300182301182302182303182304182305182306182307182308182309182310182311182312182313182314182315182316182317182318182319182320182321182322182323182324182325182326182327182328182329182330182331182332182333182334182335182336182337182338182339182340182341182342182343182344182345182346182347182348182349182350182351182352182353182354182355182356182357182358182359182360182361182362182363182364182365182366182367182368182369182370182371182372182373182374182375182376182377182378182379182380182381182382182383182384182385182386182387182388182389182390182391182392182393182394182395182396182397182398182399182400182401182402182403182404182405182406182407182408182409182410182411182412182413182414182415182416182417182418182419182420182421182422182423182424182425182426182427182428182429182430182431182432182433182434182435182436182437182438182439182440182441182442182443182444182445182446182447182448182449182450182451182452182453182454182455182456182457182458182459182460182461182462182463182464182465182466182467182468182469182470182471182472182473182474182475182476182477182478182479182480182481182482182483182484182485182486182487182488182489182490182491182492182493182494182495182496182497182498182499182500182501182502182503182504182505182506182507182508182509182510182511182512182513182514182515182516182517182518182519182520182521182522182523182524182525182526182527182528182529182530182531182532182533182534182535182536182537182538182539182540182541182542182543182544182545182546182547182548182549182550182551182552182553182554182555182556182557182558182559182560182561182562182563182564182565182566182567182568182569182570182571182572182573182574182575182576182577182578182579182580182581182582182583182584182585182586182587182588182589182590182591182592182593182594182595182596182597182598182599182600182601182602182603182604182605182606182607182608182609182610182611182612182613182614182615182616182617182618182619182620182621182622182623182624182625182626182627182628182629182630182631182632182633182634182635182636182637182638182639182640182641182642182643182644182645182646182647182648182649182650182651182652182653182654182655182656182657182658182659182660182661182662182663182664182665182666182667182668182669182670182671182672182673182674182675182676182677182678182679182680182681182682182683182684182685182686182687182688182689182690182691182692182693182694182695182696182697182698182699182700182701182702182703182704182705182706182707182708182709182710182711182712182713182714182715182716182717182718182719182720182721182722182723182724182725182726182727182728182729182730182731182732182733182734182735182736182737182738182739182740182741182742182743182744182745182746182747182748182749182750182751182752182753182754182755182756182757182758182759182760182761182762182763182764182765182766182767182768182769182770182771182772182773182774182775182776182777182778182779182780182781182782182783182784182785182786182787182788182789182790182791182792182793182794182795182796182797182798182799182800182801182802182803182804182805182806182807182808182809182810182811182812182813182814182815182816182817182818182819182820182821182822182823182824182825182826182827182828182829182830182831182832182833182834182835182836182837182838182839182840182841182842182843182844182845182846182847182848182849182850182851182852182853182854182855182856182857182858182859182860182861182862182863182864182865182866182867182868182869182870182871182872182873182874182875182876182877182878182879182880182881182882182883182884182885182886182887182888182889182890182891182892182893182894182895182896182897182898182899182900182901182902182903182904182905182906182907182908182909182910182911182912182913182914182915182916182917182918182919182920182921182922182923182924182925182926182927182928182929182930182931182932182933182934182935182936182937182938182939182940182941182942182943182944182945182946182947182948182949182950182951182952182953182954182955182956182957182958182959182960182961182962182963182964182965182966182967182968182969182970182971182972182973182974182975182976182977182978182979182980182981182982182983182984182985182986182987182988182989182990182991182992182993182994182995182996182997182998182999183000183001183002183003183004183005183006183007183008183009183010183011183012183013183014183015183016183017183018183019183020183021183022183023183024183025183026183027183028183029183030183031183032183033183034183035183036183037183038183039183040183041183042183043183044183045183046183047183048183049183050183051183052183053183054183055183056183057183058183059183060183061183062183063183064183065183066183067183068183069183070183071183072183073183074183075183076183077183078183079183080183081183082183083183084183085183086183087183088183089183090183091183092183093183094183095183096183097183098183099183100183101183102183103183104183105183106183107183108183109183110183111183112183113183114183115183116183117183118183119183120183121183122183123183124183125183126183127183128183129183130183131183132183133183134183135183136183137183138183139183140183141183142183143183144183145183146183147183148183149183150183151183152183153183154183155183156183157183158183159183160183161183162183163183164183165183166183167183168183169183170183171183172183173183174183175183176183177183178183179183180183181183182183183183184183185183186183187183188183189183190183191183192183193183194183195183196183197183198183199183200183201183202183203183204183205183206183207183208183209183210183211183212183213183214183215183216183217183218183219183220183221183222183223183224183225183226183227183228183229183230183231183232183233183234183235183236183237183238183239183240183241183242183243183244183245183246183247183248183249183250183251183252183253183254183255183256183257183258183259183260183261183262183263183264183265183266183267183268183269183270183271183272183273183274183275183276183277183278183279183280183281183282183283183284183285183286183287183288183289183290183291183292183293183294183295183296183297183298183299183300183301183302183303183304183305183306183307183308183309183310183311183312183313183314183315183316183317183318183319183320183321183322183323183324183325183326183327183328183329183330183331183332183333183334183335183336183337183338183339183340183341183342183343183344183345183346183347183348183349183350183351183352183353183354183355183356183357183358183359183360183361183362183363183364183365183366183367183368183369183370183371183372183373183374183375183376183377183378183379183380183381183382183383183384183385183386183387183388183389183390183391183392183393183394183395183396183397183398183399183400183401183402183403183404183405183406183407183408183409183410183411183412183413183414183415183416183417183418183419183420183421183422183423183424183425183426183427183428183429183430183431183432183433183434183435183436183437183438183439183440183441183442183443183444183445183446183447183448183449183450183451183452183453183454183455183456183457183458183459183460183461183462183463183464183465183466183467183468183469183470183471183472183473183474183475183476183477183478183479183480183481183482183483183484183485183486183487183488183489183490183491183492183493183494183495183496183497183498183499183500183501183502183503183504183505183506183507183508183509183510183511183512183513183514183515183516183517183518183519183520183521183522183523183524183525183526183527183528183529183530183531183532183533183534183535183536183537183538183539183540183541183542183543183544183545183546183547183548183549183550183551183552183553183554183555183556183557183558183559183560183561183562183563183564183565183566183567183568183569183570183571183572183573183574183575183576183577183578183579183580183581183582183583183584183585183586183587183588183589183590183591183592183593183594183595183596183597183598183599183600183601183602183603183604183605183606183607183608183609183610183611183612183613183614183615183616183617183618183619183620183621183622183623183624183625183626183627183628183629183630183631183632183633183634183635183636183637183638183639183640183641183642183643183644183645183646183647183648183649183650183651183652183653183654183655183656183657183658183659183660183661183662183663183664183665183666183667183668183669183670183671183672183673183674183675183676183677183678183679183680183681183682183683183684183685183686183687183688183689183690183691183692183693183694183695183696183697183698183699183700183701183702183703183704183705183706183707183708183709183710183711183712183713183714183715183716183717183718183719183720183721183722183723183724183725183726183727183728183729183730183731183732183733183734183735183736183737183738183739183740183741183742183743183744183745183746183747183748183749183750183751183752183753183754183755183756183757183758183759183760183761183762183763183764183765183766183767183768183769183770183771183772183773183774183775183776183777183778183779183780183781183782183783183784183785183786183787183788183789183790183791183792183793183794183795183796183797183798183799183800183801183802183803183804183805183806183807183808183809183810183811183812183813183814183815183816183817183818183819183820183821183822183823183824183825183826183827183828183829183830183831183832183833183834183835183836183837183838183839183840183841183842183843183844183845183846183847183848183849183850183851183852183853183854183855183856183857183858183859183860183861183862183863183864183865183866183867183868183869183870183871183872183873183874183875183876183877183878183879183880183881183882183883183884183885183886183887183888183889183890183891183892183893183894183895183896183897183898183899183900183901183902183903183904183905183906183907183908183909183910183911183912183913183914183915183916183917183918183919183920183921183922183923183924183925183926183927183928183929183930183931183932183933183934183935183936183937183938183939183940183941183942183943183944183945183946183947183948183949183950183951183952183953183954183955183956183957183958183959183960183961183962183963183964183965183966183967183968183969183970183971183972183973183974183975183976183977183978183979183980183981183982183983183984183985183986183987183988183989183990183991183992183993183994183995183996183997183998183999184000184001184002184003184004184005184006184007184008184009184010184011184012184013184014184015184016184017184018184019184020184021184022184023184024184025184026184027184028184029184030184031184032184033184034184035184036184037184038184039184040184041184042184043184044184045184046184047184048184049184050184051184052184053184054184055184056184057184058184059184060184061184062184063184064184065184066184067184068184069184070184071184072184073184074184075184076184077184078184079184080184081184082184083184084184085184086184087184088184089184090184091184092184093184094184095184096184097184098184099184100184101184102184103184104184105184106184107184108184109184110184111184112184113184114184115184116184117184118184119184120184121184122184123184124184125184126184127184128184129184130184131184132184133184134184135184136184137184138184139184140184141184142184143184144184145184146184147184148184149184150184151184152184153184154184155184156184157184158184159184160184161184162184163184164184165184166184167184168184169184170184171184172184173184174184175184176184177184178184179184180184181184182184183184184184185184186184187184188184189184190184191184192184193184194184195184196184197184198184199184200184201184202184203184204184205184206184207184208184209184210184211184212184213184214184215184216184217184218184219184220184221184222184223184224184225184226184227184228184229184230184231184232184233184234184235184236184237184238184239184240184241184242184243184244184245184246184247184248184249184250184251184252184253184254184255184256184257184258184259184260184261184262184263184264184265184266184267184268184269184270184271184272184273184274184275184276184277184278184279184280184281184282184283184284184285184286184287184288184289184290184291184292184293184294184295184296184297184298184299184300184301184302184303184304184305184306184307184308184309184310184311184312184313184314184315184316184317184318184319184320184321184322184323184324184325184326184327184328184329184330184331184332184333184334184335184336184337184338184339184340184341184342184343184344184345184346184347184348184349184350184351184352184353184354184355184356184357184358184359184360184361184362184363184364184365184366184367184368184369184370184371184372184373184374184375184376184377184378184379184380184381184382184383184384184385184386184387184388184389184390184391184392184393184394184395184396184397184398184399184400184401184402184403184404184405184406184407184408184409184410184411184412184413184414184415184416184417184418184419184420184421184422184423184424184425184426184427184428184429184430184431184432184433184434184435184436184437184438184439184440184441184442184443184444184445184446184447184448184449184450184451184452184453184454184455184456184457184458184459184460184461184462184463184464184465184466184467184468184469184470184471184472184473184474184475184476184477184478184479184480184481184482184483184484184485184486184487184488184489184490184491184492184493184494184495184496184497184498184499184500184501184502184503184504184505184506184507184508184509184510184511184512184513184514184515184516184517184518184519184520184521184522184523184524184525184526184527184528184529184530184531184532184533184534184535184536184537184538184539184540184541184542184543184544184545184546184547184548184549184550184551184552184553184554184555184556184557184558184559184560184561184562184563184564184565184566184567184568184569184570184571184572184573184574184575184576184577184578184579184580184581184582184583184584184585184586184587184588184589184590184591184592184593184594184595184596184597184598184599184600184601184602184603184604184605184606184607184608184609184610184611184612184613184614184615184616184617184618184619184620184621184622184623184624184625184626184627184628184629184630184631184632184633184634184635184636184637184638184639184640184641184642184643184644184645184646184647184648184649184650184651184652184653184654184655184656184657184658184659184660184661184662184663184664184665184666184667184668184669184670184671184672184673184674184675184676184677184678184679184680184681184682184683184684184685184686184687184688184689184690184691184692184693184694184695184696184697184698184699184700184701184702184703184704184705184706184707184708184709184710184711184712184713184714184715184716184717184718184719184720184721184722184723184724184725184726184727184728184729184730184731184732184733184734184735184736184737184738184739184740184741184742184743184744184745184746184747184748184749184750184751184752184753184754184755184756184757184758184759184760184761184762184763184764184765184766184767184768184769184770184771184772184773184774184775184776184777184778184779184780184781184782184783184784184785184786184787184788184789184790184791184792184793184794184795184796184797184798184799184800184801184802184803184804184805184806184807184808184809184810184811184812184813184814184815184816184817184818184819184820184821184822184823184824184825184826184827184828184829184830184831184832184833184834184835184836184837184838184839184840184841184842184843184844184845184846184847184848184849184850184851184852184853184854184855184856184857184858184859184860184861184862184863184864184865184866184867184868184869184870184871184872184873184874184875184876184877184878184879184880184881184882184883184884184885184886184887184888184889184890184891184892184893184894184895184896184897184898184899184900184901184902184903184904184905184906184907184908184909184910184911184912184913184914184915184916184917184918184919184920184921184922184923184924184925184926184927184928184929184930184931184932184933184934184935184936184937184938184939184940184941184942184943184944184945184946184947184948184949184950184951184952184953184954184955184956184957184958184959184960184961184962184963184964184965184966184967184968184969184970184971184972184973184974184975184976184977184978184979184980184981184982184983184984184985184986184987184988184989184990184991184992184993184994184995184996184997184998184999185000185001185002185003185004185005185006185007185008185009185010185011185012185013185014185015185016185017185018185019185020185021185022185023185024185025185026185027185028185029185030185031185032185033185034185035185036185037185038185039185040185041185042185043185044185045185046185047185048185049185050185051185052185053185054185055185056185057185058185059185060185061185062185063185064185065185066185067185068185069185070185071185072185073185074185075185076185077185078185079185080185081185082185083185084185085185086185087185088185089185090185091185092185093185094185095185096185097185098185099185100185101185102185103185104185105185106185107185108185109185110185111185112185113185114185115185116185117185118185119185120185121185122185123185124185125185126185127185128185129185130185131185132185133185134185135185136185137185138185139185140185141185142185143185144185145185146185147185148185149185150185151185152185153185154185155185156185157185158185159185160185161185162185163185164185165185166185167185168185169185170185171185172185173185174185175185176185177185178185179185180185181185182185183185184185185185186185187185188185189185190185191185192185193185194185195185196185197185198185199185200185201185202185203185204185205185206185207185208185209185210185211185212185213185214185215185216185217185218185219185220185221185222185223185224185225185226185227185228185229185230185231185232185233185234185235185236185237185238185239185240185241185242185243185244185245185246185247185248185249185250185251185252185253185254185255185256185257185258185259185260185261185262185263185264185265185266185267185268185269185270185271185272185273185274185275185276185277185278185279185280185281185282185283185284185285185286185287185288185289185290185291185292185293185294185295185296185297185298185299185300185301185302185303185304185305185306185307185308185309185310185311185312185313185314185315185316185317185318185319185320185321185322185323185324185325185326185327185328185329185330185331185332185333185334185335185336185337185338185339185340185341185342185343185344185345185346185347185348185349185350185351185352185353185354185355185356185357185358185359185360185361185362185363185364185365185366185367185368185369185370185371185372185373185374185375185376185377185378185379185380185381185382185383185384185385185386185387185388185389185390185391185392185393185394185395185396185397185398185399185400185401185402185403185404185405185406185407185408185409185410185411185412185413185414185415185416185417185418185419185420185421185422185423185424185425185426185427185428185429185430185431185432185433185434185435185436185437185438185439185440185441185442185443185444185445185446185447185448185449185450185451185452185453185454185455185456185457185458185459185460185461185462185463185464185465185466185467185468185469185470185471185472185473185474185475185476185477185478185479185480185481185482185483185484185485185486185487185488185489185490185491185492185493185494185495185496185497185498185499185500185501185502185503185504185505185506185507185508185509185510185511185512185513185514185515185516185517185518185519185520185521185522185523185524185525185526185527185528185529185530185531185532185533185534185535185536185537185538185539185540185541185542185543185544185545185546185547185548185549185550185551185552185553185554185555185556185557185558185559185560185561185562185563185564185565185566185567185568185569185570185571185572185573185574185575185576185577185578185579185580185581185582185583185584185585185586185587185588185589185590185591185592185593185594185595185596185597185598185599185600185601185602185603185604185605185606185607185608185609185610185611185612185613185614185615185616185617185618185619185620185621185622185623185624185625185626185627185628185629185630185631185632185633185634185635185636185637185638185639185640185641185642185643185644185645185646185647185648185649185650185651185652185653185654185655185656185657185658185659185660185661185662185663185664185665185666185667185668185669185670185671185672185673185674185675185676185677185678185679185680185681185682185683185684185685185686185687185688185689185690185691185692185693185694185695185696185697185698185699185700185701185702185703185704185705185706185707185708185709185710185711185712185713185714185715185716185717185718185719185720185721185722185723185724185725185726185727185728185729185730185731185732185733185734185735185736185737185738185739185740185741185742185743185744185745185746185747185748185749185750185751185752185753185754185755185756185757185758185759185760185761185762185763185764185765185766185767185768185769185770185771185772185773185774185775185776185777185778185779185780185781185782185783185784185785185786185787185788185789185790185791185792185793185794185795185796185797185798185799185800185801185802185803185804185805185806185807185808185809185810185811185812185813185814185815185816185817185818185819185820185821185822185823185824185825185826185827185828185829185830185831185832185833185834185835185836185837185838185839185840185841185842185843185844185845185846185847185848185849185850185851185852185853185854185855185856185857185858185859185860185861185862185863185864185865185866185867185868185869185870185871185872185873185874185875185876185877185878185879185880185881185882185883185884185885185886185887185888185889185890185891185892185893185894185895185896185897185898185899185900185901185902185903185904185905185906185907185908185909185910185911185912185913185914185915185916185917185918185919185920185921185922185923185924185925185926185927185928185929185930185931185932185933185934185935185936185937185938185939185940185941185942185943185944185945185946185947185948185949185950185951185952185953185954185955185956185957185958185959185960185961185962185963185964185965185966185967185968185969185970185971185972185973185974185975185976185977185978185979185980185981185982185983185984185985185986185987185988185989185990185991185992185993185994185995185996185997185998185999186000186001186002186003186004186005186006186007186008186009186010186011186012186013186014186015186016186017186018186019186020186021186022186023186024186025186026186027186028186029186030186031186032186033186034186035186036186037186038186039186040186041186042186043186044186045186046186047186048186049186050186051186052186053186054186055186056186057186058186059186060186061186062186063186064186065186066186067186068186069186070186071186072186073186074186075186076186077186078186079186080186081186082186083186084186085186086186087186088186089186090186091186092186093186094186095186096186097186098186099186100186101186102186103186104186105186106186107186108186109186110186111186112186113186114186115186116186117186118186119186120186121186122186123186124186125186126186127186128186129186130186131186132186133186134186135186136186137186138186139186140186141186142186143186144186145186146186147186148186149186150186151186152186153186154186155186156186157186158186159186160186161186162186163186164186165186166186167186168186169186170186171186172186173186174186175186176186177186178186179186180186181186182186183186184186185186186186187186188186189186190186191186192186193186194186195186196186197186198186199186200186201186202186203186204186205186206186207186208186209186210186211186212186213186214186215186216186217186218186219186220186221186222186223186224186225186226186227186228186229186230186231186232186233186234186235186236186237186238186239186240186241186242186243186244186245186246186247186248186249186250186251186252186253186254186255186256186257186258186259186260186261186262186263186264186265186266186267186268186269186270186271186272186273186274186275186276186277186278186279186280186281186282186283186284186285186286186287186288186289186290186291186292186293186294186295186296186297186298186299186300186301186302186303186304186305186306186307186308186309186310186311186312186313186314186315186316186317186318186319186320186321186322186323186324186325186326186327186328186329186330186331186332186333186334186335186336186337186338186339186340186341186342186343186344186345186346186347186348186349186350186351186352186353186354186355186356186357186358186359186360186361186362186363186364186365186366186367186368186369186370186371186372186373186374186375186376186377186378186379186380186381186382186383186384186385186386186387186388186389186390186391186392186393186394186395186396186397186398186399186400186401186402186403186404186405186406186407186408186409186410186411186412186413186414186415186416186417186418186419186420186421186422186423186424186425186426186427186428186429186430186431186432186433186434186435186436186437186438186439186440186441186442186443186444186445186446186447186448186449186450186451186452186453186454186455186456186457186458186459186460186461186462186463186464186465186466186467186468186469186470186471186472186473186474186475186476186477186478186479186480186481186482186483186484186485186486186487186488186489186490186491186492186493186494186495186496186497186498186499186500186501186502186503186504186505186506186507186508186509186510186511186512186513186514186515186516186517186518186519186520186521186522186523186524186525186526186527186528186529186530186531186532186533186534186535186536186537186538186539186540186541186542186543186544186545186546186547186548186549186550186551186552186553186554186555186556186557186558186559186560186561186562186563186564186565186566186567186568186569186570186571186572186573186574186575186576186577186578186579186580186581186582186583186584186585186586186587186588186589186590186591186592186593186594186595186596186597186598186599186600186601186602186603186604186605186606186607186608186609186610186611186612186613186614186615186616186617186618186619186620186621186622186623186624186625186626186627186628186629186630186631186632186633186634186635186636186637186638186639186640186641186642186643186644186645186646186647186648186649186650186651186652186653186654186655186656186657186658186659186660186661186662186663186664186665186666186667186668186669186670186671186672186673186674186675186676186677186678186679186680186681186682186683186684186685186686186687186688186689186690186691186692186693186694186695186696186697186698186699186700186701186702186703186704186705186706186707186708186709186710186711186712186713186714186715186716186717186718186719186720186721186722186723186724186725186726186727186728186729186730186731186732186733186734186735186736186737186738186739186740186741186742186743186744186745186746186747186748186749186750186751186752186753186754186755186756186757186758186759186760186761186762186763186764186765186766186767186768186769186770186771186772186773186774186775186776186777186778186779186780186781186782186783186784186785186786186787186788186789186790186791186792186793186794186795186796186797186798186799186800186801186802186803186804186805186806186807186808186809186810186811186812186813186814186815186816186817186818186819186820186821186822186823186824186825186826186827186828186829186830186831186832186833186834186835186836186837186838186839186840186841186842186843186844186845186846186847186848186849186850186851186852186853186854186855186856186857186858186859186860186861186862186863186864186865186866186867186868186869186870186871186872186873186874186875186876186877186878186879186880186881186882186883186884186885186886186887186888186889186890186891186892186893186894186895186896186897186898186899186900186901186902186903186904186905186906186907186908186909186910186911186912186913186914186915186916186917186918186919186920186921186922186923186924186925186926186927186928186929186930186931186932186933186934186935186936186937186938186939186940186941186942186943186944186945186946186947186948186949186950186951186952186953186954186955186956186957186958186959186960186961186962186963186964186965186966186967186968186969186970186971186972186973186974186975186976186977186978186979186980186981186982186983186984186985186986186987186988186989186990186991186992186993186994186995186996186997186998186999187000187001187002187003187004187005187006187007187008187009187010187011187012187013187014187015187016187017187018187019187020187021187022187023187024187025187026187027187028187029187030187031187032187033187034187035187036187037187038187039187040187041187042187043187044187045187046187047187048187049187050187051187052187053187054187055187056187057187058187059187060187061187062187063187064187065187066187067187068187069187070187071187072187073187074187075187076187077187078187079187080187081187082187083187084187085187086187087187088187089187090187091187092187093187094187095187096187097187098187099187100187101187102187103187104187105187106187107187108187109187110187111187112187113187114187115187116187117187118187119187120187121187122187123187124187125187126187127187128187129187130187131187132187133187134187135187136187137187138187139187140187141187142187143187144187145187146187147187148187149187150187151187152187153187154187155187156187157187158187159187160187161187162187163187164187165187166187167187168187169187170187171187172187173187174187175187176187177187178187179187180187181187182187183187184187185187186187187187188187189187190187191187192187193187194187195187196187197187198187199187200187201187202187203187204187205187206187207187208187209187210187211187212187213187214187215187216187217187218187219187220187221187222187223187224187225187226187227187228187229187230187231187232187233187234187235187236187237187238187239187240187241187242187243187244187245187246187247187248187249187250187251187252187253187254187255187256187257187258187259187260187261187262187263187264187265187266187267187268187269187270187271187272187273187274187275187276187277187278187279187280187281187282187283187284187285187286187287187288187289187290187291187292187293187294187295187296187297187298187299187300187301187302187303187304187305187306187307187308187309187310187311187312187313187314187315187316187317187318187319187320187321187322187323187324187325187326187327187328187329187330187331187332187333187334187335187336187337187338187339187340187341187342187343187344187345187346187347187348187349187350187351187352187353187354187355187356187357187358187359187360187361187362187363187364187365187366187367187368187369187370187371187372187373187374187375187376187377187378187379187380187381187382187383187384187385187386187387187388187389187390187391187392187393187394187395187396187397187398187399187400187401187402187403187404187405187406187407187408187409187410187411187412187413187414187415187416187417187418187419187420187421187422187423187424187425187426187427187428187429187430187431187432187433187434187435187436187437187438187439187440187441187442187443187444187445187446187447187448187449187450187451187452187453187454187455187456187457187458187459187460187461187462187463187464187465187466187467187468187469187470187471187472187473187474187475187476187477187478187479187480187481187482187483187484187485187486187487187488187489187490187491187492187493187494187495187496187497187498187499187500187501187502187503187504187505187506187507187508187509187510187511187512187513187514187515187516187517187518187519187520187521187522187523187524187525187526187527187528187529187530187531187532187533187534187535187536187537187538187539187540187541187542187543187544187545187546187547187548187549187550187551187552187553187554187555187556187557187558187559187560187561187562187563187564187565187566187567187568187569187570187571187572187573187574187575187576187577187578187579187580187581187582187583187584187585187586187587187588187589187590187591187592187593187594187595187596187597187598187599187600187601187602187603187604187605187606187607187608187609187610187611187612187613187614187615187616187617187618187619187620187621187622187623187624187625187626187627187628187629187630187631187632187633187634187635187636187637187638187639187640187641187642187643187644187645187646187647187648187649187650187651187652187653187654187655187656187657187658187659187660187661187662187663187664187665187666187667187668187669187670187671187672187673187674187675187676187677187678187679187680187681187682187683187684187685187686187687187688187689187690187691187692187693187694187695187696187697187698187699187700187701187702187703187704187705187706187707187708187709187710187711187712187713187714187715187716187717187718187719187720187721187722187723187724187725187726187727187728187729187730187731187732187733187734187735187736187737187738187739187740187741187742187743187744187745187746187747187748187749187750187751187752187753187754187755187756187757187758187759187760187761187762187763187764187765187766187767187768187769187770187771187772187773187774187775187776187777187778187779187780187781187782187783187784187785187786187787187788187789187790187791187792187793187794187795187796187797187798187799187800187801187802187803187804187805187806187807187808187809187810187811187812187813187814187815187816187817187818187819187820187821187822187823187824187825187826187827187828187829187830187831187832187833187834187835187836187837187838187839187840187841187842187843187844187845187846187847187848187849187850187851187852187853187854187855187856187857187858187859187860187861187862187863187864187865187866187867187868187869187870187871187872187873187874187875187876187877187878187879187880187881187882187883187884187885187886187887187888187889187890187891187892187893187894187895187896187897187898187899187900187901187902187903187904187905187906187907187908187909187910187911187912187913187914187915187916187917187918187919187920187921187922187923187924187925187926187927187928187929187930187931187932187933187934187935187936187937187938187939187940187941187942187943187944187945187946187947187948187949187950187951187952187953187954187955187956187957187958187959187960187961187962187963187964187965187966187967187968187969187970187971187972187973187974187975187976187977187978187979187980187981187982187983187984187985187986187987187988187989187990187991187992187993187994187995187996187997187998187999188000188001188002188003188004188005188006188007188008188009188010188011188012188013188014188015188016188017188018188019188020188021188022188023188024188025188026188027188028188029188030188031188032188033188034188035188036188037188038188039188040188041188042188043188044188045188046188047188048188049188050188051188052188053188054188055188056188057188058188059188060188061188062188063188064188065188066188067188068188069188070188071188072188073188074188075188076188077188078188079188080188081188082188083188084188085188086188087188088188089188090188091188092188093188094188095188096188097188098188099188100188101188102188103188104188105188106188107188108188109188110188111188112188113188114188115188116188117188118188119188120188121188122188123188124188125188126188127188128188129188130188131188132188133188134188135188136188137188138188139188140188141188142188143188144188145188146188147188148188149188150188151188152188153188154188155188156188157188158188159188160188161188162188163188164188165188166188167188168188169188170188171188172188173188174188175188176188177188178188179188180188181188182188183188184188185188186188187188188188189188190188191188192188193188194188195188196188197188198188199188200188201188202188203188204188205188206188207188208188209188210188211188212188213188214188215188216188217188218188219188220188221188222188223188224188225188226188227188228188229188230188231188232188233188234188235188236188237188238188239188240188241188242188243188244188245188246188247188248188249188250188251188252188253188254188255188256188257188258188259188260188261188262188263188264188265188266188267188268188269188270188271188272188273188274188275188276188277188278188279188280188281188282188283188284188285188286188287188288188289188290188291188292188293188294188295188296188297188298188299188300188301188302188303188304188305188306188307188308188309188310188311188312188313188314188315188316188317188318188319188320188321188322188323188324188325188326188327188328188329188330188331188332188333188334188335188336188337188338188339188340188341188342188343188344188345188346188347188348188349188350188351188352188353188354188355188356188357188358188359188360188361188362188363188364188365188366188367188368188369188370188371188372188373188374188375188376188377188378188379188380188381188382188383188384188385188386188387188388188389188390188391188392188393188394188395188396188397188398188399188400188401188402188403188404188405188406188407188408188409188410188411188412188413188414188415188416188417188418188419188420188421188422188423188424188425188426188427188428188429188430188431188432188433188434188435188436188437188438188439188440188441188442188443188444188445188446188447188448188449188450188451188452188453188454188455188456188457188458188459188460188461188462188463188464188465188466188467188468188469188470188471188472188473188474188475188476188477188478188479188480188481188482188483188484188485188486188487188488188489188490188491188492188493188494188495188496188497188498188499188500188501188502188503188504188505188506188507188508188509188510188511188512188513188514188515188516188517188518188519188520188521188522188523188524188525188526188527188528188529188530188531188532188533188534188535188536188537188538188539188540188541188542188543188544188545188546188547188548188549188550188551188552188553188554188555188556188557188558188559188560188561188562188563188564188565188566188567188568188569188570188571188572188573188574188575188576188577188578188579188580188581188582188583188584188585188586188587188588188589188590188591188592188593188594188595188596188597188598188599188600188601188602188603188604188605188606188607188608188609188610188611188612188613188614188615188616188617188618188619188620188621188622188623188624188625188626188627188628188629188630188631188632188633188634188635188636188637188638188639188640188641188642188643188644188645188646188647188648188649188650188651188652188653188654188655188656188657188658188659188660188661188662188663188664188665188666188667188668188669188670188671188672188673188674188675188676188677188678188679188680188681188682188683188684188685188686188687188688188689188690188691188692188693188694188695188696188697188698188699188700188701188702188703188704188705188706188707188708188709188710188711188712188713188714188715188716188717188718188719188720188721188722188723188724188725188726188727188728188729188730188731188732188733188734188735188736188737188738188739188740188741188742188743188744188745188746188747188748188749188750188751188752188753188754188755188756188757188758188759188760188761188762188763188764188765188766188767188768188769188770188771188772188773188774188775188776188777188778188779188780188781188782188783188784188785188786188787188788188789188790188791188792188793188794188795188796188797188798188799188800188801188802188803188804188805188806188807188808188809188810188811188812188813188814188815188816188817188818188819188820188821188822188823188824188825188826188827188828188829188830188831188832188833188834188835188836188837188838188839188840188841188842188843188844188845188846188847188848188849188850188851188852188853188854188855188856188857188858188859188860188861188862188863188864188865188866188867188868188869188870188871188872188873188874188875188876188877188878188879188880188881188882188883188884188885188886188887188888188889188890188891188892188893188894188895188896188897188898188899188900188901188902188903188904188905188906188907188908188909188910188911188912188913188914188915188916188917188918188919188920188921188922188923188924188925188926188927188928188929188930188931188932188933188934188935188936188937188938188939188940188941188942188943188944188945188946188947188948188949188950188951188952188953188954188955188956188957188958188959188960188961188962188963188964188965188966188967188968188969188970188971188972188973188974188975188976188977188978188979188980188981188982188983188984188985188986188987188988188989188990188991188992188993188994188995188996188997188998188999189000189001189002189003189004189005189006189007189008189009189010189011189012189013189014189015189016189017189018189019189020189021189022189023189024189025189026189027189028189029189030189031189032189033189034189035189036189037189038189039189040189041189042189043189044189045189046189047189048189049189050189051189052189053189054189055189056189057189058189059189060189061189062189063189064189065189066189067189068189069189070189071189072189073189074189075189076189077189078189079189080189081189082189083189084189085189086189087189088189089189090189091189092189093189094189095189096189097189098189099189100189101189102189103189104189105189106189107189108189109189110189111189112189113189114189115189116189117189118189119189120189121189122189123189124189125189126189127189128189129189130189131189132189133189134189135189136189137189138189139189140189141189142189143189144189145189146189147189148189149189150189151189152189153189154189155189156189157189158189159189160189161189162189163189164189165189166189167189168189169189170189171189172189173189174189175189176189177189178189179189180189181189182189183189184189185189186189187189188189189189190189191189192189193189194189195189196189197189198189199189200189201189202189203189204189205189206189207189208189209189210189211189212189213189214189215189216189217189218189219189220189221189222189223189224189225189226189227189228189229189230189231189232189233189234189235189236189237189238189239189240189241189242189243189244189245189246189247189248189249189250189251189252189253189254189255189256189257189258189259189260189261189262189263189264189265189266189267189268189269189270189271189272189273189274189275189276189277189278189279189280189281189282189283189284189285189286189287189288189289189290189291189292189293189294189295189296189297189298189299189300189301189302189303189304189305189306189307189308189309189310189311189312189313189314189315189316189317189318189319189320189321189322189323189324189325189326189327189328189329189330189331189332189333189334189335189336189337189338189339189340189341189342189343189344189345189346189347189348189349189350189351189352189353189354189355189356189357189358189359189360189361189362189363189364189365189366189367189368189369189370189371189372189373189374189375189376189377189378189379189380189381189382189383189384189385189386189387189388189389189390189391189392189393189394189395189396189397189398189399189400189401189402189403189404189405189406189407189408189409189410189411189412189413189414189415189416189417189418189419189420189421189422189423189424189425189426189427189428189429189430189431189432189433189434189435189436189437189438189439189440189441189442189443189444189445189446189447189448189449189450189451189452189453189454189455189456189457189458189459189460189461189462189463189464189465189466189467189468189469189470189471189472189473189474189475189476189477189478189479189480189481189482189483189484189485189486189487189488189489189490189491189492189493189494189495189496189497189498189499189500189501189502189503189504189505189506189507189508189509189510189511189512189513189514189515189516189517189518189519189520189521189522189523189524189525189526189527189528189529189530189531189532189533189534189535189536189537189538189539189540189541189542189543189544189545189546189547189548189549189550189551189552189553189554189555189556189557189558189559189560189561189562189563189564189565189566189567189568189569189570189571189572189573189574189575189576189577189578189579189580189581189582189583189584189585189586189587189588189589189590189591189592189593189594189595189596189597189598189599189600189601189602189603189604189605189606189607189608189609189610189611189612189613189614189615189616189617189618189619189620189621189622189623189624189625189626189627189628189629189630189631189632189633189634189635189636189637189638189639189640189641189642189643189644189645189646189647189648189649189650189651189652189653189654189655189656189657189658189659189660189661189662189663189664189665189666189667189668189669189670189671189672189673189674189675189676189677189678189679189680189681189682189683189684189685189686189687189688189689189690189691189692189693189694189695189696189697189698189699189700189701189702189703189704189705189706189707189708189709189710189711189712189713189714189715189716189717189718189719189720189721189722189723189724189725189726189727189728189729189730189731189732189733189734189735189736189737189738189739189740189741189742189743189744189745189746189747189748189749189750189751189752189753189754189755189756189757189758189759189760189761189762189763189764189765189766189767189768189769189770189771189772189773189774189775189776189777189778189779189780189781189782189783189784189785189786189787189788189789189790189791189792189793189794189795189796189797189798189799189800189801189802189803189804189805189806189807189808189809189810189811189812189813189814189815189816189817189818189819189820189821189822189823189824189825189826189827189828189829189830189831189832189833189834189835189836189837189838189839189840189841189842189843189844189845189846189847189848189849189850189851189852189853189854189855189856189857189858189859189860189861189862189863189864189865189866189867189868189869189870189871189872189873189874189875189876189877189878189879189880189881189882189883189884189885189886189887189888189889189890189891189892189893189894189895189896189897189898189899189900189901189902189903189904189905189906189907189908189909189910189911189912189913189914189915189916189917189918189919189920189921189922189923189924189925189926189927189928189929189930189931189932189933189934189935189936189937189938189939189940189941189942189943189944189945189946189947189948189949189950189951189952189953189954189955189956189957189958189959189960189961189962189963189964189965189966189967189968189969189970189971189972189973189974189975189976189977189978189979189980189981189982189983189984189985189986189987189988189989189990189991189992189993189994189995189996189997189998189999190000190001190002190003190004190005190006190007190008190009190010190011190012190013190014190015190016190017190018190019190020190021190022190023190024190025190026190027190028190029190030190031190032190033190034190035190036190037190038190039190040190041190042190043190044190045190046190047190048190049190050190051190052190053190054190055190056190057190058190059190060190061190062190063190064190065190066190067190068190069190070190071190072190073190074190075190076190077190078190079190080190081190082190083190084190085190086190087190088190089190090190091190092190093190094190095190096190097190098190099190100190101190102190103190104190105190106190107190108190109190110190111190112190113190114190115190116190117190118190119190120190121190122190123190124190125190126190127190128190129190130190131190132190133190134190135190136190137190138190139190140190141190142190143190144190145190146190147190148190149190150190151190152190153190154190155190156190157190158190159190160190161190162190163190164190165190166190167190168190169190170190171190172190173190174190175190176190177190178190179190180190181190182190183190184190185190186190187190188190189190190190191190192190193190194190195190196190197190198190199190200190201190202190203190204190205190206190207190208190209190210190211190212190213190214190215190216190217190218190219190220190221190222190223190224190225190226190227190228190229190230190231190232190233190234190235190236190237190238190239190240190241190242190243190244190245190246190247190248190249190250190251190252190253190254190255190256190257190258190259190260190261190262190263190264190265190266190267190268190269190270190271190272190273190274190275190276190277190278190279190280190281190282190283190284190285190286190287190288190289190290190291190292190293190294190295190296190297190298190299190300190301190302190303190304190305190306190307190308190309190310190311190312190313190314190315190316190317190318190319190320190321190322190323190324190325190326190327190328190329190330190331190332190333190334190335190336190337190338190339190340190341190342190343190344190345190346190347190348190349190350190351190352190353190354190355190356190357190358190359190360190361190362190363190364190365190366190367190368190369190370190371190372190373190374190375190376190377190378190379190380190381190382190383190384190385190386190387190388190389190390190391190392190393190394190395190396190397190398190399190400190401190402190403190404190405190406190407190408190409190410190411190412190413190414190415190416190417190418190419190420190421190422190423190424190425190426190427190428190429190430190431190432190433190434190435190436190437190438190439190440190441190442190443190444190445190446190447190448190449190450190451190452190453190454190455190456190457190458190459190460190461190462190463190464190465190466190467190468190469190470190471190472190473190474190475190476190477190478190479190480190481190482190483190484190485190486190487190488190489190490190491190492190493190494190495190496190497190498190499190500190501190502190503190504190505190506190507190508190509190510190511190512190513190514190515190516190517190518190519190520190521190522190523190524190525190526190527190528190529190530190531190532190533190534190535190536190537190538190539190540190541190542190543190544190545190546190547190548190549190550190551190552190553190554190555190556190557190558190559190560190561190562190563190564190565190566190567190568190569190570190571190572190573190574190575190576190577190578190579190580190581190582190583190584190585190586190587190588190589190590190591190592190593190594190595190596190597190598190599190600190601190602190603190604190605190606190607190608190609190610190611190612190613190614190615190616190617190618190619190620190621190622190623190624190625190626190627190628190629190630190631190632190633190634190635190636190637190638190639190640190641190642190643190644190645190646190647190648190649190650190651190652190653190654190655190656190657190658190659190660190661190662190663190664190665190666190667190668190669190670190671190672190673190674190675190676190677190678190679190680190681190682190683190684190685190686190687190688190689190690190691190692190693190694190695190696190697190698190699190700190701190702190703190704190705190706190707190708190709190710190711190712190713190714190715190716190717190718190719190720190721190722190723190724190725190726190727190728190729190730190731190732190733190734190735190736190737190738190739190740190741190742190743190744190745190746190747190748190749190750190751190752190753190754190755190756190757190758190759190760190761190762190763190764190765190766190767190768190769190770190771190772190773190774190775190776190777190778190779190780190781190782190783190784190785190786190787190788190789190790190791190792190793190794190795190796190797190798190799190800190801190802190803190804190805190806190807190808190809190810190811190812190813190814190815190816190817190818190819190820190821190822190823190824190825190826190827190828190829190830190831190832190833190834190835190836190837190838190839190840190841190842190843190844190845190846190847190848190849190850190851190852190853190854190855190856190857190858190859190860190861190862190863190864190865190866190867190868190869190870190871190872190873190874190875190876190877190878190879190880190881190882190883190884190885190886190887190888190889190890190891190892190893190894190895190896190897190898190899190900190901190902190903190904190905190906190907190908190909190910190911190912190913190914190915190916190917190918190919190920190921190922190923190924190925190926190927190928190929190930190931190932190933190934190935190936190937190938190939190940190941190942190943190944190945190946190947190948190949190950190951190952190953190954190955190956190957190958190959190960190961190962190963190964190965190966190967190968190969190970190971190972190973190974190975190976190977190978190979190980190981190982190983190984190985190986190987190988190989190990190991190992190993190994190995190996190997190998190999191000191001191002191003191004191005191006191007191008191009191010191011191012191013191014191015191016191017191018191019191020191021191022191023191024191025191026191027191028191029191030191031191032191033191034191035191036191037191038191039191040191041191042191043191044191045191046191047191048191049191050191051191052191053191054191055191056191057191058191059191060191061191062191063191064191065191066191067191068191069191070191071191072191073191074191075191076191077191078191079191080191081191082191083191084191085191086191087191088191089191090191091191092191093191094191095191096191097191098191099191100191101191102191103191104191105191106191107191108191109191110191111191112191113191114191115191116191117191118191119191120191121191122191123191124191125191126191127191128191129191130191131191132191133191134191135191136191137191138191139191140191141191142191143191144191145191146191147191148191149191150191151191152191153191154191155191156191157191158191159191160191161191162191163191164191165191166191167191168191169191170191171191172191173191174191175191176191177191178191179191180191181191182191183191184191185191186191187191188191189191190191191191192191193191194191195191196191197191198191199191200191201191202191203191204191205191206191207191208191209191210191211191212191213191214191215191216191217191218191219191220191221191222191223191224191225191226191227191228191229191230191231191232191233191234191235191236191237191238191239191240191241191242191243191244191245191246191247191248191249191250191251191252191253191254191255191256191257191258191259191260191261191262191263191264191265191266191267191268191269191270191271191272191273191274191275191276191277191278191279191280191281191282191283191284191285191286191287191288191289191290191291191292191293191294191295191296191297191298191299191300191301191302191303191304191305191306191307191308191309191310191311191312191313191314191315191316191317191318191319191320191321191322191323191324191325191326191327191328191329191330191331191332191333191334191335191336191337191338191339191340191341191342191343191344191345191346191347191348191349191350191351191352191353191354191355191356191357191358191359191360191361191362191363191364191365191366191367191368191369191370191371191372191373191374191375191376191377191378191379191380191381191382191383191384191385191386191387191388191389191390191391191392191393191394191395191396191397191398191399191400191401191402191403191404191405191406191407191408191409191410191411191412191413191414191415191416191417191418191419191420191421191422191423191424191425191426191427191428191429191430191431191432191433191434191435191436191437191438191439191440191441191442191443191444191445191446191447191448191449191450191451191452191453191454191455191456191457191458191459191460191461191462191463191464191465191466191467191468191469191470191471191472191473191474191475191476191477191478191479191480191481191482191483191484191485191486191487191488191489191490191491191492191493191494191495191496191497191498191499191500191501191502191503191504191505191506191507191508191509191510191511191512191513191514191515191516191517191518191519191520191521191522191523191524191525191526191527191528191529191530191531191532191533191534191535191536191537191538191539191540191541191542191543191544191545191546191547191548191549191550191551191552191553191554191555191556191557191558191559191560191561191562191563191564191565191566191567191568191569191570191571191572191573191574191575191576191577191578191579191580191581191582191583191584191585191586191587191588191589191590191591191592191593191594191595191596191597191598191599191600191601191602191603191604191605191606191607191608191609191610191611191612191613191614191615191616191617191618191619191620191621191622191623191624191625191626191627191628191629191630191631191632191633191634191635191636191637191638191639191640191641191642191643191644191645191646191647191648191649191650191651191652191653191654191655191656191657191658191659191660191661191662191663191664191665191666191667191668191669191670191671191672191673191674191675191676191677191678191679191680191681191682191683191684191685191686191687191688191689191690191691191692191693191694191695191696191697191698191699191700191701191702191703191704191705191706191707191708191709191710191711191712191713191714191715191716191717191718191719191720191721191722191723191724191725191726191727191728191729191730191731191732191733191734191735191736191737191738191739191740191741191742191743191744191745191746191747191748191749191750191751191752191753191754191755191756191757191758191759191760191761191762191763191764191765191766191767191768191769191770191771191772191773191774191775191776191777191778191779191780191781191782191783191784191785191786191787191788191789191790191791191792191793191794191795191796191797191798191799191800191801191802191803191804191805191806191807191808191809191810191811191812191813191814191815191816191817191818191819191820191821191822191823191824191825191826191827191828191829191830191831191832191833191834191835191836191837191838191839191840191841191842191843191844191845191846191847191848191849191850191851191852191853191854191855191856191857191858191859191860191861191862191863191864191865191866191867191868191869191870191871191872191873191874191875191876191877191878191879191880191881191882191883191884191885191886191887191888191889191890191891191892191893191894191895191896191897191898191899191900191901191902191903191904191905191906191907191908191909191910191911191912191913191914191915191916191917191918191919191920191921191922191923191924191925191926191927191928191929191930191931191932191933191934191935191936191937191938191939191940191941191942191943191944191945191946191947191948191949191950191951191952191953191954191955191956191957191958191959191960191961191962191963191964191965191966191967191968191969191970191971191972191973191974191975191976191977191978191979191980191981191982191983191984191985191986191987191988191989191990191991191992191993191994191995191996191997191998191999192000192001192002192003192004192005192006192007192008192009192010192011192012192013192014192015192016192017192018192019192020192021192022192023192024192025192026192027192028192029192030192031192032192033192034192035192036192037192038192039192040192041192042192043192044192045192046192047192048192049192050192051192052192053192054192055192056192057192058192059192060192061192062192063192064192065192066192067192068192069192070192071192072192073192074192075192076192077192078192079192080192081192082192083192084192085192086192087192088192089192090192091192092192093192094192095192096192097192098192099192100192101192102192103192104192105192106192107192108192109192110192111192112192113192114192115192116192117192118192119192120192121192122192123192124192125192126192127192128192129192130192131192132192133192134192135192136192137192138192139192140192141192142192143192144192145192146192147192148192149192150192151192152192153192154192155192156192157192158192159192160192161192162192163192164192165192166192167192168192169192170192171192172192173192174192175192176192177192178192179192180192181192182192183192184192185192186192187192188192189192190192191192192192193192194192195192196192197192198192199192200192201192202192203192204192205192206192207192208192209192210192211192212192213192214192215192216192217192218192219192220192221192222192223192224192225192226192227192228192229192230192231192232192233192234192235192236192237192238192239192240192241192242192243192244192245192246192247192248192249192250192251192252192253192254192255192256192257192258192259192260192261192262192263192264192265192266192267192268192269192270192271192272192273192274192275192276192277192278192279192280192281192282192283192284192285192286192287192288192289192290192291192292192293192294192295192296192297192298192299192300192301192302192303192304192305192306192307192308192309192310192311192312192313192314192315192316192317192318192319192320192321192322192323192324192325192326192327192328192329192330192331192332192333192334192335192336192337192338192339192340192341192342192343192344192345192346192347192348192349192350192351192352192353192354192355192356192357192358192359192360192361192362192363192364192365192366192367192368192369192370192371192372192373192374192375192376192377192378192379192380192381192382192383192384192385192386192387192388192389192390192391192392192393192394192395192396192397192398192399192400192401192402192403192404192405192406192407192408192409192410192411192412192413192414192415192416192417192418192419192420192421192422192423192424192425192426192427192428192429192430192431192432192433192434192435192436192437192438192439192440192441192442192443192444192445192446192447192448192449192450192451192452192453192454192455192456192457192458192459192460192461192462192463192464192465192466192467192468192469192470192471192472192473192474192475192476192477192478192479192480192481192482192483192484192485192486192487192488192489192490192491192492192493192494192495192496192497192498192499192500192501192502192503192504192505192506192507192508192509192510192511192512192513192514192515192516192517192518192519192520192521192522192523192524192525192526192527192528192529192530192531192532192533192534192535192536192537192538192539192540192541192542192543192544192545192546192547192548192549192550192551192552192553192554192555192556192557192558192559192560192561192562192563192564192565192566192567192568192569192570192571192572192573192574192575192576192577192578192579192580192581192582192583192584192585192586192587192588192589192590192591192592192593192594192595192596192597192598192599192600192601192602192603192604192605192606192607192608192609192610192611192612192613192614192615192616192617192618192619192620192621192622192623192624192625192626192627192628192629192630192631192632192633192634192635192636192637192638192639192640192641192642192643192644192645192646192647192648192649192650192651192652192653192654192655192656192657192658192659192660192661192662192663192664192665192666192667192668192669192670192671192672192673192674192675192676192677192678192679192680192681192682192683192684192685192686192687192688192689192690192691192692192693192694192695192696192697192698192699192700192701192702192703192704192705192706192707192708192709192710192711192712192713192714192715192716192717192718192719192720192721192722192723192724192725192726192727192728192729192730192731192732192733192734192735192736192737192738192739192740192741192742192743192744192745192746192747192748192749192750192751192752192753192754192755192756192757192758192759192760192761192762192763192764192765192766192767192768192769192770192771192772192773192774192775192776192777192778192779192780192781192782192783192784192785192786192787192788192789192790192791192792192793192794192795192796192797192798192799192800192801192802192803192804192805192806192807192808192809192810192811192812192813192814192815192816192817192818192819192820192821192822192823192824192825192826192827192828192829192830192831192832192833192834192835192836192837192838192839192840192841192842192843192844192845192846192847192848192849192850192851192852192853192854192855192856192857192858192859192860192861192862192863192864192865192866192867192868192869192870192871192872192873192874192875192876192877192878192879192880192881192882192883192884192885192886192887192888192889192890192891192892192893192894192895192896192897192898192899192900192901192902192903192904192905192906192907192908192909192910192911192912192913192914192915192916192917192918192919192920192921192922192923192924192925192926192927192928192929192930192931192932192933192934192935192936192937192938192939192940192941192942192943192944192945192946192947192948192949192950192951192952192953192954192955192956192957192958192959192960192961192962192963192964192965192966192967192968192969192970192971192972192973192974192975192976192977192978192979192980192981192982192983192984192985192986192987192988192989192990192991192992192993192994192995192996192997192998192999193000193001193002193003193004193005193006193007193008193009193010193011193012193013193014193015193016193017193018193019193020193021193022193023193024193025193026193027193028193029193030193031193032193033193034193035193036193037193038193039193040193041193042193043193044193045193046193047193048193049193050193051193052193053193054193055193056193057193058193059193060193061193062193063193064193065193066193067193068193069193070193071193072193073193074193075193076193077193078193079193080193081193082193083193084193085193086193087193088193089193090193091193092193093193094193095193096193097193098193099193100193101193102193103193104193105193106193107193108193109193110193111193112193113193114193115193116193117193118193119193120193121193122193123193124193125193126193127193128193129193130193131193132193133193134193135193136193137193138193139193140193141193142193143193144193145193146193147193148193149193150193151193152193153193154193155193156193157193158193159193160193161193162193163193164193165193166193167193168193169193170193171193172193173193174193175193176193177193178193179193180193181193182193183193184193185193186193187193188193189193190193191193192193193193194193195193196193197193198193199193200193201193202193203193204193205193206193207193208193209193210193211193212193213193214193215193216193217193218193219193220193221193222193223193224193225193226193227193228193229193230193231193232193233193234193235193236193237193238193239193240193241193242193243193244193245193246193247193248193249193250193251193252193253193254193255193256193257193258193259193260193261193262193263193264193265193266193267193268193269193270193271193272193273193274193275193276193277193278193279193280193281193282193283193284193285193286193287193288193289193290193291193292193293193294193295193296193297193298193299193300193301193302193303193304193305193306193307193308193309193310193311193312193313193314193315193316193317193318193319193320193321193322193323193324193325193326193327193328193329193330193331193332193333193334193335193336193337193338193339193340193341193342193343193344193345193346193347193348193349193350193351193352193353193354193355193356193357193358193359193360193361193362193363193364193365193366193367193368193369193370193371193372193373193374193375193376193377193378193379193380193381193382193383193384193385193386193387193388193389193390193391193392193393193394193395193396193397193398193399193400193401193402193403193404193405193406193407193408193409193410193411193412193413193414193415193416193417193418193419193420193421193422193423193424193425193426193427193428193429193430193431193432193433193434193435193436193437193438193439193440193441193442193443193444193445193446193447193448193449193450193451193452193453193454193455193456193457193458193459193460193461193462193463193464193465193466193467193468193469193470193471193472193473193474193475193476193477193478193479193480193481193482193483193484193485193486193487193488193489193490193491193492193493193494193495193496193497193498193499193500193501193502193503193504193505193506193507193508193509193510193511193512193513193514193515193516193517193518193519193520193521193522193523193524193525193526193527193528193529193530193531193532193533193534193535193536193537193538193539193540193541193542193543193544193545193546193547193548193549193550193551193552193553193554193555193556193557193558193559193560193561193562193563193564193565193566193567193568193569193570193571193572193573193574193575193576193577193578193579193580193581193582193583193584193585193586193587193588193589193590193591193592193593193594193595193596193597193598193599193600193601193602193603193604193605193606193607193608193609193610193611193612193613193614193615193616193617193618193619193620193621193622193623193624193625193626193627193628193629193630193631193632193633193634193635193636193637193638193639193640193641193642193643193644193645193646193647193648193649193650193651193652193653193654193655193656193657193658193659193660193661193662193663193664193665193666193667193668193669193670193671193672193673193674193675193676193677193678193679193680193681193682193683193684193685193686193687193688193689193690193691193692193693193694193695193696193697193698193699193700193701193702193703193704193705193706193707193708193709193710193711193712193713193714193715193716193717193718193719193720193721193722193723193724193725193726193727193728193729193730193731193732193733193734193735193736193737193738193739193740193741193742193743193744193745193746193747193748193749193750193751193752193753193754193755193756193757193758193759193760193761193762193763193764193765193766193767193768193769193770193771193772193773193774193775193776193777193778193779193780193781193782193783193784193785193786193787193788193789193790193791193792193793193794193795193796193797193798193799193800193801193802193803193804193805193806193807193808193809193810193811193812193813193814193815193816193817193818193819193820193821193822193823193824193825193826193827193828193829193830193831193832193833193834193835193836193837193838193839193840193841193842193843193844193845193846193847193848193849193850193851193852193853193854193855193856193857193858193859193860193861193862193863193864193865193866193867193868193869193870193871193872193873193874193875193876193877193878193879193880193881193882193883193884193885193886193887193888193889193890193891193892193893193894193895193896193897193898193899193900193901193902193903193904193905193906193907193908193909193910193911193912193913193914193915193916193917193918193919193920193921193922193923193924193925193926193927193928193929193930193931193932193933193934193935193936193937193938193939193940193941193942193943193944193945193946193947193948193949193950193951193952193953193954193955193956193957193958193959193960193961193962193963193964193965193966193967193968193969193970193971193972193973193974193975193976193977193978193979193980193981193982193983193984193985193986193987193988193989193990193991193992193993193994193995193996193997193998193999194000194001194002194003194004194005194006194007194008194009194010194011194012194013194014194015194016194017194018194019194020194021194022194023194024194025194026194027194028194029194030194031194032194033194034194035194036194037194038194039194040194041194042194043194044194045194046194047194048194049194050194051194052194053194054194055194056194057194058194059194060194061194062194063194064194065194066194067194068194069194070194071194072194073194074194075194076194077194078194079194080194081194082194083194084194085194086194087194088194089194090194091194092194093194094194095194096194097194098194099194100194101194102194103194104194105194106194107194108194109194110194111194112194113194114194115194116194117194118194119194120194121194122194123194124194125194126194127194128194129194130194131194132194133194134194135194136194137194138194139194140194141194142194143194144194145194146194147194148194149194150194151194152194153194154194155194156194157194158194159194160194161194162194163194164194165194166194167194168194169194170194171194172194173194174194175194176194177194178194179194180194181194182194183194184194185194186194187194188194189194190194191194192194193194194194195194196194197194198194199194200194201194202194203194204194205194206194207194208194209194210194211194212194213194214194215194216194217194218194219194220194221194222194223194224194225194226194227194228194229194230194231194232194233194234194235194236194237194238194239194240194241194242194243194244194245194246194247194248194249194250194251194252194253194254194255194256194257194258194259194260194261194262194263194264194265194266194267194268194269194270194271194272194273194274194275194276194277194278194279194280194281194282194283194284194285194286194287194288194289194290194291194292194293194294194295194296194297194298194299194300194301194302194303194304194305194306194307194308194309194310194311194312194313194314194315194316194317194318194319194320194321194322194323194324194325194326194327194328194329194330194331194332194333194334194335194336194337194338194339194340194341194342194343194344194345194346194347194348194349194350194351194352194353194354194355194356194357194358194359194360194361194362194363194364194365194366194367194368194369194370194371194372194373194374194375194376194377194378194379194380194381194382194383194384194385194386194387194388194389194390194391194392194393194394194395194396194397194398194399194400194401194402194403194404194405194406194407194408194409194410194411194412194413194414194415194416194417194418194419194420194421194422194423194424194425194426194427194428194429194430194431194432194433194434194435194436194437194438194439194440194441194442194443194444194445194446194447194448194449194450194451194452194453194454194455194456194457194458194459194460194461194462194463194464194465194466194467194468194469194470194471194472194473194474194475194476194477194478194479194480194481194482194483194484194485194486194487194488194489194490194491194492194493194494194495194496194497194498194499194500194501194502194503194504194505194506194507194508194509194510194511194512194513194514194515194516194517194518194519194520194521194522194523194524194525194526194527194528194529194530194531194532194533194534194535194536194537194538194539194540194541194542194543194544194545194546194547194548194549194550194551194552194553194554194555194556194557194558194559194560194561194562194563194564194565194566194567194568194569194570194571194572194573194574194575194576194577194578194579194580194581194582194583194584194585194586194587194588194589194590194591194592194593194594194595194596194597194598194599194600194601194602194603194604194605194606194607194608194609194610194611194612194613194614194615194616194617194618194619194620194621194622194623194624194625194626194627194628194629194630194631194632194633194634194635194636194637194638194639194640194641194642194643194644194645194646194647194648194649194650194651194652194653194654194655194656194657194658194659194660194661194662194663194664194665194666194667194668194669194670194671194672194673194674194675194676194677194678194679194680194681194682194683194684194685194686194687194688194689194690194691194692194693194694194695194696194697194698194699194700194701194702194703194704194705194706194707194708194709194710194711194712194713194714194715194716194717194718194719194720194721194722194723194724194725194726194727194728194729194730194731194732194733194734194735194736194737194738194739194740194741194742194743194744194745194746194747194748194749194750194751194752194753194754194755194756194757194758194759194760194761194762194763194764194765194766194767194768194769194770194771194772194773194774194775194776194777194778194779194780194781194782194783194784194785194786194787194788194789194790194791194792194793194794194795194796194797194798194799194800194801194802194803194804194805194806194807194808194809194810194811194812194813194814194815194816194817194818194819194820194821194822194823194824194825194826194827194828194829194830194831194832194833194834194835194836194837194838194839194840194841194842194843194844194845194846194847194848194849194850194851194852194853194854194855194856194857194858194859194860194861194862194863194864194865194866194867194868194869194870194871194872194873194874194875194876194877194878194879194880194881194882194883194884194885194886194887194888194889194890194891194892194893194894194895194896194897194898194899194900194901194902194903194904194905194906194907194908194909194910194911194912194913194914194915194916194917194918194919194920194921194922194923194924194925194926194927194928194929194930194931194932194933194934194935194936194937194938194939194940194941194942194943194944194945194946194947194948194949194950194951194952194953194954194955194956194957194958194959194960194961194962194963194964194965194966194967194968194969194970194971194972194973194974194975194976194977194978194979194980194981194982194983194984194985194986194987194988194989194990194991194992194993194994194995194996194997194998194999195000195001195002195003195004195005195006195007195008195009195010195011195012195013195014195015195016195017195018195019195020195021195022195023195024195025195026195027195028195029195030195031195032195033195034195035195036195037195038195039195040195041195042195043195044195045195046195047195048195049195050195051195052195053195054195055195056195057195058195059195060195061195062195063195064195065195066195067195068195069195070195071195072195073195074195075195076195077195078195079195080195081195082195083195084195085195086195087195088195089195090195091195092195093195094195095195096195097195098195099195100195101195102195103195104195105195106195107195108195109195110195111195112195113195114195115195116195117195118195119195120195121195122195123195124195125195126195127195128195129195130195131195132195133195134195135195136195137195138195139195140195141195142195143195144195145195146195147195148195149195150195151195152195153195154195155195156195157195158195159195160195161195162195163195164195165195166195167195168195169195170195171195172195173195174195175195176195177195178195179195180195181195182195183195184195185195186195187195188195189195190195191195192195193195194195195195196195197195198195199195200195201195202195203195204195205195206195207195208195209195210195211195212195213195214195215195216195217195218195219195220195221195222195223195224195225195226195227195228195229195230195231195232195233195234195235195236195237195238195239195240195241195242195243195244195245195246195247195248195249195250195251195252195253195254195255195256195257195258195259195260195261195262195263195264195265195266195267195268195269195270195271195272195273195274195275195276195277195278195279195280195281195282195283195284195285195286195287195288195289195290195291195292195293195294195295195296195297195298195299195300195301195302195303195304195305195306195307195308195309195310195311195312195313195314195315195316195317195318195319195320195321195322195323195324195325195326195327195328195329195330195331195332195333195334195335195336195337195338195339195340195341195342195343195344195345195346195347195348195349195350195351195352195353195354195355195356195357195358195359195360195361195362195363195364195365195366195367195368195369195370195371195372195373195374195375195376195377195378195379195380195381195382195383195384195385195386195387195388195389195390195391195392195393195394195395195396195397195398195399195400195401195402195403195404195405195406195407195408195409195410195411195412195413195414195415195416195417195418195419195420195421195422195423195424195425195426195427195428195429195430195431195432195433195434195435195436195437195438195439195440195441195442195443195444195445195446195447195448195449195450195451195452195453195454195455195456195457195458195459195460195461195462195463195464195465195466195467195468195469195470195471195472195473195474195475195476195477195478195479195480195481195482195483195484195485195486195487195488195489195490195491195492195493195494195495195496195497195498195499195500195501195502195503195504195505195506195507195508195509195510195511195512195513195514195515195516195517195518195519195520195521195522195523195524195525195526195527195528195529195530195531195532195533195534195535195536195537195538195539195540195541195542195543195544195545195546195547195548195549195550195551195552195553195554195555195556195557195558195559195560195561195562195563195564195565195566195567195568195569195570195571195572195573195574195575195576195577195578195579195580195581195582195583195584195585195586195587195588195589195590195591195592195593195594195595195596195597195598195599195600195601195602195603195604195605195606195607195608195609195610195611195612195613195614195615195616195617195618195619195620195621195622195623195624195625195626195627195628195629195630195631195632195633195634195635195636195637195638195639195640195641195642195643195644195645195646195647195648195649195650195651195652195653195654195655195656195657195658195659195660195661195662195663195664195665195666195667195668195669195670195671195672195673195674195675195676195677195678195679195680195681195682195683195684195685195686195687195688195689195690195691195692195693195694195695195696195697195698195699195700195701195702195703195704195705195706195707195708195709195710195711195712195713195714195715195716195717195718195719195720195721195722195723195724195725195726195727195728195729195730195731195732195733195734195735195736195737195738195739195740195741195742195743195744195745195746195747195748195749195750195751195752195753195754195755195756195757195758195759195760195761195762195763195764195765195766195767195768195769195770195771195772195773195774195775195776195777195778195779195780195781195782195783195784195785195786195787195788195789195790195791195792195793195794195795195796195797195798195799195800195801195802195803195804195805195806195807195808195809195810195811195812195813195814195815195816195817195818195819195820195821195822195823195824195825195826195827195828195829195830195831195832195833195834195835195836195837195838195839195840195841195842195843195844195845195846195847195848195849195850195851195852195853195854195855195856195857195858195859195860195861195862195863195864195865195866195867195868195869195870195871195872195873195874195875195876195877195878195879195880195881195882195883195884195885195886195887195888195889195890195891195892195893195894195895195896195897195898195899195900195901195902195903195904195905195906195907195908195909195910195911195912195913195914195915195916195917195918195919195920195921195922195923195924195925195926195927195928195929195930195931195932195933195934195935195936195937195938195939195940195941195942195943195944195945195946195947195948195949195950195951195952195953195954195955195956195957195958195959195960195961195962195963195964195965195966195967195968195969195970195971195972195973195974195975195976195977195978195979195980195981195982195983195984195985195986195987195988195989195990195991195992195993195994195995195996195997195998195999196000196001196002196003196004196005196006196007196008196009196010196011196012196013196014196015196016196017196018196019196020196021196022196023196024196025196026196027196028196029196030196031196032196033196034196035196036196037196038196039196040196041196042196043196044196045196046196047196048196049196050196051196052196053196054196055196056196057196058196059196060196061196062196063196064196065196066196067196068196069196070196071196072196073196074196075196076196077196078196079196080196081196082196083196084196085196086196087196088196089196090196091196092196093196094196095196096196097196098196099196100196101196102196103196104196105196106196107196108196109196110196111196112196113196114196115196116196117196118196119196120196121196122196123196124196125196126196127196128196129196130196131196132196133196134196135196136196137196138196139196140196141196142196143196144196145196146196147196148196149196150196151196152196153196154196155196156196157196158196159196160196161196162196163196164196165196166196167196168196169196170196171196172196173196174196175196176196177196178196179196180196181196182196183196184196185196186196187196188196189196190196191196192196193196194196195196196196197196198196199196200196201196202196203196204196205196206196207196208196209196210196211196212196213196214196215196216196217196218196219196220196221196222196223196224196225196226196227196228196229196230196231196232196233196234196235196236196237196238196239196240196241196242196243196244196245196246196247196248196249196250196251196252196253196254196255196256196257196258196259196260196261196262196263196264196265196266196267196268196269196270196271196272196273196274196275196276196277196278196279196280196281196282196283196284196285196286196287196288196289196290196291196292196293196294196295196296196297196298196299196300196301196302196303196304196305196306196307196308196309196310196311196312196313196314196315196316196317196318196319196320196321196322196323196324196325196326196327196328196329196330196331196332196333196334196335196336196337196338196339196340196341196342196343196344196345196346196347196348196349196350196351196352196353196354196355196356196357196358196359196360196361196362196363196364196365196366196367196368196369196370196371196372196373196374196375196376196377196378196379196380196381196382196383196384196385196386196387196388196389196390196391196392196393196394196395196396196397196398196399196400196401196402196403196404196405196406196407196408196409196410196411196412196413196414196415196416196417196418196419196420196421196422196423196424196425196426196427196428196429196430196431196432196433196434196435196436196437196438196439196440196441196442196443196444196445196446196447196448196449196450196451196452196453196454196455196456196457196458196459196460196461196462196463196464196465196466196467196468196469196470196471196472196473196474196475196476196477196478196479196480196481196482196483196484196485196486196487196488196489196490196491196492196493196494196495196496196497196498196499196500196501196502196503196504196505196506196507196508196509196510196511196512196513196514196515196516196517196518196519196520196521196522196523196524196525196526196527196528196529196530196531196532196533196534196535196536196537196538196539196540196541196542196543196544196545196546196547196548196549196550196551196552196553196554196555196556196557196558196559196560196561196562196563196564196565196566196567196568196569196570196571196572196573196574196575196576196577196578196579196580196581196582196583196584196585196586196587196588196589196590196591196592196593196594196595196596196597196598196599196600196601196602196603196604196605196606196607196608196609196610196611196612196613196614196615196616196617196618196619196620196621196622196623196624196625196626196627196628196629196630196631196632196633196634196635196636196637196638196639196640196641196642196643196644196645196646196647196648196649196650196651196652196653196654196655196656196657196658196659196660196661196662196663196664196665196666196667196668196669196670196671196672196673196674196675196676196677196678196679196680196681196682196683196684196685196686196687196688196689196690196691196692196693196694196695196696196697196698196699196700196701196702196703196704196705196706196707196708196709196710196711196712196713196714196715196716196717196718196719196720196721196722196723196724196725196726196727196728196729196730196731196732196733196734196735196736196737196738196739196740196741196742196743196744196745196746196747196748196749196750196751196752196753196754196755196756196757196758196759196760196761196762196763196764196765196766196767196768196769196770196771196772196773196774196775196776196777196778196779196780196781196782196783196784196785196786196787196788196789196790196791196792196793196794196795196796196797196798196799196800196801196802196803196804196805196806196807196808196809196810196811196812196813196814196815196816196817196818196819196820196821196822196823196824196825196826196827196828196829196830196831196832196833196834196835196836196837196838196839196840196841196842196843196844196845196846196847196848196849196850196851196852196853196854196855196856196857196858196859196860196861196862196863196864196865196866196867196868196869196870196871196872196873196874196875196876196877196878196879196880196881196882196883196884196885196886196887196888196889196890196891196892196893196894196895196896196897196898196899196900196901196902196903196904196905196906196907196908196909196910196911196912196913196914196915196916196917196918196919196920196921196922196923196924196925196926196927196928196929196930196931196932196933196934196935196936196937196938196939196940196941196942196943196944196945196946196947196948196949196950196951196952196953196954196955196956196957196958196959196960196961196962196963196964196965196966196967196968196969196970196971196972196973196974196975196976196977196978196979196980196981196982196983196984196985196986196987196988196989196990196991196992196993196994196995196996196997196998196999197000197001197002197003197004197005197006197007197008197009197010197011197012197013197014197015197016197017197018197019197020197021197022197023197024197025197026197027197028197029197030197031197032197033197034197035197036197037197038197039197040197041197042197043197044197045197046197047197048197049197050197051197052197053197054197055197056197057197058197059197060197061197062197063197064197065197066197067197068197069197070197071197072197073197074197075197076197077197078197079197080197081197082197083197084197085197086197087197088197089197090197091197092197093197094197095197096197097197098197099197100197101197102197103197104197105197106197107197108197109197110197111197112197113197114197115197116197117197118197119197120197121197122197123197124197125197126197127197128197129197130197131197132197133197134197135197136197137197138197139197140197141197142197143197144197145197146197147197148197149197150197151197152197153197154197155197156197157197158197159197160197161197162197163197164197165197166197167197168197169197170197171197172197173197174197175197176197177197178197179197180197181197182197183197184197185197186197187197188197189197190197191197192197193197194197195197196197197197198197199197200197201197202197203197204197205197206197207197208197209197210197211197212197213197214197215197216197217197218197219197220197221197222197223197224197225197226197227197228197229197230197231197232197233197234197235197236197237197238197239197240197241197242197243197244197245197246197247197248197249197250197251197252197253197254197255197256197257197258197259197260197261197262197263197264197265197266197267197268197269197270197271197272197273197274197275197276197277197278197279197280197281197282197283197284197285197286197287197288197289197290197291197292197293197294197295197296197297197298197299197300197301197302197303197304197305197306197307197308197309197310197311197312197313197314197315197316197317197318197319197320197321197322197323197324197325197326197327197328197329197330197331197332197333197334197335197336197337197338197339197340197341197342197343197344197345197346197347197348197349197350197351197352197353197354197355197356197357197358197359197360197361197362197363197364197365197366197367197368197369197370197371197372197373197374197375197376197377197378197379197380197381197382197383197384197385197386197387197388197389197390197391197392197393197394197395197396197397197398197399197400197401197402197403197404197405197406197407197408197409197410197411197412197413197414197415197416197417197418197419197420197421197422197423197424197425197426197427197428197429197430197431197432197433197434197435197436197437197438197439197440197441197442197443197444197445197446197447197448197449197450197451197452197453197454197455197456197457197458197459197460197461197462197463197464197465197466197467197468197469197470197471197472197473197474197475197476197477197478197479197480197481197482197483197484197485197486197487197488197489197490197491197492197493197494197495197496197497197498197499197500197501197502197503197504197505197506197507197508197509197510197511197512197513197514197515197516197517197518197519197520197521197522197523197524197525197526197527197528197529197530197531197532197533197534197535197536197537197538197539197540197541197542197543197544197545197546197547197548197549197550197551197552197553197554197555197556197557197558197559197560197561197562197563197564197565197566197567197568197569197570197571197572197573197574197575197576197577197578197579197580197581197582197583197584197585197586197587197588197589197590197591197592197593197594197595197596197597197598197599197600197601197602197603197604197605197606197607197608197609197610197611197612197613197614197615197616197617197618197619197620197621197622197623197624197625197626197627197628197629197630197631197632197633197634197635197636197637197638197639197640197641197642197643197644197645197646197647197648197649197650197651197652197653197654197655197656197657197658197659197660197661197662197663197664197665197666197667197668197669197670197671197672197673197674197675197676197677197678197679197680197681197682197683197684197685197686197687197688197689197690197691197692197693197694197695197696197697197698197699197700197701197702197703197704197705197706197707197708197709197710197711197712197713197714197715197716197717197718197719197720197721197722197723197724197725197726197727197728197729197730197731197732197733197734197735197736197737197738197739197740197741197742197743197744197745197746197747197748197749197750197751197752197753197754197755197756197757197758197759197760197761197762197763197764197765197766197767197768197769197770197771197772197773197774197775197776197777197778197779197780197781197782197783197784197785197786197787197788197789197790197791197792197793197794197795197796197797197798197799197800197801197802197803197804197805197806197807197808197809197810197811197812197813197814197815197816197817197818197819197820197821197822197823197824197825197826197827197828197829197830197831197832197833197834197835197836197837197838197839197840197841197842197843197844197845197846197847197848197849197850197851197852197853197854197855197856197857197858197859197860197861197862197863197864197865197866197867197868197869197870197871197872197873197874197875197876197877197878197879197880197881197882197883197884197885197886197887197888197889197890197891197892197893197894197895197896197897197898197899197900197901197902197903197904197905197906197907197908197909197910197911197912197913197914197915197916197917197918197919197920197921197922197923197924197925197926197927197928197929197930197931197932197933197934197935197936197937197938197939197940197941197942197943197944197945197946197947197948197949197950197951197952197953197954197955197956197957197958197959197960197961197962197963197964197965197966197967197968197969197970197971197972197973197974197975197976197977197978197979197980197981197982197983197984197985197986197987197988197989197990197991197992197993197994197995197996197997197998197999198000198001198002198003198004198005198006198007198008198009198010198011198012198013198014198015198016198017198018198019198020198021198022198023198024198025198026198027198028198029198030198031198032198033198034198035198036198037198038198039198040198041198042198043198044198045198046198047198048198049198050198051198052198053198054198055198056198057198058198059198060198061198062198063198064198065198066198067198068198069198070198071198072198073198074198075198076198077198078198079198080198081198082198083198084198085198086198087198088198089198090198091198092198093198094198095198096198097198098198099198100198101198102198103198104198105198106198107198108198109198110198111198112198113198114198115198116198117198118198119198120198121198122198123198124198125198126198127198128198129198130198131198132198133198134198135198136198137198138198139198140198141198142198143198144198145198146198147198148198149198150198151198152198153198154198155198156198157198158198159198160198161198162198163198164198165198166198167198168198169198170198171198172198173198174198175198176198177198178198179198180198181198182198183198184198185198186198187198188198189198190198191198192198193198194198195198196198197198198198199198200198201198202198203198204198205198206198207198208198209198210198211198212198213198214198215198216198217198218198219198220198221198222198223198224198225198226198227198228198229198230198231198232198233198234198235198236198237198238198239198240198241198242198243198244198245198246198247198248198249198250198251198252198253198254198255198256198257198258198259198260198261198262198263198264198265198266198267198268198269198270198271198272198273198274198275198276198277198278198279198280198281198282198283198284198285198286198287198288198289198290198291198292198293198294198295198296198297198298198299198300198301198302198303198304198305198306198307198308198309198310198311198312198313198314198315198316198317198318198319198320198321198322198323198324198325198326198327198328198329198330198331198332198333198334198335198336198337198338198339198340198341198342198343198344198345198346198347198348198349198350198351198352198353198354198355198356198357198358198359198360198361198362198363198364198365198366198367198368198369198370198371198372198373198374198375198376198377198378198379198380198381198382198383198384198385198386198387198388198389198390198391198392198393198394198395198396198397198398198399198400198401198402198403198404198405198406198407198408198409198410198411198412198413198414198415198416198417198418198419198420198421198422198423198424198425198426198427198428198429198430198431198432198433198434198435198436198437198438198439198440198441198442198443198444198445198446198447198448198449198450198451198452198453198454198455198456198457198458198459198460198461198462198463198464198465198466198467198468198469198470198471198472198473198474198475198476198477198478198479198480198481198482198483198484198485198486198487198488198489198490198491198492198493198494198495198496198497198498198499198500198501198502198503198504198505198506198507198508198509198510198511198512198513198514198515198516198517198518198519198520198521198522198523198524198525198526198527198528198529198530198531198532198533198534198535198536198537198538198539198540198541198542198543198544198545198546198547198548198549198550198551198552198553198554198555198556198557198558198559198560198561198562198563198564198565198566198567198568198569198570198571198572198573198574198575198576198577198578198579198580198581198582198583198584198585198586198587198588198589198590198591198592198593198594198595198596198597198598198599198600198601198602198603198604198605198606198607198608198609198610198611198612198613198614198615198616198617198618198619198620198621198622198623198624198625198626198627198628198629198630198631198632198633198634198635198636198637198638198639198640198641198642198643198644198645198646198647198648198649198650198651198652198653198654198655198656198657198658198659198660198661198662198663198664198665198666198667198668198669198670198671198672198673198674198675198676198677198678198679198680198681198682198683198684198685198686198687198688198689198690198691198692198693198694198695198696198697198698198699198700198701198702198703198704198705198706198707198708198709198710198711198712198713198714198715198716198717198718198719198720198721198722198723198724198725198726198727198728198729198730198731198732198733198734198735198736198737198738198739198740198741198742198743198744198745198746198747198748198749198750198751198752198753198754198755198756198757198758198759198760198761198762198763198764198765198766198767198768198769198770198771198772198773198774198775198776198777198778198779198780198781198782198783198784198785198786198787198788198789198790198791198792198793198794198795198796198797198798198799198800198801198802198803198804198805198806198807198808198809198810198811198812198813198814198815198816198817198818198819198820198821198822198823198824198825198826198827198828198829198830198831198832198833198834198835198836198837198838198839198840198841198842198843198844198845198846198847198848198849198850198851198852198853198854198855198856198857198858198859198860198861198862198863198864198865198866198867198868198869198870198871198872198873198874198875198876198877198878198879198880198881198882198883198884198885198886198887198888198889198890198891198892198893198894198895198896198897198898198899198900198901198902198903198904198905198906198907198908198909198910198911198912198913198914198915198916198917198918198919198920198921198922198923198924198925198926198927198928198929198930198931198932198933198934198935198936198937198938198939198940198941198942198943198944198945198946198947198948198949198950198951198952198953198954198955198956198957198958198959198960198961198962198963198964198965198966198967198968198969198970198971198972198973198974198975198976198977198978198979198980198981198982198983198984198985198986198987198988198989198990198991198992198993198994198995198996198997198998198999199000199001199002199003199004199005199006199007199008199009199010199011199012199013199014199015199016199017199018199019199020199021199022199023199024199025199026199027199028199029199030199031199032199033199034199035199036199037199038199039199040199041199042199043199044199045199046199047199048199049199050199051199052199053199054199055199056199057199058199059199060199061199062199063199064199065199066199067199068199069199070199071199072199073199074199075199076199077199078199079199080199081199082199083199084199085199086199087199088199089199090199091199092199093199094199095199096199097199098199099199100199101199102199103199104199105199106199107199108199109199110199111199112199113199114199115199116199117199118199119199120199121199122199123199124199125199126199127199128199129199130199131199132199133199134199135199136199137199138199139199140199141199142199143199144199145199146199147199148199149199150199151199152199153199154199155199156199157199158199159199160199161199162199163199164199165199166199167199168199169199170199171199172199173199174199175199176199177199178199179199180199181199182199183199184199185199186199187199188199189199190199191199192199193199194199195199196199197199198199199199200199201199202199203199204199205199206199207199208199209199210199211199212199213199214199215199216199217199218199219199220199221199222199223199224199225199226199227199228199229199230199231199232199233199234199235199236199237199238199239199240199241199242199243199244199245199246199247199248199249199250199251199252199253199254199255199256199257199258199259199260199261199262199263199264199265199266199267199268199269199270199271199272199273199274199275199276199277199278199279199280199281199282199283199284199285199286199287199288199289199290199291199292199293199294199295199296199297199298199299199300199301199302199303199304199305199306199307199308199309199310199311199312199313199314199315199316199317199318199319199320199321199322199323199324199325199326199327199328199329199330199331199332199333199334199335199336199337199338199339199340199341199342199343199344199345199346199347199348199349199350199351199352199353199354199355199356199357199358199359199360199361199362199363199364199365199366199367199368199369199370199371199372199373199374199375199376199377199378199379199380199381199382199383199384199385199386199387199388199389199390199391199392199393199394199395199396199397199398199399199400199401199402199403199404199405199406199407199408199409199410199411199412199413199414199415199416199417199418199419199420199421199422199423199424199425199426199427199428199429199430199431199432199433199434199435199436199437199438199439199440199441199442199443199444199445199446199447199448199449199450199451199452199453199454199455199456199457199458199459199460199461199462199463199464199465199466199467199468199469199470199471199472199473199474199475199476199477199478199479199480199481199482199483199484199485199486199487199488199489199490199491199492199493199494199495199496199497199498199499199500199501199502199503199504199505199506199507199508199509199510199511199512199513199514199515199516199517199518199519199520199521199522199523199524199525199526199527199528199529199530199531199532199533199534199535199536199537199538199539199540199541199542199543199544199545199546199547199548199549199550199551199552199553199554199555199556199557199558199559199560199561199562199563199564199565199566199567199568199569199570199571199572199573199574199575199576199577199578199579199580199581199582199583199584199585199586199587199588199589199590199591199592199593199594199595199596199597199598199599199600199601199602199603199604199605199606199607199608199609199610199611199612199613199614199615199616199617199618199619199620199621199622199623199624199625199626199627199628199629199630199631199632199633199634199635199636199637199638199639199640199641199642199643199644199645199646199647199648199649199650199651199652199653199654199655199656199657199658199659199660199661199662199663199664199665199666199667199668199669199670199671199672199673199674199675199676199677199678199679199680199681199682199683199684199685199686199687199688199689199690199691199692199693199694199695199696199697199698199699199700199701199702199703199704199705199706199707199708199709199710199711199712199713199714199715199716199717199718199719199720199721199722199723199724199725199726199727199728199729199730199731199732199733199734199735199736199737199738199739199740199741199742199743199744199745199746199747199748199749199750199751199752199753199754199755199756199757199758199759199760199761199762199763199764199765199766199767199768199769199770199771199772199773199774199775199776199777199778199779199780199781199782199783199784199785199786199787199788199789199790199791199792199793199794199795199796199797199798199799199800199801199802199803199804199805199806199807199808199809199810199811199812199813199814199815199816199817199818199819199820199821199822199823199824199825199826199827199828199829199830199831199832199833199834199835199836199837199838199839199840199841199842199843199844199845199846199847199848199849199850199851199852199853199854199855199856199857199858199859199860199861199862199863199864199865199866199867199868199869199870199871199872199873199874199875199876199877199878199879199880199881199882199883199884199885199886199887199888199889199890199891199892199893199894199895199896199897199898199899199900199901199902199903199904199905199906199907199908199909199910199911199912199913199914199915199916199917199918199919199920199921199922199923199924199925199926199927199928199929199930199931199932199933199934199935199936199937199938199939199940199941199942199943199944199945199946199947199948199949199950199951199952199953199954199955199956199957199958199959199960199961199962199963199964199965199966199967199968199969199970199971199972199973199974199975199976199977199978199979199980199981199982199983199984199985199986199987199988199989199990199991199992199993199994199995199996199997199998199999200000200001200002200003200004200005200006200007200008200009200010200011200012200013200014200015200016200017200018200019200020200021200022200023200024200025200026200027200028200029200030200031200032200033200034200035200036200037200038200039200040200041200042200043200044200045200046200047200048200049200050200051200052200053200054200055200056200057200058200059200060200061200062200063200064200065200066200067200068200069200070200071200072200073200074200075200076200077200078200079200080200081200082200083200084200085200086200087200088200089200090200091200092200093200094200095200096200097200098200099200100200101200102200103200104200105200106200107200108200109200110200111200112200113200114200115200116200117200118200119200120200121200122200123200124200125200126200127200128200129200130200131200132200133200134200135200136200137200138200139200140200141200142200143200144200145200146200147200148200149200150200151200152200153200154200155200156200157200158200159200160200161200162200163200164200165200166200167200168200169200170200171200172200173200174200175200176200177200178200179200180200181200182200183200184200185200186200187200188200189200190200191200192200193200194200195200196200197200198200199200200200201200202200203200204200205200206200207200208200209200210200211200212200213200214200215200216200217200218200219200220200221200222200223200224200225200226200227200228200229200230200231200232200233200234200235200236200237200238200239200240200241200242200243200244200245200246200247200248200249200250200251200252200253200254200255200256200257200258200259200260200261200262200263200264200265200266200267200268200269200270200271200272200273200274200275200276200277200278200279200280200281200282200283200284200285200286200287200288200289200290200291200292200293200294200295200296200297200298200299200300200301200302200303200304200305200306200307200308200309200310200311200312200313200314200315200316200317200318200319200320200321200322200323200324200325200326200327200328200329200330200331200332200333200334200335200336200337200338200339200340200341200342200343200344200345200346200347200348200349200350200351200352200353200354200355200356200357200358200359200360200361200362200363200364200365200366200367200368200369200370200371200372200373200374200375200376200377200378200379200380200381200382200383200384200385200386200387200388200389200390200391200392200393200394200395200396200397200398200399200400200401200402200403200404200405200406200407200408200409200410200411200412200413200414200415200416200417200418200419200420200421200422200423200424200425200426200427200428200429200430200431200432200433200434200435200436200437200438200439200440200441200442200443200444200445200446200447200448200449200450200451200452200453200454200455200456200457200458200459200460200461200462200463200464200465200466200467200468200469200470200471200472200473200474200475200476200477200478200479200480200481200482200483200484200485200486200487200488200489200490200491200492200493200494200495200496200497200498200499200500200501200502200503200504200505200506200507200508200509200510200511200512200513200514200515200516200517200518200519200520200521200522200523200524200525200526200527200528200529200530200531200532200533200534200535200536200537200538200539200540200541200542200543200544200545200546200547200548200549200550200551200552200553200554200555200556200557200558200559200560200561200562200563200564200565200566200567200568200569200570200571200572200573200574200575200576200577200578200579200580200581200582200583200584200585200586200587200588200589200590200591200592200593200594200595200596200597200598200599200600200601200602200603200604200605200606200607200608200609200610200611200612200613200614200615200616200617200618200619200620200621200622200623200624200625200626200627200628200629200630200631200632200633200634200635200636200637200638200639200640200641200642200643200644200645200646200647200648200649200650200651200652200653200654200655200656200657200658200659200660200661200662200663200664200665200666200667200668200669200670200671200672200673200674200675200676200677200678200679200680200681200682200683200684200685200686200687200688200689200690200691200692200693200694200695200696200697200698200699200700200701200702200703200704200705200706200707200708200709200710200711200712200713200714200715200716200717200718200719200720200721200722200723200724200725200726200727200728200729200730200731200732200733200734200735200736200737200738200739200740200741200742200743200744200745200746200747200748200749200750200751200752200753200754200755200756200757200758200759200760200761200762200763200764200765200766200767200768200769200770200771200772200773200774200775200776200777200778200779200780200781200782200783200784200785200786200787200788200789200790200791200792200793200794200795200796200797200798200799200800200801200802200803200804200805200806200807200808200809200810200811200812200813200814200815200816200817200818200819200820200821200822200823200824200825200826200827200828200829200830200831200832200833200834200835200836200837200838200839200840200841200842200843200844200845200846200847200848200849200850200851200852200853200854200855200856200857200858200859200860200861200862200863200864200865200866200867200868200869200870200871200872200873200874200875200876200877200878200879200880200881200882200883200884200885200886200887200888200889200890200891200892200893200894200895200896200897200898200899200900200901200902200903200904200905200906200907200908200909200910200911200912200913200914200915200916200917200918200919200920200921200922200923200924200925200926200927200928200929200930200931200932200933200934200935200936200937200938200939200940200941200942200943200944200945200946200947200948200949200950200951200952200953200954200955200956200957200958200959200960200961200962200963200964200965200966200967200968200969200970200971200972200973200974200975200976200977200978200979200980200981200982200983200984200985200986200987200988200989200990200991200992200993200994200995200996200997200998200999201000201001201002201003201004201005201006201007201008201009201010201011201012201013201014201015201016201017201018201019201020201021201022201023201024201025201026201027201028201029201030201031201032201033201034201035201036201037201038201039201040201041201042201043201044201045201046201047201048201049201050201051201052201053201054201055201056201057201058201059201060201061201062201063201064201065201066201067201068201069201070201071201072201073201074201075201076201077201078201079201080201081201082201083201084201085201086201087201088201089201090201091201092201093201094201095201096201097201098201099201100201101201102201103201104201105201106201107201108201109201110201111201112201113201114201115201116201117201118201119201120201121201122201123201124201125201126201127201128201129201130201131201132201133201134201135201136201137201138201139201140201141201142201143201144201145201146201147201148201149201150201151201152201153201154201155201156201157201158201159201160201161201162201163201164201165201166201167201168201169201170201171201172201173201174201175201176201177201178201179201180201181201182201183201184201185201186201187201188201189201190201191201192201193201194201195201196201197201198201199201200201201201202201203201204201205201206201207201208201209201210201211201212201213201214201215201216201217201218201219201220201221201222201223201224201225201226201227201228201229201230201231201232201233201234201235201236201237201238201239201240201241201242201243201244201245201246201247201248201249201250201251201252201253201254201255201256201257201258201259201260201261201262201263201264201265201266201267201268201269201270201271201272201273201274201275201276201277201278201279201280201281201282201283201284201285201286201287201288201289201290201291201292201293201294201295201296201297201298201299201300201301201302201303201304201305201306201307201308201309201310201311201312201313201314201315201316201317201318201319201320201321201322201323201324201325201326201327201328201329201330201331201332201333201334201335201336201337201338201339201340201341201342201343201344201345201346201347201348201349201350201351201352201353201354201355201356201357201358201359201360201361201362201363201364201365201366201367201368201369201370201371201372201373201374201375201376201377201378201379201380201381201382201383201384201385201386201387201388201389201390201391201392201393201394201395201396201397201398201399201400201401201402201403201404201405201406201407201408201409201410201411201412201413201414201415201416201417201418201419201420201421201422201423201424201425201426201427201428201429201430201431201432201433201434201435201436201437201438201439201440201441201442201443201444201445201446201447201448201449201450201451201452201453201454201455201456201457201458201459201460201461201462201463201464201465201466201467201468201469201470201471201472201473201474201475201476201477201478201479201480201481201482201483201484201485201486201487201488201489201490201491201492201493201494201495201496201497201498201499201500201501201502201503201504201505201506201507201508201509201510201511201512201513201514201515201516201517201518201519201520201521201522201523201524201525201526201527201528201529201530201531201532201533201534201535201536201537201538201539201540201541201542201543201544201545201546201547201548201549201550201551201552201553201554201555201556201557201558201559201560201561201562201563201564201565201566201567201568201569201570201571201572201573201574201575201576201577201578201579201580201581201582201583201584201585201586201587201588201589201590201591201592201593201594201595201596201597201598201599201600201601201602201603201604201605201606201607201608201609201610201611201612201613201614201615201616201617201618201619201620201621201622201623201624201625201626201627201628201629201630201631201632201633201634201635201636201637201638201639201640201641201642201643201644201645201646201647201648201649201650201651201652201653201654201655201656201657201658201659201660201661201662201663201664201665201666201667201668201669201670201671201672201673201674201675201676201677201678201679201680201681201682201683201684201685201686201687201688201689201690201691201692201693201694201695201696201697201698201699201700201701201702201703201704201705201706201707201708201709201710201711201712201713201714201715201716201717201718201719201720201721201722201723201724201725201726201727201728201729201730201731201732201733201734201735201736201737201738201739201740201741201742201743201744201745201746201747201748201749201750201751201752201753201754201755201756201757201758201759201760201761201762201763201764201765201766201767201768201769201770201771201772201773201774201775201776201777201778201779201780201781201782201783201784201785201786201787201788201789201790201791201792201793201794201795201796201797201798201799201800201801201802201803201804201805201806201807201808201809201810201811201812201813201814201815201816201817201818201819201820201821201822201823201824201825201826201827201828201829201830201831201832201833201834201835201836201837201838201839201840201841201842201843201844201845201846201847201848201849201850201851201852201853201854201855201856201857201858201859201860201861201862201863201864201865201866201867201868201869201870201871201872201873201874201875201876201877201878201879201880201881201882201883201884201885201886201887201888201889201890201891201892201893201894201895201896201897201898201899201900201901201902201903201904201905201906201907201908201909201910201911201912201913201914201915201916201917201918201919201920201921201922201923201924201925201926201927201928201929201930201931201932201933201934201935201936201937201938201939201940201941201942201943201944201945201946201947201948201949201950201951201952201953201954201955201956201957201958201959201960201961201962201963201964201965201966201967201968201969201970201971201972201973201974201975201976201977201978201979201980201981201982201983201984201985201986201987201988201989201990201991201992201993201994201995201996201997201998201999202000202001202002202003202004202005202006202007202008202009202010202011202012202013202014202015202016202017202018202019202020202021202022202023202024202025202026202027202028202029202030202031202032202033202034202035202036202037202038202039202040202041202042202043202044202045202046202047202048202049202050202051202052202053202054202055202056202057202058202059202060202061202062202063202064202065202066202067202068202069202070202071202072202073202074202075202076202077202078202079202080202081202082202083202084202085202086202087202088202089202090202091202092202093202094202095202096202097202098202099202100202101202102202103202104202105202106202107202108202109202110202111202112202113202114202115202116202117202118202119202120202121202122202123202124202125202126202127202128202129202130202131202132202133202134202135202136202137202138202139202140202141202142202143202144202145202146202147202148202149202150202151202152202153202154202155202156202157202158202159202160202161202162202163202164202165202166202167202168202169202170202171202172202173202174202175202176202177202178202179202180202181202182202183202184202185202186202187202188202189202190202191202192202193202194202195202196202197202198202199202200202201202202202203202204202205202206202207202208202209202210202211202212202213202214202215202216202217202218202219202220202221202222202223202224202225202226202227202228202229202230202231202232202233202234202235202236202237202238202239202240202241202242202243202244202245202246202247202248202249202250202251202252202253202254202255202256202257202258202259202260202261202262202263202264202265202266202267202268202269202270202271202272202273202274202275202276202277202278202279202280202281202282202283202284202285202286202287202288202289202290202291202292202293202294202295202296202297202298202299202300202301202302202303202304202305202306202307202308202309202310202311202312202313202314202315202316202317202318202319202320202321202322202323202324202325202326202327202328202329202330202331202332202333202334202335202336202337202338202339202340202341202342202343202344202345202346202347202348202349202350202351202352202353202354202355202356202357202358202359202360202361202362202363202364202365202366202367202368202369202370202371202372202373202374202375202376202377202378202379202380202381202382202383202384202385202386202387202388202389202390202391202392202393202394202395202396202397202398202399202400202401202402202403202404202405202406202407202408202409202410202411202412202413202414202415202416202417202418202419202420202421202422202423202424202425202426202427202428202429202430202431202432202433202434202435202436202437202438202439202440202441202442202443202444202445202446202447202448202449202450202451202452202453202454202455202456202457202458202459202460202461202462202463202464202465202466202467202468202469202470202471202472202473202474202475202476202477202478202479202480202481202482202483202484202485202486202487202488202489202490202491202492202493202494202495202496202497202498202499202500202501202502202503202504202505202506202507202508202509202510202511202512202513202514202515202516202517202518202519202520202521202522202523202524202525202526202527202528202529202530202531202532202533202534202535202536202537202538202539202540202541202542202543202544202545202546202547202548202549202550202551202552202553202554202555202556202557202558202559202560202561202562202563202564202565202566202567202568202569202570202571202572202573202574202575202576202577202578202579202580202581202582202583202584202585202586202587202588202589202590202591202592202593202594202595202596202597202598202599202600202601202602202603202604202605202606202607202608202609202610202611202612202613202614202615202616202617202618202619202620202621202622202623202624202625202626202627202628202629202630202631202632202633202634202635202636202637202638202639202640202641202642202643202644202645202646202647202648202649202650202651202652202653202654202655202656202657202658202659202660202661202662202663202664202665202666202667202668202669202670202671202672202673202674202675202676202677202678202679202680202681202682202683202684202685202686202687202688202689202690202691202692202693202694202695202696202697202698202699202700202701202702202703202704202705202706202707202708202709202710202711202712202713202714202715202716202717202718202719202720202721202722202723202724202725202726202727202728202729202730202731202732202733202734202735202736202737202738202739202740202741202742202743202744202745202746202747202748202749202750202751202752202753202754202755202756202757202758202759202760202761202762202763202764202765202766202767202768202769202770202771202772202773202774202775202776202777202778202779202780202781202782202783202784202785202786202787202788202789202790202791202792202793202794202795202796202797202798202799202800202801202802202803202804202805202806202807202808202809202810202811202812202813202814202815202816202817202818202819202820202821202822202823202824202825202826202827202828202829202830202831202832202833202834202835202836202837202838202839202840202841202842202843202844202845202846202847202848202849202850202851202852202853202854202855202856202857202858202859202860202861202862202863202864202865202866202867202868202869202870202871202872202873202874202875202876202877202878202879202880202881202882202883202884202885202886202887202888202889202890202891202892202893202894202895202896202897202898202899202900202901202902202903202904202905202906202907202908202909202910202911202912202913202914202915202916202917202918202919202920202921202922202923202924202925202926202927202928202929202930202931202932202933202934202935202936202937202938202939202940202941202942202943202944202945202946202947202948202949202950202951202952202953202954202955202956202957202958202959202960202961202962202963202964202965202966202967202968202969202970202971202972202973202974202975202976202977202978202979202980202981202982202983202984202985202986202987202988202989202990202991202992202993202994202995202996202997202998202999203000203001203002203003203004203005203006203007203008203009203010203011203012203013203014203015203016203017203018203019203020203021203022203023203024203025203026203027203028203029203030203031203032203033203034203035203036203037203038203039203040203041203042203043203044203045203046203047203048203049203050203051203052203053203054203055203056203057203058203059203060203061203062203063203064203065203066203067203068203069203070203071203072203073203074203075203076203077203078203079203080203081203082203083203084203085203086203087203088203089203090203091203092203093203094203095203096203097203098203099203100203101203102203103203104203105203106203107203108203109203110203111203112203113203114203115203116203117203118203119203120203121203122203123203124203125203126203127203128203129203130203131203132203133203134203135203136203137203138203139203140203141203142203143203144203145203146203147203148203149203150203151203152203153203154203155203156203157203158203159203160203161203162203163203164203165203166203167203168203169203170203171203172203173203174203175203176203177203178203179203180203181203182203183203184203185203186203187203188203189203190203191203192203193203194203195203196203197203198203199203200203201203202203203203204203205203206203207203208203209203210203211203212203213203214203215203216203217203218203219203220203221203222203223203224203225203226203227203228203229203230203231203232203233203234203235203236203237203238203239203240203241203242203243203244203245203246203247203248203249203250203251203252203253203254203255203256203257203258203259203260203261203262203263203264203265203266203267203268203269203270203271203272203273203274203275203276203277203278203279203280203281203282203283203284203285203286203287203288203289203290203291203292203293203294203295203296203297203298203299203300203301203302203303203304203305203306203307203308203309203310203311203312203313203314203315203316203317203318203319203320203321203322203323203324203325203326203327203328203329203330203331203332203333203334203335203336203337203338203339203340203341203342203343203344203345203346203347203348203349203350203351203352203353203354203355203356203357203358203359203360203361203362203363203364203365203366203367203368203369203370203371203372203373203374203375203376203377203378203379203380203381203382203383203384203385203386203387203388203389203390203391203392203393203394203395203396203397203398203399203400203401203402203403203404203405203406203407203408203409203410203411203412203413203414203415203416203417203418203419203420203421203422203423203424203425203426203427203428203429203430203431203432203433203434203435203436203437203438203439203440203441203442203443203444203445203446203447203448203449203450203451203452203453203454203455203456203457203458203459203460203461203462203463203464203465203466203467203468203469203470203471203472203473203474203475203476203477203478203479203480203481203482203483203484203485203486203487203488203489203490203491203492203493203494203495203496203497203498203499203500203501203502203503203504203505203506203507203508203509203510203511203512203513203514203515203516203517203518203519203520203521203522203523203524203525203526203527203528203529203530203531203532203533203534203535203536203537203538203539203540203541203542203543203544203545203546203547203548203549203550203551203552203553203554203555203556203557203558203559203560203561203562203563203564203565203566203567203568203569203570203571203572203573203574203575203576203577203578203579203580203581203582203583203584203585203586203587203588203589203590203591203592203593203594203595203596203597203598203599203600203601203602203603203604203605203606203607203608203609203610203611203612203613203614203615203616203617203618203619203620203621203622203623203624203625203626203627203628203629203630203631203632203633203634203635203636203637203638203639203640203641203642203643203644203645203646203647203648203649203650203651203652203653203654203655203656203657203658203659203660203661203662203663203664203665203666203667203668203669203670203671203672203673203674203675203676203677203678203679203680203681203682203683203684203685203686203687203688203689203690203691203692203693203694203695203696203697203698203699203700203701203702203703203704203705203706203707203708203709203710203711203712203713203714203715203716203717203718203719203720203721203722203723203724203725203726203727203728203729203730203731203732203733203734203735203736203737203738203739203740203741203742203743203744203745203746203747203748203749203750203751203752203753203754203755203756203757203758203759203760203761203762203763203764203765203766203767203768203769203770203771203772203773203774203775203776203777203778203779203780203781203782203783203784203785203786203787203788203789203790203791203792203793203794203795203796203797203798203799203800203801203802203803203804203805203806203807203808203809203810203811203812203813203814203815203816203817203818203819203820203821203822203823203824203825203826203827203828203829203830203831203832203833203834203835203836203837203838203839203840203841203842203843203844203845203846203847203848203849203850203851203852203853203854203855203856203857203858203859203860203861203862203863203864203865203866203867203868203869203870203871203872203873203874203875203876203877203878203879203880203881203882203883203884203885203886203887203888203889203890203891203892203893203894203895203896203897203898203899203900203901203902203903203904203905203906203907203908203909203910203911203912203913203914203915203916203917203918203919203920203921203922203923203924203925203926203927203928203929203930203931203932203933203934203935203936203937203938203939203940203941203942203943203944203945203946203947203948203949203950203951203952203953203954203955203956203957203958203959203960203961203962203963203964203965203966203967203968203969203970203971203972203973203974203975203976203977203978203979203980203981203982203983203984203985203986203987203988203989203990203991203992203993203994203995203996203997203998203999204000204001204002204003204004204005204006204007204008204009204010204011204012204013204014204015204016204017204018204019204020204021204022204023204024204025204026204027204028204029204030204031204032204033204034204035204036204037204038204039204040204041204042204043204044204045204046204047204048204049204050204051204052204053204054204055204056204057204058204059204060204061204062204063204064204065204066204067204068204069204070204071204072204073204074204075204076204077204078204079204080204081204082204083204084204085204086204087204088204089204090204091204092204093204094204095204096204097204098204099204100204101204102204103204104204105204106204107204108204109204110204111204112204113204114204115204116204117204118204119204120204121204122204123204124204125204126204127204128204129204130204131204132204133204134204135204136204137204138204139204140204141204142204143204144204145204146204147204148204149204150204151204152204153204154204155204156204157204158204159204160204161204162204163204164204165204166204167204168204169204170204171204172204173204174204175204176204177204178204179204180204181204182204183204184204185204186204187204188204189204190204191204192204193204194204195204196204197204198204199204200204201204202204203204204204205204206204207204208204209204210204211204212204213204214204215204216204217204218204219204220204221204222204223204224204225204226204227204228204229204230204231204232204233204234204235204236204237204238204239204240204241204242204243204244204245204246204247204248204249204250204251204252204253204254204255204256204257204258204259204260204261204262204263204264204265204266204267204268204269204270204271204272204273204274204275204276204277204278204279204280204281204282204283204284204285204286204287204288204289204290204291204292204293204294204295204296204297204298204299204300204301204302204303204304204305204306204307204308204309204310204311204312204313204314204315204316204317204318204319204320204321204322204323204324204325204326204327204328204329204330204331204332204333204334204335204336204337204338204339204340204341204342204343204344204345204346204347204348204349204350204351204352204353204354204355204356204357204358204359204360204361204362204363204364204365204366204367204368204369204370204371204372204373204374204375204376204377204378204379204380204381204382204383204384204385204386204387204388204389204390204391204392204393204394204395204396204397204398204399204400204401204402204403204404204405204406204407204408204409204410204411204412204413204414204415204416204417204418204419204420204421204422204423204424204425204426204427204428204429204430204431204432204433204434204435204436204437204438204439204440204441204442204443204444204445204446204447204448204449204450204451204452204453204454204455204456204457204458204459204460204461204462204463204464204465204466204467204468204469204470204471204472204473204474204475204476204477204478204479204480204481204482204483204484204485204486204487204488204489204490204491204492204493204494204495204496204497204498204499204500204501204502204503204504204505204506204507204508204509204510204511204512204513204514204515204516204517204518204519204520204521204522204523204524204525204526204527204528204529204530204531204532204533204534204535204536204537204538204539204540204541204542204543204544204545204546204547204548204549204550204551204552204553204554204555204556204557204558204559204560204561204562204563204564204565204566204567204568204569204570204571204572204573204574204575204576204577204578204579204580204581204582204583204584204585204586204587204588204589204590204591204592204593204594204595204596204597204598204599204600204601204602204603204604204605204606204607204608204609204610204611204612204613204614204615204616204617204618204619204620204621204622204623204624204625204626204627204628204629204630204631204632204633204634204635204636204637204638204639204640204641204642204643204644204645204646204647204648204649204650204651204652204653204654204655204656204657204658204659204660204661204662204663204664204665204666204667204668204669204670204671204672204673204674204675204676204677204678204679204680204681204682204683204684204685204686204687204688204689204690204691204692204693204694204695204696204697204698204699204700204701204702204703204704204705204706204707204708204709204710204711204712204713204714204715204716204717204718204719204720204721204722204723204724204725204726204727204728204729204730204731204732204733204734204735204736204737204738204739204740204741204742204743204744204745204746204747204748204749204750204751204752204753204754204755204756204757204758204759204760204761204762204763204764204765204766204767204768204769204770204771204772204773204774204775204776204777204778204779204780204781204782204783204784204785204786204787204788204789204790204791204792204793204794204795204796204797204798204799204800204801204802204803204804204805204806204807204808204809204810204811204812204813204814204815204816204817204818204819204820204821204822204823204824204825204826204827204828204829204830204831204832204833204834204835204836204837204838204839204840204841204842204843204844204845204846204847204848204849204850204851204852204853204854204855204856204857204858204859204860204861204862204863204864204865204866204867204868204869204870204871204872204873204874204875204876204877204878204879204880204881204882204883204884204885204886204887204888204889204890204891204892204893204894204895204896204897204898204899204900204901204902204903204904204905204906204907204908204909204910204911204912204913204914204915204916204917204918204919204920204921204922204923204924204925204926204927204928204929204930204931204932204933204934204935204936204937204938204939204940204941204942204943204944204945204946204947204948204949204950204951204952204953204954204955204956204957204958204959204960204961204962204963204964204965204966204967204968204969204970204971204972204973204974204975204976204977204978204979204980204981204982204983204984204985204986204987204988204989204990204991204992204993204994204995204996204997204998204999205000205001205002205003205004205005205006205007205008205009205010205011205012205013205014205015205016205017205018205019205020205021205022205023205024205025205026205027205028205029205030205031205032205033205034205035205036205037205038205039205040205041205042205043205044205045205046205047205048205049205050205051205052205053205054205055205056205057205058205059205060205061205062205063205064205065205066205067205068205069205070205071205072205073205074205075205076205077205078205079205080205081205082205083205084205085205086205087205088205089205090205091205092205093205094205095205096205097205098205099205100205101205102205103205104205105205106205107205108205109205110205111205112205113205114205115205116205117205118205119205120205121205122205123205124205125205126205127205128205129205130205131205132205133205134205135205136205137205138205139205140205141205142205143205144205145205146205147205148205149205150205151205152205153205154205155205156205157205158205159205160205161205162205163205164205165205166205167205168205169205170205171205172205173205174205175205176205177205178205179205180205181205182205183205184205185205186205187205188205189205190205191205192205193205194205195205196205197205198205199205200205201205202205203205204205205205206205207205208205209205210205211205212205213205214205215205216205217205218205219205220205221205222205223205224205225205226205227205228205229205230205231205232205233205234205235205236205237205238205239205240205241205242205243205244205245205246205247205248205249205250205251205252205253205254205255205256205257205258205259205260205261205262205263205264205265205266205267205268205269205270205271205272205273205274205275205276205277205278205279205280205281205282205283205284205285205286205287205288205289205290205291205292205293205294205295205296205297205298205299205300205301205302205303205304205305205306205307205308205309205310205311205312205313205314205315205316205317205318205319205320205321205322205323205324205325205326205327205328205329205330205331205332205333205334205335205336205337205338205339205340205341205342205343205344205345205346205347205348205349205350205351205352205353205354205355205356205357205358205359205360205361205362205363205364205365205366205367205368205369205370205371205372205373205374205375205376205377205378205379205380205381205382205383205384205385205386205387205388205389205390205391205392205393205394205395205396205397205398205399205400205401205402205403205404205405205406205407205408205409205410205411205412205413205414205415205416205417205418205419205420205421205422205423205424205425205426205427205428205429205430205431205432205433205434205435205436205437205438205439205440205441205442205443205444205445205446205447205448205449205450205451205452205453205454205455205456205457205458205459205460205461205462205463205464205465205466205467205468205469205470205471205472205473205474205475205476205477205478205479205480205481205482205483205484205485205486205487205488205489205490205491205492205493205494205495205496205497205498205499205500205501205502205503205504205505205506205507205508205509205510205511205512205513205514205515205516205517205518205519205520205521205522205523205524205525205526205527205528205529205530205531205532205533205534205535205536205537205538205539205540205541205542205543205544205545205546205547205548205549205550205551205552205553205554205555205556205557205558205559205560205561205562205563205564205565205566205567205568205569205570205571205572205573205574205575205576205577205578205579205580205581205582205583205584205585205586205587205588205589205590205591205592205593205594205595205596205597205598205599205600205601205602205603205604205605205606205607205608205609205610205611205612205613205614205615205616205617205618205619205620205621205622205623205624205625205626205627205628205629205630205631205632205633205634205635205636205637205638205639205640205641205642205643205644205645205646205647205648205649205650205651205652205653205654205655205656205657205658205659205660205661205662205663205664205665205666205667205668205669205670205671205672205673205674205675205676205677205678205679205680205681205682205683205684205685205686205687205688205689205690205691205692205693205694205695205696205697205698205699205700205701205702205703205704205705205706205707205708205709205710205711205712205713205714205715205716205717205718205719205720205721205722205723205724205725205726205727205728205729205730205731205732205733205734205735205736205737205738205739205740205741205742205743205744205745205746205747205748205749205750205751205752205753205754205755205756205757205758205759205760205761205762205763205764205765205766205767205768205769205770205771205772205773205774205775205776205777205778205779205780205781205782205783205784205785205786205787205788205789205790205791205792205793205794205795205796205797205798205799205800205801205802205803205804205805205806205807205808205809205810205811205812205813205814205815205816205817205818205819205820205821205822205823205824205825205826205827205828205829205830205831205832205833205834205835205836205837205838205839205840205841205842205843205844205845205846205847205848205849205850205851205852205853205854205855205856205857205858205859205860205861205862205863205864205865205866205867205868205869205870205871205872205873205874205875205876205877205878205879205880205881205882205883205884205885205886205887205888205889205890205891205892205893205894205895205896205897205898205899205900205901205902205903205904205905205906205907205908205909205910205911205912205913205914205915205916205917205918205919205920205921205922205923205924205925205926205927205928205929205930205931205932205933205934205935205936205937205938205939205940205941205942205943205944205945205946205947205948205949205950205951205952205953205954205955205956205957205958205959205960205961205962205963205964205965205966205967205968205969205970205971205972205973205974205975205976205977205978205979205980205981205982205983205984205985205986205987205988205989205990205991205992205993205994205995205996205997205998205999206000206001206002206003206004206005206006206007206008206009206010206011206012206013206014206015206016206017206018206019206020206021206022206023206024206025206026206027206028206029206030206031206032206033206034206035206036206037206038206039206040206041206042206043206044206045206046206047206048206049206050206051206052206053206054206055206056206057206058206059206060206061206062206063206064206065206066206067206068206069206070206071206072206073206074206075206076206077206078206079206080206081206082206083206084206085206086206087206088206089206090206091206092206093206094206095206096206097206098206099206100206101206102206103206104206105206106206107206108206109206110206111206112206113206114206115206116206117206118206119206120206121206122206123206124206125206126206127206128206129206130206131206132206133206134206135206136206137206138206139206140206141206142206143206144206145206146206147206148206149206150206151206152206153206154206155206156206157206158206159206160206161206162206163206164206165206166206167206168206169206170206171206172206173206174206175206176206177206178206179206180206181206182206183206184206185206186206187206188206189206190206191206192206193206194206195206196206197206198206199206200206201206202206203206204206205206206206207206208206209206210206211206212206213206214206215206216206217206218206219206220206221206222206223206224206225206226206227206228206229206230206231206232206233206234206235206236206237206238206239206240206241206242206243206244206245206246206247206248206249206250206251206252206253206254206255206256206257206258206259206260206261206262206263206264206265206266206267206268206269206270206271206272206273206274206275206276206277206278206279206280206281206282206283206284206285206286206287206288206289206290206291206292206293206294206295206296206297206298206299206300206301206302206303206304206305206306206307206308206309206310206311206312206313206314206315206316206317206318206319206320206321206322206323206324206325206326206327206328206329206330206331206332206333206334206335206336206337206338206339206340206341206342206343206344206345206346206347206348206349206350206351206352206353206354206355206356206357206358206359206360206361206362206363206364206365206366206367206368206369206370206371206372206373206374206375206376206377206378206379206380206381206382206383206384206385206386206387206388206389206390206391206392206393206394206395206396206397206398206399206400206401206402206403206404206405206406206407206408206409206410206411206412206413206414206415206416206417206418206419206420206421206422206423206424206425206426206427206428206429206430206431206432206433206434206435206436206437206438206439206440206441206442206443206444206445206446206447206448206449206450206451206452206453206454206455206456206457206458206459206460206461206462206463206464206465206466206467206468206469206470206471206472206473206474206475206476206477206478206479206480206481206482206483206484206485206486206487206488206489206490206491206492206493206494206495206496206497206498206499206500206501206502206503206504206505206506206507206508206509206510206511206512206513206514206515206516206517206518206519206520206521206522206523206524206525206526206527206528206529206530206531206532206533206534206535206536206537206538206539206540206541206542206543206544206545206546206547206548206549206550206551206552206553206554206555206556206557206558206559206560206561206562206563206564206565206566206567206568206569206570206571206572206573206574206575206576206577206578206579206580206581206582206583206584206585206586206587206588206589206590206591206592206593206594206595206596206597206598206599206600206601206602206603206604206605206606206607206608206609206610206611206612206613206614206615206616206617206618206619206620206621206622206623206624206625206626206627206628206629206630206631206632206633206634206635206636206637206638206639206640206641206642206643206644206645206646206647206648206649206650206651206652206653206654206655206656206657206658206659206660206661206662206663206664206665206666206667206668206669206670206671206672206673206674206675206676206677206678206679206680206681206682206683206684206685206686206687206688206689206690206691206692206693206694206695206696206697206698206699206700206701206702206703206704206705206706206707206708206709206710206711206712206713206714206715206716206717206718206719206720206721206722206723206724206725206726206727206728206729206730206731206732206733206734206735206736206737206738206739206740206741206742206743206744206745206746206747206748206749206750206751206752206753206754206755206756206757206758206759206760206761206762206763206764206765206766206767206768206769206770206771206772206773206774206775206776206777206778206779206780206781206782206783206784206785206786206787206788206789206790206791206792206793206794206795206796206797206798206799206800206801206802206803206804206805206806206807206808206809206810206811206812206813206814206815206816206817206818206819206820206821206822206823206824206825206826206827206828206829206830206831206832206833206834206835206836206837206838206839206840206841206842206843206844206845206846206847206848206849206850206851206852206853206854206855206856206857206858206859206860206861206862206863206864206865206866206867206868206869206870206871206872206873206874206875206876206877206878206879206880206881206882206883206884206885206886206887206888206889206890206891206892206893206894206895206896206897206898206899206900206901206902206903206904206905206906206907206908206909206910206911206912206913206914206915206916206917206918206919206920206921206922206923206924206925206926206927206928206929206930206931206932206933206934206935206936206937206938206939206940206941206942206943206944206945206946206947206948206949206950206951206952206953206954206955206956206957206958206959206960206961206962206963206964206965206966206967206968206969206970206971206972206973206974206975206976206977206978206979206980206981206982206983206984206985206986206987206988206989206990206991206992206993206994206995206996206997206998206999207000207001207002207003207004207005207006207007207008207009207010207011207012207013207014207015207016207017207018207019207020207021207022207023207024207025207026207027207028207029207030207031207032207033207034207035207036207037207038207039207040207041207042207043207044207045207046207047207048207049207050207051207052207053207054207055207056207057207058207059207060207061207062207063207064207065207066207067207068207069207070207071207072207073207074207075207076207077207078207079207080207081207082207083207084207085207086207087207088207089207090207091207092207093207094207095207096207097207098207099207100207101207102207103207104207105207106207107207108207109207110207111207112207113207114207115207116207117207118207119207120207121207122207123207124207125207126207127207128207129207130207131207132207133207134207135207136207137207138207139207140207141207142207143207144207145207146207147207148207149207150207151207152207153207154207155207156207157207158207159207160207161207162207163207164207165207166207167207168207169207170207171207172207173207174207175207176207177207178207179207180207181207182207183207184207185207186207187207188207189207190207191207192207193207194207195207196207197207198207199207200207201207202207203207204207205207206207207207208207209207210207211207212207213207214207215207216207217207218207219207220207221207222207223207224207225207226207227207228207229207230207231207232207233207234207235207236207237207238207239207240207241207242207243207244207245207246207247207248207249207250207251207252207253207254207255207256207257207258207259207260207261207262207263207264207265207266207267207268207269207270207271207272207273207274207275207276207277207278207279207280207281207282207283207284207285207286207287207288207289207290207291207292207293207294207295207296207297207298207299207300207301207302207303207304207305207306207307207308207309207310207311207312207313207314207315207316207317207318207319207320207321207322207323207324207325207326207327207328207329207330207331207332207333207334207335207336207337207338207339207340207341207342207343207344207345207346207347207348207349207350207351207352207353207354207355207356207357207358207359207360207361207362207363207364207365207366207367207368207369207370207371207372207373207374207375207376207377207378207379207380207381207382207383207384207385207386207387207388207389207390207391207392207393207394207395207396207397207398207399207400207401207402207403207404207405207406207407207408207409207410207411207412207413207414207415207416207417207418207419207420207421207422207423207424207425207426207427207428207429207430207431207432207433207434207435207436207437207438207439207440207441207442207443207444207445207446207447207448207449207450207451207452207453207454207455207456207457207458207459207460207461207462207463207464207465207466207467207468207469207470207471207472207473207474207475207476207477207478207479207480207481207482207483207484207485207486207487207488207489207490207491207492207493207494207495207496207497207498207499207500207501207502207503207504207505207506207507207508207509207510207511207512207513207514207515207516207517207518207519207520207521207522207523207524207525207526207527207528207529207530207531207532207533207534207535207536207537207538207539207540207541207542207543207544207545207546207547207548207549207550207551207552207553207554207555207556207557207558207559207560207561207562207563207564207565207566207567207568207569207570207571207572207573207574207575207576207577207578207579207580207581207582207583207584207585207586207587207588207589207590207591207592207593207594207595207596207597207598207599207600207601207602207603207604207605207606207607207608207609207610207611207612207613207614207615207616207617207618207619207620207621207622207623207624207625207626207627207628207629207630207631207632207633207634207635207636207637207638207639207640207641207642207643207644207645207646207647207648207649207650207651207652207653207654207655207656207657207658207659207660207661207662207663207664207665207666207667207668207669207670207671207672207673207674207675207676207677207678207679207680207681207682207683207684207685207686207687207688207689207690207691207692207693207694207695207696207697207698207699207700207701207702207703207704207705207706207707207708207709207710207711207712207713207714207715207716207717207718207719207720207721207722207723207724207725207726207727207728207729207730207731207732207733207734207735207736207737207738207739207740207741207742207743207744207745207746207747207748207749207750207751207752207753207754207755207756207757207758207759207760207761207762207763207764207765207766207767207768207769207770207771207772207773207774207775207776207777207778207779207780207781207782207783207784207785207786207787207788207789207790207791207792207793207794207795207796207797207798207799207800207801207802207803207804207805207806207807207808207809207810207811207812207813207814207815207816207817207818207819207820207821207822207823207824207825207826207827207828207829207830207831207832207833207834207835207836207837207838207839207840207841207842207843207844207845207846207847207848207849207850207851207852207853207854207855207856207857207858207859207860207861207862207863207864207865207866207867207868207869207870207871207872207873207874207875207876207877207878207879207880207881207882207883207884207885207886207887207888207889207890207891207892207893207894207895207896207897207898207899207900207901207902207903207904207905207906207907207908207909207910207911207912207913207914207915207916207917207918207919207920207921207922207923207924207925207926207927207928207929207930207931207932207933207934207935207936207937207938207939207940207941207942207943207944207945207946207947207948207949207950207951207952207953207954207955207956207957207958207959207960207961207962207963207964207965207966207967207968207969207970207971207972207973207974207975207976207977207978207979207980207981207982207983207984207985207986207987207988207989207990207991207992207993207994207995207996207997207998207999208000208001208002208003208004208005208006208007208008208009208010208011208012208013208014208015208016208017208018208019208020208021208022208023208024208025208026208027208028208029208030208031208032208033208034208035208036208037208038208039208040208041208042208043208044208045208046208047208048208049208050208051208052208053208054208055208056208057208058208059208060208061208062208063208064208065208066208067208068208069208070208071208072208073208074208075208076208077208078208079208080208081208082208083208084208085208086208087208088208089208090208091208092208093208094208095208096208097208098208099208100208101208102208103208104208105208106208107208108208109208110208111208112208113208114208115208116208117208118208119208120208121208122208123208124208125208126208127208128208129208130208131208132208133208134208135208136208137208138208139208140208141208142208143208144208145208146208147208148208149208150208151208152208153208154208155208156208157208158208159208160208161208162208163208164208165208166208167208168208169208170208171208172208173208174208175208176208177208178208179208180208181208182208183208184208185208186208187208188208189208190208191208192208193208194208195208196208197208198208199208200208201208202208203208204208205208206208207208208208209208210208211208212208213208214208215208216208217208218208219208220208221208222208223208224208225208226208227208228208229208230208231208232208233208234208235208236208237208238208239208240208241208242208243208244208245208246208247208248208249208250208251208252208253208254208255208256208257208258208259208260208261208262208263208264208265208266208267208268208269208270208271208272208273208274208275208276208277208278208279208280208281208282208283208284208285208286208287208288208289208290208291208292208293208294208295208296208297208298208299208300208301208302208303208304208305208306208307208308208309208310208311208312208313208314208315208316208317208318208319208320208321208322208323208324208325208326208327208328208329208330208331208332208333208334208335208336208337208338208339208340208341208342208343208344208345208346208347208348208349208350208351208352208353208354208355208356208357208358208359208360208361208362208363208364208365208366208367208368208369208370208371208372208373208374208375208376208377208378208379208380208381208382208383208384208385208386208387208388208389208390208391208392208393208394208395208396208397208398208399208400208401208402208403208404208405208406208407208408208409208410208411208412208413208414208415208416208417208418208419208420208421208422208423208424208425208426208427208428208429208430208431208432208433208434208435208436208437208438208439208440208441208442208443208444208445208446208447208448208449208450208451208452208453208454208455208456208457208458208459208460208461208462208463208464208465208466208467208468208469208470208471208472208473208474208475208476208477208478208479208480208481208482208483208484208485208486208487208488208489208490208491208492208493208494208495208496208497208498208499208500208501208502208503208504208505208506208507208508208509208510208511208512208513208514208515208516208517208518208519208520208521208522208523208524208525208526208527208528208529208530208531208532208533208534208535208536208537208538208539208540208541208542208543208544208545208546208547208548208549208550208551208552208553208554208555208556208557208558208559208560208561208562208563208564208565208566208567208568208569208570208571208572208573208574208575208576208577208578208579208580208581208582208583208584208585208586208587208588208589208590208591208592208593208594208595208596208597208598208599208600208601208602208603208604208605208606208607208608208609208610208611208612208613208614208615208616208617208618208619208620208621208622208623208624208625208626208627208628208629208630208631208632208633208634208635208636208637208638208639208640208641208642208643208644208645208646208647208648208649208650208651208652208653208654208655208656208657208658208659208660208661208662208663208664208665208666208667208668208669208670208671208672208673208674208675208676208677208678208679208680208681208682208683208684208685208686208687208688208689208690208691208692208693208694208695208696208697208698208699208700208701208702208703208704208705208706208707208708208709208710208711208712208713208714208715208716208717208718208719208720208721208722208723208724208725208726208727208728208729208730208731208732208733208734208735208736208737208738208739208740208741208742208743208744208745208746208747208748208749208750208751208752208753208754208755208756208757208758208759208760208761208762208763208764208765208766208767208768208769208770208771208772208773208774208775208776208777208778208779208780208781208782208783208784208785208786208787208788208789208790208791208792208793208794208795208796208797208798208799208800208801208802208803208804208805208806208807208808208809208810208811208812208813208814208815208816208817208818208819208820208821208822208823208824208825208826208827208828208829208830208831208832208833208834208835208836208837208838208839208840208841208842208843208844208845208846208847208848208849208850208851208852208853208854208855208856208857208858208859208860208861208862208863208864208865208866208867208868208869208870208871208872208873208874208875208876208877208878208879208880208881208882208883208884208885208886208887208888208889208890208891208892208893208894208895208896208897208898208899208900208901208902208903208904208905208906208907208908208909208910208911208912208913208914208915208916208917208918208919208920208921208922208923208924208925208926208927208928208929208930208931208932208933208934208935208936208937208938208939208940208941208942208943208944208945208946208947208948208949208950208951208952208953208954208955208956208957208958208959208960208961208962208963208964208965208966208967208968208969208970208971208972208973208974208975208976208977208978208979208980208981208982208983208984208985208986208987208988208989208990208991208992208993208994208995208996208997208998208999209000209001209002209003209004209005209006209007209008209009209010209011209012209013209014209015209016209017209018209019209020209021209022209023209024209025209026209027209028209029209030209031209032209033209034209035209036209037209038209039209040209041209042209043209044209045209046209047209048209049209050209051209052209053209054209055209056209057209058209059209060209061209062209063209064209065209066209067209068209069209070209071209072209073209074209075209076209077209078209079209080209081209082209083209084209085209086209087209088209089209090209091209092209093209094209095209096209097209098209099209100209101209102209103209104209105209106209107209108209109209110209111209112209113209114209115209116209117209118209119209120209121209122209123209124209125209126209127209128209129209130209131209132209133209134209135209136209137209138209139209140209141209142209143209144209145209146209147209148209149209150209151209152209153209154209155209156209157209158209159209160209161209162209163209164209165209166209167209168209169209170209171209172209173209174209175209176209177209178209179209180209181209182209183209184209185209186209187209188209189209190209191209192209193209194209195209196209197209198209199209200209201209202209203209204209205209206209207209208209209209210209211209212209213209214209215209216209217209218209219209220209221209222209223209224209225209226209227209228209229209230209231209232209233209234209235209236209237209238209239209240209241209242209243209244209245209246209247209248209249209250209251209252209253209254209255209256209257209258209259209260209261209262209263209264209265209266209267209268209269209270209271209272209273209274209275209276209277209278209279209280209281209282209283209284209285209286209287209288209289209290209291209292209293209294209295209296209297209298209299209300209301209302209303209304209305209306209307209308209309209310209311209312209313209314209315209316209317209318209319209320209321209322209323209324209325209326209327209328209329209330209331209332209333209334209335209336209337209338209339209340209341209342209343209344209345209346209347209348209349209350209351209352209353209354209355209356209357209358209359209360209361209362209363209364209365209366209367209368209369209370209371209372209373209374209375209376209377209378209379209380209381209382209383209384209385209386209387209388209389209390209391209392209393209394209395209396209397209398209399209400209401209402209403209404209405209406209407209408209409209410209411209412209413209414209415209416209417209418209419209420209421209422209423209424209425209426209427209428209429209430209431209432209433209434209435209436209437209438209439209440209441209442209443209444209445209446209447209448209449209450209451209452209453209454209455209456209457209458209459209460209461209462209463209464209465209466209467209468209469209470209471209472209473209474209475209476209477209478209479209480209481209482209483209484209485209486209487209488209489209490209491209492209493209494209495209496209497209498209499209500209501209502209503209504209505209506209507209508209509209510209511209512209513209514209515209516209517209518209519209520209521209522209523209524209525209526209527209528209529209530209531209532209533209534209535209536209537209538209539209540209541209542209543209544209545209546209547209548209549209550209551209552209553209554209555209556209557209558209559209560209561209562209563209564209565209566209567209568209569209570209571209572209573209574209575209576209577209578209579209580209581209582209583209584209585209586209587209588209589209590209591209592209593209594209595209596209597209598209599209600209601209602209603209604209605209606209607209608209609209610209611209612209613209614209615209616209617209618209619209620209621209622209623209624209625209626209627209628209629209630209631209632209633209634209635209636209637209638209639209640209641209642209643209644209645209646209647209648209649209650209651209652209653209654209655209656209657209658209659209660209661209662209663209664209665209666209667209668209669209670209671209672209673209674209675209676209677209678209679209680209681209682209683209684209685209686209687209688209689209690209691209692209693209694209695209696209697209698209699209700209701209702209703209704209705209706209707209708209709209710209711209712209713209714209715209716209717209718209719209720209721209722209723209724209725209726209727209728209729209730209731209732209733209734209735209736209737209738209739209740209741209742209743209744209745209746209747209748209749209750209751209752209753209754209755209756209757209758209759209760209761209762209763209764209765209766209767209768209769209770209771209772209773209774209775209776209777209778209779209780209781209782209783209784209785209786209787209788209789209790209791209792209793209794209795209796209797209798209799209800209801209802209803209804209805209806209807209808209809209810209811209812209813209814209815209816209817209818209819209820209821209822209823209824209825209826209827209828209829209830209831209832209833209834209835209836209837209838209839209840209841209842209843209844209845209846209847209848209849209850209851209852209853209854209855209856209857209858209859209860209861209862209863209864209865209866209867209868209869209870209871209872209873209874209875209876209877209878209879209880209881209882209883209884209885209886209887209888209889209890209891209892209893209894209895209896209897209898209899209900209901209902209903209904209905209906209907209908209909209910209911209912209913209914209915209916209917209918209919209920209921209922209923209924209925209926209927209928209929209930209931209932209933209934209935209936209937209938209939209940209941209942209943209944209945209946209947209948209949209950209951209952209953209954209955209956209957209958209959209960209961209962209963209964209965209966209967209968209969209970209971209972209973209974209975209976209977209978209979209980209981209982209983209984209985209986209987209988209989209990209991209992209993209994209995209996209997209998209999210000210001210002210003210004210005210006210007210008210009210010210011210012210013210014210015210016210017210018210019210020210021210022210023210024210025210026210027210028210029210030210031210032210033210034210035210036210037210038210039210040210041210042210043210044210045210046210047210048210049210050210051210052210053210054210055210056210057210058210059210060210061210062210063210064210065210066210067210068210069210070210071210072210073210074210075210076210077210078210079210080210081210082210083210084210085210086210087210088210089210090210091210092210093210094210095210096210097210098210099210100210101210102210103210104210105210106210107210108210109210110210111210112210113210114210115210116210117210118210119210120210121210122210123210124210125210126210127210128210129210130210131210132210133210134210135210136210137210138210139210140210141210142210143210144210145210146210147210148210149210150210151210152210153210154210155210156210157210158210159210160210161210162210163210164210165210166210167210168210169210170210171210172210173210174210175210176210177210178210179210180210181210182210183210184210185210186210187210188210189210190210191210192210193210194210195210196210197210198210199210200210201210202210203210204210205210206210207210208210209210210210211210212210213210214210215210216210217210218210219210220210221210222210223210224210225210226210227210228210229210230210231210232210233210234210235210236210237210238210239210240210241210242210243210244210245210246210247210248210249210250210251210252210253210254210255210256210257210258210259210260210261210262210263210264210265210266210267210268210269210270210271210272210273210274210275210276210277210278210279210280210281210282210283210284210285210286210287210288210289210290210291210292210293210294210295210296210297210298210299210300210301210302210303210304210305210306210307210308210309210310210311210312210313210314210315210316210317210318210319210320210321210322210323210324210325210326210327210328210329210330210331210332210333210334210335210336210337210338210339210340210341210342210343210344210345210346210347210348210349210350210351210352210353210354210355210356210357210358210359210360210361210362210363210364210365210366210367210368210369210370210371210372210373210374210375210376210377210378210379210380210381210382210383210384210385210386210387210388210389210390210391210392210393210394210395210396210397210398210399210400210401210402210403210404210405210406210407210408210409210410210411210412210413210414210415210416210417210418210419210420210421210422210423210424210425210426210427210428210429210430210431210432210433210434210435210436210437210438210439210440210441210442210443210444210445210446210447210448210449210450210451210452210453210454210455210456210457210458210459210460210461210462210463210464210465210466210467210468210469210470210471210472210473210474210475210476210477210478210479210480210481210482210483210484210485210486210487210488210489210490210491210492210493210494210495210496210497210498210499210500210501210502210503210504210505210506210507210508210509210510210511210512210513210514210515210516210517210518210519210520210521210522210523210524210525210526210527210528210529210530210531210532210533210534210535210536210537210538210539210540210541210542210543210544210545210546210547210548210549210550210551210552210553210554210555210556210557210558210559210560210561210562210563210564210565210566210567210568210569210570210571210572210573210574210575210576210577210578210579210580210581210582210583210584210585210586210587210588210589210590210591210592210593210594210595210596210597210598210599210600210601210602210603210604210605210606210607210608210609210610210611210612210613210614210615210616210617210618210619210620210621210622210623210624210625210626210627210628210629210630210631210632210633210634210635210636210637210638210639210640210641210642210643210644210645210646210647210648210649210650210651210652210653210654210655210656210657210658210659210660210661210662210663210664210665210666210667210668210669210670210671210672210673210674210675210676210677210678210679210680210681210682210683210684210685210686210687210688210689210690210691210692210693210694210695210696210697210698210699210700210701210702210703210704210705210706210707210708210709210710210711210712210713210714210715210716210717210718210719210720210721210722210723210724210725210726210727210728210729210730210731210732210733210734210735210736210737210738210739210740210741210742210743210744210745210746210747210748210749210750210751210752210753210754210755210756210757210758210759210760210761210762210763210764210765210766210767210768210769210770210771210772210773210774210775210776210777210778210779210780210781210782210783210784210785210786210787210788210789210790210791210792210793210794210795210796210797210798210799210800210801210802210803210804210805210806210807210808210809210810210811210812210813210814210815210816210817210818210819210820210821210822210823210824210825210826210827210828210829210830210831210832210833210834210835210836210837210838210839210840210841210842210843210844210845210846210847210848210849210850210851210852210853210854210855210856210857210858210859210860210861210862210863210864210865210866210867210868210869210870210871210872210873210874210875210876210877210878210879210880210881210882210883210884210885210886210887210888210889210890210891210892210893210894210895210896210897210898210899210900210901210902210903210904210905210906210907210908210909210910210911210912210913210914210915210916210917210918210919210920210921210922210923210924210925210926210927210928210929210930210931210932210933210934210935210936210937210938210939210940210941210942210943210944210945210946210947210948210949210950210951210952210953210954210955210956210957210958210959210960210961210962210963210964210965210966210967210968210969210970210971210972210973210974210975210976210977210978210979210980210981210982210983210984210985210986210987210988210989210990210991210992210993210994210995210996210997210998210999211000211001211002211003211004211005211006211007211008211009211010211011211012211013211014211015211016211017211018211019211020211021211022211023211024211025211026211027211028211029211030211031211032211033211034211035211036211037211038211039211040211041211042211043211044211045211046211047211048211049211050211051211052211053211054211055211056211057211058211059211060211061211062211063211064211065211066211067211068211069211070211071211072211073211074211075211076211077211078211079211080211081211082211083211084211085211086211087211088211089211090211091211092211093211094211095211096211097211098211099211100211101211102211103211104211105211106211107211108211109211110211111211112211113211114211115211116211117211118211119211120211121211122211123211124211125211126211127211128211129211130211131211132211133211134211135211136211137211138211139211140211141211142211143211144211145211146211147211148211149211150211151211152211153211154211155211156211157211158211159211160211161211162211163211164211165211166211167211168211169211170211171211172211173211174211175211176211177211178211179211180211181211182211183211184211185211186211187211188211189211190211191211192211193211194211195211196211197211198211199211200211201211202211203211204211205211206211207211208211209211210211211211212211213211214211215211216211217211218211219211220211221211222211223211224211225211226211227211228211229211230211231211232211233211234211235211236211237211238211239211240211241211242211243211244211245211246211247211248211249211250211251211252211253211254211255211256211257211258211259211260211261211262211263211264211265211266211267211268211269211270211271211272211273211274211275211276211277211278211279211280211281211282211283211284211285211286211287211288211289211290211291211292211293211294211295211296211297211298211299211300211301211302211303211304211305211306211307211308211309211310211311211312211313211314211315211316211317211318211319211320211321211322211323211324211325211326211327211328211329211330211331211332211333211334211335211336211337211338211339211340211341211342211343211344211345211346211347211348211349211350211351211352211353211354211355211356211357211358211359211360211361211362211363211364211365211366211367211368211369211370211371211372211373211374211375211376211377211378211379211380211381211382211383211384211385211386211387211388211389211390211391211392211393211394211395211396211397211398211399211400211401211402211403211404211405211406211407211408211409211410211411211412211413211414211415211416211417211418211419211420211421211422211423211424211425211426211427211428211429211430211431211432211433211434211435211436211437211438211439211440211441211442211443211444211445211446211447211448211449211450211451211452211453211454211455211456211457211458211459211460211461211462211463211464211465211466211467211468211469211470211471211472211473211474211475211476211477211478211479211480211481211482211483211484211485211486211487211488211489211490211491211492211493211494211495211496211497211498211499211500211501211502211503211504211505211506211507211508211509211510211511211512211513211514211515211516211517211518211519211520211521211522211523211524211525211526211527211528211529211530211531211532211533211534211535211536211537211538211539211540211541211542211543211544211545211546211547211548211549211550211551211552211553211554211555211556211557211558211559211560211561211562211563211564211565211566211567211568211569211570211571211572211573211574211575211576211577211578211579211580211581211582211583211584211585211586211587211588211589211590211591211592211593211594211595211596211597211598211599211600211601211602211603211604211605211606211607211608211609211610211611211612211613211614211615211616211617211618211619211620211621211622211623211624211625211626211627211628211629211630211631211632211633211634211635211636211637211638211639211640211641211642211643211644211645211646211647211648211649211650211651211652211653211654211655211656211657211658211659211660211661211662211663211664211665211666211667211668211669211670211671211672211673211674211675211676211677211678211679211680211681211682211683211684211685211686211687211688211689211690211691211692211693211694211695211696211697211698211699211700211701211702211703211704211705211706211707211708211709211710211711211712211713211714211715211716211717211718211719211720211721211722211723211724211725211726211727211728211729211730211731211732211733211734211735211736211737211738211739211740211741211742211743211744211745211746211747211748211749211750211751211752211753211754211755211756211757211758211759211760211761211762211763211764211765211766211767211768211769211770211771211772211773211774211775211776211777211778211779211780211781211782211783211784211785211786211787211788211789211790211791211792211793211794211795211796211797211798211799211800211801211802211803211804211805211806211807211808211809211810211811211812211813211814211815211816211817211818211819211820211821211822211823211824211825211826211827211828211829211830211831211832211833211834211835211836211837211838211839211840211841211842211843211844211845211846211847211848211849211850211851211852211853211854211855211856211857211858211859211860211861211862211863211864211865211866211867211868211869211870211871211872211873211874211875211876211877211878211879211880211881211882211883211884211885211886211887211888211889211890211891211892211893211894211895211896211897211898211899211900211901211902211903211904211905211906211907211908211909211910211911211912211913211914211915211916211917211918211919211920211921211922211923211924211925211926211927211928211929211930211931211932211933211934211935211936211937211938211939211940211941211942211943211944211945211946211947211948211949211950211951211952211953211954211955211956211957211958211959211960211961211962211963211964211965211966211967211968211969211970211971211972211973211974211975211976211977211978211979211980211981211982211983211984211985211986211987211988211989211990211991211992211993211994211995211996211997211998211999212000212001212002212003212004212005212006212007212008212009212010212011212012212013212014212015212016212017212018212019212020212021212022212023212024212025212026212027212028212029212030212031212032212033212034212035212036212037212038212039212040212041212042212043212044212045212046212047212048212049212050212051212052212053212054212055212056212057212058212059212060212061212062212063212064212065212066212067212068212069212070212071212072212073212074212075212076212077212078212079212080212081212082212083212084212085212086212087212088212089212090212091212092212093212094212095212096212097212098212099212100212101212102212103212104212105212106212107212108212109212110212111212112212113212114212115212116212117212118212119212120212121212122212123212124212125212126212127212128212129212130212131212132212133212134212135212136212137212138212139212140212141212142212143212144212145212146212147212148212149212150212151212152212153212154212155212156212157212158212159212160212161212162212163212164212165212166212167212168212169212170212171212172212173212174212175212176212177212178212179212180212181212182212183212184212185212186212187212188212189212190212191212192212193212194212195212196212197212198212199212200212201212202212203212204212205212206212207212208212209212210212211212212212213212214212215212216212217212218212219212220212221212222212223212224212225212226212227212228212229212230212231212232212233212234212235212236212237212238212239212240212241212242212243212244212245212246212247212248212249212250212251212252212253212254212255212256212257212258212259212260212261212262212263212264212265212266212267212268212269212270212271212272212273212274212275212276212277212278212279212280212281212282212283212284212285212286212287212288212289212290212291212292212293212294212295212296212297212298212299212300212301212302212303212304212305212306212307212308212309212310212311212312212313212314212315212316212317212318212319212320212321212322212323212324212325212326212327212328212329212330212331212332212333212334212335212336212337212338212339212340212341212342212343212344212345212346212347212348212349212350212351212352212353212354212355212356212357212358212359212360212361212362212363212364212365212366212367212368212369212370212371212372212373212374212375212376212377212378212379212380212381212382212383212384212385212386212387212388212389212390212391212392212393212394212395212396212397212398212399212400212401212402212403212404212405212406212407212408212409212410212411212412212413212414212415212416212417212418212419212420212421212422212423212424212425212426212427212428212429212430212431212432212433212434212435212436212437212438212439212440212441212442212443212444212445212446212447212448212449212450212451212452212453212454212455212456212457212458212459212460212461212462212463212464212465212466212467212468212469212470212471212472212473212474212475212476212477212478212479212480212481212482212483212484212485212486212487212488212489212490212491212492212493212494212495212496212497212498212499212500212501212502212503212504212505212506212507212508212509212510212511212512212513212514212515212516212517212518212519212520212521212522212523212524212525212526212527212528212529212530212531212532212533212534212535212536212537212538212539212540212541212542212543212544212545212546212547212548212549212550212551212552212553212554212555212556212557212558212559212560212561212562212563212564212565212566212567212568212569212570212571212572212573212574212575212576212577212578212579212580212581212582212583212584212585212586212587212588212589212590212591212592212593212594212595212596212597212598212599212600212601212602212603212604212605212606212607212608212609212610212611212612212613212614212615212616212617212618212619212620212621212622212623212624212625212626212627212628212629212630212631212632212633212634212635212636212637212638212639212640212641212642212643212644212645212646212647212648212649212650212651212652212653212654212655212656212657212658212659212660212661212662212663212664212665212666212667212668212669212670212671212672212673212674212675212676212677212678212679212680212681212682212683212684212685212686212687212688212689212690212691212692212693212694212695212696212697212698212699212700212701212702212703212704212705212706212707212708212709212710212711212712212713212714212715212716212717212718212719212720212721212722212723212724212725212726212727212728212729212730212731212732212733212734212735212736212737212738212739212740212741212742212743212744212745212746212747212748212749212750212751212752212753212754212755212756212757212758212759212760212761212762212763212764212765212766212767212768212769212770212771212772212773212774212775212776212777212778212779212780212781212782212783212784212785212786212787212788212789212790212791212792212793212794212795212796212797212798212799212800212801212802212803212804212805212806212807212808212809212810212811212812212813212814212815212816212817212818212819212820212821212822212823212824212825212826212827212828212829212830212831212832212833212834212835212836212837212838212839212840212841212842212843212844212845212846212847212848212849212850212851212852212853212854212855212856212857212858212859212860212861212862212863212864212865212866212867212868212869212870212871212872212873212874212875212876212877212878212879212880212881212882212883212884212885212886212887212888212889212890212891212892212893212894212895212896212897212898212899212900212901212902212903212904212905212906212907212908212909212910212911212912212913212914212915212916212917212918212919212920212921212922212923212924212925212926212927212928212929212930212931212932212933212934212935212936212937212938212939212940212941212942212943212944212945212946212947212948212949212950212951212952212953212954212955212956212957212958212959212960212961212962212963212964212965212966212967212968212969212970212971212972212973212974212975212976212977212978212979212980212981212982212983212984212985212986212987212988212989212990212991212992212993212994212995212996212997212998212999213000213001213002213003213004213005213006213007213008213009213010213011213012213013213014213015213016213017213018213019213020213021213022213023213024213025213026213027213028213029213030213031213032213033213034213035213036213037213038213039213040213041213042213043213044213045213046213047213048213049213050213051213052213053213054213055213056213057213058213059213060213061213062213063213064213065213066213067213068213069213070213071213072213073213074213075213076213077213078213079213080213081213082213083213084213085213086213087213088213089213090213091213092213093213094213095213096213097213098213099213100213101213102213103213104213105213106213107213108213109213110213111213112213113213114213115213116213117213118213119213120213121213122213123213124213125213126213127213128213129213130213131213132213133213134213135213136213137213138213139213140213141213142213143213144213145213146213147213148213149213150213151213152213153213154213155213156213157213158213159213160213161213162213163213164213165213166213167213168213169213170213171213172213173213174213175213176213177213178213179213180213181213182213183213184213185213186213187213188213189213190213191213192213193213194213195213196213197213198213199213200213201213202213203213204213205213206213207213208213209213210213211213212213213213214213215213216213217213218213219213220213221213222213223213224213225213226213227213228213229213230213231213232213233213234213235213236213237213238213239213240213241213242213243213244213245213246213247213248213249213250213251213252213253213254213255213256213257213258213259213260213261213262213263213264213265213266213267213268213269213270213271213272213273213274213275213276213277213278213279213280213281213282213283213284213285213286213287213288213289213290213291213292213293213294213295213296213297213298213299213300213301213302213303213304213305213306213307213308213309213310213311213312213313213314213315213316213317213318213319213320213321213322213323213324213325213326213327213328213329213330213331213332213333213334213335213336213337213338213339213340213341213342213343213344213345213346213347213348213349213350213351213352213353213354213355213356213357213358213359213360213361213362213363213364213365213366213367213368213369213370213371213372213373213374213375213376213377213378213379213380213381213382213383213384213385213386213387213388213389213390213391213392213393213394213395213396213397213398213399213400213401213402213403213404213405213406213407213408213409213410213411213412213413213414213415213416213417213418213419213420213421213422213423213424213425213426213427213428213429213430213431213432213433213434213435213436213437213438213439213440213441213442213443213444213445213446213447213448213449213450213451213452213453213454213455213456213457213458213459213460213461213462213463213464213465213466213467213468213469213470213471213472213473213474213475213476213477213478213479213480213481213482213483213484213485213486213487213488213489213490213491213492213493213494213495213496213497213498213499213500213501213502213503213504213505213506213507213508213509213510213511213512213513213514213515213516213517213518213519213520213521213522213523213524213525213526213527213528213529213530213531213532213533213534213535213536213537213538213539213540213541213542213543213544213545213546213547213548213549213550213551213552213553213554213555213556213557213558213559213560213561213562213563213564213565213566213567213568213569213570213571213572213573213574213575213576213577213578213579213580213581213582213583213584213585213586213587213588213589213590213591213592213593213594213595213596213597213598213599213600213601213602213603213604213605213606213607213608213609213610213611213612213613213614213615213616213617213618213619213620213621213622213623213624213625213626213627213628213629213630213631213632213633213634213635213636213637213638213639213640213641213642213643213644213645213646213647213648213649213650213651213652213653213654213655213656213657213658213659213660213661213662213663213664213665213666213667213668213669213670213671213672213673213674213675213676213677213678213679213680213681213682213683213684213685213686213687213688213689213690213691213692213693213694213695213696213697213698213699213700213701213702213703213704213705213706213707213708213709213710213711213712213713213714213715213716213717213718213719213720213721213722213723213724213725213726213727213728213729213730213731213732213733213734213735213736213737213738213739213740213741213742213743213744213745213746213747213748213749213750213751213752213753213754213755213756213757213758213759213760213761213762213763213764213765213766213767213768213769213770213771213772213773213774213775213776213777213778213779213780213781213782213783213784213785213786213787213788213789213790213791213792213793213794213795213796213797213798213799213800213801213802213803213804213805213806213807213808213809213810213811213812213813213814213815213816213817213818213819213820213821213822213823213824213825213826213827213828213829213830213831213832213833213834213835213836213837213838213839213840213841213842213843213844213845213846213847213848213849213850213851213852213853213854213855213856213857213858213859213860213861213862213863213864213865213866213867213868213869213870213871213872213873213874213875213876213877213878213879213880213881213882213883213884213885213886213887213888213889213890213891213892213893213894213895213896213897213898213899213900213901213902213903213904213905213906213907213908213909213910213911213912213913213914213915213916213917213918213919213920213921213922213923213924213925213926213927213928213929213930213931213932213933213934213935213936213937213938213939213940213941213942213943213944213945213946213947213948213949213950213951213952213953213954213955213956213957213958213959213960213961213962213963213964213965213966213967213968213969213970213971213972213973213974213975213976213977213978213979213980213981213982213983213984213985213986213987213988213989213990213991213992213993213994213995213996213997213998213999214000214001214002214003214004214005214006214007214008214009214010214011214012214013214014214015214016214017214018214019214020214021214022214023214024214025214026214027214028214029214030214031214032214033214034214035214036214037214038214039214040214041214042214043214044214045214046214047214048214049214050214051214052214053214054214055214056214057214058214059214060214061214062214063214064214065214066214067214068214069214070214071214072214073214074214075214076214077214078214079214080214081214082214083214084214085214086214087214088214089214090214091214092214093214094214095214096214097214098214099214100214101214102214103214104214105214106214107214108214109214110214111214112214113214114214115214116214117214118214119214120214121214122214123214124214125214126214127214128214129214130214131214132214133214134214135214136214137214138214139214140214141214142214143214144214145214146214147214148214149214150214151214152214153214154214155214156214157214158214159214160214161214162214163214164214165214166214167214168214169214170214171214172214173214174214175214176214177214178214179214180214181214182214183214184214185214186214187214188214189214190214191214192214193214194214195214196214197214198214199214200214201214202214203214204214205214206214207214208214209214210214211214212214213214214214215214216214217214218214219214220214221214222214223214224214225214226214227214228214229214230214231214232214233214234214235214236214237214238214239214240214241214242214243214244214245214246214247214248214249214250214251214252214253214254214255214256214257214258214259214260214261214262214263214264214265214266214267214268214269214270214271214272214273214274214275214276214277214278214279214280214281214282214283214284214285214286214287214288214289214290214291214292214293214294214295214296214297214298214299214300214301214302214303214304214305214306214307214308214309214310214311214312214313214314214315214316214317214318214319214320214321214322214323214324214325214326214327214328214329214330214331214332214333214334214335214336214337214338214339214340214341214342214343214344214345214346214347214348214349214350214351214352214353214354214355214356214357214358214359214360214361214362214363214364214365214366214367214368214369214370214371214372214373214374214375214376214377214378214379214380214381214382214383214384214385214386214387214388214389214390214391214392214393214394214395214396214397214398214399214400214401214402214403214404214405214406214407214408214409214410214411214412214413214414214415214416214417214418214419214420214421214422214423214424214425214426214427214428214429214430214431214432214433214434214435214436214437214438214439214440214441214442214443214444214445214446214447214448214449214450214451214452214453214454214455214456214457214458214459214460214461214462214463214464214465214466214467214468214469214470214471214472214473214474214475214476214477214478214479214480214481214482214483214484214485214486214487214488214489214490214491214492214493214494214495214496214497214498214499214500214501214502214503214504214505214506214507214508214509214510214511214512214513214514214515214516214517214518214519214520214521214522214523214524214525214526214527214528214529214530214531214532214533214534214535214536214537214538214539214540214541214542214543214544214545214546214547214548214549214550214551214552214553214554214555214556214557214558214559214560214561214562214563214564214565214566214567214568214569214570214571214572214573214574214575214576214577214578214579214580214581214582214583214584214585214586214587214588214589214590214591214592214593214594214595214596214597214598214599214600214601214602214603214604214605214606214607214608214609214610214611214612214613214614214615214616214617214618214619214620214621214622214623214624214625214626214627214628214629214630214631214632214633214634214635214636214637214638214639214640214641214642214643214644214645214646214647214648214649214650214651214652214653214654214655214656214657214658214659214660214661214662214663214664214665214666214667214668214669214670214671214672214673214674214675214676214677214678214679214680214681214682214683214684214685214686214687214688214689214690214691214692214693214694214695214696214697214698214699214700214701214702214703214704214705214706214707214708214709214710214711214712214713214714214715214716214717214718214719214720214721214722214723214724214725214726214727214728214729214730214731214732214733214734214735214736214737214738214739214740214741214742214743214744214745214746214747214748214749214750214751214752214753214754214755214756214757214758214759214760214761214762214763214764214765214766214767214768214769214770214771214772214773214774214775214776214777214778214779214780214781214782214783214784214785214786214787214788214789214790214791214792214793214794214795214796214797214798214799214800214801214802214803214804214805214806214807214808214809214810214811214812214813214814214815214816214817214818214819214820214821214822214823214824214825214826214827214828214829214830214831214832214833214834214835214836214837214838214839214840214841214842214843214844214845214846214847214848214849214850214851214852214853214854214855214856214857214858214859214860214861214862214863214864214865214866214867214868214869214870214871214872214873214874214875214876214877214878214879214880214881214882214883214884214885214886214887214888214889214890214891214892214893214894214895214896214897214898214899214900214901214902214903214904214905214906214907214908214909214910214911214912214913214914214915214916214917214918214919214920214921214922214923214924214925214926214927214928214929214930214931214932214933214934214935214936214937214938214939214940214941214942214943214944214945214946214947214948214949214950214951214952214953214954214955214956214957214958214959214960214961214962214963214964214965214966214967214968214969214970214971214972214973214974214975214976214977214978214979214980214981214982214983214984214985214986214987214988214989214990214991214992214993214994214995214996214997214998214999215000215001215002215003215004215005215006215007215008215009215010215011215012215013215014215015215016215017215018215019215020215021215022215023215024215025215026215027215028215029215030215031215032215033215034215035215036215037215038215039215040215041215042215043215044215045215046215047215048215049215050215051215052215053215054215055215056215057215058215059215060215061215062215063215064215065215066215067215068215069215070215071215072215073215074215075215076215077215078215079215080215081215082215083215084215085215086215087215088215089215090215091215092215093215094215095215096215097215098215099215100215101215102215103215104215105215106215107215108215109215110215111215112215113215114215115215116215117215118215119215120215121215122215123215124215125215126215127215128215129215130215131215132215133215134215135215136215137215138215139215140215141215142215143215144215145215146215147215148215149215150215151215152215153215154215155215156215157215158215159215160215161215162215163215164215165215166215167215168215169215170215171215172215173215174215175215176215177215178215179215180215181215182215183215184215185215186215187215188215189215190215191215192215193215194215195215196215197215198215199215200215201215202215203215204215205215206215207215208215209215210215211215212215213215214215215215216215217215218215219215220215221215222215223215224215225215226215227215228215229215230215231215232215233215234215235215236215237215238215239215240215241215242215243215244215245215246215247215248215249215250215251215252215253215254215255215256215257215258215259215260215261215262215263215264215265215266215267215268215269215270215271215272215273215274215275215276215277215278215279215280215281215282215283215284215285215286215287215288215289215290215291215292215293215294215295215296215297215298215299215300215301215302215303215304215305215306215307215308215309215310215311215312215313215314215315215316215317215318215319215320215321215322215323215324215325215326215327215328215329215330215331215332215333215334215335215336215337215338215339215340215341215342215343215344215345215346215347215348215349215350215351215352215353215354215355215356215357215358215359215360215361215362215363215364215365215366215367215368215369215370215371215372215373215374215375215376215377215378215379215380215381215382215383215384215385215386215387215388215389215390215391215392215393215394215395215396215397215398215399215400215401215402215403215404215405215406215407215408215409215410215411215412215413215414215415215416215417215418215419215420215421215422215423215424215425215426215427215428215429215430215431215432215433215434215435215436215437215438215439215440215441215442215443215444215445215446215447215448215449215450215451215452215453215454215455215456215457215458215459215460215461215462215463215464215465215466215467215468215469215470215471215472215473215474215475215476215477215478215479215480215481215482215483215484215485215486215487215488215489215490215491215492215493215494215495215496215497215498215499215500215501215502215503215504215505215506215507215508215509215510215511215512215513215514215515215516215517215518215519215520215521215522215523215524215525215526215527215528215529215530215531215532215533215534215535215536215537215538215539215540215541215542215543215544215545215546215547215548215549215550215551215552215553215554215555215556215557215558215559215560215561215562215563215564215565215566215567215568215569215570215571215572215573215574215575215576215577215578215579215580215581215582215583215584215585215586215587215588215589215590215591215592215593215594215595215596215597215598215599215600215601215602215603215604215605215606215607215608215609215610215611215612215613215614215615215616215617215618215619215620215621215622215623215624215625215626215627215628215629215630215631215632215633215634215635215636215637215638215639215640215641215642215643215644215645215646215647215648215649215650215651215652215653215654215655215656215657215658215659215660215661215662215663215664215665215666215667215668215669215670215671215672215673215674215675215676215677215678215679215680215681215682215683215684215685215686215687215688215689215690215691215692215693215694215695215696215697215698215699215700215701215702215703215704215705215706215707215708215709215710215711215712215713215714215715215716215717215718215719215720215721215722215723215724215725215726215727215728215729215730215731215732215733215734215735215736215737215738215739215740215741215742215743215744215745215746215747215748215749215750215751215752215753215754215755215756215757215758215759215760215761215762215763215764215765215766215767215768215769215770215771215772215773215774215775215776215777215778215779215780215781215782215783215784215785215786215787215788215789215790215791215792215793215794215795215796215797215798215799215800215801215802215803215804215805215806215807215808215809215810215811215812215813215814215815215816215817215818215819215820215821215822215823215824215825215826215827215828215829215830215831215832215833215834215835215836215837215838215839215840215841215842215843215844215845215846215847215848215849215850215851215852215853215854215855215856215857215858215859215860215861215862215863215864215865215866215867215868215869215870215871215872215873215874215875215876215877215878215879215880215881215882215883215884215885215886215887215888215889215890215891215892215893215894215895215896215897215898215899215900215901215902215903215904215905215906215907215908215909215910215911215912215913215914215915215916215917215918215919215920215921215922215923215924215925215926215927215928215929215930215931215932215933215934215935215936215937215938215939215940215941215942215943215944215945215946215947215948215949215950215951215952215953215954215955215956215957215958215959215960215961215962215963215964215965215966215967215968215969215970215971215972215973215974215975215976215977215978215979215980215981215982215983215984215985215986215987215988215989215990215991215992215993215994215995215996215997215998215999216000216001216002216003216004216005216006216007216008216009216010216011216012216013216014216015216016216017216018216019216020216021216022216023216024216025216026216027216028216029216030216031216032216033216034216035216036216037216038216039216040216041216042216043216044216045216046216047216048216049216050216051216052216053216054216055216056216057216058216059216060216061216062216063216064216065216066216067216068216069216070216071216072216073216074216075216076216077216078216079216080216081216082216083216084216085216086216087216088216089216090216091216092216093216094216095216096216097216098216099216100216101216102216103216104216105216106216107216108216109216110216111216112216113216114216115216116216117216118216119216120216121216122216123216124216125216126216127216128216129216130216131216132216133216134216135216136216137216138216139216140216141216142216143216144216145216146216147216148216149216150216151216152216153216154216155216156216157216158216159216160216161216162216163216164216165216166216167216168216169216170216171216172216173216174216175216176216177216178216179216180216181216182216183216184216185216186216187216188216189216190216191216192216193216194216195216196216197216198216199216200216201216202216203216204216205216206216207216208216209216210216211216212216213216214216215216216216217216218216219216220216221216222216223216224216225216226216227216228216229216230216231216232216233216234216235216236216237216238216239216240216241216242216243216244216245216246216247216248216249216250216251216252216253216254216255216256216257216258216259216260216261216262216263216264216265216266216267216268216269216270216271216272216273216274216275216276216277216278216279216280216281216282216283216284216285216286216287216288216289216290216291216292216293216294216295216296216297216298216299216300216301216302216303216304216305216306216307216308216309216310216311216312216313216314216315216316216317216318216319216320216321216322216323216324216325216326216327216328216329216330216331216332216333216334216335216336216337216338216339216340216341216342216343216344216345216346216347216348216349216350216351216352216353216354216355216356216357216358216359216360216361216362216363216364216365216366216367216368216369216370216371216372216373216374216375216376216377216378216379216380216381216382216383216384216385216386216387216388216389216390216391216392216393216394216395216396216397216398216399216400216401216402216403216404216405216406216407216408216409216410216411216412216413216414216415216416216417216418216419216420216421216422216423216424216425216426216427216428216429216430216431216432216433216434216435216436216437216438216439216440216441216442216443216444216445216446216447216448216449216450216451216452216453216454216455216456216457216458216459216460216461216462216463216464216465216466216467216468216469216470216471216472216473216474216475216476216477216478216479216480216481216482216483216484216485216486216487216488216489216490216491216492216493216494216495216496216497216498216499216500216501216502216503216504216505216506216507216508216509216510216511216512216513216514216515216516216517216518216519216520216521216522216523216524216525216526216527216528216529216530216531216532216533216534216535216536216537216538216539216540216541216542216543216544216545216546216547216548216549216550216551216552216553216554216555216556216557216558216559216560216561216562216563216564216565216566216567216568216569216570216571216572216573216574216575216576216577216578216579216580216581216582216583216584216585216586216587216588216589216590216591216592216593216594216595216596216597216598216599216600216601216602216603216604216605216606216607216608216609216610216611216612216613216614216615216616216617216618216619216620216621216622216623216624216625216626216627216628216629216630216631216632216633216634216635216636216637216638216639216640216641216642216643216644216645216646216647216648216649216650216651216652216653216654216655216656216657216658216659216660216661216662216663216664216665216666216667216668216669216670216671216672216673216674216675216676216677216678216679216680216681216682216683216684216685216686216687216688216689216690216691216692216693216694216695216696216697216698216699216700216701216702216703216704216705216706216707216708216709216710216711216712216713216714216715216716216717216718216719216720216721216722216723216724216725216726216727216728216729216730216731216732216733216734216735216736216737216738216739216740216741216742216743216744216745216746216747216748216749216750216751216752216753216754216755216756216757216758216759216760216761216762216763216764216765216766216767216768216769216770216771216772216773216774216775216776216777216778216779216780216781216782216783216784216785216786216787216788216789216790216791216792216793216794216795216796216797216798216799216800216801216802216803216804216805216806216807216808216809216810216811216812216813216814216815216816216817216818216819216820216821216822216823216824216825216826216827216828216829216830216831216832216833216834216835216836216837216838216839216840216841216842216843216844216845216846216847216848216849216850216851216852216853216854216855216856216857216858216859216860216861216862216863216864216865216866216867216868216869216870216871216872216873216874216875216876216877216878216879216880216881216882216883216884216885216886216887216888216889216890216891216892216893216894216895216896216897216898216899216900216901216902216903216904216905216906216907216908216909216910216911216912216913216914216915216916216917216918216919216920216921216922216923216924216925216926216927216928216929216930216931216932216933216934216935216936216937216938216939216940216941216942216943216944216945216946216947216948216949216950216951216952216953216954216955216956216957216958216959216960216961216962216963216964216965216966216967216968216969216970216971216972216973216974216975216976216977216978216979216980216981216982216983216984216985216986216987216988216989216990216991216992216993216994216995216996216997216998216999217000217001217002217003217004217005217006217007217008217009217010217011217012217013217014217015217016217017217018217019217020217021217022217023217024217025217026217027217028217029217030217031217032217033217034217035217036217037217038217039217040217041217042217043217044217045217046217047217048217049217050217051217052217053217054217055217056217057217058217059217060217061217062217063217064217065217066217067217068217069217070217071217072217073217074217075217076217077217078217079217080217081217082217083217084217085217086217087217088217089217090217091217092217093217094217095217096217097217098217099217100217101217102217103217104217105217106217107217108217109217110217111217112217113217114217115217116217117217118217119217120217121217122217123217124217125217126217127217128217129217130217131217132217133217134217135217136217137217138217139217140217141217142217143217144217145217146217147217148217149217150217151217152217153217154217155217156217157217158217159217160217161217162217163217164217165217166217167217168217169217170217171217172217173217174217175217176217177217178217179217180217181217182217183217184217185217186217187217188217189217190217191217192217193217194217195217196217197217198217199217200217201217202217203217204217205217206217207217208217209217210217211217212217213217214217215217216217217217218217219217220217221217222217223217224217225217226217227217228217229217230217231217232217233217234217235217236217237217238217239217240217241217242217243217244217245217246217247217248217249217250217251217252217253217254217255217256217257217258217259217260217261217262217263217264217265217266217267217268217269217270217271217272217273217274217275217276217277217278217279217280217281217282217283217284217285217286217287217288217289217290217291217292217293217294217295217296217297217298217299217300217301217302217303217304217305217306217307217308217309217310217311217312217313217314217315217316217317217318217319217320217321217322217323217324217325217326217327217328217329217330217331217332217333217334217335217336217337217338217339217340217341217342217343217344217345217346217347217348217349217350217351217352217353217354217355217356217357217358217359217360217361217362217363217364217365217366217367217368217369217370217371217372217373217374217375217376217377217378217379217380217381217382217383217384217385217386217387217388217389217390217391217392217393217394217395217396217397217398217399217400217401217402217403217404217405217406217407217408217409217410217411217412217413217414217415217416217417217418217419217420217421217422217423217424217425217426217427217428217429217430217431217432217433217434217435217436217437217438217439217440217441217442217443217444217445217446217447217448217449217450217451217452217453217454217455217456217457217458217459217460217461217462217463217464217465217466217467217468217469217470217471217472217473217474217475217476217477217478217479217480217481217482217483217484217485217486217487217488217489217490217491217492217493217494217495217496217497217498217499217500217501217502217503217504217505217506217507217508217509217510217511217512217513217514217515217516217517217518217519217520217521217522217523217524217525217526217527217528217529217530217531217532217533217534217535217536217537217538217539217540217541217542217543217544217545217546217547217548217549217550217551217552217553217554217555217556217557217558217559217560217561217562217563217564217565217566217567217568217569217570217571217572217573217574217575217576217577217578217579217580217581217582217583217584217585217586217587217588217589217590217591217592217593217594217595217596217597217598217599217600217601217602217603217604217605217606217607217608217609217610217611217612217613217614217615217616217617217618217619217620217621217622217623217624217625217626217627217628217629217630217631217632217633217634217635217636217637217638217639217640217641217642217643217644217645217646217647217648217649217650217651217652217653217654217655217656217657217658217659217660217661217662217663217664217665217666217667217668217669217670217671217672217673217674217675217676217677217678217679217680217681217682217683217684217685217686217687217688217689217690217691217692217693217694217695217696217697217698217699217700217701217702217703217704217705217706217707217708217709217710217711217712217713217714217715217716217717217718217719217720217721217722217723217724217725217726217727217728217729217730217731217732217733217734217735217736217737217738217739217740217741217742217743217744217745217746217747217748217749217750217751217752217753217754217755217756217757217758217759217760217761217762217763217764217765217766217767217768217769217770217771217772217773217774217775217776217777217778217779217780217781217782217783217784217785217786217787217788217789217790217791217792217793217794217795217796217797217798217799217800217801217802217803217804217805217806217807217808217809217810217811217812217813217814217815217816217817217818217819217820217821217822217823217824217825217826217827217828217829217830217831217832217833217834217835217836217837217838217839217840217841217842217843217844217845217846217847217848217849217850217851217852217853217854217855217856217857217858217859217860217861217862217863217864217865217866217867217868217869217870217871217872217873217874217875217876217877217878217879217880217881217882217883217884217885217886217887217888217889217890217891217892217893217894217895217896217897217898217899217900217901217902217903217904217905217906217907217908217909217910217911217912217913217914217915217916217917217918217919217920217921217922217923217924217925217926217927217928217929217930217931217932217933217934217935217936217937217938217939217940217941217942217943217944217945217946217947217948217949217950217951217952217953217954217955217956217957217958217959217960217961217962217963217964217965217966217967217968217969217970217971217972217973217974217975217976217977217978217979217980217981217982217983217984217985217986217987217988217989217990217991217992217993217994217995217996217997217998217999218000218001218002218003218004218005218006218007218008218009218010218011218012218013218014218015218016218017218018218019218020218021218022218023218024218025218026218027218028218029218030218031218032218033218034218035218036218037218038218039218040218041218042218043218044218045218046218047218048218049218050218051218052218053218054218055218056218057218058218059218060218061218062218063218064218065218066218067218068218069218070218071218072218073218074218075218076218077218078218079218080218081218082218083218084218085218086218087218088218089218090218091218092218093218094218095218096218097218098218099218100218101218102218103218104218105218106218107218108218109218110218111218112218113218114218115218116218117218118218119218120218121218122218123218124218125218126218127218128218129218130218131218132218133218134218135218136218137218138218139218140218141218142218143218144218145218146218147218148218149218150218151218152218153218154218155218156218157218158218159218160218161218162218163218164218165218166218167218168218169218170218171218172218173218174218175218176218177218178218179218180218181218182218183218184218185218186218187218188218189218190218191218192218193218194218195218196218197218198218199218200218201218202218203218204218205218206218207218208218209218210218211218212218213218214218215218216218217218218218219218220218221218222218223218224218225218226218227218228218229218230218231218232218233218234218235218236218237218238218239218240218241218242218243218244218245218246218247218248218249218250218251218252218253218254218255218256218257218258218259218260218261218262218263218264218265218266218267218268218269218270218271218272218273218274218275218276218277218278218279218280218281218282218283218284218285218286218287218288218289218290218291218292218293218294218295218296218297218298218299218300218301218302218303218304218305218306218307218308218309218310218311218312218313218314218315218316218317218318218319218320218321218322218323218324218325218326218327218328218329218330218331218332218333218334218335218336218337218338218339218340218341218342218343218344218345218346218347218348218349218350218351218352218353218354218355218356218357218358218359218360218361218362218363218364218365218366218367218368218369218370218371218372218373218374218375218376218377218378218379218380218381218382218383218384218385218386218387218388218389218390218391218392218393218394218395218396218397218398218399218400218401218402218403218404218405218406218407218408218409218410218411218412218413218414218415218416218417218418218419218420218421218422218423218424218425218426218427218428218429218430218431218432218433218434218435218436218437218438218439218440218441218442218443218444218445218446218447218448218449218450218451218452218453218454218455218456218457218458218459218460218461218462218463218464218465218466218467218468218469218470218471218472218473218474218475218476218477218478218479218480218481218482218483218484218485218486218487218488218489218490218491218492218493218494218495218496218497218498218499218500218501218502218503218504218505218506218507218508218509218510218511218512218513218514218515218516218517218518218519218520218521218522218523218524218525218526218527218528218529218530218531218532218533218534218535218536218537218538218539218540218541218542218543218544218545218546218547218548218549218550218551218552218553218554218555218556218557218558218559218560218561218562218563218564218565218566218567218568218569218570218571218572218573218574218575218576218577218578218579218580218581218582218583218584218585218586218587218588218589218590218591218592218593218594218595218596218597218598218599218600218601218602218603218604218605218606218607218608218609218610218611218612218613218614218615218616218617218618218619218620218621218622218623218624218625218626218627218628218629218630218631218632218633218634218635218636218637218638218639218640218641218642218643218644218645218646218647218648218649218650218651218652218653218654218655218656218657218658218659218660218661218662218663218664218665218666218667218668218669218670218671218672218673218674218675218676218677218678218679218680218681218682218683218684218685218686218687218688218689218690218691218692218693218694218695218696218697218698218699218700218701218702218703218704218705218706218707218708218709218710218711218712218713218714218715218716218717218718218719218720218721218722218723218724218725218726218727218728218729218730218731218732218733218734218735218736218737218738218739218740218741218742218743218744218745218746218747218748218749218750218751218752218753218754218755218756218757218758218759218760218761218762218763218764218765218766218767218768218769218770218771218772218773218774218775218776218777218778218779218780218781218782218783218784218785218786218787218788218789218790218791218792218793218794218795218796218797218798218799218800218801218802218803218804218805218806218807218808218809218810218811218812218813218814218815218816218817218818218819218820218821218822218823218824218825218826218827218828218829218830218831218832218833218834218835218836218837218838218839218840218841218842218843218844218845218846218847218848218849218850218851218852218853218854218855218856218857218858218859218860218861218862218863218864218865218866218867218868218869218870218871218872218873218874218875218876218877218878218879218880218881218882218883218884218885218886218887218888218889218890218891218892218893218894218895218896218897218898218899218900218901218902218903218904218905218906218907218908218909218910218911218912218913218914218915218916218917218918218919218920218921218922218923218924218925218926218927218928218929218930218931218932218933218934218935218936218937218938218939218940218941218942218943218944218945218946218947218948218949218950218951218952218953218954218955218956218957218958218959218960218961218962218963218964218965218966218967218968218969218970218971218972218973218974218975218976218977218978218979218980218981218982218983218984218985218986218987218988218989218990218991218992218993218994218995218996218997218998218999219000219001219002219003219004219005219006219007219008219009219010219011219012219013219014219015219016219017219018219019219020219021219022219023219024219025219026219027219028219029219030219031219032219033219034219035219036219037219038219039219040219041219042219043219044219045219046219047219048219049219050219051219052219053219054219055219056219057219058219059219060219061219062219063219064219065219066219067219068219069219070219071219072219073219074219075219076219077219078219079219080219081219082219083219084219085219086219087219088219089219090219091219092219093219094219095219096219097219098219099219100219101219102219103219104219105219106219107219108219109219110219111219112219113219114219115219116219117219118219119219120219121219122219123219124219125219126219127219128219129219130219131219132219133219134219135219136219137219138219139219140219141219142219143219144219145219146219147219148219149219150219151219152219153219154219155219156219157219158219159219160219161219162219163219164219165219166219167219168219169219170219171219172219173219174219175219176219177219178219179219180219181219182219183219184219185219186219187219188219189219190219191219192219193219194219195219196219197219198219199219200219201219202219203219204219205219206219207219208219209219210219211219212219213219214219215219216219217219218219219219220219221219222219223219224219225219226219227219228219229219230219231219232219233219234219235219236219237219238219239219240219241219242219243219244219245219246219247219248219249219250219251219252219253219254219255219256219257219258219259219260219261219262219263219264219265219266219267219268219269219270219271219272219273219274219275219276219277219278219279219280219281219282219283219284219285219286219287219288219289219290219291219292219293219294219295219296219297219298219299219300219301219302219303219304219305219306219307219308219309219310219311219312219313219314219315219316219317219318219319219320219321219322219323219324219325219326219327219328219329219330219331219332219333219334219335219336219337219338219339219340219341219342219343219344219345219346219347219348219349219350219351219352219353219354219355219356219357219358219359219360219361219362219363219364219365219366219367219368219369219370219371219372219373219374219375219376219377219378219379219380219381219382219383219384219385219386219387219388219389219390219391219392219393219394219395219396219397219398219399219400219401219402219403219404219405219406219407219408219409219410219411219412219413219414219415219416219417219418219419219420219421219422219423219424219425219426219427219428219429219430219431219432219433219434219435219436219437219438219439219440219441219442219443219444219445219446219447219448219449219450219451219452219453219454219455219456219457219458219459219460219461219462219463219464219465219466219467219468219469219470219471219472219473219474219475219476219477219478219479219480219481219482219483219484219485219486219487219488219489219490219491219492219493219494219495219496219497219498219499219500219501219502219503219504219505219506219507219508219509219510219511219512219513219514219515219516219517219518219519219520219521219522219523219524219525219526219527219528219529219530219531219532219533219534219535219536219537219538219539219540219541219542219543219544219545219546219547219548219549219550219551219552219553219554219555219556219557219558219559219560219561219562219563219564219565219566219567219568219569219570219571219572219573219574219575219576219577219578219579219580219581219582219583219584219585219586219587219588219589219590219591219592219593219594219595219596219597219598219599219600219601219602219603219604219605219606219607219608219609219610219611219612219613219614219615219616219617219618219619219620219621219622219623219624219625219626219627219628219629219630219631219632219633219634219635219636219637219638219639219640219641219642219643219644219645219646219647219648219649219650219651219652219653219654219655219656219657219658219659219660219661219662219663219664219665219666219667219668219669219670219671219672219673219674219675219676219677219678219679219680219681219682219683219684219685219686219687219688219689219690219691219692219693219694219695219696219697219698219699219700219701219702219703219704219705219706219707219708219709219710219711219712219713219714219715219716219717219718219719219720219721219722219723219724219725219726219727219728219729219730219731219732219733219734219735219736219737219738219739219740219741219742219743219744219745219746219747219748219749219750219751219752219753219754219755219756219757219758219759219760219761219762219763219764219765219766219767219768219769219770219771219772219773219774219775219776219777219778219779219780219781219782219783219784219785219786219787219788219789219790219791219792219793219794219795219796219797219798219799219800219801219802219803219804219805219806219807219808219809219810219811219812219813219814219815219816219817219818219819219820219821219822219823219824219825219826219827219828219829219830219831219832219833219834219835219836219837219838219839219840219841219842219843219844219845219846219847219848219849219850219851219852219853219854219855219856219857219858219859219860219861219862219863219864219865219866219867219868219869219870219871219872219873219874219875219876219877219878219879219880219881219882219883219884219885219886219887219888219889219890219891219892219893219894219895219896219897219898219899219900219901219902219903219904219905219906219907219908219909219910219911219912219913219914219915219916219917219918219919219920219921219922219923219924219925219926219927219928219929219930219931219932219933219934219935219936219937219938219939219940219941219942219943219944219945219946219947219948219949219950219951219952219953219954219955219956219957219958219959219960219961219962219963219964219965219966219967219968219969219970219971219972219973219974219975219976219977219978219979219980219981219982219983219984219985219986219987219988219989219990219991219992219993219994219995219996219997219998219999220000220001220002220003220004220005220006220007220008220009220010220011220012220013220014220015220016220017220018220019220020220021220022220023220024220025220026220027220028220029220030220031220032220033220034220035220036220037220038220039220040220041220042220043220044220045220046220047220048220049220050220051220052220053220054220055220056220057220058220059220060220061220062220063220064220065220066220067220068220069220070220071220072220073220074220075220076220077220078220079220080220081220082220083220084220085220086220087220088220089220090220091220092220093220094220095220096220097220098220099220100220101220102220103220104220105220106220107220108220109220110220111220112220113220114220115220116220117220118220119220120220121220122220123220124220125220126220127220128220129220130220131220132220133220134220135220136220137220138220139220140220141220142220143220144220145220146220147220148220149220150220151220152220153220154220155220156220157220158220159220160220161220162220163220164220165220166220167220168220169220170220171220172220173220174220175220176220177220178220179220180220181220182220183220184220185220186220187220188220189220190220191220192220193220194220195220196220197220198220199220200220201220202220203220204220205220206220207220208220209220210220211220212220213220214220215220216220217220218220219220220220221220222220223220224220225220226220227220228220229220230220231220232220233220234220235220236220237220238220239220240220241220242220243220244220245220246220247220248220249220250220251220252220253220254220255220256220257220258220259220260220261220262220263220264220265220266220267220268220269220270220271220272220273220274220275220276220277220278220279220280220281220282220283220284220285220286220287220288220289220290220291220292220293220294220295220296220297220298220299220300220301220302220303220304220305220306220307220308220309220310220311220312220313220314220315220316220317220318220319220320220321220322220323220324220325220326220327220328220329220330220331220332220333220334220335220336220337220338220339220340220341220342220343220344220345220346220347220348220349220350220351220352220353220354220355220356220357220358220359220360220361220362220363220364220365220366220367220368220369220370220371220372220373220374220375220376220377220378220379220380220381220382220383220384220385220386220387220388220389220390220391220392220393220394220395220396220397220398220399220400220401220402220403220404220405220406220407220408220409220410220411220412220413220414220415220416220417220418220419220420220421220422220423220424220425220426220427220428220429220430220431220432220433220434220435220436220437220438220439220440220441220442220443220444220445220446220447220448220449220450220451220452220453220454220455220456220457220458220459220460220461220462220463220464220465220466220467220468220469220470220471220472220473220474220475220476220477220478220479220480220481220482220483220484220485220486220487220488220489220490220491220492220493220494220495220496220497220498220499220500220501220502220503220504220505220506220507220508220509220510220511220512220513220514220515220516220517220518220519220520220521220522220523220524220525220526220527220528220529220530220531220532220533220534220535220536220537220538220539220540220541220542220543220544220545220546220547220548220549220550220551220552220553220554220555220556220557220558220559220560220561220562220563220564220565220566220567220568220569220570220571220572220573220574220575220576220577220578220579220580220581220582220583220584220585220586220587220588220589220590220591220592220593220594220595220596220597220598220599220600220601220602220603220604220605220606220607220608220609220610220611220612220613220614220615220616220617220618220619220620220621220622220623220624220625220626220627220628220629220630220631220632220633220634220635220636220637220638220639220640220641220642220643220644220645220646220647220648220649220650220651220652220653220654220655220656220657220658220659220660220661220662220663220664220665220666220667220668220669220670220671220672220673220674220675220676220677220678220679220680220681220682220683220684220685220686220687220688220689220690220691220692220693220694220695220696220697220698220699220700220701220702220703220704220705220706220707220708220709220710220711220712220713220714220715220716220717220718220719220720220721220722220723220724220725220726220727220728220729220730220731220732220733220734220735220736220737220738220739220740220741220742220743220744220745220746220747220748220749220750220751220752220753220754220755220756220757220758220759220760220761220762220763220764220765220766220767220768220769220770220771220772220773220774220775220776220777220778220779220780220781220782220783220784220785220786220787220788220789220790220791220792220793220794220795220796220797220798220799220800220801220802220803220804220805220806220807220808220809220810220811220812220813220814220815220816220817220818220819220820220821220822220823220824220825220826220827220828220829220830220831220832220833220834220835220836220837220838220839220840220841220842220843220844220845220846220847220848220849220850220851220852220853220854220855220856220857220858220859220860220861220862220863220864220865220866220867220868220869220870220871220872220873220874220875220876220877220878220879220880220881220882220883220884220885220886220887220888220889220890220891220892220893220894220895220896220897220898220899220900220901220902220903220904220905220906220907220908220909220910220911220912220913220914220915220916220917220918220919220920220921220922220923220924220925220926220927220928220929220930220931220932220933220934220935220936220937220938220939220940220941220942220943220944220945220946220947220948220949220950220951220952220953220954220955220956220957220958220959220960220961220962220963220964220965220966220967220968220969220970220971220972220973220974220975220976220977220978220979220980220981220982220983220984220985220986220987220988220989220990220991220992220993220994220995220996220997220998220999221000221001221002221003221004221005221006221007221008221009221010221011221012221013221014221015221016221017221018221019221020221021221022221023221024221025221026221027221028221029221030221031221032221033221034221035221036221037221038221039221040221041221042221043221044221045221046221047221048221049221050221051221052221053221054221055221056221057221058221059221060221061221062221063221064221065221066221067221068221069221070221071221072221073221074221075221076221077221078221079221080221081221082221083221084221085221086221087221088221089221090221091221092221093221094221095221096221097221098221099221100221101221102221103221104221105221106221107221108221109221110221111221112221113221114221115221116221117221118221119221120221121221122221123221124221125221126221127221128221129221130221131221132221133221134221135221136221137221138221139221140221141221142221143221144221145221146221147221148221149221150221151221152221153221154221155221156221157221158221159221160221161221162221163221164221165221166221167221168221169221170221171221172221173221174221175221176221177221178221179221180221181221182221183221184221185221186221187221188221189221190221191221192221193221194221195221196221197221198221199221200221201221202221203221204221205221206221207221208221209221210221211221212221213221214221215221216221217221218221219221220221221221222221223221224221225221226221227221228221229221230221231221232221233221234221235221236221237221238221239221240221241221242221243221244221245221246221247221248221249221250221251221252221253221254221255221256221257221258221259221260221261221262221263221264221265221266221267221268221269221270221271221272221273221274221275221276221277221278221279221280221281221282221283221284221285221286221287221288221289221290221291221292221293221294221295221296221297221298221299221300221301221302221303221304221305221306221307221308221309221310221311221312221313221314221315221316221317221318221319221320221321221322221323221324221325221326221327221328221329221330221331221332221333221334221335221336221337221338221339221340221341221342221343221344221345221346221347221348221349221350221351221352221353221354221355221356221357221358221359221360221361221362221363221364221365221366221367221368221369221370221371221372221373221374221375221376221377221378221379221380221381221382221383221384221385221386221387221388221389221390221391221392221393221394221395221396221397221398221399221400221401221402221403221404221405221406221407221408221409221410221411221412221413221414221415221416221417221418221419221420221421221422221423221424221425221426221427221428221429221430221431221432221433221434221435221436221437221438221439221440221441221442221443221444221445221446221447221448221449221450221451221452221453221454221455221456221457221458221459221460221461221462221463221464221465221466221467221468221469221470221471221472221473221474221475221476221477221478221479221480221481221482221483221484221485221486221487221488221489221490221491221492221493221494221495221496221497221498221499221500221501221502221503221504221505221506221507221508221509221510221511221512221513221514221515221516221517221518221519221520221521221522221523221524221525221526221527221528221529221530221531221532221533221534221535221536221537221538221539221540221541221542221543221544221545221546221547221548221549221550221551221552221553221554221555221556221557221558221559221560221561221562221563221564221565221566221567221568221569221570221571221572221573221574221575221576221577221578221579221580221581221582221583221584221585221586221587221588221589221590221591221592221593221594221595221596221597221598221599221600221601221602221603221604221605221606221607221608221609221610221611221612221613221614221615221616221617221618221619221620221621221622221623221624221625221626221627221628221629221630221631221632221633221634221635221636221637221638221639221640221641221642221643221644221645221646221647221648221649221650221651221652221653221654221655221656221657221658221659221660221661221662221663221664221665221666221667221668221669221670221671221672221673221674221675221676221677221678221679221680221681221682221683221684221685221686221687221688221689221690221691221692221693221694221695221696221697221698221699221700221701221702221703221704221705221706221707221708221709221710221711221712221713221714221715221716221717221718221719221720221721221722221723221724221725221726221727221728221729221730221731221732221733221734221735221736221737221738221739221740221741221742221743221744221745221746221747221748221749221750221751221752221753221754221755221756221757221758221759221760221761221762221763221764221765221766221767221768221769221770221771221772221773221774221775221776221777221778221779221780221781221782221783221784221785221786221787221788221789221790221791221792221793221794221795221796221797221798221799221800221801221802221803221804221805221806221807221808221809221810221811221812221813221814221815221816221817221818221819221820221821221822221823221824221825221826221827221828221829221830221831221832221833221834221835221836221837221838221839221840221841221842221843221844221845221846221847221848221849221850221851221852221853221854221855221856221857221858221859221860221861221862221863221864221865221866221867221868221869221870221871221872221873221874221875221876221877221878221879221880221881221882221883221884221885221886221887221888221889221890221891221892221893221894221895221896221897221898221899221900221901221902221903221904221905221906221907221908221909221910221911221912221913221914221915221916221917221918221919221920221921221922221923221924221925221926221927221928221929221930221931221932221933221934221935221936221937221938221939221940221941221942221943221944221945221946221947221948221949221950221951221952221953221954221955221956221957221958221959221960221961221962221963221964221965221966221967221968221969221970221971221972221973221974221975221976221977221978221979221980221981221982221983221984221985221986221987221988221989221990221991221992221993221994221995221996221997221998221999222000222001222002222003222004222005222006222007222008222009222010222011222012222013222014222015222016222017222018222019222020222021222022222023222024222025222026222027222028222029222030222031222032222033222034222035222036222037222038222039222040222041222042222043222044222045222046222047222048222049222050222051222052222053222054222055222056222057222058222059222060222061222062222063222064222065222066222067222068222069222070222071222072222073222074222075222076222077222078222079222080222081222082222083222084222085222086222087222088222089222090222091222092222093222094222095222096222097222098222099222100222101222102222103222104222105222106222107222108222109222110222111222112222113222114222115222116222117222118222119222120222121222122222123222124222125222126222127222128222129222130222131222132222133222134222135222136222137222138222139222140222141222142222143222144222145222146222147222148222149222150222151222152222153222154222155222156222157222158222159222160222161222162222163222164222165222166222167222168222169222170222171222172222173222174222175222176222177222178222179222180222181222182222183222184222185222186222187222188222189222190222191222192222193222194222195222196222197222198222199222200222201222202222203222204222205222206222207222208222209222210222211222212222213222214222215222216222217222218222219222220222221222222222223222224222225222226222227222228222229222230222231222232222233222234222235222236222237222238222239222240222241222242222243222244222245222246222247222248222249222250222251222252222253222254222255222256222257222258222259222260222261222262222263222264222265222266222267222268222269222270222271222272222273222274222275222276222277222278222279222280222281222282222283222284222285222286222287222288222289222290222291222292222293222294222295222296222297222298222299222300222301222302222303222304222305222306222307222308222309222310222311222312222313222314222315222316222317222318222319222320222321222322222323222324222325222326222327222328222329222330222331222332222333222334222335222336222337222338222339222340222341222342222343222344222345222346222347222348222349222350222351222352222353222354222355222356222357222358222359222360222361222362222363222364222365222366222367222368222369222370222371222372222373222374222375222376222377222378222379222380222381222382222383222384222385222386222387222388222389222390222391222392222393222394222395222396222397222398222399222400222401222402222403222404222405222406222407222408222409222410222411222412222413222414222415222416222417222418222419222420222421222422222423222424222425222426222427222428222429222430222431222432222433222434222435222436222437222438222439222440222441222442222443222444222445222446222447222448222449222450222451222452222453222454222455222456222457222458222459222460222461222462222463222464222465222466222467222468222469222470222471222472222473222474222475222476222477222478222479222480222481222482222483222484222485222486222487222488222489222490222491222492222493222494222495222496222497222498222499222500222501222502222503222504222505222506222507222508222509222510222511222512222513222514222515222516222517222518222519222520222521222522222523222524222525222526222527222528222529222530222531222532222533222534222535222536222537222538222539222540222541222542222543222544222545222546222547222548222549222550222551222552222553222554222555222556222557222558222559222560222561222562222563222564222565222566222567222568222569222570222571222572222573222574222575222576222577222578222579222580222581222582222583222584222585222586222587222588222589222590222591222592222593222594222595222596222597222598222599222600222601222602222603222604222605222606222607222608222609222610222611222612222613222614222615222616222617222618222619222620222621222622222623222624222625222626222627222628222629222630222631222632222633222634222635222636222637222638222639222640222641222642222643222644222645222646222647222648222649222650222651222652222653222654222655222656222657222658222659222660222661222662222663222664222665222666222667222668222669222670222671
  1. import {
  2. __commonJS,
  3. __esm,
  4. __export,
  5. __require,
  6. __toCommonJS
  7. } from "./chunk-S5KM4IGW.js";
  8. // node_modules/url/node_modules/punycode/punycode.js
  9. var require_punycode = __commonJS({
  10. "node_modules/url/node_modules/punycode/punycode.js"(exports2, module2) {
  11. (function(root) {
  12. var freeExports = typeof exports2 == "object" && exports2 && !exports2.nodeType && exports2;
  13. var freeModule = typeof module2 == "object" && module2 && !module2.nodeType && module2;
  14. var freeGlobal = typeof global == "object" && global;
  15. if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal) {
  16. root = freeGlobal;
  17. }
  18. var punycode2, maxInt = 2147483647, base = 36, tMin = 1, tMax = 26, skew = 38, damp = 700, initialBias = 72, initialN = 128, delimiter = "-", regexPunycode = /^xn--/, regexNonASCII = /[^\x20-\x7E]/, regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, errors = {
  19. "overflow": "Overflow: input needs wider integers to process",
  20. "not-basic": "Illegal input >= 0x80 (not a basic code point)",
  21. "invalid-input": "Invalid input"
  22. }, baseMinusTMin = base - tMin, floor = Math.floor, stringFromCharCode = String.fromCharCode, key;
  23. function error(type) {
  24. throw RangeError(errors[type]);
  25. }
  26. function map(array, fn) {
  27. var length3 = array.length;
  28. var result = [];
  29. while (length3--) {
  30. result[length3] = fn(array[length3]);
  31. }
  32. return result;
  33. }
  34. function mapDomain(string, fn) {
  35. var parts = string.split("@");
  36. var result = "";
  37. if (parts.length > 1) {
  38. result = parts[0] + "@";
  39. string = parts[1];
  40. }
  41. string = string.replace(regexSeparators, ".");
  42. var labels = string.split(".");
  43. var encoded = map(labels, fn).join(".");
  44. return result + encoded;
  45. }
  46. function ucs2decode(string) {
  47. var output = [], counter = 0, length3 = string.length, value, extra;
  48. while (counter < length3) {
  49. value = string.charCodeAt(counter++);
  50. if (value >= 55296 && value <= 56319 && counter < length3) {
  51. extra = string.charCodeAt(counter++);
  52. if ((extra & 64512) == 56320) {
  53. output.push(((value & 1023) << 10) + (extra & 1023) + 65536);
  54. } else {
  55. output.push(value);
  56. counter--;
  57. }
  58. } else {
  59. output.push(value);
  60. }
  61. }
  62. return output;
  63. }
  64. function ucs2encode(array) {
  65. return map(array, function(value) {
  66. var output = "";
  67. if (value > 65535) {
  68. value -= 65536;
  69. output += stringFromCharCode(value >>> 10 & 1023 | 55296);
  70. value = 56320 | value & 1023;
  71. }
  72. output += stringFromCharCode(value);
  73. return output;
  74. }).join("");
  75. }
  76. function basicToDigit(codePoint) {
  77. if (codePoint - 48 < 10) {
  78. return codePoint - 22;
  79. }
  80. if (codePoint - 65 < 26) {
  81. return codePoint - 65;
  82. }
  83. if (codePoint - 97 < 26) {
  84. return codePoint - 97;
  85. }
  86. return base;
  87. }
  88. function digitToBasic(digit, flag) {
  89. return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
  90. }
  91. function adapt(delta, numPoints, firstTime) {
  92. var k = 0;
  93. delta = firstTime ? floor(delta / damp) : delta >> 1;
  94. delta += floor(delta / numPoints);
  95. for (; delta > baseMinusTMin * tMax >> 1; k += base) {
  96. delta = floor(delta / baseMinusTMin);
  97. }
  98. return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
  99. }
  100. function decode(input) {
  101. var output = [], inputLength = input.length, out, i2 = 0, n2 = initialN, bias = initialBias, basic, j, index2, oldi, w, k, digit, t, baseMinusT;
  102. basic = input.lastIndexOf(delimiter);
  103. if (basic < 0) {
  104. basic = 0;
  105. }
  106. for (j = 0; j < basic; ++j) {
  107. if (input.charCodeAt(j) >= 128) {
  108. error("not-basic");
  109. }
  110. output.push(input.charCodeAt(j));
  111. }
  112. for (index2 = basic > 0 ? basic + 1 : 0; index2 < inputLength; ) {
  113. for (oldi = i2, w = 1, k = base; ; k += base) {
  114. if (index2 >= inputLength) {
  115. error("invalid-input");
  116. }
  117. digit = basicToDigit(input.charCodeAt(index2++));
  118. if (digit >= base || digit > floor((maxInt - i2) / w)) {
  119. error("overflow");
  120. }
  121. i2 += digit * w;
  122. t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
  123. if (digit < t) {
  124. break;
  125. }
  126. baseMinusT = base - t;
  127. if (w > floor(maxInt / baseMinusT)) {
  128. error("overflow");
  129. }
  130. w *= baseMinusT;
  131. }
  132. out = output.length + 1;
  133. bias = adapt(i2 - oldi, out, oldi == 0);
  134. if (floor(i2 / out) > maxInt - n2) {
  135. error("overflow");
  136. }
  137. n2 += floor(i2 / out);
  138. i2 %= out;
  139. output.splice(i2++, 0, n2);
  140. }
  141. return ucs2encode(output);
  142. }
  143. function encode(input) {
  144. var n2, delta, handledCPCount, basicLength, bias, j, m, q, k, t, currentValue, output = [], inputLength, handledCPCountPlusOne, baseMinusT, qMinusT;
  145. input = ucs2decode(input);
  146. inputLength = input.length;
  147. n2 = initialN;
  148. delta = 0;
  149. bias = initialBias;
  150. for (j = 0; j < inputLength; ++j) {
  151. currentValue = input[j];
  152. if (currentValue < 128) {
  153. output.push(stringFromCharCode(currentValue));
  154. }
  155. }
  156. handledCPCount = basicLength = output.length;
  157. if (basicLength) {
  158. output.push(delimiter);
  159. }
  160. while (handledCPCount < inputLength) {
  161. for (m = maxInt, j = 0; j < inputLength; ++j) {
  162. currentValue = input[j];
  163. if (currentValue >= n2 && currentValue < m) {
  164. m = currentValue;
  165. }
  166. }
  167. handledCPCountPlusOne = handledCPCount + 1;
  168. if (m - n2 > floor((maxInt - delta) / handledCPCountPlusOne)) {
  169. error("overflow");
  170. }
  171. delta += (m - n2) * handledCPCountPlusOne;
  172. n2 = m;
  173. for (j = 0; j < inputLength; ++j) {
  174. currentValue = input[j];
  175. if (currentValue < n2 && ++delta > maxInt) {
  176. error("overflow");
  177. }
  178. if (currentValue == n2) {
  179. for (q = delta, k = base; ; k += base) {
  180. t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
  181. if (q < t) {
  182. break;
  183. }
  184. qMinusT = q - t;
  185. baseMinusT = base - t;
  186. output.push(
  187. stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
  188. );
  189. q = floor(qMinusT / baseMinusT);
  190. }
  191. output.push(stringFromCharCode(digitToBasic(q, 0)));
  192. bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
  193. delta = 0;
  194. ++handledCPCount;
  195. }
  196. }
  197. ++delta;
  198. ++n2;
  199. }
  200. return output.join("");
  201. }
  202. function toUnicode(input) {
  203. return mapDomain(input, function(string) {
  204. return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
  205. });
  206. }
  207. function toASCII(input) {
  208. return mapDomain(input, function(string) {
  209. return regexNonASCII.test(string) ? "xn--" + encode(string) : string;
  210. });
  211. }
  212. punycode2 = {
  213. "version": "1.3.2",
  214. "ucs2": {
  215. "decode": ucs2decode,
  216. "encode": ucs2encode
  217. },
  218. "decode": decode,
  219. "encode": encode,
  220. "toASCII": toASCII,
  221. "toUnicode": toUnicode
  222. };
  223. if (typeof define == "function" && typeof define.amd == "object" && define.amd) {
  224. define("punycode", function() {
  225. return punycode2;
  226. });
  227. } else if (freeExports && freeModule) {
  228. if (module2.exports == freeExports) {
  229. freeModule.exports = punycode2;
  230. } else {
  231. for (key in punycode2) {
  232. punycode2.hasOwnProperty(key) && (freeExports[key] = punycode2[key]);
  233. }
  234. }
  235. } else {
  236. root.punycode = punycode2;
  237. }
  238. })(exports2);
  239. }
  240. });
  241. // node_modules/url/util.js
  242. var require_util = __commonJS({
  243. "node_modules/url/util.js"(exports2, module2) {
  244. "use strict";
  245. module2.exports = {
  246. isString: function(arg) {
  247. return typeof arg === "string";
  248. },
  249. isObject: function(arg) {
  250. return typeof arg === "object" && arg !== null;
  251. },
  252. isNull: function(arg) {
  253. return arg === null;
  254. },
  255. isNullOrUndefined: function(arg) {
  256. return arg == null;
  257. }
  258. };
  259. }
  260. });
  261. // node_modules/querystring/decode.js
  262. var require_decode = __commonJS({
  263. "node_modules/querystring/decode.js"(exports2, module2) {
  264. "use strict";
  265. function hasOwnProperty2(obj, prop) {
  266. return Object.prototype.hasOwnProperty.call(obj, prop);
  267. }
  268. module2.exports = function(qs, sep, eq, options) {
  269. sep = sep || "&";
  270. eq = eq || "=";
  271. var obj = {};
  272. if (typeof qs !== "string" || qs.length === 0) {
  273. return obj;
  274. }
  275. var regexp = /\+/g;
  276. qs = qs.split(sep);
  277. var maxKeys = 1e3;
  278. if (options && typeof options.maxKeys === "number") {
  279. maxKeys = options.maxKeys;
  280. }
  281. var len = qs.length;
  282. if (maxKeys > 0 && len > maxKeys) {
  283. len = maxKeys;
  284. }
  285. for (var i2 = 0; i2 < len; ++i2) {
  286. var x = qs[i2].replace(regexp, "%20"), idx = x.indexOf(eq), kstr, vstr, k, v7;
  287. if (idx >= 0) {
  288. kstr = x.substr(0, idx);
  289. vstr = x.substr(idx + 1);
  290. } else {
  291. kstr = x;
  292. vstr = "";
  293. }
  294. k = decodeURIComponent(kstr);
  295. v7 = decodeURIComponent(vstr);
  296. if (!hasOwnProperty2(obj, k)) {
  297. obj[k] = v7;
  298. } else if (Array.isArray(obj[k])) {
  299. obj[k].push(v7);
  300. } else {
  301. obj[k] = [obj[k], v7];
  302. }
  303. }
  304. return obj;
  305. };
  306. }
  307. });
  308. // node_modules/querystring/encode.js
  309. var require_encode = __commonJS({
  310. "node_modules/querystring/encode.js"(exports2, module2) {
  311. "use strict";
  312. var stringifyPrimitive = function(v7) {
  313. switch (typeof v7) {
  314. case "string":
  315. return v7;
  316. case "boolean":
  317. return v7 ? "true" : "false";
  318. case "number":
  319. return isFinite(v7) ? v7 : "";
  320. default:
  321. return "";
  322. }
  323. };
  324. module2.exports = function(obj, sep, eq, name) {
  325. sep = sep || "&";
  326. eq = eq || "=";
  327. if (obj === null) {
  328. obj = void 0;
  329. }
  330. if (typeof obj === "object") {
  331. return Object.keys(obj).map(function(k) {
  332. var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
  333. if (Array.isArray(obj[k])) {
  334. return obj[k].map(function(v7) {
  335. return ks + encodeURIComponent(stringifyPrimitive(v7));
  336. }).join(sep);
  337. } else {
  338. return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
  339. }
  340. }).join(sep);
  341. }
  342. if (!name)
  343. return "";
  344. return encodeURIComponent(stringifyPrimitive(name)) + eq + encodeURIComponent(stringifyPrimitive(obj));
  345. };
  346. }
  347. });
  348. // node_modules/querystring/index.js
  349. var require_querystring = __commonJS({
  350. "node_modules/querystring/index.js"(exports2) {
  351. "use strict";
  352. exports2.decode = exports2.parse = require_decode();
  353. exports2.encode = exports2.stringify = require_encode();
  354. }
  355. });
  356. // node_modules/url/url.js
  357. var require_url = __commonJS({
  358. "node_modules/url/url.js"(exports2) {
  359. "use strict";
  360. var punycode2 = require_punycode();
  361. var util = require_util();
  362. exports2.parse = urlParse;
  363. exports2.resolve = urlResolve;
  364. exports2.resolveObject = urlResolveObject;
  365. exports2.format = urlFormat;
  366. exports2.Url = Url;
  367. function Url() {
  368. this.protocol = null;
  369. this.slashes = null;
  370. this.auth = null;
  371. this.host = null;
  372. this.port = null;
  373. this.hostname = null;
  374. this.hash = null;
  375. this.search = null;
  376. this.query = null;
  377. this.pathname = null;
  378. this.path = null;
  379. this.href = null;
  380. }
  381. var protocolPattern = /^([a-z0-9.+-]+:)/i;
  382. var portPattern = /:[0-9]*$/;
  383. var simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/;
  384. var delims = ["<", ">", '"', "`", " ", "\r", "\n", " "];
  385. var unwise = ["{", "}", "|", "\\", "^", "`"].concat(delims);
  386. var autoEscape = ["'"].concat(unwise);
  387. var nonHostChars = ["%", "/", "?", ";", "#"].concat(autoEscape);
  388. var hostEndingChars = ["/", "?", "#"];
  389. var hostnameMaxLen = 255;
  390. var hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/;
  391. var hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/;
  392. var unsafeProtocol = {
  393. "javascript": true,
  394. "javascript:": true
  395. };
  396. var hostlessProtocol = {
  397. "javascript": true,
  398. "javascript:": true
  399. };
  400. var slashedProtocol = {
  401. "http": true,
  402. "https": true,
  403. "ftp": true,
  404. "gopher": true,
  405. "file": true,
  406. "http:": true,
  407. "https:": true,
  408. "ftp:": true,
  409. "gopher:": true,
  410. "file:": true
  411. };
  412. var querystring = require_querystring();
  413. function urlParse(url2, parseQueryString, slashesDenoteHost) {
  414. if (url2 && util.isObject(url2) && url2 instanceof Url)
  415. return url2;
  416. var u3 = new Url();
  417. u3.parse(url2, parseQueryString, slashesDenoteHost);
  418. return u3;
  419. }
  420. Url.prototype.parse = function(url2, parseQueryString, slashesDenoteHost) {
  421. if (!util.isString(url2)) {
  422. throw new TypeError("Parameter 'url' must be a string, not " + typeof url2);
  423. }
  424. var queryIndex = url2.indexOf("?"), splitter2 = queryIndex !== -1 && queryIndex < url2.indexOf("#") ? "?" : "#", uSplit = url2.split(splitter2), slashRegex = /\\/g;
  425. uSplit[0] = uSplit[0].replace(slashRegex, "/");
  426. url2 = uSplit.join(splitter2);
  427. var rest = url2;
  428. rest = rest.trim();
  429. if (!slashesDenoteHost && url2.split("#").length === 1) {
  430. var simplePath = simplePathPattern.exec(rest);
  431. if (simplePath) {
  432. this.path = rest;
  433. this.href = rest;
  434. this.pathname = simplePath[1];
  435. if (simplePath[2]) {
  436. this.search = simplePath[2];
  437. if (parseQueryString) {
  438. this.query = querystring.parse(this.search.substr(1));
  439. } else {
  440. this.query = this.search.substr(1);
  441. }
  442. } else if (parseQueryString) {
  443. this.search = "";
  444. this.query = {};
  445. }
  446. return this;
  447. }
  448. }
  449. var proto = protocolPattern.exec(rest);
  450. if (proto) {
  451. proto = proto[0];
  452. var lowerProto = proto.toLowerCase();
  453. this.protocol = lowerProto;
  454. rest = rest.substr(proto.length);
  455. }
  456. if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) {
  457. var slashes = rest.substr(0, 2) === "//";
  458. if (slashes && !(proto && hostlessProtocol[proto])) {
  459. rest = rest.substr(2);
  460. this.slashes = true;
  461. }
  462. }
  463. if (!hostlessProtocol[proto] && (slashes || proto && !slashedProtocol[proto])) {
  464. var hostEnd = -1;
  465. for (var i2 = 0; i2 < hostEndingChars.length; i2++) {
  466. var hec = rest.indexOf(hostEndingChars[i2]);
  467. if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
  468. hostEnd = hec;
  469. }
  470. var auth, atSign;
  471. if (hostEnd === -1) {
  472. atSign = rest.lastIndexOf("@");
  473. } else {
  474. atSign = rest.lastIndexOf("@", hostEnd);
  475. }
  476. if (atSign !== -1) {
  477. auth = rest.slice(0, atSign);
  478. rest = rest.slice(atSign + 1);
  479. this.auth = decodeURIComponent(auth);
  480. }
  481. hostEnd = -1;
  482. for (var i2 = 0; i2 < nonHostChars.length; i2++) {
  483. var hec = rest.indexOf(nonHostChars[i2]);
  484. if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))
  485. hostEnd = hec;
  486. }
  487. if (hostEnd === -1)
  488. hostEnd = rest.length;
  489. this.host = rest.slice(0, hostEnd);
  490. rest = rest.slice(hostEnd);
  491. this.parseHost();
  492. this.hostname = this.hostname || "";
  493. var ipv6Hostname = this.hostname[0] === "[" && this.hostname[this.hostname.length - 1] === "]";
  494. if (!ipv6Hostname) {
  495. var hostparts = this.hostname.split(/\./);
  496. for (var i2 = 0, l2 = hostparts.length; i2 < l2; i2++) {
  497. var part = hostparts[i2];
  498. if (!part)
  499. continue;
  500. if (!part.match(hostnamePartPattern)) {
  501. var newpart = "";
  502. for (var j = 0, k = part.length; j < k; j++) {
  503. if (part.charCodeAt(j) > 127) {
  504. newpart += "x";
  505. } else {
  506. newpart += part[j];
  507. }
  508. }
  509. if (!newpart.match(hostnamePartPattern)) {
  510. var validParts = hostparts.slice(0, i2);
  511. var notHost = hostparts.slice(i2 + 1);
  512. var bit = part.match(hostnamePartStart);
  513. if (bit) {
  514. validParts.push(bit[1]);
  515. notHost.unshift(bit[2]);
  516. }
  517. if (notHost.length) {
  518. rest = "/" + notHost.join(".") + rest;
  519. }
  520. this.hostname = validParts.join(".");
  521. break;
  522. }
  523. }
  524. }
  525. }
  526. if (this.hostname.length > hostnameMaxLen) {
  527. this.hostname = "";
  528. } else {
  529. this.hostname = this.hostname.toLowerCase();
  530. }
  531. if (!ipv6Hostname) {
  532. this.hostname = punycode2.toASCII(this.hostname);
  533. }
  534. var p2 = this.port ? ":" + this.port : "";
  535. var h = this.hostname || "";
  536. this.host = h + p2;
  537. this.href += this.host;
  538. if (ipv6Hostname) {
  539. this.hostname = this.hostname.substr(1, this.hostname.length - 2);
  540. if (rest[0] !== "/") {
  541. rest = "/" + rest;
  542. }
  543. }
  544. }
  545. if (!unsafeProtocol[lowerProto]) {
  546. for (var i2 = 0, l2 = autoEscape.length; i2 < l2; i2++) {
  547. var ae = autoEscape[i2];
  548. if (rest.indexOf(ae) === -1)
  549. continue;
  550. var esc = encodeURIComponent(ae);
  551. if (esc === ae) {
  552. esc = escape(ae);
  553. }
  554. rest = rest.split(ae).join(esc);
  555. }
  556. }
  557. var hash2 = rest.indexOf("#");
  558. if (hash2 !== -1) {
  559. this.hash = rest.substr(hash2);
  560. rest = rest.slice(0, hash2);
  561. }
  562. var qm = rest.indexOf("?");
  563. if (qm !== -1) {
  564. this.search = rest.substr(qm);
  565. this.query = rest.substr(qm + 1);
  566. if (parseQueryString) {
  567. this.query = querystring.parse(this.query);
  568. }
  569. rest = rest.slice(0, qm);
  570. } else if (parseQueryString) {
  571. this.search = "";
  572. this.query = {};
  573. }
  574. if (rest)
  575. this.pathname = rest;
  576. if (slashedProtocol[lowerProto] && this.hostname && !this.pathname) {
  577. this.pathname = "/";
  578. }
  579. if (this.pathname || this.search) {
  580. var p2 = this.pathname || "";
  581. var s2 = this.search || "";
  582. this.path = p2 + s2;
  583. }
  584. this.href = this.format();
  585. return this;
  586. };
  587. function urlFormat(obj) {
  588. if (util.isString(obj))
  589. obj = urlParse(obj);
  590. if (!(obj instanceof Url))
  591. return Url.prototype.format.call(obj);
  592. return obj.format();
  593. }
  594. Url.prototype.format = function() {
  595. var auth = this.auth || "";
  596. if (auth) {
  597. auth = encodeURIComponent(auth);
  598. auth = auth.replace(/%3A/i, ":");
  599. auth += "@";
  600. }
  601. var protocol = this.protocol || "", pathname = this.pathname || "", hash2 = this.hash || "", host = false, query = "";
  602. if (this.host) {
  603. host = auth + this.host;
  604. } else if (this.hostname) {
  605. host = auth + (this.hostname.indexOf(":") === -1 ? this.hostname : "[" + this.hostname + "]");
  606. if (this.port) {
  607. host += ":" + this.port;
  608. }
  609. }
  610. if (this.query && util.isObject(this.query) && Object.keys(this.query).length) {
  611. query = querystring.stringify(this.query);
  612. }
  613. var search = this.search || query && "?" + query || "";
  614. if (protocol && protocol.substr(-1) !== ":")
  615. protocol += ":";
  616. if (this.slashes || (!protocol || slashedProtocol[protocol]) && host !== false) {
  617. host = "//" + (host || "");
  618. if (pathname && pathname.charAt(0) !== "/")
  619. pathname = "/" + pathname;
  620. } else if (!host) {
  621. host = "";
  622. }
  623. if (hash2 && hash2.charAt(0) !== "#")
  624. hash2 = "#" + hash2;
  625. if (search && search.charAt(0) !== "?")
  626. search = "?" + search;
  627. pathname = pathname.replace(/[?#]/g, function(match) {
  628. return encodeURIComponent(match);
  629. });
  630. search = search.replace("#", "%23");
  631. return protocol + host + pathname + search + hash2;
  632. };
  633. function urlResolve(source, relative) {
  634. return urlParse(source, false, true).resolve(relative);
  635. }
  636. Url.prototype.resolve = function(relative) {
  637. return this.resolveObject(urlParse(relative, false, true)).format();
  638. };
  639. function urlResolveObject(source, relative) {
  640. if (!source)
  641. return relative;
  642. return urlParse(source, false, true).resolveObject(relative);
  643. }
  644. Url.prototype.resolveObject = function(relative) {
  645. if (util.isString(relative)) {
  646. var rel = new Url();
  647. rel.parse(relative, false, true);
  648. relative = rel;
  649. }
  650. var result = new Url();
  651. var tkeys = Object.keys(this);
  652. for (var tk = 0; tk < tkeys.length; tk++) {
  653. var tkey = tkeys[tk];
  654. result[tkey] = this[tkey];
  655. }
  656. result.hash = relative.hash;
  657. if (relative.href === "") {
  658. result.href = result.format();
  659. return result;
  660. }
  661. if (relative.slashes && !relative.protocol) {
  662. var rkeys = Object.keys(relative);
  663. for (var rk = 0; rk < rkeys.length; rk++) {
  664. var rkey = rkeys[rk];
  665. if (rkey !== "protocol")
  666. result[rkey] = relative[rkey];
  667. }
  668. if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) {
  669. result.path = result.pathname = "/";
  670. }
  671. result.href = result.format();
  672. return result;
  673. }
  674. if (relative.protocol && relative.protocol !== result.protocol) {
  675. if (!slashedProtocol[relative.protocol]) {
  676. var keys = Object.keys(relative);
  677. for (var v7 = 0; v7 < keys.length; v7++) {
  678. var k = keys[v7];
  679. result[k] = relative[k];
  680. }
  681. result.href = result.format();
  682. return result;
  683. }
  684. result.protocol = relative.protocol;
  685. if (!relative.host && !hostlessProtocol[relative.protocol]) {
  686. var relPath = (relative.pathname || "").split("/");
  687. while (relPath.length && !(relative.host = relPath.shift()))
  688. ;
  689. if (!relative.host)
  690. relative.host = "";
  691. if (!relative.hostname)
  692. relative.hostname = "";
  693. if (relPath[0] !== "")
  694. relPath.unshift("");
  695. if (relPath.length < 2)
  696. relPath.unshift("");
  697. result.pathname = relPath.join("/");
  698. } else {
  699. result.pathname = relative.pathname;
  700. }
  701. result.search = relative.search;
  702. result.query = relative.query;
  703. result.host = relative.host || "";
  704. result.auth = relative.auth;
  705. result.hostname = relative.hostname || relative.host;
  706. result.port = relative.port;
  707. if (result.pathname || result.search) {
  708. var p2 = result.pathname || "";
  709. var s2 = result.search || "";
  710. result.path = p2 + s2;
  711. }
  712. result.slashes = result.slashes || relative.slashes;
  713. result.href = result.format();
  714. return result;
  715. }
  716. var isSourceAbs = result.pathname && result.pathname.charAt(0) === "/", isRelAbs = relative.host || relative.pathname && relative.pathname.charAt(0) === "/", mustEndAbs = isRelAbs || isSourceAbs || result.host && relative.pathname, removeAllDots = mustEndAbs, srcPath = result.pathname && result.pathname.split("/") || [], relPath = relative.pathname && relative.pathname.split("/") || [], psychotic = result.protocol && !slashedProtocol[result.protocol];
  717. if (psychotic) {
  718. result.hostname = "";
  719. result.port = null;
  720. if (result.host) {
  721. if (srcPath[0] === "")
  722. srcPath[0] = result.host;
  723. else
  724. srcPath.unshift(result.host);
  725. }
  726. result.host = "";
  727. if (relative.protocol) {
  728. relative.hostname = null;
  729. relative.port = null;
  730. if (relative.host) {
  731. if (relPath[0] === "")
  732. relPath[0] = relative.host;
  733. else
  734. relPath.unshift(relative.host);
  735. }
  736. relative.host = null;
  737. }
  738. mustEndAbs = mustEndAbs && (relPath[0] === "" || srcPath[0] === "");
  739. }
  740. if (isRelAbs) {
  741. result.host = relative.host || relative.host === "" ? relative.host : result.host;
  742. result.hostname = relative.hostname || relative.hostname === "" ? relative.hostname : result.hostname;
  743. result.search = relative.search;
  744. result.query = relative.query;
  745. srcPath = relPath;
  746. } else if (relPath.length) {
  747. if (!srcPath)
  748. srcPath = [];
  749. srcPath.pop();
  750. srcPath = srcPath.concat(relPath);
  751. result.search = relative.search;
  752. result.query = relative.query;
  753. } else if (!util.isNullOrUndefined(relative.search)) {
  754. if (psychotic) {
  755. result.hostname = result.host = srcPath.shift();
  756. var authInHost = result.host && result.host.indexOf("@") > 0 ? result.host.split("@") : false;
  757. if (authInHost) {
  758. result.auth = authInHost.shift();
  759. result.host = result.hostname = authInHost.shift();
  760. }
  761. }
  762. result.search = relative.search;
  763. result.query = relative.query;
  764. if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
  765. result.path = (result.pathname ? result.pathname : "") + (result.search ? result.search : "");
  766. }
  767. result.href = result.format();
  768. return result;
  769. }
  770. if (!srcPath.length) {
  771. result.pathname = null;
  772. if (result.search) {
  773. result.path = "/" + result.search;
  774. } else {
  775. result.path = null;
  776. }
  777. result.href = result.format();
  778. return result;
  779. }
  780. var last = srcPath.slice(-1)[0];
  781. var hasTrailingSlash = (result.host || relative.host || srcPath.length > 1) && (last === "." || last === "..") || last === "";
  782. var up = 0;
  783. for (var i2 = srcPath.length; i2 >= 0; i2--) {
  784. last = srcPath[i2];
  785. if (last === ".") {
  786. srcPath.splice(i2, 1);
  787. } else if (last === "..") {
  788. srcPath.splice(i2, 1);
  789. up++;
  790. } else if (up) {
  791. srcPath.splice(i2, 1);
  792. up--;
  793. }
  794. }
  795. if (!mustEndAbs && !removeAllDots) {
  796. for (; up--; up) {
  797. srcPath.unshift("..");
  798. }
  799. }
  800. if (mustEndAbs && srcPath[0] !== "" && (!srcPath[0] || srcPath[0].charAt(0) !== "/")) {
  801. srcPath.unshift("");
  802. }
  803. if (hasTrailingSlash && srcPath.join("/").substr(-1) !== "/") {
  804. srcPath.push("");
  805. }
  806. var isAbsolute = srcPath[0] === "" || srcPath[0] && srcPath[0].charAt(0) === "/";
  807. if (psychotic) {
  808. result.hostname = result.host = isAbsolute ? "" : srcPath.length ? srcPath.shift() : "";
  809. var authInHost = result.host && result.host.indexOf("@") > 0 ? result.host.split("@") : false;
  810. if (authInHost) {
  811. result.auth = authInHost.shift();
  812. result.host = result.hostname = authInHost.shift();
  813. }
  814. }
  815. mustEndAbs = mustEndAbs || result.host && srcPath.length;
  816. if (mustEndAbs && !isAbsolute) {
  817. srcPath.unshift("");
  818. }
  819. if (!srcPath.length) {
  820. result.pathname = null;
  821. result.path = null;
  822. } else {
  823. result.pathname = srcPath.join("/");
  824. }
  825. if (!util.isNull(result.pathname) || !util.isNull(result.search)) {
  826. result.path = (result.pathname ? result.pathname : "") + (result.search ? result.search : "");
  827. }
  828. result.auth = relative.auth || result.auth;
  829. result.slashes = result.slashes || relative.slashes;
  830. result.href = result.format();
  831. return result;
  832. };
  833. Url.prototype.parseHost = function() {
  834. var host = this.host;
  835. var port = portPattern.exec(host);
  836. if (port) {
  837. port = port[0];
  838. if (port !== ":") {
  839. this.port = port.substr(1);
  840. }
  841. host = host.substr(0, host.length - port.length);
  842. }
  843. if (host)
  844. this.hostname = host;
  845. };
  846. }
  847. });
  848. // browser-external:https
  849. var https_exports = {};
  850. __export(https_exports, {
  851. default: () => https_default
  852. });
  853. var https_default;
  854. var init_https = __esm({
  855. "browser-external:https"() {
  856. https_default = new Proxy({}, {
  857. get() {
  858. throw new Error('Module "https" has been externalized for browser compatibility and cannot be accessed in client code.');
  859. }
  860. });
  861. }
  862. });
  863. // browser-external:http
  864. var http_exports = {};
  865. __export(http_exports, {
  866. default: () => http_default
  867. });
  868. var http_default;
  869. var init_http = __esm({
  870. "browser-external:http"() {
  871. http_default = new Proxy({}, {
  872. get() {
  873. throw new Error('Module "http" has been externalized for browser compatibility and cannot be accessed in client code.');
  874. }
  875. });
  876. }
  877. });
  878. // browser-external:zlib
  879. var zlib_exports = {};
  880. __export(zlib_exports, {
  881. default: () => zlib_default
  882. });
  883. var zlib_default;
  884. var init_zlib = __esm({
  885. "browser-external:zlib"() {
  886. zlib_default = new Proxy({}, {
  887. get() {
  888. throw new Error('Module "zlib" has been externalized for browser compatibility and cannot be accessed in client code.');
  889. }
  890. });
  891. }
  892. });
  893. // node_modules/cesium/Source/Core/defined.js
  894. function defined(value) {
  895. return value !== void 0 && value !== null;
  896. }
  897. var defined_default = defined;
  898. // node_modules/cesium/Source/Core/DeveloperError.js
  899. function DeveloperError(message) {
  900. this.name = "DeveloperError";
  901. this.message = message;
  902. let stack;
  903. try {
  904. throw new Error();
  905. } catch (e2) {
  906. stack = e2.stack;
  907. }
  908. this.stack = stack;
  909. }
  910. if (defined_default(Object.create)) {
  911. DeveloperError.prototype = Object.create(Error.prototype);
  912. DeveloperError.prototype.constructor = DeveloperError;
  913. }
  914. DeveloperError.prototype.toString = function() {
  915. let str = `${this.name}: ${this.message}`;
  916. if (defined_default(this.stack)) {
  917. str += `
  918. ${this.stack.toString()}`;
  919. }
  920. return str;
  921. };
  922. DeveloperError.throwInstantiationError = function() {
  923. throw new DeveloperError(
  924. "This function defines an interface and should not be called directly."
  925. );
  926. };
  927. var DeveloperError_default = DeveloperError;
  928. // node_modules/cesium/Source/Core/Check.js
  929. var Check = {};
  930. Check.typeOf = {};
  931. function getUndefinedErrorMessage(name) {
  932. return `${name} is required, actual value was undefined`;
  933. }
  934. function getFailedTypeErrorMessage(actual, expected, name) {
  935. return `Expected ${name} to be typeof ${expected}, actual typeof was ${actual}`;
  936. }
  937. Check.defined = function(name, test) {
  938. if (!defined_default(test)) {
  939. throw new DeveloperError_default(getUndefinedErrorMessage(name));
  940. }
  941. };
  942. Check.typeOf.func = function(name, test) {
  943. if (typeof test !== "function") {
  944. throw new DeveloperError_default(
  945. getFailedTypeErrorMessage(typeof test, "function", name)
  946. );
  947. }
  948. };
  949. Check.typeOf.string = function(name, test) {
  950. if (typeof test !== "string") {
  951. throw new DeveloperError_default(
  952. getFailedTypeErrorMessage(typeof test, "string", name)
  953. );
  954. }
  955. };
  956. Check.typeOf.number = function(name, test) {
  957. if (typeof test !== "number") {
  958. throw new DeveloperError_default(
  959. getFailedTypeErrorMessage(typeof test, "number", name)
  960. );
  961. }
  962. };
  963. Check.typeOf.number.lessThan = function(name, test, limit) {
  964. Check.typeOf.number(name, test);
  965. if (test >= limit) {
  966. throw new DeveloperError_default(
  967. `Expected ${name} to be less than ${limit}, actual value was ${test}`
  968. );
  969. }
  970. };
  971. Check.typeOf.number.lessThanOrEquals = function(name, test, limit) {
  972. Check.typeOf.number(name, test);
  973. if (test > limit) {
  974. throw new DeveloperError_default(
  975. `Expected ${name} to be less than or equal to ${limit}, actual value was ${test}`
  976. );
  977. }
  978. };
  979. Check.typeOf.number.greaterThan = function(name, test, limit) {
  980. Check.typeOf.number(name, test);
  981. if (test <= limit) {
  982. throw new DeveloperError_default(
  983. `Expected ${name} to be greater than ${limit}, actual value was ${test}`
  984. );
  985. }
  986. };
  987. Check.typeOf.number.greaterThanOrEquals = function(name, test, limit) {
  988. Check.typeOf.number(name, test);
  989. if (test < limit) {
  990. throw new DeveloperError_default(
  991. `Expected ${name} to be greater than or equal to ${limit}, actual value was ${test}`
  992. );
  993. }
  994. };
  995. Check.typeOf.object = function(name, test) {
  996. if (typeof test !== "object") {
  997. throw new DeveloperError_default(
  998. getFailedTypeErrorMessage(typeof test, "object", name)
  999. );
  1000. }
  1001. };
  1002. Check.typeOf.bool = function(name, test) {
  1003. if (typeof test !== "boolean") {
  1004. throw new DeveloperError_default(
  1005. getFailedTypeErrorMessage(typeof test, "boolean", name)
  1006. );
  1007. }
  1008. };
  1009. Check.typeOf.bigint = function(name, test) {
  1010. if (typeof test !== "bigint") {
  1011. throw new DeveloperError_default(
  1012. getFailedTypeErrorMessage(typeof test, "bigint", name)
  1013. );
  1014. }
  1015. };
  1016. Check.typeOf.number.equals = function(name1, name2, test1, test2) {
  1017. Check.typeOf.number(name1, test1);
  1018. Check.typeOf.number(name2, test2);
  1019. if (test1 !== test2) {
  1020. throw new DeveloperError_default(
  1021. `${name1} must be equal to ${name2}, the actual values are ${test1} and ${test2}`
  1022. );
  1023. }
  1024. };
  1025. var Check_default = Check;
  1026. // node_modules/cesium/Source/Core/defaultValue.js
  1027. function defaultValue(a4, b) {
  1028. if (a4 !== void 0 && a4 !== null) {
  1029. return a4;
  1030. }
  1031. return b;
  1032. }
  1033. defaultValue.EMPTY_OBJECT = Object.freeze({});
  1034. var defaultValue_default = defaultValue;
  1035. // node_modules/cesium/Source/ThirdParty/mersenne-twister.js
  1036. var MersenneTwister = function(seed) {
  1037. if (seed == void 0) {
  1038. seed = new Date().getTime();
  1039. }
  1040. this.N = 624;
  1041. this.M = 397;
  1042. this.MATRIX_A = 2567483615;
  1043. this.UPPER_MASK = 2147483648;
  1044. this.LOWER_MASK = 2147483647;
  1045. this.mt = new Array(this.N);
  1046. this.mti = this.N + 1;
  1047. if (seed.constructor == Array) {
  1048. this.init_by_array(seed, seed.length);
  1049. } else {
  1050. this.init_seed(seed);
  1051. }
  1052. };
  1053. MersenneTwister.prototype.init_seed = function(s2) {
  1054. this.mt[0] = s2 >>> 0;
  1055. for (this.mti = 1; this.mti < this.N; this.mti++) {
  1056. var s2 = this.mt[this.mti - 1] ^ this.mt[this.mti - 1] >>> 30;
  1057. this.mt[this.mti] = (((s2 & 4294901760) >>> 16) * 1812433253 << 16) + (s2 & 65535) * 1812433253 + this.mti;
  1058. this.mt[this.mti] >>>= 0;
  1059. }
  1060. };
  1061. MersenneTwister.prototype.init_by_array = function(init_key, key_length) {
  1062. var i2, j, k;
  1063. this.init_seed(19650218);
  1064. i2 = 1;
  1065. j = 0;
  1066. k = this.N > key_length ? this.N : key_length;
  1067. for (; k; k--) {
  1068. var s2 = this.mt[i2 - 1] ^ this.mt[i2 - 1] >>> 30;
  1069. this.mt[i2] = (this.mt[i2] ^ (((s2 & 4294901760) >>> 16) * 1664525 << 16) + (s2 & 65535) * 1664525) + init_key[j] + j;
  1070. this.mt[i2] >>>= 0;
  1071. i2++;
  1072. j++;
  1073. if (i2 >= this.N) {
  1074. this.mt[0] = this.mt[this.N - 1];
  1075. i2 = 1;
  1076. }
  1077. if (j >= key_length)
  1078. j = 0;
  1079. }
  1080. for (k = this.N - 1; k; k--) {
  1081. var s2 = this.mt[i2 - 1] ^ this.mt[i2 - 1] >>> 30;
  1082. this.mt[i2] = (this.mt[i2] ^ (((s2 & 4294901760) >>> 16) * 1566083941 << 16) + (s2 & 65535) * 1566083941) - i2;
  1083. this.mt[i2] >>>= 0;
  1084. i2++;
  1085. if (i2 >= this.N) {
  1086. this.mt[0] = this.mt[this.N - 1];
  1087. i2 = 1;
  1088. }
  1089. }
  1090. this.mt[0] = 2147483648;
  1091. };
  1092. MersenneTwister.prototype.random_int = function() {
  1093. var y;
  1094. var mag01 = new Array(0, this.MATRIX_A);
  1095. if (this.mti >= this.N) {
  1096. var kk;
  1097. if (this.mti == this.N + 1)
  1098. this.init_seed(5489);
  1099. for (kk = 0; kk < this.N - this.M; kk++) {
  1100. y = this.mt[kk] & this.UPPER_MASK | this.mt[kk + 1] & this.LOWER_MASK;
  1101. this.mt[kk] = this.mt[kk + this.M] ^ y >>> 1 ^ mag01[y & 1];
  1102. }
  1103. for (; kk < this.N - 1; kk++) {
  1104. y = this.mt[kk] & this.UPPER_MASK | this.mt[kk + 1] & this.LOWER_MASK;
  1105. this.mt[kk] = this.mt[kk + (this.M - this.N)] ^ y >>> 1 ^ mag01[y & 1];
  1106. }
  1107. y = this.mt[this.N - 1] & this.UPPER_MASK | this.mt[0] & this.LOWER_MASK;
  1108. this.mt[this.N - 1] = this.mt[this.M - 1] ^ y >>> 1 ^ mag01[y & 1];
  1109. this.mti = 0;
  1110. }
  1111. y = this.mt[this.mti++];
  1112. y ^= y >>> 11;
  1113. y ^= y << 7 & 2636928640;
  1114. y ^= y << 15 & 4022730752;
  1115. y ^= y >>> 18;
  1116. return y >>> 0;
  1117. };
  1118. MersenneTwister.prototype.random_int31 = function() {
  1119. return this.random_int() >>> 1;
  1120. };
  1121. MersenneTwister.prototype.random_incl = function() {
  1122. return this.random_int() * (1 / 4294967295);
  1123. };
  1124. MersenneTwister.prototype.random = function() {
  1125. return this.random_int() * (1 / 4294967296);
  1126. };
  1127. MersenneTwister.prototype.random_excl = function() {
  1128. return (this.random_int() + 0.5) * (1 / 4294967296);
  1129. };
  1130. MersenneTwister.prototype.random_long = function() {
  1131. var a4 = this.random_int() >>> 5, b = this.random_int() >>> 6;
  1132. return (a4 * 67108864 + b) * (1 / 9007199254740992);
  1133. };
  1134. var mersenneTwister = MersenneTwister;
  1135. // node_modules/cesium/Source/Core/Math.js
  1136. var CesiumMath = {};
  1137. CesiumMath.EPSILON1 = 0.1;
  1138. CesiumMath.EPSILON2 = 0.01;
  1139. CesiumMath.EPSILON3 = 1e-3;
  1140. CesiumMath.EPSILON4 = 1e-4;
  1141. CesiumMath.EPSILON5 = 1e-5;
  1142. CesiumMath.EPSILON6 = 1e-6;
  1143. CesiumMath.EPSILON7 = 1e-7;
  1144. CesiumMath.EPSILON8 = 1e-8;
  1145. CesiumMath.EPSILON9 = 1e-9;
  1146. CesiumMath.EPSILON10 = 1e-10;
  1147. CesiumMath.EPSILON11 = 1e-11;
  1148. CesiumMath.EPSILON12 = 1e-12;
  1149. CesiumMath.EPSILON13 = 1e-13;
  1150. CesiumMath.EPSILON14 = 1e-14;
  1151. CesiumMath.EPSILON15 = 1e-15;
  1152. CesiumMath.EPSILON16 = 1e-16;
  1153. CesiumMath.EPSILON17 = 1e-17;
  1154. CesiumMath.EPSILON18 = 1e-18;
  1155. CesiumMath.EPSILON19 = 1e-19;
  1156. CesiumMath.EPSILON20 = 1e-20;
  1157. CesiumMath.EPSILON21 = 1e-21;
  1158. CesiumMath.GRAVITATIONALPARAMETER = 3986004418e5;
  1159. CesiumMath.SOLAR_RADIUS = 6955e5;
  1160. CesiumMath.LUNAR_RADIUS = 1737400;
  1161. CesiumMath.SIXTY_FOUR_KILOBYTES = 64 * 1024;
  1162. CesiumMath.FOUR_GIGABYTES = 4 * 1024 * 1024 * 1024;
  1163. CesiumMath.sign = defaultValue_default(Math.sign, function sign(value) {
  1164. value = +value;
  1165. if (value === 0 || value !== value) {
  1166. return value;
  1167. }
  1168. return value > 0 ? 1 : -1;
  1169. });
  1170. CesiumMath.signNotZero = function(value) {
  1171. return value < 0 ? -1 : 1;
  1172. };
  1173. CesiumMath.toSNorm = function(value, rangeMaximum) {
  1174. rangeMaximum = defaultValue_default(rangeMaximum, 255);
  1175. return Math.round(
  1176. (CesiumMath.clamp(value, -1, 1) * 0.5 + 0.5) * rangeMaximum
  1177. );
  1178. };
  1179. CesiumMath.fromSNorm = function(value, rangeMaximum) {
  1180. rangeMaximum = defaultValue_default(rangeMaximum, 255);
  1181. return CesiumMath.clamp(value, 0, rangeMaximum) / rangeMaximum * 2 - 1;
  1182. };
  1183. CesiumMath.normalize = function(value, rangeMinimum, rangeMaximum) {
  1184. rangeMaximum = Math.max(rangeMaximum - rangeMinimum, 0);
  1185. return rangeMaximum === 0 ? 0 : CesiumMath.clamp((value - rangeMinimum) / rangeMaximum, 0, 1);
  1186. };
  1187. CesiumMath.sinh = defaultValue_default(Math.sinh, function sinh(value) {
  1188. return (Math.exp(value) - Math.exp(-value)) / 2;
  1189. });
  1190. CesiumMath.cosh = defaultValue_default(Math.cosh, function cosh(value) {
  1191. return (Math.exp(value) + Math.exp(-value)) / 2;
  1192. });
  1193. CesiumMath.lerp = function(p2, q, time) {
  1194. return (1 - time) * p2 + time * q;
  1195. };
  1196. CesiumMath.PI = Math.PI;
  1197. CesiumMath.ONE_OVER_PI = 1 / Math.PI;
  1198. CesiumMath.PI_OVER_TWO = Math.PI / 2;
  1199. CesiumMath.PI_OVER_THREE = Math.PI / 3;
  1200. CesiumMath.PI_OVER_FOUR = Math.PI / 4;
  1201. CesiumMath.PI_OVER_SIX = Math.PI / 6;
  1202. CesiumMath.THREE_PI_OVER_TWO = 3 * Math.PI / 2;
  1203. CesiumMath.TWO_PI = 2 * Math.PI;
  1204. CesiumMath.ONE_OVER_TWO_PI = 1 / (2 * Math.PI);
  1205. CesiumMath.RADIANS_PER_DEGREE = Math.PI / 180;
  1206. CesiumMath.DEGREES_PER_RADIAN = 180 / Math.PI;
  1207. CesiumMath.RADIANS_PER_ARCSECOND = CesiumMath.RADIANS_PER_DEGREE / 3600;
  1208. CesiumMath.toRadians = function(degrees) {
  1209. if (!defined_default(degrees)) {
  1210. throw new DeveloperError_default("degrees is required.");
  1211. }
  1212. return degrees * CesiumMath.RADIANS_PER_DEGREE;
  1213. };
  1214. CesiumMath.toDegrees = function(radians) {
  1215. if (!defined_default(radians)) {
  1216. throw new DeveloperError_default("radians is required.");
  1217. }
  1218. return radians * CesiumMath.DEGREES_PER_RADIAN;
  1219. };
  1220. CesiumMath.convertLongitudeRange = function(angle) {
  1221. if (!defined_default(angle)) {
  1222. throw new DeveloperError_default("angle is required.");
  1223. }
  1224. const twoPi = CesiumMath.TWO_PI;
  1225. const simplified = angle - Math.floor(angle / twoPi) * twoPi;
  1226. if (simplified < -Math.PI) {
  1227. return simplified + twoPi;
  1228. }
  1229. if (simplified >= Math.PI) {
  1230. return simplified - twoPi;
  1231. }
  1232. return simplified;
  1233. };
  1234. CesiumMath.clampToLatitudeRange = function(angle) {
  1235. if (!defined_default(angle)) {
  1236. throw new DeveloperError_default("angle is required.");
  1237. }
  1238. return CesiumMath.clamp(
  1239. angle,
  1240. -1 * CesiumMath.PI_OVER_TWO,
  1241. CesiumMath.PI_OVER_TWO
  1242. );
  1243. };
  1244. CesiumMath.negativePiToPi = function(angle) {
  1245. if (!defined_default(angle)) {
  1246. throw new DeveloperError_default("angle is required.");
  1247. }
  1248. if (angle >= -CesiumMath.PI && angle <= CesiumMath.PI) {
  1249. return angle;
  1250. }
  1251. return CesiumMath.zeroToTwoPi(angle + CesiumMath.PI) - CesiumMath.PI;
  1252. };
  1253. CesiumMath.zeroToTwoPi = function(angle) {
  1254. if (!defined_default(angle)) {
  1255. throw new DeveloperError_default("angle is required.");
  1256. }
  1257. if (angle >= 0 && angle <= CesiumMath.TWO_PI) {
  1258. return angle;
  1259. }
  1260. const mod2 = CesiumMath.mod(angle, CesiumMath.TWO_PI);
  1261. if (Math.abs(mod2) < CesiumMath.EPSILON14 && Math.abs(angle) > CesiumMath.EPSILON14) {
  1262. return CesiumMath.TWO_PI;
  1263. }
  1264. return mod2;
  1265. };
  1266. CesiumMath.mod = function(m, n2) {
  1267. if (!defined_default(m)) {
  1268. throw new DeveloperError_default("m is required.");
  1269. }
  1270. if (!defined_default(n2)) {
  1271. throw new DeveloperError_default("n is required.");
  1272. }
  1273. if (n2 === 0) {
  1274. throw new DeveloperError_default("divisor cannot be 0.");
  1275. }
  1276. if (CesiumMath.sign(m) === CesiumMath.sign(n2) && Math.abs(m) < Math.abs(n2)) {
  1277. return m;
  1278. }
  1279. return (m % n2 + n2) % n2;
  1280. };
  1281. CesiumMath.equalsEpsilon = function(left, right, relativeEpsilon, absoluteEpsilon) {
  1282. if (!defined_default(left)) {
  1283. throw new DeveloperError_default("left is required.");
  1284. }
  1285. if (!defined_default(right)) {
  1286. throw new DeveloperError_default("right is required.");
  1287. }
  1288. relativeEpsilon = defaultValue_default(relativeEpsilon, 0);
  1289. absoluteEpsilon = defaultValue_default(absoluteEpsilon, relativeEpsilon);
  1290. const absDiff = Math.abs(left - right);
  1291. return absDiff <= absoluteEpsilon || absDiff <= relativeEpsilon * Math.max(Math.abs(left), Math.abs(right));
  1292. };
  1293. CesiumMath.lessThan = function(left, right, absoluteEpsilon) {
  1294. if (!defined_default(left)) {
  1295. throw new DeveloperError_default("first is required.");
  1296. }
  1297. if (!defined_default(right)) {
  1298. throw new DeveloperError_default("second is required.");
  1299. }
  1300. if (!defined_default(absoluteEpsilon)) {
  1301. throw new DeveloperError_default("absoluteEpsilon is required.");
  1302. }
  1303. return left - right < -absoluteEpsilon;
  1304. };
  1305. CesiumMath.lessThanOrEquals = function(left, right, absoluteEpsilon) {
  1306. if (!defined_default(left)) {
  1307. throw new DeveloperError_default("first is required.");
  1308. }
  1309. if (!defined_default(right)) {
  1310. throw new DeveloperError_default("second is required.");
  1311. }
  1312. if (!defined_default(absoluteEpsilon)) {
  1313. throw new DeveloperError_default("absoluteEpsilon is required.");
  1314. }
  1315. return left - right < absoluteEpsilon;
  1316. };
  1317. CesiumMath.greaterThan = function(left, right, absoluteEpsilon) {
  1318. if (!defined_default(left)) {
  1319. throw new DeveloperError_default("first is required.");
  1320. }
  1321. if (!defined_default(right)) {
  1322. throw new DeveloperError_default("second is required.");
  1323. }
  1324. if (!defined_default(absoluteEpsilon)) {
  1325. throw new DeveloperError_default("absoluteEpsilon is required.");
  1326. }
  1327. return left - right > absoluteEpsilon;
  1328. };
  1329. CesiumMath.greaterThanOrEquals = function(left, right, absoluteEpsilon) {
  1330. if (!defined_default(left)) {
  1331. throw new DeveloperError_default("first is required.");
  1332. }
  1333. if (!defined_default(right)) {
  1334. throw new DeveloperError_default("second is required.");
  1335. }
  1336. if (!defined_default(absoluteEpsilon)) {
  1337. throw new DeveloperError_default("absoluteEpsilon is required.");
  1338. }
  1339. return left - right > -absoluteEpsilon;
  1340. };
  1341. var factorials = [1];
  1342. CesiumMath.factorial = function(n2) {
  1343. if (typeof n2 !== "number" || n2 < 0) {
  1344. throw new DeveloperError_default(
  1345. "A number greater than or equal to 0 is required."
  1346. );
  1347. }
  1348. const length3 = factorials.length;
  1349. if (n2 >= length3) {
  1350. let sum = factorials[length3 - 1];
  1351. for (let i2 = length3; i2 <= n2; i2++) {
  1352. const next = sum * i2;
  1353. factorials.push(next);
  1354. sum = next;
  1355. }
  1356. }
  1357. return factorials[n2];
  1358. };
  1359. CesiumMath.incrementWrap = function(n2, maximumValue, minimumValue) {
  1360. minimumValue = defaultValue_default(minimumValue, 0);
  1361. if (!defined_default(n2)) {
  1362. throw new DeveloperError_default("n is required.");
  1363. }
  1364. if (maximumValue <= minimumValue) {
  1365. throw new DeveloperError_default("maximumValue must be greater than minimumValue.");
  1366. }
  1367. ++n2;
  1368. if (n2 > maximumValue) {
  1369. n2 = minimumValue;
  1370. }
  1371. return n2;
  1372. };
  1373. CesiumMath.isPowerOfTwo = function(n2) {
  1374. if (typeof n2 !== "number" || n2 < 0 || n2 > 4294967295) {
  1375. throw new DeveloperError_default("A number between 0 and (2^32)-1 is required.");
  1376. }
  1377. return n2 !== 0 && (n2 & n2 - 1) === 0;
  1378. };
  1379. CesiumMath.nextPowerOfTwo = function(n2) {
  1380. if (typeof n2 !== "number" || n2 < 0 || n2 > 2147483648) {
  1381. throw new DeveloperError_default("A number between 0 and 2^31 is required.");
  1382. }
  1383. --n2;
  1384. n2 |= n2 >> 1;
  1385. n2 |= n2 >> 2;
  1386. n2 |= n2 >> 4;
  1387. n2 |= n2 >> 8;
  1388. n2 |= n2 >> 16;
  1389. ++n2;
  1390. return n2;
  1391. };
  1392. CesiumMath.previousPowerOfTwo = function(n2) {
  1393. if (typeof n2 !== "number" || n2 < 0 || n2 > 4294967295) {
  1394. throw new DeveloperError_default("A number between 0 and (2^32)-1 is required.");
  1395. }
  1396. n2 |= n2 >> 1;
  1397. n2 |= n2 >> 2;
  1398. n2 |= n2 >> 4;
  1399. n2 |= n2 >> 8;
  1400. n2 |= n2 >> 16;
  1401. n2 |= n2 >> 32;
  1402. n2 = (n2 >>> 0) - (n2 >>> 1);
  1403. return n2;
  1404. };
  1405. CesiumMath.clamp = function(value, min3, max3) {
  1406. Check_default.typeOf.number("value", value);
  1407. Check_default.typeOf.number("min", min3);
  1408. Check_default.typeOf.number("max", max3);
  1409. return value < min3 ? min3 : value > max3 ? max3 : value;
  1410. };
  1411. var randomNumberGenerator = new mersenneTwister();
  1412. CesiumMath.setRandomNumberSeed = function(seed) {
  1413. if (!defined_default(seed)) {
  1414. throw new DeveloperError_default("seed is required.");
  1415. }
  1416. randomNumberGenerator = new mersenneTwister(seed);
  1417. };
  1418. CesiumMath.nextRandomNumber = function() {
  1419. return randomNumberGenerator.random();
  1420. };
  1421. CesiumMath.randomBetween = function(min3, max3) {
  1422. return CesiumMath.nextRandomNumber() * (max3 - min3) + min3;
  1423. };
  1424. CesiumMath.acosClamped = function(value) {
  1425. if (!defined_default(value)) {
  1426. throw new DeveloperError_default("value is required.");
  1427. }
  1428. return Math.acos(CesiumMath.clamp(value, -1, 1));
  1429. };
  1430. CesiumMath.asinClamped = function(value) {
  1431. if (!defined_default(value)) {
  1432. throw new DeveloperError_default("value is required.");
  1433. }
  1434. return Math.asin(CesiumMath.clamp(value, -1, 1));
  1435. };
  1436. CesiumMath.chordLength = function(angle, radius) {
  1437. if (!defined_default(angle)) {
  1438. throw new DeveloperError_default("angle is required.");
  1439. }
  1440. if (!defined_default(radius)) {
  1441. throw new DeveloperError_default("radius is required.");
  1442. }
  1443. return 2 * radius * Math.sin(angle * 0.5);
  1444. };
  1445. CesiumMath.logBase = function(number, base) {
  1446. if (!defined_default(number)) {
  1447. throw new DeveloperError_default("number is required.");
  1448. }
  1449. if (!defined_default(base)) {
  1450. throw new DeveloperError_default("base is required.");
  1451. }
  1452. return Math.log(number) / Math.log(base);
  1453. };
  1454. CesiumMath.cbrt = defaultValue_default(Math.cbrt, function cbrt(number) {
  1455. const result = Math.pow(Math.abs(number), 1 / 3);
  1456. return number < 0 ? -result : result;
  1457. });
  1458. CesiumMath.log2 = defaultValue_default(Math.log2, function log2(number) {
  1459. return Math.log(number) * Math.LOG2E;
  1460. });
  1461. CesiumMath.fog = function(distanceToCamera, density) {
  1462. const scalar = distanceToCamera * density;
  1463. return 1 - Math.exp(-(scalar * scalar));
  1464. };
  1465. CesiumMath.fastApproximateAtan = function(x) {
  1466. Check_default.typeOf.number("x", x);
  1467. return x * (-0.1784 * Math.abs(x) - 0.0663 * x * x + 1.0301);
  1468. };
  1469. CesiumMath.fastApproximateAtan2 = function(x, y) {
  1470. Check_default.typeOf.number("x", x);
  1471. Check_default.typeOf.number("y", y);
  1472. let opposite;
  1473. let t = Math.abs(x);
  1474. opposite = Math.abs(y);
  1475. const adjacent = Math.max(t, opposite);
  1476. opposite = Math.min(t, opposite);
  1477. const oppositeOverAdjacent = opposite / adjacent;
  1478. if (isNaN(oppositeOverAdjacent)) {
  1479. throw new DeveloperError_default("either x or y must be nonzero");
  1480. }
  1481. t = CesiumMath.fastApproximateAtan(oppositeOverAdjacent);
  1482. t = Math.abs(y) > Math.abs(x) ? CesiumMath.PI_OVER_TWO - t : t;
  1483. t = x < 0 ? CesiumMath.PI - t : t;
  1484. t = y < 0 ? -t : t;
  1485. return t;
  1486. };
  1487. var Math_default = CesiumMath;
  1488. // node_modules/cesium/Source/Core/Cartesian3.js
  1489. function Cartesian3(x, y, z) {
  1490. this.x = defaultValue_default(x, 0);
  1491. this.y = defaultValue_default(y, 0);
  1492. this.z = defaultValue_default(z, 0);
  1493. }
  1494. Cartesian3.fromSpherical = function(spherical, result) {
  1495. Check_default.typeOf.object("spherical", spherical);
  1496. if (!defined_default(result)) {
  1497. result = new Cartesian3();
  1498. }
  1499. const clock = spherical.clock;
  1500. const cone = spherical.cone;
  1501. const magnitude = defaultValue_default(spherical.magnitude, 1);
  1502. const radial = magnitude * Math.sin(cone);
  1503. result.x = radial * Math.cos(clock);
  1504. result.y = radial * Math.sin(clock);
  1505. result.z = magnitude * Math.cos(cone);
  1506. return result;
  1507. };
  1508. Cartesian3.fromElements = function(x, y, z, result) {
  1509. if (!defined_default(result)) {
  1510. return new Cartesian3(x, y, z);
  1511. }
  1512. result.x = x;
  1513. result.y = y;
  1514. result.z = z;
  1515. return result;
  1516. };
  1517. Cartesian3.clone = function(cartesian11, result) {
  1518. if (!defined_default(cartesian11)) {
  1519. return void 0;
  1520. }
  1521. if (!defined_default(result)) {
  1522. return new Cartesian3(cartesian11.x, cartesian11.y, cartesian11.z);
  1523. }
  1524. result.x = cartesian11.x;
  1525. result.y = cartesian11.y;
  1526. result.z = cartesian11.z;
  1527. return result;
  1528. };
  1529. Cartesian3.fromCartesian4 = Cartesian3.clone;
  1530. Cartesian3.packedLength = 3;
  1531. Cartesian3.pack = function(value, array, startingIndex) {
  1532. Check_default.typeOf.object("value", value);
  1533. Check_default.defined("array", array);
  1534. startingIndex = defaultValue_default(startingIndex, 0);
  1535. array[startingIndex++] = value.x;
  1536. array[startingIndex++] = value.y;
  1537. array[startingIndex] = value.z;
  1538. return array;
  1539. };
  1540. Cartesian3.unpack = function(array, startingIndex, result) {
  1541. Check_default.defined("array", array);
  1542. startingIndex = defaultValue_default(startingIndex, 0);
  1543. if (!defined_default(result)) {
  1544. result = new Cartesian3();
  1545. }
  1546. result.x = array[startingIndex++];
  1547. result.y = array[startingIndex++];
  1548. result.z = array[startingIndex];
  1549. return result;
  1550. };
  1551. Cartesian3.packArray = function(array, result) {
  1552. Check_default.defined("array", array);
  1553. const length3 = array.length;
  1554. const resultLength = length3 * 3;
  1555. if (!defined_default(result)) {
  1556. result = new Array(resultLength);
  1557. } else if (!Array.isArray(result) && result.length !== resultLength) {
  1558. throw new DeveloperError_default(
  1559. "If result is a typed array, it must have exactly array.length * 3 elements"
  1560. );
  1561. } else if (result.length !== resultLength) {
  1562. result.length = resultLength;
  1563. }
  1564. for (let i2 = 0; i2 < length3; ++i2) {
  1565. Cartesian3.pack(array[i2], result, i2 * 3);
  1566. }
  1567. return result;
  1568. };
  1569. Cartesian3.unpackArray = function(array, result) {
  1570. Check_default.defined("array", array);
  1571. Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 3);
  1572. if (array.length % 3 !== 0) {
  1573. throw new DeveloperError_default("array length must be a multiple of 3.");
  1574. }
  1575. const length3 = array.length;
  1576. if (!defined_default(result)) {
  1577. result = new Array(length3 / 3);
  1578. } else {
  1579. result.length = length3 / 3;
  1580. }
  1581. for (let i2 = 0; i2 < length3; i2 += 3) {
  1582. const index2 = i2 / 3;
  1583. result[index2] = Cartesian3.unpack(array, i2, result[index2]);
  1584. }
  1585. return result;
  1586. };
  1587. Cartesian3.fromArray = Cartesian3.unpack;
  1588. Cartesian3.maximumComponent = function(cartesian11) {
  1589. Check_default.typeOf.object("cartesian", cartesian11);
  1590. return Math.max(cartesian11.x, cartesian11.y, cartesian11.z);
  1591. };
  1592. Cartesian3.minimumComponent = function(cartesian11) {
  1593. Check_default.typeOf.object("cartesian", cartesian11);
  1594. return Math.min(cartesian11.x, cartesian11.y, cartesian11.z);
  1595. };
  1596. Cartesian3.minimumByComponent = function(first, second, result) {
  1597. Check_default.typeOf.object("first", first);
  1598. Check_default.typeOf.object("second", second);
  1599. Check_default.typeOf.object("result", result);
  1600. result.x = Math.min(first.x, second.x);
  1601. result.y = Math.min(first.y, second.y);
  1602. result.z = Math.min(first.z, second.z);
  1603. return result;
  1604. };
  1605. Cartesian3.maximumByComponent = function(first, second, result) {
  1606. Check_default.typeOf.object("first", first);
  1607. Check_default.typeOf.object("second", second);
  1608. Check_default.typeOf.object("result", result);
  1609. result.x = Math.max(first.x, second.x);
  1610. result.y = Math.max(first.y, second.y);
  1611. result.z = Math.max(first.z, second.z);
  1612. return result;
  1613. };
  1614. Cartesian3.clamp = function(value, min3, max3, result) {
  1615. Check_default.typeOf.object("value", value);
  1616. Check_default.typeOf.object("min", min3);
  1617. Check_default.typeOf.object("max", max3);
  1618. Check_default.typeOf.object("result", result);
  1619. const x = Math_default.clamp(value.x, min3.x, max3.x);
  1620. const y = Math_default.clamp(value.y, min3.y, max3.y);
  1621. const z = Math_default.clamp(value.z, min3.z, max3.z);
  1622. result.x = x;
  1623. result.y = y;
  1624. result.z = z;
  1625. return result;
  1626. };
  1627. Cartesian3.magnitudeSquared = function(cartesian11) {
  1628. Check_default.typeOf.object("cartesian", cartesian11);
  1629. return cartesian11.x * cartesian11.x + cartesian11.y * cartesian11.y + cartesian11.z * cartesian11.z;
  1630. };
  1631. Cartesian3.magnitude = function(cartesian11) {
  1632. return Math.sqrt(Cartesian3.magnitudeSquared(cartesian11));
  1633. };
  1634. var distanceScratch = new Cartesian3();
  1635. Cartesian3.distance = function(left, right) {
  1636. Check_default.typeOf.object("left", left);
  1637. Check_default.typeOf.object("right", right);
  1638. Cartesian3.subtract(left, right, distanceScratch);
  1639. return Cartesian3.magnitude(distanceScratch);
  1640. };
  1641. Cartesian3.distanceSquared = function(left, right) {
  1642. Check_default.typeOf.object("left", left);
  1643. Check_default.typeOf.object("right", right);
  1644. Cartesian3.subtract(left, right, distanceScratch);
  1645. return Cartesian3.magnitudeSquared(distanceScratch);
  1646. };
  1647. Cartesian3.normalize = function(cartesian11, result) {
  1648. Check_default.typeOf.object("cartesian", cartesian11);
  1649. Check_default.typeOf.object("result", result);
  1650. const magnitude = Cartesian3.magnitude(cartesian11);
  1651. result.x = cartesian11.x / magnitude;
  1652. result.y = cartesian11.y / magnitude;
  1653. result.z = cartesian11.z / magnitude;
  1654. if (isNaN(result.x) || isNaN(result.y) || isNaN(result.z)) {
  1655. throw new DeveloperError_default("normalized result is not a number");
  1656. }
  1657. return result;
  1658. };
  1659. Cartesian3.dot = function(left, right) {
  1660. Check_default.typeOf.object("left", left);
  1661. Check_default.typeOf.object("right", right);
  1662. return left.x * right.x + left.y * right.y + left.z * right.z;
  1663. };
  1664. Cartesian3.multiplyComponents = function(left, right, result) {
  1665. Check_default.typeOf.object("left", left);
  1666. Check_default.typeOf.object("right", right);
  1667. Check_default.typeOf.object("result", result);
  1668. result.x = left.x * right.x;
  1669. result.y = left.y * right.y;
  1670. result.z = left.z * right.z;
  1671. return result;
  1672. };
  1673. Cartesian3.divideComponents = function(left, right, result) {
  1674. Check_default.typeOf.object("left", left);
  1675. Check_default.typeOf.object("right", right);
  1676. Check_default.typeOf.object("result", result);
  1677. result.x = left.x / right.x;
  1678. result.y = left.y / right.y;
  1679. result.z = left.z / right.z;
  1680. return result;
  1681. };
  1682. Cartesian3.add = function(left, right, result) {
  1683. Check_default.typeOf.object("left", left);
  1684. Check_default.typeOf.object("right", right);
  1685. Check_default.typeOf.object("result", result);
  1686. result.x = left.x + right.x;
  1687. result.y = left.y + right.y;
  1688. result.z = left.z + right.z;
  1689. return result;
  1690. };
  1691. Cartesian3.subtract = function(left, right, result) {
  1692. Check_default.typeOf.object("left", left);
  1693. Check_default.typeOf.object("right", right);
  1694. Check_default.typeOf.object("result", result);
  1695. result.x = left.x - right.x;
  1696. result.y = left.y - right.y;
  1697. result.z = left.z - right.z;
  1698. return result;
  1699. };
  1700. Cartesian3.multiplyByScalar = function(cartesian11, scalar, result) {
  1701. Check_default.typeOf.object("cartesian", cartesian11);
  1702. Check_default.typeOf.number("scalar", scalar);
  1703. Check_default.typeOf.object("result", result);
  1704. result.x = cartesian11.x * scalar;
  1705. result.y = cartesian11.y * scalar;
  1706. result.z = cartesian11.z * scalar;
  1707. return result;
  1708. };
  1709. Cartesian3.divideByScalar = function(cartesian11, scalar, result) {
  1710. Check_default.typeOf.object("cartesian", cartesian11);
  1711. Check_default.typeOf.number("scalar", scalar);
  1712. Check_default.typeOf.object("result", result);
  1713. result.x = cartesian11.x / scalar;
  1714. result.y = cartesian11.y / scalar;
  1715. result.z = cartesian11.z / scalar;
  1716. return result;
  1717. };
  1718. Cartesian3.negate = function(cartesian11, result) {
  1719. Check_default.typeOf.object("cartesian", cartesian11);
  1720. Check_default.typeOf.object("result", result);
  1721. result.x = -cartesian11.x;
  1722. result.y = -cartesian11.y;
  1723. result.z = -cartesian11.z;
  1724. return result;
  1725. };
  1726. Cartesian3.abs = function(cartesian11, result) {
  1727. Check_default.typeOf.object("cartesian", cartesian11);
  1728. Check_default.typeOf.object("result", result);
  1729. result.x = Math.abs(cartesian11.x);
  1730. result.y = Math.abs(cartesian11.y);
  1731. result.z = Math.abs(cartesian11.z);
  1732. return result;
  1733. };
  1734. var lerpScratch = new Cartesian3();
  1735. Cartesian3.lerp = function(start, end, t, result) {
  1736. Check_default.typeOf.object("start", start);
  1737. Check_default.typeOf.object("end", end);
  1738. Check_default.typeOf.number("t", t);
  1739. Check_default.typeOf.object("result", result);
  1740. Cartesian3.multiplyByScalar(end, t, lerpScratch);
  1741. result = Cartesian3.multiplyByScalar(start, 1 - t, result);
  1742. return Cartesian3.add(lerpScratch, result, result);
  1743. };
  1744. var angleBetweenScratch = new Cartesian3();
  1745. var angleBetweenScratch2 = new Cartesian3();
  1746. Cartesian3.angleBetween = function(left, right) {
  1747. Check_default.typeOf.object("left", left);
  1748. Check_default.typeOf.object("right", right);
  1749. Cartesian3.normalize(left, angleBetweenScratch);
  1750. Cartesian3.normalize(right, angleBetweenScratch2);
  1751. const cosine = Cartesian3.dot(angleBetweenScratch, angleBetweenScratch2);
  1752. const sine = Cartesian3.magnitude(
  1753. Cartesian3.cross(
  1754. angleBetweenScratch,
  1755. angleBetweenScratch2,
  1756. angleBetweenScratch
  1757. )
  1758. );
  1759. return Math.atan2(sine, cosine);
  1760. };
  1761. var mostOrthogonalAxisScratch = new Cartesian3();
  1762. Cartesian3.mostOrthogonalAxis = function(cartesian11, result) {
  1763. Check_default.typeOf.object("cartesian", cartesian11);
  1764. Check_default.typeOf.object("result", result);
  1765. const f2 = Cartesian3.normalize(cartesian11, mostOrthogonalAxisScratch);
  1766. Cartesian3.abs(f2, f2);
  1767. if (f2.x <= f2.y) {
  1768. if (f2.x <= f2.z) {
  1769. result = Cartesian3.clone(Cartesian3.UNIT_X, result);
  1770. } else {
  1771. result = Cartesian3.clone(Cartesian3.UNIT_Z, result);
  1772. }
  1773. } else if (f2.y <= f2.z) {
  1774. result = Cartesian3.clone(Cartesian3.UNIT_Y, result);
  1775. } else {
  1776. result = Cartesian3.clone(Cartesian3.UNIT_Z, result);
  1777. }
  1778. return result;
  1779. };
  1780. Cartesian3.projectVector = function(a4, b, result) {
  1781. Check_default.defined("a", a4);
  1782. Check_default.defined("b", b);
  1783. Check_default.defined("result", result);
  1784. const scalar = Cartesian3.dot(a4, b) / Cartesian3.dot(b, b);
  1785. return Cartesian3.multiplyByScalar(b, scalar, result);
  1786. };
  1787. Cartesian3.equals = function(left, right) {
  1788. return left === right || defined_default(left) && defined_default(right) && left.x === right.x && left.y === right.y && left.z === right.z;
  1789. };
  1790. Cartesian3.equalsArray = function(cartesian11, array, offset2) {
  1791. return cartesian11.x === array[offset2] && cartesian11.y === array[offset2 + 1] && cartesian11.z === array[offset2 + 2];
  1792. };
  1793. Cartesian3.equalsEpsilon = function(left, right, relativeEpsilon, absoluteEpsilon) {
  1794. return left === right || defined_default(left) && defined_default(right) && Math_default.equalsEpsilon(
  1795. left.x,
  1796. right.x,
  1797. relativeEpsilon,
  1798. absoluteEpsilon
  1799. ) && Math_default.equalsEpsilon(
  1800. left.y,
  1801. right.y,
  1802. relativeEpsilon,
  1803. absoluteEpsilon
  1804. ) && Math_default.equalsEpsilon(
  1805. left.z,
  1806. right.z,
  1807. relativeEpsilon,
  1808. absoluteEpsilon
  1809. );
  1810. };
  1811. Cartesian3.cross = function(left, right, result) {
  1812. Check_default.typeOf.object("left", left);
  1813. Check_default.typeOf.object("right", right);
  1814. Check_default.typeOf.object("result", result);
  1815. const leftX = left.x;
  1816. const leftY = left.y;
  1817. const leftZ = left.z;
  1818. const rightX = right.x;
  1819. const rightY = right.y;
  1820. const rightZ = right.z;
  1821. const x = leftY * rightZ - leftZ * rightY;
  1822. const y = leftZ * rightX - leftX * rightZ;
  1823. const z = leftX * rightY - leftY * rightX;
  1824. result.x = x;
  1825. result.y = y;
  1826. result.z = z;
  1827. return result;
  1828. };
  1829. Cartesian3.midpoint = function(left, right, result) {
  1830. Check_default.typeOf.object("left", left);
  1831. Check_default.typeOf.object("right", right);
  1832. Check_default.typeOf.object("result", result);
  1833. result.x = (left.x + right.x) * 0.5;
  1834. result.y = (left.y + right.y) * 0.5;
  1835. result.z = (left.z + right.z) * 0.5;
  1836. return result;
  1837. };
  1838. Cartesian3.fromDegrees = function(longitude, latitude, height, ellipsoid, result) {
  1839. Check_default.typeOf.number("longitude", longitude);
  1840. Check_default.typeOf.number("latitude", latitude);
  1841. longitude = Math_default.toRadians(longitude);
  1842. latitude = Math_default.toRadians(latitude);
  1843. return Cartesian3.fromRadians(longitude, latitude, height, ellipsoid, result);
  1844. };
  1845. var scratchN = new Cartesian3();
  1846. var scratchK = new Cartesian3();
  1847. var wgs84RadiiSquared = new Cartesian3(
  1848. 6378137 * 6378137,
  1849. 6378137 * 6378137,
  1850. 6356752314245179e-9 * 6356752314245179e-9
  1851. );
  1852. Cartesian3.fromRadians = function(longitude, latitude, height, ellipsoid, result) {
  1853. Check_default.typeOf.number("longitude", longitude);
  1854. Check_default.typeOf.number("latitude", latitude);
  1855. height = defaultValue_default(height, 0);
  1856. const radiiSquared = defined_default(ellipsoid) ? ellipsoid.radiiSquared : wgs84RadiiSquared;
  1857. const cosLatitude = Math.cos(latitude);
  1858. scratchN.x = cosLatitude * Math.cos(longitude);
  1859. scratchN.y = cosLatitude * Math.sin(longitude);
  1860. scratchN.z = Math.sin(latitude);
  1861. scratchN = Cartesian3.normalize(scratchN, scratchN);
  1862. Cartesian3.multiplyComponents(radiiSquared, scratchN, scratchK);
  1863. const gamma = Math.sqrt(Cartesian3.dot(scratchN, scratchK));
  1864. scratchK = Cartesian3.divideByScalar(scratchK, gamma, scratchK);
  1865. scratchN = Cartesian3.multiplyByScalar(scratchN, height, scratchN);
  1866. if (!defined_default(result)) {
  1867. result = new Cartesian3();
  1868. }
  1869. return Cartesian3.add(scratchK, scratchN, result);
  1870. };
  1871. Cartesian3.fromDegreesArray = function(coordinates, ellipsoid, result) {
  1872. Check_default.defined("coordinates", coordinates);
  1873. if (coordinates.length < 2 || coordinates.length % 2 !== 0) {
  1874. throw new DeveloperError_default(
  1875. "the number of coordinates must be a multiple of 2 and at least 2"
  1876. );
  1877. }
  1878. const length3 = coordinates.length;
  1879. if (!defined_default(result)) {
  1880. result = new Array(length3 / 2);
  1881. } else {
  1882. result.length = length3 / 2;
  1883. }
  1884. for (let i2 = 0; i2 < length3; i2 += 2) {
  1885. const longitude = coordinates[i2];
  1886. const latitude = coordinates[i2 + 1];
  1887. const index2 = i2 / 2;
  1888. result[index2] = Cartesian3.fromDegrees(
  1889. longitude,
  1890. latitude,
  1891. 0,
  1892. ellipsoid,
  1893. result[index2]
  1894. );
  1895. }
  1896. return result;
  1897. };
  1898. Cartesian3.fromRadiansArray = function(coordinates, ellipsoid, result) {
  1899. Check_default.defined("coordinates", coordinates);
  1900. if (coordinates.length < 2 || coordinates.length % 2 !== 0) {
  1901. throw new DeveloperError_default(
  1902. "the number of coordinates must be a multiple of 2 and at least 2"
  1903. );
  1904. }
  1905. const length3 = coordinates.length;
  1906. if (!defined_default(result)) {
  1907. result = new Array(length3 / 2);
  1908. } else {
  1909. result.length = length3 / 2;
  1910. }
  1911. for (let i2 = 0; i2 < length3; i2 += 2) {
  1912. const longitude = coordinates[i2];
  1913. const latitude = coordinates[i2 + 1];
  1914. const index2 = i2 / 2;
  1915. result[index2] = Cartesian3.fromRadians(
  1916. longitude,
  1917. latitude,
  1918. 0,
  1919. ellipsoid,
  1920. result[index2]
  1921. );
  1922. }
  1923. return result;
  1924. };
  1925. Cartesian3.fromDegreesArrayHeights = function(coordinates, ellipsoid, result) {
  1926. Check_default.defined("coordinates", coordinates);
  1927. if (coordinates.length < 3 || coordinates.length % 3 !== 0) {
  1928. throw new DeveloperError_default(
  1929. "the number of coordinates must be a multiple of 3 and at least 3"
  1930. );
  1931. }
  1932. const length3 = coordinates.length;
  1933. if (!defined_default(result)) {
  1934. result = new Array(length3 / 3);
  1935. } else {
  1936. result.length = length3 / 3;
  1937. }
  1938. for (let i2 = 0; i2 < length3; i2 += 3) {
  1939. const longitude = coordinates[i2];
  1940. const latitude = coordinates[i2 + 1];
  1941. const height = coordinates[i2 + 2];
  1942. const index2 = i2 / 3;
  1943. result[index2] = Cartesian3.fromDegrees(
  1944. longitude,
  1945. latitude,
  1946. height,
  1947. ellipsoid,
  1948. result[index2]
  1949. );
  1950. }
  1951. return result;
  1952. };
  1953. Cartesian3.fromRadiansArrayHeights = function(coordinates, ellipsoid, result) {
  1954. Check_default.defined("coordinates", coordinates);
  1955. if (coordinates.length < 3 || coordinates.length % 3 !== 0) {
  1956. throw new DeveloperError_default(
  1957. "the number of coordinates must be a multiple of 3 and at least 3"
  1958. );
  1959. }
  1960. const length3 = coordinates.length;
  1961. if (!defined_default(result)) {
  1962. result = new Array(length3 / 3);
  1963. } else {
  1964. result.length = length3 / 3;
  1965. }
  1966. for (let i2 = 0; i2 < length3; i2 += 3) {
  1967. const longitude = coordinates[i2];
  1968. const latitude = coordinates[i2 + 1];
  1969. const height = coordinates[i2 + 2];
  1970. const index2 = i2 / 3;
  1971. result[index2] = Cartesian3.fromRadians(
  1972. longitude,
  1973. latitude,
  1974. height,
  1975. ellipsoid,
  1976. result[index2]
  1977. );
  1978. }
  1979. return result;
  1980. };
  1981. Cartesian3.ZERO = Object.freeze(new Cartesian3(0, 0, 0));
  1982. Cartesian3.ONE = Object.freeze(new Cartesian3(1, 1, 1));
  1983. Cartesian3.UNIT_X = Object.freeze(new Cartesian3(1, 0, 0));
  1984. Cartesian3.UNIT_Y = Object.freeze(new Cartesian3(0, 1, 0));
  1985. Cartesian3.UNIT_Z = Object.freeze(new Cartesian3(0, 0, 1));
  1986. Cartesian3.prototype.clone = function(result) {
  1987. return Cartesian3.clone(this, result);
  1988. };
  1989. Cartesian3.prototype.equals = function(right) {
  1990. return Cartesian3.equals(this, right);
  1991. };
  1992. Cartesian3.prototype.equalsEpsilon = function(right, relativeEpsilon, absoluteEpsilon) {
  1993. return Cartesian3.equalsEpsilon(
  1994. this,
  1995. right,
  1996. relativeEpsilon,
  1997. absoluteEpsilon
  1998. );
  1999. };
  2000. Cartesian3.prototype.toString = function() {
  2001. return `(${this.x}, ${this.y}, ${this.z})`;
  2002. };
  2003. var Cartesian3_default = Cartesian3;
  2004. // node_modules/cesium/Source/Core/scaleToGeodeticSurface.js
  2005. var scaleToGeodeticSurfaceIntersection = new Cartesian3_default();
  2006. var scaleToGeodeticSurfaceGradient = new Cartesian3_default();
  2007. function scaleToGeodeticSurface(cartesian11, oneOverRadii, oneOverRadiiSquared, centerToleranceSquared, result) {
  2008. if (!defined_default(cartesian11)) {
  2009. throw new DeveloperError_default("cartesian is required.");
  2010. }
  2011. if (!defined_default(oneOverRadii)) {
  2012. throw new DeveloperError_default("oneOverRadii is required.");
  2013. }
  2014. if (!defined_default(oneOverRadiiSquared)) {
  2015. throw new DeveloperError_default("oneOverRadiiSquared is required.");
  2016. }
  2017. if (!defined_default(centerToleranceSquared)) {
  2018. throw new DeveloperError_default("centerToleranceSquared is required.");
  2019. }
  2020. const positionX = cartesian11.x;
  2021. const positionY = cartesian11.y;
  2022. const positionZ = cartesian11.z;
  2023. const oneOverRadiiX = oneOverRadii.x;
  2024. const oneOverRadiiY = oneOverRadii.y;
  2025. const oneOverRadiiZ = oneOverRadii.z;
  2026. const x2 = positionX * positionX * oneOverRadiiX * oneOverRadiiX;
  2027. const y2 = positionY * positionY * oneOverRadiiY * oneOverRadiiY;
  2028. const z2 = positionZ * positionZ * oneOverRadiiZ * oneOverRadiiZ;
  2029. const squaredNorm = x2 + y2 + z2;
  2030. const ratio = Math.sqrt(1 / squaredNorm);
  2031. const intersection = Cartesian3_default.multiplyByScalar(
  2032. cartesian11,
  2033. ratio,
  2034. scaleToGeodeticSurfaceIntersection
  2035. );
  2036. if (squaredNorm < centerToleranceSquared) {
  2037. return !isFinite(ratio) ? void 0 : Cartesian3_default.clone(intersection, result);
  2038. }
  2039. const oneOverRadiiSquaredX = oneOverRadiiSquared.x;
  2040. const oneOverRadiiSquaredY = oneOverRadiiSquared.y;
  2041. const oneOverRadiiSquaredZ = oneOverRadiiSquared.z;
  2042. const gradient = scaleToGeodeticSurfaceGradient;
  2043. gradient.x = intersection.x * oneOverRadiiSquaredX * 2;
  2044. gradient.y = intersection.y * oneOverRadiiSquaredY * 2;
  2045. gradient.z = intersection.z * oneOverRadiiSquaredZ * 2;
  2046. let lambda = (1 - ratio) * Cartesian3_default.magnitude(cartesian11) / (0.5 * Cartesian3_default.magnitude(gradient));
  2047. let correction = 0;
  2048. let func;
  2049. let denominator;
  2050. let xMultiplier;
  2051. let yMultiplier;
  2052. let zMultiplier;
  2053. let xMultiplier2;
  2054. let yMultiplier2;
  2055. let zMultiplier2;
  2056. let xMultiplier3;
  2057. let yMultiplier3;
  2058. let zMultiplier3;
  2059. do {
  2060. lambda -= correction;
  2061. xMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredX);
  2062. yMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredY);
  2063. zMultiplier = 1 / (1 + lambda * oneOverRadiiSquaredZ);
  2064. xMultiplier2 = xMultiplier * xMultiplier;
  2065. yMultiplier2 = yMultiplier * yMultiplier;
  2066. zMultiplier2 = zMultiplier * zMultiplier;
  2067. xMultiplier3 = xMultiplier2 * xMultiplier;
  2068. yMultiplier3 = yMultiplier2 * yMultiplier;
  2069. zMultiplier3 = zMultiplier2 * zMultiplier;
  2070. func = x2 * xMultiplier2 + y2 * yMultiplier2 + z2 * zMultiplier2 - 1;
  2071. denominator = x2 * xMultiplier3 * oneOverRadiiSquaredX + y2 * yMultiplier3 * oneOverRadiiSquaredY + z2 * zMultiplier3 * oneOverRadiiSquaredZ;
  2072. const derivative = -2 * denominator;
  2073. correction = func / derivative;
  2074. } while (Math.abs(func) > Math_default.EPSILON12);
  2075. if (!defined_default(result)) {
  2076. return new Cartesian3_default(
  2077. positionX * xMultiplier,
  2078. positionY * yMultiplier,
  2079. positionZ * zMultiplier
  2080. );
  2081. }
  2082. result.x = positionX * xMultiplier;
  2083. result.y = positionY * yMultiplier;
  2084. result.z = positionZ * zMultiplier;
  2085. return result;
  2086. }
  2087. var scaleToGeodeticSurface_default = scaleToGeodeticSurface;
  2088. // node_modules/cesium/Source/Core/Cartographic.js
  2089. function Cartographic(longitude, latitude, height) {
  2090. this.longitude = defaultValue_default(longitude, 0);
  2091. this.latitude = defaultValue_default(latitude, 0);
  2092. this.height = defaultValue_default(height, 0);
  2093. }
  2094. Cartographic.fromRadians = function(longitude, latitude, height, result) {
  2095. Check_default.typeOf.number("longitude", longitude);
  2096. Check_default.typeOf.number("latitude", latitude);
  2097. height = defaultValue_default(height, 0);
  2098. if (!defined_default(result)) {
  2099. return new Cartographic(longitude, latitude, height);
  2100. }
  2101. result.longitude = longitude;
  2102. result.latitude = latitude;
  2103. result.height = height;
  2104. return result;
  2105. };
  2106. Cartographic.fromDegrees = function(longitude, latitude, height, result) {
  2107. Check_default.typeOf.number("longitude", longitude);
  2108. Check_default.typeOf.number("latitude", latitude);
  2109. longitude = Math_default.toRadians(longitude);
  2110. latitude = Math_default.toRadians(latitude);
  2111. return Cartographic.fromRadians(longitude, latitude, height, result);
  2112. };
  2113. var cartesianToCartographicN = new Cartesian3_default();
  2114. var cartesianToCartographicP = new Cartesian3_default();
  2115. var cartesianToCartographicH = new Cartesian3_default();
  2116. var wgs84OneOverRadii = new Cartesian3_default(
  2117. 1 / 6378137,
  2118. 1 / 6378137,
  2119. 1 / 6356752314245179e-9
  2120. );
  2121. var wgs84OneOverRadiiSquared = new Cartesian3_default(
  2122. 1 / (6378137 * 6378137),
  2123. 1 / (6378137 * 6378137),
  2124. 1 / (6356752314245179e-9 * 6356752314245179e-9)
  2125. );
  2126. var wgs84CenterToleranceSquared = Math_default.EPSILON1;
  2127. Cartographic.fromCartesian = function(cartesian11, ellipsoid, result) {
  2128. const oneOverRadii = defined_default(ellipsoid) ? ellipsoid.oneOverRadii : wgs84OneOverRadii;
  2129. const oneOverRadiiSquared = defined_default(ellipsoid) ? ellipsoid.oneOverRadiiSquared : wgs84OneOverRadiiSquared;
  2130. const centerToleranceSquared = defined_default(ellipsoid) ? ellipsoid._centerToleranceSquared : wgs84CenterToleranceSquared;
  2131. const p2 = scaleToGeodeticSurface_default(
  2132. cartesian11,
  2133. oneOverRadii,
  2134. oneOverRadiiSquared,
  2135. centerToleranceSquared,
  2136. cartesianToCartographicP
  2137. );
  2138. if (!defined_default(p2)) {
  2139. return void 0;
  2140. }
  2141. let n2 = Cartesian3_default.multiplyComponents(
  2142. p2,
  2143. oneOverRadiiSquared,
  2144. cartesianToCartographicN
  2145. );
  2146. n2 = Cartesian3_default.normalize(n2, n2);
  2147. const h = Cartesian3_default.subtract(cartesian11, p2, cartesianToCartographicH);
  2148. const longitude = Math.atan2(n2.y, n2.x);
  2149. const latitude = Math.asin(n2.z);
  2150. const height = Math_default.sign(Cartesian3_default.dot(h, cartesian11)) * Cartesian3_default.magnitude(h);
  2151. if (!defined_default(result)) {
  2152. return new Cartographic(longitude, latitude, height);
  2153. }
  2154. result.longitude = longitude;
  2155. result.latitude = latitude;
  2156. result.height = height;
  2157. return result;
  2158. };
  2159. Cartographic.toCartesian = function(cartographic2, ellipsoid, result) {
  2160. Check_default.defined("cartographic", cartographic2);
  2161. return Cartesian3_default.fromRadians(
  2162. cartographic2.longitude,
  2163. cartographic2.latitude,
  2164. cartographic2.height,
  2165. ellipsoid,
  2166. result
  2167. );
  2168. };
  2169. Cartographic.clone = function(cartographic2, result) {
  2170. if (!defined_default(cartographic2)) {
  2171. return void 0;
  2172. }
  2173. if (!defined_default(result)) {
  2174. return new Cartographic(
  2175. cartographic2.longitude,
  2176. cartographic2.latitude,
  2177. cartographic2.height
  2178. );
  2179. }
  2180. result.longitude = cartographic2.longitude;
  2181. result.latitude = cartographic2.latitude;
  2182. result.height = cartographic2.height;
  2183. return result;
  2184. };
  2185. Cartographic.equals = function(left, right) {
  2186. return left === right || defined_default(left) && defined_default(right) && left.longitude === right.longitude && left.latitude === right.latitude && left.height === right.height;
  2187. };
  2188. Cartographic.equalsEpsilon = function(left, right, epsilon) {
  2189. epsilon = defaultValue_default(epsilon, 0);
  2190. return left === right || defined_default(left) && defined_default(right) && Math.abs(left.longitude - right.longitude) <= epsilon && Math.abs(left.latitude - right.latitude) <= epsilon && Math.abs(left.height - right.height) <= epsilon;
  2191. };
  2192. Cartographic.ZERO = Object.freeze(new Cartographic(0, 0, 0));
  2193. Cartographic.prototype.clone = function(result) {
  2194. return Cartographic.clone(this, result);
  2195. };
  2196. Cartographic.prototype.equals = function(right) {
  2197. return Cartographic.equals(this, right);
  2198. };
  2199. Cartographic.prototype.equalsEpsilon = function(right, epsilon) {
  2200. return Cartographic.equalsEpsilon(this, right, epsilon);
  2201. };
  2202. Cartographic.prototype.toString = function() {
  2203. return `(${this.longitude}, ${this.latitude}, ${this.height})`;
  2204. };
  2205. var Cartographic_default = Cartographic;
  2206. // node_modules/cesium/Source/Core/Ellipsoid.js
  2207. function initialize(ellipsoid, x, y, z) {
  2208. x = defaultValue_default(x, 0);
  2209. y = defaultValue_default(y, 0);
  2210. z = defaultValue_default(z, 0);
  2211. Check_default.typeOf.number.greaterThanOrEquals("x", x, 0);
  2212. Check_default.typeOf.number.greaterThanOrEquals("y", y, 0);
  2213. Check_default.typeOf.number.greaterThanOrEquals("z", z, 0);
  2214. ellipsoid._radii = new Cartesian3_default(x, y, z);
  2215. ellipsoid._radiiSquared = new Cartesian3_default(x * x, y * y, z * z);
  2216. ellipsoid._radiiToTheFourth = new Cartesian3_default(
  2217. x * x * x * x,
  2218. y * y * y * y,
  2219. z * z * z * z
  2220. );
  2221. ellipsoid._oneOverRadii = new Cartesian3_default(
  2222. x === 0 ? 0 : 1 / x,
  2223. y === 0 ? 0 : 1 / y,
  2224. z === 0 ? 0 : 1 / z
  2225. );
  2226. ellipsoid._oneOverRadiiSquared = new Cartesian3_default(
  2227. x === 0 ? 0 : 1 / (x * x),
  2228. y === 0 ? 0 : 1 / (y * y),
  2229. z === 0 ? 0 : 1 / (z * z)
  2230. );
  2231. ellipsoid._minimumRadius = Math.min(x, y, z);
  2232. ellipsoid._maximumRadius = Math.max(x, y, z);
  2233. ellipsoid._centerToleranceSquared = Math_default.EPSILON1;
  2234. if (ellipsoid._radiiSquared.z !== 0) {
  2235. ellipsoid._squaredXOverSquaredZ = ellipsoid._radiiSquared.x / ellipsoid._radiiSquared.z;
  2236. }
  2237. }
  2238. function Ellipsoid(x, y, z) {
  2239. this._radii = void 0;
  2240. this._radiiSquared = void 0;
  2241. this._radiiToTheFourth = void 0;
  2242. this._oneOverRadii = void 0;
  2243. this._oneOverRadiiSquared = void 0;
  2244. this._minimumRadius = void 0;
  2245. this._maximumRadius = void 0;
  2246. this._centerToleranceSquared = void 0;
  2247. this._squaredXOverSquaredZ = void 0;
  2248. initialize(this, x, y, z);
  2249. }
  2250. Object.defineProperties(Ellipsoid.prototype, {
  2251. radii: {
  2252. get: function() {
  2253. return this._radii;
  2254. }
  2255. },
  2256. radiiSquared: {
  2257. get: function() {
  2258. return this._radiiSquared;
  2259. }
  2260. },
  2261. radiiToTheFourth: {
  2262. get: function() {
  2263. return this._radiiToTheFourth;
  2264. }
  2265. },
  2266. oneOverRadii: {
  2267. get: function() {
  2268. return this._oneOverRadii;
  2269. }
  2270. },
  2271. oneOverRadiiSquared: {
  2272. get: function() {
  2273. return this._oneOverRadiiSquared;
  2274. }
  2275. },
  2276. minimumRadius: {
  2277. get: function() {
  2278. return this._minimumRadius;
  2279. }
  2280. },
  2281. maximumRadius: {
  2282. get: function() {
  2283. return this._maximumRadius;
  2284. }
  2285. }
  2286. });
  2287. Ellipsoid.clone = function(ellipsoid, result) {
  2288. if (!defined_default(ellipsoid)) {
  2289. return void 0;
  2290. }
  2291. const radii = ellipsoid._radii;
  2292. if (!defined_default(result)) {
  2293. return new Ellipsoid(radii.x, radii.y, radii.z);
  2294. }
  2295. Cartesian3_default.clone(radii, result._radii);
  2296. Cartesian3_default.clone(ellipsoid._radiiSquared, result._radiiSquared);
  2297. Cartesian3_default.clone(ellipsoid._radiiToTheFourth, result._radiiToTheFourth);
  2298. Cartesian3_default.clone(ellipsoid._oneOverRadii, result._oneOverRadii);
  2299. Cartesian3_default.clone(ellipsoid._oneOverRadiiSquared, result._oneOverRadiiSquared);
  2300. result._minimumRadius = ellipsoid._minimumRadius;
  2301. result._maximumRadius = ellipsoid._maximumRadius;
  2302. result._centerToleranceSquared = ellipsoid._centerToleranceSquared;
  2303. return result;
  2304. };
  2305. Ellipsoid.fromCartesian3 = function(cartesian11, result) {
  2306. if (!defined_default(result)) {
  2307. result = new Ellipsoid();
  2308. }
  2309. if (!defined_default(cartesian11)) {
  2310. return result;
  2311. }
  2312. initialize(result, cartesian11.x, cartesian11.y, cartesian11.z);
  2313. return result;
  2314. };
  2315. Ellipsoid.WGS84 = Object.freeze(
  2316. new Ellipsoid(6378137, 6378137, 6356752314245179e-9)
  2317. );
  2318. Ellipsoid.UNIT_SPHERE = Object.freeze(new Ellipsoid(1, 1, 1));
  2319. Ellipsoid.MOON = Object.freeze(
  2320. new Ellipsoid(
  2321. Math_default.LUNAR_RADIUS,
  2322. Math_default.LUNAR_RADIUS,
  2323. Math_default.LUNAR_RADIUS
  2324. )
  2325. );
  2326. Ellipsoid.prototype.clone = function(result) {
  2327. return Ellipsoid.clone(this, result);
  2328. };
  2329. Ellipsoid.packedLength = Cartesian3_default.packedLength;
  2330. Ellipsoid.pack = function(value, array, startingIndex) {
  2331. Check_default.typeOf.object("value", value);
  2332. Check_default.defined("array", array);
  2333. startingIndex = defaultValue_default(startingIndex, 0);
  2334. Cartesian3_default.pack(value._radii, array, startingIndex);
  2335. return array;
  2336. };
  2337. Ellipsoid.unpack = function(array, startingIndex, result) {
  2338. Check_default.defined("array", array);
  2339. startingIndex = defaultValue_default(startingIndex, 0);
  2340. const radii = Cartesian3_default.unpack(array, startingIndex);
  2341. return Ellipsoid.fromCartesian3(radii, result);
  2342. };
  2343. Ellipsoid.prototype.geocentricSurfaceNormal = Cartesian3_default.normalize;
  2344. Ellipsoid.prototype.geodeticSurfaceNormalCartographic = function(cartographic2, result) {
  2345. Check_default.typeOf.object("cartographic", cartographic2);
  2346. const longitude = cartographic2.longitude;
  2347. const latitude = cartographic2.latitude;
  2348. const cosLatitude = Math.cos(latitude);
  2349. const x = cosLatitude * Math.cos(longitude);
  2350. const y = cosLatitude * Math.sin(longitude);
  2351. const z = Math.sin(latitude);
  2352. if (!defined_default(result)) {
  2353. result = new Cartesian3_default();
  2354. }
  2355. result.x = x;
  2356. result.y = y;
  2357. result.z = z;
  2358. return Cartesian3_default.normalize(result, result);
  2359. };
  2360. Ellipsoid.prototype.geodeticSurfaceNormal = function(cartesian11, result) {
  2361. if (Cartesian3_default.equalsEpsilon(cartesian11, Cartesian3_default.ZERO, Math_default.EPSILON14)) {
  2362. return void 0;
  2363. }
  2364. if (!defined_default(result)) {
  2365. result = new Cartesian3_default();
  2366. }
  2367. result = Cartesian3_default.multiplyComponents(
  2368. cartesian11,
  2369. this._oneOverRadiiSquared,
  2370. result
  2371. );
  2372. return Cartesian3_default.normalize(result, result);
  2373. };
  2374. var cartographicToCartesianNormal = new Cartesian3_default();
  2375. var cartographicToCartesianK = new Cartesian3_default();
  2376. Ellipsoid.prototype.cartographicToCartesian = function(cartographic2, result) {
  2377. const n2 = cartographicToCartesianNormal;
  2378. const k = cartographicToCartesianK;
  2379. this.geodeticSurfaceNormalCartographic(cartographic2, n2);
  2380. Cartesian3_default.multiplyComponents(this._radiiSquared, n2, k);
  2381. const gamma = Math.sqrt(Cartesian3_default.dot(n2, k));
  2382. Cartesian3_default.divideByScalar(k, gamma, k);
  2383. Cartesian3_default.multiplyByScalar(n2, cartographic2.height, n2);
  2384. if (!defined_default(result)) {
  2385. result = new Cartesian3_default();
  2386. }
  2387. return Cartesian3_default.add(k, n2, result);
  2388. };
  2389. Ellipsoid.prototype.cartographicArrayToCartesianArray = function(cartographics, result) {
  2390. Check_default.defined("cartographics", cartographics);
  2391. const length3 = cartographics.length;
  2392. if (!defined_default(result)) {
  2393. result = new Array(length3);
  2394. } else {
  2395. result.length = length3;
  2396. }
  2397. for (let i2 = 0; i2 < length3; i2++) {
  2398. result[i2] = this.cartographicToCartesian(cartographics[i2], result[i2]);
  2399. }
  2400. return result;
  2401. };
  2402. var cartesianToCartographicN2 = new Cartesian3_default();
  2403. var cartesianToCartographicP2 = new Cartesian3_default();
  2404. var cartesianToCartographicH2 = new Cartesian3_default();
  2405. Ellipsoid.prototype.cartesianToCartographic = function(cartesian11, result) {
  2406. const p2 = this.scaleToGeodeticSurface(cartesian11, cartesianToCartographicP2);
  2407. if (!defined_default(p2)) {
  2408. return void 0;
  2409. }
  2410. const n2 = this.geodeticSurfaceNormal(p2, cartesianToCartographicN2);
  2411. const h = Cartesian3_default.subtract(cartesian11, p2, cartesianToCartographicH2);
  2412. const longitude = Math.atan2(n2.y, n2.x);
  2413. const latitude = Math.asin(n2.z);
  2414. const height = Math_default.sign(Cartesian3_default.dot(h, cartesian11)) * Cartesian3_default.magnitude(h);
  2415. if (!defined_default(result)) {
  2416. return new Cartographic_default(longitude, latitude, height);
  2417. }
  2418. result.longitude = longitude;
  2419. result.latitude = latitude;
  2420. result.height = height;
  2421. return result;
  2422. };
  2423. Ellipsoid.prototype.cartesianArrayToCartographicArray = function(cartesians, result) {
  2424. Check_default.defined("cartesians", cartesians);
  2425. const length3 = cartesians.length;
  2426. if (!defined_default(result)) {
  2427. result = new Array(length3);
  2428. } else {
  2429. result.length = length3;
  2430. }
  2431. for (let i2 = 0; i2 < length3; ++i2) {
  2432. result[i2] = this.cartesianToCartographic(cartesians[i2], result[i2]);
  2433. }
  2434. return result;
  2435. };
  2436. Ellipsoid.prototype.scaleToGeodeticSurface = function(cartesian11, result) {
  2437. return scaleToGeodeticSurface_default(
  2438. cartesian11,
  2439. this._oneOverRadii,
  2440. this._oneOverRadiiSquared,
  2441. this._centerToleranceSquared,
  2442. result
  2443. );
  2444. };
  2445. Ellipsoid.prototype.scaleToGeocentricSurface = function(cartesian11, result) {
  2446. Check_default.typeOf.object("cartesian", cartesian11);
  2447. if (!defined_default(result)) {
  2448. result = new Cartesian3_default();
  2449. }
  2450. const positionX = cartesian11.x;
  2451. const positionY = cartesian11.y;
  2452. const positionZ = cartesian11.z;
  2453. const oneOverRadiiSquared = this._oneOverRadiiSquared;
  2454. const beta = 1 / Math.sqrt(
  2455. positionX * positionX * oneOverRadiiSquared.x + positionY * positionY * oneOverRadiiSquared.y + positionZ * positionZ * oneOverRadiiSquared.z
  2456. );
  2457. return Cartesian3_default.multiplyByScalar(cartesian11, beta, result);
  2458. };
  2459. Ellipsoid.prototype.transformPositionToScaledSpace = function(position, result) {
  2460. if (!defined_default(result)) {
  2461. result = new Cartesian3_default();
  2462. }
  2463. return Cartesian3_default.multiplyComponents(position, this._oneOverRadii, result);
  2464. };
  2465. Ellipsoid.prototype.transformPositionFromScaledSpace = function(position, result) {
  2466. if (!defined_default(result)) {
  2467. result = new Cartesian3_default();
  2468. }
  2469. return Cartesian3_default.multiplyComponents(position, this._radii, result);
  2470. };
  2471. Ellipsoid.prototype.equals = function(right) {
  2472. return this === right || defined_default(right) && Cartesian3_default.equals(this._radii, right._radii);
  2473. };
  2474. Ellipsoid.prototype.toString = function() {
  2475. return this._radii.toString();
  2476. };
  2477. Ellipsoid.prototype.getSurfaceNormalIntersectionWithZAxis = function(position, buffer, result) {
  2478. Check_default.typeOf.object("position", position);
  2479. if (!Math_default.equalsEpsilon(
  2480. this._radii.x,
  2481. this._radii.y,
  2482. Math_default.EPSILON15
  2483. )) {
  2484. throw new DeveloperError_default(
  2485. "Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)"
  2486. );
  2487. }
  2488. Check_default.typeOf.number.greaterThan("Ellipsoid.radii.z", this._radii.z, 0);
  2489. buffer = defaultValue_default(buffer, 0);
  2490. const squaredXOverSquaredZ = this._squaredXOverSquaredZ;
  2491. if (!defined_default(result)) {
  2492. result = new Cartesian3_default();
  2493. }
  2494. result.x = 0;
  2495. result.y = 0;
  2496. result.z = position.z * (1 - squaredXOverSquaredZ);
  2497. if (Math.abs(result.z) >= this._radii.z - buffer) {
  2498. return void 0;
  2499. }
  2500. return result;
  2501. };
  2502. var abscissas = [
  2503. 0.14887433898163,
  2504. 0.43339539412925,
  2505. 0.67940956829902,
  2506. 0.86506336668898,
  2507. 0.97390652851717,
  2508. 0
  2509. ];
  2510. var weights = [
  2511. 0.29552422471475,
  2512. 0.26926671930999,
  2513. 0.21908636251598,
  2514. 0.14945134915058,
  2515. 0.066671344308684,
  2516. 0
  2517. ];
  2518. function gaussLegendreQuadrature(a4, b, func) {
  2519. Check_default.typeOf.number("a", a4);
  2520. Check_default.typeOf.number("b", b);
  2521. Check_default.typeOf.func("func", func);
  2522. const xMean = 0.5 * (b + a4);
  2523. const xRange = 0.5 * (b - a4);
  2524. let sum = 0;
  2525. for (let i2 = 0; i2 < 5; i2++) {
  2526. const dx = xRange * abscissas[i2];
  2527. sum += weights[i2] * (func(xMean + dx) + func(xMean - dx));
  2528. }
  2529. sum *= xRange;
  2530. return sum;
  2531. }
  2532. Ellipsoid.prototype.surfaceArea = function(rectangle) {
  2533. Check_default.typeOf.object("rectangle", rectangle);
  2534. const minLongitude = rectangle.west;
  2535. let maxLongitude = rectangle.east;
  2536. const minLatitude = rectangle.south;
  2537. const maxLatitude = rectangle.north;
  2538. while (maxLongitude < minLongitude) {
  2539. maxLongitude += Math_default.TWO_PI;
  2540. }
  2541. const radiiSquared = this._radiiSquared;
  2542. const a22 = radiiSquared.x;
  2543. const b2 = radiiSquared.y;
  2544. const c22 = radiiSquared.z;
  2545. const a2b2 = a22 * b2;
  2546. return gaussLegendreQuadrature(minLatitude, maxLatitude, function(lat) {
  2547. const sinPhi = Math.cos(lat);
  2548. const cosPhi = Math.sin(lat);
  2549. return Math.cos(lat) * gaussLegendreQuadrature(minLongitude, maxLongitude, function(lon) {
  2550. const cosTheta = Math.cos(lon);
  2551. const sinTheta = Math.sin(lon);
  2552. return Math.sqrt(
  2553. a2b2 * cosPhi * cosPhi + c22 * (b2 * cosTheta * cosTheta + a22 * sinTheta * sinTheta) * sinPhi * sinPhi
  2554. );
  2555. });
  2556. });
  2557. };
  2558. var Ellipsoid_default = Ellipsoid;
  2559. // node_modules/cesium/Source/Core/GeographicProjection.js
  2560. function GeographicProjection(ellipsoid) {
  2561. this._ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  2562. this._semimajorAxis = this._ellipsoid.maximumRadius;
  2563. this._oneOverSemimajorAxis = 1 / this._semimajorAxis;
  2564. }
  2565. Object.defineProperties(GeographicProjection.prototype, {
  2566. ellipsoid: {
  2567. get: function() {
  2568. return this._ellipsoid;
  2569. }
  2570. }
  2571. });
  2572. GeographicProjection.prototype.project = function(cartographic2, result) {
  2573. const semimajorAxis = this._semimajorAxis;
  2574. const x = cartographic2.longitude * semimajorAxis;
  2575. const y = cartographic2.latitude * semimajorAxis;
  2576. const z = cartographic2.height;
  2577. if (!defined_default(result)) {
  2578. return new Cartesian3_default(x, y, z);
  2579. }
  2580. result.x = x;
  2581. result.y = y;
  2582. result.z = z;
  2583. return result;
  2584. };
  2585. GeographicProjection.prototype.unproject = function(cartesian11, result) {
  2586. if (!defined_default(cartesian11)) {
  2587. throw new DeveloperError_default("cartesian is required");
  2588. }
  2589. const oneOverEarthSemimajorAxis = this._oneOverSemimajorAxis;
  2590. const longitude = cartesian11.x * oneOverEarthSemimajorAxis;
  2591. const latitude = cartesian11.y * oneOverEarthSemimajorAxis;
  2592. const height = cartesian11.z;
  2593. if (!defined_default(result)) {
  2594. return new Cartographic_default(longitude, latitude, height);
  2595. }
  2596. result.longitude = longitude;
  2597. result.latitude = latitude;
  2598. result.height = height;
  2599. return result;
  2600. };
  2601. var GeographicProjection_default = GeographicProjection;
  2602. // node_modules/cesium/Source/Core/Intersect.js
  2603. var Intersect = {
  2604. OUTSIDE: -1,
  2605. INTERSECTING: 0,
  2606. INSIDE: 1
  2607. };
  2608. var Intersect_default = Object.freeze(Intersect);
  2609. // node_modules/cesium/Source/Core/Interval.js
  2610. function Interval(start, stop2) {
  2611. this.start = defaultValue_default(start, 0);
  2612. this.stop = defaultValue_default(stop2, 0);
  2613. }
  2614. var Interval_default = Interval;
  2615. // node_modules/cesium/Source/Core/Matrix3.js
  2616. function Matrix3(column0Row0, column1Row0, column2Row0, column0Row1, column1Row1, column2Row1, column0Row2, column1Row2, column2Row2) {
  2617. this[0] = defaultValue_default(column0Row0, 0);
  2618. this[1] = defaultValue_default(column0Row1, 0);
  2619. this[2] = defaultValue_default(column0Row2, 0);
  2620. this[3] = defaultValue_default(column1Row0, 0);
  2621. this[4] = defaultValue_default(column1Row1, 0);
  2622. this[5] = defaultValue_default(column1Row2, 0);
  2623. this[6] = defaultValue_default(column2Row0, 0);
  2624. this[7] = defaultValue_default(column2Row1, 0);
  2625. this[8] = defaultValue_default(column2Row2, 0);
  2626. }
  2627. Matrix3.packedLength = 9;
  2628. Matrix3.pack = function(value, array, startingIndex) {
  2629. Check_default.typeOf.object("value", value);
  2630. Check_default.defined("array", array);
  2631. startingIndex = defaultValue_default(startingIndex, 0);
  2632. array[startingIndex++] = value[0];
  2633. array[startingIndex++] = value[1];
  2634. array[startingIndex++] = value[2];
  2635. array[startingIndex++] = value[3];
  2636. array[startingIndex++] = value[4];
  2637. array[startingIndex++] = value[5];
  2638. array[startingIndex++] = value[6];
  2639. array[startingIndex++] = value[7];
  2640. array[startingIndex++] = value[8];
  2641. return array;
  2642. };
  2643. Matrix3.unpack = function(array, startingIndex, result) {
  2644. Check_default.defined("array", array);
  2645. startingIndex = defaultValue_default(startingIndex, 0);
  2646. if (!defined_default(result)) {
  2647. result = new Matrix3();
  2648. }
  2649. result[0] = array[startingIndex++];
  2650. result[1] = array[startingIndex++];
  2651. result[2] = array[startingIndex++];
  2652. result[3] = array[startingIndex++];
  2653. result[4] = array[startingIndex++];
  2654. result[5] = array[startingIndex++];
  2655. result[6] = array[startingIndex++];
  2656. result[7] = array[startingIndex++];
  2657. result[8] = array[startingIndex++];
  2658. return result;
  2659. };
  2660. Matrix3.packArray = function(array, result) {
  2661. Check_default.defined("array", array);
  2662. const length3 = array.length;
  2663. const resultLength = length3 * 9;
  2664. if (!defined_default(result)) {
  2665. result = new Array(resultLength);
  2666. } else if (!Array.isArray(result) && result.length !== resultLength) {
  2667. throw new DeveloperError_default(
  2668. "If result is a typed array, it must have exactly array.length * 9 elements"
  2669. );
  2670. } else if (result.length !== resultLength) {
  2671. result.length = resultLength;
  2672. }
  2673. for (let i2 = 0; i2 < length3; ++i2) {
  2674. Matrix3.pack(array[i2], result, i2 * 9);
  2675. }
  2676. return result;
  2677. };
  2678. Matrix3.unpackArray = function(array, result) {
  2679. Check_default.defined("array", array);
  2680. Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 9);
  2681. if (array.length % 9 !== 0) {
  2682. throw new DeveloperError_default("array length must be a multiple of 9.");
  2683. }
  2684. const length3 = array.length;
  2685. if (!defined_default(result)) {
  2686. result = new Array(length3 / 9);
  2687. } else {
  2688. result.length = length3 / 9;
  2689. }
  2690. for (let i2 = 0; i2 < length3; i2 += 9) {
  2691. const index2 = i2 / 9;
  2692. result[index2] = Matrix3.unpack(array, i2, result[index2]);
  2693. }
  2694. return result;
  2695. };
  2696. Matrix3.clone = function(matrix, result) {
  2697. if (!defined_default(matrix)) {
  2698. return void 0;
  2699. }
  2700. if (!defined_default(result)) {
  2701. return new Matrix3(
  2702. matrix[0],
  2703. matrix[3],
  2704. matrix[6],
  2705. matrix[1],
  2706. matrix[4],
  2707. matrix[7],
  2708. matrix[2],
  2709. matrix[5],
  2710. matrix[8]
  2711. );
  2712. }
  2713. result[0] = matrix[0];
  2714. result[1] = matrix[1];
  2715. result[2] = matrix[2];
  2716. result[3] = matrix[3];
  2717. result[4] = matrix[4];
  2718. result[5] = matrix[5];
  2719. result[6] = matrix[6];
  2720. result[7] = matrix[7];
  2721. result[8] = matrix[8];
  2722. return result;
  2723. };
  2724. Matrix3.fromArray = Matrix3.unpack;
  2725. Matrix3.fromColumnMajorArray = function(values, result) {
  2726. Check_default.defined("values", values);
  2727. return Matrix3.clone(values, result);
  2728. };
  2729. Matrix3.fromRowMajorArray = function(values, result) {
  2730. Check_default.defined("values", values);
  2731. if (!defined_default(result)) {
  2732. return new Matrix3(
  2733. values[0],
  2734. values[1],
  2735. values[2],
  2736. values[3],
  2737. values[4],
  2738. values[5],
  2739. values[6],
  2740. values[7],
  2741. values[8]
  2742. );
  2743. }
  2744. result[0] = values[0];
  2745. result[1] = values[3];
  2746. result[2] = values[6];
  2747. result[3] = values[1];
  2748. result[4] = values[4];
  2749. result[5] = values[7];
  2750. result[6] = values[2];
  2751. result[7] = values[5];
  2752. result[8] = values[8];
  2753. return result;
  2754. };
  2755. Matrix3.fromQuaternion = function(quaternion, result) {
  2756. Check_default.typeOf.object("quaternion", quaternion);
  2757. const x2 = quaternion.x * quaternion.x;
  2758. const xy = quaternion.x * quaternion.y;
  2759. const xz = quaternion.x * quaternion.z;
  2760. const xw = quaternion.x * quaternion.w;
  2761. const y2 = quaternion.y * quaternion.y;
  2762. const yz = quaternion.y * quaternion.z;
  2763. const yw = quaternion.y * quaternion.w;
  2764. const z2 = quaternion.z * quaternion.z;
  2765. const zw = quaternion.z * quaternion.w;
  2766. const w2 = quaternion.w * quaternion.w;
  2767. const m00 = x2 - y2 - z2 + w2;
  2768. const m01 = 2 * (xy - zw);
  2769. const m02 = 2 * (xz + yw);
  2770. const m10 = 2 * (xy + zw);
  2771. const m11 = -x2 + y2 - z2 + w2;
  2772. const m12 = 2 * (yz - xw);
  2773. const m20 = 2 * (xz - yw);
  2774. const m21 = 2 * (yz + xw);
  2775. const m22 = -x2 - y2 + z2 + w2;
  2776. if (!defined_default(result)) {
  2777. return new Matrix3(m00, m01, m02, m10, m11, m12, m20, m21, m22);
  2778. }
  2779. result[0] = m00;
  2780. result[1] = m10;
  2781. result[2] = m20;
  2782. result[3] = m01;
  2783. result[4] = m11;
  2784. result[5] = m21;
  2785. result[6] = m02;
  2786. result[7] = m12;
  2787. result[8] = m22;
  2788. return result;
  2789. };
  2790. Matrix3.fromHeadingPitchRoll = function(headingPitchRoll, result) {
  2791. Check_default.typeOf.object("headingPitchRoll", headingPitchRoll);
  2792. const cosTheta = Math.cos(-headingPitchRoll.pitch);
  2793. const cosPsi = Math.cos(-headingPitchRoll.heading);
  2794. const cosPhi = Math.cos(headingPitchRoll.roll);
  2795. const sinTheta = Math.sin(-headingPitchRoll.pitch);
  2796. const sinPsi = Math.sin(-headingPitchRoll.heading);
  2797. const sinPhi = Math.sin(headingPitchRoll.roll);
  2798. const m00 = cosTheta * cosPsi;
  2799. const m01 = -cosPhi * sinPsi + sinPhi * sinTheta * cosPsi;
  2800. const m02 = sinPhi * sinPsi + cosPhi * sinTheta * cosPsi;
  2801. const m10 = cosTheta * sinPsi;
  2802. const m11 = cosPhi * cosPsi + sinPhi * sinTheta * sinPsi;
  2803. const m12 = -sinPhi * cosPsi + cosPhi * sinTheta * sinPsi;
  2804. const m20 = -sinTheta;
  2805. const m21 = sinPhi * cosTheta;
  2806. const m22 = cosPhi * cosTheta;
  2807. if (!defined_default(result)) {
  2808. return new Matrix3(m00, m01, m02, m10, m11, m12, m20, m21, m22);
  2809. }
  2810. result[0] = m00;
  2811. result[1] = m10;
  2812. result[2] = m20;
  2813. result[3] = m01;
  2814. result[4] = m11;
  2815. result[5] = m21;
  2816. result[6] = m02;
  2817. result[7] = m12;
  2818. result[8] = m22;
  2819. return result;
  2820. };
  2821. Matrix3.fromScale = function(scale, result) {
  2822. Check_default.typeOf.object("scale", scale);
  2823. if (!defined_default(result)) {
  2824. return new Matrix3(scale.x, 0, 0, 0, scale.y, 0, 0, 0, scale.z);
  2825. }
  2826. result[0] = scale.x;
  2827. result[1] = 0;
  2828. result[2] = 0;
  2829. result[3] = 0;
  2830. result[4] = scale.y;
  2831. result[5] = 0;
  2832. result[6] = 0;
  2833. result[7] = 0;
  2834. result[8] = scale.z;
  2835. return result;
  2836. };
  2837. Matrix3.fromUniformScale = function(scale, result) {
  2838. Check_default.typeOf.number("scale", scale);
  2839. if (!defined_default(result)) {
  2840. return new Matrix3(scale, 0, 0, 0, scale, 0, 0, 0, scale);
  2841. }
  2842. result[0] = scale;
  2843. result[1] = 0;
  2844. result[2] = 0;
  2845. result[3] = 0;
  2846. result[4] = scale;
  2847. result[5] = 0;
  2848. result[6] = 0;
  2849. result[7] = 0;
  2850. result[8] = scale;
  2851. return result;
  2852. };
  2853. Matrix3.fromCrossProduct = function(vector, result) {
  2854. Check_default.typeOf.object("vector", vector);
  2855. if (!defined_default(result)) {
  2856. return new Matrix3(
  2857. 0,
  2858. -vector.z,
  2859. vector.y,
  2860. vector.z,
  2861. 0,
  2862. -vector.x,
  2863. -vector.y,
  2864. vector.x,
  2865. 0
  2866. );
  2867. }
  2868. result[0] = 0;
  2869. result[1] = vector.z;
  2870. result[2] = -vector.y;
  2871. result[3] = -vector.z;
  2872. result[4] = 0;
  2873. result[5] = vector.x;
  2874. result[6] = vector.y;
  2875. result[7] = -vector.x;
  2876. result[8] = 0;
  2877. return result;
  2878. };
  2879. Matrix3.fromRotationX = function(angle, result) {
  2880. Check_default.typeOf.number("angle", angle);
  2881. const cosAngle = Math.cos(angle);
  2882. const sinAngle = Math.sin(angle);
  2883. if (!defined_default(result)) {
  2884. return new Matrix3(
  2885. 1,
  2886. 0,
  2887. 0,
  2888. 0,
  2889. cosAngle,
  2890. -sinAngle,
  2891. 0,
  2892. sinAngle,
  2893. cosAngle
  2894. );
  2895. }
  2896. result[0] = 1;
  2897. result[1] = 0;
  2898. result[2] = 0;
  2899. result[3] = 0;
  2900. result[4] = cosAngle;
  2901. result[5] = sinAngle;
  2902. result[6] = 0;
  2903. result[7] = -sinAngle;
  2904. result[8] = cosAngle;
  2905. return result;
  2906. };
  2907. Matrix3.fromRotationY = function(angle, result) {
  2908. Check_default.typeOf.number("angle", angle);
  2909. const cosAngle = Math.cos(angle);
  2910. const sinAngle = Math.sin(angle);
  2911. if (!defined_default(result)) {
  2912. return new Matrix3(
  2913. cosAngle,
  2914. 0,
  2915. sinAngle,
  2916. 0,
  2917. 1,
  2918. 0,
  2919. -sinAngle,
  2920. 0,
  2921. cosAngle
  2922. );
  2923. }
  2924. result[0] = cosAngle;
  2925. result[1] = 0;
  2926. result[2] = -sinAngle;
  2927. result[3] = 0;
  2928. result[4] = 1;
  2929. result[5] = 0;
  2930. result[6] = sinAngle;
  2931. result[7] = 0;
  2932. result[8] = cosAngle;
  2933. return result;
  2934. };
  2935. Matrix3.fromRotationZ = function(angle, result) {
  2936. Check_default.typeOf.number("angle", angle);
  2937. const cosAngle = Math.cos(angle);
  2938. const sinAngle = Math.sin(angle);
  2939. if (!defined_default(result)) {
  2940. return new Matrix3(
  2941. cosAngle,
  2942. -sinAngle,
  2943. 0,
  2944. sinAngle,
  2945. cosAngle,
  2946. 0,
  2947. 0,
  2948. 0,
  2949. 1
  2950. );
  2951. }
  2952. result[0] = cosAngle;
  2953. result[1] = sinAngle;
  2954. result[2] = 0;
  2955. result[3] = -sinAngle;
  2956. result[4] = cosAngle;
  2957. result[5] = 0;
  2958. result[6] = 0;
  2959. result[7] = 0;
  2960. result[8] = 1;
  2961. return result;
  2962. };
  2963. Matrix3.toArray = function(matrix, result) {
  2964. Check_default.typeOf.object("matrix", matrix);
  2965. if (!defined_default(result)) {
  2966. return [
  2967. matrix[0],
  2968. matrix[1],
  2969. matrix[2],
  2970. matrix[3],
  2971. matrix[4],
  2972. matrix[5],
  2973. matrix[6],
  2974. matrix[7],
  2975. matrix[8]
  2976. ];
  2977. }
  2978. result[0] = matrix[0];
  2979. result[1] = matrix[1];
  2980. result[2] = matrix[2];
  2981. result[3] = matrix[3];
  2982. result[4] = matrix[4];
  2983. result[5] = matrix[5];
  2984. result[6] = matrix[6];
  2985. result[7] = matrix[7];
  2986. result[8] = matrix[8];
  2987. return result;
  2988. };
  2989. Matrix3.getElementIndex = function(column, row) {
  2990. Check_default.typeOf.number.greaterThanOrEquals("row", row, 0);
  2991. Check_default.typeOf.number.lessThanOrEquals("row", row, 2);
  2992. Check_default.typeOf.number.greaterThanOrEquals("column", column, 0);
  2993. Check_default.typeOf.number.lessThanOrEquals("column", column, 2);
  2994. return column * 3 + row;
  2995. };
  2996. Matrix3.getColumn = function(matrix, index2, result) {
  2997. Check_default.typeOf.object("matrix", matrix);
  2998. Check_default.typeOf.number.greaterThanOrEquals("index", index2, 0);
  2999. Check_default.typeOf.number.lessThanOrEquals("index", index2, 2);
  3000. Check_default.typeOf.object("result", result);
  3001. const startIndex = index2 * 3;
  3002. const x = matrix[startIndex];
  3003. const y = matrix[startIndex + 1];
  3004. const z = matrix[startIndex + 2];
  3005. result.x = x;
  3006. result.y = y;
  3007. result.z = z;
  3008. return result;
  3009. };
  3010. Matrix3.setColumn = function(matrix, index2, cartesian11, result) {
  3011. Check_default.typeOf.object("matrix", matrix);
  3012. Check_default.typeOf.number.greaterThanOrEquals("index", index2, 0);
  3013. Check_default.typeOf.number.lessThanOrEquals("index", index2, 2);
  3014. Check_default.typeOf.object("cartesian", cartesian11);
  3015. Check_default.typeOf.object("result", result);
  3016. result = Matrix3.clone(matrix, result);
  3017. const startIndex = index2 * 3;
  3018. result[startIndex] = cartesian11.x;
  3019. result[startIndex + 1] = cartesian11.y;
  3020. result[startIndex + 2] = cartesian11.z;
  3021. return result;
  3022. };
  3023. Matrix3.getRow = function(matrix, index2, result) {
  3024. Check_default.typeOf.object("matrix", matrix);
  3025. Check_default.typeOf.number.greaterThanOrEquals("index", index2, 0);
  3026. Check_default.typeOf.number.lessThanOrEquals("index", index2, 2);
  3027. Check_default.typeOf.object("result", result);
  3028. const x = matrix[index2];
  3029. const y = matrix[index2 + 3];
  3030. const z = matrix[index2 + 6];
  3031. result.x = x;
  3032. result.y = y;
  3033. result.z = z;
  3034. return result;
  3035. };
  3036. Matrix3.setRow = function(matrix, index2, cartesian11, result) {
  3037. Check_default.typeOf.object("matrix", matrix);
  3038. Check_default.typeOf.number.greaterThanOrEquals("index", index2, 0);
  3039. Check_default.typeOf.number.lessThanOrEquals("index", index2, 2);
  3040. Check_default.typeOf.object("cartesian", cartesian11);
  3041. Check_default.typeOf.object("result", result);
  3042. result = Matrix3.clone(matrix, result);
  3043. result[index2] = cartesian11.x;
  3044. result[index2 + 3] = cartesian11.y;
  3045. result[index2 + 6] = cartesian11.z;
  3046. return result;
  3047. };
  3048. var scaleScratch1 = new Cartesian3_default();
  3049. Matrix3.setScale = function(matrix, scale, result) {
  3050. Check_default.typeOf.object("matrix", matrix);
  3051. Check_default.typeOf.object("scale", scale);
  3052. Check_default.typeOf.object("result", result);
  3053. const existingScale = Matrix3.getScale(matrix, scaleScratch1);
  3054. const scaleRatioX = scale.x / existingScale.x;
  3055. const scaleRatioY = scale.y / existingScale.y;
  3056. const scaleRatioZ = scale.z / existingScale.z;
  3057. result[0] = matrix[0] * scaleRatioX;
  3058. result[1] = matrix[1] * scaleRatioX;
  3059. result[2] = matrix[2] * scaleRatioX;
  3060. result[3] = matrix[3] * scaleRatioY;
  3061. result[4] = matrix[4] * scaleRatioY;
  3062. result[5] = matrix[5] * scaleRatioY;
  3063. result[6] = matrix[6] * scaleRatioZ;
  3064. result[7] = matrix[7] * scaleRatioZ;
  3065. result[8] = matrix[8] * scaleRatioZ;
  3066. return result;
  3067. };
  3068. var scaleScratch2 = new Cartesian3_default();
  3069. Matrix3.setUniformScale = function(matrix, scale, result) {
  3070. Check_default.typeOf.object("matrix", matrix);
  3071. Check_default.typeOf.number("scale", scale);
  3072. Check_default.typeOf.object("result", result);
  3073. const existingScale = Matrix3.getScale(matrix, scaleScratch2);
  3074. const scaleRatioX = scale / existingScale.x;
  3075. const scaleRatioY = scale / existingScale.y;
  3076. const scaleRatioZ = scale / existingScale.z;
  3077. result[0] = matrix[0] * scaleRatioX;
  3078. result[1] = matrix[1] * scaleRatioX;
  3079. result[2] = matrix[2] * scaleRatioX;
  3080. result[3] = matrix[3] * scaleRatioY;
  3081. result[4] = matrix[4] * scaleRatioY;
  3082. result[5] = matrix[5] * scaleRatioY;
  3083. result[6] = matrix[6] * scaleRatioZ;
  3084. result[7] = matrix[7] * scaleRatioZ;
  3085. result[8] = matrix[8] * scaleRatioZ;
  3086. return result;
  3087. };
  3088. var scratchColumn = new Cartesian3_default();
  3089. Matrix3.getScale = function(matrix, result) {
  3090. Check_default.typeOf.object("matrix", matrix);
  3091. Check_default.typeOf.object("result", result);
  3092. result.x = Cartesian3_default.magnitude(
  3093. Cartesian3_default.fromElements(matrix[0], matrix[1], matrix[2], scratchColumn)
  3094. );
  3095. result.y = Cartesian3_default.magnitude(
  3096. Cartesian3_default.fromElements(matrix[3], matrix[4], matrix[5], scratchColumn)
  3097. );
  3098. result.z = Cartesian3_default.magnitude(
  3099. Cartesian3_default.fromElements(matrix[6], matrix[7], matrix[8], scratchColumn)
  3100. );
  3101. return result;
  3102. };
  3103. var scaleScratch3 = new Cartesian3_default();
  3104. Matrix3.getMaximumScale = function(matrix) {
  3105. Matrix3.getScale(matrix, scaleScratch3);
  3106. return Cartesian3_default.maximumComponent(scaleScratch3);
  3107. };
  3108. var scaleScratch4 = new Cartesian3_default();
  3109. Matrix3.setRotation = function(matrix, rotation, result) {
  3110. Check_default.typeOf.object("matrix", matrix);
  3111. Check_default.typeOf.object("result", result);
  3112. const scale = Matrix3.getScale(matrix, scaleScratch4);
  3113. result[0] = rotation[0] * scale.x;
  3114. result[1] = rotation[1] * scale.x;
  3115. result[2] = rotation[2] * scale.x;
  3116. result[3] = rotation[3] * scale.y;
  3117. result[4] = rotation[4] * scale.y;
  3118. result[5] = rotation[5] * scale.y;
  3119. result[6] = rotation[6] * scale.z;
  3120. result[7] = rotation[7] * scale.z;
  3121. result[8] = rotation[8] * scale.z;
  3122. return result;
  3123. };
  3124. var scaleScratch5 = new Cartesian3_default();
  3125. Matrix3.getRotation = function(matrix, result) {
  3126. Check_default.typeOf.object("matrix", matrix);
  3127. Check_default.typeOf.object("result", result);
  3128. const scale = Matrix3.getScale(matrix, scaleScratch5);
  3129. result[0] = matrix[0] / scale.x;
  3130. result[1] = matrix[1] / scale.x;
  3131. result[2] = matrix[2] / scale.x;
  3132. result[3] = matrix[3] / scale.y;
  3133. result[4] = matrix[4] / scale.y;
  3134. result[5] = matrix[5] / scale.y;
  3135. result[6] = matrix[6] / scale.z;
  3136. result[7] = matrix[7] / scale.z;
  3137. result[8] = matrix[8] / scale.z;
  3138. return result;
  3139. };
  3140. Matrix3.multiply = function(left, right, result) {
  3141. Check_default.typeOf.object("left", left);
  3142. Check_default.typeOf.object("right", right);
  3143. Check_default.typeOf.object("result", result);
  3144. const column0Row0 = left[0] * right[0] + left[3] * right[1] + left[6] * right[2];
  3145. const column0Row1 = left[1] * right[0] + left[4] * right[1] + left[7] * right[2];
  3146. const column0Row2 = left[2] * right[0] + left[5] * right[1] + left[8] * right[2];
  3147. const column1Row0 = left[0] * right[3] + left[3] * right[4] + left[6] * right[5];
  3148. const column1Row1 = left[1] * right[3] + left[4] * right[4] + left[7] * right[5];
  3149. const column1Row2 = left[2] * right[3] + left[5] * right[4] + left[8] * right[5];
  3150. const column2Row0 = left[0] * right[6] + left[3] * right[7] + left[6] * right[8];
  3151. const column2Row1 = left[1] * right[6] + left[4] * right[7] + left[7] * right[8];
  3152. const column2Row2 = left[2] * right[6] + left[5] * right[7] + left[8] * right[8];
  3153. result[0] = column0Row0;
  3154. result[1] = column0Row1;
  3155. result[2] = column0Row2;
  3156. result[3] = column1Row0;
  3157. result[4] = column1Row1;
  3158. result[5] = column1Row2;
  3159. result[6] = column2Row0;
  3160. result[7] = column2Row1;
  3161. result[8] = column2Row2;
  3162. return result;
  3163. };
  3164. Matrix3.add = function(left, right, result) {
  3165. Check_default.typeOf.object("left", left);
  3166. Check_default.typeOf.object("right", right);
  3167. Check_default.typeOf.object("result", result);
  3168. result[0] = left[0] + right[0];
  3169. result[1] = left[1] + right[1];
  3170. result[2] = left[2] + right[2];
  3171. result[3] = left[3] + right[3];
  3172. result[4] = left[4] + right[4];
  3173. result[5] = left[5] + right[5];
  3174. result[6] = left[6] + right[6];
  3175. result[7] = left[7] + right[7];
  3176. result[8] = left[8] + right[8];
  3177. return result;
  3178. };
  3179. Matrix3.subtract = function(left, right, result) {
  3180. Check_default.typeOf.object("left", left);
  3181. Check_default.typeOf.object("right", right);
  3182. Check_default.typeOf.object("result", result);
  3183. result[0] = left[0] - right[0];
  3184. result[1] = left[1] - right[1];
  3185. result[2] = left[2] - right[2];
  3186. result[3] = left[3] - right[3];
  3187. result[4] = left[4] - right[4];
  3188. result[5] = left[5] - right[5];
  3189. result[6] = left[6] - right[6];
  3190. result[7] = left[7] - right[7];
  3191. result[8] = left[8] - right[8];
  3192. return result;
  3193. };
  3194. Matrix3.multiplyByVector = function(matrix, cartesian11, result) {
  3195. Check_default.typeOf.object("matrix", matrix);
  3196. Check_default.typeOf.object("cartesian", cartesian11);
  3197. Check_default.typeOf.object("result", result);
  3198. const vX = cartesian11.x;
  3199. const vY = cartesian11.y;
  3200. const vZ = cartesian11.z;
  3201. const x = matrix[0] * vX + matrix[3] * vY + matrix[6] * vZ;
  3202. const y = matrix[1] * vX + matrix[4] * vY + matrix[7] * vZ;
  3203. const z = matrix[2] * vX + matrix[5] * vY + matrix[8] * vZ;
  3204. result.x = x;
  3205. result.y = y;
  3206. result.z = z;
  3207. return result;
  3208. };
  3209. Matrix3.multiplyByScalar = function(matrix, scalar, result) {
  3210. Check_default.typeOf.object("matrix", matrix);
  3211. Check_default.typeOf.number("scalar", scalar);
  3212. Check_default.typeOf.object("result", result);
  3213. result[0] = matrix[0] * scalar;
  3214. result[1] = matrix[1] * scalar;
  3215. result[2] = matrix[2] * scalar;
  3216. result[3] = matrix[3] * scalar;
  3217. result[4] = matrix[4] * scalar;
  3218. result[5] = matrix[5] * scalar;
  3219. result[6] = matrix[6] * scalar;
  3220. result[7] = matrix[7] * scalar;
  3221. result[8] = matrix[8] * scalar;
  3222. return result;
  3223. };
  3224. Matrix3.multiplyByScale = function(matrix, scale, result) {
  3225. Check_default.typeOf.object("matrix", matrix);
  3226. Check_default.typeOf.object("scale", scale);
  3227. Check_default.typeOf.object("result", result);
  3228. result[0] = matrix[0] * scale.x;
  3229. result[1] = matrix[1] * scale.x;
  3230. result[2] = matrix[2] * scale.x;
  3231. result[3] = matrix[3] * scale.y;
  3232. result[4] = matrix[4] * scale.y;
  3233. result[5] = matrix[5] * scale.y;
  3234. result[6] = matrix[6] * scale.z;
  3235. result[7] = matrix[7] * scale.z;
  3236. result[8] = matrix[8] * scale.z;
  3237. return result;
  3238. };
  3239. Matrix3.multiplyByUniformScale = function(matrix, scale, result) {
  3240. Check_default.typeOf.object("matrix", matrix);
  3241. Check_default.typeOf.number("scale", scale);
  3242. Check_default.typeOf.object("result", result);
  3243. result[0] = matrix[0] * scale;
  3244. result[1] = matrix[1] * scale;
  3245. result[2] = matrix[2] * scale;
  3246. result[3] = matrix[3] * scale;
  3247. result[4] = matrix[4] * scale;
  3248. result[5] = matrix[5] * scale;
  3249. result[6] = matrix[6] * scale;
  3250. result[7] = matrix[7] * scale;
  3251. result[8] = matrix[8] * scale;
  3252. return result;
  3253. };
  3254. Matrix3.negate = function(matrix, result) {
  3255. Check_default.typeOf.object("matrix", matrix);
  3256. Check_default.typeOf.object("result", result);
  3257. result[0] = -matrix[0];
  3258. result[1] = -matrix[1];
  3259. result[2] = -matrix[2];
  3260. result[3] = -matrix[3];
  3261. result[4] = -matrix[4];
  3262. result[5] = -matrix[5];
  3263. result[6] = -matrix[6];
  3264. result[7] = -matrix[7];
  3265. result[8] = -matrix[8];
  3266. return result;
  3267. };
  3268. Matrix3.transpose = function(matrix, result) {
  3269. Check_default.typeOf.object("matrix", matrix);
  3270. Check_default.typeOf.object("result", result);
  3271. const column0Row0 = matrix[0];
  3272. const column0Row1 = matrix[3];
  3273. const column0Row2 = matrix[6];
  3274. const column1Row0 = matrix[1];
  3275. const column1Row1 = matrix[4];
  3276. const column1Row2 = matrix[7];
  3277. const column2Row0 = matrix[2];
  3278. const column2Row1 = matrix[5];
  3279. const column2Row2 = matrix[8];
  3280. result[0] = column0Row0;
  3281. result[1] = column0Row1;
  3282. result[2] = column0Row2;
  3283. result[3] = column1Row0;
  3284. result[4] = column1Row1;
  3285. result[5] = column1Row2;
  3286. result[6] = column2Row0;
  3287. result[7] = column2Row1;
  3288. result[8] = column2Row2;
  3289. return result;
  3290. };
  3291. function computeFrobeniusNorm(matrix) {
  3292. let norm = 0;
  3293. for (let i2 = 0; i2 < 9; ++i2) {
  3294. const temp = matrix[i2];
  3295. norm += temp * temp;
  3296. }
  3297. return Math.sqrt(norm);
  3298. }
  3299. var rowVal = [1, 0, 0];
  3300. var colVal = [2, 2, 1];
  3301. function offDiagonalFrobeniusNorm(matrix) {
  3302. let norm = 0;
  3303. for (let i2 = 0; i2 < 3; ++i2) {
  3304. const temp = matrix[Matrix3.getElementIndex(colVal[i2], rowVal[i2])];
  3305. norm += 2 * temp * temp;
  3306. }
  3307. return Math.sqrt(norm);
  3308. }
  3309. function shurDecomposition(matrix, result) {
  3310. const tolerance = Math_default.EPSILON15;
  3311. let maxDiagonal = 0;
  3312. let rotAxis2 = 1;
  3313. for (let i2 = 0; i2 < 3; ++i2) {
  3314. const temp = Math.abs(
  3315. matrix[Matrix3.getElementIndex(colVal[i2], rowVal[i2])]
  3316. );
  3317. if (temp > maxDiagonal) {
  3318. rotAxis2 = i2;
  3319. maxDiagonal = temp;
  3320. }
  3321. }
  3322. let c14 = 1;
  3323. let s2 = 0;
  3324. const p2 = rowVal[rotAxis2];
  3325. const q = colVal[rotAxis2];
  3326. if (Math.abs(matrix[Matrix3.getElementIndex(q, p2)]) > tolerance) {
  3327. const qq = matrix[Matrix3.getElementIndex(q, q)];
  3328. const pp = matrix[Matrix3.getElementIndex(p2, p2)];
  3329. const qp = matrix[Matrix3.getElementIndex(q, p2)];
  3330. const tau = (qq - pp) / 2 / qp;
  3331. let t;
  3332. if (tau < 0) {
  3333. t = -1 / (-tau + Math.sqrt(1 + tau * tau));
  3334. } else {
  3335. t = 1 / (tau + Math.sqrt(1 + tau * tau));
  3336. }
  3337. c14 = 1 / Math.sqrt(1 + t * t);
  3338. s2 = t * c14;
  3339. }
  3340. result = Matrix3.clone(Matrix3.IDENTITY, result);
  3341. result[Matrix3.getElementIndex(p2, p2)] = result[Matrix3.getElementIndex(q, q)] = c14;
  3342. result[Matrix3.getElementIndex(q, p2)] = s2;
  3343. result[Matrix3.getElementIndex(p2, q)] = -s2;
  3344. return result;
  3345. }
  3346. var jMatrix = new Matrix3();
  3347. var jMatrixTranspose = new Matrix3();
  3348. Matrix3.computeEigenDecomposition = function(matrix, result) {
  3349. Check_default.typeOf.object("matrix", matrix);
  3350. const tolerance = Math_default.EPSILON20;
  3351. const maxSweeps = 10;
  3352. let count = 0;
  3353. let sweep = 0;
  3354. if (!defined_default(result)) {
  3355. result = {};
  3356. }
  3357. const unitaryMatrix = result.unitary = Matrix3.clone(
  3358. Matrix3.IDENTITY,
  3359. result.unitary
  3360. );
  3361. const diagMatrix = result.diagonal = Matrix3.clone(matrix, result.diagonal);
  3362. const epsilon = tolerance * computeFrobeniusNorm(diagMatrix);
  3363. while (sweep < maxSweeps && offDiagonalFrobeniusNorm(diagMatrix) > epsilon) {
  3364. shurDecomposition(diagMatrix, jMatrix);
  3365. Matrix3.transpose(jMatrix, jMatrixTranspose);
  3366. Matrix3.multiply(diagMatrix, jMatrix, diagMatrix);
  3367. Matrix3.multiply(jMatrixTranspose, diagMatrix, diagMatrix);
  3368. Matrix3.multiply(unitaryMatrix, jMatrix, unitaryMatrix);
  3369. if (++count > 2) {
  3370. ++sweep;
  3371. count = 0;
  3372. }
  3373. }
  3374. return result;
  3375. };
  3376. Matrix3.abs = function(matrix, result) {
  3377. Check_default.typeOf.object("matrix", matrix);
  3378. Check_default.typeOf.object("result", result);
  3379. result[0] = Math.abs(matrix[0]);
  3380. result[1] = Math.abs(matrix[1]);
  3381. result[2] = Math.abs(matrix[2]);
  3382. result[3] = Math.abs(matrix[3]);
  3383. result[4] = Math.abs(matrix[4]);
  3384. result[5] = Math.abs(matrix[5]);
  3385. result[6] = Math.abs(matrix[6]);
  3386. result[7] = Math.abs(matrix[7]);
  3387. result[8] = Math.abs(matrix[8]);
  3388. return result;
  3389. };
  3390. Matrix3.determinant = function(matrix) {
  3391. Check_default.typeOf.object("matrix", matrix);
  3392. const m11 = matrix[0];
  3393. const m21 = matrix[3];
  3394. const m31 = matrix[6];
  3395. const m12 = matrix[1];
  3396. const m22 = matrix[4];
  3397. const m32 = matrix[7];
  3398. const m13 = matrix[2];
  3399. const m23 = matrix[5];
  3400. const m33 = matrix[8];
  3401. return m11 * (m22 * m33 - m23 * m32) + m12 * (m23 * m31 - m21 * m33) + m13 * (m21 * m32 - m22 * m31);
  3402. };
  3403. Matrix3.inverse = function(matrix, result) {
  3404. Check_default.typeOf.object("matrix", matrix);
  3405. Check_default.typeOf.object("result", result);
  3406. const m11 = matrix[0];
  3407. const m21 = matrix[1];
  3408. const m31 = matrix[2];
  3409. const m12 = matrix[3];
  3410. const m22 = matrix[4];
  3411. const m32 = matrix[5];
  3412. const m13 = matrix[6];
  3413. const m23 = matrix[7];
  3414. const m33 = matrix[8];
  3415. const determinant = Matrix3.determinant(matrix);
  3416. if (Math.abs(determinant) <= Math_default.EPSILON15) {
  3417. throw new DeveloperError_default("matrix is not invertible");
  3418. }
  3419. result[0] = m22 * m33 - m23 * m32;
  3420. result[1] = m23 * m31 - m21 * m33;
  3421. result[2] = m21 * m32 - m22 * m31;
  3422. result[3] = m13 * m32 - m12 * m33;
  3423. result[4] = m11 * m33 - m13 * m31;
  3424. result[5] = m12 * m31 - m11 * m32;
  3425. result[6] = m12 * m23 - m13 * m22;
  3426. result[7] = m13 * m21 - m11 * m23;
  3427. result[8] = m11 * m22 - m12 * m21;
  3428. const scale = 1 / determinant;
  3429. return Matrix3.multiplyByScalar(result, scale, result);
  3430. };
  3431. var scratchTransposeMatrix = new Matrix3();
  3432. Matrix3.inverseTranspose = function(matrix, result) {
  3433. Check_default.typeOf.object("matrix", matrix);
  3434. Check_default.typeOf.object("result", result);
  3435. return Matrix3.inverse(
  3436. Matrix3.transpose(matrix, scratchTransposeMatrix),
  3437. result
  3438. );
  3439. };
  3440. Matrix3.equals = function(left, right) {
  3441. return left === right || defined_default(left) && defined_default(right) && left[0] === right[0] && left[1] === right[1] && left[2] === right[2] && left[3] === right[3] && left[4] === right[4] && left[5] === right[5] && left[6] === right[6] && left[7] === right[7] && left[8] === right[8];
  3442. };
  3443. Matrix3.equalsEpsilon = function(left, right, epsilon) {
  3444. epsilon = defaultValue_default(epsilon, 0);
  3445. return left === right || defined_default(left) && defined_default(right) && Math.abs(left[0] - right[0]) <= epsilon && Math.abs(left[1] - right[1]) <= epsilon && Math.abs(left[2] - right[2]) <= epsilon && Math.abs(left[3] - right[3]) <= epsilon && Math.abs(left[4] - right[4]) <= epsilon && Math.abs(left[5] - right[5]) <= epsilon && Math.abs(left[6] - right[6]) <= epsilon && Math.abs(left[7] - right[7]) <= epsilon && Math.abs(left[8] - right[8]) <= epsilon;
  3446. };
  3447. Matrix3.IDENTITY = Object.freeze(
  3448. new Matrix3(1, 0, 0, 0, 1, 0, 0, 0, 1)
  3449. );
  3450. Matrix3.ZERO = Object.freeze(
  3451. new Matrix3(0, 0, 0, 0, 0, 0, 0, 0, 0)
  3452. );
  3453. Matrix3.COLUMN0ROW0 = 0;
  3454. Matrix3.COLUMN0ROW1 = 1;
  3455. Matrix3.COLUMN0ROW2 = 2;
  3456. Matrix3.COLUMN1ROW0 = 3;
  3457. Matrix3.COLUMN1ROW1 = 4;
  3458. Matrix3.COLUMN1ROW2 = 5;
  3459. Matrix3.COLUMN2ROW0 = 6;
  3460. Matrix3.COLUMN2ROW1 = 7;
  3461. Matrix3.COLUMN2ROW2 = 8;
  3462. Object.defineProperties(Matrix3.prototype, {
  3463. length: {
  3464. get: function() {
  3465. return Matrix3.packedLength;
  3466. }
  3467. }
  3468. });
  3469. Matrix3.prototype.clone = function(result) {
  3470. return Matrix3.clone(this, result);
  3471. };
  3472. Matrix3.prototype.equals = function(right) {
  3473. return Matrix3.equals(this, right);
  3474. };
  3475. Matrix3.equalsArray = function(matrix, array, offset2) {
  3476. return matrix[0] === array[offset2] && matrix[1] === array[offset2 + 1] && matrix[2] === array[offset2 + 2] && matrix[3] === array[offset2 + 3] && matrix[4] === array[offset2 + 4] && matrix[5] === array[offset2 + 5] && matrix[6] === array[offset2 + 6] && matrix[7] === array[offset2 + 7] && matrix[8] === array[offset2 + 8];
  3477. };
  3478. Matrix3.prototype.equalsEpsilon = function(right, epsilon) {
  3479. return Matrix3.equalsEpsilon(this, right, epsilon);
  3480. };
  3481. Matrix3.prototype.toString = function() {
  3482. return `(${this[0]}, ${this[3]}, ${this[6]})
  3483. (${this[1]}, ${this[4]}, ${this[7]})
  3484. (${this[2]}, ${this[5]}, ${this[8]})`;
  3485. };
  3486. var Matrix3_default = Matrix3;
  3487. // node_modules/cesium/Source/Core/Cartesian4.js
  3488. function Cartesian4(x, y, z, w) {
  3489. this.x = defaultValue_default(x, 0);
  3490. this.y = defaultValue_default(y, 0);
  3491. this.z = defaultValue_default(z, 0);
  3492. this.w = defaultValue_default(w, 0);
  3493. }
  3494. Cartesian4.fromElements = function(x, y, z, w, result) {
  3495. if (!defined_default(result)) {
  3496. return new Cartesian4(x, y, z, w);
  3497. }
  3498. result.x = x;
  3499. result.y = y;
  3500. result.z = z;
  3501. result.w = w;
  3502. return result;
  3503. };
  3504. Cartesian4.fromColor = function(color, result) {
  3505. Check_default.typeOf.object("color", color);
  3506. if (!defined_default(result)) {
  3507. return new Cartesian4(color.red, color.green, color.blue, color.alpha);
  3508. }
  3509. result.x = color.red;
  3510. result.y = color.green;
  3511. result.z = color.blue;
  3512. result.w = color.alpha;
  3513. return result;
  3514. };
  3515. Cartesian4.clone = function(cartesian11, result) {
  3516. if (!defined_default(cartesian11)) {
  3517. return void 0;
  3518. }
  3519. if (!defined_default(result)) {
  3520. return new Cartesian4(cartesian11.x, cartesian11.y, cartesian11.z, cartesian11.w);
  3521. }
  3522. result.x = cartesian11.x;
  3523. result.y = cartesian11.y;
  3524. result.z = cartesian11.z;
  3525. result.w = cartesian11.w;
  3526. return result;
  3527. };
  3528. Cartesian4.packedLength = 4;
  3529. Cartesian4.pack = function(value, array, startingIndex) {
  3530. Check_default.typeOf.object("value", value);
  3531. Check_default.defined("array", array);
  3532. startingIndex = defaultValue_default(startingIndex, 0);
  3533. array[startingIndex++] = value.x;
  3534. array[startingIndex++] = value.y;
  3535. array[startingIndex++] = value.z;
  3536. array[startingIndex] = value.w;
  3537. return array;
  3538. };
  3539. Cartesian4.unpack = function(array, startingIndex, result) {
  3540. Check_default.defined("array", array);
  3541. startingIndex = defaultValue_default(startingIndex, 0);
  3542. if (!defined_default(result)) {
  3543. result = new Cartesian4();
  3544. }
  3545. result.x = array[startingIndex++];
  3546. result.y = array[startingIndex++];
  3547. result.z = array[startingIndex++];
  3548. result.w = array[startingIndex];
  3549. return result;
  3550. };
  3551. Cartesian4.packArray = function(array, result) {
  3552. Check_default.defined("array", array);
  3553. const length3 = array.length;
  3554. const resultLength = length3 * 4;
  3555. if (!defined_default(result)) {
  3556. result = new Array(resultLength);
  3557. } else if (!Array.isArray(result) && result.length !== resultLength) {
  3558. throw new DeveloperError_default(
  3559. "If result is a typed array, it must have exactly array.length * 4 elements"
  3560. );
  3561. } else if (result.length !== resultLength) {
  3562. result.length = resultLength;
  3563. }
  3564. for (let i2 = 0; i2 < length3; ++i2) {
  3565. Cartesian4.pack(array[i2], result, i2 * 4);
  3566. }
  3567. return result;
  3568. };
  3569. Cartesian4.unpackArray = function(array, result) {
  3570. Check_default.defined("array", array);
  3571. Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 4);
  3572. if (array.length % 4 !== 0) {
  3573. throw new DeveloperError_default("array length must be a multiple of 4.");
  3574. }
  3575. const length3 = array.length;
  3576. if (!defined_default(result)) {
  3577. result = new Array(length3 / 4);
  3578. } else {
  3579. result.length = length3 / 4;
  3580. }
  3581. for (let i2 = 0; i2 < length3; i2 += 4) {
  3582. const index2 = i2 / 4;
  3583. result[index2] = Cartesian4.unpack(array, i2, result[index2]);
  3584. }
  3585. return result;
  3586. };
  3587. Cartesian4.fromArray = Cartesian4.unpack;
  3588. Cartesian4.maximumComponent = function(cartesian11) {
  3589. Check_default.typeOf.object("cartesian", cartesian11);
  3590. return Math.max(cartesian11.x, cartesian11.y, cartesian11.z, cartesian11.w);
  3591. };
  3592. Cartesian4.minimumComponent = function(cartesian11) {
  3593. Check_default.typeOf.object("cartesian", cartesian11);
  3594. return Math.min(cartesian11.x, cartesian11.y, cartesian11.z, cartesian11.w);
  3595. };
  3596. Cartesian4.minimumByComponent = function(first, second, result) {
  3597. Check_default.typeOf.object("first", first);
  3598. Check_default.typeOf.object("second", second);
  3599. Check_default.typeOf.object("result", result);
  3600. result.x = Math.min(first.x, second.x);
  3601. result.y = Math.min(first.y, second.y);
  3602. result.z = Math.min(first.z, second.z);
  3603. result.w = Math.min(first.w, second.w);
  3604. return result;
  3605. };
  3606. Cartesian4.maximumByComponent = function(first, second, result) {
  3607. Check_default.typeOf.object("first", first);
  3608. Check_default.typeOf.object("second", second);
  3609. Check_default.typeOf.object("result", result);
  3610. result.x = Math.max(first.x, second.x);
  3611. result.y = Math.max(first.y, second.y);
  3612. result.z = Math.max(first.z, second.z);
  3613. result.w = Math.max(first.w, second.w);
  3614. return result;
  3615. };
  3616. Cartesian4.clamp = function(value, min3, max3, result) {
  3617. Check_default.typeOf.object("value", value);
  3618. Check_default.typeOf.object("min", min3);
  3619. Check_default.typeOf.object("max", max3);
  3620. Check_default.typeOf.object("result", result);
  3621. const x = Math_default.clamp(value.x, min3.x, max3.x);
  3622. const y = Math_default.clamp(value.y, min3.y, max3.y);
  3623. const z = Math_default.clamp(value.z, min3.z, max3.z);
  3624. const w = Math_default.clamp(value.w, min3.w, max3.w);
  3625. result.x = x;
  3626. result.y = y;
  3627. result.z = z;
  3628. result.w = w;
  3629. return result;
  3630. };
  3631. Cartesian4.magnitudeSquared = function(cartesian11) {
  3632. Check_default.typeOf.object("cartesian", cartesian11);
  3633. return cartesian11.x * cartesian11.x + cartesian11.y * cartesian11.y + cartesian11.z * cartesian11.z + cartesian11.w * cartesian11.w;
  3634. };
  3635. Cartesian4.magnitude = function(cartesian11) {
  3636. return Math.sqrt(Cartesian4.magnitudeSquared(cartesian11));
  3637. };
  3638. var distanceScratch2 = new Cartesian4();
  3639. Cartesian4.distance = function(left, right) {
  3640. Check_default.typeOf.object("left", left);
  3641. Check_default.typeOf.object("right", right);
  3642. Cartesian4.subtract(left, right, distanceScratch2);
  3643. return Cartesian4.magnitude(distanceScratch2);
  3644. };
  3645. Cartesian4.distanceSquared = function(left, right) {
  3646. Check_default.typeOf.object("left", left);
  3647. Check_default.typeOf.object("right", right);
  3648. Cartesian4.subtract(left, right, distanceScratch2);
  3649. return Cartesian4.magnitudeSquared(distanceScratch2);
  3650. };
  3651. Cartesian4.normalize = function(cartesian11, result) {
  3652. Check_default.typeOf.object("cartesian", cartesian11);
  3653. Check_default.typeOf.object("result", result);
  3654. const magnitude = Cartesian4.magnitude(cartesian11);
  3655. result.x = cartesian11.x / magnitude;
  3656. result.y = cartesian11.y / magnitude;
  3657. result.z = cartesian11.z / magnitude;
  3658. result.w = cartesian11.w / magnitude;
  3659. if (isNaN(result.x) || isNaN(result.y) || isNaN(result.z) || isNaN(result.w)) {
  3660. throw new DeveloperError_default("normalized result is not a number");
  3661. }
  3662. return result;
  3663. };
  3664. Cartesian4.dot = function(left, right) {
  3665. Check_default.typeOf.object("left", left);
  3666. Check_default.typeOf.object("right", right);
  3667. return left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w;
  3668. };
  3669. Cartesian4.multiplyComponents = function(left, right, result) {
  3670. Check_default.typeOf.object("left", left);
  3671. Check_default.typeOf.object("right", right);
  3672. Check_default.typeOf.object("result", result);
  3673. result.x = left.x * right.x;
  3674. result.y = left.y * right.y;
  3675. result.z = left.z * right.z;
  3676. result.w = left.w * right.w;
  3677. return result;
  3678. };
  3679. Cartesian4.divideComponents = function(left, right, result) {
  3680. Check_default.typeOf.object("left", left);
  3681. Check_default.typeOf.object("right", right);
  3682. Check_default.typeOf.object("result", result);
  3683. result.x = left.x / right.x;
  3684. result.y = left.y / right.y;
  3685. result.z = left.z / right.z;
  3686. result.w = left.w / right.w;
  3687. return result;
  3688. };
  3689. Cartesian4.add = function(left, right, result) {
  3690. Check_default.typeOf.object("left", left);
  3691. Check_default.typeOf.object("right", right);
  3692. Check_default.typeOf.object("result", result);
  3693. result.x = left.x + right.x;
  3694. result.y = left.y + right.y;
  3695. result.z = left.z + right.z;
  3696. result.w = left.w + right.w;
  3697. return result;
  3698. };
  3699. Cartesian4.subtract = function(left, right, result) {
  3700. Check_default.typeOf.object("left", left);
  3701. Check_default.typeOf.object("right", right);
  3702. Check_default.typeOf.object("result", result);
  3703. result.x = left.x - right.x;
  3704. result.y = left.y - right.y;
  3705. result.z = left.z - right.z;
  3706. result.w = left.w - right.w;
  3707. return result;
  3708. };
  3709. Cartesian4.multiplyByScalar = function(cartesian11, scalar, result) {
  3710. Check_default.typeOf.object("cartesian", cartesian11);
  3711. Check_default.typeOf.number("scalar", scalar);
  3712. Check_default.typeOf.object("result", result);
  3713. result.x = cartesian11.x * scalar;
  3714. result.y = cartesian11.y * scalar;
  3715. result.z = cartesian11.z * scalar;
  3716. result.w = cartesian11.w * scalar;
  3717. return result;
  3718. };
  3719. Cartesian4.divideByScalar = function(cartesian11, scalar, result) {
  3720. Check_default.typeOf.object("cartesian", cartesian11);
  3721. Check_default.typeOf.number("scalar", scalar);
  3722. Check_default.typeOf.object("result", result);
  3723. result.x = cartesian11.x / scalar;
  3724. result.y = cartesian11.y / scalar;
  3725. result.z = cartesian11.z / scalar;
  3726. result.w = cartesian11.w / scalar;
  3727. return result;
  3728. };
  3729. Cartesian4.negate = function(cartesian11, result) {
  3730. Check_default.typeOf.object("cartesian", cartesian11);
  3731. Check_default.typeOf.object("result", result);
  3732. result.x = -cartesian11.x;
  3733. result.y = -cartesian11.y;
  3734. result.z = -cartesian11.z;
  3735. result.w = -cartesian11.w;
  3736. return result;
  3737. };
  3738. Cartesian4.abs = function(cartesian11, result) {
  3739. Check_default.typeOf.object("cartesian", cartesian11);
  3740. Check_default.typeOf.object("result", result);
  3741. result.x = Math.abs(cartesian11.x);
  3742. result.y = Math.abs(cartesian11.y);
  3743. result.z = Math.abs(cartesian11.z);
  3744. result.w = Math.abs(cartesian11.w);
  3745. return result;
  3746. };
  3747. var lerpScratch2 = new Cartesian4();
  3748. Cartesian4.lerp = function(start, end, t, result) {
  3749. Check_default.typeOf.object("start", start);
  3750. Check_default.typeOf.object("end", end);
  3751. Check_default.typeOf.number("t", t);
  3752. Check_default.typeOf.object("result", result);
  3753. Cartesian4.multiplyByScalar(end, t, lerpScratch2);
  3754. result = Cartesian4.multiplyByScalar(start, 1 - t, result);
  3755. return Cartesian4.add(lerpScratch2, result, result);
  3756. };
  3757. var mostOrthogonalAxisScratch2 = new Cartesian4();
  3758. Cartesian4.mostOrthogonalAxis = function(cartesian11, result) {
  3759. Check_default.typeOf.object("cartesian", cartesian11);
  3760. Check_default.typeOf.object("result", result);
  3761. const f2 = Cartesian4.normalize(cartesian11, mostOrthogonalAxisScratch2);
  3762. Cartesian4.abs(f2, f2);
  3763. if (f2.x <= f2.y) {
  3764. if (f2.x <= f2.z) {
  3765. if (f2.x <= f2.w) {
  3766. result = Cartesian4.clone(Cartesian4.UNIT_X, result);
  3767. } else {
  3768. result = Cartesian4.clone(Cartesian4.UNIT_W, result);
  3769. }
  3770. } else if (f2.z <= f2.w) {
  3771. result = Cartesian4.clone(Cartesian4.UNIT_Z, result);
  3772. } else {
  3773. result = Cartesian4.clone(Cartesian4.UNIT_W, result);
  3774. }
  3775. } else if (f2.y <= f2.z) {
  3776. if (f2.y <= f2.w) {
  3777. result = Cartesian4.clone(Cartesian4.UNIT_Y, result);
  3778. } else {
  3779. result = Cartesian4.clone(Cartesian4.UNIT_W, result);
  3780. }
  3781. } else if (f2.z <= f2.w) {
  3782. result = Cartesian4.clone(Cartesian4.UNIT_Z, result);
  3783. } else {
  3784. result = Cartesian4.clone(Cartesian4.UNIT_W, result);
  3785. }
  3786. return result;
  3787. };
  3788. Cartesian4.equals = function(left, right) {
  3789. return left === right || defined_default(left) && defined_default(right) && left.x === right.x && left.y === right.y && left.z === right.z && left.w === right.w;
  3790. };
  3791. Cartesian4.equalsArray = function(cartesian11, array, offset2) {
  3792. return cartesian11.x === array[offset2] && cartesian11.y === array[offset2 + 1] && cartesian11.z === array[offset2 + 2] && cartesian11.w === array[offset2 + 3];
  3793. };
  3794. Cartesian4.equalsEpsilon = function(left, right, relativeEpsilon, absoluteEpsilon) {
  3795. return left === right || defined_default(left) && defined_default(right) && Math_default.equalsEpsilon(
  3796. left.x,
  3797. right.x,
  3798. relativeEpsilon,
  3799. absoluteEpsilon
  3800. ) && Math_default.equalsEpsilon(
  3801. left.y,
  3802. right.y,
  3803. relativeEpsilon,
  3804. absoluteEpsilon
  3805. ) && Math_default.equalsEpsilon(
  3806. left.z,
  3807. right.z,
  3808. relativeEpsilon,
  3809. absoluteEpsilon
  3810. ) && Math_default.equalsEpsilon(
  3811. left.w,
  3812. right.w,
  3813. relativeEpsilon,
  3814. absoluteEpsilon
  3815. );
  3816. };
  3817. Cartesian4.ZERO = Object.freeze(new Cartesian4(0, 0, 0, 0));
  3818. Cartesian4.ONE = Object.freeze(new Cartesian4(1, 1, 1, 1));
  3819. Cartesian4.UNIT_X = Object.freeze(new Cartesian4(1, 0, 0, 0));
  3820. Cartesian4.UNIT_Y = Object.freeze(new Cartesian4(0, 1, 0, 0));
  3821. Cartesian4.UNIT_Z = Object.freeze(new Cartesian4(0, 0, 1, 0));
  3822. Cartesian4.UNIT_W = Object.freeze(new Cartesian4(0, 0, 0, 1));
  3823. Cartesian4.prototype.clone = function(result) {
  3824. return Cartesian4.clone(this, result);
  3825. };
  3826. Cartesian4.prototype.equals = function(right) {
  3827. return Cartesian4.equals(this, right);
  3828. };
  3829. Cartesian4.prototype.equalsEpsilon = function(right, relativeEpsilon, absoluteEpsilon) {
  3830. return Cartesian4.equalsEpsilon(
  3831. this,
  3832. right,
  3833. relativeEpsilon,
  3834. absoluteEpsilon
  3835. );
  3836. };
  3837. Cartesian4.prototype.toString = function() {
  3838. return `(${this.x}, ${this.y}, ${this.z}, ${this.w})`;
  3839. };
  3840. var scratchF32Array = new Float32Array(1);
  3841. var scratchU8Array = new Uint8Array(scratchF32Array.buffer);
  3842. var testU32 = new Uint32Array([287454020]);
  3843. var testU8 = new Uint8Array(testU32.buffer);
  3844. var littleEndian = testU8[0] === 68;
  3845. Cartesian4.packFloat = function(value, result) {
  3846. Check_default.typeOf.number("value", value);
  3847. if (!defined_default(result)) {
  3848. result = new Cartesian4();
  3849. }
  3850. scratchF32Array[0] = value;
  3851. if (littleEndian) {
  3852. result.x = scratchU8Array[0];
  3853. result.y = scratchU8Array[1];
  3854. result.z = scratchU8Array[2];
  3855. result.w = scratchU8Array[3];
  3856. } else {
  3857. result.x = scratchU8Array[3];
  3858. result.y = scratchU8Array[2];
  3859. result.z = scratchU8Array[1];
  3860. result.w = scratchU8Array[0];
  3861. }
  3862. return result;
  3863. };
  3864. Cartesian4.unpackFloat = function(packedFloat) {
  3865. Check_default.typeOf.object("packedFloat", packedFloat);
  3866. if (littleEndian) {
  3867. scratchU8Array[0] = packedFloat.x;
  3868. scratchU8Array[1] = packedFloat.y;
  3869. scratchU8Array[2] = packedFloat.z;
  3870. scratchU8Array[3] = packedFloat.w;
  3871. } else {
  3872. scratchU8Array[0] = packedFloat.w;
  3873. scratchU8Array[1] = packedFloat.z;
  3874. scratchU8Array[2] = packedFloat.y;
  3875. scratchU8Array[3] = packedFloat.x;
  3876. }
  3877. return scratchF32Array[0];
  3878. };
  3879. var Cartesian4_default = Cartesian4;
  3880. // node_modules/cesium/Source/Core/RuntimeError.js
  3881. function RuntimeError(message) {
  3882. this.name = "RuntimeError";
  3883. this.message = message;
  3884. let stack;
  3885. try {
  3886. throw new Error();
  3887. } catch (e2) {
  3888. stack = e2.stack;
  3889. }
  3890. this.stack = stack;
  3891. }
  3892. if (defined_default(Object.create)) {
  3893. RuntimeError.prototype = Object.create(Error.prototype);
  3894. RuntimeError.prototype.constructor = RuntimeError;
  3895. }
  3896. RuntimeError.prototype.toString = function() {
  3897. let str = `${this.name}: ${this.message}`;
  3898. if (defined_default(this.stack)) {
  3899. str += `
  3900. ${this.stack.toString()}`;
  3901. }
  3902. return str;
  3903. };
  3904. var RuntimeError_default = RuntimeError;
  3905. // node_modules/cesium/Source/Core/Matrix4.js
  3906. function Matrix4(column0Row0, column1Row0, column2Row0, column3Row0, column0Row1, column1Row1, column2Row1, column3Row1, column0Row2, column1Row2, column2Row2, column3Row2, column0Row3, column1Row3, column2Row3, column3Row3) {
  3907. this[0] = defaultValue_default(column0Row0, 0);
  3908. this[1] = defaultValue_default(column0Row1, 0);
  3909. this[2] = defaultValue_default(column0Row2, 0);
  3910. this[3] = defaultValue_default(column0Row3, 0);
  3911. this[4] = defaultValue_default(column1Row0, 0);
  3912. this[5] = defaultValue_default(column1Row1, 0);
  3913. this[6] = defaultValue_default(column1Row2, 0);
  3914. this[7] = defaultValue_default(column1Row3, 0);
  3915. this[8] = defaultValue_default(column2Row0, 0);
  3916. this[9] = defaultValue_default(column2Row1, 0);
  3917. this[10] = defaultValue_default(column2Row2, 0);
  3918. this[11] = defaultValue_default(column2Row3, 0);
  3919. this[12] = defaultValue_default(column3Row0, 0);
  3920. this[13] = defaultValue_default(column3Row1, 0);
  3921. this[14] = defaultValue_default(column3Row2, 0);
  3922. this[15] = defaultValue_default(column3Row3, 0);
  3923. }
  3924. Matrix4.packedLength = 16;
  3925. Matrix4.pack = function(value, array, startingIndex) {
  3926. Check_default.typeOf.object("value", value);
  3927. Check_default.defined("array", array);
  3928. startingIndex = defaultValue_default(startingIndex, 0);
  3929. array[startingIndex++] = value[0];
  3930. array[startingIndex++] = value[1];
  3931. array[startingIndex++] = value[2];
  3932. array[startingIndex++] = value[3];
  3933. array[startingIndex++] = value[4];
  3934. array[startingIndex++] = value[5];
  3935. array[startingIndex++] = value[6];
  3936. array[startingIndex++] = value[7];
  3937. array[startingIndex++] = value[8];
  3938. array[startingIndex++] = value[9];
  3939. array[startingIndex++] = value[10];
  3940. array[startingIndex++] = value[11];
  3941. array[startingIndex++] = value[12];
  3942. array[startingIndex++] = value[13];
  3943. array[startingIndex++] = value[14];
  3944. array[startingIndex] = value[15];
  3945. return array;
  3946. };
  3947. Matrix4.unpack = function(array, startingIndex, result) {
  3948. Check_default.defined("array", array);
  3949. startingIndex = defaultValue_default(startingIndex, 0);
  3950. if (!defined_default(result)) {
  3951. result = new Matrix4();
  3952. }
  3953. result[0] = array[startingIndex++];
  3954. result[1] = array[startingIndex++];
  3955. result[2] = array[startingIndex++];
  3956. result[3] = array[startingIndex++];
  3957. result[4] = array[startingIndex++];
  3958. result[5] = array[startingIndex++];
  3959. result[6] = array[startingIndex++];
  3960. result[7] = array[startingIndex++];
  3961. result[8] = array[startingIndex++];
  3962. result[9] = array[startingIndex++];
  3963. result[10] = array[startingIndex++];
  3964. result[11] = array[startingIndex++];
  3965. result[12] = array[startingIndex++];
  3966. result[13] = array[startingIndex++];
  3967. result[14] = array[startingIndex++];
  3968. result[15] = array[startingIndex];
  3969. return result;
  3970. };
  3971. Matrix4.packArray = function(array, result) {
  3972. Check_default.defined("array", array);
  3973. const length3 = array.length;
  3974. const resultLength = length3 * 16;
  3975. if (!defined_default(result)) {
  3976. result = new Array(resultLength);
  3977. } else if (!Array.isArray(result) && result.length !== resultLength) {
  3978. throw new DeveloperError_default(
  3979. "If result is a typed array, it must have exactly array.length * 16 elements"
  3980. );
  3981. } else if (result.length !== resultLength) {
  3982. result.length = resultLength;
  3983. }
  3984. for (let i2 = 0; i2 < length3; ++i2) {
  3985. Matrix4.pack(array[i2], result, i2 * 16);
  3986. }
  3987. return result;
  3988. };
  3989. Matrix4.unpackArray = function(array, result) {
  3990. Check_default.defined("array", array);
  3991. Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 16);
  3992. if (array.length % 16 !== 0) {
  3993. throw new DeveloperError_default("array length must be a multiple of 16.");
  3994. }
  3995. const length3 = array.length;
  3996. if (!defined_default(result)) {
  3997. result = new Array(length3 / 16);
  3998. } else {
  3999. result.length = length3 / 16;
  4000. }
  4001. for (let i2 = 0; i2 < length3; i2 += 16) {
  4002. const index2 = i2 / 16;
  4003. result[index2] = Matrix4.unpack(array, i2, result[index2]);
  4004. }
  4005. return result;
  4006. };
  4007. Matrix4.clone = function(matrix, result) {
  4008. if (!defined_default(matrix)) {
  4009. return void 0;
  4010. }
  4011. if (!defined_default(result)) {
  4012. return new Matrix4(
  4013. matrix[0],
  4014. matrix[4],
  4015. matrix[8],
  4016. matrix[12],
  4017. matrix[1],
  4018. matrix[5],
  4019. matrix[9],
  4020. matrix[13],
  4021. matrix[2],
  4022. matrix[6],
  4023. matrix[10],
  4024. matrix[14],
  4025. matrix[3],
  4026. matrix[7],
  4027. matrix[11],
  4028. matrix[15]
  4029. );
  4030. }
  4031. result[0] = matrix[0];
  4032. result[1] = matrix[1];
  4033. result[2] = matrix[2];
  4034. result[3] = matrix[3];
  4035. result[4] = matrix[4];
  4036. result[5] = matrix[5];
  4037. result[6] = matrix[6];
  4038. result[7] = matrix[7];
  4039. result[8] = matrix[8];
  4040. result[9] = matrix[9];
  4041. result[10] = matrix[10];
  4042. result[11] = matrix[11];
  4043. result[12] = matrix[12];
  4044. result[13] = matrix[13];
  4045. result[14] = matrix[14];
  4046. result[15] = matrix[15];
  4047. return result;
  4048. };
  4049. Matrix4.fromArray = Matrix4.unpack;
  4050. Matrix4.fromColumnMajorArray = function(values, result) {
  4051. Check_default.defined("values", values);
  4052. return Matrix4.clone(values, result);
  4053. };
  4054. Matrix4.fromRowMajorArray = function(values, result) {
  4055. Check_default.defined("values", values);
  4056. if (!defined_default(result)) {
  4057. return new Matrix4(
  4058. values[0],
  4059. values[1],
  4060. values[2],
  4061. values[3],
  4062. values[4],
  4063. values[5],
  4064. values[6],
  4065. values[7],
  4066. values[8],
  4067. values[9],
  4068. values[10],
  4069. values[11],
  4070. values[12],
  4071. values[13],
  4072. values[14],
  4073. values[15]
  4074. );
  4075. }
  4076. result[0] = values[0];
  4077. result[1] = values[4];
  4078. result[2] = values[8];
  4079. result[3] = values[12];
  4080. result[4] = values[1];
  4081. result[5] = values[5];
  4082. result[6] = values[9];
  4083. result[7] = values[13];
  4084. result[8] = values[2];
  4085. result[9] = values[6];
  4086. result[10] = values[10];
  4087. result[11] = values[14];
  4088. result[12] = values[3];
  4089. result[13] = values[7];
  4090. result[14] = values[11];
  4091. result[15] = values[15];
  4092. return result;
  4093. };
  4094. Matrix4.fromRotationTranslation = function(rotation, translation3, result) {
  4095. Check_default.typeOf.object("rotation", rotation);
  4096. translation3 = defaultValue_default(translation3, Cartesian3_default.ZERO);
  4097. if (!defined_default(result)) {
  4098. return new Matrix4(
  4099. rotation[0],
  4100. rotation[3],
  4101. rotation[6],
  4102. translation3.x,
  4103. rotation[1],
  4104. rotation[4],
  4105. rotation[7],
  4106. translation3.y,
  4107. rotation[2],
  4108. rotation[5],
  4109. rotation[8],
  4110. translation3.z,
  4111. 0,
  4112. 0,
  4113. 0,
  4114. 1
  4115. );
  4116. }
  4117. result[0] = rotation[0];
  4118. result[1] = rotation[1];
  4119. result[2] = rotation[2];
  4120. result[3] = 0;
  4121. result[4] = rotation[3];
  4122. result[5] = rotation[4];
  4123. result[6] = rotation[5];
  4124. result[7] = 0;
  4125. result[8] = rotation[6];
  4126. result[9] = rotation[7];
  4127. result[10] = rotation[8];
  4128. result[11] = 0;
  4129. result[12] = translation3.x;
  4130. result[13] = translation3.y;
  4131. result[14] = translation3.z;
  4132. result[15] = 1;
  4133. return result;
  4134. };
  4135. Matrix4.fromTranslationQuaternionRotationScale = function(translation3, rotation, scale, result) {
  4136. Check_default.typeOf.object("translation", translation3);
  4137. Check_default.typeOf.object("rotation", rotation);
  4138. Check_default.typeOf.object("scale", scale);
  4139. if (!defined_default(result)) {
  4140. result = new Matrix4();
  4141. }
  4142. const scaleX = scale.x;
  4143. const scaleY = scale.y;
  4144. const scaleZ = scale.z;
  4145. const x2 = rotation.x * rotation.x;
  4146. const xy = rotation.x * rotation.y;
  4147. const xz = rotation.x * rotation.z;
  4148. const xw = rotation.x * rotation.w;
  4149. const y2 = rotation.y * rotation.y;
  4150. const yz = rotation.y * rotation.z;
  4151. const yw = rotation.y * rotation.w;
  4152. const z2 = rotation.z * rotation.z;
  4153. const zw = rotation.z * rotation.w;
  4154. const w2 = rotation.w * rotation.w;
  4155. const m00 = x2 - y2 - z2 + w2;
  4156. const m01 = 2 * (xy - zw);
  4157. const m02 = 2 * (xz + yw);
  4158. const m10 = 2 * (xy + zw);
  4159. const m11 = -x2 + y2 - z2 + w2;
  4160. const m12 = 2 * (yz - xw);
  4161. const m20 = 2 * (xz - yw);
  4162. const m21 = 2 * (yz + xw);
  4163. const m22 = -x2 - y2 + z2 + w2;
  4164. result[0] = m00 * scaleX;
  4165. result[1] = m10 * scaleX;
  4166. result[2] = m20 * scaleX;
  4167. result[3] = 0;
  4168. result[4] = m01 * scaleY;
  4169. result[5] = m11 * scaleY;
  4170. result[6] = m21 * scaleY;
  4171. result[7] = 0;
  4172. result[8] = m02 * scaleZ;
  4173. result[9] = m12 * scaleZ;
  4174. result[10] = m22 * scaleZ;
  4175. result[11] = 0;
  4176. result[12] = translation3.x;
  4177. result[13] = translation3.y;
  4178. result[14] = translation3.z;
  4179. result[15] = 1;
  4180. return result;
  4181. };
  4182. Matrix4.fromTranslationRotationScale = function(translationRotationScale, result) {
  4183. Check_default.typeOf.object("translationRotationScale", translationRotationScale);
  4184. return Matrix4.fromTranslationQuaternionRotationScale(
  4185. translationRotationScale.translation,
  4186. translationRotationScale.rotation,
  4187. translationRotationScale.scale,
  4188. result
  4189. );
  4190. };
  4191. Matrix4.fromTranslation = function(translation3, result) {
  4192. Check_default.typeOf.object("translation", translation3);
  4193. return Matrix4.fromRotationTranslation(Matrix3_default.IDENTITY, translation3, result);
  4194. };
  4195. Matrix4.fromScale = function(scale, result) {
  4196. Check_default.typeOf.object("scale", scale);
  4197. if (!defined_default(result)) {
  4198. return new Matrix4(
  4199. scale.x,
  4200. 0,
  4201. 0,
  4202. 0,
  4203. 0,
  4204. scale.y,
  4205. 0,
  4206. 0,
  4207. 0,
  4208. 0,
  4209. scale.z,
  4210. 0,
  4211. 0,
  4212. 0,
  4213. 0,
  4214. 1
  4215. );
  4216. }
  4217. result[0] = scale.x;
  4218. result[1] = 0;
  4219. result[2] = 0;
  4220. result[3] = 0;
  4221. result[4] = 0;
  4222. result[5] = scale.y;
  4223. result[6] = 0;
  4224. result[7] = 0;
  4225. result[8] = 0;
  4226. result[9] = 0;
  4227. result[10] = scale.z;
  4228. result[11] = 0;
  4229. result[12] = 0;
  4230. result[13] = 0;
  4231. result[14] = 0;
  4232. result[15] = 1;
  4233. return result;
  4234. };
  4235. Matrix4.fromUniformScale = function(scale, result) {
  4236. Check_default.typeOf.number("scale", scale);
  4237. if (!defined_default(result)) {
  4238. return new Matrix4(
  4239. scale,
  4240. 0,
  4241. 0,
  4242. 0,
  4243. 0,
  4244. scale,
  4245. 0,
  4246. 0,
  4247. 0,
  4248. 0,
  4249. scale,
  4250. 0,
  4251. 0,
  4252. 0,
  4253. 0,
  4254. 1
  4255. );
  4256. }
  4257. result[0] = scale;
  4258. result[1] = 0;
  4259. result[2] = 0;
  4260. result[3] = 0;
  4261. result[4] = 0;
  4262. result[5] = scale;
  4263. result[6] = 0;
  4264. result[7] = 0;
  4265. result[8] = 0;
  4266. result[9] = 0;
  4267. result[10] = scale;
  4268. result[11] = 0;
  4269. result[12] = 0;
  4270. result[13] = 0;
  4271. result[14] = 0;
  4272. result[15] = 1;
  4273. return result;
  4274. };
  4275. Matrix4.fromRotation = function(rotation, result) {
  4276. Check_default.typeOf.object("rotation", rotation);
  4277. if (!defined_default(result)) {
  4278. result = new Matrix4();
  4279. }
  4280. result[0] = rotation[0];
  4281. result[1] = rotation[1];
  4282. result[2] = rotation[2];
  4283. result[3] = 0;
  4284. result[4] = rotation[3];
  4285. result[5] = rotation[4];
  4286. result[6] = rotation[5];
  4287. result[7] = 0;
  4288. result[8] = rotation[6];
  4289. result[9] = rotation[7];
  4290. result[10] = rotation[8];
  4291. result[11] = 0;
  4292. result[12] = 0;
  4293. result[13] = 0;
  4294. result[14] = 0;
  4295. result[15] = 1;
  4296. return result;
  4297. };
  4298. var fromCameraF = new Cartesian3_default();
  4299. var fromCameraR = new Cartesian3_default();
  4300. var fromCameraU = new Cartesian3_default();
  4301. Matrix4.fromCamera = function(camera, result) {
  4302. Check_default.typeOf.object("camera", camera);
  4303. const position = camera.position;
  4304. const direction2 = camera.direction;
  4305. const up = camera.up;
  4306. Check_default.typeOf.object("camera.position", position);
  4307. Check_default.typeOf.object("camera.direction", direction2);
  4308. Check_default.typeOf.object("camera.up", up);
  4309. Cartesian3_default.normalize(direction2, fromCameraF);
  4310. Cartesian3_default.normalize(
  4311. Cartesian3_default.cross(fromCameraF, up, fromCameraR),
  4312. fromCameraR
  4313. );
  4314. Cartesian3_default.normalize(
  4315. Cartesian3_default.cross(fromCameraR, fromCameraF, fromCameraU),
  4316. fromCameraU
  4317. );
  4318. const sX = fromCameraR.x;
  4319. const sY = fromCameraR.y;
  4320. const sZ = fromCameraR.z;
  4321. const fX = fromCameraF.x;
  4322. const fY = fromCameraF.y;
  4323. const fZ = fromCameraF.z;
  4324. const uX = fromCameraU.x;
  4325. const uY = fromCameraU.y;
  4326. const uZ = fromCameraU.z;
  4327. const positionX = position.x;
  4328. const positionY = position.y;
  4329. const positionZ = position.z;
  4330. const t0 = sX * -positionX + sY * -positionY + sZ * -positionZ;
  4331. const t1 = uX * -positionX + uY * -positionY + uZ * -positionZ;
  4332. const t2 = fX * positionX + fY * positionY + fZ * positionZ;
  4333. if (!defined_default(result)) {
  4334. return new Matrix4(
  4335. sX,
  4336. sY,
  4337. sZ,
  4338. t0,
  4339. uX,
  4340. uY,
  4341. uZ,
  4342. t1,
  4343. -fX,
  4344. -fY,
  4345. -fZ,
  4346. t2,
  4347. 0,
  4348. 0,
  4349. 0,
  4350. 1
  4351. );
  4352. }
  4353. result[0] = sX;
  4354. result[1] = uX;
  4355. result[2] = -fX;
  4356. result[3] = 0;
  4357. result[4] = sY;
  4358. result[5] = uY;
  4359. result[6] = -fY;
  4360. result[7] = 0;
  4361. result[8] = sZ;
  4362. result[9] = uZ;
  4363. result[10] = -fZ;
  4364. result[11] = 0;
  4365. result[12] = t0;
  4366. result[13] = t1;
  4367. result[14] = t2;
  4368. result[15] = 1;
  4369. return result;
  4370. };
  4371. Matrix4.computePerspectiveFieldOfView = function(fovY, aspectRatio, near, far, result) {
  4372. Check_default.typeOf.number.greaterThan("fovY", fovY, 0);
  4373. Check_default.typeOf.number.lessThan("fovY", fovY, Math.PI);
  4374. Check_default.typeOf.number.greaterThan("near", near, 0);
  4375. Check_default.typeOf.number.greaterThan("far", far, 0);
  4376. Check_default.typeOf.object("result", result);
  4377. const bottom = Math.tan(fovY * 0.5);
  4378. const column1Row1 = 1 / bottom;
  4379. const column0Row0 = column1Row1 / aspectRatio;
  4380. const column2Row2 = (far + near) / (near - far);
  4381. const column3Row2 = 2 * far * near / (near - far);
  4382. result[0] = column0Row0;
  4383. result[1] = 0;
  4384. result[2] = 0;
  4385. result[3] = 0;
  4386. result[4] = 0;
  4387. result[5] = column1Row1;
  4388. result[6] = 0;
  4389. result[7] = 0;
  4390. result[8] = 0;
  4391. result[9] = 0;
  4392. result[10] = column2Row2;
  4393. result[11] = -1;
  4394. result[12] = 0;
  4395. result[13] = 0;
  4396. result[14] = column3Row2;
  4397. result[15] = 0;
  4398. return result;
  4399. };
  4400. Matrix4.computeOrthographicOffCenter = function(left, right, bottom, top, near, far, result) {
  4401. Check_default.typeOf.number("left", left);
  4402. Check_default.typeOf.number("right", right);
  4403. Check_default.typeOf.number("bottom", bottom);
  4404. Check_default.typeOf.number("top", top);
  4405. Check_default.typeOf.number("near", near);
  4406. Check_default.typeOf.number("far", far);
  4407. Check_default.typeOf.object("result", result);
  4408. let a4 = 1 / (right - left);
  4409. let b = 1 / (top - bottom);
  4410. let c14 = 1 / (far - near);
  4411. const tx = -(right + left) * a4;
  4412. const ty = -(top + bottom) * b;
  4413. const tz = -(far + near) * c14;
  4414. a4 *= 2;
  4415. b *= 2;
  4416. c14 *= -2;
  4417. result[0] = a4;
  4418. result[1] = 0;
  4419. result[2] = 0;
  4420. result[3] = 0;
  4421. result[4] = 0;
  4422. result[5] = b;
  4423. result[6] = 0;
  4424. result[7] = 0;
  4425. result[8] = 0;
  4426. result[9] = 0;
  4427. result[10] = c14;
  4428. result[11] = 0;
  4429. result[12] = tx;
  4430. result[13] = ty;
  4431. result[14] = tz;
  4432. result[15] = 1;
  4433. return result;
  4434. };
  4435. Matrix4.computePerspectiveOffCenter = function(left, right, bottom, top, near, far, result) {
  4436. Check_default.typeOf.number("left", left);
  4437. Check_default.typeOf.number("right", right);
  4438. Check_default.typeOf.number("bottom", bottom);
  4439. Check_default.typeOf.number("top", top);
  4440. Check_default.typeOf.number("near", near);
  4441. Check_default.typeOf.number("far", far);
  4442. Check_default.typeOf.object("result", result);
  4443. const column0Row0 = 2 * near / (right - left);
  4444. const column1Row1 = 2 * near / (top - bottom);
  4445. const column2Row0 = (right + left) / (right - left);
  4446. const column2Row1 = (top + bottom) / (top - bottom);
  4447. const column2Row2 = -(far + near) / (far - near);
  4448. const column2Row3 = -1;
  4449. const column3Row2 = -2 * far * near / (far - near);
  4450. result[0] = column0Row0;
  4451. result[1] = 0;
  4452. result[2] = 0;
  4453. result[3] = 0;
  4454. result[4] = 0;
  4455. result[5] = column1Row1;
  4456. result[6] = 0;
  4457. result[7] = 0;
  4458. result[8] = column2Row0;
  4459. result[9] = column2Row1;
  4460. result[10] = column2Row2;
  4461. result[11] = column2Row3;
  4462. result[12] = 0;
  4463. result[13] = 0;
  4464. result[14] = column3Row2;
  4465. result[15] = 0;
  4466. return result;
  4467. };
  4468. Matrix4.computeInfinitePerspectiveOffCenter = function(left, right, bottom, top, near, result) {
  4469. Check_default.typeOf.number("left", left);
  4470. Check_default.typeOf.number("right", right);
  4471. Check_default.typeOf.number("bottom", bottom);
  4472. Check_default.typeOf.number("top", top);
  4473. Check_default.typeOf.number("near", near);
  4474. Check_default.typeOf.object("result", result);
  4475. const column0Row0 = 2 * near / (right - left);
  4476. const column1Row1 = 2 * near / (top - bottom);
  4477. const column2Row0 = (right + left) / (right - left);
  4478. const column2Row1 = (top + bottom) / (top - bottom);
  4479. const column2Row2 = -1;
  4480. const column2Row3 = -1;
  4481. const column3Row2 = -2 * near;
  4482. result[0] = column0Row0;
  4483. result[1] = 0;
  4484. result[2] = 0;
  4485. result[3] = 0;
  4486. result[4] = 0;
  4487. result[5] = column1Row1;
  4488. result[6] = 0;
  4489. result[7] = 0;
  4490. result[8] = column2Row0;
  4491. result[9] = column2Row1;
  4492. result[10] = column2Row2;
  4493. result[11] = column2Row3;
  4494. result[12] = 0;
  4495. result[13] = 0;
  4496. result[14] = column3Row2;
  4497. result[15] = 0;
  4498. return result;
  4499. };
  4500. Matrix4.computeViewportTransformation = function(viewport, nearDepthRange, farDepthRange, result) {
  4501. if (!defined_default(result)) {
  4502. result = new Matrix4();
  4503. }
  4504. viewport = defaultValue_default(viewport, defaultValue_default.EMPTY_OBJECT);
  4505. const x = defaultValue_default(viewport.x, 0);
  4506. const y = defaultValue_default(viewport.y, 0);
  4507. const width = defaultValue_default(viewport.width, 0);
  4508. const height = defaultValue_default(viewport.height, 0);
  4509. nearDepthRange = defaultValue_default(nearDepthRange, 0);
  4510. farDepthRange = defaultValue_default(farDepthRange, 1);
  4511. const halfWidth = width * 0.5;
  4512. const halfHeight = height * 0.5;
  4513. const halfDepth = (farDepthRange - nearDepthRange) * 0.5;
  4514. const column0Row0 = halfWidth;
  4515. const column1Row1 = halfHeight;
  4516. const column2Row2 = halfDepth;
  4517. const column3Row0 = x + halfWidth;
  4518. const column3Row1 = y + halfHeight;
  4519. const column3Row2 = nearDepthRange + halfDepth;
  4520. const column3Row3 = 1;
  4521. result[0] = column0Row0;
  4522. result[1] = 0;
  4523. result[2] = 0;
  4524. result[3] = 0;
  4525. result[4] = 0;
  4526. result[5] = column1Row1;
  4527. result[6] = 0;
  4528. result[7] = 0;
  4529. result[8] = 0;
  4530. result[9] = 0;
  4531. result[10] = column2Row2;
  4532. result[11] = 0;
  4533. result[12] = column3Row0;
  4534. result[13] = column3Row1;
  4535. result[14] = column3Row2;
  4536. result[15] = column3Row3;
  4537. return result;
  4538. };
  4539. Matrix4.computeView = function(position, direction2, up, right, result) {
  4540. Check_default.typeOf.object("position", position);
  4541. Check_default.typeOf.object("direction", direction2);
  4542. Check_default.typeOf.object("up", up);
  4543. Check_default.typeOf.object("right", right);
  4544. Check_default.typeOf.object("result", result);
  4545. result[0] = right.x;
  4546. result[1] = up.x;
  4547. result[2] = -direction2.x;
  4548. result[3] = 0;
  4549. result[4] = right.y;
  4550. result[5] = up.y;
  4551. result[6] = -direction2.y;
  4552. result[7] = 0;
  4553. result[8] = right.z;
  4554. result[9] = up.z;
  4555. result[10] = -direction2.z;
  4556. result[11] = 0;
  4557. result[12] = -Cartesian3_default.dot(right, position);
  4558. result[13] = -Cartesian3_default.dot(up, position);
  4559. result[14] = Cartesian3_default.dot(direction2, position);
  4560. result[15] = 1;
  4561. return result;
  4562. };
  4563. Matrix4.toArray = function(matrix, result) {
  4564. Check_default.typeOf.object("matrix", matrix);
  4565. if (!defined_default(result)) {
  4566. return [
  4567. matrix[0],
  4568. matrix[1],
  4569. matrix[2],
  4570. matrix[3],
  4571. matrix[4],
  4572. matrix[5],
  4573. matrix[6],
  4574. matrix[7],
  4575. matrix[8],
  4576. matrix[9],
  4577. matrix[10],
  4578. matrix[11],
  4579. matrix[12],
  4580. matrix[13],
  4581. matrix[14],
  4582. matrix[15]
  4583. ];
  4584. }
  4585. result[0] = matrix[0];
  4586. result[1] = matrix[1];
  4587. result[2] = matrix[2];
  4588. result[3] = matrix[3];
  4589. result[4] = matrix[4];
  4590. result[5] = matrix[5];
  4591. result[6] = matrix[6];
  4592. result[7] = matrix[7];
  4593. result[8] = matrix[8];
  4594. result[9] = matrix[9];
  4595. result[10] = matrix[10];
  4596. result[11] = matrix[11];
  4597. result[12] = matrix[12];
  4598. result[13] = matrix[13];
  4599. result[14] = matrix[14];
  4600. result[15] = matrix[15];
  4601. return result;
  4602. };
  4603. Matrix4.getElementIndex = function(column, row) {
  4604. Check_default.typeOf.number.greaterThanOrEquals("row", row, 0);
  4605. Check_default.typeOf.number.lessThanOrEquals("row", row, 3);
  4606. Check_default.typeOf.number.greaterThanOrEquals("column", column, 0);
  4607. Check_default.typeOf.number.lessThanOrEquals("column", column, 3);
  4608. return column * 4 + row;
  4609. };
  4610. Matrix4.getColumn = function(matrix, index2, result) {
  4611. Check_default.typeOf.object("matrix", matrix);
  4612. Check_default.typeOf.number.greaterThanOrEquals("index", index2, 0);
  4613. Check_default.typeOf.number.lessThanOrEquals("index", index2, 3);
  4614. Check_default.typeOf.object("result", result);
  4615. const startIndex = index2 * 4;
  4616. const x = matrix[startIndex];
  4617. const y = matrix[startIndex + 1];
  4618. const z = matrix[startIndex + 2];
  4619. const w = matrix[startIndex + 3];
  4620. result.x = x;
  4621. result.y = y;
  4622. result.z = z;
  4623. result.w = w;
  4624. return result;
  4625. };
  4626. Matrix4.setColumn = function(matrix, index2, cartesian11, result) {
  4627. Check_default.typeOf.object("matrix", matrix);
  4628. Check_default.typeOf.number.greaterThanOrEquals("index", index2, 0);
  4629. Check_default.typeOf.number.lessThanOrEquals("index", index2, 3);
  4630. Check_default.typeOf.object("cartesian", cartesian11);
  4631. Check_default.typeOf.object("result", result);
  4632. result = Matrix4.clone(matrix, result);
  4633. const startIndex = index2 * 4;
  4634. result[startIndex] = cartesian11.x;
  4635. result[startIndex + 1] = cartesian11.y;
  4636. result[startIndex + 2] = cartesian11.z;
  4637. result[startIndex + 3] = cartesian11.w;
  4638. return result;
  4639. };
  4640. Matrix4.getRow = function(matrix, index2, result) {
  4641. Check_default.typeOf.object("matrix", matrix);
  4642. Check_default.typeOf.number.greaterThanOrEquals("index", index2, 0);
  4643. Check_default.typeOf.number.lessThanOrEquals("index", index2, 3);
  4644. Check_default.typeOf.object("result", result);
  4645. const x = matrix[index2];
  4646. const y = matrix[index2 + 4];
  4647. const z = matrix[index2 + 8];
  4648. const w = matrix[index2 + 12];
  4649. result.x = x;
  4650. result.y = y;
  4651. result.z = z;
  4652. result.w = w;
  4653. return result;
  4654. };
  4655. Matrix4.setRow = function(matrix, index2, cartesian11, result) {
  4656. Check_default.typeOf.object("matrix", matrix);
  4657. Check_default.typeOf.number.greaterThanOrEquals("index", index2, 0);
  4658. Check_default.typeOf.number.lessThanOrEquals("index", index2, 3);
  4659. Check_default.typeOf.object("cartesian", cartesian11);
  4660. Check_default.typeOf.object("result", result);
  4661. result = Matrix4.clone(matrix, result);
  4662. result[index2] = cartesian11.x;
  4663. result[index2 + 4] = cartesian11.y;
  4664. result[index2 + 8] = cartesian11.z;
  4665. result[index2 + 12] = cartesian11.w;
  4666. return result;
  4667. };
  4668. Matrix4.setTranslation = function(matrix, translation3, result) {
  4669. Check_default.typeOf.object("matrix", matrix);
  4670. Check_default.typeOf.object("translation", translation3);
  4671. Check_default.typeOf.object("result", result);
  4672. result[0] = matrix[0];
  4673. result[1] = matrix[1];
  4674. result[2] = matrix[2];
  4675. result[3] = matrix[3];
  4676. result[4] = matrix[4];
  4677. result[5] = matrix[5];
  4678. result[6] = matrix[6];
  4679. result[7] = matrix[7];
  4680. result[8] = matrix[8];
  4681. result[9] = matrix[9];
  4682. result[10] = matrix[10];
  4683. result[11] = matrix[11];
  4684. result[12] = translation3.x;
  4685. result[13] = translation3.y;
  4686. result[14] = translation3.z;
  4687. result[15] = matrix[15];
  4688. return result;
  4689. };
  4690. var scaleScratch12 = new Cartesian3_default();
  4691. Matrix4.setScale = function(matrix, scale, result) {
  4692. Check_default.typeOf.object("matrix", matrix);
  4693. Check_default.typeOf.object("scale", scale);
  4694. Check_default.typeOf.object("result", result);
  4695. const existingScale = Matrix4.getScale(matrix, scaleScratch12);
  4696. const scaleRatioX = scale.x / existingScale.x;
  4697. const scaleRatioY = scale.y / existingScale.y;
  4698. const scaleRatioZ = scale.z / existingScale.z;
  4699. result[0] = matrix[0] * scaleRatioX;
  4700. result[1] = matrix[1] * scaleRatioX;
  4701. result[2] = matrix[2] * scaleRatioX;
  4702. result[3] = matrix[3];
  4703. result[4] = matrix[4] * scaleRatioY;
  4704. result[5] = matrix[5] * scaleRatioY;
  4705. result[6] = matrix[6] * scaleRatioY;
  4706. result[7] = matrix[7];
  4707. result[8] = matrix[8] * scaleRatioZ;
  4708. result[9] = matrix[9] * scaleRatioZ;
  4709. result[10] = matrix[10] * scaleRatioZ;
  4710. result[11] = matrix[11];
  4711. result[12] = matrix[12];
  4712. result[13] = matrix[13];
  4713. result[14] = matrix[14];
  4714. result[15] = matrix[15];
  4715. return result;
  4716. };
  4717. var scaleScratch22 = new Cartesian3_default();
  4718. Matrix4.setUniformScale = function(matrix, scale, result) {
  4719. Check_default.typeOf.object("matrix", matrix);
  4720. Check_default.typeOf.number("scale", scale);
  4721. Check_default.typeOf.object("result", result);
  4722. const existingScale = Matrix4.getScale(matrix, scaleScratch22);
  4723. const scaleRatioX = scale / existingScale.x;
  4724. const scaleRatioY = scale / existingScale.y;
  4725. const scaleRatioZ = scale / existingScale.z;
  4726. result[0] = matrix[0] * scaleRatioX;
  4727. result[1] = matrix[1] * scaleRatioX;
  4728. result[2] = matrix[2] * scaleRatioX;
  4729. result[3] = matrix[3];
  4730. result[4] = matrix[4] * scaleRatioY;
  4731. result[5] = matrix[5] * scaleRatioY;
  4732. result[6] = matrix[6] * scaleRatioY;
  4733. result[7] = matrix[7];
  4734. result[8] = matrix[8] * scaleRatioZ;
  4735. result[9] = matrix[9] * scaleRatioZ;
  4736. result[10] = matrix[10] * scaleRatioZ;
  4737. result[11] = matrix[11];
  4738. result[12] = matrix[12];
  4739. result[13] = matrix[13];
  4740. result[14] = matrix[14];
  4741. result[15] = matrix[15];
  4742. return result;
  4743. };
  4744. var scratchColumn2 = new Cartesian3_default();
  4745. Matrix4.getScale = function(matrix, result) {
  4746. Check_default.typeOf.object("matrix", matrix);
  4747. Check_default.typeOf.object("result", result);
  4748. result.x = Cartesian3_default.magnitude(
  4749. Cartesian3_default.fromElements(matrix[0], matrix[1], matrix[2], scratchColumn2)
  4750. );
  4751. result.y = Cartesian3_default.magnitude(
  4752. Cartesian3_default.fromElements(matrix[4], matrix[5], matrix[6], scratchColumn2)
  4753. );
  4754. result.z = Cartesian3_default.magnitude(
  4755. Cartesian3_default.fromElements(matrix[8], matrix[9], matrix[10], scratchColumn2)
  4756. );
  4757. return result;
  4758. };
  4759. var scaleScratch32 = new Cartesian3_default();
  4760. Matrix4.getMaximumScale = function(matrix) {
  4761. Matrix4.getScale(matrix, scaleScratch32);
  4762. return Cartesian3_default.maximumComponent(scaleScratch32);
  4763. };
  4764. var scaleScratch42 = new Cartesian3_default();
  4765. Matrix4.setRotation = function(matrix, rotation, result) {
  4766. Check_default.typeOf.object("matrix", matrix);
  4767. Check_default.typeOf.object("result", result);
  4768. const scale = Matrix4.getScale(matrix, scaleScratch42);
  4769. result[0] = rotation[0] * scale.x;
  4770. result[1] = rotation[1] * scale.x;
  4771. result[2] = rotation[2] * scale.x;
  4772. result[3] = matrix[3];
  4773. result[4] = rotation[3] * scale.y;
  4774. result[5] = rotation[4] * scale.y;
  4775. result[6] = rotation[5] * scale.y;
  4776. result[7] = matrix[7];
  4777. result[8] = rotation[6] * scale.z;
  4778. result[9] = rotation[7] * scale.z;
  4779. result[10] = rotation[8] * scale.z;
  4780. result[11] = matrix[11];
  4781. result[12] = matrix[12];
  4782. result[13] = matrix[13];
  4783. result[14] = matrix[14];
  4784. result[15] = matrix[15];
  4785. return result;
  4786. };
  4787. var scaleScratch52 = new Cartesian3_default();
  4788. Matrix4.getRotation = function(matrix, result) {
  4789. Check_default.typeOf.object("matrix", matrix);
  4790. Check_default.typeOf.object("result", result);
  4791. const scale = Matrix4.getScale(matrix, scaleScratch52);
  4792. result[0] = matrix[0] / scale.x;
  4793. result[1] = matrix[1] / scale.x;
  4794. result[2] = matrix[2] / scale.x;
  4795. result[3] = matrix[4] / scale.y;
  4796. result[4] = matrix[5] / scale.y;
  4797. result[5] = matrix[6] / scale.y;
  4798. result[6] = matrix[8] / scale.z;
  4799. result[7] = matrix[9] / scale.z;
  4800. result[8] = matrix[10] / scale.z;
  4801. return result;
  4802. };
  4803. Matrix4.multiply = function(left, right, result) {
  4804. Check_default.typeOf.object("left", left);
  4805. Check_default.typeOf.object("right", right);
  4806. Check_default.typeOf.object("result", result);
  4807. const left0 = left[0];
  4808. const left1 = left[1];
  4809. const left2 = left[2];
  4810. const left3 = left[3];
  4811. const left4 = left[4];
  4812. const left5 = left[5];
  4813. const left6 = left[6];
  4814. const left7 = left[7];
  4815. const left8 = left[8];
  4816. const left9 = left[9];
  4817. const left10 = left[10];
  4818. const left11 = left[11];
  4819. const left12 = left[12];
  4820. const left13 = left[13];
  4821. const left14 = left[14];
  4822. const left15 = left[15];
  4823. const right0 = right[0];
  4824. const right1 = right[1];
  4825. const right2 = right[2];
  4826. const right3 = right[3];
  4827. const right4 = right[4];
  4828. const right5 = right[5];
  4829. const right6 = right[6];
  4830. const right7 = right[7];
  4831. const right8 = right[8];
  4832. const right9 = right[9];
  4833. const right10 = right[10];
  4834. const right11 = right[11];
  4835. const right12 = right[12];
  4836. const right13 = right[13];
  4837. const right14 = right[14];
  4838. const right15 = right[15];
  4839. const column0Row0 = left0 * right0 + left4 * right1 + left8 * right2 + left12 * right3;
  4840. const column0Row1 = left1 * right0 + left5 * right1 + left9 * right2 + left13 * right3;
  4841. const column0Row2 = left2 * right0 + left6 * right1 + left10 * right2 + left14 * right3;
  4842. const column0Row3 = left3 * right0 + left7 * right1 + left11 * right2 + left15 * right3;
  4843. const column1Row0 = left0 * right4 + left4 * right5 + left8 * right6 + left12 * right7;
  4844. const column1Row1 = left1 * right4 + left5 * right5 + left9 * right6 + left13 * right7;
  4845. const column1Row2 = left2 * right4 + left6 * right5 + left10 * right6 + left14 * right7;
  4846. const column1Row3 = left3 * right4 + left7 * right5 + left11 * right6 + left15 * right7;
  4847. const column2Row0 = left0 * right8 + left4 * right9 + left8 * right10 + left12 * right11;
  4848. const column2Row1 = left1 * right8 + left5 * right9 + left9 * right10 + left13 * right11;
  4849. const column2Row2 = left2 * right8 + left6 * right9 + left10 * right10 + left14 * right11;
  4850. const column2Row3 = left3 * right8 + left7 * right9 + left11 * right10 + left15 * right11;
  4851. const column3Row0 = left0 * right12 + left4 * right13 + left8 * right14 + left12 * right15;
  4852. const column3Row1 = left1 * right12 + left5 * right13 + left9 * right14 + left13 * right15;
  4853. const column3Row2 = left2 * right12 + left6 * right13 + left10 * right14 + left14 * right15;
  4854. const column3Row3 = left3 * right12 + left7 * right13 + left11 * right14 + left15 * right15;
  4855. result[0] = column0Row0;
  4856. result[1] = column0Row1;
  4857. result[2] = column0Row2;
  4858. result[3] = column0Row3;
  4859. result[4] = column1Row0;
  4860. result[5] = column1Row1;
  4861. result[6] = column1Row2;
  4862. result[7] = column1Row3;
  4863. result[8] = column2Row0;
  4864. result[9] = column2Row1;
  4865. result[10] = column2Row2;
  4866. result[11] = column2Row3;
  4867. result[12] = column3Row0;
  4868. result[13] = column3Row1;
  4869. result[14] = column3Row2;
  4870. result[15] = column3Row3;
  4871. return result;
  4872. };
  4873. Matrix4.add = function(left, right, result) {
  4874. Check_default.typeOf.object("left", left);
  4875. Check_default.typeOf.object("right", right);
  4876. Check_default.typeOf.object("result", result);
  4877. result[0] = left[0] + right[0];
  4878. result[1] = left[1] + right[1];
  4879. result[2] = left[2] + right[2];
  4880. result[3] = left[3] + right[3];
  4881. result[4] = left[4] + right[4];
  4882. result[5] = left[5] + right[5];
  4883. result[6] = left[6] + right[6];
  4884. result[7] = left[7] + right[7];
  4885. result[8] = left[8] + right[8];
  4886. result[9] = left[9] + right[9];
  4887. result[10] = left[10] + right[10];
  4888. result[11] = left[11] + right[11];
  4889. result[12] = left[12] + right[12];
  4890. result[13] = left[13] + right[13];
  4891. result[14] = left[14] + right[14];
  4892. result[15] = left[15] + right[15];
  4893. return result;
  4894. };
  4895. Matrix4.subtract = function(left, right, result) {
  4896. Check_default.typeOf.object("left", left);
  4897. Check_default.typeOf.object("right", right);
  4898. Check_default.typeOf.object("result", result);
  4899. result[0] = left[0] - right[0];
  4900. result[1] = left[1] - right[1];
  4901. result[2] = left[2] - right[2];
  4902. result[3] = left[3] - right[3];
  4903. result[4] = left[4] - right[4];
  4904. result[5] = left[5] - right[5];
  4905. result[6] = left[6] - right[6];
  4906. result[7] = left[7] - right[7];
  4907. result[8] = left[8] - right[8];
  4908. result[9] = left[9] - right[9];
  4909. result[10] = left[10] - right[10];
  4910. result[11] = left[11] - right[11];
  4911. result[12] = left[12] - right[12];
  4912. result[13] = left[13] - right[13];
  4913. result[14] = left[14] - right[14];
  4914. result[15] = left[15] - right[15];
  4915. return result;
  4916. };
  4917. Matrix4.multiplyTransformation = function(left, right, result) {
  4918. Check_default.typeOf.object("left", left);
  4919. Check_default.typeOf.object("right", right);
  4920. Check_default.typeOf.object("result", result);
  4921. const left0 = left[0];
  4922. const left1 = left[1];
  4923. const left2 = left[2];
  4924. const left4 = left[4];
  4925. const left5 = left[5];
  4926. const left6 = left[6];
  4927. const left8 = left[8];
  4928. const left9 = left[9];
  4929. const left10 = left[10];
  4930. const left12 = left[12];
  4931. const left13 = left[13];
  4932. const left14 = left[14];
  4933. const right0 = right[0];
  4934. const right1 = right[1];
  4935. const right2 = right[2];
  4936. const right4 = right[4];
  4937. const right5 = right[5];
  4938. const right6 = right[6];
  4939. const right8 = right[8];
  4940. const right9 = right[9];
  4941. const right10 = right[10];
  4942. const right12 = right[12];
  4943. const right13 = right[13];
  4944. const right14 = right[14];
  4945. const column0Row0 = left0 * right0 + left4 * right1 + left8 * right2;
  4946. const column0Row1 = left1 * right0 + left5 * right1 + left9 * right2;
  4947. const column0Row2 = left2 * right0 + left6 * right1 + left10 * right2;
  4948. const column1Row0 = left0 * right4 + left4 * right5 + left8 * right6;
  4949. const column1Row1 = left1 * right4 + left5 * right5 + left9 * right6;
  4950. const column1Row2 = left2 * right4 + left6 * right5 + left10 * right6;
  4951. const column2Row0 = left0 * right8 + left4 * right9 + left8 * right10;
  4952. const column2Row1 = left1 * right8 + left5 * right9 + left9 * right10;
  4953. const column2Row2 = left2 * right8 + left6 * right9 + left10 * right10;
  4954. const column3Row0 = left0 * right12 + left4 * right13 + left8 * right14 + left12;
  4955. const column3Row1 = left1 * right12 + left5 * right13 + left9 * right14 + left13;
  4956. const column3Row2 = left2 * right12 + left6 * right13 + left10 * right14 + left14;
  4957. result[0] = column0Row0;
  4958. result[1] = column0Row1;
  4959. result[2] = column0Row2;
  4960. result[3] = 0;
  4961. result[4] = column1Row0;
  4962. result[5] = column1Row1;
  4963. result[6] = column1Row2;
  4964. result[7] = 0;
  4965. result[8] = column2Row0;
  4966. result[9] = column2Row1;
  4967. result[10] = column2Row2;
  4968. result[11] = 0;
  4969. result[12] = column3Row0;
  4970. result[13] = column3Row1;
  4971. result[14] = column3Row2;
  4972. result[15] = 1;
  4973. return result;
  4974. };
  4975. Matrix4.multiplyByMatrix3 = function(matrix, rotation, result) {
  4976. Check_default.typeOf.object("matrix", matrix);
  4977. Check_default.typeOf.object("rotation", rotation);
  4978. Check_default.typeOf.object("result", result);
  4979. const left0 = matrix[0];
  4980. const left1 = matrix[1];
  4981. const left2 = matrix[2];
  4982. const left4 = matrix[4];
  4983. const left5 = matrix[5];
  4984. const left6 = matrix[6];
  4985. const left8 = matrix[8];
  4986. const left9 = matrix[9];
  4987. const left10 = matrix[10];
  4988. const right0 = rotation[0];
  4989. const right1 = rotation[1];
  4990. const right2 = rotation[2];
  4991. const right4 = rotation[3];
  4992. const right5 = rotation[4];
  4993. const right6 = rotation[5];
  4994. const right8 = rotation[6];
  4995. const right9 = rotation[7];
  4996. const right10 = rotation[8];
  4997. const column0Row0 = left0 * right0 + left4 * right1 + left8 * right2;
  4998. const column0Row1 = left1 * right0 + left5 * right1 + left9 * right2;
  4999. const column0Row2 = left2 * right0 + left6 * right1 + left10 * right2;
  5000. const column1Row0 = left0 * right4 + left4 * right5 + left8 * right6;
  5001. const column1Row1 = left1 * right4 + left5 * right5 + left9 * right6;
  5002. const column1Row2 = left2 * right4 + left6 * right5 + left10 * right6;
  5003. const column2Row0 = left0 * right8 + left4 * right9 + left8 * right10;
  5004. const column2Row1 = left1 * right8 + left5 * right9 + left9 * right10;
  5005. const column2Row2 = left2 * right8 + left6 * right9 + left10 * right10;
  5006. result[0] = column0Row0;
  5007. result[1] = column0Row1;
  5008. result[2] = column0Row2;
  5009. result[3] = 0;
  5010. result[4] = column1Row0;
  5011. result[5] = column1Row1;
  5012. result[6] = column1Row2;
  5013. result[7] = 0;
  5014. result[8] = column2Row0;
  5015. result[9] = column2Row1;
  5016. result[10] = column2Row2;
  5017. result[11] = 0;
  5018. result[12] = matrix[12];
  5019. result[13] = matrix[13];
  5020. result[14] = matrix[14];
  5021. result[15] = matrix[15];
  5022. return result;
  5023. };
  5024. Matrix4.multiplyByTranslation = function(matrix, translation3, result) {
  5025. Check_default.typeOf.object("matrix", matrix);
  5026. Check_default.typeOf.object("translation", translation3);
  5027. Check_default.typeOf.object("result", result);
  5028. const x = translation3.x;
  5029. const y = translation3.y;
  5030. const z = translation3.z;
  5031. const tx = x * matrix[0] + y * matrix[4] + z * matrix[8] + matrix[12];
  5032. const ty = x * matrix[1] + y * matrix[5] + z * matrix[9] + matrix[13];
  5033. const tz = x * matrix[2] + y * matrix[6] + z * matrix[10] + matrix[14];
  5034. result[0] = matrix[0];
  5035. result[1] = matrix[1];
  5036. result[2] = matrix[2];
  5037. result[3] = matrix[3];
  5038. result[4] = matrix[4];
  5039. result[5] = matrix[5];
  5040. result[6] = matrix[6];
  5041. result[7] = matrix[7];
  5042. result[8] = matrix[8];
  5043. result[9] = matrix[9];
  5044. result[10] = matrix[10];
  5045. result[11] = matrix[11];
  5046. result[12] = tx;
  5047. result[13] = ty;
  5048. result[14] = tz;
  5049. result[15] = matrix[15];
  5050. return result;
  5051. };
  5052. Matrix4.multiplyByScale = function(matrix, scale, result) {
  5053. Check_default.typeOf.object("matrix", matrix);
  5054. Check_default.typeOf.object("scale", scale);
  5055. Check_default.typeOf.object("result", result);
  5056. const scaleX = scale.x;
  5057. const scaleY = scale.y;
  5058. const scaleZ = scale.z;
  5059. if (scaleX === 1 && scaleY === 1 && scaleZ === 1) {
  5060. return Matrix4.clone(matrix, result);
  5061. }
  5062. result[0] = scaleX * matrix[0];
  5063. result[1] = scaleX * matrix[1];
  5064. result[2] = scaleX * matrix[2];
  5065. result[3] = matrix[3];
  5066. result[4] = scaleY * matrix[4];
  5067. result[5] = scaleY * matrix[5];
  5068. result[6] = scaleY * matrix[6];
  5069. result[7] = matrix[7];
  5070. result[8] = scaleZ * matrix[8];
  5071. result[9] = scaleZ * matrix[9];
  5072. result[10] = scaleZ * matrix[10];
  5073. result[11] = matrix[11];
  5074. result[12] = matrix[12];
  5075. result[13] = matrix[13];
  5076. result[14] = matrix[14];
  5077. result[15] = matrix[15];
  5078. return result;
  5079. };
  5080. Matrix4.multiplyByUniformScale = function(matrix, scale, result) {
  5081. Check_default.typeOf.object("matrix", matrix);
  5082. Check_default.typeOf.number("scale", scale);
  5083. Check_default.typeOf.object("result", result);
  5084. result[0] = matrix[0] * scale;
  5085. result[1] = matrix[1] * scale;
  5086. result[2] = matrix[2] * scale;
  5087. result[3] = matrix[3];
  5088. result[4] = matrix[4] * scale;
  5089. result[5] = matrix[5] * scale;
  5090. result[6] = matrix[6] * scale;
  5091. result[7] = matrix[7];
  5092. result[8] = matrix[8] * scale;
  5093. result[9] = matrix[9] * scale;
  5094. result[10] = matrix[10] * scale;
  5095. result[11] = matrix[11];
  5096. result[12] = matrix[12];
  5097. result[13] = matrix[13];
  5098. result[14] = matrix[14];
  5099. result[15] = matrix[15];
  5100. return result;
  5101. };
  5102. Matrix4.multiplyByVector = function(matrix, cartesian11, result) {
  5103. Check_default.typeOf.object("matrix", matrix);
  5104. Check_default.typeOf.object("cartesian", cartesian11);
  5105. Check_default.typeOf.object("result", result);
  5106. const vX = cartesian11.x;
  5107. const vY = cartesian11.y;
  5108. const vZ = cartesian11.z;
  5109. const vW = cartesian11.w;
  5110. const x = matrix[0] * vX + matrix[4] * vY + matrix[8] * vZ + matrix[12] * vW;
  5111. const y = matrix[1] * vX + matrix[5] * vY + matrix[9] * vZ + matrix[13] * vW;
  5112. const z = matrix[2] * vX + matrix[6] * vY + matrix[10] * vZ + matrix[14] * vW;
  5113. const w = matrix[3] * vX + matrix[7] * vY + matrix[11] * vZ + matrix[15] * vW;
  5114. result.x = x;
  5115. result.y = y;
  5116. result.z = z;
  5117. result.w = w;
  5118. return result;
  5119. };
  5120. Matrix4.multiplyByPointAsVector = function(matrix, cartesian11, result) {
  5121. Check_default.typeOf.object("matrix", matrix);
  5122. Check_default.typeOf.object("cartesian", cartesian11);
  5123. Check_default.typeOf.object("result", result);
  5124. const vX = cartesian11.x;
  5125. const vY = cartesian11.y;
  5126. const vZ = cartesian11.z;
  5127. const x = matrix[0] * vX + matrix[4] * vY + matrix[8] * vZ;
  5128. const y = matrix[1] * vX + matrix[5] * vY + matrix[9] * vZ;
  5129. const z = matrix[2] * vX + matrix[6] * vY + matrix[10] * vZ;
  5130. result.x = x;
  5131. result.y = y;
  5132. result.z = z;
  5133. return result;
  5134. };
  5135. Matrix4.multiplyByPoint = function(matrix, cartesian11, result) {
  5136. Check_default.typeOf.object("matrix", matrix);
  5137. Check_default.typeOf.object("cartesian", cartesian11);
  5138. Check_default.typeOf.object("result", result);
  5139. const vX = cartesian11.x;
  5140. const vY = cartesian11.y;
  5141. const vZ = cartesian11.z;
  5142. const x = matrix[0] * vX + matrix[4] * vY + matrix[8] * vZ + matrix[12];
  5143. const y = matrix[1] * vX + matrix[5] * vY + matrix[9] * vZ + matrix[13];
  5144. const z = matrix[2] * vX + matrix[6] * vY + matrix[10] * vZ + matrix[14];
  5145. result.x = x;
  5146. result.y = y;
  5147. result.z = z;
  5148. return result;
  5149. };
  5150. Matrix4.multiplyByScalar = function(matrix, scalar, result) {
  5151. Check_default.typeOf.object("matrix", matrix);
  5152. Check_default.typeOf.number("scalar", scalar);
  5153. Check_default.typeOf.object("result", result);
  5154. result[0] = matrix[0] * scalar;
  5155. result[1] = matrix[1] * scalar;
  5156. result[2] = matrix[2] * scalar;
  5157. result[3] = matrix[3] * scalar;
  5158. result[4] = matrix[4] * scalar;
  5159. result[5] = matrix[5] * scalar;
  5160. result[6] = matrix[6] * scalar;
  5161. result[7] = matrix[7] * scalar;
  5162. result[8] = matrix[8] * scalar;
  5163. result[9] = matrix[9] * scalar;
  5164. result[10] = matrix[10] * scalar;
  5165. result[11] = matrix[11] * scalar;
  5166. result[12] = matrix[12] * scalar;
  5167. result[13] = matrix[13] * scalar;
  5168. result[14] = matrix[14] * scalar;
  5169. result[15] = matrix[15] * scalar;
  5170. return result;
  5171. };
  5172. Matrix4.negate = function(matrix, result) {
  5173. Check_default.typeOf.object("matrix", matrix);
  5174. Check_default.typeOf.object("result", result);
  5175. result[0] = -matrix[0];
  5176. result[1] = -matrix[1];
  5177. result[2] = -matrix[2];
  5178. result[3] = -matrix[3];
  5179. result[4] = -matrix[4];
  5180. result[5] = -matrix[5];
  5181. result[6] = -matrix[6];
  5182. result[7] = -matrix[7];
  5183. result[8] = -matrix[8];
  5184. result[9] = -matrix[9];
  5185. result[10] = -matrix[10];
  5186. result[11] = -matrix[11];
  5187. result[12] = -matrix[12];
  5188. result[13] = -matrix[13];
  5189. result[14] = -matrix[14];
  5190. result[15] = -matrix[15];
  5191. return result;
  5192. };
  5193. Matrix4.transpose = function(matrix, result) {
  5194. Check_default.typeOf.object("matrix", matrix);
  5195. Check_default.typeOf.object("result", result);
  5196. const matrix1 = matrix[1];
  5197. const matrix2 = matrix[2];
  5198. const matrix3 = matrix[3];
  5199. const matrix6 = matrix[6];
  5200. const matrix7 = matrix[7];
  5201. const matrix11 = matrix[11];
  5202. result[0] = matrix[0];
  5203. result[1] = matrix[4];
  5204. result[2] = matrix[8];
  5205. result[3] = matrix[12];
  5206. result[4] = matrix1;
  5207. result[5] = matrix[5];
  5208. result[6] = matrix[9];
  5209. result[7] = matrix[13];
  5210. result[8] = matrix2;
  5211. result[9] = matrix6;
  5212. result[10] = matrix[10];
  5213. result[11] = matrix[14];
  5214. result[12] = matrix3;
  5215. result[13] = matrix7;
  5216. result[14] = matrix11;
  5217. result[15] = matrix[15];
  5218. return result;
  5219. };
  5220. Matrix4.abs = function(matrix, result) {
  5221. Check_default.typeOf.object("matrix", matrix);
  5222. Check_default.typeOf.object("result", result);
  5223. result[0] = Math.abs(matrix[0]);
  5224. result[1] = Math.abs(matrix[1]);
  5225. result[2] = Math.abs(matrix[2]);
  5226. result[3] = Math.abs(matrix[3]);
  5227. result[4] = Math.abs(matrix[4]);
  5228. result[5] = Math.abs(matrix[5]);
  5229. result[6] = Math.abs(matrix[6]);
  5230. result[7] = Math.abs(matrix[7]);
  5231. result[8] = Math.abs(matrix[8]);
  5232. result[9] = Math.abs(matrix[9]);
  5233. result[10] = Math.abs(matrix[10]);
  5234. result[11] = Math.abs(matrix[11]);
  5235. result[12] = Math.abs(matrix[12]);
  5236. result[13] = Math.abs(matrix[13]);
  5237. result[14] = Math.abs(matrix[14]);
  5238. result[15] = Math.abs(matrix[15]);
  5239. return result;
  5240. };
  5241. Matrix4.equals = function(left, right) {
  5242. return left === right || defined_default(left) && defined_default(right) && left[12] === right[12] && left[13] === right[13] && left[14] === right[14] && left[0] === right[0] && left[1] === right[1] && left[2] === right[2] && left[4] === right[4] && left[5] === right[5] && left[6] === right[6] && left[8] === right[8] && left[9] === right[9] && left[10] === right[10] && left[3] === right[3] && left[7] === right[7] && left[11] === right[11] && left[15] === right[15];
  5243. };
  5244. Matrix4.equalsEpsilon = function(left, right, epsilon) {
  5245. epsilon = defaultValue_default(epsilon, 0);
  5246. return left === right || defined_default(left) && defined_default(right) && Math.abs(left[0] - right[0]) <= epsilon && Math.abs(left[1] - right[1]) <= epsilon && Math.abs(left[2] - right[2]) <= epsilon && Math.abs(left[3] - right[3]) <= epsilon && Math.abs(left[4] - right[4]) <= epsilon && Math.abs(left[5] - right[5]) <= epsilon && Math.abs(left[6] - right[6]) <= epsilon && Math.abs(left[7] - right[7]) <= epsilon && Math.abs(left[8] - right[8]) <= epsilon && Math.abs(left[9] - right[9]) <= epsilon && Math.abs(left[10] - right[10]) <= epsilon && Math.abs(left[11] - right[11]) <= epsilon && Math.abs(left[12] - right[12]) <= epsilon && Math.abs(left[13] - right[13]) <= epsilon && Math.abs(left[14] - right[14]) <= epsilon && Math.abs(left[15] - right[15]) <= epsilon;
  5247. };
  5248. Matrix4.getTranslation = function(matrix, result) {
  5249. Check_default.typeOf.object("matrix", matrix);
  5250. Check_default.typeOf.object("result", result);
  5251. result.x = matrix[12];
  5252. result.y = matrix[13];
  5253. result.z = matrix[14];
  5254. return result;
  5255. };
  5256. Matrix4.getMatrix3 = function(matrix, result) {
  5257. Check_default.typeOf.object("matrix", matrix);
  5258. Check_default.typeOf.object("result", result);
  5259. result[0] = matrix[0];
  5260. result[1] = matrix[1];
  5261. result[2] = matrix[2];
  5262. result[3] = matrix[4];
  5263. result[4] = matrix[5];
  5264. result[5] = matrix[6];
  5265. result[6] = matrix[8];
  5266. result[7] = matrix[9];
  5267. result[8] = matrix[10];
  5268. return result;
  5269. };
  5270. var scratchInverseRotation = new Matrix3_default();
  5271. var scratchMatrix3Zero = new Matrix3_default();
  5272. var scratchBottomRow = new Cartesian4_default();
  5273. var scratchExpectedBottomRow = new Cartesian4_default(0, 0, 0, 1);
  5274. Matrix4.inverse = function(matrix, result) {
  5275. Check_default.typeOf.object("matrix", matrix);
  5276. Check_default.typeOf.object("result", result);
  5277. const src0 = matrix[0];
  5278. const src1 = matrix[4];
  5279. const src2 = matrix[8];
  5280. const src3 = matrix[12];
  5281. const src4 = matrix[1];
  5282. const src5 = matrix[5];
  5283. const src6 = matrix[9];
  5284. const src7 = matrix[13];
  5285. const src8 = matrix[2];
  5286. const src9 = matrix[6];
  5287. const src10 = matrix[10];
  5288. const src11 = matrix[14];
  5289. const src12 = matrix[3];
  5290. const src13 = matrix[7];
  5291. const src14 = matrix[11];
  5292. const src15 = matrix[15];
  5293. let tmp0 = src10 * src15;
  5294. let tmp1 = src11 * src14;
  5295. let tmp2 = src9 * src15;
  5296. let tmp3 = src11 * src13;
  5297. let tmp4 = src9 * src14;
  5298. let tmp5 = src10 * src13;
  5299. let tmp6 = src8 * src15;
  5300. let tmp7 = src11 * src12;
  5301. let tmp8 = src8 * src14;
  5302. let tmp9 = src10 * src12;
  5303. let tmp10 = src8 * src13;
  5304. let tmp11 = src9 * src12;
  5305. const dst0 = tmp0 * src5 + tmp3 * src6 + tmp4 * src7 - (tmp1 * src5 + tmp2 * src6 + tmp5 * src7);
  5306. const dst1 = tmp1 * src4 + tmp6 * src6 + tmp9 * src7 - (tmp0 * src4 + tmp7 * src6 + tmp8 * src7);
  5307. const dst2 = tmp2 * src4 + tmp7 * src5 + tmp10 * src7 - (tmp3 * src4 + tmp6 * src5 + tmp11 * src7);
  5308. const dst3 = tmp5 * src4 + tmp8 * src5 + tmp11 * src6 - (tmp4 * src4 + tmp9 * src5 + tmp10 * src6);
  5309. const dst4 = tmp1 * src1 + tmp2 * src2 + tmp5 * src3 - (tmp0 * src1 + tmp3 * src2 + tmp4 * src3);
  5310. const dst5 = tmp0 * src0 + tmp7 * src2 + tmp8 * src3 - (tmp1 * src0 + tmp6 * src2 + tmp9 * src3);
  5311. const dst6 = tmp3 * src0 + tmp6 * src1 + tmp11 * src3 - (tmp2 * src0 + tmp7 * src1 + tmp10 * src3);
  5312. const dst7 = tmp4 * src0 + tmp9 * src1 + tmp10 * src2 - (tmp5 * src0 + tmp8 * src1 + tmp11 * src2);
  5313. tmp0 = src2 * src7;
  5314. tmp1 = src3 * src6;
  5315. tmp2 = src1 * src7;
  5316. tmp3 = src3 * src5;
  5317. tmp4 = src1 * src6;
  5318. tmp5 = src2 * src5;
  5319. tmp6 = src0 * src7;
  5320. tmp7 = src3 * src4;
  5321. tmp8 = src0 * src6;
  5322. tmp9 = src2 * src4;
  5323. tmp10 = src0 * src5;
  5324. tmp11 = src1 * src4;
  5325. const dst8 = tmp0 * src13 + tmp3 * src14 + tmp4 * src15 - (tmp1 * src13 + tmp2 * src14 + tmp5 * src15);
  5326. const dst9 = tmp1 * src12 + tmp6 * src14 + tmp9 * src15 - (tmp0 * src12 + tmp7 * src14 + tmp8 * src15);
  5327. const dst10 = tmp2 * src12 + tmp7 * src13 + tmp10 * src15 - (tmp3 * src12 + tmp6 * src13 + tmp11 * src15);
  5328. const dst11 = tmp5 * src12 + tmp8 * src13 + tmp11 * src14 - (tmp4 * src12 + tmp9 * src13 + tmp10 * src14);
  5329. const dst12 = tmp2 * src10 + tmp5 * src11 + tmp1 * src9 - (tmp4 * src11 + tmp0 * src9 + tmp3 * src10);
  5330. const dst13 = tmp8 * src11 + tmp0 * src8 + tmp7 * src10 - (tmp6 * src10 + tmp9 * src11 + tmp1 * src8);
  5331. const dst14 = tmp6 * src9 + tmp11 * src11 + tmp3 * src8 - (tmp10 * src11 + tmp2 * src8 + tmp7 * src9);
  5332. const dst15 = tmp10 * src10 + tmp4 * src8 + tmp9 * src9 - (tmp8 * src9 + tmp11 * src10 + tmp5 * src8);
  5333. let det = src0 * dst0 + src1 * dst1 + src2 * dst2 + src3 * dst3;
  5334. if (Math.abs(det) < Math_default.EPSILON21) {
  5335. if (Matrix3_default.equalsEpsilon(
  5336. Matrix4.getMatrix3(matrix, scratchInverseRotation),
  5337. scratchMatrix3Zero,
  5338. Math_default.EPSILON7
  5339. ) && Cartesian4_default.equals(
  5340. Matrix4.getRow(matrix, 3, scratchBottomRow),
  5341. scratchExpectedBottomRow
  5342. )) {
  5343. result[0] = 0;
  5344. result[1] = 0;
  5345. result[2] = 0;
  5346. result[3] = 0;
  5347. result[4] = 0;
  5348. result[5] = 0;
  5349. result[6] = 0;
  5350. result[7] = 0;
  5351. result[8] = 0;
  5352. result[9] = 0;
  5353. result[10] = 0;
  5354. result[11] = 0;
  5355. result[12] = -matrix[12];
  5356. result[13] = -matrix[13];
  5357. result[14] = -matrix[14];
  5358. result[15] = 1;
  5359. return result;
  5360. }
  5361. throw new RuntimeError_default(
  5362. "matrix is not invertible because its determinate is zero."
  5363. );
  5364. }
  5365. det = 1 / det;
  5366. result[0] = dst0 * det;
  5367. result[1] = dst1 * det;
  5368. result[2] = dst2 * det;
  5369. result[3] = dst3 * det;
  5370. result[4] = dst4 * det;
  5371. result[5] = dst5 * det;
  5372. result[6] = dst6 * det;
  5373. result[7] = dst7 * det;
  5374. result[8] = dst8 * det;
  5375. result[9] = dst9 * det;
  5376. result[10] = dst10 * det;
  5377. result[11] = dst11 * det;
  5378. result[12] = dst12 * det;
  5379. result[13] = dst13 * det;
  5380. result[14] = dst14 * det;
  5381. result[15] = dst15 * det;
  5382. return result;
  5383. };
  5384. Matrix4.inverseTransformation = function(matrix, result) {
  5385. Check_default.typeOf.object("matrix", matrix);
  5386. Check_default.typeOf.object("result", result);
  5387. const matrix0 = matrix[0];
  5388. const matrix1 = matrix[1];
  5389. const matrix2 = matrix[2];
  5390. const matrix4 = matrix[4];
  5391. const matrix5 = matrix[5];
  5392. const matrix6 = matrix[6];
  5393. const matrix8 = matrix[8];
  5394. const matrix9 = matrix[9];
  5395. const matrix10 = matrix[10];
  5396. const vX = matrix[12];
  5397. const vY = matrix[13];
  5398. const vZ = matrix[14];
  5399. const x = -matrix0 * vX - matrix1 * vY - matrix2 * vZ;
  5400. const y = -matrix4 * vX - matrix5 * vY - matrix6 * vZ;
  5401. const z = -matrix8 * vX - matrix9 * vY - matrix10 * vZ;
  5402. result[0] = matrix0;
  5403. result[1] = matrix4;
  5404. result[2] = matrix8;
  5405. result[3] = 0;
  5406. result[4] = matrix1;
  5407. result[5] = matrix5;
  5408. result[6] = matrix9;
  5409. result[7] = 0;
  5410. result[8] = matrix2;
  5411. result[9] = matrix6;
  5412. result[10] = matrix10;
  5413. result[11] = 0;
  5414. result[12] = x;
  5415. result[13] = y;
  5416. result[14] = z;
  5417. result[15] = 1;
  5418. return result;
  5419. };
  5420. var scratchTransposeMatrix2 = new Matrix4();
  5421. Matrix4.inverseTranspose = function(matrix, result) {
  5422. Check_default.typeOf.object("matrix", matrix);
  5423. Check_default.typeOf.object("result", result);
  5424. return Matrix4.inverse(
  5425. Matrix4.transpose(matrix, scratchTransposeMatrix2),
  5426. result
  5427. );
  5428. };
  5429. Matrix4.IDENTITY = Object.freeze(
  5430. new Matrix4(
  5431. 1,
  5432. 0,
  5433. 0,
  5434. 0,
  5435. 0,
  5436. 1,
  5437. 0,
  5438. 0,
  5439. 0,
  5440. 0,
  5441. 1,
  5442. 0,
  5443. 0,
  5444. 0,
  5445. 0,
  5446. 1
  5447. )
  5448. );
  5449. Matrix4.ZERO = Object.freeze(
  5450. new Matrix4(
  5451. 0,
  5452. 0,
  5453. 0,
  5454. 0,
  5455. 0,
  5456. 0,
  5457. 0,
  5458. 0,
  5459. 0,
  5460. 0,
  5461. 0,
  5462. 0,
  5463. 0,
  5464. 0,
  5465. 0,
  5466. 0
  5467. )
  5468. );
  5469. Matrix4.COLUMN0ROW0 = 0;
  5470. Matrix4.COLUMN0ROW1 = 1;
  5471. Matrix4.COLUMN0ROW2 = 2;
  5472. Matrix4.COLUMN0ROW3 = 3;
  5473. Matrix4.COLUMN1ROW0 = 4;
  5474. Matrix4.COLUMN1ROW1 = 5;
  5475. Matrix4.COLUMN1ROW2 = 6;
  5476. Matrix4.COLUMN1ROW3 = 7;
  5477. Matrix4.COLUMN2ROW0 = 8;
  5478. Matrix4.COLUMN2ROW1 = 9;
  5479. Matrix4.COLUMN2ROW2 = 10;
  5480. Matrix4.COLUMN2ROW3 = 11;
  5481. Matrix4.COLUMN3ROW0 = 12;
  5482. Matrix4.COLUMN3ROW1 = 13;
  5483. Matrix4.COLUMN3ROW2 = 14;
  5484. Matrix4.COLUMN3ROW3 = 15;
  5485. Object.defineProperties(Matrix4.prototype, {
  5486. length: {
  5487. get: function() {
  5488. return Matrix4.packedLength;
  5489. }
  5490. }
  5491. });
  5492. Matrix4.prototype.clone = function(result) {
  5493. return Matrix4.clone(this, result);
  5494. };
  5495. Matrix4.prototype.equals = function(right) {
  5496. return Matrix4.equals(this, right);
  5497. };
  5498. Matrix4.equalsArray = function(matrix, array, offset2) {
  5499. return matrix[0] === array[offset2] && matrix[1] === array[offset2 + 1] && matrix[2] === array[offset2 + 2] && matrix[3] === array[offset2 + 3] && matrix[4] === array[offset2 + 4] && matrix[5] === array[offset2 + 5] && matrix[6] === array[offset2 + 6] && matrix[7] === array[offset2 + 7] && matrix[8] === array[offset2 + 8] && matrix[9] === array[offset2 + 9] && matrix[10] === array[offset2 + 10] && matrix[11] === array[offset2 + 11] && matrix[12] === array[offset2 + 12] && matrix[13] === array[offset2 + 13] && matrix[14] === array[offset2 + 14] && matrix[15] === array[offset2 + 15];
  5500. };
  5501. Matrix4.prototype.equalsEpsilon = function(right, epsilon) {
  5502. return Matrix4.equalsEpsilon(this, right, epsilon);
  5503. };
  5504. Matrix4.prototype.toString = function() {
  5505. return `(${this[0]}, ${this[4]}, ${this[8]}, ${this[12]})
  5506. (${this[1]}, ${this[5]}, ${this[9]}, ${this[13]})
  5507. (${this[2]}, ${this[6]}, ${this[10]}, ${this[14]})
  5508. (${this[3]}, ${this[7]}, ${this[11]}, ${this[15]})`;
  5509. };
  5510. var Matrix4_default = Matrix4;
  5511. // node_modules/cesium/Source/Core/Rectangle.js
  5512. function Rectangle(west, south, east, north) {
  5513. this.west = defaultValue_default(west, 0);
  5514. this.south = defaultValue_default(south, 0);
  5515. this.east = defaultValue_default(east, 0);
  5516. this.north = defaultValue_default(north, 0);
  5517. }
  5518. Object.defineProperties(Rectangle.prototype, {
  5519. width: {
  5520. get: function() {
  5521. return Rectangle.computeWidth(this);
  5522. }
  5523. },
  5524. height: {
  5525. get: function() {
  5526. return Rectangle.computeHeight(this);
  5527. }
  5528. }
  5529. });
  5530. Rectangle.packedLength = 4;
  5531. Rectangle.pack = function(value, array, startingIndex) {
  5532. Check_default.typeOf.object("value", value);
  5533. Check_default.defined("array", array);
  5534. startingIndex = defaultValue_default(startingIndex, 0);
  5535. array[startingIndex++] = value.west;
  5536. array[startingIndex++] = value.south;
  5537. array[startingIndex++] = value.east;
  5538. array[startingIndex] = value.north;
  5539. return array;
  5540. };
  5541. Rectangle.unpack = function(array, startingIndex, result) {
  5542. Check_default.defined("array", array);
  5543. startingIndex = defaultValue_default(startingIndex, 0);
  5544. if (!defined_default(result)) {
  5545. result = new Rectangle();
  5546. }
  5547. result.west = array[startingIndex++];
  5548. result.south = array[startingIndex++];
  5549. result.east = array[startingIndex++];
  5550. result.north = array[startingIndex];
  5551. return result;
  5552. };
  5553. Rectangle.computeWidth = function(rectangle) {
  5554. Check_default.typeOf.object("rectangle", rectangle);
  5555. let east = rectangle.east;
  5556. const west = rectangle.west;
  5557. if (east < west) {
  5558. east += Math_default.TWO_PI;
  5559. }
  5560. return east - west;
  5561. };
  5562. Rectangle.computeHeight = function(rectangle) {
  5563. Check_default.typeOf.object("rectangle", rectangle);
  5564. return rectangle.north - rectangle.south;
  5565. };
  5566. Rectangle.fromDegrees = function(west, south, east, north, result) {
  5567. west = Math_default.toRadians(defaultValue_default(west, 0));
  5568. south = Math_default.toRadians(defaultValue_default(south, 0));
  5569. east = Math_default.toRadians(defaultValue_default(east, 0));
  5570. north = Math_default.toRadians(defaultValue_default(north, 0));
  5571. if (!defined_default(result)) {
  5572. return new Rectangle(west, south, east, north);
  5573. }
  5574. result.west = west;
  5575. result.south = south;
  5576. result.east = east;
  5577. result.north = north;
  5578. return result;
  5579. };
  5580. Rectangle.fromRadians = function(west, south, east, north, result) {
  5581. if (!defined_default(result)) {
  5582. return new Rectangle(west, south, east, north);
  5583. }
  5584. result.west = defaultValue_default(west, 0);
  5585. result.south = defaultValue_default(south, 0);
  5586. result.east = defaultValue_default(east, 0);
  5587. result.north = defaultValue_default(north, 0);
  5588. return result;
  5589. };
  5590. Rectangle.fromCartographicArray = function(cartographics, result) {
  5591. Check_default.defined("cartographics", cartographics);
  5592. let west = Number.MAX_VALUE;
  5593. let east = -Number.MAX_VALUE;
  5594. let westOverIDL = Number.MAX_VALUE;
  5595. let eastOverIDL = -Number.MAX_VALUE;
  5596. let south = Number.MAX_VALUE;
  5597. let north = -Number.MAX_VALUE;
  5598. for (let i2 = 0, len = cartographics.length; i2 < len; i2++) {
  5599. const position = cartographics[i2];
  5600. west = Math.min(west, position.longitude);
  5601. east = Math.max(east, position.longitude);
  5602. south = Math.min(south, position.latitude);
  5603. north = Math.max(north, position.latitude);
  5604. const lonAdjusted = position.longitude >= 0 ? position.longitude : position.longitude + Math_default.TWO_PI;
  5605. westOverIDL = Math.min(westOverIDL, lonAdjusted);
  5606. eastOverIDL = Math.max(eastOverIDL, lonAdjusted);
  5607. }
  5608. if (east - west > eastOverIDL - westOverIDL) {
  5609. west = westOverIDL;
  5610. east = eastOverIDL;
  5611. if (east > Math_default.PI) {
  5612. east = east - Math_default.TWO_PI;
  5613. }
  5614. if (west > Math_default.PI) {
  5615. west = west - Math_default.TWO_PI;
  5616. }
  5617. }
  5618. if (!defined_default(result)) {
  5619. return new Rectangle(west, south, east, north);
  5620. }
  5621. result.west = west;
  5622. result.south = south;
  5623. result.east = east;
  5624. result.north = north;
  5625. return result;
  5626. };
  5627. Rectangle.fromCartesianArray = function(cartesians, ellipsoid, result) {
  5628. Check_default.defined("cartesians", cartesians);
  5629. ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  5630. let west = Number.MAX_VALUE;
  5631. let east = -Number.MAX_VALUE;
  5632. let westOverIDL = Number.MAX_VALUE;
  5633. let eastOverIDL = -Number.MAX_VALUE;
  5634. let south = Number.MAX_VALUE;
  5635. let north = -Number.MAX_VALUE;
  5636. for (let i2 = 0, len = cartesians.length; i2 < len; i2++) {
  5637. const position = ellipsoid.cartesianToCartographic(cartesians[i2]);
  5638. west = Math.min(west, position.longitude);
  5639. east = Math.max(east, position.longitude);
  5640. south = Math.min(south, position.latitude);
  5641. north = Math.max(north, position.latitude);
  5642. const lonAdjusted = position.longitude >= 0 ? position.longitude : position.longitude + Math_default.TWO_PI;
  5643. westOverIDL = Math.min(westOverIDL, lonAdjusted);
  5644. eastOverIDL = Math.max(eastOverIDL, lonAdjusted);
  5645. }
  5646. if (east - west > eastOverIDL - westOverIDL) {
  5647. west = westOverIDL;
  5648. east = eastOverIDL;
  5649. if (east > Math_default.PI) {
  5650. east = east - Math_default.TWO_PI;
  5651. }
  5652. if (west > Math_default.PI) {
  5653. west = west - Math_default.TWO_PI;
  5654. }
  5655. }
  5656. if (!defined_default(result)) {
  5657. return new Rectangle(west, south, east, north);
  5658. }
  5659. result.west = west;
  5660. result.south = south;
  5661. result.east = east;
  5662. result.north = north;
  5663. return result;
  5664. };
  5665. Rectangle.clone = function(rectangle, result) {
  5666. if (!defined_default(rectangle)) {
  5667. return void 0;
  5668. }
  5669. if (!defined_default(result)) {
  5670. return new Rectangle(
  5671. rectangle.west,
  5672. rectangle.south,
  5673. rectangle.east,
  5674. rectangle.north
  5675. );
  5676. }
  5677. result.west = rectangle.west;
  5678. result.south = rectangle.south;
  5679. result.east = rectangle.east;
  5680. result.north = rectangle.north;
  5681. return result;
  5682. };
  5683. Rectangle.equalsEpsilon = function(left, right, absoluteEpsilon) {
  5684. absoluteEpsilon = defaultValue_default(absoluteEpsilon, 0);
  5685. return left === right || defined_default(left) && defined_default(right) && Math.abs(left.west - right.west) <= absoluteEpsilon && Math.abs(left.south - right.south) <= absoluteEpsilon && Math.abs(left.east - right.east) <= absoluteEpsilon && Math.abs(left.north - right.north) <= absoluteEpsilon;
  5686. };
  5687. Rectangle.prototype.clone = function(result) {
  5688. return Rectangle.clone(this, result);
  5689. };
  5690. Rectangle.prototype.equals = function(other) {
  5691. return Rectangle.equals(this, other);
  5692. };
  5693. Rectangle.equals = function(left, right) {
  5694. return left === right || defined_default(left) && defined_default(right) && left.west === right.west && left.south === right.south && left.east === right.east && left.north === right.north;
  5695. };
  5696. Rectangle.prototype.equalsEpsilon = function(other, epsilon) {
  5697. return Rectangle.equalsEpsilon(this, other, epsilon);
  5698. };
  5699. Rectangle.validate = function(rectangle) {
  5700. Check_default.typeOf.object("rectangle", rectangle);
  5701. const north = rectangle.north;
  5702. Check_default.typeOf.number.greaterThanOrEquals(
  5703. "north",
  5704. north,
  5705. -Math_default.PI_OVER_TWO
  5706. );
  5707. Check_default.typeOf.number.lessThanOrEquals("north", north, Math_default.PI_OVER_TWO);
  5708. const south = rectangle.south;
  5709. Check_default.typeOf.number.greaterThanOrEquals(
  5710. "south",
  5711. south,
  5712. -Math_default.PI_OVER_TWO
  5713. );
  5714. Check_default.typeOf.number.lessThanOrEquals("south", south, Math_default.PI_OVER_TWO);
  5715. const west = rectangle.west;
  5716. Check_default.typeOf.number.greaterThanOrEquals("west", west, -Math.PI);
  5717. Check_default.typeOf.number.lessThanOrEquals("west", west, Math.PI);
  5718. const east = rectangle.east;
  5719. Check_default.typeOf.number.greaterThanOrEquals("east", east, -Math.PI);
  5720. Check_default.typeOf.number.lessThanOrEquals("east", east, Math.PI);
  5721. };
  5722. Rectangle.southwest = function(rectangle, result) {
  5723. Check_default.typeOf.object("rectangle", rectangle);
  5724. if (!defined_default(result)) {
  5725. return new Cartographic_default(rectangle.west, rectangle.south);
  5726. }
  5727. result.longitude = rectangle.west;
  5728. result.latitude = rectangle.south;
  5729. result.height = 0;
  5730. return result;
  5731. };
  5732. Rectangle.northwest = function(rectangle, result) {
  5733. Check_default.typeOf.object("rectangle", rectangle);
  5734. if (!defined_default(result)) {
  5735. return new Cartographic_default(rectangle.west, rectangle.north);
  5736. }
  5737. result.longitude = rectangle.west;
  5738. result.latitude = rectangle.north;
  5739. result.height = 0;
  5740. return result;
  5741. };
  5742. Rectangle.northeast = function(rectangle, result) {
  5743. Check_default.typeOf.object("rectangle", rectangle);
  5744. if (!defined_default(result)) {
  5745. return new Cartographic_default(rectangle.east, rectangle.north);
  5746. }
  5747. result.longitude = rectangle.east;
  5748. result.latitude = rectangle.north;
  5749. result.height = 0;
  5750. return result;
  5751. };
  5752. Rectangle.southeast = function(rectangle, result) {
  5753. Check_default.typeOf.object("rectangle", rectangle);
  5754. if (!defined_default(result)) {
  5755. return new Cartographic_default(rectangle.east, rectangle.south);
  5756. }
  5757. result.longitude = rectangle.east;
  5758. result.latitude = rectangle.south;
  5759. result.height = 0;
  5760. return result;
  5761. };
  5762. Rectangle.center = function(rectangle, result) {
  5763. Check_default.typeOf.object("rectangle", rectangle);
  5764. let east = rectangle.east;
  5765. const west = rectangle.west;
  5766. if (east < west) {
  5767. east += Math_default.TWO_PI;
  5768. }
  5769. const longitude = Math_default.negativePiToPi((west + east) * 0.5);
  5770. const latitude = (rectangle.south + rectangle.north) * 0.5;
  5771. if (!defined_default(result)) {
  5772. return new Cartographic_default(longitude, latitude);
  5773. }
  5774. result.longitude = longitude;
  5775. result.latitude = latitude;
  5776. result.height = 0;
  5777. return result;
  5778. };
  5779. Rectangle.intersection = function(rectangle, otherRectangle, result) {
  5780. Check_default.typeOf.object("rectangle", rectangle);
  5781. Check_default.typeOf.object("otherRectangle", otherRectangle);
  5782. let rectangleEast = rectangle.east;
  5783. let rectangleWest = rectangle.west;
  5784. let otherRectangleEast = otherRectangle.east;
  5785. let otherRectangleWest = otherRectangle.west;
  5786. if (rectangleEast < rectangleWest && otherRectangleEast > 0) {
  5787. rectangleEast += Math_default.TWO_PI;
  5788. } else if (otherRectangleEast < otherRectangleWest && rectangleEast > 0) {
  5789. otherRectangleEast += Math_default.TWO_PI;
  5790. }
  5791. if (rectangleEast < rectangleWest && otherRectangleWest < 0) {
  5792. otherRectangleWest += Math_default.TWO_PI;
  5793. } else if (otherRectangleEast < otherRectangleWest && rectangleWest < 0) {
  5794. rectangleWest += Math_default.TWO_PI;
  5795. }
  5796. const west = Math_default.negativePiToPi(
  5797. Math.max(rectangleWest, otherRectangleWest)
  5798. );
  5799. const east = Math_default.negativePiToPi(
  5800. Math.min(rectangleEast, otherRectangleEast)
  5801. );
  5802. if ((rectangle.west < rectangle.east || otherRectangle.west < otherRectangle.east) && east <= west) {
  5803. return void 0;
  5804. }
  5805. const south = Math.max(rectangle.south, otherRectangle.south);
  5806. const north = Math.min(rectangle.north, otherRectangle.north);
  5807. if (south >= north) {
  5808. return void 0;
  5809. }
  5810. if (!defined_default(result)) {
  5811. return new Rectangle(west, south, east, north);
  5812. }
  5813. result.west = west;
  5814. result.south = south;
  5815. result.east = east;
  5816. result.north = north;
  5817. return result;
  5818. };
  5819. Rectangle.simpleIntersection = function(rectangle, otherRectangle, result) {
  5820. Check_default.typeOf.object("rectangle", rectangle);
  5821. Check_default.typeOf.object("otherRectangle", otherRectangle);
  5822. const west = Math.max(rectangle.west, otherRectangle.west);
  5823. const south = Math.max(rectangle.south, otherRectangle.south);
  5824. const east = Math.min(rectangle.east, otherRectangle.east);
  5825. const north = Math.min(rectangle.north, otherRectangle.north);
  5826. if (south >= north || west >= east) {
  5827. return void 0;
  5828. }
  5829. if (!defined_default(result)) {
  5830. return new Rectangle(west, south, east, north);
  5831. }
  5832. result.west = west;
  5833. result.south = south;
  5834. result.east = east;
  5835. result.north = north;
  5836. return result;
  5837. };
  5838. Rectangle.union = function(rectangle, otherRectangle, result) {
  5839. Check_default.typeOf.object("rectangle", rectangle);
  5840. Check_default.typeOf.object("otherRectangle", otherRectangle);
  5841. if (!defined_default(result)) {
  5842. result = new Rectangle();
  5843. }
  5844. let rectangleEast = rectangle.east;
  5845. let rectangleWest = rectangle.west;
  5846. let otherRectangleEast = otherRectangle.east;
  5847. let otherRectangleWest = otherRectangle.west;
  5848. if (rectangleEast < rectangleWest && otherRectangleEast > 0) {
  5849. rectangleEast += Math_default.TWO_PI;
  5850. } else if (otherRectangleEast < otherRectangleWest && rectangleEast > 0) {
  5851. otherRectangleEast += Math_default.TWO_PI;
  5852. }
  5853. if (rectangleEast < rectangleWest && otherRectangleWest < 0) {
  5854. otherRectangleWest += Math_default.TWO_PI;
  5855. } else if (otherRectangleEast < otherRectangleWest && rectangleWest < 0) {
  5856. rectangleWest += Math_default.TWO_PI;
  5857. }
  5858. const west = Math_default.negativePiToPi(
  5859. Math.min(rectangleWest, otherRectangleWest)
  5860. );
  5861. const east = Math_default.negativePiToPi(
  5862. Math.max(rectangleEast, otherRectangleEast)
  5863. );
  5864. result.west = west;
  5865. result.south = Math.min(rectangle.south, otherRectangle.south);
  5866. result.east = east;
  5867. result.north = Math.max(rectangle.north, otherRectangle.north);
  5868. return result;
  5869. };
  5870. Rectangle.expand = function(rectangle, cartographic2, result) {
  5871. Check_default.typeOf.object("rectangle", rectangle);
  5872. Check_default.typeOf.object("cartographic", cartographic2);
  5873. if (!defined_default(result)) {
  5874. result = new Rectangle();
  5875. }
  5876. result.west = Math.min(rectangle.west, cartographic2.longitude);
  5877. result.south = Math.min(rectangle.south, cartographic2.latitude);
  5878. result.east = Math.max(rectangle.east, cartographic2.longitude);
  5879. result.north = Math.max(rectangle.north, cartographic2.latitude);
  5880. return result;
  5881. };
  5882. Rectangle.contains = function(rectangle, cartographic2) {
  5883. Check_default.typeOf.object("rectangle", rectangle);
  5884. Check_default.typeOf.object("cartographic", cartographic2);
  5885. let longitude = cartographic2.longitude;
  5886. const latitude = cartographic2.latitude;
  5887. const west = rectangle.west;
  5888. let east = rectangle.east;
  5889. if (east < west) {
  5890. east += Math_default.TWO_PI;
  5891. if (longitude < 0) {
  5892. longitude += Math_default.TWO_PI;
  5893. }
  5894. }
  5895. return (longitude > west || Math_default.equalsEpsilon(longitude, west, Math_default.EPSILON14)) && (longitude < east || Math_default.equalsEpsilon(longitude, east, Math_default.EPSILON14)) && latitude >= rectangle.south && latitude <= rectangle.north;
  5896. };
  5897. var subsampleLlaScratch = new Cartographic_default();
  5898. Rectangle.subsample = function(rectangle, ellipsoid, surfaceHeight, result) {
  5899. Check_default.typeOf.object("rectangle", rectangle);
  5900. ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  5901. surfaceHeight = defaultValue_default(surfaceHeight, 0);
  5902. if (!defined_default(result)) {
  5903. result = [];
  5904. }
  5905. let length3 = 0;
  5906. const north = rectangle.north;
  5907. const south = rectangle.south;
  5908. const east = rectangle.east;
  5909. const west = rectangle.west;
  5910. const lla = subsampleLlaScratch;
  5911. lla.height = surfaceHeight;
  5912. lla.longitude = west;
  5913. lla.latitude = north;
  5914. result[length3] = ellipsoid.cartographicToCartesian(lla, result[length3]);
  5915. length3++;
  5916. lla.longitude = east;
  5917. result[length3] = ellipsoid.cartographicToCartesian(lla, result[length3]);
  5918. length3++;
  5919. lla.latitude = south;
  5920. result[length3] = ellipsoid.cartographicToCartesian(lla, result[length3]);
  5921. length3++;
  5922. lla.longitude = west;
  5923. result[length3] = ellipsoid.cartographicToCartesian(lla, result[length3]);
  5924. length3++;
  5925. if (north < 0) {
  5926. lla.latitude = north;
  5927. } else if (south > 0) {
  5928. lla.latitude = south;
  5929. } else {
  5930. lla.latitude = 0;
  5931. }
  5932. for (let i2 = 1; i2 < 8; ++i2) {
  5933. lla.longitude = -Math.PI + i2 * Math_default.PI_OVER_TWO;
  5934. if (Rectangle.contains(rectangle, lla)) {
  5935. result[length3] = ellipsoid.cartographicToCartesian(lla, result[length3]);
  5936. length3++;
  5937. }
  5938. }
  5939. if (lla.latitude === 0) {
  5940. lla.longitude = west;
  5941. result[length3] = ellipsoid.cartographicToCartesian(lla, result[length3]);
  5942. length3++;
  5943. lla.longitude = east;
  5944. result[length3] = ellipsoid.cartographicToCartesian(lla, result[length3]);
  5945. length3++;
  5946. }
  5947. result.length = length3;
  5948. return result;
  5949. };
  5950. Rectangle.subsection = function(rectangle, westLerp, southLerp, eastLerp, northLerp, result) {
  5951. Check_default.typeOf.object("rectangle", rectangle);
  5952. Check_default.typeOf.number.greaterThanOrEquals("westLerp", westLerp, 0);
  5953. Check_default.typeOf.number.lessThanOrEquals("westLerp", westLerp, 1);
  5954. Check_default.typeOf.number.greaterThanOrEquals("southLerp", southLerp, 0);
  5955. Check_default.typeOf.number.lessThanOrEquals("southLerp", southLerp, 1);
  5956. Check_default.typeOf.number.greaterThanOrEquals("eastLerp", eastLerp, 0);
  5957. Check_default.typeOf.number.lessThanOrEquals("eastLerp", eastLerp, 1);
  5958. Check_default.typeOf.number.greaterThanOrEquals("northLerp", northLerp, 0);
  5959. Check_default.typeOf.number.lessThanOrEquals("northLerp", northLerp, 1);
  5960. Check_default.typeOf.number.lessThanOrEquals("westLerp", westLerp, eastLerp);
  5961. Check_default.typeOf.number.lessThanOrEquals("southLerp", southLerp, northLerp);
  5962. if (!defined_default(result)) {
  5963. result = new Rectangle();
  5964. }
  5965. if (rectangle.west <= rectangle.east) {
  5966. const width = rectangle.east - rectangle.west;
  5967. result.west = rectangle.west + westLerp * width;
  5968. result.east = rectangle.west + eastLerp * width;
  5969. } else {
  5970. const width = Math_default.TWO_PI + rectangle.east - rectangle.west;
  5971. result.west = Math_default.negativePiToPi(rectangle.west + westLerp * width);
  5972. result.east = Math_default.negativePiToPi(rectangle.west + eastLerp * width);
  5973. }
  5974. const height = rectangle.north - rectangle.south;
  5975. result.south = rectangle.south + southLerp * height;
  5976. result.north = rectangle.south + northLerp * height;
  5977. if (westLerp === 1) {
  5978. result.west = rectangle.east;
  5979. }
  5980. if (eastLerp === 1) {
  5981. result.east = rectangle.east;
  5982. }
  5983. if (southLerp === 1) {
  5984. result.south = rectangle.north;
  5985. }
  5986. if (northLerp === 1) {
  5987. result.north = rectangle.north;
  5988. }
  5989. return result;
  5990. };
  5991. Rectangle.MAX_VALUE = Object.freeze(
  5992. new Rectangle(
  5993. -Math.PI,
  5994. -Math_default.PI_OVER_TWO,
  5995. Math.PI,
  5996. Math_default.PI_OVER_TWO
  5997. )
  5998. );
  5999. var Rectangle_default = Rectangle;
  6000. // node_modules/cesium/Source/Core/BoundingSphere.js
  6001. function BoundingSphere(center, radius) {
  6002. this.center = Cartesian3_default.clone(defaultValue_default(center, Cartesian3_default.ZERO));
  6003. this.radius = defaultValue_default(radius, 0);
  6004. }
  6005. var fromPointsXMin = new Cartesian3_default();
  6006. var fromPointsYMin = new Cartesian3_default();
  6007. var fromPointsZMin = new Cartesian3_default();
  6008. var fromPointsXMax = new Cartesian3_default();
  6009. var fromPointsYMax = new Cartesian3_default();
  6010. var fromPointsZMax = new Cartesian3_default();
  6011. var fromPointsCurrentPos = new Cartesian3_default();
  6012. var fromPointsScratch = new Cartesian3_default();
  6013. var fromPointsRitterCenter = new Cartesian3_default();
  6014. var fromPointsMinBoxPt = new Cartesian3_default();
  6015. var fromPointsMaxBoxPt = new Cartesian3_default();
  6016. var fromPointsNaiveCenterScratch = new Cartesian3_default();
  6017. var volumeConstant = 4 / 3 * Math_default.PI;
  6018. BoundingSphere.fromPoints = function(positions, result) {
  6019. if (!defined_default(result)) {
  6020. result = new BoundingSphere();
  6021. }
  6022. if (!defined_default(positions) || positions.length === 0) {
  6023. result.center = Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
  6024. result.radius = 0;
  6025. return result;
  6026. }
  6027. const currentPos = Cartesian3_default.clone(positions[0], fromPointsCurrentPos);
  6028. const xMin = Cartesian3_default.clone(currentPos, fromPointsXMin);
  6029. const yMin = Cartesian3_default.clone(currentPos, fromPointsYMin);
  6030. const zMin = Cartesian3_default.clone(currentPos, fromPointsZMin);
  6031. const xMax = Cartesian3_default.clone(currentPos, fromPointsXMax);
  6032. const yMax = Cartesian3_default.clone(currentPos, fromPointsYMax);
  6033. const zMax = Cartesian3_default.clone(currentPos, fromPointsZMax);
  6034. const numPositions = positions.length;
  6035. let i2;
  6036. for (i2 = 1; i2 < numPositions; i2++) {
  6037. Cartesian3_default.clone(positions[i2], currentPos);
  6038. const x = currentPos.x;
  6039. const y = currentPos.y;
  6040. const z = currentPos.z;
  6041. if (x < xMin.x) {
  6042. Cartesian3_default.clone(currentPos, xMin);
  6043. }
  6044. if (x > xMax.x) {
  6045. Cartesian3_default.clone(currentPos, xMax);
  6046. }
  6047. if (y < yMin.y) {
  6048. Cartesian3_default.clone(currentPos, yMin);
  6049. }
  6050. if (y > yMax.y) {
  6051. Cartesian3_default.clone(currentPos, yMax);
  6052. }
  6053. if (z < zMin.z) {
  6054. Cartesian3_default.clone(currentPos, zMin);
  6055. }
  6056. if (z > zMax.z) {
  6057. Cartesian3_default.clone(currentPos, zMax);
  6058. }
  6059. }
  6060. const xSpan = Cartesian3_default.magnitudeSquared(
  6061. Cartesian3_default.subtract(xMax, xMin, fromPointsScratch)
  6062. );
  6063. const ySpan = Cartesian3_default.magnitudeSquared(
  6064. Cartesian3_default.subtract(yMax, yMin, fromPointsScratch)
  6065. );
  6066. const zSpan = Cartesian3_default.magnitudeSquared(
  6067. Cartesian3_default.subtract(zMax, zMin, fromPointsScratch)
  6068. );
  6069. let diameter1 = xMin;
  6070. let diameter2 = xMax;
  6071. let maxSpan = xSpan;
  6072. if (ySpan > maxSpan) {
  6073. maxSpan = ySpan;
  6074. diameter1 = yMin;
  6075. diameter2 = yMax;
  6076. }
  6077. if (zSpan > maxSpan) {
  6078. maxSpan = zSpan;
  6079. diameter1 = zMin;
  6080. diameter2 = zMax;
  6081. }
  6082. const ritterCenter = fromPointsRitterCenter;
  6083. ritterCenter.x = (diameter1.x + diameter2.x) * 0.5;
  6084. ritterCenter.y = (diameter1.y + diameter2.y) * 0.5;
  6085. ritterCenter.z = (diameter1.z + diameter2.z) * 0.5;
  6086. let radiusSquared = Cartesian3_default.magnitudeSquared(
  6087. Cartesian3_default.subtract(diameter2, ritterCenter, fromPointsScratch)
  6088. );
  6089. let ritterRadius = Math.sqrt(radiusSquared);
  6090. const minBoxPt = fromPointsMinBoxPt;
  6091. minBoxPt.x = xMin.x;
  6092. minBoxPt.y = yMin.y;
  6093. minBoxPt.z = zMin.z;
  6094. const maxBoxPt = fromPointsMaxBoxPt;
  6095. maxBoxPt.x = xMax.x;
  6096. maxBoxPt.y = yMax.y;
  6097. maxBoxPt.z = zMax.z;
  6098. const naiveCenter = Cartesian3_default.midpoint(
  6099. minBoxPt,
  6100. maxBoxPt,
  6101. fromPointsNaiveCenterScratch
  6102. );
  6103. let naiveRadius = 0;
  6104. for (i2 = 0; i2 < numPositions; i2++) {
  6105. Cartesian3_default.clone(positions[i2], currentPos);
  6106. const r2 = Cartesian3_default.magnitude(
  6107. Cartesian3_default.subtract(currentPos, naiveCenter, fromPointsScratch)
  6108. );
  6109. if (r2 > naiveRadius) {
  6110. naiveRadius = r2;
  6111. }
  6112. const oldCenterToPointSquared = Cartesian3_default.magnitudeSquared(
  6113. Cartesian3_default.subtract(currentPos, ritterCenter, fromPointsScratch)
  6114. );
  6115. if (oldCenterToPointSquared > radiusSquared) {
  6116. const oldCenterToPoint = Math.sqrt(oldCenterToPointSquared);
  6117. ritterRadius = (ritterRadius + oldCenterToPoint) * 0.5;
  6118. radiusSquared = ritterRadius * ritterRadius;
  6119. const oldToNew = oldCenterToPoint - ritterRadius;
  6120. ritterCenter.x = (ritterRadius * ritterCenter.x + oldToNew * currentPos.x) / oldCenterToPoint;
  6121. ritterCenter.y = (ritterRadius * ritterCenter.y + oldToNew * currentPos.y) / oldCenterToPoint;
  6122. ritterCenter.z = (ritterRadius * ritterCenter.z + oldToNew * currentPos.z) / oldCenterToPoint;
  6123. }
  6124. }
  6125. if (ritterRadius < naiveRadius) {
  6126. Cartesian3_default.clone(ritterCenter, result.center);
  6127. result.radius = ritterRadius;
  6128. } else {
  6129. Cartesian3_default.clone(naiveCenter, result.center);
  6130. result.radius = naiveRadius;
  6131. }
  6132. return result;
  6133. };
  6134. var defaultProjection = new GeographicProjection_default();
  6135. var fromRectangle2DLowerLeft = new Cartesian3_default();
  6136. var fromRectangle2DUpperRight = new Cartesian3_default();
  6137. var fromRectangle2DSouthwest = new Cartographic_default();
  6138. var fromRectangle2DNortheast = new Cartographic_default();
  6139. BoundingSphere.fromRectangle2D = function(rectangle, projection, result) {
  6140. return BoundingSphere.fromRectangleWithHeights2D(
  6141. rectangle,
  6142. projection,
  6143. 0,
  6144. 0,
  6145. result
  6146. );
  6147. };
  6148. BoundingSphere.fromRectangleWithHeights2D = function(rectangle, projection, minimumHeight, maximumHeight, result) {
  6149. if (!defined_default(result)) {
  6150. result = new BoundingSphere();
  6151. }
  6152. if (!defined_default(rectangle)) {
  6153. result.center = Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
  6154. result.radius = 0;
  6155. return result;
  6156. }
  6157. projection = defaultValue_default(projection, defaultProjection);
  6158. Rectangle_default.southwest(rectangle, fromRectangle2DSouthwest);
  6159. fromRectangle2DSouthwest.height = minimumHeight;
  6160. Rectangle_default.northeast(rectangle, fromRectangle2DNortheast);
  6161. fromRectangle2DNortheast.height = maximumHeight;
  6162. const lowerLeft = projection.project(
  6163. fromRectangle2DSouthwest,
  6164. fromRectangle2DLowerLeft
  6165. );
  6166. const upperRight = projection.project(
  6167. fromRectangle2DNortheast,
  6168. fromRectangle2DUpperRight
  6169. );
  6170. const width = upperRight.x - lowerLeft.x;
  6171. const height = upperRight.y - lowerLeft.y;
  6172. const elevation = upperRight.z - lowerLeft.z;
  6173. result.radius = Math.sqrt(width * width + height * height + elevation * elevation) * 0.5;
  6174. const center = result.center;
  6175. center.x = lowerLeft.x + width * 0.5;
  6176. center.y = lowerLeft.y + height * 0.5;
  6177. center.z = lowerLeft.z + elevation * 0.5;
  6178. return result;
  6179. };
  6180. var fromRectangle3DScratch = [];
  6181. BoundingSphere.fromRectangle3D = function(rectangle, ellipsoid, surfaceHeight, result) {
  6182. ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  6183. surfaceHeight = defaultValue_default(surfaceHeight, 0);
  6184. if (!defined_default(result)) {
  6185. result = new BoundingSphere();
  6186. }
  6187. if (!defined_default(rectangle)) {
  6188. result.center = Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
  6189. result.radius = 0;
  6190. return result;
  6191. }
  6192. const positions = Rectangle_default.subsample(
  6193. rectangle,
  6194. ellipsoid,
  6195. surfaceHeight,
  6196. fromRectangle3DScratch
  6197. );
  6198. return BoundingSphere.fromPoints(positions, result);
  6199. };
  6200. BoundingSphere.fromVertices = function(positions, center, stride, result) {
  6201. if (!defined_default(result)) {
  6202. result = new BoundingSphere();
  6203. }
  6204. if (!defined_default(positions) || positions.length === 0) {
  6205. result.center = Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
  6206. result.radius = 0;
  6207. return result;
  6208. }
  6209. center = defaultValue_default(center, Cartesian3_default.ZERO);
  6210. stride = defaultValue_default(stride, 3);
  6211. Check_default.typeOf.number.greaterThanOrEquals("stride", stride, 3);
  6212. const currentPos = fromPointsCurrentPos;
  6213. currentPos.x = positions[0] + center.x;
  6214. currentPos.y = positions[1] + center.y;
  6215. currentPos.z = positions[2] + center.z;
  6216. const xMin = Cartesian3_default.clone(currentPos, fromPointsXMin);
  6217. const yMin = Cartesian3_default.clone(currentPos, fromPointsYMin);
  6218. const zMin = Cartesian3_default.clone(currentPos, fromPointsZMin);
  6219. const xMax = Cartesian3_default.clone(currentPos, fromPointsXMax);
  6220. const yMax = Cartesian3_default.clone(currentPos, fromPointsYMax);
  6221. const zMax = Cartesian3_default.clone(currentPos, fromPointsZMax);
  6222. const numElements = positions.length;
  6223. let i2;
  6224. for (i2 = 0; i2 < numElements; i2 += stride) {
  6225. const x = positions[i2] + center.x;
  6226. const y = positions[i2 + 1] + center.y;
  6227. const z = positions[i2 + 2] + center.z;
  6228. currentPos.x = x;
  6229. currentPos.y = y;
  6230. currentPos.z = z;
  6231. if (x < xMin.x) {
  6232. Cartesian3_default.clone(currentPos, xMin);
  6233. }
  6234. if (x > xMax.x) {
  6235. Cartesian3_default.clone(currentPos, xMax);
  6236. }
  6237. if (y < yMin.y) {
  6238. Cartesian3_default.clone(currentPos, yMin);
  6239. }
  6240. if (y > yMax.y) {
  6241. Cartesian3_default.clone(currentPos, yMax);
  6242. }
  6243. if (z < zMin.z) {
  6244. Cartesian3_default.clone(currentPos, zMin);
  6245. }
  6246. if (z > zMax.z) {
  6247. Cartesian3_default.clone(currentPos, zMax);
  6248. }
  6249. }
  6250. const xSpan = Cartesian3_default.magnitudeSquared(
  6251. Cartesian3_default.subtract(xMax, xMin, fromPointsScratch)
  6252. );
  6253. const ySpan = Cartesian3_default.magnitudeSquared(
  6254. Cartesian3_default.subtract(yMax, yMin, fromPointsScratch)
  6255. );
  6256. const zSpan = Cartesian3_default.magnitudeSquared(
  6257. Cartesian3_default.subtract(zMax, zMin, fromPointsScratch)
  6258. );
  6259. let diameter1 = xMin;
  6260. let diameter2 = xMax;
  6261. let maxSpan = xSpan;
  6262. if (ySpan > maxSpan) {
  6263. maxSpan = ySpan;
  6264. diameter1 = yMin;
  6265. diameter2 = yMax;
  6266. }
  6267. if (zSpan > maxSpan) {
  6268. maxSpan = zSpan;
  6269. diameter1 = zMin;
  6270. diameter2 = zMax;
  6271. }
  6272. const ritterCenter = fromPointsRitterCenter;
  6273. ritterCenter.x = (diameter1.x + diameter2.x) * 0.5;
  6274. ritterCenter.y = (diameter1.y + diameter2.y) * 0.5;
  6275. ritterCenter.z = (diameter1.z + diameter2.z) * 0.5;
  6276. let radiusSquared = Cartesian3_default.magnitudeSquared(
  6277. Cartesian3_default.subtract(diameter2, ritterCenter, fromPointsScratch)
  6278. );
  6279. let ritterRadius = Math.sqrt(radiusSquared);
  6280. const minBoxPt = fromPointsMinBoxPt;
  6281. minBoxPt.x = xMin.x;
  6282. minBoxPt.y = yMin.y;
  6283. minBoxPt.z = zMin.z;
  6284. const maxBoxPt = fromPointsMaxBoxPt;
  6285. maxBoxPt.x = xMax.x;
  6286. maxBoxPt.y = yMax.y;
  6287. maxBoxPt.z = zMax.z;
  6288. const naiveCenter = Cartesian3_default.midpoint(
  6289. minBoxPt,
  6290. maxBoxPt,
  6291. fromPointsNaiveCenterScratch
  6292. );
  6293. let naiveRadius = 0;
  6294. for (i2 = 0; i2 < numElements; i2 += stride) {
  6295. currentPos.x = positions[i2] + center.x;
  6296. currentPos.y = positions[i2 + 1] + center.y;
  6297. currentPos.z = positions[i2 + 2] + center.z;
  6298. const r2 = Cartesian3_default.magnitude(
  6299. Cartesian3_default.subtract(currentPos, naiveCenter, fromPointsScratch)
  6300. );
  6301. if (r2 > naiveRadius) {
  6302. naiveRadius = r2;
  6303. }
  6304. const oldCenterToPointSquared = Cartesian3_default.magnitudeSquared(
  6305. Cartesian3_default.subtract(currentPos, ritterCenter, fromPointsScratch)
  6306. );
  6307. if (oldCenterToPointSquared > radiusSquared) {
  6308. const oldCenterToPoint = Math.sqrt(oldCenterToPointSquared);
  6309. ritterRadius = (ritterRadius + oldCenterToPoint) * 0.5;
  6310. radiusSquared = ritterRadius * ritterRadius;
  6311. const oldToNew = oldCenterToPoint - ritterRadius;
  6312. ritterCenter.x = (ritterRadius * ritterCenter.x + oldToNew * currentPos.x) / oldCenterToPoint;
  6313. ritterCenter.y = (ritterRadius * ritterCenter.y + oldToNew * currentPos.y) / oldCenterToPoint;
  6314. ritterCenter.z = (ritterRadius * ritterCenter.z + oldToNew * currentPos.z) / oldCenterToPoint;
  6315. }
  6316. }
  6317. if (ritterRadius < naiveRadius) {
  6318. Cartesian3_default.clone(ritterCenter, result.center);
  6319. result.radius = ritterRadius;
  6320. } else {
  6321. Cartesian3_default.clone(naiveCenter, result.center);
  6322. result.radius = naiveRadius;
  6323. }
  6324. return result;
  6325. };
  6326. BoundingSphere.fromEncodedCartesianVertices = function(positionsHigh, positionsLow, result) {
  6327. if (!defined_default(result)) {
  6328. result = new BoundingSphere();
  6329. }
  6330. if (!defined_default(positionsHigh) || !defined_default(positionsLow) || positionsHigh.length !== positionsLow.length || positionsHigh.length === 0) {
  6331. result.center = Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
  6332. result.radius = 0;
  6333. return result;
  6334. }
  6335. const currentPos = fromPointsCurrentPos;
  6336. currentPos.x = positionsHigh[0] + positionsLow[0];
  6337. currentPos.y = positionsHigh[1] + positionsLow[1];
  6338. currentPos.z = positionsHigh[2] + positionsLow[2];
  6339. const xMin = Cartesian3_default.clone(currentPos, fromPointsXMin);
  6340. const yMin = Cartesian3_default.clone(currentPos, fromPointsYMin);
  6341. const zMin = Cartesian3_default.clone(currentPos, fromPointsZMin);
  6342. const xMax = Cartesian3_default.clone(currentPos, fromPointsXMax);
  6343. const yMax = Cartesian3_default.clone(currentPos, fromPointsYMax);
  6344. const zMax = Cartesian3_default.clone(currentPos, fromPointsZMax);
  6345. const numElements = positionsHigh.length;
  6346. let i2;
  6347. for (i2 = 0; i2 < numElements; i2 += 3) {
  6348. const x = positionsHigh[i2] + positionsLow[i2];
  6349. const y = positionsHigh[i2 + 1] + positionsLow[i2 + 1];
  6350. const z = positionsHigh[i2 + 2] + positionsLow[i2 + 2];
  6351. currentPos.x = x;
  6352. currentPos.y = y;
  6353. currentPos.z = z;
  6354. if (x < xMin.x) {
  6355. Cartesian3_default.clone(currentPos, xMin);
  6356. }
  6357. if (x > xMax.x) {
  6358. Cartesian3_default.clone(currentPos, xMax);
  6359. }
  6360. if (y < yMin.y) {
  6361. Cartesian3_default.clone(currentPos, yMin);
  6362. }
  6363. if (y > yMax.y) {
  6364. Cartesian3_default.clone(currentPos, yMax);
  6365. }
  6366. if (z < zMin.z) {
  6367. Cartesian3_default.clone(currentPos, zMin);
  6368. }
  6369. if (z > zMax.z) {
  6370. Cartesian3_default.clone(currentPos, zMax);
  6371. }
  6372. }
  6373. const xSpan = Cartesian3_default.magnitudeSquared(
  6374. Cartesian3_default.subtract(xMax, xMin, fromPointsScratch)
  6375. );
  6376. const ySpan = Cartesian3_default.magnitudeSquared(
  6377. Cartesian3_default.subtract(yMax, yMin, fromPointsScratch)
  6378. );
  6379. const zSpan = Cartesian3_default.magnitudeSquared(
  6380. Cartesian3_default.subtract(zMax, zMin, fromPointsScratch)
  6381. );
  6382. let diameter1 = xMin;
  6383. let diameter2 = xMax;
  6384. let maxSpan = xSpan;
  6385. if (ySpan > maxSpan) {
  6386. maxSpan = ySpan;
  6387. diameter1 = yMin;
  6388. diameter2 = yMax;
  6389. }
  6390. if (zSpan > maxSpan) {
  6391. maxSpan = zSpan;
  6392. diameter1 = zMin;
  6393. diameter2 = zMax;
  6394. }
  6395. const ritterCenter = fromPointsRitterCenter;
  6396. ritterCenter.x = (diameter1.x + diameter2.x) * 0.5;
  6397. ritterCenter.y = (diameter1.y + diameter2.y) * 0.5;
  6398. ritterCenter.z = (diameter1.z + diameter2.z) * 0.5;
  6399. let radiusSquared = Cartesian3_default.magnitudeSquared(
  6400. Cartesian3_default.subtract(diameter2, ritterCenter, fromPointsScratch)
  6401. );
  6402. let ritterRadius = Math.sqrt(radiusSquared);
  6403. const minBoxPt = fromPointsMinBoxPt;
  6404. minBoxPt.x = xMin.x;
  6405. minBoxPt.y = yMin.y;
  6406. minBoxPt.z = zMin.z;
  6407. const maxBoxPt = fromPointsMaxBoxPt;
  6408. maxBoxPt.x = xMax.x;
  6409. maxBoxPt.y = yMax.y;
  6410. maxBoxPt.z = zMax.z;
  6411. const naiveCenter = Cartesian3_default.midpoint(
  6412. minBoxPt,
  6413. maxBoxPt,
  6414. fromPointsNaiveCenterScratch
  6415. );
  6416. let naiveRadius = 0;
  6417. for (i2 = 0; i2 < numElements; i2 += 3) {
  6418. currentPos.x = positionsHigh[i2] + positionsLow[i2];
  6419. currentPos.y = positionsHigh[i2 + 1] + positionsLow[i2 + 1];
  6420. currentPos.z = positionsHigh[i2 + 2] + positionsLow[i2 + 2];
  6421. const r2 = Cartesian3_default.magnitude(
  6422. Cartesian3_default.subtract(currentPos, naiveCenter, fromPointsScratch)
  6423. );
  6424. if (r2 > naiveRadius) {
  6425. naiveRadius = r2;
  6426. }
  6427. const oldCenterToPointSquared = Cartesian3_default.magnitudeSquared(
  6428. Cartesian3_default.subtract(currentPos, ritterCenter, fromPointsScratch)
  6429. );
  6430. if (oldCenterToPointSquared > radiusSquared) {
  6431. const oldCenterToPoint = Math.sqrt(oldCenterToPointSquared);
  6432. ritterRadius = (ritterRadius + oldCenterToPoint) * 0.5;
  6433. radiusSquared = ritterRadius * ritterRadius;
  6434. const oldToNew = oldCenterToPoint - ritterRadius;
  6435. ritterCenter.x = (ritterRadius * ritterCenter.x + oldToNew * currentPos.x) / oldCenterToPoint;
  6436. ritterCenter.y = (ritterRadius * ritterCenter.y + oldToNew * currentPos.y) / oldCenterToPoint;
  6437. ritterCenter.z = (ritterRadius * ritterCenter.z + oldToNew * currentPos.z) / oldCenterToPoint;
  6438. }
  6439. }
  6440. if (ritterRadius < naiveRadius) {
  6441. Cartesian3_default.clone(ritterCenter, result.center);
  6442. result.radius = ritterRadius;
  6443. } else {
  6444. Cartesian3_default.clone(naiveCenter, result.center);
  6445. result.radius = naiveRadius;
  6446. }
  6447. return result;
  6448. };
  6449. BoundingSphere.fromCornerPoints = function(corner, oppositeCorner, result) {
  6450. Check_default.typeOf.object("corner", corner);
  6451. Check_default.typeOf.object("oppositeCorner", oppositeCorner);
  6452. if (!defined_default(result)) {
  6453. result = new BoundingSphere();
  6454. }
  6455. const center = Cartesian3_default.midpoint(corner, oppositeCorner, result.center);
  6456. result.radius = Cartesian3_default.distance(center, oppositeCorner);
  6457. return result;
  6458. };
  6459. BoundingSphere.fromEllipsoid = function(ellipsoid, result) {
  6460. Check_default.typeOf.object("ellipsoid", ellipsoid);
  6461. if (!defined_default(result)) {
  6462. result = new BoundingSphere();
  6463. }
  6464. Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
  6465. result.radius = ellipsoid.maximumRadius;
  6466. return result;
  6467. };
  6468. var fromBoundingSpheresScratch = new Cartesian3_default();
  6469. BoundingSphere.fromBoundingSpheres = function(boundingSpheres, result) {
  6470. if (!defined_default(result)) {
  6471. result = new BoundingSphere();
  6472. }
  6473. if (!defined_default(boundingSpheres) || boundingSpheres.length === 0) {
  6474. result.center = Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
  6475. result.radius = 0;
  6476. return result;
  6477. }
  6478. const length3 = boundingSpheres.length;
  6479. if (length3 === 1) {
  6480. return BoundingSphere.clone(boundingSpheres[0], result);
  6481. }
  6482. if (length3 === 2) {
  6483. return BoundingSphere.union(boundingSpheres[0], boundingSpheres[1], result);
  6484. }
  6485. const positions = [];
  6486. let i2;
  6487. for (i2 = 0; i2 < length3; i2++) {
  6488. positions.push(boundingSpheres[i2].center);
  6489. }
  6490. result = BoundingSphere.fromPoints(positions, result);
  6491. const center = result.center;
  6492. let radius = result.radius;
  6493. for (i2 = 0; i2 < length3; i2++) {
  6494. const tmp2 = boundingSpheres[i2];
  6495. radius = Math.max(
  6496. radius,
  6497. Cartesian3_default.distance(center, tmp2.center, fromBoundingSpheresScratch) + tmp2.radius
  6498. );
  6499. }
  6500. result.radius = radius;
  6501. return result;
  6502. };
  6503. var fromOrientedBoundingBoxScratchU = new Cartesian3_default();
  6504. var fromOrientedBoundingBoxScratchV = new Cartesian3_default();
  6505. var fromOrientedBoundingBoxScratchW = new Cartesian3_default();
  6506. BoundingSphere.fromOrientedBoundingBox = function(orientedBoundingBox, result) {
  6507. Check_default.defined("orientedBoundingBox", orientedBoundingBox);
  6508. if (!defined_default(result)) {
  6509. result = new BoundingSphere();
  6510. }
  6511. const halfAxes = orientedBoundingBox.halfAxes;
  6512. const u3 = Matrix3_default.getColumn(halfAxes, 0, fromOrientedBoundingBoxScratchU);
  6513. const v7 = Matrix3_default.getColumn(halfAxes, 1, fromOrientedBoundingBoxScratchV);
  6514. const w = Matrix3_default.getColumn(halfAxes, 2, fromOrientedBoundingBoxScratchW);
  6515. Cartesian3_default.add(u3, v7, u3);
  6516. Cartesian3_default.add(u3, w, u3);
  6517. result.center = Cartesian3_default.clone(orientedBoundingBox.center, result.center);
  6518. result.radius = Cartesian3_default.magnitude(u3);
  6519. return result;
  6520. };
  6521. var scratchFromTransformationCenter = new Cartesian3_default();
  6522. var scratchFromTransformationScale = new Cartesian3_default();
  6523. BoundingSphere.fromTransformation = function(transformation, result) {
  6524. Check_default.typeOf.object("transformation", transformation);
  6525. if (!defined_default(result)) {
  6526. result = new BoundingSphere();
  6527. }
  6528. const center = Matrix4_default.getTranslation(
  6529. transformation,
  6530. scratchFromTransformationCenter
  6531. );
  6532. const scale = Matrix4_default.getScale(
  6533. transformation,
  6534. scratchFromTransformationScale
  6535. );
  6536. const radius = 0.5 * Cartesian3_default.magnitude(scale);
  6537. result.center = Cartesian3_default.clone(center, result.center);
  6538. result.radius = radius;
  6539. return result;
  6540. };
  6541. BoundingSphere.clone = function(sphere, result) {
  6542. if (!defined_default(sphere)) {
  6543. return void 0;
  6544. }
  6545. if (!defined_default(result)) {
  6546. return new BoundingSphere(sphere.center, sphere.radius);
  6547. }
  6548. result.center = Cartesian3_default.clone(sphere.center, result.center);
  6549. result.radius = sphere.radius;
  6550. return result;
  6551. };
  6552. BoundingSphere.packedLength = 4;
  6553. BoundingSphere.pack = function(value, array, startingIndex) {
  6554. Check_default.typeOf.object("value", value);
  6555. Check_default.defined("array", array);
  6556. startingIndex = defaultValue_default(startingIndex, 0);
  6557. const center = value.center;
  6558. array[startingIndex++] = center.x;
  6559. array[startingIndex++] = center.y;
  6560. array[startingIndex++] = center.z;
  6561. array[startingIndex] = value.radius;
  6562. return array;
  6563. };
  6564. BoundingSphere.unpack = function(array, startingIndex, result) {
  6565. Check_default.defined("array", array);
  6566. startingIndex = defaultValue_default(startingIndex, 0);
  6567. if (!defined_default(result)) {
  6568. result = new BoundingSphere();
  6569. }
  6570. const center = result.center;
  6571. center.x = array[startingIndex++];
  6572. center.y = array[startingIndex++];
  6573. center.z = array[startingIndex++];
  6574. result.radius = array[startingIndex];
  6575. return result;
  6576. };
  6577. var unionScratch = new Cartesian3_default();
  6578. var unionScratchCenter = new Cartesian3_default();
  6579. BoundingSphere.union = function(left, right, result) {
  6580. Check_default.typeOf.object("left", left);
  6581. Check_default.typeOf.object("right", right);
  6582. if (!defined_default(result)) {
  6583. result = new BoundingSphere();
  6584. }
  6585. const leftCenter = left.center;
  6586. const leftRadius = left.radius;
  6587. const rightCenter = right.center;
  6588. const rightRadius = right.radius;
  6589. const toRightCenter = Cartesian3_default.subtract(
  6590. rightCenter,
  6591. leftCenter,
  6592. unionScratch
  6593. );
  6594. const centerSeparation = Cartesian3_default.magnitude(toRightCenter);
  6595. if (leftRadius >= centerSeparation + rightRadius) {
  6596. left.clone(result);
  6597. return result;
  6598. }
  6599. if (rightRadius >= centerSeparation + leftRadius) {
  6600. right.clone(result);
  6601. return result;
  6602. }
  6603. const halfDistanceBetweenTangentPoints = (leftRadius + centerSeparation + rightRadius) * 0.5;
  6604. const center = Cartesian3_default.multiplyByScalar(
  6605. toRightCenter,
  6606. (-leftRadius + halfDistanceBetweenTangentPoints) / centerSeparation,
  6607. unionScratchCenter
  6608. );
  6609. Cartesian3_default.add(center, leftCenter, center);
  6610. Cartesian3_default.clone(center, result.center);
  6611. result.radius = halfDistanceBetweenTangentPoints;
  6612. return result;
  6613. };
  6614. var expandScratch = new Cartesian3_default();
  6615. BoundingSphere.expand = function(sphere, point, result) {
  6616. Check_default.typeOf.object("sphere", sphere);
  6617. Check_default.typeOf.object("point", point);
  6618. result = BoundingSphere.clone(sphere, result);
  6619. const radius = Cartesian3_default.magnitude(
  6620. Cartesian3_default.subtract(point, result.center, expandScratch)
  6621. );
  6622. if (radius > result.radius) {
  6623. result.radius = radius;
  6624. }
  6625. return result;
  6626. };
  6627. BoundingSphere.intersectPlane = function(sphere, plane) {
  6628. Check_default.typeOf.object("sphere", sphere);
  6629. Check_default.typeOf.object("plane", plane);
  6630. const center = sphere.center;
  6631. const radius = sphere.radius;
  6632. const normal2 = plane.normal;
  6633. const distanceToPlane = Cartesian3_default.dot(normal2, center) + plane.distance;
  6634. if (distanceToPlane < -radius) {
  6635. return Intersect_default.OUTSIDE;
  6636. } else if (distanceToPlane < radius) {
  6637. return Intersect_default.INTERSECTING;
  6638. }
  6639. return Intersect_default.INSIDE;
  6640. };
  6641. BoundingSphere.transform = function(sphere, transform4, result) {
  6642. Check_default.typeOf.object("sphere", sphere);
  6643. Check_default.typeOf.object("transform", transform4);
  6644. if (!defined_default(result)) {
  6645. result = new BoundingSphere();
  6646. }
  6647. result.center = Matrix4_default.multiplyByPoint(
  6648. transform4,
  6649. sphere.center,
  6650. result.center
  6651. );
  6652. result.radius = Matrix4_default.getMaximumScale(transform4) * sphere.radius;
  6653. return result;
  6654. };
  6655. var distanceSquaredToScratch = new Cartesian3_default();
  6656. BoundingSphere.distanceSquaredTo = function(sphere, cartesian11) {
  6657. Check_default.typeOf.object("sphere", sphere);
  6658. Check_default.typeOf.object("cartesian", cartesian11);
  6659. const diff = Cartesian3_default.subtract(
  6660. sphere.center,
  6661. cartesian11,
  6662. distanceSquaredToScratch
  6663. );
  6664. const distance2 = Cartesian3_default.magnitude(diff) - sphere.radius;
  6665. if (distance2 <= 0) {
  6666. return 0;
  6667. }
  6668. return distance2 * distance2;
  6669. };
  6670. BoundingSphere.transformWithoutScale = function(sphere, transform4, result) {
  6671. Check_default.typeOf.object("sphere", sphere);
  6672. Check_default.typeOf.object("transform", transform4);
  6673. if (!defined_default(result)) {
  6674. result = new BoundingSphere();
  6675. }
  6676. result.center = Matrix4_default.multiplyByPoint(
  6677. transform4,
  6678. sphere.center,
  6679. result.center
  6680. );
  6681. result.radius = sphere.radius;
  6682. return result;
  6683. };
  6684. var scratchCartesian3 = new Cartesian3_default();
  6685. BoundingSphere.computePlaneDistances = function(sphere, position, direction2, result) {
  6686. Check_default.typeOf.object("sphere", sphere);
  6687. Check_default.typeOf.object("position", position);
  6688. Check_default.typeOf.object("direction", direction2);
  6689. if (!defined_default(result)) {
  6690. result = new Interval_default();
  6691. }
  6692. const toCenter = Cartesian3_default.subtract(
  6693. sphere.center,
  6694. position,
  6695. scratchCartesian3
  6696. );
  6697. const mag = Cartesian3_default.dot(direction2, toCenter);
  6698. result.start = mag - sphere.radius;
  6699. result.stop = mag + sphere.radius;
  6700. return result;
  6701. };
  6702. var projectTo2DNormalScratch = new Cartesian3_default();
  6703. var projectTo2DEastScratch = new Cartesian3_default();
  6704. var projectTo2DNorthScratch = new Cartesian3_default();
  6705. var projectTo2DWestScratch = new Cartesian3_default();
  6706. var projectTo2DSouthScratch = new Cartesian3_default();
  6707. var projectTo2DCartographicScratch = new Cartographic_default();
  6708. var projectTo2DPositionsScratch = new Array(8);
  6709. for (let n2 = 0; n2 < 8; ++n2) {
  6710. projectTo2DPositionsScratch[n2] = new Cartesian3_default();
  6711. }
  6712. var projectTo2DProjection = new GeographicProjection_default();
  6713. BoundingSphere.projectTo2D = function(sphere, projection, result) {
  6714. Check_default.typeOf.object("sphere", sphere);
  6715. projection = defaultValue_default(projection, projectTo2DProjection);
  6716. const ellipsoid = projection.ellipsoid;
  6717. let center = sphere.center;
  6718. const radius = sphere.radius;
  6719. let normal2;
  6720. if (Cartesian3_default.equals(center, Cartesian3_default.ZERO)) {
  6721. normal2 = Cartesian3_default.clone(Cartesian3_default.UNIT_X, projectTo2DNormalScratch);
  6722. } else {
  6723. normal2 = ellipsoid.geodeticSurfaceNormal(center, projectTo2DNormalScratch);
  6724. }
  6725. const east = Cartesian3_default.cross(
  6726. Cartesian3_default.UNIT_Z,
  6727. normal2,
  6728. projectTo2DEastScratch
  6729. );
  6730. Cartesian3_default.normalize(east, east);
  6731. const north = Cartesian3_default.cross(normal2, east, projectTo2DNorthScratch);
  6732. Cartesian3_default.normalize(north, north);
  6733. Cartesian3_default.multiplyByScalar(normal2, radius, normal2);
  6734. Cartesian3_default.multiplyByScalar(north, radius, north);
  6735. Cartesian3_default.multiplyByScalar(east, radius, east);
  6736. const south = Cartesian3_default.negate(north, projectTo2DSouthScratch);
  6737. const west = Cartesian3_default.negate(east, projectTo2DWestScratch);
  6738. const positions = projectTo2DPositionsScratch;
  6739. let corner = positions[0];
  6740. Cartesian3_default.add(normal2, north, corner);
  6741. Cartesian3_default.add(corner, east, corner);
  6742. corner = positions[1];
  6743. Cartesian3_default.add(normal2, north, corner);
  6744. Cartesian3_default.add(corner, west, corner);
  6745. corner = positions[2];
  6746. Cartesian3_default.add(normal2, south, corner);
  6747. Cartesian3_default.add(corner, west, corner);
  6748. corner = positions[3];
  6749. Cartesian3_default.add(normal2, south, corner);
  6750. Cartesian3_default.add(corner, east, corner);
  6751. Cartesian3_default.negate(normal2, normal2);
  6752. corner = positions[4];
  6753. Cartesian3_default.add(normal2, north, corner);
  6754. Cartesian3_default.add(corner, east, corner);
  6755. corner = positions[5];
  6756. Cartesian3_default.add(normal2, north, corner);
  6757. Cartesian3_default.add(corner, west, corner);
  6758. corner = positions[6];
  6759. Cartesian3_default.add(normal2, south, corner);
  6760. Cartesian3_default.add(corner, west, corner);
  6761. corner = positions[7];
  6762. Cartesian3_default.add(normal2, south, corner);
  6763. Cartesian3_default.add(corner, east, corner);
  6764. const length3 = positions.length;
  6765. for (let i2 = 0; i2 < length3; ++i2) {
  6766. const position = positions[i2];
  6767. Cartesian3_default.add(center, position, position);
  6768. const cartographic2 = ellipsoid.cartesianToCartographic(
  6769. position,
  6770. projectTo2DCartographicScratch
  6771. );
  6772. projection.project(cartographic2, position);
  6773. }
  6774. result = BoundingSphere.fromPoints(positions, result);
  6775. center = result.center;
  6776. const x = center.x;
  6777. const y = center.y;
  6778. const z = center.z;
  6779. center.x = z;
  6780. center.y = x;
  6781. center.z = y;
  6782. return result;
  6783. };
  6784. BoundingSphere.isOccluded = function(sphere, occluder) {
  6785. Check_default.typeOf.object("sphere", sphere);
  6786. Check_default.typeOf.object("occluder", occluder);
  6787. return !occluder.isBoundingSphereVisible(sphere);
  6788. };
  6789. BoundingSphere.equals = function(left, right) {
  6790. return left === right || defined_default(left) && defined_default(right) && Cartesian3_default.equals(left.center, right.center) && left.radius === right.radius;
  6791. };
  6792. BoundingSphere.prototype.intersectPlane = function(plane) {
  6793. return BoundingSphere.intersectPlane(this, plane);
  6794. };
  6795. BoundingSphere.prototype.distanceSquaredTo = function(cartesian11) {
  6796. return BoundingSphere.distanceSquaredTo(this, cartesian11);
  6797. };
  6798. BoundingSphere.prototype.computePlaneDistances = function(position, direction2, result) {
  6799. return BoundingSphere.computePlaneDistances(
  6800. this,
  6801. position,
  6802. direction2,
  6803. result
  6804. );
  6805. };
  6806. BoundingSphere.prototype.isOccluded = function(occluder) {
  6807. return BoundingSphere.isOccluded(this, occluder);
  6808. };
  6809. BoundingSphere.prototype.equals = function(right) {
  6810. return BoundingSphere.equals(this, right);
  6811. };
  6812. BoundingSphere.prototype.clone = function(result) {
  6813. return BoundingSphere.clone(this, result);
  6814. };
  6815. BoundingSphere.prototype.volume = function() {
  6816. const radius = this.radius;
  6817. return volumeConstant * radius * radius * radius;
  6818. };
  6819. var BoundingSphere_default = BoundingSphere;
  6820. // node_modules/cesium/Source/ThirdParty/_commonjsHelpers-3aae1032.js
  6821. var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  6822. function createCommonjsModule(fn, basedir, module2) {
  6823. return module2 = {
  6824. path: basedir,
  6825. exports: {},
  6826. require: function(path, base) {
  6827. return commonjsRequire(path, base === void 0 || base === null ? module2.path : base);
  6828. }
  6829. }, fn(module2, module2.exports), module2.exports;
  6830. }
  6831. function commonjsRequire() {
  6832. throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");
  6833. }
  6834. // node_modules/cesium/Source/ThirdParty/Uri.js
  6835. var punycode = createCommonjsModule(function(module2, exports2) {
  6836. (function(root) {
  6837. var freeExports = exports2 && !exports2.nodeType && exports2;
  6838. var freeModule = module2 && !module2.nodeType && module2;
  6839. var freeGlobal = typeof commonjsGlobal == "object" && commonjsGlobal;
  6840. if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal) {
  6841. root = freeGlobal;
  6842. }
  6843. var punycode2, maxInt = 2147483647, base = 36, tMin = 1, tMax = 26, skew = 38, damp = 700, initialBias = 72, initialN = 128, delimiter = "-", regexPunycode = /^xn--/, regexNonASCII = /[^\x20-\x7E]/, regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, errors = {
  6844. "overflow": "Overflow: input needs wider integers to process",
  6845. "not-basic": "Illegal input >= 0x80 (not a basic code point)",
  6846. "invalid-input": "Invalid input"
  6847. }, baseMinusTMin = base - tMin, floor = Math.floor, stringFromCharCode = String.fromCharCode, key;
  6848. function error(type) {
  6849. throw new RangeError(errors[type]);
  6850. }
  6851. function map(array, fn) {
  6852. var length3 = array.length;
  6853. var result = [];
  6854. while (length3--) {
  6855. result[length3] = fn(array[length3]);
  6856. }
  6857. return result;
  6858. }
  6859. function mapDomain(string, fn) {
  6860. var parts = string.split("@");
  6861. var result = "";
  6862. if (parts.length > 1) {
  6863. result = parts[0] + "@";
  6864. string = parts[1];
  6865. }
  6866. string = string.replace(regexSeparators, ".");
  6867. var labels = string.split(".");
  6868. var encoded = map(labels, fn).join(".");
  6869. return result + encoded;
  6870. }
  6871. function ucs2decode(string) {
  6872. var output = [], counter = 0, length3 = string.length, value, extra;
  6873. while (counter < length3) {
  6874. value = string.charCodeAt(counter++);
  6875. if (value >= 55296 && value <= 56319 && counter < length3) {
  6876. extra = string.charCodeAt(counter++);
  6877. if ((extra & 64512) == 56320) {
  6878. output.push(((value & 1023) << 10) + (extra & 1023) + 65536);
  6879. } else {
  6880. output.push(value);
  6881. counter--;
  6882. }
  6883. } else {
  6884. output.push(value);
  6885. }
  6886. }
  6887. return output;
  6888. }
  6889. function ucs2encode(array) {
  6890. return map(array, function(value) {
  6891. var output = "";
  6892. if (value > 65535) {
  6893. value -= 65536;
  6894. output += stringFromCharCode(value >>> 10 & 1023 | 55296);
  6895. value = 56320 | value & 1023;
  6896. }
  6897. output += stringFromCharCode(value);
  6898. return output;
  6899. }).join("");
  6900. }
  6901. function basicToDigit(codePoint) {
  6902. if (codePoint - 48 < 10) {
  6903. return codePoint - 22;
  6904. }
  6905. if (codePoint - 65 < 26) {
  6906. return codePoint - 65;
  6907. }
  6908. if (codePoint - 97 < 26) {
  6909. return codePoint - 97;
  6910. }
  6911. return base;
  6912. }
  6913. function digitToBasic(digit, flag) {
  6914. return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
  6915. }
  6916. function adapt(delta, numPoints, firstTime) {
  6917. var k = 0;
  6918. delta = firstTime ? floor(delta / damp) : delta >> 1;
  6919. delta += floor(delta / numPoints);
  6920. for (; delta > baseMinusTMin * tMax >> 1; k += base) {
  6921. delta = floor(delta / baseMinusTMin);
  6922. }
  6923. return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
  6924. }
  6925. function decode(input) {
  6926. var output = [], inputLength = input.length, out, i2 = 0, n2 = initialN, bias = initialBias, basic, j, index2, oldi, w, k, digit, t, baseMinusT;
  6927. basic = input.lastIndexOf(delimiter);
  6928. if (basic < 0) {
  6929. basic = 0;
  6930. }
  6931. for (j = 0; j < basic; ++j) {
  6932. if (input.charCodeAt(j) >= 128) {
  6933. error("not-basic");
  6934. }
  6935. output.push(input.charCodeAt(j));
  6936. }
  6937. for (index2 = basic > 0 ? basic + 1 : 0; index2 < inputLength; ) {
  6938. for (oldi = i2, w = 1, k = base; ; k += base) {
  6939. if (index2 >= inputLength) {
  6940. error("invalid-input");
  6941. }
  6942. digit = basicToDigit(input.charCodeAt(index2++));
  6943. if (digit >= base || digit > floor((maxInt - i2) / w)) {
  6944. error("overflow");
  6945. }
  6946. i2 += digit * w;
  6947. t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
  6948. if (digit < t) {
  6949. break;
  6950. }
  6951. baseMinusT = base - t;
  6952. if (w > floor(maxInt / baseMinusT)) {
  6953. error("overflow");
  6954. }
  6955. w *= baseMinusT;
  6956. }
  6957. out = output.length + 1;
  6958. bias = adapt(i2 - oldi, out, oldi == 0);
  6959. if (floor(i2 / out) > maxInt - n2) {
  6960. error("overflow");
  6961. }
  6962. n2 += floor(i2 / out);
  6963. i2 %= out;
  6964. output.splice(i2++, 0, n2);
  6965. }
  6966. return ucs2encode(output);
  6967. }
  6968. function encode(input) {
  6969. var n2, delta, handledCPCount, basicLength, bias, j, m, q, k, t, currentValue, output = [], inputLength, handledCPCountPlusOne, baseMinusT, qMinusT;
  6970. input = ucs2decode(input);
  6971. inputLength = input.length;
  6972. n2 = initialN;
  6973. delta = 0;
  6974. bias = initialBias;
  6975. for (j = 0; j < inputLength; ++j) {
  6976. currentValue = input[j];
  6977. if (currentValue < 128) {
  6978. output.push(stringFromCharCode(currentValue));
  6979. }
  6980. }
  6981. handledCPCount = basicLength = output.length;
  6982. if (basicLength) {
  6983. output.push(delimiter);
  6984. }
  6985. while (handledCPCount < inputLength) {
  6986. for (m = maxInt, j = 0; j < inputLength; ++j) {
  6987. currentValue = input[j];
  6988. if (currentValue >= n2 && currentValue < m) {
  6989. m = currentValue;
  6990. }
  6991. }
  6992. handledCPCountPlusOne = handledCPCount + 1;
  6993. if (m - n2 > floor((maxInt - delta) / handledCPCountPlusOne)) {
  6994. error("overflow");
  6995. }
  6996. delta += (m - n2) * handledCPCountPlusOne;
  6997. n2 = m;
  6998. for (j = 0; j < inputLength; ++j) {
  6999. currentValue = input[j];
  7000. if (currentValue < n2 && ++delta > maxInt) {
  7001. error("overflow");
  7002. }
  7003. if (currentValue == n2) {
  7004. for (q = delta, k = base; ; k += base) {
  7005. t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias;
  7006. if (q < t) {
  7007. break;
  7008. }
  7009. qMinusT = q - t;
  7010. baseMinusT = base - t;
  7011. output.push(
  7012. stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
  7013. );
  7014. q = floor(qMinusT / baseMinusT);
  7015. }
  7016. output.push(stringFromCharCode(digitToBasic(q, 0)));
  7017. bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
  7018. delta = 0;
  7019. ++handledCPCount;
  7020. }
  7021. }
  7022. ++delta;
  7023. ++n2;
  7024. }
  7025. return output.join("");
  7026. }
  7027. function toUnicode(input) {
  7028. return mapDomain(input, function(string) {
  7029. return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
  7030. });
  7031. }
  7032. function toASCII(input) {
  7033. return mapDomain(input, function(string) {
  7034. return regexNonASCII.test(string) ? "xn--" + encode(string) : string;
  7035. });
  7036. }
  7037. punycode2 = {
  7038. "version": "1.3.2",
  7039. "ucs2": {
  7040. "decode": ucs2decode,
  7041. "encode": ucs2encode
  7042. },
  7043. "decode": decode,
  7044. "encode": encode,
  7045. "toASCII": toASCII,
  7046. "toUnicode": toUnicode
  7047. };
  7048. if (freeExports && freeModule) {
  7049. if (module2.exports == freeExports) {
  7050. freeModule.exports = punycode2;
  7051. } else {
  7052. for (key in punycode2) {
  7053. punycode2.hasOwnProperty(key) && (freeExports[key] = punycode2[key]);
  7054. }
  7055. }
  7056. } else {
  7057. root.punycode = punycode2;
  7058. }
  7059. })(commonjsGlobal);
  7060. });
  7061. var IPv6 = createCommonjsModule(function(module2) {
  7062. (function(root, factory) {
  7063. if (module2.exports) {
  7064. module2.exports = factory();
  7065. } else {
  7066. root.IPv6 = factory(root);
  7067. }
  7068. })(commonjsGlobal, function(root) {
  7069. var _IPv6 = root && root.IPv6;
  7070. function bestPresentation(address) {
  7071. var _address = address.toLowerCase();
  7072. var segments = _address.split(":");
  7073. var length3 = segments.length;
  7074. var total = 8;
  7075. if (segments[0] === "" && segments[1] === "" && segments[2] === "") {
  7076. segments.shift();
  7077. segments.shift();
  7078. } else if (segments[0] === "" && segments[1] === "") {
  7079. segments.shift();
  7080. } else if (segments[length3 - 1] === "" && segments[length3 - 2] === "") {
  7081. segments.pop();
  7082. }
  7083. length3 = segments.length;
  7084. if (segments[length3 - 1].indexOf(".") !== -1) {
  7085. total = 7;
  7086. }
  7087. var pos;
  7088. for (pos = 0; pos < length3; pos++) {
  7089. if (segments[pos] === "") {
  7090. break;
  7091. }
  7092. }
  7093. if (pos < total) {
  7094. segments.splice(pos, 1, "0000");
  7095. while (segments.length < total) {
  7096. segments.splice(pos, 0, "0000");
  7097. }
  7098. }
  7099. var _segments;
  7100. for (var i2 = 0; i2 < total; i2++) {
  7101. _segments = segments[i2].split("");
  7102. for (var j = 0; j < 3; j++) {
  7103. if (_segments[0] === "0" && _segments.length > 1) {
  7104. _segments.splice(0, 1);
  7105. } else {
  7106. break;
  7107. }
  7108. }
  7109. segments[i2] = _segments.join("");
  7110. }
  7111. var best = -1;
  7112. var _best = 0;
  7113. var _current = 0;
  7114. var current = -1;
  7115. var inzeroes = false;
  7116. for (i2 = 0; i2 < total; i2++) {
  7117. if (inzeroes) {
  7118. if (segments[i2] === "0") {
  7119. _current += 1;
  7120. } else {
  7121. inzeroes = false;
  7122. if (_current > _best) {
  7123. best = current;
  7124. _best = _current;
  7125. }
  7126. }
  7127. } else {
  7128. if (segments[i2] === "0") {
  7129. inzeroes = true;
  7130. current = i2;
  7131. _current = 1;
  7132. }
  7133. }
  7134. }
  7135. if (_current > _best) {
  7136. best = current;
  7137. _best = _current;
  7138. }
  7139. if (_best > 1) {
  7140. segments.splice(best, _best, "");
  7141. }
  7142. length3 = segments.length;
  7143. var result = "";
  7144. if (segments[0] === "") {
  7145. result = ":";
  7146. }
  7147. for (i2 = 0; i2 < length3; i2++) {
  7148. result += segments[i2];
  7149. if (i2 === length3 - 1) {
  7150. break;
  7151. }
  7152. result += ":";
  7153. }
  7154. if (segments[length3 - 1] === "") {
  7155. result += ":";
  7156. }
  7157. return result;
  7158. }
  7159. function noConflict() {
  7160. if (root.IPv6 === this) {
  7161. root.IPv6 = _IPv6;
  7162. }
  7163. return this;
  7164. }
  7165. return {
  7166. best: bestPresentation,
  7167. noConflict
  7168. };
  7169. });
  7170. });
  7171. var SecondLevelDomains = createCommonjsModule(function(module2) {
  7172. (function(root, factory) {
  7173. if (module2.exports) {
  7174. module2.exports = factory();
  7175. } else {
  7176. root.SecondLevelDomains = factory(root);
  7177. }
  7178. })(commonjsGlobal, function(root) {
  7179. var _SecondLevelDomains = root && root.SecondLevelDomains;
  7180. var SLD = {
  7181. list: {
  7182. "ac": " com gov mil net org ",
  7183. "ae": " ac co gov mil name net org pro sch ",
  7184. "af": " com edu gov net org ",
  7185. "al": " com edu gov mil net org ",
  7186. "ao": " co ed gv it og pb ",
  7187. "ar": " com edu gob gov int mil net org tur ",
  7188. "at": " ac co gv or ",
  7189. "au": " asn com csiro edu gov id net org ",
  7190. "ba": " co com edu gov mil net org rs unbi unmo unsa untz unze ",
  7191. "bb": " biz co com edu gov info net org store tv ",
  7192. "bh": " biz cc com edu gov info net org ",
  7193. "bn": " com edu gov net org ",
  7194. "bo": " com edu gob gov int mil net org tv ",
  7195. "br": " adm adv agr am arq art ato b bio blog bmd cim cng cnt com coop ecn edu eng esp etc eti far flog fm fnd fot fst g12 ggf gov imb ind inf jor jus lel mat med mil mus net nom not ntr odo org ppg pro psc psi qsl rec slg srv tmp trd tur tv vet vlog wiki zlg ",
  7196. "bs": " com edu gov net org ",
  7197. "bz": " du et om ov rg ",
  7198. "ca": " ab bc mb nb nf nl ns nt nu on pe qc sk yk ",
  7199. "ck": " biz co edu gen gov info net org ",
  7200. "cn": " ac ah bj com cq edu fj gd gov gs gx gz ha hb he hi hl hn jl js jx ln mil net nm nx org qh sc sd sh sn sx tj tw xj xz yn zj ",
  7201. "co": " com edu gov mil net nom org ",
  7202. "cr": " ac c co ed fi go or sa ",
  7203. "cy": " ac biz com ekloges gov ltd name net org parliament press pro tm ",
  7204. "do": " art com edu gob gov mil net org sld web ",
  7205. "dz": " art asso com edu gov net org pol ",
  7206. "ec": " com edu fin gov info med mil net org pro ",
  7207. "eg": " com edu eun gov mil name net org sci ",
  7208. "er": " com edu gov ind mil net org rochest w ",
  7209. "es": " com edu gob nom org ",
  7210. "et": " biz com edu gov info name net org ",
  7211. "fj": " ac biz com info mil name net org pro ",
  7212. "fk": " ac co gov net nom org ",
  7213. "fr": " asso com f gouv nom prd presse tm ",
  7214. "gg": " co net org ",
  7215. "gh": " com edu gov mil org ",
  7216. "gn": " ac com gov net org ",
  7217. "gr": " com edu gov mil net org ",
  7218. "gt": " com edu gob ind mil net org ",
  7219. "gu": " com edu gov net org ",
  7220. "hk": " com edu gov idv net org ",
  7221. "hu": " 2000 agrar bolt casino city co erotica erotika film forum games hotel info ingatlan jogasz konyvelo lakas media news org priv reklam sex shop sport suli szex tm tozsde utazas video ",
  7222. "id": " ac co go mil net or sch web ",
  7223. "il": " ac co gov idf k12 muni net org ",
  7224. "in": " ac co edu ernet firm gen gov i ind mil net nic org res ",
  7225. "iq": " com edu gov i mil net org ",
  7226. "ir": " ac co dnssec gov i id net org sch ",
  7227. "it": " edu gov ",
  7228. "je": " co net org ",
  7229. "jo": " com edu gov mil name net org sch ",
  7230. "jp": " ac ad co ed go gr lg ne or ",
  7231. "ke": " ac co go info me mobi ne or sc ",
  7232. "kh": " com edu gov mil net org per ",
  7233. "ki": " biz com de edu gov info mob net org tel ",
  7234. "km": " asso com coop edu gouv k medecin mil nom notaires pharmaciens presse tm veterinaire ",
  7235. "kn": " edu gov net org ",
  7236. "kr": " ac busan chungbuk chungnam co daegu daejeon es gangwon go gwangju gyeongbuk gyeonggi gyeongnam hs incheon jeju jeonbuk jeonnam k kg mil ms ne or pe re sc seoul ulsan ",
  7237. "kw": " com edu gov net org ",
  7238. "ky": " com edu gov net org ",
  7239. "kz": " com edu gov mil net org ",
  7240. "lb": " com edu gov net org ",
  7241. "lk": " assn com edu gov grp hotel int ltd net ngo org sch soc web ",
  7242. "lr": " com edu gov net org ",
  7243. "lv": " asn com conf edu gov id mil net org ",
  7244. "ly": " com edu gov id med net org plc sch ",
  7245. "ma": " ac co gov m net org press ",
  7246. "mc": " asso tm ",
  7247. "me": " ac co edu gov its net org priv ",
  7248. "mg": " com edu gov mil nom org prd tm ",
  7249. "mk": " com edu gov inf name net org pro ",
  7250. "ml": " com edu gov net org presse ",
  7251. "mn": " edu gov org ",
  7252. "mo": " com edu gov net org ",
  7253. "mt": " com edu gov net org ",
  7254. "mv": " aero biz com coop edu gov info int mil museum name net org pro ",
  7255. "mw": " ac co com coop edu gov int museum net org ",
  7256. "mx": " com edu gob net org ",
  7257. "my": " com edu gov mil name net org sch ",
  7258. "nf": " arts com firm info net other per rec store web ",
  7259. "ng": " biz com edu gov mil mobi name net org sch ",
  7260. "ni": " ac co com edu gob mil net nom org ",
  7261. "np": " com edu gov mil net org ",
  7262. "nr": " biz com edu gov info net org ",
  7263. "om": " ac biz co com edu gov med mil museum net org pro sch ",
  7264. "pe": " com edu gob mil net nom org sld ",
  7265. "ph": " com edu gov i mil net ngo org ",
  7266. "pk": " biz com edu fam gob gok gon gop gos gov net org web ",
  7267. "pl": " art bialystok biz com edu gda gdansk gorzow gov info katowice krakow lodz lublin mil net ngo olsztyn org poznan pwr radom slupsk szczecin torun warszawa waw wroc wroclaw zgora ",
  7268. "pr": " ac biz com edu est gov info isla name net org pro prof ",
  7269. "ps": " com edu gov net org plo sec ",
  7270. "pw": " belau co ed go ne or ",
  7271. "ro": " arts com firm info nom nt org rec store tm www ",
  7272. "rs": " ac co edu gov in org ",
  7273. "sb": " com edu gov net org ",
  7274. "sc": " com edu gov net org ",
  7275. "sh": " co com edu gov net nom org ",
  7276. "sl": " com edu gov net org ",
  7277. "st": " co com consulado edu embaixada gov mil net org principe saotome store ",
  7278. "sv": " com edu gob org red ",
  7279. "sz": " ac co org ",
  7280. "tr": " av bbs bel biz com dr edu gen gov info k12 name net org pol tel tsk tv web ",
  7281. "tt": " aero biz cat co com coop edu gov info int jobs mil mobi museum name net org pro tel travel ",
  7282. "tw": " club com ebiz edu game gov idv mil net org ",
  7283. "mu": " ac co com gov net or org ",
  7284. "mz": " ac co edu gov org ",
  7285. "na": " co com ",
  7286. "nz": " ac co cri geek gen govt health iwi maori mil net org parliament school ",
  7287. "pa": " abo ac com edu gob ing med net nom org sld ",
  7288. "pt": " com edu gov int net nome org publ ",
  7289. "py": " com edu gov mil net org ",
  7290. "qa": " com edu gov mil net org ",
  7291. "re": " asso com nom ",
  7292. "ru": " ac adygeya altai amur arkhangelsk astrakhan bashkiria belgorod bir bryansk buryatia cbg chel chelyabinsk chita chukotka chuvashia com dagestan e-burg edu gov grozny int irkutsk ivanovo izhevsk jar joshkar-ola kalmykia kaluga kamchatka karelia kazan kchr kemerovo khabarovsk khakassia khv kirov koenig komi kostroma kranoyarsk kuban kurgan kursk lipetsk magadan mari mari-el marine mil mordovia mosreg msk murmansk nalchik net nnov nov novosibirsk nsk omsk orenburg org oryol penza perm pp pskov ptz rnd ryazan sakhalin samara saratov simbirsk smolensk spb stavropol stv surgut tambov tatarstan tom tomsk tsaritsyn tsk tula tuva tver tyumen udm udmurtia ulan-ude vladikavkaz vladimir vladivostok volgograd vologda voronezh vrn vyatka yakutia yamal yekaterinburg yuzhno-sakhalinsk ",
  7293. "rw": " ac co com edu gouv gov int mil net ",
  7294. "sa": " com edu gov med net org pub sch ",
  7295. "sd": " com edu gov info med net org tv ",
  7296. "se": " a ac b bd c d e f g h i k l m n o org p parti pp press r s t tm u w x y z ",
  7297. "sg": " com edu gov idn net org per ",
  7298. "sn": " art com edu gouv org perso univ ",
  7299. "sy": " com edu gov mil net news org ",
  7300. "th": " ac co go in mi net or ",
  7301. "tj": " ac biz co com edu go gov info int mil name net nic org test web ",
  7302. "tn": " agrinet com defense edunet ens fin gov ind info intl mincom nat net org perso rnrt rns rnu tourism ",
  7303. "tz": " ac co go ne or ",
  7304. "ua": " biz cherkassy chernigov chernovtsy ck cn co com crimea cv dn dnepropetrovsk donetsk dp edu gov if in ivano-frankivsk kh kharkov kherson khmelnitskiy kiev kirovograd km kr ks kv lg lugansk lutsk lviv me mk net nikolaev od odessa org pl poltava pp rovno rv sebastopol sumy te ternopil uzhgorod vinnica vn zaporizhzhe zhitomir zp zt ",
  7305. "ug": " ac co go ne or org sc ",
  7306. "uk": " ac bl british-library co cym gov govt icnet jet lea ltd me mil mod national-library-scotland nel net nhs nic nls org orgn parliament plc police sch scot soc ",
  7307. "us": " dni fed isa kids nsn ",
  7308. "uy": " com edu gub mil net org ",
  7309. "ve": " co com edu gob info mil net org web ",
  7310. "vi": " co com k12 net org ",
  7311. "vn": " ac biz com edu gov health info int name net org pro ",
  7312. "ye": " co com gov ltd me net org plc ",
  7313. "yu": " ac co edu gov org ",
  7314. "za": " ac agric alt bourse city co cybernet db edu gov grondar iaccess imt inca landesign law mil net ngo nis nom olivetti org pix school tm web ",
  7315. "zm": " ac co com edu gov net org sch ",
  7316. "com": "ar br cn de eu gb gr hu jpn kr no qc ru sa se uk us uy za ",
  7317. "net": "gb jp se uk ",
  7318. "org": "ae",
  7319. "de": "com "
  7320. },
  7321. has: function(domain) {
  7322. var tldOffset = domain.lastIndexOf(".");
  7323. if (tldOffset <= 0 || tldOffset >= domain.length - 1) {
  7324. return false;
  7325. }
  7326. var sldOffset = domain.lastIndexOf(".", tldOffset - 1);
  7327. if (sldOffset <= 0 || sldOffset >= tldOffset - 1) {
  7328. return false;
  7329. }
  7330. var sldList = SLD.list[domain.slice(tldOffset + 1)];
  7331. if (!sldList) {
  7332. return false;
  7333. }
  7334. return sldList.indexOf(" " + domain.slice(sldOffset + 1, tldOffset) + " ") >= 0;
  7335. },
  7336. is: function(domain) {
  7337. var tldOffset = domain.lastIndexOf(".");
  7338. if (tldOffset <= 0 || tldOffset >= domain.length - 1) {
  7339. return false;
  7340. }
  7341. var sldOffset = domain.lastIndexOf(".", tldOffset - 1);
  7342. if (sldOffset >= 0) {
  7343. return false;
  7344. }
  7345. var sldList = SLD.list[domain.slice(tldOffset + 1)];
  7346. if (!sldList) {
  7347. return false;
  7348. }
  7349. return sldList.indexOf(" " + domain.slice(0, tldOffset) + " ") >= 0;
  7350. },
  7351. get: function(domain) {
  7352. var tldOffset = domain.lastIndexOf(".");
  7353. if (tldOffset <= 0 || tldOffset >= domain.length - 1) {
  7354. return null;
  7355. }
  7356. var sldOffset = domain.lastIndexOf(".", tldOffset - 1);
  7357. if (sldOffset <= 0 || sldOffset >= tldOffset - 1) {
  7358. return null;
  7359. }
  7360. var sldList = SLD.list[domain.slice(tldOffset + 1)];
  7361. if (!sldList) {
  7362. return null;
  7363. }
  7364. if (sldList.indexOf(" " + domain.slice(sldOffset + 1, tldOffset) + " ") < 0) {
  7365. return null;
  7366. }
  7367. return domain.slice(sldOffset + 1);
  7368. },
  7369. noConflict: function() {
  7370. if (root.SecondLevelDomains === this) {
  7371. root.SecondLevelDomains = _SecondLevelDomains;
  7372. }
  7373. return this;
  7374. }
  7375. };
  7376. return SLD;
  7377. });
  7378. });
  7379. var URI = createCommonjsModule(function(module2) {
  7380. (function(root, factory) {
  7381. if (module2.exports) {
  7382. module2.exports = factory(punycode, IPv6, SecondLevelDomains);
  7383. } else {
  7384. root.URI = factory(root.punycode, root.IPv6, root.SecondLevelDomains, root);
  7385. }
  7386. })(commonjsGlobal, function(punycode2, IPv62, SLD, root) {
  7387. var _URI = root && root.URI;
  7388. function URI2(url2, base) {
  7389. var _urlSupplied = arguments.length >= 1;
  7390. var _baseSupplied = arguments.length >= 2;
  7391. if (!(this instanceof URI2)) {
  7392. if (_urlSupplied) {
  7393. if (_baseSupplied) {
  7394. return new URI2(url2, base);
  7395. }
  7396. return new URI2(url2);
  7397. }
  7398. return new URI2();
  7399. }
  7400. if (url2 === void 0) {
  7401. if (_urlSupplied) {
  7402. throw new TypeError("undefined is not a valid argument for URI");
  7403. }
  7404. if (typeof location !== "undefined") {
  7405. url2 = location.href + "";
  7406. } else {
  7407. url2 = "";
  7408. }
  7409. }
  7410. if (url2 === null) {
  7411. if (_urlSupplied) {
  7412. throw new TypeError("null is not a valid argument for URI");
  7413. }
  7414. }
  7415. this.href(url2);
  7416. if (base !== void 0) {
  7417. return this.absoluteTo(base);
  7418. }
  7419. return this;
  7420. }
  7421. function isInteger(value) {
  7422. return /^[0-9]+$/.test(value);
  7423. }
  7424. URI2.version = "1.19.11";
  7425. var p2 = URI2.prototype;
  7426. var hasOwn = Object.prototype.hasOwnProperty;
  7427. function escapeRegEx(string) {
  7428. return string.replace(/([.*+?^=!:${}()|[\]\/\\])/g, "\\$1");
  7429. }
  7430. function getType(value) {
  7431. if (value === void 0) {
  7432. return "Undefined";
  7433. }
  7434. return String(Object.prototype.toString.call(value)).slice(8, -1);
  7435. }
  7436. function isArray(obj) {
  7437. return getType(obj) === "Array";
  7438. }
  7439. function filterArrayValues(data, value) {
  7440. var lookup = {};
  7441. var i2, length3;
  7442. if (getType(value) === "RegExp") {
  7443. lookup = null;
  7444. } else if (isArray(value)) {
  7445. for (i2 = 0, length3 = value.length; i2 < length3; i2++) {
  7446. lookup[value[i2]] = true;
  7447. }
  7448. } else {
  7449. lookup[value] = true;
  7450. }
  7451. for (i2 = 0, length3 = data.length; i2 < length3; i2++) {
  7452. var _match = lookup && lookup[data[i2]] !== void 0 || !lookup && value.test(data[i2]);
  7453. if (_match) {
  7454. data.splice(i2, 1);
  7455. length3--;
  7456. i2--;
  7457. }
  7458. }
  7459. return data;
  7460. }
  7461. function arrayContains(list, value) {
  7462. var i2, length3;
  7463. if (isArray(value)) {
  7464. for (i2 = 0, length3 = value.length; i2 < length3; i2++) {
  7465. if (!arrayContains(list, value[i2])) {
  7466. return false;
  7467. }
  7468. }
  7469. return true;
  7470. }
  7471. var _type = getType(value);
  7472. for (i2 = 0, length3 = list.length; i2 < length3; i2++) {
  7473. if (_type === "RegExp") {
  7474. if (typeof list[i2] === "string" && list[i2].match(value)) {
  7475. return true;
  7476. }
  7477. } else if (list[i2] === value) {
  7478. return true;
  7479. }
  7480. }
  7481. return false;
  7482. }
  7483. function arraysEqual(one, two) {
  7484. if (!isArray(one) || !isArray(two)) {
  7485. return false;
  7486. }
  7487. if (one.length !== two.length) {
  7488. return false;
  7489. }
  7490. one.sort();
  7491. two.sort();
  7492. for (var i2 = 0, l2 = one.length; i2 < l2; i2++) {
  7493. if (one[i2] !== two[i2]) {
  7494. return false;
  7495. }
  7496. }
  7497. return true;
  7498. }
  7499. function trimSlashes(text2) {
  7500. var trim_expression = /^\/+|\/+$/g;
  7501. return text2.replace(trim_expression, "");
  7502. }
  7503. URI2._parts = function() {
  7504. return {
  7505. protocol: null,
  7506. username: null,
  7507. password: null,
  7508. hostname: null,
  7509. urn: null,
  7510. port: null,
  7511. path: null,
  7512. query: null,
  7513. fragment: null,
  7514. preventInvalidHostname: URI2.preventInvalidHostname,
  7515. duplicateQueryParameters: URI2.duplicateQueryParameters,
  7516. escapeQuerySpace: URI2.escapeQuerySpace
  7517. };
  7518. };
  7519. URI2.preventInvalidHostname = false;
  7520. URI2.duplicateQueryParameters = false;
  7521. URI2.escapeQuerySpace = true;
  7522. URI2.protocol_expression = /^[a-z][a-z0-9.+-]*$/i;
  7523. URI2.idn_expression = /[^a-z0-9\._-]/i;
  7524. URI2.punycode_expression = /(xn--)/i;
  7525. URI2.ip4_expression = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
  7526. URI2.ip6_expression = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/;
  7527. URI2.find_uri_expression = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/ig;
  7528. URI2.findUri = {
  7529. start: /\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,
  7530. end: /[\s\r\n]|$/,
  7531. trim: /[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,
  7532. parens: /(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g
  7533. };
  7534. URI2.leading_whitespace_expression = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/;
  7535. URI2.ascii_tab_whitespace = /[\u0009\u000A\u000D]+/g;
  7536. URI2.defaultPorts = {
  7537. http: "80",
  7538. https: "443",
  7539. ftp: "21",
  7540. gopher: "70",
  7541. ws: "80",
  7542. wss: "443"
  7543. };
  7544. URI2.hostProtocols = [
  7545. "http",
  7546. "https"
  7547. ];
  7548. URI2.invalid_hostname_characters = /[^a-zA-Z0-9\.\-:_]/;
  7549. URI2.domAttributes = {
  7550. "a": "href",
  7551. "blockquote": "cite",
  7552. "link": "href",
  7553. "base": "href",
  7554. "script": "src",
  7555. "form": "action",
  7556. "img": "src",
  7557. "area": "href",
  7558. "iframe": "src",
  7559. "embed": "src",
  7560. "source": "src",
  7561. "track": "src",
  7562. "input": "src",
  7563. "audio": "src",
  7564. "video": "src"
  7565. };
  7566. URI2.getDomAttribute = function(node) {
  7567. if (!node || !node.nodeName) {
  7568. return void 0;
  7569. }
  7570. var nodeName = node.nodeName.toLowerCase();
  7571. if (nodeName === "input" && node.type !== "image") {
  7572. return void 0;
  7573. }
  7574. return URI2.domAttributes[nodeName];
  7575. };
  7576. function escapeForDumbFirefox36(value) {
  7577. return escape(value);
  7578. }
  7579. function strictEncodeURIComponent(string) {
  7580. return encodeURIComponent(string).replace(/[!'()*]/g, escapeForDumbFirefox36).replace(/\*/g, "%2A");
  7581. }
  7582. URI2.encode = strictEncodeURIComponent;
  7583. URI2.decode = decodeURIComponent;
  7584. URI2.iso8859 = function() {
  7585. URI2.encode = escape;
  7586. URI2.decode = unescape;
  7587. };
  7588. URI2.unicode = function() {
  7589. URI2.encode = strictEncodeURIComponent;
  7590. URI2.decode = decodeURIComponent;
  7591. };
  7592. URI2.characters = {
  7593. pathname: {
  7594. encode: {
  7595. expression: /%(24|26|2B|2C|3B|3D|3A|40)/ig,
  7596. map: {
  7597. "%24": "$",
  7598. "%26": "&",
  7599. "%2B": "+",
  7600. "%2C": ",",
  7601. "%3B": ";",
  7602. "%3D": "=",
  7603. "%3A": ":",
  7604. "%40": "@"
  7605. }
  7606. },
  7607. decode: {
  7608. expression: /[\/\?#]/g,
  7609. map: {
  7610. "/": "%2F",
  7611. "?": "%3F",
  7612. "#": "%23"
  7613. }
  7614. }
  7615. },
  7616. reserved: {
  7617. encode: {
  7618. expression: /%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/ig,
  7619. map: {
  7620. "%3A": ":",
  7621. "%2F": "/",
  7622. "%3F": "?",
  7623. "%23": "#",
  7624. "%5B": "[",
  7625. "%5D": "]",
  7626. "%40": "@",
  7627. "%21": "!",
  7628. "%24": "$",
  7629. "%26": "&",
  7630. "%27": "'",
  7631. "%28": "(",
  7632. "%29": ")",
  7633. "%2A": "*",
  7634. "%2B": "+",
  7635. "%2C": ",",
  7636. "%3B": ";",
  7637. "%3D": "="
  7638. }
  7639. }
  7640. },
  7641. urnpath: {
  7642. encode: {
  7643. expression: /%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/ig,
  7644. map: {
  7645. "%21": "!",
  7646. "%24": "$",
  7647. "%27": "'",
  7648. "%28": "(",
  7649. "%29": ")",
  7650. "%2A": "*",
  7651. "%2B": "+",
  7652. "%2C": ",",
  7653. "%3B": ";",
  7654. "%3D": "=",
  7655. "%40": "@"
  7656. }
  7657. },
  7658. decode: {
  7659. expression: /[\/\?#:]/g,
  7660. map: {
  7661. "/": "%2F",
  7662. "?": "%3F",
  7663. "#": "%23",
  7664. ":": "%3A"
  7665. }
  7666. }
  7667. }
  7668. };
  7669. URI2.encodeQuery = function(string, escapeQuerySpace) {
  7670. var escaped = URI2.encode(string + "");
  7671. if (escapeQuerySpace === void 0) {
  7672. escapeQuerySpace = URI2.escapeQuerySpace;
  7673. }
  7674. return escapeQuerySpace ? escaped.replace(/%20/g, "+") : escaped;
  7675. };
  7676. URI2.decodeQuery = function(string, escapeQuerySpace) {
  7677. string += "";
  7678. if (escapeQuerySpace === void 0) {
  7679. escapeQuerySpace = URI2.escapeQuerySpace;
  7680. }
  7681. try {
  7682. return URI2.decode(escapeQuerySpace ? string.replace(/\+/g, "%20") : string);
  7683. } catch (e2) {
  7684. return string;
  7685. }
  7686. };
  7687. var _parts = { "encode": "encode", "decode": "decode" };
  7688. var _part;
  7689. var generateAccessor = function(_group, _part2) {
  7690. return function(string) {
  7691. try {
  7692. return URI2[_part2](string + "").replace(URI2.characters[_group][_part2].expression, function(c14) {
  7693. return URI2.characters[_group][_part2].map[c14];
  7694. });
  7695. } catch (e2) {
  7696. return string;
  7697. }
  7698. };
  7699. };
  7700. for (_part in _parts) {
  7701. URI2[_part + "PathSegment"] = generateAccessor("pathname", _parts[_part]);
  7702. URI2[_part + "UrnPathSegment"] = generateAccessor("urnpath", _parts[_part]);
  7703. }
  7704. var generateSegmentedPathFunction = function(_sep, _codingFuncName, _innerCodingFuncName) {
  7705. return function(string) {
  7706. var actualCodingFunc;
  7707. if (!_innerCodingFuncName) {
  7708. actualCodingFunc = URI2[_codingFuncName];
  7709. } else {
  7710. actualCodingFunc = function(string2) {
  7711. return URI2[_codingFuncName](URI2[_innerCodingFuncName](string2));
  7712. };
  7713. }
  7714. var segments = (string + "").split(_sep);
  7715. for (var i2 = 0, length3 = segments.length; i2 < length3; i2++) {
  7716. segments[i2] = actualCodingFunc(segments[i2]);
  7717. }
  7718. return segments.join(_sep);
  7719. };
  7720. };
  7721. URI2.decodePath = generateSegmentedPathFunction("/", "decodePathSegment");
  7722. URI2.decodeUrnPath = generateSegmentedPathFunction(":", "decodeUrnPathSegment");
  7723. URI2.recodePath = generateSegmentedPathFunction("/", "encodePathSegment", "decode");
  7724. URI2.recodeUrnPath = generateSegmentedPathFunction(":", "encodeUrnPathSegment", "decode");
  7725. URI2.encodeReserved = generateAccessor("reserved", "encode");
  7726. URI2.parse = function(string, parts) {
  7727. var pos;
  7728. if (!parts) {
  7729. parts = {
  7730. preventInvalidHostname: URI2.preventInvalidHostname
  7731. };
  7732. }
  7733. string = string.replace(URI2.leading_whitespace_expression, "");
  7734. string = string.replace(URI2.ascii_tab_whitespace, "");
  7735. pos = string.indexOf("#");
  7736. if (pos > -1) {
  7737. parts.fragment = string.substring(pos + 1) || null;
  7738. string = string.substring(0, pos);
  7739. }
  7740. pos = string.indexOf("?");
  7741. if (pos > -1) {
  7742. parts.query = string.substring(pos + 1) || null;
  7743. string = string.substring(0, pos);
  7744. }
  7745. string = string.replace(/^(https?|ftp|wss?)?:+[/\\]*/i, "$1://");
  7746. string = string.replace(/^[/\\]{2,}/i, "//");
  7747. if (string.substring(0, 2) === "//") {
  7748. parts.protocol = null;
  7749. string = string.substring(2);
  7750. string = URI2.parseAuthority(string, parts);
  7751. } else {
  7752. pos = string.indexOf(":");
  7753. if (pos > -1) {
  7754. parts.protocol = string.substring(0, pos) || null;
  7755. if (parts.protocol && !parts.protocol.match(URI2.protocol_expression)) {
  7756. parts.protocol = void 0;
  7757. } else if (string.substring(pos + 1, pos + 3).replace(/\\/g, "/") === "//") {
  7758. string = string.substring(pos + 3);
  7759. string = URI2.parseAuthority(string, parts);
  7760. } else {
  7761. string = string.substring(pos + 1);
  7762. parts.urn = true;
  7763. }
  7764. }
  7765. }
  7766. parts.path = string;
  7767. return parts;
  7768. };
  7769. URI2.parseHost = function(string, parts) {
  7770. if (!string) {
  7771. string = "";
  7772. }
  7773. string = string.replace(/\\/g, "/");
  7774. var pos = string.indexOf("/");
  7775. var bracketPos;
  7776. var t;
  7777. if (pos === -1) {
  7778. pos = string.length;
  7779. }
  7780. if (string.charAt(0) === "[") {
  7781. bracketPos = string.indexOf("]");
  7782. parts.hostname = string.substring(1, bracketPos) || null;
  7783. parts.port = string.substring(bracketPos + 2, pos) || null;
  7784. if (parts.port === "/") {
  7785. parts.port = null;
  7786. }
  7787. } else {
  7788. var firstColon = string.indexOf(":");
  7789. var firstSlash = string.indexOf("/");
  7790. var nextColon = string.indexOf(":", firstColon + 1);
  7791. if (nextColon !== -1 && (firstSlash === -1 || nextColon < firstSlash)) {
  7792. parts.hostname = string.substring(0, pos) || null;
  7793. parts.port = null;
  7794. } else {
  7795. t = string.substring(0, pos).split(":");
  7796. parts.hostname = t[0] || null;
  7797. parts.port = t[1] || null;
  7798. }
  7799. }
  7800. if (parts.hostname && string.substring(pos).charAt(0) !== "/") {
  7801. pos++;
  7802. string = "/" + string;
  7803. }
  7804. if (parts.preventInvalidHostname) {
  7805. URI2.ensureValidHostname(parts.hostname, parts.protocol);
  7806. }
  7807. if (parts.port) {
  7808. URI2.ensureValidPort(parts.port);
  7809. }
  7810. return string.substring(pos) || "/";
  7811. };
  7812. URI2.parseAuthority = function(string, parts) {
  7813. string = URI2.parseUserinfo(string, parts);
  7814. return URI2.parseHost(string, parts);
  7815. };
  7816. URI2.parseUserinfo = function(string, parts) {
  7817. var _string = string;
  7818. var firstBackSlash = string.indexOf("\\");
  7819. if (firstBackSlash !== -1) {
  7820. string = string.replace(/\\/g, "/");
  7821. }
  7822. var firstSlash = string.indexOf("/");
  7823. var pos = string.lastIndexOf("@", firstSlash > -1 ? firstSlash : string.length - 1);
  7824. var t;
  7825. if (pos > -1 && (firstSlash === -1 || pos < firstSlash)) {
  7826. t = string.substring(0, pos).split(":");
  7827. parts.username = t[0] ? URI2.decode(t[0]) : null;
  7828. t.shift();
  7829. parts.password = t[0] ? URI2.decode(t.join(":")) : null;
  7830. string = _string.substring(pos + 1);
  7831. } else {
  7832. parts.username = null;
  7833. parts.password = null;
  7834. }
  7835. return string;
  7836. };
  7837. URI2.parseQuery = function(string, escapeQuerySpace) {
  7838. if (!string) {
  7839. return {};
  7840. }
  7841. string = string.replace(/&+/g, "&").replace(/^\?*&*|&+$/g, "");
  7842. if (!string) {
  7843. return {};
  7844. }
  7845. var items = {};
  7846. var splits = string.split("&");
  7847. var length3 = splits.length;
  7848. var v7, name, value;
  7849. for (var i2 = 0; i2 < length3; i2++) {
  7850. v7 = splits[i2].split("=");
  7851. name = URI2.decodeQuery(v7.shift(), escapeQuerySpace);
  7852. value = v7.length ? URI2.decodeQuery(v7.join("="), escapeQuerySpace) : null;
  7853. if (name === "__proto__") {
  7854. continue;
  7855. } else if (hasOwn.call(items, name)) {
  7856. if (typeof items[name] === "string" || items[name] === null) {
  7857. items[name] = [items[name]];
  7858. }
  7859. items[name].push(value);
  7860. } else {
  7861. items[name] = value;
  7862. }
  7863. }
  7864. return items;
  7865. };
  7866. URI2.build = function(parts) {
  7867. var t = "";
  7868. var requireAbsolutePath = false;
  7869. if (parts.protocol) {
  7870. t += parts.protocol + ":";
  7871. }
  7872. if (!parts.urn && (t || parts.hostname)) {
  7873. t += "//";
  7874. requireAbsolutePath = true;
  7875. }
  7876. t += URI2.buildAuthority(parts) || "";
  7877. if (typeof parts.path === "string") {
  7878. if (parts.path.charAt(0) !== "/" && requireAbsolutePath) {
  7879. t += "/";
  7880. }
  7881. t += parts.path;
  7882. }
  7883. if (typeof parts.query === "string" && parts.query) {
  7884. t += "?" + parts.query;
  7885. }
  7886. if (typeof parts.fragment === "string" && parts.fragment) {
  7887. t += "#" + parts.fragment;
  7888. }
  7889. return t;
  7890. };
  7891. URI2.buildHost = function(parts) {
  7892. var t = "";
  7893. if (!parts.hostname) {
  7894. return "";
  7895. } else if (URI2.ip6_expression.test(parts.hostname)) {
  7896. t += "[" + parts.hostname + "]";
  7897. } else {
  7898. t += parts.hostname;
  7899. }
  7900. if (parts.port) {
  7901. t += ":" + parts.port;
  7902. }
  7903. return t;
  7904. };
  7905. URI2.buildAuthority = function(parts) {
  7906. return URI2.buildUserinfo(parts) + URI2.buildHost(parts);
  7907. };
  7908. URI2.buildUserinfo = function(parts) {
  7909. var t = "";
  7910. if (parts.username) {
  7911. t += URI2.encode(parts.username);
  7912. }
  7913. if (parts.password) {
  7914. t += ":" + URI2.encode(parts.password);
  7915. }
  7916. if (t) {
  7917. t += "@";
  7918. }
  7919. return t;
  7920. };
  7921. URI2.buildQuery = function(data, duplicateQueryParameters, escapeQuerySpace) {
  7922. var t = "";
  7923. var unique, key, i2, length3;
  7924. for (key in data) {
  7925. if (key === "__proto__") {
  7926. continue;
  7927. } else if (hasOwn.call(data, key)) {
  7928. if (isArray(data[key])) {
  7929. unique = {};
  7930. for (i2 = 0, length3 = data[key].length; i2 < length3; i2++) {
  7931. if (data[key][i2] !== void 0 && unique[data[key][i2] + ""] === void 0) {
  7932. t += "&" + URI2.buildQueryParameter(key, data[key][i2], escapeQuerySpace);
  7933. if (duplicateQueryParameters !== true) {
  7934. unique[data[key][i2] + ""] = true;
  7935. }
  7936. }
  7937. }
  7938. } else if (data[key] !== void 0) {
  7939. t += "&" + URI2.buildQueryParameter(key, data[key], escapeQuerySpace);
  7940. }
  7941. }
  7942. }
  7943. return t.substring(1);
  7944. };
  7945. URI2.buildQueryParameter = function(name, value, escapeQuerySpace) {
  7946. return URI2.encodeQuery(name, escapeQuerySpace) + (value !== null ? "=" + URI2.encodeQuery(value, escapeQuerySpace) : "");
  7947. };
  7948. URI2.addQuery = function(data, name, value) {
  7949. if (typeof name === "object") {
  7950. for (var key in name) {
  7951. if (hasOwn.call(name, key)) {
  7952. URI2.addQuery(data, key, name[key]);
  7953. }
  7954. }
  7955. } else if (typeof name === "string") {
  7956. if (data[name] === void 0) {
  7957. data[name] = value;
  7958. return;
  7959. } else if (typeof data[name] === "string") {
  7960. data[name] = [data[name]];
  7961. }
  7962. if (!isArray(value)) {
  7963. value = [value];
  7964. }
  7965. data[name] = (data[name] || []).concat(value);
  7966. } else {
  7967. throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");
  7968. }
  7969. };
  7970. URI2.setQuery = function(data, name, value) {
  7971. if (typeof name === "object") {
  7972. for (var key in name) {
  7973. if (hasOwn.call(name, key)) {
  7974. URI2.setQuery(data, key, name[key]);
  7975. }
  7976. }
  7977. } else if (typeof name === "string") {
  7978. data[name] = value === void 0 ? null : value;
  7979. } else {
  7980. throw new TypeError("URI.setQuery() accepts an object, string as the name parameter");
  7981. }
  7982. };
  7983. URI2.removeQuery = function(data, name, value) {
  7984. var i2, length3, key;
  7985. if (isArray(name)) {
  7986. for (i2 = 0, length3 = name.length; i2 < length3; i2++) {
  7987. data[name[i2]] = void 0;
  7988. }
  7989. } else if (getType(name) === "RegExp") {
  7990. for (key in data) {
  7991. if (name.test(key)) {
  7992. data[key] = void 0;
  7993. }
  7994. }
  7995. } else if (typeof name === "object") {
  7996. for (key in name) {
  7997. if (hasOwn.call(name, key)) {
  7998. URI2.removeQuery(data, key, name[key]);
  7999. }
  8000. }
  8001. } else if (typeof name === "string") {
  8002. if (value !== void 0) {
  8003. if (getType(value) === "RegExp") {
  8004. if (!isArray(data[name]) && value.test(data[name])) {
  8005. data[name] = void 0;
  8006. } else {
  8007. data[name] = filterArrayValues(data[name], value);
  8008. }
  8009. } else if (data[name] === String(value) && (!isArray(value) || value.length === 1)) {
  8010. data[name] = void 0;
  8011. } else if (isArray(data[name])) {
  8012. data[name] = filterArrayValues(data[name], value);
  8013. }
  8014. } else {
  8015. data[name] = void 0;
  8016. }
  8017. } else {
  8018. throw new TypeError("URI.removeQuery() accepts an object, string, RegExp as the first parameter");
  8019. }
  8020. };
  8021. URI2.hasQuery = function(data, name, value, withinArray) {
  8022. switch (getType(name)) {
  8023. case "String":
  8024. break;
  8025. case "RegExp":
  8026. for (var key in data) {
  8027. if (hasOwn.call(data, key)) {
  8028. if (name.test(key) && (value === void 0 || URI2.hasQuery(data, key, value))) {
  8029. return true;
  8030. }
  8031. }
  8032. }
  8033. return false;
  8034. case "Object":
  8035. for (var _key in name) {
  8036. if (hasOwn.call(name, _key)) {
  8037. if (!URI2.hasQuery(data, _key, name[_key])) {
  8038. return false;
  8039. }
  8040. }
  8041. }
  8042. return true;
  8043. default:
  8044. throw new TypeError("URI.hasQuery() accepts a string, regular expression or object as the name parameter");
  8045. }
  8046. switch (getType(value)) {
  8047. case "Undefined":
  8048. return name in data;
  8049. case "Boolean":
  8050. var _booly = Boolean(isArray(data[name]) ? data[name].length : data[name]);
  8051. return value === _booly;
  8052. case "Function":
  8053. return !!value(data[name], name, data);
  8054. case "Array":
  8055. if (!isArray(data[name])) {
  8056. return false;
  8057. }
  8058. var op = withinArray ? arrayContains : arraysEqual;
  8059. return op(data[name], value);
  8060. case "RegExp":
  8061. if (!isArray(data[name])) {
  8062. return Boolean(data[name] && data[name].match(value));
  8063. }
  8064. if (!withinArray) {
  8065. return false;
  8066. }
  8067. return arrayContains(data[name], value);
  8068. case "Number":
  8069. value = String(value);
  8070. case "String":
  8071. if (!isArray(data[name])) {
  8072. return data[name] === value;
  8073. }
  8074. if (!withinArray) {
  8075. return false;
  8076. }
  8077. return arrayContains(data[name], value);
  8078. default:
  8079. throw new TypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter");
  8080. }
  8081. };
  8082. URI2.joinPaths = function() {
  8083. var input = [];
  8084. var segments = [];
  8085. var nonEmptySegments = 0;
  8086. for (var i2 = 0; i2 < arguments.length; i2++) {
  8087. var url2 = new URI2(arguments[i2]);
  8088. input.push(url2);
  8089. var _segments = url2.segment();
  8090. for (var s2 = 0; s2 < _segments.length; s2++) {
  8091. if (typeof _segments[s2] === "string") {
  8092. segments.push(_segments[s2]);
  8093. }
  8094. if (_segments[s2]) {
  8095. nonEmptySegments++;
  8096. }
  8097. }
  8098. }
  8099. if (!segments.length || !nonEmptySegments) {
  8100. return new URI2("");
  8101. }
  8102. var uri = new URI2("").segment(segments);
  8103. if (input[0].path() === "" || input[0].path().slice(0, 1) === "/") {
  8104. uri.path("/" + uri.path());
  8105. }
  8106. return uri.normalize();
  8107. };
  8108. URI2.commonPath = function(one, two) {
  8109. var length3 = Math.min(one.length, two.length);
  8110. var pos;
  8111. for (pos = 0; pos < length3; pos++) {
  8112. if (one.charAt(pos) !== two.charAt(pos)) {
  8113. pos--;
  8114. break;
  8115. }
  8116. }
  8117. if (pos < 1) {
  8118. return one.charAt(0) === two.charAt(0) && one.charAt(0) === "/" ? "/" : "";
  8119. }
  8120. if (one.charAt(pos) !== "/" || two.charAt(pos) !== "/") {
  8121. pos = one.substring(0, pos).lastIndexOf("/");
  8122. }
  8123. return one.substring(0, pos + 1);
  8124. };
  8125. URI2.withinString = function(string, callback, options) {
  8126. options || (options = {});
  8127. var _start = options.start || URI2.findUri.start;
  8128. var _end = options.end || URI2.findUri.end;
  8129. var _trim = options.trim || URI2.findUri.trim;
  8130. var _parens = options.parens || URI2.findUri.parens;
  8131. var _attributeOpen = /[a-z0-9-]=["']?$/i;
  8132. _start.lastIndex = 0;
  8133. while (true) {
  8134. var match = _start.exec(string);
  8135. if (!match) {
  8136. break;
  8137. }
  8138. var start = match.index;
  8139. if (options.ignoreHtml) {
  8140. var attributeOpen = string.slice(Math.max(start - 3, 0), start);
  8141. if (attributeOpen && _attributeOpen.test(attributeOpen)) {
  8142. continue;
  8143. }
  8144. }
  8145. var end = start + string.slice(start).search(_end);
  8146. var slice = string.slice(start, end);
  8147. var parensEnd = -1;
  8148. while (true) {
  8149. var parensMatch = _parens.exec(slice);
  8150. if (!parensMatch) {
  8151. break;
  8152. }
  8153. var parensMatchEnd = parensMatch.index + parensMatch[0].length;
  8154. parensEnd = Math.max(parensEnd, parensMatchEnd);
  8155. }
  8156. if (parensEnd > -1) {
  8157. slice = slice.slice(0, parensEnd) + slice.slice(parensEnd).replace(_trim, "");
  8158. } else {
  8159. slice = slice.replace(_trim, "");
  8160. }
  8161. if (slice.length <= match[0].length) {
  8162. continue;
  8163. }
  8164. if (options.ignore && options.ignore.test(slice)) {
  8165. continue;
  8166. }
  8167. end = start + slice.length;
  8168. var result = callback(slice, start, end, string);
  8169. if (result === void 0) {
  8170. _start.lastIndex = end;
  8171. continue;
  8172. }
  8173. result = String(result);
  8174. string = string.slice(0, start) + result + string.slice(end);
  8175. _start.lastIndex = start + result.length;
  8176. }
  8177. _start.lastIndex = 0;
  8178. return string;
  8179. };
  8180. URI2.ensureValidHostname = function(v7, protocol) {
  8181. var hasHostname = !!v7;
  8182. var hasProtocol = !!protocol;
  8183. var rejectEmptyHostname = false;
  8184. if (hasProtocol) {
  8185. rejectEmptyHostname = arrayContains(URI2.hostProtocols, protocol);
  8186. }
  8187. if (rejectEmptyHostname && !hasHostname) {
  8188. throw new TypeError("Hostname cannot be empty, if protocol is " + protocol);
  8189. } else if (v7 && v7.match(URI2.invalid_hostname_characters)) {
  8190. if (!punycode2) {
  8191. throw new TypeError('Hostname "' + v7 + '" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');
  8192. }
  8193. if (punycode2.toASCII(v7).match(URI2.invalid_hostname_characters)) {
  8194. throw new TypeError('Hostname "' + v7 + '" contains characters other than [A-Z0-9.-:_]');
  8195. }
  8196. }
  8197. };
  8198. URI2.ensureValidPort = function(v7) {
  8199. if (!v7) {
  8200. return;
  8201. }
  8202. var port = Number(v7);
  8203. if (isInteger(port) && port > 0 && port < 65536) {
  8204. return;
  8205. }
  8206. throw new TypeError('Port "' + v7 + '" is not a valid port');
  8207. };
  8208. URI2.noConflict = function(removeAll) {
  8209. if (removeAll) {
  8210. var unconflicted = {
  8211. URI: this.noConflict()
  8212. };
  8213. if (root.URITemplate && typeof root.URITemplate.noConflict === "function") {
  8214. unconflicted.URITemplate = root.URITemplate.noConflict();
  8215. }
  8216. if (root.IPv6 && typeof root.IPv6.noConflict === "function") {
  8217. unconflicted.IPv6 = root.IPv6.noConflict();
  8218. }
  8219. if (root.SecondLevelDomains && typeof root.SecondLevelDomains.noConflict === "function") {
  8220. unconflicted.SecondLevelDomains = root.SecondLevelDomains.noConflict();
  8221. }
  8222. return unconflicted;
  8223. } else if (root.URI === this) {
  8224. root.URI = _URI;
  8225. }
  8226. return this;
  8227. };
  8228. p2.build = function(deferBuild) {
  8229. if (deferBuild === true) {
  8230. this._deferred_build = true;
  8231. } else if (deferBuild === void 0 || this._deferred_build) {
  8232. this._string = URI2.build(this._parts);
  8233. this._deferred_build = false;
  8234. }
  8235. return this;
  8236. };
  8237. p2.clone = function() {
  8238. return new URI2(this);
  8239. };
  8240. p2.valueOf = p2.toString = function() {
  8241. return this.build(false)._string;
  8242. };
  8243. function generateSimpleAccessor(_part2) {
  8244. return function(v7, build) {
  8245. if (v7 === void 0) {
  8246. return this._parts[_part2] || "";
  8247. } else {
  8248. this._parts[_part2] = v7 || null;
  8249. this.build(!build);
  8250. return this;
  8251. }
  8252. };
  8253. }
  8254. function generatePrefixAccessor(_part2, _key) {
  8255. return function(v7, build) {
  8256. if (v7 === void 0) {
  8257. return this._parts[_part2] || "";
  8258. } else {
  8259. if (v7 !== null) {
  8260. v7 = v7 + "";
  8261. if (v7.charAt(0) === _key) {
  8262. v7 = v7.substring(1);
  8263. }
  8264. }
  8265. this._parts[_part2] = v7;
  8266. this.build(!build);
  8267. return this;
  8268. }
  8269. };
  8270. }
  8271. p2.protocol = generateSimpleAccessor("protocol");
  8272. p2.username = generateSimpleAccessor("username");
  8273. p2.password = generateSimpleAccessor("password");
  8274. p2.hostname = generateSimpleAccessor("hostname");
  8275. p2.port = generateSimpleAccessor("port");
  8276. p2.query = generatePrefixAccessor("query", "?");
  8277. p2.fragment = generatePrefixAccessor("fragment", "#");
  8278. p2.search = function(v7, build) {
  8279. var t = this.query(v7, build);
  8280. return typeof t === "string" && t.length ? "?" + t : t;
  8281. };
  8282. p2.hash = function(v7, build) {
  8283. var t = this.fragment(v7, build);
  8284. return typeof t === "string" && t.length ? "#" + t : t;
  8285. };
  8286. p2.pathname = function(v7, build) {
  8287. if (v7 === void 0 || v7 === true) {
  8288. var res = this._parts.path || (this._parts.hostname ? "/" : "");
  8289. return v7 ? (this._parts.urn ? URI2.decodeUrnPath : URI2.decodePath)(res) : res;
  8290. } else {
  8291. if (this._parts.urn) {
  8292. this._parts.path = v7 ? URI2.recodeUrnPath(v7) : "";
  8293. } else {
  8294. this._parts.path = v7 ? URI2.recodePath(v7) : "/";
  8295. }
  8296. this.build(!build);
  8297. return this;
  8298. }
  8299. };
  8300. p2.path = p2.pathname;
  8301. p2.href = function(href, build) {
  8302. var key;
  8303. if (href === void 0) {
  8304. return this.toString();
  8305. }
  8306. this._string = "";
  8307. this._parts = URI2._parts();
  8308. var _URI2 = href instanceof URI2;
  8309. var _object = typeof href === "object" && (href.hostname || href.path || href.pathname);
  8310. if (href.nodeName) {
  8311. var attribute = URI2.getDomAttribute(href);
  8312. href = href[attribute] || "";
  8313. _object = false;
  8314. }
  8315. if (!_URI2 && _object && href.pathname !== void 0) {
  8316. href = href.toString();
  8317. }
  8318. if (typeof href === "string" || href instanceof String) {
  8319. this._parts = URI2.parse(String(href), this._parts);
  8320. } else if (_URI2 || _object) {
  8321. var src2 = _URI2 ? href._parts : href;
  8322. for (key in src2) {
  8323. if (key === "query") {
  8324. continue;
  8325. }
  8326. if (hasOwn.call(this._parts, key)) {
  8327. this._parts[key] = src2[key];
  8328. }
  8329. }
  8330. if (src2.query) {
  8331. this.query(src2.query, false);
  8332. }
  8333. } else {
  8334. throw new TypeError("invalid input");
  8335. }
  8336. this.build(!build);
  8337. return this;
  8338. };
  8339. p2.is = function(what) {
  8340. var ip = false;
  8341. var ip4 = false;
  8342. var ip6 = false;
  8343. var name = false;
  8344. var sld = false;
  8345. var idn = false;
  8346. var punycode3 = false;
  8347. var relative = !this._parts.urn;
  8348. if (this._parts.hostname) {
  8349. relative = false;
  8350. ip4 = URI2.ip4_expression.test(this._parts.hostname);
  8351. ip6 = URI2.ip6_expression.test(this._parts.hostname);
  8352. ip = ip4 || ip6;
  8353. name = !ip;
  8354. sld = name && SLD && SLD.has(this._parts.hostname);
  8355. idn = name && URI2.idn_expression.test(this._parts.hostname);
  8356. punycode3 = name && URI2.punycode_expression.test(this._parts.hostname);
  8357. }
  8358. switch (what.toLowerCase()) {
  8359. case "relative":
  8360. return relative;
  8361. case "absolute":
  8362. return !relative;
  8363. case "domain":
  8364. case "name":
  8365. return name;
  8366. case "sld":
  8367. return sld;
  8368. case "ip":
  8369. return ip;
  8370. case "ip4":
  8371. case "ipv4":
  8372. case "inet4":
  8373. return ip4;
  8374. case "ip6":
  8375. case "ipv6":
  8376. case "inet6":
  8377. return ip6;
  8378. case "idn":
  8379. return idn;
  8380. case "url":
  8381. return !this._parts.urn;
  8382. case "urn":
  8383. return !!this._parts.urn;
  8384. case "punycode":
  8385. return punycode3;
  8386. }
  8387. return null;
  8388. };
  8389. var _protocol = p2.protocol;
  8390. var _port = p2.port;
  8391. var _hostname = p2.hostname;
  8392. p2.protocol = function(v7, build) {
  8393. if (v7) {
  8394. v7 = v7.replace(/:(\/\/)?$/, "");
  8395. if (!v7.match(URI2.protocol_expression)) {
  8396. throw new TypeError('Protocol "' + v7 + `" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]`);
  8397. }
  8398. }
  8399. return _protocol.call(this, v7, build);
  8400. };
  8401. p2.scheme = p2.protocol;
  8402. p2.port = function(v7, build) {
  8403. if (this._parts.urn) {
  8404. return v7 === void 0 ? "" : this;
  8405. }
  8406. if (v7 !== void 0) {
  8407. if (v7 === 0) {
  8408. v7 = null;
  8409. }
  8410. if (v7) {
  8411. v7 += "";
  8412. if (v7.charAt(0) === ":") {
  8413. v7 = v7.substring(1);
  8414. }
  8415. URI2.ensureValidPort(v7);
  8416. }
  8417. }
  8418. return _port.call(this, v7, build);
  8419. };
  8420. p2.hostname = function(v7, build) {
  8421. if (this._parts.urn) {
  8422. return v7 === void 0 ? "" : this;
  8423. }
  8424. if (v7 !== void 0) {
  8425. var x = { preventInvalidHostname: this._parts.preventInvalidHostname };
  8426. var res = URI2.parseHost(v7, x);
  8427. if (res !== "/") {
  8428. throw new TypeError('Hostname "' + v7 + '" contains characters other than [A-Z0-9.-]');
  8429. }
  8430. v7 = x.hostname;
  8431. if (this._parts.preventInvalidHostname) {
  8432. URI2.ensureValidHostname(v7, this._parts.protocol);
  8433. }
  8434. }
  8435. return _hostname.call(this, v7, build);
  8436. };
  8437. p2.origin = function(v7, build) {
  8438. if (this._parts.urn) {
  8439. return v7 === void 0 ? "" : this;
  8440. }
  8441. if (v7 === void 0) {
  8442. var protocol = this.protocol();
  8443. var authority = this.authority();
  8444. if (!authority) {
  8445. return "";
  8446. }
  8447. return (protocol ? protocol + "://" : "") + this.authority();
  8448. } else {
  8449. var origin = URI2(v7);
  8450. this.protocol(origin.protocol()).authority(origin.authority()).build(!build);
  8451. return this;
  8452. }
  8453. };
  8454. p2.host = function(v7, build) {
  8455. if (this._parts.urn) {
  8456. return v7 === void 0 ? "" : this;
  8457. }
  8458. if (v7 === void 0) {
  8459. return this._parts.hostname ? URI2.buildHost(this._parts) : "";
  8460. } else {
  8461. var res = URI2.parseHost(v7, this._parts);
  8462. if (res !== "/") {
  8463. throw new TypeError('Hostname "' + v7 + '" contains characters other than [A-Z0-9.-]');
  8464. }
  8465. this.build(!build);
  8466. return this;
  8467. }
  8468. };
  8469. p2.authority = function(v7, build) {
  8470. if (this._parts.urn) {
  8471. return v7 === void 0 ? "" : this;
  8472. }
  8473. if (v7 === void 0) {
  8474. return this._parts.hostname ? URI2.buildAuthority(this._parts) : "";
  8475. } else {
  8476. var res = URI2.parseAuthority(v7, this._parts);
  8477. if (res !== "/") {
  8478. throw new TypeError('Hostname "' + v7 + '" contains characters other than [A-Z0-9.-]');
  8479. }
  8480. this.build(!build);
  8481. return this;
  8482. }
  8483. };
  8484. p2.userinfo = function(v7, build) {
  8485. if (this._parts.urn) {
  8486. return v7 === void 0 ? "" : this;
  8487. }
  8488. if (v7 === void 0) {
  8489. var t = URI2.buildUserinfo(this._parts);
  8490. return t ? t.substring(0, t.length - 1) : t;
  8491. } else {
  8492. if (v7[v7.length - 1] !== "@") {
  8493. v7 += "@";
  8494. }
  8495. URI2.parseUserinfo(v7, this._parts);
  8496. this.build(!build);
  8497. return this;
  8498. }
  8499. };
  8500. p2.resource = function(v7, build) {
  8501. var parts;
  8502. if (v7 === void 0) {
  8503. return this.path() + this.search() + this.hash();
  8504. }
  8505. parts = URI2.parse(v7);
  8506. this._parts.path = parts.path;
  8507. this._parts.query = parts.query;
  8508. this._parts.fragment = parts.fragment;
  8509. this.build(!build);
  8510. return this;
  8511. };
  8512. p2.subdomain = function(v7, build) {
  8513. if (this._parts.urn) {
  8514. return v7 === void 0 ? "" : this;
  8515. }
  8516. if (v7 === void 0) {
  8517. if (!this._parts.hostname || this.is("IP")) {
  8518. return "";
  8519. }
  8520. var end = this._parts.hostname.length - this.domain().length - 1;
  8521. return this._parts.hostname.substring(0, end) || "";
  8522. } else {
  8523. var e2 = this._parts.hostname.length - this.domain().length;
  8524. var sub = this._parts.hostname.substring(0, e2);
  8525. var replace = new RegExp("^" + escapeRegEx(sub));
  8526. if (v7 && v7.charAt(v7.length - 1) !== ".") {
  8527. v7 += ".";
  8528. }
  8529. if (v7.indexOf(":") !== -1) {
  8530. throw new TypeError("Domains cannot contain colons");
  8531. }
  8532. if (v7) {
  8533. URI2.ensureValidHostname(v7, this._parts.protocol);
  8534. }
  8535. this._parts.hostname = this._parts.hostname.replace(replace, v7);
  8536. this.build(!build);
  8537. return this;
  8538. }
  8539. };
  8540. p2.domain = function(v7, build) {
  8541. if (this._parts.urn) {
  8542. return v7 === void 0 ? "" : this;
  8543. }
  8544. if (typeof v7 === "boolean") {
  8545. build = v7;
  8546. v7 = void 0;
  8547. }
  8548. if (v7 === void 0) {
  8549. if (!this._parts.hostname || this.is("IP")) {
  8550. return "";
  8551. }
  8552. var t = this._parts.hostname.match(/\./g);
  8553. if (t && t.length < 2) {
  8554. return this._parts.hostname;
  8555. }
  8556. var end = this._parts.hostname.length - this.tld(build).length - 1;
  8557. end = this._parts.hostname.lastIndexOf(".", end - 1) + 1;
  8558. return this._parts.hostname.substring(end) || "";
  8559. } else {
  8560. if (!v7) {
  8561. throw new TypeError("cannot set domain empty");
  8562. }
  8563. if (v7.indexOf(":") !== -1) {
  8564. throw new TypeError("Domains cannot contain colons");
  8565. }
  8566. URI2.ensureValidHostname(v7, this._parts.protocol);
  8567. if (!this._parts.hostname || this.is("IP")) {
  8568. this._parts.hostname = v7;
  8569. } else {
  8570. var replace = new RegExp(escapeRegEx(this.domain()) + "$");
  8571. this._parts.hostname = this._parts.hostname.replace(replace, v7);
  8572. }
  8573. this.build(!build);
  8574. return this;
  8575. }
  8576. };
  8577. p2.tld = function(v7, build) {
  8578. if (this._parts.urn) {
  8579. return v7 === void 0 ? "" : this;
  8580. }
  8581. if (typeof v7 === "boolean") {
  8582. build = v7;
  8583. v7 = void 0;
  8584. }
  8585. if (v7 === void 0) {
  8586. if (!this._parts.hostname || this.is("IP")) {
  8587. return "";
  8588. }
  8589. var pos = this._parts.hostname.lastIndexOf(".");
  8590. var tld = this._parts.hostname.substring(pos + 1);
  8591. if (build !== true && SLD && SLD.list[tld.toLowerCase()]) {
  8592. return SLD.get(this._parts.hostname) || tld;
  8593. }
  8594. return tld;
  8595. } else {
  8596. var replace;
  8597. if (!v7) {
  8598. throw new TypeError("cannot set TLD empty");
  8599. } else if (v7.match(/[^a-zA-Z0-9-]/)) {
  8600. if (SLD && SLD.is(v7)) {
  8601. replace = new RegExp(escapeRegEx(this.tld()) + "$");
  8602. this._parts.hostname = this._parts.hostname.replace(replace, v7);
  8603. } else {
  8604. throw new TypeError('TLD "' + v7 + '" contains characters other than [A-Z0-9]');
  8605. }
  8606. } else if (!this._parts.hostname || this.is("IP")) {
  8607. throw new ReferenceError("cannot set TLD on non-domain host");
  8608. } else {
  8609. replace = new RegExp(escapeRegEx(this.tld()) + "$");
  8610. this._parts.hostname = this._parts.hostname.replace(replace, v7);
  8611. }
  8612. this.build(!build);
  8613. return this;
  8614. }
  8615. };
  8616. p2.directory = function(v7, build) {
  8617. if (this._parts.urn) {
  8618. return v7 === void 0 ? "" : this;
  8619. }
  8620. if (v7 === void 0 || v7 === true) {
  8621. if (!this._parts.path && !this._parts.hostname) {
  8622. return "";
  8623. }
  8624. if (this._parts.path === "/") {
  8625. return "/";
  8626. }
  8627. var end = this._parts.path.length - this.filename().length - 1;
  8628. var res = this._parts.path.substring(0, end) || (this._parts.hostname ? "/" : "");
  8629. return v7 ? URI2.decodePath(res) : res;
  8630. } else {
  8631. var e2 = this._parts.path.length - this.filename().length;
  8632. var directory = this._parts.path.substring(0, e2);
  8633. var replace = new RegExp("^" + escapeRegEx(directory));
  8634. if (!this.is("relative")) {
  8635. if (!v7) {
  8636. v7 = "/";
  8637. }
  8638. if (v7.charAt(0) !== "/") {
  8639. v7 = "/" + v7;
  8640. }
  8641. }
  8642. if (v7 && v7.charAt(v7.length - 1) !== "/") {
  8643. v7 += "/";
  8644. }
  8645. v7 = URI2.recodePath(v7);
  8646. this._parts.path = this._parts.path.replace(replace, v7);
  8647. this.build(!build);
  8648. return this;
  8649. }
  8650. };
  8651. p2.filename = function(v7, build) {
  8652. if (this._parts.urn) {
  8653. return v7 === void 0 ? "" : this;
  8654. }
  8655. if (typeof v7 !== "string") {
  8656. if (!this._parts.path || this._parts.path === "/") {
  8657. return "";
  8658. }
  8659. var pos = this._parts.path.lastIndexOf("/");
  8660. var res = this._parts.path.substring(pos + 1);
  8661. return v7 ? URI2.decodePathSegment(res) : res;
  8662. } else {
  8663. var mutatedDirectory = false;
  8664. if (v7.charAt(0) === "/") {
  8665. v7 = v7.substring(1);
  8666. }
  8667. if (v7.match(/\.?\//)) {
  8668. mutatedDirectory = true;
  8669. }
  8670. var replace = new RegExp(escapeRegEx(this.filename()) + "$");
  8671. v7 = URI2.recodePath(v7);
  8672. this._parts.path = this._parts.path.replace(replace, v7);
  8673. if (mutatedDirectory) {
  8674. this.normalizePath(build);
  8675. } else {
  8676. this.build(!build);
  8677. }
  8678. return this;
  8679. }
  8680. };
  8681. p2.suffix = function(v7, build) {
  8682. if (this._parts.urn) {
  8683. return v7 === void 0 ? "" : this;
  8684. }
  8685. if (v7 === void 0 || v7 === true) {
  8686. if (!this._parts.path || this._parts.path === "/") {
  8687. return "";
  8688. }
  8689. var filename = this.filename();
  8690. var pos = filename.lastIndexOf(".");
  8691. var s2, res;
  8692. if (pos === -1) {
  8693. return "";
  8694. }
  8695. s2 = filename.substring(pos + 1);
  8696. res = /^[a-z0-9%]+$/i.test(s2) ? s2 : "";
  8697. return v7 ? URI2.decodePathSegment(res) : res;
  8698. } else {
  8699. if (v7.charAt(0) === ".") {
  8700. v7 = v7.substring(1);
  8701. }
  8702. var suffix = this.suffix();
  8703. var replace;
  8704. if (!suffix) {
  8705. if (!v7) {
  8706. return this;
  8707. }
  8708. this._parts.path += "." + URI2.recodePath(v7);
  8709. } else if (!v7) {
  8710. replace = new RegExp(escapeRegEx("." + suffix) + "$");
  8711. } else {
  8712. replace = new RegExp(escapeRegEx(suffix) + "$");
  8713. }
  8714. if (replace) {
  8715. v7 = URI2.recodePath(v7);
  8716. this._parts.path = this._parts.path.replace(replace, v7);
  8717. }
  8718. this.build(!build);
  8719. return this;
  8720. }
  8721. };
  8722. p2.segment = function(segment, v7, build) {
  8723. var separator = this._parts.urn ? ":" : "/";
  8724. var path = this.path();
  8725. var absolute = path.substring(0, 1) === "/";
  8726. var segments = path.split(separator);
  8727. if (segment !== void 0 && typeof segment !== "number") {
  8728. build = v7;
  8729. v7 = segment;
  8730. segment = void 0;
  8731. }
  8732. if (segment !== void 0 && typeof segment !== "number") {
  8733. throw new Error('Bad segment "' + segment + '", must be 0-based integer');
  8734. }
  8735. if (absolute) {
  8736. segments.shift();
  8737. }
  8738. if (segment < 0) {
  8739. segment = Math.max(segments.length + segment, 0);
  8740. }
  8741. if (v7 === void 0) {
  8742. return segment === void 0 ? segments : segments[segment];
  8743. } else if (segment === null || segments[segment] === void 0) {
  8744. if (isArray(v7)) {
  8745. segments = [];
  8746. for (var i2 = 0, l2 = v7.length; i2 < l2; i2++) {
  8747. if (!v7[i2].length && (!segments.length || !segments[segments.length - 1].length)) {
  8748. continue;
  8749. }
  8750. if (segments.length && !segments[segments.length - 1].length) {
  8751. segments.pop();
  8752. }
  8753. segments.push(trimSlashes(v7[i2]));
  8754. }
  8755. } else if (v7 || typeof v7 === "string") {
  8756. v7 = trimSlashes(v7);
  8757. if (segments[segments.length - 1] === "") {
  8758. segments[segments.length - 1] = v7;
  8759. } else {
  8760. segments.push(v7);
  8761. }
  8762. }
  8763. } else {
  8764. if (v7) {
  8765. segments[segment] = trimSlashes(v7);
  8766. } else {
  8767. segments.splice(segment, 1);
  8768. }
  8769. }
  8770. if (absolute) {
  8771. segments.unshift("");
  8772. }
  8773. return this.path(segments.join(separator), build);
  8774. };
  8775. p2.segmentCoded = function(segment, v7, build) {
  8776. var segments, i2, l2;
  8777. if (typeof segment !== "number") {
  8778. build = v7;
  8779. v7 = segment;
  8780. segment = void 0;
  8781. }
  8782. if (v7 === void 0) {
  8783. segments = this.segment(segment, v7, build);
  8784. if (!isArray(segments)) {
  8785. segments = segments !== void 0 ? URI2.decode(segments) : void 0;
  8786. } else {
  8787. for (i2 = 0, l2 = segments.length; i2 < l2; i2++) {
  8788. segments[i2] = URI2.decode(segments[i2]);
  8789. }
  8790. }
  8791. return segments;
  8792. }
  8793. if (!isArray(v7)) {
  8794. v7 = typeof v7 === "string" || v7 instanceof String ? URI2.encode(v7) : v7;
  8795. } else {
  8796. for (i2 = 0, l2 = v7.length; i2 < l2; i2++) {
  8797. v7[i2] = URI2.encode(v7[i2]);
  8798. }
  8799. }
  8800. return this.segment(segment, v7, build);
  8801. };
  8802. var q = p2.query;
  8803. p2.query = function(v7, build) {
  8804. if (v7 === true) {
  8805. return URI2.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
  8806. } else if (typeof v7 === "function") {
  8807. var data = URI2.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
  8808. var result = v7.call(this, data);
  8809. this._parts.query = URI2.buildQuery(result || data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace);
  8810. this.build(!build);
  8811. return this;
  8812. } else if (v7 !== void 0 && typeof v7 !== "string") {
  8813. this._parts.query = URI2.buildQuery(v7, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace);
  8814. this.build(!build);
  8815. return this;
  8816. } else {
  8817. return q.call(this, v7, build);
  8818. }
  8819. };
  8820. p2.setQuery = function(name, value, build) {
  8821. var data = URI2.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
  8822. if (typeof name === "string" || name instanceof String) {
  8823. data[name] = value !== void 0 ? value : null;
  8824. } else if (typeof name === "object") {
  8825. for (var key in name) {
  8826. if (hasOwn.call(name, key)) {
  8827. data[key] = name[key];
  8828. }
  8829. }
  8830. } else {
  8831. throw new TypeError("URI.addQuery() accepts an object, string as the name parameter");
  8832. }
  8833. this._parts.query = URI2.buildQuery(data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace);
  8834. if (typeof name !== "string") {
  8835. build = value;
  8836. }
  8837. this.build(!build);
  8838. return this;
  8839. };
  8840. p2.addQuery = function(name, value, build) {
  8841. var data = URI2.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
  8842. URI2.addQuery(data, name, value === void 0 ? null : value);
  8843. this._parts.query = URI2.buildQuery(data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace);
  8844. if (typeof name !== "string") {
  8845. build = value;
  8846. }
  8847. this.build(!build);
  8848. return this;
  8849. };
  8850. p2.removeQuery = function(name, value, build) {
  8851. var data = URI2.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
  8852. URI2.removeQuery(data, name, value);
  8853. this._parts.query = URI2.buildQuery(data, this._parts.duplicateQueryParameters, this._parts.escapeQuerySpace);
  8854. if (typeof name !== "string") {
  8855. build = value;
  8856. }
  8857. this.build(!build);
  8858. return this;
  8859. };
  8860. p2.hasQuery = function(name, value, withinArray) {
  8861. var data = URI2.parseQuery(this._parts.query, this._parts.escapeQuerySpace);
  8862. return URI2.hasQuery(data, name, value, withinArray);
  8863. };
  8864. p2.setSearch = p2.setQuery;
  8865. p2.addSearch = p2.addQuery;
  8866. p2.removeSearch = p2.removeQuery;
  8867. p2.hasSearch = p2.hasQuery;
  8868. p2.normalize = function() {
  8869. if (this._parts.urn) {
  8870. return this.normalizeProtocol(false).normalizePath(false).normalizeQuery(false).normalizeFragment(false).build();
  8871. }
  8872. return this.normalizeProtocol(false).normalizeHostname(false).normalizePort(false).normalizePath(false).normalizeQuery(false).normalizeFragment(false).build();
  8873. };
  8874. p2.normalizeProtocol = function(build) {
  8875. if (typeof this._parts.protocol === "string") {
  8876. this._parts.protocol = this._parts.protocol.toLowerCase();
  8877. this.build(!build);
  8878. }
  8879. return this;
  8880. };
  8881. p2.normalizeHostname = function(build) {
  8882. if (this._parts.hostname) {
  8883. if (this.is("IDN") && punycode2) {
  8884. this._parts.hostname = punycode2.toASCII(this._parts.hostname);
  8885. } else if (this.is("IPv6") && IPv62) {
  8886. this._parts.hostname = IPv62.best(this._parts.hostname);
  8887. }
  8888. this._parts.hostname = this._parts.hostname.toLowerCase();
  8889. this.build(!build);
  8890. }
  8891. return this;
  8892. };
  8893. p2.normalizePort = function(build) {
  8894. if (typeof this._parts.protocol === "string" && this._parts.port === URI2.defaultPorts[this._parts.protocol]) {
  8895. this._parts.port = null;
  8896. this.build(!build);
  8897. }
  8898. return this;
  8899. };
  8900. p2.normalizePath = function(build) {
  8901. var _path = this._parts.path;
  8902. if (!_path) {
  8903. return this;
  8904. }
  8905. if (this._parts.urn) {
  8906. this._parts.path = URI2.recodeUrnPath(this._parts.path);
  8907. this.build(!build);
  8908. return this;
  8909. }
  8910. if (this._parts.path === "/") {
  8911. return this;
  8912. }
  8913. _path = URI2.recodePath(_path);
  8914. var _was_relative;
  8915. var _leadingParents = "";
  8916. var _parent, _pos;
  8917. if (_path.charAt(0) !== "/") {
  8918. _was_relative = true;
  8919. _path = "/" + _path;
  8920. }
  8921. if (_path.slice(-3) === "/.." || _path.slice(-2) === "/.") {
  8922. _path += "/";
  8923. }
  8924. _path = _path.replace(/(\/(\.\/)+)|(\/\.$)/g, "/").replace(/\/{2,}/g, "/");
  8925. if (_was_relative) {
  8926. _leadingParents = _path.substring(1).match(/^(\.\.\/)+/) || "";
  8927. if (_leadingParents) {
  8928. _leadingParents = _leadingParents[0];
  8929. }
  8930. }
  8931. while (true) {
  8932. _parent = _path.search(/\/\.\.(\/|$)/);
  8933. if (_parent === -1) {
  8934. break;
  8935. } else if (_parent === 0) {
  8936. _path = _path.substring(3);
  8937. continue;
  8938. }
  8939. _pos = _path.substring(0, _parent).lastIndexOf("/");
  8940. if (_pos === -1) {
  8941. _pos = _parent;
  8942. }
  8943. _path = _path.substring(0, _pos) + _path.substring(_parent + 3);
  8944. }
  8945. if (_was_relative && this.is("relative")) {
  8946. _path = _leadingParents + _path.substring(1);
  8947. }
  8948. this._parts.path = _path;
  8949. this.build(!build);
  8950. return this;
  8951. };
  8952. p2.normalizePathname = p2.normalizePath;
  8953. p2.normalizeQuery = function(build) {
  8954. if (typeof this._parts.query === "string") {
  8955. if (!this._parts.query.length) {
  8956. this._parts.query = null;
  8957. } else {
  8958. this.query(URI2.parseQuery(this._parts.query, this._parts.escapeQuerySpace));
  8959. }
  8960. this.build(!build);
  8961. }
  8962. return this;
  8963. };
  8964. p2.normalizeFragment = function(build) {
  8965. if (!this._parts.fragment) {
  8966. this._parts.fragment = null;
  8967. this.build(!build);
  8968. }
  8969. return this;
  8970. };
  8971. p2.normalizeSearch = p2.normalizeQuery;
  8972. p2.normalizeHash = p2.normalizeFragment;
  8973. p2.iso8859 = function() {
  8974. var e2 = URI2.encode;
  8975. var d = URI2.decode;
  8976. URI2.encode = escape;
  8977. URI2.decode = decodeURIComponent;
  8978. try {
  8979. this.normalize();
  8980. } finally {
  8981. URI2.encode = e2;
  8982. URI2.decode = d;
  8983. }
  8984. return this;
  8985. };
  8986. p2.unicode = function() {
  8987. var e2 = URI2.encode;
  8988. var d = URI2.decode;
  8989. URI2.encode = strictEncodeURIComponent;
  8990. URI2.decode = unescape;
  8991. try {
  8992. this.normalize();
  8993. } finally {
  8994. URI2.encode = e2;
  8995. URI2.decode = d;
  8996. }
  8997. return this;
  8998. };
  8999. p2.readable = function() {
  9000. var uri = this.clone();
  9001. uri.username("").password("").normalize();
  9002. var t = "";
  9003. if (uri._parts.protocol) {
  9004. t += uri._parts.protocol + "://";
  9005. }
  9006. if (uri._parts.hostname) {
  9007. if (uri.is("punycode") && punycode2) {
  9008. t += punycode2.toUnicode(uri._parts.hostname);
  9009. if (uri._parts.port) {
  9010. t += ":" + uri._parts.port;
  9011. }
  9012. } else {
  9013. t += uri.host();
  9014. }
  9015. }
  9016. if (uri._parts.hostname && uri._parts.path && uri._parts.path.charAt(0) !== "/") {
  9017. t += "/";
  9018. }
  9019. t += uri.path(true);
  9020. if (uri._parts.query) {
  9021. var q3 = "";
  9022. for (var i2 = 0, qp = uri._parts.query.split("&"), l2 = qp.length; i2 < l2; i2++) {
  9023. var kv = (qp[i2] || "").split("=");
  9024. q3 += "&" + URI2.decodeQuery(kv[0], this._parts.escapeQuerySpace).replace(/&/g, "%26");
  9025. if (kv[1] !== void 0) {
  9026. q3 += "=" + URI2.decodeQuery(kv[1], this._parts.escapeQuerySpace).replace(/&/g, "%26");
  9027. }
  9028. }
  9029. t += "?" + q3.substring(1);
  9030. }
  9031. t += URI2.decodeQuery(uri.hash(), true);
  9032. return t;
  9033. };
  9034. p2.absoluteTo = function(base) {
  9035. var resolved = this.clone();
  9036. var properties = ["protocol", "username", "password", "hostname", "port"];
  9037. var basedir, i2, p3;
  9038. if (this._parts.urn) {
  9039. throw new Error("URNs do not have any generally defined hierarchical components");
  9040. }
  9041. if (!(base instanceof URI2)) {
  9042. base = new URI2(base);
  9043. }
  9044. if (resolved._parts.protocol) {
  9045. return resolved;
  9046. } else {
  9047. resolved._parts.protocol = base._parts.protocol;
  9048. }
  9049. if (this._parts.hostname) {
  9050. return resolved;
  9051. }
  9052. for (i2 = 0; p3 = properties[i2]; i2++) {
  9053. resolved._parts[p3] = base._parts[p3];
  9054. }
  9055. if (!resolved._parts.path) {
  9056. resolved._parts.path = base._parts.path;
  9057. if (!resolved._parts.query) {
  9058. resolved._parts.query = base._parts.query;
  9059. }
  9060. } else {
  9061. if (resolved._parts.path.substring(-2) === "..") {
  9062. resolved._parts.path += "/";
  9063. }
  9064. if (resolved.path().charAt(0) !== "/") {
  9065. basedir = base.directory();
  9066. basedir = basedir ? basedir : base.path().indexOf("/") === 0 ? "/" : "";
  9067. resolved._parts.path = (basedir ? basedir + "/" : "") + resolved._parts.path;
  9068. resolved.normalizePath();
  9069. }
  9070. }
  9071. resolved.build();
  9072. return resolved;
  9073. };
  9074. p2.relativeTo = function(base) {
  9075. var relative = this.clone().normalize();
  9076. var relativeParts, baseParts, common2, relativePath, basePath;
  9077. if (relative._parts.urn) {
  9078. throw new Error("URNs do not have any generally defined hierarchical components");
  9079. }
  9080. base = new URI2(base).normalize();
  9081. relativeParts = relative._parts;
  9082. baseParts = base._parts;
  9083. relativePath = relative.path();
  9084. basePath = base.path();
  9085. if (relativePath.charAt(0) !== "/") {
  9086. throw new Error("URI is already relative");
  9087. }
  9088. if (basePath.charAt(0) !== "/") {
  9089. throw new Error("Cannot calculate a URI relative to another relative URI");
  9090. }
  9091. if (relativeParts.protocol === baseParts.protocol) {
  9092. relativeParts.protocol = null;
  9093. }
  9094. if (relativeParts.username !== baseParts.username || relativeParts.password !== baseParts.password) {
  9095. return relative.build();
  9096. }
  9097. if (relativeParts.protocol !== null || relativeParts.username !== null || relativeParts.password !== null) {
  9098. return relative.build();
  9099. }
  9100. if (relativeParts.hostname === baseParts.hostname && relativeParts.port === baseParts.port) {
  9101. relativeParts.hostname = null;
  9102. relativeParts.port = null;
  9103. } else {
  9104. return relative.build();
  9105. }
  9106. if (relativePath === basePath) {
  9107. relativeParts.path = "";
  9108. return relative.build();
  9109. }
  9110. common2 = URI2.commonPath(relativePath, basePath);
  9111. if (!common2) {
  9112. return relative.build();
  9113. }
  9114. var parents = baseParts.path.substring(common2.length).replace(/[^\/]*$/, "").replace(/.*?\//g, "../");
  9115. relativeParts.path = parents + relativeParts.path.substring(common2.length) || "./";
  9116. return relative.build();
  9117. };
  9118. p2.equals = function(uri) {
  9119. var one = this.clone();
  9120. var two = new URI2(uri);
  9121. var one_map = {};
  9122. var two_map = {};
  9123. var checked = {};
  9124. var one_query, two_query, key;
  9125. one.normalize();
  9126. two.normalize();
  9127. if (one.toString() === two.toString()) {
  9128. return true;
  9129. }
  9130. one_query = one.query();
  9131. two_query = two.query();
  9132. one.query("");
  9133. two.query("");
  9134. if (one.toString() !== two.toString()) {
  9135. return false;
  9136. }
  9137. if (one_query.length !== two_query.length) {
  9138. return false;
  9139. }
  9140. one_map = URI2.parseQuery(one_query, this._parts.escapeQuerySpace);
  9141. two_map = URI2.parseQuery(two_query, this._parts.escapeQuerySpace);
  9142. for (key in one_map) {
  9143. if (hasOwn.call(one_map, key)) {
  9144. if (!isArray(one_map[key])) {
  9145. if (one_map[key] !== two_map[key]) {
  9146. return false;
  9147. }
  9148. } else if (!arraysEqual(one_map[key], two_map[key])) {
  9149. return false;
  9150. }
  9151. checked[key] = true;
  9152. }
  9153. }
  9154. for (key in two_map) {
  9155. if (hasOwn.call(two_map, key)) {
  9156. if (!checked[key]) {
  9157. return false;
  9158. }
  9159. }
  9160. }
  9161. return true;
  9162. };
  9163. p2.preventInvalidHostname = function(v7) {
  9164. this._parts.preventInvalidHostname = !!v7;
  9165. return this;
  9166. };
  9167. p2.duplicateQueryParameters = function(v7) {
  9168. this._parts.duplicateQueryParameters = !!v7;
  9169. return this;
  9170. };
  9171. p2.escapeQuerySpace = function(v7) {
  9172. this._parts.escapeQuerySpace = !!v7;
  9173. return this;
  9174. };
  9175. return URI2;
  9176. });
  9177. });
  9178. // node_modules/cesium/Source/Core/getAbsoluteUri.js
  9179. function getAbsoluteUri(relative, base) {
  9180. let documentObject;
  9181. if (typeof document !== "undefined") {
  9182. documentObject = document;
  9183. }
  9184. return getAbsoluteUri._implementation(relative, base, documentObject);
  9185. }
  9186. getAbsoluteUri._implementation = function(relative, base, documentObject) {
  9187. if (!defined_default(relative)) {
  9188. throw new DeveloperError_default("relative uri is required.");
  9189. }
  9190. if (!defined_default(base)) {
  9191. if (typeof documentObject === "undefined") {
  9192. return relative;
  9193. }
  9194. base = defaultValue_default(documentObject.baseURI, documentObject.location.href);
  9195. }
  9196. const relativeUri = new URI(relative);
  9197. if (relativeUri.scheme() !== "") {
  9198. return relativeUri.toString();
  9199. }
  9200. return relativeUri.absoluteTo(base).toString();
  9201. };
  9202. var getAbsoluteUri_default = getAbsoluteUri;
  9203. // node_modules/cesium/Source/Core/appendForwardSlash.js
  9204. function appendForwardSlash(url2) {
  9205. if (url2.length === 0 || url2[url2.length - 1] !== "/") {
  9206. url2 = `${url2}/`;
  9207. }
  9208. return url2;
  9209. }
  9210. var appendForwardSlash_default = appendForwardSlash;
  9211. // node_modules/cesium/Source/Core/clone.js
  9212. function clone(object2, deep) {
  9213. if (object2 === null || typeof object2 !== "object") {
  9214. return object2;
  9215. }
  9216. deep = defaultValue_default(deep, false);
  9217. const result = new object2.constructor();
  9218. for (const propertyName in object2) {
  9219. if (object2.hasOwnProperty(propertyName)) {
  9220. let value = object2[propertyName];
  9221. if (deep) {
  9222. value = clone(value, deep);
  9223. }
  9224. result[propertyName] = value;
  9225. }
  9226. }
  9227. return result;
  9228. }
  9229. var clone_default = clone;
  9230. // node_modules/cesium/Source/Core/combine.js
  9231. function combine(object1, object2, deep) {
  9232. deep = defaultValue_default(deep, false);
  9233. const result = {};
  9234. const object1Defined = defined_default(object1);
  9235. const object2Defined = defined_default(object2);
  9236. let property;
  9237. let object1Value;
  9238. let object2Value;
  9239. if (object1Defined) {
  9240. for (property in object1) {
  9241. if (object1.hasOwnProperty(property)) {
  9242. object1Value = object1[property];
  9243. if (object2Defined && deep && typeof object1Value === "object" && object2.hasOwnProperty(property)) {
  9244. object2Value = object2[property];
  9245. if (typeof object2Value === "object") {
  9246. result[property] = combine(object1Value, object2Value, deep);
  9247. } else {
  9248. result[property] = object1Value;
  9249. }
  9250. } else {
  9251. result[property] = object1Value;
  9252. }
  9253. }
  9254. }
  9255. }
  9256. if (object2Defined) {
  9257. for (property in object2) {
  9258. if (object2.hasOwnProperty(property) && !result.hasOwnProperty(property)) {
  9259. object2Value = object2[property];
  9260. result[property] = object2Value;
  9261. }
  9262. }
  9263. }
  9264. return result;
  9265. }
  9266. var combine_default = combine;
  9267. // node_modules/cesium/Source/Core/defer.js
  9268. function defer() {
  9269. let resolve2;
  9270. let reject;
  9271. const promise = new Promise(function(res, rej) {
  9272. resolve2 = res;
  9273. reject = rej;
  9274. });
  9275. return {
  9276. resolve: resolve2,
  9277. reject,
  9278. promise
  9279. };
  9280. }
  9281. var defer_default = defer;
  9282. // node_modules/cesium/Source/Core/getBaseUri.js
  9283. function getBaseUri(uri, includeQuery) {
  9284. if (!defined_default(uri)) {
  9285. throw new DeveloperError_default("uri is required.");
  9286. }
  9287. let basePath = "";
  9288. const i2 = uri.lastIndexOf("/");
  9289. if (i2 !== -1) {
  9290. basePath = uri.substring(0, i2 + 1);
  9291. }
  9292. if (!includeQuery) {
  9293. return basePath;
  9294. }
  9295. uri = new URI(uri);
  9296. if (uri.query().length !== 0) {
  9297. basePath += `?${uri.query()}`;
  9298. }
  9299. if (uri.fragment().length !== 0) {
  9300. basePath += `#${uri.fragment()}`;
  9301. }
  9302. return basePath;
  9303. }
  9304. var getBaseUri_default = getBaseUri;
  9305. // node_modules/cesium/Source/Core/getExtensionFromUri.js
  9306. function getExtensionFromUri(uri) {
  9307. if (!defined_default(uri)) {
  9308. throw new DeveloperError_default("uri is required.");
  9309. }
  9310. const uriObject = new URI(uri);
  9311. uriObject.normalize();
  9312. let path = uriObject.path();
  9313. let index2 = path.lastIndexOf("/");
  9314. if (index2 !== -1) {
  9315. path = path.substr(index2 + 1);
  9316. }
  9317. index2 = path.lastIndexOf(".");
  9318. if (index2 === -1) {
  9319. path = "";
  9320. } else {
  9321. path = path.substr(index2 + 1);
  9322. }
  9323. return path;
  9324. }
  9325. var getExtensionFromUri_default = getExtensionFromUri;
  9326. // node_modules/cesium/Source/Core/getImagePixels.js
  9327. var context2DsByWidthAndHeight = {};
  9328. function getImagePixels(image, width, height) {
  9329. if (!defined_default(width)) {
  9330. width = image.width;
  9331. }
  9332. if (!defined_default(height)) {
  9333. height = image.height;
  9334. }
  9335. let context2DsByHeight = context2DsByWidthAndHeight[width];
  9336. if (!defined_default(context2DsByHeight)) {
  9337. context2DsByHeight = {};
  9338. context2DsByWidthAndHeight[width] = context2DsByHeight;
  9339. }
  9340. let context2d = context2DsByHeight[height];
  9341. if (!defined_default(context2d)) {
  9342. const canvas = document.createElement("canvas");
  9343. canvas.width = width;
  9344. canvas.height = height;
  9345. context2d = canvas.getContext("2d");
  9346. context2d.globalCompositeOperation = "copy";
  9347. context2DsByHeight[height] = context2d;
  9348. }
  9349. context2d.drawImage(image, 0, 0, width, height);
  9350. return context2d.getImageData(0, 0, width, height).data;
  9351. }
  9352. var getImagePixels_default = getImagePixels;
  9353. // node_modules/cesium/Source/Core/isBlobUri.js
  9354. var blobUriRegex = /^blob:/i;
  9355. function isBlobUri(uri) {
  9356. Check_default.typeOf.string("uri", uri);
  9357. return blobUriRegex.test(uri);
  9358. }
  9359. var isBlobUri_default = isBlobUri;
  9360. // node_modules/cesium/Source/Core/isCrossOriginUrl.js
  9361. var a;
  9362. function isCrossOriginUrl(url2) {
  9363. if (!defined_default(a)) {
  9364. a = document.createElement("a");
  9365. }
  9366. a.href = window.location.href;
  9367. const host = a.host;
  9368. const protocol = a.protocol;
  9369. a.href = url2;
  9370. a.href = a.href;
  9371. return protocol !== a.protocol || host !== a.host;
  9372. }
  9373. var isCrossOriginUrl_default = isCrossOriginUrl;
  9374. // node_modules/cesium/Source/Core/isDataUri.js
  9375. var dataUriRegex = /^data:/i;
  9376. function isDataUri(uri) {
  9377. Check_default.typeOf.string("uri", uri);
  9378. return dataUriRegex.test(uri);
  9379. }
  9380. var isDataUri_default = isDataUri;
  9381. // node_modules/cesium/Source/Core/loadAndExecuteScript.js
  9382. function loadAndExecuteScript(url2) {
  9383. const deferred = defer_default();
  9384. const script = document.createElement("script");
  9385. script.async = true;
  9386. script.src = url2;
  9387. const head = document.getElementsByTagName("head")[0];
  9388. script.onload = function() {
  9389. script.onload = void 0;
  9390. head.removeChild(script);
  9391. deferred.resolve();
  9392. };
  9393. script.onerror = function(e2) {
  9394. deferred.reject(e2);
  9395. };
  9396. head.appendChild(script);
  9397. return deferred.promise;
  9398. }
  9399. var loadAndExecuteScript_default = loadAndExecuteScript;
  9400. // node_modules/cesium/Source/Core/objectToQuery.js
  9401. function objectToQuery(obj) {
  9402. if (!defined_default(obj)) {
  9403. throw new DeveloperError_default("obj is required.");
  9404. }
  9405. let result = "";
  9406. for (const propName in obj) {
  9407. if (obj.hasOwnProperty(propName)) {
  9408. const value = obj[propName];
  9409. const part = `${encodeURIComponent(propName)}=`;
  9410. if (Array.isArray(value)) {
  9411. for (let i2 = 0, len = value.length; i2 < len; ++i2) {
  9412. result += `${part + encodeURIComponent(value[i2])}&`;
  9413. }
  9414. } else {
  9415. result += `${part + encodeURIComponent(value)}&`;
  9416. }
  9417. }
  9418. }
  9419. result = result.slice(0, -1);
  9420. return result;
  9421. }
  9422. var objectToQuery_default = objectToQuery;
  9423. // node_modules/cesium/Source/Core/queryToObject.js
  9424. function queryToObject(queryString) {
  9425. if (!defined_default(queryString)) {
  9426. throw new DeveloperError_default("queryString is required.");
  9427. }
  9428. const result = {};
  9429. if (queryString === "") {
  9430. return result;
  9431. }
  9432. const parts = queryString.replace(/\+/g, "%20").split(/[&;]/);
  9433. for (let i2 = 0, len = parts.length; i2 < len; ++i2) {
  9434. const subparts = parts[i2].split("=");
  9435. const name = decodeURIComponent(subparts[0]);
  9436. let value = subparts[1];
  9437. if (defined_default(value)) {
  9438. value = decodeURIComponent(value);
  9439. } else {
  9440. value = "";
  9441. }
  9442. const resultValue = result[name];
  9443. if (typeof resultValue === "string") {
  9444. result[name] = [resultValue, value];
  9445. } else if (Array.isArray(resultValue)) {
  9446. resultValue.push(value);
  9447. } else {
  9448. result[name] = value;
  9449. }
  9450. }
  9451. return result;
  9452. }
  9453. var queryToObject_default = queryToObject;
  9454. // node_modules/cesium/Source/Core/RequestState.js
  9455. var RequestState = {
  9456. UNISSUED: 0,
  9457. ISSUED: 1,
  9458. ACTIVE: 2,
  9459. RECEIVED: 3,
  9460. CANCELLED: 4,
  9461. FAILED: 5
  9462. };
  9463. var RequestState_default = Object.freeze(RequestState);
  9464. // node_modules/cesium/Source/Core/RequestType.js
  9465. var RequestType = {
  9466. TERRAIN: 0,
  9467. IMAGERY: 1,
  9468. TILES3D: 2,
  9469. OTHER: 3
  9470. };
  9471. var RequestType_default = Object.freeze(RequestType);
  9472. // node_modules/cesium/Source/Core/Request.js
  9473. function Request(options) {
  9474. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  9475. const throttleByServer = defaultValue_default(options.throttleByServer, false);
  9476. const throttle = defaultValue_default(options.throttle, false);
  9477. this.url = options.url;
  9478. this.requestFunction = options.requestFunction;
  9479. this.cancelFunction = options.cancelFunction;
  9480. this.priorityFunction = options.priorityFunction;
  9481. this.priority = defaultValue_default(options.priority, 0);
  9482. this.throttle = throttle;
  9483. this.throttleByServer = throttleByServer;
  9484. this.type = defaultValue_default(options.type, RequestType_default.OTHER);
  9485. this.serverKey = void 0;
  9486. this.state = RequestState_default.UNISSUED;
  9487. this.deferred = void 0;
  9488. this.cancelled = false;
  9489. }
  9490. Request.prototype.cancel = function() {
  9491. this.cancelled = true;
  9492. };
  9493. Request.prototype.clone = function(result) {
  9494. if (!defined_default(result)) {
  9495. return new Request(this);
  9496. }
  9497. result.url = this.url;
  9498. result.requestFunction = this.requestFunction;
  9499. result.cancelFunction = this.cancelFunction;
  9500. result.priorityFunction = this.priorityFunction;
  9501. result.priority = this.priority;
  9502. result.throttle = this.throttle;
  9503. result.throttleByServer = this.throttleByServer;
  9504. result.type = this.type;
  9505. result.serverKey = this.serverKey;
  9506. result.state = this.RequestState.UNISSUED;
  9507. result.deferred = void 0;
  9508. result.cancelled = false;
  9509. return result;
  9510. };
  9511. var Request_default = Request;
  9512. // node_modules/cesium/Source/Core/parseResponseHeaders.js
  9513. function parseResponseHeaders(headerString) {
  9514. const headers = {};
  9515. if (!headerString) {
  9516. return headers;
  9517. }
  9518. const headerPairs = headerString.split("\r\n");
  9519. for (let i2 = 0; i2 < headerPairs.length; ++i2) {
  9520. const headerPair = headerPairs[i2];
  9521. const index2 = headerPair.indexOf(": ");
  9522. if (index2 > 0) {
  9523. const key = headerPair.substring(0, index2);
  9524. const val = headerPair.substring(index2 + 2);
  9525. headers[key] = val;
  9526. }
  9527. }
  9528. return headers;
  9529. }
  9530. var parseResponseHeaders_default = parseResponseHeaders;
  9531. // node_modules/cesium/Source/Core/RequestErrorEvent.js
  9532. function RequestErrorEvent(statusCode, response, responseHeaders) {
  9533. this.statusCode = statusCode;
  9534. this.response = response;
  9535. this.responseHeaders = responseHeaders;
  9536. if (typeof this.responseHeaders === "string") {
  9537. this.responseHeaders = parseResponseHeaders_default(this.responseHeaders);
  9538. }
  9539. }
  9540. RequestErrorEvent.prototype.toString = function() {
  9541. let str = "Request has failed.";
  9542. if (defined_default(this.statusCode)) {
  9543. str += ` Status Code: ${this.statusCode}`;
  9544. }
  9545. return str;
  9546. };
  9547. var RequestErrorEvent_default = RequestErrorEvent;
  9548. // node_modules/cesium/Source/Core/Event.js
  9549. function Event() {
  9550. this._listeners = [];
  9551. this._scopes = [];
  9552. this._toRemove = [];
  9553. this._insideRaiseEvent = false;
  9554. }
  9555. Object.defineProperties(Event.prototype, {
  9556. numberOfListeners: {
  9557. get: function() {
  9558. return this._listeners.length - this._toRemove.length;
  9559. }
  9560. }
  9561. });
  9562. Event.prototype.addEventListener = function(listener, scope) {
  9563. Check_default.typeOf.func("listener", listener);
  9564. this._listeners.push(listener);
  9565. this._scopes.push(scope);
  9566. const event = this;
  9567. return function() {
  9568. event.removeEventListener(listener, scope);
  9569. };
  9570. };
  9571. Event.prototype.removeEventListener = function(listener, scope) {
  9572. Check_default.typeOf.func("listener", listener);
  9573. const listeners = this._listeners;
  9574. const scopes = this._scopes;
  9575. let index2 = -1;
  9576. for (let i2 = 0; i2 < listeners.length; i2++) {
  9577. if (listeners[i2] === listener && scopes[i2] === scope) {
  9578. index2 = i2;
  9579. break;
  9580. }
  9581. }
  9582. if (index2 !== -1) {
  9583. if (this._insideRaiseEvent) {
  9584. this._toRemove.push(index2);
  9585. listeners[index2] = void 0;
  9586. scopes[index2] = void 0;
  9587. } else {
  9588. listeners.splice(index2, 1);
  9589. scopes.splice(index2, 1);
  9590. }
  9591. return true;
  9592. }
  9593. return false;
  9594. };
  9595. function compareNumber(a4, b) {
  9596. return b - a4;
  9597. }
  9598. Event.prototype.raiseEvent = function() {
  9599. this._insideRaiseEvent = true;
  9600. let i2;
  9601. const listeners = this._listeners;
  9602. const scopes = this._scopes;
  9603. let length3 = listeners.length;
  9604. for (i2 = 0; i2 < length3; i2++) {
  9605. const listener = listeners[i2];
  9606. if (defined_default(listener)) {
  9607. listeners[i2].apply(scopes[i2], arguments);
  9608. }
  9609. }
  9610. const toRemove = this._toRemove;
  9611. length3 = toRemove.length;
  9612. if (length3 > 0) {
  9613. toRemove.sort(compareNumber);
  9614. for (i2 = 0; i2 < length3; i2++) {
  9615. const index2 = toRemove[i2];
  9616. listeners.splice(index2, 1);
  9617. scopes.splice(index2, 1);
  9618. }
  9619. toRemove.length = 0;
  9620. }
  9621. this._insideRaiseEvent = false;
  9622. };
  9623. var Event_default = Event;
  9624. // node_modules/cesium/Source/Core/Heap.js
  9625. function Heap(options) {
  9626. Check_default.typeOf.object("options", options);
  9627. Check_default.defined("options.comparator", options.comparator);
  9628. this._comparator = options.comparator;
  9629. this._array = [];
  9630. this._length = 0;
  9631. this._maximumLength = void 0;
  9632. }
  9633. Object.defineProperties(Heap.prototype, {
  9634. length: {
  9635. get: function() {
  9636. return this._length;
  9637. }
  9638. },
  9639. internalArray: {
  9640. get: function() {
  9641. return this._array;
  9642. }
  9643. },
  9644. maximumLength: {
  9645. get: function() {
  9646. return this._maximumLength;
  9647. },
  9648. set: function(value) {
  9649. Check_default.typeOf.number.greaterThanOrEquals("maximumLength", value, 0);
  9650. const originalLength = this._length;
  9651. if (value < originalLength) {
  9652. const array = this._array;
  9653. for (let i2 = value; i2 < originalLength; ++i2) {
  9654. array[i2] = void 0;
  9655. }
  9656. this._length = value;
  9657. array.length = value;
  9658. }
  9659. this._maximumLength = value;
  9660. }
  9661. },
  9662. comparator: {
  9663. get: function() {
  9664. return this._comparator;
  9665. }
  9666. }
  9667. });
  9668. function swap(array, a4, b) {
  9669. const temp = array[a4];
  9670. array[a4] = array[b];
  9671. array[b] = temp;
  9672. }
  9673. Heap.prototype.reserve = function(length3) {
  9674. length3 = defaultValue_default(length3, this._length);
  9675. this._array.length = length3;
  9676. };
  9677. Heap.prototype.heapify = function(index2) {
  9678. index2 = defaultValue_default(index2, 0);
  9679. const length3 = this._length;
  9680. const comparator = this._comparator;
  9681. const array = this._array;
  9682. let candidate = -1;
  9683. let inserting = true;
  9684. while (inserting) {
  9685. const right = 2 * (index2 + 1);
  9686. const left = right - 1;
  9687. if (left < length3 && comparator(array[left], array[index2]) < 0) {
  9688. candidate = left;
  9689. } else {
  9690. candidate = index2;
  9691. }
  9692. if (right < length3 && comparator(array[right], array[candidate]) < 0) {
  9693. candidate = right;
  9694. }
  9695. if (candidate !== index2) {
  9696. swap(array, candidate, index2);
  9697. index2 = candidate;
  9698. } else {
  9699. inserting = false;
  9700. }
  9701. }
  9702. };
  9703. Heap.prototype.resort = function() {
  9704. const length3 = this._length;
  9705. for (let i2 = Math.ceil(length3 / 2); i2 >= 0; --i2) {
  9706. this.heapify(i2);
  9707. }
  9708. };
  9709. Heap.prototype.insert = function(element) {
  9710. Check_default.defined("element", element);
  9711. const array = this._array;
  9712. const comparator = this._comparator;
  9713. const maximumLength = this._maximumLength;
  9714. let index2 = this._length++;
  9715. if (index2 < array.length) {
  9716. array[index2] = element;
  9717. } else {
  9718. array.push(element);
  9719. }
  9720. while (index2 !== 0) {
  9721. const parent = Math.floor((index2 - 1) / 2);
  9722. if (comparator(array[index2], array[parent]) < 0) {
  9723. swap(array, index2, parent);
  9724. index2 = parent;
  9725. } else {
  9726. break;
  9727. }
  9728. }
  9729. let removedElement;
  9730. if (defined_default(maximumLength) && this._length > maximumLength) {
  9731. removedElement = array[maximumLength];
  9732. this._length = maximumLength;
  9733. }
  9734. return removedElement;
  9735. };
  9736. Heap.prototype.pop = function(index2) {
  9737. index2 = defaultValue_default(index2, 0);
  9738. if (this._length === 0) {
  9739. return void 0;
  9740. }
  9741. Check_default.typeOf.number.lessThan("index", index2, this._length);
  9742. const array = this._array;
  9743. const root = array[index2];
  9744. swap(array, index2, --this._length);
  9745. this.heapify(index2);
  9746. array[this._length] = void 0;
  9747. return root;
  9748. };
  9749. var Heap_default = Heap;
  9750. // node_modules/cesium/Source/Core/RequestScheduler.js
  9751. function sortRequests(a4, b) {
  9752. return a4.priority - b.priority;
  9753. }
  9754. var statistics = {
  9755. numberOfAttemptedRequests: 0,
  9756. numberOfActiveRequests: 0,
  9757. numberOfCancelledRequests: 0,
  9758. numberOfCancelledActiveRequests: 0,
  9759. numberOfFailedRequests: 0,
  9760. numberOfActiveRequestsEver: 0,
  9761. lastNumberOfActiveRequests: 0
  9762. };
  9763. var priorityHeapLength = 20;
  9764. var requestHeap = new Heap_default({
  9765. comparator: sortRequests
  9766. });
  9767. requestHeap.maximumLength = priorityHeapLength;
  9768. requestHeap.reserve(priorityHeapLength);
  9769. var activeRequests = [];
  9770. var numberOfActiveRequestsByServer = {};
  9771. var pageUri = typeof document !== "undefined" ? new URI(document.location.href) : new URI();
  9772. var requestCompletedEvent = new Event_default();
  9773. function RequestScheduler() {
  9774. }
  9775. RequestScheduler.maximumRequests = 50;
  9776. RequestScheduler.maximumRequestsPerServer = 6;
  9777. RequestScheduler.requestsByServer = {
  9778. "api.cesium.com:443": 18,
  9779. "assets.cesium.com:443": 18
  9780. };
  9781. RequestScheduler.throttleRequests = true;
  9782. RequestScheduler.debugShowStatistics = false;
  9783. RequestScheduler.requestCompletedEvent = requestCompletedEvent;
  9784. Object.defineProperties(RequestScheduler, {
  9785. statistics: {
  9786. get: function() {
  9787. return statistics;
  9788. }
  9789. },
  9790. priorityHeapLength: {
  9791. get: function() {
  9792. return priorityHeapLength;
  9793. },
  9794. set: function(value) {
  9795. if (value < priorityHeapLength) {
  9796. while (requestHeap.length > value) {
  9797. const request = requestHeap.pop();
  9798. cancelRequest(request);
  9799. }
  9800. }
  9801. priorityHeapLength = value;
  9802. requestHeap.maximumLength = value;
  9803. requestHeap.reserve(value);
  9804. }
  9805. }
  9806. });
  9807. function updatePriority(request) {
  9808. if (defined_default(request.priorityFunction)) {
  9809. request.priority = request.priorityFunction();
  9810. }
  9811. }
  9812. RequestScheduler.serverHasOpenSlots = function(serverKey, desiredRequests) {
  9813. desiredRequests = defaultValue_default(desiredRequests, 1);
  9814. const maxRequests = defaultValue_default(
  9815. RequestScheduler.requestsByServer[serverKey],
  9816. RequestScheduler.maximumRequestsPerServer
  9817. );
  9818. const hasOpenSlotsServer = numberOfActiveRequestsByServer[serverKey] + desiredRequests <= maxRequests;
  9819. return hasOpenSlotsServer;
  9820. };
  9821. RequestScheduler.heapHasOpenSlots = function(desiredRequests) {
  9822. const hasOpenSlotsHeap = requestHeap.length + desiredRequests <= priorityHeapLength;
  9823. return hasOpenSlotsHeap;
  9824. };
  9825. function issueRequest(request) {
  9826. if (request.state === RequestState_default.UNISSUED) {
  9827. request.state = RequestState_default.ISSUED;
  9828. request.deferred = defer_default();
  9829. }
  9830. return request.deferred.promise;
  9831. }
  9832. function getRequestReceivedFunction(request) {
  9833. return function(results) {
  9834. if (request.state === RequestState_default.CANCELLED) {
  9835. return;
  9836. }
  9837. const deferred = request.deferred;
  9838. --statistics.numberOfActiveRequests;
  9839. --numberOfActiveRequestsByServer[request.serverKey];
  9840. requestCompletedEvent.raiseEvent();
  9841. request.state = RequestState_default.RECEIVED;
  9842. request.deferred = void 0;
  9843. deferred.resolve(results);
  9844. };
  9845. }
  9846. function getRequestFailedFunction(request) {
  9847. return function(error) {
  9848. if (request.state === RequestState_default.CANCELLED) {
  9849. return;
  9850. }
  9851. ++statistics.numberOfFailedRequests;
  9852. --statistics.numberOfActiveRequests;
  9853. --numberOfActiveRequestsByServer[request.serverKey];
  9854. requestCompletedEvent.raiseEvent(error);
  9855. request.state = RequestState_default.FAILED;
  9856. request.deferred.reject(error);
  9857. };
  9858. }
  9859. function startRequest(request) {
  9860. const promise = issueRequest(request);
  9861. request.state = RequestState_default.ACTIVE;
  9862. activeRequests.push(request);
  9863. ++statistics.numberOfActiveRequests;
  9864. ++statistics.numberOfActiveRequestsEver;
  9865. ++numberOfActiveRequestsByServer[request.serverKey];
  9866. request.requestFunction().then(getRequestReceivedFunction(request)).catch(getRequestFailedFunction(request));
  9867. return promise;
  9868. }
  9869. function cancelRequest(request) {
  9870. const active = request.state === RequestState_default.ACTIVE;
  9871. request.state = RequestState_default.CANCELLED;
  9872. ++statistics.numberOfCancelledRequests;
  9873. if (defined_default(request.deferred)) {
  9874. const deferred = request.deferred;
  9875. request.deferred = void 0;
  9876. deferred.reject();
  9877. }
  9878. if (active) {
  9879. --statistics.numberOfActiveRequests;
  9880. --numberOfActiveRequestsByServer[request.serverKey];
  9881. ++statistics.numberOfCancelledActiveRequests;
  9882. }
  9883. if (defined_default(request.cancelFunction)) {
  9884. request.cancelFunction();
  9885. }
  9886. }
  9887. RequestScheduler.update = function() {
  9888. let i2;
  9889. let request;
  9890. let removeCount = 0;
  9891. const activeLength = activeRequests.length;
  9892. for (i2 = 0; i2 < activeLength; ++i2) {
  9893. request = activeRequests[i2];
  9894. if (request.cancelled) {
  9895. cancelRequest(request);
  9896. }
  9897. if (request.state !== RequestState_default.ACTIVE) {
  9898. ++removeCount;
  9899. continue;
  9900. }
  9901. if (removeCount > 0) {
  9902. activeRequests[i2 - removeCount] = request;
  9903. }
  9904. }
  9905. activeRequests.length -= removeCount;
  9906. const issuedRequests = requestHeap.internalArray;
  9907. const issuedLength = requestHeap.length;
  9908. for (i2 = 0; i2 < issuedLength; ++i2) {
  9909. updatePriority(issuedRequests[i2]);
  9910. }
  9911. requestHeap.resort();
  9912. const openSlots = Math.max(
  9913. RequestScheduler.maximumRequests - activeRequests.length,
  9914. 0
  9915. );
  9916. let filledSlots = 0;
  9917. while (filledSlots < openSlots && requestHeap.length > 0) {
  9918. request = requestHeap.pop();
  9919. if (request.cancelled) {
  9920. cancelRequest(request);
  9921. continue;
  9922. }
  9923. if (request.throttleByServer && !RequestScheduler.serverHasOpenSlots(request.serverKey)) {
  9924. cancelRequest(request);
  9925. continue;
  9926. }
  9927. startRequest(request);
  9928. ++filledSlots;
  9929. }
  9930. updateStatistics();
  9931. };
  9932. RequestScheduler.getServerKey = function(url2) {
  9933. Check_default.typeOf.string("url", url2);
  9934. let uri = new URI(url2);
  9935. if (uri.scheme() === "") {
  9936. uri = new URI(url2).absoluteTo(pageUri);
  9937. uri.normalize();
  9938. }
  9939. let serverKey = uri.authority();
  9940. if (!/:/.test(serverKey)) {
  9941. serverKey = `${serverKey}:${uri.scheme() === "https" ? "443" : "80"}`;
  9942. }
  9943. const length3 = numberOfActiveRequestsByServer[serverKey];
  9944. if (!defined_default(length3)) {
  9945. numberOfActiveRequestsByServer[serverKey] = 0;
  9946. }
  9947. return serverKey;
  9948. };
  9949. RequestScheduler.request = function(request) {
  9950. Check_default.typeOf.object("request", request);
  9951. Check_default.typeOf.string("request.url", request.url);
  9952. Check_default.typeOf.func("request.requestFunction", request.requestFunction);
  9953. if (isDataUri_default(request.url) || isBlobUri_default(request.url)) {
  9954. requestCompletedEvent.raiseEvent();
  9955. request.state = RequestState_default.RECEIVED;
  9956. return request.requestFunction();
  9957. }
  9958. ++statistics.numberOfAttemptedRequests;
  9959. if (!defined_default(request.serverKey)) {
  9960. request.serverKey = RequestScheduler.getServerKey(request.url);
  9961. }
  9962. if (RequestScheduler.throttleRequests && request.throttleByServer && !RequestScheduler.serverHasOpenSlots(request.serverKey)) {
  9963. return void 0;
  9964. }
  9965. if (!RequestScheduler.throttleRequests || !request.throttle) {
  9966. return startRequest(request);
  9967. }
  9968. if (activeRequests.length >= RequestScheduler.maximumRequests) {
  9969. return void 0;
  9970. }
  9971. updatePriority(request);
  9972. const removedRequest = requestHeap.insert(request);
  9973. if (defined_default(removedRequest)) {
  9974. if (removedRequest === request) {
  9975. return void 0;
  9976. }
  9977. cancelRequest(removedRequest);
  9978. }
  9979. return issueRequest(request);
  9980. };
  9981. function updateStatistics() {
  9982. if (!RequestScheduler.debugShowStatistics) {
  9983. return;
  9984. }
  9985. if (statistics.numberOfActiveRequests === 0 && statistics.lastNumberOfActiveRequests > 0) {
  9986. if (statistics.numberOfAttemptedRequests > 0) {
  9987. console.log(
  9988. `Number of attempted requests: ${statistics.numberOfAttemptedRequests}`
  9989. );
  9990. statistics.numberOfAttemptedRequests = 0;
  9991. }
  9992. if (statistics.numberOfCancelledRequests > 0) {
  9993. console.log(
  9994. `Number of cancelled requests: ${statistics.numberOfCancelledRequests}`
  9995. );
  9996. statistics.numberOfCancelledRequests = 0;
  9997. }
  9998. if (statistics.numberOfCancelledActiveRequests > 0) {
  9999. console.log(
  10000. `Number of cancelled active requests: ${statistics.numberOfCancelledActiveRequests}`
  10001. );
  10002. statistics.numberOfCancelledActiveRequests = 0;
  10003. }
  10004. if (statistics.numberOfFailedRequests > 0) {
  10005. console.log(
  10006. `Number of failed requests: ${statistics.numberOfFailedRequests}`
  10007. );
  10008. statistics.numberOfFailedRequests = 0;
  10009. }
  10010. }
  10011. statistics.lastNumberOfActiveRequests = statistics.numberOfActiveRequests;
  10012. }
  10013. RequestScheduler.clearForSpecs = function() {
  10014. while (requestHeap.length > 0) {
  10015. const request = requestHeap.pop();
  10016. cancelRequest(request);
  10017. }
  10018. const length3 = activeRequests.length;
  10019. for (let i2 = 0; i2 < length3; ++i2) {
  10020. cancelRequest(activeRequests[i2]);
  10021. }
  10022. activeRequests.length = 0;
  10023. numberOfActiveRequestsByServer = {};
  10024. statistics.numberOfAttemptedRequests = 0;
  10025. statistics.numberOfActiveRequests = 0;
  10026. statistics.numberOfCancelledRequests = 0;
  10027. statistics.numberOfCancelledActiveRequests = 0;
  10028. statistics.numberOfFailedRequests = 0;
  10029. statistics.numberOfActiveRequestsEver = 0;
  10030. statistics.lastNumberOfActiveRequests = 0;
  10031. };
  10032. RequestScheduler.numberOfActiveRequestsByServer = function(serverKey) {
  10033. return numberOfActiveRequestsByServer[serverKey];
  10034. };
  10035. RequestScheduler.requestHeap = requestHeap;
  10036. var RequestScheduler_default = RequestScheduler;
  10037. // node_modules/cesium/Source/Core/TrustedServers.js
  10038. var TrustedServers = {};
  10039. var _servers = {};
  10040. TrustedServers.add = function(host, port) {
  10041. if (!defined_default(host)) {
  10042. throw new DeveloperError_default("host is required.");
  10043. }
  10044. if (!defined_default(port) || port <= 0) {
  10045. throw new DeveloperError_default("port is required to be greater than 0.");
  10046. }
  10047. const authority = `${host.toLowerCase()}:${port}`;
  10048. if (!defined_default(_servers[authority])) {
  10049. _servers[authority] = true;
  10050. }
  10051. };
  10052. TrustedServers.remove = function(host, port) {
  10053. if (!defined_default(host)) {
  10054. throw new DeveloperError_default("host is required.");
  10055. }
  10056. if (!defined_default(port) || port <= 0) {
  10057. throw new DeveloperError_default("port is required to be greater than 0.");
  10058. }
  10059. const authority = `${host.toLowerCase()}:${port}`;
  10060. if (defined_default(_servers[authority])) {
  10061. delete _servers[authority];
  10062. }
  10063. };
  10064. function getAuthority(url2) {
  10065. const uri = new URI(url2);
  10066. uri.normalize();
  10067. let authority = uri.authority();
  10068. if (authority.length === 0) {
  10069. return void 0;
  10070. }
  10071. uri.authority(authority);
  10072. if (authority.indexOf("@") !== -1) {
  10073. const parts = authority.split("@");
  10074. authority = parts[1];
  10075. }
  10076. if (authority.indexOf(":") === -1) {
  10077. let scheme = uri.scheme();
  10078. if (scheme.length === 0) {
  10079. scheme = window.location.protocol;
  10080. scheme = scheme.substring(0, scheme.length - 1);
  10081. }
  10082. if (scheme === "http") {
  10083. authority += ":80";
  10084. } else if (scheme === "https") {
  10085. authority += ":443";
  10086. } else {
  10087. return void 0;
  10088. }
  10089. }
  10090. return authority;
  10091. }
  10092. TrustedServers.contains = function(url2) {
  10093. if (!defined_default(url2)) {
  10094. throw new DeveloperError_default("url is required.");
  10095. }
  10096. const authority = getAuthority(url2);
  10097. if (defined_default(authority) && defined_default(_servers[authority])) {
  10098. return true;
  10099. }
  10100. return false;
  10101. };
  10102. TrustedServers.clear = function() {
  10103. _servers = {};
  10104. };
  10105. var TrustedServers_default = TrustedServers;
  10106. // node_modules/cesium/Source/Core/Resource.js
  10107. var xhrBlobSupported = function() {
  10108. try {
  10109. const xhr = new XMLHttpRequest();
  10110. xhr.open("GET", "#", true);
  10111. xhr.responseType = "blob";
  10112. return xhr.responseType === "blob";
  10113. } catch (e2) {
  10114. return false;
  10115. }
  10116. }();
  10117. function parseQuery(uri, resource, merge3, preserveQueryParameters) {
  10118. const queryString = uri.query();
  10119. if (queryString.length === 0) {
  10120. return {};
  10121. }
  10122. let query;
  10123. if (queryString.indexOf("=") === -1) {
  10124. const result = {};
  10125. result[queryString] = void 0;
  10126. query = result;
  10127. } else {
  10128. query = queryToObject_default(queryString);
  10129. }
  10130. if (merge3) {
  10131. resource._queryParameters = combineQueryParameters(
  10132. query,
  10133. resource._queryParameters,
  10134. preserveQueryParameters
  10135. );
  10136. } else {
  10137. resource._queryParameters = query;
  10138. }
  10139. uri.search("");
  10140. }
  10141. function stringifyQuery(uri, resource) {
  10142. const queryObject = resource._queryParameters;
  10143. const keys = Object.keys(queryObject);
  10144. if (keys.length === 1 && !defined_default(queryObject[keys[0]])) {
  10145. uri.search(keys[0]);
  10146. } else {
  10147. uri.search(objectToQuery_default(queryObject));
  10148. }
  10149. }
  10150. function defaultClone(val, defaultVal) {
  10151. if (!defined_default(val)) {
  10152. return defaultVal;
  10153. }
  10154. return defined_default(val.clone) ? val.clone() : clone_default(val);
  10155. }
  10156. function checkAndResetRequest(request) {
  10157. if (request.state === RequestState_default.ISSUED || request.state === RequestState_default.ACTIVE) {
  10158. throw new RuntimeError_default("The Resource is already being fetched.");
  10159. }
  10160. request.state = RequestState_default.UNISSUED;
  10161. request.deferred = void 0;
  10162. }
  10163. function combineQueryParameters(q12, q22, preserveQueryParameters) {
  10164. if (!preserveQueryParameters) {
  10165. return combine_default(q12, q22);
  10166. }
  10167. const result = clone_default(q12, true);
  10168. for (const param in q22) {
  10169. if (q22.hasOwnProperty(param)) {
  10170. let value = result[param];
  10171. const q2Value = q22[param];
  10172. if (defined_default(value)) {
  10173. if (!Array.isArray(value)) {
  10174. value = result[param] = [value];
  10175. }
  10176. result[param] = value.concat(q2Value);
  10177. } else {
  10178. result[param] = Array.isArray(q2Value) ? q2Value.slice() : q2Value;
  10179. }
  10180. }
  10181. }
  10182. return result;
  10183. }
  10184. function Resource(options) {
  10185. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  10186. if (typeof options === "string") {
  10187. options = {
  10188. url: options
  10189. };
  10190. }
  10191. Check_default.typeOf.string("options.url", options.url);
  10192. this._url = void 0;
  10193. this._templateValues = defaultClone(options.templateValues, {});
  10194. this._queryParameters = defaultClone(options.queryParameters, {});
  10195. this.headers = defaultClone(options.headers, {});
  10196. this.request = defaultValue_default(options.request, new Request_default());
  10197. this.proxy = options.proxy;
  10198. this.retryCallback = options.retryCallback;
  10199. this.retryAttempts = defaultValue_default(options.retryAttempts, 0);
  10200. this._retryCount = 0;
  10201. const uri = new URI(options.url);
  10202. parseQuery(uri, this, true, true);
  10203. uri.fragment("");
  10204. this._url = uri.toString();
  10205. }
  10206. Resource.createIfNeeded = function(resource) {
  10207. if (resource instanceof Resource) {
  10208. return resource.getDerivedResource({
  10209. request: resource.request
  10210. });
  10211. }
  10212. if (typeof resource !== "string") {
  10213. return resource;
  10214. }
  10215. return new Resource({
  10216. url: resource
  10217. });
  10218. };
  10219. var supportsImageBitmapOptionsPromise;
  10220. Resource.supportsImageBitmapOptions = function() {
  10221. if (defined_default(supportsImageBitmapOptionsPromise)) {
  10222. return supportsImageBitmapOptionsPromise;
  10223. }
  10224. if (typeof createImageBitmap !== "function") {
  10225. supportsImageBitmapOptionsPromise = Promise.resolve(false);
  10226. return supportsImageBitmapOptionsPromise;
  10227. }
  10228. const imageDataUri = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAABGdBTUEAAE4g3rEiDgAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADElEQVQI12Ng6GAAAAEUAIngE3ZiAAAAAElFTkSuQmCC";
  10229. supportsImageBitmapOptionsPromise = Resource.fetchBlob({
  10230. url: imageDataUri
  10231. }).then(function(blob) {
  10232. const imageBitmapOptions = {
  10233. imageOrientation: "flipY",
  10234. premultiplyAlpha: "none",
  10235. colorSpaceConversion: "none"
  10236. };
  10237. return Promise.all([
  10238. createImageBitmap(blob, imageBitmapOptions),
  10239. createImageBitmap(blob)
  10240. ]);
  10241. }).then(function(imageBitmaps) {
  10242. const colorWithOptions = getImagePixels_default(imageBitmaps[0]);
  10243. const colorWithDefaults = getImagePixels_default(imageBitmaps[1]);
  10244. return colorWithOptions[1] !== colorWithDefaults[1];
  10245. }).catch(function() {
  10246. return false;
  10247. });
  10248. return supportsImageBitmapOptionsPromise;
  10249. };
  10250. Object.defineProperties(Resource, {
  10251. isBlobSupported: {
  10252. get: function() {
  10253. return xhrBlobSupported;
  10254. }
  10255. }
  10256. });
  10257. Object.defineProperties(Resource.prototype, {
  10258. queryParameters: {
  10259. get: function() {
  10260. return this._queryParameters;
  10261. }
  10262. },
  10263. templateValues: {
  10264. get: function() {
  10265. return this._templateValues;
  10266. }
  10267. },
  10268. url: {
  10269. get: function() {
  10270. return this.getUrlComponent(true, true);
  10271. },
  10272. set: function(value) {
  10273. const uri = new URI(value);
  10274. parseQuery(uri, this, false);
  10275. uri.fragment("");
  10276. this._url = uri.toString();
  10277. }
  10278. },
  10279. extension: {
  10280. get: function() {
  10281. return getExtensionFromUri_default(this._url);
  10282. }
  10283. },
  10284. isDataUri: {
  10285. get: function() {
  10286. return isDataUri_default(this._url);
  10287. }
  10288. },
  10289. isBlobUri: {
  10290. get: function() {
  10291. return isBlobUri_default(this._url);
  10292. }
  10293. },
  10294. isCrossOriginUrl: {
  10295. get: function() {
  10296. return isCrossOriginUrl_default(this._url);
  10297. }
  10298. },
  10299. hasHeaders: {
  10300. get: function() {
  10301. return Object.keys(this.headers).length > 0;
  10302. }
  10303. }
  10304. });
  10305. Resource.prototype.toString = function() {
  10306. return this.getUrlComponent(true, true);
  10307. };
  10308. Resource.prototype.getUrlComponent = function(query, proxy) {
  10309. if (this.isDataUri) {
  10310. return this._url;
  10311. }
  10312. const uri = new URI(this._url);
  10313. if (query) {
  10314. stringifyQuery(uri, this);
  10315. }
  10316. let url2 = uri.toString().replace(/%7B/g, "{").replace(/%7D/g, "}");
  10317. const templateValues = this._templateValues;
  10318. url2 = url2.replace(/{(.*?)}/g, function(match, key) {
  10319. const replacement = templateValues[key];
  10320. if (defined_default(replacement)) {
  10321. return encodeURIComponent(replacement);
  10322. }
  10323. return match;
  10324. });
  10325. if (proxy && defined_default(this.proxy)) {
  10326. url2 = this.proxy.getURL(url2);
  10327. }
  10328. return url2;
  10329. };
  10330. Resource.prototype.setQueryParameters = function(params, useAsDefault) {
  10331. if (useAsDefault) {
  10332. this._queryParameters = combineQueryParameters(
  10333. this._queryParameters,
  10334. params,
  10335. false
  10336. );
  10337. } else {
  10338. this._queryParameters = combineQueryParameters(
  10339. params,
  10340. this._queryParameters,
  10341. false
  10342. );
  10343. }
  10344. };
  10345. Resource.prototype.appendQueryParameters = function(params) {
  10346. this._queryParameters = combineQueryParameters(
  10347. params,
  10348. this._queryParameters,
  10349. true
  10350. );
  10351. };
  10352. Resource.prototype.setTemplateValues = function(template, useAsDefault) {
  10353. if (useAsDefault) {
  10354. this._templateValues = combine_default(this._templateValues, template);
  10355. } else {
  10356. this._templateValues = combine_default(template, this._templateValues);
  10357. }
  10358. };
  10359. Resource.prototype.getDerivedResource = function(options) {
  10360. const resource = this.clone();
  10361. resource._retryCount = 0;
  10362. if (defined_default(options.url)) {
  10363. const uri = new URI(options.url);
  10364. const preserveQueryParameters = defaultValue_default(
  10365. options.preserveQueryParameters,
  10366. false
  10367. );
  10368. parseQuery(uri, resource, true, preserveQueryParameters);
  10369. uri.fragment("");
  10370. if (uri.scheme() !== "") {
  10371. resource._url = uri.toString();
  10372. } else {
  10373. resource._url = uri.absoluteTo(new URI(getAbsoluteUri_default(this._url))).toString();
  10374. }
  10375. }
  10376. if (defined_default(options.queryParameters)) {
  10377. resource._queryParameters = combine_default(
  10378. options.queryParameters,
  10379. resource._queryParameters
  10380. );
  10381. }
  10382. if (defined_default(options.templateValues)) {
  10383. resource._templateValues = combine_default(
  10384. options.templateValues,
  10385. resource.templateValues
  10386. );
  10387. }
  10388. if (defined_default(options.headers)) {
  10389. resource.headers = combine_default(options.headers, resource.headers);
  10390. }
  10391. if (defined_default(options.proxy)) {
  10392. resource.proxy = options.proxy;
  10393. }
  10394. if (defined_default(options.request)) {
  10395. resource.request = options.request;
  10396. }
  10397. if (defined_default(options.retryCallback)) {
  10398. resource.retryCallback = options.retryCallback;
  10399. }
  10400. if (defined_default(options.retryAttempts)) {
  10401. resource.retryAttempts = options.retryAttempts;
  10402. }
  10403. return resource;
  10404. };
  10405. Resource.prototype.retryOnError = function(error) {
  10406. const retryCallback2 = this.retryCallback;
  10407. if (typeof retryCallback2 !== "function" || this._retryCount >= this.retryAttempts) {
  10408. return Promise.resolve(false);
  10409. }
  10410. const that = this;
  10411. return Promise.resolve(retryCallback2(this, error)).then(function(result) {
  10412. ++that._retryCount;
  10413. return result;
  10414. });
  10415. };
  10416. Resource.prototype.clone = function(result) {
  10417. if (!defined_default(result)) {
  10418. result = new Resource({
  10419. url: this._url
  10420. });
  10421. }
  10422. result._url = this._url;
  10423. result._queryParameters = clone_default(this._queryParameters);
  10424. result._templateValues = clone_default(this._templateValues);
  10425. result.headers = clone_default(this.headers);
  10426. result.proxy = this.proxy;
  10427. result.retryCallback = this.retryCallback;
  10428. result.retryAttempts = this.retryAttempts;
  10429. result._retryCount = 0;
  10430. result.request = this.request.clone();
  10431. return result;
  10432. };
  10433. Resource.prototype.getBaseUri = function(includeQuery) {
  10434. return getBaseUri_default(this.getUrlComponent(includeQuery), includeQuery);
  10435. };
  10436. Resource.prototype.appendForwardSlash = function() {
  10437. this._url = appendForwardSlash_default(this._url);
  10438. };
  10439. Resource.prototype.fetchArrayBuffer = function() {
  10440. return this.fetch({
  10441. responseType: "arraybuffer"
  10442. });
  10443. };
  10444. Resource.fetchArrayBuffer = function(options) {
  10445. const resource = new Resource(options);
  10446. return resource.fetchArrayBuffer();
  10447. };
  10448. Resource.prototype.fetchBlob = function() {
  10449. return this.fetch({
  10450. responseType: "blob"
  10451. });
  10452. };
  10453. Resource.fetchBlob = function(options) {
  10454. const resource = new Resource(options);
  10455. return resource.fetchBlob();
  10456. };
  10457. Resource.prototype.fetchImage = function(options) {
  10458. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  10459. const preferImageBitmap = defaultValue_default(options.preferImageBitmap, false);
  10460. const preferBlob = defaultValue_default(options.preferBlob, false);
  10461. const flipY = defaultValue_default(options.flipY, false);
  10462. const skipColorSpaceConversion = defaultValue_default(
  10463. options.skipColorSpaceConversion,
  10464. false
  10465. );
  10466. checkAndResetRequest(this.request);
  10467. if (!xhrBlobSupported || this.isDataUri || this.isBlobUri || !this.hasHeaders && !preferBlob) {
  10468. return fetchImage({
  10469. resource: this,
  10470. flipY,
  10471. skipColorSpaceConversion,
  10472. preferImageBitmap
  10473. });
  10474. }
  10475. const blobPromise = this.fetchBlob();
  10476. if (!defined_default(blobPromise)) {
  10477. return;
  10478. }
  10479. let supportsImageBitmap;
  10480. let useImageBitmap;
  10481. let generatedBlobResource;
  10482. let generatedBlob;
  10483. return Resource.supportsImageBitmapOptions().then(function(result) {
  10484. supportsImageBitmap = result;
  10485. useImageBitmap = supportsImageBitmap && preferImageBitmap;
  10486. return blobPromise;
  10487. }).then(function(blob) {
  10488. if (!defined_default(blob)) {
  10489. return;
  10490. }
  10491. generatedBlob = blob;
  10492. if (useImageBitmap) {
  10493. return Resource.createImageBitmapFromBlob(blob, {
  10494. flipY,
  10495. premultiplyAlpha: false,
  10496. skipColorSpaceConversion
  10497. });
  10498. }
  10499. const blobUrl = window.URL.createObjectURL(blob);
  10500. generatedBlobResource = new Resource({
  10501. url: blobUrl
  10502. });
  10503. return fetchImage({
  10504. resource: generatedBlobResource,
  10505. flipY,
  10506. skipColorSpaceConversion,
  10507. preferImageBitmap: false
  10508. });
  10509. }).then(function(image) {
  10510. if (!defined_default(image)) {
  10511. return;
  10512. }
  10513. image.blob = generatedBlob;
  10514. if (useImageBitmap) {
  10515. return image;
  10516. }
  10517. window.URL.revokeObjectURL(generatedBlobResource.url);
  10518. return image;
  10519. }).catch(function(error) {
  10520. if (defined_default(generatedBlobResource)) {
  10521. window.URL.revokeObjectURL(generatedBlobResource.url);
  10522. }
  10523. error.blob = generatedBlob;
  10524. return Promise.reject(error);
  10525. });
  10526. };
  10527. function fetchImage(options) {
  10528. const resource = options.resource;
  10529. const flipY = options.flipY;
  10530. const skipColorSpaceConversion = options.skipColorSpaceConversion;
  10531. const preferImageBitmap = options.preferImageBitmap;
  10532. const request = resource.request;
  10533. request.url = resource.url;
  10534. request.requestFunction = function() {
  10535. let crossOrigin = false;
  10536. if (!resource.isDataUri && !resource.isBlobUri) {
  10537. crossOrigin = resource.isCrossOriginUrl;
  10538. }
  10539. const deferred = defer_default();
  10540. Resource._Implementations.createImage(
  10541. request,
  10542. crossOrigin,
  10543. deferred,
  10544. flipY,
  10545. skipColorSpaceConversion,
  10546. preferImageBitmap
  10547. );
  10548. return deferred.promise;
  10549. };
  10550. const promise = RequestScheduler_default.request(request);
  10551. if (!defined_default(promise)) {
  10552. return;
  10553. }
  10554. return promise.catch(function(e2) {
  10555. if (request.state !== RequestState_default.FAILED) {
  10556. return Promise.reject(e2);
  10557. }
  10558. return resource.retryOnError(e2).then(function(retry) {
  10559. if (retry) {
  10560. request.state = RequestState_default.UNISSUED;
  10561. request.deferred = void 0;
  10562. return fetchImage({
  10563. resource,
  10564. flipY,
  10565. skipColorSpaceConversion,
  10566. preferImageBitmap
  10567. });
  10568. }
  10569. return Promise.reject(e2);
  10570. });
  10571. });
  10572. }
  10573. Resource.fetchImage = function(options) {
  10574. const resource = new Resource(options);
  10575. return resource.fetchImage({
  10576. flipY: options.flipY,
  10577. skipColorSpaceConversion: options.skipColorSpaceConversion,
  10578. preferBlob: options.preferBlob,
  10579. preferImageBitmap: options.preferImageBitmap
  10580. });
  10581. };
  10582. Resource.prototype.fetchText = function() {
  10583. return this.fetch({
  10584. responseType: "text"
  10585. });
  10586. };
  10587. Resource.fetchText = function(options) {
  10588. const resource = new Resource(options);
  10589. return resource.fetchText();
  10590. };
  10591. Resource.prototype.fetchJson = function() {
  10592. const promise = this.fetch({
  10593. responseType: "text",
  10594. headers: {
  10595. Accept: "application/json,*/*;q=0.01"
  10596. }
  10597. });
  10598. if (!defined_default(promise)) {
  10599. return void 0;
  10600. }
  10601. return promise.then(function(value) {
  10602. if (!defined_default(value)) {
  10603. return;
  10604. }
  10605. return JSON.parse(value);
  10606. });
  10607. };
  10608. Resource.fetchJson = function(options) {
  10609. const resource = new Resource(options);
  10610. return resource.fetchJson();
  10611. };
  10612. Resource.prototype.fetchXML = function() {
  10613. return this.fetch({
  10614. responseType: "document",
  10615. overrideMimeType: "text/xml"
  10616. });
  10617. };
  10618. Resource.fetchXML = function(options) {
  10619. const resource = new Resource(options);
  10620. return resource.fetchXML();
  10621. };
  10622. Resource.prototype.fetchJsonp = function(callbackParameterName) {
  10623. callbackParameterName = defaultValue_default(callbackParameterName, "callback");
  10624. checkAndResetRequest(this.request);
  10625. let functionName;
  10626. do {
  10627. functionName = `loadJsonp${Math_default.nextRandomNumber().toString().substring(2, 8)}`;
  10628. } while (defined_default(window[functionName]));
  10629. return fetchJsonp(this, callbackParameterName, functionName);
  10630. };
  10631. function fetchJsonp(resource, callbackParameterName, functionName) {
  10632. const callbackQuery = {};
  10633. callbackQuery[callbackParameterName] = functionName;
  10634. resource.setQueryParameters(callbackQuery);
  10635. const request = resource.request;
  10636. request.url = resource.url;
  10637. request.requestFunction = function() {
  10638. const deferred = defer_default();
  10639. window[functionName] = function(data) {
  10640. deferred.resolve(data);
  10641. try {
  10642. delete window[functionName];
  10643. } catch (e2) {
  10644. window[functionName] = void 0;
  10645. }
  10646. };
  10647. Resource._Implementations.loadAndExecuteScript(
  10648. resource.url,
  10649. functionName,
  10650. deferred
  10651. );
  10652. return deferred.promise;
  10653. };
  10654. const promise = RequestScheduler_default.request(request);
  10655. if (!defined_default(promise)) {
  10656. return;
  10657. }
  10658. return promise.catch(function(e2) {
  10659. if (request.state !== RequestState_default.FAILED) {
  10660. return Promise.reject(e2);
  10661. }
  10662. return resource.retryOnError(e2).then(function(retry) {
  10663. if (retry) {
  10664. request.state = RequestState_default.UNISSUED;
  10665. request.deferred = void 0;
  10666. return fetchJsonp(resource, callbackParameterName, functionName);
  10667. }
  10668. return Promise.reject(e2);
  10669. });
  10670. });
  10671. }
  10672. Resource.fetchJsonp = function(options) {
  10673. const resource = new Resource(options);
  10674. return resource.fetchJsonp(options.callbackParameterName);
  10675. };
  10676. Resource.prototype._makeRequest = function(options) {
  10677. const resource = this;
  10678. checkAndResetRequest(resource.request);
  10679. const request = resource.request;
  10680. request.url = resource.url;
  10681. request.requestFunction = function() {
  10682. const responseType = options.responseType;
  10683. const headers = combine_default(options.headers, resource.headers);
  10684. const overrideMimeType = options.overrideMimeType;
  10685. const method = options.method;
  10686. const data = options.data;
  10687. const deferred = defer_default();
  10688. const xhr = Resource._Implementations.loadWithXhr(
  10689. resource.url,
  10690. responseType,
  10691. method,
  10692. data,
  10693. headers,
  10694. deferred,
  10695. overrideMimeType
  10696. );
  10697. if (defined_default(xhr) && defined_default(xhr.abort)) {
  10698. request.cancelFunction = function() {
  10699. xhr.abort();
  10700. };
  10701. }
  10702. return deferred.promise;
  10703. };
  10704. const promise = RequestScheduler_default.request(request);
  10705. if (!defined_default(promise)) {
  10706. return;
  10707. }
  10708. return promise.then(function(data) {
  10709. request.cancelFunction = void 0;
  10710. return data;
  10711. }).catch(function(e2) {
  10712. request.cancelFunction = void 0;
  10713. if (request.state !== RequestState_default.FAILED) {
  10714. return Promise.reject(e2);
  10715. }
  10716. return resource.retryOnError(e2).then(function(retry) {
  10717. if (retry) {
  10718. request.state = RequestState_default.UNISSUED;
  10719. request.deferred = void 0;
  10720. return resource.fetch(options);
  10721. }
  10722. return Promise.reject(e2);
  10723. });
  10724. });
  10725. };
  10726. var dataUriRegex2 = /^data:(.*?)(;base64)?,(.*)$/;
  10727. function decodeDataUriText(isBase64, data) {
  10728. const result = decodeURIComponent(data);
  10729. if (isBase64) {
  10730. return atob(result);
  10731. }
  10732. return result;
  10733. }
  10734. function decodeDataUriArrayBuffer(isBase64, data) {
  10735. const byteString = decodeDataUriText(isBase64, data);
  10736. const buffer = new ArrayBuffer(byteString.length);
  10737. const view = new Uint8Array(buffer);
  10738. for (let i2 = 0; i2 < byteString.length; i2++) {
  10739. view[i2] = byteString.charCodeAt(i2);
  10740. }
  10741. return buffer;
  10742. }
  10743. function decodeDataUri(dataUriRegexResult, responseType) {
  10744. responseType = defaultValue_default(responseType, "");
  10745. const mimeType = dataUriRegexResult[1];
  10746. const isBase64 = !!dataUriRegexResult[2];
  10747. const data = dataUriRegexResult[3];
  10748. let buffer;
  10749. let parser3;
  10750. switch (responseType) {
  10751. case "":
  10752. case "text":
  10753. return decodeDataUriText(isBase64, data);
  10754. case "arraybuffer":
  10755. return decodeDataUriArrayBuffer(isBase64, data);
  10756. case "blob":
  10757. buffer = decodeDataUriArrayBuffer(isBase64, data);
  10758. return new Blob([buffer], {
  10759. type: mimeType
  10760. });
  10761. case "document":
  10762. parser3 = new DOMParser();
  10763. return parser3.parseFromString(
  10764. decodeDataUriText(isBase64, data),
  10765. mimeType
  10766. );
  10767. case "json":
  10768. return JSON.parse(decodeDataUriText(isBase64, data));
  10769. default:
  10770. throw new DeveloperError_default(`Unhandled responseType: ${responseType}`);
  10771. }
  10772. }
  10773. Resource.prototype.fetch = function(options) {
  10774. options = defaultClone(options, {});
  10775. options.method = "GET";
  10776. return this._makeRequest(options);
  10777. };
  10778. Resource.fetch = function(options) {
  10779. const resource = new Resource(options);
  10780. return resource.fetch({
  10781. responseType: options.responseType,
  10782. overrideMimeType: options.overrideMimeType
  10783. });
  10784. };
  10785. Resource.prototype.delete = function(options) {
  10786. options = defaultClone(options, {});
  10787. options.method = "DELETE";
  10788. return this._makeRequest(options);
  10789. };
  10790. Resource.delete = function(options) {
  10791. const resource = new Resource(options);
  10792. return resource.delete({
  10793. responseType: options.responseType,
  10794. overrideMimeType: options.overrideMimeType,
  10795. data: options.data
  10796. });
  10797. };
  10798. Resource.prototype.head = function(options) {
  10799. options = defaultClone(options, {});
  10800. options.method = "HEAD";
  10801. return this._makeRequest(options);
  10802. };
  10803. Resource.head = function(options) {
  10804. const resource = new Resource(options);
  10805. return resource.head({
  10806. responseType: options.responseType,
  10807. overrideMimeType: options.overrideMimeType
  10808. });
  10809. };
  10810. Resource.prototype.options = function(options) {
  10811. options = defaultClone(options, {});
  10812. options.method = "OPTIONS";
  10813. return this._makeRequest(options);
  10814. };
  10815. Resource.options = function(options) {
  10816. const resource = new Resource(options);
  10817. return resource.options({
  10818. responseType: options.responseType,
  10819. overrideMimeType: options.overrideMimeType
  10820. });
  10821. };
  10822. Resource.prototype.post = function(data, options) {
  10823. Check_default.defined("data", data);
  10824. options = defaultClone(options, {});
  10825. options.method = "POST";
  10826. options.data = data;
  10827. return this._makeRequest(options);
  10828. };
  10829. Resource.post = function(options) {
  10830. const resource = new Resource(options);
  10831. return resource.post(options.data, {
  10832. responseType: options.responseType,
  10833. overrideMimeType: options.overrideMimeType
  10834. });
  10835. };
  10836. Resource.prototype.put = function(data, options) {
  10837. Check_default.defined("data", data);
  10838. options = defaultClone(options, {});
  10839. options.method = "PUT";
  10840. options.data = data;
  10841. return this._makeRequest(options);
  10842. };
  10843. Resource.put = function(options) {
  10844. const resource = new Resource(options);
  10845. return resource.put(options.data, {
  10846. responseType: options.responseType,
  10847. overrideMimeType: options.overrideMimeType
  10848. });
  10849. };
  10850. Resource.prototype.patch = function(data, options) {
  10851. Check_default.defined("data", data);
  10852. options = defaultClone(options, {});
  10853. options.method = "PATCH";
  10854. options.data = data;
  10855. return this._makeRequest(options);
  10856. };
  10857. Resource.patch = function(options) {
  10858. const resource = new Resource(options);
  10859. return resource.patch(options.data, {
  10860. responseType: options.responseType,
  10861. overrideMimeType: options.overrideMimeType
  10862. });
  10863. };
  10864. Resource._Implementations = {};
  10865. Resource._Implementations.loadImageElement = function(url2, crossOrigin, deferred) {
  10866. const image = new Image();
  10867. image.onload = function() {
  10868. if (image.naturalWidth === 0 && image.naturalHeight === 0 && image.width === 0 && image.height === 0) {
  10869. image.width = 300;
  10870. image.height = 150;
  10871. }
  10872. deferred.resolve(image);
  10873. };
  10874. image.onerror = function(e2) {
  10875. deferred.reject(e2);
  10876. };
  10877. if (crossOrigin) {
  10878. if (TrustedServers_default.contains(url2)) {
  10879. image.crossOrigin = "use-credentials";
  10880. } else {
  10881. image.crossOrigin = "";
  10882. }
  10883. }
  10884. image.src = url2;
  10885. };
  10886. Resource._Implementations.createImage = function(request, crossOrigin, deferred, flipY, skipColorSpaceConversion, preferImageBitmap) {
  10887. const url2 = request.url;
  10888. Resource.supportsImageBitmapOptions().then(function(supportsImageBitmap) {
  10889. if (!(supportsImageBitmap && preferImageBitmap)) {
  10890. Resource._Implementations.loadImageElement(url2, crossOrigin, deferred);
  10891. return;
  10892. }
  10893. const responseType = "blob";
  10894. const method = "GET";
  10895. const xhrDeferred = defer_default();
  10896. const xhr = Resource._Implementations.loadWithXhr(
  10897. url2,
  10898. responseType,
  10899. method,
  10900. void 0,
  10901. void 0,
  10902. xhrDeferred,
  10903. void 0,
  10904. void 0,
  10905. void 0
  10906. );
  10907. if (defined_default(xhr) && defined_default(xhr.abort)) {
  10908. request.cancelFunction = function() {
  10909. xhr.abort();
  10910. };
  10911. }
  10912. return xhrDeferred.promise.then(function(blob) {
  10913. if (!defined_default(blob)) {
  10914. deferred.reject(
  10915. new RuntimeError_default(
  10916. `Successfully retrieved ${url2} but it contained no content.`
  10917. )
  10918. );
  10919. return;
  10920. }
  10921. return Resource.createImageBitmapFromBlob(blob, {
  10922. flipY,
  10923. premultiplyAlpha: false,
  10924. skipColorSpaceConversion
  10925. });
  10926. }).then(function(image) {
  10927. deferred.resolve(image);
  10928. });
  10929. }).catch(function(e2) {
  10930. deferred.reject(e2);
  10931. });
  10932. };
  10933. Resource.createImageBitmapFromBlob = function(blob, options) {
  10934. Check_default.defined("options", options);
  10935. Check_default.typeOf.bool("options.flipY", options.flipY);
  10936. Check_default.typeOf.bool("options.premultiplyAlpha", options.premultiplyAlpha);
  10937. Check_default.typeOf.bool(
  10938. "options.skipColorSpaceConversion",
  10939. options.skipColorSpaceConversion
  10940. );
  10941. return createImageBitmap(blob, {
  10942. imageOrientation: options.flipY ? "flipY" : "none",
  10943. premultiplyAlpha: options.premultiplyAlpha ? "premultiply" : "none",
  10944. colorSpaceConversion: options.skipColorSpaceConversion ? "none" : "default"
  10945. });
  10946. };
  10947. function decodeResponse(loadWithHttpResponse, responseType) {
  10948. switch (responseType) {
  10949. case "text":
  10950. return loadWithHttpResponse.toString("utf8");
  10951. case "json":
  10952. return JSON.parse(loadWithHttpResponse.toString("utf8"));
  10953. default:
  10954. return new Uint8Array(loadWithHttpResponse).buffer;
  10955. }
  10956. }
  10957. function loadWithHttpRequest(url2, responseType, method, data, headers, deferred, overrideMimeType) {
  10958. const URL2 = require_url().parse(url2);
  10959. const http = URL2.protocol === "https:" ? (init_https(), __toCommonJS(https_exports)) : (init_http(), __toCommonJS(http_exports));
  10960. const zlib = (init_zlib(), __toCommonJS(zlib_exports));
  10961. const options = {
  10962. protocol: URL2.protocol,
  10963. hostname: URL2.hostname,
  10964. port: URL2.port,
  10965. path: URL2.path,
  10966. query: URL2.query,
  10967. method,
  10968. headers
  10969. };
  10970. http.request(options).on("response", function(res) {
  10971. if (res.statusCode < 200 || res.statusCode >= 300) {
  10972. deferred.reject(
  10973. new RequestErrorEvent_default(res.statusCode, res, res.headers)
  10974. );
  10975. return;
  10976. }
  10977. const chunkArray = [];
  10978. res.on("data", function(chunk) {
  10979. chunkArray.push(chunk);
  10980. });
  10981. res.on("end", function() {
  10982. const result = Buffer.concat(chunkArray);
  10983. if (res.headers["content-encoding"] === "gzip") {
  10984. zlib.gunzip(result, function(error, resultUnzipped) {
  10985. if (error) {
  10986. deferred.reject(
  10987. new RuntimeError_default("Error decompressing response.")
  10988. );
  10989. } else {
  10990. deferred.resolve(decodeResponse(resultUnzipped, responseType));
  10991. }
  10992. });
  10993. } else {
  10994. deferred.resolve(decodeResponse(result, responseType));
  10995. }
  10996. });
  10997. }).on("error", function(e2) {
  10998. deferred.reject(new RequestErrorEvent_default());
  10999. }).end();
  11000. }
  11001. var noXMLHttpRequest = typeof XMLHttpRequest === "undefined";
  11002. Resource._Implementations.loadWithXhr = function(url2, responseType, method, data, headers, deferred, overrideMimeType) {
  11003. const dataUriRegexResult = dataUriRegex2.exec(url2);
  11004. if (dataUriRegexResult !== null) {
  11005. deferred.resolve(decodeDataUri(dataUriRegexResult, responseType));
  11006. return;
  11007. }
  11008. if (noXMLHttpRequest) {
  11009. loadWithHttpRequest(
  11010. url2,
  11011. responseType,
  11012. method,
  11013. data,
  11014. headers,
  11015. deferred,
  11016. overrideMimeType
  11017. );
  11018. return;
  11019. }
  11020. const xhr = new XMLHttpRequest();
  11021. if (TrustedServers_default.contains(url2)) {
  11022. xhr.withCredentials = true;
  11023. }
  11024. xhr.open(method, url2, true);
  11025. if (defined_default(overrideMimeType) && defined_default(xhr.overrideMimeType)) {
  11026. xhr.overrideMimeType(overrideMimeType);
  11027. }
  11028. if (defined_default(headers)) {
  11029. for (const key in headers) {
  11030. if (headers.hasOwnProperty(key)) {
  11031. xhr.setRequestHeader(key, headers[key]);
  11032. }
  11033. }
  11034. }
  11035. if (defined_default(responseType)) {
  11036. xhr.responseType = responseType;
  11037. }
  11038. let localFile = false;
  11039. if (typeof url2 === "string") {
  11040. localFile = url2.indexOf("file://") === 0 || typeof window !== "undefined" && window.location.origin === "file://";
  11041. }
  11042. xhr.onload = function() {
  11043. if ((xhr.status < 200 || xhr.status >= 300) && !(localFile && xhr.status === 0)) {
  11044. deferred.reject(
  11045. new RequestErrorEvent_default(
  11046. xhr.status,
  11047. xhr.response,
  11048. xhr.getAllResponseHeaders()
  11049. )
  11050. );
  11051. return;
  11052. }
  11053. const response = xhr.response;
  11054. const browserResponseType = xhr.responseType;
  11055. if (method === "HEAD" || method === "OPTIONS") {
  11056. const responseHeaderString = xhr.getAllResponseHeaders();
  11057. const splitHeaders = responseHeaderString.trim().split(/[\r\n]+/);
  11058. const responseHeaders = {};
  11059. splitHeaders.forEach(function(line) {
  11060. const parts = line.split(": ");
  11061. const header = parts.shift();
  11062. responseHeaders[header] = parts.join(": ");
  11063. });
  11064. deferred.resolve(responseHeaders);
  11065. return;
  11066. }
  11067. if (xhr.status === 204) {
  11068. deferred.resolve();
  11069. } else if (defined_default(response) && (!defined_default(responseType) || browserResponseType === responseType)) {
  11070. deferred.resolve(response);
  11071. } else if (responseType === "json" && typeof response === "string") {
  11072. try {
  11073. deferred.resolve(JSON.parse(response));
  11074. } catch (e2) {
  11075. deferred.reject(e2);
  11076. }
  11077. } else if ((browserResponseType === "" || browserResponseType === "document") && defined_default(xhr.responseXML) && xhr.responseXML.hasChildNodes()) {
  11078. deferred.resolve(xhr.responseXML);
  11079. } else if ((browserResponseType === "" || browserResponseType === "text") && defined_default(xhr.responseText)) {
  11080. deferred.resolve(xhr.responseText);
  11081. } else {
  11082. deferred.reject(
  11083. new RuntimeError_default("Invalid XMLHttpRequest response type.")
  11084. );
  11085. }
  11086. };
  11087. xhr.onerror = function(e2) {
  11088. deferred.reject(new RequestErrorEvent_default());
  11089. };
  11090. xhr.send(data);
  11091. return xhr;
  11092. };
  11093. Resource._Implementations.loadAndExecuteScript = function(url2, functionName, deferred) {
  11094. return loadAndExecuteScript_default(url2, functionName).catch(function(e2) {
  11095. deferred.reject(e2);
  11096. });
  11097. };
  11098. Resource._DefaultImplementations = {};
  11099. Resource._DefaultImplementations.createImage = Resource._Implementations.createImage;
  11100. Resource._DefaultImplementations.loadWithXhr = Resource._Implementations.loadWithXhr;
  11101. Resource._DefaultImplementations.loadAndExecuteScript = Resource._Implementations.loadAndExecuteScript;
  11102. Resource.DEFAULT = Object.freeze(
  11103. new Resource({
  11104. url: typeof document === "undefined" ? "" : document.location.href.split("?")[0]
  11105. })
  11106. );
  11107. var Resource_default = Resource;
  11108. // node_modules/cesium/Source/Core/buildModuleUrl.js
  11109. var cesiumScriptRegex = /((?:.*\/)|^)Cesium\.js(?:\?|\#|$)/;
  11110. var a2;
  11111. function tryMakeAbsolute(url2) {
  11112. if (typeof document === "undefined") {
  11113. return url2;
  11114. }
  11115. if (!defined_default(a2)) {
  11116. a2 = document.createElement("a");
  11117. }
  11118. a2.href = url2;
  11119. a2.href = a2.href;
  11120. return a2.href;
  11121. }
  11122. var baseResource;
  11123. function getCesiumBaseUrl() {
  11124. if (defined_default(baseResource)) {
  11125. return baseResource;
  11126. }
  11127. let baseUrlString;
  11128. if (true) {
  11129. baseUrlString = "cesium/";
  11130. } else if (typeof define === "object" && defined_default(define.amd) && !define.amd.toUrlUndefined && defined_default(__require.toUrl)) {
  11131. baseUrlString = getAbsoluteUri_default(
  11132. "..",
  11133. buildModuleUrl("Core/buildModuleUrl.js")
  11134. );
  11135. } else {
  11136. baseUrlString = getBaseUrlFromCesiumScript();
  11137. }
  11138. if (!defined_default(baseUrlString)) {
  11139. throw new DeveloperError_default(
  11140. "Unable to determine Cesium base URL automatically, try defining a global variable called CESIUM_BASE_URL."
  11141. );
  11142. }
  11143. baseResource = new Resource_default({
  11144. url: tryMakeAbsolute(baseUrlString)
  11145. });
  11146. baseResource.appendForwardSlash();
  11147. return baseResource;
  11148. }
  11149. function buildModuleUrlFromRequireToUrl(moduleID) {
  11150. return tryMakeAbsolute(__require.toUrl(`../${moduleID}`));
  11151. }
  11152. function buildModuleUrlFromBaseUrl(moduleID) {
  11153. const resource = getCesiumBaseUrl().getDerivedResource({
  11154. url: moduleID
  11155. });
  11156. return resource.url;
  11157. }
  11158. var implementation;
  11159. function buildModuleUrl(relativeUrl) {
  11160. if (!defined_default(implementation)) {
  11161. if (typeof define === "object" && defined_default(define.amd) && !define.amd.toUrlUndefined && defined_default(__require.toUrl)) {
  11162. implementation = buildModuleUrlFromRequireToUrl;
  11163. } else {
  11164. implementation = buildModuleUrlFromBaseUrl;
  11165. }
  11166. }
  11167. const url2 = implementation(relativeUrl);
  11168. return url2;
  11169. }
  11170. buildModuleUrl._cesiumScriptRegex = cesiumScriptRegex;
  11171. buildModuleUrl._buildModuleUrlFromBaseUrl = buildModuleUrlFromBaseUrl;
  11172. buildModuleUrl._clearBaseResource = function() {
  11173. baseResource = void 0;
  11174. };
  11175. buildModuleUrl.setBaseUrl = function(value) {
  11176. baseResource = Resource_default.DEFAULT.getDerivedResource({
  11177. url: value
  11178. });
  11179. };
  11180. buildModuleUrl.getCesiumBaseUrl = getCesiumBaseUrl;
  11181. var buildModuleUrl_default = buildModuleUrl;
  11182. // node_modules/cesium/Source/Core/Cartesian2.js
  11183. function Cartesian2(x, y) {
  11184. this.x = defaultValue_default(x, 0);
  11185. this.y = defaultValue_default(y, 0);
  11186. }
  11187. Cartesian2.fromElements = function(x, y, result) {
  11188. if (!defined_default(result)) {
  11189. return new Cartesian2(x, y);
  11190. }
  11191. result.x = x;
  11192. result.y = y;
  11193. return result;
  11194. };
  11195. Cartesian2.clone = function(cartesian11, result) {
  11196. if (!defined_default(cartesian11)) {
  11197. return void 0;
  11198. }
  11199. if (!defined_default(result)) {
  11200. return new Cartesian2(cartesian11.x, cartesian11.y);
  11201. }
  11202. result.x = cartesian11.x;
  11203. result.y = cartesian11.y;
  11204. return result;
  11205. };
  11206. Cartesian2.fromCartesian3 = Cartesian2.clone;
  11207. Cartesian2.fromCartesian4 = Cartesian2.clone;
  11208. Cartesian2.packedLength = 2;
  11209. Cartesian2.pack = function(value, array, startingIndex) {
  11210. Check_default.typeOf.object("value", value);
  11211. Check_default.defined("array", array);
  11212. startingIndex = defaultValue_default(startingIndex, 0);
  11213. array[startingIndex++] = value.x;
  11214. array[startingIndex] = value.y;
  11215. return array;
  11216. };
  11217. Cartesian2.unpack = function(array, startingIndex, result) {
  11218. Check_default.defined("array", array);
  11219. startingIndex = defaultValue_default(startingIndex, 0);
  11220. if (!defined_default(result)) {
  11221. result = new Cartesian2();
  11222. }
  11223. result.x = array[startingIndex++];
  11224. result.y = array[startingIndex];
  11225. return result;
  11226. };
  11227. Cartesian2.packArray = function(array, result) {
  11228. Check_default.defined("array", array);
  11229. const length3 = array.length;
  11230. const resultLength = length3 * 2;
  11231. if (!defined_default(result)) {
  11232. result = new Array(resultLength);
  11233. } else if (!Array.isArray(result) && result.length !== resultLength) {
  11234. throw new DeveloperError_default(
  11235. "If result is a typed array, it must have exactly array.length * 2 elements"
  11236. );
  11237. } else if (result.length !== resultLength) {
  11238. result.length = resultLength;
  11239. }
  11240. for (let i2 = 0; i2 < length3; ++i2) {
  11241. Cartesian2.pack(array[i2], result, i2 * 2);
  11242. }
  11243. return result;
  11244. };
  11245. Cartesian2.unpackArray = function(array, result) {
  11246. Check_default.defined("array", array);
  11247. Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 2);
  11248. if (array.length % 2 !== 0) {
  11249. throw new DeveloperError_default("array length must be a multiple of 2.");
  11250. }
  11251. const length3 = array.length;
  11252. if (!defined_default(result)) {
  11253. result = new Array(length3 / 2);
  11254. } else {
  11255. result.length = length3 / 2;
  11256. }
  11257. for (let i2 = 0; i2 < length3; i2 += 2) {
  11258. const index2 = i2 / 2;
  11259. result[index2] = Cartesian2.unpack(array, i2, result[index2]);
  11260. }
  11261. return result;
  11262. };
  11263. Cartesian2.fromArray = Cartesian2.unpack;
  11264. Cartesian2.maximumComponent = function(cartesian11) {
  11265. Check_default.typeOf.object("cartesian", cartesian11);
  11266. return Math.max(cartesian11.x, cartesian11.y);
  11267. };
  11268. Cartesian2.minimumComponent = function(cartesian11) {
  11269. Check_default.typeOf.object("cartesian", cartesian11);
  11270. return Math.min(cartesian11.x, cartesian11.y);
  11271. };
  11272. Cartesian2.minimumByComponent = function(first, second, result) {
  11273. Check_default.typeOf.object("first", first);
  11274. Check_default.typeOf.object("second", second);
  11275. Check_default.typeOf.object("result", result);
  11276. result.x = Math.min(first.x, second.x);
  11277. result.y = Math.min(first.y, second.y);
  11278. return result;
  11279. };
  11280. Cartesian2.maximumByComponent = function(first, second, result) {
  11281. Check_default.typeOf.object("first", first);
  11282. Check_default.typeOf.object("second", second);
  11283. Check_default.typeOf.object("result", result);
  11284. result.x = Math.max(first.x, second.x);
  11285. result.y = Math.max(first.y, second.y);
  11286. return result;
  11287. };
  11288. Cartesian2.clamp = function(value, min3, max3, result) {
  11289. Check_default.typeOf.object("value", value);
  11290. Check_default.typeOf.object("min", min3);
  11291. Check_default.typeOf.object("max", max3);
  11292. Check_default.typeOf.object("result", result);
  11293. const x = Math_default.clamp(value.x, min3.x, max3.x);
  11294. const y = Math_default.clamp(value.y, min3.y, max3.y);
  11295. result.x = x;
  11296. result.y = y;
  11297. return result;
  11298. };
  11299. Cartesian2.magnitudeSquared = function(cartesian11) {
  11300. Check_default.typeOf.object("cartesian", cartesian11);
  11301. return cartesian11.x * cartesian11.x + cartesian11.y * cartesian11.y;
  11302. };
  11303. Cartesian2.magnitude = function(cartesian11) {
  11304. return Math.sqrt(Cartesian2.magnitudeSquared(cartesian11));
  11305. };
  11306. var distanceScratch3 = new Cartesian2();
  11307. Cartesian2.distance = function(left, right) {
  11308. Check_default.typeOf.object("left", left);
  11309. Check_default.typeOf.object("right", right);
  11310. Cartesian2.subtract(left, right, distanceScratch3);
  11311. return Cartesian2.magnitude(distanceScratch3);
  11312. };
  11313. Cartesian2.distanceSquared = function(left, right) {
  11314. Check_default.typeOf.object("left", left);
  11315. Check_default.typeOf.object("right", right);
  11316. Cartesian2.subtract(left, right, distanceScratch3);
  11317. return Cartesian2.magnitudeSquared(distanceScratch3);
  11318. };
  11319. Cartesian2.normalize = function(cartesian11, result) {
  11320. Check_default.typeOf.object("cartesian", cartesian11);
  11321. Check_default.typeOf.object("result", result);
  11322. const magnitude = Cartesian2.magnitude(cartesian11);
  11323. result.x = cartesian11.x / magnitude;
  11324. result.y = cartesian11.y / magnitude;
  11325. if (isNaN(result.x) || isNaN(result.y)) {
  11326. throw new DeveloperError_default("normalized result is not a number");
  11327. }
  11328. return result;
  11329. };
  11330. Cartesian2.dot = function(left, right) {
  11331. Check_default.typeOf.object("left", left);
  11332. Check_default.typeOf.object("right", right);
  11333. return left.x * right.x + left.y * right.y;
  11334. };
  11335. Cartesian2.cross = function(left, right) {
  11336. Check_default.typeOf.object("left", left);
  11337. Check_default.typeOf.object("right", right);
  11338. return left.x * right.y - left.y * right.x;
  11339. };
  11340. Cartesian2.multiplyComponents = function(left, right, result) {
  11341. Check_default.typeOf.object("left", left);
  11342. Check_default.typeOf.object("right", right);
  11343. Check_default.typeOf.object("result", result);
  11344. result.x = left.x * right.x;
  11345. result.y = left.y * right.y;
  11346. return result;
  11347. };
  11348. Cartesian2.divideComponents = function(left, right, result) {
  11349. Check_default.typeOf.object("left", left);
  11350. Check_default.typeOf.object("right", right);
  11351. Check_default.typeOf.object("result", result);
  11352. result.x = left.x / right.x;
  11353. result.y = left.y / right.y;
  11354. return result;
  11355. };
  11356. Cartesian2.add = function(left, right, result) {
  11357. Check_default.typeOf.object("left", left);
  11358. Check_default.typeOf.object("right", right);
  11359. Check_default.typeOf.object("result", result);
  11360. result.x = left.x + right.x;
  11361. result.y = left.y + right.y;
  11362. return result;
  11363. };
  11364. Cartesian2.subtract = function(left, right, result) {
  11365. Check_default.typeOf.object("left", left);
  11366. Check_default.typeOf.object("right", right);
  11367. Check_default.typeOf.object("result", result);
  11368. result.x = left.x - right.x;
  11369. result.y = left.y - right.y;
  11370. return result;
  11371. };
  11372. Cartesian2.multiplyByScalar = function(cartesian11, scalar, result) {
  11373. Check_default.typeOf.object("cartesian", cartesian11);
  11374. Check_default.typeOf.number("scalar", scalar);
  11375. Check_default.typeOf.object("result", result);
  11376. result.x = cartesian11.x * scalar;
  11377. result.y = cartesian11.y * scalar;
  11378. return result;
  11379. };
  11380. Cartesian2.divideByScalar = function(cartesian11, scalar, result) {
  11381. Check_default.typeOf.object("cartesian", cartesian11);
  11382. Check_default.typeOf.number("scalar", scalar);
  11383. Check_default.typeOf.object("result", result);
  11384. result.x = cartesian11.x / scalar;
  11385. result.y = cartesian11.y / scalar;
  11386. return result;
  11387. };
  11388. Cartesian2.negate = function(cartesian11, result) {
  11389. Check_default.typeOf.object("cartesian", cartesian11);
  11390. Check_default.typeOf.object("result", result);
  11391. result.x = -cartesian11.x;
  11392. result.y = -cartesian11.y;
  11393. return result;
  11394. };
  11395. Cartesian2.abs = function(cartesian11, result) {
  11396. Check_default.typeOf.object("cartesian", cartesian11);
  11397. Check_default.typeOf.object("result", result);
  11398. result.x = Math.abs(cartesian11.x);
  11399. result.y = Math.abs(cartesian11.y);
  11400. return result;
  11401. };
  11402. var lerpScratch3 = new Cartesian2();
  11403. Cartesian2.lerp = function(start, end, t, result) {
  11404. Check_default.typeOf.object("start", start);
  11405. Check_default.typeOf.object("end", end);
  11406. Check_default.typeOf.number("t", t);
  11407. Check_default.typeOf.object("result", result);
  11408. Cartesian2.multiplyByScalar(end, t, lerpScratch3);
  11409. result = Cartesian2.multiplyByScalar(start, 1 - t, result);
  11410. return Cartesian2.add(lerpScratch3, result, result);
  11411. };
  11412. var angleBetweenScratch3 = new Cartesian2();
  11413. var angleBetweenScratch22 = new Cartesian2();
  11414. Cartesian2.angleBetween = function(left, right) {
  11415. Check_default.typeOf.object("left", left);
  11416. Check_default.typeOf.object("right", right);
  11417. Cartesian2.normalize(left, angleBetweenScratch3);
  11418. Cartesian2.normalize(right, angleBetweenScratch22);
  11419. return Math_default.acosClamped(
  11420. Cartesian2.dot(angleBetweenScratch3, angleBetweenScratch22)
  11421. );
  11422. };
  11423. var mostOrthogonalAxisScratch3 = new Cartesian2();
  11424. Cartesian2.mostOrthogonalAxis = function(cartesian11, result) {
  11425. Check_default.typeOf.object("cartesian", cartesian11);
  11426. Check_default.typeOf.object("result", result);
  11427. const f2 = Cartesian2.normalize(cartesian11, mostOrthogonalAxisScratch3);
  11428. Cartesian2.abs(f2, f2);
  11429. if (f2.x <= f2.y) {
  11430. result = Cartesian2.clone(Cartesian2.UNIT_X, result);
  11431. } else {
  11432. result = Cartesian2.clone(Cartesian2.UNIT_Y, result);
  11433. }
  11434. return result;
  11435. };
  11436. Cartesian2.equals = function(left, right) {
  11437. return left === right || defined_default(left) && defined_default(right) && left.x === right.x && left.y === right.y;
  11438. };
  11439. Cartesian2.equalsArray = function(cartesian11, array, offset2) {
  11440. return cartesian11.x === array[offset2] && cartesian11.y === array[offset2 + 1];
  11441. };
  11442. Cartesian2.equalsEpsilon = function(left, right, relativeEpsilon, absoluteEpsilon) {
  11443. return left === right || defined_default(left) && defined_default(right) && Math_default.equalsEpsilon(
  11444. left.x,
  11445. right.x,
  11446. relativeEpsilon,
  11447. absoluteEpsilon
  11448. ) && Math_default.equalsEpsilon(
  11449. left.y,
  11450. right.y,
  11451. relativeEpsilon,
  11452. absoluteEpsilon
  11453. );
  11454. };
  11455. Cartesian2.ZERO = Object.freeze(new Cartesian2(0, 0));
  11456. Cartesian2.ONE = Object.freeze(new Cartesian2(1, 1));
  11457. Cartesian2.UNIT_X = Object.freeze(new Cartesian2(1, 0));
  11458. Cartesian2.UNIT_Y = Object.freeze(new Cartesian2(0, 1));
  11459. Cartesian2.prototype.clone = function(result) {
  11460. return Cartesian2.clone(this, result);
  11461. };
  11462. Cartesian2.prototype.equals = function(right) {
  11463. return Cartesian2.equals(this, right);
  11464. };
  11465. Cartesian2.prototype.equalsEpsilon = function(right, relativeEpsilon, absoluteEpsilon) {
  11466. return Cartesian2.equalsEpsilon(
  11467. this,
  11468. right,
  11469. relativeEpsilon,
  11470. absoluteEpsilon
  11471. );
  11472. };
  11473. Cartesian2.prototype.toString = function() {
  11474. return `(${this.x}, ${this.y})`;
  11475. };
  11476. var Cartesian2_default = Cartesian2;
  11477. // node_modules/cesium/Source/Core/GeographicTilingScheme.js
  11478. function GeographicTilingScheme(options) {
  11479. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  11480. this._ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  11481. this._rectangle = defaultValue_default(options.rectangle, Rectangle_default.MAX_VALUE);
  11482. this._projection = new GeographicProjection_default(this._ellipsoid);
  11483. this._numberOfLevelZeroTilesX = defaultValue_default(
  11484. options.numberOfLevelZeroTilesX,
  11485. 2
  11486. );
  11487. this._numberOfLevelZeroTilesY = defaultValue_default(
  11488. options.numberOfLevelZeroTilesY,
  11489. 1
  11490. );
  11491. }
  11492. Object.defineProperties(GeographicTilingScheme.prototype, {
  11493. ellipsoid: {
  11494. get: function() {
  11495. return this._ellipsoid;
  11496. }
  11497. },
  11498. rectangle: {
  11499. get: function() {
  11500. return this._rectangle;
  11501. }
  11502. },
  11503. projection: {
  11504. get: function() {
  11505. return this._projection;
  11506. }
  11507. }
  11508. });
  11509. GeographicTilingScheme.prototype.getNumberOfXTilesAtLevel = function(level) {
  11510. return this._numberOfLevelZeroTilesX << level;
  11511. };
  11512. GeographicTilingScheme.prototype.getNumberOfYTilesAtLevel = function(level) {
  11513. return this._numberOfLevelZeroTilesY << level;
  11514. };
  11515. GeographicTilingScheme.prototype.rectangleToNativeRectangle = function(rectangle, result) {
  11516. Check_default.defined("rectangle", rectangle);
  11517. const west = Math_default.toDegrees(rectangle.west);
  11518. const south = Math_default.toDegrees(rectangle.south);
  11519. const east = Math_default.toDegrees(rectangle.east);
  11520. const north = Math_default.toDegrees(rectangle.north);
  11521. if (!defined_default(result)) {
  11522. return new Rectangle_default(west, south, east, north);
  11523. }
  11524. result.west = west;
  11525. result.south = south;
  11526. result.east = east;
  11527. result.north = north;
  11528. return result;
  11529. };
  11530. GeographicTilingScheme.prototype.tileXYToNativeRectangle = function(x, y, level, result) {
  11531. const rectangleRadians = this.tileXYToRectangle(x, y, level, result);
  11532. rectangleRadians.west = Math_default.toDegrees(rectangleRadians.west);
  11533. rectangleRadians.south = Math_default.toDegrees(rectangleRadians.south);
  11534. rectangleRadians.east = Math_default.toDegrees(rectangleRadians.east);
  11535. rectangleRadians.north = Math_default.toDegrees(rectangleRadians.north);
  11536. return rectangleRadians;
  11537. };
  11538. GeographicTilingScheme.prototype.tileXYToRectangle = function(x, y, level, result) {
  11539. const rectangle = this._rectangle;
  11540. const xTiles = this.getNumberOfXTilesAtLevel(level);
  11541. const yTiles = this.getNumberOfYTilesAtLevel(level);
  11542. const xTileWidth = rectangle.width / xTiles;
  11543. const west = x * xTileWidth + rectangle.west;
  11544. const east = (x + 1) * xTileWidth + rectangle.west;
  11545. const yTileHeight = rectangle.height / yTiles;
  11546. const north = rectangle.north - y * yTileHeight;
  11547. const south = rectangle.north - (y + 1) * yTileHeight;
  11548. if (!defined_default(result)) {
  11549. result = new Rectangle_default(west, south, east, north);
  11550. }
  11551. result.west = west;
  11552. result.south = south;
  11553. result.east = east;
  11554. result.north = north;
  11555. return result;
  11556. };
  11557. GeographicTilingScheme.prototype.positionToTileXY = function(position, level, result) {
  11558. const rectangle = this._rectangle;
  11559. if (!Rectangle_default.contains(rectangle, position)) {
  11560. return void 0;
  11561. }
  11562. const xTiles = this.getNumberOfXTilesAtLevel(level);
  11563. const yTiles = this.getNumberOfYTilesAtLevel(level);
  11564. const xTileWidth = rectangle.width / xTiles;
  11565. const yTileHeight = rectangle.height / yTiles;
  11566. let longitude = position.longitude;
  11567. if (rectangle.east < rectangle.west) {
  11568. longitude += Math_default.TWO_PI;
  11569. }
  11570. let xTileCoordinate = (longitude - rectangle.west) / xTileWidth | 0;
  11571. if (xTileCoordinate >= xTiles) {
  11572. xTileCoordinate = xTiles - 1;
  11573. }
  11574. let yTileCoordinate = (rectangle.north - position.latitude) / yTileHeight | 0;
  11575. if (yTileCoordinate >= yTiles) {
  11576. yTileCoordinate = yTiles - 1;
  11577. }
  11578. if (!defined_default(result)) {
  11579. return new Cartesian2_default(xTileCoordinate, yTileCoordinate);
  11580. }
  11581. result.x = xTileCoordinate;
  11582. result.y = yTileCoordinate;
  11583. return result;
  11584. };
  11585. var GeographicTilingScheme_default = GeographicTilingScheme;
  11586. // node_modules/cesium/Source/Core/ApproximateTerrainHeights.js
  11587. var scratchDiagonalCartesianNE = new Cartesian3_default();
  11588. var scratchDiagonalCartesianSW = new Cartesian3_default();
  11589. var scratchDiagonalCartographic = new Cartographic_default();
  11590. var scratchCenterCartesian = new Cartesian3_default();
  11591. var scratchSurfaceCartesian = new Cartesian3_default();
  11592. var scratchBoundingSphere = new BoundingSphere_default();
  11593. var tilingScheme = new GeographicTilingScheme_default();
  11594. var scratchCorners = [
  11595. new Cartographic_default(),
  11596. new Cartographic_default(),
  11597. new Cartographic_default(),
  11598. new Cartographic_default()
  11599. ];
  11600. var scratchTileXY = new Cartesian2_default();
  11601. var ApproximateTerrainHeights = {};
  11602. ApproximateTerrainHeights.initialize = function() {
  11603. let initPromise = ApproximateTerrainHeights._initPromise;
  11604. if (defined_default(initPromise)) {
  11605. return initPromise;
  11606. }
  11607. initPromise = Resource_default.fetchJson(
  11608. buildModuleUrl_default("Assets/approximateTerrainHeights.json")
  11609. ).then(function(json) {
  11610. ApproximateTerrainHeights._terrainHeights = json;
  11611. });
  11612. ApproximateTerrainHeights._initPromise = initPromise;
  11613. return initPromise;
  11614. };
  11615. ApproximateTerrainHeights.getMinimumMaximumHeights = function(rectangle, ellipsoid) {
  11616. Check_default.defined("rectangle", rectangle);
  11617. if (!defined_default(ApproximateTerrainHeights._terrainHeights)) {
  11618. throw new DeveloperError_default(
  11619. "You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function"
  11620. );
  11621. }
  11622. ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  11623. const xyLevel = getTileXYLevel(rectangle);
  11624. let minTerrainHeight = ApproximateTerrainHeights._defaultMinTerrainHeight;
  11625. let maxTerrainHeight = ApproximateTerrainHeights._defaultMaxTerrainHeight;
  11626. if (defined_default(xyLevel)) {
  11627. const key = `${xyLevel.level}-${xyLevel.x}-${xyLevel.y}`;
  11628. const heights = ApproximateTerrainHeights._terrainHeights[key];
  11629. if (defined_default(heights)) {
  11630. minTerrainHeight = heights[0];
  11631. maxTerrainHeight = heights[1];
  11632. }
  11633. ellipsoid.cartographicToCartesian(
  11634. Rectangle_default.northeast(rectangle, scratchDiagonalCartographic),
  11635. scratchDiagonalCartesianNE
  11636. );
  11637. ellipsoid.cartographicToCartesian(
  11638. Rectangle_default.southwest(rectangle, scratchDiagonalCartographic),
  11639. scratchDiagonalCartesianSW
  11640. );
  11641. Cartesian3_default.midpoint(
  11642. scratchDiagonalCartesianSW,
  11643. scratchDiagonalCartesianNE,
  11644. scratchCenterCartesian
  11645. );
  11646. const surfacePosition = ellipsoid.scaleToGeodeticSurface(
  11647. scratchCenterCartesian,
  11648. scratchSurfaceCartesian
  11649. );
  11650. if (defined_default(surfacePosition)) {
  11651. const distance2 = Cartesian3_default.distance(
  11652. scratchCenterCartesian,
  11653. surfacePosition
  11654. );
  11655. minTerrainHeight = Math.min(minTerrainHeight, -distance2);
  11656. } else {
  11657. minTerrainHeight = ApproximateTerrainHeights._defaultMinTerrainHeight;
  11658. }
  11659. }
  11660. minTerrainHeight = Math.max(
  11661. ApproximateTerrainHeights._defaultMinTerrainHeight,
  11662. minTerrainHeight
  11663. );
  11664. return {
  11665. minimumTerrainHeight: minTerrainHeight,
  11666. maximumTerrainHeight: maxTerrainHeight
  11667. };
  11668. };
  11669. ApproximateTerrainHeights.getBoundingSphere = function(rectangle, ellipsoid) {
  11670. Check_default.defined("rectangle", rectangle);
  11671. if (!defined_default(ApproximateTerrainHeights._terrainHeights)) {
  11672. throw new DeveloperError_default(
  11673. "You must call ApproximateTerrainHeights.initialize and wait for the promise to resolve before using this function"
  11674. );
  11675. }
  11676. ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  11677. const xyLevel = getTileXYLevel(rectangle);
  11678. let maxTerrainHeight = ApproximateTerrainHeights._defaultMaxTerrainHeight;
  11679. if (defined_default(xyLevel)) {
  11680. const key = `${xyLevel.level}-${xyLevel.x}-${xyLevel.y}`;
  11681. const heights = ApproximateTerrainHeights._terrainHeights[key];
  11682. if (defined_default(heights)) {
  11683. maxTerrainHeight = heights[1];
  11684. }
  11685. }
  11686. const result = BoundingSphere_default.fromRectangle3D(rectangle, ellipsoid, 0);
  11687. BoundingSphere_default.fromRectangle3D(
  11688. rectangle,
  11689. ellipsoid,
  11690. maxTerrainHeight,
  11691. scratchBoundingSphere
  11692. );
  11693. return BoundingSphere_default.union(result, scratchBoundingSphere, result);
  11694. };
  11695. function getTileXYLevel(rectangle) {
  11696. Cartographic_default.fromRadians(
  11697. rectangle.east,
  11698. rectangle.north,
  11699. 0,
  11700. scratchCorners[0]
  11701. );
  11702. Cartographic_default.fromRadians(
  11703. rectangle.west,
  11704. rectangle.north,
  11705. 0,
  11706. scratchCorners[1]
  11707. );
  11708. Cartographic_default.fromRadians(
  11709. rectangle.east,
  11710. rectangle.south,
  11711. 0,
  11712. scratchCorners[2]
  11713. );
  11714. Cartographic_default.fromRadians(
  11715. rectangle.west,
  11716. rectangle.south,
  11717. 0,
  11718. scratchCorners[3]
  11719. );
  11720. let lastLevelX = 0, lastLevelY = 0;
  11721. let currentX = 0, currentY = 0;
  11722. const maxLevel = ApproximateTerrainHeights._terrainHeightsMaxLevel;
  11723. let i2;
  11724. for (i2 = 0; i2 <= maxLevel; ++i2) {
  11725. let failed = false;
  11726. for (let j = 0; j < 4; ++j) {
  11727. const corner = scratchCorners[j];
  11728. tilingScheme.positionToTileXY(corner, i2, scratchTileXY);
  11729. if (j === 0) {
  11730. currentX = scratchTileXY.x;
  11731. currentY = scratchTileXY.y;
  11732. } else if (currentX !== scratchTileXY.x || currentY !== scratchTileXY.y) {
  11733. failed = true;
  11734. break;
  11735. }
  11736. }
  11737. if (failed) {
  11738. break;
  11739. }
  11740. lastLevelX = currentX;
  11741. lastLevelY = currentY;
  11742. }
  11743. if (i2 === 0) {
  11744. return void 0;
  11745. }
  11746. return {
  11747. x: lastLevelX,
  11748. y: lastLevelY,
  11749. level: i2 > maxLevel ? maxLevel : i2 - 1
  11750. };
  11751. }
  11752. ApproximateTerrainHeights._terrainHeightsMaxLevel = 6;
  11753. ApproximateTerrainHeights._defaultMaxTerrainHeight = 9e3;
  11754. ApproximateTerrainHeights._defaultMinTerrainHeight = -1e5;
  11755. ApproximateTerrainHeights._terrainHeights = void 0;
  11756. ApproximateTerrainHeights._initPromise = void 0;
  11757. Object.defineProperties(ApproximateTerrainHeights, {
  11758. initialized: {
  11759. get: function() {
  11760. return defined_default(ApproximateTerrainHeights._terrainHeights);
  11761. }
  11762. }
  11763. });
  11764. var ApproximateTerrainHeights_default = ApproximateTerrainHeights;
  11765. // node_modules/cesium/Source/ThirdParty/dompurify.js
  11766. function _toConsumableArray(arr) {
  11767. if (Array.isArray(arr)) {
  11768. for (var i2 = 0, arr2 = Array(arr.length); i2 < arr.length; i2++) {
  11769. arr2[i2] = arr[i2];
  11770. }
  11771. return arr2;
  11772. } else {
  11773. return Array.from(arr);
  11774. }
  11775. }
  11776. var hasOwnProperty = Object.hasOwnProperty;
  11777. var setPrototypeOf = Object.setPrototypeOf;
  11778. var isFrozen = Object.isFrozen;
  11779. var getPrototypeOf = Object.getPrototypeOf;
  11780. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  11781. var freeze = Object.freeze;
  11782. var seal = Object.seal;
  11783. var create = Object.create;
  11784. var _ref = typeof Reflect !== "undefined" && Reflect;
  11785. var apply = _ref.apply;
  11786. var construct = _ref.construct;
  11787. if (!apply) {
  11788. apply = function apply2(fun, thisValue, args) {
  11789. return fun.apply(thisValue, args);
  11790. };
  11791. }
  11792. if (!freeze) {
  11793. freeze = function freeze2(x) {
  11794. return x;
  11795. };
  11796. }
  11797. if (!seal) {
  11798. seal = function seal2(x) {
  11799. return x;
  11800. };
  11801. }
  11802. if (!construct) {
  11803. construct = function construct2(Func, args) {
  11804. return new (Function.prototype.bind.apply(Func, [null].concat(_toConsumableArray(args))))();
  11805. };
  11806. }
  11807. var arrayForEach = unapply(Array.prototype.forEach);
  11808. var arrayPop = unapply(Array.prototype.pop);
  11809. var arrayPush = unapply(Array.prototype.push);
  11810. var stringToLowerCase = unapply(String.prototype.toLowerCase);
  11811. var stringMatch = unapply(String.prototype.match);
  11812. var stringReplace = unapply(String.prototype.replace);
  11813. var stringIndexOf = unapply(String.prototype.indexOf);
  11814. var stringTrim = unapply(String.prototype.trim);
  11815. var regExpTest = unapply(RegExp.prototype.test);
  11816. var typeErrorCreate = unconstruct(TypeError);
  11817. function unapply(func) {
  11818. return function(thisArg) {
  11819. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  11820. args[_key - 1] = arguments[_key];
  11821. }
  11822. return apply(func, thisArg, args);
  11823. };
  11824. }
  11825. function unconstruct(func) {
  11826. return function() {
  11827. for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  11828. args[_key2] = arguments[_key2];
  11829. }
  11830. return construct(func, args);
  11831. };
  11832. }
  11833. function addToSet(set2, array) {
  11834. if (setPrototypeOf) {
  11835. setPrototypeOf(set2, null);
  11836. }
  11837. var l2 = array.length;
  11838. while (l2--) {
  11839. var element = array[l2];
  11840. if (typeof element === "string") {
  11841. var lcElement = stringToLowerCase(element);
  11842. if (lcElement !== element) {
  11843. if (!isFrozen(array)) {
  11844. array[l2] = lcElement;
  11845. }
  11846. element = lcElement;
  11847. }
  11848. }
  11849. set2[element] = true;
  11850. }
  11851. return set2;
  11852. }
  11853. function clone2(object2) {
  11854. var newObject = create(null);
  11855. var property = void 0;
  11856. for (property in object2) {
  11857. if (apply(hasOwnProperty, object2, [property])) {
  11858. newObject[property] = object2[property];
  11859. }
  11860. }
  11861. return newObject;
  11862. }
  11863. function lookupGetter(object2, prop) {
  11864. while (object2 !== null) {
  11865. var desc = getOwnPropertyDescriptor(object2, prop);
  11866. if (desc) {
  11867. if (desc.get) {
  11868. return unapply(desc.get);
  11869. }
  11870. if (typeof desc.value === "function") {
  11871. return unapply(desc.value);
  11872. }
  11873. }
  11874. object2 = getPrototypeOf(object2);
  11875. }
  11876. function fallbackValue(element) {
  11877. console.warn("fallback value for", element);
  11878. return null;
  11879. }
  11880. return fallbackValue;
  11881. }
  11882. var html = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]);
  11883. var svg = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]);
  11884. var svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]);
  11885. var svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "fedropshadow", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]);
  11886. var mathMl = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover"]);
  11887. var mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
  11888. var text = freeze(["#text"]);
  11889. var html$1 = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "xmlns", "slot"]);
  11890. var svg$1 = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]);
  11891. var mathMl$1 = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]);
  11892. var xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
  11893. var MUSTACHE_EXPR = seal(/\{\{[\s\S]*|[\s\S]*\}\}/gm);
  11894. var ERB_EXPR = seal(/<%[\s\S]*|[\s\S]*%>/gm);
  11895. var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/);
  11896. var ARIA_ATTR = seal(/^aria-[\-\w]+$/);
  11897. var IS_ALLOWED_URI = seal(
  11898. /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
  11899. );
  11900. var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
  11901. var ATTR_WHITESPACE = seal(
  11902. /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
  11903. );
  11904. var DOCTYPE_NAME = seal(/^html$/i);
  11905. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function(obj) {
  11906. return typeof obj;
  11907. } : function(obj) {
  11908. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  11909. };
  11910. function _toConsumableArray$1(arr) {
  11911. if (Array.isArray(arr)) {
  11912. for (var i2 = 0, arr2 = Array(arr.length); i2 < arr.length; i2++) {
  11913. arr2[i2] = arr[i2];
  11914. }
  11915. return arr2;
  11916. } else {
  11917. return Array.from(arr);
  11918. }
  11919. }
  11920. var getGlobal = function getGlobal2() {
  11921. return typeof window === "undefined" ? null : window;
  11922. };
  11923. var _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, document2) {
  11924. if ((typeof trustedTypes === "undefined" ? "undefined" : _typeof(trustedTypes)) !== "object" || typeof trustedTypes.createPolicy !== "function") {
  11925. return null;
  11926. }
  11927. var suffix = null;
  11928. var ATTR_NAME = "data-tt-policy-suffix";
  11929. if (document2.currentScript && document2.currentScript.hasAttribute(ATTR_NAME)) {
  11930. suffix = document2.currentScript.getAttribute(ATTR_NAME);
  11931. }
  11932. var policyName = "dompurify" + (suffix ? "#" + suffix : "");
  11933. try {
  11934. return trustedTypes.createPolicy(policyName, {
  11935. createHTML: function createHTML(html$$1) {
  11936. return html$$1;
  11937. }
  11938. });
  11939. } catch (_2) {
  11940. console.warn("TrustedTypes policy " + policyName + " could not be created.");
  11941. return null;
  11942. }
  11943. };
  11944. function createDOMPurify() {
  11945. var window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
  11946. var DOMPurify = function DOMPurify2(root) {
  11947. return createDOMPurify(root);
  11948. };
  11949. DOMPurify.version = "2.3.6";
  11950. DOMPurify.removed = [];
  11951. if (!window2 || !window2.document || window2.document.nodeType !== 9) {
  11952. DOMPurify.isSupported = false;
  11953. return DOMPurify;
  11954. }
  11955. var originalDocument = window2.document;
  11956. var document2 = window2.document;
  11957. var DocumentFragment2 = window2.DocumentFragment, HTMLTemplateElement = window2.HTMLTemplateElement, Node7 = window2.Node, Element2 = window2.Element, NodeFilter = window2.NodeFilter, _window$NamedNodeMap = window2.NamedNodeMap, NamedNodeMap = _window$NamedNodeMap === void 0 ? window2.NamedNodeMap || window2.MozNamedAttrMap : _window$NamedNodeMap, HTMLFormElement = window2.HTMLFormElement, DOMParser2 = window2.DOMParser, trustedTypes = window2.trustedTypes;
  11958. var ElementPrototype = Element2.prototype;
  11959. var cloneNode = lookupGetter(ElementPrototype, "cloneNode");
  11960. var getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
  11961. var getChildNodes = lookupGetter(ElementPrototype, "childNodes");
  11962. var getParentNode = lookupGetter(ElementPrototype, "parentNode");
  11963. if (typeof HTMLTemplateElement === "function") {
  11964. var template = document2.createElement("template");
  11965. if (template.content && template.content.ownerDocument) {
  11966. document2 = template.content.ownerDocument;
  11967. }
  11968. }
  11969. var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument);
  11970. var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML("") : "";
  11971. var _document = document2, implementation4 = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName;
  11972. var importNode = originalDocument.importNode;
  11973. var documentMode = {};
  11974. try {
  11975. documentMode = clone2(document2).documentMode ? document2.documentMode : {};
  11976. } catch (_2) {
  11977. }
  11978. var hooks = {};
  11979. DOMPurify.isSupported = typeof getParentNode === "function" && implementation4 && typeof implementation4.createHTMLDocument !== "undefined" && documentMode !== 9;
  11980. var MUSTACHE_EXPR$$1 = MUSTACHE_EXPR, ERB_EXPR$$1 = ERB_EXPR, DATA_ATTR$$1 = DATA_ATTR, ARIA_ATTR$$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$$1 = ATTR_WHITESPACE;
  11981. var IS_ALLOWED_URI$$1 = IS_ALLOWED_URI;
  11982. var ALLOWED_TAGS = null;
  11983. var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray$1(html), _toConsumableArray$1(svg), _toConsumableArray$1(svgFilters), _toConsumableArray$1(mathMl), _toConsumableArray$1(text)));
  11984. var ALLOWED_ATTR = null;
  11985. var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray$1(html$1), _toConsumableArray$1(svg$1), _toConsumableArray$1(mathMl$1), _toConsumableArray$1(xml)));
  11986. var CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, {
  11987. tagNameCheck: {
  11988. writable: true,
  11989. configurable: false,
  11990. enumerable: true,
  11991. value: null
  11992. },
  11993. attributeNameCheck: {
  11994. writable: true,
  11995. configurable: false,
  11996. enumerable: true,
  11997. value: null
  11998. },
  11999. allowCustomizedBuiltInElements: {
  12000. writable: true,
  12001. configurable: false,
  12002. enumerable: true,
  12003. value: false
  12004. }
  12005. }));
  12006. var FORBID_TAGS = null;
  12007. var FORBID_ATTR = null;
  12008. var ALLOW_ARIA_ATTR = true;
  12009. var ALLOW_DATA_ATTR = true;
  12010. var ALLOW_UNKNOWN_PROTOCOLS = false;
  12011. var SAFE_FOR_TEMPLATES = false;
  12012. var WHOLE_DOCUMENT = false;
  12013. var SET_CONFIG = false;
  12014. var FORCE_BODY = false;
  12015. var RETURN_DOM = false;
  12016. var RETURN_DOM_FRAGMENT = false;
  12017. var RETURN_TRUSTED_TYPE = false;
  12018. var SANITIZE_DOM = true;
  12019. var KEEP_CONTENT = true;
  12020. var IN_PLACE = false;
  12021. var USE_PROFILES = {};
  12022. var FORBID_CONTENTS = null;
  12023. var DEFAULT_FORBID_CONTENTS = addToSet({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
  12024. var DATA_URI_TAGS = null;
  12025. var DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
  12026. var URI_SAFE_ATTRIBUTES = null;
  12027. var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
  12028. var MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
  12029. var SVG_NAMESPACE = "http://www.w3.org/2000/svg";
  12030. var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
  12031. var NAMESPACE = HTML_NAMESPACE;
  12032. var IS_EMPTY_INPUT = false;
  12033. var PARSER_MEDIA_TYPE = void 0;
  12034. var SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
  12035. var DEFAULT_PARSER_MEDIA_TYPE = "text/html";
  12036. var transformCaseFunc = void 0;
  12037. var CONFIG = null;
  12038. var formElement = document2.createElement("form");
  12039. var isRegexOrFunction = function isRegexOrFunction2(testValue) {
  12040. return testValue instanceof RegExp || testValue instanceof Function;
  12041. };
  12042. var _parseConfig = function _parseConfig2(cfg) {
  12043. if (CONFIG && CONFIG === cfg) {
  12044. return;
  12045. }
  12046. if (!cfg || (typeof cfg === "undefined" ? "undefined" : _typeof(cfg)) !== "object") {
  12047. cfg = {};
  12048. }
  12049. cfg = clone2(cfg);
  12050. ALLOWED_TAGS = "ALLOWED_TAGS" in cfg ? addToSet({}, cfg.ALLOWED_TAGS) : DEFAULT_ALLOWED_TAGS;
  12051. ALLOWED_ATTR = "ALLOWED_ATTR" in cfg ? addToSet({}, cfg.ALLOWED_ATTR) : DEFAULT_ALLOWED_ATTR;
  12052. URI_SAFE_ATTRIBUTES = "ADD_URI_SAFE_ATTR" in cfg ? addToSet(clone2(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR) : DEFAULT_URI_SAFE_ATTRIBUTES;
  12053. DATA_URI_TAGS = "ADD_DATA_URI_TAGS" in cfg ? addToSet(clone2(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS) : DEFAULT_DATA_URI_TAGS;
  12054. FORBID_CONTENTS = "FORBID_CONTENTS" in cfg ? addToSet({}, cfg.FORBID_CONTENTS) : DEFAULT_FORBID_CONTENTS;
  12055. FORBID_TAGS = "FORBID_TAGS" in cfg ? addToSet({}, cfg.FORBID_TAGS) : {};
  12056. FORBID_ATTR = "FORBID_ATTR" in cfg ? addToSet({}, cfg.FORBID_ATTR) : {};
  12057. USE_PROFILES = "USE_PROFILES" in cfg ? cfg.USE_PROFILES : false;
  12058. ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
  12059. ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
  12060. ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
  12061. SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
  12062. WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
  12063. RETURN_DOM = cfg.RETURN_DOM || false;
  12064. RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
  12065. RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
  12066. FORCE_BODY = cfg.FORCE_BODY || false;
  12067. SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
  12068. KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
  12069. IN_PLACE = cfg.IN_PLACE || false;
  12070. IS_ALLOWED_URI$$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$$1;
  12071. NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
  12072. if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
  12073. CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
  12074. }
  12075. if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
  12076. CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
  12077. }
  12078. if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") {
  12079. CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
  12080. }
  12081. PARSER_MEDIA_TYPE = SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE;
  12082. transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? function(x) {
  12083. return x;
  12084. } : stringToLowerCase;
  12085. if (SAFE_FOR_TEMPLATES) {
  12086. ALLOW_DATA_ATTR = false;
  12087. }
  12088. if (RETURN_DOM_FRAGMENT) {
  12089. RETURN_DOM = true;
  12090. }
  12091. if (USE_PROFILES) {
  12092. ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray$1(text)));
  12093. ALLOWED_ATTR = [];
  12094. if (USE_PROFILES.html === true) {
  12095. addToSet(ALLOWED_TAGS, html);
  12096. addToSet(ALLOWED_ATTR, html$1);
  12097. }
  12098. if (USE_PROFILES.svg === true) {
  12099. addToSet(ALLOWED_TAGS, svg);
  12100. addToSet(ALLOWED_ATTR, svg$1);
  12101. addToSet(ALLOWED_ATTR, xml);
  12102. }
  12103. if (USE_PROFILES.svgFilters === true) {
  12104. addToSet(ALLOWED_TAGS, svgFilters);
  12105. addToSet(ALLOWED_ATTR, svg$1);
  12106. addToSet(ALLOWED_ATTR, xml);
  12107. }
  12108. if (USE_PROFILES.mathMl === true) {
  12109. addToSet(ALLOWED_TAGS, mathMl);
  12110. addToSet(ALLOWED_ATTR, mathMl$1);
  12111. addToSet(ALLOWED_ATTR, xml);
  12112. }
  12113. }
  12114. if (cfg.ADD_TAGS) {
  12115. if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
  12116. ALLOWED_TAGS = clone2(ALLOWED_TAGS);
  12117. }
  12118. addToSet(ALLOWED_TAGS, cfg.ADD_TAGS);
  12119. }
  12120. if (cfg.ADD_ATTR) {
  12121. if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
  12122. ALLOWED_ATTR = clone2(ALLOWED_ATTR);
  12123. }
  12124. addToSet(ALLOWED_ATTR, cfg.ADD_ATTR);
  12125. }
  12126. if (cfg.ADD_URI_SAFE_ATTR) {
  12127. addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR);
  12128. }
  12129. if (cfg.FORBID_CONTENTS) {
  12130. if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
  12131. FORBID_CONTENTS = clone2(FORBID_CONTENTS);
  12132. }
  12133. addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS);
  12134. }
  12135. if (KEEP_CONTENT) {
  12136. ALLOWED_TAGS["#text"] = true;
  12137. }
  12138. if (WHOLE_DOCUMENT) {
  12139. addToSet(ALLOWED_TAGS, ["html", "head", "body"]);
  12140. }
  12141. if (ALLOWED_TAGS.table) {
  12142. addToSet(ALLOWED_TAGS, ["tbody"]);
  12143. delete FORBID_TAGS.tbody;
  12144. }
  12145. if (freeze) {
  12146. freeze(cfg);
  12147. }
  12148. CONFIG = cfg;
  12149. };
  12150. var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
  12151. var HTML_INTEGRATION_POINTS = addToSet({}, ["foreignobject", "desc", "title", "annotation-xml"]);
  12152. var ALL_SVG_TAGS = addToSet({}, svg);
  12153. addToSet(ALL_SVG_TAGS, svgFilters);
  12154. addToSet(ALL_SVG_TAGS, svgDisallowed);
  12155. var ALL_MATHML_TAGS = addToSet({}, mathMl);
  12156. addToSet(ALL_MATHML_TAGS, mathMlDisallowed);
  12157. var _checkValidNamespace = function _checkValidNamespace2(element) {
  12158. var parent = getParentNode(element);
  12159. if (!parent || !parent.tagName) {
  12160. parent = {
  12161. namespaceURI: HTML_NAMESPACE,
  12162. tagName: "template"
  12163. };
  12164. }
  12165. var tagName = stringToLowerCase(element.tagName);
  12166. var parentTagName = stringToLowerCase(parent.tagName);
  12167. if (element.namespaceURI === SVG_NAMESPACE) {
  12168. if (parent.namespaceURI === HTML_NAMESPACE) {
  12169. return tagName === "svg";
  12170. }
  12171. if (parent.namespaceURI === MATHML_NAMESPACE) {
  12172. return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
  12173. }
  12174. return Boolean(ALL_SVG_TAGS[tagName]);
  12175. }
  12176. if (element.namespaceURI === MATHML_NAMESPACE) {
  12177. if (parent.namespaceURI === HTML_NAMESPACE) {
  12178. return tagName === "math";
  12179. }
  12180. if (parent.namespaceURI === SVG_NAMESPACE) {
  12181. return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
  12182. }
  12183. return Boolean(ALL_MATHML_TAGS[tagName]);
  12184. }
  12185. if (element.namespaceURI === HTML_NAMESPACE) {
  12186. if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
  12187. return false;
  12188. }
  12189. if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
  12190. return false;
  12191. }
  12192. var commonSvgAndHTMLElements = addToSet({}, ["title", "style", "font", "a", "script"]);
  12193. return !ALL_MATHML_TAGS[tagName] && (commonSvgAndHTMLElements[tagName] || !ALL_SVG_TAGS[tagName]);
  12194. }
  12195. return false;
  12196. };
  12197. var _forceRemove = function _forceRemove2(node) {
  12198. arrayPush(DOMPurify.removed, { element: node });
  12199. try {
  12200. node.parentNode.removeChild(node);
  12201. } catch (_2) {
  12202. try {
  12203. node.outerHTML = emptyHTML;
  12204. } catch (_3) {
  12205. node.remove();
  12206. }
  12207. }
  12208. };
  12209. var _removeAttribute = function _removeAttribute2(name, node) {
  12210. try {
  12211. arrayPush(DOMPurify.removed, {
  12212. attribute: node.getAttributeNode(name),
  12213. from: node
  12214. });
  12215. } catch (_2) {
  12216. arrayPush(DOMPurify.removed, {
  12217. attribute: null,
  12218. from: node
  12219. });
  12220. }
  12221. node.removeAttribute(name);
  12222. if (name === "is" && !ALLOWED_ATTR[name]) {
  12223. if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
  12224. try {
  12225. _forceRemove(node);
  12226. } catch (_2) {
  12227. }
  12228. } else {
  12229. try {
  12230. node.setAttribute(name, "");
  12231. } catch (_2) {
  12232. }
  12233. }
  12234. }
  12235. };
  12236. var _initDocument = function _initDocument2(dirty) {
  12237. var doc = void 0;
  12238. var leadingWhitespace = void 0;
  12239. if (FORCE_BODY) {
  12240. dirty = "<remove></remove>" + dirty;
  12241. } else {
  12242. var matches = stringMatch(dirty, /^[\r\n\t ]+/);
  12243. leadingWhitespace = matches && matches[0];
  12244. }
  12245. if (PARSER_MEDIA_TYPE === "application/xhtml+xml") {
  12246. dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
  12247. }
  12248. var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
  12249. if (NAMESPACE === HTML_NAMESPACE) {
  12250. try {
  12251. doc = new DOMParser2().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
  12252. } catch (_2) {
  12253. }
  12254. }
  12255. if (!doc || !doc.documentElement) {
  12256. doc = implementation4.createDocument(NAMESPACE, "template", null);
  12257. try {
  12258. doc.documentElement.innerHTML = IS_EMPTY_INPUT ? "" : dirtyPayload;
  12259. } catch (_2) {
  12260. }
  12261. }
  12262. var body = doc.body || doc.documentElement;
  12263. if (dirty && leadingWhitespace) {
  12264. body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null);
  12265. }
  12266. if (NAMESPACE === HTML_NAMESPACE) {
  12267. return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
  12268. }
  12269. return WHOLE_DOCUMENT ? doc.documentElement : body;
  12270. };
  12271. var _createIterator = function _createIterator2(root) {
  12272. return createNodeIterator.call(
  12273. root.ownerDocument || root,
  12274. root,
  12275. NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT,
  12276. null,
  12277. false
  12278. );
  12279. };
  12280. var _isClobbered = function _isClobbered2(elm) {
  12281. return elm instanceof HTMLFormElement && (typeof elm.nodeName !== "string" || typeof elm.textContent !== "string" || typeof elm.removeChild !== "function" || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== "function" || typeof elm.setAttribute !== "function" || typeof elm.namespaceURI !== "string" || typeof elm.insertBefore !== "function");
  12282. };
  12283. var _isNode = function _isNode2(object2) {
  12284. return (typeof Node7 === "undefined" ? "undefined" : _typeof(Node7)) === "object" ? object2 instanceof Node7 : object2 && (typeof object2 === "undefined" ? "undefined" : _typeof(object2)) === "object" && typeof object2.nodeType === "number" && typeof object2.nodeName === "string";
  12285. };
  12286. var _executeHook = function _executeHook2(entryPoint, currentNode, data) {
  12287. if (!hooks[entryPoint]) {
  12288. return;
  12289. }
  12290. arrayForEach(hooks[entryPoint], function(hook) {
  12291. hook.call(DOMPurify, currentNode, data, CONFIG);
  12292. });
  12293. };
  12294. var _sanitizeElements = function _sanitizeElements2(currentNode) {
  12295. var content = void 0;
  12296. _executeHook("beforeSanitizeElements", currentNode, null);
  12297. if (_isClobbered(currentNode)) {
  12298. _forceRemove(currentNode);
  12299. return true;
  12300. }
  12301. if (stringMatch(currentNode.nodeName, /[\u0080-\uFFFF]/)) {
  12302. _forceRemove(currentNode);
  12303. return true;
  12304. }
  12305. var tagName = transformCaseFunc(currentNode.nodeName);
  12306. _executeHook("uponSanitizeElement", currentNode, {
  12307. tagName,
  12308. allowedTags: ALLOWED_TAGS
  12309. });
  12310. if (!_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
  12311. _forceRemove(currentNode);
  12312. return true;
  12313. }
  12314. if (tagName === "select" && regExpTest(/<template/i, currentNode.innerHTML)) {
  12315. _forceRemove(currentNode);
  12316. return true;
  12317. }
  12318. if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
  12319. if (!FORBID_TAGS[tagName] && _basicCustomElementTest(tagName)) {
  12320. if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName))
  12321. return false;
  12322. if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName))
  12323. return false;
  12324. }
  12325. if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
  12326. var parentNode = getParentNode(currentNode) || currentNode.parentNode;
  12327. var childNodes = getChildNodes(currentNode) || currentNode.childNodes;
  12328. if (childNodes && parentNode) {
  12329. var childCount = childNodes.length;
  12330. for (var i2 = childCount - 1; i2 >= 0; --i2) {
  12331. parentNode.insertBefore(cloneNode(childNodes[i2], true), getNextSibling(currentNode));
  12332. }
  12333. }
  12334. }
  12335. _forceRemove(currentNode);
  12336. return true;
  12337. }
  12338. if (currentNode instanceof Element2 && !_checkValidNamespace(currentNode)) {
  12339. _forceRemove(currentNode);
  12340. return true;
  12341. }
  12342. if ((tagName === "noscript" || tagName === "noembed") && regExpTest(/<\/no(script|embed)/i, currentNode.innerHTML)) {
  12343. _forceRemove(currentNode);
  12344. return true;
  12345. }
  12346. if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
  12347. content = currentNode.textContent;
  12348. content = stringReplace(content, MUSTACHE_EXPR$$1, " ");
  12349. content = stringReplace(content, ERB_EXPR$$1, " ");
  12350. if (currentNode.textContent !== content) {
  12351. arrayPush(DOMPurify.removed, { element: currentNode.cloneNode() });
  12352. currentNode.textContent = content;
  12353. }
  12354. }
  12355. _executeHook("afterSanitizeElements", currentNode, null);
  12356. return false;
  12357. };
  12358. var _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
  12359. if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) {
  12360. return false;
  12361. }
  12362. if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR$$1, lcName))
  12363. ;
  12364. else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$$1, lcName))
  12365. ;
  12366. else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
  12367. if (_basicCustomElementTest(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value)))
  12368. ;
  12369. else {
  12370. return false;
  12371. }
  12372. } else if (URI_SAFE_ATTRIBUTES[lcName])
  12373. ;
  12374. else if (regExpTest(IS_ALLOWED_URI$$1, stringReplace(value, ATTR_WHITESPACE$$1, "")))
  12375. ;
  12376. else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag])
  12377. ;
  12378. else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$$1, stringReplace(value, ATTR_WHITESPACE$$1, "")))
  12379. ;
  12380. else if (!value)
  12381. ;
  12382. else {
  12383. return false;
  12384. }
  12385. return true;
  12386. };
  12387. var _basicCustomElementTest = function _basicCustomElementTest2(tagName) {
  12388. return tagName.indexOf("-") > 0;
  12389. };
  12390. var _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
  12391. var attr = void 0;
  12392. var value = void 0;
  12393. var lcName = void 0;
  12394. var l2 = void 0;
  12395. _executeHook("beforeSanitizeAttributes", currentNode, null);
  12396. var attributes = currentNode.attributes;
  12397. if (!attributes) {
  12398. return;
  12399. }
  12400. var hookEvent = {
  12401. attrName: "",
  12402. attrValue: "",
  12403. keepAttr: true,
  12404. allowedAttributes: ALLOWED_ATTR
  12405. };
  12406. l2 = attributes.length;
  12407. while (l2--) {
  12408. attr = attributes[l2];
  12409. var _attr = attr, name = _attr.name, namespaceURI = _attr.namespaceURI;
  12410. value = stringTrim(attr.value);
  12411. lcName = transformCaseFunc(name);
  12412. hookEvent.attrName = lcName;
  12413. hookEvent.attrValue = value;
  12414. hookEvent.keepAttr = true;
  12415. hookEvent.forceKeepAttr = void 0;
  12416. _executeHook("uponSanitizeAttribute", currentNode, hookEvent);
  12417. value = hookEvent.attrValue;
  12418. if (hookEvent.forceKeepAttr) {
  12419. continue;
  12420. }
  12421. _removeAttribute(name, currentNode);
  12422. if (!hookEvent.keepAttr) {
  12423. continue;
  12424. }
  12425. if (regExpTest(/\/>/i, value)) {
  12426. _removeAttribute(name, currentNode);
  12427. continue;
  12428. }
  12429. if (SAFE_FOR_TEMPLATES) {
  12430. value = stringReplace(value, MUSTACHE_EXPR$$1, " ");
  12431. value = stringReplace(value, ERB_EXPR$$1, " ");
  12432. }
  12433. var lcTag = transformCaseFunc(currentNode.nodeName);
  12434. if (!_isValidAttribute(lcTag, lcName, value)) {
  12435. continue;
  12436. }
  12437. try {
  12438. if (namespaceURI) {
  12439. currentNode.setAttributeNS(namespaceURI, name, value);
  12440. } else {
  12441. currentNode.setAttribute(name, value);
  12442. }
  12443. arrayPop(DOMPurify.removed);
  12444. } catch (_2) {
  12445. }
  12446. }
  12447. _executeHook("afterSanitizeAttributes", currentNode, null);
  12448. };
  12449. var _sanitizeShadowDOM = function _sanitizeShadowDOM2(fragment) {
  12450. var shadowNode = void 0;
  12451. var shadowIterator = _createIterator(fragment);
  12452. _executeHook("beforeSanitizeShadowDOM", fragment, null);
  12453. while (shadowNode = shadowIterator.nextNode()) {
  12454. _executeHook("uponSanitizeShadowNode", shadowNode, null);
  12455. if (_sanitizeElements(shadowNode)) {
  12456. continue;
  12457. }
  12458. if (shadowNode.content instanceof DocumentFragment2) {
  12459. _sanitizeShadowDOM2(shadowNode.content);
  12460. }
  12461. _sanitizeAttributes(shadowNode);
  12462. }
  12463. _executeHook("afterSanitizeShadowDOM", fragment, null);
  12464. };
  12465. DOMPurify.sanitize = function(dirty, cfg) {
  12466. var body = void 0;
  12467. var importedNode = void 0;
  12468. var currentNode = void 0;
  12469. var oldNode = void 0;
  12470. var returnNode = void 0;
  12471. IS_EMPTY_INPUT = !dirty;
  12472. if (IS_EMPTY_INPUT) {
  12473. dirty = "<!-->";
  12474. }
  12475. if (typeof dirty !== "string" && !_isNode(dirty)) {
  12476. if (typeof dirty.toString !== "function") {
  12477. throw typeErrorCreate("toString is not a function");
  12478. } else {
  12479. dirty = dirty.toString();
  12480. if (typeof dirty !== "string") {
  12481. throw typeErrorCreate("dirty is not a string, aborting");
  12482. }
  12483. }
  12484. }
  12485. if (!DOMPurify.isSupported) {
  12486. if (_typeof(window2.toStaticHTML) === "object" || typeof window2.toStaticHTML === "function") {
  12487. if (typeof dirty === "string") {
  12488. return window2.toStaticHTML(dirty);
  12489. }
  12490. if (_isNode(dirty)) {
  12491. return window2.toStaticHTML(dirty.outerHTML);
  12492. }
  12493. }
  12494. return dirty;
  12495. }
  12496. if (!SET_CONFIG) {
  12497. _parseConfig(cfg);
  12498. }
  12499. DOMPurify.removed = [];
  12500. if (typeof dirty === "string") {
  12501. IN_PLACE = false;
  12502. }
  12503. if (IN_PLACE) {
  12504. if (dirty.nodeName) {
  12505. var tagName = transformCaseFunc(dirty.nodeName);
  12506. if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
  12507. throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
  12508. }
  12509. }
  12510. } else if (dirty instanceof Node7) {
  12511. body = _initDocument("<!---->");
  12512. importedNode = body.ownerDocument.importNode(dirty, true);
  12513. if (importedNode.nodeType === 1 && importedNode.nodeName === "BODY") {
  12514. body = importedNode;
  12515. } else if (importedNode.nodeName === "HTML") {
  12516. body = importedNode;
  12517. } else {
  12518. body.appendChild(importedNode);
  12519. }
  12520. } else {
  12521. if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && dirty.indexOf("<") === -1) {
  12522. return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
  12523. }
  12524. body = _initDocument(dirty);
  12525. if (!body) {
  12526. return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
  12527. }
  12528. }
  12529. if (body && FORCE_BODY) {
  12530. _forceRemove(body.firstChild);
  12531. }
  12532. var nodeIterator = _createIterator(IN_PLACE ? dirty : body);
  12533. while (currentNode = nodeIterator.nextNode()) {
  12534. if (currentNode.nodeType === 3 && currentNode === oldNode) {
  12535. continue;
  12536. }
  12537. if (_sanitizeElements(currentNode)) {
  12538. continue;
  12539. }
  12540. if (currentNode.content instanceof DocumentFragment2) {
  12541. _sanitizeShadowDOM(currentNode.content);
  12542. }
  12543. _sanitizeAttributes(currentNode);
  12544. oldNode = currentNode;
  12545. }
  12546. oldNode = null;
  12547. if (IN_PLACE) {
  12548. return dirty;
  12549. }
  12550. if (RETURN_DOM) {
  12551. if (RETURN_DOM_FRAGMENT) {
  12552. returnNode = createDocumentFragment.call(body.ownerDocument);
  12553. while (body.firstChild) {
  12554. returnNode.appendChild(body.firstChild);
  12555. }
  12556. } else {
  12557. returnNode = body;
  12558. }
  12559. if (ALLOWED_ATTR.shadowroot) {
  12560. returnNode = importNode.call(originalDocument, returnNode, true);
  12561. }
  12562. return returnNode;
  12563. }
  12564. var serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
  12565. if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
  12566. serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
  12567. }
  12568. if (SAFE_FOR_TEMPLATES) {
  12569. serializedHTML = stringReplace(serializedHTML, MUSTACHE_EXPR$$1, " ");
  12570. serializedHTML = stringReplace(serializedHTML, ERB_EXPR$$1, " ");
  12571. }
  12572. return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
  12573. };
  12574. DOMPurify.setConfig = function(cfg) {
  12575. _parseConfig(cfg);
  12576. SET_CONFIG = true;
  12577. };
  12578. DOMPurify.clearConfig = function() {
  12579. CONFIG = null;
  12580. SET_CONFIG = false;
  12581. };
  12582. DOMPurify.isValidAttribute = function(tag, attr, value) {
  12583. if (!CONFIG) {
  12584. _parseConfig({});
  12585. }
  12586. var lcTag = transformCaseFunc(tag);
  12587. var lcName = transformCaseFunc(attr);
  12588. return _isValidAttribute(lcTag, lcName, value);
  12589. };
  12590. DOMPurify.addHook = function(entryPoint, hookFunction) {
  12591. if (typeof hookFunction !== "function") {
  12592. return;
  12593. }
  12594. hooks[entryPoint] = hooks[entryPoint] || [];
  12595. arrayPush(hooks[entryPoint], hookFunction);
  12596. };
  12597. DOMPurify.removeHook = function(entryPoint) {
  12598. if (hooks[entryPoint]) {
  12599. arrayPop(hooks[entryPoint]);
  12600. }
  12601. };
  12602. DOMPurify.removeHooks = function(entryPoint) {
  12603. if (hooks[entryPoint]) {
  12604. hooks[entryPoint] = [];
  12605. }
  12606. };
  12607. DOMPurify.removeAllHooks = function() {
  12608. hooks = {};
  12609. };
  12610. return DOMPurify;
  12611. }
  12612. var purify = createDOMPurify();
  12613. // node_modules/cesium/Source/Core/Credit.js
  12614. var nextCreditId = 0;
  12615. var creditToId = {};
  12616. function Credit(html2, showOnScreen) {
  12617. Check_default.typeOf.string("html", html2);
  12618. let id;
  12619. const key = html2;
  12620. if (defined_default(creditToId[key])) {
  12621. id = creditToId[key];
  12622. } else {
  12623. id = nextCreditId++;
  12624. creditToId[key] = id;
  12625. }
  12626. showOnScreen = defaultValue_default(showOnScreen, false);
  12627. this._id = id;
  12628. this._html = html2;
  12629. this._showOnScreen = showOnScreen;
  12630. this._element = void 0;
  12631. }
  12632. Object.defineProperties(Credit.prototype, {
  12633. html: {
  12634. get: function() {
  12635. return this._html;
  12636. }
  12637. },
  12638. id: {
  12639. get: function() {
  12640. return this._id;
  12641. }
  12642. },
  12643. showOnScreen: {
  12644. get: function() {
  12645. return this._showOnScreen;
  12646. },
  12647. set: function(value) {
  12648. this._showOnScreen = value;
  12649. }
  12650. },
  12651. element: {
  12652. get: function() {
  12653. if (!defined_default(this._element)) {
  12654. const html2 = purify.sanitize(this._html);
  12655. const div = document.createElement("div");
  12656. div._creditId = this._id;
  12657. div.style.display = "inline";
  12658. div.innerHTML = html2;
  12659. const links = div.querySelectorAll("a");
  12660. for (let i2 = 0; i2 < links.length; i2++) {
  12661. links[i2].setAttribute("target", "_blank");
  12662. }
  12663. this._element = div;
  12664. }
  12665. return this._element;
  12666. }
  12667. }
  12668. });
  12669. Credit.equals = function(left, right) {
  12670. return left === right || defined_default(left) && defined_default(right) && left._id === right._id && left._showOnScreen === right._showOnScreen;
  12671. };
  12672. Credit.prototype.equals = function(credit) {
  12673. return Credit.equals(this, credit);
  12674. };
  12675. Credit.getIonCredit = function(attribution) {
  12676. const showOnScreen = defined_default(attribution.collapsible) && !attribution.collapsible;
  12677. const credit = new Credit(attribution.html, showOnScreen);
  12678. credit._isIon = credit.html.indexOf("ion-credit.png") !== -1;
  12679. return credit;
  12680. };
  12681. Credit.clone = function(credit) {
  12682. if (defined_default(credit)) {
  12683. return new Credit(credit.html, credit.showOnScreen);
  12684. }
  12685. };
  12686. var Credit_default = Credit;
  12687. // node_modules/cesium/Source/Core/HeightmapEncoding.js
  12688. var HeightmapEncoding = {
  12689. NONE: 0,
  12690. LERC: 1
  12691. };
  12692. var HeightmapEncoding_default = Object.freeze(HeightmapEncoding);
  12693. // node_modules/cesium/Source/Core/AxisAlignedBoundingBox.js
  12694. function AxisAlignedBoundingBox(minimum, maximum, center) {
  12695. this.minimum = Cartesian3_default.clone(defaultValue_default(minimum, Cartesian3_default.ZERO));
  12696. this.maximum = Cartesian3_default.clone(defaultValue_default(maximum, Cartesian3_default.ZERO));
  12697. if (!defined_default(center)) {
  12698. center = Cartesian3_default.midpoint(this.minimum, this.maximum, new Cartesian3_default());
  12699. } else {
  12700. center = Cartesian3_default.clone(center);
  12701. }
  12702. this.center = center;
  12703. }
  12704. AxisAlignedBoundingBox.fromCorners = function(minimum, maximum, result) {
  12705. Check_default.defined("minimum", minimum);
  12706. Check_default.defined("maximum", maximum);
  12707. if (!defined_default(result)) {
  12708. result = new AxisAlignedBoundingBox();
  12709. }
  12710. result.minimum = Cartesian3_default.clone(minimum, result.minimum);
  12711. result.maximum = Cartesian3_default.clone(maximum, result.maximum);
  12712. result.center = Cartesian3_default.midpoint(minimum, maximum, result.center);
  12713. return result;
  12714. };
  12715. AxisAlignedBoundingBox.fromPoints = function(positions, result) {
  12716. if (!defined_default(result)) {
  12717. result = new AxisAlignedBoundingBox();
  12718. }
  12719. if (!defined_default(positions) || positions.length === 0) {
  12720. result.minimum = Cartesian3_default.clone(Cartesian3_default.ZERO, result.minimum);
  12721. result.maximum = Cartesian3_default.clone(Cartesian3_default.ZERO, result.maximum);
  12722. result.center = Cartesian3_default.clone(Cartesian3_default.ZERO, result.center);
  12723. return result;
  12724. }
  12725. let minimumX = positions[0].x;
  12726. let minimumY = positions[0].y;
  12727. let minimumZ = positions[0].z;
  12728. let maximumX = positions[0].x;
  12729. let maximumY = positions[0].y;
  12730. let maximumZ = positions[0].z;
  12731. const length3 = positions.length;
  12732. for (let i2 = 1; i2 < length3; i2++) {
  12733. const p2 = positions[i2];
  12734. const x = p2.x;
  12735. const y = p2.y;
  12736. const z = p2.z;
  12737. minimumX = Math.min(x, minimumX);
  12738. maximumX = Math.max(x, maximumX);
  12739. minimumY = Math.min(y, minimumY);
  12740. maximumY = Math.max(y, maximumY);
  12741. minimumZ = Math.min(z, minimumZ);
  12742. maximumZ = Math.max(z, maximumZ);
  12743. }
  12744. const minimum = result.minimum;
  12745. minimum.x = minimumX;
  12746. minimum.y = minimumY;
  12747. minimum.z = minimumZ;
  12748. const maximum = result.maximum;
  12749. maximum.x = maximumX;
  12750. maximum.y = maximumY;
  12751. maximum.z = maximumZ;
  12752. result.center = Cartesian3_default.midpoint(minimum, maximum, result.center);
  12753. return result;
  12754. };
  12755. AxisAlignedBoundingBox.clone = function(box, result) {
  12756. if (!defined_default(box)) {
  12757. return void 0;
  12758. }
  12759. if (!defined_default(result)) {
  12760. return new AxisAlignedBoundingBox(box.minimum, box.maximum, box.center);
  12761. }
  12762. result.minimum = Cartesian3_default.clone(box.minimum, result.minimum);
  12763. result.maximum = Cartesian3_default.clone(box.maximum, result.maximum);
  12764. result.center = Cartesian3_default.clone(box.center, result.center);
  12765. return result;
  12766. };
  12767. AxisAlignedBoundingBox.equals = function(left, right) {
  12768. return left === right || defined_default(left) && defined_default(right) && Cartesian3_default.equals(left.center, right.center) && Cartesian3_default.equals(left.minimum, right.minimum) && Cartesian3_default.equals(left.maximum, right.maximum);
  12769. };
  12770. var intersectScratch = new Cartesian3_default();
  12771. AxisAlignedBoundingBox.intersectPlane = function(box, plane) {
  12772. Check_default.defined("box", box);
  12773. Check_default.defined("plane", plane);
  12774. intersectScratch = Cartesian3_default.subtract(
  12775. box.maximum,
  12776. box.minimum,
  12777. intersectScratch
  12778. );
  12779. const h = Cartesian3_default.multiplyByScalar(
  12780. intersectScratch,
  12781. 0.5,
  12782. intersectScratch
  12783. );
  12784. const normal2 = plane.normal;
  12785. const e2 = h.x * Math.abs(normal2.x) + h.y * Math.abs(normal2.y) + h.z * Math.abs(normal2.z);
  12786. const s2 = Cartesian3_default.dot(box.center, normal2) + plane.distance;
  12787. if (s2 - e2 > 0) {
  12788. return Intersect_default.INSIDE;
  12789. }
  12790. if (s2 + e2 < 0) {
  12791. return Intersect_default.OUTSIDE;
  12792. }
  12793. return Intersect_default.INTERSECTING;
  12794. };
  12795. AxisAlignedBoundingBox.prototype.clone = function(result) {
  12796. return AxisAlignedBoundingBox.clone(this, result);
  12797. };
  12798. AxisAlignedBoundingBox.prototype.intersectPlane = function(plane) {
  12799. return AxisAlignedBoundingBox.intersectPlane(this, plane);
  12800. };
  12801. AxisAlignedBoundingBox.prototype.equals = function(right) {
  12802. return AxisAlignedBoundingBox.equals(this, right);
  12803. };
  12804. var AxisAlignedBoundingBox_default = AxisAlignedBoundingBox;
  12805. // node_modules/cesium/Source/Core/EllipsoidalOccluder.js
  12806. function EllipsoidalOccluder(ellipsoid, cameraPosition) {
  12807. Check_default.typeOf.object("ellipsoid", ellipsoid);
  12808. this._ellipsoid = ellipsoid;
  12809. this._cameraPosition = new Cartesian3_default();
  12810. this._cameraPositionInScaledSpace = new Cartesian3_default();
  12811. this._distanceToLimbInScaledSpaceSquared = 0;
  12812. if (defined_default(cameraPosition)) {
  12813. this.cameraPosition = cameraPosition;
  12814. }
  12815. }
  12816. Object.defineProperties(EllipsoidalOccluder.prototype, {
  12817. ellipsoid: {
  12818. get: function() {
  12819. return this._ellipsoid;
  12820. }
  12821. },
  12822. cameraPosition: {
  12823. get: function() {
  12824. return this._cameraPosition;
  12825. },
  12826. set: function(cameraPosition) {
  12827. const ellipsoid = this._ellipsoid;
  12828. const cv = ellipsoid.transformPositionToScaledSpace(
  12829. cameraPosition,
  12830. this._cameraPositionInScaledSpace
  12831. );
  12832. const vhMagnitudeSquared = Cartesian3_default.magnitudeSquared(cv) - 1;
  12833. Cartesian3_default.clone(cameraPosition, this._cameraPosition);
  12834. this._cameraPositionInScaledSpace = cv;
  12835. this._distanceToLimbInScaledSpaceSquared = vhMagnitudeSquared;
  12836. }
  12837. }
  12838. });
  12839. var scratchCartesian = new Cartesian3_default();
  12840. EllipsoidalOccluder.prototype.isPointVisible = function(occludee) {
  12841. const ellipsoid = this._ellipsoid;
  12842. const occludeeScaledSpacePosition = ellipsoid.transformPositionToScaledSpace(
  12843. occludee,
  12844. scratchCartesian
  12845. );
  12846. return isScaledSpacePointVisible(
  12847. occludeeScaledSpacePosition,
  12848. this._cameraPositionInScaledSpace,
  12849. this._distanceToLimbInScaledSpaceSquared
  12850. );
  12851. };
  12852. EllipsoidalOccluder.prototype.isScaledSpacePointVisible = function(occludeeScaledSpacePosition) {
  12853. return isScaledSpacePointVisible(
  12854. occludeeScaledSpacePosition,
  12855. this._cameraPositionInScaledSpace,
  12856. this._distanceToLimbInScaledSpaceSquared
  12857. );
  12858. };
  12859. var scratchCameraPositionInScaledSpaceShrunk = new Cartesian3_default();
  12860. EllipsoidalOccluder.prototype.isScaledSpacePointVisiblePossiblyUnderEllipsoid = function(occludeeScaledSpacePosition, minimumHeight) {
  12861. const ellipsoid = this._ellipsoid;
  12862. let vhMagnitudeSquared;
  12863. let cv;
  12864. if (defined_default(minimumHeight) && minimumHeight < 0 && ellipsoid.minimumRadius > -minimumHeight) {
  12865. cv = scratchCameraPositionInScaledSpaceShrunk;
  12866. cv.x = this._cameraPosition.x / (ellipsoid.radii.x + minimumHeight);
  12867. cv.y = this._cameraPosition.y / (ellipsoid.radii.y + minimumHeight);
  12868. cv.z = this._cameraPosition.z / (ellipsoid.radii.z + minimumHeight);
  12869. vhMagnitudeSquared = cv.x * cv.x + cv.y * cv.y + cv.z * cv.z - 1;
  12870. } else {
  12871. cv = this._cameraPositionInScaledSpace;
  12872. vhMagnitudeSquared = this._distanceToLimbInScaledSpaceSquared;
  12873. }
  12874. return isScaledSpacePointVisible(
  12875. occludeeScaledSpacePosition,
  12876. cv,
  12877. vhMagnitudeSquared
  12878. );
  12879. };
  12880. EllipsoidalOccluder.prototype.computeHorizonCullingPoint = function(directionToPoint, positions, result) {
  12881. return computeHorizonCullingPointFromPositions(
  12882. this._ellipsoid,
  12883. directionToPoint,
  12884. positions,
  12885. result
  12886. );
  12887. };
  12888. var scratchEllipsoidShrunk = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
  12889. EllipsoidalOccluder.prototype.computeHorizonCullingPointPossiblyUnderEllipsoid = function(directionToPoint, positions, minimumHeight, result) {
  12890. const possiblyShrunkEllipsoid = getPossiblyShrunkEllipsoid(
  12891. this._ellipsoid,
  12892. minimumHeight,
  12893. scratchEllipsoidShrunk
  12894. );
  12895. return computeHorizonCullingPointFromPositions(
  12896. possiblyShrunkEllipsoid,
  12897. directionToPoint,
  12898. positions,
  12899. result
  12900. );
  12901. };
  12902. EllipsoidalOccluder.prototype.computeHorizonCullingPointFromVertices = function(directionToPoint, vertices, stride, center, result) {
  12903. return computeHorizonCullingPointFromVertices(
  12904. this._ellipsoid,
  12905. directionToPoint,
  12906. vertices,
  12907. stride,
  12908. center,
  12909. result
  12910. );
  12911. };
  12912. EllipsoidalOccluder.prototype.computeHorizonCullingPointFromVerticesPossiblyUnderEllipsoid = function(directionToPoint, vertices, stride, center, minimumHeight, result) {
  12913. const possiblyShrunkEllipsoid = getPossiblyShrunkEllipsoid(
  12914. this._ellipsoid,
  12915. minimumHeight,
  12916. scratchEllipsoidShrunk
  12917. );
  12918. return computeHorizonCullingPointFromVertices(
  12919. possiblyShrunkEllipsoid,
  12920. directionToPoint,
  12921. vertices,
  12922. stride,
  12923. center,
  12924. result
  12925. );
  12926. };
  12927. var subsampleScratch = [];
  12928. EllipsoidalOccluder.prototype.computeHorizonCullingPointFromRectangle = function(rectangle, ellipsoid, result) {
  12929. Check_default.typeOf.object("rectangle", rectangle);
  12930. const positions = Rectangle_default.subsample(
  12931. rectangle,
  12932. ellipsoid,
  12933. 0,
  12934. subsampleScratch
  12935. );
  12936. const bs = BoundingSphere_default.fromPoints(positions);
  12937. if (Cartesian3_default.magnitude(bs.center) < 0.1 * ellipsoid.minimumRadius) {
  12938. return void 0;
  12939. }
  12940. return this.computeHorizonCullingPoint(bs.center, positions, result);
  12941. };
  12942. var scratchEllipsoidShrunkRadii = new Cartesian3_default();
  12943. function getPossiblyShrunkEllipsoid(ellipsoid, minimumHeight, result) {
  12944. if (defined_default(minimumHeight) && minimumHeight < 0 && ellipsoid.minimumRadius > -minimumHeight) {
  12945. const ellipsoidShrunkRadii = Cartesian3_default.fromElements(
  12946. ellipsoid.radii.x + minimumHeight,
  12947. ellipsoid.radii.y + minimumHeight,
  12948. ellipsoid.radii.z + minimumHeight,
  12949. scratchEllipsoidShrunkRadii
  12950. );
  12951. ellipsoid = Ellipsoid_default.fromCartesian3(ellipsoidShrunkRadii, result);
  12952. }
  12953. return ellipsoid;
  12954. }
  12955. function computeHorizonCullingPointFromPositions(ellipsoid, directionToPoint, positions, result) {
  12956. Check_default.typeOf.object("directionToPoint", directionToPoint);
  12957. Check_default.defined("positions", positions);
  12958. if (!defined_default(result)) {
  12959. result = new Cartesian3_default();
  12960. }
  12961. const scaledSpaceDirectionToPoint = computeScaledSpaceDirectionToPoint(
  12962. ellipsoid,
  12963. directionToPoint
  12964. );
  12965. let resultMagnitude = 0;
  12966. for (let i2 = 0, len = positions.length; i2 < len; ++i2) {
  12967. const position = positions[i2];
  12968. const candidateMagnitude = computeMagnitude(
  12969. ellipsoid,
  12970. position,
  12971. scaledSpaceDirectionToPoint
  12972. );
  12973. if (candidateMagnitude < 0) {
  12974. return void 0;
  12975. }
  12976. resultMagnitude = Math.max(resultMagnitude, candidateMagnitude);
  12977. }
  12978. return magnitudeToPoint(scaledSpaceDirectionToPoint, resultMagnitude, result);
  12979. }
  12980. var positionScratch = new Cartesian3_default();
  12981. function computeHorizonCullingPointFromVertices(ellipsoid, directionToPoint, vertices, stride, center, result) {
  12982. Check_default.typeOf.object("directionToPoint", directionToPoint);
  12983. Check_default.defined("vertices", vertices);
  12984. Check_default.typeOf.number("stride", stride);
  12985. if (!defined_default(result)) {
  12986. result = new Cartesian3_default();
  12987. }
  12988. stride = defaultValue_default(stride, 3);
  12989. center = defaultValue_default(center, Cartesian3_default.ZERO);
  12990. const scaledSpaceDirectionToPoint = computeScaledSpaceDirectionToPoint(
  12991. ellipsoid,
  12992. directionToPoint
  12993. );
  12994. let resultMagnitude = 0;
  12995. for (let i2 = 0, len = vertices.length; i2 < len; i2 += stride) {
  12996. positionScratch.x = vertices[i2] + center.x;
  12997. positionScratch.y = vertices[i2 + 1] + center.y;
  12998. positionScratch.z = vertices[i2 + 2] + center.z;
  12999. const candidateMagnitude = computeMagnitude(
  13000. ellipsoid,
  13001. positionScratch,
  13002. scaledSpaceDirectionToPoint
  13003. );
  13004. if (candidateMagnitude < 0) {
  13005. return void 0;
  13006. }
  13007. resultMagnitude = Math.max(resultMagnitude, candidateMagnitude);
  13008. }
  13009. return magnitudeToPoint(scaledSpaceDirectionToPoint, resultMagnitude, result);
  13010. }
  13011. function isScaledSpacePointVisible(occludeeScaledSpacePosition, cameraPositionInScaledSpace, distanceToLimbInScaledSpaceSquared) {
  13012. const cv = cameraPositionInScaledSpace;
  13013. const vhMagnitudeSquared = distanceToLimbInScaledSpaceSquared;
  13014. const vt = Cartesian3_default.subtract(
  13015. occludeeScaledSpacePosition,
  13016. cv,
  13017. scratchCartesian
  13018. );
  13019. const vtDotVc = -Cartesian3_default.dot(vt, cv);
  13020. const isOccluded = vhMagnitudeSquared < 0 ? vtDotVc > 0 : vtDotVc > vhMagnitudeSquared && vtDotVc * vtDotVc / Cartesian3_default.magnitudeSquared(vt) > vhMagnitudeSquared;
  13021. return !isOccluded;
  13022. }
  13023. var scaledSpaceScratch = new Cartesian3_default();
  13024. var directionScratch = new Cartesian3_default();
  13025. function computeMagnitude(ellipsoid, position, scaledSpaceDirectionToPoint) {
  13026. const scaledSpacePosition = ellipsoid.transformPositionToScaledSpace(
  13027. position,
  13028. scaledSpaceScratch
  13029. );
  13030. let magnitudeSquared = Cartesian3_default.magnitudeSquared(scaledSpacePosition);
  13031. let magnitude = Math.sqrt(magnitudeSquared);
  13032. const direction2 = Cartesian3_default.divideByScalar(
  13033. scaledSpacePosition,
  13034. magnitude,
  13035. directionScratch
  13036. );
  13037. magnitudeSquared = Math.max(1, magnitudeSquared);
  13038. magnitude = Math.max(1, magnitude);
  13039. const cosAlpha = Cartesian3_default.dot(direction2, scaledSpaceDirectionToPoint);
  13040. const sinAlpha = Cartesian3_default.magnitude(
  13041. Cartesian3_default.cross(direction2, scaledSpaceDirectionToPoint, direction2)
  13042. );
  13043. const cosBeta = 1 / magnitude;
  13044. const sinBeta = Math.sqrt(magnitudeSquared - 1) * cosBeta;
  13045. return 1 / (cosAlpha * cosBeta - sinAlpha * sinBeta);
  13046. }
  13047. function magnitudeToPoint(scaledSpaceDirectionToPoint, resultMagnitude, result) {
  13048. if (resultMagnitude <= 0 || resultMagnitude === 1 / 0 || resultMagnitude !== resultMagnitude) {
  13049. return void 0;
  13050. }
  13051. return Cartesian3_default.multiplyByScalar(
  13052. scaledSpaceDirectionToPoint,
  13053. resultMagnitude,
  13054. result
  13055. );
  13056. }
  13057. var directionToPointScratch = new Cartesian3_default();
  13058. function computeScaledSpaceDirectionToPoint(ellipsoid, directionToPoint) {
  13059. if (Cartesian3_default.equals(directionToPoint, Cartesian3_default.ZERO)) {
  13060. return directionToPoint;
  13061. }
  13062. ellipsoid.transformPositionToScaledSpace(
  13063. directionToPoint,
  13064. directionToPointScratch
  13065. );
  13066. return Cartesian3_default.normalize(directionToPointScratch, directionToPointScratch);
  13067. }
  13068. var EllipsoidalOccluder_default = EllipsoidalOccluder;
  13069. // node_modules/cesium/Source/Core/QuadraticRealPolynomial.js
  13070. var QuadraticRealPolynomial = {};
  13071. QuadraticRealPolynomial.computeDiscriminant = function(a4, b, c14) {
  13072. if (typeof a4 !== "number") {
  13073. throw new DeveloperError_default("a is a required number.");
  13074. }
  13075. if (typeof b !== "number") {
  13076. throw new DeveloperError_default("b is a required number.");
  13077. }
  13078. if (typeof c14 !== "number") {
  13079. throw new DeveloperError_default("c is a required number.");
  13080. }
  13081. const discriminant = b * b - 4 * a4 * c14;
  13082. return discriminant;
  13083. };
  13084. function addWithCancellationCheck(left, right, tolerance) {
  13085. const difference = left + right;
  13086. if (Math_default.sign(left) !== Math_default.sign(right) && Math.abs(difference / Math.max(Math.abs(left), Math.abs(right))) < tolerance) {
  13087. return 0;
  13088. }
  13089. return difference;
  13090. }
  13091. QuadraticRealPolynomial.computeRealRoots = function(a4, b, c14) {
  13092. if (typeof a4 !== "number") {
  13093. throw new DeveloperError_default("a is a required number.");
  13094. }
  13095. if (typeof b !== "number") {
  13096. throw new DeveloperError_default("b is a required number.");
  13097. }
  13098. if (typeof c14 !== "number") {
  13099. throw new DeveloperError_default("c is a required number.");
  13100. }
  13101. let ratio;
  13102. if (a4 === 0) {
  13103. if (b === 0) {
  13104. return [];
  13105. }
  13106. return [-c14 / b];
  13107. } else if (b === 0) {
  13108. if (c14 === 0) {
  13109. return [0, 0];
  13110. }
  13111. const cMagnitude = Math.abs(c14);
  13112. const aMagnitude = Math.abs(a4);
  13113. if (cMagnitude < aMagnitude && cMagnitude / aMagnitude < Math_default.EPSILON14) {
  13114. return [0, 0];
  13115. } else if (cMagnitude > aMagnitude && aMagnitude / cMagnitude < Math_default.EPSILON14) {
  13116. return [];
  13117. }
  13118. ratio = -c14 / a4;
  13119. if (ratio < 0) {
  13120. return [];
  13121. }
  13122. const root = Math.sqrt(ratio);
  13123. return [-root, root];
  13124. } else if (c14 === 0) {
  13125. ratio = -b / a4;
  13126. if (ratio < 0) {
  13127. return [ratio, 0];
  13128. }
  13129. return [0, ratio];
  13130. }
  13131. const b2 = b * b;
  13132. const four_ac = 4 * a4 * c14;
  13133. const radicand = addWithCancellationCheck(b2, -four_ac, Math_default.EPSILON14);
  13134. if (radicand < 0) {
  13135. return [];
  13136. }
  13137. const q = -0.5 * addWithCancellationCheck(
  13138. b,
  13139. Math_default.sign(b) * Math.sqrt(radicand),
  13140. Math_default.EPSILON14
  13141. );
  13142. if (b > 0) {
  13143. return [q / a4, c14 / q];
  13144. }
  13145. return [c14 / q, q / a4];
  13146. };
  13147. var QuadraticRealPolynomial_default = QuadraticRealPolynomial;
  13148. // node_modules/cesium/Source/Core/CubicRealPolynomial.js
  13149. var CubicRealPolynomial = {};
  13150. CubicRealPolynomial.computeDiscriminant = function(a4, b, c14, d) {
  13151. if (typeof a4 !== "number") {
  13152. throw new DeveloperError_default("a is a required number.");
  13153. }
  13154. if (typeof b !== "number") {
  13155. throw new DeveloperError_default("b is a required number.");
  13156. }
  13157. if (typeof c14 !== "number") {
  13158. throw new DeveloperError_default("c is a required number.");
  13159. }
  13160. if (typeof d !== "number") {
  13161. throw new DeveloperError_default("d is a required number.");
  13162. }
  13163. const a22 = a4 * a4;
  13164. const b2 = b * b;
  13165. const c22 = c14 * c14;
  13166. const d2 = d * d;
  13167. const discriminant = 18 * a4 * b * c14 * d + b2 * c22 - 27 * a22 * d2 - 4 * (a4 * c22 * c14 + b2 * b * d);
  13168. return discriminant;
  13169. };
  13170. function computeRealRoots(a4, b, c14, d) {
  13171. const A = a4;
  13172. const B = b / 3;
  13173. const C = c14 / 3;
  13174. const D = d;
  13175. const AC = A * C;
  13176. const BD = B * D;
  13177. const B2 = B * B;
  13178. const C2 = C * C;
  13179. const delta1 = A * C - B2;
  13180. const delta2 = A * D - B * C;
  13181. const delta3 = B * D - C2;
  13182. const discriminant = 4 * delta1 * delta3 - delta2 * delta2;
  13183. let temp;
  13184. let temp1;
  13185. if (discriminant < 0) {
  13186. let ABar;
  13187. let CBar;
  13188. let DBar;
  13189. if (B2 * BD >= AC * C2) {
  13190. ABar = A;
  13191. CBar = delta1;
  13192. DBar = -2 * B * delta1 + A * delta2;
  13193. } else {
  13194. ABar = D;
  13195. CBar = delta3;
  13196. DBar = -D * delta2 + 2 * C * delta3;
  13197. }
  13198. const s2 = DBar < 0 ? -1 : 1;
  13199. const temp0 = -s2 * Math.abs(ABar) * Math.sqrt(-discriminant);
  13200. temp1 = -DBar + temp0;
  13201. const x = temp1 / 2;
  13202. const p2 = x < 0 ? -Math.pow(-x, 1 / 3) : Math.pow(x, 1 / 3);
  13203. const q = temp1 === temp0 ? -p2 : -CBar / p2;
  13204. temp = CBar <= 0 ? p2 + q : -DBar / (p2 * p2 + q * q + CBar);
  13205. if (B2 * BD >= AC * C2) {
  13206. return [(temp - B) / A];
  13207. }
  13208. return [-D / (temp + C)];
  13209. }
  13210. const CBarA = delta1;
  13211. const DBarA = -2 * B * delta1 + A * delta2;
  13212. const CBarD = delta3;
  13213. const DBarD = -D * delta2 + 2 * C * delta3;
  13214. const squareRootOfDiscriminant = Math.sqrt(discriminant);
  13215. const halfSquareRootOf3 = Math.sqrt(3) / 2;
  13216. let theta = Math.abs(Math.atan2(A * squareRootOfDiscriminant, -DBarA) / 3);
  13217. temp = 2 * Math.sqrt(-CBarA);
  13218. let cosine = Math.cos(theta);
  13219. temp1 = temp * cosine;
  13220. let temp3 = temp * (-cosine / 2 - halfSquareRootOf3 * Math.sin(theta));
  13221. const numeratorLarge = temp1 + temp3 > 2 * B ? temp1 - B : temp3 - B;
  13222. const denominatorLarge = A;
  13223. const root1 = numeratorLarge / denominatorLarge;
  13224. theta = Math.abs(Math.atan2(D * squareRootOfDiscriminant, -DBarD) / 3);
  13225. temp = 2 * Math.sqrt(-CBarD);
  13226. cosine = Math.cos(theta);
  13227. temp1 = temp * cosine;
  13228. temp3 = temp * (-cosine / 2 - halfSquareRootOf3 * Math.sin(theta));
  13229. const numeratorSmall = -D;
  13230. const denominatorSmall = temp1 + temp3 < 2 * C ? temp1 + C : temp3 + C;
  13231. const root3 = numeratorSmall / denominatorSmall;
  13232. const E = denominatorLarge * denominatorSmall;
  13233. const F = -numeratorLarge * denominatorSmall - denominatorLarge * numeratorSmall;
  13234. const G = numeratorLarge * numeratorSmall;
  13235. const root2 = (C * F - B * G) / (-B * F + C * E);
  13236. if (root1 <= root2) {
  13237. if (root1 <= root3) {
  13238. if (root2 <= root3) {
  13239. return [root1, root2, root3];
  13240. }
  13241. return [root1, root3, root2];
  13242. }
  13243. return [root3, root1, root2];
  13244. }
  13245. if (root1 <= root3) {
  13246. return [root2, root1, root3];
  13247. }
  13248. if (root2 <= root3) {
  13249. return [root2, root3, root1];
  13250. }
  13251. return [root3, root2, root1];
  13252. }
  13253. CubicRealPolynomial.computeRealRoots = function(a4, b, c14, d) {
  13254. if (typeof a4 !== "number") {
  13255. throw new DeveloperError_default("a is a required number.");
  13256. }
  13257. if (typeof b !== "number") {
  13258. throw new DeveloperError_default("b is a required number.");
  13259. }
  13260. if (typeof c14 !== "number") {
  13261. throw new DeveloperError_default("c is a required number.");
  13262. }
  13263. if (typeof d !== "number") {
  13264. throw new DeveloperError_default("d is a required number.");
  13265. }
  13266. let roots;
  13267. let ratio;
  13268. if (a4 === 0) {
  13269. return QuadraticRealPolynomial_default.computeRealRoots(b, c14, d);
  13270. } else if (b === 0) {
  13271. if (c14 === 0) {
  13272. if (d === 0) {
  13273. return [0, 0, 0];
  13274. }
  13275. ratio = -d / a4;
  13276. const root = ratio < 0 ? -Math.pow(-ratio, 1 / 3) : Math.pow(ratio, 1 / 3);
  13277. return [root, root, root];
  13278. } else if (d === 0) {
  13279. roots = QuadraticRealPolynomial_default.computeRealRoots(a4, 0, c14);
  13280. if (roots.Length === 0) {
  13281. return [0];
  13282. }
  13283. return [roots[0], 0, roots[1]];
  13284. }
  13285. return computeRealRoots(a4, 0, c14, d);
  13286. } else if (c14 === 0) {
  13287. if (d === 0) {
  13288. ratio = -b / a4;
  13289. if (ratio < 0) {
  13290. return [ratio, 0, 0];
  13291. }
  13292. return [0, 0, ratio];
  13293. }
  13294. return computeRealRoots(a4, b, 0, d);
  13295. } else if (d === 0) {
  13296. roots = QuadraticRealPolynomial_default.computeRealRoots(a4, b, c14);
  13297. if (roots.length === 0) {
  13298. return [0];
  13299. } else if (roots[1] <= 0) {
  13300. return [roots[0], roots[1], 0];
  13301. } else if (roots[0] >= 0) {
  13302. return [0, roots[0], roots[1]];
  13303. }
  13304. return [roots[0], 0, roots[1]];
  13305. }
  13306. return computeRealRoots(a4, b, c14, d);
  13307. };
  13308. var CubicRealPolynomial_default = CubicRealPolynomial;
  13309. // node_modules/cesium/Source/Core/QuarticRealPolynomial.js
  13310. var QuarticRealPolynomial = {};
  13311. QuarticRealPolynomial.computeDiscriminant = function(a4, b, c14, d, e2) {
  13312. if (typeof a4 !== "number") {
  13313. throw new DeveloperError_default("a is a required number.");
  13314. }
  13315. if (typeof b !== "number") {
  13316. throw new DeveloperError_default("b is a required number.");
  13317. }
  13318. if (typeof c14 !== "number") {
  13319. throw new DeveloperError_default("c is a required number.");
  13320. }
  13321. if (typeof d !== "number") {
  13322. throw new DeveloperError_default("d is a required number.");
  13323. }
  13324. if (typeof e2 !== "number") {
  13325. throw new DeveloperError_default("e is a required number.");
  13326. }
  13327. const a22 = a4 * a4;
  13328. const a32 = a22 * a4;
  13329. const b2 = b * b;
  13330. const b3 = b2 * b;
  13331. const c22 = c14 * c14;
  13332. const c33 = c22 * c14;
  13333. const d2 = d * d;
  13334. const d3 = d2 * d;
  13335. const e22 = e2 * e2;
  13336. const e3 = e22 * e2;
  13337. const discriminant = b2 * c22 * d2 - 4 * b3 * d3 - 4 * a4 * c33 * d2 + 18 * a4 * b * c14 * d3 - 27 * a22 * d2 * d2 + 256 * a32 * e3 + e2 * (18 * b3 * c14 * d - 4 * b2 * c33 + 16 * a4 * c22 * c22 - 80 * a4 * b * c22 * d - 6 * a4 * b2 * d2 + 144 * a22 * c14 * d2) + e22 * (144 * a4 * b2 * c14 - 27 * b2 * b2 - 128 * a22 * c22 - 192 * a22 * b * d);
  13338. return discriminant;
  13339. };
  13340. function original(a32, a22, a1, a0) {
  13341. const a3Squared = a32 * a32;
  13342. const p2 = a22 - 3 * a3Squared / 8;
  13343. const q = a1 - a22 * a32 / 2 + a3Squared * a32 / 8;
  13344. const r2 = a0 - a1 * a32 / 4 + a22 * a3Squared / 16 - 3 * a3Squared * a3Squared / 256;
  13345. const cubicRoots = CubicRealPolynomial_default.computeRealRoots(
  13346. 1,
  13347. 2 * p2,
  13348. p2 * p2 - 4 * r2,
  13349. -q * q
  13350. );
  13351. if (cubicRoots.length > 0) {
  13352. const temp = -a32 / 4;
  13353. const hSquared = cubicRoots[cubicRoots.length - 1];
  13354. if (Math.abs(hSquared) < Math_default.EPSILON14) {
  13355. const roots = QuadraticRealPolynomial_default.computeRealRoots(1, p2, r2);
  13356. if (roots.length === 2) {
  13357. const root0 = roots[0];
  13358. const root1 = roots[1];
  13359. let y;
  13360. if (root0 >= 0 && root1 >= 0) {
  13361. const y0 = Math.sqrt(root0);
  13362. const y1 = Math.sqrt(root1);
  13363. return [temp - y1, temp - y0, temp + y0, temp + y1];
  13364. } else if (root0 >= 0 && root1 < 0) {
  13365. y = Math.sqrt(root0);
  13366. return [temp - y, temp + y];
  13367. } else if (root0 < 0 && root1 >= 0) {
  13368. y = Math.sqrt(root1);
  13369. return [temp - y, temp + y];
  13370. }
  13371. }
  13372. return [];
  13373. } else if (hSquared > 0) {
  13374. const h = Math.sqrt(hSquared);
  13375. const m = (p2 + hSquared - q / h) / 2;
  13376. const n2 = (p2 + hSquared + q / h) / 2;
  13377. const roots1 = QuadraticRealPolynomial_default.computeRealRoots(1, h, m);
  13378. const roots2 = QuadraticRealPolynomial_default.computeRealRoots(1, -h, n2);
  13379. if (roots1.length !== 0) {
  13380. roots1[0] += temp;
  13381. roots1[1] += temp;
  13382. if (roots2.length !== 0) {
  13383. roots2[0] += temp;
  13384. roots2[1] += temp;
  13385. if (roots1[1] <= roots2[0]) {
  13386. return [roots1[0], roots1[1], roots2[0], roots2[1]];
  13387. } else if (roots2[1] <= roots1[0]) {
  13388. return [roots2[0], roots2[1], roots1[0], roots1[1]];
  13389. } else if (roots1[0] >= roots2[0] && roots1[1] <= roots2[1]) {
  13390. return [roots2[0], roots1[0], roots1[1], roots2[1]];
  13391. } else if (roots2[0] >= roots1[0] && roots2[1] <= roots1[1]) {
  13392. return [roots1[0], roots2[0], roots2[1], roots1[1]];
  13393. } else if (roots1[0] > roots2[0] && roots1[0] < roots2[1]) {
  13394. return [roots2[0], roots1[0], roots2[1], roots1[1]];
  13395. }
  13396. return [roots1[0], roots2[0], roots1[1], roots2[1]];
  13397. }
  13398. return roots1;
  13399. }
  13400. if (roots2.length !== 0) {
  13401. roots2[0] += temp;
  13402. roots2[1] += temp;
  13403. return roots2;
  13404. }
  13405. return [];
  13406. }
  13407. }
  13408. return [];
  13409. }
  13410. function neumark(a32, a22, a1, a0) {
  13411. const a1Squared = a1 * a1;
  13412. const a2Squared = a22 * a22;
  13413. const a3Squared = a32 * a32;
  13414. const p2 = -2 * a22;
  13415. const q = a1 * a32 + a2Squared - 4 * a0;
  13416. const r2 = a3Squared * a0 - a1 * a22 * a32 + a1Squared;
  13417. const cubicRoots = CubicRealPolynomial_default.computeRealRoots(1, p2, q, r2);
  13418. if (cubicRoots.length > 0) {
  13419. const y = cubicRoots[0];
  13420. const temp = a22 - y;
  13421. const tempSquared = temp * temp;
  13422. const g1 = a32 / 2;
  13423. const h1 = temp / 2;
  13424. const m = tempSquared - 4 * a0;
  13425. const mError = tempSquared + 4 * Math.abs(a0);
  13426. const n2 = a3Squared - 4 * y;
  13427. const nError = a3Squared + 4 * Math.abs(y);
  13428. let g2;
  13429. let h2;
  13430. if (y < 0 || m * nError < n2 * mError) {
  13431. const squareRootOfN = Math.sqrt(n2);
  13432. g2 = squareRootOfN / 2;
  13433. h2 = squareRootOfN === 0 ? 0 : (a32 * h1 - a1) / squareRootOfN;
  13434. } else {
  13435. const squareRootOfM = Math.sqrt(m);
  13436. g2 = squareRootOfM === 0 ? 0 : (a32 * h1 - a1) / squareRootOfM;
  13437. h2 = squareRootOfM / 2;
  13438. }
  13439. let G;
  13440. let g;
  13441. if (g1 === 0 && g2 === 0) {
  13442. G = 0;
  13443. g = 0;
  13444. } else if (Math_default.sign(g1) === Math_default.sign(g2)) {
  13445. G = g1 + g2;
  13446. g = y / G;
  13447. } else {
  13448. g = g1 - g2;
  13449. G = y / g;
  13450. }
  13451. let H;
  13452. let h;
  13453. if (h1 === 0 && h2 === 0) {
  13454. H = 0;
  13455. h = 0;
  13456. } else if (Math_default.sign(h1) === Math_default.sign(h2)) {
  13457. H = h1 + h2;
  13458. h = a0 / H;
  13459. } else {
  13460. h = h1 - h2;
  13461. H = a0 / h;
  13462. }
  13463. const roots1 = QuadraticRealPolynomial_default.computeRealRoots(1, G, H);
  13464. const roots2 = QuadraticRealPolynomial_default.computeRealRoots(1, g, h);
  13465. if (roots1.length !== 0) {
  13466. if (roots2.length !== 0) {
  13467. if (roots1[1] <= roots2[0]) {
  13468. return [roots1[0], roots1[1], roots2[0], roots2[1]];
  13469. } else if (roots2[1] <= roots1[0]) {
  13470. return [roots2[0], roots2[1], roots1[0], roots1[1]];
  13471. } else if (roots1[0] >= roots2[0] && roots1[1] <= roots2[1]) {
  13472. return [roots2[0], roots1[0], roots1[1], roots2[1]];
  13473. } else if (roots2[0] >= roots1[0] && roots2[1] <= roots1[1]) {
  13474. return [roots1[0], roots2[0], roots2[1], roots1[1]];
  13475. } else if (roots1[0] > roots2[0] && roots1[0] < roots2[1]) {
  13476. return [roots2[0], roots1[0], roots2[1], roots1[1]];
  13477. }
  13478. return [roots1[0], roots2[0], roots1[1], roots2[1]];
  13479. }
  13480. return roots1;
  13481. }
  13482. if (roots2.length !== 0) {
  13483. return roots2;
  13484. }
  13485. }
  13486. return [];
  13487. }
  13488. QuarticRealPolynomial.computeRealRoots = function(a4, b, c14, d, e2) {
  13489. if (typeof a4 !== "number") {
  13490. throw new DeveloperError_default("a is a required number.");
  13491. }
  13492. if (typeof b !== "number") {
  13493. throw new DeveloperError_default("b is a required number.");
  13494. }
  13495. if (typeof c14 !== "number") {
  13496. throw new DeveloperError_default("c is a required number.");
  13497. }
  13498. if (typeof d !== "number") {
  13499. throw new DeveloperError_default("d is a required number.");
  13500. }
  13501. if (typeof e2 !== "number") {
  13502. throw new DeveloperError_default("e is a required number.");
  13503. }
  13504. if (Math.abs(a4) < Math_default.EPSILON15) {
  13505. return CubicRealPolynomial_default.computeRealRoots(b, c14, d, e2);
  13506. }
  13507. const a32 = b / a4;
  13508. const a22 = c14 / a4;
  13509. const a1 = d / a4;
  13510. const a0 = e2 / a4;
  13511. let k = a32 < 0 ? 1 : 0;
  13512. k += a22 < 0 ? k + 1 : k;
  13513. k += a1 < 0 ? k + 1 : k;
  13514. k += a0 < 0 ? k + 1 : k;
  13515. switch (k) {
  13516. case 0:
  13517. return original(a32, a22, a1, a0);
  13518. case 1:
  13519. return neumark(a32, a22, a1, a0);
  13520. case 2:
  13521. return neumark(a32, a22, a1, a0);
  13522. case 3:
  13523. return original(a32, a22, a1, a0);
  13524. case 4:
  13525. return original(a32, a22, a1, a0);
  13526. case 5:
  13527. return neumark(a32, a22, a1, a0);
  13528. case 6:
  13529. return original(a32, a22, a1, a0);
  13530. case 7:
  13531. return original(a32, a22, a1, a0);
  13532. case 8:
  13533. return neumark(a32, a22, a1, a0);
  13534. case 9:
  13535. return original(a32, a22, a1, a0);
  13536. case 10:
  13537. return original(a32, a22, a1, a0);
  13538. case 11:
  13539. return neumark(a32, a22, a1, a0);
  13540. case 12:
  13541. return original(a32, a22, a1, a0);
  13542. case 13:
  13543. return original(a32, a22, a1, a0);
  13544. case 14:
  13545. return original(a32, a22, a1, a0);
  13546. case 15:
  13547. return original(a32, a22, a1, a0);
  13548. default:
  13549. return void 0;
  13550. }
  13551. };
  13552. var QuarticRealPolynomial_default = QuarticRealPolynomial;
  13553. // node_modules/cesium/Source/Core/Ray.js
  13554. function Ray(origin, direction2) {
  13555. direction2 = Cartesian3_default.clone(defaultValue_default(direction2, Cartesian3_default.ZERO));
  13556. if (!Cartesian3_default.equals(direction2, Cartesian3_default.ZERO)) {
  13557. Cartesian3_default.normalize(direction2, direction2);
  13558. }
  13559. this.origin = Cartesian3_default.clone(defaultValue_default(origin, Cartesian3_default.ZERO));
  13560. this.direction = direction2;
  13561. }
  13562. Ray.clone = function(ray, result) {
  13563. if (!defined_default(ray)) {
  13564. return void 0;
  13565. }
  13566. if (!defined_default(result)) {
  13567. return new Ray(ray.origin, ray.direction);
  13568. }
  13569. result.origin = Cartesian3_default.clone(ray.origin);
  13570. result.direction = Cartesian3_default.clone(ray.direction);
  13571. return result;
  13572. };
  13573. Ray.getPoint = function(ray, t, result) {
  13574. Check_default.typeOf.object("ray", ray);
  13575. Check_default.typeOf.number("t", t);
  13576. if (!defined_default(result)) {
  13577. result = new Cartesian3_default();
  13578. }
  13579. result = Cartesian3_default.multiplyByScalar(ray.direction, t, result);
  13580. return Cartesian3_default.add(ray.origin, result, result);
  13581. };
  13582. var Ray_default = Ray;
  13583. // node_modules/cesium/Source/Core/IntersectionTests.js
  13584. var IntersectionTests = {};
  13585. IntersectionTests.rayPlane = function(ray, plane, result) {
  13586. if (!defined_default(ray)) {
  13587. throw new DeveloperError_default("ray is required.");
  13588. }
  13589. if (!defined_default(plane)) {
  13590. throw new DeveloperError_default("plane is required.");
  13591. }
  13592. if (!defined_default(result)) {
  13593. result = new Cartesian3_default();
  13594. }
  13595. const origin = ray.origin;
  13596. const direction2 = ray.direction;
  13597. const normal2 = plane.normal;
  13598. const denominator = Cartesian3_default.dot(normal2, direction2);
  13599. if (Math.abs(denominator) < Math_default.EPSILON15) {
  13600. return void 0;
  13601. }
  13602. const t = (-plane.distance - Cartesian3_default.dot(normal2, origin)) / denominator;
  13603. if (t < 0) {
  13604. return void 0;
  13605. }
  13606. result = Cartesian3_default.multiplyByScalar(direction2, t, result);
  13607. return Cartesian3_default.add(origin, result, result);
  13608. };
  13609. var scratchEdge0 = new Cartesian3_default();
  13610. var scratchEdge1 = new Cartesian3_default();
  13611. var scratchPVec = new Cartesian3_default();
  13612. var scratchTVec = new Cartesian3_default();
  13613. var scratchQVec = new Cartesian3_default();
  13614. IntersectionTests.rayTriangleParametric = function(ray, p0, p1, p2, cullBackFaces) {
  13615. if (!defined_default(ray)) {
  13616. throw new DeveloperError_default("ray is required.");
  13617. }
  13618. if (!defined_default(p0)) {
  13619. throw new DeveloperError_default("p0 is required.");
  13620. }
  13621. if (!defined_default(p1)) {
  13622. throw new DeveloperError_default("p1 is required.");
  13623. }
  13624. if (!defined_default(p2)) {
  13625. throw new DeveloperError_default("p2 is required.");
  13626. }
  13627. cullBackFaces = defaultValue_default(cullBackFaces, false);
  13628. const origin = ray.origin;
  13629. const direction2 = ray.direction;
  13630. const edge0 = Cartesian3_default.subtract(p1, p0, scratchEdge0);
  13631. const edge1 = Cartesian3_default.subtract(p2, p0, scratchEdge1);
  13632. const p3 = Cartesian3_default.cross(direction2, edge1, scratchPVec);
  13633. const det = Cartesian3_default.dot(edge0, p3);
  13634. let tvec;
  13635. let q;
  13636. let u3;
  13637. let v7;
  13638. let t;
  13639. if (cullBackFaces) {
  13640. if (det < Math_default.EPSILON6) {
  13641. return void 0;
  13642. }
  13643. tvec = Cartesian3_default.subtract(origin, p0, scratchTVec);
  13644. u3 = Cartesian3_default.dot(tvec, p3);
  13645. if (u3 < 0 || u3 > det) {
  13646. return void 0;
  13647. }
  13648. q = Cartesian3_default.cross(tvec, edge0, scratchQVec);
  13649. v7 = Cartesian3_default.dot(direction2, q);
  13650. if (v7 < 0 || u3 + v7 > det) {
  13651. return void 0;
  13652. }
  13653. t = Cartesian3_default.dot(edge1, q) / det;
  13654. } else {
  13655. if (Math.abs(det) < Math_default.EPSILON6) {
  13656. return void 0;
  13657. }
  13658. const invDet = 1 / det;
  13659. tvec = Cartesian3_default.subtract(origin, p0, scratchTVec);
  13660. u3 = Cartesian3_default.dot(tvec, p3) * invDet;
  13661. if (u3 < 0 || u3 > 1) {
  13662. return void 0;
  13663. }
  13664. q = Cartesian3_default.cross(tvec, edge0, scratchQVec);
  13665. v7 = Cartesian3_default.dot(direction2, q) * invDet;
  13666. if (v7 < 0 || u3 + v7 > 1) {
  13667. return void 0;
  13668. }
  13669. t = Cartesian3_default.dot(edge1, q) * invDet;
  13670. }
  13671. return t;
  13672. };
  13673. IntersectionTests.rayTriangle = function(ray, p0, p1, p2, cullBackFaces, result) {
  13674. const t = IntersectionTests.rayTriangleParametric(
  13675. ray,
  13676. p0,
  13677. p1,
  13678. p2,
  13679. cullBackFaces
  13680. );
  13681. if (!defined_default(t) || t < 0) {
  13682. return void 0;
  13683. }
  13684. if (!defined_default(result)) {
  13685. result = new Cartesian3_default();
  13686. }
  13687. Cartesian3_default.multiplyByScalar(ray.direction, t, result);
  13688. return Cartesian3_default.add(ray.origin, result, result);
  13689. };
  13690. var scratchLineSegmentTriangleRay = new Ray_default();
  13691. IntersectionTests.lineSegmentTriangle = function(v02, v13, p0, p1, p2, cullBackFaces, result) {
  13692. if (!defined_default(v02)) {
  13693. throw new DeveloperError_default("v0 is required.");
  13694. }
  13695. if (!defined_default(v13)) {
  13696. throw new DeveloperError_default("v1 is required.");
  13697. }
  13698. if (!defined_default(p0)) {
  13699. throw new DeveloperError_default("p0 is required.");
  13700. }
  13701. if (!defined_default(p1)) {
  13702. throw new DeveloperError_default("p1 is required.");
  13703. }
  13704. if (!defined_default(p2)) {
  13705. throw new DeveloperError_default("p2 is required.");
  13706. }
  13707. const ray = scratchLineSegmentTriangleRay;
  13708. Cartesian3_default.clone(v02, ray.origin);
  13709. Cartesian3_default.subtract(v13, v02, ray.direction);
  13710. Cartesian3_default.normalize(ray.direction, ray.direction);
  13711. const t = IntersectionTests.rayTriangleParametric(
  13712. ray,
  13713. p0,
  13714. p1,
  13715. p2,
  13716. cullBackFaces
  13717. );
  13718. if (!defined_default(t) || t < 0 || t > Cartesian3_default.distance(v02, v13)) {
  13719. return void 0;
  13720. }
  13721. if (!defined_default(result)) {
  13722. result = new Cartesian3_default();
  13723. }
  13724. Cartesian3_default.multiplyByScalar(ray.direction, t, result);
  13725. return Cartesian3_default.add(ray.origin, result, result);
  13726. };
  13727. function solveQuadratic(a4, b, c14, result) {
  13728. const det = b * b - 4 * a4 * c14;
  13729. if (det < 0) {
  13730. return void 0;
  13731. } else if (det > 0) {
  13732. const denom = 1 / (2 * a4);
  13733. const disc = Math.sqrt(det);
  13734. const root0 = (-b + disc) * denom;
  13735. const root1 = (-b - disc) * denom;
  13736. if (root0 < root1) {
  13737. result.root0 = root0;
  13738. result.root1 = root1;
  13739. } else {
  13740. result.root0 = root1;
  13741. result.root1 = root0;
  13742. }
  13743. return result;
  13744. }
  13745. const root = -b / (2 * a4);
  13746. if (root === 0) {
  13747. return void 0;
  13748. }
  13749. result.root0 = result.root1 = root;
  13750. return result;
  13751. }
  13752. var raySphereRoots = {
  13753. root0: 0,
  13754. root1: 0
  13755. };
  13756. function raySphere(ray, sphere, result) {
  13757. if (!defined_default(result)) {
  13758. result = new Interval_default();
  13759. }
  13760. const origin = ray.origin;
  13761. const direction2 = ray.direction;
  13762. const center = sphere.center;
  13763. const radiusSquared = sphere.radius * sphere.radius;
  13764. const diff = Cartesian3_default.subtract(origin, center, scratchPVec);
  13765. const a4 = Cartesian3_default.dot(direction2, direction2);
  13766. const b = 2 * Cartesian3_default.dot(direction2, diff);
  13767. const c14 = Cartesian3_default.magnitudeSquared(diff) - radiusSquared;
  13768. const roots = solveQuadratic(a4, b, c14, raySphereRoots);
  13769. if (!defined_default(roots)) {
  13770. return void 0;
  13771. }
  13772. result.start = roots.root0;
  13773. result.stop = roots.root1;
  13774. return result;
  13775. }
  13776. IntersectionTests.raySphere = function(ray, sphere, result) {
  13777. if (!defined_default(ray)) {
  13778. throw new DeveloperError_default("ray is required.");
  13779. }
  13780. if (!defined_default(sphere)) {
  13781. throw new DeveloperError_default("sphere is required.");
  13782. }
  13783. result = raySphere(ray, sphere, result);
  13784. if (!defined_default(result) || result.stop < 0) {
  13785. return void 0;
  13786. }
  13787. result.start = Math.max(result.start, 0);
  13788. return result;
  13789. };
  13790. var scratchLineSegmentRay = new Ray_default();
  13791. IntersectionTests.lineSegmentSphere = function(p0, p1, sphere, result) {
  13792. if (!defined_default(p0)) {
  13793. throw new DeveloperError_default("p0 is required.");
  13794. }
  13795. if (!defined_default(p1)) {
  13796. throw new DeveloperError_default("p1 is required.");
  13797. }
  13798. if (!defined_default(sphere)) {
  13799. throw new DeveloperError_default("sphere is required.");
  13800. }
  13801. const ray = scratchLineSegmentRay;
  13802. Cartesian3_default.clone(p0, ray.origin);
  13803. const direction2 = Cartesian3_default.subtract(p1, p0, ray.direction);
  13804. const maxT = Cartesian3_default.magnitude(direction2);
  13805. Cartesian3_default.normalize(direction2, direction2);
  13806. result = raySphere(ray, sphere, result);
  13807. if (!defined_default(result) || result.stop < 0 || result.start > maxT) {
  13808. return void 0;
  13809. }
  13810. result.start = Math.max(result.start, 0);
  13811. result.stop = Math.min(result.stop, maxT);
  13812. return result;
  13813. };
  13814. var scratchQ = new Cartesian3_default();
  13815. var scratchW = new Cartesian3_default();
  13816. IntersectionTests.rayEllipsoid = function(ray, ellipsoid) {
  13817. if (!defined_default(ray)) {
  13818. throw new DeveloperError_default("ray is required.");
  13819. }
  13820. if (!defined_default(ellipsoid)) {
  13821. throw new DeveloperError_default("ellipsoid is required.");
  13822. }
  13823. const inverseRadii = ellipsoid.oneOverRadii;
  13824. const q = Cartesian3_default.multiplyComponents(inverseRadii, ray.origin, scratchQ);
  13825. const w = Cartesian3_default.multiplyComponents(
  13826. inverseRadii,
  13827. ray.direction,
  13828. scratchW
  13829. );
  13830. const q22 = Cartesian3_default.magnitudeSquared(q);
  13831. const qw = Cartesian3_default.dot(q, w);
  13832. let difference, w2, product, discriminant, temp;
  13833. if (q22 > 1) {
  13834. if (qw >= 0) {
  13835. return void 0;
  13836. }
  13837. const qw2 = qw * qw;
  13838. difference = q22 - 1;
  13839. w2 = Cartesian3_default.magnitudeSquared(w);
  13840. product = w2 * difference;
  13841. if (qw2 < product) {
  13842. return void 0;
  13843. } else if (qw2 > product) {
  13844. discriminant = qw * qw - product;
  13845. temp = -qw + Math.sqrt(discriminant);
  13846. const root0 = temp / w2;
  13847. const root1 = difference / temp;
  13848. if (root0 < root1) {
  13849. return new Interval_default(root0, root1);
  13850. }
  13851. return {
  13852. start: root1,
  13853. stop: root0
  13854. };
  13855. }
  13856. const root = Math.sqrt(difference / w2);
  13857. return new Interval_default(root, root);
  13858. } else if (q22 < 1) {
  13859. difference = q22 - 1;
  13860. w2 = Cartesian3_default.magnitudeSquared(w);
  13861. product = w2 * difference;
  13862. discriminant = qw * qw - product;
  13863. temp = -qw + Math.sqrt(discriminant);
  13864. return new Interval_default(0, temp / w2);
  13865. }
  13866. if (qw < 0) {
  13867. w2 = Cartesian3_default.magnitudeSquared(w);
  13868. return new Interval_default(0, -qw / w2);
  13869. }
  13870. return void 0;
  13871. };
  13872. function addWithCancellationCheck2(left, right, tolerance) {
  13873. const difference = left + right;
  13874. if (Math_default.sign(left) !== Math_default.sign(right) && Math.abs(difference / Math.max(Math.abs(left), Math.abs(right))) < tolerance) {
  13875. return 0;
  13876. }
  13877. return difference;
  13878. }
  13879. function quadraticVectorExpression(A, b, c14, x, w) {
  13880. const xSquared = x * x;
  13881. const wSquared = w * w;
  13882. const l2 = (A[Matrix3_default.COLUMN1ROW1] - A[Matrix3_default.COLUMN2ROW2]) * wSquared;
  13883. const l1 = w * (x * addWithCancellationCheck2(
  13884. A[Matrix3_default.COLUMN1ROW0],
  13885. A[Matrix3_default.COLUMN0ROW1],
  13886. Math_default.EPSILON15
  13887. ) + b.y);
  13888. const l0 = A[Matrix3_default.COLUMN0ROW0] * xSquared + A[Matrix3_default.COLUMN2ROW2] * wSquared + x * b.x + c14;
  13889. const r1 = wSquared * addWithCancellationCheck2(
  13890. A[Matrix3_default.COLUMN2ROW1],
  13891. A[Matrix3_default.COLUMN1ROW2],
  13892. Math_default.EPSILON15
  13893. );
  13894. const r0 = w * (x * addWithCancellationCheck2(A[Matrix3_default.COLUMN2ROW0], A[Matrix3_default.COLUMN0ROW2]) + b.z);
  13895. let cosines;
  13896. const solutions = [];
  13897. if (r0 === 0 && r1 === 0) {
  13898. cosines = QuadraticRealPolynomial_default.computeRealRoots(l2, l1, l0);
  13899. if (cosines.length === 0) {
  13900. return solutions;
  13901. }
  13902. const cosine0 = cosines[0];
  13903. const sine0 = Math.sqrt(Math.max(1 - cosine0 * cosine0, 0));
  13904. solutions.push(new Cartesian3_default(x, w * cosine0, w * -sine0));
  13905. solutions.push(new Cartesian3_default(x, w * cosine0, w * sine0));
  13906. if (cosines.length === 2) {
  13907. const cosine1 = cosines[1];
  13908. const sine1 = Math.sqrt(Math.max(1 - cosine1 * cosine1, 0));
  13909. solutions.push(new Cartesian3_default(x, w * cosine1, w * -sine1));
  13910. solutions.push(new Cartesian3_default(x, w * cosine1, w * sine1));
  13911. }
  13912. return solutions;
  13913. }
  13914. const r0Squared = r0 * r0;
  13915. const r1Squared = r1 * r1;
  13916. const l2Squared = l2 * l2;
  13917. const r0r1 = r0 * r1;
  13918. const c42 = l2Squared + r1Squared;
  13919. const c33 = 2 * (l1 * l2 + r0r1);
  13920. const c22 = 2 * l0 * l2 + l1 * l1 - r1Squared + r0Squared;
  13921. const c15 = 2 * (l0 * l1 - r0r1);
  13922. const c0 = l0 * l0 - r0Squared;
  13923. if (c42 === 0 && c33 === 0 && c22 === 0 && c15 === 0) {
  13924. return solutions;
  13925. }
  13926. cosines = QuarticRealPolynomial_default.computeRealRoots(c42, c33, c22, c15, c0);
  13927. const length3 = cosines.length;
  13928. if (length3 === 0) {
  13929. return solutions;
  13930. }
  13931. for (let i2 = 0; i2 < length3; ++i2) {
  13932. const cosine = cosines[i2];
  13933. const cosineSquared = cosine * cosine;
  13934. const sineSquared = Math.max(1 - cosineSquared, 0);
  13935. const sine = Math.sqrt(sineSquared);
  13936. let left;
  13937. if (Math_default.sign(l2) === Math_default.sign(l0)) {
  13938. left = addWithCancellationCheck2(
  13939. l2 * cosineSquared + l0,
  13940. l1 * cosine,
  13941. Math_default.EPSILON12
  13942. );
  13943. } else if (Math_default.sign(l0) === Math_default.sign(l1 * cosine)) {
  13944. left = addWithCancellationCheck2(
  13945. l2 * cosineSquared,
  13946. l1 * cosine + l0,
  13947. Math_default.EPSILON12
  13948. );
  13949. } else {
  13950. left = addWithCancellationCheck2(
  13951. l2 * cosineSquared + l1 * cosine,
  13952. l0,
  13953. Math_default.EPSILON12
  13954. );
  13955. }
  13956. const right = addWithCancellationCheck2(
  13957. r1 * cosine,
  13958. r0,
  13959. Math_default.EPSILON15
  13960. );
  13961. const product = left * right;
  13962. if (product < 0) {
  13963. solutions.push(new Cartesian3_default(x, w * cosine, w * sine));
  13964. } else if (product > 0) {
  13965. solutions.push(new Cartesian3_default(x, w * cosine, w * -sine));
  13966. } else if (sine !== 0) {
  13967. solutions.push(new Cartesian3_default(x, w * cosine, w * -sine));
  13968. solutions.push(new Cartesian3_default(x, w * cosine, w * sine));
  13969. ++i2;
  13970. } else {
  13971. solutions.push(new Cartesian3_default(x, w * cosine, w * sine));
  13972. }
  13973. }
  13974. return solutions;
  13975. }
  13976. var firstAxisScratch = new Cartesian3_default();
  13977. var secondAxisScratch = new Cartesian3_default();
  13978. var thirdAxisScratch = new Cartesian3_default();
  13979. var referenceScratch = new Cartesian3_default();
  13980. var bCart = new Cartesian3_default();
  13981. var bScratch = new Matrix3_default();
  13982. var btScratch = new Matrix3_default();
  13983. var diScratch = new Matrix3_default();
  13984. var dScratch = new Matrix3_default();
  13985. var cScratch = new Matrix3_default();
  13986. var tempMatrix = new Matrix3_default();
  13987. var aScratch = new Matrix3_default();
  13988. var sScratch = new Cartesian3_default();
  13989. var closestScratch = new Cartesian3_default();
  13990. var surfPointScratch = new Cartographic_default();
  13991. IntersectionTests.grazingAltitudeLocation = function(ray, ellipsoid) {
  13992. if (!defined_default(ray)) {
  13993. throw new DeveloperError_default("ray is required.");
  13994. }
  13995. if (!defined_default(ellipsoid)) {
  13996. throw new DeveloperError_default("ellipsoid is required.");
  13997. }
  13998. const position = ray.origin;
  13999. const direction2 = ray.direction;
  14000. if (!Cartesian3_default.equals(position, Cartesian3_default.ZERO)) {
  14001. const normal2 = ellipsoid.geodeticSurfaceNormal(position, firstAxisScratch);
  14002. if (Cartesian3_default.dot(direction2, normal2) >= 0) {
  14003. return position;
  14004. }
  14005. }
  14006. const intersects3 = defined_default(this.rayEllipsoid(ray, ellipsoid));
  14007. const f2 = ellipsoid.transformPositionToScaledSpace(
  14008. direction2,
  14009. firstAxisScratch
  14010. );
  14011. const firstAxis = Cartesian3_default.normalize(f2, f2);
  14012. const reference = Cartesian3_default.mostOrthogonalAxis(f2, referenceScratch);
  14013. const secondAxis = Cartesian3_default.normalize(
  14014. Cartesian3_default.cross(reference, firstAxis, secondAxisScratch),
  14015. secondAxisScratch
  14016. );
  14017. const thirdAxis = Cartesian3_default.normalize(
  14018. Cartesian3_default.cross(firstAxis, secondAxis, thirdAxisScratch),
  14019. thirdAxisScratch
  14020. );
  14021. const B = bScratch;
  14022. B[0] = firstAxis.x;
  14023. B[1] = firstAxis.y;
  14024. B[2] = firstAxis.z;
  14025. B[3] = secondAxis.x;
  14026. B[4] = secondAxis.y;
  14027. B[5] = secondAxis.z;
  14028. B[6] = thirdAxis.x;
  14029. B[7] = thirdAxis.y;
  14030. B[8] = thirdAxis.z;
  14031. const B_T = Matrix3_default.transpose(B, btScratch);
  14032. const D_I = Matrix3_default.fromScale(ellipsoid.radii, diScratch);
  14033. const D = Matrix3_default.fromScale(ellipsoid.oneOverRadii, dScratch);
  14034. const C = cScratch;
  14035. C[0] = 0;
  14036. C[1] = -direction2.z;
  14037. C[2] = direction2.y;
  14038. C[3] = direction2.z;
  14039. C[4] = 0;
  14040. C[5] = -direction2.x;
  14041. C[6] = -direction2.y;
  14042. C[7] = direction2.x;
  14043. C[8] = 0;
  14044. const temp = Matrix3_default.multiply(
  14045. Matrix3_default.multiply(B_T, D, tempMatrix),
  14046. C,
  14047. tempMatrix
  14048. );
  14049. const A = Matrix3_default.multiply(
  14050. Matrix3_default.multiply(temp, D_I, aScratch),
  14051. B,
  14052. aScratch
  14053. );
  14054. const b = Matrix3_default.multiplyByVector(temp, position, bCart);
  14055. const solutions = quadraticVectorExpression(
  14056. A,
  14057. Cartesian3_default.negate(b, firstAxisScratch),
  14058. 0,
  14059. 0,
  14060. 1
  14061. );
  14062. let s2;
  14063. let altitude;
  14064. const length3 = solutions.length;
  14065. if (length3 > 0) {
  14066. let closest = Cartesian3_default.clone(Cartesian3_default.ZERO, closestScratch);
  14067. let maximumValue = Number.NEGATIVE_INFINITY;
  14068. for (let i2 = 0; i2 < length3; ++i2) {
  14069. s2 = Matrix3_default.multiplyByVector(
  14070. D_I,
  14071. Matrix3_default.multiplyByVector(B, solutions[i2], sScratch),
  14072. sScratch
  14073. );
  14074. const v7 = Cartesian3_default.normalize(
  14075. Cartesian3_default.subtract(s2, position, referenceScratch),
  14076. referenceScratch
  14077. );
  14078. const dotProduct = Cartesian3_default.dot(v7, direction2);
  14079. if (dotProduct > maximumValue) {
  14080. maximumValue = dotProduct;
  14081. closest = Cartesian3_default.clone(s2, closest);
  14082. }
  14083. }
  14084. const surfacePoint = ellipsoid.cartesianToCartographic(
  14085. closest,
  14086. surfPointScratch
  14087. );
  14088. maximumValue = Math_default.clamp(maximumValue, 0, 1);
  14089. altitude = Cartesian3_default.magnitude(
  14090. Cartesian3_default.subtract(closest, position, referenceScratch)
  14091. ) * Math.sqrt(1 - maximumValue * maximumValue);
  14092. altitude = intersects3 ? -altitude : altitude;
  14093. surfacePoint.height = altitude;
  14094. return ellipsoid.cartographicToCartesian(surfacePoint, new Cartesian3_default());
  14095. }
  14096. return void 0;
  14097. };
  14098. var lineSegmentPlaneDifference = new Cartesian3_default();
  14099. IntersectionTests.lineSegmentPlane = function(endPoint0, endPoint1, plane, result) {
  14100. if (!defined_default(endPoint0)) {
  14101. throw new DeveloperError_default("endPoint0 is required.");
  14102. }
  14103. if (!defined_default(endPoint1)) {
  14104. throw new DeveloperError_default("endPoint1 is required.");
  14105. }
  14106. if (!defined_default(plane)) {
  14107. throw new DeveloperError_default("plane is required.");
  14108. }
  14109. if (!defined_default(result)) {
  14110. result = new Cartesian3_default();
  14111. }
  14112. const difference = Cartesian3_default.subtract(
  14113. endPoint1,
  14114. endPoint0,
  14115. lineSegmentPlaneDifference
  14116. );
  14117. const normal2 = plane.normal;
  14118. const nDotDiff = Cartesian3_default.dot(normal2, difference);
  14119. if (Math.abs(nDotDiff) < Math_default.EPSILON6) {
  14120. return void 0;
  14121. }
  14122. const nDotP0 = Cartesian3_default.dot(normal2, endPoint0);
  14123. const t = -(plane.distance + nDotP0) / nDotDiff;
  14124. if (t < 0 || t > 1) {
  14125. return void 0;
  14126. }
  14127. Cartesian3_default.multiplyByScalar(difference, t, result);
  14128. Cartesian3_default.add(endPoint0, result, result);
  14129. return result;
  14130. };
  14131. IntersectionTests.trianglePlaneIntersection = function(p0, p1, p2, plane) {
  14132. if (!defined_default(p0) || !defined_default(p1) || !defined_default(p2) || !defined_default(plane)) {
  14133. throw new DeveloperError_default("p0, p1, p2, and plane are required.");
  14134. }
  14135. const planeNormal = plane.normal;
  14136. const planeD = plane.distance;
  14137. const p0Behind = Cartesian3_default.dot(planeNormal, p0) + planeD < 0;
  14138. const p1Behind = Cartesian3_default.dot(planeNormal, p1) + planeD < 0;
  14139. const p2Behind = Cartesian3_default.dot(planeNormal, p2) + planeD < 0;
  14140. let numBehind = 0;
  14141. numBehind += p0Behind ? 1 : 0;
  14142. numBehind += p1Behind ? 1 : 0;
  14143. numBehind += p2Behind ? 1 : 0;
  14144. let u12, u22;
  14145. if (numBehind === 1 || numBehind === 2) {
  14146. u12 = new Cartesian3_default();
  14147. u22 = new Cartesian3_default();
  14148. }
  14149. if (numBehind === 1) {
  14150. if (p0Behind) {
  14151. IntersectionTests.lineSegmentPlane(p0, p1, plane, u12);
  14152. IntersectionTests.lineSegmentPlane(p0, p2, plane, u22);
  14153. return {
  14154. positions: [p0, p1, p2, u12, u22],
  14155. indices: [
  14156. 0,
  14157. 3,
  14158. 4,
  14159. 1,
  14160. 2,
  14161. 4,
  14162. 1,
  14163. 4,
  14164. 3
  14165. ]
  14166. };
  14167. } else if (p1Behind) {
  14168. IntersectionTests.lineSegmentPlane(p1, p2, plane, u12);
  14169. IntersectionTests.lineSegmentPlane(p1, p0, plane, u22);
  14170. return {
  14171. positions: [p0, p1, p2, u12, u22],
  14172. indices: [
  14173. 1,
  14174. 3,
  14175. 4,
  14176. 2,
  14177. 0,
  14178. 4,
  14179. 2,
  14180. 4,
  14181. 3
  14182. ]
  14183. };
  14184. } else if (p2Behind) {
  14185. IntersectionTests.lineSegmentPlane(p2, p0, plane, u12);
  14186. IntersectionTests.lineSegmentPlane(p2, p1, plane, u22);
  14187. return {
  14188. positions: [p0, p1, p2, u12, u22],
  14189. indices: [
  14190. 2,
  14191. 3,
  14192. 4,
  14193. 0,
  14194. 1,
  14195. 4,
  14196. 0,
  14197. 4,
  14198. 3
  14199. ]
  14200. };
  14201. }
  14202. } else if (numBehind === 2) {
  14203. if (!p0Behind) {
  14204. IntersectionTests.lineSegmentPlane(p1, p0, plane, u12);
  14205. IntersectionTests.lineSegmentPlane(p2, p0, plane, u22);
  14206. return {
  14207. positions: [p0, p1, p2, u12, u22],
  14208. indices: [
  14209. 1,
  14210. 2,
  14211. 4,
  14212. 1,
  14213. 4,
  14214. 3,
  14215. 0,
  14216. 3,
  14217. 4
  14218. ]
  14219. };
  14220. } else if (!p1Behind) {
  14221. IntersectionTests.lineSegmentPlane(p2, p1, plane, u12);
  14222. IntersectionTests.lineSegmentPlane(p0, p1, plane, u22);
  14223. return {
  14224. positions: [p0, p1, p2, u12, u22],
  14225. indices: [
  14226. 2,
  14227. 0,
  14228. 4,
  14229. 2,
  14230. 4,
  14231. 3,
  14232. 1,
  14233. 3,
  14234. 4
  14235. ]
  14236. };
  14237. } else if (!p2Behind) {
  14238. IntersectionTests.lineSegmentPlane(p0, p2, plane, u12);
  14239. IntersectionTests.lineSegmentPlane(p1, p2, plane, u22);
  14240. return {
  14241. positions: [p0, p1, p2, u12, u22],
  14242. indices: [
  14243. 0,
  14244. 1,
  14245. 4,
  14246. 0,
  14247. 4,
  14248. 3,
  14249. 2,
  14250. 3,
  14251. 4
  14252. ]
  14253. };
  14254. }
  14255. }
  14256. return void 0;
  14257. };
  14258. var IntersectionTests_default = IntersectionTests;
  14259. // node_modules/cesium/Source/Core/Plane.js
  14260. function Plane(normal2, distance2) {
  14261. Check_default.typeOf.object("normal", normal2);
  14262. if (!Math_default.equalsEpsilon(
  14263. Cartesian3_default.magnitude(normal2),
  14264. 1,
  14265. Math_default.EPSILON6
  14266. )) {
  14267. throw new DeveloperError_default("normal must be normalized.");
  14268. }
  14269. Check_default.typeOf.number("distance", distance2);
  14270. this.normal = Cartesian3_default.clone(normal2);
  14271. this.distance = distance2;
  14272. }
  14273. Plane.fromPointNormal = function(point, normal2, result) {
  14274. Check_default.typeOf.object("point", point);
  14275. Check_default.typeOf.object("normal", normal2);
  14276. if (!Math_default.equalsEpsilon(
  14277. Cartesian3_default.magnitude(normal2),
  14278. 1,
  14279. Math_default.EPSILON6
  14280. )) {
  14281. throw new DeveloperError_default("normal must be normalized.");
  14282. }
  14283. const distance2 = -Cartesian3_default.dot(normal2, point);
  14284. if (!defined_default(result)) {
  14285. return new Plane(normal2, distance2);
  14286. }
  14287. Cartesian3_default.clone(normal2, result.normal);
  14288. result.distance = distance2;
  14289. return result;
  14290. };
  14291. var scratchNormal = new Cartesian3_default();
  14292. Plane.fromCartesian4 = function(coefficients, result) {
  14293. Check_default.typeOf.object("coefficients", coefficients);
  14294. const normal2 = Cartesian3_default.fromCartesian4(coefficients, scratchNormal);
  14295. const distance2 = coefficients.w;
  14296. if (!Math_default.equalsEpsilon(
  14297. Cartesian3_default.magnitude(normal2),
  14298. 1,
  14299. Math_default.EPSILON6
  14300. )) {
  14301. throw new DeveloperError_default("normal must be normalized.");
  14302. }
  14303. if (!defined_default(result)) {
  14304. return new Plane(normal2, distance2);
  14305. }
  14306. Cartesian3_default.clone(normal2, result.normal);
  14307. result.distance = distance2;
  14308. return result;
  14309. };
  14310. Plane.getPointDistance = function(plane, point) {
  14311. Check_default.typeOf.object("plane", plane);
  14312. Check_default.typeOf.object("point", point);
  14313. return Cartesian3_default.dot(plane.normal, point) + plane.distance;
  14314. };
  14315. var scratchCartesian2 = new Cartesian3_default();
  14316. Plane.projectPointOntoPlane = function(plane, point, result) {
  14317. Check_default.typeOf.object("plane", plane);
  14318. Check_default.typeOf.object("point", point);
  14319. if (!defined_default(result)) {
  14320. result = new Cartesian3_default();
  14321. }
  14322. const pointDistance = Plane.getPointDistance(plane, point);
  14323. const scaledNormal = Cartesian3_default.multiplyByScalar(
  14324. plane.normal,
  14325. pointDistance,
  14326. scratchCartesian2
  14327. );
  14328. return Cartesian3_default.subtract(point, scaledNormal, result);
  14329. };
  14330. var scratchInverseTranspose = new Matrix4_default();
  14331. var scratchPlaneCartesian4 = new Cartesian4_default();
  14332. var scratchTransformNormal = new Cartesian3_default();
  14333. Plane.transform = function(plane, transform4, result) {
  14334. Check_default.typeOf.object("plane", plane);
  14335. Check_default.typeOf.object("transform", transform4);
  14336. const normal2 = plane.normal;
  14337. const distance2 = plane.distance;
  14338. const inverseTranspose2 = Matrix4_default.inverseTranspose(
  14339. transform4,
  14340. scratchInverseTranspose
  14341. );
  14342. let planeAsCartesian4 = Cartesian4_default.fromElements(
  14343. normal2.x,
  14344. normal2.y,
  14345. normal2.z,
  14346. distance2,
  14347. scratchPlaneCartesian4
  14348. );
  14349. planeAsCartesian4 = Matrix4_default.multiplyByVector(
  14350. inverseTranspose2,
  14351. planeAsCartesian4,
  14352. planeAsCartesian4
  14353. );
  14354. const transformedNormal = Cartesian3_default.fromCartesian4(
  14355. planeAsCartesian4,
  14356. scratchTransformNormal
  14357. );
  14358. planeAsCartesian4 = Cartesian4_default.divideByScalar(
  14359. planeAsCartesian4,
  14360. Cartesian3_default.magnitude(transformedNormal),
  14361. planeAsCartesian4
  14362. );
  14363. return Plane.fromCartesian4(planeAsCartesian4, result);
  14364. };
  14365. Plane.clone = function(plane, result) {
  14366. Check_default.typeOf.object("plane", plane);
  14367. if (!defined_default(result)) {
  14368. return new Plane(plane.normal, plane.distance);
  14369. }
  14370. Cartesian3_default.clone(plane.normal, result.normal);
  14371. result.distance = plane.distance;
  14372. return result;
  14373. };
  14374. Plane.equals = function(left, right) {
  14375. Check_default.typeOf.object("left", left);
  14376. Check_default.typeOf.object("right", right);
  14377. return left.distance === right.distance && Cartesian3_default.equals(left.normal, right.normal);
  14378. };
  14379. Plane.ORIGIN_XY_PLANE = Object.freeze(new Plane(Cartesian3_default.UNIT_Z, 0));
  14380. Plane.ORIGIN_YZ_PLANE = Object.freeze(new Plane(Cartesian3_default.UNIT_X, 0));
  14381. Plane.ORIGIN_ZX_PLANE = Object.freeze(new Plane(Cartesian3_default.UNIT_Y, 0));
  14382. var Plane_default = Plane;
  14383. // node_modules/cesium/Source/Core/binarySearch.js
  14384. function binarySearch(array, itemToFind, comparator) {
  14385. Check_default.defined("array", array);
  14386. Check_default.defined("itemToFind", itemToFind);
  14387. Check_default.defined("comparator", comparator);
  14388. let low = 0;
  14389. let high = array.length - 1;
  14390. let i2;
  14391. let comparison;
  14392. while (low <= high) {
  14393. i2 = ~~((low + high) / 2);
  14394. comparison = comparator(array[i2], itemToFind);
  14395. if (comparison < 0) {
  14396. low = i2 + 1;
  14397. continue;
  14398. }
  14399. if (comparison > 0) {
  14400. high = i2 - 1;
  14401. continue;
  14402. }
  14403. return i2;
  14404. }
  14405. return ~(high + 1);
  14406. }
  14407. var binarySearch_default = binarySearch;
  14408. // node_modules/cesium/Source/Core/EarthOrientationParametersSample.js
  14409. function EarthOrientationParametersSample(xPoleWander, yPoleWander, xPoleOffset, yPoleOffset, ut1MinusUtc) {
  14410. this.xPoleWander = xPoleWander;
  14411. this.yPoleWander = yPoleWander;
  14412. this.xPoleOffset = xPoleOffset;
  14413. this.yPoleOffset = yPoleOffset;
  14414. this.ut1MinusUtc = ut1MinusUtc;
  14415. }
  14416. var EarthOrientationParametersSample_default = EarthOrientationParametersSample;
  14417. // node_modules/cesium/Source/Core/GregorianDate.js
  14418. function GregorianDate(year, month, day, hour, minute, second, millisecond, isLeapSecond) {
  14419. this.year = year;
  14420. this.month = month;
  14421. this.day = day;
  14422. this.hour = hour;
  14423. this.minute = minute;
  14424. this.second = second;
  14425. this.millisecond = millisecond;
  14426. this.isLeapSecond = isLeapSecond;
  14427. }
  14428. var GregorianDate_default = GregorianDate;
  14429. // node_modules/cesium/Source/Core/isLeapYear.js
  14430. function isLeapYear(year) {
  14431. if (year === null || isNaN(year)) {
  14432. throw new DeveloperError_default("year is required and must be a number.");
  14433. }
  14434. return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
  14435. }
  14436. var isLeapYear_default = isLeapYear;
  14437. // node_modules/cesium/Source/Core/LeapSecond.js
  14438. function LeapSecond(date, offset2) {
  14439. this.julianDate = date;
  14440. this.offset = offset2;
  14441. }
  14442. var LeapSecond_default = LeapSecond;
  14443. // node_modules/cesium/Source/Core/TimeConstants.js
  14444. var TimeConstants = {
  14445. SECONDS_PER_MILLISECOND: 1e-3,
  14446. SECONDS_PER_MINUTE: 60,
  14447. MINUTES_PER_HOUR: 60,
  14448. HOURS_PER_DAY: 24,
  14449. SECONDS_PER_HOUR: 3600,
  14450. MINUTES_PER_DAY: 1440,
  14451. SECONDS_PER_DAY: 86400,
  14452. DAYS_PER_JULIAN_CENTURY: 36525,
  14453. PICOSECOND: 1e-9,
  14454. MODIFIED_JULIAN_DATE_DIFFERENCE: 24000005e-1
  14455. };
  14456. var TimeConstants_default = Object.freeze(TimeConstants);
  14457. // node_modules/cesium/Source/Core/TimeStandard.js
  14458. var TimeStandard = {
  14459. UTC: 0,
  14460. TAI: 1
  14461. };
  14462. var TimeStandard_default = Object.freeze(TimeStandard);
  14463. // node_modules/cesium/Source/Core/JulianDate.js
  14464. var gregorianDateScratch = new GregorianDate_default();
  14465. var daysInMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  14466. var daysInLeapFeburary = 29;
  14467. function compareLeapSecondDates(leapSecond, dateToFind) {
  14468. return JulianDate.compare(leapSecond.julianDate, dateToFind.julianDate);
  14469. }
  14470. var binarySearchScratchLeapSecond = new LeapSecond_default();
  14471. function convertUtcToTai(julianDate) {
  14472. binarySearchScratchLeapSecond.julianDate = julianDate;
  14473. const leapSeconds = JulianDate.leapSeconds;
  14474. let index2 = binarySearch_default(
  14475. leapSeconds,
  14476. binarySearchScratchLeapSecond,
  14477. compareLeapSecondDates
  14478. );
  14479. if (index2 < 0) {
  14480. index2 = ~index2;
  14481. }
  14482. if (index2 >= leapSeconds.length) {
  14483. index2 = leapSeconds.length - 1;
  14484. }
  14485. let offset2 = leapSeconds[index2].offset;
  14486. if (index2 > 0) {
  14487. const difference = JulianDate.secondsDifference(
  14488. leapSeconds[index2].julianDate,
  14489. julianDate
  14490. );
  14491. if (difference > offset2) {
  14492. index2--;
  14493. offset2 = leapSeconds[index2].offset;
  14494. }
  14495. }
  14496. JulianDate.addSeconds(julianDate, offset2, julianDate);
  14497. }
  14498. function convertTaiToUtc(julianDate, result) {
  14499. binarySearchScratchLeapSecond.julianDate = julianDate;
  14500. const leapSeconds = JulianDate.leapSeconds;
  14501. let index2 = binarySearch_default(
  14502. leapSeconds,
  14503. binarySearchScratchLeapSecond,
  14504. compareLeapSecondDates
  14505. );
  14506. if (index2 < 0) {
  14507. index2 = ~index2;
  14508. }
  14509. if (index2 === 0) {
  14510. return JulianDate.addSeconds(julianDate, -leapSeconds[0].offset, result);
  14511. }
  14512. if (index2 >= leapSeconds.length) {
  14513. return JulianDate.addSeconds(
  14514. julianDate,
  14515. -leapSeconds[index2 - 1].offset,
  14516. result
  14517. );
  14518. }
  14519. const difference = JulianDate.secondsDifference(
  14520. leapSeconds[index2].julianDate,
  14521. julianDate
  14522. );
  14523. if (difference === 0) {
  14524. return JulianDate.addSeconds(
  14525. julianDate,
  14526. -leapSeconds[index2].offset,
  14527. result
  14528. );
  14529. }
  14530. if (difference <= 1) {
  14531. return void 0;
  14532. }
  14533. return JulianDate.addSeconds(
  14534. julianDate,
  14535. -leapSeconds[--index2].offset,
  14536. result
  14537. );
  14538. }
  14539. function setComponents(wholeDays, secondsOfDay, julianDate) {
  14540. const extraDays = secondsOfDay / TimeConstants_default.SECONDS_PER_DAY | 0;
  14541. wholeDays += extraDays;
  14542. secondsOfDay -= TimeConstants_default.SECONDS_PER_DAY * extraDays;
  14543. if (secondsOfDay < 0) {
  14544. wholeDays--;
  14545. secondsOfDay += TimeConstants_default.SECONDS_PER_DAY;
  14546. }
  14547. julianDate.dayNumber = wholeDays;
  14548. julianDate.secondsOfDay = secondsOfDay;
  14549. return julianDate;
  14550. }
  14551. function computeJulianDateComponents(year, month, day, hour, minute, second, millisecond) {
  14552. const a4 = (month - 14) / 12 | 0;
  14553. const b = year + 4800 + a4;
  14554. let dayNumber = (1461 * b / 4 | 0) + (367 * (month - 2 - 12 * a4) / 12 | 0) - (3 * ((b + 100) / 100 | 0) / 4 | 0) + day - 32075;
  14555. hour = hour - 12;
  14556. if (hour < 0) {
  14557. hour += 24;
  14558. }
  14559. const secondsOfDay = second + (hour * TimeConstants_default.SECONDS_PER_HOUR + minute * TimeConstants_default.SECONDS_PER_MINUTE + millisecond * TimeConstants_default.SECONDS_PER_MILLISECOND);
  14560. if (secondsOfDay >= 43200) {
  14561. dayNumber -= 1;
  14562. }
  14563. return [dayNumber, secondsOfDay];
  14564. }
  14565. var matchCalendarYear = /^(\d{4})$/;
  14566. var matchCalendarMonth = /^(\d{4})-(\d{2})$/;
  14567. var matchOrdinalDate = /^(\d{4})-?(\d{3})$/;
  14568. var matchWeekDate = /^(\d{4})-?W(\d{2})-?(\d{1})?$/;
  14569. var matchCalendarDate = /^(\d{4})-?(\d{2})-?(\d{2})$/;
  14570. var utcOffset = /([Z+\-])?(\d{2})?:?(\d{2})?$/;
  14571. var matchHours = /^(\d{2})(\.\d+)?/.source + utcOffset.source;
  14572. var matchHoursMinutes = /^(\d{2}):?(\d{2})(\.\d+)?/.source + utcOffset.source;
  14573. var matchHoursMinutesSeconds = /^(\d{2}):?(\d{2}):?(\d{2})(\.\d+)?/.source + utcOffset.source;
  14574. var iso8601ErrorMessage = "Invalid ISO 8601 date.";
  14575. function JulianDate(julianDayNumber, secondsOfDay, timeStandard) {
  14576. this.dayNumber = void 0;
  14577. this.secondsOfDay = void 0;
  14578. julianDayNumber = defaultValue_default(julianDayNumber, 0);
  14579. secondsOfDay = defaultValue_default(secondsOfDay, 0);
  14580. timeStandard = defaultValue_default(timeStandard, TimeStandard_default.UTC);
  14581. const wholeDays = julianDayNumber | 0;
  14582. secondsOfDay = secondsOfDay + (julianDayNumber - wholeDays) * TimeConstants_default.SECONDS_PER_DAY;
  14583. setComponents(wholeDays, secondsOfDay, this);
  14584. if (timeStandard === TimeStandard_default.UTC) {
  14585. convertUtcToTai(this);
  14586. }
  14587. }
  14588. JulianDate.fromGregorianDate = function(date, result) {
  14589. if (!(date instanceof GregorianDate_default)) {
  14590. throw new DeveloperError_default("date must be a valid GregorianDate.");
  14591. }
  14592. const components = computeJulianDateComponents(
  14593. date.year,
  14594. date.month,
  14595. date.day,
  14596. date.hour,
  14597. date.minute,
  14598. date.second,
  14599. date.millisecond
  14600. );
  14601. if (!defined_default(result)) {
  14602. return new JulianDate(components[0], components[1], TimeStandard_default.UTC);
  14603. }
  14604. setComponents(components[0], components[1], result);
  14605. convertUtcToTai(result);
  14606. return result;
  14607. };
  14608. JulianDate.fromDate = function(date, result) {
  14609. if (!(date instanceof Date) || isNaN(date.getTime())) {
  14610. throw new DeveloperError_default("date must be a valid JavaScript Date.");
  14611. }
  14612. const components = computeJulianDateComponents(
  14613. date.getUTCFullYear(),
  14614. date.getUTCMonth() + 1,
  14615. date.getUTCDate(),
  14616. date.getUTCHours(),
  14617. date.getUTCMinutes(),
  14618. date.getUTCSeconds(),
  14619. date.getUTCMilliseconds()
  14620. );
  14621. if (!defined_default(result)) {
  14622. return new JulianDate(components[0], components[1], TimeStandard_default.UTC);
  14623. }
  14624. setComponents(components[0], components[1], result);
  14625. convertUtcToTai(result);
  14626. return result;
  14627. };
  14628. JulianDate.fromIso8601 = function(iso8601String, result) {
  14629. if (typeof iso8601String !== "string") {
  14630. throw new DeveloperError_default(iso8601ErrorMessage);
  14631. }
  14632. iso8601String = iso8601String.replace(",", ".");
  14633. let tokens = iso8601String.split("T");
  14634. let year;
  14635. let month = 1;
  14636. let day = 1;
  14637. let hour = 0;
  14638. let minute = 0;
  14639. let second = 0;
  14640. let millisecond = 0;
  14641. const date = tokens[0];
  14642. const time = tokens[1];
  14643. let tmp2;
  14644. let inLeapYear;
  14645. if (!defined_default(date)) {
  14646. throw new DeveloperError_default(iso8601ErrorMessage);
  14647. }
  14648. let dashCount;
  14649. tokens = date.match(matchCalendarDate);
  14650. if (tokens !== null) {
  14651. dashCount = date.split("-").length - 1;
  14652. if (dashCount > 0 && dashCount !== 2) {
  14653. throw new DeveloperError_default(iso8601ErrorMessage);
  14654. }
  14655. year = +tokens[1];
  14656. month = +tokens[2];
  14657. day = +tokens[3];
  14658. } else {
  14659. tokens = date.match(matchCalendarMonth);
  14660. if (tokens !== null) {
  14661. year = +tokens[1];
  14662. month = +tokens[2];
  14663. } else {
  14664. tokens = date.match(matchCalendarYear);
  14665. if (tokens !== null) {
  14666. year = +tokens[1];
  14667. } else {
  14668. let dayOfYear;
  14669. tokens = date.match(matchOrdinalDate);
  14670. if (tokens !== null) {
  14671. year = +tokens[1];
  14672. dayOfYear = +tokens[2];
  14673. inLeapYear = isLeapYear_default(year);
  14674. if (dayOfYear < 1 || inLeapYear && dayOfYear > 366 || !inLeapYear && dayOfYear > 365) {
  14675. throw new DeveloperError_default(iso8601ErrorMessage);
  14676. }
  14677. } else {
  14678. tokens = date.match(matchWeekDate);
  14679. if (tokens !== null) {
  14680. year = +tokens[1];
  14681. const weekNumber = +tokens[2];
  14682. const dayOfWeek = +tokens[3] || 0;
  14683. dashCount = date.split("-").length - 1;
  14684. if (dashCount > 0 && (!defined_default(tokens[3]) && dashCount !== 1 || defined_default(tokens[3]) && dashCount !== 2)) {
  14685. throw new DeveloperError_default(iso8601ErrorMessage);
  14686. }
  14687. const january4 = new Date(Date.UTC(year, 0, 4));
  14688. dayOfYear = weekNumber * 7 + dayOfWeek - january4.getUTCDay() - 3;
  14689. } else {
  14690. throw new DeveloperError_default(iso8601ErrorMessage);
  14691. }
  14692. }
  14693. tmp2 = new Date(Date.UTC(year, 0, 1));
  14694. tmp2.setUTCDate(dayOfYear);
  14695. month = tmp2.getUTCMonth() + 1;
  14696. day = tmp2.getUTCDate();
  14697. }
  14698. }
  14699. }
  14700. inLeapYear = isLeapYear_default(year);
  14701. if (month < 1 || month > 12 || day < 1 || (month !== 2 || !inLeapYear) && day > daysInMonth[month - 1] || inLeapYear && month === 2 && day > daysInLeapFeburary) {
  14702. throw new DeveloperError_default(iso8601ErrorMessage);
  14703. }
  14704. let offsetIndex;
  14705. if (defined_default(time)) {
  14706. tokens = time.match(matchHoursMinutesSeconds);
  14707. if (tokens !== null) {
  14708. dashCount = time.split(":").length - 1;
  14709. if (dashCount > 0 && dashCount !== 2 && dashCount !== 3) {
  14710. throw new DeveloperError_default(iso8601ErrorMessage);
  14711. }
  14712. hour = +tokens[1];
  14713. minute = +tokens[2];
  14714. second = +tokens[3];
  14715. millisecond = +(tokens[4] || 0) * 1e3;
  14716. offsetIndex = 5;
  14717. } else {
  14718. tokens = time.match(matchHoursMinutes);
  14719. if (tokens !== null) {
  14720. dashCount = time.split(":").length - 1;
  14721. if (dashCount > 2) {
  14722. throw new DeveloperError_default(iso8601ErrorMessage);
  14723. }
  14724. hour = +tokens[1];
  14725. minute = +tokens[2];
  14726. second = +(tokens[3] || 0) * 60;
  14727. offsetIndex = 4;
  14728. } else {
  14729. tokens = time.match(matchHours);
  14730. if (tokens !== null) {
  14731. hour = +tokens[1];
  14732. minute = +(tokens[2] || 0) * 60;
  14733. offsetIndex = 3;
  14734. } else {
  14735. throw new DeveloperError_default(iso8601ErrorMessage);
  14736. }
  14737. }
  14738. }
  14739. if (minute >= 60 || second >= 61 || hour > 24 || hour === 24 && (minute > 0 || second > 0 || millisecond > 0)) {
  14740. throw new DeveloperError_default(iso8601ErrorMessage);
  14741. }
  14742. const offset2 = tokens[offsetIndex];
  14743. const offsetHours = +tokens[offsetIndex + 1];
  14744. const offsetMinutes = +(tokens[offsetIndex + 2] || 0);
  14745. switch (offset2) {
  14746. case "+":
  14747. hour = hour - offsetHours;
  14748. minute = minute - offsetMinutes;
  14749. break;
  14750. case "-":
  14751. hour = hour + offsetHours;
  14752. minute = minute + offsetMinutes;
  14753. break;
  14754. case "Z":
  14755. break;
  14756. default:
  14757. minute = minute + new Date(
  14758. Date.UTC(year, month - 1, day, hour, minute)
  14759. ).getTimezoneOffset();
  14760. break;
  14761. }
  14762. }
  14763. const isLeapSecond = second === 60;
  14764. if (isLeapSecond) {
  14765. second--;
  14766. }
  14767. while (minute >= 60) {
  14768. minute -= 60;
  14769. hour++;
  14770. }
  14771. while (hour >= 24) {
  14772. hour -= 24;
  14773. day++;
  14774. }
  14775. tmp2 = inLeapYear && month === 2 ? daysInLeapFeburary : daysInMonth[month - 1];
  14776. while (day > tmp2) {
  14777. day -= tmp2;
  14778. month++;
  14779. if (month > 12) {
  14780. month -= 12;
  14781. year++;
  14782. }
  14783. tmp2 = inLeapYear && month === 2 ? daysInLeapFeburary : daysInMonth[month - 1];
  14784. }
  14785. while (minute < 0) {
  14786. minute += 60;
  14787. hour--;
  14788. }
  14789. while (hour < 0) {
  14790. hour += 24;
  14791. day--;
  14792. }
  14793. while (day < 1) {
  14794. month--;
  14795. if (month < 1) {
  14796. month += 12;
  14797. year--;
  14798. }
  14799. tmp2 = inLeapYear && month === 2 ? daysInLeapFeburary : daysInMonth[month - 1];
  14800. day += tmp2;
  14801. }
  14802. const components = computeJulianDateComponents(
  14803. year,
  14804. month,
  14805. day,
  14806. hour,
  14807. minute,
  14808. second,
  14809. millisecond
  14810. );
  14811. if (!defined_default(result)) {
  14812. result = new JulianDate(components[0], components[1], TimeStandard_default.UTC);
  14813. } else {
  14814. setComponents(components[0], components[1], result);
  14815. convertUtcToTai(result);
  14816. }
  14817. if (isLeapSecond) {
  14818. JulianDate.addSeconds(result, 1, result);
  14819. }
  14820. return result;
  14821. };
  14822. JulianDate.now = function(result) {
  14823. return JulianDate.fromDate(new Date(), result);
  14824. };
  14825. var toGregorianDateScratch = new JulianDate(0, 0, TimeStandard_default.TAI);
  14826. JulianDate.toGregorianDate = function(julianDate, result) {
  14827. if (!defined_default(julianDate)) {
  14828. throw new DeveloperError_default("julianDate is required.");
  14829. }
  14830. let isLeapSecond = false;
  14831. let thisUtc = convertTaiToUtc(julianDate, toGregorianDateScratch);
  14832. if (!defined_default(thisUtc)) {
  14833. JulianDate.addSeconds(julianDate, -1, toGregorianDateScratch);
  14834. thisUtc = convertTaiToUtc(toGregorianDateScratch, toGregorianDateScratch);
  14835. isLeapSecond = true;
  14836. }
  14837. let julianDayNumber = thisUtc.dayNumber;
  14838. const secondsOfDay = thisUtc.secondsOfDay;
  14839. if (secondsOfDay >= 43200) {
  14840. julianDayNumber += 1;
  14841. }
  14842. let L = julianDayNumber + 68569 | 0;
  14843. const N = 4 * L / 146097 | 0;
  14844. L = L - ((146097 * N + 3) / 4 | 0) | 0;
  14845. const I = 4e3 * (L + 1) / 1461001 | 0;
  14846. L = L - (1461 * I / 4 | 0) + 31 | 0;
  14847. const J = 80 * L / 2447 | 0;
  14848. const day = L - (2447 * J / 80 | 0) | 0;
  14849. L = J / 11 | 0;
  14850. const month = J + 2 - 12 * L | 0;
  14851. const year = 100 * (N - 49) + I + L | 0;
  14852. let hour = secondsOfDay / TimeConstants_default.SECONDS_PER_HOUR | 0;
  14853. let remainingSeconds = secondsOfDay - hour * TimeConstants_default.SECONDS_PER_HOUR;
  14854. const minute = remainingSeconds / TimeConstants_default.SECONDS_PER_MINUTE | 0;
  14855. remainingSeconds = remainingSeconds - minute * TimeConstants_default.SECONDS_PER_MINUTE;
  14856. let second = remainingSeconds | 0;
  14857. const millisecond = (remainingSeconds - second) / TimeConstants_default.SECONDS_PER_MILLISECOND;
  14858. hour += 12;
  14859. if (hour > 23) {
  14860. hour -= 24;
  14861. }
  14862. if (isLeapSecond) {
  14863. second += 1;
  14864. }
  14865. if (!defined_default(result)) {
  14866. return new GregorianDate_default(
  14867. year,
  14868. month,
  14869. day,
  14870. hour,
  14871. minute,
  14872. second,
  14873. millisecond,
  14874. isLeapSecond
  14875. );
  14876. }
  14877. result.year = year;
  14878. result.month = month;
  14879. result.day = day;
  14880. result.hour = hour;
  14881. result.minute = minute;
  14882. result.second = second;
  14883. result.millisecond = millisecond;
  14884. result.isLeapSecond = isLeapSecond;
  14885. return result;
  14886. };
  14887. JulianDate.toDate = function(julianDate) {
  14888. if (!defined_default(julianDate)) {
  14889. throw new DeveloperError_default("julianDate is required.");
  14890. }
  14891. const gDate = JulianDate.toGregorianDate(julianDate, gregorianDateScratch);
  14892. let second = gDate.second;
  14893. if (gDate.isLeapSecond) {
  14894. second -= 1;
  14895. }
  14896. return new Date(
  14897. Date.UTC(
  14898. gDate.year,
  14899. gDate.month - 1,
  14900. gDate.day,
  14901. gDate.hour,
  14902. gDate.minute,
  14903. second,
  14904. gDate.millisecond
  14905. )
  14906. );
  14907. };
  14908. JulianDate.toIso8601 = function(julianDate, precision) {
  14909. if (!defined_default(julianDate)) {
  14910. throw new DeveloperError_default("julianDate is required.");
  14911. }
  14912. const gDate = JulianDate.toGregorianDate(julianDate, gregorianDateScratch);
  14913. let year = gDate.year;
  14914. let month = gDate.month;
  14915. let day = gDate.day;
  14916. let hour = gDate.hour;
  14917. const minute = gDate.minute;
  14918. const second = gDate.second;
  14919. const millisecond = gDate.millisecond;
  14920. if (year === 1e4 && month === 1 && day === 1 && hour === 0 && minute === 0 && second === 0 && millisecond === 0) {
  14921. year = 9999;
  14922. month = 12;
  14923. day = 31;
  14924. hour = 24;
  14925. }
  14926. let millisecondStr;
  14927. if (!defined_default(precision) && millisecond !== 0) {
  14928. millisecondStr = (millisecond * 0.01).toString().replace(".", "");
  14929. return `${year.toString().padStart(4, "0")}-${month.toString().padStart(2, "0")}-${day.toString().padStart(2, "0")}T${hour.toString().padStart(2, "0")}:${minute.toString().padStart(2, "0")}:${second.toString().padStart(2, "0")}.${millisecondStr}Z`;
  14930. }
  14931. if (!defined_default(precision) || precision === 0) {
  14932. return `${year.toString().padStart(4, "0")}-${month.toString().padStart(2, "0")}-${day.toString().padStart(2, "0")}T${hour.toString().padStart(2, "0")}:${minute.toString().padStart(2, "0")}:${second.toString().padStart(2, "0")}Z`;
  14933. }
  14934. millisecondStr = (millisecond * 0.01).toFixed(precision).replace(".", "").slice(0, precision);
  14935. return `${year.toString().padStart(4, "0")}-${month.toString().padStart(2, "0")}-${day.toString().padStart(2, "0")}T${hour.toString().padStart(2, "0")}:${minute.toString().padStart(2, "0")}:${second.toString().padStart(2, "0")}.${millisecondStr}Z`;
  14936. };
  14937. JulianDate.clone = function(julianDate, result) {
  14938. if (!defined_default(julianDate)) {
  14939. return void 0;
  14940. }
  14941. if (!defined_default(result)) {
  14942. return new JulianDate(
  14943. julianDate.dayNumber,
  14944. julianDate.secondsOfDay,
  14945. TimeStandard_default.TAI
  14946. );
  14947. }
  14948. result.dayNumber = julianDate.dayNumber;
  14949. result.secondsOfDay = julianDate.secondsOfDay;
  14950. return result;
  14951. };
  14952. JulianDate.compare = function(left, right) {
  14953. if (!defined_default(left)) {
  14954. throw new DeveloperError_default("left is required.");
  14955. }
  14956. if (!defined_default(right)) {
  14957. throw new DeveloperError_default("right is required.");
  14958. }
  14959. const julianDayNumberDifference = left.dayNumber - right.dayNumber;
  14960. if (julianDayNumberDifference !== 0) {
  14961. return julianDayNumberDifference;
  14962. }
  14963. return left.secondsOfDay - right.secondsOfDay;
  14964. };
  14965. JulianDate.equals = function(left, right) {
  14966. return left === right || defined_default(left) && defined_default(right) && left.dayNumber === right.dayNumber && left.secondsOfDay === right.secondsOfDay;
  14967. };
  14968. JulianDate.equalsEpsilon = function(left, right, epsilon) {
  14969. epsilon = defaultValue_default(epsilon, 0);
  14970. return left === right || defined_default(left) && defined_default(right) && Math.abs(JulianDate.secondsDifference(left, right)) <= epsilon;
  14971. };
  14972. JulianDate.totalDays = function(julianDate) {
  14973. if (!defined_default(julianDate)) {
  14974. throw new DeveloperError_default("julianDate is required.");
  14975. }
  14976. return julianDate.dayNumber + julianDate.secondsOfDay / TimeConstants_default.SECONDS_PER_DAY;
  14977. };
  14978. JulianDate.secondsDifference = function(left, right) {
  14979. if (!defined_default(left)) {
  14980. throw new DeveloperError_default("left is required.");
  14981. }
  14982. if (!defined_default(right)) {
  14983. throw new DeveloperError_default("right is required.");
  14984. }
  14985. const dayDifference = (left.dayNumber - right.dayNumber) * TimeConstants_default.SECONDS_PER_DAY;
  14986. return dayDifference + (left.secondsOfDay - right.secondsOfDay);
  14987. };
  14988. JulianDate.daysDifference = function(left, right) {
  14989. if (!defined_default(left)) {
  14990. throw new DeveloperError_default("left is required.");
  14991. }
  14992. if (!defined_default(right)) {
  14993. throw new DeveloperError_default("right is required.");
  14994. }
  14995. const dayDifference = left.dayNumber - right.dayNumber;
  14996. const secondDifference = (left.secondsOfDay - right.secondsOfDay) / TimeConstants_default.SECONDS_PER_DAY;
  14997. return dayDifference + secondDifference;
  14998. };
  14999. JulianDate.computeTaiMinusUtc = function(julianDate) {
  15000. binarySearchScratchLeapSecond.julianDate = julianDate;
  15001. const leapSeconds = JulianDate.leapSeconds;
  15002. let index2 = binarySearch_default(
  15003. leapSeconds,
  15004. binarySearchScratchLeapSecond,
  15005. compareLeapSecondDates
  15006. );
  15007. if (index2 < 0) {
  15008. index2 = ~index2;
  15009. --index2;
  15010. if (index2 < 0) {
  15011. index2 = 0;
  15012. }
  15013. }
  15014. return leapSeconds[index2].offset;
  15015. };
  15016. JulianDate.addSeconds = function(julianDate, seconds, result) {
  15017. if (!defined_default(julianDate)) {
  15018. throw new DeveloperError_default("julianDate is required.");
  15019. }
  15020. if (!defined_default(seconds)) {
  15021. throw new DeveloperError_default("seconds is required.");
  15022. }
  15023. if (!defined_default(result)) {
  15024. throw new DeveloperError_default("result is required.");
  15025. }
  15026. return setComponents(
  15027. julianDate.dayNumber,
  15028. julianDate.secondsOfDay + seconds,
  15029. result
  15030. );
  15031. };
  15032. JulianDate.addMinutes = function(julianDate, minutes, result) {
  15033. if (!defined_default(julianDate)) {
  15034. throw new DeveloperError_default("julianDate is required.");
  15035. }
  15036. if (!defined_default(minutes)) {
  15037. throw new DeveloperError_default("minutes is required.");
  15038. }
  15039. if (!defined_default(result)) {
  15040. throw new DeveloperError_default("result is required.");
  15041. }
  15042. const newSecondsOfDay = julianDate.secondsOfDay + minutes * TimeConstants_default.SECONDS_PER_MINUTE;
  15043. return setComponents(julianDate.dayNumber, newSecondsOfDay, result);
  15044. };
  15045. JulianDate.addHours = function(julianDate, hours, result) {
  15046. if (!defined_default(julianDate)) {
  15047. throw new DeveloperError_default("julianDate is required.");
  15048. }
  15049. if (!defined_default(hours)) {
  15050. throw new DeveloperError_default("hours is required.");
  15051. }
  15052. if (!defined_default(result)) {
  15053. throw new DeveloperError_default("result is required.");
  15054. }
  15055. const newSecondsOfDay = julianDate.secondsOfDay + hours * TimeConstants_default.SECONDS_PER_HOUR;
  15056. return setComponents(julianDate.dayNumber, newSecondsOfDay, result);
  15057. };
  15058. JulianDate.addDays = function(julianDate, days, result) {
  15059. if (!defined_default(julianDate)) {
  15060. throw new DeveloperError_default("julianDate is required.");
  15061. }
  15062. if (!defined_default(days)) {
  15063. throw new DeveloperError_default("days is required.");
  15064. }
  15065. if (!defined_default(result)) {
  15066. throw new DeveloperError_default("result is required.");
  15067. }
  15068. const newJulianDayNumber = julianDate.dayNumber + days;
  15069. return setComponents(newJulianDayNumber, julianDate.secondsOfDay, result);
  15070. };
  15071. JulianDate.lessThan = function(left, right) {
  15072. return JulianDate.compare(left, right) < 0;
  15073. };
  15074. JulianDate.lessThanOrEquals = function(left, right) {
  15075. return JulianDate.compare(left, right) <= 0;
  15076. };
  15077. JulianDate.greaterThan = function(left, right) {
  15078. return JulianDate.compare(left, right) > 0;
  15079. };
  15080. JulianDate.greaterThanOrEquals = function(left, right) {
  15081. return JulianDate.compare(left, right) >= 0;
  15082. };
  15083. JulianDate.prototype.clone = function(result) {
  15084. return JulianDate.clone(this, result);
  15085. };
  15086. JulianDate.prototype.equals = function(right) {
  15087. return JulianDate.equals(this, right);
  15088. };
  15089. JulianDate.prototype.equalsEpsilon = function(right, epsilon) {
  15090. return JulianDate.equalsEpsilon(this, right, epsilon);
  15091. };
  15092. JulianDate.prototype.toString = function() {
  15093. return JulianDate.toIso8601(this);
  15094. };
  15095. JulianDate.leapSeconds = [
  15096. new LeapSecond_default(new JulianDate(2441317, 43210, TimeStandard_default.TAI), 10),
  15097. new LeapSecond_default(new JulianDate(2441499, 43211, TimeStandard_default.TAI), 11),
  15098. new LeapSecond_default(new JulianDate(2441683, 43212, TimeStandard_default.TAI), 12),
  15099. new LeapSecond_default(new JulianDate(2442048, 43213, TimeStandard_default.TAI), 13),
  15100. new LeapSecond_default(new JulianDate(2442413, 43214, TimeStandard_default.TAI), 14),
  15101. new LeapSecond_default(new JulianDate(2442778, 43215, TimeStandard_default.TAI), 15),
  15102. new LeapSecond_default(new JulianDate(2443144, 43216, TimeStandard_default.TAI), 16),
  15103. new LeapSecond_default(new JulianDate(2443509, 43217, TimeStandard_default.TAI), 17),
  15104. new LeapSecond_default(new JulianDate(2443874, 43218, TimeStandard_default.TAI), 18),
  15105. new LeapSecond_default(new JulianDate(2444239, 43219, TimeStandard_default.TAI), 19),
  15106. new LeapSecond_default(new JulianDate(2444786, 43220, TimeStandard_default.TAI), 20),
  15107. new LeapSecond_default(new JulianDate(2445151, 43221, TimeStandard_default.TAI), 21),
  15108. new LeapSecond_default(new JulianDate(2445516, 43222, TimeStandard_default.TAI), 22),
  15109. new LeapSecond_default(new JulianDate(2446247, 43223, TimeStandard_default.TAI), 23),
  15110. new LeapSecond_default(new JulianDate(2447161, 43224, TimeStandard_default.TAI), 24),
  15111. new LeapSecond_default(new JulianDate(2447892, 43225, TimeStandard_default.TAI), 25),
  15112. new LeapSecond_default(new JulianDate(2448257, 43226, TimeStandard_default.TAI), 26),
  15113. new LeapSecond_default(new JulianDate(2448804, 43227, TimeStandard_default.TAI), 27),
  15114. new LeapSecond_default(new JulianDate(2449169, 43228, TimeStandard_default.TAI), 28),
  15115. new LeapSecond_default(new JulianDate(2449534, 43229, TimeStandard_default.TAI), 29),
  15116. new LeapSecond_default(new JulianDate(2450083, 43230, TimeStandard_default.TAI), 30),
  15117. new LeapSecond_default(new JulianDate(2450630, 43231, TimeStandard_default.TAI), 31),
  15118. new LeapSecond_default(new JulianDate(2451179, 43232, TimeStandard_default.TAI), 32),
  15119. new LeapSecond_default(new JulianDate(2453736, 43233, TimeStandard_default.TAI), 33),
  15120. new LeapSecond_default(new JulianDate(2454832, 43234, TimeStandard_default.TAI), 34),
  15121. new LeapSecond_default(new JulianDate(2456109, 43235, TimeStandard_default.TAI), 35),
  15122. new LeapSecond_default(new JulianDate(2457204, 43236, TimeStandard_default.TAI), 36),
  15123. new LeapSecond_default(new JulianDate(2457754, 43237, TimeStandard_default.TAI), 37)
  15124. ];
  15125. var JulianDate_default = JulianDate;
  15126. // node_modules/cesium/Source/Core/EarthOrientationParameters.js
  15127. function EarthOrientationParameters(options) {
  15128. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  15129. this._dates = void 0;
  15130. this._samples = void 0;
  15131. this._dateColumn = -1;
  15132. this._xPoleWanderRadiansColumn = -1;
  15133. this._yPoleWanderRadiansColumn = -1;
  15134. this._ut1MinusUtcSecondsColumn = -1;
  15135. this._xCelestialPoleOffsetRadiansColumn = -1;
  15136. this._yCelestialPoleOffsetRadiansColumn = -1;
  15137. this._taiMinusUtcSecondsColumn = -1;
  15138. this._columnCount = 0;
  15139. this._lastIndex = -1;
  15140. this._downloadPromise = void 0;
  15141. this._dataError = void 0;
  15142. this._addNewLeapSeconds = defaultValue_default(options.addNewLeapSeconds, true);
  15143. if (defined_default(options.data)) {
  15144. onDataReady(this, options.data);
  15145. } else if (defined_default(options.url)) {
  15146. const resource = Resource_default.createIfNeeded(options.url);
  15147. const that = this;
  15148. this._downloadPromise = resource.fetchJson().then(function(eopData) {
  15149. onDataReady(that, eopData);
  15150. }).catch(function() {
  15151. that._dataError = `An error occurred while retrieving the EOP data from the URL ${resource.url}.`;
  15152. });
  15153. } else {
  15154. onDataReady(this, {
  15155. columnNames: [
  15156. "dateIso8601",
  15157. "modifiedJulianDateUtc",
  15158. "xPoleWanderRadians",
  15159. "yPoleWanderRadians",
  15160. "ut1MinusUtcSeconds",
  15161. "lengthOfDayCorrectionSeconds",
  15162. "xCelestialPoleOffsetRadians",
  15163. "yCelestialPoleOffsetRadians",
  15164. "taiMinusUtcSeconds"
  15165. ],
  15166. samples: []
  15167. });
  15168. }
  15169. }
  15170. EarthOrientationParameters.NONE = Object.freeze({
  15171. getPromiseToLoad: function() {
  15172. return Promise.resolve();
  15173. },
  15174. compute: function(date, result) {
  15175. if (!defined_default(result)) {
  15176. result = new EarthOrientationParametersSample_default(0, 0, 0, 0, 0);
  15177. } else {
  15178. result.xPoleWander = 0;
  15179. result.yPoleWander = 0;
  15180. result.xPoleOffset = 0;
  15181. result.yPoleOffset = 0;
  15182. result.ut1MinusUtc = 0;
  15183. }
  15184. return result;
  15185. }
  15186. });
  15187. EarthOrientationParameters.prototype.getPromiseToLoad = function() {
  15188. return Promise.resolve(this._downloadPromise);
  15189. };
  15190. EarthOrientationParameters.prototype.compute = function(date, result) {
  15191. if (!defined_default(this._samples)) {
  15192. if (defined_default(this._dataError)) {
  15193. throw new RuntimeError_default(this._dataError);
  15194. }
  15195. return void 0;
  15196. }
  15197. if (!defined_default(result)) {
  15198. result = new EarthOrientationParametersSample_default(0, 0, 0, 0, 0);
  15199. }
  15200. if (this._samples.length === 0) {
  15201. result.xPoleWander = 0;
  15202. result.yPoleWander = 0;
  15203. result.xPoleOffset = 0;
  15204. result.yPoleOffset = 0;
  15205. result.ut1MinusUtc = 0;
  15206. return result;
  15207. }
  15208. const dates = this._dates;
  15209. const lastIndex = this._lastIndex;
  15210. let before = 0;
  15211. let after = 0;
  15212. if (defined_default(lastIndex)) {
  15213. const previousIndexDate = dates[lastIndex];
  15214. const nextIndexDate = dates[lastIndex + 1];
  15215. const isAfterPrevious = JulianDate_default.lessThanOrEquals(
  15216. previousIndexDate,
  15217. date
  15218. );
  15219. const isAfterLastSample = !defined_default(nextIndexDate);
  15220. const isBeforeNext = isAfterLastSample || JulianDate_default.greaterThanOrEquals(nextIndexDate, date);
  15221. if (isAfterPrevious && isBeforeNext) {
  15222. before = lastIndex;
  15223. if (!isAfterLastSample && nextIndexDate.equals(date)) {
  15224. ++before;
  15225. }
  15226. after = before + 1;
  15227. interpolate(this, dates, this._samples, date, before, after, result);
  15228. return result;
  15229. }
  15230. }
  15231. let index2 = binarySearch_default(dates, date, JulianDate_default.compare, this._dateColumn);
  15232. if (index2 >= 0) {
  15233. if (index2 < dates.length - 1 && dates[index2 + 1].equals(date)) {
  15234. ++index2;
  15235. }
  15236. before = index2;
  15237. after = index2;
  15238. } else {
  15239. after = ~index2;
  15240. before = after - 1;
  15241. if (before < 0) {
  15242. before = 0;
  15243. }
  15244. }
  15245. this._lastIndex = before;
  15246. interpolate(this, dates, this._samples, date, before, after, result);
  15247. return result;
  15248. };
  15249. function compareLeapSecondDates2(leapSecond, dateToFind) {
  15250. return JulianDate_default.compare(leapSecond.julianDate, dateToFind);
  15251. }
  15252. function onDataReady(eop, eopData) {
  15253. if (!defined_default(eopData.columnNames)) {
  15254. eop._dataError = "Error in loaded EOP data: The columnNames property is required.";
  15255. return;
  15256. }
  15257. if (!defined_default(eopData.samples)) {
  15258. eop._dataError = "Error in loaded EOP data: The samples property is required.";
  15259. return;
  15260. }
  15261. const dateColumn = eopData.columnNames.indexOf("modifiedJulianDateUtc");
  15262. const xPoleWanderRadiansColumn = eopData.columnNames.indexOf(
  15263. "xPoleWanderRadians"
  15264. );
  15265. const yPoleWanderRadiansColumn = eopData.columnNames.indexOf(
  15266. "yPoleWanderRadians"
  15267. );
  15268. const ut1MinusUtcSecondsColumn = eopData.columnNames.indexOf(
  15269. "ut1MinusUtcSeconds"
  15270. );
  15271. const xCelestialPoleOffsetRadiansColumn = eopData.columnNames.indexOf(
  15272. "xCelestialPoleOffsetRadians"
  15273. );
  15274. const yCelestialPoleOffsetRadiansColumn = eopData.columnNames.indexOf(
  15275. "yCelestialPoleOffsetRadians"
  15276. );
  15277. const taiMinusUtcSecondsColumn = eopData.columnNames.indexOf(
  15278. "taiMinusUtcSeconds"
  15279. );
  15280. if (dateColumn < 0 || xPoleWanderRadiansColumn < 0 || yPoleWanderRadiansColumn < 0 || ut1MinusUtcSecondsColumn < 0 || xCelestialPoleOffsetRadiansColumn < 0 || yCelestialPoleOffsetRadiansColumn < 0 || taiMinusUtcSecondsColumn < 0) {
  15281. eop._dataError = "Error in loaded EOP data: The columnNames property must include modifiedJulianDateUtc, xPoleWanderRadians, yPoleWanderRadians, ut1MinusUtcSeconds, xCelestialPoleOffsetRadians, yCelestialPoleOffsetRadians, and taiMinusUtcSeconds columns";
  15282. return;
  15283. }
  15284. const samples = eop._samples = eopData.samples;
  15285. const dates = eop._dates = [];
  15286. eop._dateColumn = dateColumn;
  15287. eop._xPoleWanderRadiansColumn = xPoleWanderRadiansColumn;
  15288. eop._yPoleWanderRadiansColumn = yPoleWanderRadiansColumn;
  15289. eop._ut1MinusUtcSecondsColumn = ut1MinusUtcSecondsColumn;
  15290. eop._xCelestialPoleOffsetRadiansColumn = xCelestialPoleOffsetRadiansColumn;
  15291. eop._yCelestialPoleOffsetRadiansColumn = yCelestialPoleOffsetRadiansColumn;
  15292. eop._taiMinusUtcSecondsColumn = taiMinusUtcSecondsColumn;
  15293. eop._columnCount = eopData.columnNames.length;
  15294. eop._lastIndex = void 0;
  15295. let lastTaiMinusUtc;
  15296. const addNewLeapSeconds = eop._addNewLeapSeconds;
  15297. for (let i2 = 0, len = samples.length; i2 < len; i2 += eop._columnCount) {
  15298. const mjd = samples[i2 + dateColumn];
  15299. const taiMinusUtc = samples[i2 + taiMinusUtcSecondsColumn];
  15300. const day = mjd + TimeConstants_default.MODIFIED_JULIAN_DATE_DIFFERENCE;
  15301. const date = new JulianDate_default(day, taiMinusUtc, TimeStandard_default.TAI);
  15302. dates.push(date);
  15303. if (addNewLeapSeconds) {
  15304. if (taiMinusUtc !== lastTaiMinusUtc && defined_default(lastTaiMinusUtc)) {
  15305. const leapSeconds = JulianDate_default.leapSeconds;
  15306. const leapSecondIndex = binarySearch_default(
  15307. leapSeconds,
  15308. date,
  15309. compareLeapSecondDates2
  15310. );
  15311. if (leapSecondIndex < 0) {
  15312. const leapSecond = new LeapSecond_default(date, taiMinusUtc);
  15313. leapSeconds.splice(~leapSecondIndex, 0, leapSecond);
  15314. }
  15315. }
  15316. lastTaiMinusUtc = taiMinusUtc;
  15317. }
  15318. }
  15319. }
  15320. function fillResultFromIndex(eop, samples, index2, columnCount, result) {
  15321. const start = index2 * columnCount;
  15322. result.xPoleWander = samples[start + eop._xPoleWanderRadiansColumn];
  15323. result.yPoleWander = samples[start + eop._yPoleWanderRadiansColumn];
  15324. result.xPoleOffset = samples[start + eop._xCelestialPoleOffsetRadiansColumn];
  15325. result.yPoleOffset = samples[start + eop._yCelestialPoleOffsetRadiansColumn];
  15326. result.ut1MinusUtc = samples[start + eop._ut1MinusUtcSecondsColumn];
  15327. }
  15328. function linearInterp(dx, y1, y2) {
  15329. return y1 + dx * (y2 - y1);
  15330. }
  15331. function interpolate(eop, dates, samples, date, before, after, result) {
  15332. const columnCount = eop._columnCount;
  15333. if (after > dates.length - 1) {
  15334. result.xPoleWander = 0;
  15335. result.yPoleWander = 0;
  15336. result.xPoleOffset = 0;
  15337. result.yPoleOffset = 0;
  15338. result.ut1MinusUtc = 0;
  15339. return result;
  15340. }
  15341. const beforeDate = dates[before];
  15342. const afterDate = dates[after];
  15343. if (beforeDate.equals(afterDate) || date.equals(beforeDate)) {
  15344. fillResultFromIndex(eop, samples, before, columnCount, result);
  15345. return result;
  15346. } else if (date.equals(afterDate)) {
  15347. fillResultFromIndex(eop, samples, after, columnCount, result);
  15348. return result;
  15349. }
  15350. const factor2 = JulianDate_default.secondsDifference(date, beforeDate) / JulianDate_default.secondsDifference(afterDate, beforeDate);
  15351. const startBefore = before * columnCount;
  15352. const startAfter = after * columnCount;
  15353. let beforeUt1MinusUtc = samples[startBefore + eop._ut1MinusUtcSecondsColumn];
  15354. let afterUt1MinusUtc = samples[startAfter + eop._ut1MinusUtcSecondsColumn];
  15355. const offsetDifference = afterUt1MinusUtc - beforeUt1MinusUtc;
  15356. if (offsetDifference > 0.5 || offsetDifference < -0.5) {
  15357. const beforeTaiMinusUtc = samples[startBefore + eop._taiMinusUtcSecondsColumn];
  15358. const afterTaiMinusUtc = samples[startAfter + eop._taiMinusUtcSecondsColumn];
  15359. if (beforeTaiMinusUtc !== afterTaiMinusUtc) {
  15360. if (afterDate.equals(date)) {
  15361. beforeUt1MinusUtc = afterUt1MinusUtc;
  15362. } else {
  15363. afterUt1MinusUtc -= afterTaiMinusUtc - beforeTaiMinusUtc;
  15364. }
  15365. }
  15366. }
  15367. result.xPoleWander = linearInterp(
  15368. factor2,
  15369. samples[startBefore + eop._xPoleWanderRadiansColumn],
  15370. samples[startAfter + eop._xPoleWanderRadiansColumn]
  15371. );
  15372. result.yPoleWander = linearInterp(
  15373. factor2,
  15374. samples[startBefore + eop._yPoleWanderRadiansColumn],
  15375. samples[startAfter + eop._yPoleWanderRadiansColumn]
  15376. );
  15377. result.xPoleOffset = linearInterp(
  15378. factor2,
  15379. samples[startBefore + eop._xCelestialPoleOffsetRadiansColumn],
  15380. samples[startAfter + eop._xCelestialPoleOffsetRadiansColumn]
  15381. );
  15382. result.yPoleOffset = linearInterp(
  15383. factor2,
  15384. samples[startBefore + eop._yCelestialPoleOffsetRadiansColumn],
  15385. samples[startAfter + eop._yCelestialPoleOffsetRadiansColumn]
  15386. );
  15387. result.ut1MinusUtc = linearInterp(
  15388. factor2,
  15389. beforeUt1MinusUtc,
  15390. afterUt1MinusUtc
  15391. );
  15392. return result;
  15393. }
  15394. var EarthOrientationParameters_default = EarthOrientationParameters;
  15395. // node_modules/cesium/Source/Core/HeadingPitchRoll.js
  15396. function HeadingPitchRoll(heading, pitch, roll) {
  15397. this.heading = defaultValue_default(heading, 0);
  15398. this.pitch = defaultValue_default(pitch, 0);
  15399. this.roll = defaultValue_default(roll, 0);
  15400. }
  15401. HeadingPitchRoll.fromQuaternion = function(quaternion, result) {
  15402. if (!defined_default(quaternion)) {
  15403. throw new DeveloperError_default("quaternion is required");
  15404. }
  15405. if (!defined_default(result)) {
  15406. result = new HeadingPitchRoll();
  15407. }
  15408. const test = 2 * (quaternion.w * quaternion.y - quaternion.z * quaternion.x);
  15409. const denominatorRoll = 1 - 2 * (quaternion.x * quaternion.x + quaternion.y * quaternion.y);
  15410. const numeratorRoll = 2 * (quaternion.w * quaternion.x + quaternion.y * quaternion.z);
  15411. const denominatorHeading = 1 - 2 * (quaternion.y * quaternion.y + quaternion.z * quaternion.z);
  15412. const numeratorHeading = 2 * (quaternion.w * quaternion.z + quaternion.x * quaternion.y);
  15413. result.heading = -Math.atan2(numeratorHeading, denominatorHeading);
  15414. result.roll = Math.atan2(numeratorRoll, denominatorRoll);
  15415. result.pitch = -Math_default.asinClamped(test);
  15416. return result;
  15417. };
  15418. HeadingPitchRoll.fromDegrees = function(heading, pitch, roll, result) {
  15419. if (!defined_default(heading)) {
  15420. throw new DeveloperError_default("heading is required");
  15421. }
  15422. if (!defined_default(pitch)) {
  15423. throw new DeveloperError_default("pitch is required");
  15424. }
  15425. if (!defined_default(roll)) {
  15426. throw new DeveloperError_default("roll is required");
  15427. }
  15428. if (!defined_default(result)) {
  15429. result = new HeadingPitchRoll();
  15430. }
  15431. result.heading = heading * Math_default.RADIANS_PER_DEGREE;
  15432. result.pitch = pitch * Math_default.RADIANS_PER_DEGREE;
  15433. result.roll = roll * Math_default.RADIANS_PER_DEGREE;
  15434. return result;
  15435. };
  15436. HeadingPitchRoll.clone = function(headingPitchRoll, result) {
  15437. if (!defined_default(headingPitchRoll)) {
  15438. return void 0;
  15439. }
  15440. if (!defined_default(result)) {
  15441. return new HeadingPitchRoll(
  15442. headingPitchRoll.heading,
  15443. headingPitchRoll.pitch,
  15444. headingPitchRoll.roll
  15445. );
  15446. }
  15447. result.heading = headingPitchRoll.heading;
  15448. result.pitch = headingPitchRoll.pitch;
  15449. result.roll = headingPitchRoll.roll;
  15450. return result;
  15451. };
  15452. HeadingPitchRoll.equals = function(left, right) {
  15453. return left === right || defined_default(left) && defined_default(right) && left.heading === right.heading && left.pitch === right.pitch && left.roll === right.roll;
  15454. };
  15455. HeadingPitchRoll.equalsEpsilon = function(left, right, relativeEpsilon, absoluteEpsilon) {
  15456. return left === right || defined_default(left) && defined_default(right) && Math_default.equalsEpsilon(
  15457. left.heading,
  15458. right.heading,
  15459. relativeEpsilon,
  15460. absoluteEpsilon
  15461. ) && Math_default.equalsEpsilon(
  15462. left.pitch,
  15463. right.pitch,
  15464. relativeEpsilon,
  15465. absoluteEpsilon
  15466. ) && Math_default.equalsEpsilon(
  15467. left.roll,
  15468. right.roll,
  15469. relativeEpsilon,
  15470. absoluteEpsilon
  15471. );
  15472. };
  15473. HeadingPitchRoll.prototype.clone = function(result) {
  15474. return HeadingPitchRoll.clone(this, result);
  15475. };
  15476. HeadingPitchRoll.prototype.equals = function(right) {
  15477. return HeadingPitchRoll.equals(this, right);
  15478. };
  15479. HeadingPitchRoll.prototype.equalsEpsilon = function(right, relativeEpsilon, absoluteEpsilon) {
  15480. return HeadingPitchRoll.equalsEpsilon(
  15481. this,
  15482. right,
  15483. relativeEpsilon,
  15484. absoluteEpsilon
  15485. );
  15486. };
  15487. HeadingPitchRoll.prototype.toString = function() {
  15488. return `(${this.heading}, ${this.pitch}, ${this.roll})`;
  15489. };
  15490. var HeadingPitchRoll_default = HeadingPitchRoll;
  15491. // node_modules/cesium/Source/Core/Iau2006XysSample.js
  15492. function Iau2006XysSample(x, y, s2) {
  15493. this.x = x;
  15494. this.y = y;
  15495. this.s = s2;
  15496. }
  15497. var Iau2006XysSample_default = Iau2006XysSample;
  15498. // node_modules/cesium/Source/Core/Iau2006XysData.js
  15499. function Iau2006XysData(options) {
  15500. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  15501. this._xysFileUrlTemplate = Resource_default.createIfNeeded(
  15502. options.xysFileUrlTemplate
  15503. );
  15504. this._interpolationOrder = defaultValue_default(options.interpolationOrder, 9);
  15505. this._sampleZeroJulianEphemerisDate = defaultValue_default(
  15506. options.sampleZeroJulianEphemerisDate,
  15507. 24423965e-1
  15508. );
  15509. this._sampleZeroDateTT = new JulianDate_default(
  15510. this._sampleZeroJulianEphemerisDate,
  15511. 0,
  15512. TimeStandard_default.TAI
  15513. );
  15514. this._stepSizeDays = defaultValue_default(options.stepSizeDays, 1);
  15515. this._samplesPerXysFile = defaultValue_default(options.samplesPerXysFile, 1e3);
  15516. this._totalSamples = defaultValue_default(options.totalSamples, 27426);
  15517. this._samples = new Array(this._totalSamples * 3);
  15518. this._chunkDownloadsInProgress = [];
  15519. const order = this._interpolationOrder;
  15520. const denom = this._denominators = new Array(order + 1);
  15521. const xTable = this._xTable = new Array(order + 1);
  15522. const stepN = Math.pow(this._stepSizeDays, order);
  15523. for (let i2 = 0; i2 <= order; ++i2) {
  15524. denom[i2] = stepN;
  15525. xTable[i2] = i2 * this._stepSizeDays;
  15526. for (let j = 0; j <= order; ++j) {
  15527. if (j !== i2) {
  15528. denom[i2] *= i2 - j;
  15529. }
  15530. }
  15531. denom[i2] = 1 / denom[i2];
  15532. }
  15533. this._work = new Array(order + 1);
  15534. this._coef = new Array(order + 1);
  15535. }
  15536. var julianDateScratch = new JulianDate_default(0, 0, TimeStandard_default.TAI);
  15537. function getDaysSinceEpoch(xys, dayTT, secondTT) {
  15538. const dateTT2 = julianDateScratch;
  15539. dateTT2.dayNumber = dayTT;
  15540. dateTT2.secondsOfDay = secondTT;
  15541. return JulianDate_default.daysDifference(dateTT2, xys._sampleZeroDateTT);
  15542. }
  15543. Iau2006XysData.prototype.preload = function(startDayTT, startSecondTT, stopDayTT, stopSecondTT) {
  15544. const startDaysSinceEpoch = getDaysSinceEpoch(
  15545. this,
  15546. startDayTT,
  15547. startSecondTT
  15548. );
  15549. const stopDaysSinceEpoch = getDaysSinceEpoch(this, stopDayTT, stopSecondTT);
  15550. let startIndex = startDaysSinceEpoch / this._stepSizeDays - this._interpolationOrder / 2 | 0;
  15551. if (startIndex < 0) {
  15552. startIndex = 0;
  15553. }
  15554. let stopIndex = stopDaysSinceEpoch / this._stepSizeDays - this._interpolationOrder / 2 | 0 + this._interpolationOrder;
  15555. if (stopIndex >= this._totalSamples) {
  15556. stopIndex = this._totalSamples - 1;
  15557. }
  15558. const startChunk = startIndex / this._samplesPerXysFile | 0;
  15559. const stopChunk = stopIndex / this._samplesPerXysFile | 0;
  15560. const promises = [];
  15561. for (let i2 = startChunk; i2 <= stopChunk; ++i2) {
  15562. promises.push(requestXysChunk(this, i2));
  15563. }
  15564. return Promise.all(promises);
  15565. };
  15566. Iau2006XysData.prototype.computeXysRadians = function(dayTT, secondTT, result) {
  15567. const daysSinceEpoch = getDaysSinceEpoch(this, dayTT, secondTT);
  15568. if (daysSinceEpoch < 0) {
  15569. return void 0;
  15570. }
  15571. const centerIndex = daysSinceEpoch / this._stepSizeDays | 0;
  15572. if (centerIndex >= this._totalSamples) {
  15573. return void 0;
  15574. }
  15575. const degree = this._interpolationOrder;
  15576. let firstIndex = centerIndex - (degree / 2 | 0);
  15577. if (firstIndex < 0) {
  15578. firstIndex = 0;
  15579. }
  15580. let lastIndex = firstIndex + degree;
  15581. if (lastIndex >= this._totalSamples) {
  15582. lastIndex = this._totalSamples - 1;
  15583. firstIndex = lastIndex - degree;
  15584. if (firstIndex < 0) {
  15585. firstIndex = 0;
  15586. }
  15587. }
  15588. let isDataMissing = false;
  15589. const samples = this._samples;
  15590. if (!defined_default(samples[firstIndex * 3])) {
  15591. requestXysChunk(this, firstIndex / this._samplesPerXysFile | 0);
  15592. isDataMissing = true;
  15593. }
  15594. if (!defined_default(samples[lastIndex * 3])) {
  15595. requestXysChunk(this, lastIndex / this._samplesPerXysFile | 0);
  15596. isDataMissing = true;
  15597. }
  15598. if (isDataMissing) {
  15599. return void 0;
  15600. }
  15601. if (!defined_default(result)) {
  15602. result = new Iau2006XysSample_default(0, 0, 0);
  15603. } else {
  15604. result.x = 0;
  15605. result.y = 0;
  15606. result.s = 0;
  15607. }
  15608. const x = daysSinceEpoch - firstIndex * this._stepSizeDays;
  15609. const work = this._work;
  15610. const denom = this._denominators;
  15611. const coef = this._coef;
  15612. const xTable = this._xTable;
  15613. let i2, j;
  15614. for (i2 = 0; i2 <= degree; ++i2) {
  15615. work[i2] = x - xTable[i2];
  15616. }
  15617. for (i2 = 0; i2 <= degree; ++i2) {
  15618. coef[i2] = 1;
  15619. for (j = 0; j <= degree; ++j) {
  15620. if (j !== i2) {
  15621. coef[i2] *= work[j];
  15622. }
  15623. }
  15624. coef[i2] *= denom[i2];
  15625. let sampleIndex = (firstIndex + i2) * 3;
  15626. result.x += coef[i2] * samples[sampleIndex++];
  15627. result.y += coef[i2] * samples[sampleIndex++];
  15628. result.s += coef[i2] * samples[sampleIndex];
  15629. }
  15630. return result;
  15631. };
  15632. function requestXysChunk(xysData, chunkIndex) {
  15633. if (xysData._chunkDownloadsInProgress[chunkIndex]) {
  15634. return xysData._chunkDownloadsInProgress[chunkIndex];
  15635. }
  15636. const deferred = defer_default();
  15637. xysData._chunkDownloadsInProgress[chunkIndex] = deferred;
  15638. let chunkUrl;
  15639. const xysFileUrlTemplate = xysData._xysFileUrlTemplate;
  15640. if (defined_default(xysFileUrlTemplate)) {
  15641. chunkUrl = xysFileUrlTemplate.getDerivedResource({
  15642. templateValues: {
  15643. 0: chunkIndex
  15644. }
  15645. });
  15646. } else {
  15647. chunkUrl = new Resource_default({
  15648. url: buildModuleUrl_default(`Assets/IAU2006_XYS/IAU2006_XYS_${chunkIndex}.json`)
  15649. });
  15650. }
  15651. chunkUrl.fetchJson().then(function(chunk) {
  15652. xysData._chunkDownloadsInProgress[chunkIndex] = false;
  15653. const samples = xysData._samples;
  15654. const newSamples = chunk.samples;
  15655. const startIndex = chunkIndex * xysData._samplesPerXysFile * 3;
  15656. for (let i2 = 0, len = newSamples.length; i2 < len; ++i2) {
  15657. samples[startIndex + i2] = newSamples[i2];
  15658. }
  15659. deferred.resolve();
  15660. });
  15661. return deferred.promise;
  15662. }
  15663. var Iau2006XysData_default = Iau2006XysData;
  15664. // node_modules/cesium/Source/Core/Fullscreen.js
  15665. var _supportsFullscreen;
  15666. var _names = {
  15667. requestFullscreen: void 0,
  15668. exitFullscreen: void 0,
  15669. fullscreenEnabled: void 0,
  15670. fullscreenElement: void 0,
  15671. fullscreenchange: void 0,
  15672. fullscreenerror: void 0
  15673. };
  15674. var Fullscreen = {};
  15675. Object.defineProperties(Fullscreen, {
  15676. element: {
  15677. get: function() {
  15678. if (!Fullscreen.supportsFullscreen()) {
  15679. return void 0;
  15680. }
  15681. return document[_names.fullscreenElement];
  15682. }
  15683. },
  15684. changeEventName: {
  15685. get: function() {
  15686. if (!Fullscreen.supportsFullscreen()) {
  15687. return void 0;
  15688. }
  15689. return _names.fullscreenchange;
  15690. }
  15691. },
  15692. errorEventName: {
  15693. get: function() {
  15694. if (!Fullscreen.supportsFullscreen()) {
  15695. return void 0;
  15696. }
  15697. return _names.fullscreenerror;
  15698. }
  15699. },
  15700. enabled: {
  15701. get: function() {
  15702. if (!Fullscreen.supportsFullscreen()) {
  15703. return void 0;
  15704. }
  15705. return document[_names.fullscreenEnabled];
  15706. }
  15707. },
  15708. fullscreen: {
  15709. get: function() {
  15710. if (!Fullscreen.supportsFullscreen()) {
  15711. return void 0;
  15712. }
  15713. return Fullscreen.element !== null;
  15714. }
  15715. }
  15716. });
  15717. Fullscreen.supportsFullscreen = function() {
  15718. if (defined_default(_supportsFullscreen)) {
  15719. return _supportsFullscreen;
  15720. }
  15721. _supportsFullscreen = false;
  15722. const body = document.body;
  15723. if (typeof body.requestFullscreen === "function") {
  15724. _names.requestFullscreen = "requestFullscreen";
  15725. _names.exitFullscreen = "exitFullscreen";
  15726. _names.fullscreenEnabled = "fullscreenEnabled";
  15727. _names.fullscreenElement = "fullscreenElement";
  15728. _names.fullscreenchange = "fullscreenchange";
  15729. _names.fullscreenerror = "fullscreenerror";
  15730. _supportsFullscreen = true;
  15731. return _supportsFullscreen;
  15732. }
  15733. const prefixes = ["webkit", "moz", "o", "ms", "khtml"];
  15734. let name;
  15735. for (let i2 = 0, len = prefixes.length; i2 < len; ++i2) {
  15736. const prefix = prefixes[i2];
  15737. name = `${prefix}RequestFullscreen`;
  15738. if (typeof body[name] === "function") {
  15739. _names.requestFullscreen = name;
  15740. _supportsFullscreen = true;
  15741. } else {
  15742. name = `${prefix}RequestFullScreen`;
  15743. if (typeof body[name] === "function") {
  15744. _names.requestFullscreen = name;
  15745. _supportsFullscreen = true;
  15746. }
  15747. }
  15748. name = `${prefix}ExitFullscreen`;
  15749. if (typeof document[name] === "function") {
  15750. _names.exitFullscreen = name;
  15751. } else {
  15752. name = `${prefix}CancelFullScreen`;
  15753. if (typeof document[name] === "function") {
  15754. _names.exitFullscreen = name;
  15755. }
  15756. }
  15757. name = `${prefix}FullscreenEnabled`;
  15758. if (document[name] !== void 0) {
  15759. _names.fullscreenEnabled = name;
  15760. } else {
  15761. name = `${prefix}FullScreenEnabled`;
  15762. if (document[name] !== void 0) {
  15763. _names.fullscreenEnabled = name;
  15764. }
  15765. }
  15766. name = `${prefix}FullscreenElement`;
  15767. if (document[name] !== void 0) {
  15768. _names.fullscreenElement = name;
  15769. } else {
  15770. name = `${prefix}FullScreenElement`;
  15771. if (document[name] !== void 0) {
  15772. _names.fullscreenElement = name;
  15773. }
  15774. }
  15775. name = `${prefix}fullscreenchange`;
  15776. if (document[`on${name}`] !== void 0) {
  15777. if (prefix === "ms") {
  15778. name = "MSFullscreenChange";
  15779. }
  15780. _names.fullscreenchange = name;
  15781. }
  15782. name = `${prefix}fullscreenerror`;
  15783. if (document[`on${name}`] !== void 0) {
  15784. if (prefix === "ms") {
  15785. name = "MSFullscreenError";
  15786. }
  15787. _names.fullscreenerror = name;
  15788. }
  15789. }
  15790. return _supportsFullscreen;
  15791. };
  15792. Fullscreen.requestFullscreen = function(element, vrDevice) {
  15793. if (!Fullscreen.supportsFullscreen()) {
  15794. return;
  15795. }
  15796. element[_names.requestFullscreen]({ vrDisplay: vrDevice });
  15797. };
  15798. Fullscreen.exitFullscreen = function() {
  15799. if (!Fullscreen.supportsFullscreen()) {
  15800. return;
  15801. }
  15802. document[_names.exitFullscreen]();
  15803. };
  15804. Fullscreen._names = _names;
  15805. var Fullscreen_default = Fullscreen;
  15806. // node_modules/cesium/Source/Core/FeatureDetection.js
  15807. var theNavigator;
  15808. if (typeof navigator !== "undefined") {
  15809. theNavigator = navigator;
  15810. } else {
  15811. theNavigator = {};
  15812. }
  15813. function extractVersion(versionString) {
  15814. const parts = versionString.split(".");
  15815. for (let i2 = 0, len = parts.length; i2 < len; ++i2) {
  15816. parts[i2] = parseInt(parts[i2], 10);
  15817. }
  15818. return parts;
  15819. }
  15820. var isChromeResult;
  15821. var chromeVersionResult;
  15822. function isChrome() {
  15823. if (!defined_default(isChromeResult)) {
  15824. isChromeResult = false;
  15825. if (!isEdge()) {
  15826. const fields = / Chrome\/([\.0-9]+)/.exec(theNavigator.userAgent);
  15827. if (fields !== null) {
  15828. isChromeResult = true;
  15829. chromeVersionResult = extractVersion(fields[1]);
  15830. }
  15831. }
  15832. }
  15833. return isChromeResult;
  15834. }
  15835. function chromeVersion() {
  15836. return isChrome() && chromeVersionResult;
  15837. }
  15838. var isSafariResult;
  15839. var safariVersionResult;
  15840. function isSafari() {
  15841. if (!defined_default(isSafariResult)) {
  15842. isSafariResult = false;
  15843. if (!isChrome() && !isEdge() && / Safari\/[\.0-9]+/.test(theNavigator.userAgent)) {
  15844. const fields = / Version\/([\.0-9]+)/.exec(theNavigator.userAgent);
  15845. if (fields !== null) {
  15846. isSafariResult = true;
  15847. safariVersionResult = extractVersion(fields[1]);
  15848. }
  15849. }
  15850. }
  15851. return isSafariResult;
  15852. }
  15853. function safariVersion() {
  15854. return isSafari() && safariVersionResult;
  15855. }
  15856. var isWebkitResult;
  15857. var webkitVersionResult;
  15858. function isWebkit() {
  15859. if (!defined_default(isWebkitResult)) {
  15860. isWebkitResult = false;
  15861. const fields = / AppleWebKit\/([\.0-9]+)(\+?)/.exec(theNavigator.userAgent);
  15862. if (fields !== null) {
  15863. isWebkitResult = true;
  15864. webkitVersionResult = extractVersion(fields[1]);
  15865. webkitVersionResult.isNightly = !!fields[2];
  15866. }
  15867. }
  15868. return isWebkitResult;
  15869. }
  15870. function webkitVersion() {
  15871. return isWebkit() && webkitVersionResult;
  15872. }
  15873. var isInternetExplorerResult;
  15874. var internetExplorerVersionResult;
  15875. function isInternetExplorer() {
  15876. if (!defined_default(isInternetExplorerResult)) {
  15877. isInternetExplorerResult = false;
  15878. let fields;
  15879. if (theNavigator.appName === "Microsoft Internet Explorer") {
  15880. fields = /MSIE ([0-9]{1,}[\.0-9]{0,})/.exec(theNavigator.userAgent);
  15881. if (fields !== null) {
  15882. isInternetExplorerResult = true;
  15883. internetExplorerVersionResult = extractVersion(fields[1]);
  15884. }
  15885. } else if (theNavigator.appName === "Netscape") {
  15886. fields = /Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(
  15887. theNavigator.userAgent
  15888. );
  15889. if (fields !== null) {
  15890. isInternetExplorerResult = true;
  15891. internetExplorerVersionResult = extractVersion(fields[1]);
  15892. }
  15893. }
  15894. }
  15895. return isInternetExplorerResult;
  15896. }
  15897. function internetExplorerVersion() {
  15898. return isInternetExplorer() && internetExplorerVersionResult;
  15899. }
  15900. var isEdgeResult;
  15901. var edgeVersionResult;
  15902. function isEdge() {
  15903. if (!defined_default(isEdgeResult)) {
  15904. isEdgeResult = false;
  15905. const fields = / Edge\/([\.0-9]+)/.exec(theNavigator.userAgent);
  15906. if (fields !== null) {
  15907. isEdgeResult = true;
  15908. edgeVersionResult = extractVersion(fields[1]);
  15909. }
  15910. }
  15911. return isEdgeResult;
  15912. }
  15913. function edgeVersion() {
  15914. return isEdge() && edgeVersionResult;
  15915. }
  15916. var isFirefoxResult;
  15917. var firefoxVersionResult;
  15918. function isFirefox() {
  15919. if (!defined_default(isFirefoxResult)) {
  15920. isFirefoxResult = false;
  15921. const fields = /Firefox\/([\.0-9]+)/.exec(theNavigator.userAgent);
  15922. if (fields !== null) {
  15923. isFirefoxResult = true;
  15924. firefoxVersionResult = extractVersion(fields[1]);
  15925. }
  15926. }
  15927. return isFirefoxResult;
  15928. }
  15929. var isWindowsResult;
  15930. function isWindows() {
  15931. if (!defined_default(isWindowsResult)) {
  15932. isWindowsResult = /Windows/i.test(theNavigator.appVersion);
  15933. }
  15934. return isWindowsResult;
  15935. }
  15936. var isIPadOrIOSResult;
  15937. function isIPadOrIOS() {
  15938. if (!defined_default(isIPadOrIOSResult)) {
  15939. isIPadOrIOSResult = navigator.platform === "iPhone" || navigator.platform === "iPod" || navigator.platform === "iPad";
  15940. }
  15941. return isIPadOrIOSResult;
  15942. }
  15943. function firefoxVersion() {
  15944. return isFirefox() && firefoxVersionResult;
  15945. }
  15946. var hasPointerEvents;
  15947. function supportsPointerEvents() {
  15948. if (!defined_default(hasPointerEvents)) {
  15949. hasPointerEvents = !isFirefox() && typeof PointerEvent !== "undefined" && (!defined_default(theNavigator.pointerEnabled) || theNavigator.pointerEnabled);
  15950. }
  15951. return hasPointerEvents;
  15952. }
  15953. var imageRenderingValueResult;
  15954. var supportsImageRenderingPixelatedResult;
  15955. function supportsImageRenderingPixelated() {
  15956. if (!defined_default(supportsImageRenderingPixelatedResult)) {
  15957. const canvas = document.createElement("canvas");
  15958. canvas.setAttribute(
  15959. "style",
  15960. "image-rendering: -moz-crisp-edges;image-rendering: pixelated;"
  15961. );
  15962. const tmp2 = canvas.style.imageRendering;
  15963. supportsImageRenderingPixelatedResult = defined_default(tmp2) && tmp2 !== "";
  15964. if (supportsImageRenderingPixelatedResult) {
  15965. imageRenderingValueResult = tmp2;
  15966. }
  15967. }
  15968. return supportsImageRenderingPixelatedResult;
  15969. }
  15970. function imageRenderingValue() {
  15971. return supportsImageRenderingPixelated() ? imageRenderingValueResult : void 0;
  15972. }
  15973. function supportsWebP() {
  15974. if (!supportsWebP.initialized) {
  15975. throw new DeveloperError_default(
  15976. "You must call FeatureDetection.supportsWebP.initialize and wait for the promise to resolve before calling FeatureDetection.supportsWebP"
  15977. );
  15978. }
  15979. return supportsWebP._result;
  15980. }
  15981. supportsWebP._promise = void 0;
  15982. supportsWebP._result = void 0;
  15983. supportsWebP.initialize = function() {
  15984. if (defined_default(supportsWebP._promise)) {
  15985. return supportsWebP._promise;
  15986. }
  15987. const supportsWebPDeferred = defer_default();
  15988. supportsWebP._promise = supportsWebPDeferred.promise;
  15989. if (isEdge()) {
  15990. supportsWebP._result = false;
  15991. supportsWebPDeferred.resolve(supportsWebP._result);
  15992. return supportsWebPDeferred.promise;
  15993. }
  15994. const image = new Image();
  15995. image.onload = function() {
  15996. supportsWebP._result = image.width > 0 && image.height > 0;
  15997. supportsWebPDeferred.resolve(supportsWebP._result);
  15998. };
  15999. image.onerror = function() {
  16000. supportsWebP._result = false;
  16001. supportsWebPDeferred.resolve(supportsWebP._result);
  16002. };
  16003. image.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA";
  16004. return supportsWebPDeferred.promise;
  16005. };
  16006. Object.defineProperties(supportsWebP, {
  16007. initialized: {
  16008. get: function() {
  16009. return defined_default(supportsWebP._result);
  16010. }
  16011. }
  16012. });
  16013. var typedArrayTypes = [];
  16014. if (typeof ArrayBuffer !== "undefined") {
  16015. typedArrayTypes.push(
  16016. Int8Array,
  16017. Uint8Array,
  16018. Int16Array,
  16019. Uint16Array,
  16020. Int32Array,
  16021. Uint32Array,
  16022. Float32Array,
  16023. Float64Array
  16024. );
  16025. if (typeof Uint8ClampedArray !== "undefined") {
  16026. typedArrayTypes.push(Uint8ClampedArray);
  16027. }
  16028. if (typeof Uint8ClampedArray !== "undefined") {
  16029. typedArrayTypes.push(Uint8ClampedArray);
  16030. }
  16031. if (typeof BigInt64Array !== "undefined") {
  16032. typedArrayTypes.push(BigInt64Array);
  16033. }
  16034. if (typeof BigUint64Array !== "undefined") {
  16035. typedArrayTypes.push(BigUint64Array);
  16036. }
  16037. }
  16038. var FeatureDetection = {
  16039. isChrome,
  16040. chromeVersion,
  16041. isSafari,
  16042. safariVersion,
  16043. isWebkit,
  16044. webkitVersion,
  16045. isInternetExplorer,
  16046. internetExplorerVersion,
  16047. isEdge,
  16048. edgeVersion,
  16049. isFirefox,
  16050. firefoxVersion,
  16051. isWindows,
  16052. isIPadOrIOS,
  16053. hardwareConcurrency: defaultValue_default(theNavigator.hardwareConcurrency, 3),
  16054. supportsPointerEvents,
  16055. supportsImageRenderingPixelated,
  16056. supportsWebP,
  16057. imageRenderingValue,
  16058. typedArrayTypes
  16059. };
  16060. FeatureDetection.supportsBasis = function(scene) {
  16061. return FeatureDetection.supportsWebAssembly() && scene.context.supportsBasis;
  16062. };
  16063. FeatureDetection.supportsFullscreen = function() {
  16064. return Fullscreen_default.supportsFullscreen();
  16065. };
  16066. FeatureDetection.supportsTypedArrays = function() {
  16067. return typeof ArrayBuffer !== "undefined";
  16068. };
  16069. FeatureDetection.supportsBigInt64Array = function() {
  16070. return typeof BigInt64Array !== "undefined";
  16071. };
  16072. FeatureDetection.supportsBigUint64Array = function() {
  16073. return typeof BigUint64Array !== "undefined";
  16074. };
  16075. FeatureDetection.supportsBigInt = function() {
  16076. return typeof BigInt !== "undefined";
  16077. };
  16078. FeatureDetection.supportsWebWorkers = function() {
  16079. return typeof Worker !== "undefined";
  16080. };
  16081. FeatureDetection.supportsWebAssembly = function() {
  16082. return typeof WebAssembly !== "undefined" && !FeatureDetection.isEdge();
  16083. };
  16084. var FeatureDetection_default = FeatureDetection;
  16085. // node_modules/cesium/Source/Core/Quaternion.js
  16086. function Quaternion(x, y, z, w) {
  16087. this.x = defaultValue_default(x, 0);
  16088. this.y = defaultValue_default(y, 0);
  16089. this.z = defaultValue_default(z, 0);
  16090. this.w = defaultValue_default(w, 0);
  16091. }
  16092. var fromAxisAngleScratch = new Cartesian3_default();
  16093. Quaternion.fromAxisAngle = function(axis, angle, result) {
  16094. Check_default.typeOf.object("axis", axis);
  16095. Check_default.typeOf.number("angle", angle);
  16096. const halfAngle = angle / 2;
  16097. const s2 = Math.sin(halfAngle);
  16098. fromAxisAngleScratch = Cartesian3_default.normalize(axis, fromAxisAngleScratch);
  16099. const x = fromAxisAngleScratch.x * s2;
  16100. const y = fromAxisAngleScratch.y * s2;
  16101. const z = fromAxisAngleScratch.z * s2;
  16102. const w = Math.cos(halfAngle);
  16103. if (!defined_default(result)) {
  16104. return new Quaternion(x, y, z, w);
  16105. }
  16106. result.x = x;
  16107. result.y = y;
  16108. result.z = z;
  16109. result.w = w;
  16110. return result;
  16111. };
  16112. var fromRotationMatrixNext = [1, 2, 0];
  16113. var fromRotationMatrixQuat = new Array(3);
  16114. Quaternion.fromRotationMatrix = function(matrix, result) {
  16115. Check_default.typeOf.object("matrix", matrix);
  16116. let root;
  16117. let x;
  16118. let y;
  16119. let z;
  16120. let w;
  16121. const m00 = matrix[Matrix3_default.COLUMN0ROW0];
  16122. const m11 = matrix[Matrix3_default.COLUMN1ROW1];
  16123. const m22 = matrix[Matrix3_default.COLUMN2ROW2];
  16124. const trace = m00 + m11 + m22;
  16125. if (trace > 0) {
  16126. root = Math.sqrt(trace + 1);
  16127. w = 0.5 * root;
  16128. root = 0.5 / root;
  16129. x = (matrix[Matrix3_default.COLUMN1ROW2] - matrix[Matrix3_default.COLUMN2ROW1]) * root;
  16130. y = (matrix[Matrix3_default.COLUMN2ROW0] - matrix[Matrix3_default.COLUMN0ROW2]) * root;
  16131. z = (matrix[Matrix3_default.COLUMN0ROW1] - matrix[Matrix3_default.COLUMN1ROW0]) * root;
  16132. } else {
  16133. const next = fromRotationMatrixNext;
  16134. let i2 = 0;
  16135. if (m11 > m00) {
  16136. i2 = 1;
  16137. }
  16138. if (m22 > m00 && m22 > m11) {
  16139. i2 = 2;
  16140. }
  16141. const j = next[i2];
  16142. const k = next[j];
  16143. root = Math.sqrt(
  16144. matrix[Matrix3_default.getElementIndex(i2, i2)] - matrix[Matrix3_default.getElementIndex(j, j)] - matrix[Matrix3_default.getElementIndex(k, k)] + 1
  16145. );
  16146. const quat = fromRotationMatrixQuat;
  16147. quat[i2] = 0.5 * root;
  16148. root = 0.5 / root;
  16149. w = (matrix[Matrix3_default.getElementIndex(k, j)] - matrix[Matrix3_default.getElementIndex(j, k)]) * root;
  16150. quat[j] = (matrix[Matrix3_default.getElementIndex(j, i2)] + matrix[Matrix3_default.getElementIndex(i2, j)]) * root;
  16151. quat[k] = (matrix[Matrix3_default.getElementIndex(k, i2)] + matrix[Matrix3_default.getElementIndex(i2, k)]) * root;
  16152. x = -quat[0];
  16153. y = -quat[1];
  16154. z = -quat[2];
  16155. }
  16156. if (!defined_default(result)) {
  16157. return new Quaternion(x, y, z, w);
  16158. }
  16159. result.x = x;
  16160. result.y = y;
  16161. result.z = z;
  16162. result.w = w;
  16163. return result;
  16164. };
  16165. var scratchHPRQuaternion = new Quaternion();
  16166. var scratchHeadingQuaternion = new Quaternion();
  16167. var scratchPitchQuaternion = new Quaternion();
  16168. var scratchRollQuaternion = new Quaternion();
  16169. Quaternion.fromHeadingPitchRoll = function(headingPitchRoll, result) {
  16170. Check_default.typeOf.object("headingPitchRoll", headingPitchRoll);
  16171. scratchRollQuaternion = Quaternion.fromAxisAngle(
  16172. Cartesian3_default.UNIT_X,
  16173. headingPitchRoll.roll,
  16174. scratchHPRQuaternion
  16175. );
  16176. scratchPitchQuaternion = Quaternion.fromAxisAngle(
  16177. Cartesian3_default.UNIT_Y,
  16178. -headingPitchRoll.pitch,
  16179. result
  16180. );
  16181. result = Quaternion.multiply(
  16182. scratchPitchQuaternion,
  16183. scratchRollQuaternion,
  16184. scratchPitchQuaternion
  16185. );
  16186. scratchHeadingQuaternion = Quaternion.fromAxisAngle(
  16187. Cartesian3_default.UNIT_Z,
  16188. -headingPitchRoll.heading,
  16189. scratchHPRQuaternion
  16190. );
  16191. return Quaternion.multiply(scratchHeadingQuaternion, result, result);
  16192. };
  16193. var sampledQuaternionAxis = new Cartesian3_default();
  16194. var sampledQuaternionRotation = new Cartesian3_default();
  16195. var sampledQuaternionTempQuaternion = new Quaternion();
  16196. var sampledQuaternionQuaternion0 = new Quaternion();
  16197. var sampledQuaternionQuaternion0Conjugate = new Quaternion();
  16198. Quaternion.packedLength = 4;
  16199. Quaternion.pack = function(value, array, startingIndex) {
  16200. Check_default.typeOf.object("value", value);
  16201. Check_default.defined("array", array);
  16202. startingIndex = defaultValue_default(startingIndex, 0);
  16203. array[startingIndex++] = value.x;
  16204. array[startingIndex++] = value.y;
  16205. array[startingIndex++] = value.z;
  16206. array[startingIndex] = value.w;
  16207. return array;
  16208. };
  16209. Quaternion.unpack = function(array, startingIndex, result) {
  16210. Check_default.defined("array", array);
  16211. startingIndex = defaultValue_default(startingIndex, 0);
  16212. if (!defined_default(result)) {
  16213. result = new Quaternion();
  16214. }
  16215. result.x = array[startingIndex];
  16216. result.y = array[startingIndex + 1];
  16217. result.z = array[startingIndex + 2];
  16218. result.w = array[startingIndex + 3];
  16219. return result;
  16220. };
  16221. Quaternion.packedInterpolationLength = 3;
  16222. Quaternion.convertPackedArrayForInterpolation = function(packedArray, startingIndex, lastIndex, result) {
  16223. Quaternion.unpack(
  16224. packedArray,
  16225. lastIndex * 4,
  16226. sampledQuaternionQuaternion0Conjugate
  16227. );
  16228. Quaternion.conjugate(
  16229. sampledQuaternionQuaternion0Conjugate,
  16230. sampledQuaternionQuaternion0Conjugate
  16231. );
  16232. for (let i2 = 0, len = lastIndex - startingIndex + 1; i2 < len; i2++) {
  16233. const offset2 = i2 * 3;
  16234. Quaternion.unpack(
  16235. packedArray,
  16236. (startingIndex + i2) * 4,
  16237. sampledQuaternionTempQuaternion
  16238. );
  16239. Quaternion.multiply(
  16240. sampledQuaternionTempQuaternion,
  16241. sampledQuaternionQuaternion0Conjugate,
  16242. sampledQuaternionTempQuaternion
  16243. );
  16244. if (sampledQuaternionTempQuaternion.w < 0) {
  16245. Quaternion.negate(
  16246. sampledQuaternionTempQuaternion,
  16247. sampledQuaternionTempQuaternion
  16248. );
  16249. }
  16250. Quaternion.computeAxis(
  16251. sampledQuaternionTempQuaternion,
  16252. sampledQuaternionAxis
  16253. );
  16254. const angle = Quaternion.computeAngle(sampledQuaternionTempQuaternion);
  16255. if (!defined_default(result)) {
  16256. result = [];
  16257. }
  16258. result[offset2] = sampledQuaternionAxis.x * angle;
  16259. result[offset2 + 1] = sampledQuaternionAxis.y * angle;
  16260. result[offset2 + 2] = sampledQuaternionAxis.z * angle;
  16261. }
  16262. };
  16263. Quaternion.unpackInterpolationResult = function(array, sourceArray, firstIndex, lastIndex, result) {
  16264. if (!defined_default(result)) {
  16265. result = new Quaternion();
  16266. }
  16267. Cartesian3_default.fromArray(array, 0, sampledQuaternionRotation);
  16268. const magnitude = Cartesian3_default.magnitude(sampledQuaternionRotation);
  16269. Quaternion.unpack(sourceArray, lastIndex * 4, sampledQuaternionQuaternion0);
  16270. if (magnitude === 0) {
  16271. Quaternion.clone(Quaternion.IDENTITY, sampledQuaternionTempQuaternion);
  16272. } else {
  16273. Quaternion.fromAxisAngle(
  16274. sampledQuaternionRotation,
  16275. magnitude,
  16276. sampledQuaternionTempQuaternion
  16277. );
  16278. }
  16279. return Quaternion.multiply(
  16280. sampledQuaternionTempQuaternion,
  16281. sampledQuaternionQuaternion0,
  16282. result
  16283. );
  16284. };
  16285. Quaternion.clone = function(quaternion, result) {
  16286. if (!defined_default(quaternion)) {
  16287. return void 0;
  16288. }
  16289. if (!defined_default(result)) {
  16290. return new Quaternion(
  16291. quaternion.x,
  16292. quaternion.y,
  16293. quaternion.z,
  16294. quaternion.w
  16295. );
  16296. }
  16297. result.x = quaternion.x;
  16298. result.y = quaternion.y;
  16299. result.z = quaternion.z;
  16300. result.w = quaternion.w;
  16301. return result;
  16302. };
  16303. Quaternion.conjugate = function(quaternion, result) {
  16304. Check_default.typeOf.object("quaternion", quaternion);
  16305. Check_default.typeOf.object("result", result);
  16306. result.x = -quaternion.x;
  16307. result.y = -quaternion.y;
  16308. result.z = -quaternion.z;
  16309. result.w = quaternion.w;
  16310. return result;
  16311. };
  16312. Quaternion.magnitudeSquared = function(quaternion) {
  16313. Check_default.typeOf.object("quaternion", quaternion);
  16314. return quaternion.x * quaternion.x + quaternion.y * quaternion.y + quaternion.z * quaternion.z + quaternion.w * quaternion.w;
  16315. };
  16316. Quaternion.magnitude = function(quaternion) {
  16317. return Math.sqrt(Quaternion.magnitudeSquared(quaternion));
  16318. };
  16319. Quaternion.normalize = function(quaternion, result) {
  16320. Check_default.typeOf.object("result", result);
  16321. const inverseMagnitude = 1 / Quaternion.magnitude(quaternion);
  16322. const x = quaternion.x * inverseMagnitude;
  16323. const y = quaternion.y * inverseMagnitude;
  16324. const z = quaternion.z * inverseMagnitude;
  16325. const w = quaternion.w * inverseMagnitude;
  16326. result.x = x;
  16327. result.y = y;
  16328. result.z = z;
  16329. result.w = w;
  16330. return result;
  16331. };
  16332. Quaternion.inverse = function(quaternion, result) {
  16333. Check_default.typeOf.object("result", result);
  16334. const magnitudeSquared = Quaternion.magnitudeSquared(quaternion);
  16335. result = Quaternion.conjugate(quaternion, result);
  16336. return Quaternion.multiplyByScalar(result, 1 / magnitudeSquared, result);
  16337. };
  16338. Quaternion.add = function(left, right, result) {
  16339. Check_default.typeOf.object("left", left);
  16340. Check_default.typeOf.object("right", right);
  16341. Check_default.typeOf.object("result", result);
  16342. result.x = left.x + right.x;
  16343. result.y = left.y + right.y;
  16344. result.z = left.z + right.z;
  16345. result.w = left.w + right.w;
  16346. return result;
  16347. };
  16348. Quaternion.subtract = function(left, right, result) {
  16349. Check_default.typeOf.object("left", left);
  16350. Check_default.typeOf.object("right", right);
  16351. Check_default.typeOf.object("result", result);
  16352. result.x = left.x - right.x;
  16353. result.y = left.y - right.y;
  16354. result.z = left.z - right.z;
  16355. result.w = left.w - right.w;
  16356. return result;
  16357. };
  16358. Quaternion.negate = function(quaternion, result) {
  16359. Check_default.typeOf.object("quaternion", quaternion);
  16360. Check_default.typeOf.object("result", result);
  16361. result.x = -quaternion.x;
  16362. result.y = -quaternion.y;
  16363. result.z = -quaternion.z;
  16364. result.w = -quaternion.w;
  16365. return result;
  16366. };
  16367. Quaternion.dot = function(left, right) {
  16368. Check_default.typeOf.object("left", left);
  16369. Check_default.typeOf.object("right", right);
  16370. return left.x * right.x + left.y * right.y + left.z * right.z + left.w * right.w;
  16371. };
  16372. Quaternion.multiply = function(left, right, result) {
  16373. Check_default.typeOf.object("left", left);
  16374. Check_default.typeOf.object("right", right);
  16375. Check_default.typeOf.object("result", result);
  16376. const leftX = left.x;
  16377. const leftY = left.y;
  16378. const leftZ = left.z;
  16379. const leftW = left.w;
  16380. const rightX = right.x;
  16381. const rightY = right.y;
  16382. const rightZ = right.z;
  16383. const rightW = right.w;
  16384. const x = leftW * rightX + leftX * rightW + leftY * rightZ - leftZ * rightY;
  16385. const y = leftW * rightY - leftX * rightZ + leftY * rightW + leftZ * rightX;
  16386. const z = leftW * rightZ + leftX * rightY - leftY * rightX + leftZ * rightW;
  16387. const w = leftW * rightW - leftX * rightX - leftY * rightY - leftZ * rightZ;
  16388. result.x = x;
  16389. result.y = y;
  16390. result.z = z;
  16391. result.w = w;
  16392. return result;
  16393. };
  16394. Quaternion.multiplyByScalar = function(quaternion, scalar, result) {
  16395. Check_default.typeOf.object("quaternion", quaternion);
  16396. Check_default.typeOf.number("scalar", scalar);
  16397. Check_default.typeOf.object("result", result);
  16398. result.x = quaternion.x * scalar;
  16399. result.y = quaternion.y * scalar;
  16400. result.z = quaternion.z * scalar;
  16401. result.w = quaternion.w * scalar;
  16402. return result;
  16403. };
  16404. Quaternion.divideByScalar = function(quaternion, scalar, result) {
  16405. Check_default.typeOf.object("quaternion", quaternion);
  16406. Check_default.typeOf.number("scalar", scalar);
  16407. Check_default.typeOf.object("result", result);
  16408. result.x = quaternion.x / scalar;
  16409. result.y = quaternion.y / scalar;
  16410. result.z = quaternion.z / scalar;
  16411. result.w = quaternion.w / scalar;
  16412. return result;
  16413. };
  16414. Quaternion.computeAxis = function(quaternion, result) {
  16415. Check_default.typeOf.object("quaternion", quaternion);
  16416. Check_default.typeOf.object("result", result);
  16417. const w = quaternion.w;
  16418. if (Math.abs(w - 1) < Math_default.EPSILON6) {
  16419. result.x = result.y = result.z = 0;
  16420. return result;
  16421. }
  16422. const scalar = 1 / Math.sqrt(1 - w * w);
  16423. result.x = quaternion.x * scalar;
  16424. result.y = quaternion.y * scalar;
  16425. result.z = quaternion.z * scalar;
  16426. return result;
  16427. };
  16428. Quaternion.computeAngle = function(quaternion) {
  16429. Check_default.typeOf.object("quaternion", quaternion);
  16430. if (Math.abs(quaternion.w - 1) < Math_default.EPSILON6) {
  16431. return 0;
  16432. }
  16433. return 2 * Math.acos(quaternion.w);
  16434. };
  16435. var lerpScratch4 = new Quaternion();
  16436. Quaternion.lerp = function(start, end, t, result) {
  16437. Check_default.typeOf.object("start", start);
  16438. Check_default.typeOf.object("end", end);
  16439. Check_default.typeOf.number("t", t);
  16440. Check_default.typeOf.object("result", result);
  16441. lerpScratch4 = Quaternion.multiplyByScalar(end, t, lerpScratch4);
  16442. result = Quaternion.multiplyByScalar(start, 1 - t, result);
  16443. return Quaternion.add(lerpScratch4, result, result);
  16444. };
  16445. var slerpEndNegated = new Quaternion();
  16446. var slerpScaledP = new Quaternion();
  16447. var slerpScaledR = new Quaternion();
  16448. Quaternion.slerp = function(start, end, t, result) {
  16449. Check_default.typeOf.object("start", start);
  16450. Check_default.typeOf.object("end", end);
  16451. Check_default.typeOf.number("t", t);
  16452. Check_default.typeOf.object("result", result);
  16453. let dot2 = Quaternion.dot(start, end);
  16454. let r2 = end;
  16455. if (dot2 < 0) {
  16456. dot2 = -dot2;
  16457. r2 = slerpEndNegated = Quaternion.negate(end, slerpEndNegated);
  16458. }
  16459. if (1 - dot2 < Math_default.EPSILON6) {
  16460. return Quaternion.lerp(start, r2, t, result);
  16461. }
  16462. const theta = Math.acos(dot2);
  16463. slerpScaledP = Quaternion.multiplyByScalar(
  16464. start,
  16465. Math.sin((1 - t) * theta),
  16466. slerpScaledP
  16467. );
  16468. slerpScaledR = Quaternion.multiplyByScalar(
  16469. r2,
  16470. Math.sin(t * theta),
  16471. slerpScaledR
  16472. );
  16473. result = Quaternion.add(slerpScaledP, slerpScaledR, result);
  16474. return Quaternion.multiplyByScalar(result, 1 / Math.sin(theta), result);
  16475. };
  16476. Quaternion.log = function(quaternion, result) {
  16477. Check_default.typeOf.object("quaternion", quaternion);
  16478. Check_default.typeOf.object("result", result);
  16479. const theta = Math_default.acosClamped(quaternion.w);
  16480. let thetaOverSinTheta = 0;
  16481. if (theta !== 0) {
  16482. thetaOverSinTheta = theta / Math.sin(theta);
  16483. }
  16484. return Cartesian3_default.multiplyByScalar(quaternion, thetaOverSinTheta, result);
  16485. };
  16486. Quaternion.exp = function(cartesian11, result) {
  16487. Check_default.typeOf.object("cartesian", cartesian11);
  16488. Check_default.typeOf.object("result", result);
  16489. const theta = Cartesian3_default.magnitude(cartesian11);
  16490. let sinThetaOverTheta = 0;
  16491. if (theta !== 0) {
  16492. sinThetaOverTheta = Math.sin(theta) / theta;
  16493. }
  16494. result.x = cartesian11.x * sinThetaOverTheta;
  16495. result.y = cartesian11.y * sinThetaOverTheta;
  16496. result.z = cartesian11.z * sinThetaOverTheta;
  16497. result.w = Math.cos(theta);
  16498. return result;
  16499. };
  16500. var squadScratchCartesian0 = new Cartesian3_default();
  16501. var squadScratchCartesian1 = new Cartesian3_default();
  16502. var squadScratchQuaternion0 = new Quaternion();
  16503. var squadScratchQuaternion1 = new Quaternion();
  16504. Quaternion.computeInnerQuadrangle = function(q0, q12, q22, result) {
  16505. Check_default.typeOf.object("q0", q0);
  16506. Check_default.typeOf.object("q1", q12);
  16507. Check_default.typeOf.object("q2", q22);
  16508. Check_default.typeOf.object("result", result);
  16509. const qInv = Quaternion.conjugate(q12, squadScratchQuaternion0);
  16510. Quaternion.multiply(qInv, q22, squadScratchQuaternion1);
  16511. const cart0 = Quaternion.log(squadScratchQuaternion1, squadScratchCartesian0);
  16512. Quaternion.multiply(qInv, q0, squadScratchQuaternion1);
  16513. const cart1 = Quaternion.log(squadScratchQuaternion1, squadScratchCartesian1);
  16514. Cartesian3_default.add(cart0, cart1, cart0);
  16515. Cartesian3_default.multiplyByScalar(cart0, 0.25, cart0);
  16516. Cartesian3_default.negate(cart0, cart0);
  16517. Quaternion.exp(cart0, squadScratchQuaternion0);
  16518. return Quaternion.multiply(q12, squadScratchQuaternion0, result);
  16519. };
  16520. Quaternion.squad = function(q0, q12, s0, s1, t, result) {
  16521. Check_default.typeOf.object("q0", q0);
  16522. Check_default.typeOf.object("q1", q12);
  16523. Check_default.typeOf.object("s0", s0);
  16524. Check_default.typeOf.object("s1", s1);
  16525. Check_default.typeOf.number("t", t);
  16526. Check_default.typeOf.object("result", result);
  16527. const slerp0 = Quaternion.slerp(q0, q12, t, squadScratchQuaternion0);
  16528. const slerp1 = Quaternion.slerp(s0, s1, t, squadScratchQuaternion1);
  16529. return Quaternion.slerp(slerp0, slerp1, 2 * t * (1 - t), result);
  16530. };
  16531. var fastSlerpScratchQuaternion = new Quaternion();
  16532. var opmu = 1.9011074535173003;
  16533. var u = FeatureDetection_default.supportsTypedArrays() ? new Float32Array(8) : [];
  16534. var v = FeatureDetection_default.supportsTypedArrays() ? new Float32Array(8) : [];
  16535. var bT = FeatureDetection_default.supportsTypedArrays() ? new Float32Array(8) : [];
  16536. var bD = FeatureDetection_default.supportsTypedArrays() ? new Float32Array(8) : [];
  16537. for (let i2 = 0; i2 < 7; ++i2) {
  16538. const s2 = i2 + 1;
  16539. const t = 2 * s2 + 1;
  16540. u[i2] = 1 / (s2 * t);
  16541. v[i2] = s2 / t;
  16542. }
  16543. u[7] = opmu / (8 * 17);
  16544. v[7] = opmu * 8 / 17;
  16545. Quaternion.fastSlerp = function(start, end, t, result) {
  16546. Check_default.typeOf.object("start", start);
  16547. Check_default.typeOf.object("end", end);
  16548. Check_default.typeOf.number("t", t);
  16549. Check_default.typeOf.object("result", result);
  16550. let x = Quaternion.dot(start, end);
  16551. let sign3;
  16552. if (x >= 0) {
  16553. sign3 = 1;
  16554. } else {
  16555. sign3 = -1;
  16556. x = -x;
  16557. }
  16558. const xm1 = x - 1;
  16559. const d = 1 - t;
  16560. const sqrT = t * t;
  16561. const sqrD = d * d;
  16562. for (let i2 = 7; i2 >= 0; --i2) {
  16563. bT[i2] = (u[i2] * sqrT - v[i2]) * xm1;
  16564. bD[i2] = (u[i2] * sqrD - v[i2]) * xm1;
  16565. }
  16566. const cT = sign3 * t * (1 + bT[0] * (1 + bT[1] * (1 + bT[2] * (1 + bT[3] * (1 + bT[4] * (1 + bT[5] * (1 + bT[6] * (1 + bT[7]))))))));
  16567. const cD = d * (1 + bD[0] * (1 + bD[1] * (1 + bD[2] * (1 + bD[3] * (1 + bD[4] * (1 + bD[5] * (1 + bD[6] * (1 + bD[7]))))))));
  16568. const temp = Quaternion.multiplyByScalar(
  16569. start,
  16570. cD,
  16571. fastSlerpScratchQuaternion
  16572. );
  16573. Quaternion.multiplyByScalar(end, cT, result);
  16574. return Quaternion.add(temp, result, result);
  16575. };
  16576. Quaternion.fastSquad = function(q0, q12, s0, s1, t, result) {
  16577. Check_default.typeOf.object("q0", q0);
  16578. Check_default.typeOf.object("q1", q12);
  16579. Check_default.typeOf.object("s0", s0);
  16580. Check_default.typeOf.object("s1", s1);
  16581. Check_default.typeOf.number("t", t);
  16582. Check_default.typeOf.object("result", result);
  16583. const slerp0 = Quaternion.fastSlerp(q0, q12, t, squadScratchQuaternion0);
  16584. const slerp1 = Quaternion.fastSlerp(s0, s1, t, squadScratchQuaternion1);
  16585. return Quaternion.fastSlerp(slerp0, slerp1, 2 * t * (1 - t), result);
  16586. };
  16587. Quaternion.equals = function(left, right) {
  16588. return left === right || defined_default(left) && defined_default(right) && left.x === right.x && left.y === right.y && left.z === right.z && left.w === right.w;
  16589. };
  16590. Quaternion.equalsEpsilon = function(left, right, epsilon) {
  16591. epsilon = defaultValue_default(epsilon, 0);
  16592. return left === right || defined_default(left) && defined_default(right) && Math.abs(left.x - right.x) <= epsilon && Math.abs(left.y - right.y) <= epsilon && Math.abs(left.z - right.z) <= epsilon && Math.abs(left.w - right.w) <= epsilon;
  16593. };
  16594. Quaternion.ZERO = Object.freeze(new Quaternion(0, 0, 0, 0));
  16595. Quaternion.IDENTITY = Object.freeze(new Quaternion(0, 0, 0, 1));
  16596. Quaternion.prototype.clone = function(result) {
  16597. return Quaternion.clone(this, result);
  16598. };
  16599. Quaternion.prototype.equals = function(right) {
  16600. return Quaternion.equals(this, right);
  16601. };
  16602. Quaternion.prototype.equalsEpsilon = function(right, epsilon) {
  16603. return Quaternion.equalsEpsilon(this, right, epsilon);
  16604. };
  16605. Quaternion.prototype.toString = function() {
  16606. return `(${this.x}, ${this.y}, ${this.z}, ${this.w})`;
  16607. };
  16608. var Quaternion_default = Quaternion;
  16609. // node_modules/cesium/Source/Core/Transforms.js
  16610. var Transforms = {};
  16611. var vectorProductLocalFrame = {
  16612. up: {
  16613. south: "east",
  16614. north: "west",
  16615. west: "south",
  16616. east: "north"
  16617. },
  16618. down: {
  16619. south: "west",
  16620. north: "east",
  16621. west: "north",
  16622. east: "south"
  16623. },
  16624. south: {
  16625. up: "west",
  16626. down: "east",
  16627. west: "down",
  16628. east: "up"
  16629. },
  16630. north: {
  16631. up: "east",
  16632. down: "west",
  16633. west: "up",
  16634. east: "down"
  16635. },
  16636. west: {
  16637. up: "north",
  16638. down: "south",
  16639. north: "down",
  16640. south: "up"
  16641. },
  16642. east: {
  16643. up: "south",
  16644. down: "north",
  16645. north: "up",
  16646. south: "down"
  16647. }
  16648. };
  16649. var degeneratePositionLocalFrame = {
  16650. north: [-1, 0, 0],
  16651. east: [0, 1, 0],
  16652. up: [0, 0, 1],
  16653. south: [1, 0, 0],
  16654. west: [0, -1, 0],
  16655. down: [0, 0, -1]
  16656. };
  16657. var localFrameToFixedFrameCache = {};
  16658. var scratchCalculateCartesian = {
  16659. east: new Cartesian3_default(),
  16660. north: new Cartesian3_default(),
  16661. up: new Cartesian3_default(),
  16662. west: new Cartesian3_default(),
  16663. south: new Cartesian3_default(),
  16664. down: new Cartesian3_default()
  16665. };
  16666. var scratchFirstCartesian = new Cartesian3_default();
  16667. var scratchSecondCartesian = new Cartesian3_default();
  16668. var scratchThirdCartesian = new Cartesian3_default();
  16669. Transforms.localFrameToFixedFrameGenerator = function(firstAxis, secondAxis) {
  16670. if (!vectorProductLocalFrame.hasOwnProperty(firstAxis) || !vectorProductLocalFrame[firstAxis].hasOwnProperty(secondAxis)) {
  16671. throw new DeveloperError_default(
  16672. "firstAxis and secondAxis must be east, north, up, west, south or down."
  16673. );
  16674. }
  16675. const thirdAxis = vectorProductLocalFrame[firstAxis][secondAxis];
  16676. let resultat;
  16677. const hashAxis = firstAxis + secondAxis;
  16678. if (defined_default(localFrameToFixedFrameCache[hashAxis])) {
  16679. resultat = localFrameToFixedFrameCache[hashAxis];
  16680. } else {
  16681. resultat = function(origin, ellipsoid, result) {
  16682. if (!defined_default(origin)) {
  16683. throw new DeveloperError_default("origin is required.");
  16684. }
  16685. if (!defined_default(result)) {
  16686. result = new Matrix4_default();
  16687. }
  16688. if (Cartesian3_default.equalsEpsilon(origin, Cartesian3_default.ZERO, Math_default.EPSILON14)) {
  16689. Cartesian3_default.unpack(
  16690. degeneratePositionLocalFrame[firstAxis],
  16691. 0,
  16692. scratchFirstCartesian
  16693. );
  16694. Cartesian3_default.unpack(
  16695. degeneratePositionLocalFrame[secondAxis],
  16696. 0,
  16697. scratchSecondCartesian
  16698. );
  16699. Cartesian3_default.unpack(
  16700. degeneratePositionLocalFrame[thirdAxis],
  16701. 0,
  16702. scratchThirdCartesian
  16703. );
  16704. } else if (Math_default.equalsEpsilon(origin.x, 0, Math_default.EPSILON14) && Math_default.equalsEpsilon(origin.y, 0, Math_default.EPSILON14)) {
  16705. const sign3 = Math_default.sign(origin.z);
  16706. Cartesian3_default.unpack(
  16707. degeneratePositionLocalFrame[firstAxis],
  16708. 0,
  16709. scratchFirstCartesian
  16710. );
  16711. if (firstAxis !== "east" && firstAxis !== "west") {
  16712. Cartesian3_default.multiplyByScalar(
  16713. scratchFirstCartesian,
  16714. sign3,
  16715. scratchFirstCartesian
  16716. );
  16717. }
  16718. Cartesian3_default.unpack(
  16719. degeneratePositionLocalFrame[secondAxis],
  16720. 0,
  16721. scratchSecondCartesian
  16722. );
  16723. if (secondAxis !== "east" && secondAxis !== "west") {
  16724. Cartesian3_default.multiplyByScalar(
  16725. scratchSecondCartesian,
  16726. sign3,
  16727. scratchSecondCartesian
  16728. );
  16729. }
  16730. Cartesian3_default.unpack(
  16731. degeneratePositionLocalFrame[thirdAxis],
  16732. 0,
  16733. scratchThirdCartesian
  16734. );
  16735. if (thirdAxis !== "east" && thirdAxis !== "west") {
  16736. Cartesian3_default.multiplyByScalar(
  16737. scratchThirdCartesian,
  16738. sign3,
  16739. scratchThirdCartesian
  16740. );
  16741. }
  16742. } else {
  16743. ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  16744. ellipsoid.geodeticSurfaceNormal(origin, scratchCalculateCartesian.up);
  16745. const up = scratchCalculateCartesian.up;
  16746. const east = scratchCalculateCartesian.east;
  16747. east.x = -origin.y;
  16748. east.y = origin.x;
  16749. east.z = 0;
  16750. Cartesian3_default.normalize(east, scratchCalculateCartesian.east);
  16751. Cartesian3_default.cross(up, east, scratchCalculateCartesian.north);
  16752. Cartesian3_default.multiplyByScalar(
  16753. scratchCalculateCartesian.up,
  16754. -1,
  16755. scratchCalculateCartesian.down
  16756. );
  16757. Cartesian3_default.multiplyByScalar(
  16758. scratchCalculateCartesian.east,
  16759. -1,
  16760. scratchCalculateCartesian.west
  16761. );
  16762. Cartesian3_default.multiplyByScalar(
  16763. scratchCalculateCartesian.north,
  16764. -1,
  16765. scratchCalculateCartesian.south
  16766. );
  16767. scratchFirstCartesian = scratchCalculateCartesian[firstAxis];
  16768. scratchSecondCartesian = scratchCalculateCartesian[secondAxis];
  16769. scratchThirdCartesian = scratchCalculateCartesian[thirdAxis];
  16770. }
  16771. result[0] = scratchFirstCartesian.x;
  16772. result[1] = scratchFirstCartesian.y;
  16773. result[2] = scratchFirstCartesian.z;
  16774. result[3] = 0;
  16775. result[4] = scratchSecondCartesian.x;
  16776. result[5] = scratchSecondCartesian.y;
  16777. result[6] = scratchSecondCartesian.z;
  16778. result[7] = 0;
  16779. result[8] = scratchThirdCartesian.x;
  16780. result[9] = scratchThirdCartesian.y;
  16781. result[10] = scratchThirdCartesian.z;
  16782. result[11] = 0;
  16783. result[12] = origin.x;
  16784. result[13] = origin.y;
  16785. result[14] = origin.z;
  16786. result[15] = 1;
  16787. return result;
  16788. };
  16789. localFrameToFixedFrameCache[hashAxis] = resultat;
  16790. }
  16791. return resultat;
  16792. };
  16793. Transforms.eastNorthUpToFixedFrame = Transforms.localFrameToFixedFrameGenerator(
  16794. "east",
  16795. "north"
  16796. );
  16797. Transforms.northEastDownToFixedFrame = Transforms.localFrameToFixedFrameGenerator(
  16798. "north",
  16799. "east"
  16800. );
  16801. Transforms.northUpEastToFixedFrame = Transforms.localFrameToFixedFrameGenerator(
  16802. "north",
  16803. "up"
  16804. );
  16805. Transforms.northWestUpToFixedFrame = Transforms.localFrameToFixedFrameGenerator(
  16806. "north",
  16807. "west"
  16808. );
  16809. var scratchHPRQuaternion2 = new Quaternion_default();
  16810. var scratchScale = new Cartesian3_default(1, 1, 1);
  16811. var scratchHPRMatrix4 = new Matrix4_default();
  16812. Transforms.headingPitchRollToFixedFrame = function(origin, headingPitchRoll, ellipsoid, fixedFrameTransform, result) {
  16813. Check_default.typeOf.object("HeadingPitchRoll", headingPitchRoll);
  16814. fixedFrameTransform = defaultValue_default(
  16815. fixedFrameTransform,
  16816. Transforms.eastNorthUpToFixedFrame
  16817. );
  16818. const hprQuaternion = Quaternion_default.fromHeadingPitchRoll(
  16819. headingPitchRoll,
  16820. scratchHPRQuaternion2
  16821. );
  16822. const hprMatrix = Matrix4_default.fromTranslationQuaternionRotationScale(
  16823. Cartesian3_default.ZERO,
  16824. hprQuaternion,
  16825. scratchScale,
  16826. scratchHPRMatrix4
  16827. );
  16828. result = fixedFrameTransform(origin, ellipsoid, result);
  16829. return Matrix4_default.multiply(result, hprMatrix, result);
  16830. };
  16831. var scratchENUMatrix4 = new Matrix4_default();
  16832. var scratchHPRMatrix3 = new Matrix3_default();
  16833. Transforms.headingPitchRollQuaternion = function(origin, headingPitchRoll, ellipsoid, fixedFrameTransform, result) {
  16834. Check_default.typeOf.object("HeadingPitchRoll", headingPitchRoll);
  16835. const transform4 = Transforms.headingPitchRollToFixedFrame(
  16836. origin,
  16837. headingPitchRoll,
  16838. ellipsoid,
  16839. fixedFrameTransform,
  16840. scratchENUMatrix4
  16841. );
  16842. const rotation = Matrix4_default.getMatrix3(transform4, scratchHPRMatrix3);
  16843. return Quaternion_default.fromRotationMatrix(rotation, result);
  16844. };
  16845. var noScale = new Cartesian3_default(1, 1, 1);
  16846. var hprCenterScratch = new Cartesian3_default();
  16847. var ffScratch = new Matrix4_default();
  16848. var hprTransformScratch = new Matrix4_default();
  16849. var hprRotationScratch = new Matrix3_default();
  16850. var hprQuaternionScratch = new Quaternion_default();
  16851. Transforms.fixedFrameToHeadingPitchRoll = function(transform4, ellipsoid, fixedFrameTransform, result) {
  16852. Check_default.defined("transform", transform4);
  16853. ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  16854. fixedFrameTransform = defaultValue_default(
  16855. fixedFrameTransform,
  16856. Transforms.eastNorthUpToFixedFrame
  16857. );
  16858. if (!defined_default(result)) {
  16859. result = new HeadingPitchRoll_default();
  16860. }
  16861. const center = Matrix4_default.getTranslation(transform4, hprCenterScratch);
  16862. if (Cartesian3_default.equals(center, Cartesian3_default.ZERO)) {
  16863. result.heading = 0;
  16864. result.pitch = 0;
  16865. result.roll = 0;
  16866. return result;
  16867. }
  16868. let toFixedFrame = Matrix4_default.inverseTransformation(
  16869. fixedFrameTransform(center, ellipsoid, ffScratch),
  16870. ffScratch
  16871. );
  16872. let transformCopy = Matrix4_default.setScale(transform4, noScale, hprTransformScratch);
  16873. transformCopy = Matrix4_default.setTranslation(
  16874. transformCopy,
  16875. Cartesian3_default.ZERO,
  16876. transformCopy
  16877. );
  16878. toFixedFrame = Matrix4_default.multiply(toFixedFrame, transformCopy, toFixedFrame);
  16879. let quaternionRotation = Quaternion_default.fromRotationMatrix(
  16880. Matrix4_default.getMatrix3(toFixedFrame, hprRotationScratch),
  16881. hprQuaternionScratch
  16882. );
  16883. quaternionRotation = Quaternion_default.normalize(
  16884. quaternionRotation,
  16885. quaternionRotation
  16886. );
  16887. return HeadingPitchRoll_default.fromQuaternion(quaternionRotation, result);
  16888. };
  16889. var gmstConstant0 = 6 * 3600 + 41 * 60 + 50.54841;
  16890. var gmstConstant1 = 8640184812866e-6;
  16891. var gmstConstant2 = 0.093104;
  16892. var gmstConstant3 = -62e-7;
  16893. var rateCoef = 11772758384668e-32;
  16894. var wgs84WRPrecessing = 72921158553e-15;
  16895. var twoPiOverSecondsInDay = Math_default.TWO_PI / 86400;
  16896. var dateInUtc = new JulianDate_default();
  16897. Transforms.computeTemeToPseudoFixedMatrix = function(date, result) {
  16898. if (!defined_default(date)) {
  16899. throw new DeveloperError_default("date is required.");
  16900. }
  16901. dateInUtc = JulianDate_default.addSeconds(
  16902. date,
  16903. -JulianDate_default.computeTaiMinusUtc(date),
  16904. dateInUtc
  16905. );
  16906. const utcDayNumber = dateInUtc.dayNumber;
  16907. const utcSecondsIntoDay = dateInUtc.secondsOfDay;
  16908. let t;
  16909. const diffDays = utcDayNumber - 2451545;
  16910. if (utcSecondsIntoDay >= 43200) {
  16911. t = (diffDays + 0.5) / TimeConstants_default.DAYS_PER_JULIAN_CENTURY;
  16912. } else {
  16913. t = (diffDays - 0.5) / TimeConstants_default.DAYS_PER_JULIAN_CENTURY;
  16914. }
  16915. const gmst0 = gmstConstant0 + t * (gmstConstant1 + t * (gmstConstant2 + t * gmstConstant3));
  16916. const angle = gmst0 * twoPiOverSecondsInDay % Math_default.TWO_PI;
  16917. const ratio = wgs84WRPrecessing + rateCoef * (utcDayNumber - 24515455e-1);
  16918. const secondsSinceMidnight = (utcSecondsIntoDay + TimeConstants_default.SECONDS_PER_DAY * 0.5) % TimeConstants_default.SECONDS_PER_DAY;
  16919. const gha = angle + ratio * secondsSinceMidnight;
  16920. const cosGha = Math.cos(gha);
  16921. const sinGha = Math.sin(gha);
  16922. if (!defined_default(result)) {
  16923. return new Matrix3_default(
  16924. cosGha,
  16925. sinGha,
  16926. 0,
  16927. -sinGha,
  16928. cosGha,
  16929. 0,
  16930. 0,
  16931. 0,
  16932. 1
  16933. );
  16934. }
  16935. result[0] = cosGha;
  16936. result[1] = -sinGha;
  16937. result[2] = 0;
  16938. result[3] = sinGha;
  16939. result[4] = cosGha;
  16940. result[5] = 0;
  16941. result[6] = 0;
  16942. result[7] = 0;
  16943. result[8] = 1;
  16944. return result;
  16945. };
  16946. Transforms.iau2006XysData = new Iau2006XysData_default();
  16947. Transforms.earthOrientationParameters = EarthOrientationParameters_default.NONE;
  16948. var ttMinusTai = 32.184;
  16949. var j2000ttDays = 2451545;
  16950. Transforms.preloadIcrfFixed = function(timeInterval) {
  16951. const startDayTT = timeInterval.start.dayNumber;
  16952. const startSecondTT = timeInterval.start.secondsOfDay + ttMinusTai;
  16953. const stopDayTT = timeInterval.stop.dayNumber;
  16954. const stopSecondTT = timeInterval.stop.secondsOfDay + ttMinusTai;
  16955. const xysPromise = Transforms.iau2006XysData.preload(
  16956. startDayTT,
  16957. startSecondTT,
  16958. stopDayTT,
  16959. stopSecondTT
  16960. );
  16961. const eopPromise = Transforms.earthOrientationParameters.getPromiseToLoad();
  16962. return Promise.all([xysPromise, eopPromise]);
  16963. };
  16964. Transforms.computeIcrfToFixedMatrix = function(date, result) {
  16965. if (!defined_default(date)) {
  16966. throw new DeveloperError_default("date is required.");
  16967. }
  16968. if (!defined_default(result)) {
  16969. result = new Matrix3_default();
  16970. }
  16971. const fixedToIcrfMtx = Transforms.computeFixedToIcrfMatrix(date, result);
  16972. if (!defined_default(fixedToIcrfMtx)) {
  16973. return void 0;
  16974. }
  16975. return Matrix3_default.transpose(fixedToIcrfMtx, result);
  16976. };
  16977. var xysScratch = new Iau2006XysSample_default(0, 0, 0);
  16978. var eopScratch = new EarthOrientationParametersSample_default(
  16979. 0,
  16980. 0,
  16981. 0,
  16982. 0,
  16983. 0,
  16984. 0
  16985. );
  16986. var rotation1Scratch = new Matrix3_default();
  16987. var rotation2Scratch = new Matrix3_default();
  16988. Transforms.computeFixedToIcrfMatrix = function(date, result) {
  16989. if (!defined_default(date)) {
  16990. throw new DeveloperError_default("date is required.");
  16991. }
  16992. if (!defined_default(result)) {
  16993. result = new Matrix3_default();
  16994. }
  16995. const eop = Transforms.earthOrientationParameters.compute(date, eopScratch);
  16996. if (!defined_default(eop)) {
  16997. return void 0;
  16998. }
  16999. const dayTT = date.dayNumber;
  17000. const secondTT = date.secondsOfDay + ttMinusTai;
  17001. const xys = Transforms.iau2006XysData.computeXysRadians(
  17002. dayTT,
  17003. secondTT,
  17004. xysScratch
  17005. );
  17006. if (!defined_default(xys)) {
  17007. return void 0;
  17008. }
  17009. const x = xys.x + eop.xPoleOffset;
  17010. const y = xys.y + eop.yPoleOffset;
  17011. const a4 = 1 / (1 + Math.sqrt(1 - x * x - y * y));
  17012. const rotation1 = rotation1Scratch;
  17013. rotation1[0] = 1 - a4 * x * x;
  17014. rotation1[3] = -a4 * x * y;
  17015. rotation1[6] = x;
  17016. rotation1[1] = -a4 * x * y;
  17017. rotation1[4] = 1 - a4 * y * y;
  17018. rotation1[7] = y;
  17019. rotation1[2] = -x;
  17020. rotation1[5] = -y;
  17021. rotation1[8] = 1 - a4 * (x * x + y * y);
  17022. const rotation2 = Matrix3_default.fromRotationZ(-xys.s, rotation2Scratch);
  17023. const matrixQ = Matrix3_default.multiply(rotation1, rotation2, rotation1Scratch);
  17024. const dateUt1day = date.dayNumber;
  17025. const dateUt1sec = date.secondsOfDay - JulianDate_default.computeTaiMinusUtc(date) + eop.ut1MinusUtc;
  17026. const daysSinceJ2000 = dateUt1day - 2451545;
  17027. const fractionOfDay = dateUt1sec / TimeConstants_default.SECONDS_PER_DAY;
  17028. let era = 0.779057273264 + fractionOfDay + 0.00273781191135448 * (daysSinceJ2000 + fractionOfDay);
  17029. era = era % 1 * Math_default.TWO_PI;
  17030. const earthRotation = Matrix3_default.fromRotationZ(era, rotation2Scratch);
  17031. const pfToIcrf = Matrix3_default.multiply(matrixQ, earthRotation, rotation1Scratch);
  17032. const cosxp = Math.cos(eop.xPoleWander);
  17033. const cosyp = Math.cos(eop.yPoleWander);
  17034. const sinxp = Math.sin(eop.xPoleWander);
  17035. const sinyp = Math.sin(eop.yPoleWander);
  17036. let ttt = dayTT - j2000ttDays + secondTT / TimeConstants_default.SECONDS_PER_DAY;
  17037. ttt /= 36525;
  17038. const sp = -47e-6 * ttt * Math_default.RADIANS_PER_DEGREE / 3600;
  17039. const cossp = Math.cos(sp);
  17040. const sinsp = Math.sin(sp);
  17041. const fToPfMtx = rotation2Scratch;
  17042. fToPfMtx[0] = cosxp * cossp;
  17043. fToPfMtx[1] = cosxp * sinsp;
  17044. fToPfMtx[2] = sinxp;
  17045. fToPfMtx[3] = -cosyp * sinsp + sinyp * sinxp * cossp;
  17046. fToPfMtx[4] = cosyp * cossp + sinyp * sinxp * sinsp;
  17047. fToPfMtx[5] = -sinyp * cosxp;
  17048. fToPfMtx[6] = -sinyp * sinsp - cosyp * sinxp * cossp;
  17049. fToPfMtx[7] = sinyp * cossp - cosyp * sinxp * sinsp;
  17050. fToPfMtx[8] = cosyp * cosxp;
  17051. return Matrix3_default.multiply(pfToIcrf, fToPfMtx, result);
  17052. };
  17053. var pointToWindowCoordinatesTemp = new Cartesian4_default();
  17054. Transforms.pointToWindowCoordinates = function(modelViewProjectionMatrix, viewportTransformation, point, result) {
  17055. result = Transforms.pointToGLWindowCoordinates(
  17056. modelViewProjectionMatrix,
  17057. viewportTransformation,
  17058. point,
  17059. result
  17060. );
  17061. result.y = 2 * viewportTransformation[5] - result.y;
  17062. return result;
  17063. };
  17064. Transforms.pointToGLWindowCoordinates = function(modelViewProjectionMatrix, viewportTransformation, point, result) {
  17065. if (!defined_default(modelViewProjectionMatrix)) {
  17066. throw new DeveloperError_default("modelViewProjectionMatrix is required.");
  17067. }
  17068. if (!defined_default(viewportTransformation)) {
  17069. throw new DeveloperError_default("viewportTransformation is required.");
  17070. }
  17071. if (!defined_default(point)) {
  17072. throw new DeveloperError_default("point is required.");
  17073. }
  17074. if (!defined_default(result)) {
  17075. result = new Cartesian2_default();
  17076. }
  17077. const tmp2 = pointToWindowCoordinatesTemp;
  17078. Matrix4_default.multiplyByVector(
  17079. modelViewProjectionMatrix,
  17080. Cartesian4_default.fromElements(point.x, point.y, point.z, 1, tmp2),
  17081. tmp2
  17082. );
  17083. Cartesian4_default.multiplyByScalar(tmp2, 1 / tmp2.w, tmp2);
  17084. Matrix4_default.multiplyByVector(viewportTransformation, tmp2, tmp2);
  17085. return Cartesian2_default.fromCartesian4(tmp2, result);
  17086. };
  17087. var normalScratch = new Cartesian3_default();
  17088. var rightScratch = new Cartesian3_default();
  17089. var upScratch = new Cartesian3_default();
  17090. Transforms.rotationMatrixFromPositionVelocity = function(position, velocity, ellipsoid, result) {
  17091. if (!defined_default(position)) {
  17092. throw new DeveloperError_default("position is required.");
  17093. }
  17094. if (!defined_default(velocity)) {
  17095. throw new DeveloperError_default("velocity is required.");
  17096. }
  17097. const normal2 = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84).geodeticSurfaceNormal(
  17098. position,
  17099. normalScratch
  17100. );
  17101. let right = Cartesian3_default.cross(velocity, normal2, rightScratch);
  17102. if (Cartesian3_default.equalsEpsilon(right, Cartesian3_default.ZERO, Math_default.EPSILON6)) {
  17103. right = Cartesian3_default.clone(Cartesian3_default.UNIT_X, right);
  17104. }
  17105. const up = Cartesian3_default.cross(right, velocity, upScratch);
  17106. Cartesian3_default.normalize(up, up);
  17107. Cartesian3_default.cross(velocity, up, right);
  17108. Cartesian3_default.negate(right, right);
  17109. Cartesian3_default.normalize(right, right);
  17110. if (!defined_default(result)) {
  17111. result = new Matrix3_default();
  17112. }
  17113. result[0] = velocity.x;
  17114. result[1] = velocity.y;
  17115. result[2] = velocity.z;
  17116. result[3] = right.x;
  17117. result[4] = right.y;
  17118. result[5] = right.z;
  17119. result[6] = up.x;
  17120. result[7] = up.y;
  17121. result[8] = up.z;
  17122. return result;
  17123. };
  17124. var swizzleMatrix = new Matrix4_default(
  17125. 0,
  17126. 0,
  17127. 1,
  17128. 0,
  17129. 1,
  17130. 0,
  17131. 0,
  17132. 0,
  17133. 0,
  17134. 1,
  17135. 0,
  17136. 0,
  17137. 0,
  17138. 0,
  17139. 0,
  17140. 1
  17141. );
  17142. var scratchCartographic = new Cartographic_default();
  17143. var scratchCartesian3Projection = new Cartesian3_default();
  17144. var scratchCenter = new Cartesian3_default();
  17145. var scratchRotation = new Matrix3_default();
  17146. var scratchFromENU = new Matrix4_default();
  17147. var scratchToENU = new Matrix4_default();
  17148. Transforms.basisTo2D = function(projection, matrix, result) {
  17149. if (!defined_default(projection)) {
  17150. throw new DeveloperError_default("projection is required.");
  17151. }
  17152. if (!defined_default(matrix)) {
  17153. throw new DeveloperError_default("matrix is required.");
  17154. }
  17155. if (!defined_default(result)) {
  17156. throw new DeveloperError_default("result is required.");
  17157. }
  17158. const rtcCenter = Matrix4_default.getTranslation(matrix, scratchCenter);
  17159. const ellipsoid = projection.ellipsoid;
  17160. const cartographic2 = ellipsoid.cartesianToCartographic(
  17161. rtcCenter,
  17162. scratchCartographic
  17163. );
  17164. const projectedPosition2 = projection.project(
  17165. cartographic2,
  17166. scratchCartesian3Projection
  17167. );
  17168. Cartesian3_default.fromElements(
  17169. projectedPosition2.z,
  17170. projectedPosition2.x,
  17171. projectedPosition2.y,
  17172. projectedPosition2
  17173. );
  17174. const fromENU = Transforms.eastNorthUpToFixedFrame(
  17175. rtcCenter,
  17176. ellipsoid,
  17177. scratchFromENU
  17178. );
  17179. const toENU = Matrix4_default.inverseTransformation(fromENU, scratchToENU);
  17180. const rotation = Matrix4_default.getMatrix3(matrix, scratchRotation);
  17181. const local = Matrix4_default.multiplyByMatrix3(toENU, rotation, result);
  17182. Matrix4_default.multiply(swizzleMatrix, local, result);
  17183. Matrix4_default.setTranslation(result, projectedPosition2, result);
  17184. return result;
  17185. };
  17186. Transforms.wgs84To2DModelMatrix = function(projection, center, result) {
  17187. if (!defined_default(projection)) {
  17188. throw new DeveloperError_default("projection is required.");
  17189. }
  17190. if (!defined_default(center)) {
  17191. throw new DeveloperError_default("center is required.");
  17192. }
  17193. if (!defined_default(result)) {
  17194. throw new DeveloperError_default("result is required.");
  17195. }
  17196. const ellipsoid = projection.ellipsoid;
  17197. const fromENU = Transforms.eastNorthUpToFixedFrame(
  17198. center,
  17199. ellipsoid,
  17200. scratchFromENU
  17201. );
  17202. const toENU = Matrix4_default.inverseTransformation(fromENU, scratchToENU);
  17203. const cartographic2 = ellipsoid.cartesianToCartographic(
  17204. center,
  17205. scratchCartographic
  17206. );
  17207. const projectedPosition2 = projection.project(
  17208. cartographic2,
  17209. scratchCartesian3Projection
  17210. );
  17211. Cartesian3_default.fromElements(
  17212. projectedPosition2.z,
  17213. projectedPosition2.x,
  17214. projectedPosition2.y,
  17215. projectedPosition2
  17216. );
  17217. const translation3 = Matrix4_default.fromTranslation(
  17218. projectedPosition2,
  17219. scratchFromENU
  17220. );
  17221. Matrix4_default.multiply(swizzleMatrix, toENU, result);
  17222. Matrix4_default.multiply(translation3, result, result);
  17223. return result;
  17224. };
  17225. var Transforms_default = Transforms;
  17226. // node_modules/cesium/Source/Core/EllipsoidTangentPlane.js
  17227. var scratchCart4 = new Cartesian4_default();
  17228. function EllipsoidTangentPlane(origin, ellipsoid) {
  17229. Check_default.defined("origin", origin);
  17230. ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  17231. origin = ellipsoid.scaleToGeodeticSurface(origin);
  17232. if (!defined_default(origin)) {
  17233. throw new DeveloperError_default(
  17234. "origin must not be at the center of the ellipsoid."
  17235. );
  17236. }
  17237. const eastNorthUp = Transforms_default.eastNorthUpToFixedFrame(origin, ellipsoid);
  17238. this._ellipsoid = ellipsoid;
  17239. this._origin = origin;
  17240. this._xAxis = Cartesian3_default.fromCartesian4(
  17241. Matrix4_default.getColumn(eastNorthUp, 0, scratchCart4)
  17242. );
  17243. this._yAxis = Cartesian3_default.fromCartesian4(
  17244. Matrix4_default.getColumn(eastNorthUp, 1, scratchCart4)
  17245. );
  17246. const normal2 = Cartesian3_default.fromCartesian4(
  17247. Matrix4_default.getColumn(eastNorthUp, 2, scratchCart4)
  17248. );
  17249. this._plane = Plane_default.fromPointNormal(origin, normal2);
  17250. }
  17251. Object.defineProperties(EllipsoidTangentPlane.prototype, {
  17252. ellipsoid: {
  17253. get: function() {
  17254. return this._ellipsoid;
  17255. }
  17256. },
  17257. origin: {
  17258. get: function() {
  17259. return this._origin;
  17260. }
  17261. },
  17262. plane: {
  17263. get: function() {
  17264. return this._plane;
  17265. }
  17266. },
  17267. xAxis: {
  17268. get: function() {
  17269. return this._xAxis;
  17270. }
  17271. },
  17272. yAxis: {
  17273. get: function() {
  17274. return this._yAxis;
  17275. }
  17276. },
  17277. zAxis: {
  17278. get: function() {
  17279. return this._plane.normal;
  17280. }
  17281. }
  17282. });
  17283. var tmp = new AxisAlignedBoundingBox_default();
  17284. EllipsoidTangentPlane.fromPoints = function(cartesians, ellipsoid) {
  17285. Check_default.defined("cartesians", cartesians);
  17286. const box = AxisAlignedBoundingBox_default.fromPoints(cartesians, tmp);
  17287. return new EllipsoidTangentPlane(box.center, ellipsoid);
  17288. };
  17289. var scratchProjectPointOntoPlaneRay = new Ray_default();
  17290. var scratchProjectPointOntoPlaneCartesian3 = new Cartesian3_default();
  17291. EllipsoidTangentPlane.prototype.projectPointOntoPlane = function(cartesian11, result) {
  17292. Check_default.defined("cartesian", cartesian11);
  17293. const ray = scratchProjectPointOntoPlaneRay;
  17294. ray.origin = cartesian11;
  17295. Cartesian3_default.normalize(cartesian11, ray.direction);
  17296. let intersectionPoint = IntersectionTests_default.rayPlane(
  17297. ray,
  17298. this._plane,
  17299. scratchProjectPointOntoPlaneCartesian3
  17300. );
  17301. if (!defined_default(intersectionPoint)) {
  17302. Cartesian3_default.negate(ray.direction, ray.direction);
  17303. intersectionPoint = IntersectionTests_default.rayPlane(
  17304. ray,
  17305. this._plane,
  17306. scratchProjectPointOntoPlaneCartesian3
  17307. );
  17308. }
  17309. if (defined_default(intersectionPoint)) {
  17310. const v7 = Cartesian3_default.subtract(
  17311. intersectionPoint,
  17312. this._origin,
  17313. intersectionPoint
  17314. );
  17315. const x = Cartesian3_default.dot(this._xAxis, v7);
  17316. const y = Cartesian3_default.dot(this._yAxis, v7);
  17317. if (!defined_default(result)) {
  17318. return new Cartesian2_default(x, y);
  17319. }
  17320. result.x = x;
  17321. result.y = y;
  17322. return result;
  17323. }
  17324. return void 0;
  17325. };
  17326. EllipsoidTangentPlane.prototype.projectPointsOntoPlane = function(cartesians, result) {
  17327. Check_default.defined("cartesians", cartesians);
  17328. if (!defined_default(result)) {
  17329. result = [];
  17330. }
  17331. let count = 0;
  17332. const length3 = cartesians.length;
  17333. for (let i2 = 0; i2 < length3; i2++) {
  17334. const p2 = this.projectPointOntoPlane(cartesians[i2], result[count]);
  17335. if (defined_default(p2)) {
  17336. result[count] = p2;
  17337. count++;
  17338. }
  17339. }
  17340. result.length = count;
  17341. return result;
  17342. };
  17343. EllipsoidTangentPlane.prototype.projectPointToNearestOnPlane = function(cartesian11, result) {
  17344. Check_default.defined("cartesian", cartesian11);
  17345. if (!defined_default(result)) {
  17346. result = new Cartesian2_default();
  17347. }
  17348. const ray = scratchProjectPointOntoPlaneRay;
  17349. ray.origin = cartesian11;
  17350. Cartesian3_default.clone(this._plane.normal, ray.direction);
  17351. let intersectionPoint = IntersectionTests_default.rayPlane(
  17352. ray,
  17353. this._plane,
  17354. scratchProjectPointOntoPlaneCartesian3
  17355. );
  17356. if (!defined_default(intersectionPoint)) {
  17357. Cartesian3_default.negate(ray.direction, ray.direction);
  17358. intersectionPoint = IntersectionTests_default.rayPlane(
  17359. ray,
  17360. this._plane,
  17361. scratchProjectPointOntoPlaneCartesian3
  17362. );
  17363. }
  17364. const v7 = Cartesian3_default.subtract(
  17365. intersectionPoint,
  17366. this._origin,
  17367. intersectionPoint
  17368. );
  17369. const x = Cartesian3_default.dot(this._xAxis, v7);
  17370. const y = Cartesian3_default.dot(this._yAxis, v7);
  17371. result.x = x;
  17372. result.y = y;
  17373. return result;
  17374. };
  17375. EllipsoidTangentPlane.prototype.projectPointsToNearestOnPlane = function(cartesians, result) {
  17376. Check_default.defined("cartesians", cartesians);
  17377. if (!defined_default(result)) {
  17378. result = [];
  17379. }
  17380. const length3 = cartesians.length;
  17381. result.length = length3;
  17382. for (let i2 = 0; i2 < length3; i2++) {
  17383. result[i2] = this.projectPointToNearestOnPlane(cartesians[i2], result[i2]);
  17384. }
  17385. return result;
  17386. };
  17387. var projectPointsOntoEllipsoidScratch = new Cartesian3_default();
  17388. EllipsoidTangentPlane.prototype.projectPointOntoEllipsoid = function(cartesian11, result) {
  17389. Check_default.defined("cartesian", cartesian11);
  17390. if (!defined_default(result)) {
  17391. result = new Cartesian3_default();
  17392. }
  17393. const ellipsoid = this._ellipsoid;
  17394. const origin = this._origin;
  17395. const xAxis = this._xAxis;
  17396. const yAxis = this._yAxis;
  17397. const tmp2 = projectPointsOntoEllipsoidScratch;
  17398. Cartesian3_default.multiplyByScalar(xAxis, cartesian11.x, tmp2);
  17399. result = Cartesian3_default.add(origin, tmp2, result);
  17400. Cartesian3_default.multiplyByScalar(yAxis, cartesian11.y, tmp2);
  17401. Cartesian3_default.add(result, tmp2, result);
  17402. ellipsoid.scaleToGeocentricSurface(result, result);
  17403. return result;
  17404. };
  17405. EllipsoidTangentPlane.prototype.projectPointsOntoEllipsoid = function(cartesians, result) {
  17406. Check_default.defined("cartesians", cartesians);
  17407. const length3 = cartesians.length;
  17408. if (!defined_default(result)) {
  17409. result = new Array(length3);
  17410. } else {
  17411. result.length = length3;
  17412. }
  17413. for (let i2 = 0; i2 < length3; ++i2) {
  17414. result[i2] = this.projectPointOntoEllipsoid(cartesians[i2], result[i2]);
  17415. }
  17416. return result;
  17417. };
  17418. var EllipsoidTangentPlane_default = EllipsoidTangentPlane;
  17419. // node_modules/cesium/Source/Core/OrientedBoundingBox.js
  17420. function OrientedBoundingBox(center, halfAxes) {
  17421. this.center = Cartesian3_default.clone(defaultValue_default(center, Cartesian3_default.ZERO));
  17422. this.halfAxes = Matrix3_default.clone(defaultValue_default(halfAxes, Matrix3_default.ZERO));
  17423. }
  17424. OrientedBoundingBox.packedLength = Cartesian3_default.packedLength + Matrix3_default.packedLength;
  17425. OrientedBoundingBox.pack = function(value, array, startingIndex) {
  17426. Check_default.typeOf.object("value", value);
  17427. Check_default.defined("array", array);
  17428. startingIndex = defaultValue_default(startingIndex, 0);
  17429. Cartesian3_default.pack(value.center, array, startingIndex);
  17430. Matrix3_default.pack(value.halfAxes, array, startingIndex + Cartesian3_default.packedLength);
  17431. return array;
  17432. };
  17433. OrientedBoundingBox.unpack = function(array, startingIndex, result) {
  17434. Check_default.defined("array", array);
  17435. startingIndex = defaultValue_default(startingIndex, 0);
  17436. if (!defined_default(result)) {
  17437. result = new OrientedBoundingBox();
  17438. }
  17439. Cartesian3_default.unpack(array, startingIndex, result.center);
  17440. Matrix3_default.unpack(
  17441. array,
  17442. startingIndex + Cartesian3_default.packedLength,
  17443. result.halfAxes
  17444. );
  17445. return result;
  17446. };
  17447. var scratchCartesian1 = new Cartesian3_default();
  17448. var scratchCartesian22 = new Cartesian3_default();
  17449. var scratchCartesian32 = new Cartesian3_default();
  17450. var scratchCartesian4 = new Cartesian3_default();
  17451. var scratchCartesian5 = new Cartesian3_default();
  17452. var scratchCartesian6 = new Cartesian3_default();
  17453. var scratchCovarianceResult = new Matrix3_default();
  17454. var scratchEigenResult = {
  17455. unitary: new Matrix3_default(),
  17456. diagonal: new Matrix3_default()
  17457. };
  17458. OrientedBoundingBox.fromPoints = function(positions, result) {
  17459. if (!defined_default(result)) {
  17460. result = new OrientedBoundingBox();
  17461. }
  17462. if (!defined_default(positions) || positions.length === 0) {
  17463. result.halfAxes = Matrix3_default.ZERO;
  17464. result.center = Cartesian3_default.ZERO;
  17465. return result;
  17466. }
  17467. let i2;
  17468. const length3 = positions.length;
  17469. const meanPoint = Cartesian3_default.clone(positions[0], scratchCartesian1);
  17470. for (i2 = 1; i2 < length3; i2++) {
  17471. Cartesian3_default.add(meanPoint, positions[i2], meanPoint);
  17472. }
  17473. const invLength = 1 / length3;
  17474. Cartesian3_default.multiplyByScalar(meanPoint, invLength, meanPoint);
  17475. let exx = 0;
  17476. let exy = 0;
  17477. let exz = 0;
  17478. let eyy = 0;
  17479. let eyz = 0;
  17480. let ezz = 0;
  17481. let p2;
  17482. for (i2 = 0; i2 < length3; i2++) {
  17483. p2 = Cartesian3_default.subtract(positions[i2], meanPoint, scratchCartesian22);
  17484. exx += p2.x * p2.x;
  17485. exy += p2.x * p2.y;
  17486. exz += p2.x * p2.z;
  17487. eyy += p2.y * p2.y;
  17488. eyz += p2.y * p2.z;
  17489. ezz += p2.z * p2.z;
  17490. }
  17491. exx *= invLength;
  17492. exy *= invLength;
  17493. exz *= invLength;
  17494. eyy *= invLength;
  17495. eyz *= invLength;
  17496. ezz *= invLength;
  17497. const covarianceMatrix = scratchCovarianceResult;
  17498. covarianceMatrix[0] = exx;
  17499. covarianceMatrix[1] = exy;
  17500. covarianceMatrix[2] = exz;
  17501. covarianceMatrix[3] = exy;
  17502. covarianceMatrix[4] = eyy;
  17503. covarianceMatrix[5] = eyz;
  17504. covarianceMatrix[6] = exz;
  17505. covarianceMatrix[7] = eyz;
  17506. covarianceMatrix[8] = ezz;
  17507. const eigenDecomposition = Matrix3_default.computeEigenDecomposition(
  17508. covarianceMatrix,
  17509. scratchEigenResult
  17510. );
  17511. const rotation = Matrix3_default.clone(eigenDecomposition.unitary, result.halfAxes);
  17512. let v13 = Matrix3_default.getColumn(rotation, 0, scratchCartesian4);
  17513. let v23 = Matrix3_default.getColumn(rotation, 1, scratchCartesian5);
  17514. let v32 = Matrix3_default.getColumn(rotation, 2, scratchCartesian6);
  17515. let u12 = -Number.MAX_VALUE;
  17516. let u22 = -Number.MAX_VALUE;
  17517. let u3 = -Number.MAX_VALUE;
  17518. let l1 = Number.MAX_VALUE;
  17519. let l2 = Number.MAX_VALUE;
  17520. let l3 = Number.MAX_VALUE;
  17521. for (i2 = 0; i2 < length3; i2++) {
  17522. p2 = positions[i2];
  17523. u12 = Math.max(Cartesian3_default.dot(v13, p2), u12);
  17524. u22 = Math.max(Cartesian3_default.dot(v23, p2), u22);
  17525. u3 = Math.max(Cartesian3_default.dot(v32, p2), u3);
  17526. l1 = Math.min(Cartesian3_default.dot(v13, p2), l1);
  17527. l2 = Math.min(Cartesian3_default.dot(v23, p2), l2);
  17528. l3 = Math.min(Cartesian3_default.dot(v32, p2), l3);
  17529. }
  17530. v13 = Cartesian3_default.multiplyByScalar(v13, 0.5 * (l1 + u12), v13);
  17531. v23 = Cartesian3_default.multiplyByScalar(v23, 0.5 * (l2 + u22), v23);
  17532. v32 = Cartesian3_default.multiplyByScalar(v32, 0.5 * (l3 + u3), v32);
  17533. const center = Cartesian3_default.add(v13, v23, result.center);
  17534. Cartesian3_default.add(center, v32, center);
  17535. const scale = scratchCartesian32;
  17536. scale.x = u12 - l1;
  17537. scale.y = u22 - l2;
  17538. scale.z = u3 - l3;
  17539. Cartesian3_default.multiplyByScalar(scale, 0.5, scale);
  17540. Matrix3_default.multiplyByScale(result.halfAxes, scale, result.halfAxes);
  17541. return result;
  17542. };
  17543. var scratchOffset = new Cartesian3_default();
  17544. var scratchScale2 = new Cartesian3_default();
  17545. function fromPlaneExtents(planeOrigin, planeXAxis, planeYAxis, planeZAxis, minimumX, maximumX, minimumY, maximumY, minimumZ, maximumZ, result) {
  17546. if (!defined_default(minimumX) || !defined_default(maximumX) || !defined_default(minimumY) || !defined_default(maximumY) || !defined_default(minimumZ) || !defined_default(maximumZ)) {
  17547. throw new DeveloperError_default(
  17548. "all extents (minimum/maximum X/Y/Z) are required."
  17549. );
  17550. }
  17551. if (!defined_default(result)) {
  17552. result = new OrientedBoundingBox();
  17553. }
  17554. const halfAxes = result.halfAxes;
  17555. Matrix3_default.setColumn(halfAxes, 0, planeXAxis, halfAxes);
  17556. Matrix3_default.setColumn(halfAxes, 1, planeYAxis, halfAxes);
  17557. Matrix3_default.setColumn(halfAxes, 2, planeZAxis, halfAxes);
  17558. let centerOffset = scratchOffset;
  17559. centerOffset.x = (minimumX + maximumX) / 2;
  17560. centerOffset.y = (minimumY + maximumY) / 2;
  17561. centerOffset.z = (minimumZ + maximumZ) / 2;
  17562. const scale = scratchScale2;
  17563. scale.x = (maximumX - minimumX) / 2;
  17564. scale.y = (maximumY - minimumY) / 2;
  17565. scale.z = (maximumZ - minimumZ) / 2;
  17566. const center = result.center;
  17567. centerOffset = Matrix3_default.multiplyByVector(halfAxes, centerOffset, centerOffset);
  17568. Cartesian3_default.add(planeOrigin, centerOffset, center);
  17569. Matrix3_default.multiplyByScale(halfAxes, scale, halfAxes);
  17570. return result;
  17571. }
  17572. var scratchRectangleCenterCartographic = new Cartographic_default();
  17573. var scratchRectangleCenter = new Cartesian3_default();
  17574. var scratchPerimeterCartographicNC = new Cartographic_default();
  17575. var scratchPerimeterCartographicNW = new Cartographic_default();
  17576. var scratchPerimeterCartographicCW = new Cartographic_default();
  17577. var scratchPerimeterCartographicSW = new Cartographic_default();
  17578. var scratchPerimeterCartographicSC = new Cartographic_default();
  17579. var scratchPerimeterCartesianNC = new Cartesian3_default();
  17580. var scratchPerimeterCartesianNW = new Cartesian3_default();
  17581. var scratchPerimeterCartesianCW = new Cartesian3_default();
  17582. var scratchPerimeterCartesianSW = new Cartesian3_default();
  17583. var scratchPerimeterCartesianSC = new Cartesian3_default();
  17584. var scratchPerimeterProjectedNC = new Cartesian2_default();
  17585. var scratchPerimeterProjectedNW = new Cartesian2_default();
  17586. var scratchPerimeterProjectedCW = new Cartesian2_default();
  17587. var scratchPerimeterProjectedSW = new Cartesian2_default();
  17588. var scratchPerimeterProjectedSC = new Cartesian2_default();
  17589. var scratchPlaneOrigin = new Cartesian3_default();
  17590. var scratchPlaneNormal = new Cartesian3_default();
  17591. var scratchPlaneXAxis = new Cartesian3_default();
  17592. var scratchHorizonCartesian = new Cartesian3_default();
  17593. var scratchHorizonProjected = new Cartesian2_default();
  17594. var scratchMaxY = new Cartesian3_default();
  17595. var scratchMinY = new Cartesian3_default();
  17596. var scratchZ = new Cartesian3_default();
  17597. var scratchPlane = new Plane_default(Cartesian3_default.UNIT_X, 0);
  17598. OrientedBoundingBox.fromRectangle = function(rectangle, minimumHeight, maximumHeight, ellipsoid, result) {
  17599. if (!defined_default(rectangle)) {
  17600. throw new DeveloperError_default("rectangle is required");
  17601. }
  17602. if (rectangle.width < 0 || rectangle.width > Math_default.TWO_PI) {
  17603. throw new DeveloperError_default("Rectangle width must be between 0 and 2*pi");
  17604. }
  17605. if (rectangle.height < 0 || rectangle.height > Math_default.PI) {
  17606. throw new DeveloperError_default("Rectangle height must be between 0 and pi");
  17607. }
  17608. if (defined_default(ellipsoid) && !Math_default.equalsEpsilon(
  17609. ellipsoid.radii.x,
  17610. ellipsoid.radii.y,
  17611. Math_default.EPSILON15
  17612. )) {
  17613. throw new DeveloperError_default(
  17614. "Ellipsoid must be an ellipsoid of revolution (radii.x == radii.y)"
  17615. );
  17616. }
  17617. minimumHeight = defaultValue_default(minimumHeight, 0);
  17618. maximumHeight = defaultValue_default(maximumHeight, 0);
  17619. ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  17620. let minX, maxX, minY, maxY, minZ, maxZ, plane;
  17621. if (rectangle.width <= Math_default.PI) {
  17622. const tangentPointCartographic = Rectangle_default.center(
  17623. rectangle,
  17624. scratchRectangleCenterCartographic
  17625. );
  17626. const tangentPoint = ellipsoid.cartographicToCartesian(
  17627. tangentPointCartographic,
  17628. scratchRectangleCenter
  17629. );
  17630. const tangentPlane = new EllipsoidTangentPlane_default(tangentPoint, ellipsoid);
  17631. plane = tangentPlane.plane;
  17632. const lonCenter = tangentPointCartographic.longitude;
  17633. const latCenter = rectangle.south < 0 && rectangle.north > 0 ? 0 : tangentPointCartographic.latitude;
  17634. const perimeterCartographicNC = Cartographic_default.fromRadians(
  17635. lonCenter,
  17636. rectangle.north,
  17637. maximumHeight,
  17638. scratchPerimeterCartographicNC
  17639. );
  17640. const perimeterCartographicNW = Cartographic_default.fromRadians(
  17641. rectangle.west,
  17642. rectangle.north,
  17643. maximumHeight,
  17644. scratchPerimeterCartographicNW
  17645. );
  17646. const perimeterCartographicCW = Cartographic_default.fromRadians(
  17647. rectangle.west,
  17648. latCenter,
  17649. maximumHeight,
  17650. scratchPerimeterCartographicCW
  17651. );
  17652. const perimeterCartographicSW = Cartographic_default.fromRadians(
  17653. rectangle.west,
  17654. rectangle.south,
  17655. maximumHeight,
  17656. scratchPerimeterCartographicSW
  17657. );
  17658. const perimeterCartographicSC = Cartographic_default.fromRadians(
  17659. lonCenter,
  17660. rectangle.south,
  17661. maximumHeight,
  17662. scratchPerimeterCartographicSC
  17663. );
  17664. const perimeterCartesianNC = ellipsoid.cartographicToCartesian(
  17665. perimeterCartographicNC,
  17666. scratchPerimeterCartesianNC
  17667. );
  17668. let perimeterCartesianNW = ellipsoid.cartographicToCartesian(
  17669. perimeterCartographicNW,
  17670. scratchPerimeterCartesianNW
  17671. );
  17672. const perimeterCartesianCW = ellipsoid.cartographicToCartesian(
  17673. perimeterCartographicCW,
  17674. scratchPerimeterCartesianCW
  17675. );
  17676. let perimeterCartesianSW = ellipsoid.cartographicToCartesian(
  17677. perimeterCartographicSW,
  17678. scratchPerimeterCartesianSW
  17679. );
  17680. const perimeterCartesianSC = ellipsoid.cartographicToCartesian(
  17681. perimeterCartographicSC,
  17682. scratchPerimeterCartesianSC
  17683. );
  17684. const perimeterProjectedNC = tangentPlane.projectPointToNearestOnPlane(
  17685. perimeterCartesianNC,
  17686. scratchPerimeterProjectedNC
  17687. );
  17688. const perimeterProjectedNW = tangentPlane.projectPointToNearestOnPlane(
  17689. perimeterCartesianNW,
  17690. scratchPerimeterProjectedNW
  17691. );
  17692. const perimeterProjectedCW = tangentPlane.projectPointToNearestOnPlane(
  17693. perimeterCartesianCW,
  17694. scratchPerimeterProjectedCW
  17695. );
  17696. const perimeterProjectedSW = tangentPlane.projectPointToNearestOnPlane(
  17697. perimeterCartesianSW,
  17698. scratchPerimeterProjectedSW
  17699. );
  17700. const perimeterProjectedSC = tangentPlane.projectPointToNearestOnPlane(
  17701. perimeterCartesianSC,
  17702. scratchPerimeterProjectedSC
  17703. );
  17704. minX = Math.min(
  17705. perimeterProjectedNW.x,
  17706. perimeterProjectedCW.x,
  17707. perimeterProjectedSW.x
  17708. );
  17709. maxX = -minX;
  17710. maxY = Math.max(perimeterProjectedNW.y, perimeterProjectedNC.y);
  17711. minY = Math.min(perimeterProjectedSW.y, perimeterProjectedSC.y);
  17712. perimeterCartographicNW.height = perimeterCartographicSW.height = minimumHeight;
  17713. perimeterCartesianNW = ellipsoid.cartographicToCartesian(
  17714. perimeterCartographicNW,
  17715. scratchPerimeterCartesianNW
  17716. );
  17717. perimeterCartesianSW = ellipsoid.cartographicToCartesian(
  17718. perimeterCartographicSW,
  17719. scratchPerimeterCartesianSW
  17720. );
  17721. minZ = Math.min(
  17722. Plane_default.getPointDistance(plane, perimeterCartesianNW),
  17723. Plane_default.getPointDistance(plane, perimeterCartesianSW)
  17724. );
  17725. maxZ = maximumHeight;
  17726. return fromPlaneExtents(
  17727. tangentPlane.origin,
  17728. tangentPlane.xAxis,
  17729. tangentPlane.yAxis,
  17730. tangentPlane.zAxis,
  17731. minX,
  17732. maxX,
  17733. minY,
  17734. maxY,
  17735. minZ,
  17736. maxZ,
  17737. result
  17738. );
  17739. }
  17740. const fullyAboveEquator = rectangle.south > 0;
  17741. const fullyBelowEquator = rectangle.north < 0;
  17742. const latitudeNearestToEquator = fullyAboveEquator ? rectangle.south : fullyBelowEquator ? rectangle.north : 0;
  17743. const centerLongitude = Rectangle_default.center(
  17744. rectangle,
  17745. scratchRectangleCenterCartographic
  17746. ).longitude;
  17747. const planeOrigin = Cartesian3_default.fromRadians(
  17748. centerLongitude,
  17749. latitudeNearestToEquator,
  17750. maximumHeight,
  17751. ellipsoid,
  17752. scratchPlaneOrigin
  17753. );
  17754. planeOrigin.z = 0;
  17755. const isPole = Math.abs(planeOrigin.x) < Math_default.EPSILON10 && Math.abs(planeOrigin.y) < Math_default.EPSILON10;
  17756. const planeNormal = !isPole ? Cartesian3_default.normalize(planeOrigin, scratchPlaneNormal) : Cartesian3_default.UNIT_X;
  17757. const planeYAxis = Cartesian3_default.UNIT_Z;
  17758. const planeXAxis = Cartesian3_default.cross(
  17759. planeNormal,
  17760. planeYAxis,
  17761. scratchPlaneXAxis
  17762. );
  17763. plane = Plane_default.fromPointNormal(planeOrigin, planeNormal, scratchPlane);
  17764. const horizonCartesian = Cartesian3_default.fromRadians(
  17765. centerLongitude + Math_default.PI_OVER_TWO,
  17766. latitudeNearestToEquator,
  17767. maximumHeight,
  17768. ellipsoid,
  17769. scratchHorizonCartesian
  17770. );
  17771. maxX = Cartesian3_default.dot(
  17772. Plane_default.projectPointOntoPlane(
  17773. plane,
  17774. horizonCartesian,
  17775. scratchHorizonProjected
  17776. ),
  17777. planeXAxis
  17778. );
  17779. minX = -maxX;
  17780. maxY = Cartesian3_default.fromRadians(
  17781. 0,
  17782. rectangle.north,
  17783. fullyBelowEquator ? minimumHeight : maximumHeight,
  17784. ellipsoid,
  17785. scratchMaxY
  17786. ).z;
  17787. minY = Cartesian3_default.fromRadians(
  17788. 0,
  17789. rectangle.south,
  17790. fullyAboveEquator ? minimumHeight : maximumHeight,
  17791. ellipsoid,
  17792. scratchMinY
  17793. ).z;
  17794. const farZ = Cartesian3_default.fromRadians(
  17795. rectangle.east,
  17796. latitudeNearestToEquator,
  17797. maximumHeight,
  17798. ellipsoid,
  17799. scratchZ
  17800. );
  17801. minZ = Plane_default.getPointDistance(plane, farZ);
  17802. maxZ = 0;
  17803. return fromPlaneExtents(
  17804. planeOrigin,
  17805. planeXAxis,
  17806. planeYAxis,
  17807. planeNormal,
  17808. minX,
  17809. maxX,
  17810. minY,
  17811. maxY,
  17812. minZ,
  17813. maxZ,
  17814. result
  17815. );
  17816. };
  17817. OrientedBoundingBox.fromTransformation = function(transformation, result) {
  17818. Check_default.typeOf.object("transformation", transformation);
  17819. if (!defined_default(result)) {
  17820. result = new OrientedBoundingBox();
  17821. }
  17822. result.center = Matrix4_default.getTranslation(transformation, result.center);
  17823. result.halfAxes = Matrix4_default.getMatrix3(transformation, result.halfAxes);
  17824. result.halfAxes = Matrix3_default.multiplyByScalar(
  17825. result.halfAxes,
  17826. 0.5,
  17827. result.halfAxes
  17828. );
  17829. return result;
  17830. };
  17831. OrientedBoundingBox.clone = function(box, result) {
  17832. if (!defined_default(box)) {
  17833. return void 0;
  17834. }
  17835. if (!defined_default(result)) {
  17836. return new OrientedBoundingBox(box.center, box.halfAxes);
  17837. }
  17838. Cartesian3_default.clone(box.center, result.center);
  17839. Matrix3_default.clone(box.halfAxes, result.halfAxes);
  17840. return result;
  17841. };
  17842. OrientedBoundingBox.intersectPlane = function(box, plane) {
  17843. if (!defined_default(box)) {
  17844. throw new DeveloperError_default("box is required.");
  17845. }
  17846. if (!defined_default(plane)) {
  17847. throw new DeveloperError_default("plane is required.");
  17848. }
  17849. const center = box.center;
  17850. const normal2 = plane.normal;
  17851. const halfAxes = box.halfAxes;
  17852. const normalX = normal2.x, normalY = normal2.y, normalZ = normal2.z;
  17853. const radEffective = Math.abs(
  17854. normalX * halfAxes[Matrix3_default.COLUMN0ROW0] + normalY * halfAxes[Matrix3_default.COLUMN0ROW1] + normalZ * halfAxes[Matrix3_default.COLUMN0ROW2]
  17855. ) + Math.abs(
  17856. normalX * halfAxes[Matrix3_default.COLUMN1ROW0] + normalY * halfAxes[Matrix3_default.COLUMN1ROW1] + normalZ * halfAxes[Matrix3_default.COLUMN1ROW2]
  17857. ) + Math.abs(
  17858. normalX * halfAxes[Matrix3_default.COLUMN2ROW0] + normalY * halfAxes[Matrix3_default.COLUMN2ROW1] + normalZ * halfAxes[Matrix3_default.COLUMN2ROW2]
  17859. );
  17860. const distanceToPlane = Cartesian3_default.dot(normal2, center) + plane.distance;
  17861. if (distanceToPlane <= -radEffective) {
  17862. return Intersect_default.OUTSIDE;
  17863. } else if (distanceToPlane >= radEffective) {
  17864. return Intersect_default.INSIDE;
  17865. }
  17866. return Intersect_default.INTERSECTING;
  17867. };
  17868. var scratchCartesianU = new Cartesian3_default();
  17869. var scratchCartesianV = new Cartesian3_default();
  17870. var scratchCartesianW = new Cartesian3_default();
  17871. var scratchValidAxis2 = new Cartesian3_default();
  17872. var scratchValidAxis3 = new Cartesian3_default();
  17873. var scratchPPrime = new Cartesian3_default();
  17874. OrientedBoundingBox.distanceSquaredTo = function(box, cartesian11) {
  17875. if (!defined_default(box)) {
  17876. throw new DeveloperError_default("box is required.");
  17877. }
  17878. if (!defined_default(cartesian11)) {
  17879. throw new DeveloperError_default("cartesian is required.");
  17880. }
  17881. const offset2 = Cartesian3_default.subtract(cartesian11, box.center, scratchOffset);
  17882. const halfAxes = box.halfAxes;
  17883. let u3 = Matrix3_default.getColumn(halfAxes, 0, scratchCartesianU);
  17884. let v7 = Matrix3_default.getColumn(halfAxes, 1, scratchCartesianV);
  17885. let w = Matrix3_default.getColumn(halfAxes, 2, scratchCartesianW);
  17886. const uHalf = Cartesian3_default.magnitude(u3);
  17887. const vHalf = Cartesian3_default.magnitude(v7);
  17888. const wHalf = Cartesian3_default.magnitude(w);
  17889. let uValid = true;
  17890. let vValid = true;
  17891. let wValid = true;
  17892. if (uHalf > 0) {
  17893. Cartesian3_default.divideByScalar(u3, uHalf, u3);
  17894. } else {
  17895. uValid = false;
  17896. }
  17897. if (vHalf > 0) {
  17898. Cartesian3_default.divideByScalar(v7, vHalf, v7);
  17899. } else {
  17900. vValid = false;
  17901. }
  17902. if (wHalf > 0) {
  17903. Cartesian3_default.divideByScalar(w, wHalf, w);
  17904. } else {
  17905. wValid = false;
  17906. }
  17907. const numberOfDegenerateAxes = !uValid + !vValid + !wValid;
  17908. let validAxis1;
  17909. let validAxis2;
  17910. let validAxis3;
  17911. if (numberOfDegenerateAxes === 1) {
  17912. let degenerateAxis = u3;
  17913. validAxis1 = v7;
  17914. validAxis2 = w;
  17915. if (!vValid) {
  17916. degenerateAxis = v7;
  17917. validAxis1 = u3;
  17918. } else if (!wValid) {
  17919. degenerateAxis = w;
  17920. validAxis2 = u3;
  17921. }
  17922. validAxis3 = Cartesian3_default.cross(validAxis1, validAxis2, scratchValidAxis3);
  17923. if (degenerateAxis === u3) {
  17924. u3 = validAxis3;
  17925. } else if (degenerateAxis === v7) {
  17926. v7 = validAxis3;
  17927. } else if (degenerateAxis === w) {
  17928. w = validAxis3;
  17929. }
  17930. } else if (numberOfDegenerateAxes === 2) {
  17931. validAxis1 = u3;
  17932. if (vValid) {
  17933. validAxis1 = v7;
  17934. } else if (wValid) {
  17935. validAxis1 = w;
  17936. }
  17937. let crossVector = Cartesian3_default.UNIT_Y;
  17938. if (crossVector.equalsEpsilon(validAxis1, Math_default.EPSILON3)) {
  17939. crossVector = Cartesian3_default.UNIT_X;
  17940. }
  17941. validAxis2 = Cartesian3_default.cross(validAxis1, crossVector, scratchValidAxis2);
  17942. Cartesian3_default.normalize(validAxis2, validAxis2);
  17943. validAxis3 = Cartesian3_default.cross(validAxis1, validAxis2, scratchValidAxis3);
  17944. Cartesian3_default.normalize(validAxis3, validAxis3);
  17945. if (validAxis1 === u3) {
  17946. v7 = validAxis2;
  17947. w = validAxis3;
  17948. } else if (validAxis1 === v7) {
  17949. w = validAxis2;
  17950. u3 = validAxis3;
  17951. } else if (validAxis1 === w) {
  17952. u3 = validAxis2;
  17953. v7 = validAxis3;
  17954. }
  17955. } else if (numberOfDegenerateAxes === 3) {
  17956. u3 = Cartesian3_default.UNIT_X;
  17957. v7 = Cartesian3_default.UNIT_Y;
  17958. w = Cartesian3_default.UNIT_Z;
  17959. }
  17960. const pPrime = scratchPPrime;
  17961. pPrime.x = Cartesian3_default.dot(offset2, u3);
  17962. pPrime.y = Cartesian3_default.dot(offset2, v7);
  17963. pPrime.z = Cartesian3_default.dot(offset2, w);
  17964. let distanceSquared = 0;
  17965. let d;
  17966. if (pPrime.x < -uHalf) {
  17967. d = pPrime.x + uHalf;
  17968. distanceSquared += d * d;
  17969. } else if (pPrime.x > uHalf) {
  17970. d = pPrime.x - uHalf;
  17971. distanceSquared += d * d;
  17972. }
  17973. if (pPrime.y < -vHalf) {
  17974. d = pPrime.y + vHalf;
  17975. distanceSquared += d * d;
  17976. } else if (pPrime.y > vHalf) {
  17977. d = pPrime.y - vHalf;
  17978. distanceSquared += d * d;
  17979. }
  17980. if (pPrime.z < -wHalf) {
  17981. d = pPrime.z + wHalf;
  17982. distanceSquared += d * d;
  17983. } else if (pPrime.z > wHalf) {
  17984. d = pPrime.z - wHalf;
  17985. distanceSquared += d * d;
  17986. }
  17987. return distanceSquared;
  17988. };
  17989. var scratchCorner = new Cartesian3_default();
  17990. var scratchToCenter = new Cartesian3_default();
  17991. OrientedBoundingBox.computePlaneDistances = function(box, position, direction2, result) {
  17992. if (!defined_default(box)) {
  17993. throw new DeveloperError_default("box is required.");
  17994. }
  17995. if (!defined_default(position)) {
  17996. throw new DeveloperError_default("position is required.");
  17997. }
  17998. if (!defined_default(direction2)) {
  17999. throw new DeveloperError_default("direction is required.");
  18000. }
  18001. if (!defined_default(result)) {
  18002. result = new Interval_default();
  18003. }
  18004. let minDist = Number.POSITIVE_INFINITY;
  18005. let maxDist = Number.NEGATIVE_INFINITY;
  18006. const center = box.center;
  18007. const halfAxes = box.halfAxes;
  18008. const u3 = Matrix3_default.getColumn(halfAxes, 0, scratchCartesianU);
  18009. const v7 = Matrix3_default.getColumn(halfAxes, 1, scratchCartesianV);
  18010. const w = Matrix3_default.getColumn(halfAxes, 2, scratchCartesianW);
  18011. const corner = Cartesian3_default.add(u3, v7, scratchCorner);
  18012. Cartesian3_default.add(corner, w, corner);
  18013. Cartesian3_default.add(corner, center, corner);
  18014. const toCenter = Cartesian3_default.subtract(corner, position, scratchToCenter);
  18015. let mag = Cartesian3_default.dot(direction2, toCenter);
  18016. minDist = Math.min(mag, minDist);
  18017. maxDist = Math.max(mag, maxDist);
  18018. Cartesian3_default.add(center, u3, corner);
  18019. Cartesian3_default.add(corner, v7, corner);
  18020. Cartesian3_default.subtract(corner, w, corner);
  18021. Cartesian3_default.subtract(corner, position, toCenter);
  18022. mag = Cartesian3_default.dot(direction2, toCenter);
  18023. minDist = Math.min(mag, minDist);
  18024. maxDist = Math.max(mag, maxDist);
  18025. Cartesian3_default.add(center, u3, corner);
  18026. Cartesian3_default.subtract(corner, v7, corner);
  18027. Cartesian3_default.add(corner, w, corner);
  18028. Cartesian3_default.subtract(corner, position, toCenter);
  18029. mag = Cartesian3_default.dot(direction2, toCenter);
  18030. minDist = Math.min(mag, minDist);
  18031. maxDist = Math.max(mag, maxDist);
  18032. Cartesian3_default.add(center, u3, corner);
  18033. Cartesian3_default.subtract(corner, v7, corner);
  18034. Cartesian3_default.subtract(corner, w, corner);
  18035. Cartesian3_default.subtract(corner, position, toCenter);
  18036. mag = Cartesian3_default.dot(direction2, toCenter);
  18037. minDist = Math.min(mag, minDist);
  18038. maxDist = Math.max(mag, maxDist);
  18039. Cartesian3_default.subtract(center, u3, corner);
  18040. Cartesian3_default.add(corner, v7, corner);
  18041. Cartesian3_default.add(corner, w, corner);
  18042. Cartesian3_default.subtract(corner, position, toCenter);
  18043. mag = Cartesian3_default.dot(direction2, toCenter);
  18044. minDist = Math.min(mag, minDist);
  18045. maxDist = Math.max(mag, maxDist);
  18046. Cartesian3_default.subtract(center, u3, corner);
  18047. Cartesian3_default.add(corner, v7, corner);
  18048. Cartesian3_default.subtract(corner, w, corner);
  18049. Cartesian3_default.subtract(corner, position, toCenter);
  18050. mag = Cartesian3_default.dot(direction2, toCenter);
  18051. minDist = Math.min(mag, minDist);
  18052. maxDist = Math.max(mag, maxDist);
  18053. Cartesian3_default.subtract(center, u3, corner);
  18054. Cartesian3_default.subtract(corner, v7, corner);
  18055. Cartesian3_default.add(corner, w, corner);
  18056. Cartesian3_default.subtract(corner, position, toCenter);
  18057. mag = Cartesian3_default.dot(direction2, toCenter);
  18058. minDist = Math.min(mag, minDist);
  18059. maxDist = Math.max(mag, maxDist);
  18060. Cartesian3_default.subtract(center, u3, corner);
  18061. Cartesian3_default.subtract(corner, v7, corner);
  18062. Cartesian3_default.subtract(corner, w, corner);
  18063. Cartesian3_default.subtract(corner, position, toCenter);
  18064. mag = Cartesian3_default.dot(direction2, toCenter);
  18065. minDist = Math.min(mag, minDist);
  18066. maxDist = Math.max(mag, maxDist);
  18067. result.start = minDist;
  18068. result.stop = maxDist;
  18069. return result;
  18070. };
  18071. var scratchXAxis = new Cartesian3_default();
  18072. var scratchYAxis = new Cartesian3_default();
  18073. var scratchZAxis = new Cartesian3_default();
  18074. OrientedBoundingBox.computeCorners = function(box, result) {
  18075. Check_default.typeOf.object("box", box);
  18076. if (!defined_default(result)) {
  18077. result = [
  18078. new Cartesian3_default(),
  18079. new Cartesian3_default(),
  18080. new Cartesian3_default(),
  18081. new Cartesian3_default(),
  18082. new Cartesian3_default(),
  18083. new Cartesian3_default(),
  18084. new Cartesian3_default(),
  18085. new Cartesian3_default()
  18086. ];
  18087. }
  18088. const center = box.center;
  18089. const halfAxes = box.halfAxes;
  18090. const xAxis = Matrix3_default.getColumn(halfAxes, 0, scratchXAxis);
  18091. const yAxis = Matrix3_default.getColumn(halfAxes, 1, scratchYAxis);
  18092. const zAxis = Matrix3_default.getColumn(halfAxes, 2, scratchZAxis);
  18093. Cartesian3_default.clone(center, result[0]);
  18094. Cartesian3_default.subtract(result[0], xAxis, result[0]);
  18095. Cartesian3_default.subtract(result[0], yAxis, result[0]);
  18096. Cartesian3_default.subtract(result[0], zAxis, result[0]);
  18097. Cartesian3_default.clone(center, result[1]);
  18098. Cartesian3_default.subtract(result[1], xAxis, result[1]);
  18099. Cartesian3_default.subtract(result[1], yAxis, result[1]);
  18100. Cartesian3_default.add(result[1], zAxis, result[1]);
  18101. Cartesian3_default.clone(center, result[2]);
  18102. Cartesian3_default.subtract(result[2], xAxis, result[2]);
  18103. Cartesian3_default.add(result[2], yAxis, result[2]);
  18104. Cartesian3_default.subtract(result[2], zAxis, result[2]);
  18105. Cartesian3_default.clone(center, result[3]);
  18106. Cartesian3_default.subtract(result[3], xAxis, result[3]);
  18107. Cartesian3_default.add(result[3], yAxis, result[3]);
  18108. Cartesian3_default.add(result[3], zAxis, result[3]);
  18109. Cartesian3_default.clone(center, result[4]);
  18110. Cartesian3_default.add(result[4], xAxis, result[4]);
  18111. Cartesian3_default.subtract(result[4], yAxis, result[4]);
  18112. Cartesian3_default.subtract(result[4], zAxis, result[4]);
  18113. Cartesian3_default.clone(center, result[5]);
  18114. Cartesian3_default.add(result[5], xAxis, result[5]);
  18115. Cartesian3_default.subtract(result[5], yAxis, result[5]);
  18116. Cartesian3_default.add(result[5], zAxis, result[5]);
  18117. Cartesian3_default.clone(center, result[6]);
  18118. Cartesian3_default.add(result[6], xAxis, result[6]);
  18119. Cartesian3_default.add(result[6], yAxis, result[6]);
  18120. Cartesian3_default.subtract(result[6], zAxis, result[6]);
  18121. Cartesian3_default.clone(center, result[7]);
  18122. Cartesian3_default.add(result[7], xAxis, result[7]);
  18123. Cartesian3_default.add(result[7], yAxis, result[7]);
  18124. Cartesian3_default.add(result[7], zAxis, result[7]);
  18125. return result;
  18126. };
  18127. var scratchRotationScale = new Matrix3_default();
  18128. OrientedBoundingBox.computeTransformation = function(box, result) {
  18129. Check_default.typeOf.object("box", box);
  18130. if (!defined_default(result)) {
  18131. result = new Matrix4_default();
  18132. }
  18133. const translation3 = box.center;
  18134. const rotationScale = Matrix3_default.multiplyByUniformScale(
  18135. box.halfAxes,
  18136. 2,
  18137. scratchRotationScale
  18138. );
  18139. return Matrix4_default.fromRotationTranslation(rotationScale, translation3, result);
  18140. };
  18141. var scratchBoundingSphere2 = new BoundingSphere_default();
  18142. OrientedBoundingBox.isOccluded = function(box, occluder) {
  18143. if (!defined_default(box)) {
  18144. throw new DeveloperError_default("box is required.");
  18145. }
  18146. if (!defined_default(occluder)) {
  18147. throw new DeveloperError_default("occluder is required.");
  18148. }
  18149. const sphere = BoundingSphere_default.fromOrientedBoundingBox(
  18150. box,
  18151. scratchBoundingSphere2
  18152. );
  18153. return !occluder.isBoundingSphereVisible(sphere);
  18154. };
  18155. OrientedBoundingBox.prototype.intersectPlane = function(plane) {
  18156. return OrientedBoundingBox.intersectPlane(this, plane);
  18157. };
  18158. OrientedBoundingBox.prototype.distanceSquaredTo = function(cartesian11) {
  18159. return OrientedBoundingBox.distanceSquaredTo(this, cartesian11);
  18160. };
  18161. OrientedBoundingBox.prototype.computePlaneDistances = function(position, direction2, result) {
  18162. return OrientedBoundingBox.computePlaneDistances(
  18163. this,
  18164. position,
  18165. direction2,
  18166. result
  18167. );
  18168. };
  18169. OrientedBoundingBox.prototype.computeCorners = function(result) {
  18170. return OrientedBoundingBox.computeCorners(this, result);
  18171. };
  18172. OrientedBoundingBox.prototype.computeTransformation = function(result) {
  18173. return OrientedBoundingBox.computeTransformation(this, result);
  18174. };
  18175. OrientedBoundingBox.prototype.isOccluded = function(occluder) {
  18176. return OrientedBoundingBox.isOccluded(this, occluder);
  18177. };
  18178. OrientedBoundingBox.equals = function(left, right) {
  18179. return left === right || defined_default(left) && defined_default(right) && Cartesian3_default.equals(left.center, right.center) && Matrix3_default.equals(left.halfAxes, right.halfAxes);
  18180. };
  18181. OrientedBoundingBox.prototype.clone = function(result) {
  18182. return OrientedBoundingBox.clone(this, result);
  18183. };
  18184. OrientedBoundingBox.prototype.equals = function(right) {
  18185. return OrientedBoundingBox.equals(this, right);
  18186. };
  18187. var OrientedBoundingBox_default = OrientedBoundingBox;
  18188. // node_modules/cesium/Source/Core/WebGLConstants.js
  18189. var WebGLConstants = {
  18190. DEPTH_BUFFER_BIT: 256,
  18191. STENCIL_BUFFER_BIT: 1024,
  18192. COLOR_BUFFER_BIT: 16384,
  18193. POINTS: 0,
  18194. LINES: 1,
  18195. LINE_LOOP: 2,
  18196. LINE_STRIP: 3,
  18197. TRIANGLES: 4,
  18198. TRIANGLE_STRIP: 5,
  18199. TRIANGLE_FAN: 6,
  18200. ZERO: 0,
  18201. ONE: 1,
  18202. SRC_COLOR: 768,
  18203. ONE_MINUS_SRC_COLOR: 769,
  18204. SRC_ALPHA: 770,
  18205. ONE_MINUS_SRC_ALPHA: 771,
  18206. DST_ALPHA: 772,
  18207. ONE_MINUS_DST_ALPHA: 773,
  18208. DST_COLOR: 774,
  18209. ONE_MINUS_DST_COLOR: 775,
  18210. SRC_ALPHA_SATURATE: 776,
  18211. FUNC_ADD: 32774,
  18212. BLEND_EQUATION: 32777,
  18213. BLEND_EQUATION_RGB: 32777,
  18214. BLEND_EQUATION_ALPHA: 34877,
  18215. FUNC_SUBTRACT: 32778,
  18216. FUNC_REVERSE_SUBTRACT: 32779,
  18217. BLEND_DST_RGB: 32968,
  18218. BLEND_SRC_RGB: 32969,
  18219. BLEND_DST_ALPHA: 32970,
  18220. BLEND_SRC_ALPHA: 32971,
  18221. CONSTANT_COLOR: 32769,
  18222. ONE_MINUS_CONSTANT_COLOR: 32770,
  18223. CONSTANT_ALPHA: 32771,
  18224. ONE_MINUS_CONSTANT_ALPHA: 32772,
  18225. BLEND_COLOR: 32773,
  18226. ARRAY_BUFFER: 34962,
  18227. ELEMENT_ARRAY_BUFFER: 34963,
  18228. ARRAY_BUFFER_BINDING: 34964,
  18229. ELEMENT_ARRAY_BUFFER_BINDING: 34965,
  18230. STREAM_DRAW: 35040,
  18231. STATIC_DRAW: 35044,
  18232. DYNAMIC_DRAW: 35048,
  18233. BUFFER_SIZE: 34660,
  18234. BUFFER_USAGE: 34661,
  18235. CURRENT_VERTEX_ATTRIB: 34342,
  18236. FRONT: 1028,
  18237. BACK: 1029,
  18238. FRONT_AND_BACK: 1032,
  18239. CULL_FACE: 2884,
  18240. BLEND: 3042,
  18241. DITHER: 3024,
  18242. STENCIL_TEST: 2960,
  18243. DEPTH_TEST: 2929,
  18244. SCISSOR_TEST: 3089,
  18245. POLYGON_OFFSET_FILL: 32823,
  18246. SAMPLE_ALPHA_TO_COVERAGE: 32926,
  18247. SAMPLE_COVERAGE: 32928,
  18248. NO_ERROR: 0,
  18249. INVALID_ENUM: 1280,
  18250. INVALID_VALUE: 1281,
  18251. INVALID_OPERATION: 1282,
  18252. OUT_OF_MEMORY: 1285,
  18253. CW: 2304,
  18254. CCW: 2305,
  18255. LINE_WIDTH: 2849,
  18256. ALIASED_POINT_SIZE_RANGE: 33901,
  18257. ALIASED_LINE_WIDTH_RANGE: 33902,
  18258. CULL_FACE_MODE: 2885,
  18259. FRONT_FACE: 2886,
  18260. DEPTH_RANGE: 2928,
  18261. DEPTH_WRITEMASK: 2930,
  18262. DEPTH_CLEAR_VALUE: 2931,
  18263. DEPTH_FUNC: 2932,
  18264. STENCIL_CLEAR_VALUE: 2961,
  18265. STENCIL_FUNC: 2962,
  18266. STENCIL_FAIL: 2964,
  18267. STENCIL_PASS_DEPTH_FAIL: 2965,
  18268. STENCIL_PASS_DEPTH_PASS: 2966,
  18269. STENCIL_REF: 2967,
  18270. STENCIL_VALUE_MASK: 2963,
  18271. STENCIL_WRITEMASK: 2968,
  18272. STENCIL_BACK_FUNC: 34816,
  18273. STENCIL_BACK_FAIL: 34817,
  18274. STENCIL_BACK_PASS_DEPTH_FAIL: 34818,
  18275. STENCIL_BACK_PASS_DEPTH_PASS: 34819,
  18276. STENCIL_BACK_REF: 36003,
  18277. STENCIL_BACK_VALUE_MASK: 36004,
  18278. STENCIL_BACK_WRITEMASK: 36005,
  18279. VIEWPORT: 2978,
  18280. SCISSOR_BOX: 3088,
  18281. COLOR_CLEAR_VALUE: 3106,
  18282. COLOR_WRITEMASK: 3107,
  18283. UNPACK_ALIGNMENT: 3317,
  18284. PACK_ALIGNMENT: 3333,
  18285. MAX_TEXTURE_SIZE: 3379,
  18286. MAX_VIEWPORT_DIMS: 3386,
  18287. SUBPIXEL_BITS: 3408,
  18288. RED_BITS: 3410,
  18289. GREEN_BITS: 3411,
  18290. BLUE_BITS: 3412,
  18291. ALPHA_BITS: 3413,
  18292. DEPTH_BITS: 3414,
  18293. STENCIL_BITS: 3415,
  18294. POLYGON_OFFSET_UNITS: 10752,
  18295. POLYGON_OFFSET_FACTOR: 32824,
  18296. TEXTURE_BINDING_2D: 32873,
  18297. SAMPLE_BUFFERS: 32936,
  18298. SAMPLES: 32937,
  18299. SAMPLE_COVERAGE_VALUE: 32938,
  18300. SAMPLE_COVERAGE_INVERT: 32939,
  18301. COMPRESSED_TEXTURE_FORMATS: 34467,
  18302. DONT_CARE: 4352,
  18303. FASTEST: 4353,
  18304. NICEST: 4354,
  18305. GENERATE_MIPMAP_HINT: 33170,
  18306. BYTE: 5120,
  18307. UNSIGNED_BYTE: 5121,
  18308. SHORT: 5122,
  18309. UNSIGNED_SHORT: 5123,
  18310. INT: 5124,
  18311. UNSIGNED_INT: 5125,
  18312. FLOAT: 5126,
  18313. DEPTH_COMPONENT: 6402,
  18314. ALPHA: 6406,
  18315. RGB: 6407,
  18316. RGBA: 6408,
  18317. LUMINANCE: 6409,
  18318. LUMINANCE_ALPHA: 6410,
  18319. UNSIGNED_SHORT_4_4_4_4: 32819,
  18320. UNSIGNED_SHORT_5_5_5_1: 32820,
  18321. UNSIGNED_SHORT_5_6_5: 33635,
  18322. FRAGMENT_SHADER: 35632,
  18323. VERTEX_SHADER: 35633,
  18324. MAX_VERTEX_ATTRIBS: 34921,
  18325. MAX_VERTEX_UNIFORM_VECTORS: 36347,
  18326. MAX_VARYING_VECTORS: 36348,
  18327. MAX_COMBINED_TEXTURE_IMAGE_UNITS: 35661,
  18328. MAX_VERTEX_TEXTURE_IMAGE_UNITS: 35660,
  18329. MAX_TEXTURE_IMAGE_UNITS: 34930,
  18330. MAX_FRAGMENT_UNIFORM_VECTORS: 36349,
  18331. SHADER_TYPE: 35663,
  18332. DELETE_STATUS: 35712,
  18333. LINK_STATUS: 35714,
  18334. VALIDATE_STATUS: 35715,
  18335. ATTACHED_SHADERS: 35717,
  18336. ACTIVE_UNIFORMS: 35718,
  18337. ACTIVE_ATTRIBUTES: 35721,
  18338. SHADING_LANGUAGE_VERSION: 35724,
  18339. CURRENT_PROGRAM: 35725,
  18340. NEVER: 512,
  18341. LESS: 513,
  18342. EQUAL: 514,
  18343. LEQUAL: 515,
  18344. GREATER: 516,
  18345. NOTEQUAL: 517,
  18346. GEQUAL: 518,
  18347. ALWAYS: 519,
  18348. KEEP: 7680,
  18349. REPLACE: 7681,
  18350. INCR: 7682,
  18351. DECR: 7683,
  18352. INVERT: 5386,
  18353. INCR_WRAP: 34055,
  18354. DECR_WRAP: 34056,
  18355. VENDOR: 7936,
  18356. RENDERER: 7937,
  18357. VERSION: 7938,
  18358. NEAREST: 9728,
  18359. LINEAR: 9729,
  18360. NEAREST_MIPMAP_NEAREST: 9984,
  18361. LINEAR_MIPMAP_NEAREST: 9985,
  18362. NEAREST_MIPMAP_LINEAR: 9986,
  18363. LINEAR_MIPMAP_LINEAR: 9987,
  18364. TEXTURE_MAG_FILTER: 10240,
  18365. TEXTURE_MIN_FILTER: 10241,
  18366. TEXTURE_WRAP_S: 10242,
  18367. TEXTURE_WRAP_T: 10243,
  18368. TEXTURE_2D: 3553,
  18369. TEXTURE: 5890,
  18370. TEXTURE_CUBE_MAP: 34067,
  18371. TEXTURE_BINDING_CUBE_MAP: 34068,
  18372. TEXTURE_CUBE_MAP_POSITIVE_X: 34069,
  18373. TEXTURE_CUBE_MAP_NEGATIVE_X: 34070,
  18374. TEXTURE_CUBE_MAP_POSITIVE_Y: 34071,
  18375. TEXTURE_CUBE_MAP_NEGATIVE_Y: 34072,
  18376. TEXTURE_CUBE_MAP_POSITIVE_Z: 34073,
  18377. TEXTURE_CUBE_MAP_NEGATIVE_Z: 34074,
  18378. MAX_CUBE_MAP_TEXTURE_SIZE: 34076,
  18379. TEXTURE0: 33984,
  18380. TEXTURE1: 33985,
  18381. TEXTURE2: 33986,
  18382. TEXTURE3: 33987,
  18383. TEXTURE4: 33988,
  18384. TEXTURE5: 33989,
  18385. TEXTURE6: 33990,
  18386. TEXTURE7: 33991,
  18387. TEXTURE8: 33992,
  18388. TEXTURE9: 33993,
  18389. TEXTURE10: 33994,
  18390. TEXTURE11: 33995,
  18391. TEXTURE12: 33996,
  18392. TEXTURE13: 33997,
  18393. TEXTURE14: 33998,
  18394. TEXTURE15: 33999,
  18395. TEXTURE16: 34e3,
  18396. TEXTURE17: 34001,
  18397. TEXTURE18: 34002,
  18398. TEXTURE19: 34003,
  18399. TEXTURE20: 34004,
  18400. TEXTURE21: 34005,
  18401. TEXTURE22: 34006,
  18402. TEXTURE23: 34007,
  18403. TEXTURE24: 34008,
  18404. TEXTURE25: 34009,
  18405. TEXTURE26: 34010,
  18406. TEXTURE27: 34011,
  18407. TEXTURE28: 34012,
  18408. TEXTURE29: 34013,
  18409. TEXTURE30: 34014,
  18410. TEXTURE31: 34015,
  18411. ACTIVE_TEXTURE: 34016,
  18412. REPEAT: 10497,
  18413. CLAMP_TO_EDGE: 33071,
  18414. MIRRORED_REPEAT: 33648,
  18415. FLOAT_VEC2: 35664,
  18416. FLOAT_VEC3: 35665,
  18417. FLOAT_VEC4: 35666,
  18418. INT_VEC2: 35667,
  18419. INT_VEC3: 35668,
  18420. INT_VEC4: 35669,
  18421. BOOL: 35670,
  18422. BOOL_VEC2: 35671,
  18423. BOOL_VEC3: 35672,
  18424. BOOL_VEC4: 35673,
  18425. FLOAT_MAT2: 35674,
  18426. FLOAT_MAT3: 35675,
  18427. FLOAT_MAT4: 35676,
  18428. SAMPLER_2D: 35678,
  18429. SAMPLER_CUBE: 35680,
  18430. VERTEX_ATTRIB_ARRAY_ENABLED: 34338,
  18431. VERTEX_ATTRIB_ARRAY_SIZE: 34339,
  18432. VERTEX_ATTRIB_ARRAY_STRIDE: 34340,
  18433. VERTEX_ATTRIB_ARRAY_TYPE: 34341,
  18434. VERTEX_ATTRIB_ARRAY_NORMALIZED: 34922,
  18435. VERTEX_ATTRIB_ARRAY_POINTER: 34373,
  18436. VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: 34975,
  18437. IMPLEMENTATION_COLOR_READ_TYPE: 35738,
  18438. IMPLEMENTATION_COLOR_READ_FORMAT: 35739,
  18439. COMPILE_STATUS: 35713,
  18440. LOW_FLOAT: 36336,
  18441. MEDIUM_FLOAT: 36337,
  18442. HIGH_FLOAT: 36338,
  18443. LOW_INT: 36339,
  18444. MEDIUM_INT: 36340,
  18445. HIGH_INT: 36341,
  18446. FRAMEBUFFER: 36160,
  18447. RENDERBUFFER: 36161,
  18448. RGBA4: 32854,
  18449. RGB5_A1: 32855,
  18450. RGB565: 36194,
  18451. DEPTH_COMPONENT16: 33189,
  18452. STENCIL_INDEX: 6401,
  18453. STENCIL_INDEX8: 36168,
  18454. DEPTH_STENCIL: 34041,
  18455. RENDERBUFFER_WIDTH: 36162,
  18456. RENDERBUFFER_HEIGHT: 36163,
  18457. RENDERBUFFER_INTERNAL_FORMAT: 36164,
  18458. RENDERBUFFER_RED_SIZE: 36176,
  18459. RENDERBUFFER_GREEN_SIZE: 36177,
  18460. RENDERBUFFER_BLUE_SIZE: 36178,
  18461. RENDERBUFFER_ALPHA_SIZE: 36179,
  18462. RENDERBUFFER_DEPTH_SIZE: 36180,
  18463. RENDERBUFFER_STENCIL_SIZE: 36181,
  18464. FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 36048,
  18465. FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 36049,
  18466. FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: 36050,
  18467. FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: 36051,
  18468. COLOR_ATTACHMENT0: 36064,
  18469. DEPTH_ATTACHMENT: 36096,
  18470. STENCIL_ATTACHMENT: 36128,
  18471. DEPTH_STENCIL_ATTACHMENT: 33306,
  18472. NONE: 0,
  18473. FRAMEBUFFER_COMPLETE: 36053,
  18474. FRAMEBUFFER_INCOMPLETE_ATTACHMENT: 36054,
  18475. FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: 36055,
  18476. FRAMEBUFFER_INCOMPLETE_DIMENSIONS: 36057,
  18477. FRAMEBUFFER_UNSUPPORTED: 36061,
  18478. FRAMEBUFFER_BINDING: 36006,
  18479. RENDERBUFFER_BINDING: 36007,
  18480. MAX_RENDERBUFFER_SIZE: 34024,
  18481. INVALID_FRAMEBUFFER_OPERATION: 1286,
  18482. UNPACK_FLIP_Y_WEBGL: 37440,
  18483. UNPACK_PREMULTIPLY_ALPHA_WEBGL: 37441,
  18484. CONTEXT_LOST_WEBGL: 37442,
  18485. UNPACK_COLORSPACE_CONVERSION_WEBGL: 37443,
  18486. BROWSER_DEFAULT_WEBGL: 37444,
  18487. COMPRESSED_RGB_S3TC_DXT1_EXT: 33776,
  18488. COMPRESSED_RGBA_S3TC_DXT1_EXT: 33777,
  18489. COMPRESSED_RGBA_S3TC_DXT3_EXT: 33778,
  18490. COMPRESSED_RGBA_S3TC_DXT5_EXT: 33779,
  18491. COMPRESSED_RGB_PVRTC_4BPPV1_IMG: 35840,
  18492. COMPRESSED_RGB_PVRTC_2BPPV1_IMG: 35841,
  18493. COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 35842,
  18494. COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 35843,
  18495. COMPRESSED_RGBA_ASTC_4x4_WEBGL: 37808,
  18496. COMPRESSED_RGB_ETC1_WEBGL: 36196,
  18497. COMPRESSED_RGBA_BPTC_UNORM: 36492,
  18498. HALF_FLOAT_OES: 36193,
  18499. DOUBLE: 5130,
  18500. READ_BUFFER: 3074,
  18501. UNPACK_ROW_LENGTH: 3314,
  18502. UNPACK_SKIP_ROWS: 3315,
  18503. UNPACK_SKIP_PIXELS: 3316,
  18504. PACK_ROW_LENGTH: 3330,
  18505. PACK_SKIP_ROWS: 3331,
  18506. PACK_SKIP_PIXELS: 3332,
  18507. COLOR: 6144,
  18508. DEPTH: 6145,
  18509. STENCIL: 6146,
  18510. RED: 6403,
  18511. RGB8: 32849,
  18512. RGBA8: 32856,
  18513. RGB10_A2: 32857,
  18514. TEXTURE_BINDING_3D: 32874,
  18515. UNPACK_SKIP_IMAGES: 32877,
  18516. UNPACK_IMAGE_HEIGHT: 32878,
  18517. TEXTURE_3D: 32879,
  18518. TEXTURE_WRAP_R: 32882,
  18519. MAX_3D_TEXTURE_SIZE: 32883,
  18520. UNSIGNED_INT_2_10_10_10_REV: 33640,
  18521. MAX_ELEMENTS_VERTICES: 33e3,
  18522. MAX_ELEMENTS_INDICES: 33001,
  18523. TEXTURE_MIN_LOD: 33082,
  18524. TEXTURE_MAX_LOD: 33083,
  18525. TEXTURE_BASE_LEVEL: 33084,
  18526. TEXTURE_MAX_LEVEL: 33085,
  18527. MIN: 32775,
  18528. MAX: 32776,
  18529. DEPTH_COMPONENT24: 33190,
  18530. MAX_TEXTURE_LOD_BIAS: 34045,
  18531. TEXTURE_COMPARE_MODE: 34892,
  18532. TEXTURE_COMPARE_FUNC: 34893,
  18533. CURRENT_QUERY: 34917,
  18534. QUERY_RESULT: 34918,
  18535. QUERY_RESULT_AVAILABLE: 34919,
  18536. STREAM_READ: 35041,
  18537. STREAM_COPY: 35042,
  18538. STATIC_READ: 35045,
  18539. STATIC_COPY: 35046,
  18540. DYNAMIC_READ: 35049,
  18541. DYNAMIC_COPY: 35050,
  18542. MAX_DRAW_BUFFERS: 34852,
  18543. DRAW_BUFFER0: 34853,
  18544. DRAW_BUFFER1: 34854,
  18545. DRAW_BUFFER2: 34855,
  18546. DRAW_BUFFER3: 34856,
  18547. DRAW_BUFFER4: 34857,
  18548. DRAW_BUFFER5: 34858,
  18549. DRAW_BUFFER6: 34859,
  18550. DRAW_BUFFER7: 34860,
  18551. DRAW_BUFFER8: 34861,
  18552. DRAW_BUFFER9: 34862,
  18553. DRAW_BUFFER10: 34863,
  18554. DRAW_BUFFER11: 34864,
  18555. DRAW_BUFFER12: 34865,
  18556. DRAW_BUFFER13: 34866,
  18557. DRAW_BUFFER14: 34867,
  18558. DRAW_BUFFER15: 34868,
  18559. MAX_FRAGMENT_UNIFORM_COMPONENTS: 35657,
  18560. MAX_VERTEX_UNIFORM_COMPONENTS: 35658,
  18561. SAMPLER_3D: 35679,
  18562. SAMPLER_2D_SHADOW: 35682,
  18563. FRAGMENT_SHADER_DERIVATIVE_HINT: 35723,
  18564. PIXEL_PACK_BUFFER: 35051,
  18565. PIXEL_UNPACK_BUFFER: 35052,
  18566. PIXEL_PACK_BUFFER_BINDING: 35053,
  18567. PIXEL_UNPACK_BUFFER_BINDING: 35055,
  18568. FLOAT_MAT2x3: 35685,
  18569. FLOAT_MAT2x4: 35686,
  18570. FLOAT_MAT3x2: 35687,
  18571. FLOAT_MAT3x4: 35688,
  18572. FLOAT_MAT4x2: 35689,
  18573. FLOAT_MAT4x3: 35690,
  18574. SRGB: 35904,
  18575. SRGB8: 35905,
  18576. SRGB8_ALPHA8: 35907,
  18577. COMPARE_REF_TO_TEXTURE: 34894,
  18578. RGBA32F: 34836,
  18579. RGB32F: 34837,
  18580. RGBA16F: 34842,
  18581. RGB16F: 34843,
  18582. VERTEX_ATTRIB_ARRAY_INTEGER: 35069,
  18583. MAX_ARRAY_TEXTURE_LAYERS: 35071,
  18584. MIN_PROGRAM_TEXEL_OFFSET: 35076,
  18585. MAX_PROGRAM_TEXEL_OFFSET: 35077,
  18586. MAX_VARYING_COMPONENTS: 35659,
  18587. TEXTURE_2D_ARRAY: 35866,
  18588. TEXTURE_BINDING_2D_ARRAY: 35869,
  18589. R11F_G11F_B10F: 35898,
  18590. UNSIGNED_INT_10F_11F_11F_REV: 35899,
  18591. RGB9_E5: 35901,
  18592. UNSIGNED_INT_5_9_9_9_REV: 35902,
  18593. TRANSFORM_FEEDBACK_BUFFER_MODE: 35967,
  18594. MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: 35968,
  18595. TRANSFORM_FEEDBACK_VARYINGS: 35971,
  18596. TRANSFORM_FEEDBACK_BUFFER_START: 35972,
  18597. TRANSFORM_FEEDBACK_BUFFER_SIZE: 35973,
  18598. TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: 35976,
  18599. RASTERIZER_DISCARD: 35977,
  18600. MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: 35978,
  18601. MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: 35979,
  18602. INTERLEAVED_ATTRIBS: 35980,
  18603. SEPARATE_ATTRIBS: 35981,
  18604. TRANSFORM_FEEDBACK_BUFFER: 35982,
  18605. TRANSFORM_FEEDBACK_BUFFER_BINDING: 35983,
  18606. RGBA32UI: 36208,
  18607. RGB32UI: 36209,
  18608. RGBA16UI: 36214,
  18609. RGB16UI: 36215,
  18610. RGBA8UI: 36220,
  18611. RGB8UI: 36221,
  18612. RGBA32I: 36226,
  18613. RGB32I: 36227,
  18614. RGBA16I: 36232,
  18615. RGB16I: 36233,
  18616. RGBA8I: 36238,
  18617. RGB8I: 36239,
  18618. RED_INTEGER: 36244,
  18619. RGB_INTEGER: 36248,
  18620. RGBA_INTEGER: 36249,
  18621. SAMPLER_2D_ARRAY: 36289,
  18622. SAMPLER_2D_ARRAY_SHADOW: 36292,
  18623. SAMPLER_CUBE_SHADOW: 36293,
  18624. UNSIGNED_INT_VEC2: 36294,
  18625. UNSIGNED_INT_VEC3: 36295,
  18626. UNSIGNED_INT_VEC4: 36296,
  18627. INT_SAMPLER_2D: 36298,
  18628. INT_SAMPLER_3D: 36299,
  18629. INT_SAMPLER_CUBE: 36300,
  18630. INT_SAMPLER_2D_ARRAY: 36303,
  18631. UNSIGNED_INT_SAMPLER_2D: 36306,
  18632. UNSIGNED_INT_SAMPLER_3D: 36307,
  18633. UNSIGNED_INT_SAMPLER_CUBE: 36308,
  18634. UNSIGNED_INT_SAMPLER_2D_ARRAY: 36311,
  18635. DEPTH_COMPONENT32F: 36012,
  18636. DEPTH32F_STENCIL8: 36013,
  18637. FLOAT_32_UNSIGNED_INT_24_8_REV: 36269,
  18638. FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: 33296,
  18639. FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: 33297,
  18640. FRAMEBUFFER_ATTACHMENT_RED_SIZE: 33298,
  18641. FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: 33299,
  18642. FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: 33300,
  18643. FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: 33301,
  18644. FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: 33302,
  18645. FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: 33303,
  18646. FRAMEBUFFER_DEFAULT: 33304,
  18647. UNSIGNED_INT_24_8: 34042,
  18648. DEPTH24_STENCIL8: 35056,
  18649. UNSIGNED_NORMALIZED: 35863,
  18650. DRAW_FRAMEBUFFER_BINDING: 36006,
  18651. READ_FRAMEBUFFER: 36008,
  18652. DRAW_FRAMEBUFFER: 36009,
  18653. READ_FRAMEBUFFER_BINDING: 36010,
  18654. RENDERBUFFER_SAMPLES: 36011,
  18655. FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: 36052,
  18656. MAX_COLOR_ATTACHMENTS: 36063,
  18657. COLOR_ATTACHMENT1: 36065,
  18658. COLOR_ATTACHMENT2: 36066,
  18659. COLOR_ATTACHMENT3: 36067,
  18660. COLOR_ATTACHMENT4: 36068,
  18661. COLOR_ATTACHMENT5: 36069,
  18662. COLOR_ATTACHMENT6: 36070,
  18663. COLOR_ATTACHMENT7: 36071,
  18664. COLOR_ATTACHMENT8: 36072,
  18665. COLOR_ATTACHMENT9: 36073,
  18666. COLOR_ATTACHMENT10: 36074,
  18667. COLOR_ATTACHMENT11: 36075,
  18668. COLOR_ATTACHMENT12: 36076,
  18669. COLOR_ATTACHMENT13: 36077,
  18670. COLOR_ATTACHMENT14: 36078,
  18671. COLOR_ATTACHMENT15: 36079,
  18672. FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: 36182,
  18673. MAX_SAMPLES: 36183,
  18674. HALF_FLOAT: 5131,
  18675. RG: 33319,
  18676. RG_INTEGER: 33320,
  18677. R8: 33321,
  18678. RG8: 33323,
  18679. R16F: 33325,
  18680. R32F: 33326,
  18681. RG16F: 33327,
  18682. RG32F: 33328,
  18683. R8I: 33329,
  18684. R8UI: 33330,
  18685. R16I: 33331,
  18686. R16UI: 33332,
  18687. R32I: 33333,
  18688. R32UI: 33334,
  18689. RG8I: 33335,
  18690. RG8UI: 33336,
  18691. RG16I: 33337,
  18692. RG16UI: 33338,
  18693. RG32I: 33339,
  18694. RG32UI: 33340,
  18695. VERTEX_ARRAY_BINDING: 34229,
  18696. R8_SNORM: 36756,
  18697. RG8_SNORM: 36757,
  18698. RGB8_SNORM: 36758,
  18699. RGBA8_SNORM: 36759,
  18700. SIGNED_NORMALIZED: 36764,
  18701. COPY_READ_BUFFER: 36662,
  18702. COPY_WRITE_BUFFER: 36663,
  18703. COPY_READ_BUFFER_BINDING: 36662,
  18704. COPY_WRITE_BUFFER_BINDING: 36663,
  18705. UNIFORM_BUFFER: 35345,
  18706. UNIFORM_BUFFER_BINDING: 35368,
  18707. UNIFORM_BUFFER_START: 35369,
  18708. UNIFORM_BUFFER_SIZE: 35370,
  18709. MAX_VERTEX_UNIFORM_BLOCKS: 35371,
  18710. MAX_FRAGMENT_UNIFORM_BLOCKS: 35373,
  18711. MAX_COMBINED_UNIFORM_BLOCKS: 35374,
  18712. MAX_UNIFORM_BUFFER_BINDINGS: 35375,
  18713. MAX_UNIFORM_BLOCK_SIZE: 35376,
  18714. MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: 35377,
  18715. MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: 35379,
  18716. UNIFORM_BUFFER_OFFSET_ALIGNMENT: 35380,
  18717. ACTIVE_UNIFORM_BLOCKS: 35382,
  18718. UNIFORM_TYPE: 35383,
  18719. UNIFORM_SIZE: 35384,
  18720. UNIFORM_BLOCK_INDEX: 35386,
  18721. UNIFORM_OFFSET: 35387,
  18722. UNIFORM_ARRAY_STRIDE: 35388,
  18723. UNIFORM_MATRIX_STRIDE: 35389,
  18724. UNIFORM_IS_ROW_MAJOR: 35390,
  18725. UNIFORM_BLOCK_BINDING: 35391,
  18726. UNIFORM_BLOCK_DATA_SIZE: 35392,
  18727. UNIFORM_BLOCK_ACTIVE_UNIFORMS: 35394,
  18728. UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: 35395,
  18729. UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: 35396,
  18730. UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: 35398,
  18731. INVALID_INDEX: 4294967295,
  18732. MAX_VERTEX_OUTPUT_COMPONENTS: 37154,
  18733. MAX_FRAGMENT_INPUT_COMPONENTS: 37157,
  18734. MAX_SERVER_WAIT_TIMEOUT: 37137,
  18735. OBJECT_TYPE: 37138,
  18736. SYNC_CONDITION: 37139,
  18737. SYNC_STATUS: 37140,
  18738. SYNC_FLAGS: 37141,
  18739. SYNC_FENCE: 37142,
  18740. SYNC_GPU_COMMANDS_COMPLETE: 37143,
  18741. UNSIGNALED: 37144,
  18742. SIGNALED: 37145,
  18743. ALREADY_SIGNALED: 37146,
  18744. TIMEOUT_EXPIRED: 37147,
  18745. CONDITION_SATISFIED: 37148,
  18746. WAIT_FAILED: 37149,
  18747. SYNC_FLUSH_COMMANDS_BIT: 1,
  18748. VERTEX_ATTRIB_ARRAY_DIVISOR: 35070,
  18749. ANY_SAMPLES_PASSED: 35887,
  18750. ANY_SAMPLES_PASSED_CONSERVATIVE: 36202,
  18751. SAMPLER_BINDING: 35097,
  18752. RGB10_A2UI: 36975,
  18753. INT_2_10_10_10_REV: 36255,
  18754. TRANSFORM_FEEDBACK: 36386,
  18755. TRANSFORM_FEEDBACK_PAUSED: 36387,
  18756. TRANSFORM_FEEDBACK_ACTIVE: 36388,
  18757. TRANSFORM_FEEDBACK_BINDING: 36389,
  18758. COMPRESSED_R11_EAC: 37488,
  18759. COMPRESSED_SIGNED_R11_EAC: 37489,
  18760. COMPRESSED_RG11_EAC: 37490,
  18761. COMPRESSED_SIGNED_RG11_EAC: 37491,
  18762. COMPRESSED_RGB8_ETC2: 37492,
  18763. COMPRESSED_SRGB8_ETC2: 37493,
  18764. COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37494,
  18765. COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37495,
  18766. COMPRESSED_RGBA8_ETC2_EAC: 37496,
  18767. COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: 37497,
  18768. TEXTURE_IMMUTABLE_FORMAT: 37167,
  18769. MAX_ELEMENT_INDEX: 36203,
  18770. TEXTURE_IMMUTABLE_LEVELS: 33503,
  18771. MAX_TEXTURE_MAX_ANISOTROPY_EXT: 34047
  18772. };
  18773. var WebGLConstants_default = Object.freeze(WebGLConstants);
  18774. // node_modules/cesium/Source/Core/ComponentDatatype.js
  18775. var ComponentDatatype = {
  18776. BYTE: WebGLConstants_default.BYTE,
  18777. UNSIGNED_BYTE: WebGLConstants_default.UNSIGNED_BYTE,
  18778. SHORT: WebGLConstants_default.SHORT,
  18779. UNSIGNED_SHORT: WebGLConstants_default.UNSIGNED_SHORT,
  18780. INT: WebGLConstants_default.INT,
  18781. UNSIGNED_INT: WebGLConstants_default.UNSIGNED_INT,
  18782. FLOAT: WebGLConstants_default.FLOAT,
  18783. DOUBLE: WebGLConstants_default.DOUBLE
  18784. };
  18785. ComponentDatatype.getSizeInBytes = function(componentDatatype) {
  18786. if (!defined_default(componentDatatype)) {
  18787. throw new DeveloperError_default("value is required.");
  18788. }
  18789. switch (componentDatatype) {
  18790. case ComponentDatatype.BYTE:
  18791. return Int8Array.BYTES_PER_ELEMENT;
  18792. case ComponentDatatype.UNSIGNED_BYTE:
  18793. return Uint8Array.BYTES_PER_ELEMENT;
  18794. case ComponentDatatype.SHORT:
  18795. return Int16Array.BYTES_PER_ELEMENT;
  18796. case ComponentDatatype.UNSIGNED_SHORT:
  18797. return Uint16Array.BYTES_PER_ELEMENT;
  18798. case ComponentDatatype.INT:
  18799. return Int32Array.BYTES_PER_ELEMENT;
  18800. case ComponentDatatype.UNSIGNED_INT:
  18801. return Uint32Array.BYTES_PER_ELEMENT;
  18802. case ComponentDatatype.FLOAT:
  18803. return Float32Array.BYTES_PER_ELEMENT;
  18804. case ComponentDatatype.DOUBLE:
  18805. return Float64Array.BYTES_PER_ELEMENT;
  18806. default:
  18807. throw new DeveloperError_default("componentDatatype is not a valid value.");
  18808. }
  18809. };
  18810. ComponentDatatype.fromTypedArray = function(array) {
  18811. if (array instanceof Int8Array) {
  18812. return ComponentDatatype.BYTE;
  18813. }
  18814. if (array instanceof Uint8Array) {
  18815. return ComponentDatatype.UNSIGNED_BYTE;
  18816. }
  18817. if (array instanceof Int16Array) {
  18818. return ComponentDatatype.SHORT;
  18819. }
  18820. if (array instanceof Uint16Array) {
  18821. return ComponentDatatype.UNSIGNED_SHORT;
  18822. }
  18823. if (array instanceof Int32Array) {
  18824. return ComponentDatatype.INT;
  18825. }
  18826. if (array instanceof Uint32Array) {
  18827. return ComponentDatatype.UNSIGNED_INT;
  18828. }
  18829. if (array instanceof Float32Array) {
  18830. return ComponentDatatype.FLOAT;
  18831. }
  18832. if (array instanceof Float64Array) {
  18833. return ComponentDatatype.DOUBLE;
  18834. }
  18835. };
  18836. ComponentDatatype.validate = function(componentDatatype) {
  18837. return defined_default(componentDatatype) && (componentDatatype === ComponentDatatype.BYTE || componentDatatype === ComponentDatatype.UNSIGNED_BYTE || componentDatatype === ComponentDatatype.SHORT || componentDatatype === ComponentDatatype.UNSIGNED_SHORT || componentDatatype === ComponentDatatype.INT || componentDatatype === ComponentDatatype.UNSIGNED_INT || componentDatatype === ComponentDatatype.FLOAT || componentDatatype === ComponentDatatype.DOUBLE);
  18838. };
  18839. ComponentDatatype.createTypedArray = function(componentDatatype, valuesOrLength) {
  18840. if (!defined_default(componentDatatype)) {
  18841. throw new DeveloperError_default("componentDatatype is required.");
  18842. }
  18843. if (!defined_default(valuesOrLength)) {
  18844. throw new DeveloperError_default("valuesOrLength is required.");
  18845. }
  18846. switch (componentDatatype) {
  18847. case ComponentDatatype.BYTE:
  18848. return new Int8Array(valuesOrLength);
  18849. case ComponentDatatype.UNSIGNED_BYTE:
  18850. return new Uint8Array(valuesOrLength);
  18851. case ComponentDatatype.SHORT:
  18852. return new Int16Array(valuesOrLength);
  18853. case ComponentDatatype.UNSIGNED_SHORT:
  18854. return new Uint16Array(valuesOrLength);
  18855. case ComponentDatatype.INT:
  18856. return new Int32Array(valuesOrLength);
  18857. case ComponentDatatype.UNSIGNED_INT:
  18858. return new Uint32Array(valuesOrLength);
  18859. case ComponentDatatype.FLOAT:
  18860. return new Float32Array(valuesOrLength);
  18861. case ComponentDatatype.DOUBLE:
  18862. return new Float64Array(valuesOrLength);
  18863. default:
  18864. throw new DeveloperError_default("componentDatatype is not a valid value.");
  18865. }
  18866. };
  18867. ComponentDatatype.createArrayBufferView = function(componentDatatype, buffer, byteOffset, length3) {
  18868. if (!defined_default(componentDatatype)) {
  18869. throw new DeveloperError_default("componentDatatype is required.");
  18870. }
  18871. if (!defined_default(buffer)) {
  18872. throw new DeveloperError_default("buffer is required.");
  18873. }
  18874. byteOffset = defaultValue_default(byteOffset, 0);
  18875. length3 = defaultValue_default(
  18876. length3,
  18877. (buffer.byteLength - byteOffset) / ComponentDatatype.getSizeInBytes(componentDatatype)
  18878. );
  18879. switch (componentDatatype) {
  18880. case ComponentDatatype.BYTE:
  18881. return new Int8Array(buffer, byteOffset, length3);
  18882. case ComponentDatatype.UNSIGNED_BYTE:
  18883. return new Uint8Array(buffer, byteOffset, length3);
  18884. case ComponentDatatype.SHORT:
  18885. return new Int16Array(buffer, byteOffset, length3);
  18886. case ComponentDatatype.UNSIGNED_SHORT:
  18887. return new Uint16Array(buffer, byteOffset, length3);
  18888. case ComponentDatatype.INT:
  18889. return new Int32Array(buffer, byteOffset, length3);
  18890. case ComponentDatatype.UNSIGNED_INT:
  18891. return new Uint32Array(buffer, byteOffset, length3);
  18892. case ComponentDatatype.FLOAT:
  18893. return new Float32Array(buffer, byteOffset, length3);
  18894. case ComponentDatatype.DOUBLE:
  18895. return new Float64Array(buffer, byteOffset, length3);
  18896. default:
  18897. throw new DeveloperError_default("componentDatatype is not a valid value.");
  18898. }
  18899. };
  18900. ComponentDatatype.fromName = function(name) {
  18901. switch (name) {
  18902. case "BYTE":
  18903. return ComponentDatatype.BYTE;
  18904. case "UNSIGNED_BYTE":
  18905. return ComponentDatatype.UNSIGNED_BYTE;
  18906. case "SHORT":
  18907. return ComponentDatatype.SHORT;
  18908. case "UNSIGNED_SHORT":
  18909. return ComponentDatatype.UNSIGNED_SHORT;
  18910. case "INT":
  18911. return ComponentDatatype.INT;
  18912. case "UNSIGNED_INT":
  18913. return ComponentDatatype.UNSIGNED_INT;
  18914. case "FLOAT":
  18915. return ComponentDatatype.FLOAT;
  18916. case "DOUBLE":
  18917. return ComponentDatatype.DOUBLE;
  18918. default:
  18919. throw new DeveloperError_default("name is not a valid value.");
  18920. }
  18921. };
  18922. var ComponentDatatype_default = Object.freeze(ComponentDatatype);
  18923. // node_modules/cesium/Source/Core/Matrix2.js
  18924. function Matrix2(column0Row0, column1Row0, column0Row1, column1Row1) {
  18925. this[0] = defaultValue_default(column0Row0, 0);
  18926. this[1] = defaultValue_default(column0Row1, 0);
  18927. this[2] = defaultValue_default(column1Row0, 0);
  18928. this[3] = defaultValue_default(column1Row1, 0);
  18929. }
  18930. Matrix2.packedLength = 4;
  18931. Matrix2.pack = function(value, array, startingIndex) {
  18932. Check_default.typeOf.object("value", value);
  18933. Check_default.defined("array", array);
  18934. startingIndex = defaultValue_default(startingIndex, 0);
  18935. array[startingIndex++] = value[0];
  18936. array[startingIndex++] = value[1];
  18937. array[startingIndex++] = value[2];
  18938. array[startingIndex++] = value[3];
  18939. return array;
  18940. };
  18941. Matrix2.unpack = function(array, startingIndex, result) {
  18942. Check_default.defined("array", array);
  18943. startingIndex = defaultValue_default(startingIndex, 0);
  18944. if (!defined_default(result)) {
  18945. result = new Matrix2();
  18946. }
  18947. result[0] = array[startingIndex++];
  18948. result[1] = array[startingIndex++];
  18949. result[2] = array[startingIndex++];
  18950. result[3] = array[startingIndex++];
  18951. return result;
  18952. };
  18953. Matrix2.packArray = function(array, result) {
  18954. Check_default.defined("array", array);
  18955. const length3 = array.length;
  18956. const resultLength = length3 * 4;
  18957. if (!defined_default(result)) {
  18958. result = new Array(resultLength);
  18959. } else if (!Array.isArray(result) && result.length !== resultLength) {
  18960. throw new DeveloperError_default(
  18961. "If result is a typed array, it must have exactly array.length * 4 elements"
  18962. );
  18963. } else if (result.length !== resultLength) {
  18964. result.length = resultLength;
  18965. }
  18966. for (let i2 = 0; i2 < length3; ++i2) {
  18967. Matrix2.pack(array[i2], result, i2 * 4);
  18968. }
  18969. return result;
  18970. };
  18971. Matrix2.unpackArray = function(array, result) {
  18972. Check_default.defined("array", array);
  18973. Check_default.typeOf.number.greaterThanOrEquals("array.length", array.length, 4);
  18974. if (array.length % 4 !== 0) {
  18975. throw new DeveloperError_default("array length must be a multiple of 4.");
  18976. }
  18977. const length3 = array.length;
  18978. if (!defined_default(result)) {
  18979. result = new Array(length3 / 4);
  18980. } else {
  18981. result.length = length3 / 4;
  18982. }
  18983. for (let i2 = 0; i2 < length3; i2 += 4) {
  18984. const index2 = i2 / 4;
  18985. result[index2] = Matrix2.unpack(array, i2, result[index2]);
  18986. }
  18987. return result;
  18988. };
  18989. Matrix2.clone = function(matrix, result) {
  18990. if (!defined_default(matrix)) {
  18991. return void 0;
  18992. }
  18993. if (!defined_default(result)) {
  18994. return new Matrix2(matrix[0], matrix[2], matrix[1], matrix[3]);
  18995. }
  18996. result[0] = matrix[0];
  18997. result[1] = matrix[1];
  18998. result[2] = matrix[2];
  18999. result[3] = matrix[3];
  19000. return result;
  19001. };
  19002. Matrix2.fromArray = Matrix2.unpack;
  19003. Matrix2.fromColumnMajorArray = function(values, result) {
  19004. Check_default.defined("values", values);
  19005. return Matrix2.clone(values, result);
  19006. };
  19007. Matrix2.fromRowMajorArray = function(values, result) {
  19008. Check_default.defined("values", values);
  19009. if (!defined_default(result)) {
  19010. return new Matrix2(values[0], values[1], values[2], values[3]);
  19011. }
  19012. result[0] = values[0];
  19013. result[1] = values[2];
  19014. result[2] = values[1];
  19015. result[3] = values[3];
  19016. return result;
  19017. };
  19018. Matrix2.fromScale = function(scale, result) {
  19019. Check_default.typeOf.object("scale", scale);
  19020. if (!defined_default(result)) {
  19021. return new Matrix2(scale.x, 0, 0, scale.y);
  19022. }
  19023. result[0] = scale.x;
  19024. result[1] = 0;
  19025. result[2] = 0;
  19026. result[3] = scale.y;
  19027. return result;
  19028. };
  19029. Matrix2.fromUniformScale = function(scale, result) {
  19030. Check_default.typeOf.number("scale", scale);
  19031. if (!defined_default(result)) {
  19032. return new Matrix2(scale, 0, 0, scale);
  19033. }
  19034. result[0] = scale;
  19035. result[1] = 0;
  19036. result[2] = 0;
  19037. result[3] = scale;
  19038. return result;
  19039. };
  19040. Matrix2.fromRotation = function(angle, result) {
  19041. Check_default.typeOf.number("angle", angle);
  19042. const cosAngle = Math.cos(angle);
  19043. const sinAngle = Math.sin(angle);
  19044. if (!defined_default(result)) {
  19045. return new Matrix2(cosAngle, -sinAngle, sinAngle, cosAngle);
  19046. }
  19047. result[0] = cosAngle;
  19048. result[1] = sinAngle;
  19049. result[2] = -sinAngle;
  19050. result[3] = cosAngle;
  19051. return result;
  19052. };
  19053. Matrix2.toArray = function(matrix, result) {
  19054. Check_default.typeOf.object("matrix", matrix);
  19055. if (!defined_default(result)) {
  19056. return [matrix[0], matrix[1], matrix[2], matrix[3]];
  19057. }
  19058. result[0] = matrix[0];
  19059. result[1] = matrix[1];
  19060. result[2] = matrix[2];
  19061. result[3] = matrix[3];
  19062. return result;
  19063. };
  19064. Matrix2.getElementIndex = function(column, row) {
  19065. Check_default.typeOf.number.greaterThanOrEquals("row", row, 0);
  19066. Check_default.typeOf.number.lessThanOrEquals("row", row, 1);
  19067. Check_default.typeOf.number.greaterThanOrEquals("column", column, 0);
  19068. Check_default.typeOf.number.lessThanOrEquals("column", column, 1);
  19069. return column * 2 + row;
  19070. };
  19071. Matrix2.getColumn = function(matrix, index2, result) {
  19072. Check_default.typeOf.object("matrix", matrix);
  19073. Check_default.typeOf.number.greaterThanOrEquals("index", index2, 0);
  19074. Check_default.typeOf.number.lessThanOrEquals("index", index2, 1);
  19075. Check_default.typeOf.object("result", result);
  19076. const startIndex = index2 * 2;
  19077. const x = matrix[startIndex];
  19078. const y = matrix[startIndex + 1];
  19079. result.x = x;
  19080. result.y = y;
  19081. return result;
  19082. };
  19083. Matrix2.setColumn = function(matrix, index2, cartesian11, result) {
  19084. Check_default.typeOf.object("matrix", matrix);
  19085. Check_default.typeOf.number.greaterThanOrEquals("index", index2, 0);
  19086. Check_default.typeOf.number.lessThanOrEquals("index", index2, 1);
  19087. Check_default.typeOf.object("cartesian", cartesian11);
  19088. Check_default.typeOf.object("result", result);
  19089. result = Matrix2.clone(matrix, result);
  19090. const startIndex = index2 * 2;
  19091. result[startIndex] = cartesian11.x;
  19092. result[startIndex + 1] = cartesian11.y;
  19093. return result;
  19094. };
  19095. Matrix2.getRow = function(matrix, index2, result) {
  19096. Check_default.typeOf.object("matrix", matrix);
  19097. Check_default.typeOf.number.greaterThanOrEquals("index", index2, 0);
  19098. Check_default.typeOf.number.lessThanOrEquals("index", index2, 1);
  19099. Check_default.typeOf.object("result", result);
  19100. const x = matrix[index2];
  19101. const y = matrix[index2 + 2];
  19102. result.x = x;
  19103. result.y = y;
  19104. return result;
  19105. };
  19106. Matrix2.setRow = function(matrix, index2, cartesian11, result) {
  19107. Check_default.typeOf.object("matrix", matrix);
  19108. Check_default.typeOf.number.greaterThanOrEquals("index", index2, 0);
  19109. Check_default.typeOf.number.lessThanOrEquals("index", index2, 1);
  19110. Check_default.typeOf.object("cartesian", cartesian11);
  19111. Check_default.typeOf.object("result", result);
  19112. result = Matrix2.clone(matrix, result);
  19113. result[index2] = cartesian11.x;
  19114. result[index2 + 2] = cartesian11.y;
  19115. return result;
  19116. };
  19117. var scaleScratch13 = new Cartesian2_default();
  19118. Matrix2.setScale = function(matrix, scale, result) {
  19119. Check_default.typeOf.object("matrix", matrix);
  19120. Check_default.typeOf.object("scale", scale);
  19121. Check_default.typeOf.object("result", result);
  19122. const existingScale = Matrix2.getScale(matrix, scaleScratch13);
  19123. const scaleRatioX = scale.x / existingScale.x;
  19124. const scaleRatioY = scale.y / existingScale.y;
  19125. result[0] = matrix[0] * scaleRatioX;
  19126. result[1] = matrix[1] * scaleRatioX;
  19127. result[2] = matrix[2] * scaleRatioY;
  19128. result[3] = matrix[3] * scaleRatioY;
  19129. return result;
  19130. };
  19131. var scaleScratch23 = new Cartesian2_default();
  19132. Matrix2.setUniformScale = function(matrix, scale, result) {
  19133. Check_default.typeOf.object("matrix", matrix);
  19134. Check_default.typeOf.number("scale", scale);
  19135. Check_default.typeOf.object("result", result);
  19136. const existingScale = Matrix2.getScale(matrix, scaleScratch23);
  19137. const scaleRatioX = scale / existingScale.x;
  19138. const scaleRatioY = scale / existingScale.y;
  19139. result[0] = matrix[0] * scaleRatioX;
  19140. result[1] = matrix[1] * scaleRatioX;
  19141. result[2] = matrix[2] * scaleRatioY;
  19142. result[3] = matrix[3] * scaleRatioY;
  19143. return result;
  19144. };
  19145. var scratchColumn3 = new Cartesian2_default();
  19146. Matrix2.getScale = function(matrix, result) {
  19147. Check_default.typeOf.object("matrix", matrix);
  19148. Check_default.typeOf.object("result", result);
  19149. result.x = Cartesian2_default.magnitude(
  19150. Cartesian2_default.fromElements(matrix[0], matrix[1], scratchColumn3)
  19151. );
  19152. result.y = Cartesian2_default.magnitude(
  19153. Cartesian2_default.fromElements(matrix[2], matrix[3], scratchColumn3)
  19154. );
  19155. return result;
  19156. };
  19157. var scaleScratch33 = new Cartesian2_default();
  19158. Matrix2.getMaximumScale = function(matrix) {
  19159. Matrix2.getScale(matrix, scaleScratch33);
  19160. return Cartesian2_default.maximumComponent(scaleScratch33);
  19161. };
  19162. var scaleScratch43 = new Cartesian2_default();
  19163. Matrix2.setRotation = function(matrix, rotation, result) {
  19164. Check_default.typeOf.object("matrix", matrix);
  19165. Check_default.typeOf.object("result", result);
  19166. const scale = Matrix2.getScale(matrix, scaleScratch43);
  19167. result[0] = rotation[0] * scale.x;
  19168. result[1] = rotation[1] * scale.x;
  19169. result[2] = rotation[2] * scale.y;
  19170. result[3] = rotation[3] * scale.y;
  19171. return result;
  19172. };
  19173. var scaleScratch53 = new Cartesian2_default();
  19174. Matrix2.getRotation = function(matrix, result) {
  19175. Check_default.typeOf.object("matrix", matrix);
  19176. Check_default.typeOf.object("result", result);
  19177. const scale = Matrix2.getScale(matrix, scaleScratch53);
  19178. result[0] = matrix[0] / scale.x;
  19179. result[1] = matrix[1] / scale.x;
  19180. result[2] = matrix[2] / scale.y;
  19181. result[3] = matrix[3] / scale.y;
  19182. return result;
  19183. };
  19184. Matrix2.multiply = function(left, right, result) {
  19185. Check_default.typeOf.object("left", left);
  19186. Check_default.typeOf.object("right", right);
  19187. Check_default.typeOf.object("result", result);
  19188. const column0Row0 = left[0] * right[0] + left[2] * right[1];
  19189. const column1Row0 = left[0] * right[2] + left[2] * right[3];
  19190. const column0Row1 = left[1] * right[0] + left[3] * right[1];
  19191. const column1Row1 = left[1] * right[2] + left[3] * right[3];
  19192. result[0] = column0Row0;
  19193. result[1] = column0Row1;
  19194. result[2] = column1Row0;
  19195. result[3] = column1Row1;
  19196. return result;
  19197. };
  19198. Matrix2.add = function(left, right, result) {
  19199. Check_default.typeOf.object("left", left);
  19200. Check_default.typeOf.object("right", right);
  19201. Check_default.typeOf.object("result", result);
  19202. result[0] = left[0] + right[0];
  19203. result[1] = left[1] + right[1];
  19204. result[2] = left[2] + right[2];
  19205. result[3] = left[3] + right[3];
  19206. return result;
  19207. };
  19208. Matrix2.subtract = function(left, right, result) {
  19209. Check_default.typeOf.object("left", left);
  19210. Check_default.typeOf.object("right", right);
  19211. Check_default.typeOf.object("result", result);
  19212. result[0] = left[0] - right[0];
  19213. result[1] = left[1] - right[1];
  19214. result[2] = left[2] - right[2];
  19215. result[3] = left[3] - right[3];
  19216. return result;
  19217. };
  19218. Matrix2.multiplyByVector = function(matrix, cartesian11, result) {
  19219. Check_default.typeOf.object("matrix", matrix);
  19220. Check_default.typeOf.object("cartesian", cartesian11);
  19221. Check_default.typeOf.object("result", result);
  19222. const x = matrix[0] * cartesian11.x + matrix[2] * cartesian11.y;
  19223. const y = matrix[1] * cartesian11.x + matrix[3] * cartesian11.y;
  19224. result.x = x;
  19225. result.y = y;
  19226. return result;
  19227. };
  19228. Matrix2.multiplyByScalar = function(matrix, scalar, result) {
  19229. Check_default.typeOf.object("matrix", matrix);
  19230. Check_default.typeOf.number("scalar", scalar);
  19231. Check_default.typeOf.object("result", result);
  19232. result[0] = matrix[0] * scalar;
  19233. result[1] = matrix[1] * scalar;
  19234. result[2] = matrix[2] * scalar;
  19235. result[3] = matrix[3] * scalar;
  19236. return result;
  19237. };
  19238. Matrix2.multiplyByScale = function(matrix, scale, result) {
  19239. Check_default.typeOf.object("matrix", matrix);
  19240. Check_default.typeOf.object("scale", scale);
  19241. Check_default.typeOf.object("result", result);
  19242. result[0] = matrix[0] * scale.x;
  19243. result[1] = matrix[1] * scale.x;
  19244. result[2] = matrix[2] * scale.y;
  19245. result[3] = matrix[3] * scale.y;
  19246. return result;
  19247. };
  19248. Matrix2.multiplyByUniformScale = function(matrix, scale, result) {
  19249. Check_default.typeOf.object("matrix", matrix);
  19250. Check_default.typeOf.number("scale", scale);
  19251. Check_default.typeOf.object("result", result);
  19252. result[0] = matrix[0] * scale;
  19253. result[1] = matrix[1] * scale;
  19254. result[2] = matrix[2] * scale;
  19255. result[3] = matrix[3] * scale;
  19256. return result;
  19257. };
  19258. Matrix2.negate = function(matrix, result) {
  19259. Check_default.typeOf.object("matrix", matrix);
  19260. Check_default.typeOf.object("result", result);
  19261. result[0] = -matrix[0];
  19262. result[1] = -matrix[1];
  19263. result[2] = -matrix[2];
  19264. result[3] = -matrix[3];
  19265. return result;
  19266. };
  19267. Matrix2.transpose = function(matrix, result) {
  19268. Check_default.typeOf.object("matrix", matrix);
  19269. Check_default.typeOf.object("result", result);
  19270. const column0Row0 = matrix[0];
  19271. const column0Row1 = matrix[2];
  19272. const column1Row0 = matrix[1];
  19273. const column1Row1 = matrix[3];
  19274. result[0] = column0Row0;
  19275. result[1] = column0Row1;
  19276. result[2] = column1Row0;
  19277. result[3] = column1Row1;
  19278. return result;
  19279. };
  19280. Matrix2.abs = function(matrix, result) {
  19281. Check_default.typeOf.object("matrix", matrix);
  19282. Check_default.typeOf.object("result", result);
  19283. result[0] = Math.abs(matrix[0]);
  19284. result[1] = Math.abs(matrix[1]);
  19285. result[2] = Math.abs(matrix[2]);
  19286. result[3] = Math.abs(matrix[3]);
  19287. return result;
  19288. };
  19289. Matrix2.equals = function(left, right) {
  19290. return left === right || defined_default(left) && defined_default(right) && left[0] === right[0] && left[1] === right[1] && left[2] === right[2] && left[3] === right[3];
  19291. };
  19292. Matrix2.equalsArray = function(matrix, array, offset2) {
  19293. return matrix[0] === array[offset2] && matrix[1] === array[offset2 + 1] && matrix[2] === array[offset2 + 2] && matrix[3] === array[offset2 + 3];
  19294. };
  19295. Matrix2.equalsEpsilon = function(left, right, epsilon) {
  19296. epsilon = defaultValue_default(epsilon, 0);
  19297. return left === right || defined_default(left) && defined_default(right) && Math.abs(left[0] - right[0]) <= epsilon && Math.abs(left[1] - right[1]) <= epsilon && Math.abs(left[2] - right[2]) <= epsilon && Math.abs(left[3] - right[3]) <= epsilon;
  19298. };
  19299. Matrix2.IDENTITY = Object.freeze(new Matrix2(1, 0, 0, 1));
  19300. Matrix2.ZERO = Object.freeze(new Matrix2(0, 0, 0, 0));
  19301. Matrix2.COLUMN0ROW0 = 0;
  19302. Matrix2.COLUMN0ROW1 = 1;
  19303. Matrix2.COLUMN1ROW0 = 2;
  19304. Matrix2.COLUMN1ROW1 = 3;
  19305. Object.defineProperties(Matrix2.prototype, {
  19306. length: {
  19307. get: function() {
  19308. return Matrix2.packedLength;
  19309. }
  19310. }
  19311. });
  19312. Matrix2.prototype.clone = function(result) {
  19313. return Matrix2.clone(this, result);
  19314. };
  19315. Matrix2.prototype.equals = function(right) {
  19316. return Matrix2.equals(this, right);
  19317. };
  19318. Matrix2.prototype.equalsEpsilon = function(right, epsilon) {
  19319. return Matrix2.equalsEpsilon(this, right, epsilon);
  19320. };
  19321. Matrix2.prototype.toString = function() {
  19322. return `(${this[0]}, ${this[2]})
  19323. (${this[1]}, ${this[3]})`;
  19324. };
  19325. var Matrix2_default = Matrix2;
  19326. // node_modules/cesium/Source/Scene/AttributeType.js
  19327. var AttributeType = {
  19328. SCALAR: "SCALAR",
  19329. VEC2: "VEC2",
  19330. VEC3: "VEC3",
  19331. VEC4: "VEC4",
  19332. MAT2: "MAT2",
  19333. MAT3: "MAT3",
  19334. MAT4: "MAT4"
  19335. };
  19336. AttributeType.getMathType = function(attributeType) {
  19337. switch (attributeType) {
  19338. case AttributeType.SCALAR:
  19339. return Number;
  19340. case AttributeType.VEC2:
  19341. return Cartesian2_default;
  19342. case AttributeType.VEC3:
  19343. return Cartesian3_default;
  19344. case AttributeType.VEC4:
  19345. return Cartesian4_default;
  19346. case AttributeType.MAT2:
  19347. return Matrix2_default;
  19348. case AttributeType.MAT3:
  19349. return Matrix3_default;
  19350. case AttributeType.MAT4:
  19351. return Matrix4_default;
  19352. default:
  19353. throw new DeveloperError_default("attributeType is not a valid value.");
  19354. }
  19355. };
  19356. AttributeType.getNumberOfComponents = function(attributeType) {
  19357. switch (attributeType) {
  19358. case AttributeType.SCALAR:
  19359. return 1;
  19360. case AttributeType.VEC2:
  19361. return 2;
  19362. case AttributeType.VEC3:
  19363. return 3;
  19364. case AttributeType.VEC4:
  19365. case AttributeType.MAT2:
  19366. return 4;
  19367. case AttributeType.MAT3:
  19368. return 9;
  19369. case AttributeType.MAT4:
  19370. return 16;
  19371. default:
  19372. throw new DeveloperError_default("attributeType is not a valid value.");
  19373. }
  19374. };
  19375. AttributeType.getAttributeLocationCount = function(attributeType) {
  19376. switch (attributeType) {
  19377. case AttributeType.SCALAR:
  19378. case AttributeType.VEC2:
  19379. case AttributeType.VEC3:
  19380. case AttributeType.VEC4:
  19381. return 1;
  19382. case AttributeType.MAT2:
  19383. return 2;
  19384. case AttributeType.MAT3:
  19385. return 3;
  19386. case AttributeType.MAT4:
  19387. return 4;
  19388. default:
  19389. throw new DeveloperError_default("attributeType is not a valid value.");
  19390. }
  19391. };
  19392. AttributeType.getGlslType = function(attributeType) {
  19393. Check_default.typeOf.string("attributeType", attributeType);
  19394. switch (attributeType) {
  19395. case AttributeType.SCALAR:
  19396. return "float";
  19397. case AttributeType.VEC2:
  19398. return "vec2";
  19399. case AttributeType.VEC3:
  19400. return "vec3";
  19401. case AttributeType.VEC4:
  19402. return "vec4";
  19403. case AttributeType.MAT2:
  19404. return "mat2";
  19405. case AttributeType.MAT3:
  19406. return "mat3";
  19407. case AttributeType.MAT4:
  19408. return "mat4";
  19409. default:
  19410. throw new DeveloperError_default("attributeType is not a valid value.");
  19411. }
  19412. };
  19413. var AttributeType_default = Object.freeze(AttributeType);
  19414. // node_modules/cesium/Source/Core/AttributeCompression.js
  19415. var RIGHT_SHIFT = 1 / 256;
  19416. var LEFT_SHIFT = 256;
  19417. var AttributeCompression = {};
  19418. AttributeCompression.octEncodeInRange = function(vector, rangeMax, result) {
  19419. Check_default.defined("vector", vector);
  19420. Check_default.defined("result", result);
  19421. const magSquared = Cartesian3_default.magnitudeSquared(vector);
  19422. if (Math.abs(magSquared - 1) > Math_default.EPSILON6) {
  19423. throw new DeveloperError_default("vector must be normalized.");
  19424. }
  19425. result.x = vector.x / (Math.abs(vector.x) + Math.abs(vector.y) + Math.abs(vector.z));
  19426. result.y = vector.y / (Math.abs(vector.x) + Math.abs(vector.y) + Math.abs(vector.z));
  19427. if (vector.z < 0) {
  19428. const x = result.x;
  19429. const y = result.y;
  19430. result.x = (1 - Math.abs(y)) * Math_default.signNotZero(x);
  19431. result.y = (1 - Math.abs(x)) * Math_default.signNotZero(y);
  19432. }
  19433. result.x = Math_default.toSNorm(result.x, rangeMax);
  19434. result.y = Math_default.toSNorm(result.y, rangeMax);
  19435. return result;
  19436. };
  19437. AttributeCompression.octEncode = function(vector, result) {
  19438. return AttributeCompression.octEncodeInRange(vector, 255, result);
  19439. };
  19440. var octEncodeScratch = new Cartesian2_default();
  19441. var uint8ForceArray = new Uint8Array(1);
  19442. function forceUint8(value) {
  19443. uint8ForceArray[0] = value;
  19444. return uint8ForceArray[0];
  19445. }
  19446. AttributeCompression.octEncodeToCartesian4 = function(vector, result) {
  19447. AttributeCompression.octEncodeInRange(vector, 65535, octEncodeScratch);
  19448. result.x = forceUint8(octEncodeScratch.x * RIGHT_SHIFT);
  19449. result.y = forceUint8(octEncodeScratch.x);
  19450. result.z = forceUint8(octEncodeScratch.y * RIGHT_SHIFT);
  19451. result.w = forceUint8(octEncodeScratch.y);
  19452. return result;
  19453. };
  19454. AttributeCompression.octDecodeInRange = function(x, y, rangeMax, result) {
  19455. Check_default.defined("result", result);
  19456. if (x < 0 || x > rangeMax || y < 0 || y > rangeMax) {
  19457. throw new DeveloperError_default(
  19458. `x and y must be unsigned normalized integers between 0 and ${rangeMax}`
  19459. );
  19460. }
  19461. result.x = Math_default.fromSNorm(x, rangeMax);
  19462. result.y = Math_default.fromSNorm(y, rangeMax);
  19463. result.z = 1 - (Math.abs(result.x) + Math.abs(result.y));
  19464. if (result.z < 0) {
  19465. const oldVX = result.x;
  19466. result.x = (1 - Math.abs(result.y)) * Math_default.signNotZero(oldVX);
  19467. result.y = (1 - Math.abs(oldVX)) * Math_default.signNotZero(result.y);
  19468. }
  19469. return Cartesian3_default.normalize(result, result);
  19470. };
  19471. AttributeCompression.octDecode = function(x, y, result) {
  19472. return AttributeCompression.octDecodeInRange(x, y, 255, result);
  19473. };
  19474. AttributeCompression.octDecodeFromCartesian4 = function(encoded, result) {
  19475. Check_default.typeOf.object("encoded", encoded);
  19476. Check_default.typeOf.object("result", result);
  19477. const x = encoded.x;
  19478. const y = encoded.y;
  19479. const z = encoded.z;
  19480. const w = encoded.w;
  19481. if (x < 0 || x > 255 || y < 0 || y > 255 || z < 0 || z > 255 || w < 0 || w > 255) {
  19482. throw new DeveloperError_default(
  19483. "x, y, z, and w must be unsigned normalized integers between 0 and 255"
  19484. );
  19485. }
  19486. const xOct16 = x * LEFT_SHIFT + y;
  19487. const yOct16 = z * LEFT_SHIFT + w;
  19488. return AttributeCompression.octDecodeInRange(xOct16, yOct16, 65535, result);
  19489. };
  19490. AttributeCompression.octPackFloat = function(encoded) {
  19491. Check_default.defined("encoded", encoded);
  19492. return 256 * encoded.x + encoded.y;
  19493. };
  19494. var scratchEncodeCart2 = new Cartesian2_default();
  19495. AttributeCompression.octEncodeFloat = function(vector) {
  19496. AttributeCompression.octEncode(vector, scratchEncodeCart2);
  19497. return AttributeCompression.octPackFloat(scratchEncodeCart2);
  19498. };
  19499. AttributeCompression.octDecodeFloat = function(value, result) {
  19500. Check_default.defined("value", value);
  19501. const temp = value / 256;
  19502. const x = Math.floor(temp);
  19503. const y = (temp - x) * 256;
  19504. return AttributeCompression.octDecode(x, y, result);
  19505. };
  19506. AttributeCompression.octPack = function(v13, v23, v32, result) {
  19507. Check_default.defined("v1", v13);
  19508. Check_default.defined("v2", v23);
  19509. Check_default.defined("v3", v32);
  19510. Check_default.defined("result", result);
  19511. const encoded1 = AttributeCompression.octEncodeFloat(v13);
  19512. const encoded2 = AttributeCompression.octEncodeFloat(v23);
  19513. const encoded3 = AttributeCompression.octEncode(v32, scratchEncodeCart2);
  19514. result.x = 65536 * encoded3.x + encoded1;
  19515. result.y = 65536 * encoded3.y + encoded2;
  19516. return result;
  19517. };
  19518. AttributeCompression.octUnpack = function(packed, v13, v23, v32) {
  19519. Check_default.defined("packed", packed);
  19520. Check_default.defined("v1", v13);
  19521. Check_default.defined("v2", v23);
  19522. Check_default.defined("v3", v32);
  19523. let temp = packed.x / 65536;
  19524. const x = Math.floor(temp);
  19525. const encodedFloat1 = (temp - x) * 65536;
  19526. temp = packed.y / 65536;
  19527. const y = Math.floor(temp);
  19528. const encodedFloat2 = (temp - y) * 65536;
  19529. AttributeCompression.octDecodeFloat(encodedFloat1, v13);
  19530. AttributeCompression.octDecodeFloat(encodedFloat2, v23);
  19531. AttributeCompression.octDecode(x, y, v32);
  19532. };
  19533. AttributeCompression.compressTextureCoordinates = function(textureCoordinates) {
  19534. Check_default.defined("textureCoordinates", textureCoordinates);
  19535. const x = textureCoordinates.x * 4095 | 0;
  19536. const y = textureCoordinates.y * 4095 | 0;
  19537. return 4096 * x + y;
  19538. };
  19539. AttributeCompression.decompressTextureCoordinates = function(compressed, result) {
  19540. Check_default.defined("compressed", compressed);
  19541. Check_default.defined("result", result);
  19542. const temp = compressed / 4096;
  19543. const xZeroTo4095 = Math.floor(temp);
  19544. result.x = xZeroTo4095 / 4095;
  19545. result.y = (compressed - xZeroTo4095 * 4096) / 4095;
  19546. return result;
  19547. };
  19548. function zigZagDecode(value) {
  19549. return value >> 1 ^ -(value & 1);
  19550. }
  19551. AttributeCompression.zigZagDeltaDecode = function(uBuffer, vBuffer, heightBuffer) {
  19552. Check_default.defined("uBuffer", uBuffer);
  19553. Check_default.defined("vBuffer", vBuffer);
  19554. Check_default.typeOf.number.equals(
  19555. "uBuffer.length",
  19556. "vBuffer.length",
  19557. uBuffer.length,
  19558. vBuffer.length
  19559. );
  19560. if (defined_default(heightBuffer)) {
  19561. Check_default.typeOf.number.equals(
  19562. "uBuffer.length",
  19563. "heightBuffer.length",
  19564. uBuffer.length,
  19565. heightBuffer.length
  19566. );
  19567. }
  19568. const count = uBuffer.length;
  19569. let u3 = 0;
  19570. let v7 = 0;
  19571. let height = 0;
  19572. for (let i2 = 0; i2 < count; ++i2) {
  19573. u3 += zigZagDecode(uBuffer[i2]);
  19574. v7 += zigZagDecode(vBuffer[i2]);
  19575. uBuffer[i2] = u3;
  19576. vBuffer[i2] = v7;
  19577. if (defined_default(heightBuffer)) {
  19578. height += zigZagDecode(heightBuffer[i2]);
  19579. heightBuffer[i2] = height;
  19580. }
  19581. }
  19582. };
  19583. AttributeCompression.dequantize = function(typedArray, componentDatatype, type, count) {
  19584. Check_default.defined("typedArray", typedArray);
  19585. Check_default.defined("componentDatatype", componentDatatype);
  19586. Check_default.defined("type", type);
  19587. Check_default.defined("count", count);
  19588. const componentsPerAttribute = AttributeType_default.getNumberOfComponents(type);
  19589. let divisor;
  19590. switch (componentDatatype) {
  19591. case ComponentDatatype_default.BYTE:
  19592. divisor = 127;
  19593. break;
  19594. case ComponentDatatype_default.UNSIGNED_BYTE:
  19595. divisor = 255;
  19596. break;
  19597. case ComponentDatatype_default.SHORT:
  19598. divisor = 32767;
  19599. break;
  19600. case ComponentDatatype_default.UNSIGNED_SHORT:
  19601. divisor = 65535;
  19602. break;
  19603. case ComponentDatatype_default.INT:
  19604. divisor = 2147483647;
  19605. break;
  19606. case ComponentDatatype_default.UNSIGNED_INT:
  19607. divisor = 4294967295;
  19608. break;
  19609. default:
  19610. throw new DeveloperError_default(
  19611. `Cannot dequantize component datatype: ${componentDatatype}`
  19612. );
  19613. }
  19614. const dequantizedTypedArray = new Float32Array(
  19615. count * componentsPerAttribute
  19616. );
  19617. for (let i2 = 0; i2 < count; i2++) {
  19618. for (let j = 0; j < componentsPerAttribute; j++) {
  19619. const index2 = i2 * componentsPerAttribute + j;
  19620. dequantizedTypedArray[index2] = Math.max(
  19621. typedArray[index2] / divisor,
  19622. -1
  19623. );
  19624. }
  19625. }
  19626. return dequantizedTypedArray;
  19627. };
  19628. AttributeCompression.decodeRGB565 = function(typedArray, result) {
  19629. Check_default.defined("typedArray", typedArray);
  19630. const expectedLength = typedArray.length * 3;
  19631. if (defined_default(result)) {
  19632. Check_default.typeOf.number.equals(
  19633. "result.length",
  19634. "typedArray.length * 3",
  19635. result.length,
  19636. expectedLength
  19637. );
  19638. }
  19639. const count = typedArray.length;
  19640. if (!defined_default(result)) {
  19641. result = new Float32Array(count * 3);
  19642. }
  19643. const mask5 = (1 << 5) - 1;
  19644. const mask6 = (1 << 6) - 1;
  19645. const normalize5 = 1 / 31;
  19646. const normalize6 = 1 / 63;
  19647. for (let i2 = 0; i2 < count; i2++) {
  19648. const value = typedArray[i2];
  19649. const red = value >> 11;
  19650. const green = value >> 5 & mask6;
  19651. const blue = value & mask5;
  19652. const offset2 = 3 * i2;
  19653. result[offset2] = red * normalize5;
  19654. result[offset2 + 1] = green * normalize6;
  19655. result[offset2 + 2] = blue * normalize5;
  19656. }
  19657. return result;
  19658. };
  19659. var AttributeCompression_default = AttributeCompression;
  19660. // node_modules/cesium/Source/Core/TerrainExaggeration.js
  19661. var TerrainExaggeration = {};
  19662. TerrainExaggeration.getHeight = function(height, scale, relativeHeight) {
  19663. return (height - relativeHeight) * scale + relativeHeight;
  19664. };
  19665. var scratchCartographic2 = new Cartesian3_default();
  19666. TerrainExaggeration.getPosition = function(position, ellipsoid, terrainExaggeration, terrainExaggerationRelativeHeight, result) {
  19667. const cartographic2 = ellipsoid.cartesianToCartographic(
  19668. position,
  19669. scratchCartographic2
  19670. );
  19671. const newHeight = TerrainExaggeration.getHeight(
  19672. cartographic2.height,
  19673. terrainExaggeration,
  19674. terrainExaggerationRelativeHeight
  19675. );
  19676. return Cartesian3_default.fromRadians(
  19677. cartographic2.longitude,
  19678. cartographic2.latitude,
  19679. newHeight,
  19680. ellipsoid,
  19681. result
  19682. );
  19683. };
  19684. var TerrainExaggeration_default = TerrainExaggeration;
  19685. // node_modules/cesium/Source/Core/TerrainQuantization.js
  19686. var TerrainQuantization = {
  19687. NONE: 0,
  19688. BITS12: 1
  19689. };
  19690. var TerrainQuantization_default = Object.freeze(TerrainQuantization);
  19691. // node_modules/cesium/Source/Core/TerrainEncoding.js
  19692. var cartesian3Scratch = new Cartesian3_default();
  19693. var cartesian3DimScratch = new Cartesian3_default();
  19694. var cartesian2Scratch = new Cartesian2_default();
  19695. var matrix4Scratch = new Matrix4_default();
  19696. var matrix4Scratch2 = new Matrix4_default();
  19697. var SHIFT_LEFT_12 = Math.pow(2, 12);
  19698. function TerrainEncoding(center, axisAlignedBoundingBox, minimumHeight, maximumHeight, fromENU, hasVertexNormals, hasWebMercatorT, hasGeodeticSurfaceNormals, exaggeration, exaggerationRelativeHeight) {
  19699. let quantization = TerrainQuantization_default.NONE;
  19700. let toENU;
  19701. let matrix;
  19702. if (defined_default(axisAlignedBoundingBox) && defined_default(minimumHeight) && defined_default(maximumHeight) && defined_default(fromENU)) {
  19703. const minimum = axisAlignedBoundingBox.minimum;
  19704. const maximum = axisAlignedBoundingBox.maximum;
  19705. const dimensions = Cartesian3_default.subtract(
  19706. maximum,
  19707. minimum,
  19708. cartesian3DimScratch
  19709. );
  19710. const hDim = maximumHeight - minimumHeight;
  19711. const maxDim = Math.max(Cartesian3_default.maximumComponent(dimensions), hDim);
  19712. if (maxDim < SHIFT_LEFT_12 - 1) {
  19713. quantization = TerrainQuantization_default.BITS12;
  19714. } else {
  19715. quantization = TerrainQuantization_default.NONE;
  19716. }
  19717. toENU = Matrix4_default.inverseTransformation(fromENU, new Matrix4_default());
  19718. const translation3 = Cartesian3_default.negate(minimum, cartesian3Scratch);
  19719. Matrix4_default.multiply(
  19720. Matrix4_default.fromTranslation(translation3, matrix4Scratch),
  19721. toENU,
  19722. toENU
  19723. );
  19724. const scale = cartesian3Scratch;
  19725. scale.x = 1 / dimensions.x;
  19726. scale.y = 1 / dimensions.y;
  19727. scale.z = 1 / dimensions.z;
  19728. Matrix4_default.multiply(Matrix4_default.fromScale(scale, matrix4Scratch), toENU, toENU);
  19729. matrix = Matrix4_default.clone(fromENU);
  19730. Matrix4_default.setTranslation(matrix, Cartesian3_default.ZERO, matrix);
  19731. fromENU = Matrix4_default.clone(fromENU, new Matrix4_default());
  19732. const translationMatrix = Matrix4_default.fromTranslation(minimum, matrix4Scratch);
  19733. const scaleMatrix2 = Matrix4_default.fromScale(dimensions, matrix4Scratch2);
  19734. const st = Matrix4_default.multiply(translationMatrix, scaleMatrix2, matrix4Scratch);
  19735. Matrix4_default.multiply(fromENU, st, fromENU);
  19736. Matrix4_default.multiply(matrix, st, matrix);
  19737. }
  19738. this.quantization = quantization;
  19739. this.minimumHeight = minimumHeight;
  19740. this.maximumHeight = maximumHeight;
  19741. this.center = Cartesian3_default.clone(center);
  19742. this.toScaledENU = toENU;
  19743. this.fromScaledENU = fromENU;
  19744. this.matrix = matrix;
  19745. this.hasVertexNormals = hasVertexNormals;
  19746. this.hasWebMercatorT = defaultValue_default(hasWebMercatorT, false);
  19747. this.hasGeodeticSurfaceNormals = defaultValue_default(
  19748. hasGeodeticSurfaceNormals,
  19749. false
  19750. );
  19751. this.exaggeration = defaultValue_default(exaggeration, 1);
  19752. this.exaggerationRelativeHeight = defaultValue_default(
  19753. exaggerationRelativeHeight,
  19754. 0
  19755. );
  19756. this.stride = 0;
  19757. this._offsetGeodeticSurfaceNormal = 0;
  19758. this._offsetVertexNormal = 0;
  19759. this._calculateStrideAndOffsets();
  19760. }
  19761. TerrainEncoding.prototype.encode = function(vertexBuffer, bufferIndex, position, uv, height, normalToPack, webMercatorT, geodeticSurfaceNormal) {
  19762. const u3 = uv.x;
  19763. const v7 = uv.y;
  19764. if (this.quantization === TerrainQuantization_default.BITS12) {
  19765. position = Matrix4_default.multiplyByPoint(
  19766. this.toScaledENU,
  19767. position,
  19768. cartesian3Scratch
  19769. );
  19770. position.x = Math_default.clamp(position.x, 0, 1);
  19771. position.y = Math_default.clamp(position.y, 0, 1);
  19772. position.z = Math_default.clamp(position.z, 0, 1);
  19773. const hDim = this.maximumHeight - this.minimumHeight;
  19774. const h = Math_default.clamp((height - this.minimumHeight) / hDim, 0, 1);
  19775. Cartesian2_default.fromElements(position.x, position.y, cartesian2Scratch);
  19776. const compressed0 = AttributeCompression_default.compressTextureCoordinates(
  19777. cartesian2Scratch
  19778. );
  19779. Cartesian2_default.fromElements(position.z, h, cartesian2Scratch);
  19780. const compressed1 = AttributeCompression_default.compressTextureCoordinates(
  19781. cartesian2Scratch
  19782. );
  19783. Cartesian2_default.fromElements(u3, v7, cartesian2Scratch);
  19784. const compressed2 = AttributeCompression_default.compressTextureCoordinates(
  19785. cartesian2Scratch
  19786. );
  19787. vertexBuffer[bufferIndex++] = compressed0;
  19788. vertexBuffer[bufferIndex++] = compressed1;
  19789. vertexBuffer[bufferIndex++] = compressed2;
  19790. if (this.hasWebMercatorT) {
  19791. Cartesian2_default.fromElements(webMercatorT, 0, cartesian2Scratch);
  19792. const compressed3 = AttributeCompression_default.compressTextureCoordinates(
  19793. cartesian2Scratch
  19794. );
  19795. vertexBuffer[bufferIndex++] = compressed3;
  19796. }
  19797. } else {
  19798. Cartesian3_default.subtract(position, this.center, cartesian3Scratch);
  19799. vertexBuffer[bufferIndex++] = cartesian3Scratch.x;
  19800. vertexBuffer[bufferIndex++] = cartesian3Scratch.y;
  19801. vertexBuffer[bufferIndex++] = cartesian3Scratch.z;
  19802. vertexBuffer[bufferIndex++] = height;
  19803. vertexBuffer[bufferIndex++] = u3;
  19804. vertexBuffer[bufferIndex++] = v7;
  19805. if (this.hasWebMercatorT) {
  19806. vertexBuffer[bufferIndex++] = webMercatorT;
  19807. }
  19808. }
  19809. if (this.hasVertexNormals) {
  19810. vertexBuffer[bufferIndex++] = AttributeCompression_default.octPackFloat(
  19811. normalToPack
  19812. );
  19813. }
  19814. if (this.hasGeodeticSurfaceNormals) {
  19815. vertexBuffer[bufferIndex++] = geodeticSurfaceNormal.x;
  19816. vertexBuffer[bufferIndex++] = geodeticSurfaceNormal.y;
  19817. vertexBuffer[bufferIndex++] = geodeticSurfaceNormal.z;
  19818. }
  19819. return bufferIndex;
  19820. };
  19821. var scratchPosition = new Cartesian3_default();
  19822. var scratchGeodeticSurfaceNormal = new Cartesian3_default();
  19823. TerrainEncoding.prototype.addGeodeticSurfaceNormals = function(oldBuffer, newBuffer, ellipsoid) {
  19824. if (this.hasGeodeticSurfaceNormals) {
  19825. return;
  19826. }
  19827. const oldStride = this.stride;
  19828. const vertexCount = oldBuffer.length / oldStride;
  19829. this.hasGeodeticSurfaceNormals = true;
  19830. this._calculateStrideAndOffsets();
  19831. const newStride = this.stride;
  19832. for (let index2 = 0; index2 < vertexCount; index2++) {
  19833. for (let offset2 = 0; offset2 < oldStride; offset2++) {
  19834. const oldIndex = index2 * oldStride + offset2;
  19835. const newIndex = index2 * newStride + offset2;
  19836. newBuffer[newIndex] = oldBuffer[oldIndex];
  19837. }
  19838. const position = this.decodePosition(newBuffer, index2, scratchPosition);
  19839. const geodeticSurfaceNormal = ellipsoid.geodeticSurfaceNormal(
  19840. position,
  19841. scratchGeodeticSurfaceNormal
  19842. );
  19843. const bufferIndex = index2 * newStride + this._offsetGeodeticSurfaceNormal;
  19844. newBuffer[bufferIndex] = geodeticSurfaceNormal.x;
  19845. newBuffer[bufferIndex + 1] = geodeticSurfaceNormal.y;
  19846. newBuffer[bufferIndex + 2] = geodeticSurfaceNormal.z;
  19847. }
  19848. };
  19849. TerrainEncoding.prototype.removeGeodeticSurfaceNormals = function(oldBuffer, newBuffer) {
  19850. if (!this.hasGeodeticSurfaceNormals) {
  19851. return;
  19852. }
  19853. const oldStride = this.stride;
  19854. const vertexCount = oldBuffer.length / oldStride;
  19855. this.hasGeodeticSurfaceNormals = false;
  19856. this._calculateStrideAndOffsets();
  19857. const newStride = this.stride;
  19858. for (let index2 = 0; index2 < vertexCount; index2++) {
  19859. for (let offset2 = 0; offset2 < newStride; offset2++) {
  19860. const oldIndex = index2 * oldStride + offset2;
  19861. const newIndex = index2 * newStride + offset2;
  19862. newBuffer[newIndex] = oldBuffer[oldIndex];
  19863. }
  19864. }
  19865. };
  19866. TerrainEncoding.prototype.decodePosition = function(buffer, index2, result) {
  19867. if (!defined_default(result)) {
  19868. result = new Cartesian3_default();
  19869. }
  19870. index2 *= this.stride;
  19871. if (this.quantization === TerrainQuantization_default.BITS12) {
  19872. const xy = AttributeCompression_default.decompressTextureCoordinates(
  19873. buffer[index2],
  19874. cartesian2Scratch
  19875. );
  19876. result.x = xy.x;
  19877. result.y = xy.y;
  19878. const zh = AttributeCompression_default.decompressTextureCoordinates(
  19879. buffer[index2 + 1],
  19880. cartesian2Scratch
  19881. );
  19882. result.z = zh.x;
  19883. return Matrix4_default.multiplyByPoint(this.fromScaledENU, result, result);
  19884. }
  19885. result.x = buffer[index2];
  19886. result.y = buffer[index2 + 1];
  19887. result.z = buffer[index2 + 2];
  19888. return Cartesian3_default.add(result, this.center, result);
  19889. };
  19890. TerrainEncoding.prototype.getExaggeratedPosition = function(buffer, index2, result) {
  19891. result = this.decodePosition(buffer, index2, result);
  19892. const exaggeration = this.exaggeration;
  19893. const exaggerationRelativeHeight = this.exaggerationRelativeHeight;
  19894. const hasExaggeration = exaggeration !== 1;
  19895. if (hasExaggeration && this.hasGeodeticSurfaceNormals) {
  19896. const geodeticSurfaceNormal = this.decodeGeodeticSurfaceNormal(
  19897. buffer,
  19898. index2,
  19899. scratchGeodeticSurfaceNormal
  19900. );
  19901. const rawHeight = this.decodeHeight(buffer, index2);
  19902. const heightDifference = TerrainExaggeration_default.getHeight(
  19903. rawHeight,
  19904. exaggeration,
  19905. exaggerationRelativeHeight
  19906. ) - rawHeight;
  19907. result.x += geodeticSurfaceNormal.x * heightDifference;
  19908. result.y += geodeticSurfaceNormal.y * heightDifference;
  19909. result.z += geodeticSurfaceNormal.z * heightDifference;
  19910. }
  19911. return result;
  19912. };
  19913. TerrainEncoding.prototype.decodeTextureCoordinates = function(buffer, index2, result) {
  19914. if (!defined_default(result)) {
  19915. result = new Cartesian2_default();
  19916. }
  19917. index2 *= this.stride;
  19918. if (this.quantization === TerrainQuantization_default.BITS12) {
  19919. return AttributeCompression_default.decompressTextureCoordinates(
  19920. buffer[index2 + 2],
  19921. result
  19922. );
  19923. }
  19924. return Cartesian2_default.fromElements(buffer[index2 + 4], buffer[index2 + 5], result);
  19925. };
  19926. TerrainEncoding.prototype.decodeHeight = function(buffer, index2) {
  19927. index2 *= this.stride;
  19928. if (this.quantization === TerrainQuantization_default.BITS12) {
  19929. const zh = AttributeCompression_default.decompressTextureCoordinates(
  19930. buffer[index2 + 1],
  19931. cartesian2Scratch
  19932. );
  19933. return zh.y * (this.maximumHeight - this.minimumHeight) + this.minimumHeight;
  19934. }
  19935. return buffer[index2 + 3];
  19936. };
  19937. TerrainEncoding.prototype.decodeWebMercatorT = function(buffer, index2) {
  19938. index2 *= this.stride;
  19939. if (this.quantization === TerrainQuantization_default.BITS12) {
  19940. return AttributeCompression_default.decompressTextureCoordinates(
  19941. buffer[index2 + 3],
  19942. cartesian2Scratch
  19943. ).x;
  19944. }
  19945. return buffer[index2 + 6];
  19946. };
  19947. TerrainEncoding.prototype.getOctEncodedNormal = function(buffer, index2, result) {
  19948. index2 = index2 * this.stride + this._offsetVertexNormal;
  19949. const temp = buffer[index2] / 256;
  19950. const x = Math.floor(temp);
  19951. const y = (temp - x) * 256;
  19952. return Cartesian2_default.fromElements(x, y, result);
  19953. };
  19954. TerrainEncoding.prototype.decodeGeodeticSurfaceNormal = function(buffer, index2, result) {
  19955. index2 = index2 * this.stride + this._offsetGeodeticSurfaceNormal;
  19956. result.x = buffer[index2];
  19957. result.y = buffer[index2 + 1];
  19958. result.z = buffer[index2 + 2];
  19959. return result;
  19960. };
  19961. TerrainEncoding.prototype._calculateStrideAndOffsets = function() {
  19962. let vertexStride = 0;
  19963. switch (this.quantization) {
  19964. case TerrainQuantization_default.BITS12:
  19965. vertexStride += 3;
  19966. break;
  19967. default:
  19968. vertexStride += 6;
  19969. }
  19970. if (this.hasWebMercatorT) {
  19971. vertexStride += 1;
  19972. }
  19973. if (this.hasVertexNormals) {
  19974. this._offsetVertexNormal = vertexStride;
  19975. vertexStride += 1;
  19976. }
  19977. if (this.hasGeodeticSurfaceNormals) {
  19978. this._offsetGeodeticSurfaceNormal = vertexStride;
  19979. vertexStride += 3;
  19980. }
  19981. this.stride = vertexStride;
  19982. };
  19983. var attributesIndicesNone = {
  19984. position3DAndHeight: 0,
  19985. textureCoordAndEncodedNormals: 1,
  19986. geodeticSurfaceNormal: 2
  19987. };
  19988. var attributesIndicesBits12 = {
  19989. compressed0: 0,
  19990. compressed1: 1,
  19991. geodeticSurfaceNormal: 2
  19992. };
  19993. TerrainEncoding.prototype.getAttributes = function(buffer) {
  19994. const datatype = ComponentDatatype_default.FLOAT;
  19995. const sizeInBytes = ComponentDatatype_default.getSizeInBytes(datatype);
  19996. const strideInBytes = this.stride * sizeInBytes;
  19997. let offsetInBytes = 0;
  19998. const attributes = [];
  19999. function addAttribute2(index2, componentsPerAttribute) {
  20000. attributes.push({
  20001. index: index2,
  20002. vertexBuffer: buffer,
  20003. componentDatatype: datatype,
  20004. componentsPerAttribute,
  20005. offsetInBytes,
  20006. strideInBytes
  20007. });
  20008. offsetInBytes += componentsPerAttribute * sizeInBytes;
  20009. }
  20010. if (this.quantization === TerrainQuantization_default.NONE) {
  20011. addAttribute2(attributesIndicesNone.position3DAndHeight, 4);
  20012. let componentsTexCoordAndNormals = 2;
  20013. componentsTexCoordAndNormals += this.hasWebMercatorT ? 1 : 0;
  20014. componentsTexCoordAndNormals += this.hasVertexNormals ? 1 : 0;
  20015. addAttribute2(
  20016. attributesIndicesNone.textureCoordAndEncodedNormals,
  20017. componentsTexCoordAndNormals
  20018. );
  20019. if (this.hasGeodeticSurfaceNormals) {
  20020. addAttribute2(attributesIndicesNone.geodeticSurfaceNormal, 3);
  20021. }
  20022. } else {
  20023. const usingAttribute0Component4 = this.hasWebMercatorT || this.hasVertexNormals;
  20024. const usingAttribute1Component1 = this.hasWebMercatorT && this.hasVertexNormals;
  20025. addAttribute2(
  20026. attributesIndicesBits12.compressed0,
  20027. usingAttribute0Component4 ? 4 : 3
  20028. );
  20029. if (usingAttribute1Component1) {
  20030. addAttribute2(attributesIndicesBits12.compressed1, 1);
  20031. }
  20032. if (this.hasGeodeticSurfaceNormals) {
  20033. addAttribute2(attributesIndicesBits12.geodeticSurfaceNormal, 3);
  20034. }
  20035. }
  20036. return attributes;
  20037. };
  20038. TerrainEncoding.prototype.getAttributeLocations = function() {
  20039. if (this.quantization === TerrainQuantization_default.NONE) {
  20040. return attributesIndicesNone;
  20041. }
  20042. return attributesIndicesBits12;
  20043. };
  20044. TerrainEncoding.clone = function(encoding, result) {
  20045. if (!defined_default(encoding)) {
  20046. return void 0;
  20047. }
  20048. if (!defined_default(result)) {
  20049. result = new TerrainEncoding();
  20050. }
  20051. result.quantization = encoding.quantization;
  20052. result.minimumHeight = encoding.minimumHeight;
  20053. result.maximumHeight = encoding.maximumHeight;
  20054. result.center = Cartesian3_default.clone(encoding.center);
  20055. result.toScaledENU = Matrix4_default.clone(encoding.toScaledENU);
  20056. result.fromScaledENU = Matrix4_default.clone(encoding.fromScaledENU);
  20057. result.matrix = Matrix4_default.clone(encoding.matrix);
  20058. result.hasVertexNormals = encoding.hasVertexNormals;
  20059. result.hasWebMercatorT = encoding.hasWebMercatorT;
  20060. result.hasGeodeticSurfaceNormals = encoding.hasGeodeticSurfaceNormals;
  20061. result.exaggeration = encoding.exaggeration;
  20062. result.exaggerationRelativeHeight = encoding.exaggerationRelativeHeight;
  20063. result._calculateStrideAndOffsets();
  20064. return result;
  20065. };
  20066. var TerrainEncoding_default = TerrainEncoding;
  20067. // node_modules/cesium/Source/Core/WebMercatorProjection.js
  20068. function WebMercatorProjection(ellipsoid) {
  20069. this._ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  20070. this._semimajorAxis = this._ellipsoid.maximumRadius;
  20071. this._oneOverSemimajorAxis = 1 / this._semimajorAxis;
  20072. }
  20073. Object.defineProperties(WebMercatorProjection.prototype, {
  20074. ellipsoid: {
  20075. get: function() {
  20076. return this._ellipsoid;
  20077. }
  20078. }
  20079. });
  20080. WebMercatorProjection.mercatorAngleToGeodeticLatitude = function(mercatorAngle) {
  20081. return Math_default.PI_OVER_TWO - 2 * Math.atan(Math.exp(-mercatorAngle));
  20082. };
  20083. WebMercatorProjection.geodeticLatitudeToMercatorAngle = function(latitude) {
  20084. if (latitude > WebMercatorProjection.MaximumLatitude) {
  20085. latitude = WebMercatorProjection.MaximumLatitude;
  20086. } else if (latitude < -WebMercatorProjection.MaximumLatitude) {
  20087. latitude = -WebMercatorProjection.MaximumLatitude;
  20088. }
  20089. const sinLatitude = Math.sin(latitude);
  20090. return 0.5 * Math.log((1 + sinLatitude) / (1 - sinLatitude));
  20091. };
  20092. WebMercatorProjection.MaximumLatitude = WebMercatorProjection.mercatorAngleToGeodeticLatitude(
  20093. Math.PI
  20094. );
  20095. WebMercatorProjection.prototype.project = function(cartographic2, result) {
  20096. const semimajorAxis = this._semimajorAxis;
  20097. const x = cartographic2.longitude * semimajorAxis;
  20098. const y = WebMercatorProjection.geodeticLatitudeToMercatorAngle(
  20099. cartographic2.latitude
  20100. ) * semimajorAxis;
  20101. const z = cartographic2.height;
  20102. if (!defined_default(result)) {
  20103. return new Cartesian3_default(x, y, z);
  20104. }
  20105. result.x = x;
  20106. result.y = y;
  20107. result.z = z;
  20108. return result;
  20109. };
  20110. WebMercatorProjection.prototype.unproject = function(cartesian11, result) {
  20111. if (!defined_default(cartesian11)) {
  20112. throw new DeveloperError_default("cartesian is required");
  20113. }
  20114. const oneOverEarthSemimajorAxis = this._oneOverSemimajorAxis;
  20115. const longitude = cartesian11.x * oneOverEarthSemimajorAxis;
  20116. const latitude = WebMercatorProjection.mercatorAngleToGeodeticLatitude(
  20117. cartesian11.y * oneOverEarthSemimajorAxis
  20118. );
  20119. const height = cartesian11.z;
  20120. if (!defined_default(result)) {
  20121. return new Cartographic_default(longitude, latitude, height);
  20122. }
  20123. result.longitude = longitude;
  20124. result.latitude = latitude;
  20125. result.height = height;
  20126. return result;
  20127. };
  20128. var WebMercatorProjection_default = WebMercatorProjection;
  20129. // node_modules/cesium/Source/Core/HeightmapTessellator.js
  20130. var HeightmapTessellator = {};
  20131. HeightmapTessellator.DEFAULT_STRUCTURE = Object.freeze({
  20132. heightScale: 1,
  20133. heightOffset: 0,
  20134. elementsPerHeight: 1,
  20135. stride: 1,
  20136. elementMultiplier: 256,
  20137. isBigEndian: false
  20138. });
  20139. var cartesian3Scratch2 = new Cartesian3_default();
  20140. var matrix4Scratch3 = new Matrix4_default();
  20141. var minimumScratch = new Cartesian3_default();
  20142. var maximumScratch = new Cartesian3_default();
  20143. HeightmapTessellator.computeVertices = function(options) {
  20144. if (!defined_default(options) || !defined_default(options.heightmap)) {
  20145. throw new DeveloperError_default("options.heightmap is required.");
  20146. }
  20147. if (!defined_default(options.width) || !defined_default(options.height)) {
  20148. throw new DeveloperError_default("options.width and options.height are required.");
  20149. }
  20150. if (!defined_default(options.nativeRectangle)) {
  20151. throw new DeveloperError_default("options.nativeRectangle is required.");
  20152. }
  20153. if (!defined_default(options.skirtHeight)) {
  20154. throw new DeveloperError_default("options.skirtHeight is required.");
  20155. }
  20156. const cos4 = Math.cos;
  20157. const sin4 = Math.sin;
  20158. const sqrt2 = Math.sqrt;
  20159. const atan = Math.atan;
  20160. const exp = Math.exp;
  20161. const piOverTwo = Math_default.PI_OVER_TWO;
  20162. const toRadians = Math_default.toRadians;
  20163. const heightmap = options.heightmap;
  20164. const width = options.width;
  20165. const height = options.height;
  20166. const skirtHeight = options.skirtHeight;
  20167. const hasSkirts = skirtHeight > 0;
  20168. const isGeographic = defaultValue_default(options.isGeographic, true);
  20169. const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  20170. const oneOverGlobeSemimajorAxis = 1 / ellipsoid.maximumRadius;
  20171. const nativeRectangle = Rectangle_default.clone(options.nativeRectangle);
  20172. const rectangle = Rectangle_default.clone(options.rectangle);
  20173. let geographicWest;
  20174. let geographicSouth;
  20175. let geographicEast;
  20176. let geographicNorth;
  20177. if (!defined_default(rectangle)) {
  20178. if (isGeographic) {
  20179. geographicWest = toRadians(nativeRectangle.west);
  20180. geographicSouth = toRadians(nativeRectangle.south);
  20181. geographicEast = toRadians(nativeRectangle.east);
  20182. geographicNorth = toRadians(nativeRectangle.north);
  20183. } else {
  20184. geographicWest = nativeRectangle.west * oneOverGlobeSemimajorAxis;
  20185. geographicSouth = piOverTwo - 2 * atan(exp(-nativeRectangle.south * oneOverGlobeSemimajorAxis));
  20186. geographicEast = nativeRectangle.east * oneOverGlobeSemimajorAxis;
  20187. geographicNorth = piOverTwo - 2 * atan(exp(-nativeRectangle.north * oneOverGlobeSemimajorAxis));
  20188. }
  20189. } else {
  20190. geographicWest = rectangle.west;
  20191. geographicSouth = rectangle.south;
  20192. geographicEast = rectangle.east;
  20193. geographicNorth = rectangle.north;
  20194. }
  20195. let relativeToCenter = options.relativeToCenter;
  20196. const hasRelativeToCenter = defined_default(relativeToCenter);
  20197. relativeToCenter = hasRelativeToCenter ? relativeToCenter : Cartesian3_default.ZERO;
  20198. const includeWebMercatorT = defaultValue_default(options.includeWebMercatorT, false);
  20199. const exaggeration = defaultValue_default(options.exaggeration, 1);
  20200. const exaggerationRelativeHeight = defaultValue_default(
  20201. options.exaggerationRelativeHeight,
  20202. 0
  20203. );
  20204. const hasExaggeration = exaggeration !== 1;
  20205. const includeGeodeticSurfaceNormals = hasExaggeration;
  20206. const structure = defaultValue_default(
  20207. options.structure,
  20208. HeightmapTessellator.DEFAULT_STRUCTURE
  20209. );
  20210. const heightScale = defaultValue_default(
  20211. structure.heightScale,
  20212. HeightmapTessellator.DEFAULT_STRUCTURE.heightScale
  20213. );
  20214. const heightOffset = defaultValue_default(
  20215. structure.heightOffset,
  20216. HeightmapTessellator.DEFAULT_STRUCTURE.heightOffset
  20217. );
  20218. const elementsPerHeight = defaultValue_default(
  20219. structure.elementsPerHeight,
  20220. HeightmapTessellator.DEFAULT_STRUCTURE.elementsPerHeight
  20221. );
  20222. const stride = defaultValue_default(
  20223. structure.stride,
  20224. HeightmapTessellator.DEFAULT_STRUCTURE.stride
  20225. );
  20226. const elementMultiplier = defaultValue_default(
  20227. structure.elementMultiplier,
  20228. HeightmapTessellator.DEFAULT_STRUCTURE.elementMultiplier
  20229. );
  20230. const isBigEndian = defaultValue_default(
  20231. structure.isBigEndian,
  20232. HeightmapTessellator.DEFAULT_STRUCTURE.isBigEndian
  20233. );
  20234. let rectangleWidth = Rectangle_default.computeWidth(nativeRectangle);
  20235. let rectangleHeight = Rectangle_default.computeHeight(nativeRectangle);
  20236. const granularityX = rectangleWidth / (width - 1);
  20237. const granularityY = rectangleHeight / (height - 1);
  20238. if (!isGeographic) {
  20239. rectangleWidth *= oneOverGlobeSemimajorAxis;
  20240. rectangleHeight *= oneOverGlobeSemimajorAxis;
  20241. }
  20242. const radiiSquared = ellipsoid.radiiSquared;
  20243. const radiiSquaredX = radiiSquared.x;
  20244. const radiiSquaredY = radiiSquared.y;
  20245. const radiiSquaredZ = radiiSquared.z;
  20246. let minimumHeight = 65536;
  20247. let maximumHeight = -65536;
  20248. const fromENU = Transforms_default.eastNorthUpToFixedFrame(
  20249. relativeToCenter,
  20250. ellipsoid
  20251. );
  20252. const toENU = Matrix4_default.inverseTransformation(fromENU, matrix4Scratch3);
  20253. let southMercatorY;
  20254. let oneOverMercatorHeight;
  20255. if (includeWebMercatorT) {
  20256. southMercatorY = WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(
  20257. geographicSouth
  20258. );
  20259. oneOverMercatorHeight = 1 / (WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(geographicNorth) - southMercatorY);
  20260. }
  20261. const minimum = minimumScratch;
  20262. minimum.x = Number.POSITIVE_INFINITY;
  20263. minimum.y = Number.POSITIVE_INFINITY;
  20264. minimum.z = Number.POSITIVE_INFINITY;
  20265. const maximum = maximumScratch;
  20266. maximum.x = Number.NEGATIVE_INFINITY;
  20267. maximum.y = Number.NEGATIVE_INFINITY;
  20268. maximum.z = Number.NEGATIVE_INFINITY;
  20269. let hMin = Number.POSITIVE_INFINITY;
  20270. const gridVertexCount = width * height;
  20271. const edgeVertexCount = skirtHeight > 0 ? width * 2 + height * 2 : 0;
  20272. const vertexCount = gridVertexCount + edgeVertexCount;
  20273. const positions = new Array(vertexCount);
  20274. const heights = new Array(vertexCount);
  20275. const uvs = new Array(vertexCount);
  20276. const webMercatorTs = includeWebMercatorT ? new Array(vertexCount) : [];
  20277. const geodeticSurfaceNormals = includeGeodeticSurfaceNormals ? new Array(vertexCount) : [];
  20278. let startRow = 0;
  20279. let endRow = height;
  20280. let startCol = 0;
  20281. let endCol = width;
  20282. if (hasSkirts) {
  20283. --startRow;
  20284. ++endRow;
  20285. --startCol;
  20286. ++endCol;
  20287. }
  20288. const skirtOffsetPercentage = 1e-5;
  20289. for (let rowIndex = startRow; rowIndex < endRow; ++rowIndex) {
  20290. let row = rowIndex;
  20291. if (row < 0) {
  20292. row = 0;
  20293. }
  20294. if (row >= height) {
  20295. row = height - 1;
  20296. }
  20297. let latitude = nativeRectangle.north - granularityY * row;
  20298. if (!isGeographic) {
  20299. latitude = piOverTwo - 2 * atan(exp(-latitude * oneOverGlobeSemimajorAxis));
  20300. } else {
  20301. latitude = toRadians(latitude);
  20302. }
  20303. let v7 = (latitude - geographicSouth) / (geographicNorth - geographicSouth);
  20304. v7 = Math_default.clamp(v7, 0, 1);
  20305. const isNorthEdge = rowIndex === startRow;
  20306. const isSouthEdge = rowIndex === endRow - 1;
  20307. if (skirtHeight > 0) {
  20308. if (isNorthEdge) {
  20309. latitude += skirtOffsetPercentage * rectangleHeight;
  20310. } else if (isSouthEdge) {
  20311. latitude -= skirtOffsetPercentage * rectangleHeight;
  20312. }
  20313. }
  20314. const cosLatitude = cos4(latitude);
  20315. const nZ = sin4(latitude);
  20316. const kZ = radiiSquaredZ * nZ;
  20317. let webMercatorT;
  20318. if (includeWebMercatorT) {
  20319. webMercatorT = (WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(latitude) - southMercatorY) * oneOverMercatorHeight;
  20320. }
  20321. for (let colIndex = startCol; colIndex < endCol; ++colIndex) {
  20322. let col = colIndex;
  20323. if (col < 0) {
  20324. col = 0;
  20325. }
  20326. if (col >= width) {
  20327. col = width - 1;
  20328. }
  20329. const terrainOffset = row * (width * stride) + col * stride;
  20330. let heightSample;
  20331. if (elementsPerHeight === 1) {
  20332. heightSample = heightmap[terrainOffset];
  20333. } else {
  20334. heightSample = 0;
  20335. let elementOffset;
  20336. if (isBigEndian) {
  20337. for (elementOffset = 0; elementOffset < elementsPerHeight; ++elementOffset) {
  20338. heightSample = heightSample * elementMultiplier + heightmap[terrainOffset + elementOffset];
  20339. }
  20340. } else {
  20341. for (elementOffset = elementsPerHeight - 1; elementOffset >= 0; --elementOffset) {
  20342. heightSample = heightSample * elementMultiplier + heightmap[terrainOffset + elementOffset];
  20343. }
  20344. }
  20345. }
  20346. heightSample = heightSample * heightScale + heightOffset;
  20347. maximumHeight = Math.max(maximumHeight, heightSample);
  20348. minimumHeight = Math.min(minimumHeight, heightSample);
  20349. let longitude = nativeRectangle.west + granularityX * col;
  20350. if (!isGeographic) {
  20351. longitude = longitude * oneOverGlobeSemimajorAxis;
  20352. } else {
  20353. longitude = toRadians(longitude);
  20354. }
  20355. let u3 = (longitude - geographicWest) / (geographicEast - geographicWest);
  20356. u3 = Math_default.clamp(u3, 0, 1);
  20357. let index2 = row * width + col;
  20358. if (skirtHeight > 0) {
  20359. const isWestEdge = colIndex === startCol;
  20360. const isEastEdge = colIndex === endCol - 1;
  20361. const isEdge2 = isNorthEdge || isSouthEdge || isWestEdge || isEastEdge;
  20362. const isCorner = (isNorthEdge || isSouthEdge) && (isWestEdge || isEastEdge);
  20363. if (isCorner) {
  20364. continue;
  20365. } else if (isEdge2) {
  20366. heightSample -= skirtHeight;
  20367. if (isWestEdge) {
  20368. index2 = gridVertexCount + (height - row - 1);
  20369. longitude -= skirtOffsetPercentage * rectangleWidth;
  20370. } else if (isSouthEdge) {
  20371. index2 = gridVertexCount + height + (width - col - 1);
  20372. } else if (isEastEdge) {
  20373. index2 = gridVertexCount + height + width + row;
  20374. longitude += skirtOffsetPercentage * rectangleWidth;
  20375. } else if (isNorthEdge) {
  20376. index2 = gridVertexCount + height + width + height + col;
  20377. }
  20378. }
  20379. }
  20380. const nX = cosLatitude * cos4(longitude);
  20381. const nY = cosLatitude * sin4(longitude);
  20382. const kX = radiiSquaredX * nX;
  20383. const kY = radiiSquaredY * nY;
  20384. const gamma = sqrt2(kX * nX + kY * nY + kZ * nZ);
  20385. const oneOverGamma = 1 / gamma;
  20386. const rSurfaceX = kX * oneOverGamma;
  20387. const rSurfaceY = kY * oneOverGamma;
  20388. const rSurfaceZ = kZ * oneOverGamma;
  20389. const position = new Cartesian3_default();
  20390. position.x = rSurfaceX + nX * heightSample;
  20391. position.y = rSurfaceY + nY * heightSample;
  20392. position.z = rSurfaceZ + nZ * heightSample;
  20393. Matrix4_default.multiplyByPoint(toENU, position, cartesian3Scratch2);
  20394. Cartesian3_default.minimumByComponent(cartesian3Scratch2, minimum, minimum);
  20395. Cartesian3_default.maximumByComponent(cartesian3Scratch2, maximum, maximum);
  20396. hMin = Math.min(hMin, heightSample);
  20397. positions[index2] = position;
  20398. uvs[index2] = new Cartesian2_default(u3, v7);
  20399. heights[index2] = heightSample;
  20400. if (includeWebMercatorT) {
  20401. webMercatorTs[index2] = webMercatorT;
  20402. }
  20403. if (includeGeodeticSurfaceNormals) {
  20404. geodeticSurfaceNormals[index2] = ellipsoid.geodeticSurfaceNormal(
  20405. position
  20406. );
  20407. }
  20408. }
  20409. }
  20410. const boundingSphere3D = BoundingSphere_default.fromPoints(positions);
  20411. let orientedBoundingBox;
  20412. if (defined_default(rectangle)) {
  20413. orientedBoundingBox = OrientedBoundingBox_default.fromRectangle(
  20414. rectangle,
  20415. minimumHeight,
  20416. maximumHeight,
  20417. ellipsoid
  20418. );
  20419. }
  20420. let occludeePointInScaledSpace;
  20421. if (hasRelativeToCenter) {
  20422. const occluder = new EllipsoidalOccluder_default(ellipsoid);
  20423. occludeePointInScaledSpace = occluder.computeHorizonCullingPointPossiblyUnderEllipsoid(
  20424. relativeToCenter,
  20425. positions,
  20426. minimumHeight
  20427. );
  20428. }
  20429. const aaBox = new AxisAlignedBoundingBox_default(minimum, maximum, relativeToCenter);
  20430. const encoding = new TerrainEncoding_default(
  20431. relativeToCenter,
  20432. aaBox,
  20433. hMin,
  20434. maximumHeight,
  20435. fromENU,
  20436. false,
  20437. includeWebMercatorT,
  20438. includeGeodeticSurfaceNormals,
  20439. exaggeration,
  20440. exaggerationRelativeHeight
  20441. );
  20442. const vertices = new Float32Array(vertexCount * encoding.stride);
  20443. let bufferIndex = 0;
  20444. for (let j = 0; j < vertexCount; ++j) {
  20445. bufferIndex = encoding.encode(
  20446. vertices,
  20447. bufferIndex,
  20448. positions[j],
  20449. uvs[j],
  20450. heights[j],
  20451. void 0,
  20452. webMercatorTs[j],
  20453. geodeticSurfaceNormals[j]
  20454. );
  20455. }
  20456. return {
  20457. vertices,
  20458. maximumHeight,
  20459. minimumHeight,
  20460. encoding,
  20461. boundingSphere3D,
  20462. orientedBoundingBox,
  20463. occludeePointInScaledSpace
  20464. };
  20465. };
  20466. var HeightmapTessellator_default = HeightmapTessellator;
  20467. // node_modules/cesium/Source/Core/destroyObject.js
  20468. function returnTrue() {
  20469. return true;
  20470. }
  20471. function destroyObject(object2, message) {
  20472. message = defaultValue_default(
  20473. message,
  20474. "This object was destroyed, i.e., destroy() was called."
  20475. );
  20476. function throwOnDestroyed() {
  20477. throw new DeveloperError_default(message);
  20478. }
  20479. for (const key in object2) {
  20480. if (typeof object2[key] === "function") {
  20481. object2[key] = throwOnDestroyed;
  20482. }
  20483. }
  20484. object2.isDestroyed = returnTrue;
  20485. return void 0;
  20486. }
  20487. var destroyObject_default = destroyObject;
  20488. // node_modules/cesium/Source/Core/TaskProcessor.js
  20489. function canTransferArrayBuffer() {
  20490. if (!defined_default(TaskProcessor._canTransferArrayBuffer)) {
  20491. const worker = new Worker(
  20492. getWorkerUrl("Workers/transferTypedArrayTest.js")
  20493. );
  20494. worker.postMessage = defaultValue_default(
  20495. worker.webkitPostMessage,
  20496. worker.postMessage
  20497. );
  20498. const value = 99;
  20499. const array = new Int8Array([value]);
  20500. try {
  20501. worker.postMessage(
  20502. {
  20503. array
  20504. },
  20505. [array.buffer]
  20506. );
  20507. } catch (e2) {
  20508. TaskProcessor._canTransferArrayBuffer = false;
  20509. return TaskProcessor._canTransferArrayBuffer;
  20510. }
  20511. const deferred = defer_default();
  20512. worker.onmessage = function(event) {
  20513. const array2 = event.data.array;
  20514. const result = defined_default(array2) && array2[0] === value;
  20515. deferred.resolve(result);
  20516. worker.terminate();
  20517. TaskProcessor._canTransferArrayBuffer = result;
  20518. };
  20519. TaskProcessor._canTransferArrayBuffer = deferred.promise;
  20520. }
  20521. return TaskProcessor._canTransferArrayBuffer;
  20522. }
  20523. var taskCompletedEvent = new Event_default();
  20524. function completeTask(processor, data) {
  20525. --processor._activeTasks;
  20526. const id = data.id;
  20527. if (!defined_default(id)) {
  20528. return;
  20529. }
  20530. const deferreds = processor._deferreds;
  20531. const deferred = deferreds[id];
  20532. if (defined_default(data.error)) {
  20533. let error = data.error;
  20534. if (error.name === "RuntimeError") {
  20535. error = new RuntimeError_default(data.error.message);
  20536. error.stack = data.error.stack;
  20537. } else if (error.name === "DeveloperError") {
  20538. error = new DeveloperError_default(data.error.message);
  20539. error.stack = data.error.stack;
  20540. }
  20541. taskCompletedEvent.raiseEvent(error);
  20542. deferred.reject(error);
  20543. } else {
  20544. taskCompletedEvent.raiseEvent();
  20545. deferred.resolve(data.result);
  20546. }
  20547. delete deferreds[id];
  20548. }
  20549. function getWorkerUrl(moduleID) {
  20550. let url2 = buildModuleUrl_default(moduleID);
  20551. if (isCrossOriginUrl_default(url2)) {
  20552. const script = `importScripts("${url2}");`;
  20553. let blob;
  20554. try {
  20555. blob = new Blob([script], {
  20556. type: "application/javascript"
  20557. });
  20558. } catch (e2) {
  20559. const BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder;
  20560. const blobBuilder = new BlobBuilder();
  20561. blobBuilder.append(script);
  20562. blob = blobBuilder.getBlob("application/javascript");
  20563. }
  20564. const URL2 = window.URL || window.webkitURL;
  20565. url2 = URL2.createObjectURL(blob);
  20566. }
  20567. return url2;
  20568. }
  20569. var bootstrapperUrlResult;
  20570. function getBootstrapperUrl() {
  20571. if (!defined_default(bootstrapperUrlResult)) {
  20572. bootstrapperUrlResult = getWorkerUrl("Workers/cesiumWorkerBootstrapper.js");
  20573. }
  20574. return bootstrapperUrlResult;
  20575. }
  20576. function createWorker(processor) {
  20577. const worker = new Worker(getBootstrapperUrl());
  20578. worker.postMessage = defaultValue_default(
  20579. worker.webkitPostMessage,
  20580. worker.postMessage
  20581. );
  20582. const bootstrapMessage = {
  20583. loaderConfig: {
  20584. paths: {
  20585. Workers: buildModuleUrl_default("Workers")
  20586. },
  20587. baseUrl: buildModuleUrl_default.getCesiumBaseUrl().url
  20588. },
  20589. workerModule: processor._workerPath
  20590. };
  20591. worker.postMessage(bootstrapMessage);
  20592. worker.onmessage = function(event) {
  20593. completeTask(processor, event.data);
  20594. };
  20595. return worker;
  20596. }
  20597. function getWebAssemblyLoaderConfig(processor, wasmOptions) {
  20598. const config2 = {
  20599. modulePath: void 0,
  20600. wasmBinaryFile: void 0,
  20601. wasmBinary: void 0
  20602. };
  20603. if (!FeatureDetection_default.supportsWebAssembly()) {
  20604. if (!defined_default(wasmOptions.fallbackModulePath)) {
  20605. throw new RuntimeError_default(
  20606. `This browser does not support Web Assembly, and no backup module was provided for ${processor._workerPath}`
  20607. );
  20608. }
  20609. config2.modulePath = buildModuleUrl_default(wasmOptions.fallbackModulePath);
  20610. return Promise.resolve(config2);
  20611. }
  20612. config2.modulePath = buildModuleUrl_default(wasmOptions.modulePath);
  20613. config2.wasmBinaryFile = buildModuleUrl_default(wasmOptions.wasmBinaryFile);
  20614. return Resource_default.fetchArrayBuffer({
  20615. url: config2.wasmBinaryFile
  20616. }).then(function(arrayBuffer) {
  20617. config2.wasmBinary = arrayBuffer;
  20618. return config2;
  20619. });
  20620. }
  20621. function TaskProcessor(workerPath, maximumActiveTasks) {
  20622. const uri = new URI(workerPath);
  20623. this._workerPath = uri.scheme().length !== 0 && uri.fragment().length === 0 ? workerPath : TaskProcessor._workerModulePrefix + workerPath;
  20624. this._maximumActiveTasks = defaultValue_default(
  20625. maximumActiveTasks,
  20626. Number.POSITIVE_INFINITY
  20627. );
  20628. this._activeTasks = 0;
  20629. this._deferreds = {};
  20630. this._nextID = 0;
  20631. }
  20632. var emptyTransferableObjectArray = [];
  20633. TaskProcessor.prototype.scheduleTask = function(parameters, transferableObjects) {
  20634. if (!defined_default(this._worker)) {
  20635. this._worker = createWorker(this);
  20636. }
  20637. if (this._activeTasks >= this._maximumActiveTasks) {
  20638. return void 0;
  20639. }
  20640. ++this._activeTasks;
  20641. const processor = this;
  20642. return Promise.resolve(canTransferArrayBuffer()).then(function(canTransferArrayBuffer2) {
  20643. if (!defined_default(transferableObjects)) {
  20644. transferableObjects = emptyTransferableObjectArray;
  20645. } else if (!canTransferArrayBuffer2) {
  20646. transferableObjects.length = 0;
  20647. }
  20648. const id = processor._nextID++;
  20649. const deferred = defer_default();
  20650. processor._deferreds[id] = deferred;
  20651. processor._worker.postMessage(
  20652. {
  20653. id,
  20654. parameters,
  20655. canTransferArrayBuffer: canTransferArrayBuffer2
  20656. },
  20657. transferableObjects
  20658. );
  20659. return deferred.promise;
  20660. });
  20661. };
  20662. TaskProcessor.prototype.initWebAssemblyModule = function(webAssemblyOptions) {
  20663. if (!defined_default(this._worker)) {
  20664. this._worker = createWorker(this);
  20665. }
  20666. const deferred = defer_default();
  20667. const processor = this;
  20668. const worker = this._worker;
  20669. getWebAssemblyLoaderConfig(this, webAssemblyOptions).then(function(wasmConfig) {
  20670. return Promise.resolve(canTransferArrayBuffer()).then(function(canTransferArrayBuffer2) {
  20671. let transferableObjects;
  20672. const binary = wasmConfig.wasmBinary;
  20673. if (defined_default(binary) && canTransferArrayBuffer2) {
  20674. transferableObjects = [binary];
  20675. }
  20676. worker.onmessage = function(event) {
  20677. worker.onmessage = function(event2) {
  20678. completeTask(processor, event2.data);
  20679. };
  20680. deferred.resolve(event.data);
  20681. };
  20682. worker.postMessage(
  20683. { webAssemblyConfig: wasmConfig },
  20684. transferableObjects
  20685. );
  20686. });
  20687. });
  20688. return deferred.promise;
  20689. };
  20690. TaskProcessor.prototype.isDestroyed = function() {
  20691. return false;
  20692. };
  20693. TaskProcessor.prototype.destroy = function() {
  20694. if (defined_default(this._worker)) {
  20695. this._worker.terminate();
  20696. }
  20697. return destroyObject_default(this);
  20698. };
  20699. TaskProcessor.taskCompletedEvent = taskCompletedEvent;
  20700. TaskProcessor._defaultWorkerModulePrefix = "Workers/";
  20701. TaskProcessor._workerModulePrefix = TaskProcessor._defaultWorkerModulePrefix;
  20702. TaskProcessor._canTransferArrayBuffer = void 0;
  20703. var TaskProcessor_default = TaskProcessor;
  20704. // node_modules/cesium/Source/Core/TerrainData.js
  20705. function TerrainData() {
  20706. DeveloperError_default.throwInstantiationError();
  20707. }
  20708. Object.defineProperties(TerrainData.prototype, {
  20709. credits: {
  20710. get: DeveloperError_default.throwInstantiationError
  20711. },
  20712. waterMask: {
  20713. get: DeveloperError_default.throwInstantiationError
  20714. }
  20715. });
  20716. TerrainData.prototype.interpolateHeight = DeveloperError_default.throwInstantiationError;
  20717. TerrainData.prototype.isChildAvailable = DeveloperError_default.throwInstantiationError;
  20718. TerrainData.prototype.createMesh = DeveloperError_default.throwInstantiationError;
  20719. TerrainData.prototype.upsample = DeveloperError_default.throwInstantiationError;
  20720. TerrainData.prototype.wasCreatedByUpsampling = DeveloperError_default.throwInstantiationError;
  20721. TerrainData.maximumAsynchronousTasks = 5;
  20722. var TerrainData_default = TerrainData;
  20723. // node_modules/cesium/Source/Core/TerrainMesh.js
  20724. function TerrainMesh(center, vertices, indices2, indexCountWithoutSkirts, vertexCountWithoutSkirts, minimumHeight, maximumHeight, boundingSphere3D, occludeePointInScaledSpace, vertexStride, orientedBoundingBox, encoding, westIndicesSouthToNorth, southIndicesEastToWest, eastIndicesNorthToSouth, northIndicesWestToEast) {
  20725. this.center = center;
  20726. this.vertices = vertices;
  20727. this.stride = defaultValue_default(vertexStride, 6);
  20728. this.indices = indices2;
  20729. this.indexCountWithoutSkirts = indexCountWithoutSkirts;
  20730. this.vertexCountWithoutSkirts = vertexCountWithoutSkirts;
  20731. this.minimumHeight = minimumHeight;
  20732. this.maximumHeight = maximumHeight;
  20733. this.boundingSphere3D = boundingSphere3D;
  20734. this.occludeePointInScaledSpace = occludeePointInScaledSpace;
  20735. this.orientedBoundingBox = orientedBoundingBox;
  20736. this.encoding = encoding;
  20737. this.westIndicesSouthToNorth = westIndicesSouthToNorth;
  20738. this.southIndicesEastToWest = southIndicesEastToWest;
  20739. this.eastIndicesNorthToSouth = eastIndicesNorthToSouth;
  20740. this.northIndicesWestToEast = northIndicesWestToEast;
  20741. }
  20742. var TerrainMesh_default = TerrainMesh;
  20743. // node_modules/cesium/Source/Core/IndexDatatype.js
  20744. var IndexDatatype = {
  20745. UNSIGNED_BYTE: WebGLConstants_default.UNSIGNED_BYTE,
  20746. UNSIGNED_SHORT: WebGLConstants_default.UNSIGNED_SHORT,
  20747. UNSIGNED_INT: WebGLConstants_default.UNSIGNED_INT
  20748. };
  20749. IndexDatatype.getSizeInBytes = function(indexDatatype) {
  20750. switch (indexDatatype) {
  20751. case IndexDatatype.UNSIGNED_BYTE:
  20752. return Uint8Array.BYTES_PER_ELEMENT;
  20753. case IndexDatatype.UNSIGNED_SHORT:
  20754. return Uint16Array.BYTES_PER_ELEMENT;
  20755. case IndexDatatype.UNSIGNED_INT:
  20756. return Uint32Array.BYTES_PER_ELEMENT;
  20757. }
  20758. throw new DeveloperError_default(
  20759. "indexDatatype is required and must be a valid IndexDatatype constant."
  20760. );
  20761. };
  20762. IndexDatatype.fromSizeInBytes = function(sizeInBytes) {
  20763. switch (sizeInBytes) {
  20764. case 2:
  20765. return IndexDatatype.UNSIGNED_SHORT;
  20766. case 4:
  20767. return IndexDatatype.UNSIGNED_INT;
  20768. case 1:
  20769. return IndexDatatype.UNSIGNED_BYTE;
  20770. default:
  20771. throw new DeveloperError_default(
  20772. "Size in bytes cannot be mapped to an IndexDatatype"
  20773. );
  20774. }
  20775. };
  20776. IndexDatatype.validate = function(indexDatatype) {
  20777. return defined_default(indexDatatype) && (indexDatatype === IndexDatatype.UNSIGNED_BYTE || indexDatatype === IndexDatatype.UNSIGNED_SHORT || indexDatatype === IndexDatatype.UNSIGNED_INT);
  20778. };
  20779. IndexDatatype.createTypedArray = function(numberOfVertices, indicesLengthOrArray) {
  20780. if (!defined_default(numberOfVertices)) {
  20781. throw new DeveloperError_default("numberOfVertices is required.");
  20782. }
  20783. if (numberOfVertices >= Math_default.SIXTY_FOUR_KILOBYTES) {
  20784. return new Uint32Array(indicesLengthOrArray);
  20785. }
  20786. return new Uint16Array(indicesLengthOrArray);
  20787. };
  20788. IndexDatatype.createTypedArrayFromArrayBuffer = function(numberOfVertices, sourceArray, byteOffset, length3) {
  20789. if (!defined_default(numberOfVertices)) {
  20790. throw new DeveloperError_default("numberOfVertices is required.");
  20791. }
  20792. if (!defined_default(sourceArray)) {
  20793. throw new DeveloperError_default("sourceArray is required.");
  20794. }
  20795. if (!defined_default(byteOffset)) {
  20796. throw new DeveloperError_default("byteOffset is required.");
  20797. }
  20798. if (numberOfVertices >= Math_default.SIXTY_FOUR_KILOBYTES) {
  20799. return new Uint32Array(sourceArray, byteOffset, length3);
  20800. }
  20801. return new Uint16Array(sourceArray, byteOffset, length3);
  20802. };
  20803. var IndexDatatype_default = Object.freeze(IndexDatatype);
  20804. // node_modules/cesium/Source/Core/TerrainProvider.js
  20805. function TerrainProvider() {
  20806. DeveloperError_default.throwInstantiationError();
  20807. }
  20808. Object.defineProperties(TerrainProvider.prototype, {
  20809. errorEvent: {
  20810. get: DeveloperError_default.throwInstantiationError
  20811. },
  20812. credit: {
  20813. get: DeveloperError_default.throwInstantiationError
  20814. },
  20815. tilingScheme: {
  20816. get: DeveloperError_default.throwInstantiationError
  20817. },
  20818. ready: {
  20819. get: DeveloperError_default.throwInstantiationError
  20820. },
  20821. readyPromise: {
  20822. get: DeveloperError_default.throwInstantiationError
  20823. },
  20824. hasWaterMask: {
  20825. get: DeveloperError_default.throwInstantiationError
  20826. },
  20827. hasVertexNormals: {
  20828. get: DeveloperError_default.throwInstantiationError
  20829. },
  20830. availability: {
  20831. get: DeveloperError_default.throwInstantiationError
  20832. }
  20833. });
  20834. var regularGridIndicesCache = [];
  20835. TerrainProvider.getRegularGridIndices = function(width, height) {
  20836. if (width * height >= Math_default.FOUR_GIGABYTES) {
  20837. throw new DeveloperError_default(
  20838. "The total number of vertices (width * height) must be less than 4,294,967,296."
  20839. );
  20840. }
  20841. let byWidth = regularGridIndicesCache[width];
  20842. if (!defined_default(byWidth)) {
  20843. regularGridIndicesCache[width] = byWidth = [];
  20844. }
  20845. let indices2 = byWidth[height];
  20846. if (!defined_default(indices2)) {
  20847. if (width * height < Math_default.SIXTY_FOUR_KILOBYTES) {
  20848. indices2 = byWidth[height] = new Uint16Array(
  20849. (width - 1) * (height - 1) * 6
  20850. );
  20851. } else {
  20852. indices2 = byWidth[height] = new Uint32Array(
  20853. (width - 1) * (height - 1) * 6
  20854. );
  20855. }
  20856. addRegularGridIndices(width, height, indices2, 0);
  20857. }
  20858. return indices2;
  20859. };
  20860. var regularGridAndEdgeIndicesCache = [];
  20861. TerrainProvider.getRegularGridIndicesAndEdgeIndices = function(width, height) {
  20862. if (width * height >= Math_default.FOUR_GIGABYTES) {
  20863. throw new DeveloperError_default(
  20864. "The total number of vertices (width * height) must be less than 4,294,967,296."
  20865. );
  20866. }
  20867. let byWidth = regularGridAndEdgeIndicesCache[width];
  20868. if (!defined_default(byWidth)) {
  20869. regularGridAndEdgeIndicesCache[width] = byWidth = [];
  20870. }
  20871. let indicesAndEdges = byWidth[height];
  20872. if (!defined_default(indicesAndEdges)) {
  20873. const indices2 = TerrainProvider.getRegularGridIndices(width, height);
  20874. const edgeIndices = getEdgeIndices(width, height);
  20875. const westIndicesSouthToNorth = edgeIndices.westIndicesSouthToNorth;
  20876. const southIndicesEastToWest = edgeIndices.southIndicesEastToWest;
  20877. const eastIndicesNorthToSouth = edgeIndices.eastIndicesNorthToSouth;
  20878. const northIndicesWestToEast = edgeIndices.northIndicesWestToEast;
  20879. indicesAndEdges = byWidth[height] = {
  20880. indices: indices2,
  20881. westIndicesSouthToNorth,
  20882. southIndicesEastToWest,
  20883. eastIndicesNorthToSouth,
  20884. northIndicesWestToEast
  20885. };
  20886. }
  20887. return indicesAndEdges;
  20888. };
  20889. var regularGridAndSkirtAndEdgeIndicesCache = [];
  20890. TerrainProvider.getRegularGridAndSkirtIndicesAndEdgeIndices = function(width, height) {
  20891. if (width * height >= Math_default.FOUR_GIGABYTES) {
  20892. throw new DeveloperError_default(
  20893. "The total number of vertices (width * height) must be less than 4,294,967,296."
  20894. );
  20895. }
  20896. let byWidth = regularGridAndSkirtAndEdgeIndicesCache[width];
  20897. if (!defined_default(byWidth)) {
  20898. regularGridAndSkirtAndEdgeIndicesCache[width] = byWidth = [];
  20899. }
  20900. let indicesAndEdges = byWidth[height];
  20901. if (!defined_default(indicesAndEdges)) {
  20902. const gridVertexCount = width * height;
  20903. const gridIndexCount = (width - 1) * (height - 1) * 6;
  20904. const edgeVertexCount = width * 2 + height * 2;
  20905. const edgeIndexCount = Math.max(0, edgeVertexCount - 4) * 6;
  20906. const vertexCount = gridVertexCount + edgeVertexCount;
  20907. const indexCount = gridIndexCount + edgeIndexCount;
  20908. const edgeIndices = getEdgeIndices(width, height);
  20909. const westIndicesSouthToNorth = edgeIndices.westIndicesSouthToNorth;
  20910. const southIndicesEastToWest = edgeIndices.southIndicesEastToWest;
  20911. const eastIndicesNorthToSouth = edgeIndices.eastIndicesNorthToSouth;
  20912. const northIndicesWestToEast = edgeIndices.northIndicesWestToEast;
  20913. const indices2 = IndexDatatype_default.createTypedArray(vertexCount, indexCount);
  20914. addRegularGridIndices(width, height, indices2, 0);
  20915. TerrainProvider.addSkirtIndices(
  20916. westIndicesSouthToNorth,
  20917. southIndicesEastToWest,
  20918. eastIndicesNorthToSouth,
  20919. northIndicesWestToEast,
  20920. gridVertexCount,
  20921. indices2,
  20922. gridIndexCount
  20923. );
  20924. indicesAndEdges = byWidth[height] = {
  20925. indices: indices2,
  20926. westIndicesSouthToNorth,
  20927. southIndicesEastToWest,
  20928. eastIndicesNorthToSouth,
  20929. northIndicesWestToEast,
  20930. indexCountWithoutSkirts: gridIndexCount
  20931. };
  20932. }
  20933. return indicesAndEdges;
  20934. };
  20935. TerrainProvider.addSkirtIndices = function(westIndicesSouthToNorth, southIndicesEastToWest, eastIndicesNorthToSouth, northIndicesWestToEast, vertexCount, indices2, offset2) {
  20936. let vertexIndex = vertexCount;
  20937. offset2 = addSkirtIndices(
  20938. westIndicesSouthToNorth,
  20939. vertexIndex,
  20940. indices2,
  20941. offset2
  20942. );
  20943. vertexIndex += westIndicesSouthToNorth.length;
  20944. offset2 = addSkirtIndices(
  20945. southIndicesEastToWest,
  20946. vertexIndex,
  20947. indices2,
  20948. offset2
  20949. );
  20950. vertexIndex += southIndicesEastToWest.length;
  20951. offset2 = addSkirtIndices(
  20952. eastIndicesNorthToSouth,
  20953. vertexIndex,
  20954. indices2,
  20955. offset2
  20956. );
  20957. vertexIndex += eastIndicesNorthToSouth.length;
  20958. addSkirtIndices(northIndicesWestToEast, vertexIndex, indices2, offset2);
  20959. };
  20960. function getEdgeIndices(width, height) {
  20961. const westIndicesSouthToNorth = new Array(height);
  20962. const southIndicesEastToWest = new Array(width);
  20963. const eastIndicesNorthToSouth = new Array(height);
  20964. const northIndicesWestToEast = new Array(width);
  20965. let i2;
  20966. for (i2 = 0; i2 < width; ++i2) {
  20967. northIndicesWestToEast[i2] = i2;
  20968. southIndicesEastToWest[i2] = width * height - 1 - i2;
  20969. }
  20970. for (i2 = 0; i2 < height; ++i2) {
  20971. eastIndicesNorthToSouth[i2] = (i2 + 1) * width - 1;
  20972. westIndicesSouthToNorth[i2] = (height - i2 - 1) * width;
  20973. }
  20974. return {
  20975. westIndicesSouthToNorth,
  20976. southIndicesEastToWest,
  20977. eastIndicesNorthToSouth,
  20978. northIndicesWestToEast
  20979. };
  20980. }
  20981. function addRegularGridIndices(width, height, indices2, offset2) {
  20982. let index2 = 0;
  20983. for (let j = 0; j < height - 1; ++j) {
  20984. for (let i2 = 0; i2 < width - 1; ++i2) {
  20985. const upperLeft = index2;
  20986. const lowerLeft = upperLeft + width;
  20987. const lowerRight = lowerLeft + 1;
  20988. const upperRight = upperLeft + 1;
  20989. indices2[offset2++] = upperLeft;
  20990. indices2[offset2++] = lowerLeft;
  20991. indices2[offset2++] = upperRight;
  20992. indices2[offset2++] = upperRight;
  20993. indices2[offset2++] = lowerLeft;
  20994. indices2[offset2++] = lowerRight;
  20995. ++index2;
  20996. }
  20997. ++index2;
  20998. }
  20999. }
  21000. function addSkirtIndices(edgeIndices, vertexIndex, indices2, offset2) {
  21001. let previousIndex = edgeIndices[0];
  21002. const length3 = edgeIndices.length;
  21003. for (let i2 = 1; i2 < length3; ++i2) {
  21004. const index2 = edgeIndices[i2];
  21005. indices2[offset2++] = previousIndex;
  21006. indices2[offset2++] = index2;
  21007. indices2[offset2++] = vertexIndex;
  21008. indices2[offset2++] = vertexIndex;
  21009. indices2[offset2++] = index2;
  21010. indices2[offset2++] = vertexIndex + 1;
  21011. previousIndex = index2;
  21012. ++vertexIndex;
  21013. }
  21014. return offset2;
  21015. }
  21016. TerrainProvider.heightmapTerrainQuality = 0.25;
  21017. TerrainProvider.getEstimatedLevelZeroGeometricErrorForAHeightmap = function(ellipsoid, tileImageWidth, numberOfTilesAtLevelZero) {
  21018. return ellipsoid.maximumRadius * 2 * Math.PI * TerrainProvider.heightmapTerrainQuality / (tileImageWidth * numberOfTilesAtLevelZero);
  21019. };
  21020. TerrainProvider.prototype.requestTileGeometry = DeveloperError_default.throwInstantiationError;
  21021. TerrainProvider.prototype.getLevelMaximumGeometricError = DeveloperError_default.throwInstantiationError;
  21022. TerrainProvider.prototype.getTileDataAvailable = DeveloperError_default.throwInstantiationError;
  21023. TerrainProvider.prototype.loadTileDataAvailability = DeveloperError_default.throwInstantiationError;
  21024. var TerrainProvider_default = TerrainProvider;
  21025. // node_modules/cesium/Source/Core/HeightmapTerrainData.js
  21026. function HeightmapTerrainData(options) {
  21027. if (!defined_default(options) || !defined_default(options.buffer)) {
  21028. throw new DeveloperError_default("options.buffer is required.");
  21029. }
  21030. if (!defined_default(options.width)) {
  21031. throw new DeveloperError_default("options.width is required.");
  21032. }
  21033. if (!defined_default(options.height)) {
  21034. throw new DeveloperError_default("options.height is required.");
  21035. }
  21036. this._buffer = options.buffer;
  21037. this._width = options.width;
  21038. this._height = options.height;
  21039. this._childTileMask = defaultValue_default(options.childTileMask, 15);
  21040. this._encoding = defaultValue_default(options.encoding, HeightmapEncoding_default.NONE);
  21041. const defaultStructure = HeightmapTessellator_default.DEFAULT_STRUCTURE;
  21042. let structure = options.structure;
  21043. if (!defined_default(structure)) {
  21044. structure = defaultStructure;
  21045. } else if (structure !== defaultStructure) {
  21046. structure.heightScale = defaultValue_default(
  21047. structure.heightScale,
  21048. defaultStructure.heightScale
  21049. );
  21050. structure.heightOffset = defaultValue_default(
  21051. structure.heightOffset,
  21052. defaultStructure.heightOffset
  21053. );
  21054. structure.elementsPerHeight = defaultValue_default(
  21055. structure.elementsPerHeight,
  21056. defaultStructure.elementsPerHeight
  21057. );
  21058. structure.stride = defaultValue_default(structure.stride, defaultStructure.stride);
  21059. structure.elementMultiplier = defaultValue_default(
  21060. structure.elementMultiplier,
  21061. defaultStructure.elementMultiplier
  21062. );
  21063. structure.isBigEndian = defaultValue_default(
  21064. structure.isBigEndian,
  21065. defaultStructure.isBigEndian
  21066. );
  21067. }
  21068. this._structure = structure;
  21069. this._createdByUpsampling = defaultValue_default(options.createdByUpsampling, false);
  21070. this._waterMask = options.waterMask;
  21071. this._skirtHeight = void 0;
  21072. this._bufferType = this._encoding === HeightmapEncoding_default.LERC ? Float32Array : this._buffer.constructor;
  21073. this._mesh = void 0;
  21074. }
  21075. Object.defineProperties(HeightmapTerrainData.prototype, {
  21076. credits: {
  21077. get: function() {
  21078. return void 0;
  21079. }
  21080. },
  21081. waterMask: {
  21082. get: function() {
  21083. return this._waterMask;
  21084. }
  21085. },
  21086. childTileMask: {
  21087. get: function() {
  21088. return this._childTileMask;
  21089. }
  21090. }
  21091. });
  21092. var createMeshTaskName = "createVerticesFromHeightmap";
  21093. var createMeshTaskProcessorNoThrottle = new TaskProcessor_default(createMeshTaskName);
  21094. var createMeshTaskProcessorThrottle = new TaskProcessor_default(
  21095. createMeshTaskName,
  21096. TerrainData_default.maximumAsynchronousTasks
  21097. );
  21098. HeightmapTerrainData.prototype.createMesh = function(options) {
  21099. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  21100. Check_default.typeOf.object("options.tilingScheme", options.tilingScheme);
  21101. Check_default.typeOf.number("options.x", options.x);
  21102. Check_default.typeOf.number("options.y", options.y);
  21103. Check_default.typeOf.number("options.level", options.level);
  21104. const tilingScheme2 = options.tilingScheme;
  21105. const x = options.x;
  21106. const y = options.y;
  21107. const level = options.level;
  21108. const exaggeration = defaultValue_default(options.exaggeration, 1);
  21109. const exaggerationRelativeHeight = defaultValue_default(
  21110. options.exaggerationRelativeHeight,
  21111. 0
  21112. );
  21113. const throttle = defaultValue_default(options.throttle, true);
  21114. const ellipsoid = tilingScheme2.ellipsoid;
  21115. const nativeRectangle = tilingScheme2.tileXYToNativeRectangle(x, y, level);
  21116. const rectangle = tilingScheme2.tileXYToRectangle(x, y, level);
  21117. const center = ellipsoid.cartographicToCartesian(Rectangle_default.center(rectangle));
  21118. const structure = this._structure;
  21119. const levelZeroMaxError = TerrainProvider_default.getEstimatedLevelZeroGeometricErrorForAHeightmap(
  21120. ellipsoid,
  21121. this._width,
  21122. tilingScheme2.getNumberOfXTilesAtLevel(0)
  21123. );
  21124. const thisLevelMaxError = levelZeroMaxError / (1 << level);
  21125. this._skirtHeight = Math.min(thisLevelMaxError * 4, 1e3);
  21126. const createMeshTaskProcessor = throttle ? createMeshTaskProcessorThrottle : createMeshTaskProcessorNoThrottle;
  21127. const verticesPromise = createMeshTaskProcessor.scheduleTask({
  21128. heightmap: this._buffer,
  21129. structure,
  21130. includeWebMercatorT: true,
  21131. width: this._width,
  21132. height: this._height,
  21133. nativeRectangle,
  21134. rectangle,
  21135. relativeToCenter: center,
  21136. ellipsoid,
  21137. skirtHeight: this._skirtHeight,
  21138. isGeographic: tilingScheme2.projection instanceof GeographicProjection_default,
  21139. exaggeration,
  21140. exaggerationRelativeHeight,
  21141. encoding: this._encoding
  21142. });
  21143. if (!defined_default(verticesPromise)) {
  21144. return void 0;
  21145. }
  21146. const that = this;
  21147. return Promise.resolve(verticesPromise).then(function(result) {
  21148. let indicesAndEdges;
  21149. if (that._skirtHeight > 0) {
  21150. indicesAndEdges = TerrainProvider_default.getRegularGridAndSkirtIndicesAndEdgeIndices(
  21151. result.gridWidth,
  21152. result.gridHeight
  21153. );
  21154. } else {
  21155. indicesAndEdges = TerrainProvider_default.getRegularGridIndicesAndEdgeIndices(
  21156. result.gridWidth,
  21157. result.gridHeight
  21158. );
  21159. }
  21160. const vertexCountWithoutSkirts = result.gridWidth * result.gridHeight;
  21161. that._mesh = new TerrainMesh_default(
  21162. center,
  21163. new Float32Array(result.vertices),
  21164. indicesAndEdges.indices,
  21165. indicesAndEdges.indexCountWithoutSkirts,
  21166. vertexCountWithoutSkirts,
  21167. result.minimumHeight,
  21168. result.maximumHeight,
  21169. BoundingSphere_default.clone(result.boundingSphere3D),
  21170. Cartesian3_default.clone(result.occludeePointInScaledSpace),
  21171. result.numberOfAttributes,
  21172. OrientedBoundingBox_default.clone(result.orientedBoundingBox),
  21173. TerrainEncoding_default.clone(result.encoding),
  21174. indicesAndEdges.westIndicesSouthToNorth,
  21175. indicesAndEdges.southIndicesEastToWest,
  21176. indicesAndEdges.eastIndicesNorthToSouth,
  21177. indicesAndEdges.northIndicesWestToEast
  21178. );
  21179. that._buffer = void 0;
  21180. return that._mesh;
  21181. });
  21182. };
  21183. HeightmapTerrainData.prototype._createMeshSync = function(options) {
  21184. Check_default.typeOf.object("options.tilingScheme", options.tilingScheme);
  21185. Check_default.typeOf.number("options.x", options.x);
  21186. Check_default.typeOf.number("options.y", options.y);
  21187. Check_default.typeOf.number("options.level", options.level);
  21188. const tilingScheme2 = options.tilingScheme;
  21189. const x = options.x;
  21190. const y = options.y;
  21191. const level = options.level;
  21192. const exaggeration = defaultValue_default(options.exaggeration, 1);
  21193. const exaggerationRelativeHeight = defaultValue_default(
  21194. options.exaggerationRelativeHeight,
  21195. 0
  21196. );
  21197. const ellipsoid = tilingScheme2.ellipsoid;
  21198. const nativeRectangle = tilingScheme2.tileXYToNativeRectangle(x, y, level);
  21199. const rectangle = tilingScheme2.tileXYToRectangle(x, y, level);
  21200. const center = ellipsoid.cartographicToCartesian(Rectangle_default.center(rectangle));
  21201. const structure = this._structure;
  21202. const levelZeroMaxError = TerrainProvider_default.getEstimatedLevelZeroGeometricErrorForAHeightmap(
  21203. ellipsoid,
  21204. this._width,
  21205. tilingScheme2.getNumberOfXTilesAtLevel(0)
  21206. );
  21207. const thisLevelMaxError = levelZeroMaxError / (1 << level);
  21208. this._skirtHeight = Math.min(thisLevelMaxError * 4, 1e3);
  21209. const result = HeightmapTessellator_default.computeVertices({
  21210. heightmap: this._buffer,
  21211. structure,
  21212. includeWebMercatorT: true,
  21213. width: this._width,
  21214. height: this._height,
  21215. nativeRectangle,
  21216. rectangle,
  21217. relativeToCenter: center,
  21218. ellipsoid,
  21219. skirtHeight: this._skirtHeight,
  21220. isGeographic: tilingScheme2.projection instanceof GeographicProjection_default,
  21221. exaggeration,
  21222. exaggerationRelativeHeight
  21223. });
  21224. this._buffer = void 0;
  21225. let indicesAndEdges;
  21226. if (this._skirtHeight > 0) {
  21227. indicesAndEdges = TerrainProvider_default.getRegularGridAndSkirtIndicesAndEdgeIndices(
  21228. this._width,
  21229. this._height
  21230. );
  21231. } else {
  21232. indicesAndEdges = TerrainProvider_default.getRegularGridIndicesAndEdgeIndices(
  21233. this._width,
  21234. this._height
  21235. );
  21236. }
  21237. const vertexCountWithoutSkirts = result.gridWidth * result.gridHeight;
  21238. this._mesh = new TerrainMesh_default(
  21239. center,
  21240. result.vertices,
  21241. indicesAndEdges.indices,
  21242. indicesAndEdges.indexCountWithoutSkirts,
  21243. vertexCountWithoutSkirts,
  21244. result.minimumHeight,
  21245. result.maximumHeight,
  21246. result.boundingSphere3D,
  21247. result.occludeePointInScaledSpace,
  21248. result.encoding.stride,
  21249. result.orientedBoundingBox,
  21250. result.encoding,
  21251. indicesAndEdges.westIndicesSouthToNorth,
  21252. indicesAndEdges.southIndicesEastToWest,
  21253. indicesAndEdges.eastIndicesNorthToSouth,
  21254. indicesAndEdges.northIndicesWestToEast
  21255. );
  21256. return this._mesh;
  21257. };
  21258. HeightmapTerrainData.prototype.interpolateHeight = function(rectangle, longitude, latitude) {
  21259. const width = this._width;
  21260. const height = this._height;
  21261. const structure = this._structure;
  21262. const stride = structure.stride;
  21263. const elementsPerHeight = structure.elementsPerHeight;
  21264. const elementMultiplier = structure.elementMultiplier;
  21265. const isBigEndian = structure.isBigEndian;
  21266. const heightOffset = structure.heightOffset;
  21267. const heightScale = structure.heightScale;
  21268. const isMeshCreated = defined_default(this._mesh);
  21269. const isLERCEncoding = this._encoding === HeightmapEncoding_default.LERC;
  21270. const isInterpolationImpossible = !isMeshCreated && isLERCEncoding;
  21271. if (isInterpolationImpossible) {
  21272. return void 0;
  21273. }
  21274. let heightSample;
  21275. if (isMeshCreated) {
  21276. const buffer = this._mesh.vertices;
  21277. const encoding = this._mesh.encoding;
  21278. heightSample = interpolateMeshHeight(
  21279. buffer,
  21280. encoding,
  21281. heightOffset,
  21282. heightScale,
  21283. rectangle,
  21284. width,
  21285. height,
  21286. longitude,
  21287. latitude
  21288. );
  21289. } else {
  21290. heightSample = interpolateHeight(
  21291. this._buffer,
  21292. elementsPerHeight,
  21293. elementMultiplier,
  21294. stride,
  21295. isBigEndian,
  21296. rectangle,
  21297. width,
  21298. height,
  21299. longitude,
  21300. latitude
  21301. );
  21302. heightSample = heightSample * heightScale + heightOffset;
  21303. }
  21304. return heightSample;
  21305. };
  21306. HeightmapTerrainData.prototype.upsample = function(tilingScheme2, thisX, thisY, thisLevel, descendantX, descendantY, descendantLevel) {
  21307. if (!defined_default(tilingScheme2)) {
  21308. throw new DeveloperError_default("tilingScheme is required.");
  21309. }
  21310. if (!defined_default(thisX)) {
  21311. throw new DeveloperError_default("thisX is required.");
  21312. }
  21313. if (!defined_default(thisY)) {
  21314. throw new DeveloperError_default("thisY is required.");
  21315. }
  21316. if (!defined_default(thisLevel)) {
  21317. throw new DeveloperError_default("thisLevel is required.");
  21318. }
  21319. if (!defined_default(descendantX)) {
  21320. throw new DeveloperError_default("descendantX is required.");
  21321. }
  21322. if (!defined_default(descendantY)) {
  21323. throw new DeveloperError_default("descendantY is required.");
  21324. }
  21325. if (!defined_default(descendantLevel)) {
  21326. throw new DeveloperError_default("descendantLevel is required.");
  21327. }
  21328. const levelDifference = descendantLevel - thisLevel;
  21329. if (levelDifference > 1) {
  21330. throw new DeveloperError_default(
  21331. "Upsampling through more than one level at a time is not currently supported."
  21332. );
  21333. }
  21334. const meshData = this._mesh;
  21335. if (!defined_default(meshData)) {
  21336. return void 0;
  21337. }
  21338. const width = this._width;
  21339. const height = this._height;
  21340. const structure = this._structure;
  21341. const stride = structure.stride;
  21342. const heights = new this._bufferType(width * height * stride);
  21343. const buffer = meshData.vertices;
  21344. const encoding = meshData.encoding;
  21345. const sourceRectangle = tilingScheme2.tileXYToRectangle(
  21346. thisX,
  21347. thisY,
  21348. thisLevel
  21349. );
  21350. const destinationRectangle = tilingScheme2.tileXYToRectangle(
  21351. descendantX,
  21352. descendantY,
  21353. descendantLevel
  21354. );
  21355. const heightOffset = structure.heightOffset;
  21356. const heightScale = structure.heightScale;
  21357. const elementsPerHeight = structure.elementsPerHeight;
  21358. const elementMultiplier = structure.elementMultiplier;
  21359. const isBigEndian = structure.isBigEndian;
  21360. const divisor = Math.pow(elementMultiplier, elementsPerHeight - 1);
  21361. for (let j = 0; j < height; ++j) {
  21362. const latitude = Math_default.lerp(
  21363. destinationRectangle.north,
  21364. destinationRectangle.south,
  21365. j / (height - 1)
  21366. );
  21367. for (let i2 = 0; i2 < width; ++i2) {
  21368. const longitude = Math_default.lerp(
  21369. destinationRectangle.west,
  21370. destinationRectangle.east,
  21371. i2 / (width - 1)
  21372. );
  21373. let heightSample = interpolateMeshHeight(
  21374. buffer,
  21375. encoding,
  21376. heightOffset,
  21377. heightScale,
  21378. sourceRectangle,
  21379. width,
  21380. height,
  21381. longitude,
  21382. latitude
  21383. );
  21384. heightSample = heightSample < structure.lowestEncodedHeight ? structure.lowestEncodedHeight : heightSample;
  21385. heightSample = heightSample > structure.highestEncodedHeight ? structure.highestEncodedHeight : heightSample;
  21386. setHeight(
  21387. heights,
  21388. elementsPerHeight,
  21389. elementMultiplier,
  21390. divisor,
  21391. stride,
  21392. isBigEndian,
  21393. j * width + i2,
  21394. heightSample
  21395. );
  21396. }
  21397. }
  21398. return Promise.resolve(
  21399. new HeightmapTerrainData({
  21400. buffer: heights,
  21401. width,
  21402. height,
  21403. childTileMask: 0,
  21404. structure: this._structure,
  21405. createdByUpsampling: true
  21406. })
  21407. );
  21408. };
  21409. HeightmapTerrainData.prototype.isChildAvailable = function(thisX, thisY, childX, childY) {
  21410. if (!defined_default(thisX)) {
  21411. throw new DeveloperError_default("thisX is required.");
  21412. }
  21413. if (!defined_default(thisY)) {
  21414. throw new DeveloperError_default("thisY is required.");
  21415. }
  21416. if (!defined_default(childX)) {
  21417. throw new DeveloperError_default("childX is required.");
  21418. }
  21419. if (!defined_default(childY)) {
  21420. throw new DeveloperError_default("childY is required.");
  21421. }
  21422. let bitNumber = 2;
  21423. if (childX !== thisX * 2) {
  21424. ++bitNumber;
  21425. }
  21426. if (childY !== thisY * 2) {
  21427. bitNumber -= 2;
  21428. }
  21429. return (this._childTileMask & 1 << bitNumber) !== 0;
  21430. };
  21431. HeightmapTerrainData.prototype.wasCreatedByUpsampling = function() {
  21432. return this._createdByUpsampling;
  21433. };
  21434. function interpolateHeight(sourceHeights, elementsPerHeight, elementMultiplier, stride, isBigEndian, sourceRectangle, width, height, longitude, latitude) {
  21435. const fromWest = (longitude - sourceRectangle.west) * (width - 1) / (sourceRectangle.east - sourceRectangle.west);
  21436. const fromSouth = (latitude - sourceRectangle.south) * (height - 1) / (sourceRectangle.north - sourceRectangle.south);
  21437. let westInteger = fromWest | 0;
  21438. let eastInteger = westInteger + 1;
  21439. if (eastInteger >= width) {
  21440. eastInteger = width - 1;
  21441. westInteger = width - 2;
  21442. }
  21443. let southInteger = fromSouth | 0;
  21444. let northInteger = southInteger + 1;
  21445. if (northInteger >= height) {
  21446. northInteger = height - 1;
  21447. southInteger = height - 2;
  21448. }
  21449. const dx = fromWest - westInteger;
  21450. const dy = fromSouth - southInteger;
  21451. southInteger = height - 1 - southInteger;
  21452. northInteger = height - 1 - northInteger;
  21453. const southwestHeight = getHeight(
  21454. sourceHeights,
  21455. elementsPerHeight,
  21456. elementMultiplier,
  21457. stride,
  21458. isBigEndian,
  21459. southInteger * width + westInteger
  21460. );
  21461. const southeastHeight = getHeight(
  21462. sourceHeights,
  21463. elementsPerHeight,
  21464. elementMultiplier,
  21465. stride,
  21466. isBigEndian,
  21467. southInteger * width + eastInteger
  21468. );
  21469. const northwestHeight = getHeight(
  21470. sourceHeights,
  21471. elementsPerHeight,
  21472. elementMultiplier,
  21473. stride,
  21474. isBigEndian,
  21475. northInteger * width + westInteger
  21476. );
  21477. const northeastHeight = getHeight(
  21478. sourceHeights,
  21479. elementsPerHeight,
  21480. elementMultiplier,
  21481. stride,
  21482. isBigEndian,
  21483. northInteger * width + eastInteger
  21484. );
  21485. return triangleInterpolateHeight(
  21486. dx,
  21487. dy,
  21488. southwestHeight,
  21489. southeastHeight,
  21490. northwestHeight,
  21491. northeastHeight
  21492. );
  21493. }
  21494. function interpolateMeshHeight(buffer, encoding, heightOffset, heightScale, sourceRectangle, width, height, longitude, latitude) {
  21495. const fromWest = (longitude - sourceRectangle.west) * (width - 1) / (sourceRectangle.east - sourceRectangle.west);
  21496. const fromSouth = (latitude - sourceRectangle.south) * (height - 1) / (sourceRectangle.north - sourceRectangle.south);
  21497. let westInteger = fromWest | 0;
  21498. let eastInteger = westInteger + 1;
  21499. if (eastInteger >= width) {
  21500. eastInteger = width - 1;
  21501. westInteger = width - 2;
  21502. }
  21503. let southInteger = fromSouth | 0;
  21504. let northInteger = southInteger + 1;
  21505. if (northInteger >= height) {
  21506. northInteger = height - 1;
  21507. southInteger = height - 2;
  21508. }
  21509. const dx = fromWest - westInteger;
  21510. const dy = fromSouth - southInteger;
  21511. southInteger = height - 1 - southInteger;
  21512. northInteger = height - 1 - northInteger;
  21513. const southwestHeight = (encoding.decodeHeight(buffer, southInteger * width + westInteger) - heightOffset) / heightScale;
  21514. const southeastHeight = (encoding.decodeHeight(buffer, southInteger * width + eastInteger) - heightOffset) / heightScale;
  21515. const northwestHeight = (encoding.decodeHeight(buffer, northInteger * width + westInteger) - heightOffset) / heightScale;
  21516. const northeastHeight = (encoding.decodeHeight(buffer, northInteger * width + eastInteger) - heightOffset) / heightScale;
  21517. return triangleInterpolateHeight(
  21518. dx,
  21519. dy,
  21520. southwestHeight,
  21521. southeastHeight,
  21522. northwestHeight,
  21523. northeastHeight
  21524. );
  21525. }
  21526. function triangleInterpolateHeight(dX, dY, southwestHeight, southeastHeight, northwestHeight, northeastHeight) {
  21527. if (dY < dX) {
  21528. return southwestHeight + dX * (southeastHeight - southwestHeight) + dY * (northeastHeight - southeastHeight);
  21529. }
  21530. return southwestHeight + dX * (northeastHeight - northwestHeight) + dY * (northwestHeight - southwestHeight);
  21531. }
  21532. function getHeight(heights, elementsPerHeight, elementMultiplier, stride, isBigEndian, index2) {
  21533. index2 *= stride;
  21534. let height = 0;
  21535. let i2;
  21536. if (isBigEndian) {
  21537. for (i2 = 0; i2 < elementsPerHeight; ++i2) {
  21538. height = height * elementMultiplier + heights[index2 + i2];
  21539. }
  21540. } else {
  21541. for (i2 = elementsPerHeight - 1; i2 >= 0; --i2) {
  21542. height = height * elementMultiplier + heights[index2 + i2];
  21543. }
  21544. }
  21545. return height;
  21546. }
  21547. function setHeight(heights, elementsPerHeight, elementMultiplier, divisor, stride, isBigEndian, index2, height) {
  21548. index2 *= stride;
  21549. let i2;
  21550. if (isBigEndian) {
  21551. for (i2 = 0; i2 < elementsPerHeight - 1; ++i2) {
  21552. heights[index2 + i2] = height / divisor | 0;
  21553. height -= heights[index2 + i2] * divisor;
  21554. divisor /= elementMultiplier;
  21555. }
  21556. } else {
  21557. for (i2 = elementsPerHeight - 1; i2 > 0; --i2) {
  21558. heights[index2 + i2] = height / divisor | 0;
  21559. height -= heights[index2 + i2] * divisor;
  21560. divisor /= elementMultiplier;
  21561. }
  21562. }
  21563. heights[index2 + i2] = height;
  21564. }
  21565. var HeightmapTerrainData_default = HeightmapTerrainData;
  21566. // node_modules/cesium/Source/Core/TileAvailability.js
  21567. function TileAvailability(tilingScheme2, maximumLevel) {
  21568. this._tilingScheme = tilingScheme2;
  21569. this._maximumLevel = maximumLevel;
  21570. this._rootNodes = [];
  21571. }
  21572. var rectangleScratch = new Rectangle_default();
  21573. function findNode(level, x, y, nodes) {
  21574. const count = nodes.length;
  21575. for (let i2 = 0; i2 < count; ++i2) {
  21576. const node = nodes[i2];
  21577. if (node.x === x && node.y === y && node.level === level) {
  21578. return true;
  21579. }
  21580. }
  21581. return false;
  21582. }
  21583. TileAvailability.prototype.addAvailableTileRange = function(level, startX, startY, endX, endY) {
  21584. const tilingScheme2 = this._tilingScheme;
  21585. const rootNodes = this._rootNodes;
  21586. if (level === 0) {
  21587. for (let y = startY; y <= endY; ++y) {
  21588. for (let x = startX; x <= endX; ++x) {
  21589. if (!findNode(level, x, y, rootNodes)) {
  21590. rootNodes.push(new QuadtreeNode(tilingScheme2, void 0, 0, x, y));
  21591. }
  21592. }
  21593. }
  21594. }
  21595. tilingScheme2.tileXYToRectangle(startX, startY, level, rectangleScratch);
  21596. const west = rectangleScratch.west;
  21597. const north = rectangleScratch.north;
  21598. tilingScheme2.tileXYToRectangle(endX, endY, level, rectangleScratch);
  21599. const east = rectangleScratch.east;
  21600. const south = rectangleScratch.south;
  21601. const rectangleWithLevel = new RectangleWithLevel(
  21602. level,
  21603. west,
  21604. south,
  21605. east,
  21606. north
  21607. );
  21608. for (let i2 = 0; i2 < rootNodes.length; ++i2) {
  21609. const rootNode = rootNodes[i2];
  21610. if (rectanglesOverlap(rootNode.extent, rectangleWithLevel)) {
  21611. putRectangleInQuadtree(this._maximumLevel, rootNode, rectangleWithLevel);
  21612. }
  21613. }
  21614. };
  21615. TileAvailability.prototype.computeMaximumLevelAtPosition = function(position) {
  21616. let node;
  21617. for (let nodeIndex = 0; nodeIndex < this._rootNodes.length; ++nodeIndex) {
  21618. const rootNode = this._rootNodes[nodeIndex];
  21619. if (rectangleContainsPosition(rootNode.extent, position)) {
  21620. node = rootNode;
  21621. break;
  21622. }
  21623. }
  21624. if (!defined_default(node)) {
  21625. return -1;
  21626. }
  21627. return findMaxLevelFromNode(void 0, node, position);
  21628. };
  21629. var rectanglesScratch = [];
  21630. var remainingToCoverByLevelScratch = [];
  21631. var westScratch = new Rectangle_default();
  21632. var eastScratch = new Rectangle_default();
  21633. TileAvailability.prototype.computeBestAvailableLevelOverRectangle = function(rectangle) {
  21634. const rectangles = rectanglesScratch;
  21635. rectangles.length = 0;
  21636. if (rectangle.east < rectangle.west) {
  21637. rectangles.push(
  21638. Rectangle_default.fromRadians(
  21639. -Math.PI,
  21640. rectangle.south,
  21641. rectangle.east,
  21642. rectangle.north,
  21643. westScratch
  21644. )
  21645. );
  21646. rectangles.push(
  21647. Rectangle_default.fromRadians(
  21648. rectangle.west,
  21649. rectangle.south,
  21650. Math.PI,
  21651. rectangle.north,
  21652. eastScratch
  21653. )
  21654. );
  21655. } else {
  21656. rectangles.push(rectangle);
  21657. }
  21658. const remainingToCoverByLevel = remainingToCoverByLevelScratch;
  21659. remainingToCoverByLevel.length = 0;
  21660. let i2;
  21661. for (i2 = 0; i2 < this._rootNodes.length; ++i2) {
  21662. updateCoverageWithNode(
  21663. remainingToCoverByLevel,
  21664. this._rootNodes[i2],
  21665. rectangles
  21666. );
  21667. }
  21668. for (i2 = remainingToCoverByLevel.length - 1; i2 >= 0; --i2) {
  21669. if (defined_default(remainingToCoverByLevel[i2]) && remainingToCoverByLevel[i2].length === 0) {
  21670. return i2;
  21671. }
  21672. }
  21673. return 0;
  21674. };
  21675. var cartographicScratch = new Cartographic_default();
  21676. TileAvailability.prototype.isTileAvailable = function(level, x, y) {
  21677. const rectangle = this._tilingScheme.tileXYToRectangle(
  21678. x,
  21679. y,
  21680. level,
  21681. rectangleScratch
  21682. );
  21683. Rectangle_default.center(rectangle, cartographicScratch);
  21684. return this.computeMaximumLevelAtPosition(cartographicScratch) >= level;
  21685. };
  21686. TileAvailability.prototype.computeChildMaskForTile = function(level, x, y) {
  21687. const childLevel = level + 1;
  21688. if (childLevel >= this._maximumLevel) {
  21689. return 0;
  21690. }
  21691. let mask = 0;
  21692. mask |= this.isTileAvailable(childLevel, 2 * x, 2 * y + 1) ? 1 : 0;
  21693. mask |= this.isTileAvailable(childLevel, 2 * x + 1, 2 * y + 1) ? 2 : 0;
  21694. mask |= this.isTileAvailable(childLevel, 2 * x, 2 * y) ? 4 : 0;
  21695. mask |= this.isTileAvailable(childLevel, 2 * x + 1, 2 * y) ? 8 : 0;
  21696. return mask;
  21697. };
  21698. function QuadtreeNode(tilingScheme2, parent, level, x, y) {
  21699. this.tilingScheme = tilingScheme2;
  21700. this.parent = parent;
  21701. this.level = level;
  21702. this.x = x;
  21703. this.y = y;
  21704. this.extent = tilingScheme2.tileXYToRectangle(x, y, level);
  21705. this.rectangles = [];
  21706. this._sw = void 0;
  21707. this._se = void 0;
  21708. this._nw = void 0;
  21709. this._ne = void 0;
  21710. }
  21711. Object.defineProperties(QuadtreeNode.prototype, {
  21712. nw: {
  21713. get: function() {
  21714. if (!this._nw) {
  21715. this._nw = new QuadtreeNode(
  21716. this.tilingScheme,
  21717. this,
  21718. this.level + 1,
  21719. this.x * 2,
  21720. this.y * 2
  21721. );
  21722. }
  21723. return this._nw;
  21724. }
  21725. },
  21726. ne: {
  21727. get: function() {
  21728. if (!this._ne) {
  21729. this._ne = new QuadtreeNode(
  21730. this.tilingScheme,
  21731. this,
  21732. this.level + 1,
  21733. this.x * 2 + 1,
  21734. this.y * 2
  21735. );
  21736. }
  21737. return this._ne;
  21738. }
  21739. },
  21740. sw: {
  21741. get: function() {
  21742. if (!this._sw) {
  21743. this._sw = new QuadtreeNode(
  21744. this.tilingScheme,
  21745. this,
  21746. this.level + 1,
  21747. this.x * 2,
  21748. this.y * 2 + 1
  21749. );
  21750. }
  21751. return this._sw;
  21752. }
  21753. },
  21754. se: {
  21755. get: function() {
  21756. if (!this._se) {
  21757. this._se = new QuadtreeNode(
  21758. this.tilingScheme,
  21759. this,
  21760. this.level + 1,
  21761. this.x * 2 + 1,
  21762. this.y * 2 + 1
  21763. );
  21764. }
  21765. return this._se;
  21766. }
  21767. }
  21768. });
  21769. function RectangleWithLevel(level, west, south, east, north) {
  21770. this.level = level;
  21771. this.west = west;
  21772. this.south = south;
  21773. this.east = east;
  21774. this.north = north;
  21775. }
  21776. function rectanglesOverlap(rectangle1, rectangle2) {
  21777. const west = Math.max(rectangle1.west, rectangle2.west);
  21778. const south = Math.max(rectangle1.south, rectangle2.south);
  21779. const east = Math.min(rectangle1.east, rectangle2.east);
  21780. const north = Math.min(rectangle1.north, rectangle2.north);
  21781. return south < north && west < east;
  21782. }
  21783. function putRectangleInQuadtree(maxDepth, node, rectangle) {
  21784. while (node.level < maxDepth) {
  21785. if (rectangleFullyContainsRectangle(node.nw.extent, rectangle)) {
  21786. node = node.nw;
  21787. } else if (rectangleFullyContainsRectangle(node.ne.extent, rectangle)) {
  21788. node = node.ne;
  21789. } else if (rectangleFullyContainsRectangle(node.sw.extent, rectangle)) {
  21790. node = node.sw;
  21791. } else if (rectangleFullyContainsRectangle(node.se.extent, rectangle)) {
  21792. node = node.se;
  21793. } else {
  21794. break;
  21795. }
  21796. }
  21797. if (node.rectangles.length === 0 || node.rectangles[node.rectangles.length - 1].level <= rectangle.level) {
  21798. node.rectangles.push(rectangle);
  21799. } else {
  21800. let index2 = binarySearch_default(
  21801. node.rectangles,
  21802. rectangle.level,
  21803. rectangleLevelComparator
  21804. );
  21805. if (index2 < 0) {
  21806. index2 = ~index2;
  21807. }
  21808. node.rectangles.splice(index2, 0, rectangle);
  21809. }
  21810. }
  21811. function rectangleLevelComparator(a4, b) {
  21812. return a4.level - b;
  21813. }
  21814. function rectangleFullyContainsRectangle(potentialContainer, rectangleToTest) {
  21815. return rectangleToTest.west >= potentialContainer.west && rectangleToTest.east <= potentialContainer.east && rectangleToTest.south >= potentialContainer.south && rectangleToTest.north <= potentialContainer.north;
  21816. }
  21817. function rectangleContainsPosition(potentialContainer, positionToTest) {
  21818. return positionToTest.longitude >= potentialContainer.west && positionToTest.longitude <= potentialContainer.east && positionToTest.latitude >= potentialContainer.south && positionToTest.latitude <= potentialContainer.north;
  21819. }
  21820. function findMaxLevelFromNode(stopNode, node, position) {
  21821. let maxLevel = 0;
  21822. let found = false;
  21823. while (!found) {
  21824. const nw = node._nw && rectangleContainsPosition(node._nw.extent, position);
  21825. const ne = node._ne && rectangleContainsPosition(node._ne.extent, position);
  21826. const sw = node._sw && rectangleContainsPosition(node._sw.extent, position);
  21827. const se = node._se && rectangleContainsPosition(node._se.extent, position);
  21828. if (nw + ne + sw + se > 1) {
  21829. if (nw) {
  21830. maxLevel = Math.max(
  21831. maxLevel,
  21832. findMaxLevelFromNode(node, node._nw, position)
  21833. );
  21834. }
  21835. if (ne) {
  21836. maxLevel = Math.max(
  21837. maxLevel,
  21838. findMaxLevelFromNode(node, node._ne, position)
  21839. );
  21840. }
  21841. if (sw) {
  21842. maxLevel = Math.max(
  21843. maxLevel,
  21844. findMaxLevelFromNode(node, node._sw, position)
  21845. );
  21846. }
  21847. if (se) {
  21848. maxLevel = Math.max(
  21849. maxLevel,
  21850. findMaxLevelFromNode(node, node._se, position)
  21851. );
  21852. }
  21853. break;
  21854. } else if (nw) {
  21855. node = node._nw;
  21856. } else if (ne) {
  21857. node = node._ne;
  21858. } else if (sw) {
  21859. node = node._sw;
  21860. } else if (se) {
  21861. node = node._se;
  21862. } else {
  21863. found = true;
  21864. }
  21865. }
  21866. while (node !== stopNode) {
  21867. const rectangles = node.rectangles;
  21868. for (let i2 = rectangles.length - 1; i2 >= 0 && rectangles[i2].level > maxLevel; --i2) {
  21869. const rectangle = rectangles[i2];
  21870. if (rectangleContainsPosition(rectangle, position)) {
  21871. maxLevel = rectangle.level;
  21872. }
  21873. }
  21874. node = node.parent;
  21875. }
  21876. return maxLevel;
  21877. }
  21878. function updateCoverageWithNode(remainingToCoverByLevel, node, rectanglesToCover) {
  21879. if (!node) {
  21880. return;
  21881. }
  21882. let i2;
  21883. let anyOverlap = false;
  21884. for (i2 = 0; i2 < rectanglesToCover.length; ++i2) {
  21885. anyOverlap = anyOverlap || rectanglesOverlap(node.extent, rectanglesToCover[i2]);
  21886. }
  21887. if (!anyOverlap) {
  21888. return;
  21889. }
  21890. const rectangles = node.rectangles;
  21891. for (i2 = 0; i2 < rectangles.length; ++i2) {
  21892. const rectangle = rectangles[i2];
  21893. if (!remainingToCoverByLevel[rectangle.level]) {
  21894. remainingToCoverByLevel[rectangle.level] = rectanglesToCover;
  21895. }
  21896. remainingToCoverByLevel[rectangle.level] = subtractRectangle(
  21897. remainingToCoverByLevel[rectangle.level],
  21898. rectangle
  21899. );
  21900. }
  21901. updateCoverageWithNode(remainingToCoverByLevel, node._nw, rectanglesToCover);
  21902. updateCoverageWithNode(remainingToCoverByLevel, node._ne, rectanglesToCover);
  21903. updateCoverageWithNode(remainingToCoverByLevel, node._sw, rectanglesToCover);
  21904. updateCoverageWithNode(remainingToCoverByLevel, node._se, rectanglesToCover);
  21905. }
  21906. function subtractRectangle(rectangleList, rectangleToSubtract) {
  21907. const result = [];
  21908. for (let i2 = 0; i2 < rectangleList.length; ++i2) {
  21909. const rectangle = rectangleList[i2];
  21910. if (!rectanglesOverlap(rectangle, rectangleToSubtract)) {
  21911. result.push(rectangle);
  21912. } else {
  21913. if (rectangle.west < rectangleToSubtract.west) {
  21914. result.push(
  21915. new Rectangle_default(
  21916. rectangle.west,
  21917. rectangle.south,
  21918. rectangleToSubtract.west,
  21919. rectangle.north
  21920. )
  21921. );
  21922. }
  21923. if (rectangle.east > rectangleToSubtract.east) {
  21924. result.push(
  21925. new Rectangle_default(
  21926. rectangleToSubtract.east,
  21927. rectangle.south,
  21928. rectangle.east,
  21929. rectangle.north
  21930. )
  21931. );
  21932. }
  21933. if (rectangle.south < rectangleToSubtract.south) {
  21934. result.push(
  21935. new Rectangle_default(
  21936. Math.max(rectangleToSubtract.west, rectangle.west),
  21937. rectangle.south,
  21938. Math.min(rectangleToSubtract.east, rectangle.east),
  21939. rectangleToSubtract.south
  21940. )
  21941. );
  21942. }
  21943. if (rectangle.north > rectangleToSubtract.north) {
  21944. result.push(
  21945. new Rectangle_default(
  21946. Math.max(rectangleToSubtract.west, rectangle.west),
  21947. rectangleToSubtract.north,
  21948. Math.min(rectangleToSubtract.east, rectangle.east),
  21949. rectangle.north
  21950. )
  21951. );
  21952. }
  21953. }
  21954. }
  21955. return result;
  21956. }
  21957. var TileAvailability_default = TileAvailability;
  21958. // node_modules/cesium/Source/Core/formatError.js
  21959. function formatError(object2) {
  21960. let result;
  21961. const name = object2.name;
  21962. const message = object2.message;
  21963. if (defined_default(name) && defined_default(message)) {
  21964. result = `${name}: ${message}`;
  21965. } else {
  21966. result = object2.toString();
  21967. }
  21968. const stack = object2.stack;
  21969. if (defined_default(stack)) {
  21970. result += `
  21971. ${stack}`;
  21972. }
  21973. return result;
  21974. }
  21975. var formatError_default = formatError;
  21976. // node_modules/cesium/Source/Core/TileProviderError.js
  21977. function TileProviderError(provider, message, x, y, level, timesRetried, error) {
  21978. this.provider = provider;
  21979. this.message = message;
  21980. this.x = x;
  21981. this.y = y;
  21982. this.level = level;
  21983. this.timesRetried = defaultValue_default(timesRetried, 0);
  21984. this.retry = false;
  21985. this.error = error;
  21986. }
  21987. TileProviderError.handleError = function(previousError, provider, event, message, x, y, level, retryFunction, errorDetails) {
  21988. let error = previousError;
  21989. if (!defined_default(previousError)) {
  21990. error = new TileProviderError(
  21991. provider,
  21992. message,
  21993. x,
  21994. y,
  21995. level,
  21996. 0,
  21997. errorDetails
  21998. );
  21999. } else {
  22000. error.provider = provider;
  22001. error.message = message;
  22002. error.x = x;
  22003. error.y = y;
  22004. error.level = level;
  22005. error.retry = false;
  22006. error.error = errorDetails;
  22007. ++error.timesRetried;
  22008. }
  22009. if (event.numberOfListeners > 0) {
  22010. event.raiseEvent(error);
  22011. } else {
  22012. console.log(
  22013. `An error occurred in "${provider.constructor.name}": ${formatError_default(
  22014. message
  22015. )}`
  22016. );
  22017. }
  22018. if (error.retry && defined_default(retryFunction)) {
  22019. retryFunction();
  22020. }
  22021. return error;
  22022. };
  22023. TileProviderError.handleSuccess = function(previousError) {
  22024. if (defined_default(previousError)) {
  22025. previousError.timesRetried = -1;
  22026. }
  22027. };
  22028. var TileProviderError_default = TileProviderError;
  22029. // node_modules/cesium/Source/Core/WebMercatorTilingScheme.js
  22030. function WebMercatorTilingScheme(options) {
  22031. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  22032. this._ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  22033. this._numberOfLevelZeroTilesX = defaultValue_default(
  22034. options.numberOfLevelZeroTilesX,
  22035. 1
  22036. );
  22037. this._numberOfLevelZeroTilesY = defaultValue_default(
  22038. options.numberOfLevelZeroTilesY,
  22039. 1
  22040. );
  22041. this._projection = new WebMercatorProjection_default(this._ellipsoid);
  22042. if (defined_default(options.rectangleSouthwestInMeters) && defined_default(options.rectangleNortheastInMeters)) {
  22043. this._rectangleSouthwestInMeters = options.rectangleSouthwestInMeters;
  22044. this._rectangleNortheastInMeters = options.rectangleNortheastInMeters;
  22045. } else {
  22046. const semimajorAxisTimesPi = this._ellipsoid.maximumRadius * Math.PI;
  22047. this._rectangleSouthwestInMeters = new Cartesian2_default(
  22048. -semimajorAxisTimesPi,
  22049. -semimajorAxisTimesPi
  22050. );
  22051. this._rectangleNortheastInMeters = new Cartesian2_default(
  22052. semimajorAxisTimesPi,
  22053. semimajorAxisTimesPi
  22054. );
  22055. }
  22056. const southwest = this._projection.unproject(
  22057. this._rectangleSouthwestInMeters
  22058. );
  22059. const northeast = this._projection.unproject(
  22060. this._rectangleNortheastInMeters
  22061. );
  22062. this._rectangle = new Rectangle_default(
  22063. southwest.longitude,
  22064. southwest.latitude,
  22065. northeast.longitude,
  22066. northeast.latitude
  22067. );
  22068. }
  22069. Object.defineProperties(WebMercatorTilingScheme.prototype, {
  22070. ellipsoid: {
  22071. get: function() {
  22072. return this._ellipsoid;
  22073. }
  22074. },
  22075. rectangle: {
  22076. get: function() {
  22077. return this._rectangle;
  22078. }
  22079. },
  22080. projection: {
  22081. get: function() {
  22082. return this._projection;
  22083. }
  22084. }
  22085. });
  22086. WebMercatorTilingScheme.prototype.getNumberOfXTilesAtLevel = function(level) {
  22087. return this._numberOfLevelZeroTilesX << level;
  22088. };
  22089. WebMercatorTilingScheme.prototype.getNumberOfYTilesAtLevel = function(level) {
  22090. return this._numberOfLevelZeroTilesY << level;
  22091. };
  22092. WebMercatorTilingScheme.prototype.rectangleToNativeRectangle = function(rectangle, result) {
  22093. const projection = this._projection;
  22094. const southwest = projection.project(Rectangle_default.southwest(rectangle));
  22095. const northeast = projection.project(Rectangle_default.northeast(rectangle));
  22096. if (!defined_default(result)) {
  22097. return new Rectangle_default(southwest.x, southwest.y, northeast.x, northeast.y);
  22098. }
  22099. result.west = southwest.x;
  22100. result.south = southwest.y;
  22101. result.east = northeast.x;
  22102. result.north = northeast.y;
  22103. return result;
  22104. };
  22105. WebMercatorTilingScheme.prototype.tileXYToNativeRectangle = function(x, y, level, result) {
  22106. const xTiles = this.getNumberOfXTilesAtLevel(level);
  22107. const yTiles = this.getNumberOfYTilesAtLevel(level);
  22108. const xTileWidth = (this._rectangleNortheastInMeters.x - this._rectangleSouthwestInMeters.x) / xTiles;
  22109. const west = this._rectangleSouthwestInMeters.x + x * xTileWidth;
  22110. const east = this._rectangleSouthwestInMeters.x + (x + 1) * xTileWidth;
  22111. const yTileHeight = (this._rectangleNortheastInMeters.y - this._rectangleSouthwestInMeters.y) / yTiles;
  22112. const north = this._rectangleNortheastInMeters.y - y * yTileHeight;
  22113. const south = this._rectangleNortheastInMeters.y - (y + 1) * yTileHeight;
  22114. if (!defined_default(result)) {
  22115. return new Rectangle_default(west, south, east, north);
  22116. }
  22117. result.west = west;
  22118. result.south = south;
  22119. result.east = east;
  22120. result.north = north;
  22121. return result;
  22122. };
  22123. WebMercatorTilingScheme.prototype.tileXYToRectangle = function(x, y, level, result) {
  22124. const nativeRectangle = this.tileXYToNativeRectangle(x, y, level, result);
  22125. const projection = this._projection;
  22126. const southwest = projection.unproject(
  22127. new Cartesian2_default(nativeRectangle.west, nativeRectangle.south)
  22128. );
  22129. const northeast = projection.unproject(
  22130. new Cartesian2_default(nativeRectangle.east, nativeRectangle.north)
  22131. );
  22132. nativeRectangle.west = southwest.longitude;
  22133. nativeRectangle.south = southwest.latitude;
  22134. nativeRectangle.east = northeast.longitude;
  22135. nativeRectangle.north = northeast.latitude;
  22136. return nativeRectangle;
  22137. };
  22138. WebMercatorTilingScheme.prototype.positionToTileXY = function(position, level, result) {
  22139. const rectangle = this._rectangle;
  22140. if (!Rectangle_default.contains(rectangle, position)) {
  22141. return void 0;
  22142. }
  22143. const xTiles = this.getNumberOfXTilesAtLevel(level);
  22144. const yTiles = this.getNumberOfYTilesAtLevel(level);
  22145. const overallWidth = this._rectangleNortheastInMeters.x - this._rectangleSouthwestInMeters.x;
  22146. const xTileWidth = overallWidth / xTiles;
  22147. const overallHeight = this._rectangleNortheastInMeters.y - this._rectangleSouthwestInMeters.y;
  22148. const yTileHeight = overallHeight / yTiles;
  22149. const projection = this._projection;
  22150. const webMercatorPosition = projection.project(position);
  22151. const distanceFromWest = webMercatorPosition.x - this._rectangleSouthwestInMeters.x;
  22152. const distanceFromNorth = this._rectangleNortheastInMeters.y - webMercatorPosition.y;
  22153. let xTileCoordinate = distanceFromWest / xTileWidth | 0;
  22154. if (xTileCoordinate >= xTiles) {
  22155. xTileCoordinate = xTiles - 1;
  22156. }
  22157. let yTileCoordinate = distanceFromNorth / yTileHeight | 0;
  22158. if (yTileCoordinate >= yTiles) {
  22159. yTileCoordinate = yTiles - 1;
  22160. }
  22161. if (!defined_default(result)) {
  22162. return new Cartesian2_default(xTileCoordinate, yTileCoordinate);
  22163. }
  22164. result.x = xTileCoordinate;
  22165. result.y = yTileCoordinate;
  22166. return result;
  22167. };
  22168. var WebMercatorTilingScheme_default = WebMercatorTilingScheme;
  22169. // node_modules/cesium/Source/Core/ArcGISTiledElevationTerrainProvider.js
  22170. var ALL_CHILDREN = 15;
  22171. function ArcGISTiledElevationTerrainProvider(options) {
  22172. if (!defined_default(options) || !defined_default(options.url)) {
  22173. throw new DeveloperError_default("options.url is required.");
  22174. }
  22175. this._resource = void 0;
  22176. this._credit = void 0;
  22177. this._tilingScheme = void 0;
  22178. this._levelZeroMaximumGeometricError = void 0;
  22179. this._maxLevel = void 0;
  22180. this._terrainDataStructure = void 0;
  22181. this._ready = false;
  22182. this._width = void 0;
  22183. this._height = void 0;
  22184. this._encoding = void 0;
  22185. const token = options.token;
  22186. this._hasAvailability = false;
  22187. this._tilesAvailable = void 0;
  22188. this._tilesAvailablityLoaded = void 0;
  22189. this._availableCache = {};
  22190. const that = this;
  22191. const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  22192. this._readyPromise = Promise.resolve(options.url).then(function(url2) {
  22193. let resource = Resource_default.createIfNeeded(url2);
  22194. resource.appendForwardSlash();
  22195. if (defined_default(token)) {
  22196. resource = resource.getDerivedResource({
  22197. queryParameters: {
  22198. token
  22199. }
  22200. });
  22201. }
  22202. that._resource = resource;
  22203. const metadataResource = resource.getDerivedResource({
  22204. queryParameters: {
  22205. f: "pjson"
  22206. }
  22207. });
  22208. return metadataResource.fetchJson();
  22209. }).then(function(metadata) {
  22210. const copyrightText = metadata.copyrightText;
  22211. if (defined_default(copyrightText)) {
  22212. that._credit = new Credit_default(copyrightText);
  22213. }
  22214. const spatialReference = metadata.spatialReference;
  22215. const wkid = defaultValue_default(
  22216. spatialReference.latestWkid,
  22217. spatialReference.wkid
  22218. );
  22219. const extent = metadata.extent;
  22220. const tilingSchemeOptions = {
  22221. ellipsoid
  22222. };
  22223. if (wkid === 4326) {
  22224. tilingSchemeOptions.rectangle = Rectangle_default.fromDegrees(
  22225. extent.xmin,
  22226. extent.ymin,
  22227. extent.xmax,
  22228. extent.ymax
  22229. );
  22230. that._tilingScheme = new GeographicTilingScheme_default(tilingSchemeOptions);
  22231. } else if (wkid === 3857) {
  22232. tilingSchemeOptions.rectangleSouthwestInMeters = new Cartesian2_default(
  22233. extent.xmin,
  22234. extent.ymin
  22235. );
  22236. tilingSchemeOptions.rectangleNortheastInMeters = new Cartesian2_default(
  22237. extent.xmax,
  22238. extent.ymax
  22239. );
  22240. that._tilingScheme = new WebMercatorTilingScheme_default(tilingSchemeOptions);
  22241. } else {
  22242. return Promise.reject(new RuntimeError_default("Invalid spatial reference"));
  22243. }
  22244. const tileInfo = metadata.tileInfo;
  22245. if (!defined_default(tileInfo)) {
  22246. return Promise.reject(new RuntimeError_default("tileInfo is required"));
  22247. }
  22248. that._width = tileInfo.rows + 1;
  22249. that._height = tileInfo.cols + 1;
  22250. that._encoding = tileInfo.format === "LERC" ? HeightmapEncoding_default.LERC : HeightmapEncoding_default.NONE;
  22251. that._lodCount = tileInfo.lods.length - 1;
  22252. const hasAvailability = that._hasAvailability = metadata.capabilities.indexOf("Tilemap") !== -1;
  22253. if (hasAvailability) {
  22254. that._tilesAvailable = new TileAvailability_default(
  22255. that._tilingScheme,
  22256. that._lodCount
  22257. );
  22258. that._tilesAvailable.addAvailableTileRange(
  22259. 0,
  22260. 0,
  22261. 0,
  22262. that._tilingScheme.getNumberOfXTilesAtLevel(0),
  22263. that._tilingScheme.getNumberOfYTilesAtLevel(0)
  22264. );
  22265. that._tilesAvailablityLoaded = new TileAvailability_default(
  22266. that._tilingScheme,
  22267. that._lodCount
  22268. );
  22269. }
  22270. that._levelZeroMaximumGeometricError = TerrainProvider_default.getEstimatedLevelZeroGeometricErrorForAHeightmap(
  22271. that._tilingScheme.ellipsoid,
  22272. that._width,
  22273. that._tilingScheme.getNumberOfXTilesAtLevel(0)
  22274. );
  22275. if (metadata.bandCount > 1) {
  22276. console.log(
  22277. "ArcGISTiledElevationTerrainProvider: Terrain data has more than 1 band. Using the first one."
  22278. );
  22279. }
  22280. that._terrainDataStructure = {
  22281. elementMultiplier: 1,
  22282. lowestEncodedHeight: metadata.minValues[0],
  22283. highestEncodedHeight: metadata.maxValues[0]
  22284. };
  22285. that._ready = true;
  22286. return true;
  22287. }).catch(function(error) {
  22288. const message = `An error occurred while accessing ${that._resource.url}.`;
  22289. TileProviderError_default.handleError(void 0, that, that._errorEvent, message);
  22290. return Promise.reject(error);
  22291. });
  22292. this._errorEvent = new Event_default();
  22293. }
  22294. Object.defineProperties(ArcGISTiledElevationTerrainProvider.prototype, {
  22295. errorEvent: {
  22296. get: function() {
  22297. return this._errorEvent;
  22298. }
  22299. },
  22300. credit: {
  22301. get: function() {
  22302. if (!this.ready) {
  22303. throw new DeveloperError_default(
  22304. "credit must not be called before ready returns true."
  22305. );
  22306. }
  22307. return this._credit;
  22308. }
  22309. },
  22310. tilingScheme: {
  22311. get: function() {
  22312. if (!this.ready) {
  22313. throw new DeveloperError_default(
  22314. "tilingScheme must not be called before ready returns true."
  22315. );
  22316. }
  22317. return this._tilingScheme;
  22318. }
  22319. },
  22320. ready: {
  22321. get: function() {
  22322. return this._ready;
  22323. }
  22324. },
  22325. readyPromise: {
  22326. get: function() {
  22327. return this._readyPromise;
  22328. }
  22329. },
  22330. hasWaterMask: {
  22331. get: function() {
  22332. return false;
  22333. }
  22334. },
  22335. hasVertexNormals: {
  22336. get: function() {
  22337. return false;
  22338. }
  22339. },
  22340. availability: {
  22341. get: function() {
  22342. if (!this._ready) {
  22343. throw new DeveloperError_default(
  22344. "availability must not be called before the terrain provider is ready."
  22345. );
  22346. }
  22347. return this._tilesAvailable;
  22348. }
  22349. }
  22350. });
  22351. ArcGISTiledElevationTerrainProvider.prototype.requestTileGeometry = function(x, y, level, request) {
  22352. if (!this._ready) {
  22353. throw new DeveloperError_default(
  22354. "requestTileGeometry must not be called before the terrain provider is ready."
  22355. );
  22356. }
  22357. const tileResource = this._resource.getDerivedResource({
  22358. url: `tile/${level}/${y}/${x}`,
  22359. request
  22360. });
  22361. const hasAvailability = this._hasAvailability;
  22362. let availabilityPromise = Promise.resolve(true);
  22363. let availabilityRequest;
  22364. if (hasAvailability && !defined_default(isTileAvailable(this, level + 1, x * 2, y * 2))) {
  22365. const availabilityResult = requestAvailability(
  22366. this,
  22367. level + 1,
  22368. x * 2,
  22369. y * 2
  22370. );
  22371. availabilityPromise = availabilityResult.promise;
  22372. availabilityRequest = availabilityResult.request;
  22373. }
  22374. const promise = tileResource.fetchArrayBuffer();
  22375. if (!defined_default(promise) || !defined_default(availabilityPromise)) {
  22376. return void 0;
  22377. }
  22378. const that = this;
  22379. const tilesAvailable = this._tilesAvailable;
  22380. return Promise.all([promise, availabilityPromise]).then(function(result) {
  22381. return new HeightmapTerrainData_default({
  22382. buffer: result[0],
  22383. width: that._width,
  22384. height: that._height,
  22385. childTileMask: hasAvailability ? tilesAvailable.computeChildMaskForTile(level, x, y) : ALL_CHILDREN,
  22386. structure: that._terrainDataStructure,
  22387. encoding: that._encoding
  22388. });
  22389. }).catch(function(error) {
  22390. if (defined_default(availabilityRequest) && availabilityRequest.state === RequestState_default.CANCELLED) {
  22391. request.cancel();
  22392. return request.deferred.promise.finally(function() {
  22393. request.state = RequestState_default.CANCELLED;
  22394. return Promise.reject(error);
  22395. });
  22396. }
  22397. return Promise.reject(error);
  22398. });
  22399. };
  22400. function isTileAvailable(that, level, x, y) {
  22401. if (!that._hasAvailability) {
  22402. return void 0;
  22403. }
  22404. const tilesAvailablityLoaded = that._tilesAvailablityLoaded;
  22405. const tilesAvailable = that._tilesAvailable;
  22406. if (level > that._lodCount) {
  22407. return false;
  22408. }
  22409. if (tilesAvailable.isTileAvailable(level, x, y)) {
  22410. return true;
  22411. }
  22412. if (tilesAvailablityLoaded.isTileAvailable(level, x, y)) {
  22413. return false;
  22414. }
  22415. return void 0;
  22416. }
  22417. ArcGISTiledElevationTerrainProvider.prototype.getLevelMaximumGeometricError = function(level) {
  22418. if (!this.ready) {
  22419. throw new DeveloperError_default(
  22420. "getLevelMaximumGeometricError must not be called before ready returns true."
  22421. );
  22422. }
  22423. return this._levelZeroMaximumGeometricError / (1 << level);
  22424. };
  22425. ArcGISTiledElevationTerrainProvider.prototype.getTileDataAvailable = function(x, y, level) {
  22426. if (!this._hasAvailability) {
  22427. return void 0;
  22428. }
  22429. const result = isTileAvailable(this, level, x, y);
  22430. if (defined_default(result)) {
  22431. return result;
  22432. }
  22433. requestAvailability(this, level, x, y);
  22434. return void 0;
  22435. };
  22436. ArcGISTiledElevationTerrainProvider.prototype.loadTileDataAvailability = function(x, y, level) {
  22437. return void 0;
  22438. };
  22439. function findRange(origin, width, height, data) {
  22440. const endCol = width - 1;
  22441. const endRow = height - 1;
  22442. const value = data[origin.y * width + origin.x];
  22443. const endingIndices = [];
  22444. const range2 = {
  22445. startX: origin.x,
  22446. startY: origin.y,
  22447. endX: 0,
  22448. endY: 0
  22449. };
  22450. const corner = new Cartesian2_default(origin.x + 1, origin.y + 1);
  22451. let doneX = false;
  22452. let doneY = false;
  22453. while (!(doneX && doneY)) {
  22454. let endX = corner.x;
  22455. const endY = doneY ? corner.y + 1 : corner.y;
  22456. if (!doneX) {
  22457. for (let y = origin.y; y < endY; ++y) {
  22458. if (data[y * width + corner.x] !== value) {
  22459. doneX = true;
  22460. break;
  22461. }
  22462. }
  22463. if (doneX) {
  22464. endingIndices.push(new Cartesian2_default(corner.x, origin.y));
  22465. --corner.x;
  22466. --endX;
  22467. range2.endX = corner.x;
  22468. } else if (corner.x === endCol) {
  22469. range2.endX = corner.x;
  22470. doneX = true;
  22471. } else {
  22472. ++corner.x;
  22473. }
  22474. }
  22475. if (!doneY) {
  22476. const col = corner.y * width;
  22477. for (let x = origin.x; x <= endX; ++x) {
  22478. if (data[col + x] !== value) {
  22479. doneY = true;
  22480. break;
  22481. }
  22482. }
  22483. if (doneY) {
  22484. endingIndices.push(new Cartesian2_default(origin.x, corner.y));
  22485. --corner.y;
  22486. range2.endY = corner.y;
  22487. } else if (corner.y === endRow) {
  22488. range2.endY = corner.y;
  22489. doneY = true;
  22490. } else {
  22491. ++corner.y;
  22492. }
  22493. }
  22494. }
  22495. return {
  22496. endingIndices,
  22497. range: range2,
  22498. value
  22499. };
  22500. }
  22501. function computeAvailability(x, y, width, height, data) {
  22502. const ranges = [];
  22503. const singleValue = data.every(function(val) {
  22504. return val === data[0];
  22505. });
  22506. if (singleValue) {
  22507. if (data[0] === 1) {
  22508. ranges.push({
  22509. startX: x,
  22510. startY: y,
  22511. endX: x + width - 1,
  22512. endY: y + height - 1
  22513. });
  22514. }
  22515. return ranges;
  22516. }
  22517. let positions = [new Cartesian2_default(0, 0)];
  22518. while (positions.length > 0) {
  22519. const origin = positions.pop();
  22520. const result = findRange(origin, width, height, data);
  22521. if (result.value === 1) {
  22522. const range2 = result.range;
  22523. range2.startX += x;
  22524. range2.endX += x;
  22525. range2.startY += y;
  22526. range2.endY += y;
  22527. ranges.push(range2);
  22528. }
  22529. const endingIndices = result.endingIndices;
  22530. if (endingIndices.length > 0) {
  22531. positions = positions.concat(endingIndices);
  22532. }
  22533. }
  22534. return ranges;
  22535. }
  22536. function requestAvailability(that, level, x, y) {
  22537. if (!that._hasAvailability) {
  22538. return {};
  22539. }
  22540. const xOffset = Math.floor(x / 128) * 128;
  22541. const yOffset = Math.floor(y / 128) * 128;
  22542. const dim = Math.min(1 << level, 128);
  22543. const url2 = `tilemap/${level}/${yOffset}/${xOffset}/${dim}/${dim}`;
  22544. const availableCache = that._availableCache;
  22545. if (defined_default(availableCache[url2])) {
  22546. return availableCache[url2];
  22547. }
  22548. const request = new Request_default({
  22549. throttle: false,
  22550. throttleByServer: true,
  22551. type: RequestType_default.TERRAIN
  22552. });
  22553. const tilemapResource = that._resource.getDerivedResource({
  22554. url: url2,
  22555. request
  22556. });
  22557. let promise = tilemapResource.fetchJson();
  22558. if (!defined_default(promise)) {
  22559. return {};
  22560. }
  22561. promise = promise.then(function(result) {
  22562. const available = computeAvailability(
  22563. xOffset,
  22564. yOffset,
  22565. dim,
  22566. dim,
  22567. result.data
  22568. );
  22569. that._tilesAvailablityLoaded.addAvailableTileRange(
  22570. level,
  22571. xOffset,
  22572. yOffset,
  22573. xOffset + dim,
  22574. yOffset + dim
  22575. );
  22576. const tilesAvailable = that._tilesAvailable;
  22577. for (let i2 = 0; i2 < available.length; ++i2) {
  22578. const range2 = available[i2];
  22579. tilesAvailable.addAvailableTileRange(
  22580. level,
  22581. range2.startX,
  22582. range2.startY,
  22583. range2.endX,
  22584. range2.endY
  22585. );
  22586. }
  22587. return isTileAvailable(that, level, x, y);
  22588. });
  22589. availableCache[url2] = {
  22590. promise,
  22591. request
  22592. };
  22593. promise = promise.finally(function(result) {
  22594. delete availableCache[url2];
  22595. return result;
  22596. });
  22597. return {
  22598. promise,
  22599. request
  22600. };
  22601. }
  22602. var ArcGISTiledElevationTerrainProvider_default = ArcGISTiledElevationTerrainProvider;
  22603. // node_modules/cesium/Source/Core/ArcType.js
  22604. var ArcType = {
  22605. NONE: 0,
  22606. GEODESIC: 1,
  22607. RHUMB: 2
  22608. };
  22609. var ArcType_default = Object.freeze(ArcType);
  22610. // node_modules/cesium/Source/Core/AssociativeArray.js
  22611. function AssociativeArray() {
  22612. this._array = [];
  22613. this._hash = {};
  22614. }
  22615. Object.defineProperties(AssociativeArray.prototype, {
  22616. length: {
  22617. get: function() {
  22618. return this._array.length;
  22619. }
  22620. },
  22621. values: {
  22622. get: function() {
  22623. return this._array;
  22624. }
  22625. }
  22626. });
  22627. AssociativeArray.prototype.contains = function(key) {
  22628. if (typeof key !== "string" && typeof key !== "number") {
  22629. throw new DeveloperError_default("key is required to be a string or number.");
  22630. }
  22631. return defined_default(this._hash[key]);
  22632. };
  22633. AssociativeArray.prototype.set = function(key, value) {
  22634. if (typeof key !== "string" && typeof key !== "number") {
  22635. throw new DeveloperError_default("key is required to be a string or number.");
  22636. }
  22637. const oldValue2 = this._hash[key];
  22638. if (value !== oldValue2) {
  22639. this.remove(key);
  22640. this._hash[key] = value;
  22641. this._array.push(value);
  22642. }
  22643. };
  22644. AssociativeArray.prototype.get = function(key) {
  22645. if (typeof key !== "string" && typeof key !== "number") {
  22646. throw new DeveloperError_default("key is required to be a string or number.");
  22647. }
  22648. return this._hash[key];
  22649. };
  22650. AssociativeArray.prototype.remove = function(key) {
  22651. if (defined_default(key) && typeof key !== "string" && typeof key !== "number") {
  22652. throw new DeveloperError_default("key is required to be a string or number.");
  22653. }
  22654. const value = this._hash[key];
  22655. const hasValue = defined_default(value);
  22656. if (hasValue) {
  22657. const array = this._array;
  22658. array.splice(array.indexOf(value), 1);
  22659. delete this._hash[key];
  22660. }
  22661. return hasValue;
  22662. };
  22663. AssociativeArray.prototype.removeAll = function() {
  22664. const array = this._array;
  22665. if (array.length > 0) {
  22666. this._hash = {};
  22667. array.length = 0;
  22668. }
  22669. };
  22670. var AssociativeArray_default = AssociativeArray;
  22671. // node_modules/cesium/Source/Core/BingMapsGeocoderService.js
  22672. var url = "https://dev.virtualearth.net/REST/v1/Locations";
  22673. function BingMapsGeocoderService(options) {
  22674. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  22675. const key = options.key;
  22676. if (!defined_default(key)) {
  22677. throw new DeveloperError_default("options.key is required.");
  22678. }
  22679. this._key = key;
  22680. const queryParameters = {
  22681. key
  22682. };
  22683. if (defined_default(options.culture)) {
  22684. queryParameters.culture = options.culture;
  22685. }
  22686. this._resource = new Resource_default({
  22687. url,
  22688. queryParameters
  22689. });
  22690. }
  22691. Object.defineProperties(BingMapsGeocoderService.prototype, {
  22692. url: {
  22693. get: function() {
  22694. return url;
  22695. }
  22696. },
  22697. key: {
  22698. get: function() {
  22699. return this._key;
  22700. }
  22701. }
  22702. });
  22703. BingMapsGeocoderService.prototype.geocode = function(query) {
  22704. Check_default.typeOf.string("query", query);
  22705. const resource = this._resource.getDerivedResource({
  22706. queryParameters: {
  22707. query
  22708. }
  22709. });
  22710. return resource.fetchJsonp("jsonp").then(function(result) {
  22711. if (result.resourceSets.length === 0) {
  22712. return [];
  22713. }
  22714. const results = result.resourceSets[0].resources;
  22715. return results.map(function(resource2) {
  22716. const bbox2 = resource2.bbox;
  22717. const south = bbox2[0];
  22718. const west = bbox2[1];
  22719. const north = bbox2[2];
  22720. const east = bbox2[3];
  22721. return {
  22722. displayName: resource2.name,
  22723. destination: Rectangle_default.fromDegrees(west, south, east, north)
  22724. };
  22725. });
  22726. });
  22727. };
  22728. var BingMapsGeocoderService_default = BingMapsGeocoderService;
  22729. // node_modules/cesium/Source/Core/BoundingRectangle.js
  22730. function BoundingRectangle(x, y, width, height) {
  22731. this.x = defaultValue_default(x, 0);
  22732. this.y = defaultValue_default(y, 0);
  22733. this.width = defaultValue_default(width, 0);
  22734. this.height = defaultValue_default(height, 0);
  22735. }
  22736. BoundingRectangle.packedLength = 4;
  22737. BoundingRectangle.pack = function(value, array, startingIndex) {
  22738. Check_default.typeOf.object("value", value);
  22739. Check_default.defined("array", array);
  22740. startingIndex = defaultValue_default(startingIndex, 0);
  22741. array[startingIndex++] = value.x;
  22742. array[startingIndex++] = value.y;
  22743. array[startingIndex++] = value.width;
  22744. array[startingIndex] = value.height;
  22745. return array;
  22746. };
  22747. BoundingRectangle.unpack = function(array, startingIndex, result) {
  22748. Check_default.defined("array", array);
  22749. startingIndex = defaultValue_default(startingIndex, 0);
  22750. if (!defined_default(result)) {
  22751. result = new BoundingRectangle();
  22752. }
  22753. result.x = array[startingIndex++];
  22754. result.y = array[startingIndex++];
  22755. result.width = array[startingIndex++];
  22756. result.height = array[startingIndex];
  22757. return result;
  22758. };
  22759. BoundingRectangle.fromPoints = function(positions, result) {
  22760. if (!defined_default(result)) {
  22761. result = new BoundingRectangle();
  22762. }
  22763. if (!defined_default(positions) || positions.length === 0) {
  22764. result.x = 0;
  22765. result.y = 0;
  22766. result.width = 0;
  22767. result.height = 0;
  22768. return result;
  22769. }
  22770. const length3 = positions.length;
  22771. let minimumX = positions[0].x;
  22772. let minimumY = positions[0].y;
  22773. let maximumX = positions[0].x;
  22774. let maximumY = positions[0].y;
  22775. for (let i2 = 1; i2 < length3; i2++) {
  22776. const p2 = positions[i2];
  22777. const x = p2.x;
  22778. const y = p2.y;
  22779. minimumX = Math.min(x, minimumX);
  22780. maximumX = Math.max(x, maximumX);
  22781. minimumY = Math.min(y, minimumY);
  22782. maximumY = Math.max(y, maximumY);
  22783. }
  22784. result.x = minimumX;
  22785. result.y = minimumY;
  22786. result.width = maximumX - minimumX;
  22787. result.height = maximumY - minimumY;
  22788. return result;
  22789. };
  22790. var defaultProjection2 = new GeographicProjection_default();
  22791. var fromRectangleLowerLeft = new Cartographic_default();
  22792. var fromRectangleUpperRight = new Cartographic_default();
  22793. BoundingRectangle.fromRectangle = function(rectangle, projection, result) {
  22794. if (!defined_default(result)) {
  22795. result = new BoundingRectangle();
  22796. }
  22797. if (!defined_default(rectangle)) {
  22798. result.x = 0;
  22799. result.y = 0;
  22800. result.width = 0;
  22801. result.height = 0;
  22802. return result;
  22803. }
  22804. projection = defaultValue_default(projection, defaultProjection2);
  22805. const lowerLeft = projection.project(
  22806. Rectangle_default.southwest(rectangle, fromRectangleLowerLeft)
  22807. );
  22808. const upperRight = projection.project(
  22809. Rectangle_default.northeast(rectangle, fromRectangleUpperRight)
  22810. );
  22811. Cartesian2_default.subtract(upperRight, lowerLeft, upperRight);
  22812. result.x = lowerLeft.x;
  22813. result.y = lowerLeft.y;
  22814. result.width = upperRight.x;
  22815. result.height = upperRight.y;
  22816. return result;
  22817. };
  22818. BoundingRectangle.clone = function(rectangle, result) {
  22819. if (!defined_default(rectangle)) {
  22820. return void 0;
  22821. }
  22822. if (!defined_default(result)) {
  22823. return new BoundingRectangle(
  22824. rectangle.x,
  22825. rectangle.y,
  22826. rectangle.width,
  22827. rectangle.height
  22828. );
  22829. }
  22830. result.x = rectangle.x;
  22831. result.y = rectangle.y;
  22832. result.width = rectangle.width;
  22833. result.height = rectangle.height;
  22834. return result;
  22835. };
  22836. BoundingRectangle.union = function(left, right, result) {
  22837. Check_default.typeOf.object("left", left);
  22838. Check_default.typeOf.object("right", right);
  22839. if (!defined_default(result)) {
  22840. result = new BoundingRectangle();
  22841. }
  22842. const lowerLeftX = Math.min(left.x, right.x);
  22843. const lowerLeftY = Math.min(left.y, right.y);
  22844. const upperRightX = Math.max(left.x + left.width, right.x + right.width);
  22845. const upperRightY = Math.max(left.y + left.height, right.y + right.height);
  22846. result.x = lowerLeftX;
  22847. result.y = lowerLeftY;
  22848. result.width = upperRightX - lowerLeftX;
  22849. result.height = upperRightY - lowerLeftY;
  22850. return result;
  22851. };
  22852. BoundingRectangle.expand = function(rectangle, point, result) {
  22853. Check_default.typeOf.object("rectangle", rectangle);
  22854. Check_default.typeOf.object("point", point);
  22855. result = BoundingRectangle.clone(rectangle, result);
  22856. const width = point.x - result.x;
  22857. const height = point.y - result.y;
  22858. if (width > result.width) {
  22859. result.width = width;
  22860. } else if (width < 0) {
  22861. result.width -= width;
  22862. result.x = point.x;
  22863. }
  22864. if (height > result.height) {
  22865. result.height = height;
  22866. } else if (height < 0) {
  22867. result.height -= height;
  22868. result.y = point.y;
  22869. }
  22870. return result;
  22871. };
  22872. BoundingRectangle.intersect = function(left, right) {
  22873. Check_default.typeOf.object("left", left);
  22874. Check_default.typeOf.object("right", right);
  22875. const leftX = left.x;
  22876. const leftY = left.y;
  22877. const rightX = right.x;
  22878. const rightY = right.y;
  22879. if (!(leftX > rightX + right.width || leftX + left.width < rightX || leftY + left.height < rightY || leftY > rightY + right.height)) {
  22880. return Intersect_default.INTERSECTING;
  22881. }
  22882. return Intersect_default.OUTSIDE;
  22883. };
  22884. BoundingRectangle.equals = function(left, right) {
  22885. return left === right || defined_default(left) && defined_default(right) && left.x === right.x && left.y === right.y && left.width === right.width && left.height === right.height;
  22886. };
  22887. BoundingRectangle.prototype.clone = function(result) {
  22888. return BoundingRectangle.clone(this, result);
  22889. };
  22890. BoundingRectangle.prototype.intersect = function(right) {
  22891. return BoundingRectangle.intersect(this, right);
  22892. };
  22893. BoundingRectangle.prototype.equals = function(right) {
  22894. return BoundingRectangle.equals(this, right);
  22895. };
  22896. var BoundingRectangle_default = BoundingRectangle;
  22897. // node_modules/cesium/Source/Core/arrayFill.js
  22898. function arrayFill(array, value, start, end) {
  22899. Check_default.defined("array", array);
  22900. Check_default.defined("value", value);
  22901. if (defined_default(start)) {
  22902. Check_default.typeOf.number("start", start);
  22903. }
  22904. if (defined_default(end)) {
  22905. Check_default.typeOf.number("end", end);
  22906. }
  22907. if (typeof array.fill === "function") {
  22908. return array.fill(value, start, end);
  22909. }
  22910. const length3 = array.length >>> 0;
  22911. const relativeStart = defaultValue_default(start, 0);
  22912. let k = relativeStart < 0 ? Math.max(length3 + relativeStart, 0) : Math.min(relativeStart, length3);
  22913. const relativeEnd = defaultValue_default(end, length3);
  22914. const last = relativeEnd < 0 ? Math.max(length3 + relativeEnd, 0) : Math.min(relativeEnd, length3);
  22915. while (k < last) {
  22916. array[k] = value;
  22917. k++;
  22918. }
  22919. return array;
  22920. }
  22921. var arrayFill_default = arrayFill;
  22922. // node_modules/cesium/Source/Core/GeometryType.js
  22923. var GeometryType = {
  22924. NONE: 0,
  22925. TRIANGLES: 1,
  22926. LINES: 2,
  22927. POLYLINES: 3
  22928. };
  22929. var GeometryType_default = Object.freeze(GeometryType);
  22930. // node_modules/cesium/Source/Core/PrimitiveType.js
  22931. var PrimitiveType = {
  22932. POINTS: WebGLConstants_default.POINTS,
  22933. LINES: WebGLConstants_default.LINES,
  22934. LINE_LOOP: WebGLConstants_default.LINE_LOOP,
  22935. LINE_STRIP: WebGLConstants_default.LINE_STRIP,
  22936. TRIANGLES: WebGLConstants_default.TRIANGLES,
  22937. TRIANGLE_STRIP: WebGLConstants_default.TRIANGLE_STRIP,
  22938. TRIANGLE_FAN: WebGLConstants_default.TRIANGLE_FAN
  22939. };
  22940. PrimitiveType.isLines = function(primitiveType) {
  22941. return primitiveType === PrimitiveType.LINES || primitiveType === PrimitiveType.LINE_LOOP || primitiveType === PrimitiveType.LINE_STRIP;
  22942. };
  22943. PrimitiveType.isTriangles = function(primitiveType) {
  22944. return primitiveType === PrimitiveType.TRIANGLES || primitiveType === PrimitiveType.TRIANGLE_STRIP || primitiveType === PrimitiveType.TRIANGLE_FAN;
  22945. };
  22946. PrimitiveType.validate = function(primitiveType) {
  22947. return primitiveType === PrimitiveType.POINTS || primitiveType === PrimitiveType.LINES || primitiveType === PrimitiveType.LINE_LOOP || primitiveType === PrimitiveType.LINE_STRIP || primitiveType === PrimitiveType.TRIANGLES || primitiveType === PrimitiveType.TRIANGLE_STRIP || primitiveType === PrimitiveType.TRIANGLE_FAN;
  22948. };
  22949. var PrimitiveType_default = Object.freeze(PrimitiveType);
  22950. // node_modules/cesium/Source/Core/Geometry.js
  22951. function Geometry(options) {
  22952. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  22953. Check_default.typeOf.object("options.attributes", options.attributes);
  22954. this.attributes = options.attributes;
  22955. this.indices = options.indices;
  22956. this.primitiveType = defaultValue_default(
  22957. options.primitiveType,
  22958. PrimitiveType_default.TRIANGLES
  22959. );
  22960. this.boundingSphere = options.boundingSphere;
  22961. this.geometryType = defaultValue_default(options.geometryType, GeometryType_default.NONE);
  22962. this.boundingSphereCV = options.boundingSphereCV;
  22963. this.offsetAttribute = options.offsetAttribute;
  22964. }
  22965. Geometry.computeNumberOfVertices = function(geometry) {
  22966. Check_default.typeOf.object("geometry", geometry);
  22967. let numberOfVertices = -1;
  22968. for (const property in geometry.attributes) {
  22969. if (geometry.attributes.hasOwnProperty(property) && defined_default(geometry.attributes[property]) && defined_default(geometry.attributes[property].values)) {
  22970. const attribute = geometry.attributes[property];
  22971. const num = attribute.values.length / attribute.componentsPerAttribute;
  22972. if (numberOfVertices !== num && numberOfVertices !== -1) {
  22973. throw new DeveloperError_default(
  22974. "All attribute lists must have the same number of attributes."
  22975. );
  22976. }
  22977. numberOfVertices = num;
  22978. }
  22979. }
  22980. return numberOfVertices;
  22981. };
  22982. var rectangleCenterScratch = new Cartographic_default();
  22983. var enuCenterScratch = new Cartesian3_default();
  22984. var fixedFrameToEnuScratch = new Matrix4_default();
  22985. var boundingRectanglePointsCartographicScratch = [
  22986. new Cartographic_default(),
  22987. new Cartographic_default(),
  22988. new Cartographic_default()
  22989. ];
  22990. var boundingRectanglePointsEnuScratch = [
  22991. new Cartesian2_default(),
  22992. new Cartesian2_default(),
  22993. new Cartesian2_default()
  22994. ];
  22995. var points2DScratch = [new Cartesian2_default(), new Cartesian2_default(), new Cartesian2_default()];
  22996. var pointEnuScratch = new Cartesian3_default();
  22997. var enuRotationScratch = new Quaternion_default();
  22998. var enuRotationMatrixScratch = new Matrix4_default();
  22999. var rotation2DScratch = new Matrix2_default();
  23000. Geometry._textureCoordinateRotationPoints = function(positions, stRotation, ellipsoid, boundingRectangle) {
  23001. let i2;
  23002. const rectangleCenter = Rectangle_default.center(
  23003. boundingRectangle,
  23004. rectangleCenterScratch
  23005. );
  23006. const enuCenter = Cartographic_default.toCartesian(
  23007. rectangleCenter,
  23008. ellipsoid,
  23009. enuCenterScratch
  23010. );
  23011. const enuToFixedFrame = Transforms_default.eastNorthUpToFixedFrame(
  23012. enuCenter,
  23013. ellipsoid,
  23014. fixedFrameToEnuScratch
  23015. );
  23016. const fixedFrameToEnu = Matrix4_default.inverse(
  23017. enuToFixedFrame,
  23018. fixedFrameToEnuScratch
  23019. );
  23020. const boundingPointsEnu = boundingRectanglePointsEnuScratch;
  23021. const boundingPointsCarto = boundingRectanglePointsCartographicScratch;
  23022. boundingPointsCarto[0].longitude = boundingRectangle.west;
  23023. boundingPointsCarto[0].latitude = boundingRectangle.south;
  23024. boundingPointsCarto[1].longitude = boundingRectangle.west;
  23025. boundingPointsCarto[1].latitude = boundingRectangle.north;
  23026. boundingPointsCarto[2].longitude = boundingRectangle.east;
  23027. boundingPointsCarto[2].latitude = boundingRectangle.south;
  23028. let posEnu = pointEnuScratch;
  23029. for (i2 = 0; i2 < 3; i2++) {
  23030. Cartographic_default.toCartesian(boundingPointsCarto[i2], ellipsoid, posEnu);
  23031. posEnu = Matrix4_default.multiplyByPointAsVector(fixedFrameToEnu, posEnu, posEnu);
  23032. boundingPointsEnu[i2].x = posEnu.x;
  23033. boundingPointsEnu[i2].y = posEnu.y;
  23034. }
  23035. const rotation = Quaternion_default.fromAxisAngle(
  23036. Cartesian3_default.UNIT_Z,
  23037. -stRotation,
  23038. enuRotationScratch
  23039. );
  23040. const textureMatrix = Matrix3_default.fromQuaternion(
  23041. rotation,
  23042. enuRotationMatrixScratch
  23043. );
  23044. const positionsLength = positions.length;
  23045. let enuMinX = Number.POSITIVE_INFINITY;
  23046. let enuMinY = Number.POSITIVE_INFINITY;
  23047. let enuMaxX = Number.NEGATIVE_INFINITY;
  23048. let enuMaxY = Number.NEGATIVE_INFINITY;
  23049. for (i2 = 0; i2 < positionsLength; i2++) {
  23050. posEnu = Matrix4_default.multiplyByPointAsVector(
  23051. fixedFrameToEnu,
  23052. positions[i2],
  23053. posEnu
  23054. );
  23055. posEnu = Matrix3_default.multiplyByVector(textureMatrix, posEnu, posEnu);
  23056. enuMinX = Math.min(enuMinX, posEnu.x);
  23057. enuMinY = Math.min(enuMinY, posEnu.y);
  23058. enuMaxX = Math.max(enuMaxX, posEnu.x);
  23059. enuMaxY = Math.max(enuMaxY, posEnu.y);
  23060. }
  23061. const toDesiredInComputed = Matrix2_default.fromRotation(
  23062. stRotation,
  23063. rotation2DScratch
  23064. );
  23065. const points2D = points2DScratch;
  23066. points2D[0].x = enuMinX;
  23067. points2D[0].y = enuMinY;
  23068. points2D[1].x = enuMinX;
  23069. points2D[1].y = enuMaxY;
  23070. points2D[2].x = enuMaxX;
  23071. points2D[2].y = enuMinY;
  23072. const boundingEnuMin = boundingPointsEnu[0];
  23073. const boundingPointsWidth = boundingPointsEnu[2].x - boundingEnuMin.x;
  23074. const boundingPointsHeight = boundingPointsEnu[1].y - boundingEnuMin.y;
  23075. for (i2 = 0; i2 < 3; i2++) {
  23076. const point2D = points2D[i2];
  23077. Matrix2_default.multiplyByVector(toDesiredInComputed, point2D, point2D);
  23078. point2D.x = (point2D.x - boundingEnuMin.x) / boundingPointsWidth;
  23079. point2D.y = (point2D.y - boundingEnuMin.y) / boundingPointsHeight;
  23080. }
  23081. const minXYCorner = points2D[0];
  23082. const maxYCorner = points2D[1];
  23083. const maxXCorner = points2D[2];
  23084. const result = new Array(6);
  23085. Cartesian2_default.pack(minXYCorner, result);
  23086. Cartesian2_default.pack(maxYCorner, result, 2);
  23087. Cartesian2_default.pack(maxXCorner, result, 4);
  23088. return result;
  23089. };
  23090. var Geometry_default = Geometry;
  23091. // node_modules/cesium/Source/Core/GeometryAttribute.js
  23092. function GeometryAttribute(options) {
  23093. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  23094. if (!defined_default(options.componentDatatype)) {
  23095. throw new DeveloperError_default("options.componentDatatype is required.");
  23096. }
  23097. if (!defined_default(options.componentsPerAttribute)) {
  23098. throw new DeveloperError_default("options.componentsPerAttribute is required.");
  23099. }
  23100. if (options.componentsPerAttribute < 1 || options.componentsPerAttribute > 4) {
  23101. throw new DeveloperError_default(
  23102. "options.componentsPerAttribute must be between 1 and 4."
  23103. );
  23104. }
  23105. if (!defined_default(options.values)) {
  23106. throw new DeveloperError_default("options.values is required.");
  23107. }
  23108. this.componentDatatype = options.componentDatatype;
  23109. this.componentsPerAttribute = options.componentsPerAttribute;
  23110. this.normalize = defaultValue_default(options.normalize, false);
  23111. this.values = options.values;
  23112. }
  23113. var GeometryAttribute_default = GeometryAttribute;
  23114. // node_modules/cesium/Source/Core/GeometryAttributes.js
  23115. function GeometryAttributes(options) {
  23116. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  23117. this.position = options.position;
  23118. this.normal = options.normal;
  23119. this.st = options.st;
  23120. this.bitangent = options.bitangent;
  23121. this.tangent = options.tangent;
  23122. this.color = options.color;
  23123. }
  23124. var GeometryAttributes_default = GeometryAttributes;
  23125. // node_modules/cesium/Source/Core/GeometryOffsetAttribute.js
  23126. var GeometryOffsetAttribute = {
  23127. NONE: 0,
  23128. TOP: 1,
  23129. ALL: 2
  23130. };
  23131. var GeometryOffsetAttribute_default = Object.freeze(GeometryOffsetAttribute);
  23132. // node_modules/cesium/Source/Core/VertexFormat.js
  23133. function VertexFormat(options) {
  23134. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  23135. this.position = defaultValue_default(options.position, false);
  23136. this.normal = defaultValue_default(options.normal, false);
  23137. this.st = defaultValue_default(options.st, false);
  23138. this.bitangent = defaultValue_default(options.bitangent, false);
  23139. this.tangent = defaultValue_default(options.tangent, false);
  23140. this.color = defaultValue_default(options.color, false);
  23141. }
  23142. VertexFormat.POSITION_ONLY = Object.freeze(
  23143. new VertexFormat({
  23144. position: true
  23145. })
  23146. );
  23147. VertexFormat.POSITION_AND_NORMAL = Object.freeze(
  23148. new VertexFormat({
  23149. position: true,
  23150. normal: true
  23151. })
  23152. );
  23153. VertexFormat.POSITION_NORMAL_AND_ST = Object.freeze(
  23154. new VertexFormat({
  23155. position: true,
  23156. normal: true,
  23157. st: true
  23158. })
  23159. );
  23160. VertexFormat.POSITION_AND_ST = Object.freeze(
  23161. new VertexFormat({
  23162. position: true,
  23163. st: true
  23164. })
  23165. );
  23166. VertexFormat.POSITION_AND_COLOR = Object.freeze(
  23167. new VertexFormat({
  23168. position: true,
  23169. color: true
  23170. })
  23171. );
  23172. VertexFormat.ALL = Object.freeze(
  23173. new VertexFormat({
  23174. position: true,
  23175. normal: true,
  23176. st: true,
  23177. tangent: true,
  23178. bitangent: true
  23179. })
  23180. );
  23181. VertexFormat.DEFAULT = VertexFormat.POSITION_NORMAL_AND_ST;
  23182. VertexFormat.packedLength = 6;
  23183. VertexFormat.pack = function(value, array, startingIndex) {
  23184. if (!defined_default(value)) {
  23185. throw new DeveloperError_default("value is required");
  23186. }
  23187. if (!defined_default(array)) {
  23188. throw new DeveloperError_default("array is required");
  23189. }
  23190. startingIndex = defaultValue_default(startingIndex, 0);
  23191. array[startingIndex++] = value.position ? 1 : 0;
  23192. array[startingIndex++] = value.normal ? 1 : 0;
  23193. array[startingIndex++] = value.st ? 1 : 0;
  23194. array[startingIndex++] = value.tangent ? 1 : 0;
  23195. array[startingIndex++] = value.bitangent ? 1 : 0;
  23196. array[startingIndex] = value.color ? 1 : 0;
  23197. return array;
  23198. };
  23199. VertexFormat.unpack = function(array, startingIndex, result) {
  23200. if (!defined_default(array)) {
  23201. throw new DeveloperError_default("array is required");
  23202. }
  23203. startingIndex = defaultValue_default(startingIndex, 0);
  23204. if (!defined_default(result)) {
  23205. result = new VertexFormat();
  23206. }
  23207. result.position = array[startingIndex++] === 1;
  23208. result.normal = array[startingIndex++] === 1;
  23209. result.st = array[startingIndex++] === 1;
  23210. result.tangent = array[startingIndex++] === 1;
  23211. result.bitangent = array[startingIndex++] === 1;
  23212. result.color = array[startingIndex] === 1;
  23213. return result;
  23214. };
  23215. VertexFormat.clone = function(vertexFormat, result) {
  23216. if (!defined_default(vertexFormat)) {
  23217. return void 0;
  23218. }
  23219. if (!defined_default(result)) {
  23220. result = new VertexFormat();
  23221. }
  23222. result.position = vertexFormat.position;
  23223. result.normal = vertexFormat.normal;
  23224. result.st = vertexFormat.st;
  23225. result.tangent = vertexFormat.tangent;
  23226. result.bitangent = vertexFormat.bitangent;
  23227. result.color = vertexFormat.color;
  23228. return result;
  23229. };
  23230. var VertexFormat_default = VertexFormat;
  23231. // node_modules/cesium/Source/Core/BoxGeometry.js
  23232. var diffScratch = new Cartesian3_default();
  23233. function BoxGeometry(options) {
  23234. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  23235. const min3 = options.minimum;
  23236. const max3 = options.maximum;
  23237. Check_default.typeOf.object("min", min3);
  23238. Check_default.typeOf.object("max", max3);
  23239. if (defined_default(options.offsetAttribute) && options.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
  23240. throw new DeveloperError_default(
  23241. "GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry."
  23242. );
  23243. }
  23244. const vertexFormat = defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT);
  23245. this._minimum = Cartesian3_default.clone(min3);
  23246. this._maximum = Cartesian3_default.clone(max3);
  23247. this._vertexFormat = vertexFormat;
  23248. this._offsetAttribute = options.offsetAttribute;
  23249. this._workerName = "createBoxGeometry";
  23250. }
  23251. BoxGeometry.fromDimensions = function(options) {
  23252. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  23253. const dimensions = options.dimensions;
  23254. Check_default.typeOf.object("dimensions", dimensions);
  23255. Check_default.typeOf.number.greaterThanOrEquals("dimensions.x", dimensions.x, 0);
  23256. Check_default.typeOf.number.greaterThanOrEquals("dimensions.y", dimensions.y, 0);
  23257. Check_default.typeOf.number.greaterThanOrEquals("dimensions.z", dimensions.z, 0);
  23258. const corner = Cartesian3_default.multiplyByScalar(dimensions, 0.5, new Cartesian3_default());
  23259. return new BoxGeometry({
  23260. minimum: Cartesian3_default.negate(corner, new Cartesian3_default()),
  23261. maximum: corner,
  23262. vertexFormat: options.vertexFormat,
  23263. offsetAttribute: options.offsetAttribute
  23264. });
  23265. };
  23266. BoxGeometry.fromAxisAlignedBoundingBox = function(boundingBox) {
  23267. Check_default.typeOf.object("boundingBox", boundingBox);
  23268. return new BoxGeometry({
  23269. minimum: boundingBox.minimum,
  23270. maximum: boundingBox.maximum
  23271. });
  23272. };
  23273. BoxGeometry.packedLength = 2 * Cartesian3_default.packedLength + VertexFormat_default.packedLength + 1;
  23274. BoxGeometry.pack = function(value, array, startingIndex) {
  23275. Check_default.typeOf.object("value", value);
  23276. Check_default.defined("array", array);
  23277. startingIndex = defaultValue_default(startingIndex, 0);
  23278. Cartesian3_default.pack(value._minimum, array, startingIndex);
  23279. Cartesian3_default.pack(
  23280. value._maximum,
  23281. array,
  23282. startingIndex + Cartesian3_default.packedLength
  23283. );
  23284. VertexFormat_default.pack(
  23285. value._vertexFormat,
  23286. array,
  23287. startingIndex + 2 * Cartesian3_default.packedLength
  23288. );
  23289. array[startingIndex + 2 * Cartesian3_default.packedLength + VertexFormat_default.packedLength] = defaultValue_default(value._offsetAttribute, -1);
  23290. return array;
  23291. };
  23292. var scratchMin = new Cartesian3_default();
  23293. var scratchMax = new Cartesian3_default();
  23294. var scratchVertexFormat = new VertexFormat_default();
  23295. var scratchOptions = {
  23296. minimum: scratchMin,
  23297. maximum: scratchMax,
  23298. vertexFormat: scratchVertexFormat,
  23299. offsetAttribute: void 0
  23300. };
  23301. BoxGeometry.unpack = function(array, startingIndex, result) {
  23302. Check_default.defined("array", array);
  23303. startingIndex = defaultValue_default(startingIndex, 0);
  23304. const min3 = Cartesian3_default.unpack(array, startingIndex, scratchMin);
  23305. const max3 = Cartesian3_default.unpack(
  23306. array,
  23307. startingIndex + Cartesian3_default.packedLength,
  23308. scratchMax
  23309. );
  23310. const vertexFormat = VertexFormat_default.unpack(
  23311. array,
  23312. startingIndex + 2 * Cartesian3_default.packedLength,
  23313. scratchVertexFormat
  23314. );
  23315. const offsetAttribute = array[startingIndex + 2 * Cartesian3_default.packedLength + VertexFormat_default.packedLength];
  23316. if (!defined_default(result)) {
  23317. scratchOptions.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  23318. return new BoxGeometry(scratchOptions);
  23319. }
  23320. result._minimum = Cartesian3_default.clone(min3, result._minimum);
  23321. result._maximum = Cartesian3_default.clone(max3, result._maximum);
  23322. result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
  23323. result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  23324. return result;
  23325. };
  23326. BoxGeometry.createGeometry = function(boxGeometry) {
  23327. const min3 = boxGeometry._minimum;
  23328. const max3 = boxGeometry._maximum;
  23329. const vertexFormat = boxGeometry._vertexFormat;
  23330. if (Cartesian3_default.equals(min3, max3)) {
  23331. return;
  23332. }
  23333. const attributes = new GeometryAttributes_default();
  23334. let indices2;
  23335. let positions;
  23336. if (vertexFormat.position && (vertexFormat.st || vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent)) {
  23337. if (vertexFormat.position) {
  23338. positions = new Float64Array(6 * 4 * 3);
  23339. positions[0] = min3.x;
  23340. positions[1] = min3.y;
  23341. positions[2] = max3.z;
  23342. positions[3] = max3.x;
  23343. positions[4] = min3.y;
  23344. positions[5] = max3.z;
  23345. positions[6] = max3.x;
  23346. positions[7] = max3.y;
  23347. positions[8] = max3.z;
  23348. positions[9] = min3.x;
  23349. positions[10] = max3.y;
  23350. positions[11] = max3.z;
  23351. positions[12] = min3.x;
  23352. positions[13] = min3.y;
  23353. positions[14] = min3.z;
  23354. positions[15] = max3.x;
  23355. positions[16] = min3.y;
  23356. positions[17] = min3.z;
  23357. positions[18] = max3.x;
  23358. positions[19] = max3.y;
  23359. positions[20] = min3.z;
  23360. positions[21] = min3.x;
  23361. positions[22] = max3.y;
  23362. positions[23] = min3.z;
  23363. positions[24] = max3.x;
  23364. positions[25] = min3.y;
  23365. positions[26] = min3.z;
  23366. positions[27] = max3.x;
  23367. positions[28] = max3.y;
  23368. positions[29] = min3.z;
  23369. positions[30] = max3.x;
  23370. positions[31] = max3.y;
  23371. positions[32] = max3.z;
  23372. positions[33] = max3.x;
  23373. positions[34] = min3.y;
  23374. positions[35] = max3.z;
  23375. positions[36] = min3.x;
  23376. positions[37] = min3.y;
  23377. positions[38] = min3.z;
  23378. positions[39] = min3.x;
  23379. positions[40] = max3.y;
  23380. positions[41] = min3.z;
  23381. positions[42] = min3.x;
  23382. positions[43] = max3.y;
  23383. positions[44] = max3.z;
  23384. positions[45] = min3.x;
  23385. positions[46] = min3.y;
  23386. positions[47] = max3.z;
  23387. positions[48] = min3.x;
  23388. positions[49] = max3.y;
  23389. positions[50] = min3.z;
  23390. positions[51] = max3.x;
  23391. positions[52] = max3.y;
  23392. positions[53] = min3.z;
  23393. positions[54] = max3.x;
  23394. positions[55] = max3.y;
  23395. positions[56] = max3.z;
  23396. positions[57] = min3.x;
  23397. positions[58] = max3.y;
  23398. positions[59] = max3.z;
  23399. positions[60] = min3.x;
  23400. positions[61] = min3.y;
  23401. positions[62] = min3.z;
  23402. positions[63] = max3.x;
  23403. positions[64] = min3.y;
  23404. positions[65] = min3.z;
  23405. positions[66] = max3.x;
  23406. positions[67] = min3.y;
  23407. positions[68] = max3.z;
  23408. positions[69] = min3.x;
  23409. positions[70] = min3.y;
  23410. positions[71] = max3.z;
  23411. attributes.position = new GeometryAttribute_default({
  23412. componentDatatype: ComponentDatatype_default.DOUBLE,
  23413. componentsPerAttribute: 3,
  23414. values: positions
  23415. });
  23416. }
  23417. if (vertexFormat.normal) {
  23418. const normals = new Float32Array(6 * 4 * 3);
  23419. normals[0] = 0;
  23420. normals[1] = 0;
  23421. normals[2] = 1;
  23422. normals[3] = 0;
  23423. normals[4] = 0;
  23424. normals[5] = 1;
  23425. normals[6] = 0;
  23426. normals[7] = 0;
  23427. normals[8] = 1;
  23428. normals[9] = 0;
  23429. normals[10] = 0;
  23430. normals[11] = 1;
  23431. normals[12] = 0;
  23432. normals[13] = 0;
  23433. normals[14] = -1;
  23434. normals[15] = 0;
  23435. normals[16] = 0;
  23436. normals[17] = -1;
  23437. normals[18] = 0;
  23438. normals[19] = 0;
  23439. normals[20] = -1;
  23440. normals[21] = 0;
  23441. normals[22] = 0;
  23442. normals[23] = -1;
  23443. normals[24] = 1;
  23444. normals[25] = 0;
  23445. normals[26] = 0;
  23446. normals[27] = 1;
  23447. normals[28] = 0;
  23448. normals[29] = 0;
  23449. normals[30] = 1;
  23450. normals[31] = 0;
  23451. normals[32] = 0;
  23452. normals[33] = 1;
  23453. normals[34] = 0;
  23454. normals[35] = 0;
  23455. normals[36] = -1;
  23456. normals[37] = 0;
  23457. normals[38] = 0;
  23458. normals[39] = -1;
  23459. normals[40] = 0;
  23460. normals[41] = 0;
  23461. normals[42] = -1;
  23462. normals[43] = 0;
  23463. normals[44] = 0;
  23464. normals[45] = -1;
  23465. normals[46] = 0;
  23466. normals[47] = 0;
  23467. normals[48] = 0;
  23468. normals[49] = 1;
  23469. normals[50] = 0;
  23470. normals[51] = 0;
  23471. normals[52] = 1;
  23472. normals[53] = 0;
  23473. normals[54] = 0;
  23474. normals[55] = 1;
  23475. normals[56] = 0;
  23476. normals[57] = 0;
  23477. normals[58] = 1;
  23478. normals[59] = 0;
  23479. normals[60] = 0;
  23480. normals[61] = -1;
  23481. normals[62] = 0;
  23482. normals[63] = 0;
  23483. normals[64] = -1;
  23484. normals[65] = 0;
  23485. normals[66] = 0;
  23486. normals[67] = -1;
  23487. normals[68] = 0;
  23488. normals[69] = 0;
  23489. normals[70] = -1;
  23490. normals[71] = 0;
  23491. attributes.normal = new GeometryAttribute_default({
  23492. componentDatatype: ComponentDatatype_default.FLOAT,
  23493. componentsPerAttribute: 3,
  23494. values: normals
  23495. });
  23496. }
  23497. if (vertexFormat.st) {
  23498. const texCoords = new Float32Array(6 * 4 * 2);
  23499. texCoords[0] = 0;
  23500. texCoords[1] = 0;
  23501. texCoords[2] = 1;
  23502. texCoords[3] = 0;
  23503. texCoords[4] = 1;
  23504. texCoords[5] = 1;
  23505. texCoords[6] = 0;
  23506. texCoords[7] = 1;
  23507. texCoords[8] = 1;
  23508. texCoords[9] = 0;
  23509. texCoords[10] = 0;
  23510. texCoords[11] = 0;
  23511. texCoords[12] = 0;
  23512. texCoords[13] = 1;
  23513. texCoords[14] = 1;
  23514. texCoords[15] = 1;
  23515. texCoords[16] = 0;
  23516. texCoords[17] = 0;
  23517. texCoords[18] = 1;
  23518. texCoords[19] = 0;
  23519. texCoords[20] = 1;
  23520. texCoords[21] = 1;
  23521. texCoords[22] = 0;
  23522. texCoords[23] = 1;
  23523. texCoords[24] = 1;
  23524. texCoords[25] = 0;
  23525. texCoords[26] = 0;
  23526. texCoords[27] = 0;
  23527. texCoords[28] = 0;
  23528. texCoords[29] = 1;
  23529. texCoords[30] = 1;
  23530. texCoords[31] = 1;
  23531. texCoords[32] = 1;
  23532. texCoords[33] = 0;
  23533. texCoords[34] = 0;
  23534. texCoords[35] = 0;
  23535. texCoords[36] = 0;
  23536. texCoords[37] = 1;
  23537. texCoords[38] = 1;
  23538. texCoords[39] = 1;
  23539. texCoords[40] = 0;
  23540. texCoords[41] = 0;
  23541. texCoords[42] = 1;
  23542. texCoords[43] = 0;
  23543. texCoords[44] = 1;
  23544. texCoords[45] = 1;
  23545. texCoords[46] = 0;
  23546. texCoords[47] = 1;
  23547. attributes.st = new GeometryAttribute_default({
  23548. componentDatatype: ComponentDatatype_default.FLOAT,
  23549. componentsPerAttribute: 2,
  23550. values: texCoords
  23551. });
  23552. }
  23553. if (vertexFormat.tangent) {
  23554. const tangents = new Float32Array(6 * 4 * 3);
  23555. tangents[0] = 1;
  23556. tangents[1] = 0;
  23557. tangents[2] = 0;
  23558. tangents[3] = 1;
  23559. tangents[4] = 0;
  23560. tangents[5] = 0;
  23561. tangents[6] = 1;
  23562. tangents[7] = 0;
  23563. tangents[8] = 0;
  23564. tangents[9] = 1;
  23565. tangents[10] = 0;
  23566. tangents[11] = 0;
  23567. tangents[12] = -1;
  23568. tangents[13] = 0;
  23569. tangents[14] = 0;
  23570. tangents[15] = -1;
  23571. tangents[16] = 0;
  23572. tangents[17] = 0;
  23573. tangents[18] = -1;
  23574. tangents[19] = 0;
  23575. tangents[20] = 0;
  23576. tangents[21] = -1;
  23577. tangents[22] = 0;
  23578. tangents[23] = 0;
  23579. tangents[24] = 0;
  23580. tangents[25] = 1;
  23581. tangents[26] = 0;
  23582. tangents[27] = 0;
  23583. tangents[28] = 1;
  23584. tangents[29] = 0;
  23585. tangents[30] = 0;
  23586. tangents[31] = 1;
  23587. tangents[32] = 0;
  23588. tangents[33] = 0;
  23589. tangents[34] = 1;
  23590. tangents[35] = 0;
  23591. tangents[36] = 0;
  23592. tangents[37] = -1;
  23593. tangents[38] = 0;
  23594. tangents[39] = 0;
  23595. tangents[40] = -1;
  23596. tangents[41] = 0;
  23597. tangents[42] = 0;
  23598. tangents[43] = -1;
  23599. tangents[44] = 0;
  23600. tangents[45] = 0;
  23601. tangents[46] = -1;
  23602. tangents[47] = 0;
  23603. tangents[48] = -1;
  23604. tangents[49] = 0;
  23605. tangents[50] = 0;
  23606. tangents[51] = -1;
  23607. tangents[52] = 0;
  23608. tangents[53] = 0;
  23609. tangents[54] = -1;
  23610. tangents[55] = 0;
  23611. tangents[56] = 0;
  23612. tangents[57] = -1;
  23613. tangents[58] = 0;
  23614. tangents[59] = 0;
  23615. tangents[60] = 1;
  23616. tangents[61] = 0;
  23617. tangents[62] = 0;
  23618. tangents[63] = 1;
  23619. tangents[64] = 0;
  23620. tangents[65] = 0;
  23621. tangents[66] = 1;
  23622. tangents[67] = 0;
  23623. tangents[68] = 0;
  23624. tangents[69] = 1;
  23625. tangents[70] = 0;
  23626. tangents[71] = 0;
  23627. attributes.tangent = new GeometryAttribute_default({
  23628. componentDatatype: ComponentDatatype_default.FLOAT,
  23629. componentsPerAttribute: 3,
  23630. values: tangents
  23631. });
  23632. }
  23633. if (vertexFormat.bitangent) {
  23634. const bitangents = new Float32Array(6 * 4 * 3);
  23635. bitangents[0] = 0;
  23636. bitangents[1] = 1;
  23637. bitangents[2] = 0;
  23638. bitangents[3] = 0;
  23639. bitangents[4] = 1;
  23640. bitangents[5] = 0;
  23641. bitangents[6] = 0;
  23642. bitangents[7] = 1;
  23643. bitangents[8] = 0;
  23644. bitangents[9] = 0;
  23645. bitangents[10] = 1;
  23646. bitangents[11] = 0;
  23647. bitangents[12] = 0;
  23648. bitangents[13] = 1;
  23649. bitangents[14] = 0;
  23650. bitangents[15] = 0;
  23651. bitangents[16] = 1;
  23652. bitangents[17] = 0;
  23653. bitangents[18] = 0;
  23654. bitangents[19] = 1;
  23655. bitangents[20] = 0;
  23656. bitangents[21] = 0;
  23657. bitangents[22] = 1;
  23658. bitangents[23] = 0;
  23659. bitangents[24] = 0;
  23660. bitangents[25] = 0;
  23661. bitangents[26] = 1;
  23662. bitangents[27] = 0;
  23663. bitangents[28] = 0;
  23664. bitangents[29] = 1;
  23665. bitangents[30] = 0;
  23666. bitangents[31] = 0;
  23667. bitangents[32] = 1;
  23668. bitangents[33] = 0;
  23669. bitangents[34] = 0;
  23670. bitangents[35] = 1;
  23671. bitangents[36] = 0;
  23672. bitangents[37] = 0;
  23673. bitangents[38] = 1;
  23674. bitangents[39] = 0;
  23675. bitangents[40] = 0;
  23676. bitangents[41] = 1;
  23677. bitangents[42] = 0;
  23678. bitangents[43] = 0;
  23679. bitangents[44] = 1;
  23680. bitangents[45] = 0;
  23681. bitangents[46] = 0;
  23682. bitangents[47] = 1;
  23683. bitangents[48] = 0;
  23684. bitangents[49] = 0;
  23685. bitangents[50] = 1;
  23686. bitangents[51] = 0;
  23687. bitangents[52] = 0;
  23688. bitangents[53] = 1;
  23689. bitangents[54] = 0;
  23690. bitangents[55] = 0;
  23691. bitangents[56] = 1;
  23692. bitangents[57] = 0;
  23693. bitangents[58] = 0;
  23694. bitangents[59] = 1;
  23695. bitangents[60] = 0;
  23696. bitangents[61] = 0;
  23697. bitangents[62] = 1;
  23698. bitangents[63] = 0;
  23699. bitangents[64] = 0;
  23700. bitangents[65] = 1;
  23701. bitangents[66] = 0;
  23702. bitangents[67] = 0;
  23703. bitangents[68] = 1;
  23704. bitangents[69] = 0;
  23705. bitangents[70] = 0;
  23706. bitangents[71] = 1;
  23707. attributes.bitangent = new GeometryAttribute_default({
  23708. componentDatatype: ComponentDatatype_default.FLOAT,
  23709. componentsPerAttribute: 3,
  23710. values: bitangents
  23711. });
  23712. }
  23713. indices2 = new Uint16Array(6 * 2 * 3);
  23714. indices2[0] = 0;
  23715. indices2[1] = 1;
  23716. indices2[2] = 2;
  23717. indices2[3] = 0;
  23718. indices2[4] = 2;
  23719. indices2[5] = 3;
  23720. indices2[6] = 4 + 2;
  23721. indices2[7] = 4 + 1;
  23722. indices2[8] = 4 + 0;
  23723. indices2[9] = 4 + 3;
  23724. indices2[10] = 4 + 2;
  23725. indices2[11] = 4 + 0;
  23726. indices2[12] = 8 + 0;
  23727. indices2[13] = 8 + 1;
  23728. indices2[14] = 8 + 2;
  23729. indices2[15] = 8 + 0;
  23730. indices2[16] = 8 + 2;
  23731. indices2[17] = 8 + 3;
  23732. indices2[18] = 12 + 2;
  23733. indices2[19] = 12 + 1;
  23734. indices2[20] = 12 + 0;
  23735. indices2[21] = 12 + 3;
  23736. indices2[22] = 12 + 2;
  23737. indices2[23] = 12 + 0;
  23738. indices2[24] = 16 + 2;
  23739. indices2[25] = 16 + 1;
  23740. indices2[26] = 16 + 0;
  23741. indices2[27] = 16 + 3;
  23742. indices2[28] = 16 + 2;
  23743. indices2[29] = 16 + 0;
  23744. indices2[30] = 20 + 0;
  23745. indices2[31] = 20 + 1;
  23746. indices2[32] = 20 + 2;
  23747. indices2[33] = 20 + 0;
  23748. indices2[34] = 20 + 2;
  23749. indices2[35] = 20 + 3;
  23750. } else {
  23751. positions = new Float64Array(8 * 3);
  23752. positions[0] = min3.x;
  23753. positions[1] = min3.y;
  23754. positions[2] = min3.z;
  23755. positions[3] = max3.x;
  23756. positions[4] = min3.y;
  23757. positions[5] = min3.z;
  23758. positions[6] = max3.x;
  23759. positions[7] = max3.y;
  23760. positions[8] = min3.z;
  23761. positions[9] = min3.x;
  23762. positions[10] = max3.y;
  23763. positions[11] = min3.z;
  23764. positions[12] = min3.x;
  23765. positions[13] = min3.y;
  23766. positions[14] = max3.z;
  23767. positions[15] = max3.x;
  23768. positions[16] = min3.y;
  23769. positions[17] = max3.z;
  23770. positions[18] = max3.x;
  23771. positions[19] = max3.y;
  23772. positions[20] = max3.z;
  23773. positions[21] = min3.x;
  23774. positions[22] = max3.y;
  23775. positions[23] = max3.z;
  23776. attributes.position = new GeometryAttribute_default({
  23777. componentDatatype: ComponentDatatype_default.DOUBLE,
  23778. componentsPerAttribute: 3,
  23779. values: positions
  23780. });
  23781. indices2 = new Uint16Array(6 * 2 * 3);
  23782. indices2[0] = 4;
  23783. indices2[1] = 5;
  23784. indices2[2] = 6;
  23785. indices2[3] = 4;
  23786. indices2[4] = 6;
  23787. indices2[5] = 7;
  23788. indices2[6] = 1;
  23789. indices2[7] = 0;
  23790. indices2[8] = 3;
  23791. indices2[9] = 1;
  23792. indices2[10] = 3;
  23793. indices2[11] = 2;
  23794. indices2[12] = 1;
  23795. indices2[13] = 6;
  23796. indices2[14] = 5;
  23797. indices2[15] = 1;
  23798. indices2[16] = 2;
  23799. indices2[17] = 6;
  23800. indices2[18] = 2;
  23801. indices2[19] = 3;
  23802. indices2[20] = 7;
  23803. indices2[21] = 2;
  23804. indices2[22] = 7;
  23805. indices2[23] = 6;
  23806. indices2[24] = 3;
  23807. indices2[25] = 0;
  23808. indices2[26] = 4;
  23809. indices2[27] = 3;
  23810. indices2[28] = 4;
  23811. indices2[29] = 7;
  23812. indices2[30] = 0;
  23813. indices2[31] = 1;
  23814. indices2[32] = 5;
  23815. indices2[33] = 0;
  23816. indices2[34] = 5;
  23817. indices2[35] = 4;
  23818. }
  23819. const diff = Cartesian3_default.subtract(max3, min3, diffScratch);
  23820. const radius = Cartesian3_default.magnitude(diff) * 0.5;
  23821. if (defined_default(boxGeometry._offsetAttribute)) {
  23822. const length3 = positions.length;
  23823. const applyOffset = new Uint8Array(length3 / 3);
  23824. const offsetValue = boxGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  23825. arrayFill_default(applyOffset, offsetValue);
  23826. attributes.applyOffset = new GeometryAttribute_default({
  23827. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  23828. componentsPerAttribute: 1,
  23829. values: applyOffset
  23830. });
  23831. }
  23832. return new Geometry_default({
  23833. attributes,
  23834. indices: indices2,
  23835. primitiveType: PrimitiveType_default.TRIANGLES,
  23836. boundingSphere: new BoundingSphere_default(Cartesian3_default.ZERO, radius),
  23837. offsetAttribute: boxGeometry._offsetAttribute
  23838. });
  23839. };
  23840. var unitBoxGeometry;
  23841. BoxGeometry.getUnitBox = function() {
  23842. if (!defined_default(unitBoxGeometry)) {
  23843. unitBoxGeometry = BoxGeometry.createGeometry(
  23844. BoxGeometry.fromDimensions({
  23845. dimensions: new Cartesian3_default(1, 1, 1),
  23846. vertexFormat: VertexFormat_default.POSITION_ONLY
  23847. })
  23848. );
  23849. }
  23850. return unitBoxGeometry;
  23851. };
  23852. var BoxGeometry_default = BoxGeometry;
  23853. // node_modules/cesium/Source/Core/BoxOutlineGeometry.js
  23854. var diffScratch2 = new Cartesian3_default();
  23855. function BoxOutlineGeometry(options) {
  23856. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  23857. const min3 = options.minimum;
  23858. const max3 = options.maximum;
  23859. Check_default.typeOf.object("min", min3);
  23860. Check_default.typeOf.object("max", max3);
  23861. if (defined_default(options.offsetAttribute) && options.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
  23862. throw new DeveloperError_default(
  23863. "GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry."
  23864. );
  23865. }
  23866. this._min = Cartesian3_default.clone(min3);
  23867. this._max = Cartesian3_default.clone(max3);
  23868. this._offsetAttribute = options.offsetAttribute;
  23869. this._workerName = "createBoxOutlineGeometry";
  23870. }
  23871. BoxOutlineGeometry.fromDimensions = function(options) {
  23872. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  23873. const dimensions = options.dimensions;
  23874. Check_default.typeOf.object("dimensions", dimensions);
  23875. Check_default.typeOf.number.greaterThanOrEquals("dimensions.x", dimensions.x, 0);
  23876. Check_default.typeOf.number.greaterThanOrEquals("dimensions.y", dimensions.y, 0);
  23877. Check_default.typeOf.number.greaterThanOrEquals("dimensions.z", dimensions.z, 0);
  23878. const corner = Cartesian3_default.multiplyByScalar(dimensions, 0.5, new Cartesian3_default());
  23879. return new BoxOutlineGeometry({
  23880. minimum: Cartesian3_default.negate(corner, new Cartesian3_default()),
  23881. maximum: corner,
  23882. offsetAttribute: options.offsetAttribute
  23883. });
  23884. };
  23885. BoxOutlineGeometry.fromAxisAlignedBoundingBox = function(boundingBox) {
  23886. Check_default.typeOf.object("boundindBox", boundingBox);
  23887. return new BoxOutlineGeometry({
  23888. minimum: boundingBox.minimum,
  23889. maximum: boundingBox.maximum
  23890. });
  23891. };
  23892. BoxOutlineGeometry.packedLength = 2 * Cartesian3_default.packedLength + 1;
  23893. BoxOutlineGeometry.pack = function(value, array, startingIndex) {
  23894. Check_default.typeOf.object("value", value);
  23895. Check_default.defined("array", array);
  23896. startingIndex = defaultValue_default(startingIndex, 0);
  23897. Cartesian3_default.pack(value._min, array, startingIndex);
  23898. Cartesian3_default.pack(value._max, array, startingIndex + Cartesian3_default.packedLength);
  23899. array[startingIndex + Cartesian3_default.packedLength * 2] = defaultValue_default(
  23900. value._offsetAttribute,
  23901. -1
  23902. );
  23903. return array;
  23904. };
  23905. var scratchMin2 = new Cartesian3_default();
  23906. var scratchMax2 = new Cartesian3_default();
  23907. var scratchOptions2 = {
  23908. minimum: scratchMin2,
  23909. maximum: scratchMax2,
  23910. offsetAttribute: void 0
  23911. };
  23912. BoxOutlineGeometry.unpack = function(array, startingIndex, result) {
  23913. Check_default.defined("array", array);
  23914. startingIndex = defaultValue_default(startingIndex, 0);
  23915. const min3 = Cartesian3_default.unpack(array, startingIndex, scratchMin2);
  23916. const max3 = Cartesian3_default.unpack(
  23917. array,
  23918. startingIndex + Cartesian3_default.packedLength,
  23919. scratchMax2
  23920. );
  23921. const offsetAttribute = array[startingIndex + Cartesian3_default.packedLength * 2];
  23922. if (!defined_default(result)) {
  23923. scratchOptions2.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  23924. return new BoxOutlineGeometry(scratchOptions2);
  23925. }
  23926. result._min = Cartesian3_default.clone(min3, result._min);
  23927. result._max = Cartesian3_default.clone(max3, result._max);
  23928. result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  23929. return result;
  23930. };
  23931. BoxOutlineGeometry.createGeometry = function(boxGeometry) {
  23932. const min3 = boxGeometry._min;
  23933. const max3 = boxGeometry._max;
  23934. if (Cartesian3_default.equals(min3, max3)) {
  23935. return;
  23936. }
  23937. const attributes = new GeometryAttributes_default();
  23938. const indices2 = new Uint16Array(12 * 2);
  23939. const positions = new Float64Array(8 * 3);
  23940. positions[0] = min3.x;
  23941. positions[1] = min3.y;
  23942. positions[2] = min3.z;
  23943. positions[3] = max3.x;
  23944. positions[4] = min3.y;
  23945. positions[5] = min3.z;
  23946. positions[6] = max3.x;
  23947. positions[7] = max3.y;
  23948. positions[8] = min3.z;
  23949. positions[9] = min3.x;
  23950. positions[10] = max3.y;
  23951. positions[11] = min3.z;
  23952. positions[12] = min3.x;
  23953. positions[13] = min3.y;
  23954. positions[14] = max3.z;
  23955. positions[15] = max3.x;
  23956. positions[16] = min3.y;
  23957. positions[17] = max3.z;
  23958. positions[18] = max3.x;
  23959. positions[19] = max3.y;
  23960. positions[20] = max3.z;
  23961. positions[21] = min3.x;
  23962. positions[22] = max3.y;
  23963. positions[23] = max3.z;
  23964. attributes.position = new GeometryAttribute_default({
  23965. componentDatatype: ComponentDatatype_default.DOUBLE,
  23966. componentsPerAttribute: 3,
  23967. values: positions
  23968. });
  23969. indices2[0] = 4;
  23970. indices2[1] = 5;
  23971. indices2[2] = 5;
  23972. indices2[3] = 6;
  23973. indices2[4] = 6;
  23974. indices2[5] = 7;
  23975. indices2[6] = 7;
  23976. indices2[7] = 4;
  23977. indices2[8] = 0;
  23978. indices2[9] = 1;
  23979. indices2[10] = 1;
  23980. indices2[11] = 2;
  23981. indices2[12] = 2;
  23982. indices2[13] = 3;
  23983. indices2[14] = 3;
  23984. indices2[15] = 0;
  23985. indices2[16] = 0;
  23986. indices2[17] = 4;
  23987. indices2[18] = 1;
  23988. indices2[19] = 5;
  23989. indices2[20] = 2;
  23990. indices2[21] = 6;
  23991. indices2[22] = 3;
  23992. indices2[23] = 7;
  23993. const diff = Cartesian3_default.subtract(max3, min3, diffScratch2);
  23994. const radius = Cartesian3_default.magnitude(diff) * 0.5;
  23995. if (defined_default(boxGeometry._offsetAttribute)) {
  23996. const length3 = positions.length;
  23997. const applyOffset = new Uint8Array(length3 / 3);
  23998. const offsetValue = boxGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  23999. arrayFill_default(applyOffset, offsetValue);
  24000. attributes.applyOffset = new GeometryAttribute_default({
  24001. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  24002. componentsPerAttribute: 1,
  24003. values: applyOffset
  24004. });
  24005. }
  24006. return new Geometry_default({
  24007. attributes,
  24008. indices: indices2,
  24009. primitiveType: PrimitiveType_default.LINES,
  24010. boundingSphere: new BoundingSphere_default(Cartesian3_default.ZERO, radius),
  24011. offsetAttribute: boxGeometry._offsetAttribute
  24012. });
  24013. };
  24014. var BoxOutlineGeometry_default = BoxOutlineGeometry;
  24015. // node_modules/cesium/Source/Core/CartographicGeocoderService.js
  24016. function CartographicGeocoderService() {
  24017. }
  24018. CartographicGeocoderService.prototype.geocode = function(query) {
  24019. Check_default.typeOf.string("query", query);
  24020. const splitQuery = query.match(/[^\s,\n]+/g);
  24021. if (splitQuery.length === 2 || splitQuery.length === 3) {
  24022. let longitude = +splitQuery[0];
  24023. let latitude = +splitQuery[1];
  24024. const height = splitQuery.length === 3 ? +splitQuery[2] : 300;
  24025. if (isNaN(longitude) && isNaN(latitude)) {
  24026. const coordTest = /^(\d+.?\d*)([nsew])/i;
  24027. for (let i2 = 0; i2 < splitQuery.length; ++i2) {
  24028. const splitCoord = splitQuery[i2].match(coordTest);
  24029. if (coordTest.test(splitQuery[i2]) && splitCoord.length === 3) {
  24030. if (/^[ns]/i.test(splitCoord[2])) {
  24031. latitude = /^[n]/i.test(splitCoord[2]) ? +splitCoord[1] : -splitCoord[1];
  24032. } else if (/^[ew]/i.test(splitCoord[2])) {
  24033. longitude = /^[e]/i.test(splitCoord[2]) ? +splitCoord[1] : -splitCoord[1];
  24034. }
  24035. }
  24036. }
  24037. }
  24038. if (!isNaN(longitude) && !isNaN(latitude) && !isNaN(height)) {
  24039. const result = {
  24040. displayName: query,
  24041. destination: Cartesian3_default.fromDegrees(longitude, latitude, height)
  24042. };
  24043. return Promise.resolve([result]);
  24044. }
  24045. }
  24046. return Promise.resolve([]);
  24047. };
  24048. var CartographicGeocoderService_default = CartographicGeocoderService;
  24049. // node_modules/cesium/Source/Core/Spline.js
  24050. function Spline() {
  24051. this.times = void 0;
  24052. this.points = void 0;
  24053. DeveloperError_default.throwInstantiationError();
  24054. }
  24055. Spline.getPointType = function(point) {
  24056. if (typeof point === "number") {
  24057. return Number;
  24058. }
  24059. if (point instanceof Cartesian3_default) {
  24060. return Cartesian3_default;
  24061. }
  24062. if (point instanceof Quaternion_default) {
  24063. return Quaternion_default;
  24064. }
  24065. throw new DeveloperError_default(
  24066. "point must be a Cartesian3, Quaternion, or Number."
  24067. );
  24068. };
  24069. Spline.prototype.evaluate = DeveloperError_default.throwInstantiationError;
  24070. Spline.prototype.findTimeInterval = function(time, startIndex) {
  24071. const times = this.times;
  24072. const length3 = times.length;
  24073. Check_default.typeOf.number("time", time);
  24074. if (time < times[0] || time > times[length3 - 1]) {
  24075. throw new DeveloperError_default("time is out of range.");
  24076. }
  24077. startIndex = defaultValue_default(startIndex, 0);
  24078. if (time >= times[startIndex]) {
  24079. if (startIndex + 1 < length3 && time < times[startIndex + 1]) {
  24080. return startIndex;
  24081. } else if (startIndex + 2 < length3 && time < times[startIndex + 2]) {
  24082. return startIndex + 1;
  24083. }
  24084. } else if (startIndex - 1 >= 0 && time >= times[startIndex - 1]) {
  24085. return startIndex - 1;
  24086. }
  24087. let i2;
  24088. if (time > times[startIndex]) {
  24089. for (i2 = startIndex; i2 < length3 - 1; ++i2) {
  24090. if (time >= times[i2] && time < times[i2 + 1]) {
  24091. break;
  24092. }
  24093. }
  24094. } else {
  24095. for (i2 = startIndex - 1; i2 >= 0; --i2) {
  24096. if (time >= times[i2] && time < times[i2 + 1]) {
  24097. break;
  24098. }
  24099. }
  24100. }
  24101. if (i2 === length3 - 1) {
  24102. i2 = length3 - 2;
  24103. }
  24104. return i2;
  24105. };
  24106. Spline.prototype.wrapTime = function(time) {
  24107. Check_default.typeOf.number("time", time);
  24108. const times = this.times;
  24109. const timeEnd = times[times.length - 1];
  24110. const timeStart = times[0];
  24111. const timeStretch = timeEnd - timeStart;
  24112. let divs;
  24113. if (time < timeStart) {
  24114. divs = Math.floor((timeStart - time) / timeStretch) + 1;
  24115. time += divs * timeStretch;
  24116. }
  24117. if (time > timeEnd) {
  24118. divs = Math.floor((time - timeEnd) / timeStretch) + 1;
  24119. time -= divs * timeStretch;
  24120. }
  24121. return time;
  24122. };
  24123. Spline.prototype.clampTime = function(time) {
  24124. Check_default.typeOf.number("time", time);
  24125. const times = this.times;
  24126. return Math_default.clamp(time, times[0], times[times.length - 1]);
  24127. };
  24128. var Spline_default = Spline;
  24129. // node_modules/cesium/Source/Core/LinearSpline.js
  24130. function LinearSpline(options) {
  24131. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  24132. const points = options.points;
  24133. const times = options.times;
  24134. if (!defined_default(points) || !defined_default(times)) {
  24135. throw new DeveloperError_default("points and times are required.");
  24136. }
  24137. if (points.length < 2) {
  24138. throw new DeveloperError_default(
  24139. "points.length must be greater than or equal to 2."
  24140. );
  24141. }
  24142. if (times.length !== points.length) {
  24143. throw new DeveloperError_default("times.length must be equal to points.length.");
  24144. }
  24145. this._times = times;
  24146. this._points = points;
  24147. this._pointType = Spline_default.getPointType(points[0]);
  24148. this._lastTimeIndex = 0;
  24149. }
  24150. Object.defineProperties(LinearSpline.prototype, {
  24151. times: {
  24152. get: function() {
  24153. return this._times;
  24154. }
  24155. },
  24156. points: {
  24157. get: function() {
  24158. return this._points;
  24159. }
  24160. }
  24161. });
  24162. LinearSpline.prototype.findTimeInterval = Spline_default.prototype.findTimeInterval;
  24163. LinearSpline.prototype.wrapTime = Spline_default.prototype.wrapTime;
  24164. LinearSpline.prototype.clampTime = Spline_default.prototype.clampTime;
  24165. LinearSpline.prototype.evaluate = function(time, result) {
  24166. const points = this.points;
  24167. const times = this.times;
  24168. const i2 = this._lastTimeIndex = this.findTimeInterval(
  24169. time,
  24170. this._lastTimeIndex
  24171. );
  24172. const u3 = (time - times[i2]) / (times[i2 + 1] - times[i2]);
  24173. const PointType = this._pointType;
  24174. if (PointType === Number) {
  24175. return (1 - u3) * points[i2] + u3 * points[i2 + 1];
  24176. }
  24177. if (!defined_default(result)) {
  24178. result = new Cartesian3_default();
  24179. }
  24180. return Cartesian3_default.lerp(points[i2], points[i2 + 1], u3, result);
  24181. };
  24182. var LinearSpline_default = LinearSpline;
  24183. // node_modules/cesium/Source/Core/TridiagonalSystemSolver.js
  24184. var TridiagonalSystemSolver = {};
  24185. TridiagonalSystemSolver.solve = function(lower, diagonal, upper, right) {
  24186. if (!defined_default(lower) || !(lower instanceof Array)) {
  24187. throw new DeveloperError_default("The array lower is required.");
  24188. }
  24189. if (!defined_default(diagonal) || !(diagonal instanceof Array)) {
  24190. throw new DeveloperError_default("The array diagonal is required.");
  24191. }
  24192. if (!defined_default(upper) || !(upper instanceof Array)) {
  24193. throw new DeveloperError_default("The array upper is required.");
  24194. }
  24195. if (!defined_default(right) || !(right instanceof Array)) {
  24196. throw new DeveloperError_default("The array right is required.");
  24197. }
  24198. if (diagonal.length !== right.length) {
  24199. throw new DeveloperError_default("diagonal and right must have the same lengths.");
  24200. }
  24201. if (lower.length !== upper.length) {
  24202. throw new DeveloperError_default("lower and upper must have the same lengths.");
  24203. } else if (lower.length !== diagonal.length - 1) {
  24204. throw new DeveloperError_default(
  24205. "lower and upper must be one less than the length of diagonal."
  24206. );
  24207. }
  24208. const c14 = new Array(upper.length);
  24209. const d = new Array(right.length);
  24210. const x = new Array(right.length);
  24211. let i2;
  24212. for (i2 = 0; i2 < d.length; i2++) {
  24213. d[i2] = new Cartesian3_default();
  24214. x[i2] = new Cartesian3_default();
  24215. }
  24216. c14[0] = upper[0] / diagonal[0];
  24217. d[0] = Cartesian3_default.multiplyByScalar(right[0], 1 / diagonal[0], d[0]);
  24218. let scalar;
  24219. for (i2 = 1; i2 < c14.length; ++i2) {
  24220. scalar = 1 / (diagonal[i2] - c14[i2 - 1] * lower[i2 - 1]);
  24221. c14[i2] = upper[i2] * scalar;
  24222. d[i2] = Cartesian3_default.subtract(
  24223. right[i2],
  24224. Cartesian3_default.multiplyByScalar(d[i2 - 1], lower[i2 - 1], d[i2]),
  24225. d[i2]
  24226. );
  24227. d[i2] = Cartesian3_default.multiplyByScalar(d[i2], scalar, d[i2]);
  24228. }
  24229. scalar = 1 / (diagonal[i2] - c14[i2 - 1] * lower[i2 - 1]);
  24230. d[i2] = Cartesian3_default.subtract(
  24231. right[i2],
  24232. Cartesian3_default.multiplyByScalar(d[i2 - 1], lower[i2 - 1], d[i2]),
  24233. d[i2]
  24234. );
  24235. d[i2] = Cartesian3_default.multiplyByScalar(d[i2], scalar, d[i2]);
  24236. x[x.length - 1] = d[d.length - 1];
  24237. for (i2 = x.length - 2; i2 >= 0; --i2) {
  24238. x[i2] = Cartesian3_default.subtract(
  24239. d[i2],
  24240. Cartesian3_default.multiplyByScalar(x[i2 + 1], c14[i2], x[i2]),
  24241. x[i2]
  24242. );
  24243. }
  24244. return x;
  24245. };
  24246. var TridiagonalSystemSolver_default = TridiagonalSystemSolver;
  24247. // node_modules/cesium/Source/Core/HermiteSpline.js
  24248. var scratchLower = [];
  24249. var scratchDiagonal = [];
  24250. var scratchUpper = [];
  24251. var scratchRight = [];
  24252. function generateClamped(points, firstTangent, lastTangent) {
  24253. const l2 = scratchLower;
  24254. const u3 = scratchUpper;
  24255. const d = scratchDiagonal;
  24256. const r2 = scratchRight;
  24257. l2.length = u3.length = points.length - 1;
  24258. d.length = r2.length = points.length;
  24259. let i2;
  24260. l2[0] = d[0] = 1;
  24261. u3[0] = 0;
  24262. let right = r2[0];
  24263. if (!defined_default(right)) {
  24264. right = r2[0] = new Cartesian3_default();
  24265. }
  24266. Cartesian3_default.clone(firstTangent, right);
  24267. for (i2 = 1; i2 < l2.length - 1; ++i2) {
  24268. l2[i2] = u3[i2] = 1;
  24269. d[i2] = 4;
  24270. right = r2[i2];
  24271. if (!defined_default(right)) {
  24272. right = r2[i2] = new Cartesian3_default();
  24273. }
  24274. Cartesian3_default.subtract(points[i2 + 1], points[i2 - 1], right);
  24275. Cartesian3_default.multiplyByScalar(right, 3, right);
  24276. }
  24277. l2[i2] = 0;
  24278. u3[i2] = 1;
  24279. d[i2] = 4;
  24280. right = r2[i2];
  24281. if (!defined_default(right)) {
  24282. right = r2[i2] = new Cartesian3_default();
  24283. }
  24284. Cartesian3_default.subtract(points[i2 + 1], points[i2 - 1], right);
  24285. Cartesian3_default.multiplyByScalar(right, 3, right);
  24286. d[i2 + 1] = 1;
  24287. right = r2[i2 + 1];
  24288. if (!defined_default(right)) {
  24289. right = r2[i2 + 1] = new Cartesian3_default();
  24290. }
  24291. Cartesian3_default.clone(lastTangent, right);
  24292. return TridiagonalSystemSolver_default.solve(l2, d, u3, r2);
  24293. }
  24294. function generateNatural(points) {
  24295. const l2 = scratchLower;
  24296. const u3 = scratchUpper;
  24297. const d = scratchDiagonal;
  24298. const r2 = scratchRight;
  24299. l2.length = u3.length = points.length - 1;
  24300. d.length = r2.length = points.length;
  24301. let i2;
  24302. l2[0] = u3[0] = 1;
  24303. d[0] = 2;
  24304. let right = r2[0];
  24305. if (!defined_default(right)) {
  24306. right = r2[0] = new Cartesian3_default();
  24307. }
  24308. Cartesian3_default.subtract(points[1], points[0], right);
  24309. Cartesian3_default.multiplyByScalar(right, 3, right);
  24310. for (i2 = 1; i2 < l2.length; ++i2) {
  24311. l2[i2] = u3[i2] = 1;
  24312. d[i2] = 4;
  24313. right = r2[i2];
  24314. if (!defined_default(right)) {
  24315. right = r2[i2] = new Cartesian3_default();
  24316. }
  24317. Cartesian3_default.subtract(points[i2 + 1], points[i2 - 1], right);
  24318. Cartesian3_default.multiplyByScalar(right, 3, right);
  24319. }
  24320. d[i2] = 2;
  24321. right = r2[i2];
  24322. if (!defined_default(right)) {
  24323. right = r2[i2] = new Cartesian3_default();
  24324. }
  24325. Cartesian3_default.subtract(points[i2], points[i2 - 1], right);
  24326. Cartesian3_default.multiplyByScalar(right, 3, right);
  24327. return TridiagonalSystemSolver_default.solve(l2, d, u3, r2);
  24328. }
  24329. function HermiteSpline(options) {
  24330. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  24331. const points = options.points;
  24332. const times = options.times;
  24333. const inTangents = options.inTangents;
  24334. const outTangents = options.outTangents;
  24335. if (!defined_default(points) || !defined_default(times) || !defined_default(inTangents) || !defined_default(outTangents)) {
  24336. throw new DeveloperError_default(
  24337. "times, points, inTangents, and outTangents are required."
  24338. );
  24339. }
  24340. if (points.length < 2) {
  24341. throw new DeveloperError_default(
  24342. "points.length must be greater than or equal to 2."
  24343. );
  24344. }
  24345. if (times.length !== points.length) {
  24346. throw new DeveloperError_default("times.length must be equal to points.length.");
  24347. }
  24348. if (inTangents.length !== outTangents.length || inTangents.length !== points.length - 1) {
  24349. throw new DeveloperError_default(
  24350. "inTangents and outTangents must have a length equal to points.length - 1."
  24351. );
  24352. }
  24353. this._times = times;
  24354. this._points = points;
  24355. this._pointType = Spline_default.getPointType(points[0]);
  24356. if (this._pointType !== Spline_default.getPointType(inTangents[0]) || this._pointType !== Spline_default.getPointType(outTangents[0])) {
  24357. throw new DeveloperError_default(
  24358. "inTangents and outTangents must be of the same type as points."
  24359. );
  24360. }
  24361. this._inTangents = inTangents;
  24362. this._outTangents = outTangents;
  24363. this._lastTimeIndex = 0;
  24364. }
  24365. Object.defineProperties(HermiteSpline.prototype, {
  24366. times: {
  24367. get: function() {
  24368. return this._times;
  24369. }
  24370. },
  24371. points: {
  24372. get: function() {
  24373. return this._points;
  24374. }
  24375. },
  24376. inTangents: {
  24377. get: function() {
  24378. return this._inTangents;
  24379. }
  24380. },
  24381. outTangents: {
  24382. get: function() {
  24383. return this._outTangents;
  24384. }
  24385. }
  24386. });
  24387. HermiteSpline.createC1 = function(options) {
  24388. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  24389. const times = options.times;
  24390. const points = options.points;
  24391. const tangents = options.tangents;
  24392. if (!defined_default(points) || !defined_default(times) || !defined_default(tangents)) {
  24393. throw new DeveloperError_default("points, times and tangents are required.");
  24394. }
  24395. if (points.length < 2) {
  24396. throw new DeveloperError_default(
  24397. "points.length must be greater than or equal to 2."
  24398. );
  24399. }
  24400. if (times.length !== points.length || times.length !== tangents.length) {
  24401. throw new DeveloperError_default(
  24402. "times, points and tangents must have the same length."
  24403. );
  24404. }
  24405. const outTangents = tangents.slice(0, tangents.length - 1);
  24406. const inTangents = tangents.slice(1, tangents.length);
  24407. return new HermiteSpline({
  24408. times,
  24409. points,
  24410. inTangents,
  24411. outTangents
  24412. });
  24413. };
  24414. HermiteSpline.createNaturalCubic = function(options) {
  24415. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  24416. const times = options.times;
  24417. const points = options.points;
  24418. if (!defined_default(points) || !defined_default(times)) {
  24419. throw new DeveloperError_default("points and times are required.");
  24420. }
  24421. if (points.length < 2) {
  24422. throw new DeveloperError_default(
  24423. "points.length must be greater than or equal to 2."
  24424. );
  24425. }
  24426. if (times.length !== points.length) {
  24427. throw new DeveloperError_default("times.length must be equal to points.length.");
  24428. }
  24429. if (points.length < 3) {
  24430. return new LinearSpline_default({
  24431. points,
  24432. times
  24433. });
  24434. }
  24435. const tangents = generateNatural(points);
  24436. const outTangents = tangents.slice(0, tangents.length - 1);
  24437. const inTangents = tangents.slice(1, tangents.length);
  24438. return new HermiteSpline({
  24439. times,
  24440. points,
  24441. inTangents,
  24442. outTangents
  24443. });
  24444. };
  24445. HermiteSpline.createClampedCubic = function(options) {
  24446. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  24447. const times = options.times;
  24448. const points = options.points;
  24449. const firstTangent = options.firstTangent;
  24450. const lastTangent = options.lastTangent;
  24451. if (!defined_default(points) || !defined_default(times) || !defined_default(firstTangent) || !defined_default(lastTangent)) {
  24452. throw new DeveloperError_default(
  24453. "points, times, firstTangent and lastTangent are required."
  24454. );
  24455. }
  24456. if (points.length < 2) {
  24457. throw new DeveloperError_default(
  24458. "points.length must be greater than or equal to 2."
  24459. );
  24460. }
  24461. if (times.length !== points.length) {
  24462. throw new DeveloperError_default("times.length must be equal to points.length.");
  24463. }
  24464. const PointType = Spline_default.getPointType(points[0]);
  24465. if (PointType !== Spline_default.getPointType(firstTangent) || PointType !== Spline_default.getPointType(lastTangent)) {
  24466. throw new DeveloperError_default(
  24467. "firstTangent and lastTangent must be of the same type as points."
  24468. );
  24469. }
  24470. if (points.length < 3) {
  24471. return new LinearSpline_default({
  24472. points,
  24473. times
  24474. });
  24475. }
  24476. const tangents = generateClamped(points, firstTangent, lastTangent);
  24477. const outTangents = tangents.slice(0, tangents.length - 1);
  24478. const inTangents = tangents.slice(1, tangents.length);
  24479. return new HermiteSpline({
  24480. times,
  24481. points,
  24482. inTangents,
  24483. outTangents
  24484. });
  24485. };
  24486. HermiteSpline.hermiteCoefficientMatrix = new Matrix4_default(
  24487. 2,
  24488. -3,
  24489. 0,
  24490. 1,
  24491. -2,
  24492. 3,
  24493. 0,
  24494. 0,
  24495. 1,
  24496. -2,
  24497. 1,
  24498. 0,
  24499. 1,
  24500. -1,
  24501. 0,
  24502. 0
  24503. );
  24504. HermiteSpline.prototype.findTimeInterval = Spline_default.prototype.findTimeInterval;
  24505. var scratchTimeVec = new Cartesian4_default();
  24506. var scratchTemp = new Cartesian3_default();
  24507. HermiteSpline.prototype.wrapTime = Spline_default.prototype.wrapTime;
  24508. HermiteSpline.prototype.clampTime = Spline_default.prototype.clampTime;
  24509. HermiteSpline.prototype.evaluate = function(time, result) {
  24510. const points = this.points;
  24511. const times = this.times;
  24512. const inTangents = this.inTangents;
  24513. const outTangents = this.outTangents;
  24514. this._lastTimeIndex = this.findTimeInterval(time, this._lastTimeIndex);
  24515. const i2 = this._lastTimeIndex;
  24516. const timesDelta = times[i2 + 1] - times[i2];
  24517. const u3 = (time - times[i2]) / timesDelta;
  24518. const timeVec = scratchTimeVec;
  24519. timeVec.z = u3;
  24520. timeVec.y = u3 * u3;
  24521. timeVec.x = timeVec.y * u3;
  24522. timeVec.w = 1;
  24523. const coefs = Matrix4_default.multiplyByVector(
  24524. HermiteSpline.hermiteCoefficientMatrix,
  24525. timeVec,
  24526. timeVec
  24527. );
  24528. coefs.z *= timesDelta;
  24529. coefs.w *= timesDelta;
  24530. const PointType = this._pointType;
  24531. if (PointType === Number) {
  24532. return points[i2] * coefs.x + points[i2 + 1] * coefs.y + outTangents[i2] * coefs.z + inTangents[i2] * coefs.w;
  24533. }
  24534. if (!defined_default(result)) {
  24535. result = new PointType();
  24536. }
  24537. result = PointType.multiplyByScalar(points[i2], coefs.x, result);
  24538. PointType.multiplyByScalar(points[i2 + 1], coefs.y, scratchTemp);
  24539. PointType.add(result, scratchTemp, result);
  24540. PointType.multiplyByScalar(outTangents[i2], coefs.z, scratchTemp);
  24541. PointType.add(result, scratchTemp, result);
  24542. PointType.multiplyByScalar(inTangents[i2], coefs.w, scratchTemp);
  24543. return PointType.add(result, scratchTemp, result);
  24544. };
  24545. var HermiteSpline_default = HermiteSpline;
  24546. // node_modules/cesium/Source/Core/CatmullRomSpline.js
  24547. var scratchTimeVec2 = new Cartesian4_default();
  24548. var scratchTemp0 = new Cartesian3_default();
  24549. var scratchTemp1 = new Cartesian3_default();
  24550. function createEvaluateFunction(spline) {
  24551. const points = spline.points;
  24552. const times = spline.times;
  24553. if (points.length < 3) {
  24554. const t0 = times[0];
  24555. const invSpan = 1 / (times[1] - t0);
  24556. const p0 = points[0];
  24557. const p1 = points[1];
  24558. return function(time, result) {
  24559. if (!defined_default(result)) {
  24560. result = new Cartesian3_default();
  24561. }
  24562. const u3 = (time - t0) * invSpan;
  24563. return Cartesian3_default.lerp(p0, p1, u3, result);
  24564. };
  24565. }
  24566. return function(time, result) {
  24567. if (!defined_default(result)) {
  24568. result = new Cartesian3_default();
  24569. }
  24570. const i2 = spline._lastTimeIndex = spline.findTimeInterval(
  24571. time,
  24572. spline._lastTimeIndex
  24573. );
  24574. const u3 = (time - times[i2]) / (times[i2 + 1] - times[i2]);
  24575. const timeVec = scratchTimeVec2;
  24576. timeVec.z = u3;
  24577. timeVec.y = u3 * u3;
  24578. timeVec.x = timeVec.y * u3;
  24579. timeVec.w = 1;
  24580. let p0;
  24581. let p1;
  24582. let p2;
  24583. let p3;
  24584. let coefs;
  24585. if (i2 === 0) {
  24586. p0 = points[0];
  24587. p1 = points[1];
  24588. p2 = spline.firstTangent;
  24589. p3 = Cartesian3_default.subtract(points[2], p0, scratchTemp0);
  24590. Cartesian3_default.multiplyByScalar(p3, 0.5, p3);
  24591. coefs = Matrix4_default.multiplyByVector(
  24592. HermiteSpline_default.hermiteCoefficientMatrix,
  24593. timeVec,
  24594. timeVec
  24595. );
  24596. } else if (i2 === points.length - 2) {
  24597. p0 = points[i2];
  24598. p1 = points[i2 + 1];
  24599. p3 = spline.lastTangent;
  24600. p2 = Cartesian3_default.subtract(p1, points[i2 - 1], scratchTemp0);
  24601. Cartesian3_default.multiplyByScalar(p2, 0.5, p2);
  24602. coefs = Matrix4_default.multiplyByVector(
  24603. HermiteSpline_default.hermiteCoefficientMatrix,
  24604. timeVec,
  24605. timeVec
  24606. );
  24607. } else {
  24608. p0 = points[i2 - 1];
  24609. p1 = points[i2];
  24610. p2 = points[i2 + 1];
  24611. p3 = points[i2 + 2];
  24612. coefs = Matrix4_default.multiplyByVector(
  24613. CatmullRomSpline.catmullRomCoefficientMatrix,
  24614. timeVec,
  24615. timeVec
  24616. );
  24617. }
  24618. result = Cartesian3_default.multiplyByScalar(p0, coefs.x, result);
  24619. Cartesian3_default.multiplyByScalar(p1, coefs.y, scratchTemp1);
  24620. Cartesian3_default.add(result, scratchTemp1, result);
  24621. Cartesian3_default.multiplyByScalar(p2, coefs.z, scratchTemp1);
  24622. Cartesian3_default.add(result, scratchTemp1, result);
  24623. Cartesian3_default.multiplyByScalar(p3, coefs.w, scratchTemp1);
  24624. return Cartesian3_default.add(result, scratchTemp1, result);
  24625. };
  24626. }
  24627. var firstTangentScratch = new Cartesian3_default();
  24628. var lastTangentScratch = new Cartesian3_default();
  24629. function CatmullRomSpline(options) {
  24630. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  24631. const points = options.points;
  24632. const times = options.times;
  24633. let firstTangent = options.firstTangent;
  24634. let lastTangent = options.lastTangent;
  24635. Check_default.defined("points", points);
  24636. Check_default.defined("times", times);
  24637. Check_default.typeOf.number.greaterThanOrEquals("points.length", points.length, 2);
  24638. Check_default.typeOf.number.equals(
  24639. "times.length",
  24640. "points.length",
  24641. times.length,
  24642. points.length
  24643. );
  24644. if (points.length > 2) {
  24645. if (!defined_default(firstTangent)) {
  24646. firstTangent = firstTangentScratch;
  24647. Cartesian3_default.multiplyByScalar(points[1], 2, firstTangent);
  24648. Cartesian3_default.subtract(firstTangent, points[2], firstTangent);
  24649. Cartesian3_default.subtract(firstTangent, points[0], firstTangent);
  24650. Cartesian3_default.multiplyByScalar(firstTangent, 0.5, firstTangent);
  24651. }
  24652. if (!defined_default(lastTangent)) {
  24653. const n2 = points.length - 1;
  24654. lastTangent = lastTangentScratch;
  24655. Cartesian3_default.multiplyByScalar(points[n2 - 1], 2, lastTangent);
  24656. Cartesian3_default.subtract(points[n2], lastTangent, lastTangent);
  24657. Cartesian3_default.add(lastTangent, points[n2 - 2], lastTangent);
  24658. Cartesian3_default.multiplyByScalar(lastTangent, 0.5, lastTangent);
  24659. }
  24660. }
  24661. this._times = times;
  24662. this._points = points;
  24663. this._firstTangent = Cartesian3_default.clone(firstTangent);
  24664. this._lastTangent = Cartesian3_default.clone(lastTangent);
  24665. this._evaluateFunction = createEvaluateFunction(this);
  24666. this._lastTimeIndex = 0;
  24667. }
  24668. Object.defineProperties(CatmullRomSpline.prototype, {
  24669. times: {
  24670. get: function() {
  24671. return this._times;
  24672. }
  24673. },
  24674. points: {
  24675. get: function() {
  24676. return this._points;
  24677. }
  24678. },
  24679. firstTangent: {
  24680. get: function() {
  24681. return this._firstTangent;
  24682. }
  24683. },
  24684. lastTangent: {
  24685. get: function() {
  24686. return this._lastTangent;
  24687. }
  24688. }
  24689. });
  24690. CatmullRomSpline.catmullRomCoefficientMatrix = new Matrix4_default(
  24691. -0.5,
  24692. 1,
  24693. -0.5,
  24694. 0,
  24695. 1.5,
  24696. -2.5,
  24697. 0,
  24698. 1,
  24699. -1.5,
  24700. 2,
  24701. 0.5,
  24702. 0,
  24703. 0.5,
  24704. -0.5,
  24705. 0,
  24706. 0
  24707. );
  24708. CatmullRomSpline.prototype.findTimeInterval = Spline_default.prototype.findTimeInterval;
  24709. CatmullRomSpline.prototype.wrapTime = Spline_default.prototype.wrapTime;
  24710. CatmullRomSpline.prototype.clampTime = Spline_default.prototype.clampTime;
  24711. CatmullRomSpline.prototype.evaluate = function(time, result) {
  24712. return this._evaluateFunction(time, result);
  24713. };
  24714. var CatmullRomSpline_default = CatmullRomSpline;
  24715. // node_modules/cesium/Source/Core/getStringFromTypedArray.js
  24716. function getStringFromTypedArray(uint8Array, byteOffset, byteLength) {
  24717. if (!defined_default(uint8Array)) {
  24718. throw new DeveloperError_default("uint8Array is required.");
  24719. }
  24720. if (byteOffset < 0) {
  24721. throw new DeveloperError_default("byteOffset cannot be negative.");
  24722. }
  24723. if (byteLength < 0) {
  24724. throw new DeveloperError_default("byteLength cannot be negative.");
  24725. }
  24726. if (byteOffset + byteLength > uint8Array.byteLength) {
  24727. throw new DeveloperError_default("sub-region exceeds array bounds.");
  24728. }
  24729. byteOffset = defaultValue_default(byteOffset, 0);
  24730. byteLength = defaultValue_default(byteLength, uint8Array.byteLength - byteOffset);
  24731. uint8Array = uint8Array.subarray(byteOffset, byteOffset + byteLength);
  24732. return getStringFromTypedArray.decode(uint8Array);
  24733. }
  24734. getStringFromTypedArray.decodeWithTextDecoder = function(view) {
  24735. const decoder = new TextDecoder("utf-8");
  24736. return decoder.decode(view);
  24737. };
  24738. getStringFromTypedArray.decodeWithFromCharCode = function(view) {
  24739. let result = "";
  24740. const codePoints = utf8Handler(view);
  24741. const length3 = codePoints.length;
  24742. for (let i2 = 0; i2 < length3; ++i2) {
  24743. let cp = codePoints[i2];
  24744. if (cp <= 65535) {
  24745. result += String.fromCharCode(cp);
  24746. } else {
  24747. cp -= 65536;
  24748. result += String.fromCharCode((cp >> 10) + 55296, (cp & 1023) + 56320);
  24749. }
  24750. }
  24751. return result;
  24752. };
  24753. function inRange(a4, min3, max3) {
  24754. return min3 <= a4 && a4 <= max3;
  24755. }
  24756. function utf8Handler(utfBytes) {
  24757. let codePoint = 0;
  24758. let bytesSeen = 0;
  24759. let bytesNeeded = 0;
  24760. let lowerBoundary = 128;
  24761. let upperBoundary = 191;
  24762. const codePoints = [];
  24763. const length3 = utfBytes.length;
  24764. for (let i2 = 0; i2 < length3; ++i2) {
  24765. const currentByte = utfBytes[i2];
  24766. if (bytesNeeded === 0) {
  24767. if (inRange(currentByte, 0, 127)) {
  24768. codePoints.push(currentByte);
  24769. continue;
  24770. }
  24771. if (inRange(currentByte, 194, 223)) {
  24772. bytesNeeded = 1;
  24773. codePoint = currentByte & 31;
  24774. continue;
  24775. }
  24776. if (inRange(currentByte, 224, 239)) {
  24777. if (currentByte === 224) {
  24778. lowerBoundary = 160;
  24779. }
  24780. if (currentByte === 237) {
  24781. upperBoundary = 159;
  24782. }
  24783. bytesNeeded = 2;
  24784. codePoint = currentByte & 15;
  24785. continue;
  24786. }
  24787. if (inRange(currentByte, 240, 244)) {
  24788. if (currentByte === 240) {
  24789. lowerBoundary = 144;
  24790. }
  24791. if (currentByte === 244) {
  24792. upperBoundary = 143;
  24793. }
  24794. bytesNeeded = 3;
  24795. codePoint = currentByte & 7;
  24796. continue;
  24797. }
  24798. throw new RuntimeError_default("String decoding failed.");
  24799. }
  24800. if (!inRange(currentByte, lowerBoundary, upperBoundary)) {
  24801. codePoint = bytesNeeded = bytesSeen = 0;
  24802. lowerBoundary = 128;
  24803. upperBoundary = 191;
  24804. --i2;
  24805. continue;
  24806. }
  24807. lowerBoundary = 128;
  24808. upperBoundary = 191;
  24809. codePoint = codePoint << 6 | currentByte & 63;
  24810. ++bytesSeen;
  24811. if (bytesSeen === bytesNeeded) {
  24812. codePoints.push(codePoint);
  24813. codePoint = bytesNeeded = bytesSeen = 0;
  24814. }
  24815. }
  24816. return codePoints;
  24817. }
  24818. if (typeof TextDecoder !== "undefined") {
  24819. getStringFromTypedArray.decode = getStringFromTypedArray.decodeWithTextDecoder;
  24820. } else {
  24821. getStringFromTypedArray.decode = getStringFromTypedArray.decodeWithFromCharCode;
  24822. }
  24823. var getStringFromTypedArray_default = getStringFromTypedArray;
  24824. // node_modules/cesium/Source/Core/getJsonFromTypedArray.js
  24825. function getJsonFromTypedArray(uint8Array, byteOffset, byteLength) {
  24826. return JSON.parse(
  24827. getStringFromTypedArray_default(uint8Array, byteOffset, byteLength)
  24828. );
  24829. }
  24830. var getJsonFromTypedArray_default = getJsonFromTypedArray;
  24831. // node_modules/cesium/Source/Core/Intersections2D.js
  24832. var Intersections2D = {};
  24833. Intersections2D.clipTriangleAtAxisAlignedThreshold = function(threshold, keepAbove, u0, u12, u22, result) {
  24834. if (!defined_default(threshold)) {
  24835. throw new DeveloperError_default("threshold is required.");
  24836. }
  24837. if (!defined_default(keepAbove)) {
  24838. throw new DeveloperError_default("keepAbove is required.");
  24839. }
  24840. if (!defined_default(u0)) {
  24841. throw new DeveloperError_default("u0 is required.");
  24842. }
  24843. if (!defined_default(u12)) {
  24844. throw new DeveloperError_default("u1 is required.");
  24845. }
  24846. if (!defined_default(u22)) {
  24847. throw new DeveloperError_default("u2 is required.");
  24848. }
  24849. if (!defined_default(result)) {
  24850. result = [];
  24851. } else {
  24852. result.length = 0;
  24853. }
  24854. let u0Behind;
  24855. let u1Behind;
  24856. let u2Behind;
  24857. if (keepAbove) {
  24858. u0Behind = u0 < threshold;
  24859. u1Behind = u12 < threshold;
  24860. u2Behind = u22 < threshold;
  24861. } else {
  24862. u0Behind = u0 > threshold;
  24863. u1Behind = u12 > threshold;
  24864. u2Behind = u22 > threshold;
  24865. }
  24866. const numBehind = u0Behind + u1Behind + u2Behind;
  24867. let u01Ratio;
  24868. let u02Ratio;
  24869. let u12Ratio;
  24870. let u10Ratio;
  24871. let u20Ratio;
  24872. let u21Ratio;
  24873. if (numBehind === 1) {
  24874. if (u0Behind) {
  24875. u01Ratio = (threshold - u0) / (u12 - u0);
  24876. u02Ratio = (threshold - u0) / (u22 - u0);
  24877. result.push(1);
  24878. result.push(2);
  24879. if (u02Ratio !== 1) {
  24880. result.push(-1);
  24881. result.push(0);
  24882. result.push(2);
  24883. result.push(u02Ratio);
  24884. }
  24885. if (u01Ratio !== 1) {
  24886. result.push(-1);
  24887. result.push(0);
  24888. result.push(1);
  24889. result.push(u01Ratio);
  24890. }
  24891. } else if (u1Behind) {
  24892. u12Ratio = (threshold - u12) / (u22 - u12);
  24893. u10Ratio = (threshold - u12) / (u0 - u12);
  24894. result.push(2);
  24895. result.push(0);
  24896. if (u10Ratio !== 1) {
  24897. result.push(-1);
  24898. result.push(1);
  24899. result.push(0);
  24900. result.push(u10Ratio);
  24901. }
  24902. if (u12Ratio !== 1) {
  24903. result.push(-1);
  24904. result.push(1);
  24905. result.push(2);
  24906. result.push(u12Ratio);
  24907. }
  24908. } else if (u2Behind) {
  24909. u20Ratio = (threshold - u22) / (u0 - u22);
  24910. u21Ratio = (threshold - u22) / (u12 - u22);
  24911. result.push(0);
  24912. result.push(1);
  24913. if (u21Ratio !== 1) {
  24914. result.push(-1);
  24915. result.push(2);
  24916. result.push(1);
  24917. result.push(u21Ratio);
  24918. }
  24919. if (u20Ratio !== 1) {
  24920. result.push(-1);
  24921. result.push(2);
  24922. result.push(0);
  24923. result.push(u20Ratio);
  24924. }
  24925. }
  24926. } else if (numBehind === 2) {
  24927. if (!u0Behind && u0 !== threshold) {
  24928. u10Ratio = (threshold - u12) / (u0 - u12);
  24929. u20Ratio = (threshold - u22) / (u0 - u22);
  24930. result.push(0);
  24931. result.push(-1);
  24932. result.push(1);
  24933. result.push(0);
  24934. result.push(u10Ratio);
  24935. result.push(-1);
  24936. result.push(2);
  24937. result.push(0);
  24938. result.push(u20Ratio);
  24939. } else if (!u1Behind && u12 !== threshold) {
  24940. u21Ratio = (threshold - u22) / (u12 - u22);
  24941. u01Ratio = (threshold - u0) / (u12 - u0);
  24942. result.push(1);
  24943. result.push(-1);
  24944. result.push(2);
  24945. result.push(1);
  24946. result.push(u21Ratio);
  24947. result.push(-1);
  24948. result.push(0);
  24949. result.push(1);
  24950. result.push(u01Ratio);
  24951. } else if (!u2Behind && u22 !== threshold) {
  24952. u02Ratio = (threshold - u0) / (u22 - u0);
  24953. u12Ratio = (threshold - u12) / (u22 - u12);
  24954. result.push(2);
  24955. result.push(-1);
  24956. result.push(0);
  24957. result.push(2);
  24958. result.push(u02Ratio);
  24959. result.push(-1);
  24960. result.push(1);
  24961. result.push(2);
  24962. result.push(u12Ratio);
  24963. }
  24964. } else if (numBehind !== 3) {
  24965. result.push(0);
  24966. result.push(1);
  24967. result.push(2);
  24968. }
  24969. return result;
  24970. };
  24971. Intersections2D.computeBarycentricCoordinates = function(x, y, x1, y1, x2, y2, x3, y3, result) {
  24972. if (!defined_default(x)) {
  24973. throw new DeveloperError_default("x is required.");
  24974. }
  24975. if (!defined_default(y)) {
  24976. throw new DeveloperError_default("y is required.");
  24977. }
  24978. if (!defined_default(x1)) {
  24979. throw new DeveloperError_default("x1 is required.");
  24980. }
  24981. if (!defined_default(y1)) {
  24982. throw new DeveloperError_default("y1 is required.");
  24983. }
  24984. if (!defined_default(x2)) {
  24985. throw new DeveloperError_default("x2 is required.");
  24986. }
  24987. if (!defined_default(y2)) {
  24988. throw new DeveloperError_default("y2 is required.");
  24989. }
  24990. if (!defined_default(x3)) {
  24991. throw new DeveloperError_default("x3 is required.");
  24992. }
  24993. if (!defined_default(y3)) {
  24994. throw new DeveloperError_default("y3 is required.");
  24995. }
  24996. const x1mx3 = x1 - x3;
  24997. const x3mx2 = x3 - x2;
  24998. const y2my3 = y2 - y3;
  24999. const y1my3 = y1 - y3;
  25000. const inverseDeterminant = 1 / (y2my3 * x1mx3 + x3mx2 * y1my3);
  25001. const ymy3 = y - y3;
  25002. const xmx3 = x - x3;
  25003. const l1 = (y2my3 * xmx3 + x3mx2 * ymy3) * inverseDeterminant;
  25004. const l2 = (-y1my3 * xmx3 + x1mx3 * ymy3) * inverseDeterminant;
  25005. const l3 = 1 - l1 - l2;
  25006. if (defined_default(result)) {
  25007. result.x = l1;
  25008. result.y = l2;
  25009. result.z = l3;
  25010. return result;
  25011. }
  25012. return new Cartesian3_default(l1, l2, l3);
  25013. };
  25014. Intersections2D.computeLineSegmentLineSegmentIntersection = function(x00, y00, x01, y01, x10, y10, x11, y11, result) {
  25015. Check_default.typeOf.number("x00", x00);
  25016. Check_default.typeOf.number("y00", y00);
  25017. Check_default.typeOf.number("x01", x01);
  25018. Check_default.typeOf.number("y01", y01);
  25019. Check_default.typeOf.number("x10", x10);
  25020. Check_default.typeOf.number("y10", y10);
  25021. Check_default.typeOf.number("x11", x11);
  25022. Check_default.typeOf.number("y11", y11);
  25023. const numerator1A = (x11 - x10) * (y00 - y10) - (y11 - y10) * (x00 - x10);
  25024. const numerator1B = (x01 - x00) * (y00 - y10) - (y01 - y00) * (x00 - x10);
  25025. const denominator1 = (y11 - y10) * (x01 - x00) - (x11 - x10) * (y01 - y00);
  25026. if (denominator1 === 0) {
  25027. return;
  25028. }
  25029. const ua1 = numerator1A / denominator1;
  25030. const ub1 = numerator1B / denominator1;
  25031. if (ua1 >= 0 && ua1 <= 1 && ub1 >= 0 && ub1 <= 1) {
  25032. if (!defined_default(result)) {
  25033. result = new Cartesian2_default();
  25034. }
  25035. result.x = x00 + ua1 * (x01 - x00);
  25036. result.y = y00 + ua1 * (y01 - y00);
  25037. return result;
  25038. }
  25039. };
  25040. var Intersections2D_default = Intersections2D;
  25041. // node_modules/cesium/Source/Core/QuantizedMeshTerrainData.js
  25042. function QuantizedMeshTerrainData(options) {
  25043. if (!defined_default(options) || !defined_default(options.quantizedVertices)) {
  25044. throw new DeveloperError_default("options.quantizedVertices is required.");
  25045. }
  25046. if (!defined_default(options.indices)) {
  25047. throw new DeveloperError_default("options.indices is required.");
  25048. }
  25049. if (!defined_default(options.minimumHeight)) {
  25050. throw new DeveloperError_default("options.minimumHeight is required.");
  25051. }
  25052. if (!defined_default(options.maximumHeight)) {
  25053. throw new DeveloperError_default("options.maximumHeight is required.");
  25054. }
  25055. if (!defined_default(options.maximumHeight)) {
  25056. throw new DeveloperError_default("options.maximumHeight is required.");
  25057. }
  25058. if (!defined_default(options.boundingSphere)) {
  25059. throw new DeveloperError_default("options.boundingSphere is required.");
  25060. }
  25061. if (!defined_default(options.horizonOcclusionPoint)) {
  25062. throw new DeveloperError_default("options.horizonOcclusionPoint is required.");
  25063. }
  25064. if (!defined_default(options.westIndices)) {
  25065. throw new DeveloperError_default("options.westIndices is required.");
  25066. }
  25067. if (!defined_default(options.southIndices)) {
  25068. throw new DeveloperError_default("options.southIndices is required.");
  25069. }
  25070. if (!defined_default(options.eastIndices)) {
  25071. throw new DeveloperError_default("options.eastIndices is required.");
  25072. }
  25073. if (!defined_default(options.northIndices)) {
  25074. throw new DeveloperError_default("options.northIndices is required.");
  25075. }
  25076. if (!defined_default(options.westSkirtHeight)) {
  25077. throw new DeveloperError_default("options.westSkirtHeight is required.");
  25078. }
  25079. if (!defined_default(options.southSkirtHeight)) {
  25080. throw new DeveloperError_default("options.southSkirtHeight is required.");
  25081. }
  25082. if (!defined_default(options.eastSkirtHeight)) {
  25083. throw new DeveloperError_default("options.eastSkirtHeight is required.");
  25084. }
  25085. if (!defined_default(options.northSkirtHeight)) {
  25086. throw new DeveloperError_default("options.northSkirtHeight is required.");
  25087. }
  25088. this._quantizedVertices = options.quantizedVertices;
  25089. this._encodedNormals = options.encodedNormals;
  25090. this._indices = options.indices;
  25091. this._minimumHeight = options.minimumHeight;
  25092. this._maximumHeight = options.maximumHeight;
  25093. this._boundingSphere = options.boundingSphere;
  25094. this._orientedBoundingBox = options.orientedBoundingBox;
  25095. this._horizonOcclusionPoint = options.horizonOcclusionPoint;
  25096. this._credits = options.credits;
  25097. const vertexCount = this._quantizedVertices.length / 3;
  25098. const uValues = this._uValues = this._quantizedVertices.subarray(
  25099. 0,
  25100. vertexCount
  25101. );
  25102. const vValues = this._vValues = this._quantizedVertices.subarray(
  25103. vertexCount,
  25104. 2 * vertexCount
  25105. );
  25106. this._heightValues = this._quantizedVertices.subarray(
  25107. 2 * vertexCount,
  25108. 3 * vertexCount
  25109. );
  25110. function sortByV(a4, b) {
  25111. return vValues[a4] - vValues[b];
  25112. }
  25113. function sortByU(a4, b) {
  25114. return uValues[a4] - uValues[b];
  25115. }
  25116. this._westIndices = sortIndicesIfNecessary(
  25117. options.westIndices,
  25118. sortByV,
  25119. vertexCount
  25120. );
  25121. this._southIndices = sortIndicesIfNecessary(
  25122. options.southIndices,
  25123. sortByU,
  25124. vertexCount
  25125. );
  25126. this._eastIndices = sortIndicesIfNecessary(
  25127. options.eastIndices,
  25128. sortByV,
  25129. vertexCount
  25130. );
  25131. this._northIndices = sortIndicesIfNecessary(
  25132. options.northIndices,
  25133. sortByU,
  25134. vertexCount
  25135. );
  25136. this._westSkirtHeight = options.westSkirtHeight;
  25137. this._southSkirtHeight = options.southSkirtHeight;
  25138. this._eastSkirtHeight = options.eastSkirtHeight;
  25139. this._northSkirtHeight = options.northSkirtHeight;
  25140. this._childTileMask = defaultValue_default(options.childTileMask, 15);
  25141. this._createdByUpsampling = defaultValue_default(options.createdByUpsampling, false);
  25142. this._waterMask = options.waterMask;
  25143. this._mesh = void 0;
  25144. }
  25145. Object.defineProperties(QuantizedMeshTerrainData.prototype, {
  25146. credits: {
  25147. get: function() {
  25148. return this._credits;
  25149. }
  25150. },
  25151. waterMask: {
  25152. get: function() {
  25153. return this._waterMask;
  25154. }
  25155. },
  25156. childTileMask: {
  25157. get: function() {
  25158. return this._childTileMask;
  25159. }
  25160. },
  25161. canUpsample: {
  25162. get: function() {
  25163. return defined_default(this._mesh);
  25164. }
  25165. }
  25166. });
  25167. var arrayScratch = [];
  25168. function sortIndicesIfNecessary(indices2, sortFunction, vertexCount) {
  25169. arrayScratch.length = indices2.length;
  25170. let needsSort = false;
  25171. for (let i2 = 0, len = indices2.length; i2 < len; ++i2) {
  25172. arrayScratch[i2] = indices2[i2];
  25173. needsSort = needsSort || i2 > 0 && sortFunction(indices2[i2 - 1], indices2[i2]) > 0;
  25174. }
  25175. if (needsSort) {
  25176. arrayScratch.sort(sortFunction);
  25177. return IndexDatatype_default.createTypedArray(vertexCount, arrayScratch);
  25178. }
  25179. return indices2;
  25180. }
  25181. var createMeshTaskName2 = "createVerticesFromQuantizedTerrainMesh";
  25182. var createMeshTaskProcessorNoThrottle2 = new TaskProcessor_default(createMeshTaskName2);
  25183. var createMeshTaskProcessorThrottle2 = new TaskProcessor_default(
  25184. createMeshTaskName2,
  25185. TerrainData_default.maximumAsynchronousTasks
  25186. );
  25187. QuantizedMeshTerrainData.prototype.createMesh = function(options) {
  25188. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  25189. Check_default.typeOf.object("options.tilingScheme", options.tilingScheme);
  25190. Check_default.typeOf.number("options.x", options.x);
  25191. Check_default.typeOf.number("options.y", options.y);
  25192. Check_default.typeOf.number("options.level", options.level);
  25193. const tilingScheme2 = options.tilingScheme;
  25194. const x = options.x;
  25195. const y = options.y;
  25196. const level = options.level;
  25197. const exaggeration = defaultValue_default(options.exaggeration, 1);
  25198. const exaggerationRelativeHeight = defaultValue_default(
  25199. options.exaggerationRelativeHeight,
  25200. 0
  25201. );
  25202. const throttle = defaultValue_default(options.throttle, true);
  25203. const ellipsoid = tilingScheme2.ellipsoid;
  25204. const rectangle = tilingScheme2.tileXYToRectangle(x, y, level);
  25205. const createMeshTaskProcessor = throttle ? createMeshTaskProcessorThrottle2 : createMeshTaskProcessorNoThrottle2;
  25206. const verticesPromise = createMeshTaskProcessor.scheduleTask({
  25207. minimumHeight: this._minimumHeight,
  25208. maximumHeight: this._maximumHeight,
  25209. quantizedVertices: this._quantizedVertices,
  25210. octEncodedNormals: this._encodedNormals,
  25211. includeWebMercatorT: true,
  25212. indices: this._indices,
  25213. westIndices: this._westIndices,
  25214. southIndices: this._southIndices,
  25215. eastIndices: this._eastIndices,
  25216. northIndices: this._northIndices,
  25217. westSkirtHeight: this._westSkirtHeight,
  25218. southSkirtHeight: this._southSkirtHeight,
  25219. eastSkirtHeight: this._eastSkirtHeight,
  25220. northSkirtHeight: this._northSkirtHeight,
  25221. rectangle,
  25222. relativeToCenter: this._boundingSphere.center,
  25223. ellipsoid,
  25224. exaggeration,
  25225. exaggerationRelativeHeight
  25226. });
  25227. if (!defined_default(verticesPromise)) {
  25228. return void 0;
  25229. }
  25230. const that = this;
  25231. return Promise.resolve(verticesPromise).then(function(result) {
  25232. const vertexCountWithoutSkirts = that._quantizedVertices.length / 3;
  25233. const vertexCount = vertexCountWithoutSkirts + that._westIndices.length + that._southIndices.length + that._eastIndices.length + that._northIndices.length;
  25234. const indicesTypedArray = IndexDatatype_default.createTypedArray(
  25235. vertexCount,
  25236. result.indices
  25237. );
  25238. const vertices = new Float32Array(result.vertices);
  25239. const rtc = result.center;
  25240. const minimumHeight = result.minimumHeight;
  25241. const maximumHeight = result.maximumHeight;
  25242. const boundingSphere = that._boundingSphere;
  25243. const obb = that._orientedBoundingBox;
  25244. const occludeePointInScaledSpace = defaultValue_default(
  25245. Cartesian3_default.clone(result.occludeePointInScaledSpace),
  25246. that._horizonOcclusionPoint
  25247. );
  25248. const stride = result.vertexStride;
  25249. const terrainEncoding = TerrainEncoding_default.clone(result.encoding);
  25250. that._mesh = new TerrainMesh_default(
  25251. rtc,
  25252. vertices,
  25253. indicesTypedArray,
  25254. result.indexCountWithoutSkirts,
  25255. vertexCountWithoutSkirts,
  25256. minimumHeight,
  25257. maximumHeight,
  25258. boundingSphere,
  25259. occludeePointInScaledSpace,
  25260. stride,
  25261. obb,
  25262. terrainEncoding,
  25263. result.westIndicesSouthToNorth,
  25264. result.southIndicesEastToWest,
  25265. result.eastIndicesNorthToSouth,
  25266. result.northIndicesWestToEast
  25267. );
  25268. that._quantizedVertices = void 0;
  25269. that._encodedNormals = void 0;
  25270. that._indices = void 0;
  25271. that._uValues = void 0;
  25272. that._vValues = void 0;
  25273. that._heightValues = void 0;
  25274. that._westIndices = void 0;
  25275. that._southIndices = void 0;
  25276. that._eastIndices = void 0;
  25277. that._northIndices = void 0;
  25278. return that._mesh;
  25279. });
  25280. };
  25281. var upsampleTaskProcessor = new TaskProcessor_default(
  25282. "upsampleQuantizedTerrainMesh",
  25283. TerrainData_default.maximumAsynchronousTasks
  25284. );
  25285. QuantizedMeshTerrainData.prototype.upsample = function(tilingScheme2, thisX, thisY, thisLevel, descendantX, descendantY, descendantLevel) {
  25286. if (!defined_default(tilingScheme2)) {
  25287. throw new DeveloperError_default("tilingScheme is required.");
  25288. }
  25289. if (!defined_default(thisX)) {
  25290. throw new DeveloperError_default("thisX is required.");
  25291. }
  25292. if (!defined_default(thisY)) {
  25293. throw new DeveloperError_default("thisY is required.");
  25294. }
  25295. if (!defined_default(thisLevel)) {
  25296. throw new DeveloperError_default("thisLevel is required.");
  25297. }
  25298. if (!defined_default(descendantX)) {
  25299. throw new DeveloperError_default("descendantX is required.");
  25300. }
  25301. if (!defined_default(descendantY)) {
  25302. throw new DeveloperError_default("descendantY is required.");
  25303. }
  25304. if (!defined_default(descendantLevel)) {
  25305. throw new DeveloperError_default("descendantLevel is required.");
  25306. }
  25307. const levelDifference = descendantLevel - thisLevel;
  25308. if (levelDifference > 1) {
  25309. throw new DeveloperError_default(
  25310. "Upsampling through more than one level at a time is not currently supported."
  25311. );
  25312. }
  25313. const mesh2 = this._mesh;
  25314. if (!defined_default(this._mesh)) {
  25315. return void 0;
  25316. }
  25317. const isEastChild = thisX * 2 !== descendantX;
  25318. const isNorthChild = thisY * 2 === descendantY;
  25319. const ellipsoid = tilingScheme2.ellipsoid;
  25320. const childRectangle = tilingScheme2.tileXYToRectangle(
  25321. descendantX,
  25322. descendantY,
  25323. descendantLevel
  25324. );
  25325. const upsamplePromise = upsampleTaskProcessor.scheduleTask({
  25326. vertices: mesh2.vertices,
  25327. vertexCountWithoutSkirts: mesh2.vertexCountWithoutSkirts,
  25328. indices: mesh2.indices,
  25329. indexCountWithoutSkirts: mesh2.indexCountWithoutSkirts,
  25330. encoding: mesh2.encoding,
  25331. minimumHeight: this._minimumHeight,
  25332. maximumHeight: this._maximumHeight,
  25333. isEastChild,
  25334. isNorthChild,
  25335. childRectangle,
  25336. ellipsoid
  25337. });
  25338. if (!defined_default(upsamplePromise)) {
  25339. return void 0;
  25340. }
  25341. let shortestSkirt = Math.min(this._westSkirtHeight, this._eastSkirtHeight);
  25342. shortestSkirt = Math.min(shortestSkirt, this._southSkirtHeight);
  25343. shortestSkirt = Math.min(shortestSkirt, this._northSkirtHeight);
  25344. const westSkirtHeight = isEastChild ? shortestSkirt * 0.5 : this._westSkirtHeight;
  25345. const southSkirtHeight = isNorthChild ? shortestSkirt * 0.5 : this._southSkirtHeight;
  25346. const eastSkirtHeight = isEastChild ? this._eastSkirtHeight : shortestSkirt * 0.5;
  25347. const northSkirtHeight = isNorthChild ? this._northSkirtHeight : shortestSkirt * 0.5;
  25348. const credits = this._credits;
  25349. return Promise.resolve(upsamplePromise).then(function(result) {
  25350. const quantizedVertices = new Uint16Array(result.vertices);
  25351. const indicesTypedArray = IndexDatatype_default.createTypedArray(
  25352. quantizedVertices.length / 3,
  25353. result.indices
  25354. );
  25355. let encodedNormals;
  25356. if (defined_default(result.encodedNormals)) {
  25357. encodedNormals = new Uint8Array(result.encodedNormals);
  25358. }
  25359. return new QuantizedMeshTerrainData({
  25360. quantizedVertices,
  25361. indices: indicesTypedArray,
  25362. encodedNormals,
  25363. minimumHeight: result.minimumHeight,
  25364. maximumHeight: result.maximumHeight,
  25365. boundingSphere: BoundingSphere_default.clone(result.boundingSphere),
  25366. orientedBoundingBox: OrientedBoundingBox_default.clone(
  25367. result.orientedBoundingBox
  25368. ),
  25369. horizonOcclusionPoint: Cartesian3_default.clone(result.horizonOcclusionPoint),
  25370. westIndices: result.westIndices,
  25371. southIndices: result.southIndices,
  25372. eastIndices: result.eastIndices,
  25373. northIndices: result.northIndices,
  25374. westSkirtHeight,
  25375. southSkirtHeight,
  25376. eastSkirtHeight,
  25377. northSkirtHeight,
  25378. childTileMask: 0,
  25379. credits,
  25380. createdByUpsampling: true
  25381. });
  25382. });
  25383. };
  25384. var maxShort = 32767;
  25385. var barycentricCoordinateScratch = new Cartesian3_default();
  25386. QuantizedMeshTerrainData.prototype.interpolateHeight = function(rectangle, longitude, latitude) {
  25387. let u3 = Math_default.clamp(
  25388. (longitude - rectangle.west) / rectangle.width,
  25389. 0,
  25390. 1
  25391. );
  25392. u3 *= maxShort;
  25393. let v7 = Math_default.clamp(
  25394. (latitude - rectangle.south) / rectangle.height,
  25395. 0,
  25396. 1
  25397. );
  25398. v7 *= maxShort;
  25399. if (!defined_default(this._mesh)) {
  25400. return interpolateHeight2(this, u3, v7);
  25401. }
  25402. return interpolateMeshHeight2(this, u3, v7);
  25403. };
  25404. function pointInBoundingBox(u3, v7, u0, v02, u12, v13, u22, v23) {
  25405. const minU = Math.min(u0, u12, u22);
  25406. const maxU = Math.max(u0, u12, u22);
  25407. const minV = Math.min(v02, v13, v23);
  25408. const maxV = Math.max(v02, v13, v23);
  25409. return u3 >= minU && u3 <= maxU && v7 >= minV && v7 <= maxV;
  25410. }
  25411. var texCoordScratch0 = new Cartesian2_default();
  25412. var texCoordScratch1 = new Cartesian2_default();
  25413. var texCoordScratch2 = new Cartesian2_default();
  25414. function interpolateMeshHeight2(terrainData, u3, v7) {
  25415. const mesh2 = terrainData._mesh;
  25416. const vertices = mesh2.vertices;
  25417. const encoding = mesh2.encoding;
  25418. const indices2 = mesh2.indices;
  25419. for (let i2 = 0, len = indices2.length; i2 < len; i2 += 3) {
  25420. const i0 = indices2[i2];
  25421. const i1 = indices2[i2 + 1];
  25422. const i22 = indices2[i2 + 2];
  25423. const uv0 = encoding.decodeTextureCoordinates(
  25424. vertices,
  25425. i0,
  25426. texCoordScratch0
  25427. );
  25428. const uv1 = encoding.decodeTextureCoordinates(
  25429. vertices,
  25430. i1,
  25431. texCoordScratch1
  25432. );
  25433. const uv2 = encoding.decodeTextureCoordinates(
  25434. vertices,
  25435. i22,
  25436. texCoordScratch2
  25437. );
  25438. if (pointInBoundingBox(u3, v7, uv0.x, uv0.y, uv1.x, uv1.y, uv2.x, uv2.y)) {
  25439. const barycentric = Intersections2D_default.computeBarycentricCoordinates(
  25440. u3,
  25441. v7,
  25442. uv0.x,
  25443. uv0.y,
  25444. uv1.x,
  25445. uv1.y,
  25446. uv2.x,
  25447. uv2.y,
  25448. barycentricCoordinateScratch
  25449. );
  25450. if (barycentric.x >= -1e-15 && barycentric.y >= -1e-15 && barycentric.z >= -1e-15) {
  25451. const h0 = encoding.decodeHeight(vertices, i0);
  25452. const h1 = encoding.decodeHeight(vertices, i1);
  25453. const h2 = encoding.decodeHeight(vertices, i22);
  25454. return barycentric.x * h0 + barycentric.y * h1 + barycentric.z * h2;
  25455. }
  25456. }
  25457. }
  25458. return void 0;
  25459. }
  25460. function interpolateHeight2(terrainData, u3, v7) {
  25461. const uBuffer = terrainData._uValues;
  25462. const vBuffer = terrainData._vValues;
  25463. const heightBuffer = terrainData._heightValues;
  25464. const indices2 = terrainData._indices;
  25465. for (let i2 = 0, len = indices2.length; i2 < len; i2 += 3) {
  25466. const i0 = indices2[i2];
  25467. const i1 = indices2[i2 + 1];
  25468. const i22 = indices2[i2 + 2];
  25469. const u0 = uBuffer[i0];
  25470. const u12 = uBuffer[i1];
  25471. const u22 = uBuffer[i22];
  25472. const v02 = vBuffer[i0];
  25473. const v13 = vBuffer[i1];
  25474. const v23 = vBuffer[i22];
  25475. if (pointInBoundingBox(u3, v7, u0, v02, u12, v13, u22, v23)) {
  25476. const barycentric = Intersections2D_default.computeBarycentricCoordinates(
  25477. u3,
  25478. v7,
  25479. u0,
  25480. v02,
  25481. u12,
  25482. v13,
  25483. u22,
  25484. v23,
  25485. barycentricCoordinateScratch
  25486. );
  25487. if (barycentric.x >= -1e-15 && barycentric.y >= -1e-15 && barycentric.z >= -1e-15) {
  25488. const quantizedHeight = barycentric.x * heightBuffer[i0] + barycentric.y * heightBuffer[i1] + barycentric.z * heightBuffer[i22];
  25489. return Math_default.lerp(
  25490. terrainData._minimumHeight,
  25491. terrainData._maximumHeight,
  25492. quantizedHeight / maxShort
  25493. );
  25494. }
  25495. }
  25496. }
  25497. return void 0;
  25498. }
  25499. QuantizedMeshTerrainData.prototype.isChildAvailable = function(thisX, thisY, childX, childY) {
  25500. if (!defined_default(thisX)) {
  25501. throw new DeveloperError_default("thisX is required.");
  25502. }
  25503. if (!defined_default(thisY)) {
  25504. throw new DeveloperError_default("thisY is required.");
  25505. }
  25506. if (!defined_default(childX)) {
  25507. throw new DeveloperError_default("childX is required.");
  25508. }
  25509. if (!defined_default(childY)) {
  25510. throw new DeveloperError_default("childY is required.");
  25511. }
  25512. let bitNumber = 2;
  25513. if (childX !== thisX * 2) {
  25514. ++bitNumber;
  25515. }
  25516. if (childY !== thisY * 2) {
  25517. bitNumber -= 2;
  25518. }
  25519. return (this._childTileMask & 1 << bitNumber) !== 0;
  25520. };
  25521. QuantizedMeshTerrainData.prototype.wasCreatedByUpsampling = function() {
  25522. return this._createdByUpsampling;
  25523. };
  25524. var QuantizedMeshTerrainData_default = QuantizedMeshTerrainData;
  25525. // node_modules/cesium/Source/Core/CesiumTerrainProvider.js
  25526. function LayerInformation(layer) {
  25527. this.resource = layer.resource;
  25528. this.version = layer.version;
  25529. this.isHeightmap = layer.isHeightmap;
  25530. this.tileUrlTemplates = layer.tileUrlTemplates;
  25531. this.availability = layer.availability;
  25532. this.hasVertexNormals = layer.hasVertexNormals;
  25533. this.hasWaterMask = layer.hasWaterMask;
  25534. this.hasMetadata = layer.hasMetadata;
  25535. this.availabilityLevels = layer.availabilityLevels;
  25536. this.availabilityTilesLoaded = layer.availabilityTilesLoaded;
  25537. this.littleEndianExtensionSize = layer.littleEndianExtensionSize;
  25538. this.availabilityPromiseCache = {};
  25539. }
  25540. function CesiumTerrainProvider(options) {
  25541. if (!defined_default(options) || !defined_default(options.url)) {
  25542. throw new DeveloperError_default("options.url is required.");
  25543. }
  25544. this._heightmapWidth = 65;
  25545. this._heightmapStructure = void 0;
  25546. this._hasWaterMask = false;
  25547. this._hasVertexNormals = false;
  25548. this._ellipsoid = options.ellipsoid;
  25549. this._requestVertexNormals = defaultValue_default(
  25550. options.requestVertexNormals,
  25551. false
  25552. );
  25553. this._requestWaterMask = defaultValue_default(options.requestWaterMask, false);
  25554. this._requestMetadata = defaultValue_default(options.requestMetadata, true);
  25555. this._errorEvent = new Event_default();
  25556. let credit = options.credit;
  25557. if (typeof credit === "string") {
  25558. credit = new Credit_default(credit);
  25559. }
  25560. this._credit = credit;
  25561. this._availability = void 0;
  25562. const deferred = defer_default();
  25563. this._ready = false;
  25564. this._readyPromise = deferred;
  25565. this._tileCredits = void 0;
  25566. const that = this;
  25567. let lastResource;
  25568. let layerJsonResource;
  25569. let metadataError;
  25570. const layers = this._layers = [];
  25571. let attribution = "";
  25572. const overallAvailability = [];
  25573. let overallMaxZoom = 0;
  25574. Promise.resolve(options.url).then(function(url2) {
  25575. const resource = Resource_default.createIfNeeded(url2);
  25576. resource.appendForwardSlash();
  25577. lastResource = resource;
  25578. layerJsonResource = lastResource.getDerivedResource({
  25579. url: "layer.json"
  25580. });
  25581. that._tileCredits = resource.credits;
  25582. requestLayerJson();
  25583. }).catch(function(e2) {
  25584. deferred.reject(e2);
  25585. });
  25586. function parseMetadataSuccess(data) {
  25587. let message;
  25588. if (!data.format) {
  25589. message = "The tile format is not specified in the layer.json file.";
  25590. metadataError = TileProviderError_default.handleError(
  25591. metadataError,
  25592. that,
  25593. that._errorEvent,
  25594. message,
  25595. void 0,
  25596. void 0,
  25597. void 0,
  25598. requestLayerJson
  25599. );
  25600. return;
  25601. }
  25602. if (!data.tiles || data.tiles.length === 0) {
  25603. message = "The layer.json file does not specify any tile URL templates.";
  25604. metadataError = TileProviderError_default.handleError(
  25605. metadataError,
  25606. that,
  25607. that._errorEvent,
  25608. message,
  25609. void 0,
  25610. void 0,
  25611. void 0,
  25612. requestLayerJson
  25613. );
  25614. return;
  25615. }
  25616. let hasVertexNormals = false;
  25617. let hasWaterMask = false;
  25618. let hasMetadata = false;
  25619. let littleEndianExtensionSize = true;
  25620. let isHeightmap = false;
  25621. if (data.format === "heightmap-1.0") {
  25622. isHeightmap = true;
  25623. if (!defined_default(that._heightmapStructure)) {
  25624. that._heightmapStructure = {
  25625. heightScale: 1 / 5,
  25626. heightOffset: -1e3,
  25627. elementsPerHeight: 1,
  25628. stride: 1,
  25629. elementMultiplier: 256,
  25630. isBigEndian: false,
  25631. lowestEncodedHeight: 0,
  25632. highestEncodedHeight: 256 * 256 - 1
  25633. };
  25634. }
  25635. hasWaterMask = true;
  25636. that._requestWaterMask = true;
  25637. } else if (data.format.indexOf("quantized-mesh-1.") !== 0) {
  25638. message = `The tile format "${data.format}" is invalid or not supported.`;
  25639. metadataError = TileProviderError_default.handleError(
  25640. metadataError,
  25641. that,
  25642. that._errorEvent,
  25643. message,
  25644. void 0,
  25645. void 0,
  25646. void 0,
  25647. requestLayerJson
  25648. );
  25649. return;
  25650. }
  25651. const tileUrlTemplates = data.tiles;
  25652. const maxZoom = data.maxzoom;
  25653. overallMaxZoom = Math.max(overallMaxZoom, maxZoom);
  25654. if (!data.projection || data.projection === "EPSG:4326") {
  25655. that._tilingScheme = new GeographicTilingScheme_default({
  25656. numberOfLevelZeroTilesX: 2,
  25657. numberOfLevelZeroTilesY: 1,
  25658. ellipsoid: that._ellipsoid
  25659. });
  25660. } else if (data.projection === "EPSG:3857") {
  25661. that._tilingScheme = new WebMercatorTilingScheme_default({
  25662. numberOfLevelZeroTilesX: 1,
  25663. numberOfLevelZeroTilesY: 1,
  25664. ellipsoid: that._ellipsoid
  25665. });
  25666. } else {
  25667. message = `The projection "${data.projection}" is invalid or not supported.`;
  25668. metadataError = TileProviderError_default.handleError(
  25669. metadataError,
  25670. that,
  25671. that._errorEvent,
  25672. message,
  25673. void 0,
  25674. void 0,
  25675. void 0,
  25676. requestLayerJson
  25677. );
  25678. return;
  25679. }
  25680. that._levelZeroMaximumGeometricError = TerrainProvider_default.getEstimatedLevelZeroGeometricErrorForAHeightmap(
  25681. that._tilingScheme.ellipsoid,
  25682. that._heightmapWidth,
  25683. that._tilingScheme.getNumberOfXTilesAtLevel(0)
  25684. );
  25685. if (!data.scheme || data.scheme === "tms" || data.scheme === "slippyMap") {
  25686. that._scheme = data.scheme;
  25687. } else {
  25688. message = `The scheme "${data.scheme}" is invalid or not supported.`;
  25689. metadataError = TileProviderError_default.handleError(
  25690. metadataError,
  25691. that,
  25692. that._errorEvent,
  25693. message,
  25694. void 0,
  25695. void 0,
  25696. void 0,
  25697. requestLayerJson
  25698. );
  25699. return;
  25700. }
  25701. let availabilityTilesLoaded;
  25702. if (defined_default(data.extensions) && data.extensions.indexOf("octvertexnormals") !== -1) {
  25703. hasVertexNormals = true;
  25704. } else if (defined_default(data.extensions) && data.extensions.indexOf("vertexnormals") !== -1) {
  25705. hasVertexNormals = true;
  25706. littleEndianExtensionSize = false;
  25707. }
  25708. if (defined_default(data.extensions) && data.extensions.indexOf("watermask") !== -1) {
  25709. hasWaterMask = true;
  25710. }
  25711. if (defined_default(data.extensions) && data.extensions.indexOf("metadata") !== -1) {
  25712. hasMetadata = true;
  25713. }
  25714. const availabilityLevels = data.metadataAvailability;
  25715. const availableTiles = data.available;
  25716. let availability;
  25717. if (defined_default(availableTiles) && !defined_default(availabilityLevels)) {
  25718. availability = new TileAvailability_default(
  25719. that._tilingScheme,
  25720. availableTiles.length
  25721. );
  25722. for (let level = 0; level < availableTiles.length; ++level) {
  25723. const rangesAtLevel = availableTiles[level];
  25724. const yTiles = that._tilingScheme.getNumberOfYTilesAtLevel(level);
  25725. if (!defined_default(overallAvailability[level])) {
  25726. overallAvailability[level] = [];
  25727. }
  25728. for (let rangeIndex = 0; rangeIndex < rangesAtLevel.length; ++rangeIndex) {
  25729. const range2 = rangesAtLevel[rangeIndex];
  25730. const yStart = yTiles - range2.endY - 1;
  25731. const yEnd = yTiles - range2.startY - 1;
  25732. overallAvailability[level].push([
  25733. range2.startX,
  25734. yStart,
  25735. range2.endX,
  25736. yEnd
  25737. ]);
  25738. availability.addAvailableTileRange(
  25739. level,
  25740. range2.startX,
  25741. yStart,
  25742. range2.endX,
  25743. yEnd
  25744. );
  25745. }
  25746. }
  25747. } else if (defined_default(availabilityLevels)) {
  25748. availabilityTilesLoaded = new TileAvailability_default(
  25749. that._tilingScheme,
  25750. maxZoom
  25751. );
  25752. availability = new TileAvailability_default(that._tilingScheme, maxZoom);
  25753. overallAvailability[0] = [[0, 0, 1, 0]];
  25754. availability.addAvailableTileRange(0, 0, 0, 1, 0);
  25755. }
  25756. that._hasWaterMask = that._hasWaterMask || hasWaterMask;
  25757. that._hasVertexNormals = that._hasVertexNormals || hasVertexNormals;
  25758. that._hasMetadata = that._hasMetadata || hasMetadata;
  25759. if (defined_default(data.attribution)) {
  25760. if (attribution.length > 0) {
  25761. attribution += " ";
  25762. }
  25763. attribution += data.attribution;
  25764. }
  25765. layers.push(
  25766. new LayerInformation({
  25767. resource: lastResource,
  25768. version: data.version,
  25769. isHeightmap,
  25770. tileUrlTemplates,
  25771. availability,
  25772. hasVertexNormals,
  25773. hasWaterMask,
  25774. hasMetadata,
  25775. availabilityLevels,
  25776. availabilityTilesLoaded,
  25777. littleEndianExtensionSize
  25778. })
  25779. );
  25780. const parentUrl = data.parentUrl;
  25781. if (defined_default(parentUrl)) {
  25782. if (!defined_default(availability)) {
  25783. console.log(
  25784. "A layer.json can't have a parentUrl if it does't have an available array."
  25785. );
  25786. return Promise.resolve();
  25787. }
  25788. lastResource = lastResource.getDerivedResource({
  25789. url: parentUrl
  25790. });
  25791. lastResource.appendForwardSlash();
  25792. layerJsonResource = lastResource.getDerivedResource({
  25793. url: "layer.json"
  25794. });
  25795. const parentMetadata = layerJsonResource.fetchJson();
  25796. return Promise.resolve(parentMetadata).then(parseMetadataSuccess).catch(parseMetadataFailure);
  25797. }
  25798. return Promise.resolve();
  25799. }
  25800. function parseMetadataFailure(data) {
  25801. const message = `An error occurred while accessing ${layerJsonResource.url}.`;
  25802. metadataError = TileProviderError_default.handleError(
  25803. metadataError,
  25804. that,
  25805. that._errorEvent,
  25806. message,
  25807. void 0,
  25808. void 0,
  25809. void 0,
  25810. requestLayerJson
  25811. );
  25812. }
  25813. function metadataSuccess(data) {
  25814. parseMetadataSuccess(data).then(function() {
  25815. if (defined_default(metadataError)) {
  25816. return;
  25817. }
  25818. const length3 = overallAvailability.length;
  25819. if (length3 > 0) {
  25820. const availability = that._availability = new TileAvailability_default(
  25821. that._tilingScheme,
  25822. overallMaxZoom
  25823. );
  25824. for (let level = 0; level < length3; ++level) {
  25825. const levelRanges = overallAvailability[level];
  25826. for (let i2 = 0; i2 < levelRanges.length; ++i2) {
  25827. const range2 = levelRanges[i2];
  25828. availability.addAvailableTileRange(
  25829. level,
  25830. range2[0],
  25831. range2[1],
  25832. range2[2],
  25833. range2[3]
  25834. );
  25835. }
  25836. }
  25837. }
  25838. if (attribution.length > 0) {
  25839. const layerJsonCredit = new Credit_default(attribution);
  25840. if (defined_default(that._tileCredits)) {
  25841. that._tileCredits.push(layerJsonCredit);
  25842. } else {
  25843. that._tileCredits = [layerJsonCredit];
  25844. }
  25845. }
  25846. that._ready = true;
  25847. that._readyPromise.resolve(true);
  25848. });
  25849. }
  25850. function metadataFailure(data) {
  25851. if (defined_default(data) && data.statusCode === 404) {
  25852. metadataSuccess({
  25853. tilejson: "2.1.0",
  25854. format: "heightmap-1.0",
  25855. version: "1.0.0",
  25856. scheme: "tms",
  25857. tiles: ["{z}/{x}/{y}.terrain?v={version}"]
  25858. });
  25859. return;
  25860. }
  25861. parseMetadataFailure(data);
  25862. }
  25863. function requestLayerJson() {
  25864. Promise.resolve(layerJsonResource.fetchJson()).then(metadataSuccess).catch(metadataFailure);
  25865. }
  25866. }
  25867. var QuantizedMeshExtensionIds = {
  25868. OCT_VERTEX_NORMALS: 1,
  25869. WATER_MASK: 2,
  25870. METADATA: 4
  25871. };
  25872. function getRequestHeader(extensionsList) {
  25873. if (!defined_default(extensionsList) || extensionsList.length === 0) {
  25874. return {
  25875. Accept: "application/vnd.quantized-mesh,application/octet-stream;q=0.9,*/*;q=0.01"
  25876. };
  25877. }
  25878. const extensions = extensionsList.join("-");
  25879. return {
  25880. Accept: `application/vnd.quantized-mesh;extensions=${extensions},application/octet-stream;q=0.9,*/*;q=0.01`
  25881. };
  25882. }
  25883. function createHeightmapTerrainData(provider, buffer, level, x, y) {
  25884. const heightBuffer = new Uint16Array(
  25885. buffer,
  25886. 0,
  25887. provider._heightmapWidth * provider._heightmapWidth
  25888. );
  25889. return new HeightmapTerrainData_default({
  25890. buffer: heightBuffer,
  25891. childTileMask: new Uint8Array(buffer, heightBuffer.byteLength, 1)[0],
  25892. waterMask: new Uint8Array(
  25893. buffer,
  25894. heightBuffer.byteLength + 1,
  25895. buffer.byteLength - heightBuffer.byteLength - 1
  25896. ),
  25897. width: provider._heightmapWidth,
  25898. height: provider._heightmapWidth,
  25899. structure: provider._heightmapStructure,
  25900. credits: provider._tileCredits
  25901. });
  25902. }
  25903. function createQuantizedMeshTerrainData(provider, buffer, level, x, y, layer) {
  25904. const littleEndianExtensionSize = layer.littleEndianExtensionSize;
  25905. let pos = 0;
  25906. const cartesian3Elements = 3;
  25907. const boundingSphereElements = cartesian3Elements + 1;
  25908. const cartesian3Length = Float64Array.BYTES_PER_ELEMENT * cartesian3Elements;
  25909. const boundingSphereLength = Float64Array.BYTES_PER_ELEMENT * boundingSphereElements;
  25910. const encodedVertexElements = 3;
  25911. const encodedVertexLength = Uint16Array.BYTES_PER_ELEMENT * encodedVertexElements;
  25912. const triangleElements = 3;
  25913. let bytesPerIndex = Uint16Array.BYTES_PER_ELEMENT;
  25914. let triangleLength = bytesPerIndex * triangleElements;
  25915. const view = new DataView(buffer);
  25916. const center = new Cartesian3_default(
  25917. view.getFloat64(pos, true),
  25918. view.getFloat64(pos + 8, true),
  25919. view.getFloat64(pos + 16, true)
  25920. );
  25921. pos += cartesian3Length;
  25922. const minimumHeight = view.getFloat32(pos, true);
  25923. pos += Float32Array.BYTES_PER_ELEMENT;
  25924. const maximumHeight = view.getFloat32(pos, true);
  25925. pos += Float32Array.BYTES_PER_ELEMENT;
  25926. const boundingSphere = new BoundingSphere_default(
  25927. new Cartesian3_default(
  25928. view.getFloat64(pos, true),
  25929. view.getFloat64(pos + 8, true),
  25930. view.getFloat64(pos + 16, true)
  25931. ),
  25932. view.getFloat64(pos + cartesian3Length, true)
  25933. );
  25934. pos += boundingSphereLength;
  25935. const horizonOcclusionPoint = new Cartesian3_default(
  25936. view.getFloat64(pos, true),
  25937. view.getFloat64(pos + 8, true),
  25938. view.getFloat64(pos + 16, true)
  25939. );
  25940. pos += cartesian3Length;
  25941. const vertexCount = view.getUint32(pos, true);
  25942. pos += Uint32Array.BYTES_PER_ELEMENT;
  25943. const encodedVertexBuffer = new Uint16Array(buffer, pos, vertexCount * 3);
  25944. pos += vertexCount * encodedVertexLength;
  25945. if (vertexCount > 64 * 1024) {
  25946. bytesPerIndex = Uint32Array.BYTES_PER_ELEMENT;
  25947. triangleLength = bytesPerIndex * triangleElements;
  25948. }
  25949. const uBuffer = encodedVertexBuffer.subarray(0, vertexCount);
  25950. const vBuffer = encodedVertexBuffer.subarray(vertexCount, 2 * vertexCount);
  25951. const heightBuffer = encodedVertexBuffer.subarray(
  25952. vertexCount * 2,
  25953. 3 * vertexCount
  25954. );
  25955. AttributeCompression_default.zigZagDeltaDecode(uBuffer, vBuffer, heightBuffer);
  25956. if (pos % bytesPerIndex !== 0) {
  25957. pos += bytesPerIndex - pos % bytesPerIndex;
  25958. }
  25959. const triangleCount = view.getUint32(pos, true);
  25960. pos += Uint32Array.BYTES_PER_ELEMENT;
  25961. const indices2 = IndexDatatype_default.createTypedArrayFromArrayBuffer(
  25962. vertexCount,
  25963. buffer,
  25964. pos,
  25965. triangleCount * triangleElements
  25966. );
  25967. pos += triangleCount * triangleLength;
  25968. let highest = 0;
  25969. const length3 = indices2.length;
  25970. for (let i2 = 0; i2 < length3; ++i2) {
  25971. const code = indices2[i2];
  25972. indices2[i2] = highest - code;
  25973. if (code === 0) {
  25974. ++highest;
  25975. }
  25976. }
  25977. const westVertexCount = view.getUint32(pos, true);
  25978. pos += Uint32Array.BYTES_PER_ELEMENT;
  25979. const westIndices = IndexDatatype_default.createTypedArrayFromArrayBuffer(
  25980. vertexCount,
  25981. buffer,
  25982. pos,
  25983. westVertexCount
  25984. );
  25985. pos += westVertexCount * bytesPerIndex;
  25986. const southVertexCount = view.getUint32(pos, true);
  25987. pos += Uint32Array.BYTES_PER_ELEMENT;
  25988. const southIndices = IndexDatatype_default.createTypedArrayFromArrayBuffer(
  25989. vertexCount,
  25990. buffer,
  25991. pos,
  25992. southVertexCount
  25993. );
  25994. pos += southVertexCount * bytesPerIndex;
  25995. const eastVertexCount = view.getUint32(pos, true);
  25996. pos += Uint32Array.BYTES_PER_ELEMENT;
  25997. const eastIndices = IndexDatatype_default.createTypedArrayFromArrayBuffer(
  25998. vertexCount,
  25999. buffer,
  26000. pos,
  26001. eastVertexCount
  26002. );
  26003. pos += eastVertexCount * bytesPerIndex;
  26004. const northVertexCount = view.getUint32(pos, true);
  26005. pos += Uint32Array.BYTES_PER_ELEMENT;
  26006. const northIndices = IndexDatatype_default.createTypedArrayFromArrayBuffer(
  26007. vertexCount,
  26008. buffer,
  26009. pos,
  26010. northVertexCount
  26011. );
  26012. pos += northVertexCount * bytesPerIndex;
  26013. let encodedNormalBuffer;
  26014. let waterMaskBuffer;
  26015. while (pos < view.byteLength) {
  26016. const extensionId = view.getUint8(pos, true);
  26017. pos += Uint8Array.BYTES_PER_ELEMENT;
  26018. const extensionLength = view.getUint32(pos, littleEndianExtensionSize);
  26019. pos += Uint32Array.BYTES_PER_ELEMENT;
  26020. if (extensionId === QuantizedMeshExtensionIds.OCT_VERTEX_NORMALS && provider._requestVertexNormals) {
  26021. encodedNormalBuffer = new Uint8Array(buffer, pos, vertexCount * 2);
  26022. } else if (extensionId === QuantizedMeshExtensionIds.WATER_MASK && provider._requestWaterMask) {
  26023. waterMaskBuffer = new Uint8Array(buffer, pos, extensionLength);
  26024. } else if (extensionId === QuantizedMeshExtensionIds.METADATA && provider._requestMetadata) {
  26025. const stringLength = view.getUint32(pos, true);
  26026. if (stringLength > 0) {
  26027. const metadata = getJsonFromTypedArray_default(
  26028. new Uint8Array(buffer),
  26029. pos + Uint32Array.BYTES_PER_ELEMENT,
  26030. stringLength
  26031. );
  26032. const availableTiles = metadata.available;
  26033. if (defined_default(availableTiles)) {
  26034. for (let offset2 = 0; offset2 < availableTiles.length; ++offset2) {
  26035. const availableLevel = level + offset2 + 1;
  26036. const rangesAtLevel = availableTiles[offset2];
  26037. const yTiles = provider._tilingScheme.getNumberOfYTilesAtLevel(
  26038. availableLevel
  26039. );
  26040. for (let rangeIndex = 0; rangeIndex < rangesAtLevel.length; ++rangeIndex) {
  26041. const range2 = rangesAtLevel[rangeIndex];
  26042. const yStart = yTiles - range2.endY - 1;
  26043. const yEnd = yTiles - range2.startY - 1;
  26044. provider.availability.addAvailableTileRange(
  26045. availableLevel,
  26046. range2.startX,
  26047. yStart,
  26048. range2.endX,
  26049. yEnd
  26050. );
  26051. layer.availability.addAvailableTileRange(
  26052. availableLevel,
  26053. range2.startX,
  26054. yStart,
  26055. range2.endX,
  26056. yEnd
  26057. );
  26058. }
  26059. }
  26060. }
  26061. }
  26062. layer.availabilityTilesLoaded.addAvailableTileRange(level, x, y, x, y);
  26063. }
  26064. pos += extensionLength;
  26065. }
  26066. const skirtHeight = provider.getLevelMaximumGeometricError(level) * 5;
  26067. const rectangle = provider._tilingScheme.tileXYToRectangle(x, y, level);
  26068. const orientedBoundingBox = OrientedBoundingBox_default.fromRectangle(
  26069. rectangle,
  26070. minimumHeight,
  26071. maximumHeight,
  26072. provider._tilingScheme.ellipsoid
  26073. );
  26074. return new QuantizedMeshTerrainData_default({
  26075. center,
  26076. minimumHeight,
  26077. maximumHeight,
  26078. boundingSphere,
  26079. orientedBoundingBox,
  26080. horizonOcclusionPoint,
  26081. quantizedVertices: encodedVertexBuffer,
  26082. encodedNormals: encodedNormalBuffer,
  26083. indices: indices2,
  26084. westIndices,
  26085. southIndices,
  26086. eastIndices,
  26087. northIndices,
  26088. westSkirtHeight: skirtHeight,
  26089. southSkirtHeight: skirtHeight,
  26090. eastSkirtHeight: skirtHeight,
  26091. northSkirtHeight: skirtHeight,
  26092. childTileMask: provider.availability.computeChildMaskForTile(level, x, y),
  26093. waterMask: waterMaskBuffer,
  26094. credits: provider._tileCredits
  26095. });
  26096. }
  26097. CesiumTerrainProvider.prototype.requestTileGeometry = function(x, y, level, request) {
  26098. if (!this._ready) {
  26099. throw new DeveloperError_default(
  26100. "requestTileGeometry must not be called before the terrain provider is ready."
  26101. );
  26102. }
  26103. const layers = this._layers;
  26104. let layerToUse;
  26105. const layerCount = layers.length;
  26106. if (layerCount === 1) {
  26107. layerToUse = layers[0];
  26108. } else {
  26109. for (let i2 = 0; i2 < layerCount; ++i2) {
  26110. const layer = layers[i2];
  26111. if (!defined_default(layer.availability) || layer.availability.isTileAvailable(level, x, y)) {
  26112. layerToUse = layer;
  26113. break;
  26114. }
  26115. }
  26116. }
  26117. return requestTileGeometry(this, x, y, level, layerToUse, request);
  26118. };
  26119. function requestTileGeometry(provider, x, y, level, layerToUse, request) {
  26120. if (!defined_default(layerToUse)) {
  26121. return Promise.reject(new RuntimeError_default("Terrain tile doesn't exist"));
  26122. }
  26123. const urlTemplates = layerToUse.tileUrlTemplates;
  26124. if (urlTemplates.length === 0) {
  26125. return void 0;
  26126. }
  26127. let terrainY;
  26128. if (!provider._scheme || provider._scheme === "tms") {
  26129. const yTiles = provider._tilingScheme.getNumberOfYTilesAtLevel(level);
  26130. terrainY = yTiles - y - 1;
  26131. } else {
  26132. terrainY = y;
  26133. }
  26134. const extensionList = [];
  26135. if (provider._requestVertexNormals && layerToUse.hasVertexNormals) {
  26136. extensionList.push(
  26137. layerToUse.littleEndianExtensionSize ? "octvertexnormals" : "vertexnormals"
  26138. );
  26139. }
  26140. if (provider._requestWaterMask && layerToUse.hasWaterMask) {
  26141. extensionList.push("watermask");
  26142. }
  26143. if (provider._requestMetadata && layerToUse.hasMetadata) {
  26144. extensionList.push("metadata");
  26145. }
  26146. let headers;
  26147. let query;
  26148. const url2 = urlTemplates[(x + terrainY + level) % urlTemplates.length];
  26149. const resource = layerToUse.resource;
  26150. if (defined_default(resource._ionEndpoint) && !defined_default(resource._ionEndpoint.externalType)) {
  26151. if (extensionList.length !== 0) {
  26152. query = { extensions: extensionList.join("-") };
  26153. }
  26154. headers = getRequestHeader(void 0);
  26155. } else {
  26156. headers = getRequestHeader(extensionList);
  26157. }
  26158. const promise = resource.getDerivedResource({
  26159. url: url2,
  26160. templateValues: {
  26161. version: layerToUse.version,
  26162. z: level,
  26163. x,
  26164. y: terrainY
  26165. },
  26166. queryParameters: query,
  26167. headers,
  26168. request
  26169. }).fetchArrayBuffer();
  26170. if (!defined_default(promise)) {
  26171. return void 0;
  26172. }
  26173. return promise.then(function(buffer) {
  26174. if (defined_default(provider._heightmapStructure)) {
  26175. return createHeightmapTerrainData(provider, buffer, level, x, y);
  26176. }
  26177. return createQuantizedMeshTerrainData(
  26178. provider,
  26179. buffer,
  26180. level,
  26181. x,
  26182. y,
  26183. layerToUse
  26184. );
  26185. });
  26186. }
  26187. Object.defineProperties(CesiumTerrainProvider.prototype, {
  26188. errorEvent: {
  26189. get: function() {
  26190. return this._errorEvent;
  26191. }
  26192. },
  26193. credit: {
  26194. get: function() {
  26195. if (!this._ready) {
  26196. throw new DeveloperError_default(
  26197. "credit must not be called before the terrain provider is ready."
  26198. );
  26199. }
  26200. return this._credit;
  26201. }
  26202. },
  26203. tilingScheme: {
  26204. get: function() {
  26205. if (!this._ready) {
  26206. throw new DeveloperError_default(
  26207. "tilingScheme must not be called before the terrain provider is ready."
  26208. );
  26209. }
  26210. return this._tilingScheme;
  26211. }
  26212. },
  26213. ready: {
  26214. get: function() {
  26215. return this._ready;
  26216. }
  26217. },
  26218. readyPromise: {
  26219. get: function() {
  26220. return this._readyPromise.promise;
  26221. }
  26222. },
  26223. hasWaterMask: {
  26224. get: function() {
  26225. if (!this._ready) {
  26226. throw new DeveloperError_default(
  26227. "hasWaterMask must not be called before the terrain provider is ready."
  26228. );
  26229. }
  26230. return this._hasWaterMask && this._requestWaterMask;
  26231. }
  26232. },
  26233. hasVertexNormals: {
  26234. get: function() {
  26235. if (!this._ready) {
  26236. throw new DeveloperError_default(
  26237. "hasVertexNormals must not be called before the terrain provider is ready."
  26238. );
  26239. }
  26240. return this._hasVertexNormals && this._requestVertexNormals;
  26241. }
  26242. },
  26243. hasMetadata: {
  26244. get: function() {
  26245. if (!this._ready) {
  26246. throw new DeveloperError_default(
  26247. "hasMetadata must not be called before the terrain provider is ready."
  26248. );
  26249. }
  26250. return this._hasMetadata && this._requestMetadata;
  26251. }
  26252. },
  26253. requestVertexNormals: {
  26254. get: function() {
  26255. return this._requestVertexNormals;
  26256. }
  26257. },
  26258. requestWaterMask: {
  26259. get: function() {
  26260. return this._requestWaterMask;
  26261. }
  26262. },
  26263. requestMetadata: {
  26264. get: function() {
  26265. return this._requestMetadata;
  26266. }
  26267. },
  26268. availability: {
  26269. get: function() {
  26270. if (!this._ready) {
  26271. throw new DeveloperError_default(
  26272. "availability must not be called before the terrain provider is ready."
  26273. );
  26274. }
  26275. return this._availability;
  26276. }
  26277. }
  26278. });
  26279. CesiumTerrainProvider.prototype.getLevelMaximumGeometricError = function(level) {
  26280. return this._levelZeroMaximumGeometricError / (1 << level);
  26281. };
  26282. CesiumTerrainProvider.prototype.getTileDataAvailable = function(x, y, level) {
  26283. if (!defined_default(this._availability)) {
  26284. return void 0;
  26285. }
  26286. if (level > this._availability._maximumLevel) {
  26287. return false;
  26288. }
  26289. if (this._availability.isTileAvailable(level, x, y)) {
  26290. return true;
  26291. }
  26292. if (!this._hasMetadata) {
  26293. return false;
  26294. }
  26295. const layers = this._layers;
  26296. const count = layers.length;
  26297. for (let i2 = 0; i2 < count; ++i2) {
  26298. const layerResult = checkLayer(this, x, y, level, layers[i2], i2 === 0);
  26299. if (layerResult.result) {
  26300. return void 0;
  26301. }
  26302. }
  26303. return false;
  26304. };
  26305. CesiumTerrainProvider.prototype.loadTileDataAvailability = function(x, y, level) {
  26306. if (!defined_default(this._availability) || level > this._availability._maximumLevel || this._availability.isTileAvailable(level, x, y) || !this._hasMetadata) {
  26307. return void 0;
  26308. }
  26309. const layers = this._layers;
  26310. const count = layers.length;
  26311. for (let i2 = 0; i2 < count; ++i2) {
  26312. const layerResult = checkLayer(this, x, y, level, layers[i2], i2 === 0);
  26313. if (defined_default(layerResult.promise)) {
  26314. return layerResult.promise;
  26315. }
  26316. }
  26317. };
  26318. function getAvailabilityTile(layer, x, y, level) {
  26319. if (level === 0) {
  26320. return;
  26321. }
  26322. const availabilityLevels = layer.availabilityLevels;
  26323. const parentLevel = level % availabilityLevels === 0 ? level - availabilityLevels : (level / availabilityLevels | 0) * availabilityLevels;
  26324. const divisor = 1 << level - parentLevel;
  26325. const parentX = x / divisor | 0;
  26326. const parentY = y / divisor | 0;
  26327. return {
  26328. level: parentLevel,
  26329. x: parentX,
  26330. y: parentY
  26331. };
  26332. }
  26333. function checkLayer(provider, x, y, level, layer, topLayer) {
  26334. if (!defined_default(layer.availabilityLevels)) {
  26335. return {
  26336. result: false
  26337. };
  26338. }
  26339. let cacheKey;
  26340. const deleteFromCache = function() {
  26341. delete layer.availabilityPromiseCache[cacheKey];
  26342. };
  26343. const availabilityTilesLoaded = layer.availabilityTilesLoaded;
  26344. const availability = layer.availability;
  26345. let tile = getAvailabilityTile(layer, x, y, level);
  26346. while (defined_default(tile)) {
  26347. if (availability.isTileAvailable(tile.level, tile.x, tile.y) && !availabilityTilesLoaded.isTileAvailable(tile.level, tile.x, tile.y)) {
  26348. let requestPromise;
  26349. if (!topLayer) {
  26350. cacheKey = `${tile.level}-${tile.x}-${tile.y}`;
  26351. requestPromise = layer.availabilityPromiseCache[cacheKey];
  26352. if (!defined_default(requestPromise)) {
  26353. const request = new Request_default({
  26354. throttle: false,
  26355. throttleByServer: true,
  26356. type: RequestType_default.TERRAIN
  26357. });
  26358. requestPromise = requestTileGeometry(
  26359. provider,
  26360. tile.x,
  26361. tile.y,
  26362. tile.level,
  26363. layer,
  26364. request
  26365. );
  26366. if (defined_default(requestPromise)) {
  26367. layer.availabilityPromiseCache[cacheKey] = requestPromise;
  26368. requestPromise.then(deleteFromCache);
  26369. }
  26370. }
  26371. }
  26372. return {
  26373. result: true,
  26374. promise: requestPromise
  26375. };
  26376. }
  26377. tile = getAvailabilityTile(layer, tile.x, tile.y, tile.level);
  26378. }
  26379. return {
  26380. result: false
  26381. };
  26382. }
  26383. CesiumTerrainProvider._getAvailabilityTile = getAvailabilityTile;
  26384. var CesiumTerrainProvider_default = CesiumTerrainProvider;
  26385. // node_modules/cesium/Source/Core/EllipseGeometryLibrary.js
  26386. var EllipseGeometryLibrary = {};
  26387. var rotAxis = new Cartesian3_default();
  26388. var tempVec = new Cartesian3_default();
  26389. var unitQuat = new Quaternion_default();
  26390. var rotMtx = new Matrix3_default();
  26391. function pointOnEllipsoid(theta, rotation, northVec, eastVec, aSqr, ab, bSqr, mag, unitPos, result) {
  26392. const azimuth = theta + rotation;
  26393. Cartesian3_default.multiplyByScalar(eastVec, Math.cos(azimuth), rotAxis);
  26394. Cartesian3_default.multiplyByScalar(northVec, Math.sin(azimuth), tempVec);
  26395. Cartesian3_default.add(rotAxis, tempVec, rotAxis);
  26396. let cosThetaSquared = Math.cos(theta);
  26397. cosThetaSquared = cosThetaSquared * cosThetaSquared;
  26398. let sinThetaSquared = Math.sin(theta);
  26399. sinThetaSquared = sinThetaSquared * sinThetaSquared;
  26400. const radius = ab / Math.sqrt(bSqr * cosThetaSquared + aSqr * sinThetaSquared);
  26401. const angle = radius / mag;
  26402. Quaternion_default.fromAxisAngle(rotAxis, angle, unitQuat);
  26403. Matrix3_default.fromQuaternion(unitQuat, rotMtx);
  26404. Matrix3_default.multiplyByVector(rotMtx, unitPos, result);
  26405. Cartesian3_default.normalize(result, result);
  26406. Cartesian3_default.multiplyByScalar(result, mag, result);
  26407. return result;
  26408. }
  26409. var scratchCartesian12 = new Cartesian3_default();
  26410. var scratchCartesian23 = new Cartesian3_default();
  26411. var scratchCartesian33 = new Cartesian3_default();
  26412. var scratchNormal2 = new Cartesian3_default();
  26413. EllipseGeometryLibrary.raisePositionsToHeight = function(positions, options, extrude) {
  26414. const ellipsoid = options.ellipsoid;
  26415. const height = options.height;
  26416. const extrudedHeight = options.extrudedHeight;
  26417. const size = extrude ? positions.length / 3 * 2 : positions.length / 3;
  26418. const finalPositions = new Float64Array(size * 3);
  26419. const length3 = positions.length;
  26420. const bottomOffset = extrude ? length3 : 0;
  26421. for (let i2 = 0; i2 < length3; i2 += 3) {
  26422. const i1 = i2 + 1;
  26423. const i22 = i2 + 2;
  26424. const position = Cartesian3_default.fromArray(positions, i2, scratchCartesian12);
  26425. ellipsoid.scaleToGeodeticSurface(position, position);
  26426. const extrudedPosition = Cartesian3_default.clone(position, scratchCartesian23);
  26427. const normal2 = ellipsoid.geodeticSurfaceNormal(position, scratchNormal2);
  26428. const scaledNormal = Cartesian3_default.multiplyByScalar(
  26429. normal2,
  26430. height,
  26431. scratchCartesian33
  26432. );
  26433. Cartesian3_default.add(position, scaledNormal, position);
  26434. if (extrude) {
  26435. Cartesian3_default.multiplyByScalar(normal2, extrudedHeight, scaledNormal);
  26436. Cartesian3_default.add(extrudedPosition, scaledNormal, extrudedPosition);
  26437. finalPositions[i2 + bottomOffset] = extrudedPosition.x;
  26438. finalPositions[i1 + bottomOffset] = extrudedPosition.y;
  26439. finalPositions[i22 + bottomOffset] = extrudedPosition.z;
  26440. }
  26441. finalPositions[i2] = position.x;
  26442. finalPositions[i1] = position.y;
  26443. finalPositions[i22] = position.z;
  26444. }
  26445. return finalPositions;
  26446. };
  26447. var unitPosScratch = new Cartesian3_default();
  26448. var eastVecScratch = new Cartesian3_default();
  26449. var northVecScratch = new Cartesian3_default();
  26450. EllipseGeometryLibrary.computeEllipsePositions = function(options, addFillPositions, addEdgePositions) {
  26451. const semiMinorAxis = options.semiMinorAxis;
  26452. const semiMajorAxis = options.semiMajorAxis;
  26453. const rotation = options.rotation;
  26454. const center = options.center;
  26455. const granularity = options.granularity * 8;
  26456. const aSqr = semiMinorAxis * semiMinorAxis;
  26457. const bSqr = semiMajorAxis * semiMajorAxis;
  26458. const ab = semiMajorAxis * semiMinorAxis;
  26459. const mag = Cartesian3_default.magnitude(center);
  26460. const unitPos = Cartesian3_default.normalize(center, unitPosScratch);
  26461. let eastVec = Cartesian3_default.cross(Cartesian3_default.UNIT_Z, center, eastVecScratch);
  26462. eastVec = Cartesian3_default.normalize(eastVec, eastVec);
  26463. const northVec = Cartesian3_default.cross(unitPos, eastVec, northVecScratch);
  26464. let numPts = 1 + Math.ceil(Math_default.PI_OVER_TWO / granularity);
  26465. const deltaTheta = Math_default.PI_OVER_TWO / (numPts - 1);
  26466. let theta = Math_default.PI_OVER_TWO - numPts * deltaTheta;
  26467. if (theta < 0) {
  26468. numPts -= Math.ceil(Math.abs(theta) / deltaTheta);
  26469. }
  26470. const size = 2 * (numPts * (numPts + 2));
  26471. const positions = addFillPositions ? new Array(size * 3) : void 0;
  26472. let positionIndex = 0;
  26473. let position = scratchCartesian12;
  26474. let reflectedPosition = scratchCartesian23;
  26475. const outerPositionsLength = numPts * 4 * 3;
  26476. let outerRightIndex = outerPositionsLength - 1;
  26477. let outerLeftIndex = 0;
  26478. const outerPositions = addEdgePositions ? new Array(outerPositionsLength) : void 0;
  26479. let i2;
  26480. let j;
  26481. let numInterior;
  26482. let t;
  26483. let interiorPosition;
  26484. theta = Math_default.PI_OVER_TWO;
  26485. position = pointOnEllipsoid(
  26486. theta,
  26487. rotation,
  26488. northVec,
  26489. eastVec,
  26490. aSqr,
  26491. ab,
  26492. bSqr,
  26493. mag,
  26494. unitPos,
  26495. position
  26496. );
  26497. if (addFillPositions) {
  26498. positions[positionIndex++] = position.x;
  26499. positions[positionIndex++] = position.y;
  26500. positions[positionIndex++] = position.z;
  26501. }
  26502. if (addEdgePositions) {
  26503. outerPositions[outerRightIndex--] = position.z;
  26504. outerPositions[outerRightIndex--] = position.y;
  26505. outerPositions[outerRightIndex--] = position.x;
  26506. }
  26507. theta = Math_default.PI_OVER_TWO - deltaTheta;
  26508. for (i2 = 1; i2 < numPts + 1; ++i2) {
  26509. position = pointOnEllipsoid(
  26510. theta,
  26511. rotation,
  26512. northVec,
  26513. eastVec,
  26514. aSqr,
  26515. ab,
  26516. bSqr,
  26517. mag,
  26518. unitPos,
  26519. position
  26520. );
  26521. reflectedPosition = pointOnEllipsoid(
  26522. Math.PI - theta,
  26523. rotation,
  26524. northVec,
  26525. eastVec,
  26526. aSqr,
  26527. ab,
  26528. bSqr,
  26529. mag,
  26530. unitPos,
  26531. reflectedPosition
  26532. );
  26533. if (addFillPositions) {
  26534. positions[positionIndex++] = position.x;
  26535. positions[positionIndex++] = position.y;
  26536. positions[positionIndex++] = position.z;
  26537. numInterior = 2 * i2 + 2;
  26538. for (j = 1; j < numInterior - 1; ++j) {
  26539. t = j / (numInterior - 1);
  26540. interiorPosition = Cartesian3_default.lerp(
  26541. position,
  26542. reflectedPosition,
  26543. t,
  26544. scratchCartesian33
  26545. );
  26546. positions[positionIndex++] = interiorPosition.x;
  26547. positions[positionIndex++] = interiorPosition.y;
  26548. positions[positionIndex++] = interiorPosition.z;
  26549. }
  26550. positions[positionIndex++] = reflectedPosition.x;
  26551. positions[positionIndex++] = reflectedPosition.y;
  26552. positions[positionIndex++] = reflectedPosition.z;
  26553. }
  26554. if (addEdgePositions) {
  26555. outerPositions[outerRightIndex--] = position.z;
  26556. outerPositions[outerRightIndex--] = position.y;
  26557. outerPositions[outerRightIndex--] = position.x;
  26558. outerPositions[outerLeftIndex++] = reflectedPosition.x;
  26559. outerPositions[outerLeftIndex++] = reflectedPosition.y;
  26560. outerPositions[outerLeftIndex++] = reflectedPosition.z;
  26561. }
  26562. theta = Math_default.PI_OVER_TWO - (i2 + 1) * deltaTheta;
  26563. }
  26564. for (i2 = numPts; i2 > 1; --i2) {
  26565. theta = Math_default.PI_OVER_TWO - (i2 - 1) * deltaTheta;
  26566. position = pointOnEllipsoid(
  26567. -theta,
  26568. rotation,
  26569. northVec,
  26570. eastVec,
  26571. aSqr,
  26572. ab,
  26573. bSqr,
  26574. mag,
  26575. unitPos,
  26576. position
  26577. );
  26578. reflectedPosition = pointOnEllipsoid(
  26579. theta + Math.PI,
  26580. rotation,
  26581. northVec,
  26582. eastVec,
  26583. aSqr,
  26584. ab,
  26585. bSqr,
  26586. mag,
  26587. unitPos,
  26588. reflectedPosition
  26589. );
  26590. if (addFillPositions) {
  26591. positions[positionIndex++] = position.x;
  26592. positions[positionIndex++] = position.y;
  26593. positions[positionIndex++] = position.z;
  26594. numInterior = 2 * (i2 - 1) + 2;
  26595. for (j = 1; j < numInterior - 1; ++j) {
  26596. t = j / (numInterior - 1);
  26597. interiorPosition = Cartesian3_default.lerp(
  26598. position,
  26599. reflectedPosition,
  26600. t,
  26601. scratchCartesian33
  26602. );
  26603. positions[positionIndex++] = interiorPosition.x;
  26604. positions[positionIndex++] = interiorPosition.y;
  26605. positions[positionIndex++] = interiorPosition.z;
  26606. }
  26607. positions[positionIndex++] = reflectedPosition.x;
  26608. positions[positionIndex++] = reflectedPosition.y;
  26609. positions[positionIndex++] = reflectedPosition.z;
  26610. }
  26611. if (addEdgePositions) {
  26612. outerPositions[outerRightIndex--] = position.z;
  26613. outerPositions[outerRightIndex--] = position.y;
  26614. outerPositions[outerRightIndex--] = position.x;
  26615. outerPositions[outerLeftIndex++] = reflectedPosition.x;
  26616. outerPositions[outerLeftIndex++] = reflectedPosition.y;
  26617. outerPositions[outerLeftIndex++] = reflectedPosition.z;
  26618. }
  26619. }
  26620. theta = Math_default.PI_OVER_TWO;
  26621. position = pointOnEllipsoid(
  26622. -theta,
  26623. rotation,
  26624. northVec,
  26625. eastVec,
  26626. aSqr,
  26627. ab,
  26628. bSqr,
  26629. mag,
  26630. unitPos,
  26631. position
  26632. );
  26633. const r2 = {};
  26634. if (addFillPositions) {
  26635. positions[positionIndex++] = position.x;
  26636. positions[positionIndex++] = position.y;
  26637. positions[positionIndex++] = position.z;
  26638. r2.positions = positions;
  26639. r2.numPts = numPts;
  26640. }
  26641. if (addEdgePositions) {
  26642. outerPositions[outerRightIndex--] = position.z;
  26643. outerPositions[outerRightIndex--] = position.y;
  26644. outerPositions[outerRightIndex--] = position.x;
  26645. r2.outerPositions = outerPositions;
  26646. }
  26647. return r2;
  26648. };
  26649. var EllipseGeometryLibrary_default = EllipseGeometryLibrary;
  26650. // node_modules/cesium/Source/Core/GeometryInstance.js
  26651. function GeometryInstance(options) {
  26652. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  26653. if (!defined_default(options.geometry)) {
  26654. throw new DeveloperError_default("options.geometry is required.");
  26655. }
  26656. this.geometry = options.geometry;
  26657. this.modelMatrix = Matrix4_default.clone(
  26658. defaultValue_default(options.modelMatrix, Matrix4_default.IDENTITY)
  26659. );
  26660. this.id = options.id;
  26661. this.pickPrimitive = options.pickPrimitive;
  26662. this.attributes = defaultValue_default(options.attributes, {});
  26663. this.westHemisphereGeometry = void 0;
  26664. this.eastHemisphereGeometry = void 0;
  26665. }
  26666. var GeometryInstance_default = GeometryInstance;
  26667. // node_modules/cesium/Source/Core/barycentricCoordinates.js
  26668. var scratchCartesian13 = new Cartesian3_default();
  26669. var scratchCartesian24 = new Cartesian3_default();
  26670. var scratchCartesian34 = new Cartesian3_default();
  26671. function barycentricCoordinates(point, p0, p1, p2, result) {
  26672. Check_default.defined("point", point);
  26673. Check_default.defined("p0", p0);
  26674. Check_default.defined("p1", p1);
  26675. Check_default.defined("p2", p2);
  26676. if (!defined_default(result)) {
  26677. result = new Cartesian3_default();
  26678. }
  26679. let v02;
  26680. let v13;
  26681. let v23;
  26682. let dot00;
  26683. let dot01;
  26684. let dot02;
  26685. let dot11;
  26686. let dot12;
  26687. if (!defined_default(p0.z)) {
  26688. if (Cartesian2_default.equalsEpsilon(point, p0, Math_default.EPSILON14)) {
  26689. return Cartesian3_default.clone(Cartesian3_default.UNIT_X, result);
  26690. }
  26691. if (Cartesian2_default.equalsEpsilon(point, p1, Math_default.EPSILON14)) {
  26692. return Cartesian3_default.clone(Cartesian3_default.UNIT_Y, result);
  26693. }
  26694. if (Cartesian2_default.equalsEpsilon(point, p2, Math_default.EPSILON14)) {
  26695. return Cartesian3_default.clone(Cartesian3_default.UNIT_Z, result);
  26696. }
  26697. v02 = Cartesian2_default.subtract(p1, p0, scratchCartesian13);
  26698. v13 = Cartesian2_default.subtract(p2, p0, scratchCartesian24);
  26699. v23 = Cartesian2_default.subtract(point, p0, scratchCartesian34);
  26700. dot00 = Cartesian2_default.dot(v02, v02);
  26701. dot01 = Cartesian2_default.dot(v02, v13);
  26702. dot02 = Cartesian2_default.dot(v02, v23);
  26703. dot11 = Cartesian2_default.dot(v13, v13);
  26704. dot12 = Cartesian2_default.dot(v13, v23);
  26705. } else {
  26706. if (Cartesian3_default.equalsEpsilon(point, p0, Math_default.EPSILON14)) {
  26707. return Cartesian3_default.clone(Cartesian3_default.UNIT_X, result);
  26708. }
  26709. if (Cartesian3_default.equalsEpsilon(point, p1, Math_default.EPSILON14)) {
  26710. return Cartesian3_default.clone(Cartesian3_default.UNIT_Y, result);
  26711. }
  26712. if (Cartesian3_default.equalsEpsilon(point, p2, Math_default.EPSILON14)) {
  26713. return Cartesian3_default.clone(Cartesian3_default.UNIT_Z, result);
  26714. }
  26715. v02 = Cartesian3_default.subtract(p1, p0, scratchCartesian13);
  26716. v13 = Cartesian3_default.subtract(p2, p0, scratchCartesian24);
  26717. v23 = Cartesian3_default.subtract(point, p0, scratchCartesian34);
  26718. dot00 = Cartesian3_default.dot(v02, v02);
  26719. dot01 = Cartesian3_default.dot(v02, v13);
  26720. dot02 = Cartesian3_default.dot(v02, v23);
  26721. dot11 = Cartesian3_default.dot(v13, v13);
  26722. dot12 = Cartesian3_default.dot(v13, v23);
  26723. }
  26724. result.y = dot11 * dot02 - dot01 * dot12;
  26725. result.z = dot00 * dot12 - dot01 * dot02;
  26726. const q = dot00 * dot11 - dot01 * dot01;
  26727. if (q === 0) {
  26728. return void 0;
  26729. }
  26730. result.y /= q;
  26731. result.z /= q;
  26732. result.x = 1 - result.y - result.z;
  26733. return result;
  26734. }
  26735. var barycentricCoordinates_default = barycentricCoordinates;
  26736. // node_modules/cesium/Source/Core/EncodedCartesian3.js
  26737. function EncodedCartesian3() {
  26738. this.high = Cartesian3_default.clone(Cartesian3_default.ZERO);
  26739. this.low = Cartesian3_default.clone(Cartesian3_default.ZERO);
  26740. }
  26741. EncodedCartesian3.encode = function(value, result) {
  26742. Check_default.typeOf.number("value", value);
  26743. if (!defined_default(result)) {
  26744. result = {
  26745. high: 0,
  26746. low: 0
  26747. };
  26748. }
  26749. let doubleHigh;
  26750. if (value >= 0) {
  26751. doubleHigh = Math.floor(value / 65536) * 65536;
  26752. result.high = doubleHigh;
  26753. result.low = value - doubleHigh;
  26754. } else {
  26755. doubleHigh = Math.floor(-value / 65536) * 65536;
  26756. result.high = -doubleHigh;
  26757. result.low = value + doubleHigh;
  26758. }
  26759. return result;
  26760. };
  26761. var scratchEncode = {
  26762. high: 0,
  26763. low: 0
  26764. };
  26765. EncodedCartesian3.fromCartesian = function(cartesian11, result) {
  26766. Check_default.typeOf.object("cartesian", cartesian11);
  26767. if (!defined_default(result)) {
  26768. result = new EncodedCartesian3();
  26769. }
  26770. const high = result.high;
  26771. const low = result.low;
  26772. EncodedCartesian3.encode(cartesian11.x, scratchEncode);
  26773. high.x = scratchEncode.high;
  26774. low.x = scratchEncode.low;
  26775. EncodedCartesian3.encode(cartesian11.y, scratchEncode);
  26776. high.y = scratchEncode.high;
  26777. low.y = scratchEncode.low;
  26778. EncodedCartesian3.encode(cartesian11.z, scratchEncode);
  26779. high.z = scratchEncode.high;
  26780. low.z = scratchEncode.low;
  26781. return result;
  26782. };
  26783. var encodedP = new EncodedCartesian3();
  26784. EncodedCartesian3.writeElements = function(cartesian11, cartesianArray, index2) {
  26785. Check_default.defined("cartesianArray", cartesianArray);
  26786. Check_default.typeOf.number("index", index2);
  26787. Check_default.typeOf.number.greaterThanOrEquals("index", index2, 0);
  26788. EncodedCartesian3.fromCartesian(cartesian11, encodedP);
  26789. const high = encodedP.high;
  26790. const low = encodedP.low;
  26791. cartesianArray[index2] = high.x;
  26792. cartesianArray[index2 + 1] = high.y;
  26793. cartesianArray[index2 + 2] = high.z;
  26794. cartesianArray[index2 + 3] = low.x;
  26795. cartesianArray[index2 + 4] = low.y;
  26796. cartesianArray[index2 + 5] = low.z;
  26797. };
  26798. var EncodedCartesian3_default = EncodedCartesian3;
  26799. // node_modules/cesium/Source/Core/Tipsify.js
  26800. var Tipsify = {};
  26801. Tipsify.calculateACMR = function(options) {
  26802. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  26803. const indices2 = options.indices;
  26804. let maximumIndex = options.maximumIndex;
  26805. const cacheSize = defaultValue_default(options.cacheSize, 24);
  26806. if (!defined_default(indices2)) {
  26807. throw new DeveloperError_default("indices is required.");
  26808. }
  26809. const numIndices = indices2.length;
  26810. if (numIndices < 3 || numIndices % 3 !== 0) {
  26811. throw new DeveloperError_default("indices length must be a multiple of three.");
  26812. }
  26813. if (maximumIndex <= 0) {
  26814. throw new DeveloperError_default("maximumIndex must be greater than zero.");
  26815. }
  26816. if (cacheSize < 3) {
  26817. throw new DeveloperError_default("cacheSize must be greater than two.");
  26818. }
  26819. if (!defined_default(maximumIndex)) {
  26820. maximumIndex = 0;
  26821. let currentIndex = 0;
  26822. let intoIndices = indices2[currentIndex];
  26823. while (currentIndex < numIndices) {
  26824. if (intoIndices > maximumIndex) {
  26825. maximumIndex = intoIndices;
  26826. }
  26827. ++currentIndex;
  26828. intoIndices = indices2[currentIndex];
  26829. }
  26830. }
  26831. const vertexTimeStamps = [];
  26832. for (let i2 = 0; i2 < maximumIndex + 1; i2++) {
  26833. vertexTimeStamps[i2] = 0;
  26834. }
  26835. let s2 = cacheSize + 1;
  26836. for (let j = 0; j < numIndices; ++j) {
  26837. if (s2 - vertexTimeStamps[indices2[j]] > cacheSize) {
  26838. vertexTimeStamps[indices2[j]] = s2;
  26839. ++s2;
  26840. }
  26841. }
  26842. return (s2 - cacheSize + 1) / (numIndices / 3);
  26843. };
  26844. Tipsify.tipsify = function(options) {
  26845. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  26846. const indices2 = options.indices;
  26847. const maximumIndex = options.maximumIndex;
  26848. const cacheSize = defaultValue_default(options.cacheSize, 24);
  26849. let cursor;
  26850. function skipDeadEnd(vertices2, deadEnd2, indices3, maximumIndexPlusOne2) {
  26851. while (deadEnd2.length >= 1) {
  26852. const d = deadEnd2[deadEnd2.length - 1];
  26853. deadEnd2.splice(deadEnd2.length - 1, 1);
  26854. if (vertices2[d].numLiveTriangles > 0) {
  26855. return d;
  26856. }
  26857. }
  26858. while (cursor < maximumIndexPlusOne2) {
  26859. if (vertices2[cursor].numLiveTriangles > 0) {
  26860. ++cursor;
  26861. return cursor - 1;
  26862. }
  26863. ++cursor;
  26864. }
  26865. return -1;
  26866. }
  26867. function getNextVertex(indices3, cacheSize2, oneRing2, vertices2, s3, deadEnd2, maximumIndexPlusOne2) {
  26868. let n2 = -1;
  26869. let p2;
  26870. let m = -1;
  26871. let itOneRing = 0;
  26872. while (itOneRing < oneRing2.length) {
  26873. const index3 = oneRing2[itOneRing];
  26874. if (vertices2[index3].numLiveTriangles) {
  26875. p2 = 0;
  26876. if (s3 - vertices2[index3].timeStamp + 2 * vertices2[index3].numLiveTriangles <= cacheSize2) {
  26877. p2 = s3 - vertices2[index3].timeStamp;
  26878. }
  26879. if (p2 > m || m === -1) {
  26880. m = p2;
  26881. n2 = index3;
  26882. }
  26883. }
  26884. ++itOneRing;
  26885. }
  26886. if (n2 === -1) {
  26887. return skipDeadEnd(vertices2, deadEnd2, indices3, maximumIndexPlusOne2);
  26888. }
  26889. return n2;
  26890. }
  26891. if (!defined_default(indices2)) {
  26892. throw new DeveloperError_default("indices is required.");
  26893. }
  26894. const numIndices = indices2.length;
  26895. if (numIndices < 3 || numIndices % 3 !== 0) {
  26896. throw new DeveloperError_default("indices length must be a multiple of three.");
  26897. }
  26898. if (maximumIndex <= 0) {
  26899. throw new DeveloperError_default("maximumIndex must be greater than zero.");
  26900. }
  26901. if (cacheSize < 3) {
  26902. throw new DeveloperError_default("cacheSize must be greater than two.");
  26903. }
  26904. let maximumIndexPlusOne = 0;
  26905. let currentIndex = 0;
  26906. let intoIndices = indices2[currentIndex];
  26907. const endIndex = numIndices;
  26908. if (defined_default(maximumIndex)) {
  26909. maximumIndexPlusOne = maximumIndex + 1;
  26910. } else {
  26911. while (currentIndex < endIndex) {
  26912. if (intoIndices > maximumIndexPlusOne) {
  26913. maximumIndexPlusOne = intoIndices;
  26914. }
  26915. ++currentIndex;
  26916. intoIndices = indices2[currentIndex];
  26917. }
  26918. if (maximumIndexPlusOne === -1) {
  26919. return 0;
  26920. }
  26921. ++maximumIndexPlusOne;
  26922. }
  26923. const vertices = [];
  26924. let i2;
  26925. for (i2 = 0; i2 < maximumIndexPlusOne; i2++) {
  26926. vertices[i2] = {
  26927. numLiveTriangles: 0,
  26928. timeStamp: 0,
  26929. vertexTriangles: []
  26930. };
  26931. }
  26932. currentIndex = 0;
  26933. let triangle = 0;
  26934. while (currentIndex < endIndex) {
  26935. vertices[indices2[currentIndex]].vertexTriangles.push(triangle);
  26936. ++vertices[indices2[currentIndex]].numLiveTriangles;
  26937. vertices[indices2[currentIndex + 1]].vertexTriangles.push(triangle);
  26938. ++vertices[indices2[currentIndex + 1]].numLiveTriangles;
  26939. vertices[indices2[currentIndex + 2]].vertexTriangles.push(triangle);
  26940. ++vertices[indices2[currentIndex + 2]].numLiveTriangles;
  26941. ++triangle;
  26942. currentIndex += 3;
  26943. }
  26944. let f2 = 0;
  26945. let s2 = cacheSize + 1;
  26946. cursor = 1;
  26947. let oneRing = [];
  26948. const deadEnd = [];
  26949. let vertex;
  26950. let intoVertices;
  26951. let currentOutputIndex = 0;
  26952. const outputIndices = [];
  26953. const numTriangles = numIndices / 3;
  26954. const triangleEmitted = [];
  26955. for (i2 = 0; i2 < numTriangles; i2++) {
  26956. triangleEmitted[i2] = false;
  26957. }
  26958. let index2;
  26959. let limit;
  26960. while (f2 !== -1) {
  26961. oneRing = [];
  26962. intoVertices = vertices[f2];
  26963. limit = intoVertices.vertexTriangles.length;
  26964. for (let k = 0; k < limit; ++k) {
  26965. triangle = intoVertices.vertexTriangles[k];
  26966. if (!triangleEmitted[triangle]) {
  26967. triangleEmitted[triangle] = true;
  26968. currentIndex = triangle + triangle + triangle;
  26969. for (let j = 0; j < 3; ++j) {
  26970. index2 = indices2[currentIndex];
  26971. oneRing.push(index2);
  26972. deadEnd.push(index2);
  26973. outputIndices[currentOutputIndex] = index2;
  26974. ++currentOutputIndex;
  26975. vertex = vertices[index2];
  26976. --vertex.numLiveTriangles;
  26977. if (s2 - vertex.timeStamp > cacheSize) {
  26978. vertex.timeStamp = s2;
  26979. ++s2;
  26980. }
  26981. ++currentIndex;
  26982. }
  26983. }
  26984. }
  26985. f2 = getNextVertex(
  26986. indices2,
  26987. cacheSize,
  26988. oneRing,
  26989. vertices,
  26990. s2,
  26991. deadEnd,
  26992. maximumIndexPlusOne
  26993. );
  26994. }
  26995. return outputIndices;
  26996. };
  26997. var Tipsify_default = Tipsify;
  26998. // node_modules/cesium/Source/Core/GeometryPipeline.js
  26999. var GeometryPipeline = {};
  27000. function addTriangle(lines, index2, i0, i1, i2) {
  27001. lines[index2++] = i0;
  27002. lines[index2++] = i1;
  27003. lines[index2++] = i1;
  27004. lines[index2++] = i2;
  27005. lines[index2++] = i2;
  27006. lines[index2] = i0;
  27007. }
  27008. function trianglesToLines(triangles) {
  27009. const count = triangles.length;
  27010. const size = count / 3 * 6;
  27011. const lines = IndexDatatype_default.createTypedArray(count, size);
  27012. let index2 = 0;
  27013. for (let i2 = 0; i2 < count; i2 += 3, index2 += 6) {
  27014. addTriangle(lines, index2, triangles[i2], triangles[i2 + 1], triangles[i2 + 2]);
  27015. }
  27016. return lines;
  27017. }
  27018. function triangleStripToLines(triangles) {
  27019. const count = triangles.length;
  27020. if (count >= 3) {
  27021. const size = (count - 2) * 6;
  27022. const lines = IndexDatatype_default.createTypedArray(count, size);
  27023. addTriangle(lines, 0, triangles[0], triangles[1], triangles[2]);
  27024. let index2 = 6;
  27025. for (let i2 = 3; i2 < count; ++i2, index2 += 6) {
  27026. addTriangle(
  27027. lines,
  27028. index2,
  27029. triangles[i2 - 1],
  27030. triangles[i2],
  27031. triangles[i2 - 2]
  27032. );
  27033. }
  27034. return lines;
  27035. }
  27036. return new Uint16Array();
  27037. }
  27038. function triangleFanToLines(triangles) {
  27039. if (triangles.length > 0) {
  27040. const count = triangles.length - 1;
  27041. const size = (count - 1) * 6;
  27042. const lines = IndexDatatype_default.createTypedArray(count, size);
  27043. const base = triangles[0];
  27044. let index2 = 0;
  27045. for (let i2 = 1; i2 < count; ++i2, index2 += 6) {
  27046. addTriangle(lines, index2, base, triangles[i2], triangles[i2 + 1]);
  27047. }
  27048. return lines;
  27049. }
  27050. return new Uint16Array();
  27051. }
  27052. GeometryPipeline.toWireframe = function(geometry) {
  27053. if (!defined_default(geometry)) {
  27054. throw new DeveloperError_default("geometry is required.");
  27055. }
  27056. const indices2 = geometry.indices;
  27057. if (defined_default(indices2)) {
  27058. switch (geometry.primitiveType) {
  27059. case PrimitiveType_default.TRIANGLES:
  27060. geometry.indices = trianglesToLines(indices2);
  27061. break;
  27062. case PrimitiveType_default.TRIANGLE_STRIP:
  27063. geometry.indices = triangleStripToLines(indices2);
  27064. break;
  27065. case PrimitiveType_default.TRIANGLE_FAN:
  27066. geometry.indices = triangleFanToLines(indices2);
  27067. break;
  27068. default:
  27069. throw new DeveloperError_default(
  27070. "geometry.primitiveType must be TRIANGLES, TRIANGLE_STRIP, or TRIANGLE_FAN."
  27071. );
  27072. }
  27073. geometry.primitiveType = PrimitiveType_default.LINES;
  27074. }
  27075. return geometry;
  27076. };
  27077. GeometryPipeline.createLineSegmentsForVectors = function(geometry, attributeName, length3) {
  27078. attributeName = defaultValue_default(attributeName, "normal");
  27079. if (!defined_default(geometry)) {
  27080. throw new DeveloperError_default("geometry is required.");
  27081. }
  27082. if (!defined_default(geometry.attributes.position)) {
  27083. throw new DeveloperError_default("geometry.attributes.position is required.");
  27084. }
  27085. if (!defined_default(geometry.attributes[attributeName])) {
  27086. throw new DeveloperError_default(
  27087. `geometry.attributes must have an attribute with the same name as the attributeName parameter, ${attributeName}.`
  27088. );
  27089. }
  27090. length3 = defaultValue_default(length3, 1e4);
  27091. const positions = geometry.attributes.position.values;
  27092. const vectors = geometry.attributes[attributeName].values;
  27093. const positionsLength = positions.length;
  27094. const newPositions = new Float64Array(2 * positionsLength);
  27095. let j = 0;
  27096. for (let i2 = 0; i2 < positionsLength; i2 += 3) {
  27097. newPositions[j++] = positions[i2];
  27098. newPositions[j++] = positions[i2 + 1];
  27099. newPositions[j++] = positions[i2 + 2];
  27100. newPositions[j++] = positions[i2] + vectors[i2] * length3;
  27101. newPositions[j++] = positions[i2 + 1] + vectors[i2 + 1] * length3;
  27102. newPositions[j++] = positions[i2 + 2] + vectors[i2 + 2] * length3;
  27103. }
  27104. let newBoundingSphere;
  27105. const bs = geometry.boundingSphere;
  27106. if (defined_default(bs)) {
  27107. newBoundingSphere = new BoundingSphere_default(bs.center, bs.radius + length3);
  27108. }
  27109. return new Geometry_default({
  27110. attributes: {
  27111. position: new GeometryAttribute_default({
  27112. componentDatatype: ComponentDatatype_default.DOUBLE,
  27113. componentsPerAttribute: 3,
  27114. values: newPositions
  27115. })
  27116. },
  27117. primitiveType: PrimitiveType_default.LINES,
  27118. boundingSphere: newBoundingSphere
  27119. });
  27120. };
  27121. GeometryPipeline.createAttributeLocations = function(geometry) {
  27122. if (!defined_default(geometry)) {
  27123. throw new DeveloperError_default("geometry is required.");
  27124. }
  27125. const semantics = [
  27126. "position",
  27127. "positionHigh",
  27128. "positionLow",
  27129. "position3DHigh",
  27130. "position3DLow",
  27131. "position2DHigh",
  27132. "position2DLow",
  27133. "pickColor",
  27134. "normal",
  27135. "st",
  27136. "tangent",
  27137. "bitangent",
  27138. "extrudeDirection",
  27139. "compressedAttributes"
  27140. ];
  27141. const attributes = geometry.attributes;
  27142. const indices2 = {};
  27143. let j = 0;
  27144. let i2;
  27145. const len = semantics.length;
  27146. for (i2 = 0; i2 < len; ++i2) {
  27147. const semantic = semantics[i2];
  27148. if (defined_default(attributes[semantic])) {
  27149. indices2[semantic] = j++;
  27150. }
  27151. }
  27152. for (const name in attributes) {
  27153. if (attributes.hasOwnProperty(name) && !defined_default(indices2[name])) {
  27154. indices2[name] = j++;
  27155. }
  27156. }
  27157. return indices2;
  27158. };
  27159. GeometryPipeline.reorderForPreVertexCache = function(geometry) {
  27160. if (!defined_default(geometry)) {
  27161. throw new DeveloperError_default("geometry is required.");
  27162. }
  27163. const numVertices = Geometry_default.computeNumberOfVertices(geometry);
  27164. const indices2 = geometry.indices;
  27165. if (defined_default(indices2)) {
  27166. const indexCrossReferenceOldToNew = new Int32Array(numVertices);
  27167. for (let i2 = 0; i2 < numVertices; i2++) {
  27168. indexCrossReferenceOldToNew[i2] = -1;
  27169. }
  27170. const indicesIn = indices2;
  27171. const numIndices = indicesIn.length;
  27172. const indicesOut = IndexDatatype_default.createTypedArray(numVertices, numIndices);
  27173. let intoIndicesIn = 0;
  27174. let intoIndicesOut = 0;
  27175. let nextIndex = 0;
  27176. let tempIndex;
  27177. while (intoIndicesIn < numIndices) {
  27178. tempIndex = indexCrossReferenceOldToNew[indicesIn[intoIndicesIn]];
  27179. if (tempIndex !== -1) {
  27180. indicesOut[intoIndicesOut] = tempIndex;
  27181. } else {
  27182. tempIndex = indicesIn[intoIndicesIn];
  27183. indexCrossReferenceOldToNew[tempIndex] = nextIndex;
  27184. indicesOut[intoIndicesOut] = nextIndex;
  27185. ++nextIndex;
  27186. }
  27187. ++intoIndicesIn;
  27188. ++intoIndicesOut;
  27189. }
  27190. geometry.indices = indicesOut;
  27191. const attributes = geometry.attributes;
  27192. for (const property in attributes) {
  27193. if (attributes.hasOwnProperty(property) && defined_default(attributes[property]) && defined_default(attributes[property].values)) {
  27194. const attribute = attributes[property];
  27195. const elementsIn = attribute.values;
  27196. let intoElementsIn = 0;
  27197. const numComponents = attribute.componentsPerAttribute;
  27198. const elementsOut = ComponentDatatype_default.createTypedArray(
  27199. attribute.componentDatatype,
  27200. nextIndex * numComponents
  27201. );
  27202. while (intoElementsIn < numVertices) {
  27203. const temp = indexCrossReferenceOldToNew[intoElementsIn];
  27204. if (temp !== -1) {
  27205. for (let j = 0; j < numComponents; j++) {
  27206. elementsOut[numComponents * temp + j] = elementsIn[numComponents * intoElementsIn + j];
  27207. }
  27208. }
  27209. ++intoElementsIn;
  27210. }
  27211. attribute.values = elementsOut;
  27212. }
  27213. }
  27214. }
  27215. return geometry;
  27216. };
  27217. GeometryPipeline.reorderForPostVertexCache = function(geometry, cacheCapacity) {
  27218. if (!defined_default(geometry)) {
  27219. throw new DeveloperError_default("geometry is required.");
  27220. }
  27221. const indices2 = geometry.indices;
  27222. if (geometry.primitiveType === PrimitiveType_default.TRIANGLES && defined_default(indices2)) {
  27223. const numIndices = indices2.length;
  27224. let maximumIndex = 0;
  27225. for (let j = 0; j < numIndices; j++) {
  27226. if (indices2[j] > maximumIndex) {
  27227. maximumIndex = indices2[j];
  27228. }
  27229. }
  27230. geometry.indices = Tipsify_default.tipsify({
  27231. indices: indices2,
  27232. maximumIndex,
  27233. cacheSize: cacheCapacity
  27234. });
  27235. }
  27236. return geometry;
  27237. };
  27238. function copyAttributesDescriptions(attributes) {
  27239. const newAttributes = {};
  27240. for (const attribute in attributes) {
  27241. if (attributes.hasOwnProperty(attribute) && defined_default(attributes[attribute]) && defined_default(attributes[attribute].values)) {
  27242. const attr = attributes[attribute];
  27243. newAttributes[attribute] = new GeometryAttribute_default({
  27244. componentDatatype: attr.componentDatatype,
  27245. componentsPerAttribute: attr.componentsPerAttribute,
  27246. normalize: attr.normalize,
  27247. values: []
  27248. });
  27249. }
  27250. }
  27251. return newAttributes;
  27252. }
  27253. function copyVertex(destinationAttributes, sourceAttributes, index2) {
  27254. for (const attribute in sourceAttributes) {
  27255. if (sourceAttributes.hasOwnProperty(attribute) && defined_default(sourceAttributes[attribute]) && defined_default(sourceAttributes[attribute].values)) {
  27256. const attr = sourceAttributes[attribute];
  27257. for (let k = 0; k < attr.componentsPerAttribute; ++k) {
  27258. destinationAttributes[attribute].values.push(
  27259. attr.values[index2 * attr.componentsPerAttribute + k]
  27260. );
  27261. }
  27262. }
  27263. }
  27264. }
  27265. GeometryPipeline.fitToUnsignedShortIndices = function(geometry) {
  27266. if (!defined_default(geometry)) {
  27267. throw new DeveloperError_default("geometry is required.");
  27268. }
  27269. if (defined_default(geometry.indices) && geometry.primitiveType !== PrimitiveType_default.TRIANGLES && geometry.primitiveType !== PrimitiveType_default.LINES && geometry.primitiveType !== PrimitiveType_default.POINTS) {
  27270. throw new DeveloperError_default(
  27271. "geometry.primitiveType must equal to PrimitiveType.TRIANGLES, PrimitiveType.LINES, or PrimitiveType.POINTS."
  27272. );
  27273. }
  27274. const geometries = [];
  27275. const numberOfVertices = Geometry_default.computeNumberOfVertices(geometry);
  27276. if (defined_default(geometry.indices) && numberOfVertices >= Math_default.SIXTY_FOUR_KILOBYTES) {
  27277. let oldToNewIndex = [];
  27278. let newIndices = [];
  27279. let currentIndex = 0;
  27280. let newAttributes = copyAttributesDescriptions(geometry.attributes);
  27281. const originalIndices = geometry.indices;
  27282. const numberOfIndices = originalIndices.length;
  27283. let indicesPerPrimitive;
  27284. if (geometry.primitiveType === PrimitiveType_default.TRIANGLES) {
  27285. indicesPerPrimitive = 3;
  27286. } else if (geometry.primitiveType === PrimitiveType_default.LINES) {
  27287. indicesPerPrimitive = 2;
  27288. } else if (geometry.primitiveType === PrimitiveType_default.POINTS) {
  27289. indicesPerPrimitive = 1;
  27290. }
  27291. for (let j = 0; j < numberOfIndices; j += indicesPerPrimitive) {
  27292. for (let k = 0; k < indicesPerPrimitive; ++k) {
  27293. const x = originalIndices[j + k];
  27294. let i2 = oldToNewIndex[x];
  27295. if (!defined_default(i2)) {
  27296. i2 = currentIndex++;
  27297. oldToNewIndex[x] = i2;
  27298. copyVertex(newAttributes, geometry.attributes, x);
  27299. }
  27300. newIndices.push(i2);
  27301. }
  27302. if (currentIndex + indicesPerPrimitive >= Math_default.SIXTY_FOUR_KILOBYTES) {
  27303. geometries.push(
  27304. new Geometry_default({
  27305. attributes: newAttributes,
  27306. indices: newIndices,
  27307. primitiveType: geometry.primitiveType,
  27308. boundingSphere: geometry.boundingSphere,
  27309. boundingSphereCV: geometry.boundingSphereCV
  27310. })
  27311. );
  27312. oldToNewIndex = [];
  27313. newIndices = [];
  27314. currentIndex = 0;
  27315. newAttributes = copyAttributesDescriptions(geometry.attributes);
  27316. }
  27317. }
  27318. if (newIndices.length !== 0) {
  27319. geometries.push(
  27320. new Geometry_default({
  27321. attributes: newAttributes,
  27322. indices: newIndices,
  27323. primitiveType: geometry.primitiveType,
  27324. boundingSphere: geometry.boundingSphere,
  27325. boundingSphereCV: geometry.boundingSphereCV
  27326. })
  27327. );
  27328. }
  27329. } else {
  27330. geometries.push(geometry);
  27331. }
  27332. return geometries;
  27333. };
  27334. var scratchProjectTo2DCartesian3 = new Cartesian3_default();
  27335. var scratchProjectTo2DCartographic = new Cartographic_default();
  27336. GeometryPipeline.projectTo2D = function(geometry, attributeName, attributeName3D, attributeName2D, projection) {
  27337. if (!defined_default(geometry)) {
  27338. throw new DeveloperError_default("geometry is required.");
  27339. }
  27340. if (!defined_default(attributeName)) {
  27341. throw new DeveloperError_default("attributeName is required.");
  27342. }
  27343. if (!defined_default(attributeName3D)) {
  27344. throw new DeveloperError_default("attributeName3D is required.");
  27345. }
  27346. if (!defined_default(attributeName2D)) {
  27347. throw new DeveloperError_default("attributeName2D is required.");
  27348. }
  27349. if (!defined_default(geometry.attributes[attributeName])) {
  27350. throw new DeveloperError_default(
  27351. `geometry must have attribute matching the attributeName argument: ${attributeName}.`
  27352. );
  27353. }
  27354. if (geometry.attributes[attributeName].componentDatatype !== ComponentDatatype_default.DOUBLE) {
  27355. throw new DeveloperError_default(
  27356. "The attribute componentDatatype must be ComponentDatatype.DOUBLE."
  27357. );
  27358. }
  27359. const attribute = geometry.attributes[attributeName];
  27360. projection = defined_default(projection) ? projection : new GeographicProjection_default();
  27361. const ellipsoid = projection.ellipsoid;
  27362. const values3D = attribute.values;
  27363. const projectedValues = new Float64Array(values3D.length);
  27364. let index2 = 0;
  27365. for (let i2 = 0; i2 < values3D.length; i2 += 3) {
  27366. const value = Cartesian3_default.fromArray(
  27367. values3D,
  27368. i2,
  27369. scratchProjectTo2DCartesian3
  27370. );
  27371. const lonLat = ellipsoid.cartesianToCartographic(
  27372. value,
  27373. scratchProjectTo2DCartographic
  27374. );
  27375. if (!defined_default(lonLat)) {
  27376. throw new DeveloperError_default(
  27377. `Could not project point (${value.x}, ${value.y}, ${value.z}) to 2D.`
  27378. );
  27379. }
  27380. const projectedLonLat = projection.project(
  27381. lonLat,
  27382. scratchProjectTo2DCartesian3
  27383. );
  27384. projectedValues[index2++] = projectedLonLat.x;
  27385. projectedValues[index2++] = projectedLonLat.y;
  27386. projectedValues[index2++] = projectedLonLat.z;
  27387. }
  27388. geometry.attributes[attributeName3D] = attribute;
  27389. geometry.attributes[attributeName2D] = new GeometryAttribute_default({
  27390. componentDatatype: ComponentDatatype_default.DOUBLE,
  27391. componentsPerAttribute: 3,
  27392. values: projectedValues
  27393. });
  27394. delete geometry.attributes[attributeName];
  27395. return geometry;
  27396. };
  27397. var encodedResult = {
  27398. high: 0,
  27399. low: 0
  27400. };
  27401. GeometryPipeline.encodeAttribute = function(geometry, attributeName, attributeHighName, attributeLowName) {
  27402. if (!defined_default(geometry)) {
  27403. throw new DeveloperError_default("geometry is required.");
  27404. }
  27405. if (!defined_default(attributeName)) {
  27406. throw new DeveloperError_default("attributeName is required.");
  27407. }
  27408. if (!defined_default(attributeHighName)) {
  27409. throw new DeveloperError_default("attributeHighName is required.");
  27410. }
  27411. if (!defined_default(attributeLowName)) {
  27412. throw new DeveloperError_default("attributeLowName is required.");
  27413. }
  27414. if (!defined_default(geometry.attributes[attributeName])) {
  27415. throw new DeveloperError_default(
  27416. `geometry must have attribute matching the attributeName argument: ${attributeName}.`
  27417. );
  27418. }
  27419. if (geometry.attributes[attributeName].componentDatatype !== ComponentDatatype_default.DOUBLE) {
  27420. throw new DeveloperError_default(
  27421. "The attribute componentDatatype must be ComponentDatatype.DOUBLE."
  27422. );
  27423. }
  27424. const attribute = geometry.attributes[attributeName];
  27425. const values = attribute.values;
  27426. const length3 = values.length;
  27427. const highValues = new Float32Array(length3);
  27428. const lowValues = new Float32Array(length3);
  27429. for (let i2 = 0; i2 < length3; ++i2) {
  27430. EncodedCartesian3_default.encode(values[i2], encodedResult);
  27431. highValues[i2] = encodedResult.high;
  27432. lowValues[i2] = encodedResult.low;
  27433. }
  27434. const componentsPerAttribute = attribute.componentsPerAttribute;
  27435. geometry.attributes[attributeHighName] = new GeometryAttribute_default({
  27436. componentDatatype: ComponentDatatype_default.FLOAT,
  27437. componentsPerAttribute,
  27438. values: highValues
  27439. });
  27440. geometry.attributes[attributeLowName] = new GeometryAttribute_default({
  27441. componentDatatype: ComponentDatatype_default.FLOAT,
  27442. componentsPerAttribute,
  27443. values: lowValues
  27444. });
  27445. delete geometry.attributes[attributeName];
  27446. return geometry;
  27447. };
  27448. var scratchCartesian35 = new Cartesian3_default();
  27449. function transformPoint(matrix, attribute) {
  27450. if (defined_default(attribute)) {
  27451. const values = attribute.values;
  27452. const length3 = values.length;
  27453. for (let i2 = 0; i2 < length3; i2 += 3) {
  27454. Cartesian3_default.unpack(values, i2, scratchCartesian35);
  27455. Matrix4_default.multiplyByPoint(matrix, scratchCartesian35, scratchCartesian35);
  27456. Cartesian3_default.pack(scratchCartesian35, values, i2);
  27457. }
  27458. }
  27459. }
  27460. function transformVector(matrix, attribute) {
  27461. if (defined_default(attribute)) {
  27462. const values = attribute.values;
  27463. const length3 = values.length;
  27464. for (let i2 = 0; i2 < length3; i2 += 3) {
  27465. Cartesian3_default.unpack(values, i2, scratchCartesian35);
  27466. Matrix3_default.multiplyByVector(matrix, scratchCartesian35, scratchCartesian35);
  27467. scratchCartesian35 = Cartesian3_default.normalize(
  27468. scratchCartesian35,
  27469. scratchCartesian35
  27470. );
  27471. Cartesian3_default.pack(scratchCartesian35, values, i2);
  27472. }
  27473. }
  27474. }
  27475. var inverseTranspose = new Matrix4_default();
  27476. var normalMatrix = new Matrix3_default();
  27477. GeometryPipeline.transformToWorldCoordinates = function(instance) {
  27478. if (!defined_default(instance)) {
  27479. throw new DeveloperError_default("instance is required.");
  27480. }
  27481. const modelMatrix = instance.modelMatrix;
  27482. if (Matrix4_default.equals(modelMatrix, Matrix4_default.IDENTITY)) {
  27483. return instance;
  27484. }
  27485. const attributes = instance.geometry.attributes;
  27486. transformPoint(modelMatrix, attributes.position);
  27487. transformPoint(modelMatrix, attributes.prevPosition);
  27488. transformPoint(modelMatrix, attributes.nextPosition);
  27489. if (defined_default(attributes.normal) || defined_default(attributes.tangent) || defined_default(attributes.bitangent)) {
  27490. Matrix4_default.inverse(modelMatrix, inverseTranspose);
  27491. Matrix4_default.transpose(inverseTranspose, inverseTranspose);
  27492. Matrix4_default.getMatrix3(inverseTranspose, normalMatrix);
  27493. transformVector(normalMatrix, attributes.normal);
  27494. transformVector(normalMatrix, attributes.tangent);
  27495. transformVector(normalMatrix, attributes.bitangent);
  27496. }
  27497. const boundingSphere = instance.geometry.boundingSphere;
  27498. if (defined_default(boundingSphere)) {
  27499. instance.geometry.boundingSphere = BoundingSphere_default.transform(
  27500. boundingSphere,
  27501. modelMatrix,
  27502. boundingSphere
  27503. );
  27504. }
  27505. instance.modelMatrix = Matrix4_default.clone(Matrix4_default.IDENTITY);
  27506. return instance;
  27507. };
  27508. function findAttributesInAllGeometries(instances, propertyName) {
  27509. const length3 = instances.length;
  27510. const attributesInAllGeometries = {};
  27511. const attributes0 = instances[0][propertyName].attributes;
  27512. let name;
  27513. for (name in attributes0) {
  27514. if (attributes0.hasOwnProperty(name) && defined_default(attributes0[name]) && defined_default(attributes0[name].values)) {
  27515. const attribute = attributes0[name];
  27516. let numberOfComponents = attribute.values.length;
  27517. let inAllGeometries = true;
  27518. for (let i2 = 1; i2 < length3; ++i2) {
  27519. const otherAttribute = instances[i2][propertyName].attributes[name];
  27520. if (!defined_default(otherAttribute) || attribute.componentDatatype !== otherAttribute.componentDatatype || attribute.componentsPerAttribute !== otherAttribute.componentsPerAttribute || attribute.normalize !== otherAttribute.normalize) {
  27521. inAllGeometries = false;
  27522. break;
  27523. }
  27524. numberOfComponents += otherAttribute.values.length;
  27525. }
  27526. if (inAllGeometries) {
  27527. attributesInAllGeometries[name] = new GeometryAttribute_default({
  27528. componentDatatype: attribute.componentDatatype,
  27529. componentsPerAttribute: attribute.componentsPerAttribute,
  27530. normalize: attribute.normalize,
  27531. values: ComponentDatatype_default.createTypedArray(
  27532. attribute.componentDatatype,
  27533. numberOfComponents
  27534. )
  27535. });
  27536. }
  27537. }
  27538. }
  27539. return attributesInAllGeometries;
  27540. }
  27541. var tempScratch = new Cartesian3_default();
  27542. function combineGeometries(instances, propertyName) {
  27543. const length3 = instances.length;
  27544. let name;
  27545. let i2;
  27546. let j;
  27547. let k;
  27548. const m = instances[0].modelMatrix;
  27549. const haveIndices = defined_default(instances[0][propertyName].indices);
  27550. const primitiveType = instances[0][propertyName].primitiveType;
  27551. for (i2 = 1; i2 < length3; ++i2) {
  27552. if (!Matrix4_default.equals(instances[i2].modelMatrix, m)) {
  27553. throw new DeveloperError_default("All instances must have the same modelMatrix.");
  27554. }
  27555. if (defined_default(instances[i2][propertyName].indices) !== haveIndices) {
  27556. throw new DeveloperError_default(
  27557. "All instance geometries must have an indices or not have one."
  27558. );
  27559. }
  27560. if (instances[i2][propertyName].primitiveType !== primitiveType) {
  27561. throw new DeveloperError_default(
  27562. "All instance geometries must have the same primitiveType."
  27563. );
  27564. }
  27565. }
  27566. const attributes = findAttributesInAllGeometries(instances, propertyName);
  27567. let values;
  27568. let sourceValues;
  27569. let sourceValuesLength;
  27570. for (name in attributes) {
  27571. if (attributes.hasOwnProperty(name)) {
  27572. values = attributes[name].values;
  27573. k = 0;
  27574. for (i2 = 0; i2 < length3; ++i2) {
  27575. sourceValues = instances[i2][propertyName].attributes[name].values;
  27576. sourceValuesLength = sourceValues.length;
  27577. for (j = 0; j < sourceValuesLength; ++j) {
  27578. values[k++] = sourceValues[j];
  27579. }
  27580. }
  27581. }
  27582. }
  27583. let indices2;
  27584. if (haveIndices) {
  27585. let numberOfIndices = 0;
  27586. for (i2 = 0; i2 < length3; ++i2) {
  27587. numberOfIndices += instances[i2][propertyName].indices.length;
  27588. }
  27589. const numberOfVertices = Geometry_default.computeNumberOfVertices(
  27590. new Geometry_default({
  27591. attributes,
  27592. primitiveType: PrimitiveType_default.POINTS
  27593. })
  27594. );
  27595. const destIndices = IndexDatatype_default.createTypedArray(
  27596. numberOfVertices,
  27597. numberOfIndices
  27598. );
  27599. let destOffset = 0;
  27600. let offset2 = 0;
  27601. for (i2 = 0; i2 < length3; ++i2) {
  27602. const sourceIndices = instances[i2][propertyName].indices;
  27603. const sourceIndicesLen = sourceIndices.length;
  27604. for (k = 0; k < sourceIndicesLen; ++k) {
  27605. destIndices[destOffset++] = offset2 + sourceIndices[k];
  27606. }
  27607. offset2 += Geometry_default.computeNumberOfVertices(instances[i2][propertyName]);
  27608. }
  27609. indices2 = destIndices;
  27610. }
  27611. let center = new Cartesian3_default();
  27612. let radius = 0;
  27613. let bs;
  27614. for (i2 = 0; i2 < length3; ++i2) {
  27615. bs = instances[i2][propertyName].boundingSphere;
  27616. if (!defined_default(bs)) {
  27617. center = void 0;
  27618. break;
  27619. }
  27620. Cartesian3_default.add(bs.center, center, center);
  27621. }
  27622. if (defined_default(center)) {
  27623. Cartesian3_default.divideByScalar(center, length3, center);
  27624. for (i2 = 0; i2 < length3; ++i2) {
  27625. bs = instances[i2][propertyName].boundingSphere;
  27626. const tempRadius = Cartesian3_default.magnitude(
  27627. Cartesian3_default.subtract(bs.center, center, tempScratch)
  27628. ) + bs.radius;
  27629. if (tempRadius > radius) {
  27630. radius = tempRadius;
  27631. }
  27632. }
  27633. }
  27634. return new Geometry_default({
  27635. attributes,
  27636. indices: indices2,
  27637. primitiveType,
  27638. boundingSphere: defined_default(center) ? new BoundingSphere_default(center, radius) : void 0
  27639. });
  27640. }
  27641. GeometryPipeline.combineInstances = function(instances) {
  27642. if (!defined_default(instances) || instances.length < 1) {
  27643. throw new DeveloperError_default(
  27644. "instances is required and must have length greater than zero."
  27645. );
  27646. }
  27647. const instanceGeometry = [];
  27648. const instanceSplitGeometry = [];
  27649. const length3 = instances.length;
  27650. for (let i2 = 0; i2 < length3; ++i2) {
  27651. const instance = instances[i2];
  27652. if (defined_default(instance.geometry)) {
  27653. instanceGeometry.push(instance);
  27654. } else if (defined_default(instance.westHemisphereGeometry) && defined_default(instance.eastHemisphereGeometry)) {
  27655. instanceSplitGeometry.push(instance);
  27656. }
  27657. }
  27658. const geometries = [];
  27659. if (instanceGeometry.length > 0) {
  27660. geometries.push(combineGeometries(instanceGeometry, "geometry"));
  27661. }
  27662. if (instanceSplitGeometry.length > 0) {
  27663. geometries.push(
  27664. combineGeometries(instanceSplitGeometry, "westHemisphereGeometry")
  27665. );
  27666. geometries.push(
  27667. combineGeometries(instanceSplitGeometry, "eastHemisphereGeometry")
  27668. );
  27669. }
  27670. return geometries;
  27671. };
  27672. var normal = new Cartesian3_default();
  27673. var v0 = new Cartesian3_default();
  27674. var v1 = new Cartesian3_default();
  27675. var v2 = new Cartesian3_default();
  27676. GeometryPipeline.computeNormal = function(geometry) {
  27677. if (!defined_default(geometry)) {
  27678. throw new DeveloperError_default("geometry is required.");
  27679. }
  27680. if (!defined_default(geometry.attributes.position) || !defined_default(geometry.attributes.position.values)) {
  27681. throw new DeveloperError_default(
  27682. "geometry.attributes.position.values is required."
  27683. );
  27684. }
  27685. if (!defined_default(geometry.indices)) {
  27686. throw new DeveloperError_default("geometry.indices is required.");
  27687. }
  27688. if (geometry.indices.length < 2 || geometry.indices.length % 3 !== 0) {
  27689. throw new DeveloperError_default(
  27690. "geometry.indices length must be greater than 0 and be a multiple of 3."
  27691. );
  27692. }
  27693. if (geometry.primitiveType !== PrimitiveType_default.TRIANGLES) {
  27694. throw new DeveloperError_default(
  27695. "geometry.primitiveType must be PrimitiveType.TRIANGLES."
  27696. );
  27697. }
  27698. const indices2 = geometry.indices;
  27699. const attributes = geometry.attributes;
  27700. const vertices = attributes.position.values;
  27701. const numVertices = attributes.position.values.length / 3;
  27702. const numIndices = indices2.length;
  27703. const normalsPerVertex = new Array(numVertices);
  27704. const normalsPerTriangle = new Array(numIndices / 3);
  27705. const normalIndices = new Array(numIndices);
  27706. let i2;
  27707. for (i2 = 0; i2 < numVertices; i2++) {
  27708. normalsPerVertex[i2] = {
  27709. indexOffset: 0,
  27710. count: 0,
  27711. currentCount: 0
  27712. };
  27713. }
  27714. let j = 0;
  27715. for (i2 = 0; i2 < numIndices; i2 += 3) {
  27716. const i0 = indices2[i2];
  27717. const i1 = indices2[i2 + 1];
  27718. const i22 = indices2[i2 + 2];
  27719. const i03 = i0 * 3;
  27720. const i13 = i1 * 3;
  27721. const i23 = i22 * 3;
  27722. v0.x = vertices[i03];
  27723. v0.y = vertices[i03 + 1];
  27724. v0.z = vertices[i03 + 2];
  27725. v1.x = vertices[i13];
  27726. v1.y = vertices[i13 + 1];
  27727. v1.z = vertices[i13 + 2];
  27728. v2.x = vertices[i23];
  27729. v2.y = vertices[i23 + 1];
  27730. v2.z = vertices[i23 + 2];
  27731. normalsPerVertex[i0].count++;
  27732. normalsPerVertex[i1].count++;
  27733. normalsPerVertex[i22].count++;
  27734. Cartesian3_default.subtract(v1, v0, v1);
  27735. Cartesian3_default.subtract(v2, v0, v2);
  27736. normalsPerTriangle[j] = Cartesian3_default.cross(v1, v2, new Cartesian3_default());
  27737. j++;
  27738. }
  27739. let indexOffset = 0;
  27740. for (i2 = 0; i2 < numVertices; i2++) {
  27741. normalsPerVertex[i2].indexOffset += indexOffset;
  27742. indexOffset += normalsPerVertex[i2].count;
  27743. }
  27744. j = 0;
  27745. let vertexNormalData;
  27746. for (i2 = 0; i2 < numIndices; i2 += 3) {
  27747. vertexNormalData = normalsPerVertex[indices2[i2]];
  27748. let index2 = vertexNormalData.indexOffset + vertexNormalData.currentCount;
  27749. normalIndices[index2] = j;
  27750. vertexNormalData.currentCount++;
  27751. vertexNormalData = normalsPerVertex[indices2[i2 + 1]];
  27752. index2 = vertexNormalData.indexOffset + vertexNormalData.currentCount;
  27753. normalIndices[index2] = j;
  27754. vertexNormalData.currentCount++;
  27755. vertexNormalData = normalsPerVertex[indices2[i2 + 2]];
  27756. index2 = vertexNormalData.indexOffset + vertexNormalData.currentCount;
  27757. normalIndices[index2] = j;
  27758. vertexNormalData.currentCount++;
  27759. j++;
  27760. }
  27761. const normalValues = new Float32Array(numVertices * 3);
  27762. for (i2 = 0; i2 < numVertices; i2++) {
  27763. const i3 = i2 * 3;
  27764. vertexNormalData = normalsPerVertex[i2];
  27765. Cartesian3_default.clone(Cartesian3_default.ZERO, normal);
  27766. if (vertexNormalData.count > 0) {
  27767. for (j = 0; j < vertexNormalData.count; j++) {
  27768. Cartesian3_default.add(
  27769. normal,
  27770. normalsPerTriangle[normalIndices[vertexNormalData.indexOffset + j]],
  27771. normal
  27772. );
  27773. }
  27774. if (Cartesian3_default.equalsEpsilon(Cartesian3_default.ZERO, normal, Math_default.EPSILON10)) {
  27775. Cartesian3_default.clone(
  27776. normalsPerTriangle[normalIndices[vertexNormalData.indexOffset]],
  27777. normal
  27778. );
  27779. }
  27780. }
  27781. if (Cartesian3_default.equalsEpsilon(Cartesian3_default.ZERO, normal, Math_default.EPSILON10)) {
  27782. normal.z = 1;
  27783. }
  27784. Cartesian3_default.normalize(normal, normal);
  27785. normalValues[i3] = normal.x;
  27786. normalValues[i3 + 1] = normal.y;
  27787. normalValues[i3 + 2] = normal.z;
  27788. }
  27789. geometry.attributes.normal = new GeometryAttribute_default({
  27790. componentDatatype: ComponentDatatype_default.FLOAT,
  27791. componentsPerAttribute: 3,
  27792. values: normalValues
  27793. });
  27794. return geometry;
  27795. };
  27796. var normalScratch2 = new Cartesian3_default();
  27797. var normalScale = new Cartesian3_default();
  27798. var tScratch = new Cartesian3_default();
  27799. GeometryPipeline.computeTangentAndBitangent = function(geometry) {
  27800. if (!defined_default(geometry)) {
  27801. throw new DeveloperError_default("geometry is required.");
  27802. }
  27803. const attributes = geometry.attributes;
  27804. const indices2 = geometry.indices;
  27805. if (!defined_default(attributes.position) || !defined_default(attributes.position.values)) {
  27806. throw new DeveloperError_default(
  27807. "geometry.attributes.position.values is required."
  27808. );
  27809. }
  27810. if (!defined_default(attributes.normal) || !defined_default(attributes.normal.values)) {
  27811. throw new DeveloperError_default("geometry.attributes.normal.values is required.");
  27812. }
  27813. if (!defined_default(attributes.st) || !defined_default(attributes.st.values)) {
  27814. throw new DeveloperError_default("geometry.attributes.st.values is required.");
  27815. }
  27816. if (!defined_default(indices2)) {
  27817. throw new DeveloperError_default("geometry.indices is required.");
  27818. }
  27819. if (indices2.length < 2 || indices2.length % 3 !== 0) {
  27820. throw new DeveloperError_default(
  27821. "geometry.indices length must be greater than 0 and be a multiple of 3."
  27822. );
  27823. }
  27824. if (geometry.primitiveType !== PrimitiveType_default.TRIANGLES) {
  27825. throw new DeveloperError_default(
  27826. "geometry.primitiveType must be PrimitiveType.TRIANGLES."
  27827. );
  27828. }
  27829. const vertices = geometry.attributes.position.values;
  27830. const normals = geometry.attributes.normal.values;
  27831. const st = geometry.attributes.st.values;
  27832. const numVertices = geometry.attributes.position.values.length / 3;
  27833. const numIndices = indices2.length;
  27834. const tan1 = new Array(numVertices * 3);
  27835. let i2;
  27836. for (i2 = 0; i2 < tan1.length; i2++) {
  27837. tan1[i2] = 0;
  27838. }
  27839. let i03;
  27840. let i13;
  27841. let i23;
  27842. for (i2 = 0; i2 < numIndices; i2 += 3) {
  27843. const i0 = indices2[i2];
  27844. const i1 = indices2[i2 + 1];
  27845. const i22 = indices2[i2 + 2];
  27846. i03 = i0 * 3;
  27847. i13 = i1 * 3;
  27848. i23 = i22 * 3;
  27849. const i02 = i0 * 2;
  27850. const i12 = i1 * 2;
  27851. const i222 = i22 * 2;
  27852. const ux = vertices[i03];
  27853. const uy = vertices[i03 + 1];
  27854. const uz = vertices[i03 + 2];
  27855. const wx = st[i02];
  27856. const wy = st[i02 + 1];
  27857. const t1 = st[i12 + 1] - wy;
  27858. const t2 = st[i222 + 1] - wy;
  27859. const r2 = 1 / ((st[i12] - wx) * t2 - (st[i222] - wx) * t1);
  27860. const sdirx = (t2 * (vertices[i13] - ux) - t1 * (vertices[i23] - ux)) * r2;
  27861. const sdiry = (t2 * (vertices[i13 + 1] - uy) - t1 * (vertices[i23 + 1] - uy)) * r2;
  27862. const sdirz = (t2 * (vertices[i13 + 2] - uz) - t1 * (vertices[i23 + 2] - uz)) * r2;
  27863. tan1[i03] += sdirx;
  27864. tan1[i03 + 1] += sdiry;
  27865. tan1[i03 + 2] += sdirz;
  27866. tan1[i13] += sdirx;
  27867. tan1[i13 + 1] += sdiry;
  27868. tan1[i13 + 2] += sdirz;
  27869. tan1[i23] += sdirx;
  27870. tan1[i23 + 1] += sdiry;
  27871. tan1[i23 + 2] += sdirz;
  27872. }
  27873. const tangentValues = new Float32Array(numVertices * 3);
  27874. const bitangentValues = new Float32Array(numVertices * 3);
  27875. for (i2 = 0; i2 < numVertices; i2++) {
  27876. i03 = i2 * 3;
  27877. i13 = i03 + 1;
  27878. i23 = i03 + 2;
  27879. const n2 = Cartesian3_default.fromArray(normals, i03, normalScratch2);
  27880. const t = Cartesian3_default.fromArray(tan1, i03, tScratch);
  27881. const scalar = Cartesian3_default.dot(n2, t);
  27882. Cartesian3_default.multiplyByScalar(n2, scalar, normalScale);
  27883. Cartesian3_default.normalize(Cartesian3_default.subtract(t, normalScale, t), t);
  27884. tangentValues[i03] = t.x;
  27885. tangentValues[i13] = t.y;
  27886. tangentValues[i23] = t.z;
  27887. Cartesian3_default.normalize(Cartesian3_default.cross(n2, t, t), t);
  27888. bitangentValues[i03] = t.x;
  27889. bitangentValues[i13] = t.y;
  27890. bitangentValues[i23] = t.z;
  27891. }
  27892. geometry.attributes.tangent = new GeometryAttribute_default({
  27893. componentDatatype: ComponentDatatype_default.FLOAT,
  27894. componentsPerAttribute: 3,
  27895. values: tangentValues
  27896. });
  27897. geometry.attributes.bitangent = new GeometryAttribute_default({
  27898. componentDatatype: ComponentDatatype_default.FLOAT,
  27899. componentsPerAttribute: 3,
  27900. values: bitangentValues
  27901. });
  27902. return geometry;
  27903. };
  27904. var scratchCartesian25 = new Cartesian2_default();
  27905. var toEncode1 = new Cartesian3_default();
  27906. var toEncode2 = new Cartesian3_default();
  27907. var toEncode3 = new Cartesian3_default();
  27908. var encodeResult2 = new Cartesian2_default();
  27909. GeometryPipeline.compressVertices = function(geometry) {
  27910. if (!defined_default(geometry)) {
  27911. throw new DeveloperError_default("geometry is required.");
  27912. }
  27913. const extrudeAttribute = geometry.attributes.extrudeDirection;
  27914. let i2;
  27915. let numVertices;
  27916. if (defined_default(extrudeAttribute)) {
  27917. const extrudeDirections = extrudeAttribute.values;
  27918. numVertices = extrudeDirections.length / 3;
  27919. const compressedDirections = new Float32Array(numVertices * 2);
  27920. let i22 = 0;
  27921. for (i2 = 0; i2 < numVertices; ++i2) {
  27922. Cartesian3_default.fromArray(extrudeDirections, i2 * 3, toEncode1);
  27923. if (Cartesian3_default.equals(toEncode1, Cartesian3_default.ZERO)) {
  27924. i22 += 2;
  27925. continue;
  27926. }
  27927. encodeResult2 = AttributeCompression_default.octEncodeInRange(
  27928. toEncode1,
  27929. 65535,
  27930. encodeResult2
  27931. );
  27932. compressedDirections[i22++] = encodeResult2.x;
  27933. compressedDirections[i22++] = encodeResult2.y;
  27934. }
  27935. geometry.attributes.compressedAttributes = new GeometryAttribute_default({
  27936. componentDatatype: ComponentDatatype_default.FLOAT,
  27937. componentsPerAttribute: 2,
  27938. values: compressedDirections
  27939. });
  27940. delete geometry.attributes.extrudeDirection;
  27941. return geometry;
  27942. }
  27943. const normalAttribute = geometry.attributes.normal;
  27944. const stAttribute = geometry.attributes.st;
  27945. const hasNormal = defined_default(normalAttribute);
  27946. const hasSt = defined_default(stAttribute);
  27947. if (!hasNormal && !hasSt) {
  27948. return geometry;
  27949. }
  27950. const tangentAttribute = geometry.attributes.tangent;
  27951. const bitangentAttribute = geometry.attributes.bitangent;
  27952. const hasTangent = defined_default(tangentAttribute);
  27953. const hasBitangent = defined_default(bitangentAttribute);
  27954. let normals;
  27955. let st;
  27956. let tangents;
  27957. let bitangents;
  27958. if (hasNormal) {
  27959. normals = normalAttribute.values;
  27960. }
  27961. if (hasSt) {
  27962. st = stAttribute.values;
  27963. }
  27964. if (hasTangent) {
  27965. tangents = tangentAttribute.values;
  27966. }
  27967. if (hasBitangent) {
  27968. bitangents = bitangentAttribute.values;
  27969. }
  27970. const length3 = hasNormal ? normals.length : st.length;
  27971. const numComponents = hasNormal ? 3 : 2;
  27972. numVertices = length3 / numComponents;
  27973. let compressedLength = numVertices;
  27974. let numCompressedComponents = hasSt && hasNormal ? 2 : 1;
  27975. numCompressedComponents += hasTangent || hasBitangent ? 1 : 0;
  27976. compressedLength *= numCompressedComponents;
  27977. const compressedAttributes = new Float32Array(compressedLength);
  27978. let normalIndex = 0;
  27979. for (i2 = 0; i2 < numVertices; ++i2) {
  27980. if (hasSt) {
  27981. Cartesian2_default.fromArray(st, i2 * 2, scratchCartesian25);
  27982. compressedAttributes[normalIndex++] = AttributeCompression_default.compressTextureCoordinates(scratchCartesian25);
  27983. }
  27984. const index2 = i2 * 3;
  27985. if (hasNormal && defined_default(tangents) && defined_default(bitangents)) {
  27986. Cartesian3_default.fromArray(normals, index2, toEncode1);
  27987. Cartesian3_default.fromArray(tangents, index2, toEncode2);
  27988. Cartesian3_default.fromArray(bitangents, index2, toEncode3);
  27989. AttributeCompression_default.octPack(
  27990. toEncode1,
  27991. toEncode2,
  27992. toEncode3,
  27993. scratchCartesian25
  27994. );
  27995. compressedAttributes[normalIndex++] = scratchCartesian25.x;
  27996. compressedAttributes[normalIndex++] = scratchCartesian25.y;
  27997. } else {
  27998. if (hasNormal) {
  27999. Cartesian3_default.fromArray(normals, index2, toEncode1);
  28000. compressedAttributes[normalIndex++] = AttributeCompression_default.octEncodeFloat(toEncode1);
  28001. }
  28002. if (hasTangent) {
  28003. Cartesian3_default.fromArray(tangents, index2, toEncode1);
  28004. compressedAttributes[normalIndex++] = AttributeCompression_default.octEncodeFloat(toEncode1);
  28005. }
  28006. if (hasBitangent) {
  28007. Cartesian3_default.fromArray(bitangents, index2, toEncode1);
  28008. compressedAttributes[normalIndex++] = AttributeCompression_default.octEncodeFloat(toEncode1);
  28009. }
  28010. }
  28011. }
  28012. geometry.attributes.compressedAttributes = new GeometryAttribute_default({
  28013. componentDatatype: ComponentDatatype_default.FLOAT,
  28014. componentsPerAttribute: numCompressedComponents,
  28015. values: compressedAttributes
  28016. });
  28017. if (hasNormal) {
  28018. delete geometry.attributes.normal;
  28019. }
  28020. if (hasSt) {
  28021. delete geometry.attributes.st;
  28022. }
  28023. if (hasBitangent) {
  28024. delete geometry.attributes.bitangent;
  28025. }
  28026. if (hasTangent) {
  28027. delete geometry.attributes.tangent;
  28028. }
  28029. return geometry;
  28030. };
  28031. function indexTriangles(geometry) {
  28032. if (defined_default(geometry.indices)) {
  28033. return geometry;
  28034. }
  28035. const numberOfVertices = Geometry_default.computeNumberOfVertices(geometry);
  28036. if (numberOfVertices < 3) {
  28037. throw new DeveloperError_default("The number of vertices must be at least three.");
  28038. }
  28039. if (numberOfVertices % 3 !== 0) {
  28040. throw new DeveloperError_default(
  28041. "The number of vertices must be a multiple of three."
  28042. );
  28043. }
  28044. const indices2 = IndexDatatype_default.createTypedArray(
  28045. numberOfVertices,
  28046. numberOfVertices
  28047. );
  28048. for (let i2 = 0; i2 < numberOfVertices; ++i2) {
  28049. indices2[i2] = i2;
  28050. }
  28051. geometry.indices = indices2;
  28052. return geometry;
  28053. }
  28054. function indexTriangleFan(geometry) {
  28055. const numberOfVertices = Geometry_default.computeNumberOfVertices(geometry);
  28056. if (numberOfVertices < 3) {
  28057. throw new DeveloperError_default("The number of vertices must be at least three.");
  28058. }
  28059. const indices2 = IndexDatatype_default.createTypedArray(
  28060. numberOfVertices,
  28061. (numberOfVertices - 2) * 3
  28062. );
  28063. indices2[0] = 1;
  28064. indices2[1] = 0;
  28065. indices2[2] = 2;
  28066. let indicesIndex = 3;
  28067. for (let i2 = 3; i2 < numberOfVertices; ++i2) {
  28068. indices2[indicesIndex++] = i2 - 1;
  28069. indices2[indicesIndex++] = 0;
  28070. indices2[indicesIndex++] = i2;
  28071. }
  28072. geometry.indices = indices2;
  28073. geometry.primitiveType = PrimitiveType_default.TRIANGLES;
  28074. return geometry;
  28075. }
  28076. function indexTriangleStrip(geometry) {
  28077. const numberOfVertices = Geometry_default.computeNumberOfVertices(geometry);
  28078. if (numberOfVertices < 3) {
  28079. throw new DeveloperError_default("The number of vertices must be at least 3.");
  28080. }
  28081. const indices2 = IndexDatatype_default.createTypedArray(
  28082. numberOfVertices,
  28083. (numberOfVertices - 2) * 3
  28084. );
  28085. indices2[0] = 0;
  28086. indices2[1] = 1;
  28087. indices2[2] = 2;
  28088. if (numberOfVertices > 3) {
  28089. indices2[3] = 0;
  28090. indices2[4] = 2;
  28091. indices2[5] = 3;
  28092. }
  28093. let indicesIndex = 6;
  28094. for (let i2 = 3; i2 < numberOfVertices - 1; i2 += 2) {
  28095. indices2[indicesIndex++] = i2;
  28096. indices2[indicesIndex++] = i2 - 1;
  28097. indices2[indicesIndex++] = i2 + 1;
  28098. if (i2 + 2 < numberOfVertices) {
  28099. indices2[indicesIndex++] = i2;
  28100. indices2[indicesIndex++] = i2 + 1;
  28101. indices2[indicesIndex++] = i2 + 2;
  28102. }
  28103. }
  28104. geometry.indices = indices2;
  28105. geometry.primitiveType = PrimitiveType_default.TRIANGLES;
  28106. return geometry;
  28107. }
  28108. function indexLines(geometry) {
  28109. if (defined_default(geometry.indices)) {
  28110. return geometry;
  28111. }
  28112. const numberOfVertices = Geometry_default.computeNumberOfVertices(geometry);
  28113. if (numberOfVertices < 2) {
  28114. throw new DeveloperError_default("The number of vertices must be at least two.");
  28115. }
  28116. if (numberOfVertices % 2 !== 0) {
  28117. throw new DeveloperError_default("The number of vertices must be a multiple of 2.");
  28118. }
  28119. const indices2 = IndexDatatype_default.createTypedArray(
  28120. numberOfVertices,
  28121. numberOfVertices
  28122. );
  28123. for (let i2 = 0; i2 < numberOfVertices; ++i2) {
  28124. indices2[i2] = i2;
  28125. }
  28126. geometry.indices = indices2;
  28127. return geometry;
  28128. }
  28129. function indexLineStrip(geometry) {
  28130. const numberOfVertices = Geometry_default.computeNumberOfVertices(geometry);
  28131. if (numberOfVertices < 2) {
  28132. throw new DeveloperError_default("The number of vertices must be at least two.");
  28133. }
  28134. const indices2 = IndexDatatype_default.createTypedArray(
  28135. numberOfVertices,
  28136. (numberOfVertices - 1) * 2
  28137. );
  28138. indices2[0] = 0;
  28139. indices2[1] = 1;
  28140. let indicesIndex = 2;
  28141. for (let i2 = 2; i2 < numberOfVertices; ++i2) {
  28142. indices2[indicesIndex++] = i2 - 1;
  28143. indices2[indicesIndex++] = i2;
  28144. }
  28145. geometry.indices = indices2;
  28146. geometry.primitiveType = PrimitiveType_default.LINES;
  28147. return geometry;
  28148. }
  28149. function indexLineLoop(geometry) {
  28150. const numberOfVertices = Geometry_default.computeNumberOfVertices(geometry);
  28151. if (numberOfVertices < 2) {
  28152. throw new DeveloperError_default("The number of vertices must be at least two.");
  28153. }
  28154. const indices2 = IndexDatatype_default.createTypedArray(
  28155. numberOfVertices,
  28156. numberOfVertices * 2
  28157. );
  28158. indices2[0] = 0;
  28159. indices2[1] = 1;
  28160. let indicesIndex = 2;
  28161. for (let i2 = 2; i2 < numberOfVertices; ++i2) {
  28162. indices2[indicesIndex++] = i2 - 1;
  28163. indices2[indicesIndex++] = i2;
  28164. }
  28165. indices2[indicesIndex++] = numberOfVertices - 1;
  28166. indices2[indicesIndex] = 0;
  28167. geometry.indices = indices2;
  28168. geometry.primitiveType = PrimitiveType_default.LINES;
  28169. return geometry;
  28170. }
  28171. function indexPrimitive(geometry) {
  28172. switch (geometry.primitiveType) {
  28173. case PrimitiveType_default.TRIANGLE_FAN:
  28174. return indexTriangleFan(geometry);
  28175. case PrimitiveType_default.TRIANGLE_STRIP:
  28176. return indexTriangleStrip(geometry);
  28177. case PrimitiveType_default.TRIANGLES:
  28178. return indexTriangles(geometry);
  28179. case PrimitiveType_default.LINE_STRIP:
  28180. return indexLineStrip(geometry);
  28181. case PrimitiveType_default.LINE_LOOP:
  28182. return indexLineLoop(geometry);
  28183. case PrimitiveType_default.LINES:
  28184. return indexLines(geometry);
  28185. }
  28186. return geometry;
  28187. }
  28188. function offsetPointFromXZPlane(p2, isBehind) {
  28189. if (Math.abs(p2.y) < Math_default.EPSILON6) {
  28190. if (isBehind) {
  28191. p2.y = -Math_default.EPSILON6;
  28192. } else {
  28193. p2.y = Math_default.EPSILON6;
  28194. }
  28195. }
  28196. }
  28197. function offsetTriangleFromXZPlane(p0, p1, p2) {
  28198. if (p0.y !== 0 && p1.y !== 0 && p2.y !== 0) {
  28199. offsetPointFromXZPlane(p0, p0.y < 0);
  28200. offsetPointFromXZPlane(p1, p1.y < 0);
  28201. offsetPointFromXZPlane(p2, p2.y < 0);
  28202. return;
  28203. }
  28204. const p0y = Math.abs(p0.y);
  28205. const p1y = Math.abs(p1.y);
  28206. const p2y = Math.abs(p2.y);
  28207. let sign3;
  28208. if (p0y > p1y) {
  28209. if (p0y > p2y) {
  28210. sign3 = Math_default.sign(p0.y);
  28211. } else {
  28212. sign3 = Math_default.sign(p2.y);
  28213. }
  28214. } else if (p1y > p2y) {
  28215. sign3 = Math_default.sign(p1.y);
  28216. } else {
  28217. sign3 = Math_default.sign(p2.y);
  28218. }
  28219. const isBehind = sign3 < 0;
  28220. offsetPointFromXZPlane(p0, isBehind);
  28221. offsetPointFromXZPlane(p1, isBehind);
  28222. offsetPointFromXZPlane(p2, isBehind);
  28223. }
  28224. var c3 = new Cartesian3_default();
  28225. function getXZIntersectionOffsetPoints(p2, p1, u12, v13) {
  28226. Cartesian3_default.add(
  28227. p2,
  28228. Cartesian3_default.multiplyByScalar(
  28229. Cartesian3_default.subtract(p1, p2, c3),
  28230. p2.y / (p2.y - p1.y),
  28231. c3
  28232. ),
  28233. u12
  28234. );
  28235. Cartesian3_default.clone(u12, v13);
  28236. offsetPointFromXZPlane(u12, true);
  28237. offsetPointFromXZPlane(v13, false);
  28238. }
  28239. var u1 = new Cartesian3_default();
  28240. var u2 = new Cartesian3_default();
  28241. var q1 = new Cartesian3_default();
  28242. var q2 = new Cartesian3_default();
  28243. var splitTriangleResult = {
  28244. positions: new Array(7),
  28245. indices: new Array(3 * 3)
  28246. };
  28247. function splitTriangle(p0, p1, p2) {
  28248. if (p0.x >= 0 || p1.x >= 0 || p2.x >= 0) {
  28249. return void 0;
  28250. }
  28251. offsetTriangleFromXZPlane(p0, p1, p2);
  28252. const p0Behind = p0.y < 0;
  28253. const p1Behind = p1.y < 0;
  28254. const p2Behind = p2.y < 0;
  28255. let numBehind = 0;
  28256. numBehind += p0Behind ? 1 : 0;
  28257. numBehind += p1Behind ? 1 : 0;
  28258. numBehind += p2Behind ? 1 : 0;
  28259. const indices2 = splitTriangleResult.indices;
  28260. if (numBehind === 1) {
  28261. indices2[1] = 3;
  28262. indices2[2] = 4;
  28263. indices2[5] = 6;
  28264. indices2[7] = 6;
  28265. indices2[8] = 5;
  28266. if (p0Behind) {
  28267. getXZIntersectionOffsetPoints(p0, p1, u1, q1);
  28268. getXZIntersectionOffsetPoints(p0, p2, u2, q2);
  28269. indices2[0] = 0;
  28270. indices2[3] = 1;
  28271. indices2[4] = 2;
  28272. indices2[6] = 1;
  28273. } else if (p1Behind) {
  28274. getXZIntersectionOffsetPoints(p1, p2, u1, q1);
  28275. getXZIntersectionOffsetPoints(p1, p0, u2, q2);
  28276. indices2[0] = 1;
  28277. indices2[3] = 2;
  28278. indices2[4] = 0;
  28279. indices2[6] = 2;
  28280. } else if (p2Behind) {
  28281. getXZIntersectionOffsetPoints(p2, p0, u1, q1);
  28282. getXZIntersectionOffsetPoints(p2, p1, u2, q2);
  28283. indices2[0] = 2;
  28284. indices2[3] = 0;
  28285. indices2[4] = 1;
  28286. indices2[6] = 0;
  28287. }
  28288. } else if (numBehind === 2) {
  28289. indices2[2] = 4;
  28290. indices2[4] = 4;
  28291. indices2[5] = 3;
  28292. indices2[7] = 5;
  28293. indices2[8] = 6;
  28294. if (!p0Behind) {
  28295. getXZIntersectionOffsetPoints(p0, p1, u1, q1);
  28296. getXZIntersectionOffsetPoints(p0, p2, u2, q2);
  28297. indices2[0] = 1;
  28298. indices2[1] = 2;
  28299. indices2[3] = 1;
  28300. indices2[6] = 0;
  28301. } else if (!p1Behind) {
  28302. getXZIntersectionOffsetPoints(p1, p2, u1, q1);
  28303. getXZIntersectionOffsetPoints(p1, p0, u2, q2);
  28304. indices2[0] = 2;
  28305. indices2[1] = 0;
  28306. indices2[3] = 2;
  28307. indices2[6] = 1;
  28308. } else if (!p2Behind) {
  28309. getXZIntersectionOffsetPoints(p2, p0, u1, q1);
  28310. getXZIntersectionOffsetPoints(p2, p1, u2, q2);
  28311. indices2[0] = 0;
  28312. indices2[1] = 1;
  28313. indices2[3] = 0;
  28314. indices2[6] = 2;
  28315. }
  28316. }
  28317. const positions = splitTriangleResult.positions;
  28318. positions[0] = p0;
  28319. positions[1] = p1;
  28320. positions[2] = p2;
  28321. positions.length = 3;
  28322. if (numBehind === 1 || numBehind === 2) {
  28323. positions[3] = u1;
  28324. positions[4] = u2;
  28325. positions[5] = q1;
  28326. positions[6] = q2;
  28327. positions.length = 7;
  28328. }
  28329. return splitTriangleResult;
  28330. }
  28331. function updateGeometryAfterSplit(geometry, computeBoundingSphere) {
  28332. const attributes = geometry.attributes;
  28333. if (attributes.position.values.length === 0) {
  28334. return void 0;
  28335. }
  28336. for (const property in attributes) {
  28337. if (attributes.hasOwnProperty(property) && defined_default(attributes[property]) && defined_default(attributes[property].values)) {
  28338. const attribute = attributes[property];
  28339. attribute.values = ComponentDatatype_default.createTypedArray(
  28340. attribute.componentDatatype,
  28341. attribute.values
  28342. );
  28343. }
  28344. }
  28345. const numberOfVertices = Geometry_default.computeNumberOfVertices(geometry);
  28346. geometry.indices = IndexDatatype_default.createTypedArray(
  28347. numberOfVertices,
  28348. geometry.indices
  28349. );
  28350. if (computeBoundingSphere) {
  28351. geometry.boundingSphere = BoundingSphere_default.fromVertices(
  28352. attributes.position.values
  28353. );
  28354. }
  28355. return geometry;
  28356. }
  28357. function copyGeometryForSplit(geometry) {
  28358. const attributes = geometry.attributes;
  28359. const copiedAttributes = {};
  28360. for (const property in attributes) {
  28361. if (attributes.hasOwnProperty(property) && defined_default(attributes[property]) && defined_default(attributes[property].values)) {
  28362. const attribute = attributes[property];
  28363. copiedAttributes[property] = new GeometryAttribute_default({
  28364. componentDatatype: attribute.componentDatatype,
  28365. componentsPerAttribute: attribute.componentsPerAttribute,
  28366. normalize: attribute.normalize,
  28367. values: []
  28368. });
  28369. }
  28370. }
  28371. return new Geometry_default({
  28372. attributes: copiedAttributes,
  28373. indices: [],
  28374. primitiveType: geometry.primitiveType
  28375. });
  28376. }
  28377. function updateInstanceAfterSplit(instance, westGeometry, eastGeometry) {
  28378. const computeBoundingSphere = defined_default(instance.geometry.boundingSphere);
  28379. westGeometry = updateGeometryAfterSplit(westGeometry, computeBoundingSphere);
  28380. eastGeometry = updateGeometryAfterSplit(eastGeometry, computeBoundingSphere);
  28381. if (defined_default(eastGeometry) && !defined_default(westGeometry)) {
  28382. instance.geometry = eastGeometry;
  28383. } else if (!defined_default(eastGeometry) && defined_default(westGeometry)) {
  28384. instance.geometry = westGeometry;
  28385. } else {
  28386. instance.westHemisphereGeometry = westGeometry;
  28387. instance.eastHemisphereGeometry = eastGeometry;
  28388. instance.geometry = void 0;
  28389. }
  28390. }
  28391. function generateBarycentricInterpolateFunction(CartesianType, numberOfComponents) {
  28392. const v0Scratch = new CartesianType();
  28393. const v1Scratch2 = new CartesianType();
  28394. const v2Scratch2 = new CartesianType();
  28395. return function(i0, i1, i2, coords, sourceValues, currentValues, insertedIndex, normalize2) {
  28396. const v02 = CartesianType.fromArray(
  28397. sourceValues,
  28398. i0 * numberOfComponents,
  28399. v0Scratch
  28400. );
  28401. const v13 = CartesianType.fromArray(
  28402. sourceValues,
  28403. i1 * numberOfComponents,
  28404. v1Scratch2
  28405. );
  28406. const v23 = CartesianType.fromArray(
  28407. sourceValues,
  28408. i2 * numberOfComponents,
  28409. v2Scratch2
  28410. );
  28411. CartesianType.multiplyByScalar(v02, coords.x, v02);
  28412. CartesianType.multiplyByScalar(v13, coords.y, v13);
  28413. CartesianType.multiplyByScalar(v23, coords.z, v23);
  28414. const value = CartesianType.add(v02, v13, v02);
  28415. CartesianType.add(value, v23, value);
  28416. if (normalize2) {
  28417. CartesianType.normalize(value, value);
  28418. }
  28419. CartesianType.pack(
  28420. value,
  28421. currentValues,
  28422. insertedIndex * numberOfComponents
  28423. );
  28424. };
  28425. }
  28426. var interpolateAndPackCartesian4 = generateBarycentricInterpolateFunction(
  28427. Cartesian4_default,
  28428. 4
  28429. );
  28430. var interpolateAndPackCartesian3 = generateBarycentricInterpolateFunction(
  28431. Cartesian3_default,
  28432. 3
  28433. );
  28434. var interpolateAndPackCartesian2 = generateBarycentricInterpolateFunction(
  28435. Cartesian2_default,
  28436. 2
  28437. );
  28438. var interpolateAndPackBoolean = function(i0, i1, i2, coords, sourceValues, currentValues, insertedIndex) {
  28439. const v13 = sourceValues[i0] * coords.x;
  28440. const v23 = sourceValues[i1] * coords.y;
  28441. const v32 = sourceValues[i2] * coords.z;
  28442. currentValues[insertedIndex] = v13 + v23 + v32 > Math_default.EPSILON6 ? 1 : 0;
  28443. };
  28444. var p0Scratch = new Cartesian3_default();
  28445. var p1Scratch = new Cartesian3_default();
  28446. var p2Scratch = new Cartesian3_default();
  28447. var barycentricScratch = new Cartesian3_default();
  28448. function computeTriangleAttributes(i0, i1, i2, point, positions, normals, tangents, bitangents, texCoords, extrudeDirections, applyOffset, currentAttributes, customAttributeNames, customAttributesLength, allAttributes, insertedIndex) {
  28449. if (!defined_default(normals) && !defined_default(tangents) && !defined_default(bitangents) && !defined_default(texCoords) && !defined_default(extrudeDirections) && customAttributesLength === 0) {
  28450. return;
  28451. }
  28452. const p0 = Cartesian3_default.fromArray(positions, i0 * 3, p0Scratch);
  28453. const p1 = Cartesian3_default.fromArray(positions, i1 * 3, p1Scratch);
  28454. const p2 = Cartesian3_default.fromArray(positions, i2 * 3, p2Scratch);
  28455. const coords = barycentricCoordinates_default(point, p0, p1, p2, barycentricScratch);
  28456. if (!defined_default(coords)) {
  28457. return;
  28458. }
  28459. if (defined_default(normals)) {
  28460. interpolateAndPackCartesian3(
  28461. i0,
  28462. i1,
  28463. i2,
  28464. coords,
  28465. normals,
  28466. currentAttributes.normal.values,
  28467. insertedIndex,
  28468. true
  28469. );
  28470. }
  28471. if (defined_default(extrudeDirections)) {
  28472. const d0 = Cartesian3_default.fromArray(extrudeDirections, i0 * 3, p0Scratch);
  28473. const d1 = Cartesian3_default.fromArray(extrudeDirections, i1 * 3, p1Scratch);
  28474. const d2 = Cartesian3_default.fromArray(extrudeDirections, i2 * 3, p2Scratch);
  28475. Cartesian3_default.multiplyByScalar(d0, coords.x, d0);
  28476. Cartesian3_default.multiplyByScalar(d1, coords.y, d1);
  28477. Cartesian3_default.multiplyByScalar(d2, coords.z, d2);
  28478. let direction2;
  28479. if (!Cartesian3_default.equals(d0, Cartesian3_default.ZERO) || !Cartesian3_default.equals(d1, Cartesian3_default.ZERO) || !Cartesian3_default.equals(d2, Cartesian3_default.ZERO)) {
  28480. direction2 = Cartesian3_default.add(d0, d1, d0);
  28481. Cartesian3_default.add(direction2, d2, direction2);
  28482. Cartesian3_default.normalize(direction2, direction2);
  28483. } else {
  28484. direction2 = p0Scratch;
  28485. direction2.x = 0;
  28486. direction2.y = 0;
  28487. direction2.z = 0;
  28488. }
  28489. Cartesian3_default.pack(
  28490. direction2,
  28491. currentAttributes.extrudeDirection.values,
  28492. insertedIndex * 3
  28493. );
  28494. }
  28495. if (defined_default(applyOffset)) {
  28496. interpolateAndPackBoolean(
  28497. i0,
  28498. i1,
  28499. i2,
  28500. coords,
  28501. applyOffset,
  28502. currentAttributes.applyOffset.values,
  28503. insertedIndex
  28504. );
  28505. }
  28506. if (defined_default(tangents)) {
  28507. interpolateAndPackCartesian3(
  28508. i0,
  28509. i1,
  28510. i2,
  28511. coords,
  28512. tangents,
  28513. currentAttributes.tangent.values,
  28514. insertedIndex,
  28515. true
  28516. );
  28517. }
  28518. if (defined_default(bitangents)) {
  28519. interpolateAndPackCartesian3(
  28520. i0,
  28521. i1,
  28522. i2,
  28523. coords,
  28524. bitangents,
  28525. currentAttributes.bitangent.values,
  28526. insertedIndex,
  28527. true
  28528. );
  28529. }
  28530. if (defined_default(texCoords)) {
  28531. interpolateAndPackCartesian2(
  28532. i0,
  28533. i1,
  28534. i2,
  28535. coords,
  28536. texCoords,
  28537. currentAttributes.st.values,
  28538. insertedIndex
  28539. );
  28540. }
  28541. if (customAttributesLength > 0) {
  28542. for (let i3 = 0; i3 < customAttributesLength; i3++) {
  28543. const attributeName = customAttributeNames[i3];
  28544. genericInterpolate(
  28545. i0,
  28546. i1,
  28547. i2,
  28548. coords,
  28549. insertedIndex,
  28550. allAttributes[attributeName],
  28551. currentAttributes[attributeName]
  28552. );
  28553. }
  28554. }
  28555. }
  28556. function genericInterpolate(i0, i1, i2, coords, insertedIndex, sourceAttribute, currentAttribute) {
  28557. const componentsPerAttribute = sourceAttribute.componentsPerAttribute;
  28558. const sourceValues = sourceAttribute.values;
  28559. const currentValues = currentAttribute.values;
  28560. switch (componentsPerAttribute) {
  28561. case 4:
  28562. interpolateAndPackCartesian4(
  28563. i0,
  28564. i1,
  28565. i2,
  28566. coords,
  28567. sourceValues,
  28568. currentValues,
  28569. insertedIndex,
  28570. false
  28571. );
  28572. break;
  28573. case 3:
  28574. interpolateAndPackCartesian3(
  28575. i0,
  28576. i1,
  28577. i2,
  28578. coords,
  28579. sourceValues,
  28580. currentValues,
  28581. insertedIndex,
  28582. false
  28583. );
  28584. break;
  28585. case 2:
  28586. interpolateAndPackCartesian2(
  28587. i0,
  28588. i1,
  28589. i2,
  28590. coords,
  28591. sourceValues,
  28592. currentValues,
  28593. insertedIndex,
  28594. false
  28595. );
  28596. break;
  28597. default:
  28598. currentValues[insertedIndex] = sourceValues[i0] * coords.x + sourceValues[i1] * coords.y + sourceValues[i2] * coords.z;
  28599. }
  28600. }
  28601. function insertSplitPoint(currentAttributes, currentIndices, currentIndexMap, indices2, currentIndex, point) {
  28602. const insertIndex = currentAttributes.position.values.length / 3;
  28603. if (currentIndex !== -1) {
  28604. const prevIndex = indices2[currentIndex];
  28605. const newIndex = currentIndexMap[prevIndex];
  28606. if (newIndex === -1) {
  28607. currentIndexMap[prevIndex] = insertIndex;
  28608. currentAttributes.position.values.push(point.x, point.y, point.z);
  28609. currentIndices.push(insertIndex);
  28610. return insertIndex;
  28611. }
  28612. currentIndices.push(newIndex);
  28613. return newIndex;
  28614. }
  28615. currentAttributes.position.values.push(point.x, point.y, point.z);
  28616. currentIndices.push(insertIndex);
  28617. return insertIndex;
  28618. }
  28619. var NAMED_ATTRIBUTES = {
  28620. position: true,
  28621. normal: true,
  28622. bitangent: true,
  28623. tangent: true,
  28624. st: true,
  28625. extrudeDirection: true,
  28626. applyOffset: true
  28627. };
  28628. function splitLongitudeTriangles(instance) {
  28629. const geometry = instance.geometry;
  28630. const attributes = geometry.attributes;
  28631. const positions = attributes.position.values;
  28632. const normals = defined_default(attributes.normal) ? attributes.normal.values : void 0;
  28633. const bitangents = defined_default(attributes.bitangent) ? attributes.bitangent.values : void 0;
  28634. const tangents = defined_default(attributes.tangent) ? attributes.tangent.values : void 0;
  28635. const texCoords = defined_default(attributes.st) ? attributes.st.values : void 0;
  28636. const extrudeDirections = defined_default(attributes.extrudeDirection) ? attributes.extrudeDirection.values : void 0;
  28637. const applyOffset = defined_default(attributes.applyOffset) ? attributes.applyOffset.values : void 0;
  28638. const indices2 = geometry.indices;
  28639. const customAttributeNames = [];
  28640. for (const attributeName in attributes) {
  28641. if (attributes.hasOwnProperty(attributeName) && !NAMED_ATTRIBUTES[attributeName] && defined_default(attributes[attributeName])) {
  28642. customAttributeNames.push(attributeName);
  28643. }
  28644. }
  28645. const customAttributesLength = customAttributeNames.length;
  28646. const eastGeometry = copyGeometryForSplit(geometry);
  28647. const westGeometry = copyGeometryForSplit(geometry);
  28648. let currentAttributes;
  28649. let currentIndices;
  28650. let currentIndexMap;
  28651. let insertedIndex;
  28652. let i2;
  28653. const westGeometryIndexMap = [];
  28654. westGeometryIndexMap.length = positions.length / 3;
  28655. const eastGeometryIndexMap = [];
  28656. eastGeometryIndexMap.length = positions.length / 3;
  28657. for (i2 = 0; i2 < westGeometryIndexMap.length; ++i2) {
  28658. westGeometryIndexMap[i2] = -1;
  28659. eastGeometryIndexMap[i2] = -1;
  28660. }
  28661. const len = indices2.length;
  28662. for (i2 = 0; i2 < len; i2 += 3) {
  28663. const i0 = indices2[i2];
  28664. const i1 = indices2[i2 + 1];
  28665. const i22 = indices2[i2 + 2];
  28666. let p0 = Cartesian3_default.fromArray(positions, i0 * 3);
  28667. let p1 = Cartesian3_default.fromArray(positions, i1 * 3);
  28668. let p2 = Cartesian3_default.fromArray(positions, i22 * 3);
  28669. const result = splitTriangle(p0, p1, p2);
  28670. if (defined_default(result) && result.positions.length > 3) {
  28671. const resultPositions = result.positions;
  28672. const resultIndices = result.indices;
  28673. const resultLength = resultIndices.length;
  28674. for (let j = 0; j < resultLength; ++j) {
  28675. const resultIndex = resultIndices[j];
  28676. const point = resultPositions[resultIndex];
  28677. if (point.y < 0) {
  28678. currentAttributes = westGeometry.attributes;
  28679. currentIndices = westGeometry.indices;
  28680. currentIndexMap = westGeometryIndexMap;
  28681. } else {
  28682. currentAttributes = eastGeometry.attributes;
  28683. currentIndices = eastGeometry.indices;
  28684. currentIndexMap = eastGeometryIndexMap;
  28685. }
  28686. insertedIndex = insertSplitPoint(
  28687. currentAttributes,
  28688. currentIndices,
  28689. currentIndexMap,
  28690. indices2,
  28691. resultIndex < 3 ? i2 + resultIndex : -1,
  28692. point
  28693. );
  28694. computeTriangleAttributes(
  28695. i0,
  28696. i1,
  28697. i22,
  28698. point,
  28699. positions,
  28700. normals,
  28701. tangents,
  28702. bitangents,
  28703. texCoords,
  28704. extrudeDirections,
  28705. applyOffset,
  28706. currentAttributes,
  28707. customAttributeNames,
  28708. customAttributesLength,
  28709. attributes,
  28710. insertedIndex
  28711. );
  28712. }
  28713. } else {
  28714. if (defined_default(result)) {
  28715. p0 = result.positions[0];
  28716. p1 = result.positions[1];
  28717. p2 = result.positions[2];
  28718. }
  28719. if (p0.y < 0) {
  28720. currentAttributes = westGeometry.attributes;
  28721. currentIndices = westGeometry.indices;
  28722. currentIndexMap = westGeometryIndexMap;
  28723. } else {
  28724. currentAttributes = eastGeometry.attributes;
  28725. currentIndices = eastGeometry.indices;
  28726. currentIndexMap = eastGeometryIndexMap;
  28727. }
  28728. insertedIndex = insertSplitPoint(
  28729. currentAttributes,
  28730. currentIndices,
  28731. currentIndexMap,
  28732. indices2,
  28733. i2,
  28734. p0
  28735. );
  28736. computeTriangleAttributes(
  28737. i0,
  28738. i1,
  28739. i22,
  28740. p0,
  28741. positions,
  28742. normals,
  28743. tangents,
  28744. bitangents,
  28745. texCoords,
  28746. extrudeDirections,
  28747. applyOffset,
  28748. currentAttributes,
  28749. customAttributeNames,
  28750. customAttributesLength,
  28751. attributes,
  28752. insertedIndex
  28753. );
  28754. insertedIndex = insertSplitPoint(
  28755. currentAttributes,
  28756. currentIndices,
  28757. currentIndexMap,
  28758. indices2,
  28759. i2 + 1,
  28760. p1
  28761. );
  28762. computeTriangleAttributes(
  28763. i0,
  28764. i1,
  28765. i22,
  28766. p1,
  28767. positions,
  28768. normals,
  28769. tangents,
  28770. bitangents,
  28771. texCoords,
  28772. extrudeDirections,
  28773. applyOffset,
  28774. currentAttributes,
  28775. customAttributeNames,
  28776. customAttributesLength,
  28777. attributes,
  28778. insertedIndex
  28779. );
  28780. insertedIndex = insertSplitPoint(
  28781. currentAttributes,
  28782. currentIndices,
  28783. currentIndexMap,
  28784. indices2,
  28785. i2 + 2,
  28786. p2
  28787. );
  28788. computeTriangleAttributes(
  28789. i0,
  28790. i1,
  28791. i22,
  28792. p2,
  28793. positions,
  28794. normals,
  28795. tangents,
  28796. bitangents,
  28797. texCoords,
  28798. extrudeDirections,
  28799. applyOffset,
  28800. currentAttributes,
  28801. customAttributeNames,
  28802. customAttributesLength,
  28803. attributes,
  28804. insertedIndex
  28805. );
  28806. }
  28807. }
  28808. updateInstanceAfterSplit(instance, westGeometry, eastGeometry);
  28809. }
  28810. var xzPlane = Plane_default.fromPointNormal(Cartesian3_default.ZERO, Cartesian3_default.UNIT_Y);
  28811. var offsetScratch = new Cartesian3_default();
  28812. var offsetPointScratch = new Cartesian3_default();
  28813. function computeLineAttributes(i0, i1, point, positions, insertIndex, currentAttributes, applyOffset) {
  28814. if (!defined_default(applyOffset)) {
  28815. return;
  28816. }
  28817. const p0 = Cartesian3_default.fromArray(positions, i0 * 3, p0Scratch);
  28818. if (Cartesian3_default.equalsEpsilon(p0, point, Math_default.EPSILON10)) {
  28819. currentAttributes.applyOffset.values[insertIndex] = applyOffset[i0];
  28820. } else {
  28821. currentAttributes.applyOffset.values[insertIndex] = applyOffset[i1];
  28822. }
  28823. }
  28824. function splitLongitudeLines(instance) {
  28825. const geometry = instance.geometry;
  28826. const attributes = geometry.attributes;
  28827. const positions = attributes.position.values;
  28828. const applyOffset = defined_default(attributes.applyOffset) ? attributes.applyOffset.values : void 0;
  28829. const indices2 = geometry.indices;
  28830. const eastGeometry = copyGeometryForSplit(geometry);
  28831. const westGeometry = copyGeometryForSplit(geometry);
  28832. let i2;
  28833. const length3 = indices2.length;
  28834. const westGeometryIndexMap = [];
  28835. westGeometryIndexMap.length = positions.length / 3;
  28836. const eastGeometryIndexMap = [];
  28837. eastGeometryIndexMap.length = positions.length / 3;
  28838. for (i2 = 0; i2 < westGeometryIndexMap.length; ++i2) {
  28839. westGeometryIndexMap[i2] = -1;
  28840. eastGeometryIndexMap[i2] = -1;
  28841. }
  28842. for (i2 = 0; i2 < length3; i2 += 2) {
  28843. const i0 = indices2[i2];
  28844. const i1 = indices2[i2 + 1];
  28845. const p0 = Cartesian3_default.fromArray(positions, i0 * 3, p0Scratch);
  28846. const p1 = Cartesian3_default.fromArray(positions, i1 * 3, p1Scratch);
  28847. let insertIndex;
  28848. if (Math.abs(p0.y) < Math_default.EPSILON6) {
  28849. if (p0.y < 0) {
  28850. p0.y = -Math_default.EPSILON6;
  28851. } else {
  28852. p0.y = Math_default.EPSILON6;
  28853. }
  28854. }
  28855. if (Math.abs(p1.y) < Math_default.EPSILON6) {
  28856. if (p1.y < 0) {
  28857. p1.y = -Math_default.EPSILON6;
  28858. } else {
  28859. p1.y = Math_default.EPSILON6;
  28860. }
  28861. }
  28862. let p0Attributes = eastGeometry.attributes;
  28863. let p0Indices = eastGeometry.indices;
  28864. let p0IndexMap = eastGeometryIndexMap;
  28865. let p1Attributes = westGeometry.attributes;
  28866. let p1Indices = westGeometry.indices;
  28867. let p1IndexMap = westGeometryIndexMap;
  28868. const intersection = IntersectionTests_default.lineSegmentPlane(
  28869. p0,
  28870. p1,
  28871. xzPlane,
  28872. p2Scratch
  28873. );
  28874. if (defined_default(intersection)) {
  28875. const offset2 = Cartesian3_default.multiplyByScalar(
  28876. Cartesian3_default.UNIT_Y,
  28877. 5 * Math_default.EPSILON9,
  28878. offsetScratch
  28879. );
  28880. if (p0.y < 0) {
  28881. Cartesian3_default.negate(offset2, offset2);
  28882. p0Attributes = westGeometry.attributes;
  28883. p0Indices = westGeometry.indices;
  28884. p0IndexMap = westGeometryIndexMap;
  28885. p1Attributes = eastGeometry.attributes;
  28886. p1Indices = eastGeometry.indices;
  28887. p1IndexMap = eastGeometryIndexMap;
  28888. }
  28889. const offsetPoint = Cartesian3_default.add(
  28890. intersection,
  28891. offset2,
  28892. offsetPointScratch
  28893. );
  28894. insertIndex = insertSplitPoint(
  28895. p0Attributes,
  28896. p0Indices,
  28897. p0IndexMap,
  28898. indices2,
  28899. i2,
  28900. p0
  28901. );
  28902. computeLineAttributes(
  28903. i0,
  28904. i1,
  28905. p0,
  28906. positions,
  28907. insertIndex,
  28908. p0Attributes,
  28909. applyOffset
  28910. );
  28911. insertIndex = insertSplitPoint(
  28912. p0Attributes,
  28913. p0Indices,
  28914. p0IndexMap,
  28915. indices2,
  28916. -1,
  28917. offsetPoint
  28918. );
  28919. computeLineAttributes(
  28920. i0,
  28921. i1,
  28922. offsetPoint,
  28923. positions,
  28924. insertIndex,
  28925. p0Attributes,
  28926. applyOffset
  28927. );
  28928. Cartesian3_default.negate(offset2, offset2);
  28929. Cartesian3_default.add(intersection, offset2, offsetPoint);
  28930. insertIndex = insertSplitPoint(
  28931. p1Attributes,
  28932. p1Indices,
  28933. p1IndexMap,
  28934. indices2,
  28935. -1,
  28936. offsetPoint
  28937. );
  28938. computeLineAttributes(
  28939. i0,
  28940. i1,
  28941. offsetPoint,
  28942. positions,
  28943. insertIndex,
  28944. p1Attributes,
  28945. applyOffset
  28946. );
  28947. insertIndex = insertSplitPoint(
  28948. p1Attributes,
  28949. p1Indices,
  28950. p1IndexMap,
  28951. indices2,
  28952. i2 + 1,
  28953. p1
  28954. );
  28955. computeLineAttributes(
  28956. i0,
  28957. i1,
  28958. p1,
  28959. positions,
  28960. insertIndex,
  28961. p1Attributes,
  28962. applyOffset
  28963. );
  28964. } else {
  28965. let currentAttributes;
  28966. let currentIndices;
  28967. let currentIndexMap;
  28968. if (p0.y < 0) {
  28969. currentAttributes = westGeometry.attributes;
  28970. currentIndices = westGeometry.indices;
  28971. currentIndexMap = westGeometryIndexMap;
  28972. } else {
  28973. currentAttributes = eastGeometry.attributes;
  28974. currentIndices = eastGeometry.indices;
  28975. currentIndexMap = eastGeometryIndexMap;
  28976. }
  28977. insertIndex = insertSplitPoint(
  28978. currentAttributes,
  28979. currentIndices,
  28980. currentIndexMap,
  28981. indices2,
  28982. i2,
  28983. p0
  28984. );
  28985. computeLineAttributes(
  28986. i0,
  28987. i1,
  28988. p0,
  28989. positions,
  28990. insertIndex,
  28991. currentAttributes,
  28992. applyOffset
  28993. );
  28994. insertIndex = insertSplitPoint(
  28995. currentAttributes,
  28996. currentIndices,
  28997. currentIndexMap,
  28998. indices2,
  28999. i2 + 1,
  29000. p1
  29001. );
  29002. computeLineAttributes(
  29003. i0,
  29004. i1,
  29005. p1,
  29006. positions,
  29007. insertIndex,
  29008. currentAttributes,
  29009. applyOffset
  29010. );
  29011. }
  29012. }
  29013. updateInstanceAfterSplit(instance, westGeometry, eastGeometry);
  29014. }
  29015. var cartesian2Scratch0 = new Cartesian2_default();
  29016. var cartesian2Scratch1 = new Cartesian2_default();
  29017. var cartesian3Scratch0 = new Cartesian3_default();
  29018. var cartesian3Scratch22 = new Cartesian3_default();
  29019. var cartesian3Scratch3 = new Cartesian3_default();
  29020. var cartesian3Scratch4 = new Cartesian3_default();
  29021. var cartesian3Scratch5 = new Cartesian3_default();
  29022. var cartesian3Scratch6 = new Cartesian3_default();
  29023. var cartesian4Scratch0 = new Cartesian4_default();
  29024. function updateAdjacencyAfterSplit(geometry) {
  29025. const attributes = geometry.attributes;
  29026. const positions = attributes.position.values;
  29027. const prevPositions = attributes.prevPosition.values;
  29028. const nextPositions = attributes.nextPosition.values;
  29029. const length3 = positions.length;
  29030. for (let j = 0; j < length3; j += 3) {
  29031. const position = Cartesian3_default.unpack(positions, j, cartesian3Scratch0);
  29032. if (position.x > 0) {
  29033. continue;
  29034. }
  29035. const prevPosition = Cartesian3_default.unpack(
  29036. prevPositions,
  29037. j,
  29038. cartesian3Scratch22
  29039. );
  29040. if (position.y < 0 && prevPosition.y > 0 || position.y > 0 && prevPosition.y < 0) {
  29041. if (j - 3 > 0) {
  29042. prevPositions[j] = positions[j - 3];
  29043. prevPositions[j + 1] = positions[j - 2];
  29044. prevPositions[j + 2] = positions[j - 1];
  29045. } else {
  29046. Cartesian3_default.pack(position, prevPositions, j);
  29047. }
  29048. }
  29049. const nextPosition = Cartesian3_default.unpack(
  29050. nextPositions,
  29051. j,
  29052. cartesian3Scratch3
  29053. );
  29054. if (position.y < 0 && nextPosition.y > 0 || position.y > 0 && nextPosition.y < 0) {
  29055. if (j + 3 < length3) {
  29056. nextPositions[j] = positions[j + 3];
  29057. nextPositions[j + 1] = positions[j + 4];
  29058. nextPositions[j + 2] = positions[j + 5];
  29059. } else {
  29060. Cartesian3_default.pack(position, nextPositions, j);
  29061. }
  29062. }
  29063. }
  29064. }
  29065. var offsetScalar = 5 * Math_default.EPSILON9;
  29066. var coplanarOffset = Math_default.EPSILON6;
  29067. function splitLongitudePolyline(instance) {
  29068. const geometry = instance.geometry;
  29069. const attributes = geometry.attributes;
  29070. const positions = attributes.position.values;
  29071. const prevPositions = attributes.prevPosition.values;
  29072. const nextPositions = attributes.nextPosition.values;
  29073. const expandAndWidths = attributes.expandAndWidth.values;
  29074. const texCoords = defined_default(attributes.st) ? attributes.st.values : void 0;
  29075. const colors = defined_default(attributes.color) ? attributes.color.values : void 0;
  29076. const eastGeometry = copyGeometryForSplit(geometry);
  29077. const westGeometry = copyGeometryForSplit(geometry);
  29078. let i2;
  29079. let j;
  29080. let index2;
  29081. let intersectionFound = false;
  29082. const length3 = positions.length / 3;
  29083. for (i2 = 0; i2 < length3; i2 += 4) {
  29084. const i0 = i2;
  29085. const i22 = i2 + 2;
  29086. const p0 = Cartesian3_default.fromArray(positions, i0 * 3, cartesian3Scratch0);
  29087. const p2 = Cartesian3_default.fromArray(positions, i22 * 3, cartesian3Scratch22);
  29088. if (Math.abs(p0.y) < coplanarOffset) {
  29089. p0.y = coplanarOffset * (p2.y < 0 ? -1 : 1);
  29090. positions[i2 * 3 + 1] = p0.y;
  29091. positions[(i2 + 1) * 3 + 1] = p0.y;
  29092. for (j = i0 * 3; j < i0 * 3 + 4 * 3; j += 3) {
  29093. prevPositions[j] = positions[i2 * 3];
  29094. prevPositions[j + 1] = positions[i2 * 3 + 1];
  29095. prevPositions[j + 2] = positions[i2 * 3 + 2];
  29096. }
  29097. }
  29098. if (Math.abs(p2.y) < coplanarOffset) {
  29099. p2.y = coplanarOffset * (p0.y < 0 ? -1 : 1);
  29100. positions[(i2 + 2) * 3 + 1] = p2.y;
  29101. positions[(i2 + 3) * 3 + 1] = p2.y;
  29102. for (j = i0 * 3; j < i0 * 3 + 4 * 3; j += 3) {
  29103. nextPositions[j] = positions[(i2 + 2) * 3];
  29104. nextPositions[j + 1] = positions[(i2 + 2) * 3 + 1];
  29105. nextPositions[j + 2] = positions[(i2 + 2) * 3 + 2];
  29106. }
  29107. }
  29108. let p0Attributes = eastGeometry.attributes;
  29109. let p0Indices = eastGeometry.indices;
  29110. let p2Attributes = westGeometry.attributes;
  29111. let p2Indices = westGeometry.indices;
  29112. const intersection = IntersectionTests_default.lineSegmentPlane(
  29113. p0,
  29114. p2,
  29115. xzPlane,
  29116. cartesian3Scratch4
  29117. );
  29118. if (defined_default(intersection)) {
  29119. intersectionFound = true;
  29120. const offset2 = Cartesian3_default.multiplyByScalar(
  29121. Cartesian3_default.UNIT_Y,
  29122. offsetScalar,
  29123. cartesian3Scratch5
  29124. );
  29125. if (p0.y < 0) {
  29126. Cartesian3_default.negate(offset2, offset2);
  29127. p0Attributes = westGeometry.attributes;
  29128. p0Indices = westGeometry.indices;
  29129. p2Attributes = eastGeometry.attributes;
  29130. p2Indices = eastGeometry.indices;
  29131. }
  29132. const offsetPoint = Cartesian3_default.add(
  29133. intersection,
  29134. offset2,
  29135. cartesian3Scratch6
  29136. );
  29137. p0Attributes.position.values.push(p0.x, p0.y, p0.z, p0.x, p0.y, p0.z);
  29138. p0Attributes.position.values.push(
  29139. offsetPoint.x,
  29140. offsetPoint.y,
  29141. offsetPoint.z
  29142. );
  29143. p0Attributes.position.values.push(
  29144. offsetPoint.x,
  29145. offsetPoint.y,
  29146. offsetPoint.z
  29147. );
  29148. p0Attributes.prevPosition.values.push(
  29149. prevPositions[i0 * 3],
  29150. prevPositions[i0 * 3 + 1],
  29151. prevPositions[i0 * 3 + 2]
  29152. );
  29153. p0Attributes.prevPosition.values.push(
  29154. prevPositions[i0 * 3 + 3],
  29155. prevPositions[i0 * 3 + 4],
  29156. prevPositions[i0 * 3 + 5]
  29157. );
  29158. p0Attributes.prevPosition.values.push(p0.x, p0.y, p0.z, p0.x, p0.y, p0.z);
  29159. p0Attributes.nextPosition.values.push(
  29160. offsetPoint.x,
  29161. offsetPoint.y,
  29162. offsetPoint.z
  29163. );
  29164. p0Attributes.nextPosition.values.push(
  29165. offsetPoint.x,
  29166. offsetPoint.y,
  29167. offsetPoint.z
  29168. );
  29169. p0Attributes.nextPosition.values.push(
  29170. offsetPoint.x,
  29171. offsetPoint.y,
  29172. offsetPoint.z
  29173. );
  29174. p0Attributes.nextPosition.values.push(
  29175. offsetPoint.x,
  29176. offsetPoint.y,
  29177. offsetPoint.z
  29178. );
  29179. Cartesian3_default.negate(offset2, offset2);
  29180. Cartesian3_default.add(intersection, offset2, offsetPoint);
  29181. p2Attributes.position.values.push(
  29182. offsetPoint.x,
  29183. offsetPoint.y,
  29184. offsetPoint.z
  29185. );
  29186. p2Attributes.position.values.push(
  29187. offsetPoint.x,
  29188. offsetPoint.y,
  29189. offsetPoint.z
  29190. );
  29191. p2Attributes.position.values.push(p2.x, p2.y, p2.z, p2.x, p2.y, p2.z);
  29192. p2Attributes.prevPosition.values.push(
  29193. offsetPoint.x,
  29194. offsetPoint.y,
  29195. offsetPoint.z
  29196. );
  29197. p2Attributes.prevPosition.values.push(
  29198. offsetPoint.x,
  29199. offsetPoint.y,
  29200. offsetPoint.z
  29201. );
  29202. p2Attributes.prevPosition.values.push(
  29203. offsetPoint.x,
  29204. offsetPoint.y,
  29205. offsetPoint.z
  29206. );
  29207. p2Attributes.prevPosition.values.push(
  29208. offsetPoint.x,
  29209. offsetPoint.y,
  29210. offsetPoint.z
  29211. );
  29212. p2Attributes.nextPosition.values.push(p2.x, p2.y, p2.z, p2.x, p2.y, p2.z);
  29213. p2Attributes.nextPosition.values.push(
  29214. nextPositions[i22 * 3],
  29215. nextPositions[i22 * 3 + 1],
  29216. nextPositions[i22 * 3 + 2]
  29217. );
  29218. p2Attributes.nextPosition.values.push(
  29219. nextPositions[i22 * 3 + 3],
  29220. nextPositions[i22 * 3 + 4],
  29221. nextPositions[i22 * 3 + 5]
  29222. );
  29223. const ew0 = Cartesian2_default.fromArray(
  29224. expandAndWidths,
  29225. i0 * 2,
  29226. cartesian2Scratch0
  29227. );
  29228. const width = Math.abs(ew0.y);
  29229. p0Attributes.expandAndWidth.values.push(-1, width, 1, width);
  29230. p0Attributes.expandAndWidth.values.push(-1, -width, 1, -width);
  29231. p2Attributes.expandAndWidth.values.push(-1, width, 1, width);
  29232. p2Attributes.expandAndWidth.values.push(-1, -width, 1, -width);
  29233. let t = Cartesian3_default.magnitudeSquared(
  29234. Cartesian3_default.subtract(intersection, p0, cartesian3Scratch3)
  29235. );
  29236. t /= Cartesian3_default.magnitudeSquared(
  29237. Cartesian3_default.subtract(p2, p0, cartesian3Scratch3)
  29238. );
  29239. if (defined_default(colors)) {
  29240. const c0 = Cartesian4_default.fromArray(colors, i0 * 4, cartesian4Scratch0);
  29241. const c22 = Cartesian4_default.fromArray(colors, i22 * 4, cartesian4Scratch0);
  29242. const r2 = Math_default.lerp(c0.x, c22.x, t);
  29243. const g = Math_default.lerp(c0.y, c22.y, t);
  29244. const b = Math_default.lerp(c0.z, c22.z, t);
  29245. const a4 = Math_default.lerp(c0.w, c22.w, t);
  29246. for (j = i0 * 4; j < i0 * 4 + 2 * 4; ++j) {
  29247. p0Attributes.color.values.push(colors[j]);
  29248. }
  29249. p0Attributes.color.values.push(r2, g, b, a4);
  29250. p0Attributes.color.values.push(r2, g, b, a4);
  29251. p2Attributes.color.values.push(r2, g, b, a4);
  29252. p2Attributes.color.values.push(r2, g, b, a4);
  29253. for (j = i22 * 4; j < i22 * 4 + 2 * 4; ++j) {
  29254. p2Attributes.color.values.push(colors[j]);
  29255. }
  29256. }
  29257. if (defined_default(texCoords)) {
  29258. const s0 = Cartesian2_default.fromArray(texCoords, i0 * 2, cartesian2Scratch0);
  29259. const s3 = Cartesian2_default.fromArray(
  29260. texCoords,
  29261. (i2 + 3) * 2,
  29262. cartesian2Scratch1
  29263. );
  29264. const sx = Math_default.lerp(s0.x, s3.x, t);
  29265. for (j = i0 * 2; j < i0 * 2 + 2 * 2; ++j) {
  29266. p0Attributes.st.values.push(texCoords[j]);
  29267. }
  29268. p0Attributes.st.values.push(sx, s0.y);
  29269. p0Attributes.st.values.push(sx, s3.y);
  29270. p2Attributes.st.values.push(sx, s0.y);
  29271. p2Attributes.st.values.push(sx, s3.y);
  29272. for (j = i22 * 2; j < i22 * 2 + 2 * 2; ++j) {
  29273. p2Attributes.st.values.push(texCoords[j]);
  29274. }
  29275. }
  29276. index2 = p0Attributes.position.values.length / 3 - 4;
  29277. p0Indices.push(index2, index2 + 2, index2 + 1);
  29278. p0Indices.push(index2 + 1, index2 + 2, index2 + 3);
  29279. index2 = p2Attributes.position.values.length / 3 - 4;
  29280. p2Indices.push(index2, index2 + 2, index2 + 1);
  29281. p2Indices.push(index2 + 1, index2 + 2, index2 + 3);
  29282. } else {
  29283. let currentAttributes;
  29284. let currentIndices;
  29285. if (p0.y < 0) {
  29286. currentAttributes = westGeometry.attributes;
  29287. currentIndices = westGeometry.indices;
  29288. } else {
  29289. currentAttributes = eastGeometry.attributes;
  29290. currentIndices = eastGeometry.indices;
  29291. }
  29292. currentAttributes.position.values.push(p0.x, p0.y, p0.z);
  29293. currentAttributes.position.values.push(p0.x, p0.y, p0.z);
  29294. currentAttributes.position.values.push(p2.x, p2.y, p2.z);
  29295. currentAttributes.position.values.push(p2.x, p2.y, p2.z);
  29296. for (j = i2 * 3; j < i2 * 3 + 4 * 3; ++j) {
  29297. currentAttributes.prevPosition.values.push(prevPositions[j]);
  29298. currentAttributes.nextPosition.values.push(nextPositions[j]);
  29299. }
  29300. for (j = i2 * 2; j < i2 * 2 + 4 * 2; ++j) {
  29301. currentAttributes.expandAndWidth.values.push(expandAndWidths[j]);
  29302. if (defined_default(texCoords)) {
  29303. currentAttributes.st.values.push(texCoords[j]);
  29304. }
  29305. }
  29306. if (defined_default(colors)) {
  29307. for (j = i2 * 4; j < i2 * 4 + 4 * 4; ++j) {
  29308. currentAttributes.color.values.push(colors[j]);
  29309. }
  29310. }
  29311. index2 = currentAttributes.position.values.length / 3 - 4;
  29312. currentIndices.push(index2, index2 + 2, index2 + 1);
  29313. currentIndices.push(index2 + 1, index2 + 2, index2 + 3);
  29314. }
  29315. }
  29316. if (intersectionFound) {
  29317. updateAdjacencyAfterSplit(westGeometry);
  29318. updateAdjacencyAfterSplit(eastGeometry);
  29319. }
  29320. updateInstanceAfterSplit(instance, westGeometry, eastGeometry);
  29321. }
  29322. GeometryPipeline.splitLongitude = function(instance) {
  29323. if (!defined_default(instance)) {
  29324. throw new DeveloperError_default("instance is required.");
  29325. }
  29326. const geometry = instance.geometry;
  29327. const boundingSphere = geometry.boundingSphere;
  29328. if (defined_default(boundingSphere)) {
  29329. const minX = boundingSphere.center.x - boundingSphere.radius;
  29330. if (minX > 0 || BoundingSphere_default.intersectPlane(boundingSphere, Plane_default.ORIGIN_ZX_PLANE) !== Intersect_default.INTERSECTING) {
  29331. return instance;
  29332. }
  29333. }
  29334. if (geometry.geometryType !== GeometryType_default.NONE) {
  29335. switch (geometry.geometryType) {
  29336. case GeometryType_default.POLYLINES:
  29337. splitLongitudePolyline(instance);
  29338. break;
  29339. case GeometryType_default.TRIANGLES:
  29340. splitLongitudeTriangles(instance);
  29341. break;
  29342. case GeometryType_default.LINES:
  29343. splitLongitudeLines(instance);
  29344. break;
  29345. }
  29346. } else {
  29347. indexPrimitive(geometry);
  29348. if (geometry.primitiveType === PrimitiveType_default.TRIANGLES) {
  29349. splitLongitudeTriangles(instance);
  29350. } else if (geometry.primitiveType === PrimitiveType_default.LINES) {
  29351. splitLongitudeLines(instance);
  29352. }
  29353. }
  29354. return instance;
  29355. };
  29356. var GeometryPipeline_default = GeometryPipeline;
  29357. // node_modules/cesium/Source/Core/EllipseGeometry.js
  29358. var scratchCartesian14 = new Cartesian3_default();
  29359. var scratchCartesian26 = new Cartesian3_default();
  29360. var scratchCartesian36 = new Cartesian3_default();
  29361. var scratchCartesian42 = new Cartesian3_default();
  29362. var texCoordScratch = new Cartesian2_default();
  29363. var textureMatrixScratch = new Matrix3_default();
  29364. var tangentMatrixScratch = new Matrix3_default();
  29365. var quaternionScratch = new Quaternion_default();
  29366. var scratchNormal3 = new Cartesian3_default();
  29367. var scratchTangent = new Cartesian3_default();
  29368. var scratchBitangent = new Cartesian3_default();
  29369. var scratchCartographic3 = new Cartographic_default();
  29370. var projectedCenterScratch = new Cartesian3_default();
  29371. var scratchMinTexCoord = new Cartesian2_default();
  29372. var scratchMaxTexCoord = new Cartesian2_default();
  29373. function computeTopBottomAttributes(positions, options, extrude) {
  29374. const vertexFormat = options.vertexFormat;
  29375. const center = options.center;
  29376. const semiMajorAxis = options.semiMajorAxis;
  29377. const semiMinorAxis = options.semiMinorAxis;
  29378. const ellipsoid = options.ellipsoid;
  29379. const stRotation = options.stRotation;
  29380. const size = extrude ? positions.length / 3 * 2 : positions.length / 3;
  29381. const shadowVolume = options.shadowVolume;
  29382. const textureCoordinates = vertexFormat.st ? new Float32Array(size * 2) : void 0;
  29383. const normals = vertexFormat.normal ? new Float32Array(size * 3) : void 0;
  29384. const tangents = vertexFormat.tangent ? new Float32Array(size * 3) : void 0;
  29385. const bitangents = vertexFormat.bitangent ? new Float32Array(size * 3) : void 0;
  29386. const extrudeNormals = shadowVolume ? new Float32Array(size * 3) : void 0;
  29387. let textureCoordIndex = 0;
  29388. let normal2 = scratchNormal3;
  29389. let tangent = scratchTangent;
  29390. let bitangent = scratchBitangent;
  29391. const projection = new GeographicProjection_default(ellipsoid);
  29392. const projectedCenter = projection.project(
  29393. ellipsoid.cartesianToCartographic(center, scratchCartographic3),
  29394. projectedCenterScratch
  29395. );
  29396. const geodeticNormal = ellipsoid.scaleToGeodeticSurface(
  29397. center,
  29398. scratchCartesian14
  29399. );
  29400. ellipsoid.geodeticSurfaceNormal(geodeticNormal, geodeticNormal);
  29401. let textureMatrix = textureMatrixScratch;
  29402. let tangentMatrix = tangentMatrixScratch;
  29403. if (stRotation !== 0) {
  29404. let rotation = Quaternion_default.fromAxisAngle(
  29405. geodeticNormal,
  29406. stRotation,
  29407. quaternionScratch
  29408. );
  29409. textureMatrix = Matrix3_default.fromQuaternion(rotation, textureMatrix);
  29410. rotation = Quaternion_default.fromAxisAngle(
  29411. geodeticNormal,
  29412. -stRotation,
  29413. quaternionScratch
  29414. );
  29415. tangentMatrix = Matrix3_default.fromQuaternion(rotation, tangentMatrix);
  29416. } else {
  29417. textureMatrix = Matrix3_default.clone(Matrix3_default.IDENTITY, textureMatrix);
  29418. tangentMatrix = Matrix3_default.clone(Matrix3_default.IDENTITY, tangentMatrix);
  29419. }
  29420. const minTexCoord = Cartesian2_default.fromElements(
  29421. Number.POSITIVE_INFINITY,
  29422. Number.POSITIVE_INFINITY,
  29423. scratchMinTexCoord
  29424. );
  29425. const maxTexCoord = Cartesian2_default.fromElements(
  29426. Number.NEGATIVE_INFINITY,
  29427. Number.NEGATIVE_INFINITY,
  29428. scratchMaxTexCoord
  29429. );
  29430. let length3 = positions.length;
  29431. const bottomOffset = extrude ? length3 : 0;
  29432. const stOffset = bottomOffset / 3 * 2;
  29433. for (let i2 = 0; i2 < length3; i2 += 3) {
  29434. const i1 = i2 + 1;
  29435. const i22 = i2 + 2;
  29436. const position = Cartesian3_default.fromArray(positions, i2, scratchCartesian14);
  29437. if (vertexFormat.st) {
  29438. const rotatedPoint = Matrix3_default.multiplyByVector(
  29439. textureMatrix,
  29440. position,
  29441. scratchCartesian26
  29442. );
  29443. const projectedPoint = projection.project(
  29444. ellipsoid.cartesianToCartographic(rotatedPoint, scratchCartographic3),
  29445. scratchCartesian36
  29446. );
  29447. Cartesian3_default.subtract(projectedPoint, projectedCenter, projectedPoint);
  29448. texCoordScratch.x = (projectedPoint.x + semiMajorAxis) / (2 * semiMajorAxis);
  29449. texCoordScratch.y = (projectedPoint.y + semiMinorAxis) / (2 * semiMinorAxis);
  29450. minTexCoord.x = Math.min(texCoordScratch.x, minTexCoord.x);
  29451. minTexCoord.y = Math.min(texCoordScratch.y, minTexCoord.y);
  29452. maxTexCoord.x = Math.max(texCoordScratch.x, maxTexCoord.x);
  29453. maxTexCoord.y = Math.max(texCoordScratch.y, maxTexCoord.y);
  29454. if (extrude) {
  29455. textureCoordinates[textureCoordIndex + stOffset] = texCoordScratch.x;
  29456. textureCoordinates[textureCoordIndex + 1 + stOffset] = texCoordScratch.y;
  29457. }
  29458. textureCoordinates[textureCoordIndex++] = texCoordScratch.x;
  29459. textureCoordinates[textureCoordIndex++] = texCoordScratch.y;
  29460. }
  29461. if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent || shadowVolume) {
  29462. normal2 = ellipsoid.geodeticSurfaceNormal(position, normal2);
  29463. if (shadowVolume) {
  29464. extrudeNormals[i2 + bottomOffset] = -normal2.x;
  29465. extrudeNormals[i1 + bottomOffset] = -normal2.y;
  29466. extrudeNormals[i22 + bottomOffset] = -normal2.z;
  29467. }
  29468. if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent) {
  29469. if (vertexFormat.tangent || vertexFormat.bitangent) {
  29470. tangent = Cartesian3_default.normalize(
  29471. Cartesian3_default.cross(Cartesian3_default.UNIT_Z, normal2, tangent),
  29472. tangent
  29473. );
  29474. Matrix3_default.multiplyByVector(tangentMatrix, tangent, tangent);
  29475. }
  29476. if (vertexFormat.normal) {
  29477. normals[i2] = normal2.x;
  29478. normals[i1] = normal2.y;
  29479. normals[i22] = normal2.z;
  29480. if (extrude) {
  29481. normals[i2 + bottomOffset] = -normal2.x;
  29482. normals[i1 + bottomOffset] = -normal2.y;
  29483. normals[i22 + bottomOffset] = -normal2.z;
  29484. }
  29485. }
  29486. if (vertexFormat.tangent) {
  29487. tangents[i2] = tangent.x;
  29488. tangents[i1] = tangent.y;
  29489. tangents[i22] = tangent.z;
  29490. if (extrude) {
  29491. tangents[i2 + bottomOffset] = -tangent.x;
  29492. tangents[i1 + bottomOffset] = -tangent.y;
  29493. tangents[i22 + bottomOffset] = -tangent.z;
  29494. }
  29495. }
  29496. if (vertexFormat.bitangent) {
  29497. bitangent = Cartesian3_default.normalize(
  29498. Cartesian3_default.cross(normal2, tangent, bitangent),
  29499. bitangent
  29500. );
  29501. bitangents[i2] = bitangent.x;
  29502. bitangents[i1] = bitangent.y;
  29503. bitangents[i22] = bitangent.z;
  29504. if (extrude) {
  29505. bitangents[i2 + bottomOffset] = bitangent.x;
  29506. bitangents[i1 + bottomOffset] = bitangent.y;
  29507. bitangents[i22 + bottomOffset] = bitangent.z;
  29508. }
  29509. }
  29510. }
  29511. }
  29512. }
  29513. if (vertexFormat.st) {
  29514. length3 = textureCoordinates.length;
  29515. for (let k = 0; k < length3; k += 2) {
  29516. textureCoordinates[k] = (textureCoordinates[k] - minTexCoord.x) / (maxTexCoord.x - minTexCoord.x);
  29517. textureCoordinates[k + 1] = (textureCoordinates[k + 1] - minTexCoord.y) / (maxTexCoord.y - minTexCoord.y);
  29518. }
  29519. }
  29520. const attributes = new GeometryAttributes_default();
  29521. if (vertexFormat.position) {
  29522. const finalPositions = EllipseGeometryLibrary_default.raisePositionsToHeight(
  29523. positions,
  29524. options,
  29525. extrude
  29526. );
  29527. attributes.position = new GeometryAttribute_default({
  29528. componentDatatype: ComponentDatatype_default.DOUBLE,
  29529. componentsPerAttribute: 3,
  29530. values: finalPositions
  29531. });
  29532. }
  29533. if (vertexFormat.st) {
  29534. attributes.st = new GeometryAttribute_default({
  29535. componentDatatype: ComponentDatatype_default.FLOAT,
  29536. componentsPerAttribute: 2,
  29537. values: textureCoordinates
  29538. });
  29539. }
  29540. if (vertexFormat.normal) {
  29541. attributes.normal = new GeometryAttribute_default({
  29542. componentDatatype: ComponentDatatype_default.FLOAT,
  29543. componentsPerAttribute: 3,
  29544. values: normals
  29545. });
  29546. }
  29547. if (vertexFormat.tangent) {
  29548. attributes.tangent = new GeometryAttribute_default({
  29549. componentDatatype: ComponentDatatype_default.FLOAT,
  29550. componentsPerAttribute: 3,
  29551. values: tangents
  29552. });
  29553. }
  29554. if (vertexFormat.bitangent) {
  29555. attributes.bitangent = new GeometryAttribute_default({
  29556. componentDatatype: ComponentDatatype_default.FLOAT,
  29557. componentsPerAttribute: 3,
  29558. values: bitangents
  29559. });
  29560. }
  29561. if (shadowVolume) {
  29562. attributes.extrudeDirection = new GeometryAttribute_default({
  29563. componentDatatype: ComponentDatatype_default.FLOAT,
  29564. componentsPerAttribute: 3,
  29565. values: extrudeNormals
  29566. });
  29567. }
  29568. if (extrude && defined_default(options.offsetAttribute)) {
  29569. let offsetAttribute = new Uint8Array(size);
  29570. if (options.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
  29571. offsetAttribute = arrayFill_default(offsetAttribute, 1, 0, size / 2);
  29572. } else {
  29573. const offsetValue = options.offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  29574. offsetAttribute = arrayFill_default(offsetAttribute, offsetValue);
  29575. }
  29576. attributes.applyOffset = new GeometryAttribute_default({
  29577. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  29578. componentsPerAttribute: 1,
  29579. values: offsetAttribute
  29580. });
  29581. }
  29582. return attributes;
  29583. }
  29584. function topIndices(numPts) {
  29585. const indices2 = new Array(12 * (numPts * (numPts + 1)) - 6);
  29586. let indicesIndex = 0;
  29587. let prevIndex;
  29588. let numInterior;
  29589. let positionIndex;
  29590. let i2;
  29591. let j;
  29592. prevIndex = 0;
  29593. positionIndex = 1;
  29594. for (i2 = 0; i2 < 3; i2++) {
  29595. indices2[indicesIndex++] = positionIndex++;
  29596. indices2[indicesIndex++] = prevIndex;
  29597. indices2[indicesIndex++] = positionIndex;
  29598. }
  29599. for (i2 = 2; i2 < numPts + 1; ++i2) {
  29600. positionIndex = i2 * (i2 + 1) - 1;
  29601. prevIndex = (i2 - 1) * i2 - 1;
  29602. indices2[indicesIndex++] = positionIndex++;
  29603. indices2[indicesIndex++] = prevIndex;
  29604. indices2[indicesIndex++] = positionIndex;
  29605. numInterior = 2 * i2;
  29606. for (j = 0; j < numInterior - 1; ++j) {
  29607. indices2[indicesIndex++] = positionIndex;
  29608. indices2[indicesIndex++] = prevIndex++;
  29609. indices2[indicesIndex++] = prevIndex;
  29610. indices2[indicesIndex++] = positionIndex++;
  29611. indices2[indicesIndex++] = prevIndex;
  29612. indices2[indicesIndex++] = positionIndex;
  29613. }
  29614. indices2[indicesIndex++] = positionIndex++;
  29615. indices2[indicesIndex++] = prevIndex;
  29616. indices2[indicesIndex++] = positionIndex;
  29617. }
  29618. numInterior = numPts * 2;
  29619. ++positionIndex;
  29620. ++prevIndex;
  29621. for (i2 = 0; i2 < numInterior - 1; ++i2) {
  29622. indices2[indicesIndex++] = positionIndex;
  29623. indices2[indicesIndex++] = prevIndex++;
  29624. indices2[indicesIndex++] = prevIndex;
  29625. indices2[indicesIndex++] = positionIndex++;
  29626. indices2[indicesIndex++] = prevIndex;
  29627. indices2[indicesIndex++] = positionIndex;
  29628. }
  29629. indices2[indicesIndex++] = positionIndex;
  29630. indices2[indicesIndex++] = prevIndex++;
  29631. indices2[indicesIndex++] = prevIndex;
  29632. indices2[indicesIndex++] = positionIndex++;
  29633. indices2[indicesIndex++] = prevIndex++;
  29634. indices2[indicesIndex++] = prevIndex;
  29635. ++prevIndex;
  29636. for (i2 = numPts - 1; i2 > 1; --i2) {
  29637. indices2[indicesIndex++] = prevIndex++;
  29638. indices2[indicesIndex++] = prevIndex;
  29639. indices2[indicesIndex++] = positionIndex;
  29640. numInterior = 2 * i2;
  29641. for (j = 0; j < numInterior - 1; ++j) {
  29642. indices2[indicesIndex++] = positionIndex;
  29643. indices2[indicesIndex++] = prevIndex++;
  29644. indices2[indicesIndex++] = prevIndex;
  29645. indices2[indicesIndex++] = positionIndex++;
  29646. indices2[indicesIndex++] = prevIndex;
  29647. indices2[indicesIndex++] = positionIndex;
  29648. }
  29649. indices2[indicesIndex++] = prevIndex++;
  29650. indices2[indicesIndex++] = prevIndex++;
  29651. indices2[indicesIndex++] = positionIndex++;
  29652. }
  29653. for (i2 = 0; i2 < 3; i2++) {
  29654. indices2[indicesIndex++] = prevIndex++;
  29655. indices2[indicesIndex++] = prevIndex;
  29656. indices2[indicesIndex++] = positionIndex;
  29657. }
  29658. return indices2;
  29659. }
  29660. var boundingSphereCenter = new Cartesian3_default();
  29661. function computeEllipse(options) {
  29662. const center = options.center;
  29663. boundingSphereCenter = Cartesian3_default.multiplyByScalar(
  29664. options.ellipsoid.geodeticSurfaceNormal(center, boundingSphereCenter),
  29665. options.height,
  29666. boundingSphereCenter
  29667. );
  29668. boundingSphereCenter = Cartesian3_default.add(
  29669. center,
  29670. boundingSphereCenter,
  29671. boundingSphereCenter
  29672. );
  29673. const boundingSphere = new BoundingSphere_default(
  29674. boundingSphereCenter,
  29675. options.semiMajorAxis
  29676. );
  29677. const cep = EllipseGeometryLibrary_default.computeEllipsePositions(
  29678. options,
  29679. true,
  29680. false
  29681. );
  29682. const positions = cep.positions;
  29683. const numPts = cep.numPts;
  29684. const attributes = computeTopBottomAttributes(positions, options, false);
  29685. let indices2 = topIndices(numPts);
  29686. indices2 = IndexDatatype_default.createTypedArray(positions.length / 3, indices2);
  29687. return {
  29688. boundingSphere,
  29689. attributes,
  29690. indices: indices2
  29691. };
  29692. }
  29693. function computeWallAttributes(positions, options) {
  29694. const vertexFormat = options.vertexFormat;
  29695. const center = options.center;
  29696. const semiMajorAxis = options.semiMajorAxis;
  29697. const semiMinorAxis = options.semiMinorAxis;
  29698. const ellipsoid = options.ellipsoid;
  29699. const height = options.height;
  29700. const extrudedHeight = options.extrudedHeight;
  29701. const stRotation = options.stRotation;
  29702. const size = positions.length / 3 * 2;
  29703. const finalPositions = new Float64Array(size * 3);
  29704. const textureCoordinates = vertexFormat.st ? new Float32Array(size * 2) : void 0;
  29705. const normals = vertexFormat.normal ? new Float32Array(size * 3) : void 0;
  29706. const tangents = vertexFormat.tangent ? new Float32Array(size * 3) : void 0;
  29707. const bitangents = vertexFormat.bitangent ? new Float32Array(size * 3) : void 0;
  29708. const shadowVolume = options.shadowVolume;
  29709. const extrudeNormals = shadowVolume ? new Float32Array(size * 3) : void 0;
  29710. let textureCoordIndex = 0;
  29711. let normal2 = scratchNormal3;
  29712. let tangent = scratchTangent;
  29713. let bitangent = scratchBitangent;
  29714. const projection = new GeographicProjection_default(ellipsoid);
  29715. const projectedCenter = projection.project(
  29716. ellipsoid.cartesianToCartographic(center, scratchCartographic3),
  29717. projectedCenterScratch
  29718. );
  29719. const geodeticNormal = ellipsoid.scaleToGeodeticSurface(
  29720. center,
  29721. scratchCartesian14
  29722. );
  29723. ellipsoid.geodeticSurfaceNormal(geodeticNormal, geodeticNormal);
  29724. const rotation = Quaternion_default.fromAxisAngle(
  29725. geodeticNormal,
  29726. stRotation,
  29727. quaternionScratch
  29728. );
  29729. const textureMatrix = Matrix3_default.fromQuaternion(rotation, textureMatrixScratch);
  29730. const minTexCoord = Cartesian2_default.fromElements(
  29731. Number.POSITIVE_INFINITY,
  29732. Number.POSITIVE_INFINITY,
  29733. scratchMinTexCoord
  29734. );
  29735. const maxTexCoord = Cartesian2_default.fromElements(
  29736. Number.NEGATIVE_INFINITY,
  29737. Number.NEGATIVE_INFINITY,
  29738. scratchMaxTexCoord
  29739. );
  29740. let length3 = positions.length;
  29741. const stOffset = length3 / 3 * 2;
  29742. for (let i2 = 0; i2 < length3; i2 += 3) {
  29743. const i1 = i2 + 1;
  29744. const i22 = i2 + 2;
  29745. let position = Cartesian3_default.fromArray(positions, i2, scratchCartesian14);
  29746. let extrudedPosition;
  29747. if (vertexFormat.st) {
  29748. const rotatedPoint = Matrix3_default.multiplyByVector(
  29749. textureMatrix,
  29750. position,
  29751. scratchCartesian26
  29752. );
  29753. const projectedPoint = projection.project(
  29754. ellipsoid.cartesianToCartographic(rotatedPoint, scratchCartographic3),
  29755. scratchCartesian36
  29756. );
  29757. Cartesian3_default.subtract(projectedPoint, projectedCenter, projectedPoint);
  29758. texCoordScratch.x = (projectedPoint.x + semiMajorAxis) / (2 * semiMajorAxis);
  29759. texCoordScratch.y = (projectedPoint.y + semiMinorAxis) / (2 * semiMinorAxis);
  29760. minTexCoord.x = Math.min(texCoordScratch.x, minTexCoord.x);
  29761. minTexCoord.y = Math.min(texCoordScratch.y, minTexCoord.y);
  29762. maxTexCoord.x = Math.max(texCoordScratch.x, maxTexCoord.x);
  29763. maxTexCoord.y = Math.max(texCoordScratch.y, maxTexCoord.y);
  29764. textureCoordinates[textureCoordIndex + stOffset] = texCoordScratch.x;
  29765. textureCoordinates[textureCoordIndex + 1 + stOffset] = texCoordScratch.y;
  29766. textureCoordinates[textureCoordIndex++] = texCoordScratch.x;
  29767. textureCoordinates[textureCoordIndex++] = texCoordScratch.y;
  29768. }
  29769. position = ellipsoid.scaleToGeodeticSurface(position, position);
  29770. extrudedPosition = Cartesian3_default.clone(position, scratchCartesian26);
  29771. normal2 = ellipsoid.geodeticSurfaceNormal(position, normal2);
  29772. if (shadowVolume) {
  29773. extrudeNormals[i2 + length3] = -normal2.x;
  29774. extrudeNormals[i1 + length3] = -normal2.y;
  29775. extrudeNormals[i22 + length3] = -normal2.z;
  29776. }
  29777. let scaledNormal = Cartesian3_default.multiplyByScalar(
  29778. normal2,
  29779. height,
  29780. scratchCartesian42
  29781. );
  29782. position = Cartesian3_default.add(position, scaledNormal, position);
  29783. scaledNormal = Cartesian3_default.multiplyByScalar(
  29784. normal2,
  29785. extrudedHeight,
  29786. scaledNormal
  29787. );
  29788. extrudedPosition = Cartesian3_default.add(
  29789. extrudedPosition,
  29790. scaledNormal,
  29791. extrudedPosition
  29792. );
  29793. if (vertexFormat.position) {
  29794. finalPositions[i2 + length3] = extrudedPosition.x;
  29795. finalPositions[i1 + length3] = extrudedPosition.y;
  29796. finalPositions[i22 + length3] = extrudedPosition.z;
  29797. finalPositions[i2] = position.x;
  29798. finalPositions[i1] = position.y;
  29799. finalPositions[i22] = position.z;
  29800. }
  29801. if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent) {
  29802. bitangent = Cartesian3_default.clone(normal2, bitangent);
  29803. const next = Cartesian3_default.fromArray(
  29804. positions,
  29805. (i2 + 3) % length3,
  29806. scratchCartesian42
  29807. );
  29808. Cartesian3_default.subtract(next, position, next);
  29809. const bottom = Cartesian3_default.subtract(
  29810. extrudedPosition,
  29811. position,
  29812. scratchCartesian36
  29813. );
  29814. normal2 = Cartesian3_default.normalize(
  29815. Cartesian3_default.cross(bottom, next, normal2),
  29816. normal2
  29817. );
  29818. if (vertexFormat.normal) {
  29819. normals[i2] = normal2.x;
  29820. normals[i1] = normal2.y;
  29821. normals[i22] = normal2.z;
  29822. normals[i2 + length3] = normal2.x;
  29823. normals[i1 + length3] = normal2.y;
  29824. normals[i22 + length3] = normal2.z;
  29825. }
  29826. if (vertexFormat.tangent) {
  29827. tangent = Cartesian3_default.normalize(
  29828. Cartesian3_default.cross(bitangent, normal2, tangent),
  29829. tangent
  29830. );
  29831. tangents[i2] = tangent.x;
  29832. tangents[i1] = tangent.y;
  29833. tangents[i22] = tangent.z;
  29834. tangents[i2 + length3] = tangent.x;
  29835. tangents[i2 + 1 + length3] = tangent.y;
  29836. tangents[i2 + 2 + length3] = tangent.z;
  29837. }
  29838. if (vertexFormat.bitangent) {
  29839. bitangents[i2] = bitangent.x;
  29840. bitangents[i1] = bitangent.y;
  29841. bitangents[i22] = bitangent.z;
  29842. bitangents[i2 + length3] = bitangent.x;
  29843. bitangents[i1 + length3] = bitangent.y;
  29844. bitangents[i22 + length3] = bitangent.z;
  29845. }
  29846. }
  29847. }
  29848. if (vertexFormat.st) {
  29849. length3 = textureCoordinates.length;
  29850. for (let k = 0; k < length3; k += 2) {
  29851. textureCoordinates[k] = (textureCoordinates[k] - minTexCoord.x) / (maxTexCoord.x - minTexCoord.x);
  29852. textureCoordinates[k + 1] = (textureCoordinates[k + 1] - minTexCoord.y) / (maxTexCoord.y - minTexCoord.y);
  29853. }
  29854. }
  29855. const attributes = new GeometryAttributes_default();
  29856. if (vertexFormat.position) {
  29857. attributes.position = new GeometryAttribute_default({
  29858. componentDatatype: ComponentDatatype_default.DOUBLE,
  29859. componentsPerAttribute: 3,
  29860. values: finalPositions
  29861. });
  29862. }
  29863. if (vertexFormat.st) {
  29864. attributes.st = new GeometryAttribute_default({
  29865. componentDatatype: ComponentDatatype_default.FLOAT,
  29866. componentsPerAttribute: 2,
  29867. values: textureCoordinates
  29868. });
  29869. }
  29870. if (vertexFormat.normal) {
  29871. attributes.normal = new GeometryAttribute_default({
  29872. componentDatatype: ComponentDatatype_default.FLOAT,
  29873. componentsPerAttribute: 3,
  29874. values: normals
  29875. });
  29876. }
  29877. if (vertexFormat.tangent) {
  29878. attributes.tangent = new GeometryAttribute_default({
  29879. componentDatatype: ComponentDatatype_default.FLOAT,
  29880. componentsPerAttribute: 3,
  29881. values: tangents
  29882. });
  29883. }
  29884. if (vertexFormat.bitangent) {
  29885. attributes.bitangent = new GeometryAttribute_default({
  29886. componentDatatype: ComponentDatatype_default.FLOAT,
  29887. componentsPerAttribute: 3,
  29888. values: bitangents
  29889. });
  29890. }
  29891. if (shadowVolume) {
  29892. attributes.extrudeDirection = new GeometryAttribute_default({
  29893. componentDatatype: ComponentDatatype_default.FLOAT,
  29894. componentsPerAttribute: 3,
  29895. values: extrudeNormals
  29896. });
  29897. }
  29898. if (defined_default(options.offsetAttribute)) {
  29899. let offsetAttribute = new Uint8Array(size);
  29900. if (options.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
  29901. offsetAttribute = arrayFill_default(offsetAttribute, 1, 0, size / 2);
  29902. } else {
  29903. const offsetValue = options.offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  29904. offsetAttribute = arrayFill_default(offsetAttribute, offsetValue);
  29905. }
  29906. attributes.applyOffset = new GeometryAttribute_default({
  29907. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  29908. componentsPerAttribute: 1,
  29909. values: offsetAttribute
  29910. });
  29911. }
  29912. return attributes;
  29913. }
  29914. function computeWallIndices(positions) {
  29915. const length3 = positions.length / 3;
  29916. const indices2 = IndexDatatype_default.createTypedArray(length3, length3 * 6);
  29917. let index2 = 0;
  29918. for (let i2 = 0; i2 < length3; i2++) {
  29919. const UL = i2;
  29920. const LL = i2 + length3;
  29921. const UR = (UL + 1) % length3;
  29922. const LR = UR + length3;
  29923. indices2[index2++] = UL;
  29924. indices2[index2++] = LL;
  29925. indices2[index2++] = UR;
  29926. indices2[index2++] = UR;
  29927. indices2[index2++] = LL;
  29928. indices2[index2++] = LR;
  29929. }
  29930. return indices2;
  29931. }
  29932. var topBoundingSphere = new BoundingSphere_default();
  29933. var bottomBoundingSphere = new BoundingSphere_default();
  29934. function computeExtrudedEllipse(options) {
  29935. const center = options.center;
  29936. const ellipsoid = options.ellipsoid;
  29937. const semiMajorAxis = options.semiMajorAxis;
  29938. let scaledNormal = Cartesian3_default.multiplyByScalar(
  29939. ellipsoid.geodeticSurfaceNormal(center, scratchCartesian14),
  29940. options.height,
  29941. scratchCartesian14
  29942. );
  29943. topBoundingSphere.center = Cartesian3_default.add(
  29944. center,
  29945. scaledNormal,
  29946. topBoundingSphere.center
  29947. );
  29948. topBoundingSphere.radius = semiMajorAxis;
  29949. scaledNormal = Cartesian3_default.multiplyByScalar(
  29950. ellipsoid.geodeticSurfaceNormal(center, scaledNormal),
  29951. options.extrudedHeight,
  29952. scaledNormal
  29953. );
  29954. bottomBoundingSphere.center = Cartesian3_default.add(
  29955. center,
  29956. scaledNormal,
  29957. bottomBoundingSphere.center
  29958. );
  29959. bottomBoundingSphere.radius = semiMajorAxis;
  29960. const cep = EllipseGeometryLibrary_default.computeEllipsePositions(
  29961. options,
  29962. true,
  29963. true
  29964. );
  29965. const positions = cep.positions;
  29966. const numPts = cep.numPts;
  29967. const outerPositions = cep.outerPositions;
  29968. const boundingSphere = BoundingSphere_default.union(
  29969. topBoundingSphere,
  29970. bottomBoundingSphere
  29971. );
  29972. const topBottomAttributes = computeTopBottomAttributes(
  29973. positions,
  29974. options,
  29975. true
  29976. );
  29977. let indices2 = topIndices(numPts);
  29978. const length3 = indices2.length;
  29979. indices2.length = length3 * 2;
  29980. const posLength = positions.length / 3;
  29981. for (let i2 = 0; i2 < length3; i2 += 3) {
  29982. indices2[i2 + length3] = indices2[i2 + 2] + posLength;
  29983. indices2[i2 + 1 + length3] = indices2[i2 + 1] + posLength;
  29984. indices2[i2 + 2 + length3] = indices2[i2] + posLength;
  29985. }
  29986. const topBottomIndices = IndexDatatype_default.createTypedArray(
  29987. posLength * 2 / 3,
  29988. indices2
  29989. );
  29990. const topBottomGeo = new Geometry_default({
  29991. attributes: topBottomAttributes,
  29992. indices: topBottomIndices,
  29993. primitiveType: PrimitiveType_default.TRIANGLES
  29994. });
  29995. const wallAttributes = computeWallAttributes(outerPositions, options);
  29996. indices2 = computeWallIndices(outerPositions);
  29997. const wallIndices = IndexDatatype_default.createTypedArray(
  29998. outerPositions.length * 2 / 3,
  29999. indices2
  30000. );
  30001. const wallGeo = new Geometry_default({
  30002. attributes: wallAttributes,
  30003. indices: wallIndices,
  30004. primitiveType: PrimitiveType_default.TRIANGLES
  30005. });
  30006. const geo = GeometryPipeline_default.combineInstances([
  30007. new GeometryInstance_default({
  30008. geometry: topBottomGeo
  30009. }),
  30010. new GeometryInstance_default({
  30011. geometry: wallGeo
  30012. })
  30013. ]);
  30014. return {
  30015. boundingSphere,
  30016. attributes: geo[0].attributes,
  30017. indices: geo[0].indices
  30018. };
  30019. }
  30020. function computeRectangle(center, semiMajorAxis, semiMinorAxis, rotation, granularity, ellipsoid, result) {
  30021. const cep = EllipseGeometryLibrary_default.computeEllipsePositions(
  30022. {
  30023. center,
  30024. semiMajorAxis,
  30025. semiMinorAxis,
  30026. rotation,
  30027. granularity
  30028. },
  30029. false,
  30030. true
  30031. );
  30032. const positionsFlat = cep.outerPositions;
  30033. const positionsCount = positionsFlat.length / 3;
  30034. const positions = new Array(positionsCount);
  30035. for (let i2 = 0; i2 < positionsCount; ++i2) {
  30036. positions[i2] = Cartesian3_default.fromArray(positionsFlat, i2 * 3);
  30037. }
  30038. const rectangle = Rectangle_default.fromCartesianArray(positions, ellipsoid, result);
  30039. if (rectangle.width > Math_default.PI) {
  30040. rectangle.north = rectangle.north > 0 ? Math_default.PI_OVER_TWO - Math_default.EPSILON7 : rectangle.north;
  30041. rectangle.south = rectangle.south < 0 ? Math_default.EPSILON7 - Math_default.PI_OVER_TWO : rectangle.south;
  30042. rectangle.east = Math_default.PI;
  30043. rectangle.west = -Math_default.PI;
  30044. }
  30045. return rectangle;
  30046. }
  30047. function EllipseGeometry(options) {
  30048. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  30049. const center = options.center;
  30050. const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  30051. const semiMajorAxis = options.semiMajorAxis;
  30052. const semiMinorAxis = options.semiMinorAxis;
  30053. const granularity = defaultValue_default(
  30054. options.granularity,
  30055. Math_default.RADIANS_PER_DEGREE
  30056. );
  30057. const vertexFormat = defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT);
  30058. Check_default.defined("options.center", center);
  30059. Check_default.typeOf.number("options.semiMajorAxis", semiMajorAxis);
  30060. Check_default.typeOf.number("options.semiMinorAxis", semiMinorAxis);
  30061. if (semiMajorAxis < semiMinorAxis) {
  30062. throw new DeveloperError_default(
  30063. "semiMajorAxis must be greater than or equal to the semiMinorAxis."
  30064. );
  30065. }
  30066. if (granularity <= 0) {
  30067. throw new DeveloperError_default("granularity must be greater than zero.");
  30068. }
  30069. const height = defaultValue_default(options.height, 0);
  30070. const extrudedHeight = defaultValue_default(options.extrudedHeight, height);
  30071. this._center = Cartesian3_default.clone(center);
  30072. this._semiMajorAxis = semiMajorAxis;
  30073. this._semiMinorAxis = semiMinorAxis;
  30074. this._ellipsoid = Ellipsoid_default.clone(ellipsoid);
  30075. this._rotation = defaultValue_default(options.rotation, 0);
  30076. this._stRotation = defaultValue_default(options.stRotation, 0);
  30077. this._height = Math.max(extrudedHeight, height);
  30078. this._granularity = granularity;
  30079. this._vertexFormat = VertexFormat_default.clone(vertexFormat);
  30080. this._extrudedHeight = Math.min(extrudedHeight, height);
  30081. this._shadowVolume = defaultValue_default(options.shadowVolume, false);
  30082. this._workerName = "createEllipseGeometry";
  30083. this._offsetAttribute = options.offsetAttribute;
  30084. this._rectangle = void 0;
  30085. this._textureCoordinateRotationPoints = void 0;
  30086. }
  30087. EllipseGeometry.packedLength = Cartesian3_default.packedLength + Ellipsoid_default.packedLength + VertexFormat_default.packedLength + 9;
  30088. EllipseGeometry.pack = function(value, array, startingIndex) {
  30089. Check_default.defined("value", value);
  30090. Check_default.defined("array", array);
  30091. startingIndex = defaultValue_default(startingIndex, 0);
  30092. Cartesian3_default.pack(value._center, array, startingIndex);
  30093. startingIndex += Cartesian3_default.packedLength;
  30094. Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
  30095. startingIndex += Ellipsoid_default.packedLength;
  30096. VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
  30097. startingIndex += VertexFormat_default.packedLength;
  30098. array[startingIndex++] = value._semiMajorAxis;
  30099. array[startingIndex++] = value._semiMinorAxis;
  30100. array[startingIndex++] = value._rotation;
  30101. array[startingIndex++] = value._stRotation;
  30102. array[startingIndex++] = value._height;
  30103. array[startingIndex++] = value._granularity;
  30104. array[startingIndex++] = value._extrudedHeight;
  30105. array[startingIndex++] = value._shadowVolume ? 1 : 0;
  30106. array[startingIndex] = defaultValue_default(value._offsetAttribute, -1);
  30107. return array;
  30108. };
  30109. var scratchCenter2 = new Cartesian3_default();
  30110. var scratchEllipsoid = new Ellipsoid_default();
  30111. var scratchVertexFormat2 = new VertexFormat_default();
  30112. var scratchOptions3 = {
  30113. center: scratchCenter2,
  30114. ellipsoid: scratchEllipsoid,
  30115. vertexFormat: scratchVertexFormat2,
  30116. semiMajorAxis: void 0,
  30117. semiMinorAxis: void 0,
  30118. rotation: void 0,
  30119. stRotation: void 0,
  30120. height: void 0,
  30121. granularity: void 0,
  30122. extrudedHeight: void 0,
  30123. shadowVolume: void 0,
  30124. offsetAttribute: void 0
  30125. };
  30126. EllipseGeometry.unpack = function(array, startingIndex, result) {
  30127. Check_default.defined("array", array);
  30128. startingIndex = defaultValue_default(startingIndex, 0);
  30129. const center = Cartesian3_default.unpack(array, startingIndex, scratchCenter2);
  30130. startingIndex += Cartesian3_default.packedLength;
  30131. const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid);
  30132. startingIndex += Ellipsoid_default.packedLength;
  30133. const vertexFormat = VertexFormat_default.unpack(
  30134. array,
  30135. startingIndex,
  30136. scratchVertexFormat2
  30137. );
  30138. startingIndex += VertexFormat_default.packedLength;
  30139. const semiMajorAxis = array[startingIndex++];
  30140. const semiMinorAxis = array[startingIndex++];
  30141. const rotation = array[startingIndex++];
  30142. const stRotation = array[startingIndex++];
  30143. const height = array[startingIndex++];
  30144. const granularity = array[startingIndex++];
  30145. const extrudedHeight = array[startingIndex++];
  30146. const shadowVolume = array[startingIndex++] === 1;
  30147. const offsetAttribute = array[startingIndex];
  30148. if (!defined_default(result)) {
  30149. scratchOptions3.height = height;
  30150. scratchOptions3.extrudedHeight = extrudedHeight;
  30151. scratchOptions3.granularity = granularity;
  30152. scratchOptions3.stRotation = stRotation;
  30153. scratchOptions3.rotation = rotation;
  30154. scratchOptions3.semiMajorAxis = semiMajorAxis;
  30155. scratchOptions3.semiMinorAxis = semiMinorAxis;
  30156. scratchOptions3.shadowVolume = shadowVolume;
  30157. scratchOptions3.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  30158. return new EllipseGeometry(scratchOptions3);
  30159. }
  30160. result._center = Cartesian3_default.clone(center, result._center);
  30161. result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
  30162. result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
  30163. result._semiMajorAxis = semiMajorAxis;
  30164. result._semiMinorAxis = semiMinorAxis;
  30165. result._rotation = rotation;
  30166. result._stRotation = stRotation;
  30167. result._height = height;
  30168. result._granularity = granularity;
  30169. result._extrudedHeight = extrudedHeight;
  30170. result._shadowVolume = shadowVolume;
  30171. result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  30172. return result;
  30173. };
  30174. EllipseGeometry.computeRectangle = function(options, result) {
  30175. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  30176. const center = options.center;
  30177. const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  30178. const semiMajorAxis = options.semiMajorAxis;
  30179. const semiMinorAxis = options.semiMinorAxis;
  30180. const granularity = defaultValue_default(
  30181. options.granularity,
  30182. Math_default.RADIANS_PER_DEGREE
  30183. );
  30184. const rotation = defaultValue_default(options.rotation, 0);
  30185. Check_default.defined("options.center", center);
  30186. Check_default.typeOf.number("options.semiMajorAxis", semiMajorAxis);
  30187. Check_default.typeOf.number("options.semiMinorAxis", semiMinorAxis);
  30188. if (semiMajorAxis < semiMinorAxis) {
  30189. throw new DeveloperError_default(
  30190. "semiMajorAxis must be greater than or equal to the semiMinorAxis."
  30191. );
  30192. }
  30193. if (granularity <= 0) {
  30194. throw new DeveloperError_default("granularity must be greater than zero.");
  30195. }
  30196. return computeRectangle(
  30197. center,
  30198. semiMajorAxis,
  30199. semiMinorAxis,
  30200. rotation,
  30201. granularity,
  30202. ellipsoid,
  30203. result
  30204. );
  30205. };
  30206. EllipseGeometry.createGeometry = function(ellipseGeometry) {
  30207. if (ellipseGeometry._semiMajorAxis <= 0 || ellipseGeometry._semiMinorAxis <= 0) {
  30208. return;
  30209. }
  30210. const height = ellipseGeometry._height;
  30211. const extrudedHeight = ellipseGeometry._extrudedHeight;
  30212. const extrude = !Math_default.equalsEpsilon(
  30213. height,
  30214. extrudedHeight,
  30215. 0,
  30216. Math_default.EPSILON2
  30217. );
  30218. ellipseGeometry._center = ellipseGeometry._ellipsoid.scaleToGeodeticSurface(
  30219. ellipseGeometry._center,
  30220. ellipseGeometry._center
  30221. );
  30222. const options = {
  30223. center: ellipseGeometry._center,
  30224. semiMajorAxis: ellipseGeometry._semiMajorAxis,
  30225. semiMinorAxis: ellipseGeometry._semiMinorAxis,
  30226. ellipsoid: ellipseGeometry._ellipsoid,
  30227. rotation: ellipseGeometry._rotation,
  30228. height,
  30229. granularity: ellipseGeometry._granularity,
  30230. vertexFormat: ellipseGeometry._vertexFormat,
  30231. stRotation: ellipseGeometry._stRotation
  30232. };
  30233. let geometry;
  30234. if (extrude) {
  30235. options.extrudedHeight = extrudedHeight;
  30236. options.shadowVolume = ellipseGeometry._shadowVolume;
  30237. options.offsetAttribute = ellipseGeometry._offsetAttribute;
  30238. geometry = computeExtrudedEllipse(options);
  30239. } else {
  30240. geometry = computeEllipse(options);
  30241. if (defined_default(ellipseGeometry._offsetAttribute)) {
  30242. const length3 = geometry.attributes.position.values.length;
  30243. const applyOffset = new Uint8Array(length3 / 3);
  30244. const offsetValue = ellipseGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  30245. arrayFill_default(applyOffset, offsetValue);
  30246. geometry.attributes.applyOffset = new GeometryAttribute_default({
  30247. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  30248. componentsPerAttribute: 1,
  30249. values: applyOffset
  30250. });
  30251. }
  30252. }
  30253. return new Geometry_default({
  30254. attributes: geometry.attributes,
  30255. indices: geometry.indices,
  30256. primitiveType: PrimitiveType_default.TRIANGLES,
  30257. boundingSphere: geometry.boundingSphere,
  30258. offsetAttribute: ellipseGeometry._offsetAttribute
  30259. });
  30260. };
  30261. EllipseGeometry.createShadowVolume = function(ellipseGeometry, minHeightFunc, maxHeightFunc) {
  30262. const granularity = ellipseGeometry._granularity;
  30263. const ellipsoid = ellipseGeometry._ellipsoid;
  30264. const minHeight = minHeightFunc(granularity, ellipsoid);
  30265. const maxHeight = maxHeightFunc(granularity, ellipsoid);
  30266. return new EllipseGeometry({
  30267. center: ellipseGeometry._center,
  30268. semiMajorAxis: ellipseGeometry._semiMajorAxis,
  30269. semiMinorAxis: ellipseGeometry._semiMinorAxis,
  30270. ellipsoid,
  30271. rotation: ellipseGeometry._rotation,
  30272. stRotation: ellipseGeometry._stRotation,
  30273. granularity,
  30274. extrudedHeight: minHeight,
  30275. height: maxHeight,
  30276. vertexFormat: VertexFormat_default.POSITION_ONLY,
  30277. shadowVolume: true
  30278. });
  30279. };
  30280. function textureCoordinateRotationPoints(ellipseGeometry) {
  30281. const stRotation = -ellipseGeometry._stRotation;
  30282. if (stRotation === 0) {
  30283. return [0, 0, 0, 1, 1, 0];
  30284. }
  30285. const cep = EllipseGeometryLibrary_default.computeEllipsePositions(
  30286. {
  30287. center: ellipseGeometry._center,
  30288. semiMajorAxis: ellipseGeometry._semiMajorAxis,
  30289. semiMinorAxis: ellipseGeometry._semiMinorAxis,
  30290. rotation: ellipseGeometry._rotation,
  30291. granularity: ellipseGeometry._granularity
  30292. },
  30293. false,
  30294. true
  30295. );
  30296. const positionsFlat = cep.outerPositions;
  30297. const positionsCount = positionsFlat.length / 3;
  30298. const positions = new Array(positionsCount);
  30299. for (let i2 = 0; i2 < positionsCount; ++i2) {
  30300. positions[i2] = Cartesian3_default.fromArray(positionsFlat, i2 * 3);
  30301. }
  30302. const ellipsoid = ellipseGeometry._ellipsoid;
  30303. const boundingRectangle = ellipseGeometry.rectangle;
  30304. return Geometry_default._textureCoordinateRotationPoints(
  30305. positions,
  30306. stRotation,
  30307. ellipsoid,
  30308. boundingRectangle
  30309. );
  30310. }
  30311. Object.defineProperties(EllipseGeometry.prototype, {
  30312. rectangle: {
  30313. get: function() {
  30314. if (!defined_default(this._rectangle)) {
  30315. this._rectangle = computeRectangle(
  30316. this._center,
  30317. this._semiMajorAxis,
  30318. this._semiMinorAxis,
  30319. this._rotation,
  30320. this._granularity,
  30321. this._ellipsoid
  30322. );
  30323. }
  30324. return this._rectangle;
  30325. }
  30326. },
  30327. textureCoordinateRotationPoints: {
  30328. get: function() {
  30329. if (!defined_default(this._textureCoordinateRotationPoints)) {
  30330. this._textureCoordinateRotationPoints = textureCoordinateRotationPoints(
  30331. this
  30332. );
  30333. }
  30334. return this._textureCoordinateRotationPoints;
  30335. }
  30336. }
  30337. });
  30338. var EllipseGeometry_default = EllipseGeometry;
  30339. // node_modules/cesium/Source/Core/CircleGeometry.js
  30340. function CircleGeometry(options) {
  30341. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  30342. const radius = options.radius;
  30343. Check_default.typeOf.number("radius", radius);
  30344. const ellipseGeometryOptions = {
  30345. center: options.center,
  30346. semiMajorAxis: radius,
  30347. semiMinorAxis: radius,
  30348. ellipsoid: options.ellipsoid,
  30349. height: options.height,
  30350. extrudedHeight: options.extrudedHeight,
  30351. granularity: options.granularity,
  30352. vertexFormat: options.vertexFormat,
  30353. stRotation: options.stRotation,
  30354. shadowVolume: options.shadowVolume
  30355. };
  30356. this._ellipseGeometry = new EllipseGeometry_default(ellipseGeometryOptions);
  30357. this._workerName = "createCircleGeometry";
  30358. }
  30359. CircleGeometry.packedLength = EllipseGeometry_default.packedLength;
  30360. CircleGeometry.pack = function(value, array, startingIndex) {
  30361. Check_default.typeOf.object("value", value);
  30362. return EllipseGeometry_default.pack(value._ellipseGeometry, array, startingIndex);
  30363. };
  30364. var scratchEllipseGeometry = new EllipseGeometry_default({
  30365. center: new Cartesian3_default(),
  30366. semiMajorAxis: 1,
  30367. semiMinorAxis: 1
  30368. });
  30369. var scratchOptions4 = {
  30370. center: new Cartesian3_default(),
  30371. radius: void 0,
  30372. ellipsoid: Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE),
  30373. height: void 0,
  30374. extrudedHeight: void 0,
  30375. granularity: void 0,
  30376. vertexFormat: new VertexFormat_default(),
  30377. stRotation: void 0,
  30378. semiMajorAxis: void 0,
  30379. semiMinorAxis: void 0,
  30380. shadowVolume: void 0
  30381. };
  30382. CircleGeometry.unpack = function(array, startingIndex, result) {
  30383. const ellipseGeometry = EllipseGeometry_default.unpack(
  30384. array,
  30385. startingIndex,
  30386. scratchEllipseGeometry
  30387. );
  30388. scratchOptions4.center = Cartesian3_default.clone(
  30389. ellipseGeometry._center,
  30390. scratchOptions4.center
  30391. );
  30392. scratchOptions4.ellipsoid = Ellipsoid_default.clone(
  30393. ellipseGeometry._ellipsoid,
  30394. scratchOptions4.ellipsoid
  30395. );
  30396. scratchOptions4.height = ellipseGeometry._height;
  30397. scratchOptions4.extrudedHeight = ellipseGeometry._extrudedHeight;
  30398. scratchOptions4.granularity = ellipseGeometry._granularity;
  30399. scratchOptions4.vertexFormat = VertexFormat_default.clone(
  30400. ellipseGeometry._vertexFormat,
  30401. scratchOptions4.vertexFormat
  30402. );
  30403. scratchOptions4.stRotation = ellipseGeometry._stRotation;
  30404. scratchOptions4.shadowVolume = ellipseGeometry._shadowVolume;
  30405. if (!defined_default(result)) {
  30406. scratchOptions4.radius = ellipseGeometry._semiMajorAxis;
  30407. return new CircleGeometry(scratchOptions4);
  30408. }
  30409. scratchOptions4.semiMajorAxis = ellipseGeometry._semiMajorAxis;
  30410. scratchOptions4.semiMinorAxis = ellipseGeometry._semiMinorAxis;
  30411. result._ellipseGeometry = new EllipseGeometry_default(scratchOptions4);
  30412. return result;
  30413. };
  30414. CircleGeometry.createGeometry = function(circleGeometry) {
  30415. return EllipseGeometry_default.createGeometry(circleGeometry._ellipseGeometry);
  30416. };
  30417. CircleGeometry.createShadowVolume = function(circleGeometry, minHeightFunc, maxHeightFunc) {
  30418. const granularity = circleGeometry._ellipseGeometry._granularity;
  30419. const ellipsoid = circleGeometry._ellipseGeometry._ellipsoid;
  30420. const minHeight = minHeightFunc(granularity, ellipsoid);
  30421. const maxHeight = maxHeightFunc(granularity, ellipsoid);
  30422. return new CircleGeometry({
  30423. center: circleGeometry._ellipseGeometry._center,
  30424. radius: circleGeometry._ellipseGeometry._semiMajorAxis,
  30425. ellipsoid,
  30426. stRotation: circleGeometry._ellipseGeometry._stRotation,
  30427. granularity,
  30428. extrudedHeight: minHeight,
  30429. height: maxHeight,
  30430. vertexFormat: VertexFormat_default.POSITION_ONLY,
  30431. shadowVolume: true
  30432. });
  30433. };
  30434. Object.defineProperties(CircleGeometry.prototype, {
  30435. rectangle: {
  30436. get: function() {
  30437. return this._ellipseGeometry.rectangle;
  30438. }
  30439. },
  30440. textureCoordinateRotationPoints: {
  30441. get: function() {
  30442. return this._ellipseGeometry.textureCoordinateRotationPoints;
  30443. }
  30444. }
  30445. });
  30446. var CircleGeometry_default = CircleGeometry;
  30447. // node_modules/cesium/Source/Core/EllipseOutlineGeometry.js
  30448. var scratchCartesian15 = new Cartesian3_default();
  30449. var boundingSphereCenter2 = new Cartesian3_default();
  30450. function computeEllipse2(options) {
  30451. const center = options.center;
  30452. boundingSphereCenter2 = Cartesian3_default.multiplyByScalar(
  30453. options.ellipsoid.geodeticSurfaceNormal(center, boundingSphereCenter2),
  30454. options.height,
  30455. boundingSphereCenter2
  30456. );
  30457. boundingSphereCenter2 = Cartesian3_default.add(
  30458. center,
  30459. boundingSphereCenter2,
  30460. boundingSphereCenter2
  30461. );
  30462. const boundingSphere = new BoundingSphere_default(
  30463. boundingSphereCenter2,
  30464. options.semiMajorAxis
  30465. );
  30466. const positions = EllipseGeometryLibrary_default.computeEllipsePositions(
  30467. options,
  30468. false,
  30469. true
  30470. ).outerPositions;
  30471. const attributes = new GeometryAttributes_default({
  30472. position: new GeometryAttribute_default({
  30473. componentDatatype: ComponentDatatype_default.DOUBLE,
  30474. componentsPerAttribute: 3,
  30475. values: EllipseGeometryLibrary_default.raisePositionsToHeight(
  30476. positions,
  30477. options,
  30478. false
  30479. )
  30480. })
  30481. });
  30482. const length3 = positions.length / 3;
  30483. const indices2 = IndexDatatype_default.createTypedArray(length3, length3 * 2);
  30484. let index2 = 0;
  30485. for (let i2 = 0; i2 < length3; ++i2) {
  30486. indices2[index2++] = i2;
  30487. indices2[index2++] = (i2 + 1) % length3;
  30488. }
  30489. return {
  30490. boundingSphere,
  30491. attributes,
  30492. indices: indices2
  30493. };
  30494. }
  30495. var topBoundingSphere2 = new BoundingSphere_default();
  30496. var bottomBoundingSphere2 = new BoundingSphere_default();
  30497. function computeExtrudedEllipse2(options) {
  30498. const center = options.center;
  30499. const ellipsoid = options.ellipsoid;
  30500. const semiMajorAxis = options.semiMajorAxis;
  30501. let scaledNormal = Cartesian3_default.multiplyByScalar(
  30502. ellipsoid.geodeticSurfaceNormal(center, scratchCartesian15),
  30503. options.height,
  30504. scratchCartesian15
  30505. );
  30506. topBoundingSphere2.center = Cartesian3_default.add(
  30507. center,
  30508. scaledNormal,
  30509. topBoundingSphere2.center
  30510. );
  30511. topBoundingSphere2.radius = semiMajorAxis;
  30512. scaledNormal = Cartesian3_default.multiplyByScalar(
  30513. ellipsoid.geodeticSurfaceNormal(center, scaledNormal),
  30514. options.extrudedHeight,
  30515. scaledNormal
  30516. );
  30517. bottomBoundingSphere2.center = Cartesian3_default.add(
  30518. center,
  30519. scaledNormal,
  30520. bottomBoundingSphere2.center
  30521. );
  30522. bottomBoundingSphere2.radius = semiMajorAxis;
  30523. let positions = EllipseGeometryLibrary_default.computeEllipsePositions(
  30524. options,
  30525. false,
  30526. true
  30527. ).outerPositions;
  30528. const attributes = new GeometryAttributes_default({
  30529. position: new GeometryAttribute_default({
  30530. componentDatatype: ComponentDatatype_default.DOUBLE,
  30531. componentsPerAttribute: 3,
  30532. values: EllipseGeometryLibrary_default.raisePositionsToHeight(
  30533. positions,
  30534. options,
  30535. true
  30536. )
  30537. })
  30538. });
  30539. positions = attributes.position.values;
  30540. const boundingSphere = BoundingSphere_default.union(
  30541. topBoundingSphere2,
  30542. bottomBoundingSphere2
  30543. );
  30544. let length3 = positions.length / 3;
  30545. if (defined_default(options.offsetAttribute)) {
  30546. let applyOffset = new Uint8Array(length3);
  30547. if (options.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
  30548. applyOffset = arrayFill_default(applyOffset, 1, 0, length3 / 2);
  30549. } else {
  30550. const offsetValue = options.offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  30551. applyOffset = arrayFill_default(applyOffset, offsetValue);
  30552. }
  30553. attributes.applyOffset = new GeometryAttribute_default({
  30554. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  30555. componentsPerAttribute: 1,
  30556. values: applyOffset
  30557. });
  30558. }
  30559. let numberOfVerticalLines = defaultValue_default(options.numberOfVerticalLines, 16);
  30560. numberOfVerticalLines = Math_default.clamp(
  30561. numberOfVerticalLines,
  30562. 0,
  30563. length3 / 2
  30564. );
  30565. const indices2 = IndexDatatype_default.createTypedArray(
  30566. length3,
  30567. length3 * 2 + numberOfVerticalLines * 2
  30568. );
  30569. length3 /= 2;
  30570. let index2 = 0;
  30571. let i2;
  30572. for (i2 = 0; i2 < length3; ++i2) {
  30573. indices2[index2++] = i2;
  30574. indices2[index2++] = (i2 + 1) % length3;
  30575. indices2[index2++] = i2 + length3;
  30576. indices2[index2++] = (i2 + 1) % length3 + length3;
  30577. }
  30578. let numSide;
  30579. if (numberOfVerticalLines > 0) {
  30580. const numSideLines = Math.min(numberOfVerticalLines, length3);
  30581. numSide = Math.round(length3 / numSideLines);
  30582. const maxI = Math.min(numSide * numberOfVerticalLines, length3);
  30583. for (i2 = 0; i2 < maxI; i2 += numSide) {
  30584. indices2[index2++] = i2;
  30585. indices2[index2++] = i2 + length3;
  30586. }
  30587. }
  30588. return {
  30589. boundingSphere,
  30590. attributes,
  30591. indices: indices2
  30592. };
  30593. }
  30594. function EllipseOutlineGeometry(options) {
  30595. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  30596. const center = options.center;
  30597. const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  30598. const semiMajorAxis = options.semiMajorAxis;
  30599. const semiMinorAxis = options.semiMinorAxis;
  30600. const granularity = defaultValue_default(
  30601. options.granularity,
  30602. Math_default.RADIANS_PER_DEGREE
  30603. );
  30604. if (!defined_default(center)) {
  30605. throw new DeveloperError_default("center is required.");
  30606. }
  30607. if (!defined_default(semiMajorAxis)) {
  30608. throw new DeveloperError_default("semiMajorAxis is required.");
  30609. }
  30610. if (!defined_default(semiMinorAxis)) {
  30611. throw new DeveloperError_default("semiMinorAxis is required.");
  30612. }
  30613. if (semiMajorAxis < semiMinorAxis) {
  30614. throw new DeveloperError_default(
  30615. "semiMajorAxis must be greater than or equal to the semiMinorAxis."
  30616. );
  30617. }
  30618. if (granularity <= 0) {
  30619. throw new DeveloperError_default("granularity must be greater than zero.");
  30620. }
  30621. const height = defaultValue_default(options.height, 0);
  30622. const extrudedHeight = defaultValue_default(options.extrudedHeight, height);
  30623. this._center = Cartesian3_default.clone(center);
  30624. this._semiMajorAxis = semiMajorAxis;
  30625. this._semiMinorAxis = semiMinorAxis;
  30626. this._ellipsoid = Ellipsoid_default.clone(ellipsoid);
  30627. this._rotation = defaultValue_default(options.rotation, 0);
  30628. this._height = Math.max(extrudedHeight, height);
  30629. this._granularity = granularity;
  30630. this._extrudedHeight = Math.min(extrudedHeight, height);
  30631. this._numberOfVerticalLines = Math.max(
  30632. defaultValue_default(options.numberOfVerticalLines, 16),
  30633. 0
  30634. );
  30635. this._offsetAttribute = options.offsetAttribute;
  30636. this._workerName = "createEllipseOutlineGeometry";
  30637. }
  30638. EllipseOutlineGeometry.packedLength = Cartesian3_default.packedLength + Ellipsoid_default.packedLength + 8;
  30639. EllipseOutlineGeometry.pack = function(value, array, startingIndex) {
  30640. if (!defined_default(value)) {
  30641. throw new DeveloperError_default("value is required");
  30642. }
  30643. if (!defined_default(array)) {
  30644. throw new DeveloperError_default("array is required");
  30645. }
  30646. startingIndex = defaultValue_default(startingIndex, 0);
  30647. Cartesian3_default.pack(value._center, array, startingIndex);
  30648. startingIndex += Cartesian3_default.packedLength;
  30649. Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
  30650. startingIndex += Ellipsoid_default.packedLength;
  30651. array[startingIndex++] = value._semiMajorAxis;
  30652. array[startingIndex++] = value._semiMinorAxis;
  30653. array[startingIndex++] = value._rotation;
  30654. array[startingIndex++] = value._height;
  30655. array[startingIndex++] = value._granularity;
  30656. array[startingIndex++] = value._extrudedHeight;
  30657. array[startingIndex++] = value._numberOfVerticalLines;
  30658. array[startingIndex] = defaultValue_default(value._offsetAttribute, -1);
  30659. return array;
  30660. };
  30661. var scratchCenter3 = new Cartesian3_default();
  30662. var scratchEllipsoid2 = new Ellipsoid_default();
  30663. var scratchOptions5 = {
  30664. center: scratchCenter3,
  30665. ellipsoid: scratchEllipsoid2,
  30666. semiMajorAxis: void 0,
  30667. semiMinorAxis: void 0,
  30668. rotation: void 0,
  30669. height: void 0,
  30670. granularity: void 0,
  30671. extrudedHeight: void 0,
  30672. numberOfVerticalLines: void 0,
  30673. offsetAttribute: void 0
  30674. };
  30675. EllipseOutlineGeometry.unpack = function(array, startingIndex, result) {
  30676. if (!defined_default(array)) {
  30677. throw new DeveloperError_default("array is required");
  30678. }
  30679. startingIndex = defaultValue_default(startingIndex, 0);
  30680. const center = Cartesian3_default.unpack(array, startingIndex, scratchCenter3);
  30681. startingIndex += Cartesian3_default.packedLength;
  30682. const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid2);
  30683. startingIndex += Ellipsoid_default.packedLength;
  30684. const semiMajorAxis = array[startingIndex++];
  30685. const semiMinorAxis = array[startingIndex++];
  30686. const rotation = array[startingIndex++];
  30687. const height = array[startingIndex++];
  30688. const granularity = array[startingIndex++];
  30689. const extrudedHeight = array[startingIndex++];
  30690. const numberOfVerticalLines = array[startingIndex++];
  30691. const offsetAttribute = array[startingIndex];
  30692. if (!defined_default(result)) {
  30693. scratchOptions5.height = height;
  30694. scratchOptions5.extrudedHeight = extrudedHeight;
  30695. scratchOptions5.granularity = granularity;
  30696. scratchOptions5.rotation = rotation;
  30697. scratchOptions5.semiMajorAxis = semiMajorAxis;
  30698. scratchOptions5.semiMinorAxis = semiMinorAxis;
  30699. scratchOptions5.numberOfVerticalLines = numberOfVerticalLines;
  30700. scratchOptions5.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  30701. return new EllipseOutlineGeometry(scratchOptions5);
  30702. }
  30703. result._center = Cartesian3_default.clone(center, result._center);
  30704. result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
  30705. result._semiMajorAxis = semiMajorAxis;
  30706. result._semiMinorAxis = semiMinorAxis;
  30707. result._rotation = rotation;
  30708. result._height = height;
  30709. result._granularity = granularity;
  30710. result._extrudedHeight = extrudedHeight;
  30711. result._numberOfVerticalLines = numberOfVerticalLines;
  30712. result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  30713. return result;
  30714. };
  30715. EllipseOutlineGeometry.createGeometry = function(ellipseGeometry) {
  30716. if (ellipseGeometry._semiMajorAxis <= 0 || ellipseGeometry._semiMinorAxis <= 0) {
  30717. return;
  30718. }
  30719. const height = ellipseGeometry._height;
  30720. const extrudedHeight = ellipseGeometry._extrudedHeight;
  30721. const extrude = !Math_default.equalsEpsilon(
  30722. height,
  30723. extrudedHeight,
  30724. 0,
  30725. Math_default.EPSILON2
  30726. );
  30727. ellipseGeometry._center = ellipseGeometry._ellipsoid.scaleToGeodeticSurface(
  30728. ellipseGeometry._center,
  30729. ellipseGeometry._center
  30730. );
  30731. const options = {
  30732. center: ellipseGeometry._center,
  30733. semiMajorAxis: ellipseGeometry._semiMajorAxis,
  30734. semiMinorAxis: ellipseGeometry._semiMinorAxis,
  30735. ellipsoid: ellipseGeometry._ellipsoid,
  30736. rotation: ellipseGeometry._rotation,
  30737. height,
  30738. granularity: ellipseGeometry._granularity,
  30739. numberOfVerticalLines: ellipseGeometry._numberOfVerticalLines
  30740. };
  30741. let geometry;
  30742. if (extrude) {
  30743. options.extrudedHeight = extrudedHeight;
  30744. options.offsetAttribute = ellipseGeometry._offsetAttribute;
  30745. geometry = computeExtrudedEllipse2(options);
  30746. } else {
  30747. geometry = computeEllipse2(options);
  30748. if (defined_default(ellipseGeometry._offsetAttribute)) {
  30749. const length3 = geometry.attributes.position.values.length;
  30750. const applyOffset = new Uint8Array(length3 / 3);
  30751. const offsetValue = ellipseGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  30752. arrayFill_default(applyOffset, offsetValue);
  30753. geometry.attributes.applyOffset = new GeometryAttribute_default({
  30754. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  30755. componentsPerAttribute: 1,
  30756. values: applyOffset
  30757. });
  30758. }
  30759. }
  30760. return new Geometry_default({
  30761. attributes: geometry.attributes,
  30762. indices: geometry.indices,
  30763. primitiveType: PrimitiveType_default.LINES,
  30764. boundingSphere: geometry.boundingSphere,
  30765. offsetAttribute: ellipseGeometry._offsetAttribute
  30766. });
  30767. };
  30768. var EllipseOutlineGeometry_default = EllipseOutlineGeometry;
  30769. // node_modules/cesium/Source/Core/CircleOutlineGeometry.js
  30770. function CircleOutlineGeometry(options) {
  30771. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  30772. const radius = options.radius;
  30773. Check_default.typeOf.number("radius", radius);
  30774. const ellipseGeometryOptions = {
  30775. center: options.center,
  30776. semiMajorAxis: radius,
  30777. semiMinorAxis: radius,
  30778. ellipsoid: options.ellipsoid,
  30779. height: options.height,
  30780. extrudedHeight: options.extrudedHeight,
  30781. granularity: options.granularity,
  30782. numberOfVerticalLines: options.numberOfVerticalLines
  30783. };
  30784. this._ellipseGeometry = new EllipseOutlineGeometry_default(ellipseGeometryOptions);
  30785. this._workerName = "createCircleOutlineGeometry";
  30786. }
  30787. CircleOutlineGeometry.packedLength = EllipseOutlineGeometry_default.packedLength;
  30788. CircleOutlineGeometry.pack = function(value, array, startingIndex) {
  30789. Check_default.typeOf.object("value", value);
  30790. return EllipseOutlineGeometry_default.pack(
  30791. value._ellipseGeometry,
  30792. array,
  30793. startingIndex
  30794. );
  30795. };
  30796. var scratchEllipseGeometry2 = new EllipseOutlineGeometry_default({
  30797. center: new Cartesian3_default(),
  30798. semiMajorAxis: 1,
  30799. semiMinorAxis: 1
  30800. });
  30801. var scratchOptions6 = {
  30802. center: new Cartesian3_default(),
  30803. radius: void 0,
  30804. ellipsoid: Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE),
  30805. height: void 0,
  30806. extrudedHeight: void 0,
  30807. granularity: void 0,
  30808. numberOfVerticalLines: void 0,
  30809. semiMajorAxis: void 0,
  30810. semiMinorAxis: void 0
  30811. };
  30812. CircleOutlineGeometry.unpack = function(array, startingIndex, result) {
  30813. const ellipseGeometry = EllipseOutlineGeometry_default.unpack(
  30814. array,
  30815. startingIndex,
  30816. scratchEllipseGeometry2
  30817. );
  30818. scratchOptions6.center = Cartesian3_default.clone(
  30819. ellipseGeometry._center,
  30820. scratchOptions6.center
  30821. );
  30822. scratchOptions6.ellipsoid = Ellipsoid_default.clone(
  30823. ellipseGeometry._ellipsoid,
  30824. scratchOptions6.ellipsoid
  30825. );
  30826. scratchOptions6.height = ellipseGeometry._height;
  30827. scratchOptions6.extrudedHeight = ellipseGeometry._extrudedHeight;
  30828. scratchOptions6.granularity = ellipseGeometry._granularity;
  30829. scratchOptions6.numberOfVerticalLines = ellipseGeometry._numberOfVerticalLines;
  30830. if (!defined_default(result)) {
  30831. scratchOptions6.radius = ellipseGeometry._semiMajorAxis;
  30832. return new CircleOutlineGeometry(scratchOptions6);
  30833. }
  30834. scratchOptions6.semiMajorAxis = ellipseGeometry._semiMajorAxis;
  30835. scratchOptions6.semiMinorAxis = ellipseGeometry._semiMinorAxis;
  30836. result._ellipseGeometry = new EllipseOutlineGeometry_default(scratchOptions6);
  30837. return result;
  30838. };
  30839. CircleOutlineGeometry.createGeometry = function(circleGeometry) {
  30840. return EllipseOutlineGeometry_default.createGeometry(circleGeometry._ellipseGeometry);
  30841. };
  30842. var CircleOutlineGeometry_default = CircleOutlineGeometry;
  30843. // node_modules/cesium/Source/Core/ClockRange.js
  30844. var ClockRange = {
  30845. UNBOUNDED: 0,
  30846. CLAMPED: 1,
  30847. LOOP_STOP: 2
  30848. };
  30849. var ClockRange_default = Object.freeze(ClockRange);
  30850. // node_modules/cesium/Source/Core/ClockStep.js
  30851. var ClockStep = {
  30852. TICK_DEPENDENT: 0,
  30853. SYSTEM_CLOCK_MULTIPLIER: 1,
  30854. SYSTEM_CLOCK: 2
  30855. };
  30856. var ClockStep_default = Object.freeze(ClockStep);
  30857. // node_modules/cesium/Source/Core/getTimestamp.js
  30858. var getTimestamp;
  30859. if (typeof performance !== "undefined" && typeof performance.now === "function" && isFinite(performance.now())) {
  30860. getTimestamp = function() {
  30861. return performance.now();
  30862. };
  30863. } else {
  30864. getTimestamp = function() {
  30865. return Date.now();
  30866. };
  30867. }
  30868. var getTimestamp_default = getTimestamp;
  30869. // node_modules/cesium/Source/Core/Clock.js
  30870. function Clock(options) {
  30871. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  30872. let currentTime = options.currentTime;
  30873. let startTime = options.startTime;
  30874. let stopTime = options.stopTime;
  30875. if (!defined_default(currentTime)) {
  30876. if (defined_default(startTime)) {
  30877. currentTime = JulianDate_default.clone(startTime);
  30878. } else if (defined_default(stopTime)) {
  30879. currentTime = JulianDate_default.addDays(stopTime, -1, new JulianDate_default());
  30880. } else {
  30881. currentTime = JulianDate_default.now();
  30882. }
  30883. } else {
  30884. currentTime = JulianDate_default.clone(currentTime);
  30885. }
  30886. if (!defined_default(startTime)) {
  30887. startTime = JulianDate_default.clone(currentTime);
  30888. } else {
  30889. startTime = JulianDate_default.clone(startTime);
  30890. }
  30891. if (!defined_default(stopTime)) {
  30892. stopTime = JulianDate_default.addDays(startTime, 1, new JulianDate_default());
  30893. } else {
  30894. stopTime = JulianDate_default.clone(stopTime);
  30895. }
  30896. if (JulianDate_default.greaterThan(startTime, stopTime)) {
  30897. throw new DeveloperError_default("startTime must come before stopTime.");
  30898. }
  30899. this.startTime = startTime;
  30900. this.stopTime = stopTime;
  30901. this.clockRange = defaultValue_default(options.clockRange, ClockRange_default.UNBOUNDED);
  30902. this.canAnimate = defaultValue_default(options.canAnimate, true);
  30903. this.onTick = new Event_default();
  30904. this.onStop = new Event_default();
  30905. this._currentTime = void 0;
  30906. this._multiplier = void 0;
  30907. this._clockStep = void 0;
  30908. this._shouldAnimate = void 0;
  30909. this._lastSystemTime = getTimestamp_default();
  30910. this.currentTime = currentTime;
  30911. this.multiplier = defaultValue_default(options.multiplier, 1);
  30912. this.shouldAnimate = defaultValue_default(options.shouldAnimate, false);
  30913. this.clockStep = defaultValue_default(
  30914. options.clockStep,
  30915. ClockStep_default.SYSTEM_CLOCK_MULTIPLIER
  30916. );
  30917. }
  30918. Object.defineProperties(Clock.prototype, {
  30919. currentTime: {
  30920. get: function() {
  30921. return this._currentTime;
  30922. },
  30923. set: function(value) {
  30924. if (JulianDate_default.equals(this._currentTime, value)) {
  30925. return;
  30926. }
  30927. if (this._clockStep === ClockStep_default.SYSTEM_CLOCK) {
  30928. this._clockStep = ClockStep_default.SYSTEM_CLOCK_MULTIPLIER;
  30929. }
  30930. this._currentTime = value;
  30931. }
  30932. },
  30933. multiplier: {
  30934. get: function() {
  30935. return this._multiplier;
  30936. },
  30937. set: function(value) {
  30938. if (this._multiplier === value) {
  30939. return;
  30940. }
  30941. if (this._clockStep === ClockStep_default.SYSTEM_CLOCK) {
  30942. this._clockStep = ClockStep_default.SYSTEM_CLOCK_MULTIPLIER;
  30943. }
  30944. this._multiplier = value;
  30945. }
  30946. },
  30947. clockStep: {
  30948. get: function() {
  30949. return this._clockStep;
  30950. },
  30951. set: function(value) {
  30952. if (value === ClockStep_default.SYSTEM_CLOCK) {
  30953. this._multiplier = 1;
  30954. this._shouldAnimate = true;
  30955. this._currentTime = JulianDate_default.now();
  30956. }
  30957. this._clockStep = value;
  30958. }
  30959. },
  30960. shouldAnimate: {
  30961. get: function() {
  30962. return this._shouldAnimate;
  30963. },
  30964. set: function(value) {
  30965. if (this._shouldAnimate === value) {
  30966. return;
  30967. }
  30968. if (this._clockStep === ClockStep_default.SYSTEM_CLOCK) {
  30969. this._clockStep = ClockStep_default.SYSTEM_CLOCK_MULTIPLIER;
  30970. }
  30971. this._shouldAnimate = value;
  30972. }
  30973. }
  30974. });
  30975. Clock.prototype.tick = function() {
  30976. const currentSystemTime = getTimestamp_default();
  30977. let currentTime = JulianDate_default.clone(this._currentTime);
  30978. if (this.canAnimate && this._shouldAnimate) {
  30979. const clockStep = this._clockStep;
  30980. if (clockStep === ClockStep_default.SYSTEM_CLOCK) {
  30981. currentTime = JulianDate_default.now(currentTime);
  30982. } else {
  30983. const multiplier = this._multiplier;
  30984. if (clockStep === ClockStep_default.TICK_DEPENDENT) {
  30985. currentTime = JulianDate_default.addSeconds(
  30986. currentTime,
  30987. multiplier,
  30988. currentTime
  30989. );
  30990. } else {
  30991. const milliseconds = currentSystemTime - this._lastSystemTime;
  30992. currentTime = JulianDate_default.addSeconds(
  30993. currentTime,
  30994. multiplier * (milliseconds / 1e3),
  30995. currentTime
  30996. );
  30997. }
  30998. const clockRange = this.clockRange;
  30999. const startTime = this.startTime;
  31000. const stopTime = this.stopTime;
  31001. if (clockRange === ClockRange_default.CLAMPED) {
  31002. if (JulianDate_default.lessThan(currentTime, startTime)) {
  31003. currentTime = JulianDate_default.clone(startTime, currentTime);
  31004. } else if (JulianDate_default.greaterThan(currentTime, stopTime)) {
  31005. currentTime = JulianDate_default.clone(stopTime, currentTime);
  31006. this.onStop.raiseEvent(this);
  31007. }
  31008. } else if (clockRange === ClockRange_default.LOOP_STOP) {
  31009. if (JulianDate_default.lessThan(currentTime, startTime)) {
  31010. currentTime = JulianDate_default.clone(startTime, currentTime);
  31011. }
  31012. while (JulianDate_default.greaterThan(currentTime, stopTime)) {
  31013. currentTime = JulianDate_default.addSeconds(
  31014. startTime,
  31015. JulianDate_default.secondsDifference(currentTime, stopTime),
  31016. currentTime
  31017. );
  31018. this.onStop.raiseEvent(this);
  31019. }
  31020. }
  31021. }
  31022. }
  31023. this._currentTime = currentTime;
  31024. this._lastSystemTime = currentSystemTime;
  31025. this.onTick.raiseEvent(this);
  31026. return currentTime;
  31027. };
  31028. var Clock_default = Clock;
  31029. // node_modules/cesium/Source/Core/Color.js
  31030. function hue2rgb(m1, m2, h) {
  31031. if (h < 0) {
  31032. h += 1;
  31033. }
  31034. if (h > 1) {
  31035. h -= 1;
  31036. }
  31037. if (h * 6 < 1) {
  31038. return m1 + (m2 - m1) * 6 * h;
  31039. }
  31040. if (h * 2 < 1) {
  31041. return m2;
  31042. }
  31043. if (h * 3 < 2) {
  31044. return m1 + (m2 - m1) * (2 / 3 - h) * 6;
  31045. }
  31046. return m1;
  31047. }
  31048. function Color(red, green, blue, alpha) {
  31049. this.red = defaultValue_default(red, 1);
  31050. this.green = defaultValue_default(green, 1);
  31051. this.blue = defaultValue_default(blue, 1);
  31052. this.alpha = defaultValue_default(alpha, 1);
  31053. }
  31054. Color.fromCartesian4 = function(cartesian11, result) {
  31055. Check_default.typeOf.object("cartesian", cartesian11);
  31056. if (!defined_default(result)) {
  31057. return new Color(cartesian11.x, cartesian11.y, cartesian11.z, cartesian11.w);
  31058. }
  31059. result.red = cartesian11.x;
  31060. result.green = cartesian11.y;
  31061. result.blue = cartesian11.z;
  31062. result.alpha = cartesian11.w;
  31063. return result;
  31064. };
  31065. Color.fromBytes = function(red, green, blue, alpha, result) {
  31066. red = Color.byteToFloat(defaultValue_default(red, 255));
  31067. green = Color.byteToFloat(defaultValue_default(green, 255));
  31068. blue = Color.byteToFloat(defaultValue_default(blue, 255));
  31069. alpha = Color.byteToFloat(defaultValue_default(alpha, 255));
  31070. if (!defined_default(result)) {
  31071. return new Color(red, green, blue, alpha);
  31072. }
  31073. result.red = red;
  31074. result.green = green;
  31075. result.blue = blue;
  31076. result.alpha = alpha;
  31077. return result;
  31078. };
  31079. Color.fromAlpha = function(color, alpha, result) {
  31080. Check_default.typeOf.object("color", color);
  31081. Check_default.typeOf.number("alpha", alpha);
  31082. if (!defined_default(result)) {
  31083. return new Color(color.red, color.green, color.blue, alpha);
  31084. }
  31085. result.red = color.red;
  31086. result.green = color.green;
  31087. result.blue = color.blue;
  31088. result.alpha = alpha;
  31089. return result;
  31090. };
  31091. var scratchArrayBuffer;
  31092. var scratchUint32Array;
  31093. var scratchUint8Array;
  31094. if (FeatureDetection_default.supportsTypedArrays()) {
  31095. scratchArrayBuffer = new ArrayBuffer(4);
  31096. scratchUint32Array = new Uint32Array(scratchArrayBuffer);
  31097. scratchUint8Array = new Uint8Array(scratchArrayBuffer);
  31098. }
  31099. Color.fromRgba = function(rgba, result) {
  31100. scratchUint32Array[0] = rgba;
  31101. return Color.fromBytes(
  31102. scratchUint8Array[0],
  31103. scratchUint8Array[1],
  31104. scratchUint8Array[2],
  31105. scratchUint8Array[3],
  31106. result
  31107. );
  31108. };
  31109. Color.fromHsl = function(hue, saturation, lightness, alpha, result) {
  31110. hue = defaultValue_default(hue, 0) % 1;
  31111. saturation = defaultValue_default(saturation, 0);
  31112. lightness = defaultValue_default(lightness, 0);
  31113. alpha = defaultValue_default(alpha, 1);
  31114. let red = lightness;
  31115. let green = lightness;
  31116. let blue = lightness;
  31117. if (saturation !== 0) {
  31118. let m2;
  31119. if (lightness < 0.5) {
  31120. m2 = lightness * (1 + saturation);
  31121. } else {
  31122. m2 = lightness + saturation - lightness * saturation;
  31123. }
  31124. const m1 = 2 * lightness - m2;
  31125. red = hue2rgb(m1, m2, hue + 1 / 3);
  31126. green = hue2rgb(m1, m2, hue);
  31127. blue = hue2rgb(m1, m2, hue - 1 / 3);
  31128. }
  31129. if (!defined_default(result)) {
  31130. return new Color(red, green, blue, alpha);
  31131. }
  31132. result.red = red;
  31133. result.green = green;
  31134. result.blue = blue;
  31135. result.alpha = alpha;
  31136. return result;
  31137. };
  31138. Color.fromRandom = function(options, result) {
  31139. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  31140. let red = options.red;
  31141. if (!defined_default(red)) {
  31142. const minimumRed = defaultValue_default(options.minimumRed, 0);
  31143. const maximumRed = defaultValue_default(options.maximumRed, 1);
  31144. Check_default.typeOf.number.lessThanOrEquals("minimumRed", minimumRed, maximumRed);
  31145. red = minimumRed + Math_default.nextRandomNumber() * (maximumRed - minimumRed);
  31146. }
  31147. let green = options.green;
  31148. if (!defined_default(green)) {
  31149. const minimumGreen = defaultValue_default(options.minimumGreen, 0);
  31150. const maximumGreen = defaultValue_default(options.maximumGreen, 1);
  31151. Check_default.typeOf.number.lessThanOrEquals(
  31152. "minimumGreen",
  31153. minimumGreen,
  31154. maximumGreen
  31155. );
  31156. green = minimumGreen + Math_default.nextRandomNumber() * (maximumGreen - minimumGreen);
  31157. }
  31158. let blue = options.blue;
  31159. if (!defined_default(blue)) {
  31160. const minimumBlue = defaultValue_default(options.minimumBlue, 0);
  31161. const maximumBlue = defaultValue_default(options.maximumBlue, 1);
  31162. Check_default.typeOf.number.lessThanOrEquals(
  31163. "minimumBlue",
  31164. minimumBlue,
  31165. maximumBlue
  31166. );
  31167. blue = minimumBlue + Math_default.nextRandomNumber() * (maximumBlue - minimumBlue);
  31168. }
  31169. let alpha = options.alpha;
  31170. if (!defined_default(alpha)) {
  31171. const minimumAlpha = defaultValue_default(options.minimumAlpha, 0);
  31172. const maximumAlpha = defaultValue_default(options.maximumAlpha, 1);
  31173. Check_default.typeOf.number.lessThanOrEquals(
  31174. "minumumAlpha",
  31175. minimumAlpha,
  31176. maximumAlpha
  31177. );
  31178. alpha = minimumAlpha + Math_default.nextRandomNumber() * (maximumAlpha - minimumAlpha);
  31179. }
  31180. if (!defined_default(result)) {
  31181. return new Color(red, green, blue, alpha);
  31182. }
  31183. result.red = red;
  31184. result.green = green;
  31185. result.blue = blue;
  31186. result.alpha = alpha;
  31187. return result;
  31188. };
  31189. var rgbaMatcher = /^#([0-9a-f])([0-9a-f])([0-9a-f])([0-9a-f])?$/i;
  31190. var rrggbbaaMatcher = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})?$/i;
  31191. var rgbParenthesesMatcher = /^rgba?\(\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)(?:\s*,\s*([0-9.]+))?\s*\)$/i;
  31192. var hslParenthesesMatcher = /^hsla?\(\s*([0-9.]+)\s*,\s*([0-9.]+%)\s*,\s*([0-9.]+%)(?:\s*,\s*([0-9.]+))?\s*\)$/i;
  31193. Color.fromCssColorString = function(color, result) {
  31194. Check_default.typeOf.string("color", color);
  31195. if (!defined_default(result)) {
  31196. result = new Color();
  31197. }
  31198. color = color.replace(/\s/g, "");
  31199. const namedColor = Color[color.toUpperCase()];
  31200. if (defined_default(namedColor)) {
  31201. Color.clone(namedColor, result);
  31202. return result;
  31203. }
  31204. let matches = rgbaMatcher.exec(color);
  31205. if (matches !== null) {
  31206. result.red = parseInt(matches[1], 16) / 15;
  31207. result.green = parseInt(matches[2], 16) / 15;
  31208. result.blue = parseInt(matches[3], 16) / 15;
  31209. result.alpha = parseInt(defaultValue_default(matches[4], "f"), 16) / 15;
  31210. return result;
  31211. }
  31212. matches = rrggbbaaMatcher.exec(color);
  31213. if (matches !== null) {
  31214. result.red = parseInt(matches[1], 16) / 255;
  31215. result.green = parseInt(matches[2], 16) / 255;
  31216. result.blue = parseInt(matches[3], 16) / 255;
  31217. result.alpha = parseInt(defaultValue_default(matches[4], "ff"), 16) / 255;
  31218. return result;
  31219. }
  31220. matches = rgbParenthesesMatcher.exec(color);
  31221. if (matches !== null) {
  31222. result.red = parseFloat(matches[1]) / ("%" === matches[1].substr(-1) ? 100 : 255);
  31223. result.green = parseFloat(matches[2]) / ("%" === matches[2].substr(-1) ? 100 : 255);
  31224. result.blue = parseFloat(matches[3]) / ("%" === matches[3].substr(-1) ? 100 : 255);
  31225. result.alpha = parseFloat(defaultValue_default(matches[4], "1.0"));
  31226. return result;
  31227. }
  31228. matches = hslParenthesesMatcher.exec(color);
  31229. if (matches !== null) {
  31230. return Color.fromHsl(
  31231. parseFloat(matches[1]) / 360,
  31232. parseFloat(matches[2]) / 100,
  31233. parseFloat(matches[3]) / 100,
  31234. parseFloat(defaultValue_default(matches[4], "1.0")),
  31235. result
  31236. );
  31237. }
  31238. result = void 0;
  31239. return result;
  31240. };
  31241. Color.packedLength = 4;
  31242. Color.pack = function(value, array, startingIndex) {
  31243. Check_default.typeOf.object("value", value);
  31244. Check_default.defined("array", array);
  31245. startingIndex = defaultValue_default(startingIndex, 0);
  31246. array[startingIndex++] = value.red;
  31247. array[startingIndex++] = value.green;
  31248. array[startingIndex++] = value.blue;
  31249. array[startingIndex] = value.alpha;
  31250. return array;
  31251. };
  31252. Color.unpack = function(array, startingIndex, result) {
  31253. Check_default.defined("array", array);
  31254. startingIndex = defaultValue_default(startingIndex, 0);
  31255. if (!defined_default(result)) {
  31256. result = new Color();
  31257. }
  31258. result.red = array[startingIndex++];
  31259. result.green = array[startingIndex++];
  31260. result.blue = array[startingIndex++];
  31261. result.alpha = array[startingIndex];
  31262. return result;
  31263. };
  31264. Color.byteToFloat = function(number) {
  31265. return number / 255;
  31266. };
  31267. Color.floatToByte = function(number) {
  31268. return number === 1 ? 255 : number * 256 | 0;
  31269. };
  31270. Color.clone = function(color, result) {
  31271. if (!defined_default(color)) {
  31272. return void 0;
  31273. }
  31274. if (!defined_default(result)) {
  31275. return new Color(color.red, color.green, color.blue, color.alpha);
  31276. }
  31277. result.red = color.red;
  31278. result.green = color.green;
  31279. result.blue = color.blue;
  31280. result.alpha = color.alpha;
  31281. return result;
  31282. };
  31283. Color.equals = function(left, right) {
  31284. return left === right || defined_default(left) && defined_default(right) && left.red === right.red && left.green === right.green && left.blue === right.blue && left.alpha === right.alpha;
  31285. };
  31286. Color.equalsArray = function(color, array, offset2) {
  31287. return color.red === array[offset2] && color.green === array[offset2 + 1] && color.blue === array[offset2 + 2] && color.alpha === array[offset2 + 3];
  31288. };
  31289. Color.prototype.clone = function(result) {
  31290. return Color.clone(this, result);
  31291. };
  31292. Color.prototype.equals = function(other) {
  31293. return Color.equals(this, other);
  31294. };
  31295. Color.prototype.equalsEpsilon = function(other, epsilon) {
  31296. return this === other || defined_default(other) && Math.abs(this.red - other.red) <= epsilon && Math.abs(this.green - other.green) <= epsilon && Math.abs(this.blue - other.blue) <= epsilon && Math.abs(this.alpha - other.alpha) <= epsilon;
  31297. };
  31298. Color.prototype.toString = function() {
  31299. return `(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;
  31300. };
  31301. Color.prototype.toCssColorString = function() {
  31302. const red = Color.floatToByte(this.red);
  31303. const green = Color.floatToByte(this.green);
  31304. const blue = Color.floatToByte(this.blue);
  31305. if (this.alpha === 1) {
  31306. return `rgb(${red},${green},${blue})`;
  31307. }
  31308. return `rgba(${red},${green},${blue},${this.alpha})`;
  31309. };
  31310. Color.prototype.toCssHexString = function() {
  31311. let r2 = Color.floatToByte(this.red).toString(16);
  31312. if (r2.length < 2) {
  31313. r2 = `0${r2}`;
  31314. }
  31315. let g = Color.floatToByte(this.green).toString(16);
  31316. if (g.length < 2) {
  31317. g = `0${g}`;
  31318. }
  31319. let b = Color.floatToByte(this.blue).toString(16);
  31320. if (b.length < 2) {
  31321. b = `0${b}`;
  31322. }
  31323. if (this.alpha < 1) {
  31324. let hexAlpha = Color.floatToByte(this.alpha).toString(16);
  31325. if (hexAlpha.length < 2) {
  31326. hexAlpha = `0${hexAlpha}`;
  31327. }
  31328. return `#${r2}${g}${b}${hexAlpha}`;
  31329. }
  31330. return `#${r2}${g}${b}`;
  31331. };
  31332. Color.prototype.toBytes = function(result) {
  31333. const red = Color.floatToByte(this.red);
  31334. const green = Color.floatToByte(this.green);
  31335. const blue = Color.floatToByte(this.blue);
  31336. const alpha = Color.floatToByte(this.alpha);
  31337. if (!defined_default(result)) {
  31338. return [red, green, blue, alpha];
  31339. }
  31340. result[0] = red;
  31341. result[1] = green;
  31342. result[2] = blue;
  31343. result[3] = alpha;
  31344. return result;
  31345. };
  31346. Color.prototype.toRgba = function() {
  31347. scratchUint8Array[0] = Color.floatToByte(this.red);
  31348. scratchUint8Array[1] = Color.floatToByte(this.green);
  31349. scratchUint8Array[2] = Color.floatToByte(this.blue);
  31350. scratchUint8Array[3] = Color.floatToByte(this.alpha);
  31351. return scratchUint32Array[0];
  31352. };
  31353. Color.prototype.brighten = function(magnitude, result) {
  31354. Check_default.typeOf.number("magnitude", magnitude);
  31355. Check_default.typeOf.number.greaterThanOrEquals("magnitude", magnitude, 0);
  31356. Check_default.typeOf.object("result", result);
  31357. magnitude = 1 - magnitude;
  31358. result.red = 1 - (1 - this.red) * magnitude;
  31359. result.green = 1 - (1 - this.green) * magnitude;
  31360. result.blue = 1 - (1 - this.blue) * magnitude;
  31361. result.alpha = this.alpha;
  31362. return result;
  31363. };
  31364. Color.prototype.darken = function(magnitude, result) {
  31365. Check_default.typeOf.number("magnitude", magnitude);
  31366. Check_default.typeOf.number.greaterThanOrEquals("magnitude", magnitude, 0);
  31367. Check_default.typeOf.object("result", result);
  31368. magnitude = 1 - magnitude;
  31369. result.red = this.red * magnitude;
  31370. result.green = this.green * magnitude;
  31371. result.blue = this.blue * magnitude;
  31372. result.alpha = this.alpha;
  31373. return result;
  31374. };
  31375. Color.prototype.withAlpha = function(alpha, result) {
  31376. return Color.fromAlpha(this, alpha, result);
  31377. };
  31378. Color.add = function(left, right, result) {
  31379. Check_default.typeOf.object("left", left);
  31380. Check_default.typeOf.object("right", right);
  31381. Check_default.typeOf.object("result", result);
  31382. result.red = left.red + right.red;
  31383. result.green = left.green + right.green;
  31384. result.blue = left.blue + right.blue;
  31385. result.alpha = left.alpha + right.alpha;
  31386. return result;
  31387. };
  31388. Color.subtract = function(left, right, result) {
  31389. Check_default.typeOf.object("left", left);
  31390. Check_default.typeOf.object("right", right);
  31391. Check_default.typeOf.object("result", result);
  31392. result.red = left.red - right.red;
  31393. result.green = left.green - right.green;
  31394. result.blue = left.blue - right.blue;
  31395. result.alpha = left.alpha - right.alpha;
  31396. return result;
  31397. };
  31398. Color.multiply = function(left, right, result) {
  31399. Check_default.typeOf.object("left", left);
  31400. Check_default.typeOf.object("right", right);
  31401. Check_default.typeOf.object("result", result);
  31402. result.red = left.red * right.red;
  31403. result.green = left.green * right.green;
  31404. result.blue = left.blue * right.blue;
  31405. result.alpha = left.alpha * right.alpha;
  31406. return result;
  31407. };
  31408. Color.divide = function(left, right, result) {
  31409. Check_default.typeOf.object("left", left);
  31410. Check_default.typeOf.object("right", right);
  31411. Check_default.typeOf.object("result", result);
  31412. result.red = left.red / right.red;
  31413. result.green = left.green / right.green;
  31414. result.blue = left.blue / right.blue;
  31415. result.alpha = left.alpha / right.alpha;
  31416. return result;
  31417. };
  31418. Color.mod = function(left, right, result) {
  31419. Check_default.typeOf.object("left", left);
  31420. Check_default.typeOf.object("right", right);
  31421. Check_default.typeOf.object("result", result);
  31422. result.red = left.red % right.red;
  31423. result.green = left.green % right.green;
  31424. result.blue = left.blue % right.blue;
  31425. result.alpha = left.alpha % right.alpha;
  31426. return result;
  31427. };
  31428. Color.lerp = function(start, end, t, result) {
  31429. Check_default.typeOf.object("start", start);
  31430. Check_default.typeOf.object("end", end);
  31431. Check_default.typeOf.number("t", t);
  31432. Check_default.typeOf.object("result", result);
  31433. result.red = Math_default.lerp(start.red, end.red, t);
  31434. result.green = Math_default.lerp(start.green, end.green, t);
  31435. result.blue = Math_default.lerp(start.blue, end.blue, t);
  31436. result.alpha = Math_default.lerp(start.alpha, end.alpha, t);
  31437. return result;
  31438. };
  31439. Color.multiplyByScalar = function(color, scalar, result) {
  31440. Check_default.typeOf.object("color", color);
  31441. Check_default.typeOf.number("scalar", scalar);
  31442. Check_default.typeOf.object("result", result);
  31443. result.red = color.red * scalar;
  31444. result.green = color.green * scalar;
  31445. result.blue = color.blue * scalar;
  31446. result.alpha = color.alpha * scalar;
  31447. return result;
  31448. };
  31449. Color.divideByScalar = function(color, scalar, result) {
  31450. Check_default.typeOf.object("color", color);
  31451. Check_default.typeOf.number("scalar", scalar);
  31452. Check_default.typeOf.object("result", result);
  31453. result.red = color.red / scalar;
  31454. result.green = color.green / scalar;
  31455. result.blue = color.blue / scalar;
  31456. result.alpha = color.alpha / scalar;
  31457. return result;
  31458. };
  31459. Color.ALICEBLUE = Object.freeze(Color.fromCssColorString("#F0F8FF"));
  31460. Color.ANTIQUEWHITE = Object.freeze(Color.fromCssColorString("#FAEBD7"));
  31461. Color.AQUA = Object.freeze(Color.fromCssColorString("#00FFFF"));
  31462. Color.AQUAMARINE = Object.freeze(Color.fromCssColorString("#7FFFD4"));
  31463. Color.AZURE = Object.freeze(Color.fromCssColorString("#F0FFFF"));
  31464. Color.BEIGE = Object.freeze(Color.fromCssColorString("#F5F5DC"));
  31465. Color.BISQUE = Object.freeze(Color.fromCssColorString("#FFE4C4"));
  31466. Color.BLACK = Object.freeze(Color.fromCssColorString("#000000"));
  31467. Color.BLANCHEDALMOND = Object.freeze(Color.fromCssColorString("#FFEBCD"));
  31468. Color.BLUE = Object.freeze(Color.fromCssColorString("#0000FF"));
  31469. Color.BLUEVIOLET = Object.freeze(Color.fromCssColorString("#8A2BE2"));
  31470. Color.BROWN = Object.freeze(Color.fromCssColorString("#A52A2A"));
  31471. Color.BURLYWOOD = Object.freeze(Color.fromCssColorString("#DEB887"));
  31472. Color.CADETBLUE = Object.freeze(Color.fromCssColorString("#5F9EA0"));
  31473. Color.CHARTREUSE = Object.freeze(Color.fromCssColorString("#7FFF00"));
  31474. Color.CHOCOLATE = Object.freeze(Color.fromCssColorString("#D2691E"));
  31475. Color.CORAL = Object.freeze(Color.fromCssColorString("#FF7F50"));
  31476. Color.CORNFLOWERBLUE = Object.freeze(Color.fromCssColorString("#6495ED"));
  31477. Color.CORNSILK = Object.freeze(Color.fromCssColorString("#FFF8DC"));
  31478. Color.CRIMSON = Object.freeze(Color.fromCssColorString("#DC143C"));
  31479. Color.CYAN = Object.freeze(Color.fromCssColorString("#00FFFF"));
  31480. Color.DARKBLUE = Object.freeze(Color.fromCssColorString("#00008B"));
  31481. Color.DARKCYAN = Object.freeze(Color.fromCssColorString("#008B8B"));
  31482. Color.DARKGOLDENROD = Object.freeze(Color.fromCssColorString("#B8860B"));
  31483. Color.DARKGRAY = Object.freeze(Color.fromCssColorString("#A9A9A9"));
  31484. Color.DARKGREEN = Object.freeze(Color.fromCssColorString("#006400"));
  31485. Color.DARKGREY = Color.DARKGRAY;
  31486. Color.DARKKHAKI = Object.freeze(Color.fromCssColorString("#BDB76B"));
  31487. Color.DARKMAGENTA = Object.freeze(Color.fromCssColorString("#8B008B"));
  31488. Color.DARKOLIVEGREEN = Object.freeze(Color.fromCssColorString("#556B2F"));
  31489. Color.DARKORANGE = Object.freeze(Color.fromCssColorString("#FF8C00"));
  31490. Color.DARKORCHID = Object.freeze(Color.fromCssColorString("#9932CC"));
  31491. Color.DARKRED = Object.freeze(Color.fromCssColorString("#8B0000"));
  31492. Color.DARKSALMON = Object.freeze(Color.fromCssColorString("#E9967A"));
  31493. Color.DARKSEAGREEN = Object.freeze(Color.fromCssColorString("#8FBC8F"));
  31494. Color.DARKSLATEBLUE = Object.freeze(Color.fromCssColorString("#483D8B"));
  31495. Color.DARKSLATEGRAY = Object.freeze(Color.fromCssColorString("#2F4F4F"));
  31496. Color.DARKSLATEGREY = Color.DARKSLATEGRAY;
  31497. Color.DARKTURQUOISE = Object.freeze(Color.fromCssColorString("#00CED1"));
  31498. Color.DARKVIOLET = Object.freeze(Color.fromCssColorString("#9400D3"));
  31499. Color.DEEPPINK = Object.freeze(Color.fromCssColorString("#FF1493"));
  31500. Color.DEEPSKYBLUE = Object.freeze(Color.fromCssColorString("#00BFFF"));
  31501. Color.DIMGRAY = Object.freeze(Color.fromCssColorString("#696969"));
  31502. Color.DIMGREY = Color.DIMGRAY;
  31503. Color.DODGERBLUE = Object.freeze(Color.fromCssColorString("#1E90FF"));
  31504. Color.FIREBRICK = Object.freeze(Color.fromCssColorString("#B22222"));
  31505. Color.FLORALWHITE = Object.freeze(Color.fromCssColorString("#FFFAF0"));
  31506. Color.FORESTGREEN = Object.freeze(Color.fromCssColorString("#228B22"));
  31507. Color.FUCHSIA = Object.freeze(Color.fromCssColorString("#FF00FF"));
  31508. Color.GAINSBORO = Object.freeze(Color.fromCssColorString("#DCDCDC"));
  31509. Color.GHOSTWHITE = Object.freeze(Color.fromCssColorString("#F8F8FF"));
  31510. Color.GOLD = Object.freeze(Color.fromCssColorString("#FFD700"));
  31511. Color.GOLDENROD = Object.freeze(Color.fromCssColorString("#DAA520"));
  31512. Color.GRAY = Object.freeze(Color.fromCssColorString("#808080"));
  31513. Color.GREEN = Object.freeze(Color.fromCssColorString("#008000"));
  31514. Color.GREENYELLOW = Object.freeze(Color.fromCssColorString("#ADFF2F"));
  31515. Color.GREY = Color.GRAY;
  31516. Color.HONEYDEW = Object.freeze(Color.fromCssColorString("#F0FFF0"));
  31517. Color.HOTPINK = Object.freeze(Color.fromCssColorString("#FF69B4"));
  31518. Color.INDIANRED = Object.freeze(Color.fromCssColorString("#CD5C5C"));
  31519. Color.INDIGO = Object.freeze(Color.fromCssColorString("#4B0082"));
  31520. Color.IVORY = Object.freeze(Color.fromCssColorString("#FFFFF0"));
  31521. Color.KHAKI = Object.freeze(Color.fromCssColorString("#F0E68C"));
  31522. Color.LAVENDER = Object.freeze(Color.fromCssColorString("#E6E6FA"));
  31523. Color.LAVENDAR_BLUSH = Object.freeze(Color.fromCssColorString("#FFF0F5"));
  31524. Color.LAWNGREEN = Object.freeze(Color.fromCssColorString("#7CFC00"));
  31525. Color.LEMONCHIFFON = Object.freeze(Color.fromCssColorString("#FFFACD"));
  31526. Color.LIGHTBLUE = Object.freeze(Color.fromCssColorString("#ADD8E6"));
  31527. Color.LIGHTCORAL = Object.freeze(Color.fromCssColorString("#F08080"));
  31528. Color.LIGHTCYAN = Object.freeze(Color.fromCssColorString("#E0FFFF"));
  31529. Color.LIGHTGOLDENRODYELLOW = Object.freeze(Color.fromCssColorString("#FAFAD2"));
  31530. Color.LIGHTGRAY = Object.freeze(Color.fromCssColorString("#D3D3D3"));
  31531. Color.LIGHTGREEN = Object.freeze(Color.fromCssColorString("#90EE90"));
  31532. Color.LIGHTGREY = Color.LIGHTGRAY;
  31533. Color.LIGHTPINK = Object.freeze(Color.fromCssColorString("#FFB6C1"));
  31534. Color.LIGHTSEAGREEN = Object.freeze(Color.fromCssColorString("#20B2AA"));
  31535. Color.LIGHTSKYBLUE = Object.freeze(Color.fromCssColorString("#87CEFA"));
  31536. Color.LIGHTSLATEGRAY = Object.freeze(Color.fromCssColorString("#778899"));
  31537. Color.LIGHTSLATEGREY = Color.LIGHTSLATEGRAY;
  31538. Color.LIGHTSTEELBLUE = Object.freeze(Color.fromCssColorString("#B0C4DE"));
  31539. Color.LIGHTYELLOW = Object.freeze(Color.fromCssColorString("#FFFFE0"));
  31540. Color.LIME = Object.freeze(Color.fromCssColorString("#00FF00"));
  31541. Color.LIMEGREEN = Object.freeze(Color.fromCssColorString("#32CD32"));
  31542. Color.LINEN = Object.freeze(Color.fromCssColorString("#FAF0E6"));
  31543. Color.MAGENTA = Object.freeze(Color.fromCssColorString("#FF00FF"));
  31544. Color.MAROON = Object.freeze(Color.fromCssColorString("#800000"));
  31545. Color.MEDIUMAQUAMARINE = Object.freeze(Color.fromCssColorString("#66CDAA"));
  31546. Color.MEDIUMBLUE = Object.freeze(Color.fromCssColorString("#0000CD"));
  31547. Color.MEDIUMORCHID = Object.freeze(Color.fromCssColorString("#BA55D3"));
  31548. Color.MEDIUMPURPLE = Object.freeze(Color.fromCssColorString("#9370DB"));
  31549. Color.MEDIUMSEAGREEN = Object.freeze(Color.fromCssColorString("#3CB371"));
  31550. Color.MEDIUMSLATEBLUE = Object.freeze(Color.fromCssColorString("#7B68EE"));
  31551. Color.MEDIUMSPRINGGREEN = Object.freeze(Color.fromCssColorString("#00FA9A"));
  31552. Color.MEDIUMTURQUOISE = Object.freeze(Color.fromCssColorString("#48D1CC"));
  31553. Color.MEDIUMVIOLETRED = Object.freeze(Color.fromCssColorString("#C71585"));
  31554. Color.MIDNIGHTBLUE = Object.freeze(Color.fromCssColorString("#191970"));
  31555. Color.MINTCREAM = Object.freeze(Color.fromCssColorString("#F5FFFA"));
  31556. Color.MISTYROSE = Object.freeze(Color.fromCssColorString("#FFE4E1"));
  31557. Color.MOCCASIN = Object.freeze(Color.fromCssColorString("#FFE4B5"));
  31558. Color.NAVAJOWHITE = Object.freeze(Color.fromCssColorString("#FFDEAD"));
  31559. Color.NAVY = Object.freeze(Color.fromCssColorString("#000080"));
  31560. Color.OLDLACE = Object.freeze(Color.fromCssColorString("#FDF5E6"));
  31561. Color.OLIVE = Object.freeze(Color.fromCssColorString("#808000"));
  31562. Color.OLIVEDRAB = Object.freeze(Color.fromCssColorString("#6B8E23"));
  31563. Color.ORANGE = Object.freeze(Color.fromCssColorString("#FFA500"));
  31564. Color.ORANGERED = Object.freeze(Color.fromCssColorString("#FF4500"));
  31565. Color.ORCHID = Object.freeze(Color.fromCssColorString("#DA70D6"));
  31566. Color.PALEGOLDENROD = Object.freeze(Color.fromCssColorString("#EEE8AA"));
  31567. Color.PALEGREEN = Object.freeze(Color.fromCssColorString("#98FB98"));
  31568. Color.PALETURQUOISE = Object.freeze(Color.fromCssColorString("#AFEEEE"));
  31569. Color.PALEVIOLETRED = Object.freeze(Color.fromCssColorString("#DB7093"));
  31570. Color.PAPAYAWHIP = Object.freeze(Color.fromCssColorString("#FFEFD5"));
  31571. Color.PEACHPUFF = Object.freeze(Color.fromCssColorString("#FFDAB9"));
  31572. Color.PERU = Object.freeze(Color.fromCssColorString("#CD853F"));
  31573. Color.PINK = Object.freeze(Color.fromCssColorString("#FFC0CB"));
  31574. Color.PLUM = Object.freeze(Color.fromCssColorString("#DDA0DD"));
  31575. Color.POWDERBLUE = Object.freeze(Color.fromCssColorString("#B0E0E6"));
  31576. Color.PURPLE = Object.freeze(Color.fromCssColorString("#800080"));
  31577. Color.RED = Object.freeze(Color.fromCssColorString("#FF0000"));
  31578. Color.ROSYBROWN = Object.freeze(Color.fromCssColorString("#BC8F8F"));
  31579. Color.ROYALBLUE = Object.freeze(Color.fromCssColorString("#4169E1"));
  31580. Color.SADDLEBROWN = Object.freeze(Color.fromCssColorString("#8B4513"));
  31581. Color.SALMON = Object.freeze(Color.fromCssColorString("#FA8072"));
  31582. Color.SANDYBROWN = Object.freeze(Color.fromCssColorString("#F4A460"));
  31583. Color.SEAGREEN = Object.freeze(Color.fromCssColorString("#2E8B57"));
  31584. Color.SEASHELL = Object.freeze(Color.fromCssColorString("#FFF5EE"));
  31585. Color.SIENNA = Object.freeze(Color.fromCssColorString("#A0522D"));
  31586. Color.SILVER = Object.freeze(Color.fromCssColorString("#C0C0C0"));
  31587. Color.SKYBLUE = Object.freeze(Color.fromCssColorString("#87CEEB"));
  31588. Color.SLATEBLUE = Object.freeze(Color.fromCssColorString("#6A5ACD"));
  31589. Color.SLATEGRAY = Object.freeze(Color.fromCssColorString("#708090"));
  31590. Color.SLATEGREY = Color.SLATEGRAY;
  31591. Color.SNOW = Object.freeze(Color.fromCssColorString("#FFFAFA"));
  31592. Color.SPRINGGREEN = Object.freeze(Color.fromCssColorString("#00FF7F"));
  31593. Color.STEELBLUE = Object.freeze(Color.fromCssColorString("#4682B4"));
  31594. Color.TAN = Object.freeze(Color.fromCssColorString("#D2B48C"));
  31595. Color.TEAL = Object.freeze(Color.fromCssColorString("#008080"));
  31596. Color.THISTLE = Object.freeze(Color.fromCssColorString("#D8BFD8"));
  31597. Color.TOMATO = Object.freeze(Color.fromCssColorString("#FF6347"));
  31598. Color.TURQUOISE = Object.freeze(Color.fromCssColorString("#40E0D0"));
  31599. Color.VIOLET = Object.freeze(Color.fromCssColorString("#EE82EE"));
  31600. Color.WHEAT = Object.freeze(Color.fromCssColorString("#F5DEB3"));
  31601. Color.WHITE = Object.freeze(Color.fromCssColorString("#FFFFFF"));
  31602. Color.WHITESMOKE = Object.freeze(Color.fromCssColorString("#F5F5F5"));
  31603. Color.YELLOW = Object.freeze(Color.fromCssColorString("#FFFF00"));
  31604. Color.YELLOWGREEN = Object.freeze(Color.fromCssColorString("#9ACD32"));
  31605. Color.TRANSPARENT = Object.freeze(new Color(0, 0, 0, 0));
  31606. var Color_default = Color;
  31607. // node_modules/cesium/Source/Core/ColorGeometryInstanceAttribute.js
  31608. function ColorGeometryInstanceAttribute(red, green, blue, alpha) {
  31609. red = defaultValue_default(red, 1);
  31610. green = defaultValue_default(green, 1);
  31611. blue = defaultValue_default(blue, 1);
  31612. alpha = defaultValue_default(alpha, 1);
  31613. this.value = new Uint8Array([
  31614. Color_default.floatToByte(red),
  31615. Color_default.floatToByte(green),
  31616. Color_default.floatToByte(blue),
  31617. Color_default.floatToByte(alpha)
  31618. ]);
  31619. }
  31620. Object.defineProperties(ColorGeometryInstanceAttribute.prototype, {
  31621. componentDatatype: {
  31622. get: function() {
  31623. return ComponentDatatype_default.UNSIGNED_BYTE;
  31624. }
  31625. },
  31626. componentsPerAttribute: {
  31627. get: function() {
  31628. return 4;
  31629. }
  31630. },
  31631. normalize: {
  31632. get: function() {
  31633. return true;
  31634. }
  31635. }
  31636. });
  31637. ColorGeometryInstanceAttribute.fromColor = function(color) {
  31638. if (!defined_default(color)) {
  31639. throw new DeveloperError_default("color is required.");
  31640. }
  31641. return new ColorGeometryInstanceAttribute(
  31642. color.red,
  31643. color.green,
  31644. color.blue,
  31645. color.alpha
  31646. );
  31647. };
  31648. ColorGeometryInstanceAttribute.toValue = function(color, result) {
  31649. if (!defined_default(color)) {
  31650. throw new DeveloperError_default("color is required.");
  31651. }
  31652. if (!defined_default(result)) {
  31653. return new Uint8Array(color.toBytes());
  31654. }
  31655. return color.toBytes(result);
  31656. };
  31657. ColorGeometryInstanceAttribute.equals = function(left, right) {
  31658. return left === right || defined_default(left) && defined_default(right) && left.value[0] === right.value[0] && left.value[1] === right.value[1] && left.value[2] === right.value[2] && left.value[3] === right.value[3];
  31659. };
  31660. var ColorGeometryInstanceAttribute_default = ColorGeometryInstanceAttribute;
  31661. // node_modules/cesium/Source/Core/CompressedTextureBuffer.js
  31662. function CompressedTextureBuffer(internalFormat, pixelDatatype, width, height, buffer) {
  31663. this._format = internalFormat;
  31664. this._datatype = pixelDatatype;
  31665. this._width = width;
  31666. this._height = height;
  31667. this._buffer = buffer;
  31668. }
  31669. Object.defineProperties(CompressedTextureBuffer.prototype, {
  31670. internalFormat: {
  31671. get: function() {
  31672. return this._format;
  31673. }
  31674. },
  31675. pixelDatatype: {
  31676. get: function() {
  31677. return this._datatype;
  31678. }
  31679. },
  31680. width: {
  31681. get: function() {
  31682. return this._width;
  31683. }
  31684. },
  31685. height: {
  31686. get: function() {
  31687. return this._height;
  31688. }
  31689. },
  31690. bufferView: {
  31691. get: function() {
  31692. return this._buffer;
  31693. }
  31694. }
  31695. });
  31696. CompressedTextureBuffer.clone = function(object2) {
  31697. if (!defined_default(object2)) {
  31698. return void 0;
  31699. }
  31700. return new CompressedTextureBuffer(
  31701. object2._format,
  31702. object2._datatype,
  31703. object2._width,
  31704. object2._height,
  31705. object2._buffer
  31706. );
  31707. };
  31708. CompressedTextureBuffer.prototype.clone = function() {
  31709. return CompressedTextureBuffer.clone(this);
  31710. };
  31711. var CompressedTextureBuffer_default = CompressedTextureBuffer;
  31712. // node_modules/cesium/Source/Core/ConstantSpline.js
  31713. function ConstantSpline(value) {
  31714. this._value = value;
  31715. this._valueType = Spline_default.getPointType(value);
  31716. }
  31717. Object.defineProperties(ConstantSpline.prototype, {
  31718. value: {
  31719. get: function() {
  31720. return this._value;
  31721. }
  31722. }
  31723. });
  31724. ConstantSpline.prototype.findTimeInterval = function(time) {
  31725. throw new DeveloperError_default(
  31726. "findTimeInterval cannot be called on a ConstantSpline."
  31727. );
  31728. };
  31729. ConstantSpline.prototype.wrapTime = function(time) {
  31730. Check_default.typeOf.number("time", time);
  31731. return 0;
  31732. };
  31733. ConstantSpline.prototype.clampTime = function(time) {
  31734. Check_default.typeOf.number("time", time);
  31735. return 0;
  31736. };
  31737. ConstantSpline.prototype.evaluate = function(time, result) {
  31738. Check_default.typeOf.number("time", time);
  31739. const value = this._value;
  31740. const ValueType = this._valueType;
  31741. if (ValueType === Number) {
  31742. return value;
  31743. }
  31744. return ValueType.clone(value, result);
  31745. };
  31746. var ConstantSpline_default = ConstantSpline;
  31747. // node_modules/cesium/Source/Core/arrayRemoveDuplicates.js
  31748. var removeDuplicatesEpsilon = Math_default.EPSILON10;
  31749. function arrayRemoveDuplicates(values, equalsEpsilon, wrapAround, removedIndices) {
  31750. Check_default.defined("equalsEpsilon", equalsEpsilon);
  31751. if (!defined_default(values)) {
  31752. return void 0;
  31753. }
  31754. wrapAround = defaultValue_default(wrapAround, false);
  31755. const storeRemovedIndices = defined_default(removedIndices);
  31756. const length3 = values.length;
  31757. if (length3 < 2) {
  31758. return values;
  31759. }
  31760. let i2;
  31761. let v02 = values[0];
  31762. let v13;
  31763. let cleanedValues;
  31764. let lastCleanIndex = 0;
  31765. let removedIndexLCI = -1;
  31766. for (i2 = 1; i2 < length3; ++i2) {
  31767. v13 = values[i2];
  31768. if (equalsEpsilon(v02, v13, removeDuplicatesEpsilon)) {
  31769. if (!defined_default(cleanedValues)) {
  31770. cleanedValues = values.slice(0, i2);
  31771. lastCleanIndex = i2 - 1;
  31772. removedIndexLCI = 0;
  31773. }
  31774. if (storeRemovedIndices) {
  31775. removedIndices.push(i2);
  31776. }
  31777. } else {
  31778. if (defined_default(cleanedValues)) {
  31779. cleanedValues.push(v13);
  31780. lastCleanIndex = i2;
  31781. if (storeRemovedIndices) {
  31782. removedIndexLCI = removedIndices.length;
  31783. }
  31784. }
  31785. v02 = v13;
  31786. }
  31787. }
  31788. if (wrapAround && equalsEpsilon(values[0], values[length3 - 1], removeDuplicatesEpsilon)) {
  31789. if (storeRemovedIndices) {
  31790. if (defined_default(cleanedValues)) {
  31791. removedIndices.splice(removedIndexLCI, 0, lastCleanIndex);
  31792. } else {
  31793. removedIndices.push(length3 - 1);
  31794. }
  31795. }
  31796. if (defined_default(cleanedValues)) {
  31797. cleanedValues.length -= 1;
  31798. } else {
  31799. cleanedValues = values.slice(0, -1);
  31800. }
  31801. }
  31802. return defined_default(cleanedValues) ? cleanedValues : values;
  31803. }
  31804. var arrayRemoveDuplicates_default = arrayRemoveDuplicates;
  31805. // node_modules/cesium/Source/Core/CoplanarPolygonGeometryLibrary.js
  31806. var CoplanarPolygonGeometryLibrary = {};
  31807. var scratchIntersectionPoint = new Cartesian3_default();
  31808. var scratchXAxis2 = new Cartesian3_default();
  31809. var scratchYAxis2 = new Cartesian3_default();
  31810. var scratchZAxis2 = new Cartesian3_default();
  31811. var obbScratch = new OrientedBoundingBox_default();
  31812. CoplanarPolygonGeometryLibrary.validOutline = function(positions) {
  31813. Check_default.defined("positions", positions);
  31814. const orientedBoundingBox = OrientedBoundingBox_default.fromPoints(
  31815. positions,
  31816. obbScratch
  31817. );
  31818. const halfAxes = orientedBoundingBox.halfAxes;
  31819. const xAxis = Matrix3_default.getColumn(halfAxes, 0, scratchXAxis2);
  31820. const yAxis = Matrix3_default.getColumn(halfAxes, 1, scratchYAxis2);
  31821. const zAxis = Matrix3_default.getColumn(halfAxes, 2, scratchZAxis2);
  31822. const xMag = Cartesian3_default.magnitude(xAxis);
  31823. const yMag = Cartesian3_default.magnitude(yAxis);
  31824. const zMag = Cartesian3_default.magnitude(zAxis);
  31825. return !(xMag === 0 && (yMag === 0 || zMag === 0) || yMag === 0 && zMag === 0);
  31826. };
  31827. CoplanarPolygonGeometryLibrary.computeProjectTo2DArguments = function(positions, centerResult, planeAxis1Result, planeAxis2Result) {
  31828. Check_default.defined("positions", positions);
  31829. Check_default.defined("centerResult", centerResult);
  31830. Check_default.defined("planeAxis1Result", planeAxis1Result);
  31831. Check_default.defined("planeAxis2Result", planeAxis2Result);
  31832. const orientedBoundingBox = OrientedBoundingBox_default.fromPoints(
  31833. positions,
  31834. obbScratch
  31835. );
  31836. const halfAxes = orientedBoundingBox.halfAxes;
  31837. const xAxis = Matrix3_default.getColumn(halfAxes, 0, scratchXAxis2);
  31838. const yAxis = Matrix3_default.getColumn(halfAxes, 1, scratchYAxis2);
  31839. const zAxis = Matrix3_default.getColumn(halfAxes, 2, scratchZAxis2);
  31840. const xMag = Cartesian3_default.magnitude(xAxis);
  31841. const yMag = Cartesian3_default.magnitude(yAxis);
  31842. const zMag = Cartesian3_default.magnitude(zAxis);
  31843. const min3 = Math.min(xMag, yMag, zMag);
  31844. if (xMag === 0 && (yMag === 0 || zMag === 0) || yMag === 0 && zMag === 0) {
  31845. return false;
  31846. }
  31847. let planeAxis1;
  31848. let planeAxis2;
  31849. if (min3 === yMag || min3 === zMag) {
  31850. planeAxis1 = xAxis;
  31851. }
  31852. if (min3 === xMag) {
  31853. planeAxis1 = yAxis;
  31854. } else if (min3 === zMag) {
  31855. planeAxis2 = yAxis;
  31856. }
  31857. if (min3 === xMag || min3 === yMag) {
  31858. planeAxis2 = zAxis;
  31859. }
  31860. Cartesian3_default.normalize(planeAxis1, planeAxis1Result);
  31861. Cartesian3_default.normalize(planeAxis2, planeAxis2Result);
  31862. Cartesian3_default.clone(orientedBoundingBox.center, centerResult);
  31863. return true;
  31864. };
  31865. function projectTo2D(position, center, axis1, axis2, result) {
  31866. const v7 = Cartesian3_default.subtract(position, center, scratchIntersectionPoint);
  31867. const x = Cartesian3_default.dot(axis1, v7);
  31868. const y = Cartesian3_default.dot(axis2, v7);
  31869. return Cartesian2_default.fromElements(x, y, result);
  31870. }
  31871. CoplanarPolygonGeometryLibrary.createProjectPointsTo2DFunction = function(center, axis1, axis2) {
  31872. return function(positions) {
  31873. const positionResults = new Array(positions.length);
  31874. for (let i2 = 0; i2 < positions.length; i2++) {
  31875. positionResults[i2] = projectTo2D(positions[i2], center, axis1, axis2);
  31876. }
  31877. return positionResults;
  31878. };
  31879. };
  31880. CoplanarPolygonGeometryLibrary.createProjectPointTo2DFunction = function(center, axis1, axis2) {
  31881. return function(position, result) {
  31882. return projectTo2D(position, center, axis1, axis2, result);
  31883. };
  31884. };
  31885. var CoplanarPolygonGeometryLibrary_default = CoplanarPolygonGeometryLibrary;
  31886. // node_modules/cesium/Source/Core/EllipsoidRhumbLine.js
  31887. function calculateM(ellipticity, major, latitude) {
  31888. if (ellipticity === 0) {
  31889. return major * latitude;
  31890. }
  31891. const e2 = ellipticity * ellipticity;
  31892. const e4 = e2 * e2;
  31893. const e6 = e4 * e2;
  31894. const e8 = e6 * e2;
  31895. const e10 = e8 * e2;
  31896. const e12 = e10 * e2;
  31897. const phi = latitude;
  31898. const sin2Phi = Math.sin(2 * phi);
  31899. const sin4Phi = Math.sin(4 * phi);
  31900. const sin6Phi = Math.sin(6 * phi);
  31901. const sin8Phi = Math.sin(8 * phi);
  31902. const sin10Phi = Math.sin(10 * phi);
  31903. const sin12Phi = Math.sin(12 * phi);
  31904. return major * ((1 - e2 / 4 - 3 * e4 / 64 - 5 * e6 / 256 - 175 * e8 / 16384 - 441 * e10 / 65536 - 4851 * e12 / 1048576) * phi - (3 * e2 / 8 + 3 * e4 / 32 + 45 * e6 / 1024 + 105 * e8 / 4096 + 2205 * e10 / 131072 + 6237 * e12 / 524288) * sin2Phi + (15 * e4 / 256 + 45 * e6 / 1024 + 525 * e8 / 16384 + 1575 * e10 / 65536 + 155925 * e12 / 8388608) * sin4Phi - (35 * e6 / 3072 + 175 * e8 / 12288 + 3675 * e10 / 262144 + 13475 * e12 / 1048576) * sin6Phi + (315 * e8 / 131072 + 2205 * e10 / 524288 + 43659 * e12 / 8388608) * sin8Phi - (693 * e10 / 1310720 + 6237 * e12 / 5242880) * sin10Phi + 1001 * e12 / 8388608 * sin12Phi);
  31905. }
  31906. function calculateInverseM(M, ellipticity, major) {
  31907. const d = M / major;
  31908. if (ellipticity === 0) {
  31909. return d;
  31910. }
  31911. const d2 = d * d;
  31912. const d3 = d2 * d;
  31913. const d4 = d3 * d;
  31914. const e2 = ellipticity;
  31915. const e22 = e2 * e2;
  31916. const e4 = e22 * e22;
  31917. const e6 = e4 * e22;
  31918. const e8 = e6 * e22;
  31919. const e10 = e8 * e22;
  31920. const e12 = e10 * e22;
  31921. const sin2D = Math.sin(2 * d);
  31922. const cos2D = Math.cos(2 * d);
  31923. const sin4D = Math.sin(4 * d);
  31924. const cos4D = Math.cos(4 * d);
  31925. const sin6D = Math.sin(6 * d);
  31926. const cos6D = Math.cos(6 * d);
  31927. const sin8D = Math.sin(8 * d);
  31928. const cos8D = Math.cos(8 * d);
  31929. const sin10D = Math.sin(10 * d);
  31930. const cos10D = Math.cos(10 * d);
  31931. const sin12D = Math.sin(12 * d);
  31932. return d + d * e22 / 4 + 7 * d * e4 / 64 + 15 * d * e6 / 256 + 579 * d * e8 / 16384 + 1515 * d * e10 / 65536 + 16837 * d * e12 / 1048576 + (3 * d * e4 / 16 + 45 * d * e6 / 256 - d * (32 * d2 - 561) * e8 / 4096 - d * (232 * d2 - 1677) * e10 / 16384 + d * (399985 - 90560 * d2 + 512 * d4) * e12 / 5242880) * cos2D + (21 * d * e6 / 256 + 483 * d * e8 / 4096 - d * (224 * d2 - 1969) * e10 / 16384 - d * (33152 * d2 - 112599) * e12 / 1048576) * cos4D + (151 * d * e8 / 4096 + 4681 * d * e10 / 65536 + 1479 * d * e12 / 16384 - 453 * d3 * e12 / 32768) * cos6D + (1097 * d * e10 / 65536 + 42783 * d * e12 / 1048576) * cos8D + 8011 * d * e12 / 1048576 * cos10D + (3 * e22 / 8 + 3 * e4 / 16 + 213 * e6 / 2048 - 3 * d2 * e6 / 64 + 255 * e8 / 4096 - 33 * d2 * e8 / 512 + 20861 * e10 / 524288 - 33 * d2 * e10 / 512 + d4 * e10 / 1024 + 28273 * e12 / 1048576 - 471 * d2 * e12 / 8192 + 9 * d4 * e12 / 4096) * sin2D + (21 * e4 / 256 + 21 * e6 / 256 + 533 * e8 / 8192 - 21 * d2 * e8 / 512 + 197 * e10 / 4096 - 315 * d2 * e10 / 4096 + 584039 * e12 / 16777216 - 12517 * d2 * e12 / 131072 + 7 * d4 * e12 / 2048) * sin4D + (151 * e6 / 6144 + 151 * e8 / 4096 + 5019 * e10 / 131072 - 453 * d2 * e10 / 16384 + 26965 * e12 / 786432 - 8607 * d2 * e12 / 131072) * sin6D + (1097 * e8 / 131072 + 1097 * e10 / 65536 + 225797 * e12 / 10485760 - 1097 * d2 * e12 / 65536) * sin8D + (8011 * e10 / 2621440 + 8011 * e12 / 1048576) * sin10D + 293393 * e12 / 251658240 * sin12D;
  31933. }
  31934. function calculateSigma(ellipticity, latitude) {
  31935. if (ellipticity === 0) {
  31936. return Math.log(Math.tan(0.5 * (Math_default.PI_OVER_TWO + latitude)));
  31937. }
  31938. const eSinL = ellipticity * Math.sin(latitude);
  31939. return Math.log(Math.tan(0.5 * (Math_default.PI_OVER_TWO + latitude))) - ellipticity / 2 * Math.log((1 + eSinL) / (1 - eSinL));
  31940. }
  31941. function calculateHeading(ellipsoidRhumbLine, firstLongitude, firstLatitude, secondLongitude, secondLatitude) {
  31942. const sigma1 = calculateSigma(ellipsoidRhumbLine._ellipticity, firstLatitude);
  31943. const sigma2 = calculateSigma(
  31944. ellipsoidRhumbLine._ellipticity,
  31945. secondLatitude
  31946. );
  31947. return Math.atan2(
  31948. Math_default.negativePiToPi(secondLongitude - firstLongitude),
  31949. sigma2 - sigma1
  31950. );
  31951. }
  31952. function calculateArcLength(ellipsoidRhumbLine, major, minor, firstLongitude, firstLatitude, secondLongitude, secondLatitude) {
  31953. const heading = ellipsoidRhumbLine._heading;
  31954. const deltaLongitude = secondLongitude - firstLongitude;
  31955. let distance2 = 0;
  31956. if (Math_default.equalsEpsilon(
  31957. Math.abs(heading),
  31958. Math_default.PI_OVER_TWO,
  31959. Math_default.EPSILON8
  31960. )) {
  31961. if (major === minor) {
  31962. distance2 = major * Math.cos(firstLatitude) * Math_default.negativePiToPi(deltaLongitude);
  31963. } else {
  31964. const sinPhi = Math.sin(firstLatitude);
  31965. distance2 = major * Math.cos(firstLatitude) * Math_default.negativePiToPi(deltaLongitude) / Math.sqrt(1 - ellipsoidRhumbLine._ellipticitySquared * sinPhi * sinPhi);
  31966. }
  31967. } else {
  31968. const M1 = calculateM(
  31969. ellipsoidRhumbLine._ellipticity,
  31970. major,
  31971. firstLatitude
  31972. );
  31973. const M2 = calculateM(
  31974. ellipsoidRhumbLine._ellipticity,
  31975. major,
  31976. secondLatitude
  31977. );
  31978. distance2 = (M2 - M1) / Math.cos(heading);
  31979. }
  31980. return Math.abs(distance2);
  31981. }
  31982. var scratchCart1 = new Cartesian3_default();
  31983. var scratchCart2 = new Cartesian3_default();
  31984. function computeProperties(ellipsoidRhumbLine, start, end, ellipsoid) {
  31985. const firstCartesian = Cartesian3_default.normalize(
  31986. ellipsoid.cartographicToCartesian(start, scratchCart2),
  31987. scratchCart1
  31988. );
  31989. const lastCartesian = Cartesian3_default.normalize(
  31990. ellipsoid.cartographicToCartesian(end, scratchCart2),
  31991. scratchCart2
  31992. );
  31993. Check_default.typeOf.number.greaterThanOrEquals(
  31994. "value",
  31995. Math.abs(
  31996. Math.abs(Cartesian3_default.angleBetween(firstCartesian, lastCartesian)) - Math.PI
  31997. ),
  31998. 0.0125
  31999. );
  32000. const major = ellipsoid.maximumRadius;
  32001. const minor = ellipsoid.minimumRadius;
  32002. const majorSquared = major * major;
  32003. const minorSquared = minor * minor;
  32004. ellipsoidRhumbLine._ellipticitySquared = (majorSquared - minorSquared) / majorSquared;
  32005. ellipsoidRhumbLine._ellipticity = Math.sqrt(
  32006. ellipsoidRhumbLine._ellipticitySquared
  32007. );
  32008. ellipsoidRhumbLine._start = Cartographic_default.clone(
  32009. start,
  32010. ellipsoidRhumbLine._start
  32011. );
  32012. ellipsoidRhumbLine._start.height = 0;
  32013. ellipsoidRhumbLine._end = Cartographic_default.clone(end, ellipsoidRhumbLine._end);
  32014. ellipsoidRhumbLine._end.height = 0;
  32015. ellipsoidRhumbLine._heading = calculateHeading(
  32016. ellipsoidRhumbLine,
  32017. start.longitude,
  32018. start.latitude,
  32019. end.longitude,
  32020. end.latitude
  32021. );
  32022. ellipsoidRhumbLine._distance = calculateArcLength(
  32023. ellipsoidRhumbLine,
  32024. ellipsoid.maximumRadius,
  32025. ellipsoid.minimumRadius,
  32026. start.longitude,
  32027. start.latitude,
  32028. end.longitude,
  32029. end.latitude
  32030. );
  32031. }
  32032. function interpolateUsingSurfaceDistance(start, heading, distance2, major, ellipticity, result) {
  32033. if (distance2 === 0) {
  32034. return Cartographic_default.clone(start, result);
  32035. }
  32036. const ellipticitySquared = ellipticity * ellipticity;
  32037. let longitude;
  32038. let latitude;
  32039. let deltaLongitude;
  32040. if (Math.abs(Math_default.PI_OVER_TWO - Math.abs(heading)) > Math_default.EPSILON8) {
  32041. const M1 = calculateM(ellipticity, major, start.latitude);
  32042. const deltaM = distance2 * Math.cos(heading);
  32043. const M2 = M1 + deltaM;
  32044. latitude = calculateInverseM(M2, ellipticity, major);
  32045. const sigma1 = calculateSigma(ellipticity, start.latitude);
  32046. const sigma2 = calculateSigma(ellipticity, latitude);
  32047. deltaLongitude = Math.tan(heading) * (sigma2 - sigma1);
  32048. longitude = Math_default.negativePiToPi(start.longitude + deltaLongitude);
  32049. } else {
  32050. latitude = start.latitude;
  32051. let localRad;
  32052. if (ellipticity === 0) {
  32053. localRad = major * Math.cos(start.latitude);
  32054. } else {
  32055. const sinPhi = Math.sin(start.latitude);
  32056. localRad = major * Math.cos(start.latitude) / Math.sqrt(1 - ellipticitySquared * sinPhi * sinPhi);
  32057. }
  32058. deltaLongitude = distance2 / localRad;
  32059. if (heading > 0) {
  32060. longitude = Math_default.negativePiToPi(start.longitude + deltaLongitude);
  32061. } else {
  32062. longitude = Math_default.negativePiToPi(start.longitude - deltaLongitude);
  32063. }
  32064. }
  32065. if (defined_default(result)) {
  32066. result.longitude = longitude;
  32067. result.latitude = latitude;
  32068. result.height = 0;
  32069. return result;
  32070. }
  32071. return new Cartographic_default(longitude, latitude, 0);
  32072. }
  32073. function EllipsoidRhumbLine(start, end, ellipsoid) {
  32074. const e2 = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  32075. this._ellipsoid = e2;
  32076. this._start = new Cartographic_default();
  32077. this._end = new Cartographic_default();
  32078. this._heading = void 0;
  32079. this._distance = void 0;
  32080. this._ellipticity = void 0;
  32081. this._ellipticitySquared = void 0;
  32082. if (defined_default(start) && defined_default(end)) {
  32083. computeProperties(this, start, end, e2);
  32084. }
  32085. }
  32086. Object.defineProperties(EllipsoidRhumbLine.prototype, {
  32087. ellipsoid: {
  32088. get: function() {
  32089. return this._ellipsoid;
  32090. }
  32091. },
  32092. surfaceDistance: {
  32093. get: function() {
  32094. Check_default.defined("distance", this._distance);
  32095. return this._distance;
  32096. }
  32097. },
  32098. start: {
  32099. get: function() {
  32100. return this._start;
  32101. }
  32102. },
  32103. end: {
  32104. get: function() {
  32105. return this._end;
  32106. }
  32107. },
  32108. heading: {
  32109. get: function() {
  32110. Check_default.defined("distance", this._distance);
  32111. return this._heading;
  32112. }
  32113. }
  32114. });
  32115. EllipsoidRhumbLine.fromStartHeadingDistance = function(start, heading, distance2, ellipsoid, result) {
  32116. Check_default.defined("start", start);
  32117. Check_default.defined("heading", heading);
  32118. Check_default.defined("distance", distance2);
  32119. Check_default.typeOf.number.greaterThan("distance", distance2, 0);
  32120. const e2 = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  32121. const major = e2.maximumRadius;
  32122. const minor = e2.minimumRadius;
  32123. const majorSquared = major * major;
  32124. const minorSquared = minor * minor;
  32125. const ellipticity = Math.sqrt((majorSquared - minorSquared) / majorSquared);
  32126. heading = Math_default.negativePiToPi(heading);
  32127. const end = interpolateUsingSurfaceDistance(
  32128. start,
  32129. heading,
  32130. distance2,
  32131. e2.maximumRadius,
  32132. ellipticity
  32133. );
  32134. if (!defined_default(result) || defined_default(ellipsoid) && !ellipsoid.equals(result.ellipsoid)) {
  32135. return new EllipsoidRhumbLine(start, end, e2);
  32136. }
  32137. result.setEndPoints(start, end);
  32138. return result;
  32139. };
  32140. EllipsoidRhumbLine.prototype.setEndPoints = function(start, end) {
  32141. Check_default.defined("start", start);
  32142. Check_default.defined("end", end);
  32143. computeProperties(this, start, end, this._ellipsoid);
  32144. };
  32145. EllipsoidRhumbLine.prototype.interpolateUsingFraction = function(fraction, result) {
  32146. return this.interpolateUsingSurfaceDistance(
  32147. fraction * this._distance,
  32148. result
  32149. );
  32150. };
  32151. EllipsoidRhumbLine.prototype.interpolateUsingSurfaceDistance = function(distance2, result) {
  32152. Check_default.typeOf.number("distance", distance2);
  32153. if (!defined_default(this._distance) || this._distance === 0) {
  32154. throw new DeveloperError_default(
  32155. "EllipsoidRhumbLine must have distinct start and end set."
  32156. );
  32157. }
  32158. return interpolateUsingSurfaceDistance(
  32159. this._start,
  32160. this._heading,
  32161. distance2,
  32162. this._ellipsoid.maximumRadius,
  32163. this._ellipticity,
  32164. result
  32165. );
  32166. };
  32167. EllipsoidRhumbLine.prototype.findIntersectionWithLongitude = function(intersectionLongitude, result) {
  32168. Check_default.typeOf.number("intersectionLongitude", intersectionLongitude);
  32169. if (!defined_default(this._distance) || this._distance === 0) {
  32170. throw new DeveloperError_default(
  32171. "EllipsoidRhumbLine must have distinct start and end set."
  32172. );
  32173. }
  32174. const ellipticity = this._ellipticity;
  32175. const heading = this._heading;
  32176. const absHeading = Math.abs(heading);
  32177. const start = this._start;
  32178. intersectionLongitude = Math_default.negativePiToPi(intersectionLongitude);
  32179. if (Math_default.equalsEpsilon(
  32180. Math.abs(intersectionLongitude),
  32181. Math.PI,
  32182. Math_default.EPSILON14
  32183. )) {
  32184. intersectionLongitude = Math_default.sign(start.longitude) * Math.PI;
  32185. }
  32186. if (!defined_default(result)) {
  32187. result = new Cartographic_default();
  32188. }
  32189. if (Math.abs(Math_default.PI_OVER_TWO - absHeading) <= Math_default.EPSILON8) {
  32190. result.longitude = intersectionLongitude;
  32191. result.latitude = start.latitude;
  32192. result.height = 0;
  32193. return result;
  32194. } else if (Math_default.equalsEpsilon(
  32195. Math.abs(Math_default.PI_OVER_TWO - absHeading),
  32196. Math_default.PI_OVER_TWO,
  32197. Math_default.EPSILON8
  32198. )) {
  32199. if (Math_default.equalsEpsilon(
  32200. intersectionLongitude,
  32201. start.longitude,
  32202. Math_default.EPSILON12
  32203. )) {
  32204. return void 0;
  32205. }
  32206. result.longitude = intersectionLongitude;
  32207. result.latitude = Math_default.PI_OVER_TWO * Math_default.sign(Math_default.PI_OVER_TWO - heading);
  32208. result.height = 0;
  32209. return result;
  32210. }
  32211. const phi1 = start.latitude;
  32212. const eSinPhi1 = ellipticity * Math.sin(phi1);
  32213. const leftComponent = Math.tan(0.5 * (Math_default.PI_OVER_TWO + phi1)) * Math.exp((intersectionLongitude - start.longitude) / Math.tan(heading));
  32214. const denominator = (1 + eSinPhi1) / (1 - eSinPhi1);
  32215. let newPhi = start.latitude;
  32216. let phi;
  32217. do {
  32218. phi = newPhi;
  32219. const eSinPhi = ellipticity * Math.sin(phi);
  32220. const numerator = (1 + eSinPhi) / (1 - eSinPhi);
  32221. newPhi = 2 * Math.atan(
  32222. leftComponent * Math.pow(numerator / denominator, ellipticity / 2)
  32223. ) - Math_default.PI_OVER_TWO;
  32224. } while (!Math_default.equalsEpsilon(newPhi, phi, Math_default.EPSILON12));
  32225. result.longitude = intersectionLongitude;
  32226. result.latitude = newPhi;
  32227. result.height = 0;
  32228. return result;
  32229. };
  32230. EllipsoidRhumbLine.prototype.findIntersectionWithLatitude = function(intersectionLatitude, result) {
  32231. Check_default.typeOf.number("intersectionLatitude", intersectionLatitude);
  32232. if (!defined_default(this._distance) || this._distance === 0) {
  32233. throw new DeveloperError_default(
  32234. "EllipsoidRhumbLine must have distinct start and end set."
  32235. );
  32236. }
  32237. const ellipticity = this._ellipticity;
  32238. const heading = this._heading;
  32239. const start = this._start;
  32240. if (Math_default.equalsEpsilon(
  32241. Math.abs(heading),
  32242. Math_default.PI_OVER_TWO,
  32243. Math_default.EPSILON8
  32244. )) {
  32245. return;
  32246. }
  32247. const sigma1 = calculateSigma(ellipticity, start.latitude);
  32248. const sigma2 = calculateSigma(ellipticity, intersectionLatitude);
  32249. const deltaLongitude = Math.tan(heading) * (sigma2 - sigma1);
  32250. const longitude = Math_default.negativePiToPi(start.longitude + deltaLongitude);
  32251. if (defined_default(result)) {
  32252. result.longitude = longitude;
  32253. result.latitude = intersectionLatitude;
  32254. result.height = 0;
  32255. return result;
  32256. }
  32257. return new Cartographic_default(longitude, intersectionLatitude, 0);
  32258. };
  32259. var EllipsoidRhumbLine_default = EllipsoidRhumbLine;
  32260. // node_modules/cesium/Source/ThirdParty/earcut.js
  32261. var earcut_1 = earcut;
  32262. var _default = earcut;
  32263. function earcut(data, holeIndices, dim) {
  32264. dim = dim || 2;
  32265. var hasHoles = holeIndices && holeIndices.length, outerLen = hasHoles ? holeIndices[0] * dim : data.length, outerNode = linkedList(data, 0, outerLen, dim, true), triangles = [];
  32266. if (!outerNode || outerNode.next === outerNode.prev)
  32267. return triangles;
  32268. var minX, minY, maxX, maxY, x, y, invSize;
  32269. if (hasHoles)
  32270. outerNode = eliminateHoles(data, holeIndices, outerNode, dim);
  32271. if (data.length > 80 * dim) {
  32272. minX = maxX = data[0];
  32273. minY = maxY = data[1];
  32274. for (var i2 = dim; i2 < outerLen; i2 += dim) {
  32275. x = data[i2];
  32276. y = data[i2 + 1];
  32277. if (x < minX)
  32278. minX = x;
  32279. if (y < minY)
  32280. minY = y;
  32281. if (x > maxX)
  32282. maxX = x;
  32283. if (y > maxY)
  32284. maxY = y;
  32285. }
  32286. invSize = Math.max(maxX - minX, maxY - minY);
  32287. invSize = invSize !== 0 ? 1 / invSize : 0;
  32288. }
  32289. earcutLinked(outerNode, triangles, dim, minX, minY, invSize);
  32290. return triangles;
  32291. }
  32292. function linkedList(data, start, end, dim, clockwise) {
  32293. var i2, last;
  32294. if (clockwise === signedArea(data, start, end, dim) > 0) {
  32295. for (i2 = start; i2 < end; i2 += dim)
  32296. last = insertNode(i2, data[i2], data[i2 + 1], last);
  32297. } else {
  32298. for (i2 = end - dim; i2 >= start; i2 -= dim)
  32299. last = insertNode(i2, data[i2], data[i2 + 1], last);
  32300. }
  32301. if (last && equals(last, last.next)) {
  32302. removeNode(last);
  32303. last = last.next;
  32304. }
  32305. return last;
  32306. }
  32307. function filterPoints(start, end) {
  32308. if (!start)
  32309. return start;
  32310. if (!end)
  32311. end = start;
  32312. var p2 = start, again;
  32313. do {
  32314. again = false;
  32315. if (!p2.steiner && (equals(p2, p2.next) || area(p2.prev, p2, p2.next) === 0)) {
  32316. removeNode(p2);
  32317. p2 = end = p2.prev;
  32318. if (p2 === p2.next)
  32319. break;
  32320. again = true;
  32321. } else {
  32322. p2 = p2.next;
  32323. }
  32324. } while (again || p2 !== end);
  32325. return end;
  32326. }
  32327. function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) {
  32328. if (!ear)
  32329. return;
  32330. if (!pass && invSize)
  32331. indexCurve(ear, minX, minY, invSize);
  32332. var stop2 = ear, prev, next;
  32333. while (ear.prev !== ear.next) {
  32334. prev = ear.prev;
  32335. next = ear.next;
  32336. if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
  32337. triangles.push(prev.i / dim);
  32338. triangles.push(ear.i / dim);
  32339. triangles.push(next.i / dim);
  32340. removeNode(ear);
  32341. ear = next.next;
  32342. stop2 = next.next;
  32343. continue;
  32344. }
  32345. ear = next;
  32346. if (ear === stop2) {
  32347. if (!pass) {
  32348. earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1);
  32349. } else if (pass === 1) {
  32350. ear = cureLocalIntersections(filterPoints(ear), triangles, dim);
  32351. earcutLinked(ear, triangles, dim, minX, minY, invSize, 2);
  32352. } else if (pass === 2) {
  32353. splitEarcut(ear, triangles, dim, minX, minY, invSize);
  32354. }
  32355. break;
  32356. }
  32357. }
  32358. }
  32359. function isEar(ear) {
  32360. var a4 = ear.prev, b = ear, c14 = ear.next;
  32361. if (area(a4, b, c14) >= 0)
  32362. return false;
  32363. var p2 = ear.next.next;
  32364. while (p2 !== ear.prev) {
  32365. if (pointInTriangle(a4.x, a4.y, b.x, b.y, c14.x, c14.y, p2.x, p2.y) && area(p2.prev, p2, p2.next) >= 0)
  32366. return false;
  32367. p2 = p2.next;
  32368. }
  32369. return true;
  32370. }
  32371. function isEarHashed(ear, minX, minY, invSize) {
  32372. var a4 = ear.prev, b = ear, c14 = ear.next;
  32373. if (area(a4, b, c14) >= 0)
  32374. return false;
  32375. var minTX = a4.x < b.x ? a4.x < c14.x ? a4.x : c14.x : b.x < c14.x ? b.x : c14.x, minTY = a4.y < b.y ? a4.y < c14.y ? a4.y : c14.y : b.y < c14.y ? b.y : c14.y, maxTX = a4.x > b.x ? a4.x > c14.x ? a4.x : c14.x : b.x > c14.x ? b.x : c14.x, maxTY = a4.y > b.y ? a4.y > c14.y ? a4.y : c14.y : b.y > c14.y ? b.y : c14.y;
  32376. var minZ = zOrder(minTX, minTY, minX, minY, invSize), maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);
  32377. var p2 = ear.prevZ, n2 = ear.nextZ;
  32378. while (p2 && p2.z >= minZ && n2 && n2.z <= maxZ) {
  32379. if (p2 !== ear.prev && p2 !== ear.next && pointInTriangle(a4.x, a4.y, b.x, b.y, c14.x, c14.y, p2.x, p2.y) && area(p2.prev, p2, p2.next) >= 0)
  32380. return false;
  32381. p2 = p2.prevZ;
  32382. if (n2 !== ear.prev && n2 !== ear.next && pointInTriangle(a4.x, a4.y, b.x, b.y, c14.x, c14.y, n2.x, n2.y) && area(n2.prev, n2, n2.next) >= 0)
  32383. return false;
  32384. n2 = n2.nextZ;
  32385. }
  32386. while (p2 && p2.z >= minZ) {
  32387. if (p2 !== ear.prev && p2 !== ear.next && pointInTriangle(a4.x, a4.y, b.x, b.y, c14.x, c14.y, p2.x, p2.y) && area(p2.prev, p2, p2.next) >= 0)
  32388. return false;
  32389. p2 = p2.prevZ;
  32390. }
  32391. while (n2 && n2.z <= maxZ) {
  32392. if (n2 !== ear.prev && n2 !== ear.next && pointInTriangle(a4.x, a4.y, b.x, b.y, c14.x, c14.y, n2.x, n2.y) && area(n2.prev, n2, n2.next) >= 0)
  32393. return false;
  32394. n2 = n2.nextZ;
  32395. }
  32396. return true;
  32397. }
  32398. function cureLocalIntersections(start, triangles, dim) {
  32399. var p2 = start;
  32400. do {
  32401. var a4 = p2.prev, b = p2.next.next;
  32402. if (!equals(a4, b) && intersects(a4, p2, p2.next, b) && locallyInside(a4, b) && locallyInside(b, a4)) {
  32403. triangles.push(a4.i / dim);
  32404. triangles.push(p2.i / dim);
  32405. triangles.push(b.i / dim);
  32406. removeNode(p2);
  32407. removeNode(p2.next);
  32408. p2 = start = b;
  32409. }
  32410. p2 = p2.next;
  32411. } while (p2 !== start);
  32412. return filterPoints(p2);
  32413. }
  32414. function splitEarcut(start, triangles, dim, minX, minY, invSize) {
  32415. var a4 = start;
  32416. do {
  32417. var b = a4.next.next;
  32418. while (b !== a4.prev) {
  32419. if (a4.i !== b.i && isValidDiagonal(a4, b)) {
  32420. var c14 = splitPolygon(a4, b);
  32421. a4 = filterPoints(a4, a4.next);
  32422. c14 = filterPoints(c14, c14.next);
  32423. earcutLinked(a4, triangles, dim, minX, minY, invSize);
  32424. earcutLinked(c14, triangles, dim, minX, minY, invSize);
  32425. return;
  32426. }
  32427. b = b.next;
  32428. }
  32429. a4 = a4.next;
  32430. } while (a4 !== start);
  32431. }
  32432. function eliminateHoles(data, holeIndices, outerNode, dim) {
  32433. var queue = [], i2, len, start, end, list;
  32434. for (i2 = 0, len = holeIndices.length; i2 < len; i2++) {
  32435. start = holeIndices[i2] * dim;
  32436. end = i2 < len - 1 ? holeIndices[i2 + 1] * dim : data.length;
  32437. list = linkedList(data, start, end, dim, false);
  32438. if (list === list.next)
  32439. list.steiner = true;
  32440. queue.push(getLeftmost(list));
  32441. }
  32442. queue.sort(compareX);
  32443. for (i2 = 0; i2 < queue.length; i2++) {
  32444. outerNode = eliminateHole(queue[i2], outerNode);
  32445. outerNode = filterPoints(outerNode, outerNode.next);
  32446. }
  32447. return outerNode;
  32448. }
  32449. function compareX(a4, b) {
  32450. return a4.x - b.x;
  32451. }
  32452. function eliminateHole(hole, outerNode) {
  32453. var bridge = findHoleBridge(hole, outerNode);
  32454. if (!bridge) {
  32455. return outerNode;
  32456. }
  32457. var bridgeReverse = splitPolygon(bridge, hole);
  32458. var filteredBridge = filterPoints(bridge, bridge.next);
  32459. filterPoints(bridgeReverse, bridgeReverse.next);
  32460. return outerNode === bridge ? filteredBridge : outerNode;
  32461. }
  32462. function findHoleBridge(hole, outerNode) {
  32463. var p2 = outerNode, hx = hole.x, hy = hole.y, qx = -Infinity, m;
  32464. do {
  32465. if (hy <= p2.y && hy >= p2.next.y && p2.next.y !== p2.y) {
  32466. var x = p2.x + (hy - p2.y) * (p2.next.x - p2.x) / (p2.next.y - p2.y);
  32467. if (x <= hx && x > qx) {
  32468. qx = x;
  32469. if (x === hx) {
  32470. if (hy === p2.y)
  32471. return p2;
  32472. if (hy === p2.next.y)
  32473. return p2.next;
  32474. }
  32475. m = p2.x < p2.next.x ? p2 : p2.next;
  32476. }
  32477. }
  32478. p2 = p2.next;
  32479. } while (p2 !== outerNode);
  32480. if (!m)
  32481. return null;
  32482. if (hx === qx)
  32483. return m;
  32484. var stop2 = m, mx = m.x, my = m.y, tanMin = Infinity, tan;
  32485. p2 = m;
  32486. do {
  32487. if (hx >= p2.x && p2.x >= mx && hx !== p2.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p2.x, p2.y)) {
  32488. tan = Math.abs(hy - p2.y) / (hx - p2.x);
  32489. if (locallyInside(p2, hole) && (tan < tanMin || tan === tanMin && (p2.x > m.x || p2.x === m.x && sectorContainsSector(m, p2)))) {
  32490. m = p2;
  32491. tanMin = tan;
  32492. }
  32493. }
  32494. p2 = p2.next;
  32495. } while (p2 !== stop2);
  32496. return m;
  32497. }
  32498. function sectorContainsSector(m, p2) {
  32499. return area(m.prev, m, p2.prev) < 0 && area(p2.next, m, m.next) < 0;
  32500. }
  32501. function indexCurve(start, minX, minY, invSize) {
  32502. var p2 = start;
  32503. do {
  32504. if (p2.z === null)
  32505. p2.z = zOrder(p2.x, p2.y, minX, minY, invSize);
  32506. p2.prevZ = p2.prev;
  32507. p2.nextZ = p2.next;
  32508. p2 = p2.next;
  32509. } while (p2 !== start);
  32510. p2.prevZ.nextZ = null;
  32511. p2.prevZ = null;
  32512. sortLinked(p2);
  32513. }
  32514. function sortLinked(list) {
  32515. var i2, p2, q, e2, tail, numMerges, pSize, qSize, inSize = 1;
  32516. do {
  32517. p2 = list;
  32518. list = null;
  32519. tail = null;
  32520. numMerges = 0;
  32521. while (p2) {
  32522. numMerges++;
  32523. q = p2;
  32524. pSize = 0;
  32525. for (i2 = 0; i2 < inSize; i2++) {
  32526. pSize++;
  32527. q = q.nextZ;
  32528. if (!q)
  32529. break;
  32530. }
  32531. qSize = inSize;
  32532. while (pSize > 0 || qSize > 0 && q) {
  32533. if (pSize !== 0 && (qSize === 0 || !q || p2.z <= q.z)) {
  32534. e2 = p2;
  32535. p2 = p2.nextZ;
  32536. pSize--;
  32537. } else {
  32538. e2 = q;
  32539. q = q.nextZ;
  32540. qSize--;
  32541. }
  32542. if (tail)
  32543. tail.nextZ = e2;
  32544. else
  32545. list = e2;
  32546. e2.prevZ = tail;
  32547. tail = e2;
  32548. }
  32549. p2 = q;
  32550. }
  32551. tail.nextZ = null;
  32552. inSize *= 2;
  32553. } while (numMerges > 1);
  32554. return list;
  32555. }
  32556. function zOrder(x, y, minX, minY, invSize) {
  32557. x = 32767 * (x - minX) * invSize;
  32558. y = 32767 * (y - minY) * invSize;
  32559. x = (x | x << 8) & 16711935;
  32560. x = (x | x << 4) & 252645135;
  32561. x = (x | x << 2) & 858993459;
  32562. x = (x | x << 1) & 1431655765;
  32563. y = (y | y << 8) & 16711935;
  32564. y = (y | y << 4) & 252645135;
  32565. y = (y | y << 2) & 858993459;
  32566. y = (y | y << 1) & 1431655765;
  32567. return x | y << 1;
  32568. }
  32569. function getLeftmost(start) {
  32570. var p2 = start, leftmost = start;
  32571. do {
  32572. if (p2.x < leftmost.x || p2.x === leftmost.x && p2.y < leftmost.y)
  32573. leftmost = p2;
  32574. p2 = p2.next;
  32575. } while (p2 !== start);
  32576. return leftmost;
  32577. }
  32578. function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
  32579. return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;
  32580. }
  32581. function isValidDiagonal(a4, b) {
  32582. return a4.next.i !== b.i && a4.prev.i !== b.i && !intersectsPolygon(a4, b) && (locallyInside(a4, b) && locallyInside(b, a4) && middleInside(a4, b) && (area(a4.prev, a4, b.prev) || area(a4, b.prev, b)) || equals(a4, b) && area(a4.prev, a4, a4.next) > 0 && area(b.prev, b, b.next) > 0);
  32583. }
  32584. function area(p2, q, r2) {
  32585. return (q.y - p2.y) * (r2.x - q.x) - (q.x - p2.x) * (r2.y - q.y);
  32586. }
  32587. function equals(p1, p2) {
  32588. return p1.x === p2.x && p1.y === p2.y;
  32589. }
  32590. function intersects(p1, q12, p2, q22) {
  32591. var o1 = sign2(area(p1, q12, p2));
  32592. var o2 = sign2(area(p1, q12, q22));
  32593. var o3 = sign2(area(p2, q22, p1));
  32594. var o4 = sign2(area(p2, q22, q12));
  32595. if (o1 !== o2 && o3 !== o4)
  32596. return true;
  32597. if (o1 === 0 && onSegment(p1, p2, q12))
  32598. return true;
  32599. if (o2 === 0 && onSegment(p1, q22, q12))
  32600. return true;
  32601. if (o3 === 0 && onSegment(p2, p1, q22))
  32602. return true;
  32603. if (o4 === 0 && onSegment(p2, q12, q22))
  32604. return true;
  32605. return false;
  32606. }
  32607. function onSegment(p2, q, r2) {
  32608. return q.x <= Math.max(p2.x, r2.x) && q.x >= Math.min(p2.x, r2.x) && q.y <= Math.max(p2.y, r2.y) && q.y >= Math.min(p2.y, r2.y);
  32609. }
  32610. function sign2(num) {
  32611. return num > 0 ? 1 : num < 0 ? -1 : 0;
  32612. }
  32613. function intersectsPolygon(a4, b) {
  32614. var p2 = a4;
  32615. do {
  32616. if (p2.i !== a4.i && p2.next.i !== a4.i && p2.i !== b.i && p2.next.i !== b.i && intersects(p2, p2.next, a4, b))
  32617. return true;
  32618. p2 = p2.next;
  32619. } while (p2 !== a4);
  32620. return false;
  32621. }
  32622. function locallyInside(a4, b) {
  32623. return area(a4.prev, a4, a4.next) < 0 ? area(a4, b, a4.next) >= 0 && area(a4, a4.prev, b) >= 0 : area(a4, b, a4.prev) < 0 || area(a4, a4.next, b) < 0;
  32624. }
  32625. function middleInside(a4, b) {
  32626. var p2 = a4, inside = false, px = (a4.x + b.x) / 2, py = (a4.y + b.y) / 2;
  32627. do {
  32628. if (p2.y > py !== p2.next.y > py && p2.next.y !== p2.y && px < (p2.next.x - p2.x) * (py - p2.y) / (p2.next.y - p2.y) + p2.x)
  32629. inside = !inside;
  32630. p2 = p2.next;
  32631. } while (p2 !== a4);
  32632. return inside;
  32633. }
  32634. function splitPolygon(a4, b) {
  32635. var a22 = new Node2(a4.i, a4.x, a4.y), b2 = new Node2(b.i, b.x, b.y), an = a4.next, bp = b.prev;
  32636. a4.next = b;
  32637. b.prev = a4;
  32638. a22.next = an;
  32639. an.prev = a22;
  32640. b2.next = a22;
  32641. a22.prev = b2;
  32642. bp.next = b2;
  32643. b2.prev = bp;
  32644. return b2;
  32645. }
  32646. function insertNode(i2, x, y, last) {
  32647. var p2 = new Node2(i2, x, y);
  32648. if (!last) {
  32649. p2.prev = p2;
  32650. p2.next = p2;
  32651. } else {
  32652. p2.next = last.next;
  32653. p2.prev = last;
  32654. last.next.prev = p2;
  32655. last.next = p2;
  32656. }
  32657. return p2;
  32658. }
  32659. function removeNode(p2) {
  32660. p2.next.prev = p2.prev;
  32661. p2.prev.next = p2.next;
  32662. if (p2.prevZ)
  32663. p2.prevZ.nextZ = p2.nextZ;
  32664. if (p2.nextZ)
  32665. p2.nextZ.prevZ = p2.prevZ;
  32666. }
  32667. function Node2(i2, x, y) {
  32668. this.i = i2;
  32669. this.x = x;
  32670. this.y = y;
  32671. this.prev = null;
  32672. this.next = null;
  32673. this.z = null;
  32674. this.prevZ = null;
  32675. this.nextZ = null;
  32676. this.steiner = false;
  32677. }
  32678. earcut.deviation = function(data, holeIndices, dim, triangles) {
  32679. var hasHoles = holeIndices && holeIndices.length;
  32680. var outerLen = hasHoles ? holeIndices[0] * dim : data.length;
  32681. var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim));
  32682. if (hasHoles) {
  32683. for (var i2 = 0, len = holeIndices.length; i2 < len; i2++) {
  32684. var start = holeIndices[i2] * dim;
  32685. var end = i2 < len - 1 ? holeIndices[i2 + 1] * dim : data.length;
  32686. polygonArea -= Math.abs(signedArea(data, start, end, dim));
  32687. }
  32688. }
  32689. var trianglesArea = 0;
  32690. for (i2 = 0; i2 < triangles.length; i2 += 3) {
  32691. var a4 = triangles[i2] * dim;
  32692. var b = triangles[i2 + 1] * dim;
  32693. var c14 = triangles[i2 + 2] * dim;
  32694. trianglesArea += Math.abs(
  32695. (data[a4] - data[c14]) * (data[b + 1] - data[a4 + 1]) - (data[a4] - data[b]) * (data[c14 + 1] - data[a4 + 1])
  32696. );
  32697. }
  32698. return polygonArea === 0 && trianglesArea === 0 ? 0 : Math.abs((trianglesArea - polygonArea) / polygonArea);
  32699. };
  32700. function signedArea(data, start, end, dim) {
  32701. var sum = 0;
  32702. for (var i2 = start, j = end - dim; i2 < end; i2 += dim) {
  32703. sum += (data[j] - data[i2]) * (data[i2 + 1] + data[j + 1]);
  32704. j = i2;
  32705. }
  32706. return sum;
  32707. }
  32708. earcut.flatten = function(data) {
  32709. var dim = data[0][0].length, result = { vertices: [], holes: [], dimensions: dim }, holeIndex = 0;
  32710. for (var i2 = 0; i2 < data.length; i2++) {
  32711. for (var j = 0; j < data[i2].length; j++) {
  32712. for (var d = 0; d < dim; d++)
  32713. result.vertices.push(data[i2][j][d]);
  32714. }
  32715. if (i2 > 0) {
  32716. holeIndex += data[i2 - 1].length;
  32717. result.holes.push(holeIndex);
  32718. }
  32719. }
  32720. return result;
  32721. };
  32722. earcut_1.default = _default;
  32723. // node_modules/cesium/Source/Core/WindingOrder.js
  32724. var WindingOrder = {
  32725. CLOCKWISE: WebGLConstants_default.CW,
  32726. COUNTER_CLOCKWISE: WebGLConstants_default.CCW
  32727. };
  32728. WindingOrder.validate = function(windingOrder) {
  32729. return windingOrder === WindingOrder.CLOCKWISE || windingOrder === WindingOrder.COUNTER_CLOCKWISE;
  32730. };
  32731. var WindingOrder_default = Object.freeze(WindingOrder);
  32732. // node_modules/cesium/Source/Core/PolygonPipeline.js
  32733. var scaleToGeodeticHeightN = new Cartesian3_default();
  32734. var scaleToGeodeticHeightP = new Cartesian3_default();
  32735. var PolygonPipeline = {};
  32736. PolygonPipeline.computeArea2D = function(positions) {
  32737. Check_default.defined("positions", positions);
  32738. Check_default.typeOf.number.greaterThanOrEquals(
  32739. "positions.length",
  32740. positions.length,
  32741. 3
  32742. );
  32743. const length3 = positions.length;
  32744. let area2 = 0;
  32745. for (let i0 = length3 - 1, i1 = 0; i1 < length3; i0 = i1++) {
  32746. const v02 = positions[i0];
  32747. const v13 = positions[i1];
  32748. area2 += v02.x * v13.y - v13.x * v02.y;
  32749. }
  32750. return area2 * 0.5;
  32751. };
  32752. PolygonPipeline.computeWindingOrder2D = function(positions) {
  32753. const area2 = PolygonPipeline.computeArea2D(positions);
  32754. return area2 > 0 ? WindingOrder_default.COUNTER_CLOCKWISE : WindingOrder_default.CLOCKWISE;
  32755. };
  32756. PolygonPipeline.triangulate = function(positions, holes) {
  32757. Check_default.defined("positions", positions);
  32758. const flattenedPositions = Cartesian2_default.packArray(positions);
  32759. return earcut_1(flattenedPositions, holes, 2);
  32760. };
  32761. var subdivisionV0Scratch = new Cartesian3_default();
  32762. var subdivisionV1Scratch = new Cartesian3_default();
  32763. var subdivisionV2Scratch = new Cartesian3_default();
  32764. var subdivisionS0Scratch = new Cartesian3_default();
  32765. var subdivisionS1Scratch = new Cartesian3_default();
  32766. var subdivisionS2Scratch = new Cartesian3_default();
  32767. var subdivisionMidScratch = new Cartesian3_default();
  32768. PolygonPipeline.computeSubdivision = function(ellipsoid, positions, indices2, granularity) {
  32769. granularity = defaultValue_default(granularity, Math_default.RADIANS_PER_DEGREE);
  32770. Check_default.typeOf.object("ellipsoid", ellipsoid);
  32771. Check_default.defined("positions", positions);
  32772. Check_default.defined("indices", indices2);
  32773. Check_default.typeOf.number.greaterThanOrEquals("indices.length", indices2.length, 3);
  32774. Check_default.typeOf.number.equals("indices.length % 3", "0", indices2.length % 3, 0);
  32775. Check_default.typeOf.number.greaterThan("granularity", granularity, 0);
  32776. const triangles = indices2.slice(0);
  32777. let i2;
  32778. const length3 = positions.length;
  32779. const subdividedPositions = new Array(length3 * 3);
  32780. let q = 0;
  32781. for (i2 = 0; i2 < length3; i2++) {
  32782. const item = positions[i2];
  32783. subdividedPositions[q++] = item.x;
  32784. subdividedPositions[q++] = item.y;
  32785. subdividedPositions[q++] = item.z;
  32786. }
  32787. const subdividedIndices = [];
  32788. const edges = {};
  32789. const radius = ellipsoid.maximumRadius;
  32790. const minDistance = Math_default.chordLength(granularity, radius);
  32791. const minDistanceSqrd = minDistance * minDistance;
  32792. while (triangles.length > 0) {
  32793. const i22 = triangles.pop();
  32794. const i1 = triangles.pop();
  32795. const i0 = triangles.pop();
  32796. const v02 = Cartesian3_default.fromArray(
  32797. subdividedPositions,
  32798. i0 * 3,
  32799. subdivisionV0Scratch
  32800. );
  32801. const v13 = Cartesian3_default.fromArray(
  32802. subdividedPositions,
  32803. i1 * 3,
  32804. subdivisionV1Scratch
  32805. );
  32806. const v23 = Cartesian3_default.fromArray(
  32807. subdividedPositions,
  32808. i22 * 3,
  32809. subdivisionV2Scratch
  32810. );
  32811. const s0 = Cartesian3_default.multiplyByScalar(
  32812. Cartesian3_default.normalize(v02, subdivisionS0Scratch),
  32813. radius,
  32814. subdivisionS0Scratch
  32815. );
  32816. const s1 = Cartesian3_default.multiplyByScalar(
  32817. Cartesian3_default.normalize(v13, subdivisionS1Scratch),
  32818. radius,
  32819. subdivisionS1Scratch
  32820. );
  32821. const s2 = Cartesian3_default.multiplyByScalar(
  32822. Cartesian3_default.normalize(v23, subdivisionS2Scratch),
  32823. radius,
  32824. subdivisionS2Scratch
  32825. );
  32826. const g0 = Cartesian3_default.magnitudeSquared(
  32827. Cartesian3_default.subtract(s0, s1, subdivisionMidScratch)
  32828. );
  32829. const g1 = Cartesian3_default.magnitudeSquared(
  32830. Cartesian3_default.subtract(s1, s2, subdivisionMidScratch)
  32831. );
  32832. const g2 = Cartesian3_default.magnitudeSquared(
  32833. Cartesian3_default.subtract(s2, s0, subdivisionMidScratch)
  32834. );
  32835. const max3 = Math.max(g0, g1, g2);
  32836. let edge;
  32837. let mid;
  32838. if (max3 > minDistanceSqrd) {
  32839. if (g0 === max3) {
  32840. edge = `${Math.min(i0, i1)} ${Math.max(i0, i1)}`;
  32841. i2 = edges[edge];
  32842. if (!defined_default(i2)) {
  32843. mid = Cartesian3_default.add(v02, v13, subdivisionMidScratch);
  32844. Cartesian3_default.multiplyByScalar(mid, 0.5, mid);
  32845. subdividedPositions.push(mid.x, mid.y, mid.z);
  32846. i2 = subdividedPositions.length / 3 - 1;
  32847. edges[edge] = i2;
  32848. }
  32849. triangles.push(i0, i2, i22);
  32850. triangles.push(i2, i1, i22);
  32851. } else if (g1 === max3) {
  32852. edge = `${Math.min(i1, i22)} ${Math.max(i1, i22)}`;
  32853. i2 = edges[edge];
  32854. if (!defined_default(i2)) {
  32855. mid = Cartesian3_default.add(v13, v23, subdivisionMidScratch);
  32856. Cartesian3_default.multiplyByScalar(mid, 0.5, mid);
  32857. subdividedPositions.push(mid.x, mid.y, mid.z);
  32858. i2 = subdividedPositions.length / 3 - 1;
  32859. edges[edge] = i2;
  32860. }
  32861. triangles.push(i1, i2, i0);
  32862. triangles.push(i2, i22, i0);
  32863. } else if (g2 === max3) {
  32864. edge = `${Math.min(i22, i0)} ${Math.max(i22, i0)}`;
  32865. i2 = edges[edge];
  32866. if (!defined_default(i2)) {
  32867. mid = Cartesian3_default.add(v23, v02, subdivisionMidScratch);
  32868. Cartesian3_default.multiplyByScalar(mid, 0.5, mid);
  32869. subdividedPositions.push(mid.x, mid.y, mid.z);
  32870. i2 = subdividedPositions.length / 3 - 1;
  32871. edges[edge] = i2;
  32872. }
  32873. triangles.push(i22, i2, i1);
  32874. triangles.push(i2, i0, i1);
  32875. }
  32876. } else {
  32877. subdividedIndices.push(i0);
  32878. subdividedIndices.push(i1);
  32879. subdividedIndices.push(i22);
  32880. }
  32881. }
  32882. return new Geometry_default({
  32883. attributes: {
  32884. position: new GeometryAttribute_default({
  32885. componentDatatype: ComponentDatatype_default.DOUBLE,
  32886. componentsPerAttribute: 3,
  32887. values: subdividedPositions
  32888. })
  32889. },
  32890. indices: subdividedIndices,
  32891. primitiveType: PrimitiveType_default.TRIANGLES
  32892. });
  32893. };
  32894. var subdivisionC0Scratch = new Cartographic_default();
  32895. var subdivisionC1Scratch = new Cartographic_default();
  32896. var subdivisionC2Scratch = new Cartographic_default();
  32897. var subdivisionCartographicScratch = new Cartographic_default();
  32898. PolygonPipeline.computeRhumbLineSubdivision = function(ellipsoid, positions, indices2, granularity) {
  32899. granularity = defaultValue_default(granularity, Math_default.RADIANS_PER_DEGREE);
  32900. Check_default.typeOf.object("ellipsoid", ellipsoid);
  32901. Check_default.defined("positions", positions);
  32902. Check_default.defined("indices", indices2);
  32903. Check_default.typeOf.number.greaterThanOrEquals("indices.length", indices2.length, 3);
  32904. Check_default.typeOf.number.equals("indices.length % 3", "0", indices2.length % 3, 0);
  32905. Check_default.typeOf.number.greaterThan("granularity", granularity, 0);
  32906. const triangles = indices2.slice(0);
  32907. let i2;
  32908. const length3 = positions.length;
  32909. const subdividedPositions = new Array(length3 * 3);
  32910. let q = 0;
  32911. for (i2 = 0; i2 < length3; i2++) {
  32912. const item = positions[i2];
  32913. subdividedPositions[q++] = item.x;
  32914. subdividedPositions[q++] = item.y;
  32915. subdividedPositions[q++] = item.z;
  32916. }
  32917. const subdividedIndices = [];
  32918. const edges = {};
  32919. const radius = ellipsoid.maximumRadius;
  32920. const minDistance = Math_default.chordLength(granularity, radius);
  32921. const rhumb0 = new EllipsoidRhumbLine_default(void 0, void 0, ellipsoid);
  32922. const rhumb1 = new EllipsoidRhumbLine_default(void 0, void 0, ellipsoid);
  32923. const rhumb2 = new EllipsoidRhumbLine_default(void 0, void 0, ellipsoid);
  32924. while (triangles.length > 0) {
  32925. const i22 = triangles.pop();
  32926. const i1 = triangles.pop();
  32927. const i0 = triangles.pop();
  32928. const v02 = Cartesian3_default.fromArray(
  32929. subdividedPositions,
  32930. i0 * 3,
  32931. subdivisionV0Scratch
  32932. );
  32933. const v13 = Cartesian3_default.fromArray(
  32934. subdividedPositions,
  32935. i1 * 3,
  32936. subdivisionV1Scratch
  32937. );
  32938. const v23 = Cartesian3_default.fromArray(
  32939. subdividedPositions,
  32940. i22 * 3,
  32941. subdivisionV2Scratch
  32942. );
  32943. const c0 = ellipsoid.cartesianToCartographic(v02, subdivisionC0Scratch);
  32944. const c14 = ellipsoid.cartesianToCartographic(v13, subdivisionC1Scratch);
  32945. const c22 = ellipsoid.cartesianToCartographic(v23, subdivisionC2Scratch);
  32946. rhumb0.setEndPoints(c0, c14);
  32947. const g0 = rhumb0.surfaceDistance;
  32948. rhumb1.setEndPoints(c14, c22);
  32949. const g1 = rhumb1.surfaceDistance;
  32950. rhumb2.setEndPoints(c22, c0);
  32951. const g2 = rhumb2.surfaceDistance;
  32952. const max3 = Math.max(g0, g1, g2);
  32953. let edge;
  32954. let mid;
  32955. let midHeight;
  32956. let midCartesian3;
  32957. if (max3 > minDistance) {
  32958. if (g0 === max3) {
  32959. edge = `${Math.min(i0, i1)} ${Math.max(i0, i1)}`;
  32960. i2 = edges[edge];
  32961. if (!defined_default(i2)) {
  32962. mid = rhumb0.interpolateUsingFraction(
  32963. 0.5,
  32964. subdivisionCartographicScratch
  32965. );
  32966. midHeight = (c0.height + c14.height) * 0.5;
  32967. midCartesian3 = Cartesian3_default.fromRadians(
  32968. mid.longitude,
  32969. mid.latitude,
  32970. midHeight,
  32971. ellipsoid,
  32972. subdivisionMidScratch
  32973. );
  32974. subdividedPositions.push(
  32975. midCartesian3.x,
  32976. midCartesian3.y,
  32977. midCartesian3.z
  32978. );
  32979. i2 = subdividedPositions.length / 3 - 1;
  32980. edges[edge] = i2;
  32981. }
  32982. triangles.push(i0, i2, i22);
  32983. triangles.push(i2, i1, i22);
  32984. } else if (g1 === max3) {
  32985. edge = `${Math.min(i1, i22)} ${Math.max(i1, i22)}`;
  32986. i2 = edges[edge];
  32987. if (!defined_default(i2)) {
  32988. mid = rhumb1.interpolateUsingFraction(
  32989. 0.5,
  32990. subdivisionCartographicScratch
  32991. );
  32992. midHeight = (c14.height + c22.height) * 0.5;
  32993. midCartesian3 = Cartesian3_default.fromRadians(
  32994. mid.longitude,
  32995. mid.latitude,
  32996. midHeight,
  32997. ellipsoid,
  32998. subdivisionMidScratch
  32999. );
  33000. subdividedPositions.push(
  33001. midCartesian3.x,
  33002. midCartesian3.y,
  33003. midCartesian3.z
  33004. );
  33005. i2 = subdividedPositions.length / 3 - 1;
  33006. edges[edge] = i2;
  33007. }
  33008. triangles.push(i1, i2, i0);
  33009. triangles.push(i2, i22, i0);
  33010. } else if (g2 === max3) {
  33011. edge = `${Math.min(i22, i0)} ${Math.max(i22, i0)}`;
  33012. i2 = edges[edge];
  33013. if (!defined_default(i2)) {
  33014. mid = rhumb2.interpolateUsingFraction(
  33015. 0.5,
  33016. subdivisionCartographicScratch
  33017. );
  33018. midHeight = (c22.height + c0.height) * 0.5;
  33019. midCartesian3 = Cartesian3_default.fromRadians(
  33020. mid.longitude,
  33021. mid.latitude,
  33022. midHeight,
  33023. ellipsoid,
  33024. subdivisionMidScratch
  33025. );
  33026. subdividedPositions.push(
  33027. midCartesian3.x,
  33028. midCartesian3.y,
  33029. midCartesian3.z
  33030. );
  33031. i2 = subdividedPositions.length / 3 - 1;
  33032. edges[edge] = i2;
  33033. }
  33034. triangles.push(i22, i2, i1);
  33035. triangles.push(i2, i0, i1);
  33036. }
  33037. } else {
  33038. subdividedIndices.push(i0);
  33039. subdividedIndices.push(i1);
  33040. subdividedIndices.push(i22);
  33041. }
  33042. }
  33043. return new Geometry_default({
  33044. attributes: {
  33045. position: new GeometryAttribute_default({
  33046. componentDatatype: ComponentDatatype_default.DOUBLE,
  33047. componentsPerAttribute: 3,
  33048. values: subdividedPositions
  33049. })
  33050. },
  33051. indices: subdividedIndices,
  33052. primitiveType: PrimitiveType_default.TRIANGLES
  33053. });
  33054. };
  33055. PolygonPipeline.scaleToGeodeticHeight = function(positions, height, ellipsoid, scaleToSurface4) {
  33056. ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  33057. let n2 = scaleToGeodeticHeightN;
  33058. let p2 = scaleToGeodeticHeightP;
  33059. height = defaultValue_default(height, 0);
  33060. scaleToSurface4 = defaultValue_default(scaleToSurface4, true);
  33061. if (defined_default(positions)) {
  33062. const length3 = positions.length;
  33063. for (let i2 = 0; i2 < length3; i2 += 3) {
  33064. Cartesian3_default.fromArray(positions, i2, p2);
  33065. if (scaleToSurface4) {
  33066. p2 = ellipsoid.scaleToGeodeticSurface(p2, p2);
  33067. }
  33068. if (height !== 0) {
  33069. n2 = ellipsoid.geodeticSurfaceNormal(p2, n2);
  33070. Cartesian3_default.multiplyByScalar(n2, height, n2);
  33071. Cartesian3_default.add(p2, n2, p2);
  33072. }
  33073. positions[i2] = p2.x;
  33074. positions[i2 + 1] = p2.y;
  33075. positions[i2 + 2] = p2.z;
  33076. }
  33077. }
  33078. return positions;
  33079. };
  33080. var PolygonPipeline_default = PolygonPipeline;
  33081. // node_modules/cesium/Source/Core/Queue.js
  33082. function Queue() {
  33083. this._array = [];
  33084. this._offset = 0;
  33085. this._length = 0;
  33086. }
  33087. Object.defineProperties(Queue.prototype, {
  33088. length: {
  33089. get: function() {
  33090. return this._length;
  33091. }
  33092. }
  33093. });
  33094. Queue.prototype.enqueue = function(item) {
  33095. this._array.push(item);
  33096. this._length++;
  33097. };
  33098. Queue.prototype.dequeue = function() {
  33099. if (this._length === 0) {
  33100. return void 0;
  33101. }
  33102. const array = this._array;
  33103. let offset2 = this._offset;
  33104. const item = array[offset2];
  33105. array[offset2] = void 0;
  33106. offset2++;
  33107. if (offset2 > 10 && offset2 * 2 > array.length) {
  33108. this._array = array.slice(offset2);
  33109. offset2 = 0;
  33110. }
  33111. this._offset = offset2;
  33112. this._length--;
  33113. return item;
  33114. };
  33115. Queue.prototype.peek = function() {
  33116. if (this._length === 0) {
  33117. return void 0;
  33118. }
  33119. return this._array[this._offset];
  33120. };
  33121. Queue.prototype.contains = function(item) {
  33122. return this._array.indexOf(item) !== -1;
  33123. };
  33124. Queue.prototype.clear = function() {
  33125. this._array.length = this._offset = this._length = 0;
  33126. };
  33127. Queue.prototype.sort = function(compareFunction) {
  33128. if (this._offset > 0) {
  33129. this._array = this._array.slice(this._offset);
  33130. this._offset = 0;
  33131. }
  33132. this._array.sort(compareFunction);
  33133. };
  33134. var Queue_default = Queue;
  33135. // node_modules/cesium/Source/Core/PolygonGeometryLibrary.js
  33136. var PolygonGeometryLibrary = {};
  33137. PolygonGeometryLibrary.computeHierarchyPackedLength = function(polygonHierarchy) {
  33138. let numComponents = 0;
  33139. const stack = [polygonHierarchy];
  33140. while (stack.length > 0) {
  33141. const hierarchy = stack.pop();
  33142. if (!defined_default(hierarchy)) {
  33143. continue;
  33144. }
  33145. numComponents += 2;
  33146. const positions = hierarchy.positions;
  33147. const holes = hierarchy.holes;
  33148. if (defined_default(positions)) {
  33149. numComponents += positions.length * Cartesian3_default.packedLength;
  33150. }
  33151. if (defined_default(holes)) {
  33152. const length3 = holes.length;
  33153. for (let i2 = 0; i2 < length3; ++i2) {
  33154. stack.push(holes[i2]);
  33155. }
  33156. }
  33157. }
  33158. return numComponents;
  33159. };
  33160. PolygonGeometryLibrary.packPolygonHierarchy = function(polygonHierarchy, array, startingIndex) {
  33161. const stack = [polygonHierarchy];
  33162. while (stack.length > 0) {
  33163. const hierarchy = stack.pop();
  33164. if (!defined_default(hierarchy)) {
  33165. continue;
  33166. }
  33167. const positions = hierarchy.positions;
  33168. const holes = hierarchy.holes;
  33169. array[startingIndex++] = defined_default(positions) ? positions.length : 0;
  33170. array[startingIndex++] = defined_default(holes) ? holes.length : 0;
  33171. if (defined_default(positions)) {
  33172. const positionsLength = positions.length;
  33173. for (let i2 = 0; i2 < positionsLength; ++i2, startingIndex += 3) {
  33174. Cartesian3_default.pack(positions[i2], array, startingIndex);
  33175. }
  33176. }
  33177. if (defined_default(holes)) {
  33178. const holesLength = holes.length;
  33179. for (let j = 0; j < holesLength; ++j) {
  33180. stack.push(holes[j]);
  33181. }
  33182. }
  33183. }
  33184. return startingIndex;
  33185. };
  33186. PolygonGeometryLibrary.unpackPolygonHierarchy = function(array, startingIndex) {
  33187. const positionsLength = array[startingIndex++];
  33188. const holesLength = array[startingIndex++];
  33189. const positions = new Array(positionsLength);
  33190. const holes = holesLength > 0 ? new Array(holesLength) : void 0;
  33191. for (let i2 = 0; i2 < positionsLength; ++i2, startingIndex += Cartesian3_default.packedLength) {
  33192. positions[i2] = Cartesian3_default.unpack(array, startingIndex);
  33193. }
  33194. for (let j = 0; j < holesLength; ++j) {
  33195. holes[j] = PolygonGeometryLibrary.unpackPolygonHierarchy(
  33196. array,
  33197. startingIndex
  33198. );
  33199. startingIndex = holes[j].startingIndex;
  33200. delete holes[j].startingIndex;
  33201. }
  33202. return {
  33203. positions,
  33204. holes,
  33205. startingIndex
  33206. };
  33207. };
  33208. var distanceScratch4 = new Cartesian3_default();
  33209. function getPointAtDistance(p0, p1, distance2, length3) {
  33210. Cartesian3_default.subtract(p1, p0, distanceScratch4);
  33211. Cartesian3_default.multiplyByScalar(
  33212. distanceScratch4,
  33213. distance2 / length3,
  33214. distanceScratch4
  33215. );
  33216. Cartesian3_default.add(p0, distanceScratch4, distanceScratch4);
  33217. return [distanceScratch4.x, distanceScratch4.y, distanceScratch4.z];
  33218. }
  33219. PolygonGeometryLibrary.subdivideLineCount = function(p0, p1, minDistance) {
  33220. const distance2 = Cartesian3_default.distance(p0, p1);
  33221. const n2 = distance2 / minDistance;
  33222. const countDivide = Math.max(0, Math.ceil(Math_default.log2(n2)));
  33223. return Math.pow(2, countDivide);
  33224. };
  33225. var scratchCartographic0 = new Cartographic_default();
  33226. var scratchCartographic1 = new Cartographic_default();
  33227. var scratchCartographic22 = new Cartographic_default();
  33228. var scratchCartesian0 = new Cartesian3_default();
  33229. PolygonGeometryLibrary.subdivideRhumbLineCount = function(ellipsoid, p0, p1, minDistance) {
  33230. const c0 = ellipsoid.cartesianToCartographic(p0, scratchCartographic0);
  33231. const c14 = ellipsoid.cartesianToCartographic(p1, scratchCartographic1);
  33232. const rhumb = new EllipsoidRhumbLine_default(c0, c14, ellipsoid);
  33233. const n2 = rhumb.surfaceDistance / minDistance;
  33234. const countDivide = Math.max(0, Math.ceil(Math_default.log2(n2)));
  33235. return Math.pow(2, countDivide);
  33236. };
  33237. PolygonGeometryLibrary.subdivideLine = function(p0, p1, minDistance, result) {
  33238. const numVertices = PolygonGeometryLibrary.subdivideLineCount(
  33239. p0,
  33240. p1,
  33241. minDistance
  33242. );
  33243. const length3 = Cartesian3_default.distance(p0, p1);
  33244. const distanceBetweenVertices = length3 / numVertices;
  33245. if (!defined_default(result)) {
  33246. result = [];
  33247. }
  33248. const positions = result;
  33249. positions.length = numVertices * 3;
  33250. let index2 = 0;
  33251. for (let i2 = 0; i2 < numVertices; i2++) {
  33252. const p2 = getPointAtDistance(p0, p1, i2 * distanceBetweenVertices, length3);
  33253. positions[index2++] = p2[0];
  33254. positions[index2++] = p2[1];
  33255. positions[index2++] = p2[2];
  33256. }
  33257. return positions;
  33258. };
  33259. PolygonGeometryLibrary.subdivideRhumbLine = function(ellipsoid, p0, p1, minDistance, result) {
  33260. const c0 = ellipsoid.cartesianToCartographic(p0, scratchCartographic0);
  33261. const c14 = ellipsoid.cartesianToCartographic(p1, scratchCartographic1);
  33262. const rhumb = new EllipsoidRhumbLine_default(c0, c14, ellipsoid);
  33263. const n2 = rhumb.surfaceDistance / minDistance;
  33264. const countDivide = Math.max(0, Math.ceil(Math_default.log2(n2)));
  33265. const numVertices = Math.pow(2, countDivide);
  33266. const distanceBetweenVertices = rhumb.surfaceDistance / numVertices;
  33267. if (!defined_default(result)) {
  33268. result = [];
  33269. }
  33270. const positions = result;
  33271. positions.length = numVertices * 3;
  33272. let index2 = 0;
  33273. for (let i2 = 0; i2 < numVertices; i2++) {
  33274. const c15 = rhumb.interpolateUsingSurfaceDistance(
  33275. i2 * distanceBetweenVertices,
  33276. scratchCartographic22
  33277. );
  33278. const p2 = ellipsoid.cartographicToCartesian(c15, scratchCartesian0);
  33279. positions[index2++] = p2.x;
  33280. positions[index2++] = p2.y;
  33281. positions[index2++] = p2.z;
  33282. }
  33283. return positions;
  33284. };
  33285. var scaleToGeodeticHeightN1 = new Cartesian3_default();
  33286. var scaleToGeodeticHeightN2 = new Cartesian3_default();
  33287. var scaleToGeodeticHeightP1 = new Cartesian3_default();
  33288. var scaleToGeodeticHeightP2 = new Cartesian3_default();
  33289. PolygonGeometryLibrary.scaleToGeodeticHeightExtruded = function(geometry, maxHeight, minHeight, ellipsoid, perPositionHeight) {
  33290. ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  33291. const n1 = scaleToGeodeticHeightN1;
  33292. let n2 = scaleToGeodeticHeightN2;
  33293. const p2 = scaleToGeodeticHeightP1;
  33294. let p22 = scaleToGeodeticHeightP2;
  33295. if (defined_default(geometry) && defined_default(geometry.attributes) && defined_default(geometry.attributes.position)) {
  33296. const positions = geometry.attributes.position.values;
  33297. const length3 = positions.length / 2;
  33298. for (let i2 = 0; i2 < length3; i2 += 3) {
  33299. Cartesian3_default.fromArray(positions, i2, p2);
  33300. ellipsoid.geodeticSurfaceNormal(p2, n1);
  33301. p22 = ellipsoid.scaleToGeodeticSurface(p2, p22);
  33302. n2 = Cartesian3_default.multiplyByScalar(n1, minHeight, n2);
  33303. n2 = Cartesian3_default.add(p22, n2, n2);
  33304. positions[i2 + length3] = n2.x;
  33305. positions[i2 + 1 + length3] = n2.y;
  33306. positions[i2 + 2 + length3] = n2.z;
  33307. if (perPositionHeight) {
  33308. p22 = Cartesian3_default.clone(p2, p22);
  33309. }
  33310. n2 = Cartesian3_default.multiplyByScalar(n1, maxHeight, n2);
  33311. n2 = Cartesian3_default.add(p22, n2, n2);
  33312. positions[i2] = n2.x;
  33313. positions[i2 + 1] = n2.y;
  33314. positions[i2 + 2] = n2.z;
  33315. }
  33316. }
  33317. return geometry;
  33318. };
  33319. PolygonGeometryLibrary.polygonOutlinesFromHierarchy = function(polygonHierarchy, scaleToEllipsoidSurface, ellipsoid) {
  33320. const polygons = [];
  33321. const queue = new Queue_default();
  33322. queue.enqueue(polygonHierarchy);
  33323. let i2;
  33324. let j;
  33325. let length3;
  33326. while (queue.length !== 0) {
  33327. const outerNode = queue.dequeue();
  33328. let outerRing = outerNode.positions;
  33329. if (scaleToEllipsoidSurface) {
  33330. length3 = outerRing.length;
  33331. for (i2 = 0; i2 < length3; i2++) {
  33332. ellipsoid.scaleToGeodeticSurface(outerRing[i2], outerRing[i2]);
  33333. }
  33334. }
  33335. outerRing = arrayRemoveDuplicates_default(
  33336. outerRing,
  33337. Cartesian3_default.equalsEpsilon,
  33338. true
  33339. );
  33340. if (outerRing.length < 3) {
  33341. continue;
  33342. }
  33343. const numChildren = outerNode.holes ? outerNode.holes.length : 0;
  33344. for (i2 = 0; i2 < numChildren; i2++) {
  33345. const hole = outerNode.holes[i2];
  33346. let holePositions = hole.positions;
  33347. if (scaleToEllipsoidSurface) {
  33348. length3 = holePositions.length;
  33349. for (j = 0; j < length3; ++j) {
  33350. ellipsoid.scaleToGeodeticSurface(holePositions[j], holePositions[j]);
  33351. }
  33352. }
  33353. holePositions = arrayRemoveDuplicates_default(
  33354. holePositions,
  33355. Cartesian3_default.equalsEpsilon,
  33356. true
  33357. );
  33358. if (holePositions.length < 3) {
  33359. continue;
  33360. }
  33361. polygons.push(holePositions);
  33362. let numGrandchildren = 0;
  33363. if (defined_default(hole.holes)) {
  33364. numGrandchildren = hole.holes.length;
  33365. }
  33366. for (j = 0; j < numGrandchildren; j++) {
  33367. queue.enqueue(hole.holes[j]);
  33368. }
  33369. }
  33370. polygons.push(outerRing);
  33371. }
  33372. return polygons;
  33373. };
  33374. PolygonGeometryLibrary.polygonsFromHierarchy = function(polygonHierarchy, projectPointsTo2D, scaleToEllipsoidSurface, ellipsoid) {
  33375. const hierarchy = [];
  33376. const polygons = [];
  33377. const queue = new Queue_default();
  33378. queue.enqueue(polygonHierarchy);
  33379. while (queue.length !== 0) {
  33380. const outerNode = queue.dequeue();
  33381. let outerRing = outerNode.positions;
  33382. const holes = outerNode.holes;
  33383. let i2;
  33384. let length3;
  33385. if (scaleToEllipsoidSurface) {
  33386. length3 = outerRing.length;
  33387. for (i2 = 0; i2 < length3; i2++) {
  33388. ellipsoid.scaleToGeodeticSurface(outerRing[i2], outerRing[i2]);
  33389. }
  33390. }
  33391. outerRing = arrayRemoveDuplicates_default(
  33392. outerRing,
  33393. Cartesian3_default.equalsEpsilon,
  33394. true
  33395. );
  33396. if (outerRing.length < 3) {
  33397. continue;
  33398. }
  33399. let positions2D = projectPointsTo2D(outerRing);
  33400. if (!defined_default(positions2D)) {
  33401. continue;
  33402. }
  33403. const holeIndices = [];
  33404. let originalWindingOrder = PolygonPipeline_default.computeWindingOrder2D(
  33405. positions2D
  33406. );
  33407. if (originalWindingOrder === WindingOrder_default.CLOCKWISE) {
  33408. positions2D.reverse();
  33409. outerRing = outerRing.slice().reverse();
  33410. }
  33411. let positions = outerRing.slice();
  33412. const numChildren = defined_default(holes) ? holes.length : 0;
  33413. const polygonHoles = [];
  33414. let j;
  33415. for (i2 = 0; i2 < numChildren; i2++) {
  33416. const hole = holes[i2];
  33417. let holePositions = hole.positions;
  33418. if (scaleToEllipsoidSurface) {
  33419. length3 = holePositions.length;
  33420. for (j = 0; j < length3; ++j) {
  33421. ellipsoid.scaleToGeodeticSurface(holePositions[j], holePositions[j]);
  33422. }
  33423. }
  33424. holePositions = arrayRemoveDuplicates_default(
  33425. holePositions,
  33426. Cartesian3_default.equalsEpsilon,
  33427. true
  33428. );
  33429. if (holePositions.length < 3) {
  33430. continue;
  33431. }
  33432. const holePositions2D = projectPointsTo2D(holePositions);
  33433. if (!defined_default(holePositions2D)) {
  33434. continue;
  33435. }
  33436. originalWindingOrder = PolygonPipeline_default.computeWindingOrder2D(
  33437. holePositions2D
  33438. );
  33439. if (originalWindingOrder === WindingOrder_default.CLOCKWISE) {
  33440. holePositions2D.reverse();
  33441. holePositions = holePositions.slice().reverse();
  33442. }
  33443. polygonHoles.push(holePositions);
  33444. holeIndices.push(positions.length);
  33445. positions = positions.concat(holePositions);
  33446. positions2D = positions2D.concat(holePositions2D);
  33447. let numGrandchildren = 0;
  33448. if (defined_default(hole.holes)) {
  33449. numGrandchildren = hole.holes.length;
  33450. }
  33451. for (j = 0; j < numGrandchildren; j++) {
  33452. queue.enqueue(hole.holes[j]);
  33453. }
  33454. }
  33455. hierarchy.push({
  33456. outerRing,
  33457. holes: polygonHoles
  33458. });
  33459. polygons.push({
  33460. positions,
  33461. positions2D,
  33462. holes: holeIndices
  33463. });
  33464. }
  33465. return {
  33466. hierarchy,
  33467. polygons
  33468. };
  33469. };
  33470. var computeBoundingRectangleCartesian2 = new Cartesian2_default();
  33471. var computeBoundingRectangleCartesian3 = new Cartesian3_default();
  33472. var computeBoundingRectangleQuaternion = new Quaternion_default();
  33473. var computeBoundingRectangleMatrix3 = new Matrix3_default();
  33474. PolygonGeometryLibrary.computeBoundingRectangle = function(planeNormal, projectPointTo2D, positions, angle, result) {
  33475. const rotation = Quaternion_default.fromAxisAngle(
  33476. planeNormal,
  33477. angle,
  33478. computeBoundingRectangleQuaternion
  33479. );
  33480. const textureMatrix = Matrix3_default.fromQuaternion(
  33481. rotation,
  33482. computeBoundingRectangleMatrix3
  33483. );
  33484. let minX = Number.POSITIVE_INFINITY;
  33485. let maxX = Number.NEGATIVE_INFINITY;
  33486. let minY = Number.POSITIVE_INFINITY;
  33487. let maxY = Number.NEGATIVE_INFINITY;
  33488. const length3 = positions.length;
  33489. for (let i2 = 0; i2 < length3; ++i2) {
  33490. const p2 = Cartesian3_default.clone(
  33491. positions[i2],
  33492. computeBoundingRectangleCartesian3
  33493. );
  33494. Matrix3_default.multiplyByVector(textureMatrix, p2, p2);
  33495. const st = projectPointTo2D(p2, computeBoundingRectangleCartesian2);
  33496. if (defined_default(st)) {
  33497. minX = Math.min(minX, st.x);
  33498. maxX = Math.max(maxX, st.x);
  33499. minY = Math.min(minY, st.y);
  33500. maxY = Math.max(maxY, st.y);
  33501. }
  33502. }
  33503. result.x = minX;
  33504. result.y = minY;
  33505. result.width = maxX - minX;
  33506. result.height = maxY - minY;
  33507. return result;
  33508. };
  33509. PolygonGeometryLibrary.createGeometryFromPositions = function(ellipsoid, polygon, granularity, perPositionHeight, vertexFormat, arcType) {
  33510. let indices2 = PolygonPipeline_default.triangulate(polygon.positions2D, polygon.holes);
  33511. if (indices2.length < 3) {
  33512. indices2 = [0, 1, 2];
  33513. }
  33514. const positions = polygon.positions;
  33515. if (perPositionHeight) {
  33516. const length3 = positions.length;
  33517. const flattenedPositions = new Array(length3 * 3);
  33518. let index2 = 0;
  33519. for (let i2 = 0; i2 < length3; i2++) {
  33520. const p2 = positions[i2];
  33521. flattenedPositions[index2++] = p2.x;
  33522. flattenedPositions[index2++] = p2.y;
  33523. flattenedPositions[index2++] = p2.z;
  33524. }
  33525. const geometry = new Geometry_default({
  33526. attributes: {
  33527. position: new GeometryAttribute_default({
  33528. componentDatatype: ComponentDatatype_default.DOUBLE,
  33529. componentsPerAttribute: 3,
  33530. values: flattenedPositions
  33531. })
  33532. },
  33533. indices: indices2,
  33534. primitiveType: PrimitiveType_default.TRIANGLES
  33535. });
  33536. if (vertexFormat.normal) {
  33537. return GeometryPipeline_default.computeNormal(geometry);
  33538. }
  33539. return geometry;
  33540. }
  33541. if (arcType === ArcType_default.GEODESIC) {
  33542. return PolygonPipeline_default.computeSubdivision(
  33543. ellipsoid,
  33544. positions,
  33545. indices2,
  33546. granularity
  33547. );
  33548. } else if (arcType === ArcType_default.RHUMB) {
  33549. return PolygonPipeline_default.computeRhumbLineSubdivision(
  33550. ellipsoid,
  33551. positions,
  33552. indices2,
  33553. granularity
  33554. );
  33555. }
  33556. };
  33557. var computeWallIndicesSubdivided = [];
  33558. var p1Scratch2 = new Cartesian3_default();
  33559. var p2Scratch2 = new Cartesian3_default();
  33560. PolygonGeometryLibrary.computeWallGeometry = function(positions, ellipsoid, granularity, perPositionHeight, arcType) {
  33561. let edgePositions;
  33562. let topEdgeLength;
  33563. let i2;
  33564. let p1;
  33565. let p2;
  33566. let length3 = positions.length;
  33567. let index2 = 0;
  33568. if (!perPositionHeight) {
  33569. const minDistance = Math_default.chordLength(
  33570. granularity,
  33571. ellipsoid.maximumRadius
  33572. );
  33573. let numVertices = 0;
  33574. if (arcType === ArcType_default.GEODESIC) {
  33575. for (i2 = 0; i2 < length3; i2++) {
  33576. numVertices += PolygonGeometryLibrary.subdivideLineCount(
  33577. positions[i2],
  33578. positions[(i2 + 1) % length3],
  33579. minDistance
  33580. );
  33581. }
  33582. } else if (arcType === ArcType_default.RHUMB) {
  33583. for (i2 = 0; i2 < length3; i2++) {
  33584. numVertices += PolygonGeometryLibrary.subdivideRhumbLineCount(
  33585. ellipsoid,
  33586. positions[i2],
  33587. positions[(i2 + 1) % length3],
  33588. minDistance
  33589. );
  33590. }
  33591. }
  33592. topEdgeLength = (numVertices + length3) * 3;
  33593. edgePositions = new Array(topEdgeLength * 2);
  33594. for (i2 = 0; i2 < length3; i2++) {
  33595. p1 = positions[i2];
  33596. p2 = positions[(i2 + 1) % length3];
  33597. let tempPositions;
  33598. if (arcType === ArcType_default.GEODESIC) {
  33599. tempPositions = PolygonGeometryLibrary.subdivideLine(
  33600. p1,
  33601. p2,
  33602. minDistance,
  33603. computeWallIndicesSubdivided
  33604. );
  33605. } else if (arcType === ArcType_default.RHUMB) {
  33606. tempPositions = PolygonGeometryLibrary.subdivideRhumbLine(
  33607. ellipsoid,
  33608. p1,
  33609. p2,
  33610. minDistance,
  33611. computeWallIndicesSubdivided
  33612. );
  33613. }
  33614. const tempPositionsLength = tempPositions.length;
  33615. for (let j = 0; j < tempPositionsLength; ++j, ++index2) {
  33616. edgePositions[index2] = tempPositions[j];
  33617. edgePositions[index2 + topEdgeLength] = tempPositions[j];
  33618. }
  33619. edgePositions[index2] = p2.x;
  33620. edgePositions[index2 + topEdgeLength] = p2.x;
  33621. ++index2;
  33622. edgePositions[index2] = p2.y;
  33623. edgePositions[index2 + topEdgeLength] = p2.y;
  33624. ++index2;
  33625. edgePositions[index2] = p2.z;
  33626. edgePositions[index2 + topEdgeLength] = p2.z;
  33627. ++index2;
  33628. }
  33629. } else {
  33630. topEdgeLength = length3 * 3 * 2;
  33631. edgePositions = new Array(topEdgeLength * 2);
  33632. for (i2 = 0; i2 < length3; i2++) {
  33633. p1 = positions[i2];
  33634. p2 = positions[(i2 + 1) % length3];
  33635. edgePositions[index2] = edgePositions[index2 + topEdgeLength] = p1.x;
  33636. ++index2;
  33637. edgePositions[index2] = edgePositions[index2 + topEdgeLength] = p1.y;
  33638. ++index2;
  33639. edgePositions[index2] = edgePositions[index2 + topEdgeLength] = p1.z;
  33640. ++index2;
  33641. edgePositions[index2] = edgePositions[index2 + topEdgeLength] = p2.x;
  33642. ++index2;
  33643. edgePositions[index2] = edgePositions[index2 + topEdgeLength] = p2.y;
  33644. ++index2;
  33645. edgePositions[index2] = edgePositions[index2 + topEdgeLength] = p2.z;
  33646. ++index2;
  33647. }
  33648. }
  33649. length3 = edgePositions.length;
  33650. const indices2 = IndexDatatype_default.createTypedArray(
  33651. length3 / 3,
  33652. length3 - positions.length * 6
  33653. );
  33654. let edgeIndex = 0;
  33655. length3 /= 6;
  33656. for (i2 = 0; i2 < length3; i2++) {
  33657. const UL = i2;
  33658. const UR = UL + 1;
  33659. const LL = UL + length3;
  33660. const LR = LL + 1;
  33661. p1 = Cartesian3_default.fromArray(edgePositions, UL * 3, p1Scratch2);
  33662. p2 = Cartesian3_default.fromArray(edgePositions, UR * 3, p2Scratch2);
  33663. if (Cartesian3_default.equalsEpsilon(
  33664. p1,
  33665. p2,
  33666. Math_default.EPSILON10,
  33667. Math_default.EPSILON10
  33668. )) {
  33669. continue;
  33670. }
  33671. indices2[edgeIndex++] = UL;
  33672. indices2[edgeIndex++] = LL;
  33673. indices2[edgeIndex++] = UR;
  33674. indices2[edgeIndex++] = UR;
  33675. indices2[edgeIndex++] = LL;
  33676. indices2[edgeIndex++] = LR;
  33677. }
  33678. return new Geometry_default({
  33679. attributes: new GeometryAttributes_default({
  33680. position: new GeometryAttribute_default({
  33681. componentDatatype: ComponentDatatype_default.DOUBLE,
  33682. componentsPerAttribute: 3,
  33683. values: edgePositions
  33684. })
  33685. }),
  33686. indices: indices2,
  33687. primitiveType: PrimitiveType_default.TRIANGLES
  33688. });
  33689. };
  33690. var PolygonGeometryLibrary_default = PolygonGeometryLibrary;
  33691. // node_modules/cesium/Source/Core/CoplanarPolygonGeometry.js
  33692. var scratchPosition2 = new Cartesian3_default();
  33693. var scratchBR = new BoundingRectangle_default();
  33694. var stScratch = new Cartesian2_default();
  33695. var textureCoordinatesOrigin = new Cartesian2_default();
  33696. var scratchNormal4 = new Cartesian3_default();
  33697. var scratchTangent2 = new Cartesian3_default();
  33698. var scratchBitangent2 = new Cartesian3_default();
  33699. var centerScratch = new Cartesian3_default();
  33700. var axis1Scratch = new Cartesian3_default();
  33701. var axis2Scratch = new Cartesian3_default();
  33702. var quaternionScratch2 = new Quaternion_default();
  33703. var textureMatrixScratch2 = new Matrix3_default();
  33704. var tangentRotationScratch = new Matrix3_default();
  33705. var surfaceNormalScratch = new Cartesian3_default();
  33706. function createGeometryFromPolygon(polygon, vertexFormat, boundingRectangle, stRotation, projectPointTo2D, normal2, tangent, bitangent) {
  33707. const positions = polygon.positions;
  33708. let indices2 = PolygonPipeline_default.triangulate(polygon.positions2D, polygon.holes);
  33709. if (indices2.length < 3) {
  33710. indices2 = [0, 1, 2];
  33711. }
  33712. const newIndices = IndexDatatype_default.createTypedArray(
  33713. positions.length,
  33714. indices2.length
  33715. );
  33716. newIndices.set(indices2);
  33717. let textureMatrix = textureMatrixScratch2;
  33718. if (stRotation !== 0) {
  33719. let rotation = Quaternion_default.fromAxisAngle(
  33720. normal2,
  33721. stRotation,
  33722. quaternionScratch2
  33723. );
  33724. textureMatrix = Matrix3_default.fromQuaternion(rotation, textureMatrix);
  33725. if (vertexFormat.tangent || vertexFormat.bitangent) {
  33726. rotation = Quaternion_default.fromAxisAngle(
  33727. normal2,
  33728. -stRotation,
  33729. quaternionScratch2
  33730. );
  33731. const tangentRotation = Matrix3_default.fromQuaternion(
  33732. rotation,
  33733. tangentRotationScratch
  33734. );
  33735. tangent = Cartesian3_default.normalize(
  33736. Matrix3_default.multiplyByVector(tangentRotation, tangent, tangent),
  33737. tangent
  33738. );
  33739. if (vertexFormat.bitangent) {
  33740. bitangent = Cartesian3_default.normalize(
  33741. Cartesian3_default.cross(normal2, tangent, bitangent),
  33742. bitangent
  33743. );
  33744. }
  33745. }
  33746. } else {
  33747. textureMatrix = Matrix3_default.clone(Matrix3_default.IDENTITY, textureMatrix);
  33748. }
  33749. const stOrigin = textureCoordinatesOrigin;
  33750. if (vertexFormat.st) {
  33751. stOrigin.x = boundingRectangle.x;
  33752. stOrigin.y = boundingRectangle.y;
  33753. }
  33754. const length3 = positions.length;
  33755. const size = length3 * 3;
  33756. const flatPositions2 = new Float64Array(size);
  33757. const normals = vertexFormat.normal ? new Float32Array(size) : void 0;
  33758. const tangents = vertexFormat.tangent ? new Float32Array(size) : void 0;
  33759. const bitangents = vertexFormat.bitangent ? new Float32Array(size) : void 0;
  33760. const textureCoordinates = vertexFormat.st ? new Float32Array(length3 * 2) : void 0;
  33761. let positionIndex = 0;
  33762. let normalIndex = 0;
  33763. let bitangentIndex = 0;
  33764. let tangentIndex = 0;
  33765. let stIndex = 0;
  33766. for (let i2 = 0; i2 < length3; i2++) {
  33767. const position = positions[i2];
  33768. flatPositions2[positionIndex++] = position.x;
  33769. flatPositions2[positionIndex++] = position.y;
  33770. flatPositions2[positionIndex++] = position.z;
  33771. if (vertexFormat.st) {
  33772. const p2 = Matrix3_default.multiplyByVector(
  33773. textureMatrix,
  33774. position,
  33775. scratchPosition2
  33776. );
  33777. const st = projectPointTo2D(p2, stScratch);
  33778. Cartesian2_default.subtract(st, stOrigin, st);
  33779. const stx = Math_default.clamp(st.x / boundingRectangle.width, 0, 1);
  33780. const sty = Math_default.clamp(st.y / boundingRectangle.height, 0, 1);
  33781. textureCoordinates[stIndex++] = stx;
  33782. textureCoordinates[stIndex++] = sty;
  33783. }
  33784. if (vertexFormat.normal) {
  33785. normals[normalIndex++] = normal2.x;
  33786. normals[normalIndex++] = normal2.y;
  33787. normals[normalIndex++] = normal2.z;
  33788. }
  33789. if (vertexFormat.tangent) {
  33790. tangents[tangentIndex++] = tangent.x;
  33791. tangents[tangentIndex++] = tangent.y;
  33792. tangents[tangentIndex++] = tangent.z;
  33793. }
  33794. if (vertexFormat.bitangent) {
  33795. bitangents[bitangentIndex++] = bitangent.x;
  33796. bitangents[bitangentIndex++] = bitangent.y;
  33797. bitangents[bitangentIndex++] = bitangent.z;
  33798. }
  33799. }
  33800. const attributes = new GeometryAttributes_default();
  33801. if (vertexFormat.position) {
  33802. attributes.position = new GeometryAttribute_default({
  33803. componentDatatype: ComponentDatatype_default.DOUBLE,
  33804. componentsPerAttribute: 3,
  33805. values: flatPositions2
  33806. });
  33807. }
  33808. if (vertexFormat.normal) {
  33809. attributes.normal = new GeometryAttribute_default({
  33810. componentDatatype: ComponentDatatype_default.FLOAT,
  33811. componentsPerAttribute: 3,
  33812. values: normals
  33813. });
  33814. }
  33815. if (vertexFormat.tangent) {
  33816. attributes.tangent = new GeometryAttribute_default({
  33817. componentDatatype: ComponentDatatype_default.FLOAT,
  33818. componentsPerAttribute: 3,
  33819. values: tangents
  33820. });
  33821. }
  33822. if (vertexFormat.bitangent) {
  33823. attributes.bitangent = new GeometryAttribute_default({
  33824. componentDatatype: ComponentDatatype_default.FLOAT,
  33825. componentsPerAttribute: 3,
  33826. values: bitangents
  33827. });
  33828. }
  33829. if (vertexFormat.st) {
  33830. attributes.st = new GeometryAttribute_default({
  33831. componentDatatype: ComponentDatatype_default.FLOAT,
  33832. componentsPerAttribute: 2,
  33833. values: textureCoordinates
  33834. });
  33835. }
  33836. return new Geometry_default({
  33837. attributes,
  33838. indices: newIndices,
  33839. primitiveType: PrimitiveType_default.TRIANGLES
  33840. });
  33841. }
  33842. function CoplanarPolygonGeometry(options) {
  33843. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  33844. const polygonHierarchy = options.polygonHierarchy;
  33845. Check_default.defined("options.polygonHierarchy", polygonHierarchy);
  33846. const vertexFormat = defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT);
  33847. this._vertexFormat = VertexFormat_default.clone(vertexFormat);
  33848. this._polygonHierarchy = polygonHierarchy;
  33849. this._stRotation = defaultValue_default(options.stRotation, 0);
  33850. this._ellipsoid = Ellipsoid_default.clone(
  33851. defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84)
  33852. );
  33853. this._workerName = "createCoplanarPolygonGeometry";
  33854. this.packedLength = PolygonGeometryLibrary_default.computeHierarchyPackedLength(polygonHierarchy) + VertexFormat_default.packedLength + Ellipsoid_default.packedLength + 2;
  33855. }
  33856. CoplanarPolygonGeometry.fromPositions = function(options) {
  33857. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  33858. Check_default.defined("options.positions", options.positions);
  33859. const newOptions2 = {
  33860. polygonHierarchy: {
  33861. positions: options.positions
  33862. },
  33863. vertexFormat: options.vertexFormat,
  33864. stRotation: options.stRotation,
  33865. ellipsoid: options.ellipsoid
  33866. };
  33867. return new CoplanarPolygonGeometry(newOptions2);
  33868. };
  33869. CoplanarPolygonGeometry.pack = function(value, array, startingIndex) {
  33870. Check_default.typeOf.object("value", value);
  33871. Check_default.defined("array", array);
  33872. startingIndex = defaultValue_default(startingIndex, 0);
  33873. startingIndex = PolygonGeometryLibrary_default.packPolygonHierarchy(
  33874. value._polygonHierarchy,
  33875. array,
  33876. startingIndex
  33877. );
  33878. Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
  33879. startingIndex += Ellipsoid_default.packedLength;
  33880. VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
  33881. startingIndex += VertexFormat_default.packedLength;
  33882. array[startingIndex++] = value._stRotation;
  33883. array[startingIndex] = value.packedLength;
  33884. return array;
  33885. };
  33886. var scratchEllipsoid3 = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
  33887. var scratchVertexFormat3 = new VertexFormat_default();
  33888. var scratchOptions7 = {
  33889. polygonHierarchy: {}
  33890. };
  33891. CoplanarPolygonGeometry.unpack = function(array, startingIndex, result) {
  33892. Check_default.defined("array", array);
  33893. startingIndex = defaultValue_default(startingIndex, 0);
  33894. const polygonHierarchy = PolygonGeometryLibrary_default.unpackPolygonHierarchy(
  33895. array,
  33896. startingIndex
  33897. );
  33898. startingIndex = polygonHierarchy.startingIndex;
  33899. delete polygonHierarchy.startingIndex;
  33900. const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid3);
  33901. startingIndex += Ellipsoid_default.packedLength;
  33902. const vertexFormat = VertexFormat_default.unpack(
  33903. array,
  33904. startingIndex,
  33905. scratchVertexFormat3
  33906. );
  33907. startingIndex += VertexFormat_default.packedLength;
  33908. const stRotation = array[startingIndex++];
  33909. const packedLength = array[startingIndex];
  33910. if (!defined_default(result)) {
  33911. result = new CoplanarPolygonGeometry(scratchOptions7);
  33912. }
  33913. result._polygonHierarchy = polygonHierarchy;
  33914. result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
  33915. result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
  33916. result._stRotation = stRotation;
  33917. result.packedLength = packedLength;
  33918. return result;
  33919. };
  33920. CoplanarPolygonGeometry.createGeometry = function(polygonGeometry) {
  33921. const vertexFormat = polygonGeometry._vertexFormat;
  33922. const polygonHierarchy = polygonGeometry._polygonHierarchy;
  33923. const stRotation = polygonGeometry._stRotation;
  33924. let outerPositions = polygonHierarchy.positions;
  33925. outerPositions = arrayRemoveDuplicates_default(
  33926. outerPositions,
  33927. Cartesian3_default.equalsEpsilon,
  33928. true
  33929. );
  33930. if (outerPositions.length < 3) {
  33931. return;
  33932. }
  33933. let normal2 = scratchNormal4;
  33934. let tangent = scratchTangent2;
  33935. let bitangent = scratchBitangent2;
  33936. let axis1 = axis1Scratch;
  33937. const axis2 = axis2Scratch;
  33938. const validGeometry = CoplanarPolygonGeometryLibrary_default.computeProjectTo2DArguments(
  33939. outerPositions,
  33940. centerScratch,
  33941. axis1,
  33942. axis2
  33943. );
  33944. if (!validGeometry) {
  33945. return void 0;
  33946. }
  33947. normal2 = Cartesian3_default.cross(axis1, axis2, normal2);
  33948. normal2 = Cartesian3_default.normalize(normal2, normal2);
  33949. if (!Cartesian3_default.equalsEpsilon(
  33950. centerScratch,
  33951. Cartesian3_default.ZERO,
  33952. Math_default.EPSILON6
  33953. )) {
  33954. const surfaceNormal = polygonGeometry._ellipsoid.geodeticSurfaceNormal(
  33955. centerScratch,
  33956. surfaceNormalScratch
  33957. );
  33958. if (Cartesian3_default.dot(normal2, surfaceNormal) < 0) {
  33959. normal2 = Cartesian3_default.negate(normal2, normal2);
  33960. axis1 = Cartesian3_default.negate(axis1, axis1);
  33961. }
  33962. }
  33963. const projectPoints = CoplanarPolygonGeometryLibrary_default.createProjectPointsTo2DFunction(
  33964. centerScratch,
  33965. axis1,
  33966. axis2
  33967. );
  33968. const projectPoint = CoplanarPolygonGeometryLibrary_default.createProjectPointTo2DFunction(
  33969. centerScratch,
  33970. axis1,
  33971. axis2
  33972. );
  33973. if (vertexFormat.tangent) {
  33974. tangent = Cartesian3_default.clone(axis1, tangent);
  33975. }
  33976. if (vertexFormat.bitangent) {
  33977. bitangent = Cartesian3_default.clone(axis2, bitangent);
  33978. }
  33979. const results = PolygonGeometryLibrary_default.polygonsFromHierarchy(
  33980. polygonHierarchy,
  33981. projectPoints,
  33982. false
  33983. );
  33984. const hierarchy = results.hierarchy;
  33985. const polygons = results.polygons;
  33986. if (hierarchy.length === 0) {
  33987. return;
  33988. }
  33989. outerPositions = hierarchy[0].outerRing;
  33990. const boundingSphere = BoundingSphere_default.fromPoints(outerPositions);
  33991. const boundingRectangle = PolygonGeometryLibrary_default.computeBoundingRectangle(
  33992. normal2,
  33993. projectPoint,
  33994. outerPositions,
  33995. stRotation,
  33996. scratchBR
  33997. );
  33998. const geometries = [];
  33999. for (let i2 = 0; i2 < polygons.length; i2++) {
  34000. const geometryInstance = new GeometryInstance_default({
  34001. geometry: createGeometryFromPolygon(
  34002. polygons[i2],
  34003. vertexFormat,
  34004. boundingRectangle,
  34005. stRotation,
  34006. projectPoint,
  34007. normal2,
  34008. tangent,
  34009. bitangent
  34010. )
  34011. });
  34012. geometries.push(geometryInstance);
  34013. }
  34014. const geometry = GeometryPipeline_default.combineInstances(geometries)[0];
  34015. geometry.attributes.position.values = new Float64Array(
  34016. geometry.attributes.position.values
  34017. );
  34018. geometry.indices = IndexDatatype_default.createTypedArray(
  34019. geometry.attributes.position.values.length / 3,
  34020. geometry.indices
  34021. );
  34022. const attributes = geometry.attributes;
  34023. if (!vertexFormat.position) {
  34024. delete attributes.position;
  34025. }
  34026. return new Geometry_default({
  34027. attributes,
  34028. indices: geometry.indices,
  34029. primitiveType: geometry.primitiveType,
  34030. boundingSphere
  34031. });
  34032. };
  34033. var CoplanarPolygonGeometry_default = CoplanarPolygonGeometry;
  34034. // node_modules/cesium/Source/Core/CoplanarPolygonOutlineGeometry.js
  34035. function createGeometryFromPositions(positions) {
  34036. const length3 = positions.length;
  34037. const flatPositions2 = new Float64Array(length3 * 3);
  34038. const indices2 = IndexDatatype_default.createTypedArray(length3, length3 * 2);
  34039. let positionIndex = 0;
  34040. let index2 = 0;
  34041. for (let i2 = 0; i2 < length3; i2++) {
  34042. const position = positions[i2];
  34043. flatPositions2[positionIndex++] = position.x;
  34044. flatPositions2[positionIndex++] = position.y;
  34045. flatPositions2[positionIndex++] = position.z;
  34046. indices2[index2++] = i2;
  34047. indices2[index2++] = (i2 + 1) % length3;
  34048. }
  34049. const attributes = new GeometryAttributes_default({
  34050. position: new GeometryAttribute_default({
  34051. componentDatatype: ComponentDatatype_default.DOUBLE,
  34052. componentsPerAttribute: 3,
  34053. values: flatPositions2
  34054. })
  34055. });
  34056. return new Geometry_default({
  34057. attributes,
  34058. indices: indices2,
  34059. primitiveType: PrimitiveType_default.LINES
  34060. });
  34061. }
  34062. function CoplanarPolygonOutlineGeometry(options) {
  34063. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  34064. const polygonHierarchy = options.polygonHierarchy;
  34065. Check_default.defined("options.polygonHierarchy", polygonHierarchy);
  34066. this._polygonHierarchy = polygonHierarchy;
  34067. this._workerName = "createCoplanarPolygonOutlineGeometry";
  34068. this.packedLength = PolygonGeometryLibrary_default.computeHierarchyPackedLength(polygonHierarchy) + 1;
  34069. }
  34070. CoplanarPolygonOutlineGeometry.fromPositions = function(options) {
  34071. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  34072. Check_default.defined("options.positions", options.positions);
  34073. const newOptions2 = {
  34074. polygonHierarchy: {
  34075. positions: options.positions
  34076. }
  34077. };
  34078. return new CoplanarPolygonOutlineGeometry(newOptions2);
  34079. };
  34080. CoplanarPolygonOutlineGeometry.pack = function(value, array, startingIndex) {
  34081. Check_default.typeOf.object("value", value);
  34082. Check_default.defined("array", array);
  34083. startingIndex = defaultValue_default(startingIndex, 0);
  34084. startingIndex = PolygonGeometryLibrary_default.packPolygonHierarchy(
  34085. value._polygonHierarchy,
  34086. array,
  34087. startingIndex
  34088. );
  34089. array[startingIndex] = value.packedLength;
  34090. return array;
  34091. };
  34092. var scratchOptions8 = {
  34093. polygonHierarchy: {}
  34094. };
  34095. CoplanarPolygonOutlineGeometry.unpack = function(array, startingIndex, result) {
  34096. Check_default.defined("array", array);
  34097. startingIndex = defaultValue_default(startingIndex, 0);
  34098. const polygonHierarchy = PolygonGeometryLibrary_default.unpackPolygonHierarchy(
  34099. array,
  34100. startingIndex
  34101. );
  34102. startingIndex = polygonHierarchy.startingIndex;
  34103. delete polygonHierarchy.startingIndex;
  34104. const packedLength = array[startingIndex];
  34105. if (!defined_default(result)) {
  34106. result = new CoplanarPolygonOutlineGeometry(scratchOptions8);
  34107. }
  34108. result._polygonHierarchy = polygonHierarchy;
  34109. result.packedLength = packedLength;
  34110. return result;
  34111. };
  34112. CoplanarPolygonOutlineGeometry.createGeometry = function(polygonGeometry) {
  34113. const polygonHierarchy = polygonGeometry._polygonHierarchy;
  34114. let outerPositions = polygonHierarchy.positions;
  34115. outerPositions = arrayRemoveDuplicates_default(
  34116. outerPositions,
  34117. Cartesian3_default.equalsEpsilon,
  34118. true
  34119. );
  34120. if (outerPositions.length < 3) {
  34121. return;
  34122. }
  34123. const isValid = CoplanarPolygonGeometryLibrary_default.validOutline(outerPositions);
  34124. if (!isValid) {
  34125. return void 0;
  34126. }
  34127. const polygons = PolygonGeometryLibrary_default.polygonOutlinesFromHierarchy(
  34128. polygonHierarchy,
  34129. false
  34130. );
  34131. if (polygons.length === 0) {
  34132. return void 0;
  34133. }
  34134. const geometries = [];
  34135. for (let i2 = 0; i2 < polygons.length; i2++) {
  34136. const geometryInstance = new GeometryInstance_default({
  34137. geometry: createGeometryFromPositions(polygons[i2])
  34138. });
  34139. geometries.push(geometryInstance);
  34140. }
  34141. const geometry = GeometryPipeline_default.combineInstances(geometries)[0];
  34142. const boundingSphere = BoundingSphere_default.fromPoints(polygonHierarchy.positions);
  34143. return new Geometry_default({
  34144. attributes: geometry.attributes,
  34145. indices: geometry.indices,
  34146. primitiveType: geometry.primitiveType,
  34147. boundingSphere
  34148. });
  34149. };
  34150. var CoplanarPolygonOutlineGeometry_default = CoplanarPolygonOutlineGeometry;
  34151. // node_modules/cesium/Source/Core/CornerType.js
  34152. var CornerType = {
  34153. ROUNDED: 0,
  34154. MITERED: 1,
  34155. BEVELED: 2
  34156. };
  34157. var CornerType_default = Object.freeze(CornerType);
  34158. // node_modules/cesium/Source/Core/EllipsoidGeodesic.js
  34159. function setConstants(ellipsoidGeodesic3) {
  34160. const uSquared = ellipsoidGeodesic3._uSquared;
  34161. const a4 = ellipsoidGeodesic3._ellipsoid.maximumRadius;
  34162. const b = ellipsoidGeodesic3._ellipsoid.minimumRadius;
  34163. const f2 = (a4 - b) / a4;
  34164. const cosineHeading = Math.cos(ellipsoidGeodesic3._startHeading);
  34165. const sineHeading = Math.sin(ellipsoidGeodesic3._startHeading);
  34166. const tanU = (1 - f2) * Math.tan(ellipsoidGeodesic3._start.latitude);
  34167. const cosineU = 1 / Math.sqrt(1 + tanU * tanU);
  34168. const sineU = cosineU * tanU;
  34169. const sigma = Math.atan2(tanU, cosineHeading);
  34170. const sineAlpha = cosineU * sineHeading;
  34171. const sineSquaredAlpha = sineAlpha * sineAlpha;
  34172. const cosineSquaredAlpha = 1 - sineSquaredAlpha;
  34173. const cosineAlpha = Math.sqrt(cosineSquaredAlpha);
  34174. const u2Over4 = uSquared / 4;
  34175. const u4Over16 = u2Over4 * u2Over4;
  34176. const u6Over64 = u4Over16 * u2Over4;
  34177. const u8Over256 = u4Over16 * u4Over16;
  34178. const a0 = 1 + u2Over4 - 3 * u4Over16 / 4 + 5 * u6Over64 / 4 - 175 * u8Over256 / 64;
  34179. const a1 = 1 - u2Over4 + 15 * u4Over16 / 8 - 35 * u6Over64 / 8;
  34180. const a22 = 1 - 3 * u2Over4 + 35 * u4Over16 / 4;
  34181. const a32 = 1 - 5 * u2Over4;
  34182. const distanceRatio = a0 * sigma - a1 * Math.sin(2 * sigma) * u2Over4 / 2 - a22 * Math.sin(4 * sigma) * u4Over16 / 16 - a32 * Math.sin(6 * sigma) * u6Over64 / 48 - Math.sin(8 * sigma) * 5 * u8Over256 / 512;
  34183. const constants2 = ellipsoidGeodesic3._constants;
  34184. constants2.a = a4;
  34185. constants2.b = b;
  34186. constants2.f = f2;
  34187. constants2.cosineHeading = cosineHeading;
  34188. constants2.sineHeading = sineHeading;
  34189. constants2.tanU = tanU;
  34190. constants2.cosineU = cosineU;
  34191. constants2.sineU = sineU;
  34192. constants2.sigma = sigma;
  34193. constants2.sineAlpha = sineAlpha;
  34194. constants2.sineSquaredAlpha = sineSquaredAlpha;
  34195. constants2.cosineSquaredAlpha = cosineSquaredAlpha;
  34196. constants2.cosineAlpha = cosineAlpha;
  34197. constants2.u2Over4 = u2Over4;
  34198. constants2.u4Over16 = u4Over16;
  34199. constants2.u6Over64 = u6Over64;
  34200. constants2.u8Over256 = u8Over256;
  34201. constants2.a0 = a0;
  34202. constants2.a1 = a1;
  34203. constants2.a2 = a22;
  34204. constants2.a3 = a32;
  34205. constants2.distanceRatio = distanceRatio;
  34206. }
  34207. function computeC(f2, cosineSquaredAlpha) {
  34208. return f2 * cosineSquaredAlpha * (4 + f2 * (4 - 3 * cosineSquaredAlpha)) / 16;
  34209. }
  34210. function computeDeltaLambda(f2, sineAlpha, cosineSquaredAlpha, sigma, sineSigma, cosineSigma, cosineTwiceSigmaMidpoint) {
  34211. const C = computeC(f2, cosineSquaredAlpha);
  34212. return (1 - C) * f2 * sineAlpha * (sigma + C * sineSigma * (cosineTwiceSigmaMidpoint + C * cosineSigma * (2 * cosineTwiceSigmaMidpoint * cosineTwiceSigmaMidpoint - 1)));
  34213. }
  34214. function vincentyInverseFormula(ellipsoidGeodesic3, major, minor, firstLongitude, firstLatitude, secondLongitude, secondLatitude) {
  34215. const eff = (major - minor) / major;
  34216. const l2 = secondLongitude - firstLongitude;
  34217. const u12 = Math.atan((1 - eff) * Math.tan(firstLatitude));
  34218. const u22 = Math.atan((1 - eff) * Math.tan(secondLatitude));
  34219. const cosineU1 = Math.cos(u12);
  34220. const sineU1 = Math.sin(u12);
  34221. const cosineU2 = Math.cos(u22);
  34222. const sineU2 = Math.sin(u22);
  34223. const cc = cosineU1 * cosineU2;
  34224. const cs = cosineU1 * sineU2;
  34225. const ss = sineU1 * sineU2;
  34226. const sc = sineU1 * cosineU2;
  34227. let lambda = l2;
  34228. let lambdaDot = Math_default.TWO_PI;
  34229. let cosineLambda = Math.cos(lambda);
  34230. let sineLambda = Math.sin(lambda);
  34231. let sigma;
  34232. let cosineSigma;
  34233. let sineSigma;
  34234. let cosineSquaredAlpha;
  34235. let cosineTwiceSigmaMidpoint;
  34236. do {
  34237. cosineLambda = Math.cos(lambda);
  34238. sineLambda = Math.sin(lambda);
  34239. const temp = cs - sc * cosineLambda;
  34240. sineSigma = Math.sqrt(
  34241. cosineU2 * cosineU2 * sineLambda * sineLambda + temp * temp
  34242. );
  34243. cosineSigma = ss + cc * cosineLambda;
  34244. sigma = Math.atan2(sineSigma, cosineSigma);
  34245. let sineAlpha;
  34246. if (sineSigma === 0) {
  34247. sineAlpha = 0;
  34248. cosineSquaredAlpha = 1;
  34249. } else {
  34250. sineAlpha = cc * sineLambda / sineSigma;
  34251. cosineSquaredAlpha = 1 - sineAlpha * sineAlpha;
  34252. }
  34253. lambdaDot = lambda;
  34254. cosineTwiceSigmaMidpoint = cosineSigma - 2 * ss / cosineSquaredAlpha;
  34255. if (!isFinite(cosineTwiceSigmaMidpoint)) {
  34256. cosineTwiceSigmaMidpoint = 0;
  34257. }
  34258. lambda = l2 + computeDeltaLambda(
  34259. eff,
  34260. sineAlpha,
  34261. cosineSquaredAlpha,
  34262. sigma,
  34263. sineSigma,
  34264. cosineSigma,
  34265. cosineTwiceSigmaMidpoint
  34266. );
  34267. } while (Math.abs(lambda - lambdaDot) > Math_default.EPSILON12);
  34268. const uSquared = cosineSquaredAlpha * (major * major - minor * minor) / (minor * minor);
  34269. const A = 1 + uSquared * (4096 + uSquared * (uSquared * (320 - 175 * uSquared) - 768)) / 16384;
  34270. const B = uSquared * (256 + uSquared * (uSquared * (74 - 47 * uSquared) - 128)) / 1024;
  34271. const cosineSquaredTwiceSigmaMidpoint = cosineTwiceSigmaMidpoint * cosineTwiceSigmaMidpoint;
  34272. const deltaSigma = B * sineSigma * (cosineTwiceSigmaMidpoint + B * (cosineSigma * (2 * cosineSquaredTwiceSigmaMidpoint - 1) - B * cosineTwiceSigmaMidpoint * (4 * sineSigma * sineSigma - 3) * (4 * cosineSquaredTwiceSigmaMidpoint - 3) / 6) / 4);
  34273. const distance2 = minor * A * (sigma - deltaSigma);
  34274. const startHeading = Math.atan2(
  34275. cosineU2 * sineLambda,
  34276. cs - sc * cosineLambda
  34277. );
  34278. const endHeading = Math.atan2(cosineU1 * sineLambda, cs * cosineLambda - sc);
  34279. ellipsoidGeodesic3._distance = distance2;
  34280. ellipsoidGeodesic3._startHeading = startHeading;
  34281. ellipsoidGeodesic3._endHeading = endHeading;
  34282. ellipsoidGeodesic3._uSquared = uSquared;
  34283. }
  34284. var scratchCart12 = new Cartesian3_default();
  34285. var scratchCart22 = new Cartesian3_default();
  34286. function computeProperties2(ellipsoidGeodesic3, start, end, ellipsoid) {
  34287. const firstCartesian = Cartesian3_default.normalize(
  34288. ellipsoid.cartographicToCartesian(start, scratchCart22),
  34289. scratchCart12
  34290. );
  34291. const lastCartesian = Cartesian3_default.normalize(
  34292. ellipsoid.cartographicToCartesian(end, scratchCart22),
  34293. scratchCart22
  34294. );
  34295. Check_default.typeOf.number.greaterThanOrEquals(
  34296. "value",
  34297. Math.abs(
  34298. Math.abs(Cartesian3_default.angleBetween(firstCartesian, lastCartesian)) - Math.PI
  34299. ),
  34300. 0.0125
  34301. );
  34302. vincentyInverseFormula(
  34303. ellipsoidGeodesic3,
  34304. ellipsoid.maximumRadius,
  34305. ellipsoid.minimumRadius,
  34306. start.longitude,
  34307. start.latitude,
  34308. end.longitude,
  34309. end.latitude
  34310. );
  34311. ellipsoidGeodesic3._start = Cartographic_default.clone(
  34312. start,
  34313. ellipsoidGeodesic3._start
  34314. );
  34315. ellipsoidGeodesic3._end = Cartographic_default.clone(end, ellipsoidGeodesic3._end);
  34316. ellipsoidGeodesic3._start.height = 0;
  34317. ellipsoidGeodesic3._end.height = 0;
  34318. setConstants(ellipsoidGeodesic3);
  34319. }
  34320. function EllipsoidGeodesic(start, end, ellipsoid) {
  34321. const e2 = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  34322. this._ellipsoid = e2;
  34323. this._start = new Cartographic_default();
  34324. this._end = new Cartographic_default();
  34325. this._constants = {};
  34326. this._startHeading = void 0;
  34327. this._endHeading = void 0;
  34328. this._distance = void 0;
  34329. this._uSquared = void 0;
  34330. if (defined_default(start) && defined_default(end)) {
  34331. computeProperties2(this, start, end, e2);
  34332. }
  34333. }
  34334. Object.defineProperties(EllipsoidGeodesic.prototype, {
  34335. ellipsoid: {
  34336. get: function() {
  34337. return this._ellipsoid;
  34338. }
  34339. },
  34340. surfaceDistance: {
  34341. get: function() {
  34342. Check_default.defined("distance", this._distance);
  34343. return this._distance;
  34344. }
  34345. },
  34346. start: {
  34347. get: function() {
  34348. return this._start;
  34349. }
  34350. },
  34351. end: {
  34352. get: function() {
  34353. return this._end;
  34354. }
  34355. },
  34356. startHeading: {
  34357. get: function() {
  34358. Check_default.defined("distance", this._distance);
  34359. return this._startHeading;
  34360. }
  34361. },
  34362. endHeading: {
  34363. get: function() {
  34364. Check_default.defined("distance", this._distance);
  34365. return this._endHeading;
  34366. }
  34367. }
  34368. });
  34369. EllipsoidGeodesic.prototype.setEndPoints = function(start, end) {
  34370. Check_default.defined("start", start);
  34371. Check_default.defined("end", end);
  34372. computeProperties2(this, start, end, this._ellipsoid);
  34373. };
  34374. EllipsoidGeodesic.prototype.interpolateUsingFraction = function(fraction, result) {
  34375. return this.interpolateUsingSurfaceDistance(
  34376. this._distance * fraction,
  34377. result
  34378. );
  34379. };
  34380. EllipsoidGeodesic.prototype.interpolateUsingSurfaceDistance = function(distance2, result) {
  34381. Check_default.defined("distance", this._distance);
  34382. const constants2 = this._constants;
  34383. const s2 = constants2.distanceRatio + distance2 / constants2.b;
  34384. const cosine2S = Math.cos(2 * s2);
  34385. const cosine4S = Math.cos(4 * s2);
  34386. const cosine6S = Math.cos(6 * s2);
  34387. const sine2S = Math.sin(2 * s2);
  34388. const sine4S = Math.sin(4 * s2);
  34389. const sine6S = Math.sin(6 * s2);
  34390. const sine8S = Math.sin(8 * s2);
  34391. const s22 = s2 * s2;
  34392. const s3 = s2 * s22;
  34393. const u8Over256 = constants2.u8Over256;
  34394. const u2Over4 = constants2.u2Over4;
  34395. const u6Over64 = constants2.u6Over64;
  34396. const u4Over16 = constants2.u4Over16;
  34397. let sigma = 2 * s3 * u8Over256 * cosine2S / 3 + s2 * (1 - u2Over4 + 7 * u4Over16 / 4 - 15 * u6Over64 / 4 + 579 * u8Over256 / 64 - (u4Over16 - 15 * u6Over64 / 4 + 187 * u8Over256 / 16) * cosine2S - (5 * u6Over64 / 4 - 115 * u8Over256 / 16) * cosine4S - 29 * u8Over256 * cosine6S / 16) + (u2Over4 / 2 - u4Over16 + 71 * u6Over64 / 32 - 85 * u8Over256 / 16) * sine2S + (5 * u4Over16 / 16 - 5 * u6Over64 / 4 + 383 * u8Over256 / 96) * sine4S - s22 * ((u6Over64 - 11 * u8Over256 / 2) * sine2S + 5 * u8Over256 * sine4S / 2) + (29 * u6Over64 / 96 - 29 * u8Over256 / 16) * sine6S + 539 * u8Over256 * sine8S / 1536;
  34398. const theta = Math.asin(Math.sin(sigma) * constants2.cosineAlpha);
  34399. const latitude = Math.atan(constants2.a / constants2.b * Math.tan(theta));
  34400. sigma = sigma - constants2.sigma;
  34401. const cosineTwiceSigmaMidpoint = Math.cos(2 * constants2.sigma + sigma);
  34402. const sineSigma = Math.sin(sigma);
  34403. const cosineSigma = Math.cos(sigma);
  34404. const cc = constants2.cosineU * cosineSigma;
  34405. const ss = constants2.sineU * sineSigma;
  34406. const lambda = Math.atan2(
  34407. sineSigma * constants2.sineHeading,
  34408. cc - ss * constants2.cosineHeading
  34409. );
  34410. const l2 = lambda - computeDeltaLambda(
  34411. constants2.f,
  34412. constants2.sineAlpha,
  34413. constants2.cosineSquaredAlpha,
  34414. sigma,
  34415. sineSigma,
  34416. cosineSigma,
  34417. cosineTwiceSigmaMidpoint
  34418. );
  34419. if (defined_default(result)) {
  34420. result.longitude = this._start.longitude + l2;
  34421. result.latitude = latitude;
  34422. result.height = 0;
  34423. return result;
  34424. }
  34425. return new Cartographic_default(this._start.longitude + l2, latitude, 0);
  34426. };
  34427. var EllipsoidGeodesic_default = EllipsoidGeodesic;
  34428. // node_modules/cesium/Source/Core/PolylinePipeline.js
  34429. var PolylinePipeline = {};
  34430. PolylinePipeline.numberOfPoints = function(p0, p1, minDistance) {
  34431. const distance2 = Cartesian3_default.distance(p0, p1);
  34432. return Math.ceil(distance2 / minDistance);
  34433. };
  34434. PolylinePipeline.numberOfPointsRhumbLine = function(p0, p1, granularity) {
  34435. const radiansDistanceSquared = Math.pow(p0.longitude - p1.longitude, 2) + Math.pow(p0.latitude - p1.latitude, 2);
  34436. return Math.max(
  34437. 1,
  34438. Math.ceil(Math.sqrt(radiansDistanceSquared / (granularity * granularity)))
  34439. );
  34440. };
  34441. var cartoScratch = new Cartographic_default();
  34442. PolylinePipeline.extractHeights = function(positions, ellipsoid) {
  34443. const length3 = positions.length;
  34444. const heights = new Array(length3);
  34445. for (let i2 = 0; i2 < length3; i2++) {
  34446. const p2 = positions[i2];
  34447. heights[i2] = ellipsoid.cartesianToCartographic(p2, cartoScratch).height;
  34448. }
  34449. return heights;
  34450. };
  34451. var wrapLongitudeInversMatrix = new Matrix4_default();
  34452. var wrapLongitudeOrigin = new Cartesian3_default();
  34453. var wrapLongitudeXZNormal = new Cartesian3_default();
  34454. var wrapLongitudeXZPlane = new Plane_default(Cartesian3_default.UNIT_X, 0);
  34455. var wrapLongitudeYZNormal = new Cartesian3_default();
  34456. var wrapLongitudeYZPlane = new Plane_default(Cartesian3_default.UNIT_X, 0);
  34457. var wrapLongitudeIntersection = new Cartesian3_default();
  34458. var wrapLongitudeOffset = new Cartesian3_default();
  34459. var subdivideHeightsScratchArray = [];
  34460. function subdivideHeights(numPoints, h0, h1) {
  34461. const heights = subdivideHeightsScratchArray;
  34462. heights.length = numPoints;
  34463. let i2;
  34464. if (h0 === h1) {
  34465. for (i2 = 0; i2 < numPoints; i2++) {
  34466. heights[i2] = h0;
  34467. }
  34468. return heights;
  34469. }
  34470. const dHeight = h1 - h0;
  34471. const heightPerVertex = dHeight / numPoints;
  34472. for (i2 = 0; i2 < numPoints; i2++) {
  34473. const h = h0 + i2 * heightPerVertex;
  34474. heights[i2] = h;
  34475. }
  34476. return heights;
  34477. }
  34478. var carto1 = new Cartographic_default();
  34479. var carto2 = new Cartographic_default();
  34480. var cartesian = new Cartesian3_default();
  34481. var scaleFirst = new Cartesian3_default();
  34482. var scaleLast = new Cartesian3_default();
  34483. var ellipsoidGeodesic = new EllipsoidGeodesic_default();
  34484. var ellipsoidRhumb = new EllipsoidRhumbLine_default();
  34485. function generateCartesianArc(p0, p1, minDistance, ellipsoid, h0, h1, array, offset2) {
  34486. const first = ellipsoid.scaleToGeodeticSurface(p0, scaleFirst);
  34487. const last = ellipsoid.scaleToGeodeticSurface(p1, scaleLast);
  34488. const numPoints = PolylinePipeline.numberOfPoints(p0, p1, minDistance);
  34489. const start = ellipsoid.cartesianToCartographic(first, carto1);
  34490. const end = ellipsoid.cartesianToCartographic(last, carto2);
  34491. const heights = subdivideHeights(numPoints, h0, h1);
  34492. ellipsoidGeodesic.setEndPoints(start, end);
  34493. const surfaceDistanceBetweenPoints = ellipsoidGeodesic.surfaceDistance / numPoints;
  34494. let index2 = offset2;
  34495. start.height = h0;
  34496. let cart = ellipsoid.cartographicToCartesian(start, cartesian);
  34497. Cartesian3_default.pack(cart, array, index2);
  34498. index2 += 3;
  34499. for (let i2 = 1; i2 < numPoints; i2++) {
  34500. const carto = ellipsoidGeodesic.interpolateUsingSurfaceDistance(
  34501. i2 * surfaceDistanceBetweenPoints,
  34502. carto2
  34503. );
  34504. carto.height = heights[i2];
  34505. cart = ellipsoid.cartographicToCartesian(carto, cartesian);
  34506. Cartesian3_default.pack(cart, array, index2);
  34507. index2 += 3;
  34508. }
  34509. return index2;
  34510. }
  34511. function generateCartesianRhumbArc(p0, p1, granularity, ellipsoid, h0, h1, array, offset2) {
  34512. const start = ellipsoid.cartesianToCartographic(p0, carto1);
  34513. const end = ellipsoid.cartesianToCartographic(p1, carto2);
  34514. const numPoints = PolylinePipeline.numberOfPointsRhumbLine(
  34515. start,
  34516. end,
  34517. granularity
  34518. );
  34519. start.height = 0;
  34520. end.height = 0;
  34521. const heights = subdivideHeights(numPoints, h0, h1);
  34522. if (!ellipsoidRhumb.ellipsoid.equals(ellipsoid)) {
  34523. ellipsoidRhumb = new EllipsoidRhumbLine_default(void 0, void 0, ellipsoid);
  34524. }
  34525. ellipsoidRhumb.setEndPoints(start, end);
  34526. const surfaceDistanceBetweenPoints = ellipsoidRhumb.surfaceDistance / numPoints;
  34527. let index2 = offset2;
  34528. start.height = h0;
  34529. let cart = ellipsoid.cartographicToCartesian(start, cartesian);
  34530. Cartesian3_default.pack(cart, array, index2);
  34531. index2 += 3;
  34532. for (let i2 = 1; i2 < numPoints; i2++) {
  34533. const carto = ellipsoidRhumb.interpolateUsingSurfaceDistance(
  34534. i2 * surfaceDistanceBetweenPoints,
  34535. carto2
  34536. );
  34537. carto.height = heights[i2];
  34538. cart = ellipsoid.cartographicToCartesian(carto, cartesian);
  34539. Cartesian3_default.pack(cart, array, index2);
  34540. index2 += 3;
  34541. }
  34542. return index2;
  34543. }
  34544. PolylinePipeline.wrapLongitude = function(positions, modelMatrix) {
  34545. const cartesians = [];
  34546. const segments = [];
  34547. if (defined_default(positions) && positions.length > 0) {
  34548. modelMatrix = defaultValue_default(modelMatrix, Matrix4_default.IDENTITY);
  34549. const inverseModelMatrix = Matrix4_default.inverseTransformation(
  34550. modelMatrix,
  34551. wrapLongitudeInversMatrix
  34552. );
  34553. const origin = Matrix4_default.multiplyByPoint(
  34554. inverseModelMatrix,
  34555. Cartesian3_default.ZERO,
  34556. wrapLongitudeOrigin
  34557. );
  34558. const xzNormal = Cartesian3_default.normalize(
  34559. Matrix4_default.multiplyByPointAsVector(
  34560. inverseModelMatrix,
  34561. Cartesian3_default.UNIT_Y,
  34562. wrapLongitudeXZNormal
  34563. ),
  34564. wrapLongitudeXZNormal
  34565. );
  34566. const xzPlane2 = Plane_default.fromPointNormal(
  34567. origin,
  34568. xzNormal,
  34569. wrapLongitudeXZPlane
  34570. );
  34571. const yzNormal = Cartesian3_default.normalize(
  34572. Matrix4_default.multiplyByPointAsVector(
  34573. inverseModelMatrix,
  34574. Cartesian3_default.UNIT_X,
  34575. wrapLongitudeYZNormal
  34576. ),
  34577. wrapLongitudeYZNormal
  34578. );
  34579. const yzPlane = Plane_default.fromPointNormal(
  34580. origin,
  34581. yzNormal,
  34582. wrapLongitudeYZPlane
  34583. );
  34584. let count = 1;
  34585. cartesians.push(Cartesian3_default.clone(positions[0]));
  34586. let prev = cartesians[0];
  34587. const length3 = positions.length;
  34588. for (let i2 = 1; i2 < length3; ++i2) {
  34589. const cur = positions[i2];
  34590. if (Plane_default.getPointDistance(yzPlane, prev) < 0 || Plane_default.getPointDistance(yzPlane, cur) < 0) {
  34591. const intersection = IntersectionTests_default.lineSegmentPlane(
  34592. prev,
  34593. cur,
  34594. xzPlane2,
  34595. wrapLongitudeIntersection
  34596. );
  34597. if (defined_default(intersection)) {
  34598. const offset2 = Cartesian3_default.multiplyByScalar(
  34599. xzNormal,
  34600. 5e-9,
  34601. wrapLongitudeOffset
  34602. );
  34603. if (Plane_default.getPointDistance(xzPlane2, prev) < 0) {
  34604. Cartesian3_default.negate(offset2, offset2);
  34605. }
  34606. cartesians.push(
  34607. Cartesian3_default.add(intersection, offset2, new Cartesian3_default())
  34608. );
  34609. segments.push(count + 1);
  34610. Cartesian3_default.negate(offset2, offset2);
  34611. cartesians.push(
  34612. Cartesian3_default.add(intersection, offset2, new Cartesian3_default())
  34613. );
  34614. count = 1;
  34615. }
  34616. }
  34617. cartesians.push(Cartesian3_default.clone(positions[i2]));
  34618. count++;
  34619. prev = cur;
  34620. }
  34621. segments.push(count);
  34622. }
  34623. return {
  34624. positions: cartesians,
  34625. lengths: segments
  34626. };
  34627. };
  34628. PolylinePipeline.generateArc = function(options) {
  34629. if (!defined_default(options)) {
  34630. options = {};
  34631. }
  34632. const positions = options.positions;
  34633. if (!defined_default(positions)) {
  34634. throw new DeveloperError_default("options.positions is required.");
  34635. }
  34636. const length3 = positions.length;
  34637. const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  34638. let height = defaultValue_default(options.height, 0);
  34639. const hasHeightArray = Array.isArray(height);
  34640. if (length3 < 1) {
  34641. return [];
  34642. } else if (length3 === 1) {
  34643. const p2 = ellipsoid.scaleToGeodeticSurface(positions[0], scaleFirst);
  34644. height = hasHeightArray ? height[0] : height;
  34645. if (height !== 0) {
  34646. const n2 = ellipsoid.geodeticSurfaceNormal(p2, cartesian);
  34647. Cartesian3_default.multiplyByScalar(n2, height, n2);
  34648. Cartesian3_default.add(p2, n2, p2);
  34649. }
  34650. return [p2.x, p2.y, p2.z];
  34651. }
  34652. let minDistance = options.minDistance;
  34653. if (!defined_default(minDistance)) {
  34654. const granularity = defaultValue_default(
  34655. options.granularity,
  34656. Math_default.RADIANS_PER_DEGREE
  34657. );
  34658. minDistance = Math_default.chordLength(granularity, ellipsoid.maximumRadius);
  34659. }
  34660. let numPoints = 0;
  34661. let i2;
  34662. for (i2 = 0; i2 < length3 - 1; i2++) {
  34663. numPoints += PolylinePipeline.numberOfPoints(
  34664. positions[i2],
  34665. positions[i2 + 1],
  34666. minDistance
  34667. );
  34668. }
  34669. const arrayLength = (numPoints + 1) * 3;
  34670. const newPositions = new Array(arrayLength);
  34671. let offset2 = 0;
  34672. for (i2 = 0; i2 < length3 - 1; i2++) {
  34673. const p0 = positions[i2];
  34674. const p1 = positions[i2 + 1];
  34675. const h0 = hasHeightArray ? height[i2] : height;
  34676. const h1 = hasHeightArray ? height[i2 + 1] : height;
  34677. offset2 = generateCartesianArc(
  34678. p0,
  34679. p1,
  34680. minDistance,
  34681. ellipsoid,
  34682. h0,
  34683. h1,
  34684. newPositions,
  34685. offset2
  34686. );
  34687. }
  34688. subdivideHeightsScratchArray.length = 0;
  34689. const lastPoint = positions[length3 - 1];
  34690. const carto = ellipsoid.cartesianToCartographic(lastPoint, carto1);
  34691. carto.height = hasHeightArray ? height[length3 - 1] : height;
  34692. const cart = ellipsoid.cartographicToCartesian(carto, cartesian);
  34693. Cartesian3_default.pack(cart, newPositions, arrayLength - 3);
  34694. return newPositions;
  34695. };
  34696. var scratchCartographic02 = new Cartographic_default();
  34697. var scratchCartographic12 = new Cartographic_default();
  34698. PolylinePipeline.generateRhumbArc = function(options) {
  34699. if (!defined_default(options)) {
  34700. options = {};
  34701. }
  34702. const positions = options.positions;
  34703. if (!defined_default(positions)) {
  34704. throw new DeveloperError_default("options.positions is required.");
  34705. }
  34706. const length3 = positions.length;
  34707. const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  34708. let height = defaultValue_default(options.height, 0);
  34709. const hasHeightArray = Array.isArray(height);
  34710. if (length3 < 1) {
  34711. return [];
  34712. } else if (length3 === 1) {
  34713. const p2 = ellipsoid.scaleToGeodeticSurface(positions[0], scaleFirst);
  34714. height = hasHeightArray ? height[0] : height;
  34715. if (height !== 0) {
  34716. const n2 = ellipsoid.geodeticSurfaceNormal(p2, cartesian);
  34717. Cartesian3_default.multiplyByScalar(n2, height, n2);
  34718. Cartesian3_default.add(p2, n2, p2);
  34719. }
  34720. return [p2.x, p2.y, p2.z];
  34721. }
  34722. const granularity = defaultValue_default(
  34723. options.granularity,
  34724. Math_default.RADIANS_PER_DEGREE
  34725. );
  34726. let numPoints = 0;
  34727. let i2;
  34728. let c0 = ellipsoid.cartesianToCartographic(
  34729. positions[0],
  34730. scratchCartographic02
  34731. );
  34732. let c14;
  34733. for (i2 = 0; i2 < length3 - 1; i2++) {
  34734. c14 = ellipsoid.cartesianToCartographic(
  34735. positions[i2 + 1],
  34736. scratchCartographic12
  34737. );
  34738. numPoints += PolylinePipeline.numberOfPointsRhumbLine(c0, c14, granularity);
  34739. c0 = Cartographic_default.clone(c14, scratchCartographic02);
  34740. }
  34741. const arrayLength = (numPoints + 1) * 3;
  34742. const newPositions = new Array(arrayLength);
  34743. let offset2 = 0;
  34744. for (i2 = 0; i2 < length3 - 1; i2++) {
  34745. const p0 = positions[i2];
  34746. const p1 = positions[i2 + 1];
  34747. const h0 = hasHeightArray ? height[i2] : height;
  34748. const h1 = hasHeightArray ? height[i2 + 1] : height;
  34749. offset2 = generateCartesianRhumbArc(
  34750. p0,
  34751. p1,
  34752. granularity,
  34753. ellipsoid,
  34754. h0,
  34755. h1,
  34756. newPositions,
  34757. offset2
  34758. );
  34759. }
  34760. subdivideHeightsScratchArray.length = 0;
  34761. const lastPoint = positions[length3 - 1];
  34762. const carto = ellipsoid.cartesianToCartographic(lastPoint, carto1);
  34763. carto.height = hasHeightArray ? height[length3 - 1] : height;
  34764. const cart = ellipsoid.cartographicToCartesian(carto, cartesian);
  34765. Cartesian3_default.pack(cart, newPositions, arrayLength - 3);
  34766. return newPositions;
  34767. };
  34768. PolylinePipeline.generateCartesianArc = function(options) {
  34769. const numberArray = PolylinePipeline.generateArc(options);
  34770. const size = numberArray.length / 3;
  34771. const newPositions = new Array(size);
  34772. for (let i2 = 0; i2 < size; i2++) {
  34773. newPositions[i2] = Cartesian3_default.unpack(numberArray, i2 * 3);
  34774. }
  34775. return newPositions;
  34776. };
  34777. PolylinePipeline.generateCartesianRhumbArc = function(options) {
  34778. const numberArray = PolylinePipeline.generateRhumbArc(options);
  34779. const size = numberArray.length / 3;
  34780. const newPositions = new Array(size);
  34781. for (let i2 = 0; i2 < size; i2++) {
  34782. newPositions[i2] = Cartesian3_default.unpack(numberArray, i2 * 3);
  34783. }
  34784. return newPositions;
  34785. };
  34786. var PolylinePipeline_default = PolylinePipeline;
  34787. // node_modules/cesium/Source/Core/oneTimeWarning.js
  34788. var warnings = {};
  34789. function oneTimeWarning(identifier, message) {
  34790. if (!defined_default(identifier)) {
  34791. throw new DeveloperError_default("identifier is required.");
  34792. }
  34793. if (!defined_default(warnings[identifier])) {
  34794. warnings[identifier] = true;
  34795. console.warn(defaultValue_default(message, identifier));
  34796. }
  34797. }
  34798. oneTimeWarning.geometryOutlines = "Entity geometry outlines are unsupported on terrain. Outlines will be disabled. To enable outlines, disable geometry terrain clamping by explicitly setting height to 0.";
  34799. oneTimeWarning.geometryZIndex = "Entity geometry with zIndex are unsupported when height or extrudedHeight are defined. zIndex will be ignored";
  34800. oneTimeWarning.geometryHeightReference = "Entity corridor, ellipse, polygon or rectangle with heightReference must also have a defined height. heightReference will be ignored";
  34801. oneTimeWarning.geometryExtrudedHeightReference = "Entity corridor, ellipse, polygon or rectangle with extrudedHeightReference must also have a defined extrudedHeight. extrudedHeightReference will be ignored";
  34802. var oneTimeWarning_default = oneTimeWarning;
  34803. // node_modules/cesium/Source/Core/PolylineVolumeGeometryLibrary.js
  34804. var scratch2Array = [new Cartesian3_default(), new Cartesian3_default()];
  34805. var scratchCartesian16 = new Cartesian3_default();
  34806. var scratchCartesian27 = new Cartesian3_default();
  34807. var scratchCartesian37 = new Cartesian3_default();
  34808. var scratchCartesian43 = new Cartesian3_default();
  34809. var scratchCartesian52 = new Cartesian3_default();
  34810. var scratchCartesian62 = new Cartesian3_default();
  34811. var scratchCartesian7 = new Cartesian3_default();
  34812. var scratchCartesian8 = new Cartesian3_default();
  34813. var scratchCartesian9 = new Cartesian3_default();
  34814. var scratch1 = new Cartesian3_default();
  34815. var scratch2 = new Cartesian3_default();
  34816. var PolylineVolumeGeometryLibrary = {};
  34817. var cartographic = new Cartographic_default();
  34818. function scaleToSurface(positions, ellipsoid) {
  34819. const heights = new Array(positions.length);
  34820. for (let i2 = 0; i2 < positions.length; i2++) {
  34821. const pos = positions[i2];
  34822. cartographic = ellipsoid.cartesianToCartographic(pos, cartographic);
  34823. heights[i2] = cartographic.height;
  34824. positions[i2] = ellipsoid.scaleToGeodeticSurface(pos, pos);
  34825. }
  34826. return heights;
  34827. }
  34828. function subdivideHeights2(points, h0, h1, granularity) {
  34829. const p0 = points[0];
  34830. const p1 = points[1];
  34831. const angleBetween = Cartesian3_default.angleBetween(p0, p1);
  34832. const numPoints = Math.ceil(angleBetween / granularity);
  34833. const heights = new Array(numPoints);
  34834. let i2;
  34835. if (h0 === h1) {
  34836. for (i2 = 0; i2 < numPoints; i2++) {
  34837. heights[i2] = h0;
  34838. }
  34839. heights.push(h1);
  34840. return heights;
  34841. }
  34842. const dHeight = h1 - h0;
  34843. const heightPerVertex = dHeight / numPoints;
  34844. for (i2 = 1; i2 < numPoints; i2++) {
  34845. const h = h0 + i2 * heightPerVertex;
  34846. heights[i2] = h;
  34847. }
  34848. heights[0] = h0;
  34849. heights.push(h1);
  34850. return heights;
  34851. }
  34852. var nextScratch = new Cartesian3_default();
  34853. var prevScratch = new Cartesian3_default();
  34854. function computeRotationAngle(start, end, position, ellipsoid) {
  34855. const tangentPlane = new EllipsoidTangentPlane_default(position, ellipsoid);
  34856. const next = tangentPlane.projectPointOntoPlane(
  34857. Cartesian3_default.add(position, start, nextScratch),
  34858. nextScratch
  34859. );
  34860. const prev = tangentPlane.projectPointOntoPlane(
  34861. Cartesian3_default.add(position, end, prevScratch),
  34862. prevScratch
  34863. );
  34864. const angle = Cartesian2_default.angleBetween(next, prev);
  34865. return prev.x * next.y - prev.y * next.x >= 0 ? -angle : angle;
  34866. }
  34867. var negativeX = new Cartesian3_default(-1, 0, 0);
  34868. var transform = new Matrix4_default();
  34869. var translation = new Matrix4_default();
  34870. var rotationZ = new Matrix3_default();
  34871. var scaleMatrix = Matrix3_default.IDENTITY.clone();
  34872. var westScratch2 = new Cartesian3_default();
  34873. var finalPosScratch = new Cartesian4_default();
  34874. var heightCartesian = new Cartesian3_default();
  34875. function addPosition(center, left, shape, finalPositions, ellipsoid, height, xScalar, repeat) {
  34876. let west = westScratch2;
  34877. let finalPosition = finalPosScratch;
  34878. transform = Transforms_default.eastNorthUpToFixedFrame(center, ellipsoid, transform);
  34879. west = Matrix4_default.multiplyByPointAsVector(transform, negativeX, west);
  34880. west = Cartesian3_default.normalize(west, west);
  34881. const angle = computeRotationAngle(west, left, center, ellipsoid);
  34882. rotationZ = Matrix3_default.fromRotationZ(angle, rotationZ);
  34883. heightCartesian.z = height;
  34884. transform = Matrix4_default.multiplyTransformation(
  34885. transform,
  34886. Matrix4_default.fromRotationTranslation(rotationZ, heightCartesian, translation),
  34887. transform
  34888. );
  34889. const scale = scaleMatrix;
  34890. scale[0] = xScalar;
  34891. for (let j = 0; j < repeat; j++) {
  34892. for (let i2 = 0; i2 < shape.length; i2 += 3) {
  34893. finalPosition = Cartesian3_default.fromArray(shape, i2, finalPosition);
  34894. finalPosition = Matrix3_default.multiplyByVector(
  34895. scale,
  34896. finalPosition,
  34897. finalPosition
  34898. );
  34899. finalPosition = Matrix4_default.multiplyByPoint(
  34900. transform,
  34901. finalPosition,
  34902. finalPosition
  34903. );
  34904. finalPositions.push(finalPosition.x, finalPosition.y, finalPosition.z);
  34905. }
  34906. }
  34907. return finalPositions;
  34908. }
  34909. var centerScratch2 = new Cartesian3_default();
  34910. function addPositions(centers, left, shape, finalPositions, ellipsoid, heights, xScalar) {
  34911. for (let i2 = 0; i2 < centers.length; i2 += 3) {
  34912. const center = Cartesian3_default.fromArray(centers, i2, centerScratch2);
  34913. finalPositions = addPosition(
  34914. center,
  34915. left,
  34916. shape,
  34917. finalPositions,
  34918. ellipsoid,
  34919. heights[i2 / 3],
  34920. xScalar,
  34921. 1
  34922. );
  34923. }
  34924. return finalPositions;
  34925. }
  34926. function convertShapeTo3DDuplicate(shape2D, boundingRectangle) {
  34927. const length3 = shape2D.length;
  34928. const shape = new Array(length3 * 6);
  34929. let index2 = 0;
  34930. const xOffset = boundingRectangle.x + boundingRectangle.width / 2;
  34931. const yOffset = boundingRectangle.y + boundingRectangle.height / 2;
  34932. let point = shape2D[0];
  34933. shape[index2++] = point.x - xOffset;
  34934. shape[index2++] = 0;
  34935. shape[index2++] = point.y - yOffset;
  34936. for (let i2 = 1; i2 < length3; i2++) {
  34937. point = shape2D[i2];
  34938. const x = point.x - xOffset;
  34939. const z = point.y - yOffset;
  34940. shape[index2++] = x;
  34941. shape[index2++] = 0;
  34942. shape[index2++] = z;
  34943. shape[index2++] = x;
  34944. shape[index2++] = 0;
  34945. shape[index2++] = z;
  34946. }
  34947. point = shape2D[0];
  34948. shape[index2++] = point.x - xOffset;
  34949. shape[index2++] = 0;
  34950. shape[index2++] = point.y - yOffset;
  34951. return shape;
  34952. }
  34953. function convertShapeTo3D(shape2D, boundingRectangle) {
  34954. const length3 = shape2D.length;
  34955. const shape = new Array(length3 * 3);
  34956. let index2 = 0;
  34957. const xOffset = boundingRectangle.x + boundingRectangle.width / 2;
  34958. const yOffset = boundingRectangle.y + boundingRectangle.height / 2;
  34959. for (let i2 = 0; i2 < length3; i2++) {
  34960. shape[index2++] = shape2D[i2].x - xOffset;
  34961. shape[index2++] = 0;
  34962. shape[index2++] = shape2D[i2].y - yOffset;
  34963. }
  34964. return shape;
  34965. }
  34966. var quaterion = new Quaternion_default();
  34967. var startPointScratch = new Cartesian3_default();
  34968. var rotMatrix = new Matrix3_default();
  34969. function computeRoundCorner(pivot, startPoint, endPoint, cornerType, leftIsOutside, ellipsoid, finalPositions, shape, height, duplicatePoints) {
  34970. const angle = Cartesian3_default.angleBetween(
  34971. Cartesian3_default.subtract(startPoint, pivot, scratch1),
  34972. Cartesian3_default.subtract(endPoint, pivot, scratch2)
  34973. );
  34974. const granularity = cornerType === CornerType_default.BEVELED ? 0 : Math.ceil(angle / Math_default.toRadians(5));
  34975. let m;
  34976. if (leftIsOutside) {
  34977. m = Matrix3_default.fromQuaternion(
  34978. Quaternion_default.fromAxisAngle(
  34979. Cartesian3_default.negate(pivot, scratch1),
  34980. angle / (granularity + 1),
  34981. quaterion
  34982. ),
  34983. rotMatrix
  34984. );
  34985. } else {
  34986. m = Matrix3_default.fromQuaternion(
  34987. Quaternion_default.fromAxisAngle(pivot, angle / (granularity + 1), quaterion),
  34988. rotMatrix
  34989. );
  34990. }
  34991. let left;
  34992. let surfacePoint;
  34993. startPoint = Cartesian3_default.clone(startPoint, startPointScratch);
  34994. if (granularity > 0) {
  34995. const repeat = duplicatePoints ? 2 : 1;
  34996. for (let i2 = 0; i2 < granularity; i2++) {
  34997. startPoint = Matrix3_default.multiplyByVector(m, startPoint, startPoint);
  34998. left = Cartesian3_default.subtract(startPoint, pivot, scratch1);
  34999. left = Cartesian3_default.normalize(left, left);
  35000. if (!leftIsOutside) {
  35001. left = Cartesian3_default.negate(left, left);
  35002. }
  35003. surfacePoint = ellipsoid.scaleToGeodeticSurface(startPoint, scratch2);
  35004. finalPositions = addPosition(
  35005. surfacePoint,
  35006. left,
  35007. shape,
  35008. finalPositions,
  35009. ellipsoid,
  35010. height,
  35011. 1,
  35012. repeat
  35013. );
  35014. }
  35015. } else {
  35016. left = Cartesian3_default.subtract(startPoint, pivot, scratch1);
  35017. left = Cartesian3_default.normalize(left, left);
  35018. if (!leftIsOutside) {
  35019. left = Cartesian3_default.negate(left, left);
  35020. }
  35021. surfacePoint = ellipsoid.scaleToGeodeticSurface(startPoint, scratch2);
  35022. finalPositions = addPosition(
  35023. surfacePoint,
  35024. left,
  35025. shape,
  35026. finalPositions,
  35027. ellipsoid,
  35028. height,
  35029. 1,
  35030. 1
  35031. );
  35032. endPoint = Cartesian3_default.clone(endPoint, startPointScratch);
  35033. left = Cartesian3_default.subtract(endPoint, pivot, scratch1);
  35034. left = Cartesian3_default.normalize(left, left);
  35035. if (!leftIsOutside) {
  35036. left = Cartesian3_default.negate(left, left);
  35037. }
  35038. surfacePoint = ellipsoid.scaleToGeodeticSurface(endPoint, scratch2);
  35039. finalPositions = addPosition(
  35040. surfacePoint,
  35041. left,
  35042. shape,
  35043. finalPositions,
  35044. ellipsoid,
  35045. height,
  35046. 1,
  35047. 1
  35048. );
  35049. }
  35050. return finalPositions;
  35051. }
  35052. PolylineVolumeGeometryLibrary.removeDuplicatesFromShape = function(shapePositions) {
  35053. const length3 = shapePositions.length;
  35054. const cleanedPositions = [];
  35055. for (let i0 = length3 - 1, i1 = 0; i1 < length3; i0 = i1++) {
  35056. const v02 = shapePositions[i0];
  35057. const v13 = shapePositions[i1];
  35058. if (!Cartesian2_default.equals(v02, v13)) {
  35059. cleanedPositions.push(v13);
  35060. }
  35061. }
  35062. return cleanedPositions;
  35063. };
  35064. PolylineVolumeGeometryLibrary.angleIsGreaterThanPi = function(forward, backward, position, ellipsoid) {
  35065. const tangentPlane = new EllipsoidTangentPlane_default(position, ellipsoid);
  35066. const next = tangentPlane.projectPointOntoPlane(
  35067. Cartesian3_default.add(position, forward, nextScratch),
  35068. nextScratch
  35069. );
  35070. const prev = tangentPlane.projectPointOntoPlane(
  35071. Cartesian3_default.add(position, backward, prevScratch),
  35072. prevScratch
  35073. );
  35074. return prev.x * next.y - prev.y * next.x >= 0;
  35075. };
  35076. var scratchForwardProjection = new Cartesian3_default();
  35077. var scratchBackwardProjection = new Cartesian3_default();
  35078. PolylineVolumeGeometryLibrary.computePositions = function(positions, shape2D, boundingRectangle, geometry, duplicatePoints) {
  35079. const ellipsoid = geometry._ellipsoid;
  35080. const heights = scaleToSurface(positions, ellipsoid);
  35081. const granularity = geometry._granularity;
  35082. const cornerType = geometry._cornerType;
  35083. const shapeForSides = duplicatePoints ? convertShapeTo3DDuplicate(shape2D, boundingRectangle) : convertShapeTo3D(shape2D, boundingRectangle);
  35084. const shapeForEnds = duplicatePoints ? convertShapeTo3D(shape2D, boundingRectangle) : void 0;
  35085. const heightOffset = boundingRectangle.height / 2;
  35086. const width = boundingRectangle.width / 2;
  35087. let length3 = positions.length;
  35088. let finalPositions = [];
  35089. let ends = duplicatePoints ? [] : void 0;
  35090. let forward = scratchCartesian16;
  35091. let backward = scratchCartesian27;
  35092. let cornerDirection = scratchCartesian37;
  35093. let surfaceNormal = scratchCartesian43;
  35094. let pivot = scratchCartesian52;
  35095. let start = scratchCartesian62;
  35096. let end = scratchCartesian7;
  35097. let left = scratchCartesian8;
  35098. let previousPosition = scratchCartesian9;
  35099. let position = positions[0];
  35100. let nextPosition = positions[1];
  35101. surfaceNormal = ellipsoid.geodeticSurfaceNormal(position, surfaceNormal);
  35102. forward = Cartesian3_default.subtract(nextPosition, position, forward);
  35103. forward = Cartesian3_default.normalize(forward, forward);
  35104. left = Cartesian3_default.cross(surfaceNormal, forward, left);
  35105. left = Cartesian3_default.normalize(left, left);
  35106. let h0 = heights[0];
  35107. let h1 = heights[1];
  35108. if (duplicatePoints) {
  35109. ends = addPosition(
  35110. position,
  35111. left,
  35112. shapeForEnds,
  35113. ends,
  35114. ellipsoid,
  35115. h0 + heightOffset,
  35116. 1,
  35117. 1
  35118. );
  35119. }
  35120. previousPosition = Cartesian3_default.clone(position, previousPosition);
  35121. position = nextPosition;
  35122. backward = Cartesian3_default.negate(forward, backward);
  35123. let subdividedHeights;
  35124. let subdividedPositions;
  35125. for (let i2 = 1; i2 < length3 - 1; i2++) {
  35126. const repeat = duplicatePoints ? 2 : 1;
  35127. nextPosition = positions[i2 + 1];
  35128. if (position.equals(nextPosition)) {
  35129. oneTimeWarning_default(
  35130. "Positions are too close and are considered equivalent with rounding error."
  35131. );
  35132. continue;
  35133. }
  35134. forward = Cartesian3_default.subtract(nextPosition, position, forward);
  35135. forward = Cartesian3_default.normalize(forward, forward);
  35136. cornerDirection = Cartesian3_default.add(forward, backward, cornerDirection);
  35137. cornerDirection = Cartesian3_default.normalize(cornerDirection, cornerDirection);
  35138. surfaceNormal = ellipsoid.geodeticSurfaceNormal(position, surfaceNormal);
  35139. const forwardProjection = Cartesian3_default.multiplyByScalar(
  35140. surfaceNormal,
  35141. Cartesian3_default.dot(forward, surfaceNormal),
  35142. scratchForwardProjection
  35143. );
  35144. Cartesian3_default.subtract(forward, forwardProjection, forwardProjection);
  35145. Cartesian3_default.normalize(forwardProjection, forwardProjection);
  35146. const backwardProjection = Cartesian3_default.multiplyByScalar(
  35147. surfaceNormal,
  35148. Cartesian3_default.dot(backward, surfaceNormal),
  35149. scratchBackwardProjection
  35150. );
  35151. Cartesian3_default.subtract(backward, backwardProjection, backwardProjection);
  35152. Cartesian3_default.normalize(backwardProjection, backwardProjection);
  35153. const doCorner = !Math_default.equalsEpsilon(
  35154. Math.abs(Cartesian3_default.dot(forwardProjection, backwardProjection)),
  35155. 1,
  35156. Math_default.EPSILON7
  35157. );
  35158. if (doCorner) {
  35159. cornerDirection = Cartesian3_default.cross(
  35160. cornerDirection,
  35161. surfaceNormal,
  35162. cornerDirection
  35163. );
  35164. cornerDirection = Cartesian3_default.cross(
  35165. surfaceNormal,
  35166. cornerDirection,
  35167. cornerDirection
  35168. );
  35169. cornerDirection = Cartesian3_default.normalize(cornerDirection, cornerDirection);
  35170. const scalar = 1 / Math.max(
  35171. 0.25,
  35172. Cartesian3_default.magnitude(
  35173. Cartesian3_default.cross(cornerDirection, backward, scratch1)
  35174. )
  35175. );
  35176. const leftIsOutside = PolylineVolumeGeometryLibrary.angleIsGreaterThanPi(
  35177. forward,
  35178. backward,
  35179. position,
  35180. ellipsoid
  35181. );
  35182. if (leftIsOutside) {
  35183. pivot = Cartesian3_default.add(
  35184. position,
  35185. Cartesian3_default.multiplyByScalar(
  35186. cornerDirection,
  35187. scalar * width,
  35188. cornerDirection
  35189. ),
  35190. pivot
  35191. );
  35192. start = Cartesian3_default.add(
  35193. pivot,
  35194. Cartesian3_default.multiplyByScalar(left, width, start),
  35195. start
  35196. );
  35197. scratch2Array[0] = Cartesian3_default.clone(previousPosition, scratch2Array[0]);
  35198. scratch2Array[1] = Cartesian3_default.clone(start, scratch2Array[1]);
  35199. subdividedHeights = subdivideHeights2(
  35200. scratch2Array,
  35201. h0 + heightOffset,
  35202. h1 + heightOffset,
  35203. granularity
  35204. );
  35205. subdividedPositions = PolylinePipeline_default.generateArc({
  35206. positions: scratch2Array,
  35207. granularity,
  35208. ellipsoid
  35209. });
  35210. finalPositions = addPositions(
  35211. subdividedPositions,
  35212. left,
  35213. shapeForSides,
  35214. finalPositions,
  35215. ellipsoid,
  35216. subdividedHeights,
  35217. 1
  35218. );
  35219. left = Cartesian3_default.cross(surfaceNormal, forward, left);
  35220. left = Cartesian3_default.normalize(left, left);
  35221. end = Cartesian3_default.add(
  35222. pivot,
  35223. Cartesian3_default.multiplyByScalar(left, width, end),
  35224. end
  35225. );
  35226. if (cornerType === CornerType_default.ROUNDED || cornerType === CornerType_default.BEVELED) {
  35227. computeRoundCorner(
  35228. pivot,
  35229. start,
  35230. end,
  35231. cornerType,
  35232. leftIsOutside,
  35233. ellipsoid,
  35234. finalPositions,
  35235. shapeForSides,
  35236. h1 + heightOffset,
  35237. duplicatePoints
  35238. );
  35239. } else {
  35240. cornerDirection = Cartesian3_default.negate(cornerDirection, cornerDirection);
  35241. finalPositions = addPosition(
  35242. position,
  35243. cornerDirection,
  35244. shapeForSides,
  35245. finalPositions,
  35246. ellipsoid,
  35247. h1 + heightOffset,
  35248. scalar,
  35249. repeat
  35250. );
  35251. }
  35252. previousPosition = Cartesian3_default.clone(end, previousPosition);
  35253. } else {
  35254. pivot = Cartesian3_default.add(
  35255. position,
  35256. Cartesian3_default.multiplyByScalar(
  35257. cornerDirection,
  35258. scalar * width,
  35259. cornerDirection
  35260. ),
  35261. pivot
  35262. );
  35263. start = Cartesian3_default.add(
  35264. pivot,
  35265. Cartesian3_default.multiplyByScalar(left, -width, start),
  35266. start
  35267. );
  35268. scratch2Array[0] = Cartesian3_default.clone(previousPosition, scratch2Array[0]);
  35269. scratch2Array[1] = Cartesian3_default.clone(start, scratch2Array[1]);
  35270. subdividedHeights = subdivideHeights2(
  35271. scratch2Array,
  35272. h0 + heightOffset,
  35273. h1 + heightOffset,
  35274. granularity
  35275. );
  35276. subdividedPositions = PolylinePipeline_default.generateArc({
  35277. positions: scratch2Array,
  35278. granularity,
  35279. ellipsoid
  35280. });
  35281. finalPositions = addPositions(
  35282. subdividedPositions,
  35283. left,
  35284. shapeForSides,
  35285. finalPositions,
  35286. ellipsoid,
  35287. subdividedHeights,
  35288. 1
  35289. );
  35290. left = Cartesian3_default.cross(surfaceNormal, forward, left);
  35291. left = Cartesian3_default.normalize(left, left);
  35292. end = Cartesian3_default.add(
  35293. pivot,
  35294. Cartesian3_default.multiplyByScalar(left, -width, end),
  35295. end
  35296. );
  35297. if (cornerType === CornerType_default.ROUNDED || cornerType === CornerType_default.BEVELED) {
  35298. computeRoundCorner(
  35299. pivot,
  35300. start,
  35301. end,
  35302. cornerType,
  35303. leftIsOutside,
  35304. ellipsoid,
  35305. finalPositions,
  35306. shapeForSides,
  35307. h1 + heightOffset,
  35308. duplicatePoints
  35309. );
  35310. } else {
  35311. finalPositions = addPosition(
  35312. position,
  35313. cornerDirection,
  35314. shapeForSides,
  35315. finalPositions,
  35316. ellipsoid,
  35317. h1 + heightOffset,
  35318. scalar,
  35319. repeat
  35320. );
  35321. }
  35322. previousPosition = Cartesian3_default.clone(end, previousPosition);
  35323. }
  35324. backward = Cartesian3_default.negate(forward, backward);
  35325. } else {
  35326. finalPositions = addPosition(
  35327. previousPosition,
  35328. left,
  35329. shapeForSides,
  35330. finalPositions,
  35331. ellipsoid,
  35332. h0 + heightOffset,
  35333. 1,
  35334. 1
  35335. );
  35336. previousPosition = position;
  35337. }
  35338. h0 = h1;
  35339. h1 = heights[i2 + 1];
  35340. position = nextPosition;
  35341. }
  35342. scratch2Array[0] = Cartesian3_default.clone(previousPosition, scratch2Array[0]);
  35343. scratch2Array[1] = Cartesian3_default.clone(position, scratch2Array[1]);
  35344. subdividedHeights = subdivideHeights2(
  35345. scratch2Array,
  35346. h0 + heightOffset,
  35347. h1 + heightOffset,
  35348. granularity
  35349. );
  35350. subdividedPositions = PolylinePipeline_default.generateArc({
  35351. positions: scratch2Array,
  35352. granularity,
  35353. ellipsoid
  35354. });
  35355. finalPositions = addPositions(
  35356. subdividedPositions,
  35357. left,
  35358. shapeForSides,
  35359. finalPositions,
  35360. ellipsoid,
  35361. subdividedHeights,
  35362. 1
  35363. );
  35364. if (duplicatePoints) {
  35365. ends = addPosition(
  35366. position,
  35367. left,
  35368. shapeForEnds,
  35369. ends,
  35370. ellipsoid,
  35371. h1 + heightOffset,
  35372. 1,
  35373. 1
  35374. );
  35375. }
  35376. length3 = finalPositions.length;
  35377. const posLength = duplicatePoints ? length3 + ends.length : length3;
  35378. const combinedPositions = new Float64Array(posLength);
  35379. combinedPositions.set(finalPositions);
  35380. if (duplicatePoints) {
  35381. combinedPositions.set(ends, length3);
  35382. }
  35383. return combinedPositions;
  35384. };
  35385. var PolylineVolumeGeometryLibrary_default = PolylineVolumeGeometryLibrary;
  35386. // node_modules/cesium/Source/Core/CorridorGeometryLibrary.js
  35387. var CorridorGeometryLibrary = {};
  35388. var scratch12 = new Cartesian3_default();
  35389. var scratch22 = new Cartesian3_default();
  35390. var scratch3 = new Cartesian3_default();
  35391. var scratch4 = new Cartesian3_default();
  35392. var scaleArray2 = [new Cartesian3_default(), new Cartesian3_default()];
  35393. var cartesian1 = new Cartesian3_default();
  35394. var cartesian2 = new Cartesian3_default();
  35395. var cartesian3 = new Cartesian3_default();
  35396. var cartesian4 = new Cartesian3_default();
  35397. var cartesian5 = new Cartesian3_default();
  35398. var cartesian6 = new Cartesian3_default();
  35399. var cartesian7 = new Cartesian3_default();
  35400. var cartesian8 = new Cartesian3_default();
  35401. var cartesian9 = new Cartesian3_default();
  35402. var cartesian10 = new Cartesian3_default();
  35403. var quaterion2 = new Quaternion_default();
  35404. var rotMatrix2 = new Matrix3_default();
  35405. function computeRoundCorner2(cornerPoint, startPoint, endPoint, cornerType, leftIsOutside) {
  35406. const angle = Cartesian3_default.angleBetween(
  35407. Cartesian3_default.subtract(startPoint, cornerPoint, scratch12),
  35408. Cartesian3_default.subtract(endPoint, cornerPoint, scratch22)
  35409. );
  35410. const granularity = cornerType === CornerType_default.BEVELED ? 1 : Math.ceil(angle / Math_default.toRadians(5)) + 1;
  35411. const size = granularity * 3;
  35412. const array = new Array(size);
  35413. array[size - 3] = endPoint.x;
  35414. array[size - 2] = endPoint.y;
  35415. array[size - 1] = endPoint.z;
  35416. let m;
  35417. if (leftIsOutside) {
  35418. m = Matrix3_default.fromQuaternion(
  35419. Quaternion_default.fromAxisAngle(
  35420. Cartesian3_default.negate(cornerPoint, scratch12),
  35421. angle / granularity,
  35422. quaterion2
  35423. ),
  35424. rotMatrix2
  35425. );
  35426. } else {
  35427. m = Matrix3_default.fromQuaternion(
  35428. Quaternion_default.fromAxisAngle(cornerPoint, angle / granularity, quaterion2),
  35429. rotMatrix2
  35430. );
  35431. }
  35432. let index2 = 0;
  35433. startPoint = Cartesian3_default.clone(startPoint, scratch12);
  35434. for (let i2 = 0; i2 < granularity; i2++) {
  35435. startPoint = Matrix3_default.multiplyByVector(m, startPoint, startPoint);
  35436. array[index2++] = startPoint.x;
  35437. array[index2++] = startPoint.y;
  35438. array[index2++] = startPoint.z;
  35439. }
  35440. return array;
  35441. }
  35442. function addEndCaps(calculatedPositions) {
  35443. let cornerPoint = cartesian1;
  35444. let startPoint = cartesian2;
  35445. let endPoint = cartesian3;
  35446. let leftEdge = calculatedPositions[1];
  35447. startPoint = Cartesian3_default.fromArray(
  35448. calculatedPositions[1],
  35449. leftEdge.length - 3,
  35450. startPoint
  35451. );
  35452. endPoint = Cartesian3_default.fromArray(calculatedPositions[0], 0, endPoint);
  35453. cornerPoint = Cartesian3_default.midpoint(startPoint, endPoint, cornerPoint);
  35454. const firstEndCap = computeRoundCorner2(
  35455. cornerPoint,
  35456. startPoint,
  35457. endPoint,
  35458. CornerType_default.ROUNDED,
  35459. false
  35460. );
  35461. const length3 = calculatedPositions.length - 1;
  35462. const rightEdge = calculatedPositions[length3 - 1];
  35463. leftEdge = calculatedPositions[length3];
  35464. startPoint = Cartesian3_default.fromArray(
  35465. rightEdge,
  35466. rightEdge.length - 3,
  35467. startPoint
  35468. );
  35469. endPoint = Cartesian3_default.fromArray(leftEdge, 0, endPoint);
  35470. cornerPoint = Cartesian3_default.midpoint(startPoint, endPoint, cornerPoint);
  35471. const lastEndCap = computeRoundCorner2(
  35472. cornerPoint,
  35473. startPoint,
  35474. endPoint,
  35475. CornerType_default.ROUNDED,
  35476. false
  35477. );
  35478. return [firstEndCap, lastEndCap];
  35479. }
  35480. function computeMiteredCorner(position, leftCornerDirection, lastPoint, leftIsOutside) {
  35481. let cornerPoint = scratch12;
  35482. if (leftIsOutside) {
  35483. cornerPoint = Cartesian3_default.add(position, leftCornerDirection, cornerPoint);
  35484. } else {
  35485. leftCornerDirection = Cartesian3_default.negate(
  35486. leftCornerDirection,
  35487. leftCornerDirection
  35488. );
  35489. cornerPoint = Cartesian3_default.add(position, leftCornerDirection, cornerPoint);
  35490. }
  35491. return [
  35492. cornerPoint.x,
  35493. cornerPoint.y,
  35494. cornerPoint.z,
  35495. lastPoint.x,
  35496. lastPoint.y,
  35497. lastPoint.z
  35498. ];
  35499. }
  35500. function addShiftedPositions(positions, left, scalar, calculatedPositions) {
  35501. const rightPositions = new Array(positions.length);
  35502. const leftPositions = new Array(positions.length);
  35503. const scaledLeft = Cartesian3_default.multiplyByScalar(left, scalar, scratch12);
  35504. const scaledRight = Cartesian3_default.negate(scaledLeft, scratch22);
  35505. let rightIndex = 0;
  35506. let leftIndex = positions.length - 1;
  35507. for (let i2 = 0; i2 < positions.length; i2 += 3) {
  35508. const pos = Cartesian3_default.fromArray(positions, i2, scratch3);
  35509. const rightPos = Cartesian3_default.add(pos, scaledRight, scratch4);
  35510. rightPositions[rightIndex++] = rightPos.x;
  35511. rightPositions[rightIndex++] = rightPos.y;
  35512. rightPositions[rightIndex++] = rightPos.z;
  35513. const leftPos = Cartesian3_default.add(pos, scaledLeft, scratch4);
  35514. leftPositions[leftIndex--] = leftPos.z;
  35515. leftPositions[leftIndex--] = leftPos.y;
  35516. leftPositions[leftIndex--] = leftPos.x;
  35517. }
  35518. calculatedPositions.push(rightPositions, leftPositions);
  35519. return calculatedPositions;
  35520. }
  35521. CorridorGeometryLibrary.addAttribute = function(attribute, value, front, back) {
  35522. const x = value.x;
  35523. const y = value.y;
  35524. const z = value.z;
  35525. if (defined_default(front)) {
  35526. attribute[front] = x;
  35527. attribute[front + 1] = y;
  35528. attribute[front + 2] = z;
  35529. }
  35530. if (defined_default(back)) {
  35531. attribute[back] = z;
  35532. attribute[back - 1] = y;
  35533. attribute[back - 2] = x;
  35534. }
  35535. };
  35536. var scratchForwardProjection2 = new Cartesian3_default();
  35537. var scratchBackwardProjection2 = new Cartesian3_default();
  35538. CorridorGeometryLibrary.computePositions = function(params) {
  35539. const granularity = params.granularity;
  35540. const positions = params.positions;
  35541. const ellipsoid = params.ellipsoid;
  35542. const width = params.width / 2;
  35543. const cornerType = params.cornerType;
  35544. const saveAttributes = params.saveAttributes;
  35545. let normal2 = cartesian1;
  35546. let forward = cartesian2;
  35547. let backward = cartesian3;
  35548. let left = cartesian4;
  35549. let cornerDirection = cartesian5;
  35550. let startPoint = cartesian6;
  35551. let previousPos = cartesian7;
  35552. let rightPos = cartesian8;
  35553. let leftPos = cartesian9;
  35554. let center = cartesian10;
  35555. let calculatedPositions = [];
  35556. const calculatedLefts = saveAttributes ? [] : void 0;
  35557. const calculatedNormals = saveAttributes ? [] : void 0;
  35558. let position = positions[0];
  35559. let nextPosition = positions[1];
  35560. forward = Cartesian3_default.normalize(
  35561. Cartesian3_default.subtract(nextPosition, position, forward),
  35562. forward
  35563. );
  35564. normal2 = ellipsoid.geodeticSurfaceNormal(position, normal2);
  35565. left = Cartesian3_default.normalize(Cartesian3_default.cross(normal2, forward, left), left);
  35566. if (saveAttributes) {
  35567. calculatedLefts.push(left.x, left.y, left.z);
  35568. calculatedNormals.push(normal2.x, normal2.y, normal2.z);
  35569. }
  35570. previousPos = Cartesian3_default.clone(position, previousPos);
  35571. position = nextPosition;
  35572. backward = Cartesian3_default.negate(forward, backward);
  35573. let subdividedPositions;
  35574. const corners = [];
  35575. let i2;
  35576. const length3 = positions.length;
  35577. for (i2 = 1; i2 < length3 - 1; i2++) {
  35578. normal2 = ellipsoid.geodeticSurfaceNormal(position, normal2);
  35579. nextPosition = positions[i2 + 1];
  35580. forward = Cartesian3_default.normalize(
  35581. Cartesian3_default.subtract(nextPosition, position, forward),
  35582. forward
  35583. );
  35584. cornerDirection = Cartesian3_default.normalize(
  35585. Cartesian3_default.add(forward, backward, cornerDirection),
  35586. cornerDirection
  35587. );
  35588. const forwardProjection = Cartesian3_default.multiplyByScalar(
  35589. normal2,
  35590. Cartesian3_default.dot(forward, normal2),
  35591. scratchForwardProjection2
  35592. );
  35593. Cartesian3_default.subtract(forward, forwardProjection, forwardProjection);
  35594. Cartesian3_default.normalize(forwardProjection, forwardProjection);
  35595. const backwardProjection = Cartesian3_default.multiplyByScalar(
  35596. normal2,
  35597. Cartesian3_default.dot(backward, normal2),
  35598. scratchBackwardProjection2
  35599. );
  35600. Cartesian3_default.subtract(backward, backwardProjection, backwardProjection);
  35601. Cartesian3_default.normalize(backwardProjection, backwardProjection);
  35602. const doCorner = !Math_default.equalsEpsilon(
  35603. Math.abs(Cartesian3_default.dot(forwardProjection, backwardProjection)),
  35604. 1,
  35605. Math_default.EPSILON7
  35606. );
  35607. if (doCorner) {
  35608. cornerDirection = Cartesian3_default.cross(
  35609. cornerDirection,
  35610. normal2,
  35611. cornerDirection
  35612. );
  35613. cornerDirection = Cartesian3_default.cross(
  35614. normal2,
  35615. cornerDirection,
  35616. cornerDirection
  35617. );
  35618. cornerDirection = Cartesian3_default.normalize(cornerDirection, cornerDirection);
  35619. const scalar = width / Math.max(
  35620. 0.25,
  35621. Cartesian3_default.magnitude(
  35622. Cartesian3_default.cross(cornerDirection, backward, scratch12)
  35623. )
  35624. );
  35625. const leftIsOutside = PolylineVolumeGeometryLibrary_default.angleIsGreaterThanPi(
  35626. forward,
  35627. backward,
  35628. position,
  35629. ellipsoid
  35630. );
  35631. cornerDirection = Cartesian3_default.multiplyByScalar(
  35632. cornerDirection,
  35633. scalar,
  35634. cornerDirection
  35635. );
  35636. if (leftIsOutside) {
  35637. rightPos = Cartesian3_default.add(position, cornerDirection, rightPos);
  35638. center = Cartesian3_default.add(
  35639. rightPos,
  35640. Cartesian3_default.multiplyByScalar(left, width, center),
  35641. center
  35642. );
  35643. leftPos = Cartesian3_default.add(
  35644. rightPos,
  35645. Cartesian3_default.multiplyByScalar(left, width * 2, leftPos),
  35646. leftPos
  35647. );
  35648. scaleArray2[0] = Cartesian3_default.clone(previousPos, scaleArray2[0]);
  35649. scaleArray2[1] = Cartesian3_default.clone(center, scaleArray2[1]);
  35650. subdividedPositions = PolylinePipeline_default.generateArc({
  35651. positions: scaleArray2,
  35652. granularity,
  35653. ellipsoid
  35654. });
  35655. calculatedPositions = addShiftedPositions(
  35656. subdividedPositions,
  35657. left,
  35658. width,
  35659. calculatedPositions
  35660. );
  35661. if (saveAttributes) {
  35662. calculatedLefts.push(left.x, left.y, left.z);
  35663. calculatedNormals.push(normal2.x, normal2.y, normal2.z);
  35664. }
  35665. startPoint = Cartesian3_default.clone(leftPos, startPoint);
  35666. left = Cartesian3_default.normalize(
  35667. Cartesian3_default.cross(normal2, forward, left),
  35668. left
  35669. );
  35670. leftPos = Cartesian3_default.add(
  35671. rightPos,
  35672. Cartesian3_default.multiplyByScalar(left, width * 2, leftPos),
  35673. leftPos
  35674. );
  35675. previousPos = Cartesian3_default.add(
  35676. rightPos,
  35677. Cartesian3_default.multiplyByScalar(left, width, previousPos),
  35678. previousPos
  35679. );
  35680. if (cornerType === CornerType_default.ROUNDED || cornerType === CornerType_default.BEVELED) {
  35681. corners.push({
  35682. leftPositions: computeRoundCorner2(
  35683. rightPos,
  35684. startPoint,
  35685. leftPos,
  35686. cornerType,
  35687. leftIsOutside
  35688. )
  35689. });
  35690. } else {
  35691. corners.push({
  35692. leftPositions: computeMiteredCorner(
  35693. position,
  35694. Cartesian3_default.negate(cornerDirection, cornerDirection),
  35695. leftPos,
  35696. leftIsOutside
  35697. )
  35698. });
  35699. }
  35700. } else {
  35701. leftPos = Cartesian3_default.add(position, cornerDirection, leftPos);
  35702. center = Cartesian3_default.add(
  35703. leftPos,
  35704. Cartesian3_default.negate(
  35705. Cartesian3_default.multiplyByScalar(left, width, center),
  35706. center
  35707. ),
  35708. center
  35709. );
  35710. rightPos = Cartesian3_default.add(
  35711. leftPos,
  35712. Cartesian3_default.negate(
  35713. Cartesian3_default.multiplyByScalar(left, width * 2, rightPos),
  35714. rightPos
  35715. ),
  35716. rightPos
  35717. );
  35718. scaleArray2[0] = Cartesian3_default.clone(previousPos, scaleArray2[0]);
  35719. scaleArray2[1] = Cartesian3_default.clone(center, scaleArray2[1]);
  35720. subdividedPositions = PolylinePipeline_default.generateArc({
  35721. positions: scaleArray2,
  35722. granularity,
  35723. ellipsoid
  35724. });
  35725. calculatedPositions = addShiftedPositions(
  35726. subdividedPositions,
  35727. left,
  35728. width,
  35729. calculatedPositions
  35730. );
  35731. if (saveAttributes) {
  35732. calculatedLefts.push(left.x, left.y, left.z);
  35733. calculatedNormals.push(normal2.x, normal2.y, normal2.z);
  35734. }
  35735. startPoint = Cartesian3_default.clone(rightPos, startPoint);
  35736. left = Cartesian3_default.normalize(
  35737. Cartesian3_default.cross(normal2, forward, left),
  35738. left
  35739. );
  35740. rightPos = Cartesian3_default.add(
  35741. leftPos,
  35742. Cartesian3_default.negate(
  35743. Cartesian3_default.multiplyByScalar(left, width * 2, rightPos),
  35744. rightPos
  35745. ),
  35746. rightPos
  35747. );
  35748. previousPos = Cartesian3_default.add(
  35749. leftPos,
  35750. Cartesian3_default.negate(
  35751. Cartesian3_default.multiplyByScalar(left, width, previousPos),
  35752. previousPos
  35753. ),
  35754. previousPos
  35755. );
  35756. if (cornerType === CornerType_default.ROUNDED || cornerType === CornerType_default.BEVELED) {
  35757. corners.push({
  35758. rightPositions: computeRoundCorner2(
  35759. leftPos,
  35760. startPoint,
  35761. rightPos,
  35762. cornerType,
  35763. leftIsOutside
  35764. )
  35765. });
  35766. } else {
  35767. corners.push({
  35768. rightPositions: computeMiteredCorner(
  35769. position,
  35770. cornerDirection,
  35771. rightPos,
  35772. leftIsOutside
  35773. )
  35774. });
  35775. }
  35776. }
  35777. backward = Cartesian3_default.negate(forward, backward);
  35778. }
  35779. position = nextPosition;
  35780. }
  35781. normal2 = ellipsoid.geodeticSurfaceNormal(position, normal2);
  35782. scaleArray2[0] = Cartesian3_default.clone(previousPos, scaleArray2[0]);
  35783. scaleArray2[1] = Cartesian3_default.clone(position, scaleArray2[1]);
  35784. subdividedPositions = PolylinePipeline_default.generateArc({
  35785. positions: scaleArray2,
  35786. granularity,
  35787. ellipsoid
  35788. });
  35789. calculatedPositions = addShiftedPositions(
  35790. subdividedPositions,
  35791. left,
  35792. width,
  35793. calculatedPositions
  35794. );
  35795. if (saveAttributes) {
  35796. calculatedLefts.push(left.x, left.y, left.z);
  35797. calculatedNormals.push(normal2.x, normal2.y, normal2.z);
  35798. }
  35799. let endPositions;
  35800. if (cornerType === CornerType_default.ROUNDED) {
  35801. endPositions = addEndCaps(calculatedPositions);
  35802. }
  35803. return {
  35804. positions: calculatedPositions,
  35805. corners,
  35806. lefts: calculatedLefts,
  35807. normals: calculatedNormals,
  35808. endPositions
  35809. };
  35810. };
  35811. var CorridorGeometryLibrary_default = CorridorGeometryLibrary;
  35812. // node_modules/cesium/Source/Core/CorridorGeometry.js
  35813. var cartesian12 = new Cartesian3_default();
  35814. var cartesian22 = new Cartesian3_default();
  35815. var cartesian32 = new Cartesian3_default();
  35816. var cartesian42 = new Cartesian3_default();
  35817. var cartesian52 = new Cartesian3_default();
  35818. var cartesian62 = new Cartesian3_default();
  35819. var scratch13 = new Cartesian3_default();
  35820. var scratch23 = new Cartesian3_default();
  35821. function scaleToSurface2(positions, ellipsoid) {
  35822. for (let i2 = 0; i2 < positions.length; i2++) {
  35823. positions[i2] = ellipsoid.scaleToGeodeticSurface(positions[i2], positions[i2]);
  35824. }
  35825. return positions;
  35826. }
  35827. function addNormals(attr, normal2, left, front, back, vertexFormat) {
  35828. const normals = attr.normals;
  35829. const tangents = attr.tangents;
  35830. const bitangents = attr.bitangents;
  35831. const forward = Cartesian3_default.normalize(
  35832. Cartesian3_default.cross(left, normal2, scratch13),
  35833. scratch13
  35834. );
  35835. if (vertexFormat.normal) {
  35836. CorridorGeometryLibrary_default.addAttribute(normals, normal2, front, back);
  35837. }
  35838. if (vertexFormat.tangent) {
  35839. CorridorGeometryLibrary_default.addAttribute(tangents, forward, front, back);
  35840. }
  35841. if (vertexFormat.bitangent) {
  35842. CorridorGeometryLibrary_default.addAttribute(bitangents, left, front, back);
  35843. }
  35844. }
  35845. function combine2(computedPositions, vertexFormat, ellipsoid) {
  35846. const positions = computedPositions.positions;
  35847. const corners = computedPositions.corners;
  35848. const endPositions = computedPositions.endPositions;
  35849. const computedLefts = computedPositions.lefts;
  35850. const computedNormals = computedPositions.normals;
  35851. const attributes = new GeometryAttributes_default();
  35852. let corner;
  35853. let leftCount = 0;
  35854. let rightCount = 0;
  35855. let i2;
  35856. let indicesLength = 0;
  35857. let length3;
  35858. for (i2 = 0; i2 < positions.length; i2 += 2) {
  35859. length3 = positions[i2].length - 3;
  35860. leftCount += length3;
  35861. indicesLength += length3 * 2;
  35862. rightCount += positions[i2 + 1].length - 3;
  35863. }
  35864. leftCount += 3;
  35865. rightCount += 3;
  35866. for (i2 = 0; i2 < corners.length; i2++) {
  35867. corner = corners[i2];
  35868. const leftSide = corners[i2].leftPositions;
  35869. if (defined_default(leftSide)) {
  35870. length3 = leftSide.length;
  35871. leftCount += length3;
  35872. indicesLength += length3;
  35873. } else {
  35874. length3 = corners[i2].rightPositions.length;
  35875. rightCount += length3;
  35876. indicesLength += length3;
  35877. }
  35878. }
  35879. const addEndPositions = defined_default(endPositions);
  35880. let endPositionLength;
  35881. if (addEndPositions) {
  35882. endPositionLength = endPositions[0].length - 3;
  35883. leftCount += endPositionLength;
  35884. rightCount += endPositionLength;
  35885. endPositionLength /= 3;
  35886. indicesLength += endPositionLength * 6;
  35887. }
  35888. const size = leftCount + rightCount;
  35889. const finalPositions = new Float64Array(size);
  35890. const normals = vertexFormat.normal ? new Float32Array(size) : void 0;
  35891. const tangents = vertexFormat.tangent ? new Float32Array(size) : void 0;
  35892. const bitangents = vertexFormat.bitangent ? new Float32Array(size) : void 0;
  35893. const attr = {
  35894. normals,
  35895. tangents,
  35896. bitangents
  35897. };
  35898. let front = 0;
  35899. let back = size - 1;
  35900. let UL, LL, UR, LR;
  35901. let normal2 = cartesian12;
  35902. let left = cartesian22;
  35903. let rightPos, leftPos;
  35904. const halfLength = endPositionLength / 2;
  35905. const indices2 = IndexDatatype_default.createTypedArray(size / 3, indicesLength);
  35906. let index2 = 0;
  35907. if (addEndPositions) {
  35908. leftPos = cartesian32;
  35909. rightPos = cartesian42;
  35910. const firstEndPositions = endPositions[0];
  35911. normal2 = Cartesian3_default.fromArray(computedNormals, 0, normal2);
  35912. left = Cartesian3_default.fromArray(computedLefts, 0, left);
  35913. for (i2 = 0; i2 < halfLength; i2++) {
  35914. leftPos = Cartesian3_default.fromArray(
  35915. firstEndPositions,
  35916. (halfLength - 1 - i2) * 3,
  35917. leftPos
  35918. );
  35919. rightPos = Cartesian3_default.fromArray(
  35920. firstEndPositions,
  35921. (halfLength + i2) * 3,
  35922. rightPos
  35923. );
  35924. CorridorGeometryLibrary_default.addAttribute(finalPositions, rightPos, front);
  35925. CorridorGeometryLibrary_default.addAttribute(
  35926. finalPositions,
  35927. leftPos,
  35928. void 0,
  35929. back
  35930. );
  35931. addNormals(attr, normal2, left, front, back, vertexFormat);
  35932. LL = front / 3;
  35933. LR = LL + 1;
  35934. UL = (back - 2) / 3;
  35935. UR = UL - 1;
  35936. indices2[index2++] = UL;
  35937. indices2[index2++] = LL;
  35938. indices2[index2++] = UR;
  35939. indices2[index2++] = UR;
  35940. indices2[index2++] = LL;
  35941. indices2[index2++] = LR;
  35942. front += 3;
  35943. back -= 3;
  35944. }
  35945. }
  35946. let posIndex = 0;
  35947. let compIndex = 0;
  35948. let rightEdge = positions[posIndex++];
  35949. let leftEdge = positions[posIndex++];
  35950. finalPositions.set(rightEdge, front);
  35951. finalPositions.set(leftEdge, back - leftEdge.length + 1);
  35952. left = Cartesian3_default.fromArray(computedLefts, compIndex, left);
  35953. let rightNormal;
  35954. let leftNormal;
  35955. length3 = leftEdge.length - 3;
  35956. for (i2 = 0; i2 < length3; i2 += 3) {
  35957. rightNormal = ellipsoid.geodeticSurfaceNormal(
  35958. Cartesian3_default.fromArray(rightEdge, i2, scratch13),
  35959. scratch13
  35960. );
  35961. leftNormal = ellipsoid.geodeticSurfaceNormal(
  35962. Cartesian3_default.fromArray(leftEdge, length3 - i2, scratch23),
  35963. scratch23
  35964. );
  35965. normal2 = Cartesian3_default.normalize(
  35966. Cartesian3_default.add(rightNormal, leftNormal, normal2),
  35967. normal2
  35968. );
  35969. addNormals(attr, normal2, left, front, back, vertexFormat);
  35970. LL = front / 3;
  35971. LR = LL + 1;
  35972. UL = (back - 2) / 3;
  35973. UR = UL - 1;
  35974. indices2[index2++] = UL;
  35975. indices2[index2++] = LL;
  35976. indices2[index2++] = UR;
  35977. indices2[index2++] = UR;
  35978. indices2[index2++] = LL;
  35979. indices2[index2++] = LR;
  35980. front += 3;
  35981. back -= 3;
  35982. }
  35983. rightNormal = ellipsoid.geodeticSurfaceNormal(
  35984. Cartesian3_default.fromArray(rightEdge, length3, scratch13),
  35985. scratch13
  35986. );
  35987. leftNormal = ellipsoid.geodeticSurfaceNormal(
  35988. Cartesian3_default.fromArray(leftEdge, length3, scratch23),
  35989. scratch23
  35990. );
  35991. normal2 = Cartesian3_default.normalize(
  35992. Cartesian3_default.add(rightNormal, leftNormal, normal2),
  35993. normal2
  35994. );
  35995. compIndex += 3;
  35996. for (i2 = 0; i2 < corners.length; i2++) {
  35997. let j;
  35998. corner = corners[i2];
  35999. const l2 = corner.leftPositions;
  36000. const r2 = corner.rightPositions;
  36001. let pivot;
  36002. let start;
  36003. let outsidePoint = cartesian62;
  36004. let previousPoint = cartesian32;
  36005. let nextPoint = cartesian42;
  36006. normal2 = Cartesian3_default.fromArray(computedNormals, compIndex, normal2);
  36007. if (defined_default(l2)) {
  36008. addNormals(attr, normal2, left, void 0, back, vertexFormat);
  36009. back -= 3;
  36010. pivot = LR;
  36011. start = UR;
  36012. for (j = 0; j < l2.length / 3; j++) {
  36013. outsidePoint = Cartesian3_default.fromArray(l2, j * 3, outsidePoint);
  36014. indices2[index2++] = pivot;
  36015. indices2[index2++] = start - j - 1;
  36016. indices2[index2++] = start - j;
  36017. CorridorGeometryLibrary_default.addAttribute(
  36018. finalPositions,
  36019. outsidePoint,
  36020. void 0,
  36021. back
  36022. );
  36023. previousPoint = Cartesian3_default.fromArray(
  36024. finalPositions,
  36025. (start - j - 1) * 3,
  36026. previousPoint
  36027. );
  36028. nextPoint = Cartesian3_default.fromArray(finalPositions, pivot * 3, nextPoint);
  36029. left = Cartesian3_default.normalize(
  36030. Cartesian3_default.subtract(previousPoint, nextPoint, left),
  36031. left
  36032. );
  36033. addNormals(attr, normal2, left, void 0, back, vertexFormat);
  36034. back -= 3;
  36035. }
  36036. outsidePoint = Cartesian3_default.fromArray(
  36037. finalPositions,
  36038. pivot * 3,
  36039. outsidePoint
  36040. );
  36041. previousPoint = Cartesian3_default.subtract(
  36042. Cartesian3_default.fromArray(finalPositions, start * 3, previousPoint),
  36043. outsidePoint,
  36044. previousPoint
  36045. );
  36046. nextPoint = Cartesian3_default.subtract(
  36047. Cartesian3_default.fromArray(finalPositions, (start - j) * 3, nextPoint),
  36048. outsidePoint,
  36049. nextPoint
  36050. );
  36051. left = Cartesian3_default.normalize(
  36052. Cartesian3_default.add(previousPoint, nextPoint, left),
  36053. left
  36054. );
  36055. addNormals(attr, normal2, left, front, void 0, vertexFormat);
  36056. front += 3;
  36057. } else {
  36058. addNormals(attr, normal2, left, front, void 0, vertexFormat);
  36059. front += 3;
  36060. pivot = UR;
  36061. start = LR;
  36062. for (j = 0; j < r2.length / 3; j++) {
  36063. outsidePoint = Cartesian3_default.fromArray(r2, j * 3, outsidePoint);
  36064. indices2[index2++] = pivot;
  36065. indices2[index2++] = start + j;
  36066. indices2[index2++] = start + j + 1;
  36067. CorridorGeometryLibrary_default.addAttribute(
  36068. finalPositions,
  36069. outsidePoint,
  36070. front
  36071. );
  36072. previousPoint = Cartesian3_default.fromArray(
  36073. finalPositions,
  36074. pivot * 3,
  36075. previousPoint
  36076. );
  36077. nextPoint = Cartesian3_default.fromArray(
  36078. finalPositions,
  36079. (start + j) * 3,
  36080. nextPoint
  36081. );
  36082. left = Cartesian3_default.normalize(
  36083. Cartesian3_default.subtract(previousPoint, nextPoint, left),
  36084. left
  36085. );
  36086. addNormals(attr, normal2, left, front, void 0, vertexFormat);
  36087. front += 3;
  36088. }
  36089. outsidePoint = Cartesian3_default.fromArray(
  36090. finalPositions,
  36091. pivot * 3,
  36092. outsidePoint
  36093. );
  36094. previousPoint = Cartesian3_default.subtract(
  36095. Cartesian3_default.fromArray(finalPositions, (start + j) * 3, previousPoint),
  36096. outsidePoint,
  36097. previousPoint
  36098. );
  36099. nextPoint = Cartesian3_default.subtract(
  36100. Cartesian3_default.fromArray(finalPositions, start * 3, nextPoint),
  36101. outsidePoint,
  36102. nextPoint
  36103. );
  36104. left = Cartesian3_default.normalize(
  36105. Cartesian3_default.negate(Cartesian3_default.add(nextPoint, previousPoint, left), left),
  36106. left
  36107. );
  36108. addNormals(attr, normal2, left, void 0, back, vertexFormat);
  36109. back -= 3;
  36110. }
  36111. rightEdge = positions[posIndex++];
  36112. leftEdge = positions[posIndex++];
  36113. rightEdge.splice(0, 3);
  36114. leftEdge.splice(leftEdge.length - 3, 3);
  36115. finalPositions.set(rightEdge, front);
  36116. finalPositions.set(leftEdge, back - leftEdge.length + 1);
  36117. length3 = leftEdge.length - 3;
  36118. compIndex += 3;
  36119. left = Cartesian3_default.fromArray(computedLefts, compIndex, left);
  36120. for (j = 0; j < leftEdge.length; j += 3) {
  36121. rightNormal = ellipsoid.geodeticSurfaceNormal(
  36122. Cartesian3_default.fromArray(rightEdge, j, scratch13),
  36123. scratch13
  36124. );
  36125. leftNormal = ellipsoid.geodeticSurfaceNormal(
  36126. Cartesian3_default.fromArray(leftEdge, length3 - j, scratch23),
  36127. scratch23
  36128. );
  36129. normal2 = Cartesian3_default.normalize(
  36130. Cartesian3_default.add(rightNormal, leftNormal, normal2),
  36131. normal2
  36132. );
  36133. addNormals(attr, normal2, left, front, back, vertexFormat);
  36134. LR = front / 3;
  36135. LL = LR - 1;
  36136. UR = (back - 2) / 3;
  36137. UL = UR + 1;
  36138. indices2[index2++] = UL;
  36139. indices2[index2++] = LL;
  36140. indices2[index2++] = UR;
  36141. indices2[index2++] = UR;
  36142. indices2[index2++] = LL;
  36143. indices2[index2++] = LR;
  36144. front += 3;
  36145. back -= 3;
  36146. }
  36147. front -= 3;
  36148. back += 3;
  36149. }
  36150. normal2 = Cartesian3_default.fromArray(
  36151. computedNormals,
  36152. computedNormals.length - 3,
  36153. normal2
  36154. );
  36155. addNormals(attr, normal2, left, front, back, vertexFormat);
  36156. if (addEndPositions) {
  36157. front += 3;
  36158. back -= 3;
  36159. leftPos = cartesian32;
  36160. rightPos = cartesian42;
  36161. const lastEndPositions = endPositions[1];
  36162. for (i2 = 0; i2 < halfLength; i2++) {
  36163. leftPos = Cartesian3_default.fromArray(
  36164. lastEndPositions,
  36165. (endPositionLength - i2 - 1) * 3,
  36166. leftPos
  36167. );
  36168. rightPos = Cartesian3_default.fromArray(lastEndPositions, i2 * 3, rightPos);
  36169. CorridorGeometryLibrary_default.addAttribute(
  36170. finalPositions,
  36171. leftPos,
  36172. void 0,
  36173. back
  36174. );
  36175. CorridorGeometryLibrary_default.addAttribute(finalPositions, rightPos, front);
  36176. addNormals(attr, normal2, left, front, back, vertexFormat);
  36177. LR = front / 3;
  36178. LL = LR - 1;
  36179. UR = (back - 2) / 3;
  36180. UL = UR + 1;
  36181. indices2[index2++] = UL;
  36182. indices2[index2++] = LL;
  36183. indices2[index2++] = UR;
  36184. indices2[index2++] = UR;
  36185. indices2[index2++] = LL;
  36186. indices2[index2++] = LR;
  36187. front += 3;
  36188. back -= 3;
  36189. }
  36190. }
  36191. attributes.position = new GeometryAttribute_default({
  36192. componentDatatype: ComponentDatatype_default.DOUBLE,
  36193. componentsPerAttribute: 3,
  36194. values: finalPositions
  36195. });
  36196. if (vertexFormat.st) {
  36197. const st = new Float32Array(size / 3 * 2);
  36198. let rightSt;
  36199. let leftSt;
  36200. let stIndex = 0;
  36201. if (addEndPositions) {
  36202. leftCount /= 3;
  36203. rightCount /= 3;
  36204. const theta = Math.PI / (endPositionLength + 1);
  36205. leftSt = 1 / (leftCount - endPositionLength + 1);
  36206. rightSt = 1 / (rightCount - endPositionLength + 1);
  36207. let a4;
  36208. const halfEndPos = endPositionLength / 2;
  36209. for (i2 = halfEndPos + 1; i2 < endPositionLength + 1; i2++) {
  36210. a4 = Math_default.PI_OVER_TWO + theta * i2;
  36211. st[stIndex++] = rightSt * (1 + Math.cos(a4));
  36212. st[stIndex++] = 0.5 * (1 + Math.sin(a4));
  36213. }
  36214. for (i2 = 1; i2 < rightCount - endPositionLength + 1; i2++) {
  36215. st[stIndex++] = i2 * rightSt;
  36216. st[stIndex++] = 0;
  36217. }
  36218. for (i2 = endPositionLength; i2 > halfEndPos; i2--) {
  36219. a4 = Math_default.PI_OVER_TWO - i2 * theta;
  36220. st[stIndex++] = 1 - rightSt * (1 + Math.cos(a4));
  36221. st[stIndex++] = 0.5 * (1 + Math.sin(a4));
  36222. }
  36223. for (i2 = halfEndPos; i2 > 0; i2--) {
  36224. a4 = Math_default.PI_OVER_TWO - theta * i2;
  36225. st[stIndex++] = 1 - leftSt * (1 + Math.cos(a4));
  36226. st[stIndex++] = 0.5 * (1 + Math.sin(a4));
  36227. }
  36228. for (i2 = leftCount - endPositionLength; i2 > 0; i2--) {
  36229. st[stIndex++] = i2 * leftSt;
  36230. st[stIndex++] = 1;
  36231. }
  36232. for (i2 = 1; i2 < halfEndPos + 1; i2++) {
  36233. a4 = Math_default.PI_OVER_TWO + theta * i2;
  36234. st[stIndex++] = leftSt * (1 + Math.cos(a4));
  36235. st[stIndex++] = 0.5 * (1 + Math.sin(a4));
  36236. }
  36237. } else {
  36238. leftCount /= 3;
  36239. rightCount /= 3;
  36240. leftSt = 1 / (leftCount - 1);
  36241. rightSt = 1 / (rightCount - 1);
  36242. for (i2 = 0; i2 < rightCount; i2++) {
  36243. st[stIndex++] = i2 * rightSt;
  36244. st[stIndex++] = 0;
  36245. }
  36246. for (i2 = leftCount; i2 > 0; i2--) {
  36247. st[stIndex++] = (i2 - 1) * leftSt;
  36248. st[stIndex++] = 1;
  36249. }
  36250. }
  36251. attributes.st = new GeometryAttribute_default({
  36252. componentDatatype: ComponentDatatype_default.FLOAT,
  36253. componentsPerAttribute: 2,
  36254. values: st
  36255. });
  36256. }
  36257. if (vertexFormat.normal) {
  36258. attributes.normal = new GeometryAttribute_default({
  36259. componentDatatype: ComponentDatatype_default.FLOAT,
  36260. componentsPerAttribute: 3,
  36261. values: attr.normals
  36262. });
  36263. }
  36264. if (vertexFormat.tangent) {
  36265. attributes.tangent = new GeometryAttribute_default({
  36266. componentDatatype: ComponentDatatype_default.FLOAT,
  36267. componentsPerAttribute: 3,
  36268. values: attr.tangents
  36269. });
  36270. }
  36271. if (vertexFormat.bitangent) {
  36272. attributes.bitangent = new GeometryAttribute_default({
  36273. componentDatatype: ComponentDatatype_default.FLOAT,
  36274. componentsPerAttribute: 3,
  36275. values: attr.bitangents
  36276. });
  36277. }
  36278. return {
  36279. attributes,
  36280. indices: indices2
  36281. };
  36282. }
  36283. function extrudedAttributes(attributes, vertexFormat) {
  36284. if (!vertexFormat.normal && !vertexFormat.tangent && !vertexFormat.bitangent && !vertexFormat.st) {
  36285. return attributes;
  36286. }
  36287. const positions = attributes.position.values;
  36288. let topNormals;
  36289. let topBitangents;
  36290. if (vertexFormat.normal || vertexFormat.bitangent) {
  36291. topNormals = attributes.normal.values;
  36292. topBitangents = attributes.bitangent.values;
  36293. }
  36294. const size = attributes.position.values.length / 18;
  36295. const threeSize = size * 3;
  36296. const twoSize = size * 2;
  36297. const sixSize = threeSize * 2;
  36298. let i2;
  36299. if (vertexFormat.normal || vertexFormat.bitangent || vertexFormat.tangent) {
  36300. const normals = vertexFormat.normal ? new Float32Array(threeSize * 6) : void 0;
  36301. const tangents = vertexFormat.tangent ? new Float32Array(threeSize * 6) : void 0;
  36302. const bitangents = vertexFormat.bitangent ? new Float32Array(threeSize * 6) : void 0;
  36303. let topPosition = cartesian12;
  36304. let bottomPosition = cartesian22;
  36305. let previousPosition = cartesian32;
  36306. let normal2 = cartesian42;
  36307. let tangent = cartesian52;
  36308. let bitangent = cartesian62;
  36309. let attrIndex = sixSize;
  36310. for (i2 = 0; i2 < threeSize; i2 += 3) {
  36311. const attrIndexOffset = attrIndex + sixSize;
  36312. topPosition = Cartesian3_default.fromArray(positions, i2, topPosition);
  36313. bottomPosition = Cartesian3_default.fromArray(
  36314. positions,
  36315. i2 + threeSize,
  36316. bottomPosition
  36317. );
  36318. previousPosition = Cartesian3_default.fromArray(
  36319. positions,
  36320. (i2 + 3) % threeSize,
  36321. previousPosition
  36322. );
  36323. bottomPosition = Cartesian3_default.subtract(
  36324. bottomPosition,
  36325. topPosition,
  36326. bottomPosition
  36327. );
  36328. previousPosition = Cartesian3_default.subtract(
  36329. previousPosition,
  36330. topPosition,
  36331. previousPosition
  36332. );
  36333. normal2 = Cartesian3_default.normalize(
  36334. Cartesian3_default.cross(bottomPosition, previousPosition, normal2),
  36335. normal2
  36336. );
  36337. if (vertexFormat.normal) {
  36338. CorridorGeometryLibrary_default.addAttribute(normals, normal2, attrIndexOffset);
  36339. CorridorGeometryLibrary_default.addAttribute(
  36340. normals,
  36341. normal2,
  36342. attrIndexOffset + 3
  36343. );
  36344. CorridorGeometryLibrary_default.addAttribute(normals, normal2, attrIndex);
  36345. CorridorGeometryLibrary_default.addAttribute(normals, normal2, attrIndex + 3);
  36346. }
  36347. if (vertexFormat.tangent || vertexFormat.bitangent) {
  36348. bitangent = Cartesian3_default.fromArray(topNormals, i2, bitangent);
  36349. if (vertexFormat.bitangent) {
  36350. CorridorGeometryLibrary_default.addAttribute(
  36351. bitangents,
  36352. bitangent,
  36353. attrIndexOffset
  36354. );
  36355. CorridorGeometryLibrary_default.addAttribute(
  36356. bitangents,
  36357. bitangent,
  36358. attrIndexOffset + 3
  36359. );
  36360. CorridorGeometryLibrary_default.addAttribute(
  36361. bitangents,
  36362. bitangent,
  36363. attrIndex
  36364. );
  36365. CorridorGeometryLibrary_default.addAttribute(
  36366. bitangents,
  36367. bitangent,
  36368. attrIndex + 3
  36369. );
  36370. }
  36371. if (vertexFormat.tangent) {
  36372. tangent = Cartesian3_default.normalize(
  36373. Cartesian3_default.cross(bitangent, normal2, tangent),
  36374. tangent
  36375. );
  36376. CorridorGeometryLibrary_default.addAttribute(
  36377. tangents,
  36378. tangent,
  36379. attrIndexOffset
  36380. );
  36381. CorridorGeometryLibrary_default.addAttribute(
  36382. tangents,
  36383. tangent,
  36384. attrIndexOffset + 3
  36385. );
  36386. CorridorGeometryLibrary_default.addAttribute(tangents, tangent, attrIndex);
  36387. CorridorGeometryLibrary_default.addAttribute(
  36388. tangents,
  36389. tangent,
  36390. attrIndex + 3
  36391. );
  36392. }
  36393. }
  36394. attrIndex += 6;
  36395. }
  36396. if (vertexFormat.normal) {
  36397. normals.set(topNormals);
  36398. for (i2 = 0; i2 < threeSize; i2 += 3) {
  36399. normals[i2 + threeSize] = -topNormals[i2];
  36400. normals[i2 + threeSize + 1] = -topNormals[i2 + 1];
  36401. normals[i2 + threeSize + 2] = -topNormals[i2 + 2];
  36402. }
  36403. attributes.normal.values = normals;
  36404. } else {
  36405. attributes.normal = void 0;
  36406. }
  36407. if (vertexFormat.bitangent) {
  36408. bitangents.set(topBitangents);
  36409. bitangents.set(topBitangents, threeSize);
  36410. attributes.bitangent.values = bitangents;
  36411. } else {
  36412. attributes.bitangent = void 0;
  36413. }
  36414. if (vertexFormat.tangent) {
  36415. const topTangents = attributes.tangent.values;
  36416. tangents.set(topTangents);
  36417. tangents.set(topTangents, threeSize);
  36418. attributes.tangent.values = tangents;
  36419. }
  36420. }
  36421. if (vertexFormat.st) {
  36422. const topSt = attributes.st.values;
  36423. const st = new Float32Array(twoSize * 6);
  36424. st.set(topSt);
  36425. st.set(topSt, twoSize);
  36426. let index2 = twoSize * 2;
  36427. for (let j = 0; j < 2; j++) {
  36428. st[index2++] = topSt[0];
  36429. st[index2++] = topSt[1];
  36430. for (i2 = 2; i2 < twoSize; i2 += 2) {
  36431. const s2 = topSt[i2];
  36432. const t = topSt[i2 + 1];
  36433. st[index2++] = s2;
  36434. st[index2++] = t;
  36435. st[index2++] = s2;
  36436. st[index2++] = t;
  36437. }
  36438. st[index2++] = topSt[0];
  36439. st[index2++] = topSt[1];
  36440. }
  36441. attributes.st.values = st;
  36442. }
  36443. return attributes;
  36444. }
  36445. function addWallPositions(positions, index2, wallPositions) {
  36446. wallPositions[index2++] = positions[0];
  36447. wallPositions[index2++] = positions[1];
  36448. wallPositions[index2++] = positions[2];
  36449. for (let i2 = 3; i2 < positions.length; i2 += 3) {
  36450. const x = positions[i2];
  36451. const y = positions[i2 + 1];
  36452. const z = positions[i2 + 2];
  36453. wallPositions[index2++] = x;
  36454. wallPositions[index2++] = y;
  36455. wallPositions[index2++] = z;
  36456. wallPositions[index2++] = x;
  36457. wallPositions[index2++] = y;
  36458. wallPositions[index2++] = z;
  36459. }
  36460. wallPositions[index2++] = positions[0];
  36461. wallPositions[index2++] = positions[1];
  36462. wallPositions[index2++] = positions[2];
  36463. return wallPositions;
  36464. }
  36465. function computePositionsExtruded(params, vertexFormat) {
  36466. const topVertexFormat = new VertexFormat_default({
  36467. position: vertexFormat.position,
  36468. normal: vertexFormat.normal || vertexFormat.bitangent || params.shadowVolume,
  36469. tangent: vertexFormat.tangent,
  36470. bitangent: vertexFormat.normal || vertexFormat.bitangent,
  36471. st: vertexFormat.st
  36472. });
  36473. const ellipsoid = params.ellipsoid;
  36474. const computedPositions = CorridorGeometryLibrary_default.computePositions(params);
  36475. const attr = combine2(computedPositions, topVertexFormat, ellipsoid);
  36476. const height = params.height;
  36477. const extrudedHeight = params.extrudedHeight;
  36478. let attributes = attr.attributes;
  36479. const indices2 = attr.indices;
  36480. let positions = attributes.position.values;
  36481. let length3 = positions.length;
  36482. const newPositions = new Float64Array(length3 * 6);
  36483. let extrudedPositions = new Float64Array(length3);
  36484. extrudedPositions.set(positions);
  36485. let wallPositions = new Float64Array(length3 * 4);
  36486. positions = PolygonPipeline_default.scaleToGeodeticHeight(
  36487. positions,
  36488. height,
  36489. ellipsoid
  36490. );
  36491. wallPositions = addWallPositions(positions, 0, wallPositions);
  36492. extrudedPositions = PolygonPipeline_default.scaleToGeodeticHeight(
  36493. extrudedPositions,
  36494. extrudedHeight,
  36495. ellipsoid
  36496. );
  36497. wallPositions = addWallPositions(
  36498. extrudedPositions,
  36499. length3 * 2,
  36500. wallPositions
  36501. );
  36502. newPositions.set(positions);
  36503. newPositions.set(extrudedPositions, length3);
  36504. newPositions.set(wallPositions, length3 * 2);
  36505. attributes.position.values = newPositions;
  36506. attributes = extrudedAttributes(attributes, vertexFormat);
  36507. let i2;
  36508. const size = length3 / 3;
  36509. if (params.shadowVolume) {
  36510. const topNormals = attributes.normal.values;
  36511. length3 = topNormals.length;
  36512. let extrudeNormals = new Float32Array(length3 * 6);
  36513. for (i2 = 0; i2 < length3; i2++) {
  36514. topNormals[i2] = -topNormals[i2];
  36515. }
  36516. extrudeNormals.set(topNormals, length3);
  36517. extrudeNormals = addWallPositions(topNormals, length3 * 4, extrudeNormals);
  36518. attributes.extrudeDirection = new GeometryAttribute_default({
  36519. componentDatatype: ComponentDatatype_default.FLOAT,
  36520. componentsPerAttribute: 3,
  36521. values: extrudeNormals
  36522. });
  36523. if (!vertexFormat.normal) {
  36524. attributes.normal = void 0;
  36525. }
  36526. }
  36527. if (defined_default(params.offsetAttribute)) {
  36528. let applyOffset = new Uint8Array(size * 6);
  36529. if (params.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
  36530. applyOffset = arrayFill_default(applyOffset, 1, 0, size);
  36531. applyOffset = arrayFill_default(applyOffset, 1, size * 2, size * 4);
  36532. } else {
  36533. const applyOffsetValue = params.offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  36534. applyOffset = arrayFill_default(applyOffset, applyOffsetValue);
  36535. }
  36536. attributes.applyOffset = new GeometryAttribute_default({
  36537. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  36538. componentsPerAttribute: 1,
  36539. values: applyOffset
  36540. });
  36541. }
  36542. const iLength = indices2.length;
  36543. const twoSize = size + size;
  36544. const newIndices = IndexDatatype_default.createTypedArray(
  36545. newPositions.length / 3,
  36546. iLength * 2 + twoSize * 3
  36547. );
  36548. newIndices.set(indices2);
  36549. let index2 = iLength;
  36550. for (i2 = 0; i2 < iLength; i2 += 3) {
  36551. const v02 = indices2[i2];
  36552. const v13 = indices2[i2 + 1];
  36553. const v23 = indices2[i2 + 2];
  36554. newIndices[index2++] = v23 + size;
  36555. newIndices[index2++] = v13 + size;
  36556. newIndices[index2++] = v02 + size;
  36557. }
  36558. let UL, LL, UR, LR;
  36559. for (i2 = 0; i2 < twoSize; i2 += 2) {
  36560. UL = i2 + twoSize;
  36561. LL = UL + twoSize;
  36562. UR = UL + 1;
  36563. LR = LL + 1;
  36564. newIndices[index2++] = UL;
  36565. newIndices[index2++] = LL;
  36566. newIndices[index2++] = UR;
  36567. newIndices[index2++] = UR;
  36568. newIndices[index2++] = LL;
  36569. newIndices[index2++] = LR;
  36570. }
  36571. return {
  36572. attributes,
  36573. indices: newIndices
  36574. };
  36575. }
  36576. var scratchCartesian17 = new Cartesian3_default();
  36577. var scratchCartesian28 = new Cartesian3_default();
  36578. var scratchCartographic4 = new Cartographic_default();
  36579. function computeOffsetPoints(position1, position2, ellipsoid, halfWidth, min3, max3) {
  36580. const direction2 = Cartesian3_default.subtract(
  36581. position2,
  36582. position1,
  36583. scratchCartesian17
  36584. );
  36585. Cartesian3_default.normalize(direction2, direction2);
  36586. const normal2 = ellipsoid.geodeticSurfaceNormal(position1, scratchCartesian28);
  36587. const offsetDirection = Cartesian3_default.cross(
  36588. direction2,
  36589. normal2,
  36590. scratchCartesian17
  36591. );
  36592. Cartesian3_default.multiplyByScalar(offsetDirection, halfWidth, offsetDirection);
  36593. let minLat = min3.latitude;
  36594. let minLon = min3.longitude;
  36595. let maxLat = max3.latitude;
  36596. let maxLon = max3.longitude;
  36597. Cartesian3_default.add(position1, offsetDirection, scratchCartesian28);
  36598. ellipsoid.cartesianToCartographic(scratchCartesian28, scratchCartographic4);
  36599. let lat = scratchCartographic4.latitude;
  36600. let lon = scratchCartographic4.longitude;
  36601. minLat = Math.min(minLat, lat);
  36602. minLon = Math.min(minLon, lon);
  36603. maxLat = Math.max(maxLat, lat);
  36604. maxLon = Math.max(maxLon, lon);
  36605. Cartesian3_default.subtract(position1, offsetDirection, scratchCartesian28);
  36606. ellipsoid.cartesianToCartographic(scratchCartesian28, scratchCartographic4);
  36607. lat = scratchCartographic4.latitude;
  36608. lon = scratchCartographic4.longitude;
  36609. minLat = Math.min(minLat, lat);
  36610. minLon = Math.min(minLon, lon);
  36611. maxLat = Math.max(maxLat, lat);
  36612. maxLon = Math.max(maxLon, lon);
  36613. min3.latitude = minLat;
  36614. min3.longitude = minLon;
  36615. max3.latitude = maxLat;
  36616. max3.longitude = maxLon;
  36617. }
  36618. var scratchCartesianOffset = new Cartesian3_default();
  36619. var scratchCartesianEnds = new Cartesian3_default();
  36620. var scratchCartographicMin = new Cartographic_default();
  36621. var scratchCartographicMax = new Cartographic_default();
  36622. function computeRectangle2(positions, ellipsoid, width, cornerType, result) {
  36623. positions = scaleToSurface2(positions, ellipsoid);
  36624. const cleanPositions = arrayRemoveDuplicates_default(
  36625. positions,
  36626. Cartesian3_default.equalsEpsilon
  36627. );
  36628. const length3 = cleanPositions.length;
  36629. if (length3 < 2 || width <= 0) {
  36630. return new Rectangle_default();
  36631. }
  36632. const halfWidth = width * 0.5;
  36633. scratchCartographicMin.latitude = Number.POSITIVE_INFINITY;
  36634. scratchCartographicMin.longitude = Number.POSITIVE_INFINITY;
  36635. scratchCartographicMax.latitude = Number.NEGATIVE_INFINITY;
  36636. scratchCartographicMax.longitude = Number.NEGATIVE_INFINITY;
  36637. let lat, lon;
  36638. if (cornerType === CornerType_default.ROUNDED) {
  36639. const first = cleanPositions[0];
  36640. Cartesian3_default.subtract(first, cleanPositions[1], scratchCartesianOffset);
  36641. Cartesian3_default.normalize(scratchCartesianOffset, scratchCartesianOffset);
  36642. Cartesian3_default.multiplyByScalar(
  36643. scratchCartesianOffset,
  36644. halfWidth,
  36645. scratchCartesianOffset
  36646. );
  36647. Cartesian3_default.add(first, scratchCartesianOffset, scratchCartesianEnds);
  36648. ellipsoid.cartesianToCartographic(
  36649. scratchCartesianEnds,
  36650. scratchCartographic4
  36651. );
  36652. lat = scratchCartographic4.latitude;
  36653. lon = scratchCartographic4.longitude;
  36654. scratchCartographicMin.latitude = Math.min(
  36655. scratchCartographicMin.latitude,
  36656. lat
  36657. );
  36658. scratchCartographicMin.longitude = Math.min(
  36659. scratchCartographicMin.longitude,
  36660. lon
  36661. );
  36662. scratchCartographicMax.latitude = Math.max(
  36663. scratchCartographicMax.latitude,
  36664. lat
  36665. );
  36666. scratchCartographicMax.longitude = Math.max(
  36667. scratchCartographicMax.longitude,
  36668. lon
  36669. );
  36670. }
  36671. for (let i2 = 0; i2 < length3 - 1; ++i2) {
  36672. computeOffsetPoints(
  36673. cleanPositions[i2],
  36674. cleanPositions[i2 + 1],
  36675. ellipsoid,
  36676. halfWidth,
  36677. scratchCartographicMin,
  36678. scratchCartographicMax
  36679. );
  36680. }
  36681. const last = cleanPositions[length3 - 1];
  36682. Cartesian3_default.subtract(last, cleanPositions[length3 - 2], scratchCartesianOffset);
  36683. Cartesian3_default.normalize(scratchCartesianOffset, scratchCartesianOffset);
  36684. Cartesian3_default.multiplyByScalar(
  36685. scratchCartesianOffset,
  36686. halfWidth,
  36687. scratchCartesianOffset
  36688. );
  36689. Cartesian3_default.add(last, scratchCartesianOffset, scratchCartesianEnds);
  36690. computeOffsetPoints(
  36691. last,
  36692. scratchCartesianEnds,
  36693. ellipsoid,
  36694. halfWidth,
  36695. scratchCartographicMin,
  36696. scratchCartographicMax
  36697. );
  36698. if (cornerType === CornerType_default.ROUNDED) {
  36699. ellipsoid.cartesianToCartographic(
  36700. scratchCartesianEnds,
  36701. scratchCartographic4
  36702. );
  36703. lat = scratchCartographic4.latitude;
  36704. lon = scratchCartographic4.longitude;
  36705. scratchCartographicMin.latitude = Math.min(
  36706. scratchCartographicMin.latitude,
  36707. lat
  36708. );
  36709. scratchCartographicMin.longitude = Math.min(
  36710. scratchCartographicMin.longitude,
  36711. lon
  36712. );
  36713. scratchCartographicMax.latitude = Math.max(
  36714. scratchCartographicMax.latitude,
  36715. lat
  36716. );
  36717. scratchCartographicMax.longitude = Math.max(
  36718. scratchCartographicMax.longitude,
  36719. lon
  36720. );
  36721. }
  36722. const rectangle = defined_default(result) ? result : new Rectangle_default();
  36723. rectangle.north = scratchCartographicMax.latitude;
  36724. rectangle.south = scratchCartographicMin.latitude;
  36725. rectangle.east = scratchCartographicMax.longitude;
  36726. rectangle.west = scratchCartographicMin.longitude;
  36727. return rectangle;
  36728. }
  36729. function CorridorGeometry(options) {
  36730. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  36731. const positions = options.positions;
  36732. const width = options.width;
  36733. Check_default.defined("options.positions", positions);
  36734. Check_default.defined("options.width", width);
  36735. const height = defaultValue_default(options.height, 0);
  36736. const extrudedHeight = defaultValue_default(options.extrudedHeight, height);
  36737. this._positions = positions;
  36738. this._ellipsoid = Ellipsoid_default.clone(
  36739. defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84)
  36740. );
  36741. this._vertexFormat = VertexFormat_default.clone(
  36742. defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT)
  36743. );
  36744. this._width = width;
  36745. this._height = Math.max(height, extrudedHeight);
  36746. this._extrudedHeight = Math.min(height, extrudedHeight);
  36747. this._cornerType = defaultValue_default(options.cornerType, CornerType_default.ROUNDED);
  36748. this._granularity = defaultValue_default(
  36749. options.granularity,
  36750. Math_default.RADIANS_PER_DEGREE
  36751. );
  36752. this._shadowVolume = defaultValue_default(options.shadowVolume, false);
  36753. this._workerName = "createCorridorGeometry";
  36754. this._offsetAttribute = options.offsetAttribute;
  36755. this._rectangle = void 0;
  36756. this.packedLength = 1 + positions.length * Cartesian3_default.packedLength + Ellipsoid_default.packedLength + VertexFormat_default.packedLength + 7;
  36757. }
  36758. CorridorGeometry.pack = function(value, array, startingIndex) {
  36759. Check_default.defined("value", value);
  36760. Check_default.defined("array", array);
  36761. startingIndex = defaultValue_default(startingIndex, 0);
  36762. const positions = value._positions;
  36763. const length3 = positions.length;
  36764. array[startingIndex++] = length3;
  36765. for (let i2 = 0; i2 < length3; ++i2, startingIndex += Cartesian3_default.packedLength) {
  36766. Cartesian3_default.pack(positions[i2], array, startingIndex);
  36767. }
  36768. Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
  36769. startingIndex += Ellipsoid_default.packedLength;
  36770. VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
  36771. startingIndex += VertexFormat_default.packedLength;
  36772. array[startingIndex++] = value._width;
  36773. array[startingIndex++] = value._height;
  36774. array[startingIndex++] = value._extrudedHeight;
  36775. array[startingIndex++] = value._cornerType;
  36776. array[startingIndex++] = value._granularity;
  36777. array[startingIndex++] = value._shadowVolume ? 1 : 0;
  36778. array[startingIndex] = defaultValue_default(value._offsetAttribute, -1);
  36779. return array;
  36780. };
  36781. var scratchEllipsoid4 = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
  36782. var scratchVertexFormat4 = new VertexFormat_default();
  36783. var scratchOptions9 = {
  36784. positions: void 0,
  36785. ellipsoid: scratchEllipsoid4,
  36786. vertexFormat: scratchVertexFormat4,
  36787. width: void 0,
  36788. height: void 0,
  36789. extrudedHeight: void 0,
  36790. cornerType: void 0,
  36791. granularity: void 0,
  36792. shadowVolume: void 0,
  36793. offsetAttribute: void 0
  36794. };
  36795. CorridorGeometry.unpack = function(array, startingIndex, result) {
  36796. Check_default.defined("array", array);
  36797. startingIndex = defaultValue_default(startingIndex, 0);
  36798. const length3 = array[startingIndex++];
  36799. const positions = new Array(length3);
  36800. for (let i2 = 0; i2 < length3; ++i2, startingIndex += Cartesian3_default.packedLength) {
  36801. positions[i2] = Cartesian3_default.unpack(array, startingIndex);
  36802. }
  36803. const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid4);
  36804. startingIndex += Ellipsoid_default.packedLength;
  36805. const vertexFormat = VertexFormat_default.unpack(
  36806. array,
  36807. startingIndex,
  36808. scratchVertexFormat4
  36809. );
  36810. startingIndex += VertexFormat_default.packedLength;
  36811. const width = array[startingIndex++];
  36812. const height = array[startingIndex++];
  36813. const extrudedHeight = array[startingIndex++];
  36814. const cornerType = array[startingIndex++];
  36815. const granularity = array[startingIndex++];
  36816. const shadowVolume = array[startingIndex++] === 1;
  36817. const offsetAttribute = array[startingIndex];
  36818. if (!defined_default(result)) {
  36819. scratchOptions9.positions = positions;
  36820. scratchOptions9.width = width;
  36821. scratchOptions9.height = height;
  36822. scratchOptions9.extrudedHeight = extrudedHeight;
  36823. scratchOptions9.cornerType = cornerType;
  36824. scratchOptions9.granularity = granularity;
  36825. scratchOptions9.shadowVolume = shadowVolume;
  36826. scratchOptions9.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  36827. return new CorridorGeometry(scratchOptions9);
  36828. }
  36829. result._positions = positions;
  36830. result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
  36831. result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
  36832. result._width = width;
  36833. result._height = height;
  36834. result._extrudedHeight = extrudedHeight;
  36835. result._cornerType = cornerType;
  36836. result._granularity = granularity;
  36837. result._shadowVolume = shadowVolume;
  36838. result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  36839. return result;
  36840. };
  36841. CorridorGeometry.computeRectangle = function(options, result) {
  36842. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  36843. const positions = options.positions;
  36844. const width = options.width;
  36845. Check_default.defined("options.positions", positions);
  36846. Check_default.defined("options.width", width);
  36847. const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  36848. const cornerType = defaultValue_default(options.cornerType, CornerType_default.ROUNDED);
  36849. return computeRectangle2(positions, ellipsoid, width, cornerType, result);
  36850. };
  36851. CorridorGeometry.createGeometry = function(corridorGeometry) {
  36852. let positions = corridorGeometry._positions;
  36853. const width = corridorGeometry._width;
  36854. const ellipsoid = corridorGeometry._ellipsoid;
  36855. positions = scaleToSurface2(positions, ellipsoid);
  36856. const cleanPositions = arrayRemoveDuplicates_default(
  36857. positions,
  36858. Cartesian3_default.equalsEpsilon
  36859. );
  36860. if (cleanPositions.length < 2 || width <= 0) {
  36861. return;
  36862. }
  36863. const height = corridorGeometry._height;
  36864. const extrudedHeight = corridorGeometry._extrudedHeight;
  36865. const extrude = !Math_default.equalsEpsilon(
  36866. height,
  36867. extrudedHeight,
  36868. 0,
  36869. Math_default.EPSILON2
  36870. );
  36871. const vertexFormat = corridorGeometry._vertexFormat;
  36872. const params = {
  36873. ellipsoid,
  36874. positions: cleanPositions,
  36875. width,
  36876. cornerType: corridorGeometry._cornerType,
  36877. granularity: corridorGeometry._granularity,
  36878. saveAttributes: true
  36879. };
  36880. let attr;
  36881. if (extrude) {
  36882. params.height = height;
  36883. params.extrudedHeight = extrudedHeight;
  36884. params.shadowVolume = corridorGeometry._shadowVolume;
  36885. params.offsetAttribute = corridorGeometry._offsetAttribute;
  36886. attr = computePositionsExtruded(params, vertexFormat);
  36887. } else {
  36888. const computedPositions = CorridorGeometryLibrary_default.computePositions(params);
  36889. attr = combine2(computedPositions, vertexFormat, ellipsoid);
  36890. attr.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
  36891. attr.attributes.position.values,
  36892. height,
  36893. ellipsoid
  36894. );
  36895. if (defined_default(corridorGeometry._offsetAttribute)) {
  36896. const applyOffsetValue = corridorGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  36897. const length3 = attr.attributes.position.values.length;
  36898. const applyOffset = new Uint8Array(length3 / 3);
  36899. arrayFill_default(applyOffset, applyOffsetValue);
  36900. attr.attributes.applyOffset = new GeometryAttribute_default({
  36901. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  36902. componentsPerAttribute: 1,
  36903. values: applyOffset
  36904. });
  36905. }
  36906. }
  36907. const attributes = attr.attributes;
  36908. const boundingSphere = BoundingSphere_default.fromVertices(
  36909. attributes.position.values,
  36910. void 0,
  36911. 3
  36912. );
  36913. if (!vertexFormat.position) {
  36914. attr.attributes.position.values = void 0;
  36915. }
  36916. return new Geometry_default({
  36917. attributes,
  36918. indices: attr.indices,
  36919. primitiveType: PrimitiveType_default.TRIANGLES,
  36920. boundingSphere,
  36921. offsetAttribute: corridorGeometry._offsetAttribute
  36922. });
  36923. };
  36924. CorridorGeometry.createShadowVolume = function(corridorGeometry, minHeightFunc, maxHeightFunc) {
  36925. const granularity = corridorGeometry._granularity;
  36926. const ellipsoid = corridorGeometry._ellipsoid;
  36927. const minHeight = minHeightFunc(granularity, ellipsoid);
  36928. const maxHeight = maxHeightFunc(granularity, ellipsoid);
  36929. return new CorridorGeometry({
  36930. positions: corridorGeometry._positions,
  36931. width: corridorGeometry._width,
  36932. cornerType: corridorGeometry._cornerType,
  36933. ellipsoid,
  36934. granularity,
  36935. extrudedHeight: minHeight,
  36936. height: maxHeight,
  36937. vertexFormat: VertexFormat_default.POSITION_ONLY,
  36938. shadowVolume: true
  36939. });
  36940. };
  36941. Object.defineProperties(CorridorGeometry.prototype, {
  36942. rectangle: {
  36943. get: function() {
  36944. if (!defined_default(this._rectangle)) {
  36945. this._rectangle = computeRectangle2(
  36946. this._positions,
  36947. this._ellipsoid,
  36948. this._width,
  36949. this._cornerType
  36950. );
  36951. }
  36952. return this._rectangle;
  36953. }
  36954. },
  36955. textureCoordinateRotationPoints: {
  36956. get: function() {
  36957. return [0, 0, 0, 1, 1, 0];
  36958. }
  36959. }
  36960. });
  36961. var CorridorGeometry_default = CorridorGeometry;
  36962. // node_modules/cesium/Source/Core/CorridorOutlineGeometry.js
  36963. var cartesian13 = new Cartesian3_default();
  36964. var cartesian23 = new Cartesian3_default();
  36965. var cartesian33 = new Cartesian3_default();
  36966. function scaleToSurface3(positions, ellipsoid) {
  36967. for (let i2 = 0; i2 < positions.length; i2++) {
  36968. positions[i2] = ellipsoid.scaleToGeodeticSurface(positions[i2], positions[i2]);
  36969. }
  36970. return positions;
  36971. }
  36972. function combine3(computedPositions, cornerType) {
  36973. const wallIndices = [];
  36974. const positions = computedPositions.positions;
  36975. const corners = computedPositions.corners;
  36976. const endPositions = computedPositions.endPositions;
  36977. const attributes = new GeometryAttributes_default();
  36978. let corner;
  36979. let leftCount = 0;
  36980. let rightCount = 0;
  36981. let i2;
  36982. let indicesLength = 0;
  36983. let length3;
  36984. for (i2 = 0; i2 < positions.length; i2 += 2) {
  36985. length3 = positions[i2].length - 3;
  36986. leftCount += length3;
  36987. indicesLength += length3 / 3 * 4;
  36988. rightCount += positions[i2 + 1].length - 3;
  36989. }
  36990. leftCount += 3;
  36991. rightCount += 3;
  36992. for (i2 = 0; i2 < corners.length; i2++) {
  36993. corner = corners[i2];
  36994. const leftSide = corners[i2].leftPositions;
  36995. if (defined_default(leftSide)) {
  36996. length3 = leftSide.length;
  36997. leftCount += length3;
  36998. indicesLength += length3 / 3 * 2;
  36999. } else {
  37000. length3 = corners[i2].rightPositions.length;
  37001. rightCount += length3;
  37002. indicesLength += length3 / 3 * 2;
  37003. }
  37004. }
  37005. const addEndPositions = defined_default(endPositions);
  37006. let endPositionLength;
  37007. if (addEndPositions) {
  37008. endPositionLength = endPositions[0].length - 3;
  37009. leftCount += endPositionLength;
  37010. rightCount += endPositionLength;
  37011. endPositionLength /= 3;
  37012. indicesLength += endPositionLength * 4;
  37013. }
  37014. const size = leftCount + rightCount;
  37015. const finalPositions = new Float64Array(size);
  37016. let front = 0;
  37017. let back = size - 1;
  37018. let UL, LL, UR, LR;
  37019. let rightPos, leftPos;
  37020. const halfLength = endPositionLength / 2;
  37021. const indices2 = IndexDatatype_default.createTypedArray(size / 3, indicesLength + 4);
  37022. let index2 = 0;
  37023. indices2[index2++] = front / 3;
  37024. indices2[index2++] = (back - 2) / 3;
  37025. if (addEndPositions) {
  37026. wallIndices.push(front / 3);
  37027. leftPos = cartesian13;
  37028. rightPos = cartesian23;
  37029. const firstEndPositions = endPositions[0];
  37030. for (i2 = 0; i2 < halfLength; i2++) {
  37031. leftPos = Cartesian3_default.fromArray(
  37032. firstEndPositions,
  37033. (halfLength - 1 - i2) * 3,
  37034. leftPos
  37035. );
  37036. rightPos = Cartesian3_default.fromArray(
  37037. firstEndPositions,
  37038. (halfLength + i2) * 3,
  37039. rightPos
  37040. );
  37041. CorridorGeometryLibrary_default.addAttribute(finalPositions, rightPos, front);
  37042. CorridorGeometryLibrary_default.addAttribute(
  37043. finalPositions,
  37044. leftPos,
  37045. void 0,
  37046. back
  37047. );
  37048. LL = front / 3;
  37049. LR = LL + 1;
  37050. UL = (back - 2) / 3;
  37051. UR = UL - 1;
  37052. indices2[index2++] = UL;
  37053. indices2[index2++] = UR;
  37054. indices2[index2++] = LL;
  37055. indices2[index2++] = LR;
  37056. front += 3;
  37057. back -= 3;
  37058. }
  37059. }
  37060. let posIndex = 0;
  37061. let rightEdge = positions[posIndex++];
  37062. let leftEdge = positions[posIndex++];
  37063. finalPositions.set(rightEdge, front);
  37064. finalPositions.set(leftEdge, back - leftEdge.length + 1);
  37065. length3 = leftEdge.length - 3;
  37066. wallIndices.push(front / 3, (back - 2) / 3);
  37067. for (i2 = 0; i2 < length3; i2 += 3) {
  37068. LL = front / 3;
  37069. LR = LL + 1;
  37070. UL = (back - 2) / 3;
  37071. UR = UL - 1;
  37072. indices2[index2++] = UL;
  37073. indices2[index2++] = UR;
  37074. indices2[index2++] = LL;
  37075. indices2[index2++] = LR;
  37076. front += 3;
  37077. back -= 3;
  37078. }
  37079. for (i2 = 0; i2 < corners.length; i2++) {
  37080. let j;
  37081. corner = corners[i2];
  37082. const l2 = corner.leftPositions;
  37083. const r2 = corner.rightPositions;
  37084. let start;
  37085. let outsidePoint = cartesian33;
  37086. if (defined_default(l2)) {
  37087. back -= 3;
  37088. start = UR;
  37089. wallIndices.push(LR);
  37090. for (j = 0; j < l2.length / 3; j++) {
  37091. outsidePoint = Cartesian3_default.fromArray(l2, j * 3, outsidePoint);
  37092. indices2[index2++] = start - j - 1;
  37093. indices2[index2++] = start - j;
  37094. CorridorGeometryLibrary_default.addAttribute(
  37095. finalPositions,
  37096. outsidePoint,
  37097. void 0,
  37098. back
  37099. );
  37100. back -= 3;
  37101. }
  37102. wallIndices.push(start - Math.floor(l2.length / 6));
  37103. if (cornerType === CornerType_default.BEVELED) {
  37104. wallIndices.push((back - 2) / 3 + 1);
  37105. }
  37106. front += 3;
  37107. } else {
  37108. front += 3;
  37109. start = LR;
  37110. wallIndices.push(UR);
  37111. for (j = 0; j < r2.length / 3; j++) {
  37112. outsidePoint = Cartesian3_default.fromArray(r2, j * 3, outsidePoint);
  37113. indices2[index2++] = start + j;
  37114. indices2[index2++] = start + j + 1;
  37115. CorridorGeometryLibrary_default.addAttribute(
  37116. finalPositions,
  37117. outsidePoint,
  37118. front
  37119. );
  37120. front += 3;
  37121. }
  37122. wallIndices.push(start + Math.floor(r2.length / 6));
  37123. if (cornerType === CornerType_default.BEVELED) {
  37124. wallIndices.push(front / 3 - 1);
  37125. }
  37126. back -= 3;
  37127. }
  37128. rightEdge = positions[posIndex++];
  37129. leftEdge = positions[posIndex++];
  37130. rightEdge.splice(0, 3);
  37131. leftEdge.splice(leftEdge.length - 3, 3);
  37132. finalPositions.set(rightEdge, front);
  37133. finalPositions.set(leftEdge, back - leftEdge.length + 1);
  37134. length3 = leftEdge.length - 3;
  37135. for (j = 0; j < leftEdge.length; j += 3) {
  37136. LR = front / 3;
  37137. LL = LR - 1;
  37138. UR = (back - 2) / 3;
  37139. UL = UR + 1;
  37140. indices2[index2++] = UL;
  37141. indices2[index2++] = UR;
  37142. indices2[index2++] = LL;
  37143. indices2[index2++] = LR;
  37144. front += 3;
  37145. back -= 3;
  37146. }
  37147. front -= 3;
  37148. back += 3;
  37149. wallIndices.push(front / 3, (back - 2) / 3);
  37150. }
  37151. if (addEndPositions) {
  37152. front += 3;
  37153. back -= 3;
  37154. leftPos = cartesian13;
  37155. rightPos = cartesian23;
  37156. const lastEndPositions = endPositions[1];
  37157. for (i2 = 0; i2 < halfLength; i2++) {
  37158. leftPos = Cartesian3_default.fromArray(
  37159. lastEndPositions,
  37160. (endPositionLength - i2 - 1) * 3,
  37161. leftPos
  37162. );
  37163. rightPos = Cartesian3_default.fromArray(lastEndPositions, i2 * 3, rightPos);
  37164. CorridorGeometryLibrary_default.addAttribute(
  37165. finalPositions,
  37166. leftPos,
  37167. void 0,
  37168. back
  37169. );
  37170. CorridorGeometryLibrary_default.addAttribute(finalPositions, rightPos, front);
  37171. LR = front / 3;
  37172. LL = LR - 1;
  37173. UR = (back - 2) / 3;
  37174. UL = UR + 1;
  37175. indices2[index2++] = UL;
  37176. indices2[index2++] = UR;
  37177. indices2[index2++] = LL;
  37178. indices2[index2++] = LR;
  37179. front += 3;
  37180. back -= 3;
  37181. }
  37182. wallIndices.push(front / 3);
  37183. } else {
  37184. wallIndices.push(front / 3, (back - 2) / 3);
  37185. }
  37186. indices2[index2++] = front / 3;
  37187. indices2[index2++] = (back - 2) / 3;
  37188. attributes.position = new GeometryAttribute_default({
  37189. componentDatatype: ComponentDatatype_default.DOUBLE,
  37190. componentsPerAttribute: 3,
  37191. values: finalPositions
  37192. });
  37193. return {
  37194. attributes,
  37195. indices: indices2,
  37196. wallIndices
  37197. };
  37198. }
  37199. function computePositionsExtruded2(params) {
  37200. const ellipsoid = params.ellipsoid;
  37201. const computedPositions = CorridorGeometryLibrary_default.computePositions(params);
  37202. const attr = combine3(computedPositions, params.cornerType);
  37203. const wallIndices = attr.wallIndices;
  37204. const height = params.height;
  37205. const extrudedHeight = params.extrudedHeight;
  37206. const attributes = attr.attributes;
  37207. const indices2 = attr.indices;
  37208. let positions = attributes.position.values;
  37209. let length3 = positions.length;
  37210. let extrudedPositions = new Float64Array(length3);
  37211. extrudedPositions.set(positions);
  37212. const newPositions = new Float64Array(length3 * 2);
  37213. positions = PolygonPipeline_default.scaleToGeodeticHeight(
  37214. positions,
  37215. height,
  37216. ellipsoid
  37217. );
  37218. extrudedPositions = PolygonPipeline_default.scaleToGeodeticHeight(
  37219. extrudedPositions,
  37220. extrudedHeight,
  37221. ellipsoid
  37222. );
  37223. newPositions.set(positions);
  37224. newPositions.set(extrudedPositions, length3);
  37225. attributes.position.values = newPositions;
  37226. length3 /= 3;
  37227. if (defined_default(params.offsetAttribute)) {
  37228. let applyOffset = new Uint8Array(length3 * 2);
  37229. if (params.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
  37230. applyOffset = arrayFill_default(applyOffset, 1, 0, length3);
  37231. } else {
  37232. const applyOffsetValue = params.offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  37233. applyOffset = arrayFill_default(applyOffset, applyOffsetValue);
  37234. }
  37235. attributes.applyOffset = new GeometryAttribute_default({
  37236. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  37237. componentsPerAttribute: 1,
  37238. values: applyOffset
  37239. });
  37240. }
  37241. let i2;
  37242. const iLength = indices2.length;
  37243. const newIndices = IndexDatatype_default.createTypedArray(
  37244. newPositions.length / 3,
  37245. (iLength + wallIndices.length) * 2
  37246. );
  37247. newIndices.set(indices2);
  37248. let index2 = iLength;
  37249. for (i2 = 0; i2 < iLength; i2 += 2) {
  37250. const v02 = indices2[i2];
  37251. const v13 = indices2[i2 + 1];
  37252. newIndices[index2++] = v02 + length3;
  37253. newIndices[index2++] = v13 + length3;
  37254. }
  37255. let UL, LL;
  37256. for (i2 = 0; i2 < wallIndices.length; i2++) {
  37257. UL = wallIndices[i2];
  37258. LL = UL + length3;
  37259. newIndices[index2++] = UL;
  37260. newIndices[index2++] = LL;
  37261. }
  37262. return {
  37263. attributes,
  37264. indices: newIndices
  37265. };
  37266. }
  37267. function CorridorOutlineGeometry(options) {
  37268. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  37269. const positions = options.positions;
  37270. const width = options.width;
  37271. Check_default.typeOf.object("options.positions", positions);
  37272. Check_default.typeOf.number("options.width", width);
  37273. const height = defaultValue_default(options.height, 0);
  37274. const extrudedHeight = defaultValue_default(options.extrudedHeight, height);
  37275. this._positions = positions;
  37276. this._ellipsoid = Ellipsoid_default.clone(
  37277. defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84)
  37278. );
  37279. this._width = width;
  37280. this._height = Math.max(height, extrudedHeight);
  37281. this._extrudedHeight = Math.min(height, extrudedHeight);
  37282. this._cornerType = defaultValue_default(options.cornerType, CornerType_default.ROUNDED);
  37283. this._granularity = defaultValue_default(
  37284. options.granularity,
  37285. Math_default.RADIANS_PER_DEGREE
  37286. );
  37287. this._offsetAttribute = options.offsetAttribute;
  37288. this._workerName = "createCorridorOutlineGeometry";
  37289. this.packedLength = 1 + positions.length * Cartesian3_default.packedLength + Ellipsoid_default.packedLength + 6;
  37290. }
  37291. CorridorOutlineGeometry.pack = function(value, array, startingIndex) {
  37292. Check_default.typeOf.object("value", value);
  37293. Check_default.typeOf.object("array", array);
  37294. startingIndex = defaultValue_default(startingIndex, 0);
  37295. const positions = value._positions;
  37296. const length3 = positions.length;
  37297. array[startingIndex++] = length3;
  37298. for (let i2 = 0; i2 < length3; ++i2, startingIndex += Cartesian3_default.packedLength) {
  37299. Cartesian3_default.pack(positions[i2], array, startingIndex);
  37300. }
  37301. Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
  37302. startingIndex += Ellipsoid_default.packedLength;
  37303. array[startingIndex++] = value._width;
  37304. array[startingIndex++] = value._height;
  37305. array[startingIndex++] = value._extrudedHeight;
  37306. array[startingIndex++] = value._cornerType;
  37307. array[startingIndex++] = value._granularity;
  37308. array[startingIndex] = defaultValue_default(value._offsetAttribute, -1);
  37309. return array;
  37310. };
  37311. var scratchEllipsoid5 = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
  37312. var scratchOptions10 = {
  37313. positions: void 0,
  37314. ellipsoid: scratchEllipsoid5,
  37315. width: void 0,
  37316. height: void 0,
  37317. extrudedHeight: void 0,
  37318. cornerType: void 0,
  37319. granularity: void 0,
  37320. offsetAttribute: void 0
  37321. };
  37322. CorridorOutlineGeometry.unpack = function(array, startingIndex, result) {
  37323. Check_default.typeOf.object("array", array);
  37324. startingIndex = defaultValue_default(startingIndex, 0);
  37325. const length3 = array[startingIndex++];
  37326. const positions = new Array(length3);
  37327. for (let i2 = 0; i2 < length3; ++i2, startingIndex += Cartesian3_default.packedLength) {
  37328. positions[i2] = Cartesian3_default.unpack(array, startingIndex);
  37329. }
  37330. const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid5);
  37331. startingIndex += Ellipsoid_default.packedLength;
  37332. const width = array[startingIndex++];
  37333. const height = array[startingIndex++];
  37334. const extrudedHeight = array[startingIndex++];
  37335. const cornerType = array[startingIndex++];
  37336. const granularity = array[startingIndex++];
  37337. const offsetAttribute = array[startingIndex];
  37338. if (!defined_default(result)) {
  37339. scratchOptions10.positions = positions;
  37340. scratchOptions10.width = width;
  37341. scratchOptions10.height = height;
  37342. scratchOptions10.extrudedHeight = extrudedHeight;
  37343. scratchOptions10.cornerType = cornerType;
  37344. scratchOptions10.granularity = granularity;
  37345. scratchOptions10.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  37346. return new CorridorOutlineGeometry(scratchOptions10);
  37347. }
  37348. result._positions = positions;
  37349. result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
  37350. result._width = width;
  37351. result._height = height;
  37352. result._extrudedHeight = extrudedHeight;
  37353. result._cornerType = cornerType;
  37354. result._granularity = granularity;
  37355. result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  37356. return result;
  37357. };
  37358. CorridorOutlineGeometry.createGeometry = function(corridorOutlineGeometry) {
  37359. let positions = corridorOutlineGeometry._positions;
  37360. const width = corridorOutlineGeometry._width;
  37361. const ellipsoid = corridorOutlineGeometry._ellipsoid;
  37362. positions = scaleToSurface3(positions, ellipsoid);
  37363. const cleanPositions = arrayRemoveDuplicates_default(
  37364. positions,
  37365. Cartesian3_default.equalsEpsilon
  37366. );
  37367. if (cleanPositions.length < 2 || width <= 0) {
  37368. return;
  37369. }
  37370. const height = corridorOutlineGeometry._height;
  37371. const extrudedHeight = corridorOutlineGeometry._extrudedHeight;
  37372. const extrude = !Math_default.equalsEpsilon(
  37373. height,
  37374. extrudedHeight,
  37375. 0,
  37376. Math_default.EPSILON2
  37377. );
  37378. const params = {
  37379. ellipsoid,
  37380. positions: cleanPositions,
  37381. width,
  37382. cornerType: corridorOutlineGeometry._cornerType,
  37383. granularity: corridorOutlineGeometry._granularity,
  37384. saveAttributes: false
  37385. };
  37386. let attr;
  37387. if (extrude) {
  37388. params.height = height;
  37389. params.extrudedHeight = extrudedHeight;
  37390. params.offsetAttribute = corridorOutlineGeometry._offsetAttribute;
  37391. attr = computePositionsExtruded2(params);
  37392. } else {
  37393. const computedPositions = CorridorGeometryLibrary_default.computePositions(params);
  37394. attr = combine3(computedPositions, params.cornerType);
  37395. attr.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
  37396. attr.attributes.position.values,
  37397. height,
  37398. ellipsoid
  37399. );
  37400. if (defined_default(corridorOutlineGeometry._offsetAttribute)) {
  37401. const length3 = attr.attributes.position.values.length;
  37402. const applyOffset = new Uint8Array(length3 / 3);
  37403. const offsetValue = corridorOutlineGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  37404. arrayFill_default(applyOffset, offsetValue);
  37405. attr.attributes.applyOffset = new GeometryAttribute_default({
  37406. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  37407. componentsPerAttribute: 1,
  37408. values: applyOffset
  37409. });
  37410. }
  37411. }
  37412. const attributes = attr.attributes;
  37413. const boundingSphere = BoundingSphere_default.fromVertices(
  37414. attributes.position.values,
  37415. void 0,
  37416. 3
  37417. );
  37418. return new Geometry_default({
  37419. attributes,
  37420. indices: attr.indices,
  37421. primitiveType: PrimitiveType_default.LINES,
  37422. boundingSphere,
  37423. offsetAttribute: corridorOutlineGeometry._offsetAttribute
  37424. });
  37425. };
  37426. var CorridorOutlineGeometry_default = CorridorOutlineGeometry;
  37427. // node_modules/cesium/Source/Core/CullingVolume.js
  37428. function CullingVolume(planes) {
  37429. this.planes = defaultValue_default(planes, []);
  37430. }
  37431. var faces = [new Cartesian3_default(), new Cartesian3_default(), new Cartesian3_default()];
  37432. Cartesian3_default.clone(Cartesian3_default.UNIT_X, faces[0]);
  37433. Cartesian3_default.clone(Cartesian3_default.UNIT_Y, faces[1]);
  37434. Cartesian3_default.clone(Cartesian3_default.UNIT_Z, faces[2]);
  37435. var scratchPlaneCenter = new Cartesian3_default();
  37436. var scratchPlaneNormal2 = new Cartesian3_default();
  37437. var scratchPlane2 = new Plane_default(new Cartesian3_default(1, 0, 0), 0);
  37438. CullingVolume.fromBoundingSphere = function(boundingSphere, result) {
  37439. if (!defined_default(boundingSphere)) {
  37440. throw new DeveloperError_default("boundingSphere is required.");
  37441. }
  37442. if (!defined_default(result)) {
  37443. result = new CullingVolume();
  37444. }
  37445. const length3 = faces.length;
  37446. const planes = result.planes;
  37447. planes.length = 2 * length3;
  37448. const center = boundingSphere.center;
  37449. const radius = boundingSphere.radius;
  37450. let planeIndex = 0;
  37451. for (let i2 = 0; i2 < length3; ++i2) {
  37452. const faceNormal = faces[i2];
  37453. let plane0 = planes[planeIndex];
  37454. let plane1 = planes[planeIndex + 1];
  37455. if (!defined_default(plane0)) {
  37456. plane0 = planes[planeIndex] = new Cartesian4_default();
  37457. }
  37458. if (!defined_default(plane1)) {
  37459. plane1 = planes[planeIndex + 1] = new Cartesian4_default();
  37460. }
  37461. Cartesian3_default.multiplyByScalar(faceNormal, -radius, scratchPlaneCenter);
  37462. Cartesian3_default.add(center, scratchPlaneCenter, scratchPlaneCenter);
  37463. plane0.x = faceNormal.x;
  37464. plane0.y = faceNormal.y;
  37465. plane0.z = faceNormal.z;
  37466. plane0.w = -Cartesian3_default.dot(faceNormal, scratchPlaneCenter);
  37467. Cartesian3_default.multiplyByScalar(faceNormal, radius, scratchPlaneCenter);
  37468. Cartesian3_default.add(center, scratchPlaneCenter, scratchPlaneCenter);
  37469. plane1.x = -faceNormal.x;
  37470. plane1.y = -faceNormal.y;
  37471. plane1.z = -faceNormal.z;
  37472. plane1.w = -Cartesian3_default.dot(
  37473. Cartesian3_default.negate(faceNormal, scratchPlaneNormal2),
  37474. scratchPlaneCenter
  37475. );
  37476. planeIndex += 2;
  37477. }
  37478. return result;
  37479. };
  37480. CullingVolume.prototype.computeVisibility = function(boundingVolume) {
  37481. if (!defined_default(boundingVolume)) {
  37482. throw new DeveloperError_default("boundingVolume is required.");
  37483. }
  37484. const planes = this.planes;
  37485. let intersecting = false;
  37486. for (let k = 0, len = planes.length; k < len; ++k) {
  37487. const result = boundingVolume.intersectPlane(
  37488. Plane_default.fromCartesian4(planes[k], scratchPlane2)
  37489. );
  37490. if (result === Intersect_default.OUTSIDE) {
  37491. return Intersect_default.OUTSIDE;
  37492. } else if (result === Intersect_default.INTERSECTING) {
  37493. intersecting = true;
  37494. }
  37495. }
  37496. return intersecting ? Intersect_default.INTERSECTING : Intersect_default.INSIDE;
  37497. };
  37498. CullingVolume.prototype.computeVisibilityWithPlaneMask = function(boundingVolume, parentPlaneMask) {
  37499. if (!defined_default(boundingVolume)) {
  37500. throw new DeveloperError_default("boundingVolume is required.");
  37501. }
  37502. if (!defined_default(parentPlaneMask)) {
  37503. throw new DeveloperError_default("parentPlaneMask is required.");
  37504. }
  37505. if (parentPlaneMask === CullingVolume.MASK_OUTSIDE || parentPlaneMask === CullingVolume.MASK_INSIDE) {
  37506. return parentPlaneMask;
  37507. }
  37508. let mask = CullingVolume.MASK_INSIDE;
  37509. const planes = this.planes;
  37510. for (let k = 0, len = planes.length; k < len; ++k) {
  37511. const flag = k < 31 ? 1 << k : 0;
  37512. if (k < 31 && (parentPlaneMask & flag) === 0) {
  37513. continue;
  37514. }
  37515. const result = boundingVolume.intersectPlane(
  37516. Plane_default.fromCartesian4(planes[k], scratchPlane2)
  37517. );
  37518. if (result === Intersect_default.OUTSIDE) {
  37519. return CullingVolume.MASK_OUTSIDE;
  37520. } else if (result === Intersect_default.INTERSECTING) {
  37521. mask |= flag;
  37522. }
  37523. }
  37524. return mask;
  37525. };
  37526. CullingVolume.MASK_OUTSIDE = 4294967295;
  37527. CullingVolume.MASK_INSIDE = 0;
  37528. CullingVolume.MASK_INDETERMINATE = 2147483647;
  37529. var CullingVolume_default = CullingVolume;
  37530. // node_modules/cesium/Source/Core/CustomHeightmapTerrainProvider.js
  37531. function CustomHeightmapTerrainProvider(options) {
  37532. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  37533. Check_default.defined("options.callback", options.callback);
  37534. Check_default.defined("options.width", options.width);
  37535. Check_default.defined("options.height", options.height);
  37536. this._callback = options.callback;
  37537. this._tilingScheme = options.tilingScheme;
  37538. if (!defined_default(this._tilingScheme)) {
  37539. this._tilingScheme = new GeographicTilingScheme_default({
  37540. ellipsoid: defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84)
  37541. });
  37542. }
  37543. this._width = options.width;
  37544. this._height = options.height;
  37545. const maxTileDimensions = Math.max(this._width, this._height);
  37546. this._levelZeroMaximumGeometricError = TerrainProvider_default.getEstimatedLevelZeroGeometricErrorForAHeightmap(
  37547. this._tilingScheme.ellipsoid,
  37548. maxTileDimensions,
  37549. this._tilingScheme.getNumberOfXTilesAtLevel(0)
  37550. );
  37551. this._errorEvent = new Event_default();
  37552. let credit = options.credit;
  37553. if (typeof credit === "string") {
  37554. credit = new Credit_default(credit);
  37555. }
  37556. this._credit = credit;
  37557. this._readyPromise = Promise.resolve(true);
  37558. }
  37559. Object.defineProperties(CustomHeightmapTerrainProvider.prototype, {
  37560. errorEvent: {
  37561. get: function() {
  37562. return this._errorEvent;
  37563. }
  37564. },
  37565. credit: {
  37566. get: function() {
  37567. return this._credit;
  37568. }
  37569. },
  37570. tilingScheme: {
  37571. get: function() {
  37572. return this._tilingScheme;
  37573. }
  37574. },
  37575. ready: {
  37576. get: function() {
  37577. return true;
  37578. }
  37579. },
  37580. readyPromise: {
  37581. get: function() {
  37582. return this._readyPromise;
  37583. }
  37584. },
  37585. hasWaterMask: {
  37586. get: function() {
  37587. return false;
  37588. }
  37589. },
  37590. hasVertexNormals: {
  37591. get: function() {
  37592. return false;
  37593. }
  37594. },
  37595. width: {
  37596. get: function() {
  37597. return this._width;
  37598. }
  37599. },
  37600. height: {
  37601. get: function() {
  37602. return this._height;
  37603. }
  37604. }
  37605. });
  37606. CustomHeightmapTerrainProvider.prototype.requestTileGeometry = function(x, y, level, request) {
  37607. const promise = this._callback(x, y, level);
  37608. if (!defined_default(promise)) {
  37609. return void 0;
  37610. }
  37611. const width = this._width;
  37612. const height = this._height;
  37613. return Promise.resolve(promise).then(function(heightmapData) {
  37614. let buffer = heightmapData;
  37615. if (Array.isArray(buffer)) {
  37616. buffer = new Float64Array(buffer);
  37617. }
  37618. return new HeightmapTerrainData_default({
  37619. buffer,
  37620. width,
  37621. height
  37622. });
  37623. });
  37624. };
  37625. CustomHeightmapTerrainProvider.prototype.getLevelMaximumGeometricError = function(level) {
  37626. return this._levelZeroMaximumGeometricError / (1 << level);
  37627. };
  37628. CustomHeightmapTerrainProvider.prototype.getTileDataAvailable = function(x, y, level) {
  37629. return void 0;
  37630. };
  37631. CustomHeightmapTerrainProvider.prototype.loadTileDataAvailability = function(x, y, level) {
  37632. return void 0;
  37633. };
  37634. var CustomHeightmapTerrainProvider_default = CustomHeightmapTerrainProvider;
  37635. // node_modules/cesium/Source/Core/CylinderGeometryLibrary.js
  37636. var CylinderGeometryLibrary = {};
  37637. CylinderGeometryLibrary.computePositions = function(length3, topRadius, bottomRadius, slices, fill) {
  37638. const topZ = length3 * 0.5;
  37639. const bottomZ = -topZ;
  37640. const twoSlice = slices + slices;
  37641. const size = fill ? 2 * twoSlice : twoSlice;
  37642. const positions = new Float64Array(size * 3);
  37643. let i2;
  37644. let index2 = 0;
  37645. let tbIndex = 0;
  37646. const bottomOffset = fill ? twoSlice * 3 : 0;
  37647. const topOffset = fill ? (twoSlice + slices) * 3 : slices * 3;
  37648. for (i2 = 0; i2 < slices; i2++) {
  37649. const angle = i2 / slices * Math_default.TWO_PI;
  37650. const x = Math.cos(angle);
  37651. const y = Math.sin(angle);
  37652. const bottomX = x * bottomRadius;
  37653. const bottomY = y * bottomRadius;
  37654. const topX = x * topRadius;
  37655. const topY = y * topRadius;
  37656. positions[tbIndex + bottomOffset] = bottomX;
  37657. positions[tbIndex + bottomOffset + 1] = bottomY;
  37658. positions[tbIndex + bottomOffset + 2] = bottomZ;
  37659. positions[tbIndex + topOffset] = topX;
  37660. positions[tbIndex + topOffset + 1] = topY;
  37661. positions[tbIndex + topOffset + 2] = topZ;
  37662. tbIndex += 3;
  37663. if (fill) {
  37664. positions[index2++] = bottomX;
  37665. positions[index2++] = bottomY;
  37666. positions[index2++] = bottomZ;
  37667. positions[index2++] = topX;
  37668. positions[index2++] = topY;
  37669. positions[index2++] = topZ;
  37670. }
  37671. }
  37672. return positions;
  37673. };
  37674. var CylinderGeometryLibrary_default = CylinderGeometryLibrary;
  37675. // node_modules/cesium/Source/Core/CylinderGeometry.js
  37676. var radiusScratch = new Cartesian2_default();
  37677. var normalScratch3 = new Cartesian3_default();
  37678. var bitangentScratch = new Cartesian3_default();
  37679. var tangentScratch = new Cartesian3_default();
  37680. var positionScratch2 = new Cartesian3_default();
  37681. function CylinderGeometry(options) {
  37682. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  37683. const length3 = options.length;
  37684. const topRadius = options.topRadius;
  37685. const bottomRadius = options.bottomRadius;
  37686. const vertexFormat = defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT);
  37687. const slices = defaultValue_default(options.slices, 128);
  37688. if (!defined_default(length3)) {
  37689. throw new DeveloperError_default("options.length must be defined.");
  37690. }
  37691. if (!defined_default(topRadius)) {
  37692. throw new DeveloperError_default("options.topRadius must be defined.");
  37693. }
  37694. if (!defined_default(bottomRadius)) {
  37695. throw new DeveloperError_default("options.bottomRadius must be defined.");
  37696. }
  37697. if (slices < 3) {
  37698. throw new DeveloperError_default(
  37699. "options.slices must be greater than or equal to 3."
  37700. );
  37701. }
  37702. if (defined_default(options.offsetAttribute) && options.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
  37703. throw new DeveloperError_default(
  37704. "GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry."
  37705. );
  37706. }
  37707. this._length = length3;
  37708. this._topRadius = topRadius;
  37709. this._bottomRadius = bottomRadius;
  37710. this._vertexFormat = VertexFormat_default.clone(vertexFormat);
  37711. this._slices = slices;
  37712. this._offsetAttribute = options.offsetAttribute;
  37713. this._workerName = "createCylinderGeometry";
  37714. }
  37715. CylinderGeometry.packedLength = VertexFormat_default.packedLength + 5;
  37716. CylinderGeometry.pack = function(value, array, startingIndex) {
  37717. if (!defined_default(value)) {
  37718. throw new DeveloperError_default("value is required");
  37719. }
  37720. if (!defined_default(array)) {
  37721. throw new DeveloperError_default("array is required");
  37722. }
  37723. startingIndex = defaultValue_default(startingIndex, 0);
  37724. VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
  37725. startingIndex += VertexFormat_default.packedLength;
  37726. array[startingIndex++] = value._length;
  37727. array[startingIndex++] = value._topRadius;
  37728. array[startingIndex++] = value._bottomRadius;
  37729. array[startingIndex++] = value._slices;
  37730. array[startingIndex] = defaultValue_default(value._offsetAttribute, -1);
  37731. return array;
  37732. };
  37733. var scratchVertexFormat5 = new VertexFormat_default();
  37734. var scratchOptions11 = {
  37735. vertexFormat: scratchVertexFormat5,
  37736. length: void 0,
  37737. topRadius: void 0,
  37738. bottomRadius: void 0,
  37739. slices: void 0,
  37740. offsetAttribute: void 0
  37741. };
  37742. CylinderGeometry.unpack = function(array, startingIndex, result) {
  37743. if (!defined_default(array)) {
  37744. throw new DeveloperError_default("array is required");
  37745. }
  37746. startingIndex = defaultValue_default(startingIndex, 0);
  37747. const vertexFormat = VertexFormat_default.unpack(
  37748. array,
  37749. startingIndex,
  37750. scratchVertexFormat5
  37751. );
  37752. startingIndex += VertexFormat_default.packedLength;
  37753. const length3 = array[startingIndex++];
  37754. const topRadius = array[startingIndex++];
  37755. const bottomRadius = array[startingIndex++];
  37756. const slices = array[startingIndex++];
  37757. const offsetAttribute = array[startingIndex];
  37758. if (!defined_default(result)) {
  37759. scratchOptions11.length = length3;
  37760. scratchOptions11.topRadius = topRadius;
  37761. scratchOptions11.bottomRadius = bottomRadius;
  37762. scratchOptions11.slices = slices;
  37763. scratchOptions11.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  37764. return new CylinderGeometry(scratchOptions11);
  37765. }
  37766. result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
  37767. result._length = length3;
  37768. result._topRadius = topRadius;
  37769. result._bottomRadius = bottomRadius;
  37770. result._slices = slices;
  37771. result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  37772. return result;
  37773. };
  37774. CylinderGeometry.createGeometry = function(cylinderGeometry) {
  37775. let length3 = cylinderGeometry._length;
  37776. const topRadius = cylinderGeometry._topRadius;
  37777. const bottomRadius = cylinderGeometry._bottomRadius;
  37778. const vertexFormat = cylinderGeometry._vertexFormat;
  37779. const slices = cylinderGeometry._slices;
  37780. if (length3 <= 0 || topRadius < 0 || bottomRadius < 0 || topRadius === 0 && bottomRadius === 0) {
  37781. return;
  37782. }
  37783. const twoSlices = slices + slices;
  37784. const threeSlices = slices + twoSlices;
  37785. const numVertices = twoSlices + twoSlices;
  37786. const positions = CylinderGeometryLibrary_default.computePositions(
  37787. length3,
  37788. topRadius,
  37789. bottomRadius,
  37790. slices,
  37791. true
  37792. );
  37793. const st = vertexFormat.st ? new Float32Array(numVertices * 2) : void 0;
  37794. const normals = vertexFormat.normal ? new Float32Array(numVertices * 3) : void 0;
  37795. const tangents = vertexFormat.tangent ? new Float32Array(numVertices * 3) : void 0;
  37796. const bitangents = vertexFormat.bitangent ? new Float32Array(numVertices * 3) : void 0;
  37797. let i2;
  37798. const computeNormal = vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent;
  37799. if (computeNormal) {
  37800. const computeTangent = vertexFormat.tangent || vertexFormat.bitangent;
  37801. let normalIndex = 0;
  37802. let tangentIndex = 0;
  37803. let bitangentIndex = 0;
  37804. const theta = Math.atan2(bottomRadius - topRadius, length3);
  37805. const normal2 = normalScratch3;
  37806. normal2.z = Math.sin(theta);
  37807. const normalScale2 = Math.cos(theta);
  37808. let tangent = tangentScratch;
  37809. let bitangent = bitangentScratch;
  37810. for (i2 = 0; i2 < slices; i2++) {
  37811. const angle = i2 / slices * Math_default.TWO_PI;
  37812. const x = normalScale2 * Math.cos(angle);
  37813. const y = normalScale2 * Math.sin(angle);
  37814. if (computeNormal) {
  37815. normal2.x = x;
  37816. normal2.y = y;
  37817. if (computeTangent) {
  37818. tangent = Cartesian3_default.normalize(
  37819. Cartesian3_default.cross(Cartesian3_default.UNIT_Z, normal2, tangent),
  37820. tangent
  37821. );
  37822. }
  37823. if (vertexFormat.normal) {
  37824. normals[normalIndex++] = normal2.x;
  37825. normals[normalIndex++] = normal2.y;
  37826. normals[normalIndex++] = normal2.z;
  37827. normals[normalIndex++] = normal2.x;
  37828. normals[normalIndex++] = normal2.y;
  37829. normals[normalIndex++] = normal2.z;
  37830. }
  37831. if (vertexFormat.tangent) {
  37832. tangents[tangentIndex++] = tangent.x;
  37833. tangents[tangentIndex++] = tangent.y;
  37834. tangents[tangentIndex++] = tangent.z;
  37835. tangents[tangentIndex++] = tangent.x;
  37836. tangents[tangentIndex++] = tangent.y;
  37837. tangents[tangentIndex++] = tangent.z;
  37838. }
  37839. if (vertexFormat.bitangent) {
  37840. bitangent = Cartesian3_default.normalize(
  37841. Cartesian3_default.cross(normal2, tangent, bitangent),
  37842. bitangent
  37843. );
  37844. bitangents[bitangentIndex++] = bitangent.x;
  37845. bitangents[bitangentIndex++] = bitangent.y;
  37846. bitangents[bitangentIndex++] = bitangent.z;
  37847. bitangents[bitangentIndex++] = bitangent.x;
  37848. bitangents[bitangentIndex++] = bitangent.y;
  37849. bitangents[bitangentIndex++] = bitangent.z;
  37850. }
  37851. }
  37852. }
  37853. for (i2 = 0; i2 < slices; i2++) {
  37854. if (vertexFormat.normal) {
  37855. normals[normalIndex++] = 0;
  37856. normals[normalIndex++] = 0;
  37857. normals[normalIndex++] = -1;
  37858. }
  37859. if (vertexFormat.tangent) {
  37860. tangents[tangentIndex++] = 1;
  37861. tangents[tangentIndex++] = 0;
  37862. tangents[tangentIndex++] = 0;
  37863. }
  37864. if (vertexFormat.bitangent) {
  37865. bitangents[bitangentIndex++] = 0;
  37866. bitangents[bitangentIndex++] = -1;
  37867. bitangents[bitangentIndex++] = 0;
  37868. }
  37869. }
  37870. for (i2 = 0; i2 < slices; i2++) {
  37871. if (vertexFormat.normal) {
  37872. normals[normalIndex++] = 0;
  37873. normals[normalIndex++] = 0;
  37874. normals[normalIndex++] = 1;
  37875. }
  37876. if (vertexFormat.tangent) {
  37877. tangents[tangentIndex++] = 1;
  37878. tangents[tangentIndex++] = 0;
  37879. tangents[tangentIndex++] = 0;
  37880. }
  37881. if (vertexFormat.bitangent) {
  37882. bitangents[bitangentIndex++] = 0;
  37883. bitangents[bitangentIndex++] = 1;
  37884. bitangents[bitangentIndex++] = 0;
  37885. }
  37886. }
  37887. }
  37888. const numIndices = 12 * slices - 12;
  37889. const indices2 = IndexDatatype_default.createTypedArray(numVertices, numIndices);
  37890. let index2 = 0;
  37891. let j = 0;
  37892. for (i2 = 0; i2 < slices - 1; i2++) {
  37893. indices2[index2++] = j;
  37894. indices2[index2++] = j + 2;
  37895. indices2[index2++] = j + 3;
  37896. indices2[index2++] = j;
  37897. indices2[index2++] = j + 3;
  37898. indices2[index2++] = j + 1;
  37899. j += 2;
  37900. }
  37901. indices2[index2++] = twoSlices - 2;
  37902. indices2[index2++] = 0;
  37903. indices2[index2++] = 1;
  37904. indices2[index2++] = twoSlices - 2;
  37905. indices2[index2++] = 1;
  37906. indices2[index2++] = twoSlices - 1;
  37907. for (i2 = 1; i2 < slices - 1; i2++) {
  37908. indices2[index2++] = twoSlices + i2 + 1;
  37909. indices2[index2++] = twoSlices + i2;
  37910. indices2[index2++] = twoSlices;
  37911. }
  37912. for (i2 = 1; i2 < slices - 1; i2++) {
  37913. indices2[index2++] = threeSlices;
  37914. indices2[index2++] = threeSlices + i2;
  37915. indices2[index2++] = threeSlices + i2 + 1;
  37916. }
  37917. let textureCoordIndex = 0;
  37918. if (vertexFormat.st) {
  37919. const rad = Math.max(topRadius, bottomRadius);
  37920. for (i2 = 0; i2 < numVertices; i2++) {
  37921. const position = Cartesian3_default.fromArray(positions, i2 * 3, positionScratch2);
  37922. st[textureCoordIndex++] = (position.x + rad) / (2 * rad);
  37923. st[textureCoordIndex++] = (position.y + rad) / (2 * rad);
  37924. }
  37925. }
  37926. const attributes = new GeometryAttributes_default();
  37927. if (vertexFormat.position) {
  37928. attributes.position = new GeometryAttribute_default({
  37929. componentDatatype: ComponentDatatype_default.DOUBLE,
  37930. componentsPerAttribute: 3,
  37931. values: positions
  37932. });
  37933. }
  37934. if (vertexFormat.normal) {
  37935. attributes.normal = new GeometryAttribute_default({
  37936. componentDatatype: ComponentDatatype_default.FLOAT,
  37937. componentsPerAttribute: 3,
  37938. values: normals
  37939. });
  37940. }
  37941. if (vertexFormat.tangent) {
  37942. attributes.tangent = new GeometryAttribute_default({
  37943. componentDatatype: ComponentDatatype_default.FLOAT,
  37944. componentsPerAttribute: 3,
  37945. values: tangents
  37946. });
  37947. }
  37948. if (vertexFormat.bitangent) {
  37949. attributes.bitangent = new GeometryAttribute_default({
  37950. componentDatatype: ComponentDatatype_default.FLOAT,
  37951. componentsPerAttribute: 3,
  37952. values: bitangents
  37953. });
  37954. }
  37955. if (vertexFormat.st) {
  37956. attributes.st = new GeometryAttribute_default({
  37957. componentDatatype: ComponentDatatype_default.FLOAT,
  37958. componentsPerAttribute: 2,
  37959. values: st
  37960. });
  37961. }
  37962. radiusScratch.x = length3 * 0.5;
  37963. radiusScratch.y = Math.max(bottomRadius, topRadius);
  37964. const boundingSphere = new BoundingSphere_default(
  37965. Cartesian3_default.ZERO,
  37966. Cartesian2_default.magnitude(radiusScratch)
  37967. );
  37968. if (defined_default(cylinderGeometry._offsetAttribute)) {
  37969. length3 = positions.length;
  37970. const applyOffset = new Uint8Array(length3 / 3);
  37971. const offsetValue = cylinderGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  37972. arrayFill_default(applyOffset, offsetValue);
  37973. attributes.applyOffset = new GeometryAttribute_default({
  37974. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  37975. componentsPerAttribute: 1,
  37976. values: applyOffset
  37977. });
  37978. }
  37979. return new Geometry_default({
  37980. attributes,
  37981. indices: indices2,
  37982. primitiveType: PrimitiveType_default.TRIANGLES,
  37983. boundingSphere,
  37984. offsetAttribute: cylinderGeometry._offsetAttribute
  37985. });
  37986. };
  37987. var unitCylinderGeometry;
  37988. CylinderGeometry.getUnitCylinder = function() {
  37989. if (!defined_default(unitCylinderGeometry)) {
  37990. unitCylinderGeometry = CylinderGeometry.createGeometry(
  37991. new CylinderGeometry({
  37992. topRadius: 1,
  37993. bottomRadius: 1,
  37994. length: 1,
  37995. vertexFormat: VertexFormat_default.POSITION_ONLY
  37996. })
  37997. );
  37998. }
  37999. return unitCylinderGeometry;
  38000. };
  38001. var CylinderGeometry_default = CylinderGeometry;
  38002. // node_modules/cesium/Source/Core/CylinderOutlineGeometry.js
  38003. var radiusScratch2 = new Cartesian2_default();
  38004. function CylinderOutlineGeometry(options) {
  38005. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  38006. const length3 = options.length;
  38007. const topRadius = options.topRadius;
  38008. const bottomRadius = options.bottomRadius;
  38009. const slices = defaultValue_default(options.slices, 128);
  38010. const numberOfVerticalLines = Math.max(
  38011. defaultValue_default(options.numberOfVerticalLines, 16),
  38012. 0
  38013. );
  38014. Check_default.typeOf.number("options.positions", length3);
  38015. Check_default.typeOf.number("options.topRadius", topRadius);
  38016. Check_default.typeOf.number("options.bottomRadius", bottomRadius);
  38017. Check_default.typeOf.number.greaterThanOrEquals("options.slices", slices, 3);
  38018. if (defined_default(options.offsetAttribute) && options.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
  38019. throw new DeveloperError_default(
  38020. "GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry."
  38021. );
  38022. }
  38023. this._length = length3;
  38024. this._topRadius = topRadius;
  38025. this._bottomRadius = bottomRadius;
  38026. this._slices = slices;
  38027. this._numberOfVerticalLines = numberOfVerticalLines;
  38028. this._offsetAttribute = options.offsetAttribute;
  38029. this._workerName = "createCylinderOutlineGeometry";
  38030. }
  38031. CylinderOutlineGeometry.packedLength = 6;
  38032. CylinderOutlineGeometry.pack = function(value, array, startingIndex) {
  38033. Check_default.typeOf.object("value", value);
  38034. Check_default.defined("array", array);
  38035. startingIndex = defaultValue_default(startingIndex, 0);
  38036. array[startingIndex++] = value._length;
  38037. array[startingIndex++] = value._topRadius;
  38038. array[startingIndex++] = value._bottomRadius;
  38039. array[startingIndex++] = value._slices;
  38040. array[startingIndex++] = value._numberOfVerticalLines;
  38041. array[startingIndex] = defaultValue_default(value._offsetAttribute, -1);
  38042. return array;
  38043. };
  38044. var scratchOptions12 = {
  38045. length: void 0,
  38046. topRadius: void 0,
  38047. bottomRadius: void 0,
  38048. slices: void 0,
  38049. numberOfVerticalLines: void 0,
  38050. offsetAttribute: void 0
  38051. };
  38052. CylinderOutlineGeometry.unpack = function(array, startingIndex, result) {
  38053. Check_default.defined("array", array);
  38054. startingIndex = defaultValue_default(startingIndex, 0);
  38055. const length3 = array[startingIndex++];
  38056. const topRadius = array[startingIndex++];
  38057. const bottomRadius = array[startingIndex++];
  38058. const slices = array[startingIndex++];
  38059. const numberOfVerticalLines = array[startingIndex++];
  38060. const offsetAttribute = array[startingIndex];
  38061. if (!defined_default(result)) {
  38062. scratchOptions12.length = length3;
  38063. scratchOptions12.topRadius = topRadius;
  38064. scratchOptions12.bottomRadius = bottomRadius;
  38065. scratchOptions12.slices = slices;
  38066. scratchOptions12.numberOfVerticalLines = numberOfVerticalLines;
  38067. scratchOptions12.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  38068. return new CylinderOutlineGeometry(scratchOptions12);
  38069. }
  38070. result._length = length3;
  38071. result._topRadius = topRadius;
  38072. result._bottomRadius = bottomRadius;
  38073. result._slices = slices;
  38074. result._numberOfVerticalLines = numberOfVerticalLines;
  38075. result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  38076. return result;
  38077. };
  38078. CylinderOutlineGeometry.createGeometry = function(cylinderGeometry) {
  38079. let length3 = cylinderGeometry._length;
  38080. const topRadius = cylinderGeometry._topRadius;
  38081. const bottomRadius = cylinderGeometry._bottomRadius;
  38082. const slices = cylinderGeometry._slices;
  38083. const numberOfVerticalLines = cylinderGeometry._numberOfVerticalLines;
  38084. if (length3 <= 0 || topRadius < 0 || bottomRadius < 0 || topRadius === 0 && bottomRadius === 0) {
  38085. return;
  38086. }
  38087. const numVertices = slices * 2;
  38088. const positions = CylinderGeometryLibrary_default.computePositions(
  38089. length3,
  38090. topRadius,
  38091. bottomRadius,
  38092. slices,
  38093. false
  38094. );
  38095. let numIndices = slices * 2;
  38096. let numSide;
  38097. if (numberOfVerticalLines > 0) {
  38098. const numSideLines = Math.min(numberOfVerticalLines, slices);
  38099. numSide = Math.round(slices / numSideLines);
  38100. numIndices += numSideLines;
  38101. }
  38102. const indices2 = IndexDatatype_default.createTypedArray(numVertices, numIndices * 2);
  38103. let index2 = 0;
  38104. let i2;
  38105. for (i2 = 0; i2 < slices - 1; i2++) {
  38106. indices2[index2++] = i2;
  38107. indices2[index2++] = i2 + 1;
  38108. indices2[index2++] = i2 + slices;
  38109. indices2[index2++] = i2 + 1 + slices;
  38110. }
  38111. indices2[index2++] = slices - 1;
  38112. indices2[index2++] = 0;
  38113. indices2[index2++] = slices + slices - 1;
  38114. indices2[index2++] = slices;
  38115. if (numberOfVerticalLines > 0) {
  38116. for (i2 = 0; i2 < slices; i2 += numSide) {
  38117. indices2[index2++] = i2;
  38118. indices2[index2++] = i2 + slices;
  38119. }
  38120. }
  38121. const attributes = new GeometryAttributes_default();
  38122. attributes.position = new GeometryAttribute_default({
  38123. componentDatatype: ComponentDatatype_default.DOUBLE,
  38124. componentsPerAttribute: 3,
  38125. values: positions
  38126. });
  38127. radiusScratch2.x = length3 * 0.5;
  38128. radiusScratch2.y = Math.max(bottomRadius, topRadius);
  38129. const boundingSphere = new BoundingSphere_default(
  38130. Cartesian3_default.ZERO,
  38131. Cartesian2_default.magnitude(radiusScratch2)
  38132. );
  38133. if (defined_default(cylinderGeometry._offsetAttribute)) {
  38134. length3 = positions.length;
  38135. const applyOffset = new Uint8Array(length3 / 3);
  38136. const offsetValue = cylinderGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  38137. arrayFill_default(applyOffset, offsetValue);
  38138. attributes.applyOffset = new GeometryAttribute_default({
  38139. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  38140. componentsPerAttribute: 1,
  38141. values: applyOffset
  38142. });
  38143. }
  38144. return new Geometry_default({
  38145. attributes,
  38146. indices: indices2,
  38147. primitiveType: PrimitiveType_default.LINES,
  38148. boundingSphere,
  38149. offsetAttribute: cylinderGeometry._offsetAttribute
  38150. });
  38151. };
  38152. var CylinderOutlineGeometry_default = CylinderOutlineGeometry;
  38153. // node_modules/cesium/Source/Core/DefaultProxy.js
  38154. function DefaultProxy(proxy) {
  38155. this.proxy = proxy;
  38156. }
  38157. DefaultProxy.prototype.getURL = function(resource) {
  38158. const prefix = this.proxy.indexOf("?") === -1 ? "?" : "";
  38159. return this.proxy + prefix + encodeURIComponent(resource);
  38160. };
  38161. var DefaultProxy_default = DefaultProxy;
  38162. // node_modules/cesium/Source/Core/DistanceDisplayCondition.js
  38163. function DistanceDisplayCondition(near, far) {
  38164. near = defaultValue_default(near, 0);
  38165. this._near = near;
  38166. far = defaultValue_default(far, Number.MAX_VALUE);
  38167. this._far = far;
  38168. }
  38169. Object.defineProperties(DistanceDisplayCondition.prototype, {
  38170. near: {
  38171. get: function() {
  38172. return this._near;
  38173. },
  38174. set: function(value) {
  38175. this._near = value;
  38176. }
  38177. },
  38178. far: {
  38179. get: function() {
  38180. return this._far;
  38181. },
  38182. set: function(value) {
  38183. this._far = value;
  38184. }
  38185. }
  38186. });
  38187. DistanceDisplayCondition.packedLength = 2;
  38188. DistanceDisplayCondition.pack = function(value, array, startingIndex) {
  38189. if (!defined_default(value)) {
  38190. throw new DeveloperError_default("value is required");
  38191. }
  38192. if (!defined_default(array)) {
  38193. throw new DeveloperError_default("array is required");
  38194. }
  38195. startingIndex = defaultValue_default(startingIndex, 0);
  38196. array[startingIndex++] = value.near;
  38197. array[startingIndex] = value.far;
  38198. return array;
  38199. };
  38200. DistanceDisplayCondition.unpack = function(array, startingIndex, result) {
  38201. if (!defined_default(array)) {
  38202. throw new DeveloperError_default("array is required");
  38203. }
  38204. startingIndex = defaultValue_default(startingIndex, 0);
  38205. if (!defined_default(result)) {
  38206. result = new DistanceDisplayCondition();
  38207. }
  38208. result.near = array[startingIndex++];
  38209. result.far = array[startingIndex];
  38210. return result;
  38211. };
  38212. DistanceDisplayCondition.equals = function(left, right) {
  38213. return left === right || defined_default(left) && defined_default(right) && left.near === right.near && left.far === right.far;
  38214. };
  38215. DistanceDisplayCondition.clone = function(value, result) {
  38216. if (!defined_default(value)) {
  38217. return void 0;
  38218. }
  38219. if (!defined_default(result)) {
  38220. result = new DistanceDisplayCondition();
  38221. }
  38222. result.near = value.near;
  38223. result.far = value.far;
  38224. return result;
  38225. };
  38226. DistanceDisplayCondition.prototype.clone = function(result) {
  38227. return DistanceDisplayCondition.clone(this, result);
  38228. };
  38229. DistanceDisplayCondition.prototype.equals = function(other) {
  38230. return DistanceDisplayCondition.equals(this, other);
  38231. };
  38232. var DistanceDisplayCondition_default = DistanceDisplayCondition;
  38233. // node_modules/cesium/Source/Core/DistanceDisplayConditionGeometryInstanceAttribute.js
  38234. function DistanceDisplayConditionGeometryInstanceAttribute(near, far) {
  38235. near = defaultValue_default(near, 0);
  38236. far = defaultValue_default(far, Number.MAX_VALUE);
  38237. if (far <= near) {
  38238. throw new DeveloperError_default(
  38239. "far distance must be greater than near distance."
  38240. );
  38241. }
  38242. this.value = new Float32Array([near, far]);
  38243. }
  38244. Object.defineProperties(
  38245. DistanceDisplayConditionGeometryInstanceAttribute.prototype,
  38246. {
  38247. componentDatatype: {
  38248. get: function() {
  38249. return ComponentDatatype_default.FLOAT;
  38250. }
  38251. },
  38252. componentsPerAttribute: {
  38253. get: function() {
  38254. return 2;
  38255. }
  38256. },
  38257. normalize: {
  38258. get: function() {
  38259. return false;
  38260. }
  38261. }
  38262. }
  38263. );
  38264. DistanceDisplayConditionGeometryInstanceAttribute.fromDistanceDisplayCondition = function(distanceDisplayCondition) {
  38265. if (!defined_default(distanceDisplayCondition)) {
  38266. throw new DeveloperError_default("distanceDisplayCondition is required.");
  38267. }
  38268. if (distanceDisplayCondition.far <= distanceDisplayCondition.near) {
  38269. throw new DeveloperError_default(
  38270. "distanceDisplayCondition.far distance must be greater than distanceDisplayCondition.near distance."
  38271. );
  38272. }
  38273. return new DistanceDisplayConditionGeometryInstanceAttribute(
  38274. distanceDisplayCondition.near,
  38275. distanceDisplayCondition.far
  38276. );
  38277. };
  38278. DistanceDisplayConditionGeometryInstanceAttribute.toValue = function(distanceDisplayCondition, result) {
  38279. if (!defined_default(distanceDisplayCondition)) {
  38280. throw new DeveloperError_default("distanceDisplayCondition is required.");
  38281. }
  38282. if (!defined_default(result)) {
  38283. return new Float32Array([
  38284. distanceDisplayCondition.near,
  38285. distanceDisplayCondition.far
  38286. ]);
  38287. }
  38288. result[0] = distanceDisplayCondition.near;
  38289. result[1] = distanceDisplayCondition.far;
  38290. return result;
  38291. };
  38292. var DistanceDisplayConditionGeometryInstanceAttribute_default = DistanceDisplayConditionGeometryInstanceAttribute;
  38293. // node_modules/cesium/Source/Core/DoubleEndedPriorityQueue.js
  38294. function DoubleEndedPriorityQueue(options) {
  38295. Check_default.typeOf.object("options", options);
  38296. Check_default.defined("options.comparator", options.comparator);
  38297. if (defined_default(options.maximumLength)) {
  38298. Check_default.typeOf.number.greaterThanOrEquals(
  38299. "options.maximumLength",
  38300. options.maximumLength,
  38301. 0
  38302. );
  38303. }
  38304. this._comparator = options.comparator;
  38305. this._maximumLength = options.maximumLength;
  38306. this._array = defined_default(options.maximumLength) ? new Array(options.maximumLength) : [];
  38307. this._length = 0;
  38308. }
  38309. Object.defineProperties(DoubleEndedPriorityQueue.prototype, {
  38310. length: {
  38311. get: function() {
  38312. return this._length;
  38313. }
  38314. },
  38315. maximumLength: {
  38316. get: function() {
  38317. return this._maximumLength;
  38318. },
  38319. set: function(value) {
  38320. if (defined_default(value)) {
  38321. Check_default.typeOf.number.greaterThanOrEquals("maximumLength", value, 0);
  38322. while (this._length > value) {
  38323. this.removeMinimum();
  38324. }
  38325. this._array.length = value;
  38326. }
  38327. this._maximumLength = value;
  38328. }
  38329. },
  38330. internalArray: {
  38331. get: function() {
  38332. return this._array;
  38333. }
  38334. },
  38335. comparator: {
  38336. get: function() {
  38337. return this._comparator;
  38338. }
  38339. }
  38340. });
  38341. DoubleEndedPriorityQueue.prototype.clone = function() {
  38342. const maximumLength = this._maximumLength;
  38343. const comparator = this._comparator;
  38344. const array = this._array;
  38345. const length3 = this._length;
  38346. const result = new DoubleEndedPriorityQueue({
  38347. comparator,
  38348. maximumLength
  38349. });
  38350. result._length = length3;
  38351. for (let i2 = 0; i2 < length3; i2++) {
  38352. result._array[i2] = array[i2];
  38353. }
  38354. return result;
  38355. };
  38356. DoubleEndedPriorityQueue.prototype.reset = function() {
  38357. this._length = 0;
  38358. const maximumLength = this._maximumLength;
  38359. if (defined_default(maximumLength)) {
  38360. for (let i2 = 0; i2 < maximumLength; i2++) {
  38361. this._array[i2] = void 0;
  38362. }
  38363. } else {
  38364. this._array.length = 0;
  38365. }
  38366. };
  38367. DoubleEndedPriorityQueue.prototype.resort = function() {
  38368. const length3 = this._length;
  38369. for (let i2 = 0; i2 < length3; i2++) {
  38370. pushUp(this, i2);
  38371. }
  38372. };
  38373. DoubleEndedPriorityQueue.prototype.insert = function(element) {
  38374. let removedElement;
  38375. const maximumLength = this._maximumLength;
  38376. if (defined_default(maximumLength)) {
  38377. if (maximumLength === 0) {
  38378. return void 0;
  38379. } else if (this._length === maximumLength) {
  38380. const minimumElement = this._array[0];
  38381. if (this._comparator(element, minimumElement) <= 0) {
  38382. return element;
  38383. }
  38384. removedElement = this.removeMinimum();
  38385. }
  38386. }
  38387. const index2 = this._length;
  38388. this._array[index2] = element;
  38389. this._length++;
  38390. pushUp(this, index2);
  38391. return removedElement;
  38392. };
  38393. DoubleEndedPriorityQueue.prototype.removeMinimum = function() {
  38394. const length3 = this._length;
  38395. if (length3 === 0) {
  38396. return void 0;
  38397. }
  38398. this._length--;
  38399. const minimumElement = this._array[0];
  38400. if (length3 >= 2) {
  38401. this._array[0] = this._array[length3 - 1];
  38402. pushDown(this, 0);
  38403. }
  38404. this._array[length3 - 1] = void 0;
  38405. return minimumElement;
  38406. };
  38407. DoubleEndedPriorityQueue.prototype.removeMaximum = function() {
  38408. const length3 = this._length;
  38409. if (length3 === 0) {
  38410. return void 0;
  38411. }
  38412. this._length--;
  38413. let maximumElement;
  38414. if (length3 <= 2) {
  38415. maximumElement = this._array[length3 - 1];
  38416. } else {
  38417. const maximumElementIndex = greaterThan(this, 1, 2) ? 1 : 2;
  38418. maximumElement = this._array[maximumElementIndex];
  38419. this._array[maximumElementIndex] = this._array[length3 - 1];
  38420. if (length3 >= 4) {
  38421. pushDown(this, maximumElementIndex);
  38422. }
  38423. }
  38424. this._array[length3 - 1] = void 0;
  38425. return maximumElement;
  38426. };
  38427. DoubleEndedPriorityQueue.prototype.getMinimum = function() {
  38428. const length3 = this._length;
  38429. if (length3 === 0) {
  38430. return void 0;
  38431. }
  38432. return this._array[0];
  38433. };
  38434. DoubleEndedPriorityQueue.prototype.getMaximum = function() {
  38435. const length3 = this._length;
  38436. if (length3 === 0) {
  38437. return void 0;
  38438. }
  38439. if (length3 <= 2) {
  38440. return this._array[length3 - 1];
  38441. }
  38442. return this._array[greaterThan(this, 1, 2) ? 1 : 2];
  38443. };
  38444. function swap2(that, indexA, indexB) {
  38445. const array = that._array;
  38446. const temp = array[indexA];
  38447. array[indexA] = array[indexB];
  38448. array[indexB] = temp;
  38449. }
  38450. function lessThan(that, indexA, indexB) {
  38451. return that._comparator(that._array[indexA], that._array[indexB]) < 0;
  38452. }
  38453. function greaterThan(that, indexA, indexB) {
  38454. return that._comparator(that._array[indexA], that._array[indexB]) > 0;
  38455. }
  38456. function pushUp(that, index2) {
  38457. if (index2 === 0) {
  38458. return;
  38459. }
  38460. const onMinLevel = Math.floor(Math_default.log2(index2 + 1)) % 2 === 0;
  38461. const parentIndex = Math.floor((index2 - 1) / 2);
  38462. const lessThanParent = lessThan(that, index2, parentIndex);
  38463. if (lessThanParent !== onMinLevel) {
  38464. swap2(that, index2, parentIndex);
  38465. index2 = parentIndex;
  38466. }
  38467. while (index2 >= 3) {
  38468. const grandparentIndex = Math.floor((index2 - 3) / 4);
  38469. if (lessThan(that, index2, grandparentIndex) !== lessThanParent) {
  38470. break;
  38471. }
  38472. swap2(that, index2, grandparentIndex);
  38473. index2 = grandparentIndex;
  38474. }
  38475. }
  38476. function pushDown(that, index2) {
  38477. const length3 = that._length;
  38478. const onMinLevel = Math.floor(Math_default.log2(index2 + 1)) % 2 === 0;
  38479. let leftChildIndex;
  38480. while ((leftChildIndex = 2 * index2 + 1) < length3) {
  38481. let target = leftChildIndex;
  38482. const rightChildIndex = leftChildIndex + 1;
  38483. if (rightChildIndex < length3) {
  38484. if (lessThan(that, rightChildIndex, target) === onMinLevel) {
  38485. target = rightChildIndex;
  38486. }
  38487. const grandChildStart = 2 * leftChildIndex + 1;
  38488. const grandChildCount = Math.max(
  38489. Math.min(length3 - grandChildStart, 4),
  38490. 0
  38491. );
  38492. for (let i2 = 0; i2 < grandChildCount; i2++) {
  38493. const grandChildIndex = grandChildStart + i2;
  38494. if (lessThan(that, grandChildIndex, target) === onMinLevel) {
  38495. target = grandChildIndex;
  38496. }
  38497. }
  38498. }
  38499. if (lessThan(that, target, index2) === onMinLevel) {
  38500. swap2(that, target, index2);
  38501. if (target !== leftChildIndex && target !== rightChildIndex) {
  38502. const parentOfGrandchildIndex = Math.floor((target - 1) / 2);
  38503. if (greaterThan(that, target, parentOfGrandchildIndex) === onMinLevel) {
  38504. swap2(that, target, parentOfGrandchildIndex);
  38505. }
  38506. }
  38507. }
  38508. index2 = target;
  38509. }
  38510. }
  38511. var DoubleEndedPriorityQueue_default = DoubleEndedPriorityQueue;
  38512. // node_modules/cesium/Source/Core/DoublyLinkedList.js
  38513. function DoublyLinkedList() {
  38514. this.head = void 0;
  38515. this.tail = void 0;
  38516. this._length = 0;
  38517. }
  38518. Object.defineProperties(DoublyLinkedList.prototype, {
  38519. length: {
  38520. get: function() {
  38521. return this._length;
  38522. }
  38523. }
  38524. });
  38525. function DoublyLinkedListNode(item, previous, next) {
  38526. this.item = item;
  38527. this.previous = previous;
  38528. this.next = next;
  38529. }
  38530. DoublyLinkedList.prototype.add = function(item) {
  38531. const node = new DoublyLinkedListNode(item, this.tail, void 0);
  38532. if (defined_default(this.tail)) {
  38533. this.tail.next = node;
  38534. this.tail = node;
  38535. } else {
  38536. this.head = node;
  38537. this.tail = node;
  38538. }
  38539. ++this._length;
  38540. return node;
  38541. };
  38542. function remove(list, node) {
  38543. if (defined_default(node.previous) && defined_default(node.next)) {
  38544. node.previous.next = node.next;
  38545. node.next.previous = node.previous;
  38546. } else if (defined_default(node.previous)) {
  38547. node.previous.next = void 0;
  38548. list.tail = node.previous;
  38549. } else if (defined_default(node.next)) {
  38550. node.next.previous = void 0;
  38551. list.head = node.next;
  38552. } else {
  38553. list.head = void 0;
  38554. list.tail = void 0;
  38555. }
  38556. node.next = void 0;
  38557. node.previous = void 0;
  38558. }
  38559. DoublyLinkedList.prototype.remove = function(node) {
  38560. if (!defined_default(node)) {
  38561. return;
  38562. }
  38563. remove(this, node);
  38564. --this._length;
  38565. };
  38566. DoublyLinkedList.prototype.splice = function(node, nextNode) {
  38567. if (node === nextNode) {
  38568. return;
  38569. }
  38570. remove(this, nextNode);
  38571. const oldNodeNext = node.next;
  38572. node.next = nextNode;
  38573. if (this.tail === node) {
  38574. this.tail = nextNode;
  38575. } else {
  38576. oldNodeNext.previous = nextNode;
  38577. }
  38578. nextNode.next = oldNodeNext;
  38579. nextNode.previous = node;
  38580. };
  38581. var DoublyLinkedList_default = DoublyLinkedList;
  38582. // node_modules/cesium/Source/ThirdParty/Tween.js
  38583. var Tween = createCommonjsModule(function(module2, exports2) {
  38584. var TWEEN = TWEEN || function() {
  38585. var _tweens = [];
  38586. return {
  38587. getAll: function() {
  38588. return _tweens;
  38589. },
  38590. removeAll: function() {
  38591. _tweens = [];
  38592. },
  38593. add: function(tween) {
  38594. _tweens.push(tween);
  38595. },
  38596. remove: function(tween) {
  38597. var i2 = _tweens.indexOf(tween);
  38598. if (i2 !== -1) {
  38599. _tweens.splice(i2, 1);
  38600. }
  38601. },
  38602. update: function(time, preserve) {
  38603. if (_tweens.length === 0) {
  38604. return false;
  38605. }
  38606. var i2 = 0;
  38607. time = time !== void 0 ? time : TWEEN.now();
  38608. while (i2 < _tweens.length) {
  38609. if (_tweens[i2].update(time) || preserve) {
  38610. i2++;
  38611. } else {
  38612. _tweens.splice(i2, 1);
  38613. }
  38614. }
  38615. return true;
  38616. }
  38617. };
  38618. }();
  38619. if (typeof window === "undefined" && typeof process !== "undefined") {
  38620. TWEEN.now = function() {
  38621. var time = process.hrtime();
  38622. return time[0] * 1e3 + time[1] / 1e6;
  38623. };
  38624. } else if (typeof window !== "undefined" && window.performance !== void 0 && window.performance.now !== void 0) {
  38625. TWEEN.now = window.performance.now.bind(window.performance);
  38626. } else if (Date.now !== void 0) {
  38627. TWEEN.now = Date.now;
  38628. } else {
  38629. TWEEN.now = function() {
  38630. return new Date().getTime();
  38631. };
  38632. }
  38633. TWEEN.Tween = function(object2) {
  38634. var _object = object2;
  38635. var _valuesStart = {};
  38636. var _valuesEnd = {};
  38637. var _valuesStartRepeat = {};
  38638. var _duration = 1e3;
  38639. var _repeat = 0;
  38640. var _repeatDelayTime;
  38641. var _yoyo = false;
  38642. var _isPlaying = false;
  38643. var _delayTime = 0;
  38644. var _startTime = null;
  38645. var _easingFunction = TWEEN.Easing.Linear.None;
  38646. var _interpolationFunction = TWEEN.Interpolation.Linear;
  38647. var _chainedTweens = [];
  38648. var _onStartCallback = null;
  38649. var _onStartCallbackFired = false;
  38650. var _onUpdateCallback = null;
  38651. var _onCompleteCallback = null;
  38652. var _onStopCallback = null;
  38653. this.to = function(properties, duration) {
  38654. _valuesEnd = properties;
  38655. if (duration !== void 0) {
  38656. _duration = duration;
  38657. }
  38658. return this;
  38659. };
  38660. this.start = function(time) {
  38661. TWEEN.add(this);
  38662. _isPlaying = true;
  38663. _onStartCallbackFired = false;
  38664. _startTime = time !== void 0 ? time : TWEEN.now();
  38665. _startTime += _delayTime;
  38666. for (var property in _valuesEnd) {
  38667. if (_valuesEnd[property] instanceof Array) {
  38668. if (_valuesEnd[property].length === 0) {
  38669. continue;
  38670. }
  38671. _valuesEnd[property] = [_object[property]].concat(_valuesEnd[property]);
  38672. }
  38673. if (_object[property] === void 0) {
  38674. continue;
  38675. }
  38676. _valuesStart[property] = _object[property];
  38677. if (_valuesStart[property] instanceof Array === false) {
  38678. _valuesStart[property] *= 1;
  38679. }
  38680. _valuesStartRepeat[property] = _valuesStart[property] || 0;
  38681. }
  38682. return this;
  38683. };
  38684. this.stop = function() {
  38685. if (!_isPlaying) {
  38686. return this;
  38687. }
  38688. TWEEN.remove(this);
  38689. _isPlaying = false;
  38690. if (_onStopCallback !== null) {
  38691. _onStopCallback.call(_object, _object);
  38692. }
  38693. this.stopChainedTweens();
  38694. return this;
  38695. };
  38696. this.end = function() {
  38697. this.update(_startTime + _duration);
  38698. return this;
  38699. };
  38700. this.stopChainedTweens = function() {
  38701. for (var i2 = 0, numChainedTweens = _chainedTweens.length; i2 < numChainedTweens; i2++) {
  38702. _chainedTweens[i2].stop();
  38703. }
  38704. };
  38705. this.delay = function(amount) {
  38706. _delayTime = amount;
  38707. return this;
  38708. };
  38709. this.repeat = function(times) {
  38710. _repeat = times;
  38711. return this;
  38712. };
  38713. this.repeatDelay = function(amount) {
  38714. _repeatDelayTime = amount;
  38715. return this;
  38716. };
  38717. this.yoyo = function(yoyo) {
  38718. _yoyo = yoyo;
  38719. return this;
  38720. };
  38721. this.easing = function(easing) {
  38722. _easingFunction = easing;
  38723. return this;
  38724. };
  38725. this.interpolation = function(interpolation) {
  38726. _interpolationFunction = interpolation;
  38727. return this;
  38728. };
  38729. this.chain = function() {
  38730. _chainedTweens = arguments;
  38731. return this;
  38732. };
  38733. this.onStart = function(callback) {
  38734. _onStartCallback = callback;
  38735. return this;
  38736. };
  38737. this.onUpdate = function(callback) {
  38738. _onUpdateCallback = callback;
  38739. return this;
  38740. };
  38741. this.onComplete = function(callback) {
  38742. _onCompleteCallback = callback;
  38743. return this;
  38744. };
  38745. this.onStop = function(callback) {
  38746. _onStopCallback = callback;
  38747. return this;
  38748. };
  38749. this.update = function(time) {
  38750. var property;
  38751. var elapsed;
  38752. var value;
  38753. if (time < _startTime) {
  38754. return true;
  38755. }
  38756. if (_onStartCallbackFired === false) {
  38757. if (_onStartCallback !== null) {
  38758. _onStartCallback.call(_object, _object);
  38759. }
  38760. _onStartCallbackFired = true;
  38761. }
  38762. elapsed = (time - _startTime) / _duration;
  38763. elapsed = elapsed > 1 ? 1 : elapsed;
  38764. value = _easingFunction(elapsed);
  38765. for (property in _valuesEnd) {
  38766. if (_valuesStart[property] === void 0) {
  38767. continue;
  38768. }
  38769. var start = _valuesStart[property] || 0;
  38770. var end = _valuesEnd[property];
  38771. if (end instanceof Array) {
  38772. _object[property] = _interpolationFunction(end, value);
  38773. } else {
  38774. if (typeof end === "string") {
  38775. if (end.charAt(0) === "+" || end.charAt(0) === "-") {
  38776. end = start + parseFloat(end);
  38777. } else {
  38778. end = parseFloat(end);
  38779. }
  38780. }
  38781. if (typeof end === "number") {
  38782. _object[property] = start + (end - start) * value;
  38783. }
  38784. }
  38785. }
  38786. if (_onUpdateCallback !== null) {
  38787. _onUpdateCallback.call(_object, value);
  38788. }
  38789. if (elapsed === 1) {
  38790. if (_repeat > 0) {
  38791. if (isFinite(_repeat)) {
  38792. _repeat--;
  38793. }
  38794. for (property in _valuesStartRepeat) {
  38795. if (typeof _valuesEnd[property] === "string") {
  38796. _valuesStartRepeat[property] = _valuesStartRepeat[property] + parseFloat(_valuesEnd[property]);
  38797. }
  38798. if (_yoyo) {
  38799. var tmp2 = _valuesStartRepeat[property];
  38800. _valuesStartRepeat[property] = _valuesEnd[property];
  38801. _valuesEnd[property] = tmp2;
  38802. }
  38803. _valuesStart[property] = _valuesStartRepeat[property];
  38804. }
  38805. if (_repeatDelayTime !== void 0) {
  38806. _startTime = time + _repeatDelayTime;
  38807. } else {
  38808. _startTime = time + _delayTime;
  38809. }
  38810. return true;
  38811. } else {
  38812. if (_onCompleteCallback !== null) {
  38813. _onCompleteCallback.call(_object, _object);
  38814. }
  38815. for (var i2 = 0, numChainedTweens = _chainedTweens.length; i2 < numChainedTweens; i2++) {
  38816. _chainedTweens[i2].start(_startTime + _duration);
  38817. }
  38818. return false;
  38819. }
  38820. }
  38821. return true;
  38822. };
  38823. };
  38824. TWEEN.Easing = {
  38825. Linear: {
  38826. None: function(k) {
  38827. return k;
  38828. }
  38829. },
  38830. Quadratic: {
  38831. In: function(k) {
  38832. return k * k;
  38833. },
  38834. Out: function(k) {
  38835. return k * (2 - k);
  38836. },
  38837. InOut: function(k) {
  38838. if ((k *= 2) < 1) {
  38839. return 0.5 * k * k;
  38840. }
  38841. return -0.5 * (--k * (k - 2) - 1);
  38842. }
  38843. },
  38844. Cubic: {
  38845. In: function(k) {
  38846. return k * k * k;
  38847. },
  38848. Out: function(k) {
  38849. return --k * k * k + 1;
  38850. },
  38851. InOut: function(k) {
  38852. if ((k *= 2) < 1) {
  38853. return 0.5 * k * k * k;
  38854. }
  38855. return 0.5 * ((k -= 2) * k * k + 2);
  38856. }
  38857. },
  38858. Quartic: {
  38859. In: function(k) {
  38860. return k * k * k * k;
  38861. },
  38862. Out: function(k) {
  38863. return 1 - --k * k * k * k;
  38864. },
  38865. InOut: function(k) {
  38866. if ((k *= 2) < 1) {
  38867. return 0.5 * k * k * k * k;
  38868. }
  38869. return -0.5 * ((k -= 2) * k * k * k - 2);
  38870. }
  38871. },
  38872. Quintic: {
  38873. In: function(k) {
  38874. return k * k * k * k * k;
  38875. },
  38876. Out: function(k) {
  38877. return --k * k * k * k * k + 1;
  38878. },
  38879. InOut: function(k) {
  38880. if ((k *= 2) < 1) {
  38881. return 0.5 * k * k * k * k * k;
  38882. }
  38883. return 0.5 * ((k -= 2) * k * k * k * k + 2);
  38884. }
  38885. },
  38886. Sinusoidal: {
  38887. In: function(k) {
  38888. return 1 - Math.cos(k * Math.PI / 2);
  38889. },
  38890. Out: function(k) {
  38891. return Math.sin(k * Math.PI / 2);
  38892. },
  38893. InOut: function(k) {
  38894. return 0.5 * (1 - Math.cos(Math.PI * k));
  38895. }
  38896. },
  38897. Exponential: {
  38898. In: function(k) {
  38899. return k === 0 ? 0 : Math.pow(1024, k - 1);
  38900. },
  38901. Out: function(k) {
  38902. return k === 1 ? 1 : 1 - Math.pow(2, -10 * k);
  38903. },
  38904. InOut: function(k) {
  38905. if (k === 0) {
  38906. return 0;
  38907. }
  38908. if (k === 1) {
  38909. return 1;
  38910. }
  38911. if ((k *= 2) < 1) {
  38912. return 0.5 * Math.pow(1024, k - 1);
  38913. }
  38914. return 0.5 * (-Math.pow(2, -10 * (k - 1)) + 2);
  38915. }
  38916. },
  38917. Circular: {
  38918. In: function(k) {
  38919. return 1 - Math.sqrt(1 - k * k);
  38920. },
  38921. Out: function(k) {
  38922. return Math.sqrt(1 - --k * k);
  38923. },
  38924. InOut: function(k) {
  38925. if ((k *= 2) < 1) {
  38926. return -0.5 * (Math.sqrt(1 - k * k) - 1);
  38927. }
  38928. return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1);
  38929. }
  38930. },
  38931. Elastic: {
  38932. In: function(k) {
  38933. if (k === 0) {
  38934. return 0;
  38935. }
  38936. if (k === 1) {
  38937. return 1;
  38938. }
  38939. return -Math.pow(2, 10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI);
  38940. },
  38941. Out: function(k) {
  38942. if (k === 0) {
  38943. return 0;
  38944. }
  38945. if (k === 1) {
  38946. return 1;
  38947. }
  38948. return Math.pow(2, -10 * k) * Math.sin((k - 0.1) * 5 * Math.PI) + 1;
  38949. },
  38950. InOut: function(k) {
  38951. if (k === 0) {
  38952. return 0;
  38953. }
  38954. if (k === 1) {
  38955. return 1;
  38956. }
  38957. k *= 2;
  38958. if (k < 1) {
  38959. return -0.5 * Math.pow(2, 10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI);
  38960. }
  38961. return 0.5 * Math.pow(2, -10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI) + 1;
  38962. }
  38963. },
  38964. Back: {
  38965. In: function(k) {
  38966. var s2 = 1.70158;
  38967. return k * k * ((s2 + 1) * k - s2);
  38968. },
  38969. Out: function(k) {
  38970. var s2 = 1.70158;
  38971. return --k * k * ((s2 + 1) * k + s2) + 1;
  38972. },
  38973. InOut: function(k) {
  38974. var s2 = 1.70158 * 1.525;
  38975. if ((k *= 2) < 1) {
  38976. return 0.5 * (k * k * ((s2 + 1) * k - s2));
  38977. }
  38978. return 0.5 * ((k -= 2) * k * ((s2 + 1) * k + s2) + 2);
  38979. }
  38980. },
  38981. Bounce: {
  38982. In: function(k) {
  38983. return 1 - TWEEN.Easing.Bounce.Out(1 - k);
  38984. },
  38985. Out: function(k) {
  38986. if (k < 1 / 2.75) {
  38987. return 7.5625 * k * k;
  38988. } else if (k < 2 / 2.75) {
  38989. return 7.5625 * (k -= 1.5 / 2.75) * k + 0.75;
  38990. } else if (k < 2.5 / 2.75) {
  38991. return 7.5625 * (k -= 2.25 / 2.75) * k + 0.9375;
  38992. } else {
  38993. return 7.5625 * (k -= 2.625 / 2.75) * k + 0.984375;
  38994. }
  38995. },
  38996. InOut: function(k) {
  38997. if (k < 0.5) {
  38998. return TWEEN.Easing.Bounce.In(k * 2) * 0.5;
  38999. }
  39000. return TWEEN.Easing.Bounce.Out(k * 2 - 1) * 0.5 + 0.5;
  39001. }
  39002. }
  39003. };
  39004. TWEEN.Interpolation = {
  39005. Linear: function(v7, k) {
  39006. var m = v7.length - 1;
  39007. var f2 = m * k;
  39008. var i2 = Math.floor(f2);
  39009. var fn = TWEEN.Interpolation.Utils.Linear;
  39010. if (k < 0) {
  39011. return fn(v7[0], v7[1], f2);
  39012. }
  39013. if (k > 1) {
  39014. return fn(v7[m], v7[m - 1], m - f2);
  39015. }
  39016. return fn(v7[i2], v7[i2 + 1 > m ? m : i2 + 1], f2 - i2);
  39017. },
  39018. Bezier: function(v7, k) {
  39019. var b = 0;
  39020. var n2 = v7.length - 1;
  39021. var pw = Math.pow;
  39022. var bn = TWEEN.Interpolation.Utils.Bernstein;
  39023. for (var i2 = 0; i2 <= n2; i2++) {
  39024. b += pw(1 - k, n2 - i2) * pw(k, i2) * v7[i2] * bn(n2, i2);
  39025. }
  39026. return b;
  39027. },
  39028. CatmullRom: function(v7, k) {
  39029. var m = v7.length - 1;
  39030. var f2 = m * k;
  39031. var i2 = Math.floor(f2);
  39032. var fn = TWEEN.Interpolation.Utils.CatmullRom;
  39033. if (v7[0] === v7[m]) {
  39034. if (k < 0) {
  39035. i2 = Math.floor(f2 = m * (1 + k));
  39036. }
  39037. return fn(v7[(i2 - 1 + m) % m], v7[i2], v7[(i2 + 1) % m], v7[(i2 + 2) % m], f2 - i2);
  39038. } else {
  39039. if (k < 0) {
  39040. return v7[0] - (fn(v7[0], v7[0], v7[1], v7[1], -f2) - v7[0]);
  39041. }
  39042. if (k > 1) {
  39043. return v7[m] - (fn(v7[m], v7[m], v7[m - 1], v7[m - 1], f2 - m) - v7[m]);
  39044. }
  39045. return fn(v7[i2 ? i2 - 1 : 0], v7[i2], v7[m < i2 + 1 ? m : i2 + 1], v7[m < i2 + 2 ? m : i2 + 2], f2 - i2);
  39046. }
  39047. },
  39048. Utils: {
  39049. Linear: function(p0, p1, t) {
  39050. return (p1 - p0) * t + p0;
  39051. },
  39052. Bernstein: function(n2, i2) {
  39053. var fc = TWEEN.Interpolation.Utils.Factorial;
  39054. return fc(n2) / fc(i2) / fc(n2 - i2);
  39055. },
  39056. Factorial: function() {
  39057. var a4 = [1];
  39058. return function(n2) {
  39059. var s2 = 1;
  39060. if (a4[n2]) {
  39061. return a4[n2];
  39062. }
  39063. for (var i2 = n2; i2 > 1; i2--) {
  39064. s2 *= i2;
  39065. }
  39066. a4[n2] = s2;
  39067. return s2;
  39068. };
  39069. }(),
  39070. CatmullRom: function(p0, p1, p2, p3, t) {
  39071. var v02 = (p2 - p0) * 0.5;
  39072. var v13 = (p3 - p1) * 0.5;
  39073. var t2 = t * t;
  39074. var t3 = t * t2;
  39075. return (2 * p1 - 2 * p2 + v02 + v13) * t3 + (-3 * p1 + 3 * p2 - 2 * v02 - v13) * t2 + v02 * t + p1;
  39076. }
  39077. }
  39078. };
  39079. (function(root) {
  39080. {
  39081. module2.exports = TWEEN;
  39082. }
  39083. })();
  39084. });
  39085. // node_modules/cesium/Source/Core/EasingFunction.js
  39086. var EasingFunction = {
  39087. LINEAR_NONE: Tween.Easing.Linear.None,
  39088. QUADRATIC_IN: Tween.Easing.Quadratic.In,
  39089. QUADRATIC_OUT: Tween.Easing.Quadratic.Out,
  39090. QUADRATIC_IN_OUT: Tween.Easing.Quadratic.InOut,
  39091. CUBIC_IN: Tween.Easing.Cubic.In,
  39092. CUBIC_OUT: Tween.Easing.Cubic.Out,
  39093. CUBIC_IN_OUT: Tween.Easing.Cubic.InOut,
  39094. QUARTIC_IN: Tween.Easing.Quartic.In,
  39095. QUARTIC_OUT: Tween.Easing.Quartic.Out,
  39096. QUARTIC_IN_OUT: Tween.Easing.Quartic.InOut,
  39097. QUINTIC_IN: Tween.Easing.Quintic.In,
  39098. QUINTIC_OUT: Tween.Easing.Quintic.Out,
  39099. QUINTIC_IN_OUT: Tween.Easing.Quintic.InOut,
  39100. SINUSOIDAL_IN: Tween.Easing.Sinusoidal.In,
  39101. SINUSOIDAL_OUT: Tween.Easing.Sinusoidal.Out,
  39102. SINUSOIDAL_IN_OUT: Tween.Easing.Sinusoidal.InOut,
  39103. EXPONENTIAL_IN: Tween.Easing.Exponential.In,
  39104. EXPONENTIAL_OUT: Tween.Easing.Exponential.Out,
  39105. EXPONENTIAL_IN_OUT: Tween.Easing.Exponential.InOut,
  39106. CIRCULAR_IN: Tween.Easing.Circular.In,
  39107. CIRCULAR_OUT: Tween.Easing.Circular.Out,
  39108. CIRCULAR_IN_OUT: Tween.Easing.Circular.InOut,
  39109. ELASTIC_IN: Tween.Easing.Elastic.In,
  39110. ELASTIC_OUT: Tween.Easing.Elastic.Out,
  39111. ELASTIC_IN_OUT: Tween.Easing.Elastic.InOut,
  39112. BACK_IN: Tween.Easing.Back.In,
  39113. BACK_OUT: Tween.Easing.Back.Out,
  39114. BACK_IN_OUT: Tween.Easing.Back.InOut,
  39115. BOUNCE_IN: Tween.Easing.Bounce.In,
  39116. BOUNCE_OUT: Tween.Easing.Bounce.Out,
  39117. BOUNCE_IN_OUT: Tween.Easing.Bounce.InOut
  39118. };
  39119. var EasingFunction_default = Object.freeze(EasingFunction);
  39120. // node_modules/cesium/Source/Core/EllipsoidGeometry.js
  39121. var scratchPosition3 = new Cartesian3_default();
  39122. var scratchNormal5 = new Cartesian3_default();
  39123. var scratchTangent3 = new Cartesian3_default();
  39124. var scratchBitangent3 = new Cartesian3_default();
  39125. var scratchNormalST = new Cartesian3_default();
  39126. var defaultRadii = new Cartesian3_default(1, 1, 1);
  39127. var cos = Math.cos;
  39128. var sin = Math.sin;
  39129. function EllipsoidGeometry(options) {
  39130. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  39131. const radii = defaultValue_default(options.radii, defaultRadii);
  39132. const innerRadii = defaultValue_default(options.innerRadii, radii);
  39133. const minimumClock = defaultValue_default(options.minimumClock, 0);
  39134. const maximumClock = defaultValue_default(options.maximumClock, Math_default.TWO_PI);
  39135. const minimumCone = defaultValue_default(options.minimumCone, 0);
  39136. const maximumCone = defaultValue_default(options.maximumCone, Math_default.PI);
  39137. const stackPartitions = Math.round(defaultValue_default(options.stackPartitions, 64));
  39138. const slicePartitions = Math.round(defaultValue_default(options.slicePartitions, 64));
  39139. const vertexFormat = defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT);
  39140. if (slicePartitions < 3) {
  39141. throw new DeveloperError_default(
  39142. "options.slicePartitions cannot be less than three."
  39143. );
  39144. }
  39145. if (stackPartitions < 3) {
  39146. throw new DeveloperError_default(
  39147. "options.stackPartitions cannot be less than three."
  39148. );
  39149. }
  39150. this._radii = Cartesian3_default.clone(radii);
  39151. this._innerRadii = Cartesian3_default.clone(innerRadii);
  39152. this._minimumClock = minimumClock;
  39153. this._maximumClock = maximumClock;
  39154. this._minimumCone = minimumCone;
  39155. this._maximumCone = maximumCone;
  39156. this._stackPartitions = stackPartitions;
  39157. this._slicePartitions = slicePartitions;
  39158. this._vertexFormat = VertexFormat_default.clone(vertexFormat);
  39159. this._offsetAttribute = options.offsetAttribute;
  39160. this._workerName = "createEllipsoidGeometry";
  39161. }
  39162. EllipsoidGeometry.packedLength = 2 * Cartesian3_default.packedLength + VertexFormat_default.packedLength + 7;
  39163. EllipsoidGeometry.pack = function(value, array, startingIndex) {
  39164. if (!defined_default(value)) {
  39165. throw new DeveloperError_default("value is required");
  39166. }
  39167. if (!defined_default(array)) {
  39168. throw new DeveloperError_default("array is required");
  39169. }
  39170. startingIndex = defaultValue_default(startingIndex, 0);
  39171. Cartesian3_default.pack(value._radii, array, startingIndex);
  39172. startingIndex += Cartesian3_default.packedLength;
  39173. Cartesian3_default.pack(value._innerRadii, array, startingIndex);
  39174. startingIndex += Cartesian3_default.packedLength;
  39175. VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
  39176. startingIndex += VertexFormat_default.packedLength;
  39177. array[startingIndex++] = value._minimumClock;
  39178. array[startingIndex++] = value._maximumClock;
  39179. array[startingIndex++] = value._minimumCone;
  39180. array[startingIndex++] = value._maximumCone;
  39181. array[startingIndex++] = value._stackPartitions;
  39182. array[startingIndex++] = value._slicePartitions;
  39183. array[startingIndex] = defaultValue_default(value._offsetAttribute, -1);
  39184. return array;
  39185. };
  39186. var scratchRadii = new Cartesian3_default();
  39187. var scratchInnerRadii = new Cartesian3_default();
  39188. var scratchVertexFormat6 = new VertexFormat_default();
  39189. var scratchOptions13 = {
  39190. radii: scratchRadii,
  39191. innerRadii: scratchInnerRadii,
  39192. vertexFormat: scratchVertexFormat6,
  39193. minimumClock: void 0,
  39194. maximumClock: void 0,
  39195. minimumCone: void 0,
  39196. maximumCone: void 0,
  39197. stackPartitions: void 0,
  39198. slicePartitions: void 0,
  39199. offsetAttribute: void 0
  39200. };
  39201. EllipsoidGeometry.unpack = function(array, startingIndex, result) {
  39202. if (!defined_default(array)) {
  39203. throw new DeveloperError_default("array is required");
  39204. }
  39205. startingIndex = defaultValue_default(startingIndex, 0);
  39206. const radii = Cartesian3_default.unpack(array, startingIndex, scratchRadii);
  39207. startingIndex += Cartesian3_default.packedLength;
  39208. const innerRadii = Cartesian3_default.unpack(array, startingIndex, scratchInnerRadii);
  39209. startingIndex += Cartesian3_default.packedLength;
  39210. const vertexFormat = VertexFormat_default.unpack(
  39211. array,
  39212. startingIndex,
  39213. scratchVertexFormat6
  39214. );
  39215. startingIndex += VertexFormat_default.packedLength;
  39216. const minimumClock = array[startingIndex++];
  39217. const maximumClock = array[startingIndex++];
  39218. const minimumCone = array[startingIndex++];
  39219. const maximumCone = array[startingIndex++];
  39220. const stackPartitions = array[startingIndex++];
  39221. const slicePartitions = array[startingIndex++];
  39222. const offsetAttribute = array[startingIndex];
  39223. if (!defined_default(result)) {
  39224. scratchOptions13.minimumClock = minimumClock;
  39225. scratchOptions13.maximumClock = maximumClock;
  39226. scratchOptions13.minimumCone = minimumCone;
  39227. scratchOptions13.maximumCone = maximumCone;
  39228. scratchOptions13.stackPartitions = stackPartitions;
  39229. scratchOptions13.slicePartitions = slicePartitions;
  39230. scratchOptions13.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  39231. return new EllipsoidGeometry(scratchOptions13);
  39232. }
  39233. result._radii = Cartesian3_default.clone(radii, result._radii);
  39234. result._innerRadii = Cartesian3_default.clone(innerRadii, result._innerRadii);
  39235. result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
  39236. result._minimumClock = minimumClock;
  39237. result._maximumClock = maximumClock;
  39238. result._minimumCone = minimumCone;
  39239. result._maximumCone = maximumCone;
  39240. result._stackPartitions = stackPartitions;
  39241. result._slicePartitions = slicePartitions;
  39242. result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  39243. return result;
  39244. };
  39245. EllipsoidGeometry.createGeometry = function(ellipsoidGeometry) {
  39246. const radii = ellipsoidGeometry._radii;
  39247. if (radii.x <= 0 || radii.y <= 0 || radii.z <= 0) {
  39248. return;
  39249. }
  39250. const innerRadii = ellipsoidGeometry._innerRadii;
  39251. if (innerRadii.x <= 0 || innerRadii.y <= 0 || innerRadii.z <= 0) {
  39252. return;
  39253. }
  39254. const minimumClock = ellipsoidGeometry._minimumClock;
  39255. const maximumClock = ellipsoidGeometry._maximumClock;
  39256. const minimumCone = ellipsoidGeometry._minimumCone;
  39257. const maximumCone = ellipsoidGeometry._maximumCone;
  39258. const vertexFormat = ellipsoidGeometry._vertexFormat;
  39259. let slicePartitions = ellipsoidGeometry._slicePartitions + 1;
  39260. let stackPartitions = ellipsoidGeometry._stackPartitions + 1;
  39261. slicePartitions = Math.round(
  39262. slicePartitions * Math.abs(maximumClock - minimumClock) / Math_default.TWO_PI
  39263. );
  39264. stackPartitions = Math.round(
  39265. stackPartitions * Math.abs(maximumCone - minimumCone) / Math_default.PI
  39266. );
  39267. if (slicePartitions < 2) {
  39268. slicePartitions = 2;
  39269. }
  39270. if (stackPartitions < 2) {
  39271. stackPartitions = 2;
  39272. }
  39273. let i2;
  39274. let j;
  39275. let index2 = 0;
  39276. const phis = [minimumCone];
  39277. const thetas = [minimumClock];
  39278. for (i2 = 0; i2 < stackPartitions; i2++) {
  39279. phis.push(
  39280. minimumCone + i2 * (maximumCone - minimumCone) / (stackPartitions - 1)
  39281. );
  39282. }
  39283. phis.push(maximumCone);
  39284. for (j = 0; j < slicePartitions; j++) {
  39285. thetas.push(
  39286. minimumClock + j * (maximumClock - minimumClock) / (slicePartitions - 1)
  39287. );
  39288. }
  39289. thetas.push(maximumClock);
  39290. const numPhis = phis.length;
  39291. const numThetas = thetas.length;
  39292. let extraIndices = 0;
  39293. let vertexMultiplier = 1;
  39294. const hasInnerSurface = innerRadii.x !== radii.x || innerRadii.y !== radii.y || innerRadii.z !== radii.z;
  39295. let isTopOpen = false;
  39296. let isBotOpen = false;
  39297. let isClockOpen = false;
  39298. if (hasInnerSurface) {
  39299. vertexMultiplier = 2;
  39300. if (minimumCone > 0) {
  39301. isTopOpen = true;
  39302. extraIndices += slicePartitions - 1;
  39303. }
  39304. if (maximumCone < Math.PI) {
  39305. isBotOpen = true;
  39306. extraIndices += slicePartitions - 1;
  39307. }
  39308. if ((maximumClock - minimumClock) % Math_default.TWO_PI) {
  39309. isClockOpen = true;
  39310. extraIndices += (stackPartitions - 1) * 2 + 1;
  39311. } else {
  39312. extraIndices += 1;
  39313. }
  39314. }
  39315. const vertexCount = numThetas * numPhis * vertexMultiplier;
  39316. const positions = new Float64Array(vertexCount * 3);
  39317. const isInner = arrayFill_default(new Array(vertexCount), false);
  39318. const negateNormal = arrayFill_default(new Array(vertexCount), false);
  39319. const indexCount = slicePartitions * stackPartitions * vertexMultiplier;
  39320. const numIndices = 6 * (indexCount + extraIndices + 1 - (slicePartitions + stackPartitions) * vertexMultiplier);
  39321. const indices2 = IndexDatatype_default.createTypedArray(indexCount, numIndices);
  39322. const normals = vertexFormat.normal ? new Float32Array(vertexCount * 3) : void 0;
  39323. const tangents = vertexFormat.tangent ? new Float32Array(vertexCount * 3) : void 0;
  39324. const bitangents = vertexFormat.bitangent ? new Float32Array(vertexCount * 3) : void 0;
  39325. const st = vertexFormat.st ? new Float32Array(vertexCount * 2) : void 0;
  39326. const sinPhi = new Array(numPhis);
  39327. const cosPhi = new Array(numPhis);
  39328. for (i2 = 0; i2 < numPhis; i2++) {
  39329. sinPhi[i2] = sin(phis[i2]);
  39330. cosPhi[i2] = cos(phis[i2]);
  39331. }
  39332. const sinTheta = new Array(numThetas);
  39333. const cosTheta = new Array(numThetas);
  39334. for (j = 0; j < numThetas; j++) {
  39335. cosTheta[j] = cos(thetas[j]);
  39336. sinTheta[j] = sin(thetas[j]);
  39337. }
  39338. for (i2 = 0; i2 < numPhis; i2++) {
  39339. for (j = 0; j < numThetas; j++) {
  39340. positions[index2++] = radii.x * sinPhi[i2] * cosTheta[j];
  39341. positions[index2++] = radii.y * sinPhi[i2] * sinTheta[j];
  39342. positions[index2++] = radii.z * cosPhi[i2];
  39343. }
  39344. }
  39345. let vertexIndex = vertexCount / 2;
  39346. if (hasInnerSurface) {
  39347. for (i2 = 0; i2 < numPhis; i2++) {
  39348. for (j = 0; j < numThetas; j++) {
  39349. positions[index2++] = innerRadii.x * sinPhi[i2] * cosTheta[j];
  39350. positions[index2++] = innerRadii.y * sinPhi[i2] * sinTheta[j];
  39351. positions[index2++] = innerRadii.z * cosPhi[i2];
  39352. isInner[vertexIndex] = true;
  39353. if (i2 > 0 && i2 !== numPhis - 1 && j !== 0 && j !== numThetas - 1) {
  39354. negateNormal[vertexIndex] = true;
  39355. }
  39356. vertexIndex++;
  39357. }
  39358. }
  39359. }
  39360. index2 = 0;
  39361. let topOffset;
  39362. let bottomOffset;
  39363. for (i2 = 1; i2 < numPhis - 2; i2++) {
  39364. topOffset = i2 * numThetas;
  39365. bottomOffset = (i2 + 1) * numThetas;
  39366. for (j = 1; j < numThetas - 2; j++) {
  39367. indices2[index2++] = bottomOffset + j;
  39368. indices2[index2++] = bottomOffset + j + 1;
  39369. indices2[index2++] = topOffset + j + 1;
  39370. indices2[index2++] = bottomOffset + j;
  39371. indices2[index2++] = topOffset + j + 1;
  39372. indices2[index2++] = topOffset + j;
  39373. }
  39374. }
  39375. if (hasInnerSurface) {
  39376. const offset2 = numPhis * numThetas;
  39377. for (i2 = 1; i2 < numPhis - 2; i2++) {
  39378. topOffset = offset2 + i2 * numThetas;
  39379. bottomOffset = offset2 + (i2 + 1) * numThetas;
  39380. for (j = 1; j < numThetas - 2; j++) {
  39381. indices2[index2++] = bottomOffset + j;
  39382. indices2[index2++] = topOffset + j;
  39383. indices2[index2++] = topOffset + j + 1;
  39384. indices2[index2++] = bottomOffset + j;
  39385. indices2[index2++] = topOffset + j + 1;
  39386. indices2[index2++] = bottomOffset + j + 1;
  39387. }
  39388. }
  39389. }
  39390. let outerOffset;
  39391. let innerOffset;
  39392. if (hasInnerSurface) {
  39393. if (isTopOpen) {
  39394. innerOffset = numPhis * numThetas;
  39395. for (i2 = 1; i2 < numThetas - 2; i2++) {
  39396. indices2[index2++] = i2;
  39397. indices2[index2++] = i2 + 1;
  39398. indices2[index2++] = innerOffset + i2 + 1;
  39399. indices2[index2++] = i2;
  39400. indices2[index2++] = innerOffset + i2 + 1;
  39401. indices2[index2++] = innerOffset + i2;
  39402. }
  39403. }
  39404. if (isBotOpen) {
  39405. outerOffset = numPhis * numThetas - numThetas;
  39406. innerOffset = numPhis * numThetas * vertexMultiplier - numThetas;
  39407. for (i2 = 1; i2 < numThetas - 2; i2++) {
  39408. indices2[index2++] = outerOffset + i2 + 1;
  39409. indices2[index2++] = outerOffset + i2;
  39410. indices2[index2++] = innerOffset + i2;
  39411. indices2[index2++] = outerOffset + i2 + 1;
  39412. indices2[index2++] = innerOffset + i2;
  39413. indices2[index2++] = innerOffset + i2 + 1;
  39414. }
  39415. }
  39416. }
  39417. if (isClockOpen) {
  39418. for (i2 = 1; i2 < numPhis - 2; i2++) {
  39419. innerOffset = numThetas * numPhis + numThetas * i2;
  39420. outerOffset = numThetas * i2;
  39421. indices2[index2++] = innerOffset;
  39422. indices2[index2++] = outerOffset + numThetas;
  39423. indices2[index2++] = outerOffset;
  39424. indices2[index2++] = innerOffset;
  39425. indices2[index2++] = innerOffset + numThetas;
  39426. indices2[index2++] = outerOffset + numThetas;
  39427. }
  39428. for (i2 = 1; i2 < numPhis - 2; i2++) {
  39429. innerOffset = numThetas * numPhis + numThetas * (i2 + 1) - 1;
  39430. outerOffset = numThetas * (i2 + 1) - 1;
  39431. indices2[index2++] = outerOffset + numThetas;
  39432. indices2[index2++] = innerOffset;
  39433. indices2[index2++] = outerOffset;
  39434. indices2[index2++] = outerOffset + numThetas;
  39435. indices2[index2++] = innerOffset + numThetas;
  39436. indices2[index2++] = innerOffset;
  39437. }
  39438. }
  39439. const attributes = new GeometryAttributes_default();
  39440. if (vertexFormat.position) {
  39441. attributes.position = new GeometryAttribute_default({
  39442. componentDatatype: ComponentDatatype_default.DOUBLE,
  39443. componentsPerAttribute: 3,
  39444. values: positions
  39445. });
  39446. }
  39447. let stIndex = 0;
  39448. let normalIndex = 0;
  39449. let tangentIndex = 0;
  39450. let bitangentIndex = 0;
  39451. const vertexCountHalf = vertexCount / 2;
  39452. let ellipsoid;
  39453. const ellipsoidOuter = Ellipsoid_default.fromCartesian3(radii);
  39454. const ellipsoidInner = Ellipsoid_default.fromCartesian3(innerRadii);
  39455. if (vertexFormat.st || vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent) {
  39456. for (i2 = 0; i2 < vertexCount; i2++) {
  39457. ellipsoid = isInner[i2] ? ellipsoidInner : ellipsoidOuter;
  39458. const position = Cartesian3_default.fromArray(positions, i2 * 3, scratchPosition3);
  39459. const normal2 = ellipsoid.geodeticSurfaceNormal(position, scratchNormal5);
  39460. if (negateNormal[i2]) {
  39461. Cartesian3_default.negate(normal2, normal2);
  39462. }
  39463. if (vertexFormat.st) {
  39464. const normalST = Cartesian2_default.negate(normal2, scratchNormalST);
  39465. st[stIndex++] = Math.atan2(normalST.y, normalST.x) / Math_default.TWO_PI + 0.5;
  39466. st[stIndex++] = Math.asin(normal2.z) / Math.PI + 0.5;
  39467. }
  39468. if (vertexFormat.normal) {
  39469. normals[normalIndex++] = normal2.x;
  39470. normals[normalIndex++] = normal2.y;
  39471. normals[normalIndex++] = normal2.z;
  39472. }
  39473. if (vertexFormat.tangent || vertexFormat.bitangent) {
  39474. const tangent = scratchTangent3;
  39475. let tangetOffset = 0;
  39476. let unit;
  39477. if (isInner[i2]) {
  39478. tangetOffset = vertexCountHalf;
  39479. }
  39480. if (!isTopOpen && i2 >= tangetOffset && i2 < tangetOffset + numThetas * 2) {
  39481. unit = Cartesian3_default.UNIT_X;
  39482. } else {
  39483. unit = Cartesian3_default.UNIT_Z;
  39484. }
  39485. Cartesian3_default.cross(unit, normal2, tangent);
  39486. Cartesian3_default.normalize(tangent, tangent);
  39487. if (vertexFormat.tangent) {
  39488. tangents[tangentIndex++] = tangent.x;
  39489. tangents[tangentIndex++] = tangent.y;
  39490. tangents[tangentIndex++] = tangent.z;
  39491. }
  39492. if (vertexFormat.bitangent) {
  39493. const bitangent = Cartesian3_default.cross(normal2, tangent, scratchBitangent3);
  39494. Cartesian3_default.normalize(bitangent, bitangent);
  39495. bitangents[bitangentIndex++] = bitangent.x;
  39496. bitangents[bitangentIndex++] = bitangent.y;
  39497. bitangents[bitangentIndex++] = bitangent.z;
  39498. }
  39499. }
  39500. }
  39501. if (vertexFormat.st) {
  39502. attributes.st = new GeometryAttribute_default({
  39503. componentDatatype: ComponentDatatype_default.FLOAT,
  39504. componentsPerAttribute: 2,
  39505. values: st
  39506. });
  39507. }
  39508. if (vertexFormat.normal) {
  39509. attributes.normal = new GeometryAttribute_default({
  39510. componentDatatype: ComponentDatatype_default.FLOAT,
  39511. componentsPerAttribute: 3,
  39512. values: normals
  39513. });
  39514. }
  39515. if (vertexFormat.tangent) {
  39516. attributes.tangent = new GeometryAttribute_default({
  39517. componentDatatype: ComponentDatatype_default.FLOAT,
  39518. componentsPerAttribute: 3,
  39519. values: tangents
  39520. });
  39521. }
  39522. if (vertexFormat.bitangent) {
  39523. attributes.bitangent = new GeometryAttribute_default({
  39524. componentDatatype: ComponentDatatype_default.FLOAT,
  39525. componentsPerAttribute: 3,
  39526. values: bitangents
  39527. });
  39528. }
  39529. }
  39530. if (defined_default(ellipsoidGeometry._offsetAttribute)) {
  39531. const length3 = positions.length;
  39532. const applyOffset = new Uint8Array(length3 / 3);
  39533. const offsetValue = ellipsoidGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  39534. arrayFill_default(applyOffset, offsetValue);
  39535. attributes.applyOffset = new GeometryAttribute_default({
  39536. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  39537. componentsPerAttribute: 1,
  39538. values: applyOffset
  39539. });
  39540. }
  39541. return new Geometry_default({
  39542. attributes,
  39543. indices: indices2,
  39544. primitiveType: PrimitiveType_default.TRIANGLES,
  39545. boundingSphere: BoundingSphere_default.fromEllipsoid(ellipsoidOuter),
  39546. offsetAttribute: ellipsoidGeometry._offsetAttribute
  39547. });
  39548. };
  39549. var unitEllipsoidGeometry;
  39550. EllipsoidGeometry.getUnitEllipsoid = function() {
  39551. if (!defined_default(unitEllipsoidGeometry)) {
  39552. unitEllipsoidGeometry = EllipsoidGeometry.createGeometry(
  39553. new EllipsoidGeometry({
  39554. radii: new Cartesian3_default(1, 1, 1),
  39555. vertexFormat: VertexFormat_default.POSITION_ONLY
  39556. })
  39557. );
  39558. }
  39559. return unitEllipsoidGeometry;
  39560. };
  39561. var EllipsoidGeometry_default = EllipsoidGeometry;
  39562. // node_modules/cesium/Source/Core/EllipsoidOutlineGeometry.js
  39563. var defaultRadii2 = new Cartesian3_default(1, 1, 1);
  39564. var cos2 = Math.cos;
  39565. var sin2 = Math.sin;
  39566. function EllipsoidOutlineGeometry(options) {
  39567. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  39568. const radii = defaultValue_default(options.radii, defaultRadii2);
  39569. const innerRadii = defaultValue_default(options.innerRadii, radii);
  39570. const minimumClock = defaultValue_default(options.minimumClock, 0);
  39571. const maximumClock = defaultValue_default(options.maximumClock, Math_default.TWO_PI);
  39572. const minimumCone = defaultValue_default(options.minimumCone, 0);
  39573. const maximumCone = defaultValue_default(options.maximumCone, Math_default.PI);
  39574. const stackPartitions = Math.round(defaultValue_default(options.stackPartitions, 10));
  39575. const slicePartitions = Math.round(defaultValue_default(options.slicePartitions, 8));
  39576. const subdivisions = Math.round(defaultValue_default(options.subdivisions, 128));
  39577. if (stackPartitions < 1) {
  39578. throw new DeveloperError_default("options.stackPartitions cannot be less than 1");
  39579. }
  39580. if (slicePartitions < 0) {
  39581. throw new DeveloperError_default("options.slicePartitions cannot be less than 0");
  39582. }
  39583. if (subdivisions < 0) {
  39584. throw new DeveloperError_default(
  39585. "options.subdivisions must be greater than or equal to zero."
  39586. );
  39587. }
  39588. if (defined_default(options.offsetAttribute) && options.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
  39589. throw new DeveloperError_default(
  39590. "GeometryOffsetAttribute.TOP is not a supported options.offsetAttribute for this geometry."
  39591. );
  39592. }
  39593. this._radii = Cartesian3_default.clone(radii);
  39594. this._innerRadii = Cartesian3_default.clone(innerRadii);
  39595. this._minimumClock = minimumClock;
  39596. this._maximumClock = maximumClock;
  39597. this._minimumCone = minimumCone;
  39598. this._maximumCone = maximumCone;
  39599. this._stackPartitions = stackPartitions;
  39600. this._slicePartitions = slicePartitions;
  39601. this._subdivisions = subdivisions;
  39602. this._offsetAttribute = options.offsetAttribute;
  39603. this._workerName = "createEllipsoidOutlineGeometry";
  39604. }
  39605. EllipsoidOutlineGeometry.packedLength = 2 * Cartesian3_default.packedLength + 8;
  39606. EllipsoidOutlineGeometry.pack = function(value, array, startingIndex) {
  39607. if (!defined_default(value)) {
  39608. throw new DeveloperError_default("value is required");
  39609. }
  39610. if (!defined_default(array)) {
  39611. throw new DeveloperError_default("array is required");
  39612. }
  39613. startingIndex = defaultValue_default(startingIndex, 0);
  39614. Cartesian3_default.pack(value._radii, array, startingIndex);
  39615. startingIndex += Cartesian3_default.packedLength;
  39616. Cartesian3_default.pack(value._innerRadii, array, startingIndex);
  39617. startingIndex += Cartesian3_default.packedLength;
  39618. array[startingIndex++] = value._minimumClock;
  39619. array[startingIndex++] = value._maximumClock;
  39620. array[startingIndex++] = value._minimumCone;
  39621. array[startingIndex++] = value._maximumCone;
  39622. array[startingIndex++] = value._stackPartitions;
  39623. array[startingIndex++] = value._slicePartitions;
  39624. array[startingIndex++] = value._subdivisions;
  39625. array[startingIndex] = defaultValue_default(value._offsetAttribute, -1);
  39626. return array;
  39627. };
  39628. var scratchRadii2 = new Cartesian3_default();
  39629. var scratchInnerRadii2 = new Cartesian3_default();
  39630. var scratchOptions14 = {
  39631. radii: scratchRadii2,
  39632. innerRadii: scratchInnerRadii2,
  39633. minimumClock: void 0,
  39634. maximumClock: void 0,
  39635. minimumCone: void 0,
  39636. maximumCone: void 0,
  39637. stackPartitions: void 0,
  39638. slicePartitions: void 0,
  39639. subdivisions: void 0,
  39640. offsetAttribute: void 0
  39641. };
  39642. EllipsoidOutlineGeometry.unpack = function(array, startingIndex, result) {
  39643. if (!defined_default(array)) {
  39644. throw new DeveloperError_default("array is required");
  39645. }
  39646. startingIndex = defaultValue_default(startingIndex, 0);
  39647. const radii = Cartesian3_default.unpack(array, startingIndex, scratchRadii2);
  39648. startingIndex += Cartesian3_default.packedLength;
  39649. const innerRadii = Cartesian3_default.unpack(array, startingIndex, scratchInnerRadii2);
  39650. startingIndex += Cartesian3_default.packedLength;
  39651. const minimumClock = array[startingIndex++];
  39652. const maximumClock = array[startingIndex++];
  39653. const minimumCone = array[startingIndex++];
  39654. const maximumCone = array[startingIndex++];
  39655. const stackPartitions = array[startingIndex++];
  39656. const slicePartitions = array[startingIndex++];
  39657. const subdivisions = array[startingIndex++];
  39658. const offsetAttribute = array[startingIndex];
  39659. if (!defined_default(result)) {
  39660. scratchOptions14.minimumClock = minimumClock;
  39661. scratchOptions14.maximumClock = maximumClock;
  39662. scratchOptions14.minimumCone = minimumCone;
  39663. scratchOptions14.maximumCone = maximumCone;
  39664. scratchOptions14.stackPartitions = stackPartitions;
  39665. scratchOptions14.slicePartitions = slicePartitions;
  39666. scratchOptions14.subdivisions = subdivisions;
  39667. scratchOptions14.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  39668. return new EllipsoidOutlineGeometry(scratchOptions14);
  39669. }
  39670. result._radii = Cartesian3_default.clone(radii, result._radii);
  39671. result._innerRadii = Cartesian3_default.clone(innerRadii, result._innerRadii);
  39672. result._minimumClock = minimumClock;
  39673. result._maximumClock = maximumClock;
  39674. result._minimumCone = minimumCone;
  39675. result._maximumCone = maximumCone;
  39676. result._stackPartitions = stackPartitions;
  39677. result._slicePartitions = slicePartitions;
  39678. result._subdivisions = subdivisions;
  39679. result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  39680. return result;
  39681. };
  39682. EllipsoidOutlineGeometry.createGeometry = function(ellipsoidGeometry) {
  39683. const radii = ellipsoidGeometry._radii;
  39684. if (radii.x <= 0 || radii.y <= 0 || radii.z <= 0) {
  39685. return;
  39686. }
  39687. const innerRadii = ellipsoidGeometry._innerRadii;
  39688. if (innerRadii.x <= 0 || innerRadii.y <= 0 || innerRadii.z <= 0) {
  39689. return;
  39690. }
  39691. const minimumClock = ellipsoidGeometry._minimumClock;
  39692. const maximumClock = ellipsoidGeometry._maximumClock;
  39693. const minimumCone = ellipsoidGeometry._minimumCone;
  39694. const maximumCone = ellipsoidGeometry._maximumCone;
  39695. const subdivisions = ellipsoidGeometry._subdivisions;
  39696. const ellipsoid = Ellipsoid_default.fromCartesian3(radii);
  39697. let slicePartitions = ellipsoidGeometry._slicePartitions + 1;
  39698. let stackPartitions = ellipsoidGeometry._stackPartitions + 1;
  39699. slicePartitions = Math.round(
  39700. slicePartitions * Math.abs(maximumClock - minimumClock) / Math_default.TWO_PI
  39701. );
  39702. stackPartitions = Math.round(
  39703. stackPartitions * Math.abs(maximumCone - minimumCone) / Math_default.PI
  39704. );
  39705. if (slicePartitions < 2) {
  39706. slicePartitions = 2;
  39707. }
  39708. if (stackPartitions < 2) {
  39709. stackPartitions = 2;
  39710. }
  39711. let extraIndices = 0;
  39712. let vertexMultiplier = 1;
  39713. const hasInnerSurface = innerRadii.x !== radii.x || innerRadii.y !== radii.y || innerRadii.z !== radii.z;
  39714. let isTopOpen = false;
  39715. let isBotOpen = false;
  39716. if (hasInnerSurface) {
  39717. vertexMultiplier = 2;
  39718. if (minimumCone > 0) {
  39719. isTopOpen = true;
  39720. extraIndices += slicePartitions;
  39721. }
  39722. if (maximumCone < Math.PI) {
  39723. isBotOpen = true;
  39724. extraIndices += slicePartitions;
  39725. }
  39726. }
  39727. const vertexCount = subdivisions * vertexMultiplier * (stackPartitions + slicePartitions);
  39728. const positions = new Float64Array(vertexCount * 3);
  39729. const numIndices = 2 * (vertexCount + extraIndices - (slicePartitions + stackPartitions) * vertexMultiplier);
  39730. const indices2 = IndexDatatype_default.createTypedArray(vertexCount, numIndices);
  39731. let i2;
  39732. let j;
  39733. let theta;
  39734. let phi;
  39735. let index2 = 0;
  39736. const sinPhi = new Array(stackPartitions);
  39737. const cosPhi = new Array(stackPartitions);
  39738. for (i2 = 0; i2 < stackPartitions; i2++) {
  39739. phi = minimumCone + i2 * (maximumCone - minimumCone) / (stackPartitions - 1);
  39740. sinPhi[i2] = sin2(phi);
  39741. cosPhi[i2] = cos2(phi);
  39742. }
  39743. const sinTheta = new Array(subdivisions);
  39744. const cosTheta = new Array(subdivisions);
  39745. for (i2 = 0; i2 < subdivisions; i2++) {
  39746. theta = minimumClock + i2 * (maximumClock - minimumClock) / (subdivisions - 1);
  39747. sinTheta[i2] = sin2(theta);
  39748. cosTheta[i2] = cos2(theta);
  39749. }
  39750. for (i2 = 0; i2 < stackPartitions; i2++) {
  39751. for (j = 0; j < subdivisions; j++) {
  39752. positions[index2++] = radii.x * sinPhi[i2] * cosTheta[j];
  39753. positions[index2++] = radii.y * sinPhi[i2] * sinTheta[j];
  39754. positions[index2++] = radii.z * cosPhi[i2];
  39755. }
  39756. }
  39757. if (hasInnerSurface) {
  39758. for (i2 = 0; i2 < stackPartitions; i2++) {
  39759. for (j = 0; j < subdivisions; j++) {
  39760. positions[index2++] = innerRadii.x * sinPhi[i2] * cosTheta[j];
  39761. positions[index2++] = innerRadii.y * sinPhi[i2] * sinTheta[j];
  39762. positions[index2++] = innerRadii.z * cosPhi[i2];
  39763. }
  39764. }
  39765. }
  39766. sinPhi.length = subdivisions;
  39767. cosPhi.length = subdivisions;
  39768. for (i2 = 0; i2 < subdivisions; i2++) {
  39769. phi = minimumCone + i2 * (maximumCone - minimumCone) / (subdivisions - 1);
  39770. sinPhi[i2] = sin2(phi);
  39771. cosPhi[i2] = cos2(phi);
  39772. }
  39773. sinTheta.length = slicePartitions;
  39774. cosTheta.length = slicePartitions;
  39775. for (i2 = 0; i2 < slicePartitions; i2++) {
  39776. theta = minimumClock + i2 * (maximumClock - minimumClock) / (slicePartitions - 1);
  39777. sinTheta[i2] = sin2(theta);
  39778. cosTheta[i2] = cos2(theta);
  39779. }
  39780. for (i2 = 0; i2 < subdivisions; i2++) {
  39781. for (j = 0; j < slicePartitions; j++) {
  39782. positions[index2++] = radii.x * sinPhi[i2] * cosTheta[j];
  39783. positions[index2++] = radii.y * sinPhi[i2] * sinTheta[j];
  39784. positions[index2++] = radii.z * cosPhi[i2];
  39785. }
  39786. }
  39787. if (hasInnerSurface) {
  39788. for (i2 = 0; i2 < subdivisions; i2++) {
  39789. for (j = 0; j < slicePartitions; j++) {
  39790. positions[index2++] = innerRadii.x * sinPhi[i2] * cosTheta[j];
  39791. positions[index2++] = innerRadii.y * sinPhi[i2] * sinTheta[j];
  39792. positions[index2++] = innerRadii.z * cosPhi[i2];
  39793. }
  39794. }
  39795. }
  39796. index2 = 0;
  39797. for (i2 = 0; i2 < stackPartitions * vertexMultiplier; i2++) {
  39798. const topOffset = i2 * subdivisions;
  39799. for (j = 0; j < subdivisions - 1; j++) {
  39800. indices2[index2++] = topOffset + j;
  39801. indices2[index2++] = topOffset + j + 1;
  39802. }
  39803. }
  39804. let offset2 = stackPartitions * subdivisions * vertexMultiplier;
  39805. for (i2 = 0; i2 < slicePartitions; i2++) {
  39806. for (j = 0; j < subdivisions - 1; j++) {
  39807. indices2[index2++] = offset2 + i2 + j * slicePartitions;
  39808. indices2[index2++] = offset2 + i2 + (j + 1) * slicePartitions;
  39809. }
  39810. }
  39811. if (hasInnerSurface) {
  39812. offset2 = stackPartitions * subdivisions * vertexMultiplier + slicePartitions * subdivisions;
  39813. for (i2 = 0; i2 < slicePartitions; i2++) {
  39814. for (j = 0; j < subdivisions - 1; j++) {
  39815. indices2[index2++] = offset2 + i2 + j * slicePartitions;
  39816. indices2[index2++] = offset2 + i2 + (j + 1) * slicePartitions;
  39817. }
  39818. }
  39819. }
  39820. if (hasInnerSurface) {
  39821. let outerOffset = stackPartitions * subdivisions * vertexMultiplier;
  39822. let innerOffset = outerOffset + subdivisions * slicePartitions;
  39823. if (isTopOpen) {
  39824. for (i2 = 0; i2 < slicePartitions; i2++) {
  39825. indices2[index2++] = outerOffset + i2;
  39826. indices2[index2++] = innerOffset + i2;
  39827. }
  39828. }
  39829. if (isBotOpen) {
  39830. outerOffset += subdivisions * slicePartitions - slicePartitions;
  39831. innerOffset += subdivisions * slicePartitions - slicePartitions;
  39832. for (i2 = 0; i2 < slicePartitions; i2++) {
  39833. indices2[index2++] = outerOffset + i2;
  39834. indices2[index2++] = innerOffset + i2;
  39835. }
  39836. }
  39837. }
  39838. const attributes = new GeometryAttributes_default({
  39839. position: new GeometryAttribute_default({
  39840. componentDatatype: ComponentDatatype_default.DOUBLE,
  39841. componentsPerAttribute: 3,
  39842. values: positions
  39843. })
  39844. });
  39845. if (defined_default(ellipsoidGeometry._offsetAttribute)) {
  39846. const length3 = positions.length;
  39847. const applyOffset = new Uint8Array(length3 / 3);
  39848. const offsetValue = ellipsoidGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  39849. arrayFill_default(applyOffset, offsetValue);
  39850. attributes.applyOffset = new GeometryAttribute_default({
  39851. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  39852. componentsPerAttribute: 1,
  39853. values: applyOffset
  39854. });
  39855. }
  39856. return new Geometry_default({
  39857. attributes,
  39858. indices: indices2,
  39859. primitiveType: PrimitiveType_default.LINES,
  39860. boundingSphere: BoundingSphere_default.fromEllipsoid(ellipsoid),
  39861. offsetAttribute: ellipsoidGeometry._offsetAttribute
  39862. });
  39863. };
  39864. var EllipsoidOutlineGeometry_default = EllipsoidOutlineGeometry;
  39865. // node_modules/cesium/Source/Core/EllipsoidTerrainProvider.js
  39866. function EllipsoidTerrainProvider(options) {
  39867. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  39868. this._tilingScheme = options.tilingScheme;
  39869. if (!defined_default(this._tilingScheme)) {
  39870. this._tilingScheme = new GeographicTilingScheme_default({
  39871. ellipsoid: defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84)
  39872. });
  39873. }
  39874. this._levelZeroMaximumGeometricError = TerrainProvider_default.getEstimatedLevelZeroGeometricErrorForAHeightmap(
  39875. this._tilingScheme.ellipsoid,
  39876. 64,
  39877. this._tilingScheme.getNumberOfXTilesAtLevel(0)
  39878. );
  39879. this._errorEvent = new Event_default();
  39880. this._readyPromise = Promise.resolve(true);
  39881. }
  39882. Object.defineProperties(EllipsoidTerrainProvider.prototype, {
  39883. errorEvent: {
  39884. get: function() {
  39885. return this._errorEvent;
  39886. }
  39887. },
  39888. credit: {
  39889. get: function() {
  39890. return void 0;
  39891. }
  39892. },
  39893. tilingScheme: {
  39894. get: function() {
  39895. return this._tilingScheme;
  39896. }
  39897. },
  39898. ready: {
  39899. get: function() {
  39900. return true;
  39901. }
  39902. },
  39903. readyPromise: {
  39904. get: function() {
  39905. return this._readyPromise;
  39906. }
  39907. },
  39908. hasWaterMask: {
  39909. get: function() {
  39910. return false;
  39911. }
  39912. },
  39913. hasVertexNormals: {
  39914. get: function() {
  39915. return false;
  39916. }
  39917. },
  39918. availability: {
  39919. get: function() {
  39920. return void 0;
  39921. }
  39922. }
  39923. });
  39924. EllipsoidTerrainProvider.prototype.requestTileGeometry = function(x, y, level, request) {
  39925. const width = 16;
  39926. const height = 16;
  39927. return Promise.resolve(
  39928. new HeightmapTerrainData_default({
  39929. buffer: new Uint8Array(width * height),
  39930. width,
  39931. height
  39932. })
  39933. );
  39934. };
  39935. EllipsoidTerrainProvider.prototype.getLevelMaximumGeometricError = function(level) {
  39936. return this._levelZeroMaximumGeometricError / (1 << level);
  39937. };
  39938. EllipsoidTerrainProvider.prototype.getTileDataAvailable = function(x, y, level) {
  39939. return void 0;
  39940. };
  39941. EllipsoidTerrainProvider.prototype.loadTileDataAvailability = function(x, y, level) {
  39942. return void 0;
  39943. };
  39944. var EllipsoidTerrainProvider_default = EllipsoidTerrainProvider;
  39945. // node_modules/cesium/Source/Core/EventHelper.js
  39946. function EventHelper() {
  39947. this._removalFunctions = [];
  39948. }
  39949. EventHelper.prototype.add = function(event, listener, scope) {
  39950. if (!defined_default(event)) {
  39951. throw new DeveloperError_default("event is required");
  39952. }
  39953. const removalFunction = event.addEventListener(listener, scope);
  39954. this._removalFunctions.push(removalFunction);
  39955. const that = this;
  39956. return function() {
  39957. removalFunction();
  39958. const removalFunctions = that._removalFunctions;
  39959. removalFunctions.splice(removalFunctions.indexOf(removalFunction), 1);
  39960. };
  39961. };
  39962. EventHelper.prototype.removeAll = function() {
  39963. const removalFunctions = this._removalFunctions;
  39964. for (let i2 = 0, len = removalFunctions.length; i2 < len; ++i2) {
  39965. removalFunctions[i2]();
  39966. }
  39967. removalFunctions.length = 0;
  39968. };
  39969. var EventHelper_default = EventHelper;
  39970. // node_modules/cesium/Source/Core/ExperimentalFeatures.js
  39971. var ExperimentalFeatures = {
  39972. enableModelExperimental: false
  39973. };
  39974. var ExperimentalFeatures_default = ExperimentalFeatures;
  39975. // node_modules/cesium/Source/Core/ExtrapolationType.js
  39976. var ExtrapolationType = {
  39977. NONE: 0,
  39978. HOLD: 1,
  39979. EXTRAPOLATE: 2
  39980. };
  39981. var ExtrapolationType_default = Object.freeze(ExtrapolationType);
  39982. // node_modules/cesium/Source/Core/OrthographicOffCenterFrustum.js
  39983. function OrthographicOffCenterFrustum(options) {
  39984. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  39985. this.left = options.left;
  39986. this._left = void 0;
  39987. this.right = options.right;
  39988. this._right = void 0;
  39989. this.top = options.top;
  39990. this._top = void 0;
  39991. this.bottom = options.bottom;
  39992. this._bottom = void 0;
  39993. this.near = defaultValue_default(options.near, 1);
  39994. this._near = this.near;
  39995. this.far = defaultValue_default(options.far, 5e8);
  39996. this._far = this.far;
  39997. this._cullingVolume = new CullingVolume_default();
  39998. this._orthographicMatrix = new Matrix4_default();
  39999. }
  40000. function update(frustum) {
  40001. if (!defined_default(frustum.right) || !defined_default(frustum.left) || !defined_default(frustum.top) || !defined_default(frustum.bottom) || !defined_default(frustum.near) || !defined_default(frustum.far)) {
  40002. throw new DeveloperError_default(
  40003. "right, left, top, bottom, near, or far parameters are not set."
  40004. );
  40005. }
  40006. if (frustum.top !== frustum._top || frustum.bottom !== frustum._bottom || frustum.left !== frustum._left || frustum.right !== frustum._right || frustum.near !== frustum._near || frustum.far !== frustum._far) {
  40007. if (frustum.left > frustum.right) {
  40008. throw new DeveloperError_default("right must be greater than left.");
  40009. }
  40010. if (frustum.bottom > frustum.top) {
  40011. throw new DeveloperError_default("top must be greater than bottom.");
  40012. }
  40013. if (frustum.near <= 0 || frustum.near > frustum.far) {
  40014. throw new DeveloperError_default(
  40015. "near must be greater than zero and less than far."
  40016. );
  40017. }
  40018. frustum._left = frustum.left;
  40019. frustum._right = frustum.right;
  40020. frustum._top = frustum.top;
  40021. frustum._bottom = frustum.bottom;
  40022. frustum._near = frustum.near;
  40023. frustum._far = frustum.far;
  40024. frustum._orthographicMatrix = Matrix4_default.computeOrthographicOffCenter(
  40025. frustum.left,
  40026. frustum.right,
  40027. frustum.bottom,
  40028. frustum.top,
  40029. frustum.near,
  40030. frustum.far,
  40031. frustum._orthographicMatrix
  40032. );
  40033. }
  40034. }
  40035. Object.defineProperties(OrthographicOffCenterFrustum.prototype, {
  40036. projectionMatrix: {
  40037. get: function() {
  40038. update(this);
  40039. return this._orthographicMatrix;
  40040. }
  40041. }
  40042. });
  40043. var getPlanesRight = new Cartesian3_default();
  40044. var getPlanesNearCenter = new Cartesian3_default();
  40045. var getPlanesPoint = new Cartesian3_default();
  40046. var negateScratch = new Cartesian3_default();
  40047. OrthographicOffCenterFrustum.prototype.computeCullingVolume = function(position, direction2, up) {
  40048. if (!defined_default(position)) {
  40049. throw new DeveloperError_default("position is required.");
  40050. }
  40051. if (!defined_default(direction2)) {
  40052. throw new DeveloperError_default("direction is required.");
  40053. }
  40054. if (!defined_default(up)) {
  40055. throw new DeveloperError_default("up is required.");
  40056. }
  40057. const planes = this._cullingVolume.planes;
  40058. const t = this.top;
  40059. const b = this.bottom;
  40060. const r2 = this.right;
  40061. const l2 = this.left;
  40062. const n2 = this.near;
  40063. const f2 = this.far;
  40064. const right = Cartesian3_default.cross(direction2, up, getPlanesRight);
  40065. Cartesian3_default.normalize(right, right);
  40066. const nearCenter = getPlanesNearCenter;
  40067. Cartesian3_default.multiplyByScalar(direction2, n2, nearCenter);
  40068. Cartesian3_default.add(position, nearCenter, nearCenter);
  40069. const point = getPlanesPoint;
  40070. Cartesian3_default.multiplyByScalar(right, l2, point);
  40071. Cartesian3_default.add(nearCenter, point, point);
  40072. let plane = planes[0];
  40073. if (!defined_default(plane)) {
  40074. plane = planes[0] = new Cartesian4_default();
  40075. }
  40076. plane.x = right.x;
  40077. plane.y = right.y;
  40078. plane.z = right.z;
  40079. plane.w = -Cartesian3_default.dot(right, point);
  40080. Cartesian3_default.multiplyByScalar(right, r2, point);
  40081. Cartesian3_default.add(nearCenter, point, point);
  40082. plane = planes[1];
  40083. if (!defined_default(plane)) {
  40084. plane = planes[1] = new Cartesian4_default();
  40085. }
  40086. plane.x = -right.x;
  40087. plane.y = -right.y;
  40088. plane.z = -right.z;
  40089. plane.w = -Cartesian3_default.dot(Cartesian3_default.negate(right, negateScratch), point);
  40090. Cartesian3_default.multiplyByScalar(up, b, point);
  40091. Cartesian3_default.add(nearCenter, point, point);
  40092. plane = planes[2];
  40093. if (!defined_default(plane)) {
  40094. plane = planes[2] = new Cartesian4_default();
  40095. }
  40096. plane.x = up.x;
  40097. plane.y = up.y;
  40098. plane.z = up.z;
  40099. plane.w = -Cartesian3_default.dot(up, point);
  40100. Cartesian3_default.multiplyByScalar(up, t, point);
  40101. Cartesian3_default.add(nearCenter, point, point);
  40102. plane = planes[3];
  40103. if (!defined_default(plane)) {
  40104. plane = planes[3] = new Cartesian4_default();
  40105. }
  40106. plane.x = -up.x;
  40107. plane.y = -up.y;
  40108. plane.z = -up.z;
  40109. plane.w = -Cartesian3_default.dot(Cartesian3_default.negate(up, negateScratch), point);
  40110. plane = planes[4];
  40111. if (!defined_default(plane)) {
  40112. plane = planes[4] = new Cartesian4_default();
  40113. }
  40114. plane.x = direction2.x;
  40115. plane.y = direction2.y;
  40116. plane.z = direction2.z;
  40117. plane.w = -Cartesian3_default.dot(direction2, nearCenter);
  40118. Cartesian3_default.multiplyByScalar(direction2, f2, point);
  40119. Cartesian3_default.add(position, point, point);
  40120. plane = planes[5];
  40121. if (!defined_default(plane)) {
  40122. plane = planes[5] = new Cartesian4_default();
  40123. }
  40124. plane.x = -direction2.x;
  40125. plane.y = -direction2.y;
  40126. plane.z = -direction2.z;
  40127. plane.w = -Cartesian3_default.dot(Cartesian3_default.negate(direction2, negateScratch), point);
  40128. return this._cullingVolume;
  40129. };
  40130. OrthographicOffCenterFrustum.prototype.getPixelDimensions = function(drawingBufferWidth, drawingBufferHeight, distance2, pixelRatio, result) {
  40131. update(this);
  40132. if (!defined_default(drawingBufferWidth) || !defined_default(drawingBufferHeight)) {
  40133. throw new DeveloperError_default(
  40134. "Both drawingBufferWidth and drawingBufferHeight are required."
  40135. );
  40136. }
  40137. if (drawingBufferWidth <= 0) {
  40138. throw new DeveloperError_default("drawingBufferWidth must be greater than zero.");
  40139. }
  40140. if (drawingBufferHeight <= 0) {
  40141. throw new DeveloperError_default("drawingBufferHeight must be greater than zero.");
  40142. }
  40143. if (!defined_default(distance2)) {
  40144. throw new DeveloperError_default("distance is required.");
  40145. }
  40146. if (!defined_default(pixelRatio)) {
  40147. throw new DeveloperError_default("pixelRatio is required.");
  40148. }
  40149. if (pixelRatio <= 0) {
  40150. throw new DeveloperError_default("pixelRatio must be greater than zero.");
  40151. }
  40152. if (!defined_default(result)) {
  40153. throw new DeveloperError_default("A result object is required.");
  40154. }
  40155. const frustumWidth = this.right - this.left;
  40156. const frustumHeight = this.top - this.bottom;
  40157. const pixelWidth = pixelRatio * frustumWidth / drawingBufferWidth;
  40158. const pixelHeight = pixelRatio * frustumHeight / drawingBufferHeight;
  40159. result.x = pixelWidth;
  40160. result.y = pixelHeight;
  40161. return result;
  40162. };
  40163. OrthographicOffCenterFrustum.prototype.clone = function(result) {
  40164. if (!defined_default(result)) {
  40165. result = new OrthographicOffCenterFrustum();
  40166. }
  40167. result.left = this.left;
  40168. result.right = this.right;
  40169. result.top = this.top;
  40170. result.bottom = this.bottom;
  40171. result.near = this.near;
  40172. result.far = this.far;
  40173. result._left = void 0;
  40174. result._right = void 0;
  40175. result._top = void 0;
  40176. result._bottom = void 0;
  40177. result._near = void 0;
  40178. result._far = void 0;
  40179. return result;
  40180. };
  40181. OrthographicOffCenterFrustum.prototype.equals = function(other) {
  40182. return defined_default(other) && other instanceof OrthographicOffCenterFrustum && this.right === other.right && this.left === other.left && this.top === other.top && this.bottom === other.bottom && this.near === other.near && this.far === other.far;
  40183. };
  40184. OrthographicOffCenterFrustum.prototype.equalsEpsilon = function(other, relativeEpsilon, absoluteEpsilon) {
  40185. return other === this || defined_default(other) && other instanceof OrthographicOffCenterFrustum && Math_default.equalsEpsilon(
  40186. this.right,
  40187. other.right,
  40188. relativeEpsilon,
  40189. absoluteEpsilon
  40190. ) && Math_default.equalsEpsilon(
  40191. this.left,
  40192. other.left,
  40193. relativeEpsilon,
  40194. absoluteEpsilon
  40195. ) && Math_default.equalsEpsilon(
  40196. this.top,
  40197. other.top,
  40198. relativeEpsilon,
  40199. absoluteEpsilon
  40200. ) && Math_default.equalsEpsilon(
  40201. this.bottom,
  40202. other.bottom,
  40203. relativeEpsilon,
  40204. absoluteEpsilon
  40205. ) && Math_default.equalsEpsilon(
  40206. this.near,
  40207. other.near,
  40208. relativeEpsilon,
  40209. absoluteEpsilon
  40210. ) && Math_default.equalsEpsilon(
  40211. this.far,
  40212. other.far,
  40213. relativeEpsilon,
  40214. absoluteEpsilon
  40215. );
  40216. };
  40217. var OrthographicOffCenterFrustum_default = OrthographicOffCenterFrustum;
  40218. // node_modules/cesium/Source/Core/OrthographicFrustum.js
  40219. function OrthographicFrustum(options) {
  40220. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  40221. this._offCenterFrustum = new OrthographicOffCenterFrustum_default();
  40222. this.width = options.width;
  40223. this._width = void 0;
  40224. this.aspectRatio = options.aspectRatio;
  40225. this._aspectRatio = void 0;
  40226. this.near = defaultValue_default(options.near, 1);
  40227. this._near = this.near;
  40228. this.far = defaultValue_default(options.far, 5e8);
  40229. this._far = this.far;
  40230. }
  40231. OrthographicFrustum.packedLength = 4;
  40232. OrthographicFrustum.pack = function(value, array, startingIndex) {
  40233. Check_default.typeOf.object("value", value);
  40234. Check_default.defined("array", array);
  40235. startingIndex = defaultValue_default(startingIndex, 0);
  40236. array[startingIndex++] = value.width;
  40237. array[startingIndex++] = value.aspectRatio;
  40238. array[startingIndex++] = value.near;
  40239. array[startingIndex] = value.far;
  40240. return array;
  40241. };
  40242. OrthographicFrustum.unpack = function(array, startingIndex, result) {
  40243. Check_default.defined("array", array);
  40244. startingIndex = defaultValue_default(startingIndex, 0);
  40245. if (!defined_default(result)) {
  40246. result = new OrthographicFrustum();
  40247. }
  40248. result.width = array[startingIndex++];
  40249. result.aspectRatio = array[startingIndex++];
  40250. result.near = array[startingIndex++];
  40251. result.far = array[startingIndex];
  40252. return result;
  40253. };
  40254. function update2(frustum) {
  40255. if (!defined_default(frustum.width) || !defined_default(frustum.aspectRatio) || !defined_default(frustum.near) || !defined_default(frustum.far)) {
  40256. throw new DeveloperError_default(
  40257. "width, aspectRatio, near, or far parameters are not set."
  40258. );
  40259. }
  40260. const f2 = frustum._offCenterFrustum;
  40261. if (frustum.width !== frustum._width || frustum.aspectRatio !== frustum._aspectRatio || frustum.near !== frustum._near || frustum.far !== frustum._far) {
  40262. if (frustum.aspectRatio < 0) {
  40263. throw new DeveloperError_default("aspectRatio must be positive.");
  40264. }
  40265. if (frustum.near < 0 || frustum.near > frustum.far) {
  40266. throw new DeveloperError_default(
  40267. "near must be greater than zero and less than far."
  40268. );
  40269. }
  40270. frustum._aspectRatio = frustum.aspectRatio;
  40271. frustum._width = frustum.width;
  40272. frustum._near = frustum.near;
  40273. frustum._far = frustum.far;
  40274. const ratio = 1 / frustum.aspectRatio;
  40275. f2.right = frustum.width * 0.5;
  40276. f2.left = -f2.right;
  40277. f2.top = ratio * f2.right;
  40278. f2.bottom = -f2.top;
  40279. f2.near = frustum.near;
  40280. f2.far = frustum.far;
  40281. }
  40282. }
  40283. Object.defineProperties(OrthographicFrustum.prototype, {
  40284. projectionMatrix: {
  40285. get: function() {
  40286. update2(this);
  40287. return this._offCenterFrustum.projectionMatrix;
  40288. }
  40289. }
  40290. });
  40291. OrthographicFrustum.prototype.computeCullingVolume = function(position, direction2, up) {
  40292. update2(this);
  40293. return this._offCenterFrustum.computeCullingVolume(position, direction2, up);
  40294. };
  40295. OrthographicFrustum.prototype.getPixelDimensions = function(drawingBufferWidth, drawingBufferHeight, distance2, pixelRatio, result) {
  40296. update2(this);
  40297. return this._offCenterFrustum.getPixelDimensions(
  40298. drawingBufferWidth,
  40299. drawingBufferHeight,
  40300. distance2,
  40301. pixelRatio,
  40302. result
  40303. );
  40304. };
  40305. OrthographicFrustum.prototype.clone = function(result) {
  40306. if (!defined_default(result)) {
  40307. result = new OrthographicFrustum();
  40308. }
  40309. result.aspectRatio = this.aspectRatio;
  40310. result.width = this.width;
  40311. result.near = this.near;
  40312. result.far = this.far;
  40313. result._aspectRatio = void 0;
  40314. result._width = void 0;
  40315. result._near = void 0;
  40316. result._far = void 0;
  40317. this._offCenterFrustum.clone(result._offCenterFrustum);
  40318. return result;
  40319. };
  40320. OrthographicFrustum.prototype.equals = function(other) {
  40321. if (!defined_default(other) || !(other instanceof OrthographicFrustum)) {
  40322. return false;
  40323. }
  40324. update2(this);
  40325. update2(other);
  40326. return this.width === other.width && this.aspectRatio === other.aspectRatio && this._offCenterFrustum.equals(other._offCenterFrustum);
  40327. };
  40328. OrthographicFrustum.prototype.equalsEpsilon = function(other, relativeEpsilon, absoluteEpsilon) {
  40329. if (!defined_default(other) || !(other instanceof OrthographicFrustum)) {
  40330. return false;
  40331. }
  40332. update2(this);
  40333. update2(other);
  40334. return Math_default.equalsEpsilon(
  40335. this.width,
  40336. other.width,
  40337. relativeEpsilon,
  40338. absoluteEpsilon
  40339. ) && Math_default.equalsEpsilon(
  40340. this.aspectRatio,
  40341. other.aspectRatio,
  40342. relativeEpsilon,
  40343. absoluteEpsilon
  40344. ) && this._offCenterFrustum.equalsEpsilon(
  40345. other._offCenterFrustum,
  40346. relativeEpsilon,
  40347. absoluteEpsilon
  40348. );
  40349. };
  40350. var OrthographicFrustum_default = OrthographicFrustum;
  40351. // node_modules/cesium/Source/Core/PerspectiveOffCenterFrustum.js
  40352. function PerspectiveOffCenterFrustum(options) {
  40353. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  40354. this.left = options.left;
  40355. this._left = void 0;
  40356. this.right = options.right;
  40357. this._right = void 0;
  40358. this.top = options.top;
  40359. this._top = void 0;
  40360. this.bottom = options.bottom;
  40361. this._bottom = void 0;
  40362. this.near = defaultValue_default(options.near, 1);
  40363. this._near = this.near;
  40364. this.far = defaultValue_default(options.far, 5e8);
  40365. this._far = this.far;
  40366. this._cullingVolume = new CullingVolume_default();
  40367. this._perspectiveMatrix = new Matrix4_default();
  40368. this._infinitePerspective = new Matrix4_default();
  40369. }
  40370. function update3(frustum) {
  40371. if (!defined_default(frustum.right) || !defined_default(frustum.left) || !defined_default(frustum.top) || !defined_default(frustum.bottom) || !defined_default(frustum.near) || !defined_default(frustum.far)) {
  40372. throw new DeveloperError_default(
  40373. "right, left, top, bottom, near, or far parameters are not set."
  40374. );
  40375. }
  40376. const t = frustum.top;
  40377. const b = frustum.bottom;
  40378. const r2 = frustum.right;
  40379. const l2 = frustum.left;
  40380. const n2 = frustum.near;
  40381. const f2 = frustum.far;
  40382. if (t !== frustum._top || b !== frustum._bottom || l2 !== frustum._left || r2 !== frustum._right || n2 !== frustum._near || f2 !== frustum._far) {
  40383. if (frustum.near <= 0 || frustum.near > frustum.far) {
  40384. throw new DeveloperError_default(
  40385. "near must be greater than zero and less than far."
  40386. );
  40387. }
  40388. frustum._left = l2;
  40389. frustum._right = r2;
  40390. frustum._top = t;
  40391. frustum._bottom = b;
  40392. frustum._near = n2;
  40393. frustum._far = f2;
  40394. frustum._perspectiveMatrix = Matrix4_default.computePerspectiveOffCenter(
  40395. l2,
  40396. r2,
  40397. b,
  40398. t,
  40399. n2,
  40400. f2,
  40401. frustum._perspectiveMatrix
  40402. );
  40403. frustum._infinitePerspective = Matrix4_default.computeInfinitePerspectiveOffCenter(
  40404. l2,
  40405. r2,
  40406. b,
  40407. t,
  40408. n2,
  40409. frustum._infinitePerspective
  40410. );
  40411. }
  40412. }
  40413. Object.defineProperties(PerspectiveOffCenterFrustum.prototype, {
  40414. projectionMatrix: {
  40415. get: function() {
  40416. update3(this);
  40417. return this._perspectiveMatrix;
  40418. }
  40419. },
  40420. infiniteProjectionMatrix: {
  40421. get: function() {
  40422. update3(this);
  40423. return this._infinitePerspective;
  40424. }
  40425. }
  40426. });
  40427. var getPlanesRight2 = new Cartesian3_default();
  40428. var getPlanesNearCenter2 = new Cartesian3_default();
  40429. var getPlanesFarCenter = new Cartesian3_default();
  40430. var getPlanesNormal = new Cartesian3_default();
  40431. PerspectiveOffCenterFrustum.prototype.computeCullingVolume = function(position, direction2, up) {
  40432. if (!defined_default(position)) {
  40433. throw new DeveloperError_default("position is required.");
  40434. }
  40435. if (!defined_default(direction2)) {
  40436. throw new DeveloperError_default("direction is required.");
  40437. }
  40438. if (!defined_default(up)) {
  40439. throw new DeveloperError_default("up is required.");
  40440. }
  40441. const planes = this._cullingVolume.planes;
  40442. const t = this.top;
  40443. const b = this.bottom;
  40444. const r2 = this.right;
  40445. const l2 = this.left;
  40446. const n2 = this.near;
  40447. const f2 = this.far;
  40448. const right = Cartesian3_default.cross(direction2, up, getPlanesRight2);
  40449. const nearCenter = getPlanesNearCenter2;
  40450. Cartesian3_default.multiplyByScalar(direction2, n2, nearCenter);
  40451. Cartesian3_default.add(position, nearCenter, nearCenter);
  40452. const farCenter = getPlanesFarCenter;
  40453. Cartesian3_default.multiplyByScalar(direction2, f2, farCenter);
  40454. Cartesian3_default.add(position, farCenter, farCenter);
  40455. const normal2 = getPlanesNormal;
  40456. Cartesian3_default.multiplyByScalar(right, l2, normal2);
  40457. Cartesian3_default.add(nearCenter, normal2, normal2);
  40458. Cartesian3_default.subtract(normal2, position, normal2);
  40459. Cartesian3_default.normalize(normal2, normal2);
  40460. Cartesian3_default.cross(normal2, up, normal2);
  40461. Cartesian3_default.normalize(normal2, normal2);
  40462. let plane = planes[0];
  40463. if (!defined_default(plane)) {
  40464. plane = planes[0] = new Cartesian4_default();
  40465. }
  40466. plane.x = normal2.x;
  40467. plane.y = normal2.y;
  40468. plane.z = normal2.z;
  40469. plane.w = -Cartesian3_default.dot(normal2, position);
  40470. Cartesian3_default.multiplyByScalar(right, r2, normal2);
  40471. Cartesian3_default.add(nearCenter, normal2, normal2);
  40472. Cartesian3_default.subtract(normal2, position, normal2);
  40473. Cartesian3_default.cross(up, normal2, normal2);
  40474. Cartesian3_default.normalize(normal2, normal2);
  40475. plane = planes[1];
  40476. if (!defined_default(plane)) {
  40477. plane = planes[1] = new Cartesian4_default();
  40478. }
  40479. plane.x = normal2.x;
  40480. plane.y = normal2.y;
  40481. plane.z = normal2.z;
  40482. plane.w = -Cartesian3_default.dot(normal2, position);
  40483. Cartesian3_default.multiplyByScalar(up, b, normal2);
  40484. Cartesian3_default.add(nearCenter, normal2, normal2);
  40485. Cartesian3_default.subtract(normal2, position, normal2);
  40486. Cartesian3_default.cross(right, normal2, normal2);
  40487. Cartesian3_default.normalize(normal2, normal2);
  40488. plane = planes[2];
  40489. if (!defined_default(plane)) {
  40490. plane = planes[2] = new Cartesian4_default();
  40491. }
  40492. plane.x = normal2.x;
  40493. plane.y = normal2.y;
  40494. plane.z = normal2.z;
  40495. plane.w = -Cartesian3_default.dot(normal2, position);
  40496. Cartesian3_default.multiplyByScalar(up, t, normal2);
  40497. Cartesian3_default.add(nearCenter, normal2, normal2);
  40498. Cartesian3_default.subtract(normal2, position, normal2);
  40499. Cartesian3_default.cross(normal2, right, normal2);
  40500. Cartesian3_default.normalize(normal2, normal2);
  40501. plane = planes[3];
  40502. if (!defined_default(plane)) {
  40503. plane = planes[3] = new Cartesian4_default();
  40504. }
  40505. plane.x = normal2.x;
  40506. plane.y = normal2.y;
  40507. plane.z = normal2.z;
  40508. plane.w = -Cartesian3_default.dot(normal2, position);
  40509. plane = planes[4];
  40510. if (!defined_default(plane)) {
  40511. plane = planes[4] = new Cartesian4_default();
  40512. }
  40513. plane.x = direction2.x;
  40514. plane.y = direction2.y;
  40515. plane.z = direction2.z;
  40516. plane.w = -Cartesian3_default.dot(direction2, nearCenter);
  40517. Cartesian3_default.negate(direction2, normal2);
  40518. plane = planes[5];
  40519. if (!defined_default(plane)) {
  40520. plane = planes[5] = new Cartesian4_default();
  40521. }
  40522. plane.x = normal2.x;
  40523. plane.y = normal2.y;
  40524. plane.z = normal2.z;
  40525. plane.w = -Cartesian3_default.dot(normal2, farCenter);
  40526. return this._cullingVolume;
  40527. };
  40528. PerspectiveOffCenterFrustum.prototype.getPixelDimensions = function(drawingBufferWidth, drawingBufferHeight, distance2, pixelRatio, result) {
  40529. update3(this);
  40530. if (!defined_default(drawingBufferWidth) || !defined_default(drawingBufferHeight)) {
  40531. throw new DeveloperError_default(
  40532. "Both drawingBufferWidth and drawingBufferHeight are required."
  40533. );
  40534. }
  40535. if (drawingBufferWidth <= 0) {
  40536. throw new DeveloperError_default("drawingBufferWidth must be greater than zero.");
  40537. }
  40538. if (drawingBufferHeight <= 0) {
  40539. throw new DeveloperError_default("drawingBufferHeight must be greater than zero.");
  40540. }
  40541. if (!defined_default(distance2)) {
  40542. throw new DeveloperError_default("distance is required.");
  40543. }
  40544. if (!defined_default(pixelRatio)) {
  40545. throw new DeveloperError_default("pixelRatio is required");
  40546. }
  40547. if (pixelRatio <= 0) {
  40548. throw new DeveloperError_default("pixelRatio must be greater than zero.");
  40549. }
  40550. if (!defined_default(result)) {
  40551. throw new DeveloperError_default("A result object is required.");
  40552. }
  40553. const inverseNear = 1 / this.near;
  40554. let tanTheta = this.top * inverseNear;
  40555. const pixelHeight = 2 * pixelRatio * distance2 * tanTheta / drawingBufferHeight;
  40556. tanTheta = this.right * inverseNear;
  40557. const pixelWidth = 2 * pixelRatio * distance2 * tanTheta / drawingBufferWidth;
  40558. result.x = pixelWidth;
  40559. result.y = pixelHeight;
  40560. return result;
  40561. };
  40562. PerspectiveOffCenterFrustum.prototype.clone = function(result) {
  40563. if (!defined_default(result)) {
  40564. result = new PerspectiveOffCenterFrustum();
  40565. }
  40566. result.right = this.right;
  40567. result.left = this.left;
  40568. result.top = this.top;
  40569. result.bottom = this.bottom;
  40570. result.near = this.near;
  40571. result.far = this.far;
  40572. result._left = void 0;
  40573. result._right = void 0;
  40574. result._top = void 0;
  40575. result._bottom = void 0;
  40576. result._near = void 0;
  40577. result._far = void 0;
  40578. return result;
  40579. };
  40580. PerspectiveOffCenterFrustum.prototype.equals = function(other) {
  40581. return defined_default(other) && other instanceof PerspectiveOffCenterFrustum && this.right === other.right && this.left === other.left && this.top === other.top && this.bottom === other.bottom && this.near === other.near && this.far === other.far;
  40582. };
  40583. PerspectiveOffCenterFrustum.prototype.equalsEpsilon = function(other, relativeEpsilon, absoluteEpsilon) {
  40584. return other === this || defined_default(other) && other instanceof PerspectiveOffCenterFrustum && Math_default.equalsEpsilon(
  40585. this.right,
  40586. other.right,
  40587. relativeEpsilon,
  40588. absoluteEpsilon
  40589. ) && Math_default.equalsEpsilon(
  40590. this.left,
  40591. other.left,
  40592. relativeEpsilon,
  40593. absoluteEpsilon
  40594. ) && Math_default.equalsEpsilon(
  40595. this.top,
  40596. other.top,
  40597. relativeEpsilon,
  40598. absoluteEpsilon
  40599. ) && Math_default.equalsEpsilon(
  40600. this.bottom,
  40601. other.bottom,
  40602. relativeEpsilon,
  40603. absoluteEpsilon
  40604. ) && Math_default.equalsEpsilon(
  40605. this.near,
  40606. other.near,
  40607. relativeEpsilon,
  40608. absoluteEpsilon
  40609. ) && Math_default.equalsEpsilon(
  40610. this.far,
  40611. other.far,
  40612. relativeEpsilon,
  40613. absoluteEpsilon
  40614. );
  40615. };
  40616. var PerspectiveOffCenterFrustum_default = PerspectiveOffCenterFrustum;
  40617. // node_modules/cesium/Source/Core/PerspectiveFrustum.js
  40618. function PerspectiveFrustum(options) {
  40619. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  40620. this._offCenterFrustum = new PerspectiveOffCenterFrustum_default();
  40621. this.fov = options.fov;
  40622. this._fov = void 0;
  40623. this._fovy = void 0;
  40624. this._sseDenominator = void 0;
  40625. this.aspectRatio = options.aspectRatio;
  40626. this._aspectRatio = void 0;
  40627. this.near = defaultValue_default(options.near, 1);
  40628. this._near = this.near;
  40629. this.far = defaultValue_default(options.far, 5e8);
  40630. this._far = this.far;
  40631. this.xOffset = defaultValue_default(options.xOffset, 0);
  40632. this._xOffset = this.xOffset;
  40633. this.yOffset = defaultValue_default(options.yOffset, 0);
  40634. this._yOffset = this.yOffset;
  40635. }
  40636. PerspectiveFrustum.packedLength = 6;
  40637. PerspectiveFrustum.pack = function(value, array, startingIndex) {
  40638. Check_default.typeOf.object("value", value);
  40639. Check_default.defined("array", array);
  40640. startingIndex = defaultValue_default(startingIndex, 0);
  40641. array[startingIndex++] = value.fov;
  40642. array[startingIndex++] = value.aspectRatio;
  40643. array[startingIndex++] = value.near;
  40644. array[startingIndex++] = value.far;
  40645. array[startingIndex++] = value.xOffset;
  40646. array[startingIndex] = value.yOffset;
  40647. return array;
  40648. };
  40649. PerspectiveFrustum.unpack = function(array, startingIndex, result) {
  40650. Check_default.defined("array", array);
  40651. startingIndex = defaultValue_default(startingIndex, 0);
  40652. if (!defined_default(result)) {
  40653. result = new PerspectiveFrustum();
  40654. }
  40655. result.fov = array[startingIndex++];
  40656. result.aspectRatio = array[startingIndex++];
  40657. result.near = array[startingIndex++];
  40658. result.far = array[startingIndex++];
  40659. result.xOffset = array[startingIndex++];
  40660. result.yOffset = array[startingIndex];
  40661. return result;
  40662. };
  40663. function update4(frustum) {
  40664. if (!defined_default(frustum.fov) || !defined_default(frustum.aspectRatio) || !defined_default(frustum.near) || !defined_default(frustum.far)) {
  40665. throw new DeveloperError_default(
  40666. "fov, aspectRatio, near, or far parameters are not set."
  40667. );
  40668. }
  40669. const f2 = frustum._offCenterFrustum;
  40670. if (frustum.fov !== frustum._fov || frustum.aspectRatio !== frustum._aspectRatio || frustum.near !== frustum._near || frustum.far !== frustum._far || frustum.xOffset !== frustum._xOffset || frustum.yOffset !== frustum._yOffset) {
  40671. if (frustum.fov < 0 || frustum.fov >= Math.PI) {
  40672. throw new DeveloperError_default("fov must be in the range [0, PI).");
  40673. }
  40674. if (frustum.aspectRatio < 0) {
  40675. throw new DeveloperError_default("aspectRatio must be positive.");
  40676. }
  40677. if (frustum.near < 0 || frustum.near > frustum.far) {
  40678. throw new DeveloperError_default(
  40679. "near must be greater than zero and less than far."
  40680. );
  40681. }
  40682. frustum._aspectRatio = frustum.aspectRatio;
  40683. frustum._fov = frustum.fov;
  40684. frustum._fovy = frustum.aspectRatio <= 1 ? frustum.fov : Math.atan(Math.tan(frustum.fov * 0.5) / frustum.aspectRatio) * 2;
  40685. frustum._near = frustum.near;
  40686. frustum._far = frustum.far;
  40687. frustum._sseDenominator = 2 * Math.tan(0.5 * frustum._fovy);
  40688. frustum._xOffset = frustum.xOffset;
  40689. frustum._yOffset = frustum.yOffset;
  40690. f2.top = frustum.near * Math.tan(0.5 * frustum._fovy);
  40691. f2.bottom = -f2.top;
  40692. f2.right = frustum.aspectRatio * f2.top;
  40693. f2.left = -f2.right;
  40694. f2.near = frustum.near;
  40695. f2.far = frustum.far;
  40696. f2.right += frustum.xOffset;
  40697. f2.left += frustum.xOffset;
  40698. f2.top += frustum.yOffset;
  40699. f2.bottom += frustum.yOffset;
  40700. }
  40701. }
  40702. Object.defineProperties(PerspectiveFrustum.prototype, {
  40703. projectionMatrix: {
  40704. get: function() {
  40705. update4(this);
  40706. return this._offCenterFrustum.projectionMatrix;
  40707. }
  40708. },
  40709. infiniteProjectionMatrix: {
  40710. get: function() {
  40711. update4(this);
  40712. return this._offCenterFrustum.infiniteProjectionMatrix;
  40713. }
  40714. },
  40715. fovy: {
  40716. get: function() {
  40717. update4(this);
  40718. return this._fovy;
  40719. }
  40720. },
  40721. sseDenominator: {
  40722. get: function() {
  40723. update4(this);
  40724. return this._sseDenominator;
  40725. }
  40726. }
  40727. });
  40728. PerspectiveFrustum.prototype.computeCullingVolume = function(position, direction2, up) {
  40729. update4(this);
  40730. return this._offCenterFrustum.computeCullingVolume(position, direction2, up);
  40731. };
  40732. PerspectiveFrustum.prototype.getPixelDimensions = function(drawingBufferWidth, drawingBufferHeight, distance2, pixelRatio, result) {
  40733. update4(this);
  40734. return this._offCenterFrustum.getPixelDimensions(
  40735. drawingBufferWidth,
  40736. drawingBufferHeight,
  40737. distance2,
  40738. pixelRatio,
  40739. result
  40740. );
  40741. };
  40742. PerspectiveFrustum.prototype.clone = function(result) {
  40743. if (!defined_default(result)) {
  40744. result = new PerspectiveFrustum();
  40745. }
  40746. result.aspectRatio = this.aspectRatio;
  40747. result.fov = this.fov;
  40748. result.near = this.near;
  40749. result.far = this.far;
  40750. result._aspectRatio = void 0;
  40751. result._fov = void 0;
  40752. result._near = void 0;
  40753. result._far = void 0;
  40754. this._offCenterFrustum.clone(result._offCenterFrustum);
  40755. return result;
  40756. };
  40757. PerspectiveFrustum.prototype.equals = function(other) {
  40758. if (!defined_default(other) || !(other instanceof PerspectiveFrustum)) {
  40759. return false;
  40760. }
  40761. update4(this);
  40762. update4(other);
  40763. return this.fov === other.fov && this.aspectRatio === other.aspectRatio && this._offCenterFrustum.equals(other._offCenterFrustum);
  40764. };
  40765. PerspectiveFrustum.prototype.equalsEpsilon = function(other, relativeEpsilon, absoluteEpsilon) {
  40766. if (!defined_default(other) || !(other instanceof PerspectiveFrustum)) {
  40767. return false;
  40768. }
  40769. update4(this);
  40770. update4(other);
  40771. return Math_default.equalsEpsilon(
  40772. this.fov,
  40773. other.fov,
  40774. relativeEpsilon,
  40775. absoluteEpsilon
  40776. ) && Math_default.equalsEpsilon(
  40777. this.aspectRatio,
  40778. other.aspectRatio,
  40779. relativeEpsilon,
  40780. absoluteEpsilon
  40781. ) && this._offCenterFrustum.equalsEpsilon(
  40782. other._offCenterFrustum,
  40783. relativeEpsilon,
  40784. absoluteEpsilon
  40785. );
  40786. };
  40787. var PerspectiveFrustum_default = PerspectiveFrustum;
  40788. // node_modules/cesium/Source/Core/FrustumGeometry.js
  40789. var PERSPECTIVE = 0;
  40790. var ORTHOGRAPHIC = 1;
  40791. function FrustumGeometry(options) {
  40792. Check_default.typeOf.object("options", options);
  40793. Check_default.typeOf.object("options.frustum", options.frustum);
  40794. Check_default.typeOf.object("options.origin", options.origin);
  40795. Check_default.typeOf.object("options.orientation", options.orientation);
  40796. const frustum = options.frustum;
  40797. const orientation = options.orientation;
  40798. const origin = options.origin;
  40799. const vertexFormat = defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT);
  40800. const drawNearPlane = defaultValue_default(options._drawNearPlane, true);
  40801. let frustumType;
  40802. let frustumPackedLength;
  40803. if (frustum instanceof PerspectiveFrustum_default) {
  40804. frustumType = PERSPECTIVE;
  40805. frustumPackedLength = PerspectiveFrustum_default.packedLength;
  40806. } else if (frustum instanceof OrthographicFrustum_default) {
  40807. frustumType = ORTHOGRAPHIC;
  40808. frustumPackedLength = OrthographicFrustum_default.packedLength;
  40809. }
  40810. this._frustumType = frustumType;
  40811. this._frustum = frustum.clone();
  40812. this._origin = Cartesian3_default.clone(origin);
  40813. this._orientation = Quaternion_default.clone(orientation);
  40814. this._drawNearPlane = drawNearPlane;
  40815. this._vertexFormat = vertexFormat;
  40816. this._workerName = "createFrustumGeometry";
  40817. this.packedLength = 2 + frustumPackedLength + Cartesian3_default.packedLength + Quaternion_default.packedLength + VertexFormat_default.packedLength;
  40818. }
  40819. FrustumGeometry.pack = function(value, array, startingIndex) {
  40820. Check_default.typeOf.object("value", value);
  40821. Check_default.defined("array", array);
  40822. startingIndex = defaultValue_default(startingIndex, 0);
  40823. const frustumType = value._frustumType;
  40824. const frustum = value._frustum;
  40825. array[startingIndex++] = frustumType;
  40826. if (frustumType === PERSPECTIVE) {
  40827. PerspectiveFrustum_default.pack(frustum, array, startingIndex);
  40828. startingIndex += PerspectiveFrustum_default.packedLength;
  40829. } else {
  40830. OrthographicFrustum_default.pack(frustum, array, startingIndex);
  40831. startingIndex += OrthographicFrustum_default.packedLength;
  40832. }
  40833. Cartesian3_default.pack(value._origin, array, startingIndex);
  40834. startingIndex += Cartesian3_default.packedLength;
  40835. Quaternion_default.pack(value._orientation, array, startingIndex);
  40836. startingIndex += Quaternion_default.packedLength;
  40837. VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
  40838. startingIndex += VertexFormat_default.packedLength;
  40839. array[startingIndex] = value._drawNearPlane ? 1 : 0;
  40840. return array;
  40841. };
  40842. var scratchPackPerspective = new PerspectiveFrustum_default();
  40843. var scratchPackOrthographic = new OrthographicFrustum_default();
  40844. var scratchPackQuaternion = new Quaternion_default();
  40845. var scratchPackorigin = new Cartesian3_default();
  40846. var scratchVertexFormat7 = new VertexFormat_default();
  40847. FrustumGeometry.unpack = function(array, startingIndex, result) {
  40848. Check_default.defined("array", array);
  40849. startingIndex = defaultValue_default(startingIndex, 0);
  40850. const frustumType = array[startingIndex++];
  40851. let frustum;
  40852. if (frustumType === PERSPECTIVE) {
  40853. frustum = PerspectiveFrustum_default.unpack(
  40854. array,
  40855. startingIndex,
  40856. scratchPackPerspective
  40857. );
  40858. startingIndex += PerspectiveFrustum_default.packedLength;
  40859. } else {
  40860. frustum = OrthographicFrustum_default.unpack(
  40861. array,
  40862. startingIndex,
  40863. scratchPackOrthographic
  40864. );
  40865. startingIndex += OrthographicFrustum_default.packedLength;
  40866. }
  40867. const origin = Cartesian3_default.unpack(array, startingIndex, scratchPackorigin);
  40868. startingIndex += Cartesian3_default.packedLength;
  40869. const orientation = Quaternion_default.unpack(
  40870. array,
  40871. startingIndex,
  40872. scratchPackQuaternion
  40873. );
  40874. startingIndex += Quaternion_default.packedLength;
  40875. const vertexFormat = VertexFormat_default.unpack(
  40876. array,
  40877. startingIndex,
  40878. scratchVertexFormat7
  40879. );
  40880. startingIndex += VertexFormat_default.packedLength;
  40881. const drawNearPlane = array[startingIndex] === 1;
  40882. if (!defined_default(result)) {
  40883. return new FrustumGeometry({
  40884. frustum,
  40885. origin,
  40886. orientation,
  40887. vertexFormat,
  40888. _drawNearPlane: drawNearPlane
  40889. });
  40890. }
  40891. const frustumResult = frustumType === result._frustumType ? result._frustum : void 0;
  40892. result._frustum = frustum.clone(frustumResult);
  40893. result._frustumType = frustumType;
  40894. result._origin = Cartesian3_default.clone(origin, result._origin);
  40895. result._orientation = Quaternion_default.clone(orientation, result._orientation);
  40896. result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
  40897. result._drawNearPlane = drawNearPlane;
  40898. return result;
  40899. };
  40900. function getAttributes(offset2, normals, tangents, bitangents, st, normal2, tangent, bitangent) {
  40901. const stOffset = offset2 / 3 * 2;
  40902. for (let i2 = 0; i2 < 4; ++i2) {
  40903. if (defined_default(normals)) {
  40904. normals[offset2] = normal2.x;
  40905. normals[offset2 + 1] = normal2.y;
  40906. normals[offset2 + 2] = normal2.z;
  40907. }
  40908. if (defined_default(tangents)) {
  40909. tangents[offset2] = tangent.x;
  40910. tangents[offset2 + 1] = tangent.y;
  40911. tangents[offset2 + 2] = tangent.z;
  40912. }
  40913. if (defined_default(bitangents)) {
  40914. bitangents[offset2] = bitangent.x;
  40915. bitangents[offset2 + 1] = bitangent.y;
  40916. bitangents[offset2 + 2] = bitangent.z;
  40917. }
  40918. offset2 += 3;
  40919. }
  40920. st[stOffset] = 0;
  40921. st[stOffset + 1] = 0;
  40922. st[stOffset + 2] = 1;
  40923. st[stOffset + 3] = 0;
  40924. st[stOffset + 4] = 1;
  40925. st[stOffset + 5] = 1;
  40926. st[stOffset + 6] = 0;
  40927. st[stOffset + 7] = 1;
  40928. }
  40929. var scratchRotationMatrix = new Matrix3_default();
  40930. var scratchViewMatrix = new Matrix4_default();
  40931. var scratchInverseMatrix = new Matrix4_default();
  40932. var scratchXDirection = new Cartesian3_default();
  40933. var scratchYDirection = new Cartesian3_default();
  40934. var scratchZDirection = new Cartesian3_default();
  40935. var scratchNegativeX = new Cartesian3_default();
  40936. var scratchNegativeY = new Cartesian3_default();
  40937. var scratchNegativeZ = new Cartesian3_default();
  40938. var frustumSplits = new Array(3);
  40939. var frustumCornersNDC = new Array(4);
  40940. frustumCornersNDC[0] = new Cartesian4_default(-1, -1, 1, 1);
  40941. frustumCornersNDC[1] = new Cartesian4_default(1, -1, 1, 1);
  40942. frustumCornersNDC[2] = new Cartesian4_default(1, 1, 1, 1);
  40943. frustumCornersNDC[3] = new Cartesian4_default(-1, 1, 1, 1);
  40944. var scratchFrustumCorners = new Array(4);
  40945. for (let i2 = 0; i2 < 4; ++i2) {
  40946. scratchFrustumCorners[i2] = new Cartesian4_default();
  40947. }
  40948. FrustumGeometry._computeNearFarPlanes = function(origin, orientation, frustumType, frustum, positions, xDirection, yDirection, zDirection) {
  40949. const rotationMatrix = Matrix3_default.fromQuaternion(
  40950. orientation,
  40951. scratchRotationMatrix
  40952. );
  40953. let x = defaultValue_default(xDirection, scratchXDirection);
  40954. let y = defaultValue_default(yDirection, scratchYDirection);
  40955. let z = defaultValue_default(zDirection, scratchZDirection);
  40956. x = Matrix3_default.getColumn(rotationMatrix, 0, x);
  40957. y = Matrix3_default.getColumn(rotationMatrix, 1, y);
  40958. z = Matrix3_default.getColumn(rotationMatrix, 2, z);
  40959. Cartesian3_default.normalize(x, x);
  40960. Cartesian3_default.normalize(y, y);
  40961. Cartesian3_default.normalize(z, z);
  40962. Cartesian3_default.negate(x, x);
  40963. const view = Matrix4_default.computeView(origin, z, y, x, scratchViewMatrix);
  40964. let inverseView;
  40965. let inverseViewProjection;
  40966. if (frustumType === PERSPECTIVE) {
  40967. const projection = frustum.projectionMatrix;
  40968. const viewProjection = Matrix4_default.multiply(
  40969. projection,
  40970. view,
  40971. scratchInverseMatrix
  40972. );
  40973. inverseViewProjection = Matrix4_default.inverse(
  40974. viewProjection,
  40975. scratchInverseMatrix
  40976. );
  40977. } else {
  40978. inverseView = Matrix4_default.inverseTransformation(view, scratchInverseMatrix);
  40979. }
  40980. if (defined_default(inverseViewProjection)) {
  40981. frustumSplits[0] = frustum.near;
  40982. frustumSplits[1] = frustum.far;
  40983. } else {
  40984. frustumSplits[0] = 0;
  40985. frustumSplits[1] = frustum.near;
  40986. frustumSplits[2] = frustum.far;
  40987. }
  40988. for (let i2 = 0; i2 < 2; ++i2) {
  40989. for (let j = 0; j < 4; ++j) {
  40990. let corner = Cartesian4_default.clone(
  40991. frustumCornersNDC[j],
  40992. scratchFrustumCorners[j]
  40993. );
  40994. if (!defined_default(inverseViewProjection)) {
  40995. if (defined_default(frustum._offCenterFrustum)) {
  40996. frustum = frustum._offCenterFrustum;
  40997. }
  40998. const near = frustumSplits[i2];
  40999. const far = frustumSplits[i2 + 1];
  41000. corner.x = (corner.x * (frustum.right - frustum.left) + frustum.left + frustum.right) * 0.5;
  41001. corner.y = (corner.y * (frustum.top - frustum.bottom) + frustum.bottom + frustum.top) * 0.5;
  41002. corner.z = (corner.z * (near - far) - near - far) * 0.5;
  41003. corner.w = 1;
  41004. Matrix4_default.multiplyByVector(inverseView, corner, corner);
  41005. } else {
  41006. corner = Matrix4_default.multiplyByVector(
  41007. inverseViewProjection,
  41008. corner,
  41009. corner
  41010. );
  41011. const w = 1 / corner.w;
  41012. Cartesian3_default.multiplyByScalar(corner, w, corner);
  41013. Cartesian3_default.subtract(corner, origin, corner);
  41014. Cartesian3_default.normalize(corner, corner);
  41015. const fac = Cartesian3_default.dot(z, corner);
  41016. Cartesian3_default.multiplyByScalar(corner, frustumSplits[i2] / fac, corner);
  41017. Cartesian3_default.add(corner, origin, corner);
  41018. }
  41019. positions[12 * i2 + j * 3] = corner.x;
  41020. positions[12 * i2 + j * 3 + 1] = corner.y;
  41021. positions[12 * i2 + j * 3 + 2] = corner.z;
  41022. }
  41023. }
  41024. };
  41025. FrustumGeometry.createGeometry = function(frustumGeometry) {
  41026. const frustumType = frustumGeometry._frustumType;
  41027. const frustum = frustumGeometry._frustum;
  41028. const origin = frustumGeometry._origin;
  41029. const orientation = frustumGeometry._orientation;
  41030. const drawNearPlane = frustumGeometry._drawNearPlane;
  41031. const vertexFormat = frustumGeometry._vertexFormat;
  41032. const numberOfPlanes = drawNearPlane ? 6 : 5;
  41033. let positions = new Float64Array(3 * 4 * 6);
  41034. FrustumGeometry._computeNearFarPlanes(
  41035. origin,
  41036. orientation,
  41037. frustumType,
  41038. frustum,
  41039. positions
  41040. );
  41041. let offset2 = 3 * 4 * 2;
  41042. positions[offset2] = positions[3 * 4];
  41043. positions[offset2 + 1] = positions[3 * 4 + 1];
  41044. positions[offset2 + 2] = positions[3 * 4 + 2];
  41045. positions[offset2 + 3] = positions[0];
  41046. positions[offset2 + 4] = positions[1];
  41047. positions[offset2 + 5] = positions[2];
  41048. positions[offset2 + 6] = positions[3 * 3];
  41049. positions[offset2 + 7] = positions[3 * 3 + 1];
  41050. positions[offset2 + 8] = positions[3 * 3 + 2];
  41051. positions[offset2 + 9] = positions[3 * 7];
  41052. positions[offset2 + 10] = positions[3 * 7 + 1];
  41053. positions[offset2 + 11] = positions[3 * 7 + 2];
  41054. offset2 += 3 * 4;
  41055. positions[offset2] = positions[3 * 5];
  41056. positions[offset2 + 1] = positions[3 * 5 + 1];
  41057. positions[offset2 + 2] = positions[3 * 5 + 2];
  41058. positions[offset2 + 3] = positions[3];
  41059. positions[offset2 + 4] = positions[3 + 1];
  41060. positions[offset2 + 5] = positions[3 + 2];
  41061. positions[offset2 + 6] = positions[0];
  41062. positions[offset2 + 7] = positions[1];
  41063. positions[offset2 + 8] = positions[2];
  41064. positions[offset2 + 9] = positions[3 * 4];
  41065. positions[offset2 + 10] = positions[3 * 4 + 1];
  41066. positions[offset2 + 11] = positions[3 * 4 + 2];
  41067. offset2 += 3 * 4;
  41068. positions[offset2] = positions[3];
  41069. positions[offset2 + 1] = positions[3 + 1];
  41070. positions[offset2 + 2] = positions[3 + 2];
  41071. positions[offset2 + 3] = positions[3 * 5];
  41072. positions[offset2 + 4] = positions[3 * 5 + 1];
  41073. positions[offset2 + 5] = positions[3 * 5 + 2];
  41074. positions[offset2 + 6] = positions[3 * 6];
  41075. positions[offset2 + 7] = positions[3 * 6 + 1];
  41076. positions[offset2 + 8] = positions[3 * 6 + 2];
  41077. positions[offset2 + 9] = positions[3 * 2];
  41078. positions[offset2 + 10] = positions[3 * 2 + 1];
  41079. positions[offset2 + 11] = positions[3 * 2 + 2];
  41080. offset2 += 3 * 4;
  41081. positions[offset2] = positions[3 * 2];
  41082. positions[offset2 + 1] = positions[3 * 2 + 1];
  41083. positions[offset2 + 2] = positions[3 * 2 + 2];
  41084. positions[offset2 + 3] = positions[3 * 6];
  41085. positions[offset2 + 4] = positions[3 * 6 + 1];
  41086. positions[offset2 + 5] = positions[3 * 6 + 2];
  41087. positions[offset2 + 6] = positions[3 * 7];
  41088. positions[offset2 + 7] = positions[3 * 7 + 1];
  41089. positions[offset2 + 8] = positions[3 * 7 + 2];
  41090. positions[offset2 + 9] = positions[3 * 3];
  41091. positions[offset2 + 10] = positions[3 * 3 + 1];
  41092. positions[offset2 + 11] = positions[3 * 3 + 2];
  41093. if (!drawNearPlane) {
  41094. positions = positions.subarray(3 * 4);
  41095. }
  41096. const attributes = new GeometryAttributes_default({
  41097. position: new GeometryAttribute_default({
  41098. componentDatatype: ComponentDatatype_default.DOUBLE,
  41099. componentsPerAttribute: 3,
  41100. values: positions
  41101. })
  41102. });
  41103. if (defined_default(vertexFormat.normal) || defined_default(vertexFormat.tangent) || defined_default(vertexFormat.bitangent) || defined_default(vertexFormat.st)) {
  41104. const normals = defined_default(vertexFormat.normal) ? new Float32Array(3 * 4 * numberOfPlanes) : void 0;
  41105. const tangents = defined_default(vertexFormat.tangent) ? new Float32Array(3 * 4 * numberOfPlanes) : void 0;
  41106. const bitangents = defined_default(vertexFormat.bitangent) ? new Float32Array(3 * 4 * numberOfPlanes) : void 0;
  41107. const st = defined_default(vertexFormat.st) ? new Float32Array(2 * 4 * numberOfPlanes) : void 0;
  41108. const x = scratchXDirection;
  41109. const y = scratchYDirection;
  41110. const z = scratchZDirection;
  41111. const negativeX2 = Cartesian3_default.negate(x, scratchNegativeX);
  41112. const negativeY = Cartesian3_default.negate(y, scratchNegativeY);
  41113. const negativeZ = Cartesian3_default.negate(z, scratchNegativeZ);
  41114. offset2 = 0;
  41115. if (drawNearPlane) {
  41116. getAttributes(offset2, normals, tangents, bitangents, st, negativeZ, x, y);
  41117. offset2 += 3 * 4;
  41118. }
  41119. getAttributes(offset2, normals, tangents, bitangents, st, z, negativeX2, y);
  41120. offset2 += 3 * 4;
  41121. getAttributes(
  41122. offset2,
  41123. normals,
  41124. tangents,
  41125. bitangents,
  41126. st,
  41127. negativeX2,
  41128. negativeZ,
  41129. y
  41130. );
  41131. offset2 += 3 * 4;
  41132. getAttributes(
  41133. offset2,
  41134. normals,
  41135. tangents,
  41136. bitangents,
  41137. st,
  41138. negativeY,
  41139. negativeZ,
  41140. negativeX2
  41141. );
  41142. offset2 += 3 * 4;
  41143. getAttributes(offset2, normals, tangents, bitangents, st, x, z, y);
  41144. offset2 += 3 * 4;
  41145. getAttributes(offset2, normals, tangents, bitangents, st, y, z, negativeX2);
  41146. if (defined_default(normals)) {
  41147. attributes.normal = new GeometryAttribute_default({
  41148. componentDatatype: ComponentDatatype_default.FLOAT,
  41149. componentsPerAttribute: 3,
  41150. values: normals
  41151. });
  41152. }
  41153. if (defined_default(tangents)) {
  41154. attributes.tangent = new GeometryAttribute_default({
  41155. componentDatatype: ComponentDatatype_default.FLOAT,
  41156. componentsPerAttribute: 3,
  41157. values: tangents
  41158. });
  41159. }
  41160. if (defined_default(bitangents)) {
  41161. attributes.bitangent = new GeometryAttribute_default({
  41162. componentDatatype: ComponentDatatype_default.FLOAT,
  41163. componentsPerAttribute: 3,
  41164. values: bitangents
  41165. });
  41166. }
  41167. if (defined_default(st)) {
  41168. attributes.st = new GeometryAttribute_default({
  41169. componentDatatype: ComponentDatatype_default.FLOAT,
  41170. componentsPerAttribute: 2,
  41171. values: st
  41172. });
  41173. }
  41174. }
  41175. const indices2 = new Uint16Array(6 * numberOfPlanes);
  41176. for (let i2 = 0; i2 < numberOfPlanes; ++i2) {
  41177. const indexOffset = i2 * 6;
  41178. const index2 = i2 * 4;
  41179. indices2[indexOffset] = index2;
  41180. indices2[indexOffset + 1] = index2 + 1;
  41181. indices2[indexOffset + 2] = index2 + 2;
  41182. indices2[indexOffset + 3] = index2;
  41183. indices2[indexOffset + 4] = index2 + 2;
  41184. indices2[indexOffset + 5] = index2 + 3;
  41185. }
  41186. return new Geometry_default({
  41187. attributes,
  41188. indices: indices2,
  41189. primitiveType: PrimitiveType_default.TRIANGLES,
  41190. boundingSphere: BoundingSphere_default.fromVertices(positions)
  41191. });
  41192. };
  41193. var FrustumGeometry_default = FrustumGeometry;
  41194. // node_modules/cesium/Source/Core/FrustumOutlineGeometry.js
  41195. var PERSPECTIVE2 = 0;
  41196. var ORTHOGRAPHIC2 = 1;
  41197. function FrustumOutlineGeometry(options) {
  41198. Check_default.typeOf.object("options", options);
  41199. Check_default.typeOf.object("options.frustum", options.frustum);
  41200. Check_default.typeOf.object("options.origin", options.origin);
  41201. Check_default.typeOf.object("options.orientation", options.orientation);
  41202. const frustum = options.frustum;
  41203. const orientation = options.orientation;
  41204. const origin = options.origin;
  41205. const drawNearPlane = defaultValue_default(options._drawNearPlane, true);
  41206. let frustumType;
  41207. let frustumPackedLength;
  41208. if (frustum instanceof PerspectiveFrustum_default) {
  41209. frustumType = PERSPECTIVE2;
  41210. frustumPackedLength = PerspectiveFrustum_default.packedLength;
  41211. } else if (frustum instanceof OrthographicFrustum_default) {
  41212. frustumType = ORTHOGRAPHIC2;
  41213. frustumPackedLength = OrthographicFrustum_default.packedLength;
  41214. }
  41215. this._frustumType = frustumType;
  41216. this._frustum = frustum.clone();
  41217. this._origin = Cartesian3_default.clone(origin);
  41218. this._orientation = Quaternion_default.clone(orientation);
  41219. this._drawNearPlane = drawNearPlane;
  41220. this._workerName = "createFrustumOutlineGeometry";
  41221. this.packedLength = 2 + frustumPackedLength + Cartesian3_default.packedLength + Quaternion_default.packedLength;
  41222. }
  41223. FrustumOutlineGeometry.pack = function(value, array, startingIndex) {
  41224. Check_default.typeOf.object("value", value);
  41225. Check_default.defined("array", array);
  41226. startingIndex = defaultValue_default(startingIndex, 0);
  41227. const frustumType = value._frustumType;
  41228. const frustum = value._frustum;
  41229. array[startingIndex++] = frustumType;
  41230. if (frustumType === PERSPECTIVE2) {
  41231. PerspectiveFrustum_default.pack(frustum, array, startingIndex);
  41232. startingIndex += PerspectiveFrustum_default.packedLength;
  41233. } else {
  41234. OrthographicFrustum_default.pack(frustum, array, startingIndex);
  41235. startingIndex += OrthographicFrustum_default.packedLength;
  41236. }
  41237. Cartesian3_default.pack(value._origin, array, startingIndex);
  41238. startingIndex += Cartesian3_default.packedLength;
  41239. Quaternion_default.pack(value._orientation, array, startingIndex);
  41240. startingIndex += Quaternion_default.packedLength;
  41241. array[startingIndex] = value._drawNearPlane ? 1 : 0;
  41242. return array;
  41243. };
  41244. var scratchPackPerspective2 = new PerspectiveFrustum_default();
  41245. var scratchPackOrthographic2 = new OrthographicFrustum_default();
  41246. var scratchPackQuaternion2 = new Quaternion_default();
  41247. var scratchPackorigin2 = new Cartesian3_default();
  41248. FrustumOutlineGeometry.unpack = function(array, startingIndex, result) {
  41249. Check_default.defined("array", array);
  41250. startingIndex = defaultValue_default(startingIndex, 0);
  41251. const frustumType = array[startingIndex++];
  41252. let frustum;
  41253. if (frustumType === PERSPECTIVE2) {
  41254. frustum = PerspectiveFrustum_default.unpack(
  41255. array,
  41256. startingIndex,
  41257. scratchPackPerspective2
  41258. );
  41259. startingIndex += PerspectiveFrustum_default.packedLength;
  41260. } else {
  41261. frustum = OrthographicFrustum_default.unpack(
  41262. array,
  41263. startingIndex,
  41264. scratchPackOrthographic2
  41265. );
  41266. startingIndex += OrthographicFrustum_default.packedLength;
  41267. }
  41268. const origin = Cartesian3_default.unpack(array, startingIndex, scratchPackorigin2);
  41269. startingIndex += Cartesian3_default.packedLength;
  41270. const orientation = Quaternion_default.unpack(
  41271. array,
  41272. startingIndex,
  41273. scratchPackQuaternion2
  41274. );
  41275. startingIndex += Quaternion_default.packedLength;
  41276. const drawNearPlane = array[startingIndex] === 1;
  41277. if (!defined_default(result)) {
  41278. return new FrustumOutlineGeometry({
  41279. frustum,
  41280. origin,
  41281. orientation,
  41282. _drawNearPlane: drawNearPlane
  41283. });
  41284. }
  41285. const frustumResult = frustumType === result._frustumType ? result._frustum : void 0;
  41286. result._frustum = frustum.clone(frustumResult);
  41287. result._frustumType = frustumType;
  41288. result._origin = Cartesian3_default.clone(origin, result._origin);
  41289. result._orientation = Quaternion_default.clone(orientation, result._orientation);
  41290. result._drawNearPlane = drawNearPlane;
  41291. return result;
  41292. };
  41293. FrustumOutlineGeometry.createGeometry = function(frustumGeometry) {
  41294. const frustumType = frustumGeometry._frustumType;
  41295. const frustum = frustumGeometry._frustum;
  41296. const origin = frustumGeometry._origin;
  41297. const orientation = frustumGeometry._orientation;
  41298. const drawNearPlane = frustumGeometry._drawNearPlane;
  41299. const positions = new Float64Array(3 * 4 * 2);
  41300. FrustumGeometry_default._computeNearFarPlanes(
  41301. origin,
  41302. orientation,
  41303. frustumType,
  41304. frustum,
  41305. positions
  41306. );
  41307. const attributes = new GeometryAttributes_default({
  41308. position: new GeometryAttribute_default({
  41309. componentDatatype: ComponentDatatype_default.DOUBLE,
  41310. componentsPerAttribute: 3,
  41311. values: positions
  41312. })
  41313. });
  41314. let offset2;
  41315. let index2;
  41316. const numberOfPlanes = drawNearPlane ? 2 : 1;
  41317. const indices2 = new Uint16Array(8 * (numberOfPlanes + 1));
  41318. let i2 = drawNearPlane ? 0 : 1;
  41319. for (; i2 < 2; ++i2) {
  41320. offset2 = drawNearPlane ? i2 * 8 : 0;
  41321. index2 = i2 * 4;
  41322. indices2[offset2] = index2;
  41323. indices2[offset2 + 1] = index2 + 1;
  41324. indices2[offset2 + 2] = index2 + 1;
  41325. indices2[offset2 + 3] = index2 + 2;
  41326. indices2[offset2 + 4] = index2 + 2;
  41327. indices2[offset2 + 5] = index2 + 3;
  41328. indices2[offset2 + 6] = index2 + 3;
  41329. indices2[offset2 + 7] = index2;
  41330. }
  41331. for (i2 = 0; i2 < 2; ++i2) {
  41332. offset2 = (numberOfPlanes + i2) * 8;
  41333. index2 = i2 * 4;
  41334. indices2[offset2] = index2;
  41335. indices2[offset2 + 1] = index2 + 4;
  41336. indices2[offset2 + 2] = index2 + 1;
  41337. indices2[offset2 + 3] = index2 + 5;
  41338. indices2[offset2 + 4] = index2 + 2;
  41339. indices2[offset2 + 5] = index2 + 6;
  41340. indices2[offset2 + 6] = index2 + 3;
  41341. indices2[offset2 + 7] = index2 + 7;
  41342. }
  41343. return new Geometry_default({
  41344. attributes,
  41345. indices: indices2,
  41346. primitiveType: PrimitiveType_default.LINES,
  41347. boundingSphere: BoundingSphere_default.fromVertices(positions)
  41348. });
  41349. };
  41350. var FrustumOutlineGeometry_default = FrustumOutlineGeometry;
  41351. // node_modules/cesium/Source/Core/GeocodeType.js
  41352. var GeocodeType = {
  41353. SEARCH: 0,
  41354. AUTOCOMPLETE: 1
  41355. };
  41356. var GeocodeType_default = Object.freeze(GeocodeType);
  41357. // node_modules/cesium/Source/Core/GeocoderService.js
  41358. function GeocoderService() {
  41359. }
  41360. GeocoderService.prototype.geocode = DeveloperError_default.throwInstantiationError;
  41361. var GeocoderService_default = GeocoderService;
  41362. // node_modules/cesium/Source/Core/GeometryFactory.js
  41363. function GeometryFactory() {
  41364. DeveloperError_default.throwInstantiationError();
  41365. }
  41366. GeometryFactory.createGeometry = function(geometryFactory) {
  41367. DeveloperError_default.throwInstantiationError();
  41368. };
  41369. var GeometryFactory_default = GeometryFactory;
  41370. // node_modules/cesium/Source/Core/GeometryInstanceAttribute.js
  41371. function GeometryInstanceAttribute(options) {
  41372. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  41373. if (!defined_default(options.componentDatatype)) {
  41374. throw new DeveloperError_default("options.componentDatatype is required.");
  41375. }
  41376. if (!defined_default(options.componentsPerAttribute)) {
  41377. throw new DeveloperError_default("options.componentsPerAttribute is required.");
  41378. }
  41379. if (options.componentsPerAttribute < 1 || options.componentsPerAttribute > 4) {
  41380. throw new DeveloperError_default(
  41381. "options.componentsPerAttribute must be between 1 and 4."
  41382. );
  41383. }
  41384. if (!defined_default(options.value)) {
  41385. throw new DeveloperError_default("options.value is required.");
  41386. }
  41387. this.componentDatatype = options.componentDatatype;
  41388. this.componentsPerAttribute = options.componentsPerAttribute;
  41389. this.normalize = defaultValue_default(options.normalize, false);
  41390. this.value = options.value;
  41391. }
  41392. var GeometryInstanceAttribute_default = GeometryInstanceAttribute;
  41393. // node_modules/cesium/Source/ThirdParty/protobufjs.js
  41394. function _mergeNamespaces(n2, m) {
  41395. m.forEach(function(e2) {
  41396. e2 && typeof e2 !== "string" && !Array.isArray(e2) && Object.keys(e2).forEach(function(k) {
  41397. if (k !== "default" && !(k in n2)) {
  41398. var d = Object.getOwnPropertyDescriptor(e2, k);
  41399. Object.defineProperty(n2, k, d.get ? d : {
  41400. enumerable: true,
  41401. get: function() {
  41402. return e2[k];
  41403. }
  41404. });
  41405. }
  41406. });
  41407. });
  41408. return Object.freeze(n2);
  41409. }
  41410. var protobuf = createCommonjsModule(function(module) {
  41411. (function(global, undefined$1) {
  41412. (function prelude(modules, cache, entries) {
  41413. function $require(name) {
  41414. var $module = cache[name];
  41415. if (!$module)
  41416. modules[name][0].call($module = cache[name] = { exports: {} }, $require, $module, $module.exports);
  41417. return $module.exports;
  41418. }
  41419. var protobuf2 = global.protobuf = $require(entries[0]);
  41420. if (typeof undefined$1 === "function" && undefined$1.amd)
  41421. undefined$1(["long"], function(Long) {
  41422. if (Long && Long.isLong) {
  41423. protobuf2.util.Long = Long;
  41424. protobuf2.configure();
  41425. }
  41426. return protobuf2;
  41427. });
  41428. if (module && module.exports)
  41429. module.exports = protobuf2;
  41430. })({ 1: [function(require2, module2, exports2) {
  41431. module2.exports = asPromise;
  41432. function asPromise(fn, ctx) {
  41433. var params = [];
  41434. for (var i2 = 2; i2 < arguments.length; )
  41435. params.push(arguments[i2++]);
  41436. var pending = true;
  41437. return new Promise(function asPromiseExecutor(resolve2, reject) {
  41438. params.push(function asPromiseCallback(err) {
  41439. if (pending) {
  41440. pending = false;
  41441. if (err)
  41442. reject(err);
  41443. else {
  41444. var args = [];
  41445. for (var i3 = 1; i3 < arguments.length; )
  41446. args.push(arguments[i3++]);
  41447. resolve2.apply(null, args);
  41448. }
  41449. }
  41450. });
  41451. try {
  41452. fn.apply(ctx || this, params);
  41453. } catch (err) {
  41454. if (pending) {
  41455. pending = false;
  41456. reject(err);
  41457. }
  41458. }
  41459. });
  41460. }
  41461. }, {}], 2: [function(require2, module2, exports2) {
  41462. var base64 = exports2;
  41463. base64.length = function length3(string) {
  41464. var p2 = string.length;
  41465. if (!p2)
  41466. return 0;
  41467. var n2 = 0;
  41468. while (--p2 % 4 > 1 && string.charAt(p2) === "=")
  41469. ++n2;
  41470. return Math.ceil(string.length * 3) / 4 - n2;
  41471. };
  41472. var b64 = new Array(64);
  41473. var s64 = new Array(123);
  41474. for (var i2 = 0; i2 < 64; )
  41475. s64[b64[i2] = i2 < 26 ? i2 + 65 : i2 < 52 ? i2 + 71 : i2 < 62 ? i2 - 4 : i2 - 59 | 43] = i2++;
  41476. base64.encode = function encode(buffer, start, end) {
  41477. var string = [];
  41478. var i3 = 0, j = 0, t;
  41479. while (start < end) {
  41480. var b = buffer[start++];
  41481. switch (j) {
  41482. case 0:
  41483. string[i3++] = b64[b >> 2];
  41484. t = (b & 3) << 4;
  41485. j = 1;
  41486. break;
  41487. case 1:
  41488. string[i3++] = b64[t | b >> 4];
  41489. t = (b & 15) << 2;
  41490. j = 2;
  41491. break;
  41492. case 2:
  41493. string[i3++] = b64[t | b >> 6];
  41494. string[i3++] = b64[b & 63];
  41495. j = 0;
  41496. break;
  41497. }
  41498. }
  41499. if (j) {
  41500. string[i3++] = b64[t];
  41501. string[i3] = 61;
  41502. if (j === 1)
  41503. string[i3 + 1] = 61;
  41504. }
  41505. return String.fromCharCode.apply(String, string);
  41506. };
  41507. var invalidEncoding = "invalid encoding";
  41508. base64.decode = function decode(string, buffer, offset2) {
  41509. var start = offset2;
  41510. var j = 0, t;
  41511. for (var i3 = 0; i3 < string.length; ) {
  41512. var c14 = string.charCodeAt(i3++);
  41513. if (c14 === 61 && j > 1)
  41514. break;
  41515. if ((c14 = s64[c14]) === undefined$1)
  41516. throw Error(invalidEncoding);
  41517. switch (j) {
  41518. case 0:
  41519. t = c14;
  41520. j = 1;
  41521. break;
  41522. case 1:
  41523. buffer[offset2++] = t << 2 | (c14 & 48) >> 4;
  41524. t = c14;
  41525. j = 2;
  41526. break;
  41527. case 2:
  41528. buffer[offset2++] = (t & 15) << 4 | (c14 & 60) >> 2;
  41529. t = c14;
  41530. j = 3;
  41531. break;
  41532. case 3:
  41533. buffer[offset2++] = (t & 3) << 6 | c14;
  41534. j = 0;
  41535. break;
  41536. }
  41537. }
  41538. if (j === 1)
  41539. throw Error(invalidEncoding);
  41540. return offset2 - start;
  41541. };
  41542. base64.test = function test(string) {
  41543. return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string);
  41544. };
  41545. }, {}], 3: [function(require2, module2, exports2) {
  41546. module2.exports = EventEmitter;
  41547. function EventEmitter() {
  41548. this._listeners = {};
  41549. }
  41550. EventEmitter.prototype.on = function on(evt, fn, ctx) {
  41551. (this._listeners[evt] || (this._listeners[evt] = [])).push({
  41552. fn,
  41553. ctx: ctx || this
  41554. });
  41555. return this;
  41556. };
  41557. EventEmitter.prototype.off = function off(evt, fn) {
  41558. if (evt === undefined$1)
  41559. this._listeners = {};
  41560. else {
  41561. if (fn === undefined$1)
  41562. this._listeners[evt] = [];
  41563. else {
  41564. var listeners = this._listeners[evt];
  41565. for (var i2 = 0; i2 < listeners.length; )
  41566. if (listeners[i2].fn === fn)
  41567. listeners.splice(i2, 1);
  41568. else
  41569. ++i2;
  41570. }
  41571. }
  41572. return this;
  41573. };
  41574. EventEmitter.prototype.emit = function emit(evt) {
  41575. var listeners = this._listeners[evt];
  41576. if (listeners) {
  41577. var args = [], i2 = 1;
  41578. for (; i2 < arguments.length; )
  41579. args.push(arguments[i2++]);
  41580. for (i2 = 0; i2 < listeners.length; )
  41581. listeners[i2].fn.apply(listeners[i2++].ctx, args);
  41582. }
  41583. return this;
  41584. };
  41585. }, {}], 4: [function(require2, module2, exports2) {
  41586. module2.exports = factory(factory);
  41587. function factory(exports3) {
  41588. if (typeof Float32Array !== "undefined")
  41589. (function() {
  41590. var f32 = new Float32Array([-0]), f8b = new Uint8Array(f32.buffer), le = f8b[3] === 128;
  41591. function writeFloat_f32_cpy(val, buf, pos) {
  41592. f32[0] = val;
  41593. buf[pos] = f8b[0];
  41594. buf[pos + 1] = f8b[1];
  41595. buf[pos + 2] = f8b[2];
  41596. buf[pos + 3] = f8b[3];
  41597. }
  41598. function writeFloat_f32_rev(val, buf, pos) {
  41599. f32[0] = val;
  41600. buf[pos] = f8b[3];
  41601. buf[pos + 1] = f8b[2];
  41602. buf[pos + 2] = f8b[1];
  41603. buf[pos + 3] = f8b[0];
  41604. }
  41605. exports3.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev;
  41606. exports3.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy;
  41607. function readFloat_f32_cpy(buf, pos) {
  41608. f8b[0] = buf[pos];
  41609. f8b[1] = buf[pos + 1];
  41610. f8b[2] = buf[pos + 2];
  41611. f8b[3] = buf[pos + 3];
  41612. return f32[0];
  41613. }
  41614. function readFloat_f32_rev(buf, pos) {
  41615. f8b[3] = buf[pos];
  41616. f8b[2] = buf[pos + 1];
  41617. f8b[1] = buf[pos + 2];
  41618. f8b[0] = buf[pos + 3];
  41619. return f32[0];
  41620. }
  41621. exports3.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev;
  41622. exports3.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy;
  41623. })();
  41624. else
  41625. (function() {
  41626. function writeFloat_ieee754(writeUint, val, buf, pos) {
  41627. var sign3 = val < 0 ? 1 : 0;
  41628. if (sign3)
  41629. val = -val;
  41630. if (val === 0)
  41631. writeUint(1 / val > 0 ? 0 : 2147483648, buf, pos);
  41632. else if (isNaN(val))
  41633. writeUint(2143289344, buf, pos);
  41634. else if (val > 34028234663852886e22)
  41635. writeUint((sign3 << 31 | 2139095040) >>> 0, buf, pos);
  41636. else if (val < 11754943508222875e-54)
  41637. writeUint((sign3 << 31 | Math.round(val / 1401298464324817e-60)) >>> 0, buf, pos);
  41638. else {
  41639. var exponent = Math.floor(Math.log(val) / Math.LN2), mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607;
  41640. writeUint((sign3 << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos);
  41641. }
  41642. }
  41643. exports3.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE);
  41644. exports3.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE);
  41645. function readFloat_ieee754(readUint, buf, pos) {
  41646. var uint = readUint(buf, pos), sign3 = (uint >> 31) * 2 + 1, exponent = uint >>> 23 & 255, mantissa = uint & 8388607;
  41647. return exponent === 255 ? mantissa ? NaN : sign3 * Infinity : exponent === 0 ? sign3 * 1401298464324817e-60 * mantissa : sign3 * Math.pow(2, exponent - 150) * (mantissa + 8388608);
  41648. }
  41649. exports3.readFloatLE = readFloat_ieee754.bind(null, readUintLE);
  41650. exports3.readFloatBE = readFloat_ieee754.bind(null, readUintBE);
  41651. })();
  41652. if (typeof Float64Array !== "undefined")
  41653. (function() {
  41654. var f64 = new Float64Array([-0]), f8b = new Uint8Array(f64.buffer), le = f8b[7] === 128;
  41655. function writeDouble_f64_cpy(val, buf, pos) {
  41656. f64[0] = val;
  41657. buf[pos] = f8b[0];
  41658. buf[pos + 1] = f8b[1];
  41659. buf[pos + 2] = f8b[2];
  41660. buf[pos + 3] = f8b[3];
  41661. buf[pos + 4] = f8b[4];
  41662. buf[pos + 5] = f8b[5];
  41663. buf[pos + 6] = f8b[6];
  41664. buf[pos + 7] = f8b[7];
  41665. }
  41666. function writeDouble_f64_rev(val, buf, pos) {
  41667. f64[0] = val;
  41668. buf[pos] = f8b[7];
  41669. buf[pos + 1] = f8b[6];
  41670. buf[pos + 2] = f8b[5];
  41671. buf[pos + 3] = f8b[4];
  41672. buf[pos + 4] = f8b[3];
  41673. buf[pos + 5] = f8b[2];
  41674. buf[pos + 6] = f8b[1];
  41675. buf[pos + 7] = f8b[0];
  41676. }
  41677. exports3.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev;
  41678. exports3.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy;
  41679. function readDouble_f64_cpy(buf, pos) {
  41680. f8b[0] = buf[pos];
  41681. f8b[1] = buf[pos + 1];
  41682. f8b[2] = buf[pos + 2];
  41683. f8b[3] = buf[pos + 3];
  41684. f8b[4] = buf[pos + 4];
  41685. f8b[5] = buf[pos + 5];
  41686. f8b[6] = buf[pos + 6];
  41687. f8b[7] = buf[pos + 7];
  41688. return f64[0];
  41689. }
  41690. function readDouble_f64_rev(buf, pos) {
  41691. f8b[7] = buf[pos];
  41692. f8b[6] = buf[pos + 1];
  41693. f8b[5] = buf[pos + 2];
  41694. f8b[4] = buf[pos + 3];
  41695. f8b[3] = buf[pos + 4];
  41696. f8b[2] = buf[pos + 5];
  41697. f8b[1] = buf[pos + 6];
  41698. f8b[0] = buf[pos + 7];
  41699. return f64[0];
  41700. }
  41701. exports3.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev;
  41702. exports3.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy;
  41703. })();
  41704. else
  41705. (function() {
  41706. function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) {
  41707. var sign3 = val < 0 ? 1 : 0;
  41708. if (sign3)
  41709. val = -val;
  41710. if (val === 0) {
  41711. writeUint(0, buf, pos + off0);
  41712. writeUint(1 / val > 0 ? 0 : 2147483648, buf, pos + off1);
  41713. } else if (isNaN(val)) {
  41714. writeUint(0, buf, pos + off0);
  41715. writeUint(2146959360, buf, pos + off1);
  41716. } else if (val > 17976931348623157e292) {
  41717. writeUint(0, buf, pos + off0);
  41718. writeUint((sign3 << 31 | 2146435072) >>> 0, buf, pos + off1);
  41719. } else {
  41720. var mantissa;
  41721. if (val < 22250738585072014e-324) {
  41722. mantissa = val / 5e-324;
  41723. writeUint(mantissa >>> 0, buf, pos + off0);
  41724. writeUint((sign3 << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1);
  41725. } else {
  41726. var exponent = Math.floor(Math.log(val) / Math.LN2);
  41727. if (exponent === 1024)
  41728. exponent = 1023;
  41729. mantissa = val * Math.pow(2, -exponent);
  41730. writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0);
  41731. writeUint((sign3 << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1);
  41732. }
  41733. }
  41734. }
  41735. exports3.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4);
  41736. exports3.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0);
  41737. function readDouble_ieee754(readUint, off0, off1, buf, pos) {
  41738. var lo = readUint(buf, pos + off0), hi = readUint(buf, pos + off1);
  41739. var sign3 = (hi >> 31) * 2 + 1, exponent = hi >>> 20 & 2047, mantissa = 4294967296 * (hi & 1048575) + lo;
  41740. return exponent === 2047 ? mantissa ? NaN : sign3 * Infinity : exponent === 0 ? sign3 * 5e-324 * mantissa : sign3 * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496);
  41741. }
  41742. exports3.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4);
  41743. exports3.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0);
  41744. })();
  41745. return exports3;
  41746. }
  41747. function writeUintLE(val, buf, pos) {
  41748. buf[pos] = val & 255;
  41749. buf[pos + 1] = val >>> 8 & 255;
  41750. buf[pos + 2] = val >>> 16 & 255;
  41751. buf[pos + 3] = val >>> 24;
  41752. }
  41753. function writeUintBE(val, buf, pos) {
  41754. buf[pos] = val >>> 24;
  41755. buf[pos + 1] = val >>> 16 & 255;
  41756. buf[pos + 2] = val >>> 8 & 255;
  41757. buf[pos + 3] = val & 255;
  41758. }
  41759. function readUintLE(buf, pos) {
  41760. return (buf[pos] | buf[pos + 1] << 8 | buf[pos + 2] << 16 | buf[pos + 3] << 24) >>> 0;
  41761. }
  41762. function readUintBE(buf, pos) {
  41763. return (buf[pos] << 24 | buf[pos + 1] << 16 | buf[pos + 2] << 8 | buf[pos + 3]) >>> 0;
  41764. }
  41765. }, {}], 5: [function(require, module, exports) {
  41766. module.exports = inquire;
  41767. function inquire(moduleName) {
  41768. try {
  41769. var mod = eval("quire".replace(/^/, "re"))(moduleName);
  41770. if (mod && (mod.length || Object.keys(mod).length))
  41771. return mod;
  41772. } catch (e2) {
  41773. }
  41774. return null;
  41775. }
  41776. }, {}], 6: [function(require2, module2, exports2) {
  41777. module2.exports = pool2;
  41778. function pool2(alloc, slice, size) {
  41779. var SIZE = size || 8192;
  41780. var MAX = SIZE >>> 1;
  41781. var slab = null;
  41782. var offset2 = SIZE;
  41783. return function pool_alloc(size2) {
  41784. if (size2 < 1 || size2 > MAX)
  41785. return alloc(size2);
  41786. if (offset2 + size2 > SIZE) {
  41787. slab = alloc(SIZE);
  41788. offset2 = 0;
  41789. }
  41790. var buf = slice.call(slab, offset2, offset2 += size2);
  41791. if (offset2 & 7)
  41792. offset2 = (offset2 | 7) + 1;
  41793. return buf;
  41794. };
  41795. }
  41796. }, {}], 7: [function(require2, module2, exports2) {
  41797. var utf8 = exports2;
  41798. utf8.length = function utf8_length(string) {
  41799. var len = 0, c14 = 0;
  41800. for (var i2 = 0; i2 < string.length; ++i2) {
  41801. c14 = string.charCodeAt(i2);
  41802. if (c14 < 128)
  41803. len += 1;
  41804. else if (c14 < 2048)
  41805. len += 2;
  41806. else if ((c14 & 64512) === 55296 && (string.charCodeAt(i2 + 1) & 64512) === 56320) {
  41807. ++i2;
  41808. len += 4;
  41809. } else
  41810. len += 3;
  41811. }
  41812. return len;
  41813. };
  41814. utf8.read = function utf8_read(buffer, start, end) {
  41815. var len = end - start;
  41816. if (len < 1)
  41817. return "";
  41818. var parts = null, chunk = [], i2 = 0, t;
  41819. while (start < end) {
  41820. t = buffer[start++];
  41821. if (t < 128)
  41822. chunk[i2++] = t;
  41823. else if (t > 191 && t < 224)
  41824. chunk[i2++] = (t & 31) << 6 | buffer[start++] & 63;
  41825. else if (t > 239 && t < 365) {
  41826. t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 65536;
  41827. chunk[i2++] = 55296 + (t >> 10);
  41828. chunk[i2++] = 56320 + (t & 1023);
  41829. } else
  41830. chunk[i2++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63;
  41831. if (i2 > 8191) {
  41832. (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk));
  41833. i2 = 0;
  41834. }
  41835. }
  41836. if (parts) {
  41837. if (i2)
  41838. parts.push(String.fromCharCode.apply(String, chunk.slice(0, i2)));
  41839. return parts.join("");
  41840. }
  41841. return String.fromCharCode.apply(String, chunk.slice(0, i2));
  41842. };
  41843. utf8.write = function utf8_write(string, buffer, offset2) {
  41844. var start = offset2, c14, c22;
  41845. for (var i2 = 0; i2 < string.length; ++i2) {
  41846. c14 = string.charCodeAt(i2);
  41847. if (c14 < 128) {
  41848. buffer[offset2++] = c14;
  41849. } else if (c14 < 2048) {
  41850. buffer[offset2++] = c14 >> 6 | 192;
  41851. buffer[offset2++] = c14 & 63 | 128;
  41852. } else if ((c14 & 64512) === 55296 && ((c22 = string.charCodeAt(i2 + 1)) & 64512) === 56320) {
  41853. c14 = 65536 + ((c14 & 1023) << 10) + (c22 & 1023);
  41854. ++i2;
  41855. buffer[offset2++] = c14 >> 18 | 240;
  41856. buffer[offset2++] = c14 >> 12 & 63 | 128;
  41857. buffer[offset2++] = c14 >> 6 & 63 | 128;
  41858. buffer[offset2++] = c14 & 63 | 128;
  41859. } else {
  41860. buffer[offset2++] = c14 >> 12 | 224;
  41861. buffer[offset2++] = c14 >> 6 & 63 | 128;
  41862. buffer[offset2++] = c14 & 63 | 128;
  41863. }
  41864. }
  41865. return offset2 - start;
  41866. };
  41867. }, {}], 8: [function(require2, module2, exports2) {
  41868. var protobuf2 = exports2;
  41869. protobuf2.build = "minimal";
  41870. protobuf2.roots = {};
  41871. protobuf2.Writer = require2(15);
  41872. protobuf2.BufferWriter = require2(16);
  41873. protobuf2.Reader = require2(9);
  41874. protobuf2.BufferReader = require2(10);
  41875. protobuf2.util = require2(14);
  41876. protobuf2.rpc = require2(11);
  41877. protobuf2.configure = configure2;
  41878. function configure2() {
  41879. protobuf2.Reader._configure(protobuf2.BufferReader);
  41880. protobuf2.util._configure();
  41881. }
  41882. protobuf2.Writer._configure(protobuf2.BufferWriter);
  41883. configure2();
  41884. }, { "10": 10, "11": 11, "14": 14, "15": 15, "16": 16, "9": 9 }], 9: [function(require2, module2, exports2) {
  41885. module2.exports = Reader2;
  41886. var util = require2(14);
  41887. var BufferReader;
  41888. var LongBits = util.LongBits, utf8 = util.utf8;
  41889. function indexOutOfRange(reader, writeLength) {
  41890. return RangeError("index out of range: " + reader.pos + " + " + (writeLength || 1) + " > " + reader.len);
  41891. }
  41892. function Reader2(buffer) {
  41893. this.buf = buffer;
  41894. this.pos = 0;
  41895. this.len = buffer.length;
  41896. }
  41897. var create_array = typeof Uint8Array !== "undefined" ? function create_typed_array(buffer) {
  41898. if (buffer instanceof Uint8Array || Array.isArray(buffer))
  41899. return new Reader2(buffer);
  41900. throw Error("illegal buffer");
  41901. } : function create_array2(buffer) {
  41902. if (Array.isArray(buffer))
  41903. return new Reader2(buffer);
  41904. throw Error("illegal buffer");
  41905. };
  41906. Reader2.create = util.Buffer ? function create_buffer_setup(buffer) {
  41907. return (Reader2.create = function create_buffer(buffer2) {
  41908. return util.Buffer.isBuffer(buffer2) ? new BufferReader(buffer2) : create_array(buffer2);
  41909. })(buffer);
  41910. } : create_array;
  41911. Reader2.prototype._slice = util.Array.prototype.subarray || util.Array.prototype.slice;
  41912. Reader2.prototype.uint32 = function read_uint32_setup() {
  41913. var value = 4294967295;
  41914. return function read_uint32() {
  41915. value = (this.buf[this.pos] & 127) >>> 0;
  41916. if (this.buf[this.pos++] < 128)
  41917. return value;
  41918. value = (value | (this.buf[this.pos] & 127) << 7) >>> 0;
  41919. if (this.buf[this.pos++] < 128)
  41920. return value;
  41921. value = (value | (this.buf[this.pos] & 127) << 14) >>> 0;
  41922. if (this.buf[this.pos++] < 128)
  41923. return value;
  41924. value = (value | (this.buf[this.pos] & 127) << 21) >>> 0;
  41925. if (this.buf[this.pos++] < 128)
  41926. return value;
  41927. value = (value | (this.buf[this.pos] & 15) << 28) >>> 0;
  41928. if (this.buf[this.pos++] < 128)
  41929. return value;
  41930. if ((this.pos += 5) > this.len) {
  41931. this.pos = this.len;
  41932. throw indexOutOfRange(this, 10);
  41933. }
  41934. return value;
  41935. };
  41936. }();
  41937. Reader2.prototype.int32 = function read_int32() {
  41938. return this.uint32() | 0;
  41939. };
  41940. Reader2.prototype.sint32 = function read_sint32() {
  41941. var value = this.uint32();
  41942. return value >>> 1 ^ -(value & 1) | 0;
  41943. };
  41944. function readLongVarint() {
  41945. var bits = new LongBits(0, 0);
  41946. var i2 = 0;
  41947. if (this.len - this.pos > 4) {
  41948. for (; i2 < 4; ++i2) {
  41949. bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i2 * 7) >>> 0;
  41950. if (this.buf[this.pos++] < 128)
  41951. return bits;
  41952. }
  41953. bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0;
  41954. bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0;
  41955. if (this.buf[this.pos++] < 128)
  41956. return bits;
  41957. i2 = 0;
  41958. } else {
  41959. for (; i2 < 3; ++i2) {
  41960. if (this.pos >= this.len)
  41961. throw indexOutOfRange(this);
  41962. bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i2 * 7) >>> 0;
  41963. if (this.buf[this.pos++] < 128)
  41964. return bits;
  41965. }
  41966. bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i2 * 7) >>> 0;
  41967. return bits;
  41968. }
  41969. if (this.len - this.pos > 4) {
  41970. for (; i2 < 5; ++i2) {
  41971. bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i2 * 7 + 3) >>> 0;
  41972. if (this.buf[this.pos++] < 128)
  41973. return bits;
  41974. }
  41975. } else {
  41976. for (; i2 < 5; ++i2) {
  41977. if (this.pos >= this.len)
  41978. throw indexOutOfRange(this);
  41979. bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i2 * 7 + 3) >>> 0;
  41980. if (this.buf[this.pos++] < 128)
  41981. return bits;
  41982. }
  41983. }
  41984. throw Error("invalid varint encoding");
  41985. }
  41986. Reader2.prototype.bool = function read_bool() {
  41987. return this.uint32() !== 0;
  41988. };
  41989. function readFixed32_end(buf, end) {
  41990. return (buf[end - 4] | buf[end - 3] << 8 | buf[end - 2] << 16 | buf[end - 1] << 24) >>> 0;
  41991. }
  41992. Reader2.prototype.fixed32 = function read_fixed32() {
  41993. if (this.pos + 4 > this.len)
  41994. throw indexOutOfRange(this, 4);
  41995. return readFixed32_end(this.buf, this.pos += 4);
  41996. };
  41997. Reader2.prototype.sfixed32 = function read_sfixed32() {
  41998. if (this.pos + 4 > this.len)
  41999. throw indexOutOfRange(this, 4);
  42000. return readFixed32_end(this.buf, this.pos += 4) | 0;
  42001. };
  42002. function readFixed64() {
  42003. if (this.pos + 8 > this.len)
  42004. throw indexOutOfRange(this, 8);
  42005. return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4));
  42006. }
  42007. Reader2.prototype.float = function read_float() {
  42008. if (this.pos + 4 > this.len)
  42009. throw indexOutOfRange(this, 4);
  42010. var value = util.float.readFloatLE(this.buf, this.pos);
  42011. this.pos += 4;
  42012. return value;
  42013. };
  42014. Reader2.prototype.double = function read_double() {
  42015. if (this.pos + 8 > this.len)
  42016. throw indexOutOfRange(this, 4);
  42017. var value = util.float.readDoubleLE(this.buf, this.pos);
  42018. this.pos += 8;
  42019. return value;
  42020. };
  42021. Reader2.prototype.bytes = function read_bytes() {
  42022. var length3 = this.uint32(), start = this.pos, end = this.pos + length3;
  42023. if (end > this.len)
  42024. throw indexOutOfRange(this, length3);
  42025. this.pos += length3;
  42026. return start === end ? new this.buf.constructor(0) : this._slice.call(this.buf, start, end);
  42027. };
  42028. Reader2.prototype.string = function read_string() {
  42029. var bytes = this.bytes();
  42030. return utf8.read(bytes, 0, bytes.length);
  42031. };
  42032. Reader2.prototype.skip = function skip(length3) {
  42033. if (typeof length3 === "number") {
  42034. if (this.pos + length3 > this.len)
  42035. throw indexOutOfRange(this, length3);
  42036. this.pos += length3;
  42037. } else {
  42038. do {
  42039. if (this.pos >= this.len)
  42040. throw indexOutOfRange(this);
  42041. } while (this.buf[this.pos++] & 128);
  42042. }
  42043. return this;
  42044. };
  42045. Reader2.prototype.skipType = function(wireType) {
  42046. switch (wireType) {
  42047. case 0:
  42048. this.skip();
  42049. break;
  42050. case 1:
  42051. this.skip(8);
  42052. break;
  42053. case 2:
  42054. this.skip(this.uint32());
  42055. break;
  42056. case 3:
  42057. do {
  42058. if ((wireType = this.uint32() & 7) === 4)
  42059. break;
  42060. this.skipType(wireType);
  42061. } while (true);
  42062. break;
  42063. case 5:
  42064. this.skip(4);
  42065. break;
  42066. default:
  42067. throw Error("invalid wire type " + wireType + " at offset " + this.pos);
  42068. }
  42069. return this;
  42070. };
  42071. Reader2._configure = function(BufferReader_) {
  42072. BufferReader = BufferReader_;
  42073. var fn = util.Long ? "toLong" : "toNumber";
  42074. util.merge(Reader2.prototype, {
  42075. int64: function read_int64() {
  42076. return readLongVarint.call(this)[fn](false);
  42077. },
  42078. uint64: function read_uint64() {
  42079. return readLongVarint.call(this)[fn](true);
  42080. },
  42081. sint64: function read_sint64() {
  42082. return readLongVarint.call(this).zzDecode()[fn](false);
  42083. },
  42084. fixed64: function read_fixed64() {
  42085. return readFixed64.call(this)[fn](true);
  42086. },
  42087. sfixed64: function read_sfixed64() {
  42088. return readFixed64.call(this)[fn](false);
  42089. }
  42090. });
  42091. };
  42092. }, { "14": 14 }], 10: [function(require2, module2, exports2) {
  42093. module2.exports = BufferReader;
  42094. var Reader2 = require2(9);
  42095. (BufferReader.prototype = Object.create(Reader2.prototype)).constructor = BufferReader;
  42096. var util = require2(14);
  42097. function BufferReader(buffer) {
  42098. Reader2.call(this, buffer);
  42099. }
  42100. if (util.Buffer)
  42101. BufferReader.prototype._slice = util.Buffer.prototype.slice;
  42102. BufferReader.prototype.string = function read_string_buffer() {
  42103. var len = this.uint32();
  42104. return this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len));
  42105. };
  42106. }, { "14": 14, "9": 9 }], 11: [function(require2, module2, exports2) {
  42107. var rpc = exports2;
  42108. rpc.Service = require2(12);
  42109. }, { "12": 12 }], 12: [function(require2, module2, exports2) {
  42110. module2.exports = Service;
  42111. var util = require2(14);
  42112. (Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service;
  42113. function Service(rpcImpl, requestDelimited, responseDelimited) {
  42114. if (typeof rpcImpl !== "function")
  42115. throw TypeError("rpcImpl must be a function");
  42116. util.EventEmitter.call(this);
  42117. this.rpcImpl = rpcImpl;
  42118. this.requestDelimited = Boolean(requestDelimited);
  42119. this.responseDelimited = Boolean(responseDelimited);
  42120. }
  42121. Service.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) {
  42122. if (!request)
  42123. throw TypeError("request must be specified");
  42124. var self2 = this;
  42125. if (!callback)
  42126. return util.asPromise(rpcCall, self2, method, requestCtor, responseCtor, request);
  42127. if (!self2.rpcImpl) {
  42128. setTimeout(function() {
  42129. callback(Error("already ended"));
  42130. }, 0);
  42131. return undefined$1;
  42132. }
  42133. try {
  42134. return self2.rpcImpl(
  42135. method,
  42136. requestCtor[self2.requestDelimited ? "encodeDelimited" : "encode"](request).finish(),
  42137. function rpcCallback(err, response) {
  42138. if (err) {
  42139. self2.emit("error", err, method);
  42140. return callback(err);
  42141. }
  42142. if (response === null) {
  42143. self2.end(true);
  42144. return undefined$1;
  42145. }
  42146. if (!(response instanceof responseCtor)) {
  42147. try {
  42148. response = responseCtor[self2.responseDelimited ? "decodeDelimited" : "decode"](response);
  42149. } catch (err2) {
  42150. self2.emit("error", err2, method);
  42151. return callback(err2);
  42152. }
  42153. }
  42154. self2.emit("data", response, method);
  42155. return callback(null, response);
  42156. }
  42157. );
  42158. } catch (err) {
  42159. self2.emit("error", err, method);
  42160. setTimeout(function() {
  42161. callback(err);
  42162. }, 0);
  42163. return undefined$1;
  42164. }
  42165. };
  42166. Service.prototype.end = function end(endedByRPC) {
  42167. if (this.rpcImpl) {
  42168. if (!endedByRPC)
  42169. this.rpcImpl(null, null, null);
  42170. this.rpcImpl = null;
  42171. this.emit("end").off();
  42172. }
  42173. return this;
  42174. };
  42175. }, { "14": 14 }], 13: [function(require2, module2, exports2) {
  42176. module2.exports = LongBits;
  42177. var util = require2(14);
  42178. function LongBits(lo, hi) {
  42179. this.lo = lo >>> 0;
  42180. this.hi = hi >>> 0;
  42181. }
  42182. var zero = LongBits.zero = new LongBits(0, 0);
  42183. zero.toNumber = function() {
  42184. return 0;
  42185. };
  42186. zero.zzEncode = zero.zzDecode = function() {
  42187. return this;
  42188. };
  42189. zero.length = function() {
  42190. return 1;
  42191. };
  42192. var zeroHash = LongBits.zeroHash = "\0\0\0\0\0\0\0\0";
  42193. LongBits.fromNumber = function fromNumber(value) {
  42194. if (value === 0)
  42195. return zero;
  42196. var sign3 = value < 0;
  42197. if (sign3)
  42198. value = -value;
  42199. var lo = value >>> 0, hi = (value - lo) / 4294967296 >>> 0;
  42200. if (sign3) {
  42201. hi = ~hi >>> 0;
  42202. lo = ~lo >>> 0;
  42203. if (++lo > 4294967295) {
  42204. lo = 0;
  42205. if (++hi > 4294967295)
  42206. hi = 0;
  42207. }
  42208. }
  42209. return new LongBits(lo, hi);
  42210. };
  42211. LongBits.from = function from(value) {
  42212. if (typeof value === "number")
  42213. return LongBits.fromNumber(value);
  42214. if (util.isString(value)) {
  42215. if (util.Long)
  42216. value = util.Long.fromString(value);
  42217. else
  42218. return LongBits.fromNumber(parseInt(value, 10));
  42219. }
  42220. return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero;
  42221. };
  42222. LongBits.prototype.toNumber = function toNumber(unsigned) {
  42223. if (!unsigned && this.hi >>> 31) {
  42224. var lo = ~this.lo + 1 >>> 0, hi = ~this.hi >>> 0;
  42225. if (!lo)
  42226. hi = hi + 1 >>> 0;
  42227. return -(lo + hi * 4294967296);
  42228. }
  42229. return this.lo + this.hi * 4294967296;
  42230. };
  42231. LongBits.prototype.toLong = function toLong(unsigned) {
  42232. return util.Long ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned)) : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) };
  42233. };
  42234. var charCodeAt = String.prototype.charCodeAt;
  42235. LongBits.fromHash = function fromHash(hash2) {
  42236. if (hash2 === zeroHash)
  42237. return zero;
  42238. return new LongBits(
  42239. (charCodeAt.call(hash2, 0) | charCodeAt.call(hash2, 1) << 8 | charCodeAt.call(hash2, 2) << 16 | charCodeAt.call(hash2, 3) << 24) >>> 0,
  42240. (charCodeAt.call(hash2, 4) | charCodeAt.call(hash2, 5) << 8 | charCodeAt.call(hash2, 6) << 16 | charCodeAt.call(hash2, 7) << 24) >>> 0
  42241. );
  42242. };
  42243. LongBits.prototype.toHash = function toHash() {
  42244. return String.fromCharCode(
  42245. this.lo & 255,
  42246. this.lo >>> 8 & 255,
  42247. this.lo >>> 16 & 255,
  42248. this.lo >>> 24,
  42249. this.hi & 255,
  42250. this.hi >>> 8 & 255,
  42251. this.hi >>> 16 & 255,
  42252. this.hi >>> 24
  42253. );
  42254. };
  42255. LongBits.prototype.zzEncode = function zzEncode() {
  42256. var mask = this.hi >> 31;
  42257. this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0;
  42258. this.lo = (this.lo << 1 ^ mask) >>> 0;
  42259. return this;
  42260. };
  42261. LongBits.prototype.zzDecode = function zzDecode() {
  42262. var mask = -(this.lo & 1);
  42263. this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0;
  42264. this.hi = (this.hi >>> 1 ^ mask) >>> 0;
  42265. return this;
  42266. };
  42267. LongBits.prototype.length = function length3() {
  42268. var part0 = this.lo, part1 = (this.lo >>> 28 | this.hi << 4) >>> 0, part2 = this.hi >>> 24;
  42269. return part2 === 0 ? part1 === 0 ? part0 < 16384 ? part0 < 128 ? 1 : 2 : part0 < 2097152 ? 3 : 4 : part1 < 16384 ? part1 < 128 ? 5 : 6 : part1 < 2097152 ? 7 : 8 : part2 < 128 ? 9 : 10;
  42270. };
  42271. }, { "14": 14 }], 14: [function(require2, module2, exports2) {
  42272. var util = exports2;
  42273. util.asPromise = require2(1);
  42274. util.base64 = require2(2);
  42275. util.EventEmitter = require2(3);
  42276. util.float = require2(4);
  42277. util.inquire = require2(5);
  42278. util.utf8 = require2(7);
  42279. util.pool = require2(6);
  42280. util.LongBits = require2(13);
  42281. util.emptyArray = Object.freeze ? Object.freeze([]) : [];
  42282. util.emptyObject = Object.freeze ? Object.freeze({}) : {};
  42283. util.isNode = Boolean(global.process && global.process.versions && global.process.versions.node);
  42284. util.isInteger = Number.isInteger || function isInteger(value) {
  42285. return typeof value === "number" && isFinite(value) && Math.floor(value) === value;
  42286. };
  42287. util.isString = function isString(value) {
  42288. return typeof value === "string" || value instanceof String;
  42289. };
  42290. util.isObject = function isObject(value) {
  42291. return value && typeof value === "object";
  42292. };
  42293. util.isset = util.isSet = function isSet(obj, prop) {
  42294. var value = obj[prop];
  42295. if (value != null && obj.hasOwnProperty(prop))
  42296. return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0;
  42297. return false;
  42298. };
  42299. util.Buffer = function() {
  42300. try {
  42301. var Buffer3 = util.inquire("buffer").Buffer;
  42302. return Buffer3.prototype.utf8Write ? Buffer3 : null;
  42303. } catch (e2) {
  42304. return null;
  42305. }
  42306. }();
  42307. util._Buffer_from = null;
  42308. util._Buffer_allocUnsafe = null;
  42309. util.newBuffer = function newBuffer(sizeOrArray) {
  42310. return typeof sizeOrArray === "number" ? util.Buffer ? util._Buffer_allocUnsafe(sizeOrArray) : new util.Array(sizeOrArray) : util.Buffer ? util._Buffer_from(sizeOrArray) : typeof Uint8Array === "undefined" ? sizeOrArray : new Uint8Array(sizeOrArray);
  42311. };
  42312. util.Array = typeof Uint8Array !== "undefined" ? Uint8Array : Array;
  42313. util.Long = global.dcodeIO && global.dcodeIO.Long || util.inquire("long");
  42314. util.key2Re = /^true|false|0|1$/;
  42315. util.key32Re = /^-?(?:0|[1-9][0-9]*)$/;
  42316. util.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;
  42317. util.longToHash = function longToHash(value) {
  42318. return value ? util.LongBits.from(value).toHash() : util.LongBits.zeroHash;
  42319. };
  42320. util.longFromHash = function longFromHash(hash2, unsigned) {
  42321. var bits = util.LongBits.fromHash(hash2);
  42322. if (util.Long)
  42323. return util.Long.fromBits(bits.lo, bits.hi, unsigned);
  42324. return bits.toNumber(Boolean(unsigned));
  42325. };
  42326. function merge3(dst, src2, ifNotSet) {
  42327. for (var keys = Object.keys(src2), i2 = 0; i2 < keys.length; ++i2)
  42328. if (dst[keys[i2]] === undefined$1 || !ifNotSet)
  42329. dst[keys[i2]] = src2[keys[i2]];
  42330. return dst;
  42331. }
  42332. util.merge = merge3;
  42333. util.lcFirst = function lcFirst(str) {
  42334. return str.charAt(0).toLowerCase() + str.substring(1);
  42335. };
  42336. function newError(name) {
  42337. function CustomError(message, properties) {
  42338. if (!(this instanceof CustomError))
  42339. return new CustomError(message, properties);
  42340. Object.defineProperty(this, "message", { get: function() {
  42341. return message;
  42342. } });
  42343. if (Error.captureStackTrace)
  42344. Error.captureStackTrace(this, CustomError);
  42345. else
  42346. Object.defineProperty(this, "stack", { value: new Error().stack || "" });
  42347. if (properties)
  42348. merge3(this, properties);
  42349. }
  42350. (CustomError.prototype = Object.create(Error.prototype)).constructor = CustomError;
  42351. Object.defineProperty(CustomError.prototype, "name", { get: function() {
  42352. return name;
  42353. } });
  42354. CustomError.prototype.toString = function toString2() {
  42355. return this.name + ": " + this.message;
  42356. };
  42357. return CustomError;
  42358. }
  42359. util.newError = newError;
  42360. util.ProtocolError = newError("ProtocolError");
  42361. util.oneOfGetter = function getOneOf(fieldNames) {
  42362. var fieldMap = {};
  42363. for (var i2 = 0; i2 < fieldNames.length; ++i2)
  42364. fieldMap[fieldNames[i2]] = 1;
  42365. return function() {
  42366. for (var keys = Object.keys(this), i3 = keys.length - 1; i3 > -1; --i3)
  42367. if (fieldMap[keys[i3]] === 1 && this[keys[i3]] !== undefined$1 && this[keys[i3]] !== null)
  42368. return keys[i3];
  42369. };
  42370. };
  42371. util.oneOfSetter = function setOneOf(fieldNames) {
  42372. return function(name) {
  42373. for (var i2 = 0; i2 < fieldNames.length; ++i2)
  42374. if (fieldNames[i2] !== name)
  42375. delete this[fieldNames[i2]];
  42376. };
  42377. };
  42378. util.lazyResolve = function lazyResolve(root, lazyTypes) {
  42379. for (var i2 = 0; i2 < lazyTypes.length; ++i2) {
  42380. for (var keys = Object.keys(lazyTypes[i2]), j = 0; j < keys.length; ++j) {
  42381. var path = lazyTypes[i2][keys[j]].split("."), ptr = root;
  42382. while (path.length)
  42383. ptr = ptr[path.shift()];
  42384. lazyTypes[i2][keys[j]] = ptr;
  42385. }
  42386. }
  42387. };
  42388. util.toJSONOptions = {
  42389. longs: String,
  42390. enums: String,
  42391. bytes: String
  42392. };
  42393. util._configure = function() {
  42394. var Buffer3 = util.Buffer;
  42395. if (!Buffer3) {
  42396. util._Buffer_from = util._Buffer_allocUnsafe = null;
  42397. return;
  42398. }
  42399. util._Buffer_from = Buffer3.from !== Uint8Array.from && Buffer3.from || function Buffer_from(value, encoding) {
  42400. return new Buffer3(value, encoding);
  42401. };
  42402. util._Buffer_allocUnsafe = Buffer3.allocUnsafe || function Buffer_allocUnsafe(size) {
  42403. return new Buffer3(size);
  42404. };
  42405. };
  42406. }, { "1": 1, "13": 13, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6, "7": 7 }], 15: [function(require2, module2, exports2) {
  42407. module2.exports = Writer2;
  42408. var util = require2(14);
  42409. var BufferWriter;
  42410. var LongBits = util.LongBits, base64 = util.base64, utf8 = util.utf8;
  42411. function Op(fn, len, val) {
  42412. this.fn = fn;
  42413. this.len = len;
  42414. this.next = undefined$1;
  42415. this.val = val;
  42416. }
  42417. function noop() {
  42418. }
  42419. function State(writer) {
  42420. this.head = writer.head;
  42421. this.tail = writer.tail;
  42422. this.len = writer.len;
  42423. this.next = writer.states;
  42424. }
  42425. function Writer2() {
  42426. this.len = 0;
  42427. this.head = new Op(noop, 0, 0);
  42428. this.tail = this.head;
  42429. this.states = null;
  42430. }
  42431. Writer2.create = util.Buffer ? function create_buffer_setup() {
  42432. return (Writer2.create = function create_buffer() {
  42433. return new BufferWriter();
  42434. })();
  42435. } : function create_array() {
  42436. return new Writer2();
  42437. };
  42438. Writer2.alloc = function alloc(size) {
  42439. return new util.Array(size);
  42440. };
  42441. if (util.Array !== Array)
  42442. Writer2.alloc = util.pool(Writer2.alloc, util.Array.prototype.subarray);
  42443. Writer2.prototype.push = function push(fn, len, val) {
  42444. this.tail = this.tail.next = new Op(fn, len, val);
  42445. this.len += len;
  42446. return this;
  42447. };
  42448. function writeByte(val, buf, pos) {
  42449. buf[pos] = val & 255;
  42450. }
  42451. function writeVarint32(val, buf, pos) {
  42452. while (val > 127) {
  42453. buf[pos++] = val & 127 | 128;
  42454. val >>>= 7;
  42455. }
  42456. buf[pos] = val;
  42457. }
  42458. function VarintOp(len, val) {
  42459. this.len = len;
  42460. this.next = undefined$1;
  42461. this.val = val;
  42462. }
  42463. VarintOp.prototype = Object.create(Op.prototype);
  42464. VarintOp.prototype.fn = writeVarint32;
  42465. Writer2.prototype.uint32 = function write_uint32(value) {
  42466. this.len += (this.tail = this.tail.next = new VarintOp(
  42467. (value = value >>> 0) < 128 ? 1 : value < 16384 ? 2 : value < 2097152 ? 3 : value < 268435456 ? 4 : 5,
  42468. value
  42469. )).len;
  42470. return this;
  42471. };
  42472. Writer2.prototype.int32 = function write_int32(value) {
  42473. return value < 0 ? this.push(writeVarint64, 10, LongBits.fromNumber(value)) : this.uint32(value);
  42474. };
  42475. Writer2.prototype.sint32 = function write_sint32(value) {
  42476. return this.uint32((value << 1 ^ value >> 31) >>> 0);
  42477. };
  42478. function writeVarint64(val, buf, pos) {
  42479. while (val.hi) {
  42480. buf[pos++] = val.lo & 127 | 128;
  42481. val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0;
  42482. val.hi >>>= 7;
  42483. }
  42484. while (val.lo > 127) {
  42485. buf[pos++] = val.lo & 127 | 128;
  42486. val.lo = val.lo >>> 7;
  42487. }
  42488. buf[pos++] = val.lo;
  42489. }
  42490. Writer2.prototype.uint64 = function write_uint64(value) {
  42491. var bits = LongBits.from(value);
  42492. return this.push(writeVarint64, bits.length(), bits);
  42493. };
  42494. Writer2.prototype.int64 = Writer2.prototype.uint64;
  42495. Writer2.prototype.sint64 = function write_sint64(value) {
  42496. var bits = LongBits.from(value).zzEncode();
  42497. return this.push(writeVarint64, bits.length(), bits);
  42498. };
  42499. Writer2.prototype.bool = function write_bool(value) {
  42500. return this.push(writeByte, 1, value ? 1 : 0);
  42501. };
  42502. function writeFixed32(val, buf, pos) {
  42503. buf[pos] = val & 255;
  42504. buf[pos + 1] = val >>> 8 & 255;
  42505. buf[pos + 2] = val >>> 16 & 255;
  42506. buf[pos + 3] = val >>> 24;
  42507. }
  42508. Writer2.prototype.fixed32 = function write_fixed32(value) {
  42509. return this.push(writeFixed32, 4, value >>> 0);
  42510. };
  42511. Writer2.prototype.sfixed32 = Writer2.prototype.fixed32;
  42512. Writer2.prototype.fixed64 = function write_fixed64(value) {
  42513. var bits = LongBits.from(value);
  42514. return this.push(writeFixed32, 4, bits.lo).push(writeFixed32, 4, bits.hi);
  42515. };
  42516. Writer2.prototype.sfixed64 = Writer2.prototype.fixed64;
  42517. Writer2.prototype.float = function write_float(value) {
  42518. return this.push(util.float.writeFloatLE, 4, value);
  42519. };
  42520. Writer2.prototype.double = function write_double(value) {
  42521. return this.push(util.float.writeDoubleLE, 8, value);
  42522. };
  42523. var writeBytes = util.Array.prototype.set ? function writeBytes_set(val, buf, pos) {
  42524. buf.set(val, pos);
  42525. } : function writeBytes_for(val, buf, pos) {
  42526. for (var i2 = 0; i2 < val.length; ++i2)
  42527. buf[pos + i2] = val[i2];
  42528. };
  42529. Writer2.prototype.bytes = function write_bytes(value) {
  42530. var len = value.length >>> 0;
  42531. if (!len)
  42532. return this.push(writeByte, 1, 0);
  42533. if (util.isString(value)) {
  42534. var buf = Writer2.alloc(len = base64.length(value));
  42535. base64.decode(value, buf, 0);
  42536. value = buf;
  42537. }
  42538. return this.uint32(len).push(writeBytes, len, value);
  42539. };
  42540. Writer2.prototype.string = function write_string(value) {
  42541. var len = utf8.length(value);
  42542. return len ? this.uint32(len).push(utf8.write, len, value) : this.push(writeByte, 1, 0);
  42543. };
  42544. Writer2.prototype.fork = function fork() {
  42545. this.states = new State(this);
  42546. this.head = this.tail = new Op(noop, 0, 0);
  42547. this.len = 0;
  42548. return this;
  42549. };
  42550. Writer2.prototype.reset = function reset() {
  42551. if (this.states) {
  42552. this.head = this.states.head;
  42553. this.tail = this.states.tail;
  42554. this.len = this.states.len;
  42555. this.states = this.states.next;
  42556. } else {
  42557. this.head = this.tail = new Op(noop, 0, 0);
  42558. this.len = 0;
  42559. }
  42560. return this;
  42561. };
  42562. Writer2.prototype.ldelim = function ldelim() {
  42563. var head = this.head, tail = this.tail, len = this.len;
  42564. this.reset().uint32(len);
  42565. if (len) {
  42566. this.tail.next = head.next;
  42567. this.tail = tail;
  42568. this.len += len;
  42569. }
  42570. return this;
  42571. };
  42572. Writer2.prototype.finish = function finish() {
  42573. var head = this.head.next, buf = this.constructor.alloc(this.len), pos = 0;
  42574. while (head) {
  42575. head.fn(head.val, buf, pos);
  42576. pos += head.len;
  42577. head = head.next;
  42578. }
  42579. return buf;
  42580. };
  42581. Writer2._configure = function(BufferWriter_) {
  42582. BufferWriter = BufferWriter_;
  42583. };
  42584. }, { "14": 14 }], 16: [function(require2, module2, exports2) {
  42585. module2.exports = BufferWriter;
  42586. var Writer2 = require2(15);
  42587. (BufferWriter.prototype = Object.create(Writer2.prototype)).constructor = BufferWriter;
  42588. var util = require2(14);
  42589. var Buffer3 = util.Buffer;
  42590. function BufferWriter() {
  42591. Writer2.call(this);
  42592. }
  42593. BufferWriter.alloc = function alloc_buffer(size) {
  42594. return (BufferWriter.alloc = util._Buffer_allocUnsafe)(size);
  42595. };
  42596. var writeBytesBuffer = Buffer3 && Buffer3.prototype instanceof Uint8Array && Buffer3.prototype.set.name === "set" ? function writeBytesBuffer_set(val, buf, pos) {
  42597. buf.set(val, pos);
  42598. } : function writeBytesBuffer_copy(val, buf, pos) {
  42599. if (val.copy)
  42600. val.copy(buf, pos, 0, val.length);
  42601. else
  42602. for (var i2 = 0; i2 < val.length; )
  42603. buf[pos++] = val[i2++];
  42604. };
  42605. BufferWriter.prototype.bytes = function write_bytes_buffer(value) {
  42606. if (util.isString(value))
  42607. value = util._Buffer_from(value, "base64");
  42608. var len = value.length >>> 0;
  42609. this.uint32(len);
  42610. if (len)
  42611. this.push(writeBytesBuffer, len, value);
  42612. return this;
  42613. };
  42614. function writeStringBuffer(val, buf, pos) {
  42615. if (val.length < 40)
  42616. util.utf8.write(val, buf, pos);
  42617. else
  42618. buf.utf8Write(val, pos);
  42619. }
  42620. BufferWriter.prototype.string = function write_string_buffer(value) {
  42621. var len = Buffer3.byteLength(value);
  42622. this.uint32(len);
  42623. if (len)
  42624. this.push(writeStringBuffer, len, value);
  42625. return this;
  42626. };
  42627. }, { "14": 14, "15": 15 }] }, {}, [8]);
  42628. })(typeof window === "object" && window || typeof self === "object" && self || commonjsGlobal);
  42629. });
  42630. var protobuf$1 = _mergeNamespaces({
  42631. __proto__: null,
  42632. "default": protobuf
  42633. }, [protobuf]);
  42634. // node_modules/cesium/Source/Core/isBitSet.js
  42635. function isBitSet(bits, mask) {
  42636. return (bits & mask) !== 0;
  42637. }
  42638. var isBitSet_default = isBitSet;
  42639. // node_modules/cesium/Source/Core/GoogleEarthEnterpriseTileInformation.js
  42640. var childrenBitmasks = [1, 2, 4, 8];
  42641. var anyChildBitmask = 15;
  42642. var cacheFlagBitmask = 16;
  42643. var imageBitmask = 64;
  42644. var terrainBitmask = 128;
  42645. function GoogleEarthEnterpriseTileInformation(bits, cnodeVersion, imageryVersion, terrainVersion, imageryProvider, terrainProvider) {
  42646. this._bits = bits;
  42647. this.cnodeVersion = cnodeVersion;
  42648. this.imageryVersion = imageryVersion;
  42649. this.terrainVersion = terrainVersion;
  42650. this.imageryProvider = imageryProvider;
  42651. this.terrainProvider = terrainProvider;
  42652. this.ancestorHasTerrain = false;
  42653. this.terrainState = void 0;
  42654. }
  42655. GoogleEarthEnterpriseTileInformation.clone = function(info, result) {
  42656. if (!defined_default(result)) {
  42657. result = new GoogleEarthEnterpriseTileInformation(
  42658. info._bits,
  42659. info.cnodeVersion,
  42660. info.imageryVersion,
  42661. info.terrainVersion,
  42662. info.imageryProvider,
  42663. info.terrainProvider
  42664. );
  42665. } else {
  42666. result._bits = info._bits;
  42667. result.cnodeVersion = info.cnodeVersion;
  42668. result.imageryVersion = info.imageryVersion;
  42669. result.terrainVersion = info.terrainVersion;
  42670. result.imageryProvider = info.imageryProvider;
  42671. result.terrainProvider = info.terrainProvider;
  42672. }
  42673. result.ancestorHasTerrain = info.ancestorHasTerrain;
  42674. result.terrainState = info.terrainState;
  42675. return result;
  42676. };
  42677. GoogleEarthEnterpriseTileInformation.prototype.setParent = function(parent) {
  42678. this.ancestorHasTerrain = parent.ancestorHasTerrain || this.hasTerrain();
  42679. };
  42680. GoogleEarthEnterpriseTileInformation.prototype.hasSubtree = function() {
  42681. return isBitSet_default(this._bits, cacheFlagBitmask);
  42682. };
  42683. GoogleEarthEnterpriseTileInformation.prototype.hasImagery = function() {
  42684. return isBitSet_default(this._bits, imageBitmask);
  42685. };
  42686. GoogleEarthEnterpriseTileInformation.prototype.hasTerrain = function() {
  42687. return isBitSet_default(this._bits, terrainBitmask);
  42688. };
  42689. GoogleEarthEnterpriseTileInformation.prototype.hasChildren = function() {
  42690. return isBitSet_default(this._bits, anyChildBitmask);
  42691. };
  42692. GoogleEarthEnterpriseTileInformation.prototype.hasChild = function(index2) {
  42693. return isBitSet_default(this._bits, childrenBitmasks[index2]);
  42694. };
  42695. GoogleEarthEnterpriseTileInformation.prototype.getChildBitmask = function() {
  42696. return this._bits & anyChildBitmask;
  42697. };
  42698. var GoogleEarthEnterpriseTileInformation_default = GoogleEarthEnterpriseTileInformation;
  42699. // node_modules/cesium/Source/Core/GoogleEarthEnterpriseMetadata.js
  42700. function stringToBuffer(str) {
  42701. const len = str.length;
  42702. const buffer = new ArrayBuffer(len);
  42703. const ui8 = new Uint8Array(buffer);
  42704. for (let i2 = 0; i2 < len; ++i2) {
  42705. ui8[i2] = str.charCodeAt(i2);
  42706. }
  42707. return buffer;
  42708. }
  42709. var defaultKey = stringToBuffer(
  42710. `E\xF4\xBD\vy\xE2jE"\x92,\xCDq\xF8IFgQ\0B%\xC6\xE8a,f)\b\xC64\xDCjb%y
  42711. wmi\xD6\xF0\x9Ck\x93\xA1\xBDNu\xE0A[\xDF@V\f\xD9\xBBr\x9B\x81|3S\xEEOl\xD4q\xB0{\xC0\x7FEVZ\xADwUe\v3\x92*\xACl5\xC50s\xF83>mF8J\xB4\xDD\xF0.\xDDu\xDA\x8CDt"\xFAa"\f3"So\xAF9D\v\x8C9\xD99L\xB9\xBF\x7F\xAB\\\x8CP_\x9F"ux\xE9\x07q\x91h;\xC1\xC4\x9B\x7F\xF0<VqH\x82'UfYNe\x98u\xA3aF}a?A\0\x9F\xD7\xB44M\xCE\x87F\xB0\xD5\xB8\x8A'{\x8B\xDC+\xBBMg0\xC8\xD1\xF6\\\x8FP\xFA[/F\x9Bn5/'C.\xEB
  42712. \f^\xA5s\x1Be4\xE5l.jC'c#U\xA9?q{gC}:\xAF\xCD\xE2TU\x9C\xFDK\xC6\xE2\x9F/(\xED\xCB\\\xC6-f\x07\x88\xA7;/*"N\xB0k.\xDD\r\x95}}G\xBAC\xB2\xB2+>M\xAA>}\xE6\xCEI\x89\xC6\xE6x\fa1-\xA4O\xA5~q \x88\xEC\r1\xE8N\v\0nPh}=\b\r\x95\xA6n\xA3h\x97$[k\xF3#\xF3\xB6s\xB3\r\v@\xC0\x9F\xD8Q]\xFA".j\xDFI\0\xB9\xA0wU\xC6\xEFj\xBF{GL\x7F\x83\xEE\xDC\xDCF\x85\xA9\xADS\x07+S4\x07\xFF\x94Y\xE48\xE81\x83N\xB9XFk\xCB-#\x86\x92p\x005\x88"\xCF1\xB2&/\xE7\xC3u-6,rt\xB0#G\xB7\xD3\xD1&\x857r\xE2\0\x8CD\xCF\xDA3-\xDE\`\x86i#i*|\xCDKQ\r\x95T9w.)\xEA\x1B\xA6P\xA2j\x8FoP\x99\\>T\xFB\xEFP[\v\x07E\x89m(w7\xDB\x8EJfJo\x99 \xE5p\xE2\xB9q~\fmI-z\xFEr\xC7\xF2Y0\x8F\xBB]s\xE5\xC9 \xEAx\xEC \x90\xF0\x8A\x7FB|G\`\xB0\xBD&\xB7q\xB6\xC7\x9F\xD13\x82=\xD3\xAB\xEEc\x99\xC8+S\xA0D\\q\xC6\xCCD2O<\xCA\xC0)=R\xD3aX\xA9}e\xB4\xDC\xCF\r\xF4=\xF1\b\xA9B\xDA# \xD8\xBF^PI\xF8M\xC0\xCBGLO\xF7{+\xD8\xC51\x92;\xB5o\xDCl\r\x92\x88\xD1\x9E\xDB?\xE2\xE9\xDA_\xD4\x84\xE2FaZ\xDEU\xCF\xA4\0\xBE\xFD\xCEg\xF1Ji\x97\xE6 H\xD8]\x7F~\xAEq N\xAE\xC0V\xA9\x91<\x82r\xE7v\xEC)I\xD6]-\x83\xE3\xDB6\xA9;f\x97\x87j\xD5\xB6=P^R\xB9K\xC7sWx\xC9\xF4.Y\x07\x95\x93o\xD0KW>''\xC7\`\xDB;\xED\x9ASD>?\x8D\x92mw\xA2
  42713. \xEB?R\xA8\xC6U^1I7\x85\xF4\xC5&-\xA9\xBF\x8B'T\xDA\xC3j \xE5*x\xB0\xD6\x90pr\xAA\x8Bh\xBD\x88\xF7_H\xB1~\xC0XL?f\xF9>\xE1e\xC0p\xA7\xCF8i\xAF\xF0VldI\x9C'\xADxtO\xC2\x87\xDEV9\0\xDAw\v\xCB-\x1B\x89\xFB5O\xF5\bQ\`\xC1
  42714. ZGM&30x\xDA\xC0\x9CFG\xE2[y\`In7gS
  42715. >\xE9\xECF9\xB2\xF14\r\xC6\x84Sun\xE1\fY\xD9\xDE)\x85{II\xA5wy\xBEIV.6\xE7\v:\xBBOb{\xD2M1\x95/\xBD8{\xA8O!\xE1\xECFpv\x95})"x\x88
  42716. \x90\xDD\x9D\\\xDA\xDEQ\xCF\xF0\xFCYRe|3\xDF\xF3H\xDA\xBB*u\xDB\`\xB2\xD4\xFC\xED\x1B\xEC\x7F5\xA8\xFF(1\x07-\xC8\xDC\x88F|\x8A["`
  42717. );
  42718. function GoogleEarthEnterpriseMetadata(resourceOrUrl) {
  42719. Check_default.defined("resourceOrUrl", resourceOrUrl);
  42720. let url2 = resourceOrUrl;
  42721. if (typeof url2 !== "string" && !(url2 instanceof Resource_default)) {
  42722. Check_default.typeOf.string("resourceOrUrl.url", resourceOrUrl.url);
  42723. url2 = resourceOrUrl.url;
  42724. }
  42725. const resource = Resource_default.createIfNeeded(url2);
  42726. resource.appendForwardSlash();
  42727. this._resource = resource;
  42728. this.imageryPresent = true;
  42729. this.protoImagery = void 0;
  42730. this.terrainPresent = true;
  42731. this.negativeAltitudeExponentBias = 32;
  42732. this.negativeAltitudeThreshold = Math_default.EPSILON12;
  42733. this.providers = {};
  42734. this.key = void 0;
  42735. this._quadPacketVersion = 1;
  42736. this._tileInfo = {};
  42737. this._subtreePromises = {};
  42738. const that = this;
  42739. this._readyPromise = requestDbRoot(this).then(function() {
  42740. return that.getQuadTreePacket("", that._quadPacketVersion);
  42741. }).then(function() {
  42742. return true;
  42743. }).catch(function(e2) {
  42744. const message = `An error occurred while accessing ${getMetadataResource(that, "", 1).url}.`;
  42745. return Promise.reject(new RuntimeError_default(message));
  42746. });
  42747. }
  42748. Object.defineProperties(GoogleEarthEnterpriseMetadata.prototype, {
  42749. url: {
  42750. get: function() {
  42751. return this._resource.url;
  42752. }
  42753. },
  42754. proxy: {
  42755. get: function() {
  42756. return this._resource.proxy;
  42757. }
  42758. },
  42759. resource: {
  42760. get: function() {
  42761. return this._resource;
  42762. }
  42763. },
  42764. readyPromise: {
  42765. get: function() {
  42766. return this._readyPromise;
  42767. }
  42768. }
  42769. });
  42770. GoogleEarthEnterpriseMetadata.tileXYToQuadKey = function(x, y, level) {
  42771. let quadkey = "";
  42772. for (let i2 = level; i2 >= 0; --i2) {
  42773. const bitmask = 1 << i2;
  42774. let digit = 0;
  42775. if (!isBitSet_default(y, bitmask)) {
  42776. digit |= 2;
  42777. if (!isBitSet_default(x, bitmask)) {
  42778. digit |= 1;
  42779. }
  42780. } else if (isBitSet_default(x, bitmask)) {
  42781. digit |= 1;
  42782. }
  42783. quadkey += digit;
  42784. }
  42785. return quadkey;
  42786. };
  42787. GoogleEarthEnterpriseMetadata.quadKeyToTileXY = function(quadkey) {
  42788. let x = 0;
  42789. let y = 0;
  42790. const level = quadkey.length - 1;
  42791. for (let i2 = level; i2 >= 0; --i2) {
  42792. const bitmask = 1 << i2;
  42793. const digit = +quadkey[level - i2];
  42794. if (isBitSet_default(digit, 2)) {
  42795. if (!isBitSet_default(digit, 1)) {
  42796. x |= bitmask;
  42797. }
  42798. } else {
  42799. y |= bitmask;
  42800. if (isBitSet_default(digit, 1)) {
  42801. x |= bitmask;
  42802. }
  42803. }
  42804. }
  42805. return {
  42806. x,
  42807. y,
  42808. level
  42809. };
  42810. };
  42811. GoogleEarthEnterpriseMetadata.prototype.isValid = function(quadKey) {
  42812. let info = this.getTileInformationFromQuadKey(quadKey);
  42813. if (defined_default(info)) {
  42814. return info !== null;
  42815. }
  42816. let valid = true;
  42817. let q = quadKey;
  42818. let last;
  42819. while (q.length > 1) {
  42820. last = q.substring(q.length - 1);
  42821. q = q.substring(0, q.length - 1);
  42822. info = this.getTileInformationFromQuadKey(q);
  42823. if (defined_default(info)) {
  42824. if (!info.hasSubtree() && !info.hasChild(parseInt(last))) {
  42825. valid = false;
  42826. }
  42827. break;
  42828. } else if (info === null) {
  42829. valid = false;
  42830. break;
  42831. }
  42832. }
  42833. return valid;
  42834. };
  42835. var taskProcessor = new TaskProcessor_default("decodeGoogleEarthEnterprisePacket");
  42836. GoogleEarthEnterpriseMetadata.prototype.getQuadTreePacket = function(quadKey, version, request) {
  42837. version = defaultValue_default(version, 1);
  42838. quadKey = defaultValue_default(quadKey, "");
  42839. const resource = getMetadataResource(this, quadKey, version, request);
  42840. const promise = resource.fetchArrayBuffer();
  42841. if (!defined_default(promise)) {
  42842. return void 0;
  42843. }
  42844. const tileInfo = this._tileInfo;
  42845. const key = this.key;
  42846. return promise.then(function(metadata) {
  42847. const decodePromise = taskProcessor.scheduleTask(
  42848. {
  42849. buffer: metadata,
  42850. quadKey,
  42851. type: "Metadata",
  42852. key
  42853. },
  42854. [metadata]
  42855. );
  42856. return decodePromise.then(function(result) {
  42857. let root;
  42858. let topLevelKeyLength = -1;
  42859. if (quadKey !== "") {
  42860. topLevelKeyLength = quadKey.length + 1;
  42861. const top = result[quadKey];
  42862. root = tileInfo[quadKey];
  42863. root._bits |= top._bits;
  42864. delete result[quadKey];
  42865. }
  42866. const keys = Object.keys(result);
  42867. keys.sort(function(a4, b) {
  42868. return a4.length - b.length;
  42869. });
  42870. const keysLength = keys.length;
  42871. for (let i2 = 0; i2 < keysLength; ++i2) {
  42872. const key2 = keys[i2];
  42873. const r2 = result[key2];
  42874. if (r2 !== null) {
  42875. const info = GoogleEarthEnterpriseTileInformation_default.clone(result[key2]);
  42876. const keyLength = key2.length;
  42877. if (keyLength === topLevelKeyLength) {
  42878. info.setParent(root);
  42879. } else if (keyLength > 1) {
  42880. const parent = tileInfo[key2.substring(0, key2.length - 1)];
  42881. info.setParent(parent);
  42882. }
  42883. tileInfo[key2] = info;
  42884. } else {
  42885. tileInfo[key2] = null;
  42886. }
  42887. }
  42888. });
  42889. });
  42890. };
  42891. GoogleEarthEnterpriseMetadata.prototype.populateSubtree = function(x, y, level, request) {
  42892. const quadkey = GoogleEarthEnterpriseMetadata.tileXYToQuadKey(x, y, level);
  42893. return populateSubtree(this, quadkey, request);
  42894. };
  42895. function populateSubtree(that, quadKey, request) {
  42896. const tileInfo = that._tileInfo;
  42897. let q = quadKey;
  42898. let t = tileInfo[q];
  42899. if (defined_default(t) && (!t.hasSubtree() || t.hasChildren())) {
  42900. return t;
  42901. }
  42902. while (t === void 0 && q.length > 1) {
  42903. q = q.substring(0, q.length - 1);
  42904. t = tileInfo[q];
  42905. }
  42906. let subtreeRequest;
  42907. const subtreePromises = that._subtreePromises;
  42908. let promise = subtreePromises[q];
  42909. if (defined_default(promise)) {
  42910. return promise.then(function() {
  42911. subtreeRequest = new Request_default({
  42912. throttle: request.throttle,
  42913. throttleByServer: request.throttleByServer,
  42914. type: request.type,
  42915. priorityFunction: request.priorityFunction
  42916. });
  42917. return populateSubtree(that, quadKey, subtreeRequest);
  42918. });
  42919. }
  42920. if (!defined_default(t) || !t.hasSubtree()) {
  42921. return Promise.reject(
  42922. new RuntimeError_default(`Couldn't load metadata for tile ${quadKey}`)
  42923. );
  42924. }
  42925. promise = that.getQuadTreePacket(q, t.cnodeVersion, request);
  42926. if (!defined_default(promise)) {
  42927. return void 0;
  42928. }
  42929. subtreePromises[q] = promise;
  42930. return promise.then(function() {
  42931. subtreeRequest = new Request_default({
  42932. throttle: request.throttle,
  42933. throttleByServer: request.throttleByServer,
  42934. type: request.type,
  42935. priorityFunction: request.priorityFunction
  42936. });
  42937. return populateSubtree(that, quadKey, subtreeRequest);
  42938. }).finally(function() {
  42939. delete subtreePromises[q];
  42940. });
  42941. }
  42942. GoogleEarthEnterpriseMetadata.prototype.getTileInformation = function(x, y, level) {
  42943. const quadkey = GoogleEarthEnterpriseMetadata.tileXYToQuadKey(x, y, level);
  42944. return this._tileInfo[quadkey];
  42945. };
  42946. GoogleEarthEnterpriseMetadata.prototype.getTileInformationFromQuadKey = function(quadkey) {
  42947. return this._tileInfo[quadkey];
  42948. };
  42949. function getMetadataResource(that, quadKey, version, request) {
  42950. return that._resource.getDerivedResource({
  42951. url: `flatfile?q2-0${quadKey}-q.${version.toString()}`,
  42952. request
  42953. });
  42954. }
  42955. var dbrootParser;
  42956. var dbrootParserPromise;
  42957. function requestDbRoot(that) {
  42958. const resource = that._resource.getDerivedResource({
  42959. url: "dbRoot.v5",
  42960. queryParameters: {
  42961. output: "proto"
  42962. }
  42963. });
  42964. if (!defined_default(dbrootParserPromise)) {
  42965. const url2 = buildModuleUrl_default("ThirdParty/google-earth-dbroot-parser.js");
  42966. const oldValue2 = window.cesiumGoogleEarthDbRootParser;
  42967. dbrootParserPromise = loadAndExecuteScript_default(url2).then(function() {
  42968. dbrootParser = window.cesiumGoogleEarthDbRootParser(protobuf$1);
  42969. if (defined_default(oldValue2)) {
  42970. window.cesiumGoogleEarthDbRootParser = oldValue2;
  42971. } else {
  42972. delete window.cesiumGoogleEarthDbRootParser;
  42973. }
  42974. });
  42975. }
  42976. return dbrootParserPromise.then(function() {
  42977. return resource.fetchArrayBuffer();
  42978. }).then(function(buf) {
  42979. const encryptedDbRootProto = dbrootParser.EncryptedDbRootProto.decode(
  42980. new Uint8Array(buf)
  42981. );
  42982. let byteArray = encryptedDbRootProto.encryptionData;
  42983. let offset2 = byteArray.byteOffset;
  42984. let end = offset2 + byteArray.byteLength;
  42985. const key = that.key = byteArray.buffer.slice(offset2, end);
  42986. byteArray = encryptedDbRootProto.dbrootData;
  42987. offset2 = byteArray.byteOffset;
  42988. end = offset2 + byteArray.byteLength;
  42989. const dbRootCompressed = byteArray.buffer.slice(offset2, end);
  42990. return taskProcessor.scheduleTask(
  42991. {
  42992. buffer: dbRootCompressed,
  42993. type: "DbRoot",
  42994. key
  42995. },
  42996. [dbRootCompressed]
  42997. );
  42998. }).then(function(result) {
  42999. const dbRoot = dbrootParser.DbRootProto.decode(
  43000. new Uint8Array(result.buffer)
  43001. );
  43002. that.imageryPresent = defaultValue_default(
  43003. dbRoot.imageryPresent,
  43004. that.imageryPresent
  43005. );
  43006. that.protoImagery = dbRoot.protoImagery;
  43007. that.terrainPresent = defaultValue_default(
  43008. dbRoot.terrainPresent,
  43009. that.terrainPresent
  43010. );
  43011. if (defined_default(dbRoot.endSnippet) && defined_default(dbRoot.endSnippet.model)) {
  43012. const model = dbRoot.endSnippet.model;
  43013. that.negativeAltitudeExponentBias = defaultValue_default(
  43014. model.negativeAltitudeExponentBias,
  43015. that.negativeAltitudeExponentBias
  43016. );
  43017. that.negativeAltitudeThreshold = defaultValue_default(
  43018. model.compressedNegativeAltitudeThreshold,
  43019. that.negativeAltitudeThreshold
  43020. );
  43021. }
  43022. if (defined_default(dbRoot.databaseVersion)) {
  43023. that._quadPacketVersion = defaultValue_default(
  43024. dbRoot.databaseVersion.quadtreeVersion,
  43025. that._quadPacketVersion
  43026. );
  43027. }
  43028. const providers = that.providers;
  43029. const providerInfo = defaultValue_default(dbRoot.providerInfo, []);
  43030. const count = providerInfo.length;
  43031. for (let i2 = 0; i2 < count; ++i2) {
  43032. const provider = providerInfo[i2];
  43033. const copyrightString = provider.copyrightString;
  43034. if (defined_default(copyrightString)) {
  43035. providers[provider.providerId] = new Credit_default(copyrightString.value);
  43036. }
  43037. }
  43038. }).catch(function() {
  43039. console.log(`Failed to retrieve ${resource.url}. Using defaults.`);
  43040. that.key = defaultKey;
  43041. });
  43042. }
  43043. var GoogleEarthEnterpriseMetadata_default = GoogleEarthEnterpriseMetadata;
  43044. // node_modules/cesium/Source/Core/GoogleEarthEnterpriseTerrainData.js
  43045. function GoogleEarthEnterpriseTerrainData(options) {
  43046. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  43047. Check_default.typeOf.object("options.buffer", options.buffer);
  43048. Check_default.typeOf.number(
  43049. "options.negativeAltitudeExponentBias",
  43050. options.negativeAltitudeExponentBias
  43051. );
  43052. Check_default.typeOf.number(
  43053. "options.negativeElevationThreshold",
  43054. options.negativeElevationThreshold
  43055. );
  43056. this._buffer = options.buffer;
  43057. this._credits = options.credits;
  43058. this._negativeAltitudeExponentBias = options.negativeAltitudeExponentBias;
  43059. this._negativeElevationThreshold = options.negativeElevationThreshold;
  43060. const googleChildTileMask = defaultValue_default(options.childTileMask, 15);
  43061. let childTileMask = googleChildTileMask & 3;
  43062. childTileMask |= googleChildTileMask & 4 ? 8 : 0;
  43063. childTileMask |= googleChildTileMask & 8 ? 4 : 0;
  43064. this._childTileMask = childTileMask;
  43065. this._createdByUpsampling = defaultValue_default(options.createdByUpsampling, false);
  43066. this._skirtHeight = void 0;
  43067. this._bufferType = this._buffer.constructor;
  43068. this._mesh = void 0;
  43069. this._minimumHeight = void 0;
  43070. this._maximumHeight = void 0;
  43071. }
  43072. Object.defineProperties(GoogleEarthEnterpriseTerrainData.prototype, {
  43073. credits: {
  43074. get: function() {
  43075. return this._credits;
  43076. }
  43077. },
  43078. waterMask: {
  43079. get: function() {
  43080. return void 0;
  43081. }
  43082. }
  43083. });
  43084. var createMeshTaskName3 = "createVerticesFromGoogleEarthEnterpriseBuffer";
  43085. var createMeshTaskProcessorNoThrottle3 = new TaskProcessor_default(createMeshTaskName3);
  43086. var createMeshTaskProcessorThrottle3 = new TaskProcessor_default(
  43087. createMeshTaskName3,
  43088. TerrainData_default.maximumAsynchronousTasks
  43089. );
  43090. var nativeRectangleScratch = new Rectangle_default();
  43091. var rectangleScratch2 = new Rectangle_default();
  43092. GoogleEarthEnterpriseTerrainData.prototype.createMesh = function(options) {
  43093. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  43094. Check_default.typeOf.object("options.tilingScheme", options.tilingScheme);
  43095. Check_default.typeOf.number("options.x", options.x);
  43096. Check_default.typeOf.number("options.y", options.y);
  43097. Check_default.typeOf.number("options.level", options.level);
  43098. const tilingScheme2 = options.tilingScheme;
  43099. const x = options.x;
  43100. const y = options.y;
  43101. const level = options.level;
  43102. const exaggeration = defaultValue_default(options.exaggeration, 1);
  43103. const exaggerationRelativeHeight = defaultValue_default(
  43104. options.exaggerationRelativeHeight,
  43105. 0
  43106. );
  43107. const throttle = defaultValue_default(options.throttle, true);
  43108. const ellipsoid = tilingScheme2.ellipsoid;
  43109. tilingScheme2.tileXYToNativeRectangle(x, y, level, nativeRectangleScratch);
  43110. tilingScheme2.tileXYToRectangle(x, y, level, rectangleScratch2);
  43111. const center = ellipsoid.cartographicToCartesian(
  43112. Rectangle_default.center(rectangleScratch2)
  43113. );
  43114. const levelZeroMaxError = 40075.16;
  43115. const thisLevelMaxError = levelZeroMaxError / (1 << level);
  43116. this._skirtHeight = Math.min(thisLevelMaxError * 8, 1e3);
  43117. const createMeshTaskProcessor = throttle ? createMeshTaskProcessorThrottle3 : createMeshTaskProcessorNoThrottle3;
  43118. const verticesPromise = createMeshTaskProcessor.scheduleTask({
  43119. buffer: this._buffer,
  43120. nativeRectangle: nativeRectangleScratch,
  43121. rectangle: rectangleScratch2,
  43122. relativeToCenter: center,
  43123. ellipsoid,
  43124. skirtHeight: this._skirtHeight,
  43125. exaggeration,
  43126. exaggerationRelativeHeight,
  43127. includeWebMercatorT: true,
  43128. negativeAltitudeExponentBias: this._negativeAltitudeExponentBias,
  43129. negativeElevationThreshold: this._negativeElevationThreshold
  43130. });
  43131. if (!defined_default(verticesPromise)) {
  43132. return void 0;
  43133. }
  43134. const that = this;
  43135. return verticesPromise.then(function(result) {
  43136. that._mesh = new TerrainMesh_default(
  43137. center,
  43138. new Float32Array(result.vertices),
  43139. new Uint16Array(result.indices),
  43140. result.indexCountWithoutSkirts,
  43141. result.vertexCountWithoutSkirts,
  43142. result.minimumHeight,
  43143. result.maximumHeight,
  43144. BoundingSphere_default.clone(result.boundingSphere3D),
  43145. Cartesian3_default.clone(result.occludeePointInScaledSpace),
  43146. result.numberOfAttributes,
  43147. OrientedBoundingBox_default.clone(result.orientedBoundingBox),
  43148. TerrainEncoding_default.clone(result.encoding),
  43149. result.westIndicesSouthToNorth,
  43150. result.southIndicesEastToWest,
  43151. result.eastIndicesNorthToSouth,
  43152. result.northIndicesWestToEast
  43153. );
  43154. that._minimumHeight = result.minimumHeight;
  43155. that._maximumHeight = result.maximumHeight;
  43156. that._buffer = void 0;
  43157. return that._mesh;
  43158. });
  43159. };
  43160. GoogleEarthEnterpriseTerrainData.prototype.interpolateHeight = function(rectangle, longitude, latitude) {
  43161. const u3 = Math_default.clamp(
  43162. (longitude - rectangle.west) / rectangle.width,
  43163. 0,
  43164. 1
  43165. );
  43166. const v7 = Math_default.clamp(
  43167. (latitude - rectangle.south) / rectangle.height,
  43168. 0,
  43169. 1
  43170. );
  43171. if (!defined_default(this._mesh)) {
  43172. return interpolateHeight3(this, u3, v7, rectangle);
  43173. }
  43174. return interpolateMeshHeight3(this, u3, v7);
  43175. };
  43176. var upsampleTaskProcessor2 = new TaskProcessor_default(
  43177. "upsampleQuantizedTerrainMesh",
  43178. TerrainData_default.maximumAsynchronousTasks
  43179. );
  43180. GoogleEarthEnterpriseTerrainData.prototype.upsample = function(tilingScheme2, thisX, thisY, thisLevel, descendantX, descendantY, descendantLevel) {
  43181. Check_default.typeOf.object("tilingScheme", tilingScheme2);
  43182. Check_default.typeOf.number("thisX", thisX);
  43183. Check_default.typeOf.number("thisY", thisY);
  43184. Check_default.typeOf.number("thisLevel", thisLevel);
  43185. Check_default.typeOf.number("descendantX", descendantX);
  43186. Check_default.typeOf.number("descendantY", descendantY);
  43187. Check_default.typeOf.number("descendantLevel", descendantLevel);
  43188. const levelDifference = descendantLevel - thisLevel;
  43189. if (levelDifference > 1) {
  43190. throw new DeveloperError_default(
  43191. "Upsampling through more than one level at a time is not currently supported."
  43192. );
  43193. }
  43194. const mesh2 = this._mesh;
  43195. if (!defined_default(this._mesh)) {
  43196. return void 0;
  43197. }
  43198. const isEastChild = thisX * 2 !== descendantX;
  43199. const isNorthChild = thisY * 2 === descendantY;
  43200. const ellipsoid = tilingScheme2.ellipsoid;
  43201. const childRectangle = tilingScheme2.tileXYToRectangle(
  43202. descendantX,
  43203. descendantY,
  43204. descendantLevel
  43205. );
  43206. const upsamplePromise = upsampleTaskProcessor2.scheduleTask({
  43207. vertices: mesh2.vertices,
  43208. indices: mesh2.indices,
  43209. indexCountWithoutSkirts: mesh2.indexCountWithoutSkirts,
  43210. vertexCountWithoutSkirts: mesh2.vertexCountWithoutSkirts,
  43211. encoding: mesh2.encoding,
  43212. minimumHeight: this._minimumHeight,
  43213. maximumHeight: this._maximumHeight,
  43214. isEastChild,
  43215. isNorthChild,
  43216. childRectangle,
  43217. ellipsoid
  43218. });
  43219. if (!defined_default(upsamplePromise)) {
  43220. return void 0;
  43221. }
  43222. const that = this;
  43223. return upsamplePromise.then(function(result) {
  43224. const quantizedVertices = new Uint16Array(result.vertices);
  43225. const indicesTypedArray = IndexDatatype_default.createTypedArray(
  43226. quantizedVertices.length / 3,
  43227. result.indices
  43228. );
  43229. const skirtHeight = that._skirtHeight;
  43230. return new QuantizedMeshTerrainData_default({
  43231. quantizedVertices,
  43232. indices: indicesTypedArray,
  43233. minimumHeight: result.minimumHeight,
  43234. maximumHeight: result.maximumHeight,
  43235. boundingSphere: BoundingSphere_default.clone(result.boundingSphere),
  43236. orientedBoundingBox: OrientedBoundingBox_default.clone(
  43237. result.orientedBoundingBox
  43238. ),
  43239. horizonOcclusionPoint: Cartesian3_default.clone(result.horizonOcclusionPoint),
  43240. westIndices: result.westIndices,
  43241. southIndices: result.southIndices,
  43242. eastIndices: result.eastIndices,
  43243. northIndices: result.northIndices,
  43244. westSkirtHeight: skirtHeight,
  43245. southSkirtHeight: skirtHeight,
  43246. eastSkirtHeight: skirtHeight,
  43247. northSkirtHeight: skirtHeight,
  43248. childTileMask: 0,
  43249. createdByUpsampling: true,
  43250. credits: that._credits
  43251. });
  43252. });
  43253. };
  43254. GoogleEarthEnterpriseTerrainData.prototype.isChildAvailable = function(thisX, thisY, childX, childY) {
  43255. Check_default.typeOf.number("thisX", thisX);
  43256. Check_default.typeOf.number("thisY", thisY);
  43257. Check_default.typeOf.number("childX", childX);
  43258. Check_default.typeOf.number("childY", childY);
  43259. let bitNumber = 2;
  43260. if (childX !== thisX * 2) {
  43261. ++bitNumber;
  43262. }
  43263. if (childY !== thisY * 2) {
  43264. bitNumber -= 2;
  43265. }
  43266. return (this._childTileMask & 1 << bitNumber) !== 0;
  43267. };
  43268. GoogleEarthEnterpriseTerrainData.prototype.wasCreatedByUpsampling = function() {
  43269. return this._createdByUpsampling;
  43270. };
  43271. var texCoordScratch02 = new Cartesian2_default();
  43272. var texCoordScratch12 = new Cartesian2_default();
  43273. var texCoordScratch22 = new Cartesian2_default();
  43274. var barycentricCoordinateScratch2 = new Cartesian3_default();
  43275. function interpolateMeshHeight3(terrainData, u3, v7) {
  43276. const mesh2 = terrainData._mesh;
  43277. const vertices = mesh2.vertices;
  43278. const encoding = mesh2.encoding;
  43279. const indices2 = mesh2.indices;
  43280. for (let i2 = 0, len = indices2.length; i2 < len; i2 += 3) {
  43281. const i0 = indices2[i2];
  43282. const i1 = indices2[i2 + 1];
  43283. const i22 = indices2[i2 + 2];
  43284. const uv0 = encoding.decodeTextureCoordinates(
  43285. vertices,
  43286. i0,
  43287. texCoordScratch02
  43288. );
  43289. const uv1 = encoding.decodeTextureCoordinates(
  43290. vertices,
  43291. i1,
  43292. texCoordScratch12
  43293. );
  43294. const uv2 = encoding.decodeTextureCoordinates(
  43295. vertices,
  43296. i22,
  43297. texCoordScratch22
  43298. );
  43299. const barycentric = Intersections2D_default.computeBarycentricCoordinates(
  43300. u3,
  43301. v7,
  43302. uv0.x,
  43303. uv0.y,
  43304. uv1.x,
  43305. uv1.y,
  43306. uv2.x,
  43307. uv2.y,
  43308. barycentricCoordinateScratch2
  43309. );
  43310. if (barycentric.x >= -1e-15 && barycentric.y >= -1e-15 && barycentric.z >= -1e-15) {
  43311. const h0 = encoding.decodeHeight(vertices, i0);
  43312. const h1 = encoding.decodeHeight(vertices, i1);
  43313. const h2 = encoding.decodeHeight(vertices, i22);
  43314. return barycentric.x * h0 + barycentric.y * h1 + barycentric.z * h2;
  43315. }
  43316. }
  43317. return void 0;
  43318. }
  43319. var sizeOfUint16 = Uint16Array.BYTES_PER_ELEMENT;
  43320. var sizeOfUint32 = Uint32Array.BYTES_PER_ELEMENT;
  43321. var sizeOfInt32 = Int32Array.BYTES_PER_ELEMENT;
  43322. var sizeOfFloat = Float32Array.BYTES_PER_ELEMENT;
  43323. var sizeOfDouble = Float64Array.BYTES_PER_ELEMENT;
  43324. function interpolateHeight3(terrainData, u3, v7, rectangle) {
  43325. const buffer = terrainData._buffer;
  43326. let quad = 0;
  43327. let uStart = 0;
  43328. let vStart = 0;
  43329. if (v7 > 0.5) {
  43330. if (u3 > 0.5) {
  43331. quad = 2;
  43332. uStart = 0.5;
  43333. } else {
  43334. quad = 3;
  43335. }
  43336. vStart = 0.5;
  43337. } else if (u3 > 0.5) {
  43338. quad = 1;
  43339. uStart = 0.5;
  43340. }
  43341. const dv = new DataView(buffer);
  43342. let offset2 = 0;
  43343. for (let q = 0; q < quad; ++q) {
  43344. offset2 += dv.getUint32(offset2, true);
  43345. offset2 += sizeOfUint32;
  43346. }
  43347. offset2 += sizeOfUint32;
  43348. offset2 += 2 * sizeOfDouble;
  43349. const xSize = Math_default.toRadians(dv.getFloat64(offset2, true) * 180);
  43350. offset2 += sizeOfDouble;
  43351. const ySize = Math_default.toRadians(dv.getFloat64(offset2, true) * 180);
  43352. offset2 += sizeOfDouble;
  43353. const xScale = rectangle.width / xSize / 2;
  43354. const yScale = rectangle.height / ySize / 2;
  43355. const numPoints = dv.getInt32(offset2, true);
  43356. offset2 += sizeOfInt32;
  43357. const numIndices = dv.getInt32(offset2, true) * 3;
  43358. offset2 += sizeOfInt32;
  43359. offset2 += sizeOfInt32;
  43360. const uBuffer = new Array(numPoints);
  43361. const vBuffer = new Array(numPoints);
  43362. const heights = new Array(numPoints);
  43363. let i2;
  43364. for (i2 = 0; i2 < numPoints; ++i2) {
  43365. uBuffer[i2] = uStart + dv.getUint8(offset2++) * xScale;
  43366. vBuffer[i2] = vStart + dv.getUint8(offset2++) * yScale;
  43367. heights[i2] = dv.getFloat32(offset2, true) * 6371010;
  43368. offset2 += sizeOfFloat;
  43369. }
  43370. const indices2 = new Array(numIndices);
  43371. for (i2 = 0; i2 < numIndices; ++i2) {
  43372. indices2[i2] = dv.getUint16(offset2, true);
  43373. offset2 += sizeOfUint16;
  43374. }
  43375. for (i2 = 0; i2 < numIndices; i2 += 3) {
  43376. const i0 = indices2[i2];
  43377. const i1 = indices2[i2 + 1];
  43378. const i22 = indices2[i2 + 2];
  43379. const u0 = uBuffer[i0];
  43380. const u12 = uBuffer[i1];
  43381. const u22 = uBuffer[i22];
  43382. const v02 = vBuffer[i0];
  43383. const v13 = vBuffer[i1];
  43384. const v23 = vBuffer[i22];
  43385. const barycentric = Intersections2D_default.computeBarycentricCoordinates(
  43386. u3,
  43387. v7,
  43388. u0,
  43389. v02,
  43390. u12,
  43391. v13,
  43392. u22,
  43393. v23,
  43394. barycentricCoordinateScratch2
  43395. );
  43396. if (barycentric.x >= -1e-15 && barycentric.y >= -1e-15 && barycentric.z >= -1e-15) {
  43397. return barycentric.x * heights[i0] + barycentric.y * heights[i1] + barycentric.z * heights[i22];
  43398. }
  43399. }
  43400. return void 0;
  43401. }
  43402. var GoogleEarthEnterpriseTerrainData_default = GoogleEarthEnterpriseTerrainData;
  43403. // node_modules/cesium/Source/Core/GoogleEarthEnterpriseTerrainProvider.js
  43404. var TerrainState = {
  43405. UNKNOWN: 0,
  43406. NONE: 1,
  43407. SELF: 2,
  43408. PARENT: 3
  43409. };
  43410. var julianDateScratch2 = new JulianDate_default();
  43411. function TerrainCache() {
  43412. this._terrainCache = {};
  43413. this._lastTidy = JulianDate_default.now();
  43414. }
  43415. TerrainCache.prototype.add = function(quadKey, buffer) {
  43416. this._terrainCache[quadKey] = {
  43417. buffer,
  43418. timestamp: JulianDate_default.now()
  43419. };
  43420. };
  43421. TerrainCache.prototype.get = function(quadKey) {
  43422. const terrainCache = this._terrainCache;
  43423. const result = terrainCache[quadKey];
  43424. if (defined_default(result)) {
  43425. delete this._terrainCache[quadKey];
  43426. return result.buffer;
  43427. }
  43428. };
  43429. TerrainCache.prototype.tidy = function() {
  43430. JulianDate_default.now(julianDateScratch2);
  43431. if (JulianDate_default.secondsDifference(julianDateScratch2, this._lastTidy) > 10) {
  43432. const terrainCache = this._terrainCache;
  43433. const keys = Object.keys(terrainCache);
  43434. const count = keys.length;
  43435. for (let i2 = 0; i2 < count; ++i2) {
  43436. const k = keys[i2];
  43437. const e2 = terrainCache[k];
  43438. if (JulianDate_default.secondsDifference(julianDateScratch2, e2.timestamp) > 10) {
  43439. delete terrainCache[k];
  43440. }
  43441. }
  43442. JulianDate_default.clone(julianDateScratch2, this._lastTidy);
  43443. }
  43444. };
  43445. function GoogleEarthEnterpriseTerrainProvider(options) {
  43446. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  43447. if (!(defined_default(options.url) || defined_default(options.metadata))) {
  43448. throw new DeveloperError_default("options.url or options.metadata is required.");
  43449. }
  43450. let metadata;
  43451. if (defined_default(options.metadata)) {
  43452. metadata = options.metadata;
  43453. } else {
  43454. const resource = Resource_default.createIfNeeded(options.url);
  43455. metadata = new GoogleEarthEnterpriseMetadata_default(resource);
  43456. }
  43457. this._metadata = metadata;
  43458. this._tilingScheme = new GeographicTilingScheme_default({
  43459. numberOfLevelZeroTilesX: 2,
  43460. numberOfLevelZeroTilesY: 2,
  43461. rectangle: new Rectangle_default(
  43462. -Math_default.PI,
  43463. -Math_default.PI,
  43464. Math_default.PI,
  43465. Math_default.PI
  43466. ),
  43467. ellipsoid: options.ellipsoid
  43468. });
  43469. let credit = options.credit;
  43470. if (typeof credit === "string") {
  43471. credit = new Credit_default(credit);
  43472. }
  43473. this._credit = credit;
  43474. this._levelZeroMaximumGeometricError = 40075.16;
  43475. this._terrainCache = new TerrainCache();
  43476. this._terrainPromises = {};
  43477. this._terrainRequests = {};
  43478. this._errorEvent = new Event_default();
  43479. this._ready = false;
  43480. const that = this;
  43481. let metadataError;
  43482. this._readyPromise = metadata.readyPromise.then(function(result) {
  43483. if (!metadata.terrainPresent) {
  43484. const e2 = new RuntimeError_default(
  43485. `The server ${metadata.url} doesn't have terrain`
  43486. );
  43487. metadataError = TileProviderError_default.handleError(
  43488. metadataError,
  43489. that,
  43490. that._errorEvent,
  43491. e2.message,
  43492. void 0,
  43493. void 0,
  43494. void 0,
  43495. e2
  43496. );
  43497. return Promise.reject(e2);
  43498. }
  43499. TileProviderError_default.handleSuccess(metadataError);
  43500. that._ready = result;
  43501. return result;
  43502. }).catch(function(e2) {
  43503. metadataError = TileProviderError_default.handleError(
  43504. metadataError,
  43505. that,
  43506. that._errorEvent,
  43507. e2.message,
  43508. void 0,
  43509. void 0,
  43510. void 0,
  43511. e2
  43512. );
  43513. return Promise.reject(e2);
  43514. });
  43515. }
  43516. Object.defineProperties(GoogleEarthEnterpriseTerrainProvider.prototype, {
  43517. url: {
  43518. get: function() {
  43519. return this._metadata.url;
  43520. }
  43521. },
  43522. proxy: {
  43523. get: function() {
  43524. return this._metadata.proxy;
  43525. }
  43526. },
  43527. tilingScheme: {
  43528. get: function() {
  43529. if (!this._ready) {
  43530. throw new DeveloperError_default(
  43531. "tilingScheme must not be called before the imagery provider is ready."
  43532. );
  43533. }
  43534. return this._tilingScheme;
  43535. }
  43536. },
  43537. errorEvent: {
  43538. get: function() {
  43539. return this._errorEvent;
  43540. }
  43541. },
  43542. ready: {
  43543. get: function() {
  43544. return this._ready;
  43545. }
  43546. },
  43547. readyPromise: {
  43548. get: function() {
  43549. return this._readyPromise;
  43550. }
  43551. },
  43552. credit: {
  43553. get: function() {
  43554. return this._credit;
  43555. }
  43556. },
  43557. hasWaterMask: {
  43558. get: function() {
  43559. return false;
  43560. }
  43561. },
  43562. hasVertexNormals: {
  43563. get: function() {
  43564. return false;
  43565. }
  43566. },
  43567. availability: {
  43568. get: function() {
  43569. return void 0;
  43570. }
  43571. }
  43572. });
  43573. var taskProcessor2 = new TaskProcessor_default("decodeGoogleEarthEnterprisePacket");
  43574. function computeChildMask(quadKey, info, metadata) {
  43575. let childMask = info.getChildBitmask();
  43576. if (info.terrainState === TerrainState.PARENT) {
  43577. childMask = 0;
  43578. for (let i2 = 0; i2 < 4; ++i2) {
  43579. const child = metadata.getTileInformationFromQuadKey(
  43580. quadKey + i2.toString()
  43581. );
  43582. if (defined_default(child) && child.hasTerrain()) {
  43583. childMask |= 1 << i2;
  43584. }
  43585. }
  43586. }
  43587. return childMask;
  43588. }
  43589. GoogleEarthEnterpriseTerrainProvider.prototype.requestTileGeometry = function(x, y, level, request) {
  43590. if (!this._ready) {
  43591. throw new DeveloperError_default(
  43592. "requestTileGeometry must not be called before the terrain provider is ready."
  43593. );
  43594. }
  43595. const quadKey = GoogleEarthEnterpriseMetadata_default.tileXYToQuadKey(x, y, level);
  43596. const terrainCache = this._terrainCache;
  43597. const metadata = this._metadata;
  43598. const info = metadata.getTileInformationFromQuadKey(quadKey);
  43599. if (!defined_default(info)) {
  43600. return Promise.reject(new RuntimeError_default("Terrain tile doesn't exist"));
  43601. }
  43602. let terrainState = info.terrainState;
  43603. if (!defined_default(terrainState)) {
  43604. terrainState = info.terrainState = TerrainState.UNKNOWN;
  43605. }
  43606. const buffer = terrainCache.get(quadKey);
  43607. if (defined_default(buffer)) {
  43608. const credit = metadata.providers[info.terrainProvider];
  43609. return Promise.resolve(
  43610. new GoogleEarthEnterpriseTerrainData_default({
  43611. buffer,
  43612. childTileMask: computeChildMask(quadKey, info, metadata),
  43613. credits: defined_default(credit) ? [credit] : void 0,
  43614. negativeAltitudeExponentBias: metadata.negativeAltitudeExponentBias,
  43615. negativeElevationThreshold: metadata.negativeAltitudeThreshold
  43616. })
  43617. );
  43618. }
  43619. terrainCache.tidy();
  43620. if (!info.ancestorHasTerrain) {
  43621. return Promise.resolve(
  43622. new HeightmapTerrainData_default({
  43623. buffer: new Uint8Array(16 * 16),
  43624. width: 16,
  43625. height: 16
  43626. })
  43627. );
  43628. } else if (terrainState === TerrainState.NONE) {
  43629. return Promise.reject(new RuntimeError_default("Terrain tile doesn't exist"));
  43630. }
  43631. let parentInfo;
  43632. let q = quadKey;
  43633. let terrainVersion = -1;
  43634. switch (terrainState) {
  43635. case TerrainState.SELF:
  43636. terrainVersion = info.terrainVersion;
  43637. break;
  43638. case TerrainState.PARENT:
  43639. q = q.substring(0, q.length - 1);
  43640. parentInfo = metadata.getTileInformationFromQuadKey(q);
  43641. terrainVersion = parentInfo.terrainVersion;
  43642. break;
  43643. case TerrainState.UNKNOWN:
  43644. if (info.hasTerrain()) {
  43645. terrainVersion = info.terrainVersion;
  43646. } else {
  43647. q = q.substring(0, q.length - 1);
  43648. parentInfo = metadata.getTileInformationFromQuadKey(q);
  43649. if (defined_default(parentInfo) && parentInfo.hasTerrain()) {
  43650. terrainVersion = parentInfo.terrainVersion;
  43651. }
  43652. }
  43653. break;
  43654. }
  43655. if (terrainVersion < 0) {
  43656. return Promise.reject(new RuntimeError_default("Terrain tile doesn't exist"));
  43657. }
  43658. const terrainPromises = this._terrainPromises;
  43659. const terrainRequests = this._terrainRequests;
  43660. let sharedPromise;
  43661. let sharedRequest;
  43662. if (defined_default(terrainPromises[q])) {
  43663. sharedPromise = terrainPromises[q];
  43664. sharedRequest = terrainRequests[q];
  43665. } else {
  43666. sharedRequest = request;
  43667. const requestPromise = buildTerrainResource(
  43668. this,
  43669. q,
  43670. terrainVersion,
  43671. sharedRequest
  43672. ).fetchArrayBuffer();
  43673. if (!defined_default(requestPromise)) {
  43674. return void 0;
  43675. }
  43676. sharedPromise = requestPromise.then(function(terrain) {
  43677. if (defined_default(terrain)) {
  43678. return taskProcessor2.scheduleTask(
  43679. {
  43680. buffer: terrain,
  43681. type: "Terrain",
  43682. key: metadata.key
  43683. },
  43684. [terrain]
  43685. ).then(function(terrainTiles) {
  43686. const requestedInfo = metadata.getTileInformationFromQuadKey(q);
  43687. requestedInfo.terrainState = TerrainState.SELF;
  43688. terrainCache.add(q, terrainTiles[0]);
  43689. const provider = requestedInfo.terrainProvider;
  43690. const count = terrainTiles.length - 1;
  43691. for (let j = 0; j < count; ++j) {
  43692. const childKey = q + j.toString();
  43693. const child = metadata.getTileInformationFromQuadKey(childKey);
  43694. if (defined_default(child)) {
  43695. terrainCache.add(childKey, terrainTiles[j + 1]);
  43696. child.terrainState = TerrainState.PARENT;
  43697. if (child.terrainProvider === 0) {
  43698. child.terrainProvider = provider;
  43699. }
  43700. }
  43701. }
  43702. });
  43703. }
  43704. return Promise.reject(new RuntimeError_default("Failed to load terrain."));
  43705. });
  43706. terrainPromises[q] = sharedPromise;
  43707. terrainRequests[q] = sharedRequest;
  43708. sharedPromise = sharedPromise.finally(function() {
  43709. delete terrainPromises[q];
  43710. delete terrainRequests[q];
  43711. });
  43712. }
  43713. return sharedPromise.then(function() {
  43714. const buffer2 = terrainCache.get(quadKey);
  43715. if (defined_default(buffer2)) {
  43716. const credit = metadata.providers[info.terrainProvider];
  43717. return new GoogleEarthEnterpriseTerrainData_default({
  43718. buffer: buffer2,
  43719. childTileMask: computeChildMask(quadKey, info, metadata),
  43720. credits: defined_default(credit) ? [credit] : void 0,
  43721. negativeAltitudeExponentBias: metadata.negativeAltitudeExponentBias,
  43722. negativeElevationThreshold: metadata.negativeAltitudeThreshold
  43723. });
  43724. }
  43725. return Promise.reject(new RuntimeError_default("Failed to load terrain."));
  43726. }).catch(function(error) {
  43727. if (sharedRequest.state === RequestState_default.CANCELLED) {
  43728. request.state = sharedRequest.state;
  43729. return Promise.reject(error);
  43730. }
  43731. info.terrainState = TerrainState.NONE;
  43732. return Promise.reject(error);
  43733. });
  43734. };
  43735. GoogleEarthEnterpriseTerrainProvider.prototype.getLevelMaximumGeometricError = function(level) {
  43736. return this._levelZeroMaximumGeometricError / (1 << level);
  43737. };
  43738. GoogleEarthEnterpriseTerrainProvider.prototype.getTileDataAvailable = function(x, y, level) {
  43739. const metadata = this._metadata;
  43740. let quadKey = GoogleEarthEnterpriseMetadata_default.tileXYToQuadKey(x, y, level);
  43741. const info = metadata.getTileInformation(x, y, level);
  43742. if (info === null) {
  43743. return false;
  43744. }
  43745. if (defined_default(info)) {
  43746. if (!info.ancestorHasTerrain) {
  43747. return true;
  43748. }
  43749. const terrainState = info.terrainState;
  43750. if (terrainState === TerrainState.NONE) {
  43751. return false;
  43752. }
  43753. if (!defined_default(terrainState) || terrainState === TerrainState.UNKNOWN) {
  43754. info.terrainState = TerrainState.UNKNOWN;
  43755. if (!info.hasTerrain()) {
  43756. quadKey = quadKey.substring(0, quadKey.length - 1);
  43757. const parentInfo = metadata.getTileInformationFromQuadKey(quadKey);
  43758. if (!defined_default(parentInfo) || !parentInfo.hasTerrain()) {
  43759. return false;
  43760. }
  43761. }
  43762. }
  43763. return true;
  43764. }
  43765. if (metadata.isValid(quadKey)) {
  43766. const request = new Request_default({
  43767. throttle: false,
  43768. throttleByServer: true,
  43769. type: RequestType_default.TERRAIN
  43770. });
  43771. metadata.populateSubtree(x, y, level, request);
  43772. }
  43773. return false;
  43774. };
  43775. GoogleEarthEnterpriseTerrainProvider.prototype.loadTileDataAvailability = function(x, y, level) {
  43776. return void 0;
  43777. };
  43778. function buildTerrainResource(terrainProvider, quadKey, version, request) {
  43779. version = defined_default(version) && version > 0 ? version : 1;
  43780. return terrainProvider._metadata.resource.getDerivedResource({
  43781. url: `flatfile?f1c-0${quadKey}-t.${version.toString()}`,
  43782. request
  43783. });
  43784. }
  43785. var GoogleEarthEnterpriseTerrainProvider_default = GoogleEarthEnterpriseTerrainProvider;
  43786. // node_modules/cesium/Source/Core/GroundPolylineGeometry.js
  43787. var PROJECTIONS = [GeographicProjection_default, WebMercatorProjection_default];
  43788. var PROJECTION_COUNT = PROJECTIONS.length;
  43789. var MITER_BREAK_SMALL = Math.cos(Math_default.toRadians(30));
  43790. var MITER_BREAK_LARGE = Math.cos(Math_default.toRadians(150));
  43791. var WALL_INITIAL_MIN_HEIGHT = 0;
  43792. var WALL_INITIAL_MAX_HEIGHT = 1e3;
  43793. function GroundPolylineGeometry(options) {
  43794. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  43795. const positions = options.positions;
  43796. if (!defined_default(positions) || positions.length < 2) {
  43797. throw new DeveloperError_default("At least two positions are required.");
  43798. }
  43799. if (defined_default(options.arcType) && options.arcType !== ArcType_default.GEODESIC && options.arcType !== ArcType_default.RHUMB) {
  43800. throw new DeveloperError_default(
  43801. "Valid options for arcType are ArcType.GEODESIC and ArcType.RHUMB."
  43802. );
  43803. }
  43804. this.width = defaultValue_default(options.width, 1);
  43805. this._positions = positions;
  43806. this.granularity = defaultValue_default(options.granularity, 9999);
  43807. this.loop = defaultValue_default(options.loop, false);
  43808. this.arcType = defaultValue_default(options.arcType, ArcType_default.GEODESIC);
  43809. this._ellipsoid = Ellipsoid_default.WGS84;
  43810. this._projectionIndex = 0;
  43811. this._workerName = "createGroundPolylineGeometry";
  43812. this._scene3DOnly = false;
  43813. }
  43814. Object.defineProperties(GroundPolylineGeometry.prototype, {
  43815. packedLength: {
  43816. get: function() {
  43817. return 1 + this._positions.length * 3 + 1 + 1 + 1 + Ellipsoid_default.packedLength + 1 + 1;
  43818. }
  43819. }
  43820. });
  43821. GroundPolylineGeometry.setProjectionAndEllipsoid = function(groundPolylineGeometry, mapProjection) {
  43822. let projectionIndex = 0;
  43823. for (let i2 = 0; i2 < PROJECTION_COUNT; i2++) {
  43824. if (mapProjection instanceof PROJECTIONS[i2]) {
  43825. projectionIndex = i2;
  43826. break;
  43827. }
  43828. }
  43829. groundPolylineGeometry._projectionIndex = projectionIndex;
  43830. groundPolylineGeometry._ellipsoid = mapProjection.ellipsoid;
  43831. };
  43832. var cart3Scratch1 = new Cartesian3_default();
  43833. var cart3Scratch2 = new Cartesian3_default();
  43834. var cart3Scratch3 = new Cartesian3_default();
  43835. function computeRightNormal(start, end, maxHeight, ellipsoid, result) {
  43836. const startBottom = getPosition(ellipsoid, start, 0, cart3Scratch1);
  43837. const startTop = getPosition(ellipsoid, start, maxHeight, cart3Scratch2);
  43838. const endBottom = getPosition(ellipsoid, end, 0, cart3Scratch3);
  43839. const up = direction(startTop, startBottom, cart3Scratch2);
  43840. const forward = direction(endBottom, startBottom, cart3Scratch3);
  43841. Cartesian3_default.cross(forward, up, result);
  43842. return Cartesian3_default.normalize(result, result);
  43843. }
  43844. var interpolatedCartographicScratch = new Cartographic_default();
  43845. var interpolatedBottomScratch = new Cartesian3_default();
  43846. var interpolatedTopScratch = new Cartesian3_default();
  43847. var interpolatedNormalScratch = new Cartesian3_default();
  43848. function interpolateSegment(start, end, minHeight, maxHeight, granularity, arcType, ellipsoid, normalsArray, bottomPositionsArray, topPositionsArray, cartographicsArray) {
  43849. if (granularity === 0) {
  43850. return;
  43851. }
  43852. let ellipsoidLine;
  43853. if (arcType === ArcType_default.GEODESIC) {
  43854. ellipsoidLine = new EllipsoidGeodesic_default(start, end, ellipsoid);
  43855. } else if (arcType === ArcType_default.RHUMB) {
  43856. ellipsoidLine = new EllipsoidRhumbLine_default(start, end, ellipsoid);
  43857. }
  43858. const surfaceDistance = ellipsoidLine.surfaceDistance;
  43859. if (surfaceDistance < granularity) {
  43860. return;
  43861. }
  43862. const interpolatedNormal = computeRightNormal(
  43863. start,
  43864. end,
  43865. maxHeight,
  43866. ellipsoid,
  43867. interpolatedNormalScratch
  43868. );
  43869. const segments = Math.ceil(surfaceDistance / granularity);
  43870. const interpointDistance = surfaceDistance / segments;
  43871. let distanceFromStart = interpointDistance;
  43872. const pointsToAdd = segments - 1;
  43873. let packIndex = normalsArray.length;
  43874. for (let i2 = 0; i2 < pointsToAdd; i2++) {
  43875. const interpolatedCartographic = ellipsoidLine.interpolateUsingSurfaceDistance(
  43876. distanceFromStart,
  43877. interpolatedCartographicScratch
  43878. );
  43879. const interpolatedBottom = getPosition(
  43880. ellipsoid,
  43881. interpolatedCartographic,
  43882. minHeight,
  43883. interpolatedBottomScratch
  43884. );
  43885. const interpolatedTop = getPosition(
  43886. ellipsoid,
  43887. interpolatedCartographic,
  43888. maxHeight,
  43889. interpolatedTopScratch
  43890. );
  43891. Cartesian3_default.pack(interpolatedNormal, normalsArray, packIndex);
  43892. Cartesian3_default.pack(interpolatedBottom, bottomPositionsArray, packIndex);
  43893. Cartesian3_default.pack(interpolatedTop, topPositionsArray, packIndex);
  43894. cartographicsArray.push(interpolatedCartographic.latitude);
  43895. cartographicsArray.push(interpolatedCartographic.longitude);
  43896. packIndex += 3;
  43897. distanceFromStart += interpointDistance;
  43898. }
  43899. }
  43900. var heightlessCartographicScratch = new Cartographic_default();
  43901. function getPosition(ellipsoid, cartographic2, height, result) {
  43902. Cartographic_default.clone(cartographic2, heightlessCartographicScratch);
  43903. heightlessCartographicScratch.height = height;
  43904. return Cartographic_default.toCartesian(
  43905. heightlessCartographicScratch,
  43906. ellipsoid,
  43907. result
  43908. );
  43909. }
  43910. GroundPolylineGeometry.pack = function(value, array, startingIndex) {
  43911. Check_default.typeOf.object("value", value);
  43912. Check_default.defined("array", array);
  43913. let index2 = defaultValue_default(startingIndex, 0);
  43914. const positions = value._positions;
  43915. const positionsLength = positions.length;
  43916. array[index2++] = positionsLength;
  43917. for (let i2 = 0; i2 < positionsLength; ++i2) {
  43918. const cartesian11 = positions[i2];
  43919. Cartesian3_default.pack(cartesian11, array, index2);
  43920. index2 += 3;
  43921. }
  43922. array[index2++] = value.granularity;
  43923. array[index2++] = value.loop ? 1 : 0;
  43924. array[index2++] = value.arcType;
  43925. Ellipsoid_default.pack(value._ellipsoid, array, index2);
  43926. index2 += Ellipsoid_default.packedLength;
  43927. array[index2++] = value._projectionIndex;
  43928. array[index2++] = value._scene3DOnly ? 1 : 0;
  43929. return array;
  43930. };
  43931. GroundPolylineGeometry.unpack = function(array, startingIndex, result) {
  43932. Check_default.defined("array", array);
  43933. let index2 = defaultValue_default(startingIndex, 0);
  43934. const positionsLength = array[index2++];
  43935. const positions = new Array(positionsLength);
  43936. for (let i2 = 0; i2 < positionsLength; i2++) {
  43937. positions[i2] = Cartesian3_default.unpack(array, index2);
  43938. index2 += 3;
  43939. }
  43940. const granularity = array[index2++];
  43941. const loop = array[index2++] === 1;
  43942. const arcType = array[index2++];
  43943. const ellipsoid = Ellipsoid_default.unpack(array, index2);
  43944. index2 += Ellipsoid_default.packedLength;
  43945. const projectionIndex = array[index2++];
  43946. const scene3DOnly = array[index2++] === 1;
  43947. if (!defined_default(result)) {
  43948. result = new GroundPolylineGeometry({
  43949. positions
  43950. });
  43951. }
  43952. result._positions = positions;
  43953. result.granularity = granularity;
  43954. result.loop = loop;
  43955. result.arcType = arcType;
  43956. result._ellipsoid = ellipsoid;
  43957. result._projectionIndex = projectionIndex;
  43958. result._scene3DOnly = scene3DOnly;
  43959. return result;
  43960. };
  43961. function direction(target, origin, result) {
  43962. Cartesian3_default.subtract(target, origin, result);
  43963. Cartesian3_default.normalize(result, result);
  43964. return result;
  43965. }
  43966. function tangentDirection(target, origin, up, result) {
  43967. result = direction(target, origin, result);
  43968. result = Cartesian3_default.cross(result, up, result);
  43969. result = Cartesian3_default.normalize(result, result);
  43970. result = Cartesian3_default.cross(up, result, result);
  43971. return result;
  43972. }
  43973. var toPreviousScratch = new Cartesian3_default();
  43974. var toNextScratch = new Cartesian3_default();
  43975. var forwardScratch = new Cartesian3_default();
  43976. var vertexUpScratch = new Cartesian3_default();
  43977. var cosine90 = 0;
  43978. var cosine180 = -1;
  43979. function computeVertexMiterNormal(previousBottom, vertexBottom, vertexTop, nextBottom, result) {
  43980. const up = direction(vertexTop, vertexBottom, vertexUpScratch);
  43981. const toPrevious = tangentDirection(
  43982. previousBottom,
  43983. vertexBottom,
  43984. up,
  43985. toPreviousScratch
  43986. );
  43987. const toNext = tangentDirection(nextBottom, vertexBottom, up, toNextScratch);
  43988. if (Math_default.equalsEpsilon(
  43989. Cartesian3_default.dot(toPrevious, toNext),
  43990. cosine180,
  43991. Math_default.EPSILON5
  43992. )) {
  43993. result = Cartesian3_default.cross(up, toPrevious, result);
  43994. result = Cartesian3_default.normalize(result, result);
  43995. return result;
  43996. }
  43997. result = Cartesian3_default.add(toNext, toPrevious, result);
  43998. result = Cartesian3_default.normalize(result, result);
  43999. const forward = Cartesian3_default.cross(up, result, forwardScratch);
  44000. if (Cartesian3_default.dot(toNext, forward) < cosine90) {
  44001. result = Cartesian3_default.negate(result, result);
  44002. }
  44003. return result;
  44004. }
  44005. var XZ_PLANE = Plane_default.fromPointNormal(Cartesian3_default.ZERO, Cartesian3_default.UNIT_Y);
  44006. var previousBottomScratch = new Cartesian3_default();
  44007. var vertexBottomScratch = new Cartesian3_default();
  44008. var vertexTopScratch = new Cartesian3_default();
  44009. var nextBottomScratch = new Cartesian3_default();
  44010. var vertexNormalScratch = new Cartesian3_default();
  44011. var intersectionScratch = new Cartesian3_default();
  44012. var cartographicScratch0 = new Cartographic_default();
  44013. var cartographicScratch1 = new Cartographic_default();
  44014. var cartographicIntersectionScratch = new Cartographic_default();
  44015. GroundPolylineGeometry.createGeometry = function(groundPolylineGeometry) {
  44016. const compute2dAttributes = !groundPolylineGeometry._scene3DOnly;
  44017. let loop = groundPolylineGeometry.loop;
  44018. const ellipsoid = groundPolylineGeometry._ellipsoid;
  44019. const granularity = groundPolylineGeometry.granularity;
  44020. const arcType = groundPolylineGeometry.arcType;
  44021. const projection = new PROJECTIONS[groundPolylineGeometry._projectionIndex](
  44022. ellipsoid
  44023. );
  44024. const minHeight = WALL_INITIAL_MIN_HEIGHT;
  44025. const maxHeight = WALL_INITIAL_MAX_HEIGHT;
  44026. let index2;
  44027. let i2;
  44028. const positions = groundPolylineGeometry._positions;
  44029. const positionsLength = positions.length;
  44030. if (positionsLength === 2) {
  44031. loop = false;
  44032. }
  44033. let p0;
  44034. let p1;
  44035. let c0;
  44036. let c14;
  44037. const rhumbLine = new EllipsoidRhumbLine_default(void 0, void 0, ellipsoid);
  44038. let intersection;
  44039. let intersectionCartographic;
  44040. let intersectionLongitude;
  44041. const splitPositions = [positions[0]];
  44042. for (i2 = 0; i2 < positionsLength - 1; i2++) {
  44043. p0 = positions[i2];
  44044. p1 = positions[i2 + 1];
  44045. intersection = IntersectionTests_default.lineSegmentPlane(
  44046. p0,
  44047. p1,
  44048. XZ_PLANE,
  44049. intersectionScratch
  44050. );
  44051. if (defined_default(intersection) && !Cartesian3_default.equalsEpsilon(intersection, p0, Math_default.EPSILON7) && !Cartesian3_default.equalsEpsilon(intersection, p1, Math_default.EPSILON7)) {
  44052. if (groundPolylineGeometry.arcType === ArcType_default.GEODESIC) {
  44053. splitPositions.push(Cartesian3_default.clone(intersection));
  44054. } else if (groundPolylineGeometry.arcType === ArcType_default.RHUMB) {
  44055. intersectionLongitude = ellipsoid.cartesianToCartographic(
  44056. intersection,
  44057. cartographicScratch0
  44058. ).longitude;
  44059. c0 = ellipsoid.cartesianToCartographic(p0, cartographicScratch0);
  44060. c14 = ellipsoid.cartesianToCartographic(p1, cartographicScratch1);
  44061. rhumbLine.setEndPoints(c0, c14);
  44062. intersectionCartographic = rhumbLine.findIntersectionWithLongitude(
  44063. intersectionLongitude,
  44064. cartographicIntersectionScratch
  44065. );
  44066. intersection = ellipsoid.cartographicToCartesian(
  44067. intersectionCartographic,
  44068. intersectionScratch
  44069. );
  44070. if (defined_default(intersection) && !Cartesian3_default.equalsEpsilon(intersection, p0, Math_default.EPSILON7) && !Cartesian3_default.equalsEpsilon(intersection, p1, Math_default.EPSILON7)) {
  44071. splitPositions.push(Cartesian3_default.clone(intersection));
  44072. }
  44073. }
  44074. }
  44075. splitPositions.push(p1);
  44076. }
  44077. if (loop) {
  44078. p0 = positions[positionsLength - 1];
  44079. p1 = positions[0];
  44080. intersection = IntersectionTests_default.lineSegmentPlane(
  44081. p0,
  44082. p1,
  44083. XZ_PLANE,
  44084. intersectionScratch
  44085. );
  44086. if (defined_default(intersection) && !Cartesian3_default.equalsEpsilon(intersection, p0, Math_default.EPSILON7) && !Cartesian3_default.equalsEpsilon(intersection, p1, Math_default.EPSILON7)) {
  44087. if (groundPolylineGeometry.arcType === ArcType_default.GEODESIC) {
  44088. splitPositions.push(Cartesian3_default.clone(intersection));
  44089. } else if (groundPolylineGeometry.arcType === ArcType_default.RHUMB) {
  44090. intersectionLongitude = ellipsoid.cartesianToCartographic(
  44091. intersection,
  44092. cartographicScratch0
  44093. ).longitude;
  44094. c0 = ellipsoid.cartesianToCartographic(p0, cartographicScratch0);
  44095. c14 = ellipsoid.cartesianToCartographic(p1, cartographicScratch1);
  44096. rhumbLine.setEndPoints(c0, c14);
  44097. intersectionCartographic = rhumbLine.findIntersectionWithLongitude(
  44098. intersectionLongitude,
  44099. cartographicIntersectionScratch
  44100. );
  44101. intersection = ellipsoid.cartographicToCartesian(
  44102. intersectionCartographic,
  44103. intersectionScratch
  44104. );
  44105. if (defined_default(intersection) && !Cartesian3_default.equalsEpsilon(intersection, p0, Math_default.EPSILON7) && !Cartesian3_default.equalsEpsilon(intersection, p1, Math_default.EPSILON7)) {
  44106. splitPositions.push(Cartesian3_default.clone(intersection));
  44107. }
  44108. }
  44109. }
  44110. }
  44111. let cartographicsLength = splitPositions.length;
  44112. let cartographics = new Array(cartographicsLength);
  44113. for (i2 = 0; i2 < cartographicsLength; i2++) {
  44114. const cartographic2 = Cartographic_default.fromCartesian(
  44115. splitPositions[i2],
  44116. ellipsoid
  44117. );
  44118. cartographic2.height = 0;
  44119. cartographics[i2] = cartographic2;
  44120. }
  44121. cartographics = arrayRemoveDuplicates_default(
  44122. cartographics,
  44123. Cartographic_default.equalsEpsilon
  44124. );
  44125. cartographicsLength = cartographics.length;
  44126. if (cartographicsLength < 2) {
  44127. return void 0;
  44128. }
  44129. const cartographicsArray = [];
  44130. const normalsArray = [];
  44131. const bottomPositionsArray = [];
  44132. const topPositionsArray = [];
  44133. let previousBottom = previousBottomScratch;
  44134. let vertexBottom = vertexBottomScratch;
  44135. let vertexTop = vertexTopScratch;
  44136. let nextBottom = nextBottomScratch;
  44137. let vertexNormal = vertexNormalScratch;
  44138. const startCartographic = cartographics[0];
  44139. const nextCartographic = cartographics[1];
  44140. const prestartCartographic = cartographics[cartographicsLength - 1];
  44141. previousBottom = getPosition(
  44142. ellipsoid,
  44143. prestartCartographic,
  44144. minHeight,
  44145. previousBottom
  44146. );
  44147. nextBottom = getPosition(ellipsoid, nextCartographic, minHeight, nextBottom);
  44148. vertexBottom = getPosition(
  44149. ellipsoid,
  44150. startCartographic,
  44151. minHeight,
  44152. vertexBottom
  44153. );
  44154. vertexTop = getPosition(ellipsoid, startCartographic, maxHeight, vertexTop);
  44155. if (loop) {
  44156. vertexNormal = computeVertexMiterNormal(
  44157. previousBottom,
  44158. vertexBottom,
  44159. vertexTop,
  44160. nextBottom,
  44161. vertexNormal
  44162. );
  44163. } else {
  44164. vertexNormal = computeRightNormal(
  44165. startCartographic,
  44166. nextCartographic,
  44167. maxHeight,
  44168. ellipsoid,
  44169. vertexNormal
  44170. );
  44171. }
  44172. Cartesian3_default.pack(vertexNormal, normalsArray, 0);
  44173. Cartesian3_default.pack(vertexBottom, bottomPositionsArray, 0);
  44174. Cartesian3_default.pack(vertexTop, topPositionsArray, 0);
  44175. cartographicsArray.push(startCartographic.latitude);
  44176. cartographicsArray.push(startCartographic.longitude);
  44177. interpolateSegment(
  44178. startCartographic,
  44179. nextCartographic,
  44180. minHeight,
  44181. maxHeight,
  44182. granularity,
  44183. arcType,
  44184. ellipsoid,
  44185. normalsArray,
  44186. bottomPositionsArray,
  44187. topPositionsArray,
  44188. cartographicsArray
  44189. );
  44190. for (i2 = 1; i2 < cartographicsLength - 1; ++i2) {
  44191. previousBottom = Cartesian3_default.clone(vertexBottom, previousBottom);
  44192. vertexBottom = Cartesian3_default.clone(nextBottom, vertexBottom);
  44193. const vertexCartographic = cartographics[i2];
  44194. getPosition(ellipsoid, vertexCartographic, maxHeight, vertexTop);
  44195. getPosition(ellipsoid, cartographics[i2 + 1], minHeight, nextBottom);
  44196. computeVertexMiterNormal(
  44197. previousBottom,
  44198. vertexBottom,
  44199. vertexTop,
  44200. nextBottom,
  44201. vertexNormal
  44202. );
  44203. index2 = normalsArray.length;
  44204. Cartesian3_default.pack(vertexNormal, normalsArray, index2);
  44205. Cartesian3_default.pack(vertexBottom, bottomPositionsArray, index2);
  44206. Cartesian3_default.pack(vertexTop, topPositionsArray, index2);
  44207. cartographicsArray.push(vertexCartographic.latitude);
  44208. cartographicsArray.push(vertexCartographic.longitude);
  44209. interpolateSegment(
  44210. cartographics[i2],
  44211. cartographics[i2 + 1],
  44212. minHeight,
  44213. maxHeight,
  44214. granularity,
  44215. arcType,
  44216. ellipsoid,
  44217. normalsArray,
  44218. bottomPositionsArray,
  44219. topPositionsArray,
  44220. cartographicsArray
  44221. );
  44222. }
  44223. const endCartographic = cartographics[cartographicsLength - 1];
  44224. const preEndCartographic = cartographics[cartographicsLength - 2];
  44225. vertexBottom = getPosition(
  44226. ellipsoid,
  44227. endCartographic,
  44228. minHeight,
  44229. vertexBottom
  44230. );
  44231. vertexTop = getPosition(ellipsoid, endCartographic, maxHeight, vertexTop);
  44232. if (loop) {
  44233. const postEndCartographic = cartographics[0];
  44234. previousBottom = getPosition(
  44235. ellipsoid,
  44236. preEndCartographic,
  44237. minHeight,
  44238. previousBottom
  44239. );
  44240. nextBottom = getPosition(
  44241. ellipsoid,
  44242. postEndCartographic,
  44243. minHeight,
  44244. nextBottom
  44245. );
  44246. vertexNormal = computeVertexMiterNormal(
  44247. previousBottom,
  44248. vertexBottom,
  44249. vertexTop,
  44250. nextBottom,
  44251. vertexNormal
  44252. );
  44253. } else {
  44254. vertexNormal = computeRightNormal(
  44255. preEndCartographic,
  44256. endCartographic,
  44257. maxHeight,
  44258. ellipsoid,
  44259. vertexNormal
  44260. );
  44261. }
  44262. index2 = normalsArray.length;
  44263. Cartesian3_default.pack(vertexNormal, normalsArray, index2);
  44264. Cartesian3_default.pack(vertexBottom, bottomPositionsArray, index2);
  44265. Cartesian3_default.pack(vertexTop, topPositionsArray, index2);
  44266. cartographicsArray.push(endCartographic.latitude);
  44267. cartographicsArray.push(endCartographic.longitude);
  44268. if (loop) {
  44269. interpolateSegment(
  44270. endCartographic,
  44271. startCartographic,
  44272. minHeight,
  44273. maxHeight,
  44274. granularity,
  44275. arcType,
  44276. ellipsoid,
  44277. normalsArray,
  44278. bottomPositionsArray,
  44279. topPositionsArray,
  44280. cartographicsArray
  44281. );
  44282. index2 = normalsArray.length;
  44283. for (i2 = 0; i2 < 3; ++i2) {
  44284. normalsArray[index2 + i2] = normalsArray[i2];
  44285. bottomPositionsArray[index2 + i2] = bottomPositionsArray[i2];
  44286. topPositionsArray[index2 + i2] = topPositionsArray[i2];
  44287. }
  44288. cartographicsArray.push(startCartographic.latitude);
  44289. cartographicsArray.push(startCartographic.longitude);
  44290. }
  44291. return generateGeometryAttributes(
  44292. loop,
  44293. projection,
  44294. bottomPositionsArray,
  44295. topPositionsArray,
  44296. normalsArray,
  44297. cartographicsArray,
  44298. compute2dAttributes
  44299. );
  44300. };
  44301. var lineDirectionScratch = new Cartesian3_default();
  44302. var matrix3Scratch = new Matrix3_default();
  44303. var quaternionScratch3 = new Quaternion_default();
  44304. function breakMiter(endGeometryNormal, startBottom, endBottom, endTop) {
  44305. const lineDirection = direction(endBottom, startBottom, lineDirectionScratch);
  44306. const dot2 = Cartesian3_default.dot(lineDirection, endGeometryNormal);
  44307. if (dot2 > MITER_BREAK_SMALL || dot2 < MITER_BREAK_LARGE) {
  44308. const vertexUp = direction(endTop, endBottom, vertexUpScratch);
  44309. const angle = dot2 < MITER_BREAK_LARGE ? Math_default.PI_OVER_TWO : -Math_default.PI_OVER_TWO;
  44310. const quaternion = Quaternion_default.fromAxisAngle(
  44311. vertexUp,
  44312. angle,
  44313. quaternionScratch3
  44314. );
  44315. const rotationMatrix = Matrix3_default.fromQuaternion(quaternion, matrix3Scratch);
  44316. Matrix3_default.multiplyByVector(
  44317. rotationMatrix,
  44318. endGeometryNormal,
  44319. endGeometryNormal
  44320. );
  44321. return true;
  44322. }
  44323. return false;
  44324. }
  44325. var endPosCartographicScratch = new Cartographic_default();
  44326. var normalStartpointScratch = new Cartesian3_default();
  44327. var normalEndpointScratch = new Cartesian3_default();
  44328. function projectNormal(projection, cartographic2, normal2, projectedPosition2, result) {
  44329. const position = Cartographic_default.toCartesian(
  44330. cartographic2,
  44331. projection._ellipsoid,
  44332. normalStartpointScratch
  44333. );
  44334. let normalEndpoint = Cartesian3_default.add(position, normal2, normalEndpointScratch);
  44335. let flipNormal = false;
  44336. const ellipsoid = projection._ellipsoid;
  44337. let normalEndpointCartographic = ellipsoid.cartesianToCartographic(
  44338. normalEndpoint,
  44339. endPosCartographicScratch
  44340. );
  44341. if (Math.abs(cartographic2.longitude - normalEndpointCartographic.longitude) > Math_default.PI_OVER_TWO) {
  44342. flipNormal = true;
  44343. normalEndpoint = Cartesian3_default.subtract(
  44344. position,
  44345. normal2,
  44346. normalEndpointScratch
  44347. );
  44348. normalEndpointCartographic = ellipsoid.cartesianToCartographic(
  44349. normalEndpoint,
  44350. endPosCartographicScratch
  44351. );
  44352. }
  44353. normalEndpointCartographic.height = 0;
  44354. const normalEndpointProjected = projection.project(
  44355. normalEndpointCartographic,
  44356. result
  44357. );
  44358. result = Cartesian3_default.subtract(
  44359. normalEndpointProjected,
  44360. projectedPosition2,
  44361. result
  44362. );
  44363. result.z = 0;
  44364. result = Cartesian3_default.normalize(result, result);
  44365. if (flipNormal) {
  44366. Cartesian3_default.negate(result, result);
  44367. }
  44368. return result;
  44369. }
  44370. var adjustHeightNormalScratch = new Cartesian3_default();
  44371. var adjustHeightOffsetScratch = new Cartesian3_default();
  44372. function adjustHeights(bottom, top, minHeight, maxHeight, adjustHeightBottom, adjustHeightTop) {
  44373. const adjustHeightNormal = Cartesian3_default.subtract(
  44374. top,
  44375. bottom,
  44376. adjustHeightNormalScratch
  44377. );
  44378. Cartesian3_default.normalize(adjustHeightNormal, adjustHeightNormal);
  44379. const distanceForBottom = minHeight - WALL_INITIAL_MIN_HEIGHT;
  44380. let adjustHeightOffset = Cartesian3_default.multiplyByScalar(
  44381. adjustHeightNormal,
  44382. distanceForBottom,
  44383. adjustHeightOffsetScratch
  44384. );
  44385. Cartesian3_default.add(bottom, adjustHeightOffset, adjustHeightBottom);
  44386. const distanceForTop = maxHeight - WALL_INITIAL_MAX_HEIGHT;
  44387. adjustHeightOffset = Cartesian3_default.multiplyByScalar(
  44388. adjustHeightNormal,
  44389. distanceForTop,
  44390. adjustHeightOffsetScratch
  44391. );
  44392. Cartesian3_default.add(top, adjustHeightOffset, adjustHeightTop);
  44393. }
  44394. var nudgeDirectionScratch = new Cartesian3_default();
  44395. function nudgeXZ(start, end) {
  44396. const startToXZdistance = Plane_default.getPointDistance(XZ_PLANE, start);
  44397. const endToXZdistance = Plane_default.getPointDistance(XZ_PLANE, end);
  44398. let offset2 = nudgeDirectionScratch;
  44399. if (Math_default.equalsEpsilon(startToXZdistance, 0, Math_default.EPSILON2)) {
  44400. offset2 = direction(end, start, offset2);
  44401. Cartesian3_default.multiplyByScalar(offset2, Math_default.EPSILON2, offset2);
  44402. Cartesian3_default.add(start, offset2, start);
  44403. } else if (Math_default.equalsEpsilon(endToXZdistance, 0, Math_default.EPSILON2)) {
  44404. offset2 = direction(start, end, offset2);
  44405. Cartesian3_default.multiplyByScalar(offset2, Math_default.EPSILON2, offset2);
  44406. Cartesian3_default.add(end, offset2, end);
  44407. }
  44408. }
  44409. function nudgeCartographic(start, end) {
  44410. const absStartLon = Math.abs(start.longitude);
  44411. const absEndLon = Math.abs(end.longitude);
  44412. if (Math_default.equalsEpsilon(absStartLon, Math_default.PI, Math_default.EPSILON11)) {
  44413. const endSign = Math_default.sign(end.longitude);
  44414. start.longitude = endSign * (absStartLon - Math_default.EPSILON11);
  44415. return 1;
  44416. } else if (Math_default.equalsEpsilon(absEndLon, Math_default.PI, Math_default.EPSILON11)) {
  44417. const startSign = Math_default.sign(start.longitude);
  44418. end.longitude = startSign * (absEndLon - Math_default.EPSILON11);
  44419. return 2;
  44420. }
  44421. return 0;
  44422. }
  44423. var startCartographicScratch = new Cartographic_default();
  44424. var endCartographicScratch = new Cartographic_default();
  44425. var segmentStartTopScratch = new Cartesian3_default();
  44426. var segmentEndTopScratch = new Cartesian3_default();
  44427. var segmentStartBottomScratch = new Cartesian3_default();
  44428. var segmentEndBottomScratch = new Cartesian3_default();
  44429. var segmentStartNormalScratch = new Cartesian3_default();
  44430. var segmentEndNormalScratch = new Cartesian3_default();
  44431. var getHeightCartographics = [
  44432. startCartographicScratch,
  44433. endCartographicScratch
  44434. ];
  44435. var getHeightRectangleScratch = new Rectangle_default();
  44436. var adjustHeightStartTopScratch = new Cartesian3_default();
  44437. var adjustHeightEndTopScratch = new Cartesian3_default();
  44438. var adjustHeightStartBottomScratch = new Cartesian3_default();
  44439. var adjustHeightEndBottomScratch = new Cartesian3_default();
  44440. var segmentStart2DScratch = new Cartesian3_default();
  44441. var segmentEnd2DScratch = new Cartesian3_default();
  44442. var segmentStartNormal2DScratch = new Cartesian3_default();
  44443. var segmentEndNormal2DScratch = new Cartesian3_default();
  44444. var offsetScratch2 = new Cartesian3_default();
  44445. var startUpScratch = new Cartesian3_default();
  44446. var endUpScratch = new Cartesian3_default();
  44447. var rightScratch2 = new Cartesian3_default();
  44448. var startPlaneNormalScratch = new Cartesian3_default();
  44449. var endPlaneNormalScratch = new Cartesian3_default();
  44450. var encodeScratch = new EncodedCartesian3_default();
  44451. var encodeScratch2D = new EncodedCartesian3_default();
  44452. var forwardOffset2DScratch = new Cartesian3_default();
  44453. var right2DScratch = new Cartesian3_default();
  44454. var normalNudgeScratch = new Cartesian3_default();
  44455. var scratchBoundingSpheres = [new BoundingSphere_default(), new BoundingSphere_default()];
  44456. var REFERENCE_INDICES = [
  44457. 0,
  44458. 2,
  44459. 1,
  44460. 0,
  44461. 3,
  44462. 2,
  44463. 0,
  44464. 7,
  44465. 3,
  44466. 0,
  44467. 4,
  44468. 7,
  44469. 0,
  44470. 5,
  44471. 4,
  44472. 0,
  44473. 1,
  44474. 5,
  44475. 5,
  44476. 7,
  44477. 4,
  44478. 5,
  44479. 6,
  44480. 7,
  44481. 5,
  44482. 2,
  44483. 6,
  44484. 5,
  44485. 1,
  44486. 2,
  44487. 3,
  44488. 6,
  44489. 2,
  44490. 3,
  44491. 7,
  44492. 6
  44493. ];
  44494. var REFERENCE_INDICES_LENGTH = REFERENCE_INDICES.length;
  44495. function generateGeometryAttributes(loop, projection, bottomPositionsArray, topPositionsArray, normalsArray, cartographicsArray, compute2dAttributes) {
  44496. let i2;
  44497. let index2;
  44498. const ellipsoid = projection._ellipsoid;
  44499. const segmentCount = bottomPositionsArray.length / 3 - 1;
  44500. const vertexCount = segmentCount * 8;
  44501. const arraySizeVec4 = vertexCount * 4;
  44502. const indexCount = segmentCount * 36;
  44503. const indices2 = vertexCount > 65535 ? new Uint32Array(indexCount) : new Uint16Array(indexCount);
  44504. const positionsArray = new Float64Array(vertexCount * 3);
  44505. const startHiAndForwardOffsetX = new Float32Array(arraySizeVec4);
  44506. const startLoAndForwardOffsetY = new Float32Array(arraySizeVec4);
  44507. const startNormalAndForwardOffsetZ = new Float32Array(arraySizeVec4);
  44508. const endNormalAndTextureCoordinateNormalizationX = new Float32Array(
  44509. arraySizeVec4
  44510. );
  44511. const rightNormalAndTextureCoordinateNormalizationY = new Float32Array(
  44512. arraySizeVec4
  44513. );
  44514. let startHiLo2D;
  44515. let offsetAndRight2D;
  44516. let startEndNormals2D;
  44517. let texcoordNormalization2D;
  44518. if (compute2dAttributes) {
  44519. startHiLo2D = new Float32Array(arraySizeVec4);
  44520. offsetAndRight2D = new Float32Array(arraySizeVec4);
  44521. startEndNormals2D = new Float32Array(arraySizeVec4);
  44522. texcoordNormalization2D = new Float32Array(vertexCount * 2);
  44523. }
  44524. const cartographicsLength = cartographicsArray.length / 2;
  44525. let length2D = 0;
  44526. const startCartographic = startCartographicScratch;
  44527. startCartographic.height = 0;
  44528. const endCartographic = endCartographicScratch;
  44529. endCartographic.height = 0;
  44530. let segmentStartCartesian = segmentStartTopScratch;
  44531. let segmentEndCartesian = segmentEndTopScratch;
  44532. if (compute2dAttributes) {
  44533. index2 = 0;
  44534. for (i2 = 1; i2 < cartographicsLength; i2++) {
  44535. startCartographic.latitude = cartographicsArray[index2];
  44536. startCartographic.longitude = cartographicsArray[index2 + 1];
  44537. endCartographic.latitude = cartographicsArray[index2 + 2];
  44538. endCartographic.longitude = cartographicsArray[index2 + 3];
  44539. segmentStartCartesian = projection.project(
  44540. startCartographic,
  44541. segmentStartCartesian
  44542. );
  44543. segmentEndCartesian = projection.project(
  44544. endCartographic,
  44545. segmentEndCartesian
  44546. );
  44547. length2D += Cartesian3_default.distance(
  44548. segmentStartCartesian,
  44549. segmentEndCartesian
  44550. );
  44551. index2 += 2;
  44552. }
  44553. }
  44554. const positionsLength = topPositionsArray.length / 3;
  44555. segmentEndCartesian = Cartesian3_default.unpack(
  44556. topPositionsArray,
  44557. 0,
  44558. segmentEndCartesian
  44559. );
  44560. let length3D = 0;
  44561. index2 = 3;
  44562. for (i2 = 1; i2 < positionsLength; i2++) {
  44563. segmentStartCartesian = Cartesian3_default.clone(
  44564. segmentEndCartesian,
  44565. segmentStartCartesian
  44566. );
  44567. segmentEndCartesian = Cartesian3_default.unpack(
  44568. topPositionsArray,
  44569. index2,
  44570. segmentEndCartesian
  44571. );
  44572. length3D += Cartesian3_default.distance(segmentStartCartesian, segmentEndCartesian);
  44573. index2 += 3;
  44574. }
  44575. let j;
  44576. index2 = 3;
  44577. let cartographicsIndex = 0;
  44578. let vec2sWriteIndex = 0;
  44579. let vec3sWriteIndex = 0;
  44580. let vec4sWriteIndex = 0;
  44581. let miterBroken = false;
  44582. let endBottom = Cartesian3_default.unpack(
  44583. bottomPositionsArray,
  44584. 0,
  44585. segmentEndBottomScratch
  44586. );
  44587. let endTop = Cartesian3_default.unpack(topPositionsArray, 0, segmentEndTopScratch);
  44588. let endGeometryNormal = Cartesian3_default.unpack(
  44589. normalsArray,
  44590. 0,
  44591. segmentEndNormalScratch
  44592. );
  44593. if (loop) {
  44594. const preEndBottom = Cartesian3_default.unpack(
  44595. bottomPositionsArray,
  44596. bottomPositionsArray.length - 6,
  44597. segmentStartBottomScratch
  44598. );
  44599. if (breakMiter(endGeometryNormal, preEndBottom, endBottom, endTop)) {
  44600. endGeometryNormal = Cartesian3_default.negate(
  44601. endGeometryNormal,
  44602. endGeometryNormal
  44603. );
  44604. }
  44605. }
  44606. let lengthSoFar3D = 0;
  44607. let lengthSoFar2D = 0;
  44608. let sumHeights = 0;
  44609. for (i2 = 0; i2 < segmentCount; i2++) {
  44610. const startBottom = Cartesian3_default.clone(endBottom, segmentStartBottomScratch);
  44611. const startTop = Cartesian3_default.clone(endTop, segmentStartTopScratch);
  44612. let startGeometryNormal = Cartesian3_default.clone(
  44613. endGeometryNormal,
  44614. segmentStartNormalScratch
  44615. );
  44616. if (miterBroken) {
  44617. startGeometryNormal = Cartesian3_default.negate(
  44618. startGeometryNormal,
  44619. startGeometryNormal
  44620. );
  44621. }
  44622. endBottom = Cartesian3_default.unpack(
  44623. bottomPositionsArray,
  44624. index2,
  44625. segmentEndBottomScratch
  44626. );
  44627. endTop = Cartesian3_default.unpack(topPositionsArray, index2, segmentEndTopScratch);
  44628. endGeometryNormal = Cartesian3_default.unpack(
  44629. normalsArray,
  44630. index2,
  44631. segmentEndNormalScratch
  44632. );
  44633. miterBroken = breakMiter(endGeometryNormal, startBottom, endBottom, endTop);
  44634. startCartographic.latitude = cartographicsArray[cartographicsIndex];
  44635. startCartographic.longitude = cartographicsArray[cartographicsIndex + 1];
  44636. endCartographic.latitude = cartographicsArray[cartographicsIndex + 2];
  44637. endCartographic.longitude = cartographicsArray[cartographicsIndex + 3];
  44638. let start2D;
  44639. let end2D;
  44640. let startGeometryNormal2D;
  44641. let endGeometryNormal2D;
  44642. if (compute2dAttributes) {
  44643. const nudgeResult = nudgeCartographic(startCartographic, endCartographic);
  44644. start2D = projection.project(startCartographic, segmentStart2DScratch);
  44645. end2D = projection.project(endCartographic, segmentEnd2DScratch);
  44646. const direction2D = direction(end2D, start2D, forwardOffset2DScratch);
  44647. direction2D.y = Math.abs(direction2D.y);
  44648. startGeometryNormal2D = segmentStartNormal2DScratch;
  44649. endGeometryNormal2D = segmentEndNormal2DScratch;
  44650. if (nudgeResult === 0 || Cartesian3_default.dot(direction2D, Cartesian3_default.UNIT_Y) > MITER_BREAK_SMALL) {
  44651. startGeometryNormal2D = projectNormal(
  44652. projection,
  44653. startCartographic,
  44654. startGeometryNormal,
  44655. start2D,
  44656. segmentStartNormal2DScratch
  44657. );
  44658. endGeometryNormal2D = projectNormal(
  44659. projection,
  44660. endCartographic,
  44661. endGeometryNormal,
  44662. end2D,
  44663. segmentEndNormal2DScratch
  44664. );
  44665. } else if (nudgeResult === 1) {
  44666. endGeometryNormal2D = projectNormal(
  44667. projection,
  44668. endCartographic,
  44669. endGeometryNormal,
  44670. end2D,
  44671. segmentEndNormal2DScratch
  44672. );
  44673. startGeometryNormal2D.x = 0;
  44674. startGeometryNormal2D.y = Math_default.sign(
  44675. startCartographic.longitude - Math.abs(endCartographic.longitude)
  44676. );
  44677. startGeometryNormal2D.z = 0;
  44678. } else {
  44679. startGeometryNormal2D = projectNormal(
  44680. projection,
  44681. startCartographic,
  44682. startGeometryNormal,
  44683. start2D,
  44684. segmentStartNormal2DScratch
  44685. );
  44686. endGeometryNormal2D.x = 0;
  44687. endGeometryNormal2D.y = Math_default.sign(
  44688. startCartographic.longitude - endCartographic.longitude
  44689. );
  44690. endGeometryNormal2D.z = 0;
  44691. }
  44692. }
  44693. const segmentLength3D = Cartesian3_default.distance(startTop, endTop);
  44694. const encodedStart = EncodedCartesian3_default.fromCartesian(
  44695. startBottom,
  44696. encodeScratch
  44697. );
  44698. const forwardOffset = Cartesian3_default.subtract(
  44699. endBottom,
  44700. startBottom,
  44701. offsetScratch2
  44702. );
  44703. const forward = Cartesian3_default.normalize(forwardOffset, rightScratch2);
  44704. let startUp = Cartesian3_default.subtract(startTop, startBottom, startUpScratch);
  44705. startUp = Cartesian3_default.normalize(startUp, startUp);
  44706. let rightNormal = Cartesian3_default.cross(forward, startUp, rightScratch2);
  44707. rightNormal = Cartesian3_default.normalize(rightNormal, rightNormal);
  44708. let startPlaneNormal = Cartesian3_default.cross(
  44709. startUp,
  44710. startGeometryNormal,
  44711. startPlaneNormalScratch
  44712. );
  44713. startPlaneNormal = Cartesian3_default.normalize(startPlaneNormal, startPlaneNormal);
  44714. let endUp = Cartesian3_default.subtract(endTop, endBottom, endUpScratch);
  44715. endUp = Cartesian3_default.normalize(endUp, endUp);
  44716. let endPlaneNormal = Cartesian3_default.cross(
  44717. endGeometryNormal,
  44718. endUp,
  44719. endPlaneNormalScratch
  44720. );
  44721. endPlaneNormal = Cartesian3_default.normalize(endPlaneNormal, endPlaneNormal);
  44722. const texcoordNormalization3DX = segmentLength3D / length3D;
  44723. const texcoordNormalization3DY = lengthSoFar3D / length3D;
  44724. let segmentLength2D = 0;
  44725. let encodedStart2D;
  44726. let forwardOffset2D;
  44727. let right2D;
  44728. let texcoordNormalization2DX = 0;
  44729. let texcoordNormalization2DY = 0;
  44730. if (compute2dAttributes) {
  44731. segmentLength2D = Cartesian3_default.distance(start2D, end2D);
  44732. encodedStart2D = EncodedCartesian3_default.fromCartesian(
  44733. start2D,
  44734. encodeScratch2D
  44735. );
  44736. forwardOffset2D = Cartesian3_default.subtract(
  44737. end2D,
  44738. start2D,
  44739. forwardOffset2DScratch
  44740. );
  44741. right2D = Cartesian3_default.normalize(forwardOffset2D, right2DScratch);
  44742. const swap5 = right2D.x;
  44743. right2D.x = right2D.y;
  44744. right2D.y = -swap5;
  44745. texcoordNormalization2DX = segmentLength2D / length2D;
  44746. texcoordNormalization2DY = lengthSoFar2D / length2D;
  44747. }
  44748. for (j = 0; j < 8; j++) {
  44749. const vec4Index = vec4sWriteIndex + j * 4;
  44750. const vec2Index = vec2sWriteIndex + j * 2;
  44751. const wIndex = vec4Index + 3;
  44752. const rightPlaneSide = j < 4 ? 1 : -1;
  44753. const topBottomSide = j === 2 || j === 3 || j === 6 || j === 7 ? 1 : -1;
  44754. Cartesian3_default.pack(encodedStart.high, startHiAndForwardOffsetX, vec4Index);
  44755. startHiAndForwardOffsetX[wIndex] = forwardOffset.x;
  44756. Cartesian3_default.pack(encodedStart.low, startLoAndForwardOffsetY, vec4Index);
  44757. startLoAndForwardOffsetY[wIndex] = forwardOffset.y;
  44758. Cartesian3_default.pack(
  44759. startPlaneNormal,
  44760. startNormalAndForwardOffsetZ,
  44761. vec4Index
  44762. );
  44763. startNormalAndForwardOffsetZ[wIndex] = forwardOffset.z;
  44764. Cartesian3_default.pack(
  44765. endPlaneNormal,
  44766. endNormalAndTextureCoordinateNormalizationX,
  44767. vec4Index
  44768. );
  44769. endNormalAndTextureCoordinateNormalizationX[wIndex] = texcoordNormalization3DX * rightPlaneSide;
  44770. Cartesian3_default.pack(
  44771. rightNormal,
  44772. rightNormalAndTextureCoordinateNormalizationY,
  44773. vec4Index
  44774. );
  44775. let texcoordNormalization = texcoordNormalization3DY * topBottomSide;
  44776. if (texcoordNormalization === 0 && topBottomSide < 0) {
  44777. texcoordNormalization = 9;
  44778. }
  44779. rightNormalAndTextureCoordinateNormalizationY[wIndex] = texcoordNormalization;
  44780. if (compute2dAttributes) {
  44781. startHiLo2D[vec4Index] = encodedStart2D.high.x;
  44782. startHiLo2D[vec4Index + 1] = encodedStart2D.high.y;
  44783. startHiLo2D[vec4Index + 2] = encodedStart2D.low.x;
  44784. startHiLo2D[vec4Index + 3] = encodedStart2D.low.y;
  44785. startEndNormals2D[vec4Index] = -startGeometryNormal2D.y;
  44786. startEndNormals2D[vec4Index + 1] = startGeometryNormal2D.x;
  44787. startEndNormals2D[vec4Index + 2] = endGeometryNormal2D.y;
  44788. startEndNormals2D[vec4Index + 3] = -endGeometryNormal2D.x;
  44789. offsetAndRight2D[vec4Index] = forwardOffset2D.x;
  44790. offsetAndRight2D[vec4Index + 1] = forwardOffset2D.y;
  44791. offsetAndRight2D[vec4Index + 2] = right2D.x;
  44792. offsetAndRight2D[vec4Index + 3] = right2D.y;
  44793. texcoordNormalization2D[vec2Index] = texcoordNormalization2DX * rightPlaneSide;
  44794. texcoordNormalization = texcoordNormalization2DY * topBottomSide;
  44795. if (texcoordNormalization === 0 && topBottomSide < 0) {
  44796. texcoordNormalization = 9;
  44797. }
  44798. texcoordNormalization2D[vec2Index + 1] = texcoordNormalization;
  44799. }
  44800. }
  44801. const adjustHeightStartBottom = adjustHeightStartBottomScratch;
  44802. const adjustHeightEndBottom = adjustHeightEndBottomScratch;
  44803. const adjustHeightStartTop = adjustHeightStartTopScratch;
  44804. const adjustHeightEndTop = adjustHeightEndTopScratch;
  44805. const getHeightsRectangle = Rectangle_default.fromCartographicArray(
  44806. getHeightCartographics,
  44807. getHeightRectangleScratch
  44808. );
  44809. const minMaxHeights = ApproximateTerrainHeights_default.getMinimumMaximumHeights(
  44810. getHeightsRectangle,
  44811. ellipsoid
  44812. );
  44813. const minHeight = minMaxHeights.minimumTerrainHeight;
  44814. const maxHeight = minMaxHeights.maximumTerrainHeight;
  44815. sumHeights += minHeight;
  44816. sumHeights += maxHeight;
  44817. adjustHeights(
  44818. startBottom,
  44819. startTop,
  44820. minHeight,
  44821. maxHeight,
  44822. adjustHeightStartBottom,
  44823. adjustHeightStartTop
  44824. );
  44825. adjustHeights(
  44826. endBottom,
  44827. endTop,
  44828. minHeight,
  44829. maxHeight,
  44830. adjustHeightEndBottom,
  44831. adjustHeightEndTop
  44832. );
  44833. let normalNudge = Cartesian3_default.multiplyByScalar(
  44834. rightNormal,
  44835. Math_default.EPSILON5,
  44836. normalNudgeScratch
  44837. );
  44838. Cartesian3_default.add(
  44839. adjustHeightStartBottom,
  44840. normalNudge,
  44841. adjustHeightStartBottom
  44842. );
  44843. Cartesian3_default.add(adjustHeightEndBottom, normalNudge, adjustHeightEndBottom);
  44844. Cartesian3_default.add(adjustHeightStartTop, normalNudge, adjustHeightStartTop);
  44845. Cartesian3_default.add(adjustHeightEndTop, normalNudge, adjustHeightEndTop);
  44846. nudgeXZ(adjustHeightStartBottom, adjustHeightEndBottom);
  44847. nudgeXZ(adjustHeightStartTop, adjustHeightEndTop);
  44848. Cartesian3_default.pack(adjustHeightStartBottom, positionsArray, vec3sWriteIndex);
  44849. Cartesian3_default.pack(adjustHeightEndBottom, positionsArray, vec3sWriteIndex + 3);
  44850. Cartesian3_default.pack(adjustHeightEndTop, positionsArray, vec3sWriteIndex + 6);
  44851. Cartesian3_default.pack(adjustHeightStartTop, positionsArray, vec3sWriteIndex + 9);
  44852. normalNudge = Cartesian3_default.multiplyByScalar(
  44853. rightNormal,
  44854. -2 * Math_default.EPSILON5,
  44855. normalNudgeScratch
  44856. );
  44857. Cartesian3_default.add(
  44858. adjustHeightStartBottom,
  44859. normalNudge,
  44860. adjustHeightStartBottom
  44861. );
  44862. Cartesian3_default.add(adjustHeightEndBottom, normalNudge, adjustHeightEndBottom);
  44863. Cartesian3_default.add(adjustHeightStartTop, normalNudge, adjustHeightStartTop);
  44864. Cartesian3_default.add(adjustHeightEndTop, normalNudge, adjustHeightEndTop);
  44865. nudgeXZ(adjustHeightStartBottom, adjustHeightEndBottom);
  44866. nudgeXZ(adjustHeightStartTop, adjustHeightEndTop);
  44867. Cartesian3_default.pack(
  44868. adjustHeightStartBottom,
  44869. positionsArray,
  44870. vec3sWriteIndex + 12
  44871. );
  44872. Cartesian3_default.pack(
  44873. adjustHeightEndBottom,
  44874. positionsArray,
  44875. vec3sWriteIndex + 15
  44876. );
  44877. Cartesian3_default.pack(adjustHeightEndTop, positionsArray, vec3sWriteIndex + 18);
  44878. Cartesian3_default.pack(adjustHeightStartTop, positionsArray, vec3sWriteIndex + 21);
  44879. cartographicsIndex += 2;
  44880. index2 += 3;
  44881. vec2sWriteIndex += 16;
  44882. vec3sWriteIndex += 24;
  44883. vec4sWriteIndex += 32;
  44884. lengthSoFar3D += segmentLength3D;
  44885. lengthSoFar2D += segmentLength2D;
  44886. }
  44887. index2 = 0;
  44888. let indexOffset = 0;
  44889. for (i2 = 0; i2 < segmentCount; i2++) {
  44890. for (j = 0; j < REFERENCE_INDICES_LENGTH; j++) {
  44891. indices2[index2 + j] = REFERENCE_INDICES[j] + indexOffset;
  44892. }
  44893. indexOffset += 8;
  44894. index2 += REFERENCE_INDICES_LENGTH;
  44895. }
  44896. const boundingSpheres = scratchBoundingSpheres;
  44897. BoundingSphere_default.fromVertices(
  44898. bottomPositionsArray,
  44899. Cartesian3_default.ZERO,
  44900. 3,
  44901. boundingSpheres[0]
  44902. );
  44903. BoundingSphere_default.fromVertices(
  44904. topPositionsArray,
  44905. Cartesian3_default.ZERO,
  44906. 3,
  44907. boundingSpheres[1]
  44908. );
  44909. const boundingSphere = BoundingSphere_default.fromBoundingSpheres(boundingSpheres);
  44910. boundingSphere.radius += sumHeights / (segmentCount * 2);
  44911. const attributes = {
  44912. position: new GeometryAttribute_default({
  44913. componentDatatype: ComponentDatatype_default.DOUBLE,
  44914. componentsPerAttribute: 3,
  44915. normalize: false,
  44916. values: positionsArray
  44917. }),
  44918. startHiAndForwardOffsetX: getVec4GeometryAttribute(
  44919. startHiAndForwardOffsetX
  44920. ),
  44921. startLoAndForwardOffsetY: getVec4GeometryAttribute(
  44922. startLoAndForwardOffsetY
  44923. ),
  44924. startNormalAndForwardOffsetZ: getVec4GeometryAttribute(
  44925. startNormalAndForwardOffsetZ
  44926. ),
  44927. endNormalAndTextureCoordinateNormalizationX: getVec4GeometryAttribute(
  44928. endNormalAndTextureCoordinateNormalizationX
  44929. ),
  44930. rightNormalAndTextureCoordinateNormalizationY: getVec4GeometryAttribute(
  44931. rightNormalAndTextureCoordinateNormalizationY
  44932. )
  44933. };
  44934. if (compute2dAttributes) {
  44935. attributes.startHiLo2D = getVec4GeometryAttribute(startHiLo2D);
  44936. attributes.offsetAndRight2D = getVec4GeometryAttribute(offsetAndRight2D);
  44937. attributes.startEndNormals2D = getVec4GeometryAttribute(startEndNormals2D);
  44938. attributes.texcoordNormalization2D = new GeometryAttribute_default({
  44939. componentDatatype: ComponentDatatype_default.FLOAT,
  44940. componentsPerAttribute: 2,
  44941. normalize: false,
  44942. values: texcoordNormalization2D
  44943. });
  44944. }
  44945. return new Geometry_default({
  44946. attributes,
  44947. indices: indices2,
  44948. boundingSphere
  44949. });
  44950. }
  44951. function getVec4GeometryAttribute(typedArray) {
  44952. return new GeometryAttribute_default({
  44953. componentDatatype: ComponentDatatype_default.FLOAT,
  44954. componentsPerAttribute: 4,
  44955. normalize: false,
  44956. values: typedArray
  44957. });
  44958. }
  44959. GroundPolylineGeometry._projectNormal = projectNormal;
  44960. var GroundPolylineGeometry_default = GroundPolylineGeometry;
  44961. // node_modules/cesium/Source/Core/HeadingPitchRange.js
  44962. function HeadingPitchRange(heading, pitch, range2) {
  44963. this.heading = defaultValue_default(heading, 0);
  44964. this.pitch = defaultValue_default(pitch, 0);
  44965. this.range = defaultValue_default(range2, 0);
  44966. }
  44967. HeadingPitchRange.clone = function(hpr, result) {
  44968. if (!defined_default(hpr)) {
  44969. return void 0;
  44970. }
  44971. if (!defined_default(result)) {
  44972. result = new HeadingPitchRange();
  44973. }
  44974. result.heading = hpr.heading;
  44975. result.pitch = hpr.pitch;
  44976. result.range = hpr.range;
  44977. return result;
  44978. };
  44979. var HeadingPitchRange_default = HeadingPitchRange;
  44980. // node_modules/cesium/Source/Core/HermitePolynomialApproximation.js
  44981. var factorial = Math_default.factorial;
  44982. function calculateCoefficientTerm(x, zIndices, xTable, derivOrder, termOrder, reservedIndices) {
  44983. let result = 0;
  44984. let reserved;
  44985. let i2;
  44986. let j;
  44987. if (derivOrder > 0) {
  44988. for (i2 = 0; i2 < termOrder; i2++) {
  44989. reserved = false;
  44990. for (j = 0; j < reservedIndices.length && !reserved; j++) {
  44991. if (i2 === reservedIndices[j]) {
  44992. reserved = true;
  44993. }
  44994. }
  44995. if (!reserved) {
  44996. reservedIndices.push(i2);
  44997. result += calculateCoefficientTerm(
  44998. x,
  44999. zIndices,
  45000. xTable,
  45001. derivOrder - 1,
  45002. termOrder,
  45003. reservedIndices
  45004. );
  45005. reservedIndices.splice(reservedIndices.length - 1, 1);
  45006. }
  45007. }
  45008. return result;
  45009. }
  45010. result = 1;
  45011. for (i2 = 0; i2 < termOrder; i2++) {
  45012. reserved = false;
  45013. for (j = 0; j < reservedIndices.length && !reserved; j++) {
  45014. if (i2 === reservedIndices[j]) {
  45015. reserved = true;
  45016. }
  45017. }
  45018. if (!reserved) {
  45019. result *= x - xTable[zIndices[i2]];
  45020. }
  45021. }
  45022. return result;
  45023. }
  45024. var HermitePolynomialApproximation = {
  45025. type: "Hermite"
  45026. };
  45027. HermitePolynomialApproximation.getRequiredDataPoints = function(degree, inputOrder) {
  45028. inputOrder = defaultValue_default(inputOrder, 0);
  45029. if (!defined_default(degree)) {
  45030. throw new DeveloperError_default("degree is required.");
  45031. }
  45032. if (degree < 0) {
  45033. throw new DeveloperError_default("degree must be 0 or greater.");
  45034. }
  45035. if (inputOrder < 0) {
  45036. throw new DeveloperError_default("inputOrder must be 0 or greater.");
  45037. }
  45038. return Math.max(Math.floor((degree + 1) / (inputOrder + 1)), 2);
  45039. };
  45040. HermitePolynomialApproximation.interpolateOrderZero = function(x, xTable, yTable, yStride, result) {
  45041. if (!defined_default(result)) {
  45042. result = new Array(yStride);
  45043. }
  45044. let i2;
  45045. let j;
  45046. let d;
  45047. let s2;
  45048. let len;
  45049. let index2;
  45050. const length3 = xTable.length;
  45051. const coefficients = new Array(yStride);
  45052. for (i2 = 0; i2 < yStride; i2++) {
  45053. result[i2] = 0;
  45054. const l2 = new Array(length3);
  45055. coefficients[i2] = l2;
  45056. for (j = 0; j < length3; j++) {
  45057. l2[j] = [];
  45058. }
  45059. }
  45060. const zIndicesLength = length3, zIndices = new Array(zIndicesLength);
  45061. for (i2 = 0; i2 < zIndicesLength; i2++) {
  45062. zIndices[i2] = i2;
  45063. }
  45064. let highestNonZeroCoef = length3 - 1;
  45065. for (s2 = 0; s2 < yStride; s2++) {
  45066. for (j = 0; j < zIndicesLength; j++) {
  45067. index2 = zIndices[j] * yStride + s2;
  45068. coefficients[s2][0].push(yTable[index2]);
  45069. }
  45070. for (i2 = 1; i2 < zIndicesLength; i2++) {
  45071. let nonZeroCoefficients = false;
  45072. for (j = 0; j < zIndicesLength - i2; j++) {
  45073. const zj = xTable[zIndices[j]];
  45074. const zn = xTable[zIndices[j + i2]];
  45075. let numerator;
  45076. if (zn - zj <= 0) {
  45077. index2 = zIndices[j] * yStride + yStride * i2 + s2;
  45078. numerator = yTable[index2];
  45079. coefficients[s2][i2].push(numerator / factorial(i2));
  45080. } else {
  45081. numerator = coefficients[s2][i2 - 1][j + 1] - coefficients[s2][i2 - 1][j];
  45082. coefficients[s2][i2].push(numerator / (zn - zj));
  45083. }
  45084. nonZeroCoefficients = nonZeroCoefficients || numerator !== 0;
  45085. }
  45086. if (!nonZeroCoefficients) {
  45087. highestNonZeroCoef = i2 - 1;
  45088. }
  45089. }
  45090. }
  45091. for (d = 0, len = 0; d <= len; d++) {
  45092. for (i2 = d; i2 <= highestNonZeroCoef; i2++) {
  45093. const tempTerm = calculateCoefficientTerm(x, zIndices, xTable, d, i2, []);
  45094. for (s2 = 0; s2 < yStride; s2++) {
  45095. const coeff = coefficients[s2][i2][0];
  45096. result[s2 + d * yStride] += coeff * tempTerm;
  45097. }
  45098. }
  45099. }
  45100. return result;
  45101. };
  45102. var arrayScratch2 = [];
  45103. HermitePolynomialApproximation.interpolate = function(x, xTable, yTable, yStride, inputOrder, outputOrder, result) {
  45104. const resultLength = yStride * (outputOrder + 1);
  45105. if (!defined_default(result)) {
  45106. result = new Array(resultLength);
  45107. }
  45108. for (let r2 = 0; r2 < resultLength; r2++) {
  45109. result[r2] = 0;
  45110. }
  45111. const length3 = xTable.length;
  45112. const zIndices = new Array(length3 * (inputOrder + 1));
  45113. let i2;
  45114. for (i2 = 0; i2 < length3; i2++) {
  45115. for (let j = 0; j < inputOrder + 1; j++) {
  45116. zIndices[i2 * (inputOrder + 1) + j] = i2;
  45117. }
  45118. }
  45119. const zIndiceslength = zIndices.length;
  45120. const coefficients = arrayScratch2;
  45121. const highestNonZeroCoef = fillCoefficientList(
  45122. coefficients,
  45123. zIndices,
  45124. xTable,
  45125. yTable,
  45126. yStride,
  45127. inputOrder
  45128. );
  45129. const reservedIndices = [];
  45130. const tmp2 = zIndiceslength * (zIndiceslength + 1) / 2;
  45131. const loopStop = Math.min(highestNonZeroCoef, outputOrder);
  45132. for (let d = 0; d <= loopStop; d++) {
  45133. for (i2 = d; i2 <= highestNonZeroCoef; i2++) {
  45134. reservedIndices.length = 0;
  45135. const tempTerm = calculateCoefficientTerm(
  45136. x,
  45137. zIndices,
  45138. xTable,
  45139. d,
  45140. i2,
  45141. reservedIndices
  45142. );
  45143. const dimTwo = Math.floor(i2 * (1 - i2) / 2) + zIndiceslength * i2;
  45144. for (let s2 = 0; s2 < yStride; s2++) {
  45145. const dimOne = Math.floor(s2 * tmp2);
  45146. const coef = coefficients[dimOne + dimTwo];
  45147. result[s2 + d * yStride] += coef * tempTerm;
  45148. }
  45149. }
  45150. }
  45151. return result;
  45152. };
  45153. function fillCoefficientList(coefficients, zIndices, xTable, yTable, yStride, inputOrder) {
  45154. let j;
  45155. let index2;
  45156. let highestNonZero = -1;
  45157. const zIndiceslength = zIndices.length;
  45158. const tmp2 = zIndiceslength * (zIndiceslength + 1) / 2;
  45159. for (let s2 = 0; s2 < yStride; s2++) {
  45160. const dimOne = Math.floor(s2 * tmp2);
  45161. for (j = 0; j < zIndiceslength; j++) {
  45162. index2 = zIndices[j] * yStride * (inputOrder + 1) + s2;
  45163. coefficients[dimOne + j] = yTable[index2];
  45164. }
  45165. for (let i2 = 1; i2 < zIndiceslength; i2++) {
  45166. let coefIndex = 0;
  45167. const dimTwo = Math.floor(i2 * (1 - i2) / 2) + zIndiceslength * i2;
  45168. let nonZeroCoefficients = false;
  45169. for (j = 0; j < zIndiceslength - i2; j++) {
  45170. const zj = xTable[zIndices[j]];
  45171. const zn = xTable[zIndices[j + i2]];
  45172. let numerator;
  45173. let coefficient;
  45174. if (zn - zj <= 0) {
  45175. index2 = zIndices[j] * yStride * (inputOrder + 1) + yStride * i2 + s2;
  45176. numerator = yTable[index2];
  45177. coefficient = numerator / Math_default.factorial(i2);
  45178. coefficients[dimOne + dimTwo + coefIndex] = coefficient;
  45179. coefIndex++;
  45180. } else {
  45181. const dimTwoMinusOne = Math.floor((i2 - 1) * (2 - i2) / 2) + zIndiceslength * (i2 - 1);
  45182. numerator = coefficients[dimOne + dimTwoMinusOne + j + 1] - coefficients[dimOne + dimTwoMinusOne + j];
  45183. coefficient = numerator / (zn - zj);
  45184. coefficients[dimOne + dimTwo + coefIndex] = coefficient;
  45185. coefIndex++;
  45186. }
  45187. nonZeroCoefficients = nonZeroCoefficients || numerator !== 0;
  45188. }
  45189. if (nonZeroCoefficients) {
  45190. highestNonZero = Math.max(highestNonZero, i2);
  45191. }
  45192. }
  45193. }
  45194. return highestNonZero;
  45195. }
  45196. var HermitePolynomialApproximation_default = HermitePolynomialApproximation;
  45197. // node_modules/cesium/Source/Core/HilbertOrder.js
  45198. var HilbertOrder = {};
  45199. HilbertOrder.encode2D = function(level, x, y) {
  45200. const n2 = Math.pow(2, level);
  45201. Check_default.typeOf.number("level", level);
  45202. Check_default.typeOf.number("x", x);
  45203. Check_default.typeOf.number("y", y);
  45204. if (level < 1) {
  45205. throw new DeveloperError_default("Hilbert level cannot be less than 1.");
  45206. }
  45207. if (x < 0 || x >= n2 || y < 0 || y >= n2) {
  45208. throw new DeveloperError_default("Invalid coordinates for given level.");
  45209. }
  45210. const p2 = {
  45211. x,
  45212. y
  45213. };
  45214. let rx, ry, s2, index2 = BigInt(0);
  45215. for (s2 = n2 / 2; s2 > 0; s2 /= 2) {
  45216. rx = (p2.x & s2) > 0 ? 1 : 0;
  45217. ry = (p2.y & s2) > 0 ? 1 : 0;
  45218. index2 += BigInt((3 * rx ^ ry) * s2 * s2);
  45219. rotate(n2, p2, rx, ry);
  45220. }
  45221. return index2;
  45222. };
  45223. HilbertOrder.decode2D = function(level, index2) {
  45224. Check_default.typeOf.number("level", level);
  45225. Check_default.typeOf.bigint("index", index2);
  45226. if (level < 1) {
  45227. throw new DeveloperError_default("Hilbert level cannot be less than 1.");
  45228. }
  45229. if (index2 < BigInt(0) || index2 >= BigInt(Math.pow(4, level))) {
  45230. throw new DeveloperError_default(
  45231. "Hilbert index exceeds valid maximum for given level."
  45232. );
  45233. }
  45234. const n2 = Math.pow(2, level);
  45235. const p2 = {
  45236. x: 0,
  45237. y: 0
  45238. };
  45239. let rx, ry, s2, t;
  45240. for (s2 = 1, t = index2; s2 < n2; s2 *= 2) {
  45241. rx = 1 & Number(t / BigInt(2));
  45242. ry = 1 & Number(t ^ BigInt(rx));
  45243. rotate(s2, p2, rx, ry);
  45244. p2.x += s2 * rx;
  45245. p2.y += s2 * ry;
  45246. t /= BigInt(4);
  45247. }
  45248. return [p2.x, p2.y];
  45249. };
  45250. function rotate(n2, p2, rx, ry) {
  45251. if (ry !== 0) {
  45252. return;
  45253. }
  45254. if (rx === 1) {
  45255. p2.x = n2 - 1 - p2.x;
  45256. p2.y = n2 - 1 - p2.y;
  45257. }
  45258. const t = p2.x;
  45259. p2.x = p2.y;
  45260. p2.y = t;
  45261. }
  45262. var HilbertOrder_default = HilbertOrder;
  45263. // node_modules/cesium/Source/Core/IauOrientationParameters.js
  45264. function IauOrientationParameters(rightAscension, declination, rotation, rotationRate) {
  45265. this.rightAscension = rightAscension;
  45266. this.declination = declination;
  45267. this.rotation = rotation;
  45268. this.rotationRate = rotationRate;
  45269. }
  45270. var IauOrientationParameters_default = IauOrientationParameters;
  45271. // node_modules/cesium/Source/Core/Iau2000Orientation.js
  45272. var Iau2000Orientation = {};
  45273. var TdtMinusTai = 32.184;
  45274. var J2000d = 2451545;
  45275. var c1 = -0.0529921;
  45276. var c2 = -0.1059842;
  45277. var c32 = 13.0120009;
  45278. var c4 = 13.3407154;
  45279. var c5 = 0.9856003;
  45280. var c6 = 26.4057084;
  45281. var c7 = 13.064993;
  45282. var c8 = 0.3287146;
  45283. var c9 = 1.7484877;
  45284. var c10 = -0.1589763;
  45285. var c11 = 36096e-7;
  45286. var c12 = 0.1643573;
  45287. var c13 = 12.9590088;
  45288. var dateTT = new JulianDate_default();
  45289. Iau2000Orientation.ComputeMoon = function(date, result) {
  45290. if (!defined_default(date)) {
  45291. date = JulianDate_default.now();
  45292. }
  45293. dateTT = JulianDate_default.addSeconds(date, TdtMinusTai, dateTT);
  45294. const d = JulianDate_default.totalDays(dateTT) - J2000d;
  45295. const T = d / TimeConstants_default.DAYS_PER_JULIAN_CENTURY;
  45296. const E1 = (125.045 + c1 * d) * Math_default.RADIANS_PER_DEGREE;
  45297. const E2 = (250.089 + c2 * d) * Math_default.RADIANS_PER_DEGREE;
  45298. const E3 = (260.008 + c32 * d) * Math_default.RADIANS_PER_DEGREE;
  45299. const E4 = (176.625 + c4 * d) * Math_default.RADIANS_PER_DEGREE;
  45300. const E5 = (357.529 + c5 * d) * Math_default.RADIANS_PER_DEGREE;
  45301. const E6 = (311.589 + c6 * d) * Math_default.RADIANS_PER_DEGREE;
  45302. const E7 = (134.963 + c7 * d) * Math_default.RADIANS_PER_DEGREE;
  45303. const E8 = (276.617 + c8 * d) * Math_default.RADIANS_PER_DEGREE;
  45304. const E9 = (34.226 + c9 * d) * Math_default.RADIANS_PER_DEGREE;
  45305. const E10 = (15.134 + c10 * d) * Math_default.RADIANS_PER_DEGREE;
  45306. const E11 = (119.743 + c11 * d) * Math_default.RADIANS_PER_DEGREE;
  45307. const E12 = (239.961 + c12 * d) * Math_default.RADIANS_PER_DEGREE;
  45308. const E13 = (25.053 + c13 * d) * Math_default.RADIANS_PER_DEGREE;
  45309. const sinE1 = Math.sin(E1);
  45310. const sinE2 = Math.sin(E2);
  45311. const sinE3 = Math.sin(E3);
  45312. const sinE4 = Math.sin(E4);
  45313. const sinE5 = Math.sin(E5);
  45314. const sinE6 = Math.sin(E6);
  45315. const sinE7 = Math.sin(E7);
  45316. const sinE8 = Math.sin(E8);
  45317. const sinE9 = Math.sin(E9);
  45318. const sinE10 = Math.sin(E10);
  45319. const sinE11 = Math.sin(E11);
  45320. const sinE12 = Math.sin(E12);
  45321. const sinE13 = Math.sin(E13);
  45322. const cosE1 = Math.cos(E1);
  45323. const cosE2 = Math.cos(E2);
  45324. const cosE3 = Math.cos(E3);
  45325. const cosE4 = Math.cos(E4);
  45326. const cosE5 = Math.cos(E5);
  45327. const cosE6 = Math.cos(E6);
  45328. const cosE7 = Math.cos(E7);
  45329. const cosE8 = Math.cos(E8);
  45330. const cosE9 = Math.cos(E9);
  45331. const cosE10 = Math.cos(E10);
  45332. const cosE11 = Math.cos(E11);
  45333. const cosE12 = Math.cos(E12);
  45334. const cosE13 = Math.cos(E13);
  45335. const rightAscension = (269.9949 + 31e-4 * T - 3.8787 * sinE1 - 0.1204 * sinE2 + 0.07 * sinE3 - 0.0172 * sinE4 + 72e-4 * sinE6 - 52e-4 * sinE10 + 43e-4 * sinE13) * Math_default.RADIANS_PER_DEGREE;
  45336. const declination = (66.5392 + 0.013 * T + 1.5419 * cosE1 + 0.0239 * cosE2 - 0.0278 * cosE3 + 68e-4 * cosE4 - 29e-4 * cosE6 + 9e-4 * cosE7 + 8e-4 * cosE10 - 9e-4 * cosE13) * Math_default.RADIANS_PER_DEGREE;
  45337. const rotation = (38.3213 + 13.17635815 * d - 14e-13 * d * d + 3.561 * sinE1 + 0.1208 * sinE2 - 0.0642 * sinE3 + 0.0158 * sinE4 + 0.0252 * sinE5 - 66e-4 * sinE6 - 47e-4 * sinE7 - 46e-4 * sinE8 + 28e-4 * sinE9 + 52e-4 * sinE10 + 4e-3 * sinE11 + 19e-4 * sinE12 - 44e-4 * sinE13) * Math_default.RADIANS_PER_DEGREE;
  45338. const rotationRate = (13.17635815 - 14e-13 * (2 * d) + 3.561 * cosE1 * c1 + 0.1208 * cosE2 * c2 - 0.0642 * cosE3 * c32 + 0.0158 * cosE4 * c4 + 0.0252 * cosE5 * c5 - 66e-4 * cosE6 * c6 - 47e-4 * cosE7 * c7 - 46e-4 * cosE8 * c8 + 28e-4 * cosE9 * c9 + 52e-4 * cosE10 * c10 + 4e-3 * cosE11 * c11 + 19e-4 * cosE12 * c12 - 44e-4 * cosE13 * c13) / 86400 * Math_default.RADIANS_PER_DEGREE;
  45339. if (!defined_default(result)) {
  45340. result = new IauOrientationParameters_default();
  45341. }
  45342. result.rightAscension = rightAscension;
  45343. result.declination = declination;
  45344. result.rotation = rotation;
  45345. result.rotationRate = rotationRate;
  45346. return result;
  45347. };
  45348. var Iau2000Orientation_default = Iau2000Orientation;
  45349. // node_modules/cesium/Source/Core/IauOrientationAxes.js
  45350. function IauOrientationAxes(computeFunction) {
  45351. if (!defined_default(computeFunction) || typeof computeFunction !== "function") {
  45352. computeFunction = Iau2000Orientation_default.ComputeMoon;
  45353. }
  45354. this._computeFunction = computeFunction;
  45355. }
  45356. var xAxisScratch = new Cartesian3_default();
  45357. var yAxisScratch = new Cartesian3_default();
  45358. var zAxisScratch = new Cartesian3_default();
  45359. function computeRotationMatrix(alpha, delta, result) {
  45360. const xAxis = xAxisScratch;
  45361. xAxis.x = Math.cos(alpha + Math_default.PI_OVER_TWO);
  45362. xAxis.y = Math.sin(alpha + Math_default.PI_OVER_TWO);
  45363. xAxis.z = 0;
  45364. const cosDec = Math.cos(delta);
  45365. const zAxis = zAxisScratch;
  45366. zAxis.x = cosDec * Math.cos(alpha);
  45367. zAxis.y = cosDec * Math.sin(alpha);
  45368. zAxis.z = Math.sin(delta);
  45369. const yAxis = Cartesian3_default.cross(zAxis, xAxis, yAxisScratch);
  45370. if (!defined_default(result)) {
  45371. result = new Matrix3_default();
  45372. }
  45373. result[0] = xAxis.x;
  45374. result[1] = yAxis.x;
  45375. result[2] = zAxis.x;
  45376. result[3] = xAxis.y;
  45377. result[4] = yAxis.y;
  45378. result[5] = zAxis.y;
  45379. result[6] = xAxis.z;
  45380. result[7] = yAxis.z;
  45381. result[8] = zAxis.z;
  45382. return result;
  45383. }
  45384. var rotMtxScratch = new Matrix3_default();
  45385. var quatScratch = new Quaternion_default();
  45386. IauOrientationAxes.prototype.evaluate = function(date, result) {
  45387. if (!defined_default(date)) {
  45388. date = JulianDate_default.now();
  45389. }
  45390. const alphaDeltaW = this._computeFunction(date);
  45391. const precMtx = computeRotationMatrix(
  45392. alphaDeltaW.rightAscension,
  45393. alphaDeltaW.declination,
  45394. result
  45395. );
  45396. const rot = Math_default.zeroToTwoPi(alphaDeltaW.rotation);
  45397. const quat = Quaternion_default.fromAxisAngle(Cartesian3_default.UNIT_Z, rot, quatScratch);
  45398. const rotMtx2 = Matrix3_default.fromQuaternion(
  45399. Quaternion_default.conjugate(quat, quat),
  45400. rotMtxScratch
  45401. );
  45402. const cbi2cbf = Matrix3_default.multiply(rotMtx2, precMtx, precMtx);
  45403. return cbi2cbf;
  45404. };
  45405. var IauOrientationAxes_default = IauOrientationAxes;
  45406. // node_modules/cesium/Source/Core/InterpolationAlgorithm.js
  45407. var InterpolationAlgorithm = {};
  45408. InterpolationAlgorithm.type = void 0;
  45409. InterpolationAlgorithm.getRequiredDataPoints = DeveloperError_default.throwInstantiationError;
  45410. InterpolationAlgorithm.interpolateOrderZero = DeveloperError_default.throwInstantiationError;
  45411. InterpolationAlgorithm.interpolate = DeveloperError_default.throwInstantiationError;
  45412. var InterpolationAlgorithm_default = InterpolationAlgorithm;
  45413. // node_modules/cesium/Source/Core/InterpolationType.js
  45414. var InterpolationType = {
  45415. STEP: 0,
  45416. LINEAR: 1,
  45417. CUBICSPLINE: 2
  45418. };
  45419. var InterpolationType_default = Object.freeze(InterpolationType);
  45420. // node_modules/cesium/Source/Core/Ion.js
  45421. var defaultTokenCredit;
  45422. var defaultAccessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI5YTJlYmI0NC1kM2IwLTRmZDktOGI2Yy01MDFiZWRkYzQ4NzEiLCJpZCI6MjU5LCJpYXQiOjE2NTE0OTY5NDl9.GEWUJWU1Yuf7kVTVshQ1jb2ix9f-O-A74MuSsjq7Kbg";
  45423. var Ion = {};
  45424. Ion.defaultAccessToken = defaultAccessToken;
  45425. Ion.defaultServer = new Resource_default({ url: "https://api.cesium.com/" });
  45426. Ion.getDefaultTokenCredit = function(providedKey) {
  45427. if (providedKey !== defaultAccessToken) {
  45428. return void 0;
  45429. }
  45430. if (!defined_default(defaultTokenCredit)) {
  45431. const defaultTokenMessage = `<b> This application is using Cesium's default ion access token. Please assign <i>Cesium.Ion.defaultAccessToken</i> with an access token from your ion account before making any Cesium API calls. You can sign up for a free ion account at <a href="https://cesium.com">https://cesium.com</a>.</b>`;
  45432. defaultTokenCredit = new Credit_default(defaultTokenMessage, true);
  45433. }
  45434. return defaultTokenCredit;
  45435. };
  45436. var Ion_default = Ion;
  45437. // node_modules/cesium/Source/Core/PeliasGeocoderService.js
  45438. function PeliasGeocoderService(url2) {
  45439. Check_default.defined("url", url2);
  45440. this._url = Resource_default.createIfNeeded(url2);
  45441. this._url.appendForwardSlash();
  45442. }
  45443. Object.defineProperties(PeliasGeocoderService.prototype, {
  45444. url: {
  45445. get: function() {
  45446. return this._url;
  45447. }
  45448. }
  45449. });
  45450. PeliasGeocoderService.prototype.geocode = function(query, type) {
  45451. Check_default.typeOf.string("query", query);
  45452. const resource = this._url.getDerivedResource({
  45453. url: type === GeocodeType_default.AUTOCOMPLETE ? "autocomplete" : "search",
  45454. queryParameters: {
  45455. text: query
  45456. }
  45457. });
  45458. return resource.fetchJson().then(function(results) {
  45459. return results.features.map(function(resultObject) {
  45460. let destination;
  45461. const bboxDegrees = resultObject.bbox;
  45462. if (defined_default(bboxDegrees)) {
  45463. destination = Rectangle_default.fromDegrees(
  45464. bboxDegrees[0],
  45465. bboxDegrees[1],
  45466. bboxDegrees[2],
  45467. bboxDegrees[3]
  45468. );
  45469. } else {
  45470. const lon = resultObject.geometry.coordinates[0];
  45471. const lat = resultObject.geometry.coordinates[1];
  45472. destination = Cartesian3_default.fromDegrees(lon, lat);
  45473. }
  45474. return {
  45475. displayName: resultObject.properties.label,
  45476. destination
  45477. };
  45478. });
  45479. });
  45480. };
  45481. var PeliasGeocoderService_default = PeliasGeocoderService;
  45482. // node_modules/cesium/Source/Core/IonGeocoderService.js
  45483. function IonGeocoderService(options) {
  45484. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  45485. Check_default.typeOf.object("options.scene", options.scene);
  45486. const accessToken = defaultValue_default(options.accessToken, Ion_default.defaultAccessToken);
  45487. const server = Resource_default.createIfNeeded(
  45488. defaultValue_default(options.server, Ion_default.defaultServer)
  45489. );
  45490. server.appendForwardSlash();
  45491. const defaultTokenCredit2 = Ion_default.getDefaultTokenCredit(accessToken);
  45492. if (defined_default(defaultTokenCredit2)) {
  45493. options.scene.frameState.creditDisplay.addDefaultCredit(
  45494. Credit_default.clone(defaultTokenCredit2)
  45495. );
  45496. }
  45497. const searchEndpoint = server.getDerivedResource({
  45498. url: "v1/geocode"
  45499. });
  45500. if (defined_default(accessToken)) {
  45501. searchEndpoint.appendQueryParameters({ access_token: accessToken });
  45502. }
  45503. this._accessToken = accessToken;
  45504. this._server = server;
  45505. this._pelias = new PeliasGeocoderService_default(searchEndpoint);
  45506. }
  45507. IonGeocoderService.prototype.geocode = function(query, geocodeType) {
  45508. return this._pelias.geocode(query, geocodeType);
  45509. };
  45510. var IonGeocoderService_default = IonGeocoderService;
  45511. // node_modules/cesium/Source/Core/IonResource.js
  45512. function IonResource(endpoint, endpointResource) {
  45513. Check_default.defined("endpoint", endpoint);
  45514. Check_default.defined("endpointResource", endpointResource);
  45515. let options;
  45516. const externalType = endpoint.externalType;
  45517. const isExternal = defined_default(externalType);
  45518. if (!isExternal) {
  45519. options = {
  45520. url: endpoint.url,
  45521. retryAttempts: 1,
  45522. retryCallback
  45523. };
  45524. } else if (externalType === "3DTILES" || externalType === "STK_TERRAIN_SERVER") {
  45525. options = { url: endpoint.options.url };
  45526. } else {
  45527. throw new RuntimeError_default(
  45528. "Ion.createResource does not support external imagery assets; use IonImageryProvider instead."
  45529. );
  45530. }
  45531. Resource_default.call(this, options);
  45532. this._ionEndpoint = endpoint;
  45533. this._ionEndpointDomain = isExternal ? void 0 : new URI(endpoint.url).authority();
  45534. this._ionEndpointResource = endpointResource;
  45535. this._ionRoot = void 0;
  45536. this._pendingPromise = void 0;
  45537. this._credits = void 0;
  45538. this._isExternal = isExternal;
  45539. }
  45540. if (defined_default(Object.create)) {
  45541. IonResource.prototype = Object.create(Resource_default.prototype);
  45542. IonResource.prototype.constructor = IonResource;
  45543. }
  45544. IonResource.fromAssetId = function(assetId, options) {
  45545. const endpointResource = IonResource._createEndpointResource(
  45546. assetId,
  45547. options
  45548. );
  45549. return endpointResource.fetchJson().then(function(endpoint) {
  45550. return new IonResource(endpoint, endpointResource);
  45551. });
  45552. };
  45553. Object.defineProperties(IonResource.prototype, {
  45554. credits: {
  45555. get: function() {
  45556. if (defined_default(this._ionRoot)) {
  45557. return this._ionRoot.credits;
  45558. }
  45559. if (defined_default(this._credits)) {
  45560. return this._credits;
  45561. }
  45562. this._credits = IonResource.getCreditsFromEndpoint(
  45563. this._ionEndpoint,
  45564. this._ionEndpointResource
  45565. );
  45566. return this._credits;
  45567. }
  45568. }
  45569. });
  45570. IonResource.getCreditsFromEndpoint = function(endpoint, endpointResource) {
  45571. const credits = endpoint.attributions.map(Credit_default.getIonCredit);
  45572. const defaultTokenCredit2 = Ion_default.getDefaultTokenCredit(
  45573. endpointResource.queryParameters.access_token
  45574. );
  45575. if (defined_default(defaultTokenCredit2)) {
  45576. credits.push(Credit_default.clone(defaultTokenCredit2));
  45577. }
  45578. return credits;
  45579. };
  45580. IonResource.prototype.clone = function(result) {
  45581. const ionRoot = defaultValue_default(this._ionRoot, this);
  45582. if (!defined_default(result)) {
  45583. result = new IonResource(
  45584. ionRoot._ionEndpoint,
  45585. ionRoot._ionEndpointResource
  45586. );
  45587. }
  45588. result = Resource_default.prototype.clone.call(this, result);
  45589. result._ionRoot = ionRoot;
  45590. result._isExternal = this._isExternal;
  45591. return result;
  45592. };
  45593. IonResource.prototype.fetchImage = function(options) {
  45594. if (!this._isExternal) {
  45595. const userOptions = options;
  45596. options = {
  45597. preferBlob: true
  45598. };
  45599. if (defined_default(userOptions)) {
  45600. options.flipY = userOptions.flipY;
  45601. options.preferImageBitmap = userOptions.preferImageBitmap;
  45602. }
  45603. }
  45604. return Resource_default.prototype.fetchImage.call(this, options);
  45605. };
  45606. IonResource.prototype._makeRequest = function(options) {
  45607. if (this._isExternal || new URI(this.url).authority() !== this._ionEndpointDomain) {
  45608. return Resource_default.prototype._makeRequest.call(this, options);
  45609. }
  45610. if (!defined_default(options.headers)) {
  45611. options.headers = {};
  45612. }
  45613. options.headers.Authorization = `Bearer ${this._ionEndpoint.accessToken}`;
  45614. return Resource_default.prototype._makeRequest.call(this, options);
  45615. };
  45616. IonResource._createEndpointResource = function(assetId, options) {
  45617. Check_default.defined("assetId", assetId);
  45618. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  45619. let server = defaultValue_default(options.server, Ion_default.defaultServer);
  45620. const accessToken = defaultValue_default(options.accessToken, Ion_default.defaultAccessToken);
  45621. server = Resource_default.createIfNeeded(server);
  45622. const resourceOptions = {
  45623. url: `v1/assets/${assetId}/endpoint`
  45624. };
  45625. if (defined_default(accessToken)) {
  45626. resourceOptions.queryParameters = { access_token: accessToken };
  45627. }
  45628. return server.getDerivedResource(resourceOptions);
  45629. };
  45630. function retryCallback(that, error) {
  45631. const ionRoot = defaultValue_default(that._ionRoot, that);
  45632. const endpointResource = ionRoot._ionEndpointResource;
  45633. const imageDefined = typeof Image !== "undefined";
  45634. if (!defined_default(error) || error.statusCode !== 401 && !(imageDefined && error.target instanceof Image)) {
  45635. return Promise.resolve(false);
  45636. }
  45637. if (!defined_default(ionRoot._pendingPromise)) {
  45638. ionRoot._pendingPromise = endpointResource.fetchJson().then(function(newEndpoint) {
  45639. ionRoot._ionEndpoint = newEndpoint;
  45640. return newEndpoint;
  45641. }).finally(function(newEndpoint) {
  45642. ionRoot._pendingPromise = void 0;
  45643. return newEndpoint;
  45644. });
  45645. }
  45646. return ionRoot._pendingPromise.then(function(newEndpoint) {
  45647. that._ionEndpoint = newEndpoint;
  45648. return true;
  45649. });
  45650. }
  45651. var IonResource_default = IonResource;
  45652. // node_modules/cesium/Source/Core/TimeInterval.js
  45653. function TimeInterval(options) {
  45654. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  45655. this.start = defined_default(options.start) ? JulianDate_default.clone(options.start) : new JulianDate_default();
  45656. this.stop = defined_default(options.stop) ? JulianDate_default.clone(options.stop) : new JulianDate_default();
  45657. this.data = options.data;
  45658. this.isStartIncluded = defaultValue_default(options.isStartIncluded, true);
  45659. this.isStopIncluded = defaultValue_default(options.isStopIncluded, true);
  45660. }
  45661. Object.defineProperties(TimeInterval.prototype, {
  45662. isEmpty: {
  45663. get: function() {
  45664. const stopComparedToStart = JulianDate_default.compare(this.stop, this.start);
  45665. return stopComparedToStart < 0 || stopComparedToStart === 0 && (!this.isStartIncluded || !this.isStopIncluded);
  45666. }
  45667. }
  45668. });
  45669. var scratchInterval = {
  45670. start: void 0,
  45671. stop: void 0,
  45672. isStartIncluded: void 0,
  45673. isStopIncluded: void 0,
  45674. data: void 0
  45675. };
  45676. TimeInterval.fromIso8601 = function(options, result) {
  45677. Check_default.typeOf.object("options", options);
  45678. Check_default.typeOf.string("options.iso8601", options.iso8601);
  45679. const dates = options.iso8601.split("/");
  45680. if (dates.length !== 2) {
  45681. throw new DeveloperError_default(
  45682. "options.iso8601 is an invalid ISO 8601 interval."
  45683. );
  45684. }
  45685. const start = JulianDate_default.fromIso8601(dates[0]);
  45686. const stop2 = JulianDate_default.fromIso8601(dates[1]);
  45687. const isStartIncluded = defaultValue_default(options.isStartIncluded, true);
  45688. const isStopIncluded = defaultValue_default(options.isStopIncluded, true);
  45689. const data = options.data;
  45690. if (!defined_default(result)) {
  45691. scratchInterval.start = start;
  45692. scratchInterval.stop = stop2;
  45693. scratchInterval.isStartIncluded = isStartIncluded;
  45694. scratchInterval.isStopIncluded = isStopIncluded;
  45695. scratchInterval.data = data;
  45696. return new TimeInterval(scratchInterval);
  45697. }
  45698. result.start = start;
  45699. result.stop = stop2;
  45700. result.isStartIncluded = isStartIncluded;
  45701. result.isStopIncluded = isStopIncluded;
  45702. result.data = data;
  45703. return result;
  45704. };
  45705. TimeInterval.toIso8601 = function(timeInterval, precision) {
  45706. Check_default.typeOf.object("timeInterval", timeInterval);
  45707. return `${JulianDate_default.toIso8601(
  45708. timeInterval.start,
  45709. precision
  45710. )}/${JulianDate_default.toIso8601(timeInterval.stop, precision)}`;
  45711. };
  45712. TimeInterval.clone = function(timeInterval, result) {
  45713. if (!defined_default(timeInterval)) {
  45714. return void 0;
  45715. }
  45716. if (!defined_default(result)) {
  45717. return new TimeInterval(timeInterval);
  45718. }
  45719. result.start = timeInterval.start;
  45720. result.stop = timeInterval.stop;
  45721. result.isStartIncluded = timeInterval.isStartIncluded;
  45722. result.isStopIncluded = timeInterval.isStopIncluded;
  45723. result.data = timeInterval.data;
  45724. return result;
  45725. };
  45726. TimeInterval.equals = function(left, right, dataComparer) {
  45727. return left === right || defined_default(left) && defined_default(right) && (left.isEmpty && right.isEmpty || left.isStartIncluded === right.isStartIncluded && left.isStopIncluded === right.isStopIncluded && JulianDate_default.equals(left.start, right.start) && JulianDate_default.equals(left.stop, right.stop) && (left.data === right.data || defined_default(dataComparer) && dataComparer(left.data, right.data)));
  45728. };
  45729. TimeInterval.equalsEpsilon = function(left, right, epsilon, dataComparer) {
  45730. epsilon = defaultValue_default(epsilon, 0);
  45731. return left === right || defined_default(left) && defined_default(right) && (left.isEmpty && right.isEmpty || left.isStartIncluded === right.isStartIncluded && left.isStopIncluded === right.isStopIncluded && JulianDate_default.equalsEpsilon(left.start, right.start, epsilon) && JulianDate_default.equalsEpsilon(left.stop, right.stop, epsilon) && (left.data === right.data || defined_default(dataComparer) && dataComparer(left.data, right.data)));
  45732. };
  45733. TimeInterval.intersect = function(left, right, result, mergeCallback) {
  45734. Check_default.typeOf.object("left", left);
  45735. if (!defined_default(right)) {
  45736. return TimeInterval.clone(TimeInterval.EMPTY, result);
  45737. }
  45738. const leftStart = left.start;
  45739. const leftStop = left.stop;
  45740. const rightStart = right.start;
  45741. const rightStop = right.stop;
  45742. const intersectsStartRight = JulianDate_default.greaterThanOrEquals(rightStart, leftStart) && JulianDate_default.greaterThanOrEquals(leftStop, rightStart);
  45743. const intersectsStartLeft = !intersectsStartRight && JulianDate_default.lessThanOrEquals(rightStart, leftStart) && JulianDate_default.lessThanOrEquals(leftStart, rightStop);
  45744. if (!intersectsStartRight && !intersectsStartLeft) {
  45745. return TimeInterval.clone(TimeInterval.EMPTY, result);
  45746. }
  45747. const leftIsStartIncluded = left.isStartIncluded;
  45748. const leftIsStopIncluded = left.isStopIncluded;
  45749. const rightIsStartIncluded = right.isStartIncluded;
  45750. const rightIsStopIncluded = right.isStopIncluded;
  45751. const leftLessThanRight = JulianDate_default.lessThan(leftStop, rightStop);
  45752. if (!defined_default(result)) {
  45753. result = new TimeInterval();
  45754. }
  45755. result.start = intersectsStartRight ? rightStart : leftStart;
  45756. result.isStartIncluded = leftIsStartIncluded && rightIsStartIncluded || !JulianDate_default.equals(rightStart, leftStart) && (intersectsStartRight && rightIsStartIncluded || intersectsStartLeft && leftIsStartIncluded);
  45757. result.stop = leftLessThanRight ? leftStop : rightStop;
  45758. result.isStopIncluded = leftLessThanRight ? leftIsStopIncluded : leftIsStopIncluded && rightIsStopIncluded || !JulianDate_default.equals(rightStop, leftStop) && rightIsStopIncluded;
  45759. result.data = defined_default(mergeCallback) ? mergeCallback(left.data, right.data) : left.data;
  45760. return result;
  45761. };
  45762. TimeInterval.contains = function(timeInterval, julianDate) {
  45763. Check_default.typeOf.object("timeInterval", timeInterval);
  45764. Check_default.typeOf.object("julianDate", julianDate);
  45765. if (timeInterval.isEmpty) {
  45766. return false;
  45767. }
  45768. const startComparedToDate = JulianDate_default.compare(
  45769. timeInterval.start,
  45770. julianDate
  45771. );
  45772. if (startComparedToDate === 0) {
  45773. return timeInterval.isStartIncluded;
  45774. }
  45775. const dateComparedToStop = JulianDate_default.compare(julianDate, timeInterval.stop);
  45776. if (dateComparedToStop === 0) {
  45777. return timeInterval.isStopIncluded;
  45778. }
  45779. return startComparedToDate < 0 && dateComparedToStop < 0;
  45780. };
  45781. TimeInterval.prototype.clone = function(result) {
  45782. return TimeInterval.clone(this, result);
  45783. };
  45784. TimeInterval.prototype.equals = function(right, dataComparer) {
  45785. return TimeInterval.equals(this, right, dataComparer);
  45786. };
  45787. TimeInterval.prototype.equalsEpsilon = function(right, epsilon, dataComparer) {
  45788. return TimeInterval.equalsEpsilon(this, right, epsilon, dataComparer);
  45789. };
  45790. TimeInterval.prototype.toString = function() {
  45791. return TimeInterval.toIso8601(this);
  45792. };
  45793. TimeInterval.EMPTY = Object.freeze(
  45794. new TimeInterval({
  45795. start: new JulianDate_default(),
  45796. stop: new JulianDate_default(),
  45797. isStartIncluded: false,
  45798. isStopIncluded: false
  45799. })
  45800. );
  45801. var TimeInterval_default = TimeInterval;
  45802. // node_modules/cesium/Source/Core/Iso8601.js
  45803. var MINIMUM_VALUE = Object.freeze(
  45804. JulianDate_default.fromIso8601("0000-01-01T00:00:00Z")
  45805. );
  45806. var MAXIMUM_VALUE = Object.freeze(
  45807. JulianDate_default.fromIso8601("9999-12-31T24:00:00Z")
  45808. );
  45809. var MAXIMUM_INTERVAL = Object.freeze(
  45810. new TimeInterval_default({
  45811. start: MINIMUM_VALUE,
  45812. stop: MAXIMUM_VALUE
  45813. })
  45814. );
  45815. var Iso8601 = {
  45816. MINIMUM_VALUE,
  45817. MAXIMUM_VALUE,
  45818. MAXIMUM_INTERVAL
  45819. };
  45820. var Iso8601_default = Iso8601;
  45821. // node_modules/cesium/Source/Core/KTX2Transcoder.js
  45822. function KTX2Transcoder() {
  45823. }
  45824. KTX2Transcoder._transcodeTaskProcessor = new TaskProcessor_default(
  45825. "transcodeKTX2",
  45826. Number.POSITIVE_INFINITY
  45827. );
  45828. KTX2Transcoder._readyPromise = void 0;
  45829. function makeReadyPromise() {
  45830. const readyPromise = KTX2Transcoder._transcodeTaskProcessor.initWebAssemblyModule({
  45831. modulePath: "ThirdParty/Workers/basis_transcoder.js",
  45832. wasmBinaryFile: "ThirdParty/basis_transcoder.wasm"
  45833. }).then(function() {
  45834. return KTX2Transcoder._transcodeTaskProcessor;
  45835. });
  45836. KTX2Transcoder._readyPromise = readyPromise;
  45837. }
  45838. KTX2Transcoder.transcode = function(ktx2Buffer, supportedTargetFormats) {
  45839. Check_default.defined("supportedTargetFormats", supportedTargetFormats);
  45840. if (!defined_default(KTX2Transcoder._readyPromise)) {
  45841. makeReadyPromise();
  45842. }
  45843. return KTX2Transcoder._readyPromise.then(function(taskProcessor3) {
  45844. let parameters;
  45845. if (ktx2Buffer instanceof ArrayBuffer) {
  45846. const view = new Uint8Array(ktx2Buffer);
  45847. parameters = {
  45848. supportedTargetFormats,
  45849. ktx2Buffer: view
  45850. };
  45851. return taskProcessor3.scheduleTask(parameters, [ktx2Buffer]);
  45852. }
  45853. parameters = {
  45854. supportedTargetFormats,
  45855. ktx2Buffer
  45856. };
  45857. return taskProcessor3.scheduleTask(parameters, [ktx2Buffer.buffer]);
  45858. }).then(function(result) {
  45859. const levelsLength = result.length;
  45860. const faceKeys = Object.keys(result[0]);
  45861. const faceKeysLength = faceKeys.length;
  45862. let i2;
  45863. for (i2 = 0; i2 < levelsLength; i2++) {
  45864. const faces2 = result[i2];
  45865. for (let j = 0; j < faceKeysLength; j++) {
  45866. const face = faces2[faceKeys[j]];
  45867. faces2[faceKeys[j]] = new CompressedTextureBuffer_default(
  45868. face.internalFormat,
  45869. face.datatype,
  45870. face.width,
  45871. face.height,
  45872. face.levelBuffer
  45873. );
  45874. }
  45875. }
  45876. if (faceKeysLength === 1) {
  45877. for (i2 = 0; i2 < levelsLength; ++i2) {
  45878. result[i2] = result[i2][faceKeys[0]];
  45879. }
  45880. if (levelsLength === 1) {
  45881. result = result[0];
  45882. }
  45883. }
  45884. return result;
  45885. }).catch(function(error) {
  45886. throw error;
  45887. });
  45888. };
  45889. var KTX2Transcoder_default = KTX2Transcoder;
  45890. // node_modules/cesium/Source/Core/KeyboardEventModifier.js
  45891. var KeyboardEventModifier = {
  45892. SHIFT: 0,
  45893. CTRL: 1,
  45894. ALT: 2
  45895. };
  45896. var KeyboardEventModifier_default = Object.freeze(KeyboardEventModifier);
  45897. // node_modules/cesium/Source/Core/LagrangePolynomialApproximation.js
  45898. var LagrangePolynomialApproximation = {
  45899. type: "Lagrange"
  45900. };
  45901. LagrangePolynomialApproximation.getRequiredDataPoints = function(degree) {
  45902. return Math.max(degree + 1, 2);
  45903. };
  45904. LagrangePolynomialApproximation.interpolateOrderZero = function(x, xTable, yTable, yStride, result) {
  45905. if (!defined_default(result)) {
  45906. result = new Array(yStride);
  45907. }
  45908. let i2;
  45909. let j;
  45910. const length3 = xTable.length;
  45911. for (i2 = 0; i2 < yStride; i2++) {
  45912. result[i2] = 0;
  45913. }
  45914. for (i2 = 0; i2 < length3; i2++) {
  45915. let coefficient = 1;
  45916. for (j = 0; j < length3; j++) {
  45917. if (j !== i2) {
  45918. const diffX = xTable[i2] - xTable[j];
  45919. coefficient *= (x - xTable[j]) / diffX;
  45920. }
  45921. }
  45922. for (j = 0; j < yStride; j++) {
  45923. result[j] += coefficient * yTable[i2 * yStride + j];
  45924. }
  45925. }
  45926. return result;
  45927. };
  45928. var LagrangePolynomialApproximation_default = LagrangePolynomialApproximation;
  45929. // node_modules/cesium/Source/Core/LinearApproximation.js
  45930. var LinearApproximation = {
  45931. type: "Linear"
  45932. };
  45933. LinearApproximation.getRequiredDataPoints = function(degree) {
  45934. return 2;
  45935. };
  45936. LinearApproximation.interpolateOrderZero = function(x, xTable, yTable, yStride, result) {
  45937. if (xTable.length !== 2) {
  45938. throw new DeveloperError_default(
  45939. "The xTable provided to the linear interpolator must have exactly two elements."
  45940. );
  45941. } else if (yStride <= 0) {
  45942. throw new DeveloperError_default(
  45943. "There must be at least 1 dependent variable for each independent variable."
  45944. );
  45945. }
  45946. if (!defined_default(result)) {
  45947. result = new Array(yStride);
  45948. }
  45949. let i2;
  45950. let y0;
  45951. let y1;
  45952. const x0 = xTable[0];
  45953. const x1 = xTable[1];
  45954. if (x0 === x1) {
  45955. throw new DeveloperError_default(
  45956. "Divide by zero error: xTable[0] and xTable[1] are equal"
  45957. );
  45958. }
  45959. for (i2 = 0; i2 < yStride; i2++) {
  45960. y0 = yTable[i2];
  45961. y1 = yTable[i2 + yStride];
  45962. result[i2] = ((y1 - y0) * x + x1 * y0 - x0 * y1) / (x1 - x0);
  45963. }
  45964. return result;
  45965. };
  45966. var LinearApproximation_default = LinearApproximation;
  45967. // node_modules/cesium/Source/Core/ManagedArray.js
  45968. function ManagedArray(length3) {
  45969. length3 = defaultValue_default(length3, 0);
  45970. this._array = new Array(length3);
  45971. this._length = length3;
  45972. }
  45973. Object.defineProperties(ManagedArray.prototype, {
  45974. length: {
  45975. get: function() {
  45976. return this._length;
  45977. },
  45978. set: function(length3) {
  45979. Check_default.typeOf.number.greaterThanOrEquals("length", length3, 0);
  45980. const array = this._array;
  45981. const originalLength = this._length;
  45982. if (length3 < originalLength) {
  45983. for (let i2 = length3; i2 < originalLength; ++i2) {
  45984. array[i2] = void 0;
  45985. }
  45986. } else if (length3 > array.length) {
  45987. array.length = length3;
  45988. }
  45989. this._length = length3;
  45990. }
  45991. },
  45992. values: {
  45993. get: function() {
  45994. return this._array;
  45995. }
  45996. }
  45997. });
  45998. ManagedArray.prototype.get = function(index2) {
  45999. Check_default.typeOf.number.lessThan("index", index2, this._array.length);
  46000. return this._array[index2];
  46001. };
  46002. ManagedArray.prototype.set = function(index2, element) {
  46003. Check_default.typeOf.number("index", index2);
  46004. if (index2 >= this._length) {
  46005. this.length = index2 + 1;
  46006. }
  46007. this._array[index2] = element;
  46008. };
  46009. ManagedArray.prototype.peek = function() {
  46010. return this._array[this._length - 1];
  46011. };
  46012. ManagedArray.prototype.push = function(element) {
  46013. const index2 = this.length++;
  46014. this._array[index2] = element;
  46015. };
  46016. ManagedArray.prototype.pop = function() {
  46017. if (this._length === 0) {
  46018. return void 0;
  46019. }
  46020. const element = this._array[this._length - 1];
  46021. --this.length;
  46022. return element;
  46023. };
  46024. ManagedArray.prototype.reserve = function(length3) {
  46025. Check_default.typeOf.number.greaterThanOrEquals("length", length3, 0);
  46026. if (length3 > this._array.length) {
  46027. this._array.length = length3;
  46028. }
  46029. };
  46030. ManagedArray.prototype.resize = function(length3) {
  46031. Check_default.typeOf.number.greaterThanOrEquals("length", length3, 0);
  46032. this.length = length3;
  46033. };
  46034. ManagedArray.prototype.trim = function(length3) {
  46035. length3 = defaultValue_default(length3, this._length);
  46036. this._array.length = length3;
  46037. };
  46038. var ManagedArray_default = ManagedArray;
  46039. // node_modules/cesium/Source/Core/MapProjection.js
  46040. function MapProjection() {
  46041. DeveloperError_default.throwInstantiationError();
  46042. }
  46043. Object.defineProperties(MapProjection.prototype, {
  46044. ellipsoid: {
  46045. get: DeveloperError_default.throwInstantiationError
  46046. }
  46047. });
  46048. MapProjection.prototype.project = DeveloperError_default.throwInstantiationError;
  46049. MapProjection.prototype.unproject = DeveloperError_default.throwInstantiationError;
  46050. var MapProjection_default = MapProjection;
  46051. // node_modules/cesium/Source/Core/MorphWeightSpline.js
  46052. function MorphWeightSpline(options) {
  46053. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  46054. const weights2 = options.weights;
  46055. const times = options.times;
  46056. Check_default.defined("weights", weights2);
  46057. Check_default.defined("times", times);
  46058. Check_default.typeOf.number.greaterThanOrEquals("weights.length", weights2.length, 3);
  46059. if (weights2.length % times.length !== 0) {
  46060. throw new DeveloperError_default(
  46061. "times.length must be a factor of weights.length."
  46062. );
  46063. }
  46064. this._times = times;
  46065. this._weights = weights2;
  46066. this._count = weights2.length / times.length;
  46067. this._lastTimeIndex = 0;
  46068. }
  46069. Object.defineProperties(MorphWeightSpline.prototype, {
  46070. times: {
  46071. get: function() {
  46072. return this._times;
  46073. }
  46074. },
  46075. weights: {
  46076. get: function() {
  46077. return this._weights;
  46078. }
  46079. }
  46080. });
  46081. MorphWeightSpline.prototype.findTimeInterval = Spline_default.prototype.findTimeInterval;
  46082. MorphWeightSpline.prototype.wrapTime = Spline_default.prototype.wrapTime;
  46083. MorphWeightSpline.prototype.clampTime = Spline_default.prototype.clampTime;
  46084. MorphWeightSpline.prototype.evaluate = function(time, result) {
  46085. const weights2 = this.weights;
  46086. const times = this.times;
  46087. const i2 = this._lastTimeIndex = this.findTimeInterval(
  46088. time,
  46089. this._lastTimeIndex
  46090. );
  46091. const u3 = (time - times[i2]) / (times[i2 + 1] - times[i2]);
  46092. if (!defined_default(result)) {
  46093. result = new Array(this._count);
  46094. }
  46095. for (let j = 0; j < this._count; j++) {
  46096. const index2 = i2 * this._count + j;
  46097. result[j] = weights2[index2] * (1 - u3) + weights2[index2 + this._count] * u3;
  46098. }
  46099. return result;
  46100. };
  46101. var MorphWeightSpline_default = MorphWeightSpline;
  46102. // node_modules/cesium/Source/Core/MortonOrder.js
  46103. var MortonOrder = {};
  46104. function insertOneSpacing(v7) {
  46105. v7 = (v7 ^ v7 << 8) & 16711935;
  46106. v7 = (v7 ^ v7 << 4) & 252645135;
  46107. v7 = (v7 ^ v7 << 2) & 858993459;
  46108. v7 = (v7 ^ v7 << 1) & 1431655765;
  46109. return v7;
  46110. }
  46111. function insertTwoSpacing(v7) {
  46112. v7 = (v7 ^ v7 << 16) & 50331903;
  46113. v7 = (v7 ^ v7 << 8) & 50393103;
  46114. v7 = (v7 ^ v7 << 4) & 51130563;
  46115. v7 = (v7 ^ v7 << 2) & 153391689;
  46116. return v7;
  46117. }
  46118. function removeOneSpacing(v7) {
  46119. v7 &= 1431655765;
  46120. v7 = (v7 ^ v7 >> 1) & 858993459;
  46121. v7 = (v7 ^ v7 >> 2) & 252645135;
  46122. v7 = (v7 ^ v7 >> 4) & 16711935;
  46123. v7 = (v7 ^ v7 >> 8) & 65535;
  46124. return v7;
  46125. }
  46126. function removeTwoSpacing(v7) {
  46127. v7 &= 153391689;
  46128. v7 = (v7 ^ v7 >> 2) & 51130563;
  46129. v7 = (v7 ^ v7 >> 4) & 50393103;
  46130. v7 = (v7 ^ v7 >> 8) & 4278190335;
  46131. v7 = (v7 ^ v7 >> 16) & 1023;
  46132. return v7;
  46133. }
  46134. MortonOrder.encode2D = function(x, y) {
  46135. Check_default.typeOf.number("x", x);
  46136. Check_default.typeOf.number("y", y);
  46137. if (x < 0 || x > 65535 || y < 0 || y > 65535) {
  46138. throw new DeveloperError_default("inputs must be 16-bit unsigned integers");
  46139. }
  46140. return (insertOneSpacing(x) | insertOneSpacing(y) << 1) >>> 0;
  46141. };
  46142. MortonOrder.decode2D = function(mortonIndex, result) {
  46143. Check_default.typeOf.number("mortonIndex", mortonIndex);
  46144. if (mortonIndex < 0 || mortonIndex > 4294967295) {
  46145. throw new DeveloperError_default("input must be a 32-bit unsigned integer");
  46146. }
  46147. if (!defined_default(result)) {
  46148. result = new Array(2);
  46149. }
  46150. result[0] = removeOneSpacing(mortonIndex);
  46151. result[1] = removeOneSpacing(mortonIndex >> 1);
  46152. return result;
  46153. };
  46154. MortonOrder.encode3D = function(x, y, z) {
  46155. Check_default.typeOf.number("x", x);
  46156. Check_default.typeOf.number("y", y);
  46157. Check_default.typeOf.number("z", z);
  46158. if (x < 0 || x > 1023 || y < 0 || y > 1023 || z < 0 || z > 1023) {
  46159. throw new DeveloperError_default("inputs must be 10-bit unsigned integers");
  46160. }
  46161. return insertTwoSpacing(x) | insertTwoSpacing(y) << 1 | insertTwoSpacing(z) << 2;
  46162. };
  46163. MortonOrder.decode3D = function(mortonIndex, result) {
  46164. Check_default.typeOf.number("mortonIndex", mortonIndex);
  46165. if (mortonIndex < 0 || mortonIndex > 1073741823) {
  46166. throw new DeveloperError_default("input must be a 30-bit unsigned integer");
  46167. }
  46168. if (!defined_default(result)) {
  46169. result = new Array(3);
  46170. }
  46171. result[0] = removeTwoSpacing(mortonIndex);
  46172. result[1] = removeTwoSpacing(mortonIndex >> 1);
  46173. result[2] = removeTwoSpacing(mortonIndex >> 2);
  46174. return result;
  46175. };
  46176. var MortonOrder_default = MortonOrder;
  46177. // node_modules/cesium/Source/Core/NearFarScalar.js
  46178. function NearFarScalar(near, nearValue, far, farValue) {
  46179. this.near = defaultValue_default(near, 0);
  46180. this.nearValue = defaultValue_default(nearValue, 0);
  46181. this.far = defaultValue_default(far, 1);
  46182. this.farValue = defaultValue_default(farValue, 0);
  46183. }
  46184. NearFarScalar.clone = function(nearFarScalar, result) {
  46185. if (!defined_default(nearFarScalar)) {
  46186. return void 0;
  46187. }
  46188. if (!defined_default(result)) {
  46189. return new NearFarScalar(
  46190. nearFarScalar.near,
  46191. nearFarScalar.nearValue,
  46192. nearFarScalar.far,
  46193. nearFarScalar.farValue
  46194. );
  46195. }
  46196. result.near = nearFarScalar.near;
  46197. result.nearValue = nearFarScalar.nearValue;
  46198. result.far = nearFarScalar.far;
  46199. result.farValue = nearFarScalar.farValue;
  46200. return result;
  46201. };
  46202. NearFarScalar.packedLength = 4;
  46203. NearFarScalar.pack = function(value, array, startingIndex) {
  46204. if (!defined_default(value)) {
  46205. throw new DeveloperError_default("value is required");
  46206. }
  46207. if (!defined_default(array)) {
  46208. throw new DeveloperError_default("array is required");
  46209. }
  46210. startingIndex = defaultValue_default(startingIndex, 0);
  46211. array[startingIndex++] = value.near;
  46212. array[startingIndex++] = value.nearValue;
  46213. array[startingIndex++] = value.far;
  46214. array[startingIndex] = value.farValue;
  46215. return array;
  46216. };
  46217. NearFarScalar.unpack = function(array, startingIndex, result) {
  46218. if (!defined_default(array)) {
  46219. throw new DeveloperError_default("array is required");
  46220. }
  46221. startingIndex = defaultValue_default(startingIndex, 0);
  46222. if (!defined_default(result)) {
  46223. result = new NearFarScalar();
  46224. }
  46225. result.near = array[startingIndex++];
  46226. result.nearValue = array[startingIndex++];
  46227. result.far = array[startingIndex++];
  46228. result.farValue = array[startingIndex];
  46229. return result;
  46230. };
  46231. NearFarScalar.equals = function(left, right) {
  46232. return left === right || defined_default(left) && defined_default(right) && left.near === right.near && left.nearValue === right.nearValue && left.far === right.far && left.farValue === right.farValue;
  46233. };
  46234. NearFarScalar.prototype.clone = function(result) {
  46235. return NearFarScalar.clone(this, result);
  46236. };
  46237. NearFarScalar.prototype.equals = function(right) {
  46238. return NearFarScalar.equals(this, right);
  46239. };
  46240. var NearFarScalar_default = NearFarScalar;
  46241. // node_modules/cesium/Source/Core/Visibility.js
  46242. var Visibility = {
  46243. NONE: -1,
  46244. PARTIAL: 0,
  46245. FULL: 1
  46246. };
  46247. var Visibility_default = Object.freeze(Visibility);
  46248. // node_modules/cesium/Source/Core/Occluder.js
  46249. function Occluder(occluderBoundingSphere, cameraPosition) {
  46250. if (!defined_default(occluderBoundingSphere)) {
  46251. throw new DeveloperError_default("occluderBoundingSphere is required.");
  46252. }
  46253. if (!defined_default(cameraPosition)) {
  46254. throw new DeveloperError_default("camera position is required.");
  46255. }
  46256. this._occluderPosition = Cartesian3_default.clone(occluderBoundingSphere.center);
  46257. this._occluderRadius = occluderBoundingSphere.radius;
  46258. this._horizonDistance = 0;
  46259. this._horizonPlaneNormal = void 0;
  46260. this._horizonPlanePosition = void 0;
  46261. this._cameraPosition = void 0;
  46262. this.cameraPosition = cameraPosition;
  46263. }
  46264. var scratchCartesian38 = new Cartesian3_default();
  46265. Object.defineProperties(Occluder.prototype, {
  46266. position: {
  46267. get: function() {
  46268. return this._occluderPosition;
  46269. }
  46270. },
  46271. radius: {
  46272. get: function() {
  46273. return this._occluderRadius;
  46274. }
  46275. },
  46276. cameraPosition: {
  46277. set: function(cameraPosition) {
  46278. if (!defined_default(cameraPosition)) {
  46279. throw new DeveloperError_default("cameraPosition is required.");
  46280. }
  46281. cameraPosition = Cartesian3_default.clone(cameraPosition, this._cameraPosition);
  46282. const cameraToOccluderVec = Cartesian3_default.subtract(
  46283. this._occluderPosition,
  46284. cameraPosition,
  46285. scratchCartesian38
  46286. );
  46287. let invCameraToOccluderDistance = Cartesian3_default.magnitudeSquared(
  46288. cameraToOccluderVec
  46289. );
  46290. const occluderRadiusSqrd = this._occluderRadius * this._occluderRadius;
  46291. let horizonDistance;
  46292. let horizonPlaneNormal;
  46293. let horizonPlanePosition;
  46294. if (invCameraToOccluderDistance > occluderRadiusSqrd) {
  46295. horizonDistance = Math.sqrt(
  46296. invCameraToOccluderDistance - occluderRadiusSqrd
  46297. );
  46298. invCameraToOccluderDistance = 1 / Math.sqrt(invCameraToOccluderDistance);
  46299. horizonPlaneNormal = Cartesian3_default.multiplyByScalar(
  46300. cameraToOccluderVec,
  46301. invCameraToOccluderDistance,
  46302. scratchCartesian38
  46303. );
  46304. const nearPlaneDistance = horizonDistance * horizonDistance * invCameraToOccluderDistance;
  46305. horizonPlanePosition = Cartesian3_default.add(
  46306. cameraPosition,
  46307. Cartesian3_default.multiplyByScalar(
  46308. horizonPlaneNormal,
  46309. nearPlaneDistance,
  46310. scratchCartesian38
  46311. ),
  46312. scratchCartesian38
  46313. );
  46314. } else {
  46315. horizonDistance = Number.MAX_VALUE;
  46316. }
  46317. this._horizonDistance = horizonDistance;
  46318. this._horizonPlaneNormal = horizonPlaneNormal;
  46319. this._horizonPlanePosition = horizonPlanePosition;
  46320. this._cameraPosition = cameraPosition;
  46321. }
  46322. }
  46323. });
  46324. Occluder.fromBoundingSphere = function(occluderBoundingSphere, cameraPosition, result) {
  46325. if (!defined_default(occluderBoundingSphere)) {
  46326. throw new DeveloperError_default("occluderBoundingSphere is required.");
  46327. }
  46328. if (!defined_default(cameraPosition)) {
  46329. throw new DeveloperError_default("camera position is required.");
  46330. }
  46331. if (!defined_default(result)) {
  46332. return new Occluder(occluderBoundingSphere, cameraPosition);
  46333. }
  46334. Cartesian3_default.clone(occluderBoundingSphere.center, result._occluderPosition);
  46335. result._occluderRadius = occluderBoundingSphere.radius;
  46336. result.cameraPosition = cameraPosition;
  46337. return result;
  46338. };
  46339. var tempVecScratch = new Cartesian3_default();
  46340. Occluder.prototype.isPointVisible = function(occludee) {
  46341. if (this._horizonDistance !== Number.MAX_VALUE) {
  46342. let tempVec2 = Cartesian3_default.subtract(
  46343. occludee,
  46344. this._occluderPosition,
  46345. tempVecScratch
  46346. );
  46347. let temp = this._occluderRadius;
  46348. temp = Cartesian3_default.magnitudeSquared(tempVec2) - temp * temp;
  46349. if (temp > 0) {
  46350. temp = Math.sqrt(temp) + this._horizonDistance;
  46351. tempVec2 = Cartesian3_default.subtract(occludee, this._cameraPosition, tempVec2);
  46352. return temp * temp > Cartesian3_default.magnitudeSquared(tempVec2);
  46353. }
  46354. }
  46355. return false;
  46356. };
  46357. var occludeePositionScratch = new Cartesian3_default();
  46358. Occluder.prototype.isBoundingSphereVisible = function(occludee) {
  46359. const occludeePosition = Cartesian3_default.clone(
  46360. occludee.center,
  46361. occludeePositionScratch
  46362. );
  46363. const occludeeRadius = occludee.radius;
  46364. if (this._horizonDistance !== Number.MAX_VALUE) {
  46365. let tempVec2 = Cartesian3_default.subtract(
  46366. occludeePosition,
  46367. this._occluderPosition,
  46368. tempVecScratch
  46369. );
  46370. let temp = this._occluderRadius - occludeeRadius;
  46371. temp = Cartesian3_default.magnitudeSquared(tempVec2) - temp * temp;
  46372. if (occludeeRadius < this._occluderRadius) {
  46373. if (temp > 0) {
  46374. temp = Math.sqrt(temp) + this._horizonDistance;
  46375. tempVec2 = Cartesian3_default.subtract(
  46376. occludeePosition,
  46377. this._cameraPosition,
  46378. tempVec2
  46379. );
  46380. return temp * temp + occludeeRadius * occludeeRadius > Cartesian3_default.magnitudeSquared(tempVec2);
  46381. }
  46382. return false;
  46383. }
  46384. if (temp > 0) {
  46385. tempVec2 = Cartesian3_default.subtract(
  46386. occludeePosition,
  46387. this._cameraPosition,
  46388. tempVec2
  46389. );
  46390. const tempVecMagnitudeSquared = Cartesian3_default.magnitudeSquared(tempVec2);
  46391. const occluderRadiusSquared = this._occluderRadius * this._occluderRadius;
  46392. const occludeeRadiusSquared = occludeeRadius * occludeeRadius;
  46393. if ((this._horizonDistance * this._horizonDistance + occluderRadiusSquared) * occludeeRadiusSquared > tempVecMagnitudeSquared * occluderRadiusSquared) {
  46394. return true;
  46395. }
  46396. temp = Math.sqrt(temp) + this._horizonDistance;
  46397. return temp * temp + occludeeRadiusSquared > tempVecMagnitudeSquared;
  46398. }
  46399. return true;
  46400. }
  46401. return false;
  46402. };
  46403. var tempScratch2 = new Cartesian3_default();
  46404. Occluder.prototype.computeVisibility = function(occludeeBS) {
  46405. if (!defined_default(occludeeBS)) {
  46406. throw new DeveloperError_default("occludeeBS is required.");
  46407. }
  46408. const occludeePosition = Cartesian3_default.clone(occludeeBS.center);
  46409. const occludeeRadius = occludeeBS.radius;
  46410. if (occludeeRadius > this._occluderRadius) {
  46411. return Visibility_default.FULL;
  46412. }
  46413. if (this._horizonDistance !== Number.MAX_VALUE) {
  46414. let tempVec2 = Cartesian3_default.subtract(
  46415. occludeePosition,
  46416. this._occluderPosition,
  46417. tempScratch2
  46418. );
  46419. let temp = this._occluderRadius - occludeeRadius;
  46420. const occluderToOccludeeDistSqrd = Cartesian3_default.magnitudeSquared(tempVec2);
  46421. temp = occluderToOccludeeDistSqrd - temp * temp;
  46422. if (temp > 0) {
  46423. temp = Math.sqrt(temp) + this._horizonDistance;
  46424. tempVec2 = Cartesian3_default.subtract(
  46425. occludeePosition,
  46426. this._cameraPosition,
  46427. tempVec2
  46428. );
  46429. const cameraToOccludeeDistSqrd = Cartesian3_default.magnitudeSquared(tempVec2);
  46430. if (temp * temp + occludeeRadius * occludeeRadius < cameraToOccludeeDistSqrd) {
  46431. return Visibility_default.NONE;
  46432. }
  46433. temp = this._occluderRadius + occludeeRadius;
  46434. temp = occluderToOccludeeDistSqrd - temp * temp;
  46435. if (temp > 0) {
  46436. temp = Math.sqrt(temp) + this._horizonDistance;
  46437. return cameraToOccludeeDistSqrd < temp * temp + occludeeRadius * occludeeRadius ? Visibility_default.FULL : Visibility_default.PARTIAL;
  46438. }
  46439. tempVec2 = Cartesian3_default.subtract(
  46440. occludeePosition,
  46441. this._horizonPlanePosition,
  46442. tempVec2
  46443. );
  46444. return Cartesian3_default.dot(tempVec2, this._horizonPlaneNormal) > -occludeeRadius ? Visibility_default.PARTIAL : Visibility_default.FULL;
  46445. }
  46446. }
  46447. return Visibility_default.NONE;
  46448. };
  46449. var occludeePointScratch = new Cartesian3_default();
  46450. Occluder.computeOccludeePoint = function(occluderBoundingSphere, occludeePosition, positions) {
  46451. if (!defined_default(occluderBoundingSphere)) {
  46452. throw new DeveloperError_default("occluderBoundingSphere is required.");
  46453. }
  46454. if (!defined_default(positions)) {
  46455. throw new DeveloperError_default("positions is required.");
  46456. }
  46457. if (positions.length === 0) {
  46458. throw new DeveloperError_default("positions must contain at least one element");
  46459. }
  46460. const occludeePos = Cartesian3_default.clone(occludeePosition);
  46461. const occluderPosition = Cartesian3_default.clone(occluderBoundingSphere.center);
  46462. const occluderRadius = occluderBoundingSphere.radius;
  46463. const numPositions = positions.length;
  46464. if (Cartesian3_default.equals(occluderPosition, occludeePosition)) {
  46465. throw new DeveloperError_default(
  46466. "occludeePosition must be different than occluderBoundingSphere.center"
  46467. );
  46468. }
  46469. const occluderPlaneNormal = Cartesian3_default.normalize(
  46470. Cartesian3_default.subtract(occludeePos, occluderPosition, occludeePointScratch),
  46471. occludeePointScratch
  46472. );
  46473. const occluderPlaneD = -Cartesian3_default.dot(occluderPlaneNormal, occluderPosition);
  46474. const aRotationVector = Occluder._anyRotationVector(
  46475. occluderPosition,
  46476. occluderPlaneNormal,
  46477. occluderPlaneD
  46478. );
  46479. let dot2 = Occluder._horizonToPlaneNormalDotProduct(
  46480. occluderBoundingSphere,
  46481. occluderPlaneNormal,
  46482. occluderPlaneD,
  46483. aRotationVector,
  46484. positions[0]
  46485. );
  46486. if (!dot2) {
  46487. return void 0;
  46488. }
  46489. let tempDot;
  46490. for (let i2 = 1; i2 < numPositions; ++i2) {
  46491. tempDot = Occluder._horizonToPlaneNormalDotProduct(
  46492. occluderBoundingSphere,
  46493. occluderPlaneNormal,
  46494. occluderPlaneD,
  46495. aRotationVector,
  46496. positions[i2]
  46497. );
  46498. if (!tempDot) {
  46499. return void 0;
  46500. }
  46501. if (tempDot < dot2) {
  46502. dot2 = tempDot;
  46503. }
  46504. }
  46505. if (dot2 < 0.0017453283658983088) {
  46506. return void 0;
  46507. }
  46508. const distance2 = occluderRadius / dot2;
  46509. return Cartesian3_default.add(
  46510. occluderPosition,
  46511. Cartesian3_default.multiplyByScalar(
  46512. occluderPlaneNormal,
  46513. distance2,
  46514. occludeePointScratch
  46515. ),
  46516. occludeePointScratch
  46517. );
  46518. };
  46519. var computeOccludeePointFromRectangleScratch = [];
  46520. Occluder.computeOccludeePointFromRectangle = function(rectangle, ellipsoid) {
  46521. if (!defined_default(rectangle)) {
  46522. throw new DeveloperError_default("rectangle is required.");
  46523. }
  46524. ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  46525. const positions = Rectangle_default.subsample(
  46526. rectangle,
  46527. ellipsoid,
  46528. 0,
  46529. computeOccludeePointFromRectangleScratch
  46530. );
  46531. const bs = BoundingSphere_default.fromPoints(positions);
  46532. const ellipsoidCenter = Cartesian3_default.ZERO;
  46533. if (!Cartesian3_default.equals(ellipsoidCenter, bs.center)) {
  46534. return Occluder.computeOccludeePoint(
  46535. new BoundingSphere_default(ellipsoidCenter, ellipsoid.minimumRadius),
  46536. bs.center,
  46537. positions
  46538. );
  46539. }
  46540. return void 0;
  46541. };
  46542. var tempVec0Scratch = new Cartesian3_default();
  46543. Occluder._anyRotationVector = function(occluderPosition, occluderPlaneNormal, occluderPlaneD) {
  46544. const tempVec0 = Cartesian3_default.abs(occluderPlaneNormal, tempVec0Scratch);
  46545. let majorAxis = tempVec0.x > tempVec0.y ? 0 : 1;
  46546. if (majorAxis === 0 && tempVec0.z > tempVec0.x || majorAxis === 1 && tempVec0.z > tempVec0.y) {
  46547. majorAxis = 2;
  46548. }
  46549. const tempVec2 = new Cartesian3_default();
  46550. let tempVec1;
  46551. if (majorAxis === 0) {
  46552. tempVec0.x = occluderPosition.x;
  46553. tempVec0.y = occluderPosition.y + 1;
  46554. tempVec0.z = occluderPosition.z + 1;
  46555. tempVec1 = Cartesian3_default.UNIT_X;
  46556. } else if (majorAxis === 1) {
  46557. tempVec0.x = occluderPosition.x + 1;
  46558. tempVec0.y = occluderPosition.y;
  46559. tempVec0.z = occluderPosition.z + 1;
  46560. tempVec1 = Cartesian3_default.UNIT_Y;
  46561. } else {
  46562. tempVec0.x = occluderPosition.x + 1;
  46563. tempVec0.y = occluderPosition.y + 1;
  46564. tempVec0.z = occluderPosition.z;
  46565. tempVec1 = Cartesian3_default.UNIT_Z;
  46566. }
  46567. const u3 = (Cartesian3_default.dot(occluderPlaneNormal, tempVec0) + occluderPlaneD) / -Cartesian3_default.dot(occluderPlaneNormal, tempVec1);
  46568. return Cartesian3_default.normalize(
  46569. Cartesian3_default.subtract(
  46570. Cartesian3_default.add(
  46571. tempVec0,
  46572. Cartesian3_default.multiplyByScalar(tempVec1, u3, tempVec2),
  46573. tempVec0
  46574. ),
  46575. occluderPosition,
  46576. tempVec0
  46577. ),
  46578. tempVec0
  46579. );
  46580. };
  46581. var posDirectionScratch = new Cartesian3_default();
  46582. Occluder._rotationVector = function(occluderPosition, occluderPlaneNormal, occluderPlaneD, position, anyRotationVector) {
  46583. let positionDirection = Cartesian3_default.subtract(
  46584. position,
  46585. occluderPosition,
  46586. posDirectionScratch
  46587. );
  46588. positionDirection = Cartesian3_default.normalize(
  46589. positionDirection,
  46590. positionDirection
  46591. );
  46592. if (Cartesian3_default.dot(occluderPlaneNormal, positionDirection) < 0.9999999847691291) {
  46593. const crossProduct = Cartesian3_default.cross(
  46594. occluderPlaneNormal,
  46595. positionDirection,
  46596. positionDirection
  46597. );
  46598. const length3 = Cartesian3_default.magnitude(crossProduct);
  46599. if (length3 > Math_default.EPSILON13) {
  46600. return Cartesian3_default.normalize(crossProduct, new Cartesian3_default());
  46601. }
  46602. }
  46603. return anyRotationVector;
  46604. };
  46605. var posScratch1 = new Cartesian3_default();
  46606. var occluerPosScratch = new Cartesian3_default();
  46607. var posScratch2 = new Cartesian3_default();
  46608. var horizonPlanePosScratch = new Cartesian3_default();
  46609. Occluder._horizonToPlaneNormalDotProduct = function(occluderBS, occluderPlaneNormal, occluderPlaneD, anyRotationVector, position) {
  46610. const pos = Cartesian3_default.clone(position, posScratch1);
  46611. const occluderPosition = Cartesian3_default.clone(
  46612. occluderBS.center,
  46613. occluerPosScratch
  46614. );
  46615. const occluderRadius = occluderBS.radius;
  46616. let positionToOccluder = Cartesian3_default.subtract(
  46617. occluderPosition,
  46618. pos,
  46619. posScratch2
  46620. );
  46621. const occluderToPositionDistanceSquared = Cartesian3_default.magnitudeSquared(
  46622. positionToOccluder
  46623. );
  46624. const occluderRadiusSquared = occluderRadius * occluderRadius;
  46625. if (occluderToPositionDistanceSquared < occluderRadiusSquared) {
  46626. return false;
  46627. }
  46628. const horizonDistanceSquared = occluderToPositionDistanceSquared - occluderRadiusSquared;
  46629. const horizonDistance = Math.sqrt(horizonDistanceSquared);
  46630. const occluderToPositionDistance = Math.sqrt(
  46631. occluderToPositionDistanceSquared
  46632. );
  46633. const invOccluderToPositionDistance = 1 / occluderToPositionDistance;
  46634. const cosTheta = horizonDistance * invOccluderToPositionDistance;
  46635. const horizonPlaneDistance = cosTheta * horizonDistance;
  46636. positionToOccluder = Cartesian3_default.normalize(
  46637. positionToOccluder,
  46638. positionToOccluder
  46639. );
  46640. const horizonPlanePosition = Cartesian3_default.add(
  46641. pos,
  46642. Cartesian3_default.multiplyByScalar(
  46643. positionToOccluder,
  46644. horizonPlaneDistance,
  46645. horizonPlanePosScratch
  46646. ),
  46647. horizonPlanePosScratch
  46648. );
  46649. const horizonCrossDistance = Math.sqrt(
  46650. horizonDistanceSquared - horizonPlaneDistance * horizonPlaneDistance
  46651. );
  46652. let tempVec2 = this._rotationVector(
  46653. occluderPosition,
  46654. occluderPlaneNormal,
  46655. occluderPlaneD,
  46656. pos,
  46657. anyRotationVector
  46658. );
  46659. let horizonCrossDirection = Cartesian3_default.fromElements(
  46660. tempVec2.x * tempVec2.x * positionToOccluder.x + (tempVec2.x * tempVec2.y - tempVec2.z) * positionToOccluder.y + (tempVec2.x * tempVec2.z + tempVec2.y) * positionToOccluder.z,
  46661. (tempVec2.x * tempVec2.y + tempVec2.z) * positionToOccluder.x + tempVec2.y * tempVec2.y * positionToOccluder.y + (tempVec2.y * tempVec2.z - tempVec2.x) * positionToOccluder.z,
  46662. (tempVec2.x * tempVec2.z - tempVec2.y) * positionToOccluder.x + (tempVec2.y * tempVec2.z + tempVec2.x) * positionToOccluder.y + tempVec2.z * tempVec2.z * positionToOccluder.z,
  46663. posScratch1
  46664. );
  46665. horizonCrossDirection = Cartesian3_default.normalize(
  46666. horizonCrossDirection,
  46667. horizonCrossDirection
  46668. );
  46669. const offset2 = Cartesian3_default.multiplyByScalar(
  46670. horizonCrossDirection,
  46671. horizonCrossDistance,
  46672. posScratch1
  46673. );
  46674. tempVec2 = Cartesian3_default.normalize(
  46675. Cartesian3_default.subtract(
  46676. Cartesian3_default.add(horizonPlanePosition, offset2, posScratch2),
  46677. occluderPosition,
  46678. posScratch2
  46679. ),
  46680. posScratch2
  46681. );
  46682. const dot0 = Cartesian3_default.dot(occluderPlaneNormal, tempVec2);
  46683. tempVec2 = Cartesian3_default.normalize(
  46684. Cartesian3_default.subtract(
  46685. Cartesian3_default.subtract(horizonPlanePosition, offset2, tempVec2),
  46686. occluderPosition,
  46687. tempVec2
  46688. ),
  46689. tempVec2
  46690. );
  46691. const dot1 = Cartesian3_default.dot(occluderPlaneNormal, tempVec2);
  46692. return dot0 < dot1 ? dot0 : dot1;
  46693. };
  46694. var Occluder_default = Occluder;
  46695. // node_modules/cesium/Source/Core/OffsetGeometryInstanceAttribute.js
  46696. function OffsetGeometryInstanceAttribute(x, y, z) {
  46697. x = defaultValue_default(x, 0);
  46698. y = defaultValue_default(y, 0);
  46699. z = defaultValue_default(z, 0);
  46700. this.value = new Float32Array([x, y, z]);
  46701. }
  46702. Object.defineProperties(OffsetGeometryInstanceAttribute.prototype, {
  46703. componentDatatype: {
  46704. get: function() {
  46705. return ComponentDatatype_default.FLOAT;
  46706. }
  46707. },
  46708. componentsPerAttribute: {
  46709. get: function() {
  46710. return 3;
  46711. }
  46712. },
  46713. normalize: {
  46714. get: function() {
  46715. return false;
  46716. }
  46717. }
  46718. });
  46719. OffsetGeometryInstanceAttribute.fromCartesian3 = function(offset2) {
  46720. Check_default.defined("offset", offset2);
  46721. return new OffsetGeometryInstanceAttribute(offset2.x, offset2.y, offset2.z);
  46722. };
  46723. OffsetGeometryInstanceAttribute.toValue = function(offset2, result) {
  46724. Check_default.defined("offset", offset2);
  46725. if (!defined_default(result)) {
  46726. result = new Float32Array([offset2.x, offset2.y, offset2.z]);
  46727. }
  46728. result[0] = offset2.x;
  46729. result[1] = offset2.y;
  46730. result[2] = offset2.z;
  46731. return result;
  46732. };
  46733. var OffsetGeometryInstanceAttribute_default = OffsetGeometryInstanceAttribute;
  46734. // node_modules/cesium/Source/Core/OpenCageGeocoderService.js
  46735. function OpenCageGeocoderService(url2, apiKey, params) {
  46736. Check_default.defined("url", url2);
  46737. Check_default.defined("apiKey", apiKey);
  46738. if (defined_default(params)) {
  46739. Check_default.typeOf.object("params", params);
  46740. }
  46741. url2 = Resource_default.createIfNeeded(url2);
  46742. url2.appendForwardSlash();
  46743. url2.setQueryParameters({ key: apiKey });
  46744. this._url = url2;
  46745. this._params = defaultValue_default(params, {});
  46746. }
  46747. Object.defineProperties(OpenCageGeocoderService.prototype, {
  46748. url: {
  46749. get: function() {
  46750. return this._url;
  46751. }
  46752. },
  46753. params: {
  46754. get: function() {
  46755. return this._params;
  46756. }
  46757. }
  46758. });
  46759. OpenCageGeocoderService.prototype.geocode = function(query) {
  46760. Check_default.typeOf.string("query", query);
  46761. const resource = this._url.getDerivedResource({
  46762. url: "json",
  46763. queryParameters: combine_default(this._params, { q: query })
  46764. });
  46765. return resource.fetchJson().then(function(response) {
  46766. return response.results.map(function(resultObject) {
  46767. let destination;
  46768. const bounds = resultObject.bounds;
  46769. if (defined_default(bounds)) {
  46770. destination = Rectangle_default.fromDegrees(
  46771. bounds.southwest.lng,
  46772. bounds.southwest.lat,
  46773. bounds.northeast.lng,
  46774. bounds.northeast.lat
  46775. );
  46776. } else {
  46777. const lon = resultObject.geometry.lat;
  46778. const lat = resultObject.geometry.lng;
  46779. destination = Cartesian3_default.fromDegrees(lon, lat);
  46780. }
  46781. return {
  46782. displayName: resultObject.formatted,
  46783. destination
  46784. };
  46785. });
  46786. });
  46787. };
  46788. var OpenCageGeocoderService_default = OpenCageGeocoderService;
  46789. // node_modules/cesium/Source/Core/Packable.js
  46790. var Packable = {
  46791. packedLength: void 0,
  46792. pack: DeveloperError_default.throwInstantiationError,
  46793. unpack: DeveloperError_default.throwInstantiationError
  46794. };
  46795. var Packable_default = Packable;
  46796. // node_modules/cesium/Source/Core/PackableForInterpolation.js
  46797. var PackableForInterpolation = {
  46798. packedInterpolationLength: void 0,
  46799. convertPackedArrayForInterpolation: DeveloperError_default.throwInstantiationError,
  46800. unpackInterpolationResult: DeveloperError_default.throwInstantiationError
  46801. };
  46802. var PackableForInterpolation_default = PackableForInterpolation;
  46803. // node_modules/cesium/Source/Core/writeTextToCanvas.js
  46804. function measureText(context2D, textString, font, stroke, fill) {
  46805. const metrics = context2D.measureText(textString);
  46806. const isSpace = !/\S/.test(textString);
  46807. if (!isSpace) {
  46808. const fontSize = document.defaultView.getComputedStyle(context2D.canvas).getPropertyValue("font-size").replace("px", "");
  46809. const canvas = document.createElement("canvas");
  46810. const padding = 100;
  46811. const width = metrics.width + padding | 0;
  46812. const height = 3 * fontSize;
  46813. const baseline = height / 2;
  46814. canvas.width = width;
  46815. canvas.height = height;
  46816. const ctx = canvas.getContext("2d");
  46817. ctx.font = font;
  46818. ctx.fillStyle = "white";
  46819. ctx.fillRect(0, 0, canvas.width + 1, canvas.height + 1);
  46820. if (stroke) {
  46821. ctx.strokeStyle = "black";
  46822. ctx.lineWidth = context2D.lineWidth;
  46823. ctx.strokeText(textString, padding / 2, baseline);
  46824. }
  46825. if (fill) {
  46826. ctx.fillStyle = "black";
  46827. ctx.fillText(textString, padding / 2, baseline);
  46828. }
  46829. const pixelData = ctx.getImageData(0, 0, width, height).data;
  46830. const length3 = pixelData.length;
  46831. const width4 = width * 4;
  46832. let i2, j;
  46833. let ascent, descent;
  46834. for (i2 = 0; i2 < length3; ++i2) {
  46835. if (pixelData[i2] !== 255) {
  46836. ascent = i2 / width4 | 0;
  46837. break;
  46838. }
  46839. }
  46840. for (i2 = length3 - 1; i2 >= 0; --i2) {
  46841. if (pixelData[i2] !== 255) {
  46842. descent = i2 / width4 | 0;
  46843. break;
  46844. }
  46845. }
  46846. let minx = -1;
  46847. for (i2 = 0; i2 < width && minx === -1; ++i2) {
  46848. for (j = 0; j < height; ++j) {
  46849. const pixelIndex = i2 * 4 + j * width4;
  46850. if (pixelData[pixelIndex] !== 255 || pixelData[pixelIndex + 1] !== 255 || pixelData[pixelIndex + 2] !== 255 || pixelData[pixelIndex + 3] !== 255) {
  46851. minx = i2;
  46852. break;
  46853. }
  46854. }
  46855. }
  46856. return {
  46857. width: metrics.width,
  46858. height: descent - ascent,
  46859. ascent: baseline - ascent,
  46860. descent: descent - baseline,
  46861. minx: minx - padding / 2
  46862. };
  46863. }
  46864. return {
  46865. width: metrics.width,
  46866. height: 0,
  46867. ascent: 0,
  46868. descent: 0,
  46869. minx: 0
  46870. };
  46871. }
  46872. var imageSmoothingEnabledName;
  46873. function writeTextToCanvas(text2, options) {
  46874. if (!defined_default(text2)) {
  46875. throw new DeveloperError_default("text is required.");
  46876. }
  46877. if (text2 === "") {
  46878. return void 0;
  46879. }
  46880. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  46881. const font = defaultValue_default(options.font, "10px sans-serif");
  46882. const stroke = defaultValue_default(options.stroke, false);
  46883. const fill = defaultValue_default(options.fill, true);
  46884. const strokeWidth = defaultValue_default(options.strokeWidth, 1);
  46885. const backgroundColor = defaultValue_default(
  46886. options.backgroundColor,
  46887. Color_default.TRANSPARENT
  46888. );
  46889. const padding = defaultValue_default(options.padding, 0);
  46890. const doublePadding = padding * 2;
  46891. const canvas = document.createElement("canvas");
  46892. canvas.width = 1;
  46893. canvas.height = 1;
  46894. canvas.style.font = font;
  46895. const context2D = canvas.getContext("2d");
  46896. if (!defined_default(imageSmoothingEnabledName)) {
  46897. if (defined_default(context2D.imageSmoothingEnabled)) {
  46898. imageSmoothingEnabledName = "imageSmoothingEnabled";
  46899. } else if (defined_default(context2D.mozImageSmoothingEnabled)) {
  46900. imageSmoothingEnabledName = "mozImageSmoothingEnabled";
  46901. } else if (defined_default(context2D.webkitImageSmoothingEnabled)) {
  46902. imageSmoothingEnabledName = "webkitImageSmoothingEnabled";
  46903. } else if (defined_default(context2D.msImageSmoothingEnabled)) {
  46904. imageSmoothingEnabledName = "msImageSmoothingEnabled";
  46905. }
  46906. }
  46907. context2D.font = font;
  46908. context2D.lineJoin = "round";
  46909. context2D.lineWidth = strokeWidth;
  46910. context2D[imageSmoothingEnabledName] = false;
  46911. canvas.style.visibility = "hidden";
  46912. document.body.appendChild(canvas);
  46913. const dimensions = measureText(context2D, text2, font, stroke, fill);
  46914. canvas.dimensions = dimensions;
  46915. document.body.removeChild(canvas);
  46916. canvas.style.visibility = "";
  46917. const x = -dimensions.minx;
  46918. const width = Math.ceil(dimensions.width) + x + doublePadding;
  46919. const height = dimensions.height + doublePadding;
  46920. const baseline = height - dimensions.ascent + padding;
  46921. const y = height - baseline + doublePadding;
  46922. canvas.width = width;
  46923. canvas.height = height;
  46924. context2D.font = font;
  46925. context2D.lineJoin = "round";
  46926. context2D.lineWidth = strokeWidth;
  46927. context2D[imageSmoothingEnabledName] = false;
  46928. if (backgroundColor !== Color_default.TRANSPARENT) {
  46929. context2D.fillStyle = backgroundColor.toCssColorString();
  46930. context2D.fillRect(0, 0, canvas.width, canvas.height);
  46931. }
  46932. if (stroke) {
  46933. const strokeColor = defaultValue_default(options.strokeColor, Color_default.BLACK);
  46934. context2D.strokeStyle = strokeColor.toCssColorString();
  46935. context2D.strokeText(text2, x + padding, y);
  46936. }
  46937. if (fill) {
  46938. const fillColor = defaultValue_default(options.fillColor, Color_default.WHITE);
  46939. context2D.fillStyle = fillColor.toCssColorString();
  46940. context2D.fillText(text2, x + padding, y);
  46941. }
  46942. return canvas;
  46943. }
  46944. var writeTextToCanvas_default = writeTextToCanvas;
  46945. // node_modules/cesium/Source/Core/PinBuilder.js
  46946. function PinBuilder() {
  46947. this._cache = {};
  46948. }
  46949. PinBuilder.prototype.fromColor = function(color, size) {
  46950. if (!defined_default(color)) {
  46951. throw new DeveloperError_default("color is required");
  46952. }
  46953. if (!defined_default(size)) {
  46954. throw new DeveloperError_default("size is required");
  46955. }
  46956. return createPin(void 0, void 0, color, size, this._cache);
  46957. };
  46958. PinBuilder.prototype.fromUrl = function(url2, color, size) {
  46959. if (!defined_default(url2)) {
  46960. throw new DeveloperError_default("url is required");
  46961. }
  46962. if (!defined_default(color)) {
  46963. throw new DeveloperError_default("color is required");
  46964. }
  46965. if (!defined_default(size)) {
  46966. throw new DeveloperError_default("size is required");
  46967. }
  46968. return createPin(url2, void 0, color, size, this._cache);
  46969. };
  46970. PinBuilder.prototype.fromMakiIconId = function(id, color, size) {
  46971. if (!defined_default(id)) {
  46972. throw new DeveloperError_default("id is required");
  46973. }
  46974. if (!defined_default(color)) {
  46975. throw new DeveloperError_default("color is required");
  46976. }
  46977. if (!defined_default(size)) {
  46978. throw new DeveloperError_default("size is required");
  46979. }
  46980. return createPin(
  46981. buildModuleUrl_default(`Assets/Textures/maki/${encodeURIComponent(id)}.png`),
  46982. void 0,
  46983. color,
  46984. size,
  46985. this._cache
  46986. );
  46987. };
  46988. PinBuilder.prototype.fromText = function(text2, color, size) {
  46989. if (!defined_default(text2)) {
  46990. throw new DeveloperError_default("text is required");
  46991. }
  46992. if (!defined_default(color)) {
  46993. throw new DeveloperError_default("color is required");
  46994. }
  46995. if (!defined_default(size)) {
  46996. throw new DeveloperError_default("size is required");
  46997. }
  46998. return createPin(void 0, text2, color, size, this._cache);
  46999. };
  47000. var colorScratch = new Color_default();
  47001. function drawPin(context2D, color, size) {
  47002. context2D.save();
  47003. context2D.scale(size / 24, size / 24);
  47004. context2D.fillStyle = color.toCssColorString();
  47005. context2D.strokeStyle = color.brighten(0.6, colorScratch).toCssColorString();
  47006. context2D.lineWidth = 0.846;
  47007. context2D.beginPath();
  47008. context2D.moveTo(6.72, 0.422);
  47009. context2D.lineTo(17.28, 0.422);
  47010. context2D.bezierCurveTo(18.553, 0.422, 19.577, 1.758, 19.577, 3.415);
  47011. context2D.lineTo(19.577, 10.973);
  47012. context2D.bezierCurveTo(19.577, 12.63, 18.553, 13.966, 17.282, 13.966);
  47013. context2D.lineTo(14.386, 14.008);
  47014. context2D.lineTo(11.826, 23.578);
  47015. context2D.lineTo(9.614, 14.008);
  47016. context2D.lineTo(6.719, 13.965);
  47017. context2D.bezierCurveTo(5.446, 13.983, 4.422, 12.629, 4.422, 10.972);
  47018. context2D.lineTo(4.422, 3.416);
  47019. context2D.bezierCurveTo(4.423, 1.76, 5.447, 0.423, 6.718, 0.423);
  47020. context2D.closePath();
  47021. context2D.fill();
  47022. context2D.stroke();
  47023. context2D.restore();
  47024. }
  47025. function drawIcon(context2D, image, size) {
  47026. const imageSize = size / 2.5;
  47027. let sizeX = imageSize;
  47028. let sizeY = imageSize;
  47029. if (image.width > image.height) {
  47030. sizeY = imageSize * (image.height / image.width);
  47031. } else if (image.width < image.height) {
  47032. sizeX = imageSize * (image.width / image.height);
  47033. }
  47034. const x = Math.round((size - sizeX) / 2);
  47035. const y = Math.round(7 / 24 * size - sizeY / 2);
  47036. context2D.globalCompositeOperation = "destination-out";
  47037. context2D.drawImage(image, x - 1, y, sizeX, sizeY);
  47038. context2D.drawImage(image, x, y - 1, sizeX, sizeY);
  47039. context2D.drawImage(image, x + 1, y, sizeX, sizeY);
  47040. context2D.drawImage(image, x, y + 1, sizeX, sizeY);
  47041. context2D.globalCompositeOperation = "destination-over";
  47042. context2D.fillStyle = Color_default.BLACK.toCssColorString();
  47043. context2D.fillRect(x - 1, y - 1, sizeX + 2, sizeY + 2);
  47044. context2D.globalCompositeOperation = "destination-out";
  47045. context2D.drawImage(image, x, y, sizeX, sizeY);
  47046. context2D.globalCompositeOperation = "destination-over";
  47047. context2D.fillStyle = Color_default.WHITE.toCssColorString();
  47048. context2D.fillRect(x - 1, y - 2, sizeX + 2, sizeY + 2);
  47049. }
  47050. var stringifyScratch = new Array(4);
  47051. function createPin(url2, label, color, size, cache) {
  47052. stringifyScratch[0] = url2;
  47053. stringifyScratch[1] = label;
  47054. stringifyScratch[2] = color;
  47055. stringifyScratch[3] = size;
  47056. const id = JSON.stringify(stringifyScratch);
  47057. const item = cache[id];
  47058. if (defined_default(item)) {
  47059. return item;
  47060. }
  47061. const canvas = document.createElement("canvas");
  47062. canvas.width = size;
  47063. canvas.height = size;
  47064. const context2D = canvas.getContext("2d");
  47065. drawPin(context2D, color, size);
  47066. if (defined_default(url2)) {
  47067. const resource = Resource_default.createIfNeeded(url2);
  47068. const promise = resource.fetchImage().then(function(image) {
  47069. drawIcon(context2D, image, size);
  47070. cache[id] = canvas;
  47071. return canvas;
  47072. });
  47073. cache[id] = promise;
  47074. return promise;
  47075. } else if (defined_default(label)) {
  47076. const image = writeTextToCanvas_default(label, {
  47077. font: `bold ${size}px sans-serif`
  47078. });
  47079. drawIcon(context2D, image, size);
  47080. }
  47081. cache[id] = canvas;
  47082. return canvas;
  47083. }
  47084. var PinBuilder_default = PinBuilder;
  47085. // node_modules/cesium/Source/Renderer/PixelDatatype.js
  47086. var PixelDatatype = {
  47087. UNSIGNED_BYTE: WebGLConstants_default.UNSIGNED_BYTE,
  47088. UNSIGNED_SHORT: WebGLConstants_default.UNSIGNED_SHORT,
  47089. UNSIGNED_INT: WebGLConstants_default.UNSIGNED_INT,
  47090. FLOAT: WebGLConstants_default.FLOAT,
  47091. HALF_FLOAT: WebGLConstants_default.HALF_FLOAT_OES,
  47092. UNSIGNED_INT_24_8: WebGLConstants_default.UNSIGNED_INT_24_8,
  47093. UNSIGNED_SHORT_4_4_4_4: WebGLConstants_default.UNSIGNED_SHORT_4_4_4_4,
  47094. UNSIGNED_SHORT_5_5_5_1: WebGLConstants_default.UNSIGNED_SHORT_5_5_5_1,
  47095. UNSIGNED_SHORT_5_6_5: WebGLConstants_default.UNSIGNED_SHORT_5_6_5
  47096. };
  47097. PixelDatatype.toWebGLConstant = function(pixelDatatype, context) {
  47098. switch (pixelDatatype) {
  47099. case PixelDatatype.UNSIGNED_BYTE:
  47100. return WebGLConstants_default.UNSIGNED_BYTE;
  47101. case PixelDatatype.UNSIGNED_SHORT:
  47102. return WebGLConstants_default.UNSIGNED_SHORT;
  47103. case PixelDatatype.UNSIGNED_INT:
  47104. return WebGLConstants_default.UNSIGNED_INT;
  47105. case PixelDatatype.FLOAT:
  47106. return WebGLConstants_default.FLOAT;
  47107. case PixelDatatype.HALF_FLOAT:
  47108. return context.webgl2 ? WebGLConstants_default.HALF_FLOAT : WebGLConstants_default.HALF_FLOAT_OES;
  47109. case PixelDatatype.UNSIGNED_INT_24_8:
  47110. return WebGLConstants_default.UNSIGNED_INT_24_8;
  47111. case PixelDatatype.UNSIGNED_SHORT_4_4_4_4:
  47112. return WebGLConstants_default.UNSIGNED_SHORT_4_4_4_4;
  47113. case PixelDatatype.UNSIGNED_SHORT_5_5_5_1:
  47114. return WebGLConstants_default.UNSIGNED_SHORT_5_5_5_1;
  47115. case PixelDatatype.UNSIGNED_SHORT_5_6_5:
  47116. return PixelDatatype.UNSIGNED_SHORT_5_6_5;
  47117. }
  47118. };
  47119. PixelDatatype.isPacked = function(pixelDatatype) {
  47120. return pixelDatatype === PixelDatatype.UNSIGNED_INT_24_8 || pixelDatatype === PixelDatatype.UNSIGNED_SHORT_4_4_4_4 || pixelDatatype === PixelDatatype.UNSIGNED_SHORT_5_5_5_1 || pixelDatatype === PixelDatatype.UNSIGNED_SHORT_5_6_5;
  47121. };
  47122. PixelDatatype.sizeInBytes = function(pixelDatatype) {
  47123. switch (pixelDatatype) {
  47124. case PixelDatatype.UNSIGNED_BYTE:
  47125. return 1;
  47126. case PixelDatatype.UNSIGNED_SHORT:
  47127. case PixelDatatype.UNSIGNED_SHORT_4_4_4_4:
  47128. case PixelDatatype.UNSIGNED_SHORT_5_5_5_1:
  47129. case PixelDatatype.UNSIGNED_SHORT_5_6_5:
  47130. case PixelDatatype.HALF_FLOAT:
  47131. return 2;
  47132. case PixelDatatype.UNSIGNED_INT:
  47133. case PixelDatatype.FLOAT:
  47134. case PixelDatatype.UNSIGNED_INT_24_8:
  47135. return 4;
  47136. }
  47137. };
  47138. PixelDatatype.validate = function(pixelDatatype) {
  47139. return pixelDatatype === PixelDatatype.UNSIGNED_BYTE || pixelDatatype === PixelDatatype.UNSIGNED_SHORT || pixelDatatype === PixelDatatype.UNSIGNED_INT || pixelDatatype === PixelDatatype.FLOAT || pixelDatatype === PixelDatatype.HALF_FLOAT || pixelDatatype === PixelDatatype.UNSIGNED_INT_24_8 || pixelDatatype === PixelDatatype.UNSIGNED_SHORT_4_4_4_4 || pixelDatatype === PixelDatatype.UNSIGNED_SHORT_5_5_5_1 || pixelDatatype === PixelDatatype.UNSIGNED_SHORT_5_6_5;
  47140. };
  47141. var PixelDatatype_default = Object.freeze(PixelDatatype);
  47142. // node_modules/cesium/Source/Core/PixelFormat.js
  47143. var PixelFormat = {
  47144. DEPTH_COMPONENT: WebGLConstants_default.DEPTH_COMPONENT,
  47145. DEPTH_STENCIL: WebGLConstants_default.DEPTH_STENCIL,
  47146. ALPHA: WebGLConstants_default.ALPHA,
  47147. RGB: WebGLConstants_default.RGB,
  47148. RGBA: WebGLConstants_default.RGBA,
  47149. LUMINANCE: WebGLConstants_default.LUMINANCE,
  47150. LUMINANCE_ALPHA: WebGLConstants_default.LUMINANCE_ALPHA,
  47151. RGB_DXT1: WebGLConstants_default.COMPRESSED_RGB_S3TC_DXT1_EXT,
  47152. RGBA_DXT1: WebGLConstants_default.COMPRESSED_RGBA_S3TC_DXT1_EXT,
  47153. RGBA_DXT3: WebGLConstants_default.COMPRESSED_RGBA_S3TC_DXT3_EXT,
  47154. RGBA_DXT5: WebGLConstants_default.COMPRESSED_RGBA_S3TC_DXT5_EXT,
  47155. RGB_PVRTC_4BPPV1: WebGLConstants_default.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
  47156. RGB_PVRTC_2BPPV1: WebGLConstants_default.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,
  47157. RGBA_PVRTC_4BPPV1: WebGLConstants_default.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
  47158. RGBA_PVRTC_2BPPV1: WebGLConstants_default.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
  47159. RGBA_ASTC: WebGLConstants_default.COMPRESSED_RGBA_ASTC_4x4_WEBGL,
  47160. RGB_ETC1: WebGLConstants_default.COMPRESSED_RGB_ETC1_WEBGL,
  47161. RGB8_ETC2: WebGLConstants_default.COMPRESSED_RGB8_ETC2,
  47162. RGBA8_ETC2_EAC: WebGLConstants_default.COMPRESSED_RGBA8_ETC2_EAC,
  47163. RGBA_BC7: WebGLConstants_default.COMPRESSED_RGBA_BPTC_UNORM
  47164. };
  47165. PixelFormat.componentsLength = function(pixelFormat) {
  47166. switch (pixelFormat) {
  47167. case PixelFormat.RGB:
  47168. return 3;
  47169. case PixelFormat.RGBA:
  47170. return 4;
  47171. case PixelFormat.LUMINANCE_ALPHA:
  47172. return 2;
  47173. case PixelFormat.ALPHA:
  47174. case PixelFormat.LUMINANCE:
  47175. return 1;
  47176. default:
  47177. return 1;
  47178. }
  47179. };
  47180. PixelFormat.validate = function(pixelFormat) {
  47181. return pixelFormat === PixelFormat.DEPTH_COMPONENT || pixelFormat === PixelFormat.DEPTH_STENCIL || pixelFormat === PixelFormat.ALPHA || pixelFormat === PixelFormat.RGB || pixelFormat === PixelFormat.RGBA || pixelFormat === PixelFormat.LUMINANCE || pixelFormat === PixelFormat.LUMINANCE_ALPHA || pixelFormat === PixelFormat.RGB_DXT1 || pixelFormat === PixelFormat.RGBA_DXT1 || pixelFormat === PixelFormat.RGBA_DXT3 || pixelFormat === PixelFormat.RGBA_DXT5 || pixelFormat === PixelFormat.RGB_PVRTC_4BPPV1 || pixelFormat === PixelFormat.RGB_PVRTC_2BPPV1 || pixelFormat === PixelFormat.RGBA_PVRTC_4BPPV1 || pixelFormat === PixelFormat.RGBA_PVRTC_2BPPV1 || pixelFormat === PixelFormat.RGBA_ASTC || pixelFormat === PixelFormat.RGB_ETC1 || pixelFormat === PixelFormat.RGB8_ETC2 || pixelFormat === PixelFormat.RGBA8_ETC2_EAC || pixelFormat === PixelFormat.RGBA_BC7;
  47182. };
  47183. PixelFormat.isColorFormat = function(pixelFormat) {
  47184. return pixelFormat === PixelFormat.ALPHA || pixelFormat === PixelFormat.RGB || pixelFormat === PixelFormat.RGBA || pixelFormat === PixelFormat.LUMINANCE || pixelFormat === PixelFormat.LUMINANCE_ALPHA;
  47185. };
  47186. PixelFormat.isDepthFormat = function(pixelFormat) {
  47187. return pixelFormat === PixelFormat.DEPTH_COMPONENT || pixelFormat === PixelFormat.DEPTH_STENCIL;
  47188. };
  47189. PixelFormat.isCompressedFormat = function(pixelFormat) {
  47190. return pixelFormat === PixelFormat.RGB_DXT1 || pixelFormat === PixelFormat.RGBA_DXT1 || pixelFormat === PixelFormat.RGBA_DXT3 || pixelFormat === PixelFormat.RGBA_DXT5 || pixelFormat === PixelFormat.RGB_PVRTC_4BPPV1 || pixelFormat === PixelFormat.RGB_PVRTC_2BPPV1 || pixelFormat === PixelFormat.RGBA_PVRTC_4BPPV1 || pixelFormat === PixelFormat.RGBA_PVRTC_2BPPV1 || pixelFormat === PixelFormat.RGBA_ASTC || pixelFormat === PixelFormat.RGB_ETC1 || pixelFormat === PixelFormat.RGB8_ETC2 || pixelFormat === PixelFormat.RGBA8_ETC2_EAC || pixelFormat === PixelFormat.RGBA_BC7;
  47191. };
  47192. PixelFormat.isDXTFormat = function(pixelFormat) {
  47193. return pixelFormat === PixelFormat.RGB_DXT1 || pixelFormat === PixelFormat.RGBA_DXT1 || pixelFormat === PixelFormat.RGBA_DXT3 || pixelFormat === PixelFormat.RGBA_DXT5;
  47194. };
  47195. PixelFormat.isPVRTCFormat = function(pixelFormat) {
  47196. return pixelFormat === PixelFormat.RGB_PVRTC_4BPPV1 || pixelFormat === PixelFormat.RGB_PVRTC_2BPPV1 || pixelFormat === PixelFormat.RGBA_PVRTC_4BPPV1 || pixelFormat === PixelFormat.RGBA_PVRTC_2BPPV1;
  47197. };
  47198. PixelFormat.isASTCFormat = function(pixelFormat) {
  47199. return pixelFormat === PixelFormat.RGBA_ASTC;
  47200. };
  47201. PixelFormat.isETC1Format = function(pixelFormat) {
  47202. return pixelFormat === PixelFormat.RGB_ETC1;
  47203. };
  47204. PixelFormat.isETC2Format = function(pixelFormat) {
  47205. return pixelFormat === PixelFormat.RGB8_ETC2 || pixelFormat === PixelFormat.RGBA8_ETC2_EAC;
  47206. };
  47207. PixelFormat.isBC7Format = function(pixelFormat) {
  47208. return pixelFormat === PixelFormat.RGBA_BC7;
  47209. };
  47210. PixelFormat.compressedTextureSizeInBytes = function(pixelFormat, width, height) {
  47211. switch (pixelFormat) {
  47212. case PixelFormat.RGB_DXT1:
  47213. case PixelFormat.RGBA_DXT1:
  47214. case PixelFormat.RGB_ETC1:
  47215. case PixelFormat.RGB8_ETC2:
  47216. return Math.floor((width + 3) / 4) * Math.floor((height + 3) / 4) * 8;
  47217. case PixelFormat.RGBA_DXT3:
  47218. case PixelFormat.RGBA_DXT5:
  47219. case PixelFormat.RGBA_ASTC:
  47220. case PixelFormat.RGBA8_ETC2_EAC:
  47221. return Math.floor((width + 3) / 4) * Math.floor((height + 3) / 4) * 16;
  47222. case PixelFormat.RGB_PVRTC_4BPPV1:
  47223. case PixelFormat.RGBA_PVRTC_4BPPV1:
  47224. return Math.floor((Math.max(width, 8) * Math.max(height, 8) * 4 + 7) / 8);
  47225. case PixelFormat.RGB_PVRTC_2BPPV1:
  47226. case PixelFormat.RGBA_PVRTC_2BPPV1:
  47227. return Math.floor(
  47228. (Math.max(width, 16) * Math.max(height, 8) * 2 + 7) / 8
  47229. );
  47230. case PixelFormat.RGBA_BC7:
  47231. return Math.ceil(width / 4) * Math.ceil(height / 4) * 16;
  47232. default:
  47233. return 0;
  47234. }
  47235. };
  47236. PixelFormat.textureSizeInBytes = function(pixelFormat, pixelDatatype, width, height) {
  47237. let componentsLength = PixelFormat.componentsLength(pixelFormat);
  47238. if (PixelDatatype_default.isPacked(pixelDatatype)) {
  47239. componentsLength = 1;
  47240. }
  47241. return componentsLength * PixelDatatype_default.sizeInBytes(pixelDatatype) * width * height;
  47242. };
  47243. PixelFormat.alignmentInBytes = function(pixelFormat, pixelDatatype, width) {
  47244. const mod2 = PixelFormat.textureSizeInBytes(pixelFormat, pixelDatatype, width, 1) % 4;
  47245. return mod2 === 0 ? 4 : mod2 === 2 ? 2 : 1;
  47246. };
  47247. PixelFormat.createTypedArray = function(pixelFormat, pixelDatatype, width, height) {
  47248. let constructor;
  47249. const sizeInBytes = PixelDatatype_default.sizeInBytes(pixelDatatype);
  47250. if (sizeInBytes === Uint8Array.BYTES_PER_ELEMENT) {
  47251. constructor = Uint8Array;
  47252. } else if (sizeInBytes === Uint16Array.BYTES_PER_ELEMENT) {
  47253. constructor = Uint16Array;
  47254. } else if (sizeInBytes === Float32Array.BYTES_PER_ELEMENT && pixelDatatype === PixelDatatype_default.FLOAT) {
  47255. constructor = Float32Array;
  47256. } else {
  47257. constructor = Uint32Array;
  47258. }
  47259. const size = PixelFormat.componentsLength(pixelFormat) * width * height;
  47260. return new constructor(size);
  47261. };
  47262. PixelFormat.flipY = function(bufferView, pixelFormat, pixelDatatype, width, height) {
  47263. if (height === 1) {
  47264. return bufferView;
  47265. }
  47266. const flipped = PixelFormat.createTypedArray(
  47267. pixelFormat,
  47268. pixelDatatype,
  47269. width,
  47270. height
  47271. );
  47272. const numberOfComponents = PixelFormat.componentsLength(pixelFormat);
  47273. const textureWidth = width * numberOfComponents;
  47274. for (let i2 = 0; i2 < height; ++i2) {
  47275. const row = i2 * width * numberOfComponents;
  47276. const flippedRow = (height - i2 - 1) * width * numberOfComponents;
  47277. for (let j = 0; j < textureWidth; ++j) {
  47278. flipped[flippedRow + j] = bufferView[row + j];
  47279. }
  47280. }
  47281. return flipped;
  47282. };
  47283. PixelFormat.toInternalFormat = function(pixelFormat, pixelDatatype, context) {
  47284. if (!context.webgl2) {
  47285. return pixelFormat;
  47286. }
  47287. if (pixelFormat === PixelFormat.DEPTH_STENCIL) {
  47288. return WebGLConstants_default.DEPTH24_STENCIL8;
  47289. }
  47290. if (pixelFormat === PixelFormat.DEPTH_COMPONENT) {
  47291. if (pixelDatatype === PixelDatatype_default.UNSIGNED_SHORT) {
  47292. return WebGLConstants_default.DEPTH_COMPONENT16;
  47293. } else if (pixelDatatype === PixelDatatype_default.UNSIGNED_INT) {
  47294. return WebGLConstants_default.DEPTH_COMPONENT24;
  47295. }
  47296. }
  47297. if (pixelDatatype === PixelDatatype_default.FLOAT) {
  47298. switch (pixelFormat) {
  47299. case PixelFormat.RGBA:
  47300. return WebGLConstants_default.RGBA32F;
  47301. case PixelFormat.RGB:
  47302. return WebGLConstants_default.RGB32F;
  47303. case PixelFormat.RG:
  47304. return WebGLConstants_default.RG32F;
  47305. case PixelFormat.R:
  47306. return WebGLConstants_default.R32F;
  47307. }
  47308. }
  47309. if (pixelDatatype === PixelDatatype_default.HALF_FLOAT) {
  47310. switch (pixelFormat) {
  47311. case PixelFormat.RGBA:
  47312. return WebGLConstants_default.RGBA16F;
  47313. case PixelFormat.RGB:
  47314. return WebGLConstants_default.RGB16F;
  47315. case PixelFormat.RG:
  47316. return WebGLConstants_default.RG16F;
  47317. case PixelFormat.R:
  47318. return WebGLConstants_default.R16F;
  47319. }
  47320. }
  47321. return pixelFormat;
  47322. };
  47323. var PixelFormat_default = Object.freeze(PixelFormat);
  47324. // node_modules/cesium/Source/Core/PlaneGeometry.js
  47325. function PlaneGeometry(options) {
  47326. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  47327. const vertexFormat = defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT);
  47328. this._vertexFormat = vertexFormat;
  47329. this._workerName = "createPlaneGeometry";
  47330. }
  47331. PlaneGeometry.packedLength = VertexFormat_default.packedLength;
  47332. PlaneGeometry.pack = function(value, array, startingIndex) {
  47333. Check_default.typeOf.object("value", value);
  47334. Check_default.defined("array", array);
  47335. startingIndex = defaultValue_default(startingIndex, 0);
  47336. VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
  47337. return array;
  47338. };
  47339. var scratchVertexFormat8 = new VertexFormat_default();
  47340. var scratchOptions15 = {
  47341. vertexFormat: scratchVertexFormat8
  47342. };
  47343. PlaneGeometry.unpack = function(array, startingIndex, result) {
  47344. Check_default.defined("array", array);
  47345. startingIndex = defaultValue_default(startingIndex, 0);
  47346. const vertexFormat = VertexFormat_default.unpack(
  47347. array,
  47348. startingIndex,
  47349. scratchVertexFormat8
  47350. );
  47351. if (!defined_default(result)) {
  47352. return new PlaneGeometry(scratchOptions15);
  47353. }
  47354. result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
  47355. return result;
  47356. };
  47357. var min = new Cartesian3_default(-0.5, -0.5, 0);
  47358. var max = new Cartesian3_default(0.5, 0.5, 0);
  47359. PlaneGeometry.createGeometry = function(planeGeometry) {
  47360. const vertexFormat = planeGeometry._vertexFormat;
  47361. const attributes = new GeometryAttributes_default();
  47362. let indices2;
  47363. let positions;
  47364. if (vertexFormat.position) {
  47365. positions = new Float64Array(4 * 3);
  47366. positions[0] = min.x;
  47367. positions[1] = min.y;
  47368. positions[2] = 0;
  47369. positions[3] = max.x;
  47370. positions[4] = min.y;
  47371. positions[5] = 0;
  47372. positions[6] = max.x;
  47373. positions[7] = max.y;
  47374. positions[8] = 0;
  47375. positions[9] = min.x;
  47376. positions[10] = max.y;
  47377. positions[11] = 0;
  47378. attributes.position = new GeometryAttribute_default({
  47379. componentDatatype: ComponentDatatype_default.DOUBLE,
  47380. componentsPerAttribute: 3,
  47381. values: positions
  47382. });
  47383. if (vertexFormat.normal) {
  47384. const normals = new Float32Array(4 * 3);
  47385. normals[0] = 0;
  47386. normals[1] = 0;
  47387. normals[2] = 1;
  47388. normals[3] = 0;
  47389. normals[4] = 0;
  47390. normals[5] = 1;
  47391. normals[6] = 0;
  47392. normals[7] = 0;
  47393. normals[8] = 1;
  47394. normals[9] = 0;
  47395. normals[10] = 0;
  47396. normals[11] = 1;
  47397. attributes.normal = new GeometryAttribute_default({
  47398. componentDatatype: ComponentDatatype_default.FLOAT,
  47399. componentsPerAttribute: 3,
  47400. values: normals
  47401. });
  47402. }
  47403. if (vertexFormat.st) {
  47404. const texCoords = new Float32Array(4 * 2);
  47405. texCoords[0] = 0;
  47406. texCoords[1] = 0;
  47407. texCoords[2] = 1;
  47408. texCoords[3] = 0;
  47409. texCoords[4] = 1;
  47410. texCoords[5] = 1;
  47411. texCoords[6] = 0;
  47412. texCoords[7] = 1;
  47413. attributes.st = new GeometryAttribute_default({
  47414. componentDatatype: ComponentDatatype_default.FLOAT,
  47415. componentsPerAttribute: 2,
  47416. values: texCoords
  47417. });
  47418. }
  47419. if (vertexFormat.tangent) {
  47420. const tangents = new Float32Array(4 * 3);
  47421. tangents[0] = 1;
  47422. tangents[1] = 0;
  47423. tangents[2] = 0;
  47424. tangents[3] = 1;
  47425. tangents[4] = 0;
  47426. tangents[5] = 0;
  47427. tangents[6] = 1;
  47428. tangents[7] = 0;
  47429. tangents[8] = 0;
  47430. tangents[9] = 1;
  47431. tangents[10] = 0;
  47432. tangents[11] = 0;
  47433. attributes.tangent = new GeometryAttribute_default({
  47434. componentDatatype: ComponentDatatype_default.FLOAT,
  47435. componentsPerAttribute: 3,
  47436. values: tangents
  47437. });
  47438. }
  47439. if (vertexFormat.bitangent) {
  47440. const bitangents = new Float32Array(4 * 3);
  47441. bitangents[0] = 0;
  47442. bitangents[1] = 1;
  47443. bitangents[2] = 0;
  47444. bitangents[3] = 0;
  47445. bitangents[4] = 1;
  47446. bitangents[5] = 0;
  47447. bitangents[6] = 0;
  47448. bitangents[7] = 1;
  47449. bitangents[8] = 0;
  47450. bitangents[9] = 0;
  47451. bitangents[10] = 1;
  47452. bitangents[11] = 0;
  47453. attributes.bitangent = new GeometryAttribute_default({
  47454. componentDatatype: ComponentDatatype_default.FLOAT,
  47455. componentsPerAttribute: 3,
  47456. values: bitangents
  47457. });
  47458. }
  47459. indices2 = new Uint16Array(2 * 3);
  47460. indices2[0] = 0;
  47461. indices2[1] = 1;
  47462. indices2[2] = 2;
  47463. indices2[3] = 0;
  47464. indices2[4] = 2;
  47465. indices2[5] = 3;
  47466. }
  47467. return new Geometry_default({
  47468. attributes,
  47469. indices: indices2,
  47470. primitiveType: PrimitiveType_default.TRIANGLES,
  47471. boundingSphere: new BoundingSphere_default(Cartesian3_default.ZERO, Math.sqrt(2))
  47472. });
  47473. };
  47474. var PlaneGeometry_default = PlaneGeometry;
  47475. // node_modules/cesium/Source/Core/PlaneOutlineGeometry.js
  47476. function PlaneOutlineGeometry() {
  47477. this._workerName = "createPlaneOutlineGeometry";
  47478. }
  47479. PlaneOutlineGeometry.packedLength = 0;
  47480. PlaneOutlineGeometry.pack = function(value, array) {
  47481. Check_default.defined("value", value);
  47482. Check_default.defined("array", array);
  47483. return array;
  47484. };
  47485. PlaneOutlineGeometry.unpack = function(array, startingIndex, result) {
  47486. Check_default.defined("array", array);
  47487. if (!defined_default(result)) {
  47488. return new PlaneOutlineGeometry();
  47489. }
  47490. return result;
  47491. };
  47492. var min2 = new Cartesian3_default(-0.5, -0.5, 0);
  47493. var max2 = new Cartesian3_default(0.5, 0.5, 0);
  47494. PlaneOutlineGeometry.createGeometry = function() {
  47495. const attributes = new GeometryAttributes_default();
  47496. const indices2 = new Uint16Array(4 * 2);
  47497. const positions = new Float64Array(4 * 3);
  47498. positions[0] = min2.x;
  47499. positions[1] = min2.y;
  47500. positions[2] = min2.z;
  47501. positions[3] = max2.x;
  47502. positions[4] = min2.y;
  47503. positions[5] = min2.z;
  47504. positions[6] = max2.x;
  47505. positions[7] = max2.y;
  47506. positions[8] = min2.z;
  47507. positions[9] = min2.x;
  47508. positions[10] = max2.y;
  47509. positions[11] = min2.z;
  47510. attributes.position = new GeometryAttribute_default({
  47511. componentDatatype: ComponentDatatype_default.DOUBLE,
  47512. componentsPerAttribute: 3,
  47513. values: positions
  47514. });
  47515. indices2[0] = 0;
  47516. indices2[1] = 1;
  47517. indices2[2] = 1;
  47518. indices2[3] = 2;
  47519. indices2[4] = 2;
  47520. indices2[5] = 3;
  47521. indices2[6] = 3;
  47522. indices2[7] = 0;
  47523. return new Geometry_default({
  47524. attributes,
  47525. indices: indices2,
  47526. primitiveType: PrimitiveType_default.LINES,
  47527. boundingSphere: new BoundingSphere_default(Cartesian3_default.ZERO, Math.sqrt(2))
  47528. });
  47529. };
  47530. var PlaneOutlineGeometry_default = PlaneOutlineGeometry;
  47531. // node_modules/cesium/Source/Core/PolygonGeometry.js
  47532. var scratchCarto1 = new Cartographic_default();
  47533. var scratchCarto2 = new Cartographic_default();
  47534. function adjustPosHeightsForNormal(position, p1, p2, ellipsoid) {
  47535. const carto12 = ellipsoid.cartesianToCartographic(position, scratchCarto1);
  47536. const height = carto12.height;
  47537. const p1Carto = ellipsoid.cartesianToCartographic(p1, scratchCarto2);
  47538. p1Carto.height = height;
  47539. ellipsoid.cartographicToCartesian(p1Carto, p1);
  47540. const p2Carto = ellipsoid.cartesianToCartographic(p2, scratchCarto2);
  47541. p2Carto.height = height - 100;
  47542. ellipsoid.cartographicToCartesian(p2Carto, p2);
  47543. }
  47544. var scratchBoundingRectangle = new BoundingRectangle_default();
  47545. var scratchPosition4 = new Cartesian3_default();
  47546. var scratchNormal6 = new Cartesian3_default();
  47547. var scratchTangent4 = new Cartesian3_default();
  47548. var scratchBitangent4 = new Cartesian3_default();
  47549. var p1Scratch3 = new Cartesian3_default();
  47550. var p2Scratch3 = new Cartesian3_default();
  47551. var scratchPerPosNormal = new Cartesian3_default();
  47552. var scratchPerPosTangent = new Cartesian3_default();
  47553. var scratchPerPosBitangent = new Cartesian3_default();
  47554. var appendTextureCoordinatesOrigin = new Cartesian2_default();
  47555. var appendTextureCoordinatesCartesian2 = new Cartesian2_default();
  47556. var appendTextureCoordinatesCartesian3 = new Cartesian3_default();
  47557. var appendTextureCoordinatesQuaternion = new Quaternion_default();
  47558. var appendTextureCoordinatesMatrix3 = new Matrix3_default();
  47559. var tangentMatrixScratch2 = new Matrix3_default();
  47560. function computeAttributes(options) {
  47561. const vertexFormat = options.vertexFormat;
  47562. const geometry = options.geometry;
  47563. const shadowVolume = options.shadowVolume;
  47564. const flatPositions2 = geometry.attributes.position.values;
  47565. let length3 = flatPositions2.length;
  47566. const wall = options.wall;
  47567. const top = options.top || wall;
  47568. const bottom = options.bottom || wall;
  47569. if (vertexFormat.st || vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent || shadowVolume) {
  47570. const boundingRectangle = options.boundingRectangle;
  47571. const tangentPlane = options.tangentPlane;
  47572. const ellipsoid = options.ellipsoid;
  47573. const stRotation = options.stRotation;
  47574. const perPositionHeight = options.perPositionHeight;
  47575. const origin = appendTextureCoordinatesOrigin;
  47576. origin.x = boundingRectangle.x;
  47577. origin.y = boundingRectangle.y;
  47578. const textureCoordinates = vertexFormat.st ? new Float32Array(2 * (length3 / 3)) : void 0;
  47579. let normals;
  47580. if (vertexFormat.normal) {
  47581. if (perPositionHeight && top && !wall) {
  47582. normals = geometry.attributes.normal.values;
  47583. } else {
  47584. normals = new Float32Array(length3);
  47585. }
  47586. }
  47587. const tangents = vertexFormat.tangent ? new Float32Array(length3) : void 0;
  47588. const bitangents = vertexFormat.bitangent ? new Float32Array(length3) : void 0;
  47589. const extrudeNormals = shadowVolume ? new Float32Array(length3) : void 0;
  47590. let textureCoordIndex = 0;
  47591. let attrIndex = 0;
  47592. let normal2 = scratchNormal6;
  47593. let tangent = scratchTangent4;
  47594. let bitangent = scratchBitangent4;
  47595. let recomputeNormal = true;
  47596. let textureMatrix = appendTextureCoordinatesMatrix3;
  47597. let tangentRotationMatrix = tangentMatrixScratch2;
  47598. if (stRotation !== 0) {
  47599. let rotation = Quaternion_default.fromAxisAngle(
  47600. tangentPlane._plane.normal,
  47601. stRotation,
  47602. appendTextureCoordinatesQuaternion
  47603. );
  47604. textureMatrix = Matrix3_default.fromQuaternion(rotation, textureMatrix);
  47605. rotation = Quaternion_default.fromAxisAngle(
  47606. tangentPlane._plane.normal,
  47607. -stRotation,
  47608. appendTextureCoordinatesQuaternion
  47609. );
  47610. tangentRotationMatrix = Matrix3_default.fromQuaternion(
  47611. rotation,
  47612. tangentRotationMatrix
  47613. );
  47614. } else {
  47615. textureMatrix = Matrix3_default.clone(Matrix3_default.IDENTITY, textureMatrix);
  47616. tangentRotationMatrix = Matrix3_default.clone(
  47617. Matrix3_default.IDENTITY,
  47618. tangentRotationMatrix
  47619. );
  47620. }
  47621. let bottomOffset = 0;
  47622. let bottomOffset2 = 0;
  47623. if (top && bottom) {
  47624. bottomOffset = length3 / 2;
  47625. bottomOffset2 = length3 / 3;
  47626. length3 /= 2;
  47627. }
  47628. for (let i2 = 0; i2 < length3; i2 += 3) {
  47629. const position = Cartesian3_default.fromArray(
  47630. flatPositions2,
  47631. i2,
  47632. appendTextureCoordinatesCartesian3
  47633. );
  47634. if (vertexFormat.st) {
  47635. let p2 = Matrix3_default.multiplyByVector(
  47636. textureMatrix,
  47637. position,
  47638. scratchPosition4
  47639. );
  47640. p2 = ellipsoid.scaleToGeodeticSurface(p2, p2);
  47641. const st = tangentPlane.projectPointOntoPlane(
  47642. p2,
  47643. appendTextureCoordinatesCartesian2
  47644. );
  47645. Cartesian2_default.subtract(st, origin, st);
  47646. const stx = Math_default.clamp(st.x / boundingRectangle.width, 0, 1);
  47647. const sty = Math_default.clamp(st.y / boundingRectangle.height, 0, 1);
  47648. if (bottom) {
  47649. textureCoordinates[textureCoordIndex + bottomOffset2] = stx;
  47650. textureCoordinates[textureCoordIndex + 1 + bottomOffset2] = sty;
  47651. }
  47652. if (top) {
  47653. textureCoordinates[textureCoordIndex] = stx;
  47654. textureCoordinates[textureCoordIndex + 1] = sty;
  47655. }
  47656. textureCoordIndex += 2;
  47657. }
  47658. if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent || shadowVolume) {
  47659. const attrIndex1 = attrIndex + 1;
  47660. const attrIndex2 = attrIndex + 2;
  47661. if (wall) {
  47662. if (i2 + 3 < length3) {
  47663. const p1 = Cartesian3_default.fromArray(flatPositions2, i2 + 3, p1Scratch3);
  47664. if (recomputeNormal) {
  47665. const p2 = Cartesian3_default.fromArray(
  47666. flatPositions2,
  47667. i2 + length3,
  47668. p2Scratch3
  47669. );
  47670. if (perPositionHeight) {
  47671. adjustPosHeightsForNormal(position, p1, p2, ellipsoid);
  47672. }
  47673. Cartesian3_default.subtract(p1, position, p1);
  47674. Cartesian3_default.subtract(p2, position, p2);
  47675. normal2 = Cartesian3_default.normalize(
  47676. Cartesian3_default.cross(p2, p1, normal2),
  47677. normal2
  47678. );
  47679. recomputeNormal = false;
  47680. }
  47681. if (Cartesian3_default.equalsEpsilon(p1, position, Math_default.EPSILON10)) {
  47682. recomputeNormal = true;
  47683. }
  47684. }
  47685. if (vertexFormat.tangent || vertexFormat.bitangent) {
  47686. bitangent = ellipsoid.geodeticSurfaceNormal(position, bitangent);
  47687. if (vertexFormat.tangent) {
  47688. tangent = Cartesian3_default.normalize(
  47689. Cartesian3_default.cross(bitangent, normal2, tangent),
  47690. tangent
  47691. );
  47692. }
  47693. }
  47694. } else {
  47695. normal2 = ellipsoid.geodeticSurfaceNormal(position, normal2);
  47696. if (vertexFormat.tangent || vertexFormat.bitangent) {
  47697. if (perPositionHeight) {
  47698. scratchPerPosNormal = Cartesian3_default.fromArray(
  47699. normals,
  47700. attrIndex,
  47701. scratchPerPosNormal
  47702. );
  47703. scratchPerPosTangent = Cartesian3_default.cross(
  47704. Cartesian3_default.UNIT_Z,
  47705. scratchPerPosNormal,
  47706. scratchPerPosTangent
  47707. );
  47708. scratchPerPosTangent = Cartesian3_default.normalize(
  47709. Matrix3_default.multiplyByVector(
  47710. tangentRotationMatrix,
  47711. scratchPerPosTangent,
  47712. scratchPerPosTangent
  47713. ),
  47714. scratchPerPosTangent
  47715. );
  47716. if (vertexFormat.bitangent) {
  47717. scratchPerPosBitangent = Cartesian3_default.normalize(
  47718. Cartesian3_default.cross(
  47719. scratchPerPosNormal,
  47720. scratchPerPosTangent,
  47721. scratchPerPosBitangent
  47722. ),
  47723. scratchPerPosBitangent
  47724. );
  47725. }
  47726. }
  47727. tangent = Cartesian3_default.cross(Cartesian3_default.UNIT_Z, normal2, tangent);
  47728. tangent = Cartesian3_default.normalize(
  47729. Matrix3_default.multiplyByVector(tangentRotationMatrix, tangent, tangent),
  47730. tangent
  47731. );
  47732. if (vertexFormat.bitangent) {
  47733. bitangent = Cartesian3_default.normalize(
  47734. Cartesian3_default.cross(normal2, tangent, bitangent),
  47735. bitangent
  47736. );
  47737. }
  47738. }
  47739. }
  47740. if (vertexFormat.normal) {
  47741. if (options.wall) {
  47742. normals[attrIndex + bottomOffset] = normal2.x;
  47743. normals[attrIndex1 + bottomOffset] = normal2.y;
  47744. normals[attrIndex2 + bottomOffset] = normal2.z;
  47745. } else if (bottom) {
  47746. normals[attrIndex + bottomOffset] = -normal2.x;
  47747. normals[attrIndex1 + bottomOffset] = -normal2.y;
  47748. normals[attrIndex2 + bottomOffset] = -normal2.z;
  47749. }
  47750. if (top && !perPositionHeight || wall) {
  47751. normals[attrIndex] = normal2.x;
  47752. normals[attrIndex1] = normal2.y;
  47753. normals[attrIndex2] = normal2.z;
  47754. }
  47755. }
  47756. if (shadowVolume) {
  47757. if (wall) {
  47758. normal2 = ellipsoid.geodeticSurfaceNormal(position, normal2);
  47759. }
  47760. extrudeNormals[attrIndex + bottomOffset] = -normal2.x;
  47761. extrudeNormals[attrIndex1 + bottomOffset] = -normal2.y;
  47762. extrudeNormals[attrIndex2 + bottomOffset] = -normal2.z;
  47763. }
  47764. if (vertexFormat.tangent) {
  47765. if (options.wall) {
  47766. tangents[attrIndex + bottomOffset] = tangent.x;
  47767. tangents[attrIndex1 + bottomOffset] = tangent.y;
  47768. tangents[attrIndex2 + bottomOffset] = tangent.z;
  47769. } else if (bottom) {
  47770. tangents[attrIndex + bottomOffset] = -tangent.x;
  47771. tangents[attrIndex1 + bottomOffset] = -tangent.y;
  47772. tangents[attrIndex2 + bottomOffset] = -tangent.z;
  47773. }
  47774. if (top) {
  47775. if (perPositionHeight) {
  47776. tangents[attrIndex] = scratchPerPosTangent.x;
  47777. tangents[attrIndex1] = scratchPerPosTangent.y;
  47778. tangents[attrIndex2] = scratchPerPosTangent.z;
  47779. } else {
  47780. tangents[attrIndex] = tangent.x;
  47781. tangents[attrIndex1] = tangent.y;
  47782. tangents[attrIndex2] = tangent.z;
  47783. }
  47784. }
  47785. }
  47786. if (vertexFormat.bitangent) {
  47787. if (bottom) {
  47788. bitangents[attrIndex + bottomOffset] = bitangent.x;
  47789. bitangents[attrIndex1 + bottomOffset] = bitangent.y;
  47790. bitangents[attrIndex2 + bottomOffset] = bitangent.z;
  47791. }
  47792. if (top) {
  47793. if (perPositionHeight) {
  47794. bitangents[attrIndex] = scratchPerPosBitangent.x;
  47795. bitangents[attrIndex1] = scratchPerPosBitangent.y;
  47796. bitangents[attrIndex2] = scratchPerPosBitangent.z;
  47797. } else {
  47798. bitangents[attrIndex] = bitangent.x;
  47799. bitangents[attrIndex1] = bitangent.y;
  47800. bitangents[attrIndex2] = bitangent.z;
  47801. }
  47802. }
  47803. }
  47804. attrIndex += 3;
  47805. }
  47806. }
  47807. if (vertexFormat.st) {
  47808. geometry.attributes.st = new GeometryAttribute_default({
  47809. componentDatatype: ComponentDatatype_default.FLOAT,
  47810. componentsPerAttribute: 2,
  47811. values: textureCoordinates
  47812. });
  47813. }
  47814. if (vertexFormat.normal) {
  47815. geometry.attributes.normal = new GeometryAttribute_default({
  47816. componentDatatype: ComponentDatatype_default.FLOAT,
  47817. componentsPerAttribute: 3,
  47818. values: normals
  47819. });
  47820. }
  47821. if (vertexFormat.tangent) {
  47822. geometry.attributes.tangent = new GeometryAttribute_default({
  47823. componentDatatype: ComponentDatatype_default.FLOAT,
  47824. componentsPerAttribute: 3,
  47825. values: tangents
  47826. });
  47827. }
  47828. if (vertexFormat.bitangent) {
  47829. geometry.attributes.bitangent = new GeometryAttribute_default({
  47830. componentDatatype: ComponentDatatype_default.FLOAT,
  47831. componentsPerAttribute: 3,
  47832. values: bitangents
  47833. });
  47834. }
  47835. if (shadowVolume) {
  47836. geometry.attributes.extrudeDirection = new GeometryAttribute_default({
  47837. componentDatatype: ComponentDatatype_default.FLOAT,
  47838. componentsPerAttribute: 3,
  47839. values: extrudeNormals
  47840. });
  47841. }
  47842. }
  47843. if (options.extrude && defined_default(options.offsetAttribute)) {
  47844. const size = flatPositions2.length / 3;
  47845. let offsetAttribute = new Uint8Array(size);
  47846. if (options.offsetAttribute === GeometryOffsetAttribute_default.TOP) {
  47847. if (top && bottom || wall) {
  47848. offsetAttribute = arrayFill_default(offsetAttribute, 1, 0, size / 2);
  47849. } else if (top) {
  47850. offsetAttribute = arrayFill_default(offsetAttribute, 1);
  47851. }
  47852. } else {
  47853. const offsetValue = options.offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  47854. offsetAttribute = arrayFill_default(offsetAttribute, offsetValue);
  47855. }
  47856. geometry.attributes.applyOffset = new GeometryAttribute_default({
  47857. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  47858. componentsPerAttribute: 1,
  47859. values: offsetAttribute
  47860. });
  47861. }
  47862. return geometry;
  47863. }
  47864. var startCartographicScratch2 = new Cartographic_default();
  47865. var endCartographicScratch2 = new Cartographic_default();
  47866. var idlCross = {
  47867. westOverIDL: 0,
  47868. eastOverIDL: 0
  47869. };
  47870. var ellipsoidGeodesic2 = new EllipsoidGeodesic_default();
  47871. function computeRectangle3(positions, ellipsoid, arcType, granularity, result) {
  47872. result = defaultValue_default(result, new Rectangle_default());
  47873. if (!defined_default(positions) || positions.length < 3) {
  47874. result.west = 0;
  47875. result.north = 0;
  47876. result.south = 0;
  47877. result.east = 0;
  47878. return result;
  47879. }
  47880. if (arcType === ArcType_default.RHUMB) {
  47881. return Rectangle_default.fromCartesianArray(positions, ellipsoid, result);
  47882. }
  47883. if (!ellipsoidGeodesic2.ellipsoid.equals(ellipsoid)) {
  47884. ellipsoidGeodesic2 = new EllipsoidGeodesic_default(void 0, void 0, ellipsoid);
  47885. }
  47886. result.west = Number.POSITIVE_INFINITY;
  47887. result.east = Number.NEGATIVE_INFINITY;
  47888. result.south = Number.POSITIVE_INFINITY;
  47889. result.north = Number.NEGATIVE_INFINITY;
  47890. idlCross.westOverIDL = Number.POSITIVE_INFINITY;
  47891. idlCross.eastOverIDL = Number.NEGATIVE_INFINITY;
  47892. const inverseChordLength = 1 / Math_default.chordLength(granularity, ellipsoid.maximumRadius);
  47893. const positionsLength = positions.length;
  47894. let endCartographic = ellipsoid.cartesianToCartographic(
  47895. positions[0],
  47896. endCartographicScratch2
  47897. );
  47898. let startCartographic = startCartographicScratch2;
  47899. let swap5;
  47900. for (let i2 = 1; i2 < positionsLength; i2++) {
  47901. swap5 = startCartographic;
  47902. startCartographic = endCartographic;
  47903. endCartographic = ellipsoid.cartesianToCartographic(positions[i2], swap5);
  47904. ellipsoidGeodesic2.setEndPoints(startCartographic, endCartographic);
  47905. interpolateAndGrowRectangle(
  47906. ellipsoidGeodesic2,
  47907. inverseChordLength,
  47908. result,
  47909. idlCross
  47910. );
  47911. }
  47912. swap5 = startCartographic;
  47913. startCartographic = endCartographic;
  47914. endCartographic = ellipsoid.cartesianToCartographic(positions[0], swap5);
  47915. ellipsoidGeodesic2.setEndPoints(startCartographic, endCartographic);
  47916. interpolateAndGrowRectangle(
  47917. ellipsoidGeodesic2,
  47918. inverseChordLength,
  47919. result,
  47920. idlCross
  47921. );
  47922. if (result.east - result.west > idlCross.eastOverIDL - idlCross.westOverIDL) {
  47923. result.west = idlCross.westOverIDL;
  47924. result.east = idlCross.eastOverIDL;
  47925. if (result.east > Math_default.PI) {
  47926. result.east = result.east - Math_default.TWO_PI;
  47927. }
  47928. if (result.west > Math_default.PI) {
  47929. result.west = result.west - Math_default.TWO_PI;
  47930. }
  47931. }
  47932. return result;
  47933. }
  47934. var interpolatedCartographicScratch2 = new Cartographic_default();
  47935. function interpolateAndGrowRectangle(ellipsoidGeodesic3, inverseChordLength, result, idlCross2) {
  47936. const segmentLength = ellipsoidGeodesic3.surfaceDistance;
  47937. const numPoints = Math.ceil(segmentLength * inverseChordLength);
  47938. const subsegmentDistance = numPoints > 0 ? segmentLength / (numPoints - 1) : Number.POSITIVE_INFINITY;
  47939. let interpolationDistance = 0;
  47940. for (let i2 = 0; i2 < numPoints; i2++) {
  47941. const interpolatedCartographic = ellipsoidGeodesic3.interpolateUsingSurfaceDistance(
  47942. interpolationDistance,
  47943. interpolatedCartographicScratch2
  47944. );
  47945. interpolationDistance += subsegmentDistance;
  47946. const longitude = interpolatedCartographic.longitude;
  47947. const latitude = interpolatedCartographic.latitude;
  47948. result.west = Math.min(result.west, longitude);
  47949. result.east = Math.max(result.east, longitude);
  47950. result.south = Math.min(result.south, latitude);
  47951. result.north = Math.max(result.north, latitude);
  47952. const lonAdjusted = longitude >= 0 ? longitude : longitude + Math_default.TWO_PI;
  47953. idlCross2.westOverIDL = Math.min(idlCross2.westOverIDL, lonAdjusted);
  47954. idlCross2.eastOverIDL = Math.max(idlCross2.eastOverIDL, lonAdjusted);
  47955. }
  47956. }
  47957. var createGeometryFromPositionsExtrudedPositions = [];
  47958. function createGeometryFromPositionsExtruded(ellipsoid, polygon, granularity, hierarchy, perPositionHeight, closeTop, closeBottom, vertexFormat, arcType) {
  47959. const geos = {
  47960. walls: []
  47961. };
  47962. let i2;
  47963. if (closeTop || closeBottom) {
  47964. const topGeo = PolygonGeometryLibrary_default.createGeometryFromPositions(
  47965. ellipsoid,
  47966. polygon,
  47967. granularity,
  47968. perPositionHeight,
  47969. vertexFormat,
  47970. arcType
  47971. );
  47972. const edgePoints = topGeo.attributes.position.values;
  47973. const indices2 = topGeo.indices;
  47974. let numPositions;
  47975. let newIndices;
  47976. if (closeTop && closeBottom) {
  47977. const topBottomPositions = edgePoints.concat(edgePoints);
  47978. numPositions = topBottomPositions.length / 3;
  47979. newIndices = IndexDatatype_default.createTypedArray(
  47980. numPositions,
  47981. indices2.length * 2
  47982. );
  47983. newIndices.set(indices2);
  47984. const ilength = indices2.length;
  47985. const length3 = numPositions / 2;
  47986. for (i2 = 0; i2 < ilength; i2 += 3) {
  47987. const i0 = newIndices[i2] + length3;
  47988. const i1 = newIndices[i2 + 1] + length3;
  47989. const i22 = newIndices[i2 + 2] + length3;
  47990. newIndices[i2 + ilength] = i22;
  47991. newIndices[i2 + 1 + ilength] = i1;
  47992. newIndices[i2 + 2 + ilength] = i0;
  47993. }
  47994. topGeo.attributes.position.values = topBottomPositions;
  47995. if (perPositionHeight && vertexFormat.normal) {
  47996. const normals = topGeo.attributes.normal.values;
  47997. topGeo.attributes.normal.values = new Float32Array(
  47998. topBottomPositions.length
  47999. );
  48000. topGeo.attributes.normal.values.set(normals);
  48001. }
  48002. topGeo.indices = newIndices;
  48003. } else if (closeBottom) {
  48004. numPositions = edgePoints.length / 3;
  48005. newIndices = IndexDatatype_default.createTypedArray(numPositions, indices2.length);
  48006. for (i2 = 0; i2 < indices2.length; i2 += 3) {
  48007. newIndices[i2] = indices2[i2 + 2];
  48008. newIndices[i2 + 1] = indices2[i2 + 1];
  48009. newIndices[i2 + 2] = indices2[i2];
  48010. }
  48011. topGeo.indices = newIndices;
  48012. }
  48013. geos.topAndBottom = new GeometryInstance_default({
  48014. geometry: topGeo
  48015. });
  48016. }
  48017. let outerRing = hierarchy.outerRing;
  48018. let tangentPlane = EllipsoidTangentPlane_default.fromPoints(outerRing, ellipsoid);
  48019. let positions2D = tangentPlane.projectPointsOntoPlane(
  48020. outerRing,
  48021. createGeometryFromPositionsExtrudedPositions
  48022. );
  48023. let windingOrder = PolygonPipeline_default.computeWindingOrder2D(positions2D);
  48024. if (windingOrder === WindingOrder_default.CLOCKWISE) {
  48025. outerRing = outerRing.slice().reverse();
  48026. }
  48027. let wallGeo = PolygonGeometryLibrary_default.computeWallGeometry(
  48028. outerRing,
  48029. ellipsoid,
  48030. granularity,
  48031. perPositionHeight,
  48032. arcType
  48033. );
  48034. geos.walls.push(
  48035. new GeometryInstance_default({
  48036. geometry: wallGeo
  48037. })
  48038. );
  48039. const holes = hierarchy.holes;
  48040. for (i2 = 0; i2 < holes.length; i2++) {
  48041. let hole = holes[i2];
  48042. tangentPlane = EllipsoidTangentPlane_default.fromPoints(hole, ellipsoid);
  48043. positions2D = tangentPlane.projectPointsOntoPlane(
  48044. hole,
  48045. createGeometryFromPositionsExtrudedPositions
  48046. );
  48047. windingOrder = PolygonPipeline_default.computeWindingOrder2D(positions2D);
  48048. if (windingOrder === WindingOrder_default.COUNTER_CLOCKWISE) {
  48049. hole = hole.slice().reverse();
  48050. }
  48051. wallGeo = PolygonGeometryLibrary_default.computeWallGeometry(
  48052. hole,
  48053. ellipsoid,
  48054. granularity,
  48055. perPositionHeight,
  48056. arcType
  48057. );
  48058. geos.walls.push(
  48059. new GeometryInstance_default({
  48060. geometry: wallGeo
  48061. })
  48062. );
  48063. }
  48064. return geos;
  48065. }
  48066. function PolygonGeometry(options) {
  48067. Check_default.typeOf.object("options", options);
  48068. Check_default.typeOf.object("options.polygonHierarchy", options.polygonHierarchy);
  48069. if (defined_default(options.perPositionHeight) && options.perPositionHeight && defined_default(options.height)) {
  48070. throw new DeveloperError_default(
  48071. "Cannot use both options.perPositionHeight and options.height"
  48072. );
  48073. }
  48074. if (defined_default(options.arcType) && options.arcType !== ArcType_default.GEODESIC && options.arcType !== ArcType_default.RHUMB) {
  48075. throw new DeveloperError_default(
  48076. "Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB."
  48077. );
  48078. }
  48079. const polygonHierarchy = options.polygonHierarchy;
  48080. const vertexFormat = defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT);
  48081. const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  48082. const granularity = defaultValue_default(
  48083. options.granularity,
  48084. Math_default.RADIANS_PER_DEGREE
  48085. );
  48086. const stRotation = defaultValue_default(options.stRotation, 0);
  48087. const perPositionHeight = defaultValue_default(options.perPositionHeight, false);
  48088. const perPositionHeightExtrude = perPositionHeight && defined_default(options.extrudedHeight);
  48089. let height = defaultValue_default(options.height, 0);
  48090. let extrudedHeight = defaultValue_default(options.extrudedHeight, height);
  48091. if (!perPositionHeightExtrude) {
  48092. const h = Math.max(height, extrudedHeight);
  48093. extrudedHeight = Math.min(height, extrudedHeight);
  48094. height = h;
  48095. }
  48096. this._vertexFormat = VertexFormat_default.clone(vertexFormat);
  48097. this._ellipsoid = Ellipsoid_default.clone(ellipsoid);
  48098. this._granularity = granularity;
  48099. this._stRotation = stRotation;
  48100. this._height = height;
  48101. this._extrudedHeight = extrudedHeight;
  48102. this._closeTop = defaultValue_default(options.closeTop, true);
  48103. this._closeBottom = defaultValue_default(options.closeBottom, true);
  48104. this._polygonHierarchy = polygonHierarchy;
  48105. this._perPositionHeight = perPositionHeight;
  48106. this._perPositionHeightExtrude = perPositionHeightExtrude;
  48107. this._shadowVolume = defaultValue_default(options.shadowVolume, false);
  48108. this._workerName = "createPolygonGeometry";
  48109. this._offsetAttribute = options.offsetAttribute;
  48110. this._arcType = defaultValue_default(options.arcType, ArcType_default.GEODESIC);
  48111. this._rectangle = void 0;
  48112. this._textureCoordinateRotationPoints = void 0;
  48113. this.packedLength = PolygonGeometryLibrary_default.computeHierarchyPackedLength(polygonHierarchy) + Ellipsoid_default.packedLength + VertexFormat_default.packedLength + 12;
  48114. }
  48115. PolygonGeometry.fromPositions = function(options) {
  48116. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  48117. Check_default.defined("options.positions", options.positions);
  48118. const newOptions2 = {
  48119. polygonHierarchy: {
  48120. positions: options.positions
  48121. },
  48122. height: options.height,
  48123. extrudedHeight: options.extrudedHeight,
  48124. vertexFormat: options.vertexFormat,
  48125. stRotation: options.stRotation,
  48126. ellipsoid: options.ellipsoid,
  48127. granularity: options.granularity,
  48128. perPositionHeight: options.perPositionHeight,
  48129. closeTop: options.closeTop,
  48130. closeBottom: options.closeBottom,
  48131. offsetAttribute: options.offsetAttribute,
  48132. arcType: options.arcType
  48133. };
  48134. return new PolygonGeometry(newOptions2);
  48135. };
  48136. PolygonGeometry.pack = function(value, array, startingIndex) {
  48137. Check_default.typeOf.object("value", value);
  48138. Check_default.defined("array", array);
  48139. startingIndex = defaultValue_default(startingIndex, 0);
  48140. startingIndex = PolygonGeometryLibrary_default.packPolygonHierarchy(
  48141. value._polygonHierarchy,
  48142. array,
  48143. startingIndex
  48144. );
  48145. Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
  48146. startingIndex += Ellipsoid_default.packedLength;
  48147. VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
  48148. startingIndex += VertexFormat_default.packedLength;
  48149. array[startingIndex++] = value._height;
  48150. array[startingIndex++] = value._extrudedHeight;
  48151. array[startingIndex++] = value._granularity;
  48152. array[startingIndex++] = value._stRotation;
  48153. array[startingIndex++] = value._perPositionHeightExtrude ? 1 : 0;
  48154. array[startingIndex++] = value._perPositionHeight ? 1 : 0;
  48155. array[startingIndex++] = value._closeTop ? 1 : 0;
  48156. array[startingIndex++] = value._closeBottom ? 1 : 0;
  48157. array[startingIndex++] = value._shadowVolume ? 1 : 0;
  48158. array[startingIndex++] = defaultValue_default(value._offsetAttribute, -1);
  48159. array[startingIndex++] = value._arcType;
  48160. array[startingIndex] = value.packedLength;
  48161. return array;
  48162. };
  48163. var scratchEllipsoid6 = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
  48164. var scratchVertexFormat9 = new VertexFormat_default();
  48165. var dummyOptions = {
  48166. polygonHierarchy: {}
  48167. };
  48168. PolygonGeometry.unpack = function(array, startingIndex, result) {
  48169. Check_default.defined("array", array);
  48170. startingIndex = defaultValue_default(startingIndex, 0);
  48171. const polygonHierarchy = PolygonGeometryLibrary_default.unpackPolygonHierarchy(
  48172. array,
  48173. startingIndex
  48174. );
  48175. startingIndex = polygonHierarchy.startingIndex;
  48176. delete polygonHierarchy.startingIndex;
  48177. const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid6);
  48178. startingIndex += Ellipsoid_default.packedLength;
  48179. const vertexFormat = VertexFormat_default.unpack(
  48180. array,
  48181. startingIndex,
  48182. scratchVertexFormat9
  48183. );
  48184. startingIndex += VertexFormat_default.packedLength;
  48185. const height = array[startingIndex++];
  48186. const extrudedHeight = array[startingIndex++];
  48187. const granularity = array[startingIndex++];
  48188. const stRotation = array[startingIndex++];
  48189. const perPositionHeightExtrude = array[startingIndex++] === 1;
  48190. const perPositionHeight = array[startingIndex++] === 1;
  48191. const closeTop = array[startingIndex++] === 1;
  48192. const closeBottom = array[startingIndex++] === 1;
  48193. const shadowVolume = array[startingIndex++] === 1;
  48194. const offsetAttribute = array[startingIndex++];
  48195. const arcType = array[startingIndex++];
  48196. const packedLength = array[startingIndex];
  48197. if (!defined_default(result)) {
  48198. result = new PolygonGeometry(dummyOptions);
  48199. }
  48200. result._polygonHierarchy = polygonHierarchy;
  48201. result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
  48202. result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
  48203. result._height = height;
  48204. result._extrudedHeight = extrudedHeight;
  48205. result._granularity = granularity;
  48206. result._stRotation = stRotation;
  48207. result._perPositionHeightExtrude = perPositionHeightExtrude;
  48208. result._perPositionHeight = perPositionHeight;
  48209. result._closeTop = closeTop;
  48210. result._closeBottom = closeBottom;
  48211. result._shadowVolume = shadowVolume;
  48212. result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  48213. result._arcType = arcType;
  48214. result.packedLength = packedLength;
  48215. return result;
  48216. };
  48217. PolygonGeometry.computeRectangle = function(options, result) {
  48218. Check_default.typeOf.object("options", options);
  48219. Check_default.typeOf.object("options.polygonHierarchy", options.polygonHierarchy);
  48220. const granularity = defaultValue_default(
  48221. options.granularity,
  48222. Math_default.RADIANS_PER_DEGREE
  48223. );
  48224. const arcType = defaultValue_default(options.arcType, ArcType_default.GEODESIC);
  48225. if (arcType !== ArcType_default.GEODESIC && arcType !== ArcType_default.RHUMB) {
  48226. throw new DeveloperError_default(
  48227. "Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB."
  48228. );
  48229. }
  48230. const polygonHierarchy = options.polygonHierarchy;
  48231. const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  48232. return computeRectangle3(
  48233. polygonHierarchy.positions,
  48234. ellipsoid,
  48235. arcType,
  48236. granularity,
  48237. result
  48238. );
  48239. };
  48240. PolygonGeometry.createGeometry = function(polygonGeometry) {
  48241. const vertexFormat = polygonGeometry._vertexFormat;
  48242. const ellipsoid = polygonGeometry._ellipsoid;
  48243. const granularity = polygonGeometry._granularity;
  48244. const stRotation = polygonGeometry._stRotation;
  48245. const polygonHierarchy = polygonGeometry._polygonHierarchy;
  48246. const perPositionHeight = polygonGeometry._perPositionHeight;
  48247. const closeTop = polygonGeometry._closeTop;
  48248. const closeBottom = polygonGeometry._closeBottom;
  48249. const arcType = polygonGeometry._arcType;
  48250. let outerPositions = polygonHierarchy.positions;
  48251. if (outerPositions.length < 3) {
  48252. return;
  48253. }
  48254. const tangentPlane = EllipsoidTangentPlane_default.fromPoints(
  48255. outerPositions,
  48256. ellipsoid
  48257. );
  48258. const results = PolygonGeometryLibrary_default.polygonsFromHierarchy(
  48259. polygonHierarchy,
  48260. tangentPlane.projectPointsOntoPlane.bind(tangentPlane),
  48261. !perPositionHeight,
  48262. ellipsoid
  48263. );
  48264. const hierarchy = results.hierarchy;
  48265. const polygons = results.polygons;
  48266. if (hierarchy.length === 0) {
  48267. return;
  48268. }
  48269. outerPositions = hierarchy[0].outerRing;
  48270. const boundingRectangle = PolygonGeometryLibrary_default.computeBoundingRectangle(
  48271. tangentPlane.plane.normal,
  48272. tangentPlane.projectPointOntoPlane.bind(tangentPlane),
  48273. outerPositions,
  48274. stRotation,
  48275. scratchBoundingRectangle
  48276. );
  48277. const geometries = [];
  48278. const height = polygonGeometry._height;
  48279. const extrudedHeight = polygonGeometry._extrudedHeight;
  48280. const extrude = polygonGeometry._perPositionHeightExtrude || !Math_default.equalsEpsilon(height, extrudedHeight, 0, Math_default.EPSILON2);
  48281. const options = {
  48282. perPositionHeight,
  48283. vertexFormat,
  48284. geometry: void 0,
  48285. tangentPlane,
  48286. boundingRectangle,
  48287. ellipsoid,
  48288. stRotation,
  48289. bottom: false,
  48290. top: true,
  48291. wall: false,
  48292. extrude: false,
  48293. arcType
  48294. };
  48295. let i2;
  48296. if (extrude) {
  48297. options.extrude = true;
  48298. options.top = closeTop;
  48299. options.bottom = closeBottom;
  48300. options.shadowVolume = polygonGeometry._shadowVolume;
  48301. options.offsetAttribute = polygonGeometry._offsetAttribute;
  48302. for (i2 = 0; i2 < polygons.length; i2++) {
  48303. const splitGeometry = createGeometryFromPositionsExtruded(
  48304. ellipsoid,
  48305. polygons[i2],
  48306. granularity,
  48307. hierarchy[i2],
  48308. perPositionHeight,
  48309. closeTop,
  48310. closeBottom,
  48311. vertexFormat,
  48312. arcType
  48313. );
  48314. let topAndBottom;
  48315. if (closeTop && closeBottom) {
  48316. topAndBottom = splitGeometry.topAndBottom;
  48317. options.geometry = PolygonGeometryLibrary_default.scaleToGeodeticHeightExtruded(
  48318. topAndBottom.geometry,
  48319. height,
  48320. extrudedHeight,
  48321. ellipsoid,
  48322. perPositionHeight
  48323. );
  48324. } else if (closeTop) {
  48325. topAndBottom = splitGeometry.topAndBottom;
  48326. topAndBottom.geometry.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
  48327. topAndBottom.geometry.attributes.position.values,
  48328. height,
  48329. ellipsoid,
  48330. !perPositionHeight
  48331. );
  48332. options.geometry = topAndBottom.geometry;
  48333. } else if (closeBottom) {
  48334. topAndBottom = splitGeometry.topAndBottom;
  48335. topAndBottom.geometry.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
  48336. topAndBottom.geometry.attributes.position.values,
  48337. extrudedHeight,
  48338. ellipsoid,
  48339. true
  48340. );
  48341. options.geometry = topAndBottom.geometry;
  48342. }
  48343. if (closeTop || closeBottom) {
  48344. options.wall = false;
  48345. topAndBottom.geometry = computeAttributes(options);
  48346. geometries.push(topAndBottom);
  48347. }
  48348. const walls = splitGeometry.walls;
  48349. options.wall = true;
  48350. for (let k = 0; k < walls.length; k++) {
  48351. const wall = walls[k];
  48352. options.geometry = PolygonGeometryLibrary_default.scaleToGeodeticHeightExtruded(
  48353. wall.geometry,
  48354. height,
  48355. extrudedHeight,
  48356. ellipsoid,
  48357. perPositionHeight
  48358. );
  48359. wall.geometry = computeAttributes(options);
  48360. geometries.push(wall);
  48361. }
  48362. }
  48363. } else {
  48364. for (i2 = 0; i2 < polygons.length; i2++) {
  48365. const geometryInstance = new GeometryInstance_default({
  48366. geometry: PolygonGeometryLibrary_default.createGeometryFromPositions(
  48367. ellipsoid,
  48368. polygons[i2],
  48369. granularity,
  48370. perPositionHeight,
  48371. vertexFormat,
  48372. arcType
  48373. )
  48374. });
  48375. geometryInstance.geometry.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
  48376. geometryInstance.geometry.attributes.position.values,
  48377. height,
  48378. ellipsoid,
  48379. !perPositionHeight
  48380. );
  48381. options.geometry = geometryInstance.geometry;
  48382. geometryInstance.geometry = computeAttributes(options);
  48383. if (defined_default(polygonGeometry._offsetAttribute)) {
  48384. const length3 = geometryInstance.geometry.attributes.position.values.length;
  48385. const applyOffset = new Uint8Array(length3 / 3);
  48386. const offsetValue = polygonGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  48387. arrayFill_default(applyOffset, offsetValue);
  48388. geometryInstance.geometry.attributes.applyOffset = new GeometryAttribute_default(
  48389. {
  48390. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  48391. componentsPerAttribute: 1,
  48392. values: applyOffset
  48393. }
  48394. );
  48395. }
  48396. geometries.push(geometryInstance);
  48397. }
  48398. }
  48399. const geometry = GeometryPipeline_default.combineInstances(geometries)[0];
  48400. geometry.attributes.position.values = new Float64Array(
  48401. geometry.attributes.position.values
  48402. );
  48403. geometry.indices = IndexDatatype_default.createTypedArray(
  48404. geometry.attributes.position.values.length / 3,
  48405. geometry.indices
  48406. );
  48407. const attributes = geometry.attributes;
  48408. const boundingSphere = BoundingSphere_default.fromVertices(
  48409. attributes.position.values
  48410. );
  48411. if (!vertexFormat.position) {
  48412. delete attributes.position;
  48413. }
  48414. return new Geometry_default({
  48415. attributes,
  48416. indices: geometry.indices,
  48417. primitiveType: geometry.primitiveType,
  48418. boundingSphere,
  48419. offsetAttribute: polygonGeometry._offsetAttribute
  48420. });
  48421. };
  48422. PolygonGeometry.createShadowVolume = function(polygonGeometry, minHeightFunc, maxHeightFunc) {
  48423. const granularity = polygonGeometry._granularity;
  48424. const ellipsoid = polygonGeometry._ellipsoid;
  48425. const minHeight = minHeightFunc(granularity, ellipsoid);
  48426. const maxHeight = maxHeightFunc(granularity, ellipsoid);
  48427. return new PolygonGeometry({
  48428. polygonHierarchy: polygonGeometry._polygonHierarchy,
  48429. ellipsoid,
  48430. stRotation: polygonGeometry._stRotation,
  48431. granularity,
  48432. perPositionHeight: false,
  48433. extrudedHeight: minHeight,
  48434. height: maxHeight,
  48435. vertexFormat: VertexFormat_default.POSITION_ONLY,
  48436. shadowVolume: true,
  48437. arcType: polygonGeometry._arcType
  48438. });
  48439. };
  48440. function textureCoordinateRotationPoints2(polygonGeometry) {
  48441. const stRotation = -polygonGeometry._stRotation;
  48442. if (stRotation === 0) {
  48443. return [0, 0, 0, 1, 1, 0];
  48444. }
  48445. const ellipsoid = polygonGeometry._ellipsoid;
  48446. const positions = polygonGeometry._polygonHierarchy.positions;
  48447. const boundingRectangle = polygonGeometry.rectangle;
  48448. return Geometry_default._textureCoordinateRotationPoints(
  48449. positions,
  48450. stRotation,
  48451. ellipsoid,
  48452. boundingRectangle
  48453. );
  48454. }
  48455. Object.defineProperties(PolygonGeometry.prototype, {
  48456. rectangle: {
  48457. get: function() {
  48458. if (!defined_default(this._rectangle)) {
  48459. const positions = this._polygonHierarchy.positions;
  48460. this._rectangle = computeRectangle3(
  48461. positions,
  48462. this._ellipsoid,
  48463. this._arcType,
  48464. this._granularity
  48465. );
  48466. }
  48467. return this._rectangle;
  48468. }
  48469. },
  48470. textureCoordinateRotationPoints: {
  48471. get: function() {
  48472. if (!defined_default(this._textureCoordinateRotationPoints)) {
  48473. this._textureCoordinateRotationPoints = textureCoordinateRotationPoints2(
  48474. this
  48475. );
  48476. }
  48477. return this._textureCoordinateRotationPoints;
  48478. }
  48479. }
  48480. });
  48481. var PolygonGeometry_default = PolygonGeometry;
  48482. // node_modules/cesium/Source/Core/PolygonHierarchy.js
  48483. function PolygonHierarchy(positions, holes) {
  48484. this.positions = defined_default(positions) ? positions : [];
  48485. this.holes = defined_default(holes) ? holes : [];
  48486. }
  48487. var PolygonHierarchy_default = PolygonHierarchy;
  48488. // node_modules/cesium/Source/Core/PolygonOutlineGeometry.js
  48489. var createGeometryFromPositionsPositions = [];
  48490. var createGeometryFromPositionsSubdivided = [];
  48491. function createGeometryFromPositions2(ellipsoid, positions, minDistance, perPositionHeight, arcType) {
  48492. const tangentPlane = EllipsoidTangentPlane_default.fromPoints(positions, ellipsoid);
  48493. const positions2D = tangentPlane.projectPointsOntoPlane(
  48494. positions,
  48495. createGeometryFromPositionsPositions
  48496. );
  48497. const originalWindingOrder = PolygonPipeline_default.computeWindingOrder2D(
  48498. positions2D
  48499. );
  48500. if (originalWindingOrder === WindingOrder_default.CLOCKWISE) {
  48501. positions2D.reverse();
  48502. positions = positions.slice().reverse();
  48503. }
  48504. let subdividedPositions;
  48505. let i2;
  48506. let length3 = positions.length;
  48507. let index2 = 0;
  48508. if (!perPositionHeight) {
  48509. let numVertices = 0;
  48510. if (arcType === ArcType_default.GEODESIC) {
  48511. for (i2 = 0; i2 < length3; i2++) {
  48512. numVertices += PolygonGeometryLibrary_default.subdivideLineCount(
  48513. positions[i2],
  48514. positions[(i2 + 1) % length3],
  48515. minDistance
  48516. );
  48517. }
  48518. } else if (arcType === ArcType_default.RHUMB) {
  48519. for (i2 = 0; i2 < length3; i2++) {
  48520. numVertices += PolygonGeometryLibrary_default.subdivideRhumbLineCount(
  48521. ellipsoid,
  48522. positions[i2],
  48523. positions[(i2 + 1) % length3],
  48524. minDistance
  48525. );
  48526. }
  48527. }
  48528. subdividedPositions = new Float64Array(numVertices * 3);
  48529. for (i2 = 0; i2 < length3; i2++) {
  48530. let tempPositions;
  48531. if (arcType === ArcType_default.GEODESIC) {
  48532. tempPositions = PolygonGeometryLibrary_default.subdivideLine(
  48533. positions[i2],
  48534. positions[(i2 + 1) % length3],
  48535. minDistance,
  48536. createGeometryFromPositionsSubdivided
  48537. );
  48538. } else if (arcType === ArcType_default.RHUMB) {
  48539. tempPositions = PolygonGeometryLibrary_default.subdivideRhumbLine(
  48540. ellipsoid,
  48541. positions[i2],
  48542. positions[(i2 + 1) % length3],
  48543. minDistance,
  48544. createGeometryFromPositionsSubdivided
  48545. );
  48546. }
  48547. const tempPositionsLength = tempPositions.length;
  48548. for (let j = 0; j < tempPositionsLength; ++j) {
  48549. subdividedPositions[index2++] = tempPositions[j];
  48550. }
  48551. }
  48552. } else {
  48553. subdividedPositions = new Float64Array(length3 * 2 * 3);
  48554. for (i2 = 0; i2 < length3; i2++) {
  48555. const p0 = positions[i2];
  48556. const p1 = positions[(i2 + 1) % length3];
  48557. subdividedPositions[index2++] = p0.x;
  48558. subdividedPositions[index2++] = p0.y;
  48559. subdividedPositions[index2++] = p0.z;
  48560. subdividedPositions[index2++] = p1.x;
  48561. subdividedPositions[index2++] = p1.y;
  48562. subdividedPositions[index2++] = p1.z;
  48563. }
  48564. }
  48565. length3 = subdividedPositions.length / 3;
  48566. const indicesSize = length3 * 2;
  48567. const indices2 = IndexDatatype_default.createTypedArray(length3, indicesSize);
  48568. index2 = 0;
  48569. for (i2 = 0; i2 < length3 - 1; i2++) {
  48570. indices2[index2++] = i2;
  48571. indices2[index2++] = i2 + 1;
  48572. }
  48573. indices2[index2++] = length3 - 1;
  48574. indices2[index2++] = 0;
  48575. return new GeometryInstance_default({
  48576. geometry: new Geometry_default({
  48577. attributes: new GeometryAttributes_default({
  48578. position: new GeometryAttribute_default({
  48579. componentDatatype: ComponentDatatype_default.DOUBLE,
  48580. componentsPerAttribute: 3,
  48581. values: subdividedPositions
  48582. })
  48583. }),
  48584. indices: indices2,
  48585. primitiveType: PrimitiveType_default.LINES
  48586. })
  48587. });
  48588. }
  48589. function createGeometryFromPositionsExtruded2(ellipsoid, positions, minDistance, perPositionHeight, arcType) {
  48590. const tangentPlane = EllipsoidTangentPlane_default.fromPoints(positions, ellipsoid);
  48591. const positions2D = tangentPlane.projectPointsOntoPlane(
  48592. positions,
  48593. createGeometryFromPositionsPositions
  48594. );
  48595. const originalWindingOrder = PolygonPipeline_default.computeWindingOrder2D(
  48596. positions2D
  48597. );
  48598. if (originalWindingOrder === WindingOrder_default.CLOCKWISE) {
  48599. positions2D.reverse();
  48600. positions = positions.slice().reverse();
  48601. }
  48602. let subdividedPositions;
  48603. let i2;
  48604. let length3 = positions.length;
  48605. const corners = new Array(length3);
  48606. let index2 = 0;
  48607. if (!perPositionHeight) {
  48608. let numVertices = 0;
  48609. if (arcType === ArcType_default.GEODESIC) {
  48610. for (i2 = 0; i2 < length3; i2++) {
  48611. numVertices += PolygonGeometryLibrary_default.subdivideLineCount(
  48612. positions[i2],
  48613. positions[(i2 + 1) % length3],
  48614. minDistance
  48615. );
  48616. }
  48617. } else if (arcType === ArcType_default.RHUMB) {
  48618. for (i2 = 0; i2 < length3; i2++) {
  48619. numVertices += PolygonGeometryLibrary_default.subdivideRhumbLineCount(
  48620. ellipsoid,
  48621. positions[i2],
  48622. positions[(i2 + 1) % length3],
  48623. minDistance
  48624. );
  48625. }
  48626. }
  48627. subdividedPositions = new Float64Array(numVertices * 3 * 2);
  48628. for (i2 = 0; i2 < length3; ++i2) {
  48629. corners[i2] = index2 / 3;
  48630. let tempPositions;
  48631. if (arcType === ArcType_default.GEODESIC) {
  48632. tempPositions = PolygonGeometryLibrary_default.subdivideLine(
  48633. positions[i2],
  48634. positions[(i2 + 1) % length3],
  48635. minDistance,
  48636. createGeometryFromPositionsSubdivided
  48637. );
  48638. } else if (arcType === ArcType_default.RHUMB) {
  48639. tempPositions = PolygonGeometryLibrary_default.subdivideRhumbLine(
  48640. ellipsoid,
  48641. positions[i2],
  48642. positions[(i2 + 1) % length3],
  48643. minDistance,
  48644. createGeometryFromPositionsSubdivided
  48645. );
  48646. }
  48647. const tempPositionsLength = tempPositions.length;
  48648. for (let j = 0; j < tempPositionsLength; ++j) {
  48649. subdividedPositions[index2++] = tempPositions[j];
  48650. }
  48651. }
  48652. } else {
  48653. subdividedPositions = new Float64Array(length3 * 2 * 3 * 2);
  48654. for (i2 = 0; i2 < length3; ++i2) {
  48655. corners[i2] = index2 / 3;
  48656. const p0 = positions[i2];
  48657. const p1 = positions[(i2 + 1) % length3];
  48658. subdividedPositions[index2++] = p0.x;
  48659. subdividedPositions[index2++] = p0.y;
  48660. subdividedPositions[index2++] = p0.z;
  48661. subdividedPositions[index2++] = p1.x;
  48662. subdividedPositions[index2++] = p1.y;
  48663. subdividedPositions[index2++] = p1.z;
  48664. }
  48665. }
  48666. length3 = subdividedPositions.length / (3 * 2);
  48667. const cornersLength = corners.length;
  48668. const indicesSize = (length3 * 2 + cornersLength) * 2;
  48669. const indices2 = IndexDatatype_default.createTypedArray(
  48670. length3 + cornersLength,
  48671. indicesSize
  48672. );
  48673. index2 = 0;
  48674. for (i2 = 0; i2 < length3; ++i2) {
  48675. indices2[index2++] = i2;
  48676. indices2[index2++] = (i2 + 1) % length3;
  48677. indices2[index2++] = i2 + length3;
  48678. indices2[index2++] = (i2 + 1) % length3 + length3;
  48679. }
  48680. for (i2 = 0; i2 < cornersLength; i2++) {
  48681. const corner = corners[i2];
  48682. indices2[index2++] = corner;
  48683. indices2[index2++] = corner + length3;
  48684. }
  48685. return new GeometryInstance_default({
  48686. geometry: new Geometry_default({
  48687. attributes: new GeometryAttributes_default({
  48688. position: new GeometryAttribute_default({
  48689. componentDatatype: ComponentDatatype_default.DOUBLE,
  48690. componentsPerAttribute: 3,
  48691. values: subdividedPositions
  48692. })
  48693. }),
  48694. indices: indices2,
  48695. primitiveType: PrimitiveType_default.LINES
  48696. })
  48697. });
  48698. }
  48699. function PolygonOutlineGeometry(options) {
  48700. Check_default.typeOf.object("options", options);
  48701. Check_default.typeOf.object("options.polygonHierarchy", options.polygonHierarchy);
  48702. if (options.perPositionHeight && defined_default(options.height)) {
  48703. throw new DeveloperError_default(
  48704. "Cannot use both options.perPositionHeight and options.height"
  48705. );
  48706. }
  48707. if (defined_default(options.arcType) && options.arcType !== ArcType_default.GEODESIC && options.arcType !== ArcType_default.RHUMB) {
  48708. throw new DeveloperError_default(
  48709. "Invalid arcType. Valid options are ArcType.GEODESIC and ArcType.RHUMB."
  48710. );
  48711. }
  48712. const polygonHierarchy = options.polygonHierarchy;
  48713. const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  48714. const granularity = defaultValue_default(
  48715. options.granularity,
  48716. Math_default.RADIANS_PER_DEGREE
  48717. );
  48718. const perPositionHeight = defaultValue_default(options.perPositionHeight, false);
  48719. const perPositionHeightExtrude = perPositionHeight && defined_default(options.extrudedHeight);
  48720. const arcType = defaultValue_default(options.arcType, ArcType_default.GEODESIC);
  48721. let height = defaultValue_default(options.height, 0);
  48722. let extrudedHeight = defaultValue_default(options.extrudedHeight, height);
  48723. if (!perPositionHeightExtrude) {
  48724. const h = Math.max(height, extrudedHeight);
  48725. extrudedHeight = Math.min(height, extrudedHeight);
  48726. height = h;
  48727. }
  48728. this._ellipsoid = Ellipsoid_default.clone(ellipsoid);
  48729. this._granularity = granularity;
  48730. this._height = height;
  48731. this._extrudedHeight = extrudedHeight;
  48732. this._arcType = arcType;
  48733. this._polygonHierarchy = polygonHierarchy;
  48734. this._perPositionHeight = perPositionHeight;
  48735. this._perPositionHeightExtrude = perPositionHeightExtrude;
  48736. this._offsetAttribute = options.offsetAttribute;
  48737. this._workerName = "createPolygonOutlineGeometry";
  48738. this.packedLength = PolygonGeometryLibrary_default.computeHierarchyPackedLength(polygonHierarchy) + Ellipsoid_default.packedLength + 8;
  48739. }
  48740. PolygonOutlineGeometry.pack = function(value, array, startingIndex) {
  48741. Check_default.typeOf.object("value", value);
  48742. Check_default.defined("array", array);
  48743. startingIndex = defaultValue_default(startingIndex, 0);
  48744. startingIndex = PolygonGeometryLibrary_default.packPolygonHierarchy(
  48745. value._polygonHierarchy,
  48746. array,
  48747. startingIndex
  48748. );
  48749. Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
  48750. startingIndex += Ellipsoid_default.packedLength;
  48751. array[startingIndex++] = value._height;
  48752. array[startingIndex++] = value._extrudedHeight;
  48753. array[startingIndex++] = value._granularity;
  48754. array[startingIndex++] = value._perPositionHeightExtrude ? 1 : 0;
  48755. array[startingIndex++] = value._perPositionHeight ? 1 : 0;
  48756. array[startingIndex++] = value._arcType;
  48757. array[startingIndex++] = defaultValue_default(value._offsetAttribute, -1);
  48758. array[startingIndex] = value.packedLength;
  48759. return array;
  48760. };
  48761. var scratchEllipsoid7 = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
  48762. var dummyOptions2 = {
  48763. polygonHierarchy: {}
  48764. };
  48765. PolygonOutlineGeometry.unpack = function(array, startingIndex, result) {
  48766. Check_default.defined("array", array);
  48767. startingIndex = defaultValue_default(startingIndex, 0);
  48768. const polygonHierarchy = PolygonGeometryLibrary_default.unpackPolygonHierarchy(
  48769. array,
  48770. startingIndex
  48771. );
  48772. startingIndex = polygonHierarchy.startingIndex;
  48773. delete polygonHierarchy.startingIndex;
  48774. const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid7);
  48775. startingIndex += Ellipsoid_default.packedLength;
  48776. const height = array[startingIndex++];
  48777. const extrudedHeight = array[startingIndex++];
  48778. const granularity = array[startingIndex++];
  48779. const perPositionHeightExtrude = array[startingIndex++] === 1;
  48780. const perPositionHeight = array[startingIndex++] === 1;
  48781. const arcType = array[startingIndex++];
  48782. const offsetAttribute = array[startingIndex++];
  48783. const packedLength = array[startingIndex];
  48784. if (!defined_default(result)) {
  48785. result = new PolygonOutlineGeometry(dummyOptions2);
  48786. }
  48787. result._polygonHierarchy = polygonHierarchy;
  48788. result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
  48789. result._height = height;
  48790. result._extrudedHeight = extrudedHeight;
  48791. result._granularity = granularity;
  48792. result._perPositionHeight = perPositionHeight;
  48793. result._perPositionHeightExtrude = perPositionHeightExtrude;
  48794. result._arcType = arcType;
  48795. result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  48796. result.packedLength = packedLength;
  48797. return result;
  48798. };
  48799. PolygonOutlineGeometry.fromPositions = function(options) {
  48800. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  48801. Check_default.defined("options.positions", options.positions);
  48802. const newOptions2 = {
  48803. polygonHierarchy: {
  48804. positions: options.positions
  48805. },
  48806. height: options.height,
  48807. extrudedHeight: options.extrudedHeight,
  48808. ellipsoid: options.ellipsoid,
  48809. granularity: options.granularity,
  48810. perPositionHeight: options.perPositionHeight,
  48811. arcType: options.arcType,
  48812. offsetAttribute: options.offsetAttribute
  48813. };
  48814. return new PolygonOutlineGeometry(newOptions2);
  48815. };
  48816. PolygonOutlineGeometry.createGeometry = function(polygonGeometry) {
  48817. const ellipsoid = polygonGeometry._ellipsoid;
  48818. const granularity = polygonGeometry._granularity;
  48819. const polygonHierarchy = polygonGeometry._polygonHierarchy;
  48820. const perPositionHeight = polygonGeometry._perPositionHeight;
  48821. const arcType = polygonGeometry._arcType;
  48822. const polygons = PolygonGeometryLibrary_default.polygonOutlinesFromHierarchy(
  48823. polygonHierarchy,
  48824. !perPositionHeight,
  48825. ellipsoid
  48826. );
  48827. if (polygons.length === 0) {
  48828. return void 0;
  48829. }
  48830. let geometryInstance;
  48831. const geometries = [];
  48832. const minDistance = Math_default.chordLength(
  48833. granularity,
  48834. ellipsoid.maximumRadius
  48835. );
  48836. const height = polygonGeometry._height;
  48837. const extrudedHeight = polygonGeometry._extrudedHeight;
  48838. const extrude = polygonGeometry._perPositionHeightExtrude || !Math_default.equalsEpsilon(height, extrudedHeight, 0, Math_default.EPSILON2);
  48839. let offsetValue;
  48840. let i2;
  48841. if (extrude) {
  48842. for (i2 = 0; i2 < polygons.length; i2++) {
  48843. geometryInstance = createGeometryFromPositionsExtruded2(
  48844. ellipsoid,
  48845. polygons[i2],
  48846. minDistance,
  48847. perPositionHeight,
  48848. arcType
  48849. );
  48850. geometryInstance.geometry = PolygonGeometryLibrary_default.scaleToGeodeticHeightExtruded(
  48851. geometryInstance.geometry,
  48852. height,
  48853. extrudedHeight,
  48854. ellipsoid,
  48855. perPositionHeight
  48856. );
  48857. if (defined_default(polygonGeometry._offsetAttribute)) {
  48858. const size = geometryInstance.geometry.attributes.position.values.length / 3;
  48859. let offsetAttribute = new Uint8Array(size);
  48860. if (polygonGeometry._offsetAttribute === GeometryOffsetAttribute_default.TOP) {
  48861. offsetAttribute = arrayFill_default(offsetAttribute, 1, 0, size / 2);
  48862. } else {
  48863. offsetValue = polygonGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  48864. offsetAttribute = arrayFill_default(offsetAttribute, offsetValue);
  48865. }
  48866. geometryInstance.geometry.attributes.applyOffset = new GeometryAttribute_default(
  48867. {
  48868. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  48869. componentsPerAttribute: 1,
  48870. values: offsetAttribute
  48871. }
  48872. );
  48873. }
  48874. geometries.push(geometryInstance);
  48875. }
  48876. } else {
  48877. for (i2 = 0; i2 < polygons.length; i2++) {
  48878. geometryInstance = createGeometryFromPositions2(
  48879. ellipsoid,
  48880. polygons[i2],
  48881. minDistance,
  48882. perPositionHeight,
  48883. arcType
  48884. );
  48885. geometryInstance.geometry.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
  48886. geometryInstance.geometry.attributes.position.values,
  48887. height,
  48888. ellipsoid,
  48889. !perPositionHeight
  48890. );
  48891. if (defined_default(polygonGeometry._offsetAttribute)) {
  48892. const length3 = geometryInstance.geometry.attributes.position.values.length;
  48893. const applyOffset = new Uint8Array(length3 / 3);
  48894. offsetValue = polygonGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  48895. arrayFill_default(applyOffset, offsetValue);
  48896. geometryInstance.geometry.attributes.applyOffset = new GeometryAttribute_default(
  48897. {
  48898. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  48899. componentsPerAttribute: 1,
  48900. values: applyOffset
  48901. }
  48902. );
  48903. }
  48904. geometries.push(geometryInstance);
  48905. }
  48906. }
  48907. const geometry = GeometryPipeline_default.combineInstances(geometries)[0];
  48908. const boundingSphere = BoundingSphere_default.fromVertices(
  48909. geometry.attributes.position.values
  48910. );
  48911. return new Geometry_default({
  48912. attributes: geometry.attributes,
  48913. indices: geometry.indices,
  48914. primitiveType: geometry.primitiveType,
  48915. boundingSphere,
  48916. offsetAttribute: polygonGeometry._offsetAttribute
  48917. });
  48918. };
  48919. var PolygonOutlineGeometry_default = PolygonOutlineGeometry;
  48920. // node_modules/cesium/Source/Core/PolylineGeometry.js
  48921. var scratchInterpolateColorsArray = [];
  48922. function interpolateColors(p0, p1, color0, color1, numPoints) {
  48923. const colors = scratchInterpolateColorsArray;
  48924. colors.length = numPoints;
  48925. let i2;
  48926. const r0 = color0.red;
  48927. const g0 = color0.green;
  48928. const b0 = color0.blue;
  48929. const a0 = color0.alpha;
  48930. const r1 = color1.red;
  48931. const g1 = color1.green;
  48932. const b1 = color1.blue;
  48933. const a1 = color1.alpha;
  48934. if (Color_default.equals(color0, color1)) {
  48935. for (i2 = 0; i2 < numPoints; i2++) {
  48936. colors[i2] = Color_default.clone(color0);
  48937. }
  48938. return colors;
  48939. }
  48940. const redPerVertex = (r1 - r0) / numPoints;
  48941. const greenPerVertex = (g1 - g0) / numPoints;
  48942. const bluePerVertex = (b1 - b0) / numPoints;
  48943. const alphaPerVertex = (a1 - a0) / numPoints;
  48944. for (i2 = 0; i2 < numPoints; i2++) {
  48945. colors[i2] = new Color_default(
  48946. r0 + i2 * redPerVertex,
  48947. g0 + i2 * greenPerVertex,
  48948. b0 + i2 * bluePerVertex,
  48949. a0 + i2 * alphaPerVertex
  48950. );
  48951. }
  48952. return colors;
  48953. }
  48954. function PolylineGeometry(options) {
  48955. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  48956. const positions = options.positions;
  48957. const colors = options.colors;
  48958. const width = defaultValue_default(options.width, 1);
  48959. const colorsPerVertex = defaultValue_default(options.colorsPerVertex, false);
  48960. if (!defined_default(positions) || positions.length < 2) {
  48961. throw new DeveloperError_default("At least two positions are required.");
  48962. }
  48963. if (typeof width !== "number") {
  48964. throw new DeveloperError_default("width must be a number");
  48965. }
  48966. if (defined_default(colors) && (colorsPerVertex && colors.length < positions.length || !colorsPerVertex && colors.length < positions.length - 1)) {
  48967. throw new DeveloperError_default("colors has an invalid length.");
  48968. }
  48969. this._positions = positions;
  48970. this._colors = colors;
  48971. this._width = width;
  48972. this._colorsPerVertex = colorsPerVertex;
  48973. this._vertexFormat = VertexFormat_default.clone(
  48974. defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT)
  48975. );
  48976. this._arcType = defaultValue_default(options.arcType, ArcType_default.GEODESIC);
  48977. this._granularity = defaultValue_default(
  48978. options.granularity,
  48979. Math_default.RADIANS_PER_DEGREE
  48980. );
  48981. this._ellipsoid = Ellipsoid_default.clone(
  48982. defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84)
  48983. );
  48984. this._workerName = "createPolylineGeometry";
  48985. let numComponents = 1 + positions.length * Cartesian3_default.packedLength;
  48986. numComponents += defined_default(colors) ? 1 + colors.length * Color_default.packedLength : 1;
  48987. this.packedLength = numComponents + Ellipsoid_default.packedLength + VertexFormat_default.packedLength + 4;
  48988. }
  48989. PolylineGeometry.pack = function(value, array, startingIndex) {
  48990. if (!defined_default(value)) {
  48991. throw new DeveloperError_default("value is required");
  48992. }
  48993. if (!defined_default(array)) {
  48994. throw new DeveloperError_default("array is required");
  48995. }
  48996. startingIndex = defaultValue_default(startingIndex, 0);
  48997. let i2;
  48998. const positions = value._positions;
  48999. let length3 = positions.length;
  49000. array[startingIndex++] = length3;
  49001. for (i2 = 0; i2 < length3; ++i2, startingIndex += Cartesian3_default.packedLength) {
  49002. Cartesian3_default.pack(positions[i2], array, startingIndex);
  49003. }
  49004. const colors = value._colors;
  49005. length3 = defined_default(colors) ? colors.length : 0;
  49006. array[startingIndex++] = length3;
  49007. for (i2 = 0; i2 < length3; ++i2, startingIndex += Color_default.packedLength) {
  49008. Color_default.pack(colors[i2], array, startingIndex);
  49009. }
  49010. Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
  49011. startingIndex += Ellipsoid_default.packedLength;
  49012. VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
  49013. startingIndex += VertexFormat_default.packedLength;
  49014. array[startingIndex++] = value._width;
  49015. array[startingIndex++] = value._colorsPerVertex ? 1 : 0;
  49016. array[startingIndex++] = value._arcType;
  49017. array[startingIndex] = value._granularity;
  49018. return array;
  49019. };
  49020. var scratchEllipsoid8 = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
  49021. var scratchVertexFormat10 = new VertexFormat_default();
  49022. var scratchOptions16 = {
  49023. positions: void 0,
  49024. colors: void 0,
  49025. ellipsoid: scratchEllipsoid8,
  49026. vertexFormat: scratchVertexFormat10,
  49027. width: void 0,
  49028. colorsPerVertex: void 0,
  49029. arcType: void 0,
  49030. granularity: void 0
  49031. };
  49032. PolylineGeometry.unpack = function(array, startingIndex, result) {
  49033. if (!defined_default(array)) {
  49034. throw new DeveloperError_default("array is required");
  49035. }
  49036. startingIndex = defaultValue_default(startingIndex, 0);
  49037. let i2;
  49038. let length3 = array[startingIndex++];
  49039. const positions = new Array(length3);
  49040. for (i2 = 0; i2 < length3; ++i2, startingIndex += Cartesian3_default.packedLength) {
  49041. positions[i2] = Cartesian3_default.unpack(array, startingIndex);
  49042. }
  49043. length3 = array[startingIndex++];
  49044. const colors = length3 > 0 ? new Array(length3) : void 0;
  49045. for (i2 = 0; i2 < length3; ++i2, startingIndex += Color_default.packedLength) {
  49046. colors[i2] = Color_default.unpack(array, startingIndex);
  49047. }
  49048. const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid8);
  49049. startingIndex += Ellipsoid_default.packedLength;
  49050. const vertexFormat = VertexFormat_default.unpack(
  49051. array,
  49052. startingIndex,
  49053. scratchVertexFormat10
  49054. );
  49055. startingIndex += VertexFormat_default.packedLength;
  49056. const width = array[startingIndex++];
  49057. const colorsPerVertex = array[startingIndex++] === 1;
  49058. const arcType = array[startingIndex++];
  49059. const granularity = array[startingIndex];
  49060. if (!defined_default(result)) {
  49061. scratchOptions16.positions = positions;
  49062. scratchOptions16.colors = colors;
  49063. scratchOptions16.width = width;
  49064. scratchOptions16.colorsPerVertex = colorsPerVertex;
  49065. scratchOptions16.arcType = arcType;
  49066. scratchOptions16.granularity = granularity;
  49067. return new PolylineGeometry(scratchOptions16);
  49068. }
  49069. result._positions = positions;
  49070. result._colors = colors;
  49071. result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
  49072. result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
  49073. result._width = width;
  49074. result._colorsPerVertex = colorsPerVertex;
  49075. result._arcType = arcType;
  49076. result._granularity = granularity;
  49077. return result;
  49078. };
  49079. var scratchCartesian39 = new Cartesian3_default();
  49080. var scratchPosition5 = new Cartesian3_default();
  49081. var scratchPrevPosition = new Cartesian3_default();
  49082. var scratchNextPosition = new Cartesian3_default();
  49083. PolylineGeometry.createGeometry = function(polylineGeometry) {
  49084. const width = polylineGeometry._width;
  49085. const vertexFormat = polylineGeometry._vertexFormat;
  49086. let colors = polylineGeometry._colors;
  49087. const colorsPerVertex = polylineGeometry._colorsPerVertex;
  49088. const arcType = polylineGeometry._arcType;
  49089. const granularity = polylineGeometry._granularity;
  49090. const ellipsoid = polylineGeometry._ellipsoid;
  49091. let i2;
  49092. let j;
  49093. let k;
  49094. const removedIndices = [];
  49095. let positions = arrayRemoveDuplicates_default(
  49096. polylineGeometry._positions,
  49097. Cartesian3_default.equalsEpsilon,
  49098. false,
  49099. removedIndices
  49100. );
  49101. if (defined_default(colors) && removedIndices.length > 0) {
  49102. let removedArrayIndex = 0;
  49103. let nextRemovedIndex = removedIndices[0];
  49104. colors = colors.filter(function(color, index3) {
  49105. let remove4 = false;
  49106. if (colorsPerVertex) {
  49107. remove4 = index3 === nextRemovedIndex || index3 === 0 && nextRemovedIndex === 1;
  49108. } else {
  49109. remove4 = index3 + 1 === nextRemovedIndex;
  49110. }
  49111. if (remove4) {
  49112. removedArrayIndex++;
  49113. nextRemovedIndex = removedIndices[removedArrayIndex];
  49114. return false;
  49115. }
  49116. return true;
  49117. });
  49118. }
  49119. let positionsLength = positions.length;
  49120. if (positionsLength < 2 || width <= 0) {
  49121. return void 0;
  49122. }
  49123. if (arcType === ArcType_default.GEODESIC || arcType === ArcType_default.RHUMB) {
  49124. let subdivisionSize;
  49125. let numberOfPointsFunction;
  49126. if (arcType === ArcType_default.GEODESIC) {
  49127. subdivisionSize = Math_default.chordLength(
  49128. granularity,
  49129. ellipsoid.maximumRadius
  49130. );
  49131. numberOfPointsFunction = PolylinePipeline_default.numberOfPoints;
  49132. } else {
  49133. subdivisionSize = granularity;
  49134. numberOfPointsFunction = PolylinePipeline_default.numberOfPointsRhumbLine;
  49135. }
  49136. const heights = PolylinePipeline_default.extractHeights(positions, ellipsoid);
  49137. if (defined_default(colors)) {
  49138. let colorLength = 1;
  49139. for (i2 = 0; i2 < positionsLength - 1; ++i2) {
  49140. colorLength += numberOfPointsFunction(
  49141. positions[i2],
  49142. positions[i2 + 1],
  49143. subdivisionSize
  49144. );
  49145. }
  49146. const newColors = new Array(colorLength);
  49147. let newColorIndex = 0;
  49148. for (i2 = 0; i2 < positionsLength - 1; ++i2) {
  49149. const p0 = positions[i2];
  49150. const p1 = positions[i2 + 1];
  49151. const c0 = colors[i2];
  49152. const numColors = numberOfPointsFunction(p0, p1, subdivisionSize);
  49153. if (colorsPerVertex && i2 < colorLength) {
  49154. const c14 = colors[i2 + 1];
  49155. const interpolatedColors = interpolateColors(
  49156. p0,
  49157. p1,
  49158. c0,
  49159. c14,
  49160. numColors
  49161. );
  49162. const interpolatedColorsLength = interpolatedColors.length;
  49163. for (j = 0; j < interpolatedColorsLength; ++j) {
  49164. newColors[newColorIndex++] = interpolatedColors[j];
  49165. }
  49166. } else {
  49167. for (j = 0; j < numColors; ++j) {
  49168. newColors[newColorIndex++] = Color_default.clone(c0);
  49169. }
  49170. }
  49171. }
  49172. newColors[newColorIndex] = Color_default.clone(colors[colors.length - 1]);
  49173. colors = newColors;
  49174. scratchInterpolateColorsArray.length = 0;
  49175. }
  49176. if (arcType === ArcType_default.GEODESIC) {
  49177. positions = PolylinePipeline_default.generateCartesianArc({
  49178. positions,
  49179. minDistance: subdivisionSize,
  49180. ellipsoid,
  49181. height: heights
  49182. });
  49183. } else {
  49184. positions = PolylinePipeline_default.generateCartesianRhumbArc({
  49185. positions,
  49186. granularity: subdivisionSize,
  49187. ellipsoid,
  49188. height: heights
  49189. });
  49190. }
  49191. }
  49192. positionsLength = positions.length;
  49193. const size = positionsLength * 4 - 4;
  49194. const finalPositions = new Float64Array(size * 3);
  49195. const prevPositions = new Float64Array(size * 3);
  49196. const nextPositions = new Float64Array(size * 3);
  49197. const expandAndWidth = new Float32Array(size * 2);
  49198. const st = vertexFormat.st ? new Float32Array(size * 2) : void 0;
  49199. const finalColors = defined_default(colors) ? new Uint8Array(size * 4) : void 0;
  49200. let positionIndex = 0;
  49201. let expandAndWidthIndex = 0;
  49202. let stIndex = 0;
  49203. let colorIndex = 0;
  49204. let position;
  49205. for (j = 0; j < positionsLength; ++j) {
  49206. if (j === 0) {
  49207. position = scratchCartesian39;
  49208. Cartesian3_default.subtract(positions[0], positions[1], position);
  49209. Cartesian3_default.add(positions[0], position, position);
  49210. } else {
  49211. position = positions[j - 1];
  49212. }
  49213. Cartesian3_default.clone(position, scratchPrevPosition);
  49214. Cartesian3_default.clone(positions[j], scratchPosition5);
  49215. if (j === positionsLength - 1) {
  49216. position = scratchCartesian39;
  49217. Cartesian3_default.subtract(
  49218. positions[positionsLength - 1],
  49219. positions[positionsLength - 2],
  49220. position
  49221. );
  49222. Cartesian3_default.add(positions[positionsLength - 1], position, position);
  49223. } else {
  49224. position = positions[j + 1];
  49225. }
  49226. Cartesian3_default.clone(position, scratchNextPosition);
  49227. let color0, color1;
  49228. if (defined_default(finalColors)) {
  49229. if (j !== 0 && !colorsPerVertex) {
  49230. color0 = colors[j - 1];
  49231. } else {
  49232. color0 = colors[j];
  49233. }
  49234. if (j !== positionsLength - 1) {
  49235. color1 = colors[j];
  49236. }
  49237. }
  49238. const startK = j === 0 ? 2 : 0;
  49239. const endK = j === positionsLength - 1 ? 2 : 4;
  49240. for (k = startK; k < endK; ++k) {
  49241. Cartesian3_default.pack(scratchPosition5, finalPositions, positionIndex);
  49242. Cartesian3_default.pack(scratchPrevPosition, prevPositions, positionIndex);
  49243. Cartesian3_default.pack(scratchNextPosition, nextPositions, positionIndex);
  49244. positionIndex += 3;
  49245. const direction2 = k - 2 < 0 ? -1 : 1;
  49246. expandAndWidth[expandAndWidthIndex++] = 2 * (k % 2) - 1;
  49247. expandAndWidth[expandAndWidthIndex++] = direction2 * width;
  49248. if (vertexFormat.st) {
  49249. st[stIndex++] = j / (positionsLength - 1);
  49250. st[stIndex++] = Math.max(expandAndWidth[expandAndWidthIndex - 2], 0);
  49251. }
  49252. if (defined_default(finalColors)) {
  49253. const color = k < 2 ? color0 : color1;
  49254. finalColors[colorIndex++] = Color_default.floatToByte(color.red);
  49255. finalColors[colorIndex++] = Color_default.floatToByte(color.green);
  49256. finalColors[colorIndex++] = Color_default.floatToByte(color.blue);
  49257. finalColors[colorIndex++] = Color_default.floatToByte(color.alpha);
  49258. }
  49259. }
  49260. }
  49261. const attributes = new GeometryAttributes_default();
  49262. attributes.position = new GeometryAttribute_default({
  49263. componentDatatype: ComponentDatatype_default.DOUBLE,
  49264. componentsPerAttribute: 3,
  49265. values: finalPositions
  49266. });
  49267. attributes.prevPosition = new GeometryAttribute_default({
  49268. componentDatatype: ComponentDatatype_default.DOUBLE,
  49269. componentsPerAttribute: 3,
  49270. values: prevPositions
  49271. });
  49272. attributes.nextPosition = new GeometryAttribute_default({
  49273. componentDatatype: ComponentDatatype_default.DOUBLE,
  49274. componentsPerAttribute: 3,
  49275. values: nextPositions
  49276. });
  49277. attributes.expandAndWidth = new GeometryAttribute_default({
  49278. componentDatatype: ComponentDatatype_default.FLOAT,
  49279. componentsPerAttribute: 2,
  49280. values: expandAndWidth
  49281. });
  49282. if (vertexFormat.st) {
  49283. attributes.st = new GeometryAttribute_default({
  49284. componentDatatype: ComponentDatatype_default.FLOAT,
  49285. componentsPerAttribute: 2,
  49286. values: st
  49287. });
  49288. }
  49289. if (defined_default(finalColors)) {
  49290. attributes.color = new GeometryAttribute_default({
  49291. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  49292. componentsPerAttribute: 4,
  49293. values: finalColors,
  49294. normalize: true
  49295. });
  49296. }
  49297. const indices2 = IndexDatatype_default.createTypedArray(size, positionsLength * 6 - 6);
  49298. let index2 = 0;
  49299. let indicesIndex = 0;
  49300. const length3 = positionsLength - 1;
  49301. for (j = 0; j < length3; ++j) {
  49302. indices2[indicesIndex++] = index2;
  49303. indices2[indicesIndex++] = index2 + 2;
  49304. indices2[indicesIndex++] = index2 + 1;
  49305. indices2[indicesIndex++] = index2 + 1;
  49306. indices2[indicesIndex++] = index2 + 2;
  49307. indices2[indicesIndex++] = index2 + 3;
  49308. index2 += 4;
  49309. }
  49310. return new Geometry_default({
  49311. attributes,
  49312. indices: indices2,
  49313. primitiveType: PrimitiveType_default.TRIANGLES,
  49314. boundingSphere: BoundingSphere_default.fromPoints(positions),
  49315. geometryType: GeometryType_default.POLYLINES
  49316. });
  49317. };
  49318. var PolylineGeometry_default = PolylineGeometry;
  49319. // node_modules/cesium/Source/Core/PolylineVolumeGeometry.js
  49320. function computeAttributes2(combinedPositions, shape, boundingRectangle, vertexFormat) {
  49321. const attributes = new GeometryAttributes_default();
  49322. if (vertexFormat.position) {
  49323. attributes.position = new GeometryAttribute_default({
  49324. componentDatatype: ComponentDatatype_default.DOUBLE,
  49325. componentsPerAttribute: 3,
  49326. values: combinedPositions
  49327. });
  49328. }
  49329. const shapeLength = shape.length;
  49330. const vertexCount = combinedPositions.length / 3;
  49331. const length3 = (vertexCount - shapeLength * 2) / (shapeLength * 2);
  49332. const firstEndIndices = PolygonPipeline_default.triangulate(shape);
  49333. const indicesCount = (length3 - 1) * shapeLength * 6 + firstEndIndices.length * 2;
  49334. const indices2 = IndexDatatype_default.createTypedArray(vertexCount, indicesCount);
  49335. let i2, j;
  49336. let ll, ul, ur, lr;
  49337. const offset2 = shapeLength * 2;
  49338. let index2 = 0;
  49339. for (i2 = 0; i2 < length3 - 1; i2++) {
  49340. for (j = 0; j < shapeLength - 1; j++) {
  49341. ll = j * 2 + i2 * shapeLength * 2;
  49342. lr = ll + offset2;
  49343. ul = ll + 1;
  49344. ur = ul + offset2;
  49345. indices2[index2++] = ul;
  49346. indices2[index2++] = ll;
  49347. indices2[index2++] = ur;
  49348. indices2[index2++] = ur;
  49349. indices2[index2++] = ll;
  49350. indices2[index2++] = lr;
  49351. }
  49352. ll = shapeLength * 2 - 2 + i2 * shapeLength * 2;
  49353. ul = ll + 1;
  49354. ur = ul + offset2;
  49355. lr = ll + offset2;
  49356. indices2[index2++] = ul;
  49357. indices2[index2++] = ll;
  49358. indices2[index2++] = ur;
  49359. indices2[index2++] = ur;
  49360. indices2[index2++] = ll;
  49361. indices2[index2++] = lr;
  49362. }
  49363. if (vertexFormat.st || vertexFormat.tangent || vertexFormat.bitangent) {
  49364. const st = new Float32Array(vertexCount * 2);
  49365. const lengthSt = 1 / (length3 - 1);
  49366. const heightSt = 1 / boundingRectangle.height;
  49367. const heightOffset = boundingRectangle.height / 2;
  49368. let s2, t;
  49369. let stindex = 0;
  49370. for (i2 = 0; i2 < length3; i2++) {
  49371. s2 = i2 * lengthSt;
  49372. t = heightSt * (shape[0].y + heightOffset);
  49373. st[stindex++] = s2;
  49374. st[stindex++] = t;
  49375. for (j = 1; j < shapeLength; j++) {
  49376. t = heightSt * (shape[j].y + heightOffset);
  49377. st[stindex++] = s2;
  49378. st[stindex++] = t;
  49379. st[stindex++] = s2;
  49380. st[stindex++] = t;
  49381. }
  49382. t = heightSt * (shape[0].y + heightOffset);
  49383. st[stindex++] = s2;
  49384. st[stindex++] = t;
  49385. }
  49386. for (j = 0; j < shapeLength; j++) {
  49387. s2 = 0;
  49388. t = heightSt * (shape[j].y + heightOffset);
  49389. st[stindex++] = s2;
  49390. st[stindex++] = t;
  49391. }
  49392. for (j = 0; j < shapeLength; j++) {
  49393. s2 = (length3 - 1) * lengthSt;
  49394. t = heightSt * (shape[j].y + heightOffset);
  49395. st[stindex++] = s2;
  49396. st[stindex++] = t;
  49397. }
  49398. attributes.st = new GeometryAttribute_default({
  49399. componentDatatype: ComponentDatatype_default.FLOAT,
  49400. componentsPerAttribute: 2,
  49401. values: new Float32Array(st)
  49402. });
  49403. }
  49404. const endOffset = vertexCount - shapeLength * 2;
  49405. for (i2 = 0; i2 < firstEndIndices.length; i2 += 3) {
  49406. const v02 = firstEndIndices[i2] + endOffset;
  49407. const v13 = firstEndIndices[i2 + 1] + endOffset;
  49408. const v23 = firstEndIndices[i2 + 2] + endOffset;
  49409. indices2[index2++] = v02;
  49410. indices2[index2++] = v13;
  49411. indices2[index2++] = v23;
  49412. indices2[index2++] = v23 + shapeLength;
  49413. indices2[index2++] = v13 + shapeLength;
  49414. indices2[index2++] = v02 + shapeLength;
  49415. }
  49416. let geometry = new Geometry_default({
  49417. attributes,
  49418. indices: indices2,
  49419. boundingSphere: BoundingSphere_default.fromVertices(combinedPositions),
  49420. primitiveType: PrimitiveType_default.TRIANGLES
  49421. });
  49422. if (vertexFormat.normal) {
  49423. geometry = GeometryPipeline_default.computeNormal(geometry);
  49424. }
  49425. if (vertexFormat.tangent || vertexFormat.bitangent) {
  49426. try {
  49427. geometry = GeometryPipeline_default.computeTangentAndBitangent(geometry);
  49428. } catch (e2) {
  49429. oneTimeWarning_default(
  49430. "polyline-volume-tangent-bitangent",
  49431. "Unable to compute tangents and bitangents for polyline volume geometry"
  49432. );
  49433. }
  49434. if (!vertexFormat.tangent) {
  49435. geometry.attributes.tangent = void 0;
  49436. }
  49437. if (!vertexFormat.bitangent) {
  49438. geometry.attributes.bitangent = void 0;
  49439. }
  49440. if (!vertexFormat.st) {
  49441. geometry.attributes.st = void 0;
  49442. }
  49443. }
  49444. return geometry;
  49445. }
  49446. function PolylineVolumeGeometry(options) {
  49447. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  49448. const positions = options.polylinePositions;
  49449. const shape = options.shapePositions;
  49450. if (!defined_default(positions)) {
  49451. throw new DeveloperError_default("options.polylinePositions is required.");
  49452. }
  49453. if (!defined_default(shape)) {
  49454. throw new DeveloperError_default("options.shapePositions is required.");
  49455. }
  49456. this._positions = positions;
  49457. this._shape = shape;
  49458. this._ellipsoid = Ellipsoid_default.clone(
  49459. defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84)
  49460. );
  49461. this._cornerType = defaultValue_default(options.cornerType, CornerType_default.ROUNDED);
  49462. this._vertexFormat = VertexFormat_default.clone(
  49463. defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT)
  49464. );
  49465. this._granularity = defaultValue_default(
  49466. options.granularity,
  49467. Math_default.RADIANS_PER_DEGREE
  49468. );
  49469. this._workerName = "createPolylineVolumeGeometry";
  49470. let numComponents = 1 + positions.length * Cartesian3_default.packedLength;
  49471. numComponents += 1 + shape.length * Cartesian2_default.packedLength;
  49472. this.packedLength = numComponents + Ellipsoid_default.packedLength + VertexFormat_default.packedLength + 2;
  49473. }
  49474. PolylineVolumeGeometry.pack = function(value, array, startingIndex) {
  49475. if (!defined_default(value)) {
  49476. throw new DeveloperError_default("value is required");
  49477. }
  49478. if (!defined_default(array)) {
  49479. throw new DeveloperError_default("array is required");
  49480. }
  49481. startingIndex = defaultValue_default(startingIndex, 0);
  49482. let i2;
  49483. const positions = value._positions;
  49484. let length3 = positions.length;
  49485. array[startingIndex++] = length3;
  49486. for (i2 = 0; i2 < length3; ++i2, startingIndex += Cartesian3_default.packedLength) {
  49487. Cartesian3_default.pack(positions[i2], array, startingIndex);
  49488. }
  49489. const shape = value._shape;
  49490. length3 = shape.length;
  49491. array[startingIndex++] = length3;
  49492. for (i2 = 0; i2 < length3; ++i2, startingIndex += Cartesian2_default.packedLength) {
  49493. Cartesian2_default.pack(shape[i2], array, startingIndex);
  49494. }
  49495. Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
  49496. startingIndex += Ellipsoid_default.packedLength;
  49497. VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
  49498. startingIndex += VertexFormat_default.packedLength;
  49499. array[startingIndex++] = value._cornerType;
  49500. array[startingIndex] = value._granularity;
  49501. return array;
  49502. };
  49503. var scratchEllipsoid9 = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
  49504. var scratchVertexFormat11 = new VertexFormat_default();
  49505. var scratchOptions17 = {
  49506. polylinePositions: void 0,
  49507. shapePositions: void 0,
  49508. ellipsoid: scratchEllipsoid9,
  49509. vertexFormat: scratchVertexFormat11,
  49510. cornerType: void 0,
  49511. granularity: void 0
  49512. };
  49513. PolylineVolumeGeometry.unpack = function(array, startingIndex, result) {
  49514. if (!defined_default(array)) {
  49515. throw new DeveloperError_default("array is required");
  49516. }
  49517. startingIndex = defaultValue_default(startingIndex, 0);
  49518. let i2;
  49519. let length3 = array[startingIndex++];
  49520. const positions = new Array(length3);
  49521. for (i2 = 0; i2 < length3; ++i2, startingIndex += Cartesian3_default.packedLength) {
  49522. positions[i2] = Cartesian3_default.unpack(array, startingIndex);
  49523. }
  49524. length3 = array[startingIndex++];
  49525. const shape = new Array(length3);
  49526. for (i2 = 0; i2 < length3; ++i2, startingIndex += Cartesian2_default.packedLength) {
  49527. shape[i2] = Cartesian2_default.unpack(array, startingIndex);
  49528. }
  49529. const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid9);
  49530. startingIndex += Ellipsoid_default.packedLength;
  49531. const vertexFormat = VertexFormat_default.unpack(
  49532. array,
  49533. startingIndex,
  49534. scratchVertexFormat11
  49535. );
  49536. startingIndex += VertexFormat_default.packedLength;
  49537. const cornerType = array[startingIndex++];
  49538. const granularity = array[startingIndex];
  49539. if (!defined_default(result)) {
  49540. scratchOptions17.polylinePositions = positions;
  49541. scratchOptions17.shapePositions = shape;
  49542. scratchOptions17.cornerType = cornerType;
  49543. scratchOptions17.granularity = granularity;
  49544. return new PolylineVolumeGeometry(scratchOptions17);
  49545. }
  49546. result._positions = positions;
  49547. result._shape = shape;
  49548. result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
  49549. result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
  49550. result._cornerType = cornerType;
  49551. result._granularity = granularity;
  49552. return result;
  49553. };
  49554. var brScratch = new BoundingRectangle_default();
  49555. PolylineVolumeGeometry.createGeometry = function(polylineVolumeGeometry) {
  49556. const positions = polylineVolumeGeometry._positions;
  49557. const cleanPositions = arrayRemoveDuplicates_default(
  49558. positions,
  49559. Cartesian3_default.equalsEpsilon
  49560. );
  49561. let shape2D = polylineVolumeGeometry._shape;
  49562. shape2D = PolylineVolumeGeometryLibrary_default.removeDuplicatesFromShape(shape2D);
  49563. if (cleanPositions.length < 2 || shape2D.length < 3) {
  49564. return void 0;
  49565. }
  49566. if (PolygonPipeline_default.computeWindingOrder2D(shape2D) === WindingOrder_default.CLOCKWISE) {
  49567. shape2D.reverse();
  49568. }
  49569. const boundingRectangle = BoundingRectangle_default.fromPoints(shape2D, brScratch);
  49570. const computedPositions = PolylineVolumeGeometryLibrary_default.computePositions(
  49571. cleanPositions,
  49572. shape2D,
  49573. boundingRectangle,
  49574. polylineVolumeGeometry,
  49575. true
  49576. );
  49577. return computeAttributes2(
  49578. computedPositions,
  49579. shape2D,
  49580. boundingRectangle,
  49581. polylineVolumeGeometry._vertexFormat
  49582. );
  49583. };
  49584. var PolylineVolumeGeometry_default = PolylineVolumeGeometry;
  49585. // node_modules/cesium/Source/Core/PolylineVolumeOutlineGeometry.js
  49586. function computeAttributes3(positions, shape) {
  49587. const attributes = new GeometryAttributes_default();
  49588. attributes.position = new GeometryAttribute_default({
  49589. componentDatatype: ComponentDatatype_default.DOUBLE,
  49590. componentsPerAttribute: 3,
  49591. values: positions
  49592. });
  49593. const shapeLength = shape.length;
  49594. const vertexCount = attributes.position.values.length / 3;
  49595. const positionLength = positions.length / 3;
  49596. const shapeCount = positionLength / shapeLength;
  49597. const indices2 = IndexDatatype_default.createTypedArray(
  49598. vertexCount,
  49599. 2 * shapeLength * (shapeCount + 1)
  49600. );
  49601. let i2, j;
  49602. let index2 = 0;
  49603. i2 = 0;
  49604. let offset2 = i2 * shapeLength;
  49605. for (j = 0; j < shapeLength - 1; j++) {
  49606. indices2[index2++] = j + offset2;
  49607. indices2[index2++] = j + offset2 + 1;
  49608. }
  49609. indices2[index2++] = shapeLength - 1 + offset2;
  49610. indices2[index2++] = offset2;
  49611. i2 = shapeCount - 1;
  49612. offset2 = i2 * shapeLength;
  49613. for (j = 0; j < shapeLength - 1; j++) {
  49614. indices2[index2++] = j + offset2;
  49615. indices2[index2++] = j + offset2 + 1;
  49616. }
  49617. indices2[index2++] = shapeLength - 1 + offset2;
  49618. indices2[index2++] = offset2;
  49619. for (i2 = 0; i2 < shapeCount - 1; i2++) {
  49620. const firstOffset = shapeLength * i2;
  49621. const secondOffset = firstOffset + shapeLength;
  49622. for (j = 0; j < shapeLength; j++) {
  49623. indices2[index2++] = j + firstOffset;
  49624. indices2[index2++] = j + secondOffset;
  49625. }
  49626. }
  49627. const geometry = new Geometry_default({
  49628. attributes,
  49629. indices: IndexDatatype_default.createTypedArray(vertexCount, indices2),
  49630. boundingSphere: BoundingSphere_default.fromVertices(positions),
  49631. primitiveType: PrimitiveType_default.LINES
  49632. });
  49633. return geometry;
  49634. }
  49635. function PolylineVolumeOutlineGeometry(options) {
  49636. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  49637. const positions = options.polylinePositions;
  49638. const shape = options.shapePositions;
  49639. if (!defined_default(positions)) {
  49640. throw new DeveloperError_default("options.polylinePositions is required.");
  49641. }
  49642. if (!defined_default(shape)) {
  49643. throw new DeveloperError_default("options.shapePositions is required.");
  49644. }
  49645. this._positions = positions;
  49646. this._shape = shape;
  49647. this._ellipsoid = Ellipsoid_default.clone(
  49648. defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84)
  49649. );
  49650. this._cornerType = defaultValue_default(options.cornerType, CornerType_default.ROUNDED);
  49651. this._granularity = defaultValue_default(
  49652. options.granularity,
  49653. Math_default.RADIANS_PER_DEGREE
  49654. );
  49655. this._workerName = "createPolylineVolumeOutlineGeometry";
  49656. let numComponents = 1 + positions.length * Cartesian3_default.packedLength;
  49657. numComponents += 1 + shape.length * Cartesian2_default.packedLength;
  49658. this.packedLength = numComponents + Ellipsoid_default.packedLength + 2;
  49659. }
  49660. PolylineVolumeOutlineGeometry.pack = function(value, array, startingIndex) {
  49661. if (!defined_default(value)) {
  49662. throw new DeveloperError_default("value is required");
  49663. }
  49664. if (!defined_default(array)) {
  49665. throw new DeveloperError_default("array is required");
  49666. }
  49667. startingIndex = defaultValue_default(startingIndex, 0);
  49668. let i2;
  49669. const positions = value._positions;
  49670. let length3 = positions.length;
  49671. array[startingIndex++] = length3;
  49672. for (i2 = 0; i2 < length3; ++i2, startingIndex += Cartesian3_default.packedLength) {
  49673. Cartesian3_default.pack(positions[i2], array, startingIndex);
  49674. }
  49675. const shape = value._shape;
  49676. length3 = shape.length;
  49677. array[startingIndex++] = length3;
  49678. for (i2 = 0; i2 < length3; ++i2, startingIndex += Cartesian2_default.packedLength) {
  49679. Cartesian2_default.pack(shape[i2], array, startingIndex);
  49680. }
  49681. Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
  49682. startingIndex += Ellipsoid_default.packedLength;
  49683. array[startingIndex++] = value._cornerType;
  49684. array[startingIndex] = value._granularity;
  49685. return array;
  49686. };
  49687. var scratchEllipsoid10 = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
  49688. var scratchOptions18 = {
  49689. polylinePositions: void 0,
  49690. shapePositions: void 0,
  49691. ellipsoid: scratchEllipsoid10,
  49692. height: void 0,
  49693. cornerType: void 0,
  49694. granularity: void 0
  49695. };
  49696. PolylineVolumeOutlineGeometry.unpack = function(array, startingIndex, result) {
  49697. if (!defined_default(array)) {
  49698. throw new DeveloperError_default("array is required");
  49699. }
  49700. startingIndex = defaultValue_default(startingIndex, 0);
  49701. let i2;
  49702. let length3 = array[startingIndex++];
  49703. const positions = new Array(length3);
  49704. for (i2 = 0; i2 < length3; ++i2, startingIndex += Cartesian3_default.packedLength) {
  49705. positions[i2] = Cartesian3_default.unpack(array, startingIndex);
  49706. }
  49707. length3 = array[startingIndex++];
  49708. const shape = new Array(length3);
  49709. for (i2 = 0; i2 < length3; ++i2, startingIndex += Cartesian2_default.packedLength) {
  49710. shape[i2] = Cartesian2_default.unpack(array, startingIndex);
  49711. }
  49712. const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid10);
  49713. startingIndex += Ellipsoid_default.packedLength;
  49714. const cornerType = array[startingIndex++];
  49715. const granularity = array[startingIndex];
  49716. if (!defined_default(result)) {
  49717. scratchOptions18.polylinePositions = positions;
  49718. scratchOptions18.shapePositions = shape;
  49719. scratchOptions18.cornerType = cornerType;
  49720. scratchOptions18.granularity = granularity;
  49721. return new PolylineVolumeOutlineGeometry(scratchOptions18);
  49722. }
  49723. result._positions = positions;
  49724. result._shape = shape;
  49725. result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
  49726. result._cornerType = cornerType;
  49727. result._granularity = granularity;
  49728. return result;
  49729. };
  49730. var brScratch2 = new BoundingRectangle_default();
  49731. PolylineVolumeOutlineGeometry.createGeometry = function(polylineVolumeOutlineGeometry) {
  49732. const positions = polylineVolumeOutlineGeometry._positions;
  49733. const cleanPositions = arrayRemoveDuplicates_default(
  49734. positions,
  49735. Cartesian3_default.equalsEpsilon
  49736. );
  49737. let shape2D = polylineVolumeOutlineGeometry._shape;
  49738. shape2D = PolylineVolumeGeometryLibrary_default.removeDuplicatesFromShape(shape2D);
  49739. if (cleanPositions.length < 2 || shape2D.length < 3) {
  49740. return void 0;
  49741. }
  49742. if (PolygonPipeline_default.computeWindingOrder2D(shape2D) === WindingOrder_default.CLOCKWISE) {
  49743. shape2D.reverse();
  49744. }
  49745. const boundingRectangle = BoundingRectangle_default.fromPoints(shape2D, brScratch2);
  49746. const computedPositions = PolylineVolumeGeometryLibrary_default.computePositions(
  49747. cleanPositions,
  49748. shape2D,
  49749. boundingRectangle,
  49750. polylineVolumeOutlineGeometry,
  49751. false
  49752. );
  49753. return computeAttributes3(computedPositions, shape2D);
  49754. };
  49755. var PolylineVolumeOutlineGeometry_default = PolylineVolumeOutlineGeometry;
  49756. // node_modules/cesium/Source/Core/Proxy.js
  49757. function Proxy2() {
  49758. DeveloperError_default.throwInstantiationError();
  49759. }
  49760. Proxy2.prototype.getURL = DeveloperError_default.throwInstantiationError;
  49761. var Proxy_default = Proxy2;
  49762. // node_modules/cesium/Source/Core/QuaternionSpline.js
  49763. function createEvaluateFunction2(spline) {
  49764. const points = spline.points;
  49765. const times = spline.times;
  49766. return function(time, result) {
  49767. if (!defined_default(result)) {
  49768. result = new Quaternion_default();
  49769. }
  49770. const i2 = spline._lastTimeIndex = spline.findTimeInterval(
  49771. time,
  49772. spline._lastTimeIndex
  49773. );
  49774. const u3 = (time - times[i2]) / (times[i2 + 1] - times[i2]);
  49775. const q0 = points[i2];
  49776. const q12 = points[i2 + 1];
  49777. return Quaternion_default.fastSlerp(q0, q12, u3, result);
  49778. };
  49779. }
  49780. function QuaternionSpline(options) {
  49781. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  49782. const points = options.points;
  49783. const times = options.times;
  49784. if (!defined_default(points) || !defined_default(times)) {
  49785. throw new DeveloperError_default("points and times are required.");
  49786. }
  49787. if (points.length < 2) {
  49788. throw new DeveloperError_default(
  49789. "points.length must be greater than or equal to 2."
  49790. );
  49791. }
  49792. if (times.length !== points.length) {
  49793. throw new DeveloperError_default("times.length must be equal to points.length.");
  49794. }
  49795. this._times = times;
  49796. this._points = points;
  49797. this._evaluateFunction = createEvaluateFunction2(this);
  49798. this._lastTimeIndex = 0;
  49799. }
  49800. Object.defineProperties(QuaternionSpline.prototype, {
  49801. times: {
  49802. get: function() {
  49803. return this._times;
  49804. }
  49805. },
  49806. points: {
  49807. get: function() {
  49808. return this._points;
  49809. }
  49810. }
  49811. });
  49812. QuaternionSpline.prototype.findTimeInterval = Spline_default.prototype.findTimeInterval;
  49813. QuaternionSpline.prototype.wrapTime = Spline_default.prototype.wrapTime;
  49814. QuaternionSpline.prototype.clampTime = Spline_default.prototype.clampTime;
  49815. QuaternionSpline.prototype.evaluate = function(time, result) {
  49816. return this._evaluateFunction(time, result);
  49817. };
  49818. var QuaternionSpline_default = QuaternionSpline;
  49819. // node_modules/cesium/Source/ThirdParty/rbush.js
  49820. function quickselect(arr, k, left, right, compare) {
  49821. quickselectStep(arr, k, left || 0, right || arr.length - 1, compare || defaultCompare);
  49822. }
  49823. function quickselectStep(arr, k, left, right, compare) {
  49824. while (right > left) {
  49825. if (right - left > 600) {
  49826. var n2 = right - left + 1;
  49827. var m = k - left + 1;
  49828. var z = Math.log(n2);
  49829. var s2 = 0.5 * Math.exp(2 * z / 3);
  49830. var sd = 0.5 * Math.sqrt(z * s2 * (n2 - s2) / n2) * (m - n2 / 2 < 0 ? -1 : 1);
  49831. var newLeft = Math.max(left, Math.floor(k - m * s2 / n2 + sd));
  49832. var newRight = Math.min(right, Math.floor(k + (n2 - m) * s2 / n2 + sd));
  49833. quickselectStep(arr, k, newLeft, newRight, compare);
  49834. }
  49835. var t = arr[k];
  49836. var i2 = left;
  49837. var j = right;
  49838. swap3(arr, left, k);
  49839. if (compare(arr[right], t) > 0)
  49840. swap3(arr, left, right);
  49841. while (i2 < j) {
  49842. swap3(arr, i2, j);
  49843. i2++;
  49844. j--;
  49845. while (compare(arr[i2], t) < 0)
  49846. i2++;
  49847. while (compare(arr[j], t) > 0)
  49848. j--;
  49849. }
  49850. if (compare(arr[left], t) === 0)
  49851. swap3(arr, left, j);
  49852. else {
  49853. j++;
  49854. swap3(arr, j, right);
  49855. }
  49856. if (j <= k)
  49857. left = j + 1;
  49858. if (k <= j)
  49859. right = j - 1;
  49860. }
  49861. }
  49862. function swap3(arr, i2, j) {
  49863. var tmp2 = arr[i2];
  49864. arr[i2] = arr[j];
  49865. arr[j] = tmp2;
  49866. }
  49867. function defaultCompare(a4, b) {
  49868. return a4 < b ? -1 : a4 > b ? 1 : 0;
  49869. }
  49870. var RBush = class {
  49871. constructor(maxEntries = 9) {
  49872. this._maxEntries = Math.max(4, maxEntries);
  49873. this._minEntries = Math.max(2, Math.ceil(this._maxEntries * 0.4));
  49874. this.clear();
  49875. }
  49876. all() {
  49877. return this._all(this.data, []);
  49878. }
  49879. search(bbox2) {
  49880. let node = this.data;
  49881. const result = [];
  49882. if (!intersects2(bbox2, node))
  49883. return result;
  49884. const toBBox = this.toBBox;
  49885. const nodesToSearch = [];
  49886. while (node) {
  49887. for (let i2 = 0; i2 < node.children.length; i2++) {
  49888. const child = node.children[i2];
  49889. const childBBox = node.leaf ? toBBox(child) : child;
  49890. if (intersects2(bbox2, childBBox)) {
  49891. if (node.leaf)
  49892. result.push(child);
  49893. else if (contains(bbox2, childBBox))
  49894. this._all(child, result);
  49895. else
  49896. nodesToSearch.push(child);
  49897. }
  49898. }
  49899. node = nodesToSearch.pop();
  49900. }
  49901. return result;
  49902. }
  49903. collides(bbox2) {
  49904. let node = this.data;
  49905. if (!intersects2(bbox2, node))
  49906. return false;
  49907. const nodesToSearch = [];
  49908. while (node) {
  49909. for (let i2 = 0; i2 < node.children.length; i2++) {
  49910. const child = node.children[i2];
  49911. const childBBox = node.leaf ? this.toBBox(child) : child;
  49912. if (intersects2(bbox2, childBBox)) {
  49913. if (node.leaf || contains(bbox2, childBBox))
  49914. return true;
  49915. nodesToSearch.push(child);
  49916. }
  49917. }
  49918. node = nodesToSearch.pop();
  49919. }
  49920. return false;
  49921. }
  49922. load(data) {
  49923. if (!(data && data.length))
  49924. return this;
  49925. if (data.length < this._minEntries) {
  49926. for (let i2 = 0; i2 < data.length; i2++) {
  49927. this.insert(data[i2]);
  49928. }
  49929. return this;
  49930. }
  49931. let node = this._build(data.slice(), 0, data.length - 1, 0);
  49932. if (!this.data.children.length) {
  49933. this.data = node;
  49934. } else if (this.data.height === node.height) {
  49935. this._splitRoot(this.data, node);
  49936. } else {
  49937. if (this.data.height < node.height) {
  49938. const tmpNode = this.data;
  49939. this.data = node;
  49940. node = tmpNode;
  49941. }
  49942. this._insert(node, this.data.height - node.height - 1, true);
  49943. }
  49944. return this;
  49945. }
  49946. insert(item) {
  49947. if (item)
  49948. this._insert(item, this.data.height - 1);
  49949. return this;
  49950. }
  49951. clear() {
  49952. this.data = createNode([]);
  49953. return this;
  49954. }
  49955. remove(item, equalsFn) {
  49956. if (!item)
  49957. return this;
  49958. let node = this.data;
  49959. const bbox2 = this.toBBox(item);
  49960. const path = [];
  49961. const indexes = [];
  49962. let i2, parent, goingUp;
  49963. while (node || path.length) {
  49964. if (!node) {
  49965. node = path.pop();
  49966. parent = path[path.length - 1];
  49967. i2 = indexes.pop();
  49968. goingUp = true;
  49969. }
  49970. if (node.leaf) {
  49971. const index2 = findItem(item, node.children, equalsFn);
  49972. if (index2 !== -1) {
  49973. node.children.splice(index2, 1);
  49974. path.push(node);
  49975. this._condense(path);
  49976. return this;
  49977. }
  49978. }
  49979. if (!goingUp && !node.leaf && contains(node, bbox2)) {
  49980. path.push(node);
  49981. indexes.push(i2);
  49982. i2 = 0;
  49983. parent = node;
  49984. node = node.children[0];
  49985. } else if (parent) {
  49986. i2++;
  49987. node = parent.children[i2];
  49988. goingUp = false;
  49989. } else
  49990. node = null;
  49991. }
  49992. return this;
  49993. }
  49994. toBBox(item) {
  49995. return item;
  49996. }
  49997. compareMinX(a4, b) {
  49998. return a4.minX - b.minX;
  49999. }
  50000. compareMinY(a4, b) {
  50001. return a4.minY - b.minY;
  50002. }
  50003. toJSON() {
  50004. return this.data;
  50005. }
  50006. fromJSON(data) {
  50007. this.data = data;
  50008. return this;
  50009. }
  50010. _all(node, result) {
  50011. const nodesToSearch = [];
  50012. while (node) {
  50013. if (node.leaf)
  50014. result.push(...node.children);
  50015. else
  50016. nodesToSearch.push(...node.children);
  50017. node = nodesToSearch.pop();
  50018. }
  50019. return result;
  50020. }
  50021. _build(items, left, right, height) {
  50022. const N = right - left + 1;
  50023. let M = this._maxEntries;
  50024. let node;
  50025. if (N <= M) {
  50026. node = createNode(items.slice(left, right + 1));
  50027. calcBBox(node, this.toBBox);
  50028. return node;
  50029. }
  50030. if (!height) {
  50031. height = Math.ceil(Math.log(N) / Math.log(M));
  50032. M = Math.ceil(N / Math.pow(M, height - 1));
  50033. }
  50034. node = createNode([]);
  50035. node.leaf = false;
  50036. node.height = height;
  50037. const N2 = Math.ceil(N / M);
  50038. const N1 = N2 * Math.ceil(Math.sqrt(M));
  50039. multiSelect(items, left, right, N1, this.compareMinX);
  50040. for (let i2 = left; i2 <= right; i2 += N1) {
  50041. const right2 = Math.min(i2 + N1 - 1, right);
  50042. multiSelect(items, i2, right2, N2, this.compareMinY);
  50043. for (let j = i2; j <= right2; j += N2) {
  50044. const right3 = Math.min(j + N2 - 1, right2);
  50045. node.children.push(this._build(items, j, right3, height - 1));
  50046. }
  50047. }
  50048. calcBBox(node, this.toBBox);
  50049. return node;
  50050. }
  50051. _chooseSubtree(bbox2, node, level, path) {
  50052. while (true) {
  50053. path.push(node);
  50054. if (node.leaf || path.length - 1 === level)
  50055. break;
  50056. let minArea = Infinity;
  50057. let minEnlargement = Infinity;
  50058. let targetNode;
  50059. for (let i2 = 0; i2 < node.children.length; i2++) {
  50060. const child = node.children[i2];
  50061. const area2 = bboxArea(child);
  50062. const enlargement = enlargedArea(bbox2, child) - area2;
  50063. if (enlargement < minEnlargement) {
  50064. minEnlargement = enlargement;
  50065. minArea = area2 < minArea ? area2 : minArea;
  50066. targetNode = child;
  50067. } else if (enlargement === minEnlargement) {
  50068. if (area2 < minArea) {
  50069. minArea = area2;
  50070. targetNode = child;
  50071. }
  50072. }
  50073. }
  50074. node = targetNode || node.children[0];
  50075. }
  50076. return node;
  50077. }
  50078. _insert(item, level, isNode) {
  50079. const bbox2 = isNode ? item : this.toBBox(item);
  50080. const insertPath = [];
  50081. const node = this._chooseSubtree(bbox2, this.data, level, insertPath);
  50082. node.children.push(item);
  50083. extend(node, bbox2);
  50084. while (level >= 0) {
  50085. if (insertPath[level].children.length > this._maxEntries) {
  50086. this._split(insertPath, level);
  50087. level--;
  50088. } else
  50089. break;
  50090. }
  50091. this._adjustParentBBoxes(bbox2, insertPath, level);
  50092. }
  50093. _split(insertPath, level) {
  50094. const node = insertPath[level];
  50095. const M = node.children.length;
  50096. const m = this._minEntries;
  50097. this._chooseSplitAxis(node, m, M);
  50098. const splitIndex = this._chooseSplitIndex(node, m, M);
  50099. const newNode = createNode(node.children.splice(splitIndex, node.children.length - splitIndex));
  50100. newNode.height = node.height;
  50101. newNode.leaf = node.leaf;
  50102. calcBBox(node, this.toBBox);
  50103. calcBBox(newNode, this.toBBox);
  50104. if (level)
  50105. insertPath[level - 1].children.push(newNode);
  50106. else
  50107. this._splitRoot(node, newNode);
  50108. }
  50109. _splitRoot(node, newNode) {
  50110. this.data = createNode([node, newNode]);
  50111. this.data.height = node.height + 1;
  50112. this.data.leaf = false;
  50113. calcBBox(this.data, this.toBBox);
  50114. }
  50115. _chooseSplitIndex(node, m, M) {
  50116. let index2;
  50117. let minOverlap = Infinity;
  50118. let minArea = Infinity;
  50119. for (let i2 = m; i2 <= M - m; i2++) {
  50120. const bbox1 = distBBox(node, 0, i2, this.toBBox);
  50121. const bbox2 = distBBox(node, i2, M, this.toBBox);
  50122. const overlap = intersectionArea(bbox1, bbox2);
  50123. const area2 = bboxArea(bbox1) + bboxArea(bbox2);
  50124. if (overlap < minOverlap) {
  50125. minOverlap = overlap;
  50126. index2 = i2;
  50127. minArea = area2 < minArea ? area2 : minArea;
  50128. } else if (overlap === minOverlap) {
  50129. if (area2 < minArea) {
  50130. minArea = area2;
  50131. index2 = i2;
  50132. }
  50133. }
  50134. }
  50135. return index2 || M - m;
  50136. }
  50137. _chooseSplitAxis(node, m, M) {
  50138. const compareMinX = node.leaf ? this.compareMinX : compareNodeMinX;
  50139. const compareMinY = node.leaf ? this.compareMinY : compareNodeMinY;
  50140. const xMargin = this._allDistMargin(node, m, M, compareMinX);
  50141. const yMargin = this._allDistMargin(node, m, M, compareMinY);
  50142. if (xMargin < yMargin)
  50143. node.children.sort(compareMinX);
  50144. }
  50145. _allDistMargin(node, m, M, compare) {
  50146. node.children.sort(compare);
  50147. const toBBox = this.toBBox;
  50148. const leftBBox = distBBox(node, 0, m, toBBox);
  50149. const rightBBox = distBBox(node, M - m, M, toBBox);
  50150. let margin = bboxMargin(leftBBox) + bboxMargin(rightBBox);
  50151. for (let i2 = m; i2 < M - m; i2++) {
  50152. const child = node.children[i2];
  50153. extend(leftBBox, node.leaf ? toBBox(child) : child);
  50154. margin += bboxMargin(leftBBox);
  50155. }
  50156. for (let i2 = M - m - 1; i2 >= m; i2--) {
  50157. const child = node.children[i2];
  50158. extend(rightBBox, node.leaf ? toBBox(child) : child);
  50159. margin += bboxMargin(rightBBox);
  50160. }
  50161. return margin;
  50162. }
  50163. _adjustParentBBoxes(bbox2, path, level) {
  50164. for (let i2 = level; i2 >= 0; i2--) {
  50165. extend(path[i2], bbox2);
  50166. }
  50167. }
  50168. _condense(path) {
  50169. for (let i2 = path.length - 1, siblings; i2 >= 0; i2--) {
  50170. if (path[i2].children.length === 0) {
  50171. if (i2 > 0) {
  50172. siblings = path[i2 - 1].children;
  50173. siblings.splice(siblings.indexOf(path[i2]), 1);
  50174. } else
  50175. this.clear();
  50176. } else
  50177. calcBBox(path[i2], this.toBBox);
  50178. }
  50179. }
  50180. };
  50181. function findItem(item, items, equalsFn) {
  50182. if (!equalsFn)
  50183. return items.indexOf(item);
  50184. for (let i2 = 0; i2 < items.length; i2++) {
  50185. if (equalsFn(item, items[i2]))
  50186. return i2;
  50187. }
  50188. return -1;
  50189. }
  50190. function calcBBox(node, toBBox) {
  50191. distBBox(node, 0, node.children.length, toBBox, node);
  50192. }
  50193. function distBBox(node, k, p2, toBBox, destNode) {
  50194. if (!destNode)
  50195. destNode = createNode(null);
  50196. destNode.minX = Infinity;
  50197. destNode.minY = Infinity;
  50198. destNode.maxX = -Infinity;
  50199. destNode.maxY = -Infinity;
  50200. for (let i2 = k; i2 < p2; i2++) {
  50201. const child = node.children[i2];
  50202. extend(destNode, node.leaf ? toBBox(child) : child);
  50203. }
  50204. return destNode;
  50205. }
  50206. function extend(a4, b) {
  50207. a4.minX = Math.min(a4.minX, b.minX);
  50208. a4.minY = Math.min(a4.minY, b.minY);
  50209. a4.maxX = Math.max(a4.maxX, b.maxX);
  50210. a4.maxY = Math.max(a4.maxY, b.maxY);
  50211. return a4;
  50212. }
  50213. function compareNodeMinX(a4, b) {
  50214. return a4.minX - b.minX;
  50215. }
  50216. function compareNodeMinY(a4, b) {
  50217. return a4.minY - b.minY;
  50218. }
  50219. function bboxArea(a4) {
  50220. return (a4.maxX - a4.minX) * (a4.maxY - a4.minY);
  50221. }
  50222. function bboxMargin(a4) {
  50223. return a4.maxX - a4.minX + (a4.maxY - a4.minY);
  50224. }
  50225. function enlargedArea(a4, b) {
  50226. return (Math.max(b.maxX, a4.maxX) - Math.min(b.minX, a4.minX)) * (Math.max(b.maxY, a4.maxY) - Math.min(b.minY, a4.minY));
  50227. }
  50228. function intersectionArea(a4, b) {
  50229. const minX = Math.max(a4.minX, b.minX);
  50230. const minY = Math.max(a4.minY, b.minY);
  50231. const maxX = Math.min(a4.maxX, b.maxX);
  50232. const maxY = Math.min(a4.maxY, b.maxY);
  50233. return Math.max(0, maxX - minX) * Math.max(0, maxY - minY);
  50234. }
  50235. function contains(a4, b) {
  50236. return a4.minX <= b.minX && a4.minY <= b.minY && b.maxX <= a4.maxX && b.maxY <= a4.maxY;
  50237. }
  50238. function intersects2(a4, b) {
  50239. return b.minX <= a4.maxX && b.minY <= a4.maxY && b.maxX >= a4.minX && b.maxY >= a4.minY;
  50240. }
  50241. function createNode(children) {
  50242. return {
  50243. children,
  50244. height: 1,
  50245. leaf: true,
  50246. minX: Infinity,
  50247. minY: Infinity,
  50248. maxX: -Infinity,
  50249. maxY: -Infinity
  50250. };
  50251. }
  50252. function multiSelect(arr, left, right, n2, compare) {
  50253. const stack = [left, right];
  50254. while (stack.length) {
  50255. right = stack.pop();
  50256. left = stack.pop();
  50257. if (right - left <= n2)
  50258. continue;
  50259. const mid = left + Math.ceil((right - left) / n2 / 2) * n2;
  50260. quickselect(arr, mid, left, right, compare);
  50261. stack.push(left, mid, mid, right);
  50262. }
  50263. }
  50264. // node_modules/cesium/Source/Core/RectangleCollisionChecker.js
  50265. function RectangleCollisionChecker() {
  50266. this._tree = new RBush();
  50267. }
  50268. function RectangleWithId() {
  50269. this.minX = 0;
  50270. this.minY = 0;
  50271. this.maxX = 0;
  50272. this.maxY = 0;
  50273. this.id = "";
  50274. }
  50275. RectangleWithId.fromRectangleAndId = function(id, rectangle, result) {
  50276. result.minX = rectangle.west;
  50277. result.minY = rectangle.south;
  50278. result.maxX = rectangle.east;
  50279. result.maxY = rectangle.north;
  50280. result.id = id;
  50281. return result;
  50282. };
  50283. RectangleCollisionChecker.prototype.insert = function(id, rectangle) {
  50284. Check_default.typeOf.string("id", id);
  50285. Check_default.typeOf.object("rectangle", rectangle);
  50286. const withId = RectangleWithId.fromRectangleAndId(
  50287. id,
  50288. rectangle,
  50289. new RectangleWithId()
  50290. );
  50291. this._tree.insert(withId);
  50292. };
  50293. function idCompare(a4, b) {
  50294. return a4.id === b.id;
  50295. }
  50296. var removalScratch = new RectangleWithId();
  50297. RectangleCollisionChecker.prototype.remove = function(id, rectangle) {
  50298. Check_default.typeOf.string("id", id);
  50299. Check_default.typeOf.object("rectangle", rectangle);
  50300. const withId = RectangleWithId.fromRectangleAndId(
  50301. id,
  50302. rectangle,
  50303. removalScratch
  50304. );
  50305. this._tree.remove(withId, idCompare);
  50306. };
  50307. var collisionScratch = new RectangleWithId();
  50308. RectangleCollisionChecker.prototype.collides = function(rectangle) {
  50309. Check_default.typeOf.object("rectangle", rectangle);
  50310. const withId = RectangleWithId.fromRectangleAndId(
  50311. "",
  50312. rectangle,
  50313. collisionScratch
  50314. );
  50315. return this._tree.collides(withId);
  50316. };
  50317. var RectangleCollisionChecker_default = RectangleCollisionChecker;
  50318. // node_modules/cesium/Source/Core/RectangleGeometryLibrary.js
  50319. var cos3 = Math.cos;
  50320. var sin3 = Math.sin;
  50321. var sqrt = Math.sqrt;
  50322. var RectangleGeometryLibrary = {};
  50323. RectangleGeometryLibrary.computePosition = function(computedOptions, ellipsoid, computeST, row, col, position, st) {
  50324. const radiiSquared = ellipsoid.radiiSquared;
  50325. const nwCorner = computedOptions.nwCorner;
  50326. const rectangle = computedOptions.boundingRectangle;
  50327. let stLatitude = nwCorner.latitude - computedOptions.granYCos * row + col * computedOptions.granXSin;
  50328. const cosLatitude = cos3(stLatitude);
  50329. const nZ = sin3(stLatitude);
  50330. const kZ = radiiSquared.z * nZ;
  50331. let stLongitude = nwCorner.longitude + row * computedOptions.granYSin + col * computedOptions.granXCos;
  50332. const nX = cosLatitude * cos3(stLongitude);
  50333. const nY = cosLatitude * sin3(stLongitude);
  50334. const kX = radiiSquared.x * nX;
  50335. const kY = radiiSquared.y * nY;
  50336. const gamma = sqrt(kX * nX + kY * nY + kZ * nZ);
  50337. position.x = kX / gamma;
  50338. position.y = kY / gamma;
  50339. position.z = kZ / gamma;
  50340. if (computeST) {
  50341. const stNwCorner = computedOptions.stNwCorner;
  50342. if (defined_default(stNwCorner)) {
  50343. stLatitude = stNwCorner.latitude - computedOptions.stGranYCos * row + col * computedOptions.stGranXSin;
  50344. stLongitude = stNwCorner.longitude + row * computedOptions.stGranYSin + col * computedOptions.stGranXCos;
  50345. st.x = (stLongitude - computedOptions.stWest) * computedOptions.lonScalar;
  50346. st.y = (stLatitude - computedOptions.stSouth) * computedOptions.latScalar;
  50347. } else {
  50348. st.x = (stLongitude - rectangle.west) * computedOptions.lonScalar;
  50349. st.y = (stLatitude - rectangle.south) * computedOptions.latScalar;
  50350. }
  50351. }
  50352. };
  50353. var rotationMatrixScratch = new Matrix2_default();
  50354. var nwCartesian = new Cartesian3_default();
  50355. var centerScratch3 = new Cartographic_default();
  50356. var centerCartesian = new Cartesian3_default();
  50357. var proj = new GeographicProjection_default();
  50358. function getRotationOptions(nwCorner, rotation, granularityX, granularityY, center, width, height) {
  50359. const cosRotation = Math.cos(rotation);
  50360. const granYCos = granularityY * cosRotation;
  50361. const granXCos = granularityX * cosRotation;
  50362. const sinRotation = Math.sin(rotation);
  50363. const granYSin = granularityY * sinRotation;
  50364. const granXSin = granularityX * sinRotation;
  50365. nwCartesian = proj.project(nwCorner, nwCartesian);
  50366. nwCartesian = Cartesian3_default.subtract(nwCartesian, centerCartesian, nwCartesian);
  50367. const rotationMatrix = Matrix2_default.fromRotation(rotation, rotationMatrixScratch);
  50368. nwCartesian = Matrix2_default.multiplyByVector(
  50369. rotationMatrix,
  50370. nwCartesian,
  50371. nwCartesian
  50372. );
  50373. nwCartesian = Cartesian3_default.add(nwCartesian, centerCartesian, nwCartesian);
  50374. nwCorner = proj.unproject(nwCartesian, nwCorner);
  50375. width -= 1;
  50376. height -= 1;
  50377. const latitude = nwCorner.latitude;
  50378. const latitude0 = latitude + width * granXSin;
  50379. const latitude1 = latitude - granYCos * height;
  50380. const latitude2 = latitude - granYCos * height + width * granXSin;
  50381. const north = Math.max(latitude, latitude0, latitude1, latitude2);
  50382. const south = Math.min(latitude, latitude0, latitude1, latitude2);
  50383. const longitude = nwCorner.longitude;
  50384. const longitude0 = longitude + width * granXCos;
  50385. const longitude1 = longitude + height * granYSin;
  50386. const longitude2 = longitude + height * granYSin + width * granXCos;
  50387. const east = Math.max(longitude, longitude0, longitude1, longitude2);
  50388. const west = Math.min(longitude, longitude0, longitude1, longitude2);
  50389. return {
  50390. north,
  50391. south,
  50392. east,
  50393. west,
  50394. granYCos,
  50395. granYSin,
  50396. granXCos,
  50397. granXSin,
  50398. nwCorner
  50399. };
  50400. }
  50401. RectangleGeometryLibrary.computeOptions = function(rectangle, granularity, rotation, stRotation, boundingRectangleScratch2, nwCornerResult, stNwCornerResult) {
  50402. let east = rectangle.east;
  50403. let west = rectangle.west;
  50404. let north = rectangle.north;
  50405. let south = rectangle.south;
  50406. let northCap = false;
  50407. let southCap = false;
  50408. if (north === Math_default.PI_OVER_TWO) {
  50409. northCap = true;
  50410. }
  50411. if (south === -Math_default.PI_OVER_TWO) {
  50412. southCap = true;
  50413. }
  50414. let dx;
  50415. const dy = north - south;
  50416. if (west > east) {
  50417. dx = Math_default.TWO_PI - west + east;
  50418. } else {
  50419. dx = east - west;
  50420. }
  50421. const width = Math.ceil(dx / granularity) + 1;
  50422. const height = Math.ceil(dy / granularity) + 1;
  50423. const granularityX = dx / (width - 1);
  50424. const granularityY = dy / (height - 1);
  50425. const nwCorner = Rectangle_default.northwest(rectangle, nwCornerResult);
  50426. const center = Rectangle_default.center(rectangle, centerScratch3);
  50427. if (rotation !== 0 || stRotation !== 0) {
  50428. if (center.longitude < nwCorner.longitude) {
  50429. center.longitude += Math_default.TWO_PI;
  50430. }
  50431. centerCartesian = proj.project(center, centerCartesian);
  50432. }
  50433. const granYCos = granularityY;
  50434. const granXCos = granularityX;
  50435. const granYSin = 0;
  50436. const granXSin = 0;
  50437. const boundingRectangle = Rectangle_default.clone(
  50438. rectangle,
  50439. boundingRectangleScratch2
  50440. );
  50441. const computedOptions = {
  50442. granYCos,
  50443. granYSin,
  50444. granXCos,
  50445. granXSin,
  50446. nwCorner,
  50447. boundingRectangle,
  50448. width,
  50449. height,
  50450. northCap,
  50451. southCap
  50452. };
  50453. if (rotation !== 0) {
  50454. const rotationOptions = getRotationOptions(
  50455. nwCorner,
  50456. rotation,
  50457. granularityX,
  50458. granularityY,
  50459. center,
  50460. width,
  50461. height
  50462. );
  50463. north = rotationOptions.north;
  50464. south = rotationOptions.south;
  50465. east = rotationOptions.east;
  50466. west = rotationOptions.west;
  50467. if (north < -Math_default.PI_OVER_TWO || north > Math_default.PI_OVER_TWO || south < -Math_default.PI_OVER_TWO || south > Math_default.PI_OVER_TWO) {
  50468. throw new DeveloperError_default(
  50469. "Rotated rectangle is invalid. It crosses over either the north or south pole."
  50470. );
  50471. }
  50472. computedOptions.granYCos = rotationOptions.granYCos;
  50473. computedOptions.granYSin = rotationOptions.granYSin;
  50474. computedOptions.granXCos = rotationOptions.granXCos;
  50475. computedOptions.granXSin = rotationOptions.granXSin;
  50476. boundingRectangle.north = north;
  50477. boundingRectangle.south = south;
  50478. boundingRectangle.east = east;
  50479. boundingRectangle.west = west;
  50480. }
  50481. if (stRotation !== 0) {
  50482. rotation = rotation - stRotation;
  50483. const stNwCorner = Rectangle_default.northwest(boundingRectangle, stNwCornerResult);
  50484. const stRotationOptions = getRotationOptions(
  50485. stNwCorner,
  50486. rotation,
  50487. granularityX,
  50488. granularityY,
  50489. center,
  50490. width,
  50491. height
  50492. );
  50493. computedOptions.stGranYCos = stRotationOptions.granYCos;
  50494. computedOptions.stGranXCos = stRotationOptions.granXCos;
  50495. computedOptions.stGranYSin = stRotationOptions.granYSin;
  50496. computedOptions.stGranXSin = stRotationOptions.granXSin;
  50497. computedOptions.stNwCorner = stNwCorner;
  50498. computedOptions.stWest = stRotationOptions.west;
  50499. computedOptions.stSouth = stRotationOptions.south;
  50500. }
  50501. return computedOptions;
  50502. };
  50503. var RectangleGeometryLibrary_default = RectangleGeometryLibrary;
  50504. // node_modules/cesium/Source/Core/RectangleGeometry.js
  50505. var positionScratch3 = new Cartesian3_default();
  50506. var normalScratch4 = new Cartesian3_default();
  50507. var tangentScratch2 = new Cartesian3_default();
  50508. var bitangentScratch2 = new Cartesian3_default();
  50509. var rectangleScratch3 = new Rectangle_default();
  50510. var stScratch2 = new Cartesian2_default();
  50511. var bottomBoundingSphere3 = new BoundingSphere_default();
  50512. var topBoundingSphere3 = new BoundingSphere_default();
  50513. function createAttributes(vertexFormat, attributes) {
  50514. const geo = new Geometry_default({
  50515. attributes: new GeometryAttributes_default(),
  50516. primitiveType: PrimitiveType_default.TRIANGLES
  50517. });
  50518. geo.attributes.position = new GeometryAttribute_default({
  50519. componentDatatype: ComponentDatatype_default.DOUBLE,
  50520. componentsPerAttribute: 3,
  50521. values: attributes.positions
  50522. });
  50523. if (vertexFormat.normal) {
  50524. geo.attributes.normal = new GeometryAttribute_default({
  50525. componentDatatype: ComponentDatatype_default.FLOAT,
  50526. componentsPerAttribute: 3,
  50527. values: attributes.normals
  50528. });
  50529. }
  50530. if (vertexFormat.tangent) {
  50531. geo.attributes.tangent = new GeometryAttribute_default({
  50532. componentDatatype: ComponentDatatype_default.FLOAT,
  50533. componentsPerAttribute: 3,
  50534. values: attributes.tangents
  50535. });
  50536. }
  50537. if (vertexFormat.bitangent) {
  50538. geo.attributes.bitangent = new GeometryAttribute_default({
  50539. componentDatatype: ComponentDatatype_default.FLOAT,
  50540. componentsPerAttribute: 3,
  50541. values: attributes.bitangents
  50542. });
  50543. }
  50544. return geo;
  50545. }
  50546. function calculateAttributes(positions, vertexFormat, ellipsoid, tangentRotationMatrix) {
  50547. const length3 = positions.length;
  50548. const normals = vertexFormat.normal ? new Float32Array(length3) : void 0;
  50549. const tangents = vertexFormat.tangent ? new Float32Array(length3) : void 0;
  50550. const bitangents = vertexFormat.bitangent ? new Float32Array(length3) : void 0;
  50551. let attrIndex = 0;
  50552. const bitangent = bitangentScratch2;
  50553. const tangent = tangentScratch2;
  50554. let normal2 = normalScratch4;
  50555. if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent) {
  50556. for (let i2 = 0; i2 < length3; i2 += 3) {
  50557. const p2 = Cartesian3_default.fromArray(positions, i2, positionScratch3);
  50558. const attrIndex1 = attrIndex + 1;
  50559. const attrIndex2 = attrIndex + 2;
  50560. normal2 = ellipsoid.geodeticSurfaceNormal(p2, normal2);
  50561. if (vertexFormat.tangent || vertexFormat.bitangent) {
  50562. Cartesian3_default.cross(Cartesian3_default.UNIT_Z, normal2, tangent);
  50563. Matrix3_default.multiplyByVector(tangentRotationMatrix, tangent, tangent);
  50564. Cartesian3_default.normalize(tangent, tangent);
  50565. if (vertexFormat.bitangent) {
  50566. Cartesian3_default.normalize(
  50567. Cartesian3_default.cross(normal2, tangent, bitangent),
  50568. bitangent
  50569. );
  50570. }
  50571. }
  50572. if (vertexFormat.normal) {
  50573. normals[attrIndex] = normal2.x;
  50574. normals[attrIndex1] = normal2.y;
  50575. normals[attrIndex2] = normal2.z;
  50576. }
  50577. if (vertexFormat.tangent) {
  50578. tangents[attrIndex] = tangent.x;
  50579. tangents[attrIndex1] = tangent.y;
  50580. tangents[attrIndex2] = tangent.z;
  50581. }
  50582. if (vertexFormat.bitangent) {
  50583. bitangents[attrIndex] = bitangent.x;
  50584. bitangents[attrIndex1] = bitangent.y;
  50585. bitangents[attrIndex2] = bitangent.z;
  50586. }
  50587. attrIndex += 3;
  50588. }
  50589. }
  50590. return createAttributes(vertexFormat, {
  50591. positions,
  50592. normals,
  50593. tangents,
  50594. bitangents
  50595. });
  50596. }
  50597. var v1Scratch = new Cartesian3_default();
  50598. var v2Scratch = new Cartesian3_default();
  50599. function calculateAttributesWall(positions, vertexFormat, ellipsoid) {
  50600. const length3 = positions.length;
  50601. const normals = vertexFormat.normal ? new Float32Array(length3) : void 0;
  50602. const tangents = vertexFormat.tangent ? new Float32Array(length3) : void 0;
  50603. const bitangents = vertexFormat.bitangent ? new Float32Array(length3) : void 0;
  50604. let normalIndex = 0;
  50605. let tangentIndex = 0;
  50606. let bitangentIndex = 0;
  50607. let recomputeNormal = true;
  50608. let bitangent = bitangentScratch2;
  50609. let tangent = tangentScratch2;
  50610. let normal2 = normalScratch4;
  50611. if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent) {
  50612. for (let i2 = 0; i2 < length3; i2 += 6) {
  50613. const p2 = Cartesian3_default.fromArray(positions, i2, positionScratch3);
  50614. const p1 = Cartesian3_default.fromArray(positions, (i2 + 6) % length3, v1Scratch);
  50615. if (recomputeNormal) {
  50616. const p22 = Cartesian3_default.fromArray(positions, (i2 + 3) % length3, v2Scratch);
  50617. Cartesian3_default.subtract(p1, p2, p1);
  50618. Cartesian3_default.subtract(p22, p2, p22);
  50619. normal2 = Cartesian3_default.normalize(Cartesian3_default.cross(p22, p1, normal2), normal2);
  50620. recomputeNormal = false;
  50621. }
  50622. if (Cartesian3_default.equalsEpsilon(p1, p2, Math_default.EPSILON10)) {
  50623. recomputeNormal = true;
  50624. }
  50625. if (vertexFormat.tangent || vertexFormat.bitangent) {
  50626. bitangent = ellipsoid.geodeticSurfaceNormal(p2, bitangent);
  50627. if (vertexFormat.tangent) {
  50628. tangent = Cartesian3_default.normalize(
  50629. Cartesian3_default.cross(bitangent, normal2, tangent),
  50630. tangent
  50631. );
  50632. }
  50633. }
  50634. if (vertexFormat.normal) {
  50635. normals[normalIndex++] = normal2.x;
  50636. normals[normalIndex++] = normal2.y;
  50637. normals[normalIndex++] = normal2.z;
  50638. normals[normalIndex++] = normal2.x;
  50639. normals[normalIndex++] = normal2.y;
  50640. normals[normalIndex++] = normal2.z;
  50641. }
  50642. if (vertexFormat.tangent) {
  50643. tangents[tangentIndex++] = tangent.x;
  50644. tangents[tangentIndex++] = tangent.y;
  50645. tangents[tangentIndex++] = tangent.z;
  50646. tangents[tangentIndex++] = tangent.x;
  50647. tangents[tangentIndex++] = tangent.y;
  50648. tangents[tangentIndex++] = tangent.z;
  50649. }
  50650. if (vertexFormat.bitangent) {
  50651. bitangents[bitangentIndex++] = bitangent.x;
  50652. bitangents[bitangentIndex++] = bitangent.y;
  50653. bitangents[bitangentIndex++] = bitangent.z;
  50654. bitangents[bitangentIndex++] = bitangent.x;
  50655. bitangents[bitangentIndex++] = bitangent.y;
  50656. bitangents[bitangentIndex++] = bitangent.z;
  50657. }
  50658. }
  50659. }
  50660. return createAttributes(vertexFormat, {
  50661. positions,
  50662. normals,
  50663. tangents,
  50664. bitangents
  50665. });
  50666. }
  50667. function constructRectangle(rectangleGeometry, computedOptions) {
  50668. const vertexFormat = rectangleGeometry._vertexFormat;
  50669. const ellipsoid = rectangleGeometry._ellipsoid;
  50670. const height = computedOptions.height;
  50671. const width = computedOptions.width;
  50672. const northCap = computedOptions.northCap;
  50673. const southCap = computedOptions.southCap;
  50674. let rowStart = 0;
  50675. let rowEnd = height;
  50676. let rowHeight = height;
  50677. let size = 0;
  50678. if (northCap) {
  50679. rowStart = 1;
  50680. rowHeight -= 1;
  50681. size += 1;
  50682. }
  50683. if (southCap) {
  50684. rowEnd -= 1;
  50685. rowHeight -= 1;
  50686. size += 1;
  50687. }
  50688. size += width * rowHeight;
  50689. const positions = vertexFormat.position ? new Float64Array(size * 3) : void 0;
  50690. const textureCoordinates = vertexFormat.st ? new Float32Array(size * 2) : void 0;
  50691. let posIndex = 0;
  50692. let stIndex = 0;
  50693. const position = positionScratch3;
  50694. const st = stScratch2;
  50695. let minX = Number.MAX_VALUE;
  50696. let minY = Number.MAX_VALUE;
  50697. let maxX = -Number.MAX_VALUE;
  50698. let maxY = -Number.MAX_VALUE;
  50699. for (let row = rowStart; row < rowEnd; ++row) {
  50700. for (let col = 0; col < width; ++col) {
  50701. RectangleGeometryLibrary_default.computePosition(
  50702. computedOptions,
  50703. ellipsoid,
  50704. vertexFormat.st,
  50705. row,
  50706. col,
  50707. position,
  50708. st
  50709. );
  50710. positions[posIndex++] = position.x;
  50711. positions[posIndex++] = position.y;
  50712. positions[posIndex++] = position.z;
  50713. if (vertexFormat.st) {
  50714. textureCoordinates[stIndex++] = st.x;
  50715. textureCoordinates[stIndex++] = st.y;
  50716. minX = Math.min(minX, st.x);
  50717. minY = Math.min(minY, st.y);
  50718. maxX = Math.max(maxX, st.x);
  50719. maxY = Math.max(maxY, st.y);
  50720. }
  50721. }
  50722. }
  50723. if (northCap) {
  50724. RectangleGeometryLibrary_default.computePosition(
  50725. computedOptions,
  50726. ellipsoid,
  50727. vertexFormat.st,
  50728. 0,
  50729. 0,
  50730. position,
  50731. st
  50732. );
  50733. positions[posIndex++] = position.x;
  50734. positions[posIndex++] = position.y;
  50735. positions[posIndex++] = position.z;
  50736. if (vertexFormat.st) {
  50737. textureCoordinates[stIndex++] = st.x;
  50738. textureCoordinates[stIndex++] = st.y;
  50739. minX = st.x;
  50740. minY = st.y;
  50741. maxX = st.x;
  50742. maxY = st.y;
  50743. }
  50744. }
  50745. if (southCap) {
  50746. RectangleGeometryLibrary_default.computePosition(
  50747. computedOptions,
  50748. ellipsoid,
  50749. vertexFormat.st,
  50750. height - 1,
  50751. 0,
  50752. position,
  50753. st
  50754. );
  50755. positions[posIndex++] = position.x;
  50756. positions[posIndex++] = position.y;
  50757. positions[posIndex] = position.z;
  50758. if (vertexFormat.st) {
  50759. textureCoordinates[stIndex++] = st.x;
  50760. textureCoordinates[stIndex] = st.y;
  50761. minX = Math.min(minX, st.x);
  50762. minY = Math.min(minY, st.y);
  50763. maxX = Math.max(maxX, st.x);
  50764. maxY = Math.max(maxY, st.y);
  50765. }
  50766. }
  50767. if (vertexFormat.st && (minX < 0 || minY < 0 || maxX > 1 || maxY > 1)) {
  50768. for (let k = 0; k < textureCoordinates.length; k += 2) {
  50769. textureCoordinates[k] = (textureCoordinates[k] - minX) / (maxX - minX);
  50770. textureCoordinates[k + 1] = (textureCoordinates[k + 1] - minY) / (maxY - minY);
  50771. }
  50772. }
  50773. const geo = calculateAttributes(
  50774. positions,
  50775. vertexFormat,
  50776. ellipsoid,
  50777. computedOptions.tangentRotationMatrix
  50778. );
  50779. let indicesSize = 6 * (width - 1) * (rowHeight - 1);
  50780. if (northCap) {
  50781. indicesSize += 3 * (width - 1);
  50782. }
  50783. if (southCap) {
  50784. indicesSize += 3 * (width - 1);
  50785. }
  50786. const indices2 = IndexDatatype_default.createTypedArray(size, indicesSize);
  50787. let index2 = 0;
  50788. let indicesIndex = 0;
  50789. let i2;
  50790. for (i2 = 0; i2 < rowHeight - 1; ++i2) {
  50791. for (let j = 0; j < width - 1; ++j) {
  50792. const upperLeft = index2;
  50793. const lowerLeft = upperLeft + width;
  50794. const lowerRight = lowerLeft + 1;
  50795. const upperRight = upperLeft + 1;
  50796. indices2[indicesIndex++] = upperLeft;
  50797. indices2[indicesIndex++] = lowerLeft;
  50798. indices2[indicesIndex++] = upperRight;
  50799. indices2[indicesIndex++] = upperRight;
  50800. indices2[indicesIndex++] = lowerLeft;
  50801. indices2[indicesIndex++] = lowerRight;
  50802. ++index2;
  50803. }
  50804. ++index2;
  50805. }
  50806. if (northCap || southCap) {
  50807. let northIndex = size - 1;
  50808. const southIndex = size - 1;
  50809. if (northCap && southCap) {
  50810. northIndex = size - 2;
  50811. }
  50812. let p1;
  50813. let p2;
  50814. index2 = 0;
  50815. if (northCap) {
  50816. for (i2 = 0; i2 < width - 1; i2++) {
  50817. p1 = index2;
  50818. p2 = p1 + 1;
  50819. indices2[indicesIndex++] = northIndex;
  50820. indices2[indicesIndex++] = p1;
  50821. indices2[indicesIndex++] = p2;
  50822. ++index2;
  50823. }
  50824. }
  50825. if (southCap) {
  50826. index2 = (rowHeight - 1) * width;
  50827. for (i2 = 0; i2 < width - 1; i2++) {
  50828. p1 = index2;
  50829. p2 = p1 + 1;
  50830. indices2[indicesIndex++] = p1;
  50831. indices2[indicesIndex++] = southIndex;
  50832. indices2[indicesIndex++] = p2;
  50833. ++index2;
  50834. }
  50835. }
  50836. }
  50837. geo.indices = indices2;
  50838. if (vertexFormat.st) {
  50839. geo.attributes.st = new GeometryAttribute_default({
  50840. componentDatatype: ComponentDatatype_default.FLOAT,
  50841. componentsPerAttribute: 2,
  50842. values: textureCoordinates
  50843. });
  50844. }
  50845. return geo;
  50846. }
  50847. function addWallPositions2(wallPositions, posIndex, i2, topPositions, bottomPositions) {
  50848. wallPositions[posIndex++] = topPositions[i2];
  50849. wallPositions[posIndex++] = topPositions[i2 + 1];
  50850. wallPositions[posIndex++] = topPositions[i2 + 2];
  50851. wallPositions[posIndex++] = bottomPositions[i2];
  50852. wallPositions[posIndex++] = bottomPositions[i2 + 1];
  50853. wallPositions[posIndex] = bottomPositions[i2 + 2];
  50854. return wallPositions;
  50855. }
  50856. function addWallTextureCoordinates(wallTextures, stIndex, i2, st) {
  50857. wallTextures[stIndex++] = st[i2];
  50858. wallTextures[stIndex++] = st[i2 + 1];
  50859. wallTextures[stIndex++] = st[i2];
  50860. wallTextures[stIndex] = st[i2 + 1];
  50861. return wallTextures;
  50862. }
  50863. var scratchVertexFormat12 = new VertexFormat_default();
  50864. function constructExtrudedRectangle(rectangleGeometry, computedOptions) {
  50865. const shadowVolume = rectangleGeometry._shadowVolume;
  50866. const offsetAttributeValue = rectangleGeometry._offsetAttribute;
  50867. const vertexFormat = rectangleGeometry._vertexFormat;
  50868. const minHeight = rectangleGeometry._extrudedHeight;
  50869. const maxHeight = rectangleGeometry._surfaceHeight;
  50870. const ellipsoid = rectangleGeometry._ellipsoid;
  50871. const height = computedOptions.height;
  50872. const width = computedOptions.width;
  50873. let i2;
  50874. if (shadowVolume) {
  50875. const newVertexFormat = VertexFormat_default.clone(
  50876. vertexFormat,
  50877. scratchVertexFormat12
  50878. );
  50879. newVertexFormat.normal = true;
  50880. rectangleGeometry._vertexFormat = newVertexFormat;
  50881. }
  50882. const topBottomGeo = constructRectangle(rectangleGeometry, computedOptions);
  50883. if (shadowVolume) {
  50884. rectangleGeometry._vertexFormat = vertexFormat;
  50885. }
  50886. let topPositions = PolygonPipeline_default.scaleToGeodeticHeight(
  50887. topBottomGeo.attributes.position.values,
  50888. maxHeight,
  50889. ellipsoid,
  50890. false
  50891. );
  50892. topPositions = new Float64Array(topPositions);
  50893. let length3 = topPositions.length;
  50894. const newLength = length3 * 2;
  50895. const positions = new Float64Array(newLength);
  50896. positions.set(topPositions);
  50897. const bottomPositions = PolygonPipeline_default.scaleToGeodeticHeight(
  50898. topBottomGeo.attributes.position.values,
  50899. minHeight,
  50900. ellipsoid
  50901. );
  50902. positions.set(bottomPositions, length3);
  50903. topBottomGeo.attributes.position.values = positions;
  50904. const normals = vertexFormat.normal ? new Float32Array(newLength) : void 0;
  50905. const tangents = vertexFormat.tangent ? new Float32Array(newLength) : void 0;
  50906. const bitangents = vertexFormat.bitangent ? new Float32Array(newLength) : void 0;
  50907. const textures = vertexFormat.st ? new Float32Array(newLength / 3 * 2) : void 0;
  50908. let topSt;
  50909. let topNormals;
  50910. if (vertexFormat.normal) {
  50911. topNormals = topBottomGeo.attributes.normal.values;
  50912. normals.set(topNormals);
  50913. for (i2 = 0; i2 < length3; i2++) {
  50914. topNormals[i2] = -topNormals[i2];
  50915. }
  50916. normals.set(topNormals, length3);
  50917. topBottomGeo.attributes.normal.values = normals;
  50918. }
  50919. if (shadowVolume) {
  50920. topNormals = topBottomGeo.attributes.normal.values;
  50921. if (!vertexFormat.normal) {
  50922. topBottomGeo.attributes.normal = void 0;
  50923. }
  50924. const extrudeNormals = new Float32Array(newLength);
  50925. for (i2 = 0; i2 < length3; i2++) {
  50926. topNormals[i2] = -topNormals[i2];
  50927. }
  50928. extrudeNormals.set(topNormals, length3);
  50929. topBottomGeo.attributes.extrudeDirection = new GeometryAttribute_default({
  50930. componentDatatype: ComponentDatatype_default.FLOAT,
  50931. componentsPerAttribute: 3,
  50932. values: extrudeNormals
  50933. });
  50934. }
  50935. let offsetValue;
  50936. const hasOffsets = defined_default(offsetAttributeValue);
  50937. if (hasOffsets) {
  50938. const size = length3 / 3 * 2;
  50939. let offsetAttribute = new Uint8Array(size);
  50940. if (offsetAttributeValue === GeometryOffsetAttribute_default.TOP) {
  50941. offsetAttribute = arrayFill_default(offsetAttribute, 1, 0, size / 2);
  50942. } else {
  50943. offsetValue = offsetAttributeValue === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  50944. offsetAttribute = arrayFill_default(offsetAttribute, offsetValue);
  50945. }
  50946. topBottomGeo.attributes.applyOffset = new GeometryAttribute_default({
  50947. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  50948. componentsPerAttribute: 1,
  50949. values: offsetAttribute
  50950. });
  50951. }
  50952. if (vertexFormat.tangent) {
  50953. const topTangents = topBottomGeo.attributes.tangent.values;
  50954. tangents.set(topTangents);
  50955. for (i2 = 0; i2 < length3; i2++) {
  50956. topTangents[i2] = -topTangents[i2];
  50957. }
  50958. tangents.set(topTangents, length3);
  50959. topBottomGeo.attributes.tangent.values = tangents;
  50960. }
  50961. if (vertexFormat.bitangent) {
  50962. const topBitangents = topBottomGeo.attributes.bitangent.values;
  50963. bitangents.set(topBitangents);
  50964. bitangents.set(topBitangents, length3);
  50965. topBottomGeo.attributes.bitangent.values = bitangents;
  50966. }
  50967. if (vertexFormat.st) {
  50968. topSt = topBottomGeo.attributes.st.values;
  50969. textures.set(topSt);
  50970. textures.set(topSt, length3 / 3 * 2);
  50971. topBottomGeo.attributes.st.values = textures;
  50972. }
  50973. const indices2 = topBottomGeo.indices;
  50974. const indicesLength = indices2.length;
  50975. const posLength = length3 / 3;
  50976. const newIndices = IndexDatatype_default.createTypedArray(
  50977. newLength / 3,
  50978. indicesLength * 2
  50979. );
  50980. newIndices.set(indices2);
  50981. for (i2 = 0; i2 < indicesLength; i2 += 3) {
  50982. newIndices[i2 + indicesLength] = indices2[i2 + 2] + posLength;
  50983. newIndices[i2 + 1 + indicesLength] = indices2[i2 + 1] + posLength;
  50984. newIndices[i2 + 2 + indicesLength] = indices2[i2] + posLength;
  50985. }
  50986. topBottomGeo.indices = newIndices;
  50987. const northCap = computedOptions.northCap;
  50988. const southCap = computedOptions.southCap;
  50989. let rowHeight = height;
  50990. let widthMultiplier = 2;
  50991. let perimeterPositions = 0;
  50992. let corners = 4;
  50993. let dupliateCorners = 4;
  50994. if (northCap) {
  50995. widthMultiplier -= 1;
  50996. rowHeight -= 1;
  50997. perimeterPositions += 1;
  50998. corners -= 2;
  50999. dupliateCorners -= 1;
  51000. }
  51001. if (southCap) {
  51002. widthMultiplier -= 1;
  51003. rowHeight -= 1;
  51004. perimeterPositions += 1;
  51005. corners -= 2;
  51006. dupliateCorners -= 1;
  51007. }
  51008. perimeterPositions += widthMultiplier * width + 2 * rowHeight - corners;
  51009. const wallCount = (perimeterPositions + dupliateCorners) * 2;
  51010. let wallPositions = new Float64Array(wallCount * 3);
  51011. const wallExtrudeNormals = shadowVolume ? new Float32Array(wallCount * 3) : void 0;
  51012. let wallOffsetAttribute = hasOffsets ? new Uint8Array(wallCount) : void 0;
  51013. let wallTextures = vertexFormat.st ? new Float32Array(wallCount * 2) : void 0;
  51014. const computeTopOffsets = offsetAttributeValue === GeometryOffsetAttribute_default.TOP;
  51015. if (hasOffsets && !computeTopOffsets) {
  51016. offsetValue = offsetAttributeValue === GeometryOffsetAttribute_default.ALL ? 1 : 0;
  51017. wallOffsetAttribute = arrayFill_default(wallOffsetAttribute, offsetValue);
  51018. }
  51019. let posIndex = 0;
  51020. let stIndex = 0;
  51021. let extrudeNormalIndex = 0;
  51022. let wallOffsetIndex = 0;
  51023. const area2 = width * rowHeight;
  51024. let threeI;
  51025. for (i2 = 0; i2 < area2; i2 += width) {
  51026. threeI = i2 * 3;
  51027. wallPositions = addWallPositions2(
  51028. wallPositions,
  51029. posIndex,
  51030. threeI,
  51031. topPositions,
  51032. bottomPositions
  51033. );
  51034. posIndex += 6;
  51035. if (vertexFormat.st) {
  51036. wallTextures = addWallTextureCoordinates(
  51037. wallTextures,
  51038. stIndex,
  51039. i2 * 2,
  51040. topSt
  51041. );
  51042. stIndex += 4;
  51043. }
  51044. if (shadowVolume) {
  51045. extrudeNormalIndex += 3;
  51046. wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI];
  51047. wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 1];
  51048. wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 2];
  51049. }
  51050. if (computeTopOffsets) {
  51051. wallOffsetAttribute[wallOffsetIndex++] = 1;
  51052. wallOffsetIndex += 1;
  51053. }
  51054. }
  51055. if (!southCap) {
  51056. for (i2 = area2 - width; i2 < area2; i2++) {
  51057. threeI = i2 * 3;
  51058. wallPositions = addWallPositions2(
  51059. wallPositions,
  51060. posIndex,
  51061. threeI,
  51062. topPositions,
  51063. bottomPositions
  51064. );
  51065. posIndex += 6;
  51066. if (vertexFormat.st) {
  51067. wallTextures = addWallTextureCoordinates(
  51068. wallTextures,
  51069. stIndex,
  51070. i2 * 2,
  51071. topSt
  51072. );
  51073. stIndex += 4;
  51074. }
  51075. if (shadowVolume) {
  51076. extrudeNormalIndex += 3;
  51077. wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI];
  51078. wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 1];
  51079. wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 2];
  51080. }
  51081. if (computeTopOffsets) {
  51082. wallOffsetAttribute[wallOffsetIndex++] = 1;
  51083. wallOffsetIndex += 1;
  51084. }
  51085. }
  51086. } else {
  51087. const southIndex = northCap ? area2 + 1 : area2;
  51088. threeI = southIndex * 3;
  51089. for (i2 = 0; i2 < 2; i2++) {
  51090. wallPositions = addWallPositions2(
  51091. wallPositions,
  51092. posIndex,
  51093. threeI,
  51094. topPositions,
  51095. bottomPositions
  51096. );
  51097. posIndex += 6;
  51098. if (vertexFormat.st) {
  51099. wallTextures = addWallTextureCoordinates(
  51100. wallTextures,
  51101. stIndex,
  51102. southIndex * 2,
  51103. topSt
  51104. );
  51105. stIndex += 4;
  51106. }
  51107. if (shadowVolume) {
  51108. extrudeNormalIndex += 3;
  51109. wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI];
  51110. wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 1];
  51111. wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 2];
  51112. }
  51113. if (computeTopOffsets) {
  51114. wallOffsetAttribute[wallOffsetIndex++] = 1;
  51115. wallOffsetIndex += 1;
  51116. }
  51117. }
  51118. }
  51119. for (i2 = area2 - 1; i2 > 0; i2 -= width) {
  51120. threeI = i2 * 3;
  51121. wallPositions = addWallPositions2(
  51122. wallPositions,
  51123. posIndex,
  51124. threeI,
  51125. topPositions,
  51126. bottomPositions
  51127. );
  51128. posIndex += 6;
  51129. if (vertexFormat.st) {
  51130. wallTextures = addWallTextureCoordinates(
  51131. wallTextures,
  51132. stIndex,
  51133. i2 * 2,
  51134. topSt
  51135. );
  51136. stIndex += 4;
  51137. }
  51138. if (shadowVolume) {
  51139. extrudeNormalIndex += 3;
  51140. wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI];
  51141. wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 1];
  51142. wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 2];
  51143. }
  51144. if (computeTopOffsets) {
  51145. wallOffsetAttribute[wallOffsetIndex++] = 1;
  51146. wallOffsetIndex += 1;
  51147. }
  51148. }
  51149. if (!northCap) {
  51150. for (i2 = width - 1; i2 >= 0; i2--) {
  51151. threeI = i2 * 3;
  51152. wallPositions = addWallPositions2(
  51153. wallPositions,
  51154. posIndex,
  51155. threeI,
  51156. topPositions,
  51157. bottomPositions
  51158. );
  51159. posIndex += 6;
  51160. if (vertexFormat.st) {
  51161. wallTextures = addWallTextureCoordinates(
  51162. wallTextures,
  51163. stIndex,
  51164. i2 * 2,
  51165. topSt
  51166. );
  51167. stIndex += 4;
  51168. }
  51169. if (shadowVolume) {
  51170. extrudeNormalIndex += 3;
  51171. wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI];
  51172. wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 1];
  51173. wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 2];
  51174. }
  51175. if (computeTopOffsets) {
  51176. wallOffsetAttribute[wallOffsetIndex++] = 1;
  51177. wallOffsetIndex += 1;
  51178. }
  51179. }
  51180. } else {
  51181. const northIndex = area2;
  51182. threeI = northIndex * 3;
  51183. for (i2 = 0; i2 < 2; i2++) {
  51184. wallPositions = addWallPositions2(
  51185. wallPositions,
  51186. posIndex,
  51187. threeI,
  51188. topPositions,
  51189. bottomPositions
  51190. );
  51191. posIndex += 6;
  51192. if (vertexFormat.st) {
  51193. wallTextures = addWallTextureCoordinates(
  51194. wallTextures,
  51195. stIndex,
  51196. northIndex * 2,
  51197. topSt
  51198. );
  51199. stIndex += 4;
  51200. }
  51201. if (shadowVolume) {
  51202. extrudeNormalIndex += 3;
  51203. wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI];
  51204. wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 1];
  51205. wallExtrudeNormals[extrudeNormalIndex++] = topNormals[threeI + 2];
  51206. }
  51207. if (computeTopOffsets) {
  51208. wallOffsetAttribute[wallOffsetIndex++] = 1;
  51209. wallOffsetIndex += 1;
  51210. }
  51211. }
  51212. }
  51213. let geo = calculateAttributesWall(wallPositions, vertexFormat, ellipsoid);
  51214. if (vertexFormat.st) {
  51215. geo.attributes.st = new GeometryAttribute_default({
  51216. componentDatatype: ComponentDatatype_default.FLOAT,
  51217. componentsPerAttribute: 2,
  51218. values: wallTextures
  51219. });
  51220. }
  51221. if (shadowVolume) {
  51222. geo.attributes.extrudeDirection = new GeometryAttribute_default({
  51223. componentDatatype: ComponentDatatype_default.FLOAT,
  51224. componentsPerAttribute: 3,
  51225. values: wallExtrudeNormals
  51226. });
  51227. }
  51228. if (hasOffsets) {
  51229. geo.attributes.applyOffset = new GeometryAttribute_default({
  51230. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  51231. componentsPerAttribute: 1,
  51232. values: wallOffsetAttribute
  51233. });
  51234. }
  51235. const wallIndices = IndexDatatype_default.createTypedArray(
  51236. wallCount,
  51237. perimeterPositions * 6
  51238. );
  51239. let upperLeft;
  51240. let lowerLeft;
  51241. let lowerRight;
  51242. let upperRight;
  51243. length3 = wallPositions.length / 3;
  51244. let index2 = 0;
  51245. for (i2 = 0; i2 < length3 - 1; i2 += 2) {
  51246. upperLeft = i2;
  51247. upperRight = (upperLeft + 2) % length3;
  51248. const p1 = Cartesian3_default.fromArray(wallPositions, upperLeft * 3, v1Scratch);
  51249. const p2 = Cartesian3_default.fromArray(wallPositions, upperRight * 3, v2Scratch);
  51250. if (Cartesian3_default.equalsEpsilon(p1, p2, Math_default.EPSILON10)) {
  51251. continue;
  51252. }
  51253. lowerLeft = (upperLeft + 1) % length3;
  51254. lowerRight = (lowerLeft + 2) % length3;
  51255. wallIndices[index2++] = upperLeft;
  51256. wallIndices[index2++] = lowerLeft;
  51257. wallIndices[index2++] = upperRight;
  51258. wallIndices[index2++] = upperRight;
  51259. wallIndices[index2++] = lowerLeft;
  51260. wallIndices[index2++] = lowerRight;
  51261. }
  51262. geo.indices = wallIndices;
  51263. geo = GeometryPipeline_default.combineInstances([
  51264. new GeometryInstance_default({
  51265. geometry: topBottomGeo
  51266. }),
  51267. new GeometryInstance_default({
  51268. geometry: geo
  51269. })
  51270. ]);
  51271. return geo[0];
  51272. }
  51273. var scratchRectanglePoints = [
  51274. new Cartesian3_default(),
  51275. new Cartesian3_default(),
  51276. new Cartesian3_default(),
  51277. new Cartesian3_default()
  51278. ];
  51279. var nwScratch = new Cartographic_default();
  51280. var stNwScratch = new Cartographic_default();
  51281. function computeRectangle4(rectangle, granularity, rotation, ellipsoid, result) {
  51282. if (rotation === 0) {
  51283. return Rectangle_default.clone(rectangle, result);
  51284. }
  51285. const computedOptions = RectangleGeometryLibrary_default.computeOptions(
  51286. rectangle,
  51287. granularity,
  51288. rotation,
  51289. 0,
  51290. rectangleScratch3,
  51291. nwScratch
  51292. );
  51293. const height = computedOptions.height;
  51294. const width = computedOptions.width;
  51295. const positions = scratchRectanglePoints;
  51296. RectangleGeometryLibrary_default.computePosition(
  51297. computedOptions,
  51298. ellipsoid,
  51299. false,
  51300. 0,
  51301. 0,
  51302. positions[0]
  51303. );
  51304. RectangleGeometryLibrary_default.computePosition(
  51305. computedOptions,
  51306. ellipsoid,
  51307. false,
  51308. 0,
  51309. width - 1,
  51310. positions[1]
  51311. );
  51312. RectangleGeometryLibrary_default.computePosition(
  51313. computedOptions,
  51314. ellipsoid,
  51315. false,
  51316. height - 1,
  51317. 0,
  51318. positions[2]
  51319. );
  51320. RectangleGeometryLibrary_default.computePosition(
  51321. computedOptions,
  51322. ellipsoid,
  51323. false,
  51324. height - 1,
  51325. width - 1,
  51326. positions[3]
  51327. );
  51328. return Rectangle_default.fromCartesianArray(positions, ellipsoid, result);
  51329. }
  51330. function RectangleGeometry(options) {
  51331. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  51332. const rectangle = options.rectangle;
  51333. Check_default.typeOf.object("rectangle", rectangle);
  51334. Rectangle_default.validate(rectangle);
  51335. if (rectangle.north < rectangle.south) {
  51336. throw new DeveloperError_default(
  51337. "options.rectangle.north must be greater than or equal to options.rectangle.south"
  51338. );
  51339. }
  51340. const height = defaultValue_default(options.height, 0);
  51341. const extrudedHeight = defaultValue_default(options.extrudedHeight, height);
  51342. this._rectangle = Rectangle_default.clone(rectangle);
  51343. this._granularity = defaultValue_default(
  51344. options.granularity,
  51345. Math_default.RADIANS_PER_DEGREE
  51346. );
  51347. this._ellipsoid = Ellipsoid_default.clone(
  51348. defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84)
  51349. );
  51350. this._surfaceHeight = Math.max(height, extrudedHeight);
  51351. this._rotation = defaultValue_default(options.rotation, 0);
  51352. this._stRotation = defaultValue_default(options.stRotation, 0);
  51353. this._vertexFormat = VertexFormat_default.clone(
  51354. defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT)
  51355. );
  51356. this._extrudedHeight = Math.min(height, extrudedHeight);
  51357. this._shadowVolume = defaultValue_default(options.shadowVolume, false);
  51358. this._workerName = "createRectangleGeometry";
  51359. this._offsetAttribute = options.offsetAttribute;
  51360. this._rotatedRectangle = void 0;
  51361. this._textureCoordinateRotationPoints = void 0;
  51362. }
  51363. RectangleGeometry.packedLength = Rectangle_default.packedLength + Ellipsoid_default.packedLength + VertexFormat_default.packedLength + 7;
  51364. RectangleGeometry.pack = function(value, array, startingIndex) {
  51365. Check_default.typeOf.object("value", value);
  51366. Check_default.defined("array", array);
  51367. startingIndex = defaultValue_default(startingIndex, 0);
  51368. Rectangle_default.pack(value._rectangle, array, startingIndex);
  51369. startingIndex += Rectangle_default.packedLength;
  51370. Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
  51371. startingIndex += Ellipsoid_default.packedLength;
  51372. VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
  51373. startingIndex += VertexFormat_default.packedLength;
  51374. array[startingIndex++] = value._granularity;
  51375. array[startingIndex++] = value._surfaceHeight;
  51376. array[startingIndex++] = value._rotation;
  51377. array[startingIndex++] = value._stRotation;
  51378. array[startingIndex++] = value._extrudedHeight;
  51379. array[startingIndex++] = value._shadowVolume ? 1 : 0;
  51380. array[startingIndex] = defaultValue_default(value._offsetAttribute, -1);
  51381. return array;
  51382. };
  51383. var scratchRectangle = new Rectangle_default();
  51384. var scratchEllipsoid11 = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
  51385. var scratchOptions19 = {
  51386. rectangle: scratchRectangle,
  51387. ellipsoid: scratchEllipsoid11,
  51388. vertexFormat: scratchVertexFormat12,
  51389. granularity: void 0,
  51390. height: void 0,
  51391. rotation: void 0,
  51392. stRotation: void 0,
  51393. extrudedHeight: void 0,
  51394. shadowVolume: void 0,
  51395. offsetAttribute: void 0
  51396. };
  51397. RectangleGeometry.unpack = function(array, startingIndex, result) {
  51398. Check_default.defined("array", array);
  51399. startingIndex = defaultValue_default(startingIndex, 0);
  51400. const rectangle = Rectangle_default.unpack(array, startingIndex, scratchRectangle);
  51401. startingIndex += Rectangle_default.packedLength;
  51402. const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid11);
  51403. startingIndex += Ellipsoid_default.packedLength;
  51404. const vertexFormat = VertexFormat_default.unpack(
  51405. array,
  51406. startingIndex,
  51407. scratchVertexFormat12
  51408. );
  51409. startingIndex += VertexFormat_default.packedLength;
  51410. const granularity = array[startingIndex++];
  51411. const surfaceHeight = array[startingIndex++];
  51412. const rotation = array[startingIndex++];
  51413. const stRotation = array[startingIndex++];
  51414. const extrudedHeight = array[startingIndex++];
  51415. const shadowVolume = array[startingIndex++] === 1;
  51416. const offsetAttribute = array[startingIndex];
  51417. if (!defined_default(result)) {
  51418. scratchOptions19.granularity = granularity;
  51419. scratchOptions19.height = surfaceHeight;
  51420. scratchOptions19.rotation = rotation;
  51421. scratchOptions19.stRotation = stRotation;
  51422. scratchOptions19.extrudedHeight = extrudedHeight;
  51423. scratchOptions19.shadowVolume = shadowVolume;
  51424. scratchOptions19.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  51425. return new RectangleGeometry(scratchOptions19);
  51426. }
  51427. result._rectangle = Rectangle_default.clone(rectangle, result._rectangle);
  51428. result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
  51429. result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
  51430. result._granularity = granularity;
  51431. result._surfaceHeight = surfaceHeight;
  51432. result._rotation = rotation;
  51433. result._stRotation = stRotation;
  51434. result._extrudedHeight = extrudedHeight;
  51435. result._shadowVolume = shadowVolume;
  51436. result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  51437. return result;
  51438. };
  51439. RectangleGeometry.computeRectangle = function(options, result) {
  51440. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  51441. const rectangle = options.rectangle;
  51442. Check_default.typeOf.object("rectangle", rectangle);
  51443. Rectangle_default.validate(rectangle);
  51444. if (rectangle.north < rectangle.south) {
  51445. throw new DeveloperError_default(
  51446. "options.rectangle.north must be greater than or equal to options.rectangle.south"
  51447. );
  51448. }
  51449. const granularity = defaultValue_default(
  51450. options.granularity,
  51451. Math_default.RADIANS_PER_DEGREE
  51452. );
  51453. const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  51454. const rotation = defaultValue_default(options.rotation, 0);
  51455. return computeRectangle4(rectangle, granularity, rotation, ellipsoid, result);
  51456. };
  51457. var tangentRotationMatrixScratch = new Matrix3_default();
  51458. var quaternionScratch4 = new Quaternion_default();
  51459. var centerScratch4 = new Cartographic_default();
  51460. RectangleGeometry.createGeometry = function(rectangleGeometry) {
  51461. if (Math_default.equalsEpsilon(
  51462. rectangleGeometry._rectangle.north,
  51463. rectangleGeometry._rectangle.south,
  51464. Math_default.EPSILON10
  51465. ) || Math_default.equalsEpsilon(
  51466. rectangleGeometry._rectangle.east,
  51467. rectangleGeometry._rectangle.west,
  51468. Math_default.EPSILON10
  51469. )) {
  51470. return void 0;
  51471. }
  51472. let rectangle = rectangleGeometry._rectangle;
  51473. const ellipsoid = rectangleGeometry._ellipsoid;
  51474. const rotation = rectangleGeometry._rotation;
  51475. const stRotation = rectangleGeometry._stRotation;
  51476. const vertexFormat = rectangleGeometry._vertexFormat;
  51477. const computedOptions = RectangleGeometryLibrary_default.computeOptions(
  51478. rectangle,
  51479. rectangleGeometry._granularity,
  51480. rotation,
  51481. stRotation,
  51482. rectangleScratch3,
  51483. nwScratch,
  51484. stNwScratch
  51485. );
  51486. const tangentRotationMatrix = tangentRotationMatrixScratch;
  51487. if (stRotation !== 0 || rotation !== 0) {
  51488. const center = Rectangle_default.center(rectangle, centerScratch4);
  51489. const axis = ellipsoid.geodeticSurfaceNormalCartographic(center, v1Scratch);
  51490. Quaternion_default.fromAxisAngle(axis, -stRotation, quaternionScratch4);
  51491. Matrix3_default.fromQuaternion(quaternionScratch4, tangentRotationMatrix);
  51492. } else {
  51493. Matrix3_default.clone(Matrix3_default.IDENTITY, tangentRotationMatrix);
  51494. }
  51495. const surfaceHeight = rectangleGeometry._surfaceHeight;
  51496. const extrudedHeight = rectangleGeometry._extrudedHeight;
  51497. const extrude = !Math_default.equalsEpsilon(
  51498. surfaceHeight,
  51499. extrudedHeight,
  51500. 0,
  51501. Math_default.EPSILON2
  51502. );
  51503. computedOptions.lonScalar = 1 / rectangleGeometry._rectangle.width;
  51504. computedOptions.latScalar = 1 / rectangleGeometry._rectangle.height;
  51505. computedOptions.tangentRotationMatrix = tangentRotationMatrix;
  51506. let geometry;
  51507. let boundingSphere;
  51508. rectangle = rectangleGeometry._rectangle;
  51509. if (extrude) {
  51510. geometry = constructExtrudedRectangle(rectangleGeometry, computedOptions);
  51511. const topBS = BoundingSphere_default.fromRectangle3D(
  51512. rectangle,
  51513. ellipsoid,
  51514. surfaceHeight,
  51515. topBoundingSphere3
  51516. );
  51517. const bottomBS = BoundingSphere_default.fromRectangle3D(
  51518. rectangle,
  51519. ellipsoid,
  51520. extrudedHeight,
  51521. bottomBoundingSphere3
  51522. );
  51523. boundingSphere = BoundingSphere_default.union(topBS, bottomBS);
  51524. } else {
  51525. geometry = constructRectangle(rectangleGeometry, computedOptions);
  51526. geometry.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
  51527. geometry.attributes.position.values,
  51528. surfaceHeight,
  51529. ellipsoid,
  51530. false
  51531. );
  51532. if (defined_default(rectangleGeometry._offsetAttribute)) {
  51533. const length3 = geometry.attributes.position.values.length;
  51534. const applyOffset = new Uint8Array(length3 / 3);
  51535. const offsetValue = rectangleGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  51536. arrayFill_default(applyOffset, offsetValue);
  51537. geometry.attributes.applyOffset = new GeometryAttribute_default({
  51538. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  51539. componentsPerAttribute: 1,
  51540. values: applyOffset
  51541. });
  51542. }
  51543. boundingSphere = BoundingSphere_default.fromRectangle3D(
  51544. rectangle,
  51545. ellipsoid,
  51546. surfaceHeight
  51547. );
  51548. }
  51549. if (!vertexFormat.position) {
  51550. delete geometry.attributes.position;
  51551. }
  51552. return new Geometry_default({
  51553. attributes: geometry.attributes,
  51554. indices: geometry.indices,
  51555. primitiveType: geometry.primitiveType,
  51556. boundingSphere,
  51557. offsetAttribute: rectangleGeometry._offsetAttribute
  51558. });
  51559. };
  51560. RectangleGeometry.createShadowVolume = function(rectangleGeometry, minHeightFunc, maxHeightFunc) {
  51561. const granularity = rectangleGeometry._granularity;
  51562. const ellipsoid = rectangleGeometry._ellipsoid;
  51563. const minHeight = minHeightFunc(granularity, ellipsoid);
  51564. const maxHeight = maxHeightFunc(granularity, ellipsoid);
  51565. return new RectangleGeometry({
  51566. rectangle: rectangleGeometry._rectangle,
  51567. rotation: rectangleGeometry._rotation,
  51568. ellipsoid,
  51569. stRotation: rectangleGeometry._stRotation,
  51570. granularity,
  51571. extrudedHeight: maxHeight,
  51572. height: minHeight,
  51573. vertexFormat: VertexFormat_default.POSITION_ONLY,
  51574. shadowVolume: true
  51575. });
  51576. };
  51577. var unrotatedTextureRectangleScratch = new Rectangle_default();
  51578. var points2DScratch2 = [new Cartesian2_default(), new Cartesian2_default(), new Cartesian2_default()];
  51579. var rotation2DScratch2 = new Matrix2_default();
  51580. var rectangleCenterScratch2 = new Cartographic_default();
  51581. function textureCoordinateRotationPoints3(rectangleGeometry) {
  51582. if (rectangleGeometry._stRotation === 0) {
  51583. return [0, 0, 0, 1, 1, 0];
  51584. }
  51585. const rectangle = Rectangle_default.clone(
  51586. rectangleGeometry._rectangle,
  51587. unrotatedTextureRectangleScratch
  51588. );
  51589. const granularity = rectangleGeometry._granularity;
  51590. const ellipsoid = rectangleGeometry._ellipsoid;
  51591. const rotation = rectangleGeometry._rotation - rectangleGeometry._stRotation;
  51592. const unrotatedTextureRectangle = computeRectangle4(
  51593. rectangle,
  51594. granularity,
  51595. rotation,
  51596. ellipsoid,
  51597. unrotatedTextureRectangleScratch
  51598. );
  51599. const points2D = points2DScratch2;
  51600. points2D[0].x = unrotatedTextureRectangle.west;
  51601. points2D[0].y = unrotatedTextureRectangle.south;
  51602. points2D[1].x = unrotatedTextureRectangle.west;
  51603. points2D[1].y = unrotatedTextureRectangle.north;
  51604. points2D[2].x = unrotatedTextureRectangle.east;
  51605. points2D[2].y = unrotatedTextureRectangle.south;
  51606. const boundingRectangle = rectangleGeometry.rectangle;
  51607. const toDesiredInComputed = Matrix2_default.fromRotation(
  51608. rectangleGeometry._stRotation,
  51609. rotation2DScratch2
  51610. );
  51611. const boundingRectangleCenter = Rectangle_default.center(
  51612. boundingRectangle,
  51613. rectangleCenterScratch2
  51614. );
  51615. for (let i2 = 0; i2 < 3; ++i2) {
  51616. const point2D = points2D[i2];
  51617. point2D.x -= boundingRectangleCenter.longitude;
  51618. point2D.y -= boundingRectangleCenter.latitude;
  51619. Matrix2_default.multiplyByVector(toDesiredInComputed, point2D, point2D);
  51620. point2D.x += boundingRectangleCenter.longitude;
  51621. point2D.y += boundingRectangleCenter.latitude;
  51622. point2D.x = (point2D.x - boundingRectangle.west) / boundingRectangle.width;
  51623. point2D.y = (point2D.y - boundingRectangle.south) / boundingRectangle.height;
  51624. }
  51625. const minXYCorner = points2D[0];
  51626. const maxYCorner = points2D[1];
  51627. const maxXCorner = points2D[2];
  51628. const result = new Array(6);
  51629. Cartesian2_default.pack(minXYCorner, result);
  51630. Cartesian2_default.pack(maxYCorner, result, 2);
  51631. Cartesian2_default.pack(maxXCorner, result, 4);
  51632. return result;
  51633. }
  51634. Object.defineProperties(RectangleGeometry.prototype, {
  51635. rectangle: {
  51636. get: function() {
  51637. if (!defined_default(this._rotatedRectangle)) {
  51638. this._rotatedRectangle = computeRectangle4(
  51639. this._rectangle,
  51640. this._granularity,
  51641. this._rotation,
  51642. this._ellipsoid
  51643. );
  51644. }
  51645. return this._rotatedRectangle;
  51646. }
  51647. },
  51648. textureCoordinateRotationPoints: {
  51649. get: function() {
  51650. if (!defined_default(this._textureCoordinateRotationPoints)) {
  51651. this._textureCoordinateRotationPoints = textureCoordinateRotationPoints3(
  51652. this
  51653. );
  51654. }
  51655. return this._textureCoordinateRotationPoints;
  51656. }
  51657. }
  51658. });
  51659. var RectangleGeometry_default = RectangleGeometry;
  51660. // node_modules/cesium/Source/Core/RectangleOutlineGeometry.js
  51661. var bottomBoundingSphere4 = new BoundingSphere_default();
  51662. var topBoundingSphere4 = new BoundingSphere_default();
  51663. var positionScratch4 = new Cartesian3_default();
  51664. var rectangleScratch4 = new Rectangle_default();
  51665. function constructRectangle2(geometry, computedOptions) {
  51666. const ellipsoid = geometry._ellipsoid;
  51667. const height = computedOptions.height;
  51668. const width = computedOptions.width;
  51669. const northCap = computedOptions.northCap;
  51670. const southCap = computedOptions.southCap;
  51671. let rowHeight = height;
  51672. let widthMultiplier = 2;
  51673. let size = 0;
  51674. let corners = 4;
  51675. if (northCap) {
  51676. widthMultiplier -= 1;
  51677. rowHeight -= 1;
  51678. size += 1;
  51679. corners -= 2;
  51680. }
  51681. if (southCap) {
  51682. widthMultiplier -= 1;
  51683. rowHeight -= 1;
  51684. size += 1;
  51685. corners -= 2;
  51686. }
  51687. size += widthMultiplier * width + 2 * rowHeight - corners;
  51688. const positions = new Float64Array(size * 3);
  51689. let posIndex = 0;
  51690. let row = 0;
  51691. let col;
  51692. const position = positionScratch4;
  51693. if (northCap) {
  51694. RectangleGeometryLibrary_default.computePosition(
  51695. computedOptions,
  51696. ellipsoid,
  51697. false,
  51698. row,
  51699. 0,
  51700. position
  51701. );
  51702. positions[posIndex++] = position.x;
  51703. positions[posIndex++] = position.y;
  51704. positions[posIndex++] = position.z;
  51705. } else {
  51706. for (col = 0; col < width; col++) {
  51707. RectangleGeometryLibrary_default.computePosition(
  51708. computedOptions,
  51709. ellipsoid,
  51710. false,
  51711. row,
  51712. col,
  51713. position
  51714. );
  51715. positions[posIndex++] = position.x;
  51716. positions[posIndex++] = position.y;
  51717. positions[posIndex++] = position.z;
  51718. }
  51719. }
  51720. col = width - 1;
  51721. for (row = 1; row < height; row++) {
  51722. RectangleGeometryLibrary_default.computePosition(
  51723. computedOptions,
  51724. ellipsoid,
  51725. false,
  51726. row,
  51727. col,
  51728. position
  51729. );
  51730. positions[posIndex++] = position.x;
  51731. positions[posIndex++] = position.y;
  51732. positions[posIndex++] = position.z;
  51733. }
  51734. row = height - 1;
  51735. if (!southCap) {
  51736. for (col = width - 2; col >= 0; col--) {
  51737. RectangleGeometryLibrary_default.computePosition(
  51738. computedOptions,
  51739. ellipsoid,
  51740. false,
  51741. row,
  51742. col,
  51743. position
  51744. );
  51745. positions[posIndex++] = position.x;
  51746. positions[posIndex++] = position.y;
  51747. positions[posIndex++] = position.z;
  51748. }
  51749. }
  51750. col = 0;
  51751. for (row = height - 2; row > 0; row--) {
  51752. RectangleGeometryLibrary_default.computePosition(
  51753. computedOptions,
  51754. ellipsoid,
  51755. false,
  51756. row,
  51757. col,
  51758. position
  51759. );
  51760. positions[posIndex++] = position.x;
  51761. positions[posIndex++] = position.y;
  51762. positions[posIndex++] = position.z;
  51763. }
  51764. const indicesSize = positions.length / 3 * 2;
  51765. const indices2 = IndexDatatype_default.createTypedArray(
  51766. positions.length / 3,
  51767. indicesSize
  51768. );
  51769. let index2 = 0;
  51770. for (let i2 = 0; i2 < positions.length / 3 - 1; i2++) {
  51771. indices2[index2++] = i2;
  51772. indices2[index2++] = i2 + 1;
  51773. }
  51774. indices2[index2++] = positions.length / 3 - 1;
  51775. indices2[index2++] = 0;
  51776. const geo = new Geometry_default({
  51777. attributes: new GeometryAttributes_default(),
  51778. primitiveType: PrimitiveType_default.LINES
  51779. });
  51780. geo.attributes.position = new GeometryAttribute_default({
  51781. componentDatatype: ComponentDatatype_default.DOUBLE,
  51782. componentsPerAttribute: 3,
  51783. values: positions
  51784. });
  51785. geo.indices = indices2;
  51786. return geo;
  51787. }
  51788. function constructExtrudedRectangle2(rectangleGeometry, computedOptions) {
  51789. const surfaceHeight = rectangleGeometry._surfaceHeight;
  51790. const extrudedHeight = rectangleGeometry._extrudedHeight;
  51791. const ellipsoid = rectangleGeometry._ellipsoid;
  51792. const minHeight = extrudedHeight;
  51793. const maxHeight = surfaceHeight;
  51794. const geo = constructRectangle2(rectangleGeometry, computedOptions);
  51795. const height = computedOptions.height;
  51796. const width = computedOptions.width;
  51797. const topPositions = PolygonPipeline_default.scaleToGeodeticHeight(
  51798. geo.attributes.position.values,
  51799. maxHeight,
  51800. ellipsoid,
  51801. false
  51802. );
  51803. let length3 = topPositions.length;
  51804. const positions = new Float64Array(length3 * 2);
  51805. positions.set(topPositions);
  51806. const bottomPositions = PolygonPipeline_default.scaleToGeodeticHeight(
  51807. geo.attributes.position.values,
  51808. minHeight,
  51809. ellipsoid
  51810. );
  51811. positions.set(bottomPositions, length3);
  51812. geo.attributes.position.values = positions;
  51813. const northCap = computedOptions.northCap;
  51814. const southCap = computedOptions.southCap;
  51815. let corners = 4;
  51816. if (northCap) {
  51817. corners -= 1;
  51818. }
  51819. if (southCap) {
  51820. corners -= 1;
  51821. }
  51822. const indicesSize = (positions.length / 3 + corners) * 2;
  51823. const indices2 = IndexDatatype_default.createTypedArray(
  51824. positions.length / 3,
  51825. indicesSize
  51826. );
  51827. length3 = positions.length / 6;
  51828. let index2 = 0;
  51829. for (let i2 = 0; i2 < length3 - 1; i2++) {
  51830. indices2[index2++] = i2;
  51831. indices2[index2++] = i2 + 1;
  51832. indices2[index2++] = i2 + length3;
  51833. indices2[index2++] = i2 + length3 + 1;
  51834. }
  51835. indices2[index2++] = length3 - 1;
  51836. indices2[index2++] = 0;
  51837. indices2[index2++] = length3 + length3 - 1;
  51838. indices2[index2++] = length3;
  51839. indices2[index2++] = 0;
  51840. indices2[index2++] = length3;
  51841. let bottomCorner;
  51842. if (northCap) {
  51843. bottomCorner = height - 1;
  51844. } else {
  51845. const topRightCorner = width - 1;
  51846. indices2[index2++] = topRightCorner;
  51847. indices2[index2++] = topRightCorner + length3;
  51848. bottomCorner = width + height - 2;
  51849. }
  51850. indices2[index2++] = bottomCorner;
  51851. indices2[index2++] = bottomCorner + length3;
  51852. if (!southCap) {
  51853. const bottomLeftCorner = width + bottomCorner - 1;
  51854. indices2[index2++] = bottomLeftCorner;
  51855. indices2[index2] = bottomLeftCorner + length3;
  51856. }
  51857. geo.indices = indices2;
  51858. return geo;
  51859. }
  51860. function RectangleOutlineGeometry(options) {
  51861. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  51862. const rectangle = options.rectangle;
  51863. const granularity = defaultValue_default(
  51864. options.granularity,
  51865. Math_default.RADIANS_PER_DEGREE
  51866. );
  51867. const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  51868. const rotation = defaultValue_default(options.rotation, 0);
  51869. if (!defined_default(rectangle)) {
  51870. throw new DeveloperError_default("rectangle is required.");
  51871. }
  51872. Rectangle_default.validate(rectangle);
  51873. if (rectangle.north < rectangle.south) {
  51874. throw new DeveloperError_default(
  51875. "options.rectangle.north must be greater than options.rectangle.south"
  51876. );
  51877. }
  51878. const height = defaultValue_default(options.height, 0);
  51879. const extrudedHeight = defaultValue_default(options.extrudedHeight, height);
  51880. this._rectangle = Rectangle_default.clone(rectangle);
  51881. this._granularity = granularity;
  51882. this._ellipsoid = ellipsoid;
  51883. this._surfaceHeight = Math.max(height, extrudedHeight);
  51884. this._rotation = rotation;
  51885. this._extrudedHeight = Math.min(height, extrudedHeight);
  51886. this._offsetAttribute = options.offsetAttribute;
  51887. this._workerName = "createRectangleOutlineGeometry";
  51888. }
  51889. RectangleOutlineGeometry.packedLength = Rectangle_default.packedLength + Ellipsoid_default.packedLength + 5;
  51890. RectangleOutlineGeometry.pack = function(value, array, startingIndex) {
  51891. if (!defined_default(value)) {
  51892. throw new DeveloperError_default("value is required");
  51893. }
  51894. if (!defined_default(array)) {
  51895. throw new DeveloperError_default("array is required");
  51896. }
  51897. startingIndex = defaultValue_default(startingIndex, 0);
  51898. Rectangle_default.pack(value._rectangle, array, startingIndex);
  51899. startingIndex += Rectangle_default.packedLength;
  51900. Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
  51901. startingIndex += Ellipsoid_default.packedLength;
  51902. array[startingIndex++] = value._granularity;
  51903. array[startingIndex++] = value._surfaceHeight;
  51904. array[startingIndex++] = value._rotation;
  51905. array[startingIndex++] = value._extrudedHeight;
  51906. array[startingIndex] = defaultValue_default(value._offsetAttribute, -1);
  51907. return array;
  51908. };
  51909. var scratchRectangle2 = new Rectangle_default();
  51910. var scratchEllipsoid12 = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
  51911. var scratchOptions20 = {
  51912. rectangle: scratchRectangle2,
  51913. ellipsoid: scratchEllipsoid12,
  51914. granularity: void 0,
  51915. height: void 0,
  51916. rotation: void 0,
  51917. extrudedHeight: void 0,
  51918. offsetAttribute: void 0
  51919. };
  51920. RectangleOutlineGeometry.unpack = function(array, startingIndex, result) {
  51921. if (!defined_default(array)) {
  51922. throw new DeveloperError_default("array is required");
  51923. }
  51924. startingIndex = defaultValue_default(startingIndex, 0);
  51925. const rectangle = Rectangle_default.unpack(array, startingIndex, scratchRectangle2);
  51926. startingIndex += Rectangle_default.packedLength;
  51927. const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid12);
  51928. startingIndex += Ellipsoid_default.packedLength;
  51929. const granularity = array[startingIndex++];
  51930. const height = array[startingIndex++];
  51931. const rotation = array[startingIndex++];
  51932. const extrudedHeight = array[startingIndex++];
  51933. const offsetAttribute = array[startingIndex];
  51934. if (!defined_default(result)) {
  51935. scratchOptions20.granularity = granularity;
  51936. scratchOptions20.height = height;
  51937. scratchOptions20.rotation = rotation;
  51938. scratchOptions20.extrudedHeight = extrudedHeight;
  51939. scratchOptions20.offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  51940. return new RectangleOutlineGeometry(scratchOptions20);
  51941. }
  51942. result._rectangle = Rectangle_default.clone(rectangle, result._rectangle);
  51943. result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
  51944. result._surfaceHeight = height;
  51945. result._rotation = rotation;
  51946. result._extrudedHeight = extrudedHeight;
  51947. result._offsetAttribute = offsetAttribute === -1 ? void 0 : offsetAttribute;
  51948. return result;
  51949. };
  51950. var nwScratch2 = new Cartographic_default();
  51951. RectangleOutlineGeometry.createGeometry = function(rectangleGeometry) {
  51952. const rectangle = rectangleGeometry._rectangle;
  51953. const ellipsoid = rectangleGeometry._ellipsoid;
  51954. const computedOptions = RectangleGeometryLibrary_default.computeOptions(
  51955. rectangle,
  51956. rectangleGeometry._granularity,
  51957. rectangleGeometry._rotation,
  51958. 0,
  51959. rectangleScratch4,
  51960. nwScratch2
  51961. );
  51962. let geometry;
  51963. let boundingSphere;
  51964. if (Math_default.equalsEpsilon(
  51965. rectangle.north,
  51966. rectangle.south,
  51967. Math_default.EPSILON10
  51968. ) || Math_default.equalsEpsilon(
  51969. rectangle.east,
  51970. rectangle.west,
  51971. Math_default.EPSILON10
  51972. )) {
  51973. return void 0;
  51974. }
  51975. const surfaceHeight = rectangleGeometry._surfaceHeight;
  51976. const extrudedHeight = rectangleGeometry._extrudedHeight;
  51977. const extrude = !Math_default.equalsEpsilon(
  51978. surfaceHeight,
  51979. extrudedHeight,
  51980. 0,
  51981. Math_default.EPSILON2
  51982. );
  51983. let offsetValue;
  51984. if (extrude) {
  51985. geometry = constructExtrudedRectangle2(rectangleGeometry, computedOptions);
  51986. if (defined_default(rectangleGeometry._offsetAttribute)) {
  51987. const size = geometry.attributes.position.values.length / 3;
  51988. let offsetAttribute = new Uint8Array(size);
  51989. if (rectangleGeometry._offsetAttribute === GeometryOffsetAttribute_default.TOP) {
  51990. offsetAttribute = arrayFill_default(offsetAttribute, 1, 0, size / 2);
  51991. } else {
  51992. offsetValue = rectangleGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  51993. offsetAttribute = arrayFill_default(offsetAttribute, offsetValue);
  51994. }
  51995. geometry.attributes.applyOffset = new GeometryAttribute_default({
  51996. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  51997. componentsPerAttribute: 1,
  51998. values: offsetAttribute
  51999. });
  52000. }
  52001. const topBS = BoundingSphere_default.fromRectangle3D(
  52002. rectangle,
  52003. ellipsoid,
  52004. surfaceHeight,
  52005. topBoundingSphere4
  52006. );
  52007. const bottomBS = BoundingSphere_default.fromRectangle3D(
  52008. rectangle,
  52009. ellipsoid,
  52010. extrudedHeight,
  52011. bottomBoundingSphere4
  52012. );
  52013. boundingSphere = BoundingSphere_default.union(topBS, bottomBS);
  52014. } else {
  52015. geometry = constructRectangle2(rectangleGeometry, computedOptions);
  52016. geometry.attributes.position.values = PolygonPipeline_default.scaleToGeodeticHeight(
  52017. geometry.attributes.position.values,
  52018. surfaceHeight,
  52019. ellipsoid,
  52020. false
  52021. );
  52022. if (defined_default(rectangleGeometry._offsetAttribute)) {
  52023. const length3 = geometry.attributes.position.values.length;
  52024. const applyOffset = new Uint8Array(length3 / 3);
  52025. offsetValue = rectangleGeometry._offsetAttribute === GeometryOffsetAttribute_default.NONE ? 0 : 1;
  52026. arrayFill_default(applyOffset, offsetValue);
  52027. geometry.attributes.applyOffset = new GeometryAttribute_default({
  52028. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  52029. componentsPerAttribute: 1,
  52030. values: applyOffset
  52031. });
  52032. }
  52033. boundingSphere = BoundingSphere_default.fromRectangle3D(
  52034. rectangle,
  52035. ellipsoid,
  52036. surfaceHeight
  52037. );
  52038. }
  52039. return new Geometry_default({
  52040. attributes: geometry.attributes,
  52041. indices: geometry.indices,
  52042. primitiveType: PrimitiveType_default.LINES,
  52043. boundingSphere,
  52044. offsetAttribute: rectangleGeometry._offsetAttribute
  52045. });
  52046. };
  52047. var RectangleOutlineGeometry_default = RectangleOutlineGeometry;
  52048. // node_modules/cesium/Source/Core/ReferenceFrame.js
  52049. var ReferenceFrame = {
  52050. FIXED: 0,
  52051. INERTIAL: 1
  52052. };
  52053. var ReferenceFrame_default = Object.freeze(ReferenceFrame);
  52054. // node_modules/cesium/Source/Core/S2Cell.js
  52055. var S2_MAX_LEVEL = 30;
  52056. var S2_LIMIT_IJ = 1 << S2_MAX_LEVEL;
  52057. var S2_MAX_SITI = 1 << S2_MAX_LEVEL + 1 >>> 0;
  52058. var S2_POSITION_BITS = 2 * S2_MAX_LEVEL + 1;
  52059. var S2_LOOKUP_BITS = 4;
  52060. var S2_LOOKUP_POSITIONS = [];
  52061. var S2_LOOKUP_IJ = [];
  52062. var S2_POSITION_TO_IJ = [
  52063. [0, 1, 3, 2],
  52064. [0, 2, 3, 1],
  52065. [3, 2, 0, 1],
  52066. [3, 1, 0, 2]
  52067. ];
  52068. var S2_SWAP_MASK = 1;
  52069. var S2_INVERT_MASK = 2;
  52070. var S2_POSITION_TO_ORIENTATION_MASK = [
  52071. S2_SWAP_MASK,
  52072. 0,
  52073. 0,
  52074. S2_SWAP_MASK | S2_INVERT_MASK
  52075. ];
  52076. function S2Cell(cellId) {
  52077. if (!FeatureDetection_default.supportsBigInt()) {
  52078. throw new RuntimeError_default("S2 required BigInt support");
  52079. }
  52080. if (!defined_default(cellId)) {
  52081. throw new DeveloperError_default("cell ID is required.");
  52082. }
  52083. if (!S2Cell.isValidId(cellId)) {
  52084. throw new DeveloperError_default("cell ID is invalid.");
  52085. }
  52086. this._cellId = cellId;
  52087. this._level = S2Cell.getLevel(cellId);
  52088. }
  52089. S2Cell.fromToken = function(token) {
  52090. Check_default.typeOf.string("token", token);
  52091. if (!S2Cell.isValidToken(token)) {
  52092. throw new DeveloperError_default("token is invalid.");
  52093. }
  52094. return new S2Cell(S2Cell.getIdFromToken(token));
  52095. };
  52096. S2Cell.isValidId = function(cellId) {
  52097. Check_default.typeOf.bigint("cellId", cellId);
  52098. if (cellId <= 0) {
  52099. return false;
  52100. }
  52101. if (cellId >> BigInt(S2_POSITION_BITS) > 5) {
  52102. return false;
  52103. }
  52104. const lowestSetBit = cellId & ~cellId + BigInt(1);
  52105. if (!(lowestSetBit & BigInt("0x1555555555555555"))) {
  52106. return false;
  52107. }
  52108. return true;
  52109. };
  52110. S2Cell.isValidToken = function(token) {
  52111. Check_default.typeOf.string("token", token);
  52112. if (!/^[0-9a-fA-F]{1,16}$/.test(token)) {
  52113. return false;
  52114. }
  52115. return S2Cell.isValidId(S2Cell.getIdFromToken(token));
  52116. };
  52117. S2Cell.getIdFromToken = function(token) {
  52118. Check_default.typeOf.string("token", token);
  52119. return BigInt("0x" + token + "0".repeat(16 - token.length));
  52120. };
  52121. S2Cell.getTokenFromId = function(cellId) {
  52122. Check_default.typeOf.bigint("cellId", cellId);
  52123. const trailingZeroHexChars = Math.floor(countTrailingZeroBits(cellId) / 4);
  52124. const hexString = cellId.toString(16).replace(/0*$/, "");
  52125. const zeroString = Array(17 - trailingZeroHexChars - hexString.length).join(
  52126. "0"
  52127. );
  52128. return zeroString + hexString;
  52129. };
  52130. S2Cell.getLevel = function(cellId) {
  52131. Check_default.typeOf.bigint("cellId", cellId);
  52132. if (!S2Cell.isValidId(cellId)) {
  52133. throw new DeveloperError_default();
  52134. }
  52135. let lsbPosition = 0;
  52136. while (cellId !== BigInt(0)) {
  52137. if (cellId & BigInt(1)) {
  52138. break;
  52139. }
  52140. lsbPosition++;
  52141. cellId = cellId >> BigInt(1);
  52142. }
  52143. return S2_MAX_LEVEL - (lsbPosition >> 1);
  52144. };
  52145. S2Cell.prototype.getChild = function(index2) {
  52146. Check_default.typeOf.number("index", index2);
  52147. if (index2 < 0 || index2 > 3) {
  52148. throw new DeveloperError_default("child index must be in the range [0-3].");
  52149. }
  52150. if (this._level === 30) {
  52151. throw new DeveloperError_default("cannot get child of leaf cell.");
  52152. }
  52153. const newLsb = lsb(this._cellId) >> BigInt(2);
  52154. const childCellId = this._cellId + BigInt(2 * index2 + 1 - 4) * newLsb;
  52155. return new S2Cell(childCellId);
  52156. };
  52157. S2Cell.prototype.getParent = function() {
  52158. if (this._level === 0) {
  52159. throw new DeveloperError_default("cannot get parent of root cell.");
  52160. }
  52161. const newLsb = lsb(this._cellId) << BigInt(2);
  52162. return new S2Cell(this._cellId & ~newLsb + BigInt(1) | newLsb);
  52163. };
  52164. S2Cell.prototype.getParentAtLevel = function(level) {
  52165. if (this._level === 0 || level < 0 || this._level < level) {
  52166. throw new DeveloperError_default("cannot get parent at invalid level.");
  52167. }
  52168. const newLsb = lsbForLevel(level);
  52169. return new S2Cell(this._cellId & -newLsb | newLsb);
  52170. };
  52171. S2Cell.prototype.getCenter = function(ellipsoid) {
  52172. ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  52173. let center = getS2Center(this._cellId, this._level);
  52174. center = Cartesian3_default.normalize(center, center);
  52175. const cartographic2 = new Cartographic_default.fromCartesian(
  52176. center,
  52177. Ellipsoid_default.UNIT_SPHERE
  52178. );
  52179. return Cartographic_default.toCartesian(cartographic2, ellipsoid, new Cartesian3_default());
  52180. };
  52181. S2Cell.prototype.getVertex = function(index2, ellipsoid) {
  52182. Check_default.typeOf.number("index", index2);
  52183. if (index2 < 0 || index2 > 3) {
  52184. throw new DeveloperError_default("vertex index must be in the range [0-3].");
  52185. }
  52186. ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  52187. let vertex = getS2Vertex(this._cellId, this._level, index2);
  52188. vertex = Cartesian3_default.normalize(vertex, vertex);
  52189. const cartographic2 = new Cartographic_default.fromCartesian(
  52190. vertex,
  52191. Ellipsoid_default.UNIT_SPHERE
  52192. );
  52193. return Cartographic_default.toCartesian(cartographic2, ellipsoid, new Cartesian3_default());
  52194. };
  52195. S2Cell.fromFacePositionLevel = function(face, position, level) {
  52196. Check_default.typeOf.bigint("position", position);
  52197. if (face < 0 || face > 5) {
  52198. throw new DeveloperError_default("Invalid S2 Face (must be within 0-5)");
  52199. }
  52200. if (level < 0 || level > S2_MAX_LEVEL) {
  52201. throw new DeveloperError_default("Invalid level (must be within 0-30)");
  52202. }
  52203. if (position < 0 || position >= Math.pow(4, level)) {
  52204. throw new DeveloperError_default("Invalid Hilbert position for level");
  52205. }
  52206. const faceBitString = (face < 4 ? "0" : "") + (face < 2 ? "0" : "") + face.toString(2);
  52207. const positionBitString = position.toString(2);
  52208. const positionPrefixPadding = Array(
  52209. 2 * level - positionBitString.length + 1
  52210. ).join("0");
  52211. const positionSuffixPadding = Array(S2_POSITION_BITS - 2 * level).join("0");
  52212. const cellId = BigInt(
  52213. `0b${faceBitString}${positionPrefixPadding}${positionBitString}1${positionSuffixPadding}`
  52214. );
  52215. return new S2Cell(cellId);
  52216. };
  52217. function getS2Center(cellId, level) {
  52218. const faceSiTi = convertCellIdToFaceSiTi(cellId, level);
  52219. return convertFaceSiTitoXYZ(faceSiTi[0], faceSiTi[1], faceSiTi[2]);
  52220. }
  52221. function getS2Vertex(cellId, level, index2) {
  52222. const faceIJ = convertCellIdToFaceIJ(cellId, level);
  52223. const uv = convertIJLeveltoBoundUV([faceIJ[1], faceIJ[2]], level);
  52224. const y = index2 >> 1 & 1;
  52225. return convertFaceUVtoXYZ(faceIJ[0], uv[0][y ^ index2 & 1], uv[1][y]);
  52226. }
  52227. function convertCellIdToFaceSiTi(cellId, level) {
  52228. const faceIJ = convertCellIdToFaceIJ(cellId);
  52229. const face = faceIJ[0];
  52230. const i2 = faceIJ[1];
  52231. const j = faceIJ[2];
  52232. const isLeaf = level === 30;
  52233. const shouldCorrect = !isLeaf && (BigInt(i2) ^ cellId >> BigInt(2)) & BigInt(1);
  52234. const correction = isLeaf ? 1 : shouldCorrect ? 2 : 0;
  52235. const si = (i2 << 1) + correction;
  52236. const ti = (j << 1) + correction;
  52237. return [face, si, ti];
  52238. }
  52239. function convertCellIdToFaceIJ(cellId) {
  52240. if (S2_LOOKUP_POSITIONS.length === 0) {
  52241. generateLookupTable();
  52242. }
  52243. const face = Number(cellId >> BigInt(S2_POSITION_BITS));
  52244. let bits = face & S2_SWAP_MASK;
  52245. const lookupMask = (1 << S2_LOOKUP_BITS) - 1;
  52246. let i2 = 0;
  52247. let j = 0;
  52248. for (let k = 7; k >= 0; k--) {
  52249. const numberOfBits = k === 7 ? S2_MAX_LEVEL - 7 * S2_LOOKUP_BITS : S2_LOOKUP_BITS;
  52250. const extractMask = (1 << 2 * numberOfBits) - 1;
  52251. bits += Number(
  52252. cellId >> BigInt(k * 2 * S2_LOOKUP_BITS + 1) & BigInt(extractMask)
  52253. ) << 2;
  52254. bits = S2_LOOKUP_IJ[bits];
  52255. const offset2 = k * S2_LOOKUP_BITS;
  52256. i2 += bits >> S2_LOOKUP_BITS + 2 << offset2;
  52257. j += (bits >> 2 & lookupMask) << offset2;
  52258. bits &= S2_SWAP_MASK | S2_INVERT_MASK;
  52259. }
  52260. return [face, i2, j];
  52261. }
  52262. function convertFaceSiTitoXYZ(face, si, ti) {
  52263. const s2 = convertSiTitoST(si);
  52264. const t = convertSiTitoST(ti);
  52265. const u3 = convertSTtoUV(s2);
  52266. const v7 = convertSTtoUV(t);
  52267. return convertFaceUVtoXYZ(face, u3, v7);
  52268. }
  52269. function convertFaceUVtoXYZ(face, u3, v7) {
  52270. switch (face) {
  52271. case 0:
  52272. return new Cartesian3_default(1, u3, v7);
  52273. case 1:
  52274. return new Cartesian3_default(-u3, 1, v7);
  52275. case 2:
  52276. return new Cartesian3_default(-u3, -v7, 1);
  52277. case 3:
  52278. return new Cartesian3_default(-1, -v7, -u3);
  52279. case 4:
  52280. return new Cartesian3_default(v7, -1, -u3);
  52281. default:
  52282. return new Cartesian3_default(v7, u3, -1);
  52283. }
  52284. }
  52285. function convertSTtoUV(s2) {
  52286. if (s2 >= 0.5)
  52287. return 1 / 3 * (4 * s2 * s2 - 1);
  52288. return 1 / 3 * (1 - 4 * (1 - s2) * (1 - s2));
  52289. }
  52290. function convertSiTitoST(si) {
  52291. return 1 / S2_MAX_SITI * si;
  52292. }
  52293. function convertIJLeveltoBoundUV(ij, level) {
  52294. const result = [[], []];
  52295. const cellSize = getSizeIJ(level);
  52296. for (let d = 0; d < 2; ++d) {
  52297. const ijLow = ij[d] & -cellSize;
  52298. const ijHigh = ijLow + cellSize;
  52299. result[d][0] = convertSTtoUV(convertIJtoSTMinimum(ijLow));
  52300. result[d][1] = convertSTtoUV(convertIJtoSTMinimum(ijHigh));
  52301. }
  52302. return result;
  52303. }
  52304. function getSizeIJ(level) {
  52305. return 1 << S2_MAX_LEVEL - level >>> 0;
  52306. }
  52307. function convertIJtoSTMinimum(i2) {
  52308. return 1 / S2_LIMIT_IJ * i2;
  52309. }
  52310. function generateLookupCell(level, i2, j, originalOrientation, position, orientation) {
  52311. if (level === S2_LOOKUP_BITS) {
  52312. const ij = (i2 << S2_LOOKUP_BITS) + j;
  52313. S2_LOOKUP_POSITIONS[(ij << 2) + originalOrientation] = (position << 2) + orientation;
  52314. S2_LOOKUP_IJ[(position << 2) + originalOrientation] = (ij << 2) + orientation;
  52315. } else {
  52316. level++;
  52317. i2 <<= 1;
  52318. j <<= 1;
  52319. position <<= 2;
  52320. const r2 = S2_POSITION_TO_IJ[orientation];
  52321. generateLookupCell(
  52322. level,
  52323. i2 + (r2[0] >> 1),
  52324. j + (r2[0] & 1),
  52325. originalOrientation,
  52326. position,
  52327. orientation ^ S2_POSITION_TO_ORIENTATION_MASK[0]
  52328. );
  52329. generateLookupCell(
  52330. level,
  52331. i2 + (r2[1] >> 1),
  52332. j + (r2[1] & 1),
  52333. originalOrientation,
  52334. position + 1,
  52335. orientation ^ S2_POSITION_TO_ORIENTATION_MASK[1]
  52336. );
  52337. generateLookupCell(
  52338. level,
  52339. i2 + (r2[2] >> 1),
  52340. j + (r2[2] & 1),
  52341. originalOrientation,
  52342. position + 2,
  52343. orientation ^ S2_POSITION_TO_ORIENTATION_MASK[2]
  52344. );
  52345. generateLookupCell(
  52346. level,
  52347. i2 + (r2[3] >> 1),
  52348. j + (r2[3] & 1),
  52349. originalOrientation,
  52350. position + 3,
  52351. orientation ^ S2_POSITION_TO_ORIENTATION_MASK[3]
  52352. );
  52353. }
  52354. }
  52355. function generateLookupTable() {
  52356. generateLookupCell(0, 0, 0, 0, 0, 0);
  52357. generateLookupCell(0, 0, 0, S2_SWAP_MASK, 0, S2_SWAP_MASK);
  52358. generateLookupCell(0, 0, 0, S2_INVERT_MASK, 0, S2_INVERT_MASK);
  52359. generateLookupCell(
  52360. 0,
  52361. 0,
  52362. 0,
  52363. S2_SWAP_MASK | S2_INVERT_MASK,
  52364. 0,
  52365. S2_SWAP_MASK | S2_INVERT_MASK
  52366. );
  52367. }
  52368. function lsb(cellId) {
  52369. return cellId & ~cellId + BigInt(1);
  52370. }
  52371. function lsbForLevel(level) {
  52372. return BigInt(1) << BigInt(2 * (S2_MAX_LEVEL - level));
  52373. }
  52374. var Mod67BitPosition = [
  52375. 64,
  52376. 0,
  52377. 1,
  52378. 39,
  52379. 2,
  52380. 15,
  52381. 40,
  52382. 23,
  52383. 3,
  52384. 12,
  52385. 16,
  52386. 59,
  52387. 41,
  52388. 19,
  52389. 24,
  52390. 54,
  52391. 4,
  52392. 64,
  52393. 13,
  52394. 10,
  52395. 17,
  52396. 62,
  52397. 60,
  52398. 28,
  52399. 42,
  52400. 30,
  52401. 20,
  52402. 51,
  52403. 25,
  52404. 44,
  52405. 55,
  52406. 47,
  52407. 5,
  52408. 32,
  52409. 65,
  52410. 38,
  52411. 14,
  52412. 22,
  52413. 11,
  52414. 58,
  52415. 18,
  52416. 53,
  52417. 63,
  52418. 9,
  52419. 61,
  52420. 27,
  52421. 29,
  52422. 50,
  52423. 43,
  52424. 46,
  52425. 31,
  52426. 37,
  52427. 21,
  52428. 57,
  52429. 52,
  52430. 8,
  52431. 26,
  52432. 49,
  52433. 45,
  52434. 36,
  52435. 56,
  52436. 7,
  52437. 48,
  52438. 35,
  52439. 6,
  52440. 34,
  52441. 33,
  52442. 0
  52443. ];
  52444. function countTrailingZeroBits(x) {
  52445. return Mod67BitPosition[(-x & x) % BigInt(67)];
  52446. }
  52447. var S2Cell_default = S2Cell;
  52448. // node_modules/cesium/Source/Core/ScreenSpaceEventType.js
  52449. var ScreenSpaceEventType = {
  52450. LEFT_DOWN: 0,
  52451. LEFT_UP: 1,
  52452. LEFT_CLICK: 2,
  52453. LEFT_DOUBLE_CLICK: 3,
  52454. RIGHT_DOWN: 5,
  52455. RIGHT_UP: 6,
  52456. RIGHT_CLICK: 7,
  52457. MIDDLE_DOWN: 10,
  52458. MIDDLE_UP: 11,
  52459. MIDDLE_CLICK: 12,
  52460. MOUSE_MOVE: 15,
  52461. WHEEL: 16,
  52462. PINCH_START: 17,
  52463. PINCH_END: 18,
  52464. PINCH_MOVE: 19
  52465. };
  52466. var ScreenSpaceEventType_default = Object.freeze(ScreenSpaceEventType);
  52467. // node_modules/cesium/Source/Core/ScreenSpaceEventHandler.js
  52468. function getPosition2(screenSpaceEventHandler, event, result) {
  52469. const element = screenSpaceEventHandler._element;
  52470. if (element === document) {
  52471. result.x = event.clientX;
  52472. result.y = event.clientY;
  52473. return result;
  52474. }
  52475. const rect = element.getBoundingClientRect();
  52476. result.x = event.clientX - rect.left;
  52477. result.y = event.clientY - rect.top;
  52478. return result;
  52479. }
  52480. function getInputEventKey(type, modifier) {
  52481. let key = type;
  52482. if (defined_default(modifier)) {
  52483. key += `+${modifier}`;
  52484. }
  52485. return key;
  52486. }
  52487. function getModifier(event) {
  52488. if (event.shiftKey) {
  52489. return KeyboardEventModifier_default.SHIFT;
  52490. } else if (event.ctrlKey) {
  52491. return KeyboardEventModifier_default.CTRL;
  52492. } else if (event.altKey) {
  52493. return KeyboardEventModifier_default.ALT;
  52494. }
  52495. return void 0;
  52496. }
  52497. var MouseButton = {
  52498. LEFT: 0,
  52499. MIDDLE: 1,
  52500. RIGHT: 2
  52501. };
  52502. function registerListener(screenSpaceEventHandler, domType, element, callback) {
  52503. function listener(e2) {
  52504. callback(screenSpaceEventHandler, e2);
  52505. }
  52506. if (FeatureDetection_default.isInternetExplorer()) {
  52507. element.addEventListener(domType, listener, false);
  52508. } else {
  52509. element.addEventListener(domType, listener, {
  52510. capture: false,
  52511. passive: false
  52512. });
  52513. }
  52514. screenSpaceEventHandler._removalFunctions.push(function() {
  52515. element.removeEventListener(domType, listener, false);
  52516. });
  52517. }
  52518. function registerListeners(screenSpaceEventHandler) {
  52519. const element = screenSpaceEventHandler._element;
  52520. const alternateElement = !defined_default(element.disableRootEvents) ? document : element;
  52521. if (FeatureDetection_default.supportsPointerEvents()) {
  52522. registerListener(
  52523. screenSpaceEventHandler,
  52524. "pointerdown",
  52525. element,
  52526. handlePointerDown
  52527. );
  52528. registerListener(
  52529. screenSpaceEventHandler,
  52530. "pointerup",
  52531. element,
  52532. handlePointerUp
  52533. );
  52534. registerListener(
  52535. screenSpaceEventHandler,
  52536. "pointermove",
  52537. element,
  52538. handlePointerMove
  52539. );
  52540. registerListener(
  52541. screenSpaceEventHandler,
  52542. "pointercancel",
  52543. element,
  52544. handlePointerUp
  52545. );
  52546. } else {
  52547. registerListener(
  52548. screenSpaceEventHandler,
  52549. "mousedown",
  52550. element,
  52551. handleMouseDown
  52552. );
  52553. registerListener(
  52554. screenSpaceEventHandler,
  52555. "mouseup",
  52556. alternateElement,
  52557. handleMouseUp
  52558. );
  52559. registerListener(
  52560. screenSpaceEventHandler,
  52561. "mousemove",
  52562. alternateElement,
  52563. handleMouseMove
  52564. );
  52565. registerListener(
  52566. screenSpaceEventHandler,
  52567. "touchstart",
  52568. element,
  52569. handleTouchStart
  52570. );
  52571. registerListener(
  52572. screenSpaceEventHandler,
  52573. "touchend",
  52574. alternateElement,
  52575. handleTouchEnd
  52576. );
  52577. registerListener(
  52578. screenSpaceEventHandler,
  52579. "touchmove",
  52580. alternateElement,
  52581. handleTouchMove
  52582. );
  52583. registerListener(
  52584. screenSpaceEventHandler,
  52585. "touchcancel",
  52586. alternateElement,
  52587. handleTouchEnd
  52588. );
  52589. }
  52590. registerListener(
  52591. screenSpaceEventHandler,
  52592. "dblclick",
  52593. element,
  52594. handleDblClick
  52595. );
  52596. let wheelEvent;
  52597. if ("onwheel" in element) {
  52598. wheelEvent = "wheel";
  52599. } else if (document.onmousewheel !== void 0) {
  52600. wheelEvent = "mousewheel";
  52601. } else {
  52602. wheelEvent = "DOMMouseScroll";
  52603. }
  52604. registerListener(screenSpaceEventHandler, wheelEvent, element, handleWheel);
  52605. }
  52606. function unregisterListeners(screenSpaceEventHandler) {
  52607. const removalFunctions = screenSpaceEventHandler._removalFunctions;
  52608. for (let i2 = 0; i2 < removalFunctions.length; ++i2) {
  52609. removalFunctions[i2]();
  52610. }
  52611. }
  52612. var mouseDownEvent = {
  52613. position: new Cartesian2_default()
  52614. };
  52615. function gotTouchEvent(screenSpaceEventHandler) {
  52616. screenSpaceEventHandler._lastSeenTouchEvent = getTimestamp_default();
  52617. }
  52618. function canProcessMouseEvent(screenSpaceEventHandler) {
  52619. return getTimestamp_default() - screenSpaceEventHandler._lastSeenTouchEvent > ScreenSpaceEventHandler.mouseEmulationIgnoreMilliseconds;
  52620. }
  52621. function checkPixelTolerance(startPosition, endPosition, pixelTolerance) {
  52622. const xDiff = startPosition.x - endPosition.x;
  52623. const yDiff = startPosition.y - endPosition.y;
  52624. const totalPixels = Math.sqrt(xDiff * xDiff + yDiff * yDiff);
  52625. return totalPixels < pixelTolerance;
  52626. }
  52627. function handleMouseDown(screenSpaceEventHandler, event) {
  52628. if (!canProcessMouseEvent(screenSpaceEventHandler)) {
  52629. return;
  52630. }
  52631. const button = event.button;
  52632. screenSpaceEventHandler._buttonDown[button] = true;
  52633. let screenSpaceEventType;
  52634. if (button === MouseButton.LEFT) {
  52635. screenSpaceEventType = ScreenSpaceEventType_default.LEFT_DOWN;
  52636. } else if (button === MouseButton.MIDDLE) {
  52637. screenSpaceEventType = ScreenSpaceEventType_default.MIDDLE_DOWN;
  52638. } else if (button === MouseButton.RIGHT) {
  52639. screenSpaceEventType = ScreenSpaceEventType_default.RIGHT_DOWN;
  52640. } else {
  52641. return;
  52642. }
  52643. const position = getPosition2(
  52644. screenSpaceEventHandler,
  52645. event,
  52646. screenSpaceEventHandler._primaryPosition
  52647. );
  52648. Cartesian2_default.clone(position, screenSpaceEventHandler._primaryStartPosition);
  52649. Cartesian2_default.clone(position, screenSpaceEventHandler._primaryPreviousPosition);
  52650. const modifier = getModifier(event);
  52651. const action = screenSpaceEventHandler.getInputAction(
  52652. screenSpaceEventType,
  52653. modifier
  52654. );
  52655. if (defined_default(action)) {
  52656. Cartesian2_default.clone(position, mouseDownEvent.position);
  52657. action(mouseDownEvent);
  52658. event.preventDefault();
  52659. }
  52660. }
  52661. var mouseUpEvent = {
  52662. position: new Cartesian2_default()
  52663. };
  52664. var mouseClickEvent = {
  52665. position: new Cartesian2_default()
  52666. };
  52667. function cancelMouseEvent(screenSpaceEventHandler, screenSpaceEventType, clickScreenSpaceEventType, event) {
  52668. const modifier = getModifier(event);
  52669. const action = screenSpaceEventHandler.getInputAction(
  52670. screenSpaceEventType,
  52671. modifier
  52672. );
  52673. const clickAction = screenSpaceEventHandler.getInputAction(
  52674. clickScreenSpaceEventType,
  52675. modifier
  52676. );
  52677. if (defined_default(action) || defined_default(clickAction)) {
  52678. const position = getPosition2(
  52679. screenSpaceEventHandler,
  52680. event,
  52681. screenSpaceEventHandler._primaryPosition
  52682. );
  52683. if (defined_default(action)) {
  52684. Cartesian2_default.clone(position, mouseUpEvent.position);
  52685. action(mouseUpEvent);
  52686. }
  52687. if (defined_default(clickAction)) {
  52688. const startPosition = screenSpaceEventHandler._primaryStartPosition;
  52689. if (checkPixelTolerance(
  52690. startPosition,
  52691. position,
  52692. screenSpaceEventHandler._clickPixelTolerance
  52693. )) {
  52694. Cartesian2_default.clone(position, mouseClickEvent.position);
  52695. clickAction(mouseClickEvent);
  52696. }
  52697. }
  52698. }
  52699. }
  52700. function handleMouseUp(screenSpaceEventHandler, event) {
  52701. if (!canProcessMouseEvent(screenSpaceEventHandler)) {
  52702. return;
  52703. }
  52704. const button = event.button;
  52705. if (button !== MouseButton.LEFT && button !== MouseButton.MIDDLE && button !== MouseButton.RIGHT) {
  52706. return;
  52707. }
  52708. if (screenSpaceEventHandler._buttonDown[MouseButton.LEFT]) {
  52709. cancelMouseEvent(
  52710. screenSpaceEventHandler,
  52711. ScreenSpaceEventType_default.LEFT_UP,
  52712. ScreenSpaceEventType_default.LEFT_CLICK,
  52713. event
  52714. );
  52715. screenSpaceEventHandler._buttonDown[MouseButton.LEFT] = false;
  52716. }
  52717. if (screenSpaceEventHandler._buttonDown[MouseButton.MIDDLE]) {
  52718. cancelMouseEvent(
  52719. screenSpaceEventHandler,
  52720. ScreenSpaceEventType_default.MIDDLE_UP,
  52721. ScreenSpaceEventType_default.MIDDLE_CLICK,
  52722. event
  52723. );
  52724. screenSpaceEventHandler._buttonDown[MouseButton.MIDDLE] = false;
  52725. }
  52726. if (screenSpaceEventHandler._buttonDown[MouseButton.RIGHT]) {
  52727. cancelMouseEvent(
  52728. screenSpaceEventHandler,
  52729. ScreenSpaceEventType_default.RIGHT_UP,
  52730. ScreenSpaceEventType_default.RIGHT_CLICK,
  52731. event
  52732. );
  52733. screenSpaceEventHandler._buttonDown[MouseButton.RIGHT] = false;
  52734. }
  52735. }
  52736. var mouseMoveEvent = {
  52737. startPosition: new Cartesian2_default(),
  52738. endPosition: new Cartesian2_default()
  52739. };
  52740. function handleMouseMove(screenSpaceEventHandler, event) {
  52741. if (!canProcessMouseEvent(screenSpaceEventHandler)) {
  52742. return;
  52743. }
  52744. const modifier = getModifier(event);
  52745. const position = getPosition2(
  52746. screenSpaceEventHandler,
  52747. event,
  52748. screenSpaceEventHandler._primaryPosition
  52749. );
  52750. const previousPosition = screenSpaceEventHandler._primaryPreviousPosition;
  52751. const action = screenSpaceEventHandler.getInputAction(
  52752. ScreenSpaceEventType_default.MOUSE_MOVE,
  52753. modifier
  52754. );
  52755. if (defined_default(action)) {
  52756. Cartesian2_default.clone(previousPosition, mouseMoveEvent.startPosition);
  52757. Cartesian2_default.clone(position, mouseMoveEvent.endPosition);
  52758. action(mouseMoveEvent);
  52759. }
  52760. Cartesian2_default.clone(position, previousPosition);
  52761. if (screenSpaceEventHandler._buttonDown[MouseButton.LEFT] || screenSpaceEventHandler._buttonDown[MouseButton.MIDDLE] || screenSpaceEventHandler._buttonDown[MouseButton.RIGHT]) {
  52762. event.preventDefault();
  52763. }
  52764. }
  52765. var mouseDblClickEvent = {
  52766. position: new Cartesian2_default()
  52767. };
  52768. function handleDblClick(screenSpaceEventHandler, event) {
  52769. const button = event.button;
  52770. let screenSpaceEventType;
  52771. if (button === MouseButton.LEFT) {
  52772. screenSpaceEventType = ScreenSpaceEventType_default.LEFT_DOUBLE_CLICK;
  52773. } else {
  52774. return;
  52775. }
  52776. const modifier = getModifier(event);
  52777. const action = screenSpaceEventHandler.getInputAction(
  52778. screenSpaceEventType,
  52779. modifier
  52780. );
  52781. if (defined_default(action)) {
  52782. getPosition2(screenSpaceEventHandler, event, mouseDblClickEvent.position);
  52783. action(mouseDblClickEvent);
  52784. }
  52785. }
  52786. function handleWheel(screenSpaceEventHandler, event) {
  52787. let delta;
  52788. if (defined_default(event.deltaY)) {
  52789. const deltaMode = event.deltaMode;
  52790. if (deltaMode === event.DOM_DELTA_PIXEL) {
  52791. delta = -event.deltaY;
  52792. } else if (deltaMode === event.DOM_DELTA_LINE) {
  52793. delta = -event.deltaY * 40;
  52794. } else {
  52795. delta = -event.deltaY * 120;
  52796. }
  52797. } else if (event.detail > 0) {
  52798. delta = event.detail * -120;
  52799. } else {
  52800. delta = event.wheelDelta;
  52801. }
  52802. if (!defined_default(delta)) {
  52803. return;
  52804. }
  52805. const modifier = getModifier(event);
  52806. const action = screenSpaceEventHandler.getInputAction(
  52807. ScreenSpaceEventType_default.WHEEL,
  52808. modifier
  52809. );
  52810. if (defined_default(action)) {
  52811. action(delta);
  52812. event.preventDefault();
  52813. }
  52814. }
  52815. function handleTouchStart(screenSpaceEventHandler, event) {
  52816. gotTouchEvent(screenSpaceEventHandler);
  52817. const changedTouches = event.changedTouches;
  52818. let i2;
  52819. const length3 = changedTouches.length;
  52820. let touch;
  52821. let identifier;
  52822. const positions = screenSpaceEventHandler._positions;
  52823. for (i2 = 0; i2 < length3; ++i2) {
  52824. touch = changedTouches[i2];
  52825. identifier = touch.identifier;
  52826. positions.set(
  52827. identifier,
  52828. getPosition2(screenSpaceEventHandler, touch, new Cartesian2_default())
  52829. );
  52830. }
  52831. fireTouchEvents(screenSpaceEventHandler, event);
  52832. const previousPositions = screenSpaceEventHandler._previousPositions;
  52833. for (i2 = 0; i2 < length3; ++i2) {
  52834. touch = changedTouches[i2];
  52835. identifier = touch.identifier;
  52836. previousPositions.set(
  52837. identifier,
  52838. Cartesian2_default.clone(positions.get(identifier))
  52839. );
  52840. }
  52841. }
  52842. function handleTouchEnd(screenSpaceEventHandler, event) {
  52843. gotTouchEvent(screenSpaceEventHandler);
  52844. const changedTouches = event.changedTouches;
  52845. let i2;
  52846. const length3 = changedTouches.length;
  52847. let touch;
  52848. let identifier;
  52849. const positions = screenSpaceEventHandler._positions;
  52850. for (i2 = 0; i2 < length3; ++i2) {
  52851. touch = changedTouches[i2];
  52852. identifier = touch.identifier;
  52853. positions.remove(identifier);
  52854. }
  52855. fireTouchEvents(screenSpaceEventHandler, event);
  52856. const previousPositions = screenSpaceEventHandler._previousPositions;
  52857. for (i2 = 0; i2 < length3; ++i2) {
  52858. touch = changedTouches[i2];
  52859. identifier = touch.identifier;
  52860. previousPositions.remove(identifier);
  52861. }
  52862. }
  52863. var touchStartEvent = {
  52864. position: new Cartesian2_default()
  52865. };
  52866. var touch2StartEvent = {
  52867. position1: new Cartesian2_default(),
  52868. position2: new Cartesian2_default()
  52869. };
  52870. var touchEndEvent = {
  52871. position: new Cartesian2_default()
  52872. };
  52873. var touchClickEvent = {
  52874. position: new Cartesian2_default()
  52875. };
  52876. var touchHoldEvent = {
  52877. position: new Cartesian2_default()
  52878. };
  52879. function fireTouchEvents(screenSpaceEventHandler, event) {
  52880. const modifier = getModifier(event);
  52881. const positions = screenSpaceEventHandler._positions;
  52882. const numberOfTouches = positions.length;
  52883. let action;
  52884. let clickAction;
  52885. const pinching = screenSpaceEventHandler._isPinching;
  52886. if (numberOfTouches !== 1 && screenSpaceEventHandler._buttonDown[MouseButton.LEFT]) {
  52887. screenSpaceEventHandler._buttonDown[MouseButton.LEFT] = false;
  52888. if (defined_default(screenSpaceEventHandler._touchHoldTimer)) {
  52889. clearTimeout(screenSpaceEventHandler._touchHoldTimer);
  52890. screenSpaceEventHandler._touchHoldTimer = void 0;
  52891. }
  52892. action = screenSpaceEventHandler.getInputAction(
  52893. ScreenSpaceEventType_default.LEFT_UP,
  52894. modifier
  52895. );
  52896. if (defined_default(action)) {
  52897. Cartesian2_default.clone(
  52898. screenSpaceEventHandler._primaryPosition,
  52899. touchEndEvent.position
  52900. );
  52901. action(touchEndEvent);
  52902. }
  52903. if (numberOfTouches === 0 && !screenSpaceEventHandler._isTouchHolding) {
  52904. clickAction = screenSpaceEventHandler.getInputAction(
  52905. ScreenSpaceEventType_default.LEFT_CLICK,
  52906. modifier
  52907. );
  52908. if (defined_default(clickAction)) {
  52909. const startPosition = screenSpaceEventHandler._primaryStartPosition;
  52910. const endPosition = screenSpaceEventHandler._previousPositions.values[0];
  52911. if (checkPixelTolerance(
  52912. startPosition,
  52913. endPosition,
  52914. screenSpaceEventHandler._clickPixelTolerance
  52915. )) {
  52916. Cartesian2_default.clone(
  52917. screenSpaceEventHandler._primaryPosition,
  52918. touchClickEvent.position
  52919. );
  52920. clickAction(touchClickEvent);
  52921. }
  52922. }
  52923. }
  52924. screenSpaceEventHandler._isTouchHolding = false;
  52925. }
  52926. if (numberOfTouches === 0 && pinching) {
  52927. screenSpaceEventHandler._isPinching = false;
  52928. action = screenSpaceEventHandler.getInputAction(
  52929. ScreenSpaceEventType_default.PINCH_END,
  52930. modifier
  52931. );
  52932. if (defined_default(action)) {
  52933. action();
  52934. }
  52935. }
  52936. if (numberOfTouches === 1 && !pinching) {
  52937. const position = positions.values[0];
  52938. Cartesian2_default.clone(position, screenSpaceEventHandler._primaryPosition);
  52939. Cartesian2_default.clone(position, screenSpaceEventHandler._primaryStartPosition);
  52940. Cartesian2_default.clone(
  52941. position,
  52942. screenSpaceEventHandler._primaryPreviousPosition
  52943. );
  52944. screenSpaceEventHandler._buttonDown[MouseButton.LEFT] = true;
  52945. action = screenSpaceEventHandler.getInputAction(
  52946. ScreenSpaceEventType_default.LEFT_DOWN,
  52947. modifier
  52948. );
  52949. if (defined_default(action)) {
  52950. Cartesian2_default.clone(position, touchStartEvent.position);
  52951. action(touchStartEvent);
  52952. }
  52953. screenSpaceEventHandler._touchHoldTimer = setTimeout(function() {
  52954. if (!screenSpaceEventHandler.isDestroyed()) {
  52955. screenSpaceEventHandler._touchHoldTimer = void 0;
  52956. screenSpaceEventHandler._isTouchHolding = true;
  52957. clickAction = screenSpaceEventHandler.getInputAction(
  52958. ScreenSpaceEventType_default.RIGHT_CLICK,
  52959. modifier
  52960. );
  52961. if (defined_default(clickAction)) {
  52962. const startPosition = screenSpaceEventHandler._primaryStartPosition;
  52963. const endPosition = screenSpaceEventHandler._previousPositions.values[0];
  52964. if (checkPixelTolerance(
  52965. startPosition,
  52966. endPosition,
  52967. screenSpaceEventHandler._holdPixelTolerance
  52968. )) {
  52969. Cartesian2_default.clone(
  52970. screenSpaceEventHandler._primaryPosition,
  52971. touchHoldEvent.position
  52972. );
  52973. clickAction(touchHoldEvent);
  52974. }
  52975. }
  52976. }
  52977. }, ScreenSpaceEventHandler.touchHoldDelayMilliseconds);
  52978. event.preventDefault();
  52979. }
  52980. if (numberOfTouches === 2 && !pinching) {
  52981. screenSpaceEventHandler._isPinching = true;
  52982. action = screenSpaceEventHandler.getInputAction(
  52983. ScreenSpaceEventType_default.PINCH_START,
  52984. modifier
  52985. );
  52986. if (defined_default(action)) {
  52987. Cartesian2_default.clone(positions.values[0], touch2StartEvent.position1);
  52988. Cartesian2_default.clone(positions.values[1], touch2StartEvent.position2);
  52989. action(touch2StartEvent);
  52990. event.preventDefault();
  52991. }
  52992. }
  52993. }
  52994. function handleTouchMove(screenSpaceEventHandler, event) {
  52995. gotTouchEvent(screenSpaceEventHandler);
  52996. const changedTouches = event.changedTouches;
  52997. let i2;
  52998. const length3 = changedTouches.length;
  52999. let touch;
  53000. let identifier;
  53001. const positions = screenSpaceEventHandler._positions;
  53002. for (i2 = 0; i2 < length3; ++i2) {
  53003. touch = changedTouches[i2];
  53004. identifier = touch.identifier;
  53005. const position = positions.get(identifier);
  53006. if (defined_default(position)) {
  53007. getPosition2(screenSpaceEventHandler, touch, position);
  53008. }
  53009. }
  53010. fireTouchMoveEvents(screenSpaceEventHandler, event);
  53011. const previousPositions = screenSpaceEventHandler._previousPositions;
  53012. for (i2 = 0; i2 < length3; ++i2) {
  53013. touch = changedTouches[i2];
  53014. identifier = touch.identifier;
  53015. Cartesian2_default.clone(
  53016. positions.get(identifier),
  53017. previousPositions.get(identifier)
  53018. );
  53019. }
  53020. }
  53021. var touchMoveEvent = {
  53022. startPosition: new Cartesian2_default(),
  53023. endPosition: new Cartesian2_default()
  53024. };
  53025. var touchPinchMovementEvent = {
  53026. distance: {
  53027. startPosition: new Cartesian2_default(),
  53028. endPosition: new Cartesian2_default()
  53029. },
  53030. angleAndHeight: {
  53031. startPosition: new Cartesian2_default(),
  53032. endPosition: new Cartesian2_default()
  53033. }
  53034. };
  53035. function fireTouchMoveEvents(screenSpaceEventHandler, event) {
  53036. const modifier = getModifier(event);
  53037. const positions = screenSpaceEventHandler._positions;
  53038. const previousPositions = screenSpaceEventHandler._previousPositions;
  53039. const numberOfTouches = positions.length;
  53040. let action;
  53041. if (numberOfTouches === 1 && screenSpaceEventHandler._buttonDown[MouseButton.LEFT]) {
  53042. const position = positions.values[0];
  53043. Cartesian2_default.clone(position, screenSpaceEventHandler._primaryPosition);
  53044. const previousPosition = screenSpaceEventHandler._primaryPreviousPosition;
  53045. action = screenSpaceEventHandler.getInputAction(
  53046. ScreenSpaceEventType_default.MOUSE_MOVE,
  53047. modifier
  53048. );
  53049. if (defined_default(action)) {
  53050. Cartesian2_default.clone(previousPosition, touchMoveEvent.startPosition);
  53051. Cartesian2_default.clone(position, touchMoveEvent.endPosition);
  53052. action(touchMoveEvent);
  53053. }
  53054. Cartesian2_default.clone(position, previousPosition);
  53055. event.preventDefault();
  53056. } else if (numberOfTouches === 2 && screenSpaceEventHandler._isPinching) {
  53057. action = screenSpaceEventHandler.getInputAction(
  53058. ScreenSpaceEventType_default.PINCH_MOVE,
  53059. modifier
  53060. );
  53061. if (defined_default(action)) {
  53062. const position1 = positions.values[0];
  53063. const position2 = positions.values[1];
  53064. const previousPosition1 = previousPositions.values[0];
  53065. const previousPosition2 = previousPositions.values[1];
  53066. const dX = position2.x - position1.x;
  53067. const dY = position2.y - position1.y;
  53068. const dist = Math.sqrt(dX * dX + dY * dY) * 0.25;
  53069. const prevDX = previousPosition2.x - previousPosition1.x;
  53070. const prevDY = previousPosition2.y - previousPosition1.y;
  53071. const prevDist = Math.sqrt(prevDX * prevDX + prevDY * prevDY) * 0.25;
  53072. const cY = (position2.y + position1.y) * 0.125;
  53073. const prevCY = (previousPosition2.y + previousPosition1.y) * 0.125;
  53074. const angle = Math.atan2(dY, dX);
  53075. const prevAngle = Math.atan2(prevDY, prevDX);
  53076. Cartesian2_default.fromElements(
  53077. 0,
  53078. prevDist,
  53079. touchPinchMovementEvent.distance.startPosition
  53080. );
  53081. Cartesian2_default.fromElements(
  53082. 0,
  53083. dist,
  53084. touchPinchMovementEvent.distance.endPosition
  53085. );
  53086. Cartesian2_default.fromElements(
  53087. prevAngle,
  53088. prevCY,
  53089. touchPinchMovementEvent.angleAndHeight.startPosition
  53090. );
  53091. Cartesian2_default.fromElements(
  53092. angle,
  53093. cY,
  53094. touchPinchMovementEvent.angleAndHeight.endPosition
  53095. );
  53096. action(touchPinchMovementEvent);
  53097. }
  53098. }
  53099. }
  53100. function handlePointerDown(screenSpaceEventHandler, event) {
  53101. event.target.setPointerCapture(event.pointerId);
  53102. if (event.pointerType === "touch") {
  53103. const positions = screenSpaceEventHandler._positions;
  53104. const identifier = event.pointerId;
  53105. positions.set(
  53106. identifier,
  53107. getPosition2(screenSpaceEventHandler, event, new Cartesian2_default())
  53108. );
  53109. fireTouchEvents(screenSpaceEventHandler, event);
  53110. const previousPositions = screenSpaceEventHandler._previousPositions;
  53111. previousPositions.set(
  53112. identifier,
  53113. Cartesian2_default.clone(positions.get(identifier))
  53114. );
  53115. } else {
  53116. handleMouseDown(screenSpaceEventHandler, event);
  53117. }
  53118. }
  53119. function handlePointerUp(screenSpaceEventHandler, event) {
  53120. if (event.pointerType === "touch") {
  53121. const positions = screenSpaceEventHandler._positions;
  53122. const identifier = event.pointerId;
  53123. positions.remove(identifier);
  53124. fireTouchEvents(screenSpaceEventHandler, event);
  53125. const previousPositions = screenSpaceEventHandler._previousPositions;
  53126. previousPositions.remove(identifier);
  53127. } else {
  53128. handleMouseUp(screenSpaceEventHandler, event);
  53129. }
  53130. }
  53131. function handlePointerMove(screenSpaceEventHandler, event) {
  53132. if (event.pointerType === "touch") {
  53133. const positions = screenSpaceEventHandler._positions;
  53134. const identifier = event.pointerId;
  53135. const position = positions.get(identifier);
  53136. if (!defined_default(position)) {
  53137. return;
  53138. }
  53139. getPosition2(screenSpaceEventHandler, event, position);
  53140. fireTouchMoveEvents(screenSpaceEventHandler, event);
  53141. const previousPositions = screenSpaceEventHandler._previousPositions;
  53142. Cartesian2_default.clone(
  53143. positions.get(identifier),
  53144. previousPositions.get(identifier)
  53145. );
  53146. } else {
  53147. handleMouseMove(screenSpaceEventHandler, event);
  53148. }
  53149. }
  53150. function ScreenSpaceEventHandler(element) {
  53151. this._inputEvents = {};
  53152. this._buttonDown = {
  53153. LEFT: false,
  53154. MIDDLE: false,
  53155. RIGHT: false
  53156. };
  53157. this._isPinching = false;
  53158. this._isTouchHolding = false;
  53159. this._lastSeenTouchEvent = -ScreenSpaceEventHandler.mouseEmulationIgnoreMilliseconds;
  53160. this._primaryStartPosition = new Cartesian2_default();
  53161. this._primaryPosition = new Cartesian2_default();
  53162. this._primaryPreviousPosition = new Cartesian2_default();
  53163. this._positions = new AssociativeArray_default();
  53164. this._previousPositions = new AssociativeArray_default();
  53165. this._removalFunctions = [];
  53166. this._touchHoldTimer = void 0;
  53167. this._clickPixelTolerance = 5;
  53168. this._holdPixelTolerance = 25;
  53169. this._element = defaultValue_default(element, document);
  53170. registerListeners(this);
  53171. }
  53172. ScreenSpaceEventHandler.prototype.setInputAction = function(action, type, modifier) {
  53173. if (!defined_default(action)) {
  53174. throw new DeveloperError_default("action is required.");
  53175. }
  53176. if (!defined_default(type)) {
  53177. throw new DeveloperError_default("type is required.");
  53178. }
  53179. const key = getInputEventKey(type, modifier);
  53180. this._inputEvents[key] = action;
  53181. };
  53182. ScreenSpaceEventHandler.prototype.getInputAction = function(type, modifier) {
  53183. if (!defined_default(type)) {
  53184. throw new DeveloperError_default("type is required.");
  53185. }
  53186. const key = getInputEventKey(type, modifier);
  53187. return this._inputEvents[key];
  53188. };
  53189. ScreenSpaceEventHandler.prototype.removeInputAction = function(type, modifier) {
  53190. if (!defined_default(type)) {
  53191. throw new DeveloperError_default("type is required.");
  53192. }
  53193. const key = getInputEventKey(type, modifier);
  53194. delete this._inputEvents[key];
  53195. };
  53196. ScreenSpaceEventHandler.prototype.isDestroyed = function() {
  53197. return false;
  53198. };
  53199. ScreenSpaceEventHandler.prototype.destroy = function() {
  53200. unregisterListeners(this);
  53201. return destroyObject_default(this);
  53202. };
  53203. ScreenSpaceEventHandler.mouseEmulationIgnoreMilliseconds = 800;
  53204. ScreenSpaceEventHandler.touchHoldDelayMilliseconds = 1500;
  53205. var ScreenSpaceEventHandler_default = ScreenSpaceEventHandler;
  53206. // node_modules/cesium/Source/Core/ShowGeometryInstanceAttribute.js
  53207. function ShowGeometryInstanceAttribute(show) {
  53208. show = defaultValue_default(show, true);
  53209. this.value = ShowGeometryInstanceAttribute.toValue(show);
  53210. }
  53211. Object.defineProperties(ShowGeometryInstanceAttribute.prototype, {
  53212. componentDatatype: {
  53213. get: function() {
  53214. return ComponentDatatype_default.UNSIGNED_BYTE;
  53215. }
  53216. },
  53217. componentsPerAttribute: {
  53218. get: function() {
  53219. return 1;
  53220. }
  53221. },
  53222. normalize: {
  53223. get: function() {
  53224. return false;
  53225. }
  53226. }
  53227. });
  53228. ShowGeometryInstanceAttribute.toValue = function(show, result) {
  53229. if (!defined_default(show)) {
  53230. throw new DeveloperError_default("show is required.");
  53231. }
  53232. if (!defined_default(result)) {
  53233. return new Uint8Array([show]);
  53234. }
  53235. result[0] = show;
  53236. return result;
  53237. };
  53238. var ShowGeometryInstanceAttribute_default = ShowGeometryInstanceAttribute;
  53239. // node_modules/cesium/Source/Core/Simon1994PlanetaryPositions.js
  53240. var Simon1994PlanetaryPositions = {};
  53241. function computeTdbMinusTtSpice(daysSinceJ2000InTerrestrialTime) {
  53242. const g = 6.239996 + 0.0172019696544 * daysSinceJ2000InTerrestrialTime;
  53243. return 1657e-6 * Math.sin(g + 0.01671 * Math.sin(g));
  53244. }
  53245. var TdtMinusTai2 = 32.184;
  53246. var J2000d2 = 2451545;
  53247. function taiToTdb(date, result) {
  53248. result = JulianDate_default.addSeconds(date, TdtMinusTai2, result);
  53249. const days = JulianDate_default.totalDays(result) - J2000d2;
  53250. result = JulianDate_default.addSeconds(result, computeTdbMinusTtSpice(days), result);
  53251. return result;
  53252. }
  53253. var epoch = new JulianDate_default(2451545, 0, TimeStandard_default.TAI);
  53254. var MetersPerKilometer = 1e3;
  53255. var RadiansPerDegree = Math_default.RADIANS_PER_DEGREE;
  53256. var RadiansPerArcSecond = Math_default.RADIANS_PER_ARCSECOND;
  53257. var MetersPerAstronomicalUnit = 14959787e4;
  53258. var perifocalToEquatorial = new Matrix3_default();
  53259. function elementsToCartesian(semimajorAxis, eccentricity, inclination, longitudeOfPerigee, longitudeOfNode, meanLongitude, result) {
  53260. if (inclination < 0) {
  53261. inclination = -inclination;
  53262. longitudeOfNode += Math_default.PI;
  53263. }
  53264. if (inclination < 0 || inclination > Math_default.PI) {
  53265. throw new DeveloperError_default(
  53266. "The inclination is out of range. Inclination must be greater than or equal to zero and less than or equal to Pi radians."
  53267. );
  53268. }
  53269. const radiusOfPeriapsis = semimajorAxis * (1 - eccentricity);
  53270. const argumentOfPeriapsis = longitudeOfPerigee - longitudeOfNode;
  53271. const rightAscensionOfAscendingNode = longitudeOfNode;
  53272. const trueAnomaly = meanAnomalyToTrueAnomaly(
  53273. meanLongitude - longitudeOfPerigee,
  53274. eccentricity
  53275. );
  53276. const type = chooseOrbit(eccentricity, 0);
  53277. if (type === "Hyperbolic" && Math.abs(Math_default.negativePiToPi(trueAnomaly)) >= Math.acos(-1 / eccentricity)) {
  53278. throw new DeveloperError_default(
  53279. "The true anomaly of the hyperbolic orbit lies outside of the bounds of the hyperbola."
  53280. );
  53281. }
  53282. perifocalToCartesianMatrix(
  53283. argumentOfPeriapsis,
  53284. inclination,
  53285. rightAscensionOfAscendingNode,
  53286. perifocalToEquatorial
  53287. );
  53288. const semilatus = radiusOfPeriapsis * (1 + eccentricity);
  53289. const costheta = Math.cos(trueAnomaly);
  53290. const sintheta = Math.sin(trueAnomaly);
  53291. const denom = 1 + eccentricity * costheta;
  53292. if (denom <= Math_default.Epsilon10) {
  53293. throw new DeveloperError_default("elements cannot be converted to cartesian");
  53294. }
  53295. const radius = semilatus / denom;
  53296. if (!defined_default(result)) {
  53297. result = new Cartesian3_default(radius * costheta, radius * sintheta, 0);
  53298. } else {
  53299. result.x = radius * costheta;
  53300. result.y = radius * sintheta;
  53301. result.z = 0;
  53302. }
  53303. return Matrix3_default.multiplyByVector(perifocalToEquatorial, result, result);
  53304. }
  53305. function chooseOrbit(eccentricity, tolerance) {
  53306. if (eccentricity < 0) {
  53307. throw new DeveloperError_default("eccentricity cannot be negative.");
  53308. }
  53309. if (eccentricity <= tolerance) {
  53310. return "Circular";
  53311. } else if (eccentricity < 1 - tolerance) {
  53312. return "Elliptical";
  53313. } else if (eccentricity <= 1 + tolerance) {
  53314. return "Parabolic";
  53315. }
  53316. return "Hyperbolic";
  53317. }
  53318. function meanAnomalyToTrueAnomaly(meanAnomaly, eccentricity) {
  53319. if (eccentricity < 0 || eccentricity >= 1) {
  53320. throw new DeveloperError_default("eccentricity out of range.");
  53321. }
  53322. const eccentricAnomaly = meanAnomalyToEccentricAnomaly(
  53323. meanAnomaly,
  53324. eccentricity
  53325. );
  53326. return eccentricAnomalyToTrueAnomaly(eccentricAnomaly, eccentricity);
  53327. }
  53328. var maxIterationCount = 50;
  53329. var keplerEqConvergence = Math_default.EPSILON8;
  53330. function meanAnomalyToEccentricAnomaly(meanAnomaly, eccentricity) {
  53331. if (eccentricity < 0 || eccentricity >= 1) {
  53332. throw new DeveloperError_default("eccentricity out of range.");
  53333. }
  53334. const revs = Math.floor(meanAnomaly / Math_default.TWO_PI);
  53335. meanAnomaly -= revs * Math_default.TWO_PI;
  53336. let iterationValue = meanAnomaly + eccentricity * Math.sin(meanAnomaly) / (1 - Math.sin(meanAnomaly + eccentricity) + Math.sin(meanAnomaly));
  53337. let eccentricAnomaly = Number.MAX_VALUE;
  53338. let count;
  53339. for (count = 0; count < maxIterationCount && Math.abs(eccentricAnomaly - iterationValue) > keplerEqConvergence; ++count) {
  53340. eccentricAnomaly = iterationValue;
  53341. const NRfunction = eccentricAnomaly - eccentricity * Math.sin(eccentricAnomaly) - meanAnomaly;
  53342. const dNRfunction = 1 - eccentricity * Math.cos(eccentricAnomaly);
  53343. iterationValue = eccentricAnomaly - NRfunction / dNRfunction;
  53344. }
  53345. if (count >= maxIterationCount) {
  53346. throw new DeveloperError_default("Kepler equation did not converge");
  53347. }
  53348. eccentricAnomaly = iterationValue + revs * Math_default.TWO_PI;
  53349. return eccentricAnomaly;
  53350. }
  53351. function eccentricAnomalyToTrueAnomaly(eccentricAnomaly, eccentricity) {
  53352. if (eccentricity < 0 || eccentricity >= 1) {
  53353. throw new DeveloperError_default("eccentricity out of range.");
  53354. }
  53355. const revs = Math.floor(eccentricAnomaly / Math_default.TWO_PI);
  53356. eccentricAnomaly -= revs * Math_default.TWO_PI;
  53357. const trueAnomalyX = Math.cos(eccentricAnomaly) - eccentricity;
  53358. const trueAnomalyY = Math.sin(eccentricAnomaly) * Math.sqrt(1 - eccentricity * eccentricity);
  53359. let trueAnomaly = Math.atan2(trueAnomalyY, trueAnomalyX);
  53360. trueAnomaly = Math_default.zeroToTwoPi(trueAnomaly);
  53361. if (eccentricAnomaly < 0) {
  53362. trueAnomaly -= Math_default.TWO_PI;
  53363. }
  53364. trueAnomaly += revs * Math_default.TWO_PI;
  53365. return trueAnomaly;
  53366. }
  53367. function perifocalToCartesianMatrix(argumentOfPeriapsis, inclination, rightAscension, result) {
  53368. if (inclination < 0 || inclination > Math_default.PI) {
  53369. throw new DeveloperError_default("inclination out of range");
  53370. }
  53371. const cosap = Math.cos(argumentOfPeriapsis);
  53372. const sinap = Math.sin(argumentOfPeriapsis);
  53373. const cosi = Math.cos(inclination);
  53374. const sini = Math.sin(inclination);
  53375. const cosraan = Math.cos(rightAscension);
  53376. const sinraan = Math.sin(rightAscension);
  53377. if (!defined_default(result)) {
  53378. result = new Matrix3_default(
  53379. cosraan * cosap - sinraan * sinap * cosi,
  53380. -cosraan * sinap - sinraan * cosap * cosi,
  53381. sinraan * sini,
  53382. sinraan * cosap + cosraan * sinap * cosi,
  53383. -sinraan * sinap + cosraan * cosap * cosi,
  53384. -cosraan * sini,
  53385. sinap * sini,
  53386. cosap * sini,
  53387. cosi
  53388. );
  53389. } else {
  53390. result[0] = cosraan * cosap - sinraan * sinap * cosi;
  53391. result[1] = sinraan * cosap + cosraan * sinap * cosi;
  53392. result[2] = sinap * sini;
  53393. result[3] = -cosraan * sinap - sinraan * cosap * cosi;
  53394. result[4] = -sinraan * sinap + cosraan * cosap * cosi;
  53395. result[5] = cosap * sini;
  53396. result[6] = sinraan * sini;
  53397. result[7] = -cosraan * sini;
  53398. result[8] = cosi;
  53399. }
  53400. return result;
  53401. }
  53402. var semiMajorAxis0 = 1.0000010178 * MetersPerAstronomicalUnit;
  53403. var meanLongitude0 = 100.46645683 * RadiansPerDegree;
  53404. var meanLongitude1 = 129597742283429e-5 * RadiansPerArcSecond;
  53405. var p1u = 16002;
  53406. var p2u = 21863;
  53407. var p3u = 32004;
  53408. var p4u = 10931;
  53409. var p5u = 14529;
  53410. var p6u = 16368;
  53411. var p7u = 15318;
  53412. var p8u = 32794;
  53413. var Ca1 = 64 * 1e-7 * MetersPerAstronomicalUnit;
  53414. var Ca2 = -152 * 1e-7 * MetersPerAstronomicalUnit;
  53415. var Ca3 = 62 * 1e-7 * MetersPerAstronomicalUnit;
  53416. var Ca4 = -8 * 1e-7 * MetersPerAstronomicalUnit;
  53417. var Ca5 = 32 * 1e-7 * MetersPerAstronomicalUnit;
  53418. var Ca6 = -41 * 1e-7 * MetersPerAstronomicalUnit;
  53419. var Ca7 = 19 * 1e-7 * MetersPerAstronomicalUnit;
  53420. var Ca8 = -11 * 1e-7 * MetersPerAstronomicalUnit;
  53421. var Sa1 = -150 * 1e-7 * MetersPerAstronomicalUnit;
  53422. var Sa2 = -46 * 1e-7 * MetersPerAstronomicalUnit;
  53423. var Sa3 = 68 * 1e-7 * MetersPerAstronomicalUnit;
  53424. var Sa4 = 54 * 1e-7 * MetersPerAstronomicalUnit;
  53425. var Sa5 = 14 * 1e-7 * MetersPerAstronomicalUnit;
  53426. var Sa6 = 24 * 1e-7 * MetersPerAstronomicalUnit;
  53427. var Sa7 = -28 * 1e-7 * MetersPerAstronomicalUnit;
  53428. var Sa8 = 22 * 1e-7 * MetersPerAstronomicalUnit;
  53429. var q1u = 10;
  53430. var q2u = 16002;
  53431. var q3u = 21863;
  53432. var q4u = 10931;
  53433. var q5u = 1473;
  53434. var q6u = 32004;
  53435. var q7u = 4387;
  53436. var q8u = 73;
  53437. var Cl1 = -325 * 1e-7;
  53438. var Cl2 = -322 * 1e-7;
  53439. var Cl3 = -79 * 1e-7;
  53440. var Cl4 = 232 * 1e-7;
  53441. var Cl5 = -52 * 1e-7;
  53442. var Cl6 = 97 * 1e-7;
  53443. var Cl7 = 55 * 1e-7;
  53444. var Cl8 = -41 * 1e-7;
  53445. var Sl1 = -105 * 1e-7;
  53446. var Sl2 = -137 * 1e-7;
  53447. var Sl3 = 258 * 1e-7;
  53448. var Sl4 = 35 * 1e-7;
  53449. var Sl5 = -116 * 1e-7;
  53450. var Sl6 = -88 * 1e-7;
  53451. var Sl7 = -112 * 1e-7;
  53452. var Sl8 = -80 * 1e-7;
  53453. var scratchDate = new JulianDate_default(0, 0, TimeStandard_default.TAI);
  53454. function computeSimonEarthMoonBarycenter(date, result) {
  53455. taiToTdb(date, scratchDate);
  53456. const x = scratchDate.dayNumber - epoch.dayNumber + (scratchDate.secondsOfDay - epoch.secondsOfDay) / TimeConstants_default.SECONDS_PER_DAY;
  53457. const t = x / (TimeConstants_default.DAYS_PER_JULIAN_CENTURY * 10);
  53458. const u3 = 0.3595362 * t;
  53459. const semimajorAxis = semiMajorAxis0 + Ca1 * Math.cos(p1u * u3) + Sa1 * Math.sin(p1u * u3) + Ca2 * Math.cos(p2u * u3) + Sa2 * Math.sin(p2u * u3) + Ca3 * Math.cos(p3u * u3) + Sa3 * Math.sin(p3u * u3) + Ca4 * Math.cos(p4u * u3) + Sa4 * Math.sin(p4u * u3) + Ca5 * Math.cos(p5u * u3) + Sa5 * Math.sin(p5u * u3) + Ca6 * Math.cos(p6u * u3) + Sa6 * Math.sin(p6u * u3) + Ca7 * Math.cos(p7u * u3) + Sa7 * Math.sin(p7u * u3) + Ca8 * Math.cos(p8u * u3) + Sa8 * Math.sin(p8u * u3);
  53460. const meanLongitude = meanLongitude0 + meanLongitude1 * t + Cl1 * Math.cos(q1u * u3) + Sl1 * Math.sin(q1u * u3) + Cl2 * Math.cos(q2u * u3) + Sl2 * Math.sin(q2u * u3) + Cl3 * Math.cos(q3u * u3) + Sl3 * Math.sin(q3u * u3) + Cl4 * Math.cos(q4u * u3) + Sl4 * Math.sin(q4u * u3) + Cl5 * Math.cos(q5u * u3) + Sl5 * Math.sin(q5u * u3) + Cl6 * Math.cos(q6u * u3) + Sl6 * Math.sin(q6u * u3) + Cl7 * Math.cos(q7u * u3) + Sl7 * Math.sin(q7u * u3) + Cl8 * Math.cos(q8u * u3) + Sl8 * Math.sin(q8u * u3);
  53461. const eccentricity = 0.0167086342 - 4203654e-10 * t;
  53462. const longitudeOfPerigee = 102.93734808 * RadiansPerDegree + 11612.3529 * RadiansPerArcSecond * t;
  53463. const inclination = 469.97289 * RadiansPerArcSecond * t;
  53464. const longitudeOfNode = 174.87317577 * RadiansPerDegree - 8679.27034 * RadiansPerArcSecond * t;
  53465. return elementsToCartesian(
  53466. semimajorAxis,
  53467. eccentricity,
  53468. inclination,
  53469. longitudeOfPerigee,
  53470. longitudeOfNode,
  53471. meanLongitude,
  53472. result
  53473. );
  53474. }
  53475. function computeSimonMoon(date, result) {
  53476. taiToTdb(date, scratchDate);
  53477. const x = scratchDate.dayNumber - epoch.dayNumber + (scratchDate.secondsOfDay - epoch.secondsOfDay) / TimeConstants_default.SECONDS_PER_DAY;
  53478. const t = x / TimeConstants_default.DAYS_PER_JULIAN_CENTURY;
  53479. const t2 = t * t;
  53480. const t3 = t2 * t;
  53481. const t4 = t3 * t;
  53482. let semimajorAxis = 383397.7725 + 4e-3 * t;
  53483. let eccentricity = 0.055545526 - 16e-9 * t;
  53484. const inclinationConstant = 5.15668983 * RadiansPerDegree;
  53485. let inclinationSecPart = -8e-5 * t + 0.02966 * t2 - 42e-6 * t3 - 13e-8 * t4;
  53486. const longitudeOfPerigeeConstant = 83.35324312 * RadiansPerDegree;
  53487. let longitudeOfPerigeeSecPart = 146434202669e-4 * t - 38.2702 * t2 - 0.045047 * t3 + 21301e-8 * t4;
  53488. const longitudeOfNodeConstant = 125.04455501 * RadiansPerDegree;
  53489. let longitudeOfNodeSecPart = -69679193631e-4 * t + 6.3602 * t2 + 7625e-6 * t3 - 3586e-8 * t4;
  53490. const meanLongitudeConstant = 218.31664563 * RadiansPerDegree;
  53491. let meanLongitudeSecPart = 17325593434847e-4 * t - 6.391 * t2 + 6588e-6 * t3 - 3169e-8 * t4;
  53492. const D = 297.85019547 * RadiansPerDegree + RadiansPerArcSecond * (1602961601209e-3 * t - 6.3706 * t2 + 6593e-6 * t3 - 3169e-8 * t4);
  53493. const F = 93.27209062 * RadiansPerDegree + RadiansPerArcSecond * (17395272628478e-4 * t - 12.7512 * t2 - 1037e-6 * t3 + 417e-8 * t4);
  53494. const l2 = 134.96340251 * RadiansPerDegree + RadiansPerArcSecond * (17179159232178e-4 * t + 31.8792 * t2 + 0.051635 * t3 - 2447e-7 * t4);
  53495. const lprime = 357.52910918 * RadiansPerDegree + RadiansPerArcSecond * (1295965810481e-4 * t - 0.5532 * t2 + 136e-6 * t3 - 1149e-8 * t4);
  53496. const psi = 310.17137918 * RadiansPerDegree - RadiansPerArcSecond * (6967051436e-3 * t + 6.2068 * t2 + 7618e-6 * t3 - 3219e-8 * t4);
  53497. const twoD = 2 * D;
  53498. const fourD = 4 * D;
  53499. const sixD = 6 * D;
  53500. const twol = 2 * l2;
  53501. const threel = 3 * l2;
  53502. const fourl = 4 * l2;
  53503. const twoF = 2 * F;
  53504. semimajorAxis += 3400.4 * Math.cos(twoD) - 635.6 * Math.cos(twoD - l2) - 235.6 * Math.cos(l2) + 218.1 * Math.cos(twoD - lprime) + 181 * Math.cos(twoD + l2);
  53505. eccentricity += 0.014216 * Math.cos(twoD - l2) + 8551e-6 * Math.cos(twoD - twol) - 1383e-6 * Math.cos(l2) + 1356e-6 * Math.cos(twoD + l2) - 1147e-6 * Math.cos(fourD - threel) - 914e-6 * Math.cos(fourD - twol) + 869e-6 * Math.cos(twoD - lprime - l2) - 627e-6 * Math.cos(twoD) - 394e-6 * Math.cos(fourD - fourl) + 282e-6 * Math.cos(twoD - lprime - twol) - 279e-6 * Math.cos(D - l2) - 236e-6 * Math.cos(twol) + 231e-6 * Math.cos(fourD) + 229e-6 * Math.cos(sixD - fourl) - 201e-6 * Math.cos(twol - twoF);
  53506. inclinationSecPart += 486.26 * Math.cos(twoD - twoF) - 40.13 * Math.cos(twoD) + 37.51 * Math.cos(twoF) + 25.73 * Math.cos(twol - twoF) + 19.97 * Math.cos(twoD - lprime - twoF);
  53507. longitudeOfPerigeeSecPart += -55609 * Math.sin(twoD - l2) - 34711 * Math.sin(twoD - twol) - 9792 * Math.sin(l2) + 9385 * Math.sin(fourD - threel) + 7505 * Math.sin(fourD - twol) + 5318 * Math.sin(twoD + l2) + 3484 * Math.sin(fourD - fourl) - 3417 * Math.sin(twoD - lprime - l2) - 2530 * Math.sin(sixD - fourl) - 2376 * Math.sin(twoD) - 2075 * Math.sin(twoD - threel) - 1883 * Math.sin(twol) - 1736 * Math.sin(sixD - 5 * l2) + 1626 * Math.sin(lprime) - 1370 * Math.sin(sixD - threel);
  53508. longitudeOfNodeSecPart += -5392 * Math.sin(twoD - twoF) - 540 * Math.sin(lprime) - 441 * Math.sin(twoD) + 423 * Math.sin(twoF) - 288 * Math.sin(twol - twoF);
  53509. meanLongitudeSecPart += -3332.9 * Math.sin(twoD) + 1197.4 * Math.sin(twoD - l2) - 662.5 * Math.sin(lprime) + 396.3 * Math.sin(l2) - 218 * Math.sin(twoD - lprime);
  53510. const twoPsi = 2 * psi;
  53511. const threePsi = 3 * psi;
  53512. inclinationSecPart += 46.997 * Math.cos(psi) * t - 0.614 * Math.cos(twoD - twoF + psi) * t + 0.614 * Math.cos(twoD - twoF - psi) * t - 0.0297 * Math.cos(twoPsi) * t2 - 0.0335 * Math.cos(psi) * t2 + 12e-4 * Math.cos(twoD - twoF + twoPsi) * t2 - 16e-5 * Math.cos(psi) * t3 + 4e-5 * Math.cos(threePsi) * t3 + 4e-5 * Math.cos(twoPsi) * t3;
  53513. const perigeeAndMean = 2.116 * Math.sin(psi) * t - 0.111 * Math.sin(twoD - twoF - psi) * t - 15e-4 * Math.sin(psi) * t2;
  53514. longitudeOfPerigeeSecPart += perigeeAndMean;
  53515. meanLongitudeSecPart += perigeeAndMean;
  53516. longitudeOfNodeSecPart += -520.77 * Math.sin(psi) * t + 13.66 * Math.sin(twoD - twoF + psi) * t + 1.12 * Math.sin(twoD - psi) * t - 1.06 * Math.sin(twoF - psi) * t + 0.66 * Math.sin(twoPsi) * t2 + 0.371 * Math.sin(psi) * t2 - 0.035 * Math.sin(twoD - twoF + twoPsi) * t2 - 0.015 * Math.sin(twoD - twoF + psi) * t2 + 14e-4 * Math.sin(psi) * t3 - 11e-4 * Math.sin(threePsi) * t3 - 9e-4 * Math.sin(twoPsi) * t3;
  53517. semimajorAxis *= MetersPerKilometer;
  53518. const inclination = inclinationConstant + inclinationSecPart * RadiansPerArcSecond;
  53519. const longitudeOfPerigee = longitudeOfPerigeeConstant + longitudeOfPerigeeSecPart * RadiansPerArcSecond;
  53520. const meanLongitude = meanLongitudeConstant + meanLongitudeSecPart * RadiansPerArcSecond;
  53521. const longitudeOfNode = longitudeOfNodeConstant + longitudeOfNodeSecPart * RadiansPerArcSecond;
  53522. return elementsToCartesian(
  53523. semimajorAxis,
  53524. eccentricity,
  53525. inclination,
  53526. longitudeOfPerigee,
  53527. longitudeOfNode,
  53528. meanLongitude,
  53529. result
  53530. );
  53531. }
  53532. var moonEarthMassRatio = 0.012300034;
  53533. var factor = moonEarthMassRatio / (moonEarthMassRatio + 1) * -1;
  53534. function computeSimonEarth(date, result) {
  53535. result = computeSimonMoon(date, result);
  53536. return Cartesian3_default.multiplyByScalar(result, factor, result);
  53537. }
  53538. var axesTransformation = new Matrix3_default(
  53539. 1.0000000000000002,
  53540. 5619723173785822e-31,
  53541. 4690511510146299e-34,
  53542. -5154129427414611e-31,
  53543. 0.9174820620691819,
  53544. -0.39777715593191376,
  53545. -223970096136568e-30,
  53546. 0.39777715593191376,
  53547. 0.9174820620691819
  53548. );
  53549. var translation2 = new Cartesian3_default();
  53550. Simon1994PlanetaryPositions.computeSunPositionInEarthInertialFrame = function(julianDate, result) {
  53551. if (!defined_default(julianDate)) {
  53552. julianDate = JulianDate_default.now();
  53553. }
  53554. if (!defined_default(result)) {
  53555. result = new Cartesian3_default();
  53556. }
  53557. translation2 = computeSimonEarthMoonBarycenter(julianDate, translation2);
  53558. result = Cartesian3_default.negate(translation2, result);
  53559. computeSimonEarth(julianDate, translation2);
  53560. Cartesian3_default.subtract(result, translation2, result);
  53561. Matrix3_default.multiplyByVector(axesTransformation, result, result);
  53562. return result;
  53563. };
  53564. Simon1994PlanetaryPositions.computeMoonPositionInEarthInertialFrame = function(julianDate, result) {
  53565. if (!defined_default(julianDate)) {
  53566. julianDate = JulianDate_default.now();
  53567. }
  53568. result = computeSimonMoon(julianDate, result);
  53569. Matrix3_default.multiplyByVector(axesTransformation, result, result);
  53570. return result;
  53571. };
  53572. var Simon1994PlanetaryPositions_default = Simon1994PlanetaryPositions;
  53573. // node_modules/cesium/Source/Core/SimplePolylineGeometry.js
  53574. function interpolateColors2(p0, p1, color0, color1, minDistance, array, offset2) {
  53575. const numPoints = PolylinePipeline_default.numberOfPoints(p0, p1, minDistance);
  53576. let i2;
  53577. const r0 = color0.red;
  53578. const g0 = color0.green;
  53579. const b0 = color0.blue;
  53580. const a0 = color0.alpha;
  53581. const r1 = color1.red;
  53582. const g1 = color1.green;
  53583. const b1 = color1.blue;
  53584. const a1 = color1.alpha;
  53585. if (Color_default.equals(color0, color1)) {
  53586. for (i2 = 0; i2 < numPoints; i2++) {
  53587. array[offset2++] = Color_default.floatToByte(r0);
  53588. array[offset2++] = Color_default.floatToByte(g0);
  53589. array[offset2++] = Color_default.floatToByte(b0);
  53590. array[offset2++] = Color_default.floatToByte(a0);
  53591. }
  53592. return offset2;
  53593. }
  53594. const redPerVertex = (r1 - r0) / numPoints;
  53595. const greenPerVertex = (g1 - g0) / numPoints;
  53596. const bluePerVertex = (b1 - b0) / numPoints;
  53597. const alphaPerVertex = (a1 - a0) / numPoints;
  53598. let index2 = offset2;
  53599. for (i2 = 0; i2 < numPoints; i2++) {
  53600. array[index2++] = Color_default.floatToByte(r0 + i2 * redPerVertex);
  53601. array[index2++] = Color_default.floatToByte(g0 + i2 * greenPerVertex);
  53602. array[index2++] = Color_default.floatToByte(b0 + i2 * bluePerVertex);
  53603. array[index2++] = Color_default.floatToByte(a0 + i2 * alphaPerVertex);
  53604. }
  53605. return index2;
  53606. }
  53607. function SimplePolylineGeometry(options) {
  53608. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  53609. const positions = options.positions;
  53610. const colors = options.colors;
  53611. const colorsPerVertex = defaultValue_default(options.colorsPerVertex, false);
  53612. if (!defined_default(positions) || positions.length < 2) {
  53613. throw new DeveloperError_default("At least two positions are required.");
  53614. }
  53615. if (defined_default(colors) && (colorsPerVertex && colors.length < positions.length || !colorsPerVertex && colors.length < positions.length - 1)) {
  53616. throw new DeveloperError_default("colors has an invalid length.");
  53617. }
  53618. this._positions = positions;
  53619. this._colors = colors;
  53620. this._colorsPerVertex = colorsPerVertex;
  53621. this._arcType = defaultValue_default(options.arcType, ArcType_default.GEODESIC);
  53622. this._granularity = defaultValue_default(
  53623. options.granularity,
  53624. Math_default.RADIANS_PER_DEGREE
  53625. );
  53626. this._ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  53627. this._workerName = "createSimplePolylineGeometry";
  53628. let numComponents = 1 + positions.length * Cartesian3_default.packedLength;
  53629. numComponents += defined_default(colors) ? 1 + colors.length * Color_default.packedLength : 1;
  53630. this.packedLength = numComponents + Ellipsoid_default.packedLength + 3;
  53631. }
  53632. SimplePolylineGeometry.pack = function(value, array, startingIndex) {
  53633. if (!defined_default(value)) {
  53634. throw new DeveloperError_default("value is required");
  53635. }
  53636. if (!defined_default(array)) {
  53637. throw new DeveloperError_default("array is required");
  53638. }
  53639. startingIndex = defaultValue_default(startingIndex, 0);
  53640. let i2;
  53641. const positions = value._positions;
  53642. let length3 = positions.length;
  53643. array[startingIndex++] = length3;
  53644. for (i2 = 0; i2 < length3; ++i2, startingIndex += Cartesian3_default.packedLength) {
  53645. Cartesian3_default.pack(positions[i2], array, startingIndex);
  53646. }
  53647. const colors = value._colors;
  53648. length3 = defined_default(colors) ? colors.length : 0;
  53649. array[startingIndex++] = length3;
  53650. for (i2 = 0; i2 < length3; ++i2, startingIndex += Color_default.packedLength) {
  53651. Color_default.pack(colors[i2], array, startingIndex);
  53652. }
  53653. Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
  53654. startingIndex += Ellipsoid_default.packedLength;
  53655. array[startingIndex++] = value._colorsPerVertex ? 1 : 0;
  53656. array[startingIndex++] = value._arcType;
  53657. array[startingIndex] = value._granularity;
  53658. return array;
  53659. };
  53660. SimplePolylineGeometry.unpack = function(array, startingIndex, result) {
  53661. if (!defined_default(array)) {
  53662. throw new DeveloperError_default("array is required");
  53663. }
  53664. startingIndex = defaultValue_default(startingIndex, 0);
  53665. let i2;
  53666. let length3 = array[startingIndex++];
  53667. const positions = new Array(length3);
  53668. for (i2 = 0; i2 < length3; ++i2, startingIndex += Cartesian3_default.packedLength) {
  53669. positions[i2] = Cartesian3_default.unpack(array, startingIndex);
  53670. }
  53671. length3 = array[startingIndex++];
  53672. const colors = length3 > 0 ? new Array(length3) : void 0;
  53673. for (i2 = 0; i2 < length3; ++i2, startingIndex += Color_default.packedLength) {
  53674. colors[i2] = Color_default.unpack(array, startingIndex);
  53675. }
  53676. const ellipsoid = Ellipsoid_default.unpack(array, startingIndex);
  53677. startingIndex += Ellipsoid_default.packedLength;
  53678. const colorsPerVertex = array[startingIndex++] === 1;
  53679. const arcType = array[startingIndex++];
  53680. const granularity = array[startingIndex];
  53681. if (!defined_default(result)) {
  53682. return new SimplePolylineGeometry({
  53683. positions,
  53684. colors,
  53685. ellipsoid,
  53686. colorsPerVertex,
  53687. arcType,
  53688. granularity
  53689. });
  53690. }
  53691. result._positions = positions;
  53692. result._colors = colors;
  53693. result._ellipsoid = ellipsoid;
  53694. result._colorsPerVertex = colorsPerVertex;
  53695. result._arcType = arcType;
  53696. result._granularity = granularity;
  53697. return result;
  53698. };
  53699. var scratchArray1 = new Array(2);
  53700. var scratchArray2 = new Array(2);
  53701. var generateArcOptionsScratch = {
  53702. positions: scratchArray1,
  53703. height: scratchArray2,
  53704. ellipsoid: void 0,
  53705. minDistance: void 0,
  53706. granularity: void 0
  53707. };
  53708. SimplePolylineGeometry.createGeometry = function(simplePolylineGeometry) {
  53709. const positions = simplePolylineGeometry._positions;
  53710. const colors = simplePolylineGeometry._colors;
  53711. const colorsPerVertex = simplePolylineGeometry._colorsPerVertex;
  53712. const arcType = simplePolylineGeometry._arcType;
  53713. const granularity = simplePolylineGeometry._granularity;
  53714. const ellipsoid = simplePolylineGeometry._ellipsoid;
  53715. const minDistance = Math_default.chordLength(
  53716. granularity,
  53717. ellipsoid.maximumRadius
  53718. );
  53719. const perSegmentColors = defined_default(colors) && !colorsPerVertex;
  53720. let i2;
  53721. const length3 = positions.length;
  53722. let positionValues;
  53723. let numberOfPositions;
  53724. let colorValues;
  53725. let color;
  53726. let offset2 = 0;
  53727. if (arcType === ArcType_default.GEODESIC || arcType === ArcType_default.RHUMB) {
  53728. let subdivisionSize;
  53729. let numberOfPointsFunction;
  53730. let generateArcFunction;
  53731. if (arcType === ArcType_default.GEODESIC) {
  53732. subdivisionSize = Math_default.chordLength(
  53733. granularity,
  53734. ellipsoid.maximumRadius
  53735. );
  53736. numberOfPointsFunction = PolylinePipeline_default.numberOfPoints;
  53737. generateArcFunction = PolylinePipeline_default.generateArc;
  53738. } else {
  53739. subdivisionSize = granularity;
  53740. numberOfPointsFunction = PolylinePipeline_default.numberOfPointsRhumbLine;
  53741. generateArcFunction = PolylinePipeline_default.generateRhumbArc;
  53742. }
  53743. const heights = PolylinePipeline_default.extractHeights(positions, ellipsoid);
  53744. const generateArcOptions = generateArcOptionsScratch;
  53745. if (arcType === ArcType_default.GEODESIC) {
  53746. generateArcOptions.minDistance = minDistance;
  53747. } else {
  53748. generateArcOptions.granularity = granularity;
  53749. }
  53750. generateArcOptions.ellipsoid = ellipsoid;
  53751. if (perSegmentColors) {
  53752. let positionCount = 0;
  53753. for (i2 = 0; i2 < length3 - 1; i2++) {
  53754. positionCount += numberOfPointsFunction(
  53755. positions[i2],
  53756. positions[i2 + 1],
  53757. subdivisionSize
  53758. ) + 1;
  53759. }
  53760. positionValues = new Float64Array(positionCount * 3);
  53761. colorValues = new Uint8Array(positionCount * 4);
  53762. generateArcOptions.positions = scratchArray1;
  53763. generateArcOptions.height = scratchArray2;
  53764. let ci = 0;
  53765. for (i2 = 0; i2 < length3 - 1; ++i2) {
  53766. scratchArray1[0] = positions[i2];
  53767. scratchArray1[1] = positions[i2 + 1];
  53768. scratchArray2[0] = heights[i2];
  53769. scratchArray2[1] = heights[i2 + 1];
  53770. const pos = generateArcFunction(generateArcOptions);
  53771. if (defined_default(colors)) {
  53772. const segLen = pos.length / 3;
  53773. color = colors[i2];
  53774. for (let k = 0; k < segLen; ++k) {
  53775. colorValues[ci++] = Color_default.floatToByte(color.red);
  53776. colorValues[ci++] = Color_default.floatToByte(color.green);
  53777. colorValues[ci++] = Color_default.floatToByte(color.blue);
  53778. colorValues[ci++] = Color_default.floatToByte(color.alpha);
  53779. }
  53780. }
  53781. positionValues.set(pos, offset2);
  53782. offset2 += pos.length;
  53783. }
  53784. } else {
  53785. generateArcOptions.positions = positions;
  53786. generateArcOptions.height = heights;
  53787. positionValues = new Float64Array(
  53788. generateArcFunction(generateArcOptions)
  53789. );
  53790. if (defined_default(colors)) {
  53791. colorValues = new Uint8Array(positionValues.length / 3 * 4);
  53792. for (i2 = 0; i2 < length3 - 1; ++i2) {
  53793. const p0 = positions[i2];
  53794. const p1 = positions[i2 + 1];
  53795. const c0 = colors[i2];
  53796. const c14 = colors[i2 + 1];
  53797. offset2 = interpolateColors2(
  53798. p0,
  53799. p1,
  53800. c0,
  53801. c14,
  53802. minDistance,
  53803. colorValues,
  53804. offset2
  53805. );
  53806. }
  53807. const lastColor = colors[length3 - 1];
  53808. colorValues[offset2++] = Color_default.floatToByte(lastColor.red);
  53809. colorValues[offset2++] = Color_default.floatToByte(lastColor.green);
  53810. colorValues[offset2++] = Color_default.floatToByte(lastColor.blue);
  53811. colorValues[offset2++] = Color_default.floatToByte(lastColor.alpha);
  53812. }
  53813. }
  53814. } else {
  53815. numberOfPositions = perSegmentColors ? length3 * 2 - 2 : length3;
  53816. positionValues = new Float64Array(numberOfPositions * 3);
  53817. colorValues = defined_default(colors) ? new Uint8Array(numberOfPositions * 4) : void 0;
  53818. let positionIndex = 0;
  53819. let colorIndex = 0;
  53820. for (i2 = 0; i2 < length3; ++i2) {
  53821. const p2 = positions[i2];
  53822. if (perSegmentColors && i2 > 0) {
  53823. Cartesian3_default.pack(p2, positionValues, positionIndex);
  53824. positionIndex += 3;
  53825. color = colors[i2 - 1];
  53826. colorValues[colorIndex++] = Color_default.floatToByte(color.red);
  53827. colorValues[colorIndex++] = Color_default.floatToByte(color.green);
  53828. colorValues[colorIndex++] = Color_default.floatToByte(color.blue);
  53829. colorValues[colorIndex++] = Color_default.floatToByte(color.alpha);
  53830. }
  53831. if (perSegmentColors && i2 === length3 - 1) {
  53832. break;
  53833. }
  53834. Cartesian3_default.pack(p2, positionValues, positionIndex);
  53835. positionIndex += 3;
  53836. if (defined_default(colors)) {
  53837. color = colors[i2];
  53838. colorValues[colorIndex++] = Color_default.floatToByte(color.red);
  53839. colorValues[colorIndex++] = Color_default.floatToByte(color.green);
  53840. colorValues[colorIndex++] = Color_default.floatToByte(color.blue);
  53841. colorValues[colorIndex++] = Color_default.floatToByte(color.alpha);
  53842. }
  53843. }
  53844. }
  53845. const attributes = new GeometryAttributes_default();
  53846. attributes.position = new GeometryAttribute_default({
  53847. componentDatatype: ComponentDatatype_default.DOUBLE,
  53848. componentsPerAttribute: 3,
  53849. values: positionValues
  53850. });
  53851. if (defined_default(colors)) {
  53852. attributes.color = new GeometryAttribute_default({
  53853. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  53854. componentsPerAttribute: 4,
  53855. values: colorValues,
  53856. normalize: true
  53857. });
  53858. }
  53859. numberOfPositions = positionValues.length / 3;
  53860. const numberOfIndices = (numberOfPositions - 1) * 2;
  53861. const indices2 = IndexDatatype_default.createTypedArray(
  53862. numberOfPositions,
  53863. numberOfIndices
  53864. );
  53865. let index2 = 0;
  53866. for (i2 = 0; i2 < numberOfPositions - 1; ++i2) {
  53867. indices2[index2++] = i2;
  53868. indices2[index2++] = i2 + 1;
  53869. }
  53870. return new Geometry_default({
  53871. attributes,
  53872. indices: indices2,
  53873. primitiveType: PrimitiveType_default.LINES,
  53874. boundingSphere: BoundingSphere_default.fromPoints(positions)
  53875. });
  53876. };
  53877. var SimplePolylineGeometry_default = SimplePolylineGeometry;
  53878. // node_modules/cesium/Source/Core/SphereGeometry.js
  53879. function SphereGeometry(options) {
  53880. const radius = defaultValue_default(options.radius, 1);
  53881. const radii = new Cartesian3_default(radius, radius, radius);
  53882. const ellipsoidOptions = {
  53883. radii,
  53884. stackPartitions: options.stackPartitions,
  53885. slicePartitions: options.slicePartitions,
  53886. vertexFormat: options.vertexFormat
  53887. };
  53888. this._ellipsoidGeometry = new EllipsoidGeometry_default(ellipsoidOptions);
  53889. this._workerName = "createSphereGeometry";
  53890. }
  53891. SphereGeometry.packedLength = EllipsoidGeometry_default.packedLength;
  53892. SphereGeometry.pack = function(value, array, startingIndex) {
  53893. Check_default.typeOf.object("value", value);
  53894. return EllipsoidGeometry_default.pack(value._ellipsoidGeometry, array, startingIndex);
  53895. };
  53896. var scratchEllipsoidGeometry = new EllipsoidGeometry_default();
  53897. var scratchOptions21 = {
  53898. radius: void 0,
  53899. radii: new Cartesian3_default(),
  53900. vertexFormat: new VertexFormat_default(),
  53901. stackPartitions: void 0,
  53902. slicePartitions: void 0
  53903. };
  53904. SphereGeometry.unpack = function(array, startingIndex, result) {
  53905. const ellipsoidGeometry = EllipsoidGeometry_default.unpack(
  53906. array,
  53907. startingIndex,
  53908. scratchEllipsoidGeometry
  53909. );
  53910. scratchOptions21.vertexFormat = VertexFormat_default.clone(
  53911. ellipsoidGeometry._vertexFormat,
  53912. scratchOptions21.vertexFormat
  53913. );
  53914. scratchOptions21.stackPartitions = ellipsoidGeometry._stackPartitions;
  53915. scratchOptions21.slicePartitions = ellipsoidGeometry._slicePartitions;
  53916. if (!defined_default(result)) {
  53917. scratchOptions21.radius = ellipsoidGeometry._radii.x;
  53918. return new SphereGeometry(scratchOptions21);
  53919. }
  53920. Cartesian3_default.clone(ellipsoidGeometry._radii, scratchOptions21.radii);
  53921. result._ellipsoidGeometry = new EllipsoidGeometry_default(scratchOptions21);
  53922. return result;
  53923. };
  53924. SphereGeometry.createGeometry = function(sphereGeometry) {
  53925. return EllipsoidGeometry_default.createGeometry(sphereGeometry._ellipsoidGeometry);
  53926. };
  53927. var SphereGeometry_default = SphereGeometry;
  53928. // node_modules/cesium/Source/Core/SphereOutlineGeometry.js
  53929. function SphereOutlineGeometry(options) {
  53930. const radius = defaultValue_default(options.radius, 1);
  53931. const radii = new Cartesian3_default(radius, radius, radius);
  53932. const ellipsoidOptions = {
  53933. radii,
  53934. stackPartitions: options.stackPartitions,
  53935. slicePartitions: options.slicePartitions,
  53936. subdivisions: options.subdivisions
  53937. };
  53938. this._ellipsoidGeometry = new EllipsoidOutlineGeometry_default(ellipsoidOptions);
  53939. this._workerName = "createSphereOutlineGeometry";
  53940. }
  53941. SphereOutlineGeometry.packedLength = EllipsoidOutlineGeometry_default.packedLength;
  53942. SphereOutlineGeometry.pack = function(value, array, startingIndex) {
  53943. Check_default.typeOf.object("value", value);
  53944. return EllipsoidOutlineGeometry_default.pack(
  53945. value._ellipsoidGeometry,
  53946. array,
  53947. startingIndex
  53948. );
  53949. };
  53950. var scratchEllipsoidGeometry2 = new EllipsoidOutlineGeometry_default();
  53951. var scratchOptions22 = {
  53952. radius: void 0,
  53953. radii: new Cartesian3_default(),
  53954. stackPartitions: void 0,
  53955. slicePartitions: void 0,
  53956. subdivisions: void 0
  53957. };
  53958. SphereOutlineGeometry.unpack = function(array, startingIndex, result) {
  53959. const ellipsoidGeometry = EllipsoidOutlineGeometry_default.unpack(
  53960. array,
  53961. startingIndex,
  53962. scratchEllipsoidGeometry2
  53963. );
  53964. scratchOptions22.stackPartitions = ellipsoidGeometry._stackPartitions;
  53965. scratchOptions22.slicePartitions = ellipsoidGeometry._slicePartitions;
  53966. scratchOptions22.subdivisions = ellipsoidGeometry._subdivisions;
  53967. if (!defined_default(result)) {
  53968. scratchOptions22.radius = ellipsoidGeometry._radii.x;
  53969. return new SphereOutlineGeometry(scratchOptions22);
  53970. }
  53971. Cartesian3_default.clone(ellipsoidGeometry._radii, scratchOptions22.radii);
  53972. result._ellipsoidGeometry = new EllipsoidOutlineGeometry_default(scratchOptions22);
  53973. return result;
  53974. };
  53975. SphereOutlineGeometry.createGeometry = function(sphereGeometry) {
  53976. return EllipsoidOutlineGeometry_default.createGeometry(
  53977. sphereGeometry._ellipsoidGeometry
  53978. );
  53979. };
  53980. var SphereOutlineGeometry_default = SphereOutlineGeometry;
  53981. // node_modules/cesium/Source/Core/Spherical.js
  53982. function Spherical(clock, cone, magnitude) {
  53983. this.clock = defaultValue_default(clock, 0);
  53984. this.cone = defaultValue_default(cone, 0);
  53985. this.magnitude = defaultValue_default(magnitude, 1);
  53986. }
  53987. Spherical.fromCartesian3 = function(cartesian34, result) {
  53988. Check_default.typeOf.object("cartesian3", cartesian34);
  53989. const x = cartesian34.x;
  53990. const y = cartesian34.y;
  53991. const z = cartesian34.z;
  53992. const radialSquared = x * x + y * y;
  53993. if (!defined_default(result)) {
  53994. result = new Spherical();
  53995. }
  53996. result.clock = Math.atan2(y, x);
  53997. result.cone = Math.atan2(Math.sqrt(radialSquared), z);
  53998. result.magnitude = Math.sqrt(radialSquared + z * z);
  53999. return result;
  54000. };
  54001. Spherical.clone = function(spherical, result) {
  54002. if (!defined_default(spherical)) {
  54003. return void 0;
  54004. }
  54005. if (!defined_default(result)) {
  54006. return new Spherical(spherical.clock, spherical.cone, spherical.magnitude);
  54007. }
  54008. result.clock = spherical.clock;
  54009. result.cone = spherical.cone;
  54010. result.magnitude = spherical.magnitude;
  54011. return result;
  54012. };
  54013. Spherical.normalize = function(spherical, result) {
  54014. Check_default.typeOf.object("spherical", spherical);
  54015. if (!defined_default(result)) {
  54016. return new Spherical(spherical.clock, spherical.cone, 1);
  54017. }
  54018. result.clock = spherical.clock;
  54019. result.cone = spherical.cone;
  54020. result.magnitude = 1;
  54021. return result;
  54022. };
  54023. Spherical.equals = function(left, right) {
  54024. return left === right || defined_default(left) && defined_default(right) && left.clock === right.clock && left.cone === right.cone && left.magnitude === right.magnitude;
  54025. };
  54026. Spherical.equalsEpsilon = function(left, right, epsilon) {
  54027. epsilon = defaultValue_default(epsilon, 0);
  54028. return left === right || defined_default(left) && defined_default(right) && Math.abs(left.clock - right.clock) <= epsilon && Math.abs(left.cone - right.cone) <= epsilon && Math.abs(left.magnitude - right.magnitude) <= epsilon;
  54029. };
  54030. Spherical.prototype.equals = function(other) {
  54031. return Spherical.equals(this, other);
  54032. };
  54033. Spherical.prototype.clone = function(result) {
  54034. return Spherical.clone(this, result);
  54035. };
  54036. Spherical.prototype.equalsEpsilon = function(other, epsilon) {
  54037. return Spherical.equalsEpsilon(this, other, epsilon);
  54038. };
  54039. Spherical.prototype.toString = function() {
  54040. return `(${this.clock}, ${this.cone}, ${this.magnitude})`;
  54041. };
  54042. var Spherical_default = Spherical;
  54043. // node_modules/cesium/Source/Core/SteppedSpline.js
  54044. function SteppedSpline(options) {
  54045. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  54046. const points = options.points;
  54047. const times = options.times;
  54048. if (!defined_default(points) || !defined_default(times)) {
  54049. throw new DeveloperError_default("points and times are required.");
  54050. }
  54051. if (points.length < 2) {
  54052. throw new DeveloperError_default(
  54053. "points.length must be greater than or equal to 2."
  54054. );
  54055. }
  54056. if (times.length !== points.length) {
  54057. throw new DeveloperError_default("times.length must be equal to points.length.");
  54058. }
  54059. this._times = times;
  54060. this._points = points;
  54061. this._pointType = Spline_default.getPointType(points[0]);
  54062. this._lastTimeIndex = 0;
  54063. }
  54064. Object.defineProperties(SteppedSpline.prototype, {
  54065. times: {
  54066. get: function() {
  54067. return this._times;
  54068. }
  54069. },
  54070. points: {
  54071. get: function() {
  54072. return this._points;
  54073. }
  54074. }
  54075. });
  54076. SteppedSpline.prototype.findTimeInterval = Spline_default.prototype.findTimeInterval;
  54077. SteppedSpline.prototype.wrapTime = Spline_default.prototype.wrapTime;
  54078. SteppedSpline.prototype.clampTime = Spline_default.prototype.clampTime;
  54079. SteppedSpline.prototype.evaluate = function(time, result) {
  54080. const points = this.points;
  54081. this._lastTimeIndex = this.findTimeInterval(time, this._lastTimeIndex);
  54082. const i2 = this._lastTimeIndex;
  54083. const PointType = this._pointType;
  54084. if (PointType === Number) {
  54085. return points[i2];
  54086. }
  54087. if (!defined_default(result)) {
  54088. result = new PointType();
  54089. }
  54090. return PointType.clone(points[i2], result);
  54091. };
  54092. var SteppedSpline_default = SteppedSpline;
  54093. // node_modules/cesium/Source/Core/TileEdge.js
  54094. var TileEdge = {
  54095. WEST: 0,
  54096. NORTH: 1,
  54097. EAST: 2,
  54098. SOUTH: 3,
  54099. NORTHWEST: 4,
  54100. NORTHEAST: 5,
  54101. SOUTHWEST: 6,
  54102. SOUTHEAST: 7
  54103. };
  54104. var TileEdge_default = TileEdge;
  54105. // node_modules/cesium/Source/Core/TilingScheme.js
  54106. function TilingScheme(options) {
  54107. throw new DeveloperError_default(
  54108. "This type should not be instantiated directly. Instead, use WebMercatorTilingScheme or GeographicTilingScheme."
  54109. );
  54110. }
  54111. Object.defineProperties(TilingScheme.prototype, {
  54112. ellipsoid: {
  54113. get: DeveloperError_default.throwInstantiationError
  54114. },
  54115. rectangle: {
  54116. get: DeveloperError_default.throwInstantiationError
  54117. },
  54118. projection: {
  54119. get: DeveloperError_default.throwInstantiationError
  54120. }
  54121. });
  54122. TilingScheme.prototype.getNumberOfXTilesAtLevel = DeveloperError_default.throwInstantiationError;
  54123. TilingScheme.prototype.getNumberOfYTilesAtLevel = DeveloperError_default.throwInstantiationError;
  54124. TilingScheme.prototype.rectangleToNativeRectangle = DeveloperError_default.throwInstantiationError;
  54125. TilingScheme.prototype.tileXYToNativeRectangle = DeveloperError_default.throwInstantiationError;
  54126. TilingScheme.prototype.tileXYToRectangle = DeveloperError_default.throwInstantiationError;
  54127. TilingScheme.prototype.positionToTileXY = DeveloperError_default.throwInstantiationError;
  54128. var TilingScheme_default = TilingScheme;
  54129. // node_modules/cesium/Source/Core/TimeIntervalCollection.js
  54130. function compareIntervalStartTimes(left, right) {
  54131. return JulianDate_default.compare(left.start, right.start);
  54132. }
  54133. function TimeIntervalCollection(intervals) {
  54134. this._intervals = [];
  54135. this._changedEvent = new Event_default();
  54136. if (defined_default(intervals)) {
  54137. const length3 = intervals.length;
  54138. for (let i2 = 0; i2 < length3; i2++) {
  54139. this.addInterval(intervals[i2]);
  54140. }
  54141. }
  54142. }
  54143. Object.defineProperties(TimeIntervalCollection.prototype, {
  54144. changedEvent: {
  54145. get: function() {
  54146. return this._changedEvent;
  54147. }
  54148. },
  54149. start: {
  54150. get: function() {
  54151. const intervals = this._intervals;
  54152. return intervals.length === 0 ? void 0 : intervals[0].start;
  54153. }
  54154. },
  54155. isStartIncluded: {
  54156. get: function() {
  54157. const intervals = this._intervals;
  54158. return intervals.length === 0 ? false : intervals[0].isStartIncluded;
  54159. }
  54160. },
  54161. stop: {
  54162. get: function() {
  54163. const intervals = this._intervals;
  54164. const length3 = intervals.length;
  54165. return length3 === 0 ? void 0 : intervals[length3 - 1].stop;
  54166. }
  54167. },
  54168. isStopIncluded: {
  54169. get: function() {
  54170. const intervals = this._intervals;
  54171. const length3 = intervals.length;
  54172. return length3 === 0 ? false : intervals[length3 - 1].isStopIncluded;
  54173. }
  54174. },
  54175. length: {
  54176. get: function() {
  54177. return this._intervals.length;
  54178. }
  54179. },
  54180. isEmpty: {
  54181. get: function() {
  54182. return this._intervals.length === 0;
  54183. }
  54184. }
  54185. });
  54186. TimeIntervalCollection.prototype.equals = function(right, dataComparer) {
  54187. if (this === right) {
  54188. return true;
  54189. }
  54190. if (!(right instanceof TimeIntervalCollection)) {
  54191. return false;
  54192. }
  54193. const intervals = this._intervals;
  54194. const rightIntervals = right._intervals;
  54195. const length3 = intervals.length;
  54196. if (length3 !== rightIntervals.length) {
  54197. return false;
  54198. }
  54199. for (let i2 = 0; i2 < length3; i2++) {
  54200. if (!TimeInterval_default.equals(intervals[i2], rightIntervals[i2], dataComparer)) {
  54201. return false;
  54202. }
  54203. }
  54204. return true;
  54205. };
  54206. TimeIntervalCollection.prototype.get = function(index2) {
  54207. if (!defined_default(index2)) {
  54208. throw new DeveloperError_default("index is required.");
  54209. }
  54210. return this._intervals[index2];
  54211. };
  54212. TimeIntervalCollection.prototype.removeAll = function() {
  54213. if (this._intervals.length > 0) {
  54214. this._intervals.length = 0;
  54215. this._changedEvent.raiseEvent(this);
  54216. }
  54217. };
  54218. TimeIntervalCollection.prototype.findIntervalContainingDate = function(date) {
  54219. const index2 = this.indexOf(date);
  54220. return index2 >= 0 ? this._intervals[index2] : void 0;
  54221. };
  54222. TimeIntervalCollection.prototype.findDataForIntervalContainingDate = function(date) {
  54223. const index2 = this.indexOf(date);
  54224. return index2 >= 0 ? this._intervals[index2].data : void 0;
  54225. };
  54226. TimeIntervalCollection.prototype.contains = function(julianDate) {
  54227. return this.indexOf(julianDate) >= 0;
  54228. };
  54229. var indexOfScratch = new TimeInterval_default();
  54230. TimeIntervalCollection.prototype.indexOf = function(date) {
  54231. if (!defined_default(date)) {
  54232. throw new DeveloperError_default("date is required");
  54233. }
  54234. const intervals = this._intervals;
  54235. indexOfScratch.start = date;
  54236. indexOfScratch.stop = date;
  54237. let index2 = binarySearch_default(
  54238. intervals,
  54239. indexOfScratch,
  54240. compareIntervalStartTimes
  54241. );
  54242. if (index2 >= 0) {
  54243. if (intervals[index2].isStartIncluded) {
  54244. return index2;
  54245. }
  54246. if (index2 > 0 && intervals[index2 - 1].stop.equals(date) && intervals[index2 - 1].isStopIncluded) {
  54247. return index2 - 1;
  54248. }
  54249. return ~index2;
  54250. }
  54251. index2 = ~index2;
  54252. if (index2 > 0 && index2 - 1 < intervals.length && TimeInterval_default.contains(intervals[index2 - 1], date)) {
  54253. return index2 - 1;
  54254. }
  54255. return ~index2;
  54256. };
  54257. TimeIntervalCollection.prototype.findInterval = function(options) {
  54258. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  54259. const start = options.start;
  54260. const stop2 = options.stop;
  54261. const isStartIncluded = options.isStartIncluded;
  54262. const isStopIncluded = options.isStopIncluded;
  54263. const intervals = this._intervals;
  54264. for (let i2 = 0, len = intervals.length; i2 < len; i2++) {
  54265. const interval = intervals[i2];
  54266. if ((!defined_default(start) || interval.start.equals(start)) && (!defined_default(stop2) || interval.stop.equals(stop2)) && (!defined_default(isStartIncluded) || interval.isStartIncluded === isStartIncluded) && (!defined_default(isStopIncluded) || interval.isStopIncluded === isStopIncluded)) {
  54267. return intervals[i2];
  54268. }
  54269. }
  54270. return void 0;
  54271. };
  54272. TimeIntervalCollection.prototype.addInterval = function(interval, dataComparer) {
  54273. if (!defined_default(interval)) {
  54274. throw new DeveloperError_default("interval is required");
  54275. }
  54276. if (interval.isEmpty) {
  54277. return;
  54278. }
  54279. const intervals = this._intervals;
  54280. if (intervals.length === 0 || JulianDate_default.greaterThan(interval.start, intervals[intervals.length - 1].stop)) {
  54281. intervals.push(interval);
  54282. this._changedEvent.raiseEvent(this);
  54283. return;
  54284. }
  54285. let index2 = binarySearch_default(intervals, interval, compareIntervalStartTimes);
  54286. if (index2 < 0) {
  54287. index2 = ~index2;
  54288. } else {
  54289. if (index2 > 0 && interval.isStartIncluded && intervals[index2 - 1].isStartIncluded && intervals[index2 - 1].start.equals(interval.start)) {
  54290. --index2;
  54291. } else if (index2 < intervals.length && !interval.isStartIncluded && intervals[index2].isStartIncluded && intervals[index2].start.equals(interval.start)) {
  54292. ++index2;
  54293. }
  54294. }
  54295. let comparison;
  54296. if (index2 > 0) {
  54297. comparison = JulianDate_default.compare(intervals[index2 - 1].stop, interval.start);
  54298. if (comparison > 0 || comparison === 0 && (intervals[index2 - 1].isStopIncluded || interval.isStartIncluded)) {
  54299. if (defined_default(dataComparer) ? dataComparer(intervals[index2 - 1].data, interval.data) : intervals[index2 - 1].data === interval.data) {
  54300. if (JulianDate_default.greaterThan(interval.stop, intervals[index2 - 1].stop)) {
  54301. interval = new TimeInterval_default({
  54302. start: intervals[index2 - 1].start,
  54303. stop: interval.stop,
  54304. isStartIncluded: intervals[index2 - 1].isStartIncluded,
  54305. isStopIncluded: interval.isStopIncluded,
  54306. data: interval.data
  54307. });
  54308. } else {
  54309. interval = new TimeInterval_default({
  54310. start: intervals[index2 - 1].start,
  54311. stop: intervals[index2 - 1].stop,
  54312. isStartIncluded: intervals[index2 - 1].isStartIncluded,
  54313. isStopIncluded: intervals[index2 - 1].isStopIncluded || interval.stop.equals(intervals[index2 - 1].stop) && interval.isStopIncluded,
  54314. data: interval.data
  54315. });
  54316. }
  54317. intervals.splice(index2 - 1, 1);
  54318. --index2;
  54319. } else {
  54320. comparison = JulianDate_default.compare(
  54321. intervals[index2 - 1].stop,
  54322. interval.stop
  54323. );
  54324. if (comparison > 0 || comparison === 0 && intervals[index2 - 1].isStopIncluded && !interval.isStopIncluded) {
  54325. intervals.splice(
  54326. index2,
  54327. 0,
  54328. new TimeInterval_default({
  54329. start: interval.stop,
  54330. stop: intervals[index2 - 1].stop,
  54331. isStartIncluded: !interval.isStopIncluded,
  54332. isStopIncluded: intervals[index2 - 1].isStopIncluded,
  54333. data: intervals[index2 - 1].data
  54334. })
  54335. );
  54336. }
  54337. intervals[index2 - 1] = new TimeInterval_default({
  54338. start: intervals[index2 - 1].start,
  54339. stop: interval.start,
  54340. isStartIncluded: intervals[index2 - 1].isStartIncluded,
  54341. isStopIncluded: !interval.isStartIncluded,
  54342. data: intervals[index2 - 1].data
  54343. });
  54344. }
  54345. }
  54346. }
  54347. while (index2 < intervals.length) {
  54348. comparison = JulianDate_default.compare(interval.stop, intervals[index2].start);
  54349. if (comparison > 0 || comparison === 0 && (interval.isStopIncluded || intervals[index2].isStartIncluded)) {
  54350. if (defined_default(dataComparer) ? dataComparer(intervals[index2].data, interval.data) : intervals[index2].data === interval.data) {
  54351. interval = new TimeInterval_default({
  54352. start: interval.start,
  54353. stop: JulianDate_default.greaterThan(intervals[index2].stop, interval.stop) ? intervals[index2].stop : interval.stop,
  54354. isStartIncluded: interval.isStartIncluded,
  54355. isStopIncluded: JulianDate_default.greaterThan(
  54356. intervals[index2].stop,
  54357. interval.stop
  54358. ) ? intervals[index2].isStopIncluded : interval.isStopIncluded,
  54359. data: interval.data
  54360. });
  54361. intervals.splice(index2, 1);
  54362. } else {
  54363. intervals[index2] = new TimeInterval_default({
  54364. start: interval.stop,
  54365. stop: intervals[index2].stop,
  54366. isStartIncluded: !interval.isStopIncluded,
  54367. isStopIncluded: intervals[index2].isStopIncluded,
  54368. data: intervals[index2].data
  54369. });
  54370. if (intervals[index2].isEmpty) {
  54371. intervals.splice(index2, 1);
  54372. } else {
  54373. break;
  54374. }
  54375. }
  54376. } else {
  54377. break;
  54378. }
  54379. }
  54380. intervals.splice(index2, 0, interval);
  54381. this._changedEvent.raiseEvent(this);
  54382. };
  54383. TimeIntervalCollection.prototype.removeInterval = function(interval) {
  54384. if (!defined_default(interval)) {
  54385. throw new DeveloperError_default("interval is required");
  54386. }
  54387. if (interval.isEmpty) {
  54388. return false;
  54389. }
  54390. const intervals = this._intervals;
  54391. let index2 = binarySearch_default(intervals, interval, compareIntervalStartTimes);
  54392. if (index2 < 0) {
  54393. index2 = ~index2;
  54394. }
  54395. let result = false;
  54396. if (index2 > 0 && (JulianDate_default.greaterThan(intervals[index2 - 1].stop, interval.start) || intervals[index2 - 1].stop.equals(interval.start) && intervals[index2 - 1].isStopIncluded && interval.isStartIncluded)) {
  54397. result = true;
  54398. if (JulianDate_default.greaterThan(intervals[index2 - 1].stop, interval.stop) || intervals[index2 - 1].isStopIncluded && !interval.isStopIncluded && intervals[index2 - 1].stop.equals(interval.stop)) {
  54399. intervals.splice(
  54400. index2,
  54401. 0,
  54402. new TimeInterval_default({
  54403. start: interval.stop,
  54404. stop: intervals[index2 - 1].stop,
  54405. isStartIncluded: !interval.isStopIncluded,
  54406. isStopIncluded: intervals[index2 - 1].isStopIncluded,
  54407. data: intervals[index2 - 1].data
  54408. })
  54409. );
  54410. }
  54411. intervals[index2 - 1] = new TimeInterval_default({
  54412. start: intervals[index2 - 1].start,
  54413. stop: interval.start,
  54414. isStartIncluded: intervals[index2 - 1].isStartIncluded,
  54415. isStopIncluded: !interval.isStartIncluded,
  54416. data: intervals[index2 - 1].data
  54417. });
  54418. }
  54419. if (index2 < intervals.length && !interval.isStartIncluded && intervals[index2].isStartIncluded && interval.start.equals(intervals[index2].start)) {
  54420. result = true;
  54421. intervals.splice(
  54422. index2,
  54423. 0,
  54424. new TimeInterval_default({
  54425. start: intervals[index2].start,
  54426. stop: intervals[index2].start,
  54427. isStartIncluded: true,
  54428. isStopIncluded: true,
  54429. data: intervals[index2].data
  54430. })
  54431. );
  54432. ++index2;
  54433. }
  54434. while (index2 < intervals.length && JulianDate_default.greaterThan(interval.stop, intervals[index2].stop)) {
  54435. result = true;
  54436. intervals.splice(index2, 1);
  54437. }
  54438. if (index2 < intervals.length && interval.stop.equals(intervals[index2].stop)) {
  54439. result = true;
  54440. if (!interval.isStopIncluded && intervals[index2].isStopIncluded) {
  54441. if (index2 + 1 < intervals.length && intervals[index2 + 1].start.equals(interval.stop) && intervals[index2].data === intervals[index2 + 1].data) {
  54442. intervals.splice(index2, 1);
  54443. intervals[index2] = new TimeInterval_default({
  54444. start: intervals[index2].start,
  54445. stop: intervals[index2].stop,
  54446. isStartIncluded: true,
  54447. isStopIncluded: intervals[index2].isStopIncluded,
  54448. data: intervals[index2].data
  54449. });
  54450. } else {
  54451. intervals[index2] = new TimeInterval_default({
  54452. start: interval.stop,
  54453. stop: interval.stop,
  54454. isStartIncluded: true,
  54455. isStopIncluded: true,
  54456. data: intervals[index2].data
  54457. });
  54458. }
  54459. } else {
  54460. intervals.splice(index2, 1);
  54461. }
  54462. }
  54463. if (index2 < intervals.length && (JulianDate_default.greaterThan(interval.stop, intervals[index2].start) || interval.stop.equals(intervals[index2].start) && interval.isStopIncluded && intervals[index2].isStartIncluded)) {
  54464. result = true;
  54465. intervals[index2] = new TimeInterval_default({
  54466. start: interval.stop,
  54467. stop: intervals[index2].stop,
  54468. isStartIncluded: !interval.isStopIncluded,
  54469. isStopIncluded: intervals[index2].isStopIncluded,
  54470. data: intervals[index2].data
  54471. });
  54472. }
  54473. if (result) {
  54474. this._changedEvent.raiseEvent(this);
  54475. }
  54476. return result;
  54477. };
  54478. TimeIntervalCollection.prototype.intersect = function(other, dataComparer, mergeCallback) {
  54479. if (!defined_default(other)) {
  54480. throw new DeveloperError_default("other is required.");
  54481. }
  54482. const result = new TimeIntervalCollection();
  54483. let left = 0;
  54484. let right = 0;
  54485. const intervals = this._intervals;
  54486. const otherIntervals = other._intervals;
  54487. while (left < intervals.length && right < otherIntervals.length) {
  54488. const leftInterval = intervals[left];
  54489. const rightInterval = otherIntervals[right];
  54490. if (JulianDate_default.lessThan(leftInterval.stop, rightInterval.start)) {
  54491. ++left;
  54492. } else if (JulianDate_default.lessThan(rightInterval.stop, leftInterval.start)) {
  54493. ++right;
  54494. } else {
  54495. if (defined_default(mergeCallback) || defined_default(dataComparer) && dataComparer(leftInterval.data, rightInterval.data) || !defined_default(dataComparer) && rightInterval.data === leftInterval.data) {
  54496. const intersection = TimeInterval_default.intersect(
  54497. leftInterval,
  54498. rightInterval,
  54499. new TimeInterval_default(),
  54500. mergeCallback
  54501. );
  54502. if (!intersection.isEmpty) {
  54503. result.addInterval(intersection, dataComparer);
  54504. }
  54505. }
  54506. if (JulianDate_default.lessThan(leftInterval.stop, rightInterval.stop) || leftInterval.stop.equals(rightInterval.stop) && !leftInterval.isStopIncluded && rightInterval.isStopIncluded) {
  54507. ++left;
  54508. } else {
  54509. ++right;
  54510. }
  54511. }
  54512. }
  54513. return result;
  54514. };
  54515. TimeIntervalCollection.fromJulianDateArray = function(options, result) {
  54516. if (!defined_default(options)) {
  54517. throw new DeveloperError_default("options is required.");
  54518. }
  54519. if (!defined_default(options.julianDates)) {
  54520. throw new DeveloperError_default("options.iso8601Array is required.");
  54521. }
  54522. if (!defined_default(result)) {
  54523. result = new TimeIntervalCollection();
  54524. }
  54525. const julianDates = options.julianDates;
  54526. const length3 = julianDates.length;
  54527. const dataCallback = options.dataCallback;
  54528. const isStartIncluded = defaultValue_default(options.isStartIncluded, true);
  54529. const isStopIncluded = defaultValue_default(options.isStopIncluded, true);
  54530. const leadingInterval = defaultValue_default(options.leadingInterval, false);
  54531. const trailingInterval = defaultValue_default(options.trailingInterval, false);
  54532. let interval;
  54533. let startIndex = 0;
  54534. if (leadingInterval) {
  54535. ++startIndex;
  54536. interval = new TimeInterval_default({
  54537. start: Iso8601_default.MINIMUM_VALUE,
  54538. stop: julianDates[0],
  54539. isStartIncluded: true,
  54540. isStopIncluded: !isStartIncluded
  54541. });
  54542. interval.data = defined_default(dataCallback) ? dataCallback(interval, result.length) : result.length;
  54543. result.addInterval(interval);
  54544. }
  54545. for (let i2 = 0; i2 < length3 - 1; ++i2) {
  54546. let startDate = julianDates[i2];
  54547. const endDate = julianDates[i2 + 1];
  54548. interval = new TimeInterval_default({
  54549. start: startDate,
  54550. stop: endDate,
  54551. isStartIncluded: result.length === startIndex ? isStartIncluded : true,
  54552. isStopIncluded: i2 === length3 - 2 ? isStopIncluded : false
  54553. });
  54554. interval.data = defined_default(dataCallback) ? dataCallback(interval, result.length) : result.length;
  54555. result.addInterval(interval);
  54556. startDate = endDate;
  54557. }
  54558. if (trailingInterval) {
  54559. interval = new TimeInterval_default({
  54560. start: julianDates[length3 - 1],
  54561. stop: Iso8601_default.MAXIMUM_VALUE,
  54562. isStartIncluded: !isStopIncluded,
  54563. isStopIncluded: true
  54564. });
  54565. interval.data = defined_default(dataCallback) ? dataCallback(interval, result.length) : result.length;
  54566. result.addInterval(interval);
  54567. }
  54568. return result;
  54569. };
  54570. var scratchGregorianDate = new GregorianDate_default();
  54571. var monthLengths = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  54572. function addToDate(julianDate, duration, result) {
  54573. if (!defined_default(result)) {
  54574. result = new JulianDate_default();
  54575. }
  54576. JulianDate_default.toGregorianDate(julianDate, scratchGregorianDate);
  54577. let millisecond = scratchGregorianDate.millisecond + duration.millisecond;
  54578. let second = scratchGregorianDate.second + duration.second;
  54579. let minute = scratchGregorianDate.minute + duration.minute;
  54580. let hour = scratchGregorianDate.hour + duration.hour;
  54581. let day = scratchGregorianDate.day + duration.day;
  54582. let month = scratchGregorianDate.month + duration.month;
  54583. let year = scratchGregorianDate.year + duration.year;
  54584. if (millisecond >= 1e3) {
  54585. second += Math.floor(millisecond / 1e3);
  54586. millisecond = millisecond % 1e3;
  54587. }
  54588. if (second >= 60) {
  54589. minute += Math.floor(second / 60);
  54590. second = second % 60;
  54591. }
  54592. if (minute >= 60) {
  54593. hour += Math.floor(minute / 60);
  54594. minute = minute % 60;
  54595. }
  54596. if (hour >= 24) {
  54597. day += Math.floor(hour / 24);
  54598. hour = hour % 24;
  54599. }
  54600. monthLengths[2] = isLeapYear_default(year) ? 29 : 28;
  54601. while (day > monthLengths[month] || month >= 13) {
  54602. if (day > monthLengths[month]) {
  54603. day -= monthLengths[month];
  54604. ++month;
  54605. }
  54606. if (month >= 13) {
  54607. --month;
  54608. year += Math.floor(month / 12);
  54609. month = month % 12;
  54610. ++month;
  54611. }
  54612. monthLengths[2] = isLeapYear_default(year) ? 29 : 28;
  54613. }
  54614. scratchGregorianDate.millisecond = millisecond;
  54615. scratchGregorianDate.second = second;
  54616. scratchGregorianDate.minute = minute;
  54617. scratchGregorianDate.hour = hour;
  54618. scratchGregorianDate.day = day;
  54619. scratchGregorianDate.month = month;
  54620. scratchGregorianDate.year = year;
  54621. return JulianDate_default.fromGregorianDate(scratchGregorianDate, result);
  54622. }
  54623. var scratchJulianDate = new JulianDate_default();
  54624. var durationRegex = /P(?:([\d.,]+)Y)?(?:([\d.,]+)M)?(?:([\d.,]+)W)?(?:([\d.,]+)D)?(?:T(?:([\d.,]+)H)?(?:([\d.,]+)M)?(?:([\d.,]+)S)?)?/;
  54625. function parseDuration(iso8601, result) {
  54626. if (!defined_default(iso8601) || iso8601.length === 0) {
  54627. return false;
  54628. }
  54629. result.year = 0;
  54630. result.month = 0;
  54631. result.day = 0;
  54632. result.hour = 0;
  54633. result.minute = 0;
  54634. result.second = 0;
  54635. result.millisecond = 0;
  54636. if (iso8601[0] === "P") {
  54637. const matches = iso8601.match(durationRegex);
  54638. if (!defined_default(matches)) {
  54639. return false;
  54640. }
  54641. if (defined_default(matches[1])) {
  54642. result.year = Number(matches[1].replace(",", "."));
  54643. }
  54644. if (defined_default(matches[2])) {
  54645. result.month = Number(matches[2].replace(",", "."));
  54646. }
  54647. if (defined_default(matches[3])) {
  54648. result.day = Number(matches[3].replace(",", ".")) * 7;
  54649. }
  54650. if (defined_default(matches[4])) {
  54651. result.day += Number(matches[4].replace(",", "."));
  54652. }
  54653. if (defined_default(matches[5])) {
  54654. result.hour = Number(matches[5].replace(",", "."));
  54655. }
  54656. if (defined_default(matches[6])) {
  54657. result.minute = Number(matches[6].replace(",", "."));
  54658. }
  54659. if (defined_default(matches[7])) {
  54660. const seconds = Number(matches[7].replace(",", "."));
  54661. result.second = Math.floor(seconds);
  54662. result.millisecond = seconds % 1 * 1e3;
  54663. }
  54664. } else {
  54665. if (iso8601[iso8601.length - 1] !== "Z") {
  54666. iso8601 += "Z";
  54667. }
  54668. JulianDate_default.toGregorianDate(
  54669. JulianDate_default.fromIso8601(iso8601, scratchJulianDate),
  54670. result
  54671. );
  54672. }
  54673. return result.year || result.month || result.day || result.hour || result.minute || result.second || result.millisecond;
  54674. }
  54675. var scratchDuration = new GregorianDate_default();
  54676. TimeIntervalCollection.fromIso8601 = function(options, result) {
  54677. if (!defined_default(options)) {
  54678. throw new DeveloperError_default("options is required.");
  54679. }
  54680. if (!defined_default(options.iso8601)) {
  54681. throw new DeveloperError_default("options.iso8601 is required.");
  54682. }
  54683. const dates = options.iso8601.split("/");
  54684. const start = JulianDate_default.fromIso8601(dates[0]);
  54685. const stop2 = JulianDate_default.fromIso8601(dates[1]);
  54686. const julianDates = [];
  54687. if (!parseDuration(dates[2], scratchDuration)) {
  54688. julianDates.push(start, stop2);
  54689. } else {
  54690. let date = JulianDate_default.clone(start);
  54691. julianDates.push(date);
  54692. while (JulianDate_default.compare(date, stop2) < 0) {
  54693. date = addToDate(date, scratchDuration);
  54694. const afterStop = JulianDate_default.compare(stop2, date) <= 0;
  54695. if (afterStop) {
  54696. JulianDate_default.clone(stop2, date);
  54697. }
  54698. julianDates.push(date);
  54699. }
  54700. }
  54701. return TimeIntervalCollection.fromJulianDateArray(
  54702. {
  54703. julianDates,
  54704. isStartIncluded: options.isStartIncluded,
  54705. isStopIncluded: options.isStopIncluded,
  54706. leadingInterval: options.leadingInterval,
  54707. trailingInterval: options.trailingInterval,
  54708. dataCallback: options.dataCallback
  54709. },
  54710. result
  54711. );
  54712. };
  54713. TimeIntervalCollection.fromIso8601DateArray = function(options, result) {
  54714. if (!defined_default(options)) {
  54715. throw new DeveloperError_default("options is required.");
  54716. }
  54717. if (!defined_default(options.iso8601Dates)) {
  54718. throw new DeveloperError_default("options.iso8601Dates is required.");
  54719. }
  54720. return TimeIntervalCollection.fromJulianDateArray(
  54721. {
  54722. julianDates: options.iso8601Dates.map(function(date) {
  54723. return JulianDate_default.fromIso8601(date);
  54724. }),
  54725. isStartIncluded: options.isStartIncluded,
  54726. isStopIncluded: options.isStopIncluded,
  54727. leadingInterval: options.leadingInterval,
  54728. trailingInterval: options.trailingInterval,
  54729. dataCallback: options.dataCallback
  54730. },
  54731. result
  54732. );
  54733. };
  54734. TimeIntervalCollection.fromIso8601DurationArray = function(options, result) {
  54735. if (!defined_default(options)) {
  54736. throw new DeveloperError_default("options is required.");
  54737. }
  54738. if (!defined_default(options.epoch)) {
  54739. throw new DeveloperError_default("options.epoch is required.");
  54740. }
  54741. if (!defined_default(options.iso8601Durations)) {
  54742. throw new DeveloperError_default("options.iso8601Durations is required.");
  54743. }
  54744. const epoch2 = options.epoch;
  54745. const iso8601Durations = options.iso8601Durations;
  54746. const relativeToPrevious = defaultValue_default(options.relativeToPrevious, false);
  54747. const julianDates = [];
  54748. let date, previousDate;
  54749. const length3 = iso8601Durations.length;
  54750. for (let i2 = 0; i2 < length3; ++i2) {
  54751. if (parseDuration(iso8601Durations[i2], scratchDuration) || i2 === 0) {
  54752. if (relativeToPrevious && defined_default(previousDate)) {
  54753. date = addToDate(previousDate, scratchDuration);
  54754. } else {
  54755. date = addToDate(epoch2, scratchDuration);
  54756. }
  54757. julianDates.push(date);
  54758. previousDate = date;
  54759. }
  54760. }
  54761. return TimeIntervalCollection.fromJulianDateArray(
  54762. {
  54763. julianDates,
  54764. isStartIncluded: options.isStartIncluded,
  54765. isStopIncluded: options.isStopIncluded,
  54766. leadingInterval: options.leadingInterval,
  54767. trailingInterval: options.trailingInterval,
  54768. dataCallback: options.dataCallback
  54769. },
  54770. result
  54771. );
  54772. };
  54773. var TimeIntervalCollection_default = TimeIntervalCollection;
  54774. // node_modules/cesium/Source/Core/TranslationRotationScale.js
  54775. var defaultScale = new Cartesian3_default(1, 1, 1);
  54776. var defaultTranslation = Cartesian3_default.ZERO;
  54777. var defaultRotation = Quaternion_default.IDENTITY;
  54778. function TranslationRotationScale(translation3, rotation, scale) {
  54779. this.translation = Cartesian3_default.clone(
  54780. defaultValue_default(translation3, defaultTranslation)
  54781. );
  54782. this.rotation = Quaternion_default.clone(defaultValue_default(rotation, defaultRotation));
  54783. this.scale = Cartesian3_default.clone(defaultValue_default(scale, defaultScale));
  54784. }
  54785. TranslationRotationScale.prototype.equals = function(right) {
  54786. return this === right || defined_default(right) && Cartesian3_default.equals(this.translation, right.translation) && Quaternion_default.equals(this.rotation, right.rotation) && Cartesian3_default.equals(this.scale, right.scale);
  54787. };
  54788. var TranslationRotationScale_default = TranslationRotationScale;
  54789. // node_modules/cesium/Source/Core/VRTheWorldTerrainProvider.js
  54790. function DataRectangle(rectangle, maxLevel) {
  54791. this.rectangle = rectangle;
  54792. this.maxLevel = maxLevel;
  54793. }
  54794. function VRTheWorldTerrainProvider(options) {
  54795. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  54796. if (!defined_default(options.url)) {
  54797. throw new DeveloperError_default("options.url is required.");
  54798. }
  54799. const resource = Resource_default.createIfNeeded(options.url);
  54800. this._resource = resource;
  54801. this._errorEvent = new Event_default();
  54802. this._ready = false;
  54803. this._readyPromise = defer_default();
  54804. this._terrainDataStructure = {
  54805. heightScale: 1 / 1e3,
  54806. heightOffset: -1e3,
  54807. elementsPerHeight: 3,
  54808. stride: 4,
  54809. elementMultiplier: 256,
  54810. isBigEndian: true,
  54811. lowestEncodedHeight: 0,
  54812. highestEncodedHeight: 256 * 256 * 256 - 1
  54813. };
  54814. let credit = options.credit;
  54815. if (typeof credit === "string") {
  54816. credit = new Credit_default(credit);
  54817. }
  54818. this._credit = credit;
  54819. this._tilingScheme = void 0;
  54820. this._rectangles = [];
  54821. const that = this;
  54822. let metadataError;
  54823. const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  54824. function metadataSuccess(xml2) {
  54825. const srs = xml2.getElementsByTagName("SRS")[0].textContent;
  54826. if (srs === "EPSG:4326") {
  54827. that._tilingScheme = new GeographicTilingScheme_default({ ellipsoid });
  54828. } else {
  54829. metadataFailure(`SRS ${srs} is not supported.`);
  54830. return;
  54831. }
  54832. const tileFormat = xml2.getElementsByTagName("TileFormat")[0];
  54833. that._heightmapWidth = parseInt(tileFormat.getAttribute("width"), 10);
  54834. that._heightmapHeight = parseInt(tileFormat.getAttribute("height"), 10);
  54835. that._levelZeroMaximumGeometricError = TerrainProvider_default.getEstimatedLevelZeroGeometricErrorForAHeightmap(
  54836. ellipsoid,
  54837. Math.min(that._heightmapWidth, that._heightmapHeight),
  54838. that._tilingScheme.getNumberOfXTilesAtLevel(0)
  54839. );
  54840. const dataRectangles = xml2.getElementsByTagName("DataExtent");
  54841. for (let i2 = 0; i2 < dataRectangles.length; ++i2) {
  54842. const dataRectangle = dataRectangles[i2];
  54843. const west = Math_default.toRadians(
  54844. parseFloat(dataRectangle.getAttribute("minx"))
  54845. );
  54846. const south = Math_default.toRadians(
  54847. parseFloat(dataRectangle.getAttribute("miny"))
  54848. );
  54849. const east = Math_default.toRadians(
  54850. parseFloat(dataRectangle.getAttribute("maxx"))
  54851. );
  54852. const north = Math_default.toRadians(
  54853. parseFloat(dataRectangle.getAttribute("maxy"))
  54854. );
  54855. const maxLevel = parseInt(dataRectangle.getAttribute("maxlevel"), 10);
  54856. that._rectangles.push(
  54857. new DataRectangle(new Rectangle_default(west, south, east, north), maxLevel)
  54858. );
  54859. }
  54860. that._ready = true;
  54861. that._readyPromise.resolve(true);
  54862. }
  54863. function metadataFailure(e2) {
  54864. const message = defaultValue_default(
  54865. e2,
  54866. `An error occurred while accessing ${that._resource.url}.`
  54867. );
  54868. metadataError = TileProviderError_default.handleError(
  54869. metadataError,
  54870. that,
  54871. that._errorEvent,
  54872. message,
  54873. void 0,
  54874. void 0,
  54875. void 0,
  54876. requestMetadata
  54877. );
  54878. }
  54879. function requestMetadata() {
  54880. that._resource.fetchXML().then(metadataSuccess).catch(metadataFailure);
  54881. }
  54882. requestMetadata();
  54883. }
  54884. Object.defineProperties(VRTheWorldTerrainProvider.prototype, {
  54885. errorEvent: {
  54886. get: function() {
  54887. return this._errorEvent;
  54888. }
  54889. },
  54890. credit: {
  54891. get: function() {
  54892. return this._credit;
  54893. }
  54894. },
  54895. tilingScheme: {
  54896. get: function() {
  54897. if (!this.ready) {
  54898. throw new DeveloperError_default(
  54899. "requestTileGeometry must not be called before ready returns true."
  54900. );
  54901. }
  54902. return this._tilingScheme;
  54903. }
  54904. },
  54905. ready: {
  54906. get: function() {
  54907. return this._ready;
  54908. }
  54909. },
  54910. readyPromise: {
  54911. get: function() {
  54912. return this._readyPromise.promise;
  54913. }
  54914. },
  54915. hasWaterMask: {
  54916. get: function() {
  54917. return false;
  54918. }
  54919. },
  54920. hasVertexNormals: {
  54921. get: function() {
  54922. return false;
  54923. }
  54924. },
  54925. availability: {
  54926. get: function() {
  54927. return void 0;
  54928. }
  54929. }
  54930. });
  54931. VRTheWorldTerrainProvider.prototype.requestTileGeometry = function(x, y, level, request) {
  54932. if (!this.ready) {
  54933. throw new DeveloperError_default(
  54934. "requestTileGeometry must not be called before ready returns true."
  54935. );
  54936. }
  54937. const yTiles = this._tilingScheme.getNumberOfYTilesAtLevel(level);
  54938. const resource = this._resource.getDerivedResource({
  54939. url: `${level}/${x}/${yTiles - y - 1}.tif`,
  54940. queryParameters: {
  54941. cesium: true
  54942. },
  54943. request
  54944. });
  54945. const promise = resource.fetchImage({
  54946. preferImageBitmap: true
  54947. });
  54948. if (!defined_default(promise)) {
  54949. return void 0;
  54950. }
  54951. const that = this;
  54952. return Promise.resolve(promise).then(function(image) {
  54953. return new HeightmapTerrainData_default({
  54954. buffer: getImagePixels_default(image),
  54955. width: that._heightmapWidth,
  54956. height: that._heightmapHeight,
  54957. childTileMask: getChildMask(that, x, y, level),
  54958. structure: that._terrainDataStructure
  54959. });
  54960. });
  54961. };
  54962. VRTheWorldTerrainProvider.prototype.getLevelMaximumGeometricError = function(level) {
  54963. if (!this.ready) {
  54964. throw new DeveloperError_default(
  54965. "requestTileGeometry must not be called before ready returns true."
  54966. );
  54967. }
  54968. return this._levelZeroMaximumGeometricError / (1 << level);
  54969. };
  54970. var rectangleScratch5 = new Rectangle_default();
  54971. function getChildMask(provider, x, y, level) {
  54972. const tilingScheme2 = provider._tilingScheme;
  54973. const rectangles = provider._rectangles;
  54974. const parentRectangle = tilingScheme2.tileXYToRectangle(x, y, level);
  54975. let childMask = 0;
  54976. for (let i2 = 0; i2 < rectangles.length && childMask !== 15; ++i2) {
  54977. const rectangle = rectangles[i2];
  54978. if (rectangle.maxLevel <= level) {
  54979. continue;
  54980. }
  54981. const testRectangle = rectangle.rectangle;
  54982. const intersection = Rectangle_default.intersection(
  54983. testRectangle,
  54984. parentRectangle,
  54985. rectangleScratch5
  54986. );
  54987. if (defined_default(intersection)) {
  54988. if (isTileInRectangle(tilingScheme2, testRectangle, x * 2, y * 2, level + 1)) {
  54989. childMask |= 4;
  54990. }
  54991. if (isTileInRectangle(
  54992. tilingScheme2,
  54993. testRectangle,
  54994. x * 2 + 1,
  54995. y * 2,
  54996. level + 1
  54997. )) {
  54998. childMask |= 8;
  54999. }
  55000. if (isTileInRectangle(
  55001. tilingScheme2,
  55002. testRectangle,
  55003. x * 2,
  55004. y * 2 + 1,
  55005. level + 1
  55006. )) {
  55007. childMask |= 1;
  55008. }
  55009. if (isTileInRectangle(
  55010. tilingScheme2,
  55011. testRectangle,
  55012. x * 2 + 1,
  55013. y * 2 + 1,
  55014. level + 1
  55015. )) {
  55016. childMask |= 2;
  55017. }
  55018. }
  55019. }
  55020. return childMask;
  55021. }
  55022. function isTileInRectangle(tilingScheme2, rectangle, x, y, level) {
  55023. const tileRectangle = tilingScheme2.tileXYToRectangle(x, y, level);
  55024. return defined_default(
  55025. Rectangle_default.intersection(tileRectangle, rectangle, rectangleScratch5)
  55026. );
  55027. }
  55028. VRTheWorldTerrainProvider.prototype.getTileDataAvailable = function(x, y, level) {
  55029. return void 0;
  55030. };
  55031. VRTheWorldTerrainProvider.prototype.loadTileDataAvailability = function(x, y, level) {
  55032. return void 0;
  55033. };
  55034. var VRTheWorldTerrainProvider_default = VRTheWorldTerrainProvider;
  55035. // node_modules/cesium/Source/Core/VideoSynchronizer.js
  55036. function VideoSynchronizer(options) {
  55037. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  55038. this._clock = void 0;
  55039. this._element = void 0;
  55040. this._clockSubscription = void 0;
  55041. this._seekFunction = void 0;
  55042. this._lastPlaybackRate = void 0;
  55043. this.clock = options.clock;
  55044. this.element = options.element;
  55045. this.epoch = defaultValue_default(options.epoch, Iso8601_default.MINIMUM_VALUE);
  55046. this.tolerance = defaultValue_default(options.tolerance, 1);
  55047. this._seeking = false;
  55048. this._seekFunction = void 0;
  55049. this._firstTickAfterSeek = false;
  55050. }
  55051. Object.defineProperties(VideoSynchronizer.prototype, {
  55052. clock: {
  55053. get: function() {
  55054. return this._clock;
  55055. },
  55056. set: function(value) {
  55057. const oldValue2 = this._clock;
  55058. if (oldValue2 === value) {
  55059. return;
  55060. }
  55061. if (defined_default(oldValue2)) {
  55062. this._clockSubscription();
  55063. this._clockSubscription = void 0;
  55064. }
  55065. if (defined_default(value)) {
  55066. this._clockSubscription = value.onTick.addEventListener(
  55067. VideoSynchronizer.prototype._onTick,
  55068. this
  55069. );
  55070. }
  55071. this._clock = value;
  55072. }
  55073. },
  55074. element: {
  55075. get: function() {
  55076. return this._element;
  55077. },
  55078. set: function(value) {
  55079. const oldValue2 = this._element;
  55080. if (oldValue2 === value) {
  55081. return;
  55082. }
  55083. if (defined_default(oldValue2)) {
  55084. oldValue2.removeEventListener("seeked", this._seekFunction, false);
  55085. }
  55086. if (defined_default(value)) {
  55087. this._seeking = false;
  55088. this._seekFunction = createSeekFunction(this);
  55089. value.addEventListener("seeked", this._seekFunction, false);
  55090. }
  55091. this._element = value;
  55092. this._seeking = false;
  55093. this._firstTickAfterSeek = false;
  55094. }
  55095. }
  55096. });
  55097. VideoSynchronizer.prototype.destroy = function() {
  55098. this.element = void 0;
  55099. this.clock = void 0;
  55100. return destroyObject_default(this);
  55101. };
  55102. VideoSynchronizer.prototype.isDestroyed = function() {
  55103. return false;
  55104. };
  55105. VideoSynchronizer.prototype._trySetPlaybackRate = function(clock) {
  55106. if (this._lastPlaybackRate === clock.multiplier) {
  55107. return;
  55108. }
  55109. const element = this._element;
  55110. try {
  55111. element.playbackRate = clock.multiplier;
  55112. } catch (error) {
  55113. element.playbackRate = 0;
  55114. }
  55115. this._lastPlaybackRate = clock.multiplier;
  55116. };
  55117. VideoSynchronizer.prototype._onTick = function(clock) {
  55118. const element = this._element;
  55119. if (!defined_default(element) || element.readyState < 2) {
  55120. return;
  55121. }
  55122. const paused = element.paused;
  55123. const shouldAnimate = clock.shouldAnimate;
  55124. if (shouldAnimate === paused) {
  55125. if (shouldAnimate) {
  55126. element.play();
  55127. } else {
  55128. element.pause();
  55129. }
  55130. }
  55131. if (this._seeking || this._firstTickAfterSeek) {
  55132. this._firstTickAfterSeek = false;
  55133. return;
  55134. }
  55135. this._trySetPlaybackRate(clock);
  55136. const clockTime = clock.currentTime;
  55137. const epoch2 = defaultValue_default(this.epoch, Iso8601_default.MINIMUM_VALUE);
  55138. let videoTime = JulianDate_default.secondsDifference(clockTime, epoch2);
  55139. const duration = element.duration;
  55140. let desiredTime;
  55141. const currentTime = element.currentTime;
  55142. if (element.loop) {
  55143. videoTime = videoTime % duration;
  55144. if (videoTime < 0) {
  55145. videoTime = duration - videoTime;
  55146. }
  55147. desiredTime = videoTime;
  55148. } else if (videoTime > duration) {
  55149. desiredTime = duration;
  55150. } else if (videoTime < 0) {
  55151. desiredTime = 0;
  55152. } else {
  55153. desiredTime = videoTime;
  55154. }
  55155. const tolerance = shouldAnimate ? defaultValue_default(this.tolerance, 1) : 1e-3;
  55156. if (Math.abs(desiredTime - currentTime) > tolerance) {
  55157. this._seeking = true;
  55158. element.currentTime = desiredTime;
  55159. }
  55160. };
  55161. function createSeekFunction(that) {
  55162. return function() {
  55163. that._seeking = false;
  55164. that._firstTickAfterSeek = true;
  55165. };
  55166. }
  55167. var VideoSynchronizer_default = VideoSynchronizer;
  55168. // node_modules/cesium/Source/Core/VulkanConstants.js
  55169. var VulkanConstants = {
  55170. VK_FORMAT_UNDEFINED: 0,
  55171. VK_FORMAT_R4G4_UNORM_PACK8: 1,
  55172. VK_FORMAT_R4G4B4A4_UNORM_PACK16: 2,
  55173. VK_FORMAT_B4G4R4A4_UNORM_PACK16: 3,
  55174. VK_FORMAT_R5G6B5_UNORM_PACK16: 4,
  55175. VK_FORMAT_B5G6R5_UNORM_PACK16: 5,
  55176. VK_FORMAT_R5G5B5A1_UNORM_PACK16: 6,
  55177. VK_FORMAT_B5G5R5A1_UNORM_PACK16: 7,
  55178. VK_FORMAT_A1R5G5B5_UNORM_PACK16: 8,
  55179. VK_FORMAT_R8_UNORM: 9,
  55180. VK_FORMAT_R8_SNORM: 10,
  55181. VK_FORMAT_R8_USCALED: 11,
  55182. VK_FORMAT_R8_SSCALED: 12,
  55183. VK_FORMAT_R8_UINT: 13,
  55184. VK_FORMAT_R8_SINT: 14,
  55185. VK_FORMAT_R8_SRGB: 15,
  55186. VK_FORMAT_R8G8_UNORM: 16,
  55187. VK_FORMAT_R8G8_SNORM: 17,
  55188. VK_FORMAT_R8G8_USCALED: 18,
  55189. VK_FORMAT_R8G8_SSCALED: 19,
  55190. VK_FORMAT_R8G8_UINT: 20,
  55191. VK_FORMAT_R8G8_SINT: 21,
  55192. VK_FORMAT_R8G8_SRGB: 22,
  55193. VK_FORMAT_R8G8B8_UNORM: 23,
  55194. VK_FORMAT_R8G8B8_SNORM: 24,
  55195. VK_FORMAT_R8G8B8_USCALED: 25,
  55196. VK_FORMAT_R8G8B8_SSCALED: 26,
  55197. VK_FORMAT_R8G8B8_UINT: 27,
  55198. VK_FORMAT_R8G8B8_SINT: 28,
  55199. VK_FORMAT_R8G8B8_SRGB: 29,
  55200. VK_FORMAT_B8G8R8_UNORM: 30,
  55201. VK_FORMAT_B8G8R8_SNORM: 31,
  55202. VK_FORMAT_B8G8R8_USCALED: 32,
  55203. VK_FORMAT_B8G8R8_SSCALED: 33,
  55204. VK_FORMAT_B8G8R8_UINT: 34,
  55205. VK_FORMAT_B8G8R8_SINT: 35,
  55206. VK_FORMAT_B8G8R8_SRGB: 36,
  55207. VK_FORMAT_R8G8B8A8_UNORM: 37,
  55208. VK_FORMAT_R8G8B8A8_SNORM: 38,
  55209. VK_FORMAT_R8G8B8A8_USCALED: 39,
  55210. VK_FORMAT_R8G8B8A8_SSCALED: 40,
  55211. VK_FORMAT_R8G8B8A8_UINT: 41,
  55212. VK_FORMAT_R8G8B8A8_SINT: 42,
  55213. VK_FORMAT_R8G8B8A8_SRGB: 43,
  55214. VK_FORMAT_B8G8R8A8_UNORM: 44,
  55215. VK_FORMAT_B8G8R8A8_SNORM: 45,
  55216. VK_FORMAT_B8G8R8A8_USCALED: 46,
  55217. VK_FORMAT_B8G8R8A8_SSCALED: 47,
  55218. VK_FORMAT_B8G8R8A8_UINT: 48,
  55219. VK_FORMAT_B8G8R8A8_SINT: 49,
  55220. VK_FORMAT_B8G8R8A8_SRGB: 50,
  55221. VK_FORMAT_A8B8G8R8_UNORM_PACK32: 51,
  55222. VK_FORMAT_A8B8G8R8_SNORM_PACK32: 52,
  55223. VK_FORMAT_A8B8G8R8_USCALED_PACK32: 53,
  55224. VK_FORMAT_A8B8G8R8_SSCALED_PACK32: 54,
  55225. VK_FORMAT_A8B8G8R8_UINT_PACK32: 55,
  55226. VK_FORMAT_A8B8G8R8_SINT_PACK32: 56,
  55227. VK_FORMAT_A8B8G8R8_SRGB_PACK32: 57,
  55228. VK_FORMAT_A2R10G10B10_UNORM_PACK32: 58,
  55229. VK_FORMAT_A2R10G10B10_SNORM_PACK32: 59,
  55230. VK_FORMAT_A2R10G10B10_USCALED_PACK32: 60,
  55231. VK_FORMAT_A2R10G10B10_SSCALED_PACK32: 61,
  55232. VK_FORMAT_A2R10G10B10_UINT_PACK32: 62,
  55233. VK_FORMAT_A2R10G10B10_SINT_PACK32: 63,
  55234. VK_FORMAT_A2B10G10R10_UNORM_PACK32: 64,
  55235. VK_FORMAT_A2B10G10R10_SNORM_PACK32: 65,
  55236. VK_FORMAT_A2B10G10R10_USCALED_PACK32: 66,
  55237. VK_FORMAT_A2B10G10R10_SSCALED_PACK32: 67,
  55238. VK_FORMAT_A2B10G10R10_UINT_PACK32: 68,
  55239. VK_FORMAT_A2B10G10R10_SINT_PACK32: 69,
  55240. VK_FORMAT_R16_UNORM: 70,
  55241. VK_FORMAT_R16_SNORM: 71,
  55242. VK_FORMAT_R16_USCALED: 72,
  55243. VK_FORMAT_R16_SSCALED: 73,
  55244. VK_FORMAT_R16_UINT: 74,
  55245. VK_FORMAT_R16_SINT: 75,
  55246. VK_FORMAT_R16_SFLOAT: 76,
  55247. VK_FORMAT_R16G16_UNORM: 77,
  55248. VK_FORMAT_R16G16_SNORM: 78,
  55249. VK_FORMAT_R16G16_USCALED: 79,
  55250. VK_FORMAT_R16G16_SSCALED: 80,
  55251. VK_FORMAT_R16G16_UINT: 81,
  55252. VK_FORMAT_R16G16_SINT: 82,
  55253. VK_FORMAT_R16G16_SFLOAT: 83,
  55254. VK_FORMAT_R16G16B16_UNORM: 84,
  55255. VK_FORMAT_R16G16B16_SNORM: 85,
  55256. VK_FORMAT_R16G16B16_USCALED: 86,
  55257. VK_FORMAT_R16G16B16_SSCALED: 87,
  55258. VK_FORMAT_R16G16B16_UINT: 88,
  55259. VK_FORMAT_R16G16B16_SINT: 89,
  55260. VK_FORMAT_R16G16B16_SFLOAT: 90,
  55261. VK_FORMAT_R16G16B16A16_UNORM: 91,
  55262. VK_FORMAT_R16G16B16A16_SNORM: 92,
  55263. VK_FORMAT_R16G16B16A16_USCALED: 93,
  55264. VK_FORMAT_R16G16B16A16_SSCALED: 94,
  55265. VK_FORMAT_R16G16B16A16_UINT: 95,
  55266. VK_FORMAT_R16G16B16A16_SINT: 96,
  55267. VK_FORMAT_R16G16B16A16_SFLOAT: 97,
  55268. VK_FORMAT_R32_UINT: 98,
  55269. VK_FORMAT_R32_SINT: 99,
  55270. VK_FORMAT_R32_SFLOAT: 100,
  55271. VK_FORMAT_R32G32_UINT: 101,
  55272. VK_FORMAT_R32G32_SINT: 102,
  55273. VK_FORMAT_R32G32_SFLOAT: 103,
  55274. VK_FORMAT_R32G32B32_UINT: 104,
  55275. VK_FORMAT_R32G32B32_SINT: 105,
  55276. VK_FORMAT_R32G32B32_SFLOAT: 106,
  55277. VK_FORMAT_R32G32B32A32_UINT: 107,
  55278. VK_FORMAT_R32G32B32A32_SINT: 108,
  55279. VK_FORMAT_R32G32B32A32_SFLOAT: 109,
  55280. VK_FORMAT_R64_UINT: 110,
  55281. VK_FORMAT_R64_SINT: 111,
  55282. VK_FORMAT_R64_SFLOAT: 112,
  55283. VK_FORMAT_R64G64_UINT: 113,
  55284. VK_FORMAT_R64G64_SINT: 114,
  55285. VK_FORMAT_R64G64_SFLOAT: 115,
  55286. VK_FORMAT_R64G64B64_UINT: 116,
  55287. VK_FORMAT_R64G64B64_SINT: 117,
  55288. VK_FORMAT_R64G64B64_SFLOAT: 118,
  55289. VK_FORMAT_R64G64B64A64_UINT: 119,
  55290. VK_FORMAT_R64G64B64A64_SINT: 120,
  55291. VK_FORMAT_R64G64B64A64_SFLOAT: 121,
  55292. VK_FORMAT_B10G11R11_UFLOAT_PACK32: 122,
  55293. VK_FORMAT_E5B9G9R9_UFLOAT_PACK32: 123,
  55294. VK_FORMAT_D16_UNORM: 124,
  55295. VK_FORMAT_X8_D24_UNORM_PACK32: 125,
  55296. VK_FORMAT_D32_SFLOAT: 126,
  55297. VK_FORMAT_S8_UINT: 127,
  55298. VK_FORMAT_D16_UNORM_S8_UINT: 128,
  55299. VK_FORMAT_D24_UNORM_S8_UINT: 129,
  55300. VK_FORMAT_D32_SFLOAT_S8_UINT: 130,
  55301. VK_FORMAT_BC1_RGB_UNORM_BLOCK: 131,
  55302. VK_FORMAT_BC1_RGB_SRGB_BLOCK: 132,
  55303. VK_FORMAT_BC1_RGBA_UNORM_BLOCK: 133,
  55304. VK_FORMAT_BC1_RGBA_SRGB_BLOCK: 134,
  55305. VK_FORMAT_BC2_UNORM_BLOCK: 135,
  55306. VK_FORMAT_BC2_SRGB_BLOCK: 136,
  55307. VK_FORMAT_BC3_UNORM_BLOCK: 137,
  55308. VK_FORMAT_BC3_SRGB_BLOCK: 138,
  55309. VK_FORMAT_BC4_UNORM_BLOCK: 139,
  55310. VK_FORMAT_BC4_SNORM_BLOCK: 140,
  55311. VK_FORMAT_BC5_UNORM_BLOCK: 141,
  55312. VK_FORMAT_BC5_SNORM_BLOCK: 142,
  55313. VK_FORMAT_BC6H_UFLOAT_BLOCK: 143,
  55314. VK_FORMAT_BC6H_SFLOAT_BLOCK: 144,
  55315. VK_FORMAT_BC7_UNORM_BLOCK: 145,
  55316. VK_FORMAT_BC7_SRGB_BLOCK: 146,
  55317. VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK: 147,
  55318. VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK: 148,
  55319. VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK: 149,
  55320. VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK: 150,
  55321. VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK: 151,
  55322. VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK: 152,
  55323. VK_FORMAT_EAC_R11_UNORM_BLOCK: 153,
  55324. VK_FORMAT_EAC_R11_SNORM_BLOCK: 154,
  55325. VK_FORMAT_EAC_R11G11_UNORM_BLOCK: 155,
  55326. VK_FORMAT_EAC_R11G11_SNORM_BLOCK: 156,
  55327. VK_FORMAT_ASTC_4x4_UNORM_BLOCK: 157,
  55328. VK_FORMAT_ASTC_4x4_SRGB_BLOCK: 158,
  55329. VK_FORMAT_ASTC_5x4_UNORM_BLOCK: 159,
  55330. VK_FORMAT_ASTC_5x4_SRGB_BLOCK: 160,
  55331. VK_FORMAT_ASTC_5x5_UNORM_BLOCK: 161,
  55332. VK_FORMAT_ASTC_5x5_SRGB_BLOCK: 162,
  55333. VK_FORMAT_ASTC_6x5_UNORM_BLOCK: 163,
  55334. VK_FORMAT_ASTC_6x5_SRGB_BLOCK: 164,
  55335. VK_FORMAT_ASTC_6x6_UNORM_BLOCK: 165,
  55336. VK_FORMAT_ASTC_6x6_SRGB_BLOCK: 166,
  55337. VK_FORMAT_ASTC_8x5_UNORM_BLOCK: 167,
  55338. VK_FORMAT_ASTC_8x5_SRGB_BLOCK: 168,
  55339. VK_FORMAT_ASTC_8x6_UNORM_BLOCK: 169,
  55340. VK_FORMAT_ASTC_8x6_SRGB_BLOCK: 170,
  55341. VK_FORMAT_ASTC_8x8_UNORM_BLOCK: 171,
  55342. VK_FORMAT_ASTC_8x8_SRGB_BLOCK: 172,
  55343. VK_FORMAT_ASTC_10x5_UNORM_BLOCK: 173,
  55344. VK_FORMAT_ASTC_10x5_SRGB_BLOCK: 174,
  55345. VK_FORMAT_ASTC_10x6_UNORM_BLOCK: 175,
  55346. VK_FORMAT_ASTC_10x6_SRGB_BLOCK: 176,
  55347. VK_FORMAT_ASTC_10x8_UNORM_BLOCK: 177,
  55348. VK_FORMAT_ASTC_10x8_SRGB_BLOCK: 178,
  55349. VK_FORMAT_ASTC_10x10_UNORM_BLOCK: 179,
  55350. VK_FORMAT_ASTC_10x10_SRGB_BLOCK: 180,
  55351. VK_FORMAT_ASTC_12x10_UNORM_BLOCK: 181,
  55352. VK_FORMAT_ASTC_12x10_SRGB_BLOCK: 182,
  55353. VK_FORMAT_ASTC_12x12_UNORM_BLOCK: 183,
  55354. VK_FORMAT_ASTC_12x12_SRGB_BLOCK: 184,
  55355. VK_FORMAT_G8B8G8R8_422_UNORM: 1000156e3,
  55356. VK_FORMAT_B8G8R8G8_422_UNORM: 1000156001,
  55357. VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM: 1000156002,
  55358. VK_FORMAT_G8_B8R8_2PLANE_420_UNORM: 1000156003,
  55359. VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM: 1000156004,
  55360. VK_FORMAT_G8_B8R8_2PLANE_422_UNORM: 1000156005,
  55361. VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM: 1000156006,
  55362. VK_FORMAT_R10X6_UNORM_PACK16: 1000156007,
  55363. VK_FORMAT_R10X6G10X6_UNORM_2PACK16: 1000156008,
  55364. VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16: 1000156009,
  55365. VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16: 1000156010,
  55366. VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16: 1000156011,
  55367. VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16: 1000156012,
  55368. VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16: 1000156013,
  55369. VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16: 1000156014,
  55370. VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16: 1000156015,
  55371. VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16: 1000156016,
  55372. VK_FORMAT_R12X4_UNORM_PACK16: 1000156017,
  55373. VK_FORMAT_R12X4G12X4_UNORM_2PACK16: 1000156018,
  55374. VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16: 1000156019,
  55375. VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16: 1000156020,
  55376. VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16: 1000156021,
  55377. VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16: 1000156022,
  55378. VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16: 1000156023,
  55379. VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16: 1000156024,
  55380. VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16: 1000156025,
  55381. VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16: 1000156026,
  55382. VK_FORMAT_G16B16G16R16_422_UNORM: 1000156027,
  55383. VK_FORMAT_B16G16R16G16_422_UNORM: 1000156028,
  55384. VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM: 1000156029,
  55385. VK_FORMAT_G16_B16R16_2PLANE_420_UNORM: 1000156030,
  55386. VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM: 1000156031,
  55387. VK_FORMAT_G16_B16R16_2PLANE_422_UNORM: 1000156032,
  55388. VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM: 1000156033,
  55389. VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG: 1000054e3,
  55390. VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG: 1000054001,
  55391. VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG: 1000054002,
  55392. VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG: 1000054003,
  55393. VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG: 1000054004,
  55394. VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG: 1000054005,
  55395. VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG: 1000054006,
  55396. VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG: 1000054007,
  55397. VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT: 1000066e3,
  55398. VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT: 1000066001,
  55399. VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT: 1000066002,
  55400. VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT: 1000066003,
  55401. VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT: 1000066004,
  55402. VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT: 1000066005,
  55403. VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT: 1000066006,
  55404. VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT: 1000066007,
  55405. VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT: 1000066008,
  55406. VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT: 1000066009,
  55407. VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT: 1000066010,
  55408. VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT: 1000066011,
  55409. VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT: 1000066012,
  55410. VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT: 1000066013,
  55411. VK_FORMAT_G8B8G8R8_422_UNORM_KHR: 1000156e3,
  55412. VK_FORMAT_B8G8R8G8_422_UNORM_KHR: 1000156001,
  55413. VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR: 1000156002,
  55414. VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR: 1000156003,
  55415. VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR: 1000156004,
  55416. VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR: 1000156005,
  55417. VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR: 1000156006,
  55418. VK_FORMAT_R10X6_UNORM_PACK16_KHR: 1000156007,
  55419. VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR: 1000156008,
  55420. VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR: 1000156009,
  55421. VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR: 1000156010,
  55422. VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR: 1000156011,
  55423. VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR: 1000156012,
  55424. VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR: 1000156013,
  55425. VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR: 1000156014,
  55426. VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR: 1000156015,
  55427. VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR: 1000156016,
  55428. VK_FORMAT_R12X4_UNORM_PACK16_KHR: 1000156017,
  55429. VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR: 1000156018,
  55430. VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR: 1000156019,
  55431. VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR: 1000156020,
  55432. VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR: 1000156021,
  55433. VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR: 1000156022,
  55434. VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR: 1000156023,
  55435. VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR: 1000156024,
  55436. VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR: 1000156025,
  55437. VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR: 1000156026,
  55438. VK_FORMAT_G16B16G16R16_422_UNORM_KHR: 1000156027,
  55439. VK_FORMAT_B16G16R16G16_422_UNORM_KHR: 1000156028,
  55440. VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR: 1000156029,
  55441. VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR: 1000156030,
  55442. VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR: 1000156031,
  55443. VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR: 1000156032,
  55444. VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR: 1000156033
  55445. };
  55446. var VulkanConstants_default = Object.freeze(VulkanConstants);
  55447. // node_modules/cesium/Source/Core/WallGeometryLibrary.js
  55448. var WallGeometryLibrary = {};
  55449. function latLonEquals(c0, c14) {
  55450. return Math_default.equalsEpsilon(c0.latitude, c14.latitude, Math_default.EPSILON10) && Math_default.equalsEpsilon(c0.longitude, c14.longitude, Math_default.EPSILON10);
  55451. }
  55452. var scratchCartographic13 = new Cartographic_default();
  55453. var scratchCartographic23 = new Cartographic_default();
  55454. function removeDuplicates(ellipsoid, positions, topHeights, bottomHeights) {
  55455. positions = arrayRemoveDuplicates_default(positions, Cartesian3_default.equalsEpsilon);
  55456. const length3 = positions.length;
  55457. if (length3 < 2) {
  55458. return;
  55459. }
  55460. const hasBottomHeights = defined_default(bottomHeights);
  55461. const hasTopHeights = defined_default(topHeights);
  55462. const cleanedPositions = new Array(length3);
  55463. const cleanedTopHeights = new Array(length3);
  55464. const cleanedBottomHeights = new Array(length3);
  55465. const v02 = positions[0];
  55466. cleanedPositions[0] = v02;
  55467. const c0 = ellipsoid.cartesianToCartographic(v02, scratchCartographic13);
  55468. if (hasTopHeights) {
  55469. c0.height = topHeights[0];
  55470. }
  55471. cleanedTopHeights[0] = c0.height;
  55472. if (hasBottomHeights) {
  55473. cleanedBottomHeights[0] = bottomHeights[0];
  55474. } else {
  55475. cleanedBottomHeights[0] = 0;
  55476. }
  55477. const startTopHeight = cleanedTopHeights[0];
  55478. const startBottomHeight = cleanedBottomHeights[0];
  55479. let hasAllSameHeights = startTopHeight === startBottomHeight;
  55480. let index2 = 1;
  55481. for (let i2 = 1; i2 < length3; ++i2) {
  55482. const v13 = positions[i2];
  55483. const c14 = ellipsoid.cartesianToCartographic(v13, scratchCartographic23);
  55484. if (hasTopHeights) {
  55485. c14.height = topHeights[i2];
  55486. }
  55487. hasAllSameHeights = hasAllSameHeights && c14.height === 0;
  55488. if (!latLonEquals(c0, c14)) {
  55489. cleanedPositions[index2] = v13;
  55490. cleanedTopHeights[index2] = c14.height;
  55491. if (hasBottomHeights) {
  55492. cleanedBottomHeights[index2] = bottomHeights[i2];
  55493. } else {
  55494. cleanedBottomHeights[index2] = 0;
  55495. }
  55496. hasAllSameHeights = hasAllSameHeights && cleanedTopHeights[index2] === cleanedBottomHeights[index2];
  55497. Cartographic_default.clone(c14, c0);
  55498. ++index2;
  55499. } else if (c0.height < c14.height) {
  55500. cleanedTopHeights[index2 - 1] = c14.height;
  55501. }
  55502. }
  55503. if (hasAllSameHeights || index2 < 2) {
  55504. return;
  55505. }
  55506. cleanedPositions.length = index2;
  55507. cleanedTopHeights.length = index2;
  55508. cleanedBottomHeights.length = index2;
  55509. return {
  55510. positions: cleanedPositions,
  55511. topHeights: cleanedTopHeights,
  55512. bottomHeights: cleanedBottomHeights
  55513. };
  55514. }
  55515. var positionsArrayScratch = new Array(2);
  55516. var heightsArrayScratch = new Array(2);
  55517. var generateArcOptionsScratch2 = {
  55518. positions: void 0,
  55519. height: void 0,
  55520. granularity: void 0,
  55521. ellipsoid: void 0
  55522. };
  55523. WallGeometryLibrary.computePositions = function(ellipsoid, wallPositions, maximumHeights, minimumHeights, granularity, duplicateCorners) {
  55524. const o2 = removeDuplicates(
  55525. ellipsoid,
  55526. wallPositions,
  55527. maximumHeights,
  55528. minimumHeights
  55529. );
  55530. if (!defined_default(o2)) {
  55531. return;
  55532. }
  55533. wallPositions = o2.positions;
  55534. maximumHeights = o2.topHeights;
  55535. minimumHeights = o2.bottomHeights;
  55536. const length3 = wallPositions.length;
  55537. const numCorners = length3 - 2;
  55538. let topPositions;
  55539. let bottomPositions;
  55540. const minDistance = Math_default.chordLength(
  55541. granularity,
  55542. ellipsoid.maximumRadius
  55543. );
  55544. const generateArcOptions = generateArcOptionsScratch2;
  55545. generateArcOptions.minDistance = minDistance;
  55546. generateArcOptions.ellipsoid = ellipsoid;
  55547. if (duplicateCorners) {
  55548. let count = 0;
  55549. let i2;
  55550. for (i2 = 0; i2 < length3 - 1; i2++) {
  55551. count += PolylinePipeline_default.numberOfPoints(
  55552. wallPositions[i2],
  55553. wallPositions[i2 + 1],
  55554. minDistance
  55555. ) + 1;
  55556. }
  55557. topPositions = new Float64Array(count * 3);
  55558. bottomPositions = new Float64Array(count * 3);
  55559. const generateArcPositions = positionsArrayScratch;
  55560. const generateArcHeights = heightsArrayScratch;
  55561. generateArcOptions.positions = generateArcPositions;
  55562. generateArcOptions.height = generateArcHeights;
  55563. let offset2 = 0;
  55564. for (i2 = 0; i2 < length3 - 1; i2++) {
  55565. generateArcPositions[0] = wallPositions[i2];
  55566. generateArcPositions[1] = wallPositions[i2 + 1];
  55567. generateArcHeights[0] = maximumHeights[i2];
  55568. generateArcHeights[1] = maximumHeights[i2 + 1];
  55569. const pos = PolylinePipeline_default.generateArc(generateArcOptions);
  55570. topPositions.set(pos, offset2);
  55571. generateArcHeights[0] = minimumHeights[i2];
  55572. generateArcHeights[1] = minimumHeights[i2 + 1];
  55573. bottomPositions.set(
  55574. PolylinePipeline_default.generateArc(generateArcOptions),
  55575. offset2
  55576. );
  55577. offset2 += pos.length;
  55578. }
  55579. } else {
  55580. generateArcOptions.positions = wallPositions;
  55581. generateArcOptions.height = maximumHeights;
  55582. topPositions = new Float64Array(
  55583. PolylinePipeline_default.generateArc(generateArcOptions)
  55584. );
  55585. generateArcOptions.height = minimumHeights;
  55586. bottomPositions = new Float64Array(
  55587. PolylinePipeline_default.generateArc(generateArcOptions)
  55588. );
  55589. }
  55590. return {
  55591. bottomPositions,
  55592. topPositions,
  55593. numCorners
  55594. };
  55595. };
  55596. var WallGeometryLibrary_default = WallGeometryLibrary;
  55597. // node_modules/cesium/Source/Core/WallGeometry.js
  55598. var scratchCartesian3Position1 = new Cartesian3_default();
  55599. var scratchCartesian3Position2 = new Cartesian3_default();
  55600. var scratchCartesian3Position4 = new Cartesian3_default();
  55601. var scratchCartesian3Position5 = new Cartesian3_default();
  55602. var scratchBitangent5 = new Cartesian3_default();
  55603. var scratchTangent5 = new Cartesian3_default();
  55604. var scratchNormal7 = new Cartesian3_default();
  55605. function WallGeometry(options) {
  55606. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  55607. const wallPositions = options.positions;
  55608. const maximumHeights = options.maximumHeights;
  55609. const minimumHeights = options.minimumHeights;
  55610. if (!defined_default(wallPositions)) {
  55611. throw new DeveloperError_default("options.positions is required.");
  55612. }
  55613. if (defined_default(maximumHeights) && maximumHeights.length !== wallPositions.length) {
  55614. throw new DeveloperError_default(
  55615. "options.positions and options.maximumHeights must have the same length."
  55616. );
  55617. }
  55618. if (defined_default(minimumHeights) && minimumHeights.length !== wallPositions.length) {
  55619. throw new DeveloperError_default(
  55620. "options.positions and options.minimumHeights must have the same length."
  55621. );
  55622. }
  55623. const vertexFormat = defaultValue_default(options.vertexFormat, VertexFormat_default.DEFAULT);
  55624. const granularity = defaultValue_default(
  55625. options.granularity,
  55626. Math_default.RADIANS_PER_DEGREE
  55627. );
  55628. const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  55629. this._positions = wallPositions;
  55630. this._minimumHeights = minimumHeights;
  55631. this._maximumHeights = maximumHeights;
  55632. this._vertexFormat = VertexFormat_default.clone(vertexFormat);
  55633. this._granularity = granularity;
  55634. this._ellipsoid = Ellipsoid_default.clone(ellipsoid);
  55635. this._workerName = "createWallGeometry";
  55636. let numComponents = 1 + wallPositions.length * Cartesian3_default.packedLength + 2;
  55637. if (defined_default(minimumHeights)) {
  55638. numComponents += minimumHeights.length;
  55639. }
  55640. if (defined_default(maximumHeights)) {
  55641. numComponents += maximumHeights.length;
  55642. }
  55643. this.packedLength = numComponents + Ellipsoid_default.packedLength + VertexFormat_default.packedLength + 1;
  55644. }
  55645. WallGeometry.pack = function(value, array, startingIndex) {
  55646. if (!defined_default(value)) {
  55647. throw new DeveloperError_default("value is required");
  55648. }
  55649. if (!defined_default(array)) {
  55650. throw new DeveloperError_default("array is required");
  55651. }
  55652. startingIndex = defaultValue_default(startingIndex, 0);
  55653. let i2;
  55654. const positions = value._positions;
  55655. let length3 = positions.length;
  55656. array[startingIndex++] = length3;
  55657. for (i2 = 0; i2 < length3; ++i2, startingIndex += Cartesian3_default.packedLength) {
  55658. Cartesian3_default.pack(positions[i2], array, startingIndex);
  55659. }
  55660. const minimumHeights = value._minimumHeights;
  55661. length3 = defined_default(minimumHeights) ? minimumHeights.length : 0;
  55662. array[startingIndex++] = length3;
  55663. if (defined_default(minimumHeights)) {
  55664. for (i2 = 0; i2 < length3; ++i2) {
  55665. array[startingIndex++] = minimumHeights[i2];
  55666. }
  55667. }
  55668. const maximumHeights = value._maximumHeights;
  55669. length3 = defined_default(maximumHeights) ? maximumHeights.length : 0;
  55670. array[startingIndex++] = length3;
  55671. if (defined_default(maximumHeights)) {
  55672. for (i2 = 0; i2 < length3; ++i2) {
  55673. array[startingIndex++] = maximumHeights[i2];
  55674. }
  55675. }
  55676. Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
  55677. startingIndex += Ellipsoid_default.packedLength;
  55678. VertexFormat_default.pack(value._vertexFormat, array, startingIndex);
  55679. startingIndex += VertexFormat_default.packedLength;
  55680. array[startingIndex] = value._granularity;
  55681. return array;
  55682. };
  55683. var scratchEllipsoid13 = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
  55684. var scratchVertexFormat13 = new VertexFormat_default();
  55685. var scratchOptions23 = {
  55686. positions: void 0,
  55687. minimumHeights: void 0,
  55688. maximumHeights: void 0,
  55689. ellipsoid: scratchEllipsoid13,
  55690. vertexFormat: scratchVertexFormat13,
  55691. granularity: void 0
  55692. };
  55693. WallGeometry.unpack = function(array, startingIndex, result) {
  55694. if (!defined_default(array)) {
  55695. throw new DeveloperError_default("array is required");
  55696. }
  55697. startingIndex = defaultValue_default(startingIndex, 0);
  55698. let i2;
  55699. let length3 = array[startingIndex++];
  55700. const positions = new Array(length3);
  55701. for (i2 = 0; i2 < length3; ++i2, startingIndex += Cartesian3_default.packedLength) {
  55702. positions[i2] = Cartesian3_default.unpack(array, startingIndex);
  55703. }
  55704. length3 = array[startingIndex++];
  55705. let minimumHeights;
  55706. if (length3 > 0) {
  55707. minimumHeights = new Array(length3);
  55708. for (i2 = 0; i2 < length3; ++i2) {
  55709. minimumHeights[i2] = array[startingIndex++];
  55710. }
  55711. }
  55712. length3 = array[startingIndex++];
  55713. let maximumHeights;
  55714. if (length3 > 0) {
  55715. maximumHeights = new Array(length3);
  55716. for (i2 = 0; i2 < length3; ++i2) {
  55717. maximumHeights[i2] = array[startingIndex++];
  55718. }
  55719. }
  55720. const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid13);
  55721. startingIndex += Ellipsoid_default.packedLength;
  55722. const vertexFormat = VertexFormat_default.unpack(
  55723. array,
  55724. startingIndex,
  55725. scratchVertexFormat13
  55726. );
  55727. startingIndex += VertexFormat_default.packedLength;
  55728. const granularity = array[startingIndex];
  55729. if (!defined_default(result)) {
  55730. scratchOptions23.positions = positions;
  55731. scratchOptions23.minimumHeights = minimumHeights;
  55732. scratchOptions23.maximumHeights = maximumHeights;
  55733. scratchOptions23.granularity = granularity;
  55734. return new WallGeometry(scratchOptions23);
  55735. }
  55736. result._positions = positions;
  55737. result._minimumHeights = minimumHeights;
  55738. result._maximumHeights = maximumHeights;
  55739. result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
  55740. result._vertexFormat = VertexFormat_default.clone(vertexFormat, result._vertexFormat);
  55741. result._granularity = granularity;
  55742. return result;
  55743. };
  55744. WallGeometry.fromConstantHeights = function(options) {
  55745. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  55746. const positions = options.positions;
  55747. if (!defined_default(positions)) {
  55748. throw new DeveloperError_default("options.positions is required.");
  55749. }
  55750. let minHeights;
  55751. let maxHeights;
  55752. const min3 = options.minimumHeight;
  55753. const max3 = options.maximumHeight;
  55754. const doMin = defined_default(min3);
  55755. const doMax = defined_default(max3);
  55756. if (doMin || doMax) {
  55757. const length3 = positions.length;
  55758. minHeights = doMin ? new Array(length3) : void 0;
  55759. maxHeights = doMax ? new Array(length3) : void 0;
  55760. for (let i2 = 0; i2 < length3; ++i2) {
  55761. if (doMin) {
  55762. minHeights[i2] = min3;
  55763. }
  55764. if (doMax) {
  55765. maxHeights[i2] = max3;
  55766. }
  55767. }
  55768. }
  55769. const newOptions2 = {
  55770. positions,
  55771. maximumHeights: maxHeights,
  55772. minimumHeights: minHeights,
  55773. ellipsoid: options.ellipsoid,
  55774. vertexFormat: options.vertexFormat
  55775. };
  55776. return new WallGeometry(newOptions2);
  55777. };
  55778. WallGeometry.createGeometry = function(wallGeometry) {
  55779. const wallPositions = wallGeometry._positions;
  55780. const minimumHeights = wallGeometry._minimumHeights;
  55781. const maximumHeights = wallGeometry._maximumHeights;
  55782. const vertexFormat = wallGeometry._vertexFormat;
  55783. const granularity = wallGeometry._granularity;
  55784. const ellipsoid = wallGeometry._ellipsoid;
  55785. const pos = WallGeometryLibrary_default.computePositions(
  55786. ellipsoid,
  55787. wallPositions,
  55788. maximumHeights,
  55789. minimumHeights,
  55790. granularity,
  55791. true
  55792. );
  55793. if (!defined_default(pos)) {
  55794. return;
  55795. }
  55796. const bottomPositions = pos.bottomPositions;
  55797. const topPositions = pos.topPositions;
  55798. const numCorners = pos.numCorners;
  55799. let length3 = topPositions.length;
  55800. let size = length3 * 2;
  55801. const positions = vertexFormat.position ? new Float64Array(size) : void 0;
  55802. const normals = vertexFormat.normal ? new Float32Array(size) : void 0;
  55803. const tangents = vertexFormat.tangent ? new Float32Array(size) : void 0;
  55804. const bitangents = vertexFormat.bitangent ? new Float32Array(size) : void 0;
  55805. const textureCoordinates = vertexFormat.st ? new Float32Array(size / 3 * 2) : void 0;
  55806. let positionIndex = 0;
  55807. let normalIndex = 0;
  55808. let bitangentIndex = 0;
  55809. let tangentIndex = 0;
  55810. let stIndex = 0;
  55811. let normal2 = scratchNormal7;
  55812. let tangent = scratchTangent5;
  55813. let bitangent = scratchBitangent5;
  55814. let recomputeNormal = true;
  55815. length3 /= 3;
  55816. let i2;
  55817. let s2 = 0;
  55818. const ds = 1 / (length3 - numCorners - 1);
  55819. for (i2 = 0; i2 < length3; ++i2) {
  55820. const i3 = i2 * 3;
  55821. const topPosition = Cartesian3_default.fromArray(
  55822. topPositions,
  55823. i3,
  55824. scratchCartesian3Position1
  55825. );
  55826. const bottomPosition = Cartesian3_default.fromArray(
  55827. bottomPositions,
  55828. i3,
  55829. scratchCartesian3Position2
  55830. );
  55831. if (vertexFormat.position) {
  55832. positions[positionIndex++] = bottomPosition.x;
  55833. positions[positionIndex++] = bottomPosition.y;
  55834. positions[positionIndex++] = bottomPosition.z;
  55835. positions[positionIndex++] = topPosition.x;
  55836. positions[positionIndex++] = topPosition.y;
  55837. positions[positionIndex++] = topPosition.z;
  55838. }
  55839. if (vertexFormat.st) {
  55840. textureCoordinates[stIndex++] = s2;
  55841. textureCoordinates[stIndex++] = 0;
  55842. textureCoordinates[stIndex++] = s2;
  55843. textureCoordinates[stIndex++] = 1;
  55844. }
  55845. if (vertexFormat.normal || vertexFormat.tangent || vertexFormat.bitangent) {
  55846. let nextTop = Cartesian3_default.clone(
  55847. Cartesian3_default.ZERO,
  55848. scratchCartesian3Position5
  55849. );
  55850. const groundPosition = Cartesian3_default.subtract(
  55851. topPosition,
  55852. ellipsoid.geodeticSurfaceNormal(
  55853. topPosition,
  55854. scratchCartesian3Position2
  55855. ),
  55856. scratchCartesian3Position2
  55857. );
  55858. if (i2 + 1 < length3) {
  55859. nextTop = Cartesian3_default.fromArray(
  55860. topPositions,
  55861. i3 + 3,
  55862. scratchCartesian3Position5
  55863. );
  55864. }
  55865. if (recomputeNormal) {
  55866. const scalednextPosition = Cartesian3_default.subtract(
  55867. nextTop,
  55868. topPosition,
  55869. scratchCartesian3Position4
  55870. );
  55871. const scaledGroundPosition = Cartesian3_default.subtract(
  55872. groundPosition,
  55873. topPosition,
  55874. scratchCartesian3Position1
  55875. );
  55876. normal2 = Cartesian3_default.normalize(
  55877. Cartesian3_default.cross(scaledGroundPosition, scalednextPosition, normal2),
  55878. normal2
  55879. );
  55880. recomputeNormal = false;
  55881. }
  55882. if (Cartesian3_default.equalsEpsilon(topPosition, nextTop, Math_default.EPSILON10)) {
  55883. recomputeNormal = true;
  55884. } else {
  55885. s2 += ds;
  55886. if (vertexFormat.tangent) {
  55887. tangent = Cartesian3_default.normalize(
  55888. Cartesian3_default.subtract(nextTop, topPosition, tangent),
  55889. tangent
  55890. );
  55891. }
  55892. if (vertexFormat.bitangent) {
  55893. bitangent = Cartesian3_default.normalize(
  55894. Cartesian3_default.cross(normal2, tangent, bitangent),
  55895. bitangent
  55896. );
  55897. }
  55898. }
  55899. if (vertexFormat.normal) {
  55900. normals[normalIndex++] = normal2.x;
  55901. normals[normalIndex++] = normal2.y;
  55902. normals[normalIndex++] = normal2.z;
  55903. normals[normalIndex++] = normal2.x;
  55904. normals[normalIndex++] = normal2.y;
  55905. normals[normalIndex++] = normal2.z;
  55906. }
  55907. if (vertexFormat.tangent) {
  55908. tangents[tangentIndex++] = tangent.x;
  55909. tangents[tangentIndex++] = tangent.y;
  55910. tangents[tangentIndex++] = tangent.z;
  55911. tangents[tangentIndex++] = tangent.x;
  55912. tangents[tangentIndex++] = tangent.y;
  55913. tangents[tangentIndex++] = tangent.z;
  55914. }
  55915. if (vertexFormat.bitangent) {
  55916. bitangents[bitangentIndex++] = bitangent.x;
  55917. bitangents[bitangentIndex++] = bitangent.y;
  55918. bitangents[bitangentIndex++] = bitangent.z;
  55919. bitangents[bitangentIndex++] = bitangent.x;
  55920. bitangents[bitangentIndex++] = bitangent.y;
  55921. bitangents[bitangentIndex++] = bitangent.z;
  55922. }
  55923. }
  55924. }
  55925. const attributes = new GeometryAttributes_default();
  55926. if (vertexFormat.position) {
  55927. attributes.position = new GeometryAttribute_default({
  55928. componentDatatype: ComponentDatatype_default.DOUBLE,
  55929. componentsPerAttribute: 3,
  55930. values: positions
  55931. });
  55932. }
  55933. if (vertexFormat.normal) {
  55934. attributes.normal = new GeometryAttribute_default({
  55935. componentDatatype: ComponentDatatype_default.FLOAT,
  55936. componentsPerAttribute: 3,
  55937. values: normals
  55938. });
  55939. }
  55940. if (vertexFormat.tangent) {
  55941. attributes.tangent = new GeometryAttribute_default({
  55942. componentDatatype: ComponentDatatype_default.FLOAT,
  55943. componentsPerAttribute: 3,
  55944. values: tangents
  55945. });
  55946. }
  55947. if (vertexFormat.bitangent) {
  55948. attributes.bitangent = new GeometryAttribute_default({
  55949. componentDatatype: ComponentDatatype_default.FLOAT,
  55950. componentsPerAttribute: 3,
  55951. values: bitangents
  55952. });
  55953. }
  55954. if (vertexFormat.st) {
  55955. attributes.st = new GeometryAttribute_default({
  55956. componentDatatype: ComponentDatatype_default.FLOAT,
  55957. componentsPerAttribute: 2,
  55958. values: textureCoordinates
  55959. });
  55960. }
  55961. const numVertices = size / 3;
  55962. size -= 6 * (numCorners + 1);
  55963. const indices2 = IndexDatatype_default.createTypedArray(numVertices, size);
  55964. let edgeIndex = 0;
  55965. for (i2 = 0; i2 < numVertices - 2; i2 += 2) {
  55966. const LL = i2;
  55967. const LR = i2 + 2;
  55968. const pl = Cartesian3_default.fromArray(
  55969. positions,
  55970. LL * 3,
  55971. scratchCartesian3Position1
  55972. );
  55973. const pr = Cartesian3_default.fromArray(
  55974. positions,
  55975. LR * 3,
  55976. scratchCartesian3Position2
  55977. );
  55978. if (Cartesian3_default.equalsEpsilon(pl, pr, Math_default.EPSILON10)) {
  55979. continue;
  55980. }
  55981. const UL = i2 + 1;
  55982. const UR = i2 + 3;
  55983. indices2[edgeIndex++] = UL;
  55984. indices2[edgeIndex++] = LL;
  55985. indices2[edgeIndex++] = UR;
  55986. indices2[edgeIndex++] = UR;
  55987. indices2[edgeIndex++] = LL;
  55988. indices2[edgeIndex++] = LR;
  55989. }
  55990. return new Geometry_default({
  55991. attributes,
  55992. indices: indices2,
  55993. primitiveType: PrimitiveType_default.TRIANGLES,
  55994. boundingSphere: new BoundingSphere_default.fromVertices(positions)
  55995. });
  55996. };
  55997. var WallGeometry_default = WallGeometry;
  55998. // node_modules/cesium/Source/Core/WallOutlineGeometry.js
  55999. var scratchCartesian3Position12 = new Cartesian3_default();
  56000. var scratchCartesian3Position22 = new Cartesian3_default();
  56001. function WallOutlineGeometry(options) {
  56002. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  56003. const wallPositions = options.positions;
  56004. const maximumHeights = options.maximumHeights;
  56005. const minimumHeights = options.minimumHeights;
  56006. if (!defined_default(wallPositions)) {
  56007. throw new DeveloperError_default("options.positions is required.");
  56008. }
  56009. if (defined_default(maximumHeights) && maximumHeights.length !== wallPositions.length) {
  56010. throw new DeveloperError_default(
  56011. "options.positions and options.maximumHeights must have the same length."
  56012. );
  56013. }
  56014. if (defined_default(minimumHeights) && minimumHeights.length !== wallPositions.length) {
  56015. throw new DeveloperError_default(
  56016. "options.positions and options.minimumHeights must have the same length."
  56017. );
  56018. }
  56019. const granularity = defaultValue_default(
  56020. options.granularity,
  56021. Math_default.RADIANS_PER_DEGREE
  56022. );
  56023. const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  56024. this._positions = wallPositions;
  56025. this._minimumHeights = minimumHeights;
  56026. this._maximumHeights = maximumHeights;
  56027. this._granularity = granularity;
  56028. this._ellipsoid = Ellipsoid_default.clone(ellipsoid);
  56029. this._workerName = "createWallOutlineGeometry";
  56030. let numComponents = 1 + wallPositions.length * Cartesian3_default.packedLength + 2;
  56031. if (defined_default(minimumHeights)) {
  56032. numComponents += minimumHeights.length;
  56033. }
  56034. if (defined_default(maximumHeights)) {
  56035. numComponents += maximumHeights.length;
  56036. }
  56037. this.packedLength = numComponents + Ellipsoid_default.packedLength + 1;
  56038. }
  56039. WallOutlineGeometry.pack = function(value, array, startingIndex) {
  56040. if (!defined_default(value)) {
  56041. throw new DeveloperError_default("value is required");
  56042. }
  56043. if (!defined_default(array)) {
  56044. throw new DeveloperError_default("array is required");
  56045. }
  56046. startingIndex = defaultValue_default(startingIndex, 0);
  56047. let i2;
  56048. const positions = value._positions;
  56049. let length3 = positions.length;
  56050. array[startingIndex++] = length3;
  56051. for (i2 = 0; i2 < length3; ++i2, startingIndex += Cartesian3_default.packedLength) {
  56052. Cartesian3_default.pack(positions[i2], array, startingIndex);
  56053. }
  56054. const minimumHeights = value._minimumHeights;
  56055. length3 = defined_default(minimumHeights) ? minimumHeights.length : 0;
  56056. array[startingIndex++] = length3;
  56057. if (defined_default(minimumHeights)) {
  56058. for (i2 = 0; i2 < length3; ++i2) {
  56059. array[startingIndex++] = minimumHeights[i2];
  56060. }
  56061. }
  56062. const maximumHeights = value._maximumHeights;
  56063. length3 = defined_default(maximumHeights) ? maximumHeights.length : 0;
  56064. array[startingIndex++] = length3;
  56065. if (defined_default(maximumHeights)) {
  56066. for (i2 = 0; i2 < length3; ++i2) {
  56067. array[startingIndex++] = maximumHeights[i2];
  56068. }
  56069. }
  56070. Ellipsoid_default.pack(value._ellipsoid, array, startingIndex);
  56071. startingIndex += Ellipsoid_default.packedLength;
  56072. array[startingIndex] = value._granularity;
  56073. return array;
  56074. };
  56075. var scratchEllipsoid14 = Ellipsoid_default.clone(Ellipsoid_default.UNIT_SPHERE);
  56076. var scratchOptions24 = {
  56077. positions: void 0,
  56078. minimumHeights: void 0,
  56079. maximumHeights: void 0,
  56080. ellipsoid: scratchEllipsoid14,
  56081. granularity: void 0
  56082. };
  56083. WallOutlineGeometry.unpack = function(array, startingIndex, result) {
  56084. if (!defined_default(array)) {
  56085. throw new DeveloperError_default("array is required");
  56086. }
  56087. startingIndex = defaultValue_default(startingIndex, 0);
  56088. let i2;
  56089. let length3 = array[startingIndex++];
  56090. const positions = new Array(length3);
  56091. for (i2 = 0; i2 < length3; ++i2, startingIndex += Cartesian3_default.packedLength) {
  56092. positions[i2] = Cartesian3_default.unpack(array, startingIndex);
  56093. }
  56094. length3 = array[startingIndex++];
  56095. let minimumHeights;
  56096. if (length3 > 0) {
  56097. minimumHeights = new Array(length3);
  56098. for (i2 = 0; i2 < length3; ++i2) {
  56099. minimumHeights[i2] = array[startingIndex++];
  56100. }
  56101. }
  56102. length3 = array[startingIndex++];
  56103. let maximumHeights;
  56104. if (length3 > 0) {
  56105. maximumHeights = new Array(length3);
  56106. for (i2 = 0; i2 < length3; ++i2) {
  56107. maximumHeights[i2] = array[startingIndex++];
  56108. }
  56109. }
  56110. const ellipsoid = Ellipsoid_default.unpack(array, startingIndex, scratchEllipsoid14);
  56111. startingIndex += Ellipsoid_default.packedLength;
  56112. const granularity = array[startingIndex];
  56113. if (!defined_default(result)) {
  56114. scratchOptions24.positions = positions;
  56115. scratchOptions24.minimumHeights = minimumHeights;
  56116. scratchOptions24.maximumHeights = maximumHeights;
  56117. scratchOptions24.granularity = granularity;
  56118. return new WallOutlineGeometry(scratchOptions24);
  56119. }
  56120. result._positions = positions;
  56121. result._minimumHeights = minimumHeights;
  56122. result._maximumHeights = maximumHeights;
  56123. result._ellipsoid = Ellipsoid_default.clone(ellipsoid, result._ellipsoid);
  56124. result._granularity = granularity;
  56125. return result;
  56126. };
  56127. WallOutlineGeometry.fromConstantHeights = function(options) {
  56128. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  56129. const positions = options.positions;
  56130. if (!defined_default(positions)) {
  56131. throw new DeveloperError_default("options.positions is required.");
  56132. }
  56133. let minHeights;
  56134. let maxHeights;
  56135. const min3 = options.minimumHeight;
  56136. const max3 = options.maximumHeight;
  56137. const doMin = defined_default(min3);
  56138. const doMax = defined_default(max3);
  56139. if (doMin || doMax) {
  56140. const length3 = positions.length;
  56141. minHeights = doMin ? new Array(length3) : void 0;
  56142. maxHeights = doMax ? new Array(length3) : void 0;
  56143. for (let i2 = 0; i2 < length3; ++i2) {
  56144. if (doMin) {
  56145. minHeights[i2] = min3;
  56146. }
  56147. if (doMax) {
  56148. maxHeights[i2] = max3;
  56149. }
  56150. }
  56151. }
  56152. const newOptions2 = {
  56153. positions,
  56154. maximumHeights: maxHeights,
  56155. minimumHeights: minHeights,
  56156. ellipsoid: options.ellipsoid
  56157. };
  56158. return new WallOutlineGeometry(newOptions2);
  56159. };
  56160. WallOutlineGeometry.createGeometry = function(wallGeometry) {
  56161. const wallPositions = wallGeometry._positions;
  56162. const minimumHeights = wallGeometry._minimumHeights;
  56163. const maximumHeights = wallGeometry._maximumHeights;
  56164. const granularity = wallGeometry._granularity;
  56165. const ellipsoid = wallGeometry._ellipsoid;
  56166. const pos = WallGeometryLibrary_default.computePositions(
  56167. ellipsoid,
  56168. wallPositions,
  56169. maximumHeights,
  56170. minimumHeights,
  56171. granularity,
  56172. false
  56173. );
  56174. if (!defined_default(pos)) {
  56175. return;
  56176. }
  56177. const bottomPositions = pos.bottomPositions;
  56178. const topPositions = pos.topPositions;
  56179. let length3 = topPositions.length;
  56180. let size = length3 * 2;
  56181. const positions = new Float64Array(size);
  56182. let positionIndex = 0;
  56183. length3 /= 3;
  56184. let i2;
  56185. for (i2 = 0; i2 < length3; ++i2) {
  56186. const i3 = i2 * 3;
  56187. const topPosition = Cartesian3_default.fromArray(
  56188. topPositions,
  56189. i3,
  56190. scratchCartesian3Position12
  56191. );
  56192. const bottomPosition = Cartesian3_default.fromArray(
  56193. bottomPositions,
  56194. i3,
  56195. scratchCartesian3Position22
  56196. );
  56197. positions[positionIndex++] = bottomPosition.x;
  56198. positions[positionIndex++] = bottomPosition.y;
  56199. positions[positionIndex++] = bottomPosition.z;
  56200. positions[positionIndex++] = topPosition.x;
  56201. positions[positionIndex++] = topPosition.y;
  56202. positions[positionIndex++] = topPosition.z;
  56203. }
  56204. const attributes = new GeometryAttributes_default({
  56205. position: new GeometryAttribute_default({
  56206. componentDatatype: ComponentDatatype_default.DOUBLE,
  56207. componentsPerAttribute: 3,
  56208. values: positions
  56209. })
  56210. });
  56211. const numVertices = size / 3;
  56212. size = 2 * numVertices - 4 + numVertices;
  56213. const indices2 = IndexDatatype_default.createTypedArray(numVertices, size);
  56214. let edgeIndex = 0;
  56215. for (i2 = 0; i2 < numVertices - 2; i2 += 2) {
  56216. const LL = i2;
  56217. const LR = i2 + 2;
  56218. const pl = Cartesian3_default.fromArray(
  56219. positions,
  56220. LL * 3,
  56221. scratchCartesian3Position12
  56222. );
  56223. const pr = Cartesian3_default.fromArray(
  56224. positions,
  56225. LR * 3,
  56226. scratchCartesian3Position22
  56227. );
  56228. if (Cartesian3_default.equalsEpsilon(pl, pr, Math_default.EPSILON10)) {
  56229. continue;
  56230. }
  56231. const UL = i2 + 1;
  56232. const UR = i2 + 3;
  56233. indices2[edgeIndex++] = UL;
  56234. indices2[edgeIndex++] = LL;
  56235. indices2[edgeIndex++] = UL;
  56236. indices2[edgeIndex++] = UR;
  56237. indices2[edgeIndex++] = LL;
  56238. indices2[edgeIndex++] = LR;
  56239. }
  56240. indices2[edgeIndex++] = numVertices - 2;
  56241. indices2[edgeIndex++] = numVertices - 1;
  56242. return new Geometry_default({
  56243. attributes,
  56244. indices: indices2,
  56245. primitiveType: PrimitiveType_default.LINES,
  56246. boundingSphere: new BoundingSphere_default.fromVertices(positions)
  56247. });
  56248. };
  56249. var WallOutlineGeometry_default = WallOutlineGeometry;
  56250. // node_modules/cesium/Source/Core/WireframeIndexGenerator.js
  56251. var WireframeIndexGenerator = {};
  56252. function createWireframeFromTriangles(vertexCount) {
  56253. const wireframeIndices = IndexDatatype_default.createTypedArray(
  56254. vertexCount,
  56255. vertexCount * 2
  56256. );
  56257. const length3 = vertexCount;
  56258. let index2 = 0;
  56259. for (let i2 = 0; i2 < length3; i2 += 3) {
  56260. wireframeIndices[index2++] = i2;
  56261. wireframeIndices[index2++] = i2 + 1;
  56262. wireframeIndices[index2++] = i2 + 1;
  56263. wireframeIndices[index2++] = i2 + 2;
  56264. wireframeIndices[index2++] = i2 + 2;
  56265. wireframeIndices[index2++] = i2;
  56266. }
  56267. return wireframeIndices;
  56268. }
  56269. function createWireframeFromTriangleIndices(vertexCount, originalIndices) {
  56270. const originalIndicesCount = originalIndices.length;
  56271. const wireframeIndices = IndexDatatype_default.createTypedArray(
  56272. vertexCount,
  56273. originalIndicesCount * 2
  56274. );
  56275. let index2 = 0;
  56276. for (let i2 = 0; i2 < originalIndicesCount; i2 += 3) {
  56277. const point0 = originalIndices[i2];
  56278. const point1 = originalIndices[i2 + 1];
  56279. const point2 = originalIndices[i2 + 2];
  56280. wireframeIndices[index2++] = point0;
  56281. wireframeIndices[index2++] = point1;
  56282. wireframeIndices[index2++] = point1;
  56283. wireframeIndices[index2++] = point2;
  56284. wireframeIndices[index2++] = point2;
  56285. wireframeIndices[index2++] = point0;
  56286. }
  56287. return wireframeIndices;
  56288. }
  56289. function createWireframeFromTriangleStrip(vertexCount) {
  56290. const numberOfTriangles = vertexCount - 2;
  56291. const wireframeIndicesCount = 2 + numberOfTriangles * 4;
  56292. const wireframeIndices = IndexDatatype_default.createTypedArray(
  56293. vertexCount,
  56294. wireframeIndicesCount
  56295. );
  56296. let index2 = 0;
  56297. wireframeIndices[index2++] = 0;
  56298. wireframeIndices[index2++] = 1;
  56299. for (let i2 = 0; i2 < numberOfTriangles; i2++) {
  56300. wireframeIndices[index2++] = i2 + 1;
  56301. wireframeIndices[index2++] = i2 + 2;
  56302. wireframeIndices[index2++] = i2 + 2;
  56303. wireframeIndices[index2++] = i2;
  56304. }
  56305. return wireframeIndices;
  56306. }
  56307. function createWireframeFromTriangleStripIndices(vertexCount, originalIndices) {
  56308. const originalIndicesCount = originalIndices.length;
  56309. const numberOfTriangles = originalIndicesCount - 2;
  56310. const wireframeIndicesCount = 2 + numberOfTriangles * 4;
  56311. const wireframeIndices = IndexDatatype_default.createTypedArray(
  56312. vertexCount,
  56313. wireframeIndicesCount
  56314. );
  56315. let index2 = 0;
  56316. wireframeIndices[index2++] = originalIndices[0];
  56317. wireframeIndices[index2++] = originalIndices[1];
  56318. for (let i2 = 0; i2 < numberOfTriangles; i2++) {
  56319. const point0 = originalIndices[i2];
  56320. const point1 = originalIndices[i2 + 1];
  56321. const point2 = originalIndices[i2 + 2];
  56322. wireframeIndices[index2++] = point1;
  56323. wireframeIndices[index2++] = point2;
  56324. wireframeIndices[index2++] = point2;
  56325. wireframeIndices[index2++] = point0;
  56326. }
  56327. return wireframeIndices;
  56328. }
  56329. function createWireframeFromTriangleFan(vertexCount) {
  56330. const numberOfTriangles = vertexCount - 2;
  56331. const wireframeIndicesCount = 2 + numberOfTriangles * 4;
  56332. const wireframeIndices = IndexDatatype_default.createTypedArray(
  56333. vertexCount,
  56334. wireframeIndicesCount
  56335. );
  56336. let index2 = 0;
  56337. wireframeIndices[index2++] = 0;
  56338. wireframeIndices[index2++] = 1;
  56339. for (let i2 = 0; i2 < numberOfTriangles; i2++) {
  56340. wireframeIndices[index2++] = i2 + 1;
  56341. wireframeIndices[index2++] = i2 + 2;
  56342. wireframeIndices[index2++] = i2 + 2;
  56343. wireframeIndices[index2++] = 0;
  56344. }
  56345. return wireframeIndices;
  56346. }
  56347. function createWireframeFromTriangleFanIndices(vertexCount, originalIndices) {
  56348. const originalIndicesCount = originalIndices.length;
  56349. const numberOfTriangles = originalIndicesCount - 2;
  56350. const wireframeIndicesCount = 2 + numberOfTriangles * 4;
  56351. const wireframeIndices = IndexDatatype_default.createTypedArray(
  56352. vertexCount,
  56353. wireframeIndicesCount
  56354. );
  56355. let index2 = 0;
  56356. const firstPoint = originalIndices[0];
  56357. wireframeIndices[index2++] = firstPoint;
  56358. wireframeIndices[index2++] = originalIndices[1];
  56359. for (let i2 = 0; i2 < numberOfTriangles; i2++) {
  56360. const point1 = originalIndices[i2 + 1];
  56361. const point2 = originalIndices[i2 + 2];
  56362. wireframeIndices[index2++] = point1;
  56363. wireframeIndices[index2++] = point2;
  56364. wireframeIndices[index2++] = point2;
  56365. wireframeIndices[index2++] = firstPoint;
  56366. }
  56367. return wireframeIndices;
  56368. }
  56369. WireframeIndexGenerator.createWireframeIndices = function(primitiveType, vertexCount, originalIndices) {
  56370. const hasOriginalIndices = defined_default(originalIndices);
  56371. if (primitiveType === PrimitiveType_default.TRIANGLES) {
  56372. return hasOriginalIndices ? createWireframeFromTriangleIndices(vertexCount, originalIndices) : createWireframeFromTriangles(vertexCount);
  56373. }
  56374. if (primitiveType === PrimitiveType_default.TRIANGLE_STRIP) {
  56375. return hasOriginalIndices ? createWireframeFromTriangleStripIndices(vertexCount, originalIndices) : createWireframeFromTriangleStrip(vertexCount);
  56376. }
  56377. if (primitiveType === PrimitiveType_default.TRIANGLE_FAN) {
  56378. return hasOriginalIndices ? createWireframeFromTriangleFanIndices(vertexCount, originalIndices) : createWireframeFromTriangleFan(vertexCount);
  56379. }
  56380. return void 0;
  56381. };
  56382. WireframeIndexGenerator.getWireframeIndicesCount = function(primitiveType, originalCount) {
  56383. if (primitiveType === PrimitiveType_default.TRIANGLES) {
  56384. return originalCount * 2;
  56385. }
  56386. if (primitiveType === PrimitiveType_default.TRIANGLE_STRIP || primitiveType === PrimitiveType_default.TRIANGLE_FAN) {
  56387. const numberOfTriangles = originalCount - 2;
  56388. return 2 + numberOfTriangles * 4;
  56389. }
  56390. return originalCount;
  56391. };
  56392. var WireframeIndexGenerator_default = WireframeIndexGenerator;
  56393. // node_modules/cesium/Source/Core/arraySlice.js
  56394. function arraySlice(array, begin, end) {
  56395. Check_default.defined("array", array);
  56396. if (defined_default(begin)) {
  56397. Check_default.typeOf.number("begin", begin);
  56398. }
  56399. if (defined_default(end)) {
  56400. Check_default.typeOf.number("end", end);
  56401. }
  56402. if (typeof array.slice === "function") {
  56403. return array.slice(begin, end);
  56404. }
  56405. let copy = Array.prototype.slice.call(array, begin, end);
  56406. const typedArrayTypes2 = FeatureDetection_default.typedArrayTypes;
  56407. const length3 = typedArrayTypes2.length;
  56408. for (let i2 = 0; i2 < length3; ++i2) {
  56409. if (array instanceof typedArrayTypes2[i2]) {
  56410. copy = new typedArrayTypes2[i2](copy);
  56411. break;
  56412. }
  56413. }
  56414. return copy;
  56415. }
  56416. var arraySlice_default = arraySlice;
  56417. // node_modules/cesium/Source/Core/cancelAnimationFrame.js
  56418. var implementation2;
  56419. if (typeof cancelAnimationFrame !== "undefined") {
  56420. implementation2 = cancelAnimationFrame;
  56421. }
  56422. (function() {
  56423. if (!defined_default(implementation2) && typeof window !== "undefined") {
  56424. const vendors = ["webkit", "moz", "ms", "o"];
  56425. let i2 = 0;
  56426. const len = vendors.length;
  56427. while (i2 < len && !defined_default(implementation2)) {
  56428. implementation2 = window[`${vendors[i2]}CancelAnimationFrame`];
  56429. if (!defined_default(implementation2)) {
  56430. implementation2 = window[`${vendors[i2]}CancelRequestAnimationFrame`];
  56431. }
  56432. ++i2;
  56433. }
  56434. }
  56435. if (!defined_default(implementation2)) {
  56436. implementation2 = clearTimeout;
  56437. }
  56438. })();
  56439. function cancelAnimationFramePolyfill(requestID) {
  56440. implementation2(requestID);
  56441. }
  56442. var cancelAnimationFrame_default = cancelAnimationFramePolyfill;
  56443. // node_modules/cesium/Source/Core/createGuid.js
  56444. function createGuid() {
  56445. return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c14) {
  56446. const r2 = Math.random() * 16 | 0;
  56447. const v7 = c14 === "x" ? r2 : r2 & 3 | 8;
  56448. return v7.toString(16);
  56449. });
  56450. }
  56451. var createGuid_default = createGuid;
  56452. // node_modules/cesium/Source/Core/createWorldTerrain.js
  56453. function createWorldTerrain(options) {
  56454. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  56455. return new CesiumTerrainProvider_default({
  56456. url: IonResource_default.fromAssetId(1),
  56457. requestVertexNormals: defaultValue_default(options.requestVertexNormals, false),
  56458. requestWaterMask: defaultValue_default(options.requestWaterMask, false)
  56459. });
  56460. }
  56461. var createWorldTerrain_default = createWorldTerrain;
  56462. // node_modules/cesium/Source/Core/decodeGoogleEarthEnterpriseData.js
  56463. var compressedMagic = 1953029805;
  56464. var compressedMagicSwap = 2917034100;
  56465. function decodeGoogleEarthEnterpriseData(key, data) {
  56466. if (decodeGoogleEarthEnterpriseData.passThroughDataForTesting) {
  56467. return data;
  56468. }
  56469. Check_default.typeOf.object("key", key);
  56470. Check_default.typeOf.object("data", data);
  56471. const keyLength = key.byteLength;
  56472. if (keyLength === 0 || keyLength % 4 !== 0) {
  56473. throw new RuntimeError_default(
  56474. "The length of key must be greater than 0 and a multiple of 4."
  56475. );
  56476. }
  56477. const dataView = new DataView(data);
  56478. const magic = dataView.getUint32(0, true);
  56479. if (magic === compressedMagic || magic === compressedMagicSwap) {
  56480. return data;
  56481. }
  56482. const keyView = new DataView(key);
  56483. let dp = 0;
  56484. const dpend = data.byteLength;
  56485. const dpend64 = dpend - dpend % 8;
  56486. const kpend = keyLength;
  56487. let kp;
  56488. let off = 8;
  56489. while (dp < dpend64) {
  56490. off = (off + 8) % 24;
  56491. kp = off;
  56492. while (dp < dpend64 && kp < kpend) {
  56493. dataView.setUint32(
  56494. dp,
  56495. dataView.getUint32(dp, true) ^ keyView.getUint32(kp, true),
  56496. true
  56497. );
  56498. dataView.setUint32(
  56499. dp + 4,
  56500. dataView.getUint32(dp + 4, true) ^ keyView.getUint32(kp + 4, true),
  56501. true
  56502. );
  56503. dp += 8;
  56504. kp += 24;
  56505. }
  56506. }
  56507. if (dp < dpend) {
  56508. if (kp >= kpend) {
  56509. off = (off + 8) % 24;
  56510. kp = off;
  56511. }
  56512. while (dp < dpend) {
  56513. dataView.setUint8(dp, dataView.getUint8(dp) ^ keyView.getUint8(kp));
  56514. dp++;
  56515. kp++;
  56516. }
  56517. }
  56518. }
  56519. decodeGoogleEarthEnterpriseData.passThroughDataForTesting = false;
  56520. var decodeGoogleEarthEnterpriseData_default = decodeGoogleEarthEnterpriseData;
  56521. // node_modules/cesium/Source/Core/decodeVectorPolylinePositions.js
  56522. var maxShort2 = 32767;
  56523. var scratchBVCartographic = new Cartographic_default();
  56524. var scratchEncodedPosition = new Cartesian3_default();
  56525. function decodeVectorPolylinePositions(positions, rectangle, minimumHeight, maximumHeight, ellipsoid) {
  56526. const positionsLength = positions.length / 3;
  56527. const uBuffer = positions.subarray(0, positionsLength);
  56528. const vBuffer = positions.subarray(positionsLength, 2 * positionsLength);
  56529. const heightBuffer = positions.subarray(
  56530. 2 * positionsLength,
  56531. 3 * positionsLength
  56532. );
  56533. AttributeCompression_default.zigZagDeltaDecode(uBuffer, vBuffer, heightBuffer);
  56534. const decoded = new Float64Array(positions.length);
  56535. for (let i2 = 0; i2 < positionsLength; ++i2) {
  56536. const u3 = uBuffer[i2];
  56537. const v7 = vBuffer[i2];
  56538. const h = heightBuffer[i2];
  56539. const lon = Math_default.lerp(rectangle.west, rectangle.east, u3 / maxShort2);
  56540. const lat = Math_default.lerp(rectangle.south, rectangle.north, v7 / maxShort2);
  56541. const alt = Math_default.lerp(minimumHeight, maximumHeight, h / maxShort2);
  56542. const cartographic2 = Cartographic_default.fromRadians(
  56543. lon,
  56544. lat,
  56545. alt,
  56546. scratchBVCartographic
  56547. );
  56548. const decodedPosition = ellipsoid.cartographicToCartesian(
  56549. cartographic2,
  56550. scratchEncodedPosition
  56551. );
  56552. Cartesian3_default.pack(decodedPosition, decoded, i2 * 3);
  56553. }
  56554. return decoded;
  56555. }
  56556. var decodeVectorPolylinePositions_default = decodeVectorPolylinePositions;
  56557. // node_modules/cesium/Source/Core/deprecationWarning.js
  56558. function deprecationWarning(identifier, message) {
  56559. if (!defined_default(identifier) || !defined_default(message)) {
  56560. throw new DeveloperError_default("identifier and message are required.");
  56561. }
  56562. oneTimeWarning_default(identifier, message);
  56563. }
  56564. var deprecationWarning_default = deprecationWarning;
  56565. // node_modules/cesium/Source/Core/getFilenameFromUri.js
  56566. function getFilenameFromUri(uri) {
  56567. if (!defined_default(uri)) {
  56568. throw new DeveloperError_default("uri is required.");
  56569. }
  56570. const uriObject = new URI(uri);
  56571. uriObject.normalize();
  56572. let path = uriObject.path();
  56573. const index2 = path.lastIndexOf("/");
  56574. if (index2 !== -1) {
  56575. path = path.substr(index2 + 1);
  56576. }
  56577. return path;
  56578. }
  56579. var getFilenameFromUri_default = getFilenameFromUri;
  56580. // node_modules/cesium/Source/Core/getMagic.js
  56581. function getMagic(uint8Array, byteOffset) {
  56582. byteOffset = defaultValue_default(byteOffset, 0);
  56583. return getStringFromTypedArray_default(
  56584. uint8Array,
  56585. byteOffset,
  56586. Math.min(4, uint8Array.length)
  56587. );
  56588. }
  56589. var getMagic_default = getMagic;
  56590. // node_modules/cesium/Source/Core/loadImageFromTypedArray.js
  56591. function loadImageFromTypedArray(options) {
  56592. const uint8Array = options.uint8Array;
  56593. const format = options.format;
  56594. const request = options.request;
  56595. const flipY = defaultValue_default(options.flipY, false);
  56596. const skipColorSpaceConversion = defaultValue_default(
  56597. options.skipColorSpaceConversion,
  56598. false
  56599. );
  56600. Check_default.typeOf.object("uint8Array", uint8Array);
  56601. Check_default.typeOf.string("format", format);
  56602. const blob = new Blob([uint8Array], {
  56603. type: format
  56604. });
  56605. let blobUrl;
  56606. return Resource_default.supportsImageBitmapOptions().then(function(result) {
  56607. if (result) {
  56608. return Promise.resolve(
  56609. Resource_default.createImageBitmapFromBlob(blob, {
  56610. flipY,
  56611. premultiplyAlpha: false,
  56612. skipColorSpaceConversion
  56613. })
  56614. );
  56615. }
  56616. blobUrl = window.URL.createObjectURL(blob);
  56617. const resource = new Resource_default({
  56618. url: blobUrl,
  56619. request
  56620. });
  56621. return resource.fetchImage({
  56622. flipY,
  56623. skipColorSpaceConversion
  56624. });
  56625. }).then(function(result) {
  56626. if (defined_default(blobUrl)) {
  56627. window.URL.revokeObjectURL(blobUrl);
  56628. }
  56629. return result;
  56630. }).catch(function(error) {
  56631. if (defined_default(blobUrl)) {
  56632. window.URL.revokeObjectURL(blobUrl);
  56633. }
  56634. return Promise.reject(error);
  56635. });
  56636. }
  56637. var loadImageFromTypedArray_default = loadImageFromTypedArray;
  56638. // node_modules/cesium/Source/Core/loadKTX2.js
  56639. var supportedTranscoderFormats;
  56640. loadKTX2.setKTX2SupportedFormats = function(s3tc, pvrtc, astc, etc, etc1, bc7) {
  56641. supportedTranscoderFormats = {
  56642. s3tc,
  56643. pvrtc,
  56644. astc,
  56645. etc,
  56646. etc1,
  56647. bc7
  56648. };
  56649. };
  56650. function loadKTX2(resourceOrUrlOrBuffer) {
  56651. Check_default.defined("resourceOrUrlOrBuffer", resourceOrUrlOrBuffer);
  56652. let loadPromise;
  56653. if (resourceOrUrlOrBuffer instanceof ArrayBuffer || ArrayBuffer.isView(resourceOrUrlOrBuffer)) {
  56654. loadPromise = Promise.resolve(resourceOrUrlOrBuffer);
  56655. } else {
  56656. const resource = Resource_default.createIfNeeded(resourceOrUrlOrBuffer);
  56657. loadPromise = resource.fetchArrayBuffer();
  56658. }
  56659. return loadPromise.then(function(data) {
  56660. return KTX2Transcoder_default.transcode(data, supportedTranscoderFormats);
  56661. });
  56662. }
  56663. var loadKTX2_default = loadKTX2;
  56664. // node_modules/cesium/Source/Core/mergeSort.js
  56665. var leftScratchArray = [];
  56666. var rightScratchArray = [];
  56667. function merge(array, compare, userDefinedObject, start, middle, end) {
  56668. const leftLength = middle - start + 1;
  56669. const rightLength = end - middle;
  56670. const left = leftScratchArray;
  56671. const right = rightScratchArray;
  56672. let i2;
  56673. let j;
  56674. for (i2 = 0; i2 < leftLength; ++i2) {
  56675. left[i2] = array[start + i2];
  56676. }
  56677. for (j = 0; j < rightLength; ++j) {
  56678. right[j] = array[middle + j + 1];
  56679. }
  56680. i2 = 0;
  56681. j = 0;
  56682. for (let k = start; k <= end; ++k) {
  56683. const leftElement = left[i2];
  56684. const rightElement = right[j];
  56685. if (i2 < leftLength && (j >= rightLength || compare(leftElement, rightElement, userDefinedObject) <= 0)) {
  56686. array[k] = leftElement;
  56687. ++i2;
  56688. } else if (j < rightLength) {
  56689. array[k] = rightElement;
  56690. ++j;
  56691. }
  56692. }
  56693. }
  56694. function sort(array, compare, userDefinedObject, start, end) {
  56695. if (start >= end) {
  56696. return;
  56697. }
  56698. const middle = Math.floor((start + end) * 0.5);
  56699. sort(array, compare, userDefinedObject, start, middle);
  56700. sort(array, compare, userDefinedObject, middle + 1, end);
  56701. merge(array, compare, userDefinedObject, start, middle, end);
  56702. }
  56703. function mergeSort(array, comparator, userDefinedObject) {
  56704. if (!defined_default(array)) {
  56705. throw new DeveloperError_default("array is required.");
  56706. }
  56707. if (!defined_default(comparator)) {
  56708. throw new DeveloperError_default("comparator is required.");
  56709. }
  56710. const length3 = array.length;
  56711. const scratchLength = Math.ceil(length3 * 0.5);
  56712. leftScratchArray.length = scratchLength;
  56713. rightScratchArray.length = scratchLength;
  56714. sort(array, comparator, userDefinedObject, 0, length3 - 1);
  56715. leftScratchArray.length = 0;
  56716. rightScratchArray.length = 0;
  56717. }
  56718. var mergeSort_default = mergeSort;
  56719. // node_modules/cesium/Source/Core/pointInsideTriangle.js
  56720. var scratchBarycentricCoords = new Cartesian3_default();
  56721. function pointInsideTriangle(point, p0, p1, p2) {
  56722. const coords = barycentricCoordinates_default(
  56723. point,
  56724. p0,
  56725. p1,
  56726. p2,
  56727. scratchBarycentricCoords
  56728. );
  56729. if (!defined_default(coords)) {
  56730. return false;
  56731. }
  56732. return coords.x > 0 && coords.y > 0 && coords.z > 0;
  56733. }
  56734. var pointInsideTriangle_default = pointInsideTriangle;
  56735. // node_modules/cesium/Source/Core/requestAnimationFrame.js
  56736. var implementation3;
  56737. if (typeof requestAnimationFrame !== "undefined") {
  56738. implementation3 = requestAnimationFrame;
  56739. }
  56740. (function() {
  56741. if (!defined_default(implementation3) && typeof window !== "undefined") {
  56742. const vendors = ["webkit", "moz", "ms", "o"];
  56743. let i2 = 0;
  56744. const len = vendors.length;
  56745. while (i2 < len && !defined_default(implementation3)) {
  56746. implementation3 = window[`${vendors[i2]}RequestAnimationFrame`];
  56747. ++i2;
  56748. }
  56749. }
  56750. if (!defined_default(implementation3)) {
  56751. const msPerFrame = 1e3 / 60;
  56752. let lastFrameTime = 0;
  56753. implementation3 = function(callback) {
  56754. const currentTime = getTimestamp_default();
  56755. const delay = Math.max(msPerFrame - (currentTime - lastFrameTime), 0);
  56756. lastFrameTime = currentTime + delay;
  56757. return setTimeout(function() {
  56758. callback(lastFrameTime);
  56759. }, delay);
  56760. };
  56761. }
  56762. })();
  56763. function requestAnimationFramePolyFill(callback) {
  56764. return implementation3(callback);
  56765. }
  56766. var requestAnimationFrame_default = requestAnimationFramePolyFill;
  56767. // node_modules/cesium/Source/Core/sampleTerrain.js
  56768. function sampleTerrain(terrainProvider, level, positions) {
  56769. Check_default.typeOf.object("terrainProvider", terrainProvider);
  56770. Check_default.typeOf.number("level", level);
  56771. Check_default.defined("positions", positions);
  56772. return terrainProvider.readyPromise.then(function() {
  56773. return doSampling(terrainProvider, level, positions);
  56774. });
  56775. }
  56776. function doSampling(terrainProvider, level, positions) {
  56777. const tilingScheme2 = terrainProvider.tilingScheme;
  56778. let i2;
  56779. const tileRequests = [];
  56780. const tileRequestSet = {};
  56781. for (i2 = 0; i2 < positions.length; ++i2) {
  56782. const xy = tilingScheme2.positionToTileXY(positions[i2], level);
  56783. const key = xy.toString();
  56784. if (!tileRequestSet.hasOwnProperty(key)) {
  56785. const value = {
  56786. x: xy.x,
  56787. y: xy.y,
  56788. level,
  56789. tilingScheme: tilingScheme2,
  56790. terrainProvider,
  56791. positions: []
  56792. };
  56793. tileRequestSet[key] = value;
  56794. tileRequests.push(value);
  56795. }
  56796. tileRequestSet[key].positions.push(positions[i2]);
  56797. }
  56798. const tilePromises = [];
  56799. for (i2 = 0; i2 < tileRequests.length; ++i2) {
  56800. const tileRequest = tileRequests[i2];
  56801. const requestPromise = tileRequest.terrainProvider.requestTileGeometry(
  56802. tileRequest.x,
  56803. tileRequest.y,
  56804. tileRequest.level
  56805. );
  56806. const tilePromise = requestPromise.then(createInterpolateFunction(tileRequest)).catch(createMarkFailedFunction(tileRequest));
  56807. tilePromises.push(tilePromise);
  56808. }
  56809. return Promise.all(tilePromises).then(function() {
  56810. return positions;
  56811. });
  56812. }
  56813. function interpolateAndAssignHeight(position, terrainData, rectangle) {
  56814. const height = terrainData.interpolateHeight(
  56815. rectangle,
  56816. position.longitude,
  56817. position.latitude
  56818. );
  56819. if (height === void 0) {
  56820. return false;
  56821. }
  56822. position.height = height;
  56823. return true;
  56824. }
  56825. function createInterpolateFunction(tileRequest) {
  56826. const tilePositions = tileRequest.positions;
  56827. const rectangle = tileRequest.tilingScheme.tileXYToRectangle(
  56828. tileRequest.x,
  56829. tileRequest.y,
  56830. tileRequest.level
  56831. );
  56832. return function(terrainData) {
  56833. let isMeshRequired = false;
  56834. for (let i2 = 0; i2 < tilePositions.length; ++i2) {
  56835. const position = tilePositions[i2];
  56836. const isHeightAssigned = interpolateAndAssignHeight(
  56837. position,
  56838. terrainData,
  56839. rectangle
  56840. );
  56841. if (!isHeightAssigned) {
  56842. isMeshRequired = true;
  56843. break;
  56844. }
  56845. }
  56846. if (!isMeshRequired) {
  56847. return Promise.resolve();
  56848. }
  56849. return terrainData.createMesh({
  56850. tilingScheme: tileRequest.tilingScheme,
  56851. x: tileRequest.x,
  56852. y: tileRequest.y,
  56853. level: tileRequest.level,
  56854. throttle: false
  56855. }).then(function() {
  56856. for (let i2 = 0; i2 < tilePositions.length; ++i2) {
  56857. const position = tilePositions[i2];
  56858. interpolateAndAssignHeight(position, terrainData, rectangle);
  56859. }
  56860. });
  56861. };
  56862. }
  56863. function createMarkFailedFunction(tileRequest) {
  56864. const tilePositions = tileRequest.positions;
  56865. return function() {
  56866. for (let i2 = 0; i2 < tilePositions.length; ++i2) {
  56867. const position = tilePositions[i2];
  56868. position.height = void 0;
  56869. }
  56870. };
  56871. }
  56872. var sampleTerrain_default = sampleTerrain;
  56873. // node_modules/cesium/Source/Core/sampleTerrainMostDetailed.js
  56874. var scratchCartesian29 = new Cartesian2_default();
  56875. function sampleTerrainMostDetailed(terrainProvider, positions) {
  56876. if (!defined_default(terrainProvider)) {
  56877. throw new DeveloperError_default("terrainProvider is required.");
  56878. }
  56879. if (!defined_default(positions)) {
  56880. throw new DeveloperError_default("positions is required.");
  56881. }
  56882. return terrainProvider.readyPromise.then(function() {
  56883. const byLevel = [];
  56884. const maxLevels = [];
  56885. const availability = terrainProvider.availability;
  56886. if (!defined_default(availability)) {
  56887. throw new DeveloperError_default(
  56888. "sampleTerrainMostDetailed requires a terrain provider that has tile availability."
  56889. );
  56890. }
  56891. const promises = [];
  56892. for (let i2 = 0; i2 < positions.length; ++i2) {
  56893. const position = positions[i2];
  56894. const maxLevel = availability.computeMaximumLevelAtPosition(position);
  56895. maxLevels[i2] = maxLevel;
  56896. if (maxLevel === 0) {
  56897. terrainProvider.tilingScheme.positionToTileXY(
  56898. position,
  56899. 1,
  56900. scratchCartesian29
  56901. );
  56902. const promise = terrainProvider.loadTileDataAvailability(
  56903. scratchCartesian29.x,
  56904. scratchCartesian29.y,
  56905. 1
  56906. );
  56907. if (defined_default(promise)) {
  56908. promises.push(promise);
  56909. }
  56910. }
  56911. let atLevel = byLevel[maxLevel];
  56912. if (!defined_default(atLevel)) {
  56913. byLevel[maxLevel] = atLevel = [];
  56914. }
  56915. atLevel.push(position);
  56916. }
  56917. return Promise.all(promises).then(function() {
  56918. return Promise.all(
  56919. byLevel.map(function(positionsAtLevel, index2) {
  56920. if (defined_default(positionsAtLevel)) {
  56921. return sampleTerrain_default(terrainProvider, index2, positionsAtLevel);
  56922. }
  56923. })
  56924. );
  56925. }).then(function() {
  56926. const changedPositions = [];
  56927. for (let i2 = 0; i2 < positions.length; ++i2) {
  56928. const position = positions[i2];
  56929. const maxLevel = availability.computeMaximumLevelAtPosition(position);
  56930. if (maxLevel !== maxLevels[i2]) {
  56931. changedPositions.push(position);
  56932. }
  56933. }
  56934. if (changedPositions.length > 0) {
  56935. return sampleTerrainMostDetailed(terrainProvider, changedPositions);
  56936. }
  56937. }).then(function() {
  56938. return positions;
  56939. });
  56940. });
  56941. }
  56942. var sampleTerrainMostDetailed_default = sampleTerrainMostDetailed;
  56943. // node_modules/cesium/Source/Core/subdivideArray.js
  56944. function subdivideArray(array, numberOfArrays) {
  56945. if (!defined_default(array)) {
  56946. throw new DeveloperError_default("array is required.");
  56947. }
  56948. if (!defined_default(numberOfArrays) || numberOfArrays < 1) {
  56949. throw new DeveloperError_default("numberOfArrays must be greater than 0.");
  56950. }
  56951. const result = [];
  56952. const len = array.length;
  56953. let i2 = 0;
  56954. while (i2 < len) {
  56955. const size = Math.ceil((len - i2) / numberOfArrays--);
  56956. result.push(array.slice(i2, i2 + size));
  56957. i2 += size;
  56958. }
  56959. return result;
  56960. }
  56961. var subdivideArray_default = subdivideArray;
  56962. // node_modules/cesium/Source/Core/webGLConstantToGlslType.js
  56963. function webGLConstantToGlslType(webGLValue) {
  56964. switch (webGLValue) {
  56965. case WebGLConstants_default.FLOAT:
  56966. return "float";
  56967. case WebGLConstants_default.FLOAT_VEC2:
  56968. return "vec2";
  56969. case WebGLConstants_default.FLOAT_VEC3:
  56970. return "vec3";
  56971. case WebGLConstants_default.FLOAT_VEC4:
  56972. return "vec4";
  56973. case WebGLConstants_default.FLOAT_MAT2:
  56974. return "mat2";
  56975. case WebGLConstants_default.FLOAT_MAT3:
  56976. return "mat3";
  56977. case WebGLConstants_default.FLOAT_MAT4:
  56978. return "mat4";
  56979. case WebGLConstants_default.SAMPLER_2D:
  56980. return "sampler2D";
  56981. case WebGLConstants_default.BOOL:
  56982. return "bool";
  56983. }
  56984. }
  56985. var webGLConstantToGlslType_default = webGLConstantToGlslType;
  56986. // node_modules/cesium/Source/Core/wrapFunction.js
  56987. function wrapFunction(obj, oldFunction, newFunction) {
  56988. if (typeof oldFunction !== "function") {
  56989. throw new DeveloperError_default("oldFunction is required to be a function.");
  56990. }
  56991. if (typeof newFunction !== "function") {
  56992. throw new DeveloperError_default("oldFunction is required to be a function.");
  56993. }
  56994. return function() {
  56995. newFunction.apply(obj, arguments);
  56996. oldFunction.apply(obj, arguments);
  56997. };
  56998. }
  56999. var wrapFunction_default = wrapFunction;
  57000. // node_modules/cesium/Source/DataSources/ConstantProperty.js
  57001. function ConstantProperty(value) {
  57002. this._value = void 0;
  57003. this._hasClone = false;
  57004. this._hasEquals = false;
  57005. this._definitionChanged = new Event_default();
  57006. this.setValue(value);
  57007. }
  57008. Object.defineProperties(ConstantProperty.prototype, {
  57009. isConstant: {
  57010. value: true
  57011. },
  57012. definitionChanged: {
  57013. get: function() {
  57014. return this._definitionChanged;
  57015. }
  57016. }
  57017. });
  57018. ConstantProperty.prototype.getValue = function(time, result) {
  57019. return this._hasClone ? this._value.clone(result) : this._value;
  57020. };
  57021. ConstantProperty.prototype.setValue = function(value) {
  57022. const oldValue2 = this._value;
  57023. if (oldValue2 !== value) {
  57024. const isDefined = defined_default(value);
  57025. const hasClone = isDefined && typeof value.clone === "function";
  57026. const hasEquals = isDefined && typeof value.equals === "function";
  57027. const changed = !hasEquals || !value.equals(oldValue2);
  57028. if (changed) {
  57029. this._hasClone = hasClone;
  57030. this._hasEquals = hasEquals;
  57031. this._value = !hasClone ? value : value.clone(this._value);
  57032. this._definitionChanged.raiseEvent(this);
  57033. }
  57034. }
  57035. };
  57036. ConstantProperty.prototype.equals = function(other) {
  57037. return this === other || other instanceof ConstantProperty && (!this._hasEquals && this._value === other._value || this._hasEquals && this._value.equals(other._value));
  57038. };
  57039. ConstantProperty.prototype.valueOf = function() {
  57040. return this._value;
  57041. };
  57042. ConstantProperty.prototype.toString = function() {
  57043. return String(this._value);
  57044. };
  57045. var ConstantProperty_default = ConstantProperty;
  57046. // node_modules/cesium/Source/DataSources/createPropertyDescriptor.js
  57047. function createProperty(name, privateName, subscriptionName, configurable, createPropertyCallback) {
  57048. return {
  57049. configurable,
  57050. get: function() {
  57051. return this[privateName];
  57052. },
  57053. set: function(value) {
  57054. const oldValue2 = this[privateName];
  57055. const subscription = this[subscriptionName];
  57056. if (defined_default(subscription)) {
  57057. subscription();
  57058. this[subscriptionName] = void 0;
  57059. }
  57060. const hasValue = value !== void 0;
  57061. if (hasValue && (!defined_default(value) || !defined_default(value.getValue)) && defined_default(createPropertyCallback)) {
  57062. value = createPropertyCallback(value);
  57063. }
  57064. if (oldValue2 !== value) {
  57065. this[privateName] = value;
  57066. this._definitionChanged.raiseEvent(this, name, value, oldValue2);
  57067. }
  57068. if (defined_default(value) && defined_default(value.definitionChanged)) {
  57069. this[subscriptionName] = value.definitionChanged.addEventListener(
  57070. function() {
  57071. this._definitionChanged.raiseEvent(this, name, value, value);
  57072. },
  57073. this
  57074. );
  57075. }
  57076. }
  57077. };
  57078. }
  57079. function createConstantProperty(value) {
  57080. return new ConstantProperty_default(value);
  57081. }
  57082. function createPropertyDescriptor(name, configurable, createPropertyCallback) {
  57083. return createProperty(
  57084. name,
  57085. `_${name.toString()}`,
  57086. `_${name.toString()}Subscription`,
  57087. defaultValue_default(configurable, false),
  57088. defaultValue_default(createPropertyCallback, createConstantProperty)
  57089. );
  57090. }
  57091. var createPropertyDescriptor_default = createPropertyDescriptor;
  57092. // node_modules/cesium/Source/DataSources/BillboardGraphics.js
  57093. function BillboardGraphics(options) {
  57094. this._definitionChanged = new Event_default();
  57095. this._show = void 0;
  57096. this._showSubscription = void 0;
  57097. this._image = void 0;
  57098. this._imageSubscription = void 0;
  57099. this._scale = void 0;
  57100. this._scaleSubscription = void 0;
  57101. this._pixelOffset = void 0;
  57102. this._pixelOffsetSubscription = void 0;
  57103. this._eyeOffset = void 0;
  57104. this._eyeOffsetSubscription = void 0;
  57105. this._horizontalOrigin = void 0;
  57106. this._horizontalOriginSubscription = void 0;
  57107. this._verticalOrigin = void 0;
  57108. this._verticalOriginSubscription = void 0;
  57109. this._heightReference = void 0;
  57110. this._heightReferenceSubscription = void 0;
  57111. this._color = void 0;
  57112. this._colorSubscription = void 0;
  57113. this._rotation = void 0;
  57114. this._rotationSubscription = void 0;
  57115. this._alignedAxis = void 0;
  57116. this._alignedAxisSubscription = void 0;
  57117. this._sizeInMeters = void 0;
  57118. this._sizeInMetersSubscription = void 0;
  57119. this._width = void 0;
  57120. this._widthSubscription = void 0;
  57121. this._height = void 0;
  57122. this._heightSubscription = void 0;
  57123. this._scaleByDistance = void 0;
  57124. this._scaleByDistanceSubscription = void 0;
  57125. this._translucencyByDistance = void 0;
  57126. this._translucencyByDistanceSubscription = void 0;
  57127. this._pixelOffsetScaleByDistance = void 0;
  57128. this._pixelOffsetScaleByDistanceSubscription = void 0;
  57129. this._imageSubRegion = void 0;
  57130. this._imageSubRegionSubscription = void 0;
  57131. this._distanceDisplayCondition = void 0;
  57132. this._distanceDisplayConditionSubscription = void 0;
  57133. this._disableDepthTestDistance = void 0;
  57134. this._disableDepthTestDistanceSubscription = void 0;
  57135. this.merge(defaultValue_default(options, defaultValue_default.EMPTY_OBJECT));
  57136. }
  57137. Object.defineProperties(BillboardGraphics.prototype, {
  57138. definitionChanged: {
  57139. get: function() {
  57140. return this._definitionChanged;
  57141. }
  57142. },
  57143. show: createPropertyDescriptor_default("show"),
  57144. image: createPropertyDescriptor_default("image"),
  57145. scale: createPropertyDescriptor_default("scale"),
  57146. pixelOffset: createPropertyDescriptor_default("pixelOffset"),
  57147. eyeOffset: createPropertyDescriptor_default("eyeOffset"),
  57148. horizontalOrigin: createPropertyDescriptor_default("horizontalOrigin"),
  57149. verticalOrigin: createPropertyDescriptor_default("verticalOrigin"),
  57150. heightReference: createPropertyDescriptor_default("heightReference"),
  57151. color: createPropertyDescriptor_default("color"),
  57152. rotation: createPropertyDescriptor_default("rotation"),
  57153. alignedAxis: createPropertyDescriptor_default("alignedAxis"),
  57154. sizeInMeters: createPropertyDescriptor_default("sizeInMeters"),
  57155. width: createPropertyDescriptor_default("width"),
  57156. height: createPropertyDescriptor_default("height"),
  57157. scaleByDistance: createPropertyDescriptor_default("scaleByDistance"),
  57158. translucencyByDistance: createPropertyDescriptor_default("translucencyByDistance"),
  57159. pixelOffsetScaleByDistance: createPropertyDescriptor_default(
  57160. "pixelOffsetScaleByDistance"
  57161. ),
  57162. imageSubRegion: createPropertyDescriptor_default("imageSubRegion"),
  57163. distanceDisplayCondition: createPropertyDescriptor_default(
  57164. "distanceDisplayCondition"
  57165. ),
  57166. disableDepthTestDistance: createPropertyDescriptor_default(
  57167. "disableDepthTestDistance"
  57168. )
  57169. });
  57170. BillboardGraphics.prototype.clone = function(result) {
  57171. if (!defined_default(result)) {
  57172. return new BillboardGraphics(this);
  57173. }
  57174. result.show = this._show;
  57175. result.image = this._image;
  57176. result.scale = this._scale;
  57177. result.pixelOffset = this._pixelOffset;
  57178. result.eyeOffset = this._eyeOffset;
  57179. result.horizontalOrigin = this._horizontalOrigin;
  57180. result.verticalOrigin = this._verticalOrigin;
  57181. result.heightReference = this._heightReference;
  57182. result.color = this._color;
  57183. result.rotation = this._rotation;
  57184. result.alignedAxis = this._alignedAxis;
  57185. result.sizeInMeters = this._sizeInMeters;
  57186. result.width = this._width;
  57187. result.height = this._height;
  57188. result.scaleByDistance = this._scaleByDistance;
  57189. result.translucencyByDistance = this._translucencyByDistance;
  57190. result.pixelOffsetScaleByDistance = this._pixelOffsetScaleByDistance;
  57191. result.imageSubRegion = this._imageSubRegion;
  57192. result.distanceDisplayCondition = this._distanceDisplayCondition;
  57193. result.disableDepthTestDistance = this._disableDepthTestDistance;
  57194. return result;
  57195. };
  57196. BillboardGraphics.prototype.merge = function(source) {
  57197. if (!defined_default(source)) {
  57198. throw new DeveloperError_default("source is required.");
  57199. }
  57200. this.show = defaultValue_default(this._show, source.show);
  57201. this.image = defaultValue_default(this._image, source.image);
  57202. this.scale = defaultValue_default(this._scale, source.scale);
  57203. this.pixelOffset = defaultValue_default(this._pixelOffset, source.pixelOffset);
  57204. this.eyeOffset = defaultValue_default(this._eyeOffset, source.eyeOffset);
  57205. this.horizontalOrigin = defaultValue_default(
  57206. this._horizontalOrigin,
  57207. source.horizontalOrigin
  57208. );
  57209. this.verticalOrigin = defaultValue_default(
  57210. this._verticalOrigin,
  57211. source.verticalOrigin
  57212. );
  57213. this.heightReference = defaultValue_default(
  57214. this._heightReference,
  57215. source.heightReference
  57216. );
  57217. this.color = defaultValue_default(this._color, source.color);
  57218. this.rotation = defaultValue_default(this._rotation, source.rotation);
  57219. this.alignedAxis = defaultValue_default(this._alignedAxis, source.alignedAxis);
  57220. this.sizeInMeters = defaultValue_default(this._sizeInMeters, source.sizeInMeters);
  57221. this.width = defaultValue_default(this._width, source.width);
  57222. this.height = defaultValue_default(this._height, source.height);
  57223. this.scaleByDistance = defaultValue_default(
  57224. this._scaleByDistance,
  57225. source.scaleByDistance
  57226. );
  57227. this.translucencyByDistance = defaultValue_default(
  57228. this._translucencyByDistance,
  57229. source.translucencyByDistance
  57230. );
  57231. this.pixelOffsetScaleByDistance = defaultValue_default(
  57232. this._pixelOffsetScaleByDistance,
  57233. source.pixelOffsetScaleByDistance
  57234. );
  57235. this.imageSubRegion = defaultValue_default(
  57236. this._imageSubRegion,
  57237. source.imageSubRegion
  57238. );
  57239. this.distanceDisplayCondition = defaultValue_default(
  57240. this._distanceDisplayCondition,
  57241. source.distanceDisplayCondition
  57242. );
  57243. this.disableDepthTestDistance = defaultValue_default(
  57244. this._disableDepthTestDistance,
  57245. source.disableDepthTestDistance
  57246. );
  57247. };
  57248. var BillboardGraphics_default = BillboardGraphics;
  57249. // node_modules/cesium/Source/Scene/HeightReference.js
  57250. var HeightReference = {
  57251. NONE: 0,
  57252. CLAMP_TO_GROUND: 1,
  57253. RELATIVE_TO_GROUND: 2
  57254. };
  57255. var HeightReference_default = Object.freeze(HeightReference);
  57256. // node_modules/cesium/Source/Scene/HorizontalOrigin.js
  57257. var HorizontalOrigin = {
  57258. CENTER: 0,
  57259. LEFT: 1,
  57260. RIGHT: -1
  57261. };
  57262. var HorizontalOrigin_default = Object.freeze(HorizontalOrigin);
  57263. // node_modules/cesium/Source/Scene/VerticalOrigin.js
  57264. var VerticalOrigin = {
  57265. CENTER: 0,
  57266. BOTTOM: 1,
  57267. BASELINE: 2,
  57268. TOP: -1
  57269. };
  57270. var VerticalOrigin_default = Object.freeze(VerticalOrigin);
  57271. // node_modules/cesium/Source/DataSources/BoundingSphereState.js
  57272. var BoundingSphereState = {
  57273. DONE: 0,
  57274. PENDING: 1,
  57275. FAILED: 2
  57276. };
  57277. var BoundingSphereState_default = Object.freeze(BoundingSphereState);
  57278. // node_modules/cesium/Source/DataSources/Property.js
  57279. function Property() {
  57280. DeveloperError_default.throwInstantiationError();
  57281. }
  57282. Object.defineProperties(Property.prototype, {
  57283. isConstant: {
  57284. get: DeveloperError_default.throwInstantiationError
  57285. },
  57286. definitionChanged: {
  57287. get: DeveloperError_default.throwInstantiationError
  57288. }
  57289. });
  57290. Property.prototype.getValue = DeveloperError_default.throwInstantiationError;
  57291. Property.prototype.equals = DeveloperError_default.throwInstantiationError;
  57292. Property.equals = function(left, right) {
  57293. return left === right || defined_default(left) && left.equals(right);
  57294. };
  57295. Property.arrayEquals = function(left, right) {
  57296. if (left === right) {
  57297. return true;
  57298. }
  57299. if (!defined_default(left) || !defined_default(right) || left.length !== right.length) {
  57300. return false;
  57301. }
  57302. const length3 = left.length;
  57303. for (let i2 = 0; i2 < length3; i2++) {
  57304. if (!Property.equals(left[i2], right[i2])) {
  57305. return false;
  57306. }
  57307. }
  57308. return true;
  57309. };
  57310. Property.isConstant = function(property) {
  57311. return !defined_default(property) || property.isConstant;
  57312. };
  57313. Property.getValueOrUndefined = function(property, time, result) {
  57314. return defined_default(property) ? property.getValue(time, result) : void 0;
  57315. };
  57316. Property.getValueOrDefault = function(property, time, valueDefault, result) {
  57317. return defined_default(property) ? defaultValue_default(property.getValue(time, result), valueDefault) : valueDefault;
  57318. };
  57319. Property.getValueOrClonedDefault = function(property, time, valueDefault, result) {
  57320. let value;
  57321. if (defined_default(property)) {
  57322. value = property.getValue(time, result);
  57323. }
  57324. if (!defined_default(value)) {
  57325. value = valueDefault.clone(value);
  57326. }
  57327. return value;
  57328. };
  57329. var Property_default = Property;
  57330. // node_modules/cesium/Source/DataSources/BillboardVisualizer.js
  57331. var defaultColor = Color_default.WHITE;
  57332. var defaultEyeOffset = Cartesian3_default.ZERO;
  57333. var defaultHeightReference = HeightReference_default.NONE;
  57334. var defaultPixelOffset = Cartesian2_default.ZERO;
  57335. var defaultScale2 = 1;
  57336. var defaultRotation2 = 0;
  57337. var defaultAlignedAxis = Cartesian3_default.ZERO;
  57338. var defaultHorizontalOrigin = HorizontalOrigin_default.CENTER;
  57339. var defaultVerticalOrigin = VerticalOrigin_default.CENTER;
  57340. var defaultSizeInMeters = false;
  57341. var positionScratch5 = new Cartesian3_default();
  57342. var colorScratch2 = new Color_default();
  57343. var eyeOffsetScratch = new Cartesian3_default();
  57344. var pixelOffsetScratch = new Cartesian2_default();
  57345. var scaleByDistanceScratch = new NearFarScalar_default();
  57346. var translucencyByDistanceScratch = new NearFarScalar_default();
  57347. var pixelOffsetScaleByDistanceScratch = new NearFarScalar_default();
  57348. var boundingRectangleScratch = new BoundingRectangle_default();
  57349. var distanceDisplayConditionScratch = new DistanceDisplayCondition_default();
  57350. function EntityData(entity) {
  57351. this.entity = entity;
  57352. this.billboard = void 0;
  57353. this.textureValue = void 0;
  57354. }
  57355. function BillboardVisualizer(entityCluster, entityCollection) {
  57356. if (!defined_default(entityCluster)) {
  57357. throw new DeveloperError_default("entityCluster is required.");
  57358. }
  57359. if (!defined_default(entityCollection)) {
  57360. throw new DeveloperError_default("entityCollection is required.");
  57361. }
  57362. entityCollection.collectionChanged.addEventListener(
  57363. BillboardVisualizer.prototype._onCollectionChanged,
  57364. this
  57365. );
  57366. this._cluster = entityCluster;
  57367. this._entityCollection = entityCollection;
  57368. this._items = new AssociativeArray_default();
  57369. this._onCollectionChanged(entityCollection, entityCollection.values, [], []);
  57370. }
  57371. BillboardVisualizer.prototype.update = function(time) {
  57372. if (!defined_default(time)) {
  57373. throw new DeveloperError_default("time is required.");
  57374. }
  57375. const items = this._items.values;
  57376. const cluster = this._cluster;
  57377. for (let i2 = 0, len = items.length; i2 < len; i2++) {
  57378. const item = items[i2];
  57379. const entity = item.entity;
  57380. const billboardGraphics = entity._billboard;
  57381. let textureValue;
  57382. let billboard = item.billboard;
  57383. let show = entity.isShowing && entity.isAvailable(time) && Property_default.getValueOrDefault(billboardGraphics._show, time, true);
  57384. let position;
  57385. if (show) {
  57386. position = Property_default.getValueOrUndefined(
  57387. entity._position,
  57388. time,
  57389. positionScratch5
  57390. );
  57391. textureValue = Property_default.getValueOrUndefined(
  57392. billboardGraphics._image,
  57393. time
  57394. );
  57395. show = defined_default(position) && defined_default(textureValue);
  57396. }
  57397. if (!show) {
  57398. returnPrimitive(item, entity, cluster);
  57399. continue;
  57400. }
  57401. if (!Property_default.isConstant(entity._position)) {
  57402. cluster._clusterDirty = true;
  57403. }
  57404. if (!defined_default(billboard)) {
  57405. billboard = cluster.getBillboard(entity);
  57406. billboard.id = entity;
  57407. billboard.image = void 0;
  57408. item.billboard = billboard;
  57409. }
  57410. billboard.show = show;
  57411. if (!defined_default(billboard.image) || item.textureValue !== textureValue) {
  57412. billboard.image = textureValue;
  57413. item.textureValue = textureValue;
  57414. }
  57415. billboard.position = position;
  57416. billboard.color = Property_default.getValueOrDefault(
  57417. billboardGraphics._color,
  57418. time,
  57419. defaultColor,
  57420. colorScratch2
  57421. );
  57422. billboard.eyeOffset = Property_default.getValueOrDefault(
  57423. billboardGraphics._eyeOffset,
  57424. time,
  57425. defaultEyeOffset,
  57426. eyeOffsetScratch
  57427. );
  57428. billboard.heightReference = Property_default.getValueOrDefault(
  57429. billboardGraphics._heightReference,
  57430. time,
  57431. defaultHeightReference
  57432. );
  57433. billboard.pixelOffset = Property_default.getValueOrDefault(
  57434. billboardGraphics._pixelOffset,
  57435. time,
  57436. defaultPixelOffset,
  57437. pixelOffsetScratch
  57438. );
  57439. billboard.scale = Property_default.getValueOrDefault(
  57440. billboardGraphics._scale,
  57441. time,
  57442. defaultScale2
  57443. );
  57444. billboard.rotation = Property_default.getValueOrDefault(
  57445. billboardGraphics._rotation,
  57446. time,
  57447. defaultRotation2
  57448. );
  57449. billboard.alignedAxis = Property_default.getValueOrDefault(
  57450. billboardGraphics._alignedAxis,
  57451. time,
  57452. defaultAlignedAxis
  57453. );
  57454. billboard.horizontalOrigin = Property_default.getValueOrDefault(
  57455. billboardGraphics._horizontalOrigin,
  57456. time,
  57457. defaultHorizontalOrigin
  57458. );
  57459. billboard.verticalOrigin = Property_default.getValueOrDefault(
  57460. billboardGraphics._verticalOrigin,
  57461. time,
  57462. defaultVerticalOrigin
  57463. );
  57464. billboard.width = Property_default.getValueOrUndefined(
  57465. billboardGraphics._width,
  57466. time
  57467. );
  57468. billboard.height = Property_default.getValueOrUndefined(
  57469. billboardGraphics._height,
  57470. time
  57471. );
  57472. billboard.scaleByDistance = Property_default.getValueOrUndefined(
  57473. billboardGraphics._scaleByDistance,
  57474. time,
  57475. scaleByDistanceScratch
  57476. );
  57477. billboard.translucencyByDistance = Property_default.getValueOrUndefined(
  57478. billboardGraphics._translucencyByDistance,
  57479. time,
  57480. translucencyByDistanceScratch
  57481. );
  57482. billboard.pixelOffsetScaleByDistance = Property_default.getValueOrUndefined(
  57483. billboardGraphics._pixelOffsetScaleByDistance,
  57484. time,
  57485. pixelOffsetScaleByDistanceScratch
  57486. );
  57487. billboard.sizeInMeters = Property_default.getValueOrDefault(
  57488. billboardGraphics._sizeInMeters,
  57489. time,
  57490. defaultSizeInMeters
  57491. );
  57492. billboard.distanceDisplayCondition = Property_default.getValueOrUndefined(
  57493. billboardGraphics._distanceDisplayCondition,
  57494. time,
  57495. distanceDisplayConditionScratch
  57496. );
  57497. billboard.disableDepthTestDistance = Property_default.getValueOrUndefined(
  57498. billboardGraphics._disableDepthTestDistance,
  57499. time
  57500. );
  57501. const subRegion = Property_default.getValueOrUndefined(
  57502. billboardGraphics._imageSubRegion,
  57503. time,
  57504. boundingRectangleScratch
  57505. );
  57506. if (defined_default(subRegion)) {
  57507. billboard.setImageSubRegion(billboard._imageId, subRegion);
  57508. }
  57509. }
  57510. return true;
  57511. };
  57512. BillboardVisualizer.prototype.getBoundingSphere = function(entity, result) {
  57513. if (!defined_default(entity)) {
  57514. throw new DeveloperError_default("entity is required.");
  57515. }
  57516. if (!defined_default(result)) {
  57517. throw new DeveloperError_default("result is required.");
  57518. }
  57519. const item = this._items.get(entity.id);
  57520. if (!defined_default(item) || !defined_default(item.billboard)) {
  57521. return BoundingSphereState_default.FAILED;
  57522. }
  57523. const billboard = item.billboard;
  57524. if (billboard.heightReference === HeightReference_default.NONE) {
  57525. result.center = Cartesian3_default.clone(billboard.position, result.center);
  57526. } else {
  57527. if (!defined_default(billboard._clampedPosition)) {
  57528. return BoundingSphereState_default.PENDING;
  57529. }
  57530. result.center = Cartesian3_default.clone(billboard._clampedPosition, result.center);
  57531. }
  57532. result.radius = 0;
  57533. return BoundingSphereState_default.DONE;
  57534. };
  57535. BillboardVisualizer.prototype.isDestroyed = function() {
  57536. return false;
  57537. };
  57538. BillboardVisualizer.prototype.destroy = function() {
  57539. this._entityCollection.collectionChanged.removeEventListener(
  57540. BillboardVisualizer.prototype._onCollectionChanged,
  57541. this
  57542. );
  57543. const entities = this._entityCollection.values;
  57544. for (let i2 = 0; i2 < entities.length; i2++) {
  57545. this._cluster.removeBillboard(entities[i2]);
  57546. }
  57547. return destroyObject_default(this);
  57548. };
  57549. BillboardVisualizer.prototype._onCollectionChanged = function(entityCollection, added, removed, changed) {
  57550. let i2;
  57551. let entity;
  57552. const items = this._items;
  57553. const cluster = this._cluster;
  57554. for (i2 = added.length - 1; i2 > -1; i2--) {
  57555. entity = added[i2];
  57556. if (defined_default(entity._billboard) && defined_default(entity._position)) {
  57557. items.set(entity.id, new EntityData(entity));
  57558. }
  57559. }
  57560. for (i2 = changed.length - 1; i2 > -1; i2--) {
  57561. entity = changed[i2];
  57562. if (defined_default(entity._billboard) && defined_default(entity._position)) {
  57563. if (!items.contains(entity.id)) {
  57564. items.set(entity.id, new EntityData(entity));
  57565. }
  57566. } else {
  57567. returnPrimitive(items.get(entity.id), entity, cluster);
  57568. items.remove(entity.id);
  57569. }
  57570. }
  57571. for (i2 = removed.length - 1; i2 > -1; i2--) {
  57572. entity = removed[i2];
  57573. returnPrimitive(items.get(entity.id), entity, cluster);
  57574. items.remove(entity.id);
  57575. }
  57576. };
  57577. function returnPrimitive(item, entity, cluster) {
  57578. if (defined_default(item)) {
  57579. item.billboard = void 0;
  57580. cluster.removeBillboard(entity);
  57581. }
  57582. }
  57583. var BillboardVisualizer_default = BillboardVisualizer;
  57584. // node_modules/cesium/Source/Shaders/Appearances/AllMaterialAppearanceFS.js
  57585. var AllMaterialAppearanceFS_default = "varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec3 v_tangentEC;\nvarying vec3 v_bitangentEC;\nvarying vec2 v_st;\n\nvoid main()\n{\n vec3 positionToEyeEC = -v_positionEC;\n mat3 tangentToEyeMatrix = czm_tangentToEyeSpaceMatrix(v_normalEC, v_tangentEC, v_bitangentEC);\n\n vec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\n normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\n\n czm_materialInput materialInput;\n materialInput.normalEC = normalEC;\n materialInput.tangentToEyeMatrix = tangentToEyeMatrix;\n materialInput.positionToEyeEC = positionToEyeEC;\n materialInput.st = v_st;\n czm_material material = czm_getMaterial(materialInput);\n\n#ifdef FLAT\n gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\n gl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n#endif\n}\n";
  57586. // node_modules/cesium/Source/Shaders/Appearances/AllMaterialAppearanceVS.js
  57587. var AllMaterialAppearanceVS_default = "attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute vec3 tangent;\nattribute vec3 bitangent;\nattribute vec2 st;\nattribute float batchId;\n\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec3 v_tangentEC;\nvarying vec3 v_bitangentEC;\nvarying vec2 v_st;\n\nvoid main()\n{\n vec4 p = czm_computePosition();\n\n v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates\n v_normalEC = czm_normal * normal; // normal in eye coordinates\n v_tangentEC = czm_normal * tangent; // tangent in eye coordinates\n v_bitangentEC = czm_normal * bitangent; // bitangent in eye coordinates\n v_st = st;\n\n gl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n";
  57588. // node_modules/cesium/Source/Shaders/Appearances/BasicMaterialAppearanceFS.js
  57589. var BasicMaterialAppearanceFS_default = "varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\n\nvoid main()\n{\n vec3 positionToEyeEC = -v_positionEC;\n\n vec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\n normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\n\n czm_materialInput materialInput;\n materialInput.normalEC = normalEC;\n materialInput.positionToEyeEC = positionToEyeEC;\n czm_material material = czm_getMaterial(materialInput);\n\n#ifdef FLAT\n gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\n gl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n#endif\n}\n";
  57590. // node_modules/cesium/Source/Shaders/Appearances/BasicMaterialAppearanceVS.js
  57591. var BasicMaterialAppearanceVS_default = "attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute float batchId;\n\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\n\nvoid main()\n{\n vec4 p = czm_computePosition();\n\n v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates\n v_normalEC = czm_normal * normal; // normal in eye coordinates\n\n gl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n";
  57592. // node_modules/cesium/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.js
  57593. var TexturedMaterialAppearanceFS_default = "varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec2 v_st;\n\nvoid main()\n{\n vec3 positionToEyeEC = -v_positionEC;\n\n vec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\n normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\n\n czm_materialInput materialInput;\n materialInput.normalEC = normalEC;\n materialInput.positionToEyeEC = positionToEyeEC;\n materialInput.st = v_st;\n czm_material material = czm_getMaterial(materialInput);\n\n#ifdef FLAT\n gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\n gl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n#endif\n}\n";
  57594. // node_modules/cesium/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.js
  57595. var TexturedMaterialAppearanceVS_default = "attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute vec2 st;\nattribute float batchId;\n\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec2 v_st;\n\nvoid main()\n{\n vec4 p = czm_computePosition();\n\n v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates\n v_normalEC = czm_normal * normal; // normal in eye coordinates\n v_st = st;\n\n gl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n";
  57596. // node_modules/cesium/Source/Scene/BlendEquation.js
  57597. var BlendEquation = {
  57598. ADD: WebGLConstants_default.FUNC_ADD,
  57599. SUBTRACT: WebGLConstants_default.FUNC_SUBTRACT,
  57600. REVERSE_SUBTRACT: WebGLConstants_default.FUNC_REVERSE_SUBTRACT,
  57601. MIN: WebGLConstants_default.MIN,
  57602. MAX: WebGLConstants_default.MAX
  57603. };
  57604. var BlendEquation_default = Object.freeze(BlendEquation);
  57605. // node_modules/cesium/Source/Scene/BlendFunction.js
  57606. var BlendFunction = {
  57607. ZERO: WebGLConstants_default.ZERO,
  57608. ONE: WebGLConstants_default.ONE,
  57609. SOURCE_COLOR: WebGLConstants_default.SRC_COLOR,
  57610. ONE_MINUS_SOURCE_COLOR: WebGLConstants_default.ONE_MINUS_SRC_COLOR,
  57611. DESTINATION_COLOR: WebGLConstants_default.DST_COLOR,
  57612. ONE_MINUS_DESTINATION_COLOR: WebGLConstants_default.ONE_MINUS_DST_COLOR,
  57613. SOURCE_ALPHA: WebGLConstants_default.SRC_ALPHA,
  57614. ONE_MINUS_SOURCE_ALPHA: WebGLConstants_default.ONE_MINUS_SRC_ALPHA,
  57615. DESTINATION_ALPHA: WebGLConstants_default.DST_ALPHA,
  57616. ONE_MINUS_DESTINATION_ALPHA: WebGLConstants_default.ONE_MINUS_DST_ALPHA,
  57617. CONSTANT_COLOR: WebGLConstants_default.CONSTANT_COLOR,
  57618. ONE_MINUS_CONSTANT_COLOR: WebGLConstants_default.ONE_MINUS_CONSTANT_COLOR,
  57619. CONSTANT_ALPHA: WebGLConstants_default.CONSTANT_ALPHA,
  57620. ONE_MINUS_CONSTANT_ALPHA: WebGLConstants_default.ONE_MINUS_CONSTANT_ALPHA,
  57621. SOURCE_ALPHA_SATURATE: WebGLConstants_default.SRC_ALPHA_SATURATE
  57622. };
  57623. var BlendFunction_default = Object.freeze(BlendFunction);
  57624. // node_modules/cesium/Source/Scene/BlendingState.js
  57625. var BlendingState = {
  57626. DISABLED: Object.freeze({
  57627. enabled: false
  57628. }),
  57629. ALPHA_BLEND: Object.freeze({
  57630. enabled: true,
  57631. equationRgb: BlendEquation_default.ADD,
  57632. equationAlpha: BlendEquation_default.ADD,
  57633. functionSourceRgb: BlendFunction_default.SOURCE_ALPHA,
  57634. functionSourceAlpha: BlendFunction_default.ONE,
  57635. functionDestinationRgb: BlendFunction_default.ONE_MINUS_SOURCE_ALPHA,
  57636. functionDestinationAlpha: BlendFunction_default.ONE_MINUS_SOURCE_ALPHA
  57637. }),
  57638. PRE_MULTIPLIED_ALPHA_BLEND: Object.freeze({
  57639. enabled: true,
  57640. equationRgb: BlendEquation_default.ADD,
  57641. equationAlpha: BlendEquation_default.ADD,
  57642. functionSourceRgb: BlendFunction_default.ONE,
  57643. functionSourceAlpha: BlendFunction_default.ONE,
  57644. functionDestinationRgb: BlendFunction_default.ONE_MINUS_SOURCE_ALPHA,
  57645. functionDestinationAlpha: BlendFunction_default.ONE_MINUS_SOURCE_ALPHA
  57646. }),
  57647. ADDITIVE_BLEND: Object.freeze({
  57648. enabled: true,
  57649. equationRgb: BlendEquation_default.ADD,
  57650. equationAlpha: BlendEquation_default.ADD,
  57651. functionSourceRgb: BlendFunction_default.SOURCE_ALPHA,
  57652. functionSourceAlpha: BlendFunction_default.ONE,
  57653. functionDestinationRgb: BlendFunction_default.ONE,
  57654. functionDestinationAlpha: BlendFunction_default.ONE
  57655. })
  57656. };
  57657. var BlendingState_default = Object.freeze(BlendingState);
  57658. // node_modules/cesium/Source/Scene/CullFace.js
  57659. var CullFace = {
  57660. FRONT: WebGLConstants_default.FRONT,
  57661. BACK: WebGLConstants_default.BACK,
  57662. FRONT_AND_BACK: WebGLConstants_default.FRONT_AND_BACK
  57663. };
  57664. var CullFace_default = Object.freeze(CullFace);
  57665. // node_modules/cesium/Source/Scene/Appearance.js
  57666. function Appearance(options) {
  57667. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  57668. this.material = options.material;
  57669. this.translucent = defaultValue_default(options.translucent, true);
  57670. this._vertexShaderSource = options.vertexShaderSource;
  57671. this._fragmentShaderSource = options.fragmentShaderSource;
  57672. this._renderState = options.renderState;
  57673. this._closed = defaultValue_default(options.closed, false);
  57674. }
  57675. Object.defineProperties(Appearance.prototype, {
  57676. vertexShaderSource: {
  57677. get: function() {
  57678. return this._vertexShaderSource;
  57679. }
  57680. },
  57681. fragmentShaderSource: {
  57682. get: function() {
  57683. return this._fragmentShaderSource;
  57684. }
  57685. },
  57686. renderState: {
  57687. get: function() {
  57688. return this._renderState;
  57689. }
  57690. },
  57691. closed: {
  57692. get: function() {
  57693. return this._closed;
  57694. }
  57695. }
  57696. });
  57697. Appearance.prototype.getFragmentShaderSource = function() {
  57698. const parts = [];
  57699. if (this.flat) {
  57700. parts.push("#define FLAT");
  57701. }
  57702. if (this.faceForward) {
  57703. parts.push("#define FACE_FORWARD");
  57704. }
  57705. if (defined_default(this.material)) {
  57706. parts.push(this.material.shaderSource);
  57707. }
  57708. parts.push(this.fragmentShaderSource);
  57709. return parts.join("\n");
  57710. };
  57711. Appearance.prototype.isTranslucent = function() {
  57712. return defined_default(this.material) && this.material.isTranslucent() || !defined_default(this.material) && this.translucent;
  57713. };
  57714. Appearance.prototype.getRenderState = function() {
  57715. const translucent = this.isTranslucent();
  57716. const rs = clone_default(this.renderState, false);
  57717. if (translucent) {
  57718. rs.depthMask = false;
  57719. rs.blending = BlendingState_default.ALPHA_BLEND;
  57720. } else {
  57721. rs.depthMask = true;
  57722. }
  57723. return rs;
  57724. };
  57725. Appearance.getDefaultRenderState = function(translucent, closed, existing) {
  57726. let rs = {
  57727. depthTest: {
  57728. enabled: true
  57729. }
  57730. };
  57731. if (translucent) {
  57732. rs.depthMask = false;
  57733. rs.blending = BlendingState_default.ALPHA_BLEND;
  57734. }
  57735. if (closed) {
  57736. rs.cull = {
  57737. enabled: true,
  57738. face: CullFace_default.BACK
  57739. };
  57740. }
  57741. if (defined_default(existing)) {
  57742. rs = combine_default(existing, rs, true);
  57743. }
  57744. return rs;
  57745. };
  57746. var Appearance_default = Appearance;
  57747. // node_modules/cesium/Source/Renderer/ContextLimits.js
  57748. var ContextLimits = {
  57749. _maximumCombinedTextureImageUnits: 0,
  57750. _maximumCubeMapSize: 0,
  57751. _maximumFragmentUniformVectors: 0,
  57752. _maximumTextureImageUnits: 0,
  57753. _maximumRenderbufferSize: 0,
  57754. _maximumTextureSize: 0,
  57755. _maximumVaryingVectors: 0,
  57756. _maximumVertexAttributes: 0,
  57757. _maximumVertexTextureImageUnits: 0,
  57758. _maximumVertexUniformVectors: 0,
  57759. _minimumAliasedLineWidth: 0,
  57760. _maximumAliasedLineWidth: 0,
  57761. _minimumAliasedPointSize: 0,
  57762. _maximumAliasedPointSize: 0,
  57763. _maximumViewportWidth: 0,
  57764. _maximumViewportHeight: 0,
  57765. _maximumTextureFilterAnisotropy: 0,
  57766. _maximumDrawBuffers: 0,
  57767. _maximumColorAttachments: 0,
  57768. _maximumSamples: 0,
  57769. _highpFloatSupported: false,
  57770. _highpIntSupported: false
  57771. };
  57772. Object.defineProperties(ContextLimits, {
  57773. maximumCombinedTextureImageUnits: {
  57774. get: function() {
  57775. return ContextLimits._maximumCombinedTextureImageUnits;
  57776. }
  57777. },
  57778. maximumCubeMapSize: {
  57779. get: function() {
  57780. return ContextLimits._maximumCubeMapSize;
  57781. }
  57782. },
  57783. maximumFragmentUniformVectors: {
  57784. get: function() {
  57785. return ContextLimits._maximumFragmentUniformVectors;
  57786. }
  57787. },
  57788. maximumTextureImageUnits: {
  57789. get: function() {
  57790. return ContextLimits._maximumTextureImageUnits;
  57791. }
  57792. },
  57793. maximumRenderbufferSize: {
  57794. get: function() {
  57795. return ContextLimits._maximumRenderbufferSize;
  57796. }
  57797. },
  57798. maximumTextureSize: {
  57799. get: function() {
  57800. return ContextLimits._maximumTextureSize;
  57801. }
  57802. },
  57803. maximumVaryingVectors: {
  57804. get: function() {
  57805. return ContextLimits._maximumVaryingVectors;
  57806. }
  57807. },
  57808. maximumVertexAttributes: {
  57809. get: function() {
  57810. return ContextLimits._maximumVertexAttributes;
  57811. }
  57812. },
  57813. maximumVertexTextureImageUnits: {
  57814. get: function() {
  57815. return ContextLimits._maximumVertexTextureImageUnits;
  57816. }
  57817. },
  57818. maximumVertexUniformVectors: {
  57819. get: function() {
  57820. return ContextLimits._maximumVertexUniformVectors;
  57821. }
  57822. },
  57823. minimumAliasedLineWidth: {
  57824. get: function() {
  57825. return ContextLimits._minimumAliasedLineWidth;
  57826. }
  57827. },
  57828. maximumAliasedLineWidth: {
  57829. get: function() {
  57830. return ContextLimits._maximumAliasedLineWidth;
  57831. }
  57832. },
  57833. minimumAliasedPointSize: {
  57834. get: function() {
  57835. return ContextLimits._minimumAliasedPointSize;
  57836. }
  57837. },
  57838. maximumAliasedPointSize: {
  57839. get: function() {
  57840. return ContextLimits._maximumAliasedPointSize;
  57841. }
  57842. },
  57843. maximumViewportWidth: {
  57844. get: function() {
  57845. return ContextLimits._maximumViewportWidth;
  57846. }
  57847. },
  57848. maximumViewportHeight: {
  57849. get: function() {
  57850. return ContextLimits._maximumViewportHeight;
  57851. }
  57852. },
  57853. maximumTextureFilterAnisotropy: {
  57854. get: function() {
  57855. return ContextLimits._maximumTextureFilterAnisotropy;
  57856. }
  57857. },
  57858. maximumDrawBuffers: {
  57859. get: function() {
  57860. return ContextLimits._maximumDrawBuffers;
  57861. }
  57862. },
  57863. maximumColorAttachments: {
  57864. get: function() {
  57865. return ContextLimits._maximumColorAttachments;
  57866. }
  57867. },
  57868. maximumSamples: {
  57869. get: function() {
  57870. return ContextLimits._maximumSamples;
  57871. }
  57872. },
  57873. highpFloatSupported: {
  57874. get: function() {
  57875. return ContextLimits._highpFloatSupported;
  57876. }
  57877. },
  57878. highpIntSupported: {
  57879. get: function() {
  57880. return ContextLimits._highpIntSupported;
  57881. }
  57882. }
  57883. });
  57884. var ContextLimits_default = ContextLimits;
  57885. // node_modules/cesium/Source/Renderer/CubeMapFace.js
  57886. function CubeMapFace(context, texture, textureTarget, targetFace, internalFormat, pixelFormat, pixelDatatype, size, preMultiplyAlpha, flipY, initialized) {
  57887. this._context = context;
  57888. this._texture = texture;
  57889. this._textureTarget = textureTarget;
  57890. this._targetFace = targetFace;
  57891. this._pixelDatatype = pixelDatatype;
  57892. this._internalFormat = internalFormat;
  57893. this._pixelFormat = pixelFormat;
  57894. this._size = size;
  57895. this._preMultiplyAlpha = preMultiplyAlpha;
  57896. this._flipY = flipY;
  57897. this._initialized = initialized;
  57898. }
  57899. Object.defineProperties(CubeMapFace.prototype, {
  57900. pixelFormat: {
  57901. get: function() {
  57902. return this._pixelFormat;
  57903. }
  57904. },
  57905. pixelDatatype: {
  57906. get: function() {
  57907. return this._pixelDatatype;
  57908. }
  57909. },
  57910. _target: {
  57911. get: function() {
  57912. return this._targetFace;
  57913. }
  57914. }
  57915. });
  57916. CubeMapFace.prototype.copyFrom = function(options) {
  57917. Check_default.defined("options", options);
  57918. const xOffset = defaultValue_default(options.xOffset, 0);
  57919. const yOffset = defaultValue_default(options.yOffset, 0);
  57920. Check_default.defined("options.source", options.source);
  57921. Check_default.typeOf.number.greaterThanOrEquals("xOffset", xOffset, 0);
  57922. Check_default.typeOf.number.greaterThanOrEquals("yOffset", yOffset, 0);
  57923. if (xOffset + options.source.width > this._size) {
  57924. throw new DeveloperError_default(
  57925. "xOffset + options.source.width must be less than or equal to width."
  57926. );
  57927. }
  57928. if (yOffset + options.source.height > this._size) {
  57929. throw new DeveloperError_default(
  57930. "yOffset + options.source.height must be less than or equal to height."
  57931. );
  57932. }
  57933. const source = options.source;
  57934. const gl = this._context._gl;
  57935. const target = this._textureTarget;
  57936. const targetFace = this._targetFace;
  57937. gl.activeTexture(gl.TEXTURE0);
  57938. gl.bindTexture(target, this._texture);
  57939. const width = source.width;
  57940. const height = source.height;
  57941. let arrayBufferView = source.arrayBufferView;
  57942. const size = this._size;
  57943. const pixelFormat = this._pixelFormat;
  57944. const internalFormat = this._internalFormat;
  57945. const pixelDatatype = this._pixelDatatype;
  57946. const preMultiplyAlpha = this._preMultiplyAlpha;
  57947. const flipY = this._flipY;
  57948. const skipColorSpaceConversion = defaultValue_default(
  57949. options.skipColorSpaceConversion,
  57950. false
  57951. );
  57952. let unpackAlignment = 4;
  57953. if (defined_default(arrayBufferView)) {
  57954. unpackAlignment = PixelFormat_default.alignmentInBytes(
  57955. pixelFormat,
  57956. pixelDatatype,
  57957. width
  57958. );
  57959. }
  57960. gl.pixelStorei(gl.UNPACK_ALIGNMENT, unpackAlignment);
  57961. if (skipColorSpaceConversion) {
  57962. gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE);
  57963. } else {
  57964. gl.pixelStorei(
  57965. gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,
  57966. gl.BROWSER_DEFAULT_WEBGL
  57967. );
  57968. }
  57969. let uploaded = false;
  57970. if (!this._initialized) {
  57971. if (xOffset === 0 && yOffset === 0 && width === size && height === size) {
  57972. if (defined_default(arrayBufferView)) {
  57973. gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
  57974. gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
  57975. if (flipY) {
  57976. arrayBufferView = PixelFormat_default.flipY(
  57977. arrayBufferView,
  57978. pixelFormat,
  57979. pixelDatatype,
  57980. size,
  57981. size
  57982. );
  57983. }
  57984. gl.texImage2D(
  57985. targetFace,
  57986. 0,
  57987. internalFormat,
  57988. size,
  57989. size,
  57990. 0,
  57991. pixelFormat,
  57992. PixelDatatype_default.toWebGLConstant(pixelDatatype, this._context),
  57993. arrayBufferView
  57994. );
  57995. } else {
  57996. gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, preMultiplyAlpha);
  57997. gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY);
  57998. gl.texImage2D(
  57999. targetFace,
  58000. 0,
  58001. internalFormat,
  58002. pixelFormat,
  58003. PixelDatatype_default.toWebGLConstant(pixelDatatype, this._context),
  58004. source
  58005. );
  58006. }
  58007. uploaded = true;
  58008. } else {
  58009. gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
  58010. gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
  58011. const bufferView = PixelFormat_default.createTypedArray(
  58012. pixelFormat,
  58013. pixelDatatype,
  58014. size,
  58015. size
  58016. );
  58017. gl.texImage2D(
  58018. targetFace,
  58019. 0,
  58020. internalFormat,
  58021. size,
  58022. size,
  58023. 0,
  58024. pixelFormat,
  58025. PixelDatatype_default.toWebGLConstant(pixelDatatype, this._context),
  58026. bufferView
  58027. );
  58028. }
  58029. this._initialized = true;
  58030. }
  58031. if (!uploaded) {
  58032. if (defined_default(arrayBufferView)) {
  58033. gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
  58034. gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
  58035. if (flipY) {
  58036. arrayBufferView = PixelFormat_default.flipY(
  58037. arrayBufferView,
  58038. pixelFormat,
  58039. pixelDatatype,
  58040. width,
  58041. height
  58042. );
  58043. }
  58044. gl.texSubImage2D(
  58045. targetFace,
  58046. 0,
  58047. xOffset,
  58048. yOffset,
  58049. width,
  58050. height,
  58051. pixelFormat,
  58052. PixelDatatype_default.toWebGLConstant(pixelDatatype, this._context),
  58053. arrayBufferView
  58054. );
  58055. } else {
  58056. gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, preMultiplyAlpha);
  58057. gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY);
  58058. gl.texSubImage2D(
  58059. targetFace,
  58060. 0,
  58061. xOffset,
  58062. yOffset,
  58063. pixelFormat,
  58064. PixelDatatype_default.toWebGLConstant(pixelDatatype, this._context),
  58065. source
  58066. );
  58067. }
  58068. }
  58069. gl.bindTexture(target, null);
  58070. };
  58071. CubeMapFace.prototype.copyFromFramebuffer = function(xOffset, yOffset, framebufferXOffset, framebufferYOffset, width, height) {
  58072. xOffset = defaultValue_default(xOffset, 0);
  58073. yOffset = defaultValue_default(yOffset, 0);
  58074. framebufferXOffset = defaultValue_default(framebufferXOffset, 0);
  58075. framebufferYOffset = defaultValue_default(framebufferYOffset, 0);
  58076. width = defaultValue_default(width, this._size);
  58077. height = defaultValue_default(height, this._size);
  58078. Check_default.typeOf.number.greaterThanOrEquals("xOffset", xOffset, 0);
  58079. Check_default.typeOf.number.greaterThanOrEquals("yOffset", yOffset, 0);
  58080. Check_default.typeOf.number.greaterThanOrEquals(
  58081. "framebufferXOffset",
  58082. framebufferXOffset,
  58083. 0
  58084. );
  58085. Check_default.typeOf.number.greaterThanOrEquals(
  58086. "framebufferYOffset",
  58087. framebufferYOffset,
  58088. 0
  58089. );
  58090. if (xOffset + width > this._size) {
  58091. throw new DeveloperError_default(
  58092. "xOffset + source.width must be less than or equal to width."
  58093. );
  58094. }
  58095. if (yOffset + height > this._size) {
  58096. throw new DeveloperError_default(
  58097. "yOffset + source.height must be less than or equal to height."
  58098. );
  58099. }
  58100. if (this._pixelDatatype === PixelDatatype_default.FLOAT) {
  58101. throw new DeveloperError_default(
  58102. "Cannot call copyFromFramebuffer when the texture pixel data type is FLOAT."
  58103. );
  58104. }
  58105. if (this._pixelDatatype === PixelDatatype_default.HALF_FLOAT) {
  58106. throw new DeveloperError_default(
  58107. "Cannot call copyFromFramebuffer when the texture pixel data type is HALF_FLOAT."
  58108. );
  58109. }
  58110. const gl = this._context._gl;
  58111. const target = this._textureTarget;
  58112. gl.activeTexture(gl.TEXTURE0);
  58113. gl.bindTexture(target, this._texture);
  58114. gl.copyTexSubImage2D(
  58115. this._targetFace,
  58116. 0,
  58117. xOffset,
  58118. yOffset,
  58119. framebufferXOffset,
  58120. framebufferYOffset,
  58121. width,
  58122. height
  58123. );
  58124. gl.bindTexture(target, null);
  58125. this._initialized = true;
  58126. };
  58127. var CubeMapFace_default = CubeMapFace;
  58128. // node_modules/cesium/Source/Renderer/MipmapHint.js
  58129. var MipmapHint = {
  58130. DONT_CARE: WebGLConstants_default.DONT_CARE,
  58131. FASTEST: WebGLConstants_default.FASTEST,
  58132. NICEST: WebGLConstants_default.NICEST,
  58133. validate: function(mipmapHint) {
  58134. return mipmapHint === MipmapHint.DONT_CARE || mipmapHint === MipmapHint.FASTEST || mipmapHint === MipmapHint.NICEST;
  58135. }
  58136. };
  58137. var MipmapHint_default = Object.freeze(MipmapHint);
  58138. // node_modules/cesium/Source/Renderer/TextureMagnificationFilter.js
  58139. var TextureMagnificationFilter = {
  58140. NEAREST: WebGLConstants_default.NEAREST,
  58141. LINEAR: WebGLConstants_default.LINEAR
  58142. };
  58143. TextureMagnificationFilter.validate = function(textureMagnificationFilter) {
  58144. return textureMagnificationFilter === TextureMagnificationFilter.NEAREST || textureMagnificationFilter === TextureMagnificationFilter.LINEAR;
  58145. };
  58146. var TextureMagnificationFilter_default = Object.freeze(TextureMagnificationFilter);
  58147. // node_modules/cesium/Source/Renderer/TextureMinificationFilter.js
  58148. var TextureMinificationFilter = {
  58149. NEAREST: WebGLConstants_default.NEAREST,
  58150. LINEAR: WebGLConstants_default.LINEAR,
  58151. NEAREST_MIPMAP_NEAREST: WebGLConstants_default.NEAREST_MIPMAP_NEAREST,
  58152. LINEAR_MIPMAP_NEAREST: WebGLConstants_default.LINEAR_MIPMAP_NEAREST,
  58153. NEAREST_MIPMAP_LINEAR: WebGLConstants_default.NEAREST_MIPMAP_LINEAR,
  58154. LINEAR_MIPMAP_LINEAR: WebGLConstants_default.LINEAR_MIPMAP_LINEAR
  58155. };
  58156. TextureMinificationFilter.validate = function(textureMinificationFilter) {
  58157. return textureMinificationFilter === TextureMinificationFilter.NEAREST || textureMinificationFilter === TextureMinificationFilter.LINEAR || textureMinificationFilter === TextureMinificationFilter.NEAREST_MIPMAP_NEAREST || textureMinificationFilter === TextureMinificationFilter.LINEAR_MIPMAP_NEAREST || textureMinificationFilter === TextureMinificationFilter.NEAREST_MIPMAP_LINEAR || textureMinificationFilter === TextureMinificationFilter.LINEAR_MIPMAP_LINEAR;
  58158. };
  58159. var TextureMinificationFilter_default = Object.freeze(TextureMinificationFilter);
  58160. // node_modules/cesium/Source/Renderer/TextureWrap.js
  58161. var TextureWrap = {
  58162. CLAMP_TO_EDGE: WebGLConstants_default.CLAMP_TO_EDGE,
  58163. REPEAT: WebGLConstants_default.REPEAT,
  58164. MIRRORED_REPEAT: WebGLConstants_default.MIRRORED_REPEAT,
  58165. validate: function(textureWrap) {
  58166. return textureWrap === TextureWrap.CLAMP_TO_EDGE || textureWrap === TextureWrap.REPEAT || textureWrap === TextureWrap.MIRRORED_REPEAT;
  58167. }
  58168. };
  58169. var TextureWrap_default = Object.freeze(TextureWrap);
  58170. // node_modules/cesium/Source/Renderer/Sampler.js
  58171. function Sampler(options) {
  58172. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  58173. const wrapS = defaultValue_default(options.wrapS, TextureWrap_default.CLAMP_TO_EDGE);
  58174. const wrapT = defaultValue_default(options.wrapT, TextureWrap_default.CLAMP_TO_EDGE);
  58175. const minificationFilter = defaultValue_default(
  58176. options.minificationFilter,
  58177. TextureMinificationFilter_default.LINEAR
  58178. );
  58179. const magnificationFilter = defaultValue_default(
  58180. options.magnificationFilter,
  58181. TextureMagnificationFilter_default.LINEAR
  58182. );
  58183. const maximumAnisotropy = defined_default(options.maximumAnisotropy) ? options.maximumAnisotropy : 1;
  58184. if (!TextureWrap_default.validate(wrapS)) {
  58185. throw new DeveloperError_default("Invalid sampler.wrapS.");
  58186. }
  58187. if (!TextureWrap_default.validate(wrapT)) {
  58188. throw new DeveloperError_default("Invalid sampler.wrapT.");
  58189. }
  58190. if (!TextureMinificationFilter_default.validate(minificationFilter)) {
  58191. throw new DeveloperError_default("Invalid sampler.minificationFilter.");
  58192. }
  58193. if (!TextureMagnificationFilter_default.validate(magnificationFilter)) {
  58194. throw new DeveloperError_default("Invalid sampler.magnificationFilter.");
  58195. }
  58196. Check_default.typeOf.number.greaterThanOrEquals(
  58197. "maximumAnisotropy",
  58198. maximumAnisotropy,
  58199. 1
  58200. );
  58201. this._wrapS = wrapS;
  58202. this._wrapT = wrapT;
  58203. this._minificationFilter = minificationFilter;
  58204. this._magnificationFilter = magnificationFilter;
  58205. this._maximumAnisotropy = maximumAnisotropy;
  58206. }
  58207. Object.defineProperties(Sampler.prototype, {
  58208. wrapS: {
  58209. get: function() {
  58210. return this._wrapS;
  58211. }
  58212. },
  58213. wrapT: {
  58214. get: function() {
  58215. return this._wrapT;
  58216. }
  58217. },
  58218. minificationFilter: {
  58219. get: function() {
  58220. return this._minificationFilter;
  58221. }
  58222. },
  58223. magnificationFilter: {
  58224. get: function() {
  58225. return this._magnificationFilter;
  58226. }
  58227. },
  58228. maximumAnisotropy: {
  58229. get: function() {
  58230. return this._maximumAnisotropy;
  58231. }
  58232. }
  58233. });
  58234. Sampler.equals = function(left, right) {
  58235. return left === right || defined_default(left) && defined_default(right) && left._wrapS === right._wrapS && left._wrapT === right._wrapT && left._minificationFilter === right._minificationFilter && left._magnificationFilter === right._magnificationFilter && left._maximumAnisotropy === right._maximumAnisotropy;
  58236. };
  58237. Sampler.NEAREST = Object.freeze(
  58238. new Sampler({
  58239. wrapS: TextureWrap_default.CLAMP_TO_EDGE,
  58240. wrapT: TextureWrap_default.CLAMP_TO_EDGE,
  58241. minificationFilter: TextureMinificationFilter_default.NEAREST,
  58242. magnificationFilter: TextureMagnificationFilter_default.NEAREST
  58243. })
  58244. );
  58245. var Sampler_default = Sampler;
  58246. // node_modules/cesium/Source/Renderer/CubeMap.js
  58247. function CubeMap(options) {
  58248. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  58249. Check_default.defined("options.context", options.context);
  58250. const context = options.context;
  58251. const source = options.source;
  58252. let width;
  58253. let height;
  58254. if (defined_default(source)) {
  58255. const faces2 = [
  58256. source.positiveX,
  58257. source.negativeX,
  58258. source.positiveY,
  58259. source.negativeY,
  58260. source.positiveZ,
  58261. source.negativeZ
  58262. ];
  58263. if (!faces2[0] || !faces2[1] || !faces2[2] || !faces2[3] || !faces2[4] || !faces2[5]) {
  58264. throw new DeveloperError_default(
  58265. "options.source requires positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ faces."
  58266. );
  58267. }
  58268. width = faces2[0].width;
  58269. height = faces2[0].height;
  58270. for (let i2 = 1; i2 < 6; ++i2) {
  58271. if (Number(faces2[i2].width) !== width || Number(faces2[i2].height) !== height) {
  58272. throw new DeveloperError_default(
  58273. "Each face in options.source must have the same width and height."
  58274. );
  58275. }
  58276. }
  58277. } else {
  58278. width = options.width;
  58279. height = options.height;
  58280. }
  58281. const size = width;
  58282. const pixelDatatype = defaultValue_default(
  58283. options.pixelDatatype,
  58284. PixelDatatype_default.UNSIGNED_BYTE
  58285. );
  58286. const pixelFormat = defaultValue_default(options.pixelFormat, PixelFormat_default.RGBA);
  58287. const internalFormat = PixelFormat_default.toInternalFormat(
  58288. pixelFormat,
  58289. pixelDatatype,
  58290. context
  58291. );
  58292. if (!defined_default(width) || !defined_default(height)) {
  58293. throw new DeveloperError_default(
  58294. "options requires a source field to create an initialized cube map or width and height fields to create a blank cube map."
  58295. );
  58296. }
  58297. if (width !== height) {
  58298. throw new DeveloperError_default("Width must equal height.");
  58299. }
  58300. if (size <= 0) {
  58301. throw new DeveloperError_default("Width and height must be greater than zero.");
  58302. }
  58303. if (size > ContextLimits_default.maximumCubeMapSize) {
  58304. throw new DeveloperError_default(
  58305. `Width and height must be less than or equal to the maximum cube map size (${ContextLimits_default.maximumCubeMapSize}). Check maximumCubeMapSize.`
  58306. );
  58307. }
  58308. if (!PixelFormat_default.validate(pixelFormat)) {
  58309. throw new DeveloperError_default("Invalid options.pixelFormat.");
  58310. }
  58311. if (PixelFormat_default.isDepthFormat(pixelFormat)) {
  58312. throw new DeveloperError_default(
  58313. "options.pixelFormat cannot be DEPTH_COMPONENT or DEPTH_STENCIL."
  58314. );
  58315. }
  58316. if (!PixelDatatype_default.validate(pixelDatatype)) {
  58317. throw new DeveloperError_default("Invalid options.pixelDatatype.");
  58318. }
  58319. if (pixelDatatype === PixelDatatype_default.FLOAT && !context.floatingPointTexture) {
  58320. throw new DeveloperError_default(
  58321. "When options.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension."
  58322. );
  58323. }
  58324. if (pixelDatatype === PixelDatatype_default.HALF_FLOAT && !context.halfFloatingPointTexture) {
  58325. throw new DeveloperError_default(
  58326. "When options.pixelDatatype is HALF_FLOAT, this WebGL implementation must support the OES_texture_half_float extension."
  58327. );
  58328. }
  58329. const sizeInBytes = PixelFormat_default.textureSizeInBytes(pixelFormat, pixelDatatype, size, size) * 6;
  58330. const preMultiplyAlpha = options.preMultiplyAlpha || pixelFormat === PixelFormat_default.RGB || pixelFormat === PixelFormat_default.LUMINANCE;
  58331. const flipY = defaultValue_default(options.flipY, true);
  58332. const skipColorSpaceConversion = defaultValue_default(
  58333. options.skipColorSpaceConversion,
  58334. false
  58335. );
  58336. const gl = context._gl;
  58337. const textureTarget = gl.TEXTURE_CUBE_MAP;
  58338. const texture = gl.createTexture();
  58339. gl.activeTexture(gl.TEXTURE0);
  58340. gl.bindTexture(textureTarget, texture);
  58341. function createFace(target, sourceFace, preMultiplyAlpha2, flipY2, skipColorSpaceConversion2) {
  58342. let arrayBufferView = sourceFace.arrayBufferView;
  58343. if (!defined_default(arrayBufferView)) {
  58344. arrayBufferView = sourceFace.bufferView;
  58345. }
  58346. let unpackAlignment = 4;
  58347. if (defined_default(arrayBufferView)) {
  58348. unpackAlignment = PixelFormat_default.alignmentInBytes(
  58349. pixelFormat,
  58350. pixelDatatype,
  58351. width
  58352. );
  58353. }
  58354. gl.pixelStorei(gl.UNPACK_ALIGNMENT, unpackAlignment);
  58355. if (skipColorSpaceConversion2) {
  58356. gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE);
  58357. } else {
  58358. gl.pixelStorei(
  58359. gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,
  58360. gl.BROWSER_DEFAULT_WEBGL
  58361. );
  58362. }
  58363. if (defined_default(arrayBufferView)) {
  58364. gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
  58365. gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
  58366. if (flipY2) {
  58367. arrayBufferView = PixelFormat_default.flipY(
  58368. arrayBufferView,
  58369. pixelFormat,
  58370. pixelDatatype,
  58371. size,
  58372. size
  58373. );
  58374. }
  58375. gl.texImage2D(
  58376. target,
  58377. 0,
  58378. internalFormat,
  58379. size,
  58380. size,
  58381. 0,
  58382. pixelFormat,
  58383. PixelDatatype_default.toWebGLConstant(pixelDatatype, context),
  58384. arrayBufferView
  58385. );
  58386. } else {
  58387. gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, preMultiplyAlpha2);
  58388. gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY2);
  58389. gl.texImage2D(
  58390. target,
  58391. 0,
  58392. internalFormat,
  58393. pixelFormat,
  58394. PixelDatatype_default.toWebGLConstant(pixelDatatype, context),
  58395. sourceFace
  58396. );
  58397. }
  58398. }
  58399. if (defined_default(source)) {
  58400. createFace(
  58401. gl.TEXTURE_CUBE_MAP_POSITIVE_X,
  58402. source.positiveX,
  58403. preMultiplyAlpha,
  58404. flipY,
  58405. skipColorSpaceConversion
  58406. );
  58407. createFace(
  58408. gl.TEXTURE_CUBE_MAP_NEGATIVE_X,
  58409. source.negativeX,
  58410. preMultiplyAlpha,
  58411. flipY,
  58412. skipColorSpaceConversion
  58413. );
  58414. createFace(
  58415. gl.TEXTURE_CUBE_MAP_POSITIVE_Y,
  58416. source.positiveY,
  58417. preMultiplyAlpha,
  58418. flipY,
  58419. skipColorSpaceConversion
  58420. );
  58421. createFace(
  58422. gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,
  58423. source.negativeY,
  58424. preMultiplyAlpha,
  58425. flipY,
  58426. skipColorSpaceConversion
  58427. );
  58428. createFace(
  58429. gl.TEXTURE_CUBE_MAP_POSITIVE_Z,
  58430. source.positiveZ,
  58431. preMultiplyAlpha,
  58432. flipY,
  58433. skipColorSpaceConversion
  58434. );
  58435. createFace(
  58436. gl.TEXTURE_CUBE_MAP_NEGATIVE_Z,
  58437. source.negativeZ,
  58438. preMultiplyAlpha,
  58439. flipY,
  58440. skipColorSpaceConversion
  58441. );
  58442. } else {
  58443. gl.texImage2D(
  58444. gl.TEXTURE_CUBE_MAP_POSITIVE_X,
  58445. 0,
  58446. internalFormat,
  58447. size,
  58448. size,
  58449. 0,
  58450. pixelFormat,
  58451. PixelDatatype_default.toWebGLConstant(pixelDatatype, context),
  58452. null
  58453. );
  58454. gl.texImage2D(
  58455. gl.TEXTURE_CUBE_MAP_NEGATIVE_X,
  58456. 0,
  58457. internalFormat,
  58458. size,
  58459. size,
  58460. 0,
  58461. pixelFormat,
  58462. PixelDatatype_default.toWebGLConstant(pixelDatatype, context),
  58463. null
  58464. );
  58465. gl.texImage2D(
  58466. gl.TEXTURE_CUBE_MAP_POSITIVE_Y,
  58467. 0,
  58468. internalFormat,
  58469. size,
  58470. size,
  58471. 0,
  58472. pixelFormat,
  58473. PixelDatatype_default.toWebGLConstant(pixelDatatype, context),
  58474. null
  58475. );
  58476. gl.texImage2D(
  58477. gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,
  58478. 0,
  58479. internalFormat,
  58480. size,
  58481. size,
  58482. 0,
  58483. pixelFormat,
  58484. PixelDatatype_default.toWebGLConstant(pixelDatatype, context),
  58485. null
  58486. );
  58487. gl.texImage2D(
  58488. gl.TEXTURE_CUBE_MAP_POSITIVE_Z,
  58489. 0,
  58490. internalFormat,
  58491. size,
  58492. size,
  58493. 0,
  58494. pixelFormat,
  58495. PixelDatatype_default.toWebGLConstant(pixelDatatype, context),
  58496. null
  58497. );
  58498. gl.texImage2D(
  58499. gl.TEXTURE_CUBE_MAP_NEGATIVE_Z,
  58500. 0,
  58501. internalFormat,
  58502. size,
  58503. size,
  58504. 0,
  58505. pixelFormat,
  58506. PixelDatatype_default.toWebGLConstant(pixelDatatype, context),
  58507. null
  58508. );
  58509. }
  58510. gl.bindTexture(textureTarget, null);
  58511. this._context = context;
  58512. this._textureFilterAnisotropic = context._textureFilterAnisotropic;
  58513. this._textureTarget = textureTarget;
  58514. this._texture = texture;
  58515. this._pixelFormat = pixelFormat;
  58516. this._pixelDatatype = pixelDatatype;
  58517. this._size = size;
  58518. this._hasMipmap = false;
  58519. this._sizeInBytes = sizeInBytes;
  58520. this._preMultiplyAlpha = preMultiplyAlpha;
  58521. this._flipY = flipY;
  58522. this._sampler = void 0;
  58523. const initialized = defined_default(source);
  58524. this._positiveX = new CubeMapFace_default(
  58525. context,
  58526. texture,
  58527. textureTarget,
  58528. gl.TEXTURE_CUBE_MAP_POSITIVE_X,
  58529. internalFormat,
  58530. pixelFormat,
  58531. pixelDatatype,
  58532. size,
  58533. preMultiplyAlpha,
  58534. flipY,
  58535. initialized
  58536. );
  58537. this._negativeX = new CubeMapFace_default(
  58538. context,
  58539. texture,
  58540. textureTarget,
  58541. gl.TEXTURE_CUBE_MAP_NEGATIVE_X,
  58542. internalFormat,
  58543. pixelFormat,
  58544. pixelDatatype,
  58545. size,
  58546. preMultiplyAlpha,
  58547. flipY,
  58548. initialized
  58549. );
  58550. this._positiveY = new CubeMapFace_default(
  58551. context,
  58552. texture,
  58553. textureTarget,
  58554. gl.TEXTURE_CUBE_MAP_POSITIVE_Y,
  58555. internalFormat,
  58556. pixelFormat,
  58557. pixelDatatype,
  58558. size,
  58559. preMultiplyAlpha,
  58560. flipY,
  58561. initialized
  58562. );
  58563. this._negativeY = new CubeMapFace_default(
  58564. context,
  58565. texture,
  58566. textureTarget,
  58567. gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,
  58568. internalFormat,
  58569. pixelFormat,
  58570. pixelDatatype,
  58571. size,
  58572. preMultiplyAlpha,
  58573. flipY,
  58574. initialized
  58575. );
  58576. this._positiveZ = new CubeMapFace_default(
  58577. context,
  58578. texture,
  58579. textureTarget,
  58580. gl.TEXTURE_CUBE_MAP_POSITIVE_Z,
  58581. internalFormat,
  58582. pixelFormat,
  58583. pixelDatatype,
  58584. size,
  58585. preMultiplyAlpha,
  58586. flipY,
  58587. initialized
  58588. );
  58589. this._negativeZ = new CubeMapFace_default(
  58590. context,
  58591. texture,
  58592. textureTarget,
  58593. gl.TEXTURE_CUBE_MAP_NEGATIVE_Z,
  58594. internalFormat,
  58595. pixelFormat,
  58596. pixelDatatype,
  58597. size,
  58598. preMultiplyAlpha,
  58599. flipY,
  58600. initialized
  58601. );
  58602. this.sampler = defined_default(options.sampler) ? options.sampler : new Sampler_default();
  58603. }
  58604. Object.defineProperties(CubeMap.prototype, {
  58605. positiveX: {
  58606. get: function() {
  58607. return this._positiveX;
  58608. }
  58609. },
  58610. negativeX: {
  58611. get: function() {
  58612. return this._negativeX;
  58613. }
  58614. },
  58615. positiveY: {
  58616. get: function() {
  58617. return this._positiveY;
  58618. }
  58619. },
  58620. negativeY: {
  58621. get: function() {
  58622. return this._negativeY;
  58623. }
  58624. },
  58625. positiveZ: {
  58626. get: function() {
  58627. return this._positiveZ;
  58628. }
  58629. },
  58630. negativeZ: {
  58631. get: function() {
  58632. return this._negativeZ;
  58633. }
  58634. },
  58635. sampler: {
  58636. get: function() {
  58637. return this._sampler;
  58638. },
  58639. set: function(sampler) {
  58640. let minificationFilter = sampler.minificationFilter;
  58641. let magnificationFilter = sampler.magnificationFilter;
  58642. const mipmap = minificationFilter === TextureMinificationFilter_default.NEAREST_MIPMAP_NEAREST || minificationFilter === TextureMinificationFilter_default.NEAREST_MIPMAP_LINEAR || minificationFilter === TextureMinificationFilter_default.LINEAR_MIPMAP_NEAREST || minificationFilter === TextureMinificationFilter_default.LINEAR_MIPMAP_LINEAR;
  58643. const context = this._context;
  58644. const pixelDatatype = this._pixelDatatype;
  58645. if (pixelDatatype === PixelDatatype_default.FLOAT && !context.textureFloatLinear || pixelDatatype === PixelDatatype_default.HALF_FLOAT && !context.textureHalfFloatLinear) {
  58646. minificationFilter = mipmap ? TextureMinificationFilter_default.NEAREST_MIPMAP_NEAREST : TextureMinificationFilter_default.NEAREST;
  58647. magnificationFilter = TextureMagnificationFilter_default.NEAREST;
  58648. }
  58649. const gl = context._gl;
  58650. const target = this._textureTarget;
  58651. gl.activeTexture(gl.TEXTURE0);
  58652. gl.bindTexture(target, this._texture);
  58653. gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, minificationFilter);
  58654. gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, magnificationFilter);
  58655. gl.texParameteri(target, gl.TEXTURE_WRAP_S, sampler.wrapS);
  58656. gl.texParameteri(target, gl.TEXTURE_WRAP_T, sampler.wrapT);
  58657. if (defined_default(this._textureFilterAnisotropic)) {
  58658. gl.texParameteri(
  58659. target,
  58660. this._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,
  58661. sampler.maximumAnisotropy
  58662. );
  58663. }
  58664. gl.bindTexture(target, null);
  58665. this._sampler = sampler;
  58666. }
  58667. },
  58668. pixelFormat: {
  58669. get: function() {
  58670. return this._pixelFormat;
  58671. }
  58672. },
  58673. pixelDatatype: {
  58674. get: function() {
  58675. return this._pixelDatatype;
  58676. }
  58677. },
  58678. width: {
  58679. get: function() {
  58680. return this._size;
  58681. }
  58682. },
  58683. height: {
  58684. get: function() {
  58685. return this._size;
  58686. }
  58687. },
  58688. sizeInBytes: {
  58689. get: function() {
  58690. if (this._hasMipmap) {
  58691. return Math.floor(this._sizeInBytes * 4 / 3);
  58692. }
  58693. return this._sizeInBytes;
  58694. }
  58695. },
  58696. preMultiplyAlpha: {
  58697. get: function() {
  58698. return this._preMultiplyAlpha;
  58699. }
  58700. },
  58701. flipY: {
  58702. get: function() {
  58703. return this._flipY;
  58704. }
  58705. },
  58706. _target: {
  58707. get: function() {
  58708. return this._textureTarget;
  58709. }
  58710. }
  58711. });
  58712. CubeMap.prototype.generateMipmap = function(hint) {
  58713. hint = defaultValue_default(hint, MipmapHint_default.DONT_CARE);
  58714. if (this._size > 1 && !Math_default.isPowerOfTwo(this._size)) {
  58715. throw new DeveloperError_default(
  58716. "width and height must be a power of two to call generateMipmap()."
  58717. );
  58718. }
  58719. if (!MipmapHint_default.validate(hint)) {
  58720. throw new DeveloperError_default("hint is invalid.");
  58721. }
  58722. this._hasMipmap = true;
  58723. const gl = this._context._gl;
  58724. const target = this._textureTarget;
  58725. gl.hint(gl.GENERATE_MIPMAP_HINT, hint);
  58726. gl.activeTexture(gl.TEXTURE0);
  58727. gl.bindTexture(target, this._texture);
  58728. gl.generateMipmap(target);
  58729. gl.bindTexture(target, null);
  58730. };
  58731. CubeMap.prototype.isDestroyed = function() {
  58732. return false;
  58733. };
  58734. CubeMap.prototype.destroy = function() {
  58735. this._context._gl.deleteTexture(this._texture);
  58736. this._positiveX = destroyObject_default(this._positiveX);
  58737. this._negativeX = destroyObject_default(this._negativeX);
  58738. this._positiveY = destroyObject_default(this._positiveY);
  58739. this._negativeY = destroyObject_default(this._negativeY);
  58740. this._positiveZ = destroyObject_default(this._positiveZ);
  58741. this._negativeZ = destroyObject_default(this._negativeZ);
  58742. return destroyObject_default(this);
  58743. };
  58744. var CubeMap_default = CubeMap;
  58745. // node_modules/cesium/Source/Renderer/Texture.js
  58746. function Texture(options) {
  58747. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  58748. Check_default.defined("options.context", options.context);
  58749. const context = options.context;
  58750. let width = options.width;
  58751. let height = options.height;
  58752. const source = options.source;
  58753. if (defined_default(source)) {
  58754. if (!defined_default(width)) {
  58755. width = defaultValue_default(source.videoWidth, source.width);
  58756. }
  58757. if (!defined_default(height)) {
  58758. height = defaultValue_default(source.videoHeight, source.height);
  58759. }
  58760. }
  58761. const pixelFormat = defaultValue_default(options.pixelFormat, PixelFormat_default.RGBA);
  58762. const pixelDatatype = defaultValue_default(
  58763. options.pixelDatatype,
  58764. PixelDatatype_default.UNSIGNED_BYTE
  58765. );
  58766. const internalFormat = PixelFormat_default.toInternalFormat(
  58767. pixelFormat,
  58768. pixelDatatype,
  58769. context
  58770. );
  58771. const isCompressed = PixelFormat_default.isCompressedFormat(internalFormat);
  58772. if (!defined_default(width) || !defined_default(height)) {
  58773. throw new DeveloperError_default(
  58774. "options requires a source field to create an initialized texture or width and height fields to create a blank texture."
  58775. );
  58776. }
  58777. Check_default.typeOf.number.greaterThan("width", width, 0);
  58778. if (width > ContextLimits_default.maximumTextureSize) {
  58779. throw new DeveloperError_default(
  58780. `Width must be less than or equal to the maximum texture size (${ContextLimits_default.maximumTextureSize}). Check maximumTextureSize.`
  58781. );
  58782. }
  58783. Check_default.typeOf.number.greaterThan("height", height, 0);
  58784. if (height > ContextLimits_default.maximumTextureSize) {
  58785. throw new DeveloperError_default(
  58786. `Height must be less than or equal to the maximum texture size (${ContextLimits_default.maximumTextureSize}). Check maximumTextureSize.`
  58787. );
  58788. }
  58789. if (!PixelFormat_default.validate(pixelFormat)) {
  58790. throw new DeveloperError_default("Invalid options.pixelFormat.");
  58791. }
  58792. if (!isCompressed && !PixelDatatype_default.validate(pixelDatatype)) {
  58793. throw new DeveloperError_default("Invalid options.pixelDatatype.");
  58794. }
  58795. if (pixelFormat === PixelFormat_default.DEPTH_COMPONENT && pixelDatatype !== PixelDatatype_default.UNSIGNED_SHORT && pixelDatatype !== PixelDatatype_default.UNSIGNED_INT) {
  58796. throw new DeveloperError_default(
  58797. "When options.pixelFormat is DEPTH_COMPONENT, options.pixelDatatype must be UNSIGNED_SHORT or UNSIGNED_INT."
  58798. );
  58799. }
  58800. if (pixelFormat === PixelFormat_default.DEPTH_STENCIL && pixelDatatype !== PixelDatatype_default.UNSIGNED_INT_24_8) {
  58801. throw new DeveloperError_default(
  58802. "When options.pixelFormat is DEPTH_STENCIL, options.pixelDatatype must be UNSIGNED_INT_24_8."
  58803. );
  58804. }
  58805. if (pixelDatatype === PixelDatatype_default.FLOAT && !context.floatingPointTexture) {
  58806. throw new DeveloperError_default(
  58807. "When options.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension. Check context.floatingPointTexture."
  58808. );
  58809. }
  58810. if (pixelDatatype === PixelDatatype_default.HALF_FLOAT && !context.halfFloatingPointTexture) {
  58811. throw new DeveloperError_default(
  58812. "When options.pixelDatatype is HALF_FLOAT, this WebGL implementation must support the OES_texture_half_float extension. Check context.halfFloatingPointTexture."
  58813. );
  58814. }
  58815. if (PixelFormat_default.isDepthFormat(pixelFormat)) {
  58816. if (defined_default(source)) {
  58817. throw new DeveloperError_default(
  58818. "When options.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, source cannot be provided."
  58819. );
  58820. }
  58821. if (!context.depthTexture) {
  58822. throw new DeveloperError_default(
  58823. "When options.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, this WebGL implementation must support WEBGL_depth_texture. Check context.depthTexture."
  58824. );
  58825. }
  58826. }
  58827. if (isCompressed) {
  58828. if (!defined_default(source) || !defined_default(source.arrayBufferView)) {
  58829. throw new DeveloperError_default(
  58830. "When options.pixelFormat is compressed, options.source.arrayBufferView must be defined."
  58831. );
  58832. }
  58833. if (PixelFormat_default.isDXTFormat(internalFormat) && !context.s3tc) {
  58834. throw new DeveloperError_default(
  58835. "When options.pixelFormat is S3TC compressed, this WebGL implementation must support the WEBGL_compressed_texture_s3tc extension. Check context.s3tc."
  58836. );
  58837. } else if (PixelFormat_default.isPVRTCFormat(internalFormat) && !context.pvrtc) {
  58838. throw new DeveloperError_default(
  58839. "When options.pixelFormat is PVRTC compressed, this WebGL implementation must support the WEBGL_compressed_texture_pvrtc extension. Check context.pvrtc."
  58840. );
  58841. } else if (PixelFormat_default.isASTCFormat(internalFormat) && !context.astc) {
  58842. throw new DeveloperError_default(
  58843. "When options.pixelFormat is ASTC compressed, this WebGL implementation must support the WEBGL_compressed_texture_astc extension. Check context.astc."
  58844. );
  58845. } else if (PixelFormat_default.isETC2Format(internalFormat) && !context.etc) {
  58846. throw new DeveloperError_default(
  58847. "When options.pixelFormat is ETC2 compressed, this WebGL implementation must support the WEBGL_compressed_texture_etc extension. Check context.etc."
  58848. );
  58849. } else if (PixelFormat_default.isETC1Format(internalFormat) && !context.etc1) {
  58850. throw new DeveloperError_default(
  58851. "When options.pixelFormat is ETC1 compressed, this WebGL implementation must support the WEBGL_compressed_texture_etc1 extension. Check context.etc1."
  58852. );
  58853. } else if (PixelFormat_default.isBC7Format(internalFormat) && !context.bc7) {
  58854. throw new DeveloperError_default(
  58855. "When options.pixelFormat is BC7 compressed, this WebGL implementation must support the EXT_texture_compression_bptc extension. Check context.bc7."
  58856. );
  58857. }
  58858. if (PixelFormat_default.compressedTextureSizeInBytes(
  58859. internalFormat,
  58860. width,
  58861. height
  58862. ) !== source.arrayBufferView.byteLength) {
  58863. throw new DeveloperError_default(
  58864. "The byte length of the array buffer is invalid for the compressed texture with the given width and height."
  58865. );
  58866. }
  58867. }
  58868. const preMultiplyAlpha = options.preMultiplyAlpha || pixelFormat === PixelFormat_default.RGB || pixelFormat === PixelFormat_default.LUMINANCE;
  58869. const flipY = defaultValue_default(options.flipY, true);
  58870. const skipColorSpaceConversion = defaultValue_default(
  58871. options.skipColorSpaceConversion,
  58872. false
  58873. );
  58874. let initialized = true;
  58875. const gl = context._gl;
  58876. const textureTarget = gl.TEXTURE_2D;
  58877. const texture = gl.createTexture();
  58878. gl.activeTexture(gl.TEXTURE0);
  58879. gl.bindTexture(textureTarget, texture);
  58880. let unpackAlignment = 4;
  58881. if (defined_default(source) && defined_default(source.arrayBufferView) && !isCompressed) {
  58882. unpackAlignment = PixelFormat_default.alignmentInBytes(
  58883. pixelFormat,
  58884. pixelDatatype,
  58885. width
  58886. );
  58887. }
  58888. gl.pixelStorei(gl.UNPACK_ALIGNMENT, unpackAlignment);
  58889. if (skipColorSpaceConversion) {
  58890. gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE);
  58891. } else {
  58892. gl.pixelStorei(
  58893. gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,
  58894. gl.BROWSER_DEFAULT_WEBGL
  58895. );
  58896. }
  58897. if (defined_default(source)) {
  58898. if (defined_default(source.arrayBufferView)) {
  58899. gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
  58900. gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
  58901. let arrayBufferView = source.arrayBufferView;
  58902. let i2, mipWidth, mipHeight;
  58903. if (isCompressed) {
  58904. gl.compressedTexImage2D(
  58905. textureTarget,
  58906. 0,
  58907. internalFormat,
  58908. width,
  58909. height,
  58910. 0,
  58911. arrayBufferView
  58912. );
  58913. if (defined_default(source.mipLevels)) {
  58914. mipWidth = width;
  58915. mipHeight = height;
  58916. for (i2 = 0; i2 < source.mipLevels.length; ++i2) {
  58917. mipWidth = Math.floor(mipWidth / 2) | 0;
  58918. if (mipWidth < 1) {
  58919. mipWidth = 1;
  58920. }
  58921. mipHeight = Math.floor(mipHeight / 2) | 0;
  58922. if (mipHeight < 1) {
  58923. mipHeight = 1;
  58924. }
  58925. gl.compressedTexImage2D(
  58926. textureTarget,
  58927. i2 + 1,
  58928. internalFormat,
  58929. mipWidth,
  58930. mipHeight,
  58931. 0,
  58932. source.mipLevels[i2]
  58933. );
  58934. }
  58935. }
  58936. } else {
  58937. if (flipY) {
  58938. arrayBufferView = PixelFormat_default.flipY(
  58939. arrayBufferView,
  58940. pixelFormat,
  58941. pixelDatatype,
  58942. width,
  58943. height
  58944. );
  58945. }
  58946. gl.texImage2D(
  58947. textureTarget,
  58948. 0,
  58949. internalFormat,
  58950. width,
  58951. height,
  58952. 0,
  58953. pixelFormat,
  58954. PixelDatatype_default.toWebGLConstant(pixelDatatype, context),
  58955. arrayBufferView
  58956. );
  58957. if (defined_default(source.mipLevels)) {
  58958. mipWidth = width;
  58959. mipHeight = height;
  58960. for (i2 = 0; i2 < source.mipLevels.length; ++i2) {
  58961. mipWidth = Math.floor(mipWidth / 2) | 0;
  58962. if (mipWidth < 1) {
  58963. mipWidth = 1;
  58964. }
  58965. mipHeight = Math.floor(mipHeight / 2) | 0;
  58966. if (mipHeight < 1) {
  58967. mipHeight = 1;
  58968. }
  58969. gl.texImage2D(
  58970. textureTarget,
  58971. i2 + 1,
  58972. internalFormat,
  58973. mipWidth,
  58974. mipHeight,
  58975. 0,
  58976. pixelFormat,
  58977. PixelDatatype_default.toWebGLConstant(pixelDatatype, context),
  58978. source.mipLevels[i2]
  58979. );
  58980. }
  58981. }
  58982. }
  58983. } else if (defined_default(source.framebuffer)) {
  58984. gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
  58985. gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
  58986. if (source.framebuffer !== context.defaultFramebuffer) {
  58987. source.framebuffer._bind();
  58988. }
  58989. gl.copyTexImage2D(
  58990. textureTarget,
  58991. 0,
  58992. internalFormat,
  58993. source.xOffset,
  58994. source.yOffset,
  58995. width,
  58996. height,
  58997. 0
  58998. );
  58999. if (source.framebuffer !== context.defaultFramebuffer) {
  59000. source.framebuffer._unBind();
  59001. }
  59002. } else {
  59003. gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, preMultiplyAlpha);
  59004. gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY);
  59005. gl.texImage2D(
  59006. textureTarget,
  59007. 0,
  59008. internalFormat,
  59009. pixelFormat,
  59010. PixelDatatype_default.toWebGLConstant(pixelDatatype, context),
  59011. source
  59012. );
  59013. }
  59014. } else {
  59015. gl.texImage2D(
  59016. textureTarget,
  59017. 0,
  59018. internalFormat,
  59019. width,
  59020. height,
  59021. 0,
  59022. pixelFormat,
  59023. PixelDatatype_default.toWebGLConstant(pixelDatatype, context),
  59024. null
  59025. );
  59026. initialized = false;
  59027. }
  59028. gl.bindTexture(textureTarget, null);
  59029. let sizeInBytes;
  59030. if (isCompressed) {
  59031. sizeInBytes = PixelFormat_default.compressedTextureSizeInBytes(
  59032. pixelFormat,
  59033. width,
  59034. height
  59035. );
  59036. } else {
  59037. sizeInBytes = PixelFormat_default.textureSizeInBytes(
  59038. pixelFormat,
  59039. pixelDatatype,
  59040. width,
  59041. height
  59042. );
  59043. }
  59044. this._id = createGuid_default();
  59045. this._context = context;
  59046. this._textureFilterAnisotropic = context._textureFilterAnisotropic;
  59047. this._textureTarget = textureTarget;
  59048. this._texture = texture;
  59049. this._internalFormat = internalFormat;
  59050. this._pixelFormat = pixelFormat;
  59051. this._pixelDatatype = pixelDatatype;
  59052. this._width = width;
  59053. this._height = height;
  59054. this._dimensions = new Cartesian2_default(width, height);
  59055. this._hasMipmap = false;
  59056. this._sizeInBytes = sizeInBytes;
  59057. this._preMultiplyAlpha = preMultiplyAlpha;
  59058. this._flipY = flipY;
  59059. this._initialized = initialized;
  59060. this._sampler = void 0;
  59061. this.sampler = defined_default(options.sampler) ? options.sampler : new Sampler_default();
  59062. }
  59063. Texture.create = function(options) {
  59064. return new Texture(options);
  59065. };
  59066. Texture.fromFramebuffer = function(options) {
  59067. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  59068. Check_default.defined("options.context", options.context);
  59069. const context = options.context;
  59070. const gl = context._gl;
  59071. const pixelFormat = defaultValue_default(options.pixelFormat, PixelFormat_default.RGB);
  59072. const framebufferXOffset = defaultValue_default(options.framebufferXOffset, 0);
  59073. const framebufferYOffset = defaultValue_default(options.framebufferYOffset, 0);
  59074. const width = defaultValue_default(options.width, gl.drawingBufferWidth);
  59075. const height = defaultValue_default(options.height, gl.drawingBufferHeight);
  59076. const framebuffer = options.framebuffer;
  59077. if (!PixelFormat_default.validate(pixelFormat)) {
  59078. throw new DeveloperError_default("Invalid pixelFormat.");
  59079. }
  59080. if (PixelFormat_default.isDepthFormat(pixelFormat) || PixelFormat_default.isCompressedFormat(pixelFormat)) {
  59081. throw new DeveloperError_default(
  59082. "pixelFormat cannot be DEPTH_COMPONENT, DEPTH_STENCIL or a compressed format."
  59083. );
  59084. }
  59085. Check_default.defined("options.context", options.context);
  59086. Check_default.typeOf.number.greaterThanOrEquals(
  59087. "framebufferXOffset",
  59088. framebufferXOffset,
  59089. 0
  59090. );
  59091. Check_default.typeOf.number.greaterThanOrEquals(
  59092. "framebufferYOffset",
  59093. framebufferYOffset,
  59094. 0
  59095. );
  59096. if (framebufferXOffset + width > gl.drawingBufferWidth) {
  59097. throw new DeveloperError_default(
  59098. "framebufferXOffset + width must be less than or equal to drawingBufferWidth"
  59099. );
  59100. }
  59101. if (framebufferYOffset + height > gl.drawingBufferHeight) {
  59102. throw new DeveloperError_default(
  59103. "framebufferYOffset + height must be less than or equal to drawingBufferHeight."
  59104. );
  59105. }
  59106. const texture = new Texture({
  59107. context,
  59108. width,
  59109. height,
  59110. pixelFormat,
  59111. source: {
  59112. framebuffer: defined_default(framebuffer) ? framebuffer : context.defaultFramebuffer,
  59113. xOffset: framebufferXOffset,
  59114. yOffset: framebufferYOffset,
  59115. width,
  59116. height
  59117. }
  59118. });
  59119. return texture;
  59120. };
  59121. Object.defineProperties(Texture.prototype, {
  59122. id: {
  59123. get: function() {
  59124. return this._id;
  59125. }
  59126. },
  59127. sampler: {
  59128. get: function() {
  59129. return this._sampler;
  59130. },
  59131. set: function(sampler) {
  59132. let minificationFilter = sampler.minificationFilter;
  59133. let magnificationFilter = sampler.magnificationFilter;
  59134. const context = this._context;
  59135. const pixelFormat = this._pixelFormat;
  59136. const pixelDatatype = this._pixelDatatype;
  59137. const mipmap = minificationFilter === TextureMinificationFilter_default.NEAREST_MIPMAP_NEAREST || minificationFilter === TextureMinificationFilter_default.NEAREST_MIPMAP_LINEAR || minificationFilter === TextureMinificationFilter_default.LINEAR_MIPMAP_NEAREST || minificationFilter === TextureMinificationFilter_default.LINEAR_MIPMAP_LINEAR;
  59138. if (pixelDatatype === PixelDatatype_default.FLOAT && !context.textureFloatLinear || pixelDatatype === PixelDatatype_default.HALF_FLOAT && !context.textureHalfFloatLinear) {
  59139. minificationFilter = mipmap ? TextureMinificationFilter_default.NEAREST_MIPMAP_NEAREST : TextureMinificationFilter_default.NEAREST;
  59140. magnificationFilter = TextureMagnificationFilter_default.NEAREST;
  59141. }
  59142. if (context.webgl2) {
  59143. if (PixelFormat_default.isDepthFormat(pixelFormat)) {
  59144. minificationFilter = TextureMinificationFilter_default.NEAREST;
  59145. magnificationFilter = TextureMagnificationFilter_default.NEAREST;
  59146. }
  59147. }
  59148. const gl = context._gl;
  59149. const target = this._textureTarget;
  59150. gl.activeTexture(gl.TEXTURE0);
  59151. gl.bindTexture(target, this._texture);
  59152. gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, minificationFilter);
  59153. gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, magnificationFilter);
  59154. gl.texParameteri(target, gl.TEXTURE_WRAP_S, sampler.wrapS);
  59155. gl.texParameteri(target, gl.TEXTURE_WRAP_T, sampler.wrapT);
  59156. if (defined_default(this._textureFilterAnisotropic)) {
  59157. gl.texParameteri(
  59158. target,
  59159. this._textureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,
  59160. sampler.maximumAnisotropy
  59161. );
  59162. }
  59163. gl.bindTexture(target, null);
  59164. this._sampler = sampler;
  59165. }
  59166. },
  59167. pixelFormat: {
  59168. get: function() {
  59169. return this._pixelFormat;
  59170. }
  59171. },
  59172. pixelDatatype: {
  59173. get: function() {
  59174. return this._pixelDatatype;
  59175. }
  59176. },
  59177. dimensions: {
  59178. get: function() {
  59179. return this._dimensions;
  59180. }
  59181. },
  59182. preMultiplyAlpha: {
  59183. get: function() {
  59184. return this._preMultiplyAlpha;
  59185. }
  59186. },
  59187. flipY: {
  59188. get: function() {
  59189. return this._flipY;
  59190. }
  59191. },
  59192. width: {
  59193. get: function() {
  59194. return this._width;
  59195. }
  59196. },
  59197. height: {
  59198. get: function() {
  59199. return this._height;
  59200. }
  59201. },
  59202. sizeInBytes: {
  59203. get: function() {
  59204. if (this._hasMipmap) {
  59205. return Math.floor(this._sizeInBytes * 4 / 3);
  59206. }
  59207. return this._sizeInBytes;
  59208. }
  59209. },
  59210. _target: {
  59211. get: function() {
  59212. return this._textureTarget;
  59213. }
  59214. }
  59215. });
  59216. Texture.prototype.copyFrom = function(options) {
  59217. Check_default.defined("options", options);
  59218. const xOffset = defaultValue_default(options.xOffset, 0);
  59219. const yOffset = defaultValue_default(options.yOffset, 0);
  59220. Check_default.defined("options.source", options.source);
  59221. if (PixelFormat_default.isDepthFormat(this._pixelFormat)) {
  59222. throw new DeveloperError_default(
  59223. "Cannot call copyFrom when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL."
  59224. );
  59225. }
  59226. if (PixelFormat_default.isCompressedFormat(this._pixelFormat)) {
  59227. throw new DeveloperError_default(
  59228. "Cannot call copyFrom with a compressed texture pixel format."
  59229. );
  59230. }
  59231. Check_default.typeOf.number.greaterThanOrEquals("xOffset", xOffset, 0);
  59232. Check_default.typeOf.number.greaterThanOrEquals("yOffset", yOffset, 0);
  59233. Check_default.typeOf.number.lessThanOrEquals(
  59234. "xOffset + options.source.width",
  59235. xOffset + options.source.width,
  59236. this._width
  59237. );
  59238. Check_default.typeOf.number.lessThanOrEquals(
  59239. "yOffset + options.source.height",
  59240. yOffset + options.source.height,
  59241. this._height
  59242. );
  59243. const source = options.source;
  59244. const context = this._context;
  59245. const gl = context._gl;
  59246. const target = this._textureTarget;
  59247. gl.activeTexture(gl.TEXTURE0);
  59248. gl.bindTexture(target, this._texture);
  59249. const width = source.width;
  59250. const height = source.height;
  59251. let arrayBufferView = source.arrayBufferView;
  59252. const textureWidth = this._width;
  59253. const textureHeight = this._height;
  59254. const internalFormat = this._internalFormat;
  59255. const pixelFormat = this._pixelFormat;
  59256. const pixelDatatype = this._pixelDatatype;
  59257. const preMultiplyAlpha = this._preMultiplyAlpha;
  59258. const flipY = this._flipY;
  59259. const skipColorSpaceConversion = defaultValue_default(
  59260. options.skipColorSpaceConversion,
  59261. false
  59262. );
  59263. let unpackAlignment = 4;
  59264. if (defined_default(arrayBufferView)) {
  59265. unpackAlignment = PixelFormat_default.alignmentInBytes(
  59266. pixelFormat,
  59267. pixelDatatype,
  59268. width
  59269. );
  59270. }
  59271. gl.pixelStorei(gl.UNPACK_ALIGNMENT, unpackAlignment);
  59272. if (skipColorSpaceConversion) {
  59273. gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE);
  59274. } else {
  59275. gl.pixelStorei(
  59276. gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,
  59277. gl.BROWSER_DEFAULT_WEBGL
  59278. );
  59279. }
  59280. let uploaded = false;
  59281. if (!this._initialized) {
  59282. if (xOffset === 0 && yOffset === 0 && width === textureWidth && height === textureHeight) {
  59283. if (defined_default(arrayBufferView)) {
  59284. gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
  59285. gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
  59286. if (flipY) {
  59287. arrayBufferView = PixelFormat_default.flipY(
  59288. arrayBufferView,
  59289. pixelFormat,
  59290. pixelDatatype,
  59291. textureWidth,
  59292. textureHeight
  59293. );
  59294. }
  59295. gl.texImage2D(
  59296. target,
  59297. 0,
  59298. internalFormat,
  59299. textureWidth,
  59300. textureHeight,
  59301. 0,
  59302. pixelFormat,
  59303. PixelDatatype_default.toWebGLConstant(pixelDatatype, context),
  59304. arrayBufferView
  59305. );
  59306. } else {
  59307. gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, preMultiplyAlpha);
  59308. gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY);
  59309. gl.texImage2D(
  59310. target,
  59311. 0,
  59312. internalFormat,
  59313. pixelFormat,
  59314. PixelDatatype_default.toWebGLConstant(pixelDatatype, context),
  59315. source
  59316. );
  59317. }
  59318. uploaded = true;
  59319. } else {
  59320. gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
  59321. gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
  59322. const bufferView = PixelFormat_default.createTypedArray(
  59323. pixelFormat,
  59324. pixelDatatype,
  59325. textureWidth,
  59326. textureHeight
  59327. );
  59328. gl.texImage2D(
  59329. target,
  59330. 0,
  59331. internalFormat,
  59332. textureWidth,
  59333. textureHeight,
  59334. 0,
  59335. pixelFormat,
  59336. PixelDatatype_default.toWebGLConstant(pixelDatatype, context),
  59337. bufferView
  59338. );
  59339. }
  59340. this._initialized = true;
  59341. }
  59342. if (!uploaded) {
  59343. if (defined_default(arrayBufferView)) {
  59344. gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
  59345. gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
  59346. if (flipY) {
  59347. arrayBufferView = PixelFormat_default.flipY(
  59348. arrayBufferView,
  59349. pixelFormat,
  59350. pixelDatatype,
  59351. width,
  59352. height
  59353. );
  59354. }
  59355. gl.texSubImage2D(
  59356. target,
  59357. 0,
  59358. xOffset,
  59359. yOffset,
  59360. width,
  59361. height,
  59362. pixelFormat,
  59363. PixelDatatype_default.toWebGLConstant(pixelDatatype, context),
  59364. arrayBufferView
  59365. );
  59366. } else {
  59367. gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, preMultiplyAlpha);
  59368. gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY);
  59369. gl.texSubImage2D(
  59370. target,
  59371. 0,
  59372. xOffset,
  59373. yOffset,
  59374. pixelFormat,
  59375. PixelDatatype_default.toWebGLConstant(pixelDatatype, context),
  59376. source
  59377. );
  59378. }
  59379. }
  59380. gl.bindTexture(target, null);
  59381. };
  59382. Texture.prototype.copyFromFramebuffer = function(xOffset, yOffset, framebufferXOffset, framebufferYOffset, width, height) {
  59383. xOffset = defaultValue_default(xOffset, 0);
  59384. yOffset = defaultValue_default(yOffset, 0);
  59385. framebufferXOffset = defaultValue_default(framebufferXOffset, 0);
  59386. framebufferYOffset = defaultValue_default(framebufferYOffset, 0);
  59387. width = defaultValue_default(width, this._width);
  59388. height = defaultValue_default(height, this._height);
  59389. if (PixelFormat_default.isDepthFormat(this._pixelFormat)) {
  59390. throw new DeveloperError_default(
  59391. "Cannot call copyFromFramebuffer when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL."
  59392. );
  59393. }
  59394. if (this._pixelDatatype === PixelDatatype_default.FLOAT) {
  59395. throw new DeveloperError_default(
  59396. "Cannot call copyFromFramebuffer when the texture pixel data type is FLOAT."
  59397. );
  59398. }
  59399. if (this._pixelDatatype === PixelDatatype_default.HALF_FLOAT) {
  59400. throw new DeveloperError_default(
  59401. "Cannot call copyFromFramebuffer when the texture pixel data type is HALF_FLOAT."
  59402. );
  59403. }
  59404. if (PixelFormat_default.isCompressedFormat(this._pixelFormat)) {
  59405. throw new DeveloperError_default(
  59406. "Cannot call copyFrom with a compressed texture pixel format."
  59407. );
  59408. }
  59409. Check_default.typeOf.number.greaterThanOrEquals("xOffset", xOffset, 0);
  59410. Check_default.typeOf.number.greaterThanOrEquals("yOffset", yOffset, 0);
  59411. Check_default.typeOf.number.greaterThanOrEquals(
  59412. "framebufferXOffset",
  59413. framebufferXOffset,
  59414. 0
  59415. );
  59416. Check_default.typeOf.number.greaterThanOrEquals(
  59417. "framebufferYOffset",
  59418. framebufferYOffset,
  59419. 0
  59420. );
  59421. Check_default.typeOf.number.lessThanOrEquals(
  59422. "xOffset + width",
  59423. xOffset + width,
  59424. this._width
  59425. );
  59426. Check_default.typeOf.number.lessThanOrEquals(
  59427. "yOffset + height",
  59428. yOffset + height,
  59429. this._height
  59430. );
  59431. const gl = this._context._gl;
  59432. const target = this._textureTarget;
  59433. gl.activeTexture(gl.TEXTURE0);
  59434. gl.bindTexture(target, this._texture);
  59435. gl.copyTexSubImage2D(
  59436. target,
  59437. 0,
  59438. xOffset,
  59439. yOffset,
  59440. framebufferXOffset,
  59441. framebufferYOffset,
  59442. width,
  59443. height
  59444. );
  59445. gl.bindTexture(target, null);
  59446. this._initialized = true;
  59447. };
  59448. Texture.prototype.generateMipmap = function(hint) {
  59449. hint = defaultValue_default(hint, MipmapHint_default.DONT_CARE);
  59450. if (PixelFormat_default.isDepthFormat(this._pixelFormat)) {
  59451. throw new DeveloperError_default(
  59452. "Cannot call generateMipmap when the texture pixel format is DEPTH_COMPONENT or DEPTH_STENCIL."
  59453. );
  59454. }
  59455. if (PixelFormat_default.isCompressedFormat(this._pixelFormat)) {
  59456. throw new DeveloperError_default(
  59457. "Cannot call generateMipmap with a compressed pixel format."
  59458. );
  59459. }
  59460. if (this._width > 1 && !Math_default.isPowerOfTwo(this._width)) {
  59461. throw new DeveloperError_default(
  59462. "width must be a power of two to call generateMipmap()."
  59463. );
  59464. }
  59465. if (this._height > 1 && !Math_default.isPowerOfTwo(this._height)) {
  59466. throw new DeveloperError_default(
  59467. "height must be a power of two to call generateMipmap()."
  59468. );
  59469. }
  59470. if (!MipmapHint_default.validate(hint)) {
  59471. throw new DeveloperError_default("hint is invalid.");
  59472. }
  59473. this._hasMipmap = true;
  59474. const gl = this._context._gl;
  59475. const target = this._textureTarget;
  59476. gl.hint(gl.GENERATE_MIPMAP_HINT, hint);
  59477. gl.activeTexture(gl.TEXTURE0);
  59478. gl.bindTexture(target, this._texture);
  59479. gl.generateMipmap(target);
  59480. gl.bindTexture(target, null);
  59481. };
  59482. Texture.prototype.isDestroyed = function() {
  59483. return false;
  59484. };
  59485. Texture.prototype.destroy = function() {
  59486. this._context._gl.deleteTexture(this._texture);
  59487. return destroyObject_default(this);
  59488. };
  59489. var Texture_default = Texture;
  59490. // node_modules/cesium/Source/Shaders/Materials/AspectRampMaterial.js
  59491. var AspectRampMaterial_default = "uniform sampler2D image;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec4 rampColor = texture2D(image, vec2(materialInput.aspect / (2.0 * czm_pi), 0.5));\n rampColor = czm_gammaCorrect(rampColor);\n material.diffuse = rampColor.rgb;\n material.alpha = rampColor.a;\n return material;\n}\n";
  59492. // node_modules/cesium/Source/Shaders/Materials/BumpMapMaterial.js
  59493. var BumpMapMaterial_default = "uniform sampler2D image;\nuniform float strength;\nuniform vec2 repeat;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n vec2 st = materialInput.st;\n\n vec2 centerPixel = fract(repeat * st);\n float centerBump = texture2D(image, centerPixel).channel;\n\n float imageWidth = float(imageDimensions.x);\n vec2 rightPixel = fract(repeat * (st + vec2(1.0 / imageWidth, 0.0)));\n float rightBump = texture2D(image, rightPixel).channel;\n\n float imageHeight = float(imageDimensions.y);\n vec2 leftPixel = fract(repeat * (st + vec2(0.0, 1.0 / imageHeight)));\n float topBump = texture2D(image, leftPixel).channel;\n\n vec3 normalTangentSpace = normalize(vec3(centerBump - rightBump, centerBump - topBump, clamp(1.0 - strength, 0.1, 1.0)));\n vec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;\n\n material.normal = normalEC;\n material.diffuse = vec3(0.01);\n\n return material;\n}\n";
  59494. // node_modules/cesium/Source/Shaders/Materials/CheckerboardMaterial.js
  59495. var CheckerboardMaterial_default = "uniform vec4 lightColor;\nuniform vec4 darkColor;\nuniform vec2 repeat;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n vec2 st = materialInput.st;\n\n // From Stefan Gustavson's Procedural Textures in GLSL in OpenGL Insights\n float b = mod(floor(repeat.s * st.s) + floor(repeat.t * st.t), 2.0); // 0.0 or 1.0\n\n // Find the distance from the closest separator (region between two colors)\n float scaledWidth = fract(repeat.s * st.s);\n scaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));\n float scaledHeight = fract(repeat.t * st.t);\n scaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));\n float value = min(scaledWidth, scaledHeight);\n\n vec4 currentColor = mix(lightColor, darkColor, b);\n vec4 color = czm_antialias(lightColor, darkColor, currentColor, value, 0.03);\n\n color = czm_gammaCorrect(color);\n material.diffuse = color.rgb;\n material.alpha = color.a;\n\n return material;\n}\n";
  59496. // node_modules/cesium/Source/Shaders/Materials/DotMaterial.js
  59497. var DotMaterial_default = "uniform vec4 lightColor;\nuniform vec4 darkColor;\nuniform vec2 repeat;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n // From Stefan Gustavson's Procedural Textures in GLSL in OpenGL Insights\n float b = smoothstep(0.3, 0.32, length(fract(repeat * materialInput.st) - 0.5)); // 0.0 or 1.0\n\n vec4 color = mix(lightColor, darkColor, b);\n color = czm_gammaCorrect(color);\n material.diffuse = color.rgb;\n material.alpha = color.a;\n\n return material;\n}\n";
  59498. // node_modules/cesium/Source/Shaders/Materials/ElevationBandMaterial.js
  59499. var ElevationBandMaterial_default = "uniform sampler2D heights;\nuniform sampler2D colors;\n\n// This material expects heights to be sorted from lowest to highest.\n\nfloat getHeight(int idx, float invTexSize)\n{\n vec2 uv = vec2((float(idx) + 0.5) * invTexSize, 0.5);\n#ifdef OES_texture_float\n return texture2D(heights, uv).x;\n#else\n return czm_unpackFloat(texture2D(heights, uv));\n#endif\n}\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n float height = materialInput.height;\n float invTexSize = 1.0 / float(heightsDimensions.x);\n\n float minHeight = getHeight(0, invTexSize);\n float maxHeight = getHeight(heightsDimensions.x - 1, invTexSize);\n\n // early-out when outside the height range\n if (height < minHeight || height > maxHeight) {\n material.diffuse = vec3(0.0);\n material.alpha = 0.0;\n return material;\n }\n\n // Binary search to find heights above and below.\n int idxBelow = 0;\n int idxAbove = heightsDimensions.x;\n float heightBelow = minHeight;\n float heightAbove = maxHeight;\n\n // while loop not allowed, so use for loop with max iterations.\n // maxIterations of 16 supports a texture size up to 65536 (2^16).\n const int maxIterations = 16;\n for (int i = 0; i < maxIterations; i++) {\n if (idxBelow >= idxAbove - 1) {\n break;\n }\n\n int idxMid = (idxBelow + idxAbove) / 2;\n float heightTex = getHeight(idxMid, invTexSize);\n\n if (height > heightTex) {\n idxBelow = idxMid;\n heightBelow = heightTex;\n } else {\n idxAbove = idxMid;\n heightAbove = heightTex;\n }\n }\n\n float lerper = heightBelow == heightAbove ? 1.0 : (height - heightBelow) / (heightAbove - heightBelow);\n vec2 colorUv = vec2(invTexSize * (float(idxBelow) + 0.5 + lerper), 0.5);\n vec4 color = texture2D(colors, colorUv);\n\n // undo preumultiplied alpha\n if (color.a > 0.0) \n {\n color.rgb /= color.a;\n }\n \n color.rgb = czm_gammaCorrect(color.rgb);\n\n material.diffuse = color.rgb;\n material.alpha = color.a;\n return material;\n}\n";
  59500. // node_modules/cesium/Source/Shaders/Materials/ElevationContourMaterial.js
  59501. var ElevationContourMaterial_default = "#ifdef GL_OES_standard_derivatives\n #extension GL_OES_standard_derivatives : enable\n#endif\n\nuniform vec4 color;\nuniform float spacing;\nuniform float width;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n float distanceToContour = mod(materialInput.height, spacing);\n\n#ifdef GL_OES_standard_derivatives\n float dxc = abs(dFdx(materialInput.height));\n float dyc = abs(dFdy(materialInput.height));\n float dF = max(dxc, dyc) * czm_pixelRatio * width;\n float alpha = (distanceToContour < dF) ? 1.0 : 0.0;\n#else\n float alpha = (distanceToContour < (czm_pixelRatio * width)) ? 1.0 : 0.0;\n#endif\n\n vec4 outColor = czm_gammaCorrect(vec4(color.rgb, alpha * color.a));\n material.diffuse = outColor.rgb;\n material.alpha = outColor.a;\n\n return material;\n}\n";
  59502. // node_modules/cesium/Source/Shaders/Materials/ElevationRampMaterial.js
  59503. var ElevationRampMaterial_default = "uniform sampler2D image;\nuniform float minimumHeight;\nuniform float maximumHeight;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n float scaledHeight = clamp((materialInput.height - minimumHeight) / (maximumHeight - minimumHeight), 0.0, 1.0);\n vec4 rampColor = texture2D(image, vec2(scaledHeight, 0.5));\n rampColor = czm_gammaCorrect(rampColor);\n material.diffuse = rampColor.rgb;\n material.alpha = rampColor.a;\n return material;\n}\n";
  59504. // node_modules/cesium/Source/Shaders/Materials/FadeMaterial.js
  59505. var FadeMaterial_default = "uniform vec4 fadeInColor;\nuniform vec4 fadeOutColor;\nuniform float maximumDistance;\nuniform bool repeat;\nuniform vec2 fadeDirection;\nuniform vec2 time;\n\nfloat getTime(float t, float coord)\n{\n float scalar = 1.0 / maximumDistance;\n float q = distance(t, coord) * scalar;\n if (repeat)\n {\n float r = distance(t, coord + 1.0) * scalar;\n float s = distance(t, coord - 1.0) * scalar;\n q = min(min(r, s), q);\n }\n return clamp(q, 0.0, 1.0);\n}\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n vec2 st = materialInput.st;\n float s = getTime(time.x, st.s) * fadeDirection.s;\n float t = getTime(time.y, st.t) * fadeDirection.t;\n\n float u = length(vec2(s, t));\n vec4 color = mix(fadeInColor, fadeOutColor, u);\n\n color = czm_gammaCorrect(color);\n material.emission = color.rgb;\n material.alpha = color.a;\n\n return material;\n}\n";
  59506. // node_modules/cesium/Source/Shaders/Materials/GridMaterial.js
  59507. var GridMaterial_default = '#ifdef GL_OES_standard_derivatives\n #extension GL_OES_standard_derivatives : enable\n#endif\n\nuniform vec4 color;\nuniform float cellAlpha;\nuniform vec2 lineCount;\nuniform vec2 lineThickness;\nuniform vec2 lineOffset;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n vec2 st = materialInput.st;\n\n float scaledWidth = fract(lineCount.s * st.s - lineOffset.s);\n scaledWidth = abs(scaledWidth - floor(scaledWidth + 0.5));\n float scaledHeight = fract(lineCount.t * st.t - lineOffset.t);\n scaledHeight = abs(scaledHeight - floor(scaledHeight + 0.5));\n\n float value;\n#ifdef GL_OES_standard_derivatives\n // Fuzz Factor - Controls blurriness of lines\n const float fuzz = 1.2;\n vec2 thickness = (lineThickness * czm_pixelRatio) - 1.0;\n\n // From "3D Engine Design for Virtual Globes" by Cozzi and Ring, Listing 4.13.\n vec2 dx = abs(dFdx(st));\n vec2 dy = abs(dFdy(st));\n vec2 dF = vec2(max(dx.s, dy.s), max(dx.t, dy.t)) * lineCount;\n value = min(\n smoothstep(dF.s * thickness.s, dF.s * (fuzz + thickness.s), scaledWidth),\n smoothstep(dF.t * thickness.t, dF.t * (fuzz + thickness.t), scaledHeight));\n#else\n // Fuzz Factor - Controls blurriness of lines\n const float fuzz = 0.05;\n\n vec2 range = 0.5 - (lineThickness * 0.05);\n value = min(\n 1.0 - smoothstep(range.s, range.s + fuzz, scaledWidth),\n 1.0 - smoothstep(range.t, range.t + fuzz, scaledHeight));\n#endif\n\n // Edges taken from RimLightingMaterial.glsl\n // See http://www.fundza.com/rman_shaders/surface/fake_rim/fake_rim1.html\n float dRim = 1.0 - abs(dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC)));\n float sRim = smoothstep(0.8, 1.0, dRim);\n value *= (1.0 - sRim);\n\n vec4 halfColor;\n halfColor.rgb = color.rgb * 0.5;\n halfColor.a = color.a * (1.0 - ((1.0 - cellAlpha) * value));\n halfColor = czm_gammaCorrect(halfColor);\n material.diffuse = halfColor.rgb;\n material.emission = halfColor.rgb;\n material.alpha = halfColor.a;\n\n return material;\n}\n';
  59508. // node_modules/cesium/Source/Shaders/Materials/NormalMapMaterial.js
  59509. var NormalMapMaterial_default = "uniform sampler2D image;\nuniform float strength;\nuniform vec2 repeat;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n \n vec4 textureValue = texture2D(image, fract(repeat * materialInput.st));\n vec3 normalTangentSpace = textureValue.channels;\n normalTangentSpace.xy = normalTangentSpace.xy * 2.0 - 1.0;\n normalTangentSpace.z = clamp(1.0 - strength, 0.1, 1.0);\n normalTangentSpace = normalize(normalTangentSpace);\n vec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;\n \n material.normal = normalEC;\n \n return material;\n}\n";
  59510. // node_modules/cesium/Source/Shaders/Materials/PolylineArrowMaterial.js
  59511. var PolylineArrowMaterial_default = "#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\n\nuniform vec4 color;\n\nfloat getPointOnLine(vec2 p0, vec2 p1, float x)\n{\n float slope = (p0.y - p1.y) / (p0.x - p1.x);\n return slope * (x - p0.x) + p0.y;\n}\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n vec2 st = materialInput.st;\n\n#ifdef GL_OES_standard_derivatives\n float base = 1.0 - abs(fwidth(st.s)) * 10.0 * czm_pixelRatio;\n#else\n float base = 0.975; // 2.5% of the line will be the arrow head\n#endif\n\n vec2 center = vec2(1.0, 0.5);\n float ptOnUpperLine = getPointOnLine(vec2(base, 1.0), center, st.s);\n float ptOnLowerLine = getPointOnLine(vec2(base, 0.0), center, st.s);\n\n float halfWidth = 0.15;\n float s = step(0.5 - halfWidth, st.t);\n s *= 1.0 - step(0.5 + halfWidth, st.t);\n s *= 1.0 - step(base, st.s);\n\n float t = step(base, materialInput.st.s);\n t *= 1.0 - step(ptOnUpperLine, st.t);\n t *= step(ptOnLowerLine, st.t);\n\n // Find the distance from the closest separator (region between two colors)\n float dist;\n if (st.s < base)\n {\n float d1 = abs(st.t - (0.5 - halfWidth));\n float d2 = abs(st.t - (0.5 + halfWidth));\n dist = min(d1, d2);\n }\n else\n {\n float d1 = czm_infinity;\n if (st.t < 0.5 - halfWidth && st.t > 0.5 + halfWidth)\n {\n d1 = abs(st.s - base);\n }\n float d2 = abs(st.t - ptOnUpperLine);\n float d3 = abs(st.t - ptOnLowerLine);\n dist = min(min(d1, d2), d3);\n }\n\n vec4 outsideColor = vec4(0.0);\n vec4 currentColor = mix(outsideColor, color, clamp(s + t, 0.0, 1.0));\n vec4 outColor = czm_antialias(outsideColor, color, currentColor, dist);\n\n outColor = czm_gammaCorrect(outColor);\n material.diffuse = outColor.rgb;\n material.alpha = outColor.a;\n return material;\n}\n";
  59512. // node_modules/cesium/Source/Shaders/Materials/PolylineDashMaterial.js
  59513. var PolylineDashMaterial_default = "uniform vec4 color;\nuniform vec4 gapColor;\nuniform float dashLength;\nuniform float dashPattern;\nvarying float v_polylineAngle;\n\nconst float maskLength = 16.0;\n\nmat2 rotate(float rad) {\n float c = cos(rad);\n float s = sin(rad);\n return mat2(\n c, s,\n -s, c\n );\n}\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n vec2 pos = rotate(v_polylineAngle) * gl_FragCoord.xy;\n\n // Get the relative position within the dash from 0 to 1\n float dashPosition = fract(pos.x / (dashLength * czm_pixelRatio));\n // Figure out the mask index.\n float maskIndex = floor(dashPosition * maskLength);\n // Test the bit mask.\n float maskTest = floor(dashPattern / pow(2.0, maskIndex));\n vec4 fragColor = (mod(maskTest, 2.0) < 1.0) ? gapColor : color;\n if (fragColor.a < 0.005) { // matches 0/255 and 1/255\n discard;\n }\n\n fragColor = czm_gammaCorrect(fragColor);\n material.emission = fragColor.rgb;\n material.alpha = fragColor.a;\n return material;\n}\n";
  59514. // node_modules/cesium/Source/Shaders/Materials/PolylineGlowMaterial.js
  59515. var PolylineGlowMaterial_default = "uniform vec4 color;\nuniform float glowPower;\nuniform float taperPower;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n vec2 st = materialInput.st;\n float glow = glowPower / abs(st.t - 0.5) - (glowPower / 0.5);\n\n if (taperPower <= 0.99999) {\n glow *= min(1.0, taperPower / (0.5 - st.s * 0.5) - (taperPower / 0.5));\n }\n\n vec4 fragColor;\n fragColor.rgb = max(vec3(glow - 1.0 + color.rgb), color.rgb);\n fragColor.a = clamp(0.0, 1.0, glow) * color.a;\n fragColor = czm_gammaCorrect(fragColor);\n\n material.emission = fragColor.rgb;\n material.alpha = fragColor.a;\n\n return material;\n}\n";
  59516. // node_modules/cesium/Source/Shaders/Materials/PolylineOutlineMaterial.js
  59517. var PolylineOutlineMaterial_default = "uniform vec4 color;\nuniform vec4 outlineColor;\nuniform float outlineWidth;\n\nvarying float v_width;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n vec2 st = materialInput.st;\n float halfInteriorWidth = 0.5 * (v_width - outlineWidth) / v_width;\n float b = step(0.5 - halfInteriorWidth, st.t);\n b *= 1.0 - step(0.5 + halfInteriorWidth, st.t);\n\n // Find the distance from the closest separator (region between two colors)\n float d1 = abs(st.t - (0.5 - halfInteriorWidth));\n float d2 = abs(st.t - (0.5 + halfInteriorWidth));\n float dist = min(d1, d2);\n\n vec4 currentColor = mix(outlineColor, color, b);\n vec4 outColor = czm_antialias(outlineColor, color, currentColor, dist);\n outColor = czm_gammaCorrect(outColor);\n\n material.diffuse = outColor.rgb;\n material.alpha = outColor.a;\n\n return material;\n}\n";
  59518. // node_modules/cesium/Source/Shaders/Materials/RimLightingMaterial.js
  59519. var RimLightingMaterial_default = "uniform vec4 color;\nuniform vec4 rimColor;\nuniform float width;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n // See http://www.fundza.com/rman_shaders/surface/fake_rim/fake_rim1.html\n float d = 1.0 - dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC));\n float s = smoothstep(1.0 - width, 1.0, d);\n\n vec4 outColor = czm_gammaCorrect(color);\n vec4 outRimColor = czm_gammaCorrect(rimColor);\n\n material.diffuse = outColor.rgb;\n material.emission = outRimColor.rgb * s;\n material.alpha = mix(outColor.a, outRimColor.a, s);\n\n return material;\n}\n";
  59520. // node_modules/cesium/Source/Shaders/Materials/SlopeRampMaterial.js
  59521. var SlopeRampMaterial_default = "uniform sampler2D image;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec4 rampColor = texture2D(image, vec2(materialInput.slope / (czm_pi / 2.0), 0.5));\n rampColor = czm_gammaCorrect(rampColor);\n material.diffuse = rampColor.rgb;\n material.alpha = rampColor.a;\n return material;\n}\n";
  59522. // node_modules/cesium/Source/Shaders/Materials/StripeMaterial.js
  59523. var StripeMaterial_default = "uniform vec4 evenColor;\nuniform vec4 oddColor;\nuniform float offset;\nuniform float repeat;\nuniform bool horizontal;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n // Based on the Stripes Fragment Shader in the Orange Book (11.1.2)\n float coord = mix(materialInput.st.s, materialInput.st.t, float(horizontal));\n float value = fract((coord - offset) * (repeat * 0.5));\n float dist = min(value, min(abs(value - 0.5), 1.0 - value));\n\n vec4 currentColor = mix(evenColor, oddColor, step(0.5, value));\n vec4 color = czm_antialias(evenColor, oddColor, currentColor, dist);\n color = czm_gammaCorrect(color);\n\n material.diffuse = color.rgb;\n material.alpha = color.a;\n\n return material;\n}\n";
  59524. // node_modules/cesium/Source/Shaders/Materials/Water.js
  59525. var Water_default = "// Thanks for the contribution Jonas\n// http://29a.ch/2012/7/19/webgl-terrain-rendering-water-fog\n\nuniform sampler2D specularMap;\nuniform sampler2D normalMap;\nuniform vec4 baseWaterColor;\nuniform vec4 blendColor;\nuniform float frequency;\nuniform float animationSpeed;\nuniform float amplitude;\nuniform float specularIntensity;\nuniform float fadeFactor;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n\n float time = czm_frameNumber * animationSpeed;\n\n // fade is a function of the distance from the fragment and the frequency of the waves\n float fade = max(1.0, (length(materialInput.positionToEyeEC) / 10000000000.0) * frequency * fadeFactor);\n\n float specularMapValue = texture2D(specularMap, materialInput.st).r;\n\n // note: not using directional motion at this time, just set the angle to 0.0;\n vec4 noise = czm_getWaterNoise(normalMap, materialInput.st * frequency, time, 0.0);\n vec3 normalTangentSpace = noise.xyz * vec3(1.0, 1.0, (1.0 / amplitude));\n\n // fade out the normal perturbation as we move further from the water surface\n normalTangentSpace.xy /= fade;\n\n // attempt to fade out the normal perturbation as we approach non water areas (low specular map value)\n normalTangentSpace = mix(vec3(0.0, 0.0, 50.0), normalTangentSpace, specularMapValue);\n\n normalTangentSpace = normalize(normalTangentSpace);\n\n // get ratios for alignment of the new normal vector with a vector perpendicular to the tangent plane\n float tsPerturbationRatio = clamp(dot(normalTangentSpace, vec3(0.0, 0.0, 1.0)), 0.0, 1.0);\n\n // fade out water effect as specular map value decreases\n material.alpha = mix(blendColor.a, baseWaterColor.a, specularMapValue) * specularMapValue;\n\n // base color is a blend of the water and non-water color based on the value from the specular map\n // may need a uniform blend factor to better control this\n material.diffuse = mix(blendColor.rgb, baseWaterColor.rgb, specularMapValue);\n\n // diffuse highlights are based on how perturbed the normal is\n material.diffuse += (0.1 * tsPerturbationRatio);\n\n material.diffuse = material.diffuse;\n\n material.normal = normalize(materialInput.tangentToEyeMatrix * normalTangentSpace);\n\n material.specular = specularIntensity;\n material.shininess = 10.0;\n\n return material;\n}\n";
  59526. // node_modules/cesium/Source/Scene/Material.js
  59527. function Material(options) {
  59528. this.type = void 0;
  59529. this.shaderSource = void 0;
  59530. this.materials = void 0;
  59531. this.uniforms = void 0;
  59532. this._uniforms = void 0;
  59533. this.translucent = void 0;
  59534. this._minificationFilter = defaultValue_default(
  59535. options.minificationFilter,
  59536. TextureMinificationFilter_default.LINEAR
  59537. );
  59538. this._magnificationFilter = defaultValue_default(
  59539. options.magnificationFilter,
  59540. TextureMagnificationFilter_default.LINEAR
  59541. );
  59542. this._strict = void 0;
  59543. this._template = void 0;
  59544. this._count = void 0;
  59545. this._texturePaths = {};
  59546. this._loadedImages = [];
  59547. this._loadedCubeMaps = [];
  59548. this._textures = {};
  59549. this._updateFunctions = [];
  59550. this._defaultTexture = void 0;
  59551. initializeMaterial(options, this);
  59552. Object.defineProperties(this, {
  59553. type: {
  59554. value: this.type,
  59555. writable: false
  59556. }
  59557. });
  59558. if (!defined_default(Material._uniformList[this.type])) {
  59559. Material._uniformList[this.type] = Object.keys(this._uniforms);
  59560. }
  59561. }
  59562. Material._uniformList = {};
  59563. Material.fromType = function(type, uniforms) {
  59564. if (!defined_default(Material._materialCache.getMaterial(type))) {
  59565. throw new DeveloperError_default(`material with type '${type}' does not exist.`);
  59566. }
  59567. const material = new Material({
  59568. fabric: {
  59569. type
  59570. }
  59571. });
  59572. if (defined_default(uniforms)) {
  59573. for (const name in uniforms) {
  59574. if (uniforms.hasOwnProperty(name)) {
  59575. material.uniforms[name] = uniforms[name];
  59576. }
  59577. }
  59578. }
  59579. return material;
  59580. };
  59581. Material.prototype.isTranslucent = function() {
  59582. if (defined_default(this.translucent)) {
  59583. if (typeof this.translucent === "function") {
  59584. return this.translucent();
  59585. }
  59586. return this.translucent;
  59587. }
  59588. let translucent = true;
  59589. const funcs = this._translucentFunctions;
  59590. const length3 = funcs.length;
  59591. for (let i2 = 0; i2 < length3; ++i2) {
  59592. const func = funcs[i2];
  59593. if (typeof func === "function") {
  59594. translucent = translucent && func();
  59595. } else {
  59596. translucent = translucent && func;
  59597. }
  59598. if (!translucent) {
  59599. break;
  59600. }
  59601. }
  59602. return translucent;
  59603. };
  59604. Material.prototype.update = function(context) {
  59605. this._defaultTexture = context.defaultTexture;
  59606. let i2;
  59607. let uniformId;
  59608. const loadedImages = this._loadedImages;
  59609. let length3 = loadedImages.length;
  59610. for (i2 = 0; i2 < length3; ++i2) {
  59611. const loadedImage = loadedImages[i2];
  59612. uniformId = loadedImage.id;
  59613. let image = loadedImage.image;
  59614. let mipLevels;
  59615. if (Array.isArray(image)) {
  59616. mipLevels = image.slice(1, image.length).map(function(mipLevel) {
  59617. return mipLevel.bufferView;
  59618. });
  59619. image = image[0];
  59620. }
  59621. const sampler = new Sampler_default({
  59622. minificationFilter: this._minificationFilter,
  59623. magnificationFilter: this._magnificationFilter
  59624. });
  59625. let texture;
  59626. if (defined_default(image.internalFormat)) {
  59627. texture = new Texture_default({
  59628. context,
  59629. pixelFormat: image.internalFormat,
  59630. width: image.width,
  59631. height: image.height,
  59632. source: {
  59633. arrayBufferView: image.bufferView,
  59634. mipLevels
  59635. },
  59636. sampler
  59637. });
  59638. } else {
  59639. texture = new Texture_default({
  59640. context,
  59641. source: image,
  59642. sampler
  59643. });
  59644. }
  59645. const oldTexture = this._textures[uniformId];
  59646. if (defined_default(oldTexture) && oldTexture !== this._defaultTexture) {
  59647. oldTexture.destroy();
  59648. }
  59649. this._textures[uniformId] = texture;
  59650. const uniformDimensionsName = `${uniformId}Dimensions`;
  59651. if (this.uniforms.hasOwnProperty(uniformDimensionsName)) {
  59652. const uniformDimensions = this.uniforms[uniformDimensionsName];
  59653. uniformDimensions.x = texture._width;
  59654. uniformDimensions.y = texture._height;
  59655. }
  59656. }
  59657. loadedImages.length = 0;
  59658. const loadedCubeMaps = this._loadedCubeMaps;
  59659. length3 = loadedCubeMaps.length;
  59660. for (i2 = 0; i2 < length3; ++i2) {
  59661. const loadedCubeMap = loadedCubeMaps[i2];
  59662. uniformId = loadedCubeMap.id;
  59663. const images = loadedCubeMap.images;
  59664. const cubeMap = new CubeMap_default({
  59665. context,
  59666. source: {
  59667. positiveX: images[0],
  59668. negativeX: images[1],
  59669. positiveY: images[2],
  59670. negativeY: images[3],
  59671. positiveZ: images[4],
  59672. negativeZ: images[5]
  59673. },
  59674. sampler: new Sampler_default({
  59675. minificationFilter: this._minificationFilter,
  59676. magnificationFilter: this._magnificationFilter
  59677. })
  59678. });
  59679. this._textures[uniformId] = cubeMap;
  59680. }
  59681. loadedCubeMaps.length = 0;
  59682. const updateFunctions2 = this._updateFunctions;
  59683. length3 = updateFunctions2.length;
  59684. for (i2 = 0; i2 < length3; ++i2) {
  59685. updateFunctions2[i2](this, context);
  59686. }
  59687. const subMaterials = this.materials;
  59688. for (const name in subMaterials) {
  59689. if (subMaterials.hasOwnProperty(name)) {
  59690. subMaterials[name].update(context);
  59691. }
  59692. }
  59693. };
  59694. Material.prototype.isDestroyed = function() {
  59695. return false;
  59696. };
  59697. Material.prototype.destroy = function() {
  59698. const textures = this._textures;
  59699. for (const texture in textures) {
  59700. if (textures.hasOwnProperty(texture)) {
  59701. const instance = textures[texture];
  59702. if (instance !== this._defaultTexture) {
  59703. instance.destroy();
  59704. }
  59705. }
  59706. }
  59707. const materials = this.materials;
  59708. for (const material in materials) {
  59709. if (materials.hasOwnProperty(material)) {
  59710. materials[material].destroy();
  59711. }
  59712. }
  59713. return destroyObject_default(this);
  59714. };
  59715. function initializeMaterial(options, result) {
  59716. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  59717. result._strict = defaultValue_default(options.strict, false);
  59718. result._count = defaultValue_default(options.count, 0);
  59719. result._template = clone_default(
  59720. defaultValue_default(options.fabric, defaultValue_default.EMPTY_OBJECT)
  59721. );
  59722. result._template.uniforms = clone_default(
  59723. defaultValue_default(result._template.uniforms, defaultValue_default.EMPTY_OBJECT)
  59724. );
  59725. result._template.materials = clone_default(
  59726. defaultValue_default(result._template.materials, defaultValue_default.EMPTY_OBJECT)
  59727. );
  59728. result.type = defined_default(result._template.type) ? result._template.type : createGuid_default();
  59729. result.shaderSource = "";
  59730. result.materials = {};
  59731. result.uniforms = {};
  59732. result._uniforms = {};
  59733. result._translucentFunctions = [];
  59734. let translucent;
  59735. const cachedMaterial = Material._materialCache.getMaterial(result.type);
  59736. if (defined_default(cachedMaterial)) {
  59737. const template = clone_default(cachedMaterial.fabric, true);
  59738. result._template = combine_default(result._template, template, true);
  59739. translucent = cachedMaterial.translucent;
  59740. }
  59741. checkForTemplateErrors(result);
  59742. if (!defined_default(cachedMaterial)) {
  59743. Material._materialCache.addMaterial(result.type, result);
  59744. }
  59745. createMethodDefinition(result);
  59746. createUniforms(result);
  59747. createSubMaterials(result);
  59748. const defaultTranslucent = result._translucentFunctions.length === 0 ? true : void 0;
  59749. translucent = defaultValue_default(translucent, defaultTranslucent);
  59750. translucent = defaultValue_default(options.translucent, translucent);
  59751. if (defined_default(translucent)) {
  59752. if (typeof translucent === "function") {
  59753. const wrappedTranslucent = function() {
  59754. return translucent(result);
  59755. };
  59756. result._translucentFunctions.push(wrappedTranslucent);
  59757. } else {
  59758. result._translucentFunctions.push(translucent);
  59759. }
  59760. }
  59761. }
  59762. function checkForValidProperties(object2, properties, result, throwNotFound) {
  59763. if (defined_default(object2)) {
  59764. for (const property in object2) {
  59765. if (object2.hasOwnProperty(property)) {
  59766. const hasProperty = properties.indexOf(property) !== -1;
  59767. if (throwNotFound && !hasProperty || !throwNotFound && hasProperty) {
  59768. result(property, properties);
  59769. }
  59770. }
  59771. }
  59772. }
  59773. }
  59774. function invalidNameError(property, properties) {
  59775. let errorString = `fabric: property name '${property}' is not valid. It should be `;
  59776. for (let i2 = 0; i2 < properties.length; i2++) {
  59777. const propertyName = `'${properties[i2]}'`;
  59778. errorString += i2 === properties.length - 1 ? `or ${propertyName}.` : `${propertyName}, `;
  59779. }
  59780. throw new DeveloperError_default(errorString);
  59781. }
  59782. function duplicateNameError(property, properties) {
  59783. const errorString = `fabric: uniforms and materials cannot share the same property '${property}'`;
  59784. throw new DeveloperError_default(errorString);
  59785. }
  59786. var templateProperties = [
  59787. "type",
  59788. "materials",
  59789. "uniforms",
  59790. "components",
  59791. "source"
  59792. ];
  59793. var componentProperties = [
  59794. "diffuse",
  59795. "specular",
  59796. "shininess",
  59797. "normal",
  59798. "emission",
  59799. "alpha"
  59800. ];
  59801. function checkForTemplateErrors(material) {
  59802. const template = material._template;
  59803. const uniforms = template.uniforms;
  59804. const materials = template.materials;
  59805. const components = template.components;
  59806. if (defined_default(components) && defined_default(template.source)) {
  59807. throw new DeveloperError_default(
  59808. "fabric: cannot have source and components in the same template."
  59809. );
  59810. }
  59811. checkForValidProperties(template, templateProperties, invalidNameError, true);
  59812. checkForValidProperties(
  59813. components,
  59814. componentProperties,
  59815. invalidNameError,
  59816. true
  59817. );
  59818. const materialNames = [];
  59819. for (const property in materials) {
  59820. if (materials.hasOwnProperty(property)) {
  59821. materialNames.push(property);
  59822. }
  59823. }
  59824. checkForValidProperties(uniforms, materialNames, duplicateNameError, false);
  59825. }
  59826. function isMaterialFused(shaderComponent, material) {
  59827. const materials = material._template.materials;
  59828. for (const subMaterialId in materials) {
  59829. if (materials.hasOwnProperty(subMaterialId)) {
  59830. if (shaderComponent.indexOf(subMaterialId) > -1) {
  59831. return true;
  59832. }
  59833. }
  59834. }
  59835. return false;
  59836. }
  59837. function createMethodDefinition(material) {
  59838. const components = material._template.components;
  59839. const source = material._template.source;
  59840. if (defined_default(source)) {
  59841. material.shaderSource += `${source}
  59842. `;
  59843. } else {
  59844. material.shaderSource += "czm_material czm_getMaterial(czm_materialInput materialInput)\n{\n";
  59845. material.shaderSource += "czm_material material = czm_getDefaultMaterial(materialInput);\n";
  59846. if (defined_default(components)) {
  59847. const isMultiMaterial = Object.keys(material._template.materials).length > 0;
  59848. for (const component in components) {
  59849. if (components.hasOwnProperty(component)) {
  59850. if (component === "diffuse" || component === "emission") {
  59851. const isFusion = isMultiMaterial && isMaterialFused(components[component], material);
  59852. const componentSource = isFusion ? components[component] : `czm_gammaCorrect(${components[component]})`;
  59853. material.shaderSource += `material.${component} = ${componentSource};
  59854. `;
  59855. } else if (component === "alpha") {
  59856. material.shaderSource += `material.alpha = ${components.alpha};
  59857. `;
  59858. } else {
  59859. material.shaderSource += `material.${component} = ${components[component]};
  59860. `;
  59861. }
  59862. }
  59863. }
  59864. }
  59865. material.shaderSource += "return material;\n}\n";
  59866. }
  59867. }
  59868. var matrixMap = {
  59869. mat2: Matrix2_default,
  59870. mat3: Matrix3_default,
  59871. mat4: Matrix4_default
  59872. };
  59873. var ktx2Regex = /\.ktx2$/i;
  59874. function createTexture2DUpdateFunction(uniformId) {
  59875. let oldUniformValue;
  59876. return function(material, context) {
  59877. const uniforms = material.uniforms;
  59878. const uniformValue = uniforms[uniformId];
  59879. const uniformChanged = oldUniformValue !== uniformValue;
  59880. const uniformValueIsDefaultImage = !defined_default(uniformValue) || uniformValue === Material.DefaultImageId;
  59881. oldUniformValue = uniformValue;
  59882. let texture = material._textures[uniformId];
  59883. let uniformDimensionsName;
  59884. let uniformDimensions;
  59885. if (uniformValue instanceof HTMLVideoElement) {
  59886. if (uniformValue.readyState >= 2) {
  59887. if (uniformChanged && defined_default(texture)) {
  59888. if (texture !== context.defaultTexture) {
  59889. texture.destroy();
  59890. }
  59891. texture = void 0;
  59892. }
  59893. if (!defined_default(texture) || texture === context.defaultTexture) {
  59894. const sampler = new Sampler_default({
  59895. minificationFilter: material._minificationFilter,
  59896. magnificationFilter: material._magnificationFilter
  59897. });
  59898. texture = new Texture_default({
  59899. context,
  59900. source: uniformValue,
  59901. sampler
  59902. });
  59903. material._textures[uniformId] = texture;
  59904. return;
  59905. }
  59906. texture.copyFrom({
  59907. source: uniformValue
  59908. });
  59909. } else if (!defined_default(texture)) {
  59910. material._textures[uniformId] = context.defaultTexture;
  59911. }
  59912. return;
  59913. }
  59914. if (uniformValue instanceof Texture_default && uniformValue !== texture) {
  59915. material._texturePaths[uniformId] = void 0;
  59916. const tmp2 = material._textures[uniformId];
  59917. if (defined_default(tmp2) && tmp2 !== material._defaultTexture) {
  59918. tmp2.destroy();
  59919. }
  59920. material._textures[uniformId] = uniformValue;
  59921. uniformDimensionsName = `${uniformId}Dimensions`;
  59922. if (uniforms.hasOwnProperty(uniformDimensionsName)) {
  59923. uniformDimensions = uniforms[uniformDimensionsName];
  59924. uniformDimensions.x = uniformValue._width;
  59925. uniformDimensions.y = uniformValue._height;
  59926. }
  59927. return;
  59928. }
  59929. if (uniformChanged && defined_default(texture) && uniformValueIsDefaultImage) {
  59930. if (texture !== material._defaultTexture) {
  59931. texture.destroy();
  59932. }
  59933. texture = void 0;
  59934. }
  59935. if (!defined_default(texture)) {
  59936. material._texturePaths[uniformId] = void 0;
  59937. texture = material._textures[uniformId] = material._defaultTexture;
  59938. uniformDimensionsName = `${uniformId}Dimensions`;
  59939. if (uniforms.hasOwnProperty(uniformDimensionsName)) {
  59940. uniformDimensions = uniforms[uniformDimensionsName];
  59941. uniformDimensions.x = texture._width;
  59942. uniformDimensions.y = texture._height;
  59943. }
  59944. }
  59945. if (uniformValueIsDefaultImage) {
  59946. return;
  59947. }
  59948. const isResource = uniformValue instanceof Resource_default;
  59949. if (!defined_default(material._texturePaths[uniformId]) || isResource && uniformValue.url !== material._texturePaths[uniformId].url || !isResource && uniformValue !== material._texturePaths[uniformId]) {
  59950. if (typeof uniformValue === "string" || isResource) {
  59951. const resource = isResource ? uniformValue : Resource_default.createIfNeeded(uniformValue);
  59952. let promise;
  59953. if (ktx2Regex.test(resource.url)) {
  59954. promise = loadKTX2_default(resource.url);
  59955. } else {
  59956. promise = resource.fetchImage();
  59957. }
  59958. Promise.resolve(promise).then(function(image) {
  59959. material._loadedImages.push({
  59960. id: uniformId,
  59961. image
  59962. });
  59963. }).catch(function() {
  59964. if (defined_default(texture) && texture !== material._defaultTexture) {
  59965. texture.destroy();
  59966. }
  59967. material._textures[uniformId] = material._defaultTexture;
  59968. });
  59969. } else if (uniformValue instanceof HTMLCanvasElement || uniformValue instanceof HTMLImageElement) {
  59970. material._loadedImages.push({
  59971. id: uniformId,
  59972. image: uniformValue
  59973. });
  59974. }
  59975. material._texturePaths[uniformId] = uniformValue;
  59976. }
  59977. };
  59978. }
  59979. function createCubeMapUpdateFunction(uniformId) {
  59980. return function(material, context) {
  59981. const uniformValue = material.uniforms[uniformId];
  59982. if (uniformValue instanceof CubeMap_default) {
  59983. const tmp2 = material._textures[uniformId];
  59984. if (tmp2 !== material._defaultTexture) {
  59985. tmp2.destroy();
  59986. }
  59987. material._texturePaths[uniformId] = void 0;
  59988. material._textures[uniformId] = uniformValue;
  59989. return;
  59990. }
  59991. if (!defined_default(material._textures[uniformId])) {
  59992. material._texturePaths[uniformId] = void 0;
  59993. material._textures[uniformId] = context.defaultCubeMap;
  59994. }
  59995. if (uniformValue === Material.DefaultCubeMapId) {
  59996. return;
  59997. }
  59998. const path = uniformValue.positiveX + uniformValue.negativeX + uniformValue.positiveY + uniformValue.negativeY + uniformValue.positiveZ + uniformValue.negativeZ;
  59999. if (path !== material._texturePaths[uniformId]) {
  60000. const promises = [
  60001. Resource_default.createIfNeeded(uniformValue.positiveX).fetchImage(),
  60002. Resource_default.createIfNeeded(uniformValue.negativeX).fetchImage(),
  60003. Resource_default.createIfNeeded(uniformValue.positiveY).fetchImage(),
  60004. Resource_default.createIfNeeded(uniformValue.negativeY).fetchImage(),
  60005. Resource_default.createIfNeeded(uniformValue.positiveZ).fetchImage(),
  60006. Resource_default.createIfNeeded(uniformValue.negativeZ).fetchImage()
  60007. ];
  60008. Promise.all(promises).then(function(images) {
  60009. material._loadedCubeMaps.push({
  60010. id: uniformId,
  60011. images
  60012. });
  60013. });
  60014. material._texturePaths[uniformId] = path;
  60015. }
  60016. };
  60017. }
  60018. function createUniforms(material) {
  60019. const uniforms = material._template.uniforms;
  60020. for (const uniformId in uniforms) {
  60021. if (uniforms.hasOwnProperty(uniformId)) {
  60022. createUniform(material, uniformId);
  60023. }
  60024. }
  60025. }
  60026. function createUniform(material, uniformId) {
  60027. const strict = material._strict;
  60028. const materialUniforms = material._template.uniforms;
  60029. const uniformValue = materialUniforms[uniformId];
  60030. const uniformType = getUniformType(uniformValue);
  60031. if (!defined_default(uniformType)) {
  60032. throw new DeveloperError_default(
  60033. `fabric: uniform '${uniformId}' has invalid type.`
  60034. );
  60035. }
  60036. let replacedTokenCount;
  60037. if (uniformType === "channels") {
  60038. replacedTokenCount = replaceToken(material, uniformId, uniformValue, false);
  60039. if (replacedTokenCount === 0 && strict) {
  60040. throw new DeveloperError_default(
  60041. `strict: shader source does not use channels '${uniformId}'.`
  60042. );
  60043. }
  60044. } else {
  60045. if (uniformType === "sampler2D") {
  60046. const imageDimensionsUniformName = `${uniformId}Dimensions`;
  60047. if (getNumberOfTokens(material, imageDimensionsUniformName) > 0) {
  60048. materialUniforms[imageDimensionsUniformName] = {
  60049. type: "ivec3",
  60050. x: 1,
  60051. y: 1
  60052. };
  60053. createUniform(material, imageDimensionsUniformName);
  60054. }
  60055. }
  60056. const uniformDeclarationRegex = new RegExp(
  60057. `uniform\\s+${uniformType}\\s+${uniformId}\\s*;`
  60058. );
  60059. if (!uniformDeclarationRegex.test(material.shaderSource)) {
  60060. const uniformDeclaration = `uniform ${uniformType} ${uniformId};`;
  60061. material.shaderSource = uniformDeclaration + material.shaderSource;
  60062. }
  60063. const newUniformId = `${uniformId}_${material._count++}`;
  60064. replacedTokenCount = replaceToken(material, uniformId, newUniformId);
  60065. if (replacedTokenCount === 1 && strict) {
  60066. throw new DeveloperError_default(
  60067. `strict: shader source does not use uniform '${uniformId}'.`
  60068. );
  60069. }
  60070. material.uniforms[uniformId] = uniformValue;
  60071. if (uniformType === "sampler2D") {
  60072. material._uniforms[newUniformId] = function() {
  60073. return material._textures[uniformId];
  60074. };
  60075. material._updateFunctions.push(createTexture2DUpdateFunction(uniformId));
  60076. } else if (uniformType === "samplerCube") {
  60077. material._uniforms[newUniformId] = function() {
  60078. return material._textures[uniformId];
  60079. };
  60080. material._updateFunctions.push(createCubeMapUpdateFunction(uniformId));
  60081. } else if (uniformType.indexOf("mat") !== -1) {
  60082. const scratchMatrix7 = new matrixMap[uniformType]();
  60083. material._uniforms[newUniformId] = function() {
  60084. return matrixMap[uniformType].fromColumnMajorArray(
  60085. material.uniforms[uniformId],
  60086. scratchMatrix7
  60087. );
  60088. };
  60089. } else {
  60090. material._uniforms[newUniformId] = function() {
  60091. return material.uniforms[uniformId];
  60092. };
  60093. }
  60094. }
  60095. }
  60096. function getUniformType(uniformValue) {
  60097. let uniformType = uniformValue.type;
  60098. if (!defined_default(uniformType)) {
  60099. const type = typeof uniformValue;
  60100. if (type === "number") {
  60101. uniformType = "float";
  60102. } else if (type === "boolean") {
  60103. uniformType = "bool";
  60104. } else if (type === "string" || uniformValue instanceof Resource_default || uniformValue instanceof HTMLCanvasElement || uniformValue instanceof HTMLImageElement) {
  60105. if (/^([rgba]){1,4}$/i.test(uniformValue)) {
  60106. uniformType = "channels";
  60107. } else if (uniformValue === Material.DefaultCubeMapId) {
  60108. uniformType = "samplerCube";
  60109. } else {
  60110. uniformType = "sampler2D";
  60111. }
  60112. } else if (type === "object") {
  60113. if (Array.isArray(uniformValue)) {
  60114. if (uniformValue.length === 4 || uniformValue.length === 9 || uniformValue.length === 16) {
  60115. uniformType = `mat${Math.sqrt(uniformValue.length)}`;
  60116. }
  60117. } else {
  60118. let numAttributes = 0;
  60119. for (const attribute in uniformValue) {
  60120. if (uniformValue.hasOwnProperty(attribute)) {
  60121. numAttributes += 1;
  60122. }
  60123. }
  60124. if (numAttributes >= 2 && numAttributes <= 4) {
  60125. uniformType = `vec${numAttributes}`;
  60126. } else if (numAttributes === 6) {
  60127. uniformType = "samplerCube";
  60128. }
  60129. }
  60130. }
  60131. }
  60132. return uniformType;
  60133. }
  60134. function createSubMaterials(material) {
  60135. const strict = material._strict;
  60136. const subMaterialTemplates = material._template.materials;
  60137. for (const subMaterialId in subMaterialTemplates) {
  60138. if (subMaterialTemplates.hasOwnProperty(subMaterialId)) {
  60139. const subMaterial = new Material({
  60140. strict,
  60141. fabric: subMaterialTemplates[subMaterialId],
  60142. count: material._count
  60143. });
  60144. material._count = subMaterial._count;
  60145. material._uniforms = combine_default(
  60146. material._uniforms,
  60147. subMaterial._uniforms,
  60148. true
  60149. );
  60150. material.materials[subMaterialId] = subMaterial;
  60151. material._translucentFunctions = material._translucentFunctions.concat(
  60152. subMaterial._translucentFunctions
  60153. );
  60154. const originalMethodName = "czm_getMaterial";
  60155. const newMethodName = `${originalMethodName}_${material._count++}`;
  60156. replaceToken(subMaterial, originalMethodName, newMethodName);
  60157. material.shaderSource = subMaterial.shaderSource + material.shaderSource;
  60158. const materialMethodCall = `${newMethodName}(materialInput)`;
  60159. const tokensReplacedCount = replaceToken(
  60160. material,
  60161. subMaterialId,
  60162. materialMethodCall
  60163. );
  60164. if (tokensReplacedCount === 0 && strict) {
  60165. throw new DeveloperError_default(
  60166. `strict: shader source does not use material '${subMaterialId}'.`
  60167. );
  60168. }
  60169. }
  60170. }
  60171. }
  60172. function replaceToken(material, token, newToken, excludePeriod) {
  60173. excludePeriod = defaultValue_default(excludePeriod, true);
  60174. let count = 0;
  60175. const suffixChars = "([\\w])?";
  60176. const prefixChars = `([\\w${excludePeriod ? "." : ""}])?`;
  60177. const regExp = new RegExp(prefixChars + token + suffixChars, "g");
  60178. material.shaderSource = material.shaderSource.replace(regExp, function($0, $1, $2) {
  60179. if ($1 || $2) {
  60180. return $0;
  60181. }
  60182. count += 1;
  60183. return newToken;
  60184. });
  60185. return count;
  60186. }
  60187. function getNumberOfTokens(material, token, excludePeriod) {
  60188. return replaceToken(material, token, token, excludePeriod);
  60189. }
  60190. Material._materialCache = {
  60191. _materials: {},
  60192. addMaterial: function(type, materialTemplate) {
  60193. this._materials[type] = materialTemplate;
  60194. },
  60195. getMaterial: function(type) {
  60196. return this._materials[type];
  60197. }
  60198. };
  60199. Material.DefaultImageId = "czm_defaultImage";
  60200. Material.DefaultCubeMapId = "czm_defaultCubeMap";
  60201. Material.ColorType = "Color";
  60202. Material._materialCache.addMaterial(Material.ColorType, {
  60203. fabric: {
  60204. type: Material.ColorType,
  60205. uniforms: {
  60206. color: new Color_default(1, 0, 0, 0.5)
  60207. },
  60208. components: {
  60209. diffuse: "color.rgb",
  60210. alpha: "color.a"
  60211. }
  60212. },
  60213. translucent: function(material) {
  60214. return material.uniforms.color.alpha < 1;
  60215. }
  60216. });
  60217. Material.ImageType = "Image";
  60218. Material._materialCache.addMaterial(Material.ImageType, {
  60219. fabric: {
  60220. type: Material.ImageType,
  60221. uniforms: {
  60222. image: Material.DefaultImageId,
  60223. repeat: new Cartesian2_default(1, 1),
  60224. color: new Color_default(1, 1, 1, 1)
  60225. },
  60226. components: {
  60227. diffuse: "texture2D(image, fract(repeat * materialInput.st)).rgb * color.rgb",
  60228. alpha: "texture2D(image, fract(repeat * materialInput.st)).a * color.a"
  60229. }
  60230. },
  60231. translucent: function(material) {
  60232. return material.uniforms.color.alpha < 1;
  60233. }
  60234. });
  60235. Material.DiffuseMapType = "DiffuseMap";
  60236. Material._materialCache.addMaterial(Material.DiffuseMapType, {
  60237. fabric: {
  60238. type: Material.DiffuseMapType,
  60239. uniforms: {
  60240. image: Material.DefaultImageId,
  60241. channels: "rgb",
  60242. repeat: new Cartesian2_default(1, 1)
  60243. },
  60244. components: {
  60245. diffuse: "texture2D(image, fract(repeat * materialInput.st)).channels"
  60246. }
  60247. },
  60248. translucent: false
  60249. });
  60250. Material.AlphaMapType = "AlphaMap";
  60251. Material._materialCache.addMaterial(Material.AlphaMapType, {
  60252. fabric: {
  60253. type: Material.AlphaMapType,
  60254. uniforms: {
  60255. image: Material.DefaultImageId,
  60256. channel: "a",
  60257. repeat: new Cartesian2_default(1, 1)
  60258. },
  60259. components: {
  60260. alpha: "texture2D(image, fract(repeat * materialInput.st)).channel"
  60261. }
  60262. },
  60263. translucent: true
  60264. });
  60265. Material.SpecularMapType = "SpecularMap";
  60266. Material._materialCache.addMaterial(Material.SpecularMapType, {
  60267. fabric: {
  60268. type: Material.SpecularMapType,
  60269. uniforms: {
  60270. image: Material.DefaultImageId,
  60271. channel: "r",
  60272. repeat: new Cartesian2_default(1, 1)
  60273. },
  60274. components: {
  60275. specular: "texture2D(image, fract(repeat * materialInput.st)).channel"
  60276. }
  60277. },
  60278. translucent: false
  60279. });
  60280. Material.EmissionMapType = "EmissionMap";
  60281. Material._materialCache.addMaterial(Material.EmissionMapType, {
  60282. fabric: {
  60283. type: Material.EmissionMapType,
  60284. uniforms: {
  60285. image: Material.DefaultImageId,
  60286. channels: "rgb",
  60287. repeat: new Cartesian2_default(1, 1)
  60288. },
  60289. components: {
  60290. emission: "texture2D(image, fract(repeat * materialInput.st)).channels"
  60291. }
  60292. },
  60293. translucent: false
  60294. });
  60295. Material.BumpMapType = "BumpMap";
  60296. Material._materialCache.addMaterial(Material.BumpMapType, {
  60297. fabric: {
  60298. type: Material.BumpMapType,
  60299. uniforms: {
  60300. image: Material.DefaultImageId,
  60301. channel: "r",
  60302. strength: 0.8,
  60303. repeat: new Cartesian2_default(1, 1)
  60304. },
  60305. source: BumpMapMaterial_default
  60306. },
  60307. translucent: false
  60308. });
  60309. Material.NormalMapType = "NormalMap";
  60310. Material._materialCache.addMaterial(Material.NormalMapType, {
  60311. fabric: {
  60312. type: Material.NormalMapType,
  60313. uniforms: {
  60314. image: Material.DefaultImageId,
  60315. channels: "rgb",
  60316. strength: 0.8,
  60317. repeat: new Cartesian2_default(1, 1)
  60318. },
  60319. source: NormalMapMaterial_default
  60320. },
  60321. translucent: false
  60322. });
  60323. Material.GridType = "Grid";
  60324. Material._materialCache.addMaterial(Material.GridType, {
  60325. fabric: {
  60326. type: Material.GridType,
  60327. uniforms: {
  60328. color: new Color_default(0, 1, 0, 1),
  60329. cellAlpha: 0.1,
  60330. lineCount: new Cartesian2_default(8, 8),
  60331. lineThickness: new Cartesian2_default(1, 1),
  60332. lineOffset: new Cartesian2_default(0, 0)
  60333. },
  60334. source: GridMaterial_default
  60335. },
  60336. translucent: function(material) {
  60337. const uniforms = material.uniforms;
  60338. return uniforms.color.alpha < 1 || uniforms.cellAlpha < 1;
  60339. }
  60340. });
  60341. Material.StripeType = "Stripe";
  60342. Material._materialCache.addMaterial(Material.StripeType, {
  60343. fabric: {
  60344. type: Material.StripeType,
  60345. uniforms: {
  60346. horizontal: true,
  60347. evenColor: new Color_default(1, 1, 1, 0.5),
  60348. oddColor: new Color_default(0, 0, 1, 0.5),
  60349. offset: 0,
  60350. repeat: 5
  60351. },
  60352. source: StripeMaterial_default
  60353. },
  60354. translucent: function(material) {
  60355. const uniforms = material.uniforms;
  60356. return uniforms.evenColor.alpha < 1 || uniforms.oddColor.alpha < 1;
  60357. }
  60358. });
  60359. Material.CheckerboardType = "Checkerboard";
  60360. Material._materialCache.addMaterial(Material.CheckerboardType, {
  60361. fabric: {
  60362. type: Material.CheckerboardType,
  60363. uniforms: {
  60364. lightColor: new Color_default(1, 1, 1, 0.5),
  60365. darkColor: new Color_default(0, 0, 0, 0.5),
  60366. repeat: new Cartesian2_default(5, 5)
  60367. },
  60368. source: CheckerboardMaterial_default
  60369. },
  60370. translucent: function(material) {
  60371. const uniforms = material.uniforms;
  60372. return uniforms.lightColor.alpha < 1 || uniforms.darkColor.alpha < 1;
  60373. }
  60374. });
  60375. Material.DotType = "Dot";
  60376. Material._materialCache.addMaterial(Material.DotType, {
  60377. fabric: {
  60378. type: Material.DotType,
  60379. uniforms: {
  60380. lightColor: new Color_default(1, 1, 0, 0.75),
  60381. darkColor: new Color_default(0, 1, 1, 0.75),
  60382. repeat: new Cartesian2_default(5, 5)
  60383. },
  60384. source: DotMaterial_default
  60385. },
  60386. translucent: function(material) {
  60387. const uniforms = material.uniforms;
  60388. return uniforms.lightColor.alpha < 1 || uniforms.darkColor.alpha < 1;
  60389. }
  60390. });
  60391. Material.WaterType = "Water";
  60392. Material._materialCache.addMaterial(Material.WaterType, {
  60393. fabric: {
  60394. type: Material.WaterType,
  60395. uniforms: {
  60396. baseWaterColor: new Color_default(0.2, 0.3, 0.6, 1),
  60397. blendColor: new Color_default(0, 1, 0.699, 1),
  60398. specularMap: Material.DefaultImageId,
  60399. normalMap: Material.DefaultImageId,
  60400. frequency: 10,
  60401. animationSpeed: 0.01,
  60402. amplitude: 1,
  60403. specularIntensity: 0.5,
  60404. fadeFactor: 1
  60405. },
  60406. source: Water_default
  60407. },
  60408. translucent: function(material) {
  60409. const uniforms = material.uniforms;
  60410. return uniforms.baseWaterColor.alpha < 1 || uniforms.blendColor.alpha < 1;
  60411. }
  60412. });
  60413. Material.RimLightingType = "RimLighting";
  60414. Material._materialCache.addMaterial(Material.RimLightingType, {
  60415. fabric: {
  60416. type: Material.RimLightingType,
  60417. uniforms: {
  60418. color: new Color_default(1, 0, 0, 0.7),
  60419. rimColor: new Color_default(1, 1, 1, 0.4),
  60420. width: 0.3
  60421. },
  60422. source: RimLightingMaterial_default
  60423. },
  60424. translucent: function(material) {
  60425. const uniforms = material.uniforms;
  60426. return uniforms.color.alpha < 1 || uniforms.rimColor.alpha < 1;
  60427. }
  60428. });
  60429. Material.FadeType = "Fade";
  60430. Material._materialCache.addMaterial(Material.FadeType, {
  60431. fabric: {
  60432. type: Material.FadeType,
  60433. uniforms: {
  60434. fadeInColor: new Color_default(1, 0, 0, 1),
  60435. fadeOutColor: new Color_default(0, 0, 0, 0),
  60436. maximumDistance: 0.5,
  60437. repeat: true,
  60438. fadeDirection: {
  60439. x: true,
  60440. y: true
  60441. },
  60442. time: new Cartesian2_default(0.5, 0.5)
  60443. },
  60444. source: FadeMaterial_default
  60445. },
  60446. translucent: function(material) {
  60447. const uniforms = material.uniforms;
  60448. return uniforms.fadeInColor.alpha < 1 || uniforms.fadeOutColor.alpha < 1;
  60449. }
  60450. });
  60451. Material.PolylineArrowType = "PolylineArrow";
  60452. Material._materialCache.addMaterial(Material.PolylineArrowType, {
  60453. fabric: {
  60454. type: Material.PolylineArrowType,
  60455. uniforms: {
  60456. color: new Color_default(1, 1, 1, 1)
  60457. },
  60458. source: PolylineArrowMaterial_default
  60459. },
  60460. translucent: true
  60461. });
  60462. Material.PolylineDashType = "PolylineDash";
  60463. Material._materialCache.addMaterial(Material.PolylineDashType, {
  60464. fabric: {
  60465. type: Material.PolylineDashType,
  60466. uniforms: {
  60467. color: new Color_default(1, 0, 1, 1),
  60468. gapColor: new Color_default(0, 0, 0, 0),
  60469. dashLength: 16,
  60470. dashPattern: 255
  60471. },
  60472. source: PolylineDashMaterial_default
  60473. },
  60474. translucent: true
  60475. });
  60476. Material.PolylineGlowType = "PolylineGlow";
  60477. Material._materialCache.addMaterial(Material.PolylineGlowType, {
  60478. fabric: {
  60479. type: Material.PolylineGlowType,
  60480. uniforms: {
  60481. color: new Color_default(0, 0.5, 1, 1),
  60482. glowPower: 0.25,
  60483. taperPower: 1
  60484. },
  60485. source: PolylineGlowMaterial_default
  60486. },
  60487. translucent: true
  60488. });
  60489. Material.PolylineOutlineType = "PolylineOutline";
  60490. Material._materialCache.addMaterial(Material.PolylineOutlineType, {
  60491. fabric: {
  60492. type: Material.PolylineOutlineType,
  60493. uniforms: {
  60494. color: new Color_default(1, 1, 1, 1),
  60495. outlineColor: new Color_default(1, 0, 0, 1),
  60496. outlineWidth: 1
  60497. },
  60498. source: PolylineOutlineMaterial_default
  60499. },
  60500. translucent: function(material) {
  60501. const uniforms = material.uniforms;
  60502. return uniforms.color.alpha < 1 || uniforms.outlineColor.alpha < 1;
  60503. }
  60504. });
  60505. Material.ElevationContourType = "ElevationContour";
  60506. Material._materialCache.addMaterial(Material.ElevationContourType, {
  60507. fabric: {
  60508. type: Material.ElevationContourType,
  60509. uniforms: {
  60510. spacing: 100,
  60511. color: new Color_default(1, 0, 0, 1),
  60512. width: 1
  60513. },
  60514. source: ElevationContourMaterial_default
  60515. },
  60516. translucent: false
  60517. });
  60518. Material.ElevationRampType = "ElevationRamp";
  60519. Material._materialCache.addMaterial(Material.ElevationRampType, {
  60520. fabric: {
  60521. type: Material.ElevationRampType,
  60522. uniforms: {
  60523. image: Material.DefaultImageId,
  60524. minimumHeight: 0,
  60525. maximumHeight: 1e4
  60526. },
  60527. source: ElevationRampMaterial_default
  60528. },
  60529. translucent: false
  60530. });
  60531. Material.SlopeRampMaterialType = "SlopeRamp";
  60532. Material._materialCache.addMaterial(Material.SlopeRampMaterialType, {
  60533. fabric: {
  60534. type: Material.SlopeRampMaterialType,
  60535. uniforms: {
  60536. image: Material.DefaultImageId
  60537. },
  60538. source: SlopeRampMaterial_default
  60539. },
  60540. translucent: false
  60541. });
  60542. Material.AspectRampMaterialType = "AspectRamp";
  60543. Material._materialCache.addMaterial(Material.AspectRampMaterialType, {
  60544. fabric: {
  60545. type: Material.AspectRampMaterialType,
  60546. uniforms: {
  60547. image: Material.DefaultImageId
  60548. },
  60549. source: AspectRampMaterial_default
  60550. },
  60551. translucent: false
  60552. });
  60553. Material.ElevationBandType = "ElevationBand";
  60554. Material._materialCache.addMaterial(Material.ElevationBandType, {
  60555. fabric: {
  60556. type: Material.ElevationBandType,
  60557. uniforms: {
  60558. heights: Material.DefaultImageId,
  60559. colors: Material.DefaultImageId
  60560. },
  60561. source: ElevationBandMaterial_default
  60562. },
  60563. translucent: true
  60564. });
  60565. var Material_default = Material;
  60566. // node_modules/cesium/Source/Scene/MaterialAppearance.js
  60567. function MaterialAppearance(options) {
  60568. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  60569. const translucent = defaultValue_default(options.translucent, true);
  60570. const closed = defaultValue_default(options.closed, false);
  60571. const materialSupport = defaultValue_default(
  60572. options.materialSupport,
  60573. MaterialAppearance.MaterialSupport.TEXTURED
  60574. );
  60575. this.material = defined_default(options.material) ? options.material : Material_default.fromType(Material_default.ColorType);
  60576. this.translucent = translucent;
  60577. this._vertexShaderSource = defaultValue_default(
  60578. options.vertexShaderSource,
  60579. materialSupport.vertexShaderSource
  60580. );
  60581. this._fragmentShaderSource = defaultValue_default(
  60582. options.fragmentShaderSource,
  60583. materialSupport.fragmentShaderSource
  60584. );
  60585. this._renderState = Appearance_default.getDefaultRenderState(
  60586. translucent,
  60587. closed,
  60588. options.renderState
  60589. );
  60590. this._closed = closed;
  60591. this._materialSupport = materialSupport;
  60592. this._vertexFormat = materialSupport.vertexFormat;
  60593. this._flat = defaultValue_default(options.flat, false);
  60594. this._faceForward = defaultValue_default(options.faceForward, !closed);
  60595. }
  60596. Object.defineProperties(MaterialAppearance.prototype, {
  60597. vertexShaderSource: {
  60598. get: function() {
  60599. return this._vertexShaderSource;
  60600. }
  60601. },
  60602. fragmentShaderSource: {
  60603. get: function() {
  60604. return this._fragmentShaderSource;
  60605. }
  60606. },
  60607. renderState: {
  60608. get: function() {
  60609. return this._renderState;
  60610. }
  60611. },
  60612. closed: {
  60613. get: function() {
  60614. return this._closed;
  60615. }
  60616. },
  60617. materialSupport: {
  60618. get: function() {
  60619. return this._materialSupport;
  60620. }
  60621. },
  60622. vertexFormat: {
  60623. get: function() {
  60624. return this._vertexFormat;
  60625. }
  60626. },
  60627. flat: {
  60628. get: function() {
  60629. return this._flat;
  60630. }
  60631. },
  60632. faceForward: {
  60633. get: function() {
  60634. return this._faceForward;
  60635. }
  60636. }
  60637. });
  60638. MaterialAppearance.prototype.getFragmentShaderSource = Appearance_default.prototype.getFragmentShaderSource;
  60639. MaterialAppearance.prototype.isTranslucent = Appearance_default.prototype.isTranslucent;
  60640. MaterialAppearance.prototype.getRenderState = Appearance_default.prototype.getRenderState;
  60641. MaterialAppearance.MaterialSupport = {
  60642. BASIC: Object.freeze({
  60643. vertexFormat: VertexFormat_default.POSITION_AND_NORMAL,
  60644. vertexShaderSource: BasicMaterialAppearanceVS_default,
  60645. fragmentShaderSource: BasicMaterialAppearanceFS_default
  60646. }),
  60647. TEXTURED: Object.freeze({
  60648. vertexFormat: VertexFormat_default.POSITION_NORMAL_AND_ST,
  60649. vertexShaderSource: TexturedMaterialAppearanceVS_default,
  60650. fragmentShaderSource: TexturedMaterialAppearanceFS_default
  60651. }),
  60652. ALL: Object.freeze({
  60653. vertexFormat: VertexFormat_default.ALL,
  60654. vertexShaderSource: AllMaterialAppearanceVS_default,
  60655. fragmentShaderSource: AllMaterialAppearanceFS_default
  60656. })
  60657. };
  60658. var MaterialAppearance_default = MaterialAppearance;
  60659. // node_modules/cesium/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.js
  60660. var PerInstanceColorAppearanceFS_default = "varying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec4 v_color;\n\nvoid main()\n{\n vec3 positionToEyeEC = -v_positionEC;\n\n vec3 normalEC = normalize(v_normalEC);\n#ifdef FACE_FORWARD\n normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\n\n vec4 color = czm_gammaCorrect(v_color);\n\n czm_materialInput materialInput;\n materialInput.normalEC = normalEC;\n materialInput.positionToEyeEC = positionToEyeEC;\n czm_material material = czm_getDefaultMaterial(materialInput);\n material.diffuse = color.rgb;\n material.alpha = color.a;\n\n gl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n}\n";
  60661. // node_modules/cesium/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.js
  60662. var PerInstanceColorAppearanceVS_default = "attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 normal;\nattribute vec4 color;\nattribute float batchId;\n\nvarying vec3 v_positionEC;\nvarying vec3 v_normalEC;\nvarying vec4 v_color;\n\nvoid main()\n{\n vec4 p = czm_computePosition();\n\n v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates\n v_normalEC = czm_normal * normal; // normal in eye coordinates\n v_color = color;\n\n gl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n";
  60663. // node_modules/cesium/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.js
  60664. var PerInstanceFlatColorAppearanceFS_default = "varying vec4 v_color;\n\nvoid main()\n{\n gl_FragColor = czm_gammaCorrect(v_color);\n}\n";
  60665. // node_modules/cesium/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.js
  60666. var PerInstanceFlatColorAppearanceVS_default = "attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec4 color;\nattribute float batchId;\n\nvarying vec4 v_color;\n\nvoid main()\n{\n vec4 p = czm_computePosition();\n\n v_color = color;\n\n gl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n";
  60667. // node_modules/cesium/Source/Scene/PerInstanceColorAppearance.js
  60668. function PerInstanceColorAppearance(options) {
  60669. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  60670. const translucent = defaultValue_default(options.translucent, true);
  60671. const closed = defaultValue_default(options.closed, false);
  60672. const flat = defaultValue_default(options.flat, false);
  60673. const vs = flat ? PerInstanceFlatColorAppearanceVS_default : PerInstanceColorAppearanceVS_default;
  60674. const fs = flat ? PerInstanceFlatColorAppearanceFS_default : PerInstanceColorAppearanceFS_default;
  60675. const vertexFormat = flat ? PerInstanceColorAppearance.FLAT_VERTEX_FORMAT : PerInstanceColorAppearance.VERTEX_FORMAT;
  60676. this.material = void 0;
  60677. this.translucent = translucent;
  60678. this._vertexShaderSource = defaultValue_default(options.vertexShaderSource, vs);
  60679. this._fragmentShaderSource = defaultValue_default(options.fragmentShaderSource, fs);
  60680. this._renderState = Appearance_default.getDefaultRenderState(
  60681. translucent,
  60682. closed,
  60683. options.renderState
  60684. );
  60685. this._closed = closed;
  60686. this._vertexFormat = vertexFormat;
  60687. this._flat = flat;
  60688. this._faceForward = defaultValue_default(options.faceForward, !closed);
  60689. }
  60690. Object.defineProperties(PerInstanceColorAppearance.prototype, {
  60691. vertexShaderSource: {
  60692. get: function() {
  60693. return this._vertexShaderSource;
  60694. }
  60695. },
  60696. fragmentShaderSource: {
  60697. get: function() {
  60698. return this._fragmentShaderSource;
  60699. }
  60700. },
  60701. renderState: {
  60702. get: function() {
  60703. return this._renderState;
  60704. }
  60705. },
  60706. closed: {
  60707. get: function() {
  60708. return this._closed;
  60709. }
  60710. },
  60711. vertexFormat: {
  60712. get: function() {
  60713. return this._vertexFormat;
  60714. }
  60715. },
  60716. flat: {
  60717. get: function() {
  60718. return this._flat;
  60719. }
  60720. },
  60721. faceForward: {
  60722. get: function() {
  60723. return this._faceForward;
  60724. }
  60725. }
  60726. });
  60727. PerInstanceColorAppearance.VERTEX_FORMAT = VertexFormat_default.POSITION_AND_NORMAL;
  60728. PerInstanceColorAppearance.FLAT_VERTEX_FORMAT = VertexFormat_default.POSITION_ONLY;
  60729. PerInstanceColorAppearance.prototype.getFragmentShaderSource = Appearance_default.prototype.getFragmentShaderSource;
  60730. PerInstanceColorAppearance.prototype.isTranslucent = Appearance_default.prototype.isTranslucent;
  60731. PerInstanceColorAppearance.prototype.getRenderState = Appearance_default.prototype.getRenderState;
  60732. var PerInstanceColorAppearance_default = PerInstanceColorAppearance;
  60733. // node_modules/cesium/Source/DataSources/ColorMaterialProperty.js
  60734. function ColorMaterialProperty(color) {
  60735. this._definitionChanged = new Event_default();
  60736. this._color = void 0;
  60737. this._colorSubscription = void 0;
  60738. this.color = color;
  60739. }
  60740. Object.defineProperties(ColorMaterialProperty.prototype, {
  60741. isConstant: {
  60742. get: function() {
  60743. return Property_default.isConstant(this._color);
  60744. }
  60745. },
  60746. definitionChanged: {
  60747. get: function() {
  60748. return this._definitionChanged;
  60749. }
  60750. },
  60751. color: createPropertyDescriptor_default("color")
  60752. });
  60753. ColorMaterialProperty.prototype.getType = function(time) {
  60754. return "Color";
  60755. };
  60756. ColorMaterialProperty.prototype.getValue = function(time, result) {
  60757. if (!defined_default(result)) {
  60758. result = {};
  60759. }
  60760. result.color = Property_default.getValueOrClonedDefault(
  60761. this._color,
  60762. time,
  60763. Color_default.WHITE,
  60764. result.color
  60765. );
  60766. return result;
  60767. };
  60768. ColorMaterialProperty.prototype.equals = function(other) {
  60769. return this === other || other instanceof ColorMaterialProperty && Property_default.equals(this._color, other._color);
  60770. };
  60771. var ColorMaterialProperty_default = ColorMaterialProperty;
  60772. // node_modules/cesium/Source/Renderer/DrawCommand.js
  60773. var Flags = {
  60774. CULL: 1,
  60775. OCCLUDE: 2,
  60776. EXECUTE_IN_CLOSEST_FRUSTUM: 4,
  60777. DEBUG_SHOW_BOUNDING_VOLUME: 8,
  60778. CAST_SHADOWS: 16,
  60779. RECEIVE_SHADOWS: 32,
  60780. PICK_ONLY: 64,
  60781. DEPTH_FOR_TRANSLUCENT_CLASSIFICATION: 128
  60782. };
  60783. function DrawCommand(options) {
  60784. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  60785. this._boundingVolume = options.boundingVolume;
  60786. this._orientedBoundingBox = options.orientedBoundingBox;
  60787. this._modelMatrix = options.modelMatrix;
  60788. this._primitiveType = defaultValue_default(
  60789. options.primitiveType,
  60790. PrimitiveType_default.TRIANGLES
  60791. );
  60792. this._vertexArray = options.vertexArray;
  60793. this._count = options.count;
  60794. this._offset = defaultValue_default(options.offset, 0);
  60795. this._instanceCount = defaultValue_default(options.instanceCount, 0);
  60796. this._shaderProgram = options.shaderProgram;
  60797. this._uniformMap = options.uniformMap;
  60798. this._renderState = options.renderState;
  60799. this._framebuffer = options.framebuffer;
  60800. this._pass = options.pass;
  60801. this._owner = options.owner;
  60802. this._debugOverlappingFrustums = 0;
  60803. this._pickId = options.pickId;
  60804. this._flags = 0;
  60805. this.cull = defaultValue_default(options.cull, true);
  60806. this.occlude = defaultValue_default(options.occlude, true);
  60807. this.executeInClosestFrustum = defaultValue_default(
  60808. options.executeInClosestFrustum,
  60809. false
  60810. );
  60811. this.debugShowBoundingVolume = defaultValue_default(
  60812. options.debugShowBoundingVolume,
  60813. false
  60814. );
  60815. this.castShadows = defaultValue_default(options.castShadows, false);
  60816. this.receiveShadows = defaultValue_default(options.receiveShadows, false);
  60817. this.pickOnly = defaultValue_default(options.pickOnly, false);
  60818. this.depthForTranslucentClassification = defaultValue_default(
  60819. options.depthForTranslucentClassification,
  60820. false
  60821. );
  60822. this.dirty = true;
  60823. this.lastDirtyTime = 0;
  60824. this.derivedCommands = {};
  60825. }
  60826. function hasFlag(command, flag) {
  60827. return (command._flags & flag) === flag;
  60828. }
  60829. function setFlag(command, flag, value) {
  60830. if (value) {
  60831. command._flags |= flag;
  60832. } else {
  60833. command._flags &= ~flag;
  60834. }
  60835. }
  60836. Object.defineProperties(DrawCommand.prototype, {
  60837. boundingVolume: {
  60838. get: function() {
  60839. return this._boundingVolume;
  60840. },
  60841. set: function(value) {
  60842. if (this._boundingVolume !== value) {
  60843. this._boundingVolume = value;
  60844. this.dirty = true;
  60845. }
  60846. }
  60847. },
  60848. orientedBoundingBox: {
  60849. get: function() {
  60850. return this._orientedBoundingBox;
  60851. },
  60852. set: function(value) {
  60853. if (this._orientedBoundingBox !== value) {
  60854. this._orientedBoundingBox = value;
  60855. this.dirty = true;
  60856. }
  60857. }
  60858. },
  60859. cull: {
  60860. get: function() {
  60861. return hasFlag(this, Flags.CULL);
  60862. },
  60863. set: function(value) {
  60864. if (hasFlag(this, Flags.CULL) !== value) {
  60865. setFlag(this, Flags.CULL, value);
  60866. this.dirty = true;
  60867. }
  60868. }
  60869. },
  60870. occlude: {
  60871. get: function() {
  60872. return hasFlag(this, Flags.OCCLUDE);
  60873. },
  60874. set: function(value) {
  60875. if (hasFlag(this, Flags.OCCLUDE) !== value) {
  60876. setFlag(this, Flags.OCCLUDE, value);
  60877. this.dirty = true;
  60878. }
  60879. }
  60880. },
  60881. modelMatrix: {
  60882. get: function() {
  60883. return this._modelMatrix;
  60884. },
  60885. set: function(value) {
  60886. if (this._modelMatrix !== value) {
  60887. this._modelMatrix = value;
  60888. this.dirty = true;
  60889. }
  60890. }
  60891. },
  60892. primitiveType: {
  60893. get: function() {
  60894. return this._primitiveType;
  60895. },
  60896. set: function(value) {
  60897. if (this._primitiveType !== value) {
  60898. this._primitiveType = value;
  60899. this.dirty = true;
  60900. }
  60901. }
  60902. },
  60903. vertexArray: {
  60904. get: function() {
  60905. return this._vertexArray;
  60906. },
  60907. set: function(value) {
  60908. if (this._vertexArray !== value) {
  60909. this._vertexArray = value;
  60910. this.dirty = true;
  60911. }
  60912. }
  60913. },
  60914. count: {
  60915. get: function() {
  60916. return this._count;
  60917. },
  60918. set: function(value) {
  60919. if (this._count !== value) {
  60920. this._count = value;
  60921. this.dirty = true;
  60922. }
  60923. }
  60924. },
  60925. offset: {
  60926. get: function() {
  60927. return this._offset;
  60928. },
  60929. set: function(value) {
  60930. if (this._offset !== value) {
  60931. this._offset = value;
  60932. this.dirty = true;
  60933. }
  60934. }
  60935. },
  60936. instanceCount: {
  60937. get: function() {
  60938. return this._instanceCount;
  60939. },
  60940. set: function(value) {
  60941. if (this._instanceCount !== value) {
  60942. this._instanceCount = value;
  60943. this.dirty = true;
  60944. }
  60945. }
  60946. },
  60947. shaderProgram: {
  60948. get: function() {
  60949. return this._shaderProgram;
  60950. },
  60951. set: function(value) {
  60952. if (this._shaderProgram !== value) {
  60953. this._shaderProgram = value;
  60954. this.dirty = true;
  60955. }
  60956. }
  60957. },
  60958. castShadows: {
  60959. get: function() {
  60960. return hasFlag(this, Flags.CAST_SHADOWS);
  60961. },
  60962. set: function(value) {
  60963. if (hasFlag(this, Flags.CAST_SHADOWS) !== value) {
  60964. setFlag(this, Flags.CAST_SHADOWS, value);
  60965. this.dirty = true;
  60966. }
  60967. }
  60968. },
  60969. receiveShadows: {
  60970. get: function() {
  60971. return hasFlag(this, Flags.RECEIVE_SHADOWS);
  60972. },
  60973. set: function(value) {
  60974. if (hasFlag(this, Flags.RECEIVE_SHADOWS) !== value) {
  60975. setFlag(this, Flags.RECEIVE_SHADOWS, value);
  60976. this.dirty = true;
  60977. }
  60978. }
  60979. },
  60980. uniformMap: {
  60981. get: function() {
  60982. return this._uniformMap;
  60983. },
  60984. set: function(value) {
  60985. if (this._uniformMap !== value) {
  60986. this._uniformMap = value;
  60987. this.dirty = true;
  60988. }
  60989. }
  60990. },
  60991. renderState: {
  60992. get: function() {
  60993. return this._renderState;
  60994. },
  60995. set: function(value) {
  60996. if (this._renderState !== value) {
  60997. this._renderState = value;
  60998. this.dirty = true;
  60999. }
  61000. }
  61001. },
  61002. framebuffer: {
  61003. get: function() {
  61004. return this._framebuffer;
  61005. },
  61006. set: function(value) {
  61007. if (this._framebuffer !== value) {
  61008. this._framebuffer = value;
  61009. this.dirty = true;
  61010. }
  61011. }
  61012. },
  61013. pass: {
  61014. get: function() {
  61015. return this._pass;
  61016. },
  61017. set: function(value) {
  61018. if (this._pass !== value) {
  61019. this._pass = value;
  61020. this.dirty = true;
  61021. }
  61022. }
  61023. },
  61024. executeInClosestFrustum: {
  61025. get: function() {
  61026. return hasFlag(this, Flags.EXECUTE_IN_CLOSEST_FRUSTUM);
  61027. },
  61028. set: function(value) {
  61029. if (hasFlag(this, Flags.EXECUTE_IN_CLOSEST_FRUSTUM) !== value) {
  61030. setFlag(this, Flags.EXECUTE_IN_CLOSEST_FRUSTUM, value);
  61031. this.dirty = true;
  61032. }
  61033. }
  61034. },
  61035. owner: {
  61036. get: function() {
  61037. return this._owner;
  61038. },
  61039. set: function(value) {
  61040. if (this._owner !== value) {
  61041. this._owner = value;
  61042. this.dirty = true;
  61043. }
  61044. }
  61045. },
  61046. debugShowBoundingVolume: {
  61047. get: function() {
  61048. return hasFlag(this, Flags.DEBUG_SHOW_BOUNDING_VOLUME);
  61049. },
  61050. set: function(value) {
  61051. if (hasFlag(this, Flags.DEBUG_SHOW_BOUNDING_VOLUME) !== value) {
  61052. setFlag(this, Flags.DEBUG_SHOW_BOUNDING_VOLUME, value);
  61053. this.dirty = true;
  61054. }
  61055. }
  61056. },
  61057. debugOverlappingFrustums: {
  61058. get: function() {
  61059. return this._debugOverlappingFrustums;
  61060. },
  61061. set: function(value) {
  61062. if (this._debugOverlappingFrustums !== value) {
  61063. this._debugOverlappingFrustums = value;
  61064. this.dirty = true;
  61065. }
  61066. }
  61067. },
  61068. pickId: {
  61069. get: function() {
  61070. return this._pickId;
  61071. },
  61072. set: function(value) {
  61073. if (this._pickId !== value) {
  61074. this._pickId = value;
  61075. this.dirty = true;
  61076. }
  61077. }
  61078. },
  61079. pickOnly: {
  61080. get: function() {
  61081. return hasFlag(this, Flags.PICK_ONLY);
  61082. },
  61083. set: function(value) {
  61084. if (hasFlag(this, Flags.PICK_ONLY) !== value) {
  61085. setFlag(this, Flags.PICK_ONLY, value);
  61086. this.dirty = true;
  61087. }
  61088. }
  61089. },
  61090. depthForTranslucentClassification: {
  61091. get: function() {
  61092. return hasFlag(this, Flags.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION);
  61093. },
  61094. set: function(value) {
  61095. if (hasFlag(this, Flags.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION) !== value) {
  61096. setFlag(this, Flags.DEPTH_FOR_TRANSLUCENT_CLASSIFICATION, value);
  61097. this.dirty = true;
  61098. }
  61099. }
  61100. }
  61101. });
  61102. DrawCommand.shallowClone = function(command, result) {
  61103. if (!defined_default(command)) {
  61104. return void 0;
  61105. }
  61106. if (!defined_default(result)) {
  61107. result = new DrawCommand();
  61108. }
  61109. result._boundingVolume = command._boundingVolume;
  61110. result._orientedBoundingBox = command._orientedBoundingBox;
  61111. result._modelMatrix = command._modelMatrix;
  61112. result._primitiveType = command._primitiveType;
  61113. result._vertexArray = command._vertexArray;
  61114. result._count = command._count;
  61115. result._offset = command._offset;
  61116. result._instanceCount = command._instanceCount;
  61117. result._shaderProgram = command._shaderProgram;
  61118. result._uniformMap = command._uniformMap;
  61119. result._renderState = command._renderState;
  61120. result._framebuffer = command._framebuffer;
  61121. result._pass = command._pass;
  61122. result._owner = command._owner;
  61123. result._debugOverlappingFrustums = command._debugOverlappingFrustums;
  61124. result._pickId = command._pickId;
  61125. result._flags = command._flags;
  61126. result.dirty = true;
  61127. result.lastDirtyTime = 0;
  61128. return result;
  61129. };
  61130. DrawCommand.prototype.execute = function(context, passState) {
  61131. context.draw(this, passState);
  61132. };
  61133. var DrawCommand_default = DrawCommand;
  61134. // node_modules/cesium/Source/Renderer/Pass.js
  61135. var Pass = {
  61136. ENVIRONMENT: 0,
  61137. COMPUTE: 1,
  61138. GLOBE: 2,
  61139. TERRAIN_CLASSIFICATION: 3,
  61140. CESIUM_3D_TILE: 4,
  61141. CESIUM_3D_TILE_CLASSIFICATION: 5,
  61142. CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW: 6,
  61143. OPAQUE: 7,
  61144. TRANSLUCENT: 8,
  61145. OVERLAY: 9,
  61146. NUMBER_OF_PASSES: 10
  61147. };
  61148. var Pass_default = Object.freeze(Pass);
  61149. // node_modules/cesium/Source/Renderer/freezeRenderState.js
  61150. function freezeRenderState(renderState) {
  61151. if (typeof renderState !== "object" || renderState === null) {
  61152. return renderState;
  61153. }
  61154. let propName;
  61155. const propNames = Object.keys(renderState);
  61156. for (let i2 = 0; i2 < propNames.length; i2++) {
  61157. propName = propNames[i2];
  61158. if (renderState.hasOwnProperty(propName) && propName !== "_applyFunctions") {
  61159. renderState[propName] = freezeRenderState(renderState[propName]);
  61160. }
  61161. }
  61162. return Object.freeze(renderState);
  61163. }
  61164. var freezeRenderState_default = freezeRenderState;
  61165. // node_modules/cesium/Source/Renderer/RenderState.js
  61166. function validateBlendEquation(blendEquation) {
  61167. return blendEquation === WebGLConstants_default.FUNC_ADD || blendEquation === WebGLConstants_default.FUNC_SUBTRACT || blendEquation === WebGLConstants_default.FUNC_REVERSE_SUBTRACT || blendEquation === WebGLConstants_default.MIN || blendEquation === WebGLConstants_default.MAX;
  61168. }
  61169. function validateBlendFunction(blendFunction) {
  61170. return blendFunction === WebGLConstants_default.ZERO || blendFunction === WebGLConstants_default.ONE || blendFunction === WebGLConstants_default.SRC_COLOR || blendFunction === WebGLConstants_default.ONE_MINUS_SRC_COLOR || blendFunction === WebGLConstants_default.DST_COLOR || blendFunction === WebGLConstants_default.ONE_MINUS_DST_COLOR || blendFunction === WebGLConstants_default.SRC_ALPHA || blendFunction === WebGLConstants_default.ONE_MINUS_SRC_ALPHA || blendFunction === WebGLConstants_default.DST_ALPHA || blendFunction === WebGLConstants_default.ONE_MINUS_DST_ALPHA || blendFunction === WebGLConstants_default.CONSTANT_COLOR || blendFunction === WebGLConstants_default.ONE_MINUS_CONSTANT_COLOR || blendFunction === WebGLConstants_default.CONSTANT_ALPHA || blendFunction === WebGLConstants_default.ONE_MINUS_CONSTANT_ALPHA || blendFunction === WebGLConstants_default.SRC_ALPHA_SATURATE;
  61171. }
  61172. function validateCullFace(cullFace) {
  61173. return cullFace === WebGLConstants_default.FRONT || cullFace === WebGLConstants_default.BACK || cullFace === WebGLConstants_default.FRONT_AND_BACK;
  61174. }
  61175. function validateDepthFunction(depthFunction) {
  61176. return depthFunction === WebGLConstants_default.NEVER || depthFunction === WebGLConstants_default.LESS || depthFunction === WebGLConstants_default.EQUAL || depthFunction === WebGLConstants_default.LEQUAL || depthFunction === WebGLConstants_default.GREATER || depthFunction === WebGLConstants_default.NOTEQUAL || depthFunction === WebGLConstants_default.GEQUAL || depthFunction === WebGLConstants_default.ALWAYS;
  61177. }
  61178. function validateStencilFunction(stencilFunction) {
  61179. return stencilFunction === WebGLConstants_default.NEVER || stencilFunction === WebGLConstants_default.LESS || stencilFunction === WebGLConstants_default.EQUAL || stencilFunction === WebGLConstants_default.LEQUAL || stencilFunction === WebGLConstants_default.GREATER || stencilFunction === WebGLConstants_default.NOTEQUAL || stencilFunction === WebGLConstants_default.GEQUAL || stencilFunction === WebGLConstants_default.ALWAYS;
  61180. }
  61181. function validateStencilOperation(stencilOperation) {
  61182. return stencilOperation === WebGLConstants_default.ZERO || stencilOperation === WebGLConstants_default.KEEP || stencilOperation === WebGLConstants_default.REPLACE || stencilOperation === WebGLConstants_default.INCR || stencilOperation === WebGLConstants_default.DECR || stencilOperation === WebGLConstants_default.INVERT || stencilOperation === WebGLConstants_default.INCR_WRAP || stencilOperation === WebGLConstants_default.DECR_WRAP;
  61183. }
  61184. function RenderState(renderState) {
  61185. const rs = defaultValue_default(renderState, defaultValue_default.EMPTY_OBJECT);
  61186. const cull = defaultValue_default(rs.cull, defaultValue_default.EMPTY_OBJECT);
  61187. const polygonOffset = defaultValue_default(
  61188. rs.polygonOffset,
  61189. defaultValue_default.EMPTY_OBJECT
  61190. );
  61191. const scissorTest = defaultValue_default(rs.scissorTest, defaultValue_default.EMPTY_OBJECT);
  61192. const scissorTestRectangle = defaultValue_default(
  61193. scissorTest.rectangle,
  61194. defaultValue_default.EMPTY_OBJECT
  61195. );
  61196. const depthRange = defaultValue_default(rs.depthRange, defaultValue_default.EMPTY_OBJECT);
  61197. const depthTest = defaultValue_default(rs.depthTest, defaultValue_default.EMPTY_OBJECT);
  61198. const colorMask = defaultValue_default(rs.colorMask, defaultValue_default.EMPTY_OBJECT);
  61199. const blending = defaultValue_default(rs.blending, defaultValue_default.EMPTY_OBJECT);
  61200. const blendingColor = defaultValue_default(blending.color, defaultValue_default.EMPTY_OBJECT);
  61201. const stencilTest = defaultValue_default(rs.stencilTest, defaultValue_default.EMPTY_OBJECT);
  61202. const stencilTestFrontOperation = defaultValue_default(
  61203. stencilTest.frontOperation,
  61204. defaultValue_default.EMPTY_OBJECT
  61205. );
  61206. const stencilTestBackOperation = defaultValue_default(
  61207. stencilTest.backOperation,
  61208. defaultValue_default.EMPTY_OBJECT
  61209. );
  61210. const sampleCoverage = defaultValue_default(
  61211. rs.sampleCoverage,
  61212. defaultValue_default.EMPTY_OBJECT
  61213. );
  61214. const viewport = rs.viewport;
  61215. this.frontFace = defaultValue_default(rs.frontFace, WindingOrder_default.COUNTER_CLOCKWISE);
  61216. this.cull = {
  61217. enabled: defaultValue_default(cull.enabled, false),
  61218. face: defaultValue_default(cull.face, WebGLConstants_default.BACK)
  61219. };
  61220. this.lineWidth = defaultValue_default(rs.lineWidth, 1);
  61221. this.polygonOffset = {
  61222. enabled: defaultValue_default(polygonOffset.enabled, false),
  61223. factor: defaultValue_default(polygonOffset.factor, 0),
  61224. units: defaultValue_default(polygonOffset.units, 0)
  61225. };
  61226. this.scissorTest = {
  61227. enabled: defaultValue_default(scissorTest.enabled, false),
  61228. rectangle: BoundingRectangle_default.clone(scissorTestRectangle)
  61229. };
  61230. this.depthRange = {
  61231. near: defaultValue_default(depthRange.near, 0),
  61232. far: defaultValue_default(depthRange.far, 1)
  61233. };
  61234. this.depthTest = {
  61235. enabled: defaultValue_default(depthTest.enabled, false),
  61236. func: defaultValue_default(depthTest.func, WebGLConstants_default.LESS)
  61237. };
  61238. this.colorMask = {
  61239. red: defaultValue_default(colorMask.red, true),
  61240. green: defaultValue_default(colorMask.green, true),
  61241. blue: defaultValue_default(colorMask.blue, true),
  61242. alpha: defaultValue_default(colorMask.alpha, true)
  61243. };
  61244. this.depthMask = defaultValue_default(rs.depthMask, true);
  61245. this.stencilMask = defaultValue_default(rs.stencilMask, ~0);
  61246. this.blending = {
  61247. enabled: defaultValue_default(blending.enabled, false),
  61248. color: new Color_default(
  61249. defaultValue_default(blendingColor.red, 0),
  61250. defaultValue_default(blendingColor.green, 0),
  61251. defaultValue_default(blendingColor.blue, 0),
  61252. defaultValue_default(blendingColor.alpha, 0)
  61253. ),
  61254. equationRgb: defaultValue_default(blending.equationRgb, WebGLConstants_default.FUNC_ADD),
  61255. equationAlpha: defaultValue_default(
  61256. blending.equationAlpha,
  61257. WebGLConstants_default.FUNC_ADD
  61258. ),
  61259. functionSourceRgb: defaultValue_default(
  61260. blending.functionSourceRgb,
  61261. WebGLConstants_default.ONE
  61262. ),
  61263. functionSourceAlpha: defaultValue_default(
  61264. blending.functionSourceAlpha,
  61265. WebGLConstants_default.ONE
  61266. ),
  61267. functionDestinationRgb: defaultValue_default(
  61268. blending.functionDestinationRgb,
  61269. WebGLConstants_default.ZERO
  61270. ),
  61271. functionDestinationAlpha: defaultValue_default(
  61272. blending.functionDestinationAlpha,
  61273. WebGLConstants_default.ZERO
  61274. )
  61275. };
  61276. this.stencilTest = {
  61277. enabled: defaultValue_default(stencilTest.enabled, false),
  61278. frontFunction: defaultValue_default(
  61279. stencilTest.frontFunction,
  61280. WebGLConstants_default.ALWAYS
  61281. ),
  61282. backFunction: defaultValue_default(stencilTest.backFunction, WebGLConstants_default.ALWAYS),
  61283. reference: defaultValue_default(stencilTest.reference, 0),
  61284. mask: defaultValue_default(stencilTest.mask, ~0),
  61285. frontOperation: {
  61286. fail: defaultValue_default(stencilTestFrontOperation.fail, WebGLConstants_default.KEEP),
  61287. zFail: defaultValue_default(stencilTestFrontOperation.zFail, WebGLConstants_default.KEEP),
  61288. zPass: defaultValue_default(stencilTestFrontOperation.zPass, WebGLConstants_default.KEEP)
  61289. },
  61290. backOperation: {
  61291. fail: defaultValue_default(stencilTestBackOperation.fail, WebGLConstants_default.KEEP),
  61292. zFail: defaultValue_default(stencilTestBackOperation.zFail, WebGLConstants_default.KEEP),
  61293. zPass: defaultValue_default(stencilTestBackOperation.zPass, WebGLConstants_default.KEEP)
  61294. }
  61295. };
  61296. this.sampleCoverage = {
  61297. enabled: defaultValue_default(sampleCoverage.enabled, false),
  61298. value: defaultValue_default(sampleCoverage.value, 1),
  61299. invert: defaultValue_default(sampleCoverage.invert, false)
  61300. };
  61301. this.viewport = defined_default(viewport) ? new BoundingRectangle_default(
  61302. viewport.x,
  61303. viewport.y,
  61304. viewport.width,
  61305. viewport.height
  61306. ) : void 0;
  61307. if (this.lineWidth < ContextLimits_default.minimumAliasedLineWidth || this.lineWidth > ContextLimits_default.maximumAliasedLineWidth) {
  61308. throw new DeveloperError_default(
  61309. "renderState.lineWidth is out of range. Check minimumAliasedLineWidth and maximumAliasedLineWidth."
  61310. );
  61311. }
  61312. if (!WindingOrder_default.validate(this.frontFace)) {
  61313. throw new DeveloperError_default("Invalid renderState.frontFace.");
  61314. }
  61315. if (!validateCullFace(this.cull.face)) {
  61316. throw new DeveloperError_default("Invalid renderState.cull.face.");
  61317. }
  61318. if (this.scissorTest.rectangle.width < 0 || this.scissorTest.rectangle.height < 0) {
  61319. throw new DeveloperError_default(
  61320. "renderState.scissorTest.rectangle.width and renderState.scissorTest.rectangle.height must be greater than or equal to zero."
  61321. );
  61322. }
  61323. if (this.depthRange.near > this.depthRange.far) {
  61324. throw new DeveloperError_default(
  61325. "renderState.depthRange.near can not be greater than renderState.depthRange.far."
  61326. );
  61327. }
  61328. if (this.depthRange.near < 0) {
  61329. throw new DeveloperError_default(
  61330. "renderState.depthRange.near must be greater than or equal to zero."
  61331. );
  61332. }
  61333. if (this.depthRange.far > 1) {
  61334. throw new DeveloperError_default(
  61335. "renderState.depthRange.far must be less than or equal to one."
  61336. );
  61337. }
  61338. if (!validateDepthFunction(this.depthTest.func)) {
  61339. throw new DeveloperError_default("Invalid renderState.depthTest.func.");
  61340. }
  61341. if (this.blending.color.red < 0 || this.blending.color.red > 1 || this.blending.color.green < 0 || this.blending.color.green > 1 || this.blending.color.blue < 0 || this.blending.color.blue > 1 || this.blending.color.alpha < 0 || this.blending.color.alpha > 1) {
  61342. throw new DeveloperError_default(
  61343. "renderState.blending.color components must be greater than or equal to zero and less than or equal to one."
  61344. );
  61345. }
  61346. if (!validateBlendEquation(this.blending.equationRgb)) {
  61347. throw new DeveloperError_default("Invalid renderState.blending.equationRgb.");
  61348. }
  61349. if (!validateBlendEquation(this.blending.equationAlpha)) {
  61350. throw new DeveloperError_default("Invalid renderState.blending.equationAlpha.");
  61351. }
  61352. if (!validateBlendFunction(this.blending.functionSourceRgb)) {
  61353. throw new DeveloperError_default("Invalid renderState.blending.functionSourceRgb.");
  61354. }
  61355. if (!validateBlendFunction(this.blending.functionSourceAlpha)) {
  61356. throw new DeveloperError_default(
  61357. "Invalid renderState.blending.functionSourceAlpha."
  61358. );
  61359. }
  61360. if (!validateBlendFunction(this.blending.functionDestinationRgb)) {
  61361. throw new DeveloperError_default(
  61362. "Invalid renderState.blending.functionDestinationRgb."
  61363. );
  61364. }
  61365. if (!validateBlendFunction(this.blending.functionDestinationAlpha)) {
  61366. throw new DeveloperError_default(
  61367. "Invalid renderState.blending.functionDestinationAlpha."
  61368. );
  61369. }
  61370. if (!validateStencilFunction(this.stencilTest.frontFunction)) {
  61371. throw new DeveloperError_default("Invalid renderState.stencilTest.frontFunction.");
  61372. }
  61373. if (!validateStencilFunction(this.stencilTest.backFunction)) {
  61374. throw new DeveloperError_default("Invalid renderState.stencilTest.backFunction.");
  61375. }
  61376. if (!validateStencilOperation(this.stencilTest.frontOperation.fail)) {
  61377. throw new DeveloperError_default(
  61378. "Invalid renderState.stencilTest.frontOperation.fail."
  61379. );
  61380. }
  61381. if (!validateStencilOperation(this.stencilTest.frontOperation.zFail)) {
  61382. throw new DeveloperError_default(
  61383. "Invalid renderState.stencilTest.frontOperation.zFail."
  61384. );
  61385. }
  61386. if (!validateStencilOperation(this.stencilTest.frontOperation.zPass)) {
  61387. throw new DeveloperError_default(
  61388. "Invalid renderState.stencilTest.frontOperation.zPass."
  61389. );
  61390. }
  61391. if (!validateStencilOperation(this.stencilTest.backOperation.fail)) {
  61392. throw new DeveloperError_default(
  61393. "Invalid renderState.stencilTest.backOperation.fail."
  61394. );
  61395. }
  61396. if (!validateStencilOperation(this.stencilTest.backOperation.zFail)) {
  61397. throw new DeveloperError_default(
  61398. "Invalid renderState.stencilTest.backOperation.zFail."
  61399. );
  61400. }
  61401. if (!validateStencilOperation(this.stencilTest.backOperation.zPass)) {
  61402. throw new DeveloperError_default(
  61403. "Invalid renderState.stencilTest.backOperation.zPass."
  61404. );
  61405. }
  61406. if (defined_default(this.viewport)) {
  61407. if (this.viewport.width < 0) {
  61408. throw new DeveloperError_default(
  61409. "renderState.viewport.width must be greater than or equal to zero."
  61410. );
  61411. }
  61412. if (this.viewport.height < 0) {
  61413. throw new DeveloperError_default(
  61414. "renderState.viewport.height must be greater than or equal to zero."
  61415. );
  61416. }
  61417. if (this.viewport.width > ContextLimits_default.maximumViewportWidth) {
  61418. throw new DeveloperError_default(
  61419. `renderState.viewport.width must be less than or equal to the maximum viewport width (${ContextLimits_default.maximumViewportWidth.toString()}). Check maximumViewportWidth.`
  61420. );
  61421. }
  61422. if (this.viewport.height > ContextLimits_default.maximumViewportHeight) {
  61423. throw new DeveloperError_default(
  61424. `renderState.viewport.height must be less than or equal to the maximum viewport height (${ContextLimits_default.maximumViewportHeight.toString()}). Check maximumViewportHeight.`
  61425. );
  61426. }
  61427. }
  61428. this.id = 0;
  61429. this._applyFunctions = [];
  61430. }
  61431. var nextRenderStateId = 0;
  61432. var renderStateCache = {};
  61433. RenderState.fromCache = function(renderState) {
  61434. const partialKey = JSON.stringify(renderState);
  61435. let cachedState = renderStateCache[partialKey];
  61436. if (defined_default(cachedState)) {
  61437. ++cachedState.referenceCount;
  61438. return cachedState.state;
  61439. }
  61440. let states = new RenderState(renderState);
  61441. const fullKey = JSON.stringify(states);
  61442. cachedState = renderStateCache[fullKey];
  61443. if (!defined_default(cachedState)) {
  61444. states.id = nextRenderStateId++;
  61445. states = freezeRenderState_default(states);
  61446. cachedState = {
  61447. referenceCount: 0,
  61448. state: states
  61449. };
  61450. renderStateCache[fullKey] = cachedState;
  61451. }
  61452. ++cachedState.referenceCount;
  61453. renderStateCache[partialKey] = {
  61454. referenceCount: 1,
  61455. state: cachedState.state
  61456. };
  61457. return cachedState.state;
  61458. };
  61459. RenderState.removeFromCache = function(renderState) {
  61460. const states = new RenderState(renderState);
  61461. const fullKey = JSON.stringify(states);
  61462. const fullCachedState = renderStateCache[fullKey];
  61463. const partialKey = JSON.stringify(renderState);
  61464. const cachedState = renderStateCache[partialKey];
  61465. if (defined_default(cachedState)) {
  61466. --cachedState.referenceCount;
  61467. if (cachedState.referenceCount === 0) {
  61468. delete renderStateCache[partialKey];
  61469. if (defined_default(fullCachedState)) {
  61470. --fullCachedState.referenceCount;
  61471. }
  61472. }
  61473. }
  61474. if (defined_default(fullCachedState) && fullCachedState.referenceCount === 0) {
  61475. delete renderStateCache[fullKey];
  61476. }
  61477. };
  61478. RenderState.getCache = function() {
  61479. return renderStateCache;
  61480. };
  61481. RenderState.clearCache = function() {
  61482. renderStateCache = {};
  61483. };
  61484. function enableOrDisable(gl, glEnum, enable) {
  61485. if (enable) {
  61486. gl.enable(glEnum);
  61487. } else {
  61488. gl.disable(glEnum);
  61489. }
  61490. }
  61491. function applyFrontFace(gl, renderState) {
  61492. gl.frontFace(renderState.frontFace);
  61493. }
  61494. function applyCull(gl, renderState) {
  61495. const cull = renderState.cull;
  61496. const enabled = cull.enabled;
  61497. enableOrDisable(gl, gl.CULL_FACE, enabled);
  61498. if (enabled) {
  61499. gl.cullFace(cull.face);
  61500. }
  61501. }
  61502. function applyLineWidth(gl, renderState) {
  61503. gl.lineWidth(renderState.lineWidth);
  61504. }
  61505. function applyPolygonOffset(gl, renderState) {
  61506. const polygonOffset = renderState.polygonOffset;
  61507. const enabled = polygonOffset.enabled;
  61508. enableOrDisable(gl, gl.POLYGON_OFFSET_FILL, enabled);
  61509. if (enabled) {
  61510. gl.polygonOffset(polygonOffset.factor, polygonOffset.units);
  61511. }
  61512. }
  61513. function applyScissorTest(gl, renderState, passState) {
  61514. const scissorTest = renderState.scissorTest;
  61515. const enabled = defined_default(passState.scissorTest) ? passState.scissorTest.enabled : scissorTest.enabled;
  61516. enableOrDisable(gl, gl.SCISSOR_TEST, enabled);
  61517. if (enabled) {
  61518. const rectangle = defined_default(passState.scissorTest) ? passState.scissorTest.rectangle : scissorTest.rectangle;
  61519. gl.scissor(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
  61520. }
  61521. }
  61522. function applyDepthRange(gl, renderState) {
  61523. const depthRange = renderState.depthRange;
  61524. gl.depthRange(depthRange.near, depthRange.far);
  61525. }
  61526. function applyDepthTest(gl, renderState) {
  61527. const depthTest = renderState.depthTest;
  61528. const enabled = depthTest.enabled;
  61529. enableOrDisable(gl, gl.DEPTH_TEST, enabled);
  61530. if (enabled) {
  61531. gl.depthFunc(depthTest.func);
  61532. }
  61533. }
  61534. function applyColorMask(gl, renderState) {
  61535. const colorMask = renderState.colorMask;
  61536. gl.colorMask(colorMask.red, colorMask.green, colorMask.blue, colorMask.alpha);
  61537. }
  61538. function applyDepthMask(gl, renderState) {
  61539. gl.depthMask(renderState.depthMask);
  61540. }
  61541. function applyStencilMask(gl, renderState) {
  61542. gl.stencilMask(renderState.stencilMask);
  61543. }
  61544. function applyBlendingColor(gl, color) {
  61545. gl.blendColor(color.red, color.green, color.blue, color.alpha);
  61546. }
  61547. function applyBlending(gl, renderState, passState) {
  61548. const blending = renderState.blending;
  61549. const enabled = defined_default(passState.blendingEnabled) ? passState.blendingEnabled : blending.enabled;
  61550. enableOrDisable(gl, gl.BLEND, enabled);
  61551. if (enabled) {
  61552. applyBlendingColor(gl, blending.color);
  61553. gl.blendEquationSeparate(blending.equationRgb, blending.equationAlpha);
  61554. gl.blendFuncSeparate(
  61555. blending.functionSourceRgb,
  61556. blending.functionDestinationRgb,
  61557. blending.functionSourceAlpha,
  61558. blending.functionDestinationAlpha
  61559. );
  61560. }
  61561. }
  61562. function applyStencilTest(gl, renderState) {
  61563. const stencilTest = renderState.stencilTest;
  61564. const enabled = stencilTest.enabled;
  61565. enableOrDisable(gl, gl.STENCIL_TEST, enabled);
  61566. if (enabled) {
  61567. const frontFunction = stencilTest.frontFunction;
  61568. const backFunction = stencilTest.backFunction;
  61569. const reference = stencilTest.reference;
  61570. const mask = stencilTest.mask;
  61571. gl.stencilFunc(frontFunction, reference, mask);
  61572. gl.stencilFuncSeparate(gl.BACK, backFunction, reference, mask);
  61573. gl.stencilFuncSeparate(gl.FRONT, frontFunction, reference, mask);
  61574. const frontOperation = stencilTest.frontOperation;
  61575. const frontOperationFail = frontOperation.fail;
  61576. const frontOperationZFail = frontOperation.zFail;
  61577. const frontOperationZPass = frontOperation.zPass;
  61578. gl.stencilOpSeparate(
  61579. gl.FRONT,
  61580. frontOperationFail,
  61581. frontOperationZFail,
  61582. frontOperationZPass
  61583. );
  61584. const backOperation = stencilTest.backOperation;
  61585. const backOperationFail = backOperation.fail;
  61586. const backOperationZFail = backOperation.zFail;
  61587. const backOperationZPass = backOperation.zPass;
  61588. gl.stencilOpSeparate(
  61589. gl.BACK,
  61590. backOperationFail,
  61591. backOperationZFail,
  61592. backOperationZPass
  61593. );
  61594. }
  61595. }
  61596. function applySampleCoverage(gl, renderState) {
  61597. const sampleCoverage = renderState.sampleCoverage;
  61598. const enabled = sampleCoverage.enabled;
  61599. enableOrDisable(gl, gl.SAMPLE_COVERAGE, enabled);
  61600. if (enabled) {
  61601. gl.sampleCoverage(sampleCoverage.value, sampleCoverage.invert);
  61602. }
  61603. }
  61604. var scratchViewport = new BoundingRectangle_default();
  61605. function applyViewport(gl, renderState, passState) {
  61606. let viewport = defaultValue_default(renderState.viewport, passState.viewport);
  61607. if (!defined_default(viewport)) {
  61608. viewport = scratchViewport;
  61609. viewport.width = passState.context.drawingBufferWidth;
  61610. viewport.height = passState.context.drawingBufferHeight;
  61611. }
  61612. passState.context.uniformState.viewport = viewport;
  61613. gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height);
  61614. }
  61615. RenderState.apply = function(gl, renderState, passState) {
  61616. applyFrontFace(gl, renderState);
  61617. applyCull(gl, renderState);
  61618. applyLineWidth(gl, renderState);
  61619. applyPolygonOffset(gl, renderState);
  61620. applyDepthRange(gl, renderState);
  61621. applyDepthTest(gl, renderState);
  61622. applyColorMask(gl, renderState);
  61623. applyDepthMask(gl, renderState);
  61624. applyStencilMask(gl, renderState);
  61625. applyStencilTest(gl, renderState);
  61626. applySampleCoverage(gl, renderState);
  61627. applyScissorTest(gl, renderState, passState);
  61628. applyBlending(gl, renderState, passState);
  61629. applyViewport(gl, renderState, passState);
  61630. };
  61631. function createFuncs(previousState, nextState) {
  61632. const funcs = [];
  61633. if (previousState.frontFace !== nextState.frontFace) {
  61634. funcs.push(applyFrontFace);
  61635. }
  61636. if (previousState.cull.enabled !== nextState.cull.enabled || previousState.cull.face !== nextState.cull.face) {
  61637. funcs.push(applyCull);
  61638. }
  61639. if (previousState.lineWidth !== nextState.lineWidth) {
  61640. funcs.push(applyLineWidth);
  61641. }
  61642. if (previousState.polygonOffset.enabled !== nextState.polygonOffset.enabled || previousState.polygonOffset.factor !== nextState.polygonOffset.factor || previousState.polygonOffset.units !== nextState.polygonOffset.units) {
  61643. funcs.push(applyPolygonOffset);
  61644. }
  61645. if (previousState.depthRange.near !== nextState.depthRange.near || previousState.depthRange.far !== nextState.depthRange.far) {
  61646. funcs.push(applyDepthRange);
  61647. }
  61648. if (previousState.depthTest.enabled !== nextState.depthTest.enabled || previousState.depthTest.func !== nextState.depthTest.func) {
  61649. funcs.push(applyDepthTest);
  61650. }
  61651. if (previousState.colorMask.red !== nextState.colorMask.red || previousState.colorMask.green !== nextState.colorMask.green || previousState.colorMask.blue !== nextState.colorMask.blue || previousState.colorMask.alpha !== nextState.colorMask.alpha) {
  61652. funcs.push(applyColorMask);
  61653. }
  61654. if (previousState.depthMask !== nextState.depthMask) {
  61655. funcs.push(applyDepthMask);
  61656. }
  61657. if (previousState.stencilMask !== nextState.stencilMask) {
  61658. funcs.push(applyStencilMask);
  61659. }
  61660. if (previousState.stencilTest.enabled !== nextState.stencilTest.enabled || previousState.stencilTest.frontFunction !== nextState.stencilTest.frontFunction || previousState.stencilTest.backFunction !== nextState.stencilTest.backFunction || previousState.stencilTest.reference !== nextState.stencilTest.reference || previousState.stencilTest.mask !== nextState.stencilTest.mask || previousState.stencilTest.frontOperation.fail !== nextState.stencilTest.frontOperation.fail || previousState.stencilTest.frontOperation.zFail !== nextState.stencilTest.frontOperation.zFail || previousState.stencilTest.backOperation.fail !== nextState.stencilTest.backOperation.fail || previousState.stencilTest.backOperation.zFail !== nextState.stencilTest.backOperation.zFail || previousState.stencilTest.backOperation.zPass !== nextState.stencilTest.backOperation.zPass) {
  61661. funcs.push(applyStencilTest);
  61662. }
  61663. if (previousState.sampleCoverage.enabled !== nextState.sampleCoverage.enabled || previousState.sampleCoverage.value !== nextState.sampleCoverage.value || previousState.sampleCoverage.invert !== nextState.sampleCoverage.invert) {
  61664. funcs.push(applySampleCoverage);
  61665. }
  61666. return funcs;
  61667. }
  61668. RenderState.partialApply = function(gl, previousRenderState, renderState, previousPassState, passState, clear2) {
  61669. if (previousRenderState !== renderState) {
  61670. let funcs = renderState._applyFunctions[previousRenderState.id];
  61671. if (!defined_default(funcs)) {
  61672. funcs = createFuncs(previousRenderState, renderState);
  61673. renderState._applyFunctions[previousRenderState.id] = funcs;
  61674. }
  61675. const len = funcs.length;
  61676. for (let i2 = 0; i2 < len; ++i2) {
  61677. funcs[i2](gl, renderState);
  61678. }
  61679. }
  61680. const previousScissorTest = defined_default(previousPassState.scissorTest) ? previousPassState.scissorTest : previousRenderState.scissorTest;
  61681. const scissorTest = defined_default(passState.scissorTest) ? passState.scissorTest : renderState.scissorTest;
  61682. if (previousScissorTest !== scissorTest || clear2) {
  61683. applyScissorTest(gl, renderState, passState);
  61684. }
  61685. const previousBlendingEnabled = defined_default(previousPassState.blendingEnabled) ? previousPassState.blendingEnabled : previousRenderState.blending.enabled;
  61686. const blendingEnabled = defined_default(passState.blendingEnabled) ? passState.blendingEnabled : renderState.blending.enabled;
  61687. if (previousBlendingEnabled !== blendingEnabled || blendingEnabled && previousRenderState.blending !== renderState.blending) {
  61688. applyBlending(gl, renderState, passState);
  61689. }
  61690. if (previousRenderState !== renderState || previousPassState !== passState || previousPassState.context !== passState.context) {
  61691. applyViewport(gl, renderState, passState);
  61692. }
  61693. };
  61694. RenderState.getState = function(renderState) {
  61695. if (!defined_default(renderState)) {
  61696. throw new DeveloperError_default("renderState is required.");
  61697. }
  61698. return {
  61699. frontFace: renderState.frontFace,
  61700. cull: {
  61701. enabled: renderState.cull.enabled,
  61702. face: renderState.cull.face
  61703. },
  61704. lineWidth: renderState.lineWidth,
  61705. polygonOffset: {
  61706. enabled: renderState.polygonOffset.enabled,
  61707. factor: renderState.polygonOffset.factor,
  61708. units: renderState.polygonOffset.units
  61709. },
  61710. scissorTest: {
  61711. enabled: renderState.scissorTest.enabled,
  61712. rectangle: BoundingRectangle_default.clone(renderState.scissorTest.rectangle)
  61713. },
  61714. depthRange: {
  61715. near: renderState.depthRange.near,
  61716. far: renderState.depthRange.far
  61717. },
  61718. depthTest: {
  61719. enabled: renderState.depthTest.enabled,
  61720. func: renderState.depthTest.func
  61721. },
  61722. colorMask: {
  61723. red: renderState.colorMask.red,
  61724. green: renderState.colorMask.green,
  61725. blue: renderState.colorMask.blue,
  61726. alpha: renderState.colorMask.alpha
  61727. },
  61728. depthMask: renderState.depthMask,
  61729. stencilMask: renderState.stencilMask,
  61730. blending: {
  61731. enabled: renderState.blending.enabled,
  61732. color: Color_default.clone(renderState.blending.color),
  61733. equationRgb: renderState.blending.equationRgb,
  61734. equationAlpha: renderState.blending.equationAlpha,
  61735. functionSourceRgb: renderState.blending.functionSourceRgb,
  61736. functionSourceAlpha: renderState.blending.functionSourceAlpha,
  61737. functionDestinationRgb: renderState.blending.functionDestinationRgb,
  61738. functionDestinationAlpha: renderState.blending.functionDestinationAlpha
  61739. },
  61740. stencilTest: {
  61741. enabled: renderState.stencilTest.enabled,
  61742. frontFunction: renderState.stencilTest.frontFunction,
  61743. backFunction: renderState.stencilTest.backFunction,
  61744. reference: renderState.stencilTest.reference,
  61745. mask: renderState.stencilTest.mask,
  61746. frontOperation: {
  61747. fail: renderState.stencilTest.frontOperation.fail,
  61748. zFail: renderState.stencilTest.frontOperation.zFail,
  61749. zPass: renderState.stencilTest.frontOperation.zPass
  61750. },
  61751. backOperation: {
  61752. fail: renderState.stencilTest.backOperation.fail,
  61753. zFail: renderState.stencilTest.backOperation.zFail,
  61754. zPass: renderState.stencilTest.backOperation.zPass
  61755. }
  61756. },
  61757. sampleCoverage: {
  61758. enabled: renderState.sampleCoverage.enabled,
  61759. value: renderState.sampleCoverage.value,
  61760. invert: renderState.sampleCoverage.invert
  61761. },
  61762. viewport: defined_default(renderState.viewport) ? BoundingRectangle_default.clone(renderState.viewport) : void 0
  61763. };
  61764. };
  61765. var RenderState_default = RenderState;
  61766. // node_modules/cesium/Source/Renderer/AutomaticUniforms.js
  61767. var viewerPositionWCScratch = new Cartesian3_default();
  61768. function AutomaticUniform(options) {
  61769. this._size = options.size;
  61770. this._datatype = options.datatype;
  61771. this.getValue = options.getValue;
  61772. }
  61773. var datatypeToGlsl = {};
  61774. datatypeToGlsl[WebGLConstants_default.FLOAT] = "float";
  61775. datatypeToGlsl[WebGLConstants_default.FLOAT_VEC2] = "vec2";
  61776. datatypeToGlsl[WebGLConstants_default.FLOAT_VEC3] = "vec3";
  61777. datatypeToGlsl[WebGLConstants_default.FLOAT_VEC4] = "vec4";
  61778. datatypeToGlsl[WebGLConstants_default.INT] = "int";
  61779. datatypeToGlsl[WebGLConstants_default.INT_VEC2] = "ivec2";
  61780. datatypeToGlsl[WebGLConstants_default.INT_VEC3] = "ivec3";
  61781. datatypeToGlsl[WebGLConstants_default.INT_VEC4] = "ivec4";
  61782. datatypeToGlsl[WebGLConstants_default.BOOL] = "bool";
  61783. datatypeToGlsl[WebGLConstants_default.BOOL_VEC2] = "bvec2";
  61784. datatypeToGlsl[WebGLConstants_default.BOOL_VEC3] = "bvec3";
  61785. datatypeToGlsl[WebGLConstants_default.BOOL_VEC4] = "bvec4";
  61786. datatypeToGlsl[WebGLConstants_default.FLOAT_MAT2] = "mat2";
  61787. datatypeToGlsl[WebGLConstants_default.FLOAT_MAT3] = "mat3";
  61788. datatypeToGlsl[WebGLConstants_default.FLOAT_MAT4] = "mat4";
  61789. datatypeToGlsl[WebGLConstants_default.SAMPLER_2D] = "sampler2D";
  61790. datatypeToGlsl[WebGLConstants_default.SAMPLER_CUBE] = "samplerCube";
  61791. AutomaticUniform.prototype.getDeclaration = function(name) {
  61792. let declaration = `uniform ${datatypeToGlsl[this._datatype]} ${name}`;
  61793. const size = this._size;
  61794. if (size === 1) {
  61795. declaration += ";";
  61796. } else {
  61797. declaration += `[${size.toString()}];`;
  61798. }
  61799. return declaration;
  61800. };
  61801. var AutomaticUniforms = {
  61802. czm_viewport: new AutomaticUniform({
  61803. size: 1,
  61804. datatype: WebGLConstants_default.FLOAT_VEC4,
  61805. getValue: function(uniformState) {
  61806. return uniformState.viewportCartesian4;
  61807. }
  61808. }),
  61809. czm_viewportOrthographic: new AutomaticUniform({
  61810. size: 1,
  61811. datatype: WebGLConstants_default.FLOAT_MAT4,
  61812. getValue: function(uniformState) {
  61813. return uniformState.viewportOrthographic;
  61814. }
  61815. }),
  61816. czm_viewportTransformation: new AutomaticUniform({
  61817. size: 1,
  61818. datatype: WebGLConstants_default.FLOAT_MAT4,
  61819. getValue: function(uniformState) {
  61820. return uniformState.viewportTransformation;
  61821. }
  61822. }),
  61823. czm_globeDepthTexture: new AutomaticUniform({
  61824. size: 1,
  61825. datatype: WebGLConstants_default.SAMPLER_2D,
  61826. getValue: function(uniformState) {
  61827. return uniformState.globeDepthTexture;
  61828. }
  61829. }),
  61830. czm_model: new AutomaticUniform({
  61831. size: 1,
  61832. datatype: WebGLConstants_default.FLOAT_MAT4,
  61833. getValue: function(uniformState) {
  61834. return uniformState.model;
  61835. }
  61836. }),
  61837. czm_inverseModel: new AutomaticUniform({
  61838. size: 1,
  61839. datatype: WebGLConstants_default.FLOAT_MAT4,
  61840. getValue: function(uniformState) {
  61841. return uniformState.inverseModel;
  61842. }
  61843. }),
  61844. czm_view: new AutomaticUniform({
  61845. size: 1,
  61846. datatype: WebGLConstants_default.FLOAT_MAT4,
  61847. getValue: function(uniformState) {
  61848. return uniformState.view;
  61849. }
  61850. }),
  61851. czm_view3D: new AutomaticUniform({
  61852. size: 1,
  61853. datatype: WebGLConstants_default.FLOAT_MAT4,
  61854. getValue: function(uniformState) {
  61855. return uniformState.view3D;
  61856. }
  61857. }),
  61858. czm_viewRotation: new AutomaticUniform({
  61859. size: 1,
  61860. datatype: WebGLConstants_default.FLOAT_MAT3,
  61861. getValue: function(uniformState) {
  61862. return uniformState.viewRotation;
  61863. }
  61864. }),
  61865. czm_viewRotation3D: new AutomaticUniform({
  61866. size: 1,
  61867. datatype: WebGLConstants_default.FLOAT_MAT3,
  61868. getValue: function(uniformState) {
  61869. return uniformState.viewRotation3D;
  61870. }
  61871. }),
  61872. czm_inverseView: new AutomaticUniform({
  61873. size: 1,
  61874. datatype: WebGLConstants_default.FLOAT_MAT4,
  61875. getValue: function(uniformState) {
  61876. return uniformState.inverseView;
  61877. }
  61878. }),
  61879. czm_inverseView3D: new AutomaticUniform({
  61880. size: 1,
  61881. datatype: WebGLConstants_default.FLOAT_MAT4,
  61882. getValue: function(uniformState) {
  61883. return uniformState.inverseView3D;
  61884. }
  61885. }),
  61886. czm_inverseViewRotation: new AutomaticUniform({
  61887. size: 1,
  61888. datatype: WebGLConstants_default.FLOAT_MAT3,
  61889. getValue: function(uniformState) {
  61890. return uniformState.inverseViewRotation;
  61891. }
  61892. }),
  61893. czm_inverseViewRotation3D: new AutomaticUniform({
  61894. size: 1,
  61895. datatype: WebGLConstants_default.FLOAT_MAT3,
  61896. getValue: function(uniformState) {
  61897. return uniformState.inverseViewRotation3D;
  61898. }
  61899. }),
  61900. czm_projection: new AutomaticUniform({
  61901. size: 1,
  61902. datatype: WebGLConstants_default.FLOAT_MAT4,
  61903. getValue: function(uniformState) {
  61904. return uniformState.projection;
  61905. }
  61906. }),
  61907. czm_inverseProjection: new AutomaticUniform({
  61908. size: 1,
  61909. datatype: WebGLConstants_default.FLOAT_MAT4,
  61910. getValue: function(uniformState) {
  61911. return uniformState.inverseProjection;
  61912. }
  61913. }),
  61914. czm_infiniteProjection: new AutomaticUniform({
  61915. size: 1,
  61916. datatype: WebGLConstants_default.FLOAT_MAT4,
  61917. getValue: function(uniformState) {
  61918. return uniformState.infiniteProjection;
  61919. }
  61920. }),
  61921. czm_modelView: new AutomaticUniform({
  61922. size: 1,
  61923. datatype: WebGLConstants_default.FLOAT_MAT4,
  61924. getValue: function(uniformState) {
  61925. return uniformState.modelView;
  61926. }
  61927. }),
  61928. czm_modelView3D: new AutomaticUniform({
  61929. size: 1,
  61930. datatype: WebGLConstants_default.FLOAT_MAT4,
  61931. getValue: function(uniformState) {
  61932. return uniformState.modelView3D;
  61933. }
  61934. }),
  61935. czm_modelViewRelativeToEye: new AutomaticUniform({
  61936. size: 1,
  61937. datatype: WebGLConstants_default.FLOAT_MAT4,
  61938. getValue: function(uniformState) {
  61939. return uniformState.modelViewRelativeToEye;
  61940. }
  61941. }),
  61942. czm_inverseModelView: new AutomaticUniform({
  61943. size: 1,
  61944. datatype: WebGLConstants_default.FLOAT_MAT4,
  61945. getValue: function(uniformState) {
  61946. return uniformState.inverseModelView;
  61947. }
  61948. }),
  61949. czm_inverseModelView3D: new AutomaticUniform({
  61950. size: 1,
  61951. datatype: WebGLConstants_default.FLOAT_MAT4,
  61952. getValue: function(uniformState) {
  61953. return uniformState.inverseModelView3D;
  61954. }
  61955. }),
  61956. czm_viewProjection: new AutomaticUniform({
  61957. size: 1,
  61958. datatype: WebGLConstants_default.FLOAT_MAT4,
  61959. getValue: function(uniformState) {
  61960. return uniformState.viewProjection;
  61961. }
  61962. }),
  61963. czm_inverseViewProjection: new AutomaticUniform({
  61964. size: 1,
  61965. datatype: WebGLConstants_default.FLOAT_MAT4,
  61966. getValue: function(uniformState) {
  61967. return uniformState.inverseViewProjection;
  61968. }
  61969. }),
  61970. czm_modelViewProjection: new AutomaticUniform({
  61971. size: 1,
  61972. datatype: WebGLConstants_default.FLOAT_MAT4,
  61973. getValue: function(uniformState) {
  61974. return uniformState.modelViewProjection;
  61975. }
  61976. }),
  61977. czm_inverseModelViewProjection: new AutomaticUniform({
  61978. size: 1,
  61979. datatype: WebGLConstants_default.FLOAT_MAT4,
  61980. getValue: function(uniformState) {
  61981. return uniformState.inverseModelViewProjection;
  61982. }
  61983. }),
  61984. czm_modelViewProjectionRelativeToEye: new AutomaticUniform({
  61985. size: 1,
  61986. datatype: WebGLConstants_default.FLOAT_MAT4,
  61987. getValue: function(uniformState) {
  61988. return uniformState.modelViewProjectionRelativeToEye;
  61989. }
  61990. }),
  61991. czm_modelViewInfiniteProjection: new AutomaticUniform({
  61992. size: 1,
  61993. datatype: WebGLConstants_default.FLOAT_MAT4,
  61994. getValue: function(uniformState) {
  61995. return uniformState.modelViewInfiniteProjection;
  61996. }
  61997. }),
  61998. czm_orthographicIn3D: new AutomaticUniform({
  61999. size: 1,
  62000. datatype: WebGLConstants_default.FLOAT,
  62001. getValue: function(uniformState) {
  62002. return uniformState.orthographicIn3D ? 1 : 0;
  62003. }
  62004. }),
  62005. czm_normal: new AutomaticUniform({
  62006. size: 1,
  62007. datatype: WebGLConstants_default.FLOAT_MAT3,
  62008. getValue: function(uniformState) {
  62009. return uniformState.normal;
  62010. }
  62011. }),
  62012. czm_normal3D: new AutomaticUniform({
  62013. size: 1,
  62014. datatype: WebGLConstants_default.FLOAT_MAT3,
  62015. getValue: function(uniformState) {
  62016. return uniformState.normal3D;
  62017. }
  62018. }),
  62019. czm_inverseNormal: new AutomaticUniform({
  62020. size: 1,
  62021. datatype: WebGLConstants_default.FLOAT_MAT3,
  62022. getValue: function(uniformState) {
  62023. return uniformState.inverseNormal;
  62024. }
  62025. }),
  62026. czm_inverseNormal3D: new AutomaticUniform({
  62027. size: 1,
  62028. datatype: WebGLConstants_default.FLOAT_MAT3,
  62029. getValue: function(uniformState) {
  62030. return uniformState.inverseNormal3D;
  62031. }
  62032. }),
  62033. czm_eyeHeight: new AutomaticUniform({
  62034. size: 1,
  62035. datatype: WebGLConstants_default.FLOAT,
  62036. getValue: function(uniformState) {
  62037. return uniformState.eyeHeight;
  62038. }
  62039. }),
  62040. czm_eyeHeight2D: new AutomaticUniform({
  62041. size: 1,
  62042. datatype: WebGLConstants_default.FLOAT_VEC2,
  62043. getValue: function(uniformState) {
  62044. return uniformState.eyeHeight2D;
  62045. }
  62046. }),
  62047. czm_entireFrustum: new AutomaticUniform({
  62048. size: 1,
  62049. datatype: WebGLConstants_default.FLOAT_VEC2,
  62050. getValue: function(uniformState) {
  62051. return uniformState.entireFrustum;
  62052. }
  62053. }),
  62054. czm_currentFrustum: new AutomaticUniform({
  62055. size: 1,
  62056. datatype: WebGLConstants_default.FLOAT_VEC2,
  62057. getValue: function(uniformState) {
  62058. return uniformState.currentFrustum;
  62059. }
  62060. }),
  62061. czm_frustumPlanes: new AutomaticUniform({
  62062. size: 1,
  62063. datatype: WebGLConstants_default.FLOAT_VEC4,
  62064. getValue: function(uniformState) {
  62065. return uniformState.frustumPlanes;
  62066. }
  62067. }),
  62068. czm_farDepthFromNearPlusOne: new AutomaticUniform({
  62069. size: 1,
  62070. datatype: WebGLConstants_default.FLOAT,
  62071. getValue: function(uniformState) {
  62072. return uniformState.farDepthFromNearPlusOne;
  62073. }
  62074. }),
  62075. czm_log2FarDepthFromNearPlusOne: new AutomaticUniform({
  62076. size: 1,
  62077. datatype: WebGLConstants_default.FLOAT,
  62078. getValue: function(uniformState) {
  62079. return uniformState.log2FarDepthFromNearPlusOne;
  62080. }
  62081. }),
  62082. czm_oneOverLog2FarDepthFromNearPlusOne: new AutomaticUniform({
  62083. size: 1,
  62084. datatype: WebGLConstants_default.FLOAT,
  62085. getValue: function(uniformState) {
  62086. return uniformState.oneOverLog2FarDepthFromNearPlusOne;
  62087. }
  62088. }),
  62089. czm_sunPositionWC: new AutomaticUniform({
  62090. size: 1,
  62091. datatype: WebGLConstants_default.FLOAT_VEC3,
  62092. getValue: function(uniformState) {
  62093. return uniformState.sunPositionWC;
  62094. }
  62095. }),
  62096. czm_sunPositionColumbusView: new AutomaticUniform({
  62097. size: 1,
  62098. datatype: WebGLConstants_default.FLOAT_VEC3,
  62099. getValue: function(uniformState) {
  62100. return uniformState.sunPositionColumbusView;
  62101. }
  62102. }),
  62103. czm_sunDirectionEC: new AutomaticUniform({
  62104. size: 1,
  62105. datatype: WebGLConstants_default.FLOAT_VEC3,
  62106. getValue: function(uniformState) {
  62107. return uniformState.sunDirectionEC;
  62108. }
  62109. }),
  62110. czm_sunDirectionWC: new AutomaticUniform({
  62111. size: 1,
  62112. datatype: WebGLConstants_default.FLOAT_VEC3,
  62113. getValue: function(uniformState) {
  62114. return uniformState.sunDirectionWC;
  62115. }
  62116. }),
  62117. czm_moonDirectionEC: new AutomaticUniform({
  62118. size: 1,
  62119. datatype: WebGLConstants_default.FLOAT_VEC3,
  62120. getValue: function(uniformState) {
  62121. return uniformState.moonDirectionEC;
  62122. }
  62123. }),
  62124. czm_lightDirectionEC: new AutomaticUniform({
  62125. size: 1,
  62126. datatype: WebGLConstants_default.FLOAT_VEC3,
  62127. getValue: function(uniformState) {
  62128. return uniformState.lightDirectionEC;
  62129. }
  62130. }),
  62131. czm_lightDirectionWC: new AutomaticUniform({
  62132. size: 1,
  62133. datatype: WebGLConstants_default.FLOAT_VEC3,
  62134. getValue: function(uniformState) {
  62135. return uniformState.lightDirectionWC;
  62136. }
  62137. }),
  62138. czm_lightColor: new AutomaticUniform({
  62139. size: 1,
  62140. datatype: WebGLConstants_default.FLOAT_VEC3,
  62141. getValue: function(uniformState) {
  62142. return uniformState.lightColor;
  62143. }
  62144. }),
  62145. czm_lightColorHdr: new AutomaticUniform({
  62146. size: 1,
  62147. datatype: WebGLConstants_default.FLOAT_VEC3,
  62148. getValue: function(uniformState) {
  62149. return uniformState.lightColorHdr;
  62150. }
  62151. }),
  62152. czm_encodedCameraPositionMCHigh: new AutomaticUniform({
  62153. size: 1,
  62154. datatype: WebGLConstants_default.FLOAT_VEC3,
  62155. getValue: function(uniformState) {
  62156. return uniformState.encodedCameraPositionMCHigh;
  62157. }
  62158. }),
  62159. czm_encodedCameraPositionMCLow: new AutomaticUniform({
  62160. size: 1,
  62161. datatype: WebGLConstants_default.FLOAT_VEC3,
  62162. getValue: function(uniformState) {
  62163. return uniformState.encodedCameraPositionMCLow;
  62164. }
  62165. }),
  62166. czm_viewerPositionWC: new AutomaticUniform({
  62167. size: 1,
  62168. datatype: WebGLConstants_default.FLOAT_VEC3,
  62169. getValue: function(uniformState) {
  62170. return Matrix4_default.getTranslation(
  62171. uniformState.inverseView,
  62172. viewerPositionWCScratch
  62173. );
  62174. }
  62175. }),
  62176. czm_frameNumber: new AutomaticUniform({
  62177. size: 1,
  62178. datatype: WebGLConstants_default.FLOAT,
  62179. getValue: function(uniformState) {
  62180. return uniformState.frameState.frameNumber;
  62181. }
  62182. }),
  62183. czm_morphTime: new AutomaticUniform({
  62184. size: 1,
  62185. datatype: WebGLConstants_default.FLOAT,
  62186. getValue: function(uniformState) {
  62187. return uniformState.frameState.morphTime;
  62188. }
  62189. }),
  62190. czm_sceneMode: new AutomaticUniform({
  62191. size: 1,
  62192. datatype: WebGLConstants_default.FLOAT,
  62193. getValue: function(uniformState) {
  62194. return uniformState.frameState.mode;
  62195. }
  62196. }),
  62197. czm_pass: new AutomaticUniform({
  62198. size: 1,
  62199. datatype: WebGLConstants_default.FLOAT,
  62200. getValue: function(uniformState) {
  62201. return uniformState.pass;
  62202. }
  62203. }),
  62204. czm_backgroundColor: new AutomaticUniform({
  62205. size: 1,
  62206. datatype: WebGLConstants_default.FLOAT_VEC4,
  62207. getValue: function(uniformState) {
  62208. return uniformState.backgroundColor;
  62209. }
  62210. }),
  62211. czm_brdfLut: new AutomaticUniform({
  62212. size: 1,
  62213. datatype: WebGLConstants_default.SAMPLER_2D,
  62214. getValue: function(uniformState) {
  62215. return uniformState.brdfLut;
  62216. }
  62217. }),
  62218. czm_environmentMap: new AutomaticUniform({
  62219. size: 1,
  62220. datatype: WebGLConstants_default.SAMPLER_CUBE,
  62221. getValue: function(uniformState) {
  62222. return uniformState.environmentMap;
  62223. }
  62224. }),
  62225. czm_specularEnvironmentMaps: new AutomaticUniform({
  62226. size: 1,
  62227. datatype: WebGLConstants_default.SAMPLER_2D,
  62228. getValue: function(uniformState) {
  62229. return uniformState.specularEnvironmentMaps;
  62230. }
  62231. }),
  62232. czm_specularEnvironmentMapSize: new AutomaticUniform({
  62233. size: 1,
  62234. datatype: WebGLConstants_default.FLOAT_VEC2,
  62235. getValue: function(uniformState) {
  62236. return uniformState.specularEnvironmentMapsDimensions;
  62237. }
  62238. }),
  62239. czm_specularEnvironmentMapsMaximumLOD: new AutomaticUniform({
  62240. size: 1,
  62241. datatype: WebGLConstants_default.FLOAT,
  62242. getValue: function(uniformState) {
  62243. return uniformState.specularEnvironmentMapsMaximumLOD;
  62244. }
  62245. }),
  62246. czm_sphericalHarmonicCoefficients: new AutomaticUniform({
  62247. size: 9,
  62248. datatype: WebGLConstants_default.FLOAT_VEC3,
  62249. getValue: function(uniformState) {
  62250. return uniformState.sphericalHarmonicCoefficients;
  62251. }
  62252. }),
  62253. czm_temeToPseudoFixed: new AutomaticUniform({
  62254. size: 1,
  62255. datatype: WebGLConstants_default.FLOAT_MAT3,
  62256. getValue: function(uniformState) {
  62257. return uniformState.temeToPseudoFixedMatrix;
  62258. }
  62259. }),
  62260. czm_pixelRatio: new AutomaticUniform({
  62261. size: 1,
  62262. datatype: WebGLConstants_default.FLOAT,
  62263. getValue: function(uniformState) {
  62264. return uniformState.pixelRatio;
  62265. }
  62266. }),
  62267. czm_fogDensity: new AutomaticUniform({
  62268. size: 1,
  62269. datatype: WebGLConstants_default.FLOAT,
  62270. getValue: function(uniformState) {
  62271. return uniformState.fogDensity;
  62272. }
  62273. }),
  62274. czm_splitPosition: new AutomaticUniform({
  62275. size: 1,
  62276. datatype: WebGLConstants_default.FLOAT,
  62277. getValue: function(uniformState) {
  62278. return uniformState.splitPosition;
  62279. }
  62280. }),
  62281. czm_imagerySplitPosition: new AutomaticUniform({
  62282. size: 1,
  62283. datatype: WebGLConstants_default.FLOAT,
  62284. getValue: function(uniformState) {
  62285. return uniformState.imagerySplitPosition;
  62286. }
  62287. }),
  62288. czm_geometricToleranceOverMeter: new AutomaticUniform({
  62289. size: 1,
  62290. datatype: WebGLConstants_default.FLOAT,
  62291. getValue: function(uniformState) {
  62292. return uniformState.geometricToleranceOverMeter;
  62293. }
  62294. }),
  62295. czm_minimumDisableDepthTestDistance: new AutomaticUniform({
  62296. size: 1,
  62297. datatype: WebGLConstants_default.FLOAT,
  62298. getValue: function(uniformState) {
  62299. return uniformState.minimumDisableDepthTestDistance;
  62300. }
  62301. }),
  62302. czm_invertClassificationColor: new AutomaticUniform({
  62303. size: 1,
  62304. datatype: WebGLConstants_default.FLOAT_VEC4,
  62305. getValue: function(uniformState) {
  62306. return uniformState.invertClassificationColor;
  62307. }
  62308. }),
  62309. czm_gamma: new AutomaticUniform({
  62310. size: 1,
  62311. datatype: WebGLConstants_default.FLOAT,
  62312. getValue: function(uniformState) {
  62313. return uniformState.gamma;
  62314. }
  62315. }),
  62316. czm_ellipsoidRadii: new AutomaticUniform({
  62317. size: 1,
  62318. datatype: WebGLConstants_default.FLOAT_VEC3,
  62319. getValue: function(uniformState) {
  62320. return uniformState.ellipsoid.radii;
  62321. }
  62322. }),
  62323. czm_ellipsoidInverseRadii: new AutomaticUniform({
  62324. size: 1,
  62325. datatype: WebGLConstants_default.FLOAT_VEC3,
  62326. getValue: function(uniformState) {
  62327. return uniformState.ellipsoid.oneOverRadii;
  62328. }
  62329. })
  62330. };
  62331. var AutomaticUniforms_default = AutomaticUniforms;
  62332. // node_modules/cesium/Source/Renderer/createUniform.js
  62333. function createUniform2(gl, activeUniform, uniformName, location2) {
  62334. switch (activeUniform.type) {
  62335. case gl.FLOAT:
  62336. return new UniformFloat(gl, activeUniform, uniformName, location2);
  62337. case gl.FLOAT_VEC2:
  62338. return new UniformFloatVec2(gl, activeUniform, uniformName, location2);
  62339. case gl.FLOAT_VEC3:
  62340. return new UniformFloatVec3(gl, activeUniform, uniformName, location2);
  62341. case gl.FLOAT_VEC4:
  62342. return new UniformFloatVec4(gl, activeUniform, uniformName, location2);
  62343. case gl.SAMPLER_2D:
  62344. case gl.SAMPLER_CUBE:
  62345. return new UniformSampler(gl, activeUniform, uniformName, location2);
  62346. case gl.INT:
  62347. case gl.BOOL:
  62348. return new UniformInt(gl, activeUniform, uniformName, location2);
  62349. case gl.INT_VEC2:
  62350. case gl.BOOL_VEC2:
  62351. return new UniformIntVec2(gl, activeUniform, uniformName, location2);
  62352. case gl.INT_VEC3:
  62353. case gl.BOOL_VEC3:
  62354. return new UniformIntVec3(gl, activeUniform, uniformName, location2);
  62355. case gl.INT_VEC4:
  62356. case gl.BOOL_VEC4:
  62357. return new UniformIntVec4(gl, activeUniform, uniformName, location2);
  62358. case gl.FLOAT_MAT2:
  62359. return new UniformMat2(gl, activeUniform, uniformName, location2);
  62360. case gl.FLOAT_MAT3:
  62361. return new UniformMat3(gl, activeUniform, uniformName, location2);
  62362. case gl.FLOAT_MAT4:
  62363. return new UniformMat4(gl, activeUniform, uniformName, location2);
  62364. default:
  62365. throw new RuntimeError_default(
  62366. `Unrecognized uniform type: ${activeUniform.type} for uniform "${uniformName}".`
  62367. );
  62368. }
  62369. }
  62370. function UniformFloat(gl, activeUniform, uniformName, location2) {
  62371. this.name = uniformName;
  62372. this.value = void 0;
  62373. this._value = 0;
  62374. this._gl = gl;
  62375. this._location = location2;
  62376. }
  62377. UniformFloat.prototype.set = function() {
  62378. if (this.value !== this._value) {
  62379. this._value = this.value;
  62380. this._gl.uniform1f(this._location, this.value);
  62381. }
  62382. };
  62383. function UniformFloatVec2(gl, activeUniform, uniformName, location2) {
  62384. this.name = uniformName;
  62385. this.value = void 0;
  62386. this._value = new Cartesian2_default();
  62387. this._gl = gl;
  62388. this._location = location2;
  62389. }
  62390. UniformFloatVec2.prototype.set = function() {
  62391. const v7 = this.value;
  62392. if (!Cartesian2_default.equals(v7, this._value)) {
  62393. Cartesian2_default.clone(v7, this._value);
  62394. this._gl.uniform2f(this._location, v7.x, v7.y);
  62395. }
  62396. };
  62397. function UniformFloatVec3(gl, activeUniform, uniformName, location2) {
  62398. this.name = uniformName;
  62399. this.value = void 0;
  62400. this._value = void 0;
  62401. this._gl = gl;
  62402. this._location = location2;
  62403. }
  62404. UniformFloatVec3.prototype.set = function() {
  62405. const v7 = this.value;
  62406. if (defined_default(v7.red)) {
  62407. if (!Color_default.equals(v7, this._value)) {
  62408. this._value = Color_default.clone(v7, this._value);
  62409. this._gl.uniform3f(this._location, v7.red, v7.green, v7.blue);
  62410. }
  62411. } else if (defined_default(v7.x)) {
  62412. if (!Cartesian3_default.equals(v7, this._value)) {
  62413. this._value = Cartesian3_default.clone(v7, this._value);
  62414. this._gl.uniform3f(this._location, v7.x, v7.y, v7.z);
  62415. }
  62416. } else {
  62417. throw new DeveloperError_default(`Invalid vec3 value for uniform "${this.name}".`);
  62418. }
  62419. };
  62420. function UniformFloatVec4(gl, activeUniform, uniformName, location2) {
  62421. this.name = uniformName;
  62422. this.value = void 0;
  62423. this._value = void 0;
  62424. this._gl = gl;
  62425. this._location = location2;
  62426. }
  62427. UniformFloatVec4.prototype.set = function() {
  62428. const v7 = this.value;
  62429. if (defined_default(v7.red)) {
  62430. if (!Color_default.equals(v7, this._value)) {
  62431. this._value = Color_default.clone(v7, this._value);
  62432. this._gl.uniform4f(this._location, v7.red, v7.green, v7.blue, v7.alpha);
  62433. }
  62434. } else if (defined_default(v7.x)) {
  62435. if (!Cartesian4_default.equals(v7, this._value)) {
  62436. this._value = Cartesian4_default.clone(v7, this._value);
  62437. this._gl.uniform4f(this._location, v7.x, v7.y, v7.z, v7.w);
  62438. }
  62439. } else {
  62440. throw new DeveloperError_default(`Invalid vec4 value for uniform "${this.name}".`);
  62441. }
  62442. };
  62443. function UniformSampler(gl, activeUniform, uniformName, location2) {
  62444. this.name = uniformName;
  62445. this.value = void 0;
  62446. this._gl = gl;
  62447. this._location = location2;
  62448. this.textureUnitIndex = void 0;
  62449. }
  62450. UniformSampler.prototype.set = function() {
  62451. const gl = this._gl;
  62452. gl.activeTexture(gl.TEXTURE0 + this.textureUnitIndex);
  62453. const v7 = this.value;
  62454. gl.bindTexture(v7._target, v7._texture);
  62455. };
  62456. UniformSampler.prototype._setSampler = function(textureUnitIndex) {
  62457. this.textureUnitIndex = textureUnitIndex;
  62458. this._gl.uniform1i(this._location, textureUnitIndex);
  62459. return textureUnitIndex + 1;
  62460. };
  62461. function UniformInt(gl, activeUniform, uniformName, location2) {
  62462. this.name = uniformName;
  62463. this.value = void 0;
  62464. this._value = 0;
  62465. this._gl = gl;
  62466. this._location = location2;
  62467. }
  62468. UniformInt.prototype.set = function() {
  62469. if (this.value !== this._value) {
  62470. this._value = this.value;
  62471. this._gl.uniform1i(this._location, this.value);
  62472. }
  62473. };
  62474. function UniformIntVec2(gl, activeUniform, uniformName, location2) {
  62475. this.name = uniformName;
  62476. this.value = void 0;
  62477. this._value = new Cartesian2_default();
  62478. this._gl = gl;
  62479. this._location = location2;
  62480. }
  62481. UniformIntVec2.prototype.set = function() {
  62482. const v7 = this.value;
  62483. if (!Cartesian2_default.equals(v7, this._value)) {
  62484. Cartesian2_default.clone(v7, this._value);
  62485. this._gl.uniform2i(this._location, v7.x, v7.y);
  62486. }
  62487. };
  62488. function UniformIntVec3(gl, activeUniform, uniformName, location2) {
  62489. this.name = uniformName;
  62490. this.value = void 0;
  62491. this._value = new Cartesian3_default();
  62492. this._gl = gl;
  62493. this._location = location2;
  62494. }
  62495. UniformIntVec3.prototype.set = function() {
  62496. const v7 = this.value;
  62497. if (!Cartesian3_default.equals(v7, this._value)) {
  62498. Cartesian3_default.clone(v7, this._value);
  62499. this._gl.uniform3i(this._location, v7.x, v7.y, v7.z);
  62500. }
  62501. };
  62502. function UniformIntVec4(gl, activeUniform, uniformName, location2) {
  62503. this.name = uniformName;
  62504. this.value = void 0;
  62505. this._value = new Cartesian4_default();
  62506. this._gl = gl;
  62507. this._location = location2;
  62508. }
  62509. UniformIntVec4.prototype.set = function() {
  62510. const v7 = this.value;
  62511. if (!Cartesian4_default.equals(v7, this._value)) {
  62512. Cartesian4_default.clone(v7, this._value);
  62513. this._gl.uniform4i(this._location, v7.x, v7.y, v7.z, v7.w);
  62514. }
  62515. };
  62516. var scratchUniformArray = new Float32Array(4);
  62517. function UniformMat2(gl, activeUniform, uniformName, location2) {
  62518. this.name = uniformName;
  62519. this.value = void 0;
  62520. this._value = new Matrix2_default();
  62521. this._gl = gl;
  62522. this._location = location2;
  62523. }
  62524. UniformMat2.prototype.set = function() {
  62525. if (!Matrix2_default.equalsArray(this.value, this._value, 0)) {
  62526. Matrix2_default.clone(this.value, this._value);
  62527. const array = Matrix2_default.toArray(this.value, scratchUniformArray);
  62528. this._gl.uniformMatrix2fv(this._location, false, array);
  62529. }
  62530. };
  62531. var scratchMat3Array = new Float32Array(9);
  62532. function UniformMat3(gl, activeUniform, uniformName, location2) {
  62533. this.name = uniformName;
  62534. this.value = void 0;
  62535. this._value = new Matrix3_default();
  62536. this._gl = gl;
  62537. this._location = location2;
  62538. }
  62539. UniformMat3.prototype.set = function() {
  62540. if (!Matrix3_default.equalsArray(this.value, this._value, 0)) {
  62541. Matrix3_default.clone(this.value, this._value);
  62542. const array = Matrix3_default.toArray(this.value, scratchMat3Array);
  62543. this._gl.uniformMatrix3fv(this._location, false, array);
  62544. }
  62545. };
  62546. var scratchMat4Array = new Float32Array(16);
  62547. function UniformMat4(gl, activeUniform, uniformName, location2) {
  62548. this.name = uniformName;
  62549. this.value = void 0;
  62550. this._value = new Matrix4_default();
  62551. this._gl = gl;
  62552. this._location = location2;
  62553. }
  62554. UniformMat4.prototype.set = function() {
  62555. if (!Matrix4_default.equalsArray(this.value, this._value, 0)) {
  62556. Matrix4_default.clone(this.value, this._value);
  62557. const array = Matrix4_default.toArray(this.value, scratchMat4Array);
  62558. this._gl.uniformMatrix4fv(this._location, false, array);
  62559. }
  62560. };
  62561. var createUniform_default = createUniform2;
  62562. // node_modules/cesium/Source/Renderer/createUniformArray.js
  62563. function createUniformArray(gl, activeUniform, uniformName, locations) {
  62564. switch (activeUniform.type) {
  62565. case gl.FLOAT:
  62566. return new UniformArrayFloat(gl, activeUniform, uniformName, locations);
  62567. case gl.FLOAT_VEC2:
  62568. return new UniformArrayFloatVec2(
  62569. gl,
  62570. activeUniform,
  62571. uniformName,
  62572. locations
  62573. );
  62574. case gl.FLOAT_VEC3:
  62575. return new UniformArrayFloatVec3(
  62576. gl,
  62577. activeUniform,
  62578. uniformName,
  62579. locations
  62580. );
  62581. case gl.FLOAT_VEC4:
  62582. return new UniformArrayFloatVec4(
  62583. gl,
  62584. activeUniform,
  62585. uniformName,
  62586. locations
  62587. );
  62588. case gl.SAMPLER_2D:
  62589. case gl.SAMPLER_CUBE:
  62590. return new UniformArraySampler(gl, activeUniform, uniformName, locations);
  62591. case gl.INT:
  62592. case gl.BOOL:
  62593. return new UniformArrayInt(gl, activeUniform, uniformName, locations);
  62594. case gl.INT_VEC2:
  62595. case gl.BOOL_VEC2:
  62596. return new UniformArrayIntVec2(gl, activeUniform, uniformName, locations);
  62597. case gl.INT_VEC3:
  62598. case gl.BOOL_VEC3:
  62599. return new UniformArrayIntVec3(gl, activeUniform, uniformName, locations);
  62600. case gl.INT_VEC4:
  62601. case gl.BOOL_VEC4:
  62602. return new UniformArrayIntVec4(gl, activeUniform, uniformName, locations);
  62603. case gl.FLOAT_MAT2:
  62604. return new UniformArrayMat2(gl, activeUniform, uniformName, locations);
  62605. case gl.FLOAT_MAT3:
  62606. return new UniformArrayMat3(gl, activeUniform, uniformName, locations);
  62607. case gl.FLOAT_MAT4:
  62608. return new UniformArrayMat4(gl, activeUniform, uniformName, locations);
  62609. default:
  62610. throw new RuntimeError_default(
  62611. `Unrecognized uniform type: ${activeUniform.type} for uniform "${uniformName}".`
  62612. );
  62613. }
  62614. }
  62615. function UniformArrayFloat(gl, activeUniform, uniformName, locations) {
  62616. const length3 = locations.length;
  62617. this.name = uniformName;
  62618. this.value = new Array(length3);
  62619. this._value = new Float32Array(length3);
  62620. this._gl = gl;
  62621. this._location = locations[0];
  62622. }
  62623. UniformArrayFloat.prototype.set = function() {
  62624. const value = this.value;
  62625. const length3 = value.length;
  62626. const arraybuffer = this._value;
  62627. let changed = false;
  62628. for (let i2 = 0; i2 < length3; ++i2) {
  62629. const v7 = value[i2];
  62630. if (v7 !== arraybuffer[i2]) {
  62631. arraybuffer[i2] = v7;
  62632. changed = true;
  62633. }
  62634. }
  62635. if (changed) {
  62636. this._gl.uniform1fv(this._location, arraybuffer);
  62637. }
  62638. };
  62639. function UniformArrayFloatVec2(gl, activeUniform, uniformName, locations) {
  62640. const length3 = locations.length;
  62641. this.name = uniformName;
  62642. this.value = new Array(length3);
  62643. this._value = new Float32Array(length3 * 2);
  62644. this._gl = gl;
  62645. this._location = locations[0];
  62646. }
  62647. UniformArrayFloatVec2.prototype.set = function() {
  62648. const value = this.value;
  62649. const length3 = value.length;
  62650. const arraybuffer = this._value;
  62651. let changed = false;
  62652. let j = 0;
  62653. for (let i2 = 0; i2 < length3; ++i2) {
  62654. const v7 = value[i2];
  62655. if (!Cartesian2_default.equalsArray(v7, arraybuffer, j)) {
  62656. Cartesian2_default.pack(v7, arraybuffer, j);
  62657. changed = true;
  62658. }
  62659. j += 2;
  62660. }
  62661. if (changed) {
  62662. this._gl.uniform2fv(this._location, arraybuffer);
  62663. }
  62664. };
  62665. function UniformArrayFloatVec3(gl, activeUniform, uniformName, locations) {
  62666. const length3 = locations.length;
  62667. this.name = uniformName;
  62668. this.value = new Array(length3);
  62669. this._value = new Float32Array(length3 * 3);
  62670. this._gl = gl;
  62671. this._location = locations[0];
  62672. }
  62673. UniformArrayFloatVec3.prototype.set = function() {
  62674. const value = this.value;
  62675. const length3 = value.length;
  62676. const arraybuffer = this._value;
  62677. let changed = false;
  62678. let j = 0;
  62679. for (let i2 = 0; i2 < length3; ++i2) {
  62680. const v7 = value[i2];
  62681. if (defined_default(v7.red)) {
  62682. if (v7.red !== arraybuffer[j] || v7.green !== arraybuffer[j + 1] || v7.blue !== arraybuffer[j + 2]) {
  62683. arraybuffer[j] = v7.red;
  62684. arraybuffer[j + 1] = v7.green;
  62685. arraybuffer[j + 2] = v7.blue;
  62686. changed = true;
  62687. }
  62688. } else if (defined_default(v7.x)) {
  62689. if (!Cartesian3_default.equalsArray(v7, arraybuffer, j)) {
  62690. Cartesian3_default.pack(v7, arraybuffer, j);
  62691. changed = true;
  62692. }
  62693. } else {
  62694. throw new DeveloperError_default("Invalid vec3 value.");
  62695. }
  62696. j += 3;
  62697. }
  62698. if (changed) {
  62699. this._gl.uniform3fv(this._location, arraybuffer);
  62700. }
  62701. };
  62702. function UniformArrayFloatVec4(gl, activeUniform, uniformName, locations) {
  62703. const length3 = locations.length;
  62704. this.name = uniformName;
  62705. this.value = new Array(length3);
  62706. this._value = new Float32Array(length3 * 4);
  62707. this._gl = gl;
  62708. this._location = locations[0];
  62709. }
  62710. UniformArrayFloatVec4.prototype.set = function() {
  62711. const value = this.value;
  62712. const length3 = value.length;
  62713. const arraybuffer = this._value;
  62714. let changed = false;
  62715. let j = 0;
  62716. for (let i2 = 0; i2 < length3; ++i2) {
  62717. const v7 = value[i2];
  62718. if (defined_default(v7.red)) {
  62719. if (!Color_default.equalsArray(v7, arraybuffer, j)) {
  62720. Color_default.pack(v7, arraybuffer, j);
  62721. changed = true;
  62722. }
  62723. } else if (defined_default(v7.x)) {
  62724. if (!Cartesian4_default.equalsArray(v7, arraybuffer, j)) {
  62725. Cartesian4_default.pack(v7, arraybuffer, j);
  62726. changed = true;
  62727. }
  62728. } else {
  62729. throw new DeveloperError_default("Invalid vec4 value.");
  62730. }
  62731. j += 4;
  62732. }
  62733. if (changed) {
  62734. this._gl.uniform4fv(this._location, arraybuffer);
  62735. }
  62736. };
  62737. function UniformArraySampler(gl, activeUniform, uniformName, locations) {
  62738. const length3 = locations.length;
  62739. this.name = uniformName;
  62740. this.value = new Array(length3);
  62741. this._value = new Float32Array(length3);
  62742. this._gl = gl;
  62743. this._locations = locations;
  62744. this.textureUnitIndex = void 0;
  62745. }
  62746. UniformArraySampler.prototype.set = function() {
  62747. const gl = this._gl;
  62748. const textureUnitIndex = gl.TEXTURE0 + this.textureUnitIndex;
  62749. const value = this.value;
  62750. const length3 = value.length;
  62751. for (let i2 = 0; i2 < length3; ++i2) {
  62752. const v7 = value[i2];
  62753. gl.activeTexture(textureUnitIndex + i2);
  62754. gl.bindTexture(v7._target, v7._texture);
  62755. }
  62756. };
  62757. UniformArraySampler.prototype._setSampler = function(textureUnitIndex) {
  62758. this.textureUnitIndex = textureUnitIndex;
  62759. const locations = this._locations;
  62760. const length3 = locations.length;
  62761. for (let i2 = 0; i2 < length3; ++i2) {
  62762. const index2 = textureUnitIndex + i2;
  62763. this._gl.uniform1i(locations[i2], index2);
  62764. }
  62765. return textureUnitIndex + length3;
  62766. };
  62767. function UniformArrayInt(gl, activeUniform, uniformName, locations) {
  62768. const length3 = locations.length;
  62769. this.name = uniformName;
  62770. this.value = new Array(length3);
  62771. this._value = new Int32Array(length3);
  62772. this._gl = gl;
  62773. this._location = locations[0];
  62774. }
  62775. UniformArrayInt.prototype.set = function() {
  62776. const value = this.value;
  62777. const length3 = value.length;
  62778. const arraybuffer = this._value;
  62779. let changed = false;
  62780. for (let i2 = 0; i2 < length3; ++i2) {
  62781. const v7 = value[i2];
  62782. if (v7 !== arraybuffer[i2]) {
  62783. arraybuffer[i2] = v7;
  62784. changed = true;
  62785. }
  62786. }
  62787. if (changed) {
  62788. this._gl.uniform1iv(this._location, arraybuffer);
  62789. }
  62790. };
  62791. function UniformArrayIntVec2(gl, activeUniform, uniformName, locations) {
  62792. const length3 = locations.length;
  62793. this.name = uniformName;
  62794. this.value = new Array(length3);
  62795. this._value = new Int32Array(length3 * 2);
  62796. this._gl = gl;
  62797. this._location = locations[0];
  62798. }
  62799. UniformArrayIntVec2.prototype.set = function() {
  62800. const value = this.value;
  62801. const length3 = value.length;
  62802. const arraybuffer = this._value;
  62803. let changed = false;
  62804. let j = 0;
  62805. for (let i2 = 0; i2 < length3; ++i2) {
  62806. const v7 = value[i2];
  62807. if (!Cartesian2_default.equalsArray(v7, arraybuffer, j)) {
  62808. Cartesian2_default.pack(v7, arraybuffer, j);
  62809. changed = true;
  62810. }
  62811. j += 2;
  62812. }
  62813. if (changed) {
  62814. this._gl.uniform2iv(this._location, arraybuffer);
  62815. }
  62816. };
  62817. function UniformArrayIntVec3(gl, activeUniform, uniformName, locations) {
  62818. const length3 = locations.length;
  62819. this.name = uniformName;
  62820. this.value = new Array(length3);
  62821. this._value = new Int32Array(length3 * 3);
  62822. this._gl = gl;
  62823. this._location = locations[0];
  62824. }
  62825. UniformArrayIntVec3.prototype.set = function() {
  62826. const value = this.value;
  62827. const length3 = value.length;
  62828. const arraybuffer = this._value;
  62829. let changed = false;
  62830. let j = 0;
  62831. for (let i2 = 0; i2 < length3; ++i2) {
  62832. const v7 = value[i2];
  62833. if (!Cartesian3_default.equalsArray(v7, arraybuffer, j)) {
  62834. Cartesian3_default.pack(v7, arraybuffer, j);
  62835. changed = true;
  62836. }
  62837. j += 3;
  62838. }
  62839. if (changed) {
  62840. this._gl.uniform3iv(this._location, arraybuffer);
  62841. }
  62842. };
  62843. function UniformArrayIntVec4(gl, activeUniform, uniformName, locations) {
  62844. const length3 = locations.length;
  62845. this.name = uniformName;
  62846. this.value = new Array(length3);
  62847. this._value = new Int32Array(length3 * 4);
  62848. this._gl = gl;
  62849. this._location = locations[0];
  62850. }
  62851. UniformArrayIntVec4.prototype.set = function() {
  62852. const value = this.value;
  62853. const length3 = value.length;
  62854. const arraybuffer = this._value;
  62855. let changed = false;
  62856. let j = 0;
  62857. for (let i2 = 0; i2 < length3; ++i2) {
  62858. const v7 = value[i2];
  62859. if (!Cartesian4_default.equalsArray(v7, arraybuffer, j)) {
  62860. Cartesian4_default.pack(v7, arraybuffer, j);
  62861. changed = true;
  62862. }
  62863. j += 4;
  62864. }
  62865. if (changed) {
  62866. this._gl.uniform4iv(this._location, arraybuffer);
  62867. }
  62868. };
  62869. function UniformArrayMat2(gl, activeUniform, uniformName, locations) {
  62870. const length3 = locations.length;
  62871. this.name = uniformName;
  62872. this.value = new Array(length3);
  62873. this._value = new Float32Array(length3 * 4);
  62874. this._gl = gl;
  62875. this._location = locations[0];
  62876. }
  62877. UniformArrayMat2.prototype.set = function() {
  62878. const value = this.value;
  62879. const length3 = value.length;
  62880. const arraybuffer = this._value;
  62881. let changed = false;
  62882. let j = 0;
  62883. for (let i2 = 0; i2 < length3; ++i2) {
  62884. const v7 = value[i2];
  62885. if (!Matrix2_default.equalsArray(v7, arraybuffer, j)) {
  62886. Matrix2_default.pack(v7, arraybuffer, j);
  62887. changed = true;
  62888. }
  62889. j += 4;
  62890. }
  62891. if (changed) {
  62892. this._gl.uniformMatrix2fv(this._location, false, arraybuffer);
  62893. }
  62894. };
  62895. function UniformArrayMat3(gl, activeUniform, uniformName, locations) {
  62896. const length3 = locations.length;
  62897. this.name = uniformName;
  62898. this.value = new Array(length3);
  62899. this._value = new Float32Array(length3 * 9);
  62900. this._gl = gl;
  62901. this._location = locations[0];
  62902. }
  62903. UniformArrayMat3.prototype.set = function() {
  62904. const value = this.value;
  62905. const length3 = value.length;
  62906. const arraybuffer = this._value;
  62907. let changed = false;
  62908. let j = 0;
  62909. for (let i2 = 0; i2 < length3; ++i2) {
  62910. const v7 = value[i2];
  62911. if (!Matrix3_default.equalsArray(v7, arraybuffer, j)) {
  62912. Matrix3_default.pack(v7, arraybuffer, j);
  62913. changed = true;
  62914. }
  62915. j += 9;
  62916. }
  62917. if (changed) {
  62918. this._gl.uniformMatrix3fv(this._location, false, arraybuffer);
  62919. }
  62920. };
  62921. function UniformArrayMat4(gl, activeUniform, uniformName, locations) {
  62922. const length3 = locations.length;
  62923. this.name = uniformName;
  62924. this.value = new Array(length3);
  62925. this._value = new Float32Array(length3 * 16);
  62926. this._gl = gl;
  62927. this._location = locations[0];
  62928. }
  62929. UniformArrayMat4.prototype.set = function() {
  62930. const value = this.value;
  62931. const length3 = value.length;
  62932. const arraybuffer = this._value;
  62933. let changed = false;
  62934. let j = 0;
  62935. for (let i2 = 0; i2 < length3; ++i2) {
  62936. const v7 = value[i2];
  62937. if (!Matrix4_default.equalsArray(v7, arraybuffer, j)) {
  62938. Matrix4_default.pack(v7, arraybuffer, j);
  62939. changed = true;
  62940. }
  62941. j += 16;
  62942. }
  62943. if (changed) {
  62944. this._gl.uniformMatrix4fv(this._location, false, arraybuffer);
  62945. }
  62946. };
  62947. var createUniformArray_default = createUniformArray;
  62948. // node_modules/cesium/Source/Renderer/ShaderProgram.js
  62949. var nextShaderProgramId = 0;
  62950. function ShaderProgram(options) {
  62951. let vertexShaderText = options.vertexShaderText;
  62952. let fragmentShaderText = options.fragmentShaderText;
  62953. if (typeof spector !== "undefined") {
  62954. vertexShaderText = vertexShaderText.replace(/^#line/gm, "//#line");
  62955. fragmentShaderText = fragmentShaderText.replace(/^#line/gm, "//#line");
  62956. }
  62957. const modifiedFS = handleUniformPrecisionMismatches(
  62958. vertexShaderText,
  62959. fragmentShaderText
  62960. );
  62961. this._gl = options.gl;
  62962. this._logShaderCompilation = options.logShaderCompilation;
  62963. this._debugShaders = options.debugShaders;
  62964. this._attributeLocations = options.attributeLocations;
  62965. this._program = void 0;
  62966. this._numberOfVertexAttributes = void 0;
  62967. this._vertexAttributes = void 0;
  62968. this._uniformsByName = void 0;
  62969. this._uniforms = void 0;
  62970. this._automaticUniforms = void 0;
  62971. this._manualUniforms = void 0;
  62972. this._duplicateUniformNames = modifiedFS.duplicateUniformNames;
  62973. this._cachedShader = void 0;
  62974. this.maximumTextureUnitIndex = void 0;
  62975. this._vertexShaderSource = options.vertexShaderSource;
  62976. this._vertexShaderText = options.vertexShaderText;
  62977. this._fragmentShaderSource = options.fragmentShaderSource;
  62978. this._fragmentShaderText = modifiedFS.fragmentShaderText;
  62979. this.id = nextShaderProgramId++;
  62980. }
  62981. ShaderProgram.fromCache = function(options) {
  62982. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  62983. Check_default.defined("options.context", options.context);
  62984. return options.context.shaderCache.getShaderProgram(options);
  62985. };
  62986. ShaderProgram.replaceCache = function(options) {
  62987. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  62988. Check_default.defined("options.context", options.context);
  62989. return options.context.shaderCache.replaceShaderProgram(options);
  62990. };
  62991. Object.defineProperties(ShaderProgram.prototype, {
  62992. vertexShaderSource: {
  62993. get: function() {
  62994. return this._vertexShaderSource;
  62995. }
  62996. },
  62997. fragmentShaderSource: {
  62998. get: function() {
  62999. return this._fragmentShaderSource;
  63000. }
  63001. },
  63002. vertexAttributes: {
  63003. get: function() {
  63004. initialize2(this);
  63005. return this._vertexAttributes;
  63006. }
  63007. },
  63008. numberOfVertexAttributes: {
  63009. get: function() {
  63010. initialize2(this);
  63011. return this._numberOfVertexAttributes;
  63012. }
  63013. },
  63014. allUniforms: {
  63015. get: function() {
  63016. initialize2(this);
  63017. return this._uniformsByName;
  63018. }
  63019. }
  63020. });
  63021. function extractUniforms(shaderText) {
  63022. const uniformNames = [];
  63023. const uniformLines = shaderText.match(/uniform.*?(?![^{]*})(?=[=\[;])/g);
  63024. if (defined_default(uniformLines)) {
  63025. const len = uniformLines.length;
  63026. for (let i2 = 0; i2 < len; i2++) {
  63027. const line = uniformLines[i2].trim();
  63028. const name = line.slice(line.lastIndexOf(" ") + 1);
  63029. uniformNames.push(name);
  63030. }
  63031. }
  63032. return uniformNames;
  63033. }
  63034. function handleUniformPrecisionMismatches(vertexShaderText, fragmentShaderText) {
  63035. const duplicateUniformNames = {};
  63036. if (!ContextLimits_default.highpFloatSupported || !ContextLimits_default.highpIntSupported) {
  63037. let i2, j;
  63038. let uniformName;
  63039. let duplicateName;
  63040. const vertexShaderUniforms = extractUniforms(vertexShaderText);
  63041. const fragmentShaderUniforms = extractUniforms(fragmentShaderText);
  63042. const vertexUniformsCount = vertexShaderUniforms.length;
  63043. const fragmentUniformsCount = fragmentShaderUniforms.length;
  63044. for (i2 = 0; i2 < vertexUniformsCount; i2++) {
  63045. for (j = 0; j < fragmentUniformsCount; j++) {
  63046. if (vertexShaderUniforms[i2] === fragmentShaderUniforms[j]) {
  63047. uniformName = vertexShaderUniforms[i2];
  63048. duplicateName = `czm_mediump_${uniformName}`;
  63049. const re = new RegExp(`${uniformName}\\b`, "g");
  63050. fragmentShaderText = fragmentShaderText.replace(re, duplicateName);
  63051. duplicateUniformNames[duplicateName] = uniformName;
  63052. }
  63053. }
  63054. }
  63055. }
  63056. return {
  63057. fragmentShaderText,
  63058. duplicateUniformNames
  63059. };
  63060. }
  63061. var consolePrefix = "[Cesium WebGL] ";
  63062. function createAndLinkProgram(gl, shader) {
  63063. const vsSource = shader._vertexShaderText;
  63064. const fsSource = shader._fragmentShaderText;
  63065. const vertexShader = gl.createShader(gl.VERTEX_SHADER);
  63066. gl.shaderSource(vertexShader, vsSource);
  63067. gl.compileShader(vertexShader);
  63068. const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
  63069. gl.shaderSource(fragmentShader, fsSource);
  63070. gl.compileShader(fragmentShader);
  63071. const program = gl.createProgram();
  63072. gl.attachShader(program, vertexShader);
  63073. gl.attachShader(program, fragmentShader);
  63074. gl.deleteShader(vertexShader);
  63075. gl.deleteShader(fragmentShader);
  63076. const attributeLocations8 = shader._attributeLocations;
  63077. if (defined_default(attributeLocations8)) {
  63078. for (const attribute in attributeLocations8) {
  63079. if (attributeLocations8.hasOwnProperty(attribute)) {
  63080. gl.bindAttribLocation(
  63081. program,
  63082. attributeLocations8[attribute],
  63083. attribute
  63084. );
  63085. }
  63086. }
  63087. }
  63088. gl.linkProgram(program);
  63089. let log;
  63090. if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
  63091. const debugShaders = shader._debugShaders;
  63092. if (!gl.getShaderParameter(fragmentShader, gl.COMPILE_STATUS)) {
  63093. log = gl.getShaderInfoLog(fragmentShader);
  63094. console.error(`${consolePrefix}Fragment shader compile log: ${log}`);
  63095. if (defined_default(debugShaders)) {
  63096. const fragmentSourceTranslation = debugShaders.getTranslatedShaderSource(
  63097. fragmentShader
  63098. );
  63099. if (fragmentSourceTranslation !== "") {
  63100. console.error(
  63101. `${consolePrefix}Translated fragment shader source:
  63102. ${fragmentSourceTranslation}`
  63103. );
  63104. } else {
  63105. console.error(`${consolePrefix}Fragment shader translation failed.`);
  63106. }
  63107. }
  63108. gl.deleteProgram(program);
  63109. throw new RuntimeError_default(
  63110. `Fragment shader failed to compile. Compile log: ${log}`
  63111. );
  63112. }
  63113. if (!gl.getShaderParameter(vertexShader, gl.COMPILE_STATUS)) {
  63114. log = gl.getShaderInfoLog(vertexShader);
  63115. console.error(`${consolePrefix}Vertex shader compile log: ${log}`);
  63116. if (defined_default(debugShaders)) {
  63117. const vertexSourceTranslation = debugShaders.getTranslatedShaderSource(
  63118. vertexShader
  63119. );
  63120. if (vertexSourceTranslation !== "") {
  63121. console.error(
  63122. `${consolePrefix}Translated vertex shader source:
  63123. ${vertexSourceTranslation}`
  63124. );
  63125. } else {
  63126. console.error(`${consolePrefix}Vertex shader translation failed.`);
  63127. }
  63128. }
  63129. gl.deleteProgram(program);
  63130. throw new RuntimeError_default(
  63131. `Vertex shader failed to compile. Compile log: ${log}`
  63132. );
  63133. }
  63134. log = gl.getProgramInfoLog(program);
  63135. console.error(`${consolePrefix}Shader program link log: ${log}`);
  63136. if (defined_default(debugShaders)) {
  63137. console.error(
  63138. `${consolePrefix}Translated vertex shader source:
  63139. ${debugShaders.getTranslatedShaderSource(
  63140. vertexShader
  63141. )}`
  63142. );
  63143. console.error(
  63144. `${consolePrefix}Translated fragment shader source:
  63145. ${debugShaders.getTranslatedShaderSource(
  63146. fragmentShader
  63147. )}`
  63148. );
  63149. }
  63150. gl.deleteProgram(program);
  63151. throw new RuntimeError_default(`Program failed to link. Link log: ${log}`);
  63152. }
  63153. const logShaderCompilation = shader._logShaderCompilation;
  63154. if (logShaderCompilation) {
  63155. log = gl.getShaderInfoLog(vertexShader);
  63156. if (defined_default(log) && log.length > 0) {
  63157. console.log(`${consolePrefix}Vertex shader compile log: ${log}`);
  63158. }
  63159. }
  63160. if (logShaderCompilation) {
  63161. log = gl.getShaderInfoLog(fragmentShader);
  63162. if (defined_default(log) && log.length > 0) {
  63163. console.log(`${consolePrefix}Fragment shader compile log: ${log}`);
  63164. }
  63165. }
  63166. if (logShaderCompilation) {
  63167. log = gl.getProgramInfoLog(program);
  63168. if (defined_default(log) && log.length > 0) {
  63169. console.log(`${consolePrefix}Shader program link log: ${log}`);
  63170. }
  63171. }
  63172. return program;
  63173. }
  63174. function findVertexAttributes(gl, program, numberOfAttributes2) {
  63175. const attributes = {};
  63176. for (let i2 = 0; i2 < numberOfAttributes2; ++i2) {
  63177. const attr = gl.getActiveAttrib(program, i2);
  63178. const location2 = gl.getAttribLocation(program, attr.name);
  63179. attributes[attr.name] = {
  63180. name: attr.name,
  63181. type: attr.type,
  63182. index: location2
  63183. };
  63184. }
  63185. return attributes;
  63186. }
  63187. function findUniforms(gl, program) {
  63188. const uniformsByName = {};
  63189. const uniforms = [];
  63190. const samplerUniforms = [];
  63191. const numberOfUniforms = gl.getProgramParameter(program, gl.ACTIVE_UNIFORMS);
  63192. for (let i2 = 0; i2 < numberOfUniforms; ++i2) {
  63193. const activeUniform = gl.getActiveUniform(program, i2);
  63194. const suffix = "[0]";
  63195. const uniformName = activeUniform.name.indexOf(
  63196. suffix,
  63197. activeUniform.name.length - suffix.length
  63198. ) !== -1 ? activeUniform.name.slice(0, activeUniform.name.length - 3) : activeUniform.name;
  63199. if (uniformName.indexOf("gl_") !== 0) {
  63200. if (activeUniform.name.indexOf("[") < 0) {
  63201. const location2 = gl.getUniformLocation(program, uniformName);
  63202. if (location2 !== null) {
  63203. const uniform = createUniform_default(
  63204. gl,
  63205. activeUniform,
  63206. uniformName,
  63207. location2
  63208. );
  63209. uniformsByName[uniformName] = uniform;
  63210. uniforms.push(uniform);
  63211. if (uniform._setSampler) {
  63212. samplerUniforms.push(uniform);
  63213. }
  63214. }
  63215. } else {
  63216. let uniformArray;
  63217. let locations;
  63218. let value;
  63219. let loc;
  63220. const indexOfBracket = uniformName.indexOf("[");
  63221. if (indexOfBracket >= 0) {
  63222. uniformArray = uniformsByName[uniformName.slice(0, indexOfBracket)];
  63223. if (!defined_default(uniformArray)) {
  63224. continue;
  63225. }
  63226. locations = uniformArray._locations;
  63227. if (locations.length <= 1) {
  63228. value = uniformArray.value;
  63229. loc = gl.getUniformLocation(program, uniformName);
  63230. if (loc !== null) {
  63231. locations.push(loc);
  63232. value.push(gl.getUniform(program, loc));
  63233. }
  63234. }
  63235. } else {
  63236. locations = [];
  63237. for (let j = 0; j < activeUniform.size; ++j) {
  63238. loc = gl.getUniformLocation(program, `${uniformName}[${j}]`);
  63239. if (loc !== null) {
  63240. locations.push(loc);
  63241. }
  63242. }
  63243. uniformArray = createUniformArray_default(
  63244. gl,
  63245. activeUniform,
  63246. uniformName,
  63247. locations
  63248. );
  63249. uniformsByName[uniformName] = uniformArray;
  63250. uniforms.push(uniformArray);
  63251. if (uniformArray._setSampler) {
  63252. samplerUniforms.push(uniformArray);
  63253. }
  63254. }
  63255. }
  63256. }
  63257. }
  63258. return {
  63259. uniformsByName,
  63260. uniforms,
  63261. samplerUniforms
  63262. };
  63263. }
  63264. function partitionUniforms(shader, uniforms) {
  63265. const automaticUniforms = [];
  63266. const manualUniforms = [];
  63267. for (const uniform in uniforms) {
  63268. if (uniforms.hasOwnProperty(uniform)) {
  63269. const uniformObject = uniforms[uniform];
  63270. let uniformName = uniform;
  63271. const duplicateUniform = shader._duplicateUniformNames[uniformName];
  63272. if (defined_default(duplicateUniform)) {
  63273. uniformObject.name = duplicateUniform;
  63274. uniformName = duplicateUniform;
  63275. }
  63276. const automaticUniform = AutomaticUniforms_default[uniformName];
  63277. if (defined_default(automaticUniform)) {
  63278. automaticUniforms.push({
  63279. uniform: uniformObject,
  63280. automaticUniform
  63281. });
  63282. } else {
  63283. manualUniforms.push(uniformObject);
  63284. }
  63285. }
  63286. }
  63287. return {
  63288. automaticUniforms,
  63289. manualUniforms
  63290. };
  63291. }
  63292. function setSamplerUniforms(gl, program, samplerUniforms) {
  63293. gl.useProgram(program);
  63294. let textureUnitIndex = 0;
  63295. const length3 = samplerUniforms.length;
  63296. for (let i2 = 0; i2 < length3; ++i2) {
  63297. textureUnitIndex = samplerUniforms[i2]._setSampler(textureUnitIndex);
  63298. }
  63299. gl.useProgram(null);
  63300. return textureUnitIndex;
  63301. }
  63302. function initialize2(shader) {
  63303. if (defined_default(shader._program)) {
  63304. return;
  63305. }
  63306. reinitialize(shader);
  63307. }
  63308. function reinitialize(shader) {
  63309. const oldProgram = shader._program;
  63310. const gl = shader._gl;
  63311. const program = createAndLinkProgram(gl, shader, shader._debugShaders);
  63312. const numberOfVertexAttributes = gl.getProgramParameter(
  63313. program,
  63314. gl.ACTIVE_ATTRIBUTES
  63315. );
  63316. const uniforms = findUniforms(gl, program);
  63317. const partitionedUniforms = partitionUniforms(
  63318. shader,
  63319. uniforms.uniformsByName
  63320. );
  63321. shader._program = program;
  63322. shader._numberOfVertexAttributes = numberOfVertexAttributes;
  63323. shader._vertexAttributes = findVertexAttributes(
  63324. gl,
  63325. program,
  63326. numberOfVertexAttributes
  63327. );
  63328. shader._uniformsByName = uniforms.uniformsByName;
  63329. shader._uniforms = uniforms.uniforms;
  63330. shader._automaticUniforms = partitionedUniforms.automaticUniforms;
  63331. shader._manualUniforms = partitionedUniforms.manualUniforms;
  63332. shader.maximumTextureUnitIndex = setSamplerUniforms(
  63333. gl,
  63334. program,
  63335. uniforms.samplerUniforms
  63336. );
  63337. if (oldProgram) {
  63338. shader._gl.deleteProgram(oldProgram);
  63339. }
  63340. if (typeof spector !== "undefined") {
  63341. shader._program.__SPECTOR_rebuildProgram = function(vertexSourceCode, fragmentSourceCode, onCompiled, onError) {
  63342. const originalVS = shader._vertexShaderText;
  63343. const originalFS = shader._fragmentShaderText;
  63344. const regex = / ! = /g;
  63345. shader._vertexShaderText = vertexSourceCode.replace(regex, " != ");
  63346. shader._fragmentShaderText = fragmentSourceCode.replace(regex, " != ");
  63347. try {
  63348. reinitialize(shader);
  63349. onCompiled(shader._program);
  63350. } catch (e2) {
  63351. shader._vertexShaderText = originalVS;
  63352. shader._fragmentShaderText = originalFS;
  63353. const errorMatcher = /(?:Compile|Link) error: ([^]*)/;
  63354. const match = errorMatcher.exec(e2.message);
  63355. if (match) {
  63356. onError(match[1]);
  63357. } else {
  63358. onError(e2.message);
  63359. }
  63360. }
  63361. };
  63362. }
  63363. }
  63364. ShaderProgram.prototype._bind = function() {
  63365. initialize2(this);
  63366. this._gl.useProgram(this._program);
  63367. };
  63368. ShaderProgram.prototype._setUniforms = function(uniformMap2, uniformState, validate) {
  63369. let len;
  63370. let i2;
  63371. if (defined_default(uniformMap2)) {
  63372. const manualUniforms = this._manualUniforms;
  63373. len = manualUniforms.length;
  63374. for (i2 = 0; i2 < len; ++i2) {
  63375. const mu = manualUniforms[i2];
  63376. mu.value = uniformMap2[mu.name]();
  63377. }
  63378. }
  63379. const automaticUniforms = this._automaticUniforms;
  63380. len = automaticUniforms.length;
  63381. for (i2 = 0; i2 < len; ++i2) {
  63382. const au = automaticUniforms[i2];
  63383. au.uniform.value = au.automaticUniform.getValue(uniformState);
  63384. }
  63385. const uniforms = this._uniforms;
  63386. len = uniforms.length;
  63387. for (i2 = 0; i2 < len; ++i2) {
  63388. uniforms[i2].set();
  63389. }
  63390. if (validate) {
  63391. const gl = this._gl;
  63392. const program = this._program;
  63393. gl.validateProgram(program);
  63394. if (!gl.getProgramParameter(program, gl.VALIDATE_STATUS)) {
  63395. throw new DeveloperError_default(
  63396. `Program validation failed. Program info log: ${gl.getProgramInfoLog(
  63397. program
  63398. )}`
  63399. );
  63400. }
  63401. }
  63402. };
  63403. ShaderProgram.prototype.isDestroyed = function() {
  63404. return false;
  63405. };
  63406. ShaderProgram.prototype.destroy = function() {
  63407. this._cachedShader.cache.releaseShaderProgram(this);
  63408. return void 0;
  63409. };
  63410. ShaderProgram.prototype.finalDestroy = function() {
  63411. this._gl.deleteProgram(this._program);
  63412. return destroyObject_default(this);
  63413. };
  63414. var ShaderProgram_default = ShaderProgram;
  63415. // node_modules/cesium/Source/Renderer/modernizeShader.js
  63416. function modernizeShader(source, isFragmentShader) {
  63417. const outputDeclarationRegex = /#define OUTPUT_DECLARATION/;
  63418. const splitSource = source.split("\n");
  63419. if (/#version 300 es/g.test(source)) {
  63420. return source;
  63421. }
  63422. let outputDeclarationLine = -1;
  63423. let i2, line;
  63424. for (i2 = 0; i2 < splitSource.length; ++i2) {
  63425. line = splitSource[i2];
  63426. if (outputDeclarationRegex.test(line)) {
  63427. outputDeclarationLine = i2;
  63428. break;
  63429. }
  63430. }
  63431. if (outputDeclarationLine === -1) {
  63432. throw new DeveloperError_default("Could not find a #define OUTPUT_DECLARATION!");
  63433. }
  63434. const outputVariables = [];
  63435. for (i2 = 0; i2 < 10; i2++) {
  63436. const fragDataString = `gl_FragData\\[${i2}\\]`;
  63437. const newOutput = `czm_out${i2}`;
  63438. const regex = new RegExp(fragDataString, "g");
  63439. if (regex.test(source)) {
  63440. setAdd(newOutput, outputVariables);
  63441. replaceInSourceString(fragDataString, newOutput, splitSource);
  63442. splitSource.splice(
  63443. outputDeclarationLine,
  63444. 0,
  63445. `layout(location = ${i2}) out vec4 ${newOutput};`
  63446. );
  63447. outputDeclarationLine += 1;
  63448. }
  63449. }
  63450. const czmFragColor = "czm_fragColor";
  63451. if (findInSource("gl_FragColor", splitSource)) {
  63452. setAdd(czmFragColor, outputVariables);
  63453. replaceInSourceString("gl_FragColor", czmFragColor, splitSource);
  63454. splitSource.splice(
  63455. outputDeclarationLine,
  63456. 0,
  63457. "layout(location = 0) out vec4 czm_fragColor;"
  63458. );
  63459. outputDeclarationLine += 1;
  63460. }
  63461. const variableMap = getVariablePreprocessorBranch(
  63462. outputVariables,
  63463. splitSource
  63464. );
  63465. const lineAdds = {};
  63466. for (i2 = 0; i2 < splitSource.length; i2++) {
  63467. line = splitSource[i2];
  63468. for (const variable in variableMap) {
  63469. if (variableMap.hasOwnProperty(variable)) {
  63470. const matchVar = new RegExp(
  63471. `(layout)[^]+(out)[^]+(${variable})[^]+`,
  63472. "g"
  63473. );
  63474. if (matchVar.test(line)) {
  63475. lineAdds[line] = variable;
  63476. }
  63477. }
  63478. }
  63479. }
  63480. for (const layoutDeclaration in lineAdds) {
  63481. if (lineAdds.hasOwnProperty(layoutDeclaration)) {
  63482. const variableName = lineAdds[layoutDeclaration];
  63483. let lineNumber = splitSource.indexOf(layoutDeclaration);
  63484. const entry = variableMap[variableName];
  63485. const depth = entry.length;
  63486. for (let d = 0; d < depth; d++) {
  63487. splitSource.splice(lineNumber, 0, entry[d]);
  63488. }
  63489. lineNumber += depth + 1;
  63490. for (let d = depth - 1; d >= 0; d--) {
  63491. splitSource.splice(lineNumber, 0, `#endif //${entry[d]}`);
  63492. }
  63493. }
  63494. }
  63495. const webgl2UniqueID = "WEBGL_2";
  63496. const webgl2DefineMacro = `#define ${webgl2UniqueID}`;
  63497. const versionThree = "#version 300 es";
  63498. let foundVersion = false;
  63499. for (i2 = 0; i2 < splitSource.length; i2++) {
  63500. if (/#version/.test(splitSource[i2])) {
  63501. splitSource[i2] = versionThree;
  63502. foundVersion = true;
  63503. break;
  63504. }
  63505. }
  63506. if (!foundVersion) {
  63507. splitSource.splice(0, 0, versionThree);
  63508. }
  63509. splitSource.splice(1, 0, webgl2DefineMacro);
  63510. removeExtension("EXT_draw_buffers", webgl2UniqueID, splitSource);
  63511. removeExtension("EXT_frag_depth", webgl2UniqueID, splitSource);
  63512. removeExtension("OES_standard_derivatives", webgl2UniqueID, splitSource);
  63513. replaceInSourceString("texture2D", "texture", splitSource);
  63514. replaceInSourceString("texture3D", "texture", splitSource);
  63515. replaceInSourceString("textureCube", "texture", splitSource);
  63516. replaceInSourceString("gl_FragDepthEXT", "gl_FragDepth", splitSource);
  63517. if (isFragmentShader) {
  63518. replaceInSourceString("varying", "in", splitSource);
  63519. } else {
  63520. replaceInSourceString("attribute", "in", splitSource);
  63521. replaceInSourceString("varying", "out", splitSource);
  63522. }
  63523. return compileSource(splitSource);
  63524. }
  63525. function replaceInSourceString(str, replacement, splitSource) {
  63526. const regexStr = `(^|[^\\w])(${str})($|[^\\w])`;
  63527. const regex = new RegExp(regexStr, "g");
  63528. const splitSourceLength = splitSource.length;
  63529. for (let i2 = 0; i2 < splitSourceLength; ++i2) {
  63530. const line = splitSource[i2];
  63531. splitSource[i2] = line.replace(regex, `$1${replacement}$3`);
  63532. }
  63533. }
  63534. function replaceInSourceRegex(regex, replacement, splitSource) {
  63535. const splitSourceLength = splitSource.length;
  63536. for (let i2 = 0; i2 < splitSourceLength; ++i2) {
  63537. const line = splitSource[i2];
  63538. splitSource[i2] = line.replace(regex, replacement);
  63539. }
  63540. }
  63541. function findInSource(str, splitSource) {
  63542. const regexStr = `(^|[^\\w])(${str})($|[^\\w])`;
  63543. const regex = new RegExp(regexStr, "g");
  63544. const splitSourceLength = splitSource.length;
  63545. for (let i2 = 0; i2 < splitSourceLength; ++i2) {
  63546. const line = splitSource[i2];
  63547. if (regex.test(line)) {
  63548. return true;
  63549. }
  63550. }
  63551. return false;
  63552. }
  63553. function compileSource(splitSource) {
  63554. let wholeSource = "";
  63555. const splitSourceLength = splitSource.length;
  63556. for (let i2 = 0; i2 < splitSourceLength; ++i2) {
  63557. wholeSource += `${splitSource[i2]}
  63558. `;
  63559. }
  63560. return wholeSource;
  63561. }
  63562. function setAdd(variable, set2) {
  63563. if (set2.indexOf(variable) === -1) {
  63564. set2.push(variable);
  63565. }
  63566. }
  63567. function getVariablePreprocessorBranch(layoutVariables, splitSource) {
  63568. const variableMap = {};
  63569. const numLayoutVariables = layoutVariables.length;
  63570. const stack = [];
  63571. for (let i2 = 0; i2 < splitSource.length; ++i2) {
  63572. const line = splitSource[i2];
  63573. const hasIF = /(#ifdef|#if)/g.test(line);
  63574. const hasELSE = /#else/g.test(line);
  63575. const hasENDIF = /#endif/g.test(line);
  63576. if (hasIF) {
  63577. stack.push(line);
  63578. } else if (hasELSE) {
  63579. const top = stack[stack.length - 1];
  63580. let op = top.replace("ifdef", "ifndef");
  63581. if (/if/g.test(op)) {
  63582. op = op.replace(/(#if\s+)(\S*)([^]*)/, "$1!($2)$3");
  63583. }
  63584. stack.pop();
  63585. stack.push(op);
  63586. } else if (hasENDIF) {
  63587. stack.pop();
  63588. } else if (!/layout/g.test(line)) {
  63589. for (let varIndex = 0; varIndex < numLayoutVariables; ++varIndex) {
  63590. const varName = layoutVariables[varIndex];
  63591. if (line.indexOf(varName) !== -1) {
  63592. if (!defined_default(variableMap[varName])) {
  63593. variableMap[varName] = stack.slice();
  63594. } else {
  63595. variableMap[varName] = variableMap[varName].filter(function(x) {
  63596. return stack.indexOf(x) >= 0;
  63597. });
  63598. }
  63599. }
  63600. }
  63601. }
  63602. }
  63603. return variableMap;
  63604. }
  63605. function removeExtension(name, webgl2UniqueID, splitSource) {
  63606. const regex = `#extension\\s+GL_${name}\\s+:\\s+[a-zA-Z0-9]+\\s*$`;
  63607. replaceInSourceRegex(new RegExp(regex, "g"), "", splitSource);
  63608. replaceInSourceString(`GL_${name}`, webgl2UniqueID, splitSource);
  63609. }
  63610. var modernizeShader_default = modernizeShader;
  63611. // node_modules/cesium/Source/Shaders/Builtin/Constants/degreesPerRadian.js
  63612. var degreesPerRadian_default = "/**\n * A built-in GLSL floating-point constant for converting radians to degrees.\n *\n * @alias czm_degreesPerRadian\n * @glslConstant\n *\n * @see CesiumMath.DEGREES_PER_RADIAN\n *\n * @example\n * // GLSL declaration\n * const float czm_degreesPerRadian = ...;\n *\n * // Example\n * float deg = czm_degreesPerRadian * rad;\n */\nconst float czm_degreesPerRadian = 57.29577951308232;\n";
  63613. // node_modules/cesium/Source/Shaders/Builtin/Constants/depthRange.js
  63614. var depthRange_default = "/**\n * A built-in GLSL vec2 constant for defining the depth range.\n * This is a workaround to a bug where IE11 does not implement gl_DepthRange.\n *\n * @alias czm_depthRange\n * @glslConstant\n *\n * @example\n * // GLSL declaration\n * float depthRangeNear = czm_depthRange.near;\n * float depthRangeFar = czm_depthRange.far;\n *\n */\nconst czm_depthRangeStruct czm_depthRange = czm_depthRangeStruct(0.0, 1.0);\n";
  63615. // node_modules/cesium/Source/Shaders/Builtin/Constants/epsilon1.js
  63616. var epsilon1_default = "/**\n * 0.1\n *\n * @name czm_epsilon1\n * @glslConstant\n */\nconst float czm_epsilon1 = 0.1;\n";
  63617. // node_modules/cesium/Source/Shaders/Builtin/Constants/epsilon2.js
  63618. var epsilon2_default = "/**\n * 0.01\n *\n * @name czm_epsilon2\n * @glslConstant\n */\nconst float czm_epsilon2 = 0.01;\n";
  63619. // node_modules/cesium/Source/Shaders/Builtin/Constants/epsilon3.js
  63620. var epsilon3_default = "/**\n * 0.001\n *\n * @name czm_epsilon3\n * @glslConstant\n */\nconst float czm_epsilon3 = 0.001;\n";
  63621. // node_modules/cesium/Source/Shaders/Builtin/Constants/epsilon4.js
  63622. var epsilon4_default = "/**\n * 0.0001\n *\n * @name czm_epsilon4\n * @glslConstant\n */\nconst float czm_epsilon4 = 0.0001;\n";
  63623. // node_modules/cesium/Source/Shaders/Builtin/Constants/epsilon5.js
  63624. var epsilon5_default = "/**\n * 0.00001\n *\n * @name czm_epsilon5\n * @glslConstant\n */\nconst float czm_epsilon5 = 0.00001;\n";
  63625. // node_modules/cesium/Source/Shaders/Builtin/Constants/epsilon6.js
  63626. var epsilon6_default = "/**\n * 0.000001\n *\n * @name czm_epsilon6\n * @glslConstant\n */\nconst float czm_epsilon6 = 0.000001;\n";
  63627. // node_modules/cesium/Source/Shaders/Builtin/Constants/epsilon7.js
  63628. var epsilon7_default = "/**\n * 0.0000001\n *\n * @name czm_epsilon7\n * @glslConstant\n */\nconst float czm_epsilon7 = 0.0000001;\n";
  63629. // node_modules/cesium/Source/Shaders/Builtin/Constants/infinity.js
  63630. var infinity_default = "/**\n * DOC_TBA\n *\n * @name czm_infinity\n * @glslConstant\n */\nconst float czm_infinity = 5906376272000.0; // Distance from the Sun to Pluto in meters. TODO: What is best given lowp, mediump, and highp?\n";
  63631. // node_modules/cesium/Source/Shaders/Builtin/Constants/oneOverPi.js
  63632. var oneOverPi_default = "/**\n * A built-in GLSL floating-point constant for <code>1/pi</code>.\n *\n * @alias czm_oneOverPi\n * @glslConstant\n *\n * @see CesiumMath.ONE_OVER_PI\n *\n * @example\n * // GLSL declaration\n * const float czm_oneOverPi = ...;\n *\n * // Example\n * float pi = 1.0 / czm_oneOverPi;\n */\nconst float czm_oneOverPi = 0.3183098861837907;\n";
  63633. // node_modules/cesium/Source/Shaders/Builtin/Constants/oneOverTwoPi.js
  63634. var oneOverTwoPi_default = "/**\n * A built-in GLSL floating-point constant for <code>1/2pi</code>.\n *\n * @alias czm_oneOverTwoPi\n * @glslConstant\n *\n * @see CesiumMath.ONE_OVER_TWO_PI\n *\n * @example\n * // GLSL declaration\n * const float czm_oneOverTwoPi = ...;\n *\n * // Example\n * float pi = 2.0 * czm_oneOverTwoPi;\n */\nconst float czm_oneOverTwoPi = 0.15915494309189535;\n";
  63635. // node_modules/cesium/Source/Shaders/Builtin/Constants/passCesium3DTile.js
  63636. var passCesium3DTile_default = "/**\n * The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE}\n *\n * @name czm_passCesium3DTile\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passCesium3DTile = 4.0;\n";
  63637. // node_modules/cesium/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js
  63638. var passCesium3DTileClassification_default = "/**\n * The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_CLASSIFICATION}\n *\n * @name czm_passCesium3DTileClassification\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passCesium3DTileClassification = 5.0;\n";
  63639. // node_modules/cesium/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js
  63640. var passCesium3DTileClassificationIgnoreShow_default = "/**\n * The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW}\n *\n * @name czm_passCesium3DTileClassificationIgnoreShow\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passCesium3DTileClassificationIgnoreShow = 6.0;\n";
  63641. // node_modules/cesium/Source/Shaders/Builtin/Constants/passClassification.js
  63642. var passClassification_default = "/**\n * The automatic GLSL constant for {@link Pass#CLASSIFICATION}\n *\n * @name czm_passClassification\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passClassification = 7.0;\n";
  63643. // node_modules/cesium/Source/Shaders/Builtin/Constants/passCompute.js
  63644. var passCompute_default = "/**\n * The automatic GLSL constant for {@link Pass#COMPUTE}\n *\n * @name czm_passCompute\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passCompute = 1.0;\n";
  63645. // node_modules/cesium/Source/Shaders/Builtin/Constants/passEnvironment.js
  63646. var passEnvironment_default = "/**\n * The automatic GLSL constant for {@link Pass#ENVIRONMENT}\n *\n * @name czm_passEnvironment\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passEnvironment = 0.0;\n";
  63647. // node_modules/cesium/Source/Shaders/Builtin/Constants/passGlobe.js
  63648. var passGlobe_default = "/**\n * The automatic GLSL constant for {@link Pass#GLOBE}\n *\n * @name czm_passGlobe\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passGlobe = 2.0;\n";
  63649. // node_modules/cesium/Source/Shaders/Builtin/Constants/passOpaque.js
  63650. var passOpaque_default = "/**\n * The automatic GLSL constant for {@link Pass#OPAQUE}\n *\n * @name czm_passOpaque\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passOpaque = 7.0;\n";
  63651. // node_modules/cesium/Source/Shaders/Builtin/Constants/passOverlay.js
  63652. var passOverlay_default = "/**\n * The automatic GLSL constant for {@link Pass#OVERLAY}\n *\n * @name czm_passOverlay\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passOverlay = 9.0;\n";
  63653. // node_modules/cesium/Source/Shaders/Builtin/Constants/passTerrainClassification.js
  63654. var passTerrainClassification_default = "/**\n * The automatic GLSL constant for {@link Pass#TERRAIN_CLASSIFICATION}\n *\n * @name czm_passTerrainClassification\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passTerrainClassification = 3.0;\n";
  63655. // node_modules/cesium/Source/Shaders/Builtin/Constants/passTranslucent.js
  63656. var passTranslucent_default = "/**\n * The automatic GLSL constant for {@link Pass#TRANSLUCENT}\n *\n * @name czm_passTranslucent\n * @glslConstant\n *\n * @see czm_pass\n */\nconst float czm_passTranslucent = 8.0;\n";
  63657. // node_modules/cesium/Source/Shaders/Builtin/Constants/pi.js
  63658. var pi_default = "/**\n * A built-in GLSL floating-point constant for <code>Math.PI</code>.\n *\n * @alias czm_pi\n * @glslConstant\n *\n * @see CesiumMath.PI\n *\n * @example\n * // GLSL declaration\n * const float czm_pi = ...;\n *\n * // Example\n * float twoPi = 2.0 * czm_pi;\n */\nconst float czm_pi = 3.141592653589793;\n";
  63659. // node_modules/cesium/Source/Shaders/Builtin/Constants/piOverFour.js
  63660. var piOverFour_default = "/**\n * A built-in GLSL floating-point constant for <code>pi/4</code>.\n *\n * @alias czm_piOverFour\n * @glslConstant\n *\n * @see CesiumMath.PI_OVER_FOUR\n *\n * @example\n * // GLSL declaration\n * const float czm_piOverFour = ...;\n *\n * // Example\n * float pi = 4.0 * czm_piOverFour;\n */\nconst float czm_piOverFour = 0.7853981633974483;\n";
  63661. // node_modules/cesium/Source/Shaders/Builtin/Constants/piOverSix.js
  63662. var piOverSix_default = "/**\n * A built-in GLSL floating-point constant for <code>pi/6</code>.\n *\n * @alias czm_piOverSix\n * @glslConstant\n *\n * @see CesiumMath.PI_OVER_SIX\n *\n * @example\n * // GLSL declaration\n * const float czm_piOverSix = ...;\n *\n * // Example\n * float pi = 6.0 * czm_piOverSix;\n */\nconst float czm_piOverSix = 0.5235987755982988;\n";
  63663. // node_modules/cesium/Source/Shaders/Builtin/Constants/piOverThree.js
  63664. var piOverThree_default = "/**\n * A built-in GLSL floating-point constant for <code>pi/3</code>.\n *\n * @alias czm_piOverThree\n * @glslConstant\n *\n * @see CesiumMath.PI_OVER_THREE\n *\n * @example\n * // GLSL declaration\n * const float czm_piOverThree = ...;\n *\n * // Example\n * float pi = 3.0 * czm_piOverThree;\n */\nconst float czm_piOverThree = 1.0471975511965976;\n";
  63665. // node_modules/cesium/Source/Shaders/Builtin/Constants/piOverTwo.js
  63666. var piOverTwo_default = "/**\n * A built-in GLSL floating-point constant for <code>pi/2</code>.\n *\n * @alias czm_piOverTwo\n * @glslConstant\n *\n * @see CesiumMath.PI_OVER_TWO\n *\n * @example\n * // GLSL declaration\n * const float czm_piOverTwo = ...;\n *\n * // Example\n * float pi = 2.0 * czm_piOverTwo;\n */\nconst float czm_piOverTwo = 1.5707963267948966;\n";
  63667. // node_modules/cesium/Source/Shaders/Builtin/Constants/radiansPerDegree.js
  63668. var radiansPerDegree_default = "/**\n * A built-in GLSL floating-point constant for converting degrees to radians.\n *\n * @alias czm_radiansPerDegree\n * @glslConstant\n *\n * @see CesiumMath.RADIANS_PER_DEGREE\n *\n * @example\n * // GLSL declaration\n * const float czm_radiansPerDegree = ...;\n *\n * // Example\n * float rad = czm_radiansPerDegree * deg;\n */\nconst float czm_radiansPerDegree = 0.017453292519943295;\n";
  63669. // node_modules/cesium/Source/Shaders/Builtin/Constants/sceneMode2D.js
  63670. var sceneMode2D_default = "/**\n * The constant identifier for the 2D {@link SceneMode}\n *\n * @name czm_sceneMode2D\n * @glslConstant\n * @see czm_sceneMode\n * @see czm_sceneModeColumbusView\n * @see czm_sceneMode3D\n * @see czm_sceneModeMorphing\n */\nconst float czm_sceneMode2D = 2.0;\n";
  63671. // node_modules/cesium/Source/Shaders/Builtin/Constants/sceneMode3D.js
  63672. var sceneMode3D_default = "/**\n * The constant identifier for the 3D {@link SceneMode}\n *\n * @name czm_sceneMode3D\n * @glslConstant\n * @see czm_sceneMode\n * @see czm_sceneMode2D\n * @see czm_sceneModeColumbusView\n * @see czm_sceneModeMorphing\n */\nconst float czm_sceneMode3D = 3.0;\n";
  63673. // node_modules/cesium/Source/Shaders/Builtin/Constants/sceneModeColumbusView.js
  63674. var sceneModeColumbusView_default = "/**\n * The constant identifier for the Columbus View {@link SceneMode}\n *\n * @name czm_sceneModeColumbusView\n * @glslConstant\n * @see czm_sceneMode\n * @see czm_sceneMode2D\n * @see czm_sceneMode3D\n * @see czm_sceneModeMorphing\n */\nconst float czm_sceneModeColumbusView = 1.0;\n";
  63675. // node_modules/cesium/Source/Shaders/Builtin/Constants/sceneModeMorphing.js
  63676. var sceneModeMorphing_default = "/**\n * The constant identifier for the Morphing {@link SceneMode}\n *\n * @name czm_sceneModeMorphing\n * @glslConstant\n * @see czm_sceneMode\n * @see czm_sceneMode2D\n * @see czm_sceneModeColumbusView\n * @see czm_sceneMode3D\n */\nconst float czm_sceneModeMorphing = 0.0;\n";
  63677. // node_modules/cesium/Source/Shaders/Builtin/Constants/solarRadius.js
  63678. var solarRadius_default = "/**\n * A built-in GLSL floating-point constant for one solar radius.\n *\n * @alias czm_solarRadius\n * @glslConstant\n *\n * @see CesiumMath.SOLAR_RADIUS\n *\n * @example\n * // GLSL declaration\n * const float czm_solarRadius = ...;\n */\nconst float czm_solarRadius = 695500000.0;\n";
  63679. // node_modules/cesium/Source/Shaders/Builtin/Constants/threePiOver2.js
  63680. var threePiOver2_default = "/**\n * A built-in GLSL floating-point constant for <code>3pi/2</code>.\n *\n * @alias czm_threePiOver2\n * @glslConstant\n *\n * @see CesiumMath.THREE_PI_OVER_TWO\n *\n * @example\n * // GLSL declaration\n * const float czm_threePiOver2 = ...;\n *\n * // Example\n * float pi = (2.0 / 3.0) * czm_threePiOver2;\n */\nconst float czm_threePiOver2 = 4.71238898038469;\n";
  63681. // node_modules/cesium/Source/Shaders/Builtin/Constants/twoPi.js
  63682. var twoPi_default = "/**\n * A built-in GLSL floating-point constant for <code>2pi</code>.\n *\n * @alias czm_twoPi\n * @glslConstant\n *\n * @see CesiumMath.TWO_PI\n *\n * @example\n * // GLSL declaration\n * const float czm_twoPi = ...;\n *\n * // Example\n * float pi = czm_twoPi / 2.0;\n */\nconst float czm_twoPi = 6.283185307179586;\n";
  63683. // node_modules/cesium/Source/Shaders/Builtin/Constants/webMercatorMaxLatitude.js
  63684. var webMercatorMaxLatitude_default = "/**\n * The maximum latitude, in radians, both North and South, supported by a Web Mercator\n * (EPSG:3857) projection. Technically, the Mercator projection is defined\n * for any latitude up to (but not including) 90 degrees, but it makes sense\n * to cut it off sooner because it grows exponentially with increasing latitude.\n * The logic behind this particular cutoff value, which is the one used by\n * Google Maps, Bing Maps, and Esri, is that it makes the projection\n * square. That is, the rectangle is equal in the X and Y directions.\n *\n * The constant value is computed as follows:\n * czm_pi * 0.5 - (2.0 * atan(exp(-czm_pi)))\n *\n * @name czm_webMercatorMaxLatitude\n * @glslConstant\n */\nconst float czm_webMercatorMaxLatitude = 1.4844222297453324;\n";
  63685. // node_modules/cesium/Source/Shaders/Builtin/Structs/depthRangeStruct.js
  63686. var depthRangeStruct_default = "/**\n * @name czm_depthRangeStruct\n * @glslStruct\n */\nstruct czm_depthRangeStruct\n{\n float near;\n float far;\n};\n";
  63687. // node_modules/cesium/Source/Shaders/Builtin/Structs/material.js
  63688. var material_default = "/**\n * Holds material information that can be used for lighting. Returned by all czm_getMaterial functions.\n *\n * @name czm_material\n * @glslStruct\n *\n * @property {vec3} diffuse Incoming light that scatters evenly in all directions.\n * @property {float} specular Intensity of incoming light reflecting in a single direction.\n * @property {float} shininess The sharpness of the specular reflection. Higher values create a smaller, more focused specular highlight.\n * @property {vec3} normal Surface's normal in eye coordinates. It is used for effects such as normal mapping. The default is the surface's unmodified normal.\n * @property {vec3} emission Light emitted by the material equally in all directions. The default is vec3(0.0), which emits no light.\n * @property {float} alpha Alpha of this material. 0.0 is completely transparent; 1.0 is completely opaque.\n */\nstruct czm_material\n{\n vec3 diffuse;\n float specular;\n float shininess;\n vec3 normal;\n vec3 emission;\n float alpha;\n};\n";
  63689. // node_modules/cesium/Source/Shaders/Builtin/Structs/materialInput.js
  63690. var materialInput_default = "/**\n * Used as input to every material's czm_getMaterial function.\n *\n * @name czm_materialInput\n * @glslStruct\n *\n * @property {float} s 1D texture coordinates.\n * @property {vec2} st 2D texture coordinates.\n * @property {vec3} str 3D texture coordinates.\n * @property {vec3} normalEC Unperturbed surface normal in eye coordinates.\n * @property {mat3} tangentToEyeMatrix Matrix for converting a tangent space normal to eye space.\n * @property {vec3} positionToEyeEC Vector from the fragment to the eye in eye coordinates. The magnitude is the distance in meters from the fragment to the eye.\n * @property {float} height The height of the terrain in meters above or below the WGS84 ellipsoid. Only available for globe materials.\n * @property {float} slope The slope of the terrain in radians. 0 is flat; pi/2 is vertical. Only available for globe materials.\n * @property {float} aspect The aspect of the terrain in radians. 0 is East, pi/2 is North, pi is West, 3pi/2 is South. Only available for globe materials.\n */\nstruct czm_materialInput\n{\n float s;\n vec2 st;\n vec3 str;\n vec3 normalEC;\n mat3 tangentToEyeMatrix;\n vec3 positionToEyeEC;\n float height;\n float slope;\n float aspect;\n};\n";
  63691. // node_modules/cesium/Source/Shaders/Builtin/Structs/modelMaterial.js
  63692. var modelMaterial_default = "/**\n * Struct for representing a material for a {@link ModelExperimental}. The model\n * rendering pipeline will pass this struct between material, custom shaders,\n * and lighting stages. This is not to be confused with {@link czm_material}\n * which is used by the older Fabric materials system, although they are similar\n *\n * @name czm_modelMaterial\n * @glslStruct\n *\n * @property {vec3} diffuse Incoming light that scatters evenly in all directions.\n * @property {float} alpha Alpha of this material. 0.0 is completely transparent; 1.0 is completely opaque.\n * @property {vec3} specular Color of reflected light at normal incidence in PBR materials. This is sometimes referred to as f0 in the literature.\n * @property {float} roughness A number from 0.0 to 1.0 representing how rough the surface is. Values near 0.0 produce glossy surfaces, while values near 1.0 produce rough surfaces.\n * @property {vec3} normalEC Surface's normal in eye coordinates. It is used for effects such as normal mapping. The default is the surface's unmodified normal.\n * @property {float} occlusion Ambient occlusion recieved at this point on the material. 1.0 means fully lit, 0.0 means fully occluded.\n * @property {vec3} emissive Light emitted by the material equally in all directions. The default is vec3(0.0), which emits no light.\n */\nstruct czm_modelMaterial {\n vec3 diffuse;\n float alpha;\n vec3 specular;\n float roughness;\n vec3 normalEC;\n float occlusion;\n vec3 emissive;\n};\n";
  63693. // node_modules/cesium/Source/Shaders/Builtin/Structs/modelVertexOutput.js
  63694. var modelVertexOutput_default = "/**\n * Struct for representing the output of a custom vertex shader.\n * \n * @name czm_modelVertexOutput\n * @glslStruct\n *\n * @see {@link CustomShader}\n * @see {@link ModelExperimental}\n *\n * @property {vec3} positionMC The position of the vertex in model coordinates\n * @property {float} pointSize A custom value for gl_PointSize. This is only used for point primitives. \n */\nstruct czm_modelVertexOutput {\n vec3 positionMC;\n float pointSize;\n};\n";
  63695. // node_modules/cesium/Source/Shaders/Builtin/Structs/pbrParameters.js
  63696. var pbrParameters_default = "/**\n * Parameters for {@link czm_pbrLighting}\n *\n * @name czm_material\n * @glslStruct\n *\n * @property {vec3} diffuseColor the diffuse color of the material for the lambert term of the rendering equation\n * @property {float} roughness a value from 0.0 to 1.0 that indicates how rough the surface of the material is.\n * @property {vec3} f0 The reflectance of the material at normal incidence\n */\nstruct czm_pbrParameters\n{\n vec3 diffuseColor;\n float roughness;\n vec3 f0;\n};\n";
  63697. // node_modules/cesium/Source/Shaders/Builtin/Structs/ray.js
  63698. var ray_default = "/**\n * DOC_TBA\n *\n * @name czm_ray\n * @glslStruct\n */\nstruct czm_ray\n{\n vec3 origin;\n vec3 direction;\n};\n";
  63699. // node_modules/cesium/Source/Shaders/Builtin/Structs/raySegment.js
  63700. var raySegment_default = "/**\n * DOC_TBA\n *\n * @name czm_raySegment\n * @glslStruct\n */\nstruct czm_raySegment\n{\n float start;\n float stop;\n};\n\n/**\n * DOC_TBA\n *\n * @name czm_emptyRaySegment\n * @glslConstant \n */\nconst czm_raySegment czm_emptyRaySegment = czm_raySegment(-czm_infinity, -czm_infinity);\n\n/**\n * DOC_TBA\n *\n * @name czm_fullRaySegment\n * @glslConstant \n */\nconst czm_raySegment czm_fullRaySegment = czm_raySegment(0.0, czm_infinity);\n";
  63701. // node_modules/cesium/Source/Shaders/Builtin/Structs/shadowParameters.js
  63702. var shadowParameters_default = "struct czm_shadowParameters\n{\n#ifdef USE_CUBE_MAP_SHADOW\n vec3 texCoords;\n#else\n vec2 texCoords;\n#endif\n\n float depthBias;\n float depth;\n float nDotL;\n vec2 texelStepSize;\n float normalShadingSmooth;\n float darkness;\n};\n";
  63703. // node_modules/cesium/Source/Shaders/Builtin/Functions/HSBToRGB.js
  63704. var HSBToRGB_default = "/**\n * Converts an HSB color (hue, saturation, brightness) to RGB\n * HSB <-> RGB conversion with minimal branching: {@link http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl}\n *\n * @name czm_HSBToRGB\n * @glslFunction\n * \n * @param {vec3} hsb The color in HSB.\n *\n * @returns {vec3} The color in RGB.\n *\n * @example\n * vec3 hsb = czm_RGBToHSB(rgb);\n * hsb.z *= 0.1;\n * rgb = czm_HSBToRGB(hsb);\n */\n\nconst vec4 K_HSB2RGB = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n\nvec3 czm_HSBToRGB(vec3 hsb)\n{\n vec3 p = abs(fract(hsb.xxx + K_HSB2RGB.xyz) * 6.0 - K_HSB2RGB.www);\n return hsb.z * mix(K_HSB2RGB.xxx, clamp(p - K_HSB2RGB.xxx, 0.0, 1.0), hsb.y);\n}\n";
  63705. // node_modules/cesium/Source/Shaders/Builtin/Functions/HSLToRGB.js
  63706. var HSLToRGB_default = "/**\n * Converts an HSL color (hue, saturation, lightness) to RGB\n * HSL <-> RGB conversion: {@link http://www.chilliant.com/rgb2hsv.html}\n *\n * @name czm_HSLToRGB\n * @glslFunction\n * \n * @param {vec3} rgb The color in HSL.\n *\n * @returns {vec3} The color in RGB.\n *\n * @example\n * vec3 hsl = czm_RGBToHSL(rgb);\n * hsl.z *= 0.1;\n * rgb = czm_HSLToRGB(hsl);\n */\n\nvec3 hueToRGB(float hue)\n{\n float r = abs(hue * 6.0 - 3.0) - 1.0;\n float g = 2.0 - abs(hue * 6.0 - 2.0);\n float b = 2.0 - abs(hue * 6.0 - 4.0);\n return clamp(vec3(r, g, b), 0.0, 1.0);\n}\n\nvec3 czm_HSLToRGB(vec3 hsl)\n{\n vec3 rgb = hueToRGB(hsl.x);\n float c = (1.0 - abs(2.0 * hsl.z - 1.0)) * hsl.y;\n return (rgb - 0.5) * c + hsl.z;\n}\n";
  63707. // node_modules/cesium/Source/Shaders/Builtin/Functions/RGBToHSB.js
  63708. var RGBToHSB_default = "/**\n * Converts an RGB color to HSB (hue, saturation, brightness)\n * HSB <-> RGB conversion with minimal branching: {@link http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl}\n *\n * @name czm_RGBToHSB\n * @glslFunction\n * \n * @param {vec3} rgb The color in RGB.\n *\n * @returns {vec3} The color in HSB.\n *\n * @example\n * vec3 hsb = czm_RGBToHSB(rgb);\n * hsb.z *= 0.1;\n * rgb = czm_HSBToRGB(hsb);\n */\n\nconst vec4 K_RGB2HSB = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n\nvec3 czm_RGBToHSB(vec3 rgb)\n{\n vec4 p = mix(vec4(rgb.bg, K_RGB2HSB.wz), vec4(rgb.gb, K_RGB2HSB.xy), step(rgb.b, rgb.g));\n vec4 q = mix(vec4(p.xyw, rgb.r), vec4(rgb.r, p.yzx), step(p.x, rgb.r));\n\n float d = q.x - min(q.w, q.y);\n return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + czm_epsilon7)), d / (q.x + czm_epsilon7), q.x);\n}\n";
  63709. // node_modules/cesium/Source/Shaders/Builtin/Functions/RGBToHSL.js
  63710. var RGBToHSL_default = "/**\n * Converts an RGB color to HSL (hue, saturation, lightness)\n * HSL <-> RGB conversion: {@link http://www.chilliant.com/rgb2hsv.html}\n *\n * @name czm_RGBToHSL\n * @glslFunction\n * \n * @param {vec3} rgb The color in RGB.\n *\n * @returns {vec3} The color in HSL.\n *\n * @example\n * vec3 hsl = czm_RGBToHSL(rgb);\n * hsl.z *= 0.1;\n * rgb = czm_HSLToRGB(hsl);\n */\n \nvec3 RGBtoHCV(vec3 rgb)\n{\n // Based on work by Sam Hocevar and Emil Persson\n vec4 p = (rgb.g < rgb.b) ? vec4(rgb.bg, -1.0, 2.0 / 3.0) : vec4(rgb.gb, 0.0, -1.0 / 3.0);\n vec4 q = (rgb.r < p.x) ? vec4(p.xyw, rgb.r) : vec4(rgb.r, p.yzx);\n float c = q.x - min(q.w, q.y);\n float h = abs((q.w - q.y) / (6.0 * c + czm_epsilon7) + q.z);\n return vec3(h, c, q.x);\n}\n\nvec3 czm_RGBToHSL(vec3 rgb)\n{\n vec3 hcv = RGBtoHCV(rgb);\n float l = hcv.z - hcv.y * 0.5;\n float s = hcv.y / (1.0 - abs(l * 2.0 - 1.0) + czm_epsilon7);\n return vec3(hcv.x, s, l);\n}\n";
  63711. // node_modules/cesium/Source/Shaders/Builtin/Functions/RGBToXYZ.js
  63712. var RGBToXYZ_default = "/**\n * Converts an RGB color to CIE Yxy.\n * <p>The conversion is described in\n * {@link http://content.gpwiki.org/index.php/D3DBook:High-Dynamic_Range_Rendering#Luminance_Transform|Luminance Transform}\n * </p>\n * \n * @name czm_RGBToXYZ\n * @glslFunction\n * \n * @param {vec3} rgb The color in RGB.\n *\n * @returns {vec3} The color in CIE Yxy.\n *\n * @example\n * vec3 xyz = czm_RGBToXYZ(rgb);\n * xyz.x = max(xyz.x - luminanceThreshold, 0.0);\n * rgb = czm_XYZToRGB(xyz);\n */\nvec3 czm_RGBToXYZ(vec3 rgb)\n{\n const mat3 RGB2XYZ = mat3(0.4124, 0.2126, 0.0193,\n 0.3576, 0.7152, 0.1192,\n 0.1805, 0.0722, 0.9505);\n vec3 xyz = RGB2XYZ * rgb;\n vec3 Yxy;\n Yxy.r = xyz.g;\n float temp = dot(vec3(1.0), xyz);\n Yxy.gb = xyz.rg / temp;\n return Yxy;\n}\n";
  63713. // node_modules/cesium/Source/Shaders/Builtin/Functions/XYZToRGB.js
  63714. var XYZToRGB_default = "/**\n * Converts a CIE Yxy color to RGB.\n * <p>The conversion is described in\n * {@link http://content.gpwiki.org/index.php/D3DBook:High-Dynamic_Range_Rendering#Luminance_Transform|Luminance Transform}\n * </p>\n * \n * @name czm_XYZToRGB\n * @glslFunction\n * \n * @param {vec3} Yxy The color in CIE Yxy.\n *\n * @returns {vec3} The color in RGB.\n *\n * @example\n * vec3 xyz = czm_RGBToXYZ(rgb);\n * xyz.x = max(xyz.x - luminanceThreshold, 0.0);\n * rgb = czm_XYZToRGB(xyz);\n */\nvec3 czm_XYZToRGB(vec3 Yxy)\n{\n const mat3 XYZ2RGB = mat3( 3.2405, -0.9693, 0.0556,\n -1.5371, 1.8760, -0.2040,\n -0.4985, 0.0416, 1.0572);\n vec3 xyz;\n xyz.r = Yxy.r * Yxy.g / Yxy.b;\n xyz.g = Yxy.r;\n xyz.b = Yxy.r * (1.0 - Yxy.g - Yxy.b) / Yxy.b;\n \n return XYZ2RGB * xyz;\n}\n";
  63715. // node_modules/cesium/Source/Shaders/Builtin/Functions/acesTonemapping.js
  63716. var acesTonemapping_default = "// See:\n// https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/\n\nvec3 czm_acesTonemapping(vec3 color) {\n float g = 0.985;\n float a = 0.065;\n float b = 0.0001;\n float c = 0.433;\n float d = 0.238;\n\n color = (color * (color + a) - b) / (color * (g * color + c) + d);\n\n color = clamp(color, 0.0, 1.0);\n\n return color;\n}\n";
  63717. // node_modules/cesium/Source/Shaders/Builtin/Functions/alphaWeight.js
  63718. var alphaWeight_default = "/**\n * @private\n */\nfloat czm_alphaWeight(float a)\n{\n float z = (gl_FragCoord.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\n\n // See Weighted Blended Order-Independent Transparency for examples of different weighting functions:\n // http://jcgt.org/published/0002/02/09/\n return pow(a + 0.01, 4.0) + max(1e-2, min(3.0 * 1e3, 0.003 / (1e-5 + pow(abs(z) / 200.0, 4.0))));\n}\n";
  63719. // node_modules/cesium/Source/Shaders/Builtin/Functions/antialias.js
  63720. var antialias_default = "/**\n * Procedural anti-aliasing by blurring two colors that meet at a sharp edge.\n *\n * @name czm_antialias\n * @glslFunction\n *\n * @param {vec4} color1 The color on one side of the edge.\n * @param {vec4} color2 The color on the other side of the edge.\n * @param {vec4} currentcolor The current color, either <code>color1</code> or <code>color2</code>.\n * @param {float} dist The distance to the edge in texture coordinates.\n * @param {float} [fuzzFactor=0.1] Controls the blurriness between the two colors.\n * @returns {vec4} The anti-aliased color.\n *\n * @example\n * // GLSL declarations\n * vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor);\n * vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist);\n *\n * // get the color for a material that has a sharp edge at the line y = 0.5 in texture space\n * float dist = abs(textureCoordinates.t - 0.5);\n * vec4 currentColor = mix(bottomColor, topColor, step(0.5, textureCoordinates.t));\n * vec4 color = czm_antialias(bottomColor, topColor, currentColor, dist, 0.1);\n */\nvec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor)\n{\n float val1 = clamp(dist / fuzzFactor, 0.0, 1.0);\n float val2 = clamp((dist - 0.5) / fuzzFactor, 0.0, 1.0);\n val1 = val1 * (1.0 - val2);\n val1 = val1 * val1 * (3.0 - (2.0 * val1));\n val1 = pow(val1, 0.5); //makes the transition nicer\n \n vec4 midColor = (color1 + color2) * 0.5;\n return mix(midColor, currentColor, val1);\n}\n\nvec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist)\n{\n return czm_antialias(color1, color2, currentColor, dist, 0.1);\n}\n";
  63721. // node_modules/cesium/Source/Shaders/Builtin/Functions/approximateSphericalCoordinates.js
  63722. var approximateSphericalCoordinates_default = "/**\n * Approximately computes spherical coordinates given a normal.\n * Uses approximate inverse trigonometry for speed and consistency,\n * since inverse trigonometry can differ from vendor-to-vendor and when compared with the CPU.\n *\n * @name czm_approximateSphericalCoordinates\n * @glslFunction\n *\n * @param {vec3} normal arbitrary-length normal.\n *\n * @returns {vec2} Approximate latitude and longitude spherical coordinates.\n */\nvec2 czm_approximateSphericalCoordinates(vec3 normal) {\n // Project into plane with vertical for latitude\n float latitudeApproximation = czm_fastApproximateAtan(sqrt(normal.x * normal.x + normal.y * normal.y), normal.z);\n float longitudeApproximation = czm_fastApproximateAtan(normal.x, normal.y);\n return vec2(latitudeApproximation, longitudeApproximation);\n}\n";
  63723. // node_modules/cesium/Source/Shaders/Builtin/Functions/backFacing.js
  63724. var backFacing_default = "/**\n * Determines if the fragment is back facing\n *\n * @name czm_backFacing\n * @glslFunction \n * \n * @returns {bool} <code>true</code> if the fragment is back facing; otherwise, <code>false</code>.\n */\nbool czm_backFacing()\n{\n // !gl_FrontFacing doesn't work as expected on Mac/Intel so use the more verbose form instead. See https://github.com/CesiumGS/cesium/pull/8494.\n return gl_FrontFacing == false;\n}\n";
  63725. // node_modules/cesium/Source/Shaders/Builtin/Functions/branchFreeTernary.js
  63726. var branchFreeTernary_default = "/**\n * Branchless ternary operator to be used when it's inexpensive to explicitly\n * evaluate both possibilities for a float expression.\n *\n * @name czm_branchFreeTernary\n * @glslFunction\n *\n * @param {bool} comparison A comparison statement\n * @param {float} a Value to return if the comparison is true.\n * @param {float} b Value to return if the comparison is false.\n *\n * @returns {float} equivalent of comparison ? a : b\n */\nfloat czm_branchFreeTernary(bool comparison, float a, float b) {\n float useA = float(comparison);\n return a * useA + b * (1.0 - useA);\n}\n\n/**\n * Branchless ternary operator to be used when it's inexpensive to explicitly\n * evaluate both possibilities for a vec2 expression.\n *\n * @name czm_branchFreeTernary\n * @glslFunction\n *\n * @param {bool} comparison A comparison statement\n * @param {vec2} a Value to return if the comparison is true.\n * @param {vec2} b Value to return if the comparison is false.\n *\n * @returns {vec2} equivalent of comparison ? a : b\n */\nvec2 czm_branchFreeTernary(bool comparison, vec2 a, vec2 b) {\n float useA = float(comparison);\n return a * useA + b * (1.0 - useA);\n}\n\n/**\n * Branchless ternary operator to be used when it's inexpensive to explicitly\n * evaluate both possibilities for a vec3 expression.\n *\n * @name czm_branchFreeTernary\n * @glslFunction\n *\n * @param {bool} comparison A comparison statement\n * @param {vec3} a Value to return if the comparison is true.\n * @param {vec3} b Value to return if the comparison is false.\n *\n * @returns {vec3} equivalent of comparison ? a : b\n */\nvec3 czm_branchFreeTernary(bool comparison, vec3 a, vec3 b) {\n float useA = float(comparison);\n return a * useA + b * (1.0 - useA);\n}\n\n/**\n * Branchless ternary operator to be used when it's inexpensive to explicitly\n * evaluate both possibilities for a vec4 expression.\n *\n * @name czm_branchFreeTernary\n * @glslFunction\n *\n * @param {bool} comparison A comparison statement\n * @param {vec3} a Value to return if the comparison is true.\n * @param {vec3} b Value to return if the comparison is false.\n *\n * @returns {vec3} equivalent of comparison ? a : b\n */\nvec4 czm_branchFreeTernary(bool comparison, vec4 a, vec4 b) {\n float useA = float(comparison);\n return a * useA + b * (1.0 - useA);\n}\n";
  63727. // node_modules/cesium/Source/Shaders/Builtin/Functions/cascadeColor.js
  63728. var cascadeColor_default = "\nvec4 czm_cascadeColor(vec4 weights)\n{\n return vec4(1.0, 0.0, 0.0, 1.0) * weights.x +\n vec4(0.0, 1.0, 0.0, 1.0) * weights.y +\n vec4(0.0, 0.0, 1.0, 1.0) * weights.z +\n vec4(1.0, 0.0, 1.0, 1.0) * weights.w;\n}\n";
  63729. // node_modules/cesium/Source/Shaders/Builtin/Functions/cascadeDistance.js
  63730. var cascadeDistance_default = "\nuniform vec4 shadowMap_cascadeDistances;\n\nfloat czm_cascadeDistance(vec4 weights)\n{\n return dot(shadowMap_cascadeDistances, weights);\n}\n";
  63731. // node_modules/cesium/Source/Shaders/Builtin/Functions/cascadeMatrix.js
  63732. var cascadeMatrix_default = "\nuniform mat4 shadowMap_cascadeMatrices[4];\n\nmat4 czm_cascadeMatrix(vec4 weights)\n{\n return shadowMap_cascadeMatrices[0] * weights.x +\n shadowMap_cascadeMatrices[1] * weights.y +\n shadowMap_cascadeMatrices[2] * weights.z +\n shadowMap_cascadeMatrices[3] * weights.w;\n}\n";
  63733. // node_modules/cesium/Source/Shaders/Builtin/Functions/cascadeWeights.js
  63734. var cascadeWeights_default = "\nuniform vec4 shadowMap_cascadeSplits[2];\n\nvec4 czm_cascadeWeights(float depthEye)\n{\n // One component is set to 1.0 and all others set to 0.0.\n vec4 near = step(shadowMap_cascadeSplits[0], vec4(depthEye));\n vec4 far = step(depthEye, shadowMap_cascadeSplits[1]);\n return near * far;\n}\n";
  63735. // node_modules/cesium/Source/Shaders/Builtin/Functions/columbusViewMorph.js
  63736. var columbusViewMorph_default = "/**\n * DOC_TBA\n *\n * @name czm_columbusViewMorph\n * @glslFunction\n */\nvec4 czm_columbusViewMorph(vec4 position2D, vec4 position3D, float time)\n{\n // Just linear for now.\n vec3 p = mix(position2D.xyz, position3D.xyz, time);\n return vec4(p, 1.0);\n}\n";
  63737. // node_modules/cesium/Source/Shaders/Builtin/Functions/computePosition.js
  63738. var computePosition_default = "/**\n * Returns a position in model coordinates relative to eye taking into\n * account the current scene mode: 3D, 2D, or Columbus view.\n * <p>\n * This uses standard position attributes, <code>position3DHigh</code>, \n * <code>position3DLow</code>, <code>position2DHigh</code>, and <code>position2DLow</code>, \n * and should be used when writing a vertex shader for an {@link Appearance}.\n * </p>\n *\n * @name czm_computePosition\n * @glslFunction\n *\n * @returns {vec4} The position relative to eye.\n *\n * @example\n * vec4 p = czm_computePosition();\n * v_positionEC = (czm_modelViewRelativeToEye * p).xyz;\n * gl_Position = czm_modelViewProjectionRelativeToEye * p;\n *\n * @see czm_translateRelativeToEye\n */\nvec4 czm_computePosition();\n";
  63739. // node_modules/cesium/Source/Shaders/Builtin/Functions/cosineAndSine.js
  63740. var cosineAndSine_default = "/**\n * @private\n */\nvec2 cordic(float angle)\n{\n// Scale the vector by the appropriate factor for the 24 iterations to follow.\n vec2 vector = vec2(6.0725293500888267e-1, 0.0);\n// Iteration 1\n float sense = (angle < 0.0) ? -1.0 : 1.0;\n // float factor = sense * 1.0; // 2^-0\n mat2 rotation = mat2(1.0, sense, -sense, 1.0);\n vector = rotation * vector;\n angle -= sense * 7.8539816339744828e-1; // atan(2^-0)\n// Iteration 2\n sense = (angle < 0.0) ? -1.0 : 1.0;\n float factor = sense * 5.0e-1; // 2^-1\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 4.6364760900080609e-1; // atan(2^-1)\n// Iteration 3\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 2.5e-1; // 2^-2\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 2.4497866312686414e-1; // atan(2^-2)\n// Iteration 4\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 1.25e-1; // 2^-3\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 1.2435499454676144e-1; // atan(2^-3)\n// Iteration 5\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 6.25e-2; // 2^-4\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 6.2418809995957350e-2; // atan(2^-4)\n// Iteration 6\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 3.125e-2; // 2^-5\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 3.1239833430268277e-2; // atan(2^-5)\n// Iteration 7\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 1.5625e-2; // 2^-6\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 1.5623728620476831e-2; // atan(2^-6)\n// Iteration 8\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 7.8125e-3; // 2^-7\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 7.8123410601011111e-3; // atan(2^-7)\n// Iteration 9\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 3.90625e-3; // 2^-8\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 3.9062301319669718e-3; // atan(2^-8)\n// Iteration 10\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 1.953125e-3; // 2^-9\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 1.9531225164788188e-3; // atan(2^-9)\n// Iteration 11\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 9.765625e-4; // 2^-10\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 9.7656218955931946e-4; // atan(2^-10)\n// Iteration 12\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 4.8828125e-4; // 2^-11\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 4.8828121119489829e-4; // atan(2^-11)\n// Iteration 13\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 2.44140625e-4; // 2^-12\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 2.4414062014936177e-4; // atan(2^-12)\n// Iteration 14\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 1.220703125e-4; // 2^-13\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 1.2207031189367021e-4; // atan(2^-13)\n// Iteration 15\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 6.103515625e-5; // 2^-14\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 6.1035156174208773e-5; // atan(2^-14)\n// Iteration 16\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 3.0517578125e-5; // 2^-15\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 3.0517578115526096e-5; // atan(2^-15)\n// Iteration 17\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 1.52587890625e-5; // 2^-16\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 1.5258789061315762e-5; // atan(2^-16)\n// Iteration 18\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 7.62939453125e-6; // 2^-17\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 7.6293945311019700e-6; // atan(2^-17)\n// Iteration 19\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 3.814697265625e-6; // 2^-18\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 3.8146972656064961e-6; // atan(2^-18)\n// Iteration 20\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 1.9073486328125e-6; // 2^-19\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 1.9073486328101870e-6; // atan(2^-19)\n// Iteration 21\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 9.5367431640625e-7; // 2^-20\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 9.5367431640596084e-7; // atan(2^-20)\n// Iteration 22\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 4.76837158203125e-7; // 2^-21\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 4.7683715820308884e-7; // atan(2^-21)\n// Iteration 23\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 2.384185791015625e-7; // 2^-22\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n angle -= sense * 2.3841857910155797e-7; // atan(2^-22)\n// Iteration 24\n sense = (angle < 0.0) ? -1.0 : 1.0;\n factor = sense * 1.1920928955078125e-7; // 2^-23\n rotation[0][1] = factor;\n rotation[1][0] = -factor;\n vector = rotation * vector;\n// angle -= sense * 1.1920928955078068e-7; // atan(2^-23)\n\n return vector;\n}\n\n/**\n * Computes the cosine and sine of the provided angle using the CORDIC algorithm.\n *\n * @name czm_cosineAndSine\n * @glslFunction\n *\n * @param {float} angle The angle in radians.\n *\n * @returns {vec2} The resulting cosine of the angle (as the x coordinate) and sine of the angle (as the y coordinate).\n *\n * @example\n * vec2 v = czm_cosineAndSine(czm_piOverSix);\n * float cosine = v.x;\n * float sine = v.y;\n */\nvec2 czm_cosineAndSine(float angle)\n{\n if (angle < -czm_piOverTwo || angle > czm_piOverTwo)\n {\n if (angle < 0.0)\n {\n return -cordic(angle + czm_pi);\n }\n else\n {\n return -cordic(angle - czm_pi);\n }\n }\n else\n {\n return cordic(angle);\n }\n}\n";
  63741. // node_modules/cesium/Source/Shaders/Builtin/Functions/decompressTextureCoordinates.js
  63742. var decompressTextureCoordinates_default = "/**\n * Decompresses texture coordinates that were packed into a single float.\n *\n * @name czm_decompressTextureCoordinates\n * @glslFunction\n *\n * @param {float} encoded The compressed texture coordinates.\n * @returns {vec2} The decompressed texture coordinates.\n */\n vec2 czm_decompressTextureCoordinates(float encoded)\n {\n float temp = encoded / 4096.0;\n float xZeroTo4095 = floor(temp);\n float stx = xZeroTo4095 / 4095.0;\n float sty = (encoded - xZeroTo4095 * 4096.0) / 4095.0;\n return vec2(stx, sty);\n }\n";
  63743. // node_modules/cesium/Source/Shaders/Builtin/Functions/defaultPbrMaterial.js
  63744. var defaultPbrMaterial_default = "/**\n * Get default parameters for physically based rendering. These defaults\n * describe a rough dielectric (non-metal) surface (e.g. rough plastic).\n *\n * @return {czm_pbrParameters} Default parameters for {@link czm_pbrLighting}\n */\nczm_pbrParameters czm_defaultPbrMaterial()\n{\n czm_pbrParameters results;\n results.diffuseColor = vec3(1.0);\n results.roughness = 1.0;\n\n const vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);\n results.f0 = REFLECTANCE_DIELECTRIC;\n return results;\n}\n";
  63745. // node_modules/cesium/Source/Shaders/Builtin/Functions/depthClamp.js
  63746. var depthClamp_default = "// emulated noperspective\n#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)\nvarying float v_WindowZ;\n#endif\n\n/**\n * Emulates GL_DEPTH_CLAMP, which is not available in WebGL 1 or 2.\n * GL_DEPTH_CLAMP clamps geometry that is outside the near and far planes, \n * capping the shadow volume. More information here: \n * https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_depth_clamp.txt.\n *\n * When GL_EXT_frag_depth is available we emulate GL_DEPTH_CLAMP by ensuring \n * no geometry gets clipped by setting the clip space z value to 0.0 and then\n * sending the unaltered screen space z value (using emulated noperspective\n * interpolation) to the frag shader where it is clamped to [0,1] and then\n * written with gl_FragDepth (see czm_writeDepthClamp). This technique is based on:\n * https://stackoverflow.com/questions/5960757/how-to-emulate-gl-depth-clamp-nv.\n *\n * When GL_EXT_frag_depth is not available, which is the case on some mobile \n * devices, we must attempt to fix this only in the vertex shader. \n * The approach is to clamp the z value to the far plane, which closes the \n * shadow volume but also distorts the geometry, so there can still be artifacts\n * on frustum seams.\n *\n * @name czm_depthClamp\n * @glslFunction\n *\n * @param {vec4} coords The vertex in clip coordinates.\n * @returns {vec4} The modified vertex.\n *\n * @example\n * gl_Position = czm_depthClamp(czm_modelViewProjection * vec4(position, 1.0));\n *\n * @see czm_writeDepthClamp\n */\nvec4 czm_depthClamp(vec4 coords)\n{\n#ifndef LOG_DEPTH\n#ifdef GL_EXT_frag_depth\n v_WindowZ = (0.5 * (coords.z / coords.w) + 0.5) * coords.w;\n coords.z = 0.0;\n#else\n coords.z = min(coords.z, coords.w);\n#endif\n#endif\n return coords;\n}\n";
  63747. // node_modules/cesium/Source/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.js
  63748. var eastNorthUpToEyeCoordinates_default = "/**\n * Computes a 3x3 rotation matrix that transforms vectors from an ellipsoid's east-north-up coordinate system \n * to eye coordinates. In east-north-up coordinates, x points east, y points north, and z points along the \n * surface normal. East-north-up can be used as an ellipsoid's tangent space for operations such as bump mapping.\n * <br /><br />\n * The ellipsoid is assumed to be centered at the model coordinate's origin.\n *\n * @name czm_eastNorthUpToEyeCoordinates\n * @glslFunction\n *\n * @param {vec3} positionMC The position on the ellipsoid in model coordinates.\n * @param {vec3} normalEC The normalized ellipsoid surface normal, at <code>positionMC</code>, in eye coordinates.\n *\n * @returns {mat3} A 3x3 rotation matrix that transforms vectors from the east-north-up coordinate system to eye coordinates.\n *\n * @example\n * // Transform a vector defined in the east-north-up coordinate \n * // system, (0, 0, 1) which is the surface normal, to eye \n * // coordinates.\n * mat3 m = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);\n * vec3 normalEC = m * vec3(0.0, 0.0, 1.0);\n */\nmat3 czm_eastNorthUpToEyeCoordinates(vec3 positionMC, vec3 normalEC)\n{\n vec3 tangentMC = normalize(vec3(-positionMC.y, positionMC.x, 0.0)); // normalized surface tangent in model coordinates\n vec3 tangentEC = normalize(czm_normal3D * tangentMC); // normalized surface tangent in eye coordiantes\n vec3 bitangentEC = normalize(cross(normalEC, tangentEC)); // normalized surface bitangent in eye coordinates\n\n return mat3(\n tangentEC.x, tangentEC.y, tangentEC.z,\n bitangentEC.x, bitangentEC.y, bitangentEC.z,\n normalEC.x, normalEC.y, normalEC.z);\n}\n";
  63749. // node_modules/cesium/Source/Shaders/Builtin/Functions/ellipsoidContainsPoint.js
  63750. var ellipsoidContainsPoint_default = "/**\n * DOC_TBA\n *\n * @name czm_ellipsoidContainsPoint\n * @glslFunction\n *\n */\nbool czm_ellipsoidContainsPoint(vec3 ellipsoid_inverseRadii, vec3 point)\n{\n vec3 scaled = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(point, 1.0)).xyz;\n return (dot(scaled, scaled) <= 1.0);\n}\n";
  63751. // node_modules/cesium/Source/Shaders/Builtin/Functions/ellipsoidWgs84TextureCoordinates.js
  63752. var ellipsoidWgs84TextureCoordinates_default = "/**\n * DOC_TBA\n *\n * @name czm_ellipsoidWgs84TextureCoordinates\n * @glslFunction\n */\nvec2 czm_ellipsoidWgs84TextureCoordinates(vec3 normal)\n{\n return vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);\n}\n";
  63753. // node_modules/cesium/Source/Shaders/Builtin/Functions/equalsEpsilon.js
  63754. var equalsEpsilon_default = "/**\n * Compares <code>left</code> and <code>right</code> componentwise. Returns <code>true</code>\n * if they are within <code>epsilon</code> and <code>false</code> otherwise. The inputs\n * <code>left</code> and <code>right</code> can be <code>float</code>s, <code>vec2</code>s,\n * <code>vec3</code>s, or <code>vec4</code>s.\n *\n * @name czm_equalsEpsilon\n * @glslFunction\n *\n * @param {} left The first vector.\n * @param {} right The second vector.\n * @param {float} epsilon The epsilon to use for equality testing.\n * @returns {bool} <code>true</code> if the components are within <code>epsilon</code> and <code>false</code> otherwise.\n *\n * @example\n * // GLSL declarations\n * bool czm_equalsEpsilon(float left, float right, float epsilon);\n * bool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon);\n * bool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon);\n * bool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon);\n */\nbool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon) {\n return all(lessThanEqual(abs(left - right), vec4(epsilon)));\n}\n\nbool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon) {\n return all(lessThanEqual(abs(left - right), vec3(epsilon)));\n}\n\nbool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon) {\n return all(lessThanEqual(abs(left - right), vec2(epsilon)));\n}\n\nbool czm_equalsEpsilon(float left, float right, float epsilon) {\n return (abs(left - right) <= epsilon);\n}\n";
  63755. // node_modules/cesium/Source/Shaders/Builtin/Functions/eyeOffset.js
  63756. var eyeOffset_default = "/**\n * DOC_TBA\n *\n * @name czm_eyeOffset\n * @glslFunction\n *\n * @param {vec4} positionEC DOC_TBA.\n * @param {vec3} eyeOffset DOC_TBA.\n *\n * @returns {vec4} DOC_TBA.\n */\nvec4 czm_eyeOffset(vec4 positionEC, vec3 eyeOffset)\n{\n // This equation is approximate in x and y.\n vec4 p = positionEC;\n vec4 zEyeOffset = normalize(p) * eyeOffset.z;\n p.xy += eyeOffset.xy + zEyeOffset.xy;\n p.z += zEyeOffset.z;\n return p;\n}\n";
  63757. // node_modules/cesium/Source/Shaders/Builtin/Functions/eyeToWindowCoordinates.js
  63758. var eyeToWindowCoordinates_default = "/**\n * Transforms a position from eye to window coordinates. The transformation\n * from eye to clip coordinates is done using {@link czm_projection}.\n * The transform from normalized device coordinates to window coordinates is\n * done using {@link czm_viewportTransformation}, which assumes a depth range\n * of <code>near = 0</code> and <code>far = 1</code>.\n * <br /><br />\n * This transform is useful when there is a need to manipulate window coordinates\n * in a vertex shader as done by {@link BillboardCollection}.\n *\n * @name czm_eyeToWindowCoordinates\n * @glslFunction\n *\n * @param {vec4} position The position in eye coordinates to transform.\n *\n * @returns {vec4} The transformed position in window coordinates.\n *\n * @see czm_modelToWindowCoordinates\n * @see czm_projection\n * @see czm_viewportTransformation\n * @see BillboardCollection\n *\n * @example\n * vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\n */\nvec4 czm_eyeToWindowCoordinates(vec4 positionEC)\n{\n vec4 q = czm_projection * positionEC; // clip coordinates\n q.xyz /= q.w; // normalized device coordinates\n q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates\n return q;\n}\n";
  63759. // node_modules/cesium/Source/Shaders/Builtin/Functions/fastApproximateAtan.js
  63760. var fastApproximateAtan_default = `/**
  63761. * Approxiamtes atan over the range [0, 1]. Safe to flip output for negative input.
  63762. *
  63763. * Based on Michal Drobot's approximation from ShaderFastLibs, which in turn is based on
  63764. * "Efficient approximations for the arctangent function," Rajan, S. Sichun Wang Inkol, R. Joyal, A., May 2006.
  63765. * Adapted from ShaderFastLibs under MIT License.
  63766. *
  63767. * Chosen for the following characteristics over range [0, 1]:
  63768. * - basically no error at 0 and 1, important for getting around range limit (naive atan2 via atan requires infinite range atan)
  63769. * - no visible artifacts from first-derivative discontinuities, unlike latitude via range-reduced sqrt asin approximations (at equator)
  63770. *
  63771. * The original code is x * (-0.1784 * abs(x) - 0.0663 * x * x + 1.0301);
  63772. * Removed the abs() in here because it isn't needed, the input range is guaranteed as [0, 1] by how we're approximating atan2.
  63773. *
  63774. * @name czm_fastApproximateAtan
  63775. * @glslFunction
  63776. *
  63777. * @param {float} x Value between 0 and 1 inclusive.
  63778. *
  63779. * @returns {float} Approximation of atan(x)
  63780. */
  63781. float czm_fastApproximateAtan(float x) {
  63782. return x * (-0.1784 * x - 0.0663 * x * x + 1.0301);
  63783. }
  63784. /**
  63785. * Approximation of atan2.
  63786. *
  63787. * Range reduction math based on nvidia's cg reference implementation for atan2: http://developer.download.nvidia.com/cg/atan2.html
  63788. * However, we replaced their atan curve with Michael Drobot's (see above).
  63789. *
  63790. * @name czm_fastApproximateAtan
  63791. * @glslFunction
  63792. *
  63793. * @param {float} x Value between -1 and 1 inclusive.
  63794. * @param {float} y Value between -1 and 1 inclusive.
  63795. *
  63796. * @returns {float} Approximation of atan2(x, y)
  63797. */
  63798. float czm_fastApproximateAtan(float x, float y) {
  63799. // atan approximations are usually only reliable over [-1, 1], or, in our case, [0, 1] due to modifications.
  63800. // So range-reduce using abs and by flipping whether x or y is on top.
  63801. float t = abs(x); // t used as swap and atan result.
  63802. float opposite = abs(y);
  63803. float adjacent = max(t, opposite);
  63804. opposite = min(t, opposite);
  63805. t = czm_fastApproximateAtan(opposite / adjacent);
  63806. // Undo range reduction
  63807. t = czm_branchFreeTernary(abs(y) > abs(x), czm_piOverTwo - t, t);
  63808. t = czm_branchFreeTernary(x < 0.0, czm_pi - t, t);
  63809. t = czm_branchFreeTernary(y < 0.0, -t, t);
  63810. return t;
  63811. }
  63812. `;
  63813. // node_modules/cesium/Source/Shaders/Builtin/Functions/fog.js
  63814. var fog_default = "/**\n * Gets the color with fog at a distance from the camera.\n *\n * @name czm_fog\n * @glslFunction\n *\n * @param {float} distanceToCamera The distance to the camera in meters.\n * @param {vec3} color The original color.\n * @param {vec3} fogColor The color of the fog.\n *\n * @returns {vec3} The color adjusted for fog at the distance from the camera.\n */\nvec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor)\n{\n float scalar = distanceToCamera * czm_fogDensity;\n float fog = 1.0 - exp(-(scalar * scalar));\n return mix(color, fogColor, fog);\n}\n\n/**\n * Gets the color with fog at a distance from the camera.\n *\n * @name czm_fog\n * @glslFunction\n *\n * @param {float} distanceToCamera The distance to the camera in meters.\n * @param {vec3} color The original color.\n * @param {vec3} fogColor The color of the fog.\n * @param {float} fogModifierConstant A constant to modify the appearance of fog.\n *\n * @returns {vec3} The color adjusted for fog at the distance from the camera.\n */\nvec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor, float fogModifierConstant)\n{\n float scalar = distanceToCamera * czm_fogDensity;\n float fog = 1.0 - exp(-((fogModifierConstant * scalar + fogModifierConstant) * (scalar * (1.0 + fogModifierConstant))));\n return mix(color, fogColor, fog);\n}\n";
  63815. // node_modules/cesium/Source/Shaders/Builtin/Functions/gammaCorrect.js
  63816. var gammaCorrect_default = "/**\n * Converts a color from RGB space to linear space.\n *\n * @name czm_gammaCorrect\n * @glslFunction\n *\n * @param {vec3} color The color in RGB space.\n * @returns {vec3} The color in linear space.\n */\nvec3 czm_gammaCorrect(vec3 color) {\n#ifdef HDR\n color = pow(color, vec3(czm_gamma));\n#endif\n return color;\n}\n\nvec4 czm_gammaCorrect(vec4 color) {\n#ifdef HDR\n color.rgb = pow(color.rgb, vec3(czm_gamma));\n#endif\n return color;\n}\n";
  63817. // node_modules/cesium/Source/Shaders/Builtin/Functions/geodeticSurfaceNormal.js
  63818. var geodeticSurfaceNormal_default = "/**\n * DOC_TBA\n *\n * @name czm_geodeticSurfaceNormal\n * @glslFunction\n *\n * @param {vec3} positionOnEllipsoid DOC_TBA\n * @param {vec3} ellipsoidCenter DOC_TBA\n * @param {vec3} oneOverEllipsoidRadiiSquared DOC_TBA\n * \n * @returns {vec3} DOC_TBA.\n */\nvec3 czm_geodeticSurfaceNormal(vec3 positionOnEllipsoid, vec3 ellipsoidCenter, vec3 oneOverEllipsoidRadiiSquared)\n{\n return normalize((positionOnEllipsoid - ellipsoidCenter) * oneOverEllipsoidRadiiSquared);\n}\n";
  63819. // node_modules/cesium/Source/Shaders/Builtin/Functions/getDefaultMaterial.js
  63820. var getDefaultMaterial_default = "/**\n * An czm_material with default values. Every material's czm_getMaterial\n * should use this default material as a base for the material it returns.\n * The default normal value is given by materialInput.normalEC.\n *\n * @name czm_getDefaultMaterial\n * @glslFunction\n *\n * @param {czm_materialInput} input The input used to construct the default material.\n *\n * @returns {czm_material} The default material.\n *\n * @see czm_materialInput\n * @see czm_material\n * @see czm_getMaterial\n */\nczm_material czm_getDefaultMaterial(czm_materialInput materialInput)\n{\n czm_material material;\n material.diffuse = vec3(0.0);\n material.specular = 0.0;\n material.shininess = 1.0;\n material.normal = materialInput.normalEC;\n material.emission = vec3(0.0);\n material.alpha = 1.0;\n return material;\n}\n";
  63821. // node_modules/cesium/Source/Shaders/Builtin/Functions/getLambertDiffuse.js
  63822. var getLambertDiffuse_default = "/**\n * Calculates the intensity of diffusely reflected light.\n *\n * @name czm_getLambertDiffuse\n * @glslFunction\n *\n * @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.\n * @param {vec3} normalEC The surface normal in eye coordinates.\n *\n * @returns {float} The intensity of the diffuse reflection.\n *\n * @see czm_phong\n *\n * @example\n * float diffuseIntensity = czm_getLambertDiffuse(lightDirectionEC, normalEC);\n * float specularIntensity = czm_getSpecular(lightDirectionEC, toEyeEC, normalEC, 200);\n * vec3 color = (diffuseColor * diffuseIntensity) + (specularColor * specularIntensity);\n */\nfloat czm_getLambertDiffuse(vec3 lightDirectionEC, vec3 normalEC)\n{\n return max(dot(lightDirectionEC, normalEC), 0.0);\n}\n";
  63823. // node_modules/cesium/Source/Shaders/Builtin/Functions/getSpecular.js
  63824. var getSpecular_default = "/**\n * Calculates the specular intensity of reflected light.\n *\n * @name czm_getSpecular\n * @glslFunction\n *\n * @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.\n * @param {vec3} toEyeEC Unit vector pointing to the eye position in eye coordinates.\n * @param {vec3} normalEC The surface normal in eye coordinates.\n * @param {float} shininess The sharpness of the specular reflection. Higher values create a smaller, more focused specular highlight.\n *\n * @returns {float} The intensity of the specular highlight.\n *\n * @see czm_phong\n *\n * @example\n * float diffuseIntensity = czm_getLambertDiffuse(lightDirectionEC, normalEC);\n * float specularIntensity = czm_getSpecular(lightDirectionEC, toEyeEC, normalEC, 200);\n * vec3 color = (diffuseColor * diffuseIntensity) + (specularColor * specularIntensity);\n */\nfloat czm_getSpecular(vec3 lightDirectionEC, vec3 toEyeEC, vec3 normalEC, float shininess)\n{\n vec3 toReflectedLight = reflect(-lightDirectionEC, normalEC);\n float specular = max(dot(toReflectedLight, toEyeEC), 0.0);\n\n // pow has undefined behavior if both parameters <= 0.\n // Prevent this by making sure shininess is at least czm_epsilon2.\n return pow(specular, max(shininess, czm_epsilon2));\n}\n";
  63825. // node_modules/cesium/Source/Shaders/Builtin/Functions/getWaterNoise.js
  63826. var getWaterNoise_default = "/**\n * @private\n */\nvec4 czm_getWaterNoise(sampler2D normalMap, vec2 uv, float time, float angleInRadians)\n{\n float cosAngle = cos(angleInRadians);\n float sinAngle = sin(angleInRadians);\n\n // time dependent sampling directions\n vec2 s0 = vec2(1.0/17.0, 0.0);\n vec2 s1 = vec2(-1.0/29.0, 0.0);\n vec2 s2 = vec2(1.0/101.0, 1.0/59.0);\n vec2 s3 = vec2(-1.0/109.0, -1.0/57.0);\n\n // rotate sampling direction by specified angle\n s0 = vec2((cosAngle * s0.x) - (sinAngle * s0.y), (sinAngle * s0.x) + (cosAngle * s0.y));\n s1 = vec2((cosAngle * s1.x) - (sinAngle * s1.y), (sinAngle * s1.x) + (cosAngle * s1.y));\n s2 = vec2((cosAngle * s2.x) - (sinAngle * s2.y), (sinAngle * s2.x) + (cosAngle * s2.y));\n s3 = vec2((cosAngle * s3.x) - (sinAngle * s3.y), (sinAngle * s3.x) + (cosAngle * s3.y));\n\n vec2 uv0 = (uv/103.0) + (time * s0);\n vec2 uv1 = uv/107.0 + (time * s1) + vec2(0.23);\n vec2 uv2 = uv/vec2(897.0, 983.0) + (time * s2) + vec2(0.51);\n vec2 uv3 = uv/vec2(991.0, 877.0) + (time * s3) + vec2(0.71);\n\n uv0 = fract(uv0);\n uv1 = fract(uv1);\n uv2 = fract(uv2);\n uv3 = fract(uv3);\n vec4 noise = (texture2D(normalMap, uv0)) +\n (texture2D(normalMap, uv1)) +\n (texture2D(normalMap, uv2)) +\n (texture2D(normalMap, uv3));\n\n // average and scale to between -1 and 1\n return ((noise / 4.0) - 0.5) * 2.0;\n}\n";
  63827. // node_modules/cesium/Source/Shaders/Builtin/Functions/hue.js
  63828. var hue_default = "/**\n * Adjusts the hue of a color.\n * \n * @name czm_hue\n * @glslFunction\n * \n * @param {vec3} rgb The color.\n * @param {float} adjustment The amount to adjust the hue of the color in radians.\n *\n * @returns {float} The color with the hue adjusted.\n *\n * @example\n * vec3 adjustHue = czm_hue(color, czm_pi); // The same as czm_hue(color, -czm_pi)\n */\nvec3 czm_hue(vec3 rgb, float adjustment)\n{\n const mat3 toYIQ = mat3(0.299, 0.587, 0.114,\n 0.595716, -0.274453, -0.321263,\n 0.211456, -0.522591, 0.311135);\n const mat3 toRGB = mat3(1.0, 0.9563, 0.6210,\n 1.0, -0.2721, -0.6474,\n 1.0, -1.107, 1.7046);\n \n vec3 yiq = toYIQ * rgb;\n float hue = atan(yiq.z, yiq.y) + adjustment;\n float chroma = sqrt(yiq.z * yiq.z + yiq.y * yiq.y);\n \n vec3 color = vec3(yiq.x, chroma * cos(hue), chroma * sin(hue));\n return toRGB * color;\n}\n";
  63829. // node_modules/cesium/Source/Shaders/Builtin/Functions/inverseGamma.js
  63830. var inverseGamma_default = "/**\n * Converts a color in linear space to RGB space.\n *\n * @name czm_inverseGamma\n * @glslFunction\n *\n * @param {vec3} color The color in linear space.\n * @returns {vec3} The color in RGB space.\n */\nvec3 czm_inverseGamma(vec3 color) {\n return pow(color, vec3(1.0 / czm_gamma));\n}\n";
  63831. // node_modules/cesium/Source/Shaders/Builtin/Functions/isEmpty.js
  63832. var isEmpty_default = "/**\n * Determines if a time interval is empty.\n *\n * @name czm_isEmpty\n * @glslFunction \n * \n * @param {czm_raySegment} interval The interval to test.\n * \n * @returns {bool} <code>true</code> if the time interval is empty; otherwise, <code>false</code>.\n *\n * @example\n * bool b0 = czm_isEmpty(czm_emptyRaySegment); // true\n * bool b1 = czm_isEmpty(czm_raySegment(0.0, 1.0)); // false\n * bool b2 = czm_isEmpty(czm_raySegment(1.0, 1.0)); // false, contains 1.0.\n */\nbool czm_isEmpty(czm_raySegment interval)\n{\n return (interval.stop < 0.0);\n}\n";
  63833. // node_modules/cesium/Source/Shaders/Builtin/Functions/isFull.js
  63834. var isFull_default = "/**\n * Determines if a time interval is empty.\n *\n * @name czm_isFull\n * @glslFunction \n * \n * @param {czm_raySegment} interval The interval to test.\n * \n * @returns {bool} <code>true</code> if the time interval is empty; otherwise, <code>false</code>.\n *\n * @example\n * bool b0 = czm_isEmpty(czm_emptyRaySegment); // true\n * bool b1 = czm_isEmpty(czm_raySegment(0.0, 1.0)); // false\n * bool b2 = czm_isEmpty(czm_raySegment(1.0, 1.0)); // false, contains 1.0.\n */\nbool czm_isFull(czm_raySegment interval)\n{\n return (interval.start == 0.0 && interval.stop == czm_infinity);\n}\n";
  63835. // node_modules/cesium/Source/Shaders/Builtin/Functions/latitudeToWebMercatorFraction.js
  63836. var latitudeToWebMercatorFraction_default = "/**\n * Computes the fraction of a Web Wercator rectangle at which a given geodetic latitude is located.\n *\n * @name czm_latitudeToWebMercatorFraction\n * @glslFunction\n *\n * @param {float} latitude The geodetic latitude, in radians.\n * @param {float} southMercatorY The Web Mercator coordinate of the southern boundary of the rectangle.\n * @param {float} oneOverMercatorHeight The total height of the rectangle in Web Mercator coordinates.\n *\n * @returns {float} The fraction of the rectangle at which the latitude occurs. If the latitude is the southern\n * boundary of the rectangle, the return value will be zero. If it is the northern boundary, the return\n * value will be 1.0. Latitudes in between are mapped according to the Web Mercator projection.\n */ \nfloat czm_latitudeToWebMercatorFraction(float latitude, float southMercatorY, float oneOverMercatorHeight)\n{\n float sinLatitude = sin(latitude);\n float mercatorY = 0.5 * log((1.0 + sinLatitude) / (1.0 - sinLatitude));\n \n return (mercatorY - southMercatorY) * oneOverMercatorHeight;\n}\n";
  63837. // node_modules/cesium/Source/Shaders/Builtin/Functions/lineDistance.js
  63838. var lineDistance_default = "/**\n * Computes distance from an point in 2D to a line in 2D.\n *\n * @name czm_lineDistance\n * @glslFunction\n *\n * param {vec2} point1 A point along the line.\n * param {vec2} point2 A point along the line.\n * param {vec2} point A point that may or may not be on the line.\n * returns {float} The distance from the point to the line.\n */\nfloat czm_lineDistance(vec2 point1, vec2 point2, vec2 point) {\n return abs((point2.y - point1.y) * point.x - (point2.x - point1.x) * point.y + point2.x * point1.y - point2.y * point1.x) / distance(point2, point1);\n}\n";
  63839. // node_modules/cesium/Source/Shaders/Builtin/Functions/linearToSrgb.js
  63840. var linearToSrgb_default = "/**\n * Converts a linear RGB color to an sRGB color.\n *\n * @param {vec3|vec4} linearIn The color in linear color space.\n * @returns {vec3|vec4} The color in sRGB color space. The vector type matches the input.\n */\nvec3 czm_linearToSrgb(vec3 linearIn) \n{\n return pow(linearIn, vec3(1.0/2.2));\n}\n\nvec4 czm_linearToSrgb(vec4 linearIn) \n{\n vec3 srgbOut = pow(linearIn.rgb, vec3(1.0/2.2));\n return vec4(srgbOut, linearIn.a);\n}\n";
  63841. // node_modules/cesium/Source/Shaders/Builtin/Functions/luminance.js
  63842. var luminance_default = "/**\n * Computes the luminance of a color. \n *\n * @name czm_luminance\n * @glslFunction\n *\n * @param {vec3} rgb The color.\n * \n * @returns {float} The luminance.\n *\n * @example\n * float light = czm_luminance(vec3(0.0)); // 0.0\n * float dark = czm_luminance(vec3(1.0)); // ~1.0 \n */\nfloat czm_luminance(vec3 rgb)\n{\n // Algorithm from Chapter 10 of Graphics Shaders.\n const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n return dot(rgb, W);\n}\n";
  63843. // node_modules/cesium/Source/Shaders/Builtin/Functions/metersPerPixel.js
  63844. var metersPerPixel_default = "/**\n * Computes the size of a pixel in meters at a distance from the eye.\n * <p>\n * Use this version when passing in a custom pixel ratio. For example, passing in 1.0 will return meters per native device pixel.\n * </p>\n * @name czm_metersPerPixel\n * @glslFunction\n *\n * @param {vec3} positionEC The position to get the meters per pixel in eye coordinates.\n * @param {float} pixelRatio The scaling factor from pixel space to coordinate space\n *\n * @returns {float} The meters per pixel at positionEC.\n */\nfloat czm_metersPerPixel(vec4 positionEC, float pixelRatio)\n{\n float width = czm_viewport.z;\n float height = czm_viewport.w;\n float pixelWidth;\n float pixelHeight;\n\n float top = czm_frustumPlanes.x;\n float bottom = czm_frustumPlanes.y;\n float left = czm_frustumPlanes.z;\n float right = czm_frustumPlanes.w;\n\n if (czm_sceneMode == czm_sceneMode2D || czm_orthographicIn3D == 1.0)\n {\n float frustumWidth = right - left;\n float frustumHeight = top - bottom;\n pixelWidth = frustumWidth / width;\n pixelHeight = frustumHeight / height;\n }\n else\n {\n float distanceToPixel = -positionEC.z;\n float inverseNear = 1.0 / czm_currentFrustum.x;\n float tanTheta = top * inverseNear;\n pixelHeight = 2.0 * distanceToPixel * tanTheta / height;\n tanTheta = right * inverseNear;\n pixelWidth = 2.0 * distanceToPixel * tanTheta / width;\n }\n\n return max(pixelWidth, pixelHeight) * pixelRatio;\n}\n\n/**\n * Computes the size of a pixel in meters at a distance from the eye.\n * <p>\n * Use this version when scaling by pixel ratio.\n * </p>\n * @name czm_metersPerPixel\n * @glslFunction\n *\n * @param {vec3} positionEC The position to get the meters per pixel in eye coordinates.\n *\n * @returns {float} The meters per pixel at positionEC.\n */\nfloat czm_metersPerPixel(vec4 positionEC)\n{\n return czm_metersPerPixel(positionEC, czm_pixelRatio);\n}\n";
  63845. // node_modules/cesium/Source/Shaders/Builtin/Functions/modelToWindowCoordinates.js
  63846. var modelToWindowCoordinates_default = "/**\n * Transforms a position from model to window coordinates. The transformation\n * from model to clip coordinates is done using {@link czm_modelViewProjection}.\n * The transform from normalized device coordinates to window coordinates is\n * done using {@link czm_viewportTransformation}, which assumes a depth range\n * of <code>near = 0</code> and <code>far = 1</code>.\n * <br /><br />\n * This transform is useful when there is a need to manipulate window coordinates\n * in a vertex shader as done by {@link BillboardCollection}.\n * <br /><br />\n * This function should not be confused with {@link czm_viewportOrthographic},\n * which is an orthographic projection matrix that transforms from window \n * coordinates to clip coordinates.\n *\n * @name czm_modelToWindowCoordinates\n * @glslFunction\n *\n * @param {vec4} position The position in model coordinates to transform.\n *\n * @returns {vec4} The transformed position in window coordinates.\n *\n * @see czm_eyeToWindowCoordinates\n * @see czm_modelViewProjection\n * @see czm_viewportTransformation\n * @see czm_viewportOrthographic\n * @see BillboardCollection\n *\n * @example\n * vec4 positionWC = czm_modelToWindowCoordinates(positionMC);\n */\nvec4 czm_modelToWindowCoordinates(vec4 position)\n{\n vec4 q = czm_modelViewProjection * position; // clip coordinates\n q.xyz /= q.w; // normalized device coordinates\n q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates\n return q;\n}\n";
  63847. // node_modules/cesium/Source/Shaders/Builtin/Functions/multiplyWithColorBalance.js
  63848. var multiplyWithColorBalance_default = "/**\n * DOC_TBA\n *\n * @name czm_multiplyWithColorBalance\n * @glslFunction\n */\nvec3 czm_multiplyWithColorBalance(vec3 left, vec3 right)\n{\n // Algorithm from Chapter 10 of Graphics Shaders.\n const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n \n vec3 target = left * right;\n float leftLuminance = dot(left, W);\n float rightLuminance = dot(right, W);\n float targetLuminance = dot(target, W);\n \n return ((leftLuminance + rightLuminance) / (2.0 * targetLuminance)) * target;\n}\n";
  63849. // node_modules/cesium/Source/Shaders/Builtin/Functions/nearFarScalar.js
  63850. var nearFarScalar_default = "/**\n * Computes a value that scales with distance. The scaling is clamped at the near and\n * far distances, and does not extrapolate. This function works with the\n * {@link NearFarScalar} JavaScript class.\n *\n * @name czm_nearFarScalar\n * @glslFunction\n *\n * @param {vec4} nearFarScalar A vector with 4 components: Near distance (x), Near value (y), Far distance (z), Far value (w).\n * @param {float} cameraDistSq The square of the current distance from the camera.\n *\n * @returns {float} The value at this distance.\n */\nfloat czm_nearFarScalar(vec4 nearFarScalar, float cameraDistSq)\n{\n float valueAtMin = nearFarScalar.y;\n float valueAtMax = nearFarScalar.w;\n float nearDistanceSq = nearFarScalar.x * nearFarScalar.x;\n float farDistanceSq = nearFarScalar.z * nearFarScalar.z;\n\n float t = (cameraDistSq - nearDistanceSq) / (farDistanceSq - nearDistanceSq);\n\n t = pow(clamp(t, 0.0, 1.0), 0.2);\n\n return mix(valueAtMin, valueAtMax, t);\n}\n";
  63851. // node_modules/cesium/Source/Shaders/Builtin/Functions/octDecode.js
  63852. var octDecode_default = ` /**
  63853. * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component Cartesian vector.
  63854. * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors",
  63855. * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/
  63856. *
  63857. * @name czm_octDecode
  63858. * @param {vec2} encoded The oct-encoded, unit-length vector
  63859. * @param {float} range The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits.
  63860. * @returns {vec3} The decoded and normalized vector
  63861. */
  63862. vec3 czm_octDecode(vec2 encoded, float range)
  63863. {
  63864. if (encoded.x == 0.0 && encoded.y == 0.0) {
  63865. return vec3(0.0, 0.0, 0.0);
  63866. }
  63867. encoded = encoded / range * 2.0 - 1.0;
  63868. vec3 v = vec3(encoded.x, encoded.y, 1.0 - abs(encoded.x) - abs(encoded.y));
  63869. if (v.z < 0.0)
  63870. {
  63871. v.xy = (1.0 - abs(v.yx)) * czm_signNotZero(v.xy);
  63872. }
  63873. return normalize(v);
  63874. }
  63875. /**
  63876. * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component Cartesian vector.
  63877. * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors",
  63878. * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/
  63879. *
  63880. * @name czm_octDecode
  63881. * @param {vec2} encoded The oct-encoded, unit-length vector
  63882. * @returns {vec3} The decoded and normalized vector
  63883. */
  63884. vec3 czm_octDecode(vec2 encoded)
  63885. {
  63886. return czm_octDecode(encoded, 255.0);
  63887. }
  63888. /**
  63889. * Decodes a unit-length vector in 'oct' encoding packed into a floating-point number to a normalized 3-component Cartesian vector.
  63890. * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors",
  63891. * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/
  63892. *
  63893. * @name czm_octDecode
  63894. * @param {float} encoded The oct-encoded, unit-length vector
  63895. * @returns {vec3} The decoded and normalized vector
  63896. */
  63897. vec3 czm_octDecode(float encoded)
  63898. {
  63899. float temp = encoded / 256.0;
  63900. float x = floor(temp);
  63901. float y = (temp - x) * 256.0;
  63902. return czm_octDecode(vec2(x, y));
  63903. }
  63904. /**
  63905. * Decodes three unit-length vectors in 'oct' encoding packed into two floating-point numbers to normalized 3-component Cartesian vectors.
  63906. * The 'oct' encoding is described in "A Survey of Efficient Representations of Independent Unit Vectors",
  63907. * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/
  63908. *
  63909. * @name czm_octDecode
  63910. * @param {vec2} encoded The packed oct-encoded, unit-length vectors.
  63911. * @param {vec3} vector1 One decoded and normalized vector.
  63912. * @param {vec3} vector2 One decoded and normalized vector.
  63913. * @param {vec3} vector3 One decoded and normalized vector.
  63914. */
  63915. void czm_octDecode(vec2 encoded, out vec3 vector1, out vec3 vector2, out vec3 vector3)
  63916. {
  63917. float temp = encoded.x / 65536.0;
  63918. float x = floor(temp);
  63919. float encodedFloat1 = (temp - x) * 65536.0;
  63920. temp = encoded.y / 65536.0;
  63921. float y = floor(temp);
  63922. float encodedFloat2 = (temp - y) * 65536.0;
  63923. vector1 = czm_octDecode(encodedFloat1);
  63924. vector2 = czm_octDecode(encodedFloat2);
  63925. vector3 = czm_octDecode(vec2(x, y));
  63926. }
  63927. `;
  63928. // node_modules/cesium/Source/Shaders/Builtin/Functions/packDepth.js
  63929. var packDepth_default = "/**\n * Packs a depth value into a vec3 that can be represented by unsigned bytes.\n *\n * @name czm_packDepth\n * @glslFunction\n *\n * @param {float} depth The floating-point depth.\n * @returns {vec3} The packed depth.\n */\nvec4 czm_packDepth(float depth)\n{\n // See Aras Pranckevi\u010Dius' post Encoding Floats to RGBA\n // http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/\n vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;\n enc = fract(enc);\n enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n return enc;\n}\n";
  63930. // node_modules/cesium/Source/Shaders/Builtin/Functions/pbrLighting.js
  63931. var pbrLighting_default = "vec3 lambertianDiffuse(vec3 diffuseColor)\n{\n return diffuseColor / czm_pi;\n}\n\nvec3 fresnelSchlick2(vec3 f0, vec3 f90, float VdotH)\n{\n return f0 + (f90 - f0) * pow(clamp(1.0 - VdotH, 0.0, 1.0), 5.0);\n}\n\nfloat smithVisibilityG1(float NdotV, float roughness)\n{\n // this is the k value for direct lighting.\n // for image based lighting it will be roughness^2 / 2\n float k = (roughness + 1.0) * (roughness + 1.0) / 8.0;\n return NdotV / (NdotV * (1.0 - k) + k);\n}\n\nfloat smithVisibilityGGX(float roughness, float NdotL, float NdotV)\n{\n return (\n smithVisibilityG1(NdotL, roughness) *\n smithVisibilityG1(NdotV, roughness)\n );\n}\n\nfloat GGX(float roughness, float NdotH)\n{\n float roughnessSquared = roughness * roughness;\n float f = (NdotH * roughnessSquared - NdotH) * NdotH + 1.0;\n return roughnessSquared / (czm_pi * f * f);\n}\n\n/**\n * Compute the diffuse and specular contributions using physically based\n * rendering. This function only handles direct lighting.\n * <p>\n * This function only handles the lighting calculations. Metallic/roughness\n * and specular/glossy must be handled separately. See {@czm_pbrMetallicRoughnessMaterial}, {@czm_pbrSpecularGlossinessMaterial} and {@czm_defaultPbrMaterial}\n * </p>\n *\n * @name czm_pbrlighting\n * @glslFunction\n *\n * @param {vec3} positionEC The position of the fragment in eye coordinates\n * @param {vec3} normalEC The surface normal in eye coordinates\n * @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.\n * @param {vec3} lightColorHdr radiance of the light source. This is a HDR value.\n * @param {czm_pbrParameters} The computed PBR parameters.\n * @return {vec3} The computed HDR color\n *\n * @example\n * czm_pbrParameters pbrParameters = czm_pbrMetallicRoughnessMaterial(\n * baseColor,\n * metallic,\n * roughness\n * );\n * vec3 color = czm_pbrlighting(\n * positionEC,\n * normalEC,\n * lightDirectionEC,\n * lightColorHdr,\n * pbrParameters);\n */\nvec3 czm_pbrLighting(\n vec3 positionEC,\n vec3 normalEC,\n vec3 lightDirectionEC,\n vec3 lightColorHdr,\n czm_pbrParameters pbrParameters\n)\n{\n vec3 v = -normalize(positionEC);\n vec3 l = normalize(lightDirectionEC);\n vec3 h = normalize(v + l);\n vec3 n = normalEC;\n float NdotL = clamp(dot(n, l), 0.001, 1.0);\n float NdotV = abs(dot(n, v)) + 0.001;\n float NdotH = clamp(dot(n, h), 0.0, 1.0);\n float LdotH = clamp(dot(l, h), 0.0, 1.0);\n float VdotH = clamp(dot(v, h), 0.0, 1.0);\n\n vec3 f0 = pbrParameters.f0;\n float reflectance = max(max(f0.r, f0.g), f0.b);\n vec3 f90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));\n vec3 F = fresnelSchlick2(f0, f90, VdotH);\n\n float alpha = pbrParameters.roughness;\n float G = smithVisibilityGGX(alpha, NdotL, NdotV);\n float D = GGX(alpha, NdotH);\n vec3 specularContribution = F * G * D / (4.0 * NdotL * NdotV);\n\n vec3 diffuseColor = pbrParameters.diffuseColor;\n // F here represents the specular contribution\n vec3 diffuseContribution = (1.0 - F) * lambertianDiffuse(diffuseColor);\n\n // Lo = (diffuse + specular) * Li * NdotL\n return (diffuseContribution + specularContribution) * NdotL * lightColorHdr;\n}\n";
  63932. // node_modules/cesium/Source/Shaders/Builtin/Functions/pbrMetallicRoughnessMaterial.js
  63933. var pbrMetallicRoughnessMaterial_default = "/**\n * Compute parameters for physically based rendering using the\n * metallic/roughness workflow. All inputs are linear; sRGB texture values must\n * be decoded beforehand\n *\n * @name czm_pbrMetallicRoughnessMaterial\n * @glslFunction\n *\n * @param {vec3} baseColor For dielectrics, this is the base color. For metals, this is the f0 value (reflectance at normal incidence)\n * @param {float} metallic 0.0 indicates dielectric. 1.0 indicates metal. Values in between are allowed (e.g. to model rust or dirt);\n * @param {float} roughness A value between 0.0 and 1.0\n * @return {czm_pbrParameters} parameters to pass into {@link czm_pbrLighting}\n */\nczm_pbrParameters czm_pbrMetallicRoughnessMaterial(\n vec3 baseColor,\n float metallic,\n float roughness\n) \n{\n czm_pbrParameters results;\n\n // roughness is authored as perceptual roughness\n // square it to get material roughness\n roughness = clamp(roughness, 0.0, 1.0);\n results.roughness = roughness * roughness;\n\n // dielectrics us f0 = 0.04, metals use albedo as f0\n metallic = clamp(metallic, 0.0, 1.0);\n const vec3 REFLECTANCE_DIELECTRIC = vec3(0.04);\n vec3 f0 = mix(REFLECTANCE_DIELECTRIC, baseColor, metallic);\n results.f0 = f0;\n\n // diffuse only applies to dielectrics.\n results.diffuseColor = baseColor * (1.0 - f0) * (1.0 - metallic);\n\n return results;\n}\n";
  63934. // node_modules/cesium/Source/Shaders/Builtin/Functions/pbrSpecularGlossinessMaterial.js
  63935. var pbrSpecularGlossinessMaterial_default = "/**\n * Compute parameters for physically based rendering using the\n * specular/glossy workflow. All inputs are linear; sRGB texture values must\n * be decoded beforehand\n *\n * @name czm_pbrSpecularGlossinessMaterial\n * @glslFunction\n *\n * @param {vec3} diffuse The diffuse color for dielectrics (non-metals)\n * @param {vec3} specular The reflectance at normal incidence (f0)\n * @param {float} glossiness A number from 0.0 to 1.0 indicating how smooth the surface is.\n * @return {czm_pbrParameters} parameters to pass into {@link czm_pbrLighting}\n */\nczm_pbrParameters czm_pbrSpecularGlossinessMaterial(\n vec3 diffuse,\n vec3 specular,\n float glossiness\n) \n{\n czm_pbrParameters results;\n\n // glossiness is the opposite of roughness, but easier for artists to use.\n float roughness = 1.0 - glossiness;\n results.roughness = roughness * roughness;\n\n results.diffuseColor = diffuse * (1.0 - max(max(specular.r, specular.g), specular.b));\n results.f0 = specular;\n\n return results;\n}\n";
  63936. // node_modules/cesium/Source/Shaders/Builtin/Functions/phong.js
  63937. var phong_default = "float czm_private_getLambertDiffuseOfMaterial(vec3 lightDirectionEC, czm_material material)\n{\n return czm_getLambertDiffuse(lightDirectionEC, material.normal);\n}\n\nfloat czm_private_getSpecularOfMaterial(vec3 lightDirectionEC, vec3 toEyeEC, czm_material material)\n{\n return czm_getSpecular(lightDirectionEC, toEyeEC, material.normal, material.shininess);\n}\n\n/**\n * Computes a color using the Phong lighting model.\n *\n * @name czm_phong\n * @glslFunction\n *\n * @param {vec3} toEye A normalized vector from the fragment to the eye in eye coordinates.\n * @param {czm_material} material The fragment's material.\n *\n * @returns {vec4} The computed color.\n *\n * @example\n * vec3 positionToEyeEC = // ...\n * czm_material material = // ...\n * vec3 lightDirectionEC = // ...\n * gl_FragColor = czm_phong(normalize(positionToEyeEC), material, lightDirectionEC);\n *\n * @see czm_getMaterial\n */\nvec4 czm_phong(vec3 toEye, czm_material material, vec3 lightDirectionEC)\n{\n // Diffuse from directional light sources at eye (for top-down)\n float diffuse = czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 0.0, 1.0), material);\n if (czm_sceneMode == czm_sceneMode3D) {\n // (and horizon views in 3D)\n diffuse += czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 1.0, 0.0), material);\n }\n\n float specular = czm_private_getSpecularOfMaterial(lightDirectionEC, toEye, material);\n\n // Temporary workaround for adding ambient.\n vec3 materialDiffuse = material.diffuse * 0.5;\n\n vec3 ambient = materialDiffuse;\n vec3 color = ambient + material.emission;\n color += materialDiffuse * diffuse * czm_lightColor;\n color += material.specular * specular * czm_lightColor;\n\n return vec4(color, material.alpha);\n}\n\nvec4 czm_private_phong(vec3 toEye, czm_material material, vec3 lightDirectionEC)\n{\n float diffuse = czm_private_getLambertDiffuseOfMaterial(lightDirectionEC, material);\n float specular = czm_private_getSpecularOfMaterial(lightDirectionEC, toEye, material);\n\n vec3 ambient = vec3(0.0);\n vec3 color = ambient + material.emission;\n color += material.diffuse * diffuse * czm_lightColor;\n color += material.specular * specular * czm_lightColor;\n\n return vec4(color, material.alpha);\n}\n";
  63938. // node_modules/cesium/Source/Shaders/Builtin/Functions/planeDistance.js
  63939. var planeDistance_default = "/**\n * Computes distance from a point to a plane.\n *\n * @name czm_planeDistance\n * @glslFunction\n *\n * param {vec4} plane A Plane in Hessian Normal Form. See Plane.js\n * param {vec3} point A point in the same space as the plane.\n * returns {float} The distance from the point to the plane.\n */\nfloat czm_planeDistance(vec4 plane, vec3 point) {\n return (dot(plane.xyz, point) + plane.w);\n}\n\n/**\n * Computes distance from a point to a plane.\n *\n * @name czm_planeDistance\n * @glslFunction\n *\n * param {vec3} planeNormal Normal for a plane in Hessian Normal Form. See Plane.js\n * param {float} planeDistance Distance for a plane in Hessian Normal form. See Plane.js\n * param {vec3} point A point in the same space as the plane.\n * returns {float} The distance from the point to the plane.\n */\nfloat czm_planeDistance(vec3 planeNormal, float planeDistance, vec3 point) {\n return (dot(planeNormal, point) + planeDistance);\n}\n";
  63940. // node_modules/cesium/Source/Shaders/Builtin/Functions/pointAlongRay.js
  63941. var pointAlongRay_default = "/**\n * Computes the point along a ray at the given time. <code>time</code> can be positive, negative, or zero.\n *\n * @name czm_pointAlongRay\n * @glslFunction\n *\n * @param {czm_ray} ray The ray to compute the point along.\n * @param {float} time The time along the ray.\n * \n * @returns {vec3} The point along the ray at the given time.\n * \n * @example\n * czm_ray ray = czm_ray(vec3(0.0), vec3(1.0, 0.0, 0.0)); // origin, direction\n * vec3 v = czm_pointAlongRay(ray, 2.0); // (2.0, 0.0, 0.0)\n */\nvec3 czm_pointAlongRay(czm_ray ray, float time)\n{\n return ray.origin + (time * ray.direction);\n}\n";
  63942. // node_modules/cesium/Source/Shaders/Builtin/Functions/rayEllipsoidIntersectionInterval.js
  63943. var rayEllipsoidIntersectionInterval_default = "/**\n * DOC_TBA\n *\n * @name czm_rayEllipsoidIntersectionInterval\n * @glslFunction\n */\nczm_raySegment czm_rayEllipsoidIntersectionInterval(czm_ray ray, vec3 ellipsoid_center, vec3 ellipsoid_inverseRadii)\n{\n // ray and ellipsoid center in eye coordinates. radii in model coordinates.\n vec3 q = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ray.origin, 1.0)).xyz;\n vec3 w = ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ray.direction, 0.0)).xyz;\n\n q = q - ellipsoid_inverseRadii * (czm_inverseModelView * vec4(ellipsoid_center, 1.0)).xyz;\n\n float q2 = dot(q, q);\n float qw = dot(q, w);\n\n if (q2 > 1.0) // Outside ellipsoid.\n {\n if (qw >= 0.0) // Looking outward or tangent (0 intersections).\n {\n return czm_emptyRaySegment;\n }\n else // qw < 0.0.\n {\n float qw2 = qw * qw;\n float difference = q2 - 1.0; // Positively valued.\n float w2 = dot(w, w);\n float product = w2 * difference;\n\n if (qw2 < product) // Imaginary roots (0 intersections).\n {\n return czm_emptyRaySegment;\n }\n else if (qw2 > product) // Distinct roots (2 intersections).\n {\n float discriminant = qw * qw - product;\n float temp = -qw + sqrt(discriminant); // Avoid cancellation.\n float root0 = temp / w2;\n float root1 = difference / temp;\n if (root0 < root1)\n {\n czm_raySegment i = czm_raySegment(root0, root1);\n return i;\n }\n else\n {\n czm_raySegment i = czm_raySegment(root1, root0);\n return i;\n }\n }\n else // qw2 == product. Repeated roots (2 intersections).\n {\n float root = sqrt(difference / w2);\n czm_raySegment i = czm_raySegment(root, root);\n return i;\n }\n }\n }\n else if (q2 < 1.0) // Inside ellipsoid (2 intersections).\n {\n float difference = q2 - 1.0; // Negatively valued.\n float w2 = dot(w, w);\n float product = w2 * difference; // Negatively valued.\n float discriminant = qw * qw - product;\n float temp = -qw + sqrt(discriminant); // Positively valued.\n czm_raySegment i = czm_raySegment(0.0, temp / w2);\n return i;\n }\n else // q2 == 1.0. On ellipsoid.\n {\n if (qw < 0.0) // Looking inward.\n {\n float w2 = dot(w, w);\n czm_raySegment i = czm_raySegment(0.0, -qw / w2);\n return i;\n }\n else // qw >= 0.0. Looking outward or tangent.\n {\n return czm_emptyRaySegment;\n }\n }\n}\n";
  63944. // node_modules/cesium/Source/Shaders/Builtin/Functions/raySphereIntersectionInterval.js
  63945. var raySphereIntersectionInterval_default = "/**\n * Compute the intersection interval of a ray with a sphere.\n *\n * @name czm_raySphereIntersectionInterval\n * @glslFunction\n *\n * @param {czm_ray} ray The ray.\n * @param {vec3} center The center of the sphere.\n * @param {float} radius The radius of the sphere.\n * @return {czm_raySegment} The intersection interval of the ray with the sphere.\n */\nczm_raySegment czm_raySphereIntersectionInterval(czm_ray ray, vec3 center, float radius)\n{\n vec3 o = ray.origin;\n vec3 d = ray.direction;\n\n vec3 oc = o - center;\n\n float a = dot(d, d);\n float b = 2.0 * dot(d, oc);\n float c = dot(oc, oc) - (radius * radius);\n\n float det = (b * b) - (4.0 * a * c);\n\n if (det < 0.0) {\n return czm_emptyRaySegment;\n }\n\n float sqrtDet = sqrt(det);\n\n float t0 = (-b - sqrtDet) / (2.0 * a);\n float t1 = (-b + sqrtDet) / (2.0 * a);\n\n czm_raySegment result = czm_raySegment(t0, t1);\n return result;\n}\n";
  63946. // node_modules/cesium/Source/Shaders/Builtin/Functions/readDepth.js
  63947. var readDepth_default = "float czm_readDepth(sampler2D depthTexture, vec2 texCoords)\n{\n return czm_reverseLogDepth(texture2D(depthTexture, texCoords).r);\n}\n";
  63948. // node_modules/cesium/Source/Shaders/Builtin/Functions/readNonPerspective.js
  63949. var readNonPerspective_default = "/**\n * Reads a value previously transformed with {@link czm_writeNonPerspective}\n * by dividing it by `w`, the value used in the perspective divide.\n * This function is intended to be called in a fragment shader to access a\n * `varying` that should not be subject to perspective interpolation.\n * For example, screen-space texture coordinates. The value should have been\n * previously written in the vertex shader with a call to\n * {@link czm_writeNonPerspective}.\n *\n * @name czm_readNonPerspective\n * @glslFunction\n *\n * @param {float|vec2|vec3|vec4} value The non-perspective value to be read.\n * @param {float} oneOverW One over the perspective divide value, `w`. Usually this is simply `gl_FragCoord.w`.\n * @returns {float|vec2|vec3|vec4} The usable value.\n */\nfloat czm_readNonPerspective(float value, float oneOverW) {\n return value * oneOverW;\n}\n\nvec2 czm_readNonPerspective(vec2 value, float oneOverW) {\n return value * oneOverW;\n}\n\nvec3 czm_readNonPerspective(vec3 value, float oneOverW) {\n return value * oneOverW;\n}\n\nvec4 czm_readNonPerspective(vec4 value, float oneOverW) {\n return value * oneOverW;\n}\n";
  63950. // node_modules/cesium/Source/Shaders/Builtin/Functions/reverseLogDepth.js
  63951. var reverseLogDepth_default = "float czm_reverseLogDepth(float logZ)\n{\n#ifdef LOG_DEPTH\n float near = czm_currentFrustum.x;\n float far = czm_currentFrustum.y;\n float log2Depth = logZ * czm_log2FarDepthFromNearPlusOne;\n float depthFromNear = pow(2.0, log2Depth) - 1.0;\n return far * (1.0 - near / (depthFromNear + near)) / (far - near);\n#endif\n return logZ;\n}\n";
  63952. // node_modules/cesium/Source/Shaders/Builtin/Functions/round.js
  63953. var round_default = "/**\n * Round a floating point value. This function exists because round() doesn't\n * exist in GLSL 1.00. \n *\n * @param {float|vec2|vec3|vec4} value The value to round\n * @param {float|vec2|vec3|vec3} The rounded value. The type matches the input.\n */\nfloat czm_round(float value) {\n return floor(value + 0.5);\n}\n\nvec2 czm_round(vec2 value) {\n return floor(value + 0.5);\n}\n\nvec3 czm_round(vec3 value) {\n return floor(value + 0.5);\n}\n\nvec4 czm_round(vec4 value) {\n return floor(value + 0.5);\n}\n";
  63954. // node_modules/cesium/Source/Shaders/Builtin/Functions/sampleOctahedralProjection.js
  63955. var sampleOctahedralProjection_default = "/**\n * Samples the 4 neighboring pixels and return the weighted average.\n *\n * @private\n */\nvec3 czm_sampleOctahedralProjectionWithFiltering(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod)\n{\n direction /= dot(vec3(1.0), abs(direction));\n vec2 rev = abs(direction.zx) - vec2(1.0);\n vec2 neg = vec2(direction.x < 0.0 ? rev.x : -rev.x,\n direction.z < 0.0 ? rev.y : -rev.y);\n vec2 uv = direction.y < 0.0 ? neg : direction.xz;\n vec2 coord = 0.5 * uv + vec2(0.5);\n vec2 pixel = 1.0 / textureSize;\n\n if (lod > 0.0)\n {\n // Each subseqeuent mip level is half the size\n float scale = 1.0 / pow(2.0, lod);\n float offset = ((textureSize.y + 1.0) / textureSize.x);\n\n coord.x *= offset;\n coord *= scale;\n\n coord.x += offset + pixel.x;\n coord.y += (1.0 - (1.0 / pow(2.0, lod - 1.0))) + pixel.y * (lod - 1.0) * 2.0;\n }\n else\n {\n coord.x *= (textureSize.y / textureSize.x);\n }\n\n // Do bilinear filtering\n #ifndef OES_texture_float_linear\n vec3 color1 = texture2D(projectedMap, coord + vec2(0.0, pixel.y)).rgb;\n vec3 color2 = texture2D(projectedMap, coord + vec2(pixel.x, 0.0)).rgb;\n vec3 color3 = texture2D(projectedMap, coord + pixel).rgb;\n vec3 color4 = texture2D(projectedMap, coord).rgb;\n\n vec2 texturePosition = coord * textureSize;\n\n float fu = fract(texturePosition.x);\n float fv = fract(texturePosition.y);\n\n vec3 average1 = mix(color4, color2, fu);\n vec3 average2 = mix(color1, color3, fu);\n\n vec3 color = mix(average1, average2, fv);\n #else\n vec3 color = texture2D(projectedMap, coord).rgb;\n #endif\n\n return color;\n}\n\n\n/**\n * Samples from a cube map that has been projected using an octahedral projection from the given direction.\n *\n * @name czm_sampleOctahedralProjection\n * @glslFunction\n *\n * @param {sampler2D} projectedMap The texture with the octahedral projected cube map.\n * @param {vec2} textureSize The width and height dimensions in pixels of the projected map.\n * @param {vec3} direction The normalized direction used to sample the cube map.\n * @param {float} lod The level of detail to sample.\n * @param {float} maxLod The maximum level of detail.\n * @returns {vec3} The color of the cube map at the direction.\n */\nvec3 czm_sampleOctahedralProjection(sampler2D projectedMap, vec2 textureSize, vec3 direction, float lod, float maxLod) {\n float currentLod = floor(lod + 0.5);\n float nextLod = min(currentLod + 1.0, maxLod);\n\n vec3 colorCurrentLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, currentLod);\n vec3 colorNextLod = czm_sampleOctahedralProjectionWithFiltering(projectedMap, textureSize, direction, nextLod);\n\n return mix(colorNextLod, colorCurrentLod, nextLod - lod);\n}\n";
  63956. // node_modules/cesium/Source/Shaders/Builtin/Functions/saturation.js
  63957. var saturation_default = "/**\n * Adjusts the saturation of a color.\n * \n * @name czm_saturation\n * @glslFunction\n * \n * @param {vec3} rgb The color.\n * @param {float} adjustment The amount to adjust the saturation of the color.\n *\n * @returns {float} The color with the saturation adjusted.\n *\n * @example\n * vec3 greyScale = czm_saturation(color, 0.0);\n * vec3 doubleSaturation = czm_saturation(color, 2.0);\n */\nvec3 czm_saturation(vec3 rgb, float adjustment)\n{\n // Algorithm from Chapter 16 of OpenGL Shading Language\n const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n vec3 intensity = vec3(dot(rgb, W));\n return mix(intensity, rgb, adjustment);\n}\n";
  63958. // node_modules/cesium/Source/Shaders/Builtin/Functions/shadowDepthCompare.js
  63959. var shadowDepthCompare_default = "\nfloat czm_sampleShadowMap(highp samplerCube shadowMap, vec3 d)\n{\n return czm_unpackDepth(textureCube(shadowMap, d));\n}\n\nfloat czm_sampleShadowMap(highp sampler2D shadowMap, vec2 uv)\n{\n#ifdef USE_SHADOW_DEPTH_TEXTURE\n return texture2D(shadowMap, uv).r;\n#else\n return czm_unpackDepth(texture2D(shadowMap, uv));\n#endif\n}\n\nfloat czm_shadowDepthCompare(samplerCube shadowMap, vec3 uv, float depth)\n{\n return step(depth, czm_sampleShadowMap(shadowMap, uv));\n}\n\nfloat czm_shadowDepthCompare(sampler2D shadowMap, vec2 uv, float depth)\n{\n return step(depth, czm_sampleShadowMap(shadowMap, uv));\n}\n";
  63960. // node_modules/cesium/Source/Shaders/Builtin/Functions/shadowVisibility.js
  63961. var shadowVisibility_default = "\nfloat czm_private_shadowVisibility(float visibility, float nDotL, float normalShadingSmooth, float darkness)\n{\n#ifdef USE_NORMAL_SHADING\n#ifdef USE_NORMAL_SHADING_SMOOTH\n float strength = clamp(nDotL / normalShadingSmooth, 0.0, 1.0);\n#else\n float strength = step(0.0, nDotL);\n#endif\n visibility *= strength;\n#endif\n\n visibility = max(visibility, darkness);\n return visibility;\n}\n\n#ifdef USE_CUBE_MAP_SHADOW\nfloat czm_shadowVisibility(samplerCube shadowMap, czm_shadowParameters shadowParameters)\n{\n float depthBias = shadowParameters.depthBias;\n float depth = shadowParameters.depth;\n float nDotL = shadowParameters.nDotL;\n float normalShadingSmooth = shadowParameters.normalShadingSmooth;\n float darkness = shadowParameters.darkness;\n vec3 uvw = shadowParameters.texCoords;\n\n depth -= depthBias;\n float visibility = czm_shadowDepthCompare(shadowMap, uvw, depth);\n return czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);\n}\n#else\nfloat czm_shadowVisibility(sampler2D shadowMap, czm_shadowParameters shadowParameters)\n{\n float depthBias = shadowParameters.depthBias;\n float depth = shadowParameters.depth;\n float nDotL = shadowParameters.nDotL;\n float normalShadingSmooth = shadowParameters.normalShadingSmooth;\n float darkness = shadowParameters.darkness;\n vec2 uv = shadowParameters.texCoords;\n\n depth -= depthBias;\n#ifdef USE_SOFT_SHADOWS\n vec2 texelStepSize = shadowParameters.texelStepSize;\n float radius = 1.0;\n float dx0 = -texelStepSize.x * radius;\n float dy0 = -texelStepSize.y * radius;\n float dx1 = texelStepSize.x * radius;\n float dy1 = texelStepSize.y * radius;\n float visibility = (\n czm_shadowDepthCompare(shadowMap, uv, depth) +\n czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy0), depth) +\n czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy0), depth) +\n czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy0), depth) +\n czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, 0.0), depth) +\n czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, 0.0), depth) +\n czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy1), depth) +\n czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy1), depth) +\n czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy1), depth)\n ) * (1.0 / 9.0);\n#else\n float visibility = czm_shadowDepthCompare(shadowMap, uv, depth);\n#endif\n\n return czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);\n}\n#endif\n";
  63962. // node_modules/cesium/Source/Shaders/Builtin/Functions/signNotZero.js
  63963. var signNotZero_default = "/**\n * Returns 1.0 if the given value is positive or zero, and -1.0 if it is negative. This is similar to the GLSL\n * built-in function <code>sign</code> except that returns 1.0 instead of 0.0 when the input value is 0.0.\n * \n * @name czm_signNotZero\n * @glslFunction\n *\n * @param {} value The value for which to determine the sign.\n * @returns {} 1.0 if the value is positive or zero, -1.0 if the value is negative.\n */\nfloat czm_signNotZero(float value)\n{\n return value >= 0.0 ? 1.0 : -1.0;\n}\n\nvec2 czm_signNotZero(vec2 value)\n{\n return vec2(czm_signNotZero(value.x), czm_signNotZero(value.y));\n}\n\nvec3 czm_signNotZero(vec3 value)\n{\n return vec3(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z));\n}\n\nvec4 czm_signNotZero(vec4 value)\n{\n return vec4(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z), czm_signNotZero(value.w));\n}\n";
  63964. // node_modules/cesium/Source/Shaders/Builtin/Functions/sphericalHarmonics.js
  63965. var sphericalHarmonics_default = "/**\n * Computes a color from the third order spherical harmonic coefficients and a normalized direction vector.\n * <p>\n * The order of the coefficients is [L00, L1_1, L10, L11, L2_2, L2_1, L20, L21, L22].\n * </p>\n *\n * @name czm_sphericalHarmonics\n * @glslFunction\n *\n * @param {vec3} normal The normalized direction.\n * @param {vec3[9]} coefficients The third order spherical harmonic coefficients.\n * @returns {vec3} The color at the direction.\n *\n * @see https://graphics.stanford.edu/papers/envmap/envmap.pdf\n */\nvec3 czm_sphericalHarmonics(vec3 normal, vec3 coefficients[9])\n{\n vec3 L00 = coefficients[0];\n vec3 L1_1 = coefficients[1];\n vec3 L10 = coefficients[2];\n vec3 L11 = coefficients[3];\n vec3 L2_2 = coefficients[4];\n vec3 L2_1 = coefficients[5];\n vec3 L20 = coefficients[6];\n vec3 L21 = coefficients[7];\n vec3 L22 = coefficients[8];\n\n float x = normal.x;\n float y = normal.y;\n float z = normal.z;\n\n return\n L00\n + L1_1 * y\n + L10 * z\n + L11 * x\n + L2_2 * (y * x)\n + L2_1 * (y * z)\n + L20 * (3.0 * z * z - 1.0)\n + L21 * (z * x)\n + L22 * (x * x - y * y);\n}\n";
  63966. // node_modules/cesium/Source/Shaders/Builtin/Functions/srgbToLinear.js
  63967. var srgbToLinear_default = "/**\n * Converts an sRGB color to a linear RGB color.\n *\n * @param {vec3|vec4} srgbIn The color in sRGB space\n * @returns {vec3|vec4} The color in linear color space. The vector type matches the input.\n */\nvec3 czm_srgbToLinear(vec3 srgbIn)\n{\n return pow(srgbIn, vec3(2.2));\n}\n\nvec4 czm_srgbToLinear(vec4 srgbIn) \n{\n vec3 linearOut = pow(srgbIn.rgb, vec3(2.2));\n return vec4(linearOut, srgbIn.a);\n}\n";
  63968. // node_modules/cesium/Source/Shaders/Builtin/Functions/tangentToEyeSpaceMatrix.js
  63969. var tangentToEyeSpaceMatrix_default = "/**\n * Creates a matrix that transforms vectors from tangent space to eye space.\n *\n * @name czm_tangentToEyeSpaceMatrix\n * @glslFunction\n *\n * @param {vec3} normalEC The normal vector in eye coordinates.\n * @param {vec3} tangentEC The tangent vector in eye coordinates.\n * @param {vec3} bitangentEC The bitangent vector in eye coordinates.\n *\n * @returns {mat3} The matrix that transforms from tangent space to eye space.\n *\n * @example\n * mat3 tangentToEye = czm_tangentToEyeSpaceMatrix(normalEC, tangentEC, bitangentEC);\n * vec3 normal = tangentToEye * texture2D(normalMap, st).xyz;\n */\nmat3 czm_tangentToEyeSpaceMatrix(vec3 normalEC, vec3 tangentEC, vec3 bitangentEC)\n{\n vec3 normal = normalize(normalEC);\n vec3 tangent = normalize(tangentEC);\n vec3 bitangent = normalize(bitangentEC);\n return mat3(tangent.x , tangent.y , tangent.z,\n bitangent.x, bitangent.y, bitangent.z,\n normal.x , normal.y , normal.z);\n}\n";
  63970. // node_modules/cesium/Source/Shaders/Builtin/Functions/transformPlane.js
  63971. var transformPlane_default = "/**\n * Transforms a plane.\n * \n * @name czm_transformPlane\n * @glslFunction\n *\n * @param {vec4} plane The plane in Hessian Normal Form.\n * @param {mat4} transform The inverse-transpose of a transformation matrix.\n */\nvec4 czm_transformPlane(vec4 plane, mat4 transform) {\n vec4 transformedPlane = transform * plane;\n // Convert the transformed plane to Hessian Normal Form\n float normalMagnitude = length(transformedPlane.xyz);\n return transformedPlane / normalMagnitude;\n}\n";
  63972. // node_modules/cesium/Source/Shaders/Builtin/Functions/translateRelativeToEye.js
  63973. var translateRelativeToEye_default = "/**\n * Translates a position (or any <code>vec3</code>) that was encoded with {@link EncodedCartesian3},\n * and then provided to the shader as separate <code>high</code> and <code>low</code> bits to\n * be relative to the eye. As shown in the example, the position can then be transformed in eye\n * or clip coordinates using {@link czm_modelViewRelativeToEye} or {@link czm_modelViewProjectionRelativeToEye},\n * respectively.\n * <p>\n * This technique, called GPU RTE, eliminates jittering artifacts when using large coordinates as\n * described in {@link http://help.agi.com/AGIComponents/html/BlogPrecisionsPrecisions.htm|Precisions, Precisions}.\n * </p>\n *\n * @name czm_translateRelativeToEye\n * @glslFunction\n *\n * @param {vec3} high The position's high bits.\n * @param {vec3} low The position's low bits.\n * @returns {vec3} The position translated to be relative to the camera's position.\n *\n * @example\n * attribute vec3 positionHigh;\n * attribute vec3 positionLow;\n *\n * void main()\n * {\n * vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\n * gl_Position = czm_modelViewProjectionRelativeToEye * p;\n * }\n *\n * @see czm_modelViewRelativeToEye\n * @see czm_modelViewProjectionRelativeToEye\n * @see czm_computePosition\n * @see EncodedCartesian3\n */\nvec4 czm_translateRelativeToEye(vec3 high, vec3 low)\n{\n vec3 highDifference = high - czm_encodedCameraPositionMCHigh;\n vec3 lowDifference = low - czm_encodedCameraPositionMCLow;\n\n return vec4(highDifference + lowDifference, 1.0);\n}\n";
  63974. // node_modules/cesium/Source/Shaders/Builtin/Functions/translucentPhong.js
  63975. var translucentPhong_default = "/**\n * @private\n */\nvec4 czm_translucentPhong(vec3 toEye, czm_material material, vec3 lightDirectionEC)\n{\n // Diffuse from directional light sources at eye (for top-down and horizon views)\n float diffuse = czm_getLambertDiffuse(vec3(0.0, 0.0, 1.0), material.normal);\n\n if (czm_sceneMode == czm_sceneMode3D) {\n // (and horizon views in 3D)\n diffuse += czm_getLambertDiffuse(vec3(0.0, 1.0, 0.0), material.normal);\n }\n\n diffuse = clamp(diffuse, 0.0, 1.0);\n\n float specular = czm_getSpecular(lightDirectionEC, toEye, material.normal, material.shininess);\n\n // Temporary workaround for adding ambient.\n vec3 materialDiffuse = material.diffuse * 0.5;\n\n vec3 ambient = materialDiffuse;\n vec3 color = ambient + material.emission;\n color += materialDiffuse * diffuse * czm_lightColor;\n color += material.specular * specular * czm_lightColor;\n\n return vec4(color, material.alpha);\n}\n";
  63976. // node_modules/cesium/Source/Shaders/Builtin/Functions/transpose.js
  63977. var transpose_default = "/**\n * Returns the transpose of the matrix. The input <code>matrix</code> can be\n * a <code>mat2</code>, <code>mat3</code>, or <code>mat4</code>.\n *\n * @name czm_transpose\n * @glslFunction\n *\n * @param {} matrix The matrix to transpose.\n *\n * @returns {} The transposed matrix.\n *\n * @example\n * // GLSL declarations\n * mat2 czm_transpose(mat2 matrix);\n * mat3 czm_transpose(mat3 matrix);\n * mat4 czm_transpose(mat4 matrix);\n *\n * // Transpose a 3x3 rotation matrix to find its inverse.\n * mat3 eastNorthUpToEye = czm_eastNorthUpToEyeCoordinates(\n * positionMC, normalEC);\n * mat3 eyeToEastNorthUp = czm_transpose(eastNorthUpToEye);\n */\nmat2 czm_transpose(mat2 matrix)\n{\n return mat2(\n matrix[0][0], matrix[1][0],\n matrix[0][1], matrix[1][1]);\n}\n\nmat3 czm_transpose(mat3 matrix)\n{\n return mat3(\n matrix[0][0], matrix[1][0], matrix[2][0],\n matrix[0][1], matrix[1][1], matrix[2][1],\n matrix[0][2], matrix[1][2], matrix[2][2]);\n}\n\nmat4 czm_transpose(mat4 matrix)\n{\n return mat4(\n matrix[0][0], matrix[1][0], matrix[2][0], matrix[3][0],\n matrix[0][1], matrix[1][1], matrix[2][1], matrix[3][1],\n matrix[0][2], matrix[1][2], matrix[2][2], matrix[3][2],\n matrix[0][3], matrix[1][3], matrix[2][3], matrix[3][3]);\n}\n";
  63978. // node_modules/cesium/Source/Shaders/Builtin/Functions/unpackDepth.js
  63979. var unpackDepth_default = "/**\n * Unpacks a vec4 depth value to a float in [0, 1) range.\n *\n * @name czm_unpackDepth\n * @glslFunction\n *\n * @param {vec4} packedDepth The packed depth.\n *\n * @returns {float} The floating-point depth in [0, 1) range.\n */\n float czm_unpackDepth(vec4 packedDepth)\n {\n // See Aras Pranckevi\u010Dius' post Encoding Floats to RGBA\n // http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/\n return dot(packedDepth, vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));\n }\n";
  63980. // node_modules/cesium/Source/Shaders/Builtin/Functions/unpackFloat.js
  63981. var unpackFloat_default = "/**\n * Unpack an IEEE 754 single-precision float that is packed as a little-endian unsigned normalized vec4.\n *\n * @name czm_unpackFloat\n * @glslFunction\n *\n * @param {vec4} packedFloat The packed float.\n *\n * @returns {float} The floating-point depth in arbitrary range.\n */\nfloat czm_unpackFloat(vec4 packedFloat)\n{\n // Convert to [0.0, 255.0] and round to integer\n packedFloat = floor(packedFloat * 255.0 + 0.5);\n float sign = 1.0 - step(128.0, packedFloat[3]) * 2.0;\n float exponent = 2.0 * mod(packedFloat[3], 128.0) + step(128.0, packedFloat[2]) - 127.0; \n if (exponent == -127.0)\n {\n return 0.0;\n }\n float mantissa = mod(packedFloat[2], 128.0) * 65536.0 + packedFloat[1] * 256.0 + packedFloat[0] + float(0x800000);\n float result = sign * exp2(exponent - 23.0) * mantissa;\n return result;\n}\n";
  63982. // node_modules/cesium/Source/Shaders/Builtin/Functions/unpackUint.js
  63983. var unpackUint_default = "/**\n * Unpack unsigned integers of 1-4 bytes. in WebGL 1, there is no uint type,\n * so the return value is an int.\n * <p>\n * There are also precision limitations in WebGL 1. highp int is still limited\n * to 24 bits. Above the value of 2^24 = 16777216, precision loss may occur.\n * </p>\n *\n * @param {float|vec2|vec3|vec4} packed The packed value. For vectors, the components are listed in little-endian order.\n *\n * @return {int} The unpacked value.\n */\n int czm_unpackUint(float packedValue) {\n float rounded = czm_round(packedValue * 255.0);\n return int(rounded);\n }\n\n int czm_unpackUint(vec2 packedValue) {\n vec2 rounded = czm_round(packedValue * 255.0);\n return int(dot(rounded, vec2(1.0, 256.0)));\n }\n\n int czm_unpackUint(vec3 packedValue) {\n vec3 rounded = czm_round(packedValue * 255.0);\n return int(dot(rounded, vec3(1.0, 256.0, 65536.0)));\n }\n\n int czm_unpackUint(vec4 packedValue) {\n vec4 rounded = czm_round(packedValue * 255.0);\n return int(dot(rounded, vec4(1.0, 256.0, 65536.0, 16777216.0)));\n }\n";
  63984. // node_modules/cesium/Source/Shaders/Builtin/Functions/valueTransform.js
  63985. var valueTransform_default = "/**\n * Transform metadata values following the EXT_structural_metadata spec\n * by multiplying by scale and adding the offset. Operations are always\n * performed component-wise, even for matrices.\n * \n * @param {float|vec2|vec3|vec4|mat2|mat3|mat4} offset The offset to add\n * @param {float|vec2|vec3|vec4|mat2|mat3|mat4} scale The scale factor to multiply\n * @param {float|vec2|vec3|vec4|mat2|mat3|mat4} value The original value.\n *\n * @return {float|vec2|vec3|vec4|mat2|mat3|mat4} The transformed value of the same scalar/vector/matrix type as the input.\n */\nfloat czm_valueTransform(float offset, float scale, float value) {\n return scale * value + offset;\n}\n\nvec2 czm_valueTransform(vec2 offset, vec2 scale, vec2 value) {\n return scale * value + offset;\n}\n\nvec3 czm_valueTransform(vec3 offset, vec3 scale, vec3 value) {\n return scale * value + offset;\n}\n\nvec4 czm_valueTransform(vec4 offset, vec4 scale, vec4 value) {\n return scale * value + offset;\n}\n\nmat2 czm_valueTransform(mat2 offset, mat2 scale, mat2 value) {\n return matrixCompMult(scale, value) + offset;\n}\n\nmat3 czm_valueTransform(mat3 offset, mat3 scale, mat3 value) {\n return matrixCompMult(scale, value) + offset;\n}\n\nmat4 czm_valueTransform(mat4 offset, mat4 scale, mat4 value) {\n return matrixCompMult(scale, value) + offset;\n}\n";
  63986. // node_modules/cesium/Source/Shaders/Builtin/Functions/vertexLogDepth.js
  63987. var vertexLogDepth_default = "#ifdef LOG_DEPTH\n// 1.0 at the near plane, increasing linearly from there.\nvarying float v_depthFromNearPlusOne;\n#ifdef SHADOW_MAP\nvarying vec3 v_logPositionEC;\n#endif\n#endif\n\nvec4 czm_updatePositionDepth(vec4 coords) {\n#if defined(LOG_DEPTH)\n\n#ifdef SHADOW_MAP\n vec3 logPositionEC = (czm_inverseProjection * coords).xyz;\n v_logPositionEC = logPositionEC;\n#endif\n\n // With the very high far/near ratios used with the logarithmic depth\n // buffer, floating point rounding errors can cause linear depth values\n // to end up on the wrong side of the far plane, even for vertices that\n // are really nowhere near it. Since we always write a correct logarithmic\n // depth value in the fragment shader anyway, we just need to make sure\n // such errors don't cause the primitive to be clipped entirely before\n // we even get to the fragment shader.\n coords.z = clamp(coords.z / coords.w, -1.0, 1.0) * coords.w;\n#endif\n\n return coords;\n}\n\n/**\n * Writes the logarithmic depth to gl_Position using the already computed gl_Position.\n *\n * @name czm_vertexLogDepth\n * @glslFunction\n */\nvoid czm_vertexLogDepth()\n{\n#ifdef LOG_DEPTH\n v_depthFromNearPlusOne = (gl_Position.w - czm_currentFrustum.x) + 1.0;\n gl_Position = czm_updatePositionDepth(gl_Position);\n#endif\n}\n\n/**\n * Writes the logarithmic depth to gl_Position using the provided clip coordinates.\n * <p>\n * An example use case for this function would be moving the vertex in window coordinates\n * before converting back to clip coordinates. Use the original vertex clip coordinates.\n * </p>\n * @name czm_vertexLogDepth\n * @glslFunction\n *\n * @param {vec4} clipCoords The vertex in clip coordinates.\n *\n * @example\n * czm_vertexLogDepth(czm_projection * vec4(positionEyeCoordinates, 1.0));\n */\nvoid czm_vertexLogDepth(vec4 clipCoords)\n{\n#ifdef LOG_DEPTH\n v_depthFromNearPlusOne = (clipCoords.w - czm_currentFrustum.x) + 1.0;\n czm_updatePositionDepth(clipCoords);\n#endif\n}\n";
  63988. // node_modules/cesium/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.js
  63989. var windowToEyeCoordinates_default = "/**\n * Transforms a position from window to eye coordinates.\n * The transform from window to normalized device coordinates is done using components\n * of (@link czm_viewport} and {@link czm_viewportTransformation} instead of calculating\n * the inverse of <code>czm_viewportTransformation</code>. The transformation from\n * normalized device coordinates to clip coordinates is done using <code>fragmentCoordinate.w</code>,\n * which is expected to be the scalar used in the perspective divide. The transformation\n * from clip to eye coordinates is done using {@link czm_inverseProjection}.\n *\n * @name czm_windowToEyeCoordinates\n * @glslFunction\n *\n * @param {vec4} fragmentCoordinate The position in window coordinates to transform.\n *\n * @returns {vec4} The transformed position in eye coordinates.\n *\n * @see czm_modelToWindowCoordinates\n * @see czm_eyeToWindowCoordinates\n * @see czm_inverseProjection\n * @see czm_viewport\n * @see czm_viewportTransformation\n *\n * @example\n * vec4 positionEC = czm_windowToEyeCoordinates(gl_FragCoord);\n */\nvec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)\n{\n // Reconstruct NDC coordinates\n float x = 2.0 * (fragmentCoordinate.x - czm_viewport.x) / czm_viewport.z - 1.0;\n float y = 2.0 * (fragmentCoordinate.y - czm_viewport.y) / czm_viewport.w - 1.0;\n float z = (fragmentCoordinate.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\n vec4 q = vec4(x, y, z, 1.0);\n\n // Reverse the perspective division to obtain clip coordinates.\n q /= fragmentCoordinate.w;\n\n // Reverse the projection transformation to obtain eye coordinates.\n if (!(czm_inverseProjection == mat4(0.0))) // IE and Edge sometimes do something weird with != between mat4s\n {\n q = czm_inverseProjection * q;\n }\n else\n {\n float top = czm_frustumPlanes.x;\n float bottom = czm_frustumPlanes.y;\n float left = czm_frustumPlanes.z;\n float right = czm_frustumPlanes.w;\n\n float near = czm_currentFrustum.x;\n float far = czm_currentFrustum.y;\n\n q.x = (q.x * (right - left) + left + right) * 0.5;\n q.y = (q.y * (top - bottom) + bottom + top) * 0.5;\n q.z = (q.z * (near - far) - near - far) * 0.5;\n q.w = 1.0;\n }\n\n return q;\n}\n\n/**\n * Transforms a position given as window x/y and a depth or a log depth from window to eye coordinates.\n * This function produces more accurate results for window positions with log depth than\n * conventionally unpacking the log depth using czm_reverseLogDepth and using the standard version\n * of czm_windowToEyeCoordinates.\n *\n * @name czm_windowToEyeCoordinates\n * @glslFunction\n *\n * @param {vec2} fragmentCoordinateXY The XY position in window coordinates to transform.\n * @param {float} depthOrLogDepth A depth or log depth for the fragment.\n *\n * @see czm_modelToWindowCoordinates\n * @see czm_eyeToWindowCoordinates\n * @see czm_inverseProjection\n * @see czm_viewport\n * @see czm_viewportTransformation\n *\n * @returns {vec4} The transformed position in eye coordinates.\n */\nvec4 czm_windowToEyeCoordinates(vec2 fragmentCoordinateXY, float depthOrLogDepth)\n{\n // See reverseLogDepth.glsl. This is separate to re-use the pow.\n#ifdef LOG_DEPTH\n float near = czm_currentFrustum.x;\n float far = czm_currentFrustum.y;\n float log2Depth = depthOrLogDepth * czm_log2FarDepthFromNearPlusOne;\n float depthFromNear = pow(2.0, log2Depth) - 1.0;\n float depthFromCamera = depthFromNear + near;\n vec4 windowCoord = vec4(fragmentCoordinateXY, far * (1.0 - near / depthFromCamera) / (far - near), 1.0);\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(windowCoord);\n eyeCoordinate.w = 1.0 / depthFromCamera; // Better precision\n return eyeCoordinate;\n#else\n vec4 windowCoord = vec4(fragmentCoordinateXY, depthOrLogDepth, 1.0);\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(windowCoord);\n#endif\n return eyeCoordinate;\n}\n";
  63990. // node_modules/cesium/Source/Shaders/Builtin/Functions/writeDepthClamp.js
  63991. var writeDepthClamp_default = "// emulated noperspective\n#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)\nvarying float v_WindowZ;\n#endif\n\n/**\n * Emulates GL_DEPTH_CLAMP. Clamps a fragment to the near and far plane\n * by writing the fragment's depth. See czm_depthClamp for more details.\n * <p>\n * The shader must enable the GL_EXT_frag_depth extension.\n * </p>\n *\n * @name czm_writeDepthClamp\n * @glslFunction\n *\n * @example\n * gl_FragColor = color;\n * czm_writeDepthClamp();\n *\n * @see czm_depthClamp\n */\nvoid czm_writeDepthClamp()\n{\n#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)\n gl_FragDepthEXT = clamp(v_WindowZ * gl_FragCoord.w, 0.0, 1.0);\n#endif\n}\n";
  63992. // node_modules/cesium/Source/Shaders/Builtin/Functions/writeLogDepth.js
  63993. var writeLogDepth_default = "#ifdef LOG_DEPTH\nvarying float v_depthFromNearPlusOne;\n\n#ifdef POLYGON_OFFSET\nuniform vec2 u_polygonOffset;\n#endif\n\n#endif\n\n/**\n * Writes the fragment depth to the logarithmic depth buffer.\n * <p>\n * Use this when the vertex shader does not call {@link czm_vertexlogDepth}, for example, when\n * ray-casting geometry using a full screen quad.\n * </p>\n * @name czm_writeLogDepth\n * @glslFunction\n *\n * @param {float} depth The depth coordinate, where 1.0 is on the near plane and\n * depth increases in eye-space units from there\n *\n * @example\n * czm_writeLogDepth((czm_projection * v_positionEyeCoordinates).w + 1.0);\n */\nvoid czm_writeLogDepth(float depth)\n{\n#if defined(GL_EXT_frag_depth) && defined(LOG_DEPTH)\n // Discard the vertex if it's not between the near and far planes.\n // We allow a bit of epsilon on the near plane comparison because a 1.0\n // from the vertex shader (indicating the vertex should be _on_ the near\n // plane) will not necessarily come here as exactly 1.0.\n if (depth <= 0.9999999 || depth > czm_farDepthFromNearPlusOne) {\n discard;\n }\n\n#ifdef POLYGON_OFFSET\n // Polygon offset: m * factor + r * units\n float factor = u_polygonOffset[0];\n float units = u_polygonOffset[1];\n\n // If we can't compute derivatives, just leave out the factor I guess?\n#ifdef GL_OES_standard_derivatives\n // m = sqrt(dZdX^2 + dZdY^2);\n float x = dFdx(depth);\n float y = dFdy(depth);\n float m = sqrt(x * x + y * y);\n\n // Apply the factor before computing the log depth.\n depth += m * factor;\n#endif\n\n#endif\n\n gl_FragDepthEXT = log2(depth) * czm_oneOverLog2FarDepthFromNearPlusOne;\n\n#ifdef POLYGON_OFFSET\n // Apply the units after the log depth.\n gl_FragDepthEXT += czm_epsilon7 * units;\n#endif\n\n#endif\n}\n\n/**\n * Writes the fragment depth to the logarithmic depth buffer.\n * <p>\n * Use this when the vertex shader calls {@link czm_vertexlogDepth}.\n * </p>\n *\n * @name czm_writeLogDepth\n * @glslFunction\n */\nvoid czm_writeLogDepth() {\n#ifdef LOG_DEPTH\n czm_writeLogDepth(v_depthFromNearPlusOne);\n#endif\n}\n";
  63994. // node_modules/cesium/Source/Shaders/Builtin/Functions/writeNonPerspective.js
  63995. var writeNonPerspective_default = "/**\n * Transforms a value for non-perspective interpolation by multiplying\n * it by w, the value used in the perspective divide. This function is\n * intended to be called in a vertex shader to compute the value of a\n * `varying` that should not be subject to perspective interpolation.\n * For example, screen-space texture coordinates. The fragment shader\n * must call {@link czm_readNonPerspective} to retrieve the final\n * non-perspective value.\n *\n * @name czm_writeNonPerspective\n * @glslFunction\n *\n * @param {float|vec2|vec3|vec4} value The value to be interpolated without accounting for perspective.\n * @param {float} w The perspective divide value. Usually this is the computed `gl_Position.w`.\n * @returns {float|vec2|vec3|vec4} The transformed value, intended to be stored in a `varying` and read in the\n * fragment shader with {@link czm_readNonPerspective}.\n */\nfloat czm_writeNonPerspective(float value, float w) {\n return value * w;\n}\n\nvec2 czm_writeNonPerspective(vec2 value, float w) {\n return value * w;\n}\n\nvec3 czm_writeNonPerspective(vec3 value, float w) {\n return value * w;\n}\n\nvec4 czm_writeNonPerspective(vec4 value, float w) {\n return value * w;\n}\n";
  63996. // node_modules/cesium/Source/Shaders/Builtin/CzmBuiltins.js
  63997. var CzmBuiltins_default = {
  63998. czm_degreesPerRadian: degreesPerRadian_default,
  63999. czm_depthRange: depthRange_default,
  64000. czm_epsilon1: epsilon1_default,
  64001. czm_epsilon2: epsilon2_default,
  64002. czm_epsilon3: epsilon3_default,
  64003. czm_epsilon4: epsilon4_default,
  64004. czm_epsilon5: epsilon5_default,
  64005. czm_epsilon6: epsilon6_default,
  64006. czm_epsilon7: epsilon7_default,
  64007. czm_infinity: infinity_default,
  64008. czm_oneOverPi: oneOverPi_default,
  64009. czm_oneOverTwoPi: oneOverTwoPi_default,
  64010. czm_passCesium3DTile: passCesium3DTile_default,
  64011. czm_passCesium3DTileClassification: passCesium3DTileClassification_default,
  64012. czm_passCesium3DTileClassificationIgnoreShow: passCesium3DTileClassificationIgnoreShow_default,
  64013. czm_passClassification: passClassification_default,
  64014. czm_passCompute: passCompute_default,
  64015. czm_passEnvironment: passEnvironment_default,
  64016. czm_passGlobe: passGlobe_default,
  64017. czm_passOpaque: passOpaque_default,
  64018. czm_passOverlay: passOverlay_default,
  64019. czm_passTerrainClassification: passTerrainClassification_default,
  64020. czm_passTranslucent: passTranslucent_default,
  64021. czm_pi: pi_default,
  64022. czm_piOverFour: piOverFour_default,
  64023. czm_piOverSix: piOverSix_default,
  64024. czm_piOverThree: piOverThree_default,
  64025. czm_piOverTwo: piOverTwo_default,
  64026. czm_radiansPerDegree: radiansPerDegree_default,
  64027. czm_sceneMode2D: sceneMode2D_default,
  64028. czm_sceneMode3D: sceneMode3D_default,
  64029. czm_sceneModeColumbusView: sceneModeColumbusView_default,
  64030. czm_sceneModeMorphing: sceneModeMorphing_default,
  64031. czm_solarRadius: solarRadius_default,
  64032. czm_threePiOver2: threePiOver2_default,
  64033. czm_twoPi: twoPi_default,
  64034. czm_webMercatorMaxLatitude: webMercatorMaxLatitude_default,
  64035. czm_depthRangeStruct: depthRangeStruct_default,
  64036. czm_material: material_default,
  64037. czm_materialInput: materialInput_default,
  64038. czm_modelMaterial: modelMaterial_default,
  64039. czm_modelVertexOutput: modelVertexOutput_default,
  64040. czm_pbrParameters: pbrParameters_default,
  64041. czm_ray: ray_default,
  64042. czm_raySegment: raySegment_default,
  64043. czm_shadowParameters: shadowParameters_default,
  64044. czm_HSBToRGB: HSBToRGB_default,
  64045. czm_HSLToRGB: HSLToRGB_default,
  64046. czm_RGBToHSB: RGBToHSB_default,
  64047. czm_RGBToHSL: RGBToHSL_default,
  64048. czm_RGBToXYZ: RGBToXYZ_default,
  64049. czm_XYZToRGB: XYZToRGB_default,
  64050. czm_acesTonemapping: acesTonemapping_default,
  64051. czm_alphaWeight: alphaWeight_default,
  64052. czm_antialias: antialias_default,
  64053. czm_approximateSphericalCoordinates: approximateSphericalCoordinates_default,
  64054. czm_backFacing: backFacing_default,
  64055. czm_branchFreeTernary: branchFreeTernary_default,
  64056. czm_cascadeColor: cascadeColor_default,
  64057. czm_cascadeDistance: cascadeDistance_default,
  64058. czm_cascadeMatrix: cascadeMatrix_default,
  64059. czm_cascadeWeights: cascadeWeights_default,
  64060. czm_columbusViewMorph: columbusViewMorph_default,
  64061. czm_computePosition: computePosition_default,
  64062. czm_cosineAndSine: cosineAndSine_default,
  64063. czm_decompressTextureCoordinates: decompressTextureCoordinates_default,
  64064. czm_defaultPbrMaterial: defaultPbrMaterial_default,
  64065. czm_depthClamp: depthClamp_default,
  64066. czm_eastNorthUpToEyeCoordinates: eastNorthUpToEyeCoordinates_default,
  64067. czm_ellipsoidContainsPoint: ellipsoidContainsPoint_default,
  64068. czm_ellipsoidWgs84TextureCoordinates: ellipsoidWgs84TextureCoordinates_default,
  64069. czm_equalsEpsilon: equalsEpsilon_default,
  64070. czm_eyeOffset: eyeOffset_default,
  64071. czm_eyeToWindowCoordinates: eyeToWindowCoordinates_default,
  64072. czm_fastApproximateAtan: fastApproximateAtan_default,
  64073. czm_fog: fog_default,
  64074. czm_gammaCorrect: gammaCorrect_default,
  64075. czm_geodeticSurfaceNormal: geodeticSurfaceNormal_default,
  64076. czm_getDefaultMaterial: getDefaultMaterial_default,
  64077. czm_getLambertDiffuse: getLambertDiffuse_default,
  64078. czm_getSpecular: getSpecular_default,
  64079. czm_getWaterNoise: getWaterNoise_default,
  64080. czm_hue: hue_default,
  64081. czm_inverseGamma: inverseGamma_default,
  64082. czm_isEmpty: isEmpty_default,
  64083. czm_isFull: isFull_default,
  64084. czm_latitudeToWebMercatorFraction: latitudeToWebMercatorFraction_default,
  64085. czm_lineDistance: lineDistance_default,
  64086. czm_linearToSrgb: linearToSrgb_default,
  64087. czm_luminance: luminance_default,
  64088. czm_metersPerPixel: metersPerPixel_default,
  64089. czm_modelToWindowCoordinates: modelToWindowCoordinates_default,
  64090. czm_multiplyWithColorBalance: multiplyWithColorBalance_default,
  64091. czm_nearFarScalar: nearFarScalar_default,
  64092. czm_octDecode: octDecode_default,
  64093. czm_packDepth: packDepth_default,
  64094. czm_pbrLighting: pbrLighting_default,
  64095. czm_pbrMetallicRoughnessMaterial: pbrMetallicRoughnessMaterial_default,
  64096. czm_pbrSpecularGlossinessMaterial: pbrSpecularGlossinessMaterial_default,
  64097. czm_phong: phong_default,
  64098. czm_planeDistance: planeDistance_default,
  64099. czm_pointAlongRay: pointAlongRay_default,
  64100. czm_rayEllipsoidIntersectionInterval: rayEllipsoidIntersectionInterval_default,
  64101. czm_raySphereIntersectionInterval: raySphereIntersectionInterval_default,
  64102. czm_readDepth: readDepth_default,
  64103. czm_readNonPerspective: readNonPerspective_default,
  64104. czm_reverseLogDepth: reverseLogDepth_default,
  64105. czm_round: round_default,
  64106. czm_sampleOctahedralProjection: sampleOctahedralProjection_default,
  64107. czm_saturation: saturation_default,
  64108. czm_shadowDepthCompare: shadowDepthCompare_default,
  64109. czm_shadowVisibility: shadowVisibility_default,
  64110. czm_signNotZero: signNotZero_default,
  64111. czm_sphericalHarmonics: sphericalHarmonics_default,
  64112. czm_srgbToLinear: srgbToLinear_default,
  64113. czm_tangentToEyeSpaceMatrix: tangentToEyeSpaceMatrix_default,
  64114. czm_transformPlane: transformPlane_default,
  64115. czm_translateRelativeToEye: translateRelativeToEye_default,
  64116. czm_translucentPhong: translucentPhong_default,
  64117. czm_transpose: transpose_default,
  64118. czm_unpackDepth: unpackDepth_default,
  64119. czm_unpackFloat: unpackFloat_default,
  64120. czm_unpackUint: unpackUint_default,
  64121. czm_valueTransform: valueTransform_default,
  64122. czm_vertexLogDepth: vertexLogDepth_default,
  64123. czm_windowToEyeCoordinates: windowToEyeCoordinates_default,
  64124. czm_writeDepthClamp: writeDepthClamp_default,
  64125. czm_writeLogDepth: writeLogDepth_default,
  64126. czm_writeNonPerspective: writeNonPerspective_default
  64127. };
  64128. // node_modules/cesium/Source/Renderer/ShaderSource.js
  64129. function removeComments(source) {
  64130. source = source.replace(/\/\/.*/g, "");
  64131. return source.replace(/\/\*\*[\s\S]*?\*\//gm, function(match) {
  64132. const numberOfLines = match.match(/\n/gm).length;
  64133. let replacement = "";
  64134. for (let lineNumber = 0; lineNumber < numberOfLines; ++lineNumber) {
  64135. replacement += "\n";
  64136. }
  64137. return replacement;
  64138. });
  64139. }
  64140. function getDependencyNode(name, glslSource, nodes) {
  64141. let dependencyNode;
  64142. for (let i2 = 0; i2 < nodes.length; ++i2) {
  64143. if (nodes[i2].name === name) {
  64144. dependencyNode = nodes[i2];
  64145. }
  64146. }
  64147. if (!defined_default(dependencyNode)) {
  64148. glslSource = removeComments(glslSource);
  64149. dependencyNode = {
  64150. name,
  64151. glslSource,
  64152. dependsOn: [],
  64153. requiredBy: [],
  64154. evaluated: false
  64155. };
  64156. nodes.push(dependencyNode);
  64157. }
  64158. return dependencyNode;
  64159. }
  64160. function generateDependencies(currentNode, dependencyNodes) {
  64161. if (currentNode.evaluated) {
  64162. return;
  64163. }
  64164. currentNode.evaluated = true;
  64165. let czmMatches = currentNode.glslSource.match(/\bczm_[a-zA-Z0-9_]*/g);
  64166. if (defined_default(czmMatches) && czmMatches !== null) {
  64167. czmMatches = czmMatches.filter(function(elem, pos) {
  64168. return czmMatches.indexOf(elem) === pos;
  64169. });
  64170. czmMatches.forEach(function(element) {
  64171. if (element !== currentNode.name && ShaderSource._czmBuiltinsAndUniforms.hasOwnProperty(element)) {
  64172. const referencedNode = getDependencyNode(
  64173. element,
  64174. ShaderSource._czmBuiltinsAndUniforms[element],
  64175. dependencyNodes
  64176. );
  64177. currentNode.dependsOn.push(referencedNode);
  64178. referencedNode.requiredBy.push(currentNode);
  64179. generateDependencies(referencedNode, dependencyNodes);
  64180. }
  64181. });
  64182. }
  64183. }
  64184. function sortDependencies(dependencyNodes) {
  64185. const nodesWithoutIncomingEdges = [];
  64186. const allNodes = [];
  64187. while (dependencyNodes.length > 0) {
  64188. const node = dependencyNodes.pop();
  64189. allNodes.push(node);
  64190. if (node.requiredBy.length === 0) {
  64191. nodesWithoutIncomingEdges.push(node);
  64192. }
  64193. }
  64194. while (nodesWithoutIncomingEdges.length > 0) {
  64195. const currentNode = nodesWithoutIncomingEdges.shift();
  64196. dependencyNodes.push(currentNode);
  64197. for (let i2 = 0; i2 < currentNode.dependsOn.length; ++i2) {
  64198. const referencedNode = currentNode.dependsOn[i2];
  64199. const index2 = referencedNode.requiredBy.indexOf(currentNode);
  64200. referencedNode.requiredBy.splice(index2, 1);
  64201. if (referencedNode.requiredBy.length === 0) {
  64202. nodesWithoutIncomingEdges.push(referencedNode);
  64203. }
  64204. }
  64205. }
  64206. const badNodes = [];
  64207. for (let j = 0; j < allNodes.length; ++j) {
  64208. if (allNodes[j].requiredBy.length !== 0) {
  64209. badNodes.push(allNodes[j]);
  64210. }
  64211. }
  64212. if (badNodes.length !== 0) {
  64213. let message = "A circular dependency was found in the following built-in functions/structs/constants: \n";
  64214. for (let k = 0; k < badNodes.length; ++k) {
  64215. message = `${message + badNodes[k].name}
  64216. `;
  64217. }
  64218. throw new DeveloperError_default(message);
  64219. }
  64220. }
  64221. function getBuiltinsAndAutomaticUniforms(shaderSource) {
  64222. const dependencyNodes = [];
  64223. const root = getDependencyNode("main", shaderSource, dependencyNodes);
  64224. generateDependencies(root, dependencyNodes);
  64225. sortDependencies(dependencyNodes);
  64226. let builtinsSource = "";
  64227. for (let i2 = dependencyNodes.length - 1; i2 >= 0; --i2) {
  64228. builtinsSource = `${builtinsSource + dependencyNodes[i2].glslSource}
  64229. `;
  64230. }
  64231. return builtinsSource.replace(root.glslSource, "");
  64232. }
  64233. function combineShader(shaderSource, isFragmentShader, context) {
  64234. let i2;
  64235. let length3;
  64236. let combinedSources = "";
  64237. const sources = shaderSource.sources;
  64238. if (defined_default(sources)) {
  64239. for (i2 = 0, length3 = sources.length; i2 < length3; ++i2) {
  64240. combinedSources += `
  64241. #line 0
  64242. ${sources[i2]}`;
  64243. }
  64244. }
  64245. combinedSources = removeComments(combinedSources);
  64246. let version;
  64247. combinedSources = combinedSources.replace(/#version\s+(.*?)\n/gm, function(match, group1) {
  64248. if (defined_default(version) && version !== group1) {
  64249. throw new DeveloperError_default(
  64250. `inconsistent versions found: ${version} and ${group1}`
  64251. );
  64252. }
  64253. version = group1;
  64254. return "\n";
  64255. });
  64256. const extensions = [];
  64257. combinedSources = combinedSources.replace(/#extension.*\n/gm, function(match) {
  64258. extensions.push(match);
  64259. return "\n";
  64260. });
  64261. combinedSources = combinedSources.replace(
  64262. /precision\s(lowp|mediump|highp)\s(float|int);/,
  64263. ""
  64264. );
  64265. const pickColorQualifier = shaderSource.pickColorQualifier;
  64266. if (defined_default(pickColorQualifier)) {
  64267. combinedSources = ShaderSource.createPickFragmentShaderSource(
  64268. combinedSources,
  64269. pickColorQualifier
  64270. );
  64271. }
  64272. let result = "";
  64273. if (defined_default(version)) {
  64274. result = `#version ${version}
  64275. `;
  64276. }
  64277. const extensionsLength = extensions.length;
  64278. for (i2 = 0; i2 < extensionsLength; i2++) {
  64279. result += extensions[i2];
  64280. }
  64281. if (isFragmentShader) {
  64282. result += "#ifdef GL_FRAGMENT_PRECISION_HIGH\n precision highp float;\n precision highp int;\n#else\n precision mediump float;\n precision mediump int;\n #define highp mediump\n#endif\n\n";
  64283. }
  64284. const defines = shaderSource.defines;
  64285. if (defined_default(defines)) {
  64286. for (i2 = 0, length3 = defines.length; i2 < length3; ++i2) {
  64287. const define2 = defines[i2];
  64288. if (define2.length !== 0) {
  64289. result += `#define ${define2}
  64290. `;
  64291. }
  64292. }
  64293. }
  64294. if (context.webgl2) {
  64295. result += "#define OUTPUT_DECLARATION\n\n";
  64296. }
  64297. if (context.textureFloatLinear) {
  64298. result += "#define OES_texture_float_linear\n\n";
  64299. }
  64300. if (context.floatingPointTexture) {
  64301. result += "#define OES_texture_float\n\n";
  64302. }
  64303. if (shaderSource.includeBuiltIns) {
  64304. result += getBuiltinsAndAutomaticUniforms(combinedSources);
  64305. }
  64306. result += "\n#line 0\n";
  64307. result += combinedSources;
  64308. if (context.webgl2) {
  64309. result = modernizeShader_default(result, isFragmentShader, true);
  64310. }
  64311. return result;
  64312. }
  64313. function ShaderSource(options) {
  64314. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  64315. const pickColorQualifier = options.pickColorQualifier;
  64316. if (defined_default(pickColorQualifier) && pickColorQualifier !== "uniform" && pickColorQualifier !== "varying") {
  64317. throw new DeveloperError_default(
  64318. "options.pickColorQualifier must be 'uniform' or 'varying'."
  64319. );
  64320. }
  64321. this.defines = defined_default(options.defines) ? options.defines.slice(0) : [];
  64322. this.sources = defined_default(options.sources) ? options.sources.slice(0) : [];
  64323. this.pickColorQualifier = pickColorQualifier;
  64324. this.includeBuiltIns = defaultValue_default(options.includeBuiltIns, true);
  64325. }
  64326. ShaderSource.prototype.clone = function() {
  64327. return new ShaderSource({
  64328. sources: this.sources,
  64329. defines: this.defines,
  64330. pickColorQualifier: this.pickColorQualifier,
  64331. includeBuiltIns: this.includeBuiltIns
  64332. });
  64333. };
  64334. ShaderSource.replaceMain = function(source, renamedMain) {
  64335. renamedMain = `void ${renamedMain}()`;
  64336. return source.replace(/void\s+main\s*\(\s*(?:void)?\s*\)/g, renamedMain);
  64337. };
  64338. ShaderSource.prototype.createCombinedVertexShader = function(context) {
  64339. return combineShader(this, false, context);
  64340. };
  64341. ShaderSource.prototype.createCombinedFragmentShader = function(context) {
  64342. return combineShader(this, true, context);
  64343. };
  64344. ShaderSource._czmBuiltinsAndUniforms = {};
  64345. for (const builtinName in CzmBuiltins_default) {
  64346. if (CzmBuiltins_default.hasOwnProperty(builtinName)) {
  64347. ShaderSource._czmBuiltinsAndUniforms[builtinName] = CzmBuiltins_default[builtinName];
  64348. }
  64349. }
  64350. for (const uniformName in AutomaticUniforms_default) {
  64351. if (AutomaticUniforms_default.hasOwnProperty(uniformName)) {
  64352. const uniform = AutomaticUniforms_default[uniformName];
  64353. if (typeof uniform.getDeclaration === "function") {
  64354. ShaderSource._czmBuiltinsAndUniforms[uniformName] = uniform.getDeclaration(uniformName);
  64355. }
  64356. }
  64357. }
  64358. ShaderSource.createPickVertexShaderSource = function(vertexShaderSource) {
  64359. const renamedVS = ShaderSource.replaceMain(
  64360. vertexShaderSource,
  64361. "czm_old_main"
  64362. );
  64363. const pickMain = "attribute vec4 pickColor; \nvarying vec4 czm_pickColor; \nvoid main() \n{ \n czm_old_main(); \n czm_pickColor = pickColor; \n}";
  64364. return `${renamedVS}
  64365. ${pickMain}`;
  64366. };
  64367. ShaderSource.createPickFragmentShaderSource = function(fragmentShaderSource, pickColorQualifier) {
  64368. const renamedFS = ShaderSource.replaceMain(
  64369. fragmentShaderSource,
  64370. "czm_old_main"
  64371. );
  64372. const pickMain = `${pickColorQualifier} vec4 czm_pickColor;
  64373. void main()
  64374. {
  64375. czm_old_main();
  64376. if (gl_FragColor.a == 0.0) {
  64377. discard;
  64378. }
  64379. gl_FragColor = czm_pickColor;
  64380. }`;
  64381. return `${renamedFS}
  64382. ${pickMain}`;
  64383. };
  64384. function containsString(shaderSource, string) {
  64385. const sources = shaderSource.sources;
  64386. const sourcesLength = sources.length;
  64387. for (let i2 = 0; i2 < sourcesLength; ++i2) {
  64388. if (sources[i2].indexOf(string) !== -1) {
  64389. return true;
  64390. }
  64391. }
  64392. return false;
  64393. }
  64394. function findFirstString(shaderSource, strings2) {
  64395. const stringsLength = strings2.length;
  64396. for (let i2 = 0; i2 < stringsLength; ++i2) {
  64397. const string = strings2[i2];
  64398. if (containsString(shaderSource, string)) {
  64399. return string;
  64400. }
  64401. }
  64402. return void 0;
  64403. }
  64404. var normalVaryingNames = ["v_normalEC", "v_normal"];
  64405. ShaderSource.findNormalVarying = function(shaderSource) {
  64406. if (containsString(shaderSource, "#ifdef HAS_NORMALS")) {
  64407. if (containsString(shaderSource, "#define HAS_NORMALS")) {
  64408. return "v_normalEC";
  64409. }
  64410. return void 0;
  64411. }
  64412. return findFirstString(shaderSource, normalVaryingNames);
  64413. };
  64414. var positionVaryingNames = ["v_positionEC"];
  64415. ShaderSource.findPositionVarying = function(shaderSource) {
  64416. return findFirstString(shaderSource, positionVaryingNames);
  64417. };
  64418. var ShaderSource_default = ShaderSource;
  64419. // node_modules/cesium/Source/Shaders/ShadowVolumeAppearanceVS.js
  64420. var ShadowVolumeAppearanceVS_default = 'attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute float batchId;\n\n#ifdef EXTRUDED_GEOMETRY\nattribute vec3 extrudeDirection;\n\nuniform float u_globeMinimumAltitude;\n#endif // EXTRUDED_GEOMETRY\n\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#endif // PER_INSTANCE_COLOR\n\n#ifdef TEXTURE_COORDINATES\n#ifdef SPHERICAL\nvarying vec4 v_sphericalExtents;\n#else // SPHERICAL\nvarying vec2 v_inversePlaneExtents;\nvarying vec4 v_westPlane;\nvarying vec4 v_southPlane;\n#endif // SPHERICAL\nvarying vec3 v_uvMinAndSphericalLongitudeRotation;\nvarying vec3 v_uMaxAndInverseDistance;\nvarying vec3 v_vMaxAndInverseDistance;\n#endif // TEXTURE_COORDINATES\n\nvoid main()\n{\n vec4 position = czm_computePosition();\n\n#ifdef EXTRUDED_GEOMETRY\n float delta = min(u_globeMinimumAltitude, czm_geometricToleranceOverMeter * length(position.xyz));\n delta *= czm_sceneMode == czm_sceneMode3D ? 1.0 : 0.0;\n\n //extrudeDirection is zero for the top layer\n position = position + vec4(extrudeDirection * delta, 0.0);\n#endif\n\n#ifdef TEXTURE_COORDINATES\n#ifdef SPHERICAL\n v_sphericalExtents = czm_batchTable_sphericalExtents(batchId);\n v_uvMinAndSphericalLongitudeRotation.z = czm_batchTable_longitudeRotation(batchId);\n#else // SPHERICAL\n#ifdef COLUMBUS_VIEW_2D\n vec4 planes2D_high = czm_batchTable_planes2D_HIGH(batchId);\n vec4 planes2D_low = czm_batchTable_planes2D_LOW(batchId);\n\n // If the primitive is split across the IDL (planes2D_high.x > planes2D_high.w):\n // - If this vertex is on the east side of the IDL (position3DLow.y > 0.0, comparison with position3DHigh may produce artifacts)\n // - existing "east" is on the wrong side of the world, far away (planes2D_high/low.w)\n // - so set "east" as beyond the eastmost extent of the projection (idlSplitNewPlaneHiLow)\n vec2 idlSplitNewPlaneHiLow = vec2(EAST_MOST_X_HIGH - (WEST_MOST_X_HIGH - planes2D_high.w), EAST_MOST_X_LOW - (WEST_MOST_X_LOW - planes2D_low.w));\n bool idlSplit = planes2D_high.x > planes2D_high.w && position3DLow.y > 0.0;\n planes2D_high.w = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.x, planes2D_high.w);\n planes2D_low.w = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.y, planes2D_low.w);\n\n // - else, if this vertex is on the west side of the IDL (position3DLow.y < 0.0)\n // - existing "west" is on the wrong side of the world, far away (planes2D_high/low.x)\n // - so set "west" as beyond the westmost extent of the projection (idlSplitNewPlaneHiLow)\n idlSplit = planes2D_high.x > planes2D_high.w && position3DLow.y < 0.0;\n idlSplitNewPlaneHiLow = vec2(WEST_MOST_X_HIGH - (EAST_MOST_X_HIGH - planes2D_high.x), WEST_MOST_X_LOW - (EAST_MOST_X_LOW - planes2D_low.x));\n planes2D_high.x = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.x, planes2D_high.x);\n planes2D_low.x = czm_branchFreeTernary(idlSplit, idlSplitNewPlaneHiLow.y, planes2D_low.x);\n\n vec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.xy), vec3(0.0, planes2D_low.xy))).xyz;\n vec3 northWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.x, planes2D_high.z), vec3(0.0, planes2D_low.x, planes2D_low.z))).xyz;\n vec3 southEastCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, planes2D_high.w, planes2D_high.y), vec3(0.0, planes2D_low.w, planes2D_low.y))).xyz;\n#else // COLUMBUS_VIEW_2D\n // 3D case has smaller "plane extents," so planes encoded as a 64 bit position and 2 vec3s for distances/direction\n vec3 southWestCorner = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(czm_batchTable_southWest_HIGH(batchId), czm_batchTable_southWest_LOW(batchId))).xyz;\n vec3 northWestCorner = czm_normal * czm_batchTable_northward(batchId) + southWestCorner;\n vec3 southEastCorner = czm_normal * czm_batchTable_eastward(batchId) + southWestCorner;\n#endif // COLUMBUS_VIEW_2D\n\n vec3 eastWard = southEastCorner - southWestCorner;\n float eastExtent = length(eastWard);\n eastWard /= eastExtent;\n\n vec3 northWard = northWestCorner - southWestCorner;\n float northExtent = length(northWard);\n northWard /= northExtent;\n\n v_westPlane = vec4(eastWard, -dot(eastWard, southWestCorner));\n v_southPlane = vec4(northWard, -dot(northWard, southWestCorner));\n v_inversePlaneExtents = vec2(1.0 / eastExtent, 1.0 / northExtent);\n#endif // SPHERICAL\n vec4 uvMinAndExtents = czm_batchTable_uvMinAndExtents(batchId);\n vec4 uMaxVmax = czm_batchTable_uMaxVmax(batchId);\n\n v_uMaxAndInverseDistance = vec3(uMaxVmax.xy, uvMinAndExtents.z);\n v_vMaxAndInverseDistance = vec3(uMaxVmax.zw, uvMinAndExtents.w);\n v_uvMinAndSphericalLongitudeRotation.xy = uvMinAndExtents.xy;\n#endif // TEXTURE_COORDINATES\n\n#ifdef PER_INSTANCE_COLOR\n v_color = czm_batchTable_color(batchId);\n#endif\n\n gl_Position = czm_depthClamp(czm_modelViewProjectionRelativeToEye * position);\n}\n';
  64421. // node_modules/cesium/Source/Shaders/ShadowVolumeFS.js
  64422. var ShadowVolumeFS_default = "#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\n\n#ifdef VECTOR_TILE\nuniform vec4 u_highlightColor;\n#endif\n\nvoid main(void)\n{\n#ifdef VECTOR_TILE\n gl_FragColor = czm_gammaCorrect(u_highlightColor);\n#else\n gl_FragColor = vec4(1.0);\n#endif\n czm_writeDepthClamp();\n}\n";
  64423. // node_modules/cesium/Source/Scene/ClassificationType.js
  64424. var ClassificationType = {
  64425. TERRAIN: 0,
  64426. CESIUM_3D_TILE: 1,
  64427. BOTH: 2
  64428. };
  64429. ClassificationType.NUMBER_OF_CLASSIFICATION_TYPES = 3;
  64430. var ClassificationType_default = Object.freeze(ClassificationType);
  64431. // node_modules/cesium/Source/Scene/DepthFunction.js
  64432. var DepthFunction = {
  64433. NEVER: WebGLConstants_default.NEVER,
  64434. LESS: WebGLConstants_default.LESS,
  64435. EQUAL: WebGLConstants_default.EQUAL,
  64436. LESS_OR_EQUAL: WebGLConstants_default.LEQUAL,
  64437. GREATER: WebGLConstants_default.GREATER,
  64438. NOT_EQUAL: WebGLConstants_default.NOTEQUAL,
  64439. GREATER_OR_EQUAL: WebGLConstants_default.GEQUAL,
  64440. ALWAYS: WebGLConstants_default.ALWAYS
  64441. };
  64442. var DepthFunction_default = Object.freeze(DepthFunction);
  64443. // node_modules/cesium/Source/Renderer/BufferUsage.js
  64444. var BufferUsage = {
  64445. STREAM_DRAW: WebGLConstants_default.STREAM_DRAW,
  64446. STATIC_DRAW: WebGLConstants_default.STATIC_DRAW,
  64447. DYNAMIC_DRAW: WebGLConstants_default.DYNAMIC_DRAW,
  64448. validate: function(bufferUsage) {
  64449. return bufferUsage === BufferUsage.STREAM_DRAW || bufferUsage === BufferUsage.STATIC_DRAW || bufferUsage === BufferUsage.DYNAMIC_DRAW;
  64450. }
  64451. };
  64452. var BufferUsage_default = Object.freeze(BufferUsage);
  64453. // node_modules/cesium/Source/Renderer/Buffer.js
  64454. function Buffer2(options) {
  64455. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  64456. Check_default.defined("options.context", options.context);
  64457. if (!defined_default(options.typedArray) && !defined_default(options.sizeInBytes)) {
  64458. throw new DeveloperError_default(
  64459. "Either options.sizeInBytes or options.typedArray is required."
  64460. );
  64461. }
  64462. if (defined_default(options.typedArray) && defined_default(options.sizeInBytes)) {
  64463. throw new DeveloperError_default(
  64464. "Cannot pass in both options.sizeInBytes and options.typedArray."
  64465. );
  64466. }
  64467. if (defined_default(options.typedArray)) {
  64468. Check_default.typeOf.object("options.typedArray", options.typedArray);
  64469. Check_default.typeOf.number(
  64470. "options.typedArray.byteLength",
  64471. options.typedArray.byteLength
  64472. );
  64473. }
  64474. if (!BufferUsage_default.validate(options.usage)) {
  64475. throw new DeveloperError_default("usage is invalid.");
  64476. }
  64477. const gl = options.context._gl;
  64478. const bufferTarget = options.bufferTarget;
  64479. const typedArray = options.typedArray;
  64480. let sizeInBytes = options.sizeInBytes;
  64481. const usage = options.usage;
  64482. const hasArray = defined_default(typedArray);
  64483. if (hasArray) {
  64484. sizeInBytes = typedArray.byteLength;
  64485. }
  64486. Check_default.typeOf.number.greaterThan("sizeInBytes", sizeInBytes, 0);
  64487. const buffer = gl.createBuffer();
  64488. gl.bindBuffer(bufferTarget, buffer);
  64489. gl.bufferData(bufferTarget, hasArray ? typedArray : sizeInBytes, usage);
  64490. gl.bindBuffer(bufferTarget, null);
  64491. this._gl = gl;
  64492. this._webgl2 = options.context._webgl2;
  64493. this._bufferTarget = bufferTarget;
  64494. this._sizeInBytes = sizeInBytes;
  64495. this._usage = usage;
  64496. this._buffer = buffer;
  64497. this.vertexArrayDestroyable = true;
  64498. }
  64499. Buffer2.createVertexBuffer = function(options) {
  64500. Check_default.defined("options.context", options.context);
  64501. return new Buffer2({
  64502. context: options.context,
  64503. bufferTarget: WebGLConstants_default.ARRAY_BUFFER,
  64504. typedArray: options.typedArray,
  64505. sizeInBytes: options.sizeInBytes,
  64506. usage: options.usage
  64507. });
  64508. };
  64509. Buffer2.createIndexBuffer = function(options) {
  64510. Check_default.defined("options.context", options.context);
  64511. if (!IndexDatatype_default.validate(options.indexDatatype)) {
  64512. throw new DeveloperError_default("Invalid indexDatatype.");
  64513. }
  64514. if (options.indexDatatype === IndexDatatype_default.UNSIGNED_INT && !options.context.elementIndexUint) {
  64515. throw new DeveloperError_default(
  64516. "IndexDatatype.UNSIGNED_INT requires OES_element_index_uint, which is not supported on this system. Check context.elementIndexUint."
  64517. );
  64518. }
  64519. const context = options.context;
  64520. const indexDatatype = options.indexDatatype;
  64521. const bytesPerIndex = IndexDatatype_default.getSizeInBytes(indexDatatype);
  64522. const buffer = new Buffer2({
  64523. context,
  64524. bufferTarget: WebGLConstants_default.ELEMENT_ARRAY_BUFFER,
  64525. typedArray: options.typedArray,
  64526. sizeInBytes: options.sizeInBytes,
  64527. usage: options.usage
  64528. });
  64529. const numberOfIndices = buffer.sizeInBytes / bytesPerIndex;
  64530. Object.defineProperties(buffer, {
  64531. indexDatatype: {
  64532. get: function() {
  64533. return indexDatatype;
  64534. }
  64535. },
  64536. bytesPerIndex: {
  64537. get: function() {
  64538. return bytesPerIndex;
  64539. }
  64540. },
  64541. numberOfIndices: {
  64542. get: function() {
  64543. return numberOfIndices;
  64544. }
  64545. }
  64546. });
  64547. return buffer;
  64548. };
  64549. Object.defineProperties(Buffer2.prototype, {
  64550. sizeInBytes: {
  64551. get: function() {
  64552. return this._sizeInBytes;
  64553. }
  64554. },
  64555. usage: {
  64556. get: function() {
  64557. return this._usage;
  64558. }
  64559. }
  64560. });
  64561. Buffer2.prototype._getBuffer = function() {
  64562. return this._buffer;
  64563. };
  64564. Buffer2.prototype.copyFromArrayView = function(arrayView, offsetInBytes) {
  64565. offsetInBytes = defaultValue_default(offsetInBytes, 0);
  64566. Check_default.defined("arrayView", arrayView);
  64567. Check_default.typeOf.number.lessThanOrEquals(
  64568. "offsetInBytes + arrayView.byteLength",
  64569. offsetInBytes + arrayView.byteLength,
  64570. this._sizeInBytes
  64571. );
  64572. const gl = this._gl;
  64573. const target = this._bufferTarget;
  64574. gl.bindBuffer(target, this._buffer);
  64575. gl.bufferSubData(target, offsetInBytes, arrayView);
  64576. gl.bindBuffer(target, null);
  64577. };
  64578. Buffer2.prototype.copyFromBuffer = function(readBuffer, readOffset, writeOffset, sizeInBytes) {
  64579. if (!this._webgl2) {
  64580. throw new DeveloperError_default("A WebGL 2 context is required.");
  64581. }
  64582. if (!defined_default(readBuffer)) {
  64583. throw new DeveloperError_default("readBuffer must be defined.");
  64584. }
  64585. if (!defined_default(sizeInBytes) || sizeInBytes <= 0) {
  64586. throw new DeveloperError_default(
  64587. "sizeInBytes must be defined and be greater than zero."
  64588. );
  64589. }
  64590. if (!defined_default(readOffset) || readOffset < 0 || readOffset + sizeInBytes > readBuffer._sizeInBytes) {
  64591. throw new DeveloperError_default(
  64592. "readOffset must be greater than or equal to zero and readOffset + sizeInBytes must be less than of equal to readBuffer.sizeInBytes."
  64593. );
  64594. }
  64595. if (!defined_default(writeOffset) || writeOffset < 0 || writeOffset + sizeInBytes > this._sizeInBytes) {
  64596. throw new DeveloperError_default(
  64597. "writeOffset must be greater than or equal to zero and writeOffset + sizeInBytes must be less than of equal to this.sizeInBytes."
  64598. );
  64599. }
  64600. if (this._buffer === readBuffer._buffer && (writeOffset >= readOffset && writeOffset < readOffset + sizeInBytes || readOffset > writeOffset && readOffset < writeOffset + sizeInBytes)) {
  64601. throw new DeveloperError_default(
  64602. "When readBuffer is equal to this, the ranges [readOffset + sizeInBytes) and [writeOffset, writeOffset + sizeInBytes) must not overlap."
  64603. );
  64604. }
  64605. if (this._bufferTarget === WebGLConstants_default.ELEMENT_ARRAY_BUFFER && readBuffer._bufferTarget !== WebGLConstants_default.ELEMENT_ARRAY_BUFFER || this._bufferTarget !== WebGLConstants_default.ELEMENT_ARRAY_BUFFER && readBuffer._bufferTarget === WebGLConstants_default.ELEMENT_ARRAY_BUFFER) {
  64606. throw new DeveloperError_default(
  64607. "Can not copy an index buffer into another buffer type."
  64608. );
  64609. }
  64610. const readTarget = WebGLConstants_default.COPY_READ_BUFFER;
  64611. const writeTarget = WebGLConstants_default.COPY_WRITE_BUFFER;
  64612. const gl = this._gl;
  64613. gl.bindBuffer(writeTarget, this._buffer);
  64614. gl.bindBuffer(readTarget, readBuffer._buffer);
  64615. gl.copyBufferSubData(
  64616. readTarget,
  64617. writeTarget,
  64618. readOffset,
  64619. writeOffset,
  64620. sizeInBytes
  64621. );
  64622. gl.bindBuffer(writeTarget, null);
  64623. gl.bindBuffer(readTarget, null);
  64624. };
  64625. Buffer2.prototype.getBufferData = function(arrayView, sourceOffset, destinationOffset, length3) {
  64626. sourceOffset = defaultValue_default(sourceOffset, 0);
  64627. destinationOffset = defaultValue_default(destinationOffset, 0);
  64628. if (!this._webgl2) {
  64629. throw new DeveloperError_default("A WebGL 2 context is required.");
  64630. }
  64631. if (!defined_default(arrayView)) {
  64632. throw new DeveloperError_default("arrayView is required.");
  64633. }
  64634. let copyLength;
  64635. let elementSize;
  64636. let arrayLength = arrayView.byteLength;
  64637. if (!defined_default(length3)) {
  64638. if (defined_default(arrayLength)) {
  64639. copyLength = arrayLength - destinationOffset;
  64640. elementSize = 1;
  64641. } else {
  64642. arrayLength = arrayView.length;
  64643. copyLength = arrayLength - destinationOffset;
  64644. elementSize = arrayView.BYTES_PER_ELEMENT;
  64645. }
  64646. } else {
  64647. copyLength = length3;
  64648. if (defined_default(arrayLength)) {
  64649. elementSize = 1;
  64650. } else {
  64651. arrayLength = arrayView.length;
  64652. elementSize = arrayView.BYTES_PER_ELEMENT;
  64653. }
  64654. }
  64655. if (destinationOffset < 0 || destinationOffset > arrayLength) {
  64656. throw new DeveloperError_default(
  64657. "destinationOffset must be greater than zero and less than the arrayView length."
  64658. );
  64659. }
  64660. if (destinationOffset + copyLength > arrayLength) {
  64661. throw new DeveloperError_default(
  64662. "destinationOffset + length must be less than or equal to the arrayViewLength."
  64663. );
  64664. }
  64665. if (sourceOffset < 0 || sourceOffset > this._sizeInBytes) {
  64666. throw new DeveloperError_default(
  64667. "sourceOffset must be greater than zero and less than the buffers size."
  64668. );
  64669. }
  64670. if (sourceOffset + copyLength * elementSize > this._sizeInBytes) {
  64671. throw new DeveloperError_default(
  64672. "sourceOffset + length must be less than the buffers size."
  64673. );
  64674. }
  64675. const gl = this._gl;
  64676. const target = WebGLConstants_default.COPY_READ_BUFFER;
  64677. gl.bindBuffer(target, this._buffer);
  64678. gl.getBufferSubData(
  64679. target,
  64680. sourceOffset,
  64681. arrayView,
  64682. destinationOffset,
  64683. length3
  64684. );
  64685. gl.bindBuffer(target, null);
  64686. };
  64687. Buffer2.prototype.isDestroyed = function() {
  64688. return false;
  64689. };
  64690. Buffer2.prototype.destroy = function() {
  64691. this._gl.deleteBuffer(this._buffer);
  64692. return destroyObject_default(this);
  64693. };
  64694. var Buffer_default = Buffer2;
  64695. // node_modules/cesium/Source/Renderer/VertexArray.js
  64696. function addAttribute(attributes, attribute, index2, context) {
  64697. const hasVertexBuffer = defined_default(attribute.vertexBuffer);
  64698. const hasValue = defined_default(attribute.value);
  64699. const componentsPerAttribute = attribute.value ? attribute.value.length : attribute.componentsPerAttribute;
  64700. if (!hasVertexBuffer && !hasValue) {
  64701. throw new DeveloperError_default("attribute must have a vertexBuffer or a value.");
  64702. }
  64703. if (hasVertexBuffer && hasValue) {
  64704. throw new DeveloperError_default(
  64705. "attribute cannot have both a vertexBuffer and a value. It must have either a vertexBuffer property defining per-vertex data or a value property defining data for all vertices."
  64706. );
  64707. }
  64708. if (componentsPerAttribute !== 1 && componentsPerAttribute !== 2 && componentsPerAttribute !== 3 && componentsPerAttribute !== 4) {
  64709. if (hasValue) {
  64710. throw new DeveloperError_default(
  64711. "attribute.value.length must be in the range [1, 4]."
  64712. );
  64713. }
  64714. throw new DeveloperError_default(
  64715. "attribute.componentsPerAttribute must be in the range [1, 4]."
  64716. );
  64717. }
  64718. if (defined_default(attribute.componentDatatype) && !ComponentDatatype_default.validate(attribute.componentDatatype)) {
  64719. throw new DeveloperError_default(
  64720. "attribute must have a valid componentDatatype or not specify it."
  64721. );
  64722. }
  64723. if (defined_default(attribute.strideInBytes) && attribute.strideInBytes > 255) {
  64724. throw new DeveloperError_default(
  64725. "attribute must have a strideInBytes less than or equal to 255 or not specify it."
  64726. );
  64727. }
  64728. if (defined_default(attribute.instanceDivisor) && attribute.instanceDivisor > 0 && !context.instancedArrays) {
  64729. throw new DeveloperError_default("instanced arrays is not supported");
  64730. }
  64731. if (defined_default(attribute.instanceDivisor) && attribute.instanceDivisor < 0) {
  64732. throw new DeveloperError_default(
  64733. "attribute must have an instanceDivisor greater than or equal to zero"
  64734. );
  64735. }
  64736. if (defined_default(attribute.instanceDivisor) && hasValue) {
  64737. throw new DeveloperError_default(
  64738. "attribute cannot have have an instanceDivisor if it is not backed by a buffer"
  64739. );
  64740. }
  64741. if (defined_default(attribute.instanceDivisor) && attribute.instanceDivisor > 0 && attribute.index === 0) {
  64742. throw new DeveloperError_default(
  64743. "attribute zero cannot have an instanceDivisor greater than 0"
  64744. );
  64745. }
  64746. const attr = {
  64747. index: defaultValue_default(attribute.index, index2),
  64748. enabled: defaultValue_default(attribute.enabled, true),
  64749. vertexBuffer: attribute.vertexBuffer,
  64750. value: hasValue ? attribute.value.slice(0) : void 0,
  64751. componentsPerAttribute,
  64752. componentDatatype: defaultValue_default(
  64753. attribute.componentDatatype,
  64754. ComponentDatatype_default.FLOAT
  64755. ),
  64756. normalize: defaultValue_default(attribute.normalize, false),
  64757. offsetInBytes: defaultValue_default(attribute.offsetInBytes, 0),
  64758. strideInBytes: defaultValue_default(attribute.strideInBytes, 0),
  64759. instanceDivisor: defaultValue_default(attribute.instanceDivisor, 0)
  64760. };
  64761. if (hasVertexBuffer) {
  64762. attr.vertexAttrib = function(gl) {
  64763. const index3 = this.index;
  64764. gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer._getBuffer());
  64765. gl.vertexAttribPointer(
  64766. index3,
  64767. this.componentsPerAttribute,
  64768. this.componentDatatype,
  64769. this.normalize,
  64770. this.strideInBytes,
  64771. this.offsetInBytes
  64772. );
  64773. gl.enableVertexAttribArray(index3);
  64774. if (this.instanceDivisor > 0) {
  64775. context.glVertexAttribDivisor(index3, this.instanceDivisor);
  64776. context._vertexAttribDivisors[index3] = this.instanceDivisor;
  64777. context._previousDrawInstanced = true;
  64778. }
  64779. };
  64780. attr.disableVertexAttribArray = function(gl) {
  64781. gl.disableVertexAttribArray(this.index);
  64782. if (this.instanceDivisor > 0) {
  64783. context.glVertexAttribDivisor(index2, 0);
  64784. }
  64785. };
  64786. } else {
  64787. switch (attr.componentsPerAttribute) {
  64788. case 1:
  64789. attr.vertexAttrib = function(gl) {
  64790. gl.vertexAttrib1fv(this.index, this.value);
  64791. };
  64792. break;
  64793. case 2:
  64794. attr.vertexAttrib = function(gl) {
  64795. gl.vertexAttrib2fv(this.index, this.value);
  64796. };
  64797. break;
  64798. case 3:
  64799. attr.vertexAttrib = function(gl) {
  64800. gl.vertexAttrib3fv(this.index, this.value);
  64801. };
  64802. break;
  64803. case 4:
  64804. attr.vertexAttrib = function(gl) {
  64805. gl.vertexAttrib4fv(this.index, this.value);
  64806. };
  64807. break;
  64808. }
  64809. attr.disableVertexAttribArray = function(gl) {
  64810. };
  64811. }
  64812. attributes.push(attr);
  64813. }
  64814. function bind(gl, attributes, indexBuffer) {
  64815. for (let i2 = 0; i2 < attributes.length; ++i2) {
  64816. const attribute = attributes[i2];
  64817. if (attribute.enabled) {
  64818. attribute.vertexAttrib(gl);
  64819. }
  64820. }
  64821. if (defined_default(indexBuffer)) {
  64822. gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer._getBuffer());
  64823. }
  64824. }
  64825. function VertexArray(options) {
  64826. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  64827. Check_default.defined("options.context", options.context);
  64828. Check_default.defined("options.attributes", options.attributes);
  64829. const context = options.context;
  64830. const gl = context._gl;
  64831. const attributes = options.attributes;
  64832. const indexBuffer = options.indexBuffer;
  64833. let i2;
  64834. const vaAttributes = [];
  64835. let numberOfVertices = 1;
  64836. let hasInstancedAttributes = false;
  64837. let hasConstantAttributes = false;
  64838. let length3 = attributes.length;
  64839. for (i2 = 0; i2 < length3; ++i2) {
  64840. addAttribute(vaAttributes, attributes[i2], i2, context);
  64841. }
  64842. length3 = vaAttributes.length;
  64843. for (i2 = 0; i2 < length3; ++i2) {
  64844. const attribute = vaAttributes[i2];
  64845. if (defined_default(attribute.vertexBuffer) && attribute.instanceDivisor === 0) {
  64846. const bytes = attribute.strideInBytes || attribute.componentsPerAttribute * ComponentDatatype_default.getSizeInBytes(attribute.componentDatatype);
  64847. numberOfVertices = attribute.vertexBuffer.sizeInBytes / bytes;
  64848. break;
  64849. }
  64850. }
  64851. for (i2 = 0; i2 < length3; ++i2) {
  64852. if (vaAttributes[i2].instanceDivisor > 0) {
  64853. hasInstancedAttributes = true;
  64854. }
  64855. if (defined_default(vaAttributes[i2].value)) {
  64856. hasConstantAttributes = true;
  64857. }
  64858. }
  64859. const uniqueIndices = {};
  64860. for (i2 = 0; i2 < length3; ++i2) {
  64861. const index2 = vaAttributes[i2].index;
  64862. if (uniqueIndices[index2]) {
  64863. throw new DeveloperError_default(
  64864. `Index ${index2} is used by more than one attribute.`
  64865. );
  64866. }
  64867. uniqueIndices[index2] = true;
  64868. }
  64869. let vao;
  64870. if (context.vertexArrayObject) {
  64871. vao = context.glCreateVertexArray();
  64872. context.glBindVertexArray(vao);
  64873. bind(gl, vaAttributes, indexBuffer);
  64874. context.glBindVertexArray(null);
  64875. }
  64876. this._numberOfVertices = numberOfVertices;
  64877. this._hasInstancedAttributes = hasInstancedAttributes;
  64878. this._hasConstantAttributes = hasConstantAttributes;
  64879. this._context = context;
  64880. this._gl = gl;
  64881. this._vao = vao;
  64882. this._attributes = vaAttributes;
  64883. this._indexBuffer = indexBuffer;
  64884. }
  64885. function computeNumberOfVertices(attribute) {
  64886. return attribute.values.length / attribute.componentsPerAttribute;
  64887. }
  64888. function computeAttributeSizeInBytes(attribute) {
  64889. return ComponentDatatype_default.getSizeInBytes(attribute.componentDatatype) * attribute.componentsPerAttribute;
  64890. }
  64891. function interleaveAttributes(attributes) {
  64892. let j;
  64893. let name;
  64894. let attribute;
  64895. const names = [];
  64896. for (name in attributes) {
  64897. if (attributes.hasOwnProperty(name) && defined_default(attributes[name]) && defined_default(attributes[name].values)) {
  64898. names.push(name);
  64899. if (attributes[name].componentDatatype === ComponentDatatype_default.DOUBLE) {
  64900. attributes[name].componentDatatype = ComponentDatatype_default.FLOAT;
  64901. attributes[name].values = ComponentDatatype_default.createTypedArray(
  64902. ComponentDatatype_default.FLOAT,
  64903. attributes[name].values
  64904. );
  64905. }
  64906. }
  64907. }
  64908. let numberOfVertices;
  64909. const namesLength = names.length;
  64910. if (namesLength > 0) {
  64911. numberOfVertices = computeNumberOfVertices(attributes[names[0]]);
  64912. for (j = 1; j < namesLength; ++j) {
  64913. const currentNumberOfVertices = computeNumberOfVertices(
  64914. attributes[names[j]]
  64915. );
  64916. if (currentNumberOfVertices !== numberOfVertices) {
  64917. throw new RuntimeError_default(
  64918. `${"Each attribute list must have the same number of vertices. Attribute "}${names[j]} has a different number of vertices (${currentNumberOfVertices.toString()}) than attribute ${names[0]} (${numberOfVertices.toString()}).`
  64919. );
  64920. }
  64921. }
  64922. }
  64923. names.sort(function(left, right) {
  64924. return ComponentDatatype_default.getSizeInBytes(attributes[right].componentDatatype) - ComponentDatatype_default.getSizeInBytes(attributes[left].componentDatatype);
  64925. });
  64926. let vertexSizeInBytes = 0;
  64927. const offsetsInBytes = {};
  64928. for (j = 0; j < namesLength; ++j) {
  64929. name = names[j];
  64930. attribute = attributes[name];
  64931. offsetsInBytes[name] = vertexSizeInBytes;
  64932. vertexSizeInBytes += computeAttributeSizeInBytes(attribute);
  64933. }
  64934. if (vertexSizeInBytes > 0) {
  64935. const maxComponentSizeInBytes = ComponentDatatype_default.getSizeInBytes(
  64936. attributes[names[0]].componentDatatype
  64937. );
  64938. const remainder = vertexSizeInBytes % maxComponentSizeInBytes;
  64939. if (remainder !== 0) {
  64940. vertexSizeInBytes += maxComponentSizeInBytes - remainder;
  64941. }
  64942. const vertexBufferSizeInBytes = numberOfVertices * vertexSizeInBytes;
  64943. const buffer = new ArrayBuffer(vertexBufferSizeInBytes);
  64944. const views = {};
  64945. for (j = 0; j < namesLength; ++j) {
  64946. name = names[j];
  64947. const sizeInBytes = ComponentDatatype_default.getSizeInBytes(
  64948. attributes[name].componentDatatype
  64949. );
  64950. views[name] = {
  64951. pointer: ComponentDatatype_default.createTypedArray(
  64952. attributes[name].componentDatatype,
  64953. buffer
  64954. ),
  64955. index: offsetsInBytes[name] / sizeInBytes,
  64956. strideInComponentType: vertexSizeInBytes / sizeInBytes
  64957. };
  64958. }
  64959. for (j = 0; j < numberOfVertices; ++j) {
  64960. for (let n2 = 0; n2 < namesLength; ++n2) {
  64961. name = names[n2];
  64962. attribute = attributes[name];
  64963. const values = attribute.values;
  64964. const view = views[name];
  64965. const pointer = view.pointer;
  64966. const numberOfComponents = attribute.componentsPerAttribute;
  64967. for (let k = 0; k < numberOfComponents; ++k) {
  64968. pointer[view.index + k] = values[j * numberOfComponents + k];
  64969. }
  64970. view.index += view.strideInComponentType;
  64971. }
  64972. }
  64973. return {
  64974. buffer,
  64975. offsetsInBytes,
  64976. vertexSizeInBytes
  64977. };
  64978. }
  64979. return void 0;
  64980. }
  64981. VertexArray.fromGeometry = function(options) {
  64982. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  64983. Check_default.defined("options.context", options.context);
  64984. const context = options.context;
  64985. const geometry = defaultValue_default(options.geometry, defaultValue_default.EMPTY_OBJECT);
  64986. const bufferUsage = defaultValue_default(
  64987. options.bufferUsage,
  64988. BufferUsage_default.DYNAMIC_DRAW
  64989. );
  64990. const attributeLocations8 = defaultValue_default(
  64991. options.attributeLocations,
  64992. defaultValue_default.EMPTY_OBJECT
  64993. );
  64994. const interleave = defaultValue_default(options.interleave, false);
  64995. const createdVAAttributes = options.vertexArrayAttributes;
  64996. let name;
  64997. let attribute;
  64998. let vertexBuffer;
  64999. const vaAttributes = defined_default(createdVAAttributes) ? createdVAAttributes : [];
  65000. const attributes = geometry.attributes;
  65001. if (interleave) {
  65002. const interleavedAttributes = interleaveAttributes(attributes);
  65003. if (defined_default(interleavedAttributes)) {
  65004. vertexBuffer = Buffer_default.createVertexBuffer({
  65005. context,
  65006. typedArray: interleavedAttributes.buffer,
  65007. usage: bufferUsage
  65008. });
  65009. const offsetsInBytes = interleavedAttributes.offsetsInBytes;
  65010. const strideInBytes = interleavedAttributes.vertexSizeInBytes;
  65011. for (name in attributes) {
  65012. if (attributes.hasOwnProperty(name) && defined_default(attributes[name])) {
  65013. attribute = attributes[name];
  65014. if (defined_default(attribute.values)) {
  65015. vaAttributes.push({
  65016. index: attributeLocations8[name],
  65017. vertexBuffer,
  65018. componentDatatype: attribute.componentDatatype,
  65019. componentsPerAttribute: attribute.componentsPerAttribute,
  65020. normalize: attribute.normalize,
  65021. offsetInBytes: offsetsInBytes[name],
  65022. strideInBytes
  65023. });
  65024. } else {
  65025. vaAttributes.push({
  65026. index: attributeLocations8[name],
  65027. value: attribute.value,
  65028. componentDatatype: attribute.componentDatatype,
  65029. normalize: attribute.normalize
  65030. });
  65031. }
  65032. }
  65033. }
  65034. }
  65035. } else {
  65036. for (name in attributes) {
  65037. if (attributes.hasOwnProperty(name) && defined_default(attributes[name])) {
  65038. attribute = attributes[name];
  65039. let componentDatatype = attribute.componentDatatype;
  65040. if (componentDatatype === ComponentDatatype_default.DOUBLE) {
  65041. componentDatatype = ComponentDatatype_default.FLOAT;
  65042. }
  65043. vertexBuffer = void 0;
  65044. if (defined_default(attribute.values)) {
  65045. vertexBuffer = Buffer_default.createVertexBuffer({
  65046. context,
  65047. typedArray: ComponentDatatype_default.createTypedArray(
  65048. componentDatatype,
  65049. attribute.values
  65050. ),
  65051. usage: bufferUsage
  65052. });
  65053. }
  65054. vaAttributes.push({
  65055. index: attributeLocations8[name],
  65056. vertexBuffer,
  65057. value: attribute.value,
  65058. componentDatatype,
  65059. componentsPerAttribute: attribute.componentsPerAttribute,
  65060. normalize: attribute.normalize
  65061. });
  65062. }
  65063. }
  65064. }
  65065. let indexBuffer;
  65066. const indices2 = geometry.indices;
  65067. if (defined_default(indices2)) {
  65068. if (Geometry_default.computeNumberOfVertices(geometry) >= Math_default.SIXTY_FOUR_KILOBYTES && context.elementIndexUint) {
  65069. indexBuffer = Buffer_default.createIndexBuffer({
  65070. context,
  65071. typedArray: new Uint32Array(indices2),
  65072. usage: bufferUsage,
  65073. indexDatatype: IndexDatatype_default.UNSIGNED_INT
  65074. });
  65075. } else {
  65076. indexBuffer = Buffer_default.createIndexBuffer({
  65077. context,
  65078. typedArray: new Uint16Array(indices2),
  65079. usage: bufferUsage,
  65080. indexDatatype: IndexDatatype_default.UNSIGNED_SHORT
  65081. });
  65082. }
  65083. }
  65084. return new VertexArray({
  65085. context,
  65086. attributes: vaAttributes,
  65087. indexBuffer
  65088. });
  65089. };
  65090. Object.defineProperties(VertexArray.prototype, {
  65091. numberOfAttributes: {
  65092. get: function() {
  65093. return this._attributes.length;
  65094. }
  65095. },
  65096. numberOfVertices: {
  65097. get: function() {
  65098. return this._numberOfVertices;
  65099. }
  65100. },
  65101. indexBuffer: {
  65102. get: function() {
  65103. return this._indexBuffer;
  65104. }
  65105. }
  65106. });
  65107. VertexArray.prototype.getAttribute = function(index2) {
  65108. Check_default.defined("index", index2);
  65109. return this._attributes[index2];
  65110. };
  65111. function setVertexAttribDivisor(vertexArray) {
  65112. const context = vertexArray._context;
  65113. const hasInstancedAttributes = vertexArray._hasInstancedAttributes;
  65114. if (!hasInstancedAttributes && !context._previousDrawInstanced) {
  65115. return;
  65116. }
  65117. context._previousDrawInstanced = hasInstancedAttributes;
  65118. const divisors = context._vertexAttribDivisors;
  65119. const attributes = vertexArray._attributes;
  65120. const maxAttributes = ContextLimits_default.maximumVertexAttributes;
  65121. let i2;
  65122. if (hasInstancedAttributes) {
  65123. const length3 = attributes.length;
  65124. for (i2 = 0; i2 < length3; ++i2) {
  65125. const attribute = attributes[i2];
  65126. if (attribute.enabled) {
  65127. const divisor = attribute.instanceDivisor;
  65128. const index2 = attribute.index;
  65129. if (divisor !== divisors[index2]) {
  65130. context.glVertexAttribDivisor(index2, divisor);
  65131. divisors[index2] = divisor;
  65132. }
  65133. }
  65134. }
  65135. } else {
  65136. for (i2 = 0; i2 < maxAttributes; ++i2) {
  65137. if (divisors[i2] > 0) {
  65138. context.glVertexAttribDivisor(i2, 0);
  65139. divisors[i2] = 0;
  65140. }
  65141. }
  65142. }
  65143. }
  65144. function setConstantAttributes(vertexArray, gl) {
  65145. const attributes = vertexArray._attributes;
  65146. const length3 = attributes.length;
  65147. for (let i2 = 0; i2 < length3; ++i2) {
  65148. const attribute = attributes[i2];
  65149. if (attribute.enabled && defined_default(attribute.value)) {
  65150. attribute.vertexAttrib(gl);
  65151. }
  65152. }
  65153. }
  65154. VertexArray.prototype._bind = function() {
  65155. if (defined_default(this._vao)) {
  65156. this._context.glBindVertexArray(this._vao);
  65157. if (this._context.instancedArrays) {
  65158. setVertexAttribDivisor(this);
  65159. }
  65160. if (this._hasConstantAttributes) {
  65161. setConstantAttributes(this, this._gl);
  65162. }
  65163. } else {
  65164. bind(this._gl, this._attributes, this._indexBuffer);
  65165. }
  65166. };
  65167. VertexArray.prototype._unBind = function() {
  65168. if (defined_default(this._vao)) {
  65169. this._context.glBindVertexArray(null);
  65170. } else {
  65171. const attributes = this._attributes;
  65172. const gl = this._gl;
  65173. for (let i2 = 0; i2 < attributes.length; ++i2) {
  65174. const attribute = attributes[i2];
  65175. if (attribute.enabled) {
  65176. attribute.disableVertexAttribArray(gl);
  65177. }
  65178. }
  65179. if (this._indexBuffer) {
  65180. gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, null);
  65181. }
  65182. }
  65183. };
  65184. VertexArray.prototype.isDestroyed = function() {
  65185. return false;
  65186. };
  65187. VertexArray.prototype.destroy = function() {
  65188. const attributes = this._attributes;
  65189. for (let i2 = 0; i2 < attributes.length; ++i2) {
  65190. const vertexBuffer = attributes[i2].vertexBuffer;
  65191. if (defined_default(vertexBuffer) && !vertexBuffer.isDestroyed() && vertexBuffer.vertexArrayDestroyable) {
  65192. vertexBuffer.destroy();
  65193. }
  65194. }
  65195. const indexBuffer = this._indexBuffer;
  65196. if (defined_default(indexBuffer) && !indexBuffer.isDestroyed() && indexBuffer.vertexArrayDestroyable) {
  65197. indexBuffer.destroy();
  65198. }
  65199. if (defined_default(this._vao)) {
  65200. this._context.glDeleteVertexArray(this._vao);
  65201. }
  65202. return destroyObject_default(this);
  65203. };
  65204. var VertexArray_default = VertexArray;
  65205. // node_modules/cesium/Source/Scene/BatchTable.js
  65206. function BatchTable(context, attributes, numberOfInstances) {
  65207. if (!defined_default(context)) {
  65208. throw new DeveloperError_default("context is required");
  65209. }
  65210. if (!defined_default(attributes)) {
  65211. throw new DeveloperError_default("attributes is required");
  65212. }
  65213. if (!defined_default(numberOfInstances)) {
  65214. throw new DeveloperError_default("numberOfInstances is required");
  65215. }
  65216. this._attributes = attributes;
  65217. this._numberOfInstances = numberOfInstances;
  65218. if (attributes.length === 0) {
  65219. return;
  65220. }
  65221. const pixelDatatype = getDatatype(attributes);
  65222. const textureFloatSupported = context.floatingPointTexture;
  65223. const packFloats = pixelDatatype === PixelDatatype_default.FLOAT && !textureFloatSupported;
  65224. const offsets = createOffsets(attributes, packFloats);
  65225. const stride = getStride(offsets, attributes, packFloats);
  65226. const maxNumberOfInstancesPerRow = Math.floor(
  65227. ContextLimits_default.maximumTextureSize / stride
  65228. );
  65229. const instancesPerWidth = Math.min(
  65230. numberOfInstances,
  65231. maxNumberOfInstancesPerRow
  65232. );
  65233. const width = stride * instancesPerWidth;
  65234. const height = Math.ceil(numberOfInstances / instancesPerWidth);
  65235. const stepX = 1 / width;
  65236. const centerX = stepX * 0.5;
  65237. const stepY = 1 / height;
  65238. const centerY = stepY * 0.5;
  65239. this._textureDimensions = new Cartesian2_default(width, height);
  65240. this._textureStep = new Cartesian4_default(stepX, centerX, stepY, centerY);
  65241. this._pixelDatatype = !packFloats ? pixelDatatype : PixelDatatype_default.UNSIGNED_BYTE;
  65242. this._packFloats = packFloats;
  65243. this._offsets = offsets;
  65244. this._stride = stride;
  65245. this._texture = void 0;
  65246. const batchLength = 4 * width * height;
  65247. this._batchValues = pixelDatatype === PixelDatatype_default.FLOAT && !packFloats ? new Float32Array(batchLength) : new Uint8Array(batchLength);
  65248. this._batchValuesDirty = false;
  65249. }
  65250. Object.defineProperties(BatchTable.prototype, {
  65251. attributes: {
  65252. get: function() {
  65253. return this._attributes;
  65254. }
  65255. },
  65256. numberOfInstances: {
  65257. get: function() {
  65258. return this._numberOfInstances;
  65259. }
  65260. }
  65261. });
  65262. function getDatatype(attributes) {
  65263. let foundFloatDatatype = false;
  65264. const length3 = attributes.length;
  65265. for (let i2 = 0; i2 < length3; ++i2) {
  65266. if (attributes[i2].componentDatatype !== ComponentDatatype_default.UNSIGNED_BYTE) {
  65267. foundFloatDatatype = true;
  65268. break;
  65269. }
  65270. }
  65271. return foundFloatDatatype ? PixelDatatype_default.FLOAT : PixelDatatype_default.UNSIGNED_BYTE;
  65272. }
  65273. function getAttributeType(attributes, attributeIndex) {
  65274. const componentsPerAttribute = attributes[attributeIndex].componentsPerAttribute;
  65275. if (componentsPerAttribute === 2) {
  65276. return Cartesian2_default;
  65277. } else if (componentsPerAttribute === 3) {
  65278. return Cartesian3_default;
  65279. } else if (componentsPerAttribute === 4) {
  65280. return Cartesian4_default;
  65281. }
  65282. return Number;
  65283. }
  65284. function createOffsets(attributes, packFloats) {
  65285. const offsets = new Array(attributes.length);
  65286. let currentOffset = 0;
  65287. const attributesLength = attributes.length;
  65288. for (let i2 = 0; i2 < attributesLength; ++i2) {
  65289. const attribute = attributes[i2];
  65290. const componentDatatype = attribute.componentDatatype;
  65291. offsets[i2] = currentOffset;
  65292. if (componentDatatype !== ComponentDatatype_default.UNSIGNED_BYTE && packFloats) {
  65293. currentOffset += 4;
  65294. } else {
  65295. ++currentOffset;
  65296. }
  65297. }
  65298. return offsets;
  65299. }
  65300. function getStride(offsets, attributes, packFloats) {
  65301. const length3 = offsets.length;
  65302. const lastOffset = offsets[length3 - 1];
  65303. const lastAttribute = attributes[length3 - 1];
  65304. const componentDatatype = lastAttribute.componentDatatype;
  65305. if (componentDatatype !== ComponentDatatype_default.UNSIGNED_BYTE && packFloats) {
  65306. return lastOffset + 4;
  65307. }
  65308. return lastOffset + 1;
  65309. }
  65310. var scratchPackedFloatCartesian4 = new Cartesian4_default();
  65311. function getPackedFloat(array, index2, result) {
  65312. let packed = Cartesian4_default.unpack(array, index2, scratchPackedFloatCartesian4);
  65313. const x = Cartesian4_default.unpackFloat(packed);
  65314. packed = Cartesian4_default.unpack(array, index2 + 4, scratchPackedFloatCartesian4);
  65315. const y = Cartesian4_default.unpackFloat(packed);
  65316. packed = Cartesian4_default.unpack(array, index2 + 8, scratchPackedFloatCartesian4);
  65317. const z = Cartesian4_default.unpackFloat(packed);
  65318. packed = Cartesian4_default.unpack(array, index2 + 12, scratchPackedFloatCartesian4);
  65319. const w = Cartesian4_default.unpackFloat(packed);
  65320. return Cartesian4_default.fromElements(x, y, z, w, result);
  65321. }
  65322. function setPackedAttribute(value, array, index2) {
  65323. let packed = Cartesian4_default.packFloat(value.x, scratchPackedFloatCartesian4);
  65324. Cartesian4_default.pack(packed, array, index2);
  65325. packed = Cartesian4_default.packFloat(value.y, packed);
  65326. Cartesian4_default.pack(packed, array, index2 + 4);
  65327. packed = Cartesian4_default.packFloat(value.z, packed);
  65328. Cartesian4_default.pack(packed, array, index2 + 8);
  65329. packed = Cartesian4_default.packFloat(value.w, packed);
  65330. Cartesian4_default.pack(packed, array, index2 + 12);
  65331. }
  65332. var scratchGetAttributeCartesian4 = new Cartesian4_default();
  65333. BatchTable.prototype.getBatchedAttribute = function(instanceIndex, attributeIndex, result) {
  65334. if (instanceIndex < 0 || instanceIndex >= this._numberOfInstances) {
  65335. throw new DeveloperError_default("instanceIndex is out of range.");
  65336. }
  65337. if (attributeIndex < 0 || attributeIndex >= this._attributes.length) {
  65338. throw new DeveloperError_default("attributeIndex is out of range");
  65339. }
  65340. const attributes = this._attributes;
  65341. const offset2 = this._offsets[attributeIndex];
  65342. const stride = this._stride;
  65343. const index2 = 4 * stride * instanceIndex + 4 * offset2;
  65344. let value;
  65345. if (this._packFloats && attributes[attributeIndex].componentDatatype !== PixelDatatype_default.UNSIGNED_BYTE) {
  65346. value = getPackedFloat(
  65347. this._batchValues,
  65348. index2,
  65349. scratchGetAttributeCartesian4
  65350. );
  65351. } else {
  65352. value = Cartesian4_default.unpack(
  65353. this._batchValues,
  65354. index2,
  65355. scratchGetAttributeCartesian4
  65356. );
  65357. }
  65358. const attributeType = getAttributeType(attributes, attributeIndex);
  65359. if (defined_default(attributeType.fromCartesian4)) {
  65360. return attributeType.fromCartesian4(value, result);
  65361. } else if (defined_default(attributeType.clone)) {
  65362. return attributeType.clone(value, result);
  65363. }
  65364. return value.x;
  65365. };
  65366. var setAttributeScratchValues = [
  65367. void 0,
  65368. void 0,
  65369. new Cartesian2_default(),
  65370. new Cartesian3_default(),
  65371. new Cartesian4_default()
  65372. ];
  65373. var setAttributeScratchCartesian4 = new Cartesian4_default();
  65374. BatchTable.prototype.setBatchedAttribute = function(instanceIndex, attributeIndex, value) {
  65375. if (instanceIndex < 0 || instanceIndex >= this._numberOfInstances) {
  65376. throw new DeveloperError_default("instanceIndex is out of range.");
  65377. }
  65378. if (attributeIndex < 0 || attributeIndex >= this._attributes.length) {
  65379. throw new DeveloperError_default("attributeIndex is out of range");
  65380. }
  65381. if (!defined_default(value)) {
  65382. throw new DeveloperError_default("value is required.");
  65383. }
  65384. const attributes = this._attributes;
  65385. const result = setAttributeScratchValues[attributes[attributeIndex].componentsPerAttribute];
  65386. const currentAttribute = this.getBatchedAttribute(
  65387. instanceIndex,
  65388. attributeIndex,
  65389. result
  65390. );
  65391. const attributeType = getAttributeType(this._attributes, attributeIndex);
  65392. const entriesEqual = defined_default(attributeType.equals) ? attributeType.equals(currentAttribute, value) : currentAttribute === value;
  65393. if (entriesEqual) {
  65394. return;
  65395. }
  65396. const attributeValue = setAttributeScratchCartesian4;
  65397. attributeValue.x = defined_default(value.x) ? value.x : value;
  65398. attributeValue.y = defined_default(value.y) ? value.y : 0;
  65399. attributeValue.z = defined_default(value.z) ? value.z : 0;
  65400. attributeValue.w = defined_default(value.w) ? value.w : 0;
  65401. const offset2 = this._offsets[attributeIndex];
  65402. const stride = this._stride;
  65403. const index2 = 4 * stride * instanceIndex + 4 * offset2;
  65404. if (this._packFloats && attributes[attributeIndex].componentDatatype !== PixelDatatype_default.UNSIGNED_BYTE) {
  65405. setPackedAttribute(attributeValue, this._batchValues, index2);
  65406. } else {
  65407. Cartesian4_default.pack(attributeValue, this._batchValues, index2);
  65408. }
  65409. this._batchValuesDirty = true;
  65410. };
  65411. function createTexture(batchTable, context) {
  65412. const dimensions = batchTable._textureDimensions;
  65413. batchTable._texture = new Texture_default({
  65414. context,
  65415. pixelFormat: PixelFormat_default.RGBA,
  65416. pixelDatatype: batchTable._pixelDatatype,
  65417. width: dimensions.x,
  65418. height: dimensions.y,
  65419. sampler: Sampler_default.NEAREST,
  65420. flipY: false
  65421. });
  65422. }
  65423. function updateTexture(batchTable) {
  65424. const dimensions = batchTable._textureDimensions;
  65425. batchTable._texture.copyFrom({
  65426. source: {
  65427. width: dimensions.x,
  65428. height: dimensions.y,
  65429. arrayBufferView: batchTable._batchValues
  65430. }
  65431. });
  65432. }
  65433. BatchTable.prototype.update = function(frameState) {
  65434. if (defined_default(this._texture) && !this._batchValuesDirty || this._attributes.length === 0) {
  65435. return;
  65436. }
  65437. this._batchValuesDirty = false;
  65438. if (!defined_default(this._texture)) {
  65439. createTexture(this, frameState.context);
  65440. }
  65441. updateTexture(this);
  65442. };
  65443. BatchTable.prototype.getUniformMapCallback = function() {
  65444. const that = this;
  65445. return function(uniformMap2) {
  65446. if (that._attributes.length === 0) {
  65447. return uniformMap2;
  65448. }
  65449. const batchUniformMap = {
  65450. batchTexture: function() {
  65451. return that._texture;
  65452. },
  65453. batchTextureDimensions: function() {
  65454. return that._textureDimensions;
  65455. },
  65456. batchTextureStep: function() {
  65457. return that._textureStep;
  65458. }
  65459. };
  65460. return combine_default(uniformMap2, batchUniformMap);
  65461. };
  65462. };
  65463. function getGlslComputeSt(batchTable) {
  65464. const stride = batchTable._stride;
  65465. if (batchTable._textureDimensions.y === 1) {
  65466. return `${"uniform vec4 batchTextureStep; \nvec2 computeSt(float batchId) \n{ \n float stepX = batchTextureStep.x; \n float centerX = batchTextureStep.y; \n float numberOfAttributes = float("}${stride});
  65467. return vec2(centerX + (batchId * numberOfAttributes * stepX), 0.5);
  65468. }
  65469. `;
  65470. }
  65471. return `${"uniform vec4 batchTextureStep; \nuniform vec2 batchTextureDimensions; \nvec2 computeSt(float batchId) \n{ \n float stepX = batchTextureStep.x; \n float centerX = batchTextureStep.y; \n float stepY = batchTextureStep.z; \n float centerY = batchTextureStep.w; \n float numberOfAttributes = float("}${stride});
  65472. float xId = mod(batchId * numberOfAttributes, batchTextureDimensions.x);
  65473. float yId = floor(batchId * numberOfAttributes / batchTextureDimensions.x);
  65474. return vec2(centerX + (xId * stepX), centerY + (yId * stepY));
  65475. }
  65476. `;
  65477. }
  65478. function getComponentType(componentsPerAttribute) {
  65479. if (componentsPerAttribute === 1) {
  65480. return "float";
  65481. }
  65482. return `vec${componentsPerAttribute}`;
  65483. }
  65484. function getComponentSwizzle(componentsPerAttribute) {
  65485. if (componentsPerAttribute === 1) {
  65486. return ".x";
  65487. } else if (componentsPerAttribute === 2) {
  65488. return ".xy";
  65489. } else if (componentsPerAttribute === 3) {
  65490. return ".xyz";
  65491. }
  65492. return "";
  65493. }
  65494. function getGlslAttributeFunction(batchTable, attributeIndex) {
  65495. const attributes = batchTable._attributes;
  65496. const attribute = attributes[attributeIndex];
  65497. const componentsPerAttribute = attribute.componentsPerAttribute;
  65498. const functionName = attribute.functionName;
  65499. const functionReturnType = getComponentType(componentsPerAttribute);
  65500. const functionReturnValue = getComponentSwizzle(componentsPerAttribute);
  65501. const offset2 = batchTable._offsets[attributeIndex];
  65502. let glslFunction = `${functionReturnType} ${functionName}(float batchId)
  65503. {
  65504. vec2 st = computeSt(batchId);
  65505. st.x += batchTextureStep.x * float(${offset2});
  65506. `;
  65507. if (batchTable._packFloats && attribute.componentDatatype !== PixelDatatype_default.UNSIGNED_BYTE) {
  65508. glslFunction += "vec4 textureValue; \ntextureValue.x = czm_unpackFloat(texture2D(batchTexture, st)); \ntextureValue.y = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x, 0.0))); \ntextureValue.z = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x * 2.0, 0.0))); \ntextureValue.w = czm_unpackFloat(texture2D(batchTexture, st + vec2(batchTextureStep.x * 3.0, 0.0))); \n";
  65509. } else {
  65510. glslFunction += " vec4 textureValue = texture2D(batchTexture, st); \n";
  65511. }
  65512. glslFunction += ` ${functionReturnType} value = textureValue${functionReturnValue};
  65513. `;
  65514. if (batchTable._pixelDatatype === PixelDatatype_default.UNSIGNED_BYTE && attribute.componentDatatype === ComponentDatatype_default.UNSIGNED_BYTE && !attribute.normalize) {
  65515. glslFunction += "value *= 255.0; \n";
  65516. } else if (batchTable._pixelDatatype === PixelDatatype_default.FLOAT && attribute.componentDatatype === ComponentDatatype_default.UNSIGNED_BYTE && attribute.normalize) {
  65517. glslFunction += "value /= 255.0; \n";
  65518. }
  65519. glslFunction += " return value; \n} \n";
  65520. return glslFunction;
  65521. }
  65522. BatchTable.prototype.getVertexShaderCallback = function() {
  65523. const attributes = this._attributes;
  65524. if (attributes.length === 0) {
  65525. return function(source) {
  65526. return source;
  65527. };
  65528. }
  65529. let batchTableShader = "uniform highp sampler2D batchTexture; \n";
  65530. batchTableShader += `${getGlslComputeSt(this)}
  65531. `;
  65532. const length3 = attributes.length;
  65533. for (let i2 = 0; i2 < length3; ++i2) {
  65534. batchTableShader += getGlslAttributeFunction(this, i2);
  65535. }
  65536. return function(source) {
  65537. const mainIndex = source.indexOf("void main");
  65538. const beforeMain = source.substring(0, mainIndex);
  65539. const afterMain = source.substring(mainIndex);
  65540. return `${beforeMain}
  65541. ${batchTableShader}
  65542. ${afterMain}`;
  65543. };
  65544. };
  65545. BatchTable.prototype.isDestroyed = function() {
  65546. return false;
  65547. };
  65548. BatchTable.prototype.destroy = function() {
  65549. this._texture = this._texture && this._texture.destroy();
  65550. return destroyObject_default(this);
  65551. };
  65552. var BatchTable_default = BatchTable;
  65553. // node_modules/cesium/Source/Scene/PrimitivePipeline.js
  65554. function transformToWorldCoordinates(instances, primitiveModelMatrix, scene3DOnly) {
  65555. let toWorld = !scene3DOnly;
  65556. const length3 = instances.length;
  65557. let i2;
  65558. if (!toWorld && length3 > 1) {
  65559. const modelMatrix = instances[0].modelMatrix;
  65560. for (i2 = 1; i2 < length3; ++i2) {
  65561. if (!Matrix4_default.equals(modelMatrix, instances[i2].modelMatrix)) {
  65562. toWorld = true;
  65563. break;
  65564. }
  65565. }
  65566. }
  65567. if (toWorld) {
  65568. for (i2 = 0; i2 < length3; ++i2) {
  65569. if (defined_default(instances[i2].geometry)) {
  65570. GeometryPipeline_default.transformToWorldCoordinates(instances[i2]);
  65571. }
  65572. }
  65573. } else {
  65574. Matrix4_default.multiplyTransformation(
  65575. primitiveModelMatrix,
  65576. instances[0].modelMatrix,
  65577. primitiveModelMatrix
  65578. );
  65579. }
  65580. }
  65581. function addGeometryBatchId(geometry, batchId) {
  65582. const attributes = geometry.attributes;
  65583. const positionAttr = attributes.position;
  65584. const numberOfComponents = positionAttr.values.length / positionAttr.componentsPerAttribute;
  65585. attributes.batchId = new GeometryAttribute_default({
  65586. componentDatatype: ComponentDatatype_default.FLOAT,
  65587. componentsPerAttribute: 1,
  65588. values: new Float32Array(numberOfComponents)
  65589. });
  65590. const values = attributes.batchId.values;
  65591. for (let j = 0; j < numberOfComponents; ++j) {
  65592. values[j] = batchId;
  65593. }
  65594. }
  65595. function addBatchIds(instances) {
  65596. const length3 = instances.length;
  65597. for (let i2 = 0; i2 < length3; ++i2) {
  65598. const instance = instances[i2];
  65599. if (defined_default(instance.geometry)) {
  65600. addGeometryBatchId(instance.geometry, i2);
  65601. } else if (defined_default(instance.westHemisphereGeometry) && defined_default(instance.eastHemisphereGeometry)) {
  65602. addGeometryBatchId(instance.westHemisphereGeometry, i2);
  65603. addGeometryBatchId(instance.eastHemisphereGeometry, i2);
  65604. }
  65605. }
  65606. }
  65607. function geometryPipeline(parameters) {
  65608. const instances = parameters.instances;
  65609. const projection = parameters.projection;
  65610. const uintIndexSupport = parameters.elementIndexUintSupported;
  65611. const scene3DOnly = parameters.scene3DOnly;
  65612. const vertexCacheOptimize = parameters.vertexCacheOptimize;
  65613. const compressVertices = parameters.compressVertices;
  65614. const modelMatrix = parameters.modelMatrix;
  65615. let i2;
  65616. let geometry;
  65617. let primitiveType;
  65618. let length3 = instances.length;
  65619. for (i2 = 0; i2 < length3; ++i2) {
  65620. if (defined_default(instances[i2].geometry)) {
  65621. primitiveType = instances[i2].geometry.primitiveType;
  65622. break;
  65623. }
  65624. }
  65625. for (i2 = 1; i2 < length3; ++i2) {
  65626. if (defined_default(instances[i2].geometry) && instances[i2].geometry.primitiveType !== primitiveType) {
  65627. throw new DeveloperError_default(
  65628. "All instance geometries must have the same primitiveType."
  65629. );
  65630. }
  65631. }
  65632. transformToWorldCoordinates(instances, modelMatrix, scene3DOnly);
  65633. if (!scene3DOnly) {
  65634. for (i2 = 0; i2 < length3; ++i2) {
  65635. if (defined_default(instances[i2].geometry)) {
  65636. GeometryPipeline_default.splitLongitude(instances[i2]);
  65637. }
  65638. }
  65639. }
  65640. addBatchIds(instances);
  65641. if (vertexCacheOptimize) {
  65642. for (i2 = 0; i2 < length3; ++i2) {
  65643. const instance = instances[i2];
  65644. if (defined_default(instance.geometry)) {
  65645. GeometryPipeline_default.reorderForPostVertexCache(instance.geometry);
  65646. GeometryPipeline_default.reorderForPreVertexCache(instance.geometry);
  65647. } else if (defined_default(instance.westHemisphereGeometry) && defined_default(instance.eastHemisphereGeometry)) {
  65648. GeometryPipeline_default.reorderForPostVertexCache(
  65649. instance.westHemisphereGeometry
  65650. );
  65651. GeometryPipeline_default.reorderForPreVertexCache(
  65652. instance.westHemisphereGeometry
  65653. );
  65654. GeometryPipeline_default.reorderForPostVertexCache(
  65655. instance.eastHemisphereGeometry
  65656. );
  65657. GeometryPipeline_default.reorderForPreVertexCache(
  65658. instance.eastHemisphereGeometry
  65659. );
  65660. }
  65661. }
  65662. }
  65663. let geometries = GeometryPipeline_default.combineInstances(instances);
  65664. length3 = geometries.length;
  65665. for (i2 = 0; i2 < length3; ++i2) {
  65666. geometry = geometries[i2];
  65667. const attributes = geometry.attributes;
  65668. if (!scene3DOnly) {
  65669. for (const name in attributes) {
  65670. if (attributes.hasOwnProperty(name) && attributes[name].componentDatatype === ComponentDatatype_default.DOUBLE) {
  65671. const name3D = `${name}3D`;
  65672. const name2D = `${name}2D`;
  65673. GeometryPipeline_default.projectTo2D(
  65674. geometry,
  65675. name,
  65676. name3D,
  65677. name2D,
  65678. projection
  65679. );
  65680. if (defined_default(geometry.boundingSphere) && name === "position") {
  65681. geometry.boundingSphereCV = BoundingSphere_default.fromVertices(
  65682. geometry.attributes.position2D.values
  65683. );
  65684. }
  65685. GeometryPipeline_default.encodeAttribute(
  65686. geometry,
  65687. name3D,
  65688. `${name3D}High`,
  65689. `${name3D}Low`
  65690. );
  65691. GeometryPipeline_default.encodeAttribute(
  65692. geometry,
  65693. name2D,
  65694. `${name2D}High`,
  65695. `${name2D}Low`
  65696. );
  65697. }
  65698. }
  65699. } else {
  65700. for (const name in attributes) {
  65701. if (attributes.hasOwnProperty(name) && attributes[name].componentDatatype === ComponentDatatype_default.DOUBLE) {
  65702. GeometryPipeline_default.encodeAttribute(
  65703. geometry,
  65704. name,
  65705. `${name}3DHigh`,
  65706. `${name}3DLow`
  65707. );
  65708. }
  65709. }
  65710. }
  65711. if (compressVertices) {
  65712. GeometryPipeline_default.compressVertices(geometry);
  65713. }
  65714. }
  65715. if (!uintIndexSupport) {
  65716. let splitGeometries = [];
  65717. length3 = geometries.length;
  65718. for (i2 = 0; i2 < length3; ++i2) {
  65719. geometry = geometries[i2];
  65720. splitGeometries = splitGeometries.concat(
  65721. GeometryPipeline_default.fitToUnsignedShortIndices(geometry)
  65722. );
  65723. }
  65724. geometries = splitGeometries;
  65725. }
  65726. return geometries;
  65727. }
  65728. function createPickOffsets(instances, geometryName, geometries, pickOffsets) {
  65729. let offset2;
  65730. let indexCount;
  65731. let geometryIndex;
  65732. const offsetIndex = pickOffsets.length - 1;
  65733. if (offsetIndex >= 0) {
  65734. const pickOffset = pickOffsets[offsetIndex];
  65735. offset2 = pickOffset.offset + pickOffset.count;
  65736. geometryIndex = pickOffset.index;
  65737. indexCount = geometries[geometryIndex].indices.length;
  65738. } else {
  65739. offset2 = 0;
  65740. geometryIndex = 0;
  65741. indexCount = geometries[geometryIndex].indices.length;
  65742. }
  65743. const length3 = instances.length;
  65744. for (let i2 = 0; i2 < length3; ++i2) {
  65745. const instance = instances[i2];
  65746. const geometry = instance[geometryName];
  65747. if (!defined_default(geometry)) {
  65748. continue;
  65749. }
  65750. const count = geometry.indices.length;
  65751. if (offset2 + count > indexCount) {
  65752. offset2 = 0;
  65753. indexCount = geometries[++geometryIndex].indices.length;
  65754. }
  65755. pickOffsets.push({
  65756. index: geometryIndex,
  65757. offset: offset2,
  65758. count
  65759. });
  65760. offset2 += count;
  65761. }
  65762. }
  65763. function createInstancePickOffsets(instances, geometries) {
  65764. const pickOffsets = [];
  65765. createPickOffsets(instances, "geometry", geometries, pickOffsets);
  65766. createPickOffsets(
  65767. instances,
  65768. "westHemisphereGeometry",
  65769. geometries,
  65770. pickOffsets
  65771. );
  65772. createPickOffsets(
  65773. instances,
  65774. "eastHemisphereGeometry",
  65775. geometries,
  65776. pickOffsets
  65777. );
  65778. return pickOffsets;
  65779. }
  65780. var PrimitivePipeline = {};
  65781. PrimitivePipeline.combineGeometry = function(parameters) {
  65782. let geometries;
  65783. let attributeLocations8;
  65784. const instances = parameters.instances;
  65785. const length3 = instances.length;
  65786. let pickOffsets;
  65787. let offsetInstanceExtend;
  65788. let hasOffset = false;
  65789. if (length3 > 0) {
  65790. geometries = geometryPipeline(parameters);
  65791. if (geometries.length > 0) {
  65792. attributeLocations8 = GeometryPipeline_default.createAttributeLocations(
  65793. geometries[0]
  65794. );
  65795. if (parameters.createPickOffsets) {
  65796. pickOffsets = createInstancePickOffsets(instances, geometries);
  65797. }
  65798. }
  65799. if (defined_default(instances[0].attributes) && defined_default(instances[0].attributes.offset)) {
  65800. offsetInstanceExtend = new Array(length3);
  65801. hasOffset = true;
  65802. }
  65803. }
  65804. const boundingSpheres = new Array(length3);
  65805. const boundingSpheresCV = new Array(length3);
  65806. for (let i2 = 0; i2 < length3; ++i2) {
  65807. const instance = instances[i2];
  65808. const geometry = instance.geometry;
  65809. if (defined_default(geometry)) {
  65810. boundingSpheres[i2] = geometry.boundingSphere;
  65811. boundingSpheresCV[i2] = geometry.boundingSphereCV;
  65812. if (hasOffset) {
  65813. offsetInstanceExtend[i2] = instance.geometry.offsetAttribute;
  65814. }
  65815. }
  65816. const eastHemisphereGeometry = instance.eastHemisphereGeometry;
  65817. const westHemisphereGeometry = instance.westHemisphereGeometry;
  65818. if (defined_default(eastHemisphereGeometry) && defined_default(westHemisphereGeometry)) {
  65819. if (defined_default(eastHemisphereGeometry.boundingSphere) && defined_default(westHemisphereGeometry.boundingSphere)) {
  65820. boundingSpheres[i2] = BoundingSphere_default.union(
  65821. eastHemisphereGeometry.boundingSphere,
  65822. westHemisphereGeometry.boundingSphere
  65823. );
  65824. }
  65825. if (defined_default(eastHemisphereGeometry.boundingSphereCV) && defined_default(westHemisphereGeometry.boundingSphereCV)) {
  65826. boundingSpheresCV[i2] = BoundingSphere_default.union(
  65827. eastHemisphereGeometry.boundingSphereCV,
  65828. westHemisphereGeometry.boundingSphereCV
  65829. );
  65830. }
  65831. }
  65832. }
  65833. return {
  65834. geometries,
  65835. modelMatrix: parameters.modelMatrix,
  65836. attributeLocations: attributeLocations8,
  65837. pickOffsets,
  65838. offsetInstanceExtend,
  65839. boundingSpheres,
  65840. boundingSpheresCV
  65841. };
  65842. };
  65843. function transferGeometry(geometry, transferableObjects) {
  65844. const attributes = geometry.attributes;
  65845. for (const name in attributes) {
  65846. if (attributes.hasOwnProperty(name)) {
  65847. const attribute = attributes[name];
  65848. if (defined_default(attribute) && defined_default(attribute.values)) {
  65849. transferableObjects.push(attribute.values.buffer);
  65850. }
  65851. }
  65852. }
  65853. if (defined_default(geometry.indices)) {
  65854. transferableObjects.push(geometry.indices.buffer);
  65855. }
  65856. }
  65857. function transferGeometries(geometries, transferableObjects) {
  65858. const length3 = geometries.length;
  65859. for (let i2 = 0; i2 < length3; ++i2) {
  65860. transferGeometry(geometries[i2], transferableObjects);
  65861. }
  65862. }
  65863. function countCreateGeometryResults(items) {
  65864. let count = 1;
  65865. const length3 = items.length;
  65866. for (let i2 = 0; i2 < length3; i2++) {
  65867. const geometry = items[i2];
  65868. ++count;
  65869. if (!defined_default(geometry)) {
  65870. continue;
  65871. }
  65872. const attributes = geometry.attributes;
  65873. count += 7 + 2 * BoundingSphere_default.packedLength + (defined_default(geometry.indices) ? geometry.indices.length : 0);
  65874. for (const property in attributes) {
  65875. if (attributes.hasOwnProperty(property) && defined_default(attributes[property])) {
  65876. const attribute = attributes[property];
  65877. count += 5 + attribute.values.length;
  65878. }
  65879. }
  65880. }
  65881. return count;
  65882. }
  65883. PrimitivePipeline.packCreateGeometryResults = function(items, transferableObjects) {
  65884. const packedData = new Float64Array(countCreateGeometryResults(items));
  65885. const stringTable = [];
  65886. const stringHash = {};
  65887. const length3 = items.length;
  65888. let count = 0;
  65889. packedData[count++] = length3;
  65890. for (let i2 = 0; i2 < length3; i2++) {
  65891. const geometry = items[i2];
  65892. const validGeometry = defined_default(geometry);
  65893. packedData[count++] = validGeometry ? 1 : 0;
  65894. if (!validGeometry) {
  65895. continue;
  65896. }
  65897. packedData[count++] = geometry.primitiveType;
  65898. packedData[count++] = geometry.geometryType;
  65899. packedData[count++] = defaultValue_default(geometry.offsetAttribute, -1);
  65900. const validBoundingSphere = defined_default(geometry.boundingSphere) ? 1 : 0;
  65901. packedData[count++] = validBoundingSphere;
  65902. if (validBoundingSphere) {
  65903. BoundingSphere_default.pack(geometry.boundingSphere, packedData, count);
  65904. }
  65905. count += BoundingSphere_default.packedLength;
  65906. const validBoundingSphereCV = defined_default(geometry.boundingSphereCV) ? 1 : 0;
  65907. packedData[count++] = validBoundingSphereCV;
  65908. if (validBoundingSphereCV) {
  65909. BoundingSphere_default.pack(geometry.boundingSphereCV, packedData, count);
  65910. }
  65911. count += BoundingSphere_default.packedLength;
  65912. const attributes = geometry.attributes;
  65913. const attributesToWrite = [];
  65914. for (const property in attributes) {
  65915. if (attributes.hasOwnProperty(property) && defined_default(attributes[property])) {
  65916. attributesToWrite.push(property);
  65917. if (!defined_default(stringHash[property])) {
  65918. stringHash[property] = stringTable.length;
  65919. stringTable.push(property);
  65920. }
  65921. }
  65922. }
  65923. packedData[count++] = attributesToWrite.length;
  65924. for (let q = 0; q < attributesToWrite.length; q++) {
  65925. const name = attributesToWrite[q];
  65926. const attribute = attributes[name];
  65927. packedData[count++] = stringHash[name];
  65928. packedData[count++] = attribute.componentDatatype;
  65929. packedData[count++] = attribute.componentsPerAttribute;
  65930. packedData[count++] = attribute.normalize ? 1 : 0;
  65931. packedData[count++] = attribute.values.length;
  65932. packedData.set(attribute.values, count);
  65933. count += attribute.values.length;
  65934. }
  65935. const indicesLength = defined_default(geometry.indices) ? geometry.indices.length : 0;
  65936. packedData[count++] = indicesLength;
  65937. if (indicesLength > 0) {
  65938. packedData.set(geometry.indices, count);
  65939. count += indicesLength;
  65940. }
  65941. }
  65942. transferableObjects.push(packedData.buffer);
  65943. return {
  65944. stringTable,
  65945. packedData
  65946. };
  65947. };
  65948. PrimitivePipeline.unpackCreateGeometryResults = function(createGeometryResult) {
  65949. const stringTable = createGeometryResult.stringTable;
  65950. const packedGeometry = createGeometryResult.packedData;
  65951. let i2;
  65952. const result = new Array(packedGeometry[0]);
  65953. let resultIndex = 0;
  65954. let packedGeometryIndex = 1;
  65955. while (packedGeometryIndex < packedGeometry.length) {
  65956. const valid = packedGeometry[packedGeometryIndex++] === 1;
  65957. if (!valid) {
  65958. result[resultIndex++] = void 0;
  65959. continue;
  65960. }
  65961. const primitiveType = packedGeometry[packedGeometryIndex++];
  65962. const geometryType = packedGeometry[packedGeometryIndex++];
  65963. let offsetAttribute = packedGeometry[packedGeometryIndex++];
  65964. if (offsetAttribute === -1) {
  65965. offsetAttribute = void 0;
  65966. }
  65967. let boundingSphere;
  65968. let boundingSphereCV;
  65969. const validBoundingSphere = packedGeometry[packedGeometryIndex++] === 1;
  65970. if (validBoundingSphere) {
  65971. boundingSphere = BoundingSphere_default.unpack(
  65972. packedGeometry,
  65973. packedGeometryIndex
  65974. );
  65975. }
  65976. packedGeometryIndex += BoundingSphere_default.packedLength;
  65977. const validBoundingSphereCV = packedGeometry[packedGeometryIndex++] === 1;
  65978. if (validBoundingSphereCV) {
  65979. boundingSphereCV = BoundingSphere_default.unpack(
  65980. packedGeometry,
  65981. packedGeometryIndex
  65982. );
  65983. }
  65984. packedGeometryIndex += BoundingSphere_default.packedLength;
  65985. let length3;
  65986. let values;
  65987. let componentsPerAttribute;
  65988. const attributes = new GeometryAttributes_default();
  65989. const numAttributes = packedGeometry[packedGeometryIndex++];
  65990. for (i2 = 0; i2 < numAttributes; i2++) {
  65991. const name = stringTable[packedGeometry[packedGeometryIndex++]];
  65992. const componentDatatype = packedGeometry[packedGeometryIndex++];
  65993. componentsPerAttribute = packedGeometry[packedGeometryIndex++];
  65994. const normalize2 = packedGeometry[packedGeometryIndex++] !== 0;
  65995. length3 = packedGeometry[packedGeometryIndex++];
  65996. values = ComponentDatatype_default.createTypedArray(componentDatatype, length3);
  65997. for (let valuesIndex = 0; valuesIndex < length3; valuesIndex++) {
  65998. values[valuesIndex] = packedGeometry[packedGeometryIndex++];
  65999. }
  66000. attributes[name] = new GeometryAttribute_default({
  66001. componentDatatype,
  66002. componentsPerAttribute,
  66003. normalize: normalize2,
  66004. values
  66005. });
  66006. }
  66007. let indices2;
  66008. length3 = packedGeometry[packedGeometryIndex++];
  66009. if (length3 > 0) {
  66010. const numberOfVertices = values.length / componentsPerAttribute;
  66011. indices2 = IndexDatatype_default.createTypedArray(numberOfVertices, length3);
  66012. for (i2 = 0; i2 < length3; i2++) {
  66013. indices2[i2] = packedGeometry[packedGeometryIndex++];
  66014. }
  66015. }
  66016. result[resultIndex++] = new Geometry_default({
  66017. primitiveType,
  66018. geometryType,
  66019. boundingSphere,
  66020. boundingSphereCV,
  66021. indices: indices2,
  66022. attributes,
  66023. offsetAttribute
  66024. });
  66025. }
  66026. return result;
  66027. };
  66028. function packInstancesForCombine(instances, transferableObjects) {
  66029. const length3 = instances.length;
  66030. const packedData = new Float64Array(1 + length3 * 19);
  66031. let count = 0;
  66032. packedData[count++] = length3;
  66033. for (let i2 = 0; i2 < length3; i2++) {
  66034. const instance = instances[i2];
  66035. Matrix4_default.pack(instance.modelMatrix, packedData, count);
  66036. count += Matrix4_default.packedLength;
  66037. if (defined_default(instance.attributes) && defined_default(instance.attributes.offset)) {
  66038. const values = instance.attributes.offset.value;
  66039. packedData[count] = values[0];
  66040. packedData[count + 1] = values[1];
  66041. packedData[count + 2] = values[2];
  66042. }
  66043. count += 3;
  66044. }
  66045. transferableObjects.push(packedData.buffer);
  66046. return packedData;
  66047. }
  66048. function unpackInstancesForCombine(data) {
  66049. const packedInstances = data;
  66050. const result = new Array(packedInstances[0]);
  66051. let count = 0;
  66052. let i2 = 1;
  66053. while (i2 < packedInstances.length) {
  66054. const modelMatrix = Matrix4_default.unpack(packedInstances, i2);
  66055. let attributes;
  66056. i2 += Matrix4_default.packedLength;
  66057. if (defined_default(packedInstances[i2])) {
  66058. attributes = {
  66059. offset: new OffsetGeometryInstanceAttribute_default(
  66060. packedInstances[i2],
  66061. packedInstances[i2 + 1],
  66062. packedInstances[i2 + 2]
  66063. )
  66064. };
  66065. }
  66066. i2 += 3;
  66067. result[count++] = {
  66068. modelMatrix,
  66069. attributes
  66070. };
  66071. }
  66072. return result;
  66073. }
  66074. PrimitivePipeline.packCombineGeometryParameters = function(parameters, transferableObjects) {
  66075. const createGeometryResults = parameters.createGeometryResults;
  66076. const length3 = createGeometryResults.length;
  66077. for (let i2 = 0; i2 < length3; i2++) {
  66078. transferableObjects.push(createGeometryResults[i2].packedData.buffer);
  66079. }
  66080. return {
  66081. createGeometryResults: parameters.createGeometryResults,
  66082. packedInstances: packInstancesForCombine(
  66083. parameters.instances,
  66084. transferableObjects
  66085. ),
  66086. ellipsoid: parameters.ellipsoid,
  66087. isGeographic: parameters.projection instanceof GeographicProjection_default,
  66088. elementIndexUintSupported: parameters.elementIndexUintSupported,
  66089. scene3DOnly: parameters.scene3DOnly,
  66090. vertexCacheOptimize: parameters.vertexCacheOptimize,
  66091. compressVertices: parameters.compressVertices,
  66092. modelMatrix: parameters.modelMatrix,
  66093. createPickOffsets: parameters.createPickOffsets
  66094. };
  66095. };
  66096. PrimitivePipeline.unpackCombineGeometryParameters = function(packedParameters) {
  66097. const instances = unpackInstancesForCombine(packedParameters.packedInstances);
  66098. const createGeometryResults = packedParameters.createGeometryResults;
  66099. const length3 = createGeometryResults.length;
  66100. let instanceIndex = 0;
  66101. for (let resultIndex = 0; resultIndex < length3; resultIndex++) {
  66102. const geometries = PrimitivePipeline.unpackCreateGeometryResults(
  66103. createGeometryResults[resultIndex]
  66104. );
  66105. const geometriesLength = geometries.length;
  66106. for (let geometryIndex = 0; geometryIndex < geometriesLength; geometryIndex++) {
  66107. const geometry = geometries[geometryIndex];
  66108. const instance = instances[instanceIndex];
  66109. instance.geometry = geometry;
  66110. ++instanceIndex;
  66111. }
  66112. }
  66113. const ellipsoid = Ellipsoid_default.clone(packedParameters.ellipsoid);
  66114. const projection = packedParameters.isGeographic ? new GeographicProjection_default(ellipsoid) : new WebMercatorProjection_default(ellipsoid);
  66115. return {
  66116. instances,
  66117. ellipsoid,
  66118. projection,
  66119. elementIndexUintSupported: packedParameters.elementIndexUintSupported,
  66120. scene3DOnly: packedParameters.scene3DOnly,
  66121. vertexCacheOptimize: packedParameters.vertexCacheOptimize,
  66122. compressVertices: packedParameters.compressVertices,
  66123. modelMatrix: Matrix4_default.clone(packedParameters.modelMatrix),
  66124. createPickOffsets: packedParameters.createPickOffsets
  66125. };
  66126. };
  66127. function packBoundingSpheres(boundingSpheres) {
  66128. const length3 = boundingSpheres.length;
  66129. const bufferLength = 1 + (BoundingSphere_default.packedLength + 1) * length3;
  66130. const buffer = new Float32Array(bufferLength);
  66131. let bufferIndex = 0;
  66132. buffer[bufferIndex++] = length3;
  66133. for (let i2 = 0; i2 < length3; ++i2) {
  66134. const bs = boundingSpheres[i2];
  66135. if (!defined_default(bs)) {
  66136. buffer[bufferIndex++] = 0;
  66137. } else {
  66138. buffer[bufferIndex++] = 1;
  66139. BoundingSphere_default.pack(boundingSpheres[i2], buffer, bufferIndex);
  66140. }
  66141. bufferIndex += BoundingSphere_default.packedLength;
  66142. }
  66143. return buffer;
  66144. }
  66145. function unpackBoundingSpheres(buffer) {
  66146. const result = new Array(buffer[0]);
  66147. let count = 0;
  66148. let i2 = 1;
  66149. while (i2 < buffer.length) {
  66150. if (buffer[i2++] === 1) {
  66151. result[count] = BoundingSphere_default.unpack(buffer, i2);
  66152. }
  66153. ++count;
  66154. i2 += BoundingSphere_default.packedLength;
  66155. }
  66156. return result;
  66157. }
  66158. PrimitivePipeline.packCombineGeometryResults = function(results, transferableObjects) {
  66159. if (defined_default(results.geometries)) {
  66160. transferGeometries(results.geometries, transferableObjects);
  66161. }
  66162. const packedBoundingSpheres = packBoundingSpheres(results.boundingSpheres);
  66163. const packedBoundingSpheresCV = packBoundingSpheres(
  66164. results.boundingSpheresCV
  66165. );
  66166. transferableObjects.push(
  66167. packedBoundingSpheres.buffer,
  66168. packedBoundingSpheresCV.buffer
  66169. );
  66170. return {
  66171. geometries: results.geometries,
  66172. attributeLocations: results.attributeLocations,
  66173. modelMatrix: results.modelMatrix,
  66174. pickOffsets: results.pickOffsets,
  66175. offsetInstanceExtend: results.offsetInstanceExtend,
  66176. boundingSpheres: packedBoundingSpheres,
  66177. boundingSpheresCV: packedBoundingSpheresCV
  66178. };
  66179. };
  66180. PrimitivePipeline.unpackCombineGeometryResults = function(packedResult) {
  66181. return {
  66182. geometries: packedResult.geometries,
  66183. attributeLocations: packedResult.attributeLocations,
  66184. modelMatrix: packedResult.modelMatrix,
  66185. pickOffsets: packedResult.pickOffsets,
  66186. offsetInstanceExtend: packedResult.offsetInstanceExtend,
  66187. boundingSpheres: unpackBoundingSpheres(packedResult.boundingSpheres),
  66188. boundingSpheresCV: unpackBoundingSpheres(packedResult.boundingSpheresCV)
  66189. };
  66190. };
  66191. var PrimitivePipeline_default = PrimitivePipeline;
  66192. // node_modules/cesium/Source/Scene/PrimitiveState.js
  66193. var PrimitiveState = {
  66194. READY: 0,
  66195. CREATING: 1,
  66196. CREATED: 2,
  66197. COMBINING: 3,
  66198. COMBINED: 4,
  66199. COMPLETE: 5,
  66200. FAILED: 6
  66201. };
  66202. var PrimitiveState_default = Object.freeze(PrimitiveState);
  66203. // node_modules/cesium/Source/Scene/SceneMode.js
  66204. var SceneMode = {
  66205. MORPHING: 0,
  66206. COLUMBUS_VIEW: 1,
  66207. SCENE2D: 2,
  66208. SCENE3D: 3
  66209. };
  66210. SceneMode.getMorphTime = function(value) {
  66211. if (value === SceneMode.SCENE3D) {
  66212. return 1;
  66213. } else if (value === SceneMode.MORPHING) {
  66214. return void 0;
  66215. }
  66216. return 0;
  66217. };
  66218. var SceneMode_default = Object.freeze(SceneMode);
  66219. // node_modules/cesium/Source/Scene/ShadowMode.js
  66220. var ShadowMode = {
  66221. DISABLED: 0,
  66222. ENABLED: 1,
  66223. CAST_ONLY: 2,
  66224. RECEIVE_ONLY: 3
  66225. };
  66226. ShadowMode.NUMBER_OF_SHADOW_MODES = 4;
  66227. ShadowMode.castShadows = function(shadowMode) {
  66228. return shadowMode === ShadowMode.ENABLED || shadowMode === ShadowMode.CAST_ONLY;
  66229. };
  66230. ShadowMode.receiveShadows = function(shadowMode) {
  66231. return shadowMode === ShadowMode.ENABLED || shadowMode === ShadowMode.RECEIVE_ONLY;
  66232. };
  66233. ShadowMode.fromCastReceive = function(castShadows, receiveShadows) {
  66234. if (castShadows && receiveShadows) {
  66235. return ShadowMode.ENABLED;
  66236. } else if (castShadows) {
  66237. return ShadowMode.CAST_ONLY;
  66238. } else if (receiveShadows) {
  66239. return ShadowMode.RECEIVE_ONLY;
  66240. }
  66241. return ShadowMode.DISABLED;
  66242. };
  66243. var ShadowMode_default = Object.freeze(ShadowMode);
  66244. // node_modules/cesium/Source/Scene/Primitive.js
  66245. function Primitive(options) {
  66246. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  66247. this.geometryInstances = options.geometryInstances;
  66248. this.appearance = options.appearance;
  66249. this._appearance = void 0;
  66250. this._material = void 0;
  66251. this.depthFailAppearance = options.depthFailAppearance;
  66252. this._depthFailAppearance = void 0;
  66253. this._depthFailMaterial = void 0;
  66254. this.modelMatrix = Matrix4_default.clone(
  66255. defaultValue_default(options.modelMatrix, Matrix4_default.IDENTITY)
  66256. );
  66257. this._modelMatrix = new Matrix4_default();
  66258. this.show = defaultValue_default(options.show, true);
  66259. this._vertexCacheOptimize = defaultValue_default(options.vertexCacheOptimize, false);
  66260. this._interleave = defaultValue_default(options.interleave, false);
  66261. this._releaseGeometryInstances = defaultValue_default(
  66262. options.releaseGeometryInstances,
  66263. true
  66264. );
  66265. this._allowPicking = defaultValue_default(options.allowPicking, true);
  66266. this._asynchronous = defaultValue_default(options.asynchronous, true);
  66267. this._compressVertices = defaultValue_default(options.compressVertices, true);
  66268. this.cull = defaultValue_default(options.cull, true);
  66269. this.debugShowBoundingVolume = defaultValue_default(
  66270. options.debugShowBoundingVolume,
  66271. false
  66272. );
  66273. this.rtcCenter = options.rtcCenter;
  66274. if (defined_default(this.rtcCenter) && (!defined_default(this.geometryInstances) || Array.isArray(this.geometryInstances) && this.geometryInstances.length !== 1)) {
  66275. throw new DeveloperError_default(
  66276. "Relative-to-center rendering only supports one geometry instance."
  66277. );
  66278. }
  66279. this.shadows = defaultValue_default(options.shadows, ShadowMode_default.DISABLED);
  66280. this._translucent = void 0;
  66281. this._state = PrimitiveState_default.READY;
  66282. this._geometries = [];
  66283. this._error = void 0;
  66284. this._numberOfInstances = 0;
  66285. this._boundingSpheres = [];
  66286. this._boundingSphereWC = [];
  66287. this._boundingSphereCV = [];
  66288. this._boundingSphere2D = [];
  66289. this._boundingSphereMorph = [];
  66290. this._perInstanceAttributeCache = [];
  66291. this._instanceIds = [];
  66292. this._lastPerInstanceAttributeIndex = 0;
  66293. this._va = [];
  66294. this._attributeLocations = void 0;
  66295. this._primitiveType = void 0;
  66296. this._frontFaceRS = void 0;
  66297. this._backFaceRS = void 0;
  66298. this._sp = void 0;
  66299. this._depthFailAppearance = void 0;
  66300. this._spDepthFail = void 0;
  66301. this._frontFaceDepthFailRS = void 0;
  66302. this._backFaceDepthFailRS = void 0;
  66303. this._pickIds = [];
  66304. this._colorCommands = [];
  66305. this._pickCommands = [];
  66306. this._createBoundingVolumeFunction = options._createBoundingVolumeFunction;
  66307. this._createRenderStatesFunction = options._createRenderStatesFunction;
  66308. this._createShaderProgramFunction = options._createShaderProgramFunction;
  66309. this._createCommandsFunction = options._createCommandsFunction;
  66310. this._updateAndQueueCommandsFunction = options._updateAndQueueCommandsFunction;
  66311. this._createPickOffsets = options._createPickOffsets;
  66312. this._pickOffsets = void 0;
  66313. this._createGeometryResults = void 0;
  66314. this._ready = false;
  66315. this._readyPromise = defer_default();
  66316. this._batchTable = void 0;
  66317. this._batchTableAttributeIndices = void 0;
  66318. this._offsetInstanceExtend = void 0;
  66319. this._batchTableOffsetAttribute2DIndex = void 0;
  66320. this._batchTableOffsetsUpdated = false;
  66321. this._instanceBoundingSpheres = void 0;
  66322. this._instanceBoundingSpheresCV = void 0;
  66323. this._tempBoundingSpheres = void 0;
  66324. this._recomputeBoundingSpheres = false;
  66325. this._batchTableBoundingSpheresUpdated = false;
  66326. this._batchTableBoundingSphereAttributeIndices = void 0;
  66327. }
  66328. Object.defineProperties(Primitive.prototype, {
  66329. vertexCacheOptimize: {
  66330. get: function() {
  66331. return this._vertexCacheOptimize;
  66332. }
  66333. },
  66334. interleave: {
  66335. get: function() {
  66336. return this._interleave;
  66337. }
  66338. },
  66339. releaseGeometryInstances: {
  66340. get: function() {
  66341. return this._releaseGeometryInstances;
  66342. }
  66343. },
  66344. allowPicking: {
  66345. get: function() {
  66346. return this._allowPicking;
  66347. }
  66348. },
  66349. asynchronous: {
  66350. get: function() {
  66351. return this._asynchronous;
  66352. }
  66353. },
  66354. compressVertices: {
  66355. get: function() {
  66356. return this._compressVertices;
  66357. }
  66358. },
  66359. ready: {
  66360. get: function() {
  66361. return this._ready;
  66362. }
  66363. },
  66364. readyPromise: {
  66365. get: function() {
  66366. return this._readyPromise.promise;
  66367. }
  66368. }
  66369. });
  66370. function getCommonPerInstanceAttributeNames(instances) {
  66371. const length3 = instances.length;
  66372. const attributesInAllInstances = [];
  66373. const attributes0 = instances[0].attributes;
  66374. let name;
  66375. for (name in attributes0) {
  66376. if (attributes0.hasOwnProperty(name) && defined_default(attributes0[name])) {
  66377. const attribute = attributes0[name];
  66378. let inAllInstances = true;
  66379. for (let i2 = 1; i2 < length3; ++i2) {
  66380. const otherAttribute = instances[i2].attributes[name];
  66381. if (!defined_default(otherAttribute) || attribute.componentDatatype !== otherAttribute.componentDatatype || attribute.componentsPerAttribute !== otherAttribute.componentsPerAttribute || attribute.normalize !== otherAttribute.normalize) {
  66382. inAllInstances = false;
  66383. break;
  66384. }
  66385. }
  66386. if (inAllInstances) {
  66387. attributesInAllInstances.push(name);
  66388. }
  66389. }
  66390. }
  66391. return attributesInAllInstances;
  66392. }
  66393. var scratchGetAttributeCartesian2 = new Cartesian2_default();
  66394. var scratchGetAttributeCartesian3 = new Cartesian3_default();
  66395. var scratchGetAttributeCartesian42 = new Cartesian4_default();
  66396. function getAttributeValue(value) {
  66397. const componentsPerAttribute = value.length;
  66398. if (componentsPerAttribute === 1) {
  66399. return value[0];
  66400. } else if (componentsPerAttribute === 2) {
  66401. return Cartesian2_default.unpack(value, 0, scratchGetAttributeCartesian2);
  66402. } else if (componentsPerAttribute === 3) {
  66403. return Cartesian3_default.unpack(value, 0, scratchGetAttributeCartesian3);
  66404. } else if (componentsPerAttribute === 4) {
  66405. return Cartesian4_default.unpack(value, 0, scratchGetAttributeCartesian42);
  66406. }
  66407. }
  66408. function createBatchTable(primitive, context) {
  66409. const geometryInstances = primitive.geometryInstances;
  66410. const instances = Array.isArray(geometryInstances) ? geometryInstances : [geometryInstances];
  66411. const numberOfInstances = instances.length;
  66412. if (numberOfInstances === 0) {
  66413. return;
  66414. }
  66415. const names = getCommonPerInstanceAttributeNames(instances);
  66416. const length3 = names.length;
  66417. const attributes = [];
  66418. const attributeIndices = {};
  66419. const boundingSphereAttributeIndices = {};
  66420. let offset2DIndex;
  66421. const firstInstance = instances[0];
  66422. let instanceAttributes = firstInstance.attributes;
  66423. let i2;
  66424. let name;
  66425. let attribute;
  66426. for (i2 = 0; i2 < length3; ++i2) {
  66427. name = names[i2];
  66428. attribute = instanceAttributes[name];
  66429. attributeIndices[name] = i2;
  66430. attributes.push({
  66431. functionName: `czm_batchTable_${name}`,
  66432. componentDatatype: attribute.componentDatatype,
  66433. componentsPerAttribute: attribute.componentsPerAttribute,
  66434. normalize: attribute.normalize
  66435. });
  66436. }
  66437. if (names.indexOf("distanceDisplayCondition") !== -1) {
  66438. attributes.push(
  66439. {
  66440. functionName: "czm_batchTable_boundingSphereCenter3DHigh",
  66441. componentDatatype: ComponentDatatype_default.FLOAT,
  66442. componentsPerAttribute: 3
  66443. },
  66444. {
  66445. functionName: "czm_batchTable_boundingSphereCenter3DLow",
  66446. componentDatatype: ComponentDatatype_default.FLOAT,
  66447. componentsPerAttribute: 3
  66448. },
  66449. {
  66450. functionName: "czm_batchTable_boundingSphereCenter2DHigh",
  66451. componentDatatype: ComponentDatatype_default.FLOAT,
  66452. componentsPerAttribute: 3
  66453. },
  66454. {
  66455. functionName: "czm_batchTable_boundingSphereCenter2DLow",
  66456. componentDatatype: ComponentDatatype_default.FLOAT,
  66457. componentsPerAttribute: 3
  66458. },
  66459. {
  66460. functionName: "czm_batchTable_boundingSphereRadius",
  66461. componentDatatype: ComponentDatatype_default.FLOAT,
  66462. componentsPerAttribute: 1
  66463. }
  66464. );
  66465. boundingSphereAttributeIndices.center3DHigh = attributes.length - 5;
  66466. boundingSphereAttributeIndices.center3DLow = attributes.length - 4;
  66467. boundingSphereAttributeIndices.center2DHigh = attributes.length - 3;
  66468. boundingSphereAttributeIndices.center2DLow = attributes.length - 2;
  66469. boundingSphereAttributeIndices.radius = attributes.length - 1;
  66470. }
  66471. if (names.indexOf("offset") !== -1) {
  66472. attributes.push({
  66473. functionName: "czm_batchTable_offset2D",
  66474. componentDatatype: ComponentDatatype_default.FLOAT,
  66475. componentsPerAttribute: 3
  66476. });
  66477. offset2DIndex = attributes.length - 1;
  66478. }
  66479. attributes.push({
  66480. functionName: "czm_batchTable_pickColor",
  66481. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  66482. componentsPerAttribute: 4,
  66483. normalize: true
  66484. });
  66485. const attributesLength = attributes.length;
  66486. const batchTable = new BatchTable_default(context, attributes, numberOfInstances);
  66487. for (i2 = 0; i2 < numberOfInstances; ++i2) {
  66488. const instance = instances[i2];
  66489. instanceAttributes = instance.attributes;
  66490. for (let j = 0; j < length3; ++j) {
  66491. name = names[j];
  66492. attribute = instanceAttributes[name];
  66493. const value = getAttributeValue(attribute.value);
  66494. const attributeIndex = attributeIndices[name];
  66495. batchTable.setBatchedAttribute(i2, attributeIndex, value);
  66496. }
  66497. const pickObject = {
  66498. primitive: defaultValue_default(instance.pickPrimitive, primitive)
  66499. };
  66500. if (defined_default(instance.id)) {
  66501. pickObject.id = instance.id;
  66502. }
  66503. const pickId = context.createPickId(pickObject);
  66504. primitive._pickIds.push(pickId);
  66505. const pickColor = pickId.color;
  66506. const color = scratchGetAttributeCartesian42;
  66507. color.x = Color_default.floatToByte(pickColor.red);
  66508. color.y = Color_default.floatToByte(pickColor.green);
  66509. color.z = Color_default.floatToByte(pickColor.blue);
  66510. color.w = Color_default.floatToByte(pickColor.alpha);
  66511. batchTable.setBatchedAttribute(i2, attributesLength - 1, color);
  66512. }
  66513. primitive._batchTable = batchTable;
  66514. primitive._batchTableAttributeIndices = attributeIndices;
  66515. primitive._batchTableBoundingSphereAttributeIndices = boundingSphereAttributeIndices;
  66516. primitive._batchTableOffsetAttribute2DIndex = offset2DIndex;
  66517. }
  66518. function cloneAttribute(attribute) {
  66519. let clonedValues;
  66520. if (Array.isArray(attribute.values)) {
  66521. clonedValues = attribute.values.slice(0);
  66522. } else {
  66523. clonedValues = new attribute.values.constructor(attribute.values);
  66524. }
  66525. return new GeometryAttribute_default({
  66526. componentDatatype: attribute.componentDatatype,
  66527. componentsPerAttribute: attribute.componentsPerAttribute,
  66528. normalize: attribute.normalize,
  66529. values: clonedValues
  66530. });
  66531. }
  66532. function cloneGeometry(geometry) {
  66533. const attributes = geometry.attributes;
  66534. const newAttributes = new GeometryAttributes_default();
  66535. for (const property in attributes) {
  66536. if (attributes.hasOwnProperty(property) && defined_default(attributes[property])) {
  66537. newAttributes[property] = cloneAttribute(attributes[property]);
  66538. }
  66539. }
  66540. let indices2;
  66541. if (defined_default(geometry.indices)) {
  66542. const sourceValues = geometry.indices;
  66543. if (Array.isArray(sourceValues)) {
  66544. indices2 = sourceValues.slice(0);
  66545. } else {
  66546. indices2 = new sourceValues.constructor(sourceValues);
  66547. }
  66548. }
  66549. return new Geometry_default({
  66550. attributes: newAttributes,
  66551. indices: indices2,
  66552. primitiveType: geometry.primitiveType,
  66553. boundingSphere: BoundingSphere_default.clone(geometry.boundingSphere)
  66554. });
  66555. }
  66556. function cloneInstance(instance, geometry) {
  66557. return {
  66558. geometry,
  66559. attributes: instance.attributes,
  66560. modelMatrix: Matrix4_default.clone(instance.modelMatrix),
  66561. pickPrimitive: instance.pickPrimitive,
  66562. id: instance.id
  66563. };
  66564. }
  66565. var positionRegex = /attribute\s+vec(?:3|4)\s+(.*)3DHigh;/g;
  66566. Primitive._modifyShaderPosition = function(primitive, vertexShaderSource, scene3DOnly) {
  66567. let match;
  66568. let forwardDecl = "";
  66569. let attributes = "";
  66570. let computeFunctions = "";
  66571. while ((match = positionRegex.exec(vertexShaderSource)) !== null) {
  66572. const name = match[1];
  66573. const functionName = `vec4 czm_compute${name[0].toUpperCase()}${name.substr(
  66574. 1
  66575. )}()`;
  66576. if (functionName !== "vec4 czm_computePosition()") {
  66577. forwardDecl += `${functionName};
  66578. `;
  66579. }
  66580. if (!defined_default(primitive.rtcCenter)) {
  66581. if (!scene3DOnly) {
  66582. attributes += `attribute vec3 ${name}2DHigh;
  66583. attribute vec3 ${name}2DLow;
  66584. `;
  66585. computeFunctions += `${functionName}
  66586. {
  66587. vec4 p;
  66588. if (czm_morphTime == 1.0)
  66589. {
  66590. p = czm_translateRelativeToEye(${name}3DHigh, ${name}3DLow);
  66591. }
  66592. else if (czm_morphTime == 0.0)
  66593. {
  66594. p = czm_translateRelativeToEye(${name}2DHigh.zxy, ${name}2DLow.zxy);
  66595. }
  66596. else
  66597. {
  66598. p = czm_columbusViewMorph(
  66599. czm_translateRelativeToEye(${name}2DHigh.zxy, ${name}2DLow.zxy),
  66600. czm_translateRelativeToEye(${name}3DHigh, ${name}3DLow),
  66601. czm_morphTime);
  66602. }
  66603. return p;
  66604. }
  66605. `;
  66606. } else {
  66607. computeFunctions += `${functionName}
  66608. {
  66609. return czm_translateRelativeToEye(${name}3DHigh, ${name}3DLow);
  66610. }
  66611. `;
  66612. }
  66613. } else {
  66614. vertexShaderSource = vertexShaderSource.replace(
  66615. /attribute\s+vec(?:3|4)\s+position3DHigh;/g,
  66616. ""
  66617. );
  66618. vertexShaderSource = vertexShaderSource.replace(
  66619. /attribute\s+vec(?:3|4)\s+position3DLow;/g,
  66620. ""
  66621. );
  66622. forwardDecl += "uniform mat4 u_modifiedModelView;\n";
  66623. attributes += "attribute vec4 position;\n";
  66624. computeFunctions += `${functionName}
  66625. {
  66626. return u_modifiedModelView * position;
  66627. }
  66628. `;
  66629. vertexShaderSource = vertexShaderSource.replace(
  66630. /czm_modelViewRelativeToEye\s+\*\s+/g,
  66631. ""
  66632. );
  66633. vertexShaderSource = vertexShaderSource.replace(
  66634. /czm_modelViewProjectionRelativeToEye/g,
  66635. "czm_projection"
  66636. );
  66637. }
  66638. }
  66639. return [forwardDecl, attributes, vertexShaderSource, computeFunctions].join(
  66640. "\n"
  66641. );
  66642. };
  66643. Primitive._appendShowToShader = function(primitive, vertexShaderSource) {
  66644. if (!defined_default(primitive._batchTableAttributeIndices.show)) {
  66645. return vertexShaderSource;
  66646. }
  66647. const renamedVS = ShaderSource_default.replaceMain(
  66648. vertexShaderSource,
  66649. "czm_non_show_main"
  66650. );
  66651. const showMain = "void main() \n{ \n czm_non_show_main(); \n gl_Position *= czm_batchTable_show(batchId); \n}";
  66652. return `${renamedVS}
  66653. ${showMain}`;
  66654. };
  66655. Primitive._updateColorAttribute = function(primitive, vertexShaderSource, isDepthFail) {
  66656. if (!defined_default(primitive._batchTableAttributeIndices.color) && !defined_default(primitive._batchTableAttributeIndices.depthFailColor)) {
  66657. return vertexShaderSource;
  66658. }
  66659. if (vertexShaderSource.search(/attribute\s+vec4\s+color;/g) === -1) {
  66660. return vertexShaderSource;
  66661. }
  66662. if (isDepthFail && !defined_default(primitive._batchTableAttributeIndices.depthFailColor)) {
  66663. throw new DeveloperError_default(
  66664. "A depthFailColor per-instance attribute is required when using a depth fail appearance that uses a color attribute."
  66665. );
  66666. }
  66667. let modifiedVS = vertexShaderSource;
  66668. modifiedVS = modifiedVS.replace(/attribute\s+vec4\s+color;/g, "");
  66669. if (!isDepthFail) {
  66670. modifiedVS = modifiedVS.replace(
  66671. /(\b)color(\b)/g,
  66672. "$1czm_batchTable_color(batchId)$2"
  66673. );
  66674. } else {
  66675. modifiedVS = modifiedVS.replace(
  66676. /(\b)color(\b)/g,
  66677. "$1czm_batchTable_depthFailColor(batchId)$2"
  66678. );
  66679. }
  66680. return modifiedVS;
  66681. };
  66682. function appendPickToVertexShader(source) {
  66683. const renamedVS = ShaderSource_default.replaceMain(source, "czm_non_pick_main");
  66684. const pickMain = "varying vec4 v_pickColor; \nvoid main() \n{ \n czm_non_pick_main(); \n v_pickColor = czm_batchTable_pickColor(batchId); \n}";
  66685. return `${renamedVS}
  66686. ${pickMain}`;
  66687. }
  66688. function appendPickToFragmentShader(source) {
  66689. return `varying vec4 v_pickColor;
  66690. ${source}`;
  66691. }
  66692. Primitive._updatePickColorAttribute = function(source) {
  66693. let vsPick = source.replace(/attribute\s+vec4\s+pickColor;/g, "");
  66694. vsPick = vsPick.replace(
  66695. /(\b)pickColor(\b)/g,
  66696. "$1czm_batchTable_pickColor(batchId)$2"
  66697. );
  66698. return vsPick;
  66699. };
  66700. Primitive._appendOffsetToShader = function(primitive, vertexShaderSource) {
  66701. if (!defined_default(primitive._batchTableAttributeIndices.offset)) {
  66702. return vertexShaderSource;
  66703. }
  66704. let attr = "attribute float batchId;\n";
  66705. attr += "attribute float applyOffset;";
  66706. let modifiedShader = vertexShaderSource.replace(
  66707. /attribute\s+float\s+batchId;/g,
  66708. attr
  66709. );
  66710. let str = "vec4 $1 = czm_computePosition();\n";
  66711. str += " if (czm_sceneMode == czm_sceneMode3D)\n";
  66712. str += " {\n";
  66713. str += " $1 = $1 + vec4(czm_batchTable_offset(batchId) * applyOffset, 0.0);";
  66714. str += " }\n";
  66715. str += " else\n";
  66716. str += " {\n";
  66717. str += " $1 = $1 + vec4(czm_batchTable_offset2D(batchId) * applyOffset, 0.0);";
  66718. str += " }\n";
  66719. modifiedShader = modifiedShader.replace(
  66720. /vec4\s+([A-Za-z0-9_]+)\s+=\s+czm_computePosition\(\);/g,
  66721. str
  66722. );
  66723. return modifiedShader;
  66724. };
  66725. Primitive._appendDistanceDisplayConditionToShader = function(primitive, vertexShaderSource, scene3DOnly) {
  66726. if (!defined_default(primitive._batchTableAttributeIndices.distanceDisplayCondition)) {
  66727. return vertexShaderSource;
  66728. }
  66729. const renamedVS = ShaderSource_default.replaceMain(
  66730. vertexShaderSource,
  66731. "czm_non_distanceDisplayCondition_main"
  66732. );
  66733. let distanceDisplayConditionMain = "void main() \n{ \n czm_non_distanceDisplayCondition_main(); \n vec2 distanceDisplayCondition = czm_batchTable_distanceDisplayCondition(batchId);\n vec3 boundingSphereCenter3DHigh = czm_batchTable_boundingSphereCenter3DHigh(batchId);\n vec3 boundingSphereCenter3DLow = czm_batchTable_boundingSphereCenter3DLow(batchId);\n float boundingSphereRadius = czm_batchTable_boundingSphereRadius(batchId);\n";
  66734. if (!scene3DOnly) {
  66735. distanceDisplayConditionMain += " vec3 boundingSphereCenter2DHigh = czm_batchTable_boundingSphereCenter2DHigh(batchId);\n vec3 boundingSphereCenter2DLow = czm_batchTable_boundingSphereCenter2DLow(batchId);\n vec4 centerRTE;\n if (czm_morphTime == 1.0)\n {\n centerRTE = czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow);\n }\n else if (czm_morphTime == 0.0)\n {\n centerRTE = czm_translateRelativeToEye(boundingSphereCenter2DHigh.zxy, boundingSphereCenter2DLow.zxy);\n }\n else\n {\n centerRTE = czm_columbusViewMorph(\n czm_translateRelativeToEye(boundingSphereCenter2DHigh.zxy, boundingSphereCenter2DLow.zxy),\n czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow),\n czm_morphTime);\n }\n";
  66736. } else {
  66737. distanceDisplayConditionMain += " vec4 centerRTE = czm_translateRelativeToEye(boundingSphereCenter3DHigh, boundingSphereCenter3DLow);\n";
  66738. }
  66739. distanceDisplayConditionMain += " float radiusSq = boundingSphereRadius * boundingSphereRadius; \n float distanceSq; \n if (czm_sceneMode == czm_sceneMode2D) \n { \n distanceSq = czm_eyeHeight2D.y - radiusSq; \n } \n else \n { \n distanceSq = dot(centerRTE.xyz, centerRTE.xyz) - radiusSq; \n } \n distanceSq = max(distanceSq, 0.0); \n float nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x; \n float farSq = distanceDisplayCondition.y * distanceDisplayCondition.y; \n float show = (distanceSq >= nearSq && distanceSq <= farSq) ? 1.0 : 0.0; \n gl_Position *= show; \n}";
  66740. return `${renamedVS}
  66741. ${distanceDisplayConditionMain}`;
  66742. };
  66743. function modifyForEncodedNormals(primitive, vertexShaderSource) {
  66744. if (!primitive.compressVertices) {
  66745. return vertexShaderSource;
  66746. }
  66747. const containsNormal = vertexShaderSource.search(/attribute\s+vec3\s+normal;/g) !== -1;
  66748. const containsSt = vertexShaderSource.search(/attribute\s+vec2\s+st;/g) !== -1;
  66749. if (!containsNormal && !containsSt) {
  66750. return vertexShaderSource;
  66751. }
  66752. const containsTangent = vertexShaderSource.search(/attribute\s+vec3\s+tangent;/g) !== -1;
  66753. const containsBitangent = vertexShaderSource.search(/attribute\s+vec3\s+bitangent;/g) !== -1;
  66754. let numComponents = containsSt && containsNormal ? 2 : 1;
  66755. numComponents += containsTangent || containsBitangent ? 1 : 0;
  66756. const type = numComponents > 1 ? `vec${numComponents}` : "float";
  66757. const attributeName = "compressedAttributes";
  66758. const attributeDecl = `attribute ${type} ${attributeName};`;
  66759. let globalDecl = "";
  66760. let decode = "";
  66761. if (containsSt) {
  66762. globalDecl += "vec2 st;\n";
  66763. const stComponent = numComponents > 1 ? `${attributeName}.x` : attributeName;
  66764. decode += ` st = czm_decompressTextureCoordinates(${stComponent});
  66765. `;
  66766. }
  66767. if (containsNormal && containsTangent && containsBitangent) {
  66768. globalDecl += "vec3 normal;\nvec3 tangent;\nvec3 bitangent;\n";
  66769. decode += ` czm_octDecode(${attributeName}.${containsSt ? "yz" : "xy"}, normal, tangent, bitangent);
  66770. `;
  66771. } else {
  66772. if (containsNormal) {
  66773. globalDecl += "vec3 normal;\n";
  66774. decode += ` normal = czm_octDecode(${attributeName}${numComponents > 1 ? `.${containsSt ? "y" : "x"}` : ""});
  66775. `;
  66776. }
  66777. if (containsTangent) {
  66778. globalDecl += "vec3 tangent;\n";
  66779. decode += ` tangent = czm_octDecode(${attributeName}.${containsSt && containsNormal ? "z" : "y"});
  66780. `;
  66781. }
  66782. if (containsBitangent) {
  66783. globalDecl += "vec3 bitangent;\n";
  66784. decode += ` bitangent = czm_octDecode(${attributeName}.${containsSt && containsNormal ? "z" : "y"});
  66785. `;
  66786. }
  66787. }
  66788. let modifiedVS = vertexShaderSource;
  66789. modifiedVS = modifiedVS.replace(/attribute\s+vec3\s+normal;/g, "");
  66790. modifiedVS = modifiedVS.replace(/attribute\s+vec2\s+st;/g, "");
  66791. modifiedVS = modifiedVS.replace(/attribute\s+vec3\s+tangent;/g, "");
  66792. modifiedVS = modifiedVS.replace(/attribute\s+vec3\s+bitangent;/g, "");
  66793. modifiedVS = ShaderSource_default.replaceMain(modifiedVS, "czm_non_compressed_main");
  66794. const compressedMain = `${"void main() \n{ \n"}${decode} czm_non_compressed_main();
  66795. }`;
  66796. return [attributeDecl, globalDecl, modifiedVS, compressedMain].join("\n");
  66797. }
  66798. function depthClampVS(vertexShaderSource) {
  66799. let modifiedVS = ShaderSource_default.replaceMain(
  66800. vertexShaderSource,
  66801. "czm_non_depth_clamp_main"
  66802. );
  66803. modifiedVS += "void main() {\n czm_non_depth_clamp_main();\n gl_Position = czm_depthClamp(gl_Position);}\n";
  66804. return modifiedVS;
  66805. }
  66806. function depthClampFS(fragmentShaderSource) {
  66807. let modifiedFS = ShaderSource_default.replaceMain(
  66808. fragmentShaderSource,
  66809. "czm_non_depth_clamp_main"
  66810. );
  66811. modifiedFS += "void main() {\n czm_non_depth_clamp_main();\n#if defined(GL_EXT_frag_depth)\n #if defined(LOG_DEPTH)\n czm_writeLogDepth();\n #else\n czm_writeDepthClamp();\n #endif\n#endif\n}\n";
  66812. modifiedFS = `${"#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\n"}${modifiedFS}`;
  66813. return modifiedFS;
  66814. }
  66815. function validateShaderMatching(shaderProgram, attributeLocations8) {
  66816. const shaderAttributes = shaderProgram.vertexAttributes;
  66817. for (const name in shaderAttributes) {
  66818. if (shaderAttributes.hasOwnProperty(name)) {
  66819. if (!defined_default(attributeLocations8[name])) {
  66820. throw new DeveloperError_default(
  66821. `Appearance/Geometry mismatch. The appearance requires vertex shader attribute input '${name}', which was not computed as part of the Geometry. Use the appearance's vertexFormat property when constructing the geometry.`
  66822. );
  66823. }
  66824. }
  66825. }
  66826. }
  66827. function getUniformFunction(uniforms, name) {
  66828. return function() {
  66829. return uniforms[name];
  66830. };
  66831. }
  66832. var numberOfCreationWorkers = Math.max(
  66833. FeatureDetection_default.hardwareConcurrency - 1,
  66834. 1
  66835. );
  66836. var createGeometryTaskProcessors;
  66837. var combineGeometryTaskProcessor = new TaskProcessor_default("combineGeometry");
  66838. function loadAsynchronous(primitive, frameState) {
  66839. let instances;
  66840. let geometry;
  66841. let i2;
  66842. let j;
  66843. const instanceIds = primitive._instanceIds;
  66844. if (primitive._state === PrimitiveState_default.READY) {
  66845. instances = Array.isArray(primitive.geometryInstances) ? primitive.geometryInstances : [primitive.geometryInstances];
  66846. const length3 = primitive._numberOfInstances = instances.length;
  66847. const promises = [];
  66848. let subTasks = [];
  66849. for (i2 = 0; i2 < length3; ++i2) {
  66850. geometry = instances[i2].geometry;
  66851. instanceIds.push(instances[i2].id);
  66852. if (!defined_default(geometry._workerName)) {
  66853. throw new DeveloperError_default(
  66854. "_workerName must be defined for asynchronous geometry."
  66855. );
  66856. }
  66857. subTasks.push({
  66858. moduleName: geometry._workerName,
  66859. geometry
  66860. });
  66861. }
  66862. if (!defined_default(createGeometryTaskProcessors)) {
  66863. createGeometryTaskProcessors = new Array(numberOfCreationWorkers);
  66864. for (i2 = 0; i2 < numberOfCreationWorkers; i2++) {
  66865. createGeometryTaskProcessors[i2] = new TaskProcessor_default("createGeometry");
  66866. }
  66867. }
  66868. let subTask;
  66869. subTasks = subdivideArray_default(subTasks, numberOfCreationWorkers);
  66870. for (i2 = 0; i2 < subTasks.length; i2++) {
  66871. let packedLength = 0;
  66872. const workerSubTasks = subTasks[i2];
  66873. const workerSubTasksLength = workerSubTasks.length;
  66874. for (j = 0; j < workerSubTasksLength; ++j) {
  66875. subTask = workerSubTasks[j];
  66876. geometry = subTask.geometry;
  66877. if (defined_default(geometry.constructor.pack)) {
  66878. subTask.offset = packedLength;
  66879. packedLength += defaultValue_default(
  66880. geometry.constructor.packedLength,
  66881. geometry.packedLength
  66882. );
  66883. }
  66884. }
  66885. let subTaskTransferableObjects;
  66886. if (packedLength > 0) {
  66887. const array = new Float64Array(packedLength);
  66888. subTaskTransferableObjects = [array.buffer];
  66889. for (j = 0; j < workerSubTasksLength; ++j) {
  66890. subTask = workerSubTasks[j];
  66891. geometry = subTask.geometry;
  66892. if (defined_default(geometry.constructor.pack)) {
  66893. geometry.constructor.pack(geometry, array, subTask.offset);
  66894. subTask.geometry = array;
  66895. }
  66896. }
  66897. }
  66898. promises.push(
  66899. createGeometryTaskProcessors[i2].scheduleTask(
  66900. {
  66901. subTasks: subTasks[i2]
  66902. },
  66903. subTaskTransferableObjects
  66904. )
  66905. );
  66906. }
  66907. primitive._state = PrimitiveState_default.CREATING;
  66908. Promise.all(promises).then(function(results) {
  66909. primitive._createGeometryResults = results;
  66910. primitive._state = PrimitiveState_default.CREATED;
  66911. }).catch(function(error) {
  66912. setReady(primitive, frameState, PrimitiveState_default.FAILED, error);
  66913. });
  66914. } else if (primitive._state === PrimitiveState_default.CREATED) {
  66915. const transferableObjects = [];
  66916. instances = Array.isArray(primitive.geometryInstances) ? primitive.geometryInstances : [primitive.geometryInstances];
  66917. const scene3DOnly = frameState.scene3DOnly;
  66918. const projection = frameState.mapProjection;
  66919. const promise = combineGeometryTaskProcessor.scheduleTask(
  66920. PrimitivePipeline_default.packCombineGeometryParameters(
  66921. {
  66922. createGeometryResults: primitive._createGeometryResults,
  66923. instances,
  66924. ellipsoid: projection.ellipsoid,
  66925. projection,
  66926. elementIndexUintSupported: frameState.context.elementIndexUint,
  66927. scene3DOnly,
  66928. vertexCacheOptimize: primitive.vertexCacheOptimize,
  66929. compressVertices: primitive.compressVertices,
  66930. modelMatrix: primitive.modelMatrix,
  66931. createPickOffsets: primitive._createPickOffsets
  66932. },
  66933. transferableObjects
  66934. ),
  66935. transferableObjects
  66936. );
  66937. primitive._createGeometryResults = void 0;
  66938. primitive._state = PrimitiveState_default.COMBINING;
  66939. Promise.resolve(promise).then(function(packedResult) {
  66940. const result = PrimitivePipeline_default.unpackCombineGeometryResults(
  66941. packedResult
  66942. );
  66943. primitive._geometries = result.geometries;
  66944. primitive._attributeLocations = result.attributeLocations;
  66945. primitive.modelMatrix = Matrix4_default.clone(
  66946. result.modelMatrix,
  66947. primitive.modelMatrix
  66948. );
  66949. primitive._pickOffsets = result.pickOffsets;
  66950. primitive._offsetInstanceExtend = result.offsetInstanceExtend;
  66951. primitive._instanceBoundingSpheres = result.boundingSpheres;
  66952. primitive._instanceBoundingSpheresCV = result.boundingSpheresCV;
  66953. if (defined_default(primitive._geometries) && primitive._geometries.length > 0) {
  66954. primitive._recomputeBoundingSpheres = true;
  66955. primitive._state = PrimitiveState_default.COMBINED;
  66956. } else {
  66957. setReady(primitive, frameState, PrimitiveState_default.FAILED, void 0);
  66958. }
  66959. }).catch(function(error) {
  66960. setReady(primitive, frameState, PrimitiveState_default.FAILED, error);
  66961. });
  66962. }
  66963. }
  66964. function loadSynchronous(primitive, frameState) {
  66965. const instances = Array.isArray(primitive.geometryInstances) ? primitive.geometryInstances : [primitive.geometryInstances];
  66966. const length3 = primitive._numberOfInstances = instances.length;
  66967. const clonedInstances = new Array(length3);
  66968. const instanceIds = primitive._instanceIds;
  66969. let instance;
  66970. let i2;
  66971. let geometryIndex = 0;
  66972. for (i2 = 0; i2 < length3; i2++) {
  66973. instance = instances[i2];
  66974. const geometry = instance.geometry;
  66975. let createdGeometry;
  66976. if (defined_default(geometry.attributes) && defined_default(geometry.primitiveType)) {
  66977. createdGeometry = cloneGeometry(geometry);
  66978. } else {
  66979. createdGeometry = geometry.constructor.createGeometry(geometry);
  66980. }
  66981. clonedInstances[geometryIndex++] = cloneInstance(instance, createdGeometry);
  66982. instanceIds.push(instance.id);
  66983. }
  66984. clonedInstances.length = geometryIndex;
  66985. const scene3DOnly = frameState.scene3DOnly;
  66986. const projection = frameState.mapProjection;
  66987. const result = PrimitivePipeline_default.combineGeometry({
  66988. instances: clonedInstances,
  66989. ellipsoid: projection.ellipsoid,
  66990. projection,
  66991. elementIndexUintSupported: frameState.context.elementIndexUint,
  66992. scene3DOnly,
  66993. vertexCacheOptimize: primitive.vertexCacheOptimize,
  66994. compressVertices: primitive.compressVertices,
  66995. modelMatrix: primitive.modelMatrix,
  66996. createPickOffsets: primitive._createPickOffsets
  66997. });
  66998. primitive._geometries = result.geometries;
  66999. primitive._attributeLocations = result.attributeLocations;
  67000. primitive.modelMatrix = Matrix4_default.clone(
  67001. result.modelMatrix,
  67002. primitive.modelMatrix
  67003. );
  67004. primitive._pickOffsets = result.pickOffsets;
  67005. primitive._offsetInstanceExtend = result.offsetInstanceExtend;
  67006. primitive._instanceBoundingSpheres = result.boundingSpheres;
  67007. primitive._instanceBoundingSpheresCV = result.boundingSpheresCV;
  67008. if (defined_default(primitive._geometries) && primitive._geometries.length > 0) {
  67009. primitive._recomputeBoundingSpheres = true;
  67010. primitive._state = PrimitiveState_default.COMBINED;
  67011. } else {
  67012. setReady(primitive, frameState, PrimitiveState_default.FAILED, void 0);
  67013. }
  67014. }
  67015. function recomputeBoundingSpheres(primitive, frameState) {
  67016. const offsetIndex = primitive._batchTableAttributeIndices.offset;
  67017. if (!primitive._recomputeBoundingSpheres || !defined_default(offsetIndex)) {
  67018. primitive._recomputeBoundingSpheres = false;
  67019. return;
  67020. }
  67021. let i2;
  67022. const offsetInstanceExtend = primitive._offsetInstanceExtend;
  67023. const boundingSpheres = primitive._instanceBoundingSpheres;
  67024. const length3 = boundingSpheres.length;
  67025. let newBoundingSpheres = primitive._tempBoundingSpheres;
  67026. if (!defined_default(newBoundingSpheres)) {
  67027. newBoundingSpheres = new Array(length3);
  67028. for (i2 = 0; i2 < length3; i2++) {
  67029. newBoundingSpheres[i2] = new BoundingSphere_default();
  67030. }
  67031. primitive._tempBoundingSpheres = newBoundingSpheres;
  67032. }
  67033. for (i2 = 0; i2 < length3; ++i2) {
  67034. let newBS = newBoundingSpheres[i2];
  67035. const offset2 = primitive._batchTable.getBatchedAttribute(
  67036. i2,
  67037. offsetIndex,
  67038. new Cartesian3_default()
  67039. );
  67040. newBS = boundingSpheres[i2].clone(newBS);
  67041. transformBoundingSphere(newBS, offset2, offsetInstanceExtend[i2]);
  67042. }
  67043. const combinedBS = [];
  67044. const combinedWestBS = [];
  67045. const combinedEastBS = [];
  67046. for (i2 = 0; i2 < length3; ++i2) {
  67047. const bs = newBoundingSpheres[i2];
  67048. const minX = bs.center.x - bs.radius;
  67049. if (minX > 0 || BoundingSphere_default.intersectPlane(bs, Plane_default.ORIGIN_ZX_PLANE) !== Intersect_default.INTERSECTING) {
  67050. combinedBS.push(bs);
  67051. } else {
  67052. combinedWestBS.push(bs);
  67053. combinedEastBS.push(bs);
  67054. }
  67055. }
  67056. let resultBS1 = combinedBS[0];
  67057. let resultBS2 = combinedEastBS[0];
  67058. let resultBS3 = combinedWestBS[0];
  67059. for (i2 = 1; i2 < combinedBS.length; i2++) {
  67060. resultBS1 = BoundingSphere_default.union(resultBS1, combinedBS[i2]);
  67061. }
  67062. for (i2 = 1; i2 < combinedEastBS.length; i2++) {
  67063. resultBS2 = BoundingSphere_default.union(resultBS2, combinedEastBS[i2]);
  67064. }
  67065. for (i2 = 1; i2 < combinedWestBS.length; i2++) {
  67066. resultBS3 = BoundingSphere_default.union(resultBS3, combinedWestBS[i2]);
  67067. }
  67068. const result = [];
  67069. if (defined_default(resultBS1)) {
  67070. result.push(resultBS1);
  67071. }
  67072. if (defined_default(resultBS2)) {
  67073. result.push(resultBS2);
  67074. }
  67075. if (defined_default(resultBS3)) {
  67076. result.push(resultBS3);
  67077. }
  67078. for (i2 = 0; i2 < result.length; i2++) {
  67079. const boundingSphere = result[i2].clone(primitive._boundingSpheres[i2]);
  67080. primitive._boundingSpheres[i2] = boundingSphere;
  67081. primitive._boundingSphereCV[i2] = BoundingSphere_default.projectTo2D(
  67082. boundingSphere,
  67083. frameState.mapProjection,
  67084. primitive._boundingSphereCV[i2]
  67085. );
  67086. }
  67087. Primitive._updateBoundingVolumes(
  67088. primitive,
  67089. frameState,
  67090. primitive.modelMatrix,
  67091. true
  67092. );
  67093. primitive._recomputeBoundingSpheres = false;
  67094. }
  67095. var scratchBoundingSphereCenterEncoded = new EncodedCartesian3_default();
  67096. var scratchBoundingSphereCartographic = new Cartographic_default();
  67097. var scratchBoundingSphereCenter2D = new Cartesian3_default();
  67098. var scratchBoundingSphere3 = new BoundingSphere_default();
  67099. function updateBatchTableBoundingSpheres(primitive, frameState) {
  67100. const hasDistanceDisplayCondition = defined_default(
  67101. primitive._batchTableAttributeIndices.distanceDisplayCondition
  67102. );
  67103. if (!hasDistanceDisplayCondition || primitive._batchTableBoundingSpheresUpdated) {
  67104. return;
  67105. }
  67106. const indices2 = primitive._batchTableBoundingSphereAttributeIndices;
  67107. const center3DHighIndex = indices2.center3DHigh;
  67108. const center3DLowIndex = indices2.center3DLow;
  67109. const center2DHighIndex = indices2.center2DHigh;
  67110. const center2DLowIndex = indices2.center2DLow;
  67111. const radiusIndex = indices2.radius;
  67112. const projection = frameState.mapProjection;
  67113. const ellipsoid = projection.ellipsoid;
  67114. const batchTable = primitive._batchTable;
  67115. const boundingSpheres = primitive._instanceBoundingSpheres;
  67116. const length3 = boundingSpheres.length;
  67117. for (let i2 = 0; i2 < length3; ++i2) {
  67118. let boundingSphere = boundingSpheres[i2];
  67119. if (!defined_default(boundingSphere)) {
  67120. continue;
  67121. }
  67122. const modelMatrix = primitive.modelMatrix;
  67123. if (defined_default(modelMatrix)) {
  67124. boundingSphere = BoundingSphere_default.transform(
  67125. boundingSphere,
  67126. modelMatrix,
  67127. scratchBoundingSphere3
  67128. );
  67129. }
  67130. const center = boundingSphere.center;
  67131. const radius = boundingSphere.radius;
  67132. let encodedCenter = EncodedCartesian3_default.fromCartesian(
  67133. center,
  67134. scratchBoundingSphereCenterEncoded
  67135. );
  67136. batchTable.setBatchedAttribute(i2, center3DHighIndex, encodedCenter.high);
  67137. batchTable.setBatchedAttribute(i2, center3DLowIndex, encodedCenter.low);
  67138. if (!frameState.scene3DOnly) {
  67139. const cartographic2 = ellipsoid.cartesianToCartographic(
  67140. center,
  67141. scratchBoundingSphereCartographic
  67142. );
  67143. const center2D = projection.project(
  67144. cartographic2,
  67145. scratchBoundingSphereCenter2D
  67146. );
  67147. encodedCenter = EncodedCartesian3_default.fromCartesian(
  67148. center2D,
  67149. scratchBoundingSphereCenterEncoded
  67150. );
  67151. batchTable.setBatchedAttribute(i2, center2DHighIndex, encodedCenter.high);
  67152. batchTable.setBatchedAttribute(i2, center2DLowIndex, encodedCenter.low);
  67153. }
  67154. batchTable.setBatchedAttribute(i2, radiusIndex, radius);
  67155. }
  67156. primitive._batchTableBoundingSpheresUpdated = true;
  67157. }
  67158. var offsetScratchCartesian = new Cartesian3_default();
  67159. var offsetCenterScratch = new Cartesian3_default();
  67160. function updateBatchTableOffsets(primitive, frameState) {
  67161. const hasOffset = defined_default(primitive._batchTableAttributeIndices.offset);
  67162. if (!hasOffset || primitive._batchTableOffsetsUpdated || frameState.scene3DOnly) {
  67163. return;
  67164. }
  67165. const index2D = primitive._batchTableOffsetAttribute2DIndex;
  67166. const projection = frameState.mapProjection;
  67167. const ellipsoid = projection.ellipsoid;
  67168. const batchTable = primitive._batchTable;
  67169. const boundingSpheres = primitive._instanceBoundingSpheres;
  67170. const length3 = boundingSpheres.length;
  67171. for (let i2 = 0; i2 < length3; ++i2) {
  67172. let boundingSphere = boundingSpheres[i2];
  67173. if (!defined_default(boundingSphere)) {
  67174. continue;
  67175. }
  67176. const offset2 = batchTable.getBatchedAttribute(
  67177. i2,
  67178. primitive._batchTableAttributeIndices.offset
  67179. );
  67180. if (Cartesian3_default.equals(offset2, Cartesian3_default.ZERO)) {
  67181. batchTable.setBatchedAttribute(i2, index2D, Cartesian3_default.ZERO);
  67182. continue;
  67183. }
  67184. const modelMatrix = primitive.modelMatrix;
  67185. if (defined_default(modelMatrix)) {
  67186. boundingSphere = BoundingSphere_default.transform(
  67187. boundingSphere,
  67188. modelMatrix,
  67189. scratchBoundingSphere3
  67190. );
  67191. }
  67192. let center = boundingSphere.center;
  67193. center = ellipsoid.scaleToGeodeticSurface(center, offsetCenterScratch);
  67194. let cartographic2 = ellipsoid.cartesianToCartographic(
  67195. center,
  67196. scratchBoundingSphereCartographic
  67197. );
  67198. const center2D = projection.project(
  67199. cartographic2,
  67200. scratchBoundingSphereCenter2D
  67201. );
  67202. const newPoint = Cartesian3_default.add(offset2, center, offsetScratchCartesian);
  67203. cartographic2 = ellipsoid.cartesianToCartographic(newPoint, cartographic2);
  67204. const newPointProjected = projection.project(
  67205. cartographic2,
  67206. offsetScratchCartesian
  67207. );
  67208. const newVector = Cartesian3_default.subtract(
  67209. newPointProjected,
  67210. center2D,
  67211. offsetScratchCartesian
  67212. );
  67213. const x = newVector.x;
  67214. newVector.x = newVector.z;
  67215. newVector.z = newVector.y;
  67216. newVector.y = x;
  67217. batchTable.setBatchedAttribute(i2, index2D, newVector);
  67218. }
  67219. primitive._batchTableOffsetsUpdated = true;
  67220. }
  67221. function createVertexArray(primitive, frameState) {
  67222. const attributeLocations8 = primitive._attributeLocations;
  67223. const geometries = primitive._geometries;
  67224. const scene3DOnly = frameState.scene3DOnly;
  67225. const context = frameState.context;
  67226. const va = [];
  67227. const length3 = geometries.length;
  67228. for (let i2 = 0; i2 < length3; ++i2) {
  67229. const geometry = geometries[i2];
  67230. va.push(
  67231. VertexArray_default.fromGeometry({
  67232. context,
  67233. geometry,
  67234. attributeLocations: attributeLocations8,
  67235. bufferUsage: BufferUsage_default.STATIC_DRAW,
  67236. interleave: primitive._interleave
  67237. })
  67238. );
  67239. if (defined_default(primitive._createBoundingVolumeFunction)) {
  67240. primitive._createBoundingVolumeFunction(frameState, geometry);
  67241. } else {
  67242. primitive._boundingSpheres.push(
  67243. BoundingSphere_default.clone(geometry.boundingSphere)
  67244. );
  67245. primitive._boundingSphereWC.push(new BoundingSphere_default());
  67246. if (!scene3DOnly) {
  67247. const center = geometry.boundingSphereCV.center;
  67248. const x = center.x;
  67249. const y = center.y;
  67250. const z = center.z;
  67251. center.x = z;
  67252. center.y = x;
  67253. center.z = y;
  67254. primitive._boundingSphereCV.push(
  67255. BoundingSphere_default.clone(geometry.boundingSphereCV)
  67256. );
  67257. primitive._boundingSphere2D.push(new BoundingSphere_default());
  67258. primitive._boundingSphereMorph.push(new BoundingSphere_default());
  67259. }
  67260. }
  67261. }
  67262. primitive._va = va;
  67263. primitive._primitiveType = geometries[0].primitiveType;
  67264. if (primitive.releaseGeometryInstances) {
  67265. primitive.geometryInstances = void 0;
  67266. }
  67267. primitive._geometries = void 0;
  67268. setReady(primitive, frameState, PrimitiveState_default.COMPLETE, void 0);
  67269. }
  67270. function createRenderStates(primitive, context, appearance, twoPasses) {
  67271. let renderState = appearance.getRenderState();
  67272. let rs;
  67273. if (twoPasses) {
  67274. rs = clone_default(renderState, false);
  67275. rs.cull = {
  67276. enabled: true,
  67277. face: CullFace_default.BACK
  67278. };
  67279. primitive._frontFaceRS = RenderState_default.fromCache(rs);
  67280. rs.cull.face = CullFace_default.FRONT;
  67281. primitive._backFaceRS = RenderState_default.fromCache(rs);
  67282. } else {
  67283. primitive._frontFaceRS = RenderState_default.fromCache(renderState);
  67284. primitive._backFaceRS = primitive._frontFaceRS;
  67285. }
  67286. rs = clone_default(renderState, false);
  67287. if (defined_default(primitive._depthFailAppearance)) {
  67288. rs.depthTest.enabled = false;
  67289. }
  67290. if (defined_default(primitive._depthFailAppearance)) {
  67291. renderState = primitive._depthFailAppearance.getRenderState();
  67292. rs = clone_default(renderState, false);
  67293. rs.depthTest.func = DepthFunction_default.GREATER;
  67294. if (twoPasses) {
  67295. rs.cull = {
  67296. enabled: true,
  67297. face: CullFace_default.BACK
  67298. };
  67299. primitive._frontFaceDepthFailRS = RenderState_default.fromCache(rs);
  67300. rs.cull.face = CullFace_default.FRONT;
  67301. primitive._backFaceDepthFailRS = RenderState_default.fromCache(rs);
  67302. } else {
  67303. primitive._frontFaceDepthFailRS = RenderState_default.fromCache(rs);
  67304. primitive._backFaceDepthFailRS = primitive._frontFaceRS;
  67305. }
  67306. }
  67307. }
  67308. function createShaderProgram(primitive, frameState, appearance) {
  67309. const context = frameState.context;
  67310. const attributeLocations8 = primitive._attributeLocations;
  67311. let vs = primitive._batchTable.getVertexShaderCallback()(
  67312. appearance.vertexShaderSource
  67313. );
  67314. vs = Primitive._appendOffsetToShader(primitive, vs);
  67315. vs = Primitive._appendShowToShader(primitive, vs);
  67316. vs = Primitive._appendDistanceDisplayConditionToShader(
  67317. primitive,
  67318. vs,
  67319. frameState.scene3DOnly
  67320. );
  67321. vs = appendPickToVertexShader(vs);
  67322. vs = Primitive._updateColorAttribute(primitive, vs, false);
  67323. vs = modifyForEncodedNormals(primitive, vs);
  67324. vs = Primitive._modifyShaderPosition(primitive, vs, frameState.scene3DOnly);
  67325. let fs = appearance.getFragmentShaderSource();
  67326. fs = appendPickToFragmentShader(fs);
  67327. primitive._sp = ShaderProgram_default.replaceCache({
  67328. context,
  67329. shaderProgram: primitive._sp,
  67330. vertexShaderSource: vs,
  67331. fragmentShaderSource: fs,
  67332. attributeLocations: attributeLocations8
  67333. });
  67334. validateShaderMatching(primitive._sp, attributeLocations8);
  67335. if (defined_default(primitive._depthFailAppearance)) {
  67336. vs = primitive._batchTable.getVertexShaderCallback()(
  67337. primitive._depthFailAppearance.vertexShaderSource
  67338. );
  67339. vs = Primitive._appendShowToShader(primitive, vs);
  67340. vs = Primitive._appendDistanceDisplayConditionToShader(
  67341. primitive,
  67342. vs,
  67343. frameState.scene3DOnly
  67344. );
  67345. vs = appendPickToVertexShader(vs);
  67346. vs = Primitive._updateColorAttribute(primitive, vs, true);
  67347. vs = modifyForEncodedNormals(primitive, vs);
  67348. vs = Primitive._modifyShaderPosition(primitive, vs, frameState.scene3DOnly);
  67349. vs = depthClampVS(vs);
  67350. fs = primitive._depthFailAppearance.getFragmentShaderSource();
  67351. fs = appendPickToFragmentShader(fs);
  67352. fs = depthClampFS(fs);
  67353. primitive._spDepthFail = ShaderProgram_default.replaceCache({
  67354. context,
  67355. shaderProgram: primitive._spDepthFail,
  67356. vertexShaderSource: vs,
  67357. fragmentShaderSource: fs,
  67358. attributeLocations: attributeLocations8
  67359. });
  67360. validateShaderMatching(primitive._spDepthFail, attributeLocations8);
  67361. }
  67362. }
  67363. var modifiedModelViewScratch = new Matrix4_default();
  67364. var rtcScratch = new Cartesian3_default();
  67365. function getUniforms(primitive, appearance, material, frameState) {
  67366. const materialUniformMap = defined_default(material) ? material._uniforms : void 0;
  67367. const appearanceUniformMap = {};
  67368. const appearanceUniforms = appearance.uniforms;
  67369. if (defined_default(appearanceUniforms)) {
  67370. for (const name in appearanceUniforms) {
  67371. if (appearanceUniforms.hasOwnProperty(name)) {
  67372. if (defined_default(materialUniformMap) && defined_default(materialUniformMap[name])) {
  67373. throw new DeveloperError_default(
  67374. `Appearance and material have a uniform with the same name: ${name}`
  67375. );
  67376. }
  67377. appearanceUniformMap[name] = getUniformFunction(
  67378. appearanceUniforms,
  67379. name
  67380. );
  67381. }
  67382. }
  67383. }
  67384. let uniforms = combine_default(appearanceUniformMap, materialUniformMap);
  67385. uniforms = primitive._batchTable.getUniformMapCallback()(uniforms);
  67386. if (defined_default(primitive.rtcCenter)) {
  67387. uniforms.u_modifiedModelView = function() {
  67388. const viewMatrix = frameState.context.uniformState.view;
  67389. Matrix4_default.multiply(
  67390. viewMatrix,
  67391. primitive._modelMatrix,
  67392. modifiedModelViewScratch
  67393. );
  67394. Matrix4_default.multiplyByPoint(
  67395. modifiedModelViewScratch,
  67396. primitive.rtcCenter,
  67397. rtcScratch
  67398. );
  67399. Matrix4_default.setTranslation(
  67400. modifiedModelViewScratch,
  67401. rtcScratch,
  67402. modifiedModelViewScratch
  67403. );
  67404. return modifiedModelViewScratch;
  67405. };
  67406. }
  67407. return uniforms;
  67408. }
  67409. function createCommands(primitive, appearance, material, translucent, twoPasses, colorCommands, pickCommands, frameState) {
  67410. const uniforms = getUniforms(primitive, appearance, material, frameState);
  67411. let depthFailUniforms;
  67412. if (defined_default(primitive._depthFailAppearance)) {
  67413. depthFailUniforms = getUniforms(
  67414. primitive,
  67415. primitive._depthFailAppearance,
  67416. primitive._depthFailAppearance.material,
  67417. frameState
  67418. );
  67419. }
  67420. const pass = translucent ? Pass_default.TRANSLUCENT : Pass_default.OPAQUE;
  67421. let multiplier = twoPasses ? 2 : 1;
  67422. multiplier *= defined_default(primitive._depthFailAppearance) ? 2 : 1;
  67423. colorCommands.length = primitive._va.length * multiplier;
  67424. const length3 = colorCommands.length;
  67425. let vaIndex = 0;
  67426. for (let i2 = 0; i2 < length3; ++i2) {
  67427. let colorCommand;
  67428. if (twoPasses) {
  67429. colorCommand = colorCommands[i2];
  67430. if (!defined_default(colorCommand)) {
  67431. colorCommand = colorCommands[i2] = new DrawCommand_default({
  67432. owner: primitive,
  67433. primitiveType: primitive._primitiveType
  67434. });
  67435. }
  67436. colorCommand.vertexArray = primitive._va[vaIndex];
  67437. colorCommand.renderState = primitive._backFaceRS;
  67438. colorCommand.shaderProgram = primitive._sp;
  67439. colorCommand.uniformMap = uniforms;
  67440. colorCommand.pass = pass;
  67441. ++i2;
  67442. }
  67443. colorCommand = colorCommands[i2];
  67444. if (!defined_default(colorCommand)) {
  67445. colorCommand = colorCommands[i2] = new DrawCommand_default({
  67446. owner: primitive,
  67447. primitiveType: primitive._primitiveType
  67448. });
  67449. }
  67450. colorCommand.vertexArray = primitive._va[vaIndex];
  67451. colorCommand.renderState = primitive._frontFaceRS;
  67452. colorCommand.shaderProgram = primitive._sp;
  67453. colorCommand.uniformMap = uniforms;
  67454. colorCommand.pass = pass;
  67455. if (defined_default(primitive._depthFailAppearance)) {
  67456. if (twoPasses) {
  67457. ++i2;
  67458. colorCommand = colorCommands[i2];
  67459. if (!defined_default(colorCommand)) {
  67460. colorCommand = colorCommands[i2] = new DrawCommand_default({
  67461. owner: primitive,
  67462. primitiveType: primitive._primitiveType
  67463. });
  67464. }
  67465. colorCommand.vertexArray = primitive._va[vaIndex];
  67466. colorCommand.renderState = primitive._backFaceDepthFailRS;
  67467. colorCommand.shaderProgram = primitive._spDepthFail;
  67468. colorCommand.uniformMap = depthFailUniforms;
  67469. colorCommand.pass = pass;
  67470. }
  67471. ++i2;
  67472. colorCommand = colorCommands[i2];
  67473. if (!defined_default(colorCommand)) {
  67474. colorCommand = colorCommands[i2] = new DrawCommand_default({
  67475. owner: primitive,
  67476. primitiveType: primitive._primitiveType
  67477. });
  67478. }
  67479. colorCommand.vertexArray = primitive._va[vaIndex];
  67480. colorCommand.renderState = primitive._frontFaceDepthFailRS;
  67481. colorCommand.shaderProgram = primitive._spDepthFail;
  67482. colorCommand.uniformMap = depthFailUniforms;
  67483. colorCommand.pass = pass;
  67484. }
  67485. ++vaIndex;
  67486. }
  67487. }
  67488. Primitive._updateBoundingVolumes = function(primitive, frameState, modelMatrix, forceUpdate) {
  67489. let i2;
  67490. let length3;
  67491. let boundingSphere;
  67492. if (forceUpdate || !Matrix4_default.equals(modelMatrix, primitive._modelMatrix)) {
  67493. Matrix4_default.clone(modelMatrix, primitive._modelMatrix);
  67494. length3 = primitive._boundingSpheres.length;
  67495. for (i2 = 0; i2 < length3; ++i2) {
  67496. boundingSphere = primitive._boundingSpheres[i2];
  67497. if (defined_default(boundingSphere)) {
  67498. primitive._boundingSphereWC[i2] = BoundingSphere_default.transform(
  67499. boundingSphere,
  67500. modelMatrix,
  67501. primitive._boundingSphereWC[i2]
  67502. );
  67503. if (!frameState.scene3DOnly) {
  67504. primitive._boundingSphere2D[i2] = BoundingSphere_default.clone(
  67505. primitive._boundingSphereCV[i2],
  67506. primitive._boundingSphere2D[i2]
  67507. );
  67508. primitive._boundingSphere2D[i2].center.x = 0;
  67509. primitive._boundingSphereMorph[i2] = BoundingSphere_default.union(
  67510. primitive._boundingSphereWC[i2],
  67511. primitive._boundingSphereCV[i2]
  67512. );
  67513. }
  67514. }
  67515. }
  67516. }
  67517. const pixelSize = primitive.appearance.pixelSize;
  67518. if (defined_default(pixelSize)) {
  67519. length3 = primitive._boundingSpheres.length;
  67520. for (i2 = 0; i2 < length3; ++i2) {
  67521. boundingSphere = primitive._boundingSpheres[i2];
  67522. const boundingSphereWC = primitive._boundingSphereWC[i2];
  67523. const pixelSizeInMeters = frameState.camera.getPixelSize(
  67524. boundingSphere,
  67525. frameState.context.drawingBufferWidth,
  67526. frameState.context.drawingBufferHeight
  67527. );
  67528. const sizeInMeters = pixelSizeInMeters * pixelSize;
  67529. boundingSphereWC.radius = boundingSphere.radius + sizeInMeters;
  67530. }
  67531. }
  67532. };
  67533. function updateAndQueueCommands(primitive, frameState, colorCommands, pickCommands, modelMatrix, cull, debugShowBoundingVolume2, twoPasses) {
  67534. if (frameState.mode !== SceneMode_default.SCENE3D && !Matrix4_default.equals(modelMatrix, Matrix4_default.IDENTITY)) {
  67535. throw new DeveloperError_default(
  67536. "Primitive.modelMatrix is only supported in 3D mode."
  67537. );
  67538. }
  67539. Primitive._updateBoundingVolumes(primitive, frameState, modelMatrix);
  67540. let boundingSpheres;
  67541. if (frameState.mode === SceneMode_default.SCENE3D) {
  67542. boundingSpheres = primitive._boundingSphereWC;
  67543. } else if (frameState.mode === SceneMode_default.COLUMBUS_VIEW) {
  67544. boundingSpheres = primitive._boundingSphereCV;
  67545. } else if (frameState.mode === SceneMode_default.SCENE2D && defined_default(primitive._boundingSphere2D)) {
  67546. boundingSpheres = primitive._boundingSphere2D;
  67547. } else if (defined_default(primitive._boundingSphereMorph)) {
  67548. boundingSpheres = primitive._boundingSphereMorph;
  67549. }
  67550. const commandList = frameState.commandList;
  67551. const passes = frameState.passes;
  67552. if (passes.render || passes.pick) {
  67553. const allowPicking = primitive.allowPicking;
  67554. const castShadows = ShadowMode_default.castShadows(primitive.shadows);
  67555. const receiveShadows = ShadowMode_default.receiveShadows(primitive.shadows);
  67556. const colorLength = colorCommands.length;
  67557. let factor2 = twoPasses ? 2 : 1;
  67558. factor2 *= defined_default(primitive._depthFailAppearance) ? 2 : 1;
  67559. for (let j = 0; j < colorLength; ++j) {
  67560. const sphereIndex = Math.floor(j / factor2);
  67561. const colorCommand = colorCommands[j];
  67562. colorCommand.modelMatrix = modelMatrix;
  67563. colorCommand.boundingVolume = boundingSpheres[sphereIndex];
  67564. colorCommand.cull = cull;
  67565. colorCommand.debugShowBoundingVolume = debugShowBoundingVolume2;
  67566. colorCommand.castShadows = castShadows;
  67567. colorCommand.receiveShadows = receiveShadows;
  67568. if (allowPicking) {
  67569. colorCommand.pickId = "v_pickColor";
  67570. } else {
  67571. colorCommand.pickId = void 0;
  67572. }
  67573. commandList.push(colorCommand);
  67574. }
  67575. }
  67576. }
  67577. Primitive.prototype.update = function(frameState) {
  67578. if (!defined_default(this.geometryInstances) && this._va.length === 0 || defined_default(this.geometryInstances) && Array.isArray(this.geometryInstances) && this.geometryInstances.length === 0 || !defined_default(this.appearance) || frameState.mode !== SceneMode_default.SCENE3D && frameState.scene3DOnly || !frameState.passes.render && !frameState.passes.pick) {
  67579. return;
  67580. }
  67581. if (defined_default(this._error)) {
  67582. throw this._error;
  67583. }
  67584. if (defined_default(this.rtcCenter) && !frameState.scene3DOnly) {
  67585. throw new DeveloperError_default(
  67586. "RTC rendering is only available for 3D only scenes."
  67587. );
  67588. }
  67589. if (this._state === PrimitiveState_default.FAILED) {
  67590. return;
  67591. }
  67592. const context = frameState.context;
  67593. if (!defined_default(this._batchTable)) {
  67594. createBatchTable(this, context);
  67595. }
  67596. if (this._batchTable.attributes.length > 0) {
  67597. if (ContextLimits_default.maximumVertexTextureImageUnits === 0) {
  67598. throw new RuntimeError_default(
  67599. "Vertex texture fetch support is required to render primitives with per-instance attributes. The maximum number of vertex texture image units must be greater than zero."
  67600. );
  67601. }
  67602. this._batchTable.update(frameState);
  67603. }
  67604. if (this._state !== PrimitiveState_default.COMPLETE && this._state !== PrimitiveState_default.COMBINED) {
  67605. if (this.asynchronous) {
  67606. loadAsynchronous(this, frameState);
  67607. } else {
  67608. loadSynchronous(this, frameState);
  67609. }
  67610. }
  67611. if (this._state === PrimitiveState_default.COMBINED) {
  67612. updateBatchTableBoundingSpheres(this, frameState);
  67613. updateBatchTableOffsets(this, frameState);
  67614. createVertexArray(this, frameState);
  67615. }
  67616. if (!this.show || this._state !== PrimitiveState_default.COMPLETE) {
  67617. return;
  67618. }
  67619. if (!this._batchTableOffsetsUpdated) {
  67620. updateBatchTableOffsets(this, frameState);
  67621. }
  67622. if (this._recomputeBoundingSpheres) {
  67623. recomputeBoundingSpheres(this, frameState);
  67624. }
  67625. const appearance = this.appearance;
  67626. const material = appearance.material;
  67627. let createRS = false;
  67628. let createSP = false;
  67629. if (this._appearance !== appearance) {
  67630. this._appearance = appearance;
  67631. this._material = material;
  67632. createRS = true;
  67633. createSP = true;
  67634. } else if (this._material !== material) {
  67635. this._material = material;
  67636. createSP = true;
  67637. }
  67638. const depthFailAppearance = this.depthFailAppearance;
  67639. const depthFailMaterial = defined_default(depthFailAppearance) ? depthFailAppearance.material : void 0;
  67640. if (this._depthFailAppearance !== depthFailAppearance) {
  67641. this._depthFailAppearance = depthFailAppearance;
  67642. this._depthFailMaterial = depthFailMaterial;
  67643. createRS = true;
  67644. createSP = true;
  67645. } else if (this._depthFailMaterial !== depthFailMaterial) {
  67646. this._depthFailMaterial = depthFailMaterial;
  67647. createSP = true;
  67648. }
  67649. const translucent = this._appearance.isTranslucent();
  67650. if (this._translucent !== translucent) {
  67651. this._translucent = translucent;
  67652. createRS = true;
  67653. }
  67654. if (defined_default(this._material)) {
  67655. this._material.update(context);
  67656. }
  67657. const twoPasses = appearance.closed && translucent;
  67658. if (createRS) {
  67659. const rsFunc = defaultValue_default(
  67660. this._createRenderStatesFunction,
  67661. createRenderStates
  67662. );
  67663. rsFunc(this, context, appearance, twoPasses);
  67664. }
  67665. if (createSP) {
  67666. const spFunc = defaultValue_default(
  67667. this._createShaderProgramFunction,
  67668. createShaderProgram
  67669. );
  67670. spFunc(this, frameState, appearance);
  67671. }
  67672. if (createRS || createSP) {
  67673. const commandFunc = defaultValue_default(
  67674. this._createCommandsFunction,
  67675. createCommands
  67676. );
  67677. commandFunc(
  67678. this,
  67679. appearance,
  67680. material,
  67681. translucent,
  67682. twoPasses,
  67683. this._colorCommands,
  67684. this._pickCommands,
  67685. frameState
  67686. );
  67687. }
  67688. const updateAndQueueCommandsFunc = defaultValue_default(
  67689. this._updateAndQueueCommandsFunction,
  67690. updateAndQueueCommands
  67691. );
  67692. updateAndQueueCommandsFunc(
  67693. this,
  67694. frameState,
  67695. this._colorCommands,
  67696. this._pickCommands,
  67697. this.modelMatrix,
  67698. this.cull,
  67699. this.debugShowBoundingVolume,
  67700. twoPasses
  67701. );
  67702. };
  67703. var offsetBoundingSphereScratch1 = new BoundingSphere_default();
  67704. var offsetBoundingSphereScratch2 = new BoundingSphere_default();
  67705. function transformBoundingSphere(boundingSphere, offset2, offsetAttribute) {
  67706. if (offsetAttribute === GeometryOffsetAttribute_default.TOP) {
  67707. const origBS = BoundingSphere_default.clone(
  67708. boundingSphere,
  67709. offsetBoundingSphereScratch1
  67710. );
  67711. const offsetBS = BoundingSphere_default.clone(
  67712. boundingSphere,
  67713. offsetBoundingSphereScratch2
  67714. );
  67715. offsetBS.center = Cartesian3_default.add(offsetBS.center, offset2, offsetBS.center);
  67716. boundingSphere = BoundingSphere_default.union(origBS, offsetBS, boundingSphere);
  67717. } else if (offsetAttribute === GeometryOffsetAttribute_default.ALL) {
  67718. boundingSphere.center = Cartesian3_default.add(
  67719. boundingSphere.center,
  67720. offset2,
  67721. boundingSphere.center
  67722. );
  67723. }
  67724. return boundingSphere;
  67725. }
  67726. function createGetFunction(batchTable, instanceIndex, attributeIndex) {
  67727. return function() {
  67728. const attributeValue = batchTable.getBatchedAttribute(
  67729. instanceIndex,
  67730. attributeIndex
  67731. );
  67732. const attribute = batchTable.attributes[attributeIndex];
  67733. const componentsPerAttribute = attribute.componentsPerAttribute;
  67734. const value = ComponentDatatype_default.createTypedArray(
  67735. attribute.componentDatatype,
  67736. componentsPerAttribute
  67737. );
  67738. if (defined_default(attributeValue.constructor.pack)) {
  67739. attributeValue.constructor.pack(attributeValue, value, 0);
  67740. } else {
  67741. value[0] = attributeValue;
  67742. }
  67743. return value;
  67744. };
  67745. }
  67746. function createSetFunction(batchTable, instanceIndex, attributeIndex, primitive, name) {
  67747. return function(value) {
  67748. if (!defined_default(value) || !defined_default(value.length) || value.length < 1 || value.length > 4) {
  67749. throw new DeveloperError_default(
  67750. "value must be and array with length between 1 and 4."
  67751. );
  67752. }
  67753. const attributeValue = getAttributeValue(value);
  67754. batchTable.setBatchedAttribute(
  67755. instanceIndex,
  67756. attributeIndex,
  67757. attributeValue
  67758. );
  67759. if (name === "offset") {
  67760. primitive._recomputeBoundingSpheres = true;
  67761. primitive._batchTableOffsetsUpdated = false;
  67762. }
  67763. };
  67764. }
  67765. var offsetScratch3 = new Cartesian3_default();
  67766. function createBoundingSphereProperties(primitive, properties, index2) {
  67767. properties.boundingSphere = {
  67768. get: function() {
  67769. let boundingSphere = primitive._instanceBoundingSpheres[index2];
  67770. if (defined_default(boundingSphere)) {
  67771. boundingSphere = boundingSphere.clone();
  67772. const modelMatrix = primitive.modelMatrix;
  67773. const offset2 = properties.offset;
  67774. if (defined_default(offset2)) {
  67775. transformBoundingSphere(
  67776. boundingSphere,
  67777. Cartesian3_default.fromArray(offset2.get(), 0, offsetScratch3),
  67778. primitive._offsetInstanceExtend[index2]
  67779. );
  67780. }
  67781. if (defined_default(modelMatrix)) {
  67782. boundingSphere = BoundingSphere_default.transform(
  67783. boundingSphere,
  67784. modelMatrix
  67785. );
  67786. }
  67787. }
  67788. return boundingSphere;
  67789. }
  67790. };
  67791. properties.boundingSphereCV = {
  67792. get: function() {
  67793. return primitive._instanceBoundingSpheresCV[index2];
  67794. }
  67795. };
  67796. }
  67797. function createPickIdProperty(primitive, properties, index2) {
  67798. properties.pickId = {
  67799. get: function() {
  67800. return primitive._pickIds[index2];
  67801. }
  67802. };
  67803. }
  67804. Primitive.prototype.getGeometryInstanceAttributes = function(id) {
  67805. if (!defined_default(id)) {
  67806. throw new DeveloperError_default("id is required");
  67807. }
  67808. if (!defined_default(this._batchTable)) {
  67809. throw new DeveloperError_default(
  67810. "must call update before calling getGeometryInstanceAttributes"
  67811. );
  67812. }
  67813. let index2 = -1;
  67814. const lastIndex = this._lastPerInstanceAttributeIndex;
  67815. const ids = this._instanceIds;
  67816. const length3 = ids.length;
  67817. for (let i2 = 0; i2 < length3; ++i2) {
  67818. const curIndex = (lastIndex + i2) % length3;
  67819. if (id === ids[curIndex]) {
  67820. index2 = curIndex;
  67821. break;
  67822. }
  67823. }
  67824. if (index2 === -1) {
  67825. return void 0;
  67826. }
  67827. let attributes = this._perInstanceAttributeCache[index2];
  67828. if (defined_default(attributes)) {
  67829. return attributes;
  67830. }
  67831. const batchTable = this._batchTable;
  67832. const perInstanceAttributeIndices = this._batchTableAttributeIndices;
  67833. attributes = {};
  67834. const properties = {};
  67835. for (const name in perInstanceAttributeIndices) {
  67836. if (perInstanceAttributeIndices.hasOwnProperty(name)) {
  67837. const attributeIndex = perInstanceAttributeIndices[name];
  67838. properties[name] = {
  67839. get: createGetFunction(batchTable, index2, attributeIndex),
  67840. set: createSetFunction(batchTable, index2, attributeIndex, this, name)
  67841. };
  67842. }
  67843. }
  67844. createBoundingSphereProperties(this, properties, index2);
  67845. createPickIdProperty(this, properties, index2);
  67846. Object.defineProperties(attributes, properties);
  67847. this._lastPerInstanceAttributeIndex = index2;
  67848. this._perInstanceAttributeCache[index2] = attributes;
  67849. return attributes;
  67850. };
  67851. Primitive.prototype.isDestroyed = function() {
  67852. return false;
  67853. };
  67854. Primitive.prototype.destroy = function() {
  67855. let length3;
  67856. let i2;
  67857. this._sp = this._sp && this._sp.destroy();
  67858. this._spDepthFail = this._spDepthFail && this._spDepthFail.destroy();
  67859. const va = this._va;
  67860. length3 = va.length;
  67861. for (i2 = 0; i2 < length3; ++i2) {
  67862. va[i2].destroy();
  67863. }
  67864. this._va = void 0;
  67865. const pickIds = this._pickIds;
  67866. length3 = pickIds.length;
  67867. for (i2 = 0; i2 < length3; ++i2) {
  67868. pickIds[i2].destroy();
  67869. }
  67870. this._pickIds = void 0;
  67871. this._batchTable = this._batchTable && this._batchTable.destroy();
  67872. this._instanceIds = void 0;
  67873. this._perInstanceAttributeCache = void 0;
  67874. this._attributeLocations = void 0;
  67875. return destroyObject_default(this);
  67876. };
  67877. function setReady(primitive, frameState, state, error) {
  67878. primitive._error = error;
  67879. primitive._state = state;
  67880. frameState.afterRender.push(function() {
  67881. primitive._ready = primitive._state === PrimitiveState_default.COMPLETE || primitive._state === PrimitiveState_default.FAILED;
  67882. if (!defined_default(error)) {
  67883. primitive._readyPromise.resolve(primitive);
  67884. } else {
  67885. primitive._readyPromise.reject(error);
  67886. }
  67887. });
  67888. }
  67889. var Primitive_default = Primitive;
  67890. // node_modules/cesium/Source/Shaders/ShadowVolumeAppearanceFS.js
  67891. var ShadowVolumeAppearanceFS_default = "#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\n\n#ifdef TEXTURE_COORDINATES\n#ifdef SPHERICAL\nvarying vec4 v_sphericalExtents;\n#else // SPHERICAL\nvarying vec2 v_inversePlaneExtents;\nvarying vec4 v_westPlane;\nvarying vec4 v_southPlane;\n#endif // SPHERICAL\nvarying vec3 v_uvMinAndSphericalLongitudeRotation;\nvarying vec3 v_uMaxAndInverseDistance;\nvarying vec3 v_vMaxAndInverseDistance;\n#endif // TEXTURE_COORDINATES\n\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#endif\n\n#ifdef NORMAL_EC\nvec3 getEyeCoordinate3FromWindowCoordinate(vec2 fragCoord, float logDepthOrDepth) {\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(fragCoord, logDepthOrDepth);\n return eyeCoordinate.xyz / eyeCoordinate.w;\n}\n\nvec3 vectorFromOffset(vec4 eyeCoordinate, vec2 positiveOffset) {\n vec2 glFragCoordXY = gl_FragCoord.xy;\n // Sample depths at both offset and negative offset\n float upOrRightLogDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, (glFragCoordXY + positiveOffset) / czm_viewport.zw));\n float downOrLeftLogDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, (glFragCoordXY - positiveOffset) / czm_viewport.zw));\n // Explicitly evaluate both paths\n // Necessary for multifrustum and for edges of the screen\n bvec2 upOrRightInBounds = lessThan(glFragCoordXY + positiveOffset, czm_viewport.zw);\n float useUpOrRight = float(upOrRightLogDepth > 0.0 && upOrRightInBounds.x && upOrRightInBounds.y);\n float useDownOrLeft = float(useUpOrRight == 0.0);\n vec3 upOrRightEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY + positiveOffset, upOrRightLogDepth);\n vec3 downOrLeftEC = getEyeCoordinate3FromWindowCoordinate(glFragCoordXY - positiveOffset, downOrLeftLogDepth);\n return (upOrRightEC - (eyeCoordinate.xyz / eyeCoordinate.w)) * useUpOrRight + ((eyeCoordinate.xyz / eyeCoordinate.w) - downOrLeftEC) * useDownOrLeft;\n}\n#endif // NORMAL_EC\n\nvoid main(void)\n{\n#ifdef REQUIRES_EC\n float logDepthOrDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw));\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\n#endif\n\n#ifdef REQUIRES_WC\n vec4 worldCoordinate4 = czm_inverseView * eyeCoordinate;\n vec3 worldCoordinate = worldCoordinate4.xyz / worldCoordinate4.w;\n#endif\n\n#ifdef TEXTURE_COORDINATES\n vec2 uv;\n#ifdef SPHERICAL\n // Treat world coords as a sphere normal for spherical coordinates\n vec2 sphericalLatLong = czm_approximateSphericalCoordinates(worldCoordinate);\n sphericalLatLong.y += v_uvMinAndSphericalLongitudeRotation.z;\n sphericalLatLong.y = czm_branchFreeTernary(sphericalLatLong.y < czm_pi, sphericalLatLong.y, sphericalLatLong.y - czm_twoPi);\n uv.x = (sphericalLatLong.y - v_sphericalExtents.y) * v_sphericalExtents.w;\n uv.y = (sphericalLatLong.x - v_sphericalExtents.x) * v_sphericalExtents.z;\n#else // SPHERICAL\n // Unpack planes and transform to eye space\n uv.x = czm_planeDistance(v_westPlane, eyeCoordinate.xyz / eyeCoordinate.w) * v_inversePlaneExtents.x;\n uv.y = czm_planeDistance(v_southPlane, eyeCoordinate.xyz / eyeCoordinate.w) * v_inversePlaneExtents.y;\n#endif // SPHERICAL\n#endif // TEXTURE_COORDINATES\n\n#ifdef PICK\n#ifdef CULL_FRAGMENTS\n // When classifying translucent geometry, logDepthOrDepth == 0.0\n // indicates a region that should not be classified, possibly due to there\n // being opaque pixels there in another buffer.\n // Check for logDepthOrDepth != 0.0 to make sure this should be classified.\n if (0.0 <= uv.x && uv.x <= 1.0 && 0.0 <= uv.y && uv.y <= 1.0 || logDepthOrDepth != 0.0) {\n gl_FragColor.a = 1.0; // 0.0 alpha leads to discard from ShaderSource.createPickFragmentShaderSource\n czm_writeDepthClamp();\n }\n#else // CULL_FRAGMENTS\n gl_FragColor.a = 1.0;\n#endif // CULL_FRAGMENTS\n#else // PICK\n\n#ifdef CULL_FRAGMENTS\n // When classifying translucent geometry, logDepthOrDepth == 0.0\n // indicates a region that should not be classified, possibly due to there\n // being opaque pixels there in another buffer.\n if (uv.x <= 0.0 || 1.0 <= uv.x || uv.y <= 0.0 || 1.0 <= uv.y || logDepthOrDepth == 0.0) {\n discard;\n }\n#endif\n\n#ifdef NORMAL_EC\n // Compute normal by sampling adjacent pixels in 2x2 block in screen space\n vec3 downUp = vectorFromOffset(eyeCoordinate, vec2(0.0, 1.0));\n vec3 leftRight = vectorFromOffset(eyeCoordinate, vec2(1.0, 0.0));\n vec3 normalEC = normalize(cross(leftRight, downUp));\n#endif\n\n\n#ifdef PER_INSTANCE_COLOR\n\n vec4 color = czm_gammaCorrect(v_color);\n#ifdef FLAT\n gl_FragColor = color;\n#else // FLAT\n czm_materialInput materialInput;\n materialInput.normalEC = normalEC;\n materialInput.positionToEyeEC = -eyeCoordinate.xyz;\n czm_material material = czm_getDefaultMaterial(materialInput);\n material.diffuse = color.rgb;\n material.alpha = color.a;\n\n gl_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC);\n#endif // FLAT\n\n // Premultiply alpha. Required for classification primitives on translucent globe.\n gl_FragColor.rgb *= gl_FragColor.a;\n\n#else // PER_INSTANCE_COLOR\n\n // Material support.\n // USES_ is distinct from REQUIRES_, because some things are dependencies of each other or\n // dependencies for culling but might not actually be used by the material.\n\n czm_materialInput materialInput;\n\n#ifdef USES_NORMAL_EC\n materialInput.normalEC = normalEC;\n#endif\n\n#ifdef USES_POSITION_TO_EYE_EC\n materialInput.positionToEyeEC = -eyeCoordinate.xyz;\n#endif\n\n#ifdef USES_TANGENT_TO_EYE\n materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(worldCoordinate, normalEC);\n#endif\n\n#ifdef USES_ST\n // Remap texture coordinates from computed (approximately aligned with cartographic space) to the desired\n // texture coordinate system, which typically forms a tight oriented bounding box around the geometry.\n // Shader is provided a set of reference points for remapping.\n materialInput.st.x = czm_lineDistance(v_uvMinAndSphericalLongitudeRotation.xy, v_uMaxAndInverseDistance.xy, uv) * v_uMaxAndInverseDistance.z;\n materialInput.st.y = czm_lineDistance(v_uvMinAndSphericalLongitudeRotation.xy, v_vMaxAndInverseDistance.xy, uv) * v_vMaxAndInverseDistance.z;\n#endif\n\n czm_material material = czm_getMaterial(materialInput);\n\n#ifdef FLAT\n gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else // FLAT\n gl_FragColor = czm_phong(normalize(-eyeCoordinate.xyz), material, czm_lightDirectionEC);\n#endif // FLAT\n\n // Premultiply alpha. Required for classification primitives on translucent globe.\n gl_FragColor.rgb *= gl_FragColor.a;\n\n#endif // PER_INSTANCE_COLOR\n czm_writeDepthClamp();\n#endif // PICK\n}\n";
  67892. // node_modules/cesium/Source/Scene/ShadowVolumeAppearance.js
  67893. function ShadowVolumeAppearance(extentsCulling, planarExtents, appearance) {
  67894. Check_default.typeOf.bool("extentsCulling", extentsCulling);
  67895. Check_default.typeOf.bool("planarExtents", planarExtents);
  67896. Check_default.typeOf.object("appearance", appearance);
  67897. this._projectionExtentDefines = {
  67898. eastMostYhighDefine: "",
  67899. eastMostYlowDefine: "",
  67900. westMostYhighDefine: "",
  67901. westMostYlowDefine: ""
  67902. };
  67903. const colorShaderDependencies = new ShaderDependencies();
  67904. colorShaderDependencies.requiresTextureCoordinates = extentsCulling;
  67905. colorShaderDependencies.requiresEC = !appearance.flat;
  67906. const pickShaderDependencies = new ShaderDependencies();
  67907. pickShaderDependencies.requiresTextureCoordinates = extentsCulling;
  67908. if (appearance instanceof PerInstanceColorAppearance_default) {
  67909. colorShaderDependencies.requiresNormalEC = !appearance.flat;
  67910. } else {
  67911. const materialShaderSource = `${appearance.material.shaderSource}
  67912. ${appearance.fragmentShaderSource}`;
  67913. colorShaderDependencies.normalEC = materialShaderSource.indexOf("materialInput.normalEC") !== -1 || materialShaderSource.indexOf("czm_getDefaultMaterial") !== -1;
  67914. colorShaderDependencies.positionToEyeEC = materialShaderSource.indexOf("materialInput.positionToEyeEC") !== -1;
  67915. colorShaderDependencies.tangentToEyeMatrix = materialShaderSource.indexOf("materialInput.tangentToEyeMatrix") !== -1;
  67916. colorShaderDependencies.st = materialShaderSource.indexOf("materialInput.st") !== -1;
  67917. }
  67918. this._colorShaderDependencies = colorShaderDependencies;
  67919. this._pickShaderDependencies = pickShaderDependencies;
  67920. this._appearance = appearance;
  67921. this._extentsCulling = extentsCulling;
  67922. this._planarExtents = planarExtents;
  67923. }
  67924. ShadowVolumeAppearance.prototype.createFragmentShader = function(columbusView2D) {
  67925. Check_default.typeOf.bool("columbusView2D", columbusView2D);
  67926. const appearance = this._appearance;
  67927. const dependencies = this._colorShaderDependencies;
  67928. const defines = [];
  67929. if (!columbusView2D && !this._planarExtents) {
  67930. defines.push("SPHERICAL");
  67931. }
  67932. if (dependencies.requiresEC) {
  67933. defines.push("REQUIRES_EC");
  67934. }
  67935. if (dependencies.requiresWC) {
  67936. defines.push("REQUIRES_WC");
  67937. }
  67938. if (dependencies.requiresTextureCoordinates) {
  67939. defines.push("TEXTURE_COORDINATES");
  67940. }
  67941. if (this._extentsCulling) {
  67942. defines.push("CULL_FRAGMENTS");
  67943. }
  67944. if (dependencies.requiresNormalEC) {
  67945. defines.push("NORMAL_EC");
  67946. }
  67947. if (appearance instanceof PerInstanceColorAppearance_default) {
  67948. defines.push("PER_INSTANCE_COLOR");
  67949. }
  67950. if (dependencies.normalEC) {
  67951. defines.push("USES_NORMAL_EC");
  67952. }
  67953. if (dependencies.positionToEyeEC) {
  67954. defines.push("USES_POSITION_TO_EYE_EC");
  67955. }
  67956. if (dependencies.tangentToEyeMatrix) {
  67957. defines.push("USES_TANGENT_TO_EYE");
  67958. }
  67959. if (dependencies.st) {
  67960. defines.push("USES_ST");
  67961. }
  67962. if (appearance.flat) {
  67963. defines.push("FLAT");
  67964. }
  67965. let materialSource = "";
  67966. if (!(appearance instanceof PerInstanceColorAppearance_default)) {
  67967. materialSource = appearance.material.shaderSource;
  67968. }
  67969. return new ShaderSource_default({
  67970. defines,
  67971. sources: [materialSource, ShadowVolumeAppearanceFS_default]
  67972. });
  67973. };
  67974. ShadowVolumeAppearance.prototype.createPickFragmentShader = function(columbusView2D) {
  67975. Check_default.typeOf.bool("columbusView2D", columbusView2D);
  67976. const dependencies = this._pickShaderDependencies;
  67977. const defines = ["PICK"];
  67978. if (!columbusView2D && !this._planarExtents) {
  67979. defines.push("SPHERICAL");
  67980. }
  67981. if (dependencies.requiresEC) {
  67982. defines.push("REQUIRES_EC");
  67983. }
  67984. if (dependencies.requiresWC) {
  67985. defines.push("REQUIRES_WC");
  67986. }
  67987. if (dependencies.requiresTextureCoordinates) {
  67988. defines.push("TEXTURE_COORDINATES");
  67989. }
  67990. if (this._extentsCulling) {
  67991. defines.push("CULL_FRAGMENTS");
  67992. }
  67993. return new ShaderSource_default({
  67994. defines,
  67995. sources: [ShadowVolumeAppearanceFS_default],
  67996. pickColorQualifier: "varying"
  67997. });
  67998. };
  67999. ShadowVolumeAppearance.prototype.createVertexShader = function(defines, vertexShaderSource, columbusView2D, mapProjection) {
  68000. Check_default.defined("defines", defines);
  68001. Check_default.typeOf.string("vertexShaderSource", vertexShaderSource);
  68002. Check_default.typeOf.bool("columbusView2D", columbusView2D);
  68003. Check_default.defined("mapProjection", mapProjection);
  68004. return createShadowVolumeAppearanceVS(
  68005. this._colorShaderDependencies,
  68006. this._planarExtents,
  68007. columbusView2D,
  68008. defines,
  68009. vertexShaderSource,
  68010. this._appearance,
  68011. mapProjection,
  68012. this._projectionExtentDefines
  68013. );
  68014. };
  68015. ShadowVolumeAppearance.prototype.createPickVertexShader = function(defines, vertexShaderSource, columbusView2D, mapProjection) {
  68016. Check_default.defined("defines", defines);
  68017. Check_default.typeOf.string("vertexShaderSource", vertexShaderSource);
  68018. Check_default.typeOf.bool("columbusView2D", columbusView2D);
  68019. Check_default.defined("mapProjection", mapProjection);
  68020. return createShadowVolumeAppearanceVS(
  68021. this._pickShaderDependencies,
  68022. this._planarExtents,
  68023. columbusView2D,
  68024. defines,
  68025. vertexShaderSource,
  68026. void 0,
  68027. mapProjection,
  68028. this._projectionExtentDefines
  68029. );
  68030. };
  68031. var longitudeExtentsCartesianScratch = new Cartesian3_default();
  68032. var longitudeExtentsCartographicScratch = new Cartographic_default();
  68033. var longitudeExtentsEncodeScratch = {
  68034. high: 0,
  68035. low: 0
  68036. };
  68037. function createShadowVolumeAppearanceVS(shaderDependencies, planarExtents, columbusView2D, defines, vertexShaderSource, appearance, mapProjection, projectionExtentDefines) {
  68038. const allDefines = defines.slice();
  68039. if (projectionExtentDefines.eastMostYhighDefine === "") {
  68040. const eastMostCartographic = longitudeExtentsCartographicScratch;
  68041. eastMostCartographic.longitude = Math_default.PI;
  68042. eastMostCartographic.latitude = 0;
  68043. eastMostCartographic.height = 0;
  68044. const eastMostCartesian = mapProjection.project(
  68045. eastMostCartographic,
  68046. longitudeExtentsCartesianScratch
  68047. );
  68048. let encoded = EncodedCartesian3_default.encode(
  68049. eastMostCartesian.x,
  68050. longitudeExtentsEncodeScratch
  68051. );
  68052. projectionExtentDefines.eastMostYhighDefine = `EAST_MOST_X_HIGH ${encoded.high.toFixed(
  68053. `${encoded.high}`.length + 1
  68054. )}`;
  68055. projectionExtentDefines.eastMostYlowDefine = `EAST_MOST_X_LOW ${encoded.low.toFixed(
  68056. `${encoded.low}`.length + 1
  68057. )}`;
  68058. const westMostCartographic = longitudeExtentsCartographicScratch;
  68059. westMostCartographic.longitude = -Math_default.PI;
  68060. westMostCartographic.latitude = 0;
  68061. westMostCartographic.height = 0;
  68062. const westMostCartesian = mapProjection.project(
  68063. westMostCartographic,
  68064. longitudeExtentsCartesianScratch
  68065. );
  68066. encoded = EncodedCartesian3_default.encode(
  68067. westMostCartesian.x,
  68068. longitudeExtentsEncodeScratch
  68069. );
  68070. projectionExtentDefines.westMostYhighDefine = `WEST_MOST_X_HIGH ${encoded.high.toFixed(
  68071. `${encoded.high}`.length + 1
  68072. )}`;
  68073. projectionExtentDefines.westMostYlowDefine = `WEST_MOST_X_LOW ${encoded.low.toFixed(
  68074. `${encoded.low}`.length + 1
  68075. )}`;
  68076. }
  68077. if (columbusView2D) {
  68078. allDefines.push(projectionExtentDefines.eastMostYhighDefine);
  68079. allDefines.push(projectionExtentDefines.eastMostYlowDefine);
  68080. allDefines.push(projectionExtentDefines.westMostYhighDefine);
  68081. allDefines.push(projectionExtentDefines.westMostYlowDefine);
  68082. }
  68083. if (defined_default(appearance) && appearance instanceof PerInstanceColorAppearance_default) {
  68084. allDefines.push("PER_INSTANCE_COLOR");
  68085. }
  68086. if (shaderDependencies.requiresTextureCoordinates) {
  68087. allDefines.push("TEXTURE_COORDINATES");
  68088. if (!(planarExtents || columbusView2D)) {
  68089. allDefines.push("SPHERICAL");
  68090. }
  68091. if (columbusView2D) {
  68092. allDefines.push("COLUMBUS_VIEW_2D");
  68093. }
  68094. }
  68095. return new ShaderSource_default({
  68096. defines: allDefines,
  68097. sources: [vertexShaderSource]
  68098. });
  68099. }
  68100. function ShaderDependencies() {
  68101. this._requiresEC = false;
  68102. this._requiresWC = false;
  68103. this._requiresNormalEC = false;
  68104. this._requiresTextureCoordinates = false;
  68105. this._usesNormalEC = false;
  68106. this._usesPositionToEyeEC = false;
  68107. this._usesTangentToEyeMat = false;
  68108. this._usesSt = false;
  68109. }
  68110. Object.defineProperties(ShaderDependencies.prototype, {
  68111. requiresEC: {
  68112. get: function() {
  68113. return this._requiresEC;
  68114. },
  68115. set: function(value) {
  68116. this._requiresEC = value || this._requiresEC;
  68117. }
  68118. },
  68119. requiresWC: {
  68120. get: function() {
  68121. return this._requiresWC;
  68122. },
  68123. set: function(value) {
  68124. this._requiresWC = value || this._requiresWC;
  68125. this.requiresEC = this._requiresWC;
  68126. }
  68127. },
  68128. requiresNormalEC: {
  68129. get: function() {
  68130. return this._requiresNormalEC;
  68131. },
  68132. set: function(value) {
  68133. this._requiresNormalEC = value || this._requiresNormalEC;
  68134. this.requiresEC = this._requiresNormalEC;
  68135. }
  68136. },
  68137. requiresTextureCoordinates: {
  68138. get: function() {
  68139. return this._requiresTextureCoordinates;
  68140. },
  68141. set: function(value) {
  68142. this._requiresTextureCoordinates = value || this._requiresTextureCoordinates;
  68143. this.requiresWC = this._requiresTextureCoordinates;
  68144. }
  68145. },
  68146. normalEC: {
  68147. set: function(value) {
  68148. this.requiresNormalEC = value;
  68149. this._usesNormalEC = value;
  68150. },
  68151. get: function() {
  68152. return this._usesNormalEC;
  68153. }
  68154. },
  68155. tangentToEyeMatrix: {
  68156. set: function(value) {
  68157. this.requiresWC = value;
  68158. this.requiresNormalEC = value;
  68159. this._usesTangentToEyeMat = value;
  68160. },
  68161. get: function() {
  68162. return this._usesTangentToEyeMat;
  68163. }
  68164. },
  68165. positionToEyeEC: {
  68166. set: function(value) {
  68167. this.requiresEC = value;
  68168. this._usesPositionToEyeEC = value;
  68169. },
  68170. get: function() {
  68171. return this._usesPositionToEyeEC;
  68172. }
  68173. },
  68174. st: {
  68175. set: function(value) {
  68176. this.requiresTextureCoordinates = value;
  68177. this._usesSt = value;
  68178. },
  68179. get: function() {
  68180. return this._usesSt;
  68181. }
  68182. }
  68183. });
  68184. function pointLineDistance(point1, point2, point) {
  68185. return Math.abs(
  68186. (point2.y - point1.y) * point.x - (point2.x - point1.x) * point.y + point2.x * point1.y - point2.y * point1.x
  68187. ) / Cartesian2_default.distance(point2, point1);
  68188. }
  68189. var points2DScratch3 = [
  68190. new Cartesian2_default(),
  68191. new Cartesian2_default(),
  68192. new Cartesian2_default(),
  68193. new Cartesian2_default()
  68194. ];
  68195. function addTextureCoordinateRotationAttributes(attributes, textureCoordinateRotationPoints4) {
  68196. const points2D = points2DScratch3;
  68197. const minXYCorner = Cartesian2_default.unpack(
  68198. textureCoordinateRotationPoints4,
  68199. 0,
  68200. points2D[0]
  68201. );
  68202. const maxYCorner = Cartesian2_default.unpack(
  68203. textureCoordinateRotationPoints4,
  68204. 2,
  68205. points2D[1]
  68206. );
  68207. const maxXCorner = Cartesian2_default.unpack(
  68208. textureCoordinateRotationPoints4,
  68209. 4,
  68210. points2D[2]
  68211. );
  68212. attributes.uMaxVmax = new GeometryInstanceAttribute_default({
  68213. componentDatatype: ComponentDatatype_default.FLOAT,
  68214. componentsPerAttribute: 4,
  68215. normalize: false,
  68216. value: [maxYCorner.x, maxYCorner.y, maxXCorner.x, maxXCorner.y]
  68217. });
  68218. const inverseExtentX = 1 / pointLineDistance(minXYCorner, maxYCorner, maxXCorner);
  68219. const inverseExtentY = 1 / pointLineDistance(minXYCorner, maxXCorner, maxYCorner);
  68220. attributes.uvMinAndExtents = new GeometryInstanceAttribute_default({
  68221. componentDatatype: ComponentDatatype_default.FLOAT,
  68222. componentsPerAttribute: 4,
  68223. normalize: false,
  68224. value: [minXYCorner.x, minXYCorner.y, inverseExtentX, inverseExtentY]
  68225. });
  68226. }
  68227. var cartographicScratch2 = new Cartographic_default();
  68228. var cornerScratch = new Cartesian3_default();
  68229. var northWestScratch = new Cartesian3_default();
  68230. var southEastScratch = new Cartesian3_default();
  68231. var highLowScratch = { high: 0, low: 0 };
  68232. function add2DTextureCoordinateAttributes(rectangle, projection, attributes) {
  68233. const carto = cartographicScratch2;
  68234. carto.height = 0;
  68235. carto.longitude = rectangle.west;
  68236. carto.latitude = rectangle.south;
  68237. const southWestCorner = projection.project(carto, cornerScratch);
  68238. carto.latitude = rectangle.north;
  68239. const northWest = projection.project(carto, northWestScratch);
  68240. carto.longitude = rectangle.east;
  68241. carto.latitude = rectangle.south;
  68242. const southEast = projection.project(carto, southEastScratch);
  68243. const valuesHigh = [0, 0, 0, 0];
  68244. const valuesLow = [0, 0, 0, 0];
  68245. let encoded = EncodedCartesian3_default.encode(southWestCorner.x, highLowScratch);
  68246. valuesHigh[0] = encoded.high;
  68247. valuesLow[0] = encoded.low;
  68248. encoded = EncodedCartesian3_default.encode(southWestCorner.y, highLowScratch);
  68249. valuesHigh[1] = encoded.high;
  68250. valuesLow[1] = encoded.low;
  68251. encoded = EncodedCartesian3_default.encode(northWest.y, highLowScratch);
  68252. valuesHigh[2] = encoded.high;
  68253. valuesLow[2] = encoded.low;
  68254. encoded = EncodedCartesian3_default.encode(southEast.x, highLowScratch);
  68255. valuesHigh[3] = encoded.high;
  68256. valuesLow[3] = encoded.low;
  68257. attributes.planes2D_HIGH = new GeometryInstanceAttribute_default({
  68258. componentDatatype: ComponentDatatype_default.FLOAT,
  68259. componentsPerAttribute: 4,
  68260. normalize: false,
  68261. value: valuesHigh
  68262. });
  68263. attributes.planes2D_LOW = new GeometryInstanceAttribute_default({
  68264. componentDatatype: ComponentDatatype_default.FLOAT,
  68265. componentsPerAttribute: 4,
  68266. normalize: false,
  68267. value: valuesLow
  68268. });
  68269. }
  68270. var enuMatrixScratch = new Matrix4_default();
  68271. var inverseEnuScratch = new Matrix4_default();
  68272. var rectanglePointCartesianScratch = new Cartesian3_default();
  68273. var rectangleCenterScratch3 = new Cartographic_default();
  68274. var pointsCartographicScratch = [
  68275. new Cartographic_default(),
  68276. new Cartographic_default(),
  68277. new Cartographic_default(),
  68278. new Cartographic_default(),
  68279. new Cartographic_default(),
  68280. new Cartographic_default(),
  68281. new Cartographic_default(),
  68282. new Cartographic_default()
  68283. ];
  68284. function computeRectangleBounds(rectangle, ellipsoid, height, southWestCornerResult, eastVectorResult, northVectorResult) {
  68285. const centerCartographic = Rectangle_default.center(
  68286. rectangle,
  68287. rectangleCenterScratch3
  68288. );
  68289. centerCartographic.height = height;
  68290. const centerCartesian2 = Cartographic_default.toCartesian(
  68291. centerCartographic,
  68292. ellipsoid,
  68293. rectanglePointCartesianScratch
  68294. );
  68295. const enuMatrix = Transforms_default.eastNorthUpToFixedFrame(
  68296. centerCartesian2,
  68297. ellipsoid,
  68298. enuMatrixScratch
  68299. );
  68300. const inverseEnu = Matrix4_default.inverse(enuMatrix, inverseEnuScratch);
  68301. const west = rectangle.west;
  68302. const east = rectangle.east;
  68303. const north = rectangle.north;
  68304. const south = rectangle.south;
  68305. const cartographics = pointsCartographicScratch;
  68306. cartographics[0].latitude = south;
  68307. cartographics[0].longitude = west;
  68308. cartographics[1].latitude = north;
  68309. cartographics[1].longitude = west;
  68310. cartographics[2].latitude = north;
  68311. cartographics[2].longitude = east;
  68312. cartographics[3].latitude = south;
  68313. cartographics[3].longitude = east;
  68314. const longitudeCenter = (west + east) * 0.5;
  68315. const latitudeCenter = (north + south) * 0.5;
  68316. cartographics[4].latitude = south;
  68317. cartographics[4].longitude = longitudeCenter;
  68318. cartographics[5].latitude = north;
  68319. cartographics[5].longitude = longitudeCenter;
  68320. cartographics[6].latitude = latitudeCenter;
  68321. cartographics[6].longitude = west;
  68322. cartographics[7].latitude = latitudeCenter;
  68323. cartographics[7].longitude = east;
  68324. let minX = Number.POSITIVE_INFINITY;
  68325. let maxX = Number.NEGATIVE_INFINITY;
  68326. let minY = Number.POSITIVE_INFINITY;
  68327. let maxY = Number.NEGATIVE_INFINITY;
  68328. for (let i2 = 0; i2 < 8; i2++) {
  68329. cartographics[i2].height = height;
  68330. const pointCartesian = Cartographic_default.toCartesian(
  68331. cartographics[i2],
  68332. ellipsoid,
  68333. rectanglePointCartesianScratch
  68334. );
  68335. Matrix4_default.multiplyByPoint(inverseEnu, pointCartesian, pointCartesian);
  68336. pointCartesian.z = 0;
  68337. minX = Math.min(minX, pointCartesian.x);
  68338. maxX = Math.max(maxX, pointCartesian.x);
  68339. minY = Math.min(minY, pointCartesian.y);
  68340. maxY = Math.max(maxY, pointCartesian.y);
  68341. }
  68342. const southWestCorner = southWestCornerResult;
  68343. southWestCorner.x = minX;
  68344. southWestCorner.y = minY;
  68345. southWestCorner.z = 0;
  68346. Matrix4_default.multiplyByPoint(enuMatrix, southWestCorner, southWestCorner);
  68347. const southEastCorner = eastVectorResult;
  68348. southEastCorner.x = maxX;
  68349. southEastCorner.y = minY;
  68350. southEastCorner.z = 0;
  68351. Matrix4_default.multiplyByPoint(enuMatrix, southEastCorner, southEastCorner);
  68352. Cartesian3_default.subtract(southEastCorner, southWestCorner, eastVectorResult);
  68353. const northWestCorner = northVectorResult;
  68354. northWestCorner.x = minX;
  68355. northWestCorner.y = maxY;
  68356. northWestCorner.z = 0;
  68357. Matrix4_default.multiplyByPoint(enuMatrix, northWestCorner, northWestCorner);
  68358. Cartesian3_default.subtract(northWestCorner, southWestCorner, northVectorResult);
  68359. }
  68360. var eastwardScratch = new Cartesian3_default();
  68361. var northwardScratch = new Cartesian3_default();
  68362. var encodeScratch2 = new EncodedCartesian3_default();
  68363. ShadowVolumeAppearance.getPlanarTextureCoordinateAttributes = function(boundingRectangle, textureCoordinateRotationPoints4, ellipsoid, projection, height) {
  68364. Check_default.typeOf.object("boundingRectangle", boundingRectangle);
  68365. Check_default.defined(
  68366. "textureCoordinateRotationPoints",
  68367. textureCoordinateRotationPoints4
  68368. );
  68369. Check_default.typeOf.object("ellipsoid", ellipsoid);
  68370. Check_default.typeOf.object("projection", projection);
  68371. const corner = cornerScratch;
  68372. const eastward = eastwardScratch;
  68373. const northward = northwardScratch;
  68374. computeRectangleBounds(
  68375. boundingRectangle,
  68376. ellipsoid,
  68377. defaultValue_default(height, 0),
  68378. corner,
  68379. eastward,
  68380. northward
  68381. );
  68382. const attributes = {};
  68383. addTextureCoordinateRotationAttributes(
  68384. attributes,
  68385. textureCoordinateRotationPoints4
  68386. );
  68387. const encoded = EncodedCartesian3_default.fromCartesian(corner, encodeScratch2);
  68388. attributes.southWest_HIGH = new GeometryInstanceAttribute_default({
  68389. componentDatatype: ComponentDatatype_default.FLOAT,
  68390. componentsPerAttribute: 3,
  68391. normalize: false,
  68392. value: Cartesian3_default.pack(encoded.high, [0, 0, 0])
  68393. });
  68394. attributes.southWest_LOW = new GeometryInstanceAttribute_default({
  68395. componentDatatype: ComponentDatatype_default.FLOAT,
  68396. componentsPerAttribute: 3,
  68397. normalize: false,
  68398. value: Cartesian3_default.pack(encoded.low, [0, 0, 0])
  68399. });
  68400. attributes.eastward = new GeometryInstanceAttribute_default({
  68401. componentDatatype: ComponentDatatype_default.FLOAT,
  68402. componentsPerAttribute: 3,
  68403. normalize: false,
  68404. value: Cartesian3_default.pack(eastward, [0, 0, 0])
  68405. });
  68406. attributes.northward = new GeometryInstanceAttribute_default({
  68407. componentDatatype: ComponentDatatype_default.FLOAT,
  68408. componentsPerAttribute: 3,
  68409. normalize: false,
  68410. value: Cartesian3_default.pack(northward, [0, 0, 0])
  68411. });
  68412. add2DTextureCoordinateAttributes(boundingRectangle, projection, attributes);
  68413. return attributes;
  68414. };
  68415. var spherePointScratch = new Cartesian3_default();
  68416. function latLongToSpherical(latitude, longitude, ellipsoid, result) {
  68417. const cartographic2 = cartographicScratch2;
  68418. cartographic2.latitude = latitude;
  68419. cartographic2.longitude = longitude;
  68420. cartographic2.height = 0;
  68421. const spherePoint = Cartographic_default.toCartesian(
  68422. cartographic2,
  68423. ellipsoid,
  68424. spherePointScratch
  68425. );
  68426. const magXY = Math.sqrt(
  68427. spherePoint.x * spherePoint.x + spherePoint.y * spherePoint.y
  68428. );
  68429. const sphereLatitude = Math_default.fastApproximateAtan2(magXY, spherePoint.z);
  68430. const sphereLongitude = Math_default.fastApproximateAtan2(
  68431. spherePoint.x,
  68432. spherePoint.y
  68433. );
  68434. result.x = sphereLatitude;
  68435. result.y = sphereLongitude;
  68436. return result;
  68437. }
  68438. var sphericalScratch = new Cartesian2_default();
  68439. ShadowVolumeAppearance.getSphericalExtentGeometryInstanceAttributes = function(boundingRectangle, textureCoordinateRotationPoints4, ellipsoid, projection) {
  68440. Check_default.typeOf.object("boundingRectangle", boundingRectangle);
  68441. Check_default.defined(
  68442. "textureCoordinateRotationPoints",
  68443. textureCoordinateRotationPoints4
  68444. );
  68445. Check_default.typeOf.object("ellipsoid", ellipsoid);
  68446. Check_default.typeOf.object("projection", projection);
  68447. const southWestExtents = latLongToSpherical(
  68448. boundingRectangle.south,
  68449. boundingRectangle.west,
  68450. ellipsoid,
  68451. sphericalScratch
  68452. );
  68453. let south = southWestExtents.x;
  68454. let west = southWestExtents.y;
  68455. const northEastExtents = latLongToSpherical(
  68456. boundingRectangle.north,
  68457. boundingRectangle.east,
  68458. ellipsoid,
  68459. sphericalScratch
  68460. );
  68461. let north = northEastExtents.x;
  68462. let east = northEastExtents.y;
  68463. let rotationRadians = 0;
  68464. if (west > east) {
  68465. rotationRadians = Math_default.PI - west;
  68466. west = -Math_default.PI;
  68467. east += rotationRadians;
  68468. }
  68469. south -= Math_default.EPSILON5;
  68470. west -= Math_default.EPSILON5;
  68471. north += Math_default.EPSILON5;
  68472. east += Math_default.EPSILON5;
  68473. const longitudeRangeInverse = 1 / (east - west);
  68474. const latitudeRangeInverse = 1 / (north - south);
  68475. const attributes = {
  68476. sphericalExtents: new GeometryInstanceAttribute_default({
  68477. componentDatatype: ComponentDatatype_default.FLOAT,
  68478. componentsPerAttribute: 4,
  68479. normalize: false,
  68480. value: [south, west, latitudeRangeInverse, longitudeRangeInverse]
  68481. }),
  68482. longitudeRotation: new GeometryInstanceAttribute_default({
  68483. componentDatatype: ComponentDatatype_default.FLOAT,
  68484. componentsPerAttribute: 1,
  68485. normalize: false,
  68486. value: [rotationRadians]
  68487. })
  68488. };
  68489. addTextureCoordinateRotationAttributes(
  68490. attributes,
  68491. textureCoordinateRotationPoints4
  68492. );
  68493. add2DTextureCoordinateAttributes(boundingRectangle, projection, attributes);
  68494. return attributes;
  68495. };
  68496. ShadowVolumeAppearance.hasAttributesForTextureCoordinatePlanes = function(attributes) {
  68497. return defined_default(attributes.southWest_HIGH) && defined_default(attributes.southWest_LOW) && defined_default(attributes.northward) && defined_default(attributes.eastward) && defined_default(attributes.planes2D_HIGH) && defined_default(attributes.planes2D_LOW) && defined_default(attributes.uMaxVmax) && defined_default(attributes.uvMinAndExtents);
  68498. };
  68499. ShadowVolumeAppearance.hasAttributesForSphericalExtents = function(attributes) {
  68500. return defined_default(attributes.sphericalExtents) && defined_default(attributes.longitudeRotation) && defined_default(attributes.planes2D_HIGH) && defined_default(attributes.planes2D_LOW) && defined_default(attributes.uMaxVmax) && defined_default(attributes.uvMinAndExtents);
  68501. };
  68502. function shouldUseSpherical(rectangle) {
  68503. return Math.max(rectangle.width, rectangle.height) > ShadowVolumeAppearance.MAX_WIDTH_FOR_PLANAR_EXTENTS;
  68504. }
  68505. ShadowVolumeAppearance.shouldUseSphericalCoordinates = function(rectangle) {
  68506. Check_default.typeOf.object("rectangle", rectangle);
  68507. return shouldUseSpherical(rectangle);
  68508. };
  68509. ShadowVolumeAppearance.MAX_WIDTH_FOR_PLANAR_EXTENTS = Math_default.toRadians(1);
  68510. var ShadowVolumeAppearance_default = ShadowVolumeAppearance;
  68511. // node_modules/cesium/Source/Scene/StencilFunction.js
  68512. var StencilFunction = {
  68513. NEVER: WebGLConstants_default.NEVER,
  68514. LESS: WebGLConstants_default.LESS,
  68515. EQUAL: WebGLConstants_default.EQUAL,
  68516. LESS_OR_EQUAL: WebGLConstants_default.LEQUAL,
  68517. GREATER: WebGLConstants_default.GREATER,
  68518. NOT_EQUAL: WebGLConstants_default.NOTEQUAL,
  68519. GREATER_OR_EQUAL: WebGLConstants_default.GEQUAL,
  68520. ALWAYS: WebGLConstants_default.ALWAYS
  68521. };
  68522. var StencilFunction_default = Object.freeze(StencilFunction);
  68523. // node_modules/cesium/Source/Scene/StencilOperation.js
  68524. var StencilOperation = {
  68525. ZERO: WebGLConstants_default.ZERO,
  68526. KEEP: WebGLConstants_default.KEEP,
  68527. REPLACE: WebGLConstants_default.REPLACE,
  68528. INCREMENT: WebGLConstants_default.INCR,
  68529. DECREMENT: WebGLConstants_default.DECR,
  68530. INVERT: WebGLConstants_default.INVERT,
  68531. INCREMENT_WRAP: WebGLConstants_default.INCR_WRAP,
  68532. DECREMENT_WRAP: WebGLConstants_default.DECR_WRAP
  68533. };
  68534. var StencilOperation_default = Object.freeze(StencilOperation);
  68535. // node_modules/cesium/Source/Scene/StencilConstants.js
  68536. var StencilConstants = {
  68537. CESIUM_3D_TILE_MASK: 128,
  68538. SKIP_LOD_MASK: 112,
  68539. SKIP_LOD_BIT_SHIFT: 4,
  68540. CLASSIFICATION_MASK: 15
  68541. };
  68542. StencilConstants.setCesium3DTileBit = function() {
  68543. return {
  68544. enabled: true,
  68545. frontFunction: StencilFunction_default.ALWAYS,
  68546. frontOperation: {
  68547. fail: StencilOperation_default.KEEP,
  68548. zFail: StencilOperation_default.KEEP,
  68549. zPass: StencilOperation_default.REPLACE
  68550. },
  68551. backFunction: StencilFunction_default.ALWAYS,
  68552. backOperation: {
  68553. fail: StencilOperation_default.KEEP,
  68554. zFail: StencilOperation_default.KEEP,
  68555. zPass: StencilOperation_default.REPLACE
  68556. },
  68557. reference: StencilConstants.CESIUM_3D_TILE_MASK,
  68558. mask: StencilConstants.CESIUM_3D_TILE_MASK
  68559. };
  68560. };
  68561. var StencilConstants_default = Object.freeze(StencilConstants);
  68562. // node_modules/cesium/Source/Scene/ClassificationPrimitive.js
  68563. function ClassificationPrimitive(options) {
  68564. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  68565. const geometryInstances = options.geometryInstances;
  68566. this.geometryInstances = geometryInstances;
  68567. this.show = defaultValue_default(options.show, true);
  68568. this.classificationType = defaultValue_default(
  68569. options.classificationType,
  68570. ClassificationType_default.BOTH
  68571. );
  68572. this.debugShowBoundingVolume = defaultValue_default(
  68573. options.debugShowBoundingVolume,
  68574. false
  68575. );
  68576. this.debugShowShadowVolume = defaultValue_default(
  68577. options.debugShowShadowVolume,
  68578. false
  68579. );
  68580. this._debugShowShadowVolume = false;
  68581. this._extruded = defaultValue_default(options._extruded, false);
  68582. this._uniformMap = options._uniformMap;
  68583. this._sp = void 0;
  68584. this._spStencil = void 0;
  68585. this._spPick = void 0;
  68586. this._spColor = void 0;
  68587. this._spPick2D = void 0;
  68588. this._spColor2D = void 0;
  68589. this._rsStencilDepthPass = void 0;
  68590. this._rsStencilDepthPass3DTiles = void 0;
  68591. this._rsColorPass = void 0;
  68592. this._rsPickPass = void 0;
  68593. this._commandsIgnoreShow = [];
  68594. this._ready = false;
  68595. this._readyPromise = defer_default();
  68596. this._primitive = void 0;
  68597. this._pickPrimitive = options._pickPrimitive;
  68598. this._hasSphericalExtentsAttribute = false;
  68599. this._hasPlanarExtentsAttributes = false;
  68600. this._hasPerColorAttribute = false;
  68601. this.appearance = options.appearance;
  68602. this._createBoundingVolumeFunction = options._createBoundingVolumeFunction;
  68603. this._updateAndQueueCommandsFunction = options._updateAndQueueCommandsFunction;
  68604. this._usePickOffsets = false;
  68605. this._primitiveOptions = {
  68606. geometryInstances: void 0,
  68607. appearance: void 0,
  68608. vertexCacheOptimize: defaultValue_default(options.vertexCacheOptimize, false),
  68609. interleave: defaultValue_default(options.interleave, false),
  68610. releaseGeometryInstances: defaultValue_default(
  68611. options.releaseGeometryInstances,
  68612. true
  68613. ),
  68614. allowPicking: defaultValue_default(options.allowPicking, true),
  68615. asynchronous: defaultValue_default(options.asynchronous, true),
  68616. compressVertices: defaultValue_default(options.compressVertices, true),
  68617. _createBoundingVolumeFunction: void 0,
  68618. _createRenderStatesFunction: void 0,
  68619. _createShaderProgramFunction: void 0,
  68620. _createCommandsFunction: void 0,
  68621. _updateAndQueueCommandsFunction: void 0,
  68622. _createPickOffsets: true
  68623. };
  68624. }
  68625. Object.defineProperties(ClassificationPrimitive.prototype, {
  68626. vertexCacheOptimize: {
  68627. get: function() {
  68628. return this._primitiveOptions.vertexCacheOptimize;
  68629. }
  68630. },
  68631. interleave: {
  68632. get: function() {
  68633. return this._primitiveOptions.interleave;
  68634. }
  68635. },
  68636. releaseGeometryInstances: {
  68637. get: function() {
  68638. return this._primitiveOptions.releaseGeometryInstances;
  68639. }
  68640. },
  68641. allowPicking: {
  68642. get: function() {
  68643. return this._primitiveOptions.allowPicking;
  68644. }
  68645. },
  68646. asynchronous: {
  68647. get: function() {
  68648. return this._primitiveOptions.asynchronous;
  68649. }
  68650. },
  68651. compressVertices: {
  68652. get: function() {
  68653. return this._primitiveOptions.compressVertices;
  68654. }
  68655. },
  68656. ready: {
  68657. get: function() {
  68658. return this._ready;
  68659. }
  68660. },
  68661. readyPromise: {
  68662. get: function() {
  68663. return this._readyPromise.promise;
  68664. }
  68665. },
  68666. _needs2DShader: {
  68667. get: function() {
  68668. return this._hasPlanarExtentsAttributes || this._hasSphericalExtentsAttribute;
  68669. }
  68670. }
  68671. });
  68672. ClassificationPrimitive.isSupported = function(scene) {
  68673. return scene.context.stencilBuffer;
  68674. };
  68675. function getStencilDepthRenderState(enableStencil, mask3DTiles) {
  68676. const stencilFunction = mask3DTiles ? StencilFunction_default.EQUAL : StencilFunction_default.ALWAYS;
  68677. return {
  68678. colorMask: {
  68679. red: false,
  68680. green: false,
  68681. blue: false,
  68682. alpha: false
  68683. },
  68684. stencilTest: {
  68685. enabled: enableStencil,
  68686. frontFunction: stencilFunction,
  68687. frontOperation: {
  68688. fail: StencilOperation_default.KEEP,
  68689. zFail: StencilOperation_default.DECREMENT_WRAP,
  68690. zPass: StencilOperation_default.KEEP
  68691. },
  68692. backFunction: stencilFunction,
  68693. backOperation: {
  68694. fail: StencilOperation_default.KEEP,
  68695. zFail: StencilOperation_default.INCREMENT_WRAP,
  68696. zPass: StencilOperation_default.KEEP
  68697. },
  68698. reference: StencilConstants_default.CESIUM_3D_TILE_MASK,
  68699. mask: StencilConstants_default.CESIUM_3D_TILE_MASK
  68700. },
  68701. stencilMask: StencilConstants_default.CLASSIFICATION_MASK,
  68702. depthTest: {
  68703. enabled: true,
  68704. func: DepthFunction_default.LESS_OR_EQUAL
  68705. },
  68706. depthMask: false
  68707. };
  68708. }
  68709. function getColorRenderState(enableStencil) {
  68710. return {
  68711. stencilTest: {
  68712. enabled: enableStencil,
  68713. frontFunction: StencilFunction_default.NOT_EQUAL,
  68714. frontOperation: {
  68715. fail: StencilOperation_default.ZERO,
  68716. zFail: StencilOperation_default.ZERO,
  68717. zPass: StencilOperation_default.ZERO
  68718. },
  68719. backFunction: StencilFunction_default.NOT_EQUAL,
  68720. backOperation: {
  68721. fail: StencilOperation_default.ZERO,
  68722. zFail: StencilOperation_default.ZERO,
  68723. zPass: StencilOperation_default.ZERO
  68724. },
  68725. reference: 0,
  68726. mask: StencilConstants_default.CLASSIFICATION_MASK
  68727. },
  68728. stencilMask: StencilConstants_default.CLASSIFICATION_MASK,
  68729. depthTest: {
  68730. enabled: false
  68731. },
  68732. depthMask: false,
  68733. blending: BlendingState_default.PRE_MULTIPLIED_ALPHA_BLEND
  68734. };
  68735. }
  68736. var pickRenderState = {
  68737. stencilTest: {
  68738. enabled: true,
  68739. frontFunction: StencilFunction_default.NOT_EQUAL,
  68740. frontOperation: {
  68741. fail: StencilOperation_default.ZERO,
  68742. zFail: StencilOperation_default.ZERO,
  68743. zPass: StencilOperation_default.ZERO
  68744. },
  68745. backFunction: StencilFunction_default.NOT_EQUAL,
  68746. backOperation: {
  68747. fail: StencilOperation_default.ZERO,
  68748. zFail: StencilOperation_default.ZERO,
  68749. zPass: StencilOperation_default.ZERO
  68750. },
  68751. reference: 0,
  68752. mask: StencilConstants_default.CLASSIFICATION_MASK
  68753. },
  68754. stencilMask: StencilConstants_default.CLASSIFICATION_MASK,
  68755. depthTest: {
  68756. enabled: false
  68757. },
  68758. depthMask: false
  68759. };
  68760. function createRenderStates2(classificationPrimitive, context, appearance, twoPasses) {
  68761. if (defined_default(classificationPrimitive._rsStencilDepthPass)) {
  68762. return;
  68763. }
  68764. const stencilEnabled = !classificationPrimitive.debugShowShadowVolume;
  68765. classificationPrimitive._rsStencilDepthPass = RenderState_default.fromCache(
  68766. getStencilDepthRenderState(stencilEnabled, false)
  68767. );
  68768. classificationPrimitive._rsStencilDepthPass3DTiles = RenderState_default.fromCache(
  68769. getStencilDepthRenderState(stencilEnabled, true)
  68770. );
  68771. classificationPrimitive._rsColorPass = RenderState_default.fromCache(
  68772. getColorRenderState(stencilEnabled, false)
  68773. );
  68774. classificationPrimitive._rsPickPass = RenderState_default.fromCache(pickRenderState);
  68775. }
  68776. function modifyForEncodedNormals2(primitive, vertexShaderSource) {
  68777. if (!primitive.compressVertices) {
  68778. return vertexShaderSource;
  68779. }
  68780. if (vertexShaderSource.search(/attribute\s+vec3\s+extrudeDirection;/g) !== -1) {
  68781. const attributeName = "compressedAttributes";
  68782. const attributeDecl = `attribute vec2 ${attributeName};`;
  68783. const globalDecl = "vec3 extrudeDirection;\n";
  68784. const decode = ` extrudeDirection = czm_octDecode(${attributeName}, 65535.0);
  68785. `;
  68786. let modifiedVS = vertexShaderSource;
  68787. modifiedVS = modifiedVS.replace(
  68788. /attribute\s+vec3\s+extrudeDirection;/g,
  68789. ""
  68790. );
  68791. modifiedVS = ShaderSource_default.replaceMain(
  68792. modifiedVS,
  68793. "czm_non_compressed_main"
  68794. );
  68795. const compressedMain = `${"void main() \n{ \n"}${decode} czm_non_compressed_main();
  68796. }`;
  68797. return [attributeDecl, globalDecl, modifiedVS, compressedMain].join("\n");
  68798. }
  68799. }
  68800. function createShaderProgram2(classificationPrimitive, frameState) {
  68801. const context = frameState.context;
  68802. const primitive = classificationPrimitive._primitive;
  68803. let vs = ShadowVolumeAppearanceVS_default;
  68804. vs = classificationPrimitive._primitive._batchTable.getVertexShaderCallback()(
  68805. vs
  68806. );
  68807. vs = Primitive_default._appendDistanceDisplayConditionToShader(primitive, vs);
  68808. vs = Primitive_default._modifyShaderPosition(
  68809. classificationPrimitive,
  68810. vs,
  68811. frameState.scene3DOnly
  68812. );
  68813. vs = Primitive_default._updateColorAttribute(primitive, vs);
  68814. const planarExtents = classificationPrimitive._hasPlanarExtentsAttributes;
  68815. const cullFragmentsUsingExtents = planarExtents || classificationPrimitive._hasSphericalExtentsAttribute;
  68816. if (classificationPrimitive._extruded) {
  68817. vs = modifyForEncodedNormals2(primitive, vs);
  68818. }
  68819. const extrudedDefine = classificationPrimitive._extruded ? "EXTRUDED_GEOMETRY" : "";
  68820. let vsSource = new ShaderSource_default({
  68821. defines: [extrudedDefine],
  68822. sources: [vs]
  68823. });
  68824. const fsSource = new ShaderSource_default({
  68825. sources: [ShadowVolumeFS_default]
  68826. });
  68827. const attributeLocations8 = classificationPrimitive._primitive._attributeLocations;
  68828. const shadowVolumeAppearance = new ShadowVolumeAppearance_default(
  68829. cullFragmentsUsingExtents,
  68830. planarExtents,
  68831. classificationPrimitive.appearance
  68832. );
  68833. classificationPrimitive._spStencil = ShaderProgram_default.replaceCache({
  68834. context,
  68835. shaderProgram: classificationPrimitive._spStencil,
  68836. vertexShaderSource: vsSource,
  68837. fragmentShaderSource: fsSource,
  68838. attributeLocations: attributeLocations8
  68839. });
  68840. if (classificationPrimitive._primitive.allowPicking) {
  68841. let vsPick = ShaderSource_default.createPickVertexShaderSource(vs);
  68842. vsPick = Primitive_default._appendShowToShader(primitive, vsPick);
  68843. vsPick = Primitive_default._updatePickColorAttribute(vsPick);
  68844. const pickFS3D = shadowVolumeAppearance.createPickFragmentShader(false);
  68845. const pickVS3D = shadowVolumeAppearance.createPickVertexShader(
  68846. [extrudedDefine],
  68847. vsPick,
  68848. false,
  68849. frameState.mapProjection
  68850. );
  68851. classificationPrimitive._spPick = ShaderProgram_default.replaceCache({
  68852. context,
  68853. shaderProgram: classificationPrimitive._spPick,
  68854. vertexShaderSource: pickVS3D,
  68855. fragmentShaderSource: pickFS3D,
  68856. attributeLocations: attributeLocations8
  68857. });
  68858. if (cullFragmentsUsingExtents) {
  68859. let pickProgram2D = context.shaderCache.getDerivedShaderProgram(
  68860. classificationPrimitive._spPick,
  68861. "2dPick"
  68862. );
  68863. if (!defined_default(pickProgram2D)) {
  68864. const pickFS2D = shadowVolumeAppearance.createPickFragmentShader(true);
  68865. const pickVS2D = shadowVolumeAppearance.createPickVertexShader(
  68866. [extrudedDefine],
  68867. vsPick,
  68868. true,
  68869. frameState.mapProjection
  68870. );
  68871. pickProgram2D = context.shaderCache.createDerivedShaderProgram(
  68872. classificationPrimitive._spPick,
  68873. "2dPick",
  68874. {
  68875. vertexShaderSource: pickVS2D,
  68876. fragmentShaderSource: pickFS2D,
  68877. attributeLocations: attributeLocations8
  68878. }
  68879. );
  68880. }
  68881. classificationPrimitive._spPick2D = pickProgram2D;
  68882. }
  68883. } else {
  68884. classificationPrimitive._spPick = ShaderProgram_default.fromCache({
  68885. context,
  68886. vertexShaderSource: vsSource,
  68887. fragmentShaderSource: fsSource,
  68888. attributeLocations: attributeLocations8
  68889. });
  68890. }
  68891. vs = Primitive_default._appendShowToShader(primitive, vs);
  68892. vsSource = new ShaderSource_default({
  68893. defines: [extrudedDefine],
  68894. sources: [vs]
  68895. });
  68896. classificationPrimitive._sp = ShaderProgram_default.replaceCache({
  68897. context,
  68898. shaderProgram: classificationPrimitive._sp,
  68899. vertexShaderSource: vsSource,
  68900. fragmentShaderSource: fsSource,
  68901. attributeLocations: attributeLocations8
  68902. });
  68903. const fsColorSource = shadowVolumeAppearance.createFragmentShader(false);
  68904. const vsColorSource = shadowVolumeAppearance.createVertexShader(
  68905. [extrudedDefine],
  68906. vs,
  68907. false,
  68908. frameState.mapProjection
  68909. );
  68910. classificationPrimitive._spColor = ShaderProgram_default.replaceCache({
  68911. context,
  68912. shaderProgram: classificationPrimitive._spColor,
  68913. vertexShaderSource: vsColorSource,
  68914. fragmentShaderSource: fsColorSource,
  68915. attributeLocations: attributeLocations8
  68916. });
  68917. if (cullFragmentsUsingExtents) {
  68918. let colorProgram2D = context.shaderCache.getDerivedShaderProgram(
  68919. classificationPrimitive._spColor,
  68920. "2dColor"
  68921. );
  68922. if (!defined_default(colorProgram2D)) {
  68923. const fsColorSource2D = shadowVolumeAppearance.createFragmentShader(true);
  68924. const vsColorSource2D = shadowVolumeAppearance.createVertexShader(
  68925. [extrudedDefine],
  68926. vs,
  68927. true,
  68928. frameState.mapProjection
  68929. );
  68930. colorProgram2D = context.shaderCache.createDerivedShaderProgram(
  68931. classificationPrimitive._spColor,
  68932. "2dColor",
  68933. {
  68934. vertexShaderSource: vsColorSource2D,
  68935. fragmentShaderSource: fsColorSource2D,
  68936. attributeLocations: attributeLocations8
  68937. }
  68938. );
  68939. }
  68940. classificationPrimitive._spColor2D = colorProgram2D;
  68941. }
  68942. }
  68943. function createColorCommands(classificationPrimitive, colorCommands) {
  68944. const primitive = classificationPrimitive._primitive;
  68945. let length3 = primitive._va.length * 2;
  68946. colorCommands.length = length3;
  68947. let i2;
  68948. let command;
  68949. let derivedCommand;
  68950. let vaIndex = 0;
  68951. let uniformMap2 = primitive._batchTable.getUniformMapCallback()(
  68952. classificationPrimitive._uniformMap
  68953. );
  68954. const needs2DShader = classificationPrimitive._needs2DShader;
  68955. for (i2 = 0; i2 < length3; i2 += 2) {
  68956. const vertexArray = primitive._va[vaIndex++];
  68957. command = colorCommands[i2];
  68958. if (!defined_default(command)) {
  68959. command = colorCommands[i2] = new DrawCommand_default({
  68960. owner: classificationPrimitive,
  68961. primitiveType: primitive._primitiveType
  68962. });
  68963. }
  68964. command.vertexArray = vertexArray;
  68965. command.renderState = classificationPrimitive._rsStencilDepthPass;
  68966. command.shaderProgram = classificationPrimitive._sp;
  68967. command.uniformMap = uniformMap2;
  68968. command.pass = Pass_default.TERRAIN_CLASSIFICATION;
  68969. derivedCommand = DrawCommand_default.shallowClone(
  68970. command,
  68971. command.derivedCommands.tileset
  68972. );
  68973. derivedCommand.renderState = classificationPrimitive._rsStencilDepthPass3DTiles;
  68974. derivedCommand.pass = Pass_default.CESIUM_3D_TILE_CLASSIFICATION;
  68975. command.derivedCommands.tileset = derivedCommand;
  68976. command = colorCommands[i2 + 1];
  68977. if (!defined_default(command)) {
  68978. command = colorCommands[i2 + 1] = new DrawCommand_default({
  68979. owner: classificationPrimitive,
  68980. primitiveType: primitive._primitiveType
  68981. });
  68982. }
  68983. command.vertexArray = vertexArray;
  68984. command.renderState = classificationPrimitive._rsColorPass;
  68985. command.shaderProgram = classificationPrimitive._spColor;
  68986. command.pass = Pass_default.TERRAIN_CLASSIFICATION;
  68987. const appearance = classificationPrimitive.appearance;
  68988. const material = appearance.material;
  68989. if (defined_default(material)) {
  68990. uniformMap2 = combine_default(uniformMap2, material._uniforms);
  68991. }
  68992. command.uniformMap = uniformMap2;
  68993. derivedCommand = DrawCommand_default.shallowClone(
  68994. command,
  68995. command.derivedCommands.tileset
  68996. );
  68997. derivedCommand.pass = Pass_default.CESIUM_3D_TILE_CLASSIFICATION;
  68998. command.derivedCommands.tileset = derivedCommand;
  68999. if (needs2DShader) {
  69000. let derived2DCommand = DrawCommand_default.shallowClone(
  69001. command,
  69002. command.derivedCommands.appearance2D
  69003. );
  69004. derived2DCommand.shaderProgram = classificationPrimitive._spColor2D;
  69005. command.derivedCommands.appearance2D = derived2DCommand;
  69006. derived2DCommand = DrawCommand_default.shallowClone(
  69007. derivedCommand,
  69008. derivedCommand.derivedCommands.appearance2D
  69009. );
  69010. derived2DCommand.shaderProgram = classificationPrimitive._spColor2D;
  69011. derivedCommand.derivedCommands.appearance2D = derived2DCommand;
  69012. }
  69013. }
  69014. const commandsIgnoreShow = classificationPrimitive._commandsIgnoreShow;
  69015. const spStencil = classificationPrimitive._spStencil;
  69016. let commandIndex = 0;
  69017. length3 = commandsIgnoreShow.length = length3 / 2;
  69018. for (let j = 0; j < length3; ++j) {
  69019. const commandIgnoreShow = commandsIgnoreShow[j] = DrawCommand_default.shallowClone(
  69020. colorCommands[commandIndex],
  69021. commandsIgnoreShow[j]
  69022. );
  69023. commandIgnoreShow.shaderProgram = spStencil;
  69024. commandIgnoreShow.pass = Pass_default.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW;
  69025. commandIndex += 2;
  69026. }
  69027. }
  69028. function createPickCommands(classificationPrimitive, pickCommands) {
  69029. const usePickOffsets = classificationPrimitive._usePickOffsets;
  69030. const primitive = classificationPrimitive._primitive;
  69031. let length3 = primitive._va.length * 2;
  69032. let pickOffsets;
  69033. let pickIndex = 0;
  69034. let pickOffset;
  69035. if (usePickOffsets) {
  69036. pickOffsets = primitive._pickOffsets;
  69037. length3 = pickOffsets.length * 2;
  69038. }
  69039. pickCommands.length = length3;
  69040. let j;
  69041. let command;
  69042. let derivedCommand;
  69043. let vaIndex = 0;
  69044. const uniformMap2 = primitive._batchTable.getUniformMapCallback()(
  69045. classificationPrimitive._uniformMap
  69046. );
  69047. const needs2DShader = classificationPrimitive._needs2DShader;
  69048. for (j = 0; j < length3; j += 2) {
  69049. let vertexArray = primitive._va[vaIndex++];
  69050. if (usePickOffsets) {
  69051. pickOffset = pickOffsets[pickIndex++];
  69052. vertexArray = primitive._va[pickOffset.index];
  69053. }
  69054. command = pickCommands[j];
  69055. if (!defined_default(command)) {
  69056. command = pickCommands[j] = new DrawCommand_default({
  69057. owner: classificationPrimitive,
  69058. primitiveType: primitive._primitiveType,
  69059. pickOnly: true
  69060. });
  69061. }
  69062. command.vertexArray = vertexArray;
  69063. command.renderState = classificationPrimitive._rsStencilDepthPass;
  69064. command.shaderProgram = classificationPrimitive._sp;
  69065. command.uniformMap = uniformMap2;
  69066. command.pass = Pass_default.TERRAIN_CLASSIFICATION;
  69067. if (usePickOffsets) {
  69068. command.offset = pickOffset.offset;
  69069. command.count = pickOffset.count;
  69070. }
  69071. derivedCommand = DrawCommand_default.shallowClone(
  69072. command,
  69073. command.derivedCommands.tileset
  69074. );
  69075. derivedCommand.renderState = classificationPrimitive._rsStencilDepthPass3DTiles;
  69076. derivedCommand.pass = Pass_default.CESIUM_3D_TILE_CLASSIFICATION;
  69077. command.derivedCommands.tileset = derivedCommand;
  69078. command = pickCommands[j + 1];
  69079. if (!defined_default(command)) {
  69080. command = pickCommands[j + 1] = new DrawCommand_default({
  69081. owner: classificationPrimitive,
  69082. primitiveType: primitive._primitiveType,
  69083. pickOnly: true
  69084. });
  69085. }
  69086. command.vertexArray = vertexArray;
  69087. command.renderState = classificationPrimitive._rsPickPass;
  69088. command.shaderProgram = classificationPrimitive._spPick;
  69089. command.uniformMap = uniformMap2;
  69090. command.pass = Pass_default.TERRAIN_CLASSIFICATION;
  69091. if (usePickOffsets) {
  69092. command.offset = pickOffset.offset;
  69093. command.count = pickOffset.count;
  69094. }
  69095. derivedCommand = DrawCommand_default.shallowClone(
  69096. command,
  69097. command.derivedCommands.tileset
  69098. );
  69099. derivedCommand.pass = Pass_default.CESIUM_3D_TILE_CLASSIFICATION;
  69100. command.derivedCommands.tileset = derivedCommand;
  69101. if (needs2DShader) {
  69102. let derived2DCommand = DrawCommand_default.shallowClone(
  69103. command,
  69104. command.derivedCommands.pick2D
  69105. );
  69106. derived2DCommand.shaderProgram = classificationPrimitive._spPick2D;
  69107. command.derivedCommands.pick2D = derived2DCommand;
  69108. derived2DCommand = DrawCommand_default.shallowClone(
  69109. derivedCommand,
  69110. derivedCommand.derivedCommands.pick2D
  69111. );
  69112. derived2DCommand.shaderProgram = classificationPrimitive._spPick2D;
  69113. derivedCommand.derivedCommands.pick2D = derived2DCommand;
  69114. }
  69115. }
  69116. }
  69117. function createCommands2(classificationPrimitive, appearance, material, translucent, twoPasses, colorCommands, pickCommands) {
  69118. createColorCommands(classificationPrimitive, colorCommands);
  69119. createPickCommands(classificationPrimitive, pickCommands);
  69120. }
  69121. function boundingVolumeIndex(commandIndex, length3) {
  69122. return Math.floor(commandIndex % length3 / 2);
  69123. }
  69124. function updateAndQueueRenderCommand(command, frameState, modelMatrix, cull, boundingVolume, debugShowBoundingVolume2) {
  69125. command.modelMatrix = modelMatrix;
  69126. command.boundingVolume = boundingVolume;
  69127. command.cull = cull;
  69128. command.debugShowBoundingVolume = debugShowBoundingVolume2;
  69129. frameState.commandList.push(command);
  69130. }
  69131. function updateAndQueuePickCommand(command, frameState, modelMatrix, cull, boundingVolume) {
  69132. command.modelMatrix = modelMatrix;
  69133. command.boundingVolume = boundingVolume;
  69134. command.cull = cull;
  69135. frameState.commandList.push(command);
  69136. }
  69137. function updateAndQueueCommands2(classificationPrimitive, frameState, colorCommands, pickCommands, modelMatrix, cull, debugShowBoundingVolume2, twoPasses) {
  69138. const primitive = classificationPrimitive._primitive;
  69139. Primitive_default._updateBoundingVolumes(primitive, frameState, modelMatrix);
  69140. let boundingVolumes;
  69141. if (frameState.mode === SceneMode_default.SCENE3D) {
  69142. boundingVolumes = primitive._boundingSphereWC;
  69143. } else if (frameState.mode === SceneMode_default.COLUMBUS_VIEW) {
  69144. boundingVolumes = primitive._boundingSphereCV;
  69145. } else if (frameState.mode === SceneMode_default.SCENE2D && defined_default(primitive._boundingSphere2D)) {
  69146. boundingVolumes = primitive._boundingSphere2D;
  69147. } else if (defined_default(primitive._boundingSphereMorph)) {
  69148. boundingVolumes = primitive._boundingSphereMorph;
  69149. }
  69150. const classificationType = classificationPrimitive.classificationType;
  69151. const queueTerrainCommands = classificationType !== ClassificationType_default.CESIUM_3D_TILE;
  69152. const queue3DTilesCommands = classificationType !== ClassificationType_default.TERRAIN;
  69153. const passes = frameState.passes;
  69154. let i2;
  69155. let boundingVolume;
  69156. let command;
  69157. if (passes.render) {
  69158. const colorLength = colorCommands.length;
  69159. for (i2 = 0; i2 < colorLength; ++i2) {
  69160. boundingVolume = boundingVolumes[boundingVolumeIndex(i2, colorLength)];
  69161. if (queueTerrainCommands) {
  69162. command = colorCommands[i2];
  69163. updateAndQueueRenderCommand(
  69164. command,
  69165. frameState,
  69166. modelMatrix,
  69167. cull,
  69168. boundingVolume,
  69169. debugShowBoundingVolume2
  69170. );
  69171. }
  69172. if (queue3DTilesCommands) {
  69173. command = colorCommands[i2].derivedCommands.tileset;
  69174. updateAndQueueRenderCommand(
  69175. command,
  69176. frameState,
  69177. modelMatrix,
  69178. cull,
  69179. boundingVolume,
  69180. debugShowBoundingVolume2
  69181. );
  69182. }
  69183. }
  69184. if (frameState.invertClassification) {
  69185. const ignoreShowCommands = classificationPrimitive._commandsIgnoreShow;
  69186. const ignoreShowCommandsLength = ignoreShowCommands.length;
  69187. for (i2 = 0; i2 < ignoreShowCommandsLength; ++i2) {
  69188. boundingVolume = boundingVolumes[i2];
  69189. command = ignoreShowCommands[i2];
  69190. updateAndQueueRenderCommand(
  69191. command,
  69192. frameState,
  69193. modelMatrix,
  69194. cull,
  69195. boundingVolume,
  69196. debugShowBoundingVolume2
  69197. );
  69198. }
  69199. }
  69200. }
  69201. if (passes.pick) {
  69202. const pickLength = pickCommands.length;
  69203. const pickOffsets = primitive._pickOffsets;
  69204. for (i2 = 0; i2 < pickLength; ++i2) {
  69205. const pickOffset = pickOffsets[boundingVolumeIndex(i2, pickLength)];
  69206. boundingVolume = boundingVolumes[pickOffset.index];
  69207. if (queueTerrainCommands) {
  69208. command = pickCommands[i2];
  69209. updateAndQueuePickCommand(
  69210. command,
  69211. frameState,
  69212. modelMatrix,
  69213. cull,
  69214. boundingVolume
  69215. );
  69216. }
  69217. if (queue3DTilesCommands) {
  69218. command = pickCommands[i2].derivedCommands.tileset;
  69219. updateAndQueuePickCommand(
  69220. command,
  69221. frameState,
  69222. modelMatrix,
  69223. cull,
  69224. boundingVolume
  69225. );
  69226. }
  69227. }
  69228. }
  69229. }
  69230. ClassificationPrimitive.prototype.update = function(frameState) {
  69231. if (!defined_default(this._primitive) && !defined_default(this.geometryInstances)) {
  69232. return;
  69233. }
  69234. let appearance = this.appearance;
  69235. if (defined_default(appearance) && defined_default(appearance.material)) {
  69236. appearance.material.update(frameState.context);
  69237. }
  69238. const that = this;
  69239. const primitiveOptions = this._primitiveOptions;
  69240. if (!defined_default(this._primitive)) {
  69241. const instances = Array.isArray(this.geometryInstances) ? this.geometryInstances : [this.geometryInstances];
  69242. const length3 = instances.length;
  69243. let i2;
  69244. let instance;
  69245. let attributes;
  69246. let hasPerColorAttribute = false;
  69247. let allColorsSame = true;
  69248. let firstColor;
  69249. let hasSphericalExtentsAttribute = false;
  69250. let hasPlanarExtentsAttributes = false;
  69251. if (length3 > 0) {
  69252. attributes = instances[0].attributes;
  69253. hasSphericalExtentsAttribute = ShadowVolumeAppearance_default.hasAttributesForSphericalExtents(
  69254. attributes
  69255. );
  69256. hasPlanarExtentsAttributes = ShadowVolumeAppearance_default.hasAttributesForTextureCoordinatePlanes(
  69257. attributes
  69258. );
  69259. firstColor = attributes.color;
  69260. }
  69261. for (i2 = 0; i2 < length3; i2++) {
  69262. instance = instances[i2];
  69263. const color = instance.attributes.color;
  69264. if (defined_default(color)) {
  69265. hasPerColorAttribute = true;
  69266. } else if (hasPerColorAttribute) {
  69267. throw new DeveloperError_default(
  69268. "All GeometryInstances must have color attributes to use per-instance color."
  69269. );
  69270. }
  69271. allColorsSame = allColorsSame && defined_default(color) && ColorGeometryInstanceAttribute_default.equals(firstColor, color);
  69272. }
  69273. if (!allColorsSame && !hasSphericalExtentsAttribute && !hasPlanarExtentsAttributes) {
  69274. throw new DeveloperError_default(
  69275. "All GeometryInstances must have the same color attribute except via GroundPrimitives"
  69276. );
  69277. }
  69278. if (hasPerColorAttribute && !defined_default(appearance)) {
  69279. appearance = new PerInstanceColorAppearance_default({
  69280. flat: true
  69281. });
  69282. this.appearance = appearance;
  69283. }
  69284. if (!hasPerColorAttribute && appearance instanceof PerInstanceColorAppearance_default) {
  69285. throw new DeveloperError_default(
  69286. "PerInstanceColorAppearance requires color GeometryInstanceAttributes on all GeometryInstances"
  69287. );
  69288. }
  69289. if (defined_default(appearance.material) && !hasSphericalExtentsAttribute && !hasPlanarExtentsAttributes) {
  69290. throw new DeveloperError_default(
  69291. "Materials on ClassificationPrimitives are not supported except via GroundPrimitives"
  69292. );
  69293. }
  69294. this._usePickOffsets = !hasSphericalExtentsAttribute && !hasPlanarExtentsAttributes;
  69295. this._hasSphericalExtentsAttribute = hasSphericalExtentsAttribute;
  69296. this._hasPlanarExtentsAttributes = hasPlanarExtentsAttributes;
  69297. this._hasPerColorAttribute = hasPerColorAttribute;
  69298. const geometryInstances = new Array(length3);
  69299. for (i2 = 0; i2 < length3; ++i2) {
  69300. instance = instances[i2];
  69301. geometryInstances[i2] = new GeometryInstance_default({
  69302. geometry: instance.geometry,
  69303. attributes: instance.attributes,
  69304. modelMatrix: instance.modelMatrix,
  69305. id: instance.id,
  69306. pickPrimitive: defaultValue_default(this._pickPrimitive, that)
  69307. });
  69308. }
  69309. primitiveOptions.appearance = appearance;
  69310. primitiveOptions.geometryInstances = geometryInstances;
  69311. if (defined_default(this._createBoundingVolumeFunction)) {
  69312. primitiveOptions._createBoundingVolumeFunction = function(frameState2, geometry) {
  69313. that._createBoundingVolumeFunction(frameState2, geometry);
  69314. };
  69315. }
  69316. primitiveOptions._createRenderStatesFunction = function(primitive, context, appearance2, twoPasses) {
  69317. createRenderStates2(that, context);
  69318. };
  69319. primitiveOptions._createShaderProgramFunction = function(primitive, frameState2, appearance2) {
  69320. createShaderProgram2(that, frameState2);
  69321. };
  69322. primitiveOptions._createCommandsFunction = function(primitive, appearance2, material, translucent, twoPasses, colorCommands, pickCommands) {
  69323. createCommands2(
  69324. that,
  69325. void 0,
  69326. void 0,
  69327. true,
  69328. false,
  69329. colorCommands,
  69330. pickCommands
  69331. );
  69332. };
  69333. if (defined_default(this._updateAndQueueCommandsFunction)) {
  69334. primitiveOptions._updateAndQueueCommandsFunction = function(primitive, frameState2, colorCommands, pickCommands, modelMatrix, cull, debugShowBoundingVolume2, twoPasses) {
  69335. that._updateAndQueueCommandsFunction(
  69336. primitive,
  69337. frameState2,
  69338. colorCommands,
  69339. pickCommands,
  69340. modelMatrix,
  69341. cull,
  69342. debugShowBoundingVolume2,
  69343. twoPasses
  69344. );
  69345. };
  69346. } else {
  69347. primitiveOptions._updateAndQueueCommandsFunction = function(primitive, frameState2, colorCommands, pickCommands, modelMatrix, cull, debugShowBoundingVolume2, twoPasses) {
  69348. updateAndQueueCommands2(
  69349. that,
  69350. frameState2,
  69351. colorCommands,
  69352. pickCommands,
  69353. modelMatrix,
  69354. cull,
  69355. debugShowBoundingVolume2,
  69356. twoPasses
  69357. );
  69358. };
  69359. }
  69360. this._primitive = new Primitive_default(primitiveOptions);
  69361. this._primitive.readyPromise.then(function(primitive) {
  69362. that._ready = true;
  69363. if (that.releaseGeometryInstances) {
  69364. that.geometryInstances = void 0;
  69365. }
  69366. const error = primitive._error;
  69367. if (!defined_default(error)) {
  69368. that._readyPromise.resolve(that);
  69369. } else {
  69370. that._readyPromise.reject(error);
  69371. }
  69372. });
  69373. }
  69374. if (this.debugShowShadowVolume && !this._debugShowShadowVolume && this._ready) {
  69375. this._debugShowShadowVolume = true;
  69376. this._rsStencilDepthPass = RenderState_default.fromCache(
  69377. getStencilDepthRenderState(false, false)
  69378. );
  69379. this._rsStencilDepthPass3DTiles = RenderState_default.fromCache(
  69380. getStencilDepthRenderState(false, true)
  69381. );
  69382. this._rsColorPass = RenderState_default.fromCache(getColorRenderState(false));
  69383. } else if (!this.debugShowShadowVolume && this._debugShowShadowVolume) {
  69384. this._debugShowShadowVolume = false;
  69385. this._rsStencilDepthPass = RenderState_default.fromCache(
  69386. getStencilDepthRenderState(true, false)
  69387. );
  69388. this._rsStencilDepthPass3DTiles = RenderState_default.fromCache(
  69389. getStencilDepthRenderState(true, true)
  69390. );
  69391. this._rsColorPass = RenderState_default.fromCache(getColorRenderState(true));
  69392. }
  69393. if (this._primitive.appearance !== appearance) {
  69394. if (!this._hasSphericalExtentsAttribute && !this._hasPlanarExtentsAttributes && defined_default(appearance.material)) {
  69395. throw new DeveloperError_default(
  69396. "Materials on ClassificationPrimitives are not supported except via GroundPrimitive"
  69397. );
  69398. }
  69399. if (!this._hasPerColorAttribute && appearance instanceof PerInstanceColorAppearance_default) {
  69400. throw new DeveloperError_default(
  69401. "PerInstanceColorAppearance requires color GeometryInstanceAttribute"
  69402. );
  69403. }
  69404. this._primitive.appearance = appearance;
  69405. }
  69406. this._primitive.show = this.show;
  69407. this._primitive.debugShowBoundingVolume = this.debugShowBoundingVolume;
  69408. this._primitive.update(frameState);
  69409. };
  69410. ClassificationPrimitive.prototype.getGeometryInstanceAttributes = function(id) {
  69411. if (!defined_default(this._primitive)) {
  69412. throw new DeveloperError_default(
  69413. "must call update before calling getGeometryInstanceAttributes"
  69414. );
  69415. }
  69416. return this._primitive.getGeometryInstanceAttributes(id);
  69417. };
  69418. ClassificationPrimitive.prototype.isDestroyed = function() {
  69419. return false;
  69420. };
  69421. ClassificationPrimitive.prototype.destroy = function() {
  69422. this._primitive = this._primitive && this._primitive.destroy();
  69423. this._sp = this._sp && this._sp.destroy();
  69424. this._spPick = this._spPick && this._spPick.destroy();
  69425. this._spColor = this._spColor && this._spColor.destroy();
  69426. this._spPick2D = void 0;
  69427. this._spColor2D = void 0;
  69428. return destroyObject_default(this);
  69429. };
  69430. var ClassificationPrimitive_default = ClassificationPrimitive;
  69431. // node_modules/cesium/Source/Scene/GroundPrimitive.js
  69432. var GroundPrimitiveUniformMap = {
  69433. u_globeMinimumAltitude: function() {
  69434. return 55e3;
  69435. }
  69436. };
  69437. function GroundPrimitive(options) {
  69438. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  69439. let appearance = options.appearance;
  69440. const geometryInstances = options.geometryInstances;
  69441. if (!defined_default(appearance) && defined_default(geometryInstances)) {
  69442. const geometryInstancesArray = Array.isArray(geometryInstances) ? geometryInstances : [geometryInstances];
  69443. const geometryInstanceCount = geometryInstancesArray.length;
  69444. for (let i2 = 0; i2 < geometryInstanceCount; i2++) {
  69445. const attributes = geometryInstancesArray[i2].attributes;
  69446. if (defined_default(attributes) && defined_default(attributes.color)) {
  69447. appearance = new PerInstanceColorAppearance_default({
  69448. flat: true
  69449. });
  69450. break;
  69451. }
  69452. }
  69453. }
  69454. this.appearance = appearance;
  69455. this.geometryInstances = options.geometryInstances;
  69456. this.show = defaultValue_default(options.show, true);
  69457. this.classificationType = defaultValue_default(
  69458. options.classificationType,
  69459. ClassificationType_default.BOTH
  69460. );
  69461. this.debugShowBoundingVolume = defaultValue_default(
  69462. options.debugShowBoundingVolume,
  69463. false
  69464. );
  69465. this.debugShowShadowVolume = defaultValue_default(
  69466. options.debugShowShadowVolume,
  69467. false
  69468. );
  69469. this._boundingVolumes = [];
  69470. this._boundingVolumes2D = [];
  69471. this._ready = false;
  69472. this._readyPromise = defer_default();
  69473. this._primitive = void 0;
  69474. this._maxHeight = void 0;
  69475. this._minHeight = void 0;
  69476. this._maxTerrainHeight = ApproximateTerrainHeights_default._defaultMaxTerrainHeight;
  69477. this._minTerrainHeight = ApproximateTerrainHeights_default._defaultMinTerrainHeight;
  69478. this._boundingSpheresKeys = [];
  69479. this._boundingSpheres = [];
  69480. this._useFragmentCulling = false;
  69481. this._zIndex = void 0;
  69482. const that = this;
  69483. this._classificationPrimitiveOptions = {
  69484. geometryInstances: void 0,
  69485. appearance: void 0,
  69486. vertexCacheOptimize: defaultValue_default(options.vertexCacheOptimize, false),
  69487. interleave: defaultValue_default(options.interleave, false),
  69488. releaseGeometryInstances: defaultValue_default(
  69489. options.releaseGeometryInstances,
  69490. true
  69491. ),
  69492. allowPicking: defaultValue_default(options.allowPicking, true),
  69493. asynchronous: defaultValue_default(options.asynchronous, true),
  69494. compressVertices: defaultValue_default(options.compressVertices, true),
  69495. _createBoundingVolumeFunction: void 0,
  69496. _updateAndQueueCommandsFunction: void 0,
  69497. _pickPrimitive: that,
  69498. _extruded: true,
  69499. _uniformMap: GroundPrimitiveUniformMap
  69500. };
  69501. }
  69502. Object.defineProperties(GroundPrimitive.prototype, {
  69503. vertexCacheOptimize: {
  69504. get: function() {
  69505. return this._classificationPrimitiveOptions.vertexCacheOptimize;
  69506. }
  69507. },
  69508. interleave: {
  69509. get: function() {
  69510. return this._classificationPrimitiveOptions.interleave;
  69511. }
  69512. },
  69513. releaseGeometryInstances: {
  69514. get: function() {
  69515. return this._classificationPrimitiveOptions.releaseGeometryInstances;
  69516. }
  69517. },
  69518. allowPicking: {
  69519. get: function() {
  69520. return this._classificationPrimitiveOptions.allowPicking;
  69521. }
  69522. },
  69523. asynchronous: {
  69524. get: function() {
  69525. return this._classificationPrimitiveOptions.asynchronous;
  69526. }
  69527. },
  69528. compressVertices: {
  69529. get: function() {
  69530. return this._classificationPrimitiveOptions.compressVertices;
  69531. }
  69532. },
  69533. ready: {
  69534. get: function() {
  69535. return this._ready;
  69536. }
  69537. },
  69538. readyPromise: {
  69539. get: function() {
  69540. return this._readyPromise.promise;
  69541. }
  69542. }
  69543. });
  69544. GroundPrimitive.isSupported = ClassificationPrimitive_default.isSupported;
  69545. function getComputeMaximumHeightFunction(primitive) {
  69546. return function(granularity, ellipsoid) {
  69547. const r2 = ellipsoid.maximumRadius;
  69548. const delta = r2 / Math.cos(granularity * 0.5) - r2;
  69549. return primitive._maxHeight + delta;
  69550. };
  69551. }
  69552. function getComputeMinimumHeightFunction(primitive) {
  69553. return function(granularity, ellipsoid) {
  69554. return primitive._minHeight;
  69555. };
  69556. }
  69557. var scratchBVCartesianHigh = new Cartesian3_default();
  69558. var scratchBVCartesianLow = new Cartesian3_default();
  69559. var scratchBVCartesian = new Cartesian3_default();
  69560. var scratchBVCartographic2 = new Cartographic_default();
  69561. var scratchBVRectangle = new Rectangle_default();
  69562. function getRectangle(frameState, geometry) {
  69563. const ellipsoid = frameState.mapProjection.ellipsoid;
  69564. if (!defined_default(geometry.attributes) || !defined_default(geometry.attributes.position3DHigh)) {
  69565. if (defined_default(geometry.rectangle)) {
  69566. return geometry.rectangle;
  69567. }
  69568. return void 0;
  69569. }
  69570. const highPositions = geometry.attributes.position3DHigh.values;
  69571. const lowPositions = geometry.attributes.position3DLow.values;
  69572. const length3 = highPositions.length;
  69573. let minLat = Number.POSITIVE_INFINITY;
  69574. let minLon = Number.POSITIVE_INFINITY;
  69575. let maxLat = Number.NEGATIVE_INFINITY;
  69576. let maxLon = Number.NEGATIVE_INFINITY;
  69577. for (let i2 = 0; i2 < length3; i2 += 3) {
  69578. const highPosition = Cartesian3_default.unpack(
  69579. highPositions,
  69580. i2,
  69581. scratchBVCartesianHigh
  69582. );
  69583. const lowPosition = Cartesian3_default.unpack(
  69584. lowPositions,
  69585. i2,
  69586. scratchBVCartesianLow
  69587. );
  69588. const position = Cartesian3_default.add(
  69589. highPosition,
  69590. lowPosition,
  69591. scratchBVCartesian
  69592. );
  69593. const cartographic2 = ellipsoid.cartesianToCartographic(
  69594. position,
  69595. scratchBVCartographic2
  69596. );
  69597. const latitude = cartographic2.latitude;
  69598. const longitude = cartographic2.longitude;
  69599. minLat = Math.min(minLat, latitude);
  69600. minLon = Math.min(minLon, longitude);
  69601. maxLat = Math.max(maxLat, latitude);
  69602. maxLon = Math.max(maxLon, longitude);
  69603. }
  69604. const rectangle = scratchBVRectangle;
  69605. rectangle.north = maxLat;
  69606. rectangle.south = minLat;
  69607. rectangle.east = maxLon;
  69608. rectangle.west = minLon;
  69609. return rectangle;
  69610. }
  69611. function setMinMaxTerrainHeights(primitive, rectangle, ellipsoid) {
  69612. const result = ApproximateTerrainHeights_default.getMinimumMaximumHeights(
  69613. rectangle,
  69614. ellipsoid
  69615. );
  69616. primitive._minTerrainHeight = result.minimumTerrainHeight;
  69617. primitive._maxTerrainHeight = result.maximumTerrainHeight;
  69618. }
  69619. function createBoundingVolume(groundPrimitive, frameState, geometry) {
  69620. const ellipsoid = frameState.mapProjection.ellipsoid;
  69621. const rectangle = getRectangle(frameState, geometry);
  69622. const obb = OrientedBoundingBox_default.fromRectangle(
  69623. rectangle,
  69624. groundPrimitive._minHeight,
  69625. groundPrimitive._maxHeight,
  69626. ellipsoid
  69627. );
  69628. groundPrimitive._boundingVolumes.push(obb);
  69629. if (!frameState.scene3DOnly) {
  69630. const projection = frameState.mapProjection;
  69631. const boundingVolume = BoundingSphere_default.fromRectangleWithHeights2D(
  69632. rectangle,
  69633. projection,
  69634. groundPrimitive._maxHeight,
  69635. groundPrimitive._minHeight
  69636. );
  69637. Cartesian3_default.fromElements(
  69638. boundingVolume.center.z,
  69639. boundingVolume.center.x,
  69640. boundingVolume.center.y,
  69641. boundingVolume.center
  69642. );
  69643. groundPrimitive._boundingVolumes2D.push(boundingVolume);
  69644. }
  69645. }
  69646. function boundingVolumeIndex2(commandIndex, length3) {
  69647. return Math.floor(commandIndex % length3 / 2);
  69648. }
  69649. function updateAndQueueRenderCommand2(groundPrimitive, command, frameState, modelMatrix, cull, boundingVolume, debugShowBoundingVolume2) {
  69650. const classificationPrimitive = groundPrimitive._primitive;
  69651. if (frameState.mode !== SceneMode_default.SCENE3D && command.shaderProgram === classificationPrimitive._spColor && classificationPrimitive._needs2DShader) {
  69652. command = command.derivedCommands.appearance2D;
  69653. }
  69654. command.owner = groundPrimitive;
  69655. command.modelMatrix = modelMatrix;
  69656. command.boundingVolume = boundingVolume;
  69657. command.cull = cull;
  69658. command.debugShowBoundingVolume = debugShowBoundingVolume2;
  69659. frameState.commandList.push(command);
  69660. }
  69661. function updateAndQueuePickCommand2(groundPrimitive, command, frameState, modelMatrix, cull, boundingVolume) {
  69662. const classificationPrimitive = groundPrimitive._primitive;
  69663. if (frameState.mode !== SceneMode_default.SCENE3D && command.shaderProgram === classificationPrimitive._spPick && classificationPrimitive._needs2DShader) {
  69664. command = command.derivedCommands.pick2D;
  69665. }
  69666. command.owner = groundPrimitive;
  69667. command.modelMatrix = modelMatrix;
  69668. command.boundingVolume = boundingVolume;
  69669. command.cull = cull;
  69670. frameState.commandList.push(command);
  69671. }
  69672. function updateAndQueueCommands3(groundPrimitive, frameState, colorCommands, pickCommands, modelMatrix, cull, debugShowBoundingVolume2, twoPasses) {
  69673. let boundingVolumes;
  69674. if (frameState.mode === SceneMode_default.SCENE3D) {
  69675. boundingVolumes = groundPrimitive._boundingVolumes;
  69676. } else {
  69677. boundingVolumes = groundPrimitive._boundingVolumes2D;
  69678. }
  69679. const classificationType = groundPrimitive.classificationType;
  69680. const queueTerrainCommands = classificationType !== ClassificationType_default.CESIUM_3D_TILE;
  69681. const queue3DTilesCommands = classificationType !== ClassificationType_default.TERRAIN;
  69682. const passes = frameState.passes;
  69683. const classificationPrimitive = groundPrimitive._primitive;
  69684. let i2;
  69685. let boundingVolume;
  69686. let command;
  69687. if (passes.render) {
  69688. const colorLength = colorCommands.length;
  69689. for (i2 = 0; i2 < colorLength; ++i2) {
  69690. boundingVolume = boundingVolumes[boundingVolumeIndex2(i2, colorLength)];
  69691. if (queueTerrainCommands) {
  69692. command = colorCommands[i2];
  69693. updateAndQueueRenderCommand2(
  69694. groundPrimitive,
  69695. command,
  69696. frameState,
  69697. modelMatrix,
  69698. cull,
  69699. boundingVolume,
  69700. debugShowBoundingVolume2
  69701. );
  69702. }
  69703. if (queue3DTilesCommands) {
  69704. command = colorCommands[i2].derivedCommands.tileset;
  69705. updateAndQueueRenderCommand2(
  69706. groundPrimitive,
  69707. command,
  69708. frameState,
  69709. modelMatrix,
  69710. cull,
  69711. boundingVolume,
  69712. debugShowBoundingVolume2
  69713. );
  69714. }
  69715. }
  69716. if (frameState.invertClassification) {
  69717. const ignoreShowCommands = classificationPrimitive._commandsIgnoreShow;
  69718. const ignoreShowCommandsLength = ignoreShowCommands.length;
  69719. for (i2 = 0; i2 < ignoreShowCommandsLength; ++i2) {
  69720. boundingVolume = boundingVolumes[i2];
  69721. command = ignoreShowCommands[i2];
  69722. updateAndQueueRenderCommand2(
  69723. groundPrimitive,
  69724. command,
  69725. frameState,
  69726. modelMatrix,
  69727. cull,
  69728. boundingVolume,
  69729. debugShowBoundingVolume2
  69730. );
  69731. }
  69732. }
  69733. }
  69734. if (passes.pick) {
  69735. const pickLength = pickCommands.length;
  69736. let pickOffsets;
  69737. if (!groundPrimitive._useFragmentCulling) {
  69738. pickOffsets = classificationPrimitive._primitive._pickOffsets;
  69739. }
  69740. for (i2 = 0; i2 < pickLength; ++i2) {
  69741. boundingVolume = boundingVolumes[boundingVolumeIndex2(i2, pickLength)];
  69742. if (!groundPrimitive._useFragmentCulling) {
  69743. const pickOffset = pickOffsets[boundingVolumeIndex2(i2, pickLength)];
  69744. boundingVolume = boundingVolumes[pickOffset.index];
  69745. }
  69746. if (queueTerrainCommands) {
  69747. command = pickCommands[i2];
  69748. updateAndQueuePickCommand2(
  69749. groundPrimitive,
  69750. command,
  69751. frameState,
  69752. modelMatrix,
  69753. cull,
  69754. boundingVolume
  69755. );
  69756. }
  69757. if (queue3DTilesCommands) {
  69758. command = pickCommands[i2].derivedCommands.tileset;
  69759. updateAndQueuePickCommand2(
  69760. groundPrimitive,
  69761. command,
  69762. frameState,
  69763. modelMatrix,
  69764. cull,
  69765. boundingVolume
  69766. );
  69767. }
  69768. }
  69769. }
  69770. }
  69771. GroundPrimitive.initializeTerrainHeights = function() {
  69772. return ApproximateTerrainHeights_default.initialize();
  69773. };
  69774. GroundPrimitive.prototype.update = function(frameState) {
  69775. if (!defined_default(this._primitive) && !defined_default(this.geometryInstances)) {
  69776. return;
  69777. }
  69778. if (!ApproximateTerrainHeights_default.initialized) {
  69779. if (!this.asynchronous) {
  69780. throw new DeveloperError_default(
  69781. "For synchronous GroundPrimitives, you must call GroundPrimitive.initializeTerrainHeights() and wait for the returned promise to resolve."
  69782. );
  69783. }
  69784. GroundPrimitive.initializeTerrainHeights();
  69785. return;
  69786. }
  69787. const that = this;
  69788. const primitiveOptions = this._classificationPrimitiveOptions;
  69789. if (!defined_default(this._primitive)) {
  69790. const ellipsoid = frameState.mapProjection.ellipsoid;
  69791. let instance;
  69792. let geometry;
  69793. let instanceType;
  69794. const instances = Array.isArray(this.geometryInstances) ? this.geometryInstances : [this.geometryInstances];
  69795. const length3 = instances.length;
  69796. const groundInstances = new Array(length3);
  69797. let i2;
  69798. let rectangle;
  69799. for (i2 = 0; i2 < length3; ++i2) {
  69800. instance = instances[i2];
  69801. geometry = instance.geometry;
  69802. const instanceRectangle = getRectangle(frameState, geometry);
  69803. if (!defined_default(rectangle)) {
  69804. rectangle = Rectangle_default.clone(instanceRectangle);
  69805. } else if (defined_default(instanceRectangle)) {
  69806. Rectangle_default.union(rectangle, instanceRectangle, rectangle);
  69807. }
  69808. const id = instance.id;
  69809. if (defined_default(id) && defined_default(instanceRectangle)) {
  69810. const boundingSphere = ApproximateTerrainHeights_default.getBoundingSphere(
  69811. instanceRectangle,
  69812. ellipsoid
  69813. );
  69814. this._boundingSpheresKeys.push(id);
  69815. this._boundingSpheres.push(boundingSphere);
  69816. }
  69817. instanceType = geometry.constructor;
  69818. if (!defined_default(instanceType) || !defined_default(instanceType.createShadowVolume)) {
  69819. throw new DeveloperError_default(
  69820. "Not all of the geometry instances have GroundPrimitive support."
  69821. );
  69822. }
  69823. }
  69824. setMinMaxTerrainHeights(this, rectangle, ellipsoid);
  69825. const exaggeration = frameState.terrainExaggeration;
  69826. const exaggerationRelativeHeight = frameState.terrainExaggerationRelativeHeight;
  69827. this._minHeight = TerrainExaggeration_default.getHeight(
  69828. this._minTerrainHeight,
  69829. exaggeration,
  69830. exaggerationRelativeHeight
  69831. );
  69832. this._maxHeight = TerrainExaggeration_default.getHeight(
  69833. this._maxTerrainHeight,
  69834. exaggeration,
  69835. exaggerationRelativeHeight
  69836. );
  69837. const useFragmentCulling = GroundPrimitive._supportsMaterials(
  69838. frameState.context
  69839. );
  69840. this._useFragmentCulling = useFragmentCulling;
  69841. if (useFragmentCulling) {
  69842. let attributes;
  69843. let usePlanarExtents = true;
  69844. for (i2 = 0; i2 < length3; ++i2) {
  69845. instance = instances[i2];
  69846. geometry = instance.geometry;
  69847. rectangle = getRectangle(frameState, geometry);
  69848. if (ShadowVolumeAppearance_default.shouldUseSphericalCoordinates(rectangle)) {
  69849. usePlanarExtents = false;
  69850. break;
  69851. }
  69852. }
  69853. for (i2 = 0; i2 < length3; ++i2) {
  69854. instance = instances[i2];
  69855. geometry = instance.geometry;
  69856. instanceType = geometry.constructor;
  69857. const boundingRectangle = getRectangle(frameState, geometry);
  69858. const textureCoordinateRotationPoints4 = geometry.textureCoordinateRotationPoints;
  69859. if (usePlanarExtents) {
  69860. attributes = ShadowVolumeAppearance_default.getPlanarTextureCoordinateAttributes(
  69861. boundingRectangle,
  69862. textureCoordinateRotationPoints4,
  69863. ellipsoid,
  69864. frameState.mapProjection,
  69865. this._maxHeight
  69866. );
  69867. } else {
  69868. attributes = ShadowVolumeAppearance_default.getSphericalExtentGeometryInstanceAttributes(
  69869. boundingRectangle,
  69870. textureCoordinateRotationPoints4,
  69871. ellipsoid,
  69872. frameState.mapProjection
  69873. );
  69874. }
  69875. const instanceAttributes = instance.attributes;
  69876. for (const attributeKey in instanceAttributes) {
  69877. if (instanceAttributes.hasOwnProperty(attributeKey)) {
  69878. attributes[attributeKey] = instanceAttributes[attributeKey];
  69879. }
  69880. }
  69881. groundInstances[i2] = new GeometryInstance_default({
  69882. geometry: instanceType.createShadowVolume(
  69883. geometry,
  69884. getComputeMinimumHeightFunction(this),
  69885. getComputeMaximumHeightFunction(this)
  69886. ),
  69887. attributes,
  69888. id: instance.id
  69889. });
  69890. }
  69891. } else {
  69892. for (i2 = 0; i2 < length3; ++i2) {
  69893. instance = instances[i2];
  69894. geometry = instance.geometry;
  69895. instanceType = geometry.constructor;
  69896. groundInstances[i2] = new GeometryInstance_default({
  69897. geometry: instanceType.createShadowVolume(
  69898. geometry,
  69899. getComputeMinimumHeightFunction(this),
  69900. getComputeMaximumHeightFunction(this)
  69901. ),
  69902. attributes: instance.attributes,
  69903. id: instance.id
  69904. });
  69905. }
  69906. }
  69907. primitiveOptions.geometryInstances = groundInstances;
  69908. primitiveOptions.appearance = this.appearance;
  69909. primitiveOptions._createBoundingVolumeFunction = function(frameState2, geometry2) {
  69910. createBoundingVolume(that, frameState2, geometry2);
  69911. };
  69912. primitiveOptions._updateAndQueueCommandsFunction = function(primitive, frameState2, colorCommands, pickCommands, modelMatrix, cull, debugShowBoundingVolume2, twoPasses) {
  69913. updateAndQueueCommands3(
  69914. that,
  69915. frameState2,
  69916. colorCommands,
  69917. pickCommands,
  69918. modelMatrix,
  69919. cull,
  69920. debugShowBoundingVolume2,
  69921. twoPasses
  69922. );
  69923. };
  69924. this._primitive = new ClassificationPrimitive_default(primitiveOptions);
  69925. this._primitive.readyPromise.then(function(primitive) {
  69926. that._ready = true;
  69927. if (that.releaseGeometryInstances) {
  69928. that.geometryInstances = void 0;
  69929. }
  69930. const error = primitive._error;
  69931. if (!defined_default(error)) {
  69932. that._readyPromise.resolve(that);
  69933. } else {
  69934. that._readyPromise.reject(error);
  69935. }
  69936. });
  69937. }
  69938. this._primitive.appearance = this.appearance;
  69939. this._primitive.show = this.show;
  69940. this._primitive.debugShowShadowVolume = this.debugShowShadowVolume;
  69941. this._primitive.debugShowBoundingVolume = this.debugShowBoundingVolume;
  69942. this._primitive.update(frameState);
  69943. };
  69944. GroundPrimitive.prototype.getBoundingSphere = function(id) {
  69945. const index2 = this._boundingSpheresKeys.indexOf(id);
  69946. if (index2 !== -1) {
  69947. return this._boundingSpheres[index2];
  69948. }
  69949. return void 0;
  69950. };
  69951. GroundPrimitive.prototype.getGeometryInstanceAttributes = function(id) {
  69952. if (!defined_default(this._primitive)) {
  69953. throw new DeveloperError_default(
  69954. "must call update before calling getGeometryInstanceAttributes"
  69955. );
  69956. }
  69957. return this._primitive.getGeometryInstanceAttributes(id);
  69958. };
  69959. GroundPrimitive.prototype.isDestroyed = function() {
  69960. return false;
  69961. };
  69962. GroundPrimitive.prototype.destroy = function() {
  69963. this._primitive = this._primitive && this._primitive.destroy();
  69964. return destroyObject_default(this);
  69965. };
  69966. GroundPrimitive._supportsMaterials = function(context) {
  69967. return context.depthTexture;
  69968. };
  69969. GroundPrimitive.supportsMaterials = function(scene) {
  69970. Check_default.typeOf.object("scene", scene);
  69971. return GroundPrimitive._supportsMaterials(scene.frameState.context);
  69972. };
  69973. var GroundPrimitive_default = GroundPrimitive;
  69974. // node_modules/cesium/Source/DataSources/MaterialProperty.js
  69975. function MaterialProperty() {
  69976. DeveloperError_default.throwInstantiationError();
  69977. }
  69978. Object.defineProperties(MaterialProperty.prototype, {
  69979. isConstant: {
  69980. get: DeveloperError_default.throwInstantiationError
  69981. },
  69982. definitionChanged: {
  69983. get: DeveloperError_default.throwInstantiationError
  69984. }
  69985. });
  69986. MaterialProperty.prototype.getType = DeveloperError_default.throwInstantiationError;
  69987. MaterialProperty.prototype.getValue = DeveloperError_default.throwInstantiationError;
  69988. MaterialProperty.prototype.equals = DeveloperError_default.throwInstantiationError;
  69989. MaterialProperty.getValue = function(time, materialProperty, material) {
  69990. let type;
  69991. if (defined_default(materialProperty)) {
  69992. type = materialProperty.getType(time);
  69993. if (defined_default(type)) {
  69994. if (!defined_default(material) || material.type !== type) {
  69995. material = Material_default.fromType(type);
  69996. }
  69997. materialProperty.getValue(time, material.uniforms);
  69998. return material;
  69999. }
  70000. }
  70001. if (!defined_default(material) || material.type !== Material_default.ColorType) {
  70002. material = Material_default.fromType(Material_default.ColorType);
  70003. }
  70004. Color_default.clone(Color_default.WHITE, material.uniforms.color);
  70005. return material;
  70006. };
  70007. var MaterialProperty_default = MaterialProperty;
  70008. // node_modules/cesium/Source/DataSources/DynamicGeometryUpdater.js
  70009. function DynamicGeometryUpdater(geometryUpdater, primitives, orderedGroundPrimitives) {
  70010. Check_default.defined("geometryUpdater", geometryUpdater);
  70011. Check_default.defined("primitives", primitives);
  70012. Check_default.defined("orderedGroundPrimitives", orderedGroundPrimitives);
  70013. this._primitives = primitives;
  70014. this._orderedGroundPrimitives = orderedGroundPrimitives;
  70015. this._primitive = void 0;
  70016. this._outlinePrimitive = void 0;
  70017. this._geometryUpdater = geometryUpdater;
  70018. this._options = geometryUpdater._options;
  70019. this._entity = geometryUpdater._entity;
  70020. this._material = void 0;
  70021. }
  70022. DynamicGeometryUpdater.prototype._isHidden = function(entity, geometry, time) {
  70023. return !entity.isShowing || !entity.isAvailable(time) || !Property_default.getValueOrDefault(geometry.show, time, true);
  70024. };
  70025. DynamicGeometryUpdater.prototype._setOptions = DeveloperError_default.throwInstantiationError;
  70026. DynamicGeometryUpdater.prototype.update = function(time) {
  70027. Check_default.defined("time", time);
  70028. const geometryUpdater = this._geometryUpdater;
  70029. const onTerrain = geometryUpdater._onTerrain;
  70030. const primitives = this._primitives;
  70031. const orderedGroundPrimitives = this._orderedGroundPrimitives;
  70032. if (onTerrain) {
  70033. orderedGroundPrimitives.remove(this._primitive);
  70034. } else {
  70035. primitives.removeAndDestroy(this._primitive);
  70036. primitives.removeAndDestroy(this._outlinePrimitive);
  70037. this._outlinePrimitive = void 0;
  70038. }
  70039. this._primitive = void 0;
  70040. const entity = this._entity;
  70041. const geometry = entity[this._geometryUpdater._geometryPropertyName];
  70042. this._setOptions(entity, geometry, time);
  70043. if (this._isHidden(entity, geometry, time)) {
  70044. return;
  70045. }
  70046. const shadows = this._geometryUpdater.shadowsProperty.getValue(time);
  70047. const options = this._options;
  70048. if (!defined_default(geometry.fill) || geometry.fill.getValue(time)) {
  70049. const fillMaterialProperty = geometryUpdater.fillMaterialProperty;
  70050. const isColorAppearance = fillMaterialProperty instanceof ColorMaterialProperty_default;
  70051. let appearance;
  70052. const closed = geometryUpdater._getIsClosed(options);
  70053. if (isColorAppearance) {
  70054. appearance = new PerInstanceColorAppearance_default({
  70055. closed,
  70056. flat: onTerrain && !geometryUpdater._supportsMaterialsforEntitiesOnTerrain
  70057. });
  70058. } else {
  70059. const material = MaterialProperty_default.getValue(
  70060. time,
  70061. fillMaterialProperty,
  70062. this._material
  70063. );
  70064. this._material = material;
  70065. appearance = new MaterialAppearance_default({
  70066. material,
  70067. translucent: material.isTranslucent(),
  70068. closed
  70069. });
  70070. }
  70071. if (onTerrain) {
  70072. options.vertexFormat = PerInstanceColorAppearance_default.VERTEX_FORMAT;
  70073. this._primitive = orderedGroundPrimitives.add(
  70074. new GroundPrimitive_default({
  70075. geometryInstances: this._geometryUpdater.createFillGeometryInstance(
  70076. time
  70077. ),
  70078. appearance,
  70079. asynchronous: false,
  70080. shadows,
  70081. classificationType: this._geometryUpdater.classificationTypeProperty.getValue(
  70082. time
  70083. )
  70084. }),
  70085. Property_default.getValueOrUndefined(this._geometryUpdater.zIndex, time)
  70086. );
  70087. } else {
  70088. options.vertexFormat = appearance.vertexFormat;
  70089. const fillInstance = this._geometryUpdater.createFillGeometryInstance(
  70090. time
  70091. );
  70092. if (isColorAppearance) {
  70093. appearance.translucent = fillInstance.attributes.color.value[3] !== 255;
  70094. }
  70095. this._primitive = primitives.add(
  70096. new Primitive_default({
  70097. geometryInstances: fillInstance,
  70098. appearance,
  70099. asynchronous: false,
  70100. shadows
  70101. })
  70102. );
  70103. }
  70104. }
  70105. if (!onTerrain && defined_default(geometry.outline) && geometry.outline.getValue(time)) {
  70106. const outlineInstance = this._geometryUpdater.createOutlineGeometryInstance(
  70107. time
  70108. );
  70109. const outlineWidth = Property_default.getValueOrDefault(
  70110. geometry.outlineWidth,
  70111. time,
  70112. 1
  70113. );
  70114. this._outlinePrimitive = primitives.add(
  70115. new Primitive_default({
  70116. geometryInstances: outlineInstance,
  70117. appearance: new PerInstanceColorAppearance_default({
  70118. flat: true,
  70119. translucent: outlineInstance.attributes.color.value[3] !== 255,
  70120. renderState: {
  70121. lineWidth: geometryUpdater._scene.clampLineWidth(outlineWidth)
  70122. }
  70123. }),
  70124. asynchronous: false,
  70125. shadows
  70126. })
  70127. );
  70128. }
  70129. };
  70130. DynamicGeometryUpdater.prototype.getBoundingSphere = function(result) {
  70131. if (!defined_default(result)) {
  70132. throw new DeveloperError_default("result is required.");
  70133. }
  70134. const entity = this._entity;
  70135. const primitive = this._primitive;
  70136. const outlinePrimitive = this._outlinePrimitive;
  70137. let attributes;
  70138. if (defined_default(primitive) && primitive.show && primitive.ready) {
  70139. attributes = primitive.getGeometryInstanceAttributes(entity);
  70140. if (defined_default(attributes) && defined_default(attributes.boundingSphere)) {
  70141. BoundingSphere_default.clone(attributes.boundingSphere, result);
  70142. return BoundingSphereState_default.DONE;
  70143. }
  70144. }
  70145. if (defined_default(outlinePrimitive) && outlinePrimitive.show && outlinePrimitive.ready) {
  70146. attributes = outlinePrimitive.getGeometryInstanceAttributes(entity);
  70147. if (defined_default(attributes) && defined_default(attributes.boundingSphere)) {
  70148. BoundingSphere_default.clone(attributes.boundingSphere, result);
  70149. return BoundingSphereState_default.DONE;
  70150. }
  70151. }
  70152. if (defined_default(primitive) && !primitive.ready || defined_default(outlinePrimitive) && !outlinePrimitive.ready) {
  70153. return BoundingSphereState_default.PENDING;
  70154. }
  70155. return BoundingSphereState_default.FAILED;
  70156. };
  70157. DynamicGeometryUpdater.prototype.isDestroyed = function() {
  70158. return false;
  70159. };
  70160. DynamicGeometryUpdater.prototype.destroy = function() {
  70161. const primitives = this._primitives;
  70162. const orderedGroundPrimitives = this._orderedGroundPrimitives;
  70163. if (this._geometryUpdater._onTerrain) {
  70164. orderedGroundPrimitives.remove(this._primitive);
  70165. } else {
  70166. primitives.removeAndDestroy(this._primitive);
  70167. }
  70168. primitives.removeAndDestroy(this._outlinePrimitive);
  70169. destroyObject_default(this);
  70170. };
  70171. var DynamicGeometryUpdater_default = DynamicGeometryUpdater;
  70172. // node_modules/cesium/Source/Shaders/PolylineShadowVolumeFS.js
  70173. var PolylineShadowVolumeFS_default = '#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\n\nvarying vec4 v_startPlaneNormalEcAndHalfWidth;\nvarying vec4 v_endPlaneNormalEcAndBatchId;\nvarying vec4 v_rightPlaneEC; // Technically can compute distance for this here\nvarying vec4 v_endEcAndStartEcX;\nvarying vec4 v_texcoordNormalizationAndStartEcYZ;\n\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#endif\n\nvoid main(void)\n{\n float logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture2D(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw)));\n vec3 ecStart = vec3(v_endEcAndStartEcX.w, v_texcoordNormalizationAndStartEcYZ.zw);\n\n // Discard for sky\n if (logDepthOrDepth == 0.0) {\n#ifdef DEBUG_SHOW_VOLUME\n gl_FragColor = vec4(1.0, 0.0, 0.0, 0.5);\n return;\n#else // DEBUG_SHOW_VOLUME\n discard;\n#endif // DEBUG_SHOW_VOLUME\n }\n\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\n eyeCoordinate /= eyeCoordinate.w;\n\n float halfMaxWidth = v_startPlaneNormalEcAndHalfWidth.w * czm_metersPerPixel(eyeCoordinate);\n // Check distance of the eye coordinate against the right-facing plane\n float widthwiseDistance = czm_planeDistance(v_rightPlaneEC, eyeCoordinate.xyz);\n\n // Check eye coordinate against the mitering planes\n float distanceFromStart = czm_planeDistance(v_startPlaneNormalEcAndHalfWidth.xyz, -dot(ecStart, v_startPlaneNormalEcAndHalfWidth.xyz), eyeCoordinate.xyz);\n float distanceFromEnd = czm_planeDistance(v_endPlaneNormalEcAndBatchId.xyz, -dot(v_endEcAndStartEcX.xyz, v_endPlaneNormalEcAndBatchId.xyz), eyeCoordinate.xyz);\n\n if (abs(widthwiseDistance) > halfMaxWidth || distanceFromStart < 0.0 || distanceFromEnd < 0.0) {\n#ifdef DEBUG_SHOW_VOLUME\n gl_FragColor = vec4(1.0, 0.0, 0.0, 0.5);\n return;\n#else // DEBUG_SHOW_VOLUME\n discard;\n#endif // DEBUG_SHOW_VOLUME\n }\n\n // Check distance of the eye coordinate against start and end planes with normals in the right plane.\n // For computing unskewed lengthwise texture coordinate.\n // Can also be used for clipping extremely pointy miters, but in practice unnecessary because of miter breaking.\n\n // aligned plane: cross the right plane normal with miter plane normal, then cross the result with right again to point it more "forward"\n vec3 alignedPlaneNormal;\n\n // start aligned plane\n alignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_startPlaneNormalEcAndHalfWidth.xyz);\n alignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz));\n distanceFromStart = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, ecStart), eyeCoordinate.xyz);\n\n // end aligned plane\n alignedPlaneNormal = cross(v_rightPlaneEC.xyz, v_endPlaneNormalEcAndBatchId.xyz);\n alignedPlaneNormal = normalize(cross(alignedPlaneNormal, v_rightPlaneEC.xyz));\n distanceFromEnd = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, v_endEcAndStartEcX.xyz), eyeCoordinate.xyz);\n\n#ifdef PER_INSTANCE_COLOR\n gl_FragColor = czm_gammaCorrect(v_color);\n#else // PER_INSTANCE_COLOR\n // Clamp - distance to aligned planes may be negative due to mitering,\n // so fragment texture coordinate might be out-of-bounds.\n float s = clamp(distanceFromStart / (distanceFromStart + distanceFromEnd), 0.0, 1.0);\n s = (s * v_texcoordNormalizationAndStartEcYZ.x) + v_texcoordNormalizationAndStartEcYZ.y;\n float t = (widthwiseDistance + halfMaxWidth) / (2.0 * halfMaxWidth);\n\n czm_materialInput materialInput;\n\n materialInput.s = s;\n materialInput.st = vec2(s, t);\n materialInput.str = vec3(s, t, 0.0);\n\n czm_material material = czm_getMaterial(materialInput);\n gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#endif // PER_INSTANCE_COLOR\n\n // Premultiply alpha. Required for classification primitives on translucent globe.\n gl_FragColor.rgb *= gl_FragColor.a;\n\n czm_writeDepthClamp();\n}\n';
  70174. // node_modules/cesium/Source/Shaders/PolylineShadowVolumeMorphFS.js
  70175. var PolylineShadowVolumeMorphFS_default = "varying vec3 v_forwardDirectionEC;\nvarying vec3 v_texcoordNormalizationAndHalfWidth;\nvarying float v_batchId;\n\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#else\nvarying vec2 v_alignedPlaneDistances;\nvarying float v_texcoordT;\n#endif\n\nfloat rayPlaneDistanceUnsafe(vec3 origin, vec3 direction, vec3 planeNormal, float planeDistance) {\n // We don't expect the ray to ever be parallel to the plane\n return (-planeDistance - dot(planeNormal, origin)) / dot(planeNormal, direction);\n}\n\nvoid main(void)\n{\n vec4 eyeCoordinate = gl_FragCoord;\n eyeCoordinate /= eyeCoordinate.w;\n\n#ifdef PER_INSTANCE_COLOR\n gl_FragColor = czm_gammaCorrect(v_color);\n#else // PER_INSTANCE_COLOR\n // Use distances for planes aligned with segment to prevent skew in dashing\n float distanceFromStart = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, -v_forwardDirectionEC, v_forwardDirectionEC.xyz, v_alignedPlaneDistances.x);\n float distanceFromEnd = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, v_forwardDirectionEC, -v_forwardDirectionEC.xyz, v_alignedPlaneDistances.y);\n\n // Clamp - distance to aligned planes may be negative due to mitering\n distanceFromStart = max(0.0, distanceFromStart);\n distanceFromEnd = max(0.0, distanceFromEnd);\n\n float s = distanceFromStart / (distanceFromStart + distanceFromEnd);\n s = (s * v_texcoordNormalizationAndHalfWidth.x) + v_texcoordNormalizationAndHalfWidth.y;\n\n czm_materialInput materialInput;\n\n materialInput.s = s;\n materialInput.st = vec2(s, v_texcoordT);\n materialInput.str = vec3(s, v_texcoordT, 0.0);\n\n czm_material material = czm_getMaterial(materialInput);\n gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#endif // PER_INSTANCE_COLOR\n}\n";
  70176. // node_modules/cesium/Source/Shaders/PolylineShadowVolumeMorphVS.js
  70177. var PolylineShadowVolumeMorphVS_default = `attribute vec3 position3DHigh;
  70178. attribute vec3 position3DLow;
  70179. attribute vec4 startHiAndForwardOffsetX;
  70180. attribute vec4 startLoAndForwardOffsetY;
  70181. attribute vec4 startNormalAndForwardOffsetZ;
  70182. attribute vec4 endNormalAndTextureCoordinateNormalizationX;
  70183. attribute vec4 rightNormalAndTextureCoordinateNormalizationY;
  70184. attribute vec4 startHiLo2D;
  70185. attribute vec4 offsetAndRight2D;
  70186. attribute vec4 startEndNormals2D;
  70187. attribute vec2 texcoordNormalization2D;
  70188. attribute float batchId;
  70189. varying vec3 v_forwardDirectionEC;
  70190. varying vec3 v_texcoordNormalizationAndHalfWidth;
  70191. varying float v_batchId;
  70192. // For materials
  70193. #ifdef WIDTH_VARYING
  70194. varying float v_width;
  70195. #endif
  70196. #ifdef ANGLE_VARYING
  70197. varying float v_polylineAngle;
  70198. #endif
  70199. #ifdef PER_INSTANCE_COLOR
  70200. varying vec4 v_color;
  70201. #else
  70202. varying vec2 v_alignedPlaneDistances;
  70203. varying float v_texcoordT;
  70204. #endif
  70205. // Morphing planes using SLERP or NLERP doesn't seem to work, so instead draw the material directly on the shadow volume.
  70206. // Morph views are from very far away and aren't meant to be used precisely, so this should be sufficient.
  70207. void main()
  70208. {
  70209. v_batchId = batchId;
  70210. // Start position
  70211. vec4 posRelativeToEye2D = czm_translateRelativeToEye(vec3(0.0, startHiLo2D.xy), vec3(0.0, startHiLo2D.zw));
  70212. vec4 posRelativeToEye3D = czm_translateRelativeToEye(startHiAndForwardOffsetX.xyz, startLoAndForwardOffsetY.xyz);
  70213. vec4 posRelativeToEye = czm_columbusViewMorph(posRelativeToEye2D, posRelativeToEye3D, czm_morphTime);
  70214. vec3 posEc2D = (czm_modelViewRelativeToEye * posRelativeToEye2D).xyz;
  70215. vec3 posEc3D = (czm_modelViewRelativeToEye * posRelativeToEye3D).xyz;
  70216. vec3 startEC = (czm_modelViewRelativeToEye * posRelativeToEye).xyz;
  70217. // Start plane
  70218. vec4 startPlane2D;
  70219. vec4 startPlane3D;
  70220. startPlane2D.xyz = czm_normal * vec3(0.0, startEndNormals2D.xy);
  70221. startPlane3D.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz;
  70222. startPlane2D.w = -dot(startPlane2D.xyz, posEc2D);
  70223. startPlane3D.w = -dot(startPlane3D.xyz, posEc3D);
  70224. // Right plane
  70225. vec4 rightPlane2D;
  70226. vec4 rightPlane3D;
  70227. rightPlane2D.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw);
  70228. rightPlane3D.xyz = czm_normal * rightNormalAndTextureCoordinateNormalizationY.xyz;
  70229. rightPlane2D.w = -dot(rightPlane2D.xyz, posEc2D);
  70230. rightPlane3D.w = -dot(rightPlane3D.xyz, posEc3D);
  70231. // End position
  70232. posRelativeToEye2D = posRelativeToEye2D + vec4(0.0, offsetAndRight2D.xy, 0.0);
  70233. posRelativeToEye3D = posRelativeToEye3D + vec4(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w, 0.0);
  70234. posRelativeToEye = czm_columbusViewMorph(posRelativeToEye2D, posRelativeToEye3D, czm_morphTime);
  70235. posEc2D = (czm_modelViewRelativeToEye * posRelativeToEye2D).xyz;
  70236. posEc3D = (czm_modelViewRelativeToEye * posRelativeToEye3D).xyz;
  70237. vec3 endEC = (czm_modelViewRelativeToEye * posRelativeToEye).xyz;
  70238. vec3 forwardEc3D = czm_normal * normalize(vec3(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w));
  70239. vec3 forwardEc2D = czm_normal * normalize(vec3(0.0, offsetAndRight2D.xy));
  70240. // End plane
  70241. vec4 endPlane2D;
  70242. vec4 endPlane3D;
  70243. endPlane2D.xyz = czm_normal * vec3(0.0, startEndNormals2D.zw);
  70244. endPlane3D.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz;
  70245. endPlane2D.w = -dot(endPlane2D.xyz, posEc2D);
  70246. endPlane3D.w = -dot(endPlane3D.xyz, posEc3D);
  70247. // Forward direction
  70248. v_forwardDirectionEC = normalize(endEC - startEC);
  70249. vec2 cleanTexcoordNormalization2D;
  70250. cleanTexcoordNormalization2D.x = abs(texcoordNormalization2D.x);
  70251. cleanTexcoordNormalization2D.y = czm_branchFreeTernary(texcoordNormalization2D.y > 1.0, 0.0, abs(texcoordNormalization2D.y));
  70252. vec2 cleanTexcoordNormalization3D;
  70253. cleanTexcoordNormalization3D.x = abs(endNormalAndTextureCoordinateNormalizationX.w);
  70254. cleanTexcoordNormalization3D.y = rightNormalAndTextureCoordinateNormalizationY.w;
  70255. cleanTexcoordNormalization3D.y = czm_branchFreeTernary(cleanTexcoordNormalization3D.y > 1.0, 0.0, abs(cleanTexcoordNormalization3D.y));
  70256. v_texcoordNormalizationAndHalfWidth.xy = mix(cleanTexcoordNormalization2D, cleanTexcoordNormalization3D, czm_morphTime);
  70257. #ifdef PER_INSTANCE_COLOR
  70258. v_color = czm_batchTable_color(batchId);
  70259. #else // PER_INSTANCE_COLOR
  70260. // For computing texture coordinates
  70261. v_alignedPlaneDistances.x = -dot(v_forwardDirectionEC, startEC);
  70262. v_alignedPlaneDistances.y = -dot(-v_forwardDirectionEC, endEC);
  70263. #endif // PER_INSTANCE_COLOR
  70264. #ifdef WIDTH_VARYING
  70265. float width = czm_batchTable_width(batchId);
  70266. float halfWidth = width * 0.5;
  70267. v_width = width;
  70268. v_texcoordNormalizationAndHalfWidth.z = halfWidth;
  70269. #else
  70270. float halfWidth = 0.5 * czm_batchTable_width(batchId);
  70271. v_texcoordNormalizationAndHalfWidth.z = halfWidth;
  70272. #endif
  70273. // Compute a normal along which to "push" the position out, extending the miter depending on view distance.
  70274. // Position has already been "pushed" by unit length along miter normal, and miter normals are encoded in the planes.
  70275. // Decode the normal to use at this specific vertex, push the position back, and then push to where it needs to be.
  70276. // Since this is morphing, compute both 3D and 2D positions and then blend.
  70277. // ****** 3D ******
  70278. // Check distance to the end plane and start plane, pick the plane that is closer
  70279. vec4 positionEc3D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position3DHigh, position3DLow); // w = 1.0, see czm_computePosition
  70280. float absStartPlaneDistance = abs(czm_planeDistance(startPlane3D, positionEc3D.xyz));
  70281. float absEndPlaneDistance = abs(czm_planeDistance(endPlane3D, positionEc3D.xyz));
  70282. vec3 planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlane3D.xyz, endPlane3D.xyz);
  70283. vec3 upOrDown = normalize(cross(rightPlane3D.xyz, planeDirection)); // Points "up" for start plane, "down" at end plane.
  70284. vec3 normalEC = normalize(cross(planeDirection, upOrDown)); // In practice, the opposite seems to work too.
  70285. // Nudge the top vertex upwards to prevent flickering
  70286. vec3 geodeticSurfaceNormal = normalize(cross(normalEC, forwardEc3D));
  70287. geodeticSurfaceNormal *= float(0.0 <= rightNormalAndTextureCoordinateNormalizationY.w && rightNormalAndTextureCoordinateNormalizationY.w <= 1.0);
  70288. geodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT;
  70289. positionEc3D.xyz += geodeticSurfaceNormal;
  70290. // Determine if this vertex is on the "left" or "right"
  70291. normalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w);
  70292. // A "perfect" implementation would push along normals according to the angle against forward.
  70293. // In practice, just pushing the normal out by halfWidth is sufficient for morph views.
  70294. positionEc3D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc3D)) * normalEC; // prevent artifacts when czm_metersPerPixel is negative (behind camera)
  70295. // ****** 2D ******
  70296. // Check distance to the end plane and start plane, pick the plane that is closer
  70297. vec4 positionEc2D = czm_modelViewRelativeToEye * czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy); // w = 1.0, see czm_computePosition
  70298. absStartPlaneDistance = abs(czm_planeDistance(startPlane2D, positionEc2D.xyz));
  70299. absEndPlaneDistance = abs(czm_planeDistance(endPlane2D, positionEc2D.xyz));
  70300. planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlane2D.xyz, endPlane2D.xyz);
  70301. upOrDown = normalize(cross(rightPlane2D.xyz, planeDirection)); // Points "up" for start plane, "down" at end plane.
  70302. normalEC = normalize(cross(planeDirection, upOrDown)); // In practice, the opposite seems to work too.
  70303. // Nudge the top vertex upwards to prevent flickering
  70304. geodeticSurfaceNormal = normalize(cross(normalEC, forwardEc2D));
  70305. geodeticSurfaceNormal *= float(0.0 <= texcoordNormalization2D.y && texcoordNormalization2D.y <= 1.0);
  70306. geodeticSurfaceNormal *= MAX_TERRAIN_HEIGHT;
  70307. positionEc2D.xyz += geodeticSurfaceNormal;
  70308. // Determine if this vertex is on the "left" or "right"
  70309. normalEC *= sign(texcoordNormalization2D.x);
  70310. #ifndef PER_INSTANCE_COLOR
  70311. // Use vertex's sidedness to compute its texture coordinate.
  70312. v_texcoordT = clamp(sign(texcoordNormalization2D.x), 0.0, 1.0);
  70313. #endif
  70314. // A "perfect" implementation would push along normals according to the angle against forward.
  70315. // In practice, just pushing the normal out by halfWidth is sufficient for morph views.
  70316. positionEc2D.xyz += halfWidth * max(0.0, czm_metersPerPixel(positionEc2D)) * normalEC; // prevent artifacts when czm_metersPerPixel is negative (behind camera)
  70317. // Blend for actual position
  70318. gl_Position = czm_projection * mix(positionEc2D, positionEc3D, czm_morphTime);
  70319. #ifdef ANGLE_VARYING
  70320. // Approximate relative screen space direction of the line.
  70321. vec2 approxLineDirection = normalize(vec2(v_forwardDirectionEC.x, -v_forwardDirectionEC.y));
  70322. approxLineDirection.y = czm_branchFreeTernary(approxLineDirection.x == 0.0 && approxLineDirection.y == 0.0, -1.0, approxLineDirection.y);
  70323. v_polylineAngle = czm_fastApproximateAtan(approxLineDirection.x, approxLineDirection.y);
  70324. #endif
  70325. }
  70326. `;
  70327. // node_modules/cesium/Source/Shaders/PolylineShadowVolumeVS.js
  70328. var PolylineShadowVolumeVS_default = 'attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\n\n// In 2D and in 3D, texture coordinate normalization component signs encodes:\n// * X sign - sidedness relative to right plane\n// * Y sign - is negative OR magnitude is greater than 1.0 if vertex is on bottom of volume\n#ifndef COLUMBUS_VIEW_2D\nattribute vec4 startHiAndForwardOffsetX;\nattribute vec4 startLoAndForwardOffsetY;\nattribute vec4 startNormalAndForwardOffsetZ;\nattribute vec4 endNormalAndTextureCoordinateNormalizationX;\nattribute vec4 rightNormalAndTextureCoordinateNormalizationY;\n#else\nattribute vec4 startHiLo2D;\nattribute vec4 offsetAndRight2D;\nattribute vec4 startEndNormals2D;\nattribute vec2 texcoordNormalization2D;\n#endif\n\nattribute float batchId;\n\nvarying vec4 v_startPlaneNormalEcAndHalfWidth;\nvarying vec4 v_endPlaneNormalEcAndBatchId;\nvarying vec4 v_rightPlaneEC;\nvarying vec4 v_endEcAndStartEcX;\nvarying vec4 v_texcoordNormalizationAndStartEcYZ;\n\n// For materials\n#ifdef WIDTH_VARYING\nvarying float v_width;\n#endif\n#ifdef ANGLE_VARYING\nvarying float v_polylineAngle;\n#endif\n\n#ifdef PER_INSTANCE_COLOR\nvarying vec4 v_color;\n#endif\n\nvoid main()\n{\n#ifdef COLUMBUS_VIEW_2D\n vec3 ecStart = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(vec3(0.0, startHiLo2D.xy), vec3(0.0, startHiLo2D.zw))).xyz;\n\n vec3 forwardDirectionEC = czm_normal * vec3(0.0, offsetAndRight2D.xy);\n vec3 ecEnd = forwardDirectionEC + ecStart;\n forwardDirectionEC = normalize(forwardDirectionEC);\n\n // Right plane\n v_rightPlaneEC.xyz = czm_normal * vec3(0.0, offsetAndRight2D.zw);\n v_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart);\n\n // start plane\n vec4 startPlaneEC;\n startPlaneEC.xyz = czm_normal * vec3(0.0, startEndNormals2D.xy);\n startPlaneEC.w = -dot(startPlaneEC.xyz, ecStart);\n\n // end plane\n vec4 endPlaneEC;\n endPlaneEC.xyz = czm_normal * vec3(0.0, startEndNormals2D.zw);\n endPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd);\n\n v_texcoordNormalizationAndStartEcYZ.x = abs(texcoordNormalization2D.x);\n v_texcoordNormalizationAndStartEcYZ.y = texcoordNormalization2D.y;\n\n#else // COLUMBUS_VIEW_2D\n vec3 ecStart = (czm_modelViewRelativeToEye * czm_translateRelativeToEye(startHiAndForwardOffsetX.xyz, startLoAndForwardOffsetY.xyz)).xyz;\n vec3 offset = czm_normal * vec3(startHiAndForwardOffsetX.w, startLoAndForwardOffsetY.w, startNormalAndForwardOffsetZ.w);\n vec3 ecEnd = ecStart + offset;\n\n vec3 forwardDirectionEC = normalize(offset);\n\n // start plane\n vec4 startPlaneEC;\n startPlaneEC.xyz = czm_normal * startNormalAndForwardOffsetZ.xyz;\n startPlaneEC.w = -dot(startPlaneEC.xyz, ecStart);\n\n // end plane\n vec4 endPlaneEC;\n endPlaneEC.xyz = czm_normal * endNormalAndTextureCoordinateNormalizationX.xyz;\n endPlaneEC.w = -dot(endPlaneEC.xyz, ecEnd);\n\n // Right plane\n v_rightPlaneEC.xyz = czm_normal * rightNormalAndTextureCoordinateNormalizationY.xyz;\n v_rightPlaneEC.w = -dot(v_rightPlaneEC.xyz, ecStart);\n\n v_texcoordNormalizationAndStartEcYZ.x = abs(endNormalAndTextureCoordinateNormalizationX.w);\n v_texcoordNormalizationAndStartEcYZ.y = rightNormalAndTextureCoordinateNormalizationY.w;\n\n#endif // COLUMBUS_VIEW_2D\n\n v_endEcAndStartEcX.xyz = ecEnd;\n v_endEcAndStartEcX.w = ecStart.x;\n v_texcoordNormalizationAndStartEcYZ.zw = ecStart.yz;\n\n#ifdef PER_INSTANCE_COLOR\n v_color = czm_batchTable_color(batchId);\n#endif // PER_INSTANCE_COLOR\n\n // Compute a normal along which to "push" the position out, extending the miter depending on view distance.\n // Position has already been "pushed" by unit length along miter normal, and miter normals are encoded in the planes.\n // Decode the normal to use at this specific vertex, push the position back, and then push to where it needs to be.\n vec4 positionRelativeToEye = czm_computePosition();\n\n // Check distance to the end plane and start plane, pick the plane that is closer\n vec4 positionEC = czm_modelViewRelativeToEye * positionRelativeToEye; // w = 1.0, see czm_computePosition\n float absStartPlaneDistance = abs(czm_planeDistance(startPlaneEC, positionEC.xyz));\n float absEndPlaneDistance = abs(czm_planeDistance(endPlaneEC, positionEC.xyz));\n vec3 planeDirection = czm_branchFreeTernary(absStartPlaneDistance < absEndPlaneDistance, startPlaneEC.xyz, endPlaneEC.xyz);\n vec3 upOrDown = normalize(cross(v_rightPlaneEC.xyz, planeDirection)); // Points "up" for start plane, "down" at end plane.\n vec3 normalEC = normalize(cross(planeDirection, upOrDown)); // In practice, the opposite seems to work too.\n\n // Extrude bottom vertices downward for far view distances, like for GroundPrimitives\n upOrDown = cross(forwardDirectionEC, normalEC);\n upOrDown = float(czm_sceneMode == czm_sceneMode3D) * upOrDown;\n upOrDown = float(v_texcoordNormalizationAndStartEcYZ.y > 1.0 || v_texcoordNormalizationAndStartEcYZ.y < 0.0) * upOrDown;\n upOrDown = min(GLOBE_MINIMUM_ALTITUDE, czm_geometricToleranceOverMeter * length(positionRelativeToEye.xyz)) * upOrDown;\n positionEC.xyz += upOrDown;\n\n v_texcoordNormalizationAndStartEcYZ.y = czm_branchFreeTernary(v_texcoordNormalizationAndStartEcYZ.y > 1.0, 0.0, abs(v_texcoordNormalizationAndStartEcYZ.y));\n\n // Determine distance along normalEC to push for a volume of appropriate width.\n // Make volumes about double pixel width for a conservative fit - in practice the\n // extra cost here is minimal compared to the loose volume heights.\n //\n // N = normalEC (guaranteed "right-facing")\n // R = rightEC\n // p = angle between N and R\n // w = distance to push along R if R == N\n // d = distance to push along N\n //\n // N R\n // { p| } * cos(p) = dot(N, R) = w / d\n // d | |w * d = w / dot(N, R)\n // { | }\n // o---------- polyline segment ---->\n //\n float width = czm_batchTable_width(batchId);\n#ifdef WIDTH_VARYING\n v_width = width;\n#endif\n\n v_startPlaneNormalEcAndHalfWidth.xyz = startPlaneEC.xyz;\n v_startPlaneNormalEcAndHalfWidth.w = width * 0.5;\n\n v_endPlaneNormalEcAndBatchId.xyz = endPlaneEC.xyz;\n v_endPlaneNormalEcAndBatchId.w = batchId;\n\n width = width * max(0.0, czm_metersPerPixel(positionEC)); // width = distance to push along R\n width = width / dot(normalEC, v_rightPlaneEC.xyz); // width = distance to push along N\n\n // Determine if this vertex is on the "left" or "right"\n#ifdef COLUMBUS_VIEW_2D\n normalEC *= sign(texcoordNormalization2D.x);\n#else\n normalEC *= sign(endNormalAndTextureCoordinateNormalizationX.w);\n#endif\n\n positionEC.xyz += width * normalEC;\n gl_Position = czm_depthClamp(czm_projection * positionEC);\n\n#ifdef ANGLE_VARYING\n // Approximate relative screen space direction of the line.\n vec2 approxLineDirection = normalize(vec2(forwardDirectionEC.x, -forwardDirectionEC.y));\n approxLineDirection.y = czm_branchFreeTernary(approxLineDirection.x == 0.0 && approxLineDirection.y == 0.0, -1.0, approxLineDirection.y);\n v_polylineAngle = czm_fastApproximateAtan(approxLineDirection.x, approxLineDirection.y);\n#endif\n}\n';
  70329. // node_modules/cesium/Source/Shaders/Appearances/PolylineColorAppearanceVS.js
  70330. var PolylineColorAppearanceVS_default = "attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec2 expandAndWidth;\nattribute vec4 color;\nattribute float batchId;\n\nvarying vec4 v_color;\n\nvoid main()\n{\n float expandDir = expandAndWidth.x;\n float width = abs(expandAndWidth.y) + 0.5;\n bool usePrev = expandAndWidth.y < 0.0;\n\n vec4 p = czm_computePosition();\n vec4 prev = czm_computePrevPosition();\n vec4 next = czm_computeNextPosition();\n\n float angle;\n vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);\n gl_Position = czm_viewportOrthographic * positionWC;\n\n v_color = color;\n}\n";
  70331. // node_modules/cesium/Source/Shaders/PolylineCommon.js
  70332. var PolylineCommon_default = "void clipLineSegmentToNearPlane(\n vec3 p0,\n vec3 p1,\n out vec4 positionWC,\n out bool clipped,\n out bool culledByNearPlane,\n out vec4 clippedPositionEC)\n{\n culledByNearPlane = false;\n clipped = false;\n\n vec3 p0ToP1 = p1 - p0;\n float magnitude = length(p0ToP1);\n vec3 direction = normalize(p0ToP1);\n\n // Distance that p0 is behind the near plane. Negative means p0 is\n // in front of the near plane.\n float endPoint0Distance = czm_currentFrustum.x + p0.z;\n\n // Camera looks down -Z.\n // When moving a point along +Z: LESS VISIBLE\n // * Points in front of the camera move closer to the camera.\n // * Points behind the camrea move farther away from the camera.\n // When moving a point along -Z: MORE VISIBLE\n // * Points in front of the camera move farther away from the camera.\n // * Points behind the camera move closer to the camera.\n\n // Positive denominator: -Z, becoming more visible\n // Negative denominator: +Z, becoming less visible\n // Nearly zero: parallel to near plane\n float denominator = -direction.z;\n\n if (endPoint0Distance > 0.0 && abs(denominator) < czm_epsilon7)\n {\n // p0 is behind the near plane and the line to p1 is nearly parallel to\n // the near plane, so cull the segment completely.\n culledByNearPlane = true;\n }\n else if (endPoint0Distance > 0.0)\n {\n // p0 is behind the near plane, and the line to p1 is moving distinctly\n // toward or away from it.\n\n // t = (-plane distance - dot(plane normal, ray origin)) / dot(plane normal, ray direction)\n float t = endPoint0Distance / denominator;\n if (t < 0.0 || t > magnitude)\n {\n // Near plane intersection is not between the two points.\n // We already confirmed p0 is behind the naer plane, so now\n // we know the entire segment is behind it.\n culledByNearPlane = true;\n }\n else\n {\n // Segment crosses the near plane, update p0 to lie exactly on it.\n p0 = p0 + t * direction;\n\n // Numerical noise might put us a bit on the wrong side of the near plane.\n // Don't let that happen.\n p0.z = min(p0.z, -czm_currentFrustum.x);\n\n clipped = true;\n }\n }\n\n clippedPositionEC = vec4(p0, 1.0);\n positionWC = czm_eyeToWindowCoordinates(clippedPositionEC);\n}\n\nvec4 getPolylineWindowCoordinatesEC(vec4 positionEC, vec4 prevEC, vec4 nextEC, float expandDirection, float width, bool usePrevious, out float angle)\n{\n // expandDirection +1 is to the _left_ when looking from positionEC toward nextEC.\n\n#ifdef POLYLINE_DASH\n // Compute the window coordinates of the points.\n vec4 positionWindow = czm_eyeToWindowCoordinates(positionEC);\n vec4 previousWindow = czm_eyeToWindowCoordinates(prevEC);\n vec4 nextWindow = czm_eyeToWindowCoordinates(nextEC);\n\n // Determine the relative screen space direction of the line.\n vec2 lineDir;\n if (usePrevious) {\n lineDir = normalize(positionWindow.xy - previousWindow.xy);\n }\n else {\n lineDir = normalize(nextWindow.xy - positionWindow.xy);\n }\n angle = atan(lineDir.x, lineDir.y) - 1.570796327; // precomputed atan(1,0)\n\n // Quantize the angle so it doesn't change rapidly between segments.\n angle = floor(angle / czm_piOverFour + 0.5) * czm_piOverFour;\n#endif\n\n vec4 clippedPrevWC, clippedPrevEC;\n bool prevSegmentClipped, prevSegmentCulled;\n clipLineSegmentToNearPlane(prevEC.xyz, positionEC.xyz, clippedPrevWC, prevSegmentClipped, prevSegmentCulled, clippedPrevEC);\n\n vec4 clippedNextWC, clippedNextEC;\n bool nextSegmentClipped, nextSegmentCulled;\n clipLineSegmentToNearPlane(nextEC.xyz, positionEC.xyz, clippedNextWC, nextSegmentClipped, nextSegmentCulled, clippedNextEC);\n\n bool segmentClipped, segmentCulled;\n vec4 clippedPositionWC, clippedPositionEC;\n clipLineSegmentToNearPlane(positionEC.xyz, usePrevious ? prevEC.xyz : nextEC.xyz, clippedPositionWC, segmentClipped, segmentCulled, clippedPositionEC);\n\n if (segmentCulled)\n {\n return vec4(0.0, 0.0, 0.0, 1.0);\n }\n\n vec2 directionToPrevWC = normalize(clippedPrevWC.xy - clippedPositionWC.xy);\n vec2 directionToNextWC = normalize(clippedNextWC.xy - clippedPositionWC.xy);\n\n // If a segment was culled, we can't use the corresponding direction\n // computed above. We should never see both of these be true without\n // `segmentCulled` above also being true.\n if (prevSegmentCulled)\n {\n directionToPrevWC = -directionToNextWC;\n }\n else if (nextSegmentCulled)\n {\n directionToNextWC = -directionToPrevWC;\n }\n\n vec2 thisSegmentForwardWC, otherSegmentForwardWC;\n if (usePrevious)\n {\n thisSegmentForwardWC = -directionToPrevWC;\n otherSegmentForwardWC = directionToNextWC;\n }\n else\n {\n thisSegmentForwardWC = directionToNextWC;\n otherSegmentForwardWC = -directionToPrevWC;\n }\n\n vec2 thisSegmentLeftWC = vec2(-thisSegmentForwardWC.y, thisSegmentForwardWC.x);\n\n vec2 leftWC = thisSegmentLeftWC;\n float expandWidth = width * 0.5;\n\n // When lines are split at the anti-meridian, the position may be at the\n // same location as the next or previous position, and we need to handle\n // that to avoid producing NaNs.\n if (!czm_equalsEpsilon(prevEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1) && !czm_equalsEpsilon(nextEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1))\n {\n vec2 otherSegmentLeftWC = vec2(-otherSegmentForwardWC.y, otherSegmentForwardWC.x);\n\n vec2 leftSumWC = thisSegmentLeftWC + otherSegmentLeftWC;\n float leftSumLength = length(leftSumWC);\n leftWC = leftSumLength < czm_epsilon6 ? thisSegmentLeftWC : (leftSumWC / leftSumLength);\n\n // The sine of the angle between the two vectors is given by the formula\n // |a x b| = |a||b|sin(theta)\n // which is\n // float sinAngle = length(cross(vec3(leftWC, 0.0), vec3(-thisSegmentForwardWC, 0.0)));\n // Because the z components of both vectors are zero, the x and y coordinate will be zero.\n // Therefore, the sine of the angle is just the z component of the cross product.\n vec2 u = -thisSegmentForwardWC;\n vec2 v = leftWC;\n float sinAngle = abs(u.x * v.y - u.y * v.x);\n expandWidth = clamp(expandWidth / sinAngle, 0.0, width * 2.0);\n }\n\n vec2 offset = leftWC * expandDirection * expandWidth * czm_pixelRatio;\n return vec4(clippedPositionWC.xy + offset, -clippedPositionWC.z, 1.0) * (czm_projection * clippedPositionEC).w;\n}\n\nvec4 getPolylineWindowCoordinates(vec4 position, vec4 previous, vec4 next, float expandDirection, float width, bool usePrevious, out float angle)\n{\n vec4 positionEC = czm_modelViewRelativeToEye * position;\n vec4 prevEC = czm_modelViewRelativeToEye * previous;\n vec4 nextEC = czm_modelViewRelativeToEye * next;\n return getPolylineWindowCoordinatesEC(positionEC, prevEC, nextEC, expandDirection, width, usePrevious, angle);\n}\n";
  70333. // node_modules/cesium/Source/Scene/PolylineColorAppearance.js
  70334. var defaultVertexShaderSource = `${PolylineCommon_default}
  70335. ${PolylineColorAppearanceVS_default}`;
  70336. var defaultFragmentShaderSource = PerInstanceFlatColorAppearanceFS_default;
  70337. if (!FeatureDetection_default.isInternetExplorer()) {
  70338. defaultVertexShaderSource = `#define CLIP_POLYLINE
  70339. ${defaultVertexShaderSource}`;
  70340. }
  70341. function PolylineColorAppearance(options) {
  70342. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  70343. const translucent = defaultValue_default(options.translucent, true);
  70344. const closed = false;
  70345. const vertexFormat = PolylineColorAppearance.VERTEX_FORMAT;
  70346. this.material = void 0;
  70347. this.translucent = translucent;
  70348. this._vertexShaderSource = defaultValue_default(
  70349. options.vertexShaderSource,
  70350. defaultVertexShaderSource
  70351. );
  70352. this._fragmentShaderSource = defaultValue_default(
  70353. options.fragmentShaderSource,
  70354. defaultFragmentShaderSource
  70355. );
  70356. this._renderState = Appearance_default.getDefaultRenderState(
  70357. translucent,
  70358. closed,
  70359. options.renderState
  70360. );
  70361. this._closed = closed;
  70362. this._vertexFormat = vertexFormat;
  70363. }
  70364. Object.defineProperties(PolylineColorAppearance.prototype, {
  70365. vertexShaderSource: {
  70366. get: function() {
  70367. return this._vertexShaderSource;
  70368. }
  70369. },
  70370. fragmentShaderSource: {
  70371. get: function() {
  70372. return this._fragmentShaderSource;
  70373. }
  70374. },
  70375. renderState: {
  70376. get: function() {
  70377. return this._renderState;
  70378. }
  70379. },
  70380. closed: {
  70381. get: function() {
  70382. return this._closed;
  70383. }
  70384. },
  70385. vertexFormat: {
  70386. get: function() {
  70387. return this._vertexFormat;
  70388. }
  70389. }
  70390. });
  70391. PolylineColorAppearance.VERTEX_FORMAT = VertexFormat_default.POSITION_ONLY;
  70392. PolylineColorAppearance.prototype.getFragmentShaderSource = Appearance_default.prototype.getFragmentShaderSource;
  70393. PolylineColorAppearance.prototype.isTranslucent = Appearance_default.prototype.isTranslucent;
  70394. PolylineColorAppearance.prototype.getRenderState = Appearance_default.prototype.getRenderState;
  70395. var PolylineColorAppearance_default = PolylineColorAppearance;
  70396. // node_modules/cesium/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.js
  70397. var PolylineMaterialAppearanceVS_default = "attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec2 expandAndWidth;\nattribute vec2 st;\nattribute float batchId;\n\nvarying float v_width;\nvarying vec2 v_st;\nvarying float v_polylineAngle;\n\nvoid main()\n{\n float expandDir = expandAndWidth.x;\n float width = abs(expandAndWidth.y) + 0.5;\n bool usePrev = expandAndWidth.y < 0.0;\n\n vec4 p = czm_computePosition();\n vec4 prev = czm_computePrevPosition();\n vec4 next = czm_computeNextPosition();\n\n float angle;\n vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);\n gl_Position = czm_viewportOrthographic * positionWC;\n\n v_width = width;\n v_st.s = st.s;\n v_st.t = czm_writeNonPerspective(st.t, gl_Position.w);\n v_polylineAngle = angle;\n}\n";
  70398. // node_modules/cesium/Source/Shaders/PolylineFS.js
  70399. var PolylineFS_default = "#ifdef VECTOR_TILE\nuniform vec4 u_highlightColor;\n#endif\n\nvarying vec2 v_st;\n\nvoid main()\n{\n czm_materialInput materialInput;\n\n vec2 st = v_st;\n st.t = czm_readNonPerspective(st.t, gl_FragCoord.w);\n\n materialInput.s = st.s;\n materialInput.st = st;\n materialInput.str = vec3(st, 0.0);\n\n czm_material material = czm_getMaterial(materialInput);\n gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#ifdef VECTOR_TILE\n gl_FragColor *= u_highlightColor;\n#endif\n\n czm_writeLogDepth();\n}\n";
  70400. // node_modules/cesium/Source/Scene/PolylineMaterialAppearance.js
  70401. var defaultVertexShaderSource2 = `${PolylineCommon_default}
  70402. ${PolylineMaterialAppearanceVS_default}`;
  70403. var defaultFragmentShaderSource2 = PolylineFS_default;
  70404. if (!FeatureDetection_default.isInternetExplorer()) {
  70405. defaultVertexShaderSource2 = `#define CLIP_POLYLINE
  70406. ${defaultVertexShaderSource2}`;
  70407. }
  70408. function PolylineMaterialAppearance(options) {
  70409. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  70410. const translucent = defaultValue_default(options.translucent, true);
  70411. const closed = false;
  70412. const vertexFormat = PolylineMaterialAppearance.VERTEX_FORMAT;
  70413. this.material = defined_default(options.material) ? options.material : Material_default.fromType(Material_default.ColorType);
  70414. this.translucent = translucent;
  70415. this._vertexShaderSource = defaultValue_default(
  70416. options.vertexShaderSource,
  70417. defaultVertexShaderSource2
  70418. );
  70419. this._fragmentShaderSource = defaultValue_default(
  70420. options.fragmentShaderSource,
  70421. defaultFragmentShaderSource2
  70422. );
  70423. this._renderState = Appearance_default.getDefaultRenderState(
  70424. translucent,
  70425. closed,
  70426. options.renderState
  70427. );
  70428. this._closed = closed;
  70429. this._vertexFormat = vertexFormat;
  70430. }
  70431. Object.defineProperties(PolylineMaterialAppearance.prototype, {
  70432. vertexShaderSource: {
  70433. get: function() {
  70434. let vs = this._vertexShaderSource;
  70435. if (this.material.shaderSource.search(
  70436. /varying\s+float\s+v_polylineAngle;/g
  70437. ) !== -1) {
  70438. vs = `#define POLYLINE_DASH
  70439. ${vs}`;
  70440. }
  70441. return vs;
  70442. }
  70443. },
  70444. fragmentShaderSource: {
  70445. get: function() {
  70446. return this._fragmentShaderSource;
  70447. }
  70448. },
  70449. renderState: {
  70450. get: function() {
  70451. return this._renderState;
  70452. }
  70453. },
  70454. closed: {
  70455. get: function() {
  70456. return this._closed;
  70457. }
  70458. },
  70459. vertexFormat: {
  70460. get: function() {
  70461. return this._vertexFormat;
  70462. }
  70463. }
  70464. });
  70465. PolylineMaterialAppearance.VERTEX_FORMAT = VertexFormat_default.POSITION_AND_ST;
  70466. PolylineMaterialAppearance.prototype.getFragmentShaderSource = Appearance_default.prototype.getFragmentShaderSource;
  70467. PolylineMaterialAppearance.prototype.isTranslucent = Appearance_default.prototype.isTranslucent;
  70468. PolylineMaterialAppearance.prototype.getRenderState = Appearance_default.prototype.getRenderState;
  70469. var PolylineMaterialAppearance_default = PolylineMaterialAppearance;
  70470. // node_modules/cesium/Source/Scene/GroundPolylinePrimitive.js
  70471. function GroundPolylinePrimitive(options) {
  70472. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  70473. this.geometryInstances = options.geometryInstances;
  70474. this._hasPerInstanceColors = true;
  70475. let appearance = options.appearance;
  70476. if (!defined_default(appearance)) {
  70477. appearance = new PolylineMaterialAppearance_default();
  70478. }
  70479. this.appearance = appearance;
  70480. this.show = defaultValue_default(options.show, true);
  70481. this.classificationType = defaultValue_default(
  70482. options.classificationType,
  70483. ClassificationType_default.BOTH
  70484. );
  70485. this.debugShowBoundingVolume = defaultValue_default(
  70486. options.debugShowBoundingVolume,
  70487. false
  70488. );
  70489. this._debugShowShadowVolume = defaultValue_default(
  70490. options.debugShowShadowVolume,
  70491. false
  70492. );
  70493. this._primitiveOptions = {
  70494. geometryInstances: void 0,
  70495. appearance: void 0,
  70496. vertexCacheOptimize: false,
  70497. interleave: defaultValue_default(options.interleave, false),
  70498. releaseGeometryInstances: defaultValue_default(
  70499. options.releaseGeometryInstances,
  70500. true
  70501. ),
  70502. allowPicking: defaultValue_default(options.allowPicking, true),
  70503. asynchronous: defaultValue_default(options.asynchronous, true),
  70504. compressVertices: false,
  70505. _createShaderProgramFunction: void 0,
  70506. _createCommandsFunction: void 0,
  70507. _updateAndQueueCommandsFunction: void 0
  70508. };
  70509. this._zIndex = void 0;
  70510. this._ready = false;
  70511. this._readyPromise = defer_default();
  70512. this._primitive = void 0;
  70513. this._sp = void 0;
  70514. this._sp2D = void 0;
  70515. this._spMorph = void 0;
  70516. this._renderState = getRenderState(false);
  70517. this._renderState3DTiles = getRenderState(true);
  70518. this._renderStateMorph = RenderState_default.fromCache({
  70519. cull: {
  70520. enabled: true,
  70521. face: CullFace_default.FRONT
  70522. },
  70523. depthTest: {
  70524. enabled: true
  70525. },
  70526. blending: BlendingState_default.PRE_MULTIPLIED_ALPHA_BLEND,
  70527. depthMask: false
  70528. });
  70529. }
  70530. Object.defineProperties(GroundPolylinePrimitive.prototype, {
  70531. interleave: {
  70532. get: function() {
  70533. return this._primitiveOptions.interleave;
  70534. }
  70535. },
  70536. releaseGeometryInstances: {
  70537. get: function() {
  70538. return this._primitiveOptions.releaseGeometryInstances;
  70539. }
  70540. },
  70541. allowPicking: {
  70542. get: function() {
  70543. return this._primitiveOptions.allowPicking;
  70544. }
  70545. },
  70546. asynchronous: {
  70547. get: function() {
  70548. return this._primitiveOptions.asynchronous;
  70549. }
  70550. },
  70551. ready: {
  70552. get: function() {
  70553. return this._ready;
  70554. }
  70555. },
  70556. readyPromise: {
  70557. get: function() {
  70558. return this._readyPromise.promise;
  70559. }
  70560. },
  70561. debugShowShadowVolume: {
  70562. get: function() {
  70563. return this._debugShowShadowVolume;
  70564. }
  70565. }
  70566. });
  70567. GroundPolylinePrimitive.initializeTerrainHeights = function() {
  70568. return ApproximateTerrainHeights_default.initialize();
  70569. };
  70570. function createShaderProgram3(groundPolylinePrimitive, frameState, appearance) {
  70571. const context = frameState.context;
  70572. const primitive = groundPolylinePrimitive._primitive;
  70573. const attributeLocations8 = primitive._attributeLocations;
  70574. let vs = primitive._batchTable.getVertexShaderCallback()(
  70575. PolylineShadowVolumeVS_default
  70576. );
  70577. vs = Primitive_default._appendShowToShader(primitive, vs);
  70578. vs = Primitive_default._appendDistanceDisplayConditionToShader(primitive, vs);
  70579. vs = Primitive_default._modifyShaderPosition(
  70580. groundPolylinePrimitive,
  70581. vs,
  70582. frameState.scene3DOnly
  70583. );
  70584. let vsMorph = primitive._batchTable.getVertexShaderCallback()(
  70585. PolylineShadowVolumeMorphVS_default
  70586. );
  70587. vsMorph = Primitive_default._appendShowToShader(primitive, vsMorph);
  70588. vsMorph = Primitive_default._appendDistanceDisplayConditionToShader(
  70589. primitive,
  70590. vsMorph
  70591. );
  70592. vsMorph = Primitive_default._modifyShaderPosition(
  70593. groundPolylinePrimitive,
  70594. vsMorph,
  70595. frameState.scene3DOnly
  70596. );
  70597. let fs = primitive._batchTable.getVertexShaderCallback()(
  70598. PolylineShadowVolumeFS_default
  70599. );
  70600. const vsDefines = [
  70601. `GLOBE_MINIMUM_ALTITUDE ${frameState.mapProjection.ellipsoid.minimumRadius.toFixed(
  70602. 1
  70603. )}`
  70604. ];
  70605. let colorDefine = "";
  70606. let materialShaderSource = "";
  70607. if (defined_default(appearance.material)) {
  70608. materialShaderSource = defined_default(appearance.material) ? appearance.material.shaderSource : "";
  70609. if (materialShaderSource.search(/varying\s+float\s+v_polylineAngle;/g) !== -1) {
  70610. vsDefines.push("ANGLE_VARYING");
  70611. }
  70612. if (materialShaderSource.search(/varying\s+float\s+v_width;/g) !== -1) {
  70613. vsDefines.push("WIDTH_VARYING");
  70614. }
  70615. } else {
  70616. colorDefine = "PER_INSTANCE_COLOR";
  70617. }
  70618. vsDefines.push(colorDefine);
  70619. const fsDefines = groundPolylinePrimitive.debugShowShadowVolume ? ["DEBUG_SHOW_VOLUME", colorDefine] : [colorDefine];
  70620. const vsColor3D = new ShaderSource_default({
  70621. defines: vsDefines,
  70622. sources: [vs]
  70623. });
  70624. const fsColor3D = new ShaderSource_default({
  70625. defines: fsDefines,
  70626. sources: [materialShaderSource, fs]
  70627. });
  70628. groundPolylinePrimitive._sp = ShaderProgram_default.replaceCache({
  70629. context,
  70630. shaderProgram: primitive._sp,
  70631. vertexShaderSource: vsColor3D,
  70632. fragmentShaderSource: fsColor3D,
  70633. attributeLocations: attributeLocations8
  70634. });
  70635. let colorProgram2D = context.shaderCache.getDerivedShaderProgram(
  70636. groundPolylinePrimitive._sp,
  70637. "2dColor"
  70638. );
  70639. if (!defined_default(colorProgram2D)) {
  70640. const vsColor2D = new ShaderSource_default({
  70641. defines: vsDefines.concat(["COLUMBUS_VIEW_2D"]),
  70642. sources: [vs]
  70643. });
  70644. colorProgram2D = context.shaderCache.createDerivedShaderProgram(
  70645. groundPolylinePrimitive._sp,
  70646. "2dColor",
  70647. {
  70648. context,
  70649. shaderProgram: groundPolylinePrimitive._sp2D,
  70650. vertexShaderSource: vsColor2D,
  70651. fragmentShaderSource: fsColor3D,
  70652. attributeLocations: attributeLocations8
  70653. }
  70654. );
  70655. }
  70656. groundPolylinePrimitive._sp2D = colorProgram2D;
  70657. let colorProgramMorph = context.shaderCache.getDerivedShaderProgram(
  70658. groundPolylinePrimitive._sp,
  70659. "MorphColor"
  70660. );
  70661. if (!defined_default(colorProgramMorph)) {
  70662. const vsColorMorph = new ShaderSource_default({
  70663. defines: vsDefines.concat([
  70664. `MAX_TERRAIN_HEIGHT ${ApproximateTerrainHeights_default._defaultMaxTerrainHeight.toFixed(
  70665. 1
  70666. )}`
  70667. ]),
  70668. sources: [vsMorph]
  70669. });
  70670. fs = primitive._batchTable.getVertexShaderCallback()(
  70671. PolylineShadowVolumeMorphFS_default
  70672. );
  70673. const fsColorMorph = new ShaderSource_default({
  70674. defines: fsDefines,
  70675. sources: [materialShaderSource, fs]
  70676. });
  70677. colorProgramMorph = context.shaderCache.createDerivedShaderProgram(
  70678. groundPolylinePrimitive._sp,
  70679. "MorphColor",
  70680. {
  70681. context,
  70682. shaderProgram: groundPolylinePrimitive._spMorph,
  70683. vertexShaderSource: vsColorMorph,
  70684. fragmentShaderSource: fsColorMorph,
  70685. attributeLocations: attributeLocations8
  70686. }
  70687. );
  70688. }
  70689. groundPolylinePrimitive._spMorph = colorProgramMorph;
  70690. }
  70691. function getRenderState(mask3DTiles) {
  70692. return RenderState_default.fromCache({
  70693. cull: {
  70694. enabled: true
  70695. },
  70696. blending: BlendingState_default.PRE_MULTIPLIED_ALPHA_BLEND,
  70697. depthMask: false,
  70698. stencilTest: {
  70699. enabled: mask3DTiles,
  70700. frontFunction: StencilFunction_default.EQUAL,
  70701. frontOperation: {
  70702. fail: StencilOperation_default.KEEP,
  70703. zFail: StencilOperation_default.KEEP,
  70704. zPass: StencilOperation_default.KEEP
  70705. },
  70706. backFunction: StencilFunction_default.EQUAL,
  70707. backOperation: {
  70708. fail: StencilOperation_default.KEEP,
  70709. zFail: StencilOperation_default.KEEP,
  70710. zPass: StencilOperation_default.KEEP
  70711. },
  70712. reference: StencilConstants_default.CESIUM_3D_TILE_MASK,
  70713. mask: StencilConstants_default.CESIUM_3D_TILE_MASK
  70714. }
  70715. });
  70716. }
  70717. function createCommands3(groundPolylinePrimitive, appearance, material, translucent, colorCommands, pickCommands) {
  70718. const primitive = groundPolylinePrimitive._primitive;
  70719. const length3 = primitive._va.length;
  70720. colorCommands.length = length3;
  70721. pickCommands.length = length3;
  70722. const isPolylineColorAppearance = appearance instanceof PolylineColorAppearance_default;
  70723. const materialUniforms = isPolylineColorAppearance ? {} : material._uniforms;
  70724. const uniformMap2 = primitive._batchTable.getUniformMapCallback()(
  70725. materialUniforms
  70726. );
  70727. for (let i2 = 0; i2 < length3; i2++) {
  70728. const vertexArray = primitive._va[i2];
  70729. let command = colorCommands[i2];
  70730. if (!defined_default(command)) {
  70731. command = colorCommands[i2] = new DrawCommand_default({
  70732. owner: groundPolylinePrimitive,
  70733. primitiveType: primitive._primitiveType
  70734. });
  70735. }
  70736. command.vertexArray = vertexArray;
  70737. command.renderState = groundPolylinePrimitive._renderState;
  70738. command.shaderProgram = groundPolylinePrimitive._sp;
  70739. command.uniformMap = uniformMap2;
  70740. command.pass = Pass_default.TERRAIN_CLASSIFICATION;
  70741. command.pickId = "czm_batchTable_pickColor(v_endPlaneNormalEcAndBatchId.w)";
  70742. const derivedTilesetCommand = DrawCommand_default.shallowClone(
  70743. command,
  70744. command.derivedCommands.tileset
  70745. );
  70746. derivedTilesetCommand.renderState = groundPolylinePrimitive._renderState3DTiles;
  70747. derivedTilesetCommand.pass = Pass_default.CESIUM_3D_TILE_CLASSIFICATION;
  70748. command.derivedCommands.tileset = derivedTilesetCommand;
  70749. const derived2DCommand = DrawCommand_default.shallowClone(
  70750. command,
  70751. command.derivedCommands.color2D
  70752. );
  70753. derived2DCommand.shaderProgram = groundPolylinePrimitive._sp2D;
  70754. command.derivedCommands.color2D = derived2DCommand;
  70755. const derived2DTilesetCommand = DrawCommand_default.shallowClone(
  70756. derivedTilesetCommand,
  70757. derivedTilesetCommand.derivedCommands.color2D
  70758. );
  70759. derived2DTilesetCommand.shaderProgram = groundPolylinePrimitive._sp2D;
  70760. derivedTilesetCommand.derivedCommands.color2D = derived2DTilesetCommand;
  70761. const derivedMorphCommand = DrawCommand_default.shallowClone(
  70762. command,
  70763. command.derivedCommands.colorMorph
  70764. );
  70765. derivedMorphCommand.renderState = groundPolylinePrimitive._renderStateMorph;
  70766. derivedMorphCommand.shaderProgram = groundPolylinePrimitive._spMorph;
  70767. derivedMorphCommand.pickId = "czm_batchTable_pickColor(v_batchId)";
  70768. command.derivedCommands.colorMorph = derivedMorphCommand;
  70769. }
  70770. }
  70771. function updateAndQueueCommand(groundPolylinePrimitive, command, frameState, modelMatrix, cull, boundingVolume, debugShowBoundingVolume2) {
  70772. if (frameState.mode === SceneMode_default.MORPHING) {
  70773. command = command.derivedCommands.colorMorph;
  70774. } else if (frameState.mode !== SceneMode_default.SCENE3D) {
  70775. command = command.derivedCommands.color2D;
  70776. }
  70777. command.modelMatrix = modelMatrix;
  70778. command.boundingVolume = boundingVolume;
  70779. command.cull = cull;
  70780. command.debugShowBoundingVolume = debugShowBoundingVolume2;
  70781. frameState.commandList.push(command);
  70782. }
  70783. function updateAndQueueCommands4(groundPolylinePrimitive, frameState, colorCommands, pickCommands, modelMatrix, cull, debugShowBoundingVolume2) {
  70784. const primitive = groundPolylinePrimitive._primitive;
  70785. Primitive_default._updateBoundingVolumes(primitive, frameState, modelMatrix);
  70786. let boundingSpheres;
  70787. if (frameState.mode === SceneMode_default.SCENE3D) {
  70788. boundingSpheres = primitive._boundingSphereWC;
  70789. } else if (frameState.mode === SceneMode_default.COLUMBUS_VIEW) {
  70790. boundingSpheres = primitive._boundingSphereCV;
  70791. } else if (frameState.mode === SceneMode_default.SCENE2D && defined_default(primitive._boundingSphere2D)) {
  70792. boundingSpheres = primitive._boundingSphere2D;
  70793. } else if (defined_default(primitive._boundingSphereMorph)) {
  70794. boundingSpheres = primitive._boundingSphereMorph;
  70795. }
  70796. const morphing = frameState.mode === SceneMode_default.MORPHING;
  70797. const classificationType = groundPolylinePrimitive.classificationType;
  70798. const queueTerrainCommands = classificationType !== ClassificationType_default.CESIUM_3D_TILE;
  70799. const queue3DTilesCommands = classificationType !== ClassificationType_default.TERRAIN && !morphing;
  70800. let command;
  70801. const passes = frameState.passes;
  70802. if (passes.render || passes.pick && primitive.allowPicking) {
  70803. const colorLength = colorCommands.length;
  70804. for (let j = 0; j < colorLength; ++j) {
  70805. const boundingVolume = boundingSpheres[j];
  70806. if (queueTerrainCommands) {
  70807. command = colorCommands[j];
  70808. updateAndQueueCommand(
  70809. groundPolylinePrimitive,
  70810. command,
  70811. frameState,
  70812. modelMatrix,
  70813. cull,
  70814. boundingVolume,
  70815. debugShowBoundingVolume2
  70816. );
  70817. }
  70818. if (queue3DTilesCommands) {
  70819. command = colorCommands[j].derivedCommands.tileset;
  70820. updateAndQueueCommand(
  70821. groundPolylinePrimitive,
  70822. command,
  70823. frameState,
  70824. modelMatrix,
  70825. cull,
  70826. boundingVolume,
  70827. debugShowBoundingVolume2
  70828. );
  70829. }
  70830. }
  70831. }
  70832. }
  70833. GroundPolylinePrimitive.prototype.update = function(frameState) {
  70834. if (!defined_default(this._primitive) && !defined_default(this.geometryInstances)) {
  70835. return;
  70836. }
  70837. if (!ApproximateTerrainHeights_default.initialized) {
  70838. if (!this.asynchronous) {
  70839. throw new DeveloperError_default(
  70840. "For synchronous GroundPolylinePrimitives, you must call GroundPolylinePrimitives.initializeTerrainHeights() and wait for the returned promise to resolve."
  70841. );
  70842. }
  70843. GroundPolylinePrimitive.initializeTerrainHeights();
  70844. return;
  70845. }
  70846. let i2;
  70847. const that = this;
  70848. const primitiveOptions = this._primitiveOptions;
  70849. if (!defined_default(this._primitive)) {
  70850. const geometryInstances = Array.isArray(this.geometryInstances) ? this.geometryInstances : [this.geometryInstances];
  70851. const geometryInstancesLength = geometryInstances.length;
  70852. const groundInstances = new Array(geometryInstancesLength);
  70853. let attributes;
  70854. for (i2 = 0; i2 < geometryInstancesLength; ++i2) {
  70855. attributes = geometryInstances[i2].attributes;
  70856. if (!defined_default(attributes) || !defined_default(attributes.color)) {
  70857. this._hasPerInstanceColors = false;
  70858. break;
  70859. }
  70860. }
  70861. for (i2 = 0; i2 < geometryInstancesLength; ++i2) {
  70862. const geometryInstance = geometryInstances[i2];
  70863. attributes = {};
  70864. const instanceAttributes = geometryInstance.attributes;
  70865. for (const attributeKey in instanceAttributes) {
  70866. if (instanceAttributes.hasOwnProperty(attributeKey)) {
  70867. attributes[attributeKey] = instanceAttributes[attributeKey];
  70868. }
  70869. }
  70870. if (!defined_default(attributes.width)) {
  70871. attributes.width = new GeometryInstanceAttribute_default({
  70872. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  70873. componentsPerAttribute: 1,
  70874. value: [geometryInstance.geometry.width]
  70875. });
  70876. }
  70877. geometryInstance.geometry._scene3DOnly = frameState.scene3DOnly;
  70878. GroundPolylineGeometry_default.setProjectionAndEllipsoid(
  70879. geometryInstance.geometry,
  70880. frameState.mapProjection
  70881. );
  70882. groundInstances[i2] = new GeometryInstance_default({
  70883. geometry: geometryInstance.geometry,
  70884. attributes,
  70885. id: geometryInstance.id,
  70886. pickPrimitive: that
  70887. });
  70888. }
  70889. primitiveOptions.geometryInstances = groundInstances;
  70890. primitiveOptions.appearance = this.appearance;
  70891. primitiveOptions._createShaderProgramFunction = function(primitive, frameState2, appearance) {
  70892. createShaderProgram3(that, frameState2, appearance);
  70893. };
  70894. primitiveOptions._createCommandsFunction = function(primitive, appearance, material, translucent, twoPasses, colorCommands, pickCommands) {
  70895. createCommands3(
  70896. that,
  70897. appearance,
  70898. material,
  70899. translucent,
  70900. colorCommands,
  70901. pickCommands
  70902. );
  70903. };
  70904. primitiveOptions._updateAndQueueCommandsFunction = function(primitive, frameState2, colorCommands, pickCommands, modelMatrix, cull, debugShowBoundingVolume2, twoPasses) {
  70905. updateAndQueueCommands4(
  70906. that,
  70907. frameState2,
  70908. colorCommands,
  70909. pickCommands,
  70910. modelMatrix,
  70911. cull,
  70912. debugShowBoundingVolume2
  70913. );
  70914. };
  70915. this._primitive = new Primitive_default(primitiveOptions);
  70916. this._primitive.readyPromise.then(function(primitive) {
  70917. that._ready = true;
  70918. if (that.releaseGeometryInstances) {
  70919. that.geometryInstances = void 0;
  70920. }
  70921. const error = primitive._error;
  70922. if (!defined_default(error)) {
  70923. that._readyPromise.resolve(that);
  70924. } else {
  70925. that._readyPromise.reject(error);
  70926. }
  70927. });
  70928. }
  70929. if (this.appearance instanceof PolylineColorAppearance_default && !this._hasPerInstanceColors) {
  70930. throw new DeveloperError_default(
  70931. "All GeometryInstances must have color attributes to use PolylineColorAppearance with GroundPolylinePrimitive."
  70932. );
  70933. }
  70934. this._primitive.appearance = this.appearance;
  70935. this._primitive.show = this.show;
  70936. this._primitive.debugShowBoundingVolume = this.debugShowBoundingVolume;
  70937. this._primitive.update(frameState);
  70938. };
  70939. GroundPolylinePrimitive.prototype.getGeometryInstanceAttributes = function(id) {
  70940. if (!defined_default(this._primitive)) {
  70941. throw new DeveloperError_default(
  70942. "must call update before calling getGeometryInstanceAttributes"
  70943. );
  70944. }
  70945. return this._primitive.getGeometryInstanceAttributes(id);
  70946. };
  70947. GroundPolylinePrimitive.isSupported = function(scene) {
  70948. return scene.frameState.context.depthTexture;
  70949. };
  70950. GroundPolylinePrimitive.prototype.isDestroyed = function() {
  70951. return false;
  70952. };
  70953. GroundPolylinePrimitive.prototype.destroy = function() {
  70954. this._primitive = this._primitive && this._primitive.destroy();
  70955. this._sp = this._sp && this._sp.destroy();
  70956. this._sp2D = void 0;
  70957. this._spMorph = void 0;
  70958. return destroyObject_default(this);
  70959. };
  70960. var GroundPolylinePrimitive_default = GroundPolylinePrimitive;
  70961. // node_modules/cesium/Source/DataSources/ImageMaterialProperty.js
  70962. var defaultRepeat = new Cartesian2_default(1, 1);
  70963. var defaultTransparent = false;
  70964. var defaultColor2 = Color_default.WHITE;
  70965. function ImageMaterialProperty(options) {
  70966. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  70967. this._definitionChanged = new Event_default();
  70968. this._image = void 0;
  70969. this._imageSubscription = void 0;
  70970. this._repeat = void 0;
  70971. this._repeatSubscription = void 0;
  70972. this._color = void 0;
  70973. this._colorSubscription = void 0;
  70974. this._transparent = void 0;
  70975. this._transparentSubscription = void 0;
  70976. this.image = options.image;
  70977. this.repeat = options.repeat;
  70978. this.color = options.color;
  70979. this.transparent = options.transparent;
  70980. }
  70981. Object.defineProperties(ImageMaterialProperty.prototype, {
  70982. isConstant: {
  70983. get: function() {
  70984. return Property_default.isConstant(this._image) && Property_default.isConstant(this._repeat);
  70985. }
  70986. },
  70987. definitionChanged: {
  70988. get: function() {
  70989. return this._definitionChanged;
  70990. }
  70991. },
  70992. image: createPropertyDescriptor_default("image"),
  70993. repeat: createPropertyDescriptor_default("repeat"),
  70994. color: createPropertyDescriptor_default("color"),
  70995. transparent: createPropertyDescriptor_default("transparent")
  70996. });
  70997. ImageMaterialProperty.prototype.getType = function(time) {
  70998. return "Image";
  70999. };
  71000. ImageMaterialProperty.prototype.getValue = function(time, result) {
  71001. if (!defined_default(result)) {
  71002. result = {};
  71003. }
  71004. result.image = Property_default.getValueOrUndefined(this._image, time);
  71005. result.repeat = Property_default.getValueOrClonedDefault(
  71006. this._repeat,
  71007. time,
  71008. defaultRepeat,
  71009. result.repeat
  71010. );
  71011. result.color = Property_default.getValueOrClonedDefault(
  71012. this._color,
  71013. time,
  71014. defaultColor2,
  71015. result.color
  71016. );
  71017. if (Property_default.getValueOrDefault(this._transparent, time, defaultTransparent)) {
  71018. result.color.alpha = Math.min(0.99, result.color.alpha);
  71019. }
  71020. return result;
  71021. };
  71022. ImageMaterialProperty.prototype.equals = function(other) {
  71023. return this === other || other instanceof ImageMaterialProperty && Property_default.equals(this._image, other._image) && Property_default.equals(this._repeat, other._repeat) && Property_default.equals(this._color, other._color) && Property_default.equals(this._transparent, other._transparent);
  71024. };
  71025. var ImageMaterialProperty_default = ImageMaterialProperty;
  71026. // node_modules/cesium/Source/DataSources/createMaterialPropertyDescriptor.js
  71027. function createMaterialProperty(value) {
  71028. if (value instanceof Color_default) {
  71029. return new ColorMaterialProperty_default(value);
  71030. }
  71031. if (typeof value === "string" || value instanceof Resource_default || value instanceof HTMLCanvasElement || value instanceof HTMLVideoElement) {
  71032. const result = new ImageMaterialProperty_default();
  71033. result.image = value;
  71034. return result;
  71035. }
  71036. throw new DeveloperError_default(`Unable to infer material type: ${value}`);
  71037. }
  71038. function createMaterialPropertyDescriptor(name, configurable) {
  71039. return createPropertyDescriptor_default(name, configurable, createMaterialProperty);
  71040. }
  71041. var createMaterialPropertyDescriptor_default = createMaterialPropertyDescriptor;
  71042. // node_modules/cesium/Source/DataSources/BoxGraphics.js
  71043. function BoxGraphics(options) {
  71044. this._definitionChanged = new Event_default();
  71045. this._show = void 0;
  71046. this._showSubscription = void 0;
  71047. this._dimensions = void 0;
  71048. this._dimensionsSubscription = void 0;
  71049. this._heightReference = void 0;
  71050. this._heightReferenceSubscription = void 0;
  71051. this._fill = void 0;
  71052. this._fillSubscription = void 0;
  71053. this._material = void 0;
  71054. this._materialSubscription = void 0;
  71055. this._outline = void 0;
  71056. this._outlineSubscription = void 0;
  71057. this._outlineColor = void 0;
  71058. this._outlineColorSubscription = void 0;
  71059. this._outlineWidth = void 0;
  71060. this._outlineWidthSubscription = void 0;
  71061. this._shadows = void 0;
  71062. this._shadowsSubscription = void 0;
  71063. this._distanceDisplayCondition = void 0;
  71064. this._distanceDisplayConditionSubscription = void 0;
  71065. this.merge(defaultValue_default(options, defaultValue_default.EMPTY_OBJECT));
  71066. }
  71067. Object.defineProperties(BoxGraphics.prototype, {
  71068. definitionChanged: {
  71069. get: function() {
  71070. return this._definitionChanged;
  71071. }
  71072. },
  71073. show: createPropertyDescriptor_default("show"),
  71074. dimensions: createPropertyDescriptor_default("dimensions"),
  71075. heightReference: createPropertyDescriptor_default("heightReference"),
  71076. fill: createPropertyDescriptor_default("fill"),
  71077. material: createMaterialPropertyDescriptor_default("material"),
  71078. outline: createPropertyDescriptor_default("outline"),
  71079. outlineColor: createPropertyDescriptor_default("outlineColor"),
  71080. outlineWidth: createPropertyDescriptor_default("outlineWidth"),
  71081. shadows: createPropertyDescriptor_default("shadows"),
  71082. distanceDisplayCondition: createPropertyDescriptor_default(
  71083. "distanceDisplayCondition"
  71084. )
  71085. });
  71086. BoxGraphics.prototype.clone = function(result) {
  71087. if (!defined_default(result)) {
  71088. return new BoxGraphics(this);
  71089. }
  71090. result.show = this.show;
  71091. result.dimensions = this.dimensions;
  71092. result.heightReference = this.heightReference;
  71093. result.fill = this.fill;
  71094. result.material = this.material;
  71095. result.outline = this.outline;
  71096. result.outlineColor = this.outlineColor;
  71097. result.outlineWidth = this.outlineWidth;
  71098. result.shadows = this.shadows;
  71099. result.distanceDisplayCondition = this.distanceDisplayCondition;
  71100. return result;
  71101. };
  71102. BoxGraphics.prototype.merge = function(source) {
  71103. if (!defined_default(source)) {
  71104. throw new DeveloperError_default("source is required.");
  71105. }
  71106. this.show = defaultValue_default(this.show, source.show);
  71107. this.dimensions = defaultValue_default(this.dimensions, source.dimensions);
  71108. this.heightReference = defaultValue_default(
  71109. this.heightReference,
  71110. source.heightReference
  71111. );
  71112. this.fill = defaultValue_default(this.fill, source.fill);
  71113. this.material = defaultValue_default(this.material, source.material);
  71114. this.outline = defaultValue_default(this.outline, source.outline);
  71115. this.outlineColor = defaultValue_default(this.outlineColor, source.outlineColor);
  71116. this.outlineWidth = defaultValue_default(this.outlineWidth, source.outlineWidth);
  71117. this.shadows = defaultValue_default(this.shadows, source.shadows);
  71118. this.distanceDisplayCondition = defaultValue_default(
  71119. this.distanceDisplayCondition,
  71120. source.distanceDisplayCondition
  71121. );
  71122. };
  71123. var BoxGraphics_default = BoxGraphics;
  71124. // node_modules/cesium/Source/DataSources/PositionProperty.js
  71125. function PositionProperty() {
  71126. DeveloperError_default.throwInstantiationError();
  71127. }
  71128. Object.defineProperties(PositionProperty.prototype, {
  71129. isConstant: {
  71130. get: DeveloperError_default.throwInstantiationError
  71131. },
  71132. definitionChanged: {
  71133. get: DeveloperError_default.throwInstantiationError
  71134. },
  71135. referenceFrame: {
  71136. get: DeveloperError_default.throwInstantiationError
  71137. }
  71138. });
  71139. PositionProperty.prototype.getValue = DeveloperError_default.throwInstantiationError;
  71140. PositionProperty.prototype.getValueInReferenceFrame = DeveloperError_default.throwInstantiationError;
  71141. PositionProperty.prototype.equals = DeveloperError_default.throwInstantiationError;
  71142. var scratchMatrix3 = new Matrix3_default();
  71143. PositionProperty.convertToReferenceFrame = function(time, value, inputFrame, outputFrame, result) {
  71144. if (!defined_default(value)) {
  71145. return value;
  71146. }
  71147. if (!defined_default(result)) {
  71148. result = new Cartesian3_default();
  71149. }
  71150. if (inputFrame === outputFrame) {
  71151. return Cartesian3_default.clone(value, result);
  71152. }
  71153. let icrfToFixed2 = Transforms_default.computeIcrfToFixedMatrix(time, scratchMatrix3);
  71154. if (!defined_default(icrfToFixed2)) {
  71155. icrfToFixed2 = Transforms_default.computeTemeToPseudoFixedMatrix(
  71156. time,
  71157. scratchMatrix3
  71158. );
  71159. }
  71160. if (inputFrame === ReferenceFrame_default.INERTIAL) {
  71161. return Matrix3_default.multiplyByVector(icrfToFixed2, value, result);
  71162. }
  71163. if (inputFrame === ReferenceFrame_default.FIXED) {
  71164. return Matrix3_default.multiplyByVector(
  71165. Matrix3_default.transpose(icrfToFixed2, scratchMatrix3),
  71166. value,
  71167. result
  71168. );
  71169. }
  71170. };
  71171. var PositionProperty_default = PositionProperty;
  71172. // node_modules/cesium/Source/DataSources/ConstantPositionProperty.js
  71173. function ConstantPositionProperty(value, referenceFrame) {
  71174. this._definitionChanged = new Event_default();
  71175. this._value = Cartesian3_default.clone(value);
  71176. this._referenceFrame = defaultValue_default(referenceFrame, ReferenceFrame_default.FIXED);
  71177. }
  71178. Object.defineProperties(ConstantPositionProperty.prototype, {
  71179. isConstant: {
  71180. get: function() {
  71181. return !defined_default(this._value) || this._referenceFrame === ReferenceFrame_default.FIXED;
  71182. }
  71183. },
  71184. definitionChanged: {
  71185. get: function() {
  71186. return this._definitionChanged;
  71187. }
  71188. },
  71189. referenceFrame: {
  71190. get: function() {
  71191. return this._referenceFrame;
  71192. }
  71193. }
  71194. });
  71195. ConstantPositionProperty.prototype.getValue = function(time, result) {
  71196. return this.getValueInReferenceFrame(time, ReferenceFrame_default.FIXED, result);
  71197. };
  71198. ConstantPositionProperty.prototype.setValue = function(value, referenceFrame) {
  71199. let definitionChanged = false;
  71200. if (!Cartesian3_default.equals(this._value, value)) {
  71201. definitionChanged = true;
  71202. this._value = Cartesian3_default.clone(value);
  71203. }
  71204. if (defined_default(referenceFrame) && this._referenceFrame !== referenceFrame) {
  71205. definitionChanged = true;
  71206. this._referenceFrame = referenceFrame;
  71207. }
  71208. if (definitionChanged) {
  71209. this._definitionChanged.raiseEvent(this);
  71210. }
  71211. };
  71212. ConstantPositionProperty.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) {
  71213. if (!defined_default(time)) {
  71214. throw new DeveloperError_default("time is required.");
  71215. }
  71216. if (!defined_default(referenceFrame)) {
  71217. throw new DeveloperError_default("referenceFrame is required.");
  71218. }
  71219. return PositionProperty_default.convertToReferenceFrame(
  71220. time,
  71221. this._value,
  71222. this._referenceFrame,
  71223. referenceFrame,
  71224. result
  71225. );
  71226. };
  71227. ConstantPositionProperty.prototype.equals = function(other) {
  71228. return this === other || other instanceof ConstantPositionProperty && Cartesian3_default.equals(this._value, other._value) && this._referenceFrame === other._referenceFrame;
  71229. };
  71230. var ConstantPositionProperty_default = ConstantPositionProperty;
  71231. // node_modules/cesium/Source/DataSources/CorridorGraphics.js
  71232. function CorridorGraphics(options) {
  71233. this._definitionChanged = new Event_default();
  71234. this._show = void 0;
  71235. this._showSubscription = void 0;
  71236. this._positions = void 0;
  71237. this._positionsSubscription = void 0;
  71238. this._width = void 0;
  71239. this._widthSubscription = void 0;
  71240. this._height = void 0;
  71241. this._heightSubscription = void 0;
  71242. this._heightReference = void 0;
  71243. this._heightReferenceSubscription = void 0;
  71244. this._extrudedHeight = void 0;
  71245. this._extrudedHeightSubscription = void 0;
  71246. this._extrudedHeightReference = void 0;
  71247. this._extrudedHeightReferenceSubscription = void 0;
  71248. this._cornerType = void 0;
  71249. this._cornerTypeSubscription = void 0;
  71250. this._granularity = void 0;
  71251. this._granularitySubscription = void 0;
  71252. this._fill = void 0;
  71253. this._fillSubscription = void 0;
  71254. this._material = void 0;
  71255. this._materialSubscription = void 0;
  71256. this._outline = void 0;
  71257. this._outlineSubscription = void 0;
  71258. this._outlineColor = void 0;
  71259. this._outlineColorSubscription = void 0;
  71260. this._outlineWidth = void 0;
  71261. this._outlineWidthSubscription = void 0;
  71262. this._shadows = void 0;
  71263. this._shadowsSubscription = void 0;
  71264. this._distanceDisplayCondition = void 0;
  71265. this._distanceDisplayConditionSubscription = void 0;
  71266. this._classificationType = void 0;
  71267. this._classificationTypeSubscription = void 0;
  71268. this._zIndex = void 0;
  71269. this._zIndexSubscription = void 0;
  71270. this.merge(defaultValue_default(options, defaultValue_default.EMPTY_OBJECT));
  71271. }
  71272. Object.defineProperties(CorridorGraphics.prototype, {
  71273. definitionChanged: {
  71274. get: function() {
  71275. return this._definitionChanged;
  71276. }
  71277. },
  71278. show: createPropertyDescriptor_default("show"),
  71279. positions: createPropertyDescriptor_default("positions"),
  71280. width: createPropertyDescriptor_default("width"),
  71281. height: createPropertyDescriptor_default("height"),
  71282. heightReference: createPropertyDescriptor_default("heightReference"),
  71283. extrudedHeight: createPropertyDescriptor_default("extrudedHeight"),
  71284. extrudedHeightReference: createPropertyDescriptor_default("extrudedHeightReference"),
  71285. cornerType: createPropertyDescriptor_default("cornerType"),
  71286. granularity: createPropertyDescriptor_default("granularity"),
  71287. fill: createPropertyDescriptor_default("fill"),
  71288. material: createMaterialPropertyDescriptor_default("material"),
  71289. outline: createPropertyDescriptor_default("outline"),
  71290. outlineColor: createPropertyDescriptor_default("outlineColor"),
  71291. outlineWidth: createPropertyDescriptor_default("outlineWidth"),
  71292. shadows: createPropertyDescriptor_default("shadows"),
  71293. distanceDisplayCondition: createPropertyDescriptor_default(
  71294. "distanceDisplayCondition"
  71295. ),
  71296. classificationType: createPropertyDescriptor_default("classificationType"),
  71297. zIndex: createPropertyDescriptor_default("zIndex")
  71298. });
  71299. CorridorGraphics.prototype.clone = function(result) {
  71300. if (!defined_default(result)) {
  71301. return new CorridorGraphics(this);
  71302. }
  71303. result.show = this.show;
  71304. result.positions = this.positions;
  71305. result.width = this.width;
  71306. result.height = this.height;
  71307. result.heightReference = this.heightReference;
  71308. result.extrudedHeight = this.extrudedHeight;
  71309. result.extrudedHeightReference = this.extrudedHeightReference;
  71310. result.cornerType = this.cornerType;
  71311. result.granularity = this.granularity;
  71312. result.fill = this.fill;
  71313. result.material = this.material;
  71314. result.outline = this.outline;
  71315. result.outlineColor = this.outlineColor;
  71316. result.outlineWidth = this.outlineWidth;
  71317. result.shadows = this.shadows;
  71318. result.distanceDisplayCondition = this.distanceDisplayCondition;
  71319. result.classificationType = this.classificationType;
  71320. result.zIndex = this.zIndex;
  71321. return result;
  71322. };
  71323. CorridorGraphics.prototype.merge = function(source) {
  71324. if (!defined_default(source)) {
  71325. throw new DeveloperError_default("source is required.");
  71326. }
  71327. this.show = defaultValue_default(this.show, source.show);
  71328. this.positions = defaultValue_default(this.positions, source.positions);
  71329. this.width = defaultValue_default(this.width, source.width);
  71330. this.height = defaultValue_default(this.height, source.height);
  71331. this.heightReference = defaultValue_default(
  71332. this.heightReference,
  71333. source.heightReference
  71334. );
  71335. this.extrudedHeight = defaultValue_default(
  71336. this.extrudedHeight,
  71337. source.extrudedHeight
  71338. );
  71339. this.extrudedHeightReference = defaultValue_default(
  71340. this.extrudedHeightReference,
  71341. source.extrudedHeightReference
  71342. );
  71343. this.cornerType = defaultValue_default(this.cornerType, source.cornerType);
  71344. this.granularity = defaultValue_default(this.granularity, source.granularity);
  71345. this.fill = defaultValue_default(this.fill, source.fill);
  71346. this.material = defaultValue_default(this.material, source.material);
  71347. this.outline = defaultValue_default(this.outline, source.outline);
  71348. this.outlineColor = defaultValue_default(this.outlineColor, source.outlineColor);
  71349. this.outlineWidth = defaultValue_default(this.outlineWidth, source.outlineWidth);
  71350. this.shadows = defaultValue_default(this.shadows, source.shadows);
  71351. this.distanceDisplayCondition = defaultValue_default(
  71352. this.distanceDisplayCondition,
  71353. source.distanceDisplayCondition
  71354. );
  71355. this.classificationType = defaultValue_default(
  71356. this.classificationType,
  71357. source.classificationType
  71358. );
  71359. this.zIndex = defaultValue_default(this.zIndex, source.zIndex);
  71360. };
  71361. var CorridorGraphics_default = CorridorGraphics;
  71362. // node_modules/cesium/Source/DataSources/createRawPropertyDescriptor.js
  71363. function createRawProperty(value) {
  71364. return value;
  71365. }
  71366. function createRawPropertyDescriptor(name, configurable) {
  71367. return createPropertyDescriptor_default(name, configurable, createRawProperty);
  71368. }
  71369. var createRawPropertyDescriptor_default = createRawPropertyDescriptor;
  71370. // node_modules/cesium/Source/DataSources/CylinderGraphics.js
  71371. function CylinderGraphics(options) {
  71372. this._definitionChanged = new Event_default();
  71373. this._show = void 0;
  71374. this._showSubscription = void 0;
  71375. this._length = void 0;
  71376. this._lengthSubscription = void 0;
  71377. this._topRadius = void 0;
  71378. this._topRadiusSubscription = void 0;
  71379. this._bottomRadius = void 0;
  71380. this._bottomRadiusSubscription = void 0;
  71381. this._heightReference = void 0;
  71382. this._heightReferenceSubscription = void 0;
  71383. this._fill = void 0;
  71384. this._fillSubscription = void 0;
  71385. this._material = void 0;
  71386. this._materialSubscription = void 0;
  71387. this._outline = void 0;
  71388. this._outlineSubscription = void 0;
  71389. this._outlineColor = void 0;
  71390. this._outlineColorSubscription = void 0;
  71391. this._outlineWidth = void 0;
  71392. this._outlineWidthSubscription = void 0;
  71393. this._numberOfVerticalLines = void 0;
  71394. this._numberOfVerticalLinesSubscription = void 0;
  71395. this._slices = void 0;
  71396. this._slicesSubscription = void 0;
  71397. this._shadows = void 0;
  71398. this._shadowsSubscription = void 0;
  71399. this._distanceDisplayCondition = void 0;
  71400. this._distanceDisplayConditionSubscription = void 0;
  71401. this.merge(defaultValue_default(options, defaultValue_default.EMPTY_OBJECT));
  71402. }
  71403. Object.defineProperties(CylinderGraphics.prototype, {
  71404. definitionChanged: {
  71405. get: function() {
  71406. return this._definitionChanged;
  71407. }
  71408. },
  71409. show: createPropertyDescriptor_default("show"),
  71410. length: createPropertyDescriptor_default("length"),
  71411. topRadius: createPropertyDescriptor_default("topRadius"),
  71412. bottomRadius: createPropertyDescriptor_default("bottomRadius"),
  71413. heightReference: createPropertyDescriptor_default("heightReference"),
  71414. fill: createPropertyDescriptor_default("fill"),
  71415. material: createMaterialPropertyDescriptor_default("material"),
  71416. outline: createPropertyDescriptor_default("outline"),
  71417. outlineColor: createPropertyDescriptor_default("outlineColor"),
  71418. outlineWidth: createPropertyDescriptor_default("outlineWidth"),
  71419. numberOfVerticalLines: createPropertyDescriptor_default("numberOfVerticalLines"),
  71420. slices: createPropertyDescriptor_default("slices"),
  71421. shadows: createPropertyDescriptor_default("shadows"),
  71422. distanceDisplayCondition: createPropertyDescriptor_default(
  71423. "distanceDisplayCondition"
  71424. )
  71425. });
  71426. CylinderGraphics.prototype.clone = function(result) {
  71427. if (!defined_default(result)) {
  71428. return new CylinderGraphics(this);
  71429. }
  71430. result.show = this.show;
  71431. result.length = this.length;
  71432. result.topRadius = this.topRadius;
  71433. result.bottomRadius = this.bottomRadius;
  71434. result.heightReference = this.heightReference;
  71435. result.fill = this.fill;
  71436. result.material = this.material;
  71437. result.outline = this.outline;
  71438. result.outlineColor = this.outlineColor;
  71439. result.outlineWidth = this.outlineWidth;
  71440. result.numberOfVerticalLines = this.numberOfVerticalLines;
  71441. result.slices = this.slices;
  71442. result.shadows = this.shadows;
  71443. result.distanceDisplayCondition = this.distanceDisplayCondition;
  71444. return result;
  71445. };
  71446. CylinderGraphics.prototype.merge = function(source) {
  71447. if (!defined_default(source)) {
  71448. throw new DeveloperError_default("source is required.");
  71449. }
  71450. this.show = defaultValue_default(this.show, source.show);
  71451. this.length = defaultValue_default(this.length, source.length);
  71452. this.topRadius = defaultValue_default(this.topRadius, source.topRadius);
  71453. this.bottomRadius = defaultValue_default(this.bottomRadius, source.bottomRadius);
  71454. this.heightReference = defaultValue_default(
  71455. this.heightReference,
  71456. source.heightReference
  71457. );
  71458. this.fill = defaultValue_default(this.fill, source.fill);
  71459. this.material = defaultValue_default(this.material, source.material);
  71460. this.outline = defaultValue_default(this.outline, source.outline);
  71461. this.outlineColor = defaultValue_default(this.outlineColor, source.outlineColor);
  71462. this.outlineWidth = defaultValue_default(this.outlineWidth, source.outlineWidth);
  71463. this.numberOfVerticalLines = defaultValue_default(
  71464. this.numberOfVerticalLines,
  71465. source.numberOfVerticalLines
  71466. );
  71467. this.slices = defaultValue_default(this.slices, source.slices);
  71468. this.shadows = defaultValue_default(this.shadows, source.shadows);
  71469. this.distanceDisplayCondition = defaultValue_default(
  71470. this.distanceDisplayCondition,
  71471. source.distanceDisplayCondition
  71472. );
  71473. };
  71474. var CylinderGraphics_default = CylinderGraphics;
  71475. // node_modules/cesium/Source/DataSources/EllipseGraphics.js
  71476. function EllipseGraphics(options) {
  71477. this._definitionChanged = new Event_default();
  71478. this._show = void 0;
  71479. this._showSubscription = void 0;
  71480. this._semiMajorAxis = void 0;
  71481. this._semiMajorAxisSubscription = void 0;
  71482. this._semiMinorAxis = void 0;
  71483. this._semiMinorAxisSubscription = void 0;
  71484. this._height = void 0;
  71485. this._heightSubscription = void 0;
  71486. this._heightReference = void 0;
  71487. this._heightReferenceSubscription = void 0;
  71488. this._extrudedHeight = void 0;
  71489. this._extrudedHeightSubscription = void 0;
  71490. this._extrudedHeightReference = void 0;
  71491. this._extrudedHeightReferenceSubscription = void 0;
  71492. this._rotation = void 0;
  71493. this._rotationSubscription = void 0;
  71494. this._stRotation = void 0;
  71495. this._stRotationSubscription = void 0;
  71496. this._granularity = void 0;
  71497. this._granularitySubscription = void 0;
  71498. this._fill = void 0;
  71499. this._fillSubscription = void 0;
  71500. this._material = void 0;
  71501. this._materialSubscription = void 0;
  71502. this._outline = void 0;
  71503. this._outlineSubscription = void 0;
  71504. this._outlineColor = void 0;
  71505. this._outlineColorSubscription = void 0;
  71506. this._outlineWidth = void 0;
  71507. this._outlineWidthSubscription = void 0;
  71508. this._numberOfVerticalLines = void 0;
  71509. this._numberOfVerticalLinesSubscription = void 0;
  71510. this._shadows = void 0;
  71511. this._shadowsSubscription = void 0;
  71512. this._distanceDisplayCondition = void 0;
  71513. this._distanceDisplayConditionSubscription = void 0;
  71514. this._classificationType = void 0;
  71515. this._classificationTypeSubscription = void 0;
  71516. this._zIndex = void 0;
  71517. this._zIndexSubscription = void 0;
  71518. this.merge(defaultValue_default(options, defaultValue_default.EMPTY_OBJECT));
  71519. }
  71520. Object.defineProperties(EllipseGraphics.prototype, {
  71521. definitionChanged: {
  71522. get: function() {
  71523. return this._definitionChanged;
  71524. }
  71525. },
  71526. show: createPropertyDescriptor_default("show"),
  71527. semiMajorAxis: createPropertyDescriptor_default("semiMajorAxis"),
  71528. semiMinorAxis: createPropertyDescriptor_default("semiMinorAxis"),
  71529. height: createPropertyDescriptor_default("height"),
  71530. heightReference: createPropertyDescriptor_default("heightReference"),
  71531. extrudedHeight: createPropertyDescriptor_default("extrudedHeight"),
  71532. extrudedHeightReference: createPropertyDescriptor_default("extrudedHeightReference"),
  71533. rotation: createPropertyDescriptor_default("rotation"),
  71534. stRotation: createPropertyDescriptor_default("stRotation"),
  71535. granularity: createPropertyDescriptor_default("granularity"),
  71536. fill: createPropertyDescriptor_default("fill"),
  71537. material: createMaterialPropertyDescriptor_default("material"),
  71538. outline: createPropertyDescriptor_default("outline"),
  71539. outlineColor: createPropertyDescriptor_default("outlineColor"),
  71540. outlineWidth: createPropertyDescriptor_default("outlineWidth"),
  71541. numberOfVerticalLines: createPropertyDescriptor_default("numberOfVerticalLines"),
  71542. shadows: createPropertyDescriptor_default("shadows"),
  71543. distanceDisplayCondition: createPropertyDescriptor_default(
  71544. "distanceDisplayCondition"
  71545. ),
  71546. classificationType: createPropertyDescriptor_default("classificationType"),
  71547. zIndex: createPropertyDescriptor_default("zIndex")
  71548. });
  71549. EllipseGraphics.prototype.clone = function(result) {
  71550. if (!defined_default(result)) {
  71551. return new EllipseGraphics(this);
  71552. }
  71553. result.show = this.show;
  71554. result.semiMajorAxis = this.semiMajorAxis;
  71555. result.semiMinorAxis = this.semiMinorAxis;
  71556. result.height = this.height;
  71557. result.heightReference = this.heightReference;
  71558. result.extrudedHeight = this.extrudedHeight;
  71559. result.extrudedHeightReference = this.extrudedHeightReference;
  71560. result.rotation = this.rotation;
  71561. result.stRotation = this.stRotation;
  71562. result.granularity = this.granularity;
  71563. result.fill = this.fill;
  71564. result.material = this.material;
  71565. result.outline = this.outline;
  71566. result.outlineColor = this.outlineColor;
  71567. result.outlineWidth = this.outlineWidth;
  71568. result.numberOfVerticalLines = this.numberOfVerticalLines;
  71569. result.shadows = this.shadows;
  71570. result.distanceDisplayCondition = this.distanceDisplayCondition;
  71571. result.classificationType = this.classificationType;
  71572. result.zIndex = this.zIndex;
  71573. return result;
  71574. };
  71575. EllipseGraphics.prototype.merge = function(source) {
  71576. if (!defined_default(source)) {
  71577. throw new DeveloperError_default("source is required.");
  71578. }
  71579. this.show = defaultValue_default(this.show, source.show);
  71580. this.semiMajorAxis = defaultValue_default(this.semiMajorAxis, source.semiMajorAxis);
  71581. this.semiMinorAxis = defaultValue_default(this.semiMinorAxis, source.semiMinorAxis);
  71582. this.height = defaultValue_default(this.height, source.height);
  71583. this.heightReference = defaultValue_default(
  71584. this.heightReference,
  71585. source.heightReference
  71586. );
  71587. this.extrudedHeight = defaultValue_default(
  71588. this.extrudedHeight,
  71589. source.extrudedHeight
  71590. );
  71591. this.extrudedHeightReference = defaultValue_default(
  71592. this.extrudedHeightReference,
  71593. source.extrudedHeightReference
  71594. );
  71595. this.rotation = defaultValue_default(this.rotation, source.rotation);
  71596. this.stRotation = defaultValue_default(this.stRotation, source.stRotation);
  71597. this.granularity = defaultValue_default(this.granularity, source.granularity);
  71598. this.fill = defaultValue_default(this.fill, source.fill);
  71599. this.material = defaultValue_default(this.material, source.material);
  71600. this.outline = defaultValue_default(this.outline, source.outline);
  71601. this.outlineColor = defaultValue_default(this.outlineColor, source.outlineColor);
  71602. this.outlineWidth = defaultValue_default(this.outlineWidth, source.outlineWidth);
  71603. this.numberOfVerticalLines = defaultValue_default(
  71604. this.numberOfVerticalLines,
  71605. source.numberOfVerticalLines
  71606. );
  71607. this.shadows = defaultValue_default(this.shadows, source.shadows);
  71608. this.distanceDisplayCondition = defaultValue_default(
  71609. this.distanceDisplayCondition,
  71610. source.distanceDisplayCondition
  71611. );
  71612. this.classificationType = defaultValue_default(
  71613. this.classificationType,
  71614. source.classificationType
  71615. );
  71616. this.zIndex = defaultValue_default(this.zIndex, source.zIndex);
  71617. };
  71618. var EllipseGraphics_default = EllipseGraphics;
  71619. // node_modules/cesium/Source/DataSources/EllipsoidGraphics.js
  71620. function EllipsoidGraphics(options) {
  71621. this._definitionChanged = new Event_default();
  71622. this._show = void 0;
  71623. this._showSubscription = void 0;
  71624. this._radii = void 0;
  71625. this._radiiSubscription = void 0;
  71626. this._innerRadii = void 0;
  71627. this._innerRadiiSubscription = void 0;
  71628. this._minimumClock = void 0;
  71629. this._minimumClockSubscription = void 0;
  71630. this._maximumClock = void 0;
  71631. this._maximumClockSubscription = void 0;
  71632. this._minimumCone = void 0;
  71633. this._minimumConeSubscription = void 0;
  71634. this._maximumCone = void 0;
  71635. this._maximumConeSubscription = void 0;
  71636. this._heightReference = void 0;
  71637. this._heightReferenceSubscription = void 0;
  71638. this._fill = void 0;
  71639. this._fillSubscription = void 0;
  71640. this._material = void 0;
  71641. this._materialSubscription = void 0;
  71642. this._outline = void 0;
  71643. this._outlineSubscription = void 0;
  71644. this._outlineColor = void 0;
  71645. this._outlineColorSubscription = void 0;
  71646. this._outlineWidth = void 0;
  71647. this._outlineWidthSubscription = void 0;
  71648. this._stackPartitions = void 0;
  71649. this._stackPartitionsSubscription = void 0;
  71650. this._slicePartitions = void 0;
  71651. this._slicePartitionsSubscription = void 0;
  71652. this._subdivisions = void 0;
  71653. this._subdivisionsSubscription = void 0;
  71654. this._shadows = void 0;
  71655. this._shadowsSubscription = void 0;
  71656. this._distanceDisplayCondition = void 0;
  71657. this._distanceDisplayConditionSubscription = void 0;
  71658. this.merge(defaultValue_default(options, defaultValue_default.EMPTY_OBJECT));
  71659. }
  71660. Object.defineProperties(EllipsoidGraphics.prototype, {
  71661. definitionChanged: {
  71662. get: function() {
  71663. return this._definitionChanged;
  71664. }
  71665. },
  71666. show: createPropertyDescriptor_default("show"),
  71667. radii: createPropertyDescriptor_default("radii"),
  71668. innerRadii: createPropertyDescriptor_default("innerRadii"),
  71669. minimumClock: createPropertyDescriptor_default("minimumClock"),
  71670. maximumClock: createPropertyDescriptor_default("maximumClock"),
  71671. minimumCone: createPropertyDescriptor_default("minimumCone"),
  71672. maximumCone: createPropertyDescriptor_default("maximumCone"),
  71673. heightReference: createPropertyDescriptor_default("heightReference"),
  71674. fill: createPropertyDescriptor_default("fill"),
  71675. material: createMaterialPropertyDescriptor_default("material"),
  71676. outline: createPropertyDescriptor_default("outline"),
  71677. outlineColor: createPropertyDescriptor_default("outlineColor"),
  71678. outlineWidth: createPropertyDescriptor_default("outlineWidth"),
  71679. stackPartitions: createPropertyDescriptor_default("stackPartitions"),
  71680. slicePartitions: createPropertyDescriptor_default("slicePartitions"),
  71681. subdivisions: createPropertyDescriptor_default("subdivisions"),
  71682. shadows: createPropertyDescriptor_default("shadows"),
  71683. distanceDisplayCondition: createPropertyDescriptor_default(
  71684. "distanceDisplayCondition"
  71685. )
  71686. });
  71687. EllipsoidGraphics.prototype.clone = function(result) {
  71688. if (!defined_default(result)) {
  71689. return new EllipsoidGraphics(this);
  71690. }
  71691. result.show = this.show;
  71692. result.radii = this.radii;
  71693. result.innerRadii = this.innerRadii;
  71694. result.minimumClock = this.minimumClock;
  71695. result.maximumClock = this.maximumClock;
  71696. result.minimumCone = this.minimumCone;
  71697. result.maximumCone = this.maximumCone;
  71698. result.heightReference = this.heightReference;
  71699. result.fill = this.fill;
  71700. result.material = this.material;
  71701. result.outline = this.outline;
  71702. result.outlineColor = this.outlineColor;
  71703. result.outlineWidth = this.outlineWidth;
  71704. result.stackPartitions = this.stackPartitions;
  71705. result.slicePartitions = this.slicePartitions;
  71706. result.subdivisions = this.subdivisions;
  71707. result.shadows = this.shadows;
  71708. result.distanceDisplayCondition = this.distanceDisplayCondition;
  71709. return result;
  71710. };
  71711. EllipsoidGraphics.prototype.merge = function(source) {
  71712. if (!defined_default(source)) {
  71713. throw new DeveloperError_default("source is required.");
  71714. }
  71715. this.show = defaultValue_default(this.show, source.show);
  71716. this.radii = defaultValue_default(this.radii, source.radii);
  71717. this.innerRadii = defaultValue_default(this.innerRadii, source.innerRadii);
  71718. this.minimumClock = defaultValue_default(this.minimumClock, source.minimumClock);
  71719. this.maximumClock = defaultValue_default(this.maximumClock, source.maximumClock);
  71720. this.minimumCone = defaultValue_default(this.minimumCone, source.minimumCone);
  71721. this.maximumCone = defaultValue_default(this.maximumCone, source.maximumCone);
  71722. this.heightReference = defaultValue_default(
  71723. this.heightReference,
  71724. source.heightReference
  71725. );
  71726. this.fill = defaultValue_default(this.fill, source.fill);
  71727. this.material = defaultValue_default(this.material, source.material);
  71728. this.outline = defaultValue_default(this.outline, source.outline);
  71729. this.outlineColor = defaultValue_default(this.outlineColor, source.outlineColor);
  71730. this.outlineWidth = defaultValue_default(this.outlineWidth, source.outlineWidth);
  71731. this.stackPartitions = defaultValue_default(
  71732. this.stackPartitions,
  71733. source.stackPartitions
  71734. );
  71735. this.slicePartitions = defaultValue_default(
  71736. this.slicePartitions,
  71737. source.slicePartitions
  71738. );
  71739. this.subdivisions = defaultValue_default(this.subdivisions, source.subdivisions);
  71740. this.shadows = defaultValue_default(this.shadows, source.shadows);
  71741. this.distanceDisplayCondition = defaultValue_default(
  71742. this.distanceDisplayCondition,
  71743. source.distanceDisplayCondition
  71744. );
  71745. };
  71746. var EllipsoidGraphics_default = EllipsoidGraphics;
  71747. // node_modules/cesium/Source/DataSources/LabelGraphics.js
  71748. function LabelGraphics(options) {
  71749. this._definitionChanged = new Event_default();
  71750. this._show = void 0;
  71751. this._showSubscription = void 0;
  71752. this._text = void 0;
  71753. this._textSubscription = void 0;
  71754. this._font = void 0;
  71755. this._fontSubscription = void 0;
  71756. this._style = void 0;
  71757. this._styleSubscription = void 0;
  71758. this._scale = void 0;
  71759. this._scaleSubscription = void 0;
  71760. this._showBackground = void 0;
  71761. this._showBackgroundSubscription = void 0;
  71762. this._backgroundColor = void 0;
  71763. this._backgroundColorSubscription = void 0;
  71764. this._backgroundPadding = void 0;
  71765. this._backgroundPaddingSubscription = void 0;
  71766. this._pixelOffset = void 0;
  71767. this._pixelOffsetSubscription = void 0;
  71768. this._eyeOffset = void 0;
  71769. this._eyeOffsetSubscription = void 0;
  71770. this._horizontalOrigin = void 0;
  71771. this._horizontalOriginSubscription = void 0;
  71772. this._verticalOrigin = void 0;
  71773. this._verticalOriginSubscription = void 0;
  71774. this._heightReference = void 0;
  71775. this._heightReferenceSubscription = void 0;
  71776. this._fillColor = void 0;
  71777. this._fillColorSubscription = void 0;
  71778. this._outlineColor = void 0;
  71779. this._outlineColorSubscription = void 0;
  71780. this._outlineWidth = void 0;
  71781. this._outlineWidthSubscription = void 0;
  71782. this._translucencyByDistance = void 0;
  71783. this._translucencyByDistanceSubscription = void 0;
  71784. this._pixelOffsetScaleByDistance = void 0;
  71785. this._pixelOffsetScaleByDistanceSubscription = void 0;
  71786. this._scaleByDistance = void 0;
  71787. this._scaleByDistanceSubscription = void 0;
  71788. this._distanceDisplayCondition = void 0;
  71789. this._distanceDisplayConditionSubscription = void 0;
  71790. this._disableDepthTestDistance = void 0;
  71791. this._disableDepthTestDistanceSubscription = void 0;
  71792. this.merge(defaultValue_default(options, defaultValue_default.EMPTY_OBJECT));
  71793. }
  71794. Object.defineProperties(LabelGraphics.prototype, {
  71795. definitionChanged: {
  71796. get: function() {
  71797. return this._definitionChanged;
  71798. }
  71799. },
  71800. show: createPropertyDescriptor_default("show"),
  71801. text: createPropertyDescriptor_default("text"),
  71802. font: createPropertyDescriptor_default("font"),
  71803. style: createPropertyDescriptor_default("style"),
  71804. scale: createPropertyDescriptor_default("scale"),
  71805. showBackground: createPropertyDescriptor_default("showBackground"),
  71806. backgroundColor: createPropertyDescriptor_default("backgroundColor"),
  71807. backgroundPadding: createPropertyDescriptor_default("backgroundPadding"),
  71808. pixelOffset: createPropertyDescriptor_default("pixelOffset"),
  71809. eyeOffset: createPropertyDescriptor_default("eyeOffset"),
  71810. horizontalOrigin: createPropertyDescriptor_default("horizontalOrigin"),
  71811. verticalOrigin: createPropertyDescriptor_default("verticalOrigin"),
  71812. heightReference: createPropertyDescriptor_default("heightReference"),
  71813. fillColor: createPropertyDescriptor_default("fillColor"),
  71814. outlineColor: createPropertyDescriptor_default("outlineColor"),
  71815. outlineWidth: createPropertyDescriptor_default("outlineWidth"),
  71816. translucencyByDistance: createPropertyDescriptor_default("translucencyByDistance"),
  71817. pixelOffsetScaleByDistance: createPropertyDescriptor_default(
  71818. "pixelOffsetScaleByDistance"
  71819. ),
  71820. scaleByDistance: createPropertyDescriptor_default("scaleByDistance"),
  71821. distanceDisplayCondition: createPropertyDescriptor_default(
  71822. "distanceDisplayCondition"
  71823. ),
  71824. disableDepthTestDistance: createPropertyDescriptor_default(
  71825. "disableDepthTestDistance"
  71826. )
  71827. });
  71828. LabelGraphics.prototype.clone = function(result) {
  71829. if (!defined_default(result)) {
  71830. return new LabelGraphics(this);
  71831. }
  71832. result.show = this.show;
  71833. result.text = this.text;
  71834. result.font = this.font;
  71835. result.style = this.style;
  71836. result.scale = this.scale;
  71837. result.showBackground = this.showBackground;
  71838. result.backgroundColor = this.backgroundColor;
  71839. result.backgroundPadding = this.backgroundPadding;
  71840. result.pixelOffset = this.pixelOffset;
  71841. result.eyeOffset = this.eyeOffset;
  71842. result.horizontalOrigin = this.horizontalOrigin;
  71843. result.verticalOrigin = this.verticalOrigin;
  71844. result.heightReference = this.heightReference;
  71845. result.fillColor = this.fillColor;
  71846. result.outlineColor = this.outlineColor;
  71847. result.outlineWidth = this.outlineWidth;
  71848. result.translucencyByDistance = this.translucencyByDistance;
  71849. result.pixelOffsetScaleByDistance = this.pixelOffsetScaleByDistance;
  71850. result.scaleByDistance = this.scaleByDistance;
  71851. result.distanceDisplayCondition = this.distanceDisplayCondition;
  71852. result.disableDepthTestDistance = this.disableDepthTestDistance;
  71853. return result;
  71854. };
  71855. LabelGraphics.prototype.merge = function(source) {
  71856. if (!defined_default(source)) {
  71857. throw new DeveloperError_default("source is required.");
  71858. }
  71859. this.show = defaultValue_default(this.show, source.show);
  71860. this.text = defaultValue_default(this.text, source.text);
  71861. this.font = defaultValue_default(this.font, source.font);
  71862. this.style = defaultValue_default(this.style, source.style);
  71863. this.scale = defaultValue_default(this.scale, source.scale);
  71864. this.showBackground = defaultValue_default(
  71865. this.showBackground,
  71866. source.showBackground
  71867. );
  71868. this.backgroundColor = defaultValue_default(
  71869. this.backgroundColor,
  71870. source.backgroundColor
  71871. );
  71872. this.backgroundPadding = defaultValue_default(
  71873. this.backgroundPadding,
  71874. source.backgroundPadding
  71875. );
  71876. this.pixelOffset = defaultValue_default(this.pixelOffset, source.pixelOffset);
  71877. this.eyeOffset = defaultValue_default(this.eyeOffset, source.eyeOffset);
  71878. this.horizontalOrigin = defaultValue_default(
  71879. this.horizontalOrigin,
  71880. source.horizontalOrigin
  71881. );
  71882. this.verticalOrigin = defaultValue_default(
  71883. this.verticalOrigin,
  71884. source.verticalOrigin
  71885. );
  71886. this.heightReference = defaultValue_default(
  71887. this.heightReference,
  71888. source.heightReference
  71889. );
  71890. this.fillColor = defaultValue_default(this.fillColor, source.fillColor);
  71891. this.outlineColor = defaultValue_default(this.outlineColor, source.outlineColor);
  71892. this.outlineWidth = defaultValue_default(this.outlineWidth, source.outlineWidth);
  71893. this.translucencyByDistance = defaultValue_default(
  71894. this.translucencyByDistance,
  71895. source.translucencyByDistance
  71896. );
  71897. this.pixelOffsetScaleByDistance = defaultValue_default(
  71898. this.pixelOffsetScaleByDistance,
  71899. source.pixelOffsetScaleByDistance
  71900. );
  71901. this.scaleByDistance = defaultValue_default(
  71902. this.scaleByDistance,
  71903. source.scaleByDistance
  71904. );
  71905. this.distanceDisplayCondition = defaultValue_default(
  71906. this.distanceDisplayCondition,
  71907. source.distanceDisplayCondition
  71908. );
  71909. this.disableDepthTestDistance = defaultValue_default(
  71910. this.disableDepthTestDistance,
  71911. source.disableDepthTestDistance
  71912. );
  71913. };
  71914. var LabelGraphics_default = LabelGraphics;
  71915. // node_modules/cesium/Source/DataSources/NodeTransformationProperty.js
  71916. var defaultNodeTransformation = new TranslationRotationScale_default();
  71917. function NodeTransformationProperty(options) {
  71918. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  71919. this._definitionChanged = new Event_default();
  71920. this._translation = void 0;
  71921. this._translationSubscription = void 0;
  71922. this._rotation = void 0;
  71923. this._rotationSubscription = void 0;
  71924. this._scale = void 0;
  71925. this._scaleSubscription = void 0;
  71926. this.translation = options.translation;
  71927. this.rotation = options.rotation;
  71928. this.scale = options.scale;
  71929. }
  71930. Object.defineProperties(NodeTransformationProperty.prototype, {
  71931. isConstant: {
  71932. get: function() {
  71933. return Property_default.isConstant(this._translation) && Property_default.isConstant(this._rotation) && Property_default.isConstant(this._scale);
  71934. }
  71935. },
  71936. definitionChanged: {
  71937. get: function() {
  71938. return this._definitionChanged;
  71939. }
  71940. },
  71941. translation: createPropertyDescriptor_default("translation"),
  71942. rotation: createPropertyDescriptor_default("rotation"),
  71943. scale: createPropertyDescriptor_default("scale")
  71944. });
  71945. NodeTransformationProperty.prototype.getValue = function(time, result) {
  71946. if (!defined_default(result)) {
  71947. result = new TranslationRotationScale_default();
  71948. }
  71949. result.translation = Property_default.getValueOrClonedDefault(
  71950. this._translation,
  71951. time,
  71952. defaultNodeTransformation.translation,
  71953. result.translation
  71954. );
  71955. result.rotation = Property_default.getValueOrClonedDefault(
  71956. this._rotation,
  71957. time,
  71958. defaultNodeTransformation.rotation,
  71959. result.rotation
  71960. );
  71961. result.scale = Property_default.getValueOrClonedDefault(
  71962. this._scale,
  71963. time,
  71964. defaultNodeTransformation.scale,
  71965. result.scale
  71966. );
  71967. return result;
  71968. };
  71969. NodeTransformationProperty.prototype.equals = function(other) {
  71970. return this === other || other instanceof NodeTransformationProperty && Property_default.equals(this._translation, other._translation) && Property_default.equals(this._rotation, other._rotation) && Property_default.equals(this._scale, other._scale);
  71971. };
  71972. var NodeTransformationProperty_default = NodeTransformationProperty;
  71973. // node_modules/cesium/Source/DataSources/PropertyBag.js
  71974. function PropertyBag(value, createPropertyCallback) {
  71975. this._propertyNames = [];
  71976. this._definitionChanged = new Event_default();
  71977. if (defined_default(value)) {
  71978. this.merge(value, createPropertyCallback);
  71979. }
  71980. }
  71981. Object.defineProperties(PropertyBag.prototype, {
  71982. propertyNames: {
  71983. get: function() {
  71984. return this._propertyNames;
  71985. }
  71986. },
  71987. isConstant: {
  71988. get: function() {
  71989. const propertyNames = this._propertyNames;
  71990. for (let i2 = 0, len = propertyNames.length; i2 < len; i2++) {
  71991. if (!Property_default.isConstant(this[propertyNames[i2]])) {
  71992. return false;
  71993. }
  71994. }
  71995. return true;
  71996. }
  71997. },
  71998. definitionChanged: {
  71999. get: function() {
  72000. return this._definitionChanged;
  72001. }
  72002. }
  72003. });
  72004. PropertyBag.prototype.hasProperty = function(propertyName) {
  72005. return this._propertyNames.indexOf(propertyName) !== -1;
  72006. };
  72007. function createConstantProperty2(value) {
  72008. return new ConstantProperty_default(value);
  72009. }
  72010. PropertyBag.prototype.addProperty = function(propertyName, value, createPropertyCallback) {
  72011. const propertyNames = this._propertyNames;
  72012. if (!defined_default(propertyName)) {
  72013. throw new DeveloperError_default("propertyName is required.");
  72014. }
  72015. if (propertyNames.indexOf(propertyName) !== -1) {
  72016. throw new DeveloperError_default(
  72017. `${propertyName} is already a registered property.`
  72018. );
  72019. }
  72020. propertyNames.push(propertyName);
  72021. Object.defineProperty(
  72022. this,
  72023. propertyName,
  72024. createPropertyDescriptor_default(
  72025. propertyName,
  72026. true,
  72027. defaultValue_default(createPropertyCallback, createConstantProperty2)
  72028. )
  72029. );
  72030. if (defined_default(value)) {
  72031. this[propertyName] = value;
  72032. }
  72033. this._definitionChanged.raiseEvent(this);
  72034. };
  72035. PropertyBag.prototype.removeProperty = function(propertyName) {
  72036. const propertyNames = this._propertyNames;
  72037. const index2 = propertyNames.indexOf(propertyName);
  72038. if (!defined_default(propertyName)) {
  72039. throw new DeveloperError_default("propertyName is required.");
  72040. }
  72041. if (index2 === -1) {
  72042. throw new DeveloperError_default(`${propertyName} is not a registered property.`);
  72043. }
  72044. this._propertyNames.splice(index2, 1);
  72045. delete this[propertyName];
  72046. this._definitionChanged.raiseEvent(this);
  72047. };
  72048. PropertyBag.prototype.getValue = function(time, result) {
  72049. if (!defined_default(time)) {
  72050. throw new DeveloperError_default("time is required.");
  72051. }
  72052. if (!defined_default(result)) {
  72053. result = {};
  72054. }
  72055. const propertyNames = this._propertyNames;
  72056. for (let i2 = 0, len = propertyNames.length; i2 < len; i2++) {
  72057. const propertyName = propertyNames[i2];
  72058. result[propertyName] = Property_default.getValueOrUndefined(
  72059. this[propertyName],
  72060. time,
  72061. result[propertyName]
  72062. );
  72063. }
  72064. return result;
  72065. };
  72066. PropertyBag.prototype.merge = function(source, createPropertyCallback) {
  72067. if (!defined_default(source)) {
  72068. throw new DeveloperError_default("source is required.");
  72069. }
  72070. const propertyNames = this._propertyNames;
  72071. const sourcePropertyNames = defined_default(source._propertyNames) ? source._propertyNames : Object.keys(source);
  72072. for (let i2 = 0, len = sourcePropertyNames.length; i2 < len; i2++) {
  72073. const name = sourcePropertyNames[i2];
  72074. const targetProperty = this[name];
  72075. const sourceProperty = source[name];
  72076. if (targetProperty === void 0 && propertyNames.indexOf(name) === -1) {
  72077. this.addProperty(name, void 0, createPropertyCallback);
  72078. }
  72079. if (sourceProperty !== void 0) {
  72080. if (targetProperty !== void 0) {
  72081. if (defined_default(targetProperty) && defined_default(targetProperty.merge)) {
  72082. targetProperty.merge(sourceProperty);
  72083. }
  72084. } else if (defined_default(sourceProperty) && defined_default(sourceProperty.merge) && defined_default(sourceProperty.clone)) {
  72085. this[name] = sourceProperty.clone();
  72086. } else {
  72087. this[name] = sourceProperty;
  72088. }
  72089. }
  72090. }
  72091. };
  72092. function propertiesEqual(a4, b) {
  72093. const aPropertyNames = a4._propertyNames;
  72094. const bPropertyNames = b._propertyNames;
  72095. const len = aPropertyNames.length;
  72096. if (len !== bPropertyNames.length) {
  72097. return false;
  72098. }
  72099. for (let aIndex = 0; aIndex < len; ++aIndex) {
  72100. const name = aPropertyNames[aIndex];
  72101. const bIndex = bPropertyNames.indexOf(name);
  72102. if (bIndex === -1) {
  72103. return false;
  72104. }
  72105. if (!Property_default.equals(a4[name], b[name])) {
  72106. return false;
  72107. }
  72108. }
  72109. return true;
  72110. }
  72111. PropertyBag.prototype.equals = function(other) {
  72112. return this === other || other instanceof PropertyBag && propertiesEqual(this, other);
  72113. };
  72114. var PropertyBag_default = PropertyBag;
  72115. // node_modules/cesium/Source/DataSources/ModelGraphics.js
  72116. function createNodeTransformationProperty(value) {
  72117. return new NodeTransformationProperty_default(value);
  72118. }
  72119. function createNodeTransformationPropertyBag(value) {
  72120. return new PropertyBag_default(value, createNodeTransformationProperty);
  72121. }
  72122. function createArticulationStagePropertyBag(value) {
  72123. return new PropertyBag_default(value);
  72124. }
  72125. function ModelGraphics(options) {
  72126. this._definitionChanged = new Event_default();
  72127. this._show = void 0;
  72128. this._showSubscription = void 0;
  72129. this._uri = void 0;
  72130. this._uriSubscription = void 0;
  72131. this._scale = void 0;
  72132. this._scaleSubscription = void 0;
  72133. this._minimumPixelSize = void 0;
  72134. this._minimumPixelSizeSubscription = void 0;
  72135. this._maximumScale = void 0;
  72136. this._maximumScaleSubscription = void 0;
  72137. this._incrementallyLoadTextures = void 0;
  72138. this._incrementallyLoadTexturesSubscription = void 0;
  72139. this._runAnimations = void 0;
  72140. this._runAnimationsSubscription = void 0;
  72141. this._clampAnimations = void 0;
  72142. this._clampAnimationsSubscription = void 0;
  72143. this._shadows = void 0;
  72144. this._shadowsSubscription = void 0;
  72145. this._heightReference = void 0;
  72146. this._heightReferenceSubscription = void 0;
  72147. this._silhouetteColor = void 0;
  72148. this._silhouetteColorSubscription = void 0;
  72149. this._silhouetteSize = void 0;
  72150. this._silhouetteSizeSubscription = void 0;
  72151. this._color = void 0;
  72152. this._colorSubscription = void 0;
  72153. this._colorBlendMode = void 0;
  72154. this._colorBlendModeSubscription = void 0;
  72155. this._colorBlendAmount = void 0;
  72156. this._colorBlendAmountSubscription = void 0;
  72157. this._imageBasedLightingFactor = void 0;
  72158. this._imageBasedLightingFactorSubscription = void 0;
  72159. this._lightColor = void 0;
  72160. this._lightColorSubscription = void 0;
  72161. this._distanceDisplayCondition = void 0;
  72162. this._distanceDisplayConditionSubscription = void 0;
  72163. this._nodeTransformations = void 0;
  72164. this._nodeTransformationsSubscription = void 0;
  72165. this._articulations = void 0;
  72166. this._articulationsSubscription = void 0;
  72167. this._clippingPlanes = void 0;
  72168. this._clippingPlanesSubscription = void 0;
  72169. this.merge(defaultValue_default(options, defaultValue_default.EMPTY_OBJECT));
  72170. }
  72171. Object.defineProperties(ModelGraphics.prototype, {
  72172. definitionChanged: {
  72173. get: function() {
  72174. return this._definitionChanged;
  72175. }
  72176. },
  72177. show: createPropertyDescriptor_default("show"),
  72178. uri: createPropertyDescriptor_default("uri"),
  72179. scale: createPropertyDescriptor_default("scale"),
  72180. minimumPixelSize: createPropertyDescriptor_default("minimumPixelSize"),
  72181. maximumScale: createPropertyDescriptor_default("maximumScale"),
  72182. incrementallyLoadTextures: createPropertyDescriptor_default(
  72183. "incrementallyLoadTextures"
  72184. ),
  72185. runAnimations: createPropertyDescriptor_default("runAnimations"),
  72186. clampAnimations: createPropertyDescriptor_default("clampAnimations"),
  72187. shadows: createPropertyDescriptor_default("shadows"),
  72188. heightReference: createPropertyDescriptor_default("heightReference"),
  72189. silhouetteColor: createPropertyDescriptor_default("silhouetteColor"),
  72190. silhouetteSize: createPropertyDescriptor_default("silhouetteSize"),
  72191. color: createPropertyDescriptor_default("color"),
  72192. colorBlendMode: createPropertyDescriptor_default("colorBlendMode"),
  72193. colorBlendAmount: createPropertyDescriptor_default("colorBlendAmount"),
  72194. imageBasedLightingFactor: createPropertyDescriptor_default(
  72195. "imageBasedLightingFactor"
  72196. ),
  72197. lightColor: createPropertyDescriptor_default("lightColor"),
  72198. distanceDisplayCondition: createPropertyDescriptor_default(
  72199. "distanceDisplayCondition"
  72200. ),
  72201. nodeTransformations: createPropertyDescriptor_default(
  72202. "nodeTransformations",
  72203. void 0,
  72204. createNodeTransformationPropertyBag
  72205. ),
  72206. articulations: createPropertyDescriptor_default(
  72207. "articulations",
  72208. void 0,
  72209. createArticulationStagePropertyBag
  72210. ),
  72211. clippingPlanes: createPropertyDescriptor_default("clippingPlanes")
  72212. });
  72213. ModelGraphics.prototype.clone = function(result) {
  72214. if (!defined_default(result)) {
  72215. return new ModelGraphics(this);
  72216. }
  72217. result.show = this.show;
  72218. result.uri = this.uri;
  72219. result.scale = this.scale;
  72220. result.minimumPixelSize = this.minimumPixelSize;
  72221. result.maximumScale = this.maximumScale;
  72222. result.incrementallyLoadTextures = this.incrementallyLoadTextures;
  72223. result.runAnimations = this.runAnimations;
  72224. result.clampAnimations = this.clampAnimations;
  72225. result.heightReference = this._heightReference;
  72226. result.silhouetteColor = this.silhouetteColor;
  72227. result.silhouetteSize = this.silhouetteSize;
  72228. result.color = this.color;
  72229. result.colorBlendMode = this.colorBlendMode;
  72230. result.colorBlendAmount = this.colorBlendAmount;
  72231. result.imageBasedLightingFactor = this.imageBasedLightingFactor;
  72232. result.lightColor = this.lightColor;
  72233. result.distanceDisplayCondition = this.distanceDisplayCondition;
  72234. result.nodeTransformations = this.nodeTransformations;
  72235. result.articulations = this.articulations;
  72236. result.clippingPlanes = this.clippingPlanes;
  72237. return result;
  72238. };
  72239. ModelGraphics.prototype.merge = function(source) {
  72240. if (!defined_default(source)) {
  72241. throw new DeveloperError_default("source is required.");
  72242. }
  72243. this.show = defaultValue_default(this.show, source.show);
  72244. this.uri = defaultValue_default(this.uri, source.uri);
  72245. this.scale = defaultValue_default(this.scale, source.scale);
  72246. this.minimumPixelSize = defaultValue_default(
  72247. this.minimumPixelSize,
  72248. source.minimumPixelSize
  72249. );
  72250. this.maximumScale = defaultValue_default(this.maximumScale, source.maximumScale);
  72251. this.incrementallyLoadTextures = defaultValue_default(
  72252. this.incrementallyLoadTextures,
  72253. source.incrementallyLoadTextures
  72254. );
  72255. this.runAnimations = defaultValue_default(this.runAnimations, source.runAnimations);
  72256. this.clampAnimations = defaultValue_default(
  72257. this.clampAnimations,
  72258. source.clampAnimations
  72259. );
  72260. this.shadows = defaultValue_default(this.shadows, source.shadows);
  72261. this.heightReference = defaultValue_default(
  72262. this.heightReference,
  72263. source.heightReference
  72264. );
  72265. this.silhouetteColor = defaultValue_default(
  72266. this.silhouetteColor,
  72267. source.silhouetteColor
  72268. );
  72269. this.silhouetteSize = defaultValue_default(
  72270. this.silhouetteSize,
  72271. source.silhouetteSize
  72272. );
  72273. this.color = defaultValue_default(this.color, source.color);
  72274. this.colorBlendMode = defaultValue_default(
  72275. this.colorBlendMode,
  72276. source.colorBlendMode
  72277. );
  72278. this.colorBlendAmount = defaultValue_default(
  72279. this.colorBlendAmount,
  72280. source.colorBlendAmount
  72281. );
  72282. this.imageBasedLightingFactor = defaultValue_default(
  72283. this.imageBasedLightingFactor,
  72284. source.imageBasedLightingFactor
  72285. );
  72286. this.lightColor = defaultValue_default(this.lightColor, source.lightColor);
  72287. this.distanceDisplayCondition = defaultValue_default(
  72288. this.distanceDisplayCondition,
  72289. source.distanceDisplayCondition
  72290. );
  72291. this.clippingPlanes = defaultValue_default(
  72292. this.clippingPlanes,
  72293. source.clippingPlanes
  72294. );
  72295. const sourceNodeTransformations = source.nodeTransformations;
  72296. if (defined_default(sourceNodeTransformations)) {
  72297. const targetNodeTransformations = this.nodeTransformations;
  72298. if (defined_default(targetNodeTransformations)) {
  72299. targetNodeTransformations.merge(sourceNodeTransformations);
  72300. } else {
  72301. this.nodeTransformations = new PropertyBag_default(
  72302. sourceNodeTransformations,
  72303. createNodeTransformationProperty
  72304. );
  72305. }
  72306. }
  72307. const sourceArticulations = source.articulations;
  72308. if (defined_default(sourceArticulations)) {
  72309. const targetArticulations = this.articulations;
  72310. if (defined_default(targetArticulations)) {
  72311. targetArticulations.merge(sourceArticulations);
  72312. } else {
  72313. this.articulations = new PropertyBag_default(sourceArticulations);
  72314. }
  72315. }
  72316. };
  72317. var ModelGraphics_default = ModelGraphics;
  72318. // node_modules/cesium/Source/DataSources/Cesium3DTilesetGraphics.js
  72319. function Cesium3DTilesetGraphics(options) {
  72320. this._definitionChanged = new Event_default();
  72321. this._show = void 0;
  72322. this._showSubscription = void 0;
  72323. this._uri = void 0;
  72324. this._uriSubscription = void 0;
  72325. this._maximumScreenSpaceError = void 0;
  72326. this._maximumScreenSpaceErrorSubscription = void 0;
  72327. this.merge(defaultValue_default(options, defaultValue_default.EMPTY_OBJECT));
  72328. }
  72329. Object.defineProperties(Cesium3DTilesetGraphics.prototype, {
  72330. definitionChanged: {
  72331. get: function() {
  72332. return this._definitionChanged;
  72333. }
  72334. },
  72335. show: createPropertyDescriptor_default("show"),
  72336. uri: createPropertyDescriptor_default("uri"),
  72337. maximumScreenSpaceError: createPropertyDescriptor_default("maximumScreenSpaceError")
  72338. });
  72339. Cesium3DTilesetGraphics.prototype.clone = function(result) {
  72340. if (!defined_default(result)) {
  72341. return new Cesium3DTilesetGraphics(this);
  72342. }
  72343. result.show = this.show;
  72344. result.uri = this.uri;
  72345. result.maximumScreenSpaceError = this.maximumScreenSpaceError;
  72346. return result;
  72347. };
  72348. Cesium3DTilesetGraphics.prototype.merge = function(source) {
  72349. if (!defined_default(source)) {
  72350. throw new DeveloperError_default("source is required.");
  72351. }
  72352. this.show = defaultValue_default(this.show, source.show);
  72353. this.uri = defaultValue_default(this.uri, source.uri);
  72354. this.maximumScreenSpaceError = defaultValue_default(
  72355. this.maximumScreenSpaceError,
  72356. source.maximumScreenSpaceError
  72357. );
  72358. };
  72359. var Cesium3DTilesetGraphics_default = Cesium3DTilesetGraphics;
  72360. // node_modules/cesium/Source/DataSources/PathGraphics.js
  72361. function PathGraphics(options) {
  72362. this._definitionChanged = new Event_default();
  72363. this._show = void 0;
  72364. this._showSubscription = void 0;
  72365. this._leadTime = void 0;
  72366. this._leadTimeSubscription = void 0;
  72367. this._trailTime = void 0;
  72368. this._trailTimeSubscription = void 0;
  72369. this._width = void 0;
  72370. this._widthSubscription = void 0;
  72371. this._resolution = void 0;
  72372. this._resolutionSubscription = void 0;
  72373. this._material = void 0;
  72374. this._materialSubscription = void 0;
  72375. this._distanceDisplayCondition = void 0;
  72376. this._distanceDisplayConditionSubscription = void 0;
  72377. this.merge(defaultValue_default(options, defaultValue_default.EMPTY_OBJECT));
  72378. }
  72379. Object.defineProperties(PathGraphics.prototype, {
  72380. definitionChanged: {
  72381. get: function() {
  72382. return this._definitionChanged;
  72383. }
  72384. },
  72385. show: createPropertyDescriptor_default("show"),
  72386. leadTime: createPropertyDescriptor_default("leadTime"),
  72387. trailTime: createPropertyDescriptor_default("trailTime"),
  72388. width: createPropertyDescriptor_default("width"),
  72389. resolution: createPropertyDescriptor_default("resolution"),
  72390. material: createMaterialPropertyDescriptor_default("material"),
  72391. distanceDisplayCondition: createPropertyDescriptor_default(
  72392. "distanceDisplayCondition"
  72393. )
  72394. });
  72395. PathGraphics.prototype.clone = function(result) {
  72396. if (!defined_default(result)) {
  72397. return new PathGraphics(this);
  72398. }
  72399. result.show = this.show;
  72400. result.leadTime = this.leadTime;
  72401. result.trailTime = this.trailTime;
  72402. result.width = this.width;
  72403. result.resolution = this.resolution;
  72404. result.material = this.material;
  72405. result.distanceDisplayCondition = this.distanceDisplayCondition;
  72406. return result;
  72407. };
  72408. PathGraphics.prototype.merge = function(source) {
  72409. if (!defined_default(source)) {
  72410. throw new DeveloperError_default("source is required.");
  72411. }
  72412. this.show = defaultValue_default(this.show, source.show);
  72413. this.leadTime = defaultValue_default(this.leadTime, source.leadTime);
  72414. this.trailTime = defaultValue_default(this.trailTime, source.trailTime);
  72415. this.width = defaultValue_default(this.width, source.width);
  72416. this.resolution = defaultValue_default(this.resolution, source.resolution);
  72417. this.material = defaultValue_default(this.material, source.material);
  72418. this.distanceDisplayCondition = defaultValue_default(
  72419. this.distanceDisplayCondition,
  72420. source.distanceDisplayCondition
  72421. );
  72422. };
  72423. var PathGraphics_default = PathGraphics;
  72424. // node_modules/cesium/Source/DataSources/PlaneGraphics.js
  72425. function PlaneGraphics(options) {
  72426. this._definitionChanged = new Event_default();
  72427. this._show = void 0;
  72428. this._showSubscription = void 0;
  72429. this._plane = void 0;
  72430. this._planeSubscription = void 0;
  72431. this._dimensions = void 0;
  72432. this._dimensionsSubscription = void 0;
  72433. this._fill = void 0;
  72434. this._fillSubscription = void 0;
  72435. this._material = void 0;
  72436. this._materialSubscription = void 0;
  72437. this._outline = void 0;
  72438. this._outlineSubscription = void 0;
  72439. this._outlineColor = void 0;
  72440. this._outlineColorSubscription = void 0;
  72441. this._outlineWidth = void 0;
  72442. this._outlineWidthSubscription = void 0;
  72443. this._shadows = void 0;
  72444. this._shadowsSubscription = void 0;
  72445. this._distanceDisplayCondition = void 0;
  72446. this._distanceDisplayConditionSubscription = void 0;
  72447. this.merge(defaultValue_default(options, defaultValue_default.EMPTY_OBJECT));
  72448. }
  72449. Object.defineProperties(PlaneGraphics.prototype, {
  72450. definitionChanged: {
  72451. get: function() {
  72452. return this._definitionChanged;
  72453. }
  72454. },
  72455. show: createPropertyDescriptor_default("show"),
  72456. plane: createPropertyDescriptor_default("plane"),
  72457. dimensions: createPropertyDescriptor_default("dimensions"),
  72458. fill: createPropertyDescriptor_default("fill"),
  72459. material: createMaterialPropertyDescriptor_default("material"),
  72460. outline: createPropertyDescriptor_default("outline"),
  72461. outlineColor: createPropertyDescriptor_default("outlineColor"),
  72462. outlineWidth: createPropertyDescriptor_default("outlineWidth"),
  72463. shadows: createPropertyDescriptor_default("shadows"),
  72464. distanceDisplayCondition: createPropertyDescriptor_default(
  72465. "distanceDisplayCondition"
  72466. )
  72467. });
  72468. PlaneGraphics.prototype.clone = function(result) {
  72469. if (!defined_default(result)) {
  72470. return new PlaneGraphics(this);
  72471. }
  72472. result.show = this.show;
  72473. result.plane = this.plane;
  72474. result.dimensions = this.dimensions;
  72475. result.fill = this.fill;
  72476. result.material = this.material;
  72477. result.outline = this.outline;
  72478. result.outlineColor = this.outlineColor;
  72479. result.outlineWidth = this.outlineWidth;
  72480. result.shadows = this.shadows;
  72481. result.distanceDisplayCondition = this.distanceDisplayCondition;
  72482. return result;
  72483. };
  72484. PlaneGraphics.prototype.merge = function(source) {
  72485. if (!defined_default(source)) {
  72486. throw new DeveloperError_default("source is required.");
  72487. }
  72488. this.show = defaultValue_default(this.show, source.show);
  72489. this.plane = defaultValue_default(this.plane, source.plane);
  72490. this.dimensions = defaultValue_default(this.dimensions, source.dimensions);
  72491. this.fill = defaultValue_default(this.fill, source.fill);
  72492. this.material = defaultValue_default(this.material, source.material);
  72493. this.outline = defaultValue_default(this.outline, source.outline);
  72494. this.outlineColor = defaultValue_default(this.outlineColor, source.outlineColor);
  72495. this.outlineWidth = defaultValue_default(this.outlineWidth, source.outlineWidth);
  72496. this.shadows = defaultValue_default(this.shadows, source.shadows);
  72497. this.distanceDisplayCondition = defaultValue_default(
  72498. this.distanceDisplayCondition,
  72499. source.distanceDisplayCondition
  72500. );
  72501. };
  72502. var PlaneGraphics_default = PlaneGraphics;
  72503. // node_modules/cesium/Source/DataSources/PointGraphics.js
  72504. function PointGraphics(options) {
  72505. this._definitionChanged = new Event_default();
  72506. this._show = void 0;
  72507. this._showSubscription = void 0;
  72508. this._pixelSize = void 0;
  72509. this._pixelSizeSubscription = void 0;
  72510. this._heightReference = void 0;
  72511. this._heightReferenceSubscription = void 0;
  72512. this._color = void 0;
  72513. this._colorSubscription = void 0;
  72514. this._outlineColor = void 0;
  72515. this._outlineColorSubscription = void 0;
  72516. this._outlineWidth = void 0;
  72517. this._outlineWidthSubscription = void 0;
  72518. this._scaleByDistance = void 0;
  72519. this._scaleByDistanceSubscription = void 0;
  72520. this._translucencyByDistance = void 0;
  72521. this._translucencyByDistanceSubscription = void 0;
  72522. this._distanceDisplayCondition = void 0;
  72523. this._distanceDisplayConditionSubscription = void 0;
  72524. this._disableDepthTestDistance = void 0;
  72525. this._disableDepthTestDistanceSubscription = void 0;
  72526. this.merge(defaultValue_default(options, defaultValue_default.EMPTY_OBJECT));
  72527. }
  72528. Object.defineProperties(PointGraphics.prototype, {
  72529. definitionChanged: {
  72530. get: function() {
  72531. return this._definitionChanged;
  72532. }
  72533. },
  72534. show: createPropertyDescriptor_default("show"),
  72535. pixelSize: createPropertyDescriptor_default("pixelSize"),
  72536. heightReference: createPropertyDescriptor_default("heightReference"),
  72537. color: createPropertyDescriptor_default("color"),
  72538. outlineColor: createPropertyDescriptor_default("outlineColor"),
  72539. outlineWidth: createPropertyDescriptor_default("outlineWidth"),
  72540. scaleByDistance: createPropertyDescriptor_default("scaleByDistance"),
  72541. translucencyByDistance: createPropertyDescriptor_default("translucencyByDistance"),
  72542. distanceDisplayCondition: createPropertyDescriptor_default(
  72543. "distanceDisplayCondition"
  72544. ),
  72545. disableDepthTestDistance: createPropertyDescriptor_default(
  72546. "disableDepthTestDistance"
  72547. )
  72548. });
  72549. PointGraphics.prototype.clone = function(result) {
  72550. if (!defined_default(result)) {
  72551. return new PointGraphics(this);
  72552. }
  72553. result.show = this.show;
  72554. result.pixelSize = this.pixelSize;
  72555. result.heightReference = this.heightReference;
  72556. result.color = this.color;
  72557. result.outlineColor = this.outlineColor;
  72558. result.outlineWidth = this.outlineWidth;
  72559. result.scaleByDistance = this.scaleByDistance;
  72560. result.translucencyByDistance = this._translucencyByDistance;
  72561. result.distanceDisplayCondition = this.distanceDisplayCondition;
  72562. result.disableDepthTestDistance = this.disableDepthTestDistance;
  72563. return result;
  72564. };
  72565. PointGraphics.prototype.merge = function(source) {
  72566. if (!defined_default(source)) {
  72567. throw new DeveloperError_default("source is required.");
  72568. }
  72569. this.show = defaultValue_default(this.show, source.show);
  72570. this.pixelSize = defaultValue_default(this.pixelSize, source.pixelSize);
  72571. this.heightReference = defaultValue_default(
  72572. this.heightReference,
  72573. source.heightReference
  72574. );
  72575. this.color = defaultValue_default(this.color, source.color);
  72576. this.outlineColor = defaultValue_default(this.outlineColor, source.outlineColor);
  72577. this.outlineWidth = defaultValue_default(this.outlineWidth, source.outlineWidth);
  72578. this.scaleByDistance = defaultValue_default(
  72579. this.scaleByDistance,
  72580. source.scaleByDistance
  72581. );
  72582. this.translucencyByDistance = defaultValue_default(
  72583. this._translucencyByDistance,
  72584. source.translucencyByDistance
  72585. );
  72586. this.distanceDisplayCondition = defaultValue_default(
  72587. this.distanceDisplayCondition,
  72588. source.distanceDisplayCondition
  72589. );
  72590. this.disableDepthTestDistance = defaultValue_default(
  72591. this.disableDepthTestDistance,
  72592. source.disableDepthTestDistance
  72593. );
  72594. };
  72595. var PointGraphics_default = PointGraphics;
  72596. // node_modules/cesium/Source/DataSources/PolygonGraphics.js
  72597. function createPolygonHierarchyProperty(value) {
  72598. if (Array.isArray(value)) {
  72599. value = new PolygonHierarchy_default(value);
  72600. }
  72601. return new ConstantProperty_default(value);
  72602. }
  72603. function PolygonGraphics(options) {
  72604. this._definitionChanged = new Event_default();
  72605. this._show = void 0;
  72606. this._showSubscription = void 0;
  72607. this._hierarchy = void 0;
  72608. this._hierarchySubscription = void 0;
  72609. this._height = void 0;
  72610. this._heightSubscription = void 0;
  72611. this._heightReference = void 0;
  72612. this._heightReferenceSubscription = void 0;
  72613. this._extrudedHeight = void 0;
  72614. this._extrudedHeightSubscription = void 0;
  72615. this._extrudedHeightReference = void 0;
  72616. this._extrudedHeightReferenceSubscription = void 0;
  72617. this._stRotation = void 0;
  72618. this._stRotationSubscription = void 0;
  72619. this._granularity = void 0;
  72620. this._granularitySubscription = void 0;
  72621. this._fill = void 0;
  72622. this._fillSubscription = void 0;
  72623. this._material = void 0;
  72624. this._materialSubscription = void 0;
  72625. this._outline = void 0;
  72626. this._outlineSubscription = void 0;
  72627. this._outlineColor = void 0;
  72628. this._outlineColorSubscription = void 0;
  72629. this._outlineWidth = void 0;
  72630. this._outlineWidthSubscription = void 0;
  72631. this._perPositionHeight = void 0;
  72632. this._perPositionHeightSubscription = void 0;
  72633. this._closeTop = void 0;
  72634. this._closeTopSubscription = void 0;
  72635. this._closeBottom = void 0;
  72636. this._closeBottomSubscription = void 0;
  72637. this._arcType = void 0;
  72638. this._arcTypeSubscription = void 0;
  72639. this._shadows = void 0;
  72640. this._shadowsSubscription = void 0;
  72641. this._distanceDisplayCondition = void 0;
  72642. this._distanceDisplayConditionSubscription = void 0;
  72643. this._classificationType = void 0;
  72644. this._classificationTypeSubscription = void 0;
  72645. this._zIndex = void 0;
  72646. this._zIndexSubscription = void 0;
  72647. this.merge(defaultValue_default(options, defaultValue_default.EMPTY_OBJECT));
  72648. }
  72649. Object.defineProperties(PolygonGraphics.prototype, {
  72650. definitionChanged: {
  72651. get: function() {
  72652. return this._definitionChanged;
  72653. }
  72654. },
  72655. show: createPropertyDescriptor_default("show"),
  72656. hierarchy: createPropertyDescriptor_default(
  72657. "hierarchy",
  72658. void 0,
  72659. createPolygonHierarchyProperty
  72660. ),
  72661. height: createPropertyDescriptor_default("height"),
  72662. heightReference: createPropertyDescriptor_default("heightReference"),
  72663. extrudedHeight: createPropertyDescriptor_default("extrudedHeight"),
  72664. extrudedHeightReference: createPropertyDescriptor_default("extrudedHeightReference"),
  72665. stRotation: createPropertyDescriptor_default("stRotation"),
  72666. granularity: createPropertyDescriptor_default("granularity"),
  72667. fill: createPropertyDescriptor_default("fill"),
  72668. material: createMaterialPropertyDescriptor_default("material"),
  72669. outline: createPropertyDescriptor_default("outline"),
  72670. outlineColor: createPropertyDescriptor_default("outlineColor"),
  72671. outlineWidth: createPropertyDescriptor_default("outlineWidth"),
  72672. perPositionHeight: createPropertyDescriptor_default("perPositionHeight"),
  72673. closeTop: createPropertyDescriptor_default("closeTop"),
  72674. closeBottom: createPropertyDescriptor_default("closeBottom"),
  72675. arcType: createPropertyDescriptor_default("arcType"),
  72676. shadows: createPropertyDescriptor_default("shadows"),
  72677. distanceDisplayCondition: createPropertyDescriptor_default(
  72678. "distanceDisplayCondition"
  72679. ),
  72680. classificationType: createPropertyDescriptor_default("classificationType"),
  72681. zIndex: createPropertyDescriptor_default("zIndex")
  72682. });
  72683. PolygonGraphics.prototype.clone = function(result) {
  72684. if (!defined_default(result)) {
  72685. return new PolygonGraphics(this);
  72686. }
  72687. result.show = this.show;
  72688. result.hierarchy = this.hierarchy;
  72689. result.height = this.height;
  72690. result.heightReference = this.heightReference;
  72691. result.extrudedHeight = this.extrudedHeight;
  72692. result.extrudedHeightReference = this.extrudedHeightReference;
  72693. result.stRotation = this.stRotation;
  72694. result.granularity = this.granularity;
  72695. result.fill = this.fill;
  72696. result.material = this.material;
  72697. result.outline = this.outline;
  72698. result.outlineColor = this.outlineColor;
  72699. result.outlineWidth = this.outlineWidth;
  72700. result.perPositionHeight = this.perPositionHeight;
  72701. result.closeTop = this.closeTop;
  72702. result.closeBottom = this.closeBottom;
  72703. result.arcType = this.arcType;
  72704. result.shadows = this.shadows;
  72705. result.distanceDisplayCondition = this.distanceDisplayCondition;
  72706. result.classificationType = this.classificationType;
  72707. result.zIndex = this.zIndex;
  72708. return result;
  72709. };
  72710. PolygonGraphics.prototype.merge = function(source) {
  72711. if (!defined_default(source)) {
  72712. throw new DeveloperError_default("source is required.");
  72713. }
  72714. this.show = defaultValue_default(this.show, source.show);
  72715. this.hierarchy = defaultValue_default(this.hierarchy, source.hierarchy);
  72716. this.height = defaultValue_default(this.height, source.height);
  72717. this.heightReference = defaultValue_default(
  72718. this.heightReference,
  72719. source.heightReference
  72720. );
  72721. this.extrudedHeight = defaultValue_default(
  72722. this.extrudedHeight,
  72723. source.extrudedHeight
  72724. );
  72725. this.extrudedHeightReference = defaultValue_default(
  72726. this.extrudedHeightReference,
  72727. source.extrudedHeightReference
  72728. );
  72729. this.stRotation = defaultValue_default(this.stRotation, source.stRotation);
  72730. this.granularity = defaultValue_default(this.granularity, source.granularity);
  72731. this.fill = defaultValue_default(this.fill, source.fill);
  72732. this.material = defaultValue_default(this.material, source.material);
  72733. this.outline = defaultValue_default(this.outline, source.outline);
  72734. this.outlineColor = defaultValue_default(this.outlineColor, source.outlineColor);
  72735. this.outlineWidth = defaultValue_default(this.outlineWidth, source.outlineWidth);
  72736. this.perPositionHeight = defaultValue_default(
  72737. this.perPositionHeight,
  72738. source.perPositionHeight
  72739. );
  72740. this.closeTop = defaultValue_default(this.closeTop, source.closeTop);
  72741. this.closeBottom = defaultValue_default(this.closeBottom, source.closeBottom);
  72742. this.arcType = defaultValue_default(this.arcType, source.arcType);
  72743. this.shadows = defaultValue_default(this.shadows, source.shadows);
  72744. this.distanceDisplayCondition = defaultValue_default(
  72745. this.distanceDisplayCondition,
  72746. source.distanceDisplayCondition
  72747. );
  72748. this.classificationType = defaultValue_default(
  72749. this.classificationType,
  72750. source.classificationType
  72751. );
  72752. this.zIndex = defaultValue_default(this.zIndex, source.zIndex);
  72753. };
  72754. var PolygonGraphics_default = PolygonGraphics;
  72755. // node_modules/cesium/Source/DataSources/PolylineGraphics.js
  72756. function PolylineGraphics(options) {
  72757. this._definitionChanged = new Event_default();
  72758. this._show = void 0;
  72759. this._showSubscription = void 0;
  72760. this._positions = void 0;
  72761. this._positionsSubscription = void 0;
  72762. this._width = void 0;
  72763. this._widthSubscription = void 0;
  72764. this._granularity = void 0;
  72765. this._granularitySubscription = void 0;
  72766. this._material = void 0;
  72767. this._materialSubscription = void 0;
  72768. this._depthFailMaterial = void 0;
  72769. this._depthFailMaterialSubscription = void 0;
  72770. this._arcType = void 0;
  72771. this._arcTypeSubscription = void 0;
  72772. this._clampToGround = void 0;
  72773. this._clampToGroundSubscription = void 0;
  72774. this._shadows = void 0;
  72775. this._shadowsSubscription = void 0;
  72776. this._distanceDisplayCondition = void 0;
  72777. this._distanceDisplayConditionSubscription = void 0;
  72778. this._classificationType = void 0;
  72779. this._classificationTypeSubscription = void 0;
  72780. this._zIndex = void 0;
  72781. this._zIndexSubscription = void 0;
  72782. this.merge(defaultValue_default(options, defaultValue_default.EMPTY_OBJECT));
  72783. }
  72784. Object.defineProperties(PolylineGraphics.prototype, {
  72785. definitionChanged: {
  72786. get: function() {
  72787. return this._definitionChanged;
  72788. }
  72789. },
  72790. show: createPropertyDescriptor_default("show"),
  72791. positions: createPropertyDescriptor_default("positions"),
  72792. width: createPropertyDescriptor_default("width"),
  72793. granularity: createPropertyDescriptor_default("granularity"),
  72794. material: createMaterialPropertyDescriptor_default("material"),
  72795. depthFailMaterial: createMaterialPropertyDescriptor_default("depthFailMaterial"),
  72796. arcType: createPropertyDescriptor_default("arcType"),
  72797. clampToGround: createPropertyDescriptor_default("clampToGround"),
  72798. shadows: createPropertyDescriptor_default("shadows"),
  72799. distanceDisplayCondition: createPropertyDescriptor_default(
  72800. "distanceDisplayCondition"
  72801. ),
  72802. classificationType: createPropertyDescriptor_default("classificationType"),
  72803. zIndex: createPropertyDescriptor_default("zIndex")
  72804. });
  72805. PolylineGraphics.prototype.clone = function(result) {
  72806. if (!defined_default(result)) {
  72807. return new PolylineGraphics(this);
  72808. }
  72809. result.show = this.show;
  72810. result.positions = this.positions;
  72811. result.width = this.width;
  72812. result.granularity = this.granularity;
  72813. result.material = this.material;
  72814. result.depthFailMaterial = this.depthFailMaterial;
  72815. result.arcType = this.arcType;
  72816. result.clampToGround = this.clampToGround;
  72817. result.shadows = this.shadows;
  72818. result.distanceDisplayCondition = this.distanceDisplayCondition;
  72819. result.classificationType = this.classificationType;
  72820. result.zIndex = this.zIndex;
  72821. return result;
  72822. };
  72823. PolylineGraphics.prototype.merge = function(source) {
  72824. if (!defined_default(source)) {
  72825. throw new DeveloperError_default("source is required.");
  72826. }
  72827. this.show = defaultValue_default(this.show, source.show);
  72828. this.positions = defaultValue_default(this.positions, source.positions);
  72829. this.width = defaultValue_default(this.width, source.width);
  72830. this.granularity = defaultValue_default(this.granularity, source.granularity);
  72831. this.material = defaultValue_default(this.material, source.material);
  72832. this.depthFailMaterial = defaultValue_default(
  72833. this.depthFailMaterial,
  72834. source.depthFailMaterial
  72835. );
  72836. this.arcType = defaultValue_default(this.arcType, source.arcType);
  72837. this.clampToGround = defaultValue_default(this.clampToGround, source.clampToGround);
  72838. this.shadows = defaultValue_default(this.shadows, source.shadows);
  72839. this.distanceDisplayCondition = defaultValue_default(
  72840. this.distanceDisplayCondition,
  72841. source.distanceDisplayCondition
  72842. );
  72843. this.classificationType = defaultValue_default(
  72844. this.classificationType,
  72845. source.classificationType
  72846. );
  72847. this.zIndex = defaultValue_default(this.zIndex, source.zIndex);
  72848. };
  72849. var PolylineGraphics_default = PolylineGraphics;
  72850. // node_modules/cesium/Source/DataSources/PolylineVolumeGraphics.js
  72851. function PolylineVolumeGraphics(options) {
  72852. this._definitionChanged = new Event_default();
  72853. this._show = void 0;
  72854. this._showSubscription = void 0;
  72855. this._positions = void 0;
  72856. this._positionsSubscription = void 0;
  72857. this._shape = void 0;
  72858. this._shapeSubscription = void 0;
  72859. this._cornerType = void 0;
  72860. this._cornerTypeSubscription = void 0;
  72861. this._granularity = void 0;
  72862. this._granularitySubscription = void 0;
  72863. this._fill = void 0;
  72864. this._fillSubscription = void 0;
  72865. this._material = void 0;
  72866. this._materialSubscription = void 0;
  72867. this._outline = void 0;
  72868. this._outlineSubscription = void 0;
  72869. this._outlineColor = void 0;
  72870. this._outlineColorSubscription = void 0;
  72871. this._outlineWidth = void 0;
  72872. this._outlineWidthSubscription = void 0;
  72873. this._shadows = void 0;
  72874. this._shadowsSubscription = void 0;
  72875. this._distanceDisplayCondition = void 0;
  72876. this._distanceDisplayConditionSubsription = void 0;
  72877. this.merge(defaultValue_default(options, defaultValue_default.EMPTY_OBJECT));
  72878. }
  72879. Object.defineProperties(PolylineVolumeGraphics.prototype, {
  72880. definitionChanged: {
  72881. get: function() {
  72882. return this._definitionChanged;
  72883. }
  72884. },
  72885. show: createPropertyDescriptor_default("show"),
  72886. positions: createPropertyDescriptor_default("positions"),
  72887. shape: createPropertyDescriptor_default("shape"),
  72888. cornerType: createPropertyDescriptor_default("cornerType"),
  72889. granularity: createPropertyDescriptor_default("granularity"),
  72890. fill: createPropertyDescriptor_default("fill"),
  72891. material: createMaterialPropertyDescriptor_default("material"),
  72892. outline: createPropertyDescriptor_default("outline"),
  72893. outlineColor: createPropertyDescriptor_default("outlineColor"),
  72894. outlineWidth: createPropertyDescriptor_default("outlineWidth"),
  72895. shadows: createPropertyDescriptor_default("shadows"),
  72896. distanceDisplayCondition: createPropertyDescriptor_default(
  72897. "distanceDisplayCondition"
  72898. )
  72899. });
  72900. PolylineVolumeGraphics.prototype.clone = function(result) {
  72901. if (!defined_default(result)) {
  72902. return new PolylineVolumeGraphics(this);
  72903. }
  72904. result.show = this.show;
  72905. result.positions = this.positions;
  72906. result.shape = this.shape;
  72907. result.cornerType = this.cornerType;
  72908. result.granularity = this.granularity;
  72909. result.fill = this.fill;
  72910. result.material = this.material;
  72911. result.outline = this.outline;
  72912. result.outlineColor = this.outlineColor;
  72913. result.outlineWidth = this.outlineWidth;
  72914. result.shadows = this.shadows;
  72915. result.distanceDisplayCondition = this.distanceDisplayCondition;
  72916. return result;
  72917. };
  72918. PolylineVolumeGraphics.prototype.merge = function(source) {
  72919. if (!defined_default(source)) {
  72920. throw new DeveloperError_default("source is required.");
  72921. }
  72922. this.show = defaultValue_default(this.show, source.show);
  72923. this.positions = defaultValue_default(this.positions, source.positions);
  72924. this.shape = defaultValue_default(this.shape, source.shape);
  72925. this.cornerType = defaultValue_default(this.cornerType, source.cornerType);
  72926. this.granularity = defaultValue_default(this.granularity, source.granularity);
  72927. this.fill = defaultValue_default(this.fill, source.fill);
  72928. this.material = defaultValue_default(this.material, source.material);
  72929. this.outline = defaultValue_default(this.outline, source.outline);
  72930. this.outlineColor = defaultValue_default(this.outlineColor, source.outlineColor);
  72931. this.outlineWidth = defaultValue_default(this.outlineWidth, source.outlineWidth);
  72932. this.shadows = defaultValue_default(this.shadows, source.shadows);
  72933. this.distanceDisplayCondition = defaultValue_default(
  72934. this.distanceDisplayCondition,
  72935. source.distanceDisplayCondition
  72936. );
  72937. };
  72938. var PolylineVolumeGraphics_default = PolylineVolumeGraphics;
  72939. // node_modules/cesium/Source/DataSources/RectangleGraphics.js
  72940. function RectangleGraphics(options) {
  72941. this._definitionChanged = new Event_default();
  72942. this._show = void 0;
  72943. this._showSubscription = void 0;
  72944. this._coordinates = void 0;
  72945. this._coordinatesSubscription = void 0;
  72946. this._height = void 0;
  72947. this._heightSubscription = void 0;
  72948. this._heightReference = void 0;
  72949. this._heightReferenceSubscription = void 0;
  72950. this._extrudedHeight = void 0;
  72951. this._extrudedHeightSubscription = void 0;
  72952. this._extrudedHeightReference = void 0;
  72953. this._extrudedHeightReferenceSubscription = void 0;
  72954. this._rotation = void 0;
  72955. this._rotationSubscription = void 0;
  72956. this._stRotation = void 0;
  72957. this._stRotationSubscription = void 0;
  72958. this._granularity = void 0;
  72959. this._granularitySubscription = void 0;
  72960. this._fill = void 0;
  72961. this._fillSubscription = void 0;
  72962. this._material = void 0;
  72963. this._materialSubscription = void 0;
  72964. this._outline = void 0;
  72965. this._outlineSubscription = void 0;
  72966. this._outlineColor = void 0;
  72967. this._outlineColorSubscription = void 0;
  72968. this._outlineWidth = void 0;
  72969. this._outlineWidthSubscription = void 0;
  72970. this._shadows = void 0;
  72971. this._shadowsSubscription = void 0;
  72972. this._distanceDisplayCondition = void 0;
  72973. this._distancedisplayConditionSubscription = void 0;
  72974. this._classificationType = void 0;
  72975. this._classificationTypeSubscription = void 0;
  72976. this._zIndex = void 0;
  72977. this._zIndexSubscription = void 0;
  72978. this.merge(defaultValue_default(options, defaultValue_default.EMPTY_OBJECT));
  72979. }
  72980. Object.defineProperties(RectangleGraphics.prototype, {
  72981. definitionChanged: {
  72982. get: function() {
  72983. return this._definitionChanged;
  72984. }
  72985. },
  72986. show: createPropertyDescriptor_default("show"),
  72987. coordinates: createPropertyDescriptor_default("coordinates"),
  72988. height: createPropertyDescriptor_default("height"),
  72989. heightReference: createPropertyDescriptor_default("heightReference"),
  72990. extrudedHeight: createPropertyDescriptor_default("extrudedHeight"),
  72991. extrudedHeightReference: createPropertyDescriptor_default("extrudedHeightReference"),
  72992. rotation: createPropertyDescriptor_default("rotation"),
  72993. stRotation: createPropertyDescriptor_default("stRotation"),
  72994. granularity: createPropertyDescriptor_default("granularity"),
  72995. fill: createPropertyDescriptor_default("fill"),
  72996. material: createMaterialPropertyDescriptor_default("material"),
  72997. outline: createPropertyDescriptor_default("outline"),
  72998. outlineColor: createPropertyDescriptor_default("outlineColor"),
  72999. outlineWidth: createPropertyDescriptor_default("outlineWidth"),
  73000. shadows: createPropertyDescriptor_default("shadows"),
  73001. distanceDisplayCondition: createPropertyDescriptor_default(
  73002. "distanceDisplayCondition"
  73003. ),
  73004. classificationType: createPropertyDescriptor_default("classificationType"),
  73005. zIndex: createPropertyDescriptor_default("zIndex")
  73006. });
  73007. RectangleGraphics.prototype.clone = function(result) {
  73008. if (!defined_default(result)) {
  73009. return new RectangleGraphics(this);
  73010. }
  73011. result.show = this.show;
  73012. result.coordinates = this.coordinates;
  73013. result.height = this.height;
  73014. result.heightReference = this.heightReference;
  73015. result.extrudedHeight = this.extrudedHeight;
  73016. result.extrudedHeightReference = this.extrudedHeightReference;
  73017. result.rotation = this.rotation;
  73018. result.stRotation = this.stRotation;
  73019. result.granularity = this.granularity;
  73020. result.fill = this.fill;
  73021. result.material = this.material;
  73022. result.outline = this.outline;
  73023. result.outlineColor = this.outlineColor;
  73024. result.outlineWidth = this.outlineWidth;
  73025. result.shadows = this.shadows;
  73026. result.distanceDisplayCondition = this.distanceDisplayCondition;
  73027. result.classificationType = this.classificationType;
  73028. result.zIndex = this.zIndex;
  73029. return result;
  73030. };
  73031. RectangleGraphics.prototype.merge = function(source) {
  73032. if (!defined_default(source)) {
  73033. throw new DeveloperError_default("source is required.");
  73034. }
  73035. this.show = defaultValue_default(this.show, source.show);
  73036. this.coordinates = defaultValue_default(this.coordinates, source.coordinates);
  73037. this.height = defaultValue_default(this.height, source.height);
  73038. this.heightReference = defaultValue_default(
  73039. this.heightReference,
  73040. source.heightReference
  73041. );
  73042. this.extrudedHeight = defaultValue_default(
  73043. this.extrudedHeight,
  73044. source.extrudedHeight
  73045. );
  73046. this.extrudedHeightReference = defaultValue_default(
  73047. this.extrudedHeightReference,
  73048. source.extrudedHeightReference
  73049. );
  73050. this.rotation = defaultValue_default(this.rotation, source.rotation);
  73051. this.stRotation = defaultValue_default(this.stRotation, source.stRotation);
  73052. this.granularity = defaultValue_default(this.granularity, source.granularity);
  73053. this.fill = defaultValue_default(this.fill, source.fill);
  73054. this.material = defaultValue_default(this.material, source.material);
  73055. this.outline = defaultValue_default(this.outline, source.outline);
  73056. this.outlineColor = defaultValue_default(this.outlineColor, source.outlineColor);
  73057. this.outlineWidth = defaultValue_default(this.outlineWidth, source.outlineWidth);
  73058. this.shadows = defaultValue_default(this.shadows, source.shadows);
  73059. this.distanceDisplayCondition = defaultValue_default(
  73060. this.distanceDisplayCondition,
  73061. source.distanceDisplayCondition
  73062. );
  73063. this.classificationType = defaultValue_default(
  73064. this.classificationType,
  73065. source.classificationType
  73066. );
  73067. this.zIndex = defaultValue_default(this.zIndex, source.zIndex);
  73068. };
  73069. var RectangleGraphics_default = RectangleGraphics;
  73070. // node_modules/cesium/Source/DataSources/WallGraphics.js
  73071. function WallGraphics(options) {
  73072. this._definitionChanged = new Event_default();
  73073. this._show = void 0;
  73074. this._showSubscription = void 0;
  73075. this._positions = void 0;
  73076. this._positionsSubscription = void 0;
  73077. this._minimumHeights = void 0;
  73078. this._minimumHeightsSubscription = void 0;
  73079. this._maximumHeights = void 0;
  73080. this._maximumHeightsSubscription = void 0;
  73081. this._granularity = void 0;
  73082. this._granularitySubscription = void 0;
  73083. this._fill = void 0;
  73084. this._fillSubscription = void 0;
  73085. this._material = void 0;
  73086. this._materialSubscription = void 0;
  73087. this._outline = void 0;
  73088. this._outlineSubscription = void 0;
  73089. this._outlineColor = void 0;
  73090. this._outlineColorSubscription = void 0;
  73091. this._outlineWidth = void 0;
  73092. this._outlineWidthSubscription = void 0;
  73093. this._shadows = void 0;
  73094. this._shadowsSubscription = void 0;
  73095. this._distanceDisplayCondition = void 0;
  73096. this._distanceDisplayConditionSubscription = void 0;
  73097. this.merge(defaultValue_default(options, defaultValue_default.EMPTY_OBJECT));
  73098. }
  73099. Object.defineProperties(WallGraphics.prototype, {
  73100. definitionChanged: {
  73101. get: function() {
  73102. return this._definitionChanged;
  73103. }
  73104. },
  73105. show: createPropertyDescriptor_default("show"),
  73106. positions: createPropertyDescriptor_default("positions"),
  73107. minimumHeights: createPropertyDescriptor_default("minimumHeights"),
  73108. maximumHeights: createPropertyDescriptor_default("maximumHeights"),
  73109. granularity: createPropertyDescriptor_default("granularity"),
  73110. fill: createPropertyDescriptor_default("fill"),
  73111. material: createMaterialPropertyDescriptor_default("material"),
  73112. outline: createPropertyDescriptor_default("outline"),
  73113. outlineColor: createPropertyDescriptor_default("outlineColor"),
  73114. outlineWidth: createPropertyDescriptor_default("outlineWidth"),
  73115. shadows: createPropertyDescriptor_default("shadows"),
  73116. distanceDisplayCondition: createPropertyDescriptor_default(
  73117. "distanceDisplayCondition"
  73118. )
  73119. });
  73120. WallGraphics.prototype.clone = function(result) {
  73121. if (!defined_default(result)) {
  73122. return new WallGraphics(this);
  73123. }
  73124. result.show = this.show;
  73125. result.positions = this.positions;
  73126. result.minimumHeights = this.minimumHeights;
  73127. result.maximumHeights = this.maximumHeights;
  73128. result.granularity = this.granularity;
  73129. result.fill = this.fill;
  73130. result.material = this.material;
  73131. result.outline = this.outline;
  73132. result.outlineColor = this.outlineColor;
  73133. result.outlineWidth = this.outlineWidth;
  73134. result.shadows = this.shadows;
  73135. result.distanceDisplayCondition = this.distanceDisplayCondition;
  73136. return result;
  73137. };
  73138. WallGraphics.prototype.merge = function(source) {
  73139. if (!defined_default(source)) {
  73140. throw new DeveloperError_default("source is required.");
  73141. }
  73142. this.show = defaultValue_default(this.show, source.show);
  73143. this.positions = defaultValue_default(this.positions, source.positions);
  73144. this.minimumHeights = defaultValue_default(
  73145. this.minimumHeights,
  73146. source.minimumHeights
  73147. );
  73148. this.maximumHeights = defaultValue_default(
  73149. this.maximumHeights,
  73150. source.maximumHeights
  73151. );
  73152. this.granularity = defaultValue_default(this.granularity, source.granularity);
  73153. this.fill = defaultValue_default(this.fill, source.fill);
  73154. this.material = defaultValue_default(this.material, source.material);
  73155. this.outline = defaultValue_default(this.outline, source.outline);
  73156. this.outlineColor = defaultValue_default(this.outlineColor, source.outlineColor);
  73157. this.outlineWidth = defaultValue_default(this.outlineWidth, source.outlineWidth);
  73158. this.shadows = defaultValue_default(this.shadows, source.shadows);
  73159. this.distanceDisplayCondition = defaultValue_default(
  73160. this.distanceDisplayCondition,
  73161. source.distanceDisplayCondition
  73162. );
  73163. };
  73164. var WallGraphics_default = WallGraphics;
  73165. // node_modules/cesium/Source/DataSources/Entity.js
  73166. var cartoScratch2 = new Cartographic_default();
  73167. function createConstantPositionProperty(value) {
  73168. return new ConstantPositionProperty_default(value);
  73169. }
  73170. function createPositionPropertyDescriptor(name) {
  73171. return createPropertyDescriptor_default(
  73172. name,
  73173. void 0,
  73174. createConstantPositionProperty
  73175. );
  73176. }
  73177. function createPropertyTypeDescriptor(name, Type) {
  73178. return createPropertyDescriptor_default(name, void 0, function(value) {
  73179. if (value instanceof Type) {
  73180. return value;
  73181. }
  73182. return new Type(value);
  73183. });
  73184. }
  73185. function Entity(options) {
  73186. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  73187. let id = options.id;
  73188. if (!defined_default(id)) {
  73189. id = createGuid_default();
  73190. }
  73191. this._availability = void 0;
  73192. this._id = id;
  73193. this._definitionChanged = new Event_default();
  73194. this._name = options.name;
  73195. this._show = defaultValue_default(options.show, true);
  73196. this._parent = void 0;
  73197. this._propertyNames = [
  73198. "billboard",
  73199. "box",
  73200. "corridor",
  73201. "cylinder",
  73202. "description",
  73203. "ellipse",
  73204. "ellipsoid",
  73205. "label",
  73206. "model",
  73207. "tileset",
  73208. "orientation",
  73209. "path",
  73210. "plane",
  73211. "point",
  73212. "polygon",
  73213. "polyline",
  73214. "polylineVolume",
  73215. "position",
  73216. "properties",
  73217. "rectangle",
  73218. "viewFrom",
  73219. "wall"
  73220. ];
  73221. this._billboard = void 0;
  73222. this._billboardSubscription = void 0;
  73223. this._box = void 0;
  73224. this._boxSubscription = void 0;
  73225. this._corridor = void 0;
  73226. this._corridorSubscription = void 0;
  73227. this._cylinder = void 0;
  73228. this._cylinderSubscription = void 0;
  73229. this._description = void 0;
  73230. this._descriptionSubscription = void 0;
  73231. this._ellipse = void 0;
  73232. this._ellipseSubscription = void 0;
  73233. this._ellipsoid = void 0;
  73234. this._ellipsoidSubscription = void 0;
  73235. this._label = void 0;
  73236. this._labelSubscription = void 0;
  73237. this._model = void 0;
  73238. this._modelSubscription = void 0;
  73239. this._tileset = void 0;
  73240. this._tilesetSubscription = void 0;
  73241. this._orientation = void 0;
  73242. this._orientationSubscription = void 0;
  73243. this._path = void 0;
  73244. this._pathSubscription = void 0;
  73245. this._plane = void 0;
  73246. this._planeSubscription = void 0;
  73247. this._point = void 0;
  73248. this._pointSubscription = void 0;
  73249. this._polygon = void 0;
  73250. this._polygonSubscription = void 0;
  73251. this._polyline = void 0;
  73252. this._polylineSubscription = void 0;
  73253. this._polylineVolume = void 0;
  73254. this._polylineVolumeSubscription = void 0;
  73255. this._position = void 0;
  73256. this._positionSubscription = void 0;
  73257. this._properties = void 0;
  73258. this._propertiesSubscription = void 0;
  73259. this._rectangle = void 0;
  73260. this._rectangleSubscription = void 0;
  73261. this._viewFrom = void 0;
  73262. this._viewFromSubscription = void 0;
  73263. this._wall = void 0;
  73264. this._wallSubscription = void 0;
  73265. this._children = [];
  73266. this.entityCollection = void 0;
  73267. this.parent = options.parent;
  73268. this.merge(options);
  73269. }
  73270. function updateShow(entity, children, isShowing) {
  73271. const length3 = children.length;
  73272. for (let i2 = 0; i2 < length3; i2++) {
  73273. const child = children[i2];
  73274. const childShow = child._show;
  73275. const oldValue2 = !isShowing && childShow;
  73276. const newValue = isShowing && childShow;
  73277. if (oldValue2 !== newValue) {
  73278. updateShow(child, child._children, isShowing);
  73279. }
  73280. }
  73281. entity._definitionChanged.raiseEvent(
  73282. entity,
  73283. "isShowing",
  73284. isShowing,
  73285. !isShowing
  73286. );
  73287. }
  73288. Object.defineProperties(Entity.prototype, {
  73289. availability: createRawPropertyDescriptor_default("availability"),
  73290. id: {
  73291. get: function() {
  73292. return this._id;
  73293. }
  73294. },
  73295. definitionChanged: {
  73296. get: function() {
  73297. return this._definitionChanged;
  73298. }
  73299. },
  73300. name: createRawPropertyDescriptor_default("name"),
  73301. show: {
  73302. get: function() {
  73303. return this._show;
  73304. },
  73305. set: function(value) {
  73306. if (!defined_default(value)) {
  73307. throw new DeveloperError_default("value is required.");
  73308. }
  73309. if (value === this._show) {
  73310. return;
  73311. }
  73312. const wasShowing = this.isShowing;
  73313. this._show = value;
  73314. const isShowing = this.isShowing;
  73315. if (wasShowing !== isShowing) {
  73316. updateShow(this, this._children, isShowing);
  73317. }
  73318. this._definitionChanged.raiseEvent(this, "show", value, !value);
  73319. }
  73320. },
  73321. isShowing: {
  73322. get: function() {
  73323. return this._show && (!defined_default(this.entityCollection) || this.entityCollection.show) && (!defined_default(this._parent) || this._parent.isShowing);
  73324. }
  73325. },
  73326. parent: {
  73327. get: function() {
  73328. return this._parent;
  73329. },
  73330. set: function(value) {
  73331. const oldValue2 = this._parent;
  73332. if (oldValue2 === value) {
  73333. return;
  73334. }
  73335. const wasShowing = this.isShowing;
  73336. if (defined_default(oldValue2)) {
  73337. const index2 = oldValue2._children.indexOf(this);
  73338. oldValue2._children.splice(index2, 1);
  73339. }
  73340. this._parent = value;
  73341. if (defined_default(value)) {
  73342. value._children.push(this);
  73343. }
  73344. const isShowing = this.isShowing;
  73345. if (wasShowing !== isShowing) {
  73346. updateShow(this, this._children, isShowing);
  73347. }
  73348. this._definitionChanged.raiseEvent(this, "parent", value, oldValue2);
  73349. }
  73350. },
  73351. propertyNames: {
  73352. get: function() {
  73353. return this._propertyNames;
  73354. }
  73355. },
  73356. billboard: createPropertyTypeDescriptor("billboard", BillboardGraphics_default),
  73357. box: createPropertyTypeDescriptor("box", BoxGraphics_default),
  73358. corridor: createPropertyTypeDescriptor("corridor", CorridorGraphics_default),
  73359. cylinder: createPropertyTypeDescriptor("cylinder", CylinderGraphics_default),
  73360. description: createPropertyDescriptor_default("description"),
  73361. ellipse: createPropertyTypeDescriptor("ellipse", EllipseGraphics_default),
  73362. ellipsoid: createPropertyTypeDescriptor("ellipsoid", EllipsoidGraphics_default),
  73363. label: createPropertyTypeDescriptor("label", LabelGraphics_default),
  73364. model: createPropertyTypeDescriptor("model", ModelGraphics_default),
  73365. tileset: createPropertyTypeDescriptor("tileset", Cesium3DTilesetGraphics_default),
  73366. orientation: createPropertyDescriptor_default("orientation"),
  73367. path: createPropertyTypeDescriptor("path", PathGraphics_default),
  73368. plane: createPropertyTypeDescriptor("plane", PlaneGraphics_default),
  73369. point: createPropertyTypeDescriptor("point", PointGraphics_default),
  73370. polygon: createPropertyTypeDescriptor("polygon", PolygonGraphics_default),
  73371. polyline: createPropertyTypeDescriptor("polyline", PolylineGraphics_default),
  73372. polylineVolume: createPropertyTypeDescriptor(
  73373. "polylineVolume",
  73374. PolylineVolumeGraphics_default
  73375. ),
  73376. properties: createPropertyTypeDescriptor("properties", PropertyBag_default),
  73377. position: createPositionPropertyDescriptor("position"),
  73378. rectangle: createPropertyTypeDescriptor("rectangle", RectangleGraphics_default),
  73379. viewFrom: createPropertyDescriptor_default("viewFrom"),
  73380. wall: createPropertyTypeDescriptor("wall", WallGraphics_default)
  73381. });
  73382. Entity.prototype.isAvailable = function(time) {
  73383. if (!defined_default(time)) {
  73384. throw new DeveloperError_default("time is required.");
  73385. }
  73386. const availability = this._availability;
  73387. return !defined_default(availability) || availability.contains(time);
  73388. };
  73389. Entity.prototype.addProperty = function(propertyName) {
  73390. const propertyNames = this._propertyNames;
  73391. if (!defined_default(propertyName)) {
  73392. throw new DeveloperError_default("propertyName is required.");
  73393. }
  73394. if (propertyNames.indexOf(propertyName) !== -1) {
  73395. throw new DeveloperError_default(
  73396. `${propertyName} is already a registered property.`
  73397. );
  73398. }
  73399. if (propertyName in this) {
  73400. throw new DeveloperError_default(`${propertyName} is a reserved property name.`);
  73401. }
  73402. propertyNames.push(propertyName);
  73403. Object.defineProperty(
  73404. this,
  73405. propertyName,
  73406. createRawPropertyDescriptor_default(propertyName, true)
  73407. );
  73408. };
  73409. Entity.prototype.removeProperty = function(propertyName) {
  73410. const propertyNames = this._propertyNames;
  73411. const index2 = propertyNames.indexOf(propertyName);
  73412. if (!defined_default(propertyName)) {
  73413. throw new DeveloperError_default("propertyName is required.");
  73414. }
  73415. if (index2 === -1) {
  73416. throw new DeveloperError_default(`${propertyName} is not a registered property.`);
  73417. }
  73418. this._propertyNames.splice(index2, 1);
  73419. delete this[propertyName];
  73420. };
  73421. Entity.prototype.merge = function(source) {
  73422. if (!defined_default(source)) {
  73423. throw new DeveloperError_default("source is required.");
  73424. }
  73425. this.name = defaultValue_default(this.name, source.name);
  73426. this.availability = defaultValue_default(this.availability, source.availability);
  73427. const propertyNames = this._propertyNames;
  73428. const sourcePropertyNames = defined_default(source._propertyNames) ? source._propertyNames : Object.keys(source);
  73429. const propertyNamesLength = sourcePropertyNames.length;
  73430. for (let i2 = 0; i2 < propertyNamesLength; i2++) {
  73431. const name = sourcePropertyNames[i2];
  73432. if (name === "parent" || name === "name" || name === "availability") {
  73433. continue;
  73434. }
  73435. const targetProperty = this[name];
  73436. const sourceProperty = source[name];
  73437. if (!defined_default(targetProperty) && propertyNames.indexOf(name) === -1) {
  73438. this.addProperty(name);
  73439. }
  73440. if (defined_default(sourceProperty)) {
  73441. if (defined_default(targetProperty)) {
  73442. if (defined_default(targetProperty.merge)) {
  73443. targetProperty.merge(sourceProperty);
  73444. }
  73445. } else if (defined_default(sourceProperty.merge) && defined_default(sourceProperty.clone)) {
  73446. this[name] = sourceProperty.clone();
  73447. } else {
  73448. this[name] = sourceProperty;
  73449. }
  73450. }
  73451. }
  73452. };
  73453. var matrix3Scratch2 = new Matrix3_default();
  73454. var positionScratch6 = new Cartesian3_default();
  73455. var orientationScratch = new Quaternion_default();
  73456. Entity.prototype.computeModelMatrix = function(time, result) {
  73457. Check_default.typeOf.object("time", time);
  73458. const position = Property_default.getValueOrUndefined(
  73459. this._position,
  73460. time,
  73461. positionScratch6
  73462. );
  73463. if (!defined_default(position)) {
  73464. return void 0;
  73465. }
  73466. const orientation = Property_default.getValueOrUndefined(
  73467. this._orientation,
  73468. time,
  73469. orientationScratch
  73470. );
  73471. if (!defined_default(orientation)) {
  73472. result = Transforms_default.eastNorthUpToFixedFrame(position, void 0, result);
  73473. } else {
  73474. result = Matrix4_default.fromRotationTranslation(
  73475. Matrix3_default.fromQuaternion(orientation, matrix3Scratch2),
  73476. position,
  73477. result
  73478. );
  73479. }
  73480. return result;
  73481. };
  73482. Entity.prototype.computeModelMatrixForHeightReference = function(time, heightReferenceProperty, heightOffset, ellipsoid, result) {
  73483. Check_default.typeOf.object("time", time);
  73484. const heightReference = Property_default.getValueOrDefault(
  73485. heightReferenceProperty,
  73486. time,
  73487. HeightReference_default.NONE
  73488. );
  73489. let position = Property_default.getValueOrUndefined(
  73490. this._position,
  73491. time,
  73492. positionScratch6
  73493. );
  73494. if (heightReference === HeightReference_default.NONE || !defined_default(position) || Cartesian3_default.equalsEpsilon(position, Cartesian3_default.ZERO, Math_default.EPSILON8)) {
  73495. return this.computeModelMatrix(time, result);
  73496. }
  73497. const carto = ellipsoid.cartesianToCartographic(position, cartoScratch2);
  73498. if (heightReference === HeightReference_default.CLAMP_TO_GROUND) {
  73499. carto.height = heightOffset;
  73500. } else {
  73501. carto.height += heightOffset;
  73502. }
  73503. position = ellipsoid.cartographicToCartesian(carto, position);
  73504. const orientation = Property_default.getValueOrUndefined(
  73505. this._orientation,
  73506. time,
  73507. orientationScratch
  73508. );
  73509. if (!defined_default(orientation)) {
  73510. result = Transforms_default.eastNorthUpToFixedFrame(position, void 0, result);
  73511. } else {
  73512. result = Matrix4_default.fromRotationTranslation(
  73513. Matrix3_default.fromQuaternion(orientation, matrix3Scratch2),
  73514. position,
  73515. result
  73516. );
  73517. }
  73518. return result;
  73519. };
  73520. Entity.supportsMaterialsforEntitiesOnTerrain = function(scene) {
  73521. return GroundPrimitive_default.supportsMaterials(scene);
  73522. };
  73523. Entity.supportsPolylinesOnTerrain = function(scene) {
  73524. return GroundPolylinePrimitive_default.isSupported(scene);
  73525. };
  73526. var Entity_default = Entity;
  73527. // node_modules/cesium/Source/DataSources/GeometryUpdater.js
  73528. var defaultMaterial = new ColorMaterialProperty_default(Color_default.WHITE);
  73529. var defaultShow = new ConstantProperty_default(true);
  73530. var defaultFill = new ConstantProperty_default(true);
  73531. var defaultOutline = new ConstantProperty_default(false);
  73532. var defaultOutlineColor = new ConstantProperty_default(Color_default.BLACK);
  73533. var defaultShadows = new ConstantProperty_default(ShadowMode_default.DISABLED);
  73534. var defaultDistanceDisplayCondition = new ConstantProperty_default(
  73535. new DistanceDisplayCondition_default()
  73536. );
  73537. var defaultClassificationType = new ConstantProperty_default(ClassificationType_default.BOTH);
  73538. function GeometryUpdater(options) {
  73539. Check_default.defined("options.entity", options.entity);
  73540. Check_default.defined("options.scene", options.scene);
  73541. Check_default.defined("options.geometryOptions", options.geometryOptions);
  73542. Check_default.defined("options.geometryPropertyName", options.geometryPropertyName);
  73543. Check_default.defined("options.observedPropertyNames", options.observedPropertyNames);
  73544. const entity = options.entity;
  73545. const geometryPropertyName = options.geometryPropertyName;
  73546. this._entity = entity;
  73547. this._scene = options.scene;
  73548. this._fillEnabled = false;
  73549. this._isClosed = false;
  73550. this._onTerrain = false;
  73551. this._dynamic = false;
  73552. this._outlineEnabled = false;
  73553. this._geometryChanged = new Event_default();
  73554. this._showProperty = void 0;
  73555. this._materialProperty = void 0;
  73556. this._showOutlineProperty = void 0;
  73557. this._outlineColorProperty = void 0;
  73558. this._outlineWidth = 1;
  73559. this._shadowsProperty = void 0;
  73560. this._distanceDisplayConditionProperty = void 0;
  73561. this._classificationTypeProperty = void 0;
  73562. this._options = options.geometryOptions;
  73563. this._geometryPropertyName = geometryPropertyName;
  73564. this._id = `${geometryPropertyName}-${entity.id}`;
  73565. this._observedPropertyNames = options.observedPropertyNames;
  73566. this._supportsMaterialsforEntitiesOnTerrain = Entity_default.supportsMaterialsforEntitiesOnTerrain(
  73567. options.scene
  73568. );
  73569. }
  73570. Object.defineProperties(GeometryUpdater.prototype, {
  73571. id: {
  73572. get: function() {
  73573. return this._id;
  73574. }
  73575. },
  73576. entity: {
  73577. get: function() {
  73578. return this._entity;
  73579. }
  73580. },
  73581. fillEnabled: {
  73582. get: function() {
  73583. return this._fillEnabled;
  73584. }
  73585. },
  73586. hasConstantFill: {
  73587. get: function() {
  73588. return !this._fillEnabled || !defined_default(this._entity.availability) && Property_default.isConstant(this._showProperty) && Property_default.isConstant(this._fillProperty);
  73589. }
  73590. },
  73591. fillMaterialProperty: {
  73592. get: function() {
  73593. return this._materialProperty;
  73594. }
  73595. },
  73596. outlineEnabled: {
  73597. get: function() {
  73598. return this._outlineEnabled;
  73599. }
  73600. },
  73601. hasConstantOutline: {
  73602. get: function() {
  73603. return !this._outlineEnabled || !defined_default(this._entity.availability) && Property_default.isConstant(this._showProperty) && Property_default.isConstant(this._showOutlineProperty);
  73604. }
  73605. },
  73606. outlineColorProperty: {
  73607. get: function() {
  73608. return this._outlineColorProperty;
  73609. }
  73610. },
  73611. outlineWidth: {
  73612. get: function() {
  73613. return this._outlineWidth;
  73614. }
  73615. },
  73616. shadowsProperty: {
  73617. get: function() {
  73618. return this._shadowsProperty;
  73619. }
  73620. },
  73621. distanceDisplayConditionProperty: {
  73622. get: function() {
  73623. return this._distanceDisplayConditionProperty;
  73624. }
  73625. },
  73626. classificationTypeProperty: {
  73627. get: function() {
  73628. return this._classificationTypeProperty;
  73629. }
  73630. },
  73631. isDynamic: {
  73632. get: function() {
  73633. return this._dynamic;
  73634. }
  73635. },
  73636. isClosed: {
  73637. get: function() {
  73638. return this._isClosed;
  73639. }
  73640. },
  73641. onTerrain: {
  73642. get: function() {
  73643. return this._onTerrain;
  73644. }
  73645. },
  73646. geometryChanged: {
  73647. get: function() {
  73648. return this._geometryChanged;
  73649. }
  73650. }
  73651. });
  73652. GeometryUpdater.prototype.isOutlineVisible = function(time) {
  73653. const entity = this._entity;
  73654. const visible = this._outlineEnabled && entity.isAvailable(time) && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time);
  73655. return defaultValue_default(visible, false);
  73656. };
  73657. GeometryUpdater.prototype.isFilled = function(time) {
  73658. const entity = this._entity;
  73659. const visible = this._fillEnabled && entity.isAvailable(time) && this._showProperty.getValue(time) && this._fillProperty.getValue(time);
  73660. return defaultValue_default(visible, false);
  73661. };
  73662. GeometryUpdater.prototype.createFillGeometryInstance = DeveloperError_default.throwInstantiationError;
  73663. GeometryUpdater.prototype.createOutlineGeometryInstance = DeveloperError_default.throwInstantiationError;
  73664. GeometryUpdater.prototype.isDestroyed = function() {
  73665. return false;
  73666. };
  73667. GeometryUpdater.prototype.destroy = function() {
  73668. destroyObject_default(this);
  73669. };
  73670. GeometryUpdater.prototype._isHidden = function(entity, geometry) {
  73671. const show = geometry.show;
  73672. return defined_default(show) && show.isConstant && !show.getValue(Iso8601_default.MINIMUM_VALUE);
  73673. };
  73674. GeometryUpdater.prototype._isOnTerrain = function(entity, geometry) {
  73675. return false;
  73676. };
  73677. GeometryUpdater.prototype._getIsClosed = function(options) {
  73678. return true;
  73679. };
  73680. GeometryUpdater.prototype._isDynamic = DeveloperError_default.throwInstantiationError;
  73681. GeometryUpdater.prototype._setStaticOptions = DeveloperError_default.throwInstantiationError;
  73682. GeometryUpdater.prototype._onEntityPropertyChanged = function(entity, propertyName, newValue, oldValue2) {
  73683. if (this._observedPropertyNames.indexOf(propertyName) === -1) {
  73684. return;
  73685. }
  73686. const geometry = this._entity[this._geometryPropertyName];
  73687. if (!defined_default(geometry)) {
  73688. if (this._fillEnabled || this._outlineEnabled) {
  73689. this._fillEnabled = false;
  73690. this._outlineEnabled = false;
  73691. this._geometryChanged.raiseEvent(this);
  73692. }
  73693. return;
  73694. }
  73695. const fillProperty = geometry.fill;
  73696. const fillEnabled = defined_default(fillProperty) && fillProperty.isConstant ? fillProperty.getValue(Iso8601_default.MINIMUM_VALUE) : true;
  73697. const outlineProperty = geometry.outline;
  73698. let outlineEnabled = defined_default(outlineProperty);
  73699. if (outlineEnabled && outlineProperty.isConstant) {
  73700. outlineEnabled = outlineProperty.getValue(Iso8601_default.MINIMUM_VALUE);
  73701. }
  73702. if (!fillEnabled && !outlineEnabled) {
  73703. if (this._fillEnabled || this._outlineEnabled) {
  73704. this._fillEnabled = false;
  73705. this._outlineEnabled = false;
  73706. this._geometryChanged.raiseEvent(this);
  73707. }
  73708. return;
  73709. }
  73710. const show = geometry.show;
  73711. if (this._isHidden(entity, geometry)) {
  73712. if (this._fillEnabled || this._outlineEnabled) {
  73713. this._fillEnabled = false;
  73714. this._outlineEnabled = false;
  73715. this._geometryChanged.raiseEvent(this);
  73716. }
  73717. return;
  73718. }
  73719. this._materialProperty = defaultValue_default(geometry.material, defaultMaterial);
  73720. this._fillProperty = defaultValue_default(fillProperty, defaultFill);
  73721. this._showProperty = defaultValue_default(show, defaultShow);
  73722. this._showOutlineProperty = defaultValue_default(geometry.outline, defaultOutline);
  73723. this._outlineColorProperty = outlineEnabled ? defaultValue_default(geometry.outlineColor, defaultOutlineColor) : void 0;
  73724. this._shadowsProperty = defaultValue_default(geometry.shadows, defaultShadows);
  73725. this._distanceDisplayConditionProperty = defaultValue_default(
  73726. geometry.distanceDisplayCondition,
  73727. defaultDistanceDisplayCondition
  73728. );
  73729. this._classificationTypeProperty = defaultValue_default(
  73730. geometry.classificationType,
  73731. defaultClassificationType
  73732. );
  73733. this._fillEnabled = fillEnabled;
  73734. const onTerrain = this._isOnTerrain(entity, geometry) && (this._supportsMaterialsforEntitiesOnTerrain || this._materialProperty instanceof ColorMaterialProperty_default);
  73735. if (outlineEnabled && onTerrain) {
  73736. oneTimeWarning_default(oneTimeWarning_default.geometryOutlines);
  73737. outlineEnabled = false;
  73738. }
  73739. this._onTerrain = onTerrain;
  73740. this._outlineEnabled = outlineEnabled;
  73741. if (this._isDynamic(entity, geometry)) {
  73742. if (!this._dynamic) {
  73743. this._dynamic = true;
  73744. this._geometryChanged.raiseEvent(this);
  73745. }
  73746. } else {
  73747. this._setStaticOptions(entity, geometry);
  73748. this._isClosed = this._getIsClosed(this._options);
  73749. const outlineWidth = geometry.outlineWidth;
  73750. this._outlineWidth = defined_default(outlineWidth) ? outlineWidth.getValue(Iso8601_default.MINIMUM_VALUE) : 1;
  73751. this._dynamic = false;
  73752. this._geometryChanged.raiseEvent(this);
  73753. }
  73754. };
  73755. GeometryUpdater.prototype.createDynamicUpdater = function(primitives, groundPrimitives) {
  73756. Check_default.defined("primitives", primitives);
  73757. Check_default.defined("groundPrimitives", groundPrimitives);
  73758. if (!this._dynamic) {
  73759. throw new DeveloperError_default(
  73760. "This instance does not represent dynamic geometry."
  73761. );
  73762. }
  73763. return new this.constructor.DynamicGeometryUpdater(
  73764. this,
  73765. primitives,
  73766. groundPrimitives
  73767. );
  73768. };
  73769. var GeometryUpdater_default = GeometryUpdater;
  73770. // node_modules/cesium/Source/DataSources/CallbackProperty.js
  73771. function CallbackProperty(callback, isConstant) {
  73772. this._callback = void 0;
  73773. this._isConstant = void 0;
  73774. this._definitionChanged = new Event_default();
  73775. this.setCallback(callback, isConstant);
  73776. }
  73777. Object.defineProperties(CallbackProperty.prototype, {
  73778. isConstant: {
  73779. get: function() {
  73780. return this._isConstant;
  73781. }
  73782. },
  73783. definitionChanged: {
  73784. get: function() {
  73785. return this._definitionChanged;
  73786. }
  73787. }
  73788. });
  73789. CallbackProperty.prototype.getValue = function(time, result) {
  73790. return this._callback(time, result);
  73791. };
  73792. CallbackProperty.prototype.setCallback = function(callback, isConstant) {
  73793. if (!defined_default(callback)) {
  73794. throw new DeveloperError_default("callback is required.");
  73795. }
  73796. if (!defined_default(isConstant)) {
  73797. throw new DeveloperError_default("isConstant is required.");
  73798. }
  73799. const changed = this._callback !== callback || this._isConstant !== isConstant;
  73800. this._callback = callback;
  73801. this._isConstant = isConstant;
  73802. if (changed) {
  73803. this._definitionChanged.raiseEvent(this);
  73804. }
  73805. };
  73806. CallbackProperty.prototype.equals = function(other) {
  73807. return this === other || other instanceof CallbackProperty && this._callback === other._callback && this._isConstant === other._isConstant;
  73808. };
  73809. var CallbackProperty_default = CallbackProperty;
  73810. // node_modules/cesium/Source/DataSources/TerrainOffsetProperty.js
  73811. var scratchPosition6 = new Cartesian3_default();
  73812. var scratchCarto = new Cartographic_default();
  73813. function TerrainOffsetProperty(scene, positionProperty, heightReferenceProperty, extrudedHeightReferenceProperty) {
  73814. Check_default.defined("scene", scene);
  73815. Check_default.defined("positionProperty", positionProperty);
  73816. this._scene = scene;
  73817. this._heightReference = heightReferenceProperty;
  73818. this._extrudedHeightReference = extrudedHeightReferenceProperty;
  73819. this._positionProperty = positionProperty;
  73820. this._position = new Cartesian3_default();
  73821. this._cartographicPosition = new Cartographic_default();
  73822. this._normal = new Cartesian3_default();
  73823. this._definitionChanged = new Event_default();
  73824. this._terrainHeight = 0;
  73825. this._removeCallbackFunc = void 0;
  73826. this._removeEventListener = void 0;
  73827. this._removeModeListener = void 0;
  73828. const that = this;
  73829. if (defined_default(scene.globe)) {
  73830. this._removeEventListener = scene.terrainProviderChanged.addEventListener(
  73831. function() {
  73832. that._updateClamping();
  73833. }
  73834. );
  73835. this._removeModeListener = scene.morphComplete.addEventListener(
  73836. function() {
  73837. that._updateClamping();
  73838. }
  73839. );
  73840. }
  73841. if (positionProperty.isConstant) {
  73842. const position = positionProperty.getValue(
  73843. Iso8601_default.MINIMUM_VALUE,
  73844. scratchPosition6
  73845. );
  73846. if (!defined_default(position) || Cartesian3_default.equals(position, Cartesian3_default.ZERO) || !defined_default(scene.globe)) {
  73847. return;
  73848. }
  73849. this._position = Cartesian3_default.clone(position, this._position);
  73850. this._updateClamping();
  73851. this._normal = scene.globe.ellipsoid.geodeticSurfaceNormal(
  73852. position,
  73853. this._normal
  73854. );
  73855. }
  73856. }
  73857. Object.defineProperties(TerrainOffsetProperty.prototype, {
  73858. isConstant: {
  73859. get: function() {
  73860. return false;
  73861. }
  73862. },
  73863. definitionChanged: {
  73864. get: function() {
  73865. return this._definitionChanged;
  73866. }
  73867. }
  73868. });
  73869. TerrainOffsetProperty.prototype._updateClamping = function() {
  73870. if (defined_default(this._removeCallbackFunc)) {
  73871. this._removeCallbackFunc();
  73872. }
  73873. const scene = this._scene;
  73874. const globe = scene.globe;
  73875. const position = this._position;
  73876. if (!defined_default(globe) || Cartesian3_default.equals(position, Cartesian3_default.ZERO)) {
  73877. this._terrainHeight = 0;
  73878. return;
  73879. }
  73880. const ellipsoid = globe.ellipsoid;
  73881. const surface = globe._surface;
  73882. const that = this;
  73883. const cartographicPosition = ellipsoid.cartesianToCartographic(
  73884. position,
  73885. this._cartographicPosition
  73886. );
  73887. const height = globe.getHeight(cartographicPosition);
  73888. if (defined_default(height)) {
  73889. this._terrainHeight = height;
  73890. } else {
  73891. this._terrainHeight = 0;
  73892. }
  73893. function updateFunction(clampedPosition) {
  73894. if (scene.mode === SceneMode_default.SCENE3D) {
  73895. const carto = ellipsoid.cartesianToCartographic(
  73896. clampedPosition,
  73897. scratchCarto
  73898. );
  73899. that._terrainHeight = carto.height;
  73900. } else {
  73901. that._terrainHeight = clampedPosition.x;
  73902. }
  73903. that.definitionChanged.raiseEvent();
  73904. }
  73905. this._removeCallbackFunc = surface.updateHeight(
  73906. cartographicPosition,
  73907. updateFunction
  73908. );
  73909. };
  73910. TerrainOffsetProperty.prototype.getValue = function(time, result) {
  73911. const heightReference = Property_default.getValueOrDefault(
  73912. this._heightReference,
  73913. time,
  73914. HeightReference_default.NONE
  73915. );
  73916. const extrudedHeightReference = Property_default.getValueOrDefault(
  73917. this._extrudedHeightReference,
  73918. time,
  73919. HeightReference_default.NONE
  73920. );
  73921. if (heightReference === HeightReference_default.NONE && extrudedHeightReference !== HeightReference_default.RELATIVE_TO_GROUND) {
  73922. this._position = Cartesian3_default.clone(Cartesian3_default.ZERO, this._position);
  73923. return Cartesian3_default.clone(Cartesian3_default.ZERO, result);
  73924. }
  73925. if (this._positionProperty.isConstant) {
  73926. return Cartesian3_default.multiplyByScalar(
  73927. this._normal,
  73928. this._terrainHeight,
  73929. result
  73930. );
  73931. }
  73932. const scene = this._scene;
  73933. const position = this._positionProperty.getValue(time, scratchPosition6);
  73934. if (!defined_default(position) || Cartesian3_default.equals(position, Cartesian3_default.ZERO) || !defined_default(scene.globe)) {
  73935. return Cartesian3_default.clone(Cartesian3_default.ZERO, result);
  73936. }
  73937. if (Cartesian3_default.equalsEpsilon(this._position, position, Math_default.EPSILON10)) {
  73938. return Cartesian3_default.multiplyByScalar(
  73939. this._normal,
  73940. this._terrainHeight,
  73941. result
  73942. );
  73943. }
  73944. this._position = Cartesian3_default.clone(position, this._position);
  73945. this._updateClamping();
  73946. const normal2 = scene.globe.ellipsoid.geodeticSurfaceNormal(
  73947. position,
  73948. this._normal
  73949. );
  73950. return Cartesian3_default.multiplyByScalar(normal2, this._terrainHeight, result);
  73951. };
  73952. TerrainOffsetProperty.prototype.isDestroyed = function() {
  73953. return false;
  73954. };
  73955. TerrainOffsetProperty.prototype.destroy = function() {
  73956. if (defined_default(this._removeEventListener)) {
  73957. this._removeEventListener();
  73958. }
  73959. if (defined_default(this._removeModeListener)) {
  73960. this._removeModeListener();
  73961. }
  73962. if (defined_default(this._removeCallbackFunc)) {
  73963. this._removeCallbackFunc();
  73964. }
  73965. return destroyObject_default(this);
  73966. };
  73967. var TerrainOffsetProperty_default = TerrainOffsetProperty;
  73968. // node_modules/cesium/Source/DataSources/heightReferenceOnEntityPropertyChanged.js
  73969. function heightReferenceOnEntityPropertyChanged(entity, propertyName, newValue, oldValue2) {
  73970. GeometryUpdater_default.prototype._onEntityPropertyChanged.call(
  73971. this,
  73972. entity,
  73973. propertyName,
  73974. newValue,
  73975. oldValue2
  73976. );
  73977. if (this._observedPropertyNames.indexOf(propertyName) === -1) {
  73978. return;
  73979. }
  73980. const geometry = this._entity[this._geometryPropertyName];
  73981. if (!defined_default(geometry)) {
  73982. return;
  73983. }
  73984. if (defined_default(this._terrainOffsetProperty)) {
  73985. this._terrainOffsetProperty.destroy();
  73986. this._terrainOffsetProperty = void 0;
  73987. }
  73988. const heightReferenceProperty = geometry.heightReference;
  73989. if (defined_default(heightReferenceProperty)) {
  73990. const centerPosition = new CallbackProperty_default(
  73991. this._computeCenter.bind(this),
  73992. !this._dynamic
  73993. );
  73994. this._terrainOffsetProperty = new TerrainOffsetProperty_default(
  73995. this._scene,
  73996. centerPosition,
  73997. heightReferenceProperty
  73998. );
  73999. }
  74000. }
  74001. var heightReferenceOnEntityPropertyChanged_default = heightReferenceOnEntityPropertyChanged;
  74002. // node_modules/cesium/Source/DataSources/BoxGeometryUpdater.js
  74003. var defaultOffset = Cartesian3_default.ZERO;
  74004. var offsetScratch4 = new Cartesian3_default();
  74005. var positionScratch7 = new Cartesian3_default();
  74006. var scratchColor = new Color_default();
  74007. function BoxGeometryOptions(entity) {
  74008. this.id = entity;
  74009. this.vertexFormat = void 0;
  74010. this.dimensions = void 0;
  74011. this.offsetAttribute = void 0;
  74012. }
  74013. function BoxGeometryUpdater(entity, scene) {
  74014. GeometryUpdater_default.call(this, {
  74015. entity,
  74016. scene,
  74017. geometryOptions: new BoxGeometryOptions(entity),
  74018. geometryPropertyName: "box",
  74019. observedPropertyNames: ["availability", "position", "orientation", "box"]
  74020. });
  74021. this._onEntityPropertyChanged(entity, "box", entity.box, void 0);
  74022. }
  74023. if (defined_default(Object.create)) {
  74024. BoxGeometryUpdater.prototype = Object.create(GeometryUpdater_default.prototype);
  74025. BoxGeometryUpdater.prototype.constructor = BoxGeometryUpdater;
  74026. }
  74027. Object.defineProperties(BoxGeometryUpdater.prototype, {
  74028. terrainOffsetProperty: {
  74029. get: function() {
  74030. return this._terrainOffsetProperty;
  74031. }
  74032. }
  74033. });
  74034. BoxGeometryUpdater.prototype.createFillGeometryInstance = function(time) {
  74035. Check_default.defined("time", time);
  74036. if (!this._fillEnabled) {
  74037. throw new DeveloperError_default(
  74038. "This instance does not represent a filled geometry."
  74039. );
  74040. }
  74041. const entity = this._entity;
  74042. const isAvailable = entity.isAvailable(time);
  74043. const show = new ShowGeometryInstanceAttribute_default(
  74044. isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time)
  74045. );
  74046. const distanceDisplayCondition = this._distanceDisplayConditionProperty.getValue(
  74047. time
  74048. );
  74049. const distanceDisplayConditionAttribute = DistanceDisplayConditionGeometryInstanceAttribute_default.fromDistanceDisplayCondition(
  74050. distanceDisplayCondition
  74051. );
  74052. const attributes = {
  74053. show,
  74054. distanceDisplayCondition: distanceDisplayConditionAttribute,
  74055. color: void 0,
  74056. offset: void 0
  74057. };
  74058. if (this._materialProperty instanceof ColorMaterialProperty_default) {
  74059. let currentColor;
  74060. if (defined_default(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) {
  74061. currentColor = this._materialProperty.color.getValue(time, scratchColor);
  74062. }
  74063. if (!defined_default(currentColor)) {
  74064. currentColor = Color_default.WHITE;
  74065. }
  74066. attributes.color = ColorGeometryInstanceAttribute_default.fromColor(currentColor);
  74067. }
  74068. if (defined_default(this._options.offsetAttribute)) {
  74069. attributes.offset = OffsetGeometryInstanceAttribute_default.fromCartesian3(
  74070. Property_default.getValueOrDefault(
  74071. this._terrainOffsetProperty,
  74072. time,
  74073. defaultOffset,
  74074. offsetScratch4
  74075. )
  74076. );
  74077. }
  74078. return new GeometryInstance_default({
  74079. id: entity,
  74080. geometry: BoxGeometry_default.fromDimensions(this._options),
  74081. modelMatrix: entity.computeModelMatrixForHeightReference(
  74082. time,
  74083. entity.box.heightReference,
  74084. this._options.dimensions.z * 0.5,
  74085. this._scene.mapProjection.ellipsoid
  74086. ),
  74087. attributes
  74088. });
  74089. };
  74090. BoxGeometryUpdater.prototype.createOutlineGeometryInstance = function(time) {
  74091. Check_default.defined("time", time);
  74092. if (!this._outlineEnabled) {
  74093. throw new DeveloperError_default(
  74094. "This instance does not represent an outlined geometry."
  74095. );
  74096. }
  74097. const entity = this._entity;
  74098. const isAvailable = entity.isAvailable(time);
  74099. const outlineColor = Property_default.getValueOrDefault(
  74100. this._outlineColorProperty,
  74101. time,
  74102. Color_default.BLACK,
  74103. scratchColor
  74104. );
  74105. const distanceDisplayCondition = this._distanceDisplayConditionProperty.getValue(
  74106. time
  74107. );
  74108. const attributes = {
  74109. show: new ShowGeometryInstanceAttribute_default(
  74110. isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)
  74111. ),
  74112. color: ColorGeometryInstanceAttribute_default.fromColor(outlineColor),
  74113. distanceDisplayCondition: DistanceDisplayConditionGeometryInstanceAttribute_default.fromDistanceDisplayCondition(
  74114. distanceDisplayCondition
  74115. ),
  74116. offset: void 0
  74117. };
  74118. if (defined_default(this._options.offsetAttribute)) {
  74119. attributes.offset = OffsetGeometryInstanceAttribute_default.fromCartesian3(
  74120. Property_default.getValueOrDefault(
  74121. this._terrainOffsetProperty,
  74122. time,
  74123. defaultOffset,
  74124. offsetScratch4
  74125. )
  74126. );
  74127. }
  74128. return new GeometryInstance_default({
  74129. id: entity,
  74130. geometry: BoxOutlineGeometry_default.fromDimensions(this._options),
  74131. modelMatrix: entity.computeModelMatrixForHeightReference(
  74132. time,
  74133. entity.box.heightReference,
  74134. this._options.dimensions.z * 0.5,
  74135. this._scene.mapProjection.ellipsoid
  74136. ),
  74137. attributes
  74138. });
  74139. };
  74140. BoxGeometryUpdater.prototype._computeCenter = function(time, result) {
  74141. return Property_default.getValueOrUndefined(this._entity.position, time, result);
  74142. };
  74143. BoxGeometryUpdater.prototype._isHidden = function(entity, box) {
  74144. return !defined_default(box.dimensions) || !defined_default(entity.position) || GeometryUpdater_default.prototype._isHidden.call(this, entity, box);
  74145. };
  74146. BoxGeometryUpdater.prototype._isDynamic = function(entity, box) {
  74147. return !entity.position.isConstant || !Property_default.isConstant(entity.orientation) || !box.dimensions.isConstant || !Property_default.isConstant(box.outlineWidth);
  74148. };
  74149. BoxGeometryUpdater.prototype._setStaticOptions = function(entity, box) {
  74150. const heightReference = Property_default.getValueOrDefault(
  74151. box.heightReference,
  74152. Iso8601_default.MINIMUM_VALUE,
  74153. HeightReference_default.NONE
  74154. );
  74155. const options = this._options;
  74156. options.vertexFormat = this._materialProperty instanceof ColorMaterialProperty_default ? PerInstanceColorAppearance_default.VERTEX_FORMAT : MaterialAppearance_default.MaterialSupport.TEXTURED.vertexFormat;
  74157. options.dimensions = box.dimensions.getValue(
  74158. Iso8601_default.MINIMUM_VALUE,
  74159. options.dimensions
  74160. );
  74161. options.offsetAttribute = heightReference !== HeightReference_default.NONE ? GeometryOffsetAttribute_default.ALL : void 0;
  74162. };
  74163. BoxGeometryUpdater.prototype._onEntityPropertyChanged = heightReferenceOnEntityPropertyChanged_default;
  74164. BoxGeometryUpdater.DynamicGeometryUpdater = DynamicBoxGeometryUpdater;
  74165. function DynamicBoxGeometryUpdater(geometryUpdater, primitives, groundPrimitives) {
  74166. DynamicGeometryUpdater_default.call(
  74167. this,
  74168. geometryUpdater,
  74169. primitives,
  74170. groundPrimitives
  74171. );
  74172. }
  74173. if (defined_default(Object.create)) {
  74174. DynamicBoxGeometryUpdater.prototype = Object.create(
  74175. DynamicGeometryUpdater_default.prototype
  74176. );
  74177. DynamicBoxGeometryUpdater.prototype.constructor = DynamicBoxGeometryUpdater;
  74178. }
  74179. DynamicBoxGeometryUpdater.prototype._isHidden = function(entity, box, time) {
  74180. const position = Property_default.getValueOrUndefined(
  74181. entity.position,
  74182. time,
  74183. positionScratch7
  74184. );
  74185. const dimensions = this._options.dimensions;
  74186. return !defined_default(position) || !defined_default(dimensions) || DynamicGeometryUpdater_default.prototype._isHidden.call(this, entity, box, time);
  74187. };
  74188. DynamicBoxGeometryUpdater.prototype._setOptions = function(entity, box, time) {
  74189. const heightReference = Property_default.getValueOrDefault(
  74190. box.heightReference,
  74191. time,
  74192. HeightReference_default.NONE
  74193. );
  74194. const options = this._options;
  74195. options.dimensions = Property_default.getValueOrUndefined(
  74196. box.dimensions,
  74197. time,
  74198. options.dimensions
  74199. );
  74200. options.offsetAttribute = heightReference !== HeightReference_default.NONE ? GeometryOffsetAttribute_default.ALL : void 0;
  74201. };
  74202. var BoxGeometryUpdater_default = BoxGeometryUpdater;
  74203. // node_modules/cesium/Source/Renderer/ComputeCommand.js
  74204. function ComputeCommand(options) {
  74205. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  74206. this.vertexArray = options.vertexArray;
  74207. this.fragmentShaderSource = options.fragmentShaderSource;
  74208. this.shaderProgram = options.shaderProgram;
  74209. this.uniformMap = options.uniformMap;
  74210. this.outputTexture = options.outputTexture;
  74211. this.preExecute = options.preExecute;
  74212. this.postExecute = options.postExecute;
  74213. this.canceled = options.canceled;
  74214. this.persists = defaultValue_default(options.persists, false);
  74215. this.pass = Pass_default.COMPUTE;
  74216. this.owner = options.owner;
  74217. }
  74218. ComputeCommand.prototype.execute = function(computeEngine) {
  74219. computeEngine.execute(this);
  74220. };
  74221. var ComputeCommand_default = ComputeCommand;
  74222. // node_modules/cesium/Source/Shaders/OctahedralProjectionAtlasFS.js
  74223. var OctahedralProjectionAtlasFS_default = "varying vec2 v_textureCoordinates;\n\nuniform float originalSize;\nuniform sampler2D texture0;\nuniform sampler2D texture1;\nuniform sampler2D texture2;\nuniform sampler2D texture3;\nuniform sampler2D texture4;\nuniform sampler2D texture5;\n\nconst float yMipLevel1 = 1.0 - (1.0 / pow(2.0, 1.0));\nconst float yMipLevel2 = 1.0 - (1.0 / pow(2.0, 2.0));\nconst float yMipLevel3 = 1.0 - (1.0 / pow(2.0, 3.0));\nconst float yMipLevel4 = 1.0 - (1.0 / pow(2.0, 4.0));\n\nvoid main()\n{\n vec2 uv = v_textureCoordinates;\n vec2 textureSize = vec2(originalSize * 1.5 + 2.0, originalSize);\n vec2 pixel = 1.0 / textureSize;\n\n float mipLevel = 0.0;\n\n if (uv.x - pixel.x > (textureSize.y / textureSize.x))\n {\n mipLevel = 1.0;\n if (uv.y - pixel.y > yMipLevel1)\n {\n mipLevel = 2.0;\n if (uv.y - pixel.y * 3.0 > yMipLevel2)\n {\n mipLevel = 3.0;\n if (uv.y - pixel.y * 5.0 > yMipLevel3)\n {\n mipLevel = 4.0;\n if (uv.y - pixel.y * 7.0 > yMipLevel4)\n {\n mipLevel = 5.0;\n }\n }\n }\n }\n }\n\n if (mipLevel > 0.0)\n {\n float scale = pow(2.0, mipLevel);\n\n uv.y -= (pixel.y * (mipLevel - 1.0) * 2.0);\n uv.x *= ((textureSize.x - 2.0) / textureSize.y);\n\n uv.x -= 1.0 + pixel.x;\n uv.y -= (1.0 - (1.0 / pow(2.0, mipLevel - 1.0)));\n uv *= scale;\n }\n else\n {\n uv.x *= (textureSize.x / textureSize.y);\n }\n\n if(mipLevel == 0.0)\n {\n gl_FragColor = texture2D(texture0, uv);\n }\n else if(mipLevel == 1.0)\n {\n gl_FragColor = texture2D(texture1, uv);\n }\n else if(mipLevel == 2.0)\n {\n gl_FragColor = texture2D(texture2, uv);\n }\n else if(mipLevel == 3.0)\n {\n gl_FragColor = texture2D(texture3, uv);\n }\n else if(mipLevel == 4.0)\n {\n gl_FragColor = texture2D(texture4, uv);\n }\n else if(mipLevel == 5.0)\n {\n gl_FragColor = texture2D(texture5, uv);\n }\n else\n {\n gl_FragColor = vec4(0.0);\n }\n}\n";
  74224. // node_modules/cesium/Source/Shaders/OctahedralProjectionFS.js
  74225. var OctahedralProjectionFS_default = "varying vec3 v_cubeMapCoordinates;\nuniform samplerCube cubeMap;\n\nvoid main()\n{\n vec4 rgba = textureCube(cubeMap, v_cubeMapCoordinates);\n #ifdef RGBA_NORMALIZED\n gl_FragColor = vec4(rgba.rgb, 1.0);\n #else\n float m = rgba.a * 16.0;\n vec3 r = rgba.rgb * m;\n gl_FragColor = vec4(r * r, 1.0);\n #endif\n}\n";
  74226. // node_modules/cesium/Source/Shaders/OctahedralProjectionVS.js
  74227. var OctahedralProjectionVS_default = "attribute vec4 position;\nattribute vec3 cubeMapCoordinates;\n\nvarying vec3 v_cubeMapCoordinates;\n\nvoid main()\n{\n gl_Position = position;\n v_cubeMapCoordinates = cubeMapCoordinates;\n}\n";
  74228. // node_modules/cesium/Source/Scene/OctahedralProjectedCubeMap.js
  74229. function OctahedralProjectedCubeMap(url2) {
  74230. this._url = url2;
  74231. this._cubeMapBuffers = void 0;
  74232. this._cubeMaps = void 0;
  74233. this._texture = void 0;
  74234. this._mipTextures = void 0;
  74235. this._va = void 0;
  74236. this._sp = void 0;
  74237. this._maximumMipmapLevel = void 0;
  74238. this._loading = false;
  74239. this._ready = false;
  74240. this._readyPromise = defer_default();
  74241. }
  74242. Object.defineProperties(OctahedralProjectedCubeMap.prototype, {
  74243. url: {
  74244. get: function() {
  74245. return this._url;
  74246. }
  74247. },
  74248. texture: {
  74249. get: function() {
  74250. return this._texture;
  74251. }
  74252. },
  74253. maximumMipmapLevel: {
  74254. get: function() {
  74255. return this._maximumMipmapLevel;
  74256. }
  74257. },
  74258. ready: {
  74259. get: function() {
  74260. return this._ready;
  74261. }
  74262. },
  74263. readyPromise: {
  74264. get: function() {
  74265. return this._readyPromise.promise;
  74266. }
  74267. }
  74268. });
  74269. OctahedralProjectedCubeMap.isSupported = function(context) {
  74270. return context.colorBufferHalfFloat && context.halfFloatingPointTexture || context.floatingPointTexture && context.colorBufferFloat;
  74271. };
  74272. var v12 = new Cartesian3_default(1, 0, 0);
  74273. var v22 = new Cartesian3_default(0, 0, 1);
  74274. var v3 = new Cartesian3_default(-1, 0, 0);
  74275. var v4 = new Cartesian3_default(0, 0, -1);
  74276. var v5 = new Cartesian3_default(0, 1, 0);
  74277. var v6 = new Cartesian3_default(0, -1, 0);
  74278. var cubeMapCoordinates = [v5, v3, v22, v6, v12, v5, v4, v5, v5];
  74279. var length = cubeMapCoordinates.length;
  74280. var flatCubeMapCoordinates = new Float32Array(length * 3);
  74281. var offset = 0;
  74282. for (let i2 = 0; i2 < length; ++i2, offset += 3) {
  74283. Cartesian3_default.pack(cubeMapCoordinates[i2], flatCubeMapCoordinates, offset);
  74284. }
  74285. var flatPositions = new Float32Array([
  74286. -1,
  74287. 1,
  74288. -1,
  74289. 0,
  74290. 0,
  74291. 1,
  74292. 0,
  74293. 0,
  74294. 1,
  74295. 0,
  74296. 1,
  74297. 1,
  74298. 0,
  74299. -1,
  74300. -1,
  74301. -1,
  74302. 1,
  74303. -1
  74304. ]);
  74305. var indices = new Uint16Array([
  74306. 0,
  74307. 1,
  74308. 2,
  74309. 2,
  74310. 3,
  74311. 1,
  74312. 7,
  74313. 6,
  74314. 1,
  74315. 3,
  74316. 6,
  74317. 1,
  74318. 2,
  74319. 5,
  74320. 4,
  74321. 3,
  74322. 4,
  74323. 2,
  74324. 4,
  74325. 8,
  74326. 6,
  74327. 3,
  74328. 4,
  74329. 6
  74330. ]);
  74331. function createVertexArray2(context) {
  74332. const positionBuffer = Buffer_default.createVertexBuffer({
  74333. context,
  74334. typedArray: flatPositions,
  74335. usage: BufferUsage_default.STATIC_DRAW
  74336. });
  74337. const cubeMapCoordinatesBuffer = Buffer_default.createVertexBuffer({
  74338. context,
  74339. typedArray: flatCubeMapCoordinates,
  74340. usage: BufferUsage_default.STATIC_DRAW
  74341. });
  74342. const indexBuffer = Buffer_default.createIndexBuffer({
  74343. context,
  74344. typedArray: indices,
  74345. usage: BufferUsage_default.STATIC_DRAW,
  74346. indexDatatype: IndexDatatype_default.UNSIGNED_SHORT
  74347. });
  74348. const attributes = [
  74349. {
  74350. index: 0,
  74351. vertexBuffer: positionBuffer,
  74352. componentsPerAttribute: 2,
  74353. componentDatatype: ComponentDatatype_default.FLOAT
  74354. },
  74355. {
  74356. index: 1,
  74357. vertexBuffer: cubeMapCoordinatesBuffer,
  74358. componentsPerAttribute: 3,
  74359. componentDatatype: ComponentDatatype_default.FLOAT
  74360. }
  74361. ];
  74362. return new VertexArray_default({
  74363. context,
  74364. attributes,
  74365. indexBuffer
  74366. });
  74367. }
  74368. function createUniformTexture(texture) {
  74369. return function() {
  74370. return texture;
  74371. };
  74372. }
  74373. function cleanupResources(map) {
  74374. map._va = map._va && map._va.destroy();
  74375. map._sp = map._sp && map._sp.destroy();
  74376. let i2;
  74377. let length3;
  74378. const cubeMaps = map._cubeMaps;
  74379. if (defined_default(cubeMaps)) {
  74380. length3 = cubeMaps.length;
  74381. for (i2 = 0; i2 < length3; ++i2) {
  74382. cubeMaps[i2].destroy();
  74383. }
  74384. }
  74385. const mipTextures = map._mipTextures;
  74386. if (defined_default(mipTextures)) {
  74387. length3 = mipTextures.length;
  74388. for (i2 = 0; i2 < length3; ++i2) {
  74389. mipTextures[i2].destroy();
  74390. }
  74391. }
  74392. map._va = void 0;
  74393. map._sp = void 0;
  74394. map._cubeMaps = void 0;
  74395. map._cubeMapBuffers = void 0;
  74396. map._mipTextures = void 0;
  74397. }
  74398. OctahedralProjectedCubeMap.prototype.update = function(frameState) {
  74399. const context = frameState.context;
  74400. if (!OctahedralProjectedCubeMap.isSupported(context)) {
  74401. return;
  74402. }
  74403. if (defined_default(this._texture) && defined_default(this._va)) {
  74404. cleanupResources(this);
  74405. }
  74406. if (defined_default(this._texture)) {
  74407. return;
  74408. }
  74409. if (!defined_default(this._texture) && !this._loading) {
  74410. const cachedTexture = context.textureCache.getTexture(this._url);
  74411. if (defined_default(cachedTexture)) {
  74412. cleanupResources(this);
  74413. this._texture = cachedTexture;
  74414. this._maximumMipmapLevel = this._texture.maximumMipmapLevel;
  74415. this._ready = true;
  74416. this._readyPromise.resolve();
  74417. return;
  74418. }
  74419. }
  74420. const cubeMapBuffers = this._cubeMapBuffers;
  74421. if (!defined_default(cubeMapBuffers) && !this._loading) {
  74422. const that = this;
  74423. loadKTX2_default(this._url).then(function(buffers) {
  74424. that._cubeMapBuffers = buffers;
  74425. that._loading = false;
  74426. }).catch(function(e2) {
  74427. that._readyPromise.reject(e2);
  74428. });
  74429. this._loading = true;
  74430. }
  74431. if (!defined_default(this._cubeMapBuffers)) {
  74432. return;
  74433. }
  74434. const defines = [];
  74435. let pixelDatatype = cubeMapBuffers[0].positiveX.pixelDatatype;
  74436. if (!defined_default(pixelDatatype)) {
  74437. pixelDatatype = context.halfFloatingPointTexture ? PixelDatatype_default.HALF_FLOAT : PixelDatatype_default.FLOAT;
  74438. } else {
  74439. defines.push("RGBA_NORMALIZED");
  74440. }
  74441. const pixelFormat = PixelFormat_default.RGBA;
  74442. const fs = new ShaderSource_default({
  74443. defines,
  74444. sources: [OctahedralProjectionFS_default]
  74445. });
  74446. this._va = createVertexArray2(context);
  74447. this._sp = ShaderProgram_default.fromCache({
  74448. context,
  74449. vertexShaderSource: OctahedralProjectionVS_default,
  74450. fragmentShaderSource: fs,
  74451. attributeLocations: {
  74452. position: 0,
  74453. cubeMapCoordinates: 1
  74454. }
  74455. });
  74456. const length3 = Math.min(cubeMapBuffers.length, 6);
  74457. this._maximumMipmapLevel = length3 - 1;
  74458. const cubeMaps = this._cubeMaps = new Array(length3);
  74459. const mipTextures = this._mipTextures = new Array(length3);
  74460. const originalSize = cubeMapBuffers[0].positiveX.width * 2;
  74461. const uniformMap2 = {
  74462. originalSize: function() {
  74463. return originalSize;
  74464. }
  74465. };
  74466. for (let i2 = 0; i2 < length3; ++i2) {
  74467. const positiveY = cubeMapBuffers[i2].positiveY;
  74468. cubeMapBuffers[i2].positiveY = cubeMapBuffers[i2].negativeY;
  74469. cubeMapBuffers[i2].negativeY = positiveY;
  74470. const cubeMap = cubeMaps[i2] = new CubeMap_default({
  74471. context,
  74472. source: cubeMapBuffers[i2],
  74473. pixelDatatype
  74474. });
  74475. const size = cubeMaps[i2].width * 2;
  74476. const mipTexture = mipTextures[i2] = new Texture_default({
  74477. context,
  74478. width: size,
  74479. height: size,
  74480. pixelDatatype,
  74481. pixelFormat
  74482. });
  74483. const command = new ComputeCommand_default({
  74484. vertexArray: this._va,
  74485. shaderProgram: this._sp,
  74486. uniformMap: {
  74487. cubeMap: createUniformTexture(cubeMap)
  74488. },
  74489. outputTexture: mipTexture,
  74490. persists: true,
  74491. owner: this
  74492. });
  74493. frameState.commandList.push(command);
  74494. uniformMap2[`texture${i2}`] = createUniformTexture(mipTexture);
  74495. }
  74496. this._texture = new Texture_default({
  74497. context,
  74498. width: originalSize * 1.5 + 2,
  74499. height: originalSize,
  74500. pixelDatatype,
  74501. pixelFormat
  74502. });
  74503. this._texture.maximumMipmapLevel = this._maximumMipmapLevel;
  74504. context.textureCache.addTexture(this._url, this._texture);
  74505. const atlasCommand = new ComputeCommand_default({
  74506. fragmentShaderSource: OctahedralProjectionAtlasFS_default,
  74507. uniformMap: uniformMap2,
  74508. outputTexture: this._texture,
  74509. persists: false,
  74510. owner: this
  74511. });
  74512. frameState.commandList.push(atlasCommand);
  74513. this._ready = true;
  74514. this._readyPromise.resolve();
  74515. };
  74516. OctahedralProjectedCubeMap.prototype.isDestroyed = function() {
  74517. return false;
  74518. };
  74519. OctahedralProjectedCubeMap.prototype.destroy = function() {
  74520. cleanupResources(this);
  74521. this._texture = this._texture && this._texture.destroy();
  74522. return destroyObject_default(this);
  74523. };
  74524. var OctahedralProjectedCubeMap_default = OctahedralProjectedCubeMap;
  74525. // node_modules/cesium/Source/Scene/ImageBasedLighting.js
  74526. function ImageBasedLighting(options) {
  74527. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  74528. const imageBasedLightingFactor = defined_default(options.imageBasedLightingFactor) ? Cartesian2_default.clone(options.imageBasedLightingFactor) : new Cartesian2_default(1, 1);
  74529. Check_default.typeOf.object(
  74530. "options.imageBasedLightingFactor",
  74531. imageBasedLightingFactor
  74532. );
  74533. Check_default.typeOf.number.greaterThanOrEquals(
  74534. "options.imageBasedLightingFactor.x",
  74535. imageBasedLightingFactor.x,
  74536. 0
  74537. );
  74538. Check_default.typeOf.number.lessThanOrEquals(
  74539. "options.imageBasedLightingFactor.x",
  74540. imageBasedLightingFactor.x,
  74541. 1
  74542. );
  74543. Check_default.typeOf.number.greaterThanOrEquals(
  74544. "options.imageBasedLightingFactor.y",
  74545. imageBasedLightingFactor.y,
  74546. 0
  74547. );
  74548. Check_default.typeOf.number.lessThanOrEquals(
  74549. "options.imageBasedLightingFactor.y",
  74550. imageBasedLightingFactor.y,
  74551. 1
  74552. );
  74553. this._imageBasedLightingFactor = imageBasedLightingFactor;
  74554. const luminanceAtZenith = defaultValue_default(options.luminanceAtZenith, 0.2);
  74555. Check_default.typeOf.number("options.luminanceAtZenith", luminanceAtZenith);
  74556. this._luminanceAtZenith = luminanceAtZenith;
  74557. const sphericalHarmonicCoefficients = options.sphericalHarmonicCoefficients;
  74558. if (defined_default(sphericalHarmonicCoefficients) && (!Array.isArray(sphericalHarmonicCoefficients) || sphericalHarmonicCoefficients.length !== 9)) {
  74559. throw new DeveloperError_default(
  74560. "options.sphericalHarmonicCoefficients must be an array of 9 Cartesian3 values."
  74561. );
  74562. }
  74563. this._sphericalHarmonicCoefficients = sphericalHarmonicCoefficients;
  74564. this._specularEnvironmentMaps = options.specularEnvironmentMaps;
  74565. this._specularEnvironmentMapAtlas = void 0;
  74566. this._specularEnvironmentMapAtlasDirty = true;
  74567. this._specularEnvironmentMapLoaded = false;
  74568. this._previousSpecularEnvironmentMapLoaded = false;
  74569. this._useDefaultSpecularMaps = false;
  74570. this._useDefaultSphericalHarmonics = false;
  74571. this._shouldRegenerateShaders = false;
  74572. this._previousFrameNumber = void 0;
  74573. this._previousImageBasedLightingFactor = Cartesian2_default.clone(
  74574. imageBasedLightingFactor
  74575. );
  74576. this._previousLuminanceAtZenith = luminanceAtZenith;
  74577. this._previousSphericalHarmonicCoefficients = sphericalHarmonicCoefficients;
  74578. }
  74579. Object.defineProperties(ImageBasedLighting.prototype, {
  74580. imageBasedLightingFactor: {
  74581. get: function() {
  74582. return this._imageBasedLightingFactor;
  74583. },
  74584. set: function(value) {
  74585. Check_default.typeOf.object("imageBasedLightingFactor", value);
  74586. Check_default.typeOf.number.greaterThanOrEquals(
  74587. "imageBasedLightingFactor.x",
  74588. value.x,
  74589. 0
  74590. );
  74591. Check_default.typeOf.number.lessThanOrEquals(
  74592. "imageBasedLightingFactor.x",
  74593. value.x,
  74594. 1
  74595. );
  74596. Check_default.typeOf.number.greaterThanOrEquals(
  74597. "imageBasedLightingFactor.y",
  74598. value.y,
  74599. 0
  74600. );
  74601. Check_default.typeOf.number.lessThanOrEquals(
  74602. "imageBasedLightingFactor.y",
  74603. value.y,
  74604. 1
  74605. );
  74606. this._previousImageBasedLightingFactor = Cartesian2_default.clone(
  74607. this._imageBasedLightingFactor,
  74608. this._previousImageBasedLightingFactor
  74609. );
  74610. this._imageBasedLightingFactor = Cartesian2_default.clone(
  74611. value,
  74612. this._imageBasedLightingFactor
  74613. );
  74614. }
  74615. },
  74616. luminanceAtZenith: {
  74617. get: function() {
  74618. return this._luminanceAtZenith;
  74619. },
  74620. set: function(value) {
  74621. this._previousLuminanceAtZenith = this._luminanceAtZenith;
  74622. this._luminanceAtZenith = value;
  74623. }
  74624. },
  74625. sphericalHarmonicCoefficients: {
  74626. get: function() {
  74627. return this._sphericalHarmonicCoefficients;
  74628. },
  74629. set: function(value) {
  74630. if (defined_default(value) && (!Array.isArray(value) || value.length !== 9)) {
  74631. throw new DeveloperError_default(
  74632. "sphericalHarmonicCoefficients must be an array of 9 Cartesian3 values."
  74633. );
  74634. }
  74635. this._previousSphericalHarmonicCoefficients = this._sphericalHarmonicCoefficients;
  74636. this._sphericalHarmonicCoefficients = value;
  74637. }
  74638. },
  74639. specularEnvironmentMaps: {
  74640. get: function() {
  74641. return this._specularEnvironmentMaps;
  74642. },
  74643. set: function(value) {
  74644. if (value !== this._specularEnvironmentMaps) {
  74645. this._specularEnvironmentMapAtlasDirty = this._specularEnvironmentMapAtlasDirty || value !== this._specularEnvironmentMaps;
  74646. this._specularEnvironmentMapLoaded = false;
  74647. }
  74648. this._specularEnvironmentMaps = value;
  74649. }
  74650. },
  74651. enabled: {
  74652. get: function() {
  74653. return this._imageBasedLightingFactor.x > 0 || this._imageBasedLightingFactor.y > 0;
  74654. }
  74655. },
  74656. shouldRegenerateShaders: {
  74657. get: function() {
  74658. return this._shouldRegenerateShaders;
  74659. }
  74660. },
  74661. useDefaultSphericalHarmonics: {
  74662. get: function() {
  74663. return this._useDefaultSphericalHarmonics;
  74664. }
  74665. },
  74666. useSphericalHarmonicCoefficients: {
  74667. get: function() {
  74668. return defined_default(this._sphericalHarmonicCoefficients) || this._useDefaultSphericalHarmonics;
  74669. }
  74670. },
  74671. specularEnvironmentMapAtlas: {
  74672. get: function() {
  74673. return this._specularEnvironmentMapAtlas;
  74674. }
  74675. },
  74676. useDefaultSpecularMaps: {
  74677. get: function() {
  74678. return this._useDefaultSpecularMaps;
  74679. }
  74680. },
  74681. useSpecularEnvironmentMaps: {
  74682. get: function() {
  74683. return defined_default(this._specularEnvironmentMapAtlas) && this._specularEnvironmentMapAtlas.ready || this._useDefaultSpecularMaps;
  74684. }
  74685. }
  74686. });
  74687. function createSpecularEnvironmentMapAtlas(imageBasedLighting, context) {
  74688. if (!OctahedralProjectedCubeMap_default.isSupported(context)) {
  74689. return;
  74690. }
  74691. imageBasedLighting._specularEnvironmentMapAtlas = imageBasedLighting._specularEnvironmentMapAtlas && imageBasedLighting._specularEnvironmentMapAtlas.destroy();
  74692. if (defined_default(imageBasedLighting._specularEnvironmentMaps)) {
  74693. const atlas = new OctahedralProjectedCubeMap_default(
  74694. imageBasedLighting._specularEnvironmentMaps
  74695. );
  74696. imageBasedLighting._specularEnvironmentMapAtlas = atlas;
  74697. atlas.readyPromise.then(function() {
  74698. imageBasedLighting._specularEnvironmentMapLoaded = true;
  74699. }).catch(function(error) {
  74700. console.error(`Error loading specularEnvironmentMaps: ${error}`);
  74701. });
  74702. }
  74703. imageBasedLighting._shouldRegenerateShaders = true;
  74704. }
  74705. ImageBasedLighting.prototype.update = function(frameState) {
  74706. if (frameState.frameNumber === this._previousFrameNumber) {
  74707. return;
  74708. }
  74709. this._previousFrameNumber = frameState.frameNumber;
  74710. const context = frameState.context;
  74711. frameState.brdfLutGenerator.update(frameState);
  74712. this._shouldRegenerateShaders = false;
  74713. const iblFactor = this._imageBasedLightingFactor;
  74714. const previousIBLFactor = this._previousImageBasedLightingFactor;
  74715. if (!Cartesian2_default.equals(iblFactor, previousIBLFactor)) {
  74716. this._shouldRegenerateShaders = iblFactor.x > 0 && previousIBLFactor.x === 0 || iblFactor.x === 0 && previousIBLFactor.x > 0;
  74717. this._shouldRegenerateShaders = this._shouldRegenerateShaders || iblFactor.y > 0 && previousIBLFactor.y === 0 || iblFactor.y === 0 && previousIBLFactor.y > 0;
  74718. this._previousImageBasedLightingFactor = Cartesian2_default.clone(
  74719. this._imageBasedLightingFactor,
  74720. this._previousImageBasedLightingFactor
  74721. );
  74722. }
  74723. if (this._luminanceAtZenith !== this._previousLuminanceAtZenith) {
  74724. this._shouldRegenerateShaders = this._shouldRegenerateShaders || defined_default(this._luminanceAtZenith) !== defined_default(this._previousLuminanceAtZenith);
  74725. this._previousLuminanceAtZenith = this._luminanceAtZenith;
  74726. }
  74727. if (this._previousSphericalHarmonicCoefficients !== this._sphericalHarmonicCoefficients) {
  74728. this._shouldRegenerateShaders = this._shouldRegenerateShaders || defined_default(this._previousSphericalHarmonicCoefficients) !== defined_default(this._sphericalHarmonicCoefficients);
  74729. this._previousSphericalHarmonicCoefficients = this._sphericalHarmonicCoefficients;
  74730. }
  74731. this._shouldRegenerateShaders = this._shouldRegenerateShaders || this._previousSpecularEnvironmentMapLoaded !== this._specularEnvironmentMapLoaded;
  74732. this._previousSpecularEnvironmentMapLoaded = this._specularEnvironmentMapLoaded;
  74733. if (this._specularEnvironmentMapAtlasDirty) {
  74734. createSpecularEnvironmentMapAtlas(this, context);
  74735. this._specularEnvironmentMapAtlasDirty = false;
  74736. }
  74737. if (defined_default(this._specularEnvironmentMapAtlas)) {
  74738. this._specularEnvironmentMapAtlas.update(frameState);
  74739. }
  74740. const recompileWithDefaultAtlas = !defined_default(this._specularEnvironmentMapAtlas) && defined_default(frameState.specularEnvironmentMaps) && !this._useDefaultSpecularMaps;
  74741. const recompileWithoutDefaultAtlas = !defined_default(frameState.specularEnvironmentMaps) && this._useDefaultSpecularMaps;
  74742. const recompileWithDefaultSHCoeffs = !defined_default(this._sphericalHarmonicCoefficients) && defined_default(frameState.sphericalHarmonicCoefficients) && !this._useDefaultSphericalHarmonics;
  74743. const recompileWithoutDefaultSHCoeffs = !defined_default(frameState.sphericalHarmonicCoefficients) && this._useDefaultSphericalHarmonics;
  74744. this._shouldRegenerateShaders = this._shouldRegenerateShaders || recompileWithDefaultAtlas || recompileWithoutDefaultAtlas || recompileWithDefaultSHCoeffs || recompileWithoutDefaultSHCoeffs;
  74745. this._useDefaultSpecularMaps = !defined_default(this._specularEnvironmentMapAtlas) && defined_default(frameState.specularEnvironmentMaps);
  74746. this._useDefaultSphericalHarmonics = !defined_default(this._sphericalHarmonicCoefficients) && defined_default(frameState.sphericalHarmonicCoefficients);
  74747. };
  74748. ImageBasedLighting.prototype.isDestroyed = function() {
  74749. return false;
  74750. };
  74751. ImageBasedLighting.prototype.destroy = function() {
  74752. this._specularEnvironmentMapAtlas = this._specularEnvironmentMapAtlas && this._specularEnvironmentMapAtlas.destroy();
  74753. return destroyObject_default(this);
  74754. };
  74755. // node_modules/cesium/Source/Renderer/ClearCommand.js
  74756. function ClearCommand(options) {
  74757. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  74758. this.color = options.color;
  74759. this.depth = options.depth;
  74760. this.stencil = options.stencil;
  74761. this.renderState = options.renderState;
  74762. this.framebuffer = options.framebuffer;
  74763. this.owner = options.owner;
  74764. this.pass = options.pass;
  74765. }
  74766. ClearCommand.ALL = Object.freeze(
  74767. new ClearCommand({
  74768. color: new Color_default(0, 0, 0, 0),
  74769. depth: 1,
  74770. stencil: 0
  74771. })
  74772. );
  74773. ClearCommand.prototype.execute = function(context, passState) {
  74774. context.clear(this, passState);
  74775. };
  74776. var ClearCommand_default = ClearCommand;
  74777. // node_modules/cesium/Source/Scene/Axis.js
  74778. var Axis = {
  74779. X: 0,
  74780. Y: 1,
  74781. Z: 2
  74782. };
  74783. Axis.Y_UP_TO_Z_UP = Matrix4_default.fromRotationTranslation(
  74784. Matrix3_default.fromRotationX(Math_default.PI_OVER_TWO)
  74785. );
  74786. Axis.Z_UP_TO_Y_UP = Matrix4_default.fromRotationTranslation(
  74787. Matrix3_default.fromRotationX(-Math_default.PI_OVER_TWO)
  74788. );
  74789. Axis.X_UP_TO_Z_UP = Matrix4_default.fromRotationTranslation(
  74790. Matrix3_default.fromRotationY(-Math_default.PI_OVER_TWO)
  74791. );
  74792. Axis.Z_UP_TO_X_UP = Matrix4_default.fromRotationTranslation(
  74793. Matrix3_default.fromRotationY(Math_default.PI_OVER_TWO)
  74794. );
  74795. Axis.X_UP_TO_Y_UP = Matrix4_default.fromRotationTranslation(
  74796. Matrix3_default.fromRotationZ(Math_default.PI_OVER_TWO)
  74797. );
  74798. Axis.Y_UP_TO_X_UP = Matrix4_default.fromRotationTranslation(
  74799. Matrix3_default.fromRotationZ(-Math_default.PI_OVER_TWO)
  74800. );
  74801. Axis.fromName = function(name) {
  74802. Check_default.typeOf.string("name", name);
  74803. return Axis[name];
  74804. };
  74805. var Axis_default = Object.freeze(Axis);
  74806. // node_modules/cesium/Source/Scene/Cesium3DContentGroup.js
  74807. function Cesium3DContentGroup(options) {
  74808. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  74809. Check_default.typeOf.object("options.metadata", options.metadata);
  74810. this._metadata = options.metadata;
  74811. }
  74812. Object.defineProperties(Cesium3DContentGroup.prototype, {
  74813. metadata: {
  74814. get: function() {
  74815. return this._metadata;
  74816. }
  74817. }
  74818. });
  74819. // node_modules/cesium/Source/Scene/B3dmParser.js
  74820. var B3dmParser = {};
  74821. B3dmParser._deprecationWarning = deprecationWarning_default;
  74822. var sizeOfUint322 = Uint32Array.BYTES_PER_ELEMENT;
  74823. B3dmParser.parse = function(arrayBuffer, byteOffset) {
  74824. const byteStart = defaultValue_default(byteOffset, 0);
  74825. Check_default.defined("arrayBuffer", arrayBuffer);
  74826. byteOffset = byteStart;
  74827. const uint8Array = new Uint8Array(arrayBuffer);
  74828. const view = new DataView(arrayBuffer);
  74829. byteOffset += sizeOfUint322;
  74830. const version = view.getUint32(byteOffset, true);
  74831. if (version !== 1) {
  74832. throw new RuntimeError_default(
  74833. `Only Batched 3D Model version 1 is supported. Version ${version} is not.`
  74834. );
  74835. }
  74836. byteOffset += sizeOfUint322;
  74837. const byteLength = view.getUint32(byteOffset, true);
  74838. byteOffset += sizeOfUint322;
  74839. let featureTableJsonByteLength = view.getUint32(byteOffset, true);
  74840. byteOffset += sizeOfUint322;
  74841. let featureTableBinaryByteLength = view.getUint32(byteOffset, true);
  74842. byteOffset += sizeOfUint322;
  74843. let batchTableJsonByteLength = view.getUint32(byteOffset, true);
  74844. byteOffset += sizeOfUint322;
  74845. let batchTableBinaryByteLength = view.getUint32(byteOffset, true);
  74846. byteOffset += sizeOfUint322;
  74847. let batchLength;
  74848. if (batchTableJsonByteLength >= 570425344) {
  74849. byteOffset -= sizeOfUint322 * 2;
  74850. batchLength = featureTableJsonByteLength;
  74851. batchTableJsonByteLength = featureTableBinaryByteLength;
  74852. batchTableBinaryByteLength = 0;
  74853. featureTableJsonByteLength = 0;
  74854. featureTableBinaryByteLength = 0;
  74855. B3dmParser._deprecationWarning(
  74856. "b3dm-legacy-header",
  74857. "This b3dm header is using the legacy format [batchLength] [batchTableByteLength]. The new format is [featureTableJsonByteLength] [featureTableBinaryByteLength] [batchTableJsonByteLength] [batchTableBinaryByteLength] from https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/Batched3DModel."
  74858. );
  74859. } else if (batchTableBinaryByteLength >= 570425344) {
  74860. byteOffset -= sizeOfUint322;
  74861. batchLength = batchTableJsonByteLength;
  74862. batchTableJsonByteLength = featureTableJsonByteLength;
  74863. batchTableBinaryByteLength = featureTableBinaryByteLength;
  74864. featureTableJsonByteLength = 0;
  74865. featureTableBinaryByteLength = 0;
  74866. B3dmParser._deprecationWarning(
  74867. "b3dm-legacy-header",
  74868. "This b3dm header is using the legacy format [batchTableJsonByteLength] [batchTableBinaryByteLength] [batchLength]. The new format is [featureTableJsonByteLength] [featureTableBinaryByteLength] [batchTableJsonByteLength] [batchTableBinaryByteLength] from https://github.com/CesiumGS/3d-tiles/tree/main/specification/TileFormats/Batched3DModel."
  74869. );
  74870. }
  74871. let featureTableJson;
  74872. if (featureTableJsonByteLength === 0) {
  74873. featureTableJson = {
  74874. BATCH_LENGTH: defaultValue_default(batchLength, 0)
  74875. };
  74876. } else {
  74877. featureTableJson = getJsonFromTypedArray_default(
  74878. uint8Array,
  74879. byteOffset,
  74880. featureTableJsonByteLength
  74881. );
  74882. byteOffset += featureTableJsonByteLength;
  74883. }
  74884. const featureTableBinary = new Uint8Array(
  74885. arrayBuffer,
  74886. byteOffset,
  74887. featureTableBinaryByteLength
  74888. );
  74889. byteOffset += featureTableBinaryByteLength;
  74890. let batchTableJson;
  74891. let batchTableBinary;
  74892. if (batchTableJsonByteLength > 0) {
  74893. batchTableJson = getJsonFromTypedArray_default(
  74894. uint8Array,
  74895. byteOffset,
  74896. batchTableJsonByteLength
  74897. );
  74898. byteOffset += batchTableJsonByteLength;
  74899. if (batchTableBinaryByteLength > 0) {
  74900. batchTableBinary = new Uint8Array(
  74901. arrayBuffer,
  74902. byteOffset,
  74903. batchTableBinaryByteLength
  74904. );
  74905. batchTableBinary = new Uint8Array(batchTableBinary);
  74906. byteOffset += batchTableBinaryByteLength;
  74907. }
  74908. }
  74909. const gltfByteLength = byteStart + byteLength - byteOffset;
  74910. if (gltfByteLength === 0) {
  74911. throw new RuntimeError_default("glTF byte length must be greater than 0.");
  74912. }
  74913. let gltfView;
  74914. if (byteOffset % 4 === 0) {
  74915. gltfView = new Uint8Array(arrayBuffer, byteOffset, gltfByteLength);
  74916. } else {
  74917. B3dmParser._deprecationWarning(
  74918. "b3dm-glb-unaligned",
  74919. "The embedded glb is not aligned to a 4-byte boundary."
  74920. );
  74921. gltfView = new Uint8Array(
  74922. uint8Array.subarray(byteOffset, byteOffset + gltfByteLength)
  74923. );
  74924. }
  74925. return {
  74926. batchLength,
  74927. featureTableJson,
  74928. featureTableBinary,
  74929. batchTableJson,
  74930. batchTableBinary,
  74931. gltf: gltfView
  74932. };
  74933. };
  74934. var B3dmParser_default = B3dmParser;
  74935. // node_modules/cesium/Source/Scene/BatchTexture.js
  74936. function BatchTexture(options) {
  74937. Check_default.typeOf.number("options.featuresLength", options.featuresLength);
  74938. Check_default.typeOf.object("options.owner", options.owner);
  74939. const featuresLength = options.featuresLength;
  74940. this._showAlphaProperties = void 0;
  74941. this._batchValues = void 0;
  74942. this._batchValuesDirty = false;
  74943. this._batchTexture = void 0;
  74944. this._defaultTexture = void 0;
  74945. this._pickTexture = void 0;
  74946. this._pickIds = [];
  74947. let textureDimensions;
  74948. let textureStep;
  74949. if (featuresLength > 0) {
  74950. const width = Math.min(featuresLength, ContextLimits_default.maximumTextureSize);
  74951. const height = Math.ceil(featuresLength / ContextLimits_default.maximumTextureSize);
  74952. const stepX = 1 / width;
  74953. const centerX = stepX * 0.5;
  74954. const stepY = 1 / height;
  74955. const centerY = stepY * 0.5;
  74956. textureDimensions = new Cartesian2_default(width, height);
  74957. textureStep = new Cartesian4_default(stepX, centerX, stepY, centerY);
  74958. }
  74959. this._translucentFeaturesLength = 0;
  74960. this._featuresLength = featuresLength;
  74961. this._textureDimensions = textureDimensions;
  74962. this._textureStep = textureStep;
  74963. this._owner = options.owner;
  74964. this._statistics = options.statistics;
  74965. this._colorChangedCallback = options.colorChangedCallback;
  74966. }
  74967. Object.defineProperties(BatchTexture.prototype, {
  74968. translucentFeaturesLength: {
  74969. get: function() {
  74970. return this._translucentFeaturesLength;
  74971. }
  74972. },
  74973. memorySizeInBytes: {
  74974. get: function() {
  74975. let memory = 0;
  74976. if (defined_default(this._pickTexture)) {
  74977. memory += this._pickTexture.sizeInBytes;
  74978. }
  74979. if (defined_default(this._batchTexture)) {
  74980. memory += this._batchTexture.sizeInBytes;
  74981. }
  74982. return memory;
  74983. }
  74984. },
  74985. textureDimensions: {
  74986. get: function() {
  74987. return this._textureDimensions;
  74988. }
  74989. },
  74990. textureStep: {
  74991. get: function() {
  74992. return this._textureStep;
  74993. }
  74994. },
  74995. batchTexture: {
  74996. get: function() {
  74997. return this._batchTexture;
  74998. }
  74999. },
  75000. defaultTexture: {
  75001. get: function() {
  75002. return this._defaultTexture;
  75003. }
  75004. },
  75005. pickTexture: {
  75006. get: function() {
  75007. return this._pickTexture;
  75008. }
  75009. }
  75010. });
  75011. BatchTexture.DEFAULT_COLOR_VALUE = Color_default.WHITE;
  75012. BatchTexture.DEFAULT_SHOW_VALUE = true;
  75013. function getByteLength(batchTexture) {
  75014. const dimensions = batchTexture._textureDimensions;
  75015. return dimensions.x * dimensions.y * 4;
  75016. }
  75017. function getBatchValues(batchTexture) {
  75018. if (!defined_default(batchTexture._batchValues)) {
  75019. const byteLength = getByteLength(batchTexture);
  75020. const bytes = new Uint8Array(byteLength);
  75021. arrayFill_default(bytes, 255);
  75022. batchTexture._batchValues = bytes;
  75023. }
  75024. return batchTexture._batchValues;
  75025. }
  75026. function getShowAlphaProperties(batchTexture) {
  75027. if (!defined_default(batchTexture._showAlphaProperties)) {
  75028. const byteLength = 2 * batchTexture._featuresLength;
  75029. const bytes = new Uint8Array(byteLength);
  75030. arrayFill_default(bytes, 255);
  75031. batchTexture._showAlphaProperties = bytes;
  75032. }
  75033. return batchTexture._showAlphaProperties;
  75034. }
  75035. function checkBatchId(batchId, featuresLength) {
  75036. if (!defined_default(batchId) || batchId < 0 || batchId >= featuresLength) {
  75037. throw new DeveloperError_default(
  75038. `batchId is required and between zero and featuresLength - 1 (${featuresLength}` - +")."
  75039. );
  75040. }
  75041. }
  75042. BatchTexture.prototype.setShow = function(batchId, show) {
  75043. checkBatchId(batchId, this._featuresLength);
  75044. Check_default.typeOf.bool("show", show);
  75045. if (show && !defined_default(this._showAlphaProperties)) {
  75046. return;
  75047. }
  75048. const showAlphaProperties = getShowAlphaProperties(this);
  75049. const propertyOffset = batchId * 2;
  75050. const newShow = show ? 255 : 0;
  75051. if (showAlphaProperties[propertyOffset] !== newShow) {
  75052. showAlphaProperties[propertyOffset] = newShow;
  75053. const batchValues = getBatchValues(this);
  75054. const offset2 = batchId * 4 + 3;
  75055. batchValues[offset2] = show ? showAlphaProperties[propertyOffset + 1] : 0;
  75056. this._batchValuesDirty = true;
  75057. }
  75058. };
  75059. BatchTexture.prototype.setAllShow = function(show) {
  75060. Check_default.typeOf.bool("show", show);
  75061. const featuresLength = this._featuresLength;
  75062. for (let i2 = 0; i2 < featuresLength; ++i2) {
  75063. this.setShow(i2, show);
  75064. }
  75065. };
  75066. BatchTexture.prototype.getShow = function(batchId) {
  75067. checkBatchId(batchId, this._featuresLength);
  75068. if (!defined_default(this._showAlphaProperties)) {
  75069. return true;
  75070. }
  75071. const offset2 = batchId * 2;
  75072. return this._showAlphaProperties[offset2] === 255;
  75073. };
  75074. var scratchColorBytes = new Array(4);
  75075. BatchTexture.prototype.setColor = function(batchId, color) {
  75076. checkBatchId(batchId, this._featuresLength);
  75077. Check_default.typeOf.object("color", color);
  75078. if (Color_default.equals(color, BatchTexture.DEFAULT_COLOR_VALUE) && !defined_default(this._batchValues)) {
  75079. return;
  75080. }
  75081. const newColor = color.toBytes(scratchColorBytes);
  75082. const newAlpha = newColor[3];
  75083. const batchValues = getBatchValues(this);
  75084. const offset2 = batchId * 4;
  75085. const showAlphaProperties = getShowAlphaProperties(this);
  75086. const propertyOffset = batchId * 2;
  75087. if (batchValues[offset2] !== newColor[0] || batchValues[offset2 + 1] !== newColor[1] || batchValues[offset2 + 2] !== newColor[2] || showAlphaProperties[propertyOffset + 1] !== newAlpha) {
  75088. batchValues[offset2] = newColor[0];
  75089. batchValues[offset2 + 1] = newColor[1];
  75090. batchValues[offset2 + 2] = newColor[2];
  75091. const wasTranslucent = showAlphaProperties[propertyOffset + 1] !== 255;
  75092. const show = showAlphaProperties[propertyOffset] !== 0;
  75093. batchValues[offset2 + 3] = show ? newAlpha : 0;
  75094. showAlphaProperties[propertyOffset + 1] = newAlpha;
  75095. const isTranslucent2 = newAlpha !== 255;
  75096. if (isTranslucent2 && !wasTranslucent) {
  75097. ++this._translucentFeaturesLength;
  75098. } else if (!isTranslucent2 && wasTranslucent) {
  75099. --this._translucentFeaturesLength;
  75100. }
  75101. this._batchValuesDirty = true;
  75102. if (defined_default(this._colorChangedCallback)) {
  75103. this._colorChangedCallback(batchId, color);
  75104. }
  75105. }
  75106. };
  75107. BatchTexture.prototype.setAllColor = function(color) {
  75108. Check_default.typeOf.object("color", color);
  75109. const featuresLength = this._featuresLength;
  75110. for (let i2 = 0; i2 < featuresLength; ++i2) {
  75111. this.setColor(i2, color);
  75112. }
  75113. };
  75114. BatchTexture.prototype.getColor = function(batchId, result) {
  75115. checkBatchId(batchId, this._featuresLength);
  75116. Check_default.typeOf.object("result", result);
  75117. if (!defined_default(this._batchValues)) {
  75118. return Color_default.clone(BatchTexture.DEFAULT_COLOR_VALUE, result);
  75119. }
  75120. const batchValues = this._batchValues;
  75121. const offset2 = batchId * 4;
  75122. const showAlphaProperties = this._showAlphaProperties;
  75123. const propertyOffset = batchId * 2;
  75124. return Color_default.fromBytes(
  75125. batchValues[offset2],
  75126. batchValues[offset2 + 1],
  75127. batchValues[offset2 + 2],
  75128. showAlphaProperties[propertyOffset + 1],
  75129. result
  75130. );
  75131. };
  75132. BatchTexture.prototype.getPickColor = function(batchId) {
  75133. checkBatchId(batchId, this._featuresLength);
  75134. return this._pickIds[batchId];
  75135. };
  75136. function createTexture2(batchTexture, context, bytes) {
  75137. const dimensions = batchTexture._textureDimensions;
  75138. return new Texture_default({
  75139. context,
  75140. pixelFormat: PixelFormat_default.RGBA,
  75141. pixelDatatype: PixelDatatype_default.UNSIGNED_BYTE,
  75142. source: {
  75143. width: dimensions.x,
  75144. height: dimensions.y,
  75145. arrayBufferView: bytes
  75146. },
  75147. flipY: false,
  75148. sampler: Sampler_default.NEAREST
  75149. });
  75150. }
  75151. function createPickTexture(batchTexture, context) {
  75152. const featuresLength = batchTexture._featuresLength;
  75153. if (!defined_default(batchTexture._pickTexture) && featuresLength > 0) {
  75154. const pickIds = batchTexture._pickIds;
  75155. const byteLength = getByteLength(batchTexture);
  75156. const bytes = new Uint8Array(byteLength);
  75157. const owner = batchTexture._owner;
  75158. const statistics2 = batchTexture._statistics;
  75159. for (let i2 = 0; i2 < featuresLength; ++i2) {
  75160. const pickId = context.createPickId(owner.getFeature(i2));
  75161. pickIds.push(pickId);
  75162. const pickColor = pickId.color;
  75163. const offset2 = i2 * 4;
  75164. bytes[offset2] = Color_default.floatToByte(pickColor.red);
  75165. bytes[offset2 + 1] = Color_default.floatToByte(pickColor.green);
  75166. bytes[offset2 + 2] = Color_default.floatToByte(pickColor.blue);
  75167. bytes[offset2 + 3] = Color_default.floatToByte(pickColor.alpha);
  75168. }
  75169. batchTexture._pickTexture = createTexture2(batchTexture, context, bytes);
  75170. if (defined_default(statistics2)) {
  75171. statistics2.batchTableByteLength += batchTexture._pickTexture.sizeInBytes;
  75172. }
  75173. }
  75174. }
  75175. function updateBatchTexture(batchTexture) {
  75176. const dimensions = batchTexture._textureDimensions;
  75177. batchTexture._batchTexture.copyFrom({
  75178. source: {
  75179. width: dimensions.x,
  75180. height: dimensions.y,
  75181. arrayBufferView: batchTexture._batchValues
  75182. }
  75183. });
  75184. }
  75185. BatchTexture.prototype.update = function(tileset, frameState) {
  75186. const context = frameState.context;
  75187. this._defaultTexture = context.defaultTexture;
  75188. const passes = frameState.passes;
  75189. if (passes.pick || passes.postProcess) {
  75190. createPickTexture(this, context);
  75191. }
  75192. if (this._batchValuesDirty) {
  75193. this._batchValuesDirty = false;
  75194. if (!defined_default(this._batchTexture)) {
  75195. this._batchTexture = createTexture2(this, context, this._batchValues);
  75196. if (defined_default(this._statistics)) {
  75197. this._statistics.batchTableByteLength += this._batchTexture.sizeInBytes;
  75198. }
  75199. }
  75200. updateBatchTexture(this);
  75201. }
  75202. };
  75203. BatchTexture.prototype.isDestroyed = function() {
  75204. return false;
  75205. };
  75206. BatchTexture.prototype.destroy = function() {
  75207. this._batchTexture = this._batchTexture && this._batchTexture.destroy();
  75208. this._pickTexture = this._pickTexture && this._pickTexture.destroy();
  75209. const pickIds = this._pickIds;
  75210. const length3 = pickIds.length;
  75211. for (let i2 = 0; i2 < length3; ++i2) {
  75212. pickIds[i2].destroy();
  75213. }
  75214. return destroyObject_default(this);
  75215. };
  75216. // node_modules/cesium/Source/Scene/getBinaryAccessor.js
  75217. var ComponentsPerAttribute = {
  75218. SCALAR: 1,
  75219. VEC2: 2,
  75220. VEC3: 3,
  75221. VEC4: 4,
  75222. MAT2: 4,
  75223. MAT3: 9,
  75224. MAT4: 16
  75225. };
  75226. var ClassPerType = {
  75227. SCALAR: void 0,
  75228. VEC2: Cartesian2_default,
  75229. VEC3: Cartesian3_default,
  75230. VEC4: Cartesian4_default,
  75231. MAT2: Matrix2_default,
  75232. MAT3: Matrix3_default,
  75233. MAT4: Matrix4_default
  75234. };
  75235. function getBinaryAccessor(accessor) {
  75236. const componentType = accessor.componentType;
  75237. let componentDatatype;
  75238. if (typeof componentType === "string") {
  75239. componentDatatype = ComponentDatatype_default.fromName(componentType);
  75240. } else {
  75241. componentDatatype = componentType;
  75242. }
  75243. const componentsPerAttribute = ComponentsPerAttribute[accessor.type];
  75244. const classType = ClassPerType[accessor.type];
  75245. return {
  75246. componentsPerAttribute,
  75247. classType,
  75248. createArrayBufferView: function(buffer, byteOffset, length3) {
  75249. return ComponentDatatype_default.createArrayBufferView(
  75250. componentDatatype,
  75251. buffer,
  75252. byteOffset,
  75253. componentsPerAttribute * length3
  75254. );
  75255. }
  75256. };
  75257. }
  75258. var getBinaryAccessor_default = getBinaryAccessor;
  75259. // node_modules/cesium/Source/Scene/BatchTableHierarchy.js
  75260. function BatchTableHierarchy(options) {
  75261. this._classes = void 0;
  75262. this._classIds = void 0;
  75263. this._classIndexes = void 0;
  75264. this._parentCounts = void 0;
  75265. this._parentIndexes = void 0;
  75266. this._parentIds = void 0;
  75267. Check_default.typeOf.object("options.extension", options.extension);
  75268. initialize3(this, options.extension, options.binaryBody);
  75269. validateHierarchy(this);
  75270. }
  75271. function initialize3(hierarchy, hierarchyJson, binaryBody) {
  75272. let i2;
  75273. let classId;
  75274. let binaryAccessor;
  75275. const instancesLength = hierarchyJson.instancesLength;
  75276. const classes = hierarchyJson.classes;
  75277. let classIds = hierarchyJson.classIds;
  75278. let parentCounts = hierarchyJson.parentCounts;
  75279. let parentIds = hierarchyJson.parentIds;
  75280. let parentIdsLength = instancesLength;
  75281. if (defined_default(classIds.byteOffset)) {
  75282. classIds.componentType = defaultValue_default(
  75283. classIds.componentType,
  75284. ComponentDatatype_default.UNSIGNED_SHORT
  75285. );
  75286. classIds.type = AttributeType_default.SCALAR;
  75287. binaryAccessor = getBinaryAccessor_default(classIds);
  75288. classIds = binaryAccessor.createArrayBufferView(
  75289. binaryBody.buffer,
  75290. binaryBody.byteOffset + classIds.byteOffset,
  75291. instancesLength
  75292. );
  75293. }
  75294. let parentIndexes;
  75295. if (defined_default(parentCounts)) {
  75296. if (defined_default(parentCounts.byteOffset)) {
  75297. parentCounts.componentType = defaultValue_default(
  75298. parentCounts.componentType,
  75299. ComponentDatatype_default.UNSIGNED_SHORT
  75300. );
  75301. parentCounts.type = AttributeType_default.SCALAR;
  75302. binaryAccessor = getBinaryAccessor_default(parentCounts);
  75303. parentCounts = binaryAccessor.createArrayBufferView(
  75304. binaryBody.buffer,
  75305. binaryBody.byteOffset + parentCounts.byteOffset,
  75306. instancesLength
  75307. );
  75308. }
  75309. parentIndexes = new Uint16Array(instancesLength);
  75310. parentIdsLength = 0;
  75311. for (i2 = 0; i2 < instancesLength; ++i2) {
  75312. parentIndexes[i2] = parentIdsLength;
  75313. parentIdsLength += parentCounts[i2];
  75314. }
  75315. }
  75316. if (defined_default(parentIds) && defined_default(parentIds.byteOffset)) {
  75317. parentIds.componentType = defaultValue_default(
  75318. parentIds.componentType,
  75319. ComponentDatatype_default.UNSIGNED_SHORT
  75320. );
  75321. parentIds.type = AttributeType_default.SCALAR;
  75322. binaryAccessor = getBinaryAccessor_default(parentIds);
  75323. parentIds = binaryAccessor.createArrayBufferView(
  75324. binaryBody.buffer,
  75325. binaryBody.byteOffset + parentIds.byteOffset,
  75326. parentIdsLength
  75327. );
  75328. }
  75329. const classesLength = classes.length;
  75330. for (i2 = 0; i2 < classesLength; ++i2) {
  75331. const classInstancesLength = classes[i2].length;
  75332. const properties = classes[i2].instances;
  75333. const binaryProperties = getBinaryProperties(
  75334. classInstancesLength,
  75335. properties,
  75336. binaryBody
  75337. );
  75338. classes[i2].instances = combine_default(binaryProperties, properties);
  75339. }
  75340. const classCounts = arrayFill_default(new Array(classesLength), 0);
  75341. const classIndexes = new Uint16Array(instancesLength);
  75342. for (i2 = 0; i2 < instancesLength; ++i2) {
  75343. classId = classIds[i2];
  75344. classIndexes[i2] = classCounts[classId];
  75345. ++classCounts[classId];
  75346. }
  75347. hierarchy._classes = classes;
  75348. hierarchy._classIds = classIds;
  75349. hierarchy._classIndexes = classIndexes;
  75350. hierarchy._parentCounts = parentCounts;
  75351. hierarchy._parentIndexes = parentIndexes;
  75352. hierarchy._parentIds = parentIds;
  75353. }
  75354. function getBinaryProperties(featuresLength, properties, binaryBody) {
  75355. let binaryProperties;
  75356. for (const name in properties) {
  75357. if (properties.hasOwnProperty(name)) {
  75358. const property = properties[name];
  75359. const byteOffset = property.byteOffset;
  75360. if (defined_default(byteOffset)) {
  75361. const componentType = property.componentType;
  75362. const type = property.type;
  75363. if (!defined_default(componentType)) {
  75364. throw new RuntimeError_default("componentType is required.");
  75365. }
  75366. if (!defined_default(type)) {
  75367. throw new RuntimeError_default("type is required.");
  75368. }
  75369. if (!defined_default(binaryBody)) {
  75370. throw new RuntimeError_default(
  75371. `Property ${name} requires a batch table binary.`
  75372. );
  75373. }
  75374. const binaryAccessor = getBinaryAccessor_default(property);
  75375. const componentCount = binaryAccessor.componentsPerAttribute;
  75376. const classType = binaryAccessor.classType;
  75377. const typedArray = binaryAccessor.createArrayBufferView(
  75378. binaryBody.buffer,
  75379. binaryBody.byteOffset + byteOffset,
  75380. featuresLength
  75381. );
  75382. if (!defined_default(binaryProperties)) {
  75383. binaryProperties = {};
  75384. }
  75385. binaryProperties[name] = {
  75386. typedArray,
  75387. componentCount,
  75388. type: classType
  75389. };
  75390. }
  75391. }
  75392. }
  75393. return binaryProperties;
  75394. }
  75395. var scratchValidateStack = [];
  75396. function validateHierarchy(hierarchy) {
  75397. const stack = scratchValidateStack;
  75398. stack.length = 0;
  75399. const classIds = hierarchy._classIds;
  75400. const instancesLength = classIds.length;
  75401. for (let i2 = 0; i2 < instancesLength; ++i2) {
  75402. validateInstance(hierarchy, i2, stack);
  75403. }
  75404. }
  75405. function validateInstance(hierarchy, instanceIndex, stack) {
  75406. const parentCounts = hierarchy._parentCounts;
  75407. const parentIds = hierarchy._parentIds;
  75408. const parentIndexes = hierarchy._parentIndexes;
  75409. const classIds = hierarchy._classIds;
  75410. const instancesLength = classIds.length;
  75411. if (!defined_default(parentIds)) {
  75412. return;
  75413. }
  75414. if (instanceIndex >= instancesLength) {
  75415. throw new DeveloperError_default(
  75416. `Parent index ${instanceIndex} exceeds the total number of instances: ${instancesLength}`
  75417. );
  75418. }
  75419. if (stack.indexOf(instanceIndex) > -1) {
  75420. throw new DeveloperError_default(
  75421. "Circular dependency detected in the batch table hierarchy."
  75422. );
  75423. }
  75424. stack.push(instanceIndex);
  75425. const parentCount = defined_default(parentCounts) ? parentCounts[instanceIndex] : 1;
  75426. const parentIndex = defined_default(parentCounts) ? parentIndexes[instanceIndex] : instanceIndex;
  75427. for (let i2 = 0; i2 < parentCount; ++i2) {
  75428. const parentId = parentIds[parentIndex + i2];
  75429. if (parentId !== instanceIndex) {
  75430. validateInstance(hierarchy, parentId, stack);
  75431. }
  75432. }
  75433. stack.pop(instanceIndex);
  75434. }
  75435. var scratchVisited = [];
  75436. var scratchStack = [];
  75437. var marker = 0;
  75438. function traverseHierarchyMultipleParents(hierarchy, instanceIndex, endConditionCallback) {
  75439. const classIds = hierarchy._classIds;
  75440. const parentCounts = hierarchy._parentCounts;
  75441. const parentIds = hierarchy._parentIds;
  75442. const parentIndexes = hierarchy._parentIndexes;
  75443. const instancesLength = classIds.length;
  75444. const visited = scratchVisited;
  75445. visited.length = Math.max(visited.length, instancesLength);
  75446. const visitedMarker = ++marker;
  75447. const stack = scratchStack;
  75448. stack.length = 0;
  75449. stack.push(instanceIndex);
  75450. while (stack.length > 0) {
  75451. instanceIndex = stack.pop();
  75452. if (visited[instanceIndex] === visitedMarker) {
  75453. continue;
  75454. }
  75455. visited[instanceIndex] = visitedMarker;
  75456. const result = endConditionCallback(hierarchy, instanceIndex);
  75457. if (defined_default(result)) {
  75458. return result;
  75459. }
  75460. const parentCount = parentCounts[instanceIndex];
  75461. const parentIndex = parentIndexes[instanceIndex];
  75462. for (let i2 = 0; i2 < parentCount; ++i2) {
  75463. const parentId = parentIds[parentIndex + i2];
  75464. if (parentId !== instanceIndex) {
  75465. stack.push(parentId);
  75466. }
  75467. }
  75468. }
  75469. }
  75470. function traverseHierarchySingleParent(hierarchy, instanceIndex, endConditionCallback) {
  75471. let hasParent = true;
  75472. while (hasParent) {
  75473. const result = endConditionCallback(hierarchy, instanceIndex);
  75474. if (defined_default(result)) {
  75475. return result;
  75476. }
  75477. const parentId = hierarchy._parentIds[instanceIndex];
  75478. hasParent = parentId !== instanceIndex;
  75479. instanceIndex = parentId;
  75480. }
  75481. }
  75482. function traverseHierarchy(hierarchy, instanceIndex, endConditionCallback) {
  75483. const parentCounts = hierarchy._parentCounts;
  75484. const parentIds = hierarchy._parentIds;
  75485. if (!defined_default(parentIds)) {
  75486. return endConditionCallback(hierarchy, instanceIndex);
  75487. } else if (defined_default(parentCounts)) {
  75488. return traverseHierarchyMultipleParents(
  75489. hierarchy,
  75490. instanceIndex,
  75491. endConditionCallback
  75492. );
  75493. }
  75494. return traverseHierarchySingleParent(
  75495. hierarchy,
  75496. instanceIndex,
  75497. endConditionCallback
  75498. );
  75499. }
  75500. BatchTableHierarchy.prototype.hasProperty = function(batchId, propertyId) {
  75501. const result = traverseHierarchy(this, batchId, function(hierarchy, instanceIndex) {
  75502. const classId = hierarchy._classIds[instanceIndex];
  75503. const instances = hierarchy._classes[classId].instances;
  75504. if (defined_default(instances[propertyId])) {
  75505. return true;
  75506. }
  75507. });
  75508. return defined_default(result);
  75509. };
  75510. BatchTableHierarchy.prototype.propertyExists = function(propertyId) {
  75511. const classes = this._classes;
  75512. const classesLength = classes.length;
  75513. for (let i2 = 0; i2 < classesLength; ++i2) {
  75514. const instances = classes[i2].instances;
  75515. if (defined_default(instances[propertyId])) {
  75516. return true;
  75517. }
  75518. }
  75519. return false;
  75520. };
  75521. BatchTableHierarchy.prototype.getPropertyIds = function(batchId, results) {
  75522. results = defined_default(results) ? results : [];
  75523. results.length = 0;
  75524. traverseHierarchy(this, batchId, function(hierarchy, instanceIndex) {
  75525. const classId = hierarchy._classIds[instanceIndex];
  75526. const instances = hierarchy._classes[classId].instances;
  75527. for (const name in instances) {
  75528. if (instances.hasOwnProperty(name)) {
  75529. if (results.indexOf(name) === -1) {
  75530. results.push(name);
  75531. }
  75532. }
  75533. }
  75534. });
  75535. return results;
  75536. };
  75537. BatchTableHierarchy.prototype.getProperty = function(batchId, propertyId) {
  75538. return traverseHierarchy(this, batchId, function(hierarchy, instanceIndex) {
  75539. const classId = hierarchy._classIds[instanceIndex];
  75540. const instanceClass = hierarchy._classes[classId];
  75541. const indexInClass = hierarchy._classIndexes[instanceIndex];
  75542. const propertyValues = instanceClass.instances[propertyId];
  75543. if (defined_default(propertyValues)) {
  75544. if (defined_default(propertyValues.typedArray)) {
  75545. return getBinaryProperty(propertyValues, indexInClass);
  75546. }
  75547. return clone_default(propertyValues[indexInClass], true);
  75548. }
  75549. });
  75550. };
  75551. function getBinaryProperty(binaryProperty, index2) {
  75552. const typedArray = binaryProperty.typedArray;
  75553. const componentCount = binaryProperty.componentCount;
  75554. if (componentCount === 1) {
  75555. return typedArray[index2];
  75556. }
  75557. return binaryProperty.type.unpack(typedArray, index2 * componentCount);
  75558. }
  75559. BatchTableHierarchy.prototype.setProperty = function(batchId, propertyId, value) {
  75560. const result = traverseHierarchy(this, batchId, function(hierarchy, instanceIndex) {
  75561. const classId = hierarchy._classIds[instanceIndex];
  75562. const instanceClass = hierarchy._classes[classId];
  75563. const indexInClass = hierarchy._classIndexes[instanceIndex];
  75564. const propertyValues = instanceClass.instances[propertyId];
  75565. if (defined_default(propertyValues)) {
  75566. if (instanceIndex !== batchId) {
  75567. throw new DeveloperError_default(
  75568. `Inherited property "${propertyId}" is read-only.`
  75569. );
  75570. }
  75571. if (defined_default(propertyValues.typedArray)) {
  75572. setBinaryProperty(propertyValues, indexInClass, value);
  75573. } else {
  75574. propertyValues[indexInClass] = clone_default(value, true);
  75575. }
  75576. return true;
  75577. }
  75578. });
  75579. return defined_default(result);
  75580. };
  75581. function setBinaryProperty(binaryProperty, index2, value) {
  75582. const typedArray = binaryProperty.typedArray;
  75583. const componentCount = binaryProperty.componentCount;
  75584. if (componentCount === 1) {
  75585. typedArray[index2] = value;
  75586. } else {
  75587. binaryProperty.type.pack(value, typedArray, index2 * componentCount);
  75588. }
  75589. }
  75590. BatchTableHierarchy.prototype.isClass = function(batchId, className) {
  75591. const result = traverseHierarchy(this, batchId, function(hierarchy, instanceIndex) {
  75592. const classId = hierarchy._classIds[instanceIndex];
  75593. const instanceClass = hierarchy._classes[classId];
  75594. if (instanceClass.name === className) {
  75595. return true;
  75596. }
  75597. });
  75598. return defined_default(result);
  75599. };
  75600. BatchTableHierarchy.prototype.getClassName = function(batchId) {
  75601. const classId = this._classIds[batchId];
  75602. const instanceClass = this._classes[classId];
  75603. return instanceClass.name;
  75604. };
  75605. // node_modules/cesium/Source/Scene/Cesium3DTileColorBlendMode.js
  75606. var Cesium3DTileColorBlendMode = {
  75607. HIGHLIGHT: 0,
  75608. REPLACE: 1,
  75609. MIX: 2
  75610. };
  75611. var Cesium3DTileColorBlendMode_default = Object.freeze(Cesium3DTileColorBlendMode);
  75612. // node_modules/cesium/Source/Scene/Cesium3DTileBatchTable.js
  75613. var DEFAULT_COLOR_VALUE = BatchTexture.DEFAULT_COLOR_VALUE;
  75614. var DEFAULT_SHOW_VALUE = BatchTexture.DEFAULT_SHOW_VALUE;
  75615. function Cesium3DTileBatchTable(content, featuresLength, batchTableJson, batchTableBinary, colorChangedCallback) {
  75616. this.featuresLength = featuresLength;
  75617. let extensions;
  75618. if (defined_default(batchTableJson)) {
  75619. extensions = batchTableJson.extensions;
  75620. }
  75621. this._extensions = defaultValue_default(extensions, {});
  75622. const properties = initializeProperties(batchTableJson);
  75623. this._properties = properties;
  75624. this._batchTableHierarchy = initializeHierarchy(
  75625. this,
  75626. batchTableJson,
  75627. batchTableBinary
  75628. );
  75629. this._batchTableBinaryProperties = getBinaryProperties2(
  75630. featuresLength,
  75631. properties,
  75632. batchTableBinary
  75633. );
  75634. this._content = content;
  75635. this._batchTexture = new BatchTexture({
  75636. featuresLength,
  75637. colorChangedCallback,
  75638. owner: content,
  75639. statistics: content.tileset.statistics
  75640. });
  75641. }
  75642. Cesium3DTileBatchTable._deprecationWarning = deprecationWarning_default;
  75643. Object.defineProperties(Cesium3DTileBatchTable.prototype, {
  75644. memorySizeInBytes: {
  75645. get: function() {
  75646. return this._batchTexture.memorySizeInBytes;
  75647. }
  75648. }
  75649. });
  75650. function initializeProperties(jsonHeader) {
  75651. const properties = {};
  75652. if (!defined_default(jsonHeader)) {
  75653. return properties;
  75654. }
  75655. for (const propertyName in jsonHeader) {
  75656. if (jsonHeader.hasOwnProperty(propertyName) && propertyName !== "HIERARCHY" && propertyName !== "extensions" && propertyName !== "extras") {
  75657. properties[propertyName] = clone_default(jsonHeader[propertyName], true);
  75658. }
  75659. }
  75660. return properties;
  75661. }
  75662. function initializeHierarchy(batchTable, jsonHeader, binaryBody) {
  75663. if (!defined_default(jsonHeader)) {
  75664. return;
  75665. }
  75666. let hierarchy = batchTable._extensions["3DTILES_batch_table_hierarchy"];
  75667. const legacyHierarchy = jsonHeader.HIERARCHY;
  75668. if (defined_default(legacyHierarchy)) {
  75669. Cesium3DTileBatchTable._deprecationWarning(
  75670. "batchTableHierarchyExtension",
  75671. "The batch table HIERARCHY property has been moved to an extension. Use extensions.3DTILES_batch_table_hierarchy instead."
  75672. );
  75673. batchTable._extensions["3DTILES_batch_table_hierarchy"] = legacyHierarchy;
  75674. hierarchy = legacyHierarchy;
  75675. }
  75676. if (!defined_default(hierarchy)) {
  75677. return;
  75678. }
  75679. return new BatchTableHierarchy({
  75680. extension: hierarchy,
  75681. binaryBody
  75682. });
  75683. }
  75684. function getBinaryProperties2(featuresLength, properties, binaryBody) {
  75685. let binaryProperties;
  75686. for (const name in properties) {
  75687. if (properties.hasOwnProperty(name)) {
  75688. const property = properties[name];
  75689. const byteOffset = property.byteOffset;
  75690. if (defined_default(byteOffset)) {
  75691. const componentType = property.componentType;
  75692. const type = property.type;
  75693. if (!defined_default(componentType)) {
  75694. throw new RuntimeError_default("componentType is required.");
  75695. }
  75696. if (!defined_default(type)) {
  75697. throw new RuntimeError_default("type is required.");
  75698. }
  75699. if (!defined_default(binaryBody)) {
  75700. throw new RuntimeError_default(
  75701. `Property ${name} requires a batch table binary.`
  75702. );
  75703. }
  75704. const binaryAccessor = getBinaryAccessor_default(property);
  75705. const componentCount = binaryAccessor.componentsPerAttribute;
  75706. const classType = binaryAccessor.classType;
  75707. const typedArray = binaryAccessor.createArrayBufferView(
  75708. binaryBody.buffer,
  75709. binaryBody.byteOffset + byteOffset,
  75710. featuresLength
  75711. );
  75712. if (!defined_default(binaryProperties)) {
  75713. binaryProperties = {};
  75714. }
  75715. binaryProperties[name] = {
  75716. typedArray,
  75717. componentCount,
  75718. type: classType
  75719. };
  75720. }
  75721. }
  75722. }
  75723. return binaryProperties;
  75724. }
  75725. Cesium3DTileBatchTable.getBinaryProperties = function(featuresLength, batchTableJson, batchTableBinary) {
  75726. return getBinaryProperties2(featuresLength, batchTableJson, batchTableBinary);
  75727. };
  75728. Cesium3DTileBatchTable.prototype.setShow = function(batchId, show) {
  75729. this._batchTexture.setShow(batchId, show);
  75730. };
  75731. Cesium3DTileBatchTable.prototype.setAllShow = function(show) {
  75732. this._batchTexture.setAllShow(show);
  75733. };
  75734. Cesium3DTileBatchTable.prototype.getShow = function(batchId) {
  75735. return this._batchTexture.getShow(batchId);
  75736. };
  75737. Cesium3DTileBatchTable.prototype.setColor = function(batchId, color) {
  75738. this._batchTexture.setColor(batchId, color);
  75739. };
  75740. Cesium3DTileBatchTable.prototype.setAllColor = function(color) {
  75741. this._batchTexture.setAllColor(color);
  75742. };
  75743. Cesium3DTileBatchTable.prototype.getColor = function(batchId, result) {
  75744. return this._batchTexture.getColor(batchId, result);
  75745. };
  75746. Cesium3DTileBatchTable.prototype.getPickColor = function(batchId) {
  75747. return this._batchTexture.getPickColor(batchId);
  75748. };
  75749. var scratchColor2 = new Color_default();
  75750. Cesium3DTileBatchTable.prototype.applyStyle = function(style) {
  75751. if (!defined_default(style)) {
  75752. this.setAllColor(DEFAULT_COLOR_VALUE);
  75753. this.setAllShow(DEFAULT_SHOW_VALUE);
  75754. return;
  75755. }
  75756. const content = this._content;
  75757. const length3 = this.featuresLength;
  75758. for (let i2 = 0; i2 < length3; ++i2) {
  75759. const feature2 = content.getFeature(i2);
  75760. const color = defined_default(style.color) ? defaultValue_default(
  75761. style.color.evaluateColor(feature2, scratchColor2),
  75762. DEFAULT_COLOR_VALUE
  75763. ) : DEFAULT_COLOR_VALUE;
  75764. const show = defined_default(style.show) ? defaultValue_default(style.show.evaluate(feature2), DEFAULT_SHOW_VALUE) : DEFAULT_SHOW_VALUE;
  75765. this.setColor(i2, color);
  75766. this.setShow(i2, show);
  75767. }
  75768. };
  75769. function getBinaryProperty2(binaryProperty, index2) {
  75770. const typedArray = binaryProperty.typedArray;
  75771. const componentCount = binaryProperty.componentCount;
  75772. if (componentCount === 1) {
  75773. return typedArray[index2];
  75774. }
  75775. return binaryProperty.type.unpack(typedArray, index2 * componentCount);
  75776. }
  75777. function setBinaryProperty2(binaryProperty, index2, value) {
  75778. const typedArray = binaryProperty.typedArray;
  75779. const componentCount = binaryProperty.componentCount;
  75780. if (componentCount === 1) {
  75781. typedArray[index2] = value;
  75782. } else {
  75783. binaryProperty.type.pack(value, typedArray, index2 * componentCount);
  75784. }
  75785. }
  75786. function checkBatchId2(batchId, featuresLength) {
  75787. if (!defined_default(batchId) || batchId < 0 || batchId >= featuresLength) {
  75788. throw new DeveloperError_default(
  75789. `batchId is required and between zero and featuresLength - 1 (${featuresLength}` - +")."
  75790. );
  75791. }
  75792. }
  75793. Cesium3DTileBatchTable.prototype.isClass = function(batchId, className) {
  75794. checkBatchId2(batchId, this.featuresLength);
  75795. Check_default.typeOf.string("className", className);
  75796. const hierarchy = this._batchTableHierarchy;
  75797. if (!defined_default(hierarchy)) {
  75798. return false;
  75799. }
  75800. return hierarchy.isClass(batchId, className);
  75801. };
  75802. Cesium3DTileBatchTable.prototype.isExactClass = function(batchId, className) {
  75803. Check_default.typeOf.string("className", className);
  75804. return this.getExactClassName(batchId) === className;
  75805. };
  75806. Cesium3DTileBatchTable.prototype.getExactClassName = function(batchId) {
  75807. checkBatchId2(batchId, this.featuresLength);
  75808. const hierarchy = this._batchTableHierarchy;
  75809. if (!defined_default(hierarchy)) {
  75810. return void 0;
  75811. }
  75812. return hierarchy.getClassName(batchId);
  75813. };
  75814. Cesium3DTileBatchTable.prototype.hasProperty = function(batchId, name) {
  75815. checkBatchId2(batchId, this.featuresLength);
  75816. Check_default.typeOf.string("name", name);
  75817. return defined_default(this._properties[name]) || defined_default(this._batchTableHierarchy) && this._batchTableHierarchy.hasProperty(batchId, name);
  75818. };
  75819. Cesium3DTileBatchTable.prototype.hasPropertyBySemantic = function() {
  75820. return false;
  75821. };
  75822. Cesium3DTileBatchTable.prototype.getPropertyNames = function(batchId, results) {
  75823. checkBatchId2(batchId, this.featuresLength);
  75824. results = defined_default(results) ? results : [];
  75825. results.length = 0;
  75826. const scratchPropertyNames = Object.keys(this._properties);
  75827. results.push.apply(results, scratchPropertyNames);
  75828. if (defined_default(this._batchTableHierarchy)) {
  75829. results.push.apply(
  75830. results,
  75831. this._batchTableHierarchy.getPropertyIds(batchId, scratchPropertyNames)
  75832. );
  75833. }
  75834. return results;
  75835. };
  75836. Cesium3DTileBatchTable.prototype.getPropertyBySemantic = function(batchId, name) {
  75837. return void 0;
  75838. };
  75839. Cesium3DTileBatchTable.prototype.getProperty = function(batchId, name) {
  75840. checkBatchId2(batchId, this.featuresLength);
  75841. Check_default.typeOf.string("name", name);
  75842. if (defined_default(this._batchTableBinaryProperties)) {
  75843. const binaryProperty = this._batchTableBinaryProperties[name];
  75844. if (defined_default(binaryProperty)) {
  75845. return getBinaryProperty2(binaryProperty, batchId);
  75846. }
  75847. }
  75848. const propertyValues = this._properties[name];
  75849. if (defined_default(propertyValues)) {
  75850. return clone_default(propertyValues[batchId], true);
  75851. }
  75852. if (defined_default(this._batchTableHierarchy)) {
  75853. const hierarchyProperty = this._batchTableHierarchy.getProperty(
  75854. batchId,
  75855. name
  75856. );
  75857. if (defined_default(hierarchyProperty)) {
  75858. return hierarchyProperty;
  75859. }
  75860. }
  75861. return void 0;
  75862. };
  75863. Cesium3DTileBatchTable.prototype.setProperty = function(batchId, name, value) {
  75864. const featuresLength = this.featuresLength;
  75865. checkBatchId2(batchId, featuresLength);
  75866. Check_default.typeOf.string("name", name);
  75867. if (defined_default(this._batchTableBinaryProperties)) {
  75868. const binaryProperty = this._batchTableBinaryProperties[name];
  75869. if (defined_default(binaryProperty)) {
  75870. setBinaryProperty2(binaryProperty, batchId, value);
  75871. return;
  75872. }
  75873. }
  75874. if (defined_default(this._batchTableHierarchy)) {
  75875. if (this._batchTableHierarchy.setProperty(batchId, name, value)) {
  75876. return;
  75877. }
  75878. }
  75879. let propertyValues = this._properties[name];
  75880. if (!defined_default(propertyValues)) {
  75881. this._properties[name] = new Array(featuresLength);
  75882. propertyValues = this._properties[name];
  75883. }
  75884. propertyValues[batchId] = clone_default(value, true);
  75885. };
  75886. function getGlslComputeSt2(batchTable) {
  75887. if (batchTable._batchTexture.textureDimensions.y === 1) {
  75888. return "uniform vec4 tile_textureStep; \nvec2 computeSt(float batchId) \n{ \n float stepX = tile_textureStep.x; \n float centerX = tile_textureStep.y; \n return vec2(centerX + (batchId * stepX), 0.5); \n} \n";
  75889. }
  75890. return "uniform vec4 tile_textureStep; \nuniform vec2 tile_textureDimensions; \nvec2 computeSt(float batchId) \n{ \n float stepX = tile_textureStep.x; \n float centerX = tile_textureStep.y; \n float stepY = tile_textureStep.z; \n float centerY = tile_textureStep.w; \n float xId = mod(batchId, tile_textureDimensions.x); \n float yId = floor(batchId / tile_textureDimensions.x); \n return vec2(centerX + (xId * stepX), centerY + (yId * stepY)); \n} \n";
  75891. }
  75892. Cesium3DTileBatchTable.prototype.getVertexShaderCallback = function(handleTranslucent, batchIdAttributeName, diffuseAttributeOrUniformName) {
  75893. if (this.featuresLength === 0) {
  75894. return;
  75895. }
  75896. const that = this;
  75897. return function(source) {
  75898. const renamedSource = modifyDiffuse(
  75899. source,
  75900. diffuseAttributeOrUniformName,
  75901. false
  75902. );
  75903. let newMain;
  75904. if (ContextLimits_default.maximumVertexTextureImageUnits > 0) {
  75905. newMain = "";
  75906. if (handleTranslucent) {
  75907. newMain += "uniform bool tile_translucentCommand; \n";
  75908. }
  75909. newMain += `${"uniform sampler2D tile_batchTexture; \nvarying vec4 tile_featureColor; \nvarying vec2 tile_featureSt; \nvoid main() \n{ \n vec2 st = computeSt("}${batchIdAttributeName});
  75910. vec4 featureProperties = texture2D(tile_batchTexture, st);
  75911. tile_color(featureProperties);
  75912. float show = ceil(featureProperties.a);
  75913. gl_Position *= show;
  75914. `;
  75915. if (handleTranslucent) {
  75916. newMain += " bool isStyleTranslucent = (featureProperties.a != 1.0); \n if (czm_pass == czm_passTranslucent) \n { \n if (!isStyleTranslucent && !tile_translucentCommand) \n { \n gl_Position *= 0.0; \n } \n } \n else \n { \n if (isStyleTranslucent) \n { \n gl_Position *= 0.0; \n } \n } \n";
  75917. }
  75918. newMain += " tile_featureColor = featureProperties; \n tile_featureSt = st; \n}";
  75919. } else {
  75920. newMain = `${"varying vec2 tile_featureSt; \nvoid main() \n{ \n tile_color(vec4(1.0)); \n tile_featureSt = computeSt("}${batchIdAttributeName});
  75921. }`;
  75922. }
  75923. return `${renamedSource}
  75924. ${getGlslComputeSt2(that)}${newMain}`;
  75925. };
  75926. };
  75927. function getDefaultShader(source, applyHighlight) {
  75928. source = ShaderSource_default.replaceMain(source, "tile_main");
  75929. if (!applyHighlight) {
  75930. return `${source}void tile_color(vec4 tile_featureColor)
  75931. {
  75932. tile_main();
  75933. }
  75934. `;
  75935. }
  75936. return `${source}uniform float tile_colorBlend;
  75937. void tile_color(vec4 tile_featureColor)
  75938. {
  75939. tile_main();
  75940. tile_featureColor = czm_gammaCorrect(tile_featureColor);
  75941. gl_FragColor.a *= tile_featureColor.a;
  75942. float highlight = ceil(tile_colorBlend);
  75943. gl_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight);
  75944. }
  75945. `;
  75946. }
  75947. function replaceDiffuseTextureCalls(source, diffuseAttributeOrUniformName) {
  75948. const functionCall = `texture2D(${diffuseAttributeOrUniformName}`;
  75949. let fromIndex = 0;
  75950. let startIndex = source.indexOf(functionCall, fromIndex);
  75951. let endIndex;
  75952. while (startIndex > -1) {
  75953. let nestedLevel = 0;
  75954. for (let i2 = startIndex; i2 < source.length; ++i2) {
  75955. const character = source.charAt(i2);
  75956. if (character === "(") {
  75957. ++nestedLevel;
  75958. } else if (character === ")") {
  75959. --nestedLevel;
  75960. if (nestedLevel === 0) {
  75961. endIndex = i2 + 1;
  75962. break;
  75963. }
  75964. }
  75965. }
  75966. const extractedFunction = source.slice(startIndex, endIndex);
  75967. const replacedFunction = `tile_diffuse_final(${extractedFunction}, tile_diffuse)`;
  75968. source = source.slice(0, startIndex) + replacedFunction + source.slice(endIndex);
  75969. fromIndex = startIndex + replacedFunction.length;
  75970. startIndex = source.indexOf(functionCall, fromIndex);
  75971. }
  75972. return source;
  75973. }
  75974. function modifyDiffuse(source, diffuseAttributeOrUniformName, applyHighlight) {
  75975. if (!defined_default(diffuseAttributeOrUniformName)) {
  75976. return getDefaultShader(source, applyHighlight);
  75977. }
  75978. let regex = new RegExp(
  75979. `(uniform|attribute|in)\\s+(vec[34]|sampler2D)\\s+${diffuseAttributeOrUniformName};`
  75980. );
  75981. const uniformMatch = source.match(regex);
  75982. if (!defined_default(uniformMatch)) {
  75983. return getDefaultShader(source, applyHighlight);
  75984. }
  75985. const declaration = uniformMatch[0];
  75986. const type = uniformMatch[2];
  75987. source = ShaderSource_default.replaceMain(source, "tile_main");
  75988. source = source.replace(declaration, "");
  75989. const finalDiffuseFunction = "bool isWhite(vec3 color) \n{ \n return all(greaterThan(color, vec3(1.0 - czm_epsilon3))); \n} \nvec4 tile_diffuse_final(vec4 sourceDiffuse, vec4 tileDiffuse) \n{ \n vec4 blendDiffuse = mix(sourceDiffuse, tileDiffuse, tile_colorBlend); \n vec4 diffuse = isWhite(tileDiffuse.rgb) ? sourceDiffuse : blendDiffuse; \n return vec4(diffuse.rgb, sourceDiffuse.a); \n} \n";
  75990. const highlight = " tile_featureColor = czm_gammaCorrect(tile_featureColor); \n gl_FragColor.a *= tile_featureColor.a; \n float highlight = ceil(tile_colorBlend); \n gl_FragColor.rgb *= mix(tile_featureColor.rgb, vec3(1.0), highlight); \n";
  75991. let setColor;
  75992. if (type === "vec3" || type === "vec4") {
  75993. const sourceDiffuse = type === "vec3" ? `vec4(${diffuseAttributeOrUniformName}, 1.0)` : diffuseAttributeOrUniformName;
  75994. const replaceDiffuse = type === "vec3" ? "tile_diffuse.xyz" : "tile_diffuse";
  75995. regex = new RegExp(diffuseAttributeOrUniformName, "g");
  75996. source = source.replace(regex, replaceDiffuse);
  75997. setColor = ` vec4 source = ${sourceDiffuse};
  75998. tile_diffuse = tile_diffuse_final(source, tile_featureColor);
  75999. tile_main();
  76000. `;
  76001. } else if (type === "sampler2D") {
  76002. source = replaceDiffuseTextureCalls(source, diffuseAttributeOrUniformName);
  76003. setColor = " tile_diffuse = tile_featureColor; \n tile_main(); \n";
  76004. }
  76005. source = `${"uniform float tile_colorBlend; \nvec4 tile_diffuse = vec4(1.0); \n"}${finalDiffuseFunction}${declaration}
  76006. ${source}
  76007. void tile_color(vec4 tile_featureColor)
  76008. {
  76009. ${setColor}`;
  76010. if (applyHighlight) {
  76011. source += highlight;
  76012. }
  76013. source += "} \n";
  76014. return source;
  76015. }
  76016. Cesium3DTileBatchTable.prototype.getFragmentShaderCallback = function(handleTranslucent, diffuseAttributeOrUniformName, hasPremultipliedAlpha) {
  76017. if (this.featuresLength === 0) {
  76018. return;
  76019. }
  76020. return function(source) {
  76021. source = modifyDiffuse(source, diffuseAttributeOrUniformName, true);
  76022. if (ContextLimits_default.maximumVertexTextureImageUnits > 0) {
  76023. source += "uniform sampler2D tile_pickTexture; \nvarying vec2 tile_featureSt; \nvarying vec4 tile_featureColor; \nvoid main() \n{ \n tile_color(tile_featureColor); \n";
  76024. if (hasPremultipliedAlpha) {
  76025. source += " gl_FragColor.rgb *= gl_FragColor.a; \n";
  76026. }
  76027. source += "}";
  76028. } else {
  76029. if (handleTranslucent) {
  76030. source += "uniform bool tile_translucentCommand; \n";
  76031. }
  76032. source += "uniform sampler2D tile_pickTexture; \nuniform sampler2D tile_batchTexture; \nvarying vec2 tile_featureSt; \nvoid main() \n{ \n vec4 featureProperties = texture2D(tile_batchTexture, tile_featureSt); \n if (featureProperties.a == 0.0) { \n discard; \n } \n";
  76033. if (handleTranslucent) {
  76034. source += " bool isStyleTranslucent = (featureProperties.a != 1.0); \n if (czm_pass == czm_passTranslucent) \n { \n if (!isStyleTranslucent && !tile_translucentCommand) \n { \n discard; \n } \n } \n else \n { \n if (isStyleTranslucent) \n { \n discard; \n } \n } \n";
  76035. }
  76036. source += " tile_color(featureProperties); \n";
  76037. if (hasPremultipliedAlpha) {
  76038. source += " gl_FragColor.rgb *= gl_FragColor.a; \n";
  76039. }
  76040. source += "} \n";
  76041. }
  76042. return source;
  76043. };
  76044. };
  76045. Cesium3DTileBatchTable.prototype.getClassificationFragmentShaderCallback = function() {
  76046. if (this.featuresLength === 0) {
  76047. return;
  76048. }
  76049. return function(source) {
  76050. source = ShaderSource_default.replaceMain(source, "tile_main");
  76051. if (ContextLimits_default.maximumVertexTextureImageUnits > 0) {
  76052. source += "uniform sampler2D tile_pickTexture;\nvarying vec2 tile_featureSt; \nvarying vec4 tile_featureColor; \nvoid main() \n{ \n tile_main(); \n gl_FragColor = tile_featureColor; \n gl_FragColor.rgb *= gl_FragColor.a; \n}";
  76053. } else {
  76054. source += "uniform sampler2D tile_batchTexture; \nuniform sampler2D tile_pickTexture;\nvarying vec2 tile_featureSt; \nvoid main() \n{ \n tile_main(); \n vec4 featureProperties = texture2D(tile_batchTexture, tile_featureSt); \n if (featureProperties.a == 0.0) { \n discard; \n } \n gl_FragColor = featureProperties; \n gl_FragColor.rgb *= gl_FragColor.a; \n} \n";
  76055. }
  76056. return source;
  76057. };
  76058. };
  76059. function getColorBlend(batchTable) {
  76060. const tileset = batchTable._content.tileset;
  76061. const colorBlendMode = tileset.colorBlendMode;
  76062. const colorBlendAmount = tileset.colorBlendAmount;
  76063. if (colorBlendMode === Cesium3DTileColorBlendMode_default.HIGHLIGHT) {
  76064. return 0;
  76065. }
  76066. if (colorBlendMode === Cesium3DTileColorBlendMode_default.REPLACE) {
  76067. return 1;
  76068. }
  76069. if (colorBlendMode === Cesium3DTileColorBlendMode_default.MIX) {
  76070. return Math_default.clamp(colorBlendAmount, Math_default.EPSILON4, 1);
  76071. }
  76072. throw new DeveloperError_default(`Invalid color blend mode "${colorBlendMode}".`);
  76073. }
  76074. Cesium3DTileBatchTable.prototype.getUniformMapCallback = function() {
  76075. if (this.featuresLength === 0) {
  76076. return;
  76077. }
  76078. const that = this;
  76079. return function(uniformMap2) {
  76080. const batchUniformMap = {
  76081. tile_batchTexture: function() {
  76082. return defaultValue_default(
  76083. that._batchTexture.batchTexture,
  76084. that._batchTexture.defaultTexture
  76085. );
  76086. },
  76087. tile_textureDimensions: function() {
  76088. return that._batchTexture.textureDimensions;
  76089. },
  76090. tile_textureStep: function() {
  76091. return that._batchTexture.textureStep;
  76092. },
  76093. tile_colorBlend: function() {
  76094. return getColorBlend(that);
  76095. },
  76096. tile_pickTexture: function() {
  76097. return that._batchTexture.pickTexture;
  76098. }
  76099. };
  76100. return combine_default(uniformMap2, batchUniformMap);
  76101. };
  76102. };
  76103. Cesium3DTileBatchTable.prototype.getPickId = function() {
  76104. return "texture2D(tile_pickTexture, tile_featureSt)";
  76105. };
  76106. var StyleCommandsNeeded = {
  76107. ALL_OPAQUE: 0,
  76108. ALL_TRANSLUCENT: 1,
  76109. OPAQUE_AND_TRANSLUCENT: 2
  76110. };
  76111. Cesium3DTileBatchTable.prototype.addDerivedCommands = function(frameState, commandStart) {
  76112. const commandList = frameState.commandList;
  76113. const commandEnd = commandList.length;
  76114. const tile = this._content._tile;
  76115. const finalResolution = tile._finalResolution;
  76116. const tileset = tile.tileset;
  76117. const bivariateVisibilityTest = tileset._skipLevelOfDetail && tileset._hasMixedContent && frameState.context.stencilBuffer;
  76118. const styleCommandsNeeded = getStyleCommandsNeeded(this);
  76119. for (let i2 = commandStart; i2 < commandEnd; ++i2) {
  76120. const command = commandList[i2];
  76121. if (command.pass === Pass_default.COMPUTE) {
  76122. continue;
  76123. }
  76124. let derivedCommands = command.derivedCommands.tileset;
  76125. if (!defined_default(derivedCommands) || command.dirty) {
  76126. derivedCommands = {};
  76127. command.derivedCommands.tileset = derivedCommands;
  76128. derivedCommands.originalCommand = deriveCommand(command);
  76129. command.dirty = false;
  76130. }
  76131. const originalCommand = derivedCommands.originalCommand;
  76132. if (styleCommandsNeeded !== StyleCommandsNeeded.ALL_OPAQUE && command.pass !== Pass_default.TRANSLUCENT) {
  76133. if (!defined_default(derivedCommands.translucent)) {
  76134. derivedCommands.translucent = deriveTranslucentCommand(originalCommand);
  76135. }
  76136. }
  76137. if (styleCommandsNeeded !== StyleCommandsNeeded.ALL_TRANSLUCENT && command.pass !== Pass_default.TRANSLUCENT) {
  76138. if (!defined_default(derivedCommands.opaque)) {
  76139. derivedCommands.opaque = deriveOpaqueCommand(originalCommand);
  76140. }
  76141. if (bivariateVisibilityTest) {
  76142. if (!finalResolution) {
  76143. if (!defined_default(derivedCommands.zback)) {
  76144. derivedCommands.zback = deriveZBackfaceCommand(
  76145. frameState.context,
  76146. originalCommand
  76147. );
  76148. }
  76149. tileset._backfaceCommands.push(derivedCommands.zback);
  76150. }
  76151. if (!defined_default(derivedCommands.stencil) || tile._selectionDepth !== getLastSelectionDepth(derivedCommands.stencil)) {
  76152. if (command.renderState.depthMask) {
  76153. derivedCommands.stencil = deriveStencilCommand(
  76154. originalCommand,
  76155. tile._selectionDepth
  76156. );
  76157. } else {
  76158. derivedCommands.stencil = derivedCommands.opaque;
  76159. }
  76160. }
  76161. }
  76162. }
  76163. const opaqueCommand = bivariateVisibilityTest ? derivedCommands.stencil : derivedCommands.opaque;
  76164. const translucentCommand = derivedCommands.translucent;
  76165. if (command.pass !== Pass_default.TRANSLUCENT) {
  76166. if (styleCommandsNeeded === StyleCommandsNeeded.ALL_OPAQUE) {
  76167. commandList[i2] = opaqueCommand;
  76168. }
  76169. if (styleCommandsNeeded === StyleCommandsNeeded.ALL_TRANSLUCENT) {
  76170. commandList[i2] = translucentCommand;
  76171. }
  76172. if (styleCommandsNeeded === StyleCommandsNeeded.OPAQUE_AND_TRANSLUCENT) {
  76173. commandList[i2] = opaqueCommand;
  76174. commandList.push(translucentCommand);
  76175. }
  76176. } else {
  76177. commandList[i2] = originalCommand;
  76178. }
  76179. }
  76180. };
  76181. function getStyleCommandsNeeded(batchTable) {
  76182. const translucentFeaturesLength = batchTable._batchTexture.translucentFeaturesLength;
  76183. if (translucentFeaturesLength === 0) {
  76184. return StyleCommandsNeeded.ALL_OPAQUE;
  76185. } else if (translucentFeaturesLength === batchTable.featuresLength) {
  76186. return StyleCommandsNeeded.ALL_TRANSLUCENT;
  76187. }
  76188. return StyleCommandsNeeded.OPAQUE_AND_TRANSLUCENT;
  76189. }
  76190. function deriveCommand(command) {
  76191. const derivedCommand = DrawCommand_default.shallowClone(command);
  76192. const translucentCommand = derivedCommand.pass === Pass_default.TRANSLUCENT;
  76193. derivedCommand.uniformMap = defined_default(derivedCommand.uniformMap) ? derivedCommand.uniformMap : {};
  76194. derivedCommand.uniformMap.tile_translucentCommand = function() {
  76195. return translucentCommand;
  76196. };
  76197. return derivedCommand;
  76198. }
  76199. function deriveTranslucentCommand(command) {
  76200. const derivedCommand = DrawCommand_default.shallowClone(command);
  76201. derivedCommand.pass = Pass_default.TRANSLUCENT;
  76202. derivedCommand.renderState = getTranslucentRenderState(command.renderState);
  76203. return derivedCommand;
  76204. }
  76205. function deriveOpaqueCommand(command) {
  76206. const derivedCommand = DrawCommand_default.shallowClone(command);
  76207. derivedCommand.renderState = getOpaqueRenderState(command.renderState);
  76208. return derivedCommand;
  76209. }
  76210. function getLogDepthPolygonOffsetFragmentShaderProgram(context, shaderProgram) {
  76211. let shader = context.shaderCache.getDerivedShaderProgram(
  76212. shaderProgram,
  76213. "zBackfaceLogDepth"
  76214. );
  76215. if (!defined_default(shader)) {
  76216. const fs = shaderProgram.fragmentShaderSource.clone();
  76217. fs.defines = defined_default(fs.defines) ? fs.defines.slice(0) : [];
  76218. fs.defines.push("POLYGON_OFFSET");
  76219. fs.sources.unshift(
  76220. "#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\n"
  76221. );
  76222. shader = context.shaderCache.createDerivedShaderProgram(
  76223. shaderProgram,
  76224. "zBackfaceLogDepth",
  76225. {
  76226. vertexShaderSource: shaderProgram.vertexShaderSource,
  76227. fragmentShaderSource: fs,
  76228. attributeLocations: shaderProgram._attributeLocations
  76229. }
  76230. );
  76231. }
  76232. return shader;
  76233. }
  76234. function deriveZBackfaceCommand(context, command) {
  76235. const derivedCommand = DrawCommand_default.shallowClone(command);
  76236. const rs = clone_default(derivedCommand.renderState, true);
  76237. rs.cull.enabled = true;
  76238. rs.cull.face = CullFace_default.FRONT;
  76239. rs.colorMask = {
  76240. red: false,
  76241. green: false,
  76242. blue: false,
  76243. alpha: false
  76244. };
  76245. rs.polygonOffset = {
  76246. enabled: true,
  76247. factor: 5,
  76248. units: 5
  76249. };
  76250. rs.stencilTest = StencilConstants_default.setCesium3DTileBit();
  76251. rs.stencilMask = StencilConstants_default.CESIUM_3D_TILE_MASK;
  76252. derivedCommand.renderState = RenderState_default.fromCache(rs);
  76253. derivedCommand.castShadows = false;
  76254. derivedCommand.receiveShadows = false;
  76255. derivedCommand.uniformMap = clone_default(command.uniformMap);
  76256. const polygonOffset = new Cartesian2_default(5, 5);
  76257. derivedCommand.uniformMap.u_polygonOffset = function() {
  76258. return polygonOffset;
  76259. };
  76260. derivedCommand.shaderProgram = getLogDepthPolygonOffsetFragmentShaderProgram(
  76261. context,
  76262. command.shaderProgram
  76263. );
  76264. return derivedCommand;
  76265. }
  76266. function deriveStencilCommand(command, reference) {
  76267. const derivedCommand = DrawCommand_default.shallowClone(command);
  76268. const rs = clone_default(derivedCommand.renderState, true);
  76269. rs.stencilTest.enabled = true;
  76270. rs.stencilTest.mask = StencilConstants_default.SKIP_LOD_MASK;
  76271. rs.stencilTest.reference = StencilConstants_default.CESIUM_3D_TILE_MASK | reference << StencilConstants_default.SKIP_LOD_BIT_SHIFT;
  76272. rs.stencilTest.frontFunction = StencilFunction_default.GREATER_OR_EQUAL;
  76273. rs.stencilTest.frontOperation.zPass = StencilOperation_default.REPLACE;
  76274. rs.stencilTest.backFunction = StencilFunction_default.GREATER_OR_EQUAL;
  76275. rs.stencilTest.backOperation.zPass = StencilOperation_default.REPLACE;
  76276. rs.stencilMask = StencilConstants_default.CESIUM_3D_TILE_MASK | StencilConstants_default.SKIP_LOD_MASK;
  76277. derivedCommand.renderState = RenderState_default.fromCache(rs);
  76278. return derivedCommand;
  76279. }
  76280. function getLastSelectionDepth(stencilCommand) {
  76281. const reference = stencilCommand.renderState.stencilTest.reference;
  76282. return (reference & StencilConstants_default.SKIP_LOD_MASK) >>> StencilConstants_default.SKIP_LOD_BIT_SHIFT;
  76283. }
  76284. function getTranslucentRenderState(renderState) {
  76285. const rs = clone_default(renderState, true);
  76286. rs.cull.enabled = false;
  76287. rs.depthTest.enabled = true;
  76288. rs.depthMask = false;
  76289. rs.blending = BlendingState_default.ALPHA_BLEND;
  76290. rs.stencilTest = StencilConstants_default.setCesium3DTileBit();
  76291. rs.stencilMask = StencilConstants_default.CESIUM_3D_TILE_MASK;
  76292. return RenderState_default.fromCache(rs);
  76293. }
  76294. function getOpaqueRenderState(renderState) {
  76295. const rs = clone_default(renderState, true);
  76296. rs.stencilTest = StencilConstants_default.setCesium3DTileBit();
  76297. rs.stencilMask = StencilConstants_default.CESIUM_3D_TILE_MASK;
  76298. return RenderState_default.fromCache(rs);
  76299. }
  76300. Cesium3DTileBatchTable.prototype.update = function(tileset, frameState) {
  76301. this._batchTexture.update(tileset, frameState);
  76302. };
  76303. Cesium3DTileBatchTable.prototype.isDestroyed = function() {
  76304. return false;
  76305. };
  76306. Cesium3DTileBatchTable.prototype.destroy = function() {
  76307. this._batchTexture = this._batchTexture && this._batchTexture.destroy();
  76308. return destroyObject_default(this);
  76309. };
  76310. var Cesium3DTileBatchTable_default = Cesium3DTileBatchTable;
  76311. // node_modules/cesium/Source/Scene/Cesium3DTileFeature.js
  76312. function Cesium3DTileFeature(content, batchId) {
  76313. this._content = content;
  76314. this._batchId = batchId;
  76315. this._color = void 0;
  76316. }
  76317. Object.defineProperties(Cesium3DTileFeature.prototype, {
  76318. show: {
  76319. get: function() {
  76320. return this._content.batchTable.getShow(this._batchId);
  76321. },
  76322. set: function(value) {
  76323. this._content.batchTable.setShow(this._batchId, value);
  76324. }
  76325. },
  76326. color: {
  76327. get: function() {
  76328. if (!defined_default(this._color)) {
  76329. this._color = new Color_default();
  76330. }
  76331. return this._content.batchTable.getColor(this._batchId, this._color);
  76332. },
  76333. set: function(value) {
  76334. this._content.batchTable.setColor(this._batchId, value);
  76335. }
  76336. },
  76337. polylinePositions: {
  76338. get: function() {
  76339. if (!defined_default(this._content.getPolylinePositions)) {
  76340. return void 0;
  76341. }
  76342. return this._content.getPolylinePositions(this._batchId);
  76343. }
  76344. },
  76345. content: {
  76346. get: function() {
  76347. return this._content;
  76348. }
  76349. },
  76350. tileset: {
  76351. get: function() {
  76352. return this._content.tileset;
  76353. }
  76354. },
  76355. primitive: {
  76356. get: function() {
  76357. return this._content.tileset;
  76358. }
  76359. },
  76360. featureId: {
  76361. get: function() {
  76362. return this._batchId;
  76363. }
  76364. },
  76365. pickId: {
  76366. get: function() {
  76367. return this._content.batchTable.getPickColor(this._batchId);
  76368. }
  76369. }
  76370. });
  76371. Cesium3DTileFeature.prototype.hasProperty = function(name) {
  76372. return this._content.batchTable.hasProperty(this._batchId, name);
  76373. };
  76374. Cesium3DTileFeature.prototype.getPropertyNames = function(results) {
  76375. return this._content.batchTable.getPropertyNames(this._batchId, results);
  76376. };
  76377. Cesium3DTileFeature.prototype.getProperty = function(name) {
  76378. return this._content.batchTable.getProperty(this._batchId, name);
  76379. };
  76380. Cesium3DTileFeature.getPropertyInherited = function(content, batchId, name) {
  76381. const batchTable = content.batchTable;
  76382. if (defined_default(batchTable)) {
  76383. if (batchTable.hasPropertyBySemantic(batchId, name)) {
  76384. return batchTable.getPropertyBySemantic(batchId, name);
  76385. }
  76386. if (batchTable.hasProperty(batchId, name)) {
  76387. return batchTable.getProperty(batchId, name);
  76388. }
  76389. }
  76390. const contentMetadata = content.metadata;
  76391. if (defined_default(contentMetadata)) {
  76392. if (contentMetadata.hasPropertyBySemantic(name)) {
  76393. return contentMetadata.getPropertyBySemantic(name);
  76394. }
  76395. if (contentMetadata.hasProperty(name)) {
  76396. return contentMetadata.getProperty(name);
  76397. }
  76398. }
  76399. const tile = content.tile;
  76400. const tileMetadata = tile.metadata;
  76401. if (defined_default(tileMetadata)) {
  76402. if (tileMetadata.hasPropertyBySemantic(name)) {
  76403. return tileMetadata.getPropertyBySemantic(name);
  76404. }
  76405. if (tileMetadata.hasProperty(name)) {
  76406. return tileMetadata.getProperty(name);
  76407. }
  76408. }
  76409. let subtreeMetadata;
  76410. if (defined_default(tile.implicitSubtree)) {
  76411. subtreeMetadata = tile.implicitSubtree.metadata;
  76412. }
  76413. if (defined_default(subtreeMetadata)) {
  76414. if (subtreeMetadata.hasPropertyBySemantic(name)) {
  76415. return subtreeMetadata.getPropertyBySemantic(name);
  76416. }
  76417. if (subtreeMetadata.hasProperty(name)) {
  76418. return subtreeMetadata.getProperty(name);
  76419. }
  76420. }
  76421. const groupMetadata = defined_default(content.group) ? content.group.metadata : void 0;
  76422. if (defined_default(groupMetadata)) {
  76423. if (groupMetadata.hasPropertyBySemantic(name)) {
  76424. return groupMetadata.getPropertyBySemantic(name);
  76425. }
  76426. if (groupMetadata.hasProperty(name)) {
  76427. return groupMetadata.getProperty(name);
  76428. }
  76429. }
  76430. const tilesetMetadata = content.tileset.metadata;
  76431. if (defined_default(tilesetMetadata)) {
  76432. if (tilesetMetadata.hasPropertyBySemantic(name)) {
  76433. return tilesetMetadata.getPropertyBySemantic(name);
  76434. }
  76435. if (tilesetMetadata.hasProperty(name)) {
  76436. return tilesetMetadata.getProperty(name);
  76437. }
  76438. }
  76439. return void 0;
  76440. };
  76441. Cesium3DTileFeature.prototype.getPropertyInherited = function(name) {
  76442. return Cesium3DTileFeature.getPropertyInherited(
  76443. this._content,
  76444. this._batchId,
  76445. name
  76446. );
  76447. };
  76448. Cesium3DTileFeature.prototype.setProperty = function(name, value) {
  76449. this._content.batchTable.setProperty(this._batchId, name, value);
  76450. this._content.featurePropertiesDirty = true;
  76451. };
  76452. Cesium3DTileFeature.prototype.isExactClass = function(className) {
  76453. return this._content.batchTable.isExactClass(this._batchId, className);
  76454. };
  76455. Cesium3DTileFeature.prototype.isClass = function(className) {
  76456. return this._content.batchTable.isClass(this._batchId, className);
  76457. };
  76458. Cesium3DTileFeature.prototype.getExactClassName = function() {
  76459. return this._content.batchTable.getExactClassName(this._batchId);
  76460. };
  76461. var Cesium3DTileFeature_default = Cesium3DTileFeature;
  76462. // node_modules/cesium/Source/Scene/Cesium3DTileFeatureTable.js
  76463. function Cesium3DTileFeatureTable(featureTableJson, featureTableBinary) {
  76464. this.json = featureTableJson;
  76465. this.buffer = featureTableBinary;
  76466. this._cachedTypedArrays = {};
  76467. this.featuresLength = 0;
  76468. }
  76469. function getTypedArrayFromBinary(featureTable, semantic, componentType, componentLength, count, byteOffset) {
  76470. const cachedTypedArrays = featureTable._cachedTypedArrays;
  76471. let typedArray = cachedTypedArrays[semantic];
  76472. if (!defined_default(typedArray)) {
  76473. typedArray = ComponentDatatype_default.createArrayBufferView(
  76474. componentType,
  76475. featureTable.buffer.buffer,
  76476. featureTable.buffer.byteOffset + byteOffset,
  76477. count * componentLength
  76478. );
  76479. cachedTypedArrays[semantic] = typedArray;
  76480. }
  76481. return typedArray;
  76482. }
  76483. function getTypedArrayFromArray(featureTable, semantic, componentType, array) {
  76484. const cachedTypedArrays = featureTable._cachedTypedArrays;
  76485. let typedArray = cachedTypedArrays[semantic];
  76486. if (!defined_default(typedArray)) {
  76487. typedArray = ComponentDatatype_default.createTypedArray(componentType, array);
  76488. cachedTypedArrays[semantic] = typedArray;
  76489. }
  76490. return typedArray;
  76491. }
  76492. Cesium3DTileFeatureTable.prototype.getGlobalProperty = function(semantic, componentType, componentLength) {
  76493. const jsonValue = this.json[semantic];
  76494. if (!defined_default(jsonValue)) {
  76495. return void 0;
  76496. }
  76497. if (defined_default(jsonValue.byteOffset)) {
  76498. componentType = defaultValue_default(componentType, ComponentDatatype_default.UNSIGNED_INT);
  76499. componentLength = defaultValue_default(componentLength, 1);
  76500. return getTypedArrayFromBinary(
  76501. this,
  76502. semantic,
  76503. componentType,
  76504. componentLength,
  76505. 1,
  76506. jsonValue.byteOffset
  76507. );
  76508. }
  76509. return jsonValue;
  76510. };
  76511. Cesium3DTileFeatureTable.prototype.hasProperty = function(semantic) {
  76512. return defined_default(this.json[semantic]);
  76513. };
  76514. Cesium3DTileFeatureTable.prototype.getPropertyArray = function(semantic, componentType, componentLength) {
  76515. const jsonValue = this.json[semantic];
  76516. if (!defined_default(jsonValue)) {
  76517. return void 0;
  76518. }
  76519. if (defined_default(jsonValue.byteOffset)) {
  76520. if (defined_default(jsonValue.componentType)) {
  76521. componentType = ComponentDatatype_default.fromName(jsonValue.componentType);
  76522. }
  76523. return getTypedArrayFromBinary(
  76524. this,
  76525. semantic,
  76526. componentType,
  76527. componentLength,
  76528. this.featuresLength,
  76529. jsonValue.byteOffset
  76530. );
  76531. }
  76532. return getTypedArrayFromArray(this, semantic, componentType, jsonValue);
  76533. };
  76534. Cesium3DTileFeatureTable.prototype.getProperty = function(semantic, componentType, componentLength, featureId, result) {
  76535. const jsonValue = this.json[semantic];
  76536. if (!defined_default(jsonValue)) {
  76537. return void 0;
  76538. }
  76539. const typedArray = this.getPropertyArray(
  76540. semantic,
  76541. componentType,
  76542. componentLength
  76543. );
  76544. if (componentLength === 1) {
  76545. return typedArray[featureId];
  76546. }
  76547. for (let i2 = 0; i2 < componentLength; ++i2) {
  76548. result[i2] = typedArray[componentLength * featureId + i2];
  76549. }
  76550. return result;
  76551. };
  76552. var Cesium3DTileFeatureTable_default = Cesium3DTileFeatureTable;
  76553. // node_modules/cesium/Source/Scene/GltfPipeline/addToArray.js
  76554. function addToArray(array, element, checkDuplicates) {
  76555. checkDuplicates = defaultValue_default(checkDuplicates, false);
  76556. if (checkDuplicates) {
  76557. const index2 = array.indexOf(element);
  76558. if (index2 > -1) {
  76559. return index2;
  76560. }
  76561. }
  76562. array.push(element);
  76563. return array.length - 1;
  76564. }
  76565. var addToArray_default = addToArray;
  76566. // node_modules/cesium/Source/Scene/GltfPipeline/usesExtension.js
  76567. function usesExtension(gltf, extension) {
  76568. return defined_default(gltf.extensionsUsed) && gltf.extensionsUsed.indexOf(extension) >= 0;
  76569. }
  76570. var usesExtension_default = usesExtension;
  76571. // node_modules/cesium/Source/Scene/GltfPipeline/ForEach.js
  76572. function ForEach() {
  76573. }
  76574. ForEach.objectLegacy = function(objects, handler) {
  76575. if (defined_default(objects)) {
  76576. for (const objectId in objects) {
  76577. if (Object.prototype.hasOwnProperty.call(objects, objectId)) {
  76578. const object2 = objects[objectId];
  76579. const value = handler(object2, objectId);
  76580. if (defined_default(value)) {
  76581. return value;
  76582. }
  76583. }
  76584. }
  76585. }
  76586. };
  76587. ForEach.object = function(arrayOfObjects, handler) {
  76588. if (defined_default(arrayOfObjects)) {
  76589. const length3 = arrayOfObjects.length;
  76590. for (let i2 = 0; i2 < length3; i2++) {
  76591. const object2 = arrayOfObjects[i2];
  76592. const value = handler(object2, i2);
  76593. if (defined_default(value)) {
  76594. return value;
  76595. }
  76596. }
  76597. }
  76598. };
  76599. ForEach.topLevel = function(gltf, name, handler) {
  76600. const gltfProperty = gltf[name];
  76601. if (defined_default(gltfProperty) && !Array.isArray(gltfProperty)) {
  76602. return ForEach.objectLegacy(gltfProperty, handler);
  76603. }
  76604. return ForEach.object(gltfProperty, handler);
  76605. };
  76606. ForEach.accessor = function(gltf, handler) {
  76607. return ForEach.topLevel(gltf, "accessors", handler);
  76608. };
  76609. ForEach.accessorWithSemantic = function(gltf, semantic, handler) {
  76610. const visited = {};
  76611. return ForEach.mesh(gltf, function(mesh2) {
  76612. return ForEach.meshPrimitive(mesh2, function(primitive) {
  76613. const valueForEach = ForEach.meshPrimitiveAttribute(
  76614. primitive,
  76615. function(accessorId, attributeSemantic) {
  76616. if (attributeSemantic.indexOf(semantic) === 0 && !defined_default(visited[accessorId])) {
  76617. visited[accessorId] = true;
  76618. const value = handler(accessorId);
  76619. if (defined_default(value)) {
  76620. return value;
  76621. }
  76622. }
  76623. }
  76624. );
  76625. if (defined_default(valueForEach)) {
  76626. return valueForEach;
  76627. }
  76628. return ForEach.meshPrimitiveTarget(primitive, function(target) {
  76629. return ForEach.meshPrimitiveTargetAttribute(
  76630. target,
  76631. function(accessorId, attributeSemantic) {
  76632. if (attributeSemantic.indexOf(semantic) === 0 && !defined_default(visited[accessorId])) {
  76633. visited[accessorId] = true;
  76634. const value = handler(accessorId);
  76635. if (defined_default(value)) {
  76636. return value;
  76637. }
  76638. }
  76639. }
  76640. );
  76641. });
  76642. });
  76643. });
  76644. };
  76645. ForEach.accessorContainingVertexAttributeData = function(gltf, handler) {
  76646. const visited = {};
  76647. return ForEach.mesh(gltf, function(mesh2) {
  76648. return ForEach.meshPrimitive(mesh2, function(primitive) {
  76649. const valueForEach = ForEach.meshPrimitiveAttribute(
  76650. primitive,
  76651. function(accessorId) {
  76652. if (!defined_default(visited[accessorId])) {
  76653. visited[accessorId] = true;
  76654. const value = handler(accessorId);
  76655. if (defined_default(value)) {
  76656. return value;
  76657. }
  76658. }
  76659. }
  76660. );
  76661. if (defined_default(valueForEach)) {
  76662. return valueForEach;
  76663. }
  76664. return ForEach.meshPrimitiveTarget(primitive, function(target) {
  76665. return ForEach.meshPrimitiveTargetAttribute(
  76666. target,
  76667. function(accessorId) {
  76668. if (!defined_default(visited[accessorId])) {
  76669. visited[accessorId] = true;
  76670. const value = handler(accessorId);
  76671. if (defined_default(value)) {
  76672. return value;
  76673. }
  76674. }
  76675. }
  76676. );
  76677. });
  76678. });
  76679. });
  76680. };
  76681. ForEach.accessorContainingIndexData = function(gltf, handler) {
  76682. const visited = {};
  76683. return ForEach.mesh(gltf, function(mesh2) {
  76684. return ForEach.meshPrimitive(mesh2, function(primitive) {
  76685. const indices2 = primitive.indices;
  76686. if (defined_default(indices2) && !defined_default(visited[indices2])) {
  76687. visited[indices2] = true;
  76688. const value = handler(indices2);
  76689. if (defined_default(value)) {
  76690. return value;
  76691. }
  76692. }
  76693. });
  76694. });
  76695. };
  76696. ForEach.animation = function(gltf, handler) {
  76697. return ForEach.topLevel(gltf, "animations", handler);
  76698. };
  76699. ForEach.animationChannel = function(animation, handler) {
  76700. const channels = animation.channels;
  76701. return ForEach.object(channels, handler);
  76702. };
  76703. ForEach.animationSampler = function(animation, handler) {
  76704. const samplers = animation.samplers;
  76705. return ForEach.object(samplers, handler);
  76706. };
  76707. ForEach.buffer = function(gltf, handler) {
  76708. return ForEach.topLevel(gltf, "buffers", handler);
  76709. };
  76710. ForEach.bufferView = function(gltf, handler) {
  76711. return ForEach.topLevel(gltf, "bufferViews", handler);
  76712. };
  76713. ForEach.camera = function(gltf, handler) {
  76714. return ForEach.topLevel(gltf, "cameras", handler);
  76715. };
  76716. ForEach.image = function(gltf, handler) {
  76717. return ForEach.topLevel(gltf, "images", handler);
  76718. };
  76719. ForEach.material = function(gltf, handler) {
  76720. return ForEach.topLevel(gltf, "materials", handler);
  76721. };
  76722. ForEach.materialValue = function(material, handler) {
  76723. let values = material.values;
  76724. if (defined_default(material.extensions) && defined_default(material.extensions.KHR_techniques_webgl)) {
  76725. values = material.extensions.KHR_techniques_webgl.values;
  76726. }
  76727. for (const name in values) {
  76728. if (Object.prototype.hasOwnProperty.call(values, name)) {
  76729. const value = handler(values[name], name);
  76730. if (defined_default(value)) {
  76731. return value;
  76732. }
  76733. }
  76734. }
  76735. };
  76736. ForEach.mesh = function(gltf, handler) {
  76737. return ForEach.topLevel(gltf, "meshes", handler);
  76738. };
  76739. ForEach.meshPrimitive = function(mesh2, handler) {
  76740. const primitives = mesh2.primitives;
  76741. if (defined_default(primitives)) {
  76742. const primitivesLength = primitives.length;
  76743. for (let i2 = 0; i2 < primitivesLength; i2++) {
  76744. const primitive = primitives[i2];
  76745. const value = handler(primitive, i2);
  76746. if (defined_default(value)) {
  76747. return value;
  76748. }
  76749. }
  76750. }
  76751. };
  76752. ForEach.meshPrimitiveAttribute = function(primitive, handler) {
  76753. const attributes = primitive.attributes;
  76754. for (const semantic in attributes) {
  76755. if (Object.prototype.hasOwnProperty.call(attributes, semantic)) {
  76756. const value = handler(attributes[semantic], semantic);
  76757. if (defined_default(value)) {
  76758. return value;
  76759. }
  76760. }
  76761. }
  76762. };
  76763. ForEach.meshPrimitiveTarget = function(primitive, handler) {
  76764. const targets = primitive.targets;
  76765. if (defined_default(targets)) {
  76766. const length3 = targets.length;
  76767. for (let i2 = 0; i2 < length3; ++i2) {
  76768. const value = handler(targets[i2], i2);
  76769. if (defined_default(value)) {
  76770. return value;
  76771. }
  76772. }
  76773. }
  76774. };
  76775. ForEach.meshPrimitiveTargetAttribute = function(target, handler) {
  76776. for (const semantic in target) {
  76777. if (Object.prototype.hasOwnProperty.call(target, semantic)) {
  76778. const accessorId = target[semantic];
  76779. const value = handler(accessorId, semantic);
  76780. if (defined_default(value)) {
  76781. return value;
  76782. }
  76783. }
  76784. }
  76785. };
  76786. ForEach.node = function(gltf, handler) {
  76787. return ForEach.topLevel(gltf, "nodes", handler);
  76788. };
  76789. ForEach.nodeInTree = function(gltf, nodeIds, handler) {
  76790. const nodes = gltf.nodes;
  76791. if (defined_default(nodes)) {
  76792. const length3 = nodeIds.length;
  76793. for (let i2 = 0; i2 < length3; i2++) {
  76794. const nodeId = nodeIds[i2];
  76795. const node = nodes[nodeId];
  76796. if (defined_default(node)) {
  76797. let value = handler(node, nodeId);
  76798. if (defined_default(value)) {
  76799. return value;
  76800. }
  76801. const children = node.children;
  76802. if (defined_default(children)) {
  76803. value = ForEach.nodeInTree(gltf, children, handler);
  76804. if (defined_default(value)) {
  76805. return value;
  76806. }
  76807. }
  76808. }
  76809. }
  76810. }
  76811. };
  76812. ForEach.nodeInScene = function(gltf, scene, handler) {
  76813. const sceneNodeIds = scene.nodes;
  76814. if (defined_default(sceneNodeIds)) {
  76815. return ForEach.nodeInTree(gltf, sceneNodeIds, handler);
  76816. }
  76817. };
  76818. ForEach.program = function(gltf, handler) {
  76819. if (usesExtension_default(gltf, "KHR_techniques_webgl")) {
  76820. return ForEach.object(
  76821. gltf.extensions.KHR_techniques_webgl.programs,
  76822. handler
  76823. );
  76824. }
  76825. return ForEach.topLevel(gltf, "programs", handler);
  76826. };
  76827. ForEach.sampler = function(gltf, handler) {
  76828. return ForEach.topLevel(gltf, "samplers", handler);
  76829. };
  76830. ForEach.scene = function(gltf, handler) {
  76831. return ForEach.topLevel(gltf, "scenes", handler);
  76832. };
  76833. ForEach.shader = function(gltf, handler) {
  76834. if (usesExtension_default(gltf, "KHR_techniques_webgl")) {
  76835. return ForEach.object(
  76836. gltf.extensions.KHR_techniques_webgl.shaders,
  76837. handler
  76838. );
  76839. }
  76840. return ForEach.topLevel(gltf, "shaders", handler);
  76841. };
  76842. ForEach.skin = function(gltf, handler) {
  76843. return ForEach.topLevel(gltf, "skins", handler);
  76844. };
  76845. ForEach.skinJoint = function(skin, handler) {
  76846. const joints = skin.joints;
  76847. if (defined_default(joints)) {
  76848. const jointsLength = joints.length;
  76849. for (let i2 = 0; i2 < jointsLength; i2++) {
  76850. const joint = joints[i2];
  76851. const value = handler(joint);
  76852. if (defined_default(value)) {
  76853. return value;
  76854. }
  76855. }
  76856. }
  76857. };
  76858. ForEach.techniqueAttribute = function(technique, handler) {
  76859. const attributes = technique.attributes;
  76860. for (const attributeName in attributes) {
  76861. if (Object.prototype.hasOwnProperty.call(attributes, attributeName)) {
  76862. const value = handler(attributes[attributeName], attributeName);
  76863. if (defined_default(value)) {
  76864. return value;
  76865. }
  76866. }
  76867. }
  76868. };
  76869. ForEach.techniqueUniform = function(technique, handler) {
  76870. const uniforms = technique.uniforms;
  76871. for (const uniformName in uniforms) {
  76872. if (Object.prototype.hasOwnProperty.call(uniforms, uniformName)) {
  76873. const value = handler(uniforms[uniformName], uniformName);
  76874. if (defined_default(value)) {
  76875. return value;
  76876. }
  76877. }
  76878. }
  76879. };
  76880. ForEach.techniqueParameter = function(technique, handler) {
  76881. const parameters = technique.parameters;
  76882. for (const parameterName in parameters) {
  76883. if (Object.prototype.hasOwnProperty.call(parameters, parameterName)) {
  76884. const value = handler(parameters[parameterName], parameterName);
  76885. if (defined_default(value)) {
  76886. return value;
  76887. }
  76888. }
  76889. }
  76890. };
  76891. ForEach.technique = function(gltf, handler) {
  76892. if (usesExtension_default(gltf, "KHR_techniques_webgl")) {
  76893. return ForEach.object(
  76894. gltf.extensions.KHR_techniques_webgl.techniques,
  76895. handler
  76896. );
  76897. }
  76898. return ForEach.topLevel(gltf, "techniques", handler);
  76899. };
  76900. ForEach.texture = function(gltf, handler) {
  76901. return ForEach.topLevel(gltf, "textures", handler);
  76902. };
  76903. var ForEach_default = ForEach;
  76904. // node_modules/cesium/Source/Scene/GltfPipeline/numberOfComponentsForType.js
  76905. function numberOfComponentsForType(type) {
  76906. switch (type) {
  76907. case "SCALAR":
  76908. return 1;
  76909. case "VEC2":
  76910. return 2;
  76911. case "VEC3":
  76912. return 3;
  76913. case "VEC4":
  76914. case "MAT2":
  76915. return 4;
  76916. case "MAT3":
  76917. return 9;
  76918. case "MAT4":
  76919. return 16;
  76920. }
  76921. }
  76922. var numberOfComponentsForType_default = numberOfComponentsForType;
  76923. // node_modules/cesium/Source/Scene/GltfPipeline/getAccessorByteStride.js
  76924. function getAccessorByteStride(gltf, accessor) {
  76925. const bufferViewId = accessor.bufferView;
  76926. if (defined_default(bufferViewId)) {
  76927. const bufferView = gltf.bufferViews[bufferViewId];
  76928. if (defined_default(bufferView.byteStride) && bufferView.byteStride > 0) {
  76929. return bufferView.byteStride;
  76930. }
  76931. }
  76932. return ComponentDatatype_default.getSizeInBytes(accessor.componentType) * numberOfComponentsForType_default(accessor.type);
  76933. }
  76934. var getAccessorByteStride_default = getAccessorByteStride;
  76935. // node_modules/cesium/Source/Scene/GltfPipeline/addDefaults.js
  76936. function addDefaults(gltf) {
  76937. ForEach_default.accessor(gltf, function(accessor) {
  76938. if (defined_default(accessor.bufferView)) {
  76939. accessor.byteOffset = defaultValue_default(accessor.byteOffset, 0);
  76940. }
  76941. });
  76942. ForEach_default.bufferView(gltf, function(bufferView) {
  76943. if (defined_default(bufferView.buffer)) {
  76944. bufferView.byteOffset = defaultValue_default(bufferView.byteOffset, 0);
  76945. }
  76946. });
  76947. ForEach_default.mesh(gltf, function(mesh2) {
  76948. ForEach_default.meshPrimitive(mesh2, function(primitive) {
  76949. primitive.mode = defaultValue_default(primitive.mode, WebGLConstants_default.TRIANGLES);
  76950. if (!defined_default(primitive.material)) {
  76951. if (!defined_default(gltf.materials)) {
  76952. gltf.materials = [];
  76953. }
  76954. const defaultMaterial4 = {
  76955. name: "default"
  76956. };
  76957. primitive.material = addToArray_default(gltf.materials, defaultMaterial4);
  76958. }
  76959. });
  76960. });
  76961. ForEach_default.accessorContainingVertexAttributeData(gltf, function(accessorId) {
  76962. const accessor = gltf.accessors[accessorId];
  76963. const bufferViewId = accessor.bufferView;
  76964. accessor.normalized = defaultValue_default(accessor.normalized, false);
  76965. if (defined_default(bufferViewId)) {
  76966. const bufferView = gltf.bufferViews[bufferViewId];
  76967. bufferView.byteStride = getAccessorByteStride_default(gltf, accessor);
  76968. bufferView.target = WebGLConstants_default.ARRAY_BUFFER;
  76969. }
  76970. });
  76971. ForEach_default.accessorContainingIndexData(gltf, function(accessorId) {
  76972. const accessor = gltf.accessors[accessorId];
  76973. const bufferViewId = accessor.bufferView;
  76974. if (defined_default(bufferViewId)) {
  76975. const bufferView = gltf.bufferViews[bufferViewId];
  76976. bufferView.target = WebGLConstants_default.ELEMENT_ARRAY_BUFFER;
  76977. }
  76978. });
  76979. ForEach_default.material(gltf, function(material) {
  76980. const extensions = defaultValue_default(
  76981. material.extensions,
  76982. defaultValue_default.EMPTY_OBJECT
  76983. );
  76984. const materialsCommon = extensions.KHR_materials_common;
  76985. if (defined_default(materialsCommon)) {
  76986. const technique = materialsCommon.technique;
  76987. const values = defined_default(materialsCommon.values) ? materialsCommon.values : {};
  76988. materialsCommon.values = values;
  76989. values.ambient = defined_default(values.ambient) ? values.ambient : [0, 0, 0, 1];
  76990. values.emission = defined_default(values.emission) ? values.emission : [0, 0, 0, 1];
  76991. values.transparency = defaultValue_default(values.transparency, 1);
  76992. values.transparent = defaultValue_default(values.transparent, false);
  76993. values.doubleSided = defaultValue_default(values.doubleSided, false);
  76994. if (technique !== "CONSTANT") {
  76995. values.diffuse = defined_default(values.diffuse) ? values.diffuse : [0, 0, 0, 1];
  76996. if (technique !== "LAMBERT") {
  76997. values.specular = defined_default(values.specular) ? values.specular : [0, 0, 0, 1];
  76998. values.shininess = defaultValue_default(values.shininess, 0);
  76999. }
  77000. }
  77001. return;
  77002. }
  77003. material.emissiveFactor = defaultValue_default(
  77004. material.emissiveFactor,
  77005. [0, 0, 0]
  77006. );
  77007. material.alphaMode = defaultValue_default(material.alphaMode, "OPAQUE");
  77008. material.doubleSided = defaultValue_default(material.doubleSided, false);
  77009. if (material.alphaMode === "MASK") {
  77010. material.alphaCutoff = defaultValue_default(material.alphaCutoff, 0.5);
  77011. }
  77012. const techniquesExtension = extensions.KHR_techniques_webgl;
  77013. if (defined_default(techniquesExtension)) {
  77014. ForEach_default.materialValue(material, function(materialValue) {
  77015. if (defined_default(materialValue.index)) {
  77016. addTextureDefaults(materialValue);
  77017. }
  77018. });
  77019. }
  77020. addTextureDefaults(material.emissiveTexture);
  77021. addTextureDefaults(material.normalTexture);
  77022. addTextureDefaults(material.occlusionTexture);
  77023. const pbrMetallicRoughness = material.pbrMetallicRoughness;
  77024. if (defined_default(pbrMetallicRoughness)) {
  77025. pbrMetallicRoughness.baseColorFactor = defaultValue_default(
  77026. pbrMetallicRoughness.baseColorFactor,
  77027. [1, 1, 1, 1]
  77028. );
  77029. pbrMetallicRoughness.metallicFactor = defaultValue_default(
  77030. pbrMetallicRoughness.metallicFactor,
  77031. 1
  77032. );
  77033. pbrMetallicRoughness.roughnessFactor = defaultValue_default(
  77034. pbrMetallicRoughness.roughnessFactor,
  77035. 1
  77036. );
  77037. addTextureDefaults(pbrMetallicRoughness.baseColorTexture);
  77038. addTextureDefaults(pbrMetallicRoughness.metallicRoughnessTexture);
  77039. }
  77040. const pbrSpecularGlossiness = extensions.KHR_materials_pbrSpecularGlossiness;
  77041. if (defined_default(pbrSpecularGlossiness)) {
  77042. pbrSpecularGlossiness.diffuseFactor = defaultValue_default(
  77043. pbrSpecularGlossiness.diffuseFactor,
  77044. [1, 1, 1, 1]
  77045. );
  77046. pbrSpecularGlossiness.specularFactor = defaultValue_default(
  77047. pbrSpecularGlossiness.specularFactor,
  77048. [1, 1, 1]
  77049. );
  77050. pbrSpecularGlossiness.glossinessFactor = defaultValue_default(
  77051. pbrSpecularGlossiness.glossinessFactor,
  77052. 1
  77053. );
  77054. addTextureDefaults(pbrSpecularGlossiness.specularGlossinessTexture);
  77055. }
  77056. });
  77057. ForEach_default.animation(gltf, function(animation) {
  77058. ForEach_default.animationSampler(animation, function(sampler) {
  77059. sampler.interpolation = defaultValue_default(sampler.interpolation, "LINEAR");
  77060. });
  77061. });
  77062. const animatedNodes = getAnimatedNodes(gltf);
  77063. ForEach_default.node(gltf, function(node, id) {
  77064. const animated = defined_default(animatedNodes[id]);
  77065. if (animated || defined_default(node.translation) || defined_default(node.rotation) || defined_default(node.scale)) {
  77066. node.translation = defaultValue_default(node.translation, [0, 0, 0]);
  77067. node.rotation = defaultValue_default(node.rotation, [0, 0, 0, 1]);
  77068. node.scale = defaultValue_default(node.scale, [1, 1, 1]);
  77069. } else {
  77070. node.matrix = defaultValue_default(
  77071. node.matrix,
  77072. [
  77073. 1,
  77074. 0,
  77075. 0,
  77076. 0,
  77077. 0,
  77078. 1,
  77079. 0,
  77080. 0,
  77081. 0,
  77082. 0,
  77083. 1,
  77084. 0,
  77085. 0,
  77086. 0,
  77087. 0,
  77088. 1
  77089. ]
  77090. );
  77091. }
  77092. });
  77093. ForEach_default.sampler(gltf, function(sampler) {
  77094. sampler.wrapS = defaultValue_default(sampler.wrapS, WebGLConstants_default.REPEAT);
  77095. sampler.wrapT = defaultValue_default(sampler.wrapT, WebGLConstants_default.REPEAT);
  77096. });
  77097. if (defined_default(gltf.scenes) && !defined_default(gltf.scene)) {
  77098. gltf.scene = 0;
  77099. }
  77100. return gltf;
  77101. }
  77102. function getAnimatedNodes(gltf) {
  77103. const nodes = {};
  77104. ForEach_default.animation(gltf, function(animation) {
  77105. ForEach_default.animationChannel(animation, function(channel) {
  77106. const target = channel.target;
  77107. const nodeId = target.node;
  77108. const path = target.path;
  77109. if (path === "translation" || path === "rotation" || path === "scale") {
  77110. nodes[nodeId] = true;
  77111. }
  77112. });
  77113. });
  77114. return nodes;
  77115. }
  77116. function addTextureDefaults(texture) {
  77117. if (defined_default(texture)) {
  77118. texture.texCoord = defaultValue_default(texture.texCoord, 0);
  77119. }
  77120. }
  77121. var addDefaults_default = addDefaults;
  77122. // node_modules/cesium/Source/Scene/GltfPipeline/addPipelineExtras.js
  77123. function addPipelineExtras(gltf) {
  77124. ForEach_default.shader(gltf, function(shader) {
  77125. addExtras(shader);
  77126. });
  77127. ForEach_default.buffer(gltf, function(buffer) {
  77128. addExtras(buffer);
  77129. });
  77130. ForEach_default.image(gltf, function(image) {
  77131. addExtras(image);
  77132. });
  77133. addExtras(gltf);
  77134. return gltf;
  77135. }
  77136. function addExtras(object2) {
  77137. object2.extras = defined_default(object2.extras) ? object2.extras : {};
  77138. object2.extras._pipeline = defined_default(object2.extras._pipeline) ? object2.extras._pipeline : {};
  77139. }
  77140. var addPipelineExtras_default = addPipelineExtras;
  77141. // node_modules/cesium/Source/Scene/GltfPipeline/removeExtensionsRequired.js
  77142. function removeExtensionsRequired(gltf, extension) {
  77143. const extensionsRequired = gltf.extensionsRequired;
  77144. if (defined_default(extensionsRequired)) {
  77145. const index2 = extensionsRequired.indexOf(extension);
  77146. if (index2 >= 0) {
  77147. extensionsRequired.splice(index2, 1);
  77148. }
  77149. if (extensionsRequired.length === 0) {
  77150. delete gltf.extensionsRequired;
  77151. }
  77152. }
  77153. }
  77154. var removeExtensionsRequired_default = removeExtensionsRequired;
  77155. // node_modules/cesium/Source/Scene/GltfPipeline/removeExtensionsUsed.js
  77156. function removeExtensionsUsed(gltf, extension) {
  77157. const extensionsUsed = gltf.extensionsUsed;
  77158. if (defined_default(extensionsUsed)) {
  77159. const index2 = extensionsUsed.indexOf(extension);
  77160. if (index2 >= 0) {
  77161. extensionsUsed.splice(index2, 1);
  77162. }
  77163. removeExtensionsRequired_default(gltf, extension);
  77164. if (extensionsUsed.length === 0) {
  77165. delete gltf.extensionsUsed;
  77166. }
  77167. }
  77168. }
  77169. var removeExtensionsUsed_default = removeExtensionsUsed;
  77170. // node_modules/cesium/Source/Scene/GltfPipeline/parseGlb.js
  77171. var sizeOfUint323 = 4;
  77172. function parseGlb(glb) {
  77173. const magic = getMagic_default(glb);
  77174. if (magic !== "glTF") {
  77175. throw new RuntimeError_default("File is not valid binary glTF");
  77176. }
  77177. const header = readHeader(glb, 0, 5);
  77178. const version = header[1];
  77179. if (version !== 1 && version !== 2) {
  77180. throw new RuntimeError_default("Binary glTF version is not 1 or 2");
  77181. }
  77182. if (version === 1) {
  77183. return parseGlbVersion1(glb, header);
  77184. }
  77185. return parseGlbVersion2(glb, header);
  77186. }
  77187. function readHeader(glb, byteOffset, count) {
  77188. const dataView = new DataView(glb.buffer);
  77189. const header = new Array(count);
  77190. for (let i2 = 0; i2 < count; ++i2) {
  77191. header[i2] = dataView.getUint32(
  77192. glb.byteOffset + byteOffset + i2 * sizeOfUint323,
  77193. true
  77194. );
  77195. }
  77196. return header;
  77197. }
  77198. function parseGlbVersion1(glb, header) {
  77199. const length3 = header[2];
  77200. const contentLength = header[3];
  77201. const contentFormat = header[4];
  77202. if (contentFormat !== 0) {
  77203. throw new RuntimeError_default("Binary glTF scene format is not JSON");
  77204. }
  77205. const jsonStart = 20;
  77206. const binaryStart = jsonStart + contentLength;
  77207. const contentString = getStringFromTypedArray_default(glb, jsonStart, contentLength);
  77208. const gltf = JSON.parse(contentString);
  77209. addPipelineExtras_default(gltf);
  77210. const binaryBuffer = glb.subarray(binaryStart, length3);
  77211. const buffers = gltf.buffers;
  77212. if (defined_default(buffers) && Object.keys(buffers).length > 0) {
  77213. const binaryGltfBuffer = defaultValue_default(
  77214. buffers.binary_glTF,
  77215. buffers.KHR_binary_glTF
  77216. );
  77217. if (defined_default(binaryGltfBuffer)) {
  77218. binaryGltfBuffer.extras._pipeline.source = binaryBuffer;
  77219. delete binaryGltfBuffer.uri;
  77220. }
  77221. }
  77222. removeExtensionsUsed_default(gltf, "KHR_binary_glTF");
  77223. return gltf;
  77224. }
  77225. function parseGlbVersion2(glb, header) {
  77226. const length3 = header[2];
  77227. let byteOffset = 12;
  77228. let gltf;
  77229. let binaryBuffer;
  77230. while (byteOffset < length3) {
  77231. const chunkHeader = readHeader(glb, byteOffset, 2);
  77232. const chunkLength = chunkHeader[0];
  77233. const chunkType = chunkHeader[1];
  77234. byteOffset += 8;
  77235. const chunkBuffer = glb.subarray(byteOffset, byteOffset + chunkLength);
  77236. byteOffset += chunkLength;
  77237. if (chunkType === 1313821514) {
  77238. const jsonString = getStringFromTypedArray_default(chunkBuffer);
  77239. gltf = JSON.parse(jsonString);
  77240. addPipelineExtras_default(gltf);
  77241. } else if (chunkType === 5130562) {
  77242. binaryBuffer = chunkBuffer;
  77243. }
  77244. }
  77245. if (defined_default(gltf) && defined_default(binaryBuffer)) {
  77246. const buffers = gltf.buffers;
  77247. if (defined_default(buffers) && buffers.length > 0) {
  77248. const buffer = buffers[0];
  77249. buffer.extras._pipeline.source = binaryBuffer;
  77250. }
  77251. }
  77252. return gltf;
  77253. }
  77254. var parseGlb_default = parseGlb;
  77255. // node_modules/cesium/Source/Scene/GltfPipeline/addExtensionsUsed.js
  77256. function addExtensionsUsed(gltf, extension) {
  77257. let extensionsUsed = gltf.extensionsUsed;
  77258. if (!defined_default(extensionsUsed)) {
  77259. extensionsUsed = [];
  77260. gltf.extensionsUsed = extensionsUsed;
  77261. }
  77262. addToArray_default(extensionsUsed, extension, true);
  77263. }
  77264. var addExtensionsUsed_default = addExtensionsUsed;
  77265. // node_modules/cesium/Source/Scene/GltfPipeline/getComponentReader.js
  77266. function getComponentReader(componentType) {
  77267. switch (componentType) {
  77268. case ComponentDatatype_default.BYTE:
  77269. return function(dataView, byteOffset, numberOfComponents, componentTypeByteLength, result) {
  77270. for (let i2 = 0; i2 < numberOfComponents; ++i2) {
  77271. result[i2] = dataView.getInt8(
  77272. byteOffset + i2 * componentTypeByteLength
  77273. );
  77274. }
  77275. };
  77276. case ComponentDatatype_default.UNSIGNED_BYTE:
  77277. return function(dataView, byteOffset, numberOfComponents, componentTypeByteLength, result) {
  77278. for (let i2 = 0; i2 < numberOfComponents; ++i2) {
  77279. result[i2] = dataView.getUint8(
  77280. byteOffset + i2 * componentTypeByteLength
  77281. );
  77282. }
  77283. };
  77284. case ComponentDatatype_default.SHORT:
  77285. return function(dataView, byteOffset, numberOfComponents, componentTypeByteLength, result) {
  77286. for (let i2 = 0; i2 < numberOfComponents; ++i2) {
  77287. result[i2] = dataView.getInt16(
  77288. byteOffset + i2 * componentTypeByteLength,
  77289. true
  77290. );
  77291. }
  77292. };
  77293. case ComponentDatatype_default.UNSIGNED_SHORT:
  77294. return function(dataView, byteOffset, numberOfComponents, componentTypeByteLength, result) {
  77295. for (let i2 = 0; i2 < numberOfComponents; ++i2) {
  77296. result[i2] = dataView.getUint16(
  77297. byteOffset + i2 * componentTypeByteLength,
  77298. true
  77299. );
  77300. }
  77301. };
  77302. case ComponentDatatype_default.INT:
  77303. return function(dataView, byteOffset, numberOfComponents, componentTypeByteLength, result) {
  77304. for (let i2 = 0; i2 < numberOfComponents; ++i2) {
  77305. result[i2] = dataView.getInt32(
  77306. byteOffset + i2 * componentTypeByteLength,
  77307. true
  77308. );
  77309. }
  77310. };
  77311. case ComponentDatatype_default.UNSIGNED_INT:
  77312. return function(dataView, byteOffset, numberOfComponents, componentTypeByteLength, result) {
  77313. for (let i2 = 0; i2 < numberOfComponents; ++i2) {
  77314. result[i2] = dataView.getUint32(
  77315. byteOffset + i2 * componentTypeByteLength,
  77316. true
  77317. );
  77318. }
  77319. };
  77320. case ComponentDatatype_default.FLOAT:
  77321. return function(dataView, byteOffset, numberOfComponents, componentTypeByteLength, result) {
  77322. for (let i2 = 0; i2 < numberOfComponents; ++i2) {
  77323. result[i2] = dataView.getFloat32(
  77324. byteOffset + i2 * componentTypeByteLength,
  77325. true
  77326. );
  77327. }
  77328. };
  77329. case ComponentDatatype_default.DOUBLE:
  77330. return function(dataView, byteOffset, numberOfComponents, componentTypeByteLength, result) {
  77331. for (let i2 = 0; i2 < numberOfComponents; ++i2) {
  77332. result[i2] = dataView.getFloat64(
  77333. byteOffset + i2 * componentTypeByteLength,
  77334. true
  77335. );
  77336. }
  77337. };
  77338. }
  77339. }
  77340. var getComponentReader_default = getComponentReader;
  77341. // node_modules/cesium/Source/Scene/GltfPipeline/findAccessorMinMax.js
  77342. function findAccessorMinMax(gltf, accessor) {
  77343. const bufferViews = gltf.bufferViews;
  77344. const buffers = gltf.buffers;
  77345. const bufferViewId = accessor.bufferView;
  77346. const numberOfComponents = numberOfComponentsForType_default(accessor.type);
  77347. if (!defined_default(accessor.bufferView)) {
  77348. return {
  77349. min: arrayFill_default(new Array(numberOfComponents), 0),
  77350. max: arrayFill_default(new Array(numberOfComponents), 0)
  77351. };
  77352. }
  77353. const min3 = arrayFill_default(
  77354. new Array(numberOfComponents),
  77355. Number.POSITIVE_INFINITY
  77356. );
  77357. const max3 = arrayFill_default(
  77358. new Array(numberOfComponents),
  77359. Number.NEGATIVE_INFINITY
  77360. );
  77361. const bufferView = bufferViews[bufferViewId];
  77362. const bufferId = bufferView.buffer;
  77363. const buffer = buffers[bufferId];
  77364. const source = buffer.extras._pipeline.source;
  77365. const count = accessor.count;
  77366. const byteStride = getAccessorByteStride_default(gltf, accessor);
  77367. let byteOffset = accessor.byteOffset + bufferView.byteOffset + source.byteOffset;
  77368. const componentType = accessor.componentType;
  77369. const componentTypeByteLength = ComponentDatatype_default.getSizeInBytes(componentType);
  77370. const dataView = new DataView(source.buffer);
  77371. const components = new Array(numberOfComponents);
  77372. const componentReader = getComponentReader_default(componentType);
  77373. for (let i2 = 0; i2 < count; i2++) {
  77374. componentReader(
  77375. dataView,
  77376. byteOffset,
  77377. numberOfComponents,
  77378. componentTypeByteLength,
  77379. components
  77380. );
  77381. for (let j = 0; j < numberOfComponents; j++) {
  77382. const value = components[j];
  77383. min3[j] = Math.min(min3[j], value);
  77384. max3[j] = Math.max(max3[j], value);
  77385. }
  77386. byteOffset += byteStride;
  77387. }
  77388. return {
  77389. min: min3,
  77390. max: max3
  77391. };
  77392. }
  77393. var findAccessorMinMax_default = findAccessorMinMax;
  77394. // node_modules/cesium/Source/Scene/GltfPipeline/moveTechniqueRenderStates.js
  77395. var defaultBlendEquation = [WebGLConstants_default.FUNC_ADD, WebGLConstants_default.FUNC_ADD];
  77396. var defaultBlendFactors = [
  77397. WebGLConstants_default.ONE,
  77398. WebGLConstants_default.ZERO,
  77399. WebGLConstants_default.ONE,
  77400. WebGLConstants_default.ZERO
  77401. ];
  77402. function isStateEnabled(renderStates, state) {
  77403. const enabled = renderStates.enable;
  77404. if (!defined_default(enabled)) {
  77405. return false;
  77406. }
  77407. return enabled.indexOf(state) > -1;
  77408. }
  77409. var supportedBlendFactors = [
  77410. WebGLConstants_default.ZERO,
  77411. WebGLConstants_default.ONE,
  77412. WebGLConstants_default.SRC_COLOR,
  77413. WebGLConstants_default.ONE_MINUS_SRC_COLOR,
  77414. WebGLConstants_default.SRC_ALPHA,
  77415. WebGLConstants_default.ONE_MINUS_SRC_ALPHA,
  77416. WebGLConstants_default.DST_ALPHA,
  77417. WebGLConstants_default.ONE_MINUS_DST_ALPHA,
  77418. WebGLConstants_default.DST_COLOR,
  77419. WebGLConstants_default.ONE_MINUS_DST_COLOR
  77420. ];
  77421. function getSupportedBlendFactors(value, defaultValue2) {
  77422. if (!defined_default(value)) {
  77423. return defaultValue2;
  77424. }
  77425. for (let i2 = 0; i2 < 4; i2++) {
  77426. if (supportedBlendFactors.indexOf(value[i2]) === -1) {
  77427. return defaultValue2;
  77428. }
  77429. }
  77430. return value;
  77431. }
  77432. function moveTechniqueRenderStates(gltf) {
  77433. const blendingForTechnique = {};
  77434. const materialPropertiesForTechnique = {};
  77435. const techniquesLegacy = gltf.techniques;
  77436. if (!defined_default(techniquesLegacy)) {
  77437. return gltf;
  77438. }
  77439. ForEach_default.technique(gltf, function(techniqueLegacy, techniqueIndex) {
  77440. const renderStates = techniqueLegacy.states;
  77441. if (defined_default(renderStates)) {
  77442. const materialProperties = materialPropertiesForTechnique[techniqueIndex] = {};
  77443. if (isStateEnabled(renderStates, WebGLConstants_default.BLEND)) {
  77444. materialProperties.alphaMode = "BLEND";
  77445. const blendFunctions = renderStates.functions;
  77446. if (defined_default(blendFunctions) && (defined_default(blendFunctions.blendEquationSeparate) || defined_default(blendFunctions.blendFuncSeparate))) {
  77447. blendingForTechnique[techniqueIndex] = {
  77448. blendEquation: defaultValue_default(
  77449. blendFunctions.blendEquationSeparate,
  77450. defaultBlendEquation
  77451. ),
  77452. blendFactors: getSupportedBlendFactors(
  77453. blendFunctions.blendFuncSeparate,
  77454. defaultBlendFactors
  77455. )
  77456. };
  77457. }
  77458. }
  77459. if (!isStateEnabled(renderStates, WebGLConstants_default.CULL_FACE)) {
  77460. materialProperties.doubleSided = true;
  77461. }
  77462. delete techniqueLegacy.states;
  77463. }
  77464. });
  77465. if (Object.keys(blendingForTechnique).length > 0) {
  77466. if (!defined_default(gltf.extensions)) {
  77467. gltf.extensions = {};
  77468. }
  77469. addExtensionsUsed_default(gltf, "KHR_blend");
  77470. }
  77471. ForEach_default.material(gltf, function(material) {
  77472. if (defined_default(material.technique)) {
  77473. const materialProperties = materialPropertiesForTechnique[material.technique];
  77474. ForEach_default.objectLegacy(materialProperties, function(value, property) {
  77475. material[property] = value;
  77476. });
  77477. const blending = blendingForTechnique[material.technique];
  77478. if (defined_default(blending)) {
  77479. if (!defined_default(material.extensions)) {
  77480. material.extensions = {};
  77481. }
  77482. material.extensions.KHR_blend = blending;
  77483. }
  77484. }
  77485. });
  77486. return gltf;
  77487. }
  77488. var moveTechniqueRenderStates_default = moveTechniqueRenderStates;
  77489. // node_modules/cesium/Source/Scene/GltfPipeline/addExtensionsRequired.js
  77490. function addExtensionsRequired(gltf, extension) {
  77491. let extensionsRequired = gltf.extensionsRequired;
  77492. if (!defined_default(extensionsRequired)) {
  77493. extensionsRequired = [];
  77494. gltf.extensionsRequired = extensionsRequired;
  77495. }
  77496. addToArray_default(extensionsRequired, extension, true);
  77497. addExtensionsUsed_default(gltf, extension);
  77498. }
  77499. var addExtensionsRequired_default = addExtensionsRequired;
  77500. // node_modules/cesium/Source/Scene/GltfPipeline/moveTechniquesToExtension.js
  77501. function moveTechniquesToExtension(gltf) {
  77502. const techniquesLegacy = gltf.techniques;
  77503. const mappedUniforms = {};
  77504. const updatedTechniqueIndices = {};
  77505. const seenPrograms = {};
  77506. if (defined_default(techniquesLegacy)) {
  77507. const extension = {
  77508. programs: [],
  77509. shaders: [],
  77510. techniques: []
  77511. };
  77512. const glExtensions = gltf.glExtensionsUsed;
  77513. delete gltf.glExtensionsUsed;
  77514. ForEach_default.technique(gltf, function(techniqueLegacy, techniqueId) {
  77515. const technique = {
  77516. name: techniqueLegacy.name,
  77517. program: void 0,
  77518. attributes: {},
  77519. uniforms: {}
  77520. };
  77521. let parameterLegacy;
  77522. ForEach_default.techniqueAttribute(
  77523. techniqueLegacy,
  77524. function(parameterName, attributeName) {
  77525. parameterLegacy = techniqueLegacy.parameters[parameterName];
  77526. technique.attributes[attributeName] = {
  77527. semantic: parameterLegacy.semantic
  77528. };
  77529. }
  77530. );
  77531. ForEach_default.techniqueUniform(
  77532. techniqueLegacy,
  77533. function(parameterName, uniformName) {
  77534. parameterLegacy = techniqueLegacy.parameters[parameterName];
  77535. technique.uniforms[uniformName] = {
  77536. count: parameterLegacy.count,
  77537. node: parameterLegacy.node,
  77538. type: parameterLegacy.type,
  77539. semantic: parameterLegacy.semantic,
  77540. value: parameterLegacy.value
  77541. };
  77542. if (!defined_default(mappedUniforms[techniqueId])) {
  77543. mappedUniforms[techniqueId] = {};
  77544. }
  77545. mappedUniforms[techniqueId][parameterName] = uniformName;
  77546. }
  77547. );
  77548. if (!defined_default(seenPrograms[techniqueLegacy.program])) {
  77549. const programLegacy = gltf.programs[techniqueLegacy.program];
  77550. const program = {
  77551. name: programLegacy.name,
  77552. fragmentShader: void 0,
  77553. vertexShader: void 0,
  77554. glExtensions
  77555. };
  77556. const fs = gltf.shaders[programLegacy.fragmentShader];
  77557. program.fragmentShader = addToArray_default(extension.shaders, fs, true);
  77558. const vs = gltf.shaders[programLegacy.vertexShader];
  77559. program.vertexShader = addToArray_default(extension.shaders, vs, true);
  77560. technique.program = addToArray_default(extension.programs, program);
  77561. seenPrograms[techniqueLegacy.program] = technique.program;
  77562. } else {
  77563. technique.program = seenPrograms[techniqueLegacy.program];
  77564. }
  77565. updatedTechniqueIndices[techniqueId] = addToArray_default(
  77566. extension.techniques,
  77567. technique
  77568. );
  77569. });
  77570. if (extension.techniques.length > 0) {
  77571. if (!defined_default(gltf.extensions)) {
  77572. gltf.extensions = {};
  77573. }
  77574. gltf.extensions.KHR_techniques_webgl = extension;
  77575. addExtensionsUsed_default(gltf, "KHR_techniques_webgl");
  77576. addExtensionsRequired_default(gltf, "KHR_techniques_webgl");
  77577. }
  77578. }
  77579. ForEach_default.material(gltf, function(material) {
  77580. if (defined_default(material.technique)) {
  77581. const materialExtension = {
  77582. technique: updatedTechniqueIndices[material.technique]
  77583. };
  77584. ForEach_default.objectLegacy(material.values, function(value, parameterName) {
  77585. if (!defined_default(materialExtension.values)) {
  77586. materialExtension.values = {};
  77587. }
  77588. const uniformName = mappedUniforms[material.technique][parameterName];
  77589. materialExtension.values[uniformName] = value;
  77590. });
  77591. if (!defined_default(material.extensions)) {
  77592. material.extensions = {};
  77593. }
  77594. material.extensions.KHR_techniques_webgl = materialExtension;
  77595. }
  77596. delete material.technique;
  77597. delete material.values;
  77598. });
  77599. delete gltf.techniques;
  77600. delete gltf.programs;
  77601. delete gltf.shaders;
  77602. return gltf;
  77603. }
  77604. var moveTechniquesToExtension_default = moveTechniquesToExtension;
  77605. // node_modules/cesium/Source/Scene/GltfPipeline/forEachTextureInMaterial.js
  77606. function forEachTextureInMaterial(material, handler) {
  77607. Check_default.typeOf.object("material", material);
  77608. Check_default.defined("handler", handler);
  77609. const pbrMetallicRoughness = material.pbrMetallicRoughness;
  77610. if (defined_default(pbrMetallicRoughness)) {
  77611. if (defined_default(pbrMetallicRoughness.baseColorTexture)) {
  77612. const textureInfo = pbrMetallicRoughness.baseColorTexture;
  77613. const value2 = handler(textureInfo.index, textureInfo);
  77614. if (defined_default(value2)) {
  77615. return value2;
  77616. }
  77617. }
  77618. if (defined_default(pbrMetallicRoughness.metallicRoughnessTexture)) {
  77619. const textureInfo = pbrMetallicRoughness.metallicRoughnessTexture;
  77620. const value2 = handler(textureInfo.index, textureInfo);
  77621. if (defined_default(value2)) {
  77622. return value2;
  77623. }
  77624. }
  77625. }
  77626. if (defined_default(material.extensions)) {
  77627. const pbrSpecularGlossiness = material.extensions.KHR_materials_pbrSpecularGlossiness;
  77628. if (defined_default(pbrSpecularGlossiness)) {
  77629. if (defined_default(pbrSpecularGlossiness.diffuseTexture)) {
  77630. const textureInfo = pbrSpecularGlossiness.diffuseTexture;
  77631. const value2 = handler(textureInfo.index, textureInfo);
  77632. if (defined_default(value2)) {
  77633. return value2;
  77634. }
  77635. }
  77636. if (defined_default(pbrSpecularGlossiness.specularGlossinessTexture)) {
  77637. const textureInfo = pbrSpecularGlossiness.specularGlossinessTexture;
  77638. const value2 = handler(textureInfo.index, textureInfo);
  77639. if (defined_default(value2)) {
  77640. return value2;
  77641. }
  77642. }
  77643. }
  77644. const materialsCommon = material.extensions.KHR_materials_common;
  77645. if (defined_default(materialsCommon)) {
  77646. const diffuse = materialsCommon.values.diffuse;
  77647. const ambient = materialsCommon.values.ambient;
  77648. const emission = materialsCommon.values.emission;
  77649. const specular = materialsCommon.values.specular;
  77650. if (defined_default(diffuse) && defined_default(diffuse.index)) {
  77651. const value2 = handler(diffuse.index, diffuse);
  77652. if (defined_default(value2)) {
  77653. return value2;
  77654. }
  77655. }
  77656. if (defined_default(ambient) && defined_default(ambient.index)) {
  77657. const value2 = handler(ambient.index, ambient);
  77658. if (defined_default(value2)) {
  77659. return value2;
  77660. }
  77661. }
  77662. if (defined_default(emission) && defined_default(emission.index)) {
  77663. const value2 = handler(emission.index, emission);
  77664. if (defined_default(value2)) {
  77665. return value2;
  77666. }
  77667. }
  77668. if (defined_default(specular) && defined_default(specular.index)) {
  77669. const value2 = handler(specular.index, specular);
  77670. if (defined_default(value2)) {
  77671. return value2;
  77672. }
  77673. }
  77674. }
  77675. }
  77676. const value = ForEach_default.materialValue(material, function(materialValue) {
  77677. if (defined_default(materialValue.index)) {
  77678. const value2 = handler(materialValue.index, materialValue);
  77679. if (defined_default(value2)) {
  77680. return value2;
  77681. }
  77682. }
  77683. });
  77684. if (defined_default(value)) {
  77685. return value;
  77686. }
  77687. if (defined_default(material.emissiveTexture)) {
  77688. const textureInfo = material.emissiveTexture;
  77689. const value2 = handler(textureInfo.index, textureInfo);
  77690. if (defined_default(value2)) {
  77691. return value2;
  77692. }
  77693. }
  77694. if (defined_default(material.normalTexture)) {
  77695. const textureInfo = material.normalTexture;
  77696. const value2 = handler(textureInfo.index, textureInfo);
  77697. if (defined_default(value2)) {
  77698. return value2;
  77699. }
  77700. }
  77701. if (defined_default(material.occlusionTexture)) {
  77702. const textureInfo = material.occlusionTexture;
  77703. const value2 = handler(textureInfo.index, textureInfo);
  77704. if (defined_default(value2)) {
  77705. return value2;
  77706. }
  77707. }
  77708. }
  77709. var forEachTextureInMaterial_default = forEachTextureInMaterial;
  77710. // node_modules/cesium/Source/Scene/GltfPipeline/removeUnusedElements.js
  77711. var allElementTypes = [
  77712. "mesh",
  77713. "node",
  77714. "material",
  77715. "accessor",
  77716. "bufferView",
  77717. "buffer",
  77718. "texture",
  77719. "sampler",
  77720. "image"
  77721. ];
  77722. function removeUnusedElements(gltf, elementTypes) {
  77723. elementTypes = defaultValue_default(elementTypes, allElementTypes);
  77724. allElementTypes.forEach(function(type) {
  77725. if (elementTypes.indexOf(type) > -1) {
  77726. removeUnusedElementsByType(gltf, type);
  77727. }
  77728. });
  77729. return gltf;
  77730. }
  77731. var TypeToGltfElementName = {
  77732. accessor: "accessors",
  77733. buffer: "buffers",
  77734. bufferView: "bufferViews",
  77735. image: "images",
  77736. node: "nodes",
  77737. material: "materials",
  77738. mesh: "meshes",
  77739. sampler: "samplers",
  77740. texture: "textures"
  77741. };
  77742. function removeUnusedElementsByType(gltf, type) {
  77743. const name = TypeToGltfElementName[type];
  77744. const arrayOfObjects = gltf[name];
  77745. if (defined_default(arrayOfObjects)) {
  77746. let removed = 0;
  77747. const usedIds = getListOfElementsIdsInUse[type](gltf);
  77748. const length3 = arrayOfObjects.length;
  77749. for (let i2 = 0; i2 < length3; ++i2) {
  77750. if (!usedIds[i2]) {
  77751. Remove[type](gltf, i2 - removed);
  77752. removed++;
  77753. }
  77754. }
  77755. }
  77756. }
  77757. function Remove() {
  77758. }
  77759. Remove.accessor = function(gltf, accessorId) {
  77760. const accessors = gltf.accessors;
  77761. accessors.splice(accessorId, 1);
  77762. ForEach_default.mesh(gltf, function(mesh2) {
  77763. ForEach_default.meshPrimitive(mesh2, function(primitive) {
  77764. ForEach_default.meshPrimitiveAttribute(
  77765. primitive,
  77766. function(attributeAccessorId, semantic) {
  77767. if (attributeAccessorId > accessorId) {
  77768. primitive.attributes[semantic]--;
  77769. }
  77770. }
  77771. );
  77772. ForEach_default.meshPrimitiveTarget(primitive, function(target) {
  77773. ForEach_default.meshPrimitiveTargetAttribute(
  77774. target,
  77775. function(attributeAccessorId, semantic) {
  77776. if (attributeAccessorId > accessorId) {
  77777. target[semantic]--;
  77778. }
  77779. }
  77780. );
  77781. });
  77782. const indices2 = primitive.indices;
  77783. if (defined_default(indices2) && indices2 > accessorId) {
  77784. primitive.indices--;
  77785. }
  77786. });
  77787. });
  77788. ForEach_default.skin(gltf, function(skin) {
  77789. if (defined_default(skin.inverseBindMatrices) && skin.inverseBindMatrices > accessorId) {
  77790. skin.inverseBindMatrices--;
  77791. }
  77792. });
  77793. ForEach_default.animation(gltf, function(animation) {
  77794. ForEach_default.animationSampler(animation, function(sampler) {
  77795. if (defined_default(sampler.input) && sampler.input > accessorId) {
  77796. sampler.input--;
  77797. }
  77798. if (defined_default(sampler.output) && sampler.output > accessorId) {
  77799. sampler.output--;
  77800. }
  77801. });
  77802. });
  77803. };
  77804. Remove.buffer = function(gltf, bufferId) {
  77805. const buffers = gltf.buffers;
  77806. buffers.splice(bufferId, 1);
  77807. ForEach_default.bufferView(gltf, function(bufferView) {
  77808. if (defined_default(bufferView.buffer) && bufferView.buffer > bufferId) {
  77809. bufferView.buffer--;
  77810. }
  77811. if (defined_default(bufferView.extensions) && defined_default(bufferView.extensions.EXT_meshopt_compression)) {
  77812. bufferView.extensions.EXT_meshopt_compression.buffer--;
  77813. }
  77814. });
  77815. };
  77816. Remove.bufferView = function(gltf, bufferViewId) {
  77817. const bufferViews = gltf.bufferViews;
  77818. bufferViews.splice(bufferViewId, 1);
  77819. ForEach_default.accessor(gltf, function(accessor) {
  77820. if (defined_default(accessor.bufferView) && accessor.bufferView > bufferViewId) {
  77821. accessor.bufferView--;
  77822. }
  77823. });
  77824. ForEach_default.shader(gltf, function(shader) {
  77825. if (defined_default(shader.bufferView) && shader.bufferView > bufferViewId) {
  77826. shader.bufferView--;
  77827. }
  77828. });
  77829. ForEach_default.image(gltf, function(image) {
  77830. if (defined_default(image.bufferView) && image.bufferView > bufferViewId) {
  77831. image.bufferView--;
  77832. }
  77833. });
  77834. if (usesExtension_default(gltf, "KHR_draco_mesh_compression")) {
  77835. ForEach_default.mesh(gltf, function(mesh2) {
  77836. ForEach_default.meshPrimitive(mesh2, function(primitive) {
  77837. if (defined_default(primitive.extensions) && defined_default(primitive.extensions.KHR_draco_mesh_compression)) {
  77838. if (primitive.extensions.KHR_draco_mesh_compression.bufferView > bufferViewId) {
  77839. primitive.extensions.KHR_draco_mesh_compression.bufferView--;
  77840. }
  77841. }
  77842. });
  77843. });
  77844. }
  77845. if (usesExtension_default(gltf, "EXT_feature_metadata")) {
  77846. const extension = gltf.extensions.EXT_feature_metadata;
  77847. const featureTables = extension.featureTables;
  77848. for (const featureTableId in featureTables) {
  77849. if (featureTables.hasOwnProperty(featureTableId)) {
  77850. const featureTable = featureTables[featureTableId];
  77851. const properties = featureTable.properties;
  77852. if (defined_default(properties)) {
  77853. for (const propertyId in properties) {
  77854. if (properties.hasOwnProperty(propertyId)) {
  77855. const property = properties[propertyId];
  77856. if (defined_default(property.bufferView) && property.bufferView > bufferViewId) {
  77857. property.bufferView--;
  77858. }
  77859. if (defined_default(property.arrayOffsetBufferView) && property.arrayOffsetBufferView > bufferViewId) {
  77860. property.arrayOffsetBufferView--;
  77861. }
  77862. if (defined_default(property.stringOffsetBufferView) && property.stringOffsetBufferView > bufferViewId) {
  77863. property.stringOffsetBufferView--;
  77864. }
  77865. }
  77866. }
  77867. }
  77868. }
  77869. }
  77870. }
  77871. };
  77872. Remove.image = function(gltf, imageId) {
  77873. const images = gltf.images;
  77874. images.splice(imageId, 1);
  77875. ForEach_default.texture(gltf, function(texture) {
  77876. if (defined_default(texture.source)) {
  77877. if (texture.source > imageId) {
  77878. --texture.source;
  77879. }
  77880. }
  77881. const ext = texture.extensions;
  77882. if (defined_default(ext) && defined_default(ext.EXT_texture_webp) && ext.EXT_texture_webp.source > imageId) {
  77883. --texture.extensions.EXT_texture_webp.source;
  77884. } else if (defined_default(ext) && defined_default(ext.KHR_texture_basisu) && ext.KHR_texture_basisu.source > imageId) {
  77885. --texture.extensions.KHR_texture_basisu.source;
  77886. }
  77887. });
  77888. };
  77889. Remove.mesh = function(gltf, meshId) {
  77890. const meshes = gltf.meshes;
  77891. meshes.splice(meshId, 1);
  77892. ForEach_default.node(gltf, function(node) {
  77893. if (defined_default(node.mesh)) {
  77894. if (node.mesh > meshId) {
  77895. node.mesh--;
  77896. } else if (node.mesh === meshId) {
  77897. delete node.mesh;
  77898. }
  77899. }
  77900. });
  77901. };
  77902. Remove.node = function(gltf, nodeId) {
  77903. const nodes = gltf.nodes;
  77904. nodes.splice(nodeId, 1);
  77905. ForEach_default.skin(gltf, function(skin) {
  77906. if (defined_default(skin.skeleton) && skin.skeleton > nodeId) {
  77907. skin.skeleton--;
  77908. }
  77909. skin.joints = skin.joints.map(function(x) {
  77910. return x > nodeId ? x - 1 : x;
  77911. });
  77912. });
  77913. ForEach_default.animation(gltf, function(animation) {
  77914. ForEach_default.animationChannel(animation, function(channel) {
  77915. if (defined_default(channel.target) && defined_default(channel.target.node) && channel.target.node > nodeId) {
  77916. channel.target.node--;
  77917. }
  77918. });
  77919. });
  77920. ForEach_default.technique(gltf, function(technique) {
  77921. ForEach_default.techniqueUniform(technique, function(uniform) {
  77922. if (defined_default(uniform.node) && uniform.node > nodeId) {
  77923. uniform.node--;
  77924. }
  77925. });
  77926. });
  77927. ForEach_default.node(gltf, function(node) {
  77928. if (!defined_default(node.children)) {
  77929. return;
  77930. }
  77931. node.children = node.children.filter(function(x) {
  77932. return x !== nodeId;
  77933. }).map(function(x) {
  77934. return x > nodeId ? x - 1 : x;
  77935. });
  77936. });
  77937. ForEach_default.scene(gltf, function(scene) {
  77938. scene.nodes = scene.nodes.filter(function(x) {
  77939. return x !== nodeId;
  77940. }).map(function(x) {
  77941. return x > nodeId ? x - 1 : x;
  77942. });
  77943. });
  77944. };
  77945. Remove.material = function(gltf, materialId) {
  77946. const materials = gltf.materials;
  77947. materials.splice(materialId, 1);
  77948. ForEach_default.mesh(gltf, function(mesh2) {
  77949. ForEach_default.meshPrimitive(mesh2, function(primitive) {
  77950. if (defined_default(primitive.material) && primitive.material > materialId) {
  77951. primitive.material--;
  77952. }
  77953. });
  77954. });
  77955. };
  77956. Remove.sampler = function(gltf, samplerId) {
  77957. const samplers = gltf.samplers;
  77958. samplers.splice(samplerId, 1);
  77959. ForEach_default.texture(gltf, function(texture) {
  77960. if (defined_default(texture.sampler)) {
  77961. if (texture.sampler > samplerId) {
  77962. --texture.sampler;
  77963. }
  77964. }
  77965. });
  77966. };
  77967. Remove.texture = function(gltf, textureId) {
  77968. const textures = gltf.textures;
  77969. textures.splice(textureId, 1);
  77970. ForEach_default.material(gltf, function(material) {
  77971. forEachTextureInMaterial_default(material, function(textureIndex, textureInfo) {
  77972. if (textureInfo.index > textureId) {
  77973. --textureInfo.index;
  77974. }
  77975. });
  77976. });
  77977. if (usesExtension_default(gltf, "EXT_feature_metadata")) {
  77978. ForEach_default.mesh(gltf, function(mesh2) {
  77979. ForEach_default.meshPrimitive(mesh2, function(primitive) {
  77980. const extensions = primitive.extensions;
  77981. if (defined_default(extensions) && defined_default(extensions.EXT_feature_metadata)) {
  77982. const extension2 = extensions.EXT_feature_metadata;
  77983. const featureIdTextures = extension2.featureIdTextures;
  77984. if (defined_default(featureIdTextures)) {
  77985. const featureIdTexturesLength = featureIdTextures.length;
  77986. for (let i2 = 0; i2 < featureIdTexturesLength; ++i2) {
  77987. const featureIdTexture = featureIdTextures[i2];
  77988. const textureInfo = featureIdTexture.featureIds.texture;
  77989. if (textureInfo.index > textureId) {
  77990. --textureInfo.index;
  77991. }
  77992. }
  77993. }
  77994. }
  77995. });
  77996. });
  77997. const extension = gltf.extensions.EXT_feature_metadata;
  77998. const featureTextures = extension.featureTextures;
  77999. for (const featureTextureId in featureTextures) {
  78000. if (featureTextures.hasOwnProperty(featureTextureId)) {
  78001. const featureTexture = featureTextures[featureTextureId];
  78002. const properties = featureTexture.properties;
  78003. if (defined_default(properties)) {
  78004. for (const propertyId in properties) {
  78005. if (properties.hasOwnProperty(propertyId)) {
  78006. const property = properties[propertyId];
  78007. const textureInfo = property.texture;
  78008. if (textureInfo.index > textureId) {
  78009. --textureInfo.index;
  78010. }
  78011. }
  78012. }
  78013. }
  78014. }
  78015. }
  78016. }
  78017. };
  78018. function getListOfElementsIdsInUse() {
  78019. }
  78020. getListOfElementsIdsInUse.accessor = function(gltf) {
  78021. const usedAccessorIds = {};
  78022. ForEach_default.mesh(gltf, function(mesh2) {
  78023. ForEach_default.meshPrimitive(mesh2, function(primitive) {
  78024. ForEach_default.meshPrimitiveAttribute(primitive, function(accessorId) {
  78025. usedAccessorIds[accessorId] = true;
  78026. });
  78027. ForEach_default.meshPrimitiveTarget(primitive, function(target) {
  78028. ForEach_default.meshPrimitiveTargetAttribute(target, function(accessorId) {
  78029. usedAccessorIds[accessorId] = true;
  78030. });
  78031. });
  78032. const indices2 = primitive.indices;
  78033. if (defined_default(indices2)) {
  78034. usedAccessorIds[indices2] = true;
  78035. }
  78036. });
  78037. });
  78038. ForEach_default.skin(gltf, function(skin) {
  78039. if (defined_default(skin.inverseBindMatrices)) {
  78040. usedAccessorIds[skin.inverseBindMatrices] = true;
  78041. }
  78042. });
  78043. ForEach_default.animation(gltf, function(animation) {
  78044. ForEach_default.animationSampler(animation, function(sampler) {
  78045. if (defined_default(sampler.input)) {
  78046. usedAccessorIds[sampler.input] = true;
  78047. }
  78048. if (defined_default(sampler.output)) {
  78049. usedAccessorIds[sampler.output] = true;
  78050. }
  78051. });
  78052. });
  78053. if (usesExtension_default(gltf, "EXT_mesh_gpu_instancing")) {
  78054. ForEach_default.node(gltf, function(node) {
  78055. if (defined_default(node.extensions) && defined_default(node.extensions.EXT_mesh_gpu_instancing)) {
  78056. Object.keys(node.extensions.EXT_mesh_gpu_instancing.attributes).forEach(
  78057. function(key) {
  78058. const attributeAccessorId = node.extensions.EXT_mesh_gpu_instancing.attributes[key];
  78059. usedAccessorIds[attributeAccessorId] = true;
  78060. }
  78061. );
  78062. }
  78063. });
  78064. }
  78065. return usedAccessorIds;
  78066. };
  78067. getListOfElementsIdsInUse.buffer = function(gltf) {
  78068. const usedBufferIds = {};
  78069. ForEach_default.bufferView(gltf, function(bufferView) {
  78070. if (defined_default(bufferView.buffer)) {
  78071. usedBufferIds[bufferView.buffer] = true;
  78072. }
  78073. if (defined_default(bufferView.extensions) && defined_default(bufferView.extensions.EXT_meshopt_compression)) {
  78074. usedBufferIds[bufferView.extensions.EXT_meshopt_compression.buffer] = true;
  78075. }
  78076. });
  78077. return usedBufferIds;
  78078. };
  78079. getListOfElementsIdsInUse.bufferView = function(gltf) {
  78080. const usedBufferViewIds = {};
  78081. ForEach_default.accessor(gltf, function(accessor) {
  78082. if (defined_default(accessor.bufferView)) {
  78083. usedBufferViewIds[accessor.bufferView] = true;
  78084. }
  78085. });
  78086. ForEach_default.shader(gltf, function(shader) {
  78087. if (defined_default(shader.bufferView)) {
  78088. usedBufferViewIds[shader.bufferView] = true;
  78089. }
  78090. });
  78091. ForEach_default.image(gltf, function(image) {
  78092. if (defined_default(image.bufferView)) {
  78093. usedBufferViewIds[image.bufferView] = true;
  78094. }
  78095. });
  78096. if (usesExtension_default(gltf, "KHR_draco_mesh_compression")) {
  78097. ForEach_default.mesh(gltf, function(mesh2) {
  78098. ForEach_default.meshPrimitive(mesh2, function(primitive) {
  78099. if (defined_default(primitive.extensions) && defined_default(primitive.extensions.KHR_draco_mesh_compression)) {
  78100. usedBufferViewIds[primitive.extensions.KHR_draco_mesh_compression.bufferView] = true;
  78101. }
  78102. });
  78103. });
  78104. }
  78105. if (usesExtension_default(gltf, "EXT_feature_metadata")) {
  78106. const extension = gltf.extensions.EXT_feature_metadata;
  78107. const featureTables = extension.featureTables;
  78108. for (const featureTableId in featureTables) {
  78109. if (featureTables.hasOwnProperty(featureTableId)) {
  78110. const featureTable = featureTables[featureTableId];
  78111. const properties = featureTable.properties;
  78112. if (defined_default(properties)) {
  78113. for (const propertyId in properties) {
  78114. if (properties.hasOwnProperty(propertyId)) {
  78115. const property = properties[propertyId];
  78116. if (defined_default(property.bufferView)) {
  78117. usedBufferViewIds[property.bufferView] = true;
  78118. }
  78119. if (defined_default(property.arrayOffsetBufferView)) {
  78120. usedBufferViewIds[property.arrayOffsetBufferView] = true;
  78121. }
  78122. if (defined_default(property.stringOffsetBufferView)) {
  78123. usedBufferViewIds[property.stringOffsetBufferView] = true;
  78124. }
  78125. }
  78126. }
  78127. }
  78128. }
  78129. }
  78130. }
  78131. return usedBufferViewIds;
  78132. };
  78133. getListOfElementsIdsInUse.image = function(gltf) {
  78134. const usedImageIds = {};
  78135. ForEach_default.texture(gltf, function(texture) {
  78136. if (defined_default(texture.source)) {
  78137. usedImageIds[texture.source] = true;
  78138. }
  78139. if (defined_default(texture.extensions) && defined_default(texture.extensions.EXT_texture_webp)) {
  78140. usedImageIds[texture.extensions.EXT_texture_webp.source] = true;
  78141. } else if (defined_default(texture.extensions) && defined_default(texture.extensions.KHR_texture_basisu)) {
  78142. usedImageIds[texture.extensions.KHR_texture_basisu.source] = true;
  78143. }
  78144. });
  78145. return usedImageIds;
  78146. };
  78147. getListOfElementsIdsInUse.mesh = function(gltf) {
  78148. const usedMeshIds = {};
  78149. ForEach_default.node(gltf, function(node) {
  78150. if (defined_default(node.mesh && defined_default(gltf.meshes))) {
  78151. const mesh2 = gltf.meshes[node.mesh];
  78152. if (defined_default(mesh2) && defined_default(mesh2.primitives) && mesh2.primitives.length > 0) {
  78153. usedMeshIds[node.mesh] = true;
  78154. }
  78155. }
  78156. });
  78157. return usedMeshIds;
  78158. };
  78159. function nodeIsEmpty(gltf, nodeId, usedNodeIds) {
  78160. const node = gltf.nodes[nodeId];
  78161. if (defined_default(node.mesh) || defined_default(node.camera) || defined_default(node.skin) || defined_default(node.weights) || defined_default(node.extras) || defined_default(node.extensions) && Object.keys(node.extensions).length !== 0 || defined_default(usedNodeIds[nodeId])) {
  78162. return false;
  78163. }
  78164. return !defined_default(node.children) || node.children.filter(function(n2) {
  78165. return !nodeIsEmpty(gltf, n2, usedNodeIds);
  78166. }).length === 0;
  78167. }
  78168. getListOfElementsIdsInUse.node = function(gltf) {
  78169. const usedNodeIds = {};
  78170. ForEach_default.skin(gltf, function(skin) {
  78171. if (defined_default(skin.skeleton)) {
  78172. usedNodeIds[skin.skeleton] = true;
  78173. }
  78174. ForEach_default.skinJoint(skin, function(joint) {
  78175. usedNodeIds[joint] = true;
  78176. });
  78177. });
  78178. ForEach_default.animation(gltf, function(animation) {
  78179. ForEach_default.animationChannel(animation, function(channel) {
  78180. if (defined_default(channel.target) && defined_default(channel.target.node)) {
  78181. usedNodeIds[channel.target.node] = true;
  78182. }
  78183. });
  78184. });
  78185. ForEach_default.technique(gltf, function(technique) {
  78186. ForEach_default.techniqueUniform(technique, function(uniform) {
  78187. if (defined_default(uniform.node)) {
  78188. usedNodeIds[uniform.node] = true;
  78189. }
  78190. });
  78191. });
  78192. ForEach_default.node(gltf, function(node, nodeId) {
  78193. if (!nodeIsEmpty(gltf, nodeId, usedNodeIds)) {
  78194. usedNodeIds[nodeId] = true;
  78195. }
  78196. });
  78197. return usedNodeIds;
  78198. };
  78199. getListOfElementsIdsInUse.material = function(gltf) {
  78200. const usedMaterialIds = {};
  78201. ForEach_default.mesh(gltf, function(mesh2) {
  78202. ForEach_default.meshPrimitive(mesh2, function(primitive) {
  78203. if (defined_default(primitive.material)) {
  78204. usedMaterialIds[primitive.material] = true;
  78205. }
  78206. });
  78207. });
  78208. return usedMaterialIds;
  78209. };
  78210. getListOfElementsIdsInUse.texture = function(gltf) {
  78211. const usedTextureIds = {};
  78212. ForEach_default.material(gltf, function(material) {
  78213. forEachTextureInMaterial_default(material, function(textureId) {
  78214. usedTextureIds[textureId] = true;
  78215. });
  78216. });
  78217. if (usesExtension_default(gltf, "EXT_feature_metadata")) {
  78218. ForEach_default.mesh(gltf, function(mesh2) {
  78219. ForEach_default.meshPrimitive(mesh2, function(primitive) {
  78220. const extensions = primitive.extensions;
  78221. if (defined_default(extensions) && defined_default(extensions.EXT_feature_metadata)) {
  78222. const extension2 = extensions.EXT_feature_metadata;
  78223. const featureIdTextures = extension2.featureIdTextures;
  78224. if (defined_default(featureIdTextures)) {
  78225. const featureIdTexturesLength = featureIdTextures.length;
  78226. for (let i2 = 0; i2 < featureIdTexturesLength; ++i2) {
  78227. const featureIdTexture = featureIdTextures[i2];
  78228. const textureInfo = featureIdTexture.featureIds.texture;
  78229. usedTextureIds[textureInfo.index] = true;
  78230. }
  78231. }
  78232. }
  78233. });
  78234. });
  78235. const extension = gltf.extensions.EXT_feature_metadata;
  78236. const featureTextures = extension.featureTextures;
  78237. for (const featureTextureId in featureTextures) {
  78238. if (featureTextures.hasOwnProperty(featureTextureId)) {
  78239. const featureTexture = featureTextures[featureTextureId];
  78240. const properties = featureTexture.properties;
  78241. if (defined_default(properties)) {
  78242. for (const propertyId in properties) {
  78243. if (properties.hasOwnProperty(propertyId)) {
  78244. const property = properties[propertyId];
  78245. const textureInfo = property.texture;
  78246. usedTextureIds[textureInfo.index] = true;
  78247. }
  78248. }
  78249. }
  78250. }
  78251. }
  78252. }
  78253. return usedTextureIds;
  78254. };
  78255. getListOfElementsIdsInUse.sampler = function(gltf) {
  78256. const usedSamplerIds = {};
  78257. ForEach_default.texture(gltf, function(texture) {
  78258. if (defined_default(texture.sampler)) {
  78259. usedSamplerIds[texture.sampler] = true;
  78260. }
  78261. });
  78262. return usedSamplerIds;
  78263. };
  78264. var removeUnusedElements_default = removeUnusedElements;
  78265. // node_modules/cesium/Source/Scene/GltfPipeline/addBuffer.js
  78266. function addBuffer(gltf, buffer) {
  78267. const newBuffer = {
  78268. byteLength: buffer.length,
  78269. extras: {
  78270. _pipeline: {
  78271. source: buffer
  78272. }
  78273. }
  78274. };
  78275. const bufferId = addToArray_default(gltf.buffers, newBuffer);
  78276. const bufferView = {
  78277. buffer: bufferId,
  78278. byteOffset: 0,
  78279. byteLength: buffer.length
  78280. };
  78281. return addToArray_default(gltf.bufferViews, bufferView);
  78282. }
  78283. var addBuffer_default = addBuffer;
  78284. // node_modules/cesium/Source/Scene/GltfPipeline/readAccessorPacked.js
  78285. function readAccessorPacked(gltf, accessor) {
  78286. const byteStride = getAccessorByteStride_default(gltf, accessor);
  78287. const componentTypeByteLength = ComponentDatatype_default.getSizeInBytes(
  78288. accessor.componentType
  78289. );
  78290. const numberOfComponents = numberOfComponentsForType_default(accessor.type);
  78291. const count = accessor.count;
  78292. const values = new Array(numberOfComponents * count);
  78293. if (!defined_default(accessor.bufferView)) {
  78294. arrayFill_default(values, 0);
  78295. return values;
  78296. }
  78297. const bufferView = gltf.bufferViews[accessor.bufferView];
  78298. const source = gltf.buffers[bufferView.buffer].extras._pipeline.source;
  78299. let byteOffset = accessor.byteOffset + bufferView.byteOffset + source.byteOffset;
  78300. const dataView = new DataView(source.buffer);
  78301. const components = new Array(numberOfComponents);
  78302. const componentReader = getComponentReader_default(accessor.componentType);
  78303. for (let i2 = 0; i2 < count; ++i2) {
  78304. componentReader(
  78305. dataView,
  78306. byteOffset,
  78307. numberOfComponents,
  78308. componentTypeByteLength,
  78309. components
  78310. );
  78311. for (let j = 0; j < numberOfComponents; ++j) {
  78312. values[i2 * numberOfComponents + j] = components[j];
  78313. }
  78314. byteOffset += byteStride;
  78315. }
  78316. return values;
  78317. }
  78318. var readAccessorPacked_default = readAccessorPacked;
  78319. // node_modules/cesium/Source/Scene/GltfPipeline/updateAccessorComponentTypes.js
  78320. function updateAccessorComponentTypes(gltf) {
  78321. let componentType;
  78322. ForEach_default.accessorWithSemantic(gltf, "JOINTS_0", function(accessorId) {
  78323. const accessor = gltf.accessors[accessorId];
  78324. componentType = accessor.componentType;
  78325. if (componentType === WebGLConstants_default.BYTE) {
  78326. convertType(gltf, accessor, ComponentDatatype_default.UNSIGNED_BYTE);
  78327. } else if (componentType !== WebGLConstants_default.UNSIGNED_BYTE && componentType !== WebGLConstants_default.UNSIGNED_SHORT) {
  78328. convertType(gltf, accessor, ComponentDatatype_default.UNSIGNED_SHORT);
  78329. }
  78330. });
  78331. ForEach_default.accessorWithSemantic(gltf, "WEIGHTS_0", function(accessorId) {
  78332. const accessor = gltf.accessors[accessorId];
  78333. componentType = accessor.componentType;
  78334. if (componentType === WebGLConstants_default.BYTE) {
  78335. convertType(gltf, accessor, ComponentDatatype_default.UNSIGNED_BYTE);
  78336. } else if (componentType === WebGLConstants_default.SHORT) {
  78337. convertType(gltf, accessor, ComponentDatatype_default.UNSIGNED_SHORT);
  78338. }
  78339. });
  78340. return gltf;
  78341. }
  78342. function convertType(gltf, accessor, updatedComponentType) {
  78343. const typedArray = ComponentDatatype_default.createTypedArray(
  78344. updatedComponentType,
  78345. readAccessorPacked_default(gltf, accessor)
  78346. );
  78347. const newBuffer = new Uint8Array(typedArray.buffer);
  78348. accessor.bufferView = addBuffer_default(gltf, newBuffer);
  78349. accessor.componentType = updatedComponentType;
  78350. accessor.byteOffset = 0;
  78351. }
  78352. var updateAccessorComponentTypes_default = updateAccessorComponentTypes;
  78353. // node_modules/cesium/Source/Scene/GltfPipeline/updateVersion.js
  78354. var updateFunctions = {
  78355. 0.8: glTF08to10,
  78356. "1.0": glTF10to20,
  78357. "2.0": void 0
  78358. };
  78359. function updateVersion(gltf, options) {
  78360. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  78361. const targetVersion = options.targetVersion;
  78362. let version = gltf.version;
  78363. gltf.asset = defaultValue_default(gltf.asset, {
  78364. version: "1.0"
  78365. });
  78366. gltf.asset.version = defaultValue_default(gltf.asset.version, "1.0");
  78367. version = defaultValue_default(version, gltf.asset.version).toString();
  78368. if (!Object.prototype.hasOwnProperty.call(updateFunctions, version)) {
  78369. if (defined_default(version)) {
  78370. version = version.substring(0, 3);
  78371. }
  78372. if (!Object.prototype.hasOwnProperty.call(updateFunctions, version)) {
  78373. version = "1.0";
  78374. }
  78375. }
  78376. let updateFunction = updateFunctions[version];
  78377. while (defined_default(updateFunction)) {
  78378. if (version === targetVersion) {
  78379. break;
  78380. }
  78381. updateFunction(gltf, options);
  78382. version = gltf.asset.version;
  78383. updateFunction = updateFunctions[version];
  78384. }
  78385. return gltf;
  78386. }
  78387. function updateInstanceTechniques(gltf) {
  78388. const materials = gltf.materials;
  78389. for (const materialId in materials) {
  78390. if (Object.prototype.hasOwnProperty.call(materials, materialId)) {
  78391. const material = materials[materialId];
  78392. const instanceTechnique = material.instanceTechnique;
  78393. if (defined_default(instanceTechnique)) {
  78394. material.technique = instanceTechnique.technique;
  78395. material.values = instanceTechnique.values;
  78396. delete material.instanceTechnique;
  78397. }
  78398. }
  78399. }
  78400. }
  78401. function setPrimitiveModes(gltf) {
  78402. const meshes = gltf.meshes;
  78403. for (const meshId in meshes) {
  78404. if (Object.prototype.hasOwnProperty.call(meshes, meshId)) {
  78405. const mesh2 = meshes[meshId];
  78406. const primitives = mesh2.primitives;
  78407. if (defined_default(primitives)) {
  78408. const primitivesLength = primitives.length;
  78409. for (let i2 = 0; i2 < primitivesLength; ++i2) {
  78410. const primitive = primitives[i2];
  78411. const defaultMode = defaultValue_default(
  78412. primitive.primitive,
  78413. WebGLConstants_default.TRIANGLES
  78414. );
  78415. primitive.mode = defaultValue_default(primitive.mode, defaultMode);
  78416. delete primitive.primitive;
  78417. }
  78418. }
  78419. }
  78420. }
  78421. }
  78422. function updateNodes(gltf) {
  78423. const nodes = gltf.nodes;
  78424. const axis = new Cartesian3_default();
  78425. const quat = new Quaternion_default();
  78426. for (const nodeId in nodes) {
  78427. if (Object.prototype.hasOwnProperty.call(nodes, nodeId)) {
  78428. const node = nodes[nodeId];
  78429. if (defined_default(node.rotation)) {
  78430. const rotation = node.rotation;
  78431. Cartesian3_default.fromArray(rotation, 0, axis);
  78432. Quaternion_default.fromAxisAngle(axis, rotation[3], quat);
  78433. node.rotation = [quat.x, quat.y, quat.z, quat.w];
  78434. }
  78435. const instanceSkin = node.instanceSkin;
  78436. if (defined_default(instanceSkin)) {
  78437. node.skeletons = instanceSkin.skeletons;
  78438. node.skin = instanceSkin.skin;
  78439. node.meshes = instanceSkin.meshes;
  78440. delete node.instanceSkin;
  78441. }
  78442. }
  78443. }
  78444. }
  78445. function updateAnimations(gltf) {
  78446. const animations = gltf.animations;
  78447. const accessors = gltf.accessors;
  78448. const bufferViews = gltf.bufferViews;
  78449. const buffers = gltf.buffers;
  78450. const updatedAccessors = {};
  78451. const axis = new Cartesian3_default();
  78452. const quat = new Quaternion_default();
  78453. for (const animationId in animations) {
  78454. if (Object.prototype.hasOwnProperty.call(animations, animationId)) {
  78455. const animation = animations[animationId];
  78456. const channels = animation.channels;
  78457. const parameters = animation.parameters;
  78458. const samplers = animation.samplers;
  78459. if (defined_default(channels)) {
  78460. const channelsLength = channels.length;
  78461. for (let i2 = 0; i2 < channelsLength; ++i2) {
  78462. const channel = channels[i2];
  78463. if (channel.target.path === "rotation") {
  78464. const accessorId = parameters[samplers[channel.sampler].output];
  78465. if (defined_default(updatedAccessors[accessorId])) {
  78466. continue;
  78467. }
  78468. updatedAccessors[accessorId] = true;
  78469. const accessor = accessors[accessorId];
  78470. const bufferView = bufferViews[accessor.bufferView];
  78471. const buffer = buffers[bufferView.buffer];
  78472. const source = buffer.extras._pipeline.source;
  78473. const byteOffset = source.byteOffset + bufferView.byteOffset + accessor.byteOffset;
  78474. const componentType = accessor.componentType;
  78475. const count = accessor.count;
  78476. const componentsLength = numberOfComponentsForType_default(accessor.type);
  78477. const length3 = accessor.count * componentsLength;
  78478. const typedArray = ComponentDatatype_default.createArrayBufferView(
  78479. componentType,
  78480. source.buffer,
  78481. byteOffset,
  78482. length3
  78483. );
  78484. for (let j = 0; j < count; j++) {
  78485. const offset2 = j * componentsLength;
  78486. Cartesian3_default.unpack(typedArray, offset2, axis);
  78487. const angle = typedArray[offset2 + 3];
  78488. Quaternion_default.fromAxisAngle(axis, angle, quat);
  78489. Quaternion_default.pack(quat, typedArray, offset2);
  78490. }
  78491. }
  78492. }
  78493. }
  78494. }
  78495. }
  78496. }
  78497. function removeTechniquePasses(gltf) {
  78498. const techniques = gltf.techniques;
  78499. for (const techniqueId in techniques) {
  78500. if (Object.prototype.hasOwnProperty.call(techniques, techniqueId)) {
  78501. const technique = techniques[techniqueId];
  78502. const passes = technique.passes;
  78503. if (defined_default(passes)) {
  78504. const passName = defaultValue_default(technique.pass, "defaultPass");
  78505. if (Object.prototype.hasOwnProperty.call(passes, passName)) {
  78506. const pass = passes[passName];
  78507. const instanceProgram = pass.instanceProgram;
  78508. technique.attributes = defaultValue_default(
  78509. technique.attributes,
  78510. instanceProgram.attributes
  78511. );
  78512. technique.program = defaultValue_default(
  78513. technique.program,
  78514. instanceProgram.program
  78515. );
  78516. technique.uniforms = defaultValue_default(
  78517. technique.uniforms,
  78518. instanceProgram.uniforms
  78519. );
  78520. technique.states = defaultValue_default(technique.states, pass.states);
  78521. }
  78522. delete technique.passes;
  78523. delete technique.pass;
  78524. }
  78525. }
  78526. }
  78527. }
  78528. function glTF08to10(gltf) {
  78529. if (!defined_default(gltf.asset)) {
  78530. gltf.asset = {};
  78531. }
  78532. const asset = gltf.asset;
  78533. asset.version = "1.0";
  78534. if (typeof asset.profile === "string") {
  78535. const split = asset.profile.split(" ");
  78536. asset.profile = {
  78537. api: split[0],
  78538. version: split[1]
  78539. };
  78540. } else {
  78541. asset.profile = {};
  78542. }
  78543. if (defined_default(gltf.version)) {
  78544. delete gltf.version;
  78545. }
  78546. updateInstanceTechniques(gltf);
  78547. setPrimitiveModes(gltf);
  78548. updateNodes(gltf);
  78549. updateAnimations(gltf);
  78550. removeTechniquePasses(gltf);
  78551. if (defined_default(gltf.allExtensions)) {
  78552. gltf.extensionsUsed = gltf.allExtensions;
  78553. delete gltf.allExtensions;
  78554. }
  78555. if (defined_default(gltf.lights)) {
  78556. const extensions = defaultValue_default(gltf.extensions, {});
  78557. gltf.extensions = extensions;
  78558. const materialsCommon = defaultValue_default(extensions.KHR_materials_common, {});
  78559. extensions.KHR_materials_common = materialsCommon;
  78560. materialsCommon.lights = gltf.lights;
  78561. delete gltf.lights;
  78562. addExtensionsUsed_default(gltf, "KHR_materials_common");
  78563. }
  78564. }
  78565. function removeAnimationSamplersIndirection(gltf) {
  78566. const animations = gltf.animations;
  78567. for (const animationId in animations) {
  78568. if (Object.prototype.hasOwnProperty.call(animations, animationId)) {
  78569. const animation = animations[animationId];
  78570. const parameters = animation.parameters;
  78571. if (defined_default(parameters)) {
  78572. const samplers = animation.samplers;
  78573. for (const samplerId in samplers) {
  78574. if (Object.prototype.hasOwnProperty.call(samplers, samplerId)) {
  78575. const sampler = samplers[samplerId];
  78576. sampler.input = parameters[sampler.input];
  78577. sampler.output = parameters[sampler.output];
  78578. }
  78579. }
  78580. delete animation.parameters;
  78581. }
  78582. }
  78583. }
  78584. }
  78585. function objectToArray(object2, mapping) {
  78586. const array = [];
  78587. for (const id in object2) {
  78588. if (Object.prototype.hasOwnProperty.call(object2, id)) {
  78589. const value = object2[id];
  78590. mapping[id] = array.length;
  78591. array.push(value);
  78592. if (!defined_default(value.name)) {
  78593. value.name = id;
  78594. }
  78595. }
  78596. }
  78597. return array;
  78598. }
  78599. function objectsToArrays(gltf) {
  78600. let i2;
  78601. const globalMapping = {
  78602. accessors: {},
  78603. animations: {},
  78604. buffers: {},
  78605. bufferViews: {},
  78606. cameras: {},
  78607. images: {},
  78608. materials: {},
  78609. meshes: {},
  78610. nodes: {},
  78611. programs: {},
  78612. samplers: {},
  78613. scenes: {},
  78614. shaders: {},
  78615. skins: {},
  78616. textures: {},
  78617. techniques: {}
  78618. };
  78619. let jointName;
  78620. const jointNameToId = {};
  78621. const nodes = gltf.nodes;
  78622. for (const id in nodes) {
  78623. if (Object.prototype.hasOwnProperty.call(nodes, id)) {
  78624. jointName = nodes[id].jointName;
  78625. if (defined_default(jointName)) {
  78626. jointNameToId[jointName] = id;
  78627. }
  78628. }
  78629. }
  78630. for (const topLevelId in gltf) {
  78631. if (Object.prototype.hasOwnProperty.call(gltf, topLevelId) && defined_default(globalMapping[topLevelId])) {
  78632. const objectMapping = {};
  78633. const object2 = gltf[topLevelId];
  78634. gltf[topLevelId] = objectToArray(object2, objectMapping);
  78635. globalMapping[topLevelId] = objectMapping;
  78636. }
  78637. }
  78638. for (jointName in jointNameToId) {
  78639. if (Object.prototype.hasOwnProperty.call(jointNameToId, jointName)) {
  78640. jointNameToId[jointName] = globalMapping.nodes[jointNameToId[jointName]];
  78641. }
  78642. }
  78643. if (defined_default(gltf.scene)) {
  78644. gltf.scene = globalMapping.scenes[gltf.scene];
  78645. }
  78646. ForEach_default.bufferView(gltf, function(bufferView) {
  78647. if (defined_default(bufferView.buffer)) {
  78648. bufferView.buffer = globalMapping.buffers[bufferView.buffer];
  78649. }
  78650. });
  78651. ForEach_default.accessor(gltf, function(accessor) {
  78652. if (defined_default(accessor.bufferView)) {
  78653. accessor.bufferView = globalMapping.bufferViews[accessor.bufferView];
  78654. }
  78655. });
  78656. ForEach_default.shader(gltf, function(shader) {
  78657. const extensions = shader.extensions;
  78658. if (defined_default(extensions)) {
  78659. const binaryGltf = extensions.KHR_binary_glTF;
  78660. if (defined_default(binaryGltf)) {
  78661. shader.bufferView = globalMapping.bufferViews[binaryGltf.bufferView];
  78662. delete extensions.KHR_binary_glTF;
  78663. }
  78664. if (Object.keys(extensions).length === 0) {
  78665. delete shader.extensions;
  78666. }
  78667. }
  78668. });
  78669. ForEach_default.program(gltf, function(program) {
  78670. if (defined_default(program.vertexShader)) {
  78671. program.vertexShader = globalMapping.shaders[program.vertexShader];
  78672. }
  78673. if (defined_default(program.fragmentShader)) {
  78674. program.fragmentShader = globalMapping.shaders[program.fragmentShader];
  78675. }
  78676. });
  78677. ForEach_default.technique(gltf, function(technique) {
  78678. if (defined_default(technique.program)) {
  78679. technique.program = globalMapping.programs[technique.program];
  78680. }
  78681. ForEach_default.techniqueParameter(technique, function(parameter) {
  78682. if (defined_default(parameter.node)) {
  78683. parameter.node = globalMapping.nodes[parameter.node];
  78684. }
  78685. const value = parameter.value;
  78686. if (typeof value === "string") {
  78687. parameter.value = {
  78688. index: globalMapping.textures[value]
  78689. };
  78690. }
  78691. });
  78692. });
  78693. ForEach_default.mesh(gltf, function(mesh2) {
  78694. ForEach_default.meshPrimitive(mesh2, function(primitive) {
  78695. if (defined_default(primitive.indices)) {
  78696. primitive.indices = globalMapping.accessors[primitive.indices];
  78697. }
  78698. ForEach_default.meshPrimitiveAttribute(
  78699. primitive,
  78700. function(accessorId, semantic) {
  78701. primitive.attributes[semantic] = globalMapping.accessors[accessorId];
  78702. }
  78703. );
  78704. if (defined_default(primitive.material)) {
  78705. primitive.material = globalMapping.materials[primitive.material];
  78706. }
  78707. });
  78708. });
  78709. ForEach_default.node(gltf, function(node) {
  78710. let children = node.children;
  78711. if (defined_default(children)) {
  78712. const childrenLength = children.length;
  78713. for (i2 = 0; i2 < childrenLength; ++i2) {
  78714. children[i2] = globalMapping.nodes[children[i2]];
  78715. }
  78716. }
  78717. if (defined_default(node.meshes)) {
  78718. const meshes = node.meshes;
  78719. const meshesLength = meshes.length;
  78720. if (meshesLength > 0) {
  78721. node.mesh = globalMapping.meshes[meshes[0]];
  78722. for (i2 = 1; i2 < meshesLength; ++i2) {
  78723. const meshNode = {
  78724. mesh: globalMapping.meshes[meshes[i2]]
  78725. };
  78726. const meshNodeId = addToArray_default(gltf.nodes, meshNode);
  78727. if (!defined_default(children)) {
  78728. children = [];
  78729. node.children = children;
  78730. }
  78731. children.push(meshNodeId);
  78732. }
  78733. }
  78734. delete node.meshes;
  78735. }
  78736. if (defined_default(node.camera)) {
  78737. node.camera = globalMapping.cameras[node.camera];
  78738. }
  78739. if (defined_default(node.skin)) {
  78740. node.skin = globalMapping.skins[node.skin];
  78741. }
  78742. if (defined_default(node.skeletons)) {
  78743. const skeletons = node.skeletons;
  78744. const skeletonsLength = skeletons.length;
  78745. if (skeletonsLength > 0 && defined_default(node.skin)) {
  78746. const skin = gltf.skins[node.skin];
  78747. skin.skeleton = globalMapping.nodes[skeletons[0]];
  78748. }
  78749. delete node.skeletons;
  78750. }
  78751. if (defined_default(node.jointName)) {
  78752. delete node.jointName;
  78753. }
  78754. });
  78755. ForEach_default.skin(gltf, function(skin) {
  78756. if (defined_default(skin.inverseBindMatrices)) {
  78757. skin.inverseBindMatrices = globalMapping.accessors[skin.inverseBindMatrices];
  78758. }
  78759. const jointNames = skin.jointNames;
  78760. if (defined_default(jointNames)) {
  78761. const joints = [];
  78762. const jointNamesLength = jointNames.length;
  78763. for (i2 = 0; i2 < jointNamesLength; ++i2) {
  78764. joints[i2] = jointNameToId[jointNames[i2]];
  78765. }
  78766. skin.joints = joints;
  78767. delete skin.jointNames;
  78768. }
  78769. });
  78770. ForEach_default.scene(gltf, function(scene) {
  78771. const sceneNodes = scene.nodes;
  78772. if (defined_default(sceneNodes)) {
  78773. const sceneNodesLength = sceneNodes.length;
  78774. for (i2 = 0; i2 < sceneNodesLength; ++i2) {
  78775. sceneNodes[i2] = globalMapping.nodes[sceneNodes[i2]];
  78776. }
  78777. }
  78778. });
  78779. ForEach_default.animation(gltf, function(animation) {
  78780. const samplerMapping = {};
  78781. animation.samplers = objectToArray(animation.samplers, samplerMapping);
  78782. ForEach_default.animationSampler(animation, function(sampler) {
  78783. sampler.input = globalMapping.accessors[sampler.input];
  78784. sampler.output = globalMapping.accessors[sampler.output];
  78785. });
  78786. ForEach_default.animationChannel(animation, function(channel) {
  78787. channel.sampler = samplerMapping[channel.sampler];
  78788. const target = channel.target;
  78789. if (defined_default(target)) {
  78790. target.node = globalMapping.nodes[target.id];
  78791. delete target.id;
  78792. }
  78793. });
  78794. });
  78795. ForEach_default.material(gltf, function(material) {
  78796. if (defined_default(material.technique)) {
  78797. material.technique = globalMapping.techniques[material.technique];
  78798. }
  78799. ForEach_default.materialValue(material, function(value, name) {
  78800. if (typeof value === "string") {
  78801. material.values[name] = {
  78802. index: globalMapping.textures[value]
  78803. };
  78804. }
  78805. });
  78806. const extensions = material.extensions;
  78807. if (defined_default(extensions)) {
  78808. const materialsCommon = extensions.KHR_materials_common;
  78809. if (defined_default(materialsCommon)) {
  78810. ForEach_default.materialValue(materialsCommon, function(value, name) {
  78811. if (typeof value === "string") {
  78812. materialsCommon.values[name] = {
  78813. index: globalMapping.textures[value]
  78814. };
  78815. }
  78816. });
  78817. }
  78818. }
  78819. });
  78820. ForEach_default.image(gltf, function(image) {
  78821. const extensions = image.extensions;
  78822. if (defined_default(extensions)) {
  78823. const binaryGltf = extensions.KHR_binary_glTF;
  78824. if (defined_default(binaryGltf)) {
  78825. image.bufferView = globalMapping.bufferViews[binaryGltf.bufferView];
  78826. image.mimeType = binaryGltf.mimeType;
  78827. delete extensions.KHR_binary_glTF;
  78828. }
  78829. if (Object.keys(extensions).length === 0) {
  78830. delete image.extensions;
  78831. }
  78832. }
  78833. });
  78834. ForEach_default.texture(gltf, function(texture) {
  78835. if (defined_default(texture.sampler)) {
  78836. texture.sampler = globalMapping.samplers[texture.sampler];
  78837. }
  78838. if (defined_default(texture.source)) {
  78839. texture.source = globalMapping.images[texture.source];
  78840. }
  78841. });
  78842. }
  78843. function removeAnimationSamplerNames(gltf) {
  78844. ForEach_default.animation(gltf, function(animation) {
  78845. ForEach_default.animationSampler(animation, function(sampler) {
  78846. delete sampler.name;
  78847. });
  78848. });
  78849. }
  78850. function removeEmptyArrays(gltf) {
  78851. for (const topLevelId in gltf) {
  78852. if (Object.prototype.hasOwnProperty.call(gltf, topLevelId)) {
  78853. const array = gltf[topLevelId];
  78854. if (Array.isArray(array) && array.length === 0) {
  78855. delete gltf[topLevelId];
  78856. }
  78857. }
  78858. }
  78859. ForEach_default.node(gltf, function(node) {
  78860. if (defined_default(node.children) && node.children.length === 0) {
  78861. delete node.children;
  78862. }
  78863. });
  78864. }
  78865. function stripAsset(gltf) {
  78866. const asset = gltf.asset;
  78867. delete asset.profile;
  78868. delete asset.premultipliedAlpha;
  78869. }
  78870. var knownExtensions = {
  78871. CESIUM_RTC: true,
  78872. KHR_materials_common: true,
  78873. WEB3D_quantized_attributes: true
  78874. };
  78875. function requireKnownExtensions(gltf) {
  78876. const extensionsUsed = gltf.extensionsUsed;
  78877. gltf.extensionsRequired = defaultValue_default(gltf.extensionsRequired, []);
  78878. if (defined_default(extensionsUsed)) {
  78879. const extensionsUsedLength = extensionsUsed.length;
  78880. for (let i2 = 0; i2 < extensionsUsedLength; ++i2) {
  78881. const extension = extensionsUsed[i2];
  78882. if (defined_default(knownExtensions[extension])) {
  78883. gltf.extensionsRequired.push(extension);
  78884. }
  78885. }
  78886. }
  78887. }
  78888. function removeBufferType(gltf) {
  78889. ForEach_default.buffer(gltf, function(buffer) {
  78890. delete buffer.type;
  78891. });
  78892. }
  78893. function removeTextureProperties(gltf) {
  78894. ForEach_default.texture(gltf, function(texture) {
  78895. delete texture.format;
  78896. delete texture.internalFormat;
  78897. delete texture.target;
  78898. delete texture.type;
  78899. });
  78900. }
  78901. function requireAttributeSetIndex(gltf) {
  78902. ForEach_default.mesh(gltf, function(mesh2) {
  78903. ForEach_default.meshPrimitive(mesh2, function(primitive) {
  78904. ForEach_default.meshPrimitiveAttribute(
  78905. primitive,
  78906. function(accessorId, semantic) {
  78907. if (semantic === "TEXCOORD") {
  78908. primitive.attributes.TEXCOORD_0 = accessorId;
  78909. } else if (semantic === "COLOR") {
  78910. primitive.attributes.COLOR_0 = accessorId;
  78911. }
  78912. }
  78913. );
  78914. delete primitive.attributes.TEXCOORD;
  78915. delete primitive.attributes.COLOR;
  78916. });
  78917. });
  78918. ForEach_default.technique(gltf, function(technique) {
  78919. ForEach_default.techniqueParameter(technique, function(parameter) {
  78920. const semantic = parameter.semantic;
  78921. if (defined_default(semantic)) {
  78922. if (semantic === "TEXCOORD") {
  78923. parameter.semantic = "TEXCOORD_0";
  78924. } else if (semantic === "COLOR") {
  78925. parameter.semantic = "COLOR_0";
  78926. }
  78927. }
  78928. });
  78929. });
  78930. }
  78931. var knownSemantics = {
  78932. POSITION: true,
  78933. NORMAL: true,
  78934. TANGENT: true
  78935. };
  78936. var indexedSemantics = {
  78937. COLOR: "COLOR",
  78938. JOINT: "JOINTS",
  78939. JOINTS: "JOINTS",
  78940. TEXCOORD: "TEXCOORD",
  78941. WEIGHT: "WEIGHTS",
  78942. WEIGHTS: "WEIGHTS"
  78943. };
  78944. function underscoreApplicationSpecificSemantics(gltf) {
  78945. const mappedSemantics = {};
  78946. ForEach_default.mesh(gltf, function(mesh2) {
  78947. ForEach_default.meshPrimitive(mesh2, function(primitive) {
  78948. ForEach_default.meshPrimitiveAttribute(
  78949. primitive,
  78950. function(accessorId, semantic) {
  78951. if (semantic.charAt(0) !== "_") {
  78952. const setIndex = semantic.search(/_[0-9]+/g);
  78953. let strippedSemantic = semantic;
  78954. let suffix = "_0";
  78955. if (setIndex >= 0) {
  78956. strippedSemantic = semantic.substring(0, setIndex);
  78957. suffix = semantic.substring(setIndex);
  78958. }
  78959. let newSemantic;
  78960. const indexedSemantic = indexedSemantics[strippedSemantic];
  78961. if (defined_default(indexedSemantic)) {
  78962. newSemantic = indexedSemantic + suffix;
  78963. mappedSemantics[semantic] = newSemantic;
  78964. } else if (!defined_default(knownSemantics[strippedSemantic])) {
  78965. newSemantic = "_" + semantic;
  78966. mappedSemantics[semantic] = newSemantic;
  78967. }
  78968. }
  78969. }
  78970. );
  78971. for (const semantic in mappedSemantics) {
  78972. if (Object.prototype.hasOwnProperty.call(mappedSemantics, semantic)) {
  78973. const mappedSemantic = mappedSemantics[semantic];
  78974. const accessorId = primitive.attributes[semantic];
  78975. if (defined_default(accessorId)) {
  78976. delete primitive.attributes[semantic];
  78977. primitive.attributes[mappedSemantic] = accessorId;
  78978. }
  78979. }
  78980. }
  78981. });
  78982. });
  78983. ForEach_default.technique(gltf, function(technique) {
  78984. ForEach_default.techniqueParameter(technique, function(parameter) {
  78985. const mappedSemantic = mappedSemantics[parameter.semantic];
  78986. if (defined_default(mappedSemantic)) {
  78987. parameter.semantic = mappedSemantic;
  78988. }
  78989. });
  78990. });
  78991. }
  78992. function clampCameraParameters(gltf) {
  78993. ForEach_default.camera(gltf, function(camera) {
  78994. const perspective = camera.perspective;
  78995. if (defined_default(perspective)) {
  78996. const aspectRatio = perspective.aspectRatio;
  78997. if (defined_default(aspectRatio) && aspectRatio === 0) {
  78998. delete perspective.aspectRatio;
  78999. }
  79000. const yfov = perspective.yfov;
  79001. if (defined_default(yfov) && yfov === 0) {
  79002. perspective.yfov = 1;
  79003. }
  79004. }
  79005. });
  79006. }
  79007. function computeAccessorByteStride(gltf, accessor) {
  79008. return defined_default(accessor.byteStride) && accessor.byteStride !== 0 ? accessor.byteStride : getAccessorByteStride_default(gltf, accessor);
  79009. }
  79010. function requireByteLength(gltf) {
  79011. ForEach_default.buffer(gltf, function(buffer) {
  79012. if (!defined_default(buffer.byteLength)) {
  79013. buffer.byteLength = buffer.extras._pipeline.source.length;
  79014. }
  79015. });
  79016. ForEach_default.accessor(gltf, function(accessor) {
  79017. const bufferViewId = accessor.bufferView;
  79018. if (defined_default(bufferViewId)) {
  79019. const bufferView = gltf.bufferViews[bufferViewId];
  79020. const accessorByteStride = computeAccessorByteStride(gltf, accessor);
  79021. const accessorByteEnd = accessor.byteOffset + accessor.count * accessorByteStride;
  79022. bufferView.byteLength = Math.max(
  79023. defaultValue_default(bufferView.byteLength, 0),
  79024. accessorByteEnd
  79025. );
  79026. }
  79027. });
  79028. }
  79029. function moveByteStrideToBufferView(gltf) {
  79030. let i2;
  79031. let j;
  79032. let bufferView;
  79033. const bufferViews = gltf.bufferViews;
  79034. const bufferViewHasVertexAttributes = {};
  79035. ForEach_default.accessorContainingVertexAttributeData(gltf, function(accessorId) {
  79036. const accessor = gltf.accessors[accessorId];
  79037. if (defined_default(accessor.bufferView)) {
  79038. bufferViewHasVertexAttributes[accessor.bufferView] = true;
  79039. }
  79040. });
  79041. const bufferViewMap = {};
  79042. ForEach_default.accessor(gltf, function(accessor) {
  79043. if (defined_default(accessor.bufferView)) {
  79044. bufferViewMap[accessor.bufferView] = defaultValue_default(
  79045. bufferViewMap[accessor.bufferView],
  79046. []
  79047. );
  79048. bufferViewMap[accessor.bufferView].push(accessor);
  79049. }
  79050. });
  79051. for (const bufferViewId in bufferViewMap) {
  79052. if (Object.prototype.hasOwnProperty.call(bufferViewMap, bufferViewId)) {
  79053. bufferView = bufferViews[bufferViewId];
  79054. const accessors = bufferViewMap[bufferViewId];
  79055. accessors.sort(function(a4, b) {
  79056. return a4.byteOffset - b.byteOffset;
  79057. });
  79058. let currentByteOffset = 0;
  79059. let currentIndex = 0;
  79060. const accessorsLength = accessors.length;
  79061. for (i2 = 0; i2 < accessorsLength; ++i2) {
  79062. let accessor = accessors[i2];
  79063. const accessorByteStride = computeAccessorByteStride(gltf, accessor);
  79064. const accessorByteOffset = accessor.byteOffset;
  79065. const accessorByteLength = accessor.count * accessorByteStride;
  79066. delete accessor.byteStride;
  79067. const hasNextAccessor = i2 < accessorsLength - 1;
  79068. const nextAccessorByteStride = hasNextAccessor ? computeAccessorByteStride(gltf, accessors[i2 + 1]) : void 0;
  79069. if (accessorByteStride !== nextAccessorByteStride) {
  79070. const newBufferView = clone_default(bufferView, true);
  79071. if (bufferViewHasVertexAttributes[bufferViewId]) {
  79072. newBufferView.byteStride = accessorByteStride;
  79073. }
  79074. newBufferView.byteOffset += currentByteOffset;
  79075. newBufferView.byteLength = accessorByteOffset + accessorByteLength - currentByteOffset;
  79076. const newBufferViewId = addToArray_default(bufferViews, newBufferView);
  79077. for (j = currentIndex; j <= i2; ++j) {
  79078. accessor = accessors[j];
  79079. accessor.bufferView = newBufferViewId;
  79080. accessor.byteOffset = accessor.byteOffset - currentByteOffset;
  79081. }
  79082. currentByteOffset = hasNextAccessor ? accessors[i2 + 1].byteOffset : void 0;
  79083. currentIndex = i2 + 1;
  79084. }
  79085. }
  79086. }
  79087. }
  79088. removeUnusedElements_default(gltf, ["accessor", "bufferView", "buffer"]);
  79089. }
  79090. function requirePositionAccessorMinMax(gltf) {
  79091. ForEach_default.accessorWithSemantic(gltf, "POSITION", function(accessorId) {
  79092. const accessor = gltf.accessors[accessorId];
  79093. if (!defined_default(accessor.min) || !defined_default(accessor.max)) {
  79094. const minMax = findAccessorMinMax_default(gltf, accessor);
  79095. accessor.min = minMax.min;
  79096. accessor.max = minMax.max;
  79097. }
  79098. });
  79099. }
  79100. function isNodeEmpty(node) {
  79101. return (!defined_default(node.children) || node.children.length === 0) && (!defined_default(node.meshes) || node.meshes.length === 0) && !defined_default(node.camera) && !defined_default(node.skin) && !defined_default(node.skeletons) && !defined_default(node.jointName) && (!defined_default(node.translation) || Cartesian3_default.fromArray(node.translation).equals(Cartesian3_default.ZERO)) && (!defined_default(node.scale) || Cartesian3_default.fromArray(node.scale).equals(new Cartesian3_default(1, 1, 1))) && (!defined_default(node.rotation) || Cartesian4_default.fromArray(node.rotation).equals(
  79102. new Cartesian4_default(0, 0, 0, 1)
  79103. )) && (!defined_default(node.matrix) || Matrix4_default.fromColumnMajorArray(node.matrix).equals(Matrix4_default.IDENTITY)) && !defined_default(node.extensions) && !defined_default(node.extras);
  79104. }
  79105. function deleteNode(gltf, nodeId) {
  79106. ForEach_default.scene(gltf, function(scene) {
  79107. const sceneNodes = scene.nodes;
  79108. if (defined_default(sceneNodes)) {
  79109. const sceneNodesLength = sceneNodes.length;
  79110. for (let i2 = sceneNodesLength; i2 >= 0; --i2) {
  79111. if (sceneNodes[i2] === nodeId) {
  79112. sceneNodes.splice(i2, 1);
  79113. return;
  79114. }
  79115. }
  79116. }
  79117. });
  79118. ForEach_default.node(gltf, function(parentNode, parentNodeId) {
  79119. if (defined_default(parentNode.children)) {
  79120. const index2 = parentNode.children.indexOf(nodeId);
  79121. if (index2 > -1) {
  79122. parentNode.children.splice(index2, 1);
  79123. if (isNodeEmpty(parentNode)) {
  79124. deleteNode(gltf, parentNodeId);
  79125. }
  79126. }
  79127. }
  79128. });
  79129. delete gltf.nodes[nodeId];
  79130. }
  79131. function removeEmptyNodes(gltf) {
  79132. ForEach_default.node(gltf, function(node, nodeId) {
  79133. if (isNodeEmpty(node)) {
  79134. deleteNode(gltf, nodeId);
  79135. }
  79136. });
  79137. return gltf;
  79138. }
  79139. function requireAnimationAccessorMinMax(gltf) {
  79140. ForEach_default.animation(gltf, function(animation) {
  79141. ForEach_default.animationSampler(animation, function(sampler) {
  79142. const accessor = gltf.accessors[sampler.input];
  79143. if (!defined_default(accessor.min) || !defined_default(accessor.max)) {
  79144. const minMax = findAccessorMinMax_default(gltf, accessor);
  79145. accessor.min = minMax.min;
  79146. accessor.max = minMax.max;
  79147. }
  79148. });
  79149. });
  79150. }
  79151. function glTF10to20(gltf) {
  79152. gltf.asset = defaultValue_default(gltf.asset, {});
  79153. gltf.asset.version = "2.0";
  79154. updateInstanceTechniques(gltf);
  79155. removeAnimationSamplersIndirection(gltf);
  79156. removeEmptyNodes(gltf);
  79157. objectsToArrays(gltf);
  79158. removeAnimationSamplerNames(gltf);
  79159. stripAsset(gltf);
  79160. requireKnownExtensions(gltf);
  79161. requireByteLength(gltf);
  79162. moveByteStrideToBufferView(gltf);
  79163. requirePositionAccessorMinMax(gltf);
  79164. requireAnimationAccessorMinMax(gltf);
  79165. removeBufferType(gltf);
  79166. removeTextureProperties(gltf);
  79167. requireAttributeSetIndex(gltf);
  79168. underscoreApplicationSpecificSemantics(gltf);
  79169. updateAccessorComponentTypes_default(gltf);
  79170. clampCameraParameters(gltf);
  79171. moveTechniqueRenderStates_default(gltf);
  79172. moveTechniquesToExtension_default(gltf);
  79173. removeEmptyArrays(gltf);
  79174. }
  79175. var updateVersion_default = updateVersion;
  79176. // node_modules/cesium/Source/Scene/ModelLoadResources.js
  79177. function ModelLoadResources() {
  79178. this.initialized = false;
  79179. this.resourcesParsed = false;
  79180. this.vertexBuffersToCreate = new Queue_default();
  79181. this.indexBuffersToCreate = new Queue_default();
  79182. this.buffers = {};
  79183. this.pendingBufferLoads = 0;
  79184. this.programsToCreate = new Queue_default();
  79185. this.shaders = {};
  79186. this.pendingShaderLoads = 0;
  79187. this.texturesToCreate = new Queue_default();
  79188. this.pendingTextureLoads = 0;
  79189. this.texturesToCreateFromBufferView = new Queue_default();
  79190. this.pendingBufferViewToImage = 0;
  79191. this.createSamplers = true;
  79192. this.createSkins = true;
  79193. this.createRuntimeAnimations = true;
  79194. this.createVertexArrays = true;
  79195. this.createRenderStates = true;
  79196. this.createUniformMaps = true;
  79197. this.createRuntimeNodes = true;
  79198. this.createdBufferViews = {};
  79199. this.primitivesToDecode = new Queue_default();
  79200. this.activeDecodingTasks = 0;
  79201. this.pendingDecodingCache = false;
  79202. this.skinnedNodesIds = [];
  79203. }
  79204. function getSubarray(array, offset2, length3) {
  79205. return array.subarray(offset2, offset2 + length3);
  79206. }
  79207. ModelLoadResources.prototype.getBuffer = function(bufferView) {
  79208. return getSubarray(
  79209. this.buffers[bufferView.buffer],
  79210. bufferView.byteOffset,
  79211. bufferView.byteLength
  79212. );
  79213. };
  79214. ModelLoadResources.prototype.finishedPendingBufferLoads = function() {
  79215. return this.pendingBufferLoads === 0;
  79216. };
  79217. ModelLoadResources.prototype.finishedBuffersCreation = function() {
  79218. return this.pendingBufferLoads === 0 && this.vertexBuffersToCreate.length === 0 && this.indexBuffersToCreate.length === 0;
  79219. };
  79220. ModelLoadResources.prototype.finishedProgramCreation = function() {
  79221. return this.pendingShaderLoads === 0 && this.programsToCreate.length === 0;
  79222. };
  79223. ModelLoadResources.prototype.finishedTextureCreation = function() {
  79224. const finishedPendingLoads = this.pendingTextureLoads === 0;
  79225. const finishedResourceCreation = this.texturesToCreate.length === 0 && this.texturesToCreateFromBufferView.length === 0;
  79226. return finishedPendingLoads && finishedResourceCreation;
  79227. };
  79228. ModelLoadResources.prototype.finishedEverythingButTextureCreation = function() {
  79229. const finishedPendingLoads = this.pendingBufferLoads === 0 && this.pendingShaderLoads === 0;
  79230. const finishedResourceCreation = this.vertexBuffersToCreate.length === 0 && this.indexBuffersToCreate.length === 0 && this.programsToCreate.length === 0 && this.pendingBufferViewToImage === 0;
  79231. return this.finishedDecoding() && finishedPendingLoads && finishedResourceCreation;
  79232. };
  79233. ModelLoadResources.prototype.finishedDecoding = function() {
  79234. return this.primitivesToDecode.length === 0 && this.activeDecodingTasks === 0 && !this.pendingDecodingCache;
  79235. };
  79236. ModelLoadResources.prototype.finished = function() {
  79237. return this.finishedDecoding() && this.finishedTextureCreation() && this.finishedEverythingButTextureCreation();
  79238. };
  79239. var ModelLoadResources_default = ModelLoadResources;
  79240. // node_modules/cesium/Source/Scene/ModelUtility.js
  79241. var ModelUtility = {};
  79242. ModelUtility.updateForwardAxis = function(model) {
  79243. const cachedSourceVersion = model.gltf.extras.sourceVersion;
  79244. if (defined_default(cachedSourceVersion) && cachedSourceVersion !== "2.0" || ModelUtility.getAssetVersion(model.gltf) !== "2.0") {
  79245. model._gltfForwardAxis = Axis_default.X;
  79246. }
  79247. };
  79248. ModelUtility.getAssetVersion = function(gltf) {
  79249. if (!defined_default(gltf.asset) || !defined_default(gltf.asset.version)) {
  79250. return "1.0";
  79251. }
  79252. return gltf.asset.version;
  79253. };
  79254. ModelUtility.splitIncompatibleMaterials = function(gltf) {
  79255. const accessors = gltf.accessors;
  79256. const materials = gltf.materials;
  79257. const primitiveInfoByMaterial = {};
  79258. ForEach_default.mesh(gltf, function(mesh2) {
  79259. ForEach_default.meshPrimitive(mesh2, function(primitive) {
  79260. let materialIndex = primitive.material;
  79261. const material = materials[materialIndex];
  79262. const jointAccessorId = primitive.attributes.JOINTS_0;
  79263. let componentType;
  79264. let accessorType;
  79265. if (defined_default(jointAccessorId)) {
  79266. const jointAccessor = accessors[jointAccessorId];
  79267. componentType = jointAccessor.componentType;
  79268. accessorType = jointAccessor.type;
  79269. }
  79270. const isSkinned = defined_default(jointAccessorId) && accessorType === "VEC4";
  79271. const hasVertexColors = defined_default(primitive.attributes.COLOR_0);
  79272. const hasMorphTargets = defined_default(primitive.targets);
  79273. const hasNormals = defined_default(primitive.attributes.NORMAL);
  79274. const hasTangents = defined_default(primitive.attributes.TANGENT);
  79275. const hasTexCoords = defined_default(primitive.attributes.TEXCOORD_0);
  79276. const hasTexCoord1 = hasTexCoords && defined_default(primitive.attributes.TEXCOORD_1);
  79277. const hasOutline = defined_default(primitive.extensions) && defined_default(primitive.extensions.CESIUM_primitive_outline);
  79278. const primitiveInfo = primitiveInfoByMaterial[materialIndex];
  79279. if (!defined_default(primitiveInfo)) {
  79280. primitiveInfoByMaterial[materialIndex] = {
  79281. skinning: {
  79282. skinned: isSkinned,
  79283. componentType
  79284. },
  79285. hasVertexColors,
  79286. hasMorphTargets,
  79287. hasNormals,
  79288. hasTangents,
  79289. hasTexCoords,
  79290. hasTexCoord1,
  79291. hasOutline
  79292. };
  79293. } else if (primitiveInfo.skinning.skinned !== isSkinned || primitiveInfo.hasVertexColors !== hasVertexColors || primitiveInfo.hasMorphTargets !== hasMorphTargets || primitiveInfo.hasNormals !== hasNormals || primitiveInfo.hasTangents !== hasTangents || primitiveInfo.hasTexCoords !== hasTexCoords || primitiveInfo.hasTexCoord1 !== hasTexCoord1 || primitiveInfo.hasOutline !== hasOutline) {
  79294. const clonedMaterial = clone_default(material, true);
  79295. materialIndex = addToArray_default(materials, clonedMaterial);
  79296. primitive.material = materialIndex;
  79297. primitiveInfoByMaterial[materialIndex] = {
  79298. skinning: {
  79299. skinned: isSkinned,
  79300. componentType
  79301. },
  79302. hasVertexColors,
  79303. hasMorphTargets,
  79304. hasNormals,
  79305. hasTangents,
  79306. hasTexCoords,
  79307. hasTexCoord1,
  79308. hasOutline
  79309. };
  79310. }
  79311. });
  79312. });
  79313. return primitiveInfoByMaterial;
  79314. };
  79315. ModelUtility.getShaderVariable = function(type) {
  79316. if (type === "SCALAR") {
  79317. return "float";
  79318. }
  79319. return type.toLowerCase();
  79320. };
  79321. ModelUtility.ModelState = {
  79322. NEEDS_LOAD: 0,
  79323. LOADING: 1,
  79324. LOADED: 2,
  79325. FAILED: 3
  79326. };
  79327. ModelUtility.getFailedLoadFunction = function(model, type, path) {
  79328. return function(error) {
  79329. model._state = ModelUtility.ModelState.FAILED;
  79330. let message = `Failed to load ${type}: ${path}`;
  79331. if (defined_default(error)) {
  79332. message += `
  79333. ${error.message}`;
  79334. }
  79335. model._readyPromise.reject(new RuntimeError_default(message));
  79336. };
  79337. };
  79338. ModelUtility.parseBuffers = function(model, bufferLoad2) {
  79339. const loadResources = model._loadResources;
  79340. ForEach_default.buffer(model.gltf, function(buffer, bufferViewId) {
  79341. if (defined_default(buffer.extras._pipeline.source)) {
  79342. loadResources.buffers[bufferViewId] = buffer.extras._pipeline.source;
  79343. } else if (defined_default(bufferLoad2)) {
  79344. const bufferResource = model._resource.getDerivedResource({
  79345. url: buffer.uri
  79346. });
  79347. ++loadResources.pendingBufferLoads;
  79348. bufferResource.fetchArrayBuffer().then(bufferLoad2(model, bufferViewId)).catch(
  79349. ModelUtility.getFailedLoadFunction(
  79350. model,
  79351. "buffer",
  79352. bufferResource.url
  79353. )
  79354. );
  79355. }
  79356. });
  79357. };
  79358. var aMinScratch = new Cartesian3_default();
  79359. var aMaxScratch = new Cartesian3_default();
  79360. ModelUtility.computeBoundingSphere = function(model) {
  79361. const gltf = model.gltf;
  79362. const gltfNodes = gltf.nodes;
  79363. const gltfMeshes = gltf.meshes;
  79364. const rootNodes = gltf.scenes[gltf.scene].nodes;
  79365. const rootNodesLength = rootNodes.length;
  79366. const nodeStack = [];
  79367. const min3 = new Cartesian3_default(
  79368. Number.MAX_VALUE,
  79369. Number.MAX_VALUE,
  79370. Number.MAX_VALUE
  79371. );
  79372. const max3 = new Cartesian3_default(
  79373. -Number.MAX_VALUE,
  79374. -Number.MAX_VALUE,
  79375. -Number.MAX_VALUE
  79376. );
  79377. for (let i2 = 0; i2 < rootNodesLength; ++i2) {
  79378. let n2 = gltfNodes[rootNodes[i2]];
  79379. n2._transformToRoot = ModelUtility.getTransform(n2);
  79380. nodeStack.push(n2);
  79381. while (nodeStack.length > 0) {
  79382. n2 = nodeStack.pop();
  79383. const transformToRoot = n2._transformToRoot;
  79384. const meshId = n2.mesh;
  79385. if (defined_default(meshId)) {
  79386. const mesh2 = gltfMeshes[meshId];
  79387. const primitives = mesh2.primitives;
  79388. const primitivesLength = primitives.length;
  79389. for (let m = 0; m < primitivesLength; ++m) {
  79390. const positionAccessor = primitives[m].attributes.POSITION;
  79391. if (defined_default(positionAccessor)) {
  79392. const minMax = ModelUtility.getAccessorMinMax(
  79393. gltf,
  79394. positionAccessor
  79395. );
  79396. if (defined_default(minMax.min) && defined_default(minMax.max)) {
  79397. const aMin = Cartesian3_default.fromArray(minMax.min, 0, aMinScratch);
  79398. const aMax = Cartesian3_default.fromArray(minMax.max, 0, aMaxScratch);
  79399. Matrix4_default.multiplyByPoint(transformToRoot, aMin, aMin);
  79400. Matrix4_default.multiplyByPoint(transformToRoot, aMax, aMax);
  79401. Cartesian3_default.minimumByComponent(min3, aMin, min3);
  79402. Cartesian3_default.maximumByComponent(max3, aMax, max3);
  79403. }
  79404. }
  79405. }
  79406. }
  79407. const children = n2.children;
  79408. if (defined_default(children)) {
  79409. const childrenLength = children.length;
  79410. for (let k = 0; k < childrenLength; ++k) {
  79411. const child = gltfNodes[children[k]];
  79412. child._transformToRoot = ModelUtility.getTransform(child);
  79413. Matrix4_default.multiplyTransformation(
  79414. transformToRoot,
  79415. child._transformToRoot,
  79416. child._transformToRoot
  79417. );
  79418. nodeStack.push(child);
  79419. }
  79420. }
  79421. delete n2._transformToRoot;
  79422. }
  79423. }
  79424. const boundingSphere = BoundingSphere_default.fromCornerPoints(min3, max3);
  79425. if (model._forwardAxis === Axis_default.Z) {
  79426. BoundingSphere_default.transformWithoutScale(
  79427. boundingSphere,
  79428. Axis_default.Z_UP_TO_X_UP,
  79429. boundingSphere
  79430. );
  79431. }
  79432. if (model._upAxis === Axis_default.Y) {
  79433. BoundingSphere_default.transformWithoutScale(
  79434. boundingSphere,
  79435. Axis_default.Y_UP_TO_Z_UP,
  79436. boundingSphere
  79437. );
  79438. } else if (model._upAxis === Axis_default.X) {
  79439. BoundingSphere_default.transformWithoutScale(
  79440. boundingSphere,
  79441. Axis_default.X_UP_TO_Z_UP,
  79442. boundingSphere
  79443. );
  79444. }
  79445. return boundingSphere;
  79446. };
  79447. function techniqueAttributeForSemantic(technique, semantic) {
  79448. return ForEach_default.techniqueAttribute(technique, function(attribute, attributeName) {
  79449. if (attribute.semantic === semantic) {
  79450. return attributeName;
  79451. }
  79452. });
  79453. }
  79454. function ensureSemanticExistenceForPrimitive(gltf, primitive) {
  79455. const accessors = gltf.accessors;
  79456. const materials = gltf.materials;
  79457. const techniquesWebgl = gltf.extensions.KHR_techniques_webgl;
  79458. const techniques = techniquesWebgl.techniques;
  79459. const programs = techniquesWebgl.programs;
  79460. const shaders = techniquesWebgl.shaders;
  79461. const targets = primitive.targets;
  79462. const attributes = primitive.attributes;
  79463. for (const target in targets) {
  79464. if (targets.hasOwnProperty(target)) {
  79465. const targetAttributes = targets[target];
  79466. for (const attribute in targetAttributes) {
  79467. if (attribute !== "extras") {
  79468. attributes[`${attribute}_${target}`] = targetAttributes[attribute];
  79469. }
  79470. }
  79471. }
  79472. }
  79473. const material = materials[primitive.material];
  79474. const technique = techniques[material.extensions.KHR_techniques_webgl.technique];
  79475. const program = programs[technique.program];
  79476. const vertexShader = shaders[program.vertexShader];
  79477. for (const semantic in attributes) {
  79478. if (attributes.hasOwnProperty(semantic)) {
  79479. if (!defined_default(techniqueAttributeForSemantic(technique, semantic))) {
  79480. const accessorId = attributes[semantic];
  79481. const accessor = accessors[accessorId];
  79482. let lowerCase = semantic.toLowerCase();
  79483. if (lowerCase.charAt(0) === "_") {
  79484. lowerCase = lowerCase.slice(1);
  79485. }
  79486. const attributeName = `a_${lowerCase}`;
  79487. technique.attributes[attributeName] = {
  79488. semantic,
  79489. type: accessor.componentType
  79490. };
  79491. const pipelineExtras = vertexShader.extras._pipeline;
  79492. let shaderText = pipelineExtras.source;
  79493. shaderText = `attribute ${ModelUtility.getShaderVariable(
  79494. accessor.type
  79495. )} ${attributeName};
  79496. ${shaderText}`;
  79497. pipelineExtras.source = shaderText;
  79498. }
  79499. }
  79500. }
  79501. }
  79502. ModelUtility.ensureSemanticExistence = function(gltf) {
  79503. ForEach_default.mesh(gltf, function(mesh2) {
  79504. ForEach_default.meshPrimitive(mesh2, function(primitive) {
  79505. ensureSemanticExistenceForPrimitive(gltf, primitive);
  79506. });
  79507. });
  79508. return gltf;
  79509. };
  79510. ModelUtility.createAttributeLocations = function(technique, precreatedAttributes) {
  79511. const attributeLocations8 = {};
  79512. let hasIndex0 = false;
  79513. let i2 = 1;
  79514. ForEach_default.techniqueAttribute(technique, function(attribute, attributeName) {
  79515. if (/pos/i.test(attributeName) && !hasIndex0) {
  79516. attributeLocations8[attributeName] = 0;
  79517. hasIndex0 = true;
  79518. } else {
  79519. attributeLocations8[attributeName] = i2++;
  79520. }
  79521. });
  79522. if (defined_default(precreatedAttributes)) {
  79523. for (const attributeName in precreatedAttributes) {
  79524. if (precreatedAttributes.hasOwnProperty(attributeName)) {
  79525. attributeLocations8[attributeName] = i2++;
  79526. }
  79527. }
  79528. }
  79529. return attributeLocations8;
  79530. };
  79531. ModelUtility.getAccessorMinMax = function(gltf, accessorId) {
  79532. const accessor = gltf.accessors[accessorId];
  79533. const extensions = accessor.extensions;
  79534. let accessorMin = accessor.min;
  79535. let accessorMax = accessor.max;
  79536. if (defined_default(extensions)) {
  79537. const quantizedAttributes = extensions.WEB3D_quantized_attributes;
  79538. if (defined_default(quantizedAttributes)) {
  79539. accessorMin = quantizedAttributes.decodedMin;
  79540. accessorMax = quantizedAttributes.decodedMax;
  79541. }
  79542. }
  79543. return {
  79544. min: accessorMin,
  79545. max: accessorMax
  79546. };
  79547. };
  79548. function getTechniqueAttributeOrUniformFunction(gltf, technique, semantic, ignoreNodes) {
  79549. if (usesExtension_default(gltf, "KHR_techniques_webgl")) {
  79550. return function(attributeOrUniform, attributeOrUniformName) {
  79551. if (attributeOrUniform.semantic === semantic && (!ignoreNodes || !defined_default(attributeOrUniform.node))) {
  79552. return attributeOrUniformName;
  79553. }
  79554. };
  79555. }
  79556. return function(parameterName, attributeOrUniformName) {
  79557. const attributeOrUniform = technique.parameters[parameterName];
  79558. if (attributeOrUniform.semantic === semantic && (!ignoreNodes || !defined_default(attributeOrUniform.node))) {
  79559. return attributeOrUniformName;
  79560. }
  79561. };
  79562. }
  79563. ModelUtility.getAttributeOrUniformBySemantic = function(gltf, semantic, programId, ignoreNodes) {
  79564. return ForEach_default.technique(gltf, function(technique) {
  79565. if (defined_default(programId) && technique.program !== programId) {
  79566. return;
  79567. }
  79568. const value = ForEach_default.techniqueAttribute(
  79569. technique,
  79570. getTechniqueAttributeOrUniformFunction(
  79571. gltf,
  79572. technique,
  79573. semantic,
  79574. ignoreNodes
  79575. )
  79576. );
  79577. if (defined_default(value)) {
  79578. return value;
  79579. }
  79580. return ForEach_default.techniqueUniform(
  79581. technique,
  79582. getTechniqueAttributeOrUniformFunction(
  79583. gltf,
  79584. technique,
  79585. semantic,
  79586. ignoreNodes
  79587. )
  79588. );
  79589. });
  79590. };
  79591. ModelUtility.getDiffuseAttributeOrUniform = function(gltf, programId) {
  79592. let diffuseUniformName = ModelUtility.getAttributeOrUniformBySemantic(
  79593. gltf,
  79594. "COLOR_0",
  79595. programId
  79596. );
  79597. if (!defined_default(diffuseUniformName)) {
  79598. diffuseUniformName = ModelUtility.getAttributeOrUniformBySemantic(
  79599. gltf,
  79600. "_3DTILESDIFFUSE",
  79601. programId
  79602. );
  79603. }
  79604. return diffuseUniformName;
  79605. };
  79606. var nodeTranslationScratch = new Cartesian3_default();
  79607. var nodeQuaternionScratch = new Quaternion_default();
  79608. var nodeScaleScratch = new Cartesian3_default();
  79609. ModelUtility.getTransform = function(node, result) {
  79610. if (defined_default(node.matrix)) {
  79611. return Matrix4_default.fromColumnMajorArray(node.matrix, result);
  79612. }
  79613. return Matrix4_default.fromTranslationQuaternionRotationScale(
  79614. Cartesian3_default.fromArray(node.translation, 0, nodeTranslationScratch),
  79615. Quaternion_default.unpack(node.rotation, 0, nodeQuaternionScratch),
  79616. Cartesian3_default.fromArray(node.scale, 0, nodeScaleScratch),
  79617. result
  79618. );
  79619. };
  79620. ModelUtility.getUsedExtensions = function(gltf) {
  79621. const extensionsUsed = gltf.extensionsUsed;
  79622. const cachedExtensionsUsed = {};
  79623. if (defined_default(extensionsUsed)) {
  79624. const extensionsUsedLength = extensionsUsed.length;
  79625. for (let i2 = 0; i2 < extensionsUsedLength; i2++) {
  79626. const extension = extensionsUsed[i2];
  79627. cachedExtensionsUsed[extension] = true;
  79628. }
  79629. }
  79630. return cachedExtensionsUsed;
  79631. };
  79632. ModelUtility.getRequiredExtensions = function(gltf) {
  79633. const extensionsRequired = gltf.extensionsRequired;
  79634. const cachedExtensionsRequired = {};
  79635. if (defined_default(extensionsRequired)) {
  79636. const extensionsRequiredLength = extensionsRequired.length;
  79637. for (let i2 = 0; i2 < extensionsRequiredLength; i2++) {
  79638. const extension = extensionsRequired[i2];
  79639. cachedExtensionsRequired[extension] = true;
  79640. }
  79641. }
  79642. return cachedExtensionsRequired;
  79643. };
  79644. ModelUtility.supportedExtensions = {
  79645. AGI_articulations: true,
  79646. CESIUM_RTC: true,
  79647. EXT_texture_webp: true,
  79648. KHR_blend: true,
  79649. KHR_binary_glTF: true,
  79650. KHR_texture_basisu: true,
  79651. KHR_draco_mesh_compression: true,
  79652. KHR_materials_common: true,
  79653. KHR_techniques_webgl: true,
  79654. KHR_materials_unlit: true,
  79655. KHR_materials_pbrSpecularGlossiness: true,
  79656. KHR_texture_transform: true,
  79657. WEB3D_quantized_attributes: true
  79658. };
  79659. ModelUtility.checkSupportedExtensions = function(extensionsRequired, browserSupportsWebp) {
  79660. for (const extension in extensionsRequired) {
  79661. if (extensionsRequired.hasOwnProperty(extension)) {
  79662. if (!ModelUtility.supportedExtensions[extension]) {
  79663. throw new RuntimeError_default(`Unsupported glTF Extension: ${extension}`);
  79664. }
  79665. if (extension === "EXT_texture_webp" && browserSupportsWebp === false) {
  79666. throw new RuntimeError_default(
  79667. "Loaded model requires WebP but browser does not support it."
  79668. );
  79669. }
  79670. }
  79671. }
  79672. };
  79673. ModelUtility.checkSupportedGlExtensions = function(extensionsUsed, context) {
  79674. if (defined_default(extensionsUsed)) {
  79675. const glExtensionsUsedLength = extensionsUsed.length;
  79676. for (let i2 = 0; i2 < glExtensionsUsedLength; i2++) {
  79677. const extension = extensionsUsed[i2];
  79678. if (extension !== "OES_element_index_uint") {
  79679. throw new RuntimeError_default(`Unsupported WebGL Extension: ${extension}`);
  79680. } else if (!context.elementIndexUint) {
  79681. throw new RuntimeError_default(
  79682. "OES_element_index_uint WebGL extension is not enabled."
  79683. );
  79684. }
  79685. }
  79686. }
  79687. };
  79688. function replaceAllButFirstInString(string, find, replace) {
  79689. find += "(?!\\w)";
  79690. find = new RegExp(find, "g");
  79691. const index2 = string.search(find);
  79692. return string.replace(find, function(match, offset2) {
  79693. return index2 === offset2 ? match : replace;
  79694. });
  79695. }
  79696. function getQuantizedAttributes(gltf, accessorId) {
  79697. const accessor = gltf.accessors[accessorId];
  79698. const extensions = accessor.extensions;
  79699. if (defined_default(extensions)) {
  79700. return extensions.WEB3D_quantized_attributes;
  79701. }
  79702. return void 0;
  79703. }
  79704. function getAttributeVariableName(gltf, primitive, attributeSemantic) {
  79705. const materialId = primitive.material;
  79706. const material = gltf.materials[materialId];
  79707. if (!usesExtension_default(gltf, "KHR_techniques_webgl") || !defined_default(material.extensions) || !defined_default(material.extensions.KHR_techniques_webgl)) {
  79708. return;
  79709. }
  79710. const techniqueId = material.extensions.KHR_techniques_webgl.technique;
  79711. const techniquesWebgl = gltf.extensions.KHR_techniques_webgl;
  79712. const technique = techniquesWebgl.techniques[techniqueId];
  79713. return ForEach_default.techniqueAttribute(technique, function(attribute, attributeName) {
  79714. const semantic = attribute.semantic;
  79715. if (semantic === attributeSemantic) {
  79716. return attributeName;
  79717. }
  79718. });
  79719. }
  79720. ModelUtility.modifyShaderForDracoQuantizedAttributes = function(gltf, primitive, shader, decodedAttributes) {
  79721. const quantizedUniforms = {};
  79722. for (let attributeSemantic in decodedAttributes) {
  79723. if (decodedAttributes.hasOwnProperty(attributeSemantic)) {
  79724. const attribute = decodedAttributes[attributeSemantic];
  79725. const quantization = attribute.quantization;
  79726. if (!defined_default(quantization)) {
  79727. continue;
  79728. }
  79729. const attributeVarName = getAttributeVariableName(
  79730. gltf,
  79731. primitive,
  79732. attributeSemantic
  79733. );
  79734. if (attributeSemantic.charAt(0) === "_") {
  79735. attributeSemantic = attributeSemantic.substring(1);
  79736. }
  79737. const decodeUniformVarName = `gltf_u_dec_${attributeSemantic.toLowerCase()}`;
  79738. if (!defined_default(quantizedUniforms[decodeUniformVarName])) {
  79739. const newMain = `gltf_decoded_${attributeSemantic}`;
  79740. const decodedAttributeVarName = attributeVarName.replace(
  79741. "a_",
  79742. "gltf_a_dec_"
  79743. );
  79744. const size = attribute.componentsPerAttribute;
  79745. shader = replaceAllButFirstInString(
  79746. shader,
  79747. attributeVarName,
  79748. decodedAttributeVarName
  79749. );
  79750. let variableType;
  79751. if (quantization.octEncoded) {
  79752. variableType = "vec3";
  79753. } else if (size > 1) {
  79754. variableType = `vec${size}`;
  79755. } else {
  79756. variableType = "float";
  79757. }
  79758. shader = `${variableType} ${decodedAttributeVarName};
  79759. ${shader}`;
  79760. const vec3Color = size === 3 && attributeSemantic === "COLOR_0";
  79761. if (vec3Color) {
  79762. shader = replaceAllButFirstInString(
  79763. shader,
  79764. decodedAttributeVarName,
  79765. `vec4(${decodedAttributeVarName}, 1.0)`
  79766. );
  79767. }
  79768. let decode = "";
  79769. if (quantization.octEncoded) {
  79770. const decodeUniformVarNameRangeConstant = `${decodeUniformVarName}_rangeConstant`;
  79771. shader = `uniform float ${decodeUniformVarNameRangeConstant};
  79772. ${shader}`;
  79773. decode = `${"\nvoid main() {\n "}${decodedAttributeVarName} = czm_octDecode(${attributeVarName}.xy, ${decodeUniformVarNameRangeConstant}).zxy;
  79774. ${newMain}();
  79775. }
  79776. `;
  79777. } else {
  79778. const decodeUniformVarNameNormConstant = `${decodeUniformVarName}_normConstant`;
  79779. const decodeUniformVarNameMin = `${decodeUniformVarName}_min`;
  79780. shader = `uniform float ${decodeUniformVarNameNormConstant};
  79781. uniform ${variableType} ${decodeUniformVarNameMin};
  79782. ${shader}`;
  79783. const attributeVarAccess = vec3Color ? ".xyz" : "";
  79784. decode = `${"\nvoid main() {\n "}${decodedAttributeVarName} = ${decodeUniformVarNameMin} + ${attributeVarName}${attributeVarAccess} * ${decodeUniformVarNameNormConstant};
  79785. ${newMain}();
  79786. }
  79787. `;
  79788. }
  79789. shader = ShaderSource_default.replaceMain(shader, newMain);
  79790. shader += decode;
  79791. }
  79792. }
  79793. }
  79794. return {
  79795. shader
  79796. };
  79797. };
  79798. ModelUtility.modifyShaderForQuantizedAttributes = function(gltf, primitive, shader) {
  79799. const quantizedUniforms = {};
  79800. const attributes = primitive.attributes;
  79801. for (let attributeSemantic in attributes) {
  79802. if (attributes.hasOwnProperty(attributeSemantic)) {
  79803. const attributeVarName = getAttributeVariableName(
  79804. gltf,
  79805. primitive,
  79806. attributeSemantic
  79807. );
  79808. const accessorId = primitive.attributes[attributeSemantic];
  79809. if (attributeSemantic.charAt(0) === "_") {
  79810. attributeSemantic = attributeSemantic.substring(1);
  79811. }
  79812. const decodeUniformVarName = `gltf_u_dec_${attributeSemantic.toLowerCase()}`;
  79813. const decodeUniformVarNameScale = `${decodeUniformVarName}_scale`;
  79814. const decodeUniformVarNameTranslate = `${decodeUniformVarName}_translate`;
  79815. if (!defined_default(quantizedUniforms[decodeUniformVarName]) && !defined_default(quantizedUniforms[decodeUniformVarNameScale])) {
  79816. const quantizedAttributes = getQuantizedAttributes(gltf, accessorId);
  79817. if (defined_default(quantizedAttributes)) {
  79818. const decodeMatrix = quantizedAttributes.decodeMatrix;
  79819. const newMain = `gltf_decoded_${attributeSemantic}`;
  79820. const decodedAttributeVarName = attributeVarName.replace(
  79821. "a_",
  79822. "gltf_a_dec_"
  79823. );
  79824. const size = Math.floor(Math.sqrt(decodeMatrix.length));
  79825. shader = replaceAllButFirstInString(
  79826. shader,
  79827. attributeVarName,
  79828. decodedAttributeVarName
  79829. );
  79830. let variableType;
  79831. if (size > 2) {
  79832. variableType = `vec${size - 1}`;
  79833. } else {
  79834. variableType = "float";
  79835. }
  79836. shader = `${variableType} ${decodedAttributeVarName};
  79837. ${shader}`;
  79838. let decode = "";
  79839. if (size === 5) {
  79840. shader = `uniform mat4 ${decodeUniformVarNameScale};
  79841. ${shader}`;
  79842. shader = `uniform vec4 ${decodeUniformVarNameTranslate};
  79843. ${shader}`;
  79844. decode = `${"\nvoid main() {\n "}${decodedAttributeVarName} = ${decodeUniformVarNameScale} * ${attributeVarName} + ${decodeUniformVarNameTranslate};
  79845. ${newMain}();
  79846. }
  79847. `;
  79848. quantizedUniforms[decodeUniformVarNameScale] = { mat: 4 };
  79849. quantizedUniforms[decodeUniformVarNameTranslate] = { vec: 4 };
  79850. } else {
  79851. shader = `uniform mat${size} ${decodeUniformVarName};
  79852. ${shader}`;
  79853. decode = `${"\nvoid main() {\n "}${decodedAttributeVarName} = ${variableType}(${decodeUniformVarName} * vec${size}(${attributeVarName},1.0));
  79854. ${newMain}();
  79855. }
  79856. `;
  79857. quantizedUniforms[decodeUniformVarName] = { mat: size };
  79858. }
  79859. shader = ShaderSource_default.replaceMain(shader, newMain);
  79860. shader += decode;
  79861. }
  79862. }
  79863. }
  79864. }
  79865. return {
  79866. shader,
  79867. uniforms: quantizedUniforms
  79868. };
  79869. };
  79870. function getScalarUniformFunction(value) {
  79871. const that = {
  79872. value,
  79873. clone: function(source, result) {
  79874. return source;
  79875. },
  79876. func: function() {
  79877. return that.value;
  79878. }
  79879. };
  79880. return that;
  79881. }
  79882. function getVec2UniformFunction(value) {
  79883. const that = {
  79884. value: Cartesian2_default.fromArray(value),
  79885. clone: Cartesian2_default.clone,
  79886. func: function() {
  79887. return that.value;
  79888. }
  79889. };
  79890. return that;
  79891. }
  79892. function getVec3UniformFunction(value) {
  79893. const that = {
  79894. value: Cartesian3_default.fromArray(value),
  79895. clone: Cartesian3_default.clone,
  79896. func: function() {
  79897. return that.value;
  79898. }
  79899. };
  79900. return that;
  79901. }
  79902. function getVec4UniformFunction(value) {
  79903. const that = {
  79904. value: Cartesian4_default.fromArray(value),
  79905. clone: Cartesian4_default.clone,
  79906. func: function() {
  79907. return that.value;
  79908. }
  79909. };
  79910. return that;
  79911. }
  79912. function getMat2UniformFunction(value) {
  79913. const that = {
  79914. value: Matrix2_default.fromColumnMajorArray(value),
  79915. clone: Matrix2_default.clone,
  79916. func: function() {
  79917. return that.value;
  79918. }
  79919. };
  79920. return that;
  79921. }
  79922. function getMat3UniformFunction(value) {
  79923. const that = {
  79924. value: Matrix3_default.fromColumnMajorArray(value),
  79925. clone: Matrix3_default.clone,
  79926. func: function() {
  79927. return that.value;
  79928. }
  79929. };
  79930. return that;
  79931. }
  79932. function getMat4UniformFunction(value) {
  79933. const that = {
  79934. value: Matrix4_default.fromColumnMajorArray(value),
  79935. clone: Matrix4_default.clone,
  79936. func: function() {
  79937. return that.value;
  79938. }
  79939. };
  79940. return that;
  79941. }
  79942. function DelayLoadedTextureUniform(value, textures, defaultTexture) {
  79943. this._value = void 0;
  79944. this._textureId = value.index;
  79945. this._textures = textures;
  79946. this._defaultTexture = defaultTexture;
  79947. }
  79948. Object.defineProperties(DelayLoadedTextureUniform.prototype, {
  79949. value: {
  79950. get: function() {
  79951. if (!defined_default(this._value)) {
  79952. const texture = this._textures[this._textureId];
  79953. if (defined_default(texture)) {
  79954. this._value = texture;
  79955. } else {
  79956. return this._defaultTexture;
  79957. }
  79958. }
  79959. return this._value;
  79960. },
  79961. set: function(value) {
  79962. this._value = value;
  79963. }
  79964. }
  79965. });
  79966. DelayLoadedTextureUniform.prototype.clone = function(source) {
  79967. return source;
  79968. };
  79969. DelayLoadedTextureUniform.prototype.func = void 0;
  79970. function getTextureUniformFunction(value, textures, defaultTexture) {
  79971. const uniform = new DelayLoadedTextureUniform(
  79972. value,
  79973. textures,
  79974. defaultTexture
  79975. );
  79976. uniform.func = function() {
  79977. return uniform.value;
  79978. };
  79979. return uniform;
  79980. }
  79981. var gltfUniformFunctions = {};
  79982. gltfUniformFunctions[WebGLConstants_default.FLOAT] = getScalarUniformFunction;
  79983. gltfUniformFunctions[WebGLConstants_default.FLOAT_VEC2] = getVec2UniformFunction;
  79984. gltfUniformFunctions[WebGLConstants_default.FLOAT_VEC3] = getVec3UniformFunction;
  79985. gltfUniformFunctions[WebGLConstants_default.FLOAT_VEC4] = getVec4UniformFunction;
  79986. gltfUniformFunctions[WebGLConstants_default.INT] = getScalarUniformFunction;
  79987. gltfUniformFunctions[WebGLConstants_default.INT_VEC2] = getVec2UniformFunction;
  79988. gltfUniformFunctions[WebGLConstants_default.INT_VEC3] = getVec3UniformFunction;
  79989. gltfUniformFunctions[WebGLConstants_default.INT_VEC4] = getVec4UniformFunction;
  79990. gltfUniformFunctions[WebGLConstants_default.BOOL] = getScalarUniformFunction;
  79991. gltfUniformFunctions[WebGLConstants_default.BOOL_VEC2] = getVec2UniformFunction;
  79992. gltfUniformFunctions[WebGLConstants_default.BOOL_VEC3] = getVec3UniformFunction;
  79993. gltfUniformFunctions[WebGLConstants_default.BOOL_VEC4] = getVec4UniformFunction;
  79994. gltfUniformFunctions[WebGLConstants_default.FLOAT_MAT2] = getMat2UniformFunction;
  79995. gltfUniformFunctions[WebGLConstants_default.FLOAT_MAT3] = getMat3UniformFunction;
  79996. gltfUniformFunctions[WebGLConstants_default.FLOAT_MAT4] = getMat4UniformFunction;
  79997. gltfUniformFunctions[WebGLConstants_default.SAMPLER_2D] = getTextureUniformFunction;
  79998. ModelUtility.createUniformFunction = function(type, value, textures, defaultTexture) {
  79999. return gltfUniformFunctions[type](value, textures, defaultTexture);
  80000. };
  80001. function scaleFromMatrix5Array(matrix) {
  80002. return [
  80003. matrix[0],
  80004. matrix[1],
  80005. matrix[2],
  80006. matrix[3],
  80007. matrix[5],
  80008. matrix[6],
  80009. matrix[7],
  80010. matrix[8],
  80011. matrix[10],
  80012. matrix[11],
  80013. matrix[12],
  80014. matrix[13],
  80015. matrix[15],
  80016. matrix[16],
  80017. matrix[17],
  80018. matrix[18]
  80019. ];
  80020. }
  80021. function translateFromMatrix5Array(matrix) {
  80022. return [matrix[20], matrix[21], matrix[22], matrix[23]];
  80023. }
  80024. ModelUtility.createUniformsForDracoQuantizedAttributes = function(decodedAttributes) {
  80025. const uniformMap2 = {};
  80026. for (let attribute in decodedAttributes) {
  80027. if (decodedAttributes.hasOwnProperty(attribute)) {
  80028. const decodedData = decodedAttributes[attribute];
  80029. const quantization = decodedData.quantization;
  80030. if (!defined_default(quantization)) {
  80031. continue;
  80032. }
  80033. if (attribute.charAt(0) === "_") {
  80034. attribute = attribute.substring(1);
  80035. }
  80036. const uniformVarName = `gltf_u_dec_${attribute.toLowerCase()}`;
  80037. if (quantization.octEncoded) {
  80038. const uniformVarNameRangeConstant = `${uniformVarName}_rangeConstant`;
  80039. const rangeConstant = (1 << quantization.quantizationBits) - 1;
  80040. uniformMap2[uniformVarNameRangeConstant] = getScalarUniformFunction(
  80041. rangeConstant
  80042. ).func;
  80043. continue;
  80044. }
  80045. const uniformVarNameNormConstant = `${uniformVarName}_normConstant`;
  80046. const normConstant = quantization.range / (1 << quantization.quantizationBits);
  80047. uniformMap2[uniformVarNameNormConstant] = getScalarUniformFunction(
  80048. normConstant
  80049. ).func;
  80050. const uniformVarNameMin = `${uniformVarName}_min`;
  80051. switch (decodedData.componentsPerAttribute) {
  80052. case 1:
  80053. uniformMap2[uniformVarNameMin] = getScalarUniformFunction(
  80054. quantization.minValues
  80055. ).func;
  80056. break;
  80057. case 2:
  80058. uniformMap2[uniformVarNameMin] = getVec2UniformFunction(
  80059. quantization.minValues
  80060. ).func;
  80061. break;
  80062. case 3:
  80063. uniformMap2[uniformVarNameMin] = getVec3UniformFunction(
  80064. quantization.minValues
  80065. ).func;
  80066. break;
  80067. case 4:
  80068. uniformMap2[uniformVarNameMin] = getVec4UniformFunction(
  80069. quantization.minValues
  80070. ).func;
  80071. break;
  80072. }
  80073. }
  80074. }
  80075. return uniformMap2;
  80076. };
  80077. ModelUtility.createUniformsForQuantizedAttributes = function(gltf, primitive, quantizedUniforms) {
  80078. const accessors = gltf.accessors;
  80079. const setUniforms = {};
  80080. const uniformMap2 = {};
  80081. const attributes = primitive.attributes;
  80082. for (let attribute in attributes) {
  80083. if (attributes.hasOwnProperty(attribute)) {
  80084. const accessorId = attributes[attribute];
  80085. const a4 = accessors[accessorId];
  80086. const extensions = a4.extensions;
  80087. if (attribute.charAt(0) === "_") {
  80088. attribute = attribute.substring(1);
  80089. }
  80090. if (defined_default(extensions)) {
  80091. const quantizedAttributes = extensions.WEB3D_quantized_attributes;
  80092. if (defined_default(quantizedAttributes)) {
  80093. const decodeMatrix = quantizedAttributes.decodeMatrix;
  80094. const uniformVariable = `gltf_u_dec_${attribute.toLowerCase()}`;
  80095. let uniformVariableScale;
  80096. let uniformVariableTranslate;
  80097. switch (a4.type) {
  80098. case AttributeType_default.SCALAR:
  80099. uniformMap2[uniformVariable] = getMat2UniformFunction(
  80100. decodeMatrix
  80101. ).func;
  80102. setUniforms[uniformVariable] = true;
  80103. break;
  80104. case AttributeType_default.VEC2:
  80105. uniformMap2[uniformVariable] = getMat3UniformFunction(
  80106. decodeMatrix
  80107. ).func;
  80108. setUniforms[uniformVariable] = true;
  80109. break;
  80110. case AttributeType_default.VEC3:
  80111. uniformMap2[uniformVariable] = getMat4UniformFunction(
  80112. decodeMatrix
  80113. ).func;
  80114. setUniforms[uniformVariable] = true;
  80115. break;
  80116. case AttributeType_default.VEC4:
  80117. uniformVariableScale = `${uniformVariable}_scale`;
  80118. uniformVariableTranslate = `${uniformVariable}_translate`;
  80119. uniformMap2[uniformVariableScale] = getMat4UniformFunction(
  80120. scaleFromMatrix5Array(decodeMatrix)
  80121. ).func;
  80122. uniformMap2[uniformVariableTranslate] = getVec4UniformFunction(
  80123. translateFromMatrix5Array(decodeMatrix)
  80124. ).func;
  80125. setUniforms[uniformVariableScale] = true;
  80126. setUniforms[uniformVariableTranslate] = true;
  80127. break;
  80128. }
  80129. }
  80130. }
  80131. }
  80132. }
  80133. for (const quantizedUniform in quantizedUniforms) {
  80134. if (quantizedUniforms.hasOwnProperty(quantizedUniform)) {
  80135. if (!setUniforms[quantizedUniform]) {
  80136. const properties = quantizedUniforms[quantizedUniform];
  80137. if (defined_default(properties.mat)) {
  80138. if (properties.mat === 2) {
  80139. uniformMap2[quantizedUniform] = getMat2UniformFunction(
  80140. Matrix2_default.IDENTITY
  80141. ).func;
  80142. } else if (properties.mat === 3) {
  80143. uniformMap2[quantizedUniform] = getMat3UniformFunction(
  80144. Matrix3_default.IDENTITY
  80145. ).func;
  80146. } else if (properties.mat === 4) {
  80147. uniformMap2[quantizedUniform] = getMat4UniformFunction(
  80148. Matrix4_default.IDENTITY
  80149. ).func;
  80150. }
  80151. }
  80152. if (defined_default(properties.vec)) {
  80153. if (properties.vec === 4) {
  80154. uniformMap2[quantizedUniform] = getVec4UniformFunction([
  80155. 0,
  80156. 0,
  80157. 0,
  80158. 0
  80159. ]).func;
  80160. }
  80161. }
  80162. }
  80163. }
  80164. }
  80165. return uniformMap2;
  80166. };
  80167. var scratchTranslationRtc = new Cartesian3_default();
  80168. var gltfSemanticUniforms = {
  80169. MODEL: function(uniformState, model) {
  80170. return function() {
  80171. return uniformState.model;
  80172. };
  80173. },
  80174. VIEW: function(uniformState, model) {
  80175. return function() {
  80176. return uniformState.view;
  80177. };
  80178. },
  80179. PROJECTION: function(uniformState, model) {
  80180. return function() {
  80181. return uniformState.projection;
  80182. };
  80183. },
  80184. MODELVIEW: function(uniformState, model) {
  80185. return function() {
  80186. return uniformState.modelView;
  80187. };
  80188. },
  80189. CESIUM_RTC_MODELVIEW: function(uniformState, model) {
  80190. const mvRtc = new Matrix4_default();
  80191. return function() {
  80192. if (defined_default(model._rtcCenter)) {
  80193. Matrix4_default.getTranslation(uniformState.model, scratchTranslationRtc);
  80194. Cartesian3_default.add(
  80195. scratchTranslationRtc,
  80196. model._rtcCenter,
  80197. scratchTranslationRtc
  80198. );
  80199. Matrix4_default.multiplyByPoint(
  80200. uniformState.view,
  80201. scratchTranslationRtc,
  80202. scratchTranslationRtc
  80203. );
  80204. return Matrix4_default.setTranslation(
  80205. uniformState.modelView,
  80206. scratchTranslationRtc,
  80207. mvRtc
  80208. );
  80209. }
  80210. return uniformState.modelView;
  80211. };
  80212. },
  80213. MODELVIEWPROJECTION: function(uniformState, model) {
  80214. return function() {
  80215. return uniformState.modelViewProjection;
  80216. };
  80217. },
  80218. MODELINVERSE: function(uniformState, model) {
  80219. return function() {
  80220. return uniformState.inverseModel;
  80221. };
  80222. },
  80223. VIEWINVERSE: function(uniformState, model) {
  80224. return function() {
  80225. return uniformState.inverseView;
  80226. };
  80227. },
  80228. PROJECTIONINVERSE: function(uniformState, model) {
  80229. return function() {
  80230. return uniformState.inverseProjection;
  80231. };
  80232. },
  80233. MODELVIEWINVERSE: function(uniformState, model) {
  80234. return function() {
  80235. return uniformState.inverseModelView;
  80236. };
  80237. },
  80238. MODELVIEWPROJECTIONINVERSE: function(uniformState, model) {
  80239. return function() {
  80240. return uniformState.inverseModelViewProjection;
  80241. };
  80242. },
  80243. MODELINVERSETRANSPOSE: function(uniformState, model) {
  80244. return function() {
  80245. return uniformState.inverseTransposeModel;
  80246. };
  80247. },
  80248. MODELVIEWINVERSETRANSPOSE: function(uniformState, model) {
  80249. return function() {
  80250. return uniformState.normal;
  80251. };
  80252. },
  80253. VIEWPORT: function(uniformState, model) {
  80254. return function() {
  80255. return uniformState.viewportCartesian4;
  80256. };
  80257. }
  80258. };
  80259. ModelUtility.getGltfSemanticUniforms = function() {
  80260. return gltfSemanticUniforms;
  80261. };
  80262. var ModelUtility_default = ModelUtility;
  80263. // node_modules/cesium/Source/Scene/processModelMaterialsCommon.js
  80264. function processModelMaterialsCommon(gltf, options) {
  80265. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  80266. if (!defined_default(gltf)) {
  80267. return;
  80268. }
  80269. if (!usesExtension_default(gltf, "KHR_materials_common")) {
  80270. return;
  80271. }
  80272. if (!usesExtension_default(gltf, "KHR_techniques_webgl")) {
  80273. if (!defined_default(gltf.extensions)) {
  80274. gltf.extensions = {};
  80275. }
  80276. gltf.extensions.KHR_techniques_webgl = {
  80277. programs: [],
  80278. shaders: [],
  80279. techniques: []
  80280. };
  80281. gltf.extensionsUsed.push("KHR_techniques_webgl");
  80282. gltf.extensionsRequired.push("KHR_techniques_webgl");
  80283. }
  80284. const techniquesWebgl = gltf.extensions.KHR_techniques_webgl;
  80285. lightDefaults(gltf);
  80286. const lightParameters = generateLightParameters(gltf);
  80287. const primitiveByMaterial = ModelUtility_default.splitIncompatibleMaterials(gltf);
  80288. const techniques = {};
  80289. let generatedTechniques = false;
  80290. ForEach_default.material(gltf, function(material, materialIndex) {
  80291. if (defined_default(material.extensions) && defined_default(material.extensions.KHR_materials_common)) {
  80292. const khrMaterialsCommon = material.extensions.KHR_materials_common;
  80293. const primitiveInfo = primitiveByMaterial[materialIndex];
  80294. const techniqueKey = getTechniqueKey(khrMaterialsCommon, primitiveInfo);
  80295. let technique = techniques[techniqueKey];
  80296. if (!defined_default(technique)) {
  80297. technique = generateTechnique(
  80298. gltf,
  80299. techniquesWebgl,
  80300. primitiveInfo,
  80301. khrMaterialsCommon,
  80302. lightParameters,
  80303. options.addBatchIdToGeneratedShaders
  80304. );
  80305. techniques[techniqueKey] = technique;
  80306. generatedTechniques = true;
  80307. }
  80308. const materialValues = {};
  80309. const values = khrMaterialsCommon.values;
  80310. let uniformName;
  80311. for (const valueName in values) {
  80312. if (values.hasOwnProperty(valueName) && valueName !== "transparent" && valueName !== "doubleSided") {
  80313. uniformName = `u_${valueName.toLowerCase()}`;
  80314. materialValues[uniformName] = values[valueName];
  80315. }
  80316. }
  80317. material.extensions.KHR_techniques_webgl = {
  80318. technique,
  80319. values: materialValues
  80320. };
  80321. material.alphaMode = "OPAQUE";
  80322. if (khrMaterialsCommon.transparent) {
  80323. material.alphaMode = "BLEND";
  80324. }
  80325. if (khrMaterialsCommon.doubleSided) {
  80326. material.doubleSided = true;
  80327. }
  80328. }
  80329. });
  80330. if (!generatedTechniques) {
  80331. return gltf;
  80332. }
  80333. ModelUtility_default.ensureSemanticExistence(gltf);
  80334. return gltf;
  80335. }
  80336. function generateLightParameters(gltf) {
  80337. const result = {};
  80338. let lights;
  80339. if (defined_default(gltf.extensions) && defined_default(gltf.extensions.KHR_materials_common)) {
  80340. lights = gltf.extensions.KHR_materials_common.lights;
  80341. }
  80342. if (defined_default(lights)) {
  80343. const nodes = gltf.nodes;
  80344. for (const nodeName in nodes) {
  80345. if (nodes.hasOwnProperty(nodeName)) {
  80346. const node = nodes[nodeName];
  80347. if (defined_default(node.extensions) && defined_default(node.extensions.KHR_materials_common)) {
  80348. const nodeLightId = node.extensions.KHR_materials_common.light;
  80349. if (defined_default(nodeLightId) && defined_default(lights[nodeLightId])) {
  80350. lights[nodeLightId].node = nodeName;
  80351. }
  80352. delete node.extensions.KHR_materials_common;
  80353. }
  80354. }
  80355. }
  80356. let lightCount = 0;
  80357. for (const lightName in lights) {
  80358. if (lights.hasOwnProperty(lightName)) {
  80359. const light = lights[lightName];
  80360. const lightType = light.type;
  80361. if (lightType !== "ambient" && !defined_default(light.node)) {
  80362. delete lights[lightName];
  80363. continue;
  80364. }
  80365. const lightBaseName = `light${lightCount.toString()}`;
  80366. light.baseName = lightBaseName;
  80367. let ambient;
  80368. let directional;
  80369. let point;
  80370. let spot;
  80371. switch (lightType) {
  80372. case "ambient":
  80373. ambient = light.ambient;
  80374. result[`${lightBaseName}Color`] = {
  80375. type: WebGLConstants_default.FLOAT_VEC3,
  80376. value: ambient.color
  80377. };
  80378. break;
  80379. case "directional":
  80380. directional = light.directional;
  80381. result[`${lightBaseName}Color`] = {
  80382. type: WebGLConstants_default.FLOAT_VEC3,
  80383. value: directional.color
  80384. };
  80385. if (defined_default(light.node)) {
  80386. result[`${lightBaseName}Transform`] = {
  80387. node: light.node,
  80388. semantic: "MODELVIEW",
  80389. type: WebGLConstants_default.FLOAT_MAT4
  80390. };
  80391. }
  80392. break;
  80393. case "point":
  80394. point = light.point;
  80395. result[`${lightBaseName}Color`] = {
  80396. type: WebGLConstants_default.FLOAT_VEC3,
  80397. value: point.color
  80398. };
  80399. if (defined_default(light.node)) {
  80400. result[`${lightBaseName}Transform`] = {
  80401. node: light.node,
  80402. semantic: "MODELVIEW",
  80403. type: WebGLConstants_default.FLOAT_MAT4
  80404. };
  80405. }
  80406. result[`${lightBaseName}Attenuation`] = {
  80407. type: WebGLConstants_default.FLOAT_VEC3,
  80408. value: [
  80409. point.constantAttenuation,
  80410. point.linearAttenuation,
  80411. point.quadraticAttenuation
  80412. ]
  80413. };
  80414. break;
  80415. case "spot":
  80416. spot = light.spot;
  80417. result[`${lightBaseName}Color`] = {
  80418. type: WebGLConstants_default.FLOAT_VEC3,
  80419. value: spot.color
  80420. };
  80421. if (defined_default(light.node)) {
  80422. result[`${lightBaseName}Transform`] = {
  80423. node: light.node,
  80424. semantic: "MODELVIEW",
  80425. type: WebGLConstants_default.FLOAT_MAT4
  80426. };
  80427. result[`${lightBaseName}InverseTransform`] = {
  80428. node: light.node,
  80429. semantic: "MODELVIEWINVERSE",
  80430. type: WebGLConstants_default.FLOAT_MAT4,
  80431. useInFragment: true
  80432. };
  80433. }
  80434. result[`${lightBaseName}Attenuation`] = {
  80435. type: WebGLConstants_default.FLOAT_VEC3,
  80436. value: [
  80437. spot.constantAttenuation,
  80438. spot.linearAttenuation,
  80439. spot.quadraticAttenuation
  80440. ]
  80441. };
  80442. result[`${lightBaseName}FallOff`] = {
  80443. type: WebGLConstants_default.FLOAT_VEC2,
  80444. value: [spot.fallOffAngle, spot.fallOffExponent]
  80445. };
  80446. break;
  80447. }
  80448. ++lightCount;
  80449. }
  80450. }
  80451. }
  80452. return result;
  80453. }
  80454. function generateTechnique(gltf, techniquesWebgl, primitiveInfo, khrMaterialsCommon, lightParameters, addBatchIdToGeneratedShaders) {
  80455. if (!defined_default(khrMaterialsCommon)) {
  80456. khrMaterialsCommon = {};
  80457. }
  80458. addBatchIdToGeneratedShaders = defaultValue_default(
  80459. addBatchIdToGeneratedShaders,
  80460. false
  80461. );
  80462. const techniques = techniquesWebgl.techniques;
  80463. const shaders = techniquesWebgl.shaders;
  80464. const programs = techniquesWebgl.programs;
  80465. const lightingModel = khrMaterialsCommon.technique.toUpperCase();
  80466. let lights;
  80467. if (defined_default(gltf.extensions) && defined_default(gltf.extensions.KHR_materials_common)) {
  80468. lights = gltf.extensions.KHR_materials_common.lights;
  80469. }
  80470. const parameterValues = khrMaterialsCommon.values;
  80471. const jointCount = defaultValue_default(khrMaterialsCommon.jointCount, 0);
  80472. let skinningInfo;
  80473. let hasSkinning = false;
  80474. let hasVertexColors = false;
  80475. if (defined_default(primitiveInfo)) {
  80476. skinningInfo = primitiveInfo.skinning;
  80477. hasSkinning = skinningInfo.skinned;
  80478. hasVertexColors = primitiveInfo.hasVertexColors;
  80479. }
  80480. let vertexShader = "precision highp float;\n";
  80481. let fragmentShader = "precision highp float;\n";
  80482. const hasNormals = lightingModel !== "CONSTANT";
  80483. const techniqueUniforms = {
  80484. u_modelViewMatrix: {
  80485. semantic: usesExtension_default(gltf, "CESIUM_RTC") ? "CESIUM_RTC_MODELVIEW" : "MODELVIEW",
  80486. type: WebGLConstants_default.FLOAT_MAT4
  80487. },
  80488. u_projectionMatrix: {
  80489. semantic: "PROJECTION",
  80490. type: WebGLConstants_default.FLOAT_MAT4
  80491. }
  80492. };
  80493. if (hasNormals) {
  80494. techniqueUniforms.u_normalMatrix = {
  80495. semantic: "MODELVIEWINVERSETRANSPOSE",
  80496. type: WebGLConstants_default.FLOAT_MAT3
  80497. };
  80498. }
  80499. if (hasSkinning) {
  80500. techniqueUniforms.u_jointMatrix = {
  80501. count: jointCount,
  80502. semantic: "JOINTMATRIX",
  80503. type: WebGLConstants_default.FLOAT_MAT4
  80504. };
  80505. }
  80506. let uniformName;
  80507. let hasTexCoords = false;
  80508. for (const name in parameterValues) {
  80509. if (parameterValues.hasOwnProperty(name) && name !== "transparent" && name !== "doubleSided") {
  80510. const uniformType = getKHRMaterialsCommonValueType(
  80511. name,
  80512. parameterValues[name]
  80513. );
  80514. uniformName = `u_${name.toLowerCase()}`;
  80515. if (!hasTexCoords && uniformType === WebGLConstants_default.SAMPLER_2D) {
  80516. hasTexCoords = true;
  80517. }
  80518. techniqueUniforms[uniformName] = {
  80519. type: uniformType
  80520. };
  80521. }
  80522. }
  80523. if (defined_default(techniqueUniforms.u_diffuse)) {
  80524. techniqueUniforms.u_diffuse.semantic = "_3DTILESDIFFUSE";
  80525. }
  80526. if (defined_default(lightParameters)) {
  80527. for (const lightParamName in lightParameters) {
  80528. if (lightParameters.hasOwnProperty(lightParamName)) {
  80529. uniformName = `u_${lightParamName}`;
  80530. techniqueUniforms[uniformName] = lightParameters[lightParamName];
  80531. }
  80532. }
  80533. }
  80534. for (uniformName in techniqueUniforms) {
  80535. if (techniqueUniforms.hasOwnProperty(uniformName)) {
  80536. const uniform = techniqueUniforms[uniformName];
  80537. const arraySize = defined_default(uniform.count) ? `[${uniform.count}]` : "";
  80538. if (uniform.type !== WebGLConstants_default.FLOAT_MAT3 && uniform.type !== WebGLConstants_default.FLOAT_MAT4 || uniform.useInFragment) {
  80539. fragmentShader += `uniform ${webGLConstantToGlslType_default(
  80540. uniform.type
  80541. )} ${uniformName}${arraySize};
  80542. `;
  80543. delete uniform.useInFragment;
  80544. } else {
  80545. vertexShader += `uniform ${webGLConstantToGlslType_default(
  80546. uniform.type
  80547. )} ${uniformName}${arraySize};
  80548. `;
  80549. }
  80550. }
  80551. }
  80552. let vertexShaderMain = "";
  80553. if (hasSkinning) {
  80554. vertexShaderMain += " mat4 skinMatrix =\n a_weight.x * u_jointMatrix[int(a_joint.x)] +\n a_weight.y * u_jointMatrix[int(a_joint.y)] +\n a_weight.z * u_jointMatrix[int(a_joint.z)] +\n a_weight.w * u_jointMatrix[int(a_joint.w)];\n";
  80555. }
  80556. const techniqueAttributes = {
  80557. a_position: {
  80558. semantic: "POSITION"
  80559. }
  80560. };
  80561. vertexShader += "attribute vec3 a_position;\n";
  80562. vertexShader += "varying vec3 v_positionEC;\n";
  80563. if (hasSkinning) {
  80564. vertexShaderMain += " vec4 pos = u_modelViewMatrix * skinMatrix * vec4(a_position,1.0);\n";
  80565. } else {
  80566. vertexShaderMain += " vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);\n";
  80567. }
  80568. vertexShaderMain += " v_positionEC = pos.xyz;\n";
  80569. vertexShaderMain += " gl_Position = u_projectionMatrix * pos;\n";
  80570. fragmentShader += "varying vec3 v_positionEC;\n";
  80571. if (hasNormals) {
  80572. techniqueAttributes.a_normal = {
  80573. semantic: "NORMAL"
  80574. };
  80575. vertexShader += "attribute vec3 a_normal;\n";
  80576. vertexShader += "varying vec3 v_normal;\n";
  80577. if (hasSkinning) {
  80578. vertexShaderMain += " v_normal = u_normalMatrix * mat3(skinMatrix) * a_normal;\n";
  80579. } else {
  80580. vertexShaderMain += " v_normal = u_normalMatrix * a_normal;\n";
  80581. }
  80582. fragmentShader += "varying vec3 v_normal;\n";
  80583. }
  80584. let v_texcoord;
  80585. if (hasTexCoords) {
  80586. techniqueAttributes.a_texcoord_0 = {
  80587. semantic: "TEXCOORD_0"
  80588. };
  80589. v_texcoord = "v_texcoord_0";
  80590. vertexShader += "attribute vec2 a_texcoord_0;\n";
  80591. vertexShader += `varying vec2 ${v_texcoord};
  80592. `;
  80593. vertexShaderMain += ` ${v_texcoord} = a_texcoord_0;
  80594. `;
  80595. fragmentShader += `varying vec2 ${v_texcoord};
  80596. `;
  80597. }
  80598. if (hasSkinning) {
  80599. techniqueAttributes.a_joint = {
  80600. semantic: "JOINTS_0"
  80601. };
  80602. techniqueAttributes.a_weight = {
  80603. semantic: "WEIGHTS_0"
  80604. };
  80605. vertexShader += "attribute vec4 a_joint;\n";
  80606. vertexShader += "attribute vec4 a_weight;\n";
  80607. }
  80608. if (hasVertexColors) {
  80609. techniqueAttributes.a_vertexColor = {
  80610. semantic: "COLOR_0"
  80611. };
  80612. vertexShader += "attribute vec4 a_vertexColor;\n";
  80613. vertexShader += "varying vec4 v_vertexColor;\n";
  80614. vertexShaderMain += " v_vertexColor = a_vertexColor;\n";
  80615. fragmentShader += "varying vec4 v_vertexColor;\n";
  80616. }
  80617. if (addBatchIdToGeneratedShaders) {
  80618. techniqueAttributes.a_batchId = {
  80619. semantic: "_BATCHID"
  80620. };
  80621. vertexShader += "attribute float a_batchId;\n";
  80622. }
  80623. const hasSpecular = hasNormals && (lightingModel === "BLINN" || lightingModel === "PHONG") && defined_default(techniqueUniforms.u_specular) && defined_default(techniqueUniforms.u_shininess) && techniqueUniforms.u_shininess > 0;
  80624. let hasNonAmbientLights = false;
  80625. let hasAmbientLights = false;
  80626. let fragmentLightingBlock = "";
  80627. for (const lightName in lights) {
  80628. if (lights.hasOwnProperty(lightName)) {
  80629. const light = lights[lightName];
  80630. const lightType = light.type.toLowerCase();
  80631. const lightBaseName = light.baseName;
  80632. fragmentLightingBlock += " {\n";
  80633. const lightColorName = `u_${lightBaseName}Color`;
  80634. if (lightType === "ambient") {
  80635. hasAmbientLights = true;
  80636. fragmentLightingBlock += ` ambientLight += ${lightColorName};
  80637. `;
  80638. } else if (hasNormals) {
  80639. hasNonAmbientLights = true;
  80640. const varyingDirectionName = `v_${lightBaseName}Direction`;
  80641. const varyingPositionName = `v_${lightBaseName}Position`;
  80642. if (lightType !== "point") {
  80643. vertexShader += `varying vec3 ${varyingDirectionName};
  80644. `;
  80645. fragmentShader += `varying vec3 ${varyingDirectionName};
  80646. `;
  80647. vertexShaderMain += ` ${varyingDirectionName} = mat3(u_${lightBaseName}Transform) * vec3(0.,0.,1.);
  80648. `;
  80649. if (lightType === "directional") {
  80650. fragmentLightingBlock += ` vec3 l = normalize(${varyingDirectionName});
  80651. `;
  80652. }
  80653. }
  80654. if (lightType !== "directional") {
  80655. vertexShader += `varying vec3 ${varyingPositionName};
  80656. `;
  80657. fragmentShader += `varying vec3 ${varyingPositionName};
  80658. `;
  80659. vertexShaderMain += ` ${varyingPositionName} = u_${lightBaseName}Transform[3].xyz;
  80660. `;
  80661. fragmentLightingBlock += ` vec3 VP = ${varyingPositionName} - v_positionEC;
  80662. `;
  80663. fragmentLightingBlock += " vec3 l = normalize(VP);\n";
  80664. fragmentLightingBlock += " float range = length(VP);\n";
  80665. fragmentLightingBlock += ` float attenuation = 1.0 / (u_${lightBaseName}Attenuation.x + `;
  80666. fragmentLightingBlock += `(u_${lightBaseName}Attenuation.y * range) + `;
  80667. fragmentLightingBlock += `(u_${lightBaseName}Attenuation.z * range * range));
  80668. `;
  80669. } else {
  80670. fragmentLightingBlock += " float attenuation = 1.0;\n";
  80671. }
  80672. if (lightType === "spot") {
  80673. fragmentLightingBlock += ` float spotDot = dot(l, normalize(${varyingDirectionName}));
  80674. `;
  80675. fragmentLightingBlock += ` if (spotDot < cos(u_${lightBaseName}FallOff.x * 0.5))
  80676. `;
  80677. fragmentLightingBlock += " {\n";
  80678. fragmentLightingBlock += " attenuation = 0.0;\n";
  80679. fragmentLightingBlock += " }\n";
  80680. fragmentLightingBlock += " else\n";
  80681. fragmentLightingBlock += " {\n";
  80682. fragmentLightingBlock += ` attenuation *= max(0.0, pow(spotDot, u_${lightBaseName}FallOff.y));
  80683. `;
  80684. fragmentLightingBlock += " }\n";
  80685. }
  80686. fragmentLightingBlock += ` diffuseLight += ${lightColorName}* max(dot(normal,l), 0.) * attenuation;
  80687. `;
  80688. if (hasSpecular) {
  80689. if (lightingModel === "BLINN") {
  80690. fragmentLightingBlock += " vec3 h = normalize(l + viewDir);\n";
  80691. fragmentLightingBlock += " float specularIntensity = max(0., pow(max(dot(normal, h), 0.), u_shininess)) * attenuation;\n";
  80692. } else {
  80693. fragmentLightingBlock += " vec3 reflectDir = reflect(-l, normal);\n";
  80694. fragmentLightingBlock += " float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess)) * attenuation;\n";
  80695. }
  80696. fragmentLightingBlock += ` specularLight += ${lightColorName} * specularIntensity;
  80697. `;
  80698. }
  80699. }
  80700. fragmentLightingBlock += " }\n";
  80701. }
  80702. }
  80703. if (!hasAmbientLights) {
  80704. fragmentLightingBlock += " ambientLight += vec3(0.2, 0.2, 0.2);\n";
  80705. }
  80706. if (!hasNonAmbientLights && lightingModel !== "CONSTANT") {
  80707. fragmentShader += "#ifdef USE_CUSTOM_LIGHT_COLOR \n";
  80708. fragmentShader += "uniform vec3 gltf_lightColor; \n";
  80709. fragmentShader += "#endif \n";
  80710. fragmentLightingBlock += "#ifndef USE_CUSTOM_LIGHT_COLOR \n";
  80711. fragmentLightingBlock += " vec3 lightColor = czm_lightColor;\n";
  80712. fragmentLightingBlock += "#else \n";
  80713. fragmentLightingBlock += " vec3 lightColor = gltf_lightColor;\n";
  80714. fragmentLightingBlock += "#endif \n";
  80715. fragmentLightingBlock += " vec3 l = normalize(czm_lightDirectionEC);\n";
  80716. const minimumLighting = "0.2";
  80717. fragmentLightingBlock += ` diffuseLight += lightColor * max(dot(normal,l), ${minimumLighting});
  80718. `;
  80719. if (hasSpecular) {
  80720. if (lightingModel === "BLINN") {
  80721. fragmentLightingBlock += " vec3 h = normalize(l + viewDir);\n";
  80722. fragmentLightingBlock += " float specularIntensity = max(0., pow(max(dot(normal, h), 0.), u_shininess));\n";
  80723. } else {
  80724. fragmentLightingBlock += " vec3 reflectDir = reflect(-l, normal);\n";
  80725. fragmentLightingBlock += " float specularIntensity = max(0., pow(max(dot(reflectDir, viewDir), 0.), u_shininess));\n";
  80726. }
  80727. fragmentLightingBlock += " specularLight += lightColor * specularIntensity;\n";
  80728. }
  80729. }
  80730. vertexShader += "void main(void) {\n";
  80731. vertexShader += vertexShaderMain;
  80732. vertexShader += "}\n";
  80733. fragmentShader += "void main(void) {\n";
  80734. let colorCreationBlock = " vec3 color = vec3(0.0, 0.0, 0.0);\n";
  80735. if (hasNormals) {
  80736. fragmentShader += " vec3 normal = normalize(v_normal);\n";
  80737. if (khrMaterialsCommon.doubleSided) {
  80738. fragmentShader += " if (czm_backFacing())\n";
  80739. fragmentShader += " {\n";
  80740. fragmentShader += " normal = -normal;\n";
  80741. fragmentShader += " }\n";
  80742. }
  80743. }
  80744. let finalColorComputation;
  80745. if (lightingModel !== "CONSTANT") {
  80746. if (defined_default(techniqueUniforms.u_diffuse)) {
  80747. if (techniqueUniforms.u_diffuse.type === WebGLConstants_default.SAMPLER_2D) {
  80748. fragmentShader += ` vec4 diffuse = texture2D(u_diffuse, ${v_texcoord});
  80749. `;
  80750. } else {
  80751. fragmentShader += " vec4 diffuse = u_diffuse;\n";
  80752. }
  80753. fragmentShader += " vec3 diffuseLight = vec3(0.0, 0.0, 0.0);\n";
  80754. colorCreationBlock += " color += diffuse.rgb * diffuseLight;\n";
  80755. }
  80756. if (hasSpecular) {
  80757. if (techniqueUniforms.u_specular.type === WebGLConstants_default.SAMPLER_2D) {
  80758. fragmentShader += ` vec3 specular = texture2D(u_specular, ${v_texcoord}).rgb;
  80759. `;
  80760. } else {
  80761. fragmentShader += " vec3 specular = u_specular.rgb;\n";
  80762. }
  80763. fragmentShader += " vec3 specularLight = vec3(0.0, 0.0, 0.0);\n";
  80764. colorCreationBlock += " color += specular * specularLight;\n";
  80765. }
  80766. if (defined_default(techniqueUniforms.u_transparency)) {
  80767. finalColorComputation = " gl_FragColor = vec4(color * diffuse.a * u_transparency, diffuse.a * u_transparency);\n";
  80768. } else {
  80769. finalColorComputation = " gl_FragColor = vec4(color * diffuse.a, diffuse.a);\n";
  80770. }
  80771. } else if (defined_default(techniqueUniforms.u_transparency)) {
  80772. finalColorComputation = " gl_FragColor = vec4(color * u_transparency, u_transparency);\n";
  80773. } else {
  80774. finalColorComputation = " gl_FragColor = vec4(color, 1.0);\n";
  80775. }
  80776. if (hasVertexColors) {
  80777. colorCreationBlock += " color *= v_vertexColor.rgb;\n";
  80778. }
  80779. if (defined_default(techniqueUniforms.u_emission)) {
  80780. if (techniqueUniforms.u_emission.type === WebGLConstants_default.SAMPLER_2D) {
  80781. fragmentShader += ` vec3 emission = texture2D(u_emission, ${v_texcoord}).rgb;
  80782. `;
  80783. } else {
  80784. fragmentShader += " vec3 emission = u_emission.rgb;\n";
  80785. }
  80786. colorCreationBlock += " color += emission;\n";
  80787. }
  80788. if (defined_default(techniqueUniforms.u_ambient) || lightingModel !== "CONSTANT") {
  80789. if (defined_default(techniqueUniforms.u_ambient)) {
  80790. if (techniqueUniforms.u_ambient.type === WebGLConstants_default.SAMPLER_2D) {
  80791. fragmentShader += ` vec3 ambient = texture2D(u_ambient, ${v_texcoord}).rgb;
  80792. `;
  80793. } else {
  80794. fragmentShader += " vec3 ambient = u_ambient.rgb;\n";
  80795. }
  80796. } else {
  80797. fragmentShader += " vec3 ambient = diffuse.rgb;\n";
  80798. }
  80799. colorCreationBlock += " color += ambient * ambientLight;\n";
  80800. }
  80801. fragmentShader += " vec3 viewDir = -normalize(v_positionEC);\n";
  80802. fragmentShader += " vec3 ambientLight = vec3(0.0, 0.0, 0.0);\n";
  80803. fragmentShader += fragmentLightingBlock;
  80804. fragmentShader += colorCreationBlock;
  80805. fragmentShader += finalColorComputation;
  80806. fragmentShader += "}\n";
  80807. const vertexShaderId = addToArray_default(shaders, {
  80808. type: WebGLConstants_default.VERTEX_SHADER,
  80809. extras: {
  80810. _pipeline: {
  80811. source: vertexShader,
  80812. extension: ".glsl"
  80813. }
  80814. }
  80815. });
  80816. const fragmentShaderId = addToArray_default(shaders, {
  80817. type: WebGLConstants_default.FRAGMENT_SHADER,
  80818. extras: {
  80819. _pipeline: {
  80820. source: fragmentShader,
  80821. extension: ".glsl"
  80822. }
  80823. }
  80824. });
  80825. const programId = addToArray_default(programs, {
  80826. fragmentShader: fragmentShaderId,
  80827. vertexShader: vertexShaderId
  80828. });
  80829. const techniqueId = addToArray_default(techniques, {
  80830. attributes: techniqueAttributes,
  80831. program: programId,
  80832. uniforms: techniqueUniforms
  80833. });
  80834. return techniqueId;
  80835. }
  80836. function getKHRMaterialsCommonValueType(paramName, paramValue) {
  80837. let value;
  80838. if (defined_default(paramValue.value)) {
  80839. value = paramValue.value;
  80840. } else if (defined_default(paramValue.index)) {
  80841. value = [paramValue.index];
  80842. } else {
  80843. value = paramValue;
  80844. }
  80845. switch (paramName) {
  80846. case "ambient":
  80847. return value.length === 1 ? WebGLConstants_default.SAMPLER_2D : WebGLConstants_default.FLOAT_VEC4;
  80848. case "diffuse":
  80849. return value.length === 1 ? WebGLConstants_default.SAMPLER_2D : WebGLConstants_default.FLOAT_VEC4;
  80850. case "emission":
  80851. return value.length === 1 ? WebGLConstants_default.SAMPLER_2D : WebGLConstants_default.FLOAT_VEC4;
  80852. case "specular":
  80853. return value.length === 1 ? WebGLConstants_default.SAMPLER_2D : WebGLConstants_default.FLOAT_VEC4;
  80854. case "shininess":
  80855. return WebGLConstants_default.FLOAT;
  80856. case "transparency":
  80857. return WebGLConstants_default.FLOAT;
  80858. case "transparent":
  80859. return WebGLConstants_default.BOOL;
  80860. case "doubleSided":
  80861. return WebGLConstants_default.BOOL;
  80862. }
  80863. }
  80864. function getTechniqueKey(khrMaterialsCommon, primitiveInfo) {
  80865. let techniqueKey = "";
  80866. techniqueKey += `technique:${khrMaterialsCommon.technique};`;
  80867. const values = khrMaterialsCommon.values;
  80868. const keys = Object.keys(values).sort();
  80869. const keysCount = keys.length;
  80870. for (let i2 = 0; i2 < keysCount; ++i2) {
  80871. const name = keys[i2];
  80872. if (values.hasOwnProperty(name)) {
  80873. techniqueKey += `${name}:${getKHRMaterialsCommonValueType(
  80874. name,
  80875. values[name]
  80876. )}`;
  80877. techniqueKey += ";";
  80878. }
  80879. }
  80880. const jointCount = defaultValue_default(khrMaterialsCommon.jointCount, 0);
  80881. techniqueKey += `${jointCount.toString()};`;
  80882. if (defined_default(primitiveInfo)) {
  80883. const skinningInfo = primitiveInfo.skinning;
  80884. if (jointCount > 0) {
  80885. techniqueKey += `${skinningInfo.type};`;
  80886. }
  80887. techniqueKey += primitiveInfo.hasVertexColors;
  80888. }
  80889. return techniqueKey;
  80890. }
  80891. function lightDefaults(gltf) {
  80892. const khrMaterialsCommon = gltf.extensions.KHR_materials_common;
  80893. if (!defined_default(khrMaterialsCommon) || !defined_default(khrMaterialsCommon.lights)) {
  80894. return;
  80895. }
  80896. const lights = khrMaterialsCommon.lights;
  80897. const lightsLength = lights.length;
  80898. for (let lightId = 0; lightId < lightsLength; lightId++) {
  80899. const light = lights[lightId];
  80900. if (light.type === "ambient") {
  80901. if (!defined_default(light.ambient)) {
  80902. light.ambient = {};
  80903. }
  80904. const ambientLight = light.ambient;
  80905. if (!defined_default(ambientLight.color)) {
  80906. ambientLight.color = [1, 1, 1];
  80907. }
  80908. } else if (light.type === "directional") {
  80909. if (!defined_default(light.directional)) {
  80910. light.directional = {};
  80911. }
  80912. const directionalLight = light.directional;
  80913. if (!defined_default(directionalLight.color)) {
  80914. directionalLight.color = [1, 1, 1];
  80915. }
  80916. } else if (light.type === "point") {
  80917. if (!defined_default(light.point)) {
  80918. light.point = {};
  80919. }
  80920. const pointLight = light.point;
  80921. if (!defined_default(pointLight.color)) {
  80922. pointLight.color = [1, 1, 1];
  80923. }
  80924. pointLight.constantAttenuation = defaultValue_default(
  80925. pointLight.constantAttenuation,
  80926. 1
  80927. );
  80928. pointLight.linearAttenuation = defaultValue_default(
  80929. pointLight.linearAttenuation,
  80930. 0
  80931. );
  80932. pointLight.quadraticAttenuation = defaultValue_default(
  80933. pointLight.quadraticAttenuation,
  80934. 0
  80935. );
  80936. } else if (light.type === "spot") {
  80937. if (!defined_default(light.spot)) {
  80938. light.spot = {};
  80939. }
  80940. const spotLight = light.spot;
  80941. if (!defined_default(spotLight.color)) {
  80942. spotLight.color = [1, 1, 1];
  80943. }
  80944. spotLight.constantAttenuation = defaultValue_default(
  80945. spotLight.constantAttenuation,
  80946. 1
  80947. );
  80948. spotLight.fallOffAngle = defaultValue_default(spotLight.fallOffAngle, 3.14159265);
  80949. spotLight.fallOffExponent = defaultValue_default(spotLight.fallOffExponent, 0);
  80950. spotLight.linearAttenuation = defaultValue_default(
  80951. spotLight.linearAttenuation,
  80952. 0
  80953. );
  80954. spotLight.quadraticAttenuation = defaultValue_default(
  80955. spotLight.quadraticAttenuation,
  80956. 0
  80957. );
  80958. }
  80959. }
  80960. }
  80961. var processModelMaterialsCommon_default = processModelMaterialsCommon;
  80962. // node_modules/cesium/Source/Scene/processPbrMaterials.js
  80963. function processPbrMaterials(gltf, options) {
  80964. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  80965. if (usesExtension_default(gltf, "KHR_techniques_webgl")) {
  80966. return gltf;
  80967. }
  80968. if (!defined_default(gltf.materials) || gltf.materials.length === 0) {
  80969. return gltf;
  80970. }
  80971. if (!defined_default(gltf.extensions)) {
  80972. gltf.extensions = {};
  80973. }
  80974. if (!defined_default(gltf.extensionsUsed)) {
  80975. gltf.extensionsUsed = [];
  80976. }
  80977. if (!defined_default(gltf.extensionsRequired)) {
  80978. gltf.extensionsRequired = [];
  80979. }
  80980. gltf.extensions.KHR_techniques_webgl = {
  80981. programs: [],
  80982. shaders: [],
  80983. techniques: []
  80984. };
  80985. gltf.extensionsUsed.push("KHR_techniques_webgl");
  80986. gltf.extensionsRequired.push("KHR_techniques_webgl");
  80987. const primitiveByMaterial = ModelUtility_default.splitIncompatibleMaterials(gltf);
  80988. ForEach_default.material(gltf, function(material, materialIndex) {
  80989. const generatedMaterialValues = {};
  80990. const technique = generateTechnique2(
  80991. gltf,
  80992. material,
  80993. materialIndex,
  80994. generatedMaterialValues,
  80995. primitiveByMaterial,
  80996. options
  80997. );
  80998. if (!defined_default(material.extensions)) {
  80999. material.extensions = {};
  81000. }
  81001. material.extensions.KHR_techniques_webgl = {
  81002. values: generatedMaterialValues,
  81003. technique
  81004. };
  81005. });
  81006. ModelUtility_default.ensureSemanticExistence(gltf);
  81007. return gltf;
  81008. }
  81009. function isSpecularGlossinessMaterial(material) {
  81010. return defined_default(material.extensions) && defined_default(material.extensions.KHR_materials_pbrSpecularGlossiness);
  81011. }
  81012. function addTextureCoordinates(gltf, textureName, generatedMaterialValues, defaultTexCoord, result) {
  81013. let texCoord;
  81014. const texInfo = generatedMaterialValues[textureName];
  81015. if (defined_default(texInfo) && defined_default(texInfo.texCoord) && texInfo.texCoord === 1) {
  81016. defaultTexCoord = defaultTexCoord.replace("0", "1");
  81017. }
  81018. if (defined_default(generatedMaterialValues[`${textureName}Offset`])) {
  81019. texCoord = `${textureName}Coord`;
  81020. result.fragmentShaderMain += ` vec2 ${texCoord} = computeTexCoord(${defaultTexCoord}, ${textureName}Offset, ${textureName}Rotation, ${textureName}Scale);
  81021. `;
  81022. } else {
  81023. texCoord = defaultTexCoord;
  81024. }
  81025. return texCoord;
  81026. }
  81027. var DEFAULT_TEXTURE_OFFSET = [0, 0];
  81028. var DEFAULT_TEXTURE_ROTATION = [0];
  81029. var DEFAULT_TEXTURE_SCALE = [1, 1];
  81030. function handleKHRTextureTransform(parameterName, value, generatedMaterialValues) {
  81031. if (parameterName.indexOf("Texture") === -1 || !defined_default(value.extensions) || !defined_default(value.extensions.KHR_texture_transform)) {
  81032. return;
  81033. }
  81034. const uniformName = `u_${parameterName}`;
  81035. const extension = value.extensions.KHR_texture_transform;
  81036. generatedMaterialValues[`${uniformName}Offset`] = defaultValue_default(
  81037. extension.offset,
  81038. DEFAULT_TEXTURE_OFFSET
  81039. );
  81040. generatedMaterialValues[`${uniformName}Rotation`] = defaultValue_default(
  81041. extension.rotation,
  81042. DEFAULT_TEXTURE_ROTATION
  81043. );
  81044. generatedMaterialValues[`${uniformName}Scale`] = defaultValue_default(
  81045. extension.scale,
  81046. DEFAULT_TEXTURE_SCALE
  81047. );
  81048. if (defined_default(value.texCoord) && defined_default(extension.texCoord)) {
  81049. generatedMaterialValues[uniformName].texCoord = extension.texCoord;
  81050. }
  81051. }
  81052. function generateTechnique2(gltf, material, materialIndex, generatedMaterialValues, primitiveByMaterial, options) {
  81053. const addBatchIdToGeneratedShaders = defaultValue_default(
  81054. options.addBatchIdToGeneratedShaders,
  81055. false
  81056. );
  81057. const techniquesWebgl = gltf.extensions.KHR_techniques_webgl;
  81058. const techniques = techniquesWebgl.techniques;
  81059. const shaders = techniquesWebgl.shaders;
  81060. const programs = techniquesWebgl.programs;
  81061. const useSpecGloss = isSpecularGlossinessMaterial(material);
  81062. let uniformName;
  81063. let parameterName;
  81064. let value;
  81065. const pbrMetallicRoughness = material.pbrMetallicRoughness;
  81066. if (defined_default(pbrMetallicRoughness) && !useSpecGloss) {
  81067. for (parameterName in pbrMetallicRoughness) {
  81068. if (pbrMetallicRoughness.hasOwnProperty(parameterName)) {
  81069. value = pbrMetallicRoughness[parameterName];
  81070. uniformName = `u_${parameterName}`;
  81071. generatedMaterialValues[uniformName] = value;
  81072. handleKHRTextureTransform(
  81073. parameterName,
  81074. value,
  81075. generatedMaterialValues
  81076. );
  81077. }
  81078. }
  81079. }
  81080. if (useSpecGloss) {
  81081. const pbrSpecularGlossiness = material.extensions.KHR_materials_pbrSpecularGlossiness;
  81082. for (parameterName in pbrSpecularGlossiness) {
  81083. if (pbrSpecularGlossiness.hasOwnProperty(parameterName)) {
  81084. value = pbrSpecularGlossiness[parameterName];
  81085. uniformName = `u_${parameterName}`;
  81086. generatedMaterialValues[uniformName] = value;
  81087. handleKHRTextureTransform(
  81088. parameterName,
  81089. value,
  81090. generatedMaterialValues
  81091. );
  81092. }
  81093. }
  81094. }
  81095. for (const additional in material) {
  81096. if (material.hasOwnProperty(additional) && (additional.indexOf("Texture") >= 0 || additional.indexOf("Factor") >= 0)) {
  81097. value = material[additional];
  81098. uniformName = `u_${additional}`;
  81099. generatedMaterialValues[uniformName] = value;
  81100. handleKHRTextureTransform(additional, value, generatedMaterialValues);
  81101. }
  81102. }
  81103. let vertexShader = "precision highp float;\n";
  81104. let fragmentShader = "precision highp float;\n";
  81105. let skin;
  81106. if (defined_default(gltf.skins)) {
  81107. skin = gltf.skins[0];
  81108. }
  81109. const joints = defined_default(skin) ? skin.joints : [];
  81110. const jointCount = joints.length;
  81111. const primitiveInfo = primitiveByMaterial[materialIndex];
  81112. let skinningInfo;
  81113. let hasSkinning = false;
  81114. let hasVertexColors = false;
  81115. let hasMorphTargets = false;
  81116. let hasNormals = false;
  81117. let hasTangents = false;
  81118. let hasTexCoords = false;
  81119. let hasTexCoord1 = false;
  81120. let hasOutline = false;
  81121. let isUnlit = false;
  81122. if (defined_default(primitiveInfo)) {
  81123. skinningInfo = primitiveInfo.skinning;
  81124. hasSkinning = skinningInfo.skinned && joints.length > 0;
  81125. hasVertexColors = primitiveInfo.hasVertexColors;
  81126. hasMorphTargets = primitiveInfo.hasMorphTargets;
  81127. hasNormals = primitiveInfo.hasNormals;
  81128. hasTangents = primitiveInfo.hasTangents;
  81129. hasTexCoords = primitiveInfo.hasTexCoords;
  81130. hasTexCoord1 = primitiveInfo.hasTexCoord1;
  81131. hasOutline = primitiveInfo.hasOutline;
  81132. }
  81133. let morphTargets;
  81134. if (hasMorphTargets) {
  81135. ForEach_default.mesh(gltf, function(mesh2) {
  81136. ForEach_default.meshPrimitive(mesh2, function(primitive) {
  81137. if (primitive.material === materialIndex) {
  81138. const targets = primitive.targets;
  81139. if (defined_default(targets)) {
  81140. morphTargets = targets;
  81141. }
  81142. }
  81143. });
  81144. });
  81145. }
  81146. const techniqueUniforms = {
  81147. u_modelViewMatrix: {
  81148. semantic: usesExtension_default(gltf, "CESIUM_RTC") ? "CESIUM_RTC_MODELVIEW" : "MODELVIEW",
  81149. type: WebGLConstants_default.FLOAT_MAT4
  81150. },
  81151. u_projectionMatrix: {
  81152. semantic: "PROJECTION",
  81153. type: WebGLConstants_default.FLOAT_MAT4
  81154. }
  81155. };
  81156. if (defined_default(material.extensions) && defined_default(material.extensions.KHR_materials_unlit)) {
  81157. isUnlit = true;
  81158. }
  81159. if (hasNormals) {
  81160. techniqueUniforms.u_normalMatrix = {
  81161. semantic: "MODELVIEWINVERSETRANSPOSE",
  81162. type: WebGLConstants_default.FLOAT_MAT3
  81163. };
  81164. }
  81165. if (hasSkinning) {
  81166. techniqueUniforms.u_jointMatrix = {
  81167. count: jointCount,
  81168. semantic: "JOINTMATRIX",
  81169. type: WebGLConstants_default.FLOAT_MAT4
  81170. };
  81171. }
  81172. if (hasMorphTargets) {
  81173. techniqueUniforms.u_morphWeights = {
  81174. count: morphTargets.length,
  81175. semantic: "MORPHWEIGHTS",
  81176. type: WebGLConstants_default.FLOAT
  81177. };
  81178. }
  81179. const alphaMode = material.alphaMode;
  81180. if (defined_default(alphaMode) && alphaMode === "MASK") {
  81181. techniqueUniforms.u_alphaCutoff = {
  81182. semantic: "ALPHACUTOFF",
  81183. type: WebGLConstants_default.FLOAT
  81184. };
  81185. }
  81186. for (uniformName in generatedMaterialValues) {
  81187. if (generatedMaterialValues.hasOwnProperty(uniformName)) {
  81188. techniqueUniforms[uniformName] = {
  81189. type: getPBRValueType(uniformName)
  81190. };
  81191. }
  81192. }
  81193. const baseColorUniform = defaultValue_default(
  81194. techniqueUniforms.u_baseColorTexture,
  81195. techniqueUniforms.u_baseColorFactor
  81196. );
  81197. if (defined_default(baseColorUniform)) {
  81198. baseColorUniform.semantic = "_3DTILESDIFFUSE";
  81199. }
  81200. for (uniformName in techniqueUniforms) {
  81201. if (techniqueUniforms.hasOwnProperty(uniformName)) {
  81202. const uniform = techniqueUniforms[uniformName];
  81203. const arraySize = defined_default(uniform.count) ? `[${uniform.count}]` : "";
  81204. if (uniform.type !== WebGLConstants_default.FLOAT_MAT3 && uniform.type !== WebGLConstants_default.FLOAT_MAT4 && uniformName !== "u_morphWeights" || uniform.useInFragment) {
  81205. fragmentShader += `uniform ${webGLConstantToGlslType_default(
  81206. uniform.type
  81207. )} ${uniformName}${arraySize};
  81208. `;
  81209. delete uniform.useInFragment;
  81210. } else {
  81211. vertexShader += `uniform ${webGLConstantToGlslType_default(
  81212. uniform.type
  81213. )} ${uniformName}${arraySize};
  81214. `;
  81215. }
  81216. }
  81217. }
  81218. if (hasOutline) {
  81219. fragmentShader += "uniform sampler2D u_outlineTexture;\n";
  81220. }
  81221. let vertexShaderMain = "";
  81222. if (hasSkinning) {
  81223. vertexShaderMain += " mat4 skinMatrix =\n a_weight.x * u_jointMatrix[int(a_joint.x)] +\n a_weight.y * u_jointMatrix[int(a_joint.y)] +\n a_weight.z * u_jointMatrix[int(a_joint.z)] +\n a_weight.w * u_jointMatrix[int(a_joint.w)];\n";
  81224. }
  81225. const techniqueAttributes = {
  81226. a_position: {
  81227. semantic: "POSITION"
  81228. }
  81229. };
  81230. if (hasOutline) {
  81231. techniqueAttributes.a_outlineCoordinates = {
  81232. semantic: "_OUTLINE_COORDINATES"
  81233. };
  81234. }
  81235. vertexShader += "attribute vec3 a_position;\n";
  81236. if (hasNormals) {
  81237. vertexShader += "varying vec3 v_positionEC;\n";
  81238. }
  81239. if (hasOutline) {
  81240. vertexShader += "attribute vec3 a_outlineCoordinates;\n";
  81241. vertexShader += "varying vec3 v_outlineCoordinates;\n";
  81242. }
  81243. vertexShaderMain += " vec3 weightedPosition = a_position;\n";
  81244. if (hasNormals) {
  81245. vertexShaderMain += " vec3 weightedNormal = a_normal;\n";
  81246. }
  81247. if (hasTangents) {
  81248. vertexShaderMain += " vec4 weightedTangent = a_tangent;\n";
  81249. }
  81250. if (hasMorphTargets) {
  81251. for (let k = 0; k < morphTargets.length; k++) {
  81252. const targetAttributes = morphTargets[k];
  81253. for (const targetAttribute in targetAttributes) {
  81254. if (targetAttributes.hasOwnProperty(targetAttribute) && targetAttribute !== "extras") {
  81255. const attributeName = `a_${targetAttribute}_${k}`;
  81256. techniqueAttributes[attributeName] = {
  81257. semantic: `${targetAttribute}_${k}`
  81258. };
  81259. vertexShader += `attribute vec3 ${attributeName};
  81260. `;
  81261. if (targetAttribute === "POSITION") {
  81262. vertexShaderMain += ` weightedPosition += u_morphWeights[${k}] * ${attributeName};
  81263. `;
  81264. } else if (targetAttribute === "NORMAL") {
  81265. vertexShaderMain += ` weightedNormal += u_morphWeights[${k}] * ${attributeName};
  81266. `;
  81267. } else if (hasTangents && targetAttribute === "TANGENT") {
  81268. vertexShaderMain += ` weightedTangent.xyz += u_morphWeights[${k}] * ${attributeName};
  81269. `;
  81270. }
  81271. }
  81272. }
  81273. }
  81274. }
  81275. if (hasSkinning) {
  81276. vertexShaderMain += " vec4 position = skinMatrix * vec4(weightedPosition, 1.0);\n";
  81277. } else {
  81278. vertexShaderMain += " vec4 position = vec4(weightedPosition, 1.0);\n";
  81279. }
  81280. vertexShaderMain += " position = u_modelViewMatrix * position;\n";
  81281. if (hasNormals) {
  81282. vertexShaderMain += " v_positionEC = position.xyz;\n";
  81283. }
  81284. vertexShaderMain += " gl_Position = u_projectionMatrix * position;\n";
  81285. if (hasOutline) {
  81286. vertexShaderMain += " v_outlineCoordinates = a_outlineCoordinates;\n";
  81287. }
  81288. if (hasNormals) {
  81289. techniqueAttributes.a_normal = {
  81290. semantic: "NORMAL"
  81291. };
  81292. vertexShader += "attribute vec3 a_normal;\n";
  81293. if (!isUnlit) {
  81294. vertexShader += "varying vec3 v_normal;\n";
  81295. if (hasSkinning) {
  81296. vertexShaderMain += " v_normal = u_normalMatrix * mat3(skinMatrix) * weightedNormal;\n";
  81297. } else {
  81298. vertexShaderMain += " v_normal = u_normalMatrix * weightedNormal;\n";
  81299. }
  81300. fragmentShader += "varying vec3 v_normal;\n";
  81301. }
  81302. fragmentShader += "varying vec3 v_positionEC;\n";
  81303. }
  81304. if (hasTangents) {
  81305. techniqueAttributes.a_tangent = {
  81306. semantic: "TANGENT"
  81307. };
  81308. vertexShader += "attribute vec4 a_tangent;\n";
  81309. vertexShader += "varying vec4 v_tangent;\n";
  81310. vertexShaderMain += " v_tangent.xyz = u_normalMatrix * weightedTangent.xyz;\n";
  81311. vertexShaderMain += " v_tangent.w = weightedTangent.w;\n";
  81312. fragmentShader += "varying vec4 v_tangent;\n";
  81313. }
  81314. if (hasOutline) {
  81315. fragmentShader += "varying vec3 v_outlineCoordinates;\n";
  81316. }
  81317. let fragmentShaderMain = "";
  81318. let v_texCoord;
  81319. let normalTexCoord;
  81320. let baseColorTexCoord;
  81321. let specularGlossinessTexCoord;
  81322. let diffuseTexCoord;
  81323. let metallicRoughnessTexCoord;
  81324. let occlusionTexCoord;
  81325. let emissiveTexCoord;
  81326. if (hasTexCoords) {
  81327. techniqueAttributes.a_texcoord_0 = {
  81328. semantic: "TEXCOORD_0"
  81329. };
  81330. v_texCoord = "v_texcoord_0";
  81331. vertexShader += "attribute vec2 a_texcoord_0;\n";
  81332. vertexShader += `varying vec2 ${v_texCoord};
  81333. `;
  81334. vertexShaderMain += ` ${v_texCoord} = a_texcoord_0;
  81335. `;
  81336. fragmentShader += `varying vec2 ${v_texCoord};
  81337. `;
  81338. if (hasTexCoord1) {
  81339. techniqueAttributes.a_texcoord_1 = {
  81340. semantic: "TEXCOORD_1"
  81341. };
  81342. const v_texCoord1 = v_texCoord.replace("0", "1");
  81343. vertexShader += "attribute vec2 a_texcoord_1;\n";
  81344. vertexShader += `varying vec2 ${v_texCoord1};
  81345. `;
  81346. vertexShaderMain += ` ${v_texCoord1} = a_texcoord_1;
  81347. `;
  81348. fragmentShader += `varying vec2 ${v_texCoord1};
  81349. `;
  81350. }
  81351. const result = {
  81352. fragmentShaderMain
  81353. };
  81354. normalTexCoord = addTextureCoordinates(
  81355. gltf,
  81356. "u_normalTexture",
  81357. generatedMaterialValues,
  81358. v_texCoord,
  81359. result
  81360. );
  81361. baseColorTexCoord = addTextureCoordinates(
  81362. gltf,
  81363. "u_baseColorTexture",
  81364. generatedMaterialValues,
  81365. v_texCoord,
  81366. result
  81367. );
  81368. specularGlossinessTexCoord = addTextureCoordinates(
  81369. gltf,
  81370. "u_specularGlossinessTexture",
  81371. generatedMaterialValues,
  81372. v_texCoord,
  81373. result
  81374. );
  81375. diffuseTexCoord = addTextureCoordinates(
  81376. gltf,
  81377. "u_diffuseTexture",
  81378. generatedMaterialValues,
  81379. v_texCoord,
  81380. result
  81381. );
  81382. metallicRoughnessTexCoord = addTextureCoordinates(
  81383. gltf,
  81384. "u_metallicRoughnessTexture",
  81385. generatedMaterialValues,
  81386. v_texCoord,
  81387. result
  81388. );
  81389. occlusionTexCoord = addTextureCoordinates(
  81390. gltf,
  81391. "u_occlusionTexture",
  81392. generatedMaterialValues,
  81393. v_texCoord,
  81394. result
  81395. );
  81396. emissiveTexCoord = addTextureCoordinates(
  81397. gltf,
  81398. "u_emissiveTexture",
  81399. generatedMaterialValues,
  81400. v_texCoord,
  81401. result
  81402. );
  81403. fragmentShaderMain = result.fragmentShaderMain;
  81404. }
  81405. if (hasSkinning) {
  81406. techniqueAttributes.a_joint = {
  81407. semantic: "JOINTS_0"
  81408. };
  81409. techniqueAttributes.a_weight = {
  81410. semantic: "WEIGHTS_0"
  81411. };
  81412. vertexShader += "attribute vec4 a_joint;\n";
  81413. vertexShader += "attribute vec4 a_weight;\n";
  81414. }
  81415. if (hasVertexColors) {
  81416. techniqueAttributes.a_vertexColor = {
  81417. semantic: "COLOR_0"
  81418. };
  81419. vertexShader += "attribute vec4 a_vertexColor;\n";
  81420. vertexShader += "varying vec4 v_vertexColor;\n";
  81421. vertexShaderMain += " v_vertexColor = a_vertexColor;\n";
  81422. fragmentShader += "varying vec4 v_vertexColor;\n";
  81423. }
  81424. if (addBatchIdToGeneratedShaders) {
  81425. techniqueAttributes.a_batchId = {
  81426. semantic: "_BATCHID"
  81427. };
  81428. vertexShader += "attribute float a_batchId;\n";
  81429. }
  81430. vertexShader += "void main(void) \n{\n";
  81431. vertexShader += vertexShaderMain;
  81432. vertexShader += "}\n";
  81433. if (hasNormals && !isUnlit) {
  81434. fragmentShader += "const float M_PI = 3.141592653589793;\n";
  81435. fragmentShader += "vec3 lambertianDiffuse(vec3 diffuseColor) \n{\n return diffuseColor / M_PI;\n}\n\n";
  81436. fragmentShader += "vec3 fresnelSchlick2(vec3 f0, vec3 f90, float VdotH) \n{\n return f0 + (f90 - f0) * pow(clamp(1.0 - VdotH, 0.0, 1.0), 5.0);\n}\n\n";
  81437. fragmentShader += "vec3 fresnelSchlick(float metalness, float VdotH) \n{\n return metalness + (vec3(1.0) - metalness) * pow(1.0 - VdotH, 5.0);\n}\n\n";
  81438. fragmentShader += "float smithVisibilityG1(float NdotV, float roughness) \n{\n float k = (roughness + 1.0) * (roughness + 1.0) / 8.0;\n return NdotV / (NdotV * (1.0 - k) + k);\n}\n\n";
  81439. fragmentShader += "float smithVisibilityGGX(float roughness, float NdotL, float NdotV) \n{\n return smithVisibilityG1(NdotL, roughness) * smithVisibilityG1(NdotV, roughness);\n}\n\n";
  81440. fragmentShader += "float GGX(float roughness, float NdotH) \n{\n float roughnessSquared = roughness * roughness;\n float f = (NdotH * roughnessSquared - NdotH) * NdotH + 1.0;\n return roughnessSquared / (M_PI * f * f);\n}\n\n";
  81441. }
  81442. fragmentShader += "vec3 SRGBtoLINEAR3(vec3 srgbIn) \n{\n return pow(srgbIn, vec3(2.2));\n}\n\n";
  81443. fragmentShader += "vec4 SRGBtoLINEAR4(vec4 srgbIn) \n{\n vec3 linearOut = pow(srgbIn.rgb, vec3(2.2));\n return vec4(linearOut, srgbIn.a);\n}\n\n";
  81444. fragmentShader += "vec3 applyTonemapping(vec3 linearIn) \n{\n#ifndef HDR \n return czm_acesTonemapping(linearIn);\n#else \n return linearIn;\n#endif \n}\n\n";
  81445. fragmentShader += "vec3 LINEARtoSRGB(vec3 linearIn) \n{\n#ifndef HDR \n return pow(linearIn, vec3(1.0/2.2));\n#else \n return linearIn;\n#endif \n}\n\n";
  81446. fragmentShader += "vec2 computeTexCoord(vec2 texCoords, vec2 offset, float rotation, vec2 scale) \n{\n rotation = -rotation; \n mat3 transform = mat3(\n cos(rotation) * scale.x, sin(rotation) * scale.x, 0.0, \n -sin(rotation) * scale.y, cos(rotation) * scale.y, 0.0, \n offset.x, offset.y, 1.0); \n vec2 transformedTexCoords = (transform * vec3(fract(texCoords), 1.0)).xy; \n return transformedTexCoords; \n}\n\n";
  81447. fragmentShader += "#ifdef USE_IBL_LIGHTING \n";
  81448. fragmentShader += "uniform vec2 gltf_iblFactor; \n";
  81449. fragmentShader += "#endif \n";
  81450. fragmentShader += "#ifdef USE_CUSTOM_LIGHT_COLOR \n";
  81451. fragmentShader += "uniform vec3 gltf_lightColor; \n";
  81452. fragmentShader += "#endif \n";
  81453. fragmentShader += "void main(void) \n{\n";
  81454. fragmentShader += fragmentShaderMain;
  81455. if (hasNormals && !isUnlit) {
  81456. fragmentShader += " vec3 ng = normalize(v_normal);\n";
  81457. fragmentShader += " vec3 positionWC = vec3(czm_inverseView * vec4(v_positionEC, 1.0));\n";
  81458. if (defined_default(generatedMaterialValues.u_normalTexture)) {
  81459. if (hasTangents) {
  81460. fragmentShader += " vec3 t = normalize(v_tangent.xyz);\n";
  81461. fragmentShader += " vec3 b = normalize(cross(ng, t) * v_tangent.w);\n";
  81462. fragmentShader += " mat3 tbn = mat3(t, b, ng);\n";
  81463. fragmentShader += ` vec3 n = texture2D(u_normalTexture, ${normalTexCoord}).rgb;
  81464. `;
  81465. fragmentShader += " n = normalize(tbn * (2.0 * n - 1.0));\n";
  81466. } else {
  81467. fragmentShader = `${"#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n#endif\n"}${fragmentShader}`;
  81468. fragmentShader += "#ifdef GL_OES_standard_derivatives\n";
  81469. fragmentShader += " vec3 pos_dx = dFdx(v_positionEC);\n";
  81470. fragmentShader += " vec3 pos_dy = dFdy(v_positionEC);\n";
  81471. fragmentShader += ` vec3 tex_dx = dFdx(vec3(${normalTexCoord},0.0));
  81472. `;
  81473. fragmentShader += ` vec3 tex_dy = dFdy(vec3(${normalTexCoord},0.0));
  81474. `;
  81475. fragmentShader += " vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);\n";
  81476. fragmentShader += " t = normalize(t - ng * dot(ng, t));\n";
  81477. fragmentShader += " vec3 b = normalize(cross(ng, t));\n";
  81478. fragmentShader += " mat3 tbn = mat3(t, b, ng);\n";
  81479. fragmentShader += ` vec3 n = texture2D(u_normalTexture, ${normalTexCoord}).rgb;
  81480. `;
  81481. fragmentShader += " n = normalize(tbn * (2.0 * n - 1.0));\n";
  81482. fragmentShader += "#else\n";
  81483. fragmentShader += " vec3 n = ng;\n";
  81484. fragmentShader += "#endif\n";
  81485. }
  81486. } else {
  81487. fragmentShader += " vec3 n = ng;\n";
  81488. }
  81489. if (material.doubleSided) {
  81490. fragmentShader += " if (czm_backFacing())\n";
  81491. fragmentShader += " {\n";
  81492. fragmentShader += " n = -n;\n";
  81493. fragmentShader += " }\n";
  81494. }
  81495. }
  81496. if (defined_default(generatedMaterialValues.u_baseColorTexture)) {
  81497. fragmentShader += ` vec4 baseColorWithAlpha = SRGBtoLINEAR4(texture2D(u_baseColorTexture, ${baseColorTexCoord}));
  81498. `;
  81499. if (defined_default(generatedMaterialValues.u_baseColorFactor)) {
  81500. fragmentShader += " baseColorWithAlpha *= u_baseColorFactor;\n";
  81501. }
  81502. } else if (defined_default(generatedMaterialValues.u_baseColorFactor)) {
  81503. fragmentShader += " vec4 baseColorWithAlpha = u_baseColorFactor;\n";
  81504. } else {
  81505. fragmentShader += " vec4 baseColorWithAlpha = vec4(1.0);\n";
  81506. }
  81507. if (hasVertexColors) {
  81508. fragmentShader += " baseColorWithAlpha *= v_vertexColor;\n";
  81509. }
  81510. fragmentShader += " vec3 baseColor = baseColorWithAlpha.rgb;\n";
  81511. if (hasNormals && !isUnlit) {
  81512. if (useSpecGloss) {
  81513. if (defined_default(generatedMaterialValues.u_specularGlossinessTexture)) {
  81514. fragmentShader += ` vec4 specularGlossiness = SRGBtoLINEAR4(texture2D(u_specularGlossinessTexture, ${specularGlossinessTexCoord}));
  81515. `;
  81516. fragmentShader += " vec3 specular = specularGlossiness.rgb;\n";
  81517. fragmentShader += " float glossiness = specularGlossiness.a;\n";
  81518. if (defined_default(generatedMaterialValues.u_specularFactor)) {
  81519. fragmentShader += " specular *= u_specularFactor;\n";
  81520. }
  81521. if (defined_default(generatedMaterialValues.u_glossinessFactor)) {
  81522. fragmentShader += " glossiness *= u_glossinessFactor;\n";
  81523. }
  81524. } else {
  81525. if (defined_default(generatedMaterialValues.u_specularFactor)) {
  81526. fragmentShader += " vec3 specular = clamp(u_specularFactor, vec3(0.0), vec3(1.0));\n";
  81527. } else {
  81528. fragmentShader += " vec3 specular = vec3(1.0);\n";
  81529. }
  81530. if (defined_default(generatedMaterialValues.u_glossinessFactor)) {
  81531. fragmentShader += " float glossiness = clamp(u_glossinessFactor, 0.0, 1.0);\n";
  81532. } else {
  81533. fragmentShader += " float glossiness = 1.0;\n";
  81534. }
  81535. }
  81536. if (defined_default(generatedMaterialValues.u_diffuseTexture)) {
  81537. fragmentShader += ` vec4 diffuse = SRGBtoLINEAR4(texture2D(u_diffuseTexture, ${diffuseTexCoord}));
  81538. `;
  81539. if (defined_default(generatedMaterialValues.u_diffuseFactor)) {
  81540. fragmentShader += " diffuse *= u_diffuseFactor;\n";
  81541. }
  81542. } else if (defined_default(generatedMaterialValues.u_diffuseFactor)) {
  81543. fragmentShader += " vec4 diffuse = clamp(u_diffuseFactor, vec4(0.0), vec4(1.0));\n";
  81544. } else {
  81545. fragmentShader += " vec4 diffuse = vec4(1.0);\n";
  81546. }
  81547. fragmentShader += " baseColorWithAlpha.a = diffuse.a;\n";
  81548. } else if (defined_default(generatedMaterialValues.u_metallicRoughnessTexture)) {
  81549. fragmentShader += ` vec3 metallicRoughness = texture2D(u_metallicRoughnessTexture, ${metallicRoughnessTexCoord}).rgb;
  81550. `;
  81551. fragmentShader += " float metalness = clamp(metallicRoughness.b, 0.0, 1.0);\n";
  81552. fragmentShader += " float roughness = clamp(metallicRoughness.g, 0.04, 1.0);\n";
  81553. if (defined_default(generatedMaterialValues.u_metallicFactor)) {
  81554. fragmentShader += " metalness *= u_metallicFactor;\n";
  81555. }
  81556. if (defined_default(generatedMaterialValues.u_roughnessFactor)) {
  81557. fragmentShader += " roughness *= u_roughnessFactor;\n";
  81558. }
  81559. } else {
  81560. if (defined_default(generatedMaterialValues.u_metallicFactor)) {
  81561. fragmentShader += " float metalness = clamp(u_metallicFactor, 0.0, 1.0);\n";
  81562. } else {
  81563. fragmentShader += " float metalness = 1.0;\n";
  81564. }
  81565. if (defined_default(generatedMaterialValues.u_roughnessFactor)) {
  81566. fragmentShader += " float roughness = clamp(u_roughnessFactor, 0.04, 1.0);\n";
  81567. } else {
  81568. fragmentShader += " float roughness = 1.0;\n";
  81569. }
  81570. }
  81571. fragmentShader += " vec3 v = -normalize(v_positionEC);\n";
  81572. fragmentShader += "#ifndef USE_CUSTOM_LIGHT_COLOR \n";
  81573. fragmentShader += " vec3 lightColorHdr = czm_lightColorHdr;\n";
  81574. fragmentShader += "#else \n";
  81575. fragmentShader += " vec3 lightColorHdr = gltf_lightColor;\n";
  81576. fragmentShader += "#endif \n";
  81577. fragmentShader += " vec3 l = normalize(czm_lightDirectionEC);\n";
  81578. fragmentShader += " vec3 h = normalize(v + l);\n";
  81579. fragmentShader += " float NdotL = clamp(dot(n, l), 0.001, 1.0);\n";
  81580. fragmentShader += " float NdotV = abs(dot(n, v)) + 0.001;\n";
  81581. fragmentShader += " float NdotH = clamp(dot(n, h), 0.0, 1.0);\n";
  81582. fragmentShader += " float LdotH = clamp(dot(l, h), 0.0, 1.0);\n";
  81583. fragmentShader += " float VdotH = clamp(dot(v, h), 0.0, 1.0);\n";
  81584. fragmentShader += " vec3 f0 = vec3(0.04);\n";
  81585. if (useSpecGloss) {
  81586. fragmentShader += " float roughness = 1.0 - glossiness;\n";
  81587. fragmentShader += " vec3 diffuseColor = diffuse.rgb * (1.0 - max(max(specular.r, specular.g), specular.b));\n";
  81588. fragmentShader += " vec3 specularColor = specular;\n";
  81589. } else {
  81590. fragmentShader += " vec3 diffuseColor = baseColor * (1.0 - metalness) * (1.0 - f0);\n";
  81591. fragmentShader += " vec3 specularColor = mix(f0, baseColor, metalness);\n";
  81592. }
  81593. fragmentShader += " float alpha = roughness * roughness;\n";
  81594. fragmentShader += " float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);\n";
  81595. fragmentShader += " vec3 r90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));\n";
  81596. fragmentShader += " vec3 r0 = specularColor.rgb;\n";
  81597. fragmentShader += " vec3 F = fresnelSchlick2(r0, r90, VdotH);\n";
  81598. fragmentShader += " float G = smithVisibilityGGX(alpha, NdotL, NdotV);\n";
  81599. fragmentShader += " float D = GGX(alpha, NdotH);\n";
  81600. fragmentShader += " vec3 diffuseContribution = (1.0 - F) * lambertianDiffuse(diffuseColor);\n";
  81601. fragmentShader += " vec3 specularContribution = F * G * D / (4.0 * NdotL * NdotV);\n";
  81602. fragmentShader += " vec3 color = NdotL * lightColorHdr * (diffuseContribution + specularContribution);\n";
  81603. fragmentShader += "#if defined(USE_IBL_LIGHTING) && !defined(DIFFUSE_IBL) && !defined(SPECULAR_IBL) \n";
  81604. fragmentShader += " vec3 r = normalize(czm_inverseViewRotation * normalize(reflect(v, n)));\n";
  81605. fragmentShader += " float vertexRadius = length(positionWC);\n";
  81606. fragmentShader += " float horizonDotNadir = 1.0 - min(1.0, czm_ellipsoidRadii.x / vertexRadius);\n";
  81607. fragmentShader += " float reflectionDotNadir = dot(r, normalize(positionWC));\n";
  81608. fragmentShader += " r.x = -r.x;\n";
  81609. fragmentShader += " r = -normalize(czm_temeToPseudoFixed * r);\n";
  81610. fragmentShader += " r.x = -r.x;\n";
  81611. fragmentShader += " float inverseRoughness = 1.04 - roughness;\n";
  81612. fragmentShader += " inverseRoughness *= inverseRoughness;\n";
  81613. fragmentShader += " vec3 sceneSkyBox = textureCube(czm_environmentMap, r).rgb * inverseRoughness;\n";
  81614. fragmentShader += " float atmosphereHeight = 0.05;\n";
  81615. fragmentShader += " float blendRegionSize = 0.1 * ((1.0 - inverseRoughness) * 8.0 + 1.1 - horizonDotNadir);\n";
  81616. fragmentShader += " float blendRegionOffset = roughness * -1.0;\n";
  81617. fragmentShader += " float farAboveHorizon = clamp(horizonDotNadir - blendRegionSize * 0.5 + blendRegionOffset, 1.0e-10 - blendRegionSize, 0.99999);\n";
  81618. fragmentShader += " float aroundHorizon = clamp(horizonDotNadir + blendRegionSize * 0.5, 1.0e-10 - blendRegionSize, 0.99999);\n";
  81619. fragmentShader += " float farBelowHorizon = clamp(horizonDotNadir + blendRegionSize * 1.5, 1.0e-10 - blendRegionSize, 0.99999);\n";
  81620. fragmentShader += " float smoothstepHeight = smoothstep(0.0, atmosphereHeight, horizonDotNadir);\n";
  81621. fragmentShader += " vec3 belowHorizonColor = mix(vec3(0.1, 0.15, 0.25), vec3(0.4, 0.7, 0.9), smoothstepHeight);\n";
  81622. fragmentShader += " vec3 nadirColor = belowHorizonColor * 0.5;\n";
  81623. fragmentShader += " vec3 aboveHorizonColor = mix(vec3(0.9, 1.0, 1.2), belowHorizonColor, roughness * 0.5);\n";
  81624. fragmentShader += " vec3 blueSkyColor = mix(vec3(0.18, 0.26, 0.48), aboveHorizonColor, reflectionDotNadir * inverseRoughness * 0.5 + 0.75);\n";
  81625. fragmentShader += " vec3 zenithColor = mix(blueSkyColor, sceneSkyBox, smoothstepHeight);\n";
  81626. fragmentShader += " vec3 blueSkyDiffuseColor = vec3(0.7, 0.85, 0.9);\n";
  81627. fragmentShader += " float diffuseIrradianceFromEarth = (1.0 - horizonDotNadir) * (reflectionDotNadir * 0.25 + 0.75) * smoothstepHeight;\n";
  81628. fragmentShader += " float diffuseIrradianceFromSky = (1.0 - smoothstepHeight) * (1.0 - (reflectionDotNadir * 0.25 + 0.25));\n";
  81629. fragmentShader += " vec3 diffuseIrradiance = blueSkyDiffuseColor * clamp(diffuseIrradianceFromEarth + diffuseIrradianceFromSky, 0.0, 1.0);\n";
  81630. fragmentShader += " float notDistantRough = (1.0 - horizonDotNadir * roughness * 0.8);\n";
  81631. fragmentShader += " vec3 specularIrradiance = mix(zenithColor, aboveHorizonColor, smoothstep(farAboveHorizon, aroundHorizon, reflectionDotNadir) * notDistantRough);\n";
  81632. fragmentShader += " specularIrradiance = mix(specularIrradiance, belowHorizonColor, smoothstep(aroundHorizon, farBelowHorizon, reflectionDotNadir) * inverseRoughness);\n";
  81633. fragmentShader += " specularIrradiance = mix(specularIrradiance, nadirColor, smoothstep(farBelowHorizon, 1.0, reflectionDotNadir) * inverseRoughness);\n";
  81634. fragmentShader += "#ifdef USE_SUN_LUMINANCE \n";
  81635. fragmentShader += " float LdotZenith = clamp(dot(normalize(czm_inverseViewRotation * l), normalize(positionWC * -1.0)), 0.001, 1.0);\n";
  81636. fragmentShader += " float S = acos(LdotZenith);\n";
  81637. fragmentShader += " float NdotZenith = clamp(dot(normalize(czm_inverseViewRotation * n), normalize(positionWC * -1.0)), 0.001, 1.0);\n";
  81638. fragmentShader += " float gamma = acos(NdotL);\n";
  81639. fragmentShader += " float numerator = ((0.91 + 10.0 * exp(-3.0 * gamma) + 0.45 * pow(NdotL, 2.0)) * (1.0 - exp(-0.32 / NdotZenith)));\n";
  81640. fragmentShader += " float denominator = (0.91 + 10.0 * exp(-3.0 * S) + 0.45 * pow(LdotZenith,2.0)) * (1.0 - exp(-0.32));\n";
  81641. fragmentShader += " float luminance = gltf_luminanceAtZenith * (numerator / denominator);\n";
  81642. fragmentShader += "#endif \n";
  81643. fragmentShader += " vec2 brdfLut = texture2D(czm_brdfLut, vec2(NdotV, roughness)).rg;\n";
  81644. fragmentShader += " vec3 IBLColor = (diffuseIrradiance * diffuseColor * gltf_iblFactor.x) + (specularIrradiance * SRGBtoLINEAR3(specularColor * brdfLut.x + brdfLut.y) * gltf_iblFactor.y);\n";
  81645. fragmentShader += " float maximumComponent = max(max(lightColorHdr.x, lightColorHdr.y), lightColorHdr.z);\n";
  81646. fragmentShader += " vec3 lightColor = lightColorHdr / max(maximumComponent, 1.0);\n";
  81647. fragmentShader += " IBLColor *= lightColor;\n";
  81648. fragmentShader += "#ifdef USE_SUN_LUMINANCE \n";
  81649. fragmentShader += " color += IBLColor * luminance;\n";
  81650. fragmentShader += "#else \n";
  81651. fragmentShader += " color += IBLColor; \n";
  81652. fragmentShader += "#endif \n";
  81653. fragmentShader += "#elif defined(DIFFUSE_IBL) || defined(SPECULAR_IBL) \n";
  81654. fragmentShader += " const mat3 yUpToZUp = mat3(-1.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0); \n";
  81655. fragmentShader += " vec3 cubeDir = normalize(yUpToZUp * gltf_iblReferenceFrameMatrix * normalize(reflect(-v, n))); \n";
  81656. fragmentShader += "#ifdef DIFFUSE_IBL \n";
  81657. fragmentShader += "#ifdef CUSTOM_SPHERICAL_HARMONICS \n";
  81658. fragmentShader += " vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, gltf_sphericalHarmonicCoefficients); \n";
  81659. fragmentShader += "#else \n";
  81660. fragmentShader += " vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, czm_sphericalHarmonicCoefficients); \n";
  81661. fragmentShader += "#endif \n";
  81662. fragmentShader += "#else \n";
  81663. fragmentShader += " vec3 diffuseIrradiance = vec3(0.0); \n";
  81664. fragmentShader += "#endif \n";
  81665. fragmentShader += "#ifdef SPECULAR_IBL \n";
  81666. fragmentShader += " vec2 brdfLut = texture2D(czm_brdfLut, vec2(NdotV, roughness)).rg;\n";
  81667. fragmentShader += "#ifdef CUSTOM_SPECULAR_IBL \n";
  81668. fragmentShader += " vec3 specularIBL = czm_sampleOctahedralProjection(gltf_specularMap, gltf_specularMapSize, cubeDir, roughness * gltf_maxSpecularLOD, gltf_maxSpecularLOD);\n";
  81669. fragmentShader += "#else \n";
  81670. fragmentShader += " vec3 specularIBL = czm_sampleOctahedralProjection(czm_specularEnvironmentMaps, czm_specularEnvironmentMapSize, cubeDir, roughness * czm_specularEnvironmentMapsMaximumLOD, czm_specularEnvironmentMapsMaximumLOD);\n";
  81671. fragmentShader += "#endif \n";
  81672. fragmentShader += " specularIBL *= F * brdfLut.x + brdfLut.y;\n";
  81673. fragmentShader += "#else \n";
  81674. fragmentShader += " vec3 specularIBL = vec3(0.0); \n";
  81675. fragmentShader += "#endif \n";
  81676. fragmentShader += " color += diffuseIrradiance * diffuseColor + specularColor * specularIBL;\n";
  81677. fragmentShader += "#endif \n";
  81678. } else {
  81679. fragmentShader += " vec3 color = baseColor;\n";
  81680. }
  81681. if (!isUnlit) {
  81682. if (defined_default(generatedMaterialValues.u_occlusionTexture)) {
  81683. fragmentShader += ` color *= texture2D(u_occlusionTexture, ${occlusionTexCoord}).r;
  81684. `;
  81685. }
  81686. if (defined_default(generatedMaterialValues.u_emissiveTexture)) {
  81687. fragmentShader += ` vec3 emissive = SRGBtoLINEAR3(texture2D(u_emissiveTexture, ${emissiveTexCoord}).rgb);
  81688. `;
  81689. if (defined_default(generatedMaterialValues.u_emissiveFactor)) {
  81690. fragmentShader += " emissive *= u_emissiveFactor;\n";
  81691. }
  81692. fragmentShader += " color += emissive;\n";
  81693. } else if (defined_default(generatedMaterialValues.u_emissiveFactor)) {
  81694. fragmentShader += " color += u_emissiveFactor;\n";
  81695. }
  81696. }
  81697. if (!isUnlit) {
  81698. fragmentShader += " color = applyTonemapping(color);\n";
  81699. }
  81700. fragmentShader += " color = LINEARtoSRGB(color);\n";
  81701. if (hasOutline) {
  81702. fragmentShader += " float outlineness = max(\n";
  81703. fragmentShader += " texture2D(u_outlineTexture, vec2(v_outlineCoordinates.x, 0.5)).r,\n";
  81704. fragmentShader += " max(\n";
  81705. fragmentShader += " texture2D(u_outlineTexture, vec2(v_outlineCoordinates.y, 0.5)).r,\n";
  81706. fragmentShader += " texture2D(u_outlineTexture, vec2(v_outlineCoordinates.z, 0.5)).r));\n";
  81707. fragmentShader += " color = mix(color, vec3(0.0, 0.0, 0.0), outlineness);\n";
  81708. }
  81709. if (defined_default(alphaMode)) {
  81710. if (alphaMode === "MASK") {
  81711. fragmentShader += " if (baseColorWithAlpha.a < u_alphaCutoff) {\n";
  81712. fragmentShader += " discard;\n";
  81713. fragmentShader += " }\n";
  81714. fragmentShader += " gl_FragColor = vec4(color, 1.0);\n";
  81715. } else if (alphaMode === "BLEND") {
  81716. fragmentShader += " gl_FragColor = vec4(color, baseColorWithAlpha.a);\n";
  81717. } else {
  81718. fragmentShader += " gl_FragColor = vec4(color, 1.0);\n";
  81719. }
  81720. } else {
  81721. fragmentShader += " gl_FragColor = vec4(color, 1.0);\n";
  81722. }
  81723. fragmentShader += "}\n";
  81724. const vertexShaderId = addToArray_default(shaders, {
  81725. type: WebGLConstants_default.VERTEX_SHADER,
  81726. extras: {
  81727. _pipeline: {
  81728. source: vertexShader,
  81729. extension: ".glsl"
  81730. }
  81731. }
  81732. });
  81733. const fragmentShaderId = addToArray_default(shaders, {
  81734. type: WebGLConstants_default.FRAGMENT_SHADER,
  81735. extras: {
  81736. _pipeline: {
  81737. source: fragmentShader,
  81738. extension: ".glsl"
  81739. }
  81740. }
  81741. });
  81742. const programId = addToArray_default(programs, {
  81743. fragmentShader: fragmentShaderId,
  81744. vertexShader: vertexShaderId
  81745. });
  81746. const techniqueId = addToArray_default(techniques, {
  81747. attributes: techniqueAttributes,
  81748. program: programId,
  81749. uniforms: techniqueUniforms
  81750. });
  81751. return techniqueId;
  81752. }
  81753. function getPBRValueType(paramName) {
  81754. if (paramName.indexOf("Offset") !== -1) {
  81755. return WebGLConstants_default.FLOAT_VEC2;
  81756. } else if (paramName.indexOf("Rotation") !== -1) {
  81757. return WebGLConstants_default.FLOAT;
  81758. } else if (paramName.indexOf("Scale") !== -1) {
  81759. return WebGLConstants_default.FLOAT_VEC2;
  81760. } else if (paramName.indexOf("Texture") !== -1) {
  81761. return WebGLConstants_default.SAMPLER_2D;
  81762. }
  81763. switch (paramName) {
  81764. case "u_baseColorFactor":
  81765. return WebGLConstants_default.FLOAT_VEC4;
  81766. case "u_metallicFactor":
  81767. return WebGLConstants_default.FLOAT;
  81768. case "u_roughnessFactor":
  81769. return WebGLConstants_default.FLOAT;
  81770. case "u_emissiveFactor":
  81771. return WebGLConstants_default.FLOAT_VEC3;
  81772. case "u_diffuseFactor":
  81773. return WebGLConstants_default.FLOAT_VEC4;
  81774. case "u_specularFactor":
  81775. return WebGLConstants_default.FLOAT_VEC3;
  81776. case "u_glossinessFactor":
  81777. return WebGLConstants_default.FLOAT;
  81778. }
  81779. }
  81780. var processPbrMaterials_default = processPbrMaterials;
  81781. // node_modules/cesium/Source/Scene/Vector3DTileBatch.js
  81782. function Vector3DTileBatch(options) {
  81783. this.offset = options.offset;
  81784. this.count = options.count;
  81785. this.color = options.color;
  81786. this.batchIds = options.batchIds;
  81787. }
  81788. var Vector3DTileBatch_default = Vector3DTileBatch;
  81789. // node_modules/cesium/Source/Shaders/VectorTileVS.js
  81790. var VectorTileVS_default = "attribute vec3 position;\nattribute float a_batchId;\n\nuniform mat4 u_modifiedModelViewProjection;\n\nvoid main()\n{\n gl_Position = czm_depthClamp(u_modifiedModelViewProjection * vec4(position, 1.0));\n}\n";
  81791. // node_modules/cesium/Source/ThirdParty/jsep.js
  81792. var jsep = createCommonjsModule(function(module2, exports2) {
  81793. (function(root) {
  81794. var COMPOUND = "Compound", IDENTIFIER = "Identifier", MEMBER_EXP = "MemberExpression", LITERAL = "Literal", THIS_EXP = "ThisExpression", CALL_EXP = "CallExpression", UNARY_EXP = "UnaryExpression", BINARY_EXP = "BinaryExpression", LOGICAL_EXP = "LogicalExpression", CONDITIONAL_EXP = "ConditionalExpression", ARRAY_EXP = "ArrayExpression", PERIOD_CODE = 46, COMMA_CODE = 44, SQUOTE_CODE = 39, DQUOTE_CODE = 34, OPAREN_CODE = 40, CPAREN_CODE = 41, OBRACK_CODE = 91, CBRACK_CODE = 93, QUMARK_CODE = 63, SEMCOL_CODE = 59, COLON_CODE = 58, throwError = function(message, index2) {
  81795. var error = new Error(message + " at character " + index2);
  81796. error.index = index2;
  81797. error.description = message;
  81798. throw error;
  81799. }, t = true, unary_ops = { "-": t, "!": t, "~": t, "+": t }, binary_ops = {
  81800. "||": 1,
  81801. "&&": 2,
  81802. "|": 3,
  81803. "^": 4,
  81804. "&": 5,
  81805. "==": 6,
  81806. "!=": 6,
  81807. "===": 6,
  81808. "!==": 6,
  81809. "<": 7,
  81810. ">": 7,
  81811. "<=": 7,
  81812. ">=": 7,
  81813. "<<": 8,
  81814. ">>": 8,
  81815. ">>>": 8,
  81816. "+": 9,
  81817. "-": 9,
  81818. "*": 10,
  81819. "/": 10,
  81820. "%": 10
  81821. }, getMaxKeyLen = function(obj) {
  81822. var max_len = 0, len;
  81823. for (var key in obj) {
  81824. if ((len = key.length) > max_len && obj.hasOwnProperty(key)) {
  81825. max_len = len;
  81826. }
  81827. }
  81828. return max_len;
  81829. }, max_unop_len = getMaxKeyLen(unary_ops), max_binop_len = getMaxKeyLen(binary_ops), literals = {
  81830. "true": true,
  81831. "false": false,
  81832. "null": null
  81833. }, this_str = "this", binaryPrecedence = function(op_val) {
  81834. return binary_ops[op_val] || 0;
  81835. }, createBinaryExpression = function(operator, left, right) {
  81836. var type = operator === "||" || operator === "&&" ? LOGICAL_EXP : BINARY_EXP;
  81837. return {
  81838. type,
  81839. operator,
  81840. left,
  81841. right
  81842. };
  81843. }, isDecimalDigit = function(ch) {
  81844. return ch >= 48 && ch <= 57;
  81845. }, isIdentifierStart = function(ch) {
  81846. return ch === 36 || ch === 95 || ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 128 && !binary_ops[String.fromCharCode(ch)];
  81847. }, isIdentifierPart = function(ch) {
  81848. return ch === 36 || ch === 95 || ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 48 && ch <= 57 || ch >= 128 && !binary_ops[String.fromCharCode(ch)];
  81849. }, jsep2 = function(expr) {
  81850. var index2 = 0, charAtFunc = expr.charAt, charCodeAtFunc = expr.charCodeAt, exprI = function(i2) {
  81851. return charAtFunc.call(expr, i2);
  81852. }, exprICode = function(i2) {
  81853. return charCodeAtFunc.call(expr, i2);
  81854. }, length3 = expr.length, gobbleSpaces = function() {
  81855. var ch = exprICode(index2);
  81856. while (ch === 32 || ch === 9 || ch === 10 || ch === 13) {
  81857. ch = exprICode(++index2);
  81858. }
  81859. }, gobbleExpression = function() {
  81860. var test = gobbleBinaryExpression(), consequent, alternate;
  81861. gobbleSpaces();
  81862. if (exprICode(index2) === QUMARK_CODE) {
  81863. index2++;
  81864. consequent = gobbleExpression();
  81865. if (!consequent) {
  81866. throwError("Expected expression", index2);
  81867. }
  81868. gobbleSpaces();
  81869. if (exprICode(index2) === COLON_CODE) {
  81870. index2++;
  81871. alternate = gobbleExpression();
  81872. if (!alternate) {
  81873. throwError("Expected expression", index2);
  81874. }
  81875. return {
  81876. type: CONDITIONAL_EXP,
  81877. test,
  81878. consequent,
  81879. alternate
  81880. };
  81881. } else {
  81882. throwError("Expected :", index2);
  81883. }
  81884. } else {
  81885. return test;
  81886. }
  81887. }, gobbleBinaryOp = function() {
  81888. gobbleSpaces();
  81889. var to_check = expr.substr(index2, max_binop_len), tc_len = to_check.length;
  81890. while (tc_len > 0) {
  81891. if (binary_ops.hasOwnProperty(to_check) && (!isIdentifierStart(exprICode(index2)) || index2 + to_check.length < expr.length && !isIdentifierPart(exprICode(index2 + to_check.length)))) {
  81892. index2 += tc_len;
  81893. return to_check;
  81894. }
  81895. to_check = to_check.substr(0, --tc_len);
  81896. }
  81897. return false;
  81898. }, gobbleBinaryExpression = function() {
  81899. var node2, biop, prec, stack, biop_info, left, right, i2, cur_biop;
  81900. left = gobbleToken();
  81901. biop = gobbleBinaryOp();
  81902. if (!biop) {
  81903. return left;
  81904. }
  81905. biop_info = { value: biop, prec: binaryPrecedence(biop) };
  81906. right = gobbleToken();
  81907. if (!right) {
  81908. throwError("Expected expression after " + biop, index2);
  81909. }
  81910. stack = [left, biop_info, right];
  81911. while (biop = gobbleBinaryOp()) {
  81912. prec = binaryPrecedence(biop);
  81913. if (prec === 0) {
  81914. break;
  81915. }
  81916. biop_info = { value: biop, prec };
  81917. cur_biop = biop;
  81918. while (stack.length > 2 && prec <= stack[stack.length - 2].prec) {
  81919. right = stack.pop();
  81920. biop = stack.pop().value;
  81921. left = stack.pop();
  81922. node2 = createBinaryExpression(biop, left, right);
  81923. stack.push(node2);
  81924. }
  81925. node2 = gobbleToken();
  81926. if (!node2) {
  81927. throwError("Expected expression after " + cur_biop, index2);
  81928. }
  81929. stack.push(biop_info, node2);
  81930. }
  81931. i2 = stack.length - 1;
  81932. node2 = stack[i2];
  81933. while (i2 > 1) {
  81934. node2 = createBinaryExpression(stack[i2 - 1].value, stack[i2 - 2], node2);
  81935. i2 -= 2;
  81936. }
  81937. return node2;
  81938. }, gobbleToken = function() {
  81939. var ch, to_check, tc_len;
  81940. gobbleSpaces();
  81941. ch = exprICode(index2);
  81942. if (isDecimalDigit(ch) || ch === PERIOD_CODE) {
  81943. return gobbleNumericLiteral();
  81944. } else if (ch === SQUOTE_CODE || ch === DQUOTE_CODE) {
  81945. return gobbleStringLiteral();
  81946. } else if (ch === OBRACK_CODE) {
  81947. return gobbleArray();
  81948. } else {
  81949. to_check = expr.substr(index2, max_unop_len);
  81950. tc_len = to_check.length;
  81951. while (tc_len > 0) {
  81952. if (unary_ops.hasOwnProperty(to_check) && (!isIdentifierStart(exprICode(index2)) || index2 + to_check.length < expr.length && !isIdentifierPart(exprICode(index2 + to_check.length)))) {
  81953. index2 += tc_len;
  81954. return {
  81955. type: UNARY_EXP,
  81956. operator: to_check,
  81957. argument: gobbleToken(),
  81958. prefix: true
  81959. };
  81960. }
  81961. to_check = to_check.substr(0, --tc_len);
  81962. }
  81963. if (isIdentifierStart(ch) || ch === OPAREN_CODE) {
  81964. return gobbleVariable();
  81965. }
  81966. }
  81967. return false;
  81968. }, gobbleNumericLiteral = function() {
  81969. var number = "", ch, chCode;
  81970. while (isDecimalDigit(exprICode(index2))) {
  81971. number += exprI(index2++);
  81972. }
  81973. if (exprICode(index2) === PERIOD_CODE) {
  81974. number += exprI(index2++);
  81975. while (isDecimalDigit(exprICode(index2))) {
  81976. number += exprI(index2++);
  81977. }
  81978. }
  81979. ch = exprI(index2);
  81980. if (ch === "e" || ch === "E") {
  81981. number += exprI(index2++);
  81982. ch = exprI(index2);
  81983. if (ch === "+" || ch === "-") {
  81984. number += exprI(index2++);
  81985. }
  81986. while (isDecimalDigit(exprICode(index2))) {
  81987. number += exprI(index2++);
  81988. }
  81989. if (!isDecimalDigit(exprICode(index2 - 1))) {
  81990. throwError("Expected exponent (" + number + exprI(index2) + ")", index2);
  81991. }
  81992. }
  81993. chCode = exprICode(index2);
  81994. if (isIdentifierStart(chCode)) {
  81995. throwError("Variable names cannot start with a number (" + number + exprI(index2) + ")", index2);
  81996. } else if (chCode === PERIOD_CODE) {
  81997. throwError("Unexpected period", index2);
  81998. }
  81999. return {
  82000. type: LITERAL,
  82001. value: parseFloat(number),
  82002. raw: number
  82003. };
  82004. }, gobbleStringLiteral = function() {
  82005. var str = "", quote = exprI(index2++), closed = false, ch;
  82006. while (index2 < length3) {
  82007. ch = exprI(index2++);
  82008. if (ch === quote) {
  82009. closed = true;
  82010. break;
  82011. } else if (ch === "\\") {
  82012. ch = exprI(index2++);
  82013. switch (ch) {
  82014. case "n":
  82015. str += "\n";
  82016. break;
  82017. case "r":
  82018. str += "\r";
  82019. break;
  82020. case "t":
  82021. str += " ";
  82022. break;
  82023. case "b":
  82024. str += "\b";
  82025. break;
  82026. case "f":
  82027. str += "\f";
  82028. break;
  82029. case "v":
  82030. str += "\v";
  82031. break;
  82032. default:
  82033. str += ch;
  82034. }
  82035. } else {
  82036. str += ch;
  82037. }
  82038. }
  82039. if (!closed) {
  82040. throwError('Unclosed quote after "' + str + '"', index2);
  82041. }
  82042. return {
  82043. type: LITERAL,
  82044. value: str,
  82045. raw: quote + str + quote
  82046. };
  82047. }, gobbleIdentifier = function() {
  82048. var ch = exprICode(index2), start = index2, identifier;
  82049. if (isIdentifierStart(ch)) {
  82050. index2++;
  82051. } else {
  82052. throwError("Unexpected " + exprI(index2), index2);
  82053. }
  82054. while (index2 < length3) {
  82055. ch = exprICode(index2);
  82056. if (isIdentifierPart(ch)) {
  82057. index2++;
  82058. } else {
  82059. break;
  82060. }
  82061. }
  82062. identifier = expr.slice(start, index2);
  82063. if (literals.hasOwnProperty(identifier)) {
  82064. return {
  82065. type: LITERAL,
  82066. value: literals[identifier],
  82067. raw: identifier
  82068. };
  82069. } else if (identifier === this_str) {
  82070. return { type: THIS_EXP };
  82071. } else {
  82072. return {
  82073. type: IDENTIFIER,
  82074. name: identifier
  82075. };
  82076. }
  82077. }, gobbleArguments = function(termination) {
  82078. var ch_i2, args = [], node2, closed = false;
  82079. var separator_count = 0;
  82080. while (index2 < length3) {
  82081. gobbleSpaces();
  82082. ch_i2 = exprICode(index2);
  82083. if (ch_i2 === termination) {
  82084. closed = true;
  82085. index2++;
  82086. if (termination === CPAREN_CODE && separator_count && separator_count >= args.length) {
  82087. throwError("Unexpected token " + String.fromCharCode(termination), index2);
  82088. }
  82089. break;
  82090. } else if (ch_i2 === COMMA_CODE) {
  82091. index2++;
  82092. separator_count++;
  82093. if (separator_count !== args.length) {
  82094. if (termination === CPAREN_CODE) {
  82095. throwError("Unexpected token ,", index2);
  82096. } else if (termination === CBRACK_CODE) {
  82097. for (var arg = args.length; arg < separator_count; arg++) {
  82098. args.push(null);
  82099. }
  82100. }
  82101. }
  82102. } else {
  82103. node2 = gobbleExpression();
  82104. if (!node2 || node2.type === COMPOUND) {
  82105. throwError("Expected comma", index2);
  82106. }
  82107. args.push(node2);
  82108. }
  82109. }
  82110. if (!closed) {
  82111. throwError("Expected " + String.fromCharCode(termination), index2);
  82112. }
  82113. return args;
  82114. }, gobbleVariable = function() {
  82115. var ch_i2, node2;
  82116. ch_i2 = exprICode(index2);
  82117. if (ch_i2 === OPAREN_CODE) {
  82118. node2 = gobbleGroup();
  82119. } else {
  82120. node2 = gobbleIdentifier();
  82121. }
  82122. gobbleSpaces();
  82123. ch_i2 = exprICode(index2);
  82124. while (ch_i2 === PERIOD_CODE || ch_i2 === OBRACK_CODE || ch_i2 === OPAREN_CODE) {
  82125. index2++;
  82126. if (ch_i2 === PERIOD_CODE) {
  82127. gobbleSpaces();
  82128. node2 = {
  82129. type: MEMBER_EXP,
  82130. computed: false,
  82131. object: node2,
  82132. property: gobbleIdentifier()
  82133. };
  82134. } else if (ch_i2 === OBRACK_CODE) {
  82135. node2 = {
  82136. type: MEMBER_EXP,
  82137. computed: true,
  82138. object: node2,
  82139. property: gobbleExpression()
  82140. };
  82141. gobbleSpaces();
  82142. ch_i2 = exprICode(index2);
  82143. if (ch_i2 !== CBRACK_CODE) {
  82144. throwError("Unclosed [", index2);
  82145. }
  82146. index2++;
  82147. } else if (ch_i2 === OPAREN_CODE) {
  82148. node2 = {
  82149. type: CALL_EXP,
  82150. "arguments": gobbleArguments(CPAREN_CODE),
  82151. callee: node2
  82152. };
  82153. }
  82154. gobbleSpaces();
  82155. ch_i2 = exprICode(index2);
  82156. }
  82157. return node2;
  82158. }, gobbleGroup = function() {
  82159. index2++;
  82160. var node2 = gobbleExpression();
  82161. gobbleSpaces();
  82162. if (exprICode(index2) === CPAREN_CODE) {
  82163. index2++;
  82164. return node2;
  82165. } else {
  82166. throwError("Unclosed (", index2);
  82167. }
  82168. }, gobbleArray = function() {
  82169. index2++;
  82170. return {
  82171. type: ARRAY_EXP,
  82172. elements: gobbleArguments(CBRACK_CODE)
  82173. };
  82174. }, nodes = [], ch_i, node;
  82175. while (index2 < length3) {
  82176. ch_i = exprICode(index2);
  82177. if (ch_i === SEMCOL_CODE || ch_i === COMMA_CODE) {
  82178. index2++;
  82179. } else {
  82180. if (node = gobbleExpression()) {
  82181. nodes.push(node);
  82182. } else if (index2 < length3) {
  82183. throwError('Unexpected "' + exprI(index2) + '"', index2);
  82184. }
  82185. }
  82186. }
  82187. if (nodes.length === 1) {
  82188. return nodes[0];
  82189. } else {
  82190. return {
  82191. type: COMPOUND,
  82192. body: nodes
  82193. };
  82194. }
  82195. };
  82196. jsep2.version = "0.3.5";
  82197. jsep2.toString = function() {
  82198. return "JavaScript Expression Parser (JSEP) v" + jsep2.version;
  82199. };
  82200. jsep2.addUnaryOp = function(op_name) {
  82201. max_unop_len = Math.max(op_name.length, max_unop_len);
  82202. unary_ops[op_name] = t;
  82203. return this;
  82204. };
  82205. jsep2.addBinaryOp = function(op_name, precedence) {
  82206. max_binop_len = Math.max(op_name.length, max_binop_len);
  82207. binary_ops[op_name] = precedence;
  82208. return this;
  82209. };
  82210. jsep2.addLiteral = function(literal_name, literal_value) {
  82211. literals[literal_name] = literal_value;
  82212. return this;
  82213. };
  82214. jsep2.removeUnaryOp = function(op_name) {
  82215. delete unary_ops[op_name];
  82216. if (op_name.length === max_unop_len) {
  82217. max_unop_len = getMaxKeyLen(unary_ops);
  82218. }
  82219. return this;
  82220. };
  82221. jsep2.removeAllUnaryOps = function() {
  82222. unary_ops = {};
  82223. max_unop_len = 0;
  82224. return this;
  82225. };
  82226. jsep2.removeBinaryOp = function(op_name) {
  82227. delete binary_ops[op_name];
  82228. if (op_name.length === max_binop_len) {
  82229. max_binop_len = getMaxKeyLen(binary_ops);
  82230. }
  82231. return this;
  82232. };
  82233. jsep2.removeAllBinaryOps = function() {
  82234. binary_ops = {};
  82235. max_binop_len = 0;
  82236. return this;
  82237. };
  82238. jsep2.removeLiteral = function(literal_name) {
  82239. delete literals[literal_name];
  82240. return this;
  82241. };
  82242. jsep2.removeAllLiterals = function() {
  82243. literals = {};
  82244. return this;
  82245. };
  82246. {
  82247. if (module2.exports) {
  82248. exports2 = module2.exports = jsep2;
  82249. } else {
  82250. exports2.parse = jsep2;
  82251. }
  82252. }
  82253. })();
  82254. });
  82255. // node_modules/cesium/Source/Scene/ExpressionNodeType.js
  82256. var ExpressionNodeType = {
  82257. VARIABLE: 0,
  82258. UNARY: 1,
  82259. BINARY: 2,
  82260. TERNARY: 3,
  82261. CONDITIONAL: 4,
  82262. MEMBER: 5,
  82263. FUNCTION_CALL: 6,
  82264. ARRAY: 7,
  82265. REGEX: 8,
  82266. VARIABLE_IN_STRING: 9,
  82267. LITERAL_NULL: 10,
  82268. LITERAL_BOOLEAN: 11,
  82269. LITERAL_NUMBER: 12,
  82270. LITERAL_STRING: 13,
  82271. LITERAL_COLOR: 14,
  82272. LITERAL_VECTOR: 15,
  82273. LITERAL_REGEX: 16,
  82274. LITERAL_UNDEFINED: 17,
  82275. BUILTIN_VARIABLE: 18
  82276. };
  82277. var ExpressionNodeType_default = Object.freeze(ExpressionNodeType);
  82278. // node_modules/cesium/Source/Scene/Expression.js
  82279. function Expression(expression, defines) {
  82280. Check_default.typeOf.string("expression", expression);
  82281. this._expression = expression;
  82282. expression = replaceDefines(expression, defines);
  82283. expression = replaceVariables(removeBackslashes(expression));
  82284. jsep.addBinaryOp("=~", 0);
  82285. jsep.addBinaryOp("!~", 0);
  82286. let ast;
  82287. try {
  82288. ast = jsep(expression);
  82289. } catch (e2) {
  82290. throw new RuntimeError_default(e2);
  82291. }
  82292. this._runtimeAst = createRuntimeAst(this, ast);
  82293. }
  82294. Object.defineProperties(Expression.prototype, {
  82295. expression: {
  82296. get: function() {
  82297. return this._expression;
  82298. }
  82299. }
  82300. });
  82301. var scratchStorage = {
  82302. arrayIndex: 0,
  82303. arrayArray: [[]],
  82304. cartesian2Index: 0,
  82305. cartesian3Index: 0,
  82306. cartesian4Index: 0,
  82307. cartesian2Array: [new Cartesian2_default()],
  82308. cartesian3Array: [new Cartesian3_default()],
  82309. cartesian4Array: [new Cartesian4_default()],
  82310. reset: function() {
  82311. this.arrayIndex = 0;
  82312. this.cartesian2Index = 0;
  82313. this.cartesian3Index = 0;
  82314. this.cartesian4Index = 0;
  82315. },
  82316. getArray: function() {
  82317. if (this.arrayIndex >= this.arrayArray.length) {
  82318. this.arrayArray.push([]);
  82319. }
  82320. const array = this.arrayArray[this.arrayIndex++];
  82321. array.length = 0;
  82322. return array;
  82323. },
  82324. getCartesian2: function() {
  82325. if (this.cartesian2Index >= this.cartesian2Array.length) {
  82326. this.cartesian2Array.push(new Cartesian2_default());
  82327. }
  82328. return this.cartesian2Array[this.cartesian2Index++];
  82329. },
  82330. getCartesian3: function() {
  82331. if (this.cartesian3Index >= this.cartesian3Array.length) {
  82332. this.cartesian3Array.push(new Cartesian3_default());
  82333. }
  82334. return this.cartesian3Array[this.cartesian3Index++];
  82335. },
  82336. getCartesian4: function() {
  82337. if (this.cartesian4Index >= this.cartesian4Array.length) {
  82338. this.cartesian4Array.push(new Cartesian4_default());
  82339. }
  82340. return this.cartesian4Array[this.cartesian4Index++];
  82341. }
  82342. };
  82343. Expression.prototype.evaluate = function(feature2, result) {
  82344. scratchStorage.reset();
  82345. const value = this._runtimeAst.evaluate(feature2);
  82346. if (result instanceof Color_default && value instanceof Cartesian4_default) {
  82347. return Color_default.fromCartesian4(value, result);
  82348. }
  82349. if (value instanceof Cartesian2_default || value instanceof Cartesian3_default || value instanceof Cartesian4_default) {
  82350. return value.clone(result);
  82351. }
  82352. return value;
  82353. };
  82354. Expression.prototype.evaluateColor = function(feature2, result) {
  82355. scratchStorage.reset();
  82356. const color = this._runtimeAst.evaluate(feature2);
  82357. return Color_default.fromCartesian4(color, result);
  82358. };
  82359. Expression.prototype.getShaderFunction = function(functionSignature, variableSubstitutionMap, shaderState, returnType) {
  82360. let shaderExpression = this.getShaderExpression(
  82361. variableSubstitutionMap,
  82362. shaderState
  82363. );
  82364. shaderExpression = `${returnType} ${functionSignature}
  82365. {
  82366. return ${shaderExpression};
  82367. }
  82368. `;
  82369. return shaderExpression;
  82370. };
  82371. Expression.prototype.getShaderExpression = function(variableSubstitutionMap, shaderState) {
  82372. return this._runtimeAst.getShaderExpression(
  82373. variableSubstitutionMap,
  82374. shaderState
  82375. );
  82376. };
  82377. Expression.prototype.getVariables = function() {
  82378. let variables = [];
  82379. this._runtimeAst.getVariables(variables);
  82380. variables = variables.filter(function(variable, index2, variables2) {
  82381. return variables2.indexOf(variable) === index2;
  82382. });
  82383. return variables;
  82384. };
  82385. var unaryOperators = ["!", "-", "+"];
  82386. var binaryOperators = [
  82387. "+",
  82388. "-",
  82389. "*",
  82390. "/",
  82391. "%",
  82392. "===",
  82393. "!==",
  82394. ">",
  82395. ">=",
  82396. "<",
  82397. "<=",
  82398. "&&",
  82399. "||",
  82400. "!~",
  82401. "=~"
  82402. ];
  82403. var variableRegex = /\${(.*?)}/g;
  82404. var backslashRegex = /\\/g;
  82405. var backslashReplacement = "@#%";
  82406. var replacementRegex = /@#%/g;
  82407. var scratchColor3 = new Color_default();
  82408. var unaryFunctions = {
  82409. abs: getEvaluateUnaryComponentwise(Math.abs),
  82410. sqrt: getEvaluateUnaryComponentwise(Math.sqrt),
  82411. cos: getEvaluateUnaryComponentwise(Math.cos),
  82412. sin: getEvaluateUnaryComponentwise(Math.sin),
  82413. tan: getEvaluateUnaryComponentwise(Math.tan),
  82414. acos: getEvaluateUnaryComponentwise(Math.acos),
  82415. asin: getEvaluateUnaryComponentwise(Math.asin),
  82416. atan: getEvaluateUnaryComponentwise(Math.atan),
  82417. radians: getEvaluateUnaryComponentwise(Math_default.toRadians),
  82418. degrees: getEvaluateUnaryComponentwise(Math_default.toDegrees),
  82419. sign: getEvaluateUnaryComponentwise(Math_default.sign),
  82420. floor: getEvaluateUnaryComponentwise(Math.floor),
  82421. ceil: getEvaluateUnaryComponentwise(Math.ceil),
  82422. round: getEvaluateUnaryComponentwise(Math.round),
  82423. exp: getEvaluateUnaryComponentwise(Math.exp),
  82424. exp2: getEvaluateUnaryComponentwise(exp2),
  82425. log: getEvaluateUnaryComponentwise(Math.log),
  82426. log2: getEvaluateUnaryComponentwise(log22),
  82427. fract: getEvaluateUnaryComponentwise(fract),
  82428. length: length2,
  82429. normalize
  82430. };
  82431. var binaryFunctions = {
  82432. atan2: getEvaluateBinaryComponentwise(Math.atan2, false),
  82433. pow: getEvaluateBinaryComponentwise(Math.pow, false),
  82434. min: getEvaluateBinaryComponentwise(Math.min, true),
  82435. max: getEvaluateBinaryComponentwise(Math.max, true),
  82436. distance,
  82437. dot,
  82438. cross
  82439. };
  82440. var ternaryFunctions = {
  82441. clamp: getEvaluateTernaryComponentwise(Math_default.clamp, true),
  82442. mix: getEvaluateTernaryComponentwise(Math_default.lerp, true)
  82443. };
  82444. function fract(number) {
  82445. return number - Math.floor(number);
  82446. }
  82447. function exp2(exponent) {
  82448. return Math.pow(2, exponent);
  82449. }
  82450. function log22(number) {
  82451. return Math_default.log2(number);
  82452. }
  82453. function getEvaluateUnaryComponentwise(operation) {
  82454. return function(call, left) {
  82455. if (typeof left === "number") {
  82456. return operation(left);
  82457. } else if (left instanceof Cartesian2_default) {
  82458. return Cartesian2_default.fromElements(
  82459. operation(left.x),
  82460. operation(left.y),
  82461. scratchStorage.getCartesian2()
  82462. );
  82463. } else if (left instanceof Cartesian3_default) {
  82464. return Cartesian3_default.fromElements(
  82465. operation(left.x),
  82466. operation(left.y),
  82467. operation(left.z),
  82468. scratchStorage.getCartesian3()
  82469. );
  82470. } else if (left instanceof Cartesian4_default) {
  82471. return Cartesian4_default.fromElements(
  82472. operation(left.x),
  82473. operation(left.y),
  82474. operation(left.z),
  82475. operation(left.w),
  82476. scratchStorage.getCartesian4()
  82477. );
  82478. }
  82479. throw new RuntimeError_default(
  82480. `Function "${call}" requires a vector or number argument. Argument is ${left}.`
  82481. );
  82482. };
  82483. }
  82484. function getEvaluateBinaryComponentwise(operation, allowScalar) {
  82485. return function(call, left, right) {
  82486. if (allowScalar && typeof right === "number") {
  82487. if (typeof left === "number") {
  82488. return operation(left, right);
  82489. } else if (left instanceof Cartesian2_default) {
  82490. return Cartesian2_default.fromElements(
  82491. operation(left.x, right),
  82492. operation(left.y, right),
  82493. scratchStorage.getCartesian2()
  82494. );
  82495. } else if (left instanceof Cartesian3_default) {
  82496. return Cartesian3_default.fromElements(
  82497. operation(left.x, right),
  82498. operation(left.y, right),
  82499. operation(left.z, right),
  82500. scratchStorage.getCartesian3()
  82501. );
  82502. } else if (left instanceof Cartesian4_default) {
  82503. return Cartesian4_default.fromElements(
  82504. operation(left.x, right),
  82505. operation(left.y, right),
  82506. operation(left.z, right),
  82507. operation(left.w, right),
  82508. scratchStorage.getCartesian4()
  82509. );
  82510. }
  82511. }
  82512. if (typeof left === "number" && typeof right === "number") {
  82513. return operation(left, right);
  82514. } else if (left instanceof Cartesian2_default && right instanceof Cartesian2_default) {
  82515. return Cartesian2_default.fromElements(
  82516. operation(left.x, right.x),
  82517. operation(left.y, right.y),
  82518. scratchStorage.getCartesian2()
  82519. );
  82520. } else if (left instanceof Cartesian3_default && right instanceof Cartesian3_default) {
  82521. return Cartesian3_default.fromElements(
  82522. operation(left.x, right.x),
  82523. operation(left.y, right.y),
  82524. operation(left.z, right.z),
  82525. scratchStorage.getCartesian3()
  82526. );
  82527. } else if (left instanceof Cartesian4_default && right instanceof Cartesian4_default) {
  82528. return Cartesian4_default.fromElements(
  82529. operation(left.x, right.x),
  82530. operation(left.y, right.y),
  82531. operation(left.z, right.z),
  82532. operation(left.w, right.w),
  82533. scratchStorage.getCartesian4()
  82534. );
  82535. }
  82536. throw new RuntimeError_default(
  82537. `Function "${call}" requires vector or number arguments of matching types. Arguments are ${left} and ${right}.`
  82538. );
  82539. };
  82540. }
  82541. function getEvaluateTernaryComponentwise(operation, allowScalar) {
  82542. return function(call, left, right, test) {
  82543. if (allowScalar && typeof test === "number") {
  82544. if (typeof left === "number" && typeof right === "number") {
  82545. return operation(left, right, test);
  82546. } else if (left instanceof Cartesian2_default && right instanceof Cartesian2_default) {
  82547. return Cartesian2_default.fromElements(
  82548. operation(left.x, right.x, test),
  82549. operation(left.y, right.y, test),
  82550. scratchStorage.getCartesian2()
  82551. );
  82552. } else if (left instanceof Cartesian3_default && right instanceof Cartesian3_default) {
  82553. return Cartesian3_default.fromElements(
  82554. operation(left.x, right.x, test),
  82555. operation(left.y, right.y, test),
  82556. operation(left.z, right.z, test),
  82557. scratchStorage.getCartesian3()
  82558. );
  82559. } else if (left instanceof Cartesian4_default && right instanceof Cartesian4_default) {
  82560. return Cartesian4_default.fromElements(
  82561. operation(left.x, right.x, test),
  82562. operation(left.y, right.y, test),
  82563. operation(left.z, right.z, test),
  82564. operation(left.w, right.w, test),
  82565. scratchStorage.getCartesian4()
  82566. );
  82567. }
  82568. }
  82569. if (typeof left === "number" && typeof right === "number" && typeof test === "number") {
  82570. return operation(left, right, test);
  82571. } else if (left instanceof Cartesian2_default && right instanceof Cartesian2_default && test instanceof Cartesian2_default) {
  82572. return Cartesian2_default.fromElements(
  82573. operation(left.x, right.x, test.x),
  82574. operation(left.y, right.y, test.y),
  82575. scratchStorage.getCartesian2()
  82576. );
  82577. } else if (left instanceof Cartesian3_default && right instanceof Cartesian3_default && test instanceof Cartesian3_default) {
  82578. return Cartesian3_default.fromElements(
  82579. operation(left.x, right.x, test.x),
  82580. operation(left.y, right.y, test.y),
  82581. operation(left.z, right.z, test.z),
  82582. scratchStorage.getCartesian3()
  82583. );
  82584. } else if (left instanceof Cartesian4_default && right instanceof Cartesian4_default && test instanceof Cartesian4_default) {
  82585. return Cartesian4_default.fromElements(
  82586. operation(left.x, right.x, test.x),
  82587. operation(left.y, right.y, test.y),
  82588. operation(left.z, right.z, test.z),
  82589. operation(left.w, right.w, test.w),
  82590. scratchStorage.getCartesian4()
  82591. );
  82592. }
  82593. throw new RuntimeError_default(
  82594. `Function "${call}" requires vector or number arguments of matching types. Arguments are ${left}, ${right}, and ${test}.`
  82595. );
  82596. };
  82597. }
  82598. function length2(call, left) {
  82599. if (typeof left === "number") {
  82600. return Math.abs(left);
  82601. } else if (left instanceof Cartesian2_default) {
  82602. return Cartesian2_default.magnitude(left);
  82603. } else if (left instanceof Cartesian3_default) {
  82604. return Cartesian3_default.magnitude(left);
  82605. } else if (left instanceof Cartesian4_default) {
  82606. return Cartesian4_default.magnitude(left);
  82607. }
  82608. throw new RuntimeError_default(
  82609. `Function "${call}" requires a vector or number argument. Argument is ${left}.`
  82610. );
  82611. }
  82612. function normalize(call, left) {
  82613. if (typeof left === "number") {
  82614. return 1;
  82615. } else if (left instanceof Cartesian2_default) {
  82616. return Cartesian2_default.normalize(left, scratchStorage.getCartesian2());
  82617. } else if (left instanceof Cartesian3_default) {
  82618. return Cartesian3_default.normalize(left, scratchStorage.getCartesian3());
  82619. } else if (left instanceof Cartesian4_default) {
  82620. return Cartesian4_default.normalize(left, scratchStorage.getCartesian4());
  82621. }
  82622. throw new RuntimeError_default(
  82623. `Function "${call}" requires a vector or number argument. Argument is ${left}.`
  82624. );
  82625. }
  82626. function distance(call, left, right) {
  82627. if (typeof left === "number" && typeof right === "number") {
  82628. return Math.abs(left - right);
  82629. } else if (left instanceof Cartesian2_default && right instanceof Cartesian2_default) {
  82630. return Cartesian2_default.distance(left, right);
  82631. } else if (left instanceof Cartesian3_default && right instanceof Cartesian3_default) {
  82632. return Cartesian3_default.distance(left, right);
  82633. } else if (left instanceof Cartesian4_default && right instanceof Cartesian4_default) {
  82634. return Cartesian4_default.distance(left, right);
  82635. }
  82636. throw new RuntimeError_default(
  82637. `Function "${call}" requires vector or number arguments of matching types. Arguments are ${left} and ${right}.`
  82638. );
  82639. }
  82640. function dot(call, left, right) {
  82641. if (typeof left === "number" && typeof right === "number") {
  82642. return left * right;
  82643. } else if (left instanceof Cartesian2_default && right instanceof Cartesian2_default) {
  82644. return Cartesian2_default.dot(left, right);
  82645. } else if (left instanceof Cartesian3_default && right instanceof Cartesian3_default) {
  82646. return Cartesian3_default.dot(left, right);
  82647. } else if (left instanceof Cartesian4_default && right instanceof Cartesian4_default) {
  82648. return Cartesian4_default.dot(left, right);
  82649. }
  82650. throw new RuntimeError_default(
  82651. `Function "${call}" requires vector or number arguments of matching types. Arguments are ${left} and ${right}.`
  82652. );
  82653. }
  82654. function cross(call, left, right) {
  82655. if (left instanceof Cartesian3_default && right instanceof Cartesian3_default) {
  82656. return Cartesian3_default.cross(left, right, scratchStorage.getCartesian3());
  82657. }
  82658. throw new RuntimeError_default(
  82659. `Function "${call}" requires vec3 arguments. Arguments are ${left} and ${right}.`
  82660. );
  82661. }
  82662. function Node3(type, value, left, right, test) {
  82663. this._type = type;
  82664. this._value = value;
  82665. this._left = left;
  82666. this._right = right;
  82667. this._test = test;
  82668. this.evaluate = void 0;
  82669. setEvaluateFunction(this);
  82670. }
  82671. function replaceDefines(expression, defines) {
  82672. if (!defined_default(defines)) {
  82673. return expression;
  82674. }
  82675. for (const key in defines) {
  82676. if (defines.hasOwnProperty(key)) {
  82677. const definePlaceholder = new RegExp(`\\$\\{${key}\\}`, "g");
  82678. const defineReplace = `(${defines[key]})`;
  82679. if (defined_default(defineReplace)) {
  82680. expression = expression.replace(definePlaceholder, defineReplace);
  82681. }
  82682. }
  82683. }
  82684. return expression;
  82685. }
  82686. function removeBackslashes(expression) {
  82687. return expression.replace(backslashRegex, backslashReplacement);
  82688. }
  82689. function replaceBackslashes(expression) {
  82690. return expression.replace(replacementRegex, "\\");
  82691. }
  82692. function replaceVariables(expression) {
  82693. let exp = expression;
  82694. let result = "";
  82695. let i2 = exp.indexOf("${");
  82696. while (i2 >= 0) {
  82697. const openSingleQuote = exp.indexOf("'");
  82698. const openDoubleQuote = exp.indexOf('"');
  82699. let closeQuote;
  82700. if (openSingleQuote >= 0 && openSingleQuote < i2) {
  82701. closeQuote = exp.indexOf("'", openSingleQuote + 1);
  82702. result += exp.substr(0, closeQuote + 1);
  82703. exp = exp.substr(closeQuote + 1);
  82704. i2 = exp.indexOf("${");
  82705. } else if (openDoubleQuote >= 0 && openDoubleQuote < i2) {
  82706. closeQuote = exp.indexOf('"', openDoubleQuote + 1);
  82707. result += exp.substr(0, closeQuote + 1);
  82708. exp = exp.substr(closeQuote + 1);
  82709. i2 = exp.indexOf("${");
  82710. } else {
  82711. result += exp.substr(0, i2);
  82712. const j = exp.indexOf("}");
  82713. if (j < 0) {
  82714. throw new RuntimeError_default("Unmatched {.");
  82715. }
  82716. result += `czm_${exp.substr(i2 + 2, j - (i2 + 2))}`;
  82717. exp = exp.substr(j + 1);
  82718. i2 = exp.indexOf("${");
  82719. }
  82720. }
  82721. result += exp;
  82722. return result;
  82723. }
  82724. function parseLiteral(ast) {
  82725. const type = typeof ast.value;
  82726. if (ast.value === null) {
  82727. return new Node3(ExpressionNodeType_default.LITERAL_NULL, null);
  82728. } else if (type === "boolean") {
  82729. return new Node3(ExpressionNodeType_default.LITERAL_BOOLEAN, ast.value);
  82730. } else if (type === "number") {
  82731. return new Node3(ExpressionNodeType_default.LITERAL_NUMBER, ast.value);
  82732. } else if (type === "string") {
  82733. if (ast.value.indexOf("${") >= 0) {
  82734. return new Node3(ExpressionNodeType_default.VARIABLE_IN_STRING, ast.value);
  82735. }
  82736. return new Node3(
  82737. ExpressionNodeType_default.LITERAL_STRING,
  82738. replaceBackslashes(ast.value)
  82739. );
  82740. }
  82741. }
  82742. function parseCall(expression, ast) {
  82743. const args = ast.arguments;
  82744. const argsLength = args.length;
  82745. let call;
  82746. let val, left, right;
  82747. if (ast.callee.type === "MemberExpression") {
  82748. call = ast.callee.property.name;
  82749. const object2 = ast.callee.object;
  82750. if (call === "test" || call === "exec") {
  82751. if (object2.callee.name !== "regExp") {
  82752. throw new RuntimeError_default(`${call} is not a function.`);
  82753. }
  82754. if (argsLength === 0) {
  82755. if (call === "test") {
  82756. return new Node3(ExpressionNodeType_default.LITERAL_BOOLEAN, false);
  82757. }
  82758. return new Node3(ExpressionNodeType_default.LITERAL_NULL, null);
  82759. }
  82760. left = createRuntimeAst(expression, object2);
  82761. right = createRuntimeAst(expression, args[0]);
  82762. return new Node3(ExpressionNodeType_default.FUNCTION_CALL, call, left, right);
  82763. } else if (call === "toString") {
  82764. val = createRuntimeAst(expression, object2);
  82765. return new Node3(ExpressionNodeType_default.FUNCTION_CALL, call, val);
  82766. }
  82767. throw new RuntimeError_default(`Unexpected function call "${call}".`);
  82768. }
  82769. call = ast.callee.name;
  82770. if (call === "color") {
  82771. if (argsLength === 0) {
  82772. return new Node3(ExpressionNodeType_default.LITERAL_COLOR, call);
  82773. }
  82774. val = createRuntimeAst(expression, args[0]);
  82775. if (defined_default(args[1])) {
  82776. const alpha = createRuntimeAst(expression, args[1]);
  82777. return new Node3(ExpressionNodeType_default.LITERAL_COLOR, call, [val, alpha]);
  82778. }
  82779. return new Node3(ExpressionNodeType_default.LITERAL_COLOR, call, [val]);
  82780. } else if (call === "rgb" || call === "hsl") {
  82781. if (argsLength < 3) {
  82782. throw new RuntimeError_default(`${call} requires three arguments.`);
  82783. }
  82784. val = [
  82785. createRuntimeAst(expression, args[0]),
  82786. createRuntimeAst(expression, args[1]),
  82787. createRuntimeAst(expression, args[2])
  82788. ];
  82789. return new Node3(ExpressionNodeType_default.LITERAL_COLOR, call, val);
  82790. } else if (call === "rgba" || call === "hsla") {
  82791. if (argsLength < 4) {
  82792. throw new RuntimeError_default(`${call} requires four arguments.`);
  82793. }
  82794. val = [
  82795. createRuntimeAst(expression, args[0]),
  82796. createRuntimeAst(expression, args[1]),
  82797. createRuntimeAst(expression, args[2]),
  82798. createRuntimeAst(expression, args[3])
  82799. ];
  82800. return new Node3(ExpressionNodeType_default.LITERAL_COLOR, call, val);
  82801. } else if (call === "vec2" || call === "vec3" || call === "vec4") {
  82802. val = new Array(argsLength);
  82803. for (let i2 = 0; i2 < argsLength; ++i2) {
  82804. val[i2] = createRuntimeAst(expression, args[i2]);
  82805. }
  82806. return new Node3(ExpressionNodeType_default.LITERAL_VECTOR, call, val);
  82807. } else if (call === "isNaN" || call === "isFinite") {
  82808. if (argsLength === 0) {
  82809. if (call === "isNaN") {
  82810. return new Node3(ExpressionNodeType_default.LITERAL_BOOLEAN, true);
  82811. }
  82812. return new Node3(ExpressionNodeType_default.LITERAL_BOOLEAN, false);
  82813. }
  82814. val = createRuntimeAst(expression, args[0]);
  82815. return new Node3(ExpressionNodeType_default.UNARY, call, val);
  82816. } else if (call === "isExactClass" || call === "isClass") {
  82817. if (argsLength < 1 || argsLength > 1) {
  82818. throw new RuntimeError_default(`${call} requires exactly one argument.`);
  82819. }
  82820. val = createRuntimeAst(expression, args[0]);
  82821. return new Node3(ExpressionNodeType_default.UNARY, call, val);
  82822. } else if (call === "getExactClassName") {
  82823. if (argsLength > 0) {
  82824. throw new RuntimeError_default(`${call} does not take any argument.`);
  82825. }
  82826. return new Node3(ExpressionNodeType_default.UNARY, call);
  82827. } else if (defined_default(unaryFunctions[call])) {
  82828. if (argsLength !== 1) {
  82829. throw new RuntimeError_default(`${call} requires exactly one argument.`);
  82830. }
  82831. val = createRuntimeAst(expression, args[0]);
  82832. return new Node3(ExpressionNodeType_default.UNARY, call, val);
  82833. } else if (defined_default(binaryFunctions[call])) {
  82834. if (argsLength !== 2) {
  82835. throw new RuntimeError_default(`${call} requires exactly two arguments.`);
  82836. }
  82837. left = createRuntimeAst(expression, args[0]);
  82838. right = createRuntimeAst(expression, args[1]);
  82839. return new Node3(ExpressionNodeType_default.BINARY, call, left, right);
  82840. } else if (defined_default(ternaryFunctions[call])) {
  82841. if (argsLength !== 3) {
  82842. throw new RuntimeError_default(`${call} requires exactly three arguments.`);
  82843. }
  82844. left = createRuntimeAst(expression, args[0]);
  82845. right = createRuntimeAst(expression, args[1]);
  82846. const test = createRuntimeAst(expression, args[2]);
  82847. return new Node3(ExpressionNodeType_default.TERNARY, call, left, right, test);
  82848. } else if (call === "Boolean") {
  82849. if (argsLength === 0) {
  82850. return new Node3(ExpressionNodeType_default.LITERAL_BOOLEAN, false);
  82851. }
  82852. val = createRuntimeAst(expression, args[0]);
  82853. return new Node3(ExpressionNodeType_default.UNARY, call, val);
  82854. } else if (call === "Number") {
  82855. if (argsLength === 0) {
  82856. return new Node3(ExpressionNodeType_default.LITERAL_NUMBER, 0);
  82857. }
  82858. val = createRuntimeAst(expression, args[0]);
  82859. return new Node3(ExpressionNodeType_default.UNARY, call, val);
  82860. } else if (call === "String") {
  82861. if (argsLength === 0) {
  82862. return new Node3(ExpressionNodeType_default.LITERAL_STRING, "");
  82863. }
  82864. val = createRuntimeAst(expression, args[0]);
  82865. return new Node3(ExpressionNodeType_default.UNARY, call, val);
  82866. } else if (call === "regExp") {
  82867. return parseRegex(expression, ast);
  82868. }
  82869. throw new RuntimeError_default(`Unexpected function call "${call}".`);
  82870. }
  82871. function parseRegex(expression, ast) {
  82872. const args = ast.arguments;
  82873. if (args.length === 0) {
  82874. return new Node3(ExpressionNodeType_default.LITERAL_REGEX, new RegExp());
  82875. }
  82876. const pattern = createRuntimeAst(expression, args[0]);
  82877. let exp;
  82878. if (args.length > 1) {
  82879. const flags = createRuntimeAst(expression, args[1]);
  82880. if (isLiteralType(pattern) && isLiteralType(flags)) {
  82881. try {
  82882. exp = new RegExp(
  82883. replaceBackslashes(String(pattern._value)),
  82884. flags._value
  82885. );
  82886. } catch (e2) {
  82887. throw new RuntimeError_default(e2);
  82888. }
  82889. return new Node3(ExpressionNodeType_default.LITERAL_REGEX, exp);
  82890. }
  82891. return new Node3(ExpressionNodeType_default.REGEX, pattern, flags);
  82892. }
  82893. if (isLiteralType(pattern)) {
  82894. try {
  82895. exp = new RegExp(replaceBackslashes(String(pattern._value)));
  82896. } catch (e2) {
  82897. throw new RuntimeError_default(e2);
  82898. }
  82899. return new Node3(ExpressionNodeType_default.LITERAL_REGEX, exp);
  82900. }
  82901. return new Node3(ExpressionNodeType_default.REGEX, pattern);
  82902. }
  82903. function parseKeywordsAndVariables(ast) {
  82904. if (isVariable(ast.name)) {
  82905. const name = getPropertyName(ast.name);
  82906. if (name.substr(0, 8) === "tiles3d_") {
  82907. return new Node3(ExpressionNodeType_default.BUILTIN_VARIABLE, name);
  82908. }
  82909. return new Node3(ExpressionNodeType_default.VARIABLE, name);
  82910. } else if (ast.name === "NaN") {
  82911. return new Node3(ExpressionNodeType_default.LITERAL_NUMBER, NaN);
  82912. } else if (ast.name === "Infinity") {
  82913. return new Node3(ExpressionNodeType_default.LITERAL_NUMBER, Infinity);
  82914. } else if (ast.name === "undefined") {
  82915. return new Node3(ExpressionNodeType_default.LITERAL_UNDEFINED, void 0);
  82916. }
  82917. throw new RuntimeError_default(`${ast.name} is not defined.`);
  82918. }
  82919. function parseMathConstant(ast) {
  82920. const name = ast.property.name;
  82921. if (name === "PI") {
  82922. return new Node3(ExpressionNodeType_default.LITERAL_NUMBER, Math.PI);
  82923. } else if (name === "E") {
  82924. return new Node3(ExpressionNodeType_default.LITERAL_NUMBER, Math.E);
  82925. }
  82926. }
  82927. function parseNumberConstant(ast) {
  82928. const name = ast.property.name;
  82929. if (name === "POSITIVE_INFINITY") {
  82930. return new Node3(
  82931. ExpressionNodeType_default.LITERAL_NUMBER,
  82932. Number.POSITIVE_INFINITY
  82933. );
  82934. }
  82935. }
  82936. function parseMemberExpression(expression, ast) {
  82937. if (ast.object.name === "Math") {
  82938. return parseMathConstant(ast);
  82939. } else if (ast.object.name === "Number") {
  82940. return parseNumberConstant(ast);
  82941. }
  82942. let val;
  82943. const obj = createRuntimeAst(expression, ast.object);
  82944. if (ast.computed) {
  82945. val = createRuntimeAst(expression, ast.property);
  82946. return new Node3(ExpressionNodeType_default.MEMBER, "brackets", obj, val);
  82947. }
  82948. val = new Node3(ExpressionNodeType_default.LITERAL_STRING, ast.property.name);
  82949. return new Node3(ExpressionNodeType_default.MEMBER, "dot", obj, val);
  82950. }
  82951. function isLiteralType(node) {
  82952. return node._type >= ExpressionNodeType_default.LITERAL_NULL;
  82953. }
  82954. function isVariable(name) {
  82955. return name.substr(0, 4) === "czm_";
  82956. }
  82957. function getPropertyName(variable) {
  82958. return variable.substr(4);
  82959. }
  82960. function createRuntimeAst(expression, ast) {
  82961. let node;
  82962. let op;
  82963. let left;
  82964. let right;
  82965. if (ast.type === "Literal") {
  82966. node = parseLiteral(ast);
  82967. } else if (ast.type === "CallExpression") {
  82968. node = parseCall(expression, ast);
  82969. } else if (ast.type === "Identifier") {
  82970. node = parseKeywordsAndVariables(ast);
  82971. } else if (ast.type === "UnaryExpression") {
  82972. op = ast.operator;
  82973. const child = createRuntimeAst(expression, ast.argument);
  82974. if (unaryOperators.indexOf(op) > -1) {
  82975. node = new Node3(ExpressionNodeType_default.UNARY, op, child);
  82976. } else {
  82977. throw new RuntimeError_default(`Unexpected operator "${op}".`);
  82978. }
  82979. } else if (ast.type === "BinaryExpression") {
  82980. op = ast.operator;
  82981. left = createRuntimeAst(expression, ast.left);
  82982. right = createRuntimeAst(expression, ast.right);
  82983. if (binaryOperators.indexOf(op) > -1) {
  82984. node = new Node3(ExpressionNodeType_default.BINARY, op, left, right);
  82985. } else {
  82986. throw new RuntimeError_default(`Unexpected operator "${op}".`);
  82987. }
  82988. } else if (ast.type === "LogicalExpression") {
  82989. op = ast.operator;
  82990. left = createRuntimeAst(expression, ast.left);
  82991. right = createRuntimeAst(expression, ast.right);
  82992. if (binaryOperators.indexOf(op) > -1) {
  82993. node = new Node3(ExpressionNodeType_default.BINARY, op, left, right);
  82994. }
  82995. } else if (ast.type === "ConditionalExpression") {
  82996. const test = createRuntimeAst(expression, ast.test);
  82997. left = createRuntimeAst(expression, ast.consequent);
  82998. right = createRuntimeAst(expression, ast.alternate);
  82999. node = new Node3(ExpressionNodeType_default.CONDITIONAL, "?", left, right, test);
  83000. } else if (ast.type === "MemberExpression") {
  83001. node = parseMemberExpression(expression, ast);
  83002. } else if (ast.type === "ArrayExpression") {
  83003. const val = [];
  83004. for (let i2 = 0; i2 < ast.elements.length; i2++) {
  83005. val[i2] = createRuntimeAst(expression, ast.elements[i2]);
  83006. }
  83007. node = new Node3(ExpressionNodeType_default.ARRAY, val);
  83008. } else if (ast.type === "Compound") {
  83009. throw new RuntimeError_default("Provide exactly one expression.");
  83010. } else {
  83011. throw new RuntimeError_default("Cannot parse expression.");
  83012. }
  83013. return node;
  83014. }
  83015. function setEvaluateFunction(node) {
  83016. if (node._type === ExpressionNodeType_default.CONDITIONAL) {
  83017. node.evaluate = node._evaluateConditional;
  83018. } else if (node._type === ExpressionNodeType_default.FUNCTION_CALL) {
  83019. if (node._value === "test") {
  83020. node.evaluate = node._evaluateRegExpTest;
  83021. } else if (node._value === "exec") {
  83022. node.evaluate = node._evaluateRegExpExec;
  83023. } else if (node._value === "toString") {
  83024. node.evaluate = node._evaluateToString;
  83025. }
  83026. } else if (node._type === ExpressionNodeType_default.UNARY) {
  83027. if (node._value === "!") {
  83028. node.evaluate = node._evaluateNot;
  83029. } else if (node._value === "-") {
  83030. node.evaluate = node._evaluateNegative;
  83031. } else if (node._value === "+") {
  83032. node.evaluate = node._evaluatePositive;
  83033. } else if (node._value === "isNaN") {
  83034. node.evaluate = node._evaluateNaN;
  83035. } else if (node._value === "isFinite") {
  83036. node.evaluate = node._evaluateIsFinite;
  83037. } else if (node._value === "isExactClass") {
  83038. node.evaluate = node._evaluateIsExactClass;
  83039. } else if (node._value === "isClass") {
  83040. node.evaluate = node._evaluateIsClass;
  83041. } else if (node._value === "getExactClassName") {
  83042. node.evaluate = node._evaluateGetExactClassName;
  83043. } else if (node._value === "Boolean") {
  83044. node.evaluate = node._evaluateBooleanConversion;
  83045. } else if (node._value === "Number") {
  83046. node.evaluate = node._evaluateNumberConversion;
  83047. } else if (node._value === "String") {
  83048. node.evaluate = node._evaluateStringConversion;
  83049. } else if (defined_default(unaryFunctions[node._value])) {
  83050. node.evaluate = getEvaluateUnaryFunction(node._value);
  83051. }
  83052. } else if (node._type === ExpressionNodeType_default.BINARY) {
  83053. if (node._value === "+") {
  83054. node.evaluate = node._evaluatePlus;
  83055. } else if (node._value === "-") {
  83056. node.evaluate = node._evaluateMinus;
  83057. } else if (node._value === "*") {
  83058. node.evaluate = node._evaluateTimes;
  83059. } else if (node._value === "/") {
  83060. node.evaluate = node._evaluateDivide;
  83061. } else if (node._value === "%") {
  83062. node.evaluate = node._evaluateMod;
  83063. } else if (node._value === "===") {
  83064. node.evaluate = node._evaluateEqualsStrict;
  83065. } else if (node._value === "!==") {
  83066. node.evaluate = node._evaluateNotEqualsStrict;
  83067. } else if (node._value === "<") {
  83068. node.evaluate = node._evaluateLessThan;
  83069. } else if (node._value === "<=") {
  83070. node.evaluate = node._evaluateLessThanOrEquals;
  83071. } else if (node._value === ">") {
  83072. node.evaluate = node._evaluateGreaterThan;
  83073. } else if (node._value === ">=") {
  83074. node.evaluate = node._evaluateGreaterThanOrEquals;
  83075. } else if (node._value === "&&") {
  83076. node.evaluate = node._evaluateAnd;
  83077. } else if (node._value === "||") {
  83078. node.evaluate = node._evaluateOr;
  83079. } else if (node._value === "=~") {
  83080. node.evaluate = node._evaluateRegExpMatch;
  83081. } else if (node._value === "!~") {
  83082. node.evaluate = node._evaluateRegExpNotMatch;
  83083. } else if (defined_default(binaryFunctions[node._value])) {
  83084. node.evaluate = getEvaluateBinaryFunction(node._value);
  83085. }
  83086. } else if (node._type === ExpressionNodeType_default.TERNARY) {
  83087. node.evaluate = getEvaluateTernaryFunction(node._value);
  83088. } else if (node._type === ExpressionNodeType_default.MEMBER) {
  83089. if (node._value === "brackets") {
  83090. node.evaluate = node._evaluateMemberBrackets;
  83091. } else {
  83092. node.evaluate = node._evaluateMemberDot;
  83093. }
  83094. } else if (node._type === ExpressionNodeType_default.ARRAY) {
  83095. node.evaluate = node._evaluateArray;
  83096. } else if (node._type === ExpressionNodeType_default.VARIABLE) {
  83097. node.evaluate = node._evaluateVariable;
  83098. } else if (node._type === ExpressionNodeType_default.VARIABLE_IN_STRING) {
  83099. node.evaluate = node._evaluateVariableString;
  83100. } else if (node._type === ExpressionNodeType_default.LITERAL_COLOR) {
  83101. node.evaluate = node._evaluateLiteralColor;
  83102. } else if (node._type === ExpressionNodeType_default.LITERAL_VECTOR) {
  83103. node.evaluate = node._evaluateLiteralVector;
  83104. } else if (node._type === ExpressionNodeType_default.LITERAL_STRING) {
  83105. node.evaluate = node._evaluateLiteralString;
  83106. } else if (node._type === ExpressionNodeType_default.REGEX) {
  83107. node.evaluate = node._evaluateRegExp;
  83108. } else if (node._type === ExpressionNodeType_default.BUILTIN_VARIABLE) {
  83109. if (node._value === "tiles3d_tileset_time") {
  83110. node.evaluate = evaluateTilesetTime;
  83111. }
  83112. } else {
  83113. node.evaluate = node._evaluateLiteral;
  83114. }
  83115. }
  83116. function evaluateTilesetTime(feature2) {
  83117. if (!defined_default(feature2)) {
  83118. return 0;
  83119. }
  83120. return feature2.content.tileset.timeSinceLoad;
  83121. }
  83122. function getEvaluateUnaryFunction(call) {
  83123. const evaluate = unaryFunctions[call];
  83124. return function(feature2) {
  83125. const left = this._left.evaluate(feature2);
  83126. return evaluate(call, left);
  83127. };
  83128. }
  83129. function getEvaluateBinaryFunction(call) {
  83130. const evaluate = binaryFunctions[call];
  83131. return function(feature2) {
  83132. const left = this._left.evaluate(feature2);
  83133. const right = this._right.evaluate(feature2);
  83134. return evaluate(call, left, right);
  83135. };
  83136. }
  83137. function getEvaluateTernaryFunction(call) {
  83138. const evaluate = ternaryFunctions[call];
  83139. return function(feature2) {
  83140. const left = this._left.evaluate(feature2);
  83141. const right = this._right.evaluate(feature2);
  83142. const test = this._test.evaluate(feature2);
  83143. return evaluate(call, left, right, test);
  83144. };
  83145. }
  83146. function getFeatureProperty(feature2, name) {
  83147. if (defined_default(feature2)) {
  83148. return feature2.getPropertyInherited(name);
  83149. }
  83150. }
  83151. Node3.prototype._evaluateLiteral = function() {
  83152. return this._value;
  83153. };
  83154. Node3.prototype._evaluateLiteralColor = function(feature2) {
  83155. const color = scratchColor3;
  83156. const args = this._left;
  83157. if (this._value === "color") {
  83158. if (!defined_default(args)) {
  83159. Color_default.fromBytes(255, 255, 255, 255, color);
  83160. } else if (args.length > 1) {
  83161. Color_default.fromCssColorString(args[0].evaluate(feature2), color);
  83162. color.alpha = args[1].evaluate(feature2);
  83163. } else {
  83164. Color_default.fromCssColorString(args[0].evaluate(feature2), color);
  83165. }
  83166. } else if (this._value === "rgb") {
  83167. Color_default.fromBytes(
  83168. args[0].evaluate(feature2),
  83169. args[1].evaluate(feature2),
  83170. args[2].evaluate(feature2),
  83171. 255,
  83172. color
  83173. );
  83174. } else if (this._value === "rgba") {
  83175. const a4 = args[3].evaluate(feature2) * 255;
  83176. Color_default.fromBytes(
  83177. args[0].evaluate(feature2),
  83178. args[1].evaluate(feature2),
  83179. args[2].evaluate(feature2),
  83180. a4,
  83181. color
  83182. );
  83183. } else if (this._value === "hsl") {
  83184. Color_default.fromHsl(
  83185. args[0].evaluate(feature2),
  83186. args[1].evaluate(feature2),
  83187. args[2].evaluate(feature2),
  83188. 1,
  83189. color
  83190. );
  83191. } else if (this._value === "hsla") {
  83192. Color_default.fromHsl(
  83193. args[0].evaluate(feature2),
  83194. args[1].evaluate(feature2),
  83195. args[2].evaluate(feature2),
  83196. args[3].evaluate(feature2),
  83197. color
  83198. );
  83199. }
  83200. return Cartesian4_default.fromColor(color, scratchStorage.getCartesian4());
  83201. };
  83202. Node3.prototype._evaluateLiteralVector = function(feature2) {
  83203. const components = scratchStorage.getArray();
  83204. const call = this._value;
  83205. const args = this._left;
  83206. const argsLength = args.length;
  83207. for (let i2 = 0; i2 < argsLength; ++i2) {
  83208. const value = args[i2].evaluate(feature2);
  83209. if (typeof value === "number") {
  83210. components.push(value);
  83211. } else if (value instanceof Cartesian2_default) {
  83212. components.push(value.x, value.y);
  83213. } else if (value instanceof Cartesian3_default) {
  83214. components.push(value.x, value.y, value.z);
  83215. } else if (value instanceof Cartesian4_default) {
  83216. components.push(value.x, value.y, value.z, value.w);
  83217. } else {
  83218. throw new RuntimeError_default(
  83219. `${call} argument must be a vector or number. Argument is ${value}.`
  83220. );
  83221. }
  83222. }
  83223. const componentsLength = components.length;
  83224. const vectorLength = parseInt(call.charAt(3));
  83225. if (componentsLength === 0) {
  83226. throw new RuntimeError_default(`Invalid ${call} constructor. No valid arguments.`);
  83227. } else if (componentsLength < vectorLength && componentsLength > 1) {
  83228. throw new RuntimeError_default(
  83229. `Invalid ${call} constructor. Not enough arguments.`
  83230. );
  83231. } else if (componentsLength > vectorLength && argsLength > 1) {
  83232. throw new RuntimeError_default(`Invalid ${call} constructor. Too many arguments.`);
  83233. }
  83234. if (componentsLength === 1) {
  83235. const component = components[0];
  83236. components.push(component, component, component);
  83237. }
  83238. if (call === "vec2") {
  83239. return Cartesian2_default.fromArray(components, 0, scratchStorage.getCartesian2());
  83240. } else if (call === "vec3") {
  83241. return Cartesian3_default.fromArray(components, 0, scratchStorage.getCartesian3());
  83242. } else if (call === "vec4") {
  83243. return Cartesian4_default.fromArray(components, 0, scratchStorage.getCartesian4());
  83244. }
  83245. };
  83246. Node3.prototype._evaluateLiteralString = function() {
  83247. return this._value;
  83248. };
  83249. Node3.prototype._evaluateVariableString = function(feature2) {
  83250. let result = this._value;
  83251. let match = variableRegex.exec(result);
  83252. while (match !== null) {
  83253. const placeholder = match[0];
  83254. const variableName = match[1];
  83255. let property = getFeatureProperty(feature2, variableName);
  83256. if (!defined_default(property)) {
  83257. property = "";
  83258. }
  83259. result = result.replace(placeholder, property);
  83260. match = variableRegex.exec(result);
  83261. }
  83262. return result;
  83263. };
  83264. Node3.prototype._evaluateVariable = function(feature2) {
  83265. return getFeatureProperty(feature2, this._value);
  83266. };
  83267. function checkFeature(ast) {
  83268. return ast._value === "feature";
  83269. }
  83270. Node3.prototype._evaluateMemberDot = function(feature2) {
  83271. if (checkFeature(this._left)) {
  83272. return getFeatureProperty(feature2, this._right.evaluate(feature2));
  83273. }
  83274. const property = this._left.evaluate(feature2);
  83275. if (!defined_default(property)) {
  83276. return void 0;
  83277. }
  83278. const member = this._right.evaluate(feature2);
  83279. if (property instanceof Cartesian2_default || property instanceof Cartesian3_default || property instanceof Cartesian4_default) {
  83280. if (member === "r") {
  83281. return property.x;
  83282. } else if (member === "g") {
  83283. return property.y;
  83284. } else if (member === "b") {
  83285. return property.z;
  83286. } else if (member === "a") {
  83287. return property.w;
  83288. }
  83289. }
  83290. return property[member];
  83291. };
  83292. Node3.prototype._evaluateMemberBrackets = function(feature2) {
  83293. if (checkFeature(this._left)) {
  83294. return getFeatureProperty(feature2, this._right.evaluate(feature2));
  83295. }
  83296. const property = this._left.evaluate(feature2);
  83297. if (!defined_default(property)) {
  83298. return void 0;
  83299. }
  83300. const member = this._right.evaluate(feature2);
  83301. if (property instanceof Cartesian2_default || property instanceof Cartesian3_default || property instanceof Cartesian4_default) {
  83302. if (member === 0 || member === "r") {
  83303. return property.x;
  83304. } else if (member === 1 || member === "g") {
  83305. return property.y;
  83306. } else if (member === 2 || member === "b") {
  83307. return property.z;
  83308. } else if (member === 3 || member === "a") {
  83309. return property.w;
  83310. }
  83311. }
  83312. return property[member];
  83313. };
  83314. Node3.prototype._evaluateArray = function(feature2) {
  83315. const array = [];
  83316. for (let i2 = 0; i2 < this._value.length; i2++) {
  83317. array[i2] = this._value[i2].evaluate(feature2);
  83318. }
  83319. return array;
  83320. };
  83321. Node3.prototype._evaluateNot = function(feature2) {
  83322. const left = this._left.evaluate(feature2);
  83323. if (typeof left !== "boolean") {
  83324. throw new RuntimeError_default(
  83325. `Operator "!" requires a boolean argument. Argument is ${left}.`
  83326. );
  83327. }
  83328. return !left;
  83329. };
  83330. Node3.prototype._evaluateNegative = function(feature2) {
  83331. const left = this._left.evaluate(feature2);
  83332. if (left instanceof Cartesian2_default) {
  83333. return Cartesian2_default.negate(left, scratchStorage.getCartesian2());
  83334. } else if (left instanceof Cartesian3_default) {
  83335. return Cartesian3_default.negate(left, scratchStorage.getCartesian3());
  83336. } else if (left instanceof Cartesian4_default) {
  83337. return Cartesian4_default.negate(left, scratchStorage.getCartesian4());
  83338. } else if (typeof left === "number") {
  83339. return -left;
  83340. }
  83341. throw new RuntimeError_default(
  83342. `Operator "-" requires a vector or number argument. Argument is ${left}.`
  83343. );
  83344. };
  83345. Node3.prototype._evaluatePositive = function(feature2) {
  83346. const left = this._left.evaluate(feature2);
  83347. if (!(left instanceof Cartesian2_default || left instanceof Cartesian3_default || left instanceof Cartesian4_default || typeof left === "number")) {
  83348. throw new RuntimeError_default(
  83349. `Operator "+" requires a vector or number argument. Argument is ${left}.`
  83350. );
  83351. }
  83352. return left;
  83353. };
  83354. Node3.prototype._evaluateLessThan = function(feature2) {
  83355. const left = this._left.evaluate(feature2);
  83356. const right = this._right.evaluate(feature2);
  83357. if (typeof left !== "number" || typeof right !== "number") {
  83358. throw new RuntimeError_default(
  83359. `Operator "<" requires number arguments. Arguments are ${left} and ${right}.`
  83360. );
  83361. }
  83362. return left < right;
  83363. };
  83364. Node3.prototype._evaluateLessThanOrEquals = function(feature2) {
  83365. const left = this._left.evaluate(feature2);
  83366. const right = this._right.evaluate(feature2);
  83367. if (typeof left !== "number" || typeof right !== "number") {
  83368. throw new RuntimeError_default(
  83369. `Operator "<=" requires number arguments. Arguments are ${left} and ${right}.`
  83370. );
  83371. }
  83372. return left <= right;
  83373. };
  83374. Node3.prototype._evaluateGreaterThan = function(feature2) {
  83375. const left = this._left.evaluate(feature2);
  83376. const right = this._right.evaluate(feature2);
  83377. if (typeof left !== "number" || typeof right !== "number") {
  83378. throw new RuntimeError_default(
  83379. `Operator ">" requires number arguments. Arguments are ${left} and ${right}.`
  83380. );
  83381. }
  83382. return left > right;
  83383. };
  83384. Node3.prototype._evaluateGreaterThanOrEquals = function(feature2) {
  83385. const left = this._left.evaluate(feature2);
  83386. const right = this._right.evaluate(feature2);
  83387. if (typeof left !== "number" || typeof right !== "number") {
  83388. throw new RuntimeError_default(
  83389. `Operator ">=" requires number arguments. Arguments are ${left} and ${right}.`
  83390. );
  83391. }
  83392. return left >= right;
  83393. };
  83394. Node3.prototype._evaluateOr = function(feature2) {
  83395. const left = this._left.evaluate(feature2);
  83396. if (typeof left !== "boolean") {
  83397. throw new RuntimeError_default(
  83398. `Operator "||" requires boolean arguments. First argument is ${left}.`
  83399. );
  83400. }
  83401. if (left) {
  83402. return true;
  83403. }
  83404. const right = this._right.evaluate(feature2);
  83405. if (typeof right !== "boolean") {
  83406. throw new RuntimeError_default(
  83407. `Operator "||" requires boolean arguments. Second argument is ${right}.`
  83408. );
  83409. }
  83410. return left || right;
  83411. };
  83412. Node3.prototype._evaluateAnd = function(feature2) {
  83413. const left = this._left.evaluate(feature2);
  83414. if (typeof left !== "boolean") {
  83415. throw new RuntimeError_default(
  83416. `Operator "&&" requires boolean arguments. First argument is ${left}.`
  83417. );
  83418. }
  83419. if (!left) {
  83420. return false;
  83421. }
  83422. const right = this._right.evaluate(feature2);
  83423. if (typeof right !== "boolean") {
  83424. throw new RuntimeError_default(
  83425. `Operator "&&" requires boolean arguments. Second argument is ${right}.`
  83426. );
  83427. }
  83428. return left && right;
  83429. };
  83430. Node3.prototype._evaluatePlus = function(feature2) {
  83431. const left = this._left.evaluate(feature2);
  83432. const right = this._right.evaluate(feature2);
  83433. if (right instanceof Cartesian2_default && left instanceof Cartesian2_default) {
  83434. return Cartesian2_default.add(left, right, scratchStorage.getCartesian2());
  83435. } else if (right instanceof Cartesian3_default && left instanceof Cartesian3_default) {
  83436. return Cartesian3_default.add(left, right, scratchStorage.getCartesian3());
  83437. } else if (right instanceof Cartesian4_default && left instanceof Cartesian4_default) {
  83438. return Cartesian4_default.add(left, right, scratchStorage.getCartesian4());
  83439. } else if (typeof left === "string" || typeof right === "string") {
  83440. return left + right;
  83441. } else if (typeof left === "number" && typeof right === "number") {
  83442. return left + right;
  83443. }
  83444. throw new RuntimeError_default(
  83445. `Operator "+" requires vector or number arguments of matching types, or at least one string argument. Arguments are ${left} and ${right}.`
  83446. );
  83447. };
  83448. Node3.prototype._evaluateMinus = function(feature2) {
  83449. const left = this._left.evaluate(feature2);
  83450. const right = this._right.evaluate(feature2);
  83451. if (right instanceof Cartesian2_default && left instanceof Cartesian2_default) {
  83452. return Cartesian2_default.subtract(left, right, scratchStorage.getCartesian2());
  83453. } else if (right instanceof Cartesian3_default && left instanceof Cartesian3_default) {
  83454. return Cartesian3_default.subtract(left, right, scratchStorage.getCartesian3());
  83455. } else if (right instanceof Cartesian4_default && left instanceof Cartesian4_default) {
  83456. return Cartesian4_default.subtract(left, right, scratchStorage.getCartesian4());
  83457. } else if (typeof left === "number" && typeof right === "number") {
  83458. return left - right;
  83459. }
  83460. throw new RuntimeError_default(
  83461. `Operator "-" requires vector or number arguments of matching types. Arguments are ${left} and ${right}.`
  83462. );
  83463. };
  83464. Node3.prototype._evaluateTimes = function(feature2) {
  83465. const left = this._left.evaluate(feature2);
  83466. const right = this._right.evaluate(feature2);
  83467. if (right instanceof Cartesian2_default && left instanceof Cartesian2_default) {
  83468. return Cartesian2_default.multiplyComponents(
  83469. left,
  83470. right,
  83471. scratchStorage.getCartesian2()
  83472. );
  83473. } else if (right instanceof Cartesian2_default && typeof left === "number") {
  83474. return Cartesian2_default.multiplyByScalar(
  83475. right,
  83476. left,
  83477. scratchStorage.getCartesian2()
  83478. );
  83479. } else if (left instanceof Cartesian2_default && typeof right === "number") {
  83480. return Cartesian2_default.multiplyByScalar(
  83481. left,
  83482. right,
  83483. scratchStorage.getCartesian2()
  83484. );
  83485. } else if (right instanceof Cartesian3_default && left instanceof Cartesian3_default) {
  83486. return Cartesian3_default.multiplyComponents(
  83487. left,
  83488. right,
  83489. scratchStorage.getCartesian3()
  83490. );
  83491. } else if (right instanceof Cartesian3_default && typeof left === "number") {
  83492. return Cartesian3_default.multiplyByScalar(
  83493. right,
  83494. left,
  83495. scratchStorage.getCartesian3()
  83496. );
  83497. } else if (left instanceof Cartesian3_default && typeof right === "number") {
  83498. return Cartesian3_default.multiplyByScalar(
  83499. left,
  83500. right,
  83501. scratchStorage.getCartesian3()
  83502. );
  83503. } else if (right instanceof Cartesian4_default && left instanceof Cartesian4_default) {
  83504. return Cartesian4_default.multiplyComponents(
  83505. left,
  83506. right,
  83507. scratchStorage.getCartesian4()
  83508. );
  83509. } else if (right instanceof Cartesian4_default && typeof left === "number") {
  83510. return Cartesian4_default.multiplyByScalar(
  83511. right,
  83512. left,
  83513. scratchStorage.getCartesian4()
  83514. );
  83515. } else if (left instanceof Cartesian4_default && typeof right === "number") {
  83516. return Cartesian4_default.multiplyByScalar(
  83517. left,
  83518. right,
  83519. scratchStorage.getCartesian4()
  83520. );
  83521. } else if (typeof left === "number" && typeof right === "number") {
  83522. return left * right;
  83523. }
  83524. throw new RuntimeError_default(
  83525. `Operator "*" requires vector or number arguments. If both arguments are vectors they must be matching types. Arguments are ${left} and ${right}.`
  83526. );
  83527. };
  83528. Node3.prototype._evaluateDivide = function(feature2) {
  83529. const left = this._left.evaluate(feature2);
  83530. const right = this._right.evaluate(feature2);
  83531. if (right instanceof Cartesian2_default && left instanceof Cartesian2_default) {
  83532. return Cartesian2_default.divideComponents(
  83533. left,
  83534. right,
  83535. scratchStorage.getCartesian2()
  83536. );
  83537. } else if (left instanceof Cartesian2_default && typeof right === "number") {
  83538. return Cartesian2_default.divideByScalar(
  83539. left,
  83540. right,
  83541. scratchStorage.getCartesian2()
  83542. );
  83543. } else if (right instanceof Cartesian3_default && left instanceof Cartesian3_default) {
  83544. return Cartesian3_default.divideComponents(
  83545. left,
  83546. right,
  83547. scratchStorage.getCartesian3()
  83548. );
  83549. } else if (left instanceof Cartesian3_default && typeof right === "number") {
  83550. return Cartesian3_default.divideByScalar(
  83551. left,
  83552. right,
  83553. scratchStorage.getCartesian3()
  83554. );
  83555. } else if (right instanceof Cartesian4_default && left instanceof Cartesian4_default) {
  83556. return Cartesian4_default.divideComponents(
  83557. left,
  83558. right,
  83559. scratchStorage.getCartesian4()
  83560. );
  83561. } else if (left instanceof Cartesian4_default && typeof right === "number") {
  83562. return Cartesian4_default.divideByScalar(
  83563. left,
  83564. right,
  83565. scratchStorage.getCartesian4()
  83566. );
  83567. } else if (typeof left === "number" && typeof right === "number") {
  83568. return left / right;
  83569. }
  83570. throw new RuntimeError_default(
  83571. `Operator "/" requires vector or number arguments of matching types, or a number as the second argument. Arguments are ${left} and ${right}.`
  83572. );
  83573. };
  83574. Node3.prototype._evaluateMod = function(feature2) {
  83575. const left = this._left.evaluate(feature2);
  83576. const right = this._right.evaluate(feature2);
  83577. if (right instanceof Cartesian2_default && left instanceof Cartesian2_default) {
  83578. return Cartesian2_default.fromElements(
  83579. left.x % right.x,
  83580. left.y % right.y,
  83581. scratchStorage.getCartesian2()
  83582. );
  83583. } else if (right instanceof Cartesian3_default && left instanceof Cartesian3_default) {
  83584. return Cartesian3_default.fromElements(
  83585. left.x % right.x,
  83586. left.y % right.y,
  83587. left.z % right.z,
  83588. scratchStorage.getCartesian3()
  83589. );
  83590. } else if (right instanceof Cartesian4_default && left instanceof Cartesian4_default) {
  83591. return Cartesian4_default.fromElements(
  83592. left.x % right.x,
  83593. left.y % right.y,
  83594. left.z % right.z,
  83595. left.w % right.w,
  83596. scratchStorage.getCartesian4()
  83597. );
  83598. } else if (typeof left === "number" && typeof right === "number") {
  83599. return left % right;
  83600. }
  83601. throw new RuntimeError_default(
  83602. `Operator "%" requires vector or number arguments of matching types. Arguments are ${left} and ${right}.`
  83603. );
  83604. };
  83605. Node3.prototype._evaluateEqualsStrict = function(feature2) {
  83606. const left = this._left.evaluate(feature2);
  83607. const right = this._right.evaluate(feature2);
  83608. if (right instanceof Cartesian2_default && left instanceof Cartesian2_default || right instanceof Cartesian3_default && left instanceof Cartesian3_default || right instanceof Cartesian4_default && left instanceof Cartesian4_default) {
  83609. return left.equals(right);
  83610. }
  83611. return left === right;
  83612. };
  83613. Node3.prototype._evaluateNotEqualsStrict = function(feature2) {
  83614. const left = this._left.evaluate(feature2);
  83615. const right = this._right.evaluate(feature2);
  83616. if (right instanceof Cartesian2_default && left instanceof Cartesian2_default || right instanceof Cartesian3_default && left instanceof Cartesian3_default || right instanceof Cartesian4_default && left instanceof Cartesian4_default) {
  83617. return !left.equals(right);
  83618. }
  83619. return left !== right;
  83620. };
  83621. Node3.prototype._evaluateConditional = function(feature2) {
  83622. const test = this._test.evaluate(feature2);
  83623. if (typeof test !== "boolean") {
  83624. throw new RuntimeError_default(
  83625. `Conditional argument of conditional expression must be a boolean. Argument is ${test}.`
  83626. );
  83627. }
  83628. if (test) {
  83629. return this._left.evaluate(feature2);
  83630. }
  83631. return this._right.evaluate(feature2);
  83632. };
  83633. Node3.prototype._evaluateNaN = function(feature2) {
  83634. return isNaN(this._left.evaluate(feature2));
  83635. };
  83636. Node3.prototype._evaluateIsFinite = function(feature2) {
  83637. return isFinite(this._left.evaluate(feature2));
  83638. };
  83639. Node3.prototype._evaluateIsExactClass = function(feature2) {
  83640. if (defined_default(feature2)) {
  83641. return feature2.isExactClass(this._left.evaluate(feature2));
  83642. }
  83643. return false;
  83644. };
  83645. Node3.prototype._evaluateIsClass = function(feature2) {
  83646. if (defined_default(feature2)) {
  83647. return feature2.isClass(this._left.evaluate(feature2));
  83648. }
  83649. return false;
  83650. };
  83651. Node3.prototype._evaluateGetExactClassName = function(feature2) {
  83652. if (defined_default(feature2)) {
  83653. return feature2.getExactClassName();
  83654. }
  83655. };
  83656. Node3.prototype._evaluateBooleanConversion = function(feature2) {
  83657. return Boolean(this._left.evaluate(feature2));
  83658. };
  83659. Node3.prototype._evaluateNumberConversion = function(feature2) {
  83660. return Number(this._left.evaluate(feature2));
  83661. };
  83662. Node3.prototype._evaluateStringConversion = function(feature2) {
  83663. return String(this._left.evaluate(feature2));
  83664. };
  83665. Node3.prototype._evaluateRegExp = function(feature2) {
  83666. const pattern = this._value.evaluate(feature2);
  83667. let flags = "";
  83668. if (defined_default(this._left)) {
  83669. flags = this._left.evaluate(feature2);
  83670. }
  83671. let exp;
  83672. try {
  83673. exp = new RegExp(pattern, flags);
  83674. } catch (e2) {
  83675. throw new RuntimeError_default(e2);
  83676. }
  83677. return exp;
  83678. };
  83679. Node3.prototype._evaluateRegExpTest = function(feature2) {
  83680. const left = this._left.evaluate(feature2);
  83681. const right = this._right.evaluate(feature2);
  83682. if (!(left instanceof RegExp && typeof right === "string")) {
  83683. throw new RuntimeError_default(
  83684. `RegExp.test requires the first argument to be a RegExp and the second argument to be a string. Arguments are ${left} and ${right}.`
  83685. );
  83686. }
  83687. return left.test(right);
  83688. };
  83689. Node3.prototype._evaluateRegExpMatch = function(feature2) {
  83690. const left = this._left.evaluate(feature2);
  83691. const right = this._right.evaluate(feature2);
  83692. if (left instanceof RegExp && typeof right === "string") {
  83693. return left.test(right);
  83694. } else if (right instanceof RegExp && typeof left === "string") {
  83695. return right.test(left);
  83696. }
  83697. throw new RuntimeError_default(
  83698. `Operator "=~" requires one RegExp argument and one string argument. Arguments are ${left} and ${right}.`
  83699. );
  83700. };
  83701. Node3.prototype._evaluateRegExpNotMatch = function(feature2) {
  83702. const left = this._left.evaluate(feature2);
  83703. const right = this._right.evaluate(feature2);
  83704. if (left instanceof RegExp && typeof right === "string") {
  83705. return !left.test(right);
  83706. } else if (right instanceof RegExp && typeof left === "string") {
  83707. return !right.test(left);
  83708. }
  83709. throw new RuntimeError_default(
  83710. `Operator "!~" requires one RegExp argument and one string argument. Arguments are ${left} and ${right}.`
  83711. );
  83712. };
  83713. Node3.prototype._evaluateRegExpExec = function(feature2) {
  83714. const left = this._left.evaluate(feature2);
  83715. const right = this._right.evaluate(feature2);
  83716. if (!(left instanceof RegExp && typeof right === "string")) {
  83717. throw new RuntimeError_default(
  83718. `RegExp.exec requires the first argument to be a RegExp and the second argument to be a string. Arguments are ${left} and ${right}.`
  83719. );
  83720. }
  83721. const exec = left.exec(right);
  83722. if (!defined_default(exec)) {
  83723. return null;
  83724. }
  83725. return exec[1];
  83726. };
  83727. Node3.prototype._evaluateToString = function(feature2) {
  83728. const left = this._left.evaluate(feature2);
  83729. if (left instanceof RegExp || left instanceof Cartesian2_default || left instanceof Cartesian3_default || left instanceof Cartesian4_default) {
  83730. return String(left);
  83731. }
  83732. throw new RuntimeError_default(`Unexpected function call "${this._value}".`);
  83733. };
  83734. function convertHSLToRGB(ast) {
  83735. const channels = ast._left;
  83736. const length3 = channels.length;
  83737. for (let i2 = 0; i2 < length3; ++i2) {
  83738. if (channels[i2]._type !== ExpressionNodeType_default.LITERAL_NUMBER) {
  83739. return void 0;
  83740. }
  83741. }
  83742. const h = channels[0]._value;
  83743. const s2 = channels[1]._value;
  83744. const l2 = channels[2]._value;
  83745. const a4 = length3 === 4 ? channels[3]._value : 1;
  83746. return Color_default.fromHsl(h, s2, l2, a4, scratchColor3);
  83747. }
  83748. function convertRGBToColor(ast) {
  83749. const channels = ast._left;
  83750. const length3 = channels.length;
  83751. for (let i2 = 0; i2 < length3; ++i2) {
  83752. if (channels[i2]._type !== ExpressionNodeType_default.LITERAL_NUMBER) {
  83753. return void 0;
  83754. }
  83755. }
  83756. const color = scratchColor3;
  83757. color.red = channels[0]._value / 255;
  83758. color.green = channels[1]._value / 255;
  83759. color.blue = channels[2]._value / 255;
  83760. color.alpha = length3 === 4 ? channels[3]._value : 1;
  83761. return color;
  83762. }
  83763. function numberToString(number) {
  83764. if (number % 1 === 0) {
  83765. return number.toFixed(1);
  83766. }
  83767. return number.toString();
  83768. }
  83769. function colorToVec3(color) {
  83770. const r2 = numberToString(color.red);
  83771. const g = numberToString(color.green);
  83772. const b = numberToString(color.blue);
  83773. return `vec3(${r2}, ${g}, ${b})`;
  83774. }
  83775. function colorToVec4(color) {
  83776. const r2 = numberToString(color.red);
  83777. const g = numberToString(color.green);
  83778. const b = numberToString(color.blue);
  83779. const a4 = numberToString(color.alpha);
  83780. return `vec4(${r2}, ${g}, ${b}, ${a4})`;
  83781. }
  83782. function getExpressionArray(array, variableSubstitutionMap, shaderState, parent) {
  83783. const length3 = array.length;
  83784. const expressions = new Array(length3);
  83785. for (let i2 = 0; i2 < length3; ++i2) {
  83786. expressions[i2] = array[i2].getShaderExpression(
  83787. variableSubstitutionMap,
  83788. shaderState,
  83789. parent
  83790. );
  83791. }
  83792. return expressions;
  83793. }
  83794. function getVariableName(variableName, variableSubstitutionMap) {
  83795. if (!defined_default(variableSubstitutionMap[variableName])) {
  83796. return Expression.NULL_SENTINEL;
  83797. }
  83798. return variableSubstitutionMap[variableName];
  83799. }
  83800. Expression.NULL_SENTINEL = "czm_infinity";
  83801. Node3.prototype.getShaderExpression = function(variableSubstitutionMap, shaderState, parent) {
  83802. let color;
  83803. let left;
  83804. let right;
  83805. let test;
  83806. const type = this._type;
  83807. let value = this._value;
  83808. if (defined_default(this._left)) {
  83809. if (Array.isArray(this._left)) {
  83810. left = getExpressionArray(
  83811. this._left,
  83812. variableSubstitutionMap,
  83813. shaderState,
  83814. this
  83815. );
  83816. } else {
  83817. left = this._left.getShaderExpression(
  83818. variableSubstitutionMap,
  83819. shaderState,
  83820. this
  83821. );
  83822. }
  83823. }
  83824. if (defined_default(this._right)) {
  83825. right = this._right.getShaderExpression(
  83826. variableSubstitutionMap,
  83827. shaderState,
  83828. this
  83829. );
  83830. }
  83831. if (defined_default(this._test)) {
  83832. test = this._test.getShaderExpression(
  83833. variableSubstitutionMap,
  83834. shaderState,
  83835. this
  83836. );
  83837. }
  83838. if (Array.isArray(this._value)) {
  83839. value = getExpressionArray(
  83840. this._value,
  83841. variableSubstitutionMap,
  83842. shaderState,
  83843. this
  83844. );
  83845. }
  83846. let args;
  83847. let length3;
  83848. let vectorExpression;
  83849. switch (type) {
  83850. case ExpressionNodeType_default.VARIABLE:
  83851. if (checkFeature(this)) {
  83852. return void 0;
  83853. }
  83854. return getVariableName(value, variableSubstitutionMap);
  83855. case ExpressionNodeType_default.UNARY:
  83856. if (value === "Boolean") {
  83857. return `bool(${left})`;
  83858. } else if (value === "Number") {
  83859. return `float(${left})`;
  83860. } else if (value === "round") {
  83861. return `floor(${left} + 0.5)`;
  83862. } else if (defined_default(unaryFunctions[value])) {
  83863. return `${value}(${left})`;
  83864. } else if (value === "isNaN") {
  83865. return `(${left} != ${left})`;
  83866. } else if (value === "isFinite") {
  83867. return `(abs(${left}) < czm_infinity)`;
  83868. } else if (value === "String" || value === "isExactClass" || value === "isClass" || value === "getExactClassName") {
  83869. throw new RuntimeError_default(
  83870. `Error generating style shader: "${value}" is not supported.`
  83871. );
  83872. }
  83873. return value + left;
  83874. case ExpressionNodeType_default.BINARY:
  83875. if (value === "%") {
  83876. return `mod(${left}, ${right})`;
  83877. } else if (value === "===") {
  83878. return `(${left} == ${right})`;
  83879. } else if (value === "!==") {
  83880. return `(${left} != ${right})`;
  83881. } else if (value === "atan2") {
  83882. return `atan(${left}, ${right})`;
  83883. } else if (defined_default(binaryFunctions[value])) {
  83884. return `${value}(${left}, ${right})`;
  83885. }
  83886. return `(${left} ${value} ${right})`;
  83887. case ExpressionNodeType_default.TERNARY:
  83888. if (defined_default(ternaryFunctions[value])) {
  83889. return `${value}(${left}, ${right}, ${test})`;
  83890. }
  83891. break;
  83892. case ExpressionNodeType_default.CONDITIONAL:
  83893. return `(${test} ? ${left} : ${right})`;
  83894. case ExpressionNodeType_default.MEMBER:
  83895. if (checkFeature(this._left)) {
  83896. return getVariableName(right, variableSubstitutionMap);
  83897. }
  83898. if (right === "r" || right === "x" || right === "0.0") {
  83899. return `${left}[0]`;
  83900. } else if (right === "g" || right === "y" || right === "1.0") {
  83901. return `${left}[1]`;
  83902. } else if (right === "b" || right === "z" || right === "2.0") {
  83903. return `${left}[2]`;
  83904. } else if (right === "a" || right === "w" || right === "3.0") {
  83905. return `${left}[3]`;
  83906. }
  83907. return `${left}[int(${right})]`;
  83908. case ExpressionNodeType_default.FUNCTION_CALL:
  83909. throw new RuntimeError_default(
  83910. `Error generating style shader: "${value}" is not supported.`
  83911. );
  83912. case ExpressionNodeType_default.ARRAY:
  83913. if (value.length === 4) {
  83914. return `vec4(${value[0]}, ${value[1]}, ${value[2]}, ${value[3]})`;
  83915. } else if (value.length === 3) {
  83916. return `vec3(${value[0]}, ${value[1]}, ${value[2]})`;
  83917. } else if (value.length === 2) {
  83918. return `vec2(${value[0]}, ${value[1]})`;
  83919. }
  83920. throw new RuntimeError_default(
  83921. "Error generating style shader: Invalid array length. Array length should be 2, 3, or 4."
  83922. );
  83923. case ExpressionNodeType_default.REGEX:
  83924. throw new RuntimeError_default(
  83925. "Error generating style shader: Regular expressions are not supported."
  83926. );
  83927. case ExpressionNodeType_default.VARIABLE_IN_STRING:
  83928. throw new RuntimeError_default(
  83929. "Error generating style shader: Converting a variable to a string is not supported."
  83930. );
  83931. case ExpressionNodeType_default.LITERAL_NULL:
  83932. return Expression.NULL_SENTINEL;
  83933. case ExpressionNodeType_default.LITERAL_BOOLEAN:
  83934. return value ? "true" : "false";
  83935. case ExpressionNodeType_default.LITERAL_NUMBER:
  83936. return numberToString(value);
  83937. case ExpressionNodeType_default.LITERAL_STRING:
  83938. if (defined_default(parent) && parent._type === ExpressionNodeType_default.MEMBER) {
  83939. if (value === "r" || value === "g" || value === "b" || value === "a" || value === "x" || value === "y" || value === "z" || value === "w" || checkFeature(parent._left)) {
  83940. return value;
  83941. }
  83942. }
  83943. color = Color_default.fromCssColorString(value, scratchColor3);
  83944. if (defined_default(color)) {
  83945. return colorToVec3(color);
  83946. }
  83947. throw new RuntimeError_default(
  83948. "Error generating style shader: String literals are not supported."
  83949. );
  83950. case ExpressionNodeType_default.LITERAL_COLOR:
  83951. args = left;
  83952. if (value === "color") {
  83953. if (!defined_default(args)) {
  83954. return "vec4(1.0)";
  83955. } else if (args.length > 1) {
  83956. const rgb = args[0];
  83957. const alpha = args[1];
  83958. if (alpha !== "1.0") {
  83959. shaderState.translucent = true;
  83960. }
  83961. return `vec4(${rgb}, ${alpha})`;
  83962. }
  83963. return `vec4(${args[0]}, 1.0)`;
  83964. } else if (value === "rgb") {
  83965. color = convertRGBToColor(this);
  83966. if (defined_default(color)) {
  83967. return colorToVec4(color);
  83968. }
  83969. return `vec4(${args[0]} / 255.0, ${args[1]} / 255.0, ${args[2]} / 255.0, 1.0)`;
  83970. } else if (value === "rgba") {
  83971. if (args[3] !== "1.0") {
  83972. shaderState.translucent = true;
  83973. }
  83974. color = convertRGBToColor(this);
  83975. if (defined_default(color)) {
  83976. return colorToVec4(color);
  83977. }
  83978. return `vec4(${args[0]} / 255.0, ${args[1]} / 255.0, ${args[2]} / 255.0, ${args[3]})`;
  83979. } else if (value === "hsl") {
  83980. color = convertHSLToRGB(this);
  83981. if (defined_default(color)) {
  83982. return colorToVec4(color);
  83983. }
  83984. return `vec4(czm_HSLToRGB(vec3(${args[0]}, ${args[1]}, ${args[2]})), 1.0)`;
  83985. } else if (value === "hsla") {
  83986. color = convertHSLToRGB(this);
  83987. if (defined_default(color)) {
  83988. if (color.alpha !== 1) {
  83989. shaderState.translucent = true;
  83990. }
  83991. return colorToVec4(color);
  83992. }
  83993. if (args[3] !== "1.0") {
  83994. shaderState.translucent = true;
  83995. }
  83996. return `vec4(czm_HSLToRGB(vec3(${args[0]}, ${args[1]}, ${args[2]})), ${args[3]})`;
  83997. }
  83998. break;
  83999. case ExpressionNodeType_default.LITERAL_VECTOR:
  84000. if (!defined_default(left)) {
  84001. throw new DeveloperError_default(
  84002. "left should always be defined for type ExpressionNodeType.LITERAL_VECTOR"
  84003. );
  84004. }
  84005. length3 = left.length;
  84006. vectorExpression = `${value}(`;
  84007. for (let i2 = 0; i2 < length3; ++i2) {
  84008. vectorExpression += left[i2];
  84009. if (i2 < length3 - 1) {
  84010. vectorExpression += ", ";
  84011. }
  84012. }
  84013. vectorExpression += ")";
  84014. return vectorExpression;
  84015. case ExpressionNodeType_default.LITERAL_REGEX:
  84016. throw new RuntimeError_default(
  84017. "Error generating style shader: Regular expressions are not supported."
  84018. );
  84019. case ExpressionNodeType_default.LITERAL_UNDEFINED:
  84020. return Expression.NULL_SENTINEL;
  84021. case ExpressionNodeType_default.BUILTIN_VARIABLE:
  84022. if (value === "tiles3d_tileset_time") {
  84023. return "u_time";
  84024. }
  84025. }
  84026. };
  84027. Node3.prototype.getVariables = function(variables, parent) {
  84028. let array;
  84029. let length3;
  84030. let i2;
  84031. const type = this._type;
  84032. const value = this._value;
  84033. if (defined_default(this._left)) {
  84034. if (Array.isArray(this._left)) {
  84035. array = this._left;
  84036. length3 = array.length;
  84037. for (i2 = 0; i2 < length3; ++i2) {
  84038. array[i2].getVariables(variables, this);
  84039. }
  84040. } else {
  84041. this._left.getVariables(variables, this);
  84042. }
  84043. }
  84044. if (defined_default(this._right)) {
  84045. this._right.getVariables(variables, this);
  84046. }
  84047. if (defined_default(this._test)) {
  84048. this._test.getVariables(variables, this);
  84049. }
  84050. if (Array.isArray(this._value)) {
  84051. array = this._value;
  84052. length3 = array.length;
  84053. for (i2 = 0; i2 < length3; ++i2) {
  84054. array[i2].getVariables(variables, this);
  84055. }
  84056. }
  84057. let match;
  84058. switch (type) {
  84059. case ExpressionNodeType_default.VARIABLE:
  84060. if (!checkFeature(this)) {
  84061. variables.push(value);
  84062. }
  84063. break;
  84064. case ExpressionNodeType_default.VARIABLE_IN_STRING:
  84065. match = variableRegex.exec(value);
  84066. while (match !== null) {
  84067. variables.push(match[1]);
  84068. match = variableRegex.exec(value);
  84069. }
  84070. break;
  84071. case ExpressionNodeType_default.LITERAL_STRING:
  84072. if (defined_default(parent) && parent._type === ExpressionNodeType_default.MEMBER && checkFeature(parent._left)) {
  84073. variables.push(value);
  84074. }
  84075. break;
  84076. }
  84077. };
  84078. var Expression_default = Expression;
  84079. // node_modules/cesium/Source/Scene/Vector3DTilePrimitive.js
  84080. function Vector3DTilePrimitive(options) {
  84081. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  84082. this._batchTable = options.batchTable;
  84083. this._batchIds = options.batchIds;
  84084. this._positions = options.positions;
  84085. this._vertexBatchIds = options.vertexBatchIds;
  84086. this._indices = options.indices;
  84087. this._indexCounts = options.indexCounts;
  84088. this._indexOffsets = options.indexOffsets;
  84089. this._batchedIndices = options.batchedIndices;
  84090. this._boundingVolume = options.boundingVolume;
  84091. this._boundingVolumes = options.boundingVolumes;
  84092. this._center = defaultValue_default(options.center, Cartesian3_default.ZERO);
  84093. this._va = void 0;
  84094. this._sp = void 0;
  84095. this._spStencil = void 0;
  84096. this._spPick = void 0;
  84097. this._uniformMap = void 0;
  84098. this._vaSwap = void 0;
  84099. this._rsStencilDepthPass = void 0;
  84100. this._rsStencilDepthPass3DTiles = void 0;
  84101. this._rsColorPass = void 0;
  84102. this._rsPickPass = void 0;
  84103. this._rsWireframe = void 0;
  84104. this._commands = [];
  84105. this._commandsIgnoreShow = [];
  84106. this._pickCommands = [];
  84107. this._constantColor = Color_default.clone(Color_default.WHITE);
  84108. this._highlightColor = this._constantColor;
  84109. this._batchDirty = true;
  84110. this._pickCommandsDirty = true;
  84111. this._framesSinceLastRebatch = 0;
  84112. this._updatingAllCommands = false;
  84113. this._trianglesLength = this._indices.length / 3;
  84114. this._geometryByteLength = this._indices.byteLength + this._positions.byteLength + this._vertexBatchIds.byteLength;
  84115. this.debugWireframe = false;
  84116. this._debugWireframe = this.debugWireframe;
  84117. this._wireframeDirty = false;
  84118. this.forceRebatch = false;
  84119. this.classificationType = defaultValue_default(
  84120. options.classificationType,
  84121. ClassificationType_default.BOTH
  84122. );
  84123. this._vertexShaderSource = options._vertexShaderSource;
  84124. this._fragmentShaderSource = options._fragmentShaderSource;
  84125. this._attributeLocations = options._attributeLocations;
  84126. this._uniformMap = options._uniformMap;
  84127. this._pickId = options._pickId;
  84128. this._modelMatrix = options._modelMatrix;
  84129. this._boundingSphere = options._boundingSphere;
  84130. this._batchIdLookUp = {};
  84131. const length3 = this._batchIds.length;
  84132. for (let i2 = 0; i2 < length3; ++i2) {
  84133. const batchId = this._batchIds[i2];
  84134. this._batchIdLookUp[batchId] = i2;
  84135. }
  84136. }
  84137. Object.defineProperties(Vector3DTilePrimitive.prototype, {
  84138. trianglesLength: {
  84139. get: function() {
  84140. return this._trianglesLength;
  84141. }
  84142. },
  84143. geometryByteLength: {
  84144. get: function() {
  84145. return this._geometryByteLength;
  84146. }
  84147. }
  84148. });
  84149. var defaultAttributeLocations = {
  84150. position: 0,
  84151. a_batchId: 1
  84152. };
  84153. function createVertexArray3(primitive, context) {
  84154. if (defined_default(primitive._va)) {
  84155. return;
  84156. }
  84157. const positionBuffer = Buffer_default.createVertexBuffer({
  84158. context,
  84159. typedArray: primitive._positions,
  84160. usage: BufferUsage_default.STATIC_DRAW
  84161. });
  84162. const idBuffer = Buffer_default.createVertexBuffer({
  84163. context,
  84164. typedArray: primitive._vertexBatchIds,
  84165. usage: BufferUsage_default.STATIC_DRAW
  84166. });
  84167. const indexBuffer = Buffer_default.createIndexBuffer({
  84168. context,
  84169. typedArray: primitive._indices,
  84170. usage: BufferUsage_default.DYNAMIC_DRAW,
  84171. indexDatatype: primitive._indices.BYTES_PER_ELEMENT === 2 ? IndexDatatype_default.UNSIGNED_SHORT : IndexDatatype_default.UNSIGNED_INT
  84172. });
  84173. const vertexAttributes = [
  84174. {
  84175. index: 0,
  84176. vertexBuffer: positionBuffer,
  84177. componentDatatype: ComponentDatatype_default.fromTypedArray(primitive._positions),
  84178. componentsPerAttribute: 3
  84179. },
  84180. {
  84181. index: 1,
  84182. vertexBuffer: idBuffer,
  84183. componentDatatype: ComponentDatatype_default.fromTypedArray(
  84184. primitive._vertexBatchIds
  84185. ),
  84186. componentsPerAttribute: 1
  84187. }
  84188. ];
  84189. primitive._va = new VertexArray_default({
  84190. context,
  84191. attributes: vertexAttributes,
  84192. indexBuffer
  84193. });
  84194. if (context.webgl2) {
  84195. primitive._vaSwap = new VertexArray_default({
  84196. context,
  84197. attributes: vertexAttributes,
  84198. indexBuffer: Buffer_default.createIndexBuffer({
  84199. context,
  84200. sizeInBytes: indexBuffer.sizeInBytes,
  84201. usage: BufferUsage_default.DYNAMIC_DRAW,
  84202. indexDatatype: indexBuffer.indexDatatype
  84203. })
  84204. });
  84205. }
  84206. primitive._batchedPositions = void 0;
  84207. primitive._transferrableBatchIds = void 0;
  84208. primitive._vertexBatchIds = void 0;
  84209. primitive._verticesPromise = void 0;
  84210. }
  84211. function createShaders(primitive, context) {
  84212. if (defined_default(primitive._sp)) {
  84213. return;
  84214. }
  84215. const batchTable = primitive._batchTable;
  84216. const attributeLocations8 = defaultValue_default(
  84217. primitive._attributeLocations,
  84218. defaultAttributeLocations
  84219. );
  84220. let pickId = primitive._pickId;
  84221. const vertexShaderSource = primitive._vertexShaderSource;
  84222. let fragmentShaderSource = primitive._fragmentShaderSource;
  84223. if (defined_default(vertexShaderSource)) {
  84224. primitive._sp = ShaderProgram_default.fromCache({
  84225. context,
  84226. vertexShaderSource,
  84227. fragmentShaderSource,
  84228. attributeLocations: attributeLocations8
  84229. });
  84230. primitive._spStencil = primitive._sp;
  84231. fragmentShaderSource = ShaderSource_default.replaceMain(
  84232. fragmentShaderSource,
  84233. "czm_non_pick_main"
  84234. );
  84235. fragmentShaderSource = `${fragmentShaderSource}void main()
  84236. {
  84237. czm_non_pick_main();
  84238. gl_FragColor = ${pickId};
  84239. }
  84240. `;
  84241. primitive._spPick = ShaderProgram_default.fromCache({
  84242. context,
  84243. vertexShaderSource,
  84244. fragmentShaderSource,
  84245. attributeLocations: attributeLocations8
  84246. });
  84247. return;
  84248. }
  84249. const vsSource = batchTable.getVertexShaderCallback(
  84250. false,
  84251. "a_batchId",
  84252. void 0
  84253. )(VectorTileVS_default);
  84254. let fsSource = batchTable.getFragmentShaderCallback(
  84255. false,
  84256. void 0,
  84257. true
  84258. )(ShadowVolumeFS_default);
  84259. pickId = batchTable.getPickId();
  84260. let vs = new ShaderSource_default({
  84261. sources: [vsSource]
  84262. });
  84263. let fs = new ShaderSource_default({
  84264. defines: ["VECTOR_TILE"],
  84265. sources: [fsSource]
  84266. });
  84267. primitive._sp = ShaderProgram_default.fromCache({
  84268. context,
  84269. vertexShaderSource: vs,
  84270. fragmentShaderSource: fs,
  84271. attributeLocations: attributeLocations8
  84272. });
  84273. vs = new ShaderSource_default({
  84274. sources: [VectorTileVS_default]
  84275. });
  84276. fs = new ShaderSource_default({
  84277. defines: ["VECTOR_TILE"],
  84278. sources: [ShadowVolumeFS_default]
  84279. });
  84280. primitive._spStencil = ShaderProgram_default.fromCache({
  84281. context,
  84282. vertexShaderSource: vs,
  84283. fragmentShaderSource: fs,
  84284. attributeLocations: attributeLocations8
  84285. });
  84286. fsSource = ShaderSource_default.replaceMain(fsSource, "czm_non_pick_main");
  84287. fsSource = `${fsSource}
  84288. void main()
  84289. {
  84290. czm_non_pick_main();
  84291. gl_FragColor = ${pickId};
  84292. }
  84293. `;
  84294. const pickVS = new ShaderSource_default({
  84295. sources: [vsSource]
  84296. });
  84297. const pickFS = new ShaderSource_default({
  84298. defines: ["VECTOR_TILE"],
  84299. sources: [fsSource]
  84300. });
  84301. primitive._spPick = ShaderProgram_default.fromCache({
  84302. context,
  84303. vertexShaderSource: pickVS,
  84304. fragmentShaderSource: pickFS,
  84305. attributeLocations: attributeLocations8
  84306. });
  84307. }
  84308. function getStencilDepthRenderState2(mask3DTiles) {
  84309. const stencilFunction = mask3DTiles ? StencilFunction_default.EQUAL : StencilFunction_default.ALWAYS;
  84310. return {
  84311. colorMask: {
  84312. red: false,
  84313. green: false,
  84314. blue: false,
  84315. alpha: false
  84316. },
  84317. stencilTest: {
  84318. enabled: true,
  84319. frontFunction: stencilFunction,
  84320. frontOperation: {
  84321. fail: StencilOperation_default.KEEP,
  84322. zFail: StencilOperation_default.DECREMENT_WRAP,
  84323. zPass: StencilOperation_default.KEEP
  84324. },
  84325. backFunction: stencilFunction,
  84326. backOperation: {
  84327. fail: StencilOperation_default.KEEP,
  84328. zFail: StencilOperation_default.INCREMENT_WRAP,
  84329. zPass: StencilOperation_default.KEEP
  84330. },
  84331. reference: StencilConstants_default.CESIUM_3D_TILE_MASK,
  84332. mask: StencilConstants_default.CESIUM_3D_TILE_MASK
  84333. },
  84334. stencilMask: StencilConstants_default.CLASSIFICATION_MASK,
  84335. depthTest: {
  84336. enabled: true,
  84337. func: DepthFunction_default.LESS_OR_EQUAL
  84338. },
  84339. depthMask: false
  84340. };
  84341. }
  84342. var colorRenderState = {
  84343. stencilTest: {
  84344. enabled: true,
  84345. frontFunction: StencilFunction_default.NOT_EQUAL,
  84346. frontOperation: {
  84347. fail: StencilOperation_default.ZERO,
  84348. zFail: StencilOperation_default.ZERO,
  84349. zPass: StencilOperation_default.ZERO
  84350. },
  84351. backFunction: StencilFunction_default.NOT_EQUAL,
  84352. backOperation: {
  84353. fail: StencilOperation_default.ZERO,
  84354. zFail: StencilOperation_default.ZERO,
  84355. zPass: StencilOperation_default.ZERO
  84356. },
  84357. reference: 0,
  84358. mask: StencilConstants_default.CLASSIFICATION_MASK
  84359. },
  84360. stencilMask: StencilConstants_default.CLASSIFICATION_MASK,
  84361. depthTest: {
  84362. enabled: false
  84363. },
  84364. depthMask: false,
  84365. blending: BlendingState_default.PRE_MULTIPLIED_ALPHA_BLEND
  84366. };
  84367. var pickRenderState2 = {
  84368. stencilTest: {
  84369. enabled: true,
  84370. frontFunction: StencilFunction_default.NOT_EQUAL,
  84371. frontOperation: {
  84372. fail: StencilOperation_default.ZERO,
  84373. zFail: StencilOperation_default.ZERO,
  84374. zPass: StencilOperation_default.ZERO
  84375. },
  84376. backFunction: StencilFunction_default.NOT_EQUAL,
  84377. backOperation: {
  84378. fail: StencilOperation_default.ZERO,
  84379. zFail: StencilOperation_default.ZERO,
  84380. zPass: StencilOperation_default.ZERO
  84381. },
  84382. reference: 0,
  84383. mask: StencilConstants_default.CLASSIFICATION_MASK
  84384. },
  84385. stencilMask: StencilConstants_default.CLASSIFICATION_MASK,
  84386. depthTest: {
  84387. enabled: false
  84388. },
  84389. depthMask: false
  84390. };
  84391. function createRenderStates3(primitive) {
  84392. if (defined_default(primitive._rsStencilDepthPass)) {
  84393. return;
  84394. }
  84395. primitive._rsStencilDepthPass = RenderState_default.fromCache(
  84396. getStencilDepthRenderState2(false)
  84397. );
  84398. primitive._rsStencilDepthPass3DTiles = RenderState_default.fromCache(
  84399. getStencilDepthRenderState2(true)
  84400. );
  84401. primitive._rsColorPass = RenderState_default.fromCache(colorRenderState);
  84402. primitive._rsPickPass = RenderState_default.fromCache(pickRenderState2);
  84403. }
  84404. var modifiedModelViewScratch2 = new Matrix4_default();
  84405. var rtcScratch2 = new Cartesian3_default();
  84406. function createUniformMap(primitive, context) {
  84407. if (defined_default(primitive._uniformMap)) {
  84408. return;
  84409. }
  84410. const uniformMap2 = {
  84411. u_modifiedModelViewProjection: function() {
  84412. const viewMatrix = context.uniformState.view;
  84413. const projectionMatrix = context.uniformState.projection;
  84414. Matrix4_default.clone(viewMatrix, modifiedModelViewScratch2);
  84415. Matrix4_default.multiplyByPoint(
  84416. modifiedModelViewScratch2,
  84417. primitive._center,
  84418. rtcScratch2
  84419. );
  84420. Matrix4_default.setTranslation(
  84421. modifiedModelViewScratch2,
  84422. rtcScratch2,
  84423. modifiedModelViewScratch2
  84424. );
  84425. Matrix4_default.multiply(
  84426. projectionMatrix,
  84427. modifiedModelViewScratch2,
  84428. modifiedModelViewScratch2
  84429. );
  84430. return modifiedModelViewScratch2;
  84431. },
  84432. u_highlightColor: function() {
  84433. return primitive._highlightColor;
  84434. }
  84435. };
  84436. primitive._uniformMap = primitive._batchTable.getUniformMapCallback()(
  84437. uniformMap2
  84438. );
  84439. }
  84440. function copyIndicesCPU(indices2, newIndices, currentOffset, offsets, counts, batchIds, batchIdLookUp) {
  84441. const sizeInBytes = indices2.constructor.BYTES_PER_ELEMENT;
  84442. const batchedIdsLength = batchIds.length;
  84443. for (let j = 0; j < batchedIdsLength; ++j) {
  84444. const batchedId = batchIds[j];
  84445. const index2 = batchIdLookUp[batchedId];
  84446. const offset2 = offsets[index2];
  84447. const count = counts[index2];
  84448. const subarray2 = new indices2.constructor(
  84449. indices2.buffer,
  84450. sizeInBytes * offset2,
  84451. count
  84452. );
  84453. newIndices.set(subarray2, currentOffset);
  84454. offsets[index2] = currentOffset;
  84455. currentOffset += count;
  84456. }
  84457. return currentOffset;
  84458. }
  84459. function rebatchCPU(primitive, batchedIndices) {
  84460. const indices2 = primitive._indices;
  84461. const indexOffsets = primitive._indexOffsets;
  84462. const indexCounts = primitive._indexCounts;
  84463. const batchIdLookUp = primitive._batchIdLookUp;
  84464. const newIndices = new indices2.constructor(indices2.length);
  84465. let current = batchedIndices.pop();
  84466. const newBatchedIndices = [current];
  84467. let currentOffset = copyIndicesCPU(
  84468. indices2,
  84469. newIndices,
  84470. 0,
  84471. indexOffsets,
  84472. indexCounts,
  84473. current.batchIds,
  84474. batchIdLookUp
  84475. );
  84476. current.offset = 0;
  84477. current.count = currentOffset;
  84478. while (batchedIndices.length > 0) {
  84479. const next = batchedIndices.pop();
  84480. if (Color_default.equals(next.color, current.color)) {
  84481. currentOffset = copyIndicesCPU(
  84482. indices2,
  84483. newIndices,
  84484. currentOffset,
  84485. indexOffsets,
  84486. indexCounts,
  84487. next.batchIds,
  84488. batchIdLookUp
  84489. );
  84490. current.batchIds = current.batchIds.concat(next.batchIds);
  84491. current.count = currentOffset - current.offset;
  84492. } else {
  84493. const offset2 = currentOffset;
  84494. currentOffset = copyIndicesCPU(
  84495. indices2,
  84496. newIndices,
  84497. currentOffset,
  84498. indexOffsets,
  84499. indexCounts,
  84500. next.batchIds,
  84501. batchIdLookUp
  84502. );
  84503. next.offset = offset2;
  84504. next.count = currentOffset - offset2;
  84505. newBatchedIndices.push(next);
  84506. current = next;
  84507. }
  84508. }
  84509. primitive._va.indexBuffer.copyFromArrayView(newIndices);
  84510. primitive._indices = newIndices;
  84511. primitive._batchedIndices = newBatchedIndices;
  84512. }
  84513. function copyIndicesGPU(readBuffer, writeBuffer, currentOffset, offsets, counts, batchIds, batchIdLookUp) {
  84514. const sizeInBytes = readBuffer.bytesPerIndex;
  84515. const batchedIdsLength = batchIds.length;
  84516. for (let j = 0; j < batchedIdsLength; ++j) {
  84517. const batchedId = batchIds[j];
  84518. const index2 = batchIdLookUp[batchedId];
  84519. const offset2 = offsets[index2];
  84520. const count = counts[index2];
  84521. writeBuffer.copyFromBuffer(
  84522. readBuffer,
  84523. offset2 * sizeInBytes,
  84524. currentOffset * sizeInBytes,
  84525. count * sizeInBytes
  84526. );
  84527. offsets[index2] = currentOffset;
  84528. currentOffset += count;
  84529. }
  84530. return currentOffset;
  84531. }
  84532. function rebatchGPU(primitive, batchedIndices) {
  84533. const indexOffsets = primitive._indexOffsets;
  84534. const indexCounts = primitive._indexCounts;
  84535. const batchIdLookUp = primitive._batchIdLookUp;
  84536. let current = batchedIndices.pop();
  84537. const newBatchedIndices = [current];
  84538. const readBuffer = primitive._va.indexBuffer;
  84539. const writeBuffer = primitive._vaSwap.indexBuffer;
  84540. let currentOffset = copyIndicesGPU(
  84541. readBuffer,
  84542. writeBuffer,
  84543. 0,
  84544. indexOffsets,
  84545. indexCounts,
  84546. current.batchIds,
  84547. batchIdLookUp
  84548. );
  84549. current.offset = 0;
  84550. current.count = currentOffset;
  84551. while (batchedIndices.length > 0) {
  84552. const next = batchedIndices.pop();
  84553. if (Color_default.equals(next.color, current.color)) {
  84554. currentOffset = copyIndicesGPU(
  84555. readBuffer,
  84556. writeBuffer,
  84557. currentOffset,
  84558. indexOffsets,
  84559. indexCounts,
  84560. next.batchIds,
  84561. batchIdLookUp
  84562. );
  84563. current.batchIds = current.batchIds.concat(next.batchIds);
  84564. current.count = currentOffset - current.offset;
  84565. } else {
  84566. const offset2 = currentOffset;
  84567. currentOffset = copyIndicesGPU(
  84568. readBuffer,
  84569. writeBuffer,
  84570. currentOffset,
  84571. indexOffsets,
  84572. indexCounts,
  84573. next.batchIds,
  84574. batchIdLookUp
  84575. );
  84576. next.offset = offset2;
  84577. next.count = currentOffset - offset2;
  84578. newBatchedIndices.push(next);
  84579. current = next;
  84580. }
  84581. }
  84582. const temp = primitive._va;
  84583. primitive._va = primitive._vaSwap;
  84584. primitive._vaSwap = temp;
  84585. primitive._batchedIndices = newBatchedIndices;
  84586. }
  84587. function compareColors(a4, b) {
  84588. return b.color.toRgba() - a4.color.toRgba();
  84589. }
  84590. function rebatchCommands(primitive, context) {
  84591. if (!primitive._batchDirty) {
  84592. return false;
  84593. }
  84594. const batchedIndices = primitive._batchedIndices;
  84595. const length3 = batchedIndices.length;
  84596. let needToRebatch = false;
  84597. const colorCounts = {};
  84598. for (let i2 = 0; i2 < length3; ++i2) {
  84599. const color = batchedIndices[i2].color;
  84600. const rgba = color.toRgba();
  84601. if (defined_default(colorCounts[rgba])) {
  84602. needToRebatch = true;
  84603. break;
  84604. } else {
  84605. colorCounts[rgba] = true;
  84606. }
  84607. }
  84608. if (!needToRebatch) {
  84609. primitive._batchDirty = false;
  84610. return false;
  84611. }
  84612. if (needToRebatch && !primitive.forceRebatch && primitive._framesSinceLastRebatch < 120) {
  84613. ++primitive._framesSinceLastRebatch;
  84614. return;
  84615. }
  84616. batchedIndices.sort(compareColors);
  84617. if (context.webgl2) {
  84618. rebatchGPU(primitive, batchedIndices);
  84619. } else {
  84620. rebatchCPU(primitive, batchedIndices);
  84621. }
  84622. primitive._framesSinceLastRebatch = 0;
  84623. primitive._batchDirty = false;
  84624. primitive._pickCommandsDirty = true;
  84625. primitive._wireframeDirty = true;
  84626. return true;
  84627. }
  84628. function createColorCommands2(primitive, context) {
  84629. const needsRebatch = rebatchCommands(primitive, context);
  84630. const commands = primitive._commands;
  84631. const batchedIndices = primitive._batchedIndices;
  84632. const length3 = batchedIndices.length;
  84633. const commandsLength = length3 * 2;
  84634. if (defined_default(commands) && !needsRebatch && commands.length === commandsLength) {
  84635. return;
  84636. }
  84637. commands.length = commandsLength;
  84638. const vertexArray = primitive._va;
  84639. const sp = primitive._sp;
  84640. const modelMatrix = defaultValue_default(primitive._modelMatrix, Matrix4_default.IDENTITY);
  84641. const uniformMap2 = primitive._uniformMap;
  84642. const bv = primitive._boundingVolume;
  84643. for (let j = 0; j < length3; ++j) {
  84644. const offset2 = batchedIndices[j].offset;
  84645. const count = batchedIndices[j].count;
  84646. let stencilDepthCommand = commands[j * 2];
  84647. if (!defined_default(stencilDepthCommand)) {
  84648. stencilDepthCommand = commands[j * 2] = new DrawCommand_default({
  84649. owner: primitive
  84650. });
  84651. }
  84652. stencilDepthCommand.vertexArray = vertexArray;
  84653. stencilDepthCommand.modelMatrix = modelMatrix;
  84654. stencilDepthCommand.offset = offset2;
  84655. stencilDepthCommand.count = count;
  84656. stencilDepthCommand.renderState = primitive._rsStencilDepthPass;
  84657. stencilDepthCommand.shaderProgram = sp;
  84658. stencilDepthCommand.uniformMap = uniformMap2;
  84659. stencilDepthCommand.boundingVolume = bv;
  84660. stencilDepthCommand.cull = false;
  84661. stencilDepthCommand.pass = Pass_default.TERRAIN_CLASSIFICATION;
  84662. const stencilDepthDerivedCommand = DrawCommand_default.shallowClone(
  84663. stencilDepthCommand,
  84664. stencilDepthCommand.derivedCommands.tileset
  84665. );
  84666. stencilDepthDerivedCommand.renderState = primitive._rsStencilDepthPass3DTiles;
  84667. stencilDepthDerivedCommand.pass = Pass_default.CESIUM_3D_TILE_CLASSIFICATION;
  84668. stencilDepthCommand.derivedCommands.tileset = stencilDepthDerivedCommand;
  84669. let colorCommand = commands[j * 2 + 1];
  84670. if (!defined_default(colorCommand)) {
  84671. colorCommand = commands[j * 2 + 1] = new DrawCommand_default({
  84672. owner: primitive
  84673. });
  84674. }
  84675. colorCommand.vertexArray = vertexArray;
  84676. colorCommand.modelMatrix = modelMatrix;
  84677. colorCommand.offset = offset2;
  84678. colorCommand.count = count;
  84679. colorCommand.renderState = primitive._rsColorPass;
  84680. colorCommand.shaderProgram = sp;
  84681. colorCommand.uniformMap = uniformMap2;
  84682. colorCommand.boundingVolume = bv;
  84683. colorCommand.cull = false;
  84684. colorCommand.pass = Pass_default.TERRAIN_CLASSIFICATION;
  84685. const colorDerivedCommand = DrawCommand_default.shallowClone(
  84686. colorCommand,
  84687. colorCommand.derivedCommands.tileset
  84688. );
  84689. colorDerivedCommand.pass = Pass_default.CESIUM_3D_TILE_CLASSIFICATION;
  84690. colorCommand.derivedCommands.tileset = colorDerivedCommand;
  84691. }
  84692. primitive._commandsDirty = true;
  84693. }
  84694. function createColorCommandsIgnoreShow(primitive, frameState) {
  84695. if (primitive.classificationType === ClassificationType_default.TERRAIN || !frameState.invertClassification || defined_default(primitive._commandsIgnoreShow) && !primitive._commandsDirty) {
  84696. return;
  84697. }
  84698. const commands = primitive._commands;
  84699. const commandsIgnoreShow = primitive._commandsIgnoreShow;
  84700. const spStencil = primitive._spStencil;
  84701. const commandsLength = commands.length;
  84702. const length3 = commandsIgnoreShow.length = commandsLength / 2;
  84703. let commandIndex = 0;
  84704. for (let j = 0; j < length3; ++j) {
  84705. const commandIgnoreShow = commandsIgnoreShow[j] = DrawCommand_default.shallowClone(
  84706. commands[commandIndex],
  84707. commandsIgnoreShow[j]
  84708. );
  84709. commandIgnoreShow.shaderProgram = spStencil;
  84710. commandIgnoreShow.pass = Pass_default.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW;
  84711. commandIndex += 2;
  84712. }
  84713. primitive._commandsDirty = false;
  84714. }
  84715. function createPickCommands2(primitive) {
  84716. if (!primitive._pickCommandsDirty) {
  84717. return;
  84718. }
  84719. const length3 = primitive._indexOffsets.length;
  84720. const pickCommands = primitive._pickCommands;
  84721. pickCommands.length = length3 * 2;
  84722. const vertexArray = primitive._va;
  84723. const spStencil = primitive._spStencil;
  84724. const spPick = primitive._spPick;
  84725. const modelMatrix = defaultValue_default(primitive._modelMatrix, Matrix4_default.IDENTITY);
  84726. const uniformMap2 = primitive._uniformMap;
  84727. for (let j = 0; j < length3; ++j) {
  84728. const offset2 = primitive._indexOffsets[j];
  84729. const count = primitive._indexCounts[j];
  84730. const bv = defined_default(primitive._boundingVolumes) ? primitive._boundingVolumes[j] : primitive.boundingVolume;
  84731. let stencilDepthCommand = pickCommands[j * 2];
  84732. if (!defined_default(stencilDepthCommand)) {
  84733. stencilDepthCommand = pickCommands[j * 2] = new DrawCommand_default({
  84734. owner: primitive,
  84735. pickOnly: true
  84736. });
  84737. }
  84738. stencilDepthCommand.vertexArray = vertexArray;
  84739. stencilDepthCommand.modelMatrix = modelMatrix;
  84740. stencilDepthCommand.offset = offset2;
  84741. stencilDepthCommand.count = count;
  84742. stencilDepthCommand.renderState = primitive._rsStencilDepthPass;
  84743. stencilDepthCommand.shaderProgram = spStencil;
  84744. stencilDepthCommand.uniformMap = uniformMap2;
  84745. stencilDepthCommand.boundingVolume = bv;
  84746. stencilDepthCommand.pass = Pass_default.TERRAIN_CLASSIFICATION;
  84747. const stencilDepthDerivedCommand = DrawCommand_default.shallowClone(
  84748. stencilDepthCommand,
  84749. stencilDepthCommand.derivedCommands.tileset
  84750. );
  84751. stencilDepthDerivedCommand.renderState = primitive._rsStencilDepthPass3DTiles;
  84752. stencilDepthDerivedCommand.pass = Pass_default.CESIUM_3D_TILE_CLASSIFICATION;
  84753. stencilDepthCommand.derivedCommands.tileset = stencilDepthDerivedCommand;
  84754. let colorCommand = pickCommands[j * 2 + 1];
  84755. if (!defined_default(colorCommand)) {
  84756. colorCommand = pickCommands[j * 2 + 1] = new DrawCommand_default({
  84757. owner: primitive,
  84758. pickOnly: true
  84759. });
  84760. }
  84761. colorCommand.vertexArray = vertexArray;
  84762. colorCommand.modelMatrix = modelMatrix;
  84763. colorCommand.offset = offset2;
  84764. colorCommand.count = count;
  84765. colorCommand.renderState = primitive._rsPickPass;
  84766. colorCommand.shaderProgram = spPick;
  84767. colorCommand.uniformMap = uniformMap2;
  84768. colorCommand.boundingVolume = bv;
  84769. colorCommand.pass = Pass_default.TERRAIN_CLASSIFICATION;
  84770. const colorDerivedCommand = DrawCommand_default.shallowClone(
  84771. colorCommand,
  84772. colorCommand.derivedCommands.tileset
  84773. );
  84774. colorDerivedCommand.pass = Pass_default.CESIUM_3D_TILE_CLASSIFICATION;
  84775. colorCommand.derivedCommands.tileset = colorDerivedCommand;
  84776. }
  84777. primitive._pickCommandsDirty = false;
  84778. }
  84779. Vector3DTilePrimitive.prototype.createFeatures = function(content, features) {
  84780. const batchIds = this._batchIds;
  84781. const length3 = batchIds.length;
  84782. for (let i2 = 0; i2 < length3; ++i2) {
  84783. const batchId = batchIds[i2];
  84784. features[batchId] = new Cesium3DTileFeature_default(content, batchId);
  84785. }
  84786. };
  84787. Vector3DTilePrimitive.prototype.applyDebugSettings = function(enabled, color) {
  84788. this._highlightColor = enabled ? color : this._constantColor;
  84789. };
  84790. function clearStyle(polygons, features) {
  84791. polygons._updatingAllCommands = true;
  84792. const batchIds = polygons._batchIds;
  84793. let length3 = batchIds.length;
  84794. let i2;
  84795. for (i2 = 0; i2 < length3; ++i2) {
  84796. const batchId = batchIds[i2];
  84797. const feature2 = features[batchId];
  84798. feature2.show = true;
  84799. feature2.color = Color_default.WHITE;
  84800. }
  84801. const batchedIndices = polygons._batchedIndices;
  84802. length3 = batchedIndices.length;
  84803. for (i2 = 0; i2 < length3; ++i2) {
  84804. batchedIndices[i2].color = Color_default.clone(Color_default.WHITE);
  84805. }
  84806. polygons._updatingAllCommands = false;
  84807. polygons._batchDirty = true;
  84808. }
  84809. var scratchColor4 = new Color_default();
  84810. var DEFAULT_COLOR_VALUE2 = Color_default.WHITE;
  84811. var DEFAULT_SHOW_VALUE2 = true;
  84812. var complexExpressionReg = /\$/;
  84813. Vector3DTilePrimitive.prototype.applyStyle = function(style, features) {
  84814. if (!defined_default(style)) {
  84815. clearStyle(this, features);
  84816. return;
  84817. }
  84818. const colorExpression = style.color;
  84819. const isSimpleStyle = colorExpression instanceof Expression_default && !complexExpressionReg.test(colorExpression.expression);
  84820. this._updatingAllCommands = isSimpleStyle;
  84821. const batchIds = this._batchIds;
  84822. let length3 = batchIds.length;
  84823. let i2;
  84824. for (i2 = 0; i2 < length3; ++i2) {
  84825. const batchId = batchIds[i2];
  84826. const feature2 = features[batchId];
  84827. feature2.color = defined_default(style.color) ? style.color.evaluateColor(feature2, scratchColor4) : DEFAULT_COLOR_VALUE2;
  84828. feature2.show = defined_default(style.show) ? style.show.evaluate(feature2) : DEFAULT_SHOW_VALUE2;
  84829. }
  84830. if (isSimpleStyle) {
  84831. const batchedIndices = this._batchedIndices;
  84832. length3 = batchedIndices.length;
  84833. for (i2 = 0; i2 < length3; ++i2) {
  84834. batchedIndices[i2].color = Color_default.clone(Color_default.WHITE);
  84835. }
  84836. this._updatingAllCommands = false;
  84837. this._batchDirty = true;
  84838. }
  84839. };
  84840. Vector3DTilePrimitive.prototype.updateCommands = function(batchId, color) {
  84841. if (this._updatingAllCommands) {
  84842. return;
  84843. }
  84844. const batchIdLookUp = this._batchIdLookUp;
  84845. const index2 = batchIdLookUp[batchId];
  84846. if (!defined_default(index2)) {
  84847. return;
  84848. }
  84849. const indexOffsets = this._indexOffsets;
  84850. const indexCounts = this._indexCounts;
  84851. const offset2 = indexOffsets[index2];
  84852. const count = indexCounts[index2];
  84853. const batchedIndices = this._batchedIndices;
  84854. const length3 = batchedIndices.length;
  84855. let i2;
  84856. for (i2 = 0; i2 < length3; ++i2) {
  84857. const batchedOffset = batchedIndices[i2].offset;
  84858. const batchedCount = batchedIndices[i2].count;
  84859. if (offset2 >= batchedOffset && offset2 < batchedOffset + batchedCount) {
  84860. break;
  84861. }
  84862. }
  84863. batchedIndices.push(
  84864. new Vector3DTileBatch_default({
  84865. color: Color_default.clone(color),
  84866. offset: offset2,
  84867. count,
  84868. batchIds: [batchId]
  84869. })
  84870. );
  84871. const startIds = [];
  84872. const endIds = [];
  84873. const batchIds = batchedIndices[i2].batchIds;
  84874. const batchIdsLength = batchIds.length;
  84875. for (let j = 0; j < batchIdsLength; ++j) {
  84876. const id = batchIds[j];
  84877. if (id === batchId) {
  84878. continue;
  84879. }
  84880. const offsetIndex = batchIdLookUp[id];
  84881. if (indexOffsets[offsetIndex] < offset2) {
  84882. startIds.push(id);
  84883. } else {
  84884. endIds.push(id);
  84885. }
  84886. }
  84887. if (endIds.length !== 0) {
  84888. batchedIndices.push(
  84889. new Vector3DTileBatch_default({
  84890. color: Color_default.clone(batchedIndices[i2].color),
  84891. offset: offset2 + count,
  84892. count: batchedIndices[i2].offset + batchedIndices[i2].count - (offset2 + count),
  84893. batchIds: endIds
  84894. })
  84895. );
  84896. }
  84897. if (startIds.length !== 0) {
  84898. batchedIndices[i2].count = offset2 - batchedIndices[i2].offset;
  84899. batchedIndices[i2].batchIds = startIds;
  84900. } else {
  84901. batchedIndices.splice(i2, 1);
  84902. }
  84903. this._batchDirty = true;
  84904. };
  84905. function queueCommands(primitive, frameState, commands, commandsIgnoreShow) {
  84906. const classificationType = primitive.classificationType;
  84907. const queueTerrainCommands = classificationType !== ClassificationType_default.CESIUM_3D_TILE;
  84908. const queue3DTilesCommands = classificationType !== ClassificationType_default.TERRAIN;
  84909. const commandList = frameState.commandList;
  84910. let commandLength = commands.length;
  84911. let command;
  84912. let i2;
  84913. for (i2 = 0; i2 < commandLength; ++i2) {
  84914. if (queueTerrainCommands) {
  84915. command = commands[i2];
  84916. command.pass = Pass_default.TERRAIN_CLASSIFICATION;
  84917. commandList.push(command);
  84918. }
  84919. if (queue3DTilesCommands) {
  84920. command = commands[i2].derivedCommands.tileset;
  84921. command.pass = Pass_default.CESIUM_3D_TILE_CLASSIFICATION;
  84922. commandList.push(command);
  84923. }
  84924. }
  84925. if (!frameState.invertClassification || !defined_default(commandsIgnoreShow)) {
  84926. return;
  84927. }
  84928. commandLength = commandsIgnoreShow.length;
  84929. for (i2 = 0; i2 < commandLength; ++i2) {
  84930. commandList.push(commandsIgnoreShow[i2]);
  84931. }
  84932. }
  84933. function queueWireframeCommands(frameState, commands) {
  84934. const commandList = frameState.commandList;
  84935. const commandLength = commands.length;
  84936. for (let i2 = 0; i2 < commandLength; i2 += 2) {
  84937. const command = commands[i2 + 1];
  84938. command.pass = Pass_default.OPAQUE;
  84939. commandList.push(command);
  84940. }
  84941. }
  84942. function updateWireframe(primitive) {
  84943. let earlyExit = primitive.debugWireframe === primitive._debugWireframe;
  84944. earlyExit = earlyExit && !(primitive.debugWireframe && primitive._wireframeDirty);
  84945. if (earlyExit) {
  84946. return;
  84947. }
  84948. if (!defined_default(primitive._rsWireframe)) {
  84949. primitive._rsWireframe = RenderState_default.fromCache({});
  84950. }
  84951. let rs;
  84952. let type;
  84953. if (primitive.debugWireframe) {
  84954. rs = primitive._rsWireframe;
  84955. type = PrimitiveType_default.LINES;
  84956. } else {
  84957. rs = primitive._rsColorPass;
  84958. type = PrimitiveType_default.TRIANGLES;
  84959. }
  84960. const commands = primitive._commands;
  84961. const commandLength = commands.length;
  84962. for (let i2 = 0; i2 < commandLength; i2 += 2) {
  84963. const command = commands[i2 + 1];
  84964. command.renderState = rs;
  84965. command.primitiveType = type;
  84966. }
  84967. primitive._debugWireframe = primitive.debugWireframe;
  84968. primitive._wireframeDirty = false;
  84969. }
  84970. Vector3DTilePrimitive.prototype.update = function(frameState) {
  84971. const context = frameState.context;
  84972. createVertexArray3(this, context);
  84973. createShaders(this, context);
  84974. createRenderStates3(this);
  84975. createUniformMap(this, context);
  84976. const passes = frameState.passes;
  84977. if (passes.render) {
  84978. createColorCommands2(this, context);
  84979. createColorCommandsIgnoreShow(this, frameState);
  84980. updateWireframe(this);
  84981. if (this._debugWireframe) {
  84982. queueWireframeCommands(frameState, this._commands);
  84983. } else {
  84984. queueCommands(this, frameState, this._commands, this._commandsIgnoreShow);
  84985. }
  84986. }
  84987. if (passes.pick) {
  84988. createPickCommands2(this);
  84989. queueCommands(this, frameState, this._pickCommands);
  84990. }
  84991. };
  84992. Vector3DTilePrimitive.prototype.isDestroyed = function() {
  84993. return false;
  84994. };
  84995. Vector3DTilePrimitive.prototype.destroy = function() {
  84996. this._va = this._va && this._va.destroy();
  84997. this._sp = this._sp && this._sp.destroy();
  84998. this._spPick = this._spPick && this._spPick.destroy();
  84999. this._vaSwap = this._vaSwap && this._vaSwap.destroy();
  85000. return destroyObject_default(this);
  85001. };
  85002. var Vector3DTilePrimitive_default = Vector3DTilePrimitive;
  85003. // node_modules/cesium/Source/Scene/ClassificationModel.js
  85004. var boundingSphereCartesian3Scratch = new Cartesian3_default();
  85005. var ModelState = ModelUtility_default.ModelState;
  85006. function ClassificationModel(options) {
  85007. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  85008. let gltf = options.gltf;
  85009. if (gltf instanceof ArrayBuffer) {
  85010. gltf = new Uint8Array(gltf);
  85011. }
  85012. if (gltf instanceof Uint8Array) {
  85013. gltf = parseGlb_default(gltf);
  85014. updateVersion_default(gltf);
  85015. addDefaults_default(gltf);
  85016. processModelMaterialsCommon_default(gltf);
  85017. processPbrMaterials_default(gltf);
  85018. } else {
  85019. throw new RuntimeError_default("Only binary glTF is supported as a classifier.");
  85020. }
  85021. ForEach_default.buffer(gltf, function(buffer) {
  85022. if (!defined_default(buffer.extras._pipeline.source)) {
  85023. throw new RuntimeError_default(
  85024. "Buffer data must be embedded in the binary gltf."
  85025. );
  85026. }
  85027. });
  85028. const gltfNodes = gltf.nodes;
  85029. const gltfMeshes = gltf.meshes;
  85030. const gltfNode = gltfNodes[0];
  85031. const meshId = gltfNode.mesh;
  85032. if (gltfNodes.length !== 1 || !defined_default(meshId)) {
  85033. throw new RuntimeError_default(
  85034. "Only one node is supported for classification and it must have a mesh."
  85035. );
  85036. }
  85037. if (gltfMeshes.length !== 1) {
  85038. throw new RuntimeError_default(
  85039. "Only one mesh is supported when using b3dm for classification."
  85040. );
  85041. }
  85042. const gltfPrimitives = gltfMeshes[0].primitives;
  85043. if (gltfPrimitives.length !== 1) {
  85044. throw new RuntimeError_default(
  85045. "Only one primitive per mesh is supported when using b3dm for classification."
  85046. );
  85047. }
  85048. const gltfPositionAttribute = gltfPrimitives[0].attributes.POSITION;
  85049. if (!defined_default(gltfPositionAttribute)) {
  85050. throw new RuntimeError_default("The mesh must have a position attribute.");
  85051. }
  85052. const gltfBatchIdAttribute = gltfPrimitives[0].attributes._BATCHID;
  85053. if (!defined_default(gltfBatchIdAttribute)) {
  85054. throw new RuntimeError_default("The mesh must have a batch id attribute.");
  85055. }
  85056. this._gltf = gltf;
  85057. this.show = defaultValue_default(options.show, true);
  85058. this.modelMatrix = Matrix4_default.clone(
  85059. defaultValue_default(options.modelMatrix, Matrix4_default.IDENTITY)
  85060. );
  85061. this._modelMatrix = Matrix4_default.clone(this.modelMatrix);
  85062. this._ready = false;
  85063. this._readyPromise = defer_default();
  85064. this.debugShowBoundingVolume = defaultValue_default(
  85065. options.debugShowBoundingVolume,
  85066. false
  85067. );
  85068. this._debugShowBoundingVolume = false;
  85069. this.debugWireframe = defaultValue_default(options.debugWireframe, false);
  85070. this._debugWireframe = false;
  85071. this._classificationType = options.classificationType;
  85072. this._vertexShaderLoaded = options.vertexShaderLoaded;
  85073. this._classificationShaderLoaded = options.classificationShaderLoaded;
  85074. this._uniformMapLoaded = options.uniformMapLoaded;
  85075. this._pickIdLoaded = options.pickIdLoaded;
  85076. this._ignoreCommands = defaultValue_default(options.ignoreCommands, false);
  85077. this._upAxis = defaultValue_default(options.upAxis, Axis_default.Y);
  85078. this._batchTable = options.batchTable;
  85079. this._computedModelMatrix = new Matrix4_default();
  85080. this._initialRadius = void 0;
  85081. this._boundingSphere = void 0;
  85082. this._scaledBoundingSphere = new BoundingSphere_default();
  85083. this._state = ModelState.NEEDS_LOAD;
  85084. this._loadResources = void 0;
  85085. this._mode = void 0;
  85086. this._dirty = false;
  85087. this._nodeMatrix = new Matrix4_default();
  85088. this._primitive = void 0;
  85089. this._extensionsUsed = void 0;
  85090. this._extensionsRequired = void 0;
  85091. this._quantizedUniforms = void 0;
  85092. this._buffers = {};
  85093. this._vertexArray = void 0;
  85094. this._shaderProgram = void 0;
  85095. this._uniformMap = void 0;
  85096. this._geometryByteLength = 0;
  85097. this._trianglesLength = 0;
  85098. this._rtcCenter = void 0;
  85099. this._rtcCenterEye = void 0;
  85100. this._rtcCenter3D = void 0;
  85101. this._rtcCenter2D = void 0;
  85102. }
  85103. Object.defineProperties(ClassificationModel.prototype, {
  85104. gltf: {
  85105. get: function() {
  85106. return this._gltf;
  85107. }
  85108. },
  85109. boundingSphere: {
  85110. get: function() {
  85111. if (this._state !== ModelState.LOADED) {
  85112. throw new DeveloperError_default(
  85113. "The model is not loaded. Use ClassificationModel.readyPromise or wait for ClassificationModel.ready to be true."
  85114. );
  85115. }
  85116. const modelMatrix = this.modelMatrix;
  85117. const nonUniformScale = Matrix4_default.getScale(
  85118. modelMatrix,
  85119. boundingSphereCartesian3Scratch
  85120. );
  85121. const scaledBoundingSphere = this._scaledBoundingSphere;
  85122. scaledBoundingSphere.center = Cartesian3_default.multiplyComponents(
  85123. this._boundingSphere.center,
  85124. nonUniformScale,
  85125. scaledBoundingSphere.center
  85126. );
  85127. scaledBoundingSphere.radius = Cartesian3_default.maximumComponent(nonUniformScale) * this._initialRadius;
  85128. if (defined_default(this._rtcCenter)) {
  85129. Cartesian3_default.add(
  85130. this._rtcCenter,
  85131. scaledBoundingSphere.center,
  85132. scaledBoundingSphere.center
  85133. );
  85134. }
  85135. return scaledBoundingSphere;
  85136. }
  85137. },
  85138. ready: {
  85139. get: function() {
  85140. return this._ready;
  85141. }
  85142. },
  85143. readyPromise: {
  85144. get: function() {
  85145. return this._readyPromise.promise;
  85146. }
  85147. },
  85148. dirty: {
  85149. get: function() {
  85150. return this._dirty;
  85151. }
  85152. },
  85153. extensionsUsed: {
  85154. get: function() {
  85155. if (!defined_default(this._extensionsUsed)) {
  85156. this._extensionsUsed = ModelUtility_default.getUsedExtensions(this.gltf);
  85157. }
  85158. return this._extensionsUsed;
  85159. }
  85160. },
  85161. extensionsRequired: {
  85162. get: function() {
  85163. if (!defined_default(this._extensionsRequired)) {
  85164. this._extensionsRequired = ModelUtility_default.getRequiredExtensions(
  85165. this.gltf
  85166. );
  85167. }
  85168. return this._extensionsRequired;
  85169. }
  85170. },
  85171. upAxis: {
  85172. get: function() {
  85173. return this._upAxis;
  85174. }
  85175. },
  85176. trianglesLength: {
  85177. get: function() {
  85178. return this._trianglesLength;
  85179. }
  85180. },
  85181. geometryByteLength: {
  85182. get: function() {
  85183. return this._geometryByteLength;
  85184. }
  85185. },
  85186. texturesByteLength: {
  85187. get: function() {
  85188. return 0;
  85189. }
  85190. },
  85191. classificationType: {
  85192. get: function() {
  85193. return this._classificationType;
  85194. }
  85195. }
  85196. });
  85197. function addBuffersToLoadResources(model) {
  85198. const gltf = model.gltf;
  85199. const loadResources = model._loadResources;
  85200. ForEach_default.buffer(gltf, function(buffer, id) {
  85201. loadResources.buffers[id] = buffer.extras._pipeline.source;
  85202. });
  85203. }
  85204. function parseBufferViews(model) {
  85205. const bufferViews = model.gltf.bufferViews;
  85206. const vertexBuffersToCreate = model._loadResources.vertexBuffersToCreate;
  85207. ForEach_default.bufferView(model.gltf, function(bufferView, id) {
  85208. if (bufferView.target === WebGLConstants_default.ARRAY_BUFFER) {
  85209. vertexBuffersToCreate.enqueue(id);
  85210. }
  85211. });
  85212. const indexBuffersToCreate = model._loadResources.indexBuffersToCreate;
  85213. const indexBufferIds = {};
  85214. ForEach_default.accessor(model.gltf, function(accessor) {
  85215. const bufferViewId = accessor.bufferView;
  85216. const bufferView = bufferViews[bufferViewId];
  85217. if (bufferView.target === WebGLConstants_default.ELEMENT_ARRAY_BUFFER && !defined_default(indexBufferIds[bufferViewId])) {
  85218. indexBufferIds[bufferViewId] = true;
  85219. indexBuffersToCreate.enqueue({
  85220. id: bufferViewId,
  85221. componentType: accessor.componentType
  85222. });
  85223. }
  85224. });
  85225. }
  85226. function createVertexBuffer(bufferViewId, model) {
  85227. const loadResources = model._loadResources;
  85228. const bufferViews = model.gltf.bufferViews;
  85229. const bufferView = bufferViews[bufferViewId];
  85230. const vertexBuffer = loadResources.getBuffer(bufferView);
  85231. model._buffers[bufferViewId] = vertexBuffer;
  85232. model._geometryByteLength += vertexBuffer.byteLength;
  85233. }
  85234. function createIndexBuffer(bufferViewId, componentType, model) {
  85235. const loadResources = model._loadResources;
  85236. const bufferViews = model.gltf.bufferViews;
  85237. const bufferView = bufferViews[bufferViewId];
  85238. const indexBuffer = {
  85239. typedArray: loadResources.getBuffer(bufferView),
  85240. indexDatatype: componentType
  85241. };
  85242. model._buffers[bufferViewId] = indexBuffer;
  85243. model._geometryByteLength += indexBuffer.typedArray.byteLength;
  85244. }
  85245. function createBuffers(model) {
  85246. const loadResources = model._loadResources;
  85247. if (loadResources.pendingBufferLoads !== 0) {
  85248. return;
  85249. }
  85250. const vertexBuffersToCreate = loadResources.vertexBuffersToCreate;
  85251. const indexBuffersToCreate = loadResources.indexBuffersToCreate;
  85252. while (vertexBuffersToCreate.length > 0) {
  85253. createVertexBuffer(vertexBuffersToCreate.dequeue(), model);
  85254. }
  85255. while (indexBuffersToCreate.length > 0) {
  85256. const i2 = indexBuffersToCreate.dequeue();
  85257. createIndexBuffer(i2.id, i2.componentType, model);
  85258. }
  85259. }
  85260. function modifyShaderForQuantizedAttributes(shader, model) {
  85261. const primitive = model.gltf.meshes[0].primitives[0];
  85262. const result = ModelUtility_default.modifyShaderForQuantizedAttributes(
  85263. model.gltf,
  85264. primitive,
  85265. shader
  85266. );
  85267. model._quantizedUniforms = result.uniforms;
  85268. return result.shader;
  85269. }
  85270. function modifyShader(shader, callback) {
  85271. if (defined_default(callback)) {
  85272. shader = callback(shader);
  85273. }
  85274. return shader;
  85275. }
  85276. function createProgram(model) {
  85277. const gltf = model.gltf;
  85278. const positionName = ModelUtility_default.getAttributeOrUniformBySemantic(
  85279. gltf,
  85280. "POSITION"
  85281. );
  85282. const batchIdName = ModelUtility_default.getAttributeOrUniformBySemantic(
  85283. gltf,
  85284. "_BATCHID"
  85285. );
  85286. const attributeLocations8 = {};
  85287. attributeLocations8[positionName] = 0;
  85288. attributeLocations8[batchIdName] = 1;
  85289. const modelViewProjectionName = ModelUtility_default.getAttributeOrUniformBySemantic(
  85290. gltf,
  85291. "MODELVIEWPROJECTION"
  85292. );
  85293. let uniformDecl;
  85294. let toClip;
  85295. if (!defined_default(modelViewProjectionName)) {
  85296. const projectionName = ModelUtility_default.getAttributeOrUniformBySemantic(
  85297. gltf,
  85298. "PROJECTION"
  85299. );
  85300. let modelViewName = ModelUtility_default.getAttributeOrUniformBySemantic(
  85301. gltf,
  85302. "MODELVIEW"
  85303. );
  85304. if (!defined_default(modelViewName)) {
  85305. modelViewName = ModelUtility_default.getAttributeOrUniformBySemantic(
  85306. gltf,
  85307. "CESIUM_RTC_MODELVIEW"
  85308. );
  85309. }
  85310. uniformDecl = `uniform mat4 ${modelViewName};
  85311. uniform mat4 ${projectionName};
  85312. `;
  85313. toClip = `${projectionName} * ${modelViewName} * vec4(${positionName}, 1.0)`;
  85314. } else {
  85315. uniformDecl = `uniform mat4 ${modelViewProjectionName};
  85316. `;
  85317. toClip = `${modelViewProjectionName} * vec4(${positionName}, 1.0)`;
  85318. }
  85319. const computePosition = ` vec4 positionInClipCoords = ${toClip};
  85320. `;
  85321. let vs = `attribute vec3 ${positionName};
  85322. attribute float ${batchIdName};
  85323. ${uniformDecl}void main() {
  85324. ${computePosition} gl_Position = czm_depthClamp(positionInClipCoords);
  85325. }
  85326. `;
  85327. const fs = "#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\nvoid main() \n{ \n gl_FragColor = vec4(1.0); \n czm_writeDepthClamp();\n}\n";
  85328. if (model.extensionsUsed.WEB3D_quantized_attributes) {
  85329. vs = modifyShaderForQuantizedAttributes(vs, model);
  85330. }
  85331. const drawVS = modifyShader(vs, model._vertexShaderLoaded);
  85332. const drawFS = modifyShader(fs, model._classificationShaderLoaded);
  85333. model._shaderProgram = {
  85334. vertexShaderSource: drawVS,
  85335. fragmentShaderSource: drawFS,
  85336. attributeLocations: attributeLocations8
  85337. };
  85338. }
  85339. function getAttributeLocations() {
  85340. return {
  85341. POSITION: 0,
  85342. _BATCHID: 1
  85343. };
  85344. }
  85345. function createVertexArray4(model) {
  85346. const loadResources = model._loadResources;
  85347. if (!loadResources.finishedBuffersCreation() || defined_default(model._vertexArray)) {
  85348. return;
  85349. }
  85350. const rendererBuffers = model._buffers;
  85351. const gltf = model.gltf;
  85352. const accessors = gltf.accessors;
  85353. const meshes = gltf.meshes;
  85354. const primitives = meshes[0].primitives;
  85355. const primitive = primitives[0];
  85356. const attributeLocations8 = getAttributeLocations();
  85357. const attributes = {};
  85358. ForEach_default.meshPrimitiveAttribute(primitive, function(accessorId, attributeName) {
  85359. const attributeLocation = attributeLocations8[attributeName];
  85360. if (defined_default(attributeLocation)) {
  85361. const a4 = accessors[accessorId];
  85362. attributes[attributeName] = {
  85363. index: attributeLocation,
  85364. vertexBuffer: rendererBuffers[a4.bufferView],
  85365. componentsPerAttribute: numberOfComponentsForType_default(a4.type),
  85366. componentDatatype: a4.componentType,
  85367. offsetInBytes: a4.byteOffset,
  85368. strideInBytes: getAccessorByteStride_default(gltf, a4)
  85369. };
  85370. }
  85371. });
  85372. let indexBuffer;
  85373. if (defined_default(primitive.indices)) {
  85374. const accessor = accessors[primitive.indices];
  85375. indexBuffer = rendererBuffers[accessor.bufferView];
  85376. }
  85377. model._vertexArray = {
  85378. attributes,
  85379. indexBuffer
  85380. };
  85381. }
  85382. var gltfSemanticUniforms2 = {
  85383. PROJECTION: function(uniformState, model) {
  85384. return ModelUtility_default.getGltfSemanticUniforms().PROJECTION(
  85385. uniformState,
  85386. model
  85387. );
  85388. },
  85389. MODELVIEW: function(uniformState, model) {
  85390. return ModelUtility_default.getGltfSemanticUniforms().MODELVIEW(
  85391. uniformState,
  85392. model
  85393. );
  85394. },
  85395. CESIUM_RTC_MODELVIEW: function(uniformState, model) {
  85396. return ModelUtility_default.getGltfSemanticUniforms().CESIUM_RTC_MODELVIEW(
  85397. uniformState,
  85398. model
  85399. );
  85400. },
  85401. MODELVIEWPROJECTION: function(uniformState, model) {
  85402. return ModelUtility_default.getGltfSemanticUniforms().MODELVIEWPROJECTION(
  85403. uniformState,
  85404. model
  85405. );
  85406. }
  85407. };
  85408. function createUniformMap2(model, context) {
  85409. if (defined_default(model._uniformMap)) {
  85410. return;
  85411. }
  85412. const uniformMap2 = {};
  85413. ForEach_default.technique(model.gltf, function(technique) {
  85414. ForEach_default.techniqueUniform(technique, function(uniform, uniformName) {
  85415. if (!defined_default(uniform.semantic) || !defined_default(gltfSemanticUniforms2[uniform.semantic])) {
  85416. return;
  85417. }
  85418. uniformMap2[uniformName] = gltfSemanticUniforms2[uniform.semantic](
  85419. context.uniformState,
  85420. model
  85421. );
  85422. });
  85423. });
  85424. model._uniformMap = uniformMap2;
  85425. }
  85426. function createUniformsForQuantizedAttributes(model, primitive) {
  85427. return ModelUtility_default.createUniformsForQuantizedAttributes(
  85428. model.gltf,
  85429. primitive,
  85430. model._quantizedUniforms
  85431. );
  85432. }
  85433. function triangleCountFromPrimitiveIndices(primitive, indicesCount) {
  85434. switch (primitive.mode) {
  85435. case PrimitiveType_default.TRIANGLES:
  85436. return indicesCount / 3;
  85437. case PrimitiveType_default.TRIANGLE_STRIP:
  85438. case PrimitiveType_default.TRIANGLE_FAN:
  85439. return Math.max(indicesCount - 2, 0);
  85440. default:
  85441. return 0;
  85442. }
  85443. }
  85444. function createPrimitive(model) {
  85445. const batchTable = model._batchTable;
  85446. let uniformMap2 = model._uniformMap;
  85447. const vertexArray = model._vertexArray;
  85448. const gltf = model.gltf;
  85449. const accessors = gltf.accessors;
  85450. const gltfMeshes = gltf.meshes;
  85451. const primitive = gltfMeshes[0].primitives[0];
  85452. const ix = accessors[primitive.indices];
  85453. const positionAccessor = primitive.attributes.POSITION;
  85454. const minMax = ModelUtility_default.getAccessorMinMax(gltf, positionAccessor);
  85455. const boundingSphere = BoundingSphere_default.fromCornerPoints(
  85456. Cartesian3_default.fromArray(minMax.min),
  85457. Cartesian3_default.fromArray(minMax.max)
  85458. );
  85459. let offset2;
  85460. let count;
  85461. if (defined_default(ix)) {
  85462. count = ix.count;
  85463. offset2 = ix.byteOffset / IndexDatatype_default.getSizeInBytes(ix.componentType);
  85464. } else {
  85465. const positions = accessors[primitive.attributes.POSITION];
  85466. count = positions.count;
  85467. offset2 = 0;
  85468. }
  85469. model._trianglesLength += triangleCountFromPrimitiveIndices(primitive, count);
  85470. if (defined_default(model._uniformMapLoaded)) {
  85471. uniformMap2 = model._uniformMapLoaded(uniformMap2);
  85472. }
  85473. if (model.extensionsUsed.WEB3D_quantized_attributes) {
  85474. const quantizedUniformMap = createUniformsForQuantizedAttributes(
  85475. model,
  85476. primitive
  85477. );
  85478. uniformMap2 = combine_default(uniformMap2, quantizedUniformMap);
  85479. }
  85480. let attribute = vertexArray.attributes.POSITION;
  85481. let componentDatatype = attribute.componentDatatype;
  85482. let typedArray = attribute.vertexBuffer;
  85483. let byteOffset = typedArray.byteOffset;
  85484. let bufferLength = typedArray.byteLength / ComponentDatatype_default.getSizeInBytes(componentDatatype);
  85485. let positionsBuffer = ComponentDatatype_default.createArrayBufferView(
  85486. componentDatatype,
  85487. typedArray.buffer,
  85488. byteOffset,
  85489. bufferLength
  85490. );
  85491. attribute = vertexArray.attributes._BATCHID;
  85492. componentDatatype = attribute.componentDatatype;
  85493. typedArray = attribute.vertexBuffer;
  85494. byteOffset = typedArray.byteOffset;
  85495. bufferLength = typedArray.byteLength / ComponentDatatype_default.getSizeInBytes(componentDatatype);
  85496. let vertexBatchIds = ComponentDatatype_default.createArrayBufferView(
  85497. componentDatatype,
  85498. typedArray.buffer,
  85499. byteOffset,
  85500. bufferLength
  85501. );
  85502. const buffer = vertexArray.indexBuffer.typedArray;
  85503. let indices2;
  85504. if (vertexArray.indexBuffer.indexDatatype === IndexDatatype_default.UNSIGNED_SHORT) {
  85505. indices2 = new Uint16Array(
  85506. buffer.buffer,
  85507. buffer.byteOffset,
  85508. buffer.byteLength / Uint16Array.BYTES_PER_ELEMENT
  85509. );
  85510. } else {
  85511. indices2 = new Uint32Array(
  85512. buffer.buffer,
  85513. buffer.byteOffset,
  85514. buffer.byteLength / Uint32Array.BYTES_PER_ELEMENT
  85515. );
  85516. }
  85517. positionsBuffer = arraySlice_default(positionsBuffer);
  85518. vertexBatchIds = arraySlice_default(vertexBatchIds);
  85519. indices2 = arraySlice_default(indices2, offset2, offset2 + count);
  85520. const batchIds = [];
  85521. const indexCounts = [];
  85522. const indexOffsets = [];
  85523. const batchedIndices = [];
  85524. let currentId2 = vertexBatchIds[indices2[0]];
  85525. batchIds.push(currentId2);
  85526. indexOffsets.push(0);
  85527. let batchId;
  85528. let indexOffset;
  85529. let indexCount;
  85530. const indicesLength = indices2.length;
  85531. for (let j = 1; j < indicesLength; ++j) {
  85532. batchId = vertexBatchIds[indices2[j]];
  85533. if (batchId !== currentId2) {
  85534. indexOffset = indexOffsets[indexOffsets.length - 1];
  85535. indexCount = j - indexOffset;
  85536. batchIds.push(batchId);
  85537. indexCounts.push(indexCount);
  85538. indexOffsets.push(j);
  85539. batchedIndices.push(
  85540. new Vector3DTileBatch_default({
  85541. offset: indexOffset,
  85542. count: indexCount,
  85543. batchIds: [currentId2],
  85544. color: Color_default.WHITE
  85545. })
  85546. );
  85547. currentId2 = batchId;
  85548. }
  85549. }
  85550. indexOffset = indexOffsets[indexOffsets.length - 1];
  85551. indexCount = indicesLength - indexOffset;
  85552. indexCounts.push(indexCount);
  85553. batchedIndices.push(
  85554. new Vector3DTileBatch_default({
  85555. offset: indexOffset,
  85556. count: indexCount,
  85557. batchIds: [currentId2],
  85558. color: Color_default.WHITE
  85559. })
  85560. );
  85561. const shader = model._shaderProgram;
  85562. const vertexShaderSource = shader.vertexShaderSource;
  85563. const fragmentShaderSource = shader.fragmentShaderSource;
  85564. const attributeLocations8 = shader.attributeLocations;
  85565. const pickId = defined_default(model._pickIdLoaded) ? model._pickIdLoaded() : void 0;
  85566. model._primitive = new Vector3DTilePrimitive_default({
  85567. classificationType: model._classificationType,
  85568. positions: positionsBuffer,
  85569. indices: indices2,
  85570. indexOffsets,
  85571. indexCounts,
  85572. batchIds,
  85573. vertexBatchIds,
  85574. batchedIndices,
  85575. batchTable,
  85576. boundingVolume: new BoundingSphere_default(),
  85577. _vertexShaderSource: vertexShaderSource,
  85578. _fragmentShaderSource: fragmentShaderSource,
  85579. _attributeLocations: attributeLocations8,
  85580. _uniformMap: uniformMap2,
  85581. _pickId: pickId,
  85582. _modelMatrix: new Matrix4_default(),
  85583. _boundingSphere: boundingSphere
  85584. });
  85585. model._buffers = void 0;
  85586. model._vertexArray = void 0;
  85587. model._shaderProgram = void 0;
  85588. model._uniformMap = void 0;
  85589. }
  85590. function createRuntimeNodes(model) {
  85591. const loadResources = model._loadResources;
  85592. if (!loadResources.finished()) {
  85593. return;
  85594. }
  85595. if (defined_default(model._primitive)) {
  85596. return;
  85597. }
  85598. const gltf = model.gltf;
  85599. const nodes = gltf.nodes;
  85600. const gltfNode = nodes[0];
  85601. model._nodeMatrix = ModelUtility_default.getTransform(gltfNode, model._nodeMatrix);
  85602. createPrimitive(model);
  85603. }
  85604. function createResources(model, frameState) {
  85605. const context = frameState.context;
  85606. ModelUtility_default.checkSupportedGlExtensions(model.gltf.glExtensionsUsed, context);
  85607. createBuffers(model);
  85608. createProgram(model);
  85609. createVertexArray4(model);
  85610. createUniformMap2(model, context);
  85611. createRuntimeNodes(model);
  85612. }
  85613. var scratchComputedTranslation = new Cartesian4_default();
  85614. var scratchComputedMatrixIn2D = new Matrix4_default();
  85615. function updateNodeModelMatrix(model, modelTransformChanged, justLoaded, projection) {
  85616. let computedModelMatrix = model._computedModelMatrix;
  85617. if (model._mode !== SceneMode_default.SCENE3D && !model._ignoreCommands) {
  85618. const translation3 = Matrix4_default.getColumn(
  85619. computedModelMatrix,
  85620. 3,
  85621. scratchComputedTranslation
  85622. );
  85623. if (!Cartesian4_default.equals(translation3, Cartesian4_default.UNIT_W)) {
  85624. computedModelMatrix = Transforms_default.basisTo2D(
  85625. projection,
  85626. computedModelMatrix,
  85627. scratchComputedMatrixIn2D
  85628. );
  85629. model._rtcCenter = model._rtcCenter3D;
  85630. } else {
  85631. const center = model.boundingSphere.center;
  85632. const to2D = Transforms_default.wgs84To2DModelMatrix(
  85633. projection,
  85634. center,
  85635. scratchComputedMatrixIn2D
  85636. );
  85637. computedModelMatrix = Matrix4_default.multiply(
  85638. to2D,
  85639. computedModelMatrix,
  85640. scratchComputedMatrixIn2D
  85641. );
  85642. if (defined_default(model._rtcCenter)) {
  85643. Matrix4_default.setTranslation(
  85644. computedModelMatrix,
  85645. Cartesian4_default.UNIT_W,
  85646. computedModelMatrix
  85647. );
  85648. model._rtcCenter = model._rtcCenter2D;
  85649. }
  85650. }
  85651. }
  85652. const primitive = model._primitive;
  85653. if (modelTransformChanged || justLoaded) {
  85654. Matrix4_default.multiplyTransformation(
  85655. computedModelMatrix,
  85656. model._nodeMatrix,
  85657. primitive._modelMatrix
  85658. );
  85659. BoundingSphere_default.transform(
  85660. primitive._boundingSphere,
  85661. primitive._modelMatrix,
  85662. primitive._boundingVolume
  85663. );
  85664. if (defined_default(model._rtcCenter)) {
  85665. Cartesian3_default.add(
  85666. model._rtcCenter,
  85667. primitive._boundingVolume.center,
  85668. primitive._boundingVolume.center
  85669. );
  85670. }
  85671. }
  85672. }
  85673. ClassificationModel.prototype.updateCommands = function(batchId, color) {
  85674. this._primitive.updateCommands(batchId, color);
  85675. };
  85676. ClassificationModel.prototype.update = function(frameState) {
  85677. if (frameState.mode === SceneMode_default.MORPHING) {
  85678. return;
  85679. }
  85680. if (!FeatureDetection_default.supportsWebP.initialized) {
  85681. FeatureDetection_default.supportsWebP.initialize();
  85682. return;
  85683. }
  85684. const supportsWebP2 = FeatureDetection_default.supportsWebP();
  85685. if (this._state === ModelState.NEEDS_LOAD && defined_default(this.gltf)) {
  85686. this._state = ModelState.LOADING;
  85687. if (this._state !== ModelState.FAILED) {
  85688. const extensions = this.gltf.extensions;
  85689. if (defined_default(extensions) && defined_default(extensions.CESIUM_RTC)) {
  85690. const center = Cartesian3_default.fromArray(extensions.CESIUM_RTC.center);
  85691. if (!Cartesian3_default.equals(center, Cartesian3_default.ZERO)) {
  85692. this._rtcCenter3D = center;
  85693. const projection = frameState.mapProjection;
  85694. const ellipsoid = projection.ellipsoid;
  85695. const cartographic2 = ellipsoid.cartesianToCartographic(
  85696. this._rtcCenter3D
  85697. );
  85698. const projectedCart = projection.project(cartographic2);
  85699. Cartesian3_default.fromElements(
  85700. projectedCart.z,
  85701. projectedCart.x,
  85702. projectedCart.y,
  85703. projectedCart
  85704. );
  85705. this._rtcCenter2D = projectedCart;
  85706. this._rtcCenterEye = new Cartesian3_default();
  85707. this._rtcCenter = this._rtcCenter3D;
  85708. }
  85709. }
  85710. this._loadResources = new ModelLoadResources_default();
  85711. ModelUtility_default.parseBuffers(this);
  85712. }
  85713. }
  85714. const loadResources = this._loadResources;
  85715. let justLoaded = false;
  85716. if (this._state === ModelState.LOADING) {
  85717. if (loadResources.pendingBufferLoads === 0) {
  85718. ModelUtility_default.checkSupportedExtensions(
  85719. this.extensionsRequired,
  85720. supportsWebP2
  85721. );
  85722. addBuffersToLoadResources(this);
  85723. parseBufferViews(this);
  85724. this._boundingSphere = ModelUtility_default.computeBoundingSphere(this);
  85725. this._initialRadius = this._boundingSphere.radius;
  85726. createResources(this, frameState);
  85727. }
  85728. if (loadResources.finished()) {
  85729. this._state = ModelState.LOADED;
  85730. justLoaded = true;
  85731. }
  85732. }
  85733. if (defined_default(loadResources) && this._state === ModelState.LOADED) {
  85734. if (!justLoaded) {
  85735. createResources(this, frameState);
  85736. }
  85737. if (loadResources.finished()) {
  85738. this._loadResources = void 0;
  85739. }
  85740. }
  85741. const show = this.show;
  85742. if (show && this._state === ModelState.LOADED || justLoaded) {
  85743. this._dirty = false;
  85744. const modelMatrix = this.modelMatrix;
  85745. const modeChanged = frameState.mode !== this._mode;
  85746. this._mode = frameState.mode;
  85747. const modelTransformChanged = !Matrix4_default.equals(this._modelMatrix, modelMatrix) || modeChanged;
  85748. if (modelTransformChanged || justLoaded) {
  85749. Matrix4_default.clone(modelMatrix, this._modelMatrix);
  85750. const computedModelMatrix = this._computedModelMatrix;
  85751. Matrix4_default.clone(modelMatrix, computedModelMatrix);
  85752. if (this._upAxis === Axis_default.Y) {
  85753. Matrix4_default.multiplyTransformation(
  85754. computedModelMatrix,
  85755. Axis_default.Y_UP_TO_Z_UP,
  85756. computedModelMatrix
  85757. );
  85758. } else if (this._upAxis === Axis_default.X) {
  85759. Matrix4_default.multiplyTransformation(
  85760. computedModelMatrix,
  85761. Axis_default.X_UP_TO_Z_UP,
  85762. computedModelMatrix
  85763. );
  85764. }
  85765. }
  85766. if (modelTransformChanged || justLoaded) {
  85767. updateNodeModelMatrix(
  85768. this,
  85769. modelTransformChanged,
  85770. justLoaded,
  85771. frameState.mapProjection
  85772. );
  85773. this._dirty = true;
  85774. }
  85775. }
  85776. if (justLoaded) {
  85777. const model = this;
  85778. frameState.afterRender.push(function() {
  85779. model._ready = true;
  85780. model._readyPromise.resolve(model);
  85781. });
  85782. return;
  85783. }
  85784. if (show && !this._ignoreCommands) {
  85785. this._primitive.debugShowBoundingVolume = this.debugShowBoundingVolume;
  85786. this._primitive.debugWireframe = this.debugWireframe;
  85787. this._primitive.update(frameState);
  85788. }
  85789. };
  85790. ClassificationModel.prototype.isDestroyed = function() {
  85791. return false;
  85792. };
  85793. ClassificationModel.prototype.destroy = function() {
  85794. this._primitive = this._primitive && this._primitive.destroy();
  85795. return destroyObject_default(this);
  85796. };
  85797. var ClassificationModel_default = ClassificationModel;
  85798. // node_modules/cesium/Source/Scene/ClippingPlane.js
  85799. function ClippingPlane(normal2, distance2) {
  85800. Check_default.typeOf.object("normal", normal2);
  85801. Check_default.typeOf.number("distance", distance2);
  85802. this._distance = distance2;
  85803. this._normal = new UpdateChangedCartesian3(normal2, this);
  85804. this.onChangeCallback = void 0;
  85805. this.index = -1;
  85806. }
  85807. Object.defineProperties(ClippingPlane.prototype, {
  85808. distance: {
  85809. get: function() {
  85810. return this._distance;
  85811. },
  85812. set: function(value) {
  85813. Check_default.typeOf.number("value", value);
  85814. if (defined_default(this.onChangeCallback) && value !== this._distance) {
  85815. this.onChangeCallback(this.index);
  85816. }
  85817. this._distance = value;
  85818. }
  85819. },
  85820. normal: {
  85821. get: function() {
  85822. return this._normal;
  85823. },
  85824. set: function(value) {
  85825. Check_default.typeOf.object("value", value);
  85826. if (defined_default(this.onChangeCallback) && !Cartesian3_default.equals(this._normal._cartesian3, value)) {
  85827. this.onChangeCallback(this.index);
  85828. }
  85829. Cartesian3_default.clone(value, this._normal._cartesian3);
  85830. }
  85831. }
  85832. });
  85833. ClippingPlane.fromPlane = function(plane, result) {
  85834. Check_default.typeOf.object("plane", plane);
  85835. if (!defined_default(result)) {
  85836. result = new ClippingPlane(plane.normal, plane.distance);
  85837. } else {
  85838. result.normal = plane.normal;
  85839. result.distance = plane.distance;
  85840. }
  85841. return result;
  85842. };
  85843. ClippingPlane.clone = function(clippingPlane, result) {
  85844. if (!defined_default(result)) {
  85845. return new ClippingPlane(clippingPlane.normal, clippingPlane.distance);
  85846. }
  85847. result.normal = clippingPlane.normal;
  85848. result.distance = clippingPlane.distance;
  85849. return result;
  85850. };
  85851. function UpdateChangedCartesian3(normal2, clippingPlane) {
  85852. this._clippingPlane = clippingPlane;
  85853. this._cartesian3 = Cartesian3_default.clone(normal2);
  85854. }
  85855. Object.defineProperties(UpdateChangedCartesian3.prototype, {
  85856. x: {
  85857. get: function() {
  85858. return this._cartesian3.x;
  85859. },
  85860. set: function(value) {
  85861. Check_default.typeOf.number("value", value);
  85862. if (defined_default(this._clippingPlane.onChangeCallback) && value !== this._cartesian3.x) {
  85863. this._clippingPlane.onChangeCallback(this._clippingPlane.index);
  85864. }
  85865. this._cartesian3.x = value;
  85866. }
  85867. },
  85868. y: {
  85869. get: function() {
  85870. return this._cartesian3.y;
  85871. },
  85872. set: function(value) {
  85873. Check_default.typeOf.number("value", value);
  85874. if (defined_default(this._clippingPlane.onChangeCallback) && value !== this._cartesian3.y) {
  85875. this._clippingPlane.onChangeCallback(this._clippingPlane.index);
  85876. }
  85877. this._cartesian3.y = value;
  85878. }
  85879. },
  85880. z: {
  85881. get: function() {
  85882. return this._cartesian3.z;
  85883. },
  85884. set: function(value) {
  85885. Check_default.typeOf.number("value", value);
  85886. if (defined_default(this._clippingPlane.onChangeCallback) && value !== this._cartesian3.z) {
  85887. this._clippingPlane.onChangeCallback(this._clippingPlane.index);
  85888. }
  85889. this._cartesian3.z = value;
  85890. }
  85891. }
  85892. });
  85893. var ClippingPlane_default = ClippingPlane;
  85894. // node_modules/cesium/Source/Scene/ClippingPlaneCollection.js
  85895. function ClippingPlaneCollection(options) {
  85896. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  85897. this._planes = [];
  85898. this._dirtyIndex = -1;
  85899. this._multipleDirtyPlanes = false;
  85900. this._enabled = defaultValue_default(options.enabled, true);
  85901. this.modelMatrix = Matrix4_default.clone(
  85902. defaultValue_default(options.modelMatrix, Matrix4_default.IDENTITY)
  85903. );
  85904. this.edgeColor = Color_default.clone(defaultValue_default(options.edgeColor, Color_default.WHITE));
  85905. this.edgeWidth = defaultValue_default(options.edgeWidth, 0);
  85906. this.planeAdded = new Event_default();
  85907. this.planeRemoved = new Event_default();
  85908. this._owner = void 0;
  85909. const unionClippingRegions = defaultValue_default(
  85910. options.unionClippingRegions,
  85911. false
  85912. );
  85913. this._unionClippingRegions = unionClippingRegions;
  85914. this._testIntersection = unionClippingRegions ? unionIntersectFunction : defaultIntersectFunction;
  85915. this._uint8View = void 0;
  85916. this._float32View = void 0;
  85917. this._clippingPlanesTexture = void 0;
  85918. const planes = options.planes;
  85919. if (defined_default(planes)) {
  85920. const planesLength = planes.length;
  85921. for (let i2 = 0; i2 < planesLength; ++i2) {
  85922. this.add(planes[i2]);
  85923. }
  85924. }
  85925. }
  85926. function unionIntersectFunction(value) {
  85927. return value === Intersect_default.OUTSIDE;
  85928. }
  85929. function defaultIntersectFunction(value) {
  85930. return value === Intersect_default.INSIDE;
  85931. }
  85932. Object.defineProperties(ClippingPlaneCollection.prototype, {
  85933. length: {
  85934. get: function() {
  85935. return this._planes.length;
  85936. }
  85937. },
  85938. unionClippingRegions: {
  85939. get: function() {
  85940. return this._unionClippingRegions;
  85941. },
  85942. set: function(value) {
  85943. if (this._unionClippingRegions === value) {
  85944. return;
  85945. }
  85946. this._unionClippingRegions = value;
  85947. this._testIntersection = value ? unionIntersectFunction : defaultIntersectFunction;
  85948. }
  85949. },
  85950. enabled: {
  85951. get: function() {
  85952. return this._enabled;
  85953. },
  85954. set: function(value) {
  85955. if (this._enabled === value) {
  85956. return;
  85957. }
  85958. this._enabled = value;
  85959. }
  85960. },
  85961. texture: {
  85962. get: function() {
  85963. return this._clippingPlanesTexture;
  85964. }
  85965. },
  85966. owner: {
  85967. get: function() {
  85968. return this._owner;
  85969. }
  85970. },
  85971. clippingPlanesState: {
  85972. get: function() {
  85973. return this._unionClippingRegions ? this._planes.length : -this._planes.length;
  85974. }
  85975. }
  85976. });
  85977. function setIndexDirty(collection, index2) {
  85978. collection._multipleDirtyPlanes = collection._multipleDirtyPlanes || collection._dirtyIndex !== -1 && collection._dirtyIndex !== index2;
  85979. collection._dirtyIndex = index2;
  85980. }
  85981. ClippingPlaneCollection.prototype.add = function(plane) {
  85982. const newPlaneIndex = this._planes.length;
  85983. const that = this;
  85984. plane.onChangeCallback = function(index2) {
  85985. setIndexDirty(that, index2);
  85986. };
  85987. plane.index = newPlaneIndex;
  85988. setIndexDirty(this, newPlaneIndex);
  85989. this._planes.push(plane);
  85990. this.planeAdded.raiseEvent(plane, newPlaneIndex);
  85991. };
  85992. ClippingPlaneCollection.prototype.get = function(index2) {
  85993. Check_default.typeOf.number("index", index2);
  85994. return this._planes[index2];
  85995. };
  85996. function indexOf(planes, plane) {
  85997. const length3 = planes.length;
  85998. for (let i2 = 0; i2 < length3; ++i2) {
  85999. if (Plane_default.equals(planes[i2], plane)) {
  86000. return i2;
  86001. }
  86002. }
  86003. return -1;
  86004. }
  86005. ClippingPlaneCollection.prototype.contains = function(clippingPlane) {
  86006. return indexOf(this._planes, clippingPlane) !== -1;
  86007. };
  86008. ClippingPlaneCollection.prototype.remove = function(clippingPlane) {
  86009. const planes = this._planes;
  86010. const index2 = indexOf(planes, clippingPlane);
  86011. if (index2 === -1) {
  86012. return false;
  86013. }
  86014. if (clippingPlane instanceof ClippingPlane_default) {
  86015. clippingPlane.onChangeCallback = void 0;
  86016. clippingPlane.index = -1;
  86017. }
  86018. const length3 = planes.length - 1;
  86019. for (let i2 = index2; i2 < length3; ++i2) {
  86020. const planeToKeep = planes[i2 + 1];
  86021. planes[i2] = planeToKeep;
  86022. if (planeToKeep instanceof ClippingPlane_default) {
  86023. planeToKeep.index = i2;
  86024. }
  86025. }
  86026. this._multipleDirtyPlanes = true;
  86027. planes.length = length3;
  86028. this.planeRemoved.raiseEvent(clippingPlane, index2);
  86029. return true;
  86030. };
  86031. ClippingPlaneCollection.prototype.removeAll = function() {
  86032. const planes = this._planes;
  86033. const planesCount = planes.length;
  86034. for (let i2 = 0; i2 < planesCount; ++i2) {
  86035. const plane = planes[i2];
  86036. if (plane instanceof ClippingPlane_default) {
  86037. plane.onChangeCallback = void 0;
  86038. plane.index = -1;
  86039. }
  86040. this.planeRemoved.raiseEvent(plane, i2);
  86041. }
  86042. this._multipleDirtyPlanes = true;
  86043. this._planes = [];
  86044. };
  86045. var distanceEncodeScratch = new Cartesian4_default();
  86046. var oct32EncodeScratch = new Cartesian4_default();
  86047. function packPlanesAsUint8(clippingPlaneCollection, startIndex, endIndex) {
  86048. const uint8View = clippingPlaneCollection._uint8View;
  86049. const planes = clippingPlaneCollection._planes;
  86050. let byteIndex = 0;
  86051. for (let i2 = startIndex; i2 < endIndex; ++i2) {
  86052. const plane = planes[i2];
  86053. const oct32Normal = AttributeCompression_default.octEncodeToCartesian4(
  86054. plane.normal,
  86055. oct32EncodeScratch
  86056. );
  86057. uint8View[byteIndex] = oct32Normal.x;
  86058. uint8View[byteIndex + 1] = oct32Normal.y;
  86059. uint8View[byteIndex + 2] = oct32Normal.z;
  86060. uint8View[byteIndex + 3] = oct32Normal.w;
  86061. const encodedDistance = Cartesian4_default.packFloat(
  86062. plane.distance,
  86063. distanceEncodeScratch
  86064. );
  86065. uint8View[byteIndex + 4] = encodedDistance.x;
  86066. uint8View[byteIndex + 5] = encodedDistance.y;
  86067. uint8View[byteIndex + 6] = encodedDistance.z;
  86068. uint8View[byteIndex + 7] = encodedDistance.w;
  86069. byteIndex += 8;
  86070. }
  86071. }
  86072. function packPlanesAsFloats(clippingPlaneCollection, startIndex, endIndex) {
  86073. const float32View = clippingPlaneCollection._float32View;
  86074. const planes = clippingPlaneCollection._planes;
  86075. let floatIndex = 0;
  86076. for (let i2 = startIndex; i2 < endIndex; ++i2) {
  86077. const plane = planes[i2];
  86078. const normal2 = plane.normal;
  86079. float32View[floatIndex] = normal2.x;
  86080. float32View[floatIndex + 1] = normal2.y;
  86081. float32View[floatIndex + 2] = normal2.z;
  86082. float32View[floatIndex + 3] = plane.distance;
  86083. floatIndex += 4;
  86084. }
  86085. }
  86086. function computeTextureResolution(pixelsNeeded, result) {
  86087. const maxSize = ContextLimits_default.maximumTextureSize;
  86088. result.x = Math.min(pixelsNeeded, maxSize);
  86089. result.y = Math.ceil(pixelsNeeded / result.x);
  86090. return result;
  86091. }
  86092. var textureResolutionScratch = new Cartesian2_default();
  86093. ClippingPlaneCollection.prototype.update = function(frameState) {
  86094. let clippingPlanesTexture = this._clippingPlanesTexture;
  86095. const context = frameState.context;
  86096. const useFloatTexture = ClippingPlaneCollection.useFloatTexture(context);
  86097. const pixelsNeeded = useFloatTexture ? this.length : this.length * 2;
  86098. if (defined_default(clippingPlanesTexture)) {
  86099. const currentPixelCount = clippingPlanesTexture.width * clippingPlanesTexture.height;
  86100. if (currentPixelCount < pixelsNeeded || pixelsNeeded < 0.25 * currentPixelCount) {
  86101. clippingPlanesTexture.destroy();
  86102. clippingPlanesTexture = void 0;
  86103. this._clippingPlanesTexture = void 0;
  86104. }
  86105. }
  86106. if (this.length === 0) {
  86107. return;
  86108. }
  86109. if (!defined_default(clippingPlanesTexture)) {
  86110. const requiredResolution = computeTextureResolution(
  86111. pixelsNeeded,
  86112. textureResolutionScratch
  86113. );
  86114. requiredResolution.y *= 2;
  86115. if (useFloatTexture) {
  86116. clippingPlanesTexture = new Texture_default({
  86117. context,
  86118. width: requiredResolution.x,
  86119. height: requiredResolution.y,
  86120. pixelFormat: PixelFormat_default.RGBA,
  86121. pixelDatatype: PixelDatatype_default.FLOAT,
  86122. sampler: Sampler_default.NEAREST,
  86123. flipY: false
  86124. });
  86125. this._float32View = new Float32Array(
  86126. requiredResolution.x * requiredResolution.y * 4
  86127. );
  86128. } else {
  86129. clippingPlanesTexture = new Texture_default({
  86130. context,
  86131. width: requiredResolution.x,
  86132. height: requiredResolution.y,
  86133. pixelFormat: PixelFormat_default.RGBA,
  86134. pixelDatatype: PixelDatatype_default.UNSIGNED_BYTE,
  86135. sampler: Sampler_default.NEAREST,
  86136. flipY: false
  86137. });
  86138. this._uint8View = new Uint8Array(
  86139. requiredResolution.x * requiredResolution.y * 4
  86140. );
  86141. }
  86142. this._clippingPlanesTexture = clippingPlanesTexture;
  86143. this._multipleDirtyPlanes = true;
  86144. }
  86145. const dirtyIndex = this._dirtyIndex;
  86146. if (!this._multipleDirtyPlanes && dirtyIndex === -1) {
  86147. return;
  86148. }
  86149. if (!this._multipleDirtyPlanes) {
  86150. let offsetX = 0;
  86151. let offsetY = 0;
  86152. if (useFloatTexture) {
  86153. offsetY = Math.floor(dirtyIndex / clippingPlanesTexture.width);
  86154. offsetX = Math.floor(dirtyIndex - offsetY * clippingPlanesTexture.width);
  86155. packPlanesAsFloats(this, dirtyIndex, dirtyIndex + 1);
  86156. clippingPlanesTexture.copyFrom({
  86157. source: {
  86158. width: 1,
  86159. height: 1,
  86160. arrayBufferView: this._float32View
  86161. },
  86162. xOffset: offsetX,
  86163. yOffset: offsetY
  86164. });
  86165. } else {
  86166. offsetY = Math.floor(dirtyIndex * 2 / clippingPlanesTexture.width);
  86167. offsetX = Math.floor(
  86168. dirtyIndex * 2 - offsetY * clippingPlanesTexture.width
  86169. );
  86170. packPlanesAsUint8(this, dirtyIndex, dirtyIndex + 1);
  86171. clippingPlanesTexture.copyFrom({
  86172. source: {
  86173. width: 2,
  86174. height: 1,
  86175. arrayBufferView: this._uint8View
  86176. },
  86177. xOffset: offsetX,
  86178. yOffset: offsetY
  86179. });
  86180. }
  86181. } else if (useFloatTexture) {
  86182. packPlanesAsFloats(this, 0, this._planes.length);
  86183. clippingPlanesTexture.copyFrom({
  86184. source: {
  86185. width: clippingPlanesTexture.width,
  86186. height: clippingPlanesTexture.height,
  86187. arrayBufferView: this._float32View
  86188. }
  86189. });
  86190. } else {
  86191. packPlanesAsUint8(this, 0, this._planes.length);
  86192. clippingPlanesTexture.copyFrom({
  86193. source: {
  86194. width: clippingPlanesTexture.width,
  86195. height: clippingPlanesTexture.height,
  86196. arrayBufferView: this._uint8View
  86197. }
  86198. });
  86199. }
  86200. this._multipleDirtyPlanes = false;
  86201. this._dirtyIndex = -1;
  86202. };
  86203. var scratchMatrix = new Matrix4_default();
  86204. var scratchPlane3 = new Plane_default(Cartesian3_default.UNIT_X, 0);
  86205. ClippingPlaneCollection.prototype.computeIntersectionWithBoundingVolume = function(tileBoundingVolume, transform4) {
  86206. const planes = this._planes;
  86207. const length3 = planes.length;
  86208. let modelMatrix = this.modelMatrix;
  86209. if (defined_default(transform4)) {
  86210. modelMatrix = Matrix4_default.multiply(transform4, modelMatrix, scratchMatrix);
  86211. }
  86212. let intersection = Intersect_default.INSIDE;
  86213. if (!this.unionClippingRegions && length3 > 0) {
  86214. intersection = Intersect_default.OUTSIDE;
  86215. }
  86216. for (let i2 = 0; i2 < length3; ++i2) {
  86217. const plane = planes[i2];
  86218. Plane_default.transform(plane, modelMatrix, scratchPlane3);
  86219. const value = tileBoundingVolume.intersectPlane(scratchPlane3);
  86220. if (value === Intersect_default.INTERSECTING) {
  86221. intersection = value;
  86222. } else if (this._testIntersection(value)) {
  86223. return value;
  86224. }
  86225. }
  86226. return intersection;
  86227. };
  86228. ClippingPlaneCollection.setOwner = function(clippingPlaneCollection, owner, key) {
  86229. if (clippingPlaneCollection === owner[key]) {
  86230. return;
  86231. }
  86232. owner[key] = owner[key] && owner[key].destroy();
  86233. if (defined_default(clippingPlaneCollection)) {
  86234. if (defined_default(clippingPlaneCollection._owner)) {
  86235. throw new DeveloperError_default(
  86236. "ClippingPlaneCollection should only be assigned to one object"
  86237. );
  86238. }
  86239. clippingPlaneCollection._owner = owner;
  86240. owner[key] = clippingPlaneCollection;
  86241. }
  86242. };
  86243. ClippingPlaneCollection.useFloatTexture = function(context) {
  86244. return context.floatingPointTexture;
  86245. };
  86246. ClippingPlaneCollection.getTextureResolution = function(clippingPlaneCollection, context, result) {
  86247. const texture = clippingPlaneCollection.texture;
  86248. if (defined_default(texture)) {
  86249. result.x = texture.width;
  86250. result.y = texture.height;
  86251. return result;
  86252. }
  86253. const pixelsNeeded = ClippingPlaneCollection.useFloatTexture(context) ? clippingPlaneCollection.length : clippingPlaneCollection.length * 2;
  86254. const requiredResolution = computeTextureResolution(pixelsNeeded, result);
  86255. requiredResolution.y *= 2;
  86256. return requiredResolution;
  86257. };
  86258. ClippingPlaneCollection.prototype.isDestroyed = function() {
  86259. return false;
  86260. };
  86261. ClippingPlaneCollection.prototype.destroy = function() {
  86262. this._clippingPlanesTexture = this._clippingPlanesTexture && this._clippingPlanesTexture.destroy();
  86263. return destroyObject_default(this);
  86264. };
  86265. var ClippingPlaneCollection_default = ClippingPlaneCollection;
  86266. // node_modules/cesium/Source/Scene/ColorBlendMode.js
  86267. var ColorBlendMode = {
  86268. HIGHLIGHT: 0,
  86269. REPLACE: 1,
  86270. MIX: 2
  86271. };
  86272. ColorBlendMode.getColorBlend = function(colorBlendMode, colorBlendAmount) {
  86273. if (colorBlendMode === ColorBlendMode.HIGHLIGHT) {
  86274. return 0;
  86275. } else if (colorBlendMode === ColorBlendMode.REPLACE) {
  86276. return 1;
  86277. } else if (colorBlendMode === ColorBlendMode.MIX) {
  86278. return Math_default.clamp(colorBlendAmount, Math_default.EPSILON4, 1);
  86279. }
  86280. };
  86281. var ColorBlendMode_default = Object.freeze(ColorBlendMode);
  86282. // node_modules/cesium/Source/Scene/DracoLoader.js
  86283. function DracoLoader() {
  86284. }
  86285. DracoLoader._maxDecodingConcurrency = Math.max(
  86286. FeatureDetection_default.hardwareConcurrency - 1,
  86287. 1
  86288. );
  86289. DracoLoader._decoderTaskProcessor = void 0;
  86290. DracoLoader._taskProcessorReady = false;
  86291. DracoLoader._getDecoderTaskProcessor = function() {
  86292. if (!defined_default(DracoLoader._decoderTaskProcessor)) {
  86293. const processor = new TaskProcessor_default(
  86294. "decodeDraco",
  86295. DracoLoader._maxDecodingConcurrency
  86296. );
  86297. processor.initWebAssemblyModule({
  86298. modulePath: "ThirdParty/Workers/draco_decoder_nodejs.js",
  86299. wasmBinaryFile: "ThirdParty/draco_decoder.wasm"
  86300. }).then(function() {
  86301. DracoLoader._taskProcessorReady = true;
  86302. });
  86303. DracoLoader._decoderTaskProcessor = processor;
  86304. }
  86305. return DracoLoader._decoderTaskProcessor;
  86306. };
  86307. DracoLoader.hasExtension = function(model) {
  86308. return defined_default(model.extensionsRequired.KHR_draco_mesh_compression) || defined_default(model.extensionsUsed.KHR_draco_mesh_compression);
  86309. };
  86310. function addBufferToLoadResources(loadResources, typedArray) {
  86311. const bufferViewId = `runtime.${Object.keys(loadResources.createdBufferViews).length}`;
  86312. const loadResourceBuffers = loadResources.buffers;
  86313. const id = Object.keys(loadResourceBuffers).length;
  86314. loadResourceBuffers[id] = typedArray;
  86315. loadResources.createdBufferViews[bufferViewId] = {
  86316. buffer: id,
  86317. byteOffset: 0,
  86318. byteLength: typedArray.byteLength
  86319. };
  86320. return bufferViewId;
  86321. }
  86322. function addNewVertexBuffer(typedArray, model, context) {
  86323. const loadResources = model._loadResources;
  86324. const id = addBufferToLoadResources(loadResources, typedArray);
  86325. loadResources.vertexBuffersToCreate.enqueue(id);
  86326. return id;
  86327. }
  86328. function addNewIndexBuffer(indexArray, model, context) {
  86329. const typedArray = indexArray.typedArray;
  86330. const loadResources = model._loadResources;
  86331. const id = addBufferToLoadResources(loadResources, typedArray);
  86332. loadResources.indexBuffersToCreate.enqueue({
  86333. id,
  86334. componentType: ComponentDatatype_default.fromTypedArray(typedArray)
  86335. });
  86336. return {
  86337. bufferViewId: id,
  86338. numberOfIndices: indexArray.numberOfIndices
  86339. };
  86340. }
  86341. function scheduleDecodingTask(decoderTaskProcessor, model, loadResources, context) {
  86342. if (!DracoLoader._taskProcessorReady) {
  86343. return;
  86344. }
  86345. const taskData = loadResources.primitivesToDecode.peek();
  86346. if (!defined_default(taskData)) {
  86347. return;
  86348. }
  86349. const promise = decoderTaskProcessor.scheduleTask(taskData, [
  86350. taskData.array.buffer
  86351. ]);
  86352. if (!defined_default(promise)) {
  86353. return;
  86354. }
  86355. loadResources.activeDecodingTasks++;
  86356. loadResources.primitivesToDecode.dequeue();
  86357. return promise.then(function(result) {
  86358. loadResources.activeDecodingTasks--;
  86359. const decodedIndexBuffer = addNewIndexBuffer(
  86360. result.indexArray,
  86361. model,
  86362. context
  86363. );
  86364. const attributes = {};
  86365. const decodedAttributeData = result.attributeData;
  86366. for (const attributeName in decodedAttributeData) {
  86367. if (decodedAttributeData.hasOwnProperty(attributeName)) {
  86368. const attribute = decodedAttributeData[attributeName];
  86369. const vertexArray = attribute.array;
  86370. const vertexBufferView = addNewVertexBuffer(
  86371. vertexArray,
  86372. model,
  86373. context
  86374. );
  86375. const data = attribute.data;
  86376. data.bufferView = vertexBufferView;
  86377. attributes[attributeName] = data;
  86378. }
  86379. }
  86380. model._decodedData[`${taskData.mesh}.primitive.${taskData.primitive}`] = {
  86381. bufferView: decodedIndexBuffer.bufferViewId,
  86382. numberOfIndices: decodedIndexBuffer.numberOfIndices,
  86383. attributes
  86384. };
  86385. });
  86386. }
  86387. DracoLoader._decodedModelResourceCache = void 0;
  86388. DracoLoader.parse = function(model, context) {
  86389. if (!DracoLoader.hasExtension(model)) {
  86390. return;
  86391. }
  86392. const loadResources = model._loadResources;
  86393. const cacheKey = model.cacheKey;
  86394. if (defined_default(cacheKey)) {
  86395. if (!defined_default(DracoLoader._decodedModelResourceCache)) {
  86396. if (!defined_default(context.cache.modelDecodingCache)) {
  86397. context.cache.modelDecodingCache = {};
  86398. }
  86399. DracoLoader._decodedModelResourceCache = context.cache.modelDecodingCache;
  86400. }
  86401. const cachedData = DracoLoader._decodedModelResourceCache[cacheKey];
  86402. if (defined_default(cachedData)) {
  86403. cachedData.count++;
  86404. loadResources.pendingDecodingCache = true;
  86405. return;
  86406. }
  86407. }
  86408. const dequantizeInShader = model._dequantizeInShader;
  86409. const gltf = model.gltf;
  86410. ForEach_default.mesh(gltf, function(mesh2, meshId) {
  86411. ForEach_default.meshPrimitive(mesh2, function(primitive, primitiveId) {
  86412. if (!defined_default(primitive.extensions)) {
  86413. return;
  86414. }
  86415. const compressionData = primitive.extensions.KHR_draco_mesh_compression;
  86416. if (!defined_default(compressionData)) {
  86417. return;
  86418. }
  86419. const bufferView = gltf.bufferViews[compressionData.bufferView];
  86420. const typedArray = arraySlice_default(
  86421. gltf.buffers[bufferView.buffer].extras._pipeline.source,
  86422. bufferView.byteOffset,
  86423. bufferView.byteOffset + bufferView.byteLength
  86424. );
  86425. loadResources.primitivesToDecode.enqueue({
  86426. mesh: meshId,
  86427. primitive: primitiveId,
  86428. array: typedArray,
  86429. bufferView,
  86430. compressedAttributes: compressionData.attributes,
  86431. dequantizeInShader
  86432. });
  86433. });
  86434. });
  86435. };
  86436. DracoLoader.decodeModel = function(model, context) {
  86437. if (!DracoLoader.hasExtension(model)) {
  86438. return Promise.resolve();
  86439. }
  86440. const loadResources = model._loadResources;
  86441. const cacheKey = model.cacheKey;
  86442. if (defined_default(cacheKey) && defined_default(DracoLoader._decodedModelResourceCache)) {
  86443. const cachedData = DracoLoader._decodedModelResourceCache[cacheKey];
  86444. if (defined_default(cachedData) && loadResources.pendingDecodingCache) {
  86445. return Promise.resolve(cachedData.ready).then(function() {
  86446. model._decodedData = cachedData.data;
  86447. loadResources.pendingDecodingCache = false;
  86448. });
  86449. }
  86450. DracoLoader._decodedModelResourceCache[cacheKey] = {
  86451. ready: false,
  86452. count: 1,
  86453. data: void 0
  86454. };
  86455. }
  86456. if (loadResources.primitivesToDecode.length === 0) {
  86457. return Promise.resolve();
  86458. }
  86459. const decoderTaskProcessor = DracoLoader._getDecoderTaskProcessor();
  86460. const decodingPromises = [];
  86461. let promise = scheduleDecodingTask(
  86462. decoderTaskProcessor,
  86463. model,
  86464. loadResources,
  86465. context
  86466. );
  86467. while (defined_default(promise)) {
  86468. decodingPromises.push(promise);
  86469. promise = scheduleDecodingTask(
  86470. decoderTaskProcessor,
  86471. model,
  86472. loadResources,
  86473. context
  86474. );
  86475. }
  86476. return Promise.all(decodingPromises);
  86477. };
  86478. DracoLoader.decodePointCloud = function(parameters) {
  86479. const decoderTaskProcessor = DracoLoader._getDecoderTaskProcessor();
  86480. if (!DracoLoader._taskProcessorReady) {
  86481. return;
  86482. }
  86483. return decoderTaskProcessor.scheduleTask(parameters, [
  86484. parameters.buffer.buffer
  86485. ]);
  86486. };
  86487. DracoLoader.decodeBufferView = function(options) {
  86488. const decoderTaskProcessor = DracoLoader._getDecoderTaskProcessor();
  86489. if (!DracoLoader._taskProcessorReady) {
  86490. return;
  86491. }
  86492. return decoderTaskProcessor.scheduleTask(options, [options.array.buffer]);
  86493. };
  86494. DracoLoader.cacheDataForModel = function(model) {
  86495. const cacheKey = model.cacheKey;
  86496. if (defined_default(cacheKey) && defined_default(DracoLoader._decodedModelResourceCache)) {
  86497. const cachedData = DracoLoader._decodedModelResourceCache[cacheKey];
  86498. if (defined_default(cachedData)) {
  86499. cachedData.ready = true;
  86500. cachedData.data = model._decodedData;
  86501. }
  86502. }
  86503. };
  86504. DracoLoader.destroyCachedDataForModel = function(model) {
  86505. const cacheKey = model.cacheKey;
  86506. if (defined_default(cacheKey) && defined_default(DracoLoader._decodedModelResourceCache)) {
  86507. const cachedData = DracoLoader._decodedModelResourceCache[cacheKey];
  86508. if (defined_default(cachedData) && --cachedData.count === 0) {
  86509. delete DracoLoader._decodedModelResourceCache[cacheKey];
  86510. }
  86511. }
  86512. };
  86513. var DracoLoader_default = DracoLoader;
  86514. // node_modules/cesium/Source/Scene/getClipAndStyleCode.js
  86515. function getClipAndStyleCode(samplerUniformName, matrixUniformName, styleUniformName) {
  86516. Check_default.typeOf.string("samplerUniformName", samplerUniformName);
  86517. Check_default.typeOf.string("matrixUniformName", matrixUniformName);
  86518. Check_default.typeOf.string("styleUniformName", styleUniformName);
  86519. const shaderCode = ` float clipDistance = clip(gl_FragCoord, ${samplerUniformName}, ${matrixUniformName});
  86520. vec4 clippingPlanesEdgeColor = vec4(1.0);
  86521. clippingPlanesEdgeColor.rgb = ${styleUniformName}.rgb;
  86522. float clippingPlanesEdgeWidth = ${styleUniformName}.a;
  86523. if (clipDistance > 0.0 && clipDistance < clippingPlanesEdgeWidth)
  86524. {
  86525. gl_FragColor = clippingPlanesEdgeColor;
  86526. }
  86527. `;
  86528. return shaderCode;
  86529. }
  86530. var getClipAndStyleCode_default = getClipAndStyleCode;
  86531. // node_modules/cesium/Source/Scene/getClippingFunction.js
  86532. var textureResolutionScratch2 = new Cartesian2_default();
  86533. function getClippingFunction(clippingPlaneCollection, context) {
  86534. Check_default.typeOf.object("clippingPlaneCollection", clippingPlaneCollection);
  86535. Check_default.typeOf.object("context", context);
  86536. const unionClippingRegions = clippingPlaneCollection.unionClippingRegions;
  86537. const clippingPlanesLength = clippingPlaneCollection.length;
  86538. const usingFloatTexture = ClippingPlaneCollection_default.useFloatTexture(context);
  86539. const textureResolution = ClippingPlaneCollection_default.getTextureResolution(
  86540. clippingPlaneCollection,
  86541. context,
  86542. textureResolutionScratch2
  86543. );
  86544. const width = textureResolution.x;
  86545. const height = textureResolution.y;
  86546. let functions = usingFloatTexture ? getClippingPlaneFloat(width, height) : getClippingPlaneUint8(width, height);
  86547. functions += "\n";
  86548. functions += unionClippingRegions ? clippingFunctionUnion(clippingPlanesLength) : clippingFunctionIntersect(clippingPlanesLength);
  86549. return functions;
  86550. }
  86551. function clippingFunctionUnion(clippingPlanesLength) {
  86552. const functionString = `${"float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix)\n{\n vec4 position = czm_windowToEyeCoordinates(fragCoord);\n vec3 clipNormal = vec3(0.0);\n vec3 clipPosition = vec3(0.0);\n float clipAmount;\n float pixelWidth = czm_metersPerPixel(position);\n bool breakAndDiscard = false;\n for (int i = 0; i < "}${clippingPlanesLength}; ++i)
  86553. {
  86554. vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);
  86555. clipNormal = clippingPlane.xyz;
  86556. clipPosition = -clippingPlane.w * clipNormal;
  86557. float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;
  86558. clipAmount = czm_branchFreeTernary(i == 0, amount, min(amount, clipAmount));
  86559. if (amount <= 0.0)
  86560. {
  86561. breakAndDiscard = true;
  86562. break;
  86563. }
  86564. }
  86565. if (breakAndDiscard) {
  86566. discard;
  86567. }
  86568. return clipAmount;
  86569. }
  86570. `;
  86571. return functionString;
  86572. }
  86573. function clippingFunctionIntersect(clippingPlanesLength) {
  86574. const functionString = `${"float clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix)\n{\n bool clipped = true;\n vec4 position = czm_windowToEyeCoordinates(fragCoord);\n vec3 clipNormal = vec3(0.0);\n vec3 clipPosition = vec3(0.0);\n float clipAmount = 0.0;\n float pixelWidth = czm_metersPerPixel(position);\n for (int i = 0; i < "}${clippingPlanesLength}; ++i)
  86575. {
  86576. vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);
  86577. clipNormal = clippingPlane.xyz;
  86578. clipPosition = -clippingPlane.w * clipNormal;
  86579. float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;
  86580. clipAmount = max(amount, clipAmount);
  86581. clipped = clipped && (amount <= 0.0);
  86582. }
  86583. if (clipped)
  86584. {
  86585. discard;
  86586. }
  86587. return clipAmount;
  86588. }
  86589. `;
  86590. return functionString;
  86591. }
  86592. function getClippingPlaneFloat(width, height) {
  86593. const pixelWidth = 1 / width;
  86594. const pixelHeight = 1 / height;
  86595. let pixelWidthString = `${pixelWidth}`;
  86596. if (pixelWidthString.indexOf(".") === -1) {
  86597. pixelWidthString += ".0";
  86598. }
  86599. let pixelHeightString = `${pixelHeight}`;
  86600. if (pixelHeightString.indexOf(".") === -1) {
  86601. pixelHeightString += ".0";
  86602. }
  86603. const functionString = `${"vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)\n{\n int pixY = clippingPlaneNumber / "}${width};
  86604. int pixX = clippingPlaneNumber - (pixY * ${width});
  86605. float u = (float(pixX) + 0.5) * ${pixelWidthString};
  86606. float v = (float(pixY) + 0.5) * ${pixelHeightString};
  86607. vec4 plane = texture2D(packedClippingPlanes, vec2(u, v));
  86608. return czm_transformPlane(plane, transform);
  86609. }
  86610. `;
  86611. return functionString;
  86612. }
  86613. function getClippingPlaneUint8(width, height) {
  86614. const pixelWidth = 1 / width;
  86615. const pixelHeight = 1 / height;
  86616. let pixelWidthString = `${pixelWidth}`;
  86617. if (pixelWidthString.indexOf(".") === -1) {
  86618. pixelWidthString += ".0";
  86619. }
  86620. let pixelHeightString = `${pixelHeight}`;
  86621. if (pixelHeightString.indexOf(".") === -1) {
  86622. pixelHeightString += ".0";
  86623. }
  86624. const functionString = `${"vec4 getClippingPlane(highp sampler2D packedClippingPlanes, int clippingPlaneNumber, mat4 transform)\n{\n int clippingPlaneStartIndex = clippingPlaneNumber * 2;\n int pixY = clippingPlaneStartIndex / "}${width};
  86625. int pixX = clippingPlaneStartIndex - (pixY * ${width});
  86626. float u = (float(pixX) + 0.5) * ${pixelWidthString};
  86627. float v = (float(pixY) + 0.5) * ${pixelHeightString};
  86628. vec4 oct32 = texture2D(packedClippingPlanes, vec2(u, v)) * 255.0;
  86629. vec2 oct = vec2(oct32.x * 256.0 + oct32.y, oct32.z * 256.0 + oct32.w);
  86630. vec4 plane;
  86631. plane.xyz = czm_octDecode(oct, 65535.0);
  86632. plane.w = czm_unpackFloat(texture2D(packedClippingPlanes, vec2(u + ${pixelWidthString}, v)));
  86633. return czm_transformPlane(plane, transform);
  86634. }
  86635. `;
  86636. return functionString;
  86637. }
  86638. var getClippingFunction_default = getClippingFunction;
  86639. // node_modules/cesium/Source/Scene/JobType.js
  86640. var JobType = {
  86641. TEXTURE: 0,
  86642. PROGRAM: 1,
  86643. BUFFER: 2,
  86644. NUMBER_OF_JOB_TYPES: 3
  86645. };
  86646. var JobType_default = Object.freeze(JobType);
  86647. // node_modules/cesium/Source/Scene/ModelAnimationCache.js
  86648. function ModelAnimationCache() {
  86649. }
  86650. var dataUriRegex3 = /^data\:/i;
  86651. function getAccessorKey(model, accessor) {
  86652. const gltf = model.gltf;
  86653. const buffers = gltf.buffers;
  86654. const bufferViews = gltf.bufferViews;
  86655. const bufferView = bufferViews[accessor.bufferView];
  86656. const buffer = buffers[bufferView.buffer];
  86657. const byteOffset = bufferView.byteOffset + accessor.byteOffset;
  86658. const byteLength = accessor.count * numberOfComponentsForType_default(accessor.type);
  86659. const uriKey = dataUriRegex3.test(buffer.uri) ? "" : buffer.uri;
  86660. return `${model.cacheKey}//${uriKey}/${byteOffset}/${byteLength}`;
  86661. }
  86662. var cachedAnimationParameters = {};
  86663. ModelAnimationCache.getAnimationParameterValues = function(model, accessor) {
  86664. const key = getAccessorKey(model, accessor);
  86665. let values = cachedAnimationParameters[key];
  86666. if (!defined_default(values)) {
  86667. const gltf = model.gltf;
  86668. const buffers = gltf.buffers;
  86669. const bufferViews = gltf.bufferViews;
  86670. const bufferView = bufferViews[accessor.bufferView];
  86671. const bufferId = bufferView.buffer;
  86672. const buffer = buffers[bufferId];
  86673. const source = buffer.extras._pipeline.source;
  86674. const componentType = accessor.componentType;
  86675. const type = accessor.type;
  86676. const numberOfComponents = numberOfComponentsForType_default(type);
  86677. const count = accessor.count;
  86678. const byteStride = getAccessorByteStride_default(gltf, accessor);
  86679. values = new Array(count);
  86680. const accessorByteOffset = defaultValue_default(accessor.byteOffset, 0);
  86681. let byteOffset = bufferView.byteOffset + accessorByteOffset;
  86682. for (let i2 = 0; i2 < count; i2++) {
  86683. const typedArrayView = ComponentDatatype_default.createArrayBufferView(
  86684. componentType,
  86685. source.buffer,
  86686. source.byteOffset + byteOffset,
  86687. numberOfComponents
  86688. );
  86689. if (type === "SCALAR") {
  86690. values[i2] = typedArrayView[0];
  86691. } else if (type === "VEC3") {
  86692. values[i2] = Cartesian3_default.fromArray(typedArrayView);
  86693. } else if (type === "VEC4") {
  86694. values[i2] = Quaternion_default.unpack(typedArrayView);
  86695. }
  86696. byteOffset += byteStride;
  86697. }
  86698. if (defined_default(model.cacheKey)) {
  86699. cachedAnimationParameters[key] = values;
  86700. }
  86701. }
  86702. return values;
  86703. };
  86704. var cachedAnimationSplines = {};
  86705. function getAnimationSplineKey(model, animationName, samplerName) {
  86706. return `${model.cacheKey}//${animationName}/${samplerName}`;
  86707. }
  86708. function SteppedSpline2(backingSpline) {
  86709. this._spline = backingSpline;
  86710. this._lastTimeIndex = 0;
  86711. }
  86712. SteppedSpline2.prototype.findTimeInterval = Spline_default.prototype.findTimeInterval;
  86713. SteppedSpline2.prototype.evaluate = function(time, result) {
  86714. const i2 = this._lastTimeIndex = this.findTimeInterval(
  86715. time,
  86716. this._lastTimeIndex
  86717. );
  86718. const times = this._spline.times;
  86719. const steppedTime = time >= times[i2 + 1] ? times[i2 + 1] : times[i2];
  86720. return this._spline.evaluate(steppedTime, result);
  86721. };
  86722. Object.defineProperties(SteppedSpline2.prototype, {
  86723. times: {
  86724. get: function() {
  86725. return this._spline.times;
  86726. }
  86727. }
  86728. });
  86729. SteppedSpline2.prototype.wrapTime = function(time) {
  86730. return this._spline.wrapTime(time);
  86731. };
  86732. SteppedSpline2.prototype.clampTime = function(time) {
  86733. return this._spline.clampTime(time);
  86734. };
  86735. ModelAnimationCache.getAnimationSpline = function(model, animationName, animation, samplerName, sampler, input, path, output) {
  86736. const key = getAnimationSplineKey(model, animationName, samplerName);
  86737. let spline = cachedAnimationSplines[key];
  86738. if (!defined_default(spline)) {
  86739. const times = input;
  86740. const controlPoints = output;
  86741. if (times.length === 1 && controlPoints.length === 1) {
  86742. spline = new ConstantSpline_default(controlPoints[0]);
  86743. } else if (sampler.interpolation === "LINEAR" || sampler.interpolation === "STEP") {
  86744. if (path === "translation" || path === "scale") {
  86745. spline = new LinearSpline_default({
  86746. times,
  86747. points: controlPoints
  86748. });
  86749. } else if (path === "rotation") {
  86750. spline = new QuaternionSpline_default({
  86751. times,
  86752. points: controlPoints
  86753. });
  86754. } else if (path === "weights") {
  86755. spline = new MorphWeightSpline_default({
  86756. times,
  86757. weights: controlPoints
  86758. });
  86759. }
  86760. if (defined_default(spline) && sampler.interpolation === "STEP") {
  86761. spline = new SteppedSpline2(spline);
  86762. }
  86763. }
  86764. if (defined_default(model.cacheKey)) {
  86765. cachedAnimationSplines[key] = spline;
  86766. }
  86767. }
  86768. return spline;
  86769. };
  86770. var cachedSkinInverseBindMatrices = {};
  86771. ModelAnimationCache.getSkinInverseBindMatrices = function(model, accessor) {
  86772. const key = getAccessorKey(model, accessor);
  86773. let matrices = cachedSkinInverseBindMatrices[key];
  86774. if (!defined_default(matrices)) {
  86775. const gltf = model.gltf;
  86776. const buffers = gltf.buffers;
  86777. const bufferViews = gltf.bufferViews;
  86778. const bufferViewId = accessor.bufferView;
  86779. const bufferView = bufferViews[bufferViewId];
  86780. const bufferId = bufferView.buffer;
  86781. const buffer = buffers[bufferId];
  86782. const source = buffer.extras._pipeline.source;
  86783. const componentType = accessor.componentType;
  86784. const type = accessor.type;
  86785. const count = accessor.count;
  86786. const byteStride = getAccessorByteStride_default(gltf, accessor);
  86787. let byteOffset = bufferView.byteOffset + accessor.byteOffset;
  86788. const numberOfComponents = numberOfComponentsForType_default(type);
  86789. matrices = new Array(count);
  86790. if (componentType === WebGLConstants_default.FLOAT && type === AttributeType_default.MAT4) {
  86791. for (let i2 = 0; i2 < count; ++i2) {
  86792. const typedArrayView = ComponentDatatype_default.createArrayBufferView(
  86793. componentType,
  86794. source.buffer,
  86795. source.byteOffset + byteOffset,
  86796. numberOfComponents
  86797. );
  86798. matrices[i2] = Matrix4_default.fromArray(typedArrayView);
  86799. byteOffset += byteStride;
  86800. }
  86801. }
  86802. cachedSkinInverseBindMatrices[key] = matrices;
  86803. }
  86804. return matrices;
  86805. };
  86806. var ModelAnimationCache_default = ModelAnimationCache;
  86807. // node_modules/cesium/Source/Scene/ModelAnimationLoop.js
  86808. var ModelAnimationLoop = {
  86809. NONE: 0,
  86810. REPEAT: 1,
  86811. MIRRORED_REPEAT: 2
  86812. };
  86813. var ModelAnimationLoop_default = Object.freeze(ModelAnimationLoop);
  86814. // node_modules/cesium/Source/Scene/ModelAnimationState.js
  86815. var ModelAnimationState_default = Object.freeze({
  86816. STOPPED: 0,
  86817. ANIMATING: 1
  86818. });
  86819. // node_modules/cesium/Source/Scene/ModelAnimation.js
  86820. function ModelAnimation(options, model, runtimeAnimation) {
  86821. this._name = runtimeAnimation.name;
  86822. this._startTime = JulianDate_default.clone(options.startTime);
  86823. this._delay = defaultValue_default(options.delay, 0);
  86824. this._stopTime = options.stopTime;
  86825. this.removeOnStop = defaultValue_default(options.removeOnStop, false);
  86826. this._multiplier = defaultValue_default(options.multiplier, 1);
  86827. this._reverse = defaultValue_default(options.reverse, false);
  86828. this._loop = defaultValue_default(options.loop, ModelAnimationLoop_default.NONE);
  86829. this.start = new Event_default();
  86830. this.update = new Event_default();
  86831. this.stop = new Event_default();
  86832. this._state = ModelAnimationState_default.STOPPED;
  86833. this._runtimeAnimation = runtimeAnimation;
  86834. this._computedStartTime = void 0;
  86835. this._duration = void 0;
  86836. const that = this;
  86837. this._raiseStartEvent = function() {
  86838. that.start.raiseEvent(model, that);
  86839. };
  86840. this._updateEventTime = 0;
  86841. this._raiseUpdateEvent = function() {
  86842. that.update.raiseEvent(model, that, that._updateEventTime);
  86843. };
  86844. this._raiseStopEvent = function() {
  86845. that.stop.raiseEvent(model, that);
  86846. };
  86847. }
  86848. Object.defineProperties(ModelAnimation.prototype, {
  86849. name: {
  86850. get: function() {
  86851. return this._name;
  86852. }
  86853. },
  86854. startTime: {
  86855. get: function() {
  86856. return this._startTime;
  86857. }
  86858. },
  86859. delay: {
  86860. get: function() {
  86861. return this._delay;
  86862. }
  86863. },
  86864. stopTime: {
  86865. get: function() {
  86866. return this._stopTime;
  86867. }
  86868. },
  86869. multiplier: {
  86870. get: function() {
  86871. return this._multiplier;
  86872. }
  86873. },
  86874. reverse: {
  86875. get: function() {
  86876. return this._reverse;
  86877. }
  86878. },
  86879. loop: {
  86880. get: function() {
  86881. return this._loop;
  86882. }
  86883. }
  86884. });
  86885. var ModelAnimation_default = ModelAnimation;
  86886. // node_modules/cesium/Source/Scene/ModelAnimationCollection.js
  86887. function ModelAnimationCollection(model) {
  86888. this.animationAdded = new Event_default();
  86889. this.animationRemoved = new Event_default();
  86890. this._model = model;
  86891. this._scheduledAnimations = [];
  86892. this._previousTime = void 0;
  86893. }
  86894. Object.defineProperties(ModelAnimationCollection.prototype, {
  86895. length: {
  86896. get: function() {
  86897. return this._scheduledAnimations.length;
  86898. }
  86899. }
  86900. });
  86901. function add(collection, index2, options) {
  86902. const model = collection._model;
  86903. const animations = model._runtime.animations;
  86904. const animation = animations[index2];
  86905. const scheduledAnimation = new ModelAnimation_default(options, model, animation);
  86906. collection._scheduledAnimations.push(scheduledAnimation);
  86907. collection.animationAdded.raiseEvent(model, scheduledAnimation);
  86908. return scheduledAnimation;
  86909. }
  86910. ModelAnimationCollection.prototype.add = function(options) {
  86911. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  86912. const model = this._model;
  86913. const animations = model._runtime.animations;
  86914. if (!defined_default(animations)) {
  86915. throw new DeveloperError_default(
  86916. "Animations are not loaded. Wait for Model.readyPromise to resolve."
  86917. );
  86918. }
  86919. if (!defined_default(options.name) && !defined_default(options.index)) {
  86920. throw new DeveloperError_default(
  86921. "Either options.name or options.index must be defined."
  86922. );
  86923. }
  86924. if (defined_default(options.multiplier) && options.multiplier <= 0) {
  86925. throw new DeveloperError_default("options.multiplier must be greater than zero.");
  86926. }
  86927. if (defined_default(options.index) && (options.index >= animations.length || options.index < 0)) {
  86928. throw new DeveloperError_default("options.index must be a valid animation index.");
  86929. }
  86930. if (defined_default(options.index)) {
  86931. return add(this, options.index, options);
  86932. }
  86933. let index2;
  86934. const length3 = animations.length;
  86935. for (let i2 = 0; i2 < length3; ++i2) {
  86936. if (animations[i2].name === options.name) {
  86937. index2 = i2;
  86938. break;
  86939. }
  86940. }
  86941. if (!defined_default(index2)) {
  86942. throw new DeveloperError_default("options.name must be a valid animation name.");
  86943. }
  86944. return add(this, index2, options);
  86945. };
  86946. ModelAnimationCollection.prototype.addAll = function(options) {
  86947. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  86948. if (!defined_default(this._model._runtime.animations)) {
  86949. throw new DeveloperError_default(
  86950. "Animations are not loaded. Wait for Model.readyPromise to resolve."
  86951. );
  86952. }
  86953. if (defined_default(options.multiplier) && options.multiplier <= 0) {
  86954. throw new DeveloperError_default("options.multiplier must be greater than zero.");
  86955. }
  86956. const scheduledAnimations = [];
  86957. const model = this._model;
  86958. const animations = model._runtime.animations;
  86959. const length3 = animations.length;
  86960. for (let i2 = 0; i2 < length3; ++i2) {
  86961. scheduledAnimations.push(add(this, i2, options));
  86962. }
  86963. return scheduledAnimations;
  86964. };
  86965. ModelAnimationCollection.prototype.remove = function(animation) {
  86966. if (defined_default(animation)) {
  86967. const animations = this._scheduledAnimations;
  86968. const i2 = animations.indexOf(animation);
  86969. if (i2 !== -1) {
  86970. animations.splice(i2, 1);
  86971. this.animationRemoved.raiseEvent(this._model, animation);
  86972. return true;
  86973. }
  86974. }
  86975. return false;
  86976. };
  86977. ModelAnimationCollection.prototype.removeAll = function() {
  86978. const model = this._model;
  86979. const animations = this._scheduledAnimations;
  86980. const length3 = animations.length;
  86981. this._scheduledAnimations = [];
  86982. for (let i2 = 0; i2 < length3; ++i2) {
  86983. this.animationRemoved.raiseEvent(model, animations[i2]);
  86984. }
  86985. };
  86986. ModelAnimationCollection.prototype.contains = function(animation) {
  86987. if (defined_default(animation)) {
  86988. return this._scheduledAnimations.indexOf(animation) !== -1;
  86989. }
  86990. return false;
  86991. };
  86992. ModelAnimationCollection.prototype.get = function(index2) {
  86993. if (!defined_default(index2)) {
  86994. throw new DeveloperError_default("index is required.");
  86995. }
  86996. return this._scheduledAnimations[index2];
  86997. };
  86998. function animateChannels(runtimeAnimation, localAnimationTime) {
  86999. const channelEvaluators = runtimeAnimation.channelEvaluators;
  87000. const length3 = channelEvaluators.length;
  87001. for (let i2 = 0; i2 < length3; ++i2) {
  87002. channelEvaluators[i2](localAnimationTime);
  87003. }
  87004. }
  87005. var animationsToRemove = [];
  87006. function createAnimationRemovedFunction(modelAnimationCollection, model, animation) {
  87007. return function() {
  87008. modelAnimationCollection.animationRemoved.raiseEvent(model, animation);
  87009. };
  87010. }
  87011. ModelAnimationCollection.prototype.update = function(frameState) {
  87012. const scheduledAnimations = this._scheduledAnimations;
  87013. let length3 = scheduledAnimations.length;
  87014. if (length3 === 0) {
  87015. this._previousTime = void 0;
  87016. return false;
  87017. }
  87018. if (JulianDate_default.equals(frameState.time, this._previousTime)) {
  87019. return false;
  87020. }
  87021. this._previousTime = JulianDate_default.clone(frameState.time, this._previousTime);
  87022. let animationOccured = false;
  87023. const sceneTime = frameState.time;
  87024. const model = this._model;
  87025. for (let i2 = 0; i2 < length3; ++i2) {
  87026. const scheduledAnimation = scheduledAnimations[i2];
  87027. const runtimeAnimation = scheduledAnimation._runtimeAnimation;
  87028. if (!defined_default(scheduledAnimation._computedStartTime)) {
  87029. scheduledAnimation._computedStartTime = JulianDate_default.addSeconds(
  87030. defaultValue_default(scheduledAnimation.startTime, sceneTime),
  87031. scheduledAnimation.delay,
  87032. new JulianDate_default()
  87033. );
  87034. }
  87035. if (!defined_default(scheduledAnimation._duration)) {
  87036. scheduledAnimation._duration = runtimeAnimation.stopTime * (1 / scheduledAnimation.multiplier);
  87037. }
  87038. const startTime = scheduledAnimation._computedStartTime;
  87039. const duration = scheduledAnimation._duration;
  87040. const stopTime = scheduledAnimation.stopTime;
  87041. let delta = duration !== 0 ? JulianDate_default.secondsDifference(sceneTime, startTime) / duration : 0;
  87042. if (duration !== 0 && defined_default(stopTime) && JulianDate_default.greaterThan(sceneTime, stopTime)) {
  87043. delta = JulianDate_default.secondsDifference(stopTime, startTime) / duration;
  87044. }
  87045. const pastStartTime = delta >= 0;
  87046. const repeat = scheduledAnimation.loop === ModelAnimationLoop_default.REPEAT || scheduledAnimation.loop === ModelAnimationLoop_default.MIRRORED_REPEAT;
  87047. const play = (pastStartTime || repeat && !defined_default(scheduledAnimation.startTime)) && (delta <= 1 || repeat) && (!defined_default(stopTime) || JulianDate_default.lessThanOrEquals(sceneTime, stopTime));
  87048. if (play || scheduledAnimation._state === ModelAnimationState_default.ANIMATING) {
  87049. if (play && scheduledAnimation._state === ModelAnimationState_default.STOPPED) {
  87050. scheduledAnimation._state = ModelAnimationState_default.ANIMATING;
  87051. if (scheduledAnimation.start.numberOfListeners > 0) {
  87052. frameState.afterRender.push(scheduledAnimation._raiseStartEvent);
  87053. }
  87054. }
  87055. if (scheduledAnimation.loop === ModelAnimationLoop_default.REPEAT) {
  87056. delta = delta - Math.floor(delta);
  87057. } else if (scheduledAnimation.loop === ModelAnimationLoop_default.MIRRORED_REPEAT) {
  87058. const floor = Math.floor(delta);
  87059. const fract2 = delta - floor;
  87060. delta = floor % 2 === 1 ? 1 - fract2 : fract2;
  87061. }
  87062. if (scheduledAnimation.reverse) {
  87063. delta = 1 - delta;
  87064. }
  87065. let localAnimationTime = delta * duration * scheduledAnimation.multiplier;
  87066. localAnimationTime = Math_default.clamp(
  87067. localAnimationTime,
  87068. runtimeAnimation.startTime,
  87069. runtimeAnimation.stopTime
  87070. );
  87071. animateChannels(runtimeAnimation, localAnimationTime);
  87072. if (scheduledAnimation.update.numberOfListeners > 0) {
  87073. scheduledAnimation._updateEventTime = localAnimationTime;
  87074. frameState.afterRender.push(scheduledAnimation._raiseUpdateEvent);
  87075. }
  87076. animationOccured = true;
  87077. if (!play) {
  87078. scheduledAnimation._state = ModelAnimationState_default.STOPPED;
  87079. if (scheduledAnimation.stop.numberOfListeners > 0) {
  87080. frameState.afterRender.push(scheduledAnimation._raiseStopEvent);
  87081. }
  87082. if (scheduledAnimation.removeOnStop) {
  87083. animationsToRemove.push(scheduledAnimation);
  87084. }
  87085. }
  87086. }
  87087. }
  87088. length3 = animationsToRemove.length;
  87089. for (let j = 0; j < length3; ++j) {
  87090. const animationToRemove = animationsToRemove[j];
  87091. scheduledAnimations.splice(
  87092. scheduledAnimations.indexOf(animationToRemove),
  87093. 1
  87094. );
  87095. frameState.afterRender.push(
  87096. createAnimationRemovedFunction(this, model, animationToRemove)
  87097. );
  87098. }
  87099. animationsToRemove.length = 0;
  87100. return animationOccured;
  87101. };
  87102. var ModelAnimationCollection_default = ModelAnimationCollection;
  87103. // node_modules/cesium/Source/Scene/ModelMaterial.js
  87104. function ModelMaterial(model, material, id) {
  87105. this._name = material.name;
  87106. this._id = id;
  87107. this._uniformMap = model._uniformMaps[id];
  87108. this._technique = void 0;
  87109. this._program = void 0;
  87110. this._values = void 0;
  87111. }
  87112. Object.defineProperties(ModelMaterial.prototype, {
  87113. name: {
  87114. get: function() {
  87115. return this._name;
  87116. }
  87117. },
  87118. id: {
  87119. get: function() {
  87120. return this._id;
  87121. }
  87122. }
  87123. });
  87124. ModelMaterial.prototype.setValue = function(name, value) {
  87125. if (!defined_default(name)) {
  87126. throw new DeveloperError_default("name is required.");
  87127. }
  87128. const uniformName = `u_${name}`;
  87129. const v7 = this._uniformMap.values[uniformName];
  87130. if (!defined_default(v7)) {
  87131. throw new DeveloperError_default(
  87132. "name must match a parameter name in the material's technique that is targetable and not optimized out."
  87133. );
  87134. }
  87135. v7.value = v7.clone(value, v7.value);
  87136. };
  87137. ModelMaterial.prototype.getValue = function(name) {
  87138. if (!defined_default(name)) {
  87139. throw new DeveloperError_default("name is required.");
  87140. }
  87141. const uniformName = `u_${name}`;
  87142. const v7 = this._uniformMap.values[uniformName];
  87143. if (!defined_default(v7)) {
  87144. return void 0;
  87145. }
  87146. return v7.value;
  87147. };
  87148. var ModelMaterial_default = ModelMaterial;
  87149. // node_modules/cesium/Source/Scene/ModelMesh.js
  87150. function ModelMesh(mesh2, runtimeMaterialsById, id) {
  87151. const materials = [];
  87152. const primitives = mesh2.primitives;
  87153. const length3 = primitives.length;
  87154. for (let i2 = 0; i2 < length3; ++i2) {
  87155. const p2 = primitives[i2];
  87156. materials[i2] = runtimeMaterialsById[p2.material];
  87157. }
  87158. this._name = mesh2.name;
  87159. this._materials = materials;
  87160. this._id = id;
  87161. }
  87162. Object.defineProperties(ModelMesh.prototype, {
  87163. name: {
  87164. get: function() {
  87165. return this._name;
  87166. }
  87167. },
  87168. id: {
  87169. get: function() {
  87170. return this._id;
  87171. }
  87172. },
  87173. materials: {
  87174. get: function() {
  87175. return this._materials;
  87176. }
  87177. }
  87178. });
  87179. var ModelMesh_default = ModelMesh;
  87180. // node_modules/cesium/Source/Scene/ModelNode.js
  87181. function ModelNode(model, node, runtimeNode, id, matrix) {
  87182. this._model = model;
  87183. this._runtimeNode = runtimeNode;
  87184. this._name = node.name;
  87185. this._id = id;
  87186. this.useMatrix = false;
  87187. this._show = true;
  87188. this._matrix = Matrix4_default.clone(matrix);
  87189. this._originalMatrix = Matrix4_default.clone(matrix);
  87190. }
  87191. Object.defineProperties(ModelNode.prototype, {
  87192. name: {
  87193. get: function() {
  87194. return this._name;
  87195. }
  87196. },
  87197. id: {
  87198. get: function() {
  87199. return this._id;
  87200. }
  87201. },
  87202. show: {
  87203. get: function() {
  87204. return this._show;
  87205. },
  87206. set: function(value) {
  87207. if (this._show !== value) {
  87208. this._show = value;
  87209. this._model._perNodeShowDirty = true;
  87210. }
  87211. }
  87212. },
  87213. matrix: {
  87214. get: function() {
  87215. return this._matrix;
  87216. },
  87217. set: function(value) {
  87218. this._matrix = Matrix4_default.clone(value, this._matrix);
  87219. this.useMatrix = true;
  87220. const model = this._model;
  87221. model._cesiumAnimationsDirty = true;
  87222. this._runtimeNode.dirtyNumber = model._maxDirtyNumber;
  87223. }
  87224. },
  87225. originalMatrix: {
  87226. get: function() {
  87227. return this._originalMatrix;
  87228. }
  87229. }
  87230. });
  87231. ModelNode.prototype.setMatrix = function(matrix) {
  87232. Matrix4_default.clone(matrix, this._matrix);
  87233. };
  87234. var ModelNode_default = ModelNode;
  87235. // node_modules/cesium/Source/Scene/ModelOutlineLoader.js
  87236. var MAX_GLTF_UINT16_INDEX = 65534;
  87237. function ModelOutlineLoader() {
  87238. }
  87239. ModelOutlineLoader.hasExtension = function(model) {
  87240. return defined_default(model.extensionsRequired.CESIUM_primitive_outline) || defined_default(model.extensionsUsed.CESIUM_primitive_outline);
  87241. };
  87242. ModelOutlineLoader.outlinePrimitives = function(model) {
  87243. if (!ModelOutlineLoader.hasExtension(model)) {
  87244. return;
  87245. }
  87246. const gltf = model.gltf;
  87247. const vertexNumberingScopes = [];
  87248. ForEach_default.mesh(gltf, function(mesh2, meshId) {
  87249. ForEach_default.meshPrimitive(mesh2, function(primitive, primitiveId) {
  87250. if (!defined_default(primitive.extensions)) {
  87251. return;
  87252. }
  87253. const outlineData = primitive.extensions.CESIUM_primitive_outline;
  87254. if (!defined_default(outlineData)) {
  87255. return;
  87256. }
  87257. const vertexNumberingScope = getVertexNumberingScope(model, primitive);
  87258. if (vertexNumberingScope === void 0) {
  87259. return;
  87260. }
  87261. if (vertexNumberingScopes.indexOf(vertexNumberingScope) < 0) {
  87262. vertexNumberingScopes.push(vertexNumberingScope);
  87263. }
  87264. addOutline(
  87265. model,
  87266. meshId,
  87267. primitiveId,
  87268. outlineData.indices,
  87269. vertexNumberingScope
  87270. );
  87271. });
  87272. });
  87273. for (let i2 = 0; i2 < vertexNumberingScopes.length; ++i2) {
  87274. updateBufferViewsWithNewVertices(
  87275. model,
  87276. vertexNumberingScopes[i2].bufferViews
  87277. );
  87278. }
  87279. compactBuffers(model);
  87280. };
  87281. ModelOutlineLoader.createTexture = function(model, context) {
  87282. let cache = context.cache.modelOutliningCache;
  87283. if (!defined_default(cache)) {
  87284. cache = context.cache.modelOutliningCache = {};
  87285. }
  87286. if (defined_default(cache.outlineTexture)) {
  87287. return cache.outlineTexture;
  87288. }
  87289. const maxSize = Math.min(4096, ContextLimits_default.maximumTextureSize);
  87290. let size = maxSize;
  87291. const levelZero = createTexture3(size);
  87292. const mipLevels = [];
  87293. while (size > 1) {
  87294. size >>= 1;
  87295. mipLevels.push(createTexture3(size));
  87296. }
  87297. const texture = new Texture_default({
  87298. context,
  87299. source: {
  87300. arrayBufferView: levelZero,
  87301. mipLevels
  87302. },
  87303. width: maxSize,
  87304. height: 1,
  87305. pixelFormat: PixelFormat_default.LUMINANCE,
  87306. sampler: new Sampler_default({
  87307. wrapS: TextureWrap_default.CLAMP_TO_EDGE,
  87308. wrapT: TextureWrap_default.CLAMP_TO_EDGE,
  87309. minificationFilter: TextureMinificationFilter_default.LINEAR_MIPMAP_LINEAR,
  87310. magnificationFilter: TextureMagnificationFilter_default.LINEAR
  87311. })
  87312. });
  87313. cache.outlineTexture = texture;
  87314. return texture;
  87315. };
  87316. function addOutline(model, meshId, primitiveId, edgeIndicesAccessorId, vertexNumberingScope) {
  87317. const vertexCopies = vertexNumberingScope.vertexCopies;
  87318. const extraVertices = vertexNumberingScope.extraVertices;
  87319. const outlineCoordinates = vertexNumberingScope.outlineCoordinates;
  87320. const gltf = model.gltf;
  87321. const mesh2 = gltf.meshes[meshId];
  87322. const primitive = mesh2.primitives[primitiveId];
  87323. const accessors = gltf.accessors;
  87324. const bufferViews = gltf.bufferViews;
  87325. let numVertices;
  87326. for (const semantic in primitive.attributes) {
  87327. if (primitive.attributes.hasOwnProperty(semantic)) {
  87328. const attributeId = primitive.attributes[semantic];
  87329. const accessor = accessors[attributeId];
  87330. if (defined_default(accessor)) {
  87331. numVertices = accessor.count;
  87332. break;
  87333. }
  87334. }
  87335. }
  87336. if (!defined_default(numVertices)) {
  87337. return void 0;
  87338. }
  87339. const triangleIndexAccessorGltf = accessors[primitive.indices];
  87340. const triangleIndexBufferViewGltf = bufferViews[triangleIndexAccessorGltf.bufferView];
  87341. const edgeIndexAccessorGltf = accessors[edgeIndicesAccessorId];
  87342. const edgeIndexBufferViewGltf = bufferViews[edgeIndexAccessorGltf.bufferView];
  87343. const loadResources = model._loadResources;
  87344. const triangleIndexBufferView = loadResources.getBuffer(
  87345. triangleIndexBufferViewGltf
  87346. );
  87347. const edgeIndexBufferView = loadResources.getBuffer(edgeIndexBufferViewGltf);
  87348. let triangleIndices = triangleIndexAccessorGltf.componentType === 5123 ? new Uint16Array(
  87349. triangleIndexBufferView.buffer,
  87350. triangleIndexBufferView.byteOffset + triangleIndexAccessorGltf.byteOffset,
  87351. triangleIndexAccessorGltf.count
  87352. ) : new Uint32Array(
  87353. triangleIndexBufferView.buffer,
  87354. triangleIndexBufferView.byteOffset + triangleIndexAccessorGltf.byteOffset,
  87355. triangleIndexAccessorGltf.count
  87356. );
  87357. const edgeIndices = edgeIndexAccessorGltf.componentType === 5123 ? new Uint16Array(
  87358. edgeIndexBufferView.buffer,
  87359. edgeIndexBufferView.byteOffset + edgeIndexAccessorGltf.byteOffset,
  87360. edgeIndexAccessorGltf.count
  87361. ) : new Uint32Array(
  87362. edgeIndexBufferView.buffer,
  87363. edgeIndexBufferView.byteOffset + edgeIndexAccessorGltf.byteOffset,
  87364. edgeIndexAccessorGltf.count
  87365. );
  87366. const edgeSmallMultiplier = numVertices;
  87367. const edges = [edgeSmallMultiplier];
  87368. let i2;
  87369. for (i2 = 0; i2 < edgeIndices.length; i2 += 2) {
  87370. const a4 = edgeIndices[i2];
  87371. const b = edgeIndices[i2 + 1];
  87372. const small = Math.min(a4, b);
  87373. const big = Math.max(a4, b);
  87374. edges[small * edgeSmallMultiplier + big] = 1;
  87375. }
  87376. for (i2 = 0; i2 < triangleIndices.length; i2 += 3) {
  87377. let i0 = triangleIndices[i2];
  87378. let i1 = triangleIndices[i2 + 1];
  87379. let i22 = triangleIndices[i2 + 2];
  87380. const all = false;
  87381. const has01 = all || isHighlighted(edges, i0, i1);
  87382. const has12 = all || isHighlighted(edges, i1, i22);
  87383. const has20 = all || isHighlighted(edges, i22, i0);
  87384. let unmatchableVertexIndex = matchAndStoreCoordinates(
  87385. outlineCoordinates,
  87386. i0,
  87387. i1,
  87388. i22,
  87389. has01,
  87390. has12,
  87391. has20
  87392. );
  87393. while (unmatchableVertexIndex >= 0) {
  87394. let copy;
  87395. if (unmatchableVertexIndex === i0) {
  87396. copy = vertexCopies[i0];
  87397. } else if (unmatchableVertexIndex === i1) {
  87398. copy = vertexCopies[i1];
  87399. } else {
  87400. copy = vertexCopies[i22];
  87401. }
  87402. if (copy === void 0) {
  87403. copy = numVertices + extraVertices.length;
  87404. let original2 = unmatchableVertexIndex;
  87405. while (original2 >= numVertices) {
  87406. original2 = extraVertices[original2 - numVertices];
  87407. }
  87408. extraVertices.push(original2);
  87409. vertexCopies[unmatchableVertexIndex] = copy;
  87410. }
  87411. if (copy > MAX_GLTF_UINT16_INDEX && triangleIndices instanceof Uint16Array) {
  87412. triangleIndices = new Uint32Array(triangleIndices);
  87413. triangleIndexAccessorGltf.componentType = 5125;
  87414. triangleIndexBufferViewGltf.buffer = gltf.buffers.push({
  87415. byteLength: triangleIndices.byteLength,
  87416. extras: {
  87417. _pipeline: {
  87418. source: triangleIndices.buffer
  87419. }
  87420. }
  87421. }) - 1;
  87422. triangleIndexBufferViewGltf.byteLength = triangleIndices.byteLength;
  87423. triangleIndexBufferViewGltf.byteOffset = 0;
  87424. model._loadResources.buffers[triangleIndexBufferViewGltf.buffer] = new Uint8Array(
  87425. triangleIndices.buffer,
  87426. 0,
  87427. triangleIndices.byteLength
  87428. );
  87429. loadResources.indexBuffersToCreate._array.forEach(function(toCreate) {
  87430. if (toCreate.id === triangleIndexAccessorGltf.bufferView) {
  87431. toCreate.componentType = triangleIndexAccessorGltf.componentType;
  87432. }
  87433. });
  87434. }
  87435. if (unmatchableVertexIndex === i0) {
  87436. i0 = copy;
  87437. triangleIndices[i2] = copy;
  87438. } else if (unmatchableVertexIndex === i1) {
  87439. i1 = copy;
  87440. triangleIndices[i2 + 1] = copy;
  87441. } else {
  87442. i22 = copy;
  87443. triangleIndices[i2 + 2] = copy;
  87444. }
  87445. if (defined_default(triangleIndexAccessorGltf.max)) {
  87446. triangleIndexAccessorGltf.max[0] = Math.max(
  87447. triangleIndexAccessorGltf.max[0],
  87448. copy
  87449. );
  87450. }
  87451. unmatchableVertexIndex = matchAndStoreCoordinates(
  87452. outlineCoordinates,
  87453. i0,
  87454. i1,
  87455. i22,
  87456. has01,
  87457. has12,
  87458. has20
  87459. );
  87460. }
  87461. }
  87462. }
  87463. function computeOrderMask(outlineCoordinates, vertexIndex, a4, b, c14) {
  87464. const startIndex = vertexIndex * 3;
  87465. const first = outlineCoordinates[startIndex];
  87466. const second = outlineCoordinates[startIndex + 1];
  87467. const third = outlineCoordinates[startIndex + 2];
  87468. if (first === void 0) {
  87469. return 63;
  87470. }
  87471. return ((first === a4 && second === b && third === c14) << 0) + ((first === a4 && second === c14 && third === b) << 1) + ((first === b && second === a4 && third === c14) << 2) + ((first === b && second === c14 && third === a4) << 3) + ((first === c14 && second === a4 && third === b) << 4) + ((first === c14 && second === b && third === a4) << 5);
  87472. }
  87473. function popcount0to63(value) {
  87474. return (value & 1) + (value >> 1 & 1) + (value >> 2 & 1) + (value >> 3 & 1) + (value >> 4 & 1) + (value >> 5 & 1);
  87475. }
  87476. function matchAndStoreCoordinates(outlineCoordinates, i0, i1, i2, has01, has12, has20) {
  87477. const a0 = has20 ? 1 : 0;
  87478. const b0 = has01 ? 1 : 0;
  87479. const c0 = 0;
  87480. const i0Mask = computeOrderMask(outlineCoordinates, i0, a0, b0, c0);
  87481. if (i0Mask === 0) {
  87482. return i0;
  87483. }
  87484. const a1 = 0;
  87485. const b1 = has01 ? 1 : 0;
  87486. const c14 = has12 ? 1 : 0;
  87487. const i1Mask = computeOrderMask(outlineCoordinates, i1, a1, b1, c14);
  87488. if (i1Mask === 0) {
  87489. return i1;
  87490. }
  87491. const a22 = has20 ? 1 : 0;
  87492. const b2 = 0;
  87493. const c22 = has12 ? 1 : 0;
  87494. const i2Mask = computeOrderMask(outlineCoordinates, i2, a22, b2, c22);
  87495. if (i2Mask === 0) {
  87496. return i2;
  87497. }
  87498. const workingOrders = i0Mask & i1Mask & i2Mask;
  87499. let a4, b, c15;
  87500. if (workingOrders & 1 << 0) {
  87501. a4 = 0;
  87502. b = 1;
  87503. c15 = 2;
  87504. } else if (workingOrders & 1 << 1) {
  87505. a4 = 0;
  87506. c15 = 1;
  87507. b = 2;
  87508. } else if (workingOrders & 1 << 2) {
  87509. b = 0;
  87510. a4 = 1;
  87511. c15 = 2;
  87512. } else if (workingOrders & 1 << 3) {
  87513. b = 0;
  87514. c15 = 1;
  87515. a4 = 2;
  87516. } else if (workingOrders & 1 << 4) {
  87517. c15 = 0;
  87518. a4 = 1;
  87519. b = 2;
  87520. } else if (workingOrders & 1 << 5) {
  87521. c15 = 0;
  87522. b = 1;
  87523. a4 = 2;
  87524. } else {
  87525. const i0Popcount = popcount0to63(i0Mask);
  87526. const i1Popcount = popcount0to63(i1Mask);
  87527. const i2Popcount = popcount0to63(i2Mask);
  87528. if (i0Popcount < i1Popcount && i0Popcount < i2Popcount) {
  87529. return i0;
  87530. } else if (i1Popcount < i2Popcount) {
  87531. return i1;
  87532. }
  87533. return i2;
  87534. }
  87535. const i0Start = i0 * 3;
  87536. outlineCoordinates[i0Start + a4] = a0;
  87537. outlineCoordinates[i0Start + b] = b0;
  87538. outlineCoordinates[i0Start + c15] = c0;
  87539. const i1Start = i1 * 3;
  87540. outlineCoordinates[i1Start + a4] = a1;
  87541. outlineCoordinates[i1Start + b] = b1;
  87542. outlineCoordinates[i1Start + c15] = c14;
  87543. const i2Start = i2 * 3;
  87544. outlineCoordinates[i2Start + a4] = a22;
  87545. outlineCoordinates[i2Start + b] = b2;
  87546. outlineCoordinates[i2Start + c15] = c22;
  87547. return -1;
  87548. }
  87549. function isHighlighted(edges, i0, i1) {
  87550. const edgeSmallMultiplier = edges[0];
  87551. const index2 = Math.min(i0, i1) * edgeSmallMultiplier + Math.max(i0, i1);
  87552. return edges[index2] === 1;
  87553. }
  87554. function createTexture3(size) {
  87555. const texture = new Uint8Array(size);
  87556. texture[size - 1] = 192;
  87557. if (size === 8) {
  87558. texture[size - 1] = 96;
  87559. } else if (size === 4) {
  87560. texture[size - 1] = 48;
  87561. } else if (size === 2) {
  87562. texture[size - 1] = 24;
  87563. } else if (size === 1) {
  87564. texture[size - 1] = 12;
  87565. }
  87566. return texture;
  87567. }
  87568. function updateBufferViewsWithNewVertices(model, bufferViews) {
  87569. const gltf = model.gltf;
  87570. const loadResources = model._loadResources;
  87571. let i2, j;
  87572. for (i2 = 0; i2 < bufferViews.length; ++i2) {
  87573. const bufferView = bufferViews[i2];
  87574. const vertexNumberingScope = bufferView.extras._pipeline.vertexNumberingScope;
  87575. bufferView.extras._pipeline.vertexNumberingScope = void 0;
  87576. const newVertices = vertexNumberingScope.extraVertices;
  87577. const sourceData = loadResources.getBuffer(bufferView);
  87578. const byteStride = bufferView.byteStride || 4;
  87579. const newVerticesLength = newVertices.length;
  87580. const destData = new Uint8Array(
  87581. sourceData.byteLength + newVerticesLength * byteStride
  87582. );
  87583. destData.set(sourceData);
  87584. for (j = 0; j < newVerticesLength; ++j) {
  87585. const sourceIndex = newVertices[j] * byteStride;
  87586. const destIndex = sourceData.length + j * byteStride;
  87587. for (let k = 0; k < byteStride; ++k) {
  87588. destData[destIndex + k] = destData[sourceIndex + k];
  87589. }
  87590. }
  87591. bufferView.byteOffset = 0;
  87592. bufferView.byteLength = destData.byteLength;
  87593. const bufferId = gltf.buffers.push({
  87594. byteLength: destData.byteLength,
  87595. extras: {
  87596. _pipeline: {
  87597. source: destData.buffer
  87598. }
  87599. }
  87600. }) - 1;
  87601. bufferView.buffer = bufferId;
  87602. loadResources.buffers[bufferId] = destData;
  87603. const accessors = vertexNumberingScope.accessors;
  87604. for (j = 0; j < accessors.length; ++j) {
  87605. const accessorId = accessors[j];
  87606. gltf.accessors[accessorId].count += newVerticesLength;
  87607. }
  87608. if (!vertexNumberingScope.createdOutlines) {
  87609. const outlineCoordinates = vertexNumberingScope.outlineCoordinates;
  87610. const outlineCoordinateBuffer = new Float32Array(outlineCoordinates);
  87611. const bufferIndex = model.gltf.buffers.push({
  87612. byteLength: outlineCoordinateBuffer.byteLength,
  87613. extras: {
  87614. _pipeline: {
  87615. source: outlineCoordinateBuffer.buffer
  87616. }
  87617. }
  87618. }) - 1;
  87619. loadResources.buffers[bufferIndex] = new Uint8Array(
  87620. outlineCoordinateBuffer.buffer,
  87621. 0,
  87622. outlineCoordinateBuffer.byteLength
  87623. );
  87624. const bufferViewIndex = model.gltf.bufferViews.push({
  87625. buffer: bufferIndex,
  87626. byteLength: outlineCoordinateBuffer.byteLength,
  87627. byteOffset: 0,
  87628. byteStride: 3 * Float32Array.BYTES_PER_ELEMENT,
  87629. target: 34962
  87630. }) - 1;
  87631. const accessorIndex = model.gltf.accessors.push({
  87632. bufferView: bufferViewIndex,
  87633. byteOffset: 0,
  87634. componentType: 5126,
  87635. count: outlineCoordinateBuffer.length / 3,
  87636. type: "VEC3",
  87637. min: [0, 0, 0],
  87638. max: [1, 1, 1]
  87639. }) - 1;
  87640. const primitives = vertexNumberingScope.primitives;
  87641. for (j = 0; j < primitives.length; ++j) {
  87642. primitives[j].attributes._OUTLINE_COORDINATES = accessorIndex;
  87643. }
  87644. loadResources.vertexBuffersToCreate.enqueue(bufferViewIndex);
  87645. vertexNumberingScope.createdOutlines = true;
  87646. }
  87647. }
  87648. }
  87649. function compactBuffers(model) {
  87650. const gltf = model.gltf;
  87651. const loadResources = model._loadResources;
  87652. let i2;
  87653. for (i2 = 0; i2 < gltf.buffers.length; ++i2) {
  87654. const buffer = gltf.buffers[i2];
  87655. const bufferViewsUsingThisBuffer = gltf.bufferViews.filter(
  87656. usesBuffer.bind(void 0, i2)
  87657. );
  87658. const newLength = bufferViewsUsingThisBuffer.reduce(
  87659. function(previous, current) {
  87660. return previous + current.byteLength;
  87661. },
  87662. 0
  87663. );
  87664. if (newLength === buffer.byteLength) {
  87665. continue;
  87666. }
  87667. const newBuffer = new Uint8Array(newLength);
  87668. let offset2 = 0;
  87669. for (let j = 0; j < bufferViewsUsingThisBuffer.length; ++j) {
  87670. const bufferView = bufferViewsUsingThisBuffer[j];
  87671. const sourceData = loadResources.getBuffer(bufferView);
  87672. newBuffer.set(sourceData, offset2);
  87673. bufferView.byteOffset = offset2;
  87674. offset2 += sourceData.byteLength;
  87675. }
  87676. loadResources.buffers[i2] = newBuffer;
  87677. buffer.extras._pipeline.source = newBuffer.buffer;
  87678. buffer.byteLength = newLength;
  87679. }
  87680. }
  87681. function usesBuffer(bufferId, bufferView) {
  87682. return bufferView.buffer === bufferId;
  87683. }
  87684. function getVertexNumberingScope(model, primitive) {
  87685. const attributes = primitive.attributes;
  87686. if (attributes === void 0) {
  87687. return void 0;
  87688. }
  87689. const gltf = model.gltf;
  87690. let vertexNumberingScope;
  87691. for (const semantic in attributes) {
  87692. if (!attributes.hasOwnProperty(semantic)) {
  87693. continue;
  87694. }
  87695. const accessorId = attributes[semantic];
  87696. const accessor = gltf.accessors[accessorId];
  87697. const bufferViewId = accessor.bufferView;
  87698. const bufferView = gltf.bufferViews[bufferViewId];
  87699. if (!defined_default(bufferView.extras)) {
  87700. bufferView.extras = {};
  87701. }
  87702. if (!defined_default(bufferView.extras._pipeline)) {
  87703. bufferView.extras._pipeline = {};
  87704. }
  87705. if (!defined_default(bufferView.extras._pipeline.vertexNumberingScope)) {
  87706. bufferView.extras._pipeline.vertexNumberingScope = vertexNumberingScope || {
  87707. vertexCopies: [],
  87708. extraVertices: [],
  87709. outlineCoordinates: [],
  87710. accessors: [],
  87711. bufferViews: [],
  87712. primitives: [],
  87713. createdOutlines: false
  87714. };
  87715. } else if (vertexNumberingScope !== void 0 && bufferView.extras._pipeline.vertexNumberingScope !== vertexNumberingScope) {
  87716. return void 0;
  87717. }
  87718. vertexNumberingScope = bufferView.extras._pipeline.vertexNumberingScope;
  87719. if (vertexNumberingScope.bufferViews.indexOf(bufferView) < 0) {
  87720. vertexNumberingScope.bufferViews.push(bufferView);
  87721. }
  87722. if (vertexNumberingScope.accessors.indexOf(accessorId) < 0) {
  87723. vertexNumberingScope.accessors.push(accessorId);
  87724. }
  87725. }
  87726. vertexNumberingScope.primitives.push(primitive);
  87727. return vertexNumberingScope;
  87728. }
  87729. var ModelOutlineLoader_default = ModelOutlineLoader;
  87730. // node_modules/cesium/Source/Scene/SplitDirection.js
  87731. var SplitDirection = {
  87732. LEFT: -1,
  87733. NONE: 0,
  87734. RIGHT: 1
  87735. };
  87736. var SplitDirection_default = Object.freeze(SplitDirection);
  87737. // node_modules/cesium/Source/Scene/Splitter.js
  87738. var Splitter = {
  87739. modifyFragmentShader: function modifyFragmentShader(shader) {
  87740. shader = ShaderSource_default.replaceMain(shader, "czm_splitter_main");
  87741. shader += "uniform float czm_splitDirection; \nvoid main() \n{ \n#ifndef SHADOW_MAP\n if (czm_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard; \n if (czm_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard; \n#endif\n czm_splitter_main(); \n} \n";
  87742. return shader;
  87743. },
  87744. addUniforms: function addUniforms(object2, uniformMap2) {
  87745. uniformMap2.czm_splitDirection = function() {
  87746. return object2.splitDirection;
  87747. };
  87748. }
  87749. };
  87750. var Splitter_default = Splitter;
  87751. // node_modules/cesium/Source/Scene/Model.js
  87752. var boundingSphereCartesian3Scratch2 = new Cartesian3_default();
  87753. var ModelState2 = ModelUtility_default.ModelState;
  87754. var defaultModelAccept = "model/gltf-binary,model/gltf+json;q=0.8,application/json;q=0.2,*/*;q=0.01";
  87755. var articulationEpsilon = Math_default.EPSILON16;
  87756. function setCachedGltf(model, cachedGltf) {
  87757. model._cachedGltf = cachedGltf;
  87758. }
  87759. function CachedGltf(options) {
  87760. this._gltf = options.gltf;
  87761. this.ready = options.ready;
  87762. this.modelsToLoad = [];
  87763. this.count = 0;
  87764. }
  87765. Object.defineProperties(CachedGltf.prototype, {
  87766. gltf: {
  87767. set: function(value) {
  87768. this._gltf = value;
  87769. },
  87770. get: function() {
  87771. return this._gltf;
  87772. }
  87773. }
  87774. });
  87775. CachedGltf.prototype.makeReady = function(gltfJson) {
  87776. this.gltf = gltfJson;
  87777. const models = this.modelsToLoad;
  87778. const length3 = models.length;
  87779. for (let i2 = 0; i2 < length3; ++i2) {
  87780. const m = models[i2];
  87781. if (!m.isDestroyed()) {
  87782. setCachedGltf(m, this);
  87783. }
  87784. }
  87785. this.modelsToLoad = void 0;
  87786. this.ready = true;
  87787. };
  87788. var gltfCache = {};
  87789. var uriToGuid = {};
  87790. function Model(options) {
  87791. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  87792. const cacheKey = options.cacheKey;
  87793. this._cacheKey = cacheKey;
  87794. this._cachedGltf = void 0;
  87795. this._releaseGltfJson = defaultValue_default(options.releaseGltfJson, false);
  87796. let cachedGltf;
  87797. if (defined_default(cacheKey) && defined_default(gltfCache[cacheKey]) && gltfCache[cacheKey].ready) {
  87798. cachedGltf = gltfCache[cacheKey];
  87799. ++cachedGltf.count;
  87800. } else {
  87801. let gltf = options.gltf;
  87802. if (defined_default(gltf)) {
  87803. if (gltf instanceof ArrayBuffer) {
  87804. gltf = new Uint8Array(gltf);
  87805. }
  87806. if (gltf instanceof Uint8Array) {
  87807. const parsedGltf = parseGlb_default(gltf);
  87808. cachedGltf = new CachedGltf({
  87809. gltf: parsedGltf,
  87810. ready: true
  87811. });
  87812. } else {
  87813. cachedGltf = new CachedGltf({
  87814. gltf: options.gltf,
  87815. ready: true
  87816. });
  87817. }
  87818. cachedGltf.count = 1;
  87819. if (defined_default(cacheKey)) {
  87820. gltfCache[cacheKey] = cachedGltf;
  87821. }
  87822. }
  87823. }
  87824. setCachedGltf(this, cachedGltf);
  87825. const basePath = defaultValue_default(options.basePath, "");
  87826. this._resource = Resource_default.createIfNeeded(basePath);
  87827. let credit = options.credit;
  87828. if (typeof credit === "string") {
  87829. credit = new Credit_default(credit);
  87830. }
  87831. this._credit = credit;
  87832. this._resourceCredits = [];
  87833. this._gltfCredits = [];
  87834. this._showCreditsOnScreen = defaultValue_default(options.showCreditsOnScreen, false);
  87835. this.show = defaultValue_default(options.show, true);
  87836. this.silhouetteColor = defaultValue_default(options.silhouetteColor, Color_default.RED);
  87837. this._silhouetteColor = new Color_default();
  87838. this._silhouetteColorPreviousAlpha = 1;
  87839. this._normalAttributeName = void 0;
  87840. this.silhouetteSize = defaultValue_default(options.silhouetteSize, 0);
  87841. this.modelMatrix = Matrix4_default.clone(
  87842. defaultValue_default(options.modelMatrix, Matrix4_default.IDENTITY)
  87843. );
  87844. this._modelMatrix = Matrix4_default.clone(this.modelMatrix);
  87845. this._clampedModelMatrix = void 0;
  87846. this.scale = defaultValue_default(options.scale, 1);
  87847. this._scale = this.scale;
  87848. this.minimumPixelSize = defaultValue_default(options.minimumPixelSize, 0);
  87849. this._minimumPixelSize = this.minimumPixelSize;
  87850. this.maximumScale = options.maximumScale;
  87851. this._maximumScale = this.maximumScale;
  87852. this.id = options.id;
  87853. this._id = options.id;
  87854. this.heightReference = defaultValue_default(
  87855. options.heightReference,
  87856. HeightReference_default.NONE
  87857. );
  87858. this._heightReference = this.heightReference;
  87859. this._heightChanged = false;
  87860. this._removeUpdateHeightCallback = void 0;
  87861. const scene = options.scene;
  87862. this._scene = scene;
  87863. if (defined_default(scene) && defined_default(scene.terrainProviderChanged)) {
  87864. this._terrainProviderChangedCallback = scene.terrainProviderChanged.addEventListener(
  87865. function() {
  87866. this._heightChanged = true;
  87867. },
  87868. this
  87869. );
  87870. }
  87871. this._pickObject = options.pickObject;
  87872. this._allowPicking = defaultValue_default(options.allowPicking, true);
  87873. this._ready = false;
  87874. this._readyPromise = defer_default();
  87875. this.activeAnimations = new ModelAnimationCollection_default(this);
  87876. this.clampAnimations = defaultValue_default(options.clampAnimations, true);
  87877. this._defaultTexture = void 0;
  87878. this._incrementallyLoadTextures = defaultValue_default(
  87879. options.incrementallyLoadTextures,
  87880. true
  87881. );
  87882. this._asynchronous = defaultValue_default(options.asynchronous, true);
  87883. this.shadows = defaultValue_default(options.shadows, ShadowMode_default.ENABLED);
  87884. this._shadows = this.shadows;
  87885. this.color = Color_default.clone(defaultValue_default(options.color, Color_default.WHITE));
  87886. this._colorPreviousAlpha = 1;
  87887. this.colorBlendMode = defaultValue_default(
  87888. options.colorBlendMode,
  87889. ColorBlendMode_default.HIGHLIGHT
  87890. );
  87891. this.colorBlendAmount = defaultValue_default(options.colorBlendAmount, 0.5);
  87892. this._colorShadingEnabled = false;
  87893. this._clippingPlanes = void 0;
  87894. this.clippingPlanes = options.clippingPlanes;
  87895. this._clippingPlanesState = 0;
  87896. this.referenceMatrix = void 0;
  87897. this.backFaceCulling = defaultValue_default(options.backFaceCulling, true);
  87898. this.showOutline = defaultValue_default(options.showOutline, true);
  87899. this.splitDirection = defaultValue_default(
  87900. options.splitDirection,
  87901. SplitDirection_default.NONE
  87902. );
  87903. this._splittingEnabled = false;
  87904. this.debugShowBoundingVolume = defaultValue_default(
  87905. options.debugShowBoundingVolume,
  87906. false
  87907. );
  87908. this._debugShowBoundingVolume = false;
  87909. this.debugWireframe = defaultValue_default(options.debugWireframe, false);
  87910. this._debugWireframe = false;
  87911. this._distanceDisplayCondition = options.distanceDisplayCondition;
  87912. this._addBatchIdToGeneratedShaders = options.addBatchIdToGeneratedShaders;
  87913. this._precreatedAttributes = options.precreatedAttributes;
  87914. this._vertexShaderLoaded = options.vertexShaderLoaded;
  87915. this._fragmentShaderLoaded = options.fragmentShaderLoaded;
  87916. this._uniformMapLoaded = options.uniformMapLoaded;
  87917. this._pickIdLoaded = options.pickIdLoaded;
  87918. this._ignoreCommands = defaultValue_default(options.ignoreCommands, false);
  87919. this._requestType = options.requestType;
  87920. this._upAxis = defaultValue_default(options.upAxis, Axis_default.Y);
  87921. this._gltfForwardAxis = Axis_default.Z;
  87922. this._forwardAxis = options.forwardAxis;
  87923. this.cull = defaultValue_default(options.cull, true);
  87924. this.opaquePass = defaultValue_default(options.opaquePass, Pass_default.OPAQUE);
  87925. this._computedModelMatrix = new Matrix4_default();
  87926. this._clippingPlanesMatrix = Matrix4_default.clone(Matrix4_default.IDENTITY);
  87927. this._iblReferenceFrameMatrix = Matrix3_default.clone(Matrix3_default.IDENTITY);
  87928. this._initialRadius = void 0;
  87929. this._boundingSphere = void 0;
  87930. this._scaledBoundingSphere = new BoundingSphere_default();
  87931. this._state = ModelState2.NEEDS_LOAD;
  87932. this._loadResources = void 0;
  87933. this._mode = void 0;
  87934. this._perNodeShowDirty = false;
  87935. this._cesiumAnimationsDirty = false;
  87936. this._dirty = false;
  87937. this._maxDirtyNumber = 0;
  87938. this._runtime = {
  87939. animations: void 0,
  87940. articulationsByName: void 0,
  87941. articulationsByStageKey: void 0,
  87942. stagesByKey: void 0,
  87943. rootNodes: void 0,
  87944. nodes: void 0,
  87945. nodesByName: void 0,
  87946. skinnedNodes: void 0,
  87947. meshesByName: void 0,
  87948. materialsByName: void 0,
  87949. materialsById: void 0
  87950. };
  87951. this._uniformMaps = {};
  87952. this._extensionsUsed = void 0;
  87953. this._extensionsRequired = void 0;
  87954. this._quantizedUniforms = {};
  87955. this._programPrimitives = {};
  87956. this._rendererResources = {
  87957. buffers: {},
  87958. vertexArrays: {},
  87959. programs: {},
  87960. sourceShaders: {},
  87961. silhouettePrograms: {},
  87962. textures: {},
  87963. samplers: {},
  87964. renderStates: {}
  87965. };
  87966. this._cachedRendererResources = void 0;
  87967. this._loadRendererResourcesFromCache = false;
  87968. this._dequantizeInShader = defaultValue_default(options.dequantizeInShader, true);
  87969. this._decodedData = {};
  87970. this._cachedGeometryByteLength = 0;
  87971. this._cachedTexturesByteLength = 0;
  87972. this._geometryByteLength = 0;
  87973. this._texturesByteLength = 0;
  87974. this._trianglesLength = 0;
  87975. this._pointsLength = 0;
  87976. this._sourceTechniques = {};
  87977. this._sourcePrograms = {};
  87978. this._quantizedVertexShaders = {};
  87979. this._nodeCommands = [];
  87980. this._pickIds = [];
  87981. this._rtcCenter = void 0;
  87982. this._rtcCenterEye = void 0;
  87983. this._rtcCenter3D = void 0;
  87984. this._rtcCenter2D = void 0;
  87985. this._sourceVersion = void 0;
  87986. this._sourceKHRTechniquesWebGL = void 0;
  87987. this._lightColor = Cartesian3_default.clone(options.lightColor);
  87988. const hasIndividualIBLParameters = defined_default(options.imageBasedLightingFactor) || defined_default(options.luminanceAtZenith) || defined_default(options.sphericalHarmonicCoefficients) || defined_default(options.specularEnvironmentMaps);
  87989. if (defined_default(options.imageBasedLighting)) {
  87990. this._imageBasedLighting = options.imageBasedLighting;
  87991. this._shouldDestroyImageBasedLighting = false;
  87992. } else if (hasIndividualIBLParameters) {
  87993. deprecationWarning_default(
  87994. "ImageBasedLightingConstructor",
  87995. "Individual image-based lighting parameters were deprecated in Cesium 1.92. They will be removed in version 1.94. Use options.imageBasedLighting instead."
  87996. );
  87997. this._imageBasedLighting = new ImageBasedLighting({
  87998. imageBasedLightingFactor: options.imageBasedLightingFactor,
  87999. luminanceAtZenith: options.luminanceAtZenith,
  88000. sphericalHarmonicCoefficients: options.sphericalHarmonicCoefficients,
  88001. specularEnvironmentMaps: options.specularEnvironmentMaps
  88002. });
  88003. this._shouldDestroyImageBasedLighting = true;
  88004. } else {
  88005. this._imageBasedLighting = new ImageBasedLighting();
  88006. this._shouldDestroyImageBasedLighting = true;
  88007. }
  88008. this._shouldRegenerateShaders = false;
  88009. }
  88010. Object.defineProperties(Model.prototype, {
  88011. gltf: {
  88012. get: function() {
  88013. return defined_default(this._cachedGltf) ? this._cachedGltf.gltf : void 0;
  88014. }
  88015. },
  88016. releaseGltfJson: {
  88017. get: function() {
  88018. return this._releaseGltfJson;
  88019. }
  88020. },
  88021. cacheKey: {
  88022. get: function() {
  88023. return this._cacheKey;
  88024. }
  88025. },
  88026. basePath: {
  88027. get: function() {
  88028. return this._resource.url;
  88029. }
  88030. },
  88031. boundingSphere: {
  88032. get: function() {
  88033. if (this._state !== ModelState2.LOADED) {
  88034. throw new DeveloperError_default(
  88035. "The model is not loaded. Use Model.readyPromise or wait for Model.ready to be true."
  88036. );
  88037. }
  88038. let modelMatrix = this.modelMatrix;
  88039. if (this.heightReference !== HeightReference_default.NONE && this._clampedModelMatrix) {
  88040. modelMatrix = this._clampedModelMatrix;
  88041. }
  88042. const nonUniformScale = Matrix4_default.getScale(
  88043. modelMatrix,
  88044. boundingSphereCartesian3Scratch2
  88045. );
  88046. const scale = defined_default(this.maximumScale) ? Math.min(this.maximumScale, this.scale) : this.scale;
  88047. Cartesian3_default.multiplyByScalar(nonUniformScale, scale, nonUniformScale);
  88048. const scaledBoundingSphere = this._scaledBoundingSphere;
  88049. scaledBoundingSphere.center = Cartesian3_default.multiplyComponents(
  88050. this._boundingSphere.center,
  88051. nonUniformScale,
  88052. scaledBoundingSphere.center
  88053. );
  88054. scaledBoundingSphere.radius = Cartesian3_default.maximumComponent(nonUniformScale) * this._initialRadius;
  88055. if (defined_default(this._rtcCenter)) {
  88056. Cartesian3_default.add(
  88057. this._rtcCenter,
  88058. scaledBoundingSphere.center,
  88059. scaledBoundingSphere.center
  88060. );
  88061. }
  88062. return scaledBoundingSphere;
  88063. }
  88064. },
  88065. ready: {
  88066. get: function() {
  88067. return this._ready;
  88068. }
  88069. },
  88070. readyPromise: {
  88071. get: function() {
  88072. return this._readyPromise.promise;
  88073. }
  88074. },
  88075. asynchronous: {
  88076. get: function() {
  88077. return this._asynchronous;
  88078. }
  88079. },
  88080. allowPicking: {
  88081. get: function() {
  88082. return this._allowPicking;
  88083. }
  88084. },
  88085. incrementallyLoadTextures: {
  88086. get: function() {
  88087. return this._incrementallyLoadTextures;
  88088. }
  88089. },
  88090. pendingTextureLoads: {
  88091. get: function() {
  88092. return defined_default(this._loadResources) ? this._loadResources.pendingTextureLoads : 0;
  88093. }
  88094. },
  88095. dirty: {
  88096. get: function() {
  88097. return this._dirty;
  88098. }
  88099. },
  88100. distanceDisplayCondition: {
  88101. get: function() {
  88102. return this._distanceDisplayCondition;
  88103. },
  88104. set: function(value) {
  88105. if (defined_default(value) && value.far <= value.near) {
  88106. throw new DeveloperError_default("far must be greater than near");
  88107. }
  88108. this._distanceDisplayCondition = DistanceDisplayCondition_default.clone(
  88109. value,
  88110. this._distanceDisplayCondition
  88111. );
  88112. }
  88113. },
  88114. extensionsUsed: {
  88115. get: function() {
  88116. if (!defined_default(this._extensionsUsed)) {
  88117. this._extensionsUsed = ModelUtility_default.getUsedExtensions(this.gltf);
  88118. }
  88119. return this._extensionsUsed;
  88120. }
  88121. },
  88122. extensionsRequired: {
  88123. get: function() {
  88124. if (!defined_default(this._extensionsRequired)) {
  88125. this._extensionsRequired = ModelUtility_default.getRequiredExtensions(
  88126. this.gltf
  88127. );
  88128. }
  88129. return this._extensionsRequired;
  88130. }
  88131. },
  88132. upAxis: {
  88133. get: function() {
  88134. return this._upAxis;
  88135. }
  88136. },
  88137. forwardAxis: {
  88138. get: function() {
  88139. if (defined_default(this._forwardAxis)) {
  88140. return this._forwardAxis;
  88141. }
  88142. return this._gltfForwardAxis;
  88143. }
  88144. },
  88145. trianglesLength: {
  88146. get: function() {
  88147. return this._trianglesLength;
  88148. }
  88149. },
  88150. pointsLength: {
  88151. get: function() {
  88152. return this._pointsLength;
  88153. }
  88154. },
  88155. geometryByteLength: {
  88156. get: function() {
  88157. return this._geometryByteLength;
  88158. }
  88159. },
  88160. texturesByteLength: {
  88161. get: function() {
  88162. return this._texturesByteLength;
  88163. }
  88164. },
  88165. cachedGeometryByteLength: {
  88166. get: function() {
  88167. return this._cachedGeometryByteLength;
  88168. }
  88169. },
  88170. cachedTexturesByteLength: {
  88171. get: function() {
  88172. return this._cachedTexturesByteLength;
  88173. }
  88174. },
  88175. clippingPlanes: {
  88176. get: function() {
  88177. return this._clippingPlanes;
  88178. },
  88179. set: function(value) {
  88180. if (value === this._clippingPlanes) {
  88181. return;
  88182. }
  88183. ClippingPlaneCollection_default.setOwner(value, this, "_clippingPlanes");
  88184. }
  88185. },
  88186. pickIds: {
  88187. get: function() {
  88188. return this._pickIds;
  88189. }
  88190. },
  88191. lightColor: {
  88192. get: function() {
  88193. return this._lightColor;
  88194. },
  88195. set: function(value) {
  88196. const lightColor = this._lightColor;
  88197. if (value === lightColor || Cartesian3_default.equals(value, lightColor)) {
  88198. return;
  88199. }
  88200. this._shouldRegenerateShaders = this._shouldRegenerateShaders || defined_default(lightColor) && !defined_default(value) || defined_default(value) && !defined_default(lightColor);
  88201. this._lightColor = Cartesian3_default.clone(value, lightColor);
  88202. }
  88203. },
  88204. imageBasedLighting: {
  88205. get: function() {
  88206. return this._imageBasedLighting;
  88207. },
  88208. set: function(value) {
  88209. Check_default.typeOf.object("imageBasedLighting", this._imageBasedLighting);
  88210. if (value !== this._imageBasedLighting) {
  88211. if (this._shouldDestroyImageBasedLighting && !this._imageBasedLighting.isDestroyed()) {
  88212. this._imageBasedLighting.destroy();
  88213. }
  88214. this._imageBasedLighting = value;
  88215. this._shouldDestroyImageBasedLighting = false;
  88216. this._shouldRegenerateShaders = true;
  88217. }
  88218. }
  88219. },
  88220. imageBasedLightingFactor: {
  88221. get: function() {
  88222. return this._imageBasedLighting.imageBasedLightingFactor;
  88223. },
  88224. set: function(value) {
  88225. this._imageBasedLighting.imageBasedLightingFactor = value;
  88226. }
  88227. },
  88228. luminanceAtZenith: {
  88229. get: function() {
  88230. return this._imageBasedLighting.luminanceAtZenith;
  88231. },
  88232. set: function(value) {
  88233. this._imageBasedLighting.luminanceAtZenith = value;
  88234. }
  88235. },
  88236. sphericalHarmonicCoefficients: {
  88237. get: function() {
  88238. return this._imageBasedLighting.sphericalHarmonicCoefficients;
  88239. },
  88240. set: function(value) {
  88241. this._imageBasedLighting.sphericalHarmonicCoefficients = value;
  88242. }
  88243. },
  88244. specularEnvironmentMaps: {
  88245. get: function() {
  88246. return this._imageBasedLighting.specularEnvironmentMaps;
  88247. },
  88248. set: function(value) {
  88249. this._imageBasedLighting.specularEnvironmentMaps = value;
  88250. }
  88251. },
  88252. credit: {
  88253. get: function() {
  88254. return this._credit;
  88255. }
  88256. },
  88257. showCreditsOnScreen: {
  88258. get: function() {
  88259. return this._showCreditsOnScreen;
  88260. },
  88261. set: function(value) {
  88262. if (this._showCreditsOnScreen !== value) {
  88263. if (defined_default(this._credit)) {
  88264. this._credit.showOnScreen = value;
  88265. }
  88266. const resourceCreditsLength = this._resourceCredits.length;
  88267. for (let i2 = 0; i2 < resourceCreditsLength; i2++) {
  88268. this._resourceCredits[i2].showOnScreen = value;
  88269. }
  88270. const gltfCreditsLength = this._gltfCredits.length;
  88271. for (let i2 = 0; i2 < gltfCreditsLength; i2++) {
  88272. this._gltfCredits[i2].showOnScreen = value;
  88273. }
  88274. }
  88275. this._showCreditsOnScreen = value;
  88276. }
  88277. }
  88278. });
  88279. function silhouetteSupported(context) {
  88280. return context.stencilBuffer;
  88281. }
  88282. function isColorShadingEnabled(model) {
  88283. return !Color_default.equals(model.color, Color_default.WHITE) || model.colorBlendMode !== ColorBlendMode_default.HIGHLIGHT;
  88284. }
  88285. function isClippingEnabled(model) {
  88286. const clippingPlanes = model._clippingPlanes;
  88287. return defined_default(clippingPlanes) && clippingPlanes.enabled && clippingPlanes.length !== 0;
  88288. }
  88289. Model.silhouetteSupported = function(scene) {
  88290. return silhouetteSupported(scene.context);
  88291. };
  88292. function containsGltfMagic(uint8Array) {
  88293. const magic = getMagic_default(uint8Array);
  88294. return magic === "glTF";
  88295. }
  88296. Model.fromGltf = function(options) {
  88297. if (!defined_default(options) || !defined_default(options.url)) {
  88298. throw new DeveloperError_default("options.url is required");
  88299. }
  88300. const url2 = options.url;
  88301. options = clone_default(options);
  88302. const modelResource = Resource_default.createIfNeeded(url2);
  88303. const basePath = defaultValue_default(options.basePath, modelResource.clone());
  88304. const resource = Resource_default.createIfNeeded(basePath);
  88305. let cacheKey = defaultValue_default(
  88306. options.cacheKey,
  88307. uriToGuid[getAbsoluteUri_default(modelResource.url)]
  88308. );
  88309. if (!defined_default(cacheKey)) {
  88310. cacheKey = createGuid_default();
  88311. uriToGuid[getAbsoluteUri_default(modelResource.url)] = cacheKey;
  88312. }
  88313. if (defined_default(options.basePath) && !defined_default(options.cacheKey)) {
  88314. cacheKey += resource.url;
  88315. }
  88316. options.cacheKey = cacheKey;
  88317. options.basePath = resource;
  88318. const model = new Model(options);
  88319. let cachedGltf = gltfCache[cacheKey];
  88320. if (!defined_default(cachedGltf)) {
  88321. cachedGltf = new CachedGltf({
  88322. ready: false
  88323. });
  88324. cachedGltf.count = 1;
  88325. cachedGltf.modelsToLoad.push(model);
  88326. setCachedGltf(model, cachedGltf);
  88327. gltfCache[cacheKey] = cachedGltf;
  88328. if (!defined_default(modelResource.headers.Accept)) {
  88329. modelResource.headers.Accept = defaultModelAccept;
  88330. }
  88331. modelResource.fetchArrayBuffer().then(function(arrayBuffer) {
  88332. const array = new Uint8Array(arrayBuffer);
  88333. if (containsGltfMagic(array)) {
  88334. const parsedGltf = parseGlb_default(array);
  88335. cachedGltf.makeReady(parsedGltf);
  88336. } else {
  88337. const json = getJsonFromTypedArray_default(array);
  88338. cachedGltf.makeReady(json);
  88339. }
  88340. const resourceCredits = model._resourceCredits;
  88341. const credits = modelResource.credits;
  88342. if (defined_default(credits)) {
  88343. const length3 = credits.length;
  88344. for (let i2 = 0; i2 < length3; i2++) {
  88345. resourceCredits.push(credits[i2]);
  88346. }
  88347. }
  88348. }).catch(
  88349. ModelUtility_default.getFailedLoadFunction(model, "model", modelResource.url)
  88350. );
  88351. } else if (!cachedGltf.ready) {
  88352. ++cachedGltf.count;
  88353. cachedGltf.modelsToLoad.push(model);
  88354. }
  88355. return model;
  88356. };
  88357. Model._gltfCache = gltfCache;
  88358. function getRuntime(model, runtimeName, name) {
  88359. if (model._state !== ModelState2.LOADED) {
  88360. throw new DeveloperError_default(
  88361. "The model is not loaded. Use Model.readyPromise or wait for Model.ready to be true."
  88362. );
  88363. }
  88364. if (!defined_default(name)) {
  88365. throw new DeveloperError_default("name is required.");
  88366. }
  88367. return model._runtime[runtimeName][name];
  88368. }
  88369. Model.prototype.getNode = function(name) {
  88370. const node = getRuntime(this, "nodesByName", name);
  88371. return defined_default(node) ? node.publicNode : void 0;
  88372. };
  88373. Model.prototype.getMesh = function(name) {
  88374. return getRuntime(this, "meshesByName", name);
  88375. };
  88376. Model.prototype.getMaterial = function(name) {
  88377. return getRuntime(this, "materialsByName", name);
  88378. };
  88379. Model.prototype.setArticulationStage = function(articulationStageKey, value) {
  88380. Check_default.typeOf.number("value", value);
  88381. const stage = getRuntime(this, "stagesByKey", articulationStageKey);
  88382. const articulation = getRuntime(
  88383. this,
  88384. "articulationsByStageKey",
  88385. articulationStageKey
  88386. );
  88387. if (defined_default(stage) && defined_default(articulation)) {
  88388. value = Math_default.clamp(value, stage.minimumValue, stage.maximumValue);
  88389. if (!Math_default.equalsEpsilon(stage.currentValue, value, articulationEpsilon)) {
  88390. stage.currentValue = value;
  88391. articulation.isDirty = true;
  88392. }
  88393. }
  88394. };
  88395. var scratchArticulationCartesian = new Cartesian3_default();
  88396. var scratchArticulationRotation = new Matrix3_default();
  88397. function applyArticulationStageMatrix(stage, result) {
  88398. Check_default.typeOf.object("stage", stage);
  88399. Check_default.typeOf.object("result", result);
  88400. const value = stage.currentValue;
  88401. const cartesian11 = scratchArticulationCartesian;
  88402. let rotation;
  88403. switch (stage.type) {
  88404. case "xRotate":
  88405. rotation = Matrix3_default.fromRotationX(
  88406. Math_default.toRadians(value),
  88407. scratchArticulationRotation
  88408. );
  88409. Matrix4_default.multiplyByMatrix3(result, rotation, result);
  88410. break;
  88411. case "yRotate":
  88412. rotation = Matrix3_default.fromRotationY(
  88413. Math_default.toRadians(value),
  88414. scratchArticulationRotation
  88415. );
  88416. Matrix4_default.multiplyByMatrix3(result, rotation, result);
  88417. break;
  88418. case "zRotate":
  88419. rotation = Matrix3_default.fromRotationZ(
  88420. Math_default.toRadians(value),
  88421. scratchArticulationRotation
  88422. );
  88423. Matrix4_default.multiplyByMatrix3(result, rotation, result);
  88424. break;
  88425. case "xTranslate":
  88426. cartesian11.x = value;
  88427. cartesian11.y = 0;
  88428. cartesian11.z = 0;
  88429. Matrix4_default.multiplyByTranslation(result, cartesian11, result);
  88430. break;
  88431. case "yTranslate":
  88432. cartesian11.x = 0;
  88433. cartesian11.y = value;
  88434. cartesian11.z = 0;
  88435. Matrix4_default.multiplyByTranslation(result, cartesian11, result);
  88436. break;
  88437. case "zTranslate":
  88438. cartesian11.x = 0;
  88439. cartesian11.y = 0;
  88440. cartesian11.z = value;
  88441. Matrix4_default.multiplyByTranslation(result, cartesian11, result);
  88442. break;
  88443. case "xScale":
  88444. cartesian11.x = value;
  88445. cartesian11.y = 1;
  88446. cartesian11.z = 1;
  88447. Matrix4_default.multiplyByScale(result, cartesian11, result);
  88448. break;
  88449. case "yScale":
  88450. cartesian11.x = 1;
  88451. cartesian11.y = value;
  88452. cartesian11.z = 1;
  88453. Matrix4_default.multiplyByScale(result, cartesian11, result);
  88454. break;
  88455. case "zScale":
  88456. cartesian11.x = 1;
  88457. cartesian11.y = 1;
  88458. cartesian11.z = value;
  88459. Matrix4_default.multiplyByScale(result, cartesian11, result);
  88460. break;
  88461. case "uniformScale":
  88462. Matrix4_default.multiplyByUniformScale(result, value, result);
  88463. break;
  88464. default:
  88465. break;
  88466. }
  88467. return result;
  88468. }
  88469. var scratchApplyArticulationTransform = new Matrix4_default();
  88470. Model.prototype.applyArticulations = function() {
  88471. const articulationsByName = this._runtime.articulationsByName;
  88472. for (const articulationName in articulationsByName) {
  88473. if (articulationsByName.hasOwnProperty(articulationName)) {
  88474. const articulation = articulationsByName[articulationName];
  88475. if (articulation.isDirty) {
  88476. articulation.isDirty = false;
  88477. const numNodes = articulation.nodes.length;
  88478. for (let n2 = 0; n2 < numNodes; ++n2) {
  88479. const node = articulation.nodes[n2];
  88480. let transform4 = Matrix4_default.clone(
  88481. node.originalMatrix,
  88482. scratchApplyArticulationTransform
  88483. );
  88484. const numStages = articulation.stages.length;
  88485. for (let s2 = 0; s2 < numStages; ++s2) {
  88486. const stage = articulation.stages[s2];
  88487. transform4 = applyArticulationStageMatrix(stage, transform4);
  88488. }
  88489. node.matrix = transform4;
  88490. }
  88491. }
  88492. }
  88493. }
  88494. };
  88495. function addBuffersToLoadResources2(model) {
  88496. const gltf = model.gltf;
  88497. const loadResources = model._loadResources;
  88498. ForEach_default.buffer(gltf, function(buffer, id) {
  88499. loadResources.buffers[id] = buffer.extras._pipeline.source;
  88500. });
  88501. }
  88502. function bufferLoad(model, id) {
  88503. return function(arrayBuffer) {
  88504. const loadResources = model._loadResources;
  88505. const buffer = new Uint8Array(arrayBuffer);
  88506. --loadResources.pendingBufferLoads;
  88507. model.gltf.buffers[id].extras._pipeline.source = buffer;
  88508. };
  88509. }
  88510. function parseBufferViews2(model) {
  88511. const bufferViews = model.gltf.bufferViews;
  88512. const vertexBuffersToCreate = model._loadResources.vertexBuffersToCreate;
  88513. ForEach_default.bufferView(model.gltf, function(bufferView, id) {
  88514. if (bufferView.target === WebGLConstants_default.ARRAY_BUFFER) {
  88515. vertexBuffersToCreate.enqueue(id);
  88516. }
  88517. });
  88518. const indexBuffersToCreate = model._loadResources.indexBuffersToCreate;
  88519. const indexBufferIds = {};
  88520. ForEach_default.accessor(model.gltf, function(accessor) {
  88521. const bufferViewId = accessor.bufferView;
  88522. if (!defined_default(bufferViewId)) {
  88523. return;
  88524. }
  88525. const bufferView = bufferViews[bufferViewId];
  88526. if (bufferView.target === WebGLConstants_default.ELEMENT_ARRAY_BUFFER && !defined_default(indexBufferIds[bufferViewId])) {
  88527. indexBufferIds[bufferViewId] = true;
  88528. indexBuffersToCreate.enqueue({
  88529. id: bufferViewId,
  88530. componentType: accessor.componentType
  88531. });
  88532. }
  88533. });
  88534. }
  88535. function parseTechniques(model) {
  88536. const gltf = model.gltf;
  88537. if (!usesExtension_default(gltf, "KHR_techniques_webgl")) {
  88538. return;
  88539. }
  88540. const sourcePrograms = model._sourcePrograms;
  88541. const sourceTechniques = model._sourceTechniques;
  88542. const programs = gltf.extensions.KHR_techniques_webgl.programs;
  88543. ForEach_default.technique(gltf, function(technique, techniqueId) {
  88544. sourceTechniques[techniqueId] = clone_default(technique);
  88545. const programId = technique.program;
  88546. if (!defined_default(sourcePrograms[programId])) {
  88547. sourcePrograms[programId] = clone_default(programs[programId]);
  88548. }
  88549. });
  88550. }
  88551. function shaderLoad(model, type, id) {
  88552. return function(source) {
  88553. const loadResources = model._loadResources;
  88554. loadResources.shaders[id] = {
  88555. source,
  88556. type,
  88557. bufferView: void 0
  88558. };
  88559. --loadResources.pendingShaderLoads;
  88560. model._rendererResources.sourceShaders[id] = source;
  88561. };
  88562. }
  88563. function parseShaders(model) {
  88564. const gltf = model.gltf;
  88565. const buffers = gltf.buffers;
  88566. const bufferViews = gltf.bufferViews;
  88567. const sourceShaders = model._rendererResources.sourceShaders;
  88568. ForEach_default.shader(gltf, function(shader, id) {
  88569. if (defined_default(shader.bufferView)) {
  88570. const bufferViewId = shader.bufferView;
  88571. const bufferView = bufferViews[bufferViewId];
  88572. const bufferId = bufferView.buffer;
  88573. const buffer = buffers[bufferId];
  88574. const source = getStringFromTypedArray_default(
  88575. buffer.extras._pipeline.source,
  88576. bufferView.byteOffset,
  88577. bufferView.byteLength
  88578. );
  88579. sourceShaders[id] = source;
  88580. } else if (defined_default(shader.extras._pipeline.source)) {
  88581. sourceShaders[id] = shader.extras._pipeline.source;
  88582. } else {
  88583. ++model._loadResources.pendingShaderLoads;
  88584. const shaderResource = model._resource.getDerivedResource({
  88585. url: shader.uri
  88586. });
  88587. shaderResource.fetchText().then(shaderLoad(model, shader.type, id)).catch(
  88588. ModelUtility_default.getFailedLoadFunction(
  88589. model,
  88590. "shader",
  88591. shaderResource.url
  88592. )
  88593. );
  88594. }
  88595. });
  88596. }
  88597. function parsePrograms(model) {
  88598. const sourceTechniques = model._sourceTechniques;
  88599. for (const techniqueId in sourceTechniques) {
  88600. if (sourceTechniques.hasOwnProperty(techniqueId)) {
  88601. const technique = sourceTechniques[techniqueId];
  88602. model._loadResources.programsToCreate.enqueue({
  88603. programId: technique.program,
  88604. techniqueId
  88605. });
  88606. }
  88607. }
  88608. }
  88609. function parseArticulations(model) {
  88610. const articulationsByName = {};
  88611. const articulationsByStageKey = {};
  88612. const runtimeStagesByKey = {};
  88613. model._runtime.articulationsByName = articulationsByName;
  88614. model._runtime.articulationsByStageKey = articulationsByStageKey;
  88615. model._runtime.stagesByKey = runtimeStagesByKey;
  88616. const gltf = model.gltf;
  88617. if (!usesExtension_default(gltf, "AGI_articulations") || !defined_default(gltf.extensions) || !defined_default(gltf.extensions.AGI_articulations)) {
  88618. return;
  88619. }
  88620. const gltfArticulations = gltf.extensions.AGI_articulations.articulations;
  88621. if (!defined_default(gltfArticulations)) {
  88622. return;
  88623. }
  88624. const numArticulations = gltfArticulations.length;
  88625. for (let i2 = 0; i2 < numArticulations; ++i2) {
  88626. const articulation = clone_default(gltfArticulations[i2]);
  88627. articulation.nodes = [];
  88628. articulation.isDirty = true;
  88629. articulationsByName[articulation.name] = articulation;
  88630. const numStages = articulation.stages.length;
  88631. for (let s2 = 0; s2 < numStages; ++s2) {
  88632. const stage = articulation.stages[s2];
  88633. stage.currentValue = stage.initialValue;
  88634. const stageKey = `${articulation.name} ${stage.name}`;
  88635. articulationsByStageKey[stageKey] = articulation;
  88636. runtimeStagesByKey[stageKey] = stage;
  88637. }
  88638. }
  88639. }
  88640. function imageLoad(model, textureId) {
  88641. return function(image) {
  88642. const loadResources = model._loadResources;
  88643. --loadResources.pendingTextureLoads;
  88644. let mipLevels;
  88645. if (Array.isArray(image)) {
  88646. mipLevels = image.slice(1, image.length).map(function(mipLevel) {
  88647. return mipLevel.bufferView;
  88648. });
  88649. image = image[0];
  88650. }
  88651. loadResources.texturesToCreate.enqueue({
  88652. id: textureId,
  88653. image,
  88654. bufferView: image.bufferView,
  88655. width: image.width,
  88656. height: image.height,
  88657. internalFormat: image.internalFormat,
  88658. mipLevels
  88659. });
  88660. };
  88661. }
  88662. var ktx2Regex2 = /(^data:image\/ktx2)|(\.ktx2$)/i;
  88663. function parseTextures(model, context, supportsWebP2) {
  88664. const gltf = model.gltf;
  88665. const images = gltf.images;
  88666. let uri;
  88667. ForEach_default.texture(gltf, function(texture, id) {
  88668. let imageId = texture.source;
  88669. if (defined_default(texture.extensions) && defined_default(texture.extensions.EXT_texture_webp) && supportsWebP2) {
  88670. imageId = texture.extensions.EXT_texture_webp.source;
  88671. } else if (defined_default(texture.extensions) && defined_default(texture.extensions.KHR_texture_basisu) && context.supportsBasis) {
  88672. imageId = texture.extensions.KHR_texture_basisu.source;
  88673. }
  88674. const gltfImage = images[imageId];
  88675. const bufferViewId = gltfImage.bufferView;
  88676. const mimeType = gltfImage.mimeType;
  88677. uri = gltfImage.uri;
  88678. if (defined_default(bufferViewId)) {
  88679. model._loadResources.texturesToCreateFromBufferView.enqueue({
  88680. id,
  88681. image: void 0,
  88682. bufferView: bufferViewId,
  88683. mimeType
  88684. });
  88685. } else {
  88686. ++model._loadResources.pendingTextureLoads;
  88687. const imageResource = model._resource.getDerivedResource({
  88688. url: uri
  88689. });
  88690. let promise;
  88691. if (ktx2Regex2.test(uri)) {
  88692. promise = loadKTX2_default(imageResource);
  88693. } else {
  88694. promise = imageResource.fetchImage({
  88695. skipColorSpaceConversion: true,
  88696. preferImageBitmap: true
  88697. });
  88698. }
  88699. promise.then(imageLoad(model, id, imageId)).catch(
  88700. ModelUtility_default.getFailedLoadFunction(model, "image", imageResource.url)
  88701. );
  88702. }
  88703. });
  88704. }
  88705. var scratchArticulationStageInitialTransform = new Matrix4_default();
  88706. function parseNodes(model) {
  88707. const runtimeNodes = {};
  88708. const runtimeNodesByName = {};
  88709. const skinnedNodes = [];
  88710. const skinnedNodesIds = model._loadResources.skinnedNodesIds;
  88711. const articulationsByName = model._runtime.articulationsByName;
  88712. ForEach_default.node(model.gltf, function(node, id) {
  88713. const runtimeNode = {
  88714. matrix: void 0,
  88715. translation: void 0,
  88716. rotation: void 0,
  88717. scale: void 0,
  88718. computedShow: true,
  88719. transformToRoot: new Matrix4_default(),
  88720. computedMatrix: new Matrix4_default(),
  88721. dirtyNumber: 0,
  88722. commands: [],
  88723. inverseBindMatrices: void 0,
  88724. bindShapeMatrix: void 0,
  88725. joints: [],
  88726. computedJointMatrices: [],
  88727. jointName: node.jointName,
  88728. weights: [],
  88729. children: [],
  88730. parents: [],
  88731. publicNode: void 0
  88732. };
  88733. runtimeNode.publicNode = new ModelNode_default(
  88734. model,
  88735. node,
  88736. runtimeNode,
  88737. id,
  88738. ModelUtility_default.getTransform(node)
  88739. );
  88740. runtimeNodes[id] = runtimeNode;
  88741. runtimeNodesByName[node.name] = runtimeNode;
  88742. if (defined_default(node.skin)) {
  88743. skinnedNodesIds.push(id);
  88744. skinnedNodes.push(runtimeNode);
  88745. }
  88746. if (defined_default(node.extensions) && defined_default(node.extensions.AGI_articulations)) {
  88747. const articulationName = node.extensions.AGI_articulations.articulationName;
  88748. if (defined_default(articulationName)) {
  88749. let transform4 = Matrix4_default.clone(
  88750. runtimeNode.publicNode.originalMatrix,
  88751. scratchArticulationStageInitialTransform
  88752. );
  88753. const articulation = articulationsByName[articulationName];
  88754. articulation.nodes.push(runtimeNode.publicNode);
  88755. const numStages = articulation.stages.length;
  88756. for (let s2 = 0; s2 < numStages; ++s2) {
  88757. const stage = articulation.stages[s2];
  88758. transform4 = applyArticulationStageMatrix(stage, transform4);
  88759. }
  88760. runtimeNode.publicNode.matrix = transform4;
  88761. }
  88762. }
  88763. });
  88764. model._runtime.nodes = runtimeNodes;
  88765. model._runtime.nodesByName = runtimeNodesByName;
  88766. model._runtime.skinnedNodes = skinnedNodes;
  88767. }
  88768. function parseMaterials(model) {
  88769. const gltf = model.gltf;
  88770. const techniques = model._sourceTechniques;
  88771. const runtimeMaterialsByName = {};
  88772. const runtimeMaterialsById = {};
  88773. const uniformMaps = model._uniformMaps;
  88774. ForEach_default.material(gltf, function(material, materialId) {
  88775. uniformMaps[materialId] = {
  88776. uniformMap: void 0,
  88777. values: void 0,
  88778. jointMatrixUniformName: void 0,
  88779. morphWeightsUniformName: void 0
  88780. };
  88781. const modelMaterial = new ModelMaterial_default(model, material, materialId);
  88782. if (defined_default(material.extensions) && defined_default(material.extensions.KHR_techniques_webgl)) {
  88783. const techniqueId = material.extensions.KHR_techniques_webgl.technique;
  88784. modelMaterial._technique = techniqueId;
  88785. modelMaterial._program = techniques[techniqueId].program;
  88786. ForEach_default.materialValue(material, function(value, uniformName) {
  88787. if (!defined_default(modelMaterial._values)) {
  88788. modelMaterial._values = {};
  88789. }
  88790. modelMaterial._values[uniformName] = clone_default(value);
  88791. });
  88792. }
  88793. runtimeMaterialsByName[material.name] = modelMaterial;
  88794. runtimeMaterialsById[materialId] = modelMaterial;
  88795. });
  88796. model._runtime.materialsByName = runtimeMaterialsByName;
  88797. model._runtime.materialsById = runtimeMaterialsById;
  88798. }
  88799. function parseMeshes(model) {
  88800. const runtimeMeshesByName = {};
  88801. const runtimeMaterialsById = model._runtime.materialsById;
  88802. ForEach_default.mesh(model.gltf, function(mesh2, meshId) {
  88803. runtimeMeshesByName[mesh2.name] = new ModelMesh_default(
  88804. mesh2,
  88805. runtimeMaterialsById,
  88806. meshId
  88807. );
  88808. if (defined_default(model.extensionsUsed.WEB3D_quantized_attributes) || model._dequantizeInShader) {
  88809. ForEach_default.meshPrimitive(mesh2, function(primitive, primitiveId) {
  88810. const programId = getProgramForPrimitive(model, primitive);
  88811. let programPrimitives = model._programPrimitives[programId];
  88812. if (!defined_default(programPrimitives)) {
  88813. programPrimitives = {};
  88814. model._programPrimitives[programId] = programPrimitives;
  88815. }
  88816. programPrimitives[`${meshId}.primitive.${primitiveId}`] = primitive;
  88817. });
  88818. }
  88819. });
  88820. model._runtime.meshesByName = runtimeMeshesByName;
  88821. }
  88822. function parseCredits(model) {
  88823. const asset = model.gltf.asset;
  88824. const copyright = asset.copyright;
  88825. if (!defined_default(copyright)) {
  88826. return;
  88827. }
  88828. const showOnScreen = model._showCreditsOnScreen;
  88829. const credits = copyright.split(";").map(function(string) {
  88830. return new Credit_default(string.trim(), showOnScreen);
  88831. });
  88832. model._gltfCredits = credits;
  88833. }
  88834. var CreateVertexBufferJob = function() {
  88835. this.id = void 0;
  88836. this.model = void 0;
  88837. this.context = void 0;
  88838. };
  88839. CreateVertexBufferJob.prototype.set = function(id, model, context) {
  88840. this.id = id;
  88841. this.model = model;
  88842. this.context = context;
  88843. };
  88844. CreateVertexBufferJob.prototype.execute = function() {
  88845. createVertexBuffer2(this.id, this.model, this.context);
  88846. };
  88847. function createVertexBuffer2(bufferViewId, model, context) {
  88848. const loadResources = model._loadResources;
  88849. const bufferViews = model.gltf.bufferViews;
  88850. let bufferView = bufferViews[bufferViewId];
  88851. if (!defined_default(bufferView)) {
  88852. bufferView = loadResources.createdBufferViews[bufferViewId];
  88853. }
  88854. const vertexBuffer = Buffer_default.createVertexBuffer({
  88855. context,
  88856. typedArray: loadResources.getBuffer(bufferView),
  88857. usage: BufferUsage_default.STATIC_DRAW
  88858. });
  88859. vertexBuffer.vertexArrayDestroyable = false;
  88860. model._rendererResources.buffers[bufferViewId] = vertexBuffer;
  88861. model._geometryByteLength += vertexBuffer.sizeInBytes;
  88862. }
  88863. var CreateIndexBufferJob = function() {
  88864. this.id = void 0;
  88865. this.componentType = void 0;
  88866. this.model = void 0;
  88867. this.context = void 0;
  88868. };
  88869. CreateIndexBufferJob.prototype.set = function(id, componentType, model, context) {
  88870. this.id = id;
  88871. this.componentType = componentType;
  88872. this.model = model;
  88873. this.context = context;
  88874. };
  88875. CreateIndexBufferJob.prototype.execute = function() {
  88876. createIndexBuffer2(this.id, this.componentType, this.model, this.context);
  88877. };
  88878. function createIndexBuffer2(bufferViewId, componentType, model, context) {
  88879. const loadResources = model._loadResources;
  88880. const bufferViews = model.gltf.bufferViews;
  88881. let bufferView = bufferViews[bufferViewId];
  88882. if (!defined_default(bufferView)) {
  88883. bufferView = loadResources.createdBufferViews[bufferViewId];
  88884. }
  88885. const indexBuffer = Buffer_default.createIndexBuffer({
  88886. context,
  88887. typedArray: loadResources.getBuffer(bufferView),
  88888. usage: BufferUsage_default.STATIC_DRAW,
  88889. indexDatatype: componentType
  88890. });
  88891. indexBuffer.vertexArrayDestroyable = false;
  88892. model._rendererResources.buffers[bufferViewId] = indexBuffer;
  88893. model._geometryByteLength += indexBuffer.sizeInBytes;
  88894. }
  88895. var scratchVertexBufferJob = new CreateVertexBufferJob();
  88896. var scratchIndexBufferJob = new CreateIndexBufferJob();
  88897. function createBuffers2(model, frameState) {
  88898. const loadResources = model._loadResources;
  88899. if (loadResources.pendingBufferLoads !== 0) {
  88900. return;
  88901. }
  88902. const context = frameState.context;
  88903. const vertexBuffersToCreate = loadResources.vertexBuffersToCreate;
  88904. const indexBuffersToCreate = loadResources.indexBuffersToCreate;
  88905. let i2;
  88906. if (model.asynchronous) {
  88907. while (vertexBuffersToCreate.length > 0) {
  88908. scratchVertexBufferJob.set(vertexBuffersToCreate.peek(), model, context);
  88909. if (!frameState.jobScheduler.execute(scratchVertexBufferJob, JobType_default.BUFFER)) {
  88910. break;
  88911. }
  88912. vertexBuffersToCreate.dequeue();
  88913. }
  88914. while (indexBuffersToCreate.length > 0) {
  88915. i2 = indexBuffersToCreate.peek();
  88916. scratchIndexBufferJob.set(i2.id, i2.componentType, model, context);
  88917. if (!frameState.jobScheduler.execute(scratchIndexBufferJob, JobType_default.BUFFER)) {
  88918. break;
  88919. }
  88920. indexBuffersToCreate.dequeue();
  88921. }
  88922. } else {
  88923. while (vertexBuffersToCreate.length > 0) {
  88924. createVertexBuffer2(vertexBuffersToCreate.dequeue(), model, context);
  88925. }
  88926. while (indexBuffersToCreate.length > 0) {
  88927. i2 = indexBuffersToCreate.dequeue();
  88928. createIndexBuffer2(i2.id, i2.componentType, model, context);
  88929. }
  88930. }
  88931. }
  88932. function getProgramForPrimitive(model, primitive) {
  88933. const material = model._runtime.materialsById[primitive.material];
  88934. if (!defined_default(material)) {
  88935. return;
  88936. }
  88937. return material._program;
  88938. }
  88939. function modifyShaderForQuantizedAttributes2(shader, programName, model) {
  88940. let primitive;
  88941. const primitives = model._programPrimitives[programName];
  88942. if (!defined_default(primitives)) {
  88943. return shader;
  88944. }
  88945. let primitiveId;
  88946. for (primitiveId in primitives) {
  88947. if (primitives.hasOwnProperty(primitiveId)) {
  88948. primitive = primitives[primitiveId];
  88949. if (getProgramForPrimitive(model, primitive) === programName) {
  88950. break;
  88951. }
  88952. }
  88953. }
  88954. model._programPrimitives[programName] = void 0;
  88955. let result;
  88956. if (model.extensionsUsed.WEB3D_quantized_attributes) {
  88957. result = ModelUtility_default.modifyShaderForQuantizedAttributes(
  88958. model.gltf,
  88959. primitive,
  88960. shader
  88961. );
  88962. model._quantizedUniforms[programName] = result.uniforms;
  88963. } else {
  88964. const decodedData = model._decodedData[primitiveId];
  88965. if (defined_default(decodedData)) {
  88966. result = ModelUtility_default.modifyShaderForDracoQuantizedAttributes(
  88967. model.gltf,
  88968. primitive,
  88969. shader,
  88970. decodedData.attributes
  88971. );
  88972. } else {
  88973. return shader;
  88974. }
  88975. }
  88976. return result.shader;
  88977. }
  88978. function modifyShaderForColor(shader) {
  88979. shader = ShaderSource_default.replaceMain(shader, "gltf_blend_main");
  88980. shader += "uniform vec4 gltf_color; \nuniform float gltf_colorBlend; \nvoid main() \n{ \n gltf_blend_main(); \n gl_FragColor.rgb = mix(gl_FragColor.rgb, gltf_color.rgb, gltf_colorBlend); \n float highlight = ceil(gltf_colorBlend); \n gl_FragColor.rgb *= mix(gltf_color.rgb, vec3(1.0), highlight); \n gl_FragColor.a *= gltf_color.a; \n} \n";
  88981. return shader;
  88982. }
  88983. function modifyShader2(shader, programName, callback) {
  88984. if (defined_default(callback)) {
  88985. shader = callback(shader, programName);
  88986. }
  88987. return shader;
  88988. }
  88989. var CreateProgramJob = function() {
  88990. this.programToCreate = void 0;
  88991. this.model = void 0;
  88992. this.context = void 0;
  88993. };
  88994. CreateProgramJob.prototype.set = function(programToCreate, model, context) {
  88995. this.programToCreate = programToCreate;
  88996. this.model = model;
  88997. this.context = context;
  88998. };
  88999. CreateProgramJob.prototype.execute = function() {
  89000. createProgram2(this.programToCreate, this.model, this.context);
  89001. };
  89002. function createProgram2(programToCreate, model, context) {
  89003. const programId = programToCreate.programId;
  89004. const techniqueId = programToCreate.techniqueId;
  89005. const program = model._sourcePrograms[programId];
  89006. const shaders = model._rendererResources.sourceShaders;
  89007. let vs = shaders[program.vertexShader];
  89008. const fs = shaders[program.fragmentShader];
  89009. const quantizedVertexShaders = model._quantizedVertexShaders;
  89010. if (model.extensionsUsed.WEB3D_quantized_attributes || model._dequantizeInShader) {
  89011. let quantizedVS = quantizedVertexShaders[programId];
  89012. if (!defined_default(quantizedVS)) {
  89013. quantizedVS = modifyShaderForQuantizedAttributes2(vs, programId, model);
  89014. quantizedVertexShaders[programId] = quantizedVS;
  89015. }
  89016. vs = quantizedVS;
  89017. }
  89018. const drawVS = modifyShader2(vs, programId, model._vertexShaderLoaded);
  89019. let drawFS = modifyShader2(fs, programId, model._fragmentShaderLoaded);
  89020. if (!defined_default(model._uniformMapLoaded)) {
  89021. drawFS = `uniform vec4 czm_pickColor;
  89022. ${drawFS}`;
  89023. }
  89024. const imageBasedLighting = model._imageBasedLighting;
  89025. const useIBL = imageBasedLighting.enabled;
  89026. if (useIBL) {
  89027. drawFS = `#define USE_IBL_LIGHTING
  89028. ${drawFS}`;
  89029. }
  89030. if (defined_default(model._lightColor)) {
  89031. drawFS = `#define USE_CUSTOM_LIGHT_COLOR
  89032. ${drawFS}`;
  89033. }
  89034. if (model._sourceVersion !== "2.0" || model._sourceKHRTechniquesWebGL) {
  89035. drawFS = ShaderSource_default.replaceMain(drawFS, "non_gamma_corrected_main");
  89036. drawFS = `${drawFS}
  89037. void main() {
  89038. non_gamma_corrected_main();
  89039. gl_FragColor = czm_gammaCorrect(gl_FragColor);
  89040. }
  89041. `;
  89042. }
  89043. if (OctahedralProjectedCubeMap_default.isSupported(context)) {
  89044. const useSHC = imageBasedLighting.useSphericalHarmonicCoefficients;
  89045. const useSEM = imageBasedLighting.useSpecularEnvironmentMaps;
  89046. const addMatrix = useSHC || useSEM || useIBL;
  89047. if (addMatrix) {
  89048. drawFS = `uniform mat3 gltf_iblReferenceFrameMatrix;
  89049. ${drawFS}`;
  89050. }
  89051. if (defined_default(imageBasedLighting.sphericalHarmonicCoefficients)) {
  89052. drawFS = `${"#define DIFFUSE_IBL \n#define CUSTOM_SPHERICAL_HARMONICS \nuniform vec3 gltf_sphericalHarmonicCoefficients[9]; \n"}${drawFS}`;
  89053. } else if (imageBasedLighting.useDefaultSphericalHarmonics) {
  89054. drawFS = `#define DIFFUSE_IBL
  89055. ${drawFS}`;
  89056. }
  89057. if (defined_default(imageBasedLighting.specularEnvironmentMapAtlas) && imageBasedLighting.specularEnvironmentMapAtlas.ready) {
  89058. drawFS = `${"#define SPECULAR_IBL \n#define CUSTOM_SPECULAR_IBL \nuniform sampler2D gltf_specularMap; \nuniform vec2 gltf_specularMapSize; \nuniform float gltf_maxSpecularLOD; \n"}${drawFS}`;
  89059. } else if (imageBasedLighting.useDefaultSpecularMaps) {
  89060. drawFS = `#define SPECULAR_IBL
  89061. ${drawFS}`;
  89062. }
  89063. }
  89064. if (defined_default(imageBasedLighting.luminanceAtZenith)) {
  89065. drawFS = `${"#define USE_SUN_LUMINANCE \nuniform float gltf_luminanceAtZenith;\n"}${drawFS}`;
  89066. }
  89067. createAttributesAndProgram(
  89068. programId,
  89069. techniqueId,
  89070. drawFS,
  89071. drawVS,
  89072. model,
  89073. context
  89074. );
  89075. }
  89076. function recreateProgram(programToCreate, model, context) {
  89077. const programId = programToCreate.programId;
  89078. const techniqueId = programToCreate.techniqueId;
  89079. const program = model._sourcePrograms[programId];
  89080. const shaders = model._rendererResources.sourceShaders;
  89081. const quantizedVertexShaders = model._quantizedVertexShaders;
  89082. const clippingPlaneCollection = model.clippingPlanes;
  89083. const addClippingPlaneCode = isClippingEnabled(model);
  89084. let vs = shaders[program.vertexShader];
  89085. const fs = shaders[program.fragmentShader];
  89086. if (model.extensionsUsed.WEB3D_quantized_attributes || model._dequantizeInShader) {
  89087. vs = quantizedVertexShaders[programId];
  89088. }
  89089. let finalFS = fs;
  89090. if (isColorShadingEnabled(model)) {
  89091. finalFS = Model._modifyShaderForColor(finalFS);
  89092. }
  89093. if (addClippingPlaneCode) {
  89094. finalFS = modifyShaderForClippingPlanes(
  89095. finalFS,
  89096. clippingPlaneCollection,
  89097. context
  89098. );
  89099. }
  89100. if (model.splitDirection !== SplitDirection_default.NONE) {
  89101. finalFS = Splitter_default.modifyFragmentShader(finalFS);
  89102. }
  89103. const drawVS = modifyShader2(vs, programId, model._vertexShaderLoaded);
  89104. let drawFS = modifyShader2(finalFS, programId, model._fragmentShaderLoaded);
  89105. if (!defined_default(model._uniformMapLoaded)) {
  89106. drawFS = `uniform vec4 czm_pickColor;
  89107. ${drawFS}`;
  89108. }
  89109. const imageBasedLighting = model._imageBasedLighting;
  89110. const useIBL = imageBasedLighting.enabled;
  89111. if (useIBL) {
  89112. drawFS = `#define USE_IBL_LIGHTING
  89113. ${drawFS}`;
  89114. }
  89115. if (defined_default(model._lightColor)) {
  89116. drawFS = `#define USE_CUSTOM_LIGHT_COLOR
  89117. ${drawFS}`;
  89118. }
  89119. if (model._sourceVersion !== "2.0" || model._sourceKHRTechniquesWebGL) {
  89120. drawFS = ShaderSource_default.replaceMain(drawFS, "non_gamma_corrected_main");
  89121. drawFS = `${drawFS}
  89122. void main() {
  89123. non_gamma_corrected_main();
  89124. gl_FragColor = czm_gammaCorrect(gl_FragColor);
  89125. }
  89126. `;
  89127. }
  89128. if (OctahedralProjectedCubeMap_default.isSupported(context)) {
  89129. const useSHC = imageBasedLighting.useSphericalHarmonicCoefficients;
  89130. const useSEM = imageBasedLighting.useSpecularEnvironmentMaps;
  89131. const addMatrix = useSHC || useSEM || useIBL;
  89132. if (addMatrix) {
  89133. drawFS = `uniform mat3 gltf_iblReferenceFrameMatrix;
  89134. ${drawFS}`;
  89135. }
  89136. if (defined_default(imageBasedLighting.sphericalHarmonicCoefficients)) {
  89137. drawFS = `${"#define DIFFUSE_IBL \n#define CUSTOM_SPHERICAL_HARMONICS \nuniform vec3 gltf_sphericalHarmonicCoefficients[9]; \n"}${drawFS}`;
  89138. } else if (imageBasedLighting.useDefaultSphericalHarmonics) {
  89139. drawFS = `#define DIFFUSE_IBL
  89140. ${drawFS}`;
  89141. }
  89142. if (defined_default(imageBasedLighting.specularEnvironmentMapAtlas) && imageBasedLighting.specularEnvironmentMapAtlas.ready) {
  89143. drawFS = `${"#define SPECULAR_IBL \n#define CUSTOM_SPECULAR_IBL \nuniform sampler2D gltf_specularMap; \nuniform vec2 gltf_specularMapSize; \nuniform float gltf_maxSpecularLOD; \n"}${drawFS}`;
  89144. } else if (imageBasedLighting.useDefaultSpecularMaps) {
  89145. drawFS = `#define SPECULAR_IBL
  89146. ${drawFS}`;
  89147. }
  89148. }
  89149. if (defined_default(imageBasedLighting.luminanceAtZenith)) {
  89150. drawFS = `${"#define USE_SUN_LUMINANCE \nuniform float gltf_luminanceAtZenith;\n"}${drawFS}`;
  89151. }
  89152. createAttributesAndProgram(
  89153. programId,
  89154. techniqueId,
  89155. drawFS,
  89156. drawVS,
  89157. model,
  89158. context
  89159. );
  89160. }
  89161. function createAttributesAndProgram(programId, techniqueId, drawFS, drawVS, model, context) {
  89162. const technique = model._sourceTechniques[techniqueId];
  89163. const attributeLocations8 = ModelUtility_default.createAttributeLocations(
  89164. technique,
  89165. model._precreatedAttributes
  89166. );
  89167. model._rendererResources.programs[programId] = ShaderProgram_default.fromCache({
  89168. context,
  89169. vertexShaderSource: drawVS,
  89170. fragmentShaderSource: drawFS,
  89171. attributeLocations: attributeLocations8
  89172. });
  89173. }
  89174. var scratchCreateProgramJob = new CreateProgramJob();
  89175. function createPrograms(model, frameState) {
  89176. const loadResources = model._loadResources;
  89177. const programsToCreate = loadResources.programsToCreate;
  89178. if (loadResources.pendingShaderLoads !== 0) {
  89179. return;
  89180. }
  89181. if (loadResources.pendingBufferLoads !== 0) {
  89182. return;
  89183. }
  89184. const context = frameState.context;
  89185. if (model.asynchronous) {
  89186. while (programsToCreate.length > 0) {
  89187. scratchCreateProgramJob.set(programsToCreate.peek(), model, context);
  89188. if (!frameState.jobScheduler.execute(
  89189. scratchCreateProgramJob,
  89190. JobType_default.PROGRAM
  89191. )) {
  89192. break;
  89193. }
  89194. programsToCreate.dequeue();
  89195. }
  89196. } else {
  89197. while (programsToCreate.length > 0) {
  89198. createProgram2(programsToCreate.dequeue(), model, context);
  89199. }
  89200. }
  89201. }
  89202. function getOnImageCreatedFromTypedArray(loadResources, gltfTexture) {
  89203. return function(image) {
  89204. loadResources.texturesToCreate.enqueue({
  89205. id: gltfTexture.id,
  89206. image,
  89207. bufferView: void 0
  89208. });
  89209. --loadResources.pendingBufferViewToImage;
  89210. };
  89211. }
  89212. function loadTexturesFromBufferViews(model) {
  89213. const loadResources = model._loadResources;
  89214. if (loadResources.pendingBufferLoads !== 0) {
  89215. return;
  89216. }
  89217. while (loadResources.texturesToCreateFromBufferView.length > 0) {
  89218. const gltfTexture = loadResources.texturesToCreateFromBufferView.dequeue();
  89219. const gltf = model.gltf;
  89220. const bufferView = gltf.bufferViews[gltfTexture.bufferView];
  89221. const imageId = gltf.textures[gltfTexture.id].source;
  89222. const onerror = ModelUtility_default.getFailedLoadFunction(
  89223. model,
  89224. "image",
  89225. `id: ${gltfTexture.id}, bufferView: ${gltfTexture.bufferView}`
  89226. );
  89227. if (gltfTexture.mimeType === "image/ktx2") {
  89228. const ktxBuffer = new Uint8Array(loadResources.getBuffer(bufferView));
  89229. loadKTX2_default(ktxBuffer).then(imageLoad(model, gltfTexture.id, imageId)).catch(onerror);
  89230. ++model._loadResources.pendingTextureLoads;
  89231. } else {
  89232. const onload = getOnImageCreatedFromTypedArray(
  89233. loadResources,
  89234. gltfTexture
  89235. );
  89236. loadImageFromTypedArray_default({
  89237. uint8Array: loadResources.getBuffer(bufferView),
  89238. format: gltfTexture.mimeType,
  89239. flipY: false,
  89240. skipColorSpaceConversion: true
  89241. }).then(onload).catch(onerror);
  89242. ++loadResources.pendingBufferViewToImage;
  89243. }
  89244. }
  89245. }
  89246. function createSamplers(model) {
  89247. const loadResources = model._loadResources;
  89248. if (loadResources.createSamplers) {
  89249. loadResources.createSamplers = false;
  89250. const rendererSamplers = model._rendererResources.samplers;
  89251. ForEach_default.sampler(model.gltf, function(sampler, samplerId) {
  89252. rendererSamplers[samplerId] = new Sampler_default({
  89253. wrapS: sampler.wrapS,
  89254. wrapT: sampler.wrapT,
  89255. minificationFilter: sampler.minFilter,
  89256. magnificationFilter: sampler.magFilter
  89257. });
  89258. });
  89259. }
  89260. }
  89261. var CreateTextureJob = function() {
  89262. this.gltfTexture = void 0;
  89263. this.model = void 0;
  89264. this.context = void 0;
  89265. };
  89266. CreateTextureJob.prototype.set = function(gltfTexture, model, context) {
  89267. this.gltfTexture = gltfTexture;
  89268. this.model = model;
  89269. this.context = context;
  89270. };
  89271. CreateTextureJob.prototype.execute = function() {
  89272. createTexture4(this.gltfTexture, this.model, this.context);
  89273. };
  89274. function createTexture4(gltfTexture, model, context) {
  89275. const textures = model.gltf.textures;
  89276. const texture = textures[gltfTexture.id];
  89277. const rendererSamplers = model._rendererResources.samplers;
  89278. let sampler = rendererSamplers[texture.sampler];
  89279. if (!defined_default(sampler)) {
  89280. sampler = new Sampler_default({
  89281. wrapS: TextureWrap_default.REPEAT,
  89282. wrapT: TextureWrap_default.REPEAT
  89283. });
  89284. }
  89285. let usesTextureTransform = false;
  89286. const materials = model.gltf.materials;
  89287. const materialsLength = materials.length;
  89288. for (let i2 = 0; i2 < materialsLength; ++i2) {
  89289. const material = materials[i2];
  89290. if (defined_default(material.extensions) && defined_default(material.extensions.KHR_techniques_webgl)) {
  89291. const values = material.extensions.KHR_techniques_webgl.values;
  89292. for (const valueName in values) {
  89293. if (values.hasOwnProperty(valueName) && valueName.indexOf("Texture") !== -1) {
  89294. const value = values[valueName];
  89295. if (value.index === gltfTexture.id && defined_default(value.extensions) && defined_default(value.extensions.KHR_texture_transform)) {
  89296. usesTextureTransform = true;
  89297. break;
  89298. }
  89299. }
  89300. }
  89301. }
  89302. if (usesTextureTransform) {
  89303. break;
  89304. }
  89305. }
  89306. const wrapS = sampler.wrapS;
  89307. const wrapT = sampler.wrapT;
  89308. let minFilter = sampler.minificationFilter;
  89309. if (usesTextureTransform && minFilter !== TextureMinificationFilter_default.LINEAR && minFilter !== TextureMinificationFilter_default.NEAREST) {
  89310. if (minFilter === TextureMinificationFilter_default.NEAREST_MIPMAP_NEAREST || minFilter === TextureMinificationFilter_default.NEAREST_MIPMAP_LINEAR) {
  89311. minFilter = TextureMinificationFilter_default.NEAREST;
  89312. } else {
  89313. minFilter = TextureMinificationFilter_default.LINEAR;
  89314. }
  89315. sampler = new Sampler_default({
  89316. wrapS: sampler.wrapS,
  89317. wrapT: sampler.wrapT,
  89318. minificationFilter: minFilter,
  89319. magnificationFilter: sampler.magnificationFilter
  89320. });
  89321. }
  89322. const internalFormat = gltfTexture.internalFormat;
  89323. const mipmap = !(defined_default(internalFormat) && PixelFormat_default.isCompressedFormat(internalFormat)) && (minFilter === TextureMinificationFilter_default.NEAREST_MIPMAP_NEAREST || minFilter === TextureMinificationFilter_default.NEAREST_MIPMAP_LINEAR || minFilter === TextureMinificationFilter_default.LINEAR_MIPMAP_NEAREST || minFilter === TextureMinificationFilter_default.LINEAR_MIPMAP_LINEAR);
  89324. const requiresNpot = mipmap || wrapS === TextureWrap_default.REPEAT || wrapS === TextureWrap_default.MIRRORED_REPEAT || wrapT === TextureWrap_default.REPEAT || wrapT === TextureWrap_default.MIRRORED_REPEAT;
  89325. let npot;
  89326. let tx;
  89327. let source = gltfTexture.image;
  89328. if (defined_default(internalFormat)) {
  89329. npot = !Math_default.isPowerOfTwo(gltfTexture.width) || !Math_default.isPowerOfTwo(gltfTexture.height);
  89330. if (!context.webgl2 && PixelFormat_default.isCompressedFormat(internalFormat) && npot && requiresNpot) {
  89331. console.warn(
  89332. "Compressed texture uses REPEAT or MIRRORED_REPEAT texture wrap mode and dimensions are not powers of two. The texture may be rendered incorrectly. See the Model.js constructor documentation for more information."
  89333. );
  89334. }
  89335. let minificationFilter = sampler.minificationFilter;
  89336. if (!defined_default(gltfTexture.mipLevels) && (minFilter === TextureMinificationFilter_default.NEAREST_MIPMAP_NEAREST || minFilter === TextureMinificationFilter_default.NEAREST_MIPMAP_LINEAR)) {
  89337. minificationFilter = TextureMinificationFilter_default.NEAREST;
  89338. } else if (!defined_default(gltfTexture.mipLevels) && (minFilter === TextureMinificationFilter_default.LINEAR_MIPMAP_NEAREST || minFilter === TextureMinificationFilter_default.LINEAR_MIPMAP_LINEAR)) {
  89339. minificationFilter = TextureMinificationFilter_default.LINEAR;
  89340. }
  89341. sampler = new Sampler_default({
  89342. wrapS: sampler.wrapS,
  89343. wrapT: sampler.wrapT,
  89344. minificationFilter,
  89345. magnificationFilter: sampler.magnificationFilter
  89346. });
  89347. tx = new Texture_default({
  89348. context,
  89349. source: {
  89350. arrayBufferView: gltfTexture.bufferView,
  89351. mipLevels: gltfTexture.mipLevels
  89352. },
  89353. width: gltfTexture.width,
  89354. height: gltfTexture.height,
  89355. pixelFormat: internalFormat,
  89356. sampler
  89357. });
  89358. } else if (defined_default(source)) {
  89359. npot = !Math_default.isPowerOfTwo(source.width) || !Math_default.isPowerOfTwo(source.height);
  89360. if (requiresNpot && npot) {
  89361. const canvas = document.createElement("canvas");
  89362. canvas.width = Math_default.nextPowerOfTwo(source.width);
  89363. canvas.height = Math_default.nextPowerOfTwo(source.height);
  89364. const canvasContext = canvas.getContext("2d");
  89365. canvasContext.drawImage(
  89366. source,
  89367. 0,
  89368. 0,
  89369. source.width,
  89370. source.height,
  89371. 0,
  89372. 0,
  89373. canvas.width,
  89374. canvas.height
  89375. );
  89376. source = canvas;
  89377. }
  89378. tx = new Texture_default({
  89379. context,
  89380. source,
  89381. pixelFormat: texture.internalFormat,
  89382. pixelDatatype: texture.type,
  89383. sampler,
  89384. flipY: false,
  89385. skipColorSpaceConversion: true
  89386. });
  89387. if (mipmap) {
  89388. tx.generateMipmap();
  89389. }
  89390. }
  89391. if (defined_default(tx)) {
  89392. model._rendererResources.textures[gltfTexture.id] = tx;
  89393. model._texturesByteLength += tx.sizeInBytes;
  89394. }
  89395. }
  89396. var scratchCreateTextureJob = new CreateTextureJob();
  89397. function createTextures(model, frameState) {
  89398. const context = frameState.context;
  89399. const texturesToCreate = model._loadResources.texturesToCreate;
  89400. if (model.asynchronous) {
  89401. while (texturesToCreate.length > 0) {
  89402. scratchCreateTextureJob.set(texturesToCreate.peek(), model, context);
  89403. if (!frameState.jobScheduler.execute(
  89404. scratchCreateTextureJob,
  89405. JobType_default.TEXTURE
  89406. )) {
  89407. break;
  89408. }
  89409. texturesToCreate.dequeue();
  89410. }
  89411. } else {
  89412. while (texturesToCreate.length > 0) {
  89413. createTexture4(texturesToCreate.dequeue(), model, context);
  89414. }
  89415. }
  89416. }
  89417. function getAttributeLocations2(model, primitive) {
  89418. const techniques = model._sourceTechniques;
  89419. const attributeLocations8 = {};
  89420. let location2;
  89421. let index2;
  89422. const material = model._runtime.materialsById[primitive.material];
  89423. if (!defined_default(material)) {
  89424. return attributeLocations8;
  89425. }
  89426. const technique = techniques[material._technique];
  89427. if (!defined_default(technique)) {
  89428. return attributeLocations8;
  89429. }
  89430. const attributes = technique.attributes;
  89431. const program = model._rendererResources.programs[technique.program];
  89432. const programAttributeLocations = program._attributeLocations;
  89433. for (location2 in programAttributeLocations) {
  89434. if (programAttributeLocations.hasOwnProperty(location2)) {
  89435. const attribute = attributes[location2];
  89436. if (defined_default(attribute)) {
  89437. index2 = programAttributeLocations[location2];
  89438. attributeLocations8[attribute.semantic] = index2;
  89439. }
  89440. }
  89441. }
  89442. const precreatedAttributes = model._precreatedAttributes;
  89443. if (defined_default(precreatedAttributes)) {
  89444. for (location2 in precreatedAttributes) {
  89445. if (precreatedAttributes.hasOwnProperty(location2)) {
  89446. index2 = programAttributeLocations[location2];
  89447. attributeLocations8[location2] = index2;
  89448. }
  89449. }
  89450. }
  89451. return attributeLocations8;
  89452. }
  89453. function createJoints(model, runtimeSkins) {
  89454. const gltf = model.gltf;
  89455. const skins = gltf.skins;
  89456. const nodes = gltf.nodes;
  89457. const runtimeNodes = model._runtime.nodes;
  89458. const skinnedNodesIds = model._loadResources.skinnedNodesIds;
  89459. const length3 = skinnedNodesIds.length;
  89460. for (let j = 0; j < length3; ++j) {
  89461. const id = skinnedNodesIds[j];
  89462. const skinnedNode = runtimeNodes[id];
  89463. const node = nodes[id];
  89464. const runtimeSkin = runtimeSkins[node.skin];
  89465. skinnedNode.inverseBindMatrices = runtimeSkin.inverseBindMatrices;
  89466. skinnedNode.bindShapeMatrix = runtimeSkin.bindShapeMatrix;
  89467. const gltfJoints = skins[node.skin].joints;
  89468. const jointsLength = gltfJoints.length;
  89469. for (let i2 = 0; i2 < jointsLength; ++i2) {
  89470. const nodeId = gltfJoints[i2];
  89471. const jointNode = runtimeNodes[nodeId];
  89472. skinnedNode.joints.push(jointNode);
  89473. }
  89474. }
  89475. }
  89476. function createSkins(model) {
  89477. const loadResources = model._loadResources;
  89478. if (loadResources.pendingBufferLoads !== 0) {
  89479. return;
  89480. }
  89481. if (!loadResources.createSkins) {
  89482. return;
  89483. }
  89484. loadResources.createSkins = false;
  89485. const gltf = model.gltf;
  89486. const accessors = gltf.accessors;
  89487. const runtimeSkins = {};
  89488. ForEach_default.skin(gltf, function(skin, id) {
  89489. const accessor = accessors[skin.inverseBindMatrices];
  89490. let bindShapeMatrix;
  89491. if (!Matrix4_default.equals(skin.bindShapeMatrix, Matrix4_default.IDENTITY)) {
  89492. bindShapeMatrix = Matrix4_default.clone(skin.bindShapeMatrix);
  89493. }
  89494. runtimeSkins[id] = {
  89495. inverseBindMatrices: ModelAnimationCache_default.getSkinInverseBindMatrices(
  89496. model,
  89497. accessor
  89498. ),
  89499. bindShapeMatrix
  89500. };
  89501. });
  89502. createJoints(model, runtimeSkins);
  89503. }
  89504. function getChannelEvaluator(model, runtimeNode, targetPath, spline) {
  89505. return function(localAnimationTime) {
  89506. if (defined_default(spline)) {
  89507. localAnimationTime = model.clampAnimations ? spline.clampTime(localAnimationTime) : spline.wrapTime(localAnimationTime);
  89508. runtimeNode[targetPath] = spline.evaluate(
  89509. localAnimationTime,
  89510. runtimeNode[targetPath]
  89511. );
  89512. runtimeNode.dirtyNumber = model._maxDirtyNumber;
  89513. }
  89514. };
  89515. }
  89516. function createRuntimeAnimations(model) {
  89517. const loadResources = model._loadResources;
  89518. if (!loadResources.finishedPendingBufferLoads()) {
  89519. return;
  89520. }
  89521. if (!loadResources.createRuntimeAnimations) {
  89522. return;
  89523. }
  89524. loadResources.createRuntimeAnimations = false;
  89525. model._runtime.animations = [];
  89526. const runtimeNodes = model._runtime.nodes;
  89527. const accessors = model.gltf.accessors;
  89528. ForEach_default.animation(model.gltf, function(animation, i2) {
  89529. const channels = animation.channels;
  89530. const samplers = animation.samplers;
  89531. let startTime = Number.MAX_VALUE;
  89532. let stopTime = -Number.MAX_VALUE;
  89533. const channelsLength = channels.length;
  89534. const channelEvaluators = new Array(channelsLength);
  89535. for (let j = 0; j < channelsLength; ++j) {
  89536. const channel = channels[j];
  89537. const target = channel.target;
  89538. const path = target.path;
  89539. const sampler = samplers[channel.sampler];
  89540. const input = ModelAnimationCache_default.getAnimationParameterValues(
  89541. model,
  89542. accessors[sampler.input]
  89543. );
  89544. const output = ModelAnimationCache_default.getAnimationParameterValues(
  89545. model,
  89546. accessors[sampler.output]
  89547. );
  89548. startTime = Math.min(startTime, input[0]);
  89549. stopTime = Math.max(stopTime, input[input.length - 1]);
  89550. const spline = ModelAnimationCache_default.getAnimationSpline(
  89551. model,
  89552. i2,
  89553. animation,
  89554. channel.sampler,
  89555. sampler,
  89556. input,
  89557. path,
  89558. output
  89559. );
  89560. channelEvaluators[j] = getChannelEvaluator(
  89561. model,
  89562. runtimeNodes[target.node],
  89563. target.path,
  89564. spline
  89565. );
  89566. }
  89567. model._runtime.animations[i2] = {
  89568. name: animation.name,
  89569. startTime,
  89570. stopTime,
  89571. channelEvaluators
  89572. };
  89573. });
  89574. }
  89575. function createVertexArrays(model, context) {
  89576. const loadResources = model._loadResources;
  89577. if (!loadResources.finishedBuffersCreation() || !loadResources.finishedProgramCreation() || !loadResources.createVertexArrays) {
  89578. return;
  89579. }
  89580. loadResources.createVertexArrays = false;
  89581. const rendererBuffers = model._rendererResources.buffers;
  89582. const rendererVertexArrays = model._rendererResources.vertexArrays;
  89583. const gltf = model.gltf;
  89584. const accessors = gltf.accessors;
  89585. ForEach_default.mesh(gltf, function(mesh2, meshId) {
  89586. ForEach_default.meshPrimitive(mesh2, function(primitive, primitiveId) {
  89587. const attributes = [];
  89588. let attributeLocation;
  89589. const attributeLocations8 = getAttributeLocations2(model, primitive);
  89590. const decodedData = model._decodedData[`${meshId}.primitive.${primitiveId}`];
  89591. ForEach_default.meshPrimitiveAttribute(primitive, function(accessorId, attributeName2) {
  89592. attributeLocation = attributeLocations8[attributeName2];
  89593. if (defined_default(attributeLocation)) {
  89594. if (defined_default(decodedData)) {
  89595. const decodedAttributes = decodedData.attributes;
  89596. if (decodedAttributes.hasOwnProperty(attributeName2)) {
  89597. const decodedAttribute = decodedAttributes[attributeName2];
  89598. attributes.push({
  89599. index: attributeLocation,
  89600. vertexBuffer: rendererBuffers[decodedAttribute.bufferView],
  89601. componentsPerAttribute: decodedAttribute.componentsPerAttribute,
  89602. componentDatatype: decodedAttribute.componentDatatype,
  89603. normalize: decodedAttribute.normalized,
  89604. offsetInBytes: decodedAttribute.byteOffset,
  89605. strideInBytes: decodedAttribute.byteStride
  89606. });
  89607. return;
  89608. }
  89609. }
  89610. const a4 = accessors[accessorId];
  89611. const normalize2 = defined_default(a4.normalized) && a4.normalized;
  89612. attributes.push({
  89613. index: attributeLocation,
  89614. vertexBuffer: rendererBuffers[a4.bufferView],
  89615. componentsPerAttribute: numberOfComponentsForType_default(a4.type),
  89616. componentDatatype: a4.componentType,
  89617. normalize: normalize2,
  89618. offsetInBytes: a4.byteOffset,
  89619. strideInBytes: getAccessorByteStride_default(gltf, a4)
  89620. });
  89621. }
  89622. });
  89623. let attribute;
  89624. let attributeName;
  89625. const precreatedAttributes = model._precreatedAttributes;
  89626. if (defined_default(precreatedAttributes)) {
  89627. for (attributeName in precreatedAttributes) {
  89628. if (precreatedAttributes.hasOwnProperty(attributeName)) {
  89629. attributeLocation = attributeLocations8[attributeName];
  89630. if (defined_default(attributeLocation)) {
  89631. attribute = precreatedAttributes[attributeName];
  89632. attribute.index = attributeLocation;
  89633. attributes.push(attribute);
  89634. }
  89635. }
  89636. }
  89637. }
  89638. let indexBuffer;
  89639. if (defined_default(primitive.indices)) {
  89640. const accessor = accessors[primitive.indices];
  89641. let bufferView = accessor.bufferView;
  89642. if (defined_default(decodedData)) {
  89643. bufferView = decodedData.bufferView;
  89644. }
  89645. indexBuffer = rendererBuffers[bufferView];
  89646. }
  89647. rendererVertexArrays[`${meshId}.primitive.${primitiveId}`] = new VertexArray_default({
  89648. context,
  89649. attributes,
  89650. indexBuffer
  89651. });
  89652. });
  89653. });
  89654. }
  89655. function createRenderStates4(model) {
  89656. const loadResources = model._loadResources;
  89657. if (loadResources.createRenderStates) {
  89658. loadResources.createRenderStates = false;
  89659. ForEach_default.material(model.gltf, function(material, materialId) {
  89660. createRenderStateForMaterial(model, material, materialId);
  89661. });
  89662. }
  89663. }
  89664. function createRenderStateForMaterial(model, material, materialId) {
  89665. const rendererRenderStates = model._rendererResources.renderStates;
  89666. let blendEquationSeparate = [
  89667. WebGLConstants_default.FUNC_ADD,
  89668. WebGLConstants_default.FUNC_ADD
  89669. ];
  89670. let blendFuncSeparate = [
  89671. WebGLConstants_default.ONE,
  89672. WebGLConstants_default.ONE_MINUS_SRC_ALPHA,
  89673. WebGLConstants_default.ONE,
  89674. WebGLConstants_default.ONE_MINUS_SRC_ALPHA
  89675. ];
  89676. if (defined_default(material.extensions) && defined_default(material.extensions.KHR_blend)) {
  89677. blendEquationSeparate = material.extensions.KHR_blend.blendEquation;
  89678. blendFuncSeparate = material.extensions.KHR_blend.blendFactors;
  89679. }
  89680. const enableCulling = !material.doubleSided;
  89681. const blendingEnabled = material.alphaMode === "BLEND";
  89682. rendererRenderStates[materialId] = RenderState_default.fromCache({
  89683. cull: {
  89684. enabled: enableCulling
  89685. },
  89686. depthTest: {
  89687. enabled: true,
  89688. func: DepthFunction_default.LESS_OR_EQUAL
  89689. },
  89690. depthMask: !blendingEnabled,
  89691. blending: {
  89692. enabled: blendingEnabled,
  89693. equationRgb: blendEquationSeparate[0],
  89694. equationAlpha: blendEquationSeparate[1],
  89695. functionSourceRgb: blendFuncSeparate[0],
  89696. functionDestinationRgb: blendFuncSeparate[1],
  89697. functionSourceAlpha: blendFuncSeparate[2],
  89698. functionDestinationAlpha: blendFuncSeparate[3]
  89699. }
  89700. });
  89701. }
  89702. var gltfUniformsFromNode = {
  89703. MODEL: function(uniformState, model, runtimeNode) {
  89704. return function() {
  89705. return runtimeNode.computedMatrix;
  89706. };
  89707. },
  89708. VIEW: function(uniformState, model, runtimeNode) {
  89709. return function() {
  89710. return uniformState.view;
  89711. };
  89712. },
  89713. PROJECTION: function(uniformState, model, runtimeNode) {
  89714. return function() {
  89715. return uniformState.projection;
  89716. };
  89717. },
  89718. MODELVIEW: function(uniformState, model, runtimeNode) {
  89719. const mv = new Matrix4_default();
  89720. return function() {
  89721. return Matrix4_default.multiplyTransformation(
  89722. uniformState.view,
  89723. runtimeNode.computedMatrix,
  89724. mv
  89725. );
  89726. };
  89727. },
  89728. CESIUM_RTC_MODELVIEW: function(uniformState, model, runtimeNode) {
  89729. const mvRtc = new Matrix4_default();
  89730. return function() {
  89731. Matrix4_default.multiplyTransformation(
  89732. uniformState.view,
  89733. runtimeNode.computedMatrix,
  89734. mvRtc
  89735. );
  89736. return Matrix4_default.setTranslation(mvRtc, model._rtcCenterEye, mvRtc);
  89737. };
  89738. },
  89739. MODELVIEWPROJECTION: function(uniformState, model, runtimeNode) {
  89740. const mvp = new Matrix4_default();
  89741. return function() {
  89742. Matrix4_default.multiplyTransformation(
  89743. uniformState.view,
  89744. runtimeNode.computedMatrix,
  89745. mvp
  89746. );
  89747. return Matrix4_default.multiply(uniformState._projection, mvp, mvp);
  89748. };
  89749. },
  89750. MODELINVERSE: function(uniformState, model, runtimeNode) {
  89751. const mInverse = new Matrix4_default();
  89752. return function() {
  89753. return Matrix4_default.inverse(runtimeNode.computedMatrix, mInverse);
  89754. };
  89755. },
  89756. VIEWINVERSE: function(uniformState, model) {
  89757. return function() {
  89758. return uniformState.inverseView;
  89759. };
  89760. },
  89761. PROJECTIONINVERSE: function(uniformState, model, runtimeNode) {
  89762. return function() {
  89763. return uniformState.inverseProjection;
  89764. };
  89765. },
  89766. MODELVIEWINVERSE: function(uniformState, model, runtimeNode) {
  89767. const mv = new Matrix4_default();
  89768. const mvInverse = new Matrix4_default();
  89769. return function() {
  89770. Matrix4_default.multiplyTransformation(
  89771. uniformState.view,
  89772. runtimeNode.computedMatrix,
  89773. mv
  89774. );
  89775. return Matrix4_default.inverse(mv, mvInverse);
  89776. };
  89777. },
  89778. MODELVIEWPROJECTIONINVERSE: function(uniformState, model, runtimeNode) {
  89779. const mvp = new Matrix4_default();
  89780. const mvpInverse = new Matrix4_default();
  89781. return function() {
  89782. Matrix4_default.multiplyTransformation(
  89783. uniformState.view,
  89784. runtimeNode.computedMatrix,
  89785. mvp
  89786. );
  89787. Matrix4_default.multiply(uniformState._projection, mvp, mvp);
  89788. return Matrix4_default.inverse(mvp, mvpInverse);
  89789. };
  89790. },
  89791. MODELINVERSETRANSPOSE: function(uniformState, model, runtimeNode) {
  89792. const mInverse = new Matrix4_default();
  89793. const mInverseTranspose = new Matrix3_default();
  89794. return function() {
  89795. Matrix4_default.inverse(runtimeNode.computedMatrix, mInverse);
  89796. Matrix4_default.getMatrix3(mInverse, mInverseTranspose);
  89797. return Matrix3_default.transpose(mInverseTranspose, mInverseTranspose);
  89798. };
  89799. },
  89800. MODELVIEWINVERSETRANSPOSE: function(uniformState, model, runtimeNode) {
  89801. const mv = new Matrix4_default();
  89802. const mvInverse = new Matrix4_default();
  89803. const mvInverseTranspose = new Matrix3_default();
  89804. return function() {
  89805. Matrix4_default.multiplyTransformation(
  89806. uniformState.view,
  89807. runtimeNode.computedMatrix,
  89808. mv
  89809. );
  89810. Matrix4_default.inverse(mv, mvInverse);
  89811. Matrix4_default.getMatrix3(mvInverse, mvInverseTranspose);
  89812. return Matrix3_default.transpose(mvInverseTranspose, mvInverseTranspose);
  89813. };
  89814. },
  89815. VIEWPORT: function(uniformState, model, runtimeNode) {
  89816. return function() {
  89817. return uniformState.viewportCartesian4;
  89818. };
  89819. }
  89820. };
  89821. function getUniformFunctionFromSource(source, model, semantic, uniformState) {
  89822. const runtimeNode = model._runtime.nodes[source];
  89823. return gltfUniformsFromNode[semantic](uniformState, model, runtimeNode);
  89824. }
  89825. function createUniformsForMaterial(model, material, technique, instanceValues, context, textures, defaultTexture) {
  89826. const uniformMap2 = {};
  89827. const uniformValues = {};
  89828. let jointMatrixUniformName;
  89829. let morphWeightsUniformName;
  89830. ForEach_default.techniqueUniform(technique, function(uniform, uniformName) {
  89831. let uv;
  89832. if (defined_default(instanceValues) && defined_default(instanceValues[uniformName])) {
  89833. uv = ModelUtility_default.createUniformFunction(
  89834. uniform.type,
  89835. instanceValues[uniformName],
  89836. textures,
  89837. defaultTexture
  89838. );
  89839. uniformMap2[uniformName] = uv.func;
  89840. uniformValues[uniformName] = uv;
  89841. } else if (defined_default(uniform.node)) {
  89842. uniformMap2[uniformName] = getUniformFunctionFromSource(
  89843. uniform.node,
  89844. model,
  89845. uniform.semantic,
  89846. context.uniformState
  89847. );
  89848. } else if (defined_default(uniform.semantic)) {
  89849. if (uniform.semantic === "JOINTMATRIX") {
  89850. jointMatrixUniformName = uniformName;
  89851. } else if (uniform.semantic === "MORPHWEIGHTS") {
  89852. morphWeightsUniformName = uniformName;
  89853. } else if (uniform.semantic === "ALPHACUTOFF") {
  89854. const alphaMode = material.alphaMode;
  89855. if (defined_default(alphaMode) && alphaMode === "MASK") {
  89856. const alphaCutoffValue = defaultValue_default(material.alphaCutoff, 0.5);
  89857. uv = ModelUtility_default.createUniformFunction(
  89858. uniform.type,
  89859. alphaCutoffValue,
  89860. textures,
  89861. defaultTexture
  89862. );
  89863. uniformMap2[uniformName] = uv.func;
  89864. uniformValues[uniformName] = uv;
  89865. }
  89866. } else {
  89867. uniformMap2[uniformName] = ModelUtility_default.getGltfSemanticUniforms()[uniform.semantic](context.uniformState, model);
  89868. }
  89869. } else if (defined_default(uniform.value)) {
  89870. const uv2 = ModelUtility_default.createUniformFunction(
  89871. uniform.type,
  89872. uniform.value,
  89873. textures,
  89874. defaultTexture
  89875. );
  89876. uniformMap2[uniformName] = uv2.func;
  89877. uniformValues[uniformName] = uv2;
  89878. }
  89879. });
  89880. return {
  89881. map: uniformMap2,
  89882. values: uniformValues,
  89883. jointMatrixUniformName,
  89884. morphWeightsUniformName
  89885. };
  89886. }
  89887. function createUniformMaps(model, context) {
  89888. const loadResources = model._loadResources;
  89889. if (!loadResources.finishedProgramCreation()) {
  89890. return;
  89891. }
  89892. if (!loadResources.createUniformMaps) {
  89893. return;
  89894. }
  89895. loadResources.createUniformMaps = false;
  89896. const gltf = model.gltf;
  89897. const techniques = model._sourceTechniques;
  89898. const uniformMaps = model._uniformMaps;
  89899. const textures = model._rendererResources.textures;
  89900. const defaultTexture = model._defaultTexture;
  89901. ForEach_default.material(gltf, function(material, materialId) {
  89902. const modelMaterial = model._runtime.materialsById[materialId];
  89903. const technique = techniques[modelMaterial._technique];
  89904. const instanceValues = modelMaterial._values;
  89905. const uniforms = createUniformsForMaterial(
  89906. model,
  89907. material,
  89908. technique,
  89909. instanceValues,
  89910. context,
  89911. textures,
  89912. defaultTexture
  89913. );
  89914. const u3 = uniformMaps[materialId];
  89915. u3.uniformMap = uniforms.map;
  89916. u3.values = uniforms.values;
  89917. u3.jointMatrixUniformName = uniforms.jointMatrixUniformName;
  89918. u3.morphWeightsUniformName = uniforms.morphWeightsUniformName;
  89919. if (defined_default(technique.attributes.a_outlineCoordinates)) {
  89920. const outlineTexture = ModelOutlineLoader_default.createTexture(model, context);
  89921. u3.uniformMap.u_outlineTexture = function() {
  89922. return outlineTexture;
  89923. };
  89924. }
  89925. });
  89926. }
  89927. function createUniformsForDracoQuantizedAttributes(decodedData) {
  89928. return ModelUtility_default.createUniformsForDracoQuantizedAttributes(
  89929. decodedData.attributes
  89930. );
  89931. }
  89932. function createUniformsForQuantizedAttributes2(model, primitive) {
  89933. const programId = getProgramForPrimitive(model, primitive);
  89934. const quantizedUniforms = model._quantizedUniforms[programId];
  89935. return ModelUtility_default.createUniformsForQuantizedAttributes(
  89936. model.gltf,
  89937. primitive,
  89938. quantizedUniforms
  89939. );
  89940. }
  89941. function createPickColorFunction(color) {
  89942. return function() {
  89943. return color;
  89944. };
  89945. }
  89946. function createJointMatricesFunction(runtimeNode) {
  89947. return function() {
  89948. return runtimeNode.computedJointMatrices;
  89949. };
  89950. }
  89951. function createMorphWeightsFunction(runtimeNode) {
  89952. return function() {
  89953. return runtimeNode.weights;
  89954. };
  89955. }
  89956. function createSilhouetteColorFunction(model) {
  89957. return function() {
  89958. return model.silhouetteColor;
  89959. };
  89960. }
  89961. function createSilhouetteSizeFunction(model) {
  89962. return function() {
  89963. return model.silhouetteSize;
  89964. };
  89965. }
  89966. function createColorFunction(model) {
  89967. return function() {
  89968. return model.color;
  89969. };
  89970. }
  89971. function createClippingPlanesMatrixFunction(model) {
  89972. return function() {
  89973. return model._clippingPlanesMatrix;
  89974. };
  89975. }
  89976. function createIBLReferenceFrameMatrixFunction(model) {
  89977. return function() {
  89978. return model._iblReferenceFrameMatrix;
  89979. };
  89980. }
  89981. function createClippingPlanesFunction(model) {
  89982. return function() {
  89983. const clippingPlanes = model.clippingPlanes;
  89984. return !defined_default(clippingPlanes) || !clippingPlanes.enabled ? model._defaultTexture : clippingPlanes.texture;
  89985. };
  89986. }
  89987. function createClippingPlanesEdgeStyleFunction(model) {
  89988. return function() {
  89989. const clippingPlanes = model.clippingPlanes;
  89990. if (!defined_default(clippingPlanes)) {
  89991. return Color_default.WHITE.withAlpha(0);
  89992. }
  89993. const style = Color_default.clone(clippingPlanes.edgeColor);
  89994. style.alpha = clippingPlanes.edgeWidth;
  89995. return style;
  89996. };
  89997. }
  89998. function createColorBlendFunction(model) {
  89999. return function() {
  90000. return ColorBlendMode_default.getColorBlend(
  90001. model.colorBlendMode,
  90002. model.colorBlendAmount
  90003. );
  90004. };
  90005. }
  90006. function createIBLFactorFunction(model) {
  90007. return function() {
  90008. return model._imageBasedLighting.imageBasedLightingFactor;
  90009. };
  90010. }
  90011. function createLightColorFunction(model) {
  90012. return function() {
  90013. return model._lightColor;
  90014. };
  90015. }
  90016. function createLuminanceAtZenithFunction(model) {
  90017. return function() {
  90018. return model._imageBasedLighting.luminanceAtZenith;
  90019. };
  90020. }
  90021. function createSphericalHarmonicCoefficientsFunction(model) {
  90022. return function() {
  90023. return model._imageBasedLighting.sphericalHarmonicCoefficients;
  90024. };
  90025. }
  90026. function createSpecularEnvironmentMapFunction(model) {
  90027. return function() {
  90028. return model._imageBasedLighting.specularEnvironmentMapAtlas.texture;
  90029. };
  90030. }
  90031. function createSpecularEnvironmentMapSizeFunction(model) {
  90032. return function() {
  90033. return model._imageBasedLighting.specularEnvironmentMapAtlas.texture.dimensions;
  90034. };
  90035. }
  90036. function createSpecularEnvironmentMapLOD(model) {
  90037. return function() {
  90038. return model._imageBasedLighting.specularEnvironmentMapAtlas.maximumMipmapLevel;
  90039. };
  90040. }
  90041. function triangleCountFromPrimitiveIndices2(primitive, indicesCount) {
  90042. switch (primitive.mode) {
  90043. case PrimitiveType_default.TRIANGLES:
  90044. return indicesCount / 3;
  90045. case PrimitiveType_default.TRIANGLE_STRIP:
  90046. case PrimitiveType_default.TRIANGLE_FAN:
  90047. return Math.max(indicesCount - 2, 0);
  90048. default:
  90049. return 0;
  90050. }
  90051. }
  90052. function createCommand(model, gltfNode, runtimeNode, context, scene3DOnly) {
  90053. const nodeCommands = model._nodeCommands;
  90054. const pickIds = model._pickIds;
  90055. const allowPicking = model.allowPicking;
  90056. const runtimeMeshesByName = model._runtime.meshesByName;
  90057. const resources = model._rendererResources;
  90058. const rendererVertexArrays = resources.vertexArrays;
  90059. const rendererPrograms = resources.programs;
  90060. const rendererRenderStates = resources.renderStates;
  90061. const uniformMaps = model._uniformMaps;
  90062. const gltf = model.gltf;
  90063. const accessors = gltf.accessors;
  90064. const gltfMeshes = gltf.meshes;
  90065. const id = gltfNode.mesh;
  90066. const mesh2 = gltfMeshes[id];
  90067. const primitives = mesh2.primitives;
  90068. const length3 = primitives.length;
  90069. for (let i2 = 0; i2 < length3; ++i2) {
  90070. const primitive = primitives[i2];
  90071. const ix = accessors[primitive.indices];
  90072. const material = model._runtime.materialsById[primitive.material];
  90073. const programId = material._program;
  90074. const decodedData = model._decodedData[`${id}.primitive.${i2}`];
  90075. let boundingSphere;
  90076. const positionAccessor = primitive.attributes.POSITION;
  90077. if (defined_default(positionAccessor)) {
  90078. const minMax = ModelUtility_default.getAccessorMinMax(gltf, positionAccessor);
  90079. boundingSphere = BoundingSphere_default.fromCornerPoints(
  90080. Cartesian3_default.fromArray(minMax.min),
  90081. Cartesian3_default.fromArray(minMax.max)
  90082. );
  90083. }
  90084. const vertexArray = rendererVertexArrays[`${id}.primitive.${i2}`];
  90085. let offset2;
  90086. let count;
  90087. if (defined_default(decodedData)) {
  90088. count = decodedData.numberOfIndices;
  90089. offset2 = 0;
  90090. } else if (defined_default(ix)) {
  90091. count = ix.count;
  90092. offset2 = ix.byteOffset / IndexDatatype_default.getSizeInBytes(ix.componentType);
  90093. } else {
  90094. const positions = accessors[primitive.attributes.POSITION];
  90095. count = positions.count;
  90096. offset2 = 0;
  90097. }
  90098. model._trianglesLength += triangleCountFromPrimitiveIndices2(
  90099. primitive,
  90100. count
  90101. );
  90102. if (primitive.mode === PrimitiveType_default.POINTS) {
  90103. model._pointsLength += count;
  90104. }
  90105. const um = uniformMaps[primitive.material];
  90106. let uniformMap2 = um.uniformMap;
  90107. if (defined_default(um.jointMatrixUniformName)) {
  90108. const jointUniformMap = {};
  90109. jointUniformMap[um.jointMatrixUniformName] = createJointMatricesFunction(
  90110. runtimeNode
  90111. );
  90112. uniformMap2 = combine_default(uniformMap2, jointUniformMap);
  90113. }
  90114. if (defined_default(um.morphWeightsUniformName)) {
  90115. const morphWeightsUniformMap = {};
  90116. morphWeightsUniformMap[um.morphWeightsUniformName] = createMorphWeightsFunction(runtimeNode);
  90117. uniformMap2 = combine_default(uniformMap2, morphWeightsUniformMap);
  90118. }
  90119. uniformMap2 = combine_default(uniformMap2, {
  90120. gltf_color: createColorFunction(model),
  90121. gltf_colorBlend: createColorBlendFunction(model),
  90122. gltf_clippingPlanes: createClippingPlanesFunction(model),
  90123. gltf_clippingPlanesEdgeStyle: createClippingPlanesEdgeStyleFunction(
  90124. model
  90125. ),
  90126. gltf_clippingPlanesMatrix: createClippingPlanesMatrixFunction(model),
  90127. gltf_iblReferenceFrameMatrix: createIBLReferenceFrameMatrixFunction(
  90128. model
  90129. ),
  90130. gltf_iblFactor: createIBLFactorFunction(model),
  90131. gltf_lightColor: createLightColorFunction(model),
  90132. gltf_sphericalHarmonicCoefficients: createSphericalHarmonicCoefficientsFunction(
  90133. model
  90134. ),
  90135. gltf_specularMap: createSpecularEnvironmentMapFunction(model),
  90136. gltf_specularMapSize: createSpecularEnvironmentMapSizeFunction(model),
  90137. gltf_maxSpecularLOD: createSpecularEnvironmentMapLOD(model),
  90138. gltf_luminanceAtZenith: createLuminanceAtZenithFunction(model)
  90139. });
  90140. Splitter_default.addUniforms(model, uniformMap2);
  90141. if (defined_default(model._uniformMapLoaded)) {
  90142. uniformMap2 = model._uniformMapLoaded(uniformMap2, programId, runtimeNode);
  90143. }
  90144. let quantizedUniformMap = {};
  90145. if (model.extensionsUsed.WEB3D_quantized_attributes) {
  90146. quantizedUniformMap = createUniformsForQuantizedAttributes2(
  90147. model,
  90148. primitive
  90149. );
  90150. } else if (model._dequantizeInShader && defined_default(decodedData)) {
  90151. quantizedUniformMap = createUniformsForDracoQuantizedAttributes(
  90152. decodedData
  90153. );
  90154. }
  90155. uniformMap2 = combine_default(uniformMap2, quantizedUniformMap);
  90156. const rs = rendererRenderStates[primitive.material];
  90157. const isTranslucent2 = rs.blending.enabled;
  90158. let owner = model._pickObject;
  90159. if (!defined_default(owner)) {
  90160. owner = {
  90161. primitive: model,
  90162. id: model.id,
  90163. node: runtimeNode.publicNode,
  90164. mesh: runtimeMeshesByName[mesh2.name]
  90165. };
  90166. }
  90167. const castShadows = ShadowMode_default.castShadows(model._shadows);
  90168. const receiveShadows = ShadowMode_default.receiveShadows(model._shadows);
  90169. let pickId;
  90170. if (allowPicking && !defined_default(model._uniformMapLoaded)) {
  90171. pickId = context.createPickId(owner);
  90172. pickIds.push(pickId);
  90173. const pickUniforms = {
  90174. czm_pickColor: createPickColorFunction(pickId.color)
  90175. };
  90176. uniformMap2 = combine_default(uniformMap2, pickUniforms);
  90177. }
  90178. if (allowPicking) {
  90179. if (defined_default(model._pickIdLoaded) && defined_default(model._uniformMapLoaded)) {
  90180. pickId = model._pickIdLoaded();
  90181. } else {
  90182. pickId = "czm_pickColor";
  90183. }
  90184. }
  90185. const command = new DrawCommand_default({
  90186. boundingVolume: new BoundingSphere_default(),
  90187. cull: model.cull,
  90188. modelMatrix: new Matrix4_default(),
  90189. primitiveType: primitive.mode,
  90190. vertexArray,
  90191. count,
  90192. offset: offset2,
  90193. shaderProgram: rendererPrograms[programId],
  90194. castShadows,
  90195. receiveShadows,
  90196. uniformMap: uniformMap2,
  90197. renderState: rs,
  90198. owner,
  90199. pass: isTranslucent2 ? Pass_default.TRANSLUCENT : model.opaquePass,
  90200. pickId
  90201. });
  90202. let command2D;
  90203. if (!scene3DOnly) {
  90204. command2D = DrawCommand_default.shallowClone(command);
  90205. command2D.boundingVolume = new BoundingSphere_default();
  90206. command2D.modelMatrix = new Matrix4_default();
  90207. }
  90208. const nodeCommand = {
  90209. show: true,
  90210. boundingSphere,
  90211. command,
  90212. command2D,
  90213. silhouetteModelCommand: void 0,
  90214. silhouetteModelCommand2D: void 0,
  90215. silhouetteColorCommand: void 0,
  90216. silhouetteColorCommand2D: void 0,
  90217. translucentCommand: void 0,
  90218. translucentCommand2D: void 0,
  90219. disableCullingCommand: void 0,
  90220. disableCullingCommand2D: void 0,
  90221. programId
  90222. };
  90223. runtimeNode.commands.push(nodeCommand);
  90224. nodeCommands.push(nodeCommand);
  90225. }
  90226. }
  90227. function createRuntimeNodes2(model, context, scene3DOnly) {
  90228. const loadResources = model._loadResources;
  90229. if (!loadResources.finishedEverythingButTextureCreation()) {
  90230. return;
  90231. }
  90232. if (!loadResources.createRuntimeNodes) {
  90233. return;
  90234. }
  90235. loadResources.createRuntimeNodes = false;
  90236. const rootNodes = [];
  90237. const runtimeNodes = model._runtime.nodes;
  90238. const gltf = model.gltf;
  90239. const nodes = gltf.nodes;
  90240. const scene = gltf.scenes[gltf.scene];
  90241. const sceneNodes = scene.nodes;
  90242. const length3 = sceneNodes.length;
  90243. const stack = [];
  90244. const seen = {};
  90245. for (let i2 = 0; i2 < length3; ++i2) {
  90246. stack.push({
  90247. parentRuntimeNode: void 0,
  90248. gltfNode: nodes[sceneNodes[i2]],
  90249. id: sceneNodes[i2]
  90250. });
  90251. while (stack.length > 0) {
  90252. const n2 = stack.pop();
  90253. seen[n2.id] = true;
  90254. const parentRuntimeNode = n2.parentRuntimeNode;
  90255. const gltfNode = n2.gltfNode;
  90256. const runtimeNode = runtimeNodes[n2.id];
  90257. if (runtimeNode.parents.length === 0) {
  90258. if (defined_default(gltfNode.matrix)) {
  90259. runtimeNode.matrix = Matrix4_default.fromColumnMajorArray(gltfNode.matrix);
  90260. } else {
  90261. const rotation = gltfNode.rotation;
  90262. runtimeNode.translation = Cartesian3_default.fromArray(gltfNode.translation);
  90263. runtimeNode.rotation = Quaternion_default.unpack(rotation);
  90264. runtimeNode.scale = Cartesian3_default.fromArray(gltfNode.scale);
  90265. }
  90266. }
  90267. if (defined_default(parentRuntimeNode)) {
  90268. parentRuntimeNode.children.push(runtimeNode);
  90269. runtimeNode.parents.push(parentRuntimeNode);
  90270. } else {
  90271. rootNodes.push(runtimeNode);
  90272. }
  90273. if (defined_default(gltfNode.mesh)) {
  90274. createCommand(model, gltfNode, runtimeNode, context, scene3DOnly);
  90275. }
  90276. const children = gltfNode.children;
  90277. if (defined_default(children)) {
  90278. const childrenLength = children.length;
  90279. for (let j = 0; j < childrenLength; j++) {
  90280. const childId = children[j];
  90281. if (!seen[childId]) {
  90282. stack.push({
  90283. parentRuntimeNode: runtimeNode,
  90284. gltfNode: nodes[childId],
  90285. id: children[j]
  90286. });
  90287. }
  90288. }
  90289. }
  90290. }
  90291. }
  90292. model._runtime.rootNodes = rootNodes;
  90293. model._runtime.nodes = runtimeNodes;
  90294. }
  90295. function getGeometryByteLength(buffers) {
  90296. let memory = 0;
  90297. for (const id in buffers) {
  90298. if (buffers.hasOwnProperty(id)) {
  90299. memory += buffers[id].sizeInBytes;
  90300. }
  90301. }
  90302. return memory;
  90303. }
  90304. function getTexturesByteLength(textures) {
  90305. let memory = 0;
  90306. for (const id in textures) {
  90307. if (textures.hasOwnProperty(id)) {
  90308. memory += textures[id].sizeInBytes;
  90309. }
  90310. }
  90311. return memory;
  90312. }
  90313. function createResources2(model, frameState) {
  90314. const context = frameState.context;
  90315. const scene3DOnly = frameState.scene3DOnly;
  90316. const quantizedVertexShaders = model._quantizedVertexShaders;
  90317. const techniques = model._sourceTechniques;
  90318. const programs = model._sourcePrograms;
  90319. const resources = model._rendererResources;
  90320. let shaders = resources.sourceShaders;
  90321. if (model._loadRendererResourcesFromCache) {
  90322. shaders = resources.sourceShaders = model._cachedRendererResources.sourceShaders;
  90323. }
  90324. for (const techniqueId in techniques) {
  90325. if (techniques.hasOwnProperty(techniqueId)) {
  90326. const programId = techniques[techniqueId].program;
  90327. const program = programs[programId];
  90328. let shader = shaders[program.vertexShader];
  90329. ModelUtility_default.checkSupportedGlExtensions(program.glExtensions, context);
  90330. if (model.extensionsUsed.WEB3D_quantized_attributes || model._dequantizeInShader) {
  90331. let quantizedVS = quantizedVertexShaders[programId];
  90332. if (!defined_default(quantizedVS)) {
  90333. quantizedVS = modifyShaderForQuantizedAttributes2(
  90334. shader,
  90335. programId,
  90336. model
  90337. );
  90338. quantizedVertexShaders[programId] = quantizedVS;
  90339. }
  90340. shader = quantizedVS;
  90341. }
  90342. shader = modifyShader2(shader, programId, model._vertexShaderLoaded);
  90343. }
  90344. }
  90345. if (model._loadRendererResourcesFromCache) {
  90346. const cachedResources = model._cachedRendererResources;
  90347. resources.buffers = cachedResources.buffers;
  90348. resources.vertexArrays = cachedResources.vertexArrays;
  90349. resources.programs = cachedResources.programs;
  90350. resources.silhouettePrograms = cachedResources.silhouettePrograms;
  90351. resources.textures = cachedResources.textures;
  90352. resources.samplers = cachedResources.samplers;
  90353. resources.renderStates = cachedResources.renderStates;
  90354. if (defined_default(model._precreatedAttributes)) {
  90355. createVertexArrays(model, context);
  90356. }
  90357. model._cachedGeometryByteLength += getGeometryByteLength(
  90358. cachedResources.buffers
  90359. );
  90360. model._cachedTexturesByteLength += getTexturesByteLength(
  90361. cachedResources.textures
  90362. );
  90363. } else {
  90364. createBuffers2(model, frameState);
  90365. createPrograms(model, frameState);
  90366. createSamplers(model, context);
  90367. loadTexturesFromBufferViews(model);
  90368. createTextures(model, frameState);
  90369. }
  90370. createSkins(model);
  90371. createRuntimeAnimations(model);
  90372. if (!model._loadRendererResourcesFromCache) {
  90373. createVertexArrays(model, context);
  90374. createRenderStates4(model);
  90375. }
  90376. createUniformMaps(model, context);
  90377. createRuntimeNodes2(model, context, scene3DOnly);
  90378. }
  90379. function getNodeMatrix(node, result) {
  90380. const publicNode = node.publicNode;
  90381. const publicMatrix = publicNode.matrix;
  90382. if (publicNode.useMatrix && defined_default(publicMatrix)) {
  90383. Matrix4_default.clone(publicMatrix, result);
  90384. } else if (defined_default(node.matrix)) {
  90385. Matrix4_default.clone(node.matrix, result);
  90386. } else {
  90387. Matrix4_default.fromTranslationQuaternionRotationScale(
  90388. node.translation,
  90389. node.rotation,
  90390. node.scale,
  90391. result
  90392. );
  90393. publicNode.setMatrix(result);
  90394. }
  90395. }
  90396. var scratchNodeStack = [];
  90397. var scratchComputedTranslation2 = new Cartesian4_default();
  90398. var scratchComputedMatrixIn2D2 = new Matrix4_default();
  90399. function updateNodeHierarchyModelMatrix(model, modelTransformChanged, justLoaded, projection) {
  90400. const maxDirtyNumber = model._maxDirtyNumber;
  90401. const rootNodes = model._runtime.rootNodes;
  90402. const length3 = rootNodes.length;
  90403. const nodeStack = scratchNodeStack;
  90404. let computedModelMatrix = model._computedModelMatrix;
  90405. if (model._mode !== SceneMode_default.SCENE3D && !model._ignoreCommands) {
  90406. const translation3 = Matrix4_default.getColumn(
  90407. computedModelMatrix,
  90408. 3,
  90409. scratchComputedTranslation2
  90410. );
  90411. if (!Cartesian4_default.equals(translation3, Cartesian4_default.UNIT_W)) {
  90412. computedModelMatrix = Transforms_default.basisTo2D(
  90413. projection,
  90414. computedModelMatrix,
  90415. scratchComputedMatrixIn2D2
  90416. );
  90417. model._rtcCenter = model._rtcCenter3D;
  90418. } else {
  90419. const center = model.boundingSphere.center;
  90420. const to2D = Transforms_default.wgs84To2DModelMatrix(
  90421. projection,
  90422. center,
  90423. scratchComputedMatrixIn2D2
  90424. );
  90425. computedModelMatrix = Matrix4_default.multiply(
  90426. to2D,
  90427. computedModelMatrix,
  90428. scratchComputedMatrixIn2D2
  90429. );
  90430. if (defined_default(model._rtcCenter)) {
  90431. Matrix4_default.setTranslation(
  90432. computedModelMatrix,
  90433. Cartesian4_default.UNIT_W,
  90434. computedModelMatrix
  90435. );
  90436. model._rtcCenter = model._rtcCenter2D;
  90437. }
  90438. }
  90439. }
  90440. for (let i2 = 0; i2 < length3; ++i2) {
  90441. let n2 = rootNodes[i2];
  90442. getNodeMatrix(n2, n2.transformToRoot);
  90443. nodeStack.push(n2);
  90444. while (nodeStack.length > 0) {
  90445. n2 = nodeStack.pop();
  90446. const transformToRoot = n2.transformToRoot;
  90447. const commands = n2.commands;
  90448. if (n2.dirtyNumber === maxDirtyNumber || modelTransformChanged || justLoaded) {
  90449. const nodeMatrix = Matrix4_default.multiplyTransformation(
  90450. computedModelMatrix,
  90451. transformToRoot,
  90452. n2.computedMatrix
  90453. );
  90454. const commandsLength = commands.length;
  90455. if (commandsLength > 0) {
  90456. for (let j = 0; j < commandsLength; ++j) {
  90457. const primitiveCommand = commands[j];
  90458. let command = primitiveCommand.command;
  90459. Matrix4_default.clone(nodeMatrix, command.modelMatrix);
  90460. BoundingSphere_default.transform(
  90461. primitiveCommand.boundingSphere,
  90462. command.modelMatrix,
  90463. command.boundingVolume
  90464. );
  90465. if (defined_default(model._rtcCenter)) {
  90466. Cartesian3_default.add(
  90467. model._rtcCenter,
  90468. command.boundingVolume.center,
  90469. command.boundingVolume.center
  90470. );
  90471. }
  90472. command = primitiveCommand.command2D;
  90473. if (defined_default(command) && model._mode === SceneMode_default.SCENE2D) {
  90474. Matrix4_default.clone(nodeMatrix, command.modelMatrix);
  90475. command.modelMatrix[13] -= Math_default.sign(command.modelMatrix[13]) * 2 * Math_default.PI * projection.ellipsoid.maximumRadius;
  90476. BoundingSphere_default.transform(
  90477. primitiveCommand.boundingSphere,
  90478. command.modelMatrix,
  90479. command.boundingVolume
  90480. );
  90481. }
  90482. }
  90483. }
  90484. }
  90485. const children = n2.children;
  90486. if (defined_default(children)) {
  90487. const childrenLength = children.length;
  90488. for (let k = 0; k < childrenLength; ++k) {
  90489. const child = children[k];
  90490. child.dirtyNumber = Math.max(child.dirtyNumber, n2.dirtyNumber);
  90491. if (child.dirtyNumber === maxDirtyNumber || justLoaded) {
  90492. getNodeMatrix(child, child.transformToRoot);
  90493. Matrix4_default.multiplyTransformation(
  90494. transformToRoot,
  90495. child.transformToRoot,
  90496. child.transformToRoot
  90497. );
  90498. }
  90499. nodeStack.push(child);
  90500. }
  90501. }
  90502. }
  90503. }
  90504. ++model._maxDirtyNumber;
  90505. }
  90506. var scratchObjectSpace = new Matrix4_default();
  90507. function applySkins(model) {
  90508. const skinnedNodes = model._runtime.skinnedNodes;
  90509. const length3 = skinnedNodes.length;
  90510. for (let i2 = 0; i2 < length3; ++i2) {
  90511. const node = skinnedNodes[i2];
  90512. scratchObjectSpace = Matrix4_default.inverseTransformation(
  90513. node.transformToRoot,
  90514. scratchObjectSpace
  90515. );
  90516. const computedJointMatrices = node.computedJointMatrices;
  90517. const joints = node.joints;
  90518. const bindShapeMatrix = node.bindShapeMatrix;
  90519. const inverseBindMatrices = node.inverseBindMatrices;
  90520. const inverseBindMatricesLength = inverseBindMatrices.length;
  90521. for (let m = 0; m < inverseBindMatricesLength; ++m) {
  90522. if (!defined_default(computedJointMatrices[m])) {
  90523. computedJointMatrices[m] = new Matrix4_default();
  90524. }
  90525. computedJointMatrices[m] = Matrix4_default.multiplyTransformation(
  90526. scratchObjectSpace,
  90527. joints[m].transformToRoot,
  90528. computedJointMatrices[m]
  90529. );
  90530. computedJointMatrices[m] = Matrix4_default.multiplyTransformation(
  90531. computedJointMatrices[m],
  90532. inverseBindMatrices[m],
  90533. computedJointMatrices[m]
  90534. );
  90535. if (defined_default(bindShapeMatrix)) {
  90536. computedJointMatrices[m] = Matrix4_default.multiplyTransformation(
  90537. computedJointMatrices[m],
  90538. bindShapeMatrix,
  90539. computedJointMatrices[m]
  90540. );
  90541. }
  90542. }
  90543. }
  90544. }
  90545. function updatePerNodeShow(model) {
  90546. const rootNodes = model._runtime.rootNodes;
  90547. const length3 = rootNodes.length;
  90548. const nodeStack = scratchNodeStack;
  90549. for (let i2 = 0; i2 < length3; ++i2) {
  90550. let n2 = rootNodes[i2];
  90551. n2.computedShow = n2.publicNode.show;
  90552. nodeStack.push(n2);
  90553. while (nodeStack.length > 0) {
  90554. n2 = nodeStack.pop();
  90555. const show = n2.computedShow;
  90556. const nodeCommands = n2.commands;
  90557. const nodeCommandsLength = nodeCommands.length;
  90558. for (let j = 0; j < nodeCommandsLength; ++j) {
  90559. nodeCommands[j].show = show;
  90560. }
  90561. const children = n2.children;
  90562. if (defined_default(children)) {
  90563. const childrenLength = children.length;
  90564. for (let k = 0; k < childrenLength; ++k) {
  90565. const child = children[k];
  90566. child.computedShow = show && child.publicNode.show;
  90567. nodeStack.push(child);
  90568. }
  90569. }
  90570. }
  90571. }
  90572. }
  90573. function updatePickIds(model, context) {
  90574. const id = model.id;
  90575. if (model._id !== id) {
  90576. model._id = id;
  90577. const pickIds = model._pickIds;
  90578. const length3 = pickIds.length;
  90579. for (let i2 = 0; i2 < length3; ++i2) {
  90580. pickIds[i2].object.id = id;
  90581. }
  90582. }
  90583. }
  90584. function updateWireframe2(model) {
  90585. if (model._debugWireframe !== model.debugWireframe) {
  90586. model._debugWireframe = model.debugWireframe;
  90587. const primitiveType = model.debugWireframe ? PrimitiveType_default.LINES : PrimitiveType_default.TRIANGLES;
  90588. const nodeCommands = model._nodeCommands;
  90589. const length3 = nodeCommands.length;
  90590. for (let i2 = 0; i2 < length3; ++i2) {
  90591. nodeCommands[i2].command.primitiveType = primitiveType;
  90592. }
  90593. }
  90594. }
  90595. function updateShowBoundingVolume(model) {
  90596. if (model.debugShowBoundingVolume !== model._debugShowBoundingVolume) {
  90597. model._debugShowBoundingVolume = model.debugShowBoundingVolume;
  90598. const debugShowBoundingVolume2 = model.debugShowBoundingVolume;
  90599. const nodeCommands = model._nodeCommands;
  90600. const length3 = nodeCommands.length;
  90601. for (let i2 = 0; i2 < length3; ++i2) {
  90602. nodeCommands[i2].command.debugShowBoundingVolume = debugShowBoundingVolume2;
  90603. }
  90604. }
  90605. }
  90606. function updateShadows(model) {
  90607. if (model.shadows !== model._shadows) {
  90608. model._shadows = model.shadows;
  90609. const castShadows = ShadowMode_default.castShadows(model.shadows);
  90610. const receiveShadows = ShadowMode_default.receiveShadows(model.shadows);
  90611. const nodeCommands = model._nodeCommands;
  90612. const length3 = nodeCommands.length;
  90613. for (let i2 = 0; i2 < length3; i2++) {
  90614. const nodeCommand = nodeCommands[i2];
  90615. nodeCommand.command.castShadows = castShadows;
  90616. nodeCommand.command.receiveShadows = receiveShadows;
  90617. }
  90618. }
  90619. }
  90620. function getTranslucentRenderState2(model, renderState) {
  90621. const rs = clone_default(renderState, true);
  90622. rs.cull.enabled = false;
  90623. rs.depthTest.enabled = true;
  90624. rs.depthMask = false;
  90625. rs.blending = BlendingState_default.ALPHA_BLEND;
  90626. if (model.opaquePass === Pass_default.CESIUM_3D_TILE) {
  90627. rs.stencilTest = StencilConstants_default.setCesium3DTileBit();
  90628. rs.stencilMask = StencilConstants_default.CESIUM_3D_TILE_MASK;
  90629. }
  90630. return RenderState_default.fromCache(rs);
  90631. }
  90632. function deriveTranslucentCommand2(model, command) {
  90633. const translucentCommand = DrawCommand_default.shallowClone(command);
  90634. translucentCommand.pass = Pass_default.TRANSLUCENT;
  90635. translucentCommand.renderState = getTranslucentRenderState2(
  90636. model,
  90637. command.renderState
  90638. );
  90639. return translucentCommand;
  90640. }
  90641. function updateColor(model, frameState, forceDerive) {
  90642. const scene3DOnly = frameState.scene3DOnly;
  90643. const alpha = model.color.alpha;
  90644. if (alpha > 0 && alpha < 1) {
  90645. const nodeCommands = model._nodeCommands;
  90646. const length3 = nodeCommands.length;
  90647. if (length3 > 0 && (!defined_default(nodeCommands[0].translucentCommand) || forceDerive)) {
  90648. for (let i2 = 0; i2 < length3; ++i2) {
  90649. const nodeCommand = nodeCommands[i2];
  90650. const command = nodeCommand.command;
  90651. nodeCommand.translucentCommand = deriveTranslucentCommand2(
  90652. model,
  90653. command
  90654. );
  90655. if (!scene3DOnly) {
  90656. const command2D = nodeCommand.command2D;
  90657. nodeCommand.translucentCommand2D = deriveTranslucentCommand2(
  90658. model,
  90659. command2D
  90660. );
  90661. }
  90662. }
  90663. }
  90664. }
  90665. }
  90666. function getDisableCullingRenderState(renderState) {
  90667. const rs = clone_default(renderState, true);
  90668. rs.cull.enabled = false;
  90669. return RenderState_default.fromCache(rs);
  90670. }
  90671. function deriveDisableCullingCommand(command) {
  90672. const disableCullingCommand = DrawCommand_default.shallowClone(command);
  90673. disableCullingCommand.renderState = getDisableCullingRenderState(
  90674. command.renderState
  90675. );
  90676. return disableCullingCommand;
  90677. }
  90678. function updateBackFaceCulling(model, frameState, forceDerive) {
  90679. const scene3DOnly = frameState.scene3DOnly;
  90680. const backFaceCulling = model.backFaceCulling;
  90681. if (!backFaceCulling) {
  90682. const nodeCommands = model._nodeCommands;
  90683. const length3 = nodeCommands.length;
  90684. if (length3 > 0 && (!defined_default(nodeCommands[0].disableCullingCommand) || forceDerive)) {
  90685. for (let i2 = 0; i2 < length3; ++i2) {
  90686. const nodeCommand = nodeCommands[i2];
  90687. const command = nodeCommand.command;
  90688. nodeCommand.disableCullingCommand = deriveDisableCullingCommand(
  90689. command
  90690. );
  90691. if (!scene3DOnly) {
  90692. const command2D = nodeCommand.command2D;
  90693. nodeCommand.disableCullingCommand2D = deriveDisableCullingCommand(
  90694. command2D
  90695. );
  90696. }
  90697. }
  90698. }
  90699. }
  90700. }
  90701. function getProgramId(model, program) {
  90702. const programs = model._rendererResources.programs;
  90703. for (const id in programs) {
  90704. if (programs.hasOwnProperty(id)) {
  90705. if (programs[id] === program) {
  90706. return id;
  90707. }
  90708. }
  90709. }
  90710. }
  90711. function createSilhouetteProgram(model, program, frameState) {
  90712. let vs = program.vertexShaderSource.sources[0];
  90713. const attributeLocations8 = program._attributeLocations;
  90714. const normalAttributeName = model._normalAttributeName;
  90715. vs = ShaderSource_default.replaceMain(vs, "gltf_silhouette_main");
  90716. vs += `${"uniform float gltf_silhouetteSize; \nvoid main() \n{ \n gltf_silhouette_main(); \n vec3 n = normalize(czm_normal3D * "}${normalAttributeName});
  90717. n.x *= czm_projection[0][0];
  90718. n.y *= czm_projection[1][1];
  90719. vec4 clip = gl_Position;
  90720. clip.xy += n.xy * clip.w * gltf_silhouetteSize * czm_pixelRatio / czm_viewport.z;
  90721. gl_Position = clip;
  90722. }`;
  90723. const fs = "uniform vec4 gltf_silhouetteColor; \nvoid main() \n{ \n gl_FragColor = czm_gammaCorrect(gltf_silhouetteColor); \n}";
  90724. return ShaderProgram_default.fromCache({
  90725. context: frameState.context,
  90726. vertexShaderSource: vs,
  90727. fragmentShaderSource: fs,
  90728. attributeLocations: attributeLocations8
  90729. });
  90730. }
  90731. function hasSilhouette(model, frameState) {
  90732. return silhouetteSupported(frameState.context) && model.silhouetteSize > 0 && model.silhouetteColor.alpha > 0 && defined_default(model._normalAttributeName);
  90733. }
  90734. function hasTranslucentCommands(model) {
  90735. const nodeCommands = model._nodeCommands;
  90736. const length3 = nodeCommands.length;
  90737. for (let i2 = 0; i2 < length3; ++i2) {
  90738. const nodeCommand = nodeCommands[i2];
  90739. const command = nodeCommand.command;
  90740. if (command.pass === Pass_default.TRANSLUCENT) {
  90741. return true;
  90742. }
  90743. }
  90744. return false;
  90745. }
  90746. function isTranslucent(model) {
  90747. return model.color.alpha > 0 && model.color.alpha < 1;
  90748. }
  90749. function isInvisible(model) {
  90750. return model.color.alpha === 0;
  90751. }
  90752. function alphaDirty(currAlpha, prevAlpha) {
  90753. return Math.floor(currAlpha) !== Math.floor(prevAlpha) || Math.ceil(currAlpha) !== Math.ceil(prevAlpha);
  90754. }
  90755. var silhouettesLength = 0;
  90756. function createSilhouetteCommands(model, frameState) {
  90757. const stencilReference = ++silhouettesLength % 255;
  90758. const silhouetteTranslucent = hasTranslucentCommands(model) || isTranslucent(model) || model.silhouetteColor.alpha < 1;
  90759. const silhouettePrograms = model._rendererResources.silhouettePrograms;
  90760. const scene3DOnly = frameState.scene3DOnly;
  90761. const nodeCommands = model._nodeCommands;
  90762. const length3 = nodeCommands.length;
  90763. for (let i2 = 0; i2 < length3; ++i2) {
  90764. const nodeCommand = nodeCommands[i2];
  90765. const command = nodeCommand.command;
  90766. const modelCommand = isTranslucent(model) ? nodeCommand.translucentCommand : command;
  90767. const silhouetteModelCommand = DrawCommand_default.shallowClone(modelCommand);
  90768. let renderState = clone_default(modelCommand.renderState);
  90769. renderState.stencilTest = {
  90770. enabled: true,
  90771. frontFunction: WebGLConstants_default.ALWAYS,
  90772. backFunction: WebGLConstants_default.ALWAYS,
  90773. reference: stencilReference,
  90774. mask: ~0,
  90775. frontOperation: {
  90776. fail: WebGLConstants_default.KEEP,
  90777. zFail: WebGLConstants_default.KEEP,
  90778. zPass: WebGLConstants_default.REPLACE
  90779. },
  90780. backOperation: {
  90781. fail: WebGLConstants_default.KEEP,
  90782. zFail: WebGLConstants_default.KEEP,
  90783. zPass: WebGLConstants_default.REPLACE
  90784. }
  90785. };
  90786. if (isInvisible(model)) {
  90787. renderState.colorMask = {
  90788. red: false,
  90789. green: false,
  90790. blue: false,
  90791. alpha: false
  90792. };
  90793. renderState.depthMask = false;
  90794. }
  90795. renderState = RenderState_default.fromCache(renderState);
  90796. silhouetteModelCommand.renderState = renderState;
  90797. nodeCommand.silhouetteModelCommand = silhouetteModelCommand;
  90798. const silhouetteColorCommand = DrawCommand_default.shallowClone(command);
  90799. renderState = clone_default(command.renderState, true);
  90800. renderState.depthTest.enabled = true;
  90801. renderState.cull.enabled = false;
  90802. if (silhouetteTranslucent) {
  90803. silhouetteColorCommand.pass = Pass_default.TRANSLUCENT;
  90804. renderState.depthMask = false;
  90805. renderState.blending = BlendingState_default.ALPHA_BLEND;
  90806. }
  90807. renderState.stencilTest = {
  90808. enabled: true,
  90809. frontFunction: WebGLConstants_default.NOTEQUAL,
  90810. backFunction: WebGLConstants_default.NOTEQUAL,
  90811. reference: stencilReference,
  90812. mask: ~0,
  90813. frontOperation: {
  90814. fail: WebGLConstants_default.KEEP,
  90815. zFail: WebGLConstants_default.KEEP,
  90816. zPass: WebGLConstants_default.KEEP
  90817. },
  90818. backOperation: {
  90819. fail: WebGLConstants_default.KEEP,
  90820. zFail: WebGLConstants_default.KEEP,
  90821. zPass: WebGLConstants_default.KEEP
  90822. }
  90823. };
  90824. renderState = RenderState_default.fromCache(renderState);
  90825. const program = command.shaderProgram;
  90826. const id = getProgramId(model, program);
  90827. let silhouetteProgram = silhouettePrograms[id];
  90828. if (!defined_default(silhouetteProgram)) {
  90829. silhouetteProgram = createSilhouetteProgram(model, program, frameState);
  90830. silhouettePrograms[id] = silhouetteProgram;
  90831. }
  90832. const silhouetteUniformMap = combine_default(command.uniformMap, {
  90833. gltf_silhouetteColor: createSilhouetteColorFunction(model),
  90834. gltf_silhouetteSize: createSilhouetteSizeFunction(model)
  90835. });
  90836. silhouetteColorCommand.renderState = renderState;
  90837. silhouetteColorCommand.shaderProgram = silhouetteProgram;
  90838. silhouetteColorCommand.uniformMap = silhouetteUniformMap;
  90839. silhouetteColorCommand.castShadows = false;
  90840. silhouetteColorCommand.receiveShadows = false;
  90841. nodeCommand.silhouetteColorCommand = silhouetteColorCommand;
  90842. if (!scene3DOnly) {
  90843. const command2D = nodeCommand.command2D;
  90844. const silhouetteModelCommand2D = DrawCommand_default.shallowClone(
  90845. silhouetteModelCommand
  90846. );
  90847. silhouetteModelCommand2D.boundingVolume = command2D.boundingVolume;
  90848. silhouetteModelCommand2D.modelMatrix = command2D.modelMatrix;
  90849. nodeCommand.silhouetteModelCommand2D = silhouetteModelCommand2D;
  90850. const silhouetteColorCommand2D = DrawCommand_default.shallowClone(
  90851. silhouetteColorCommand
  90852. );
  90853. silhouetteModelCommand2D.boundingVolume = command2D.boundingVolume;
  90854. silhouetteModelCommand2D.modelMatrix = command2D.modelMatrix;
  90855. nodeCommand.silhouetteColorCommand2D = silhouetteColorCommand2D;
  90856. }
  90857. }
  90858. }
  90859. function modifyShaderForClippingPlanes(shader, clippingPlaneCollection, context) {
  90860. shader = ShaderSource_default.replaceMain(shader, "gltf_clip_main");
  90861. shader += `${Model._getClippingFunction(clippingPlaneCollection, context)}
  90862. `;
  90863. shader += `${"uniform highp sampler2D gltf_clippingPlanes; \nuniform mat4 gltf_clippingPlanesMatrix; \nuniform vec4 gltf_clippingPlanesEdgeStyle; \nvoid main() \n{ \n gltf_clip_main(); \n"}${getClipAndStyleCode_default(
  90864. "gltf_clippingPlanes",
  90865. "gltf_clippingPlanesMatrix",
  90866. "gltf_clippingPlanesEdgeStyle"
  90867. )}}
  90868. `;
  90869. return shader;
  90870. }
  90871. function updateSilhouette(model, frameState, force) {
  90872. if (!hasSilhouette(model, frameState)) {
  90873. return;
  90874. }
  90875. const nodeCommands = model._nodeCommands;
  90876. const dirty = nodeCommands.length > 0 && (alphaDirty(model.color.alpha, model._colorPreviousAlpha) || alphaDirty(
  90877. model.silhouetteColor.alpha,
  90878. model._silhouetteColorPreviousAlpha
  90879. ) || !defined_default(nodeCommands[0].silhouetteModelCommand));
  90880. model._colorPreviousAlpha = model.color.alpha;
  90881. model._silhouetteColorPreviousAlpha = model.silhouetteColor.alpha;
  90882. if (dirty || force) {
  90883. createSilhouetteCommands(model, frameState);
  90884. }
  90885. }
  90886. function updateClippingPlanes(model, frameState) {
  90887. const clippingPlanes = model._clippingPlanes;
  90888. if (defined_default(clippingPlanes) && clippingPlanes.owner === model) {
  90889. if (clippingPlanes.enabled) {
  90890. clippingPlanes.update(frameState);
  90891. }
  90892. }
  90893. }
  90894. var scratchBoundingSphere4 = new BoundingSphere_default();
  90895. function scaleInPixels(positionWC2, radius, frameState) {
  90896. scratchBoundingSphere4.center = positionWC2;
  90897. scratchBoundingSphere4.radius = radius;
  90898. return frameState.camera.getPixelSize(
  90899. scratchBoundingSphere4,
  90900. frameState.context.drawingBufferWidth,
  90901. frameState.context.drawingBufferHeight
  90902. );
  90903. }
  90904. var scratchPosition7 = new Cartesian3_default();
  90905. var scratchCartographic5 = new Cartographic_default();
  90906. function getScale(model, frameState) {
  90907. let scale = model.scale;
  90908. if (model.minimumPixelSize !== 0) {
  90909. const context = frameState.context;
  90910. const maxPixelSize = Math.max(
  90911. context.drawingBufferWidth,
  90912. context.drawingBufferHeight
  90913. );
  90914. const m = defined_default(model._clampedModelMatrix) ? model._clampedModelMatrix : model.modelMatrix;
  90915. scratchPosition7.x = m[12];
  90916. scratchPosition7.y = m[13];
  90917. scratchPosition7.z = m[14];
  90918. if (defined_default(model._rtcCenter)) {
  90919. Cartesian3_default.add(model._rtcCenter, scratchPosition7, scratchPosition7);
  90920. }
  90921. if (model._mode !== SceneMode_default.SCENE3D) {
  90922. const projection = frameState.mapProjection;
  90923. const cartographic2 = projection.ellipsoid.cartesianToCartographic(
  90924. scratchPosition7,
  90925. scratchCartographic5
  90926. );
  90927. projection.project(cartographic2, scratchPosition7);
  90928. Cartesian3_default.fromElements(
  90929. scratchPosition7.z,
  90930. scratchPosition7.x,
  90931. scratchPosition7.y,
  90932. scratchPosition7
  90933. );
  90934. }
  90935. const radius = model.boundingSphere.radius;
  90936. const metersPerPixel = scaleInPixels(scratchPosition7, radius, frameState);
  90937. const pixelsPerMeter = 1 / metersPerPixel;
  90938. const diameterInPixels = Math.min(
  90939. pixelsPerMeter * (2 * radius),
  90940. maxPixelSize
  90941. );
  90942. if (diameterInPixels < model.minimumPixelSize) {
  90943. scale = model.minimumPixelSize * metersPerPixel / (2 * model._initialRadius);
  90944. }
  90945. }
  90946. return defined_default(model.maximumScale) ? Math.min(model.maximumScale, scale) : scale;
  90947. }
  90948. function releaseCachedGltf(model) {
  90949. if (defined_default(model._cacheKey) && defined_default(model._cachedGltf) && --model._cachedGltf.count === 0) {
  90950. delete gltfCache[model._cacheKey];
  90951. }
  90952. model._cachedGltf = void 0;
  90953. }
  90954. function CachedRendererResources(context, cacheKey) {
  90955. this.buffers = void 0;
  90956. this.vertexArrays = void 0;
  90957. this.programs = void 0;
  90958. this.sourceShaders = void 0;
  90959. this.silhouettePrograms = void 0;
  90960. this.textures = void 0;
  90961. this.samplers = void 0;
  90962. this.renderStates = void 0;
  90963. this.ready = false;
  90964. this.context = context;
  90965. this.cacheKey = cacheKey;
  90966. this.count = 0;
  90967. }
  90968. function destroy(property) {
  90969. for (const name in property) {
  90970. if (property.hasOwnProperty(name)) {
  90971. property[name].destroy();
  90972. }
  90973. }
  90974. }
  90975. function destroyCachedRendererResources(resources) {
  90976. destroy(resources.buffers);
  90977. destroy(resources.vertexArrays);
  90978. destroy(resources.programs);
  90979. destroy(resources.silhouettePrograms);
  90980. destroy(resources.textures);
  90981. }
  90982. CachedRendererResources.prototype.release = function() {
  90983. if (--this.count === 0) {
  90984. if (defined_default(this.cacheKey)) {
  90985. delete this.context.cache.modelRendererResourceCache[this.cacheKey];
  90986. }
  90987. destroyCachedRendererResources(this);
  90988. return destroyObject_default(this);
  90989. }
  90990. return void 0;
  90991. };
  90992. function getUpdateHeightCallback(model, ellipsoid, cartoPosition) {
  90993. return function(clampedPosition) {
  90994. if (model.heightReference === HeightReference_default.RELATIVE_TO_GROUND) {
  90995. const clampedCart = ellipsoid.cartesianToCartographic(
  90996. clampedPosition,
  90997. scratchCartographic5
  90998. );
  90999. clampedCart.height += cartoPosition.height;
  91000. ellipsoid.cartographicToCartesian(clampedCart, clampedPosition);
  91001. }
  91002. const clampedModelMatrix = model._clampedModelMatrix;
  91003. Matrix4_default.clone(model.modelMatrix, clampedModelMatrix);
  91004. clampedModelMatrix[12] = clampedPosition.x;
  91005. clampedModelMatrix[13] = clampedPosition.y;
  91006. clampedModelMatrix[14] = clampedPosition.z;
  91007. model._heightChanged = true;
  91008. };
  91009. }
  91010. function updateClamping(model) {
  91011. if (defined_default(model._removeUpdateHeightCallback)) {
  91012. model._removeUpdateHeightCallback();
  91013. model._removeUpdateHeightCallback = void 0;
  91014. }
  91015. const scene = model._scene;
  91016. if (!defined_default(scene) || !defined_default(scene.globe) || model.heightReference === HeightReference_default.NONE) {
  91017. if (model.heightReference !== HeightReference_default.NONE) {
  91018. throw new DeveloperError_default(
  91019. "Height reference is not supported without a scene and globe."
  91020. );
  91021. }
  91022. model._clampedModelMatrix = void 0;
  91023. return;
  91024. }
  91025. const globe = scene.globe;
  91026. const ellipsoid = globe.ellipsoid;
  91027. const modelMatrix = model.modelMatrix;
  91028. scratchPosition7.x = modelMatrix[12];
  91029. scratchPosition7.y = modelMatrix[13];
  91030. scratchPosition7.z = modelMatrix[14];
  91031. const cartoPosition = ellipsoid.cartesianToCartographic(scratchPosition7);
  91032. if (!defined_default(model._clampedModelMatrix)) {
  91033. model._clampedModelMatrix = Matrix4_default.clone(modelMatrix, new Matrix4_default());
  91034. }
  91035. const surface = globe._surface;
  91036. model._removeUpdateHeightCallback = surface.updateHeight(
  91037. cartoPosition,
  91038. getUpdateHeightCallback(model, ellipsoid, cartoPosition)
  91039. );
  91040. const height = globe.getHeight(cartoPosition);
  91041. if (defined_default(height)) {
  91042. const cb = getUpdateHeightCallback(model, ellipsoid, cartoPosition);
  91043. Cartographic_default.clone(cartoPosition, scratchCartographic5);
  91044. scratchCartographic5.height = height;
  91045. ellipsoid.cartographicToCartesian(scratchCartographic5, scratchPosition7);
  91046. cb(scratchPosition7);
  91047. }
  91048. }
  91049. var scratchDisplayConditionCartesian = new Cartesian3_default();
  91050. var scratchDistanceDisplayConditionCartographic = new Cartographic_default();
  91051. function distanceDisplayConditionVisible(model, frameState) {
  91052. let distance2;
  91053. const ddc = model.distanceDisplayCondition;
  91054. const nearSquared = ddc.near * ddc.near;
  91055. const farSquared = ddc.far * ddc.far;
  91056. if (frameState.mode === SceneMode_default.SCENE2D) {
  91057. const frustum2DWidth = frameState.camera.frustum.right - frameState.camera.frustum.left;
  91058. distance2 = frustum2DWidth * 0.5;
  91059. distance2 = distance2 * distance2;
  91060. } else {
  91061. let position = Matrix4_default.getTranslation(
  91062. model.modelMatrix,
  91063. scratchDisplayConditionCartesian
  91064. );
  91065. if (frameState.mode === SceneMode_default.COLUMBUS_VIEW) {
  91066. const projection = frameState.mapProjection;
  91067. const ellipsoid = projection.ellipsoid;
  91068. const cartographic2 = ellipsoid.cartesianToCartographic(
  91069. position,
  91070. scratchDistanceDisplayConditionCartographic
  91071. );
  91072. position = projection.project(cartographic2, position);
  91073. Cartesian3_default.fromElements(position.z, position.x, position.y, position);
  91074. }
  91075. distance2 = Cartesian3_default.distanceSquared(
  91076. position,
  91077. frameState.camera.positionWC
  91078. );
  91079. }
  91080. return distance2 >= nearSquared && distance2 <= farSquared;
  91081. }
  91082. var scratchIBLReferenceFrameMatrix4 = new Matrix4_default();
  91083. var scratchIBLReferenceFrameMatrix3 = new Matrix3_default();
  91084. var scratchClippingPlanesMatrix = new Matrix4_default();
  91085. Model.prototype.update = function(frameState) {
  91086. if (frameState.mode === SceneMode_default.MORPHING) {
  91087. return;
  91088. }
  91089. if (!FeatureDetection_default.supportsWebP.initialized) {
  91090. FeatureDetection_default.supportsWebP.initialize();
  91091. return;
  91092. }
  91093. const context = frameState.context;
  91094. this._defaultTexture = context.defaultTexture;
  91095. const supportsWebP2 = FeatureDetection_default.supportsWebP();
  91096. if (this._state === ModelState2.NEEDS_LOAD && defined_default(this.gltf)) {
  91097. let cachedRendererResources;
  91098. const cacheKey = this.cacheKey;
  91099. if (defined_default(cacheKey)) {
  91100. context.cache.modelRendererResourceCache = defaultValue_default(
  91101. context.cache.modelRendererResourceCache,
  91102. {}
  91103. );
  91104. const modelCaches = context.cache.modelRendererResourceCache;
  91105. cachedRendererResources = modelCaches[this.cacheKey];
  91106. if (defined_default(cachedRendererResources)) {
  91107. if (!cachedRendererResources.ready) {
  91108. return;
  91109. }
  91110. ++cachedRendererResources.count;
  91111. this._loadRendererResourcesFromCache = true;
  91112. } else {
  91113. cachedRendererResources = new CachedRendererResources(
  91114. context,
  91115. cacheKey
  91116. );
  91117. cachedRendererResources.count = 1;
  91118. modelCaches[this.cacheKey] = cachedRendererResources;
  91119. }
  91120. this._cachedRendererResources = cachedRendererResources;
  91121. } else {
  91122. cachedRendererResources = new CachedRendererResources(context);
  91123. cachedRendererResources.count = 1;
  91124. this._cachedRendererResources = cachedRendererResources;
  91125. }
  91126. this._state = ModelState2.LOADING;
  91127. if (this._state !== ModelState2.FAILED) {
  91128. const extensions = this.gltf.extensions;
  91129. if (defined_default(extensions) && defined_default(extensions.CESIUM_RTC)) {
  91130. const center = Cartesian3_default.fromArray(extensions.CESIUM_RTC.center);
  91131. if (!Cartesian3_default.equals(center, Cartesian3_default.ZERO)) {
  91132. this._rtcCenter3D = center;
  91133. const projection = frameState.mapProjection;
  91134. const ellipsoid = projection.ellipsoid;
  91135. const cartographic2 = ellipsoid.cartesianToCartographic(
  91136. this._rtcCenter3D
  91137. );
  91138. const projectedCart = projection.project(cartographic2);
  91139. Cartesian3_default.fromElements(
  91140. projectedCart.z,
  91141. projectedCart.x,
  91142. projectedCart.y,
  91143. projectedCart
  91144. );
  91145. this._rtcCenter2D = projectedCart;
  91146. this._rtcCenterEye = new Cartesian3_default();
  91147. this._rtcCenter = this._rtcCenter3D;
  91148. }
  91149. }
  91150. addPipelineExtras_default(this.gltf);
  91151. this._loadResources = new ModelLoadResources_default();
  91152. if (!this._loadRendererResourcesFromCache) {
  91153. ModelUtility_default.parseBuffers(this, bufferLoad);
  91154. }
  91155. }
  91156. }
  91157. const loadResources = this._loadResources;
  91158. const incrementallyLoadTextures = this._incrementallyLoadTextures;
  91159. let justLoaded = false;
  91160. if (this._state === ModelState2.LOADING) {
  91161. if (loadResources.pendingBufferLoads === 0) {
  91162. if (!loadResources.initialized) {
  91163. frameState.brdfLutGenerator.update(frameState);
  91164. ModelUtility_default.checkSupportedExtensions(
  91165. this.extensionsRequired,
  91166. supportsWebP2
  91167. );
  91168. ModelUtility_default.updateForwardAxis(this);
  91169. if (!defined_default(this.gltf.extras.sourceVersion)) {
  91170. const gltf = this.gltf;
  91171. gltf.extras.sourceVersion = ModelUtility_default.getAssetVersion(gltf);
  91172. gltf.extras.sourceKHRTechniquesWebGL = defined_default(
  91173. ModelUtility_default.getUsedExtensions(gltf).KHR_techniques_webgl
  91174. );
  91175. this._sourceVersion = gltf.extras.sourceVersion;
  91176. this._sourceKHRTechniquesWebGL = gltf.extras.sourceKHRTechniquesWebGL;
  91177. updateVersion_default(gltf);
  91178. addDefaults_default(gltf);
  91179. const options = {
  91180. addBatchIdToGeneratedShaders: this._addBatchIdToGeneratedShaders
  91181. };
  91182. processModelMaterialsCommon_default(gltf, options);
  91183. processPbrMaterials_default(gltf, options);
  91184. }
  91185. this._sourceVersion = this.gltf.extras.sourceVersion;
  91186. this._sourceKHRTechniquesWebGL = this.gltf.extras.sourceKHRTechniquesWebGL;
  91187. this._dequantizeInShader = this._dequantizeInShader && DracoLoader_default.hasExtension(this);
  91188. addBuffersToLoadResources2(this);
  91189. parseArticulations(this);
  91190. parseTechniques(this);
  91191. if (!this._loadRendererResourcesFromCache) {
  91192. parseBufferViews2(this);
  91193. parseShaders(this);
  91194. parsePrograms(this);
  91195. parseTextures(this, context, supportsWebP2);
  91196. }
  91197. parseMaterials(this);
  91198. parseMeshes(this);
  91199. parseNodes(this);
  91200. parseCredits(this);
  91201. DracoLoader_default.parse(this, context);
  91202. loadResources.initialized = true;
  91203. }
  91204. if (!loadResources.finishedDecoding()) {
  91205. DracoLoader_default.decodeModel(this, context).catch(
  91206. ModelUtility_default.getFailedLoadFunction(this, "model", this.basePath)
  91207. );
  91208. }
  91209. if (loadResources.finishedDecoding() && !loadResources.resourcesParsed) {
  91210. this._boundingSphere = ModelUtility_default.computeBoundingSphere(this);
  91211. this._initialRadius = this._boundingSphere.radius;
  91212. DracoLoader_default.cacheDataForModel(this);
  91213. loadResources.resourcesParsed = true;
  91214. }
  91215. if (loadResources.resourcesParsed && loadResources.pendingShaderLoads === 0) {
  91216. if (this.showOutline) {
  91217. ModelOutlineLoader_default.outlinePrimitives(this);
  91218. }
  91219. createResources2(this, frameState);
  91220. }
  91221. }
  91222. if (loadResources.finished() || incrementallyLoadTextures && loadResources.finishedEverythingButTextureCreation()) {
  91223. this._state = ModelState2.LOADED;
  91224. justLoaded = true;
  91225. }
  91226. }
  91227. if (defined_default(loadResources) && this._state === ModelState2.LOADED) {
  91228. if (incrementallyLoadTextures && !justLoaded) {
  91229. createResources2(this, frameState);
  91230. }
  91231. if (loadResources.finished()) {
  91232. this._loadResources = void 0;
  91233. const resources = this._rendererResources;
  91234. const cachedResources = this._cachedRendererResources;
  91235. cachedResources.buffers = resources.buffers;
  91236. cachedResources.vertexArrays = resources.vertexArrays;
  91237. cachedResources.programs = resources.programs;
  91238. cachedResources.sourceShaders = resources.sourceShaders;
  91239. cachedResources.silhouettePrograms = resources.silhouettePrograms;
  91240. cachedResources.textures = resources.textures;
  91241. cachedResources.samplers = resources.samplers;
  91242. cachedResources.renderStates = resources.renderStates;
  91243. cachedResources.ready = true;
  91244. this._normalAttributeName = ModelUtility_default.getAttributeOrUniformBySemantic(
  91245. this.gltf,
  91246. "NORMAL"
  91247. );
  91248. if (defined_default(this._precreatedAttributes)) {
  91249. cachedResources.vertexArrays = {};
  91250. }
  91251. if (this.releaseGltfJson) {
  91252. releaseCachedGltf(this);
  91253. }
  91254. }
  91255. }
  91256. const silhouette = hasSilhouette(this, frameState);
  91257. const translucent = isTranslucent(this);
  91258. const invisible = isInvisible(this);
  91259. const backFaceCulling = this.backFaceCulling;
  91260. const displayConditionPassed = defined_default(this.distanceDisplayCondition) ? distanceDisplayConditionVisible(this, frameState) : true;
  91261. const show = this.show && displayConditionPassed && this.scale !== 0 && (!invisible || silhouette);
  91262. this._imageBasedLighting.update(frameState);
  91263. if (show && this._state === ModelState2.LOADED || justLoaded) {
  91264. const animated = this.activeAnimations.update(frameState) || this._cesiumAnimationsDirty;
  91265. this._cesiumAnimationsDirty = false;
  91266. this._dirty = false;
  91267. let modelMatrix = this.modelMatrix;
  91268. const modeChanged = frameState.mode !== this._mode;
  91269. this._mode = frameState.mode;
  91270. const modelTransformChanged = !Matrix4_default.equals(this._modelMatrix, modelMatrix) || this._scale !== this.scale || this._minimumPixelSize !== this.minimumPixelSize || this.minimumPixelSize !== 0 || this._maximumScale !== this.maximumScale || this._heightReference !== this.heightReference || this._heightChanged || modeChanged;
  91271. if (modelTransformChanged || justLoaded) {
  91272. Matrix4_default.clone(modelMatrix, this._modelMatrix);
  91273. updateClamping(this);
  91274. if (defined_default(this._clampedModelMatrix)) {
  91275. modelMatrix = this._clampedModelMatrix;
  91276. }
  91277. this._scale = this.scale;
  91278. this._minimumPixelSize = this.minimumPixelSize;
  91279. this._maximumScale = this.maximumScale;
  91280. this._heightReference = this.heightReference;
  91281. this._heightChanged = false;
  91282. const scale = getScale(this, frameState);
  91283. const computedModelMatrix = this._computedModelMatrix;
  91284. Matrix4_default.multiplyByUniformScale(modelMatrix, scale, computedModelMatrix);
  91285. if (this._upAxis === Axis_default.Y) {
  91286. Matrix4_default.multiplyTransformation(
  91287. computedModelMatrix,
  91288. Axis_default.Y_UP_TO_Z_UP,
  91289. computedModelMatrix
  91290. );
  91291. } else if (this._upAxis === Axis_default.X) {
  91292. Matrix4_default.multiplyTransformation(
  91293. computedModelMatrix,
  91294. Axis_default.X_UP_TO_Z_UP,
  91295. computedModelMatrix
  91296. );
  91297. }
  91298. if (this.forwardAxis === Axis_default.Z) {
  91299. Matrix4_default.multiplyTransformation(
  91300. computedModelMatrix,
  91301. Axis_default.Z_UP_TO_X_UP,
  91302. computedModelMatrix
  91303. );
  91304. }
  91305. }
  91306. if (animated || modelTransformChanged || justLoaded) {
  91307. updateNodeHierarchyModelMatrix(
  91308. this,
  91309. modelTransformChanged,
  91310. justLoaded,
  91311. frameState.mapProjection
  91312. );
  91313. this._dirty = true;
  91314. if (animated || justLoaded) {
  91315. applySkins(this);
  91316. }
  91317. }
  91318. if (this._perNodeShowDirty) {
  91319. this._perNodeShowDirty = false;
  91320. updatePerNodeShow(this);
  91321. }
  91322. updatePickIds(this, context);
  91323. updateWireframe2(this);
  91324. updateShowBoundingVolume(this);
  91325. updateShadows(this);
  91326. updateClippingPlanes(this, frameState);
  91327. const clippingPlanes = this._clippingPlanes;
  91328. let currentClippingPlanesState = 0;
  91329. const referenceMatrix = defaultValue_default(this.referenceMatrix, modelMatrix);
  91330. if (this._imageBasedLighting.useSphericalHarmonicCoefficients || this._imageBasedLighting.useSpecularEnvironmentMaps) {
  91331. let iblReferenceFrameMatrix3 = scratchIBLReferenceFrameMatrix3;
  91332. let iblReferenceFrameMatrix4 = scratchIBLReferenceFrameMatrix4;
  91333. iblReferenceFrameMatrix4 = Matrix4_default.multiply(
  91334. context.uniformState.view3D,
  91335. referenceMatrix,
  91336. iblReferenceFrameMatrix4
  91337. );
  91338. iblReferenceFrameMatrix3 = Matrix4_default.getMatrix3(
  91339. iblReferenceFrameMatrix4,
  91340. iblReferenceFrameMatrix3
  91341. );
  91342. iblReferenceFrameMatrix3 = Matrix3_default.getRotation(
  91343. iblReferenceFrameMatrix3,
  91344. iblReferenceFrameMatrix3
  91345. );
  91346. this._iblReferenceFrameMatrix = Matrix3_default.transpose(
  91347. iblReferenceFrameMatrix3,
  91348. this._iblReferenceFrameMatrix
  91349. );
  91350. }
  91351. this._shouldRegenerateShaders = this._shouldRegenerateShaders || this._imageBasedLighting.shouldRegenerateShaders;
  91352. if (isClippingEnabled(this)) {
  91353. let clippingPlanesMatrix = scratchClippingPlanesMatrix;
  91354. clippingPlanesMatrix = Matrix4_default.multiply(
  91355. context.uniformState.view3D,
  91356. referenceMatrix,
  91357. clippingPlanesMatrix
  91358. );
  91359. clippingPlanesMatrix = Matrix4_default.multiply(
  91360. clippingPlanesMatrix,
  91361. clippingPlanes.modelMatrix,
  91362. clippingPlanesMatrix
  91363. );
  91364. this._clippingPlanesMatrix = Matrix4_default.inverseTranspose(
  91365. clippingPlanesMatrix,
  91366. this._clippingPlanesMatrix
  91367. );
  91368. currentClippingPlanesState = clippingPlanes.clippingPlanesState;
  91369. }
  91370. this._shouldRegenerateShaders = this._shouldRegenerateShaders || this._clippingPlanesState !== currentClippingPlanesState;
  91371. this._clippingPlanesState = currentClippingPlanesState;
  91372. const currentlyColorShadingEnabled = isColorShadingEnabled(this);
  91373. if (currentlyColorShadingEnabled !== this._colorShadingEnabled) {
  91374. this._colorShadingEnabled = currentlyColorShadingEnabled;
  91375. this._shouldRegenerateShaders = true;
  91376. }
  91377. const splittingEnabled = this.splitDirection !== SplitDirection_default.NONE;
  91378. if (this._splittingEnabled !== splittingEnabled) {
  91379. this._splittingEnabled = splittingEnabled;
  91380. this._shouldRegenerateShaders = true;
  91381. }
  91382. if (this._shouldRegenerateShaders) {
  91383. regenerateShaders(this, frameState);
  91384. } else {
  91385. updateColor(this, frameState, false);
  91386. updateBackFaceCulling(this, frameState, false);
  91387. updateSilhouette(this, frameState, false);
  91388. }
  91389. }
  91390. if (justLoaded) {
  91391. const model = this;
  91392. frameState.afterRender.push(function() {
  91393. model._ready = true;
  91394. model._readyPromise.resolve(model);
  91395. });
  91396. return;
  91397. }
  91398. if (show && !this._ignoreCommands) {
  91399. const commandList = frameState.commandList;
  91400. const passes = frameState.passes;
  91401. const nodeCommands = this._nodeCommands;
  91402. const length3 = nodeCommands.length;
  91403. let i2;
  91404. let nc;
  91405. const idl2D = frameState.mapProjection.ellipsoid.maximumRadius * Math_default.PI;
  91406. let boundingVolume;
  91407. if (passes.render || passes.pick && this.allowPicking) {
  91408. for (i2 = 0; i2 < length3; ++i2) {
  91409. nc = nodeCommands[i2];
  91410. if (nc.show) {
  91411. let command = nc.command;
  91412. if (silhouette) {
  91413. command = nc.silhouetteModelCommand;
  91414. } else if (translucent) {
  91415. command = nc.translucentCommand;
  91416. } else if (!backFaceCulling) {
  91417. command = nc.disableCullingCommand;
  91418. }
  91419. commandList.push(command);
  91420. boundingVolume = nc.command.boundingVolume;
  91421. if (frameState.mode === SceneMode_default.SCENE2D && (boundingVolume.center.y + boundingVolume.radius > idl2D || boundingVolume.center.y - boundingVolume.radius < idl2D)) {
  91422. let command2D = nc.command2D;
  91423. if (silhouette) {
  91424. command2D = nc.silhouetteModelCommand2D;
  91425. } else if (translucent) {
  91426. command2D = nc.translucentCommand2D;
  91427. } else if (!backFaceCulling) {
  91428. command2D = nc.disableCullingCommand2D;
  91429. }
  91430. commandList.push(command2D);
  91431. }
  91432. }
  91433. }
  91434. if (silhouette && !passes.pick) {
  91435. for (i2 = 0; i2 < length3; ++i2) {
  91436. nc = nodeCommands[i2];
  91437. if (nc.show) {
  91438. commandList.push(nc.silhouetteColorCommand);
  91439. boundingVolume = nc.command.boundingVolume;
  91440. if (frameState.mode === SceneMode_default.SCENE2D && (boundingVolume.center.y + boundingVolume.radius > idl2D || boundingVolume.center.y - boundingVolume.radius < idl2D)) {
  91441. commandList.push(nc.silhouetteColorCommand2D);
  91442. }
  91443. }
  91444. }
  91445. }
  91446. }
  91447. }
  91448. const credit = this._credit;
  91449. if (defined_default(credit)) {
  91450. frameState.creditDisplay.addCredit(credit);
  91451. }
  91452. const resourceCredits = this._resourceCredits;
  91453. const resourceCreditsLength = resourceCredits.length;
  91454. for (let c14 = 0; c14 < resourceCreditsLength; c14++) {
  91455. frameState.creditDisplay.addCredit(resourceCredits[c14]);
  91456. }
  91457. const gltfCredits = this._gltfCredits;
  91458. const gltfCreditsLength = gltfCredits.length;
  91459. for (let c14 = 0; c14 < gltfCreditsLength; c14++) {
  91460. frameState.creditDisplay.addCredit(gltfCredits[c14]);
  91461. }
  91462. };
  91463. function destroyIfNotCached(rendererResources, cachedRendererResources) {
  91464. if (rendererResources.programs !== cachedRendererResources.programs) {
  91465. destroy(rendererResources.programs);
  91466. }
  91467. if (rendererResources.silhouettePrograms !== cachedRendererResources.silhouettePrograms) {
  91468. destroy(rendererResources.silhouettePrograms);
  91469. }
  91470. }
  91471. function regenerateShaders(model, frameState) {
  91472. const rendererResources = model._rendererResources;
  91473. const cachedRendererResources = model._cachedRendererResources;
  91474. destroyIfNotCached(rendererResources, cachedRendererResources);
  91475. let programId;
  91476. if (isClippingEnabled(model) || isColorShadingEnabled(model) || model.splitDirection !== SplitDirection_default.NONE || model._shouldRegenerateShaders) {
  91477. model._shouldRegenerateShaders = false;
  91478. rendererResources.programs = {};
  91479. rendererResources.silhouettePrograms = {};
  91480. const visitedPrograms = {};
  91481. const techniques = model._sourceTechniques;
  91482. let technique;
  91483. for (const techniqueId in techniques) {
  91484. if (techniques.hasOwnProperty(techniqueId)) {
  91485. technique = techniques[techniqueId];
  91486. programId = technique.program;
  91487. if (!visitedPrograms[programId]) {
  91488. visitedPrograms[programId] = true;
  91489. recreateProgram(
  91490. {
  91491. programId,
  91492. techniqueId
  91493. },
  91494. model,
  91495. frameState.context
  91496. );
  91497. }
  91498. }
  91499. }
  91500. } else {
  91501. rendererResources.programs = cachedRendererResources.programs;
  91502. rendererResources.silhouettePrograms = cachedRendererResources.silhouettePrograms;
  91503. }
  91504. const rendererPrograms = rendererResources.programs;
  91505. const nodeCommands = model._nodeCommands;
  91506. const commandCount = nodeCommands.length;
  91507. for (let i2 = 0; i2 < commandCount; ++i2) {
  91508. const nodeCommand = nodeCommands[i2];
  91509. programId = nodeCommand.programId;
  91510. const renderProgram = rendererPrograms[programId];
  91511. nodeCommand.command.shaderProgram = renderProgram;
  91512. if (defined_default(nodeCommand.command2D)) {
  91513. nodeCommand.command2D.shaderProgram = renderProgram;
  91514. }
  91515. }
  91516. updateColor(model, frameState, true);
  91517. updateBackFaceCulling(model, frameState, true);
  91518. updateSilhouette(model, frameState, true);
  91519. }
  91520. Model.prototype.isDestroyed = function() {
  91521. return false;
  91522. };
  91523. Model.prototype.destroy = function() {
  91524. if (defined_default(this._precreatedAttributes)) {
  91525. destroy(this._rendererResources.vertexArrays);
  91526. }
  91527. if (defined_default(this._removeUpdateHeightCallback)) {
  91528. this._removeUpdateHeightCallback();
  91529. this._removeUpdateHeightCallback = void 0;
  91530. }
  91531. if (defined_default(this._terrainProviderChangedCallback)) {
  91532. this._terrainProviderChangedCallback();
  91533. this._terrainProviderChangedCallback = void 0;
  91534. }
  91535. if (defined_default(this._cachedRendererResources)) {
  91536. destroyIfNotCached(this._rendererResources, this._cachedRendererResources);
  91537. }
  91538. this._rendererResources = void 0;
  91539. this._cachedRendererResources = this._cachedRendererResources && this._cachedRendererResources.release();
  91540. DracoLoader_default.destroyCachedDataForModel(this);
  91541. const pickIds = this._pickIds;
  91542. const length3 = pickIds.length;
  91543. for (let i2 = 0; i2 < length3; ++i2) {
  91544. pickIds[i2].destroy();
  91545. }
  91546. releaseCachedGltf(this);
  91547. this._quantizedVertexShaders = void 0;
  91548. const clippingPlaneCollection = this._clippingPlanes;
  91549. if (defined_default(clippingPlaneCollection) && !clippingPlaneCollection.isDestroyed() && clippingPlaneCollection.owner === this) {
  91550. clippingPlaneCollection.destroy();
  91551. }
  91552. this._clippingPlanes = void 0;
  91553. if (this._shouldDestroyImageBasedLighting && !this._imageBasedLighting.isDestroyed()) {
  91554. this._imageBasedLighting.destroy();
  91555. }
  91556. this._imageBasedLighting = void 0;
  91557. return destroyObject_default(this);
  91558. };
  91559. Model._getClippingFunction = getClippingFunction_default;
  91560. Model._modifyShaderForColor = modifyShaderForColor;
  91561. var Model_default = Model;
  91562. // node_modules/cesium/Source/Scene/Batched3DModel3DTileContent.js
  91563. function Batched3DModel3DTileContent(tileset, tile, resource, arrayBuffer, byteOffset) {
  91564. this._tileset = tileset;
  91565. this._tile = tile;
  91566. this._resource = resource;
  91567. this._model = void 0;
  91568. this._batchTable = void 0;
  91569. this._features = void 0;
  91570. this._classificationType = tileset.vectorClassificationOnly ? void 0 : tileset.classificationType;
  91571. this._metadata = void 0;
  91572. this._batchIdAttributeName = void 0;
  91573. this._diffuseAttributeOrUniformName = {};
  91574. this._rtcCenterTransform = void 0;
  91575. this._contentModelMatrix = void 0;
  91576. this.featurePropertiesDirty = false;
  91577. this._group = void 0;
  91578. initialize4(this, arrayBuffer, byteOffset);
  91579. }
  91580. Batched3DModel3DTileContent._deprecationWarning = deprecationWarning_default;
  91581. Object.defineProperties(Batched3DModel3DTileContent.prototype, {
  91582. featuresLength: {
  91583. get: function() {
  91584. return this.batchTable.featuresLength;
  91585. }
  91586. },
  91587. pointsLength: {
  91588. get: function() {
  91589. return this._model.pointsLength;
  91590. }
  91591. },
  91592. trianglesLength: {
  91593. get: function() {
  91594. return this._model.trianglesLength;
  91595. }
  91596. },
  91597. geometryByteLength: {
  91598. get: function() {
  91599. return this._model.geometryByteLength;
  91600. }
  91601. },
  91602. texturesByteLength: {
  91603. get: function() {
  91604. return this._model.texturesByteLength;
  91605. }
  91606. },
  91607. batchTableByteLength: {
  91608. get: function() {
  91609. return this.batchTable.memorySizeInBytes;
  91610. }
  91611. },
  91612. innerContents: {
  91613. get: function() {
  91614. return void 0;
  91615. }
  91616. },
  91617. readyPromise: {
  91618. get: function() {
  91619. return this._model.readyPromise;
  91620. }
  91621. },
  91622. tileset: {
  91623. get: function() {
  91624. return this._tileset;
  91625. }
  91626. },
  91627. tile: {
  91628. get: function() {
  91629. return this._tile;
  91630. }
  91631. },
  91632. url: {
  91633. get: function() {
  91634. return this._resource.getUrlComponent(true);
  91635. }
  91636. },
  91637. metadata: {
  91638. get: function() {
  91639. return this._metadata;
  91640. },
  91641. set: function(value) {
  91642. this._metadata = value;
  91643. }
  91644. },
  91645. batchTable: {
  91646. get: function() {
  91647. return this._batchTable;
  91648. }
  91649. },
  91650. group: {
  91651. get: function() {
  91652. return this._group;
  91653. },
  91654. set: function(value) {
  91655. this._group = value;
  91656. }
  91657. }
  91658. });
  91659. function getBatchIdAttributeName(gltf) {
  91660. let batchIdAttributeName = ModelUtility_default.getAttributeOrUniformBySemantic(
  91661. gltf,
  91662. "_BATCHID"
  91663. );
  91664. if (!defined_default(batchIdAttributeName)) {
  91665. batchIdAttributeName = ModelUtility_default.getAttributeOrUniformBySemantic(
  91666. gltf,
  91667. "BATCHID"
  91668. );
  91669. if (defined_default(batchIdAttributeName)) {
  91670. Batched3DModel3DTileContent._deprecationWarning(
  91671. "b3dm-legacy-batchid",
  91672. "The glTF in this b3dm uses the semantic `BATCHID`. Application-specific semantics should be prefixed with an underscore: `_BATCHID`."
  91673. );
  91674. }
  91675. }
  91676. return batchIdAttributeName;
  91677. }
  91678. function getVertexShaderCallback(content) {
  91679. return function(vs, programId) {
  91680. const batchTable = content._batchTable;
  91681. const handleTranslucent = !defined_default(content._classificationType);
  91682. const gltf = content._model.gltf;
  91683. if (defined_default(gltf)) {
  91684. content._batchIdAttributeName = getBatchIdAttributeName(gltf);
  91685. content._diffuseAttributeOrUniformName[programId] = ModelUtility_default.getDiffuseAttributeOrUniform(gltf, programId);
  91686. }
  91687. const callback = batchTable.getVertexShaderCallback(
  91688. handleTranslucent,
  91689. content._batchIdAttributeName,
  91690. content._diffuseAttributeOrUniformName[programId]
  91691. );
  91692. return defined_default(callback) ? callback(vs) : vs;
  91693. };
  91694. }
  91695. function getFragmentShaderCallback(content) {
  91696. return function(fs, programId) {
  91697. const batchTable = content._batchTable;
  91698. const handleTranslucent = !defined_default(content._classificationType);
  91699. const gltf = content._model.gltf;
  91700. if (defined_default(gltf)) {
  91701. content._diffuseAttributeOrUniformName[programId] = ModelUtility_default.getDiffuseAttributeOrUniform(gltf, programId);
  91702. }
  91703. const callback = batchTable.getFragmentShaderCallback(
  91704. handleTranslucent,
  91705. content._diffuseAttributeOrUniformName[programId],
  91706. false
  91707. );
  91708. return defined_default(callback) ? callback(fs) : fs;
  91709. };
  91710. }
  91711. function getPickIdCallback(content) {
  91712. return function() {
  91713. return content._batchTable.getPickId();
  91714. };
  91715. }
  91716. function getClassificationFragmentShaderCallback(content) {
  91717. return function(fs) {
  91718. const batchTable = content._batchTable;
  91719. const callback = batchTable.getClassificationFragmentShaderCallback();
  91720. return defined_default(callback) ? callback(fs) : fs;
  91721. };
  91722. }
  91723. function createColorChangedCallback(content) {
  91724. return function(batchId, color) {
  91725. content._model.updateCommands(batchId, color);
  91726. };
  91727. }
  91728. function initialize4(content, arrayBuffer, byteOffset) {
  91729. const tileset = content._tileset;
  91730. const tile = content._tile;
  91731. const resource = content._resource;
  91732. const b3dm = B3dmParser_default.parse(arrayBuffer, byteOffset);
  91733. let batchLength = b3dm.batchLength;
  91734. const featureTableJson = b3dm.featureTableJson;
  91735. const featureTableBinary = b3dm.featureTableBinary;
  91736. const featureTable = new Cesium3DTileFeatureTable_default(
  91737. featureTableJson,
  91738. featureTableBinary
  91739. );
  91740. batchLength = featureTable.getGlobalProperty("BATCH_LENGTH");
  91741. featureTable.featuresLength = batchLength;
  91742. const batchTableJson = b3dm.batchTableJson;
  91743. const batchTableBinary = b3dm.batchTableBinary;
  91744. let colorChangedCallback;
  91745. if (defined_default(content._classificationType)) {
  91746. colorChangedCallback = createColorChangedCallback(content);
  91747. }
  91748. const batchTable = new Cesium3DTileBatchTable_default(
  91749. content,
  91750. batchLength,
  91751. batchTableJson,
  91752. batchTableBinary,
  91753. colorChangedCallback
  91754. );
  91755. content._batchTable = batchTable;
  91756. const gltfView = b3dm.gltf;
  91757. const pickObject = {
  91758. content,
  91759. primitive: tileset
  91760. };
  91761. content._rtcCenterTransform = Matrix4_default.IDENTITY;
  91762. const rtcCenter = featureTable.getGlobalProperty(
  91763. "RTC_CENTER",
  91764. ComponentDatatype_default.FLOAT,
  91765. 3
  91766. );
  91767. if (defined_default(rtcCenter)) {
  91768. content._rtcCenterTransform = Matrix4_default.fromTranslation(
  91769. Cartesian3_default.fromArray(rtcCenter)
  91770. );
  91771. }
  91772. content._contentModelMatrix = Matrix4_default.multiply(
  91773. tile.computedTransform,
  91774. content._rtcCenterTransform,
  91775. new Matrix4_default()
  91776. );
  91777. if (!defined_default(content._classificationType)) {
  91778. content._model = new Model_default({
  91779. gltf: gltfView,
  91780. cull: false,
  91781. releaseGltfJson: true,
  91782. opaquePass: Pass_default.CESIUM_3D_TILE,
  91783. basePath: resource,
  91784. requestType: RequestType_default.TILES3D,
  91785. modelMatrix: content._contentModelMatrix,
  91786. upAxis: tileset._gltfUpAxis,
  91787. forwardAxis: Axis_default.X,
  91788. shadows: tileset.shadows,
  91789. debugWireframe: tileset.debugWireframe,
  91790. incrementallyLoadTextures: false,
  91791. vertexShaderLoaded: getVertexShaderCallback(content),
  91792. fragmentShaderLoaded: getFragmentShaderCallback(content),
  91793. uniformMapLoaded: batchTable.getUniformMapCallback(),
  91794. pickIdLoaded: getPickIdCallback(content),
  91795. addBatchIdToGeneratedShaders: batchLength > 0,
  91796. pickObject,
  91797. lightColor: tileset.lightColor,
  91798. imageBasedLighting: tileset.imageBasedLighting,
  91799. backFaceCulling: tileset.backFaceCulling,
  91800. showOutline: tileset.showOutline,
  91801. showCreditsOnScreen: tileset.showCreditsOnScreen
  91802. });
  91803. content._model.readyPromise.then(function(model) {
  91804. model.activeAnimations.addAll({
  91805. loop: ModelAnimationLoop_default.REPEAT
  91806. });
  91807. });
  91808. } else {
  91809. content._model = new ClassificationModel_default({
  91810. gltf: gltfView,
  91811. cull: false,
  91812. basePath: resource,
  91813. requestType: RequestType_default.TILES3D,
  91814. modelMatrix: content._contentModelMatrix,
  91815. upAxis: tileset._gltfUpAxis,
  91816. forwardAxis: Axis_default.X,
  91817. debugWireframe: tileset.debugWireframe,
  91818. vertexShaderLoaded: getVertexShaderCallback(content),
  91819. classificationShaderLoaded: getClassificationFragmentShaderCallback(
  91820. content
  91821. ),
  91822. uniformMapLoaded: batchTable.getUniformMapCallback(),
  91823. pickIdLoaded: getPickIdCallback(content),
  91824. classificationType: content._classificationType,
  91825. batchTable
  91826. });
  91827. }
  91828. }
  91829. function createFeatures(content) {
  91830. const featuresLength = content.featuresLength;
  91831. if (!defined_default(content._features) && featuresLength > 0) {
  91832. const features = new Array(featuresLength);
  91833. for (let i2 = 0; i2 < featuresLength; ++i2) {
  91834. features[i2] = new Cesium3DTileFeature_default(content, i2);
  91835. }
  91836. content._features = features;
  91837. }
  91838. }
  91839. Batched3DModel3DTileContent.prototype.hasProperty = function(batchId, name) {
  91840. return this._batchTable.hasProperty(batchId, name);
  91841. };
  91842. Batched3DModel3DTileContent.prototype.getFeature = function(batchId) {
  91843. const featuresLength = this.featuresLength;
  91844. if (!defined_default(batchId) || batchId < 0 || batchId >= featuresLength) {
  91845. throw new DeveloperError_default(
  91846. `batchId is required and between zero and featuresLength - 1 (${featuresLength - 1}).`
  91847. );
  91848. }
  91849. createFeatures(this);
  91850. return this._features[batchId];
  91851. };
  91852. Batched3DModel3DTileContent.prototype.applyDebugSettings = function(enabled, color) {
  91853. color = enabled ? color : Color_default.WHITE;
  91854. if (this.featuresLength === 0) {
  91855. this._model.color = color;
  91856. } else {
  91857. this._batchTable.setAllColor(color);
  91858. }
  91859. };
  91860. Batched3DModel3DTileContent.prototype.applyStyle = function(style) {
  91861. if (this.featuresLength === 0) {
  91862. const hasColorStyle = defined_default(style) && defined_default(style.color);
  91863. const hasShowStyle = defined_default(style) && defined_default(style.show);
  91864. this._model.color = hasColorStyle ? style.color.evaluateColor(void 0, this._model.color) : Color_default.clone(Color_default.WHITE, this._model.color);
  91865. this._model.show = hasShowStyle ? style.show.evaluate(void 0) : true;
  91866. } else {
  91867. this._batchTable.applyStyle(style);
  91868. }
  91869. };
  91870. Batched3DModel3DTileContent.prototype.update = function(tileset, frameState) {
  91871. const commandStart = frameState.commandList.length;
  91872. const model = this._model;
  91873. const tile = this._tile;
  91874. const batchTable = this._batchTable;
  91875. batchTable.update(tileset, frameState);
  91876. this._contentModelMatrix = Matrix4_default.multiply(
  91877. tile.computedTransform,
  91878. this._rtcCenterTransform,
  91879. this._contentModelMatrix
  91880. );
  91881. model.modelMatrix = this._contentModelMatrix;
  91882. model.shadows = tileset.shadows;
  91883. model.lightColor = tileset.lightColor;
  91884. model.imageBasedLighting = tileset.imageBasedLighting;
  91885. model.backFaceCulling = tileset.backFaceCulling;
  91886. model.debugWireframe = tileset.debugWireframe;
  91887. model.showCreditsOnScreen = tileset.showCreditsOnScreen;
  91888. model.splitDirection = tileset.splitDirection;
  91889. const tilesetClippingPlanes = tileset.clippingPlanes;
  91890. model.referenceMatrix = tileset.clippingPlanesOriginMatrix;
  91891. if (defined_default(tilesetClippingPlanes) && tile.clippingPlanesDirty) {
  91892. model._clippingPlanes = tilesetClippingPlanes.enabled && tile._isClipped ? tilesetClippingPlanes : void 0;
  91893. }
  91894. if (defined_default(tilesetClippingPlanes) && defined_default(model._clippingPlanes) && model._clippingPlanes !== tilesetClippingPlanes) {
  91895. model._clippingPlanes = tilesetClippingPlanes;
  91896. }
  91897. model.update(frameState);
  91898. const commandEnd = frameState.commandList.length;
  91899. if (commandStart < commandEnd && (frameState.passes.render || frameState.passes.pick) && !defined_default(this._classificationType)) {
  91900. batchTable.addDerivedCommands(frameState, commandStart);
  91901. }
  91902. };
  91903. Batched3DModel3DTileContent.prototype.isDestroyed = function() {
  91904. return false;
  91905. };
  91906. Batched3DModel3DTileContent.prototype.destroy = function() {
  91907. this._model = this._model && this._model.destroy();
  91908. this._batchTable = this._batchTable && this._batchTable.destroy();
  91909. return destroyObject_default(this);
  91910. };
  91911. var Batched3DModel3DTileContent_default = Batched3DModel3DTileContent;
  91912. // node_modules/cesium/Source/Scene/Composite3DTileContent.js
  91913. function Composite3DTileContent(tileset, tile, resource, arrayBuffer, byteOffset, factory) {
  91914. this._tileset = tileset;
  91915. this._tile = tile;
  91916. this._resource = resource;
  91917. this._contents = [];
  91918. this._readyPromise = defer_default();
  91919. this._metadata = void 0;
  91920. this._group = void 0;
  91921. initialize5(this, arrayBuffer, byteOffset, factory);
  91922. }
  91923. Object.defineProperties(Composite3DTileContent.prototype, {
  91924. featurePropertiesDirty: {
  91925. get: function() {
  91926. const contents = this._contents;
  91927. const length3 = contents.length;
  91928. for (let i2 = 0; i2 < length3; ++i2) {
  91929. if (contents[i2].featurePropertiesDirty) {
  91930. return true;
  91931. }
  91932. }
  91933. return false;
  91934. },
  91935. set: function(value) {
  91936. const contents = this._contents;
  91937. const length3 = contents.length;
  91938. for (let i2 = 0; i2 < length3; ++i2) {
  91939. contents[i2].featurePropertiesDirty = value;
  91940. }
  91941. }
  91942. },
  91943. featuresLength: {
  91944. get: function() {
  91945. return 0;
  91946. }
  91947. },
  91948. pointsLength: {
  91949. get: function() {
  91950. return 0;
  91951. }
  91952. },
  91953. trianglesLength: {
  91954. get: function() {
  91955. return 0;
  91956. }
  91957. },
  91958. geometryByteLength: {
  91959. get: function() {
  91960. return 0;
  91961. }
  91962. },
  91963. texturesByteLength: {
  91964. get: function() {
  91965. return 0;
  91966. }
  91967. },
  91968. batchTableByteLength: {
  91969. get: function() {
  91970. return 0;
  91971. }
  91972. },
  91973. innerContents: {
  91974. get: function() {
  91975. return this._contents;
  91976. }
  91977. },
  91978. readyPromise: {
  91979. get: function() {
  91980. return this._readyPromise.promise;
  91981. }
  91982. },
  91983. tileset: {
  91984. get: function() {
  91985. return this._tileset;
  91986. }
  91987. },
  91988. tile: {
  91989. get: function() {
  91990. return this._tile;
  91991. }
  91992. },
  91993. url: {
  91994. get: function() {
  91995. return this._resource.getUrlComponent(true);
  91996. }
  91997. },
  91998. metadata: {
  91999. get: function() {
  92000. return this._metadata;
  92001. },
  92002. set: function(value) {
  92003. this._metadata = value;
  92004. const contents = this._contents;
  92005. const length3 = contents.length;
  92006. for (let i2 = 0; i2 < length3; ++i2) {
  92007. contents[i2].metadata = value;
  92008. }
  92009. }
  92010. },
  92011. batchTable: {
  92012. get: function() {
  92013. return void 0;
  92014. }
  92015. },
  92016. group: {
  92017. get: function() {
  92018. return this._group;
  92019. },
  92020. set: function(value) {
  92021. this._group = value;
  92022. const contents = this._contents;
  92023. const length3 = contents.length;
  92024. for (let i2 = 0; i2 < length3; ++i2) {
  92025. contents[i2].group = value;
  92026. }
  92027. }
  92028. }
  92029. });
  92030. var sizeOfUint324 = Uint32Array.BYTES_PER_ELEMENT;
  92031. function initialize5(content, arrayBuffer, byteOffset, factory) {
  92032. byteOffset = defaultValue_default(byteOffset, 0);
  92033. const uint8Array = new Uint8Array(arrayBuffer);
  92034. const view = new DataView(arrayBuffer);
  92035. byteOffset += sizeOfUint324;
  92036. const version = view.getUint32(byteOffset, true);
  92037. if (version !== 1) {
  92038. throw new RuntimeError_default(
  92039. `Only Composite Tile version 1 is supported. Version ${version} is not.`
  92040. );
  92041. }
  92042. byteOffset += sizeOfUint324;
  92043. byteOffset += sizeOfUint324;
  92044. const tilesLength = view.getUint32(byteOffset, true);
  92045. byteOffset += sizeOfUint324;
  92046. const contentPromises = [];
  92047. for (let i2 = 0; i2 < tilesLength; ++i2) {
  92048. const tileType = getMagic_default(uint8Array, byteOffset);
  92049. const tileByteLength = view.getUint32(byteOffset + sizeOfUint324 * 2, true);
  92050. const contentFactory = factory[tileType];
  92051. if (defined_default(contentFactory)) {
  92052. const innerContent = contentFactory(
  92053. content._tileset,
  92054. content._tile,
  92055. content._resource,
  92056. arrayBuffer,
  92057. byteOffset
  92058. );
  92059. content._contents.push(innerContent);
  92060. contentPromises.push(innerContent.readyPromise);
  92061. } else {
  92062. throw new RuntimeError_default(
  92063. `Unknown tile content type, ${tileType}, inside Composite tile`
  92064. );
  92065. }
  92066. byteOffset += tileByteLength;
  92067. }
  92068. Promise.all(contentPromises).then(function() {
  92069. content._readyPromise.resolve(content);
  92070. }).catch(function(error) {
  92071. content._readyPromise.reject(error);
  92072. });
  92073. }
  92074. Composite3DTileContent.prototype.hasProperty = function(batchId, name) {
  92075. return false;
  92076. };
  92077. Composite3DTileContent.prototype.getFeature = function(batchId) {
  92078. return void 0;
  92079. };
  92080. Composite3DTileContent.prototype.applyDebugSettings = function(enabled, color) {
  92081. const contents = this._contents;
  92082. const length3 = contents.length;
  92083. for (let i2 = 0; i2 < length3; ++i2) {
  92084. contents[i2].applyDebugSettings(enabled, color);
  92085. }
  92086. };
  92087. Composite3DTileContent.prototype.applyStyle = function(style) {
  92088. const contents = this._contents;
  92089. const length3 = contents.length;
  92090. for (let i2 = 0; i2 < length3; ++i2) {
  92091. contents[i2].applyStyle(style);
  92092. }
  92093. };
  92094. Composite3DTileContent.prototype.update = function(tileset, frameState) {
  92095. const contents = this._contents;
  92096. const length3 = contents.length;
  92097. for (let i2 = 0; i2 < length3; ++i2) {
  92098. contents[i2].update(tileset, frameState);
  92099. }
  92100. };
  92101. Composite3DTileContent.prototype.isDestroyed = function() {
  92102. return false;
  92103. };
  92104. Composite3DTileContent.prototype.destroy = function() {
  92105. const contents = this._contents;
  92106. const length3 = contents.length;
  92107. for (let i2 = 0; i2 < length3; ++i2) {
  92108. contents[i2].destroy();
  92109. }
  92110. return destroyObject_default(this);
  92111. };
  92112. var Composite3DTileContent_default = Composite3DTileContent;
  92113. // node_modules/cesium/Source/Scene/Vector3DTileGeometry.js
  92114. function Vector3DTileGeometry(options) {
  92115. this._boxes = options.boxes;
  92116. this._boxBatchIds = options.boxBatchIds;
  92117. this._cylinders = options.cylinders;
  92118. this._cylinderBatchIds = options.cylinderBatchIds;
  92119. this._ellipsoids = options.ellipsoids;
  92120. this._ellipsoidBatchIds = options.ellipsoidBatchIds;
  92121. this._spheres = options.spheres;
  92122. this._sphereBatchIds = options.sphereBatchIds;
  92123. this._modelMatrix = options.modelMatrix;
  92124. this._batchTable = options.batchTable;
  92125. this._boundingVolume = options.boundingVolume;
  92126. this._center = options.center;
  92127. if (!defined_default(this._center)) {
  92128. if (defined_default(this._boundingVolume)) {
  92129. this._center = Cartesian3_default.clone(this._boundingVolume.center);
  92130. } else {
  92131. this._center = Cartesian3_default.clone(Cartesian3_default.ZERO);
  92132. }
  92133. }
  92134. this._boundingVolumes = void 0;
  92135. this._batchedIndices = void 0;
  92136. this._indices = void 0;
  92137. this._indexOffsets = void 0;
  92138. this._indexCounts = void 0;
  92139. this._positions = void 0;
  92140. this._vertexBatchIds = void 0;
  92141. this._batchIds = void 0;
  92142. this._batchTableColors = void 0;
  92143. this._packedBuffer = void 0;
  92144. this._ready = false;
  92145. this._readyPromise = defer_default();
  92146. this._verticesPromise = void 0;
  92147. this._primitive = void 0;
  92148. this.debugWireframe = false;
  92149. this.forceRebatch = false;
  92150. this.classificationType = ClassificationType_default.BOTH;
  92151. }
  92152. Object.defineProperties(Vector3DTileGeometry.prototype, {
  92153. trianglesLength: {
  92154. get: function() {
  92155. if (defined_default(this._primitive)) {
  92156. return this._primitive.trianglesLength;
  92157. }
  92158. return 0;
  92159. }
  92160. },
  92161. geometryByteLength: {
  92162. get: function() {
  92163. if (defined_default(this._primitive)) {
  92164. return this._primitive.geometryByteLength;
  92165. }
  92166. return 0;
  92167. }
  92168. },
  92169. readyPromise: {
  92170. get: function() {
  92171. return this._readyPromise.promise;
  92172. }
  92173. }
  92174. });
  92175. Vector3DTileGeometry.packedBoxLength = Matrix4_default.packedLength + Cartesian3_default.packedLength;
  92176. Vector3DTileGeometry.packedCylinderLength = Matrix4_default.packedLength + 2;
  92177. Vector3DTileGeometry.packedEllipsoidLength = Matrix4_default.packedLength + Cartesian3_default.packedLength;
  92178. Vector3DTileGeometry.packedSphereLength = Cartesian3_default.packedLength + 1;
  92179. function packBuffer(geometries) {
  92180. const packedBuffer = new Float64Array(
  92181. Matrix4_default.packedLength + Cartesian3_default.packedLength
  92182. );
  92183. let offset2 = 0;
  92184. Cartesian3_default.pack(geometries._center, packedBuffer, offset2);
  92185. offset2 += Cartesian3_default.packedLength;
  92186. Matrix4_default.pack(geometries._modelMatrix, packedBuffer, offset2);
  92187. return packedBuffer;
  92188. }
  92189. function unpackBuffer(geometries, packedBuffer) {
  92190. let offset2 = 0;
  92191. const indicesBytesPerElement = packedBuffer[offset2++];
  92192. const numBVS = packedBuffer[offset2++];
  92193. const bvs = geometries._boundingVolumes = new Array(numBVS);
  92194. for (let i2 = 0; i2 < numBVS; ++i2) {
  92195. bvs[i2] = BoundingSphere_default.unpack(packedBuffer, offset2);
  92196. offset2 += BoundingSphere_default.packedLength;
  92197. }
  92198. const numBatchedIndices = packedBuffer[offset2++];
  92199. const bis = geometries._batchedIndices = new Array(numBatchedIndices);
  92200. for (let j = 0; j < numBatchedIndices; ++j) {
  92201. const color = Color_default.unpack(packedBuffer, offset2);
  92202. offset2 += Color_default.packedLength;
  92203. const indexOffset = packedBuffer[offset2++];
  92204. const count = packedBuffer[offset2++];
  92205. const length3 = packedBuffer[offset2++];
  92206. const batchIds = new Array(length3);
  92207. for (let k = 0; k < length3; ++k) {
  92208. batchIds[k] = packedBuffer[offset2++];
  92209. }
  92210. bis[j] = new Vector3DTileBatch_default({
  92211. color,
  92212. offset: indexOffset,
  92213. count,
  92214. batchIds
  92215. });
  92216. }
  92217. return indicesBytesPerElement;
  92218. }
  92219. var createVerticesTaskProcessor = new TaskProcessor_default(
  92220. "createVectorTileGeometries",
  92221. 5
  92222. );
  92223. var scratchColor5 = new Color_default();
  92224. function createPrimitive2(geometries) {
  92225. if (defined_default(geometries._primitive)) {
  92226. return;
  92227. }
  92228. if (!defined_default(geometries._verticesPromise)) {
  92229. let boxes = geometries._boxes;
  92230. let boxBatchIds = geometries._boxBatchIds;
  92231. let cylinders = geometries._cylinders;
  92232. let cylinderBatchIds = geometries._cylinderBatchIds;
  92233. let ellipsoids = geometries._ellipsoids;
  92234. let ellipsoidBatchIds = geometries._ellipsoidBatchIds;
  92235. let spheres = geometries._spheres;
  92236. let sphereBatchIds = geometries._sphereBatchIds;
  92237. let batchTableColors = geometries._batchTableColors;
  92238. let packedBuffer = geometries._packedBuffer;
  92239. if (!defined_default(batchTableColors)) {
  92240. let length3 = 0;
  92241. if (defined_default(geometries._boxes)) {
  92242. boxes = geometries._boxes = arraySlice_default(boxes);
  92243. boxBatchIds = geometries._boxBatchIds = arraySlice_default(boxBatchIds);
  92244. length3 += boxBatchIds.length;
  92245. }
  92246. if (defined_default(geometries._cylinders)) {
  92247. cylinders = geometries._cylinders = arraySlice_default(cylinders);
  92248. cylinderBatchIds = geometries._cylinderBatchIds = arraySlice_default(
  92249. cylinderBatchIds
  92250. );
  92251. length3 += cylinderBatchIds.length;
  92252. }
  92253. if (defined_default(geometries._ellipsoids)) {
  92254. ellipsoids = geometries._ellipsoids = arraySlice_default(ellipsoids);
  92255. ellipsoidBatchIds = geometries._ellipsoidBatchIds = arraySlice_default(
  92256. ellipsoidBatchIds
  92257. );
  92258. length3 += ellipsoidBatchIds.length;
  92259. }
  92260. if (defined_default(geometries._spheres)) {
  92261. spheres = geometries._sphere = arraySlice_default(spheres);
  92262. sphereBatchIds = geometries._sphereBatchIds = arraySlice_default(
  92263. sphereBatchIds
  92264. );
  92265. length3 += sphereBatchIds.length;
  92266. }
  92267. batchTableColors = geometries._batchTableColors = new Uint32Array(length3);
  92268. const batchTable = geometries._batchTable;
  92269. for (let i2 = 0; i2 < length3; ++i2) {
  92270. const color = batchTable.getColor(i2, scratchColor5);
  92271. batchTableColors[i2] = color.toRgba();
  92272. }
  92273. packedBuffer = geometries._packedBuffer = packBuffer(geometries);
  92274. }
  92275. const transferrableObjects = [];
  92276. if (defined_default(boxes)) {
  92277. transferrableObjects.push(boxes.buffer, boxBatchIds.buffer);
  92278. }
  92279. if (defined_default(cylinders)) {
  92280. transferrableObjects.push(cylinders.buffer, cylinderBatchIds.buffer);
  92281. }
  92282. if (defined_default(ellipsoids)) {
  92283. transferrableObjects.push(ellipsoids.buffer, ellipsoidBatchIds.buffer);
  92284. }
  92285. if (defined_default(spheres)) {
  92286. transferrableObjects.push(spheres.buffer, sphereBatchIds.buffer);
  92287. }
  92288. transferrableObjects.push(batchTableColors.buffer, packedBuffer.buffer);
  92289. const parameters = {
  92290. boxes: defined_default(boxes) ? boxes.buffer : void 0,
  92291. boxBatchIds: defined_default(boxes) ? boxBatchIds.buffer : void 0,
  92292. cylinders: defined_default(cylinders) ? cylinders.buffer : void 0,
  92293. cylinderBatchIds: defined_default(cylinders) ? cylinderBatchIds.buffer : void 0,
  92294. ellipsoids: defined_default(ellipsoids) ? ellipsoids.buffer : void 0,
  92295. ellipsoidBatchIds: defined_default(ellipsoids) ? ellipsoidBatchIds.buffer : void 0,
  92296. spheres: defined_default(spheres) ? spheres.buffer : void 0,
  92297. sphereBatchIds: defined_default(spheres) ? sphereBatchIds.buffer : void 0,
  92298. batchTableColors: batchTableColors.buffer,
  92299. packedBuffer: packedBuffer.buffer
  92300. };
  92301. const verticesPromise = geometries._verticesPromise = createVerticesTaskProcessor.scheduleTask(
  92302. parameters,
  92303. transferrableObjects
  92304. );
  92305. if (!defined_default(verticesPromise)) {
  92306. return;
  92307. }
  92308. verticesPromise.then(function(result) {
  92309. const packedBuffer2 = new Float64Array(result.packedBuffer);
  92310. const indicesBytesPerElement = unpackBuffer(geometries, packedBuffer2);
  92311. if (indicesBytesPerElement === 2) {
  92312. geometries._indices = new Uint16Array(result.indices);
  92313. } else {
  92314. geometries._indices = new Uint32Array(result.indices);
  92315. }
  92316. geometries._indexOffsets = new Uint32Array(result.indexOffsets);
  92317. geometries._indexCounts = new Uint32Array(result.indexCounts);
  92318. geometries._positions = new Float32Array(result.positions);
  92319. geometries._vertexBatchIds = new Uint16Array(result.vertexBatchIds);
  92320. geometries._batchIds = new Uint16Array(result.batchIds);
  92321. geometries._ready = true;
  92322. });
  92323. }
  92324. if (geometries._ready && !defined_default(geometries._primitive)) {
  92325. geometries._primitive = new Vector3DTilePrimitive_default({
  92326. batchTable: geometries._batchTable,
  92327. positions: geometries._positions,
  92328. batchIds: geometries._batchIds,
  92329. vertexBatchIds: geometries._vertexBatchIds,
  92330. indices: geometries._indices,
  92331. indexOffsets: geometries._indexOffsets,
  92332. indexCounts: geometries._indexCounts,
  92333. batchedIndices: geometries._batchedIndices,
  92334. boundingVolume: geometries._boundingVolume,
  92335. boundingVolumes: geometries._boundingVolumes,
  92336. center: geometries._center,
  92337. pickObject: defaultValue_default(geometries._pickObject, geometries)
  92338. });
  92339. geometries._boxes = void 0;
  92340. geometries._boxBatchIds = void 0;
  92341. geometries._cylinders = void 0;
  92342. geometries._cylinderBatchIds = void 0;
  92343. geometries._ellipsoids = void 0;
  92344. geometries._ellipsoidBatchIds = void 0;
  92345. geometries._spheres = void 0;
  92346. geometries._sphereBatchIds = void 0;
  92347. geometries._center = void 0;
  92348. geometries._modelMatrix = void 0;
  92349. geometries._batchTable = void 0;
  92350. geometries._boundingVolume = void 0;
  92351. geometries._boundingVolumes = void 0;
  92352. geometries._batchedIndices = void 0;
  92353. geometries._indices = void 0;
  92354. geometries._indexOffsets = void 0;
  92355. geometries._indexCounts = void 0;
  92356. geometries._positions = void 0;
  92357. geometries._vertexBatchIds = void 0;
  92358. geometries._batchIds = void 0;
  92359. geometries._batchTableColors = void 0;
  92360. geometries._packedBuffer = void 0;
  92361. geometries._verticesPromise = void 0;
  92362. geometries._readyPromise.resolve();
  92363. }
  92364. }
  92365. Vector3DTileGeometry.prototype.createFeatures = function(content, features) {
  92366. this._primitive.createFeatures(content, features);
  92367. };
  92368. Vector3DTileGeometry.prototype.applyDebugSettings = function(enabled, color) {
  92369. this._primitive.applyDebugSettings(enabled, color);
  92370. };
  92371. Vector3DTileGeometry.prototype.applyStyle = function(style, features) {
  92372. this._primitive.applyStyle(style, features);
  92373. };
  92374. Vector3DTileGeometry.prototype.updateCommands = function(batchId, color) {
  92375. this._primitive.updateCommands(batchId, color);
  92376. };
  92377. Vector3DTileGeometry.prototype.update = function(frameState) {
  92378. createPrimitive2(this);
  92379. if (!this._ready) {
  92380. return;
  92381. }
  92382. this._primitive.debugWireframe = this.debugWireframe;
  92383. this._primitive.forceRebatch = this.forceRebatch;
  92384. this._primitive.classificationType = this.classificationType;
  92385. this._primitive.update(frameState);
  92386. };
  92387. Vector3DTileGeometry.prototype.isDestroyed = function() {
  92388. return false;
  92389. };
  92390. Vector3DTileGeometry.prototype.destroy = function() {
  92391. this._primitive = this._primitive && this._primitive.destroy();
  92392. return destroyObject_default(this);
  92393. };
  92394. var Vector3DTileGeometry_default = Vector3DTileGeometry;
  92395. // node_modules/cesium/Source/Scene/Geometry3DTileContent.js
  92396. function Geometry3DTileContent(tileset, tile, resource, arrayBuffer, byteOffset) {
  92397. this._tileset = tileset;
  92398. this._tile = tile;
  92399. this._resource = resource;
  92400. this._geometries = void 0;
  92401. this._contentReadyPromise = void 0;
  92402. this._readyPromise = defer_default();
  92403. this._metadata = void 0;
  92404. this._batchTable = void 0;
  92405. this._features = void 0;
  92406. this.featurePropertiesDirty = false;
  92407. this._group = void 0;
  92408. initialize6(this, arrayBuffer, byteOffset);
  92409. }
  92410. Object.defineProperties(Geometry3DTileContent.prototype, {
  92411. featuresLength: {
  92412. get: function() {
  92413. return defined_default(this._batchTable) ? this._batchTable.featuresLength : 0;
  92414. }
  92415. },
  92416. pointsLength: {
  92417. get: function() {
  92418. return 0;
  92419. }
  92420. },
  92421. trianglesLength: {
  92422. get: function() {
  92423. if (defined_default(this._geometries)) {
  92424. return this._geometries.trianglesLength;
  92425. }
  92426. return 0;
  92427. }
  92428. },
  92429. geometryByteLength: {
  92430. get: function() {
  92431. if (defined_default(this._geometries)) {
  92432. return this._geometries.geometryByteLength;
  92433. }
  92434. return 0;
  92435. }
  92436. },
  92437. texturesByteLength: {
  92438. get: function() {
  92439. return 0;
  92440. }
  92441. },
  92442. batchTableByteLength: {
  92443. get: function() {
  92444. return defined_default(this._batchTable) ? this._batchTable.memorySizeInBytes : 0;
  92445. }
  92446. },
  92447. innerContents: {
  92448. get: function() {
  92449. return void 0;
  92450. }
  92451. },
  92452. readyPromise: {
  92453. get: function() {
  92454. return this._readyPromise.promise;
  92455. }
  92456. },
  92457. tileset: {
  92458. get: function() {
  92459. return this._tileset;
  92460. }
  92461. },
  92462. tile: {
  92463. get: function() {
  92464. return this._tile;
  92465. }
  92466. },
  92467. url: {
  92468. get: function() {
  92469. return this._resource.getUrlComponent(true);
  92470. }
  92471. },
  92472. metadata: {
  92473. get: function() {
  92474. return this._metadata;
  92475. },
  92476. set: function(value) {
  92477. this._metadata = value;
  92478. }
  92479. },
  92480. batchTable: {
  92481. get: function() {
  92482. return this._batchTable;
  92483. }
  92484. },
  92485. group: {
  92486. get: function() {
  92487. return this._group;
  92488. },
  92489. set: function(value) {
  92490. this._group = value;
  92491. }
  92492. }
  92493. });
  92494. function createColorChangedCallback2(content) {
  92495. return function(batchId, color) {
  92496. if (defined_default(content._geometries)) {
  92497. content._geometries.updateCommands(batchId, color);
  92498. }
  92499. };
  92500. }
  92501. function getBatchIds(featureTableJson, featureTableBinary) {
  92502. let boxBatchIds;
  92503. let cylinderBatchIds;
  92504. let ellipsoidBatchIds;
  92505. let sphereBatchIds;
  92506. let i2;
  92507. const numberOfBoxes = defaultValue_default(featureTableJson.BOXES_LENGTH, 0);
  92508. const numberOfCylinders = defaultValue_default(featureTableJson.CYLINDERS_LENGTH, 0);
  92509. const numberOfEllipsoids = defaultValue_default(
  92510. featureTableJson.ELLIPSOIDS_LENGTH,
  92511. 0
  92512. );
  92513. const numberOfSpheres = defaultValue_default(featureTableJson.SPHERES_LENGTH, 0);
  92514. if (numberOfBoxes > 0 && defined_default(featureTableJson.BOX_BATCH_IDS)) {
  92515. const boxBatchIdsByteOffset = featureTableBinary.byteOffset + featureTableJson.BOX_BATCH_IDS.byteOffset;
  92516. boxBatchIds = new Uint16Array(
  92517. featureTableBinary.buffer,
  92518. boxBatchIdsByteOffset,
  92519. numberOfBoxes
  92520. );
  92521. }
  92522. if (numberOfCylinders > 0 && defined_default(featureTableJson.CYLINDER_BATCH_IDS)) {
  92523. const cylinderBatchIdsByteOffset = featureTableBinary.byteOffset + featureTableJson.CYLINDER_BATCH_IDS.byteOffset;
  92524. cylinderBatchIds = new Uint16Array(
  92525. featureTableBinary.buffer,
  92526. cylinderBatchIdsByteOffset,
  92527. numberOfCylinders
  92528. );
  92529. }
  92530. if (numberOfEllipsoids > 0 && defined_default(featureTableJson.ELLIPSOID_BATCH_IDS)) {
  92531. const ellipsoidBatchIdsByteOffset = featureTableBinary.byteOffset + featureTableJson.ELLIPSOID_BATCH_IDS.byteOffset;
  92532. ellipsoidBatchIds = new Uint16Array(
  92533. featureTableBinary.buffer,
  92534. ellipsoidBatchIdsByteOffset,
  92535. numberOfEllipsoids
  92536. );
  92537. }
  92538. if (numberOfSpheres > 0 && defined_default(featureTableJson.SPHERE_BATCH_IDS)) {
  92539. const sphereBatchIdsByteOffset = featureTableBinary.byteOffset + featureTableJson.SPHERE_BATCH_IDS.byteOffset;
  92540. sphereBatchIds = new Uint16Array(
  92541. featureTableBinary.buffer,
  92542. sphereBatchIdsByteOffset,
  92543. numberOfSpheres
  92544. );
  92545. }
  92546. const atLeastOneDefined = defined_default(boxBatchIds) || defined_default(cylinderBatchIds) || defined_default(ellipsoidBatchIds) || defined_default(sphereBatchIds);
  92547. const atLeastOneUndefined = numberOfBoxes > 0 && !defined_default(boxBatchIds) || numberOfCylinders > 0 && !defined_default(cylinderBatchIds) || numberOfEllipsoids > 0 && !defined_default(ellipsoidBatchIds) || numberOfSpheres > 0 && !defined_default(sphereBatchIds);
  92548. if (atLeastOneDefined && atLeastOneUndefined) {
  92549. throw new RuntimeError_default(
  92550. "If one group of batch ids is defined, then all batch ids must be defined."
  92551. );
  92552. }
  92553. const allUndefinedBatchIds = !defined_default(boxBatchIds) && !defined_default(cylinderBatchIds) && !defined_default(ellipsoidBatchIds) && !defined_default(sphereBatchIds);
  92554. if (allUndefinedBatchIds) {
  92555. let id = 0;
  92556. if (!defined_default(boxBatchIds) && numberOfBoxes > 0) {
  92557. boxBatchIds = new Uint16Array(numberOfBoxes);
  92558. for (i2 = 0; i2 < numberOfBoxes; ++i2) {
  92559. boxBatchIds[i2] = id++;
  92560. }
  92561. }
  92562. if (!defined_default(cylinderBatchIds) && numberOfCylinders > 0) {
  92563. cylinderBatchIds = new Uint16Array(numberOfCylinders);
  92564. for (i2 = 0; i2 < numberOfCylinders; ++i2) {
  92565. cylinderBatchIds[i2] = id++;
  92566. }
  92567. }
  92568. if (!defined_default(ellipsoidBatchIds) && numberOfEllipsoids > 0) {
  92569. ellipsoidBatchIds = new Uint16Array(numberOfEllipsoids);
  92570. for (i2 = 0; i2 < numberOfEllipsoids; ++i2) {
  92571. ellipsoidBatchIds[i2] = id++;
  92572. }
  92573. }
  92574. if (!defined_default(sphereBatchIds) && numberOfSpheres > 0) {
  92575. sphereBatchIds = new Uint16Array(numberOfSpheres);
  92576. for (i2 = 0; i2 < numberOfSpheres; ++i2) {
  92577. sphereBatchIds[i2] = id++;
  92578. }
  92579. }
  92580. }
  92581. return {
  92582. boxes: boxBatchIds,
  92583. cylinders: cylinderBatchIds,
  92584. ellipsoids: ellipsoidBatchIds,
  92585. spheres: sphereBatchIds
  92586. };
  92587. }
  92588. var sizeOfUint325 = Uint32Array.BYTES_PER_ELEMENT;
  92589. function initialize6(content, arrayBuffer, byteOffset) {
  92590. byteOffset = defaultValue_default(byteOffset, 0);
  92591. const uint8Array = new Uint8Array(arrayBuffer);
  92592. const view = new DataView(arrayBuffer);
  92593. byteOffset += sizeOfUint325;
  92594. const version = view.getUint32(byteOffset, true);
  92595. if (version !== 1) {
  92596. throw new RuntimeError_default(
  92597. `Only Geometry tile version 1 is supported. Version ${version} is not.`
  92598. );
  92599. }
  92600. byteOffset += sizeOfUint325;
  92601. const byteLength = view.getUint32(byteOffset, true);
  92602. byteOffset += sizeOfUint325;
  92603. if (byteLength === 0) {
  92604. content._readyPromise.resolve(content);
  92605. return;
  92606. }
  92607. const featureTableJSONByteLength = view.getUint32(byteOffset, true);
  92608. byteOffset += sizeOfUint325;
  92609. if (featureTableJSONByteLength === 0) {
  92610. throw new RuntimeError_default(
  92611. "Feature table must have a byte length greater than zero"
  92612. );
  92613. }
  92614. const featureTableBinaryByteLength = view.getUint32(byteOffset, true);
  92615. byteOffset += sizeOfUint325;
  92616. const batchTableJSONByteLength = view.getUint32(byteOffset, true);
  92617. byteOffset += sizeOfUint325;
  92618. const batchTableBinaryByteLength = view.getUint32(byteOffset, true);
  92619. byteOffset += sizeOfUint325;
  92620. const featureTableJson = getJsonFromTypedArray_default(
  92621. uint8Array,
  92622. byteOffset,
  92623. featureTableJSONByteLength
  92624. );
  92625. byteOffset += featureTableJSONByteLength;
  92626. const featureTableBinary = new Uint8Array(
  92627. arrayBuffer,
  92628. byteOffset,
  92629. featureTableBinaryByteLength
  92630. );
  92631. byteOffset += featureTableBinaryByteLength;
  92632. let batchTableJson;
  92633. let batchTableBinary;
  92634. if (batchTableJSONByteLength > 0) {
  92635. batchTableJson = getJsonFromTypedArray_default(
  92636. uint8Array,
  92637. byteOffset,
  92638. batchTableJSONByteLength
  92639. );
  92640. byteOffset += batchTableJSONByteLength;
  92641. if (batchTableBinaryByteLength > 0) {
  92642. batchTableBinary = new Uint8Array(
  92643. arrayBuffer,
  92644. byteOffset,
  92645. batchTableBinaryByteLength
  92646. );
  92647. batchTableBinary = new Uint8Array(batchTableBinary);
  92648. }
  92649. }
  92650. const numberOfBoxes = defaultValue_default(featureTableJson.BOXES_LENGTH, 0);
  92651. const numberOfCylinders = defaultValue_default(featureTableJson.CYLINDERS_LENGTH, 0);
  92652. const numberOfEllipsoids = defaultValue_default(
  92653. featureTableJson.ELLIPSOIDS_LENGTH,
  92654. 0
  92655. );
  92656. const numberOfSpheres = defaultValue_default(featureTableJson.SPHERES_LENGTH, 0);
  92657. const totalPrimitives = numberOfBoxes + numberOfCylinders + numberOfEllipsoids + numberOfSpheres;
  92658. const batchTable = new Cesium3DTileBatchTable_default(
  92659. content,
  92660. totalPrimitives,
  92661. batchTableJson,
  92662. batchTableBinary,
  92663. createColorChangedCallback2(content)
  92664. );
  92665. content._batchTable = batchTable;
  92666. if (totalPrimitives === 0) {
  92667. return;
  92668. }
  92669. const modelMatrix = content.tile.computedTransform;
  92670. let center;
  92671. if (defined_default(featureTableJson.RTC_CENTER)) {
  92672. center = Cartesian3_default.unpack(featureTableJson.RTC_CENTER);
  92673. Matrix4_default.multiplyByPoint(modelMatrix, center, center);
  92674. }
  92675. const batchIds = getBatchIds(featureTableJson, featureTableBinary);
  92676. if (numberOfBoxes > 0 || numberOfCylinders > 0 || numberOfEllipsoids > 0 || numberOfSpheres > 0) {
  92677. let boxes;
  92678. let cylinders;
  92679. let ellipsoids;
  92680. let spheres;
  92681. if (numberOfBoxes > 0) {
  92682. const boxesByteOffset = featureTableBinary.byteOffset + featureTableJson.BOXES.byteOffset;
  92683. boxes = new Float32Array(
  92684. featureTableBinary.buffer,
  92685. boxesByteOffset,
  92686. Vector3DTileGeometry_default.packedBoxLength * numberOfBoxes
  92687. );
  92688. }
  92689. if (numberOfCylinders > 0) {
  92690. const cylindersByteOffset = featureTableBinary.byteOffset + featureTableJson.CYLINDERS.byteOffset;
  92691. cylinders = new Float32Array(
  92692. featureTableBinary.buffer,
  92693. cylindersByteOffset,
  92694. Vector3DTileGeometry_default.packedCylinderLength * numberOfCylinders
  92695. );
  92696. }
  92697. if (numberOfEllipsoids > 0) {
  92698. const ellipsoidsByteOffset = featureTableBinary.byteOffset + featureTableJson.ELLIPSOIDS.byteOffset;
  92699. ellipsoids = new Float32Array(
  92700. featureTableBinary.buffer,
  92701. ellipsoidsByteOffset,
  92702. Vector3DTileGeometry_default.packedEllipsoidLength * numberOfEllipsoids
  92703. );
  92704. }
  92705. if (numberOfSpheres > 0) {
  92706. const spheresByteOffset = featureTableBinary.byteOffset + featureTableJson.SPHERES.byteOffset;
  92707. spheres = new Float32Array(
  92708. featureTableBinary.buffer,
  92709. spheresByteOffset,
  92710. Vector3DTileGeometry_default.packedSphereLength * numberOfSpheres
  92711. );
  92712. }
  92713. content._geometries = new Vector3DTileGeometry_default({
  92714. boxes,
  92715. boxBatchIds: batchIds.boxes,
  92716. cylinders,
  92717. cylinderBatchIds: batchIds.cylinders,
  92718. ellipsoids,
  92719. ellipsoidBatchIds: batchIds.ellipsoids,
  92720. spheres,
  92721. sphereBatchIds: batchIds.spheres,
  92722. center,
  92723. modelMatrix,
  92724. batchTable,
  92725. boundingVolume: content.tile.boundingVolume.boundingVolume
  92726. });
  92727. }
  92728. }
  92729. function createFeatures2(content) {
  92730. const featuresLength = content.featuresLength;
  92731. if (!defined_default(content._features) && featuresLength > 0) {
  92732. const features = new Array(featuresLength);
  92733. if (defined_default(content._geometries)) {
  92734. content._geometries.createFeatures(content, features);
  92735. }
  92736. content._features = features;
  92737. }
  92738. }
  92739. Geometry3DTileContent.prototype.hasProperty = function(batchId, name) {
  92740. return this._batchTable.hasProperty(batchId, name);
  92741. };
  92742. Geometry3DTileContent.prototype.getFeature = function(batchId) {
  92743. const featuresLength = this.featuresLength;
  92744. if (!defined_default(batchId) || batchId < 0 || batchId >= featuresLength) {
  92745. throw new DeveloperError_default(
  92746. `batchId is required and between zero and featuresLength - 1 (${featuresLength - 1}).`
  92747. );
  92748. }
  92749. createFeatures2(this);
  92750. return this._features[batchId];
  92751. };
  92752. Geometry3DTileContent.prototype.applyDebugSettings = function(enabled, color) {
  92753. if (defined_default(this._geometries)) {
  92754. this._geometries.applyDebugSettings(enabled, color);
  92755. }
  92756. };
  92757. Geometry3DTileContent.prototype.applyStyle = function(style) {
  92758. createFeatures2(this);
  92759. if (defined_default(this._geometries)) {
  92760. this._geometries.applyStyle(style, this._features);
  92761. }
  92762. };
  92763. Geometry3DTileContent.prototype.update = function(tileset, frameState) {
  92764. if (defined_default(this._geometries)) {
  92765. this._geometries.classificationType = this._tileset.classificationType;
  92766. this._geometries.debugWireframe = this._tileset.debugWireframe;
  92767. this._geometries.update(frameState);
  92768. }
  92769. if (defined_default(this._batchTable) && this._geometries._ready) {
  92770. this._batchTable.update(tileset, frameState);
  92771. }
  92772. if (!defined_default(this._contentReadyPromise)) {
  92773. const that = this;
  92774. this._contentReadyPromise = this._geometries.readyPromise.then(function() {
  92775. that._readyPromise.resolve(that);
  92776. });
  92777. }
  92778. };
  92779. Geometry3DTileContent.prototype.isDestroyed = function() {
  92780. return false;
  92781. };
  92782. Geometry3DTileContent.prototype.destroy = function() {
  92783. this._geometries = this._geometries && this._geometries.destroy();
  92784. this._batchTable = this._batchTable && this._batchTable.destroy();
  92785. return destroyObject_default(this);
  92786. };
  92787. var Geometry3DTileContent_default = Geometry3DTileContent;
  92788. // node_modules/cesium/Source/Scene/hasExtension.js
  92789. function hasExtension(json, extensionName) {
  92790. return defined_default(json) && defined_default(json.extensions) && defined_default(json.extensions[extensionName]);
  92791. }
  92792. // node_modules/cesium/Source/Scene/ImplicitAvailabilityBitstream.js
  92793. function ImplicitAvailabilityBitstream(options) {
  92794. const lengthBits = options.lengthBits;
  92795. let availableCount = options.availableCount;
  92796. Check_default.typeOf.number("options.lengthBits", lengthBits);
  92797. const constant = options.constant;
  92798. const bitstream = options.bitstream;
  92799. if (defined_default(constant)) {
  92800. availableCount = lengthBits;
  92801. } else {
  92802. const expectedLength = Math.ceil(lengthBits / 8);
  92803. if (bitstream.length !== expectedLength) {
  92804. throw new RuntimeError_default(
  92805. `Availability bitstream must be exactly ${expectedLength} bytes long to store ${lengthBits} bits. Actual bitstream was ${bitstream.length} bytes long.`
  92806. );
  92807. }
  92808. const computeAvailableCountEnabled = defaultValue_default(
  92809. options.computeAvailableCountEnabled,
  92810. false
  92811. );
  92812. if (!defined_default(availableCount) && computeAvailableCountEnabled) {
  92813. availableCount = count1Bits(bitstream, lengthBits);
  92814. }
  92815. }
  92816. this._lengthBits = lengthBits;
  92817. this._availableCount = availableCount;
  92818. this._constant = constant;
  92819. this._bitstream = bitstream;
  92820. }
  92821. function count1Bits(bitstream, lengthBits) {
  92822. let count = 0;
  92823. for (let i2 = 0; i2 < lengthBits; i2++) {
  92824. const byteIndex = i2 >> 3;
  92825. const bitIndex = i2 % 8;
  92826. count += bitstream[byteIndex] >> bitIndex & 1;
  92827. }
  92828. return count;
  92829. }
  92830. Object.defineProperties(ImplicitAvailabilityBitstream.prototype, {
  92831. lengthBits: {
  92832. get: function() {
  92833. return this._lengthBits;
  92834. }
  92835. },
  92836. availableCount: {
  92837. get: function() {
  92838. return this._availableCount;
  92839. }
  92840. }
  92841. });
  92842. ImplicitAvailabilityBitstream.prototype.getBit = function(index2) {
  92843. if (index2 < 0 || index2 >= this._lengthBits) {
  92844. throw new DeveloperError_default("Bit index out of bounds.");
  92845. }
  92846. if (defined_default(this._constant)) {
  92847. return this._constant;
  92848. }
  92849. const byteIndex = index2 >> 3;
  92850. const bitIndex = index2 % 8;
  92851. return (this._bitstream[byteIndex] >> bitIndex & 1) === 1;
  92852. };
  92853. // node_modules/cesium/Source/Scene/ImplicitMetadataView.js
  92854. function ImplicitMetadataView(options) {
  92855. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  92856. const metadataTable = options.metadataTable;
  92857. const metadataClass = options.class;
  92858. const entityId = options.entityId;
  92859. const propertyTableJson = options.propertyTableJson;
  92860. Check_default.typeOf.object("options.metadataTable", metadataTable);
  92861. Check_default.typeOf.object("options.class", metadataClass);
  92862. Check_default.typeOf.number("options.entityId", entityId);
  92863. Check_default.typeOf.object("options.propertyTableJson", propertyTableJson);
  92864. this._class = metadataClass;
  92865. this._metadataTable = metadataTable;
  92866. this._entityId = entityId;
  92867. this._extensions = propertyTableJson.extensions;
  92868. this._extras = propertyTableJson.extras;
  92869. }
  92870. Object.defineProperties(ImplicitMetadataView.prototype, {
  92871. class: {
  92872. get: function() {
  92873. return this._class;
  92874. }
  92875. },
  92876. extras: {
  92877. get: function() {
  92878. return this._extras;
  92879. }
  92880. },
  92881. extensions: {
  92882. get: function() {
  92883. return this._extensions;
  92884. }
  92885. }
  92886. });
  92887. ImplicitMetadataView.prototype.hasProperty = function(propertyId) {
  92888. return this._metadataTable.hasProperty(propertyId);
  92889. };
  92890. ImplicitMetadataView.prototype.hasPropertyBySemantic = function(semantic) {
  92891. return this._metadataTable.hasPropertyBySemantic(semantic);
  92892. };
  92893. ImplicitMetadataView.prototype.getPropertyIds = function(results) {
  92894. return this._metadataTable.getPropertyIds(results);
  92895. };
  92896. ImplicitMetadataView.prototype.getProperty = function(propertyId) {
  92897. return this._metadataTable.getProperty(this._entityId, propertyId);
  92898. };
  92899. ImplicitMetadataView.prototype.setProperty = function(propertyId, value) {
  92900. return this._metadataTable.setProperty(this._entityId, propertyId, value);
  92901. };
  92902. ImplicitMetadataView.prototype.getPropertyBySemantic = function(semantic) {
  92903. return this._metadataTable.getPropertyBySemantic(this._entityId, semantic);
  92904. };
  92905. ImplicitMetadataView.prototype.setPropertyBySemantic = function(semantic, value) {
  92906. return this._metadataTable.setPropertyBySemantic(
  92907. this._entityId,
  92908. semantic,
  92909. value
  92910. );
  92911. };
  92912. // node_modules/cesium/Source/Scene/ImplicitSubdivisionScheme.js
  92913. var ImplicitSubdivisionScheme = {
  92914. QUADTREE: "QUADTREE",
  92915. OCTREE: "OCTREE"
  92916. };
  92917. ImplicitSubdivisionScheme.getBranchingFactor = function(subdivisionScheme) {
  92918. switch (subdivisionScheme) {
  92919. case ImplicitSubdivisionScheme.OCTREE:
  92920. return 8;
  92921. case ImplicitSubdivisionScheme.QUADTREE:
  92922. return 4;
  92923. default:
  92924. throw new DeveloperError_default("subdivisionScheme is not a valid value.");
  92925. }
  92926. };
  92927. var ImplicitSubdivisionScheme_default = Object.freeze(ImplicitSubdivisionScheme);
  92928. // node_modules/cesium/Source/Scene/MetadataEntity.js
  92929. function MetadataEntity() {
  92930. }
  92931. Object.defineProperties(MetadataEntity.prototype, {
  92932. class: {
  92933. get: function() {
  92934. DeveloperError_default.throwInstantiationError();
  92935. }
  92936. }
  92937. });
  92938. MetadataEntity.prototype.hasProperty = function(propertyId) {
  92939. DeveloperError_default.throwInstantiationError();
  92940. };
  92941. MetadataEntity.prototype.hasPropertyBySemantic = function(semantic) {
  92942. DeveloperError_default.throwInstantiationError();
  92943. };
  92944. MetadataEntity.prototype.getPropertyIds = function(results) {
  92945. DeveloperError_default.throwInstantiationError();
  92946. };
  92947. MetadataEntity.prototype.getProperty = function(propertyId) {
  92948. DeveloperError_default.throwInstantiationError();
  92949. };
  92950. MetadataEntity.prototype.setProperty = function(propertyId, value) {
  92951. DeveloperError_default.throwInstantiationError();
  92952. };
  92953. MetadataEntity.prototype.getPropertyBySemantic = function(semantic) {
  92954. DeveloperError_default.throwInstantiationError();
  92955. };
  92956. MetadataEntity.prototype.setPropertyBySemantic = function(semantic, value) {
  92957. DeveloperError_default.throwInstantiationError();
  92958. };
  92959. MetadataEntity.hasProperty = function(propertyId, properties, classDefinition) {
  92960. Check_default.typeOf.string("propertyId", propertyId);
  92961. Check_default.typeOf.object("properties", properties);
  92962. Check_default.typeOf.object("classDefinition", classDefinition);
  92963. if (defined_default(properties[propertyId])) {
  92964. return true;
  92965. }
  92966. const classProperties = classDefinition.properties;
  92967. if (!defined_default(classProperties)) {
  92968. return false;
  92969. }
  92970. const classProperty = classProperties[propertyId];
  92971. if (defined_default(classProperty) && defined_default(classProperty.default)) {
  92972. return true;
  92973. }
  92974. return false;
  92975. };
  92976. MetadataEntity.hasPropertyBySemantic = function(semantic, properties, classDefinition) {
  92977. Check_default.typeOf.string("semantic", semantic);
  92978. Check_default.typeOf.object("properties", properties);
  92979. Check_default.typeOf.object("classDefinition", classDefinition);
  92980. const propertiesBySemantic = classDefinition.propertiesBySemantic;
  92981. if (!defined_default(propertiesBySemantic)) {
  92982. return false;
  92983. }
  92984. const property = propertiesBySemantic[semantic];
  92985. return defined_default(property);
  92986. };
  92987. MetadataEntity.getPropertyIds = function(properties, classDefinition, results) {
  92988. Check_default.typeOf.object("properties", properties);
  92989. Check_default.typeOf.object("classDefinition", classDefinition);
  92990. results = defined_default(results) ? results : [];
  92991. results.length = 0;
  92992. for (const propertyId in properties) {
  92993. if (properties.hasOwnProperty(propertyId) && defined_default(properties[propertyId])) {
  92994. results.push(propertyId);
  92995. }
  92996. }
  92997. const classProperties = classDefinition.properties;
  92998. if (defined_default(classProperties)) {
  92999. for (const classPropertyId in classProperties) {
  93000. if (classProperties.hasOwnProperty(classPropertyId) && !defined_default(properties[classPropertyId]) && defined_default(classProperties[classPropertyId].default)) {
  93001. results.push(classPropertyId);
  93002. }
  93003. }
  93004. }
  93005. return results;
  93006. };
  93007. MetadataEntity.getProperty = function(propertyId, properties, classDefinition) {
  93008. Check_default.typeOf.string("propertyId", propertyId);
  93009. Check_default.typeOf.object("properties", properties);
  93010. Check_default.typeOf.object("classDefinition", classDefinition);
  93011. if (!defined_default(classDefinition.properties[propertyId])) {
  93012. throw new DeveloperError_default(`Class definition missing property ${propertyId}`);
  93013. }
  93014. const classProperty = classDefinition.properties[propertyId];
  93015. let value = properties[propertyId];
  93016. if (Array.isArray(value)) {
  93017. value = value.slice();
  93018. }
  93019. const enableNestedArrays = true;
  93020. value = classProperty.handleNoData(value);
  93021. if (!defined_default(value) && defined_default(classProperty.default)) {
  93022. value = clone_default(classProperty.default, true);
  93023. return classProperty.unpackVectorAndMatrixTypes(value, enableNestedArrays);
  93024. }
  93025. if (!defined_default(value)) {
  93026. return void 0;
  93027. }
  93028. value = classProperty.normalize(value);
  93029. value = classProperty.applyValueTransform(value);
  93030. return classProperty.unpackVectorAndMatrixTypes(value, enableNestedArrays);
  93031. };
  93032. MetadataEntity.setProperty = function(propertyId, value, properties, classDefinition) {
  93033. Check_default.typeOf.string("propertyId", propertyId);
  93034. Check_default.defined("value", value);
  93035. Check_default.typeOf.object("properties", properties);
  93036. Check_default.typeOf.object("classDefinition", classDefinition);
  93037. if (!defined_default(properties[propertyId])) {
  93038. return false;
  93039. }
  93040. if (Array.isArray(value)) {
  93041. value = value.slice();
  93042. }
  93043. let classProperty;
  93044. const classProperties = classDefinition.properties;
  93045. if (defined_default(classProperties)) {
  93046. classProperty = classProperties[propertyId];
  93047. }
  93048. const enableNestedArrays = true;
  93049. if (defined_default(classProperty)) {
  93050. value = classProperty.packVectorAndMatrixTypes(value, enableNestedArrays);
  93051. value = classProperty.unapplyValueTransform(value);
  93052. value = classProperty.unnormalize(value);
  93053. }
  93054. properties[propertyId] = value;
  93055. return true;
  93056. };
  93057. MetadataEntity.getPropertyBySemantic = function(semantic, properties, classDefinition) {
  93058. Check_default.typeOf.string("semantic", semantic);
  93059. Check_default.typeOf.object("properties", properties);
  93060. Check_default.typeOf.object("classDefinition", classDefinition);
  93061. const propertiesBySemantic = classDefinition.propertiesBySemantic;
  93062. if (!defined_default(propertiesBySemantic)) {
  93063. return void 0;
  93064. }
  93065. const property = propertiesBySemantic[semantic];
  93066. if (defined_default(property)) {
  93067. return MetadataEntity.getProperty(property.id, properties, classDefinition);
  93068. }
  93069. return void 0;
  93070. };
  93071. MetadataEntity.setPropertyBySemantic = function(semantic, value, properties, classDefinition) {
  93072. Check_default.typeOf.string("semantic", semantic);
  93073. Check_default.defined("value", value);
  93074. Check_default.typeOf.object("properties", properties);
  93075. Check_default.typeOf.object("classDefinition", classDefinition);
  93076. const propertiesBySemantic = classDefinition.propertiesBySemantic;
  93077. if (!defined_default(propertiesBySemantic)) {
  93078. return false;
  93079. }
  93080. const property = classDefinition.propertiesBySemantic[semantic];
  93081. if (defined_default(property)) {
  93082. return MetadataEntity.setProperty(
  93083. property.id,
  93084. value,
  93085. properties,
  93086. classDefinition
  93087. );
  93088. }
  93089. return false;
  93090. };
  93091. var MetadataEntity_default = MetadataEntity;
  93092. // node_modules/cesium/Source/Scene/ImplicitSubtreeMetadata.js
  93093. function ImplicitSubtreeMetadata(options) {
  93094. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  93095. const subtreeMetadata = options.subtreeMetadata;
  93096. const metadataClass = options.class;
  93097. Check_default.typeOf.object("options.subtreeMetadata", subtreeMetadata);
  93098. Check_default.typeOf.object("options.class", metadataClass);
  93099. const properties = defined_default(subtreeMetadata.properties) ? subtreeMetadata.properties : {};
  93100. this._class = metadataClass;
  93101. this._properties = properties;
  93102. this._extras = subtreeMetadata.extras;
  93103. this._extensions = subtreeMetadata.extensions;
  93104. }
  93105. Object.defineProperties(ImplicitSubtreeMetadata.prototype, {
  93106. class: {
  93107. get: function() {
  93108. return this._class;
  93109. }
  93110. },
  93111. extras: {
  93112. get: function() {
  93113. return this._extras;
  93114. }
  93115. },
  93116. extensions: {
  93117. get: function() {
  93118. return this._extensions;
  93119. }
  93120. }
  93121. });
  93122. ImplicitSubtreeMetadata.prototype.hasProperty = function(propertyId) {
  93123. return MetadataEntity_default.hasProperty(propertyId, this._properties, this._class);
  93124. };
  93125. ImplicitSubtreeMetadata.prototype.hasPropertyBySemantic = function(semantic) {
  93126. return MetadataEntity_default.hasPropertyBySemantic(
  93127. semantic,
  93128. this._properties,
  93129. this._class
  93130. );
  93131. };
  93132. ImplicitSubtreeMetadata.prototype.getPropertyIds = function(results) {
  93133. return MetadataEntity_default.getPropertyIds(this._properties, this._class, results);
  93134. };
  93135. ImplicitSubtreeMetadata.prototype.getProperty = function(propertyId) {
  93136. return MetadataEntity_default.getProperty(propertyId, this._properties, this._class);
  93137. };
  93138. ImplicitSubtreeMetadata.prototype.setProperty = function(propertyId, value) {
  93139. return MetadataEntity_default.setProperty(
  93140. propertyId,
  93141. value,
  93142. this._properties,
  93143. this._class
  93144. );
  93145. };
  93146. ImplicitSubtreeMetadata.prototype.getPropertyBySemantic = function(semantic) {
  93147. return MetadataEntity_default.getPropertyBySemantic(
  93148. semantic,
  93149. this._properties,
  93150. this._class
  93151. );
  93152. };
  93153. ImplicitSubtreeMetadata.prototype.setPropertyBySemantic = function(semantic, value) {
  93154. return MetadataEntity_default.setPropertyBySemantic(
  93155. semantic,
  93156. value,
  93157. this._properties,
  93158. this._class
  93159. );
  93160. };
  93161. var ImplicitSubtreeMetadata_default = ImplicitSubtreeMetadata;
  93162. // node_modules/cesium/Source/Scene/MetadataComponentType.js
  93163. var MetadataComponentType = {
  93164. INT8: "INT8",
  93165. UINT8: "UINT8",
  93166. INT16: "INT16",
  93167. UINT16: "UINT16",
  93168. INT32: "INT32",
  93169. UINT32: "UINT32",
  93170. INT64: "INT64",
  93171. UINT64: "UINT64",
  93172. FLOAT32: "FLOAT32",
  93173. FLOAT64: "FLOAT64"
  93174. };
  93175. MetadataComponentType.getMinimum = function(type) {
  93176. if (!MetadataComponentType.isNumericType(type)) {
  93177. throw new DeveloperError_default("type must be a numeric type");
  93178. }
  93179. switch (type) {
  93180. case MetadataComponentType.INT8:
  93181. return -128;
  93182. case MetadataComponentType.UINT8:
  93183. return 0;
  93184. case MetadataComponentType.INT16:
  93185. return -32768;
  93186. case MetadataComponentType.UINT16:
  93187. return 0;
  93188. case MetadataComponentType.INT32:
  93189. return -2147483648;
  93190. case MetadataComponentType.UINT32:
  93191. return 0;
  93192. case MetadataComponentType.INT64:
  93193. if (FeatureDetection_default.supportsBigInt()) {
  93194. return BigInt("-9223372036854775808");
  93195. }
  93196. return -Math.pow(2, 63);
  93197. case MetadataComponentType.UINT64:
  93198. if (FeatureDetection_default.supportsBigInt()) {
  93199. return BigInt(0);
  93200. }
  93201. return 0;
  93202. case MetadataComponentType.FLOAT32:
  93203. return -34028234663852886e22;
  93204. case MetadataComponentType.FLOAT64:
  93205. return -Number.MAX_VALUE;
  93206. }
  93207. };
  93208. MetadataComponentType.getMaximum = function(type) {
  93209. if (!MetadataComponentType.isNumericType(type)) {
  93210. throw new DeveloperError_default("type must be a numeric type");
  93211. }
  93212. switch (type) {
  93213. case MetadataComponentType.INT8:
  93214. return 127;
  93215. case MetadataComponentType.UINT8:
  93216. return 255;
  93217. case MetadataComponentType.INT16:
  93218. return 32767;
  93219. case MetadataComponentType.UINT16:
  93220. return 65535;
  93221. case MetadataComponentType.INT32:
  93222. return 2147483647;
  93223. case MetadataComponentType.UINT32:
  93224. return 4294967295;
  93225. case MetadataComponentType.INT64:
  93226. if (FeatureDetection_default.supportsBigInt()) {
  93227. return BigInt("9223372036854775807");
  93228. }
  93229. return Math.pow(2, 63) - 1;
  93230. case MetadataComponentType.UINT64:
  93231. if (FeatureDetection_default.supportsBigInt()) {
  93232. return BigInt("18446744073709551615");
  93233. }
  93234. return Math.pow(2, 64) - 1;
  93235. case MetadataComponentType.FLOAT32:
  93236. return 34028234663852886e22;
  93237. case MetadataComponentType.FLOAT64:
  93238. return Number.MAX_VALUE;
  93239. }
  93240. };
  93241. MetadataComponentType.isNumericType = function(type) {
  93242. Check_default.typeOf.string("type", type);
  93243. switch (type) {
  93244. case MetadataComponentType.INT8:
  93245. case MetadataComponentType.UINT8:
  93246. case MetadataComponentType.INT16:
  93247. case MetadataComponentType.UINT16:
  93248. case MetadataComponentType.INT32:
  93249. case MetadataComponentType.UINT32:
  93250. case MetadataComponentType.INT64:
  93251. case MetadataComponentType.UINT64:
  93252. case MetadataComponentType.FLOAT32:
  93253. case MetadataComponentType.FLOAT64:
  93254. return true;
  93255. default:
  93256. return false;
  93257. }
  93258. };
  93259. MetadataComponentType.isIntegerType = function(type) {
  93260. Check_default.typeOf.string("type", type);
  93261. switch (type) {
  93262. case MetadataComponentType.INT8:
  93263. case MetadataComponentType.UINT8:
  93264. case MetadataComponentType.INT16:
  93265. case MetadataComponentType.UINT16:
  93266. case MetadataComponentType.INT32:
  93267. case MetadataComponentType.UINT32:
  93268. case MetadataComponentType.INT64:
  93269. case MetadataComponentType.UINT64:
  93270. return true;
  93271. default:
  93272. return false;
  93273. }
  93274. };
  93275. MetadataComponentType.isUnsignedIntegerType = function(type) {
  93276. Check_default.typeOf.string("type", type);
  93277. switch (type) {
  93278. case MetadataComponentType.UINT8:
  93279. case MetadataComponentType.UINT16:
  93280. case MetadataComponentType.UINT32:
  93281. case MetadataComponentType.UINT64:
  93282. return true;
  93283. default:
  93284. return false;
  93285. }
  93286. };
  93287. MetadataComponentType.isVectorCompatible = function(type) {
  93288. Check_default.typeOf.string("type", type);
  93289. switch (type) {
  93290. case MetadataComponentType.INT8:
  93291. case MetadataComponentType.UINT8:
  93292. case MetadataComponentType.INT16:
  93293. case MetadataComponentType.UINT16:
  93294. case MetadataComponentType.INT32:
  93295. case MetadataComponentType.UINT32:
  93296. case MetadataComponentType.FLOAT32:
  93297. case MetadataComponentType.FLOAT64:
  93298. return true;
  93299. default:
  93300. return false;
  93301. }
  93302. };
  93303. MetadataComponentType.normalize = function(value, type) {
  93304. if (typeof value !== "number" && typeof value !== "bigint") {
  93305. throw new DeveloperError_default("value must be a number or a BigInt");
  93306. }
  93307. if (!MetadataComponentType.isIntegerType(type)) {
  93308. throw new DeveloperError_default("type must be an integer type");
  93309. }
  93310. return Math.max(
  93311. Number(value) / Number(MetadataComponentType.getMaximum(type)),
  93312. -1
  93313. );
  93314. };
  93315. MetadataComponentType.unnormalize = function(value, type) {
  93316. Check_default.typeOf.number("value", value);
  93317. if (!MetadataComponentType.isIntegerType(type)) {
  93318. throw new DeveloperError_default("type must be an integer type");
  93319. }
  93320. const max3 = MetadataComponentType.getMaximum(type);
  93321. const min3 = MetadataComponentType.isUnsignedIntegerType(type) ? 0 : -max3;
  93322. value = Math_default.sign(value) * Math.round(Math.abs(value) * Number(max3));
  93323. if ((type === MetadataComponentType.INT64 || type === MetadataComponentType.UINT64) && FeatureDetection_default.supportsBigInt()) {
  93324. value = BigInt(value);
  93325. }
  93326. if (value > max3) {
  93327. return max3;
  93328. }
  93329. if (value < min3) {
  93330. return min3;
  93331. }
  93332. return value;
  93333. };
  93334. MetadataComponentType.applyValueTransform = function(value, offset2, scale) {
  93335. return scale * value + offset2;
  93336. };
  93337. MetadataComponentType.unapplyValueTransform = function(value, offset2, scale) {
  93338. if (scale === 0) {
  93339. return 0;
  93340. }
  93341. return (value - offset2) / scale;
  93342. };
  93343. MetadataComponentType.getSizeInBytes = function(type) {
  93344. if (!MetadataComponentType.isNumericType(type)) {
  93345. throw new DeveloperError_default("type must be a numeric type");
  93346. }
  93347. switch (type) {
  93348. case MetadataComponentType.INT8:
  93349. case MetadataComponentType.UINT8:
  93350. return 1;
  93351. case MetadataComponentType.INT16:
  93352. case MetadataComponentType.UINT16:
  93353. return 2;
  93354. case MetadataComponentType.INT32:
  93355. case MetadataComponentType.UINT32:
  93356. return 4;
  93357. case MetadataComponentType.INT64:
  93358. case MetadataComponentType.UINT64:
  93359. return 8;
  93360. case MetadataComponentType.FLOAT32:
  93361. return 4;
  93362. case MetadataComponentType.FLOAT64:
  93363. return 8;
  93364. }
  93365. };
  93366. var MetadataComponentType_default = Object.freeze(MetadataComponentType);
  93367. // node_modules/cesium/Source/Scene/MetadataType.js
  93368. var MetadataType = {
  93369. SCALAR: "SCALAR",
  93370. VEC2: "VEC2",
  93371. VEC3: "VEC3",
  93372. VEC4: "VEC4",
  93373. MAT2: "MAT2",
  93374. MAT3: "MAT3",
  93375. MAT4: "MAT4",
  93376. BOOLEAN: "BOOLEAN",
  93377. STRING: "STRING",
  93378. ENUM: "ENUM"
  93379. };
  93380. MetadataType.isVectorType = function(type) {
  93381. Check_default.typeOf.string("type", type);
  93382. switch (type) {
  93383. case MetadataType.VEC2:
  93384. case MetadataType.VEC3:
  93385. case MetadataType.VEC4:
  93386. return true;
  93387. default:
  93388. return false;
  93389. }
  93390. };
  93391. MetadataType.isMatrixType = function(type) {
  93392. Check_default.typeOf.string("type", type);
  93393. switch (type) {
  93394. case MetadataType.MAT2:
  93395. case MetadataType.MAT3:
  93396. case MetadataType.MAT4:
  93397. return true;
  93398. default:
  93399. return false;
  93400. }
  93401. };
  93402. MetadataType.getComponentCount = function(type) {
  93403. Check_default.typeOf.string("type", type);
  93404. switch (type) {
  93405. case MetadataType.SCALAR:
  93406. case MetadataType.STRING:
  93407. case MetadataType.ENUM:
  93408. case MetadataType.BOOLEAN:
  93409. return 1;
  93410. case MetadataType.VEC2:
  93411. return 2;
  93412. case MetadataType.VEC3:
  93413. return 3;
  93414. case MetadataType.VEC4:
  93415. return 4;
  93416. case MetadataType.MAT2:
  93417. return 4;
  93418. case MetadataType.MAT3:
  93419. return 9;
  93420. case MetadataType.MAT4:
  93421. return 16;
  93422. default:
  93423. throw new DeveloperError_default(`Invalid metadata type ${type}`);
  93424. }
  93425. };
  93426. MetadataType.getMathType = function(type) {
  93427. switch (type) {
  93428. case MetadataType.VEC2:
  93429. return Cartesian2_default;
  93430. case MetadataType.VEC3:
  93431. return Cartesian3_default;
  93432. case MetadataType.VEC4:
  93433. return Cartesian4_default;
  93434. case MetadataType.MAT2:
  93435. return Matrix2_default;
  93436. case MetadataType.MAT3:
  93437. return Matrix3_default;
  93438. case MetadataType.MAT4:
  93439. return Matrix4_default;
  93440. default:
  93441. return void 0;
  93442. }
  93443. };
  93444. var MetadataType_default = Object.freeze(MetadataType);
  93445. // node_modules/cesium/Source/Scene/MetadataClassProperty.js
  93446. function MetadataClassProperty(options) {
  93447. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  93448. const id = options.id;
  93449. const property = options.property;
  93450. Check_default.typeOf.string("options.id", id);
  93451. Check_default.typeOf.object("options.property", property);
  93452. Check_default.typeOf.string("options.property.type", property.type);
  93453. const isLegacyExtension = isLegacy(property);
  93454. const parsedType = parseType(property, options.enums);
  93455. const componentType = parsedType.componentType;
  93456. const normalized = defined_default(componentType) && MetadataComponentType_default.isIntegerType(componentType) && defaultValue_default(property.normalized, false);
  93457. this._id = id;
  93458. this._name = property.name;
  93459. this._description = property.description;
  93460. this._semantic = property.semantic;
  93461. this._isLegacyExtension = isLegacyExtension;
  93462. this._type = parsedType.type;
  93463. this._componentType = componentType;
  93464. this._enumType = parsedType.enumType;
  93465. this._valueType = parsedType.valueType;
  93466. this._isArray = parsedType.isArray;
  93467. this._isVariableLengthArray = parsedType.isVariableLengthArray;
  93468. this._arrayLength = parsedType.arrayLength;
  93469. this._min = property.min;
  93470. this._max = property.max;
  93471. this._normalized = normalized;
  93472. let offset2 = property.offset;
  93473. let scale = property.scale;
  93474. const hasValueTransform = defined_default(offset2) || defined_default(scale);
  93475. const enableNestedArrays = true;
  93476. if (!defined_default(offset2)) {
  93477. offset2 = this.expandConstant(0, enableNestedArrays);
  93478. }
  93479. if (!defined_default(scale)) {
  93480. scale = this.expandConstant(1, enableNestedArrays);
  93481. }
  93482. this._offset = offset2;
  93483. this._scale = scale;
  93484. this._hasValueTransform = hasValueTransform;
  93485. this._noData = property.noData;
  93486. this._default = property.default;
  93487. let required;
  93488. if (!defined_default(isLegacyExtension)) {
  93489. required = false;
  93490. } else if (isLegacyExtension) {
  93491. required = defined_default(property.optional) ? !property.optional : true;
  93492. } else {
  93493. required = defaultValue_default(property.required, false);
  93494. }
  93495. this._required = required;
  93496. this._extras = property.extras;
  93497. this._extensions = property.extensions;
  93498. }
  93499. Object.defineProperties(MetadataClassProperty.prototype, {
  93500. id: {
  93501. get: function() {
  93502. return this._id;
  93503. }
  93504. },
  93505. name: {
  93506. get: function() {
  93507. return this._name;
  93508. }
  93509. },
  93510. description: {
  93511. get: function() {
  93512. return this._description;
  93513. }
  93514. },
  93515. type: {
  93516. get: function() {
  93517. return this._type;
  93518. }
  93519. },
  93520. enumType: {
  93521. get: function() {
  93522. return this._enumType;
  93523. }
  93524. },
  93525. componentType: {
  93526. get: function() {
  93527. return this._componentType;
  93528. }
  93529. },
  93530. valueType: {
  93531. get: function() {
  93532. return this._valueType;
  93533. }
  93534. },
  93535. isArray: {
  93536. get: function() {
  93537. return this._isArray;
  93538. }
  93539. },
  93540. isVariableLengthArray: {
  93541. get: function() {
  93542. return this._isVariableLengthArray;
  93543. }
  93544. },
  93545. arrayLength: {
  93546. get: function() {
  93547. return this._arrayLength;
  93548. }
  93549. },
  93550. normalized: {
  93551. get: function() {
  93552. return this._normalized;
  93553. }
  93554. },
  93555. max: {
  93556. get: function() {
  93557. return this._max;
  93558. }
  93559. },
  93560. min: {
  93561. get: function() {
  93562. return this._min;
  93563. }
  93564. },
  93565. noData: {
  93566. get: function() {
  93567. return this._noData;
  93568. }
  93569. },
  93570. default: {
  93571. get: function() {
  93572. return this._default;
  93573. }
  93574. },
  93575. required: {
  93576. get: function() {
  93577. return this._required;
  93578. }
  93579. },
  93580. semantic: {
  93581. get: function() {
  93582. return this._semantic;
  93583. }
  93584. },
  93585. hasValueTransform: {
  93586. get: function() {
  93587. return this._hasValueTransform;
  93588. }
  93589. },
  93590. offset: {
  93591. get: function() {
  93592. return this._offset;
  93593. }
  93594. },
  93595. scale: {
  93596. get: function() {
  93597. return this._scale;
  93598. }
  93599. },
  93600. extras: {
  93601. get: function() {
  93602. return this._extras;
  93603. }
  93604. },
  93605. extensions: {
  93606. get: function() {
  93607. return this._extensions;
  93608. }
  93609. }
  93610. });
  93611. function isLegacy(property) {
  93612. if (property.type === "ARRAY") {
  93613. return true;
  93614. }
  93615. const type = property.type;
  93616. if (type === MetadataType_default.SCALAR || MetadataType_default.isMatrixType(type) || MetadataType_default.isVectorType(type)) {
  93617. return false;
  93618. }
  93619. if (MetadataComponentType_default.isNumericType(type)) {
  93620. return true;
  93621. }
  93622. if (defined_default(property.noData) || defined_default(property.scale) || defined_default(property.offset) || defined_default(property.required) || defined_default(property.count) || defined_default(property.array)) {
  93623. return false;
  93624. }
  93625. if (defined_default(property.optional)) {
  93626. return false;
  93627. }
  93628. return void 0;
  93629. }
  93630. function parseType(property, enums) {
  93631. const type = property.type;
  93632. const componentType = property.componentType;
  93633. const isLegacyArray = type === "ARRAY";
  93634. let isArray;
  93635. let arrayLength;
  93636. let isVariableLengthArray;
  93637. if (isLegacyArray) {
  93638. isArray = true;
  93639. arrayLength = property.componentCount;
  93640. isVariableLengthArray = !defined_default(arrayLength);
  93641. } else if (property.array) {
  93642. isArray = true;
  93643. arrayLength = property.count;
  93644. isVariableLengthArray = !defined_default(property.count);
  93645. } else {
  93646. isArray = false;
  93647. arrayLength = void 0;
  93648. isVariableLengthArray = false;
  93649. }
  93650. let enumType;
  93651. if (defined_default(property.enumType)) {
  93652. enumType = enums[property.enumType];
  93653. }
  93654. if (type === MetadataType_default.ENUM) {
  93655. return {
  93656. type,
  93657. componentType: void 0,
  93658. enumType,
  93659. valueType: enumType.valueType,
  93660. isArray,
  93661. isVariableLengthArray,
  93662. arrayLength
  93663. };
  93664. }
  93665. if (isLegacyArray && componentType === MetadataType_default.ENUM) {
  93666. return {
  93667. type: componentType,
  93668. componentType: void 0,
  93669. enumType,
  93670. valueType: enumType.valueType,
  93671. isArray,
  93672. isVariableLengthArray,
  93673. arrayLength
  93674. };
  93675. }
  93676. if (type === MetadataType_default.SCALAR || MetadataType_default.isMatrixType(type) || MetadataType_default.isVectorType(type)) {
  93677. return {
  93678. type,
  93679. componentType,
  93680. enumType: void 0,
  93681. valueType: componentType,
  93682. isArray,
  93683. isVariableLengthArray,
  93684. arrayLength
  93685. };
  93686. }
  93687. if (type === MetadataType_default.BOOLEAN || type === MetadataType_default.STRING) {
  93688. return {
  93689. type,
  93690. componentType: void 0,
  93691. enumType: void 0,
  93692. valueType: void 0,
  93693. isArray,
  93694. isVariableLengthArray,
  93695. arrayLength
  93696. };
  93697. }
  93698. if (isLegacyArray && (componentType === MetadataType_default.BOOLEAN || componentType === MetadataType_default.STRING)) {
  93699. return {
  93700. type: componentType,
  93701. componentType: void 0,
  93702. enumType: void 0,
  93703. valueType: void 0,
  93704. isArray,
  93705. isVariableLengthArray,
  93706. arrayLength
  93707. };
  93708. }
  93709. if (defined_default(componentType) && MetadataComponentType_default.isNumericType(componentType)) {
  93710. return {
  93711. type: MetadataType_default.SCALAR,
  93712. componentType,
  93713. enumType: void 0,
  93714. valueType: componentType,
  93715. isArray,
  93716. isVariableLengthArray,
  93717. arrayLength
  93718. };
  93719. }
  93720. if (MetadataComponentType_default.isNumericType(type)) {
  93721. return {
  93722. type: MetadataType_default.SCALAR,
  93723. componentType: type,
  93724. enumType: void 0,
  93725. valueType: type,
  93726. isArray,
  93727. isVariableLengthArray,
  93728. arrayLength
  93729. };
  93730. }
  93731. throw new DeveloperError_default(
  93732. `unknown metadata type {type: ${type}, componentType: ${componentType})`
  93733. );
  93734. }
  93735. MetadataClassProperty.prototype.normalize = function(value) {
  93736. if (!this._normalized) {
  93737. return value;
  93738. }
  93739. return normalizeInPlace(
  93740. value,
  93741. this._valueType,
  93742. MetadataComponentType_default.normalize
  93743. );
  93744. };
  93745. MetadataClassProperty.prototype.unnormalize = function(value) {
  93746. if (!this._normalized) {
  93747. return value;
  93748. }
  93749. return normalizeInPlace(
  93750. value,
  93751. this._valueType,
  93752. MetadataComponentType_default.unnormalize
  93753. );
  93754. };
  93755. MetadataClassProperty.prototype.applyValueTransform = function(value) {
  93756. if (!this._hasValueTransform || this._isVariableLengthArray) {
  93757. return value;
  93758. }
  93759. return MetadataClassProperty.valueTransformInPlace(
  93760. value,
  93761. this._offset,
  93762. this._scale,
  93763. MetadataComponentType_default.applyValueTransform
  93764. );
  93765. };
  93766. MetadataClassProperty.prototype.unapplyValueTransform = function(value) {
  93767. if (!this._hasValueTransform || this._isVariableLengthArray) {
  93768. return value;
  93769. }
  93770. return MetadataClassProperty.valueTransformInPlace(
  93771. value,
  93772. this._offset,
  93773. this._scale,
  93774. MetadataComponentType_default.unapplyValueTransform
  93775. );
  93776. };
  93777. MetadataClassProperty.prototype.expandConstant = function(constant, enableNestedArrays) {
  93778. enableNestedArrays = defaultValue_default(enableNestedArrays, false);
  93779. const isArray = this._isArray;
  93780. const arrayLength = this._arrayLength;
  93781. const componentCount = MetadataType_default.getComponentCount(this._type);
  93782. const isNested = isArray && componentCount > 1;
  93783. if (!isArray && componentCount === 1) {
  93784. return constant;
  93785. }
  93786. if (!isArray) {
  93787. return new Array(componentCount).fill(constant);
  93788. }
  93789. if (!isNested) {
  93790. return new Array(arrayLength).fill(constant);
  93791. }
  93792. if (!enableNestedArrays) {
  93793. return new Array(this._arrayLength * componentCount).fill(constant);
  93794. }
  93795. const innerConstant = new Array(componentCount).fill(constant);
  93796. return new Array(this._arrayLength).fill(innerConstant);
  93797. };
  93798. MetadataClassProperty.prototype.handleNoData = function(value) {
  93799. const sentinel = this._noData;
  93800. if (!defined_default(sentinel)) {
  93801. return value;
  93802. }
  93803. if (arrayEquals(value, sentinel)) {
  93804. return void 0;
  93805. }
  93806. return value;
  93807. };
  93808. function arrayEquals(left, right) {
  93809. if (!Array.isArray(left)) {
  93810. return left === right;
  93811. }
  93812. if (!Array.isArray(right)) {
  93813. return false;
  93814. }
  93815. if (left.length !== right.length) {
  93816. return false;
  93817. }
  93818. for (let i2 = 0; i2 < left.length; i2++) {
  93819. if (!arrayEquals(left[i2], right[i2])) {
  93820. return false;
  93821. }
  93822. }
  93823. return true;
  93824. }
  93825. MetadataClassProperty.prototype.unpackVectorAndMatrixTypes = function(value, enableNestedArrays) {
  93826. enableNestedArrays = defaultValue_default(enableNestedArrays, false);
  93827. const MathType = MetadataType_default.getMathType(this._type);
  93828. const isArray = this._isArray;
  93829. const componentCount = MetadataType_default.getComponentCount(this._type);
  93830. const isNested = isArray && componentCount > 1;
  93831. if (!defined_default(MathType)) {
  93832. return value;
  93833. }
  93834. if (enableNestedArrays && isNested) {
  93835. return value.map(function(x) {
  93836. return MathType.unpack(x);
  93837. });
  93838. }
  93839. if (isArray) {
  93840. return MathType.unpackArray(value);
  93841. }
  93842. return MathType.unpack(value);
  93843. };
  93844. MetadataClassProperty.prototype.packVectorAndMatrixTypes = function(value, enableNestedArrays) {
  93845. enableNestedArrays = defaultValue_default(enableNestedArrays, false);
  93846. const MathType = MetadataType_default.getMathType(this._type);
  93847. const isArray = this._isArray;
  93848. const componentCount = MetadataType_default.getComponentCount(this._type);
  93849. const isNested = isArray && componentCount > 1;
  93850. if (!defined_default(MathType)) {
  93851. return value;
  93852. }
  93853. if (enableNestedArrays && isNested) {
  93854. return value.map(function(x) {
  93855. return MathType.pack(x, []);
  93856. });
  93857. }
  93858. if (isArray) {
  93859. return MathType.packArray(value, []);
  93860. }
  93861. return MathType.pack(value, []);
  93862. };
  93863. MetadataClassProperty.prototype.validate = function(value) {
  93864. if (!defined_default(value) && defined_default(this._default)) {
  93865. return void 0;
  93866. }
  93867. if (this._required && !defined_default(value)) {
  93868. return `required property must have a value`;
  93869. }
  93870. if (this._isArray) {
  93871. return validateArray(this, value);
  93872. }
  93873. return validateSingleValue(this, value);
  93874. };
  93875. function validateArray(classProperty, value) {
  93876. if (!Array.isArray(value)) {
  93877. return `value ${value} must be an array`;
  93878. }
  93879. const length3 = value.length;
  93880. if (!classProperty._isVariableLengthArray && length3 !== classProperty._arrayLength) {
  93881. return "Array length does not match property.arrayLength";
  93882. }
  93883. for (let i2 = 0; i2 < length3; i2++) {
  93884. const message = validateSingleValue(classProperty, value[i2]);
  93885. if (defined_default(message)) {
  93886. return message;
  93887. }
  93888. }
  93889. }
  93890. function validateSingleValue(classProperty, value) {
  93891. const type = classProperty._type;
  93892. const componentType = classProperty._componentType;
  93893. const enumType = classProperty._enumType;
  93894. const normalized = classProperty._normalized;
  93895. if (MetadataType_default.isVectorType(type)) {
  93896. return validateVector(value, type, componentType);
  93897. } else if (MetadataType_default.isMatrixType(type)) {
  93898. return validateMatrix(value, type, componentType);
  93899. } else if (type === MetadataType_default.STRING) {
  93900. return validateString(value);
  93901. } else if (type === MetadataType_default.BOOLEAN) {
  93902. return validateBoolean(value);
  93903. } else if (type === MetadataType_default.ENUM) {
  93904. return validateEnum(value, enumType);
  93905. }
  93906. return validateScalar(value, componentType, normalized);
  93907. }
  93908. function validateVector(value, type, componentType) {
  93909. if (!MetadataComponentType_default.isVectorCompatible(componentType)) {
  93910. return `componentType ${componentType} is incompatible with vector type ${type}`;
  93911. }
  93912. if (type === MetadataType_default.VEC2 && !(value instanceof Cartesian2_default)) {
  93913. return `vector value ${value} must be a Cartesian2`;
  93914. }
  93915. if (type === MetadataType_default.VEC3 && !(value instanceof Cartesian3_default)) {
  93916. return `vector value ${value} must be a Cartesian3`;
  93917. }
  93918. if (type === MetadataType_default.VEC4 && !(value instanceof Cartesian4_default)) {
  93919. return `vector value ${value} must be a Cartesian4`;
  93920. }
  93921. }
  93922. function validateMatrix(value, type, componentType) {
  93923. if (!MetadataComponentType_default.isVectorCompatible(componentType)) {
  93924. return `componentType ${componentType} is incompatible with matrix type ${type}`;
  93925. }
  93926. if (type === MetadataType_default.MAT2 && !(value instanceof Matrix2_default)) {
  93927. return `matrix value ${value} must be a Matrix2`;
  93928. }
  93929. if (type === MetadataType_default.MAT3 && !(value instanceof Matrix3_default)) {
  93930. return `matrix value ${value} must be a Matrix3`;
  93931. }
  93932. if (type === MetadataType_default.MAT4 && !(value instanceof Matrix4_default)) {
  93933. return `matrix value ${value} must be a Matrix4`;
  93934. }
  93935. }
  93936. function validateString(value) {
  93937. if (typeof value !== "string") {
  93938. return getTypeErrorMessage(value, MetadataType_default.STRING);
  93939. }
  93940. }
  93941. function validateBoolean(value) {
  93942. if (typeof value !== "boolean") {
  93943. return getTypeErrorMessage(value, MetadataType_default.BOOLEAN);
  93944. }
  93945. }
  93946. function validateEnum(value, enumType) {
  93947. const javascriptType = typeof value;
  93948. if (defined_default(enumType)) {
  93949. if (javascriptType !== "string" || !defined_default(enumType.valuesByName[value])) {
  93950. return `value ${value} is not a valid enum name for ${enumType.id}`;
  93951. }
  93952. return;
  93953. }
  93954. }
  93955. function validateScalar(value, componentType, normalized) {
  93956. const javascriptType = typeof value;
  93957. switch (componentType) {
  93958. case MetadataComponentType_default.INT8:
  93959. case MetadataComponentType_default.UINT8:
  93960. case MetadataComponentType_default.INT16:
  93961. case MetadataComponentType_default.UINT16:
  93962. case MetadataComponentType_default.INT32:
  93963. case MetadataComponentType_default.UINT32:
  93964. case MetadataComponentType_default.FLOAT32:
  93965. case MetadataComponentType_default.FLOAT64:
  93966. if (javascriptType !== "number") {
  93967. return getTypeErrorMessage(value, componentType);
  93968. }
  93969. if (!isFinite(value)) {
  93970. return getNonFiniteErrorMessage(value, componentType);
  93971. }
  93972. return checkInRange(value, componentType, normalized);
  93973. case MetadataComponentType_default.INT64:
  93974. case MetadataComponentType_default.UINT64:
  93975. if (javascriptType !== "number" && javascriptType !== "bigint") {
  93976. return getTypeErrorMessage(value, componentType);
  93977. }
  93978. if (javascriptType === "number" && !isFinite(value)) {
  93979. return getNonFiniteErrorMessage(value, componentType);
  93980. }
  93981. return checkInRange(value, componentType, normalized);
  93982. }
  93983. }
  93984. function getTypeErrorMessage(value, type) {
  93985. return `value ${value} does not match type ${type}`;
  93986. }
  93987. function getOutOfRangeErrorMessage(value, type, normalized) {
  93988. let errorMessage = `value ${value} is out of range for type ${type}`;
  93989. if (normalized) {
  93990. errorMessage += " (normalized)";
  93991. }
  93992. return errorMessage;
  93993. }
  93994. function checkInRange(value, componentType, normalized) {
  93995. if (normalized) {
  93996. const min3 = MetadataComponentType_default.isUnsignedIntegerType(componentType) ? 0 : -1;
  93997. const max3 = 1;
  93998. if (value < min3 || value > max3) {
  93999. return getOutOfRangeErrorMessage(value, componentType, normalized);
  94000. }
  94001. return;
  94002. }
  94003. if (value < MetadataComponentType_default.getMinimum(componentType) || value > MetadataComponentType_default.getMaximum(componentType)) {
  94004. return getOutOfRangeErrorMessage(value, componentType, normalized);
  94005. }
  94006. }
  94007. function getNonFiniteErrorMessage(value, type) {
  94008. return `value ${value} of type ${type} must be finite`;
  94009. }
  94010. function normalizeInPlace(values, valueType, normalizeFunction) {
  94011. if (!Array.isArray(values)) {
  94012. return normalizeFunction(values, valueType);
  94013. }
  94014. for (let i2 = 0; i2 < values.length; i2++) {
  94015. values[i2] = normalizeInPlace(values[i2], valueType, normalizeFunction);
  94016. }
  94017. return values;
  94018. }
  94019. MetadataClassProperty.valueTransformInPlace = function(values, offsets, scales, transformationFunction) {
  94020. if (!Array.isArray(values)) {
  94021. return transformationFunction(values, offsets, scales);
  94022. }
  94023. for (let i2 = 0; i2 < values.length; i2++) {
  94024. values[i2] = MetadataClassProperty.valueTransformInPlace(
  94025. values[i2],
  94026. offsets[i2],
  94027. scales[i2],
  94028. transformationFunction
  94029. );
  94030. }
  94031. return values;
  94032. };
  94033. var MetadataClassProperty_default = MetadataClassProperty;
  94034. // node_modules/cesium/Source/Scene/MetadataTableProperty.js
  94035. function MetadataTableProperty(options) {
  94036. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  94037. const count = options.count;
  94038. const property = options.property;
  94039. const classProperty = options.classProperty;
  94040. const bufferViews = options.bufferViews;
  94041. Check_default.typeOf.number.greaterThan("options.count", count, 0);
  94042. Check_default.typeOf.object("options.property", property);
  94043. Check_default.typeOf.object("options.classProperty", classProperty);
  94044. Check_default.typeOf.object("options.bufferViews", bufferViews);
  94045. const type = classProperty.type;
  94046. const isArray = classProperty.isArray;
  94047. const isVariableLengthArray = classProperty.isVariableLengthArray;
  94048. let valueType = classProperty.valueType;
  94049. const enumType = classProperty.enumType;
  94050. const hasStrings = type === MetadataType_default.STRING;
  94051. const hasBooleans = type === MetadataType_default.BOOLEAN;
  94052. let arrayOffsets;
  94053. if (isVariableLengthArray) {
  94054. let arrayOffsetType = defaultValue_default(
  94055. property.arrayOffsetType,
  94056. property.offsetType
  94057. );
  94058. arrayOffsetType = defaultValue_default(
  94059. MetadataComponentType_default[arrayOffsetType],
  94060. MetadataComponentType_default.UINT32
  94061. );
  94062. const arrayOffsetBufferView = defaultValue_default(
  94063. property.arrayOffsets,
  94064. property.arrayOffsetBufferView
  94065. );
  94066. arrayOffsets = new BufferView(
  94067. bufferViews[arrayOffsetBufferView],
  94068. arrayOffsetType,
  94069. count + 1
  94070. );
  94071. }
  94072. const vectorComponentCount = MetadataType_default.getComponentCount(type);
  94073. let arrayComponentCount;
  94074. if (isVariableLengthArray) {
  94075. arrayComponentCount = arrayOffsets.get(count) - arrayOffsets.get(0);
  94076. } else if (isArray) {
  94077. arrayComponentCount = count * classProperty.arrayLength;
  94078. } else {
  94079. arrayComponentCount = count;
  94080. }
  94081. const componentCount = vectorComponentCount * arrayComponentCount;
  94082. let stringOffsets;
  94083. if (hasStrings) {
  94084. let stringOffsetType = defaultValue_default(
  94085. property.stringOffsetType,
  94086. property.offsetType
  94087. );
  94088. stringOffsetType = defaultValue_default(
  94089. MetadataComponentType_default[stringOffsetType],
  94090. MetadataComponentType_default.UINT32
  94091. );
  94092. const stringOffsetBufferView = defaultValue_default(
  94093. property.stringOffsets,
  94094. property.stringOffsetBufferView
  94095. );
  94096. stringOffsets = new BufferView(
  94097. bufferViews[stringOffsetBufferView],
  94098. stringOffsetType,
  94099. componentCount + 1
  94100. );
  94101. }
  94102. if (hasStrings || hasBooleans) {
  94103. valueType = MetadataComponentType_default.UINT8;
  94104. }
  94105. let valueCount;
  94106. if (hasStrings) {
  94107. valueCount = stringOffsets.get(componentCount) - stringOffsets.get(0);
  94108. } else if (hasBooleans) {
  94109. valueCount = Math.ceil(componentCount / 8);
  94110. } else {
  94111. valueCount = componentCount;
  94112. }
  94113. const valuesBufferView = defaultValue_default(property.values, property.bufferView);
  94114. const values = new BufferView(
  94115. bufferViews[valuesBufferView],
  94116. valueType,
  94117. valueCount
  94118. );
  94119. let offset2 = property.offset;
  94120. let scale = property.scale;
  94121. const hasValueTransform = classProperty.hasValueTransform || defined_default(offset2) || defined_default(scale);
  94122. offset2 = defaultValue_default(offset2, classProperty.offset);
  94123. scale = defaultValue_default(scale, classProperty.scale);
  94124. offset2 = flatten(offset2);
  94125. scale = flatten(scale);
  94126. let getValueFunction;
  94127. let setValueFunction;
  94128. const that = this;
  94129. if (hasStrings) {
  94130. getValueFunction = function(index2) {
  94131. return getString(index2, that._values, that._stringOffsets);
  94132. };
  94133. } else if (hasBooleans) {
  94134. getValueFunction = function(index2) {
  94135. return getBoolean(index2, that._values);
  94136. };
  94137. setValueFunction = function(index2, value) {
  94138. setBoolean(index2, that._values, value);
  94139. };
  94140. } else if (defined_default(enumType)) {
  94141. getValueFunction = function(index2) {
  94142. const integer = that._values.get(index2);
  94143. return enumType.namesByValue[integer];
  94144. };
  94145. setValueFunction = function(index2, value) {
  94146. const integer = enumType.valuesByName[value];
  94147. that._values.set(index2, integer);
  94148. };
  94149. } else {
  94150. getValueFunction = function(index2) {
  94151. return that._values.get(index2);
  94152. };
  94153. setValueFunction = function(index2, value) {
  94154. that._values.set(index2, value);
  94155. };
  94156. }
  94157. this._arrayOffsets = arrayOffsets;
  94158. this._stringOffsets = stringOffsets;
  94159. this._values = values;
  94160. this._classProperty = classProperty;
  94161. this._count = count;
  94162. this._vectorComponentCount = vectorComponentCount;
  94163. this._min = property.min;
  94164. this._max = property.max;
  94165. this._offset = offset2;
  94166. this._scale = scale;
  94167. this._hasValueTransform = hasValueTransform;
  94168. this._getValue = getValueFunction;
  94169. this._setValue = setValueFunction;
  94170. this._unpackedValues = void 0;
  94171. this._extras = property.extras;
  94172. this._extensions = property.extensions;
  94173. }
  94174. Object.defineProperties(MetadataTableProperty.prototype, {
  94175. hasValueTransform: {
  94176. get: function() {
  94177. return this._hasValueTransform;
  94178. }
  94179. },
  94180. offset: {
  94181. get: function() {
  94182. return this._offset;
  94183. }
  94184. },
  94185. scale: {
  94186. get: function() {
  94187. return this._scale;
  94188. }
  94189. },
  94190. extras: {
  94191. get: function() {
  94192. return this._extras;
  94193. }
  94194. },
  94195. extensions: {
  94196. get: function() {
  94197. return this._extensions;
  94198. }
  94199. }
  94200. });
  94201. MetadataTableProperty.prototype.get = function(index2) {
  94202. checkIndex(this, index2);
  94203. let value = get(this, index2);
  94204. value = this._classProperty.handleNoData(value);
  94205. if (!defined_default(value)) {
  94206. value = this._classProperty.default;
  94207. return this._classProperty.unpackVectorAndMatrixTypes(value);
  94208. }
  94209. value = this._classProperty.normalize(value);
  94210. value = applyValueTransform(this, value);
  94211. return this._classProperty.unpackVectorAndMatrixTypes(value);
  94212. };
  94213. MetadataTableProperty.prototype.set = function(index2, value) {
  94214. const classProperty = this._classProperty;
  94215. Check_default.defined("value", value);
  94216. checkIndex(this, index2);
  94217. const errorMessage = classProperty.validate(value);
  94218. if (defined_default(errorMessage)) {
  94219. throw new DeveloperError_default(errorMessage);
  94220. }
  94221. value = classProperty.packVectorAndMatrixTypes(value);
  94222. value = unapplyValueTransform(this, value);
  94223. value = classProperty.unnormalize(value);
  94224. set(this, index2, value);
  94225. };
  94226. MetadataTableProperty.prototype.getTypedArray = function() {
  94227. if (defined_default(this._values)) {
  94228. return this._values.typedArray;
  94229. }
  94230. return void 0;
  94231. };
  94232. function flatten(values) {
  94233. if (!Array.isArray(values)) {
  94234. return values;
  94235. }
  94236. const result = [];
  94237. for (let i2 = 0; i2 < values.length; i2++) {
  94238. const value = values[i2];
  94239. if (Array.isArray(value)) {
  94240. result.push.apply(result, value);
  94241. } else {
  94242. result.push(value);
  94243. }
  94244. }
  94245. return result;
  94246. }
  94247. function checkIndex(table2, index2) {
  94248. const count = table2._count;
  94249. if (!defined_default(index2) || index2 < 0 || index2 >= count) {
  94250. const maximumIndex = count - 1;
  94251. throw new DeveloperError_default(
  94252. `index is required and between zero and count - 1. Actual value: ${maximumIndex}`
  94253. );
  94254. }
  94255. }
  94256. function get(property, index2) {
  94257. if (requiresUnpackForGet(property)) {
  94258. unpackProperty(property);
  94259. }
  94260. const classProperty = property._classProperty;
  94261. const isArray = classProperty.isArray;
  94262. const type = classProperty.type;
  94263. const componentCount = MetadataType_default.getComponentCount(type);
  94264. if (defined_default(property._unpackedValues)) {
  94265. const value = property._unpackedValues[index2];
  94266. if (isArray) {
  94267. return clone_default(value, true);
  94268. }
  94269. return value;
  94270. }
  94271. if (!isArray && componentCount === 1) {
  94272. return property._getValue(index2);
  94273. }
  94274. return getArrayValues(property, classProperty, index2);
  94275. }
  94276. function getArrayValues(property, classProperty, index2) {
  94277. let offset2;
  94278. let length3;
  94279. if (classProperty.isVariableLengthArray) {
  94280. offset2 = property._arrayOffsets.get(index2);
  94281. length3 = property._arrayOffsets.get(index2 + 1) - offset2;
  94282. const componentCount = MetadataType_default.getComponentCount(classProperty.type);
  94283. offset2 *= componentCount;
  94284. length3 *= componentCount;
  94285. } else {
  94286. const arrayLength = defaultValue_default(classProperty.arrayLength, 1);
  94287. const componentCount = arrayLength * property._vectorComponentCount;
  94288. offset2 = index2 * componentCount;
  94289. length3 = componentCount;
  94290. }
  94291. const values = new Array(length3);
  94292. for (let i2 = 0; i2 < length3; i2++) {
  94293. values[i2] = property._getValue(offset2 + i2);
  94294. }
  94295. return values;
  94296. }
  94297. function set(property, index2, value) {
  94298. if (requiresUnpackForSet(property, index2, value)) {
  94299. unpackProperty(property);
  94300. }
  94301. const classProperty = property._classProperty;
  94302. const isArray = classProperty.isArray;
  94303. const type = classProperty.type;
  94304. const componentCount = MetadataType_default.getComponentCount(type);
  94305. if (defined_default(property._unpackedValues)) {
  94306. if (classProperty.isArray) {
  94307. value = clone_default(value, true);
  94308. }
  94309. property._unpackedValues[index2] = value;
  94310. return;
  94311. }
  94312. if (!isArray && componentCount === 1) {
  94313. property._setValue(index2, value);
  94314. return;
  94315. }
  94316. let offset2;
  94317. let length3;
  94318. if (classProperty.isVariableLengthArray) {
  94319. offset2 = property._arrayOffsets.get(index2);
  94320. length3 = property._arrayOffsets.get(index2 + 1) - offset2;
  94321. } else {
  94322. const arrayLength = defaultValue_default(classProperty.arrayLength, 1);
  94323. const componentCount2 = arrayLength * property._vectorComponentCount;
  94324. offset2 = index2 * componentCount2;
  94325. length3 = componentCount2;
  94326. }
  94327. for (let i2 = 0; i2 < length3; ++i2) {
  94328. property._setValue(offset2 + i2, value[i2]);
  94329. }
  94330. }
  94331. function getString(index2, values, stringOffsets) {
  94332. const stringByteOffset = stringOffsets.get(index2);
  94333. const stringByteLength = stringOffsets.get(index2 + 1) - stringByteOffset;
  94334. return getStringFromTypedArray_default(
  94335. values.typedArray,
  94336. stringByteOffset,
  94337. stringByteLength
  94338. );
  94339. }
  94340. function getBoolean(index2, values) {
  94341. const byteIndex = index2 >> 3;
  94342. const bitIndex = index2 % 8;
  94343. return (values.typedArray[byteIndex] >> bitIndex & 1) === 1;
  94344. }
  94345. function setBoolean(index2, values, value) {
  94346. const byteIndex = index2 >> 3;
  94347. const bitIndex = index2 % 8;
  94348. if (value) {
  94349. values.typedArray[byteIndex] |= 1 << bitIndex;
  94350. } else {
  94351. values.typedArray[byteIndex] &= ~(1 << bitIndex);
  94352. }
  94353. }
  94354. function getInt64NumberFallback(index2, values) {
  94355. const dataView = values.dataView;
  94356. const byteOffset = index2 * 8;
  94357. let value = 0;
  94358. const isNegative = (dataView.getUint8(byteOffset + 7) & 128) > 0;
  94359. let carrying = true;
  94360. for (let i2 = 0; i2 < 8; ++i2) {
  94361. let byte = dataView.getUint8(byteOffset + i2);
  94362. if (isNegative) {
  94363. if (carrying) {
  94364. if (byte !== 0) {
  94365. byte = ~(byte - 1) & 255;
  94366. carrying = false;
  94367. }
  94368. } else {
  94369. byte = ~byte & 255;
  94370. }
  94371. }
  94372. value += byte * Math.pow(256, i2);
  94373. }
  94374. if (isNegative) {
  94375. value = -value;
  94376. }
  94377. return value;
  94378. }
  94379. function getInt64BigIntFallback(index2, values) {
  94380. const dataView = values.dataView;
  94381. const byteOffset = index2 * 8;
  94382. let value = BigInt(0);
  94383. const isNegative = (dataView.getUint8(byteOffset + 7) & 128) > 0;
  94384. let carrying = true;
  94385. for (let i2 = 0; i2 < 8; ++i2) {
  94386. let byte = dataView.getUint8(byteOffset + i2);
  94387. if (isNegative) {
  94388. if (carrying) {
  94389. if (byte !== 0) {
  94390. byte = ~(byte - 1) & 255;
  94391. carrying = false;
  94392. }
  94393. } else {
  94394. byte = ~byte & 255;
  94395. }
  94396. }
  94397. value += BigInt(byte) * (BigInt(1) << BigInt(i2 * 8));
  94398. }
  94399. if (isNegative) {
  94400. value = -value;
  94401. }
  94402. return value;
  94403. }
  94404. function getUint64NumberFallback(index2, values) {
  94405. const dataView = values.dataView;
  94406. const byteOffset = index2 * 8;
  94407. const left = dataView.getUint32(byteOffset, true);
  94408. const right = dataView.getUint32(byteOffset + 4, true);
  94409. const value = left + 4294967296 * right;
  94410. return value;
  94411. }
  94412. function getUint64BigIntFallback(index2, values) {
  94413. const dataView = values.dataView;
  94414. const byteOffset = index2 * 8;
  94415. const left = BigInt(dataView.getUint32(byteOffset, true));
  94416. const right = BigInt(dataView.getUint32(byteOffset + 4, true));
  94417. const value = left + BigInt(4294967296) * right;
  94418. return value;
  94419. }
  94420. function getComponentDatatype(componentType) {
  94421. switch (componentType) {
  94422. case MetadataComponentType_default.INT8:
  94423. return ComponentDatatype_default.BYTE;
  94424. case MetadataComponentType_default.UINT8:
  94425. return ComponentDatatype_default.UNSIGNED_BYTE;
  94426. case MetadataComponentType_default.INT16:
  94427. return ComponentDatatype_default.SHORT;
  94428. case MetadataComponentType_default.UINT16:
  94429. return ComponentDatatype_default.UNSIGNED_SHORT;
  94430. case MetadataComponentType_default.INT32:
  94431. return ComponentDatatype_default.INT;
  94432. case MetadataComponentType_default.UINT32:
  94433. return ComponentDatatype_default.UNSIGNED_INT;
  94434. case MetadataComponentType_default.FLOAT32:
  94435. return ComponentDatatype_default.FLOAT;
  94436. case MetadataComponentType_default.FLOAT64:
  94437. return ComponentDatatype_default.DOUBLE;
  94438. }
  94439. }
  94440. function requiresUnpackForGet(property) {
  94441. if (defined_default(property._unpackedValues)) {
  94442. return false;
  94443. }
  94444. const classProperty = property._classProperty;
  94445. const type = classProperty.type;
  94446. const valueType = classProperty.valueType;
  94447. if (type === MetadataType_default.STRING) {
  94448. return true;
  94449. }
  94450. if (valueType === MetadataComponentType_default.INT64 && !FeatureDetection_default.supportsBigInt64Array()) {
  94451. return true;
  94452. }
  94453. if (valueType === MetadataComponentType_default.UINT64 && !FeatureDetection_default.supportsBigUint64Array()) {
  94454. return true;
  94455. }
  94456. return false;
  94457. }
  94458. function requiresUnpackForSet(property, index2, value) {
  94459. if (requiresUnpackForGet(property)) {
  94460. return true;
  94461. }
  94462. const arrayOffsets = property._arrayOffsets;
  94463. if (defined_default(arrayOffsets)) {
  94464. const oldLength = arrayOffsets.get(index2 + 1) - arrayOffsets.get(index2);
  94465. const newLength = value.length;
  94466. if (oldLength !== newLength) {
  94467. return true;
  94468. }
  94469. }
  94470. return false;
  94471. }
  94472. function unpackProperty(property) {
  94473. property._unpackedValues = unpackValues(property);
  94474. property._arrayOffsets = void 0;
  94475. property._stringOffsets = void 0;
  94476. property._values = void 0;
  94477. }
  94478. function unpackValues(property) {
  94479. const count = property._count;
  94480. const unpackedValues = new Array(count);
  94481. const classProperty = property._classProperty;
  94482. const isArray = classProperty.isArray;
  94483. const type = classProperty.type;
  94484. const componentCount = MetadataType_default.getComponentCount(type);
  94485. if (!isArray && componentCount === 1) {
  94486. for (let i2 = 0; i2 < count; ++i2) {
  94487. unpackedValues[i2] = property._getValue(i2);
  94488. }
  94489. return unpackedValues;
  94490. }
  94491. for (let i2 = 0; i2 < count; i2++) {
  94492. unpackedValues[i2] = getArrayValues(property, classProperty, i2);
  94493. }
  94494. return unpackedValues;
  94495. }
  94496. function applyValueTransform(property, value) {
  94497. const classProperty = property._classProperty;
  94498. const isVariableLengthArray = classProperty.isVariableLengthArray;
  94499. if (!property._hasValueTransform || isVariableLengthArray) {
  94500. return value;
  94501. }
  94502. return MetadataClassProperty_default.valueTransformInPlace(
  94503. value,
  94504. property._offset,
  94505. property._scale,
  94506. MetadataComponentType_default.applyValueTransform
  94507. );
  94508. }
  94509. function unapplyValueTransform(property, value) {
  94510. const classProperty = property._classProperty;
  94511. const isVariableLengthArray = classProperty.isVariableLengthArray;
  94512. if (!property._hasValueTransform || isVariableLengthArray) {
  94513. return value;
  94514. }
  94515. return MetadataClassProperty_default.valueTransformInPlace(
  94516. value,
  94517. property._offset,
  94518. property._scale,
  94519. MetadataComponentType_default.unapplyValueTransform
  94520. );
  94521. }
  94522. function BufferView(bufferView, componentType, length3) {
  94523. const that = this;
  94524. let typedArray;
  94525. let getFunction;
  94526. let setFunction;
  94527. if (componentType === MetadataComponentType_default.INT64) {
  94528. if (!FeatureDetection_default.supportsBigInt()) {
  94529. oneTimeWarning_default(
  94530. "INT64 type is not fully supported on this platform. Values greater than 2^53 - 1 or less than -(2^53 - 1) may lose precision when read."
  94531. );
  94532. typedArray = new Uint8Array(
  94533. bufferView.buffer,
  94534. bufferView.byteOffset,
  94535. length3 * 8
  94536. );
  94537. getFunction = function(index2) {
  94538. return getInt64NumberFallback(index2, that);
  94539. };
  94540. } else if (!FeatureDetection_default.supportsBigInt64Array()) {
  94541. typedArray = new Uint8Array(
  94542. bufferView.buffer,
  94543. bufferView.byteOffset,
  94544. length3 * 8
  94545. );
  94546. getFunction = function(index2) {
  94547. return getInt64BigIntFallback(index2, that);
  94548. };
  94549. } else {
  94550. typedArray = new BigInt64Array(
  94551. bufferView.buffer,
  94552. bufferView.byteOffset,
  94553. length3
  94554. );
  94555. setFunction = function(index2, value) {
  94556. that.typedArray[index2] = BigInt(value);
  94557. };
  94558. }
  94559. } else if (componentType === MetadataComponentType_default.UINT64) {
  94560. if (!FeatureDetection_default.supportsBigInt()) {
  94561. oneTimeWarning_default(
  94562. "UINT64 type is not fully supported on this platform. Values greater than 2^53 - 1 may lose precision when read."
  94563. );
  94564. typedArray = new Uint8Array(
  94565. bufferView.buffer,
  94566. bufferView.byteOffset,
  94567. length3 * 8
  94568. );
  94569. getFunction = function(index2) {
  94570. return getUint64NumberFallback(index2, that);
  94571. };
  94572. } else if (!FeatureDetection_default.supportsBigUint64Array()) {
  94573. typedArray = new Uint8Array(
  94574. bufferView.buffer,
  94575. bufferView.byteOffset,
  94576. length3 * 8
  94577. );
  94578. getFunction = function(index2) {
  94579. return getUint64BigIntFallback(index2, that);
  94580. };
  94581. } else {
  94582. typedArray = new BigUint64Array(
  94583. bufferView.buffer,
  94584. bufferView.byteOffset,
  94585. length3
  94586. );
  94587. setFunction = function(index2, value) {
  94588. that.typedArray[index2] = BigInt(value);
  94589. };
  94590. }
  94591. } else {
  94592. const componentDatatype = getComponentDatatype(componentType);
  94593. typedArray = ComponentDatatype_default.createArrayBufferView(
  94594. componentDatatype,
  94595. bufferView.buffer,
  94596. bufferView.byteOffset,
  94597. length3
  94598. );
  94599. setFunction = function(index2, value) {
  94600. that.typedArray[index2] = value;
  94601. };
  94602. }
  94603. if (!defined_default(getFunction)) {
  94604. getFunction = function(index2) {
  94605. return that.typedArray[index2];
  94606. };
  94607. }
  94608. this.typedArray = typedArray;
  94609. this.dataView = new DataView(typedArray.buffer, typedArray.byteOffset);
  94610. this.get = getFunction;
  94611. this.set = setFunction;
  94612. this._componentType = componentType;
  94613. }
  94614. var MetadataTableProperty_default = MetadataTableProperty;
  94615. // node_modules/cesium/Source/Scene/MetadataTable.js
  94616. function MetadataTable(options) {
  94617. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  94618. const count = options.count;
  94619. const metadataClass = options.class;
  94620. Check_default.typeOf.number.greaterThan("options.count", count, 0);
  94621. Check_default.typeOf.object("options.class", metadataClass);
  94622. const properties = {};
  94623. if (defined_default(options.properties)) {
  94624. for (const propertyId in options.properties) {
  94625. if (options.properties.hasOwnProperty(propertyId)) {
  94626. properties[propertyId] = new MetadataTableProperty_default({
  94627. count,
  94628. property: options.properties[propertyId],
  94629. classProperty: metadataClass.properties[propertyId],
  94630. bufferViews: options.bufferViews
  94631. });
  94632. }
  94633. }
  94634. }
  94635. this._count = count;
  94636. this._class = metadataClass;
  94637. this._properties = properties;
  94638. }
  94639. Object.defineProperties(MetadataTable.prototype, {
  94640. count: {
  94641. get: function() {
  94642. return this._count;
  94643. }
  94644. },
  94645. class: {
  94646. get: function() {
  94647. return this._class;
  94648. }
  94649. }
  94650. });
  94651. MetadataTable.prototype.hasProperty = function(propertyId) {
  94652. return MetadataEntity_default.hasProperty(propertyId, this._properties, this._class);
  94653. };
  94654. MetadataTable.prototype.hasPropertyBySemantic = function(semantic) {
  94655. return MetadataEntity_default.hasPropertyBySemantic(
  94656. semantic,
  94657. this._properties,
  94658. this._class
  94659. );
  94660. };
  94661. MetadataTable.prototype.getPropertyIds = function(results) {
  94662. return MetadataEntity_default.getPropertyIds(this._properties, this._class, results);
  94663. };
  94664. MetadataTable.prototype.getProperty = function(index2, propertyId) {
  94665. Check_default.typeOf.string("propertyId", propertyId);
  94666. const property = this._properties[propertyId];
  94667. let value;
  94668. if (defined_default(property)) {
  94669. value = property.get(index2);
  94670. } else {
  94671. value = getDefault(this._class, propertyId);
  94672. }
  94673. return value;
  94674. };
  94675. MetadataTable.prototype.setProperty = function(index2, propertyId, value) {
  94676. Check_default.typeOf.string("propertyId", propertyId);
  94677. const property = this._properties[propertyId];
  94678. if (defined_default(property)) {
  94679. property.set(index2, value);
  94680. return true;
  94681. }
  94682. return false;
  94683. };
  94684. MetadataTable.prototype.getPropertyBySemantic = function(index2, semantic) {
  94685. Check_default.typeOf.string("semantic", semantic);
  94686. let property;
  94687. const propertiesBySemantic = this._class.propertiesBySemantic;
  94688. if (defined_default(propertiesBySemantic)) {
  94689. property = propertiesBySemantic[semantic];
  94690. }
  94691. if (defined_default(property)) {
  94692. return this.getProperty(index2, property.id);
  94693. }
  94694. return void 0;
  94695. };
  94696. MetadataTable.prototype.setPropertyBySemantic = function(index2, semantic, value) {
  94697. Check_default.typeOf.string("semantic", semantic);
  94698. let property;
  94699. const propertiesBySemantic = this._class.propertiesBySemantic;
  94700. if (defined_default(propertiesBySemantic)) {
  94701. property = propertiesBySemantic[semantic];
  94702. }
  94703. if (defined_default(property)) {
  94704. return this.setProperty(index2, property.id, value);
  94705. }
  94706. return false;
  94707. };
  94708. MetadataTable.prototype.getPropertyTypedArray = function(propertyId) {
  94709. Check_default.typeOf.string("propertyId", propertyId);
  94710. const property = this._properties[propertyId];
  94711. if (defined_default(property)) {
  94712. return property.getTypedArray();
  94713. }
  94714. return void 0;
  94715. };
  94716. MetadataTable.prototype.getPropertyTypedArrayBySemantic = function(semantic) {
  94717. Check_default.typeOf.string("semantic", semantic);
  94718. let property;
  94719. const propertiesBySemantic = this._class.propertiesBySemantic;
  94720. if (defined_default(propertiesBySemantic)) {
  94721. property = propertiesBySemantic[semantic];
  94722. }
  94723. if (defined_default(property)) {
  94724. return this.getPropertyTypedArray(property.id);
  94725. }
  94726. return void 0;
  94727. };
  94728. function getDefault(classDefinition, propertyId) {
  94729. const classProperties = classDefinition.properties;
  94730. if (!defined_default(classProperties)) {
  94731. return void 0;
  94732. }
  94733. const classProperty = classProperties[propertyId];
  94734. if (defined_default(classProperty) && defined_default(classProperty.default)) {
  94735. let value = classProperty.default;
  94736. if (classProperty.isArray) {
  94737. value = clone_default(value, true);
  94738. }
  94739. value = classProperty.normalize(value);
  94740. return classProperty.unpackVectorAndMatrixTypes(value);
  94741. }
  94742. }
  94743. var MetadataTable_default = MetadataTable;
  94744. // node_modules/cesium/Source/Scene/ResourceLoader.js
  94745. function ResourceLoader() {
  94746. }
  94747. Object.defineProperties(ResourceLoader.prototype, {
  94748. promise: {
  94749. get: function() {
  94750. DeveloperError_default.throwInstantiationError();
  94751. }
  94752. },
  94753. cacheKey: {
  94754. get: function() {
  94755. DeveloperError_default.throwInstantiationError();
  94756. }
  94757. }
  94758. });
  94759. ResourceLoader.prototype.load = function() {
  94760. DeveloperError_default.throwInstantiationError();
  94761. };
  94762. ResourceLoader.prototype.unload = function() {
  94763. };
  94764. ResourceLoader.prototype.process = function(frameState) {
  94765. };
  94766. ResourceLoader.prototype.getError = function(errorMessage, error) {
  94767. Check_default.typeOf.string("errorMessage", errorMessage);
  94768. if (defined_default(error)) {
  94769. errorMessage += `
  94770. ${error.message}`;
  94771. }
  94772. return new RuntimeError_default(errorMessage);
  94773. };
  94774. ResourceLoader.prototype.isDestroyed = function() {
  94775. return false;
  94776. };
  94777. ResourceLoader.prototype.destroy = function() {
  94778. this.unload();
  94779. return destroyObject_default(this);
  94780. };
  94781. // node_modules/cesium/Source/Scene/ResourceLoaderState.js
  94782. var ResourceLoaderState = {
  94783. UNLOADED: 0,
  94784. LOADING: 1,
  94785. PROCESSING: 2,
  94786. READY: 3,
  94787. FAILED: 4
  94788. };
  94789. var ResourceLoaderState_default = Object.freeze(ResourceLoaderState);
  94790. // node_modules/cesium/Source/Scene/BufferLoader.js
  94791. function BufferLoader(options) {
  94792. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  94793. const typedArray = options.typedArray;
  94794. const resource = options.resource;
  94795. const cacheKey = options.cacheKey;
  94796. if (defined_default(typedArray) === defined_default(resource)) {
  94797. throw new DeveloperError_default(
  94798. "One of options.typedArray and options.resource must be defined."
  94799. );
  94800. }
  94801. this._typedArray = typedArray;
  94802. this._resource = resource;
  94803. this._cacheKey = cacheKey;
  94804. this._state = ResourceLoaderState_default.UNLOADED;
  94805. this._promise = defer_default();
  94806. }
  94807. if (defined_default(Object.create)) {
  94808. BufferLoader.prototype = Object.create(ResourceLoader.prototype);
  94809. BufferLoader.prototype.constructor = BufferLoader;
  94810. }
  94811. Object.defineProperties(BufferLoader.prototype, {
  94812. promise: {
  94813. get: function() {
  94814. return this._promise.promise;
  94815. }
  94816. },
  94817. cacheKey: {
  94818. get: function() {
  94819. return this._cacheKey;
  94820. }
  94821. },
  94822. typedArray: {
  94823. get: function() {
  94824. return this._typedArray;
  94825. }
  94826. }
  94827. });
  94828. BufferLoader.prototype.load = function() {
  94829. if (defined_default(this._typedArray)) {
  94830. this._promise.resolve(this);
  94831. return;
  94832. }
  94833. loadExternalBuffer(this);
  94834. };
  94835. function loadExternalBuffer(bufferLoader) {
  94836. const resource = bufferLoader._resource;
  94837. bufferLoader._state = ResourceLoaderState_default.LOADING;
  94838. BufferLoader._fetchArrayBuffer(resource).then(function(arrayBuffer) {
  94839. if (bufferLoader.isDestroyed()) {
  94840. return;
  94841. }
  94842. bufferLoader._typedArray = new Uint8Array(arrayBuffer);
  94843. bufferLoader._state = ResourceLoaderState_default.READY;
  94844. bufferLoader._promise.resolve(bufferLoader);
  94845. }).catch(function(error) {
  94846. if (bufferLoader.isDestroyed()) {
  94847. return;
  94848. }
  94849. bufferLoader._state = ResourceLoaderState_default.FAILED;
  94850. const errorMessage = `Failed to load external buffer: ${resource.url}`;
  94851. bufferLoader._promise.reject(bufferLoader.getError(errorMessage, error));
  94852. });
  94853. }
  94854. BufferLoader._fetchArrayBuffer = function(resource) {
  94855. return resource.fetchArrayBuffer();
  94856. };
  94857. BufferLoader.prototype.unload = function() {
  94858. this._typedArray = void 0;
  94859. };
  94860. // node_modules/cesium/Source/ThirdParty/meshoptimizer.js
  94861. (function() {
  94862. var wasm = "B9h79tEBBBENQ9gEUEU9gEUB9gBB9gVUUUUUEU9gDUUEU9gLUUUUEU9gIUUUEU9gVUUUUUB9gLUUUUB9gD99UE99Ie8aDILEVOLEVLRRRRRWWVBOOBEdddLVE9wEIIVIEBEOWEUEC+Q/KEKR/QIhO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9fw9u9j9v9kw9WwvTw949C919m9mwvBE8f9tw79o9v9wT9fw9u9j9v9kw9WwvTw949C919m9mwv9C9v919u9kBDe9tw79o9v9wT9fw9u9j9v9kw9WwvTw949Wwv79p9v9uBIy9tw79o9v9wT9fw9u9j9v9kw69u9kw949C919m9mwvBL8e9tw79o9v9wT9fw9u9j9v9kw69u9kw949C919m9mwv9C9v919u9kBO8a9tw79o9v9wT9fw9u9j9v9kw69u9kw949Wwv79p9v9uBRe9tw79o9v9wT9fw9u9j9v9kw69u9kw949Twg91w9u9jwBWA9tw79o9v9wT9fw9u9j9v9kw69u9kw949Twg91w9u9jw9C9v919u9kBdl9tw79o9v9wT9fw9u9j9v9kws9p2Twv9P9jTBQk9tw79o9v9wT9fw9u9j9v9kws9p2Twv9R919hTBKl9tw79o9v9wT9fw9u9j9v9kws9p2Twvt949wBXe9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94j9h9j9owBSA9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94j9h9j9ow9TTv9p9wBZA9tw79o9v9wT9f9v9wT9p9t9p96w9WwvTw94swT9j9o9Sw9t9h9wBhL79iv9rBodWEBCEKDqxQ+f9Q8aDBK/EpE8jU8jJJJJBCJO9rGV8kJJJJBCBHODNALCEFAE0MBABCBrBJ+KJJBC+gEv86BBAVCJDFCBCJDZnJJJB8aDNAItMBAVCJDFADALZ+TJJJB8aKABAEFHRABCEFHEAVALFCBCBCJDAL9rALCfE0eZnJJJB8aAVAVCJDFALZ+TJJJBHWCJ/ABAL9uHODNAItMBAOC/wfBgGOCJDAOCJD6eHdCBHQINAWCJLFCBCJDZnJJJB8aAdAIAQ9rAQAdFAI6eHKADAQAL2FHXDNALtMBAKCSFGOC9wgHMAOCL4CIFCD4HpCBHSAXHZAEHhINDNAKtMBAWASFrBBHoCBHEAZHOINAWCJLFAEFAOrBBGaAo9rGoCETAoCkTCk91CR4786BBAOALFHOAaHoAECEFGEAK9HMBKKDNARAh9rAp6MBAhCBApZnJJJBGcApFHEDNAMtMBCBHxAWCJLFHqINARAE9rCk6MDAWCJLFAxFGlrBDHoCUHODNAlrBEGaAlrBBGkvCfEgMBCBHaAoCfEgMBCBHoDNAlrBIMBAlrBLMBAlrBVMBAlrBOMBAlrBRMBAlrBWMBAlrBdMBAlrBQMBAlrBKMBAlrBXMBAlrBMMBCBHaAlrBpMECBHoCUCBAlrBSeHOKCBHaKDNDNDNDNCLCDCECWAOCZ6GheAkCfEgGkCD0CLvAaCfEgGaCD0FAoCfEgGoCD0FAlrBIGyCD0FAlrBLG8aCD0FAlrBVGeCD0FAlrBOG3CD0FAlrBRG5CD0FAlrBWG8eCD0FAlrBdG8fCD0FAlrBQGACD0FAlrBKGHCD0FAlrBXGGCD0FAlrBMG8jCD0FAlrBpG8kCD0FAlrBSG8lCD0FG8mAOCZAheG8n6GOeAkCp0CWvAaCp0FAoCp0FAyCp0FA8aCp0FAeCp0FA3Cp0FA5Cp0FA8eCp0FA8fCp0FAACp0FAHCp0FAGCp0FA8jCp0FA8kCp0FA8lCp0FA8mA8nAOe6GoeGyCUFpDIEBKAcAxCO4FGaAarBBCDCIAoeAxCI4COgTv86BBAyCW9HMEAEAl8pBB83BBAECWFAlCWF8pBB83BBAECZFHEXDKAcAxCO4FGaAarBBCEAxCI4COgTv86BBKCDCLCWCEAheAOeAoeH8aCUAyTCU7HaCBH5AqHeINAEH3A8aHoAeHECBHOINAErBBGhAaAhAaCfEgGk6eAOCfEgAyTvHOAECEFHEAoCUFGoMBKA3AO86BBAeA8aFHeA3CEFHEA5A8aFG5CZ6MBKDNAlrBBGOAk6MBA3AO86BEA3CDFHEKDNAlrBEGOAk6MBAEAO86BBAECEFHEKDNAlrBDGOAk6MBAEAO86BBAECEFHEKDNAlrBIGOAk6MBAEAO86BBAECEFHEKDNAlrBLGOAk6MBAEAO86BBAECEFHEKDNAlrBVGOAk6MBAEAO86BBAECEFHEKDNAlrBOGOAk6MBAEAO86BBAECEFHEKDNAlrBRGOAk6MBAEAO86BBAECEFHEKDNAlrBWGOAk6MBAEAO86BBAECEFHEKDNAlrBdGOAk6MBAEAO86BBAECEFHEKDNAlrBQGOAk6MBAEAO86BBAECEFHEKDNAlrBKGOAk6MBAEAO86BBAECEFHEKDNAlrBXGOAk6MBAEAO86BBAECEFHEKDNAlrBMGOAk6MBAEAO86BBAECEFHEKDNAlrBpGOAk6MBAEAO86BBAECEFHEKAlrBSGOAk6MBAEAO86BBAECEFHEKAqCZFHqAxCZFGxAM6MBKKAEtMBAZCEFHZAEHhASCEFGSALsMDXEKKCBHOXIKAWAXAKCUFAL2FALZ+TJJJB8aAKAQFGQAI6MBKKCBHOARAE9rCAALALCA6e6MBDNALC8f0MBAECBCAAL9rGOZnJJJBAOFHEKAEAWCJDFALZ+TJJJBALFAB9rHOKAVCJOF8kJJJJBAOK9HEEUAECAAECA0eABCJ/ABAE9uC/wfBgGDCJDADCJD6eGDFCUFAD9uAE2ADCL4CIFCD4ADv2FCEFKMBCBABbDJ+KJJBK/pSEeU8jJJJJBC/AE9rGL8kJJJJBCBHVDNAICI9uGOChFAE0MBABCBYD+E+KJJBGRC/gEv86BBALC/ABFCfECJEZnJJJB8aALCuFGW9CU83IBALC8wFGd9CU83IBALCYFGQ9CU83IBALCAFGK9CU83IBALCkFGX9CU83IBALCZFGM9CU83IBAL9CU83IWAL9CU83IBABAEFC9wFGpABCEFGSAOFGE6HODNAItMBCMCSARCB9KeHZCBHhCBHoCBHaCBHcCBHxINDNAOCEgtMBCBHVXIKCDHqADAaCDTFGOYDBHlAOCWFYDBHkAOCLFYDBHyCBH8aCBHODNDNDNDNDNDNDNDNDNINALC/ABFAOCU7AxFCSgCITFGVYDLHeDNAVYDBGVAl9HMBAeAy9HMBAqC9+FHqXDKDNAVAy9HMBAeAk9HMBAqCUFHqXDKDNAVAk9HMBAeAlsMDKAqCLFHqA8aCZFH8aAOCEFGOCZ9HMBXDKKAqC870MBADAqCIgCX2GVC+E1JJBFYDBAaFCDTFYDBHqADAVCJ1JJBFYDBAaFCDTFYDBHyALADAVC11JJBFYDBAaFCDTFYDBGVAcZ+FJJJBGeCBCSAVAhsGkeAeCB9KAeAZ9IgGleHeAkAlCE7gHkDNARCE9IMBAeCS9HMBAVAVAoAVCEFAosGeeGoCEFsMDCMCSAeeHeKASAeA8av86BBAeCS9HMDAVAo9rGOCETAOC8f917HOINAEAOCfB0CRTAOCfBgv86BBAECEFHEAOCR4GOMBKAVHoXIKADCEAkAhsCETAyAhseCX2GOC11JJBFYDBAaFCDTFYDBHqADAOC+E1JJBFYDBAaFCDTFYDBHeADAOCJ1JJBFYDBAaFCDTFYDBHVCBHlDNARCE9IMBAhtMBAVMBAeCE9HMBAqCD9HMBAW9CU83IBAd9CU83IBAQ9CU83IBAK9CU83IBAX9CU83IBAM9CU83IBAL9CU83IWAL9CU83IBCBHhCEHlKAhAVAhsGOFH8aALAeAcZ+FJJJBHyALAqAcZ+FJJJBHkAyCM0MLAyCEFHyXVKCpHeASAOCLTCpv86BBAVHoKAetMBAeAZ9IMEKALAcCDTFAVbDBAcCEFCSgHcKAhAkFHhALC/ABFAxCITFGOAqbDLAOAVbDBALC/ABFAxCEFCSgGOCITFGeAVbDLAeAybDBAOCEFHVXDKCBCSAeA8asG3eHyA8aA3FH8aKDNDNAkCM0MBAkCEFHkXEKCBCSAqA8asG3eHkA8aA3FH8aKDNDNDNDNDNDNDNDNDNDNDNDNDNDNDNDNDNAkAyCLTvG3CfEgG5C+qUFp9UISSSSSSSSSSSSSSWSLQMSSSSSSSSSSSSESVSSSSSSSSSSSSSRDSdSSSSSSSSSSSSSSKSSSSSSSSSSSSSSSSOBKC/wEH8eA5pDMKpKC/xEH8eXXKC/yEH8eXKKC/zEH8eXQKC/0EH8eXdKC/1EH8eXWKC/2EH8eXRKC/3EH8eXOKC/4EH8eXVKC/5EH8eXLKC/6EH8eXIKC/7EH8eXDKC/8EH8eXEKCPEH8eKAlAVAh9HvMBASA8e86BBXEKASC9+CUAOe86BBAEA386BBAECEFHEKDNAOMBAVAo9rGOCETAOC8f917HOINAEAOCfB0CRTAOCfBgv86BBAECEFHEAOCR4GOMBKAVHoKDNAyCS9HMBAeAo9rGOCETAOC8f917HOINAEAOCfB0CRTAOCfBgv86BBAECEFHEAOCR4GOMBKAeHoKDNAkCS9HMBAqAo9rGOCETAOC8f917HOINAEAOCfB0CRTAOCfBgv86BBAECEFHEAOCR4GOMBKAqHoKALAcCDTFAVbDBAcCEFCSgHODNDNAypZBEEEEEEEEEEEEEEBEKALAOCDTFAebDBAcCDFCSgHOKDNDNAkpZBEEEEEEEEEEEEEEBEKALAOCDTFAqbDBAOCEFCSgHOKALC/ABFAxCITFGyAVbDLAyAebDBALC/ABFAxCEFCSgCITFGyAebDLAyAqbDBALC/ABFAxCDFCSgCITFGeAqbDLAeAVbDBAxCIFHVAOHcA8aHhKApAE6HOASCEFHSAVCSgHxAaCIFGaAI6MBKKCBHVAOMBAE9C/lm+i/D+Z+g8a83BWAE9CJ/s+d+0/1+M/e/U+GU83BBAEAB9rCZFHVKALC/AEF8kJJJJBAVK+mIEEUCBHIDNABADCUFCSgCDTFYDBAEsMBCEHIABADCpFCSgCDTFYDBAEsMBCDHIABADCMFCSgCDTFYDBAEsMBCIHIABADCXFCSgCDTFYDBAEsMBCLHIABADCKFCSgCDTFYDBAEsMBCVHIABADCQFCSgCDTFYDBAEsMBCOHIABADCdFCSgCDTFYDBAEsMBCRHIABADCWFCSgCDTFYDBAEsMBCWHIABADCRFCSgCDTFYDBAEsMBCdHIABADCOFCSgCDTFYDBAEsMBCQHIABADCVFCSgCDTFYDBAEsMBCKHIABADCLFCSgCDTFYDBAEsMBCXHIABADCIFCSgCDTFYDBAEsMBCMHIABADCDFCSgCDTFYDBAEsMBCpHIABADCEFCSgCDTFYDBAEsMBCSCUABADCSgCDTFYDBAEseSKAIKjEIUCRHDDNINADCEFHIADC96FGLC8f0MEAIHDCEALTAE6MBKKAICR9uCI2CDFABCI9u2ChFKMBCBABbD+E+KJJBK+YDERU8jJJJJBCZ9rHLCBHVDNAICVFAE0MBCBHVABCBrB+E+KJJBC/QEv86BBAL9CB83IWABCEFHOABAEFC98FHRDNAItMBCBHWINDNARAO0MBCBSKAVADAWCDTFYDBGdALCWFAVCDTFYDB9rGEAEC8f91GEFAE7C59K7GVAdALCWFAVCDTFGQYDB9rGEC8f91CETAECDT7vHEINAOAECfB0CRTAECfBgv86BBAOCEFHOAECR4GEMBKAQAdbDBAWCEFGWAI9HMBKKCBHVARAO6MBAOCBbBBAOAB9rCLFHVKAVK86EIUCWHDDNINADCEFHIADC95FGLC8f0MEAIHDCEALTAE6MBKKAICR9uAB2CVFK+yWDEUO99DNAEtMBADCLsHVCUADCETCUFTCU7HDDNDNCUAICUFTCU7+yGOjBBBzmGR+LjBBB9P9dtMBAR+oHIXEKCJJJJ94HIKAD+yHWDNAVMBABCOFHDINALCLFiDBGRjBBBBjBBJzALiDBGd+LAR+LmALCWFiDBGQ+LmGR+VARjBBBB9beGRnHKAdARnHRALCXFiDBHdDNDNAQjBBBB9gtMBAKHQXEKjBBJzAR+L+TGQAQ+MAKjBBBB9geHQjBBJzAK+L+TGKAK+MARjBBBB9geHRKADC9+FAI87EBDNDNjBBBzjBBB+/AdjBBBB9geAdjBBJ+/AdjBBJ+/9geGdjBBJzAdjBBJz9feAWnmGd+LjBBB9P9dtMBAd+oHBXEKCJJJJ94HBKADAB87EBDNDNjBBBzjBBB+/AQjBBBB9geAQjBBJ+/AQjBBJ+/9geGdjBBJzAdjBBJz9feAOnmGd+LjBBB9P9dtMBAd+oHBXEKCJJJJ94HBKADC98FAB87EBDNDNjBBBzjBBB+/ARjBBBB9geARjBBJ+/ARjBBJ+/9geGRjBBJzARjBBJz9feAOnmGR+LjBBB9P9dtMBAR+oHBXEKCJJJJ94HBKADC96FAB87EBALCZFHLADCWFHDAECUFGEMBXDKKABCIFHDINALCLFiDBGRjBBBBjBBJzALiDBGd+LAR+LmALCWFiDBGQ+LmGR+VARjBBBB9beGRnHKAdARnHRALCXFiDBHdDNDNAQjBBBB9gtMBAKHQXEKjBBJzAR+L+TGQAQ+MAKjBBBB9geHQjBBJzAK+L+TGKAK+MARjBBBB9geHRKADCUFAI86BBDNDNjBBBzjBBB+/AdjBBBB9geAdjBBJ+/AdjBBJ+/9geGdjBBJzAdjBBJz9feAWnmGd+LjBBB9P9dtMBAd+oHBXEKCJJJJ94HBKADAB86BBDNDNjBBBzjBBB+/AQjBBBB9geAQjBBJ+/AQjBBJ+/9geGdjBBJzAdjBBJz9feAOnmGd+LjBBB9P9dtMBAd+oHBXEKCJJJJ94HBKADC9+FAB86BBDNDNjBBBzjBBB+/ARjBBBB9geARjBBJ+/ARjBBJ+/9geGRjBBJzARjBBJz9feAOnmGR+LjBBB9P9dtMBAR+oHBXEKCJJJJ94HBKADC99FAB86BBALCZFHLADCLFHDAECUFGEMBKKK/KLLD99EUE99EUDNAEtMBDNDNCUAICUFTCU7+yGVjBBBzmGO+LjBBB9P9dtMBAO+oHIXEKCJJJJ94HIKAIC/8fIgHRINABCOFCICDALCLFiDB+LALiDB+L9eGIALCWFiDB+LALAICDTFiDB+L9eeGIALCXFiDB+LALAICDTFiDB+L9eeGIARv87EBDNDNjBBBzjBBB+/ALAICEFCIgCDTFiDBj/zL+1znjBBJ+/jBBJzALAICDTFiDBjBBBB9deGOnGWjBBBB9geAWjBBJ+/AWjBBJ+/9geGWjBBJzAWjBBJz9feAVnmGW+LjBBB9P9dtMBAW+oHdXEKCJJJJ94HdKABAd87EBDNDNjBBBzjBBB+/AOALAICDFCIgCDTFiDBj/zL+1znnGWjBBBB9geAWjBBJ+/AWjBBJ+/9geGWjBBJzAWjBBJz9feAVnmGW+LjBBB9P9dtMBAW+oHdXEKCJJJJ94HdKABCDFAd87EBDNDNjBBBzjBBB+/AOALAICUFCIgCDTFiDBj/zL+1znnGOjBBBB9geAOjBBJ+/AOjBBJ+/9geGOjBBJzAOjBBJz9feAVnmGO+LjBBB9P9dtMBAO+oHIXEKCJJJJ94HIKABCLFAI87EBABCWFHBALCZFHLAECUFGEMBKKK+tDDWUE998jJJJJBCZ9rGV8kJJJJBDNAEtMBADCD4GOtMBCEAI9rHRAOCDTHWCBHdINC+cUHDALHIAOHQINAIiDBAVCXFZ+YJJJB8aAVYDXGKADADAK9IeHDAICLFHIAQCUFGQMBKARADFGICkTHKCBHDCBAI9rHXAOHIINDNDNALADFiDBGMAXZ+XJJJBjBBBzjBBB+/AMjBBBB9gemGM+LjBBB9P9dtMBAM+oHQXEKCJJJJ94HQKABADFAQCfffRgAKvbDBADCLFHDAICUFGIMBKABAWFHBALAWFHLAdCEFGdAE9HMBKKAVCZF8kJJJJBK+iMDlUI998jJJJJBC+QD9rGV8kJJJJBAVC+oEFCBC/kBZnJJJB8aCBHODNADtMBCBHOAItMBDNABAE9HMBAVCUADCDTGRADCffffI0eCBYD/4+JJJBhJJJJBBGEbD+oEAVCEbD1DAEABARZ+TJJJB8aKAVC+YEFCWFCBbDBAV9CB83I+YEAVC+YEFAEADAIAVC+oEFZ+OJJJBCUAICDTGWAICffffI0eGdCBYD/4+JJJBhJJJJBBHRAVC+oEFAVYD1DGOCDTFARbDBAVAOCEFGQbD1DARAVYD+YEGKAWZ+TJJJBHXAVC+oEFAQCDTFADCI9uGMCBYD/4+JJJBhJJJJBBGRbDBAVAOCDFGWbD1DARCBAMZnJJJBHpAVC+oEFAWCDTFAdCBYD/4+JJJBhJJJJBBGSbDBAVAOCIFGQbD1DAXHRASHWINAWALiDBALARYDBGdCWAdCW6eCDTFC/EBFiDBmuDBARCLFHRAWCLFHWAICUFGIMBKCBHIAVC+oEFAQCDTFCUAMCDTADCffff970eCBYD/4+JJJBhJJJJBBGQbDBAVAOCLFGObD1DDNADCI6MBAEHRAQHWINAWASARYDBCDTFiDBASARCLFYDBCDTFiDBmASARCWFYDBCDTFiDBmuDBARCXFHRAWCLFHWAICEFGIAM6MBKKAVC/MBFHZAVYD+cEHhAVYD+gEHoAVHRCBHdCBHWCBHaCEHcINARHxAEAWCX2FGqCWFGlYDBHDAqYDBHkABAaCX2FGRCLFAqCLFGyYDBG8abDBARAkbDBARCWFADbDBApAWFCE86BBAZADbDWAZA8abDLAZAkbDBAQAWCDTFCBbDBCIHeDNAdtMBAxHRINDNARYDBGIADsMBAIAksMBAIA8asMBAZAeCDTFAIbDBAeCEFHeKARCLFHRAdCUFGdMBKKAXAkCDTFGRARYDBCUFbDBAXA8aCDTFGRARYDBCUFbDBAXADCDTFGRARYDBCUFbDBAoAhAqYDBCDTGIFYDBCDTFGkHRAKAIFGDYDBGdHIDNAdtMBDNINARYDBAWsMEARCLFHRAICUFGItMDXBKKARAdCDTAkFC98FYDBbDBADADYDBCUFbDBKAoAhAyYDBCDTGIFYDBCDTFGkHRAKAIFGDYDBGdHIDNAdtMBDNINARYDBAWsMEARCLFHRAICUFGIMBXDKKARAdCDTAkFC98FYDBbDBADADYDBCUFbDBKDNAKAlYDBCDTGRFGDYDBGdtMBAoAhARFYDBCDTFGkHRAdHIDNINARYDBAWsMEARCLFHRAICUFGIMBXDKKARAdCDTAkFC98FYDBbDBADADYDBCUFbDBKDNDNAetMBCUHWjBBBBH3CBHRINASAZARCDTFYDBCDTGIFGdiDBH5AdALCBARCEFGkARCS0eCDTFiDBALAXAIFYDBGRCWARCW6eCDTFC/EBFiDBmG8euDBDNAKAIFYDBGdtMBA8eA5+TH8eAoAhAIFYDBCDTFHRAdCDTHIINAQARYDBGdCDTFGDA8eADiDBmG5uDBA5A3A3A59dGDeH3AdAWADeHWARCLFHRAIC98FGIMBKKAkHRAkAe9HMBKAWCU9HMEKAcAM9PMDINDNApAcFrBBMBAcHWXDKAMAcCEFGc9HMBXIKKAaCEFHaAeCZAeCZ6eHdAZHRAxHZAWCU9HMBKKAOCDTAVC+oEFFC98FHRDNINAOtMEARYDBCBYD/0+JJJBh+BJJJBBARC98FHRAOCUFHOXBKKAVC+QDF8kJJJJBK/iLEVUCUAICDTGVAICffffI0eGOCBYD/4+JJJBhJJJJBBHRALALYD9gGWCDTFARbDBALAWCEFbD9gABARbDBAOCBYD/4+JJJBhJJJJBBHRALALYD9gGOCDTFARbDBALAOCEFbD9gABARbDLCUADCDTADCffffI0eCBYD/4+JJJBhJJJJBBHRALALYD9gGOCDTFARbDBALAOCEFbD9gABARbDWABYDBCBAVZnJJJB8aADCI9uHdDNADtMBABYDBHOAEHLADHRINAOALYDBCDTFGVAVYDBCEFbDBALCLFHLARCUFGRMBKKDNAItMBABYDBHLABYDLHRCBHVAIHOINARAVbDBARCLFHRALYDBAVFHVALCLFHLAOCUFGOMBKKDNADCI6MBABYDLHRABYDWHVCBHLINAECWFYDBHOAECLFYDBHDARAEYDBCDTFGWAWYDBGWCEFbDBAVAWCDTFALbDBARADCDTFGDADYDBGDCEFbDBAVADCDTFALbDBARAOCDTFGOAOYDBGOCEFbDBAVAOCDTFALbDBAECXFHEALCEFGLAd6MBKKDNAItMBABYDLHEABYDBHLINAEAEYDBALYDB9rbDBALCLFHLAECLFHEAICUFGIMBKKKqBABAEADAIC+k1JJBZ+NJJJBKqBABAEADAIC+M+JJJBZ+NJJJBK9dEEUABCfEAICDTZnJJJBHLCBHIDNADtMBINDNALAEYDBCDTFGBYDBCU9HMBABAIbDBAICEFHIKAECLFHEADCUFGDMBKKAIK9TEIUCBCBYD/8+JJJBGEABCIFC98gFGBbD/8+JJJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK/lEEEUDNDNAEABvCIgtMBABHIXEKDNDNADCZ9PMBABHIXEKABHIINAIAEYDBbDBAICLFAECLFYDBbDBAICWFAECWFYDBbDBAICXFAECXFYDBbDBAICZFHIAECZFHEADC9wFGDCS0MBKKADCL6MBINAIAEYDBbDBAECLFHEAICLFHIADC98FGDCI0MBKKDNADtMBINAIAErBB86BBAICEFHIAECEFHEADCUFGDMBKKABK/AEEDUDNDNABCIgtMBABHIXEKAECfEgC+B+C+EW2HLDNDNADCZ9PMBABHIXEKABHIINAIALbDBAICXFALbDBAICWFALbDBAICLFALbDBAICZFHIADC9wFGDCS0MBKKADCL6MBINAIALbDBAICLFHIADC98FGDCI0MBKKDNADtMBINAIAE86BBAICEFHIADCUFGDMBKKABK9TEIUCBCBYD/8+JJJBGEABCIFC98gFGBbD/8+JJJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK9+EIUzBHEDNDNCBYD/8+JJJBGDAECZTGI9NMBCUHEADAI9rCffIFCZ4NBCUsMEKADHEKCBABAE9rCIFC98gCBYD/8+JJJBFGDbD/8+JJJBDNADzBCZTGE9NMBADAE9rCffIFCZ4NB8aKKXBABAEZ+ZJJJBK+BEEIUDNAB+8GDCl4GICfEgGLCfEsMBDNALMBDNABjBBBB9cMBAECBbDBABSKABjBBJ9fnAEZ+YJJJBHBAEAEYDBCNFbDBABSKAEAICfEgC+CUFbDBADCfff+D94gCJJJ/4Iv++HBKABK+gEBDNDNAECJE9IMBABjBBBUnHBDNAECfE9OMBAEC+BUFHEXDKABjBBBUnHBAECPDAECPD9IeC+C9+FHEXEKAEC+BU9KMBABjBBJXnHBDNAEC+b9+9MMBAEC/mBFHEXEKABjBBJXnHBAEC+299AEC+2999KeC/MEFHEKABAEClTCJJJ/8IF++nKK+ODDBCJWK/0EBBBBEBBBDBBBEBBBDBBBBBBBDBBBBBBBEBBBBBBB+L29Hz/69+9Kz/n/76z/RG97z/Z/O9Xz8j/b85z/+/U9Yz/B/K9hz+2/z9dz9E+L9Mz59a8kz+R/t3z+a+Zyz79ohz/J4++8++y+d9v8+BBBB9S+49+z8r+Hbz9m9m/m8+l/Z/O8+/8+pg89Q/X+j878r+Hq8++m+b/E87BBBBBBJzBBJzBBJz+e/v/n8++y+dSz9I/h/68+XD/r8+/H0838+/w+nOzBBBB+wv9o8+UF888+9I/h/68+9C9g/l89/N/M9M89/d8kO8+BBBBF+8Tz9M836zs+2azl/Zpzz818ez9E+LXz/u98f8+819e/68+BC/0dKXEBBBDBBBZwBB";
  94863. var wasmpack = new Uint8Array([32, 0, 65, 2, 1, 106, 34, 33, 3, 128, 11, 4, 13, 64, 6, 253, 10, 7, 15, 116, 127, 5, 8, 12, 40, 16, 19, 54, 20, 9, 27, 255, 113, 17, 42, 67, 24, 23, 146, 148, 18, 14, 22, 45, 70, 69, 56, 114, 101, 21, 25, 63, 75, 136, 108, 28, 118, 29, 73, 115]);
  94864. if (typeof WebAssembly !== "object") {
  94865. return {
  94866. supported: false
  94867. };
  94868. }
  94869. var instance;
  94870. var promise = WebAssembly.instantiate(unpack(wasm), {}).then(function(result) {
  94871. instance = result.instance;
  94872. instance.exports.__wasm_call_ctors();
  94873. instance.exports.meshopt_encodeVertexVersion(0);
  94874. instance.exports.meshopt_encodeIndexVersion(1);
  94875. });
  94876. function unpack(data) {
  94877. var result = new Uint8Array(data.length);
  94878. for (var i2 = 0; i2 < data.length; ++i2) {
  94879. var ch = data.charCodeAt(i2);
  94880. result[i2] = ch > 96 ? ch - 71 : ch > 64 ? ch - 65 : ch > 47 ? ch + 4 : ch > 46 ? 63 : 62;
  94881. }
  94882. var write = 0;
  94883. for (var i2 = 0; i2 < data.length; ++i2) {
  94884. result[write++] = result[i2] < 60 ? wasmpack[result[i2]] : (result[i2] - 60) * 64 + result[++i2];
  94885. }
  94886. return result.buffer.slice(0, write);
  94887. }
  94888. function assert(cond) {
  94889. if (!cond) {
  94890. throw new Error("Assertion failed");
  94891. }
  94892. }
  94893. function reorder(indices2, vertices, optf) {
  94894. var sbrk = instance.exports.sbrk;
  94895. var ip = sbrk(indices2.length * 4);
  94896. var rp = sbrk(vertices * 4);
  94897. var heap = new Uint8Array(instance.exports.memory.buffer);
  94898. var indices8 = new Uint8Array(indices2.buffer, indices2.byteOffset, indices2.byteLength);
  94899. heap.set(indices8, ip);
  94900. if (optf) {
  94901. optf(ip, ip, indices2.length, vertices);
  94902. }
  94903. var unique = instance.exports.meshopt_optimizeVertexFetchRemap(rp, ip, indices2.length, vertices);
  94904. heap = new Uint8Array(instance.exports.memory.buffer);
  94905. var remap = new Uint32Array(vertices);
  94906. new Uint8Array(remap.buffer).set(heap.subarray(rp, rp + vertices * 4));
  94907. indices8.set(heap.subarray(ip, ip + indices2.length * 4));
  94908. sbrk(ip - sbrk(0));
  94909. for (var i2 = 0; i2 < indices2.length; ++i2)
  94910. indices2[i2] = remap[indices2[i2]];
  94911. return [remap, unique];
  94912. }
  94913. function encode(fun, bound, source, count, size) {
  94914. var sbrk = instance.exports.sbrk;
  94915. var tp = sbrk(bound);
  94916. var sp = sbrk(count * size);
  94917. var heap = new Uint8Array(instance.exports.memory.buffer);
  94918. heap.set(new Uint8Array(source.buffer, source.byteOffset, source.byteLength), sp);
  94919. var res = fun(tp, bound, sp, count, size);
  94920. var target = new Uint8Array(res);
  94921. target.set(heap.subarray(tp, tp + res));
  94922. sbrk(tp - sbrk(0));
  94923. return target;
  94924. }
  94925. function maxindex(source) {
  94926. var result = 0;
  94927. for (var i2 = 0; i2 < source.length; ++i2) {
  94928. var index2 = source[i2];
  94929. result = result < index2 ? index2 : result;
  94930. }
  94931. return result;
  94932. }
  94933. function index32(source, size) {
  94934. assert(size == 2 || size == 4);
  94935. if (size == 4) {
  94936. return new Uint32Array(source.buffer, source.byteOffset, source.byteLength / 4);
  94937. } else {
  94938. var view = new Uint16Array(source.buffer, source.byteOffset, source.byteLength / 2);
  94939. return new Uint32Array(view);
  94940. }
  94941. }
  94942. function filter(fun, source, count, stride, bits, insize) {
  94943. var sbrk = instance.exports.sbrk;
  94944. var tp = sbrk(count * stride);
  94945. var sp = sbrk(count * insize);
  94946. var heap = new Uint8Array(instance.exports.memory.buffer);
  94947. heap.set(new Uint8Array(source.buffer, source.byteOffset, source.byteLength), sp);
  94948. fun(tp, count, stride, bits, sp);
  94949. var target = new Uint8Array(count * stride);
  94950. target.set(heap.subarray(tp, tp + count * stride));
  94951. sbrk(tp - sbrk(0));
  94952. return target;
  94953. }
  94954. return {
  94955. ready: promise,
  94956. supported: true,
  94957. reorderMesh: function(indices2, triangles, optsize) {
  94958. var optf = triangles ? optsize ? instance.exports.meshopt_optimizeVertexCacheStrip : instance.exports.meshopt_optimizeVertexCache : void 0;
  94959. return reorder(indices2, maxindex(indices2) + 1, optf);
  94960. },
  94961. encodeVertexBuffer: function(source, count, size) {
  94962. assert(size > 0 && size <= 256);
  94963. assert(size % 4 == 0);
  94964. var bound = instance.exports.meshopt_encodeVertexBufferBound(count, size);
  94965. return encode(instance.exports.meshopt_encodeVertexBuffer, bound, source, count, size);
  94966. },
  94967. encodeIndexBuffer: function(source, count, size) {
  94968. assert(size == 2 || size == 4);
  94969. assert(count % 3 == 0);
  94970. var indices2 = index32(source, size);
  94971. var bound = instance.exports.meshopt_encodeIndexBufferBound(count, maxindex(indices2) + 1);
  94972. return encode(instance.exports.meshopt_encodeIndexBuffer, bound, indices2, count, 4);
  94973. },
  94974. encodeIndexSequence: function(source, count, size) {
  94975. assert(size == 2 || size == 4);
  94976. var indices2 = index32(source, size);
  94977. var bound = instance.exports.meshopt_encodeIndexSequenceBound(count, maxindex(indices2) + 1);
  94978. return encode(instance.exports.meshopt_encodeIndexSequence, bound, indices2, count, 4);
  94979. },
  94980. encodeGltfBuffer: function(source, count, size, mode2) {
  94981. var table2 = {
  94982. ATTRIBUTES: this.encodeVertexBuffer,
  94983. TRIANGLES: this.encodeIndexBuffer,
  94984. INDICES: this.encodeIndexSequence
  94985. };
  94986. assert(table2[mode2]);
  94987. return table2[mode2](source, count, size);
  94988. },
  94989. encodeFilterOct: function(source, count, stride, bits) {
  94990. assert(stride == 4 || stride == 8);
  94991. assert(bits >= 1 && bits <= 16);
  94992. return filter(instance.exports.meshopt_encodeFilterOct, source, count, stride, bits, 4);
  94993. },
  94994. encodeFilterQuat: function(source, count, stride, bits) {
  94995. assert(stride == 8);
  94996. assert(bits >= 4 && bits <= 16);
  94997. return filter(instance.exports.meshopt_encodeFilterQuat, source, count, stride, bits, 4);
  94998. },
  94999. encodeFilterExp: function(source, count, stride, bits) {
  95000. assert(stride > 0 && stride % 4 == 0);
  95001. assert(bits >= 1 && bits <= 24);
  95002. return filter(instance.exports.meshopt_encodeFilterExp, source, count, stride, bits, stride / 4);
  95003. }
  95004. };
  95005. })();
  95006. var MeshoptDecoder = function() {
  95007. var wasm_base = "B9h79tEBBBE8fV9gBB9gVUUUUUEU9gIUUUB9gEUEU9gIUUUEUIKQBEEEDDDILLLVE9wEEEVIEBEOWEUEC+Q/IEKR/LEdO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9f9kw9j9v9kw9WwvTw949C919m9mwvBEy9tw79o9v9wT9f9kw9j9v9kw69u9kw949C919m9mwvBDe9tw79o9v9wT9f9kw9j9v9kw69u9kw949Twg91w9u9jwBIl9tw79o9v9wT9f9kw9j9v9kws9p2Twv9P9jTBLk9tw79o9v9wT9f9kw9j9v9kws9p2Twv9R919hTBVl9tw79o9v9wT9f9kw9j9v9kws9p2Twvt949wBOL79iv9rBRQ+x8yQDBK/qMEZU8jJJJJBCJ/EB9rGV8kJJJJBC9+HODNADCEFAL0MBCUHOAIrBBC+gE9HMBAVAIALFGRAD9rADZ1JJJBHWCJ/ABAD9uC/wfBgGOCJDAOCJD6eHdAICEFHLCBHQDNINAQAE9PMEAdAEAQ9rAQAdFAE6eHKDNDNADtMBAKCSFGOC9wgHXAOCL4CIFCD4HMAWCJDFHpCBHSALHZINDNARAZ9rAM9PMBCBHLXIKAZAMFHLDNAXtMBCBHhCBHIINDNARAL9rCk9PMBCBHLXVKAWCJ/CBFAIFHODNDNDNDNDNAZAICO4FrBBAhCOg4CIgpLBEDIBKAO9CB83IBAOCWF9CB83IBXIKAOALrBLALrBBGoCO4GaAaCIsGae86BBAOCEFALCLFAaFGarBBAoCL4CIgGcAcCIsGce86BBAOCDFAaAcFGarBBAoCD4CIgGcAcCIsGce86BBAOCIFAaAcFGarBBAoCIgGoAoCIsGoe86BBAOCLFAaAoFGarBBALrBEGoCO4GcAcCIsGce86BBAOCVFAaAcFGarBBAoCL4CIgGcAcCIsGce86BBAOCOFAaAcFGarBBAoCD4CIgGcAcCIsGce86BBAOCRFAaAcFGarBBAoCIgGoAoCIsGoe86BBAOCWFAaAoFGarBBALrBDGoCO4GcAcCIsGce86BBAOCdFAaAcFGarBBAoCL4CIgGcAcCIsGce86BBAOCQFAaAcFGarBBAoCD4CIgGcAcCIsGce86BBAOCKFAaAcFGarBBAoCIgGoAoCIsGoe86BBAOCXFAaAoFGorBBALrBIGLCO4GaAaCIsGae86BBAOCMFAoAaFGorBBALCL4CIgGaAaCIsGae86BBAOCpFAoAaFGorBBALCD4CIgGaAaCIsGae86BBAOCSFAoAaFGOrBBALCIgGLALCIsGLe86BBAOALFHLXDKAOALrBWALrBBGoCL4GaAaCSsGae86BBAOCEFALCWFAaFGarBBAoCSgGoAoCSsGoe86BBAOCDFAaAoFGorBBALrBEGaCL4GcAcCSsGce86BBAOCIFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCLFAoAaFGorBBALrBDGaCL4GcAcCSsGce86BBAOCVFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCOFAoAaFGorBBALrBIGaCL4GcAcCSsGce86BBAOCRFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCWFAoAaFGorBBALrBLGaCL4GcAcCSsGce86BBAOCdFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCQFAoAaFGorBBALrBVGaCL4GcAcCSsGce86BBAOCKFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCXFAoAaFGorBBALrBOGaCL4GcAcCSsGce86BBAOCMFAoAcFGorBBAaCSgGaAaCSsGae86BBAOCpFAoAaFGorBBALrBRGLCL4GaAaCSsGae86BBAOCSFAoAaFGOrBBALCSgGLALCSsGLe86BBAOALFHLXEKAOAL8pBB83BBAOCWFALCWF8pBB83BBALCZFHLKAhCDFHhAICZFGIAX6MBKKDNALMBCBHLXIKDNAKtMBAWASFrBBHhCBHOApHIINAIAWCJ/CBFAOFrBBGZCE4CBAZCEg9r7AhFGh86BBAIADFHIAOCEFGOAK9HMBKKApCEFHpALHZASCEFGSAD9HMBKKABAQAD2FAWCJDFAKAD2Z1JJJB8aAWAWCJDFAKCUFAD2FADZ1JJJB8aKAKCBALeAQFHQALMBKC9+HOXEKCBC99ARAL9rADCAADCA0eseHOKAVCJ/EBF8kJJJJBAOK+OoEZU8jJJJJBC/AE9rGV8kJJJJBC9+HODNAECI9uGRChFAL0MBCUHOAIrBBGWC/wEgC/gE9HMBAWCSgGdCE0MBAVC/ABFCfECJEZ+JJJJB8aAVCuF9CU83IBAVC8wF9CU83IBAVCYF9CU83IBAVCAF9CU83IBAVCkF9CU83IBAVCZF9CU83IBAV9CU83IWAV9CU83IBAIALFC9wFHQAICEFGWARFHKDNAEtMBCMCSAdCEseHXABHICBHdCBHMCBHpCBHLCBHOINDNAKAQ9NMBC9+HOXIKDNDNAWrBBGRC/vE0MBAVC/ABFARCL4CU7AOFCSgCITFGSYDLHZASYDBHhDNARCSgGSAX9PMBAVARCU7ALFCSgCDTFYDBAdASeHRAStHSDNDNADCD9HMBABAh87EBABCLFAR87EBABCDFAZ87EBXEKAIAhbDBAICWFARbDBAICLFAZbDBKAdASFHdAVC/ABFAOCITFGoARbDBAoAZbDLAVALCDTFARbDBAVC/ABFAOCEFCSgGOCITFGZAhbDBAZARbDLALASFHLAOCEFHOXDKDNDNASCSsMBAMASFASC987FCEFHMXEKAK8sBBGSCfEgHRDNDNASCU9MMBAKCEFHKXEKAK8sBEGSCfBgCRTARCfBgvHRDNASCU9MMBAKCDFHKXEKAK8sBDGSCfBgCpTARvHRDNASCU9MMBAKCIFHKXEKAK8sBIGSCfBgCxTARvHRDNASCU9MMBAKCLFHKXEKAKrBLC3TARvHRAKCVFHKKARCE4CBARCEg9r7AMFHMKDNDNADCD9HMBABAh87EBABCLFAM87EBABCDFAZ87EBXEKAIAhbDBAICWFAMbDBAICLFAZbDBKAVC/ABFAOCITFGRAMbDBARAZbDLAVALCDTFAMbDBAVC/ABFAOCEFCSgGOCITFGRAhbDBARAMbDLALCEFHLAOCEFHOXEKDNARCPE0MBAVALAQARCSgFrBBGSCL4GZ9rCSgCDTFYDBAdCEFGhAZeHRAVALAS9rCSgCDTFYDBAhAZtGoFGhASCSgGZeHSAZtHZDNDNADCD9HMBABAd87EBABCLFAS87EBABCDFAR87EBXEKAIAdbDBAICWFASbDBAICLFARbDBKAVALCDTFAdbDBAVC/ABFAOCITFGaARbDBAaAdbDLAVALCEFGLCSgCDTFARbDBAVC/ABFAOCEFCSgCITFGaASbDBAaARbDLAVALAoFCSgGLCDTFASbDBAVC/ABFAOCDFCSgGOCITFGRAdbDBARASbDLAOCEFHOALAZFHLAhAZFHdXEKAdCBAKrBBGaeGZARC/+EsGcFHRAaCSgHhDNDNAaCL4GoMBARCEFHSXEKARHSAVALAo9rCSgCDTFYDBHRKDNDNAhMBASCEFHdXEKASHdAVALAa9rCSgCDTFYDBHSKDNDNActMBAKCEFHaXEKAK8sBEGaCfEgHZDNDNAaCU9MMBAKCDFHaXEKAK8sBDGaCfBgCRTAZCfBgvHZDNAaCU9MMBAKCIFHaXEKAK8sBIGaCfBgCpTAZvHZDNAaCU9MMBAKCLFHaXEKAK8sBLGaCfBgCxTAZvHZDNAaCU9MMBAKCVFHaXEKAKCOFHaAKrBVC3TAZvHZKAZCE4CBAZCEg9r7AMFGMHZKDNDNAoCSsMBAaHcXEKAa8sBBGKCfEgHRDNDNAKCU9MMBAaCEFHcXEKAa8sBEGKCfBgCRTARCfBgvHRDNAKCU9MMBAaCDFHcXEKAa8sBDGKCfBgCpTARvHRDNAKCU9MMBAaCIFHcXEKAa8sBIGKCfBgCxTARvHRDNAKCU9MMBAaCLFHcXEKAaCVFHcAarBLC3TARvHRKARCE4CBARCEg9r7AMFGMHRKDNDNAhCSsMBAcHKXEKAc8sBBGKCfEgHSDNDNAKCU9MMBAcCEFHKXEKAc8sBEGKCfBgCRTASCfBgvHSDNAKCU9MMBAcCDFHKXEKAc8sBDGKCfBgCpTASvHSDNAKCU9MMBAcCIFHKXEKAc8sBIGKCfBgCxTASvHSDNAKCU9MMBAcCLFHKXEKAcCVFHKAcrBLC3TASvHSKASCE4CBASCEg9r7AMFGMHSKDNDNADCD9HMBABAZ87EBABCLFAS87EBABCDFAR87EBXEKAIAZbDBAICWFASbDBAICLFARbDBKAVC/ABFAOCITFGaARbDBAaAZbDLAVALCDTFAZbDBAVC/ABFAOCEFCSgCITFGaASbDBAaARbDLAVALCEFGLCSgCDTFARbDBAVC/ABFAOCDFCSgCITFGRAZbDBARASbDLAVALAotAoCSsvFGLCSgCDTFASbDBALAhtAhCSsvFHLAOCIFHOKAWCEFHWABCOFHBAICXFHIAOCSgHOALCSgHLApCIFGpAE6MBKKCBC99AKAQseHOKAVC/AEF8kJJJJBAOK/tLEDU8jJJJJBCZ9rHVC9+HODNAECVFAL0MBCUHOAIrBBC/+EgC/QE9HMBAV9CB83IWAICEFHOAIALFC98FHIDNAEtMBDNADCDsMBINDNAOAI6MBC9+SKAO8sBBGDCfEgHLDNDNADCU9MMBAOCEFHOXEKAO8sBEGDCfBgCRTALCfBgvHLDNADCU9MMBAOCDFHOXEKAO8sBDGDCfBgCpTALvHLDNADCU9MMBAOCIFHOXEKAO8sBIGDCfBgCxTALvHLDNADCU9MMBAOCLFHOXEKAOrBLC3TALvHLAOCVFHOKAVCWFALCEgCDTvGDALCD4CBALCE4CEg9r7ADYDBFGLbDBABALbDBABCLFHBAECUFGEMBXDKKINDNAOAI6MBC9+SKAO8sBBGDCfEgHLDNDNADCU9MMBAOCEFHOXEKAO8sBEGDCfBgCRTALCfBgvHLDNADCU9MMBAOCDFHOXEKAO8sBDGDCfBgCpTALvHLDNADCU9MMBAOCIFHOXEKAO8sBIGDCfBgCxTALvHLDNADCU9MMBAOCLFHOXEKAOrBLC3TALvHLAOCVFHOKABALCD4CBALCE4CEg9r7AVCWFALCEgCDTvGLYDBFGD87EBALADbDBABCDFHBAECUFGEMBKKCBC99AOAIseHOKAOK+lVOEUE99DUD99EUD99DNDNADCL9HMBAEtMEINDNDNjBBBzjBBB+/ABCDFGD8sBB+yAB8sBBGI+yGL+L+TABCEFGV8sBBGO+yGR+L+TGWjBBBB9gGdeAWjBB/+9CAWAWnjBBBBAWAdeGQAQ+MGKAICU9KeALmGLALnAQAKAOCU9KeARmGQAQnmm+R+VGRnmGW+LjBBB9P9dtMBAW+oHIXEKCJJJJ94HIKADAI86BBDNDNjBBBzjBBB+/AQjBBBB9geAQARnmGW+LjBBB9P9dtMBAW+oHDXEKCJJJJ94HDKAVAD86BBDNDNjBBBzjBBB+/ALjBBBB9geALARnmGW+LjBBB9P9dtMBAW+oHDXEKCJJJJ94HDKABAD86BBABCLFHBAECUFGEMBXDKKAEtMBINDNDNjBBBzjBBB+/ABCLFGD8uEB+yAB8uEBGI+yGL+L+TABCDFGV8uEBGO+yGR+L+TGWjBBBB9gGdeAWjB/+fsAWAWnjBBBBAWAdeGQAQ+MGKAICU9KeALmGLALnAQAKAOCU9KeARmGQAQnmm+R+VGRnmGW+LjBBB9P9dtMBAW+oHIXEKCJJJJ94HIKADAI87EBDNDNjBBBzjBBB+/AQjBBBB9geAQARnmGW+LjBBB9P9dtMBAW+oHDXEKCJJJJ94HDKAVAD87EBDNDNjBBBzjBBB+/ALjBBBB9geALARnmGW+LjBBB9P9dtMBAW+oHDXEKCJJJJ94HDKABAD87EBABCWFHBAECUFGEMBKKK/SILIUI99IUE99DNAEtMBCBHIABHLINDNDNj/zL81zALCOF8uEBGVCIv+y+VGOAL8uEB+ynGRjB/+fsnjBBBzjBBB+/ARjBBBB9gemGW+LjBBB9P9dtMBAW+oHdXEKCJJJJ94HdKALCLF8uEBHQALCDF8uEBHKABAVCEFCIgAIvCETFAd87EBDNDNAOAK+ynGWjB/+fsnjBBBzjBBB+/AWjBBBB9gemGX+LjBBB9P9dtMBAX+oHKXEKCJJJJ94HKKABAVCDFCIgAIvCETFAK87EBDNDNAOAQ+ynGOjB/+fsnjBBBzjBBB+/AOjBBBB9gemGX+LjBBB9P9dtMBAX+oHQXEKCJJJJ94HQKABAVCUFCIgAIvCETFAQ87EBDNDNjBBJzARARn+TAWAWn+TAOAOn+TGRjBBBBARjBBBB9ge+RjB/+fsnjBBBzmGR+LjBBB9P9dtMBAR+oHQXEKCJJJJ94HQKABAVCIgAIvCETFAQ87EBALCWFHLAICLFHIAECUFGEMBKKK6BDNADCD4AE2GEtMBINABABYDBGDCWTCW91+yADCk91ClTCJJJ/8IF++nuDBABCLFHBAECUFGEMBKKK9TEIUCBCBYDJ1JJBGEABCIFC98gFGBbDJ1JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIK/lEEEUDNDNAEABvCIgtMBABHIXEKDNDNADCZ9PMBABHIXEKABHIINAIAEYDBbDBAICLFAECLFYDBbDBAICWFAECWFYDBbDBAICXFAECXFYDBbDBAICZFHIAECZFHEADC9wFGDCS0MBKKADCL6MBINAIAEYDBbDBAECLFHEAICLFHIADC98FGDCI0MBKKDNADtMBINAIAErBB86BBAICEFHIAECEFHEADCUFGDMBKKABK/AEEDUDNDNABCIgtMBABHIXEKAECfEgC+B+C+EW2HLDNDNADCZ9PMBABHIXEKABHIINAIALbDBAICXFALbDBAICWFALbDBAICLFALbDBAICZFHIADC9wFGDCS0MBKKADCL6MBINAIALbDBAICLFHIADC98FGDCI0MBKKDNADtMBINAIAE86BBAICEFHIADCUFGDMBKKABKKKEBCJWKLZ9kBB";
  95008. var wasm_simd = "B9h79tEBBBE5V9gBB9gVUUUUUEU9gIUUUB9gDUUB9gEUEUIMXBBEBEEDIDIDLLVE9wEEEVIEBEOWEUEC+Q/aEKR/LEdO9tw9t9vv95DBh9f9f939h79t9f9j9h229f9jT9vv7BB8a9tw79o9v9wT9f9kw9j9v9kw9WwvTw949C919m9mwvBDy9tw79o9v9wT9f9kw9j9v9kw69u9kw949C919m9mwvBLe9tw79o9v9wT9f9kw9j9v9kw69u9kw949Twg91w9u9jwBVl9tw79o9v9wT9f9kw9j9v9kws9p2Twv9P9jTBOk9tw79o9v9wT9f9kw9j9v9kws9p2Twv9R919hTBWl9tw79o9v9wT9f9kw9j9v9kws9p2Twvt949wBQL79iv9rBKQ/j6XLBZIK9+EVU8jJJJJBCZ9rHBCBHEINCBHDCBHIINABCWFADFAICJUAEAD4CEgGLe86BBAIALFHIADCEFGDCW9HMBKAEC+Q+YJJBFAI86BBAECITC+Q1JJBFAB8pIW83IBAECEFGECJD9HMBKK1HLSUD97EUO978jJJJJBCJ/KB9rGV8kJJJJBC9+HODNADCEFAL0MBCUHOAIrBBC+gE9HMBAVAIALFGRAD9rAD/8QBBCJ/ABAD9uC/wfBgGOCJDAOCJD6eHWAICEFHOCBHdDNINAdAE9PMEAWAEAd9rAdAWFAE6eHQDNDNADtMBAQCSFGLC9wgGKCI2HXAKCETHMALCL4CIFCD4HpCBHSINAOHZCBHhDNINDNARAZ9rAp9PMBCBHOXVKAVCJ/CBFAhAK2FHoAZApFHOCBHIDNAKC/AB6MBARAO9rC/gB6MBCBHLINAoALFHIDNDNDNDNDNAZALCO4FrBBGaCIgpLBEDIBKAICBPhPKLBXIKAIAOPBBLAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlGcCDP+MEAcPMBZEhDoIaLcVxOqRlC+D+G+MkPhP9OGxCIPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLBAOCLFAlPqBFAqC+Q+YJJBFrBBFHOXDKAIAOPBBWAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlC+P+e+8/4BPhP9OGxCSPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLBAOCWFAlPqBFAqC+Q+YJJBFrBBFHOXEKAIAOPBBBPKLBAOCZFHOKDNDNDNDNDNAaCD4CIgpLBEDIBKAICBPhPKLZXIKAIAOPBBLAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlGcCDP+MEAcPMBZEhDoIaLcVxOqRlC+D+G+MkPhP9OGxCIPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLZAOCLFAlPqBFAqC+Q+YJJBFrBBFHOXDKAIAOPBBWAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlC+P+e+8/4BPhP9OGxCSPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLZAOCWFAlPqBFAqC+Q+YJJBFrBBFHOXEKAIAOPBBBPKLZAOCZFHOKDNDNDNDNDNAaCL4CIgpLBEDIBKAICBPhPKLAXIKAIAOPBBLAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlGcCDP+MEAcPMBZEhDoIaLcVxOqRlC+D+G+MkPhP9OGxCIPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLAAOCLFAlPqBFAqC+Q+YJJBFrBBFHOXDKAIAOPBBWAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlC+P+e+8/4BPhP9OGxCSPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLAAOCWFAlPqBFAqC+Q+YJJBFrBBFHOXEKAIAOPBBBPKLAAOCZFHOKDNDNDNDNDNAaCO4pLBEDIBKAICBPhPKL8wXIKAIAOPBBLAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlGcCDP+MEAcPMBZEhDoIaLcVxOqRlC+D+G+MkPhP9OGxCIPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGaCITC+Q1JJBFPBIBAaC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGaCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKL8wAOCLFAlPqBFAaC+Q+YJJBFrBBFHOXDKAIAOPBBWAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlC+P+e+8/4BPhP9OGxCSPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGaCITC+Q1JJBFPBIBAaC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGaCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKL8wAOCWFAlPqBFAaC+Q+YJJBFrBBFHOXEKAIAOPBBBPKL8wAOCZFHOKALC/ABFHIALCJEFAK0MEAIHLARAO9rC/fB0MBKKDNAIAK9PMBAICI4HLINDNARAO9rCk9PMBCBHOXRKAoAIFHaDNDNDNDNDNAZAICO4FrBBALCOg4CIgpLBEDIBKAaCBPhPKLBXIKAaAOPBBLAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlGcCDP+MEAcPMBZEhDoIaLcVxOqRlC+D+G+MkPhP9OGxCIPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLBAOCLFAlPqBFAqC+Q+YJJBFrBBFHOXDKAaAOPBBWAOPBBBGcCLP+MEAcPMBZEhDoIaLcVxOqRlC+P+e+8/4BPhP9OGxCSPSP8jGcP5B9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBAqC+Q+YJJBFPBBBGlAlPMBBBBBBBBBBBBBBBBAcP5E9CJf/8/4/w/g/AB9+9Cu1+nGqCITC+Q1JJBFPBIBP9uPMBEDILVORZhoacxqlPpAxAcP9SPKLBAOCWFAlPqBFAqC+Q+YJJBFrBBFHOXEKAaAOPBBBPKLBAOCZFHOKALCDFHLAICZFGIAK6MBKKDNAOtMBAOHZAhCEFGhCLsMDXEKKCBHOXIKDNAKtMBAVCJDFASFHIAVASFPBDBHlCBHaINAIAVCJ/CBFAaFGLPBLBGxCEP9tAxCEPSGcP9OP9hP9RGxALAKFPBLBGkCEP9tAkAcP9OP9hP9RGkPMBZEhDoIaLcVxOqRlGyALAMFPBLBG8aCEP9tA8aAcP9OP9hP9RG8aALAXFPBLBGeCEP9tAeAcP9OP9hP9RGePMBZEhDoIaLcVxOqRlG3PMBEZhDIoaLVcxORqlGcAcPMBEDIBEDIBEDIBEDIAlP9uGlPeBbDBAIADFGLAlAcAcPMLVORLVORLVORLVORP9uGlPeBbDBALADFGLAlAcAcPMWdQKWdQKWdQKWdQKP9uGlPeBbDBALADFGLAlAcAcPMXMpSXMpSXMpSXMpSP9uGlPeBbDBALADFGLAlAyA3PMWdkyQK8aeXM35pS8e8fGcAcPMBEDIBEDIBEDIBEDIP9uGlPeBbDBALADFGLAlAcAcPMLVORLVORLVORLVORP9uGlPeBbDBALADFGLAlAcAcPMWdQKWdQKWdQKWdQKP9uGlPeBbDBALADFGLAlAcAcPMXMpSXMpSXMpSXMpSP9uGlPeBbDBALADFGLAlAxAkPMWkdyQ8aKeX3M5p8eS8fGxA8aAePMWkdyQ8aKeX3M5p8eS8fGkPMBEZhDIoaLVcxORqlGcAcPMBEDIBEDIBEDIBEDIP9uGlPeBbDBALADFGLAlAcAcPMLVORLVORLVORLVORP9uGlPeBbDBALADFGLAlAcAcPMWdQKWdQKWdQKWdQKP9uGlPeBbDBALADFGLAlAcAcPMXMpSXMpSXMpSXMpSP9uGlPeBbDBALADFGLAlAxAkPMWdkyQK8aeXM35pS8e8fGcAcPMBEDIBEDIBEDIBEDIP9uGlPeBbDBALADFGLAlAcAcPMLVORLVORLVORLVORP9uGlPeBbDBALADFGLAlAcAcPMWdQKWdQKWdQKWdQKP9uGlPeBbDBALADFGLAlAcAcPMXMpSXMpSXMpSXMpSP9uGlPeBbDBALADFHIAaCZFGaAK6MBKKASCLFGSAD6MBKKABAdAD2FAVCJDFAQAD2/8QBBAVAVCJDFAQCUFAD2FAD/8QBBKAQCBAOeAdFHdAOMBKC9+HOXEKCBC99ARAO9rADCAADCA0eseHOKAVCJ/KBF8kJJJJBAOKWBZ+BJJJBK+KoEZU8jJJJJBC/AE9rGV8kJJJJBC9+HODNAECI9uGRChFAL0MBCUHOAIrBBGWC/wEgC/gE9HMBAWCSgGdCE0MBAVC/ABFCfECJE/8KBAVCuF9CU83IBAVC8wF9CU83IBAVCYF9CU83IBAVCAF9CU83IBAVCkF9CU83IBAVCZF9CU83IBAV9CU83IWAV9CU83IBAIALFC9wFHQAICEFGWARFHKDNAEtMBCMCSAdCEseHXABHICBHdCBHMCBHpCBHLCBHOINDNAKAQ9NMBC9+HOXIKDNDNAWrBBGRC/vE0MBAVC/ABFARCL4CU7AOFCSgCITFGSYDLHZASYDBHhDNARCSgGSAX9PMBAVARCU7ALFCSgCDTFYDBAdASeHRAStHSDNDNADCD9HMBABAh87EBABCLFAR87EBABCDFAZ87EBXEKAIAhbDBAICWFARbDBAICLFAZbDBKAdASFHdAVC/ABFAOCITFGoARbDBAoAZbDLAVALCDTFARbDBAVC/ABFAOCEFCSgGOCITFGZAhbDBAZARbDLALASFHLAOCEFHOXDKDNDNASCSsMBAMASFASC987FCEFHMXEKAK8sBBGSCfEgHRDNDNASCU9MMBAKCEFHKXEKAK8sBEGSCfBgCRTARCfBgvHRDNASCU9MMBAKCDFHKXEKAK8sBDGSCfBgCpTARvHRDNASCU9MMBAKCIFHKXEKAK8sBIGSCfBgCxTARvHRDNASCU9MMBAKCLFHKXEKAKrBLC3TARvHRAKCVFHKKARCE4CBARCEg9r7AMFHMKDNDNADCD9HMBABAh87EBABCLFAM87EBABCDFAZ87EBXEKAIAhbDBAICWFAMbDBAICLFAZbDBKAVC/ABFAOCITFGRAMbDBARAZbDLAVALCDTFAMbDBAVC/ABFAOCEFCSgGOCITFGRAhbDBARAMbDLALCEFHLAOCEFHOXEKDNARCPE0MBAVALAQARCSgFrBBGSCL4GZ9rCSgCDTFYDBAdCEFGhAZeHRAVALAS9rCSgCDTFYDBAhAZtGoFGhASCSgGZeHSAZtHZDNDNADCD9HMBABAd87EBABCLFAS87EBABCDFAR87EBXEKAIAdbDBAICWFASbDBAICLFARbDBKAVALCDTFAdbDBAVC/ABFAOCITFGaARbDBAaAdbDLAVALCEFGLCSgCDTFARbDBAVC/ABFAOCEFCSgCITFGaASbDBAaARbDLAVALAoFCSgGLCDTFASbDBAVC/ABFAOCDFCSgGOCITFGRAdbDBARASbDLAOCEFHOALAZFHLAhAZFHdXEKAdCBAKrBBGaeGZARC/+EsGcFHRAaCSgHhDNDNAaCL4GoMBARCEFHSXEKARHSAVALAo9rCSgCDTFYDBHRKDNDNAhMBASCEFHdXEKASHdAVALAa9rCSgCDTFYDBHSKDNDNActMBAKCEFHaXEKAK8sBEGaCfEgHZDNDNAaCU9MMBAKCDFHaXEKAK8sBDGaCfBgCRTAZCfBgvHZDNAaCU9MMBAKCIFHaXEKAK8sBIGaCfBgCpTAZvHZDNAaCU9MMBAKCLFHaXEKAK8sBLGaCfBgCxTAZvHZDNAaCU9MMBAKCVFHaXEKAKCOFHaAKrBVC3TAZvHZKAZCE4CBAZCEg9r7AMFGMHZKDNDNAoCSsMBAaHcXEKAa8sBBGKCfEgHRDNDNAKCU9MMBAaCEFHcXEKAa8sBEGKCfBgCRTARCfBgvHRDNAKCU9MMBAaCDFHcXEKAa8sBDGKCfBgCpTARvHRDNAKCU9MMBAaCIFHcXEKAa8sBIGKCfBgCxTARvHRDNAKCU9MMBAaCLFHcXEKAaCVFHcAarBLC3TARvHRKARCE4CBARCEg9r7AMFGMHRKDNDNAhCSsMBAcHKXEKAc8sBBGKCfEgHSDNDNAKCU9MMBAcCEFHKXEKAc8sBEGKCfBgCRTASCfBgvHSDNAKCU9MMBAcCDFHKXEKAc8sBDGKCfBgCpTASvHSDNAKCU9MMBAcCIFHKXEKAc8sBIGKCfBgCxTASvHSDNAKCU9MMBAcCLFHKXEKAcCVFHKAcrBLC3TASvHSKASCE4CBASCEg9r7AMFGMHSKDNDNADCD9HMBABAZ87EBABCLFAS87EBABCDFAR87EBXEKAIAZbDBAICWFASbDBAICLFARbDBKAVC/ABFAOCITFGaARbDBAaAZbDLAVALCDTFAZbDBAVC/ABFAOCEFCSgCITFGaASbDBAaARbDLAVALCEFGLCSgCDTFARbDBAVC/ABFAOCDFCSgCITFGRAZbDBARASbDLAVALAotAoCSsvFGLCSgCDTFASbDBALAhtAhCSsvFHLAOCIFHOKAWCEFHWABCOFHBAICXFHIAOCSgHOALCSgHLApCIFGpAE6MBKKCBC99AKAQseHOKAVC/AEF8kJJJJBAOK/tLEDU8jJJJJBCZ9rHVC9+HODNAECVFAL0MBCUHOAIrBBC/+EgC/QE9HMBAV9CB83IWAICEFHOAIALFC98FHIDNAEtMBDNADCDsMBINDNAOAI6MBC9+SKAO8sBBGDCfEgHLDNDNADCU9MMBAOCEFHOXEKAO8sBEGDCfBgCRTALCfBgvHLDNADCU9MMBAOCDFHOXEKAO8sBDGDCfBgCpTALvHLDNADCU9MMBAOCIFHOXEKAO8sBIGDCfBgCxTALvHLDNADCU9MMBAOCLFHOXEKAOrBLC3TALvHLAOCVFHOKAVCWFALCEgCDTvGDALCD4CBALCE4CEg9r7ADYDBFGLbDBABALbDBABCLFHBAECUFGEMBXDKKINDNAOAI6MBC9+SKAO8sBBGDCfEgHLDNDNADCU9MMBAOCEFHOXEKAO8sBEGDCfBgCRTALCfBgvHLDNADCU9MMBAOCDFHOXEKAO8sBDGDCfBgCpTALvHLDNADCU9MMBAOCIFHOXEKAO8sBIGDCfBgCxTALvHLDNADCU9MMBAOCLFHOXEKAOrBLC3TALvHLAOCVFHOKABALCD4CBALCE4CEg9r7AVCWFALCEgCDTvGLYDBFGD87EBALADbDBABCDFHBAECUFGEMBKKCBC99AOAIseHOKAOK/xVDIUO978jJJJJBCA9rGI8kJJJJBDNDNADCL9HMBDNAEC98gGLtMBABHDCBHVINADADPBBBGOCkP+rECkP+sEP/6EGRAOCWP+rECkP+sEP/6EARP/gEAOCZP+rECkP+sEP/6EGWP/gEP/kEP/lEGdCBPhP+2EGQARCJJJJ94PhGKP9OP9RP/kEGRjBB/+9CPaARARP/mEAdAdP/mEAWAQAWAKP9OP9RP/kEGRARP/mEP/kEP/kEP/jEP/nEGWP/mEjBBN0PaGQP/kECfEPhP9OAOCJJJ94PhP9OP9QARAWP/mEAQP/kECWP+rECJ/+IPhP9OP9QAdAWP/mEAQP/kECZP+rECJJ/8RPhP9OP9QPKBBADCZFHDAVCLFGVAL6MBKKALAE9PMEAIAECIgGVCDTGDvCBCZAD9r/8KBAIABALCDTFGLAD/8QBBDNAVtMBAIAIPBLBGOCkP+rECkP+sEP/6EGRAOCWP+rECkP+sEP/6EARP/gEAOCZP+rECkP+sEP/6EGWP/gEP/kEP/lEGdCBPhP+2EGQARCJJJJ94PhGKP9OP9RP/kEGRjBB/+9CPaARARP/mEAdAdP/mEAWAQAWAKP9OP9RP/kEGRARP/mEP/kEP/kEP/jEP/nEGWP/mEjBBN0PaGQP/kECfEPhP9OAOCJJJ94PhP9OP9QARAWP/mEAQP/kECWP+rECJ/+IPhP9OP9QAdAWP/mEAQP/kECZP+rECJJ/8RPhP9OP9QPKLBKALAIAD/8QBBXEKABAEC98gGDZ+HJJJBADAE9PMBAIAECIgGLCITGVFCBCAAV9r/8KBAIABADCITFGDAV/8QBBAIALZ+HJJJBADAIAV/8QBBKAICAF8kJJJJBK+yIDDUR97DNAEtMBCBHDINABCZFGIAIPBBBGLCBPhGVCJJ98P3ECJJ98P3IGOP9OABPBBBGRALPMLVORXMpScxql358e8fCffEPhP9OP/6EARALPMBEDIWdQKZhoaky8aeGLCZP+sEP/6EGWP/gEALCZP+rECZP+sEP/6EGdP/gEP/kEP/lEGLjB/+fsPaAdALAVP+2EGVAdCJJJJ94PhGQP9OP9RP/kEGdAdP/mEALALP/mEAWAVAWAQP9OP9RP/kEGLALP/mEP/kEP/kEP/jEP/nEGWP/mEjBBN0PaGVP/kECZP+rEAdAWP/mEAVP/kECffIPhP9OP9QGdALAWP/mEAVP/kECUPSCBPlDCBPlICBPlOCBPlRCBPlQCBPlKCBPlpCBPlSP9OGLPMWdkyQK8aeXM35pS8e8fP9QPKBBABARAOP9OAdALPMBEZhDIoaLVcxORqlP9QPKBBABCAFHBADCLFGDAE6MBKKK94EIU8jJJJJBCA9rGI8kJJJJBABAEC98gGLZ+JJJJBDNALAE9PMBAIAECIgGVCITGEFCBCAAE9r/8KBAIABALCITFGBAE/8QBBAIAVZ+JJJJBABAIAE/8QBBKAICAF8kJJJJBK/hILDUE97EUV978jJJJJBCZ9rHDDNAEtMBCBHIINADABPBBBGLABCZFGVPBBBGOPMLVORXMpScxql358e8fGRCZP+sEGWCLP+rEPKLBABjBBJzPaj/zL81zPaAWCIPhP9QP/6EP/nEGWALAOPMBEDIWdQKZhoaky8aeGLCZP+rECZP+sEP/6EP/mEGOAOP/mEAWALCZP+sEP/6EP/mEGdAdP/mEAWARCZP+rECZP+sEP/6EP/mEGRARP/mEP/kEP/kEP/lECBPhP+4EP/jEjB/+fsPaGWP/mEjBBN0PaGLP/kECffIPhGQP9OAdAWP/mEALP/kECZP+rEP9QGdARAWP/mEALP/kECZP+rEAOAWP/mEALP/kEAQP9OP9QGWPMBEZhDIoaLVcxORqlGLP5BADPBLBPeB+t+J83IBABCWFALP5EADPBLBPeE+t+J83IBAVAdAWPMWdkyQK8aeXM35pS8e8fGWP5BADPBLBPeD+t+J83IBABCkFAWP5EADPBLBPeI+t+J83IBABCAFHBAICLFGIAE6MBKKK/3EDIUE978jJJJJBC/AB9rHIDNADCD4AE2GLC98gGVtMBCBHDABHEINAEAEPBBBGOCWP+rECWP+sEP/6EAOCkP+sEClP+rECJJJ/8IPhP+uEP/mEPKBBAECZFHEADCLFGDAV6MBKKDNAVAL9PMBAIALCIgGDCDTGEvCBC/ABAE9r/8KBAIABAVCDTFGVAE/8QBBDNADtMBAIAIPBLBGOCWP+rECWP+sEP/6EAOCkP+sEClP+rECJJJ/8IPhP+uEP/mEPKLBKAVAIAE/8QBBKK9TEIUCBCBYDJ1JJBGEABCIFC98gFGBbDJ1JJBDNDNABzBCZTGD9NMBCUHIABAD9rCffIFCZ4NBCUsMEKAEHIKAIKKKEBCJWKLZ9tBB";
  95009. var detector = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 3, 2, 0, 0, 5, 3, 1, 0, 1, 12, 1, 0, 10, 22, 2, 12, 0, 65, 0, 65, 0, 65, 0, 252, 10, 0, 0, 11, 7, 0, 65, 0, 253, 15, 26, 11]);
  95010. var wasmpack = new Uint8Array([32, 0, 65, 2, 1, 106, 34, 33, 3, 128, 11, 4, 13, 64, 6, 253, 10, 7, 15, 116, 127, 5, 8, 12, 40, 16, 19, 54, 20, 9, 27, 255, 113, 17, 42, 67, 24, 23, 146, 148, 18, 14, 22, 45, 70, 69, 56, 114, 101, 21, 25, 63, 75, 136, 108, 28, 118, 29, 73, 115]);
  95011. if (typeof WebAssembly !== "object") {
  95012. return {
  95013. supported: false
  95014. };
  95015. }
  95016. var wasm = wasm_base;
  95017. if (WebAssembly.validate(detector)) {
  95018. wasm = wasm_simd;
  95019. }
  95020. var instance;
  95021. var promise = WebAssembly.instantiate(unpack(wasm), {}).then(function(result) {
  95022. instance = result.instance;
  95023. instance.exports.__wasm_call_ctors();
  95024. });
  95025. function unpack(data) {
  95026. var result = new Uint8Array(data.length);
  95027. for (var i2 = 0; i2 < data.length; ++i2) {
  95028. var ch = data.charCodeAt(i2);
  95029. result[i2] = ch > 96 ? ch - 71 : ch > 64 ? ch - 65 : ch > 47 ? ch + 4 : ch > 46 ? 63 : 62;
  95030. }
  95031. var write = 0;
  95032. for (var i2 = 0; i2 < data.length; ++i2) {
  95033. result[write++] = result[i2] < 60 ? wasmpack[result[i2]] : (result[i2] - 60) * 64 + result[++i2];
  95034. }
  95035. return result.buffer.slice(0, write);
  95036. }
  95037. function decode(fun, target, count, size, source, filter) {
  95038. var sbrk = instance.exports.sbrk;
  95039. var count4 = count + 3 & ~3;
  95040. var tp = sbrk(count4 * size);
  95041. var sp = sbrk(source.length);
  95042. var heap = new Uint8Array(instance.exports.memory.buffer);
  95043. heap.set(source, sp);
  95044. var res = fun(tp, count, size, sp, source.length);
  95045. if (res == 0 && filter) {
  95046. filter(tp, count4, size);
  95047. }
  95048. target.set(heap.subarray(tp, tp + count * size));
  95049. sbrk(tp - sbrk(0));
  95050. if (res != 0) {
  95051. throw new Error("Malformed buffer data: " + res);
  95052. }
  95053. }
  95054. var filters = {
  95055. 0: "",
  95056. 1: "meshopt_decodeFilterOct",
  95057. 2: "meshopt_decodeFilterQuat",
  95058. 3: "meshopt_decodeFilterExp",
  95059. NONE: "",
  95060. OCTAHEDRAL: "meshopt_decodeFilterOct",
  95061. QUATERNION: "meshopt_decodeFilterQuat",
  95062. EXPONENTIAL: "meshopt_decodeFilterExp"
  95063. };
  95064. var decoders = {
  95065. 0: "meshopt_decodeVertexBuffer",
  95066. 1: "meshopt_decodeIndexBuffer",
  95067. 2: "meshopt_decodeIndexSequence",
  95068. ATTRIBUTES: "meshopt_decodeVertexBuffer",
  95069. TRIANGLES: "meshopt_decodeIndexBuffer",
  95070. INDICES: "meshopt_decodeIndexSequence"
  95071. };
  95072. return {
  95073. ready: promise,
  95074. supported: true,
  95075. decodeVertexBuffer: function(target, count, size, source, filter) {
  95076. decode(instance.exports.meshopt_decodeVertexBuffer, target, count, size, source, instance.exports[filters[filter]]);
  95077. },
  95078. decodeIndexBuffer: function(target, count, size, source) {
  95079. decode(instance.exports.meshopt_decodeIndexBuffer, target, count, size, source);
  95080. },
  95081. decodeIndexSequence: function(target, count, size, source) {
  95082. decode(instance.exports.meshopt_decodeIndexSequence, target, count, size, source);
  95083. },
  95084. decodeGltfBuffer: function(target, count, size, source, mode2, filter) {
  95085. decode(instance.exports[decoders[mode2]], target, count, size, source, instance.exports[filters[filter]]);
  95086. }
  95087. };
  95088. }();
  95089. // node_modules/cesium/Source/Scene/GltfBufferViewLoader.js
  95090. function GltfBufferViewLoader(options) {
  95091. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  95092. const resourceCache = options.resourceCache;
  95093. const gltf = options.gltf;
  95094. const bufferViewId = options.bufferViewId;
  95095. const gltfResource = options.gltfResource;
  95096. const baseResource2 = options.baseResource;
  95097. const cacheKey = options.cacheKey;
  95098. Check_default.typeOf.func("options.resourceCache", resourceCache);
  95099. Check_default.typeOf.object("options.gltf", gltf);
  95100. Check_default.typeOf.number("options.bufferViewId", bufferViewId);
  95101. Check_default.typeOf.object("options.gltfResource", gltfResource);
  95102. Check_default.typeOf.object("options.baseResource", baseResource2);
  95103. const bufferView = gltf.bufferViews[bufferViewId];
  95104. let bufferId = bufferView.buffer;
  95105. let byteOffset = bufferView.byteOffset;
  95106. let byteLength = bufferView.byteLength;
  95107. let hasMeshopt = false;
  95108. let meshoptByteStride;
  95109. let meshoptCount;
  95110. let meshoptMode;
  95111. let meshoptFilter;
  95112. if (hasExtension(bufferView, "EXT_meshopt_compression")) {
  95113. const meshopt = bufferView.extensions.EXT_meshopt_compression;
  95114. bufferId = meshopt.buffer;
  95115. byteOffset = defaultValue_default(meshopt.byteOffset, 0);
  95116. byteLength = meshopt.byteLength;
  95117. hasMeshopt = true;
  95118. meshoptByteStride = meshopt.byteStride;
  95119. meshoptCount = meshopt.count;
  95120. meshoptMode = meshopt.mode;
  95121. meshoptFilter = defaultValue_default(meshopt.filter, "NONE");
  95122. }
  95123. const buffer = gltf.buffers[bufferId];
  95124. this._hasMeshopt = hasMeshopt;
  95125. this._meshoptByteStride = meshoptByteStride;
  95126. this._meshoptCount = meshoptCount;
  95127. this._meshoptMode = meshoptMode;
  95128. this._meshoptFilter = meshoptFilter;
  95129. this._resourceCache = resourceCache;
  95130. this._gltfResource = gltfResource;
  95131. this._baseResource = baseResource2;
  95132. this._buffer = buffer;
  95133. this._bufferId = bufferId;
  95134. this._byteOffset = byteOffset;
  95135. this._byteLength = byteLength;
  95136. this._cacheKey = cacheKey;
  95137. this._bufferLoader = void 0;
  95138. this._typedArray = void 0;
  95139. this._state = ResourceLoaderState_default.UNLOADED;
  95140. this._promise = defer_default();
  95141. }
  95142. if (defined_default(Object.create)) {
  95143. GltfBufferViewLoader.prototype = Object.create(ResourceLoader.prototype);
  95144. GltfBufferViewLoader.prototype.constructor = GltfBufferViewLoader;
  95145. }
  95146. Object.defineProperties(GltfBufferViewLoader.prototype, {
  95147. promise: {
  95148. get: function() {
  95149. return this._promise.promise;
  95150. }
  95151. },
  95152. cacheKey: {
  95153. get: function() {
  95154. return this._cacheKey;
  95155. }
  95156. },
  95157. typedArray: {
  95158. get: function() {
  95159. return this._typedArray;
  95160. }
  95161. }
  95162. });
  95163. GltfBufferViewLoader.prototype.load = function() {
  95164. const bufferLoader = getBufferLoader(this);
  95165. this._bufferLoader = bufferLoader;
  95166. this._state = ResourceLoaderState_default.LOADING;
  95167. const that = this;
  95168. bufferLoader.promise.then(function() {
  95169. if (that.isDestroyed()) {
  95170. return;
  95171. }
  95172. const bufferTypedArray = bufferLoader.typedArray;
  95173. const bufferViewTypedArray = new Uint8Array(
  95174. bufferTypedArray.buffer,
  95175. bufferTypedArray.byteOffset + that._byteOffset,
  95176. that._byteLength
  95177. );
  95178. that.unload();
  95179. that._typedArray = bufferViewTypedArray;
  95180. if (that._hasMeshopt) {
  95181. that._state = ResourceLoaderState_default.PROCESSING;
  95182. } else {
  95183. that._state = ResourceLoaderState_default.READY;
  95184. that._promise.resolve(that);
  95185. }
  95186. }).catch(function(error) {
  95187. if (that.isDestroyed()) {
  95188. return;
  95189. }
  95190. that.unload();
  95191. that._state = ResourceLoaderState_default.FAILED;
  95192. const errorMessage = "Failed to load buffer view";
  95193. that._promise.reject(that.getError(errorMessage, error));
  95194. });
  95195. };
  95196. function getBufferLoader(bufferViewLoader) {
  95197. const resourceCache = bufferViewLoader._resourceCache;
  95198. const buffer = bufferViewLoader._buffer;
  95199. if (defined_default(buffer.uri)) {
  95200. const baseResource2 = bufferViewLoader._baseResource;
  95201. const resource = baseResource2.getDerivedResource({
  95202. url: buffer.uri
  95203. });
  95204. return resourceCache.loadExternalBuffer({
  95205. resource
  95206. });
  95207. }
  95208. return resourceCache.loadEmbeddedBuffer({
  95209. parentResource: bufferViewLoader._gltfResource,
  95210. bufferId: bufferViewLoader._bufferId
  95211. });
  95212. }
  95213. GltfBufferViewLoader.prototype.process = function(frameState) {
  95214. Check_default.typeOf.object("frameState", frameState);
  95215. if (!this._hasMeshopt) {
  95216. return;
  95217. }
  95218. if (!defined_default(this._typedArray)) {
  95219. return;
  95220. }
  95221. if (this._state !== ResourceLoaderState_default.PROCESSING) {
  95222. return;
  95223. }
  95224. const count = this._meshoptCount;
  95225. const byteStride = this._meshoptByteStride;
  95226. const result = new Uint8Array(count * byteStride);
  95227. MeshoptDecoder.decodeGltfBuffer(
  95228. result,
  95229. count,
  95230. byteStride,
  95231. this._typedArray,
  95232. this._meshoptMode,
  95233. this._meshoptFilter
  95234. );
  95235. this._typedArray = result;
  95236. this._state = ResourceLoaderState_default.READY;
  95237. this._promise.resolve(this);
  95238. };
  95239. GltfBufferViewLoader.prototype.unload = function() {
  95240. if (defined_default(this._bufferLoader)) {
  95241. this._resourceCache.unload(this._bufferLoader);
  95242. }
  95243. this._bufferLoader = void 0;
  95244. this._typedArray = void 0;
  95245. };
  95246. // node_modules/cesium/Source/Scene/GltfDracoLoader.js
  95247. function GltfDracoLoader(options) {
  95248. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  95249. const resourceCache = options.resourceCache;
  95250. const gltf = options.gltf;
  95251. const draco = options.draco;
  95252. const gltfResource = options.gltfResource;
  95253. const baseResource2 = options.baseResource;
  95254. const cacheKey = options.cacheKey;
  95255. Check_default.typeOf.func("options.resourceCache", resourceCache);
  95256. Check_default.typeOf.object("options.gltf", gltf);
  95257. Check_default.typeOf.object("options.draco", draco);
  95258. Check_default.typeOf.object("options.gltfResource", gltfResource);
  95259. Check_default.typeOf.object("options.baseResource", baseResource2);
  95260. this._resourceCache = resourceCache;
  95261. this._gltfResource = gltfResource;
  95262. this._baseResource = baseResource2;
  95263. this._gltf = gltf;
  95264. this._draco = draco;
  95265. this._cacheKey = cacheKey;
  95266. this._bufferViewLoader = void 0;
  95267. this._bufferViewTypedArray = void 0;
  95268. this._decodePromise = void 0;
  95269. this._decodedData = void 0;
  95270. this._state = ResourceLoaderState_default.UNLOADED;
  95271. this._promise = defer_default();
  95272. }
  95273. if (defined_default(Object.create)) {
  95274. GltfDracoLoader.prototype = Object.create(ResourceLoader.prototype);
  95275. GltfDracoLoader.prototype.constructor = GltfDracoLoader;
  95276. }
  95277. Object.defineProperties(GltfDracoLoader.prototype, {
  95278. promise: {
  95279. get: function() {
  95280. return this._promise.promise;
  95281. }
  95282. },
  95283. cacheKey: {
  95284. get: function() {
  95285. return this._cacheKey;
  95286. }
  95287. },
  95288. decodedData: {
  95289. get: function() {
  95290. return this._decodedData;
  95291. }
  95292. }
  95293. });
  95294. GltfDracoLoader.prototype.load = function() {
  95295. const resourceCache = this._resourceCache;
  95296. const bufferViewLoader = resourceCache.loadBufferView({
  95297. gltf: this._gltf,
  95298. bufferViewId: this._draco.bufferView,
  95299. gltfResource: this._gltfResource,
  95300. baseResource: this._baseResource
  95301. });
  95302. this._bufferViewLoader = bufferViewLoader;
  95303. this._state = ResourceLoaderState_default.LOADING;
  95304. const that = this;
  95305. bufferViewLoader.promise.then(function() {
  95306. if (that.isDestroyed()) {
  95307. return;
  95308. }
  95309. that._bufferViewTypedArray = bufferViewLoader.typedArray;
  95310. that._state = ResourceLoaderState_default.PROCESSING;
  95311. }).catch(function(error) {
  95312. if (that.isDestroyed()) {
  95313. return;
  95314. }
  95315. handleError(that, error);
  95316. });
  95317. };
  95318. function handleError(dracoLoader, error) {
  95319. dracoLoader.unload();
  95320. dracoLoader._state = ResourceLoaderState_default.FAILED;
  95321. const errorMessage = "Failed to load Draco";
  95322. dracoLoader._promise.reject(dracoLoader.getError(errorMessage, error));
  95323. }
  95324. GltfDracoLoader.prototype.process = function(frameState) {
  95325. Check_default.typeOf.object("frameState", frameState);
  95326. if (!defined_default(this._bufferViewTypedArray)) {
  95327. return;
  95328. }
  95329. if (defined_default(this._decodePromise)) {
  95330. return;
  95331. }
  95332. const draco = this._draco;
  95333. const gltf = this._gltf;
  95334. const bufferViews = gltf.bufferViews;
  95335. const bufferViewId = draco.bufferView;
  95336. const bufferView = bufferViews[bufferViewId];
  95337. const compressedAttributes = draco.attributes;
  95338. const decodeOptions = {
  95339. array: new Uint8Array(this._bufferViewTypedArray),
  95340. bufferView,
  95341. compressedAttributes,
  95342. dequantizeInShader: true
  95343. };
  95344. const decodePromise = DracoLoader_default.decodeBufferView(decodeOptions);
  95345. if (!defined_default(decodePromise)) {
  95346. return;
  95347. }
  95348. const that = this;
  95349. this._decodePromise = decodePromise.then(function(results) {
  95350. if (that.isDestroyed()) {
  95351. return;
  95352. }
  95353. that.unload();
  95354. that._decodedData = {
  95355. indices: results.indexArray,
  95356. vertexAttributes: results.attributeData
  95357. };
  95358. that._state = ResourceLoaderState_default.READY;
  95359. that._promise.resolve(that);
  95360. }).catch(function(error) {
  95361. if (that.isDestroyed()) {
  95362. return;
  95363. }
  95364. handleError(that, error);
  95365. });
  95366. };
  95367. GltfDracoLoader.prototype.unload = function() {
  95368. if (defined_default(this._bufferViewLoader)) {
  95369. this._resourceCache.unload(this._bufferViewLoader);
  95370. }
  95371. this._bufferViewLoader = void 0;
  95372. this._bufferViewTypedArray = void 0;
  95373. this._decodedData = void 0;
  95374. this._gltf = void 0;
  95375. };
  95376. // node_modules/cesium/Source/Scene/GltfImageLoader.js
  95377. function GltfImageLoader(options) {
  95378. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  95379. const resourceCache = options.resourceCache;
  95380. const gltf = options.gltf;
  95381. const imageId = options.imageId;
  95382. const gltfResource = options.gltfResource;
  95383. const baseResource2 = options.baseResource;
  95384. const cacheKey = options.cacheKey;
  95385. Check_default.typeOf.func("options.resourceCache", resourceCache);
  95386. Check_default.typeOf.object("options.gltf", gltf);
  95387. Check_default.typeOf.number("options.imageId", imageId);
  95388. Check_default.typeOf.object("options.gltfResource", gltfResource);
  95389. Check_default.typeOf.object("options.baseResource", baseResource2);
  95390. const image = gltf.images[imageId];
  95391. const bufferViewId = image.bufferView;
  95392. const uri = image.uri;
  95393. this._resourceCache = resourceCache;
  95394. this._gltfResource = gltfResource;
  95395. this._baseResource = baseResource2;
  95396. this._gltf = gltf;
  95397. this._bufferViewId = bufferViewId;
  95398. this._uri = uri;
  95399. this._cacheKey = cacheKey;
  95400. this._bufferViewLoader = void 0;
  95401. this._image = void 0;
  95402. this._mipLevels = void 0;
  95403. this._state = ResourceLoaderState_default.UNLOADED;
  95404. this._promise = defer_default();
  95405. }
  95406. if (defined_default(Object.create)) {
  95407. GltfImageLoader.prototype = Object.create(ResourceLoader.prototype);
  95408. GltfImageLoader.prototype.constructor = GltfImageLoader;
  95409. }
  95410. Object.defineProperties(GltfImageLoader.prototype, {
  95411. promise: {
  95412. get: function() {
  95413. return this._promise.promise;
  95414. }
  95415. },
  95416. cacheKey: {
  95417. get: function() {
  95418. return this._cacheKey;
  95419. }
  95420. },
  95421. image: {
  95422. get: function() {
  95423. return this._image;
  95424. }
  95425. },
  95426. mipLevels: {
  95427. get: function() {
  95428. return this._mipLevels;
  95429. }
  95430. }
  95431. });
  95432. GltfImageLoader.prototype.load = function() {
  95433. if (defined_default(this._bufferViewId)) {
  95434. loadFromBufferView(this);
  95435. } else {
  95436. loadFromUri(this);
  95437. }
  95438. };
  95439. function getImageAndMipLevels(image) {
  95440. let mipLevels;
  95441. if (Array.isArray(image)) {
  95442. mipLevels = image.slice(1, image.length).map(function(mipLevel) {
  95443. return mipLevel.bufferView;
  95444. });
  95445. image = image[0];
  95446. }
  95447. return {
  95448. image,
  95449. mipLevels
  95450. };
  95451. }
  95452. function loadFromBufferView(imageLoader) {
  95453. const resourceCache = imageLoader._resourceCache;
  95454. const bufferViewLoader = resourceCache.loadBufferView({
  95455. gltf: imageLoader._gltf,
  95456. bufferViewId: imageLoader._bufferViewId,
  95457. gltfResource: imageLoader._gltfResource,
  95458. baseResource: imageLoader._baseResource
  95459. });
  95460. imageLoader._bufferViewLoader = bufferViewLoader;
  95461. imageLoader._state = ResourceLoaderState_default.LOADING;
  95462. bufferViewLoader.promise.then(function() {
  95463. if (imageLoader.isDestroyed()) {
  95464. return;
  95465. }
  95466. const typedArray = bufferViewLoader.typedArray;
  95467. return loadImageFromBufferTypedArray(typedArray).then(function(image) {
  95468. if (imageLoader.isDestroyed()) {
  95469. return;
  95470. }
  95471. const imageAndMipLevels = getImageAndMipLevels(image);
  95472. imageLoader.unload();
  95473. imageLoader._image = imageAndMipLevels.image;
  95474. imageLoader._mipLevels = imageAndMipLevels.mipLevels;
  95475. imageLoader._state = ResourceLoaderState_default.READY;
  95476. imageLoader._promise.resolve(imageLoader);
  95477. });
  95478. }).catch(function(error) {
  95479. if (imageLoader.isDestroyed()) {
  95480. return;
  95481. }
  95482. handleError2(imageLoader, error, "Failed to load embedded image");
  95483. });
  95484. }
  95485. function loadFromUri(imageLoader) {
  95486. const baseResource2 = imageLoader._baseResource;
  95487. const uri = imageLoader._uri;
  95488. const resource = baseResource2.getDerivedResource({
  95489. url: uri
  95490. });
  95491. imageLoader._state = ResourceLoaderState_default.LOADING;
  95492. loadImageFromUri(resource).then(function(image) {
  95493. if (imageLoader.isDestroyed()) {
  95494. return;
  95495. }
  95496. const imageAndMipLevels = getImageAndMipLevels(image);
  95497. imageLoader.unload();
  95498. imageLoader._image = imageAndMipLevels.image;
  95499. imageLoader._mipLevels = imageAndMipLevels.mipLevels;
  95500. imageLoader._state = ResourceLoaderState_default.READY;
  95501. imageLoader._promise.resolve(imageLoader);
  95502. }).catch(function(error) {
  95503. if (imageLoader.isDestroyed()) {
  95504. return;
  95505. }
  95506. handleError2(imageLoader, error, `Failed to load image: ${uri}`);
  95507. });
  95508. }
  95509. function handleError2(imageLoader, error, errorMessage) {
  95510. imageLoader.unload();
  95511. imageLoader._state = ResourceLoaderState_default.FAILED;
  95512. imageLoader._promise.reject(imageLoader.getError(errorMessage, error));
  95513. }
  95514. function getMimeTypeFromTypedArray(typedArray) {
  95515. const header = typedArray.subarray(0, 2);
  95516. const webpHeaderRIFFChars = typedArray.subarray(0, 4);
  95517. const webpHeaderWEBPChars = typedArray.subarray(8, 12);
  95518. if (header[0] === 255 && header[1] === 216) {
  95519. return "image/jpeg";
  95520. } else if (header[0] === 137 && header[1] === 80) {
  95521. return "image/png";
  95522. } else if (header[0] === 171 && header[1] === 75) {
  95523. return "image/ktx2";
  95524. } else if (webpHeaderRIFFChars[0] === 82 && webpHeaderRIFFChars[1] === 73 && webpHeaderRIFFChars[2] === 70 && webpHeaderRIFFChars[3] === 70 && webpHeaderWEBPChars[0] === 87 && webpHeaderWEBPChars[1] === 69 && webpHeaderWEBPChars[2] === 66 && webpHeaderWEBPChars[3] === 80) {
  95525. return "image/webp";
  95526. }
  95527. throw new RuntimeError_default("Image format is not recognized");
  95528. }
  95529. function loadImageFromBufferTypedArray(typedArray) {
  95530. const mimeType = getMimeTypeFromTypedArray(typedArray);
  95531. if (mimeType === "image/ktx2") {
  95532. const ktxBuffer = new Uint8Array(typedArray);
  95533. return loadKTX2_default(ktxBuffer);
  95534. }
  95535. return GltfImageLoader._loadImageFromTypedArray({
  95536. uint8Array: typedArray,
  95537. format: mimeType,
  95538. flipY: false,
  95539. skipColorSpaceConversion: true
  95540. });
  95541. }
  95542. var ktx2Regex3 = /(^data:image\/ktx2)|(\.ktx2$)/i;
  95543. function loadImageFromUri(resource) {
  95544. const uri = resource.url;
  95545. if (ktx2Regex3.test(uri)) {
  95546. return loadKTX2_default(resource);
  95547. }
  95548. return resource.fetchImage({
  95549. skipColorSpaceConversion: true,
  95550. preferImageBitmap: true
  95551. });
  95552. }
  95553. GltfImageLoader.prototype.unload = function() {
  95554. if (defined_default(this._bufferViewLoader)) {
  95555. this._resourceCache.unload(this._bufferViewLoader);
  95556. }
  95557. this._bufferViewLoader = void 0;
  95558. this._uri = void 0;
  95559. this._image = void 0;
  95560. this._mipLevels = void 0;
  95561. this._gltf = void 0;
  95562. };
  95563. GltfImageLoader._loadImageFromTypedArray = loadImageFromTypedArray_default;
  95564. // node_modules/cesium/Source/Scene/GltfIndexBufferLoader.js
  95565. function GltfIndexBufferLoader(options) {
  95566. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  95567. const resourceCache = options.resourceCache;
  95568. const gltf = options.gltf;
  95569. const accessorId = options.accessorId;
  95570. const gltfResource = options.gltfResource;
  95571. const baseResource2 = options.baseResource;
  95572. const draco = options.draco;
  95573. const cacheKey = options.cacheKey;
  95574. const asynchronous = defaultValue_default(options.asynchronous, true);
  95575. const loadAsTypedArray = defaultValue_default(options.loadAsTypedArray, false);
  95576. Check_default.typeOf.func("options.resourceCache", resourceCache);
  95577. Check_default.typeOf.object("options.gltf", gltf);
  95578. Check_default.typeOf.number("options.accessorId", accessorId);
  95579. Check_default.typeOf.object("options.gltfResource", gltfResource);
  95580. Check_default.typeOf.object("options.baseResource", baseResource2);
  95581. const indexDatatype = gltf.accessors[accessorId].componentType;
  95582. this._resourceCache = resourceCache;
  95583. this._gltfResource = gltfResource;
  95584. this._baseResource = baseResource2;
  95585. this._gltf = gltf;
  95586. this._accessorId = accessorId;
  95587. this._indexDatatype = indexDatatype;
  95588. this._draco = draco;
  95589. this._cacheKey = cacheKey;
  95590. this._asynchronous = asynchronous;
  95591. this._loadAsTypedArray = loadAsTypedArray;
  95592. this._bufferViewLoader = void 0;
  95593. this._dracoLoader = void 0;
  95594. this._typedArray = void 0;
  95595. this._buffer = void 0;
  95596. this._state = ResourceLoaderState_default.UNLOADED;
  95597. this._promise = defer_default();
  95598. }
  95599. if (defined_default(Object.create)) {
  95600. GltfIndexBufferLoader.prototype = Object.create(ResourceLoader.prototype);
  95601. GltfIndexBufferLoader.prototype.constructor = GltfIndexBufferLoader;
  95602. }
  95603. Object.defineProperties(GltfIndexBufferLoader.prototype, {
  95604. promise: {
  95605. get: function() {
  95606. return this._promise.promise;
  95607. }
  95608. },
  95609. cacheKey: {
  95610. get: function() {
  95611. return this._cacheKey;
  95612. }
  95613. },
  95614. buffer: {
  95615. get: function() {
  95616. return this._buffer;
  95617. }
  95618. },
  95619. typedArray: {
  95620. get: function() {
  95621. return this._typedArray;
  95622. }
  95623. },
  95624. indexDatatype: {
  95625. get: function() {
  95626. return this._indexDatatype;
  95627. }
  95628. }
  95629. });
  95630. GltfIndexBufferLoader.prototype.load = function() {
  95631. if (defined_default(this._draco)) {
  95632. loadFromDraco(this);
  95633. } else {
  95634. loadFromBufferView2(this);
  95635. }
  95636. };
  95637. function loadFromDraco(indexBufferLoader) {
  95638. const resourceCache = indexBufferLoader._resourceCache;
  95639. const dracoLoader = resourceCache.loadDraco({
  95640. gltf: indexBufferLoader._gltf,
  95641. draco: indexBufferLoader._draco,
  95642. gltfResource: indexBufferLoader._gltfResource,
  95643. baseResource: indexBufferLoader._baseResource
  95644. });
  95645. indexBufferLoader._dracoLoader = dracoLoader;
  95646. indexBufferLoader._state = ResourceLoaderState_default.LOADING;
  95647. dracoLoader.promise.then(function() {
  95648. if (indexBufferLoader.isDestroyed()) {
  95649. return;
  95650. }
  95651. const typedArray = dracoLoader.decodedData.indices.typedArray;
  95652. indexBufferLoader._typedArray = typedArray;
  95653. indexBufferLoader._indexDatatype = ComponentDatatype_default.fromTypedArray(
  95654. typedArray
  95655. );
  95656. indexBufferLoader._state = ResourceLoaderState_default.PROCESSING;
  95657. }).catch(function(error) {
  95658. if (indexBufferLoader.isDestroyed()) {
  95659. return;
  95660. }
  95661. handleError3(indexBufferLoader, error);
  95662. });
  95663. }
  95664. function loadFromBufferView2(indexBufferLoader) {
  95665. const gltf = indexBufferLoader._gltf;
  95666. const accessorId = indexBufferLoader._accessorId;
  95667. const accessor = gltf.accessors[accessorId];
  95668. const bufferViewId = accessor.bufferView;
  95669. const resourceCache = indexBufferLoader._resourceCache;
  95670. const bufferViewLoader = resourceCache.loadBufferView({
  95671. gltf,
  95672. bufferViewId,
  95673. gltfResource: indexBufferLoader._gltfResource,
  95674. baseResource: indexBufferLoader._baseResource
  95675. });
  95676. indexBufferLoader._state = ResourceLoaderState_default.LOADING;
  95677. indexBufferLoader._bufferViewLoader = bufferViewLoader;
  95678. bufferViewLoader.promise.then(function() {
  95679. if (indexBufferLoader.isDestroyed()) {
  95680. return;
  95681. }
  95682. const bufferViewTypedArray = bufferViewLoader.typedArray;
  95683. indexBufferLoader._typedArray = createIndicesTypedArray(
  95684. indexBufferLoader,
  95685. bufferViewTypedArray
  95686. );
  95687. indexBufferLoader._state = ResourceLoaderState_default.PROCESSING;
  95688. }).catch(function(error) {
  95689. if (indexBufferLoader.isDestroyed()) {
  95690. return;
  95691. }
  95692. handleError3(indexBufferLoader, error);
  95693. });
  95694. }
  95695. function createIndicesTypedArray(indexBufferLoader, bufferViewTypedArray) {
  95696. const gltf = indexBufferLoader._gltf;
  95697. const accessorId = indexBufferLoader._accessorId;
  95698. const accessor = gltf.accessors[accessorId];
  95699. const count = accessor.count;
  95700. const indexDatatype = accessor.componentType;
  95701. const arrayBuffer = bufferViewTypedArray.buffer;
  95702. const byteOffset = bufferViewTypedArray.byteOffset + accessor.byteOffset;
  95703. let typedArray;
  95704. if (indexDatatype === IndexDatatype_default.UNSIGNED_BYTE) {
  95705. typedArray = new Uint8Array(arrayBuffer, byteOffset, count);
  95706. } else if (indexDatatype === IndexDatatype_default.UNSIGNED_SHORT) {
  95707. typedArray = new Uint16Array(arrayBuffer, byteOffset, count);
  95708. } else if (indexDatatype === IndexDatatype_default.UNSIGNED_INT) {
  95709. typedArray = new Uint32Array(arrayBuffer, byteOffset, count);
  95710. }
  95711. return typedArray;
  95712. }
  95713. function handleError3(indexBufferLoader, error) {
  95714. indexBufferLoader.unload();
  95715. indexBufferLoader._state = ResourceLoaderState_default.FAILED;
  95716. const errorMessage = "Failed to load index buffer";
  95717. error = indexBufferLoader.getError(errorMessage, error);
  95718. indexBufferLoader._promise.reject(error);
  95719. }
  95720. function CreateIndexBufferJob2() {
  95721. this.typedArray = void 0;
  95722. this.indexDatatype = void 0;
  95723. this.context = void 0;
  95724. this.buffer = void 0;
  95725. }
  95726. CreateIndexBufferJob2.prototype.set = function(typedArray, indexDatatype, context) {
  95727. this.typedArray = typedArray;
  95728. this.indexDatatype = indexDatatype;
  95729. this.context = context;
  95730. };
  95731. CreateIndexBufferJob2.prototype.execute = function() {
  95732. this.buffer = createIndexBuffer3(
  95733. this.typedArray,
  95734. this.indexDatatype,
  95735. this.context
  95736. );
  95737. };
  95738. function createIndexBuffer3(typedArray, indexDatatype, context) {
  95739. const buffer = Buffer_default.createIndexBuffer({
  95740. typedArray,
  95741. context,
  95742. usage: BufferUsage_default.STATIC_DRAW,
  95743. indexDatatype
  95744. });
  95745. buffer.vertexArrayDestroyable = false;
  95746. return buffer;
  95747. }
  95748. var scratchIndexBufferJob2 = new CreateIndexBufferJob2();
  95749. GltfIndexBufferLoader.prototype.process = function(frameState) {
  95750. Check_default.typeOf.object("frameState", frameState);
  95751. if (this._state === ResourceLoaderState_default.READY) {
  95752. return;
  95753. }
  95754. const typedArray = this._typedArray;
  95755. const indexDatatype = this._indexDatatype;
  95756. if (defined_default(this._dracoLoader)) {
  95757. this._dracoLoader.process(frameState);
  95758. }
  95759. if (defined_default(this._bufferViewLoader)) {
  95760. this._bufferViewLoader.process(frameState);
  95761. }
  95762. if (!defined_default(typedArray)) {
  95763. return;
  95764. }
  95765. const useWebgl2 = frameState.context.webgl2;
  95766. if (this._loadAsTypedArray || !useWebgl2) {
  95767. this.unload();
  95768. this._typedArray = typedArray;
  95769. this._state = ResourceLoaderState_default.READY;
  95770. this._promise.resolve(this);
  95771. return;
  95772. }
  95773. let buffer;
  95774. if (this._asynchronous) {
  95775. const indexBufferJob = scratchIndexBufferJob2;
  95776. indexBufferJob.set(typedArray, indexDatatype, frameState.context);
  95777. const jobScheduler = frameState.jobScheduler;
  95778. if (!jobScheduler.execute(indexBufferJob, JobType_default.BUFFER)) {
  95779. return;
  95780. }
  95781. buffer = indexBufferJob.buffer;
  95782. } else {
  95783. buffer = createIndexBuffer3(typedArray, indexDatatype, frameState.context);
  95784. }
  95785. this.unload();
  95786. this._buffer = buffer;
  95787. this._state = ResourceLoaderState_default.READY;
  95788. this._promise.resolve(this);
  95789. };
  95790. GltfIndexBufferLoader.prototype.unload = function() {
  95791. if (defined_default(this._buffer)) {
  95792. this._buffer.destroy();
  95793. }
  95794. const resourceCache = this._resourceCache;
  95795. if (defined_default(this._bufferViewLoader)) {
  95796. resourceCache.unload(this._bufferViewLoader);
  95797. }
  95798. if (defined_default(this._dracoLoader)) {
  95799. resourceCache.unload(this._dracoLoader);
  95800. }
  95801. this._bufferViewLoader = void 0;
  95802. this._dracoLoader = void 0;
  95803. this._typedArray = void 0;
  95804. this._buffer = void 0;
  95805. this._gltf = void 0;
  95806. };
  95807. // node_modules/cesium/Source/Scene/GltfPipeline/removePipelineExtras.js
  95808. function removePipelineExtras(gltf) {
  95809. ForEach_default.shader(gltf, function(shader) {
  95810. removeExtras(shader);
  95811. });
  95812. ForEach_default.buffer(gltf, function(buffer) {
  95813. removeExtras(buffer);
  95814. });
  95815. ForEach_default.image(gltf, function(image) {
  95816. removeExtras(image);
  95817. });
  95818. removeExtras(gltf);
  95819. return gltf;
  95820. }
  95821. function removeExtras(object2) {
  95822. if (!defined_default(object2.extras)) {
  95823. return;
  95824. }
  95825. if (defined_default(object2.extras._pipeline)) {
  95826. delete object2.extras._pipeline;
  95827. }
  95828. if (Object.keys(object2.extras).length === 0) {
  95829. delete object2.extras;
  95830. }
  95831. }
  95832. var removePipelineExtras_default = removePipelineExtras;
  95833. // node_modules/cesium/Source/Scene/GltfJsonLoader.js
  95834. function GltfJsonLoader(options) {
  95835. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  95836. const resourceCache = options.resourceCache;
  95837. const gltfResource = options.gltfResource;
  95838. const baseResource2 = options.baseResource;
  95839. const typedArray = options.typedArray;
  95840. const gltfJson = options.gltfJson;
  95841. const cacheKey = options.cacheKey;
  95842. Check_default.typeOf.func("options.resourceCache", resourceCache);
  95843. Check_default.typeOf.object("options.gltfResource", gltfResource);
  95844. Check_default.typeOf.object("options.baseResource", baseResource2);
  95845. this._resourceCache = resourceCache;
  95846. this._gltfResource = gltfResource;
  95847. this._baseResource = baseResource2;
  95848. this._typedArray = typedArray;
  95849. this._gltfJson = gltfJson;
  95850. this._cacheKey = cacheKey;
  95851. this._gltf = void 0;
  95852. this._bufferLoaders = [];
  95853. this._state = ResourceLoaderState_default.UNLOADED;
  95854. this._promise = defer_default();
  95855. }
  95856. if (defined_default(Object.create)) {
  95857. GltfJsonLoader.prototype = Object.create(ResourceLoader.prototype);
  95858. GltfJsonLoader.prototype.constructor = GltfJsonLoader;
  95859. }
  95860. Object.defineProperties(GltfJsonLoader.prototype, {
  95861. promise: {
  95862. get: function() {
  95863. return this._promise.promise;
  95864. }
  95865. },
  95866. cacheKey: {
  95867. get: function() {
  95868. return this._cacheKey;
  95869. }
  95870. },
  95871. gltf: {
  95872. get: function() {
  95873. return this._gltf;
  95874. }
  95875. }
  95876. });
  95877. GltfJsonLoader.prototype.load = function() {
  95878. this._state = ResourceLoaderState_default.LOADING;
  95879. let processPromise;
  95880. if (defined_default(this._gltfJson)) {
  95881. processPromise = processGltfJson(this, this._gltfJson);
  95882. } else if (defined_default(this._typedArray)) {
  95883. processPromise = processGltfTypedArray(this, this._typedArray);
  95884. } else {
  95885. processPromise = loadFromUri2(this);
  95886. }
  95887. const that = this;
  95888. return processPromise.then(function(gltf) {
  95889. if (that.isDestroyed()) {
  95890. return;
  95891. }
  95892. that._gltf = gltf;
  95893. that._state = ResourceLoaderState_default.READY;
  95894. that._promise.resolve(that);
  95895. }).catch(function(error) {
  95896. if (that.isDestroyed()) {
  95897. return;
  95898. }
  95899. handleError4(that, error);
  95900. });
  95901. };
  95902. function loadFromUri2(gltfJsonLoader) {
  95903. return gltfJsonLoader._fetchGltf().then(function(arrayBuffer) {
  95904. if (gltfJsonLoader.isDestroyed()) {
  95905. return;
  95906. }
  95907. const typedArray = new Uint8Array(arrayBuffer);
  95908. return processGltfTypedArray(gltfJsonLoader, typedArray);
  95909. });
  95910. }
  95911. function handleError4(gltfJsonLoader, error) {
  95912. gltfJsonLoader.unload();
  95913. gltfJsonLoader._state = ResourceLoaderState_default.FAILED;
  95914. const errorMessage = `Failed to load glTF: ${gltfJsonLoader._gltfResource.url}`;
  95915. gltfJsonLoader._promise.reject(gltfJsonLoader.getError(errorMessage, error));
  95916. }
  95917. function upgradeVersion(gltfJsonLoader, gltf) {
  95918. if (gltf.asset.version === "2.0") {
  95919. return Promise.resolve();
  95920. }
  95921. const promises = [];
  95922. ForEach_default.buffer(gltf, function(buffer) {
  95923. if (!defined_default(buffer.extras._pipeline.source) && defined_default(buffer.uri)) {
  95924. const resource = gltfJsonLoader._baseResource.getDerivedResource({
  95925. url: buffer.uri
  95926. });
  95927. const resourceCache = gltfJsonLoader._resourceCache;
  95928. const bufferLoader = resourceCache.loadExternalBuffer({
  95929. resource
  95930. });
  95931. gltfJsonLoader._bufferLoaders.push(bufferLoader);
  95932. promises.push(
  95933. bufferLoader.promise.then(function(bufferLoader2) {
  95934. buffer.extras._pipeline.source = bufferLoader2.typedArray;
  95935. })
  95936. );
  95937. }
  95938. });
  95939. return Promise.all(promises).then(function() {
  95940. updateVersion_default(gltf);
  95941. });
  95942. }
  95943. function decodeDataUris(gltf) {
  95944. const promises = [];
  95945. ForEach_default.buffer(gltf, function(buffer) {
  95946. const bufferUri = buffer.uri;
  95947. if (!defined_default(buffer.extras._pipeline.source) && defined_default(bufferUri) && isDataUri_default(bufferUri)) {
  95948. delete buffer.uri;
  95949. promises.push(
  95950. Resource_default.fetchArrayBuffer(bufferUri).then(function(arrayBuffer) {
  95951. buffer.extras._pipeline.source = new Uint8Array(arrayBuffer);
  95952. })
  95953. );
  95954. }
  95955. });
  95956. return Promise.all(promises);
  95957. }
  95958. function loadEmbeddedBuffers(gltfJsonLoader, gltf) {
  95959. const promises = [];
  95960. ForEach_default.buffer(gltf, function(buffer, bufferId) {
  95961. const source = buffer.extras._pipeline.source;
  95962. if (defined_default(source) && !defined_default(buffer.uri)) {
  95963. const resourceCache = gltfJsonLoader._resourceCache;
  95964. const bufferLoader = resourceCache.loadEmbeddedBuffer({
  95965. parentResource: gltfJsonLoader._gltfResource,
  95966. bufferId,
  95967. typedArray: source
  95968. });
  95969. gltfJsonLoader._bufferLoaders.push(bufferLoader);
  95970. promises.push(bufferLoader.promise);
  95971. }
  95972. });
  95973. return Promise.all(promises);
  95974. }
  95975. function processGltfJson(gltfJsonLoader, gltf) {
  95976. addPipelineExtras_default(gltf);
  95977. return decodeDataUris(gltf).then(function() {
  95978. return upgradeVersion(gltfJsonLoader, gltf).then(function() {
  95979. addDefaults_default(gltf);
  95980. return loadEmbeddedBuffers(gltfJsonLoader, gltf).then(function() {
  95981. removePipelineExtras_default(gltf);
  95982. return gltf;
  95983. });
  95984. });
  95985. });
  95986. }
  95987. function processGltfTypedArray(gltfJsonLoader, typedArray) {
  95988. let gltf;
  95989. if (getMagic_default(typedArray) === "glTF") {
  95990. gltf = parseGlb_default(typedArray);
  95991. } else {
  95992. gltf = getJsonFromTypedArray_default(typedArray);
  95993. }
  95994. return processGltfJson(gltfJsonLoader, gltf);
  95995. }
  95996. GltfJsonLoader.prototype.unload = function() {
  95997. const bufferLoaders = this._bufferLoaders;
  95998. const bufferLoadersLength = bufferLoaders.length;
  95999. for (let i2 = 0; i2 < bufferLoadersLength; ++i2) {
  96000. this._resourceCache.unload(bufferLoaders[i2]);
  96001. }
  96002. this._bufferLoaders.length = 0;
  96003. this._gltf = void 0;
  96004. };
  96005. GltfJsonLoader.prototype._fetchGltf = function() {
  96006. return this._gltfResource.fetchArrayBuffer();
  96007. };
  96008. // node_modules/cesium/Source/Scene/AlphaMode.js
  96009. var AlphaMode = {
  96010. OPAQUE: "OPAQUE",
  96011. MASK: "MASK",
  96012. BLEND: "BLEND"
  96013. };
  96014. var AlphaMode_default = Object.freeze(AlphaMode);
  96015. // node_modules/cesium/Source/Scene/ModelComponents.js
  96016. var ModelComponents = {};
  96017. function Quantization() {
  96018. this.octEncoded = false;
  96019. this.octEncodedZXY = false;
  96020. this.normalizationRange = void 0;
  96021. this.quantizedVolumeOffset = void 0;
  96022. this.quantizedVolumeDimensions = void 0;
  96023. this.quantizedVolumeStepSize = void 0;
  96024. this.componentDatatype = void 0;
  96025. this.type = void 0;
  96026. }
  96027. function Attribute() {
  96028. this.name = void 0;
  96029. this.semantic = void 0;
  96030. this.setIndex = void 0;
  96031. this.componentDatatype = void 0;
  96032. this.type = void 0;
  96033. this.normalized = false;
  96034. this.count = void 0;
  96035. this.min = void 0;
  96036. this.max = void 0;
  96037. this.constant = void 0;
  96038. this.quantization = void 0;
  96039. this.packedTypedArray = void 0;
  96040. this.buffer = void 0;
  96041. this.typedArray = void 0;
  96042. this.byteOffset = 0;
  96043. this.byteStride = void 0;
  96044. }
  96045. function Indices() {
  96046. this.indexDatatype = void 0;
  96047. this.count = void 0;
  96048. this.buffer = void 0;
  96049. this.typedArray = void 0;
  96050. }
  96051. function FeatureIdAttribute() {
  96052. this.featureCount = void 0;
  96053. this.nullFeatureId = void 0;
  96054. this.propertyTableId = void 0;
  96055. this.setIndex = void 0;
  96056. this.label = void 0;
  96057. this.positionalLabel = void 0;
  96058. }
  96059. function FeatureIdImplicitRange() {
  96060. this.featureCount = void 0;
  96061. this.nullFeatureId = void 0;
  96062. this.propertyTableId = void 0;
  96063. this.offset = 0;
  96064. this.repeat = void 0;
  96065. this.label = void 0;
  96066. this.positionalLabel = void 0;
  96067. }
  96068. function FeatureIdTexture() {
  96069. this.featureCount = void 0;
  96070. this.nullFeatureId = void 0;
  96071. this.propertyTableId = void 0;
  96072. this.textureReader = void 0;
  96073. this.label = void 0;
  96074. this.positionalLabel = void 0;
  96075. }
  96076. function MorphTarget() {
  96077. this.attributes = [];
  96078. }
  96079. function Primitive2() {
  96080. this.attributes = [];
  96081. this.morphTargets = [];
  96082. this.indices = void 0;
  96083. this.material = void 0;
  96084. this.primitiveType = void 0;
  96085. this.featureIds = [];
  96086. this.propertyTextureIds = [];
  96087. this.propertyAttributeIds = [];
  96088. }
  96089. function Instances() {
  96090. this.attributes = [];
  96091. this.featureIds = [];
  96092. this.transformInWorldSpace = false;
  96093. }
  96094. function Skin() {
  96095. this.index = void 0;
  96096. this.joints = [];
  96097. this.inverseBindMatrices = [];
  96098. }
  96099. function Node4() {
  96100. this.name = void 0;
  96101. this.index = void 0;
  96102. this.children = [];
  96103. this.primitives = [];
  96104. this.instances = void 0;
  96105. this.skin = void 0;
  96106. this.matrix = void 0;
  96107. this.translation = void 0;
  96108. this.rotation = void 0;
  96109. this.scale = void 0;
  96110. this.morphWeights = [];
  96111. }
  96112. function Scene() {
  96113. this.nodes = [];
  96114. }
  96115. var AnimatedPropertyType = {
  96116. TRANSLATION: "translation",
  96117. ROTATION: "rotation",
  96118. SCALE: "scale",
  96119. WEIGHTS: "weights"
  96120. };
  96121. function AnimationSampler() {
  96122. this.input = [];
  96123. this.interpolation = void 0;
  96124. this.output = [];
  96125. }
  96126. function AnimationTarget() {
  96127. this.node = void 0;
  96128. this.path = void 0;
  96129. }
  96130. function AnimationChannel() {
  96131. this.sampler = void 0;
  96132. this.target = void 0;
  96133. }
  96134. function Animation() {
  96135. this.name = void 0;
  96136. this.samplers = [];
  96137. this.channels = [];
  96138. }
  96139. function Asset() {
  96140. this.credits = [];
  96141. }
  96142. function Components() {
  96143. this.asset = new Asset();
  96144. this.scene = void 0;
  96145. this.nodes = [];
  96146. this.skins = [];
  96147. this.animations = [];
  96148. this.structuralMetadata = void 0;
  96149. this.upAxis = void 0;
  96150. this.forwardAxis = void 0;
  96151. this.transform = Matrix4_default.clone(Matrix4_default.IDENTITY);
  96152. }
  96153. function TextureReader() {
  96154. this.texture = void 0;
  96155. this.index = void 0;
  96156. this.texCoord = 0;
  96157. this.transform = Matrix3_default.clone(Matrix3_default.IDENTITY);
  96158. this.channels = void 0;
  96159. }
  96160. function MetallicRoughness() {
  96161. this.baseColorTexture = void 0;
  96162. this.metallicRoughnessTexture = void 0;
  96163. this.baseColorFactor = Cartesian4_default.clone(
  96164. MetallicRoughness.DEFAULT_BASE_COLOR_FACTOR
  96165. );
  96166. this.metallicFactor = MetallicRoughness.DEFAULT_METALLIC_FACTOR;
  96167. this.roughnessFactor = MetallicRoughness.DEFAULT_ROUGHNESS_FACTOR;
  96168. }
  96169. MetallicRoughness.DEFAULT_BASE_COLOR_FACTOR = Cartesian4_default.ONE;
  96170. MetallicRoughness.DEFAULT_METALLIC_FACTOR = 1;
  96171. MetallicRoughness.DEFAULT_ROUGHNESS_FACTOR = 1;
  96172. function SpecularGlossiness() {
  96173. this.diffuseTexture = void 0;
  96174. this.specularGlossinessTexture = void 0;
  96175. this.diffuseFactor = Cartesian4_default.clone(
  96176. SpecularGlossiness.DEFAULT_DIFFUSE_FACTOR
  96177. );
  96178. this.specularFactor = Cartesian3_default.clone(
  96179. SpecularGlossiness.DEFAULT_SPECULAR_FACTOR
  96180. );
  96181. this.glossinessFactor = SpecularGlossiness.DEFAULT_GLOSSINESS_FACTOR;
  96182. }
  96183. SpecularGlossiness.DEFAULT_DIFFUSE_FACTOR = Cartesian4_default.ONE;
  96184. SpecularGlossiness.DEFAULT_SPECULAR_FACTOR = Cartesian3_default.ONE;
  96185. SpecularGlossiness.DEFAULT_GLOSSINESS_FACTOR = 1;
  96186. function Material2() {
  96187. this.metallicRoughness = new MetallicRoughness();
  96188. this.specularGlossiness = void 0;
  96189. this.emissiveTexture = void 0;
  96190. this.normalTexture = void 0;
  96191. this.occlusionTexture = void 0;
  96192. this.emissiveFactor = Cartesian3_default.clone(Material2.DEFAULT_EMISSIVE_FACTOR);
  96193. this.alphaMode = AlphaMode_default.OPAQUE;
  96194. this.alphaCutoff = 0.5;
  96195. this.doubleSided = false;
  96196. this.unlit = false;
  96197. }
  96198. Material2.DEFAULT_EMISSIVE_FACTOR = Cartesian3_default.ZERO;
  96199. ModelComponents.Quantization = Quantization;
  96200. ModelComponents.Attribute = Attribute;
  96201. ModelComponents.Indices = Indices;
  96202. ModelComponents.FeatureIdAttribute = FeatureIdAttribute;
  96203. ModelComponents.FeatureIdTexture = FeatureIdTexture;
  96204. ModelComponents.FeatureIdImplicitRange = FeatureIdImplicitRange;
  96205. ModelComponents.MorphTarget = MorphTarget;
  96206. ModelComponents.Primitive = Primitive2;
  96207. ModelComponents.Instances = Instances;
  96208. ModelComponents.Skin = Skin;
  96209. ModelComponents.Node = Node4;
  96210. ModelComponents.Scene = Scene;
  96211. ModelComponents.AnimatedPropertyType = Object.freeze(AnimatedPropertyType);
  96212. ModelComponents.AnimationSampler = AnimationSampler;
  96213. ModelComponents.AnimationTarget = AnimationTarget;
  96214. ModelComponents.AnimationChannel = AnimationChannel;
  96215. ModelComponents.Animation = Animation;
  96216. ModelComponents.Asset = Asset;
  96217. ModelComponents.Components = Components;
  96218. ModelComponents.TextureReader = TextureReader;
  96219. ModelComponents.MetallicRoughness = MetallicRoughness;
  96220. ModelComponents.SpecularGlossiness = SpecularGlossiness;
  96221. ModelComponents.Material = Material2;
  96222. var ModelComponents_default = ModelComponents;
  96223. // node_modules/cesium/Source/Scene/GltfLoaderUtil.js
  96224. var GltfLoaderUtil = {};
  96225. GltfLoaderUtil.getImageIdFromTexture = function(options) {
  96226. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  96227. const gltf = options.gltf;
  96228. const textureId = options.textureId;
  96229. const supportedImageFormats = options.supportedImageFormats;
  96230. Check_default.typeOf.object("options.gltf", gltf);
  96231. Check_default.typeOf.number("options.textureId", textureId);
  96232. Check_default.typeOf.object("options.supportedImageFormats", supportedImageFormats);
  96233. const texture = gltf.textures[textureId];
  96234. const extensions = texture.extensions;
  96235. if (defined_default(extensions)) {
  96236. if (supportedImageFormats.webp && defined_default(extensions.EXT_texture_webp)) {
  96237. return extensions.EXT_texture_webp.source;
  96238. } else if (supportedImageFormats.basis && defined_default(extensions.KHR_texture_basisu)) {
  96239. return extensions.KHR_texture_basisu.source;
  96240. }
  96241. }
  96242. return texture.source;
  96243. };
  96244. GltfLoaderUtil.createSampler = function(options) {
  96245. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  96246. const gltf = options.gltf;
  96247. const textureInfo = options.textureInfo;
  96248. const compressedTextureNoMipmap = defaultValue_default(
  96249. options.compressedTextureNoMipmap,
  96250. false
  96251. );
  96252. Check_default.typeOf.object("options.gltf", gltf);
  96253. Check_default.typeOf.object("options.textureInfo", textureInfo);
  96254. let wrapS = TextureWrap_default.REPEAT;
  96255. let wrapT = TextureWrap_default.REPEAT;
  96256. let minFilter = TextureMinificationFilter_default.LINEAR;
  96257. let magFilter = TextureMagnificationFilter_default.LINEAR;
  96258. const textureId = textureInfo.index;
  96259. const texture = gltf.textures[textureId];
  96260. const samplerId = texture.sampler;
  96261. if (defined_default(samplerId)) {
  96262. const sampler = gltf.samplers[samplerId];
  96263. wrapS = defaultValue_default(sampler.wrapS, wrapS);
  96264. wrapT = defaultValue_default(sampler.wrapT, wrapT);
  96265. minFilter = defaultValue_default(sampler.minFilter, minFilter);
  96266. magFilter = defaultValue_default(sampler.magFilter, magFilter);
  96267. }
  96268. let usesTextureTransform = false;
  96269. const extensions = textureInfo.extensions;
  96270. if (defined_default(extensions) && defined_default(extensions.KHR_texture_transform)) {
  96271. usesTextureTransform = true;
  96272. }
  96273. if ((compressedTextureNoMipmap || usesTextureTransform) && minFilter !== TextureMinificationFilter_default.LINEAR && minFilter !== TextureMinificationFilter_default.NEAREST) {
  96274. if (minFilter === TextureMinificationFilter_default.NEAREST_MIPMAP_NEAREST || minFilter === TextureMinificationFilter_default.NEAREST_MIPMAP_LINEAR) {
  96275. minFilter = TextureMinificationFilter_default.NEAREST;
  96276. } else {
  96277. minFilter = TextureMinificationFilter_default.LINEAR;
  96278. }
  96279. }
  96280. return new Sampler_default({
  96281. wrapS,
  96282. wrapT,
  96283. minificationFilter: minFilter,
  96284. magnificationFilter: magFilter
  96285. });
  96286. };
  96287. var defaultScale3 = new Cartesian2_default(1, 1);
  96288. GltfLoaderUtil.createModelTextureReader = function(options) {
  96289. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  96290. const textureInfo = options.textureInfo;
  96291. const channels = options.channels;
  96292. const texture = options.texture;
  96293. Check_default.typeOf.object("options.textureInfo", textureInfo);
  96294. let texCoord = defaultValue_default(textureInfo.texCoord, 0);
  96295. let transform4;
  96296. const textureTransform = defaultValue_default(
  96297. textureInfo.extensions,
  96298. defaultValue_default.EMPTY_OBJECT
  96299. ).KHR_texture_transform;
  96300. if (defined_default(textureTransform)) {
  96301. texCoord = defaultValue_default(textureTransform.texCoord, texCoord);
  96302. const offset2 = defined_default(textureTransform.offset) ? Cartesian2_default.unpack(textureTransform.offset) : Cartesian2_default.ZERO;
  96303. let rotation = defaultValue_default(textureTransform.rotation, 0);
  96304. const scale = defined_default(textureTransform.scale) ? Cartesian2_default.unpack(textureTransform.scale) : defaultScale3;
  96305. rotation = -rotation;
  96306. transform4 = new Matrix3_default(
  96307. Math.cos(rotation) * scale.x,
  96308. -Math.sin(rotation) * scale.y,
  96309. offset2.x,
  96310. Math.sin(rotation) * scale.x,
  96311. Math.cos(rotation) * scale.y,
  96312. offset2.y,
  96313. 0,
  96314. 0,
  96315. 1
  96316. );
  96317. }
  96318. const modelTextureReader = new ModelComponents_default.TextureReader();
  96319. modelTextureReader.index = textureInfo.index;
  96320. modelTextureReader.texture = texture;
  96321. modelTextureReader.texCoord = texCoord;
  96322. modelTextureReader.transform = transform4;
  96323. modelTextureReader.channels = channels;
  96324. return modelTextureReader;
  96325. };
  96326. var GltfLoaderUtil_default = GltfLoaderUtil;
  96327. // node_modules/cesium/Source/Scene/GltfTextureLoader.js
  96328. function GltfTextureLoader(options) {
  96329. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  96330. const resourceCache = options.resourceCache;
  96331. const gltf = options.gltf;
  96332. const textureInfo = options.textureInfo;
  96333. const gltfResource = options.gltfResource;
  96334. const baseResource2 = options.baseResource;
  96335. const supportedImageFormats = options.supportedImageFormats;
  96336. const cacheKey = options.cacheKey;
  96337. const asynchronous = defaultValue_default(options.asynchronous, true);
  96338. Check_default.typeOf.func("options.resourceCache", resourceCache);
  96339. Check_default.typeOf.object("options.gltf", gltf);
  96340. Check_default.typeOf.object("options.textureInfo", textureInfo);
  96341. Check_default.typeOf.object("options.gltfResource", gltfResource);
  96342. Check_default.typeOf.object("options.baseResource", baseResource2);
  96343. Check_default.typeOf.object("options.supportedImageFormats", supportedImageFormats);
  96344. const textureId = textureInfo.index;
  96345. const imageId = GltfLoaderUtil_default.getImageIdFromTexture({
  96346. gltf,
  96347. textureId,
  96348. supportedImageFormats
  96349. });
  96350. this._resourceCache = resourceCache;
  96351. this._gltf = gltf;
  96352. this._textureInfo = textureInfo;
  96353. this._imageId = imageId;
  96354. this._gltfResource = gltfResource;
  96355. this._baseResource = baseResource2;
  96356. this._cacheKey = cacheKey;
  96357. this._asynchronous = asynchronous;
  96358. this._imageLoader = void 0;
  96359. this._image = void 0;
  96360. this._mipLevels = void 0;
  96361. this._texture = void 0;
  96362. this._state = ResourceLoaderState_default.UNLOADED;
  96363. this._promise = defer_default();
  96364. }
  96365. if (defined_default(Object.create)) {
  96366. GltfTextureLoader.prototype = Object.create(ResourceLoader.prototype);
  96367. GltfTextureLoader.prototype.constructor = GltfTextureLoader;
  96368. }
  96369. Object.defineProperties(GltfTextureLoader.prototype, {
  96370. promise: {
  96371. get: function() {
  96372. return this._promise.promise;
  96373. }
  96374. },
  96375. cacheKey: {
  96376. get: function() {
  96377. return this._cacheKey;
  96378. }
  96379. },
  96380. texture: {
  96381. get: function() {
  96382. return this._texture;
  96383. }
  96384. }
  96385. });
  96386. GltfTextureLoader.prototype.load = function() {
  96387. const resourceCache = this._resourceCache;
  96388. const imageLoader = resourceCache.loadImage({
  96389. gltf: this._gltf,
  96390. imageId: this._imageId,
  96391. gltfResource: this._gltfResource,
  96392. baseResource: this._baseResource
  96393. });
  96394. this._imageLoader = imageLoader;
  96395. this._state = ResourceLoaderState_default.LOADING;
  96396. const that = this;
  96397. imageLoader.promise.then(function() {
  96398. if (that.isDestroyed()) {
  96399. return;
  96400. }
  96401. that._image = imageLoader.image;
  96402. that._mipLevels = imageLoader.mipLevels;
  96403. that._state = ResourceLoaderState_default.PROCESSING;
  96404. }).catch(function(error) {
  96405. if (that.isDestroyed()) {
  96406. return;
  96407. }
  96408. that.unload();
  96409. that._state = ResourceLoaderState_default.FAILED;
  96410. const errorMessage = "Failed to load texture";
  96411. that._promise.reject(that.getError(errorMessage, error));
  96412. });
  96413. };
  96414. function CreateTextureJob2() {
  96415. this.gltf = void 0;
  96416. this.textureInfo = void 0;
  96417. this.image = void 0;
  96418. this.context = void 0;
  96419. this.texture = void 0;
  96420. }
  96421. CreateTextureJob2.prototype.set = function(gltf, textureInfo, image, mipLevels, context) {
  96422. this.gltf = gltf;
  96423. this.textureInfo = textureInfo;
  96424. this.image = image;
  96425. this.mipLevels = mipLevels;
  96426. this.context = context;
  96427. };
  96428. CreateTextureJob2.prototype.execute = function() {
  96429. this.texture = createTexture5(
  96430. this.gltf,
  96431. this.textureInfo,
  96432. this.image,
  96433. this.mipLevels,
  96434. this.context
  96435. );
  96436. };
  96437. function resizeImageToNextPowerOfTwo(image) {
  96438. const canvas = document.createElement("canvas");
  96439. canvas.width = Math_default.nextPowerOfTwo(image.width);
  96440. canvas.height = Math_default.nextPowerOfTwo(image.height);
  96441. const canvasContext = canvas.getContext("2d");
  96442. canvasContext.drawImage(
  96443. image,
  96444. 0,
  96445. 0,
  96446. image.width,
  96447. image.height,
  96448. 0,
  96449. 0,
  96450. canvas.width,
  96451. canvas.height
  96452. );
  96453. return canvas;
  96454. }
  96455. function createTexture5(gltf, textureInfo, image, mipLevels, context) {
  96456. const internalFormat = image.internalFormat;
  96457. let compressedTextureNoMipmap = false;
  96458. if (PixelFormat_default.isCompressedFormat(internalFormat) && !defined_default(mipLevels)) {
  96459. compressedTextureNoMipmap = true;
  96460. }
  96461. const sampler = GltfLoaderUtil_default.createSampler({
  96462. gltf,
  96463. textureInfo,
  96464. compressedTextureNoMipmap
  96465. });
  96466. const minFilter = sampler.minificationFilter;
  96467. const wrapS = sampler.wrapS;
  96468. const wrapT = sampler.wrapT;
  96469. const samplerRequiresMipmap = minFilter === TextureMinificationFilter_default.NEAREST_MIPMAP_NEAREST || minFilter === TextureMinificationFilter_default.NEAREST_MIPMAP_LINEAR || minFilter === TextureMinificationFilter_default.LINEAR_MIPMAP_NEAREST || minFilter === TextureMinificationFilter_default.LINEAR_MIPMAP_LINEAR;
  96470. const generateMipmap = !defined_default(internalFormat) && samplerRequiresMipmap;
  96471. const requiresPowerOfTwo = generateMipmap || wrapS === TextureWrap_default.REPEAT || wrapS === TextureWrap_default.MIRRORED_REPEAT || wrapT === TextureWrap_default.REPEAT || wrapT === TextureWrap_default.MIRRORED_REPEAT;
  96472. const nonPowerOfTwo = !Math_default.isPowerOfTwo(image.width) || !Math_default.isPowerOfTwo(image.height);
  96473. const requiresResize = requiresPowerOfTwo && nonPowerOfTwo;
  96474. let texture;
  96475. if (defined_default(internalFormat)) {
  96476. if (!context.webgl2 && PixelFormat_default.isCompressedFormat(internalFormat) && nonPowerOfTwo && requiresPowerOfTwo) {
  96477. console.warn(
  96478. "Compressed texture uses REPEAT or MIRRORED_REPEAT texture wrap mode and dimensions are not powers of two. The texture may be rendered incorrectly."
  96479. );
  96480. }
  96481. texture = Texture_default.create({
  96482. context,
  96483. source: {
  96484. arrayBufferView: image.bufferView,
  96485. mipLevels
  96486. },
  96487. width: image.width,
  96488. height: image.height,
  96489. pixelFormat: image.internalFormat,
  96490. sampler
  96491. });
  96492. } else {
  96493. if (requiresResize) {
  96494. image = resizeImageToNextPowerOfTwo(image);
  96495. }
  96496. texture = Texture_default.create({
  96497. context,
  96498. source: image,
  96499. sampler,
  96500. flipY: false,
  96501. skipColorSpaceConversion: true
  96502. });
  96503. }
  96504. if (generateMipmap) {
  96505. texture.generateMipmap();
  96506. }
  96507. return texture;
  96508. }
  96509. var scratchTextureJob = new CreateTextureJob2();
  96510. GltfTextureLoader.prototype.process = function(frameState) {
  96511. Check_default.typeOf.object("frameState", frameState);
  96512. if (defined_default(this._texture)) {
  96513. return;
  96514. }
  96515. if (!defined_default(this._image)) {
  96516. return;
  96517. }
  96518. let texture;
  96519. if (this._asynchronous) {
  96520. const textureJob = scratchTextureJob;
  96521. textureJob.set(
  96522. this._gltf,
  96523. this._textureInfo,
  96524. this._image,
  96525. this._mipLevels,
  96526. frameState.context
  96527. );
  96528. const jobScheduler = frameState.jobScheduler;
  96529. if (!jobScheduler.execute(textureJob, JobType_default.TEXTURE)) {
  96530. return;
  96531. }
  96532. texture = textureJob.texture;
  96533. } else {
  96534. texture = createTexture5(
  96535. this._gltf,
  96536. this._textureInfo,
  96537. this._image,
  96538. this._mipLevels,
  96539. frameState.context
  96540. );
  96541. }
  96542. this.unload();
  96543. this._texture = texture;
  96544. this._state = ResourceLoaderState_default.READY;
  96545. this._promise.resolve(this);
  96546. };
  96547. GltfTextureLoader.prototype.unload = function() {
  96548. if (defined_default(this._texture)) {
  96549. this._texture.destroy();
  96550. }
  96551. if (defined_default(this._imageLoader)) {
  96552. this._resourceCache.unload(this._imageLoader);
  96553. }
  96554. this._imageLoader = void 0;
  96555. this._image = void 0;
  96556. this._mipLevels = void 0;
  96557. this._texture = void 0;
  96558. this._gltf = void 0;
  96559. };
  96560. // node_modules/cesium/Source/Scene/GltfVertexBufferLoader.js
  96561. function GltfVertexBufferLoader(options) {
  96562. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  96563. const resourceCache = options.resourceCache;
  96564. const gltf = options.gltf;
  96565. const gltfResource = options.gltfResource;
  96566. const baseResource2 = options.baseResource;
  96567. const bufferViewId = options.bufferViewId;
  96568. const draco = options.draco;
  96569. const attributeSemantic = options.attributeSemantic;
  96570. const accessorId = options.accessorId;
  96571. const cacheKey = options.cacheKey;
  96572. const asynchronous = defaultValue_default(options.asynchronous, true);
  96573. const dequantize = defaultValue_default(options.dequantize, false);
  96574. const loadAsTypedArray = defaultValue_default(options.loadAsTypedArray, false);
  96575. Check_default.typeOf.func("options.resourceCache", resourceCache);
  96576. Check_default.typeOf.object("options.gltf", gltf);
  96577. Check_default.typeOf.object("options.gltfResource", gltfResource);
  96578. Check_default.typeOf.object("options.baseResource", baseResource2);
  96579. const hasBufferViewId = defined_default(bufferViewId);
  96580. const hasDraco = defined_default(draco);
  96581. const hasAttributeSemantic = defined_default(attributeSemantic);
  96582. const hasAccessorId = defined_default(accessorId);
  96583. if (hasBufferViewId === hasDraco) {
  96584. throw new DeveloperError_default(
  96585. "One of options.bufferViewId and options.draco must be defined."
  96586. );
  96587. }
  96588. if (hasDraco && !hasAttributeSemantic) {
  96589. throw new DeveloperError_default(
  96590. "When options.draco is defined options.attributeSemantic must also be defined."
  96591. );
  96592. }
  96593. if (hasDraco && !hasAccessorId) {
  96594. throw new DeveloperError_default(
  96595. "When options.draco is defined options.accessorId must also be defined."
  96596. );
  96597. }
  96598. if (hasDraco) {
  96599. Check_default.typeOf.object("options.draco", draco);
  96600. Check_default.typeOf.string("options.attributeSemantic", attributeSemantic);
  96601. Check_default.typeOf.number("options.accessorId", accessorId);
  96602. }
  96603. this._resourceCache = resourceCache;
  96604. this._gltfResource = gltfResource;
  96605. this._baseResource = baseResource2;
  96606. this._gltf = gltf;
  96607. this._bufferViewId = bufferViewId;
  96608. this._draco = draco;
  96609. this._attributeSemantic = attributeSemantic;
  96610. this._accessorId = accessorId;
  96611. this._cacheKey = cacheKey;
  96612. this._asynchronous = asynchronous;
  96613. this._dequantize = dequantize;
  96614. this._loadAsTypedArray = loadAsTypedArray;
  96615. this._bufferViewLoader = void 0;
  96616. this._dracoLoader = void 0;
  96617. this._quantization = void 0;
  96618. this._typedArray = void 0;
  96619. this._buffer = void 0;
  96620. this._state = ResourceLoaderState_default.UNLOADED;
  96621. this._promise = defer_default();
  96622. }
  96623. if (defined_default(Object.create)) {
  96624. GltfVertexBufferLoader.prototype = Object.create(ResourceLoader.prototype);
  96625. GltfVertexBufferLoader.prototype.constructor = GltfVertexBufferLoader;
  96626. }
  96627. Object.defineProperties(GltfVertexBufferLoader.prototype, {
  96628. promise: {
  96629. get: function() {
  96630. return this._promise.promise;
  96631. }
  96632. },
  96633. cacheKey: {
  96634. get: function() {
  96635. return this._cacheKey;
  96636. }
  96637. },
  96638. buffer: {
  96639. get: function() {
  96640. return this._buffer;
  96641. }
  96642. },
  96643. typedArray: {
  96644. get: function() {
  96645. return this._typedArray;
  96646. }
  96647. },
  96648. quantization: {
  96649. get: function() {
  96650. return this._quantization;
  96651. }
  96652. }
  96653. });
  96654. GltfVertexBufferLoader.prototype.load = function() {
  96655. if (defined_default(this._draco)) {
  96656. loadFromDraco2(this);
  96657. } else {
  96658. loadFromBufferView3(this);
  96659. }
  96660. };
  96661. function getQuantizationInformation(dracoQuantization, componentDatatype, componentCount, type) {
  96662. const quantizationBits = dracoQuantization.quantizationBits;
  96663. const normalizationRange = (1 << quantizationBits) - 1;
  96664. const normalizationDivisor = 1 / normalizationRange;
  96665. const quantization = new ModelComponents_default.Quantization();
  96666. quantization.componentDatatype = componentDatatype;
  96667. quantization.octEncoded = dracoQuantization.octEncoded;
  96668. quantization.octEncodedZXY = true;
  96669. quantization.type = type;
  96670. if (quantization.octEncoded) {
  96671. quantization.type = AttributeType_default.VEC2;
  96672. quantization.normalizationRange = normalizationRange;
  96673. } else {
  96674. const MathType = AttributeType_default.getMathType(type);
  96675. if (MathType === Number) {
  96676. const dimensions = dracoQuantization.range;
  96677. quantization.quantizedVolumeOffset = dracoQuantization.minValues[0];
  96678. quantization.quantizedVolumeDimensions = dimensions;
  96679. quantization.normalizationRange = normalizationRange;
  96680. quantization.quantizedVolumeStepSize = dimensions * normalizationDivisor;
  96681. } else {
  96682. quantization.quantizedVolumeOffset = MathType.unpack(
  96683. dracoQuantization.minValues
  96684. );
  96685. quantization.normalizationRange = MathType.unpack(
  96686. arrayFill_default(new Array(componentCount), normalizationRange)
  96687. );
  96688. const packedDimensions = arrayFill_default(
  96689. new Array(componentCount),
  96690. dracoQuantization.range
  96691. );
  96692. quantization.quantizedVolumeDimensions = MathType.unpack(
  96693. packedDimensions
  96694. );
  96695. const packedSteps = packedDimensions.map(function(dimension) {
  96696. return dimension * normalizationDivisor;
  96697. });
  96698. quantization.quantizedVolumeStepSize = MathType.unpack(packedSteps);
  96699. }
  96700. }
  96701. return quantization;
  96702. }
  96703. function loadFromDraco2(vertexBufferLoader) {
  96704. const resourceCache = vertexBufferLoader._resourceCache;
  96705. const dracoLoader = resourceCache.loadDraco({
  96706. gltf: vertexBufferLoader._gltf,
  96707. draco: vertexBufferLoader._draco,
  96708. gltfResource: vertexBufferLoader._gltfResource,
  96709. baseResource: vertexBufferLoader._baseResource
  96710. });
  96711. vertexBufferLoader._dracoLoader = dracoLoader;
  96712. vertexBufferLoader._state = ResourceLoaderState_default.LOADING;
  96713. dracoLoader.promise.then(function() {
  96714. if (vertexBufferLoader.isDestroyed()) {
  96715. return;
  96716. }
  96717. const decodedVertexAttributes = dracoLoader.decodedData.vertexAttributes;
  96718. const attributeSemantic = vertexBufferLoader._attributeSemantic;
  96719. const dracoAttribute = decodedVertexAttributes[attributeSemantic];
  96720. const accessorId = vertexBufferLoader._accessorId;
  96721. const accessor = vertexBufferLoader._gltf.accessors[accessorId];
  96722. const type = accessor.type;
  96723. const typedArray = dracoAttribute.array;
  96724. const dracoQuantization = dracoAttribute.data.quantization;
  96725. if (defined_default(dracoQuantization)) {
  96726. vertexBufferLoader._quantization = getQuantizationInformation(
  96727. dracoQuantization,
  96728. dracoAttribute.data.componentDatatype,
  96729. dracoAttribute.data.componentsPerAttribute,
  96730. type
  96731. );
  96732. }
  96733. vertexBufferLoader._typedArray = typedArray;
  96734. vertexBufferLoader._state = ResourceLoaderState_default.PROCESSING;
  96735. }).catch(function(error) {
  96736. if (vertexBufferLoader.isDestroyed()) {
  96737. return;
  96738. }
  96739. handleError5(vertexBufferLoader, error);
  96740. });
  96741. }
  96742. function loadFromBufferView3(vertexBufferLoader) {
  96743. const resourceCache = vertexBufferLoader._resourceCache;
  96744. const bufferViewLoader = resourceCache.loadBufferView({
  96745. gltf: vertexBufferLoader._gltf,
  96746. bufferViewId: vertexBufferLoader._bufferViewId,
  96747. gltfResource: vertexBufferLoader._gltfResource,
  96748. baseResource: vertexBufferLoader._baseResource
  96749. });
  96750. vertexBufferLoader._state = ResourceLoaderState_default.LOADING;
  96751. vertexBufferLoader._bufferViewLoader = bufferViewLoader;
  96752. bufferViewLoader.promise.then(function() {
  96753. if (vertexBufferLoader.isDestroyed()) {
  96754. return;
  96755. }
  96756. vertexBufferLoader._typedArray = bufferViewLoader.typedArray;
  96757. vertexBufferLoader._state = ResourceLoaderState_default.PROCESSING;
  96758. }).catch(function(error) {
  96759. if (vertexBufferLoader.isDestroyed()) {
  96760. return;
  96761. }
  96762. handleError5(vertexBufferLoader, error);
  96763. });
  96764. }
  96765. function handleError5(vertexBufferLoader, error) {
  96766. vertexBufferLoader.unload();
  96767. vertexBufferLoader._state = ResourceLoaderState_default.FAILED;
  96768. const errorMessage = "Failed to load vertex buffer";
  96769. error = vertexBufferLoader.getError(errorMessage, error);
  96770. vertexBufferLoader._promise.reject(error);
  96771. }
  96772. function CreateVertexBufferJob2() {
  96773. this.typedArray = void 0;
  96774. this.dequantize = void 0;
  96775. this.componentType = void 0;
  96776. this.type = void 0;
  96777. this.count = void 0;
  96778. this.context = void 0;
  96779. this.buffer = void 0;
  96780. }
  96781. CreateVertexBufferJob2.prototype.set = function(typedArray, dequantize, componentType, type, count, context) {
  96782. this.typedArray = typedArray;
  96783. this.dequantize = dequantize;
  96784. this.componentType = componentType;
  96785. this.type = type;
  96786. this.count = count;
  96787. this.context = context;
  96788. };
  96789. CreateVertexBufferJob2.prototype.execute = function() {
  96790. this.buffer = createVertexBuffer3(
  96791. this.typedArray,
  96792. this.dequantize,
  96793. this.componentType,
  96794. this.type,
  96795. this.count,
  96796. this.context
  96797. );
  96798. };
  96799. function createVertexBuffer3(typedArray, dequantize, componentType, type, count, context) {
  96800. if (dequantize && componentType !== ComponentDatatype_default.FLOAT) {
  96801. typedArray = AttributeCompression_default.dequantize(
  96802. typedArray,
  96803. componentType,
  96804. type,
  96805. count
  96806. );
  96807. }
  96808. const buffer = Buffer_default.createVertexBuffer({
  96809. typedArray,
  96810. context,
  96811. usage: BufferUsage_default.STATIC_DRAW
  96812. });
  96813. buffer.vertexArrayDestroyable = false;
  96814. return buffer;
  96815. }
  96816. var scratchVertexBufferJob2 = new CreateVertexBufferJob2();
  96817. GltfVertexBufferLoader.prototype.process = function(frameState) {
  96818. Check_default.typeOf.object("frameState", frameState);
  96819. if (this._state === ResourceLoaderState_default.READY) {
  96820. return;
  96821. }
  96822. const typedArray = this._typedArray;
  96823. const dequantize = this._dequantize;
  96824. if (defined_default(this._dracoLoader)) {
  96825. this._dracoLoader.process(frameState);
  96826. }
  96827. if (defined_default(this._bufferViewLoader)) {
  96828. this._bufferViewLoader.process(frameState);
  96829. }
  96830. if (!defined_default(typedArray)) {
  96831. return;
  96832. }
  96833. if (this._loadAsTypedArray) {
  96834. this.unload();
  96835. this._typedArray = typedArray;
  96836. this._state = ResourceLoaderState_default.READY;
  96837. this._promise.resolve(this);
  96838. return;
  96839. }
  96840. const accessor = this._gltf.accessors[this._accessorId];
  96841. let buffer;
  96842. if (this._asynchronous) {
  96843. const vertexBufferJob = scratchVertexBufferJob2;
  96844. vertexBufferJob.set(
  96845. typedArray,
  96846. dequantize,
  96847. accessor.componentType,
  96848. accessor.type,
  96849. accessor.count,
  96850. frameState.context
  96851. );
  96852. const jobScheduler = frameState.jobScheduler;
  96853. if (!jobScheduler.execute(vertexBufferJob, JobType_default.BUFFER)) {
  96854. return;
  96855. }
  96856. buffer = vertexBufferJob.buffer;
  96857. } else {
  96858. buffer = createVertexBuffer3(
  96859. typedArray,
  96860. dequantize,
  96861. accessor.componentType,
  96862. accessor.type,
  96863. accessor.count,
  96864. frameState.context
  96865. );
  96866. }
  96867. this.unload();
  96868. this._buffer = buffer;
  96869. this._state = ResourceLoaderState_default.READY;
  96870. this._promise.resolve(this);
  96871. };
  96872. GltfVertexBufferLoader.prototype.unload = function() {
  96873. if (defined_default(this._buffer)) {
  96874. this._buffer.destroy();
  96875. }
  96876. const resourceCache = this._resourceCache;
  96877. if (defined_default(this._bufferViewLoader)) {
  96878. resourceCache.unload(this._bufferViewLoader);
  96879. }
  96880. if (defined_default(this._dracoLoader)) {
  96881. resourceCache.unload(this._dracoLoader);
  96882. }
  96883. this._bufferViewLoader = void 0;
  96884. this._dracoLoader = void 0;
  96885. this._typedArray = void 0;
  96886. this._buffer = void 0;
  96887. this._gltf = void 0;
  96888. };
  96889. // node_modules/cesium/Source/Scene/MetadataClass.js
  96890. function MetadataClass(options) {
  96891. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  96892. const id = options.id;
  96893. const classDefinition = options.class;
  96894. Check_default.typeOf.string("options.id", id);
  96895. Check_default.typeOf.object("options.class", classDefinition);
  96896. const properties = {};
  96897. const propertiesBySemantic = {};
  96898. for (const propertyId in classDefinition.properties) {
  96899. if (classDefinition.properties.hasOwnProperty(propertyId)) {
  96900. const property = new MetadataClassProperty_default({
  96901. id: propertyId,
  96902. property: classDefinition.properties[propertyId],
  96903. enums: options.enums
  96904. });
  96905. properties[propertyId] = property;
  96906. if (defined_default(property.semantic)) {
  96907. propertiesBySemantic[property.semantic] = property;
  96908. }
  96909. }
  96910. }
  96911. this._properties = properties;
  96912. this._propertiesBySemantic = propertiesBySemantic;
  96913. this._id = id;
  96914. this._name = classDefinition.name;
  96915. this._description = classDefinition.description;
  96916. this._extras = classDefinition.extras;
  96917. this._extensions = classDefinition.extensions;
  96918. }
  96919. Object.defineProperties(MetadataClass.prototype, {
  96920. properties: {
  96921. get: function() {
  96922. return this._properties;
  96923. }
  96924. },
  96925. propertiesBySemantic: {
  96926. get: function() {
  96927. return this._propertiesBySemantic;
  96928. }
  96929. },
  96930. id: {
  96931. get: function() {
  96932. return this._id;
  96933. }
  96934. },
  96935. name: {
  96936. get: function() {
  96937. return this._name;
  96938. }
  96939. },
  96940. description: {
  96941. get: function() {
  96942. return this._description;
  96943. }
  96944. },
  96945. extras: {
  96946. get: function() {
  96947. return this._extras;
  96948. }
  96949. },
  96950. extensions: {
  96951. get: function() {
  96952. return this._extensions;
  96953. }
  96954. }
  96955. });
  96956. MetadataClass.BATCH_TABLE_CLASS_NAME = "_batchTable";
  96957. var MetadataClass_default = MetadataClass;
  96958. // node_modules/cesium/Source/Scene/MetadataEnumValue.js
  96959. function MetadataEnumValue(value) {
  96960. Check_default.typeOf.object("value", value);
  96961. this._value = value.value;
  96962. this._name = value.name;
  96963. this._description = value.description;
  96964. this._extras = value.extras;
  96965. this._extensions = value.extensions;
  96966. }
  96967. Object.defineProperties(MetadataEnumValue.prototype, {
  96968. value: {
  96969. get: function() {
  96970. return this._value;
  96971. }
  96972. },
  96973. name: {
  96974. get: function() {
  96975. return this._name;
  96976. }
  96977. },
  96978. description: {
  96979. get: function() {
  96980. return this._description;
  96981. }
  96982. },
  96983. extras: {
  96984. get: function() {
  96985. return this._extras;
  96986. }
  96987. },
  96988. extensions: {
  96989. get: function() {
  96990. return this._extensions;
  96991. }
  96992. }
  96993. });
  96994. var MetadataEnumValue_default = MetadataEnumValue;
  96995. // node_modules/cesium/Source/Scene/MetadataEnum.js
  96996. function MetadataEnum(options) {
  96997. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  96998. const id = options.id;
  96999. const enumDefinition = options.enum;
  97000. Check_default.typeOf.string("options.id", id);
  97001. Check_default.typeOf.object("options.enum", enumDefinition);
  97002. const namesByValue = {};
  97003. const valuesByName = {};
  97004. const values = enumDefinition.values.map(function(value) {
  97005. namesByValue[value.value] = value.name;
  97006. valuesByName[value.name] = value.value;
  97007. return new MetadataEnumValue_default(value);
  97008. });
  97009. const valueType = defaultValue_default(
  97010. MetadataComponentType_default[enumDefinition.valueType],
  97011. MetadataComponentType_default.UINT16
  97012. );
  97013. this._values = values;
  97014. this._namesByValue = namesByValue;
  97015. this._valuesByName = valuesByName;
  97016. this._valueType = valueType;
  97017. this._id = id;
  97018. this._name = enumDefinition.name;
  97019. this._description = enumDefinition.description;
  97020. this._extras = enumDefinition.extras;
  97021. this._extensions = enumDefinition.extensions;
  97022. }
  97023. Object.defineProperties(MetadataEnum.prototype, {
  97024. values: {
  97025. get: function() {
  97026. return this._values;
  97027. }
  97028. },
  97029. namesByValue: {
  97030. get: function() {
  97031. return this._namesByValue;
  97032. }
  97033. },
  97034. valuesByName: {
  97035. get: function() {
  97036. return this._valuesByName;
  97037. }
  97038. },
  97039. valueType: {
  97040. get: function() {
  97041. return this._valueType;
  97042. }
  97043. },
  97044. id: {
  97045. get: function() {
  97046. return this._id;
  97047. }
  97048. },
  97049. name: {
  97050. get: function() {
  97051. return this._name;
  97052. }
  97053. },
  97054. description: {
  97055. get: function() {
  97056. return this._description;
  97057. }
  97058. },
  97059. extras: {
  97060. get: function() {
  97061. return this._extras;
  97062. }
  97063. },
  97064. extensions: {
  97065. get: function() {
  97066. return this._extensions;
  97067. }
  97068. }
  97069. });
  97070. var MetadataEnum_default = MetadataEnum;
  97071. // node_modules/cesium/Source/Scene/MetadataSchema.js
  97072. function MetadataSchema(schema) {
  97073. Check_default.typeOf.object("schema", schema);
  97074. const enums = {};
  97075. if (defined_default(schema.enums)) {
  97076. for (const enumId in schema.enums) {
  97077. if (schema.enums.hasOwnProperty(enumId)) {
  97078. enums[enumId] = new MetadataEnum_default({
  97079. id: enumId,
  97080. enum: schema.enums[enumId]
  97081. });
  97082. }
  97083. }
  97084. }
  97085. const classes = {};
  97086. if (defined_default(schema.classes)) {
  97087. for (const classId in schema.classes) {
  97088. if (schema.classes.hasOwnProperty(classId)) {
  97089. classes[classId] = new MetadataClass_default({
  97090. id: classId,
  97091. class: schema.classes[classId],
  97092. enums
  97093. });
  97094. }
  97095. }
  97096. }
  97097. this._classes = classes;
  97098. this._enums = enums;
  97099. this._id = schema.id;
  97100. this._name = schema.name;
  97101. this._description = schema.description;
  97102. this._version = schema.version;
  97103. this._extras = schema.extras;
  97104. this._extensions = schema.extensions;
  97105. }
  97106. Object.defineProperties(MetadataSchema.prototype, {
  97107. classes: {
  97108. get: function() {
  97109. return this._classes;
  97110. }
  97111. },
  97112. enums: {
  97113. get: function() {
  97114. return this._enums;
  97115. }
  97116. },
  97117. id: {
  97118. get: function() {
  97119. return this._id;
  97120. }
  97121. },
  97122. name: {
  97123. get: function() {
  97124. return this._name;
  97125. }
  97126. },
  97127. description: {
  97128. get: function() {
  97129. return this._description;
  97130. }
  97131. },
  97132. version: {
  97133. get: function() {
  97134. return this._version;
  97135. }
  97136. },
  97137. extras: {
  97138. get: function() {
  97139. return this._extras;
  97140. }
  97141. },
  97142. extensions: {
  97143. get: function() {
  97144. return this._extensions;
  97145. }
  97146. }
  97147. });
  97148. var MetadataSchema_default = MetadataSchema;
  97149. // node_modules/cesium/Source/Scene/MetadataSchemaLoader.js
  97150. function MetadataSchemaLoader(options) {
  97151. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  97152. const schema = options.schema;
  97153. const resource = options.resource;
  97154. const cacheKey = options.cacheKey;
  97155. if (defined_default(schema) === defined_default(resource)) {
  97156. throw new DeveloperError_default(
  97157. "One of options.schema and options.resource must be defined."
  97158. );
  97159. }
  97160. this._schema = defined_default(schema) ? new MetadataSchema_default(schema) : void 0;
  97161. this._resource = resource;
  97162. this._cacheKey = cacheKey;
  97163. this._state = ResourceLoaderState_default.UNLOADED;
  97164. this._promise = defer_default();
  97165. }
  97166. if (defined_default(Object.create)) {
  97167. MetadataSchemaLoader.prototype = Object.create(ResourceLoader.prototype);
  97168. MetadataSchemaLoader.prototype.constructor = MetadataSchemaLoader;
  97169. }
  97170. Object.defineProperties(MetadataSchemaLoader.prototype, {
  97171. promise: {
  97172. get: function() {
  97173. return this._promise.promise;
  97174. }
  97175. },
  97176. cacheKey: {
  97177. get: function() {
  97178. return this._cacheKey;
  97179. }
  97180. },
  97181. schema: {
  97182. get: function() {
  97183. return this._schema;
  97184. }
  97185. }
  97186. });
  97187. MetadataSchemaLoader.prototype.load = function() {
  97188. if (defined_default(this._schema)) {
  97189. this._promise.resolve(this);
  97190. return;
  97191. }
  97192. loadExternalSchema(this);
  97193. };
  97194. function loadExternalSchema(schemaLoader) {
  97195. const resource = schemaLoader._resource;
  97196. schemaLoader._state = ResourceLoaderState_default.LOADING;
  97197. resource.fetchJson().then(function(json) {
  97198. if (schemaLoader.isDestroyed()) {
  97199. return;
  97200. }
  97201. schemaLoader._schema = new MetadataSchema_default(json);
  97202. schemaLoader._state = ResourceLoaderState_default.READY;
  97203. schemaLoader._promise.resolve(schemaLoader);
  97204. }).catch(function(error) {
  97205. if (schemaLoader.isDestroyed()) {
  97206. return;
  97207. }
  97208. schemaLoader._state = ResourceLoaderState_default.FAILED;
  97209. const errorMessage = `Failed to load schema: ${resource.url}`;
  97210. schemaLoader._promise.reject(schemaLoader.getError(errorMessage, error));
  97211. });
  97212. }
  97213. MetadataSchemaLoader.prototype.unload = function() {
  97214. this._schema = void 0;
  97215. };
  97216. // node_modules/cesium/Source/Scene/ResourceCacheKey.js
  97217. var ResourceCacheKey = {};
  97218. function getExternalResourceCacheKey(resource) {
  97219. return getAbsoluteUri_default(resource.url);
  97220. }
  97221. function getBufferViewCacheKey(bufferView) {
  97222. let byteOffset = bufferView.byteOffset;
  97223. let byteLength = bufferView.byteLength;
  97224. if (hasExtension(bufferView, "EXT_meshopt_compression")) {
  97225. const meshopt = bufferView.extensions.EXT_meshopt_compression;
  97226. byteOffset = defaultValue_default(meshopt.byteOffset, 0);
  97227. byteLength = meshopt.byteLength;
  97228. }
  97229. return `${byteOffset}-${byteOffset + byteLength}`;
  97230. }
  97231. function getAccessorCacheKey(accessor, bufferView) {
  97232. const byteOffset = bufferView.byteOffset + accessor.byteOffset;
  97233. const componentType = accessor.componentType;
  97234. const type = accessor.type;
  97235. const count = accessor.count;
  97236. return `${byteOffset}-${componentType}-${type}-${count}`;
  97237. }
  97238. function getExternalBufferCacheKey(resource) {
  97239. return getExternalResourceCacheKey(resource);
  97240. }
  97241. function getEmbeddedBufferCacheKey(parentResource, bufferId) {
  97242. const parentCacheKey = getExternalResourceCacheKey(parentResource);
  97243. return `${parentCacheKey}-buffer-id-${bufferId}`;
  97244. }
  97245. function getBufferCacheKey(buffer, bufferId, gltfResource, baseResource2) {
  97246. if (defined_default(buffer.uri)) {
  97247. const resource = baseResource2.getDerivedResource({
  97248. url: buffer.uri
  97249. });
  97250. return getExternalBufferCacheKey(resource);
  97251. }
  97252. return getEmbeddedBufferCacheKey(gltfResource, bufferId);
  97253. }
  97254. function getDracoCacheKey(gltf, draco, gltfResource, baseResource2) {
  97255. const bufferViewId = draco.bufferView;
  97256. const bufferView = gltf.bufferViews[bufferViewId];
  97257. const bufferId = bufferView.buffer;
  97258. const buffer = gltf.buffers[bufferId];
  97259. const bufferCacheKey = getBufferCacheKey(
  97260. buffer,
  97261. bufferId,
  97262. gltfResource,
  97263. baseResource2
  97264. );
  97265. const bufferViewCacheKey = getBufferViewCacheKey(bufferView);
  97266. return `${bufferCacheKey}-range-${bufferViewCacheKey}`;
  97267. }
  97268. function getImageCacheKey(gltf, imageId, gltfResource, baseResource2) {
  97269. const image = gltf.images[imageId];
  97270. const bufferViewId = image.bufferView;
  97271. const uri = image.uri;
  97272. if (defined_default(uri)) {
  97273. const resource = baseResource2.getDerivedResource({
  97274. url: uri
  97275. });
  97276. return getExternalResourceCacheKey(resource);
  97277. }
  97278. const bufferView = gltf.bufferViews[bufferViewId];
  97279. const bufferId = bufferView.buffer;
  97280. const buffer = gltf.buffers[bufferId];
  97281. const bufferCacheKey = getBufferCacheKey(
  97282. buffer,
  97283. bufferId,
  97284. gltfResource,
  97285. baseResource2
  97286. );
  97287. const bufferViewCacheKey = getBufferViewCacheKey(bufferView);
  97288. return `${bufferCacheKey}-range-${bufferViewCacheKey}`;
  97289. }
  97290. function getSamplerCacheKey(gltf, textureInfo) {
  97291. const sampler = GltfLoaderUtil_default.createSampler({
  97292. gltf,
  97293. textureInfo
  97294. });
  97295. return `${sampler.wrapS}-${sampler.wrapT}-${sampler.minificationFilter}-${sampler.magnificationFilter}`;
  97296. }
  97297. ResourceCacheKey.getSchemaCacheKey = function(options) {
  97298. const schema = options.schema;
  97299. const resource = options.resource;
  97300. if (defined_default(schema) === defined_default(resource)) {
  97301. throw new DeveloperError_default(
  97302. "One of options.schema and options.resource must be defined."
  97303. );
  97304. }
  97305. if (defined_default(schema)) {
  97306. return `embedded-schema:${JSON.stringify(schema)}`;
  97307. }
  97308. return `external-schema:${getExternalResourceCacheKey(resource)}`;
  97309. };
  97310. ResourceCacheKey.getExternalBufferCacheKey = function(options) {
  97311. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  97312. const resource = options.resource;
  97313. Check_default.typeOf.object("options.resource", resource);
  97314. return `external-buffer:${getExternalBufferCacheKey(resource)}`;
  97315. };
  97316. ResourceCacheKey.getEmbeddedBufferCacheKey = function(options) {
  97317. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  97318. const parentResource = options.parentResource;
  97319. const bufferId = options.bufferId;
  97320. Check_default.typeOf.object("options.parentResource", parentResource);
  97321. Check_default.typeOf.number("options.bufferId", bufferId);
  97322. return `embedded-buffer:${getEmbeddedBufferCacheKey(
  97323. parentResource,
  97324. bufferId
  97325. )}`;
  97326. };
  97327. ResourceCacheKey.getGltfCacheKey = function(options) {
  97328. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  97329. const gltfResource = options.gltfResource;
  97330. Check_default.typeOf.object("options.gltfResource", gltfResource);
  97331. return `gltf:${getExternalResourceCacheKey(gltfResource)}`;
  97332. };
  97333. ResourceCacheKey.getBufferViewCacheKey = function(options) {
  97334. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  97335. const gltf = options.gltf;
  97336. const bufferViewId = options.bufferViewId;
  97337. const gltfResource = options.gltfResource;
  97338. const baseResource2 = options.baseResource;
  97339. Check_default.typeOf.object("options.gltf", gltf);
  97340. Check_default.typeOf.number("options.bufferViewId", bufferViewId);
  97341. Check_default.typeOf.object("options.gltfResource", gltfResource);
  97342. Check_default.typeOf.object("options.baseResource", baseResource2);
  97343. const bufferView = gltf.bufferViews[bufferViewId];
  97344. let bufferId = bufferView.buffer;
  97345. const buffer = gltf.buffers[bufferId];
  97346. if (hasExtension(bufferView, "EXT_meshopt_compression")) {
  97347. const meshopt = bufferView.extensions.EXT_meshopt_compression;
  97348. bufferId = meshopt.buffer;
  97349. }
  97350. const bufferCacheKey = getBufferCacheKey(
  97351. buffer,
  97352. bufferId,
  97353. gltfResource,
  97354. baseResource2
  97355. );
  97356. const bufferViewCacheKey = getBufferViewCacheKey(bufferView);
  97357. return `buffer-view:${bufferCacheKey}-range-${bufferViewCacheKey}`;
  97358. };
  97359. ResourceCacheKey.getDracoCacheKey = function(options) {
  97360. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  97361. const gltf = options.gltf;
  97362. const draco = options.draco;
  97363. const gltfResource = options.gltfResource;
  97364. const baseResource2 = options.baseResource;
  97365. Check_default.typeOf.object("options.gltf", gltf);
  97366. Check_default.typeOf.object("options.draco", draco);
  97367. Check_default.typeOf.object("options.gltfResource", gltfResource);
  97368. Check_default.typeOf.object("options.baseResource", baseResource2);
  97369. return `draco:${getDracoCacheKey(gltf, draco, gltfResource, baseResource2)}`;
  97370. };
  97371. ResourceCacheKey.getVertexBufferCacheKey = function(options) {
  97372. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  97373. const gltf = options.gltf;
  97374. const gltfResource = options.gltfResource;
  97375. const baseResource2 = options.baseResource;
  97376. const bufferViewId = options.bufferViewId;
  97377. const draco = options.draco;
  97378. const attributeSemantic = options.attributeSemantic;
  97379. const dequantize = defaultValue_default(options.dequantize, false);
  97380. const loadAsTypedArray = defaultValue_default(options.loadAsTypedArray, false);
  97381. Check_default.typeOf.object("options.gltf", gltf);
  97382. Check_default.typeOf.object("options.gltfResource", gltfResource);
  97383. Check_default.typeOf.object("options.baseResource", baseResource2);
  97384. const hasBufferViewId = defined_default(bufferViewId);
  97385. const hasDraco = defined_default(draco);
  97386. const hasAttributeSemantic = defined_default(attributeSemantic);
  97387. if (hasBufferViewId === hasDraco) {
  97388. throw new DeveloperError_default(
  97389. "One of options.bufferViewId and options.draco must be defined."
  97390. );
  97391. }
  97392. if (hasDraco && !hasAttributeSemantic) {
  97393. throw new DeveloperError_default(
  97394. "When options.draco is defined options.attributeSemantic must also be defined."
  97395. );
  97396. }
  97397. if (hasDraco) {
  97398. Check_default.typeOf.object("options.draco", draco);
  97399. Check_default.typeOf.string("options.attributeSemantic", attributeSemantic);
  97400. }
  97401. let cacheKeySuffix = "";
  97402. if (dequantize) {
  97403. cacheKeySuffix += "-dequantize";
  97404. }
  97405. if (loadAsTypedArray) {
  97406. cacheKeySuffix += "-typed-array";
  97407. }
  97408. if (defined_default(draco)) {
  97409. const dracoCacheKey = getDracoCacheKey(
  97410. gltf,
  97411. draco,
  97412. gltfResource,
  97413. baseResource2
  97414. );
  97415. return `vertex-buffer:${dracoCacheKey}-draco-${attributeSemantic}${cacheKeySuffix}`;
  97416. }
  97417. const bufferView = gltf.bufferViews[bufferViewId];
  97418. const bufferId = bufferView.buffer;
  97419. const buffer = gltf.buffers[bufferId];
  97420. const bufferCacheKey = getBufferCacheKey(
  97421. buffer,
  97422. bufferId,
  97423. gltfResource,
  97424. baseResource2
  97425. );
  97426. const bufferViewCacheKey = getBufferViewCacheKey(bufferView);
  97427. return `vertex-buffer:${bufferCacheKey}-range-${bufferViewCacheKey}${cacheKeySuffix}`;
  97428. };
  97429. ResourceCacheKey.getIndexBufferCacheKey = function(options) {
  97430. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  97431. const gltf = options.gltf;
  97432. const accessorId = options.accessorId;
  97433. const gltfResource = options.gltfResource;
  97434. const baseResource2 = options.baseResource;
  97435. const draco = options.draco;
  97436. const loadAsTypedArray = defaultValue_default(options.loadAsTypedArray, false);
  97437. Check_default.typeOf.object("options.gltf", gltf);
  97438. Check_default.typeOf.number("options.accessorId", accessorId);
  97439. Check_default.typeOf.object("options.gltfResource", gltfResource);
  97440. Check_default.typeOf.object("options.baseResource", baseResource2);
  97441. let cacheKeySuffix = "";
  97442. if (loadAsTypedArray) {
  97443. cacheKeySuffix += "-typed-array";
  97444. }
  97445. if (defined_default(draco)) {
  97446. const dracoCacheKey = getDracoCacheKey(
  97447. gltf,
  97448. draco,
  97449. gltfResource,
  97450. baseResource2
  97451. );
  97452. return `index-buffer:${dracoCacheKey}-draco${cacheKeySuffix}`;
  97453. }
  97454. const accessor = gltf.accessors[accessorId];
  97455. const bufferViewId = accessor.bufferView;
  97456. const bufferView = gltf.bufferViews[bufferViewId];
  97457. const bufferId = bufferView.buffer;
  97458. const buffer = gltf.buffers[bufferId];
  97459. const bufferCacheKey = getBufferCacheKey(
  97460. buffer,
  97461. bufferId,
  97462. gltfResource,
  97463. baseResource2
  97464. );
  97465. const accessorCacheKey = getAccessorCacheKey(accessor, bufferView);
  97466. return `index-buffer:${bufferCacheKey}-accessor-${accessorCacheKey}${cacheKeySuffix}`;
  97467. };
  97468. ResourceCacheKey.getImageCacheKey = function(options) {
  97469. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  97470. const gltf = options.gltf;
  97471. const imageId = options.imageId;
  97472. const gltfResource = options.gltfResource;
  97473. const baseResource2 = options.baseResource;
  97474. Check_default.typeOf.object("options.gltf", gltf);
  97475. Check_default.typeOf.number("options.imageId", imageId);
  97476. Check_default.typeOf.object("options.gltfResource", gltfResource);
  97477. Check_default.typeOf.object("options.baseResource", baseResource2);
  97478. const imageCacheKey = getImageCacheKey(
  97479. gltf,
  97480. imageId,
  97481. gltfResource,
  97482. baseResource2
  97483. );
  97484. return `image:${imageCacheKey}`;
  97485. };
  97486. ResourceCacheKey.getTextureCacheKey = function(options) {
  97487. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  97488. const gltf = options.gltf;
  97489. const textureInfo = options.textureInfo;
  97490. const gltfResource = options.gltfResource;
  97491. const baseResource2 = options.baseResource;
  97492. const supportedImageFormats = options.supportedImageFormats;
  97493. Check_default.typeOf.object("options.gltf", gltf);
  97494. Check_default.typeOf.object("options.textureInfo", textureInfo);
  97495. Check_default.typeOf.object("options.gltfResource", gltfResource);
  97496. Check_default.typeOf.object("options.baseResource", baseResource2);
  97497. Check_default.typeOf.object("options.supportedImageFormats", supportedImageFormats);
  97498. const textureId = textureInfo.index;
  97499. const imageId = GltfLoaderUtil_default.getImageIdFromTexture({
  97500. gltf,
  97501. textureId,
  97502. supportedImageFormats
  97503. });
  97504. const imageCacheKey = getImageCacheKey(
  97505. gltf,
  97506. imageId,
  97507. gltfResource,
  97508. baseResource2
  97509. );
  97510. const samplerCacheKey = getSamplerCacheKey(gltf, textureInfo);
  97511. return `texture:${imageCacheKey}-sampler-${samplerCacheKey}`;
  97512. };
  97513. var ResourceCacheKey_default = ResourceCacheKey;
  97514. // node_modules/cesium/Source/Scene/ResourceCache.js
  97515. function ResourceCache() {
  97516. }
  97517. ResourceCache.cacheEntries = {};
  97518. function CacheEntry(resourceLoader) {
  97519. this.referenceCount = 1;
  97520. this.resourceLoader = resourceLoader;
  97521. }
  97522. ResourceCache.get = function(cacheKey) {
  97523. Check_default.typeOf.string("cacheKey", cacheKey);
  97524. const cacheEntry = ResourceCache.cacheEntries[cacheKey];
  97525. if (defined_default(cacheEntry)) {
  97526. ++cacheEntry.referenceCount;
  97527. return cacheEntry.resourceLoader;
  97528. }
  97529. return void 0;
  97530. };
  97531. ResourceCache.load = function(options) {
  97532. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  97533. const resourceLoader = options.resourceLoader;
  97534. Check_default.typeOf.object("options.resourceLoader", resourceLoader);
  97535. const cacheKey = resourceLoader.cacheKey;
  97536. Check_default.typeOf.string("options.resourceLoader.cacheKey", cacheKey);
  97537. if (defined_default(ResourceCache.cacheEntries[cacheKey])) {
  97538. throw new DeveloperError_default(
  97539. `Resource with this cacheKey is already in the cache: ${cacheKey}`
  97540. );
  97541. }
  97542. ResourceCache.cacheEntries[cacheKey] = new CacheEntry(resourceLoader);
  97543. resourceLoader.load();
  97544. };
  97545. ResourceCache.unload = function(resourceLoader) {
  97546. Check_default.typeOf.object("resourceLoader", resourceLoader);
  97547. const cacheKey = resourceLoader.cacheKey;
  97548. const cacheEntry = ResourceCache.cacheEntries[cacheKey];
  97549. if (!defined_default(cacheEntry)) {
  97550. throw new DeveloperError_default(`Resource is not in the cache: ${cacheKey}`);
  97551. }
  97552. --cacheEntry.referenceCount;
  97553. if (cacheEntry.referenceCount === 0) {
  97554. resourceLoader.destroy();
  97555. delete ResourceCache.cacheEntries[cacheKey];
  97556. }
  97557. };
  97558. ResourceCache.loadSchema = function(options) {
  97559. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  97560. const schema = options.schema;
  97561. const resource = options.resource;
  97562. if (defined_default(schema) === defined_default(resource)) {
  97563. throw new DeveloperError_default(
  97564. "One of options.schema and options.resource must be defined."
  97565. );
  97566. }
  97567. const cacheKey = ResourceCacheKey_default.getSchemaCacheKey({
  97568. schema,
  97569. resource
  97570. });
  97571. let schemaLoader = ResourceCache.get(cacheKey);
  97572. if (defined_default(schemaLoader)) {
  97573. return schemaLoader;
  97574. }
  97575. schemaLoader = new MetadataSchemaLoader({
  97576. schema,
  97577. resource,
  97578. cacheKey
  97579. });
  97580. ResourceCache.load({
  97581. resourceLoader: schemaLoader
  97582. });
  97583. return schemaLoader;
  97584. };
  97585. ResourceCache.loadEmbeddedBuffer = function(options) {
  97586. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  97587. const parentResource = options.parentResource;
  97588. const bufferId = options.bufferId;
  97589. const typedArray = options.typedArray;
  97590. Check_default.typeOf.object("options.parentResource", parentResource);
  97591. Check_default.typeOf.number("options.bufferId", bufferId);
  97592. const cacheKey = ResourceCacheKey_default.getEmbeddedBufferCacheKey({
  97593. parentResource,
  97594. bufferId
  97595. });
  97596. let bufferLoader = ResourceCache.get(cacheKey);
  97597. if (defined_default(bufferLoader)) {
  97598. return bufferLoader;
  97599. }
  97600. Check_default.typeOf.object("options.typedArray", typedArray);
  97601. bufferLoader = new BufferLoader({
  97602. typedArray,
  97603. cacheKey
  97604. });
  97605. ResourceCache.load({
  97606. resourceLoader: bufferLoader
  97607. });
  97608. return bufferLoader;
  97609. };
  97610. ResourceCache.loadExternalBuffer = function(options) {
  97611. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  97612. const resource = options.resource;
  97613. Check_default.typeOf.object("options.resource", resource);
  97614. const cacheKey = ResourceCacheKey_default.getExternalBufferCacheKey({
  97615. resource
  97616. });
  97617. let bufferLoader = ResourceCache.get(cacheKey);
  97618. if (defined_default(bufferLoader)) {
  97619. return bufferLoader;
  97620. }
  97621. bufferLoader = new BufferLoader({
  97622. resource,
  97623. cacheKey
  97624. });
  97625. ResourceCache.load({
  97626. resourceLoader: bufferLoader
  97627. });
  97628. return bufferLoader;
  97629. };
  97630. ResourceCache.loadGltfJson = function(options) {
  97631. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  97632. const gltfResource = options.gltfResource;
  97633. const baseResource2 = options.baseResource;
  97634. const typedArray = options.typedArray;
  97635. const gltfJson = options.gltfJson;
  97636. Check_default.typeOf.object("options.gltfResource", gltfResource);
  97637. Check_default.typeOf.object("options.baseResource", baseResource2);
  97638. const cacheKey = ResourceCacheKey_default.getGltfCacheKey({
  97639. gltfResource
  97640. });
  97641. let gltfJsonLoader = ResourceCache.get(cacheKey);
  97642. if (defined_default(gltfJsonLoader)) {
  97643. return gltfJsonLoader;
  97644. }
  97645. gltfJsonLoader = new GltfJsonLoader({
  97646. resourceCache: ResourceCache,
  97647. gltfResource,
  97648. baseResource: baseResource2,
  97649. typedArray,
  97650. gltfJson,
  97651. cacheKey
  97652. });
  97653. ResourceCache.load({
  97654. resourceLoader: gltfJsonLoader
  97655. });
  97656. return gltfJsonLoader;
  97657. };
  97658. ResourceCache.loadBufferView = function(options) {
  97659. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  97660. const gltf = options.gltf;
  97661. const bufferViewId = options.bufferViewId;
  97662. const gltfResource = options.gltfResource;
  97663. const baseResource2 = options.baseResource;
  97664. Check_default.typeOf.object("options.gltf", gltf);
  97665. Check_default.typeOf.number("options.bufferViewId", bufferViewId);
  97666. Check_default.typeOf.object("options.gltfResource", gltfResource);
  97667. Check_default.typeOf.object("options.baseResource", baseResource2);
  97668. const cacheKey = ResourceCacheKey_default.getBufferViewCacheKey({
  97669. gltf,
  97670. bufferViewId,
  97671. gltfResource,
  97672. baseResource: baseResource2
  97673. });
  97674. let bufferViewLoader = ResourceCache.get(cacheKey);
  97675. if (defined_default(bufferViewLoader)) {
  97676. return bufferViewLoader;
  97677. }
  97678. bufferViewLoader = new GltfBufferViewLoader({
  97679. resourceCache: ResourceCache,
  97680. gltf,
  97681. bufferViewId,
  97682. gltfResource,
  97683. baseResource: baseResource2,
  97684. cacheKey
  97685. });
  97686. ResourceCache.load({
  97687. resourceLoader: bufferViewLoader
  97688. });
  97689. return bufferViewLoader;
  97690. };
  97691. ResourceCache.loadDraco = function(options) {
  97692. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  97693. const gltf = options.gltf;
  97694. const draco = options.draco;
  97695. const gltfResource = options.gltfResource;
  97696. const baseResource2 = options.baseResource;
  97697. Check_default.typeOf.object("options.gltf", gltf);
  97698. Check_default.typeOf.object("options.draco", draco);
  97699. Check_default.typeOf.object("options.gltfResource", gltfResource);
  97700. Check_default.typeOf.object("options.baseResource", baseResource2);
  97701. const cacheKey = ResourceCacheKey_default.getDracoCacheKey({
  97702. gltf,
  97703. draco,
  97704. gltfResource,
  97705. baseResource: baseResource2
  97706. });
  97707. let dracoLoader = ResourceCache.get(cacheKey);
  97708. if (defined_default(dracoLoader)) {
  97709. return dracoLoader;
  97710. }
  97711. dracoLoader = new GltfDracoLoader({
  97712. resourceCache: ResourceCache,
  97713. gltf,
  97714. draco,
  97715. gltfResource,
  97716. baseResource: baseResource2,
  97717. cacheKey
  97718. });
  97719. ResourceCache.load({
  97720. resourceLoader: dracoLoader
  97721. });
  97722. return dracoLoader;
  97723. };
  97724. ResourceCache.loadVertexBuffer = function(options) {
  97725. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  97726. const gltf = options.gltf;
  97727. const gltfResource = options.gltfResource;
  97728. const baseResource2 = options.baseResource;
  97729. const bufferViewId = options.bufferViewId;
  97730. const draco = options.draco;
  97731. const attributeSemantic = options.attributeSemantic;
  97732. const accessorId = options.accessorId;
  97733. const asynchronous = defaultValue_default(options.asynchronous, true);
  97734. const dequantize = defaultValue_default(options.dequantize, false);
  97735. const loadAsTypedArray = defaultValue_default(options.loadAsTypedArray, false);
  97736. Check_default.typeOf.object("options.gltf", gltf);
  97737. Check_default.typeOf.object("options.gltfResource", gltfResource);
  97738. Check_default.typeOf.object("options.baseResource", baseResource2);
  97739. const hasBufferViewId = defined_default(bufferViewId);
  97740. const hasDraco = defined_default(draco);
  97741. const hasAttributeSemantic = defined_default(attributeSemantic);
  97742. const hasAccessorId = defined_default(accessorId);
  97743. if (hasBufferViewId === hasDraco) {
  97744. throw new DeveloperError_default(
  97745. "One of options.bufferViewId and options.draco must be defined."
  97746. );
  97747. }
  97748. if (hasDraco && !hasAttributeSemantic) {
  97749. throw new DeveloperError_default(
  97750. "When options.draco is defined options.attributeSemantic must also be defined."
  97751. );
  97752. }
  97753. if (hasDraco && !hasAccessorId) {
  97754. throw new DeveloperError_default(
  97755. "When options.draco is defined options.haAccessorId must also be defined."
  97756. );
  97757. }
  97758. if (hasDraco) {
  97759. Check_default.typeOf.object("options.draco", draco);
  97760. Check_default.typeOf.string("options.attributeSemantic", attributeSemantic);
  97761. Check_default.typeOf.number("options.accessorId", accessorId);
  97762. }
  97763. const cacheKey = ResourceCacheKey_default.getVertexBufferCacheKey({
  97764. gltf,
  97765. gltfResource,
  97766. baseResource: baseResource2,
  97767. bufferViewId,
  97768. draco,
  97769. attributeSemantic,
  97770. dequantize,
  97771. loadAsTypedArray
  97772. });
  97773. let vertexBufferLoader = ResourceCache.get(cacheKey);
  97774. if (defined_default(vertexBufferLoader)) {
  97775. return vertexBufferLoader;
  97776. }
  97777. vertexBufferLoader = new GltfVertexBufferLoader({
  97778. resourceCache: ResourceCache,
  97779. gltf,
  97780. gltfResource,
  97781. baseResource: baseResource2,
  97782. bufferViewId,
  97783. draco,
  97784. attributeSemantic,
  97785. accessorId,
  97786. cacheKey,
  97787. asynchronous,
  97788. dequantize,
  97789. loadAsTypedArray
  97790. });
  97791. ResourceCache.load({
  97792. resourceLoader: vertexBufferLoader
  97793. });
  97794. return vertexBufferLoader;
  97795. };
  97796. ResourceCache.loadIndexBuffer = function(options) {
  97797. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  97798. const gltf = options.gltf;
  97799. const accessorId = options.accessorId;
  97800. const gltfResource = options.gltfResource;
  97801. const baseResource2 = options.baseResource;
  97802. const draco = options.draco;
  97803. const asynchronous = defaultValue_default(options.asynchronous, true);
  97804. const loadAsTypedArray = defaultValue_default(options.loadAsTypedArray, false);
  97805. Check_default.typeOf.object("options.gltf", gltf);
  97806. Check_default.typeOf.number("options.accessorId", accessorId);
  97807. Check_default.typeOf.object("options.gltfResource", gltfResource);
  97808. Check_default.typeOf.object("options.baseResource", baseResource2);
  97809. const cacheKey = ResourceCacheKey_default.getIndexBufferCacheKey({
  97810. gltf,
  97811. accessorId,
  97812. gltfResource,
  97813. baseResource: baseResource2,
  97814. draco,
  97815. loadAsTypedArray
  97816. });
  97817. let indexBufferLoader = ResourceCache.get(cacheKey);
  97818. if (defined_default(indexBufferLoader)) {
  97819. return indexBufferLoader;
  97820. }
  97821. indexBufferLoader = new GltfIndexBufferLoader({
  97822. resourceCache: ResourceCache,
  97823. gltf,
  97824. accessorId,
  97825. gltfResource,
  97826. baseResource: baseResource2,
  97827. draco,
  97828. cacheKey,
  97829. asynchronous,
  97830. loadAsTypedArray
  97831. });
  97832. ResourceCache.load({
  97833. resourceLoader: indexBufferLoader
  97834. });
  97835. return indexBufferLoader;
  97836. };
  97837. ResourceCache.loadImage = function(options) {
  97838. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  97839. const gltf = options.gltf;
  97840. const imageId = options.imageId;
  97841. const gltfResource = options.gltfResource;
  97842. const baseResource2 = options.baseResource;
  97843. Check_default.typeOf.object("options.gltf", gltf);
  97844. Check_default.typeOf.number("options.imageId", imageId);
  97845. Check_default.typeOf.object("options.gltfResource", gltfResource);
  97846. Check_default.typeOf.object("options.baseResource", baseResource2);
  97847. const cacheKey = ResourceCacheKey_default.getImageCacheKey({
  97848. gltf,
  97849. imageId,
  97850. gltfResource,
  97851. baseResource: baseResource2
  97852. });
  97853. let imageLoader = ResourceCache.get(cacheKey);
  97854. if (defined_default(imageLoader)) {
  97855. return imageLoader;
  97856. }
  97857. imageLoader = new GltfImageLoader({
  97858. resourceCache: ResourceCache,
  97859. gltf,
  97860. imageId,
  97861. gltfResource,
  97862. baseResource: baseResource2,
  97863. cacheKey
  97864. });
  97865. ResourceCache.load({
  97866. resourceLoader: imageLoader
  97867. });
  97868. return imageLoader;
  97869. };
  97870. ResourceCache.loadTexture = function(options) {
  97871. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  97872. const gltf = options.gltf;
  97873. const textureInfo = options.textureInfo;
  97874. const gltfResource = options.gltfResource;
  97875. const baseResource2 = options.baseResource;
  97876. const supportedImageFormats = options.supportedImageFormats;
  97877. const asynchronous = defaultValue_default(options.asynchronous, true);
  97878. Check_default.typeOf.object("options.gltf", gltf);
  97879. Check_default.typeOf.object("options.textureInfo", textureInfo);
  97880. Check_default.typeOf.object("options.gltfResource", gltfResource);
  97881. Check_default.typeOf.object("options.baseResource", baseResource2);
  97882. const cacheKey = ResourceCacheKey_default.getTextureCacheKey({
  97883. gltf,
  97884. textureInfo,
  97885. gltfResource,
  97886. baseResource: baseResource2,
  97887. supportedImageFormats
  97888. });
  97889. let textureLoader = ResourceCache.get(cacheKey);
  97890. if (defined_default(textureLoader)) {
  97891. return textureLoader;
  97892. }
  97893. textureLoader = new GltfTextureLoader({
  97894. resourceCache: ResourceCache,
  97895. gltf,
  97896. textureInfo,
  97897. gltfResource,
  97898. baseResource: baseResource2,
  97899. supportedImageFormats,
  97900. cacheKey,
  97901. asynchronous
  97902. });
  97903. ResourceCache.load({
  97904. resourceLoader: textureLoader
  97905. });
  97906. return textureLoader;
  97907. };
  97908. ResourceCache.clearForSpecs = function() {
  97909. const precedence = [
  97910. GltfVertexBufferLoader,
  97911. GltfIndexBufferLoader,
  97912. GltfDracoLoader,
  97913. GltfTextureLoader,
  97914. GltfImageLoader,
  97915. GltfBufferViewLoader,
  97916. BufferLoader,
  97917. MetadataSchemaLoader,
  97918. GltfJsonLoader
  97919. ];
  97920. let cacheKey;
  97921. const cacheEntries = ResourceCache.cacheEntries;
  97922. const cacheEntriesSorted = [];
  97923. for (cacheKey in cacheEntries) {
  97924. if (cacheEntries.hasOwnProperty(cacheKey)) {
  97925. cacheEntriesSorted.push(cacheEntries[cacheKey]);
  97926. }
  97927. }
  97928. cacheEntriesSorted.sort(function(a4, b) {
  97929. const indexA = precedence.indexOf(a4.resourceLoader.constructor);
  97930. const indexB = precedence.indexOf(b.resourceLoader.constructor);
  97931. return indexA - indexB;
  97932. });
  97933. const cacheEntriesLength = cacheEntriesSorted.length;
  97934. for (let i2 = 0; i2 < cacheEntriesLength; ++i2) {
  97935. const cacheEntry = cacheEntriesSorted[i2];
  97936. cacheKey = cacheEntry.resourceLoader.cacheKey;
  97937. if (defined_default(cacheEntries[cacheKey])) {
  97938. cacheEntry.resourceLoader.destroy();
  97939. delete cacheEntries[cacheKey];
  97940. }
  97941. }
  97942. };
  97943. var ResourceCache_default = ResourceCache;
  97944. // node_modules/cesium/Source/Scene/ImplicitSubtree.js
  97945. function ImplicitSubtree(resource, json, subtreeView, implicitTileset, implicitCoordinates) {
  97946. Check_default.typeOf.object("resource", resource);
  97947. if (defined_default(json) === defined_default(subtreeView)) {
  97948. throw new DeveloperError_default("One of json and subtreeView must be defined.");
  97949. }
  97950. Check_default.typeOf.object("implicitTileset", implicitTileset);
  97951. Check_default.typeOf.object("implicitCoordinates", implicitCoordinates);
  97952. this._resource = resource;
  97953. this._subtreeJson = void 0;
  97954. this._bufferLoader = void 0;
  97955. this._tileAvailability = void 0;
  97956. this._contentAvailabilityBitstreams = [];
  97957. this._childSubtreeAvailability = void 0;
  97958. this._implicitCoordinates = implicitCoordinates;
  97959. this._subtreeLevels = implicitTileset.subtreeLevels;
  97960. this._subdivisionScheme = implicitTileset.subdivisionScheme;
  97961. this._branchingFactor = implicitTileset.branchingFactor;
  97962. this._readyPromise = defer_default();
  97963. this._metadata = void 0;
  97964. this._tileMetadataTable = void 0;
  97965. this._tilePropertyTableJson = void 0;
  97966. this._contentMetadataTables = [];
  97967. this._contentPropertyTableJsons = [];
  97968. this._tileJumpBuffer = void 0;
  97969. this._contentJumpBuffers = [];
  97970. initialize7(this, json, subtreeView, implicitTileset);
  97971. }
  97972. Object.defineProperties(ImplicitSubtree.prototype, {
  97973. readyPromise: {
  97974. get: function() {
  97975. return this._readyPromise.promise;
  97976. }
  97977. },
  97978. metadata: {
  97979. get: function() {
  97980. return this._metadata;
  97981. }
  97982. },
  97983. tileMetadataTable: {
  97984. get: function() {
  97985. return this._tileMetadataTable;
  97986. }
  97987. },
  97988. tilePropertyTableJson: {
  97989. get: function() {
  97990. return this._tilePropertyTableJson;
  97991. }
  97992. },
  97993. contentMetadataTables: {
  97994. get: function() {
  97995. return this._contentMetadataTables;
  97996. }
  97997. },
  97998. contentPropertyTableJsons: {
  97999. get: function() {
  98000. return this._contentPropertyTableJsons;
  98001. }
  98002. },
  98003. implicitCoordinates: {
  98004. get: function() {
  98005. return this._implicitCoordinates;
  98006. }
  98007. }
  98008. });
  98009. ImplicitSubtree.prototype.tileIsAvailableAtIndex = function(index2) {
  98010. return this._tileAvailability.getBit(index2);
  98011. };
  98012. ImplicitSubtree.prototype.tileIsAvailableAtCoordinates = function(implicitCoordinates) {
  98013. const index2 = this.getTileIndex(implicitCoordinates);
  98014. return this.tileIsAvailableAtIndex(index2);
  98015. };
  98016. ImplicitSubtree.prototype.contentIsAvailableAtIndex = function(index2, contentIndex) {
  98017. contentIndex = defaultValue_default(contentIndex, 0);
  98018. if (contentIndex < 0 || contentIndex >= this._contentAvailabilityBitstreams.length) {
  98019. throw new DeveloperError_default("contentIndex out of bounds.");
  98020. }
  98021. return this._contentAvailabilityBitstreams[contentIndex].getBit(index2);
  98022. };
  98023. ImplicitSubtree.prototype.contentIsAvailableAtCoordinates = function(implicitCoordinates, contentIndex) {
  98024. const index2 = this.getTileIndex(implicitCoordinates);
  98025. return this.contentIsAvailableAtIndex(index2, contentIndex);
  98026. };
  98027. ImplicitSubtree.prototype.childSubtreeIsAvailableAtIndex = function(index2) {
  98028. return this._childSubtreeAvailability.getBit(index2);
  98029. };
  98030. ImplicitSubtree.prototype.childSubtreeIsAvailableAtCoordinates = function(implicitCoordinates) {
  98031. const index2 = this.getChildSubtreeIndex(implicitCoordinates);
  98032. return this.childSubtreeIsAvailableAtIndex(index2);
  98033. };
  98034. ImplicitSubtree.prototype.getLevelOffset = function(level) {
  98035. const branchingFactor = this._branchingFactor;
  98036. return (Math.pow(branchingFactor, level) - 1) / (branchingFactor - 1);
  98037. };
  98038. ImplicitSubtree.prototype.getParentMortonIndex = function(mortonIndex) {
  98039. let bitsPerLevel = 2;
  98040. if (this._subdivisionScheme === ImplicitSubdivisionScheme_default.OCTREE) {
  98041. bitsPerLevel = 3;
  98042. }
  98043. return mortonIndex >> bitsPerLevel;
  98044. };
  98045. function initialize7(subtree, json, subtreeView, implicitTileset) {
  98046. let chunks;
  98047. if (defined_default(json)) {
  98048. chunks = {
  98049. json,
  98050. binary: void 0
  98051. };
  98052. } else {
  98053. chunks = parseSubtreeChunks(subtreeView);
  98054. }
  98055. const subtreeJson = chunks.json;
  98056. subtree._subtreeJson = subtreeJson;
  98057. let tilePropertyTableJson;
  98058. if (hasExtension(subtreeJson, "3DTILES_metadata")) {
  98059. tilePropertyTableJson = subtreeJson.extensions["3DTILES_metadata"];
  98060. } else if (defined_default(subtreeJson.tileMetadata)) {
  98061. const propertyTableIndex = subtreeJson.tileMetadata;
  98062. tilePropertyTableJson = subtreeJson.propertyTables[propertyTableIndex];
  98063. }
  98064. const contentPropertyTableJsons = [];
  98065. if (defined_default(subtreeJson.contentMetadata)) {
  98066. const length3 = subtreeJson.contentMetadata.length;
  98067. for (let i2 = 0; i2 < length3; i2++) {
  98068. const propertyTableIndex = subtreeJson.contentMetadata[i2];
  98069. contentPropertyTableJsons.push(
  98070. subtreeJson.propertyTables[propertyTableIndex]
  98071. );
  98072. }
  98073. }
  98074. let metadata;
  98075. const schema = implicitTileset.metadataSchema;
  98076. const subtreeMetadata = subtreeJson.subtreeMetadata;
  98077. if (defined_default(subtreeMetadata)) {
  98078. const metadataClass = subtreeMetadata.class;
  98079. const subtreeMetadataClass = schema.classes[metadataClass];
  98080. metadata = new ImplicitSubtreeMetadata_default({
  98081. subtreeMetadata,
  98082. class: subtreeMetadataClass
  98083. });
  98084. }
  98085. subtree._metadata = metadata;
  98086. subtree._tilePropertyTableJson = tilePropertyTableJson;
  98087. subtree._contentPropertyTableJsons = contentPropertyTableJsons;
  98088. const defaultContentAvailability = {
  98089. constant: 0
  98090. };
  98091. subtreeJson.contentAvailabilityHeaders = [];
  98092. if (hasExtension(subtreeJson, "3DTILES_multiple_contents")) {
  98093. subtreeJson.contentAvailabilityHeaders = subtreeJson.extensions["3DTILES_multiple_contents"].contentAvailability;
  98094. } else if (Array.isArray(subtreeJson.contentAvailability)) {
  98095. subtreeJson.contentAvailabilityHeaders = subtreeJson.contentAvailability;
  98096. } else {
  98097. subtreeJson.contentAvailabilityHeaders.push(
  98098. defaultValue_default(subtreeJson.contentAvailability, defaultContentAvailability)
  98099. );
  98100. }
  98101. const bufferHeaders = preprocessBuffers(subtreeJson.buffers);
  98102. const bufferViewHeaders = preprocessBufferViews(
  98103. subtreeJson.bufferViews,
  98104. bufferHeaders
  98105. );
  98106. markActiveBufferViews(subtreeJson, bufferViewHeaders);
  98107. if (defined_default(tilePropertyTableJson)) {
  98108. markActiveMetadataBufferViews(tilePropertyTableJson, bufferViewHeaders);
  98109. }
  98110. for (let i2 = 0; i2 < contentPropertyTableJsons.length; i2++) {
  98111. const contentPropertyTableJson = contentPropertyTableJsons[i2];
  98112. markActiveMetadataBufferViews(contentPropertyTableJson, bufferViewHeaders);
  98113. }
  98114. requestActiveBuffers(subtree, bufferHeaders, chunks.binary).then(function(buffersU8) {
  98115. const bufferViewsU8 = parseActiveBufferViews(
  98116. bufferViewHeaders,
  98117. buffersU8
  98118. );
  98119. parseAvailability(subtree, subtreeJson, implicitTileset, bufferViewsU8);
  98120. if (defined_default(tilePropertyTableJson)) {
  98121. parseTileMetadataTable(subtree, implicitTileset, bufferViewsU8);
  98122. makeTileJumpBuffer(subtree);
  98123. }
  98124. parseContentMetadataTables(subtree, implicitTileset, bufferViewsU8);
  98125. makeContentJumpBuffers(subtree);
  98126. subtree._readyPromise.resolve(subtree);
  98127. }).catch(function(error) {
  98128. subtree._readyPromise.reject(error);
  98129. });
  98130. }
  98131. function parseSubtreeChunks(subtreeView) {
  98132. const littleEndian2 = true;
  98133. const subtreeReader = new DataView(
  98134. subtreeView.buffer,
  98135. subtreeView.byteOffset
  98136. );
  98137. let byteOffset = 8;
  98138. const jsonByteLength = subtreeReader.getUint32(byteOffset, littleEndian2);
  98139. byteOffset += 8;
  98140. const binaryByteLength = subtreeReader.getUint32(byteOffset, littleEndian2);
  98141. byteOffset += 8;
  98142. const subtreeJson = getJsonFromTypedArray_default(
  98143. subtreeView,
  98144. byteOffset,
  98145. jsonByteLength
  98146. );
  98147. byteOffset += jsonByteLength;
  98148. const subtreeBinary = subtreeView.subarray(
  98149. byteOffset,
  98150. byteOffset + binaryByteLength
  98151. );
  98152. return {
  98153. json: subtreeJson,
  98154. binary: subtreeBinary
  98155. };
  98156. }
  98157. function preprocessBuffers(bufferHeaders) {
  98158. bufferHeaders = defined_default(bufferHeaders) ? bufferHeaders : [];
  98159. for (let i2 = 0; i2 < bufferHeaders.length; i2++) {
  98160. const bufferHeader = bufferHeaders[i2];
  98161. bufferHeader.isExternal = defined_default(bufferHeader.uri);
  98162. bufferHeader.isActive = false;
  98163. }
  98164. return bufferHeaders;
  98165. }
  98166. function preprocessBufferViews(bufferViewHeaders, bufferHeaders) {
  98167. bufferViewHeaders = defined_default(bufferViewHeaders) ? bufferViewHeaders : [];
  98168. for (let i2 = 0; i2 < bufferViewHeaders.length; i2++) {
  98169. const bufferViewHeader = bufferViewHeaders[i2];
  98170. const bufferHeader = bufferHeaders[bufferViewHeader.buffer];
  98171. bufferViewHeader.bufferHeader = bufferHeader;
  98172. bufferViewHeader.isActive = false;
  98173. }
  98174. return bufferViewHeaders;
  98175. }
  98176. function markActiveBufferViews(subtreeJson, bufferViewHeaders) {
  98177. let header;
  98178. const tileAvailabilityHeader = subtreeJson.tileAvailability;
  98179. if (defined_default(tileAvailabilityHeader.bitstream)) {
  98180. header = bufferViewHeaders[tileAvailabilityHeader.bitstream];
  98181. } else if (defined_default(tileAvailabilityHeader.bufferView)) {
  98182. header = bufferViewHeaders[tileAvailabilityHeader.bufferView];
  98183. }
  98184. if (defined_default(header)) {
  98185. header.isActive = true;
  98186. header.bufferHeader.isActive = true;
  98187. }
  98188. const contentAvailabilityHeaders = subtreeJson.contentAvailabilityHeaders;
  98189. for (let i2 = 0; i2 < contentAvailabilityHeaders.length; i2++) {
  98190. header = void 0;
  98191. if (defined_default(contentAvailabilityHeaders[i2].bitstream)) {
  98192. header = bufferViewHeaders[contentAvailabilityHeaders[i2].bitstream];
  98193. } else if (defined_default(contentAvailabilityHeaders[i2].bufferView)) {
  98194. header = bufferViewHeaders[contentAvailabilityHeaders[i2].bufferView];
  98195. }
  98196. if (defined_default(header)) {
  98197. header.isActive = true;
  98198. header.bufferHeader.isActive = true;
  98199. }
  98200. }
  98201. header = void 0;
  98202. const childSubtreeAvailabilityHeader = subtreeJson.childSubtreeAvailability;
  98203. if (defined_default(childSubtreeAvailabilityHeader.bitstream)) {
  98204. header = bufferViewHeaders[childSubtreeAvailabilityHeader.bitstream];
  98205. } else if (defined_default(childSubtreeAvailabilityHeader.bufferView)) {
  98206. header = bufferViewHeaders[childSubtreeAvailabilityHeader.bufferView];
  98207. }
  98208. if (defined_default(header)) {
  98209. header.isActive = true;
  98210. header.bufferHeader.isActive = true;
  98211. }
  98212. }
  98213. function markActiveMetadataBufferViews(propertyTableJson, bufferViewHeaders) {
  98214. const properties = propertyTableJson.properties;
  98215. let header;
  98216. for (const key in properties) {
  98217. if (properties.hasOwnProperty(key)) {
  98218. const metadataHeader = properties[key];
  98219. const valuesBufferView = defaultValue_default(
  98220. metadataHeader.values,
  98221. metadataHeader.bufferView
  98222. );
  98223. header = bufferViewHeaders[valuesBufferView];
  98224. header.isActive = true;
  98225. header.bufferHeader.isActive = true;
  98226. const stringOffsetBufferView = defaultValue_default(
  98227. metadataHeader.stringOffsets,
  98228. metadataHeader.stringOffsetBufferView
  98229. );
  98230. if (defined_default(stringOffsetBufferView)) {
  98231. header = bufferViewHeaders[stringOffsetBufferView];
  98232. header.isActive = true;
  98233. header.bufferHeader.isActive = true;
  98234. }
  98235. const arrayOffsetBufferView = defaultValue_default(
  98236. metadataHeader.arrayOffsets,
  98237. metadataHeader.arrayOffsetBufferView
  98238. );
  98239. if (defined_default(arrayOffsetBufferView)) {
  98240. header = bufferViewHeaders[arrayOffsetBufferView];
  98241. header.isActive = true;
  98242. header.bufferHeader.isActive = true;
  98243. }
  98244. }
  98245. }
  98246. }
  98247. function requestActiveBuffers(subtree, bufferHeaders, internalBuffer) {
  98248. const promises = [];
  98249. for (let i2 = 0; i2 < bufferHeaders.length; i2++) {
  98250. const bufferHeader = bufferHeaders[i2];
  98251. if (!bufferHeader.isActive) {
  98252. promises.push(Promise.resolve(void 0));
  98253. } else if (bufferHeader.isExternal) {
  98254. const promise = requestExternalBuffer(subtree, bufferHeader);
  98255. promises.push(promise);
  98256. } else {
  98257. promises.push(Promise.resolve(internalBuffer));
  98258. }
  98259. }
  98260. return Promise.all(promises).then(function(bufferResults) {
  98261. const buffersU8 = {};
  98262. for (let i2 = 0; i2 < bufferResults.length; i2++) {
  98263. const result = bufferResults[i2];
  98264. if (defined_default(result)) {
  98265. buffersU8[i2] = result;
  98266. }
  98267. }
  98268. return buffersU8;
  98269. });
  98270. }
  98271. function requestExternalBuffer(subtree, bufferHeader) {
  98272. const baseResource2 = subtree._resource;
  98273. const bufferResource = baseResource2.getDerivedResource({
  98274. url: bufferHeader.uri
  98275. });
  98276. const bufferLoader = ResourceCache_default.loadExternalBuffer({
  98277. resource: bufferResource
  98278. });
  98279. subtree._bufferLoader = bufferLoader;
  98280. return bufferLoader.promise.then(function(bufferLoader2) {
  98281. return bufferLoader2.typedArray;
  98282. });
  98283. }
  98284. function parseActiveBufferViews(bufferViewHeaders, buffersU8) {
  98285. const bufferViewsU8 = {};
  98286. for (let i2 = 0; i2 < bufferViewHeaders.length; i2++) {
  98287. const bufferViewHeader = bufferViewHeaders[i2];
  98288. if (!bufferViewHeader.isActive) {
  98289. continue;
  98290. }
  98291. const start = bufferViewHeader.byteOffset;
  98292. const end = start + bufferViewHeader.byteLength;
  98293. const buffer = buffersU8[bufferViewHeader.buffer];
  98294. const bufferView = buffer.subarray(start, end);
  98295. bufferViewsU8[i2] = bufferView;
  98296. }
  98297. return bufferViewsU8;
  98298. }
  98299. function parseAvailability(subtree, subtreeJson, implicitTileset, bufferViewsU8) {
  98300. const branchingFactor = implicitTileset.branchingFactor;
  98301. const subtreeLevels = implicitTileset.subtreeLevels;
  98302. const tileAvailabilityBits = (Math.pow(branchingFactor, subtreeLevels) - 1) / (branchingFactor - 1);
  98303. const childSubtreeBits = Math.pow(branchingFactor, subtreeLevels);
  98304. const hasMetadataExtension = hasExtension(subtreeJson, "3DTILES_metadata");
  98305. const hasTileMetadata = defined_default(subtree._tilePropertyTableJson);
  98306. let computeAvailableCountEnabled = hasMetadataExtension || hasTileMetadata;
  98307. subtree._tileAvailability = parseAvailabilityBitstream(
  98308. subtreeJson.tileAvailability,
  98309. bufferViewsU8,
  98310. tileAvailabilityBits,
  98311. computeAvailableCountEnabled
  98312. );
  98313. const hasContentMetadata = subtree._contentPropertyTableJsons.length > 0;
  98314. computeAvailableCountEnabled = computeAvailableCountEnabled || hasContentMetadata;
  98315. for (let i2 = 0; i2 < subtreeJson.contentAvailabilityHeaders.length; i2++) {
  98316. const bitstream = parseAvailabilityBitstream(
  98317. subtreeJson.contentAvailabilityHeaders[i2],
  98318. bufferViewsU8,
  98319. tileAvailabilityBits,
  98320. computeAvailableCountEnabled
  98321. );
  98322. subtree._contentAvailabilityBitstreams.push(bitstream);
  98323. }
  98324. subtree._childSubtreeAvailability = parseAvailabilityBitstream(
  98325. subtreeJson.childSubtreeAvailability,
  98326. bufferViewsU8,
  98327. childSubtreeBits
  98328. );
  98329. }
  98330. function parseAvailabilityBitstream(availabilityJson, bufferViewsU8, lengthBits, computeAvailableCountEnabled) {
  98331. if (defined_default(availabilityJson.constant)) {
  98332. return new ImplicitAvailabilityBitstream({
  98333. constant: Boolean(availabilityJson.constant),
  98334. lengthBits,
  98335. availableCount: availabilityJson.availableCount
  98336. });
  98337. }
  98338. let bufferView;
  98339. if (defined_default(availabilityJson.bitstream)) {
  98340. bufferView = bufferViewsU8[availabilityJson.bitstream];
  98341. } else if (defined_default(availabilityJson.bufferView)) {
  98342. bufferView = bufferViewsU8[availabilityJson.bufferView];
  98343. }
  98344. return new ImplicitAvailabilityBitstream({
  98345. bitstream: bufferView,
  98346. lengthBits,
  98347. availableCount: availabilityJson.availableCount,
  98348. computeAvailableCountEnabled
  98349. });
  98350. }
  98351. function parseTileMetadataTable(subtree, implicitTileset, bufferViewsU8) {
  98352. const tilePropertyTableJson = subtree._tilePropertyTableJson;
  98353. const tileCount = subtree._tileAvailability.availableCount;
  98354. const metadataSchema = implicitTileset.metadataSchema;
  98355. const tileMetadataClassName = tilePropertyTableJson.class;
  98356. const tileMetadataClass = metadataSchema.classes[tileMetadataClassName];
  98357. subtree._tileMetadataTable = new MetadataTable_default({
  98358. class: tileMetadataClass,
  98359. count: tileCount,
  98360. properties: tilePropertyTableJson.properties,
  98361. bufferViews: bufferViewsU8
  98362. });
  98363. }
  98364. function parseContentMetadataTables(subtree, implicitTileset, bufferViewsU8) {
  98365. const contentPropertyTableJsons = subtree._contentPropertyTableJsons;
  98366. const contentAvailabilityBitstreams = subtree._contentAvailabilityBitstreams;
  98367. const metadataSchema = implicitTileset.metadataSchema;
  98368. const contentMetadataTables = subtree._contentMetadataTables;
  98369. for (let i2 = 0; i2 < contentPropertyTableJsons.length; i2++) {
  98370. const contentPropertyTableJson = contentPropertyTableJsons[i2];
  98371. const contentAvailabilityBitsteam = contentAvailabilityBitstreams[i2];
  98372. const contentCount = contentAvailabilityBitsteam.availableCount;
  98373. const contentMetadataClassName = contentPropertyTableJson.class;
  98374. const contentMetadataClass = metadataSchema.classes[contentMetadataClassName];
  98375. const metadataTable = new MetadataTable_default({
  98376. class: contentMetadataClass,
  98377. count: contentCount,
  98378. properties: contentPropertyTableJson.properties,
  98379. bufferViews: bufferViewsU8
  98380. });
  98381. contentMetadataTables.push(metadataTable);
  98382. }
  98383. }
  98384. function makeJumpBuffer(availability) {
  98385. let entityId = 0;
  98386. const bufferLength = availability.lengthBits;
  98387. const availableCount = availability.availableCount;
  98388. let jumpBuffer;
  98389. if (availableCount < 256) {
  98390. jumpBuffer = new Uint8Array(bufferLength);
  98391. } else if (availableCount < 65536) {
  98392. jumpBuffer = new Uint16Array(bufferLength);
  98393. } else {
  98394. jumpBuffer = new Uint32Array(bufferLength);
  98395. }
  98396. for (let i2 = 0; i2 < availability.lengthBits; i2++) {
  98397. if (availability.getBit(i2)) {
  98398. jumpBuffer[i2] = entityId;
  98399. entityId++;
  98400. }
  98401. }
  98402. return jumpBuffer;
  98403. }
  98404. function makeTileJumpBuffer(subtree) {
  98405. const tileJumpBuffer = makeJumpBuffer(subtree._tileAvailability);
  98406. subtree._tileJumpBuffer = tileJumpBuffer;
  98407. }
  98408. function makeContentJumpBuffers(subtree) {
  98409. const contentJumpBuffers = subtree._contentJumpBuffers;
  98410. const contentAvailabilityBitstreams = subtree._contentAvailabilityBitstreams;
  98411. for (let i2 = 0; i2 < contentAvailabilityBitstreams.length; i2++) {
  98412. const contentAvailability = contentAvailabilityBitstreams[i2];
  98413. const contentJumpBuffer = makeJumpBuffer(contentAvailability);
  98414. contentJumpBuffers.push(contentJumpBuffer);
  98415. }
  98416. }
  98417. ImplicitSubtree.prototype.getTileIndex = function(implicitCoordinates) {
  98418. const localLevel = implicitCoordinates.level - this._implicitCoordinates.level;
  98419. if (localLevel < 0 || this._subtreeLevels <= localLevel) {
  98420. throw new RuntimeError_default("level is out of bounds for this subtree");
  98421. }
  98422. const subtreeCoordinates = implicitCoordinates.getSubtreeCoordinates();
  98423. const offsetCoordinates = subtreeCoordinates.getOffsetCoordinates(
  98424. implicitCoordinates
  98425. );
  98426. const index2 = offsetCoordinates.tileIndex;
  98427. return index2;
  98428. };
  98429. ImplicitSubtree.prototype.getChildSubtreeIndex = function(implicitCoordinates) {
  98430. const localLevel = implicitCoordinates.level - this._implicitCoordinates.level;
  98431. if (localLevel !== this._implicitCoordinates.subtreeLevels) {
  98432. throw new RuntimeError_default("level is out of bounds for this subtree");
  98433. }
  98434. const parentSubtreeCoordinates = implicitCoordinates.getParentSubtreeCoordinates();
  98435. const offsetCoordinates = parentSubtreeCoordinates.getOffsetCoordinates(
  98436. implicitCoordinates
  98437. );
  98438. const index2 = offsetCoordinates.mortonIndex;
  98439. return index2;
  98440. };
  98441. function getTileEntityId(subtree, implicitCoordinates) {
  98442. if (!defined_default(subtree._tileMetadataTable)) {
  98443. return void 0;
  98444. }
  98445. const tileIndex = subtree.getTileIndex(implicitCoordinates);
  98446. if (subtree._tileAvailability.getBit(tileIndex)) {
  98447. return subtree._tileJumpBuffer[tileIndex];
  98448. }
  98449. return void 0;
  98450. }
  98451. function getContentEntityId(subtree, implicitCoordinates, contentIndex) {
  98452. const metadataTables = subtree._contentMetadataTables;
  98453. if (!defined_default(metadataTables)) {
  98454. return void 0;
  98455. }
  98456. const metadataTable = metadataTables[contentIndex];
  98457. if (!defined_default(metadataTable)) {
  98458. return void 0;
  98459. }
  98460. const availability = subtree._contentAvailabilityBitstreams[contentIndex];
  98461. const tileIndex = subtree.getTileIndex(implicitCoordinates);
  98462. if (availability.getBit(tileIndex)) {
  98463. const contentJumpBuffer = subtree._contentJumpBuffers[contentIndex];
  98464. return contentJumpBuffer[tileIndex];
  98465. }
  98466. return void 0;
  98467. }
  98468. ImplicitSubtree.prototype.getTileMetadataView = function(implicitCoordinates) {
  98469. const entityId = getTileEntityId(this, implicitCoordinates);
  98470. if (!defined_default(entityId)) {
  98471. return void 0;
  98472. }
  98473. const metadataTable = this._tileMetadataTable;
  98474. return new ImplicitMetadataView({
  98475. class: metadataTable.class,
  98476. metadataTable,
  98477. entityId,
  98478. propertyTableJson: this._tilePropertyTableJson
  98479. });
  98480. };
  98481. ImplicitSubtree.prototype.getContentMetadataView = function(implicitCoordinates, contentIndex) {
  98482. const entityId = getContentEntityId(this, implicitCoordinates, contentIndex);
  98483. if (!defined_default(entityId)) {
  98484. return void 0;
  98485. }
  98486. const metadataTable = this._contentMetadataTables[contentIndex];
  98487. const propertyTableJson = this._contentPropertyTableJsons[contentIndex];
  98488. return new ImplicitMetadataView({
  98489. class: metadataTable.class,
  98490. metadataTable,
  98491. entityId,
  98492. contentIndex,
  98493. propertyTableJson
  98494. });
  98495. };
  98496. ImplicitSubtree.prototype.isDestroyed = function() {
  98497. return false;
  98498. };
  98499. ImplicitSubtree.prototype.destroy = function() {
  98500. if (defined_default(this._bufferLoader)) {
  98501. ResourceCache_default.unload(this._bufferLoader);
  98502. }
  98503. return destroyObject_default(this);
  98504. };
  98505. // node_modules/cesium/Source/Scene/MetadataSemantic.js
  98506. var MetadataSemantic = {
  98507. ID: "ID",
  98508. NAME: "NAME",
  98509. DESCRIPTION: "DESCRIPTION",
  98510. TILE_BOUNDING_BOX: "TILE_BOUNDING_BOX",
  98511. TILE_BOUNDING_REGION: "TILE_BOUNDING_REGION",
  98512. TILE_BOUNDING_SPHERE: "TILE_BOUNDING_SPHERE",
  98513. TILE_MINIMUM_HEIGHT: "TILE_MINIMUM_HEIGHT",
  98514. TILE_MAXIMUM_HEIGHT: "TILE_MAXIMUM_HEIGHT",
  98515. TILE_HORIZON_OCCLUSION_POINT: "TILE_HORIZON_OCCLUSION_POINT",
  98516. TILE_GEOMETRIC_ERROR: "TILE_GEOMETRIC_ERROR",
  98517. CONTENT_BOUNDING_BOX: "CONTENT_BOUNDING_BOX",
  98518. CONTENT_BOUNDING_REGION: "CONTENT_BOUNDING_REGION",
  98519. CONTENT_BOUNDING_SPHERE: "CONTENT_BOUNDING_SPHERE",
  98520. CONTENT_MINIMUM_HEIGHT: "CONTENT_MINIMUM_HEIGHT",
  98521. CONTENT_MAXIMUM_HEIGHT: "CONTENT_MAXIMUM_HEIGHT",
  98522. CONTENT_HORIZON_OCCLUSION_POINT: "CONTENT_HORIZON_OCCLUSION_POINT"
  98523. };
  98524. var MetadataSemantic_default = Object.freeze(MetadataSemantic);
  98525. // node_modules/cesium/Source/Scene/parseBoundingVolumeSemantics.js
  98526. function parseBoundingVolumeSemantics(tileMetadata) {
  98527. Check_default.typeOf.object("tileMetadata", tileMetadata);
  98528. return {
  98529. tile: {
  98530. boundingVolume: parseBoundingVolume("TILE", tileMetadata),
  98531. minimumHeight: parseMinimumHeight("TILE", tileMetadata),
  98532. maximumHeight: parseMaximumHeight("TILE", tileMetadata)
  98533. },
  98534. content: {
  98535. boundingVolume: parseBoundingVolume("CONTENT", tileMetadata),
  98536. minimumHeight: parseMinimumHeight("CONTENT", tileMetadata),
  98537. maximumHeight: parseMaximumHeight("CONTENT", tileMetadata)
  98538. }
  98539. };
  98540. }
  98541. function parseBoundingVolume(prefix, tileMetadata) {
  98542. const boundingBoxSemantic = `${prefix}_BOUNDING_BOX`;
  98543. const boundingBox = tileMetadata.getPropertyBySemantic(boundingBoxSemantic);
  98544. if (defined_default(boundingBox)) {
  98545. return {
  98546. box: boundingBox
  98547. };
  98548. }
  98549. const boundingRegionSemantic = `${prefix}_BOUNDING_REGION`;
  98550. const boundingRegion = tileMetadata.getPropertyBySemantic(
  98551. boundingRegionSemantic
  98552. );
  98553. if (defined_default(boundingRegion)) {
  98554. return {
  98555. region: boundingRegion
  98556. };
  98557. }
  98558. const boundingSphereSemantic = `${prefix}_BOUNDING_SPHERE`;
  98559. const boundingSphere = tileMetadata.getPropertyBySemantic(
  98560. boundingSphereSemantic
  98561. );
  98562. if (defined_default(boundingSphere)) {
  98563. return {
  98564. sphere: boundingSphere
  98565. };
  98566. }
  98567. return void 0;
  98568. }
  98569. function parseMinimumHeight(prefix, tileMetadata) {
  98570. const minimumHeightSemantic = `${prefix}_MINIMUM_HEIGHT`;
  98571. return tileMetadata.getPropertyBySemantic(minimumHeightSemantic);
  98572. }
  98573. function parseMaximumHeight(prefix, tileMetadata) {
  98574. const maximumHeightSemantic = `${prefix}_MAXIMUM_HEIGHT`;
  98575. return tileMetadata.getPropertyBySemantic(maximumHeightSemantic);
  98576. }
  98577. // node_modules/cesium/Source/Scene/Implicit3DTileContent.js
  98578. function Implicit3DTileContent(tileset, tile, resource, json, arrayBuffer, byteOffset) {
  98579. Check_default.defined("tile.implicitTileset", tile.implicitTileset);
  98580. Check_default.defined("tile.implicitCoordinates", tile.implicitCoordinates);
  98581. if (defined_default(json) === defined_default(arrayBuffer)) {
  98582. throw new DeveloperError_default("One of json and arrayBuffer must be defined.");
  98583. }
  98584. const implicitTileset = tile.implicitTileset;
  98585. const implicitCoordinates = tile.implicitCoordinates;
  98586. this._implicitTileset = implicitTileset;
  98587. this._implicitCoordinates = implicitCoordinates;
  98588. this._implicitSubtree = void 0;
  98589. this._tileset = tileset;
  98590. this._tile = tile;
  98591. this._resource = resource;
  98592. this._readyPromise = defer_default();
  98593. this._metadata = void 0;
  98594. this.featurePropertiesDirty = false;
  98595. this._group = void 0;
  98596. const templateValues = implicitCoordinates.getTemplateValues();
  98597. const subtreeResource = implicitTileset.subtreeUriTemplate.getDerivedResource(
  98598. {
  98599. templateValues
  98600. }
  98601. );
  98602. this._url = subtreeResource.getUrlComponent(true);
  98603. initialize8(this, json, arrayBuffer, byteOffset);
  98604. }
  98605. Object.defineProperties(Implicit3DTileContent.prototype, {
  98606. featuresLength: {
  98607. get: function() {
  98608. return 0;
  98609. }
  98610. },
  98611. pointsLength: {
  98612. get: function() {
  98613. return 0;
  98614. }
  98615. },
  98616. trianglesLength: {
  98617. get: function() {
  98618. return 0;
  98619. }
  98620. },
  98621. geometryByteLength: {
  98622. get: function() {
  98623. return 0;
  98624. }
  98625. },
  98626. texturesByteLength: {
  98627. get: function() {
  98628. return 0;
  98629. }
  98630. },
  98631. batchTableByteLength: {
  98632. get: function() {
  98633. return 0;
  98634. }
  98635. },
  98636. innerContents: {
  98637. get: function() {
  98638. return void 0;
  98639. }
  98640. },
  98641. readyPromise: {
  98642. get: function() {
  98643. return this._readyPromise.promise;
  98644. }
  98645. },
  98646. tileset: {
  98647. get: function() {
  98648. return this._tileset;
  98649. }
  98650. },
  98651. tile: {
  98652. get: function() {
  98653. return this._tile;
  98654. }
  98655. },
  98656. url: {
  98657. get: function() {
  98658. return this._url;
  98659. }
  98660. },
  98661. metadata: {
  98662. get: function() {
  98663. return void 0;
  98664. },
  98665. set: function() {
  98666. throw new DeveloperError_default("Implicit3DTileContent cannot have metadata");
  98667. }
  98668. },
  98669. batchTable: {
  98670. get: function() {
  98671. return void 0;
  98672. }
  98673. },
  98674. group: {
  98675. get: function() {
  98676. return this._group;
  98677. },
  98678. set: function(value) {
  98679. this._group = value;
  98680. }
  98681. }
  98682. });
  98683. function initialize8(content, json, arrayBuffer, byteOffset) {
  98684. byteOffset = defaultValue_default(byteOffset, 0);
  98685. let uint8Array;
  98686. if (defined_default(arrayBuffer)) {
  98687. uint8Array = new Uint8Array(arrayBuffer, byteOffset);
  98688. }
  98689. const subtree = new ImplicitSubtree(
  98690. content._resource,
  98691. json,
  98692. uint8Array,
  98693. content._implicitTileset,
  98694. content._implicitCoordinates
  98695. );
  98696. content._implicitSubtree = subtree;
  98697. subtree.readyPromise.then(function() {
  98698. expandSubtree(content, subtree);
  98699. content._readyPromise.resolve();
  98700. }).catch(function(error) {
  98701. content._readyPromise.reject(error);
  98702. });
  98703. }
  98704. function expandSubtree(content, subtree) {
  98705. const placeholderTile = content._tile;
  98706. const childIndex = content._implicitCoordinates.childIndex;
  98707. const results = transcodeSubtreeTiles(
  98708. content,
  98709. subtree,
  98710. placeholderTile,
  98711. childIndex
  98712. );
  98713. placeholderTile.children.push(results.rootTile);
  98714. const childSubtrees = listChildSubtrees(content, subtree, results.bottomRow);
  98715. for (let i2 = 0; i2 < childSubtrees.length; i2++) {
  98716. const subtreeLocator = childSubtrees[i2];
  98717. const leafTile = subtreeLocator.tile;
  98718. const implicitChildTile = makePlaceholderChildSubtree(
  98719. content,
  98720. leafTile,
  98721. subtreeLocator.childIndex
  98722. );
  98723. leafTile.children.push(implicitChildTile);
  98724. }
  98725. }
  98726. function listChildSubtrees(content, subtree, bottomRow) {
  98727. const results = [];
  98728. const branchingFactor = content._implicitTileset.branchingFactor;
  98729. for (let i2 = 0; i2 < bottomRow.length; i2++) {
  98730. const leafTile = bottomRow[i2];
  98731. if (!defined_default(leafTile)) {
  98732. continue;
  98733. }
  98734. for (let j = 0; j < branchingFactor; j++) {
  98735. const index2 = i2 * branchingFactor + j;
  98736. if (subtree.childSubtreeIsAvailableAtIndex(index2)) {
  98737. results.push({
  98738. tile: leafTile,
  98739. childIndex: j
  98740. });
  98741. }
  98742. }
  98743. }
  98744. return results;
  98745. }
  98746. function transcodeSubtreeTiles(content, subtree, placeholderTile, childIndex) {
  98747. const rootBitIndex = 0;
  98748. const rootParentIsPlaceholder = true;
  98749. const rootTile = deriveChildTile(
  98750. content,
  98751. subtree,
  98752. placeholderTile,
  98753. childIndex,
  98754. rootBitIndex,
  98755. rootParentIsPlaceholder
  98756. );
  98757. let parentRow = [rootTile];
  98758. let currentRow = [];
  98759. const implicitTileset = content._implicitTileset;
  98760. for (let level = 1; level < implicitTileset.subtreeLevels; level++) {
  98761. const levelOffset = subtree.getLevelOffset(level);
  98762. const numberOfChildren = implicitTileset.branchingFactor * parentRow.length;
  98763. for (let childMortonIndex = 0; childMortonIndex < numberOfChildren; childMortonIndex++) {
  98764. const childBitIndex = levelOffset + childMortonIndex;
  98765. if (!subtree.tileIsAvailableAtIndex(childBitIndex)) {
  98766. currentRow.push(void 0);
  98767. continue;
  98768. }
  98769. const parentMortonIndex = subtree.getParentMortonIndex(childMortonIndex);
  98770. const parentTile = parentRow[parentMortonIndex];
  98771. const childChildIndex = childMortonIndex % implicitTileset.branchingFactor;
  98772. const childTile = deriveChildTile(
  98773. content,
  98774. subtree,
  98775. parentTile,
  98776. childChildIndex,
  98777. childBitIndex
  98778. );
  98779. parentTile.children.push(childTile);
  98780. currentRow.push(childTile);
  98781. }
  98782. parentRow = currentRow;
  98783. currentRow = [];
  98784. }
  98785. return {
  98786. rootTile,
  98787. bottomRow: parentRow
  98788. };
  98789. }
  98790. function getGeometricError(tileMetadata, implicitTileset, implicitCoordinates) {
  98791. const semantic = MetadataSemantic_default.TILE_GEOMETRIC_ERROR;
  98792. if (defined_default(tileMetadata) && tileMetadata.hasPropertyBySemantic(semantic)) {
  98793. return tileMetadata.getPropertyBySemantic(semantic);
  98794. }
  98795. return implicitTileset.geometricError / Math.pow(2, implicitCoordinates.level);
  98796. }
  98797. function deriveChildTile(implicitContent, subtree, parentTile, childIndex, childBitIndex, parentIsPlaceholderTile) {
  98798. const implicitTileset = implicitContent._implicitTileset;
  98799. let implicitCoordinates;
  98800. if (defaultValue_default(parentIsPlaceholderTile, false)) {
  98801. implicitCoordinates = parentTile.implicitCoordinates;
  98802. } else {
  98803. implicitCoordinates = parentTile.implicitCoordinates.getChildCoordinates(
  98804. childIndex
  98805. );
  98806. }
  98807. let tileMetadata;
  98808. let tileBounds;
  98809. let contentBounds;
  98810. if (defined_default(subtree.tilePropertyTableJson)) {
  98811. tileMetadata = subtree.getTileMetadataView(implicitCoordinates);
  98812. const boundingVolumeSemantics = parseBoundingVolumeSemantics(tileMetadata);
  98813. tileBounds = boundingVolumeSemantics.tile;
  98814. contentBounds = boundingVolumeSemantics.content;
  98815. }
  98816. const contentPropertyTableJsons = subtree.contentPropertyTableJsons;
  98817. const length3 = contentPropertyTableJsons.length;
  98818. let hasImplicitContentMetadata = false;
  98819. for (let i2 = 0; i2 < length3; i2++) {
  98820. if (subtree.contentIsAvailableAtCoordinates(implicitCoordinates, i2)) {
  98821. hasImplicitContentMetadata = true;
  98822. break;
  98823. }
  98824. }
  98825. const boundingVolume = getTileBoundingVolume(
  98826. implicitTileset,
  98827. implicitCoordinates,
  98828. childIndex,
  98829. parentIsPlaceholderTile,
  98830. parentTile,
  98831. tileBounds
  98832. );
  98833. const contentJsons = [];
  98834. for (let i2 = 0; i2 < implicitTileset.contentCount; i2++) {
  98835. if (!subtree.contentIsAvailableAtIndex(childBitIndex, i2)) {
  98836. continue;
  98837. }
  98838. const childContentTemplate = implicitTileset.contentUriTemplates[i2];
  98839. const childContentUri = childContentTemplate.getDerivedResource({
  98840. templateValues: implicitCoordinates.getTemplateValues()
  98841. }).url;
  98842. const contentJson = {
  98843. uri: childContentUri
  98844. };
  98845. const contentBoundingVolume = getContentBoundingVolume(
  98846. boundingVolume,
  98847. contentBounds
  98848. );
  98849. if (defined_default(contentBoundingVolume)) {
  98850. contentJson.boundingVolume = contentBoundingVolume;
  98851. }
  98852. contentJsons.push(combine_default(contentJson, implicitTileset.contentHeaders[i2]));
  98853. }
  98854. const childGeometricError = getGeometricError(
  98855. tileMetadata,
  98856. implicitTileset,
  98857. implicitCoordinates
  98858. );
  98859. const tileJson = {
  98860. boundingVolume,
  98861. geometricError: childGeometricError,
  98862. refine: implicitTileset.refine,
  98863. contents: contentJsons
  98864. };
  98865. const deep = true;
  98866. const rootHeader = clone_default(implicitTileset.tileHeader, deep);
  98867. delete rootHeader.boundingVolume;
  98868. delete rootHeader.transform;
  98869. const combinedTileJson = combine_default(tileJson, rootHeader, deep);
  98870. const childTile = makeTile(
  98871. implicitContent,
  98872. implicitTileset.baseResource,
  98873. combinedTileJson,
  98874. parentTile
  98875. );
  98876. childTile.implicitCoordinates = implicitCoordinates;
  98877. childTile.implicitSubtree = subtree;
  98878. childTile.metadata = tileMetadata;
  98879. childTile.hasImplicitContentMetadata = hasImplicitContentMetadata;
  98880. return childTile;
  98881. }
  98882. function canUpdateHeights(boundingVolume, tileBounds) {
  98883. return defined_default(boundingVolume) && defined_default(tileBounds) && (defined_default(tileBounds.minimumHeight) || defined_default(tileBounds.maximumHeight)) && (hasExtension(boundingVolume, "3DTILES_bounding_volume_S2") || defined_default(boundingVolume.region));
  98884. }
  98885. function updateHeights(boundingVolume, tileBounds) {
  98886. if (!defined_default(tileBounds)) {
  98887. return;
  98888. }
  98889. if (hasExtension(boundingVolume, "3DTILES_bounding_volume_S2")) {
  98890. updateS2CellHeights(
  98891. boundingVolume.extensions["3DTILES_bounding_volume_S2"],
  98892. tileBounds.minimumHeight,
  98893. tileBounds.maximumHeight
  98894. );
  98895. } else if (defined_default(boundingVolume.region)) {
  98896. updateRegionHeights(
  98897. boundingVolume.region,
  98898. tileBounds.minimumHeight,
  98899. tileBounds.maximumHeight
  98900. );
  98901. }
  98902. }
  98903. function updateRegionHeights(region, minimumHeight, maximumHeight) {
  98904. if (defined_default(minimumHeight)) {
  98905. region[4] = minimumHeight;
  98906. }
  98907. if (defined_default(maximumHeight)) {
  98908. region[5] = maximumHeight;
  98909. }
  98910. }
  98911. function updateS2CellHeights(s2CellVolume, minimumHeight, maximumHeight) {
  98912. if (defined_default(minimumHeight)) {
  98913. s2CellVolume.minimumHeight = minimumHeight;
  98914. }
  98915. if (defined_default(maximumHeight)) {
  98916. s2CellVolume.maximumHeight = maximumHeight;
  98917. }
  98918. }
  98919. function getTileBoundingVolume(implicitTileset, implicitCoordinates, childIndex, parentIsPlaceholderTile, parentTile, tileBounds) {
  98920. let boundingVolume;
  98921. if (!defined_default(tileBounds) || !defined_default(tileBounds.boundingVolume) || !canUpdateHeights(tileBounds.boundingVolume, tileBounds) && canUpdateHeights(implicitTileset.boundingVolume, tileBounds)) {
  98922. boundingVolume = deriveBoundingVolume(
  98923. implicitTileset,
  98924. implicitCoordinates,
  98925. childIndex,
  98926. defaultValue_default(parentIsPlaceholderTile, false),
  98927. parentTile
  98928. );
  98929. } else {
  98930. boundingVolume = tileBounds.boundingVolume;
  98931. }
  98932. updateHeights(boundingVolume, tileBounds);
  98933. return boundingVolume;
  98934. }
  98935. function getContentBoundingVolume(tileBoundingVolume, contentBounds) {
  98936. let contentBoundingVolume;
  98937. if (defined_default(contentBounds)) {
  98938. contentBoundingVolume = contentBounds.boundingVolume;
  98939. }
  98940. if (canUpdateHeights(contentBoundingVolume, contentBounds)) {
  98941. updateHeights(contentBoundingVolume, contentBounds);
  98942. } else if (canUpdateHeights(tileBoundingVolume, contentBounds)) {
  98943. contentBoundingVolume = clone_default(tileBoundingVolume, true);
  98944. updateHeights(contentBoundingVolume, contentBounds);
  98945. }
  98946. return contentBoundingVolume;
  98947. }
  98948. function deriveBoundingVolume(implicitTileset, implicitCoordinates, childIndex, parentIsPlaceholderTile, parentTile) {
  98949. const rootBoundingVolume = implicitTileset.boundingVolume;
  98950. if (hasExtension(rootBoundingVolume, "3DTILES_bounding_volume_S2")) {
  98951. return deriveBoundingVolumeS2(
  98952. parentIsPlaceholderTile,
  98953. parentTile,
  98954. childIndex,
  98955. implicitCoordinates.level,
  98956. implicitCoordinates.x,
  98957. implicitCoordinates.y,
  98958. implicitCoordinates.z
  98959. );
  98960. }
  98961. if (defined_default(rootBoundingVolume.region)) {
  98962. const childRegion = deriveBoundingRegion(
  98963. rootBoundingVolume.region,
  98964. implicitCoordinates.level,
  98965. implicitCoordinates.x,
  98966. implicitCoordinates.y,
  98967. implicitCoordinates.z
  98968. );
  98969. return {
  98970. region: childRegion
  98971. };
  98972. }
  98973. const childBox = deriveBoundingBox(
  98974. rootBoundingVolume.box,
  98975. implicitCoordinates.level,
  98976. implicitCoordinates.x,
  98977. implicitCoordinates.y,
  98978. implicitCoordinates.z
  98979. );
  98980. return {
  98981. box: childBox
  98982. };
  98983. }
  98984. function deriveBoundingVolumeS2(parentIsPlaceholderTile, parentTile, childIndex, level, x, y, z) {
  98985. Check_default.typeOf.bool("parentIsPlaceholderTile", parentIsPlaceholderTile);
  98986. Check_default.typeOf.object("parentTile", parentTile);
  98987. Check_default.typeOf.number("childIndex", childIndex);
  98988. Check_default.typeOf.number("level", level);
  98989. Check_default.typeOf.number("x", x);
  98990. Check_default.typeOf.number("y", y);
  98991. if (defined_default(z)) {
  98992. Check_default.typeOf.number("z", z);
  98993. }
  98994. const boundingVolumeS2 = parentTile._boundingVolume;
  98995. if (parentIsPlaceholderTile) {
  98996. return {
  98997. extensions: {
  98998. "3DTILES_bounding_volume_S2": {
  98999. token: S2Cell_default.getTokenFromId(boundingVolumeS2.s2Cell._cellId),
  99000. minimumHeight: boundingVolumeS2.minimumHeight,
  99001. maximumHeight: boundingVolumeS2.maximumHeight
  99002. }
  99003. }
  99004. };
  99005. }
  99006. const face = Number(parentTile._boundingVolume.s2Cell._cellId >> BigInt(61));
  99007. const position = face % 2 === 0 ? HilbertOrder_default.encode2D(level, x, y) : HilbertOrder_default.encode2D(level, y, x);
  99008. const cell = S2Cell_default.fromFacePositionLevel(face, BigInt(position), level);
  99009. let minHeight, maxHeight;
  99010. if (defined_default(z)) {
  99011. const midpointHeight = (boundingVolumeS2.maximumHeight + boundingVolumeS2.minimumHeight) / 2;
  99012. minHeight = childIndex < 4 ? boundingVolumeS2.minimumHeight : midpointHeight;
  99013. maxHeight = childIndex < 4 ? midpointHeight : boundingVolumeS2.maximumHeight;
  99014. } else {
  99015. minHeight = boundingVolumeS2.minimumHeight;
  99016. maxHeight = boundingVolumeS2.maximumHeight;
  99017. }
  99018. return {
  99019. extensions: {
  99020. "3DTILES_bounding_volume_S2": {
  99021. token: S2Cell_default.getTokenFromId(cell._cellId),
  99022. minimumHeight: minHeight,
  99023. maximumHeight: maxHeight
  99024. }
  99025. }
  99026. };
  99027. }
  99028. var scratchScaleFactors = new Cartesian3_default();
  99029. var scratchRootCenter = new Cartesian3_default();
  99030. var scratchCenter4 = new Cartesian3_default();
  99031. var scratchHalfAxes = new Matrix3_default();
  99032. function deriveBoundingBox(rootBox, level, x, y, z) {
  99033. Check_default.typeOf.object("rootBox", rootBox);
  99034. Check_default.typeOf.number("level", level);
  99035. Check_default.typeOf.number("x", x);
  99036. Check_default.typeOf.number("y", y);
  99037. if (defined_default(z)) {
  99038. Check_default.typeOf.number("z", z);
  99039. }
  99040. if (level === 0) {
  99041. return rootBox;
  99042. }
  99043. const rootCenter = Cartesian3_default.unpack(rootBox, 0, scratchRootCenter);
  99044. const rootHalfAxes = Matrix3_default.unpack(rootBox, 3, scratchHalfAxes);
  99045. const tileScale = Math.pow(2, -level);
  99046. const modelSpaceX = -1 + (2 * x + 1) * tileScale;
  99047. const modelSpaceY = -1 + (2 * y + 1) * tileScale;
  99048. let modelSpaceZ = 0;
  99049. const scaleFactors = Cartesian3_default.fromElements(
  99050. tileScale,
  99051. tileScale,
  99052. 1,
  99053. scratchScaleFactors
  99054. );
  99055. if (defined_default(z)) {
  99056. modelSpaceZ = -1 + (2 * z + 1) * tileScale;
  99057. scaleFactors.z = tileScale;
  99058. }
  99059. let center = Cartesian3_default.fromElements(
  99060. modelSpaceX,
  99061. modelSpaceY,
  99062. modelSpaceZ,
  99063. scratchCenter4
  99064. );
  99065. center = Matrix3_default.multiplyByVector(rootHalfAxes, center, scratchCenter4);
  99066. center = Cartesian3_default.add(center, rootCenter, scratchCenter4);
  99067. let halfAxes = Matrix3_default.clone(rootHalfAxes);
  99068. halfAxes = Matrix3_default.multiplyByScale(halfAxes, scaleFactors, halfAxes);
  99069. const childBox = new Array(12);
  99070. Cartesian3_default.pack(center, childBox);
  99071. Matrix3_default.pack(halfAxes, childBox, 3);
  99072. return childBox;
  99073. }
  99074. var scratchRectangle3 = new Rectangle_default();
  99075. function deriveBoundingRegion(rootRegion, level, x, y, z) {
  99076. Check_default.typeOf.object("rootRegion", rootRegion);
  99077. Check_default.typeOf.number("level", level);
  99078. Check_default.typeOf.number("x", x);
  99079. Check_default.typeOf.number("y", y);
  99080. if (defined_default(z)) {
  99081. Check_default.typeOf.number("z", z);
  99082. }
  99083. if (level === 0) {
  99084. return rootRegion.slice();
  99085. }
  99086. const rectangle = Rectangle_default.unpack(rootRegion, 0, scratchRectangle3);
  99087. const rootMinimumHeight = rootRegion[4];
  99088. const rootMaximumHeight = rootRegion[5];
  99089. const tileScale = Math.pow(2, -level);
  99090. const childWidth = tileScale * rectangle.width;
  99091. const west = Math_default.negativePiToPi(rectangle.west + x * childWidth);
  99092. const east = Math_default.negativePiToPi(west + childWidth);
  99093. const childHeight = tileScale * rectangle.height;
  99094. const south = Math_default.negativePiToPi(rectangle.south + y * childHeight);
  99095. const north = Math_default.negativePiToPi(south + childHeight);
  99096. let minimumHeight = rootMinimumHeight;
  99097. let maximumHeight = rootMaximumHeight;
  99098. if (defined_default(z)) {
  99099. const childThickness = tileScale * (rootMaximumHeight - rootMinimumHeight);
  99100. minimumHeight += z * childThickness;
  99101. maximumHeight = minimumHeight + childThickness;
  99102. }
  99103. return [west, south, east, north, minimumHeight, maximumHeight];
  99104. }
  99105. function makePlaceholderChildSubtree(content, parentTile, childIndex) {
  99106. const implicitTileset = content._implicitTileset;
  99107. const implicitCoordinates = parentTile.implicitCoordinates.getChildCoordinates(
  99108. childIndex
  99109. );
  99110. const childBoundingVolume = deriveBoundingVolume(
  99111. implicitTileset,
  99112. implicitCoordinates,
  99113. childIndex,
  99114. false,
  99115. parentTile
  99116. );
  99117. const childGeometricError = getGeometricError(
  99118. void 0,
  99119. implicitTileset,
  99120. implicitCoordinates
  99121. );
  99122. const childContentUri = implicitTileset.subtreeUriTemplate.getDerivedResource(
  99123. {
  99124. templateValues: implicitCoordinates.getTemplateValues()
  99125. }
  99126. ).url;
  99127. const tileJson = {
  99128. boundingVolume: childBoundingVolume,
  99129. geometricError: childGeometricError,
  99130. refine: implicitTileset.refine,
  99131. contents: [
  99132. {
  99133. uri: childContentUri
  99134. }
  99135. ]
  99136. };
  99137. const tile = makeTile(
  99138. content,
  99139. implicitTileset.baseResource,
  99140. tileJson,
  99141. parentTile
  99142. );
  99143. tile.implicitTileset = implicitTileset;
  99144. tile.implicitCoordinates = implicitCoordinates;
  99145. return tile;
  99146. }
  99147. function makeTile(content, baseResource2, tileJson, parentTile) {
  99148. const Cesium3DTile2 = content._tile.constructor;
  99149. return new Cesium3DTile2(content._tileset, baseResource2, tileJson, parentTile);
  99150. }
  99151. Implicit3DTileContent.prototype.hasProperty = function(batchId, name) {
  99152. return false;
  99153. };
  99154. Implicit3DTileContent.prototype.getFeature = function(batchId) {
  99155. return void 0;
  99156. };
  99157. Implicit3DTileContent.prototype.applyDebugSettings = function(enabled, color) {
  99158. };
  99159. Implicit3DTileContent.prototype.applyStyle = function(style) {
  99160. };
  99161. Implicit3DTileContent.prototype.update = function(tileset, frameState) {
  99162. };
  99163. Implicit3DTileContent.prototype.isDestroyed = function() {
  99164. return false;
  99165. };
  99166. Implicit3DTileContent.prototype.destroy = function() {
  99167. this._implicitSubtree = this._implicitSubtree && this._implicitSubtree.destroy();
  99168. return destroyObject_default(this);
  99169. };
  99170. Implicit3DTileContent._deriveBoundingBox = deriveBoundingBox;
  99171. Implicit3DTileContent._deriveBoundingRegion = deriveBoundingRegion;
  99172. Implicit3DTileContent._deriveBoundingVolumeS2 = deriveBoundingVolumeS2;
  99173. // node_modules/cesium/Source/Scene/I3dmParser.js
  99174. var I3dmParser = {};
  99175. I3dmParser._deprecationWarning = deprecationWarning_default;
  99176. var sizeOfUint326 = Uint32Array.BYTES_PER_ELEMENT;
  99177. I3dmParser.parse = function(arrayBuffer, byteOffset) {
  99178. Check_default.defined("arrayBuffer", arrayBuffer);
  99179. const byteStart = defaultValue_default(byteOffset, 0);
  99180. byteOffset = byteStart;
  99181. const uint8Array = new Uint8Array(arrayBuffer);
  99182. const view = new DataView(arrayBuffer);
  99183. byteOffset += sizeOfUint326;
  99184. const version = view.getUint32(byteOffset, true);
  99185. if (version !== 1) {
  99186. throw new RuntimeError_default(
  99187. `Only Instanced 3D Model version 1 is supported. Version ${version} is not.`
  99188. );
  99189. }
  99190. byteOffset += sizeOfUint326;
  99191. const byteLength = view.getUint32(byteOffset, true);
  99192. byteOffset += sizeOfUint326;
  99193. const featureTableJsonByteLength = view.getUint32(byteOffset, true);
  99194. if (featureTableJsonByteLength === 0) {
  99195. throw new RuntimeError_default(
  99196. "featureTableJsonByteLength is zero, the feature table must be defined."
  99197. );
  99198. }
  99199. byteOffset += sizeOfUint326;
  99200. const featureTableBinaryByteLength = view.getUint32(byteOffset, true);
  99201. byteOffset += sizeOfUint326;
  99202. const batchTableJsonByteLength = view.getUint32(byteOffset, true);
  99203. byteOffset += sizeOfUint326;
  99204. const batchTableBinaryByteLength = view.getUint32(byteOffset, true);
  99205. byteOffset += sizeOfUint326;
  99206. const gltfFormat = view.getUint32(byteOffset, true);
  99207. if (gltfFormat !== 1 && gltfFormat !== 0) {
  99208. throw new RuntimeError_default(
  99209. `Only glTF format 0 (uri) or 1 (embedded) are supported. Format ${gltfFormat} is not.`
  99210. );
  99211. }
  99212. byteOffset += sizeOfUint326;
  99213. const featureTableJson = getJsonFromTypedArray_default(
  99214. uint8Array,
  99215. byteOffset,
  99216. featureTableJsonByteLength
  99217. );
  99218. byteOffset += featureTableJsonByteLength;
  99219. const featureTableBinary = new Uint8Array(
  99220. arrayBuffer,
  99221. byteOffset,
  99222. featureTableBinaryByteLength
  99223. );
  99224. byteOffset += featureTableBinaryByteLength;
  99225. let batchTableJson;
  99226. let batchTableBinary;
  99227. if (batchTableJsonByteLength > 0) {
  99228. batchTableJson = getJsonFromTypedArray_default(
  99229. uint8Array,
  99230. byteOffset,
  99231. batchTableJsonByteLength
  99232. );
  99233. byteOffset += batchTableJsonByteLength;
  99234. if (batchTableBinaryByteLength > 0) {
  99235. batchTableBinary = new Uint8Array(
  99236. arrayBuffer,
  99237. byteOffset,
  99238. batchTableBinaryByteLength
  99239. );
  99240. batchTableBinary = new Uint8Array(batchTableBinary);
  99241. byteOffset += batchTableBinaryByteLength;
  99242. }
  99243. }
  99244. const gltfByteLength = byteStart + byteLength - byteOffset;
  99245. if (gltfByteLength === 0) {
  99246. throw new RuntimeError_default("glTF byte length must be greater than 0.");
  99247. }
  99248. let gltfView;
  99249. if (byteOffset % 4 === 0) {
  99250. gltfView = new Uint8Array(arrayBuffer, byteOffset, gltfByteLength);
  99251. } else {
  99252. I3dmParser._deprecationWarning(
  99253. "i3dm-glb-unaligned",
  99254. "The embedded glb is not aligned to a 4-byte boundary."
  99255. );
  99256. gltfView = new Uint8Array(
  99257. uint8Array.subarray(byteOffset, byteOffset + gltfByteLength)
  99258. );
  99259. }
  99260. return {
  99261. gltfFormat,
  99262. featureTableJson,
  99263. featureTableBinary,
  99264. batchTableJson,
  99265. batchTableBinary,
  99266. gltf: gltfView
  99267. };
  99268. };
  99269. var I3dmParser_default = I3dmParser;
  99270. // node_modules/cesium/Source/Scene/ModelInstance.js
  99271. function ModelInstance(collection, modelMatrix, instanceId) {
  99272. this.primitive = collection;
  99273. this._modelMatrix = Matrix4_default.clone(modelMatrix);
  99274. this._instanceId = instanceId;
  99275. }
  99276. Object.defineProperties(ModelInstance.prototype, {
  99277. instanceId: {
  99278. get: function() {
  99279. return this._instanceId;
  99280. }
  99281. },
  99282. model: {
  99283. get: function() {
  99284. return this.primitive._model;
  99285. }
  99286. },
  99287. modelMatrix: {
  99288. get: function() {
  99289. return Matrix4_default.clone(this._modelMatrix);
  99290. },
  99291. set: function(value) {
  99292. Matrix4_default.clone(value, this._modelMatrix);
  99293. this.primitive.expandBoundingSphere(this._modelMatrix);
  99294. this.primitive._dirty = true;
  99295. }
  99296. }
  99297. });
  99298. var ModelInstance_default = ModelInstance;
  99299. // node_modules/cesium/Source/Scene/ModelInstanceCollection.js
  99300. var LoadState = {
  99301. NEEDS_LOAD: 0,
  99302. LOADING: 1,
  99303. LOADED: 2,
  99304. FAILED: 3
  99305. };
  99306. function ModelInstanceCollection(options) {
  99307. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  99308. if (!defined_default(options.gltf) && !defined_default(options.url)) {
  99309. throw new DeveloperError_default("Either options.gltf or options.url is required.");
  99310. }
  99311. if (defined_default(options.gltf) && defined_default(options.url)) {
  99312. throw new DeveloperError_default(
  99313. "Cannot pass in both options.gltf and options.url."
  99314. );
  99315. }
  99316. this.show = defaultValue_default(options.show, true);
  99317. this._instancingSupported = false;
  99318. this._dynamic = defaultValue_default(options.dynamic, false);
  99319. this._allowPicking = defaultValue_default(options.allowPicking, true);
  99320. this._ready = false;
  99321. this._readyPromise = defer_default();
  99322. this._state = LoadState.NEEDS_LOAD;
  99323. this._dirty = false;
  99324. this._cull = defaultValue_default(options.cull, true);
  99325. this._opaquePass = defaultValue_default(options.opaquePass, Pass_default.OPAQUE);
  99326. this._instances = createInstances(this, options.instances);
  99327. this._batchTable = options.batchTable;
  99328. this._model = void 0;
  99329. this._vertexBufferTypedArray = void 0;
  99330. this._vertexBuffer = void 0;
  99331. this._batchIdBuffer = void 0;
  99332. this._instancedUniformsByProgram = void 0;
  99333. this._drawCommands = [];
  99334. this._modelCommands = void 0;
  99335. this._renderStates = void 0;
  99336. this._disableCullingRenderStates = void 0;
  99337. this._boundingSphere = createBoundingSphere(this);
  99338. this._center = Cartesian3_default.clone(this._boundingSphere.center);
  99339. this._rtcTransform = new Matrix4_default();
  99340. this._rtcModelView = new Matrix4_default();
  99341. this._mode = void 0;
  99342. this.modelMatrix = Matrix4_default.clone(Matrix4_default.IDENTITY);
  99343. this._modelMatrix = Matrix4_default.clone(this.modelMatrix);
  99344. this._url = Resource_default.createIfNeeded(options.url);
  99345. this._requestType = options.requestType;
  99346. this._gltf = options.gltf;
  99347. this._basePath = Resource_default.createIfNeeded(options.basePath);
  99348. this._asynchronous = options.asynchronous;
  99349. this._incrementallyLoadTextures = options.incrementallyLoadTextures;
  99350. this._upAxis = options.upAxis;
  99351. this._forwardAxis = options.forwardAxis;
  99352. this.shadows = defaultValue_default(options.shadows, ShadowMode_default.ENABLED);
  99353. this._shadows = this.shadows;
  99354. this._pickIdLoaded = options.pickIdLoaded;
  99355. this.splitDirection = defaultValue_default(
  99356. options.splitDirection,
  99357. SplitDirection_default.NONE
  99358. );
  99359. this.debugShowBoundingVolume = defaultValue_default(
  99360. options.debugShowBoundingVolume,
  99361. false
  99362. );
  99363. this._debugShowBoundingVolume = false;
  99364. this.debugWireframe = defaultValue_default(options.debugWireframe, false);
  99365. this._debugWireframe = false;
  99366. if (defined_default(options.imageBasedLighting)) {
  99367. this._imageBasedLighting = options.imageBasedLighting;
  99368. this._shouldDestroyImageBasedLighting = false;
  99369. } else {
  99370. this._imageBasedLighting = new ImageBasedLighting({
  99371. imageBasedLightingFactor: options.imageBasedLightingFactor,
  99372. luminanceAtZenith: options.luminanceAtZenith,
  99373. sphericalHarmonicCoefficients: options.sphericalHarmonicCoefficients,
  99374. specularEnvironmentMaps: options.specularEnvironmentMaps
  99375. });
  99376. this._shouldDestroyImageBasedLighting = true;
  99377. }
  99378. this.backFaceCulling = defaultValue_default(options.backFaceCulling, true);
  99379. this._backFaceCulling = this.backFaceCulling;
  99380. this.showCreditsOnScreen = defaultValue_default(options.showCreditsOnScreen, false);
  99381. }
  99382. Object.defineProperties(ModelInstanceCollection.prototype, {
  99383. allowPicking: {
  99384. get: function() {
  99385. return this._allowPicking;
  99386. }
  99387. },
  99388. length: {
  99389. get: function() {
  99390. return this._instances.length;
  99391. }
  99392. },
  99393. activeAnimations: {
  99394. get: function() {
  99395. return this._model.activeAnimations;
  99396. }
  99397. },
  99398. ready: {
  99399. get: function() {
  99400. return this._ready;
  99401. }
  99402. },
  99403. readyPromise: {
  99404. get: function() {
  99405. return this._readyPromise.promise;
  99406. }
  99407. },
  99408. imageBasedLighting: {
  99409. get: function() {
  99410. return this._imageBasedLighting;
  99411. },
  99412. set: function(value) {
  99413. if (value !== this._imageBasedLighting) {
  99414. if (this._shouldDestroyImageBasedLighting && !this._imageBasedLighting.isDestroyed()) {
  99415. this._imageBasedLighting.destroy();
  99416. }
  99417. this._imageBasedLighting = value;
  99418. this._shouldDestroyImageBasedLighting = false;
  99419. }
  99420. }
  99421. },
  99422. imageBasedLightingFactor: {
  99423. get: function() {
  99424. return this._imageBasedLighting.imageBasedLightingFactor;
  99425. },
  99426. set: function(value) {
  99427. this._imageBasedLighting.imageBasedLightingFactor = value;
  99428. }
  99429. },
  99430. luminanceAtZenith: {
  99431. get: function() {
  99432. return this._imageBasedLighting.luminanceAtZenith;
  99433. },
  99434. set: function(value) {
  99435. this._imageBasedLighting.luminanceAtZenith = value;
  99436. }
  99437. },
  99438. sphericalHarmonicCoefficients: {
  99439. get: function() {
  99440. return this._imageBasedLighting.sphericalHarmonicCoefficients;
  99441. },
  99442. set: function(value) {
  99443. this._imageBasedLighting.sphericalHarmonicCoefficients = value;
  99444. }
  99445. },
  99446. specularEnvironmentMaps: {
  99447. get: function() {
  99448. return this._imageBasedLighting.specularEnvironmentMaps;
  99449. },
  99450. set: function(value) {
  99451. this._imageBasedLighting.specularEnvironmentMaps = value;
  99452. }
  99453. }
  99454. });
  99455. function createInstances(collection, instancesOptions) {
  99456. instancesOptions = defaultValue_default(instancesOptions, []);
  99457. const length3 = instancesOptions.length;
  99458. const instances = new Array(length3);
  99459. for (let i2 = 0; i2 < length3; ++i2) {
  99460. const instanceOptions = instancesOptions[i2];
  99461. const modelMatrix = instanceOptions.modelMatrix;
  99462. const instanceId = defaultValue_default(instanceOptions.batchId, i2);
  99463. instances[i2] = new ModelInstance_default(collection, modelMatrix, instanceId);
  99464. }
  99465. return instances;
  99466. }
  99467. function createBoundingSphere(collection) {
  99468. const instancesLength = collection.length;
  99469. const points = new Array(instancesLength);
  99470. for (let i2 = 0; i2 < instancesLength; ++i2) {
  99471. points[i2] = Matrix4_default.getTranslation(
  99472. collection._instances[i2]._modelMatrix,
  99473. new Cartesian3_default()
  99474. );
  99475. }
  99476. return BoundingSphere_default.fromPoints(points);
  99477. }
  99478. var scratchCartesian10 = new Cartesian3_default();
  99479. var scratchMatrix2 = new Matrix4_default();
  99480. ModelInstanceCollection.prototype.expandBoundingSphere = function(instanceModelMatrix) {
  99481. const translation3 = Matrix4_default.getTranslation(
  99482. instanceModelMatrix,
  99483. scratchCartesian10
  99484. );
  99485. BoundingSphere_default.expand(
  99486. this._boundingSphere,
  99487. translation3,
  99488. this._boundingSphere
  99489. );
  99490. };
  99491. function getCheckUniformSemanticFunction(modelSemantics, supportedSemantics, programId, uniformMap2) {
  99492. return function(uniform, uniformName) {
  99493. const semantic = uniform.semantic;
  99494. if (defined_default(semantic) && modelSemantics.indexOf(semantic) > -1) {
  99495. if (supportedSemantics.indexOf(semantic) > -1) {
  99496. uniformMap2[uniformName] = semantic;
  99497. } else {
  99498. throw new RuntimeError_default(
  99499. `${'Shader program cannot be optimized for instancing. Uniform "'}${uniformName}" in program "${programId}" uses unsupported semantic "${semantic}"`
  99500. );
  99501. }
  99502. }
  99503. };
  99504. }
  99505. function getInstancedUniforms(collection, programId) {
  99506. if (defined_default(collection._instancedUniformsByProgram)) {
  99507. return collection._instancedUniformsByProgram[programId];
  99508. }
  99509. const instancedUniformsByProgram = {};
  99510. collection._instancedUniformsByProgram = instancedUniformsByProgram;
  99511. const modelSemantics = [
  99512. "MODEL",
  99513. "MODELVIEW",
  99514. "CESIUM_RTC_MODELVIEW",
  99515. "MODELVIEWPROJECTION",
  99516. "MODELINVERSE",
  99517. "MODELVIEWINVERSE",
  99518. "MODELVIEWPROJECTIONINVERSE",
  99519. "MODELINVERSETRANSPOSE",
  99520. "MODELVIEWINVERSETRANSPOSE"
  99521. ];
  99522. const supportedSemantics = [
  99523. "MODELVIEW",
  99524. "CESIUM_RTC_MODELVIEW",
  99525. "MODELVIEWPROJECTION",
  99526. "MODELVIEWINVERSETRANSPOSE"
  99527. ];
  99528. const techniques = collection._model._sourceTechniques;
  99529. for (const techniqueId in techniques) {
  99530. if (techniques.hasOwnProperty(techniqueId)) {
  99531. const technique = techniques[techniqueId];
  99532. const program = technique.program;
  99533. if (!defined_default(instancedUniformsByProgram[program])) {
  99534. const uniformMap2 = {};
  99535. instancedUniformsByProgram[program] = uniformMap2;
  99536. ForEach_default.techniqueUniform(
  99537. technique,
  99538. getCheckUniformSemanticFunction(
  99539. modelSemantics,
  99540. supportedSemantics,
  99541. programId,
  99542. uniformMap2
  99543. )
  99544. );
  99545. }
  99546. }
  99547. }
  99548. return instancedUniformsByProgram[programId];
  99549. }
  99550. function getVertexShaderCallback2(collection) {
  99551. return function(vs, programId) {
  99552. const instancedUniforms = getInstancedUniforms(collection, programId);
  99553. const usesBatchTable = defined_default(collection._batchTable);
  99554. let renamedSource = ShaderSource_default.replaceMain(vs, "czm_instancing_main");
  99555. let globalVarsHeader = "";
  99556. let globalVarsMain = "";
  99557. for (const uniform in instancedUniforms) {
  99558. if (instancedUniforms.hasOwnProperty(uniform)) {
  99559. const semantic = instancedUniforms[uniform];
  99560. let varName;
  99561. if (semantic === "MODELVIEW" || semantic === "CESIUM_RTC_MODELVIEW") {
  99562. varName = "czm_instanced_modelView";
  99563. } else if (semantic === "MODELVIEWPROJECTION") {
  99564. varName = "czm_instanced_modelViewProjection";
  99565. globalVarsHeader += "mat4 czm_instanced_modelViewProjection;\n";
  99566. globalVarsMain += "czm_instanced_modelViewProjection = czm_projection * czm_instanced_modelView;\n";
  99567. } else if (semantic === "MODELVIEWINVERSETRANSPOSE") {
  99568. varName = "czm_instanced_modelViewInverseTranspose";
  99569. globalVarsHeader += "mat3 czm_instanced_modelViewInverseTranspose;\n";
  99570. globalVarsMain += "czm_instanced_modelViewInverseTranspose = mat3(czm_instanced_modelView);\n";
  99571. }
  99572. let regex = new RegExp(`uniform.*${uniform}.*`);
  99573. renamedSource = renamedSource.replace(regex, "");
  99574. regex = new RegExp(`${uniform}\\b`, "g");
  99575. renamedSource = renamedSource.replace(regex, varName);
  99576. }
  99577. }
  99578. const uniforms = "uniform mat4 czm_instanced_modifiedModelView;\nuniform mat4 czm_instanced_nodeTransform;\n";
  99579. let batchIdAttribute;
  99580. let pickAttribute;
  99581. let pickVarying;
  99582. if (usesBatchTable) {
  99583. batchIdAttribute = "attribute float a_batchId;\n";
  99584. pickAttribute = "";
  99585. pickVarying = "";
  99586. } else {
  99587. batchIdAttribute = "";
  99588. pickAttribute = "attribute vec4 pickColor;\nvarying vec4 v_pickColor;\n";
  99589. pickVarying = " v_pickColor = pickColor;\n";
  99590. }
  99591. let instancedSource = `${uniforms + globalVarsHeader}mat4 czm_instanced_modelView;
  99592. attribute vec4 czm_modelMatrixRow0;
  99593. attribute vec4 czm_modelMatrixRow1;
  99594. attribute vec4 czm_modelMatrixRow2;
  99595. ${batchIdAttribute}${pickAttribute}${renamedSource}void main()
  99596. {
  99597. mat4 czm_instanced_model = mat4(czm_modelMatrixRow0.x, czm_modelMatrixRow1.x, czm_modelMatrixRow2.x, 0.0, czm_modelMatrixRow0.y, czm_modelMatrixRow1.y, czm_modelMatrixRow2.y, 0.0, czm_modelMatrixRow0.z, czm_modelMatrixRow1.z, czm_modelMatrixRow2.z, 0.0, czm_modelMatrixRow0.w, czm_modelMatrixRow1.w, czm_modelMatrixRow2.w, 1.0);
  99598. czm_instanced_modelView = czm_instanced_modifiedModelView * czm_instanced_model * czm_instanced_nodeTransform;
  99599. ${globalVarsMain} czm_instancing_main();
  99600. ${pickVarying}}
  99601. `;
  99602. if (usesBatchTable) {
  99603. const gltf = collection._model.gltf;
  99604. const diffuseAttributeOrUniformName = ModelUtility_default.getDiffuseAttributeOrUniform(
  99605. gltf,
  99606. programId
  99607. );
  99608. instancedSource = collection._batchTable.getVertexShaderCallback(
  99609. true,
  99610. "a_batchId",
  99611. diffuseAttributeOrUniformName
  99612. )(instancedSource);
  99613. }
  99614. return instancedSource;
  99615. };
  99616. }
  99617. function getFragmentShaderCallback2(collection) {
  99618. return function(fs, programId) {
  99619. const batchTable = collection._batchTable;
  99620. if (defined_default(batchTable)) {
  99621. const gltf = collection._model.gltf;
  99622. const diffuseAttributeOrUniformName = ModelUtility_default.getDiffuseAttributeOrUniform(
  99623. gltf,
  99624. programId
  99625. );
  99626. fs = batchTable.getFragmentShaderCallback(
  99627. true,
  99628. diffuseAttributeOrUniformName,
  99629. false
  99630. )(fs);
  99631. } else {
  99632. fs = `varying vec4 v_pickColor;
  99633. ${fs}`;
  99634. }
  99635. return fs;
  99636. };
  99637. }
  99638. function createModifiedModelView(collection, context) {
  99639. return function() {
  99640. return Matrix4_default.multiply(
  99641. context.uniformState.view,
  99642. collection._rtcTransform,
  99643. collection._rtcModelView
  99644. );
  99645. };
  99646. }
  99647. function createNodeTransformFunction(node) {
  99648. return function() {
  99649. return node.computedMatrix;
  99650. };
  99651. }
  99652. function getUniformMapCallback(collection, context) {
  99653. return function(uniformMap2, programId, node) {
  99654. uniformMap2 = clone_default(uniformMap2);
  99655. uniformMap2.czm_instanced_modifiedModelView = createModifiedModelView(
  99656. collection,
  99657. context
  99658. );
  99659. uniformMap2.czm_instanced_nodeTransform = createNodeTransformFunction(node);
  99660. const instancedUniforms = getInstancedUniforms(collection, programId);
  99661. for (const uniform in instancedUniforms) {
  99662. if (instancedUniforms.hasOwnProperty(uniform)) {
  99663. delete uniformMap2[uniform];
  99664. }
  99665. }
  99666. if (defined_default(collection._batchTable)) {
  99667. uniformMap2 = collection._batchTable.getUniformMapCallback()(uniformMap2);
  99668. }
  99669. return uniformMap2;
  99670. };
  99671. }
  99672. function getVertexShaderNonInstancedCallback(collection) {
  99673. return function(vs, programId) {
  99674. if (defined_default(collection._batchTable)) {
  99675. const gltf = collection._model.gltf;
  99676. const diffuseAttributeOrUniformName = ModelUtility_default.getDiffuseAttributeOrUniform(
  99677. gltf,
  99678. programId
  99679. );
  99680. vs = collection._batchTable.getVertexShaderCallback(
  99681. true,
  99682. "a_batchId",
  99683. diffuseAttributeOrUniformName
  99684. )(vs);
  99685. vs = `uniform float a_batchId
  99686. ;${vs}`;
  99687. }
  99688. return vs;
  99689. };
  99690. }
  99691. function getFragmentShaderNonInstancedCallback(collection) {
  99692. return function(fs, programId) {
  99693. const batchTable = collection._batchTable;
  99694. if (defined_default(batchTable)) {
  99695. const gltf = collection._model.gltf;
  99696. const diffuseAttributeOrUniformName = ModelUtility_default.getDiffuseAttributeOrUniform(
  99697. gltf,
  99698. programId
  99699. );
  99700. fs = batchTable.getFragmentShaderCallback(
  99701. true,
  99702. diffuseAttributeOrUniformName,
  99703. false
  99704. )(fs);
  99705. } else {
  99706. fs = `uniform vec4 czm_pickColor;
  99707. ${fs}`;
  99708. }
  99709. return fs;
  99710. };
  99711. }
  99712. function getUniformMapNonInstancedCallback(collection) {
  99713. return function(uniformMap2) {
  99714. if (defined_default(collection._batchTable)) {
  99715. uniformMap2 = collection._batchTable.getUniformMapCallback()(uniformMap2);
  99716. }
  99717. return uniformMap2;
  99718. };
  99719. }
  99720. function getVertexBufferTypedArray(collection) {
  99721. const instances = collection._instances;
  99722. const instancesLength = collection.length;
  99723. const collectionCenter = collection._center;
  99724. const vertexSizeInFloats = 12;
  99725. let bufferData = collection._vertexBufferTypedArray;
  99726. if (!defined_default(bufferData)) {
  99727. bufferData = new Float32Array(instancesLength * vertexSizeInFloats);
  99728. }
  99729. if (collection._dynamic) {
  99730. collection._vertexBufferTypedArray = bufferData;
  99731. }
  99732. for (let i2 = 0; i2 < instancesLength; ++i2) {
  99733. const modelMatrix = instances[i2]._modelMatrix;
  99734. const instanceMatrix = Matrix4_default.clone(modelMatrix, scratchMatrix2);
  99735. instanceMatrix[12] -= collectionCenter.x;
  99736. instanceMatrix[13] -= collectionCenter.y;
  99737. instanceMatrix[14] -= collectionCenter.z;
  99738. const offset2 = i2 * vertexSizeInFloats;
  99739. bufferData[offset2 + 0] = instanceMatrix[0];
  99740. bufferData[offset2 + 1] = instanceMatrix[4];
  99741. bufferData[offset2 + 2] = instanceMatrix[8];
  99742. bufferData[offset2 + 3] = instanceMatrix[12];
  99743. bufferData[offset2 + 4] = instanceMatrix[1];
  99744. bufferData[offset2 + 5] = instanceMatrix[5];
  99745. bufferData[offset2 + 6] = instanceMatrix[9];
  99746. bufferData[offset2 + 7] = instanceMatrix[13];
  99747. bufferData[offset2 + 8] = instanceMatrix[2];
  99748. bufferData[offset2 + 9] = instanceMatrix[6];
  99749. bufferData[offset2 + 10] = instanceMatrix[10];
  99750. bufferData[offset2 + 11] = instanceMatrix[14];
  99751. }
  99752. return bufferData;
  99753. }
  99754. function createVertexBuffer4(collection, context) {
  99755. let i2;
  99756. const instances = collection._instances;
  99757. const instancesLength = collection.length;
  99758. const dynamic = collection._dynamic;
  99759. const usesBatchTable = defined_default(collection._batchTable);
  99760. if (usesBatchTable) {
  99761. const batchIdBufferData = new Uint16Array(instancesLength);
  99762. for (i2 = 0; i2 < instancesLength; ++i2) {
  99763. batchIdBufferData[i2] = instances[i2]._instanceId;
  99764. }
  99765. collection._batchIdBuffer = Buffer_default.createVertexBuffer({
  99766. context,
  99767. typedArray: batchIdBufferData,
  99768. usage: BufferUsage_default.STATIC_DRAW
  99769. });
  99770. }
  99771. if (!usesBatchTable) {
  99772. const pickIdBuffer = new Uint8Array(instancesLength * 4);
  99773. for (i2 = 0; i2 < instancesLength; ++i2) {
  99774. const pickId = collection._pickIds[i2];
  99775. const pickColor = pickId.color;
  99776. const offset2 = i2 * 4;
  99777. pickIdBuffer[offset2] = Color_default.floatToByte(pickColor.red);
  99778. pickIdBuffer[offset2 + 1] = Color_default.floatToByte(pickColor.green);
  99779. pickIdBuffer[offset2 + 2] = Color_default.floatToByte(pickColor.blue);
  99780. pickIdBuffer[offset2 + 3] = Color_default.floatToByte(pickColor.alpha);
  99781. }
  99782. collection._pickIdBuffer = Buffer_default.createVertexBuffer({
  99783. context,
  99784. typedArray: pickIdBuffer,
  99785. usage: BufferUsage_default.STATIC_DRAW
  99786. });
  99787. }
  99788. const vertexBufferTypedArray = getVertexBufferTypedArray(collection);
  99789. collection._vertexBuffer = Buffer_default.createVertexBuffer({
  99790. context,
  99791. typedArray: vertexBufferTypedArray,
  99792. usage: dynamic ? BufferUsage_default.STREAM_DRAW : BufferUsage_default.STATIC_DRAW
  99793. });
  99794. }
  99795. function updateVertexBuffer(collection) {
  99796. const vertexBufferTypedArray = getVertexBufferTypedArray(collection);
  99797. collection._vertexBuffer.copyFromArrayView(vertexBufferTypedArray);
  99798. }
  99799. function createPickIds(collection, context) {
  99800. const instances = collection._instances;
  99801. const instancesLength = instances.length;
  99802. const pickIds = new Array(instancesLength);
  99803. for (let i2 = 0; i2 < instancesLength; ++i2) {
  99804. pickIds[i2] = context.createPickId(instances[i2]);
  99805. }
  99806. return pickIds;
  99807. }
  99808. function createModel(collection, context) {
  99809. const instancingSupported = collection._instancingSupported;
  99810. const usesBatchTable = defined_default(collection._batchTable);
  99811. const allowPicking = collection._allowPicking;
  99812. const modelOptions = {
  99813. url: collection._url,
  99814. requestType: collection._requestType,
  99815. gltf: collection._gltf,
  99816. basePath: collection._basePath,
  99817. shadows: collection._shadows,
  99818. cacheKey: void 0,
  99819. asynchronous: collection._asynchronous,
  99820. allowPicking,
  99821. incrementallyLoadTextures: collection._incrementallyLoadTextures,
  99822. upAxis: collection._upAxis,
  99823. forwardAxis: collection._forwardAxis,
  99824. precreatedAttributes: void 0,
  99825. vertexShaderLoaded: void 0,
  99826. fragmentShaderLoaded: void 0,
  99827. uniformMapLoaded: void 0,
  99828. pickIdLoaded: collection._pickIdLoaded,
  99829. ignoreCommands: true,
  99830. opaquePass: collection._opaquePass,
  99831. imageBasedLighting: collection._imageBasedLighting,
  99832. showOutline: collection.showOutline,
  99833. showCreditsOnScreen: collection.showCreditsOnScreen
  99834. };
  99835. if (!usesBatchTable) {
  99836. collection._pickIds = createPickIds(collection, context);
  99837. }
  99838. if (instancingSupported) {
  99839. createVertexBuffer4(collection, context);
  99840. const vertexSizeInFloats = 12;
  99841. const componentSizeInBytes = ComponentDatatype_default.getSizeInBytes(
  99842. ComponentDatatype_default.FLOAT
  99843. );
  99844. const instancedAttributes = {
  99845. czm_modelMatrixRow0: {
  99846. index: 0,
  99847. vertexBuffer: collection._vertexBuffer,
  99848. componentsPerAttribute: 4,
  99849. componentDatatype: ComponentDatatype_default.FLOAT,
  99850. normalize: false,
  99851. offsetInBytes: 0,
  99852. strideInBytes: componentSizeInBytes * vertexSizeInFloats,
  99853. instanceDivisor: 1
  99854. },
  99855. czm_modelMatrixRow1: {
  99856. index: 0,
  99857. vertexBuffer: collection._vertexBuffer,
  99858. componentsPerAttribute: 4,
  99859. componentDatatype: ComponentDatatype_default.FLOAT,
  99860. normalize: false,
  99861. offsetInBytes: componentSizeInBytes * 4,
  99862. strideInBytes: componentSizeInBytes * vertexSizeInFloats,
  99863. instanceDivisor: 1
  99864. },
  99865. czm_modelMatrixRow2: {
  99866. index: 0,
  99867. vertexBuffer: collection._vertexBuffer,
  99868. componentsPerAttribute: 4,
  99869. componentDatatype: ComponentDatatype_default.FLOAT,
  99870. normalize: false,
  99871. offsetInBytes: componentSizeInBytes * 8,
  99872. strideInBytes: componentSizeInBytes * vertexSizeInFloats,
  99873. instanceDivisor: 1
  99874. }
  99875. };
  99876. if (usesBatchTable) {
  99877. instancedAttributes.a_batchId = {
  99878. index: 0,
  99879. vertexBuffer: collection._batchIdBuffer,
  99880. componentsPerAttribute: 1,
  99881. componentDatatype: ComponentDatatype_default.UNSIGNED_SHORT,
  99882. normalize: false,
  99883. offsetInBytes: 0,
  99884. strideInBytes: 0,
  99885. instanceDivisor: 1
  99886. };
  99887. }
  99888. if (!usesBatchTable) {
  99889. instancedAttributes.pickColor = {
  99890. index: 0,
  99891. vertexBuffer: collection._pickIdBuffer,
  99892. componentsPerAttribute: 4,
  99893. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  99894. normalize: true,
  99895. offsetInBytes: 0,
  99896. strideInBytes: 0,
  99897. instanceDivisor: 1
  99898. };
  99899. }
  99900. modelOptions.precreatedAttributes = instancedAttributes;
  99901. modelOptions.vertexShaderLoaded = getVertexShaderCallback2(collection);
  99902. modelOptions.fragmentShaderLoaded = getFragmentShaderCallback2(collection);
  99903. modelOptions.uniformMapLoaded = getUniformMapCallback(collection, context);
  99904. if (defined_default(collection._url)) {
  99905. modelOptions.cacheKey = `${collection._url.getUrlComponent()}#instanced`;
  99906. }
  99907. } else {
  99908. modelOptions.vertexShaderLoaded = getVertexShaderNonInstancedCallback(
  99909. collection
  99910. );
  99911. modelOptions.fragmentShaderLoaded = getFragmentShaderNonInstancedCallback(
  99912. collection
  99913. );
  99914. modelOptions.uniformMapLoaded = getUniformMapNonInstancedCallback(
  99915. collection,
  99916. context
  99917. );
  99918. }
  99919. if (defined_default(collection._url)) {
  99920. collection._model = Model_default.fromGltf(modelOptions);
  99921. } else {
  99922. collection._model = new Model_default(modelOptions);
  99923. }
  99924. }
  99925. function updateWireframe3(collection, force) {
  99926. if (collection._debugWireframe !== collection.debugWireframe || force) {
  99927. collection._debugWireframe = collection.debugWireframe;
  99928. const primitiveType = collection.debugWireframe ? PrimitiveType_default.LINES : PrimitiveType_default.TRIANGLES;
  99929. const commands = collection._drawCommands;
  99930. const length3 = commands.length;
  99931. for (let i2 = 0; i2 < length3; ++i2) {
  99932. commands[i2].primitiveType = primitiveType;
  99933. }
  99934. }
  99935. }
  99936. function getDisableCullingRenderState2(renderState) {
  99937. const rs = clone_default(renderState, true);
  99938. rs.cull.enabled = false;
  99939. return RenderState_default.fromCache(rs);
  99940. }
  99941. function updateBackFaceCulling2(collection, force) {
  99942. if (collection._backFaceCulling !== collection.backFaceCulling || force) {
  99943. collection._backFaceCulling = collection.backFaceCulling;
  99944. const commands = collection._drawCommands;
  99945. const length3 = commands.length;
  99946. let i2;
  99947. if (!defined_default(collection._disableCullingRenderStates)) {
  99948. collection._disableCullingRenderStates = new Array(length3);
  99949. collection._renderStates = new Array(length3);
  99950. for (i2 = 0; i2 < length3; ++i2) {
  99951. const renderState = commands[i2].renderState;
  99952. const derivedRenderState = getDisableCullingRenderState2(renderState);
  99953. collection._disableCullingRenderStates[i2] = derivedRenderState;
  99954. collection._renderStates[i2] = renderState;
  99955. }
  99956. }
  99957. for (i2 = 0; i2 < length3; ++i2) {
  99958. commands[i2].renderState = collection._backFaceCulling ? collection._renderStates[i2] : collection._disableCullingRenderStates[i2];
  99959. }
  99960. }
  99961. }
  99962. function updateShowBoundingVolume2(collection, force) {
  99963. if (collection.debugShowBoundingVolume !== collection._debugShowBoundingVolume || force) {
  99964. collection._debugShowBoundingVolume = collection.debugShowBoundingVolume;
  99965. const commands = collection._drawCommands;
  99966. const length3 = commands.length;
  99967. for (let i2 = 0; i2 < length3; ++i2) {
  99968. commands[i2].debugShowBoundingVolume = collection.debugShowBoundingVolume;
  99969. }
  99970. }
  99971. }
  99972. function createCommands4(collection, drawCommands) {
  99973. const commandsLength = drawCommands.length;
  99974. const instancesLength = collection.length;
  99975. const boundingSphere = collection._boundingSphere;
  99976. const cull = collection._cull;
  99977. for (let i2 = 0; i2 < commandsLength; ++i2) {
  99978. const drawCommand = DrawCommand_default.shallowClone(drawCommands[i2]);
  99979. drawCommand.instanceCount = instancesLength;
  99980. drawCommand.boundingVolume = boundingSphere;
  99981. drawCommand.cull = cull;
  99982. if (defined_default(collection._batchTable)) {
  99983. drawCommand.pickId = collection._batchTable.getPickId();
  99984. } else {
  99985. drawCommand.pickId = "v_pickColor";
  99986. }
  99987. collection._drawCommands.push(drawCommand);
  99988. }
  99989. }
  99990. function createBatchIdFunction(batchId) {
  99991. return function() {
  99992. return batchId;
  99993. };
  99994. }
  99995. function createPickColorFunction2(color) {
  99996. return function() {
  99997. return color;
  99998. };
  99999. }
  100000. function createCommandsNonInstanced(collection, drawCommands) {
  100001. const instances = collection._instances;
  100002. const commandsLength = drawCommands.length;
  100003. const instancesLength = collection.length;
  100004. const batchTable = collection._batchTable;
  100005. const usesBatchTable = defined_default(batchTable);
  100006. const cull = collection._cull;
  100007. for (let i2 = 0; i2 < commandsLength; ++i2) {
  100008. for (let j = 0; j < instancesLength; ++j) {
  100009. const drawCommand = DrawCommand_default.shallowClone(drawCommands[i2]);
  100010. drawCommand.modelMatrix = new Matrix4_default();
  100011. drawCommand.boundingVolume = new BoundingSphere_default();
  100012. drawCommand.cull = cull;
  100013. drawCommand.uniformMap = clone_default(drawCommand.uniformMap);
  100014. if (usesBatchTable) {
  100015. drawCommand.uniformMap.a_batchId = createBatchIdFunction(
  100016. instances[j]._instanceId
  100017. );
  100018. } else {
  100019. const pickId = collection._pickIds[j];
  100020. drawCommand.uniformMap.czm_pickColor = createPickColorFunction2(
  100021. pickId.color
  100022. );
  100023. }
  100024. collection._drawCommands.push(drawCommand);
  100025. }
  100026. }
  100027. }
  100028. function updateCommandsNonInstanced(collection) {
  100029. const modelCommands = collection._modelCommands;
  100030. const commandsLength = modelCommands.length;
  100031. const instancesLength = collection.length;
  100032. const collectionTransform = collection._rtcTransform;
  100033. const collectionCenter = collection._center;
  100034. for (let i2 = 0; i2 < commandsLength; ++i2) {
  100035. const modelCommand = modelCommands[i2];
  100036. for (let j = 0; j < instancesLength; ++j) {
  100037. const commandIndex = i2 * instancesLength + j;
  100038. const drawCommand = collection._drawCommands[commandIndex];
  100039. let instanceMatrix = Matrix4_default.clone(
  100040. collection._instances[j]._modelMatrix,
  100041. scratchMatrix2
  100042. );
  100043. instanceMatrix[12] -= collectionCenter.x;
  100044. instanceMatrix[13] -= collectionCenter.y;
  100045. instanceMatrix[14] -= collectionCenter.z;
  100046. instanceMatrix = Matrix4_default.multiply(
  100047. collectionTransform,
  100048. instanceMatrix,
  100049. scratchMatrix2
  100050. );
  100051. const nodeMatrix = modelCommand.modelMatrix;
  100052. const modelMatrix = drawCommand.modelMatrix;
  100053. Matrix4_default.multiply(instanceMatrix, nodeMatrix, modelMatrix);
  100054. const nodeBoundingSphere = modelCommand.boundingVolume;
  100055. const boundingSphere = drawCommand.boundingVolume;
  100056. BoundingSphere_default.transform(
  100057. nodeBoundingSphere,
  100058. instanceMatrix,
  100059. boundingSphere
  100060. );
  100061. }
  100062. }
  100063. }
  100064. function getModelCommands(model) {
  100065. const nodeCommands = model._nodeCommands;
  100066. const length3 = nodeCommands.length;
  100067. const drawCommands = [];
  100068. for (let i2 = 0; i2 < length3; ++i2) {
  100069. const nc = nodeCommands[i2];
  100070. if (nc.show) {
  100071. drawCommands.push(nc.command);
  100072. }
  100073. }
  100074. return drawCommands;
  100075. }
  100076. function commandsDirty(model) {
  100077. const nodeCommands = model._nodeCommands;
  100078. const length3 = nodeCommands.length;
  100079. let commandsDirty2 = false;
  100080. for (let i2 = 0; i2 < length3; i2++) {
  100081. const nc = nodeCommands[i2];
  100082. if (nc.command.dirty) {
  100083. nc.command.dirty = false;
  100084. commandsDirty2 = true;
  100085. }
  100086. }
  100087. return commandsDirty2;
  100088. }
  100089. function generateModelCommands(modelInstanceCollection, instancingSupported) {
  100090. modelInstanceCollection._drawCommands = [];
  100091. const modelCommands = getModelCommands(modelInstanceCollection._model);
  100092. if (instancingSupported) {
  100093. createCommands4(modelInstanceCollection, modelCommands);
  100094. } else {
  100095. createCommandsNonInstanced(modelInstanceCollection, modelCommands);
  100096. updateCommandsNonInstanced(modelInstanceCollection);
  100097. }
  100098. }
  100099. function updateShadows2(collection, force) {
  100100. if (collection.shadows !== collection._shadows || force) {
  100101. collection._shadows = collection.shadows;
  100102. const castShadows = ShadowMode_default.castShadows(collection.shadows);
  100103. const receiveShadows = ShadowMode_default.receiveShadows(collection.shadows);
  100104. const drawCommands = collection._drawCommands;
  100105. const length3 = drawCommands.length;
  100106. for (let i2 = 0; i2 < length3; ++i2) {
  100107. const drawCommand = drawCommands[i2];
  100108. drawCommand.castShadows = castShadows;
  100109. drawCommand.receiveShadows = receiveShadows;
  100110. }
  100111. }
  100112. }
  100113. ModelInstanceCollection.prototype.update = function(frameState) {
  100114. if (frameState.mode === SceneMode_default.MORPHING) {
  100115. return;
  100116. }
  100117. if (!this.show) {
  100118. return;
  100119. }
  100120. if (this.length === 0) {
  100121. return;
  100122. }
  100123. const context = frameState.context;
  100124. if (this._state === LoadState.NEEDS_LOAD) {
  100125. this._state = LoadState.LOADING;
  100126. this._instancingSupported = context.instancedArrays;
  100127. createModel(this, context);
  100128. const that = this;
  100129. this._model.readyPromise.catch(function(error) {
  100130. that._state = LoadState.FAILED;
  100131. that._readyPromise.reject(error);
  100132. });
  100133. }
  100134. const instancingSupported = this._instancingSupported;
  100135. const model = this._model;
  100136. model.imageBasedLighting = this._imageBasedLighting;
  100137. model.showCreditsOnScreen = this.showCreditsOnScreen;
  100138. model.splitDirection = this.splitDirection;
  100139. model.update(frameState);
  100140. if (model.ready && this._state === LoadState.LOADING) {
  100141. this._state = LoadState.LOADED;
  100142. this._ready = true;
  100143. const modelRadius = model.boundingSphere.radius + Cartesian3_default.magnitude(model.boundingSphere.center);
  100144. this._boundingSphere.radius += modelRadius;
  100145. this._modelCommands = getModelCommands(model);
  100146. generateModelCommands(this, instancingSupported);
  100147. this._readyPromise.resolve(this);
  100148. return;
  100149. }
  100150. if (this._state !== LoadState.LOADED) {
  100151. return;
  100152. }
  100153. const modeChanged = frameState.mode !== this._mode;
  100154. const modelMatrix = this.modelMatrix;
  100155. const modelMatrixChanged = !Matrix4_default.equals(this._modelMatrix, modelMatrix);
  100156. if (modeChanged || modelMatrixChanged) {
  100157. this._mode = frameState.mode;
  100158. Matrix4_default.clone(modelMatrix, this._modelMatrix);
  100159. let rtcTransform = Matrix4_default.multiplyByTranslation(
  100160. this._modelMatrix,
  100161. this._center,
  100162. this._rtcTransform
  100163. );
  100164. if (this._mode !== SceneMode_default.SCENE3D) {
  100165. rtcTransform = Transforms_default.basisTo2D(
  100166. frameState.mapProjection,
  100167. rtcTransform,
  100168. rtcTransform
  100169. );
  100170. }
  100171. Matrix4_default.getTranslation(rtcTransform, this._boundingSphere.center);
  100172. }
  100173. if (instancingSupported && this._dirty) {
  100174. this._dynamic = true;
  100175. this._dirty = false;
  100176. updateVertexBuffer(this);
  100177. }
  100178. const modelCommandsDirty = commandsDirty(model);
  100179. if (modelCommandsDirty) {
  100180. generateModelCommands(this, instancingSupported);
  100181. }
  100182. if (!instancingSupported && (model.dirty || this._dirty || modeChanged || modelMatrixChanged)) {
  100183. updateCommandsNonInstanced(this);
  100184. }
  100185. updateShadows2(this, modelCommandsDirty);
  100186. updateWireframe3(this, modelCommandsDirty);
  100187. updateBackFaceCulling2(this, modelCommandsDirty);
  100188. updateShowBoundingVolume2(this, modelCommandsDirty);
  100189. const passes = frameState.passes;
  100190. if (!passes.render && !passes.pick) {
  100191. return;
  100192. }
  100193. const commandList = frameState.commandList;
  100194. const commands = this._drawCommands;
  100195. const commandsLength = commands.length;
  100196. for (let i2 = 0; i2 < commandsLength; ++i2) {
  100197. commandList.push(commands[i2]);
  100198. }
  100199. };
  100200. ModelInstanceCollection.prototype.isDestroyed = function() {
  100201. return false;
  100202. };
  100203. ModelInstanceCollection.prototype.destroy = function() {
  100204. this._model = this._model && this._model.destroy();
  100205. const pickIds = this._pickIds;
  100206. if (defined_default(pickIds)) {
  100207. const length3 = pickIds.length;
  100208. for (let i2 = 0; i2 < length3; ++i2) {
  100209. pickIds[i2].destroy();
  100210. }
  100211. }
  100212. if (this._shouldDestroyImageBasedLighting && !this._imageBasedLighting.isDestroyed()) {
  100213. this._imageBasedLighting.destroy();
  100214. }
  100215. this._imageBasedLighting = void 0;
  100216. return destroyObject_default(this);
  100217. };
  100218. var ModelInstanceCollection_default = ModelInstanceCollection;
  100219. // node_modules/cesium/Source/Scene/Instanced3DModel3DTileContent.js
  100220. function Instanced3DModel3DTileContent(tileset, tile, resource, arrayBuffer, byteOffset) {
  100221. this._tileset = tileset;
  100222. this._tile = tile;
  100223. this._resource = resource;
  100224. this._modelInstanceCollection = void 0;
  100225. this._metadata = void 0;
  100226. this._batchTable = void 0;
  100227. this._features = void 0;
  100228. this.featurePropertiesDirty = false;
  100229. this._group = void 0;
  100230. initialize9(this, arrayBuffer, byteOffset);
  100231. }
  100232. Instanced3DModel3DTileContent._deprecationWarning = deprecationWarning_default;
  100233. Object.defineProperties(Instanced3DModel3DTileContent.prototype, {
  100234. featuresLength: {
  100235. get: function() {
  100236. return this._batchTable.featuresLength;
  100237. }
  100238. },
  100239. pointsLength: {
  100240. get: function() {
  100241. return 0;
  100242. }
  100243. },
  100244. trianglesLength: {
  100245. get: function() {
  100246. const model = this._modelInstanceCollection._model;
  100247. if (defined_default(model)) {
  100248. return model.trianglesLength;
  100249. }
  100250. return 0;
  100251. }
  100252. },
  100253. geometryByteLength: {
  100254. get: function() {
  100255. const model = this._modelInstanceCollection._model;
  100256. if (defined_default(model)) {
  100257. return model.geometryByteLength;
  100258. }
  100259. return 0;
  100260. }
  100261. },
  100262. texturesByteLength: {
  100263. get: function() {
  100264. const model = this._modelInstanceCollection._model;
  100265. if (defined_default(model)) {
  100266. return model.texturesByteLength;
  100267. }
  100268. return 0;
  100269. }
  100270. },
  100271. batchTableByteLength: {
  100272. get: function() {
  100273. return this._batchTable.memorySizeInBytes;
  100274. }
  100275. },
  100276. innerContents: {
  100277. get: function() {
  100278. return void 0;
  100279. }
  100280. },
  100281. readyPromise: {
  100282. get: function() {
  100283. return this._modelInstanceCollection.readyPromise;
  100284. }
  100285. },
  100286. tileset: {
  100287. get: function() {
  100288. return this._tileset;
  100289. }
  100290. },
  100291. tile: {
  100292. get: function() {
  100293. return this._tile;
  100294. }
  100295. },
  100296. url: {
  100297. get: function() {
  100298. return this._resource.getUrlComponent(true);
  100299. }
  100300. },
  100301. metadata: {
  100302. get: function() {
  100303. return this._metadata;
  100304. },
  100305. set: function(value) {
  100306. this._metadata = value;
  100307. }
  100308. },
  100309. batchTable: {
  100310. get: function() {
  100311. return this._batchTable;
  100312. }
  100313. },
  100314. group: {
  100315. get: function() {
  100316. return this._group;
  100317. },
  100318. set: function(value) {
  100319. this._group = value;
  100320. }
  100321. }
  100322. });
  100323. function getPickIdCallback2(content) {
  100324. return function() {
  100325. return content._batchTable.getPickId();
  100326. };
  100327. }
  100328. var propertyScratch1 = new Array(4);
  100329. var propertyScratch2 = new Array(4);
  100330. function initialize9(content, arrayBuffer, byteOffset) {
  100331. const i3dm = I3dmParser_default.parse(arrayBuffer, byteOffset);
  100332. const gltfFormat = i3dm.gltfFormat;
  100333. const gltfView = i3dm.gltf;
  100334. const featureTableJson = i3dm.featureTableJson;
  100335. const featureTableBinary = i3dm.featureTableBinary;
  100336. const batchTableJson = i3dm.batchTableJson;
  100337. const batchTableBinary = i3dm.batchTableBinary;
  100338. const featureTable = new Cesium3DTileFeatureTable_default(
  100339. featureTableJson,
  100340. featureTableBinary
  100341. );
  100342. const instancesLength = featureTable.getGlobalProperty("INSTANCES_LENGTH");
  100343. featureTable.featuresLength = instancesLength;
  100344. if (!defined_default(instancesLength)) {
  100345. throw new RuntimeError_default(
  100346. "Feature table global property: INSTANCES_LENGTH must be defined"
  100347. );
  100348. }
  100349. content._batchTable = new Cesium3DTileBatchTable_default(
  100350. content,
  100351. instancesLength,
  100352. batchTableJson,
  100353. batchTableBinary
  100354. );
  100355. const tileset = content._tileset;
  100356. const collectionOptions = {
  100357. instances: new Array(instancesLength),
  100358. batchTable: content._batchTable,
  100359. cull: false,
  100360. url: void 0,
  100361. requestType: RequestType_default.TILES3D,
  100362. gltf: void 0,
  100363. basePath: void 0,
  100364. incrementallyLoadTextures: false,
  100365. upAxis: tileset._gltfUpAxis,
  100366. forwardAxis: Axis_default.X,
  100367. opaquePass: Pass_default.CESIUM_3D_TILE,
  100368. pickIdLoaded: getPickIdCallback2(content),
  100369. imageBasedLighting: tileset.imageBasedLighting,
  100370. specularEnvironmentMaps: tileset.specularEnvironmentMaps,
  100371. backFaceCulling: tileset.backFaceCulling,
  100372. showOutline: tileset.showOutline,
  100373. showCreditsOnScreen: tileset.showCreditsOnScreen
  100374. };
  100375. if (gltfFormat === 0) {
  100376. let gltfUrl = getStringFromTypedArray_default(gltfView);
  100377. gltfUrl = gltfUrl.replace(/[\s\0]+$/, "");
  100378. collectionOptions.url = content._resource.getDerivedResource({
  100379. url: gltfUrl
  100380. });
  100381. } else {
  100382. collectionOptions.gltf = gltfView;
  100383. collectionOptions.basePath = content._resource.clone();
  100384. }
  100385. const eastNorthUp = featureTable.getGlobalProperty("EAST_NORTH_UP");
  100386. let rtcCenter;
  100387. const rtcCenterArray = featureTable.getGlobalProperty(
  100388. "RTC_CENTER",
  100389. ComponentDatatype_default.FLOAT,
  100390. 3
  100391. );
  100392. if (defined_default(rtcCenterArray)) {
  100393. rtcCenter = Cartesian3_default.unpack(rtcCenterArray);
  100394. }
  100395. const instances = collectionOptions.instances;
  100396. const instancePosition = new Cartesian3_default();
  100397. const instancePositionArray = new Array(3);
  100398. const instanceNormalRight = new Cartesian3_default();
  100399. const instanceNormalUp = new Cartesian3_default();
  100400. const instanceNormalForward = new Cartesian3_default();
  100401. const instanceRotation = new Matrix3_default();
  100402. const instanceQuaternion = new Quaternion_default();
  100403. let instanceScale = new Cartesian3_default();
  100404. const instanceTranslationRotationScale = new TranslationRotationScale_default();
  100405. const instanceTransform = new Matrix4_default();
  100406. for (let i2 = 0; i2 < instancesLength; i2++) {
  100407. let position = featureTable.getProperty(
  100408. "POSITION",
  100409. ComponentDatatype_default.FLOAT,
  100410. 3,
  100411. i2,
  100412. propertyScratch1
  100413. );
  100414. if (!defined_default(position)) {
  100415. position = instancePositionArray;
  100416. const positionQuantized = featureTable.getProperty(
  100417. "POSITION_QUANTIZED",
  100418. ComponentDatatype_default.UNSIGNED_SHORT,
  100419. 3,
  100420. i2,
  100421. propertyScratch1
  100422. );
  100423. if (!defined_default(positionQuantized)) {
  100424. throw new RuntimeError_default(
  100425. "Either POSITION or POSITION_QUANTIZED must be defined for each instance."
  100426. );
  100427. }
  100428. const quantizedVolumeOffset = featureTable.getGlobalProperty(
  100429. "QUANTIZED_VOLUME_OFFSET",
  100430. ComponentDatatype_default.FLOAT,
  100431. 3
  100432. );
  100433. if (!defined_default(quantizedVolumeOffset)) {
  100434. throw new RuntimeError_default(
  100435. "Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions."
  100436. );
  100437. }
  100438. const quantizedVolumeScale = featureTable.getGlobalProperty(
  100439. "QUANTIZED_VOLUME_SCALE",
  100440. ComponentDatatype_default.FLOAT,
  100441. 3
  100442. );
  100443. if (!defined_default(quantizedVolumeScale)) {
  100444. throw new RuntimeError_default(
  100445. "Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions."
  100446. );
  100447. }
  100448. for (let j = 0; j < 3; j++) {
  100449. position[j] = positionQuantized[j] / 65535 * quantizedVolumeScale[j] + quantizedVolumeOffset[j];
  100450. }
  100451. }
  100452. Cartesian3_default.unpack(position, 0, instancePosition);
  100453. if (defined_default(rtcCenter)) {
  100454. Cartesian3_default.add(instancePosition, rtcCenter, instancePosition);
  100455. }
  100456. instanceTranslationRotationScale.translation = instancePosition;
  100457. const normalUp = featureTable.getProperty(
  100458. "NORMAL_UP",
  100459. ComponentDatatype_default.FLOAT,
  100460. 3,
  100461. i2,
  100462. propertyScratch1
  100463. );
  100464. const normalRight = featureTable.getProperty(
  100465. "NORMAL_RIGHT",
  100466. ComponentDatatype_default.FLOAT,
  100467. 3,
  100468. i2,
  100469. propertyScratch2
  100470. );
  100471. let hasCustomOrientation = false;
  100472. if (defined_default(normalUp)) {
  100473. if (!defined_default(normalRight)) {
  100474. throw new RuntimeError_default(
  100475. "To define a custom orientation, both NORMAL_UP and NORMAL_RIGHT must be defined."
  100476. );
  100477. }
  100478. Cartesian3_default.unpack(normalUp, 0, instanceNormalUp);
  100479. Cartesian3_default.unpack(normalRight, 0, instanceNormalRight);
  100480. hasCustomOrientation = true;
  100481. } else {
  100482. const octNormalUp = featureTable.getProperty(
  100483. "NORMAL_UP_OCT32P",
  100484. ComponentDatatype_default.UNSIGNED_SHORT,
  100485. 2,
  100486. i2,
  100487. propertyScratch1
  100488. );
  100489. const octNormalRight = featureTable.getProperty(
  100490. "NORMAL_RIGHT_OCT32P",
  100491. ComponentDatatype_default.UNSIGNED_SHORT,
  100492. 2,
  100493. i2,
  100494. propertyScratch2
  100495. );
  100496. if (defined_default(octNormalUp)) {
  100497. if (!defined_default(octNormalRight)) {
  100498. throw new RuntimeError_default(
  100499. "To define a custom orientation with oct-encoded vectors, both NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P must be defined."
  100500. );
  100501. }
  100502. AttributeCompression_default.octDecodeInRange(
  100503. octNormalUp[0],
  100504. octNormalUp[1],
  100505. 65535,
  100506. instanceNormalUp
  100507. );
  100508. AttributeCompression_default.octDecodeInRange(
  100509. octNormalRight[0],
  100510. octNormalRight[1],
  100511. 65535,
  100512. instanceNormalRight
  100513. );
  100514. hasCustomOrientation = true;
  100515. } else if (eastNorthUp) {
  100516. Transforms_default.eastNorthUpToFixedFrame(
  100517. instancePosition,
  100518. Ellipsoid_default.WGS84,
  100519. instanceTransform
  100520. );
  100521. Matrix4_default.getMatrix3(instanceTransform, instanceRotation);
  100522. } else {
  100523. Matrix3_default.clone(Matrix3_default.IDENTITY, instanceRotation);
  100524. }
  100525. }
  100526. if (hasCustomOrientation) {
  100527. Cartesian3_default.cross(
  100528. instanceNormalRight,
  100529. instanceNormalUp,
  100530. instanceNormalForward
  100531. );
  100532. Cartesian3_default.normalize(instanceNormalForward, instanceNormalForward);
  100533. Matrix3_default.setColumn(
  100534. instanceRotation,
  100535. 0,
  100536. instanceNormalRight,
  100537. instanceRotation
  100538. );
  100539. Matrix3_default.setColumn(
  100540. instanceRotation,
  100541. 1,
  100542. instanceNormalUp,
  100543. instanceRotation
  100544. );
  100545. Matrix3_default.setColumn(
  100546. instanceRotation,
  100547. 2,
  100548. instanceNormalForward,
  100549. instanceRotation
  100550. );
  100551. }
  100552. Quaternion_default.fromRotationMatrix(instanceRotation, instanceQuaternion);
  100553. instanceTranslationRotationScale.rotation = instanceQuaternion;
  100554. instanceScale = Cartesian3_default.fromElements(1, 1, 1, instanceScale);
  100555. const scale = featureTable.getProperty(
  100556. "SCALE",
  100557. ComponentDatatype_default.FLOAT,
  100558. 1,
  100559. i2
  100560. );
  100561. if (defined_default(scale)) {
  100562. Cartesian3_default.multiplyByScalar(instanceScale, scale, instanceScale);
  100563. }
  100564. const nonUniformScale = featureTable.getProperty(
  100565. "SCALE_NON_UNIFORM",
  100566. ComponentDatatype_default.FLOAT,
  100567. 3,
  100568. i2,
  100569. propertyScratch1
  100570. );
  100571. if (defined_default(nonUniformScale)) {
  100572. instanceScale.x *= nonUniformScale[0];
  100573. instanceScale.y *= nonUniformScale[1];
  100574. instanceScale.z *= nonUniformScale[2];
  100575. }
  100576. instanceTranslationRotationScale.scale = instanceScale;
  100577. let batchId = featureTable.getProperty(
  100578. "BATCH_ID",
  100579. ComponentDatatype_default.UNSIGNED_SHORT,
  100580. 1,
  100581. i2
  100582. );
  100583. if (!defined_default(batchId)) {
  100584. batchId = i2;
  100585. }
  100586. Matrix4_default.fromTranslationRotationScale(
  100587. instanceTranslationRotationScale,
  100588. instanceTransform
  100589. );
  100590. const modelMatrix = instanceTransform.clone();
  100591. instances[i2] = {
  100592. modelMatrix,
  100593. batchId
  100594. };
  100595. }
  100596. content._modelInstanceCollection = new ModelInstanceCollection_default(
  100597. collectionOptions
  100598. );
  100599. content._modelInstanceCollection.readyPromise.catch(function() {
  100600. }).then(function(collection) {
  100601. if (content._modelInstanceCollection.ready) {
  100602. collection.activeAnimations.addAll({
  100603. loop: ModelAnimationLoop_default.REPEAT
  100604. });
  100605. }
  100606. });
  100607. }
  100608. function createFeatures3(content) {
  100609. const featuresLength = content.featuresLength;
  100610. if (!defined_default(content._features) && featuresLength > 0) {
  100611. const features = new Array(featuresLength);
  100612. for (let i2 = 0; i2 < featuresLength; ++i2) {
  100613. features[i2] = new Cesium3DTileFeature_default(content, i2);
  100614. }
  100615. content._features = features;
  100616. }
  100617. }
  100618. Instanced3DModel3DTileContent.prototype.hasProperty = function(batchId, name) {
  100619. return this._batchTable.hasProperty(batchId, name);
  100620. };
  100621. Instanced3DModel3DTileContent.prototype.getFeature = function(batchId) {
  100622. const featuresLength = this.featuresLength;
  100623. if (!defined_default(batchId) || batchId < 0 || batchId >= featuresLength) {
  100624. throw new DeveloperError_default(
  100625. `batchId is required and between zero and featuresLength - 1 (${featuresLength - 1}).`
  100626. );
  100627. }
  100628. createFeatures3(this);
  100629. return this._features[batchId];
  100630. };
  100631. Instanced3DModel3DTileContent.prototype.applyDebugSettings = function(enabled, color) {
  100632. color = enabled ? color : Color_default.WHITE;
  100633. this._batchTable.setAllColor(color);
  100634. };
  100635. Instanced3DModel3DTileContent.prototype.applyStyle = function(style) {
  100636. this._batchTable.applyStyle(style);
  100637. };
  100638. Instanced3DModel3DTileContent.prototype.update = function(tileset, frameState) {
  100639. const commandStart = frameState.commandList.length;
  100640. this._batchTable.update(tileset, frameState);
  100641. this._modelInstanceCollection.modelMatrix = this._tile.computedTransform;
  100642. this._modelInstanceCollection.shadows = this._tileset.shadows;
  100643. this._modelInstanceCollection.lightColor = this._tileset.lightColor;
  100644. this._modelInstanceCollection.imageBasedLighting = this._tileset.imageBasedLighting;
  100645. this._modelInstanceCollection.backFaceCulling = this._tileset.backFaceCulling;
  100646. this._modelInstanceCollection.debugWireframe = this._tileset.debugWireframe;
  100647. this._modelInstanceCollection.showCreditsOnScreen = this._tileset.showCreditsOnScreen;
  100648. this._modelInstanceCollection.splitDirection = this._tileset.splitDirection;
  100649. const model = this._modelInstanceCollection._model;
  100650. if (defined_default(model)) {
  100651. const tilesetClippingPlanes = this._tileset.clippingPlanes;
  100652. model.referenceMatrix = this._tileset.clippingPlanesOriginMatrix;
  100653. if (defined_default(tilesetClippingPlanes) && this._tile.clippingPlanesDirty) {
  100654. model._clippingPlanes = tilesetClippingPlanes.enabled && this._tile._isClipped ? tilesetClippingPlanes : void 0;
  100655. }
  100656. if (defined_default(tilesetClippingPlanes) && defined_default(model._clippingPlanes) && model._clippingPlanes !== tilesetClippingPlanes) {
  100657. model._clippingPlanes = tilesetClippingPlanes;
  100658. }
  100659. }
  100660. this._modelInstanceCollection.update(frameState);
  100661. const commandEnd = frameState.commandList.length;
  100662. if (commandStart < commandEnd && (frameState.passes.render || frameState.passes.pick)) {
  100663. this._batchTable.addDerivedCommands(frameState, commandStart, false);
  100664. }
  100665. };
  100666. Instanced3DModel3DTileContent.prototype.isDestroyed = function() {
  100667. return false;
  100668. };
  100669. Instanced3DModel3DTileContent.prototype.destroy = function() {
  100670. this._modelInstanceCollection = this._modelInstanceCollection && this._modelInstanceCollection.destroy();
  100671. this._batchTable = this._batchTable && this._batchTable.destroy();
  100672. return destroyObject_default(this);
  100673. };
  100674. var Instanced3DModel3DTileContent_default = Instanced3DModel3DTileContent;
  100675. // node_modules/cesium/Source/Scene/Cesium3DTileRefine.js
  100676. var Cesium3DTileRefine = {
  100677. ADD: 0,
  100678. REPLACE: 1
  100679. };
  100680. var Cesium3DTileRefine_default = Object.freeze(Cesium3DTileRefine);
  100681. // node_modules/cesium/Source/Scene/VertexAttributeSemantic.js
  100682. var VertexAttributeSemantic = {
  100683. POSITION: "POSITION",
  100684. NORMAL: "NORMAL",
  100685. TANGENT: "TANGENT",
  100686. TEXCOORD: "TEXCOORD",
  100687. COLOR: "COLOR",
  100688. JOINTS: "JOINTS",
  100689. WEIGHTS: "WEIGHTS",
  100690. FEATURE_ID: "_FEATURE_ID"
  100691. };
  100692. function semanticToVariableName(semantic) {
  100693. switch (semantic) {
  100694. case VertexAttributeSemantic.POSITION:
  100695. return "positionMC";
  100696. case VertexAttributeSemantic.NORMAL:
  100697. return "normalMC";
  100698. case VertexAttributeSemantic.TANGENT:
  100699. return "tangentMC";
  100700. case VertexAttributeSemantic.TEXCOORD:
  100701. return "texCoord";
  100702. case VertexAttributeSemantic.COLOR:
  100703. return "color";
  100704. case VertexAttributeSemantic.JOINTS:
  100705. return "joints";
  100706. case VertexAttributeSemantic.WEIGHTS:
  100707. return "weights";
  100708. case VertexAttributeSemantic.FEATURE_ID:
  100709. return "featureId";
  100710. default:
  100711. throw new DeveloperError_default("semantic is not a valid value.");
  100712. }
  100713. }
  100714. VertexAttributeSemantic.hasSetIndex = function(semantic) {
  100715. Check_default.typeOf.string("semantic", semantic);
  100716. switch (semantic) {
  100717. case VertexAttributeSemantic.POSITION:
  100718. case VertexAttributeSemantic.NORMAL:
  100719. case VertexAttributeSemantic.TANGENT:
  100720. return false;
  100721. case VertexAttributeSemantic.TEXCOORD:
  100722. case VertexAttributeSemantic.COLOR:
  100723. case VertexAttributeSemantic.JOINTS:
  100724. case VertexAttributeSemantic.WEIGHTS:
  100725. case VertexAttributeSemantic.FEATURE_ID:
  100726. return true;
  100727. default:
  100728. throw new DeveloperError_default("semantic is not a valid value.");
  100729. }
  100730. };
  100731. VertexAttributeSemantic.fromGltfSemantic = function(gltfSemantic) {
  100732. Check_default.typeOf.string("gltfSemantic", gltfSemantic);
  100733. let semantic = gltfSemantic;
  100734. const setIndexRegex = /^(\w+)_\d+$/;
  100735. const setIndexMatch = setIndexRegex.exec(gltfSemantic);
  100736. if (setIndexMatch !== null) {
  100737. semantic = setIndexMatch[1];
  100738. }
  100739. switch (semantic) {
  100740. case "POSITION":
  100741. return VertexAttributeSemantic.POSITION;
  100742. case "NORMAL":
  100743. return VertexAttributeSemantic.NORMAL;
  100744. case "TANGENT":
  100745. return VertexAttributeSemantic.TANGENT;
  100746. case "TEXCOORD":
  100747. return VertexAttributeSemantic.TEXCOORD;
  100748. case "COLOR":
  100749. return VertexAttributeSemantic.COLOR;
  100750. case "JOINTS":
  100751. return VertexAttributeSemantic.JOINTS;
  100752. case "WEIGHTS":
  100753. return VertexAttributeSemantic.WEIGHTS;
  100754. case "_FEATURE_ID":
  100755. return VertexAttributeSemantic.FEATURE_ID;
  100756. }
  100757. return void 0;
  100758. };
  100759. VertexAttributeSemantic.fromPntsSemantic = function(pntsSemantic) {
  100760. Check_default.typeOf.string("pntsSemantic", pntsSemantic);
  100761. switch (pntsSemantic) {
  100762. case "POSITION":
  100763. case "POSITION_QUANTIZED":
  100764. return VertexAttributeSemantic.POSITION;
  100765. case "RGBA":
  100766. case "RGB":
  100767. case "RGB565":
  100768. return VertexAttributeSemantic.COLOR;
  100769. case "NORMAL":
  100770. case "NORMAL_OCT16P":
  100771. return VertexAttributeSemantic.NORMAL;
  100772. case "BATCH_ID":
  100773. return VertexAttributeSemantic.FEATURE_ID;
  100774. default:
  100775. throw new DeveloperError_default("pntsSemantic is not a valid value.");
  100776. }
  100777. };
  100778. VertexAttributeSemantic.getGlslType = function(semantic) {
  100779. Check_default.typeOf.string("semantic", semantic);
  100780. switch (semantic) {
  100781. case VertexAttributeSemantic.POSITION:
  100782. case VertexAttributeSemantic.NORMAL:
  100783. case VertexAttributeSemantic.TANGENT:
  100784. return "vec3";
  100785. case VertexAttributeSemantic.TEXCOORD:
  100786. return "vec2";
  100787. case VertexAttributeSemantic.COLOR:
  100788. return "vec4";
  100789. case VertexAttributeSemantic.JOINTS:
  100790. return "ivec4";
  100791. case VertexAttributeSemantic.WEIGHTS:
  100792. return "vec4";
  100793. case VertexAttributeSemantic.FEATURE_ID:
  100794. return "int";
  100795. default:
  100796. throw new DeveloperError_default("semantic is not a valid value.");
  100797. }
  100798. };
  100799. VertexAttributeSemantic.getVariableName = function(semantic, setIndex) {
  100800. Check_default.typeOf.string("semantic", semantic);
  100801. let variableName = semanticToVariableName(semantic);
  100802. if (defined_default(setIndex)) {
  100803. variableName += `_${setIndex}`;
  100804. }
  100805. return variableName;
  100806. };
  100807. var VertexAttributeSemantic_default = Object.freeze(VertexAttributeSemantic);
  100808. // node_modules/cesium/Source/Scene/PntsParser.js
  100809. var PntsParser = {};
  100810. var sizeOfUint327 = Uint32Array.BYTES_PER_ELEMENT;
  100811. PntsParser.parse = function(arrayBuffer, byteOffset) {
  100812. byteOffset = defaultValue_default(byteOffset, 0);
  100813. Check_default.defined("arrayBuffer", arrayBuffer);
  100814. const uint8Array = new Uint8Array(arrayBuffer);
  100815. const view = new DataView(arrayBuffer);
  100816. byteOffset += sizeOfUint327;
  100817. const version = view.getUint32(byteOffset, true);
  100818. if (version !== 1) {
  100819. throw new RuntimeError_default(
  100820. `Only Point Cloud tile version 1 is supported. Version ${version} is not.`
  100821. );
  100822. }
  100823. byteOffset += sizeOfUint327;
  100824. byteOffset += sizeOfUint327;
  100825. const featureTableJsonByteLength = view.getUint32(byteOffset, true);
  100826. if (featureTableJsonByteLength === 0) {
  100827. throw new RuntimeError_default(
  100828. "Feature table must have a byte length greater than zero"
  100829. );
  100830. }
  100831. byteOffset += sizeOfUint327;
  100832. const featureTableBinaryByteLength = view.getUint32(byteOffset, true);
  100833. byteOffset += sizeOfUint327;
  100834. const batchTableJsonByteLength = view.getUint32(byteOffset, true);
  100835. byteOffset += sizeOfUint327;
  100836. const batchTableBinaryByteLength = view.getUint32(byteOffset, true);
  100837. byteOffset += sizeOfUint327;
  100838. const featureTableJson = getJsonFromTypedArray_default(
  100839. uint8Array,
  100840. byteOffset,
  100841. featureTableJsonByteLength
  100842. );
  100843. byteOffset += featureTableJsonByteLength;
  100844. const featureTableBinary = new Uint8Array(
  100845. arrayBuffer,
  100846. byteOffset,
  100847. featureTableBinaryByteLength
  100848. );
  100849. byteOffset += featureTableBinaryByteLength;
  100850. let batchTableJson;
  100851. let batchTableBinary;
  100852. if (batchTableJsonByteLength > 0) {
  100853. batchTableJson = getJsonFromTypedArray_default(
  100854. uint8Array,
  100855. byteOffset,
  100856. batchTableJsonByteLength
  100857. );
  100858. byteOffset += batchTableJsonByteLength;
  100859. if (batchTableBinaryByteLength > 0) {
  100860. batchTableBinary = new Uint8Array(
  100861. arrayBuffer,
  100862. byteOffset,
  100863. batchTableBinaryByteLength
  100864. );
  100865. byteOffset += batchTableBinaryByteLength;
  100866. }
  100867. }
  100868. const featureTable = new Cesium3DTileFeatureTable_default(
  100869. featureTableJson,
  100870. featureTableBinary
  100871. );
  100872. const pointsLength = featureTable.getGlobalProperty("POINTS_LENGTH");
  100873. featureTable.featuresLength = pointsLength;
  100874. if (!defined_default(pointsLength)) {
  100875. throw new RuntimeError_default(
  100876. "Feature table global property: POINTS_LENGTH must be defined"
  100877. );
  100878. }
  100879. let rtcCenter = featureTable.getGlobalProperty(
  100880. "RTC_CENTER",
  100881. ComponentDatatype_default.FLOAT,
  100882. 3
  100883. );
  100884. if (defined_default(rtcCenter)) {
  100885. rtcCenter = Cartesian3_default.unpack(rtcCenter);
  100886. }
  100887. const parsedContent = parseDracoProperties(featureTable, batchTableJson);
  100888. parsedContent.rtcCenter = rtcCenter;
  100889. parsedContent.pointsLength = pointsLength;
  100890. if (!parsedContent.hasPositions) {
  100891. const positions = parsePositions(featureTable);
  100892. parsedContent.positions = positions;
  100893. parsedContent.hasPositions = parsedContent.hasPositions || defined_default(positions);
  100894. }
  100895. if (!parsedContent.hasPositions) {
  100896. throw new RuntimeError_default(
  100897. "Either POSITION or POSITION_QUANTIZED must be defined."
  100898. );
  100899. }
  100900. if (!parsedContent.hasNormals) {
  100901. const normals = parseNormals(featureTable);
  100902. parsedContent.normals = normals;
  100903. parsedContent.hasNormals = parsedContent.hasNormals || defined_default(normals);
  100904. }
  100905. if (!parsedContent.hasColors) {
  100906. const colors = parseColors(featureTable);
  100907. parsedContent.colors = colors;
  100908. parsedContent.hasColors = parsedContent.hasColors || defined_default(colors);
  100909. parsedContent.hasConstantColor = defined_default(parsedContent.constantColor);
  100910. parsedContent.isTranslucent = defined_default(colors) && colors.isTranslucent;
  100911. }
  100912. if (!parsedContent.hasBatchIds) {
  100913. const batchIds = parseBatchIds(featureTable);
  100914. parsedContent.batchIds = batchIds;
  100915. parsedContent.hasBatchIds = parsedContent.hasBatchIds || defined_default(batchIds);
  100916. }
  100917. if (parsedContent.hasBatchIds) {
  100918. const batchLength = featureTable.getGlobalProperty("BATCH_LENGTH");
  100919. if (!defined_default(batchLength)) {
  100920. throw new RuntimeError_default(
  100921. "Global property: BATCH_LENGTH must be defined when BATCH_ID is defined."
  100922. );
  100923. }
  100924. parsedContent.batchLength = batchLength;
  100925. }
  100926. if (defined_default(batchTableBinary)) {
  100927. batchTableBinary = new Uint8Array(batchTableBinary);
  100928. parsedContent.batchTableJson = batchTableJson;
  100929. parsedContent.batchTableBinary = batchTableBinary;
  100930. }
  100931. return parsedContent;
  100932. };
  100933. function parseDracoProperties(featureTable, batchTableJson) {
  100934. const featureTableJson = featureTable.json;
  100935. let dracoBuffer;
  100936. let dracoFeatureTableProperties;
  100937. let dracoBatchTableProperties;
  100938. const featureTableDraco = defined_default(featureTableJson.extensions) ? featureTableJson.extensions["3DTILES_draco_point_compression"] : void 0;
  100939. const batchTableDraco = defined_default(batchTableJson) && defined_default(batchTableJson.extensions) ? batchTableJson.extensions["3DTILES_draco_point_compression"] : void 0;
  100940. if (defined_default(batchTableDraco)) {
  100941. dracoBatchTableProperties = batchTableDraco.properties;
  100942. }
  100943. let hasPositions;
  100944. let hasColors;
  100945. let hasNormals;
  100946. let hasBatchIds;
  100947. let isTranslucent2;
  100948. if (defined_default(featureTableDraco)) {
  100949. dracoFeatureTableProperties = featureTableDraco.properties;
  100950. const dracoByteOffset = featureTableDraco.byteOffset;
  100951. const dracoByteLength = featureTableDraco.byteLength;
  100952. if (!defined_default(dracoFeatureTableProperties) || !defined_default(dracoByteOffset) || !defined_default(dracoByteLength)) {
  100953. throw new RuntimeError_default(
  100954. "Draco properties, byteOffset, and byteLength must be defined"
  100955. );
  100956. }
  100957. dracoBuffer = arraySlice_default(
  100958. featureTable.buffer,
  100959. dracoByteOffset,
  100960. dracoByteOffset + dracoByteLength
  100961. );
  100962. hasPositions = defined_default(dracoFeatureTableProperties.POSITION);
  100963. hasColors = defined_default(dracoFeatureTableProperties.RGB) || defined_default(dracoFeatureTableProperties.RGBA);
  100964. hasNormals = defined_default(dracoFeatureTableProperties.NORMAL);
  100965. hasBatchIds = defined_default(dracoFeatureTableProperties.BATCH_ID);
  100966. isTranslucent2 = defined_default(dracoFeatureTableProperties.RGBA);
  100967. }
  100968. let draco;
  100969. if (defined_default(dracoBuffer)) {
  100970. draco = {
  100971. buffer: dracoBuffer,
  100972. featureTableProperties: dracoFeatureTableProperties,
  100973. batchTableProperties: dracoBatchTableProperties,
  100974. properties: combine_default(
  100975. dracoFeatureTableProperties,
  100976. dracoBatchTableProperties
  100977. ),
  100978. dequantizeInShader: true
  100979. };
  100980. }
  100981. return {
  100982. draco,
  100983. hasPositions,
  100984. hasColors,
  100985. isTranslucent: isTranslucent2,
  100986. hasNormals,
  100987. hasBatchIds
  100988. };
  100989. }
  100990. function parsePositions(featureTable) {
  100991. const featureTableJson = featureTable.json;
  100992. let positions;
  100993. if (defined_default(featureTableJson.POSITION)) {
  100994. positions = featureTable.getPropertyArray(
  100995. "POSITION",
  100996. ComponentDatatype_default.FLOAT,
  100997. 3
  100998. );
  100999. return {
  101000. name: VertexAttributeSemantic_default.POSITION,
  101001. semantic: VertexAttributeSemantic_default.POSITION,
  101002. typedArray: positions,
  101003. isQuantized: false,
  101004. componentDatatype: ComponentDatatype_default.FLOAT,
  101005. type: AttributeType_default.VEC3
  101006. };
  101007. } else if (defined_default(featureTableJson.POSITION_QUANTIZED)) {
  101008. positions = featureTable.getPropertyArray(
  101009. "POSITION_QUANTIZED",
  101010. ComponentDatatype_default.UNSIGNED_SHORT,
  101011. 3
  101012. );
  101013. const quantizedVolumeScale = featureTable.getGlobalProperty(
  101014. "QUANTIZED_VOLUME_SCALE",
  101015. ComponentDatatype_default.FLOAT,
  101016. 3
  101017. );
  101018. if (!defined_default(quantizedVolumeScale)) {
  101019. throw new RuntimeError_default(
  101020. "Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions."
  101021. );
  101022. }
  101023. const quantizedRange = (1 << 16) - 1;
  101024. const quantizedVolumeOffset = featureTable.getGlobalProperty(
  101025. "QUANTIZED_VOLUME_OFFSET",
  101026. ComponentDatatype_default.FLOAT,
  101027. 3
  101028. );
  101029. if (!defined_default(quantizedVolumeOffset)) {
  101030. throw new RuntimeError_default(
  101031. "Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions."
  101032. );
  101033. }
  101034. return {
  101035. name: VertexAttributeSemantic_default.POSITION,
  101036. semantic: VertexAttributeSemantic_default.POSITION,
  101037. typedArray: positions,
  101038. isQuantized: true,
  101039. componentDatatype: ComponentDatatype_default.FLOAT,
  101040. type: AttributeType_default.VEC3,
  101041. quantizedRange,
  101042. quantizedVolumeOffset: Cartesian3_default.unpack(quantizedVolumeOffset),
  101043. quantizedVolumeScale: Cartesian3_default.unpack(quantizedVolumeScale),
  101044. quantizedComponentDatatype: ComponentDatatype_default.UNSIGNED_SHORT,
  101045. quantizedType: AttributeType_default.VEC3
  101046. };
  101047. }
  101048. }
  101049. function parseColors(featureTable) {
  101050. const featureTableJson = featureTable.json;
  101051. let colors;
  101052. if (defined_default(featureTableJson.RGBA)) {
  101053. colors = featureTable.getPropertyArray(
  101054. "RGBA",
  101055. ComponentDatatype_default.UNSIGNED_BYTE,
  101056. 4
  101057. );
  101058. return {
  101059. name: VertexAttributeSemantic_default.COLOR,
  101060. semantic: VertexAttributeSemantic_default.COLOR,
  101061. setIndex: 0,
  101062. typedArray: colors,
  101063. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  101064. type: AttributeType_default.VEC4,
  101065. normalized: true,
  101066. isRGB565: false,
  101067. isTranslucent: true
  101068. };
  101069. } else if (defined_default(featureTableJson.RGB)) {
  101070. colors = featureTable.getPropertyArray(
  101071. "RGB",
  101072. ComponentDatatype_default.UNSIGNED_BYTE,
  101073. 3
  101074. );
  101075. return {
  101076. name: "COLOR",
  101077. semantic: VertexAttributeSemantic_default.COLOR,
  101078. setIndex: 0,
  101079. typedArray: colors,
  101080. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  101081. type: AttributeType_default.VEC3,
  101082. normalized: true,
  101083. isRGB565: false,
  101084. isTranslucent: false
  101085. };
  101086. } else if (defined_default(featureTableJson.RGB565)) {
  101087. colors = featureTable.getPropertyArray(
  101088. "RGB565",
  101089. ComponentDatatype_default.UNSIGNED_SHORT,
  101090. 1
  101091. );
  101092. return {
  101093. name: "COLOR",
  101094. semantic: VertexAttributeSemantic_default.COLOR,
  101095. setIndex: 0,
  101096. typedArray: colors,
  101097. componentDatatype: ComponentDatatype_default.FLOAT,
  101098. type: AttributeType_default.VEC3,
  101099. normalized: false,
  101100. isRGB565: true,
  101101. isTranslucent: false
  101102. };
  101103. } else if (defined_default(featureTableJson.CONSTANT_RGBA)) {
  101104. const constantRGBA = featureTable.getGlobalProperty(
  101105. "CONSTANT_RGBA",
  101106. ComponentDatatype_default.UNSIGNED_BYTE,
  101107. 4
  101108. );
  101109. const alpha = constantRGBA[3];
  101110. const constantColor = Color_default.fromBytes(
  101111. constantRGBA[0],
  101112. constantRGBA[1],
  101113. constantRGBA[2],
  101114. alpha
  101115. );
  101116. const isTranslucent2 = alpha < 255;
  101117. return {
  101118. name: VertexAttributeSemantic_default.COLOR,
  101119. semantic: VertexAttributeSemantic_default.COLOR,
  101120. setIndex: 0,
  101121. constantColor,
  101122. componentDatatype: ComponentDatatype_default.FLOAT,
  101123. type: AttributeType_default.VEC4,
  101124. isQuantized: false,
  101125. isTranslucent: isTranslucent2
  101126. };
  101127. }
  101128. return void 0;
  101129. }
  101130. function parseNormals(featureTable) {
  101131. const featureTableJson = featureTable.json;
  101132. let normals;
  101133. if (defined_default(featureTableJson.NORMAL)) {
  101134. normals = featureTable.getPropertyArray(
  101135. "NORMAL",
  101136. ComponentDatatype_default.FLOAT,
  101137. 3
  101138. );
  101139. return {
  101140. name: VertexAttributeSemantic_default.NORMAL,
  101141. semantic: VertexAttributeSemantic_default.NORMAL,
  101142. typedArray: normals,
  101143. octEncoded: false,
  101144. octEncodedZXY: false,
  101145. componentDatatype: ComponentDatatype_default.FLOAT,
  101146. type: AttributeType_default.VEC3
  101147. };
  101148. } else if (defined_default(featureTableJson.NORMAL_OCT16P)) {
  101149. normals = featureTable.getPropertyArray(
  101150. "NORMAL_OCT16P",
  101151. ComponentDatatype_default.UNSIGNED_BYTE,
  101152. 2
  101153. );
  101154. const quantizationBits = 8;
  101155. return {
  101156. name: VertexAttributeSemantic_default.NORMAL,
  101157. semantic: VertexAttributeSemantic_default.NORMAL,
  101158. typedArray: normals,
  101159. octEncoded: true,
  101160. octEncodedZXY: false,
  101161. quantizedRange: (1 << quantizationBits) - 1,
  101162. quantizedType: AttributeType_default.VEC2,
  101163. quantizedComponentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  101164. componentDatatype: ComponentDatatype_default.FLOAT,
  101165. type: AttributeType_default.VEC3
  101166. };
  101167. }
  101168. return void 0;
  101169. }
  101170. function parseBatchIds(featureTable) {
  101171. const featureTableJson = featureTable.json;
  101172. if (defined_default(featureTableJson.BATCH_ID)) {
  101173. const batchIds = featureTable.getPropertyArray(
  101174. "BATCH_ID",
  101175. ComponentDatatype_default.UNSIGNED_SHORT,
  101176. 1
  101177. );
  101178. return {
  101179. name: VertexAttributeSemantic_default.FEATURE_ID,
  101180. semantic: VertexAttributeSemantic_default.FEATURE_ID,
  101181. setIndex: 0,
  101182. typedArray: batchIds,
  101183. componentDatatype: ComponentDatatype_default.fromTypedArray(batchIds),
  101184. type: AttributeType_default.SCALAR
  101185. };
  101186. }
  101187. return void 0;
  101188. }
  101189. var PntsParser_default = PntsParser;
  101190. // node_modules/cesium/Source/Scene/PointCloud.js
  101191. var DecodingState = {
  101192. NEEDS_DECODE: 0,
  101193. DECODING: 1,
  101194. READY: 2,
  101195. FAILED: 3
  101196. };
  101197. function PointCloud(options) {
  101198. Check_default.typeOf.object("options", options);
  101199. Check_default.typeOf.object("options.arrayBuffer", options.arrayBuffer);
  101200. this._parsedContent = void 0;
  101201. this._drawCommand = void 0;
  101202. this._isTranslucent = false;
  101203. this._styleTranslucent = false;
  101204. this._constantColor = Color_default.clone(Color_default.DARKGRAY);
  101205. this._highlightColor = Color_default.clone(Color_default.WHITE);
  101206. this._pointSize = 1;
  101207. this._rtcCenter = void 0;
  101208. this._quantizedVolumeScale = void 0;
  101209. this._quantizedVolumeOffset = void 0;
  101210. this._styleableShaderAttributes = void 0;
  101211. this._isQuantized = false;
  101212. this._isOctEncoded16P = false;
  101213. this._isRGB565 = false;
  101214. this._hasColors = false;
  101215. this._hasNormals = false;
  101216. this._hasBatchIds = false;
  101217. this._decodingState = DecodingState.READY;
  101218. this._dequantizeInShader = true;
  101219. this._isQuantizedDraco = false;
  101220. this._isOctEncodedDraco = false;
  101221. this._quantizedRange = 0;
  101222. this._octEncodedRange = 0;
  101223. this.backFaceCulling = false;
  101224. this._backFaceCulling = false;
  101225. this.normalShading = true;
  101226. this._normalShading = true;
  101227. this._opaqueRenderState = void 0;
  101228. this._translucentRenderState = void 0;
  101229. this._mode = void 0;
  101230. this._ready = false;
  101231. this._readyPromise = defer_default();
  101232. this._pointsLength = 0;
  101233. this._geometryByteLength = 0;
  101234. this._vertexShaderLoaded = options.vertexShaderLoaded;
  101235. this._fragmentShaderLoaded = options.fragmentShaderLoaded;
  101236. this._uniformMapLoaded = options.uniformMapLoaded;
  101237. this._batchTableLoaded = options.batchTableLoaded;
  101238. this._pickIdLoaded = options.pickIdLoaded;
  101239. this._opaquePass = defaultValue_default(options.opaquePass, Pass_default.OPAQUE);
  101240. this._cull = defaultValue_default(options.cull, true);
  101241. this.style = void 0;
  101242. this._style = void 0;
  101243. this.styleDirty = false;
  101244. this.modelMatrix = Matrix4_default.clone(Matrix4_default.IDENTITY);
  101245. this._modelMatrix = Matrix4_default.clone(Matrix4_default.IDENTITY);
  101246. this.time = 0;
  101247. this.shadows = ShadowMode_default.ENABLED;
  101248. this._boundingSphere = void 0;
  101249. this.clippingPlanes = void 0;
  101250. this.isClipped = false;
  101251. this.clippingPlanesDirty = false;
  101252. this.clippingPlanesOriginMatrix = void 0;
  101253. this.attenuation = false;
  101254. this._attenuation = false;
  101255. this.geometricError = 0;
  101256. this.geometricErrorScale = 1;
  101257. this.maximumAttenuation = this._pointSize;
  101258. this.splitDirection = defaultValue_default(
  101259. options.splitDirection,
  101260. SplitDirection_default.NONE
  101261. );
  101262. this._splittingEnabled = false;
  101263. initialize10(this, options);
  101264. }
  101265. Object.defineProperties(PointCloud.prototype, {
  101266. pointsLength: {
  101267. get: function() {
  101268. return this._pointsLength;
  101269. }
  101270. },
  101271. geometryByteLength: {
  101272. get: function() {
  101273. return this._geometryByteLength;
  101274. }
  101275. },
  101276. ready: {
  101277. get: function() {
  101278. return this._ready;
  101279. }
  101280. },
  101281. readyPromise: {
  101282. get: function() {
  101283. return this._readyPromise.promise;
  101284. }
  101285. },
  101286. color: {
  101287. get: function() {
  101288. return Color_default.clone(this._highlightColor);
  101289. },
  101290. set: function(value) {
  101291. this._highlightColor = Color_default.clone(value, this._highlightColor);
  101292. }
  101293. },
  101294. boundingSphere: {
  101295. get: function() {
  101296. if (defined_default(this._drawCommand)) {
  101297. return this._drawCommand.boundingVolume;
  101298. }
  101299. return void 0;
  101300. },
  101301. set: function(value) {
  101302. this._boundingSphere = BoundingSphere_default.clone(value, this._boundingSphere);
  101303. }
  101304. }
  101305. });
  101306. function initialize10(pointCloud, options) {
  101307. const parsedContent = PntsParser_default.parse(
  101308. options.arrayBuffer,
  101309. options.byteOffset
  101310. );
  101311. pointCloud._parsedContent = parsedContent;
  101312. pointCloud._rtcCenter = parsedContent.rtcCenter;
  101313. pointCloud._hasNormals = parsedContent.hasNormals;
  101314. pointCloud._hasColors = parsedContent.hasColors;
  101315. pointCloud._hasBatchIds = parsedContent.hasBatchIds;
  101316. pointCloud._isTranslucent = parsedContent.isTranslucent;
  101317. if (!parsedContent.hasBatchIds && defined_default(parsedContent.batchTableBinary)) {
  101318. parsedContent.styleableProperties = Cesium3DTileBatchTable_default.getBinaryProperties(
  101319. parsedContent.pointsLength,
  101320. parsedContent.batchTableJson,
  101321. parsedContent.batchTableBinary
  101322. );
  101323. }
  101324. if (defined_default(parsedContent.draco)) {
  101325. const draco = parsedContent.draco;
  101326. pointCloud._decodingState = DecodingState.NEEDS_DECODE;
  101327. draco.dequantizeInShader = pointCloud._dequantizeInShader;
  101328. }
  101329. const positions = parsedContent.positions;
  101330. if (defined_default(positions)) {
  101331. pointCloud._isQuantized = positions.isQuantized;
  101332. pointCloud._quantizedVolumeScale = positions.quantizedVolumeScale;
  101333. pointCloud._quantizedVolumeOffset = positions.quantizedVolumeOffset;
  101334. pointCloud._quantizedRange = positions.quantizedRange;
  101335. }
  101336. const normals = parsedContent.normals;
  101337. if (defined_default(normals)) {
  101338. pointCloud._isOctEncoded16P = normals.octEncoded;
  101339. }
  101340. const colors = parsedContent.colors;
  101341. if (defined_default(colors)) {
  101342. if (defined_default(colors.constantColor)) {
  101343. pointCloud._constantColor = Color_default.clone(
  101344. colors.constantColor,
  101345. pointCloud._constantColor
  101346. );
  101347. pointCloud._hasColors = false;
  101348. }
  101349. pointCloud._isRGB565 = colors.isRGB565;
  101350. }
  101351. const batchIds = parsedContent.batchIds;
  101352. if (defined_default(parsedContent.batchIds)) {
  101353. batchIds.name = "BATCH_ID";
  101354. batchIds.semantic = "BATCH_ID";
  101355. batchIds.setIndex = void 0;
  101356. }
  101357. if (parsedContent.hasBatchIds) {
  101358. pointCloud._batchTableLoaded(
  101359. parsedContent.batchLength,
  101360. parsedContent.batchTableJson,
  101361. parsedContent.batchTableBinary
  101362. );
  101363. }
  101364. pointCloud._pointsLength = parsedContent.pointsLength;
  101365. }
  101366. var scratchMin3 = new Cartesian3_default();
  101367. var scratchMax3 = new Cartesian3_default();
  101368. var scratchPosition8 = new Cartesian3_default();
  101369. var randomNumberGenerator2;
  101370. var randomValues;
  101371. function getRandomValues(samplesLength) {
  101372. if (!defined_default(randomValues)) {
  101373. randomNumberGenerator2 = new mersenneTwister(0);
  101374. randomValues = new Array(samplesLength);
  101375. for (let i2 = 0; i2 < samplesLength; ++i2) {
  101376. randomValues[i2] = randomNumberGenerator2.random();
  101377. }
  101378. }
  101379. return randomValues;
  101380. }
  101381. function computeApproximateBoundingSphereFromPositions(positions) {
  101382. const maximumSamplesLength = 20;
  101383. const pointsLength = positions.length / 3;
  101384. const samplesLength = Math.min(pointsLength, maximumSamplesLength);
  101385. const randomValues3 = getRandomValues(maximumSamplesLength);
  101386. const maxValue = Number.MAX_VALUE;
  101387. const minValue = -Number.MAX_VALUE;
  101388. const min3 = Cartesian3_default.fromElements(maxValue, maxValue, maxValue, scratchMin3);
  101389. const max3 = Cartesian3_default.fromElements(minValue, minValue, minValue, scratchMax3);
  101390. for (let i2 = 0; i2 < samplesLength; ++i2) {
  101391. const index2 = Math.floor(randomValues3[i2] * pointsLength);
  101392. const position = Cartesian3_default.unpack(positions, index2 * 3, scratchPosition8);
  101393. Cartesian3_default.minimumByComponent(min3, position, min3);
  101394. Cartesian3_default.maximumByComponent(max3, position, max3);
  101395. }
  101396. const boundingSphere = BoundingSphere_default.fromCornerPoints(min3, max3);
  101397. boundingSphere.radius += Math_default.EPSILON2;
  101398. return boundingSphere;
  101399. }
  101400. function prepareVertexAttribute(typedArray, name) {
  101401. const componentDatatype = ComponentDatatype_default.fromTypedArray(typedArray);
  101402. if (componentDatatype === ComponentDatatype_default.INT || componentDatatype === ComponentDatatype_default.UNSIGNED_INT || componentDatatype === ComponentDatatype_default.DOUBLE) {
  101403. oneTimeWarning_default(
  101404. "Cast pnts property to floats",
  101405. `Point cloud property "${name}" will be casted to a float array because INT, UNSIGNED_INT, and DOUBLE are not valid WebGL vertex attribute types. Some precision may be lost.`
  101406. );
  101407. return new Float32Array(typedArray);
  101408. }
  101409. return typedArray;
  101410. }
  101411. var scratchPointSizeAndTimeAndGeometricErrorAndDepthMultiplier = new Cartesian4_default();
  101412. var scratchQuantizedVolumeScaleAndOctEncodedRange = new Cartesian4_default();
  101413. var scratchColor6 = new Color_default();
  101414. var positionLocation = 0;
  101415. var colorLocation = 1;
  101416. var normalLocation = 2;
  101417. var batchIdLocation = 3;
  101418. var numberOfAttributes = 4;
  101419. var scratchClippingPlanesMatrix2 = new Matrix4_default();
  101420. var scratchInverseTransposeClippingPlanesMatrix = new Matrix4_default();
  101421. function createResources3(pointCloud, frameState) {
  101422. const context = frameState.context;
  101423. const parsedContent = pointCloud._parsedContent;
  101424. const pointsLength = pointCloud._pointsLength;
  101425. const positions = parsedContent.positions;
  101426. const colors = parsedContent.colors;
  101427. const normals = parsedContent.normals;
  101428. let batchIds = parsedContent.batchIds;
  101429. const styleableProperties = parsedContent.styleableProperties;
  101430. const hasStyleableProperties = defined_default(styleableProperties);
  101431. const isQuantized = pointCloud._isQuantized;
  101432. const isQuantizedDraco = pointCloud._isQuantizedDraco;
  101433. const isOctEncoded16P = pointCloud._isOctEncoded16P;
  101434. const isOctEncodedDraco = pointCloud._isOctEncodedDraco;
  101435. const quantizedRange = pointCloud._quantizedRange;
  101436. const octEncodedRange = pointCloud._octEncodedRange;
  101437. const isRGB565 = pointCloud._isRGB565;
  101438. const isTranslucent2 = pointCloud._isTranslucent;
  101439. const hasColors = pointCloud._hasColors;
  101440. const hasNormals = pointCloud._hasNormals;
  101441. const hasBatchIds = pointCloud._hasBatchIds;
  101442. let componentsPerAttribute;
  101443. let componentDatatype;
  101444. const styleableVertexAttributes = [];
  101445. const styleableShaderAttributes = {};
  101446. pointCloud._styleableShaderAttributes = styleableShaderAttributes;
  101447. if (hasStyleableProperties) {
  101448. let attributeLocation = numberOfAttributes;
  101449. for (const name in styleableProperties) {
  101450. if (styleableProperties.hasOwnProperty(name)) {
  101451. const property = styleableProperties[name];
  101452. const typedArray = prepareVertexAttribute(property.typedArray, name);
  101453. componentsPerAttribute = property.componentCount;
  101454. componentDatatype = ComponentDatatype_default.fromTypedArray(typedArray);
  101455. const vertexBuffer = Buffer_default.createVertexBuffer({
  101456. context,
  101457. typedArray,
  101458. usage: BufferUsage_default.STATIC_DRAW
  101459. });
  101460. pointCloud._geometryByteLength += vertexBuffer.sizeInBytes;
  101461. const vertexAttribute = {
  101462. index: attributeLocation,
  101463. vertexBuffer,
  101464. componentsPerAttribute,
  101465. componentDatatype,
  101466. normalize: false,
  101467. offsetInBytes: 0,
  101468. strideInBytes: 0
  101469. };
  101470. styleableVertexAttributes.push(vertexAttribute);
  101471. styleableShaderAttributes[name] = {
  101472. location: attributeLocation,
  101473. componentCount: componentsPerAttribute
  101474. };
  101475. ++attributeLocation;
  101476. }
  101477. }
  101478. }
  101479. const positionsVertexBuffer = Buffer_default.createVertexBuffer({
  101480. context,
  101481. typedArray: positions.typedArray,
  101482. usage: BufferUsage_default.STATIC_DRAW
  101483. });
  101484. pointCloud._geometryByteLength += positionsVertexBuffer.sizeInBytes;
  101485. let colorsVertexBuffer;
  101486. if (hasColors) {
  101487. colorsVertexBuffer = Buffer_default.createVertexBuffer({
  101488. context,
  101489. typedArray: colors.typedArray,
  101490. usage: BufferUsage_default.STATIC_DRAW
  101491. });
  101492. pointCloud._geometryByteLength += colorsVertexBuffer.sizeInBytes;
  101493. }
  101494. let normalsVertexBuffer;
  101495. if (hasNormals) {
  101496. normalsVertexBuffer = Buffer_default.createVertexBuffer({
  101497. context,
  101498. typedArray: normals.typedArray,
  101499. usage: BufferUsage_default.STATIC_DRAW
  101500. });
  101501. pointCloud._geometryByteLength += normalsVertexBuffer.sizeInBytes;
  101502. }
  101503. let batchIdsVertexBuffer;
  101504. if (hasBatchIds) {
  101505. batchIds = prepareVertexAttribute(batchIds, "batchIds");
  101506. batchIdsVertexBuffer = Buffer_default.createVertexBuffer({
  101507. context,
  101508. typedArray: batchIds.typedArray,
  101509. usage: BufferUsage_default.STATIC_DRAW
  101510. });
  101511. pointCloud._geometryByteLength += batchIdsVertexBuffer.sizeInBytes;
  101512. }
  101513. let attributes = [];
  101514. if (isQuantized) {
  101515. componentDatatype = ComponentDatatype_default.UNSIGNED_SHORT;
  101516. } else if (isQuantizedDraco) {
  101517. componentDatatype = quantizedRange <= 255 ? ComponentDatatype_default.UNSIGNED_BYTE : ComponentDatatype_default.UNSIGNED_SHORT;
  101518. } else {
  101519. componentDatatype = ComponentDatatype_default.FLOAT;
  101520. }
  101521. attributes.push({
  101522. index: positionLocation,
  101523. vertexBuffer: positionsVertexBuffer,
  101524. componentsPerAttribute: 3,
  101525. componentDatatype,
  101526. normalize: false,
  101527. offsetInBytes: 0,
  101528. strideInBytes: 0
  101529. });
  101530. if (pointCloud._cull) {
  101531. if (isQuantized || isQuantizedDraco) {
  101532. pointCloud._boundingSphere = BoundingSphere_default.fromCornerPoints(
  101533. Cartesian3_default.ZERO,
  101534. pointCloud._quantizedVolumeScale
  101535. );
  101536. } else {
  101537. pointCloud._boundingSphere = computeApproximateBoundingSphereFromPositions(
  101538. positions.typedArray
  101539. );
  101540. }
  101541. }
  101542. if (hasColors) {
  101543. if (isRGB565) {
  101544. attributes.push({
  101545. index: colorLocation,
  101546. vertexBuffer: colorsVertexBuffer,
  101547. componentsPerAttribute: 1,
  101548. componentDatatype: ComponentDatatype_default.UNSIGNED_SHORT,
  101549. normalize: false,
  101550. offsetInBytes: 0,
  101551. strideInBytes: 0
  101552. });
  101553. } else {
  101554. const colorComponentsPerAttribute = isTranslucent2 ? 4 : 3;
  101555. attributes.push({
  101556. index: colorLocation,
  101557. vertexBuffer: colorsVertexBuffer,
  101558. componentsPerAttribute: colorComponentsPerAttribute,
  101559. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  101560. normalize: true,
  101561. offsetInBytes: 0,
  101562. strideInBytes: 0
  101563. });
  101564. }
  101565. }
  101566. if (hasNormals) {
  101567. if (isOctEncoded16P) {
  101568. componentsPerAttribute = 2;
  101569. componentDatatype = ComponentDatatype_default.UNSIGNED_BYTE;
  101570. } else if (isOctEncodedDraco) {
  101571. componentsPerAttribute = 2;
  101572. componentDatatype = octEncodedRange <= 255 ? ComponentDatatype_default.UNSIGNED_BYTE : ComponentDatatype_default.UNSIGNED_SHORT;
  101573. } else {
  101574. componentsPerAttribute = 3;
  101575. componentDatatype = ComponentDatatype_default.FLOAT;
  101576. }
  101577. attributes.push({
  101578. index: normalLocation,
  101579. vertexBuffer: normalsVertexBuffer,
  101580. componentsPerAttribute,
  101581. componentDatatype,
  101582. normalize: false,
  101583. offsetInBytes: 0,
  101584. strideInBytes: 0
  101585. });
  101586. }
  101587. if (hasBatchIds) {
  101588. attributes.push({
  101589. index: batchIdLocation,
  101590. vertexBuffer: batchIdsVertexBuffer,
  101591. componentsPerAttribute: 1,
  101592. componentDatatype: ComponentDatatype_default.fromTypedArray(batchIds.typedArray),
  101593. normalize: false,
  101594. offsetInBytes: 0,
  101595. strideInBytes: 0
  101596. });
  101597. }
  101598. if (hasStyleableProperties) {
  101599. attributes = attributes.concat(styleableVertexAttributes);
  101600. }
  101601. const vertexArray = new VertexArray_default({
  101602. context,
  101603. attributes
  101604. });
  101605. const opaqueRenderState = {
  101606. depthTest: {
  101607. enabled: true
  101608. }
  101609. };
  101610. const translucentRenderState = {
  101611. depthTest: {
  101612. enabled: true
  101613. },
  101614. depthMask: false,
  101615. blending: BlendingState_default.ALPHA_BLEND
  101616. };
  101617. if (pointCloud._opaquePass === Pass_default.CESIUM_3D_TILE) {
  101618. opaqueRenderState.stencilTest = StencilConstants_default.setCesium3DTileBit();
  101619. opaqueRenderState.stencilMask = StencilConstants_default.CESIUM_3D_TILE_MASK;
  101620. translucentRenderState.stencilTest = StencilConstants_default.setCesium3DTileBit();
  101621. translucentRenderState.stencilMask = StencilConstants_default.CESIUM_3D_TILE_MASK;
  101622. }
  101623. pointCloud._opaqueRenderState = RenderState_default.fromCache(opaqueRenderState);
  101624. pointCloud._translucentRenderState = RenderState_default.fromCache(
  101625. translucentRenderState
  101626. );
  101627. pointCloud._drawCommand = new DrawCommand_default({
  101628. boundingVolume: new BoundingSphere_default(),
  101629. cull: pointCloud._cull,
  101630. modelMatrix: new Matrix4_default(),
  101631. primitiveType: PrimitiveType_default.POINTS,
  101632. vertexArray,
  101633. count: pointsLength,
  101634. shaderProgram: void 0,
  101635. uniformMap: void 0,
  101636. renderState: isTranslucent2 ? pointCloud._translucentRenderState : pointCloud._opaqueRenderState,
  101637. pass: isTranslucent2 ? Pass_default.TRANSLUCENT : pointCloud._opaquePass,
  101638. owner: pointCloud,
  101639. castShadows: false,
  101640. receiveShadows: false,
  101641. pickId: pointCloud._pickIdLoaded()
  101642. });
  101643. }
  101644. function createUniformMap3(pointCloud, frameState) {
  101645. const context = frameState.context;
  101646. const isQuantized = pointCloud._isQuantized;
  101647. const isQuantizedDraco = pointCloud._isQuantizedDraco;
  101648. const isOctEncodedDraco = pointCloud._isOctEncodedDraco;
  101649. let uniformMap2 = {
  101650. u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier: function() {
  101651. const scratch = scratchPointSizeAndTimeAndGeometricErrorAndDepthMultiplier;
  101652. scratch.x = pointCloud._attenuation ? pointCloud.maximumAttenuation : pointCloud._pointSize;
  101653. scratch.x *= frameState.pixelRatio;
  101654. scratch.y = pointCloud.time;
  101655. if (pointCloud._attenuation) {
  101656. const frustum = frameState.camera.frustum;
  101657. let depthMultiplier;
  101658. if (frameState.mode === SceneMode_default.SCENE2D || frustum instanceof OrthographicFrustum_default) {
  101659. depthMultiplier = Number.POSITIVE_INFINITY;
  101660. } else {
  101661. depthMultiplier = context.drawingBufferHeight / frameState.camera.frustum.sseDenominator;
  101662. }
  101663. scratch.z = pointCloud.geometricError * pointCloud.geometricErrorScale;
  101664. scratch.w = depthMultiplier;
  101665. }
  101666. return scratch;
  101667. },
  101668. u_highlightColor: function() {
  101669. return pointCloud._highlightColor;
  101670. },
  101671. u_constantColor: function() {
  101672. return pointCloud._constantColor;
  101673. },
  101674. u_clippingPlanes: function() {
  101675. const clippingPlanes = pointCloud.clippingPlanes;
  101676. const isClipped = pointCloud.isClipped;
  101677. return isClipped ? clippingPlanes.texture : context.defaultTexture;
  101678. },
  101679. u_clippingPlanesEdgeStyle: function() {
  101680. const clippingPlanes = pointCloud.clippingPlanes;
  101681. if (!defined_default(clippingPlanes)) {
  101682. return Color_default.TRANSPARENT;
  101683. }
  101684. const style = Color_default.clone(clippingPlanes.edgeColor, scratchColor6);
  101685. style.alpha = clippingPlanes.edgeWidth;
  101686. return style;
  101687. },
  101688. u_clippingPlanesMatrix: function() {
  101689. const clippingPlanes = pointCloud.clippingPlanes;
  101690. if (!defined_default(clippingPlanes)) {
  101691. return Matrix4_default.IDENTITY;
  101692. }
  101693. const clippingPlanesOriginMatrix = defaultValue_default(
  101694. pointCloud.clippingPlanesOriginMatrix,
  101695. pointCloud._modelMatrix
  101696. );
  101697. Matrix4_default.multiply(
  101698. context.uniformState.view3D,
  101699. clippingPlanesOriginMatrix,
  101700. scratchClippingPlanesMatrix2
  101701. );
  101702. const transform4 = Matrix4_default.multiply(
  101703. scratchClippingPlanesMatrix2,
  101704. clippingPlanes.modelMatrix,
  101705. scratchClippingPlanesMatrix2
  101706. );
  101707. return Matrix4_default.inverseTranspose(
  101708. transform4,
  101709. scratchInverseTransposeClippingPlanesMatrix
  101710. );
  101711. }
  101712. };
  101713. Splitter_default.addUniforms(pointCloud, uniformMap2);
  101714. if (isQuantized || isQuantizedDraco || isOctEncodedDraco) {
  101715. uniformMap2 = combine_default(uniformMap2, {
  101716. u_quantizedVolumeScaleAndOctEncodedRange: function() {
  101717. const scratch = scratchQuantizedVolumeScaleAndOctEncodedRange;
  101718. if (defined_default(pointCloud._quantizedVolumeScale)) {
  101719. const scale = Cartesian3_default.clone(
  101720. pointCloud._quantizedVolumeScale,
  101721. scratch
  101722. );
  101723. Cartesian3_default.divideByScalar(scale, pointCloud._quantizedRange, scratch);
  101724. }
  101725. scratch.w = pointCloud._octEncodedRange;
  101726. return scratch;
  101727. }
  101728. });
  101729. }
  101730. if (defined_default(pointCloud._uniformMapLoaded)) {
  101731. uniformMap2 = pointCloud._uniformMapLoaded(uniformMap2);
  101732. }
  101733. pointCloud._drawCommand.uniformMap = uniformMap2;
  101734. }
  101735. function getStyleablePropertyIds(source, propertyIds) {
  101736. const regex = /czm_3dtiles_property_(\d+)/g;
  101737. let matches = regex.exec(source);
  101738. while (matches !== null) {
  101739. const id = parseInt(matches[1]);
  101740. if (propertyIds.indexOf(id) === -1) {
  101741. propertyIds.push(id);
  101742. }
  101743. matches = regex.exec(source);
  101744. }
  101745. }
  101746. function getBuiltinPropertyNames(source, propertyNames) {
  101747. source = source.slice(source.indexOf("\n"));
  101748. const regex = /czm_3dtiles_builtin_property_(\w+)/g;
  101749. let matches = regex.exec(source);
  101750. while (matches !== null) {
  101751. const name = matches[1];
  101752. if (propertyNames.indexOf(name) === -1) {
  101753. propertyNames.push(name);
  101754. }
  101755. matches = regex.exec(source);
  101756. }
  101757. }
  101758. function getVertexAttribute(vertexArray, index2) {
  101759. const numberOfAttributes2 = vertexArray.numberOfAttributes;
  101760. for (let i2 = 0; i2 < numberOfAttributes2; ++i2) {
  101761. const attribute = vertexArray.getAttribute(i2);
  101762. if (attribute.index === index2) {
  101763. return attribute;
  101764. }
  101765. }
  101766. }
  101767. var builtinVariableSubstitutionMap = {
  101768. POSITION: "czm_3dtiles_builtin_property_POSITION",
  101769. POSITION_ABSOLUTE: "czm_3dtiles_builtin_property_POSITION_ABSOLUTE",
  101770. COLOR: "czm_3dtiles_builtin_property_COLOR",
  101771. NORMAL: "czm_3dtiles_builtin_property_NORMAL"
  101772. };
  101773. function createShaders2(pointCloud, frameState, style) {
  101774. let i2;
  101775. let name;
  101776. let attribute;
  101777. const context = frameState.context;
  101778. const hasStyle = defined_default(style);
  101779. const isQuantized = pointCloud._isQuantized;
  101780. const isQuantizedDraco = pointCloud._isQuantizedDraco;
  101781. const isOctEncoded16P = pointCloud._isOctEncoded16P;
  101782. const isOctEncodedDraco = pointCloud._isOctEncodedDraco;
  101783. const isRGB565 = pointCloud._isRGB565;
  101784. const isTranslucent2 = pointCloud._isTranslucent;
  101785. const hasColors = pointCloud._hasColors;
  101786. const hasNormals = pointCloud._hasNormals;
  101787. const hasBatchIds = pointCloud._hasBatchIds;
  101788. const backFaceCulling = pointCloud._backFaceCulling;
  101789. const normalShading = pointCloud._normalShading;
  101790. const vertexArray = pointCloud._drawCommand.vertexArray;
  101791. const clippingPlanes = pointCloud.clippingPlanes;
  101792. const attenuation = pointCloud._attenuation;
  101793. let colorStyleFunction;
  101794. let showStyleFunction;
  101795. let pointSizeStyleFunction;
  101796. let styleTranslucent = isTranslucent2;
  101797. const variableSubstitutionMap = clone_default(builtinVariableSubstitutionMap);
  101798. const propertyIdToAttributeMap = {};
  101799. const styleableShaderAttributes = pointCloud._styleableShaderAttributes;
  101800. for (name in styleableShaderAttributes) {
  101801. if (styleableShaderAttributes.hasOwnProperty(name)) {
  101802. attribute = styleableShaderAttributes[name];
  101803. variableSubstitutionMap[name] = `czm_3dtiles_property_${attribute.location}`;
  101804. propertyIdToAttributeMap[attribute.location] = attribute;
  101805. }
  101806. }
  101807. if (hasStyle) {
  101808. const shaderState = {
  101809. translucent: false
  101810. };
  101811. const parameterList = "(vec3 czm_3dtiles_builtin_property_POSITION, vec3 czm_3dtiles_builtin_property_POSITION_ABSOLUTE, vec4 czm_3dtiles_builtin_property_COLOR, vec3 czm_3dtiles_builtin_property_NORMAL)";
  101812. colorStyleFunction = style.getColorShaderFunction(
  101813. `getColorFromStyle${parameterList}`,
  101814. variableSubstitutionMap,
  101815. shaderState
  101816. );
  101817. showStyleFunction = style.getShowShaderFunction(
  101818. `getShowFromStyle${parameterList}`,
  101819. variableSubstitutionMap,
  101820. shaderState
  101821. );
  101822. pointSizeStyleFunction = style.getPointSizeShaderFunction(
  101823. `getPointSizeFromStyle${parameterList}`,
  101824. variableSubstitutionMap,
  101825. shaderState
  101826. );
  101827. if (defined_default(colorStyleFunction) && shaderState.translucent) {
  101828. styleTranslucent = true;
  101829. }
  101830. }
  101831. pointCloud._styleTranslucent = styleTranslucent;
  101832. const hasColorStyle = defined_default(colorStyleFunction);
  101833. const hasShowStyle = defined_default(showStyleFunction);
  101834. const hasPointSizeStyle = defined_default(pointSizeStyleFunction);
  101835. const hasClippedContent = pointCloud.isClipped;
  101836. const styleablePropertyIds = [];
  101837. const builtinPropertyNames = [];
  101838. if (hasColorStyle) {
  101839. getStyleablePropertyIds(colorStyleFunction, styleablePropertyIds);
  101840. getBuiltinPropertyNames(colorStyleFunction, builtinPropertyNames);
  101841. }
  101842. if (hasShowStyle) {
  101843. getStyleablePropertyIds(showStyleFunction, styleablePropertyIds);
  101844. getBuiltinPropertyNames(showStyleFunction, builtinPropertyNames);
  101845. }
  101846. if (hasPointSizeStyle) {
  101847. getStyleablePropertyIds(pointSizeStyleFunction, styleablePropertyIds);
  101848. getBuiltinPropertyNames(pointSizeStyleFunction, builtinPropertyNames);
  101849. }
  101850. const usesColorSemantic = builtinPropertyNames.indexOf("COLOR") >= 0;
  101851. const usesNormalSemantic = builtinPropertyNames.indexOf("NORMAL") >= 0;
  101852. if (usesNormalSemantic && !hasNormals) {
  101853. throw new RuntimeError_default(
  101854. "Style references the NORMAL semantic but the point cloud does not have normals"
  101855. );
  101856. }
  101857. for (name in styleableShaderAttributes) {
  101858. if (styleableShaderAttributes.hasOwnProperty(name)) {
  101859. attribute = styleableShaderAttributes[name];
  101860. const enabled = styleablePropertyIds.indexOf(attribute.location) >= 0;
  101861. const vertexAttribute = getVertexAttribute(
  101862. vertexArray,
  101863. attribute.location
  101864. );
  101865. vertexAttribute.enabled = enabled;
  101866. }
  101867. }
  101868. const usesColors = hasColors && (!hasColorStyle || usesColorSemantic);
  101869. if (hasColors) {
  101870. const colorVertexAttribute = getVertexAttribute(vertexArray, colorLocation);
  101871. colorVertexAttribute.enabled = usesColors;
  101872. }
  101873. const usesNormals = hasNormals && (normalShading || backFaceCulling || usesNormalSemantic);
  101874. if (hasNormals) {
  101875. const normalVertexAttribute = getVertexAttribute(
  101876. vertexArray,
  101877. normalLocation
  101878. );
  101879. normalVertexAttribute.enabled = usesNormals;
  101880. }
  101881. const attributeLocations8 = {
  101882. a_position: positionLocation
  101883. };
  101884. if (usesColors) {
  101885. attributeLocations8.a_color = colorLocation;
  101886. }
  101887. if (usesNormals) {
  101888. attributeLocations8.a_normal = normalLocation;
  101889. }
  101890. if (hasBatchIds) {
  101891. attributeLocations8.a_batchId = batchIdLocation;
  101892. }
  101893. let attributeDeclarations = "";
  101894. const length3 = styleablePropertyIds.length;
  101895. for (i2 = 0; i2 < length3; ++i2) {
  101896. const propertyId = styleablePropertyIds[i2];
  101897. attribute = propertyIdToAttributeMap[propertyId];
  101898. const componentCount = attribute.componentCount;
  101899. const attributeName = `czm_3dtiles_property_${propertyId}`;
  101900. let attributeType;
  101901. if (componentCount === 1) {
  101902. attributeType = "float";
  101903. } else {
  101904. attributeType = `vec${componentCount}`;
  101905. }
  101906. attributeDeclarations += `attribute ${attributeType} ${attributeName};
  101907. `;
  101908. attributeLocations8[attributeName] = attribute.location;
  101909. }
  101910. createUniformMap3(pointCloud, frameState);
  101911. let vs = "attribute vec3 a_position; \nvarying vec4 v_color; \nuniform vec4 u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier; \nuniform vec4 u_constantColor; \nuniform vec4 u_highlightColor; \n";
  101912. vs += "float u_pointSize; \nfloat u_time; \n";
  101913. if (attenuation) {
  101914. vs += "float u_geometricError; \nfloat u_depthMultiplier; \n";
  101915. }
  101916. vs += attributeDeclarations;
  101917. if (usesColors) {
  101918. if (isTranslucent2) {
  101919. vs += "attribute vec4 a_color; \n";
  101920. } else if (isRGB565) {
  101921. vs += "attribute float a_color; \nconst float SHIFT_RIGHT_11 = 1.0 / 2048.0; \nconst float SHIFT_RIGHT_5 = 1.0 / 32.0; \nconst float SHIFT_LEFT_11 = 2048.0; \nconst float SHIFT_LEFT_5 = 32.0; \nconst float NORMALIZE_6 = 1.0 / 64.0; \nconst float NORMALIZE_5 = 1.0 / 32.0; \n";
  101922. } else {
  101923. vs += "attribute vec3 a_color; \n";
  101924. }
  101925. }
  101926. if (usesNormals) {
  101927. if (isOctEncoded16P || isOctEncodedDraco) {
  101928. vs += "attribute vec2 a_normal; \n";
  101929. } else {
  101930. vs += "attribute vec3 a_normal; \n";
  101931. }
  101932. }
  101933. if (hasBatchIds) {
  101934. vs += "attribute float a_batchId; \n";
  101935. }
  101936. if (isQuantized || isQuantizedDraco || isOctEncodedDraco) {
  101937. vs += "uniform vec4 u_quantizedVolumeScaleAndOctEncodedRange; \n";
  101938. }
  101939. if (hasColorStyle) {
  101940. vs += colorStyleFunction;
  101941. }
  101942. if (hasShowStyle) {
  101943. vs += showStyleFunction;
  101944. }
  101945. if (hasPointSizeStyle) {
  101946. vs += pointSizeStyleFunction;
  101947. }
  101948. vs += "void main() \n{ \n u_pointSize = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.x; \n u_time = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.y; \n";
  101949. if (attenuation) {
  101950. vs += " u_geometricError = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.z; \n u_depthMultiplier = u_pointSizeAndTimeAndGeometricErrorAndDepthMultiplier.w; \n";
  101951. }
  101952. if (usesColors) {
  101953. if (isTranslucent2) {
  101954. vs += " vec4 color = a_color; \n";
  101955. } else if (isRGB565) {
  101956. vs += " float compressed = a_color; \n float r = floor(compressed * SHIFT_RIGHT_11); \n compressed -= r * SHIFT_LEFT_11; \n float g = floor(compressed * SHIFT_RIGHT_5); \n compressed -= g * SHIFT_LEFT_5; \n float b = compressed; \n vec3 rgb = vec3(r * NORMALIZE_5, g * NORMALIZE_6, b * NORMALIZE_5); \n vec4 color = vec4(rgb, 1.0); \n";
  101957. } else {
  101958. vs += " vec4 color = vec4(a_color, 1.0); \n";
  101959. }
  101960. } else {
  101961. vs += " vec4 color = u_constantColor; \n";
  101962. }
  101963. if (isQuantized || isQuantizedDraco) {
  101964. vs += " vec3 position = a_position * u_quantizedVolumeScaleAndOctEncodedRange.xyz; \n";
  101965. } else {
  101966. vs += " vec3 position = a_position; \n";
  101967. }
  101968. vs += " vec3 position_absolute = vec3(czm_model * vec4(position, 1.0)); \n";
  101969. if (usesNormals) {
  101970. if (isOctEncoded16P) {
  101971. vs += " vec3 normal = czm_octDecode(a_normal); \n";
  101972. } else if (isOctEncodedDraco) {
  101973. vs += " vec3 normal = czm_octDecode(a_normal, u_quantizedVolumeScaleAndOctEncodedRange.w).zxy; \n";
  101974. } else {
  101975. vs += " vec3 normal = a_normal; \n";
  101976. }
  101977. vs += " vec3 normalEC = czm_normal * normal; \n";
  101978. } else {
  101979. vs += " vec3 normal = vec3(1.0); \n";
  101980. }
  101981. if (hasColorStyle) {
  101982. vs += " color = getColorFromStyle(position, position_absolute, color, normal); \n";
  101983. }
  101984. if (hasShowStyle) {
  101985. vs += " float show = float(getShowFromStyle(position, position_absolute, color, normal)); \n";
  101986. }
  101987. if (hasPointSizeStyle) {
  101988. vs += " gl_PointSize = getPointSizeFromStyle(position, position_absolute, color, normal) * czm_pixelRatio; \n";
  101989. } else if (attenuation) {
  101990. vs += " vec4 positionEC = czm_modelView * vec4(position, 1.0); \n float depth = -positionEC.z; \n gl_PointSize = min((u_geometricError / depth) * u_depthMultiplier, u_pointSize); \n";
  101991. } else {
  101992. vs += " gl_PointSize = u_pointSize; \n";
  101993. }
  101994. vs += " color = color * u_highlightColor; \n";
  101995. if (usesNormals && normalShading) {
  101996. vs += " float diffuseStrength = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC); \n diffuseStrength = max(diffuseStrength, 0.4); \n color.xyz *= diffuseStrength * czm_lightColor; \n";
  101997. }
  101998. vs += " v_color = color; \n gl_Position = czm_modelViewProjection * vec4(position, 1.0); \n";
  101999. if (usesNormals && backFaceCulling) {
  102000. vs += " float visible = step(-normalEC.z, 0.0); \n gl_Position *= visible; \n gl_PointSize *= visible; \n";
  102001. }
  102002. if (hasShowStyle) {
  102003. vs += " gl_Position.w *= float(show); \n gl_PointSize *= float(show); \n";
  102004. }
  102005. vs += "} \n";
  102006. let fs = "varying vec4 v_color; \n";
  102007. if (hasClippedContent) {
  102008. fs += "uniform highp sampler2D u_clippingPlanes; \nuniform mat4 u_clippingPlanesMatrix; \nuniform vec4 u_clippingPlanesEdgeStyle; \n";
  102009. fs += "\n";
  102010. fs += getClippingFunction_default(clippingPlanes, context);
  102011. fs += "\n";
  102012. }
  102013. fs += "void main() \n{ \n gl_FragColor = czm_gammaCorrect(v_color); \n";
  102014. if (hasClippedContent) {
  102015. fs += getClipAndStyleCode_default(
  102016. "u_clippingPlanes",
  102017. "u_clippingPlanesMatrix",
  102018. "u_clippingPlanesEdgeStyle"
  102019. );
  102020. }
  102021. fs += "} \n";
  102022. if (pointCloud.splitDirection !== SplitDirection_default.NONE) {
  102023. fs = Splitter_default.modifyFragmentShader(fs);
  102024. }
  102025. if (defined_default(pointCloud._vertexShaderLoaded)) {
  102026. vs = pointCloud._vertexShaderLoaded(vs);
  102027. }
  102028. if (defined_default(pointCloud._fragmentShaderLoaded)) {
  102029. fs = pointCloud._fragmentShaderLoaded(fs);
  102030. }
  102031. const drawCommand = pointCloud._drawCommand;
  102032. if (defined_default(drawCommand.shaderProgram)) {
  102033. drawCommand.shaderProgram.destroy();
  102034. }
  102035. drawCommand.shaderProgram = ShaderProgram_default.fromCache({
  102036. context,
  102037. vertexShaderSource: vs,
  102038. fragmentShaderSource: fs,
  102039. attributeLocations: attributeLocations8
  102040. });
  102041. try {
  102042. drawCommand.shaderProgram._bind();
  102043. } catch (error) {
  102044. throw new RuntimeError_default(
  102045. "Error generating style shader: this may be caused by a type mismatch, index out-of-bounds, or other syntax error."
  102046. );
  102047. }
  102048. }
  102049. function decodeDraco(pointCloud, context) {
  102050. if (pointCloud._decodingState === DecodingState.READY) {
  102051. return false;
  102052. }
  102053. if (pointCloud._decodingState === DecodingState.NEEDS_DECODE) {
  102054. const parsedContent = pointCloud._parsedContent;
  102055. const draco = parsedContent.draco;
  102056. const decodePromise = DracoLoader_default.decodePointCloud(draco, context);
  102057. if (defined_default(decodePromise)) {
  102058. pointCloud._decodingState = DecodingState.DECODING;
  102059. decodePromise.then(function(result) {
  102060. pointCloud._decodingState = DecodingState.READY;
  102061. const decodedPositions = defined_default(result.POSITION) ? result.POSITION.array : void 0;
  102062. const decodedRgb = defined_default(result.RGB) ? result.RGB.array : void 0;
  102063. const decodedRgba = defined_default(result.RGBA) ? result.RGBA.array : void 0;
  102064. const decodedNormals = defined_default(result.NORMAL) ? result.NORMAL.array : void 0;
  102065. const decodedBatchIds = defined_default(result.BATCH_ID) ? result.BATCH_ID.array : void 0;
  102066. const isQuantizedDraco = defined_default(decodedPositions) && defined_default(result.POSITION.data.quantization);
  102067. const isOctEncodedDraco = defined_default(decodedNormals) && defined_default(result.NORMAL.data.quantization);
  102068. if (isQuantizedDraco) {
  102069. const quantization = result.POSITION.data.quantization;
  102070. const range2 = quantization.range;
  102071. pointCloud._quantizedVolumeScale = Cartesian3_default.fromElements(
  102072. range2,
  102073. range2,
  102074. range2
  102075. );
  102076. pointCloud._quantizedVolumeOffset = Cartesian3_default.unpack(
  102077. quantization.minValues
  102078. );
  102079. pointCloud._quantizedRange = (1 << quantization.quantizationBits) - 1;
  102080. pointCloud._isQuantizedDraco = true;
  102081. }
  102082. if (isOctEncodedDraco) {
  102083. pointCloud._octEncodedRange = (1 << result.NORMAL.data.quantization.quantizationBits) - 1;
  102084. pointCloud._isOctEncodedDraco = true;
  102085. }
  102086. let styleableProperties = parsedContent.styleableProperties;
  102087. const batchTableProperties = draco.batchTableProperties;
  102088. for (const name in batchTableProperties) {
  102089. if (batchTableProperties.hasOwnProperty(name)) {
  102090. const property = result[name];
  102091. if (!defined_default(styleableProperties)) {
  102092. styleableProperties = {};
  102093. }
  102094. styleableProperties[name] = {
  102095. typedArray: property.array,
  102096. componentCount: property.data.componentsPerAttribute
  102097. };
  102098. }
  102099. }
  102100. if (defined_default(decodedPositions)) {
  102101. parsedContent.positions = {
  102102. typedArray: decodedPositions
  102103. };
  102104. }
  102105. const decodedColors = defaultValue_default(decodedRgba, decodedRgb);
  102106. if (defined_default(decodedColors)) {
  102107. parsedContent.colors = {
  102108. typedArray: decodedColors
  102109. };
  102110. }
  102111. if (defined_default(decodedNormals)) {
  102112. parsedContent.normals = {
  102113. typedArray: decodedNormals
  102114. };
  102115. }
  102116. if (defined_default(decodedBatchIds)) {
  102117. parsedContent.batchIds = {
  102118. typedArray: decodedBatchIds
  102119. };
  102120. }
  102121. parsedContent.styleableProperties = styleableProperties;
  102122. }).catch(function(error) {
  102123. pointCloud._decodingState = DecodingState.FAILED;
  102124. pointCloud._readyPromise.reject(error);
  102125. });
  102126. }
  102127. }
  102128. return true;
  102129. }
  102130. var scratchComputedTranslation3 = new Cartesian4_default();
  102131. var scratchScale3 = new Cartesian3_default();
  102132. PointCloud.prototype.update = function(frameState) {
  102133. const context = frameState.context;
  102134. const decoding = decodeDraco(this, context);
  102135. if (decoding) {
  102136. return;
  102137. }
  102138. let shadersDirty = false;
  102139. let modelMatrixDirty = !Matrix4_default.equals(this._modelMatrix, this.modelMatrix);
  102140. if (this._mode !== frameState.mode) {
  102141. this._mode = frameState.mode;
  102142. modelMatrixDirty = true;
  102143. }
  102144. if (!defined_default(this._drawCommand)) {
  102145. createResources3(this, frameState);
  102146. modelMatrixDirty = true;
  102147. shadersDirty = true;
  102148. this._ready = true;
  102149. this._readyPromise.resolve(this);
  102150. this._parsedContent = void 0;
  102151. }
  102152. if (modelMatrixDirty) {
  102153. Matrix4_default.clone(this.modelMatrix, this._modelMatrix);
  102154. const modelMatrix = this._drawCommand.modelMatrix;
  102155. Matrix4_default.clone(this._modelMatrix, modelMatrix);
  102156. if (defined_default(this._rtcCenter)) {
  102157. Matrix4_default.multiplyByTranslation(modelMatrix, this._rtcCenter, modelMatrix);
  102158. }
  102159. if (defined_default(this._quantizedVolumeOffset)) {
  102160. Matrix4_default.multiplyByTranslation(
  102161. modelMatrix,
  102162. this._quantizedVolumeOffset,
  102163. modelMatrix
  102164. );
  102165. }
  102166. if (frameState.mode !== SceneMode_default.SCENE3D) {
  102167. const projection = frameState.mapProjection;
  102168. const translation3 = Matrix4_default.getColumn(
  102169. modelMatrix,
  102170. 3,
  102171. scratchComputedTranslation3
  102172. );
  102173. if (!Cartesian4_default.equals(translation3, Cartesian4_default.UNIT_W)) {
  102174. Transforms_default.basisTo2D(projection, modelMatrix, modelMatrix);
  102175. }
  102176. }
  102177. const boundingSphere = this._drawCommand.boundingVolume;
  102178. BoundingSphere_default.clone(this._boundingSphere, boundingSphere);
  102179. if (this._cull) {
  102180. const center = boundingSphere.center;
  102181. Matrix4_default.multiplyByPoint(modelMatrix, center, center);
  102182. const scale = Matrix4_default.getScale(modelMatrix, scratchScale3);
  102183. boundingSphere.radius *= Cartesian3_default.maximumComponent(scale);
  102184. }
  102185. }
  102186. if (this.clippingPlanesDirty) {
  102187. this.clippingPlanesDirty = false;
  102188. shadersDirty = true;
  102189. }
  102190. if (this._attenuation !== this.attenuation) {
  102191. this._attenuation = this.attenuation;
  102192. shadersDirty = true;
  102193. }
  102194. if (this.backFaceCulling !== this._backFaceCulling) {
  102195. this._backFaceCulling = this.backFaceCulling;
  102196. shadersDirty = true;
  102197. }
  102198. if (this.normalShading !== this._normalShading) {
  102199. this._normalShading = this.normalShading;
  102200. shadersDirty = true;
  102201. }
  102202. if (this._style !== this.style || this.styleDirty) {
  102203. this._style = this.style;
  102204. this.styleDirty = false;
  102205. shadersDirty = true;
  102206. }
  102207. const splittingEnabled = this.splitDirection !== SplitDirection_default.NONE;
  102208. if (this._splittingEnabled !== splittingEnabled) {
  102209. this._splittingEnabled = splittingEnabled;
  102210. shadersDirty = true;
  102211. }
  102212. if (shadersDirty) {
  102213. createShaders2(this, frameState, this._style);
  102214. }
  102215. this._drawCommand.castShadows = ShadowMode_default.castShadows(this.shadows);
  102216. this._drawCommand.receiveShadows = ShadowMode_default.receiveShadows(this.shadows);
  102217. const isTranslucent2 = this._highlightColor.alpha < 1 || this._constantColor.alpha < 1 || this._styleTranslucent;
  102218. this._drawCommand.renderState = isTranslucent2 ? this._translucentRenderState : this._opaqueRenderState;
  102219. this._drawCommand.pass = isTranslucent2 ? Pass_default.TRANSLUCENT : this._opaquePass;
  102220. const commandList = frameState.commandList;
  102221. const passes = frameState.passes;
  102222. if (passes.render || passes.pick) {
  102223. commandList.push(this._drawCommand);
  102224. }
  102225. };
  102226. PointCloud.prototype.isDestroyed = function() {
  102227. return false;
  102228. };
  102229. PointCloud.prototype.destroy = function() {
  102230. const command = this._drawCommand;
  102231. if (defined_default(command)) {
  102232. command.vertexArray = command.vertexArray && command.vertexArray.destroy();
  102233. command.shaderProgram = command.shaderProgram && command.shaderProgram.destroy();
  102234. }
  102235. return destroyObject_default(this);
  102236. };
  102237. var PointCloud_default = PointCloud;
  102238. // node_modules/cesium/Source/Renderer/Framebuffer.js
  102239. function attachTexture(framebuffer, attachment, texture) {
  102240. const gl = framebuffer._gl;
  102241. gl.framebufferTexture2D(
  102242. gl.FRAMEBUFFER,
  102243. attachment,
  102244. texture._target,
  102245. texture._texture,
  102246. 0
  102247. );
  102248. }
  102249. function attachRenderbuffer(framebuffer, attachment, renderbuffer) {
  102250. const gl = framebuffer._gl;
  102251. gl.framebufferRenderbuffer(
  102252. gl.FRAMEBUFFER,
  102253. attachment,
  102254. gl.RENDERBUFFER,
  102255. renderbuffer._getRenderbuffer()
  102256. );
  102257. }
  102258. function Framebuffer(options) {
  102259. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  102260. const context = options.context;
  102261. Check_default.defined("options.context", context);
  102262. const gl = context._gl;
  102263. const maximumColorAttachments = ContextLimits_default.maximumColorAttachments;
  102264. this._gl = gl;
  102265. this._framebuffer = gl.createFramebuffer();
  102266. this._colorTextures = [];
  102267. this._colorRenderbuffers = [];
  102268. this._activeColorAttachments = [];
  102269. this._depthTexture = void 0;
  102270. this._depthRenderbuffer = void 0;
  102271. this._stencilRenderbuffer = void 0;
  102272. this._depthStencilTexture = void 0;
  102273. this._depthStencilRenderbuffer = void 0;
  102274. this.destroyAttachments = defaultValue_default(options.destroyAttachments, true);
  102275. if (defined_default(options.colorTextures) && defined_default(options.colorRenderbuffers)) {
  102276. throw new DeveloperError_default(
  102277. "Cannot have both color texture and color renderbuffer attachments."
  102278. );
  102279. }
  102280. if (defined_default(options.depthTexture) && defined_default(options.depthRenderbuffer)) {
  102281. throw new DeveloperError_default(
  102282. "Cannot have both a depth texture and depth renderbuffer attachment."
  102283. );
  102284. }
  102285. if (defined_default(options.depthStencilTexture) && defined_default(options.depthStencilRenderbuffer)) {
  102286. throw new DeveloperError_default(
  102287. "Cannot have both a depth-stencil texture and depth-stencil renderbuffer attachment."
  102288. );
  102289. }
  102290. const depthAttachment = defined_default(options.depthTexture) || defined_default(options.depthRenderbuffer);
  102291. const depthStencilAttachment = defined_default(options.depthStencilTexture) || defined_default(options.depthStencilRenderbuffer);
  102292. if (depthAttachment && depthStencilAttachment) {
  102293. throw new DeveloperError_default(
  102294. "Cannot have both a depth and depth-stencil attachment."
  102295. );
  102296. }
  102297. if (defined_default(options.stencilRenderbuffer) && depthStencilAttachment) {
  102298. throw new DeveloperError_default(
  102299. "Cannot have both a stencil and depth-stencil attachment."
  102300. );
  102301. }
  102302. if (depthAttachment && defined_default(options.stencilRenderbuffer)) {
  102303. throw new DeveloperError_default(
  102304. "Cannot have both a depth and stencil attachment."
  102305. );
  102306. }
  102307. this._bind();
  102308. let texture;
  102309. let renderbuffer;
  102310. let i2;
  102311. let length3;
  102312. let attachmentEnum;
  102313. if (defined_default(options.colorTextures)) {
  102314. const textures = options.colorTextures;
  102315. length3 = this._colorTextures.length = this._activeColorAttachments.length = textures.length;
  102316. if (length3 > maximumColorAttachments) {
  102317. throw new DeveloperError_default(
  102318. "The number of color attachments exceeds the number supported."
  102319. );
  102320. }
  102321. for (i2 = 0; i2 < length3; ++i2) {
  102322. texture = textures[i2];
  102323. if (!PixelFormat_default.isColorFormat(texture.pixelFormat)) {
  102324. throw new DeveloperError_default(
  102325. "The color-texture pixel-format must be a color format."
  102326. );
  102327. }
  102328. if (texture.pixelDatatype === PixelDatatype_default.FLOAT && !context.colorBufferFloat) {
  102329. throw new DeveloperError_default(
  102330. "The color texture pixel datatype is FLOAT and the WebGL implementation does not support the EXT_color_buffer_float or WEBGL_color_buffer_float extensions. See Context.colorBufferFloat."
  102331. );
  102332. }
  102333. if (texture.pixelDatatype === PixelDatatype_default.HALF_FLOAT && !context.colorBufferHalfFloat) {
  102334. throw new DeveloperError_default(
  102335. "The color texture pixel datatype is HALF_FLOAT and the WebGL implementation does not support the EXT_color_buffer_half_float extension. See Context.colorBufferHalfFloat."
  102336. );
  102337. }
  102338. attachmentEnum = this._gl.COLOR_ATTACHMENT0 + i2;
  102339. attachTexture(this, attachmentEnum, texture);
  102340. this._activeColorAttachments[i2] = attachmentEnum;
  102341. this._colorTextures[i2] = texture;
  102342. }
  102343. }
  102344. if (defined_default(options.colorRenderbuffers)) {
  102345. const renderbuffers = options.colorRenderbuffers;
  102346. length3 = this._colorRenderbuffers.length = this._activeColorAttachments.length = renderbuffers.length;
  102347. if (length3 > maximumColorAttachments) {
  102348. throw new DeveloperError_default(
  102349. "The number of color attachments exceeds the number supported."
  102350. );
  102351. }
  102352. for (i2 = 0; i2 < length3; ++i2) {
  102353. renderbuffer = renderbuffers[i2];
  102354. attachmentEnum = this._gl.COLOR_ATTACHMENT0 + i2;
  102355. attachRenderbuffer(this, attachmentEnum, renderbuffer);
  102356. this._activeColorAttachments[i2] = attachmentEnum;
  102357. this._colorRenderbuffers[i2] = renderbuffer;
  102358. }
  102359. }
  102360. if (defined_default(options.depthTexture)) {
  102361. texture = options.depthTexture;
  102362. if (texture.pixelFormat !== PixelFormat_default.DEPTH_COMPONENT) {
  102363. throw new DeveloperError_default(
  102364. "The depth-texture pixel-format must be DEPTH_COMPONENT."
  102365. );
  102366. }
  102367. attachTexture(this, this._gl.DEPTH_ATTACHMENT, texture);
  102368. this._depthTexture = texture;
  102369. }
  102370. if (defined_default(options.depthRenderbuffer)) {
  102371. renderbuffer = options.depthRenderbuffer;
  102372. attachRenderbuffer(this, this._gl.DEPTH_ATTACHMENT, renderbuffer);
  102373. this._depthRenderbuffer = renderbuffer;
  102374. }
  102375. if (defined_default(options.stencilRenderbuffer)) {
  102376. renderbuffer = options.stencilRenderbuffer;
  102377. attachRenderbuffer(this, this._gl.STENCIL_ATTACHMENT, renderbuffer);
  102378. this._stencilRenderbuffer = renderbuffer;
  102379. }
  102380. if (defined_default(options.depthStencilTexture)) {
  102381. texture = options.depthStencilTexture;
  102382. if (texture.pixelFormat !== PixelFormat_default.DEPTH_STENCIL) {
  102383. throw new DeveloperError_default(
  102384. "The depth-stencil pixel-format must be DEPTH_STENCIL."
  102385. );
  102386. }
  102387. attachTexture(this, this._gl.DEPTH_STENCIL_ATTACHMENT, texture);
  102388. this._depthStencilTexture = texture;
  102389. }
  102390. if (defined_default(options.depthStencilRenderbuffer)) {
  102391. renderbuffer = options.depthStencilRenderbuffer;
  102392. attachRenderbuffer(this, this._gl.DEPTH_STENCIL_ATTACHMENT, renderbuffer);
  102393. this._depthStencilRenderbuffer = renderbuffer;
  102394. }
  102395. this._unBind();
  102396. }
  102397. Object.defineProperties(Framebuffer.prototype, {
  102398. status: {
  102399. get: function() {
  102400. this._bind();
  102401. const status = this._gl.checkFramebufferStatus(this._gl.FRAMEBUFFER);
  102402. this._unBind();
  102403. return status;
  102404. }
  102405. },
  102406. numberOfColorAttachments: {
  102407. get: function() {
  102408. return this._activeColorAttachments.length;
  102409. }
  102410. },
  102411. depthTexture: {
  102412. get: function() {
  102413. return this._depthTexture;
  102414. }
  102415. },
  102416. depthRenderbuffer: {
  102417. get: function() {
  102418. return this._depthRenderbuffer;
  102419. }
  102420. },
  102421. stencilRenderbuffer: {
  102422. get: function() {
  102423. return this._stencilRenderbuffer;
  102424. }
  102425. },
  102426. depthStencilTexture: {
  102427. get: function() {
  102428. return this._depthStencilTexture;
  102429. }
  102430. },
  102431. depthStencilRenderbuffer: {
  102432. get: function() {
  102433. return this._depthStencilRenderbuffer;
  102434. }
  102435. },
  102436. hasDepthAttachment: {
  102437. get: function() {
  102438. return !!(this.depthTexture || this.depthRenderbuffer || this.depthStencilTexture || this.depthStencilRenderbuffer);
  102439. }
  102440. }
  102441. });
  102442. Framebuffer.prototype._bind = function() {
  102443. const gl = this._gl;
  102444. gl.bindFramebuffer(gl.FRAMEBUFFER, this._framebuffer);
  102445. };
  102446. Framebuffer.prototype._unBind = function() {
  102447. const gl = this._gl;
  102448. gl.bindFramebuffer(gl.FRAMEBUFFER, null);
  102449. };
  102450. Framebuffer.prototype.bindDraw = function() {
  102451. const gl = this._gl;
  102452. gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, this._framebuffer);
  102453. };
  102454. Framebuffer.prototype.bindRead = function() {
  102455. const gl = this._gl;
  102456. gl.bindFramebuffer(gl.READ_FRAMEBUFFER, this._framebuffer);
  102457. };
  102458. Framebuffer.prototype._getActiveColorAttachments = function() {
  102459. return this._activeColorAttachments;
  102460. };
  102461. Framebuffer.prototype.getColorTexture = function(index2) {
  102462. if (!defined_default(index2) || index2 < 0 || index2 >= this._colorTextures.length) {
  102463. throw new DeveloperError_default(
  102464. "index is required, must be greater than or equal to zero and must be less than the number of color attachments."
  102465. );
  102466. }
  102467. return this._colorTextures[index2];
  102468. };
  102469. Framebuffer.prototype.getColorRenderbuffer = function(index2) {
  102470. if (!defined_default(index2) || index2 < 0 || index2 >= this._colorRenderbuffers.length) {
  102471. throw new DeveloperError_default(
  102472. "index is required, must be greater than or equal to zero and must be less than the number of color attachments."
  102473. );
  102474. }
  102475. return this._colorRenderbuffers[index2];
  102476. };
  102477. Framebuffer.prototype.isDestroyed = function() {
  102478. return false;
  102479. };
  102480. Framebuffer.prototype.destroy = function() {
  102481. if (this.destroyAttachments) {
  102482. let i2 = 0;
  102483. const textures = this._colorTextures;
  102484. let length3 = textures.length;
  102485. for (; i2 < length3; ++i2) {
  102486. const texture = textures[i2];
  102487. if (defined_default(texture)) {
  102488. texture.destroy();
  102489. }
  102490. }
  102491. const renderbuffers = this._colorRenderbuffers;
  102492. length3 = renderbuffers.length;
  102493. for (i2 = 0; i2 < length3; ++i2) {
  102494. const renderbuffer = renderbuffers[i2];
  102495. if (defined_default(renderbuffer)) {
  102496. renderbuffer.destroy();
  102497. }
  102498. }
  102499. this._depthTexture = this._depthTexture && this._depthTexture.destroy();
  102500. this._depthRenderbuffer = this._depthRenderbuffer && this._depthRenderbuffer.destroy();
  102501. this._stencilRenderbuffer = this._stencilRenderbuffer && this._stencilRenderbuffer.destroy();
  102502. this._depthStencilTexture = this._depthStencilTexture && this._depthStencilTexture.destroy();
  102503. this._depthStencilRenderbuffer = this._depthStencilRenderbuffer && this._depthStencilRenderbuffer.destroy();
  102504. }
  102505. this._gl.deleteFramebuffer(this._framebuffer);
  102506. return destroyObject_default(this);
  102507. };
  102508. var Framebuffer_default = Framebuffer;
  102509. // node_modules/cesium/Source/Renderer/MultisampleFramebuffer.js
  102510. function MultisampleFramebuffer(options) {
  102511. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  102512. const context = options.context;
  102513. const width = options.width;
  102514. const height = options.height;
  102515. Check_default.defined("options.context", context);
  102516. Check_default.defined("options.width", width);
  102517. Check_default.defined("options.height", height);
  102518. this._width = width;
  102519. this._height = height;
  102520. const colorRenderbuffers = options.colorRenderbuffers;
  102521. const colorTextures = options.colorTextures;
  102522. if (defined_default(colorRenderbuffers) !== defined_default(colorTextures)) {
  102523. throw new DeveloperError_default(
  102524. "Both color renderbuffer and texture attachments must be provided."
  102525. );
  102526. }
  102527. const depthStencilRenderbuffer = options.depthStencilRenderbuffer;
  102528. const depthStencilTexture = options.depthStencilTexture;
  102529. if (defined_default(depthStencilRenderbuffer) !== defined_default(depthStencilTexture)) {
  102530. throw new DeveloperError_default(
  102531. "Both depth-stencil renderbuffer and texture attachments must be provided."
  102532. );
  102533. }
  102534. this._renderFramebuffer = new Framebuffer_default({
  102535. context,
  102536. colorRenderbuffers,
  102537. depthStencilRenderbuffer,
  102538. destroyAttachments: options.destroyAttachments
  102539. });
  102540. this._colorFramebuffer = new Framebuffer_default({
  102541. context,
  102542. colorTextures,
  102543. depthStencilTexture,
  102544. destroyAttachments: options.destroyAttachments
  102545. });
  102546. }
  102547. MultisampleFramebuffer.prototype.getRenderFramebuffer = function() {
  102548. return this._renderFramebuffer;
  102549. };
  102550. MultisampleFramebuffer.prototype.getColorFramebuffer = function() {
  102551. return this._colorFramebuffer;
  102552. };
  102553. MultisampleFramebuffer.prototype.blitFramebuffers = function(context, blitStencil) {
  102554. this._renderFramebuffer.bindRead();
  102555. this._colorFramebuffer.bindDraw();
  102556. const gl = context._gl;
  102557. let mask = 0;
  102558. if (this._colorFramebuffer._colorTextures.length > 0) {
  102559. mask |= gl.COLOR_BUFFER_BIT;
  102560. }
  102561. if (defined_default(this._colorFramebuffer.depthStencilTexture)) {
  102562. mask |= gl.DEPTH_BUFFER_BIT | (blitStencil ? gl.STENCIL_BUFFER_BIT : 0);
  102563. }
  102564. gl.blitFramebuffer(
  102565. 0,
  102566. 0,
  102567. this._width,
  102568. this._height,
  102569. 0,
  102570. 0,
  102571. this._width,
  102572. this._height,
  102573. mask,
  102574. gl.NEAREST
  102575. );
  102576. gl.bindFramebuffer(gl.READ_FRAMEBUFFER, null);
  102577. gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, null);
  102578. };
  102579. MultisampleFramebuffer.prototype.isDestroyed = function() {
  102580. return false;
  102581. };
  102582. MultisampleFramebuffer.prototype.destroy = function() {
  102583. this._renderFramebuffer.destroy();
  102584. this._colorFramebuffer.destroy();
  102585. return destroyObject_default(this);
  102586. };
  102587. var MultisampleFramebuffer_default = MultisampleFramebuffer;
  102588. // node_modules/cesium/Source/Renderer/RenderbufferFormat.js
  102589. var RenderbufferFormat = {
  102590. RGBA4: WebGLConstants_default.RGBA4,
  102591. RGBA8: WebGLConstants_default.RGBA8,
  102592. RGBA16F: WebGLConstants_default.RGBA16F,
  102593. RGBA32F: WebGLConstants_default.RGBA32F,
  102594. RGB5_A1: WebGLConstants_default.RGB5_A1,
  102595. RGB565: WebGLConstants_default.RGB565,
  102596. DEPTH_COMPONENT16: WebGLConstants_default.DEPTH_COMPONENT16,
  102597. STENCIL_INDEX8: WebGLConstants_default.STENCIL_INDEX8,
  102598. DEPTH_STENCIL: WebGLConstants_default.DEPTH_STENCIL,
  102599. DEPTH24_STENCIL8: WebGLConstants_default.DEPTH24_STENCIL8,
  102600. validate: function(renderbufferFormat) {
  102601. return renderbufferFormat === RenderbufferFormat.RGBA4 || renderbufferFormat === RenderbufferFormat.RGBA8 || renderbufferFormat === RenderbufferFormat.RGBA16F || renderbufferFormat === RenderbufferFormat.RGBA32F || renderbufferFormat === RenderbufferFormat.RGB5_A1 || renderbufferFormat === RenderbufferFormat.RGB565 || renderbufferFormat === RenderbufferFormat.DEPTH_COMPONENT16 || renderbufferFormat === RenderbufferFormat.STENCIL_INDEX8 || renderbufferFormat === RenderbufferFormat.DEPTH_STENCIL || renderbufferFormat === RenderbufferFormat.DEPTH24_STENCIL8;
  102602. },
  102603. getColorFormat: function(datatype) {
  102604. if (datatype === WebGLConstants_default.FLOAT) {
  102605. return RenderbufferFormat.RGBA32F;
  102606. } else if (datatype === WebGLConstants_default.HALF_FLOAT_OES) {
  102607. return RenderbufferFormat.RGBA16F;
  102608. }
  102609. return RenderbufferFormat.RGBA8;
  102610. }
  102611. };
  102612. var RenderbufferFormat_default = Object.freeze(RenderbufferFormat);
  102613. // node_modules/cesium/Source/Renderer/Renderbuffer.js
  102614. function Renderbuffer(options) {
  102615. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  102616. Check_default.defined("options.context", options.context);
  102617. const context = options.context;
  102618. const gl = context._gl;
  102619. const maximumRenderbufferSize = ContextLimits_default.maximumRenderbufferSize;
  102620. const format = defaultValue_default(options.format, RenderbufferFormat_default.RGBA4);
  102621. const width = defined_default(options.width) ? options.width : gl.drawingBufferWidth;
  102622. const height = defined_default(options.height) ? options.height : gl.drawingBufferHeight;
  102623. const numSamples = defaultValue_default(options.numSamples, 1);
  102624. if (!RenderbufferFormat_default.validate(format)) {
  102625. throw new DeveloperError_default("Invalid format.");
  102626. }
  102627. Check_default.typeOf.number.greaterThan("width", width, 0);
  102628. if (width > maximumRenderbufferSize) {
  102629. throw new DeveloperError_default(
  102630. `Width must be less than or equal to the maximum renderbuffer size (${maximumRenderbufferSize}). Check maximumRenderbufferSize.`
  102631. );
  102632. }
  102633. Check_default.typeOf.number.greaterThan("height", height, 0);
  102634. if (height > maximumRenderbufferSize) {
  102635. throw new DeveloperError_default(
  102636. `Height must be less than or equal to the maximum renderbuffer size (${maximumRenderbufferSize}). Check maximumRenderbufferSize.`
  102637. );
  102638. }
  102639. this._gl = gl;
  102640. this._format = format;
  102641. this._width = width;
  102642. this._height = height;
  102643. this._renderbuffer = this._gl.createRenderbuffer();
  102644. gl.bindRenderbuffer(gl.RENDERBUFFER, this._renderbuffer);
  102645. if (numSamples > 1) {
  102646. gl.renderbufferStorageMultisample(
  102647. gl.RENDERBUFFER,
  102648. numSamples,
  102649. format,
  102650. width,
  102651. height
  102652. );
  102653. } else {
  102654. gl.renderbufferStorage(gl.RENDERBUFFER, format, width, height);
  102655. }
  102656. gl.bindRenderbuffer(gl.RENDERBUFFER, null);
  102657. }
  102658. Object.defineProperties(Renderbuffer.prototype, {
  102659. format: {
  102660. get: function() {
  102661. return this._format;
  102662. }
  102663. },
  102664. width: {
  102665. get: function() {
  102666. return this._width;
  102667. }
  102668. },
  102669. height: {
  102670. get: function() {
  102671. return this._height;
  102672. }
  102673. }
  102674. });
  102675. Renderbuffer.prototype._getRenderbuffer = function() {
  102676. return this._renderbuffer;
  102677. };
  102678. Renderbuffer.prototype.isDestroyed = function() {
  102679. return false;
  102680. };
  102681. Renderbuffer.prototype.destroy = function() {
  102682. this._gl.deleteRenderbuffer(this._renderbuffer);
  102683. return destroyObject_default(this);
  102684. };
  102685. var Renderbuffer_default = Renderbuffer;
  102686. // node_modules/cesium/Source/Renderer/FramebufferManager.js
  102687. function FramebufferManager(options) {
  102688. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  102689. this._numSamples = defaultValue_default(options.numSamples, 1);
  102690. this._colorAttachmentsLength = defaultValue_default(
  102691. options.colorAttachmentsLength,
  102692. 1
  102693. );
  102694. this._color = defaultValue_default(options.color, true);
  102695. this._depth = defaultValue_default(options.depth, false);
  102696. this._depthStencil = defaultValue_default(options.depthStencil, false);
  102697. this._supportsDepthTexture = defaultValue_default(
  102698. options.supportsDepthTexture,
  102699. false
  102700. );
  102701. if (!this._color && !this._depth && !this._depthStencil) {
  102702. throw new DeveloperError_default(
  102703. "Must enable at least one type of framebuffer attachment."
  102704. );
  102705. }
  102706. if (this._depth && this._depthStencil) {
  102707. throw new DeveloperError_default(
  102708. "Cannot have both a depth and depth-stencil attachment."
  102709. );
  102710. }
  102711. this._createColorAttachments = defaultValue_default(
  102712. options.createColorAttachments,
  102713. true
  102714. );
  102715. this._createDepthAttachments = defaultValue_default(
  102716. options.createDepthAttachments,
  102717. true
  102718. );
  102719. this._pixelDatatype = options.pixelDatatype;
  102720. this._pixelFormat = options.pixelFormat;
  102721. this._width = void 0;
  102722. this._height = void 0;
  102723. this._framebuffer = void 0;
  102724. this._multisampleFramebuffer = void 0;
  102725. this._colorTextures = void 0;
  102726. if (this._color) {
  102727. this._colorTextures = new Array(this._colorAttachmentsLength);
  102728. this._colorRenderbuffers = new Array(this._colorAttachmentsLength);
  102729. }
  102730. this._colorRenderbuffer = void 0;
  102731. this._depthStencilRenderbuffer = void 0;
  102732. this._depthStencilTexture = void 0;
  102733. this._depthRenderbuffer = void 0;
  102734. this._depthTexture = void 0;
  102735. this._attachmentsDirty = false;
  102736. }
  102737. Object.defineProperties(FramebufferManager.prototype, {
  102738. framebuffer: {
  102739. get: function() {
  102740. if (this._numSamples > 1) {
  102741. return this._multisampleFramebuffer.getRenderFramebuffer();
  102742. }
  102743. return this._framebuffer;
  102744. }
  102745. },
  102746. numSamples: {
  102747. get: function() {
  102748. return this._numSamples;
  102749. }
  102750. },
  102751. status: {
  102752. get: function() {
  102753. return this.framebuffer.status;
  102754. }
  102755. }
  102756. });
  102757. FramebufferManager.prototype.isDirty = function(width, height, numSamples, pixelDatatype, pixelFormat) {
  102758. numSamples = defaultValue_default(numSamples, 1);
  102759. const dimensionChanged = this._width !== width || this._height !== height;
  102760. const samplesChanged = this._numSamples !== numSamples;
  102761. const pixelChanged = defined_default(pixelDatatype) && this._pixelDatatype !== pixelDatatype || defined_default(pixelFormat) && this._pixelFormat !== pixelFormat;
  102762. const framebufferDefined = numSamples === 1 ? defined_default(this._framebuffer) : defined_default(this._multisampleFramebuffer);
  102763. return this._attachmentsDirty || dimensionChanged || samplesChanged || pixelChanged || !framebufferDefined || this._color && !defined_default(this._colorTextures[0]);
  102764. };
  102765. FramebufferManager.prototype.update = function(context, width, height, numSamples, pixelDatatype, pixelFormat) {
  102766. if (!defined_default(width) || !defined_default(height)) {
  102767. throw new DeveloperError_default("width and height must be defined.");
  102768. }
  102769. numSamples = context.msaa ? defaultValue_default(numSamples, 1) : 1;
  102770. pixelDatatype = defaultValue_default(
  102771. pixelDatatype,
  102772. this._color ? defaultValue_default(this._pixelDatatype, PixelDatatype_default.UNSIGNED_BYTE) : void 0
  102773. );
  102774. pixelFormat = defaultValue_default(
  102775. pixelFormat,
  102776. this._color ? defaultValue_default(this._pixelFormat, PixelFormat_default.RGBA) : void 0
  102777. );
  102778. if (this.isDirty(width, height, numSamples, pixelDatatype, pixelFormat)) {
  102779. this.destroy();
  102780. this._width = width;
  102781. this._height = height;
  102782. this._numSamples = numSamples;
  102783. this._pixelDatatype = pixelDatatype;
  102784. this._pixelFormat = pixelFormat;
  102785. this._attachmentsDirty = false;
  102786. if (this._color && this._createColorAttachments) {
  102787. for (let i2 = 0; i2 < this._colorAttachmentsLength; ++i2) {
  102788. this._colorTextures[i2] = new Texture_default({
  102789. context,
  102790. width,
  102791. height,
  102792. pixelFormat,
  102793. pixelDatatype,
  102794. sampler: Sampler_default.NEAREST
  102795. });
  102796. if (this._numSamples > 1) {
  102797. const format = RenderbufferFormat_default.getColorFormat(pixelDatatype);
  102798. this._colorRenderbuffers[i2] = new Renderbuffer_default({
  102799. context,
  102800. width,
  102801. height,
  102802. format,
  102803. numSamples: this._numSamples
  102804. });
  102805. }
  102806. }
  102807. }
  102808. if (this._depthStencil && this._createDepthAttachments) {
  102809. if (this._supportsDepthTexture && context.depthTexture) {
  102810. this._depthStencilTexture = new Texture_default({
  102811. context,
  102812. width,
  102813. height,
  102814. pixelFormat: PixelFormat_default.DEPTH_STENCIL,
  102815. pixelDatatype: PixelDatatype_default.UNSIGNED_INT_24_8,
  102816. sampler: Sampler_default.NEAREST
  102817. });
  102818. if (this._numSamples > 1) {
  102819. this._depthStencilRenderbuffer = new Renderbuffer_default({
  102820. context,
  102821. width,
  102822. height,
  102823. format: RenderbufferFormat_default.DEPTH24_STENCIL8,
  102824. numSamples: this._numSamples
  102825. });
  102826. }
  102827. } else {
  102828. this._depthStencilRenderbuffer = new Renderbuffer_default({
  102829. context,
  102830. width,
  102831. height,
  102832. format: RenderbufferFormat_default.DEPTH_STENCIL
  102833. });
  102834. }
  102835. }
  102836. if (this._depth && this._createDepthAttachments) {
  102837. if (this._supportsDepthTexture && context.depthTexture) {
  102838. this._depthTexture = new Texture_default({
  102839. context,
  102840. width,
  102841. height,
  102842. pixelFormat: PixelFormat_default.DEPTH_COMPONENT,
  102843. pixelDatatype: PixelDatatype_default.UNSIGNED_INT,
  102844. sampler: Sampler_default.NEAREST
  102845. });
  102846. } else {
  102847. this._depthRenderbuffer = new Renderbuffer_default({
  102848. context,
  102849. width,
  102850. height,
  102851. format: RenderbufferFormat_default.DEPTH_COMPONENT16
  102852. });
  102853. }
  102854. }
  102855. if (this._numSamples > 1) {
  102856. this._multisampleFramebuffer = new MultisampleFramebuffer_default({
  102857. context,
  102858. width: this._width,
  102859. height: this._height,
  102860. colorTextures: this._colorTextures,
  102861. colorRenderbuffers: this._colorRenderbuffers,
  102862. depthStencilTexture: this._depthStencilTexture,
  102863. depthStencilRenderbuffer: this._depthStencilRenderbuffer,
  102864. destroyAttachments: false
  102865. });
  102866. } else {
  102867. this._framebuffer = new Framebuffer_default({
  102868. context,
  102869. colorTextures: this._colorTextures,
  102870. depthTexture: this._depthTexture,
  102871. depthRenderbuffer: this._depthRenderbuffer,
  102872. depthStencilTexture: this._depthStencilTexture,
  102873. depthStencilRenderbuffer: this._depthStencilRenderbuffer,
  102874. destroyAttachments: false
  102875. });
  102876. }
  102877. }
  102878. };
  102879. FramebufferManager.prototype.getColorTexture = function(index2) {
  102880. index2 = defaultValue_default(index2, 0);
  102881. if (index2 >= this._colorAttachmentsLength) {
  102882. throw new DeveloperError_default(
  102883. "index must be smaller than total number of color attachments."
  102884. );
  102885. }
  102886. return this._colorTextures[index2];
  102887. };
  102888. FramebufferManager.prototype.setColorTexture = function(texture, index2) {
  102889. index2 = defaultValue_default(index2, 0);
  102890. if (this._createColorAttachments) {
  102891. throw new DeveloperError_default(
  102892. "createColorAttachments must be false if setColorTexture is called."
  102893. );
  102894. }
  102895. if (index2 >= this._colorAttachmentsLength) {
  102896. throw new DeveloperError_default(
  102897. "index must be smaller than total number of color attachments."
  102898. );
  102899. }
  102900. this._attachmentsDirty = texture !== this._colorTextures[index2];
  102901. this._colorTextures[index2] = texture;
  102902. };
  102903. FramebufferManager.prototype.getColorRenderbuffer = function(index2) {
  102904. index2 = defaultValue_default(index2, 0);
  102905. if (index2 >= this._colorAttachmentsLength) {
  102906. throw new DeveloperError_default(
  102907. "index must be smaller than total number of color attachments."
  102908. );
  102909. }
  102910. return this._colorRenderbuffers[index2];
  102911. };
  102912. FramebufferManager.prototype.setColorRenderbuffer = function(renderbuffer, index2) {
  102913. index2 = defaultValue_default(index2, 0);
  102914. if (this._createColorAttachments) {
  102915. throw new DeveloperError_default(
  102916. "createColorAttachments must be false if setColorRenderbuffer is called."
  102917. );
  102918. }
  102919. if (index2 >= this._colorAttachmentsLength) {
  102920. throw new DeveloperError_default(
  102921. "index must be smaller than total number of color attachments."
  102922. );
  102923. }
  102924. this._attachmentsDirty = renderbuffer !== this._colorRenderbuffers[index2];
  102925. this._colorRenderbuffers[index2] = renderbuffer;
  102926. };
  102927. FramebufferManager.prototype.getDepthRenderbuffer = function() {
  102928. return this._depthRenderbuffer;
  102929. };
  102930. FramebufferManager.prototype.setDepthRenderbuffer = function(renderbuffer) {
  102931. if (this._createDepthAttachments) {
  102932. throw new DeveloperError_default(
  102933. "createDepthAttachments must be false if setDepthRenderbuffer is called."
  102934. );
  102935. }
  102936. this._attachmentsDirty = renderbuffer !== this._depthRenderbuffer;
  102937. this._depthRenderbuffer = renderbuffer;
  102938. };
  102939. FramebufferManager.prototype.getDepthTexture = function() {
  102940. return this._depthTexture;
  102941. };
  102942. FramebufferManager.prototype.setDepthTexture = function(texture) {
  102943. if (this._createDepthAttachments) {
  102944. throw new DeveloperError_default(
  102945. "createDepthAttachments must be false if setDepthTexture is called."
  102946. );
  102947. }
  102948. this._attachmentsDirty = texture !== this._depthTexture;
  102949. this._depthTexture = texture;
  102950. };
  102951. FramebufferManager.prototype.getDepthStencilRenderbuffer = function() {
  102952. return this._depthStencilRenderbuffer;
  102953. };
  102954. FramebufferManager.prototype.setDepthStencilRenderbuffer = function(renderbuffer) {
  102955. if (this._createDepthAttachments) {
  102956. throw new DeveloperError_default(
  102957. "createDepthAttachments must be false if setDepthStencilRenderbuffer is called."
  102958. );
  102959. }
  102960. this._attachmentsDirty = renderbuffer !== this._depthStencilRenderbuffer;
  102961. this._depthStencilRenderbuffer = renderbuffer;
  102962. };
  102963. FramebufferManager.prototype.getDepthStencilTexture = function() {
  102964. return this._depthStencilTexture;
  102965. };
  102966. FramebufferManager.prototype.setDepthStencilTexture = function(texture) {
  102967. if (this._createDepthAttachments) {
  102968. throw new DeveloperError_default(
  102969. "createDepthAttachments must be false if setDepthStencilTexture is called."
  102970. );
  102971. }
  102972. this._attachmentsDirty = texture !== this._depthStencilTexture;
  102973. this._depthStencilTexture = texture;
  102974. };
  102975. FramebufferManager.prototype.prepareTextures = function(context, blitStencil) {
  102976. if (this._numSamples > 1) {
  102977. this._multisampleFramebuffer.blitFramebuffers(context, blitStencil);
  102978. }
  102979. };
  102980. FramebufferManager.prototype.clear = function(context, clearCommand, passState) {
  102981. const framebuffer = clearCommand.framebuffer;
  102982. clearCommand.framebuffer = this.framebuffer;
  102983. clearCommand.execute(context, passState);
  102984. clearCommand.framebuffer = framebuffer;
  102985. };
  102986. FramebufferManager.prototype.destroyFramebuffer = function() {
  102987. this._framebuffer = this._framebuffer && this._framebuffer.destroy();
  102988. this._multisampleFramebuffer = this._multisampleFramebuffer && this._multisampleFramebuffer.destroy();
  102989. };
  102990. FramebufferManager.prototype.destroy = function() {
  102991. if (this._color) {
  102992. let i2;
  102993. const length3 = this._colorTextures.length;
  102994. for (i2 = 0; i2 < length3; ++i2) {
  102995. const texture = this._colorTextures[i2];
  102996. if (this._createColorAttachments) {
  102997. if (defined_default(texture) && !texture.isDestroyed()) {
  102998. this._colorTextures[i2].destroy();
  102999. this._colorTextures[i2] = void 0;
  103000. }
  103001. }
  103002. if (defined_default(texture) && texture.isDestroyed()) {
  103003. this._colorTextures[i2] = void 0;
  103004. }
  103005. const renderbuffer = this._colorRenderbuffers[i2];
  103006. if (this._createColorAttachments) {
  103007. if (defined_default(renderbuffer) && !renderbuffer.isDestroyed()) {
  103008. this._colorRenderbuffers[i2].destroy();
  103009. this._colorRenderbuffers[i2] = void 0;
  103010. }
  103011. }
  103012. if (defined_default(renderbuffer) && renderbuffer.isDestroyed()) {
  103013. this._colorRenderbuffers[i2] = void 0;
  103014. }
  103015. }
  103016. }
  103017. if (this._depthStencil) {
  103018. if (this._createDepthAttachments) {
  103019. this._depthStencilTexture = this._depthStencilTexture && this._depthStencilTexture.destroy();
  103020. this._depthStencilRenderbuffer = this._depthStencilRenderbuffer && this._depthStencilRenderbuffer.destroy();
  103021. }
  103022. if (defined_default(this._depthStencilTexture) && this._depthStencilTexture.isDestroyed()) {
  103023. this._depthStencilTexture = void 0;
  103024. }
  103025. if (defined_default(this._depthStencilRenderbuffer) && this._depthStencilRenderbuffer.isDestroyed()) {
  103026. this._depthStencilRenderbuffer = void 0;
  103027. }
  103028. }
  103029. if (this._depth) {
  103030. if (this._createDepthAttachments) {
  103031. this._depthTexture = this._depthTexture && this._depthTexture.destroy();
  103032. this._depthRenderbuffer = this._depthRenderbuffer && this._depthRenderbuffer.destroy();
  103033. }
  103034. if (defined_default(this._depthTexture) && this._depthTexture.isDestroyed()) {
  103035. this._depthTexture = void 0;
  103036. }
  103037. if (defined_default(this._depthRenderbuffer) && this._depthRenderbuffer.isDestroyed()) {
  103038. this._depthRenderbuffer = void 0;
  103039. }
  103040. }
  103041. this.destroyFramebuffer();
  103042. };
  103043. var FramebufferManager_default = FramebufferManager;
  103044. // node_modules/cesium/Source/Shaders/PostProcessStages/PointCloudEyeDomeLighting.js
  103045. var PointCloudEyeDomeLighting_default = "#extension GL_EXT_frag_depth : enable\n\nuniform sampler2D u_pointCloud_colorGBuffer;\nuniform sampler2D u_pointCloud_depthGBuffer;\nuniform vec2 u_distanceAndEdlStrength;\nvarying vec2 v_textureCoordinates;\n\nvec2 neighborContribution(float log2Depth, vec2 offset)\n{\n float dist = u_distanceAndEdlStrength.x;\n vec2 texCoordOrig = v_textureCoordinates + offset * dist;\n vec2 texCoord0 = v_textureCoordinates + offset * floor(dist);\n vec2 texCoord1 = v_textureCoordinates + offset * ceil(dist);\n\n float depthOrLogDepth0 = czm_unpackDepth(texture2D(u_pointCloud_depthGBuffer, texCoord0));\n float depthOrLogDepth1 = czm_unpackDepth(texture2D(u_pointCloud_depthGBuffer, texCoord1));\n\n // ignore depth values that are the clear depth\n if (depthOrLogDepth0 == 0.0 || depthOrLogDepth1 == 0.0) {\n return vec2(0.0);\n }\n\n // interpolate the two adjacent depth values\n float depthMix = mix(depthOrLogDepth0, depthOrLogDepth1, fract(dist));\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(texCoordOrig, depthMix);\n return vec2(max(0.0, log2Depth - log2(-eyeCoordinate.z / eyeCoordinate.w)), 1.0);\n}\n\nvoid main()\n{\n float depthOrLogDepth = czm_unpackDepth(texture2D(u_pointCloud_depthGBuffer, v_textureCoordinates));\n\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depthOrLogDepth);\n eyeCoordinate /= eyeCoordinate.w;\n\n float log2Depth = log2(-eyeCoordinate.z);\n\n if (depthOrLogDepth == 0.0) // 0.0 is the clear value for the gbuffer\n {\n discard;\n }\n\n vec4 color = texture2D(u_pointCloud_colorGBuffer, v_textureCoordinates);\n\n // sample from neighbors left, right, down, up\n vec2 texelSize = 1.0 / czm_viewport.zw;\n\n vec2 responseAndCount = vec2(0.0);\n\n responseAndCount += neighborContribution(log2Depth, vec2(-texelSize.x, 0.0));\n responseAndCount += neighborContribution(log2Depth, vec2(+texelSize.x, 0.0));\n responseAndCount += neighborContribution(log2Depth, vec2(0.0, -texelSize.y));\n responseAndCount += neighborContribution(log2Depth, vec2(0.0, +texelSize.y));\n\n float response = responseAndCount.x / responseAndCount.y;\n float strength = u_distanceAndEdlStrength.y;\n float shade = exp(-response * 300.0 * strength);\n color.rgb *= shade;\n gl_FragColor = vec4(color);\n\n // Input and output depth are the same.\n gl_FragDepthEXT = depthOrLogDepth;\n}\n";
  103046. // node_modules/cesium/Source/Scene/PointCloudEyeDomeLighting.js
  103047. function PointCloudEyeDomeLighting() {
  103048. this._framebuffer = new FramebufferManager_default({
  103049. colorAttachmentsLength: 2,
  103050. depth: true,
  103051. supportsDepthTexture: true
  103052. });
  103053. this._drawCommand = void 0;
  103054. this._clearCommand = void 0;
  103055. this._strength = 1;
  103056. this._radius = 1;
  103057. }
  103058. Object.defineProperties(PointCloudEyeDomeLighting.prototype, {
  103059. framebuffer: {
  103060. get: function() {
  103061. return this._framebuffer.framebuffer;
  103062. }
  103063. },
  103064. colorGBuffer: {
  103065. get: function() {
  103066. return this._framebuffer.getColorTexture(0);
  103067. }
  103068. },
  103069. depthGBuffer: {
  103070. get: function() {
  103071. return this._framebuffer.getColorTexture(1);
  103072. }
  103073. }
  103074. });
  103075. function destroyFramebuffer(processor) {
  103076. processor._framebuffer.destroy();
  103077. processor._drawCommand = void 0;
  103078. processor._clearCommand = void 0;
  103079. }
  103080. var distanceAndEdlStrengthScratch = new Cartesian2_default();
  103081. function createCommands5(processor, context) {
  103082. const blendFS = new ShaderSource_default({
  103083. defines: ["LOG_DEPTH_WRITE"],
  103084. sources: [PointCloudEyeDomeLighting_default]
  103085. });
  103086. const blendUniformMap = {
  103087. u_pointCloud_colorGBuffer: function() {
  103088. return processor.colorGBuffer;
  103089. },
  103090. u_pointCloud_depthGBuffer: function() {
  103091. return processor.depthGBuffer;
  103092. },
  103093. u_distanceAndEdlStrength: function() {
  103094. distanceAndEdlStrengthScratch.x = processor._radius;
  103095. distanceAndEdlStrengthScratch.y = processor._strength;
  103096. return distanceAndEdlStrengthScratch;
  103097. }
  103098. };
  103099. const blendRenderState = RenderState_default.fromCache({
  103100. blending: BlendingState_default.ALPHA_BLEND,
  103101. depthMask: true,
  103102. depthTest: {
  103103. enabled: true
  103104. },
  103105. stencilTest: StencilConstants_default.setCesium3DTileBit(),
  103106. stencilMask: StencilConstants_default.CESIUM_3D_TILE_MASK
  103107. });
  103108. processor._drawCommand = context.createViewportQuadCommand(blendFS, {
  103109. uniformMap: blendUniformMap,
  103110. renderState: blendRenderState,
  103111. pass: Pass_default.CESIUM_3D_TILE,
  103112. owner: processor
  103113. });
  103114. processor._clearCommand = new ClearCommand_default({
  103115. framebuffer: processor.framebuffer,
  103116. color: new Color_default(0, 0, 0, 0),
  103117. depth: 1,
  103118. renderState: RenderState_default.fromCache(),
  103119. pass: Pass_default.CESIUM_3D_TILE,
  103120. owner: processor
  103121. });
  103122. }
  103123. function createResources4(processor, context) {
  103124. const width = context.drawingBufferWidth;
  103125. const height = context.drawingBufferHeight;
  103126. processor._framebuffer.update(context, width, height);
  103127. createCommands5(processor, context);
  103128. }
  103129. function isSupported(context) {
  103130. return context.drawBuffers && context.fragmentDepth;
  103131. }
  103132. PointCloudEyeDomeLighting.isSupported = isSupported;
  103133. function getECShaderProgram(context, shaderProgram) {
  103134. let shader = context.shaderCache.getDerivedShaderProgram(shaderProgram, "EC");
  103135. if (!defined_default(shader)) {
  103136. const attributeLocations8 = shaderProgram._attributeLocations;
  103137. const fs = shaderProgram.fragmentShaderSource.clone();
  103138. fs.sources = fs.sources.map(function(source) {
  103139. source = ShaderSource_default.replaceMain(
  103140. source,
  103141. "czm_point_cloud_post_process_main"
  103142. );
  103143. source = source.replace(/gl_FragColor/g, "gl_FragData[0]");
  103144. return source;
  103145. });
  103146. fs.sources.unshift("#extension GL_EXT_draw_buffers : enable \n");
  103147. fs.sources.push(
  103148. "void main() \n{ \n czm_point_cloud_post_process_main(); \n#ifdef LOG_DEPTH\n czm_writeLogDepth();\n gl_FragData[1] = czm_packDepth(gl_FragDepthEXT); \n#else\n gl_FragData[1] = czm_packDepth(gl_FragCoord.z);\n#endif\n}"
  103149. );
  103150. shader = context.shaderCache.createDerivedShaderProgram(
  103151. shaderProgram,
  103152. "EC",
  103153. {
  103154. vertexShaderSource: shaderProgram.vertexShaderSource,
  103155. fragmentShaderSource: fs,
  103156. attributeLocations: attributeLocations8
  103157. }
  103158. );
  103159. }
  103160. return shader;
  103161. }
  103162. PointCloudEyeDomeLighting.prototype.update = function(frameState, commandStart, pointCloudShading, boundingVolume) {
  103163. if (!isSupported(frameState.context)) {
  103164. return;
  103165. }
  103166. this._strength = pointCloudShading.eyeDomeLightingStrength;
  103167. this._radius = pointCloudShading.eyeDomeLightingRadius * frameState.pixelRatio;
  103168. createResources4(this, frameState.context);
  103169. let i2;
  103170. const commandList = frameState.commandList;
  103171. const commandEnd = commandList.length;
  103172. for (i2 = commandStart; i2 < commandEnd; ++i2) {
  103173. const command = commandList[i2];
  103174. if (command.primitiveType !== PrimitiveType_default.POINTS || command.pass === Pass_default.TRANSLUCENT) {
  103175. continue;
  103176. }
  103177. let derivedCommand;
  103178. let originalShaderProgram;
  103179. let derivedCommandObject = command.derivedCommands.pointCloudProcessor;
  103180. if (defined_default(derivedCommandObject)) {
  103181. derivedCommand = derivedCommandObject.command;
  103182. originalShaderProgram = derivedCommandObject.originalShaderProgram;
  103183. }
  103184. if (!defined_default(derivedCommand) || command.dirty || originalShaderProgram !== command.shaderProgram || derivedCommand.framebuffer !== this.framebuffer) {
  103185. derivedCommand = DrawCommand_default.shallowClone(command, derivedCommand);
  103186. derivedCommand.framebuffer = this.framebuffer;
  103187. derivedCommand.shaderProgram = getECShaderProgram(
  103188. frameState.context,
  103189. command.shaderProgram
  103190. );
  103191. derivedCommand.castShadows = false;
  103192. derivedCommand.receiveShadows = false;
  103193. if (!defined_default(derivedCommandObject)) {
  103194. derivedCommandObject = {
  103195. command: derivedCommand,
  103196. originalShaderProgram: command.shaderProgram
  103197. };
  103198. command.derivedCommands.pointCloudProcessor = derivedCommandObject;
  103199. }
  103200. derivedCommandObject.originalShaderProgram = command.shaderProgram;
  103201. }
  103202. commandList[i2] = derivedCommand;
  103203. }
  103204. const clearCommand = this._clearCommand;
  103205. const blendCommand = this._drawCommand;
  103206. blendCommand.boundingVolume = boundingVolume;
  103207. commandList.push(blendCommand);
  103208. commandList.push(clearCommand);
  103209. };
  103210. PointCloudEyeDomeLighting.prototype.isDestroyed = function() {
  103211. return false;
  103212. };
  103213. PointCloudEyeDomeLighting.prototype.destroy = function() {
  103214. destroyFramebuffer(this);
  103215. return destroyObject_default(this);
  103216. };
  103217. var PointCloudEyeDomeLighting_default2 = PointCloudEyeDomeLighting;
  103218. // node_modules/cesium/Source/Scene/PointCloudShading.js
  103219. function PointCloudShading(options) {
  103220. const pointCloudShading = defaultValue_default(options, {});
  103221. this.attenuation = defaultValue_default(pointCloudShading.attenuation, false);
  103222. this.geometricErrorScale = defaultValue_default(
  103223. pointCloudShading.geometricErrorScale,
  103224. 1
  103225. );
  103226. this.maximumAttenuation = pointCloudShading.maximumAttenuation;
  103227. this.baseResolution = pointCloudShading.baseResolution;
  103228. this.eyeDomeLighting = defaultValue_default(pointCloudShading.eyeDomeLighting, true);
  103229. this.eyeDomeLightingStrength = defaultValue_default(
  103230. pointCloudShading.eyeDomeLightingStrength,
  103231. 1
  103232. );
  103233. this.eyeDomeLightingRadius = defaultValue_default(
  103234. pointCloudShading.eyeDomeLightingRadius,
  103235. 1
  103236. );
  103237. this.backFaceCulling = defaultValue_default(pointCloudShading.backFaceCulling, false);
  103238. this.normalShading = defaultValue_default(pointCloudShading.normalShading, true);
  103239. }
  103240. PointCloudShading.isSupported = function(scene) {
  103241. return PointCloudEyeDomeLighting_default2.isSupported(scene.context);
  103242. };
  103243. var PointCloudShading_default = PointCloudShading;
  103244. // node_modules/cesium/Source/Scene/PointCloud3DTileContent.js
  103245. function PointCloud3DTileContent(tileset, tile, resource, arrayBuffer, byteOffset) {
  103246. this._tileset = tileset;
  103247. this._tile = tile;
  103248. this._resource = resource;
  103249. this._metadata = void 0;
  103250. this._pickId = void 0;
  103251. this._batchTable = void 0;
  103252. this._styleDirty = false;
  103253. this._features = void 0;
  103254. this.featurePropertiesDirty = false;
  103255. this._group = void 0;
  103256. this._pointCloud = new PointCloud_default({
  103257. arrayBuffer,
  103258. byteOffset,
  103259. cull: false,
  103260. opaquePass: Pass_default.CESIUM_3D_TILE,
  103261. vertexShaderLoaded: getVertexShaderLoaded(this),
  103262. fragmentShaderLoaded: getFragmentShaderLoaded(this),
  103263. uniformMapLoaded: getUniformMapLoaded(this),
  103264. batchTableLoaded: getBatchTableLoaded(this),
  103265. pickIdLoaded: getPickIdLoaded(this)
  103266. });
  103267. }
  103268. Object.defineProperties(PointCloud3DTileContent.prototype, {
  103269. featuresLength: {
  103270. get: function() {
  103271. if (defined_default(this._batchTable)) {
  103272. return this._batchTable.featuresLength;
  103273. }
  103274. return 0;
  103275. }
  103276. },
  103277. pointsLength: {
  103278. get: function() {
  103279. return this._pointCloud.pointsLength;
  103280. }
  103281. },
  103282. trianglesLength: {
  103283. get: function() {
  103284. return 0;
  103285. }
  103286. },
  103287. geometryByteLength: {
  103288. get: function() {
  103289. return this._pointCloud.geometryByteLength;
  103290. }
  103291. },
  103292. texturesByteLength: {
  103293. get: function() {
  103294. return 0;
  103295. }
  103296. },
  103297. batchTableByteLength: {
  103298. get: function() {
  103299. if (defined_default(this._batchTable)) {
  103300. return this._batchTable.memorySizeInBytes;
  103301. }
  103302. return 0;
  103303. }
  103304. },
  103305. innerContents: {
  103306. get: function() {
  103307. return void 0;
  103308. }
  103309. },
  103310. readyPromise: {
  103311. get: function() {
  103312. return this._pointCloud.readyPromise;
  103313. }
  103314. },
  103315. tileset: {
  103316. get: function() {
  103317. return this._tileset;
  103318. }
  103319. },
  103320. tile: {
  103321. get: function() {
  103322. return this._tile;
  103323. }
  103324. },
  103325. url: {
  103326. get: function() {
  103327. return this._resource.getUrlComponent(true);
  103328. }
  103329. },
  103330. metadata: {
  103331. get: function() {
  103332. return this._metadata;
  103333. },
  103334. set: function(value) {
  103335. this._metadata = value;
  103336. }
  103337. },
  103338. batchTable: {
  103339. get: function() {
  103340. return this._batchTable;
  103341. }
  103342. },
  103343. group: {
  103344. get: function() {
  103345. return this._group;
  103346. },
  103347. set: function(value) {
  103348. this._group = value;
  103349. }
  103350. }
  103351. });
  103352. function getVertexShaderLoaded(content) {
  103353. return function(vs) {
  103354. if (defined_default(content._batchTable)) {
  103355. return content._batchTable.getVertexShaderCallback(
  103356. false,
  103357. "a_batchId",
  103358. void 0
  103359. )(vs);
  103360. }
  103361. return vs;
  103362. };
  103363. }
  103364. function getFragmentShaderLoaded(content) {
  103365. return function(fs) {
  103366. if (defined_default(content._batchTable)) {
  103367. return content._batchTable.getFragmentShaderCallback(
  103368. false,
  103369. void 0,
  103370. false
  103371. )(fs);
  103372. }
  103373. return `uniform vec4 czm_pickColor;
  103374. ${fs}`;
  103375. };
  103376. }
  103377. function getUniformMapLoaded(content) {
  103378. return function(uniformMap2) {
  103379. if (defined_default(content._batchTable)) {
  103380. return content._batchTable.getUniformMapCallback()(uniformMap2);
  103381. }
  103382. return combine_default(uniformMap2, {
  103383. czm_pickColor: function() {
  103384. return content._pickId.color;
  103385. }
  103386. });
  103387. };
  103388. }
  103389. function getBatchTableLoaded(content) {
  103390. return function(batchLength, batchTableJson, batchTableBinary) {
  103391. content._batchTable = new Cesium3DTileBatchTable_default(
  103392. content,
  103393. batchLength,
  103394. batchTableJson,
  103395. batchTableBinary
  103396. );
  103397. };
  103398. }
  103399. function getPickIdLoaded(content) {
  103400. return function() {
  103401. return defined_default(content._batchTable) ? content._batchTable.getPickId() : "czm_pickColor";
  103402. };
  103403. }
  103404. function getGeometricError2(content) {
  103405. const pointCloudShading = content._tileset.pointCloudShading;
  103406. const sphereVolume = content._tile.contentBoundingVolume.boundingSphere.volume();
  103407. const baseResolutionApproximation = Math_default.cbrt(
  103408. sphereVolume / content.pointsLength
  103409. );
  103410. let geometricError = content._tile.geometricError;
  103411. if (geometricError === 0) {
  103412. if (defined_default(pointCloudShading) && defined_default(pointCloudShading.baseResolution)) {
  103413. geometricError = pointCloudShading.baseResolution;
  103414. } else {
  103415. geometricError = baseResolutionApproximation;
  103416. }
  103417. }
  103418. return geometricError;
  103419. }
  103420. function createFeatures4(content) {
  103421. const featuresLength = content.featuresLength;
  103422. if (!defined_default(content._features) && featuresLength > 0) {
  103423. const features = new Array(featuresLength);
  103424. for (let i2 = 0; i2 < featuresLength; ++i2) {
  103425. features[i2] = new Cesium3DTileFeature_default(content, i2);
  103426. }
  103427. content._features = features;
  103428. }
  103429. }
  103430. PointCloud3DTileContent.prototype.hasProperty = function(batchId, name) {
  103431. if (defined_default(this._batchTable)) {
  103432. return this._batchTable.hasProperty(batchId, name);
  103433. }
  103434. return false;
  103435. };
  103436. PointCloud3DTileContent.prototype.getFeature = function(batchId) {
  103437. if (!defined_default(this._batchTable)) {
  103438. return void 0;
  103439. }
  103440. const featuresLength = this.featuresLength;
  103441. if (!defined_default(batchId) || batchId < 0 || batchId >= featuresLength) {
  103442. throw new DeveloperError_default(
  103443. `batchId is required and between zero and featuresLength - 1 (${featuresLength - 1}).`
  103444. );
  103445. }
  103446. createFeatures4(this);
  103447. return this._features[batchId];
  103448. };
  103449. PointCloud3DTileContent.prototype.applyDebugSettings = function(enabled, color) {
  103450. this._pointCloud.color = enabled ? color : Color_default.WHITE;
  103451. };
  103452. PointCloud3DTileContent.prototype.applyStyle = function(style) {
  103453. if (defined_default(this._batchTable)) {
  103454. this._batchTable.applyStyle(style);
  103455. } else {
  103456. this._styleDirty = true;
  103457. }
  103458. };
  103459. var defaultShading = new PointCloudShading_default();
  103460. PointCloud3DTileContent.prototype.update = function(tileset, frameState) {
  103461. const pointCloud = this._pointCloud;
  103462. const pointCloudShading = defaultValue_default(
  103463. tileset.pointCloudShading,
  103464. defaultShading
  103465. );
  103466. const tile = this._tile;
  103467. const batchTable = this._batchTable;
  103468. const mode2 = frameState.mode;
  103469. const clippingPlanes = tileset.clippingPlanes;
  103470. if (!defined_default(this._pickId) && !defined_default(batchTable)) {
  103471. this._pickId = frameState.context.createPickId({
  103472. primitive: tileset,
  103473. content: this
  103474. });
  103475. }
  103476. if (defined_default(batchTable)) {
  103477. batchTable.update(tileset, frameState);
  103478. }
  103479. let boundingSphere;
  103480. if (defined_default(tile._contentBoundingVolume)) {
  103481. boundingSphere = mode2 === SceneMode_default.SCENE3D ? tile._contentBoundingVolume.boundingSphere : tile._contentBoundingVolume2D.boundingSphere;
  103482. } else {
  103483. boundingSphere = mode2 === SceneMode_default.SCENE3D ? tile._boundingVolume.boundingSphere : tile._boundingVolume2D.boundingSphere;
  103484. }
  103485. const styleDirty = this._styleDirty;
  103486. this._styleDirty = false;
  103487. pointCloud.clippingPlanesOriginMatrix = tileset.clippingPlanesOriginMatrix;
  103488. pointCloud.style = defined_default(batchTable) ? void 0 : tileset.style;
  103489. pointCloud.styleDirty = styleDirty;
  103490. pointCloud.modelMatrix = tile.computedTransform;
  103491. pointCloud.time = tileset.timeSinceLoad;
  103492. pointCloud.shadows = tileset.shadows;
  103493. pointCloud.boundingSphere = boundingSphere;
  103494. pointCloud.clippingPlanes = clippingPlanes;
  103495. pointCloud.isClipped = defined_default(clippingPlanes) && clippingPlanes.enabled && tile._isClipped;
  103496. pointCloud.clippingPlanesDirty = tile.clippingPlanesDirty;
  103497. pointCloud.attenuation = pointCloudShading.attenuation;
  103498. pointCloud.backFaceCulling = pointCloudShading.backFaceCulling;
  103499. pointCloud.normalShading = pointCloudShading.normalShading;
  103500. pointCloud.geometricError = getGeometricError2(this);
  103501. pointCloud.geometricErrorScale = pointCloudShading.geometricErrorScale;
  103502. pointCloud.splitDirection = tileset.splitDirection;
  103503. if (defined_default(pointCloudShading) && defined_default(pointCloudShading.maximumAttenuation)) {
  103504. pointCloud.maximumAttenuation = pointCloudShading.maximumAttenuation;
  103505. } else if (tile.refine === Cesium3DTileRefine_default.ADD) {
  103506. pointCloud.maximumAttenuation = 5;
  103507. } else {
  103508. pointCloud.maximumAttenuation = tileset.maximumScreenSpaceError;
  103509. }
  103510. pointCloud.update(frameState);
  103511. };
  103512. PointCloud3DTileContent.prototype.isDestroyed = function() {
  103513. return false;
  103514. };
  103515. PointCloud3DTileContent.prototype.destroy = function() {
  103516. this._pickId = this._pickId && this._pickId.destroy();
  103517. this._pointCloud = this._pointCloud && this._pointCloud.destroy();
  103518. this._batchTable = this._batchTable && this._batchTable.destroy();
  103519. return destroyObject_default(this);
  103520. };
  103521. var PointCloud3DTileContent_default = PointCloud3DTileContent;
  103522. // node_modules/cesium/Source/Scene/Tileset3DTileContent.js
  103523. function Tileset3DTileContent(tileset, tile, resource, json) {
  103524. this._tileset = tileset;
  103525. this._tile = tile;
  103526. this._resource = resource;
  103527. this._readyPromise = defer_default();
  103528. this.featurePropertiesDirty = false;
  103529. this._metadata = void 0;
  103530. this._group = void 0;
  103531. initialize11(this, json);
  103532. }
  103533. Object.defineProperties(Tileset3DTileContent.prototype, {
  103534. featuresLength: {
  103535. get: function() {
  103536. return 0;
  103537. }
  103538. },
  103539. pointsLength: {
  103540. get: function() {
  103541. return 0;
  103542. }
  103543. },
  103544. trianglesLength: {
  103545. get: function() {
  103546. return 0;
  103547. }
  103548. },
  103549. geometryByteLength: {
  103550. get: function() {
  103551. return 0;
  103552. }
  103553. },
  103554. texturesByteLength: {
  103555. get: function() {
  103556. return 0;
  103557. }
  103558. },
  103559. batchTableByteLength: {
  103560. get: function() {
  103561. return 0;
  103562. }
  103563. },
  103564. innerContents: {
  103565. get: function() {
  103566. return void 0;
  103567. }
  103568. },
  103569. readyPromise: {
  103570. get: function() {
  103571. return this._readyPromise.promise;
  103572. }
  103573. },
  103574. tileset: {
  103575. get: function() {
  103576. return this._tileset;
  103577. }
  103578. },
  103579. tile: {
  103580. get: function() {
  103581. return this._tile;
  103582. }
  103583. },
  103584. url: {
  103585. get: function() {
  103586. return this._resource.getUrlComponent(true);
  103587. }
  103588. },
  103589. batchTable: {
  103590. get: function() {
  103591. return void 0;
  103592. }
  103593. },
  103594. metadata: {
  103595. get: function() {
  103596. return this._metadata;
  103597. },
  103598. set: function(value) {
  103599. this._metadata = value;
  103600. }
  103601. },
  103602. group: {
  103603. get: function() {
  103604. return this._group;
  103605. },
  103606. set: function(value) {
  103607. this._group = value;
  103608. }
  103609. }
  103610. });
  103611. function initialize11(content, json) {
  103612. content._tileset.loadTileset(content._resource, json, content._tile);
  103613. content._readyPromise.resolve(content);
  103614. }
  103615. Tileset3DTileContent.prototype.hasProperty = function(batchId, name) {
  103616. return false;
  103617. };
  103618. Tileset3DTileContent.prototype.getFeature = function(batchId) {
  103619. return void 0;
  103620. };
  103621. Tileset3DTileContent.prototype.applyDebugSettings = function(enabled, color) {
  103622. };
  103623. Tileset3DTileContent.prototype.applyStyle = function(style) {
  103624. };
  103625. Tileset3DTileContent.prototype.update = function(tileset, frameState) {
  103626. };
  103627. Tileset3DTileContent.prototype.isDestroyed = function() {
  103628. return false;
  103629. };
  103630. Tileset3DTileContent.prototype.destroy = function() {
  103631. return destroyObject_default(this);
  103632. };
  103633. var Tileset3DTileContent_default = Tileset3DTileContent;
  103634. // node_modules/cesium/Source/Renderer/VertexArrayFacade.js
  103635. function VertexArrayFacade(context, attributes, sizeInVertices, instanced) {
  103636. Check_default.defined("context", context);
  103637. if (!attributes || attributes.length === 0) {
  103638. throw new DeveloperError_default("At least one attribute is required.");
  103639. }
  103640. const attrs = VertexArrayFacade._verifyAttributes(attributes);
  103641. sizeInVertices = defaultValue_default(sizeInVertices, 0);
  103642. const precreatedAttributes = [];
  103643. const attributesByUsage = {};
  103644. let attributesForUsage;
  103645. let usage;
  103646. const length3 = attrs.length;
  103647. for (let i2 = 0; i2 < length3; ++i2) {
  103648. const attribute = attrs[i2];
  103649. if (attribute.vertexBuffer) {
  103650. precreatedAttributes.push(attribute);
  103651. continue;
  103652. }
  103653. usage = attribute.usage;
  103654. attributesForUsage = attributesByUsage[usage];
  103655. if (!defined_default(attributesForUsage)) {
  103656. attributesForUsage = attributesByUsage[usage] = [];
  103657. }
  103658. attributesForUsage.push(attribute);
  103659. }
  103660. function compare(left, right) {
  103661. return ComponentDatatype_default.getSizeInBytes(right.componentDatatype) - ComponentDatatype_default.getSizeInBytes(left.componentDatatype);
  103662. }
  103663. this._allBuffers = [];
  103664. for (usage in attributesByUsage) {
  103665. if (attributesByUsage.hasOwnProperty(usage)) {
  103666. attributesForUsage = attributesByUsage[usage];
  103667. attributesForUsage.sort(compare);
  103668. const vertexSizeInBytes = VertexArrayFacade._vertexSizeInBytes(
  103669. attributesForUsage
  103670. );
  103671. const bufferUsage = attributesForUsage[0].usage;
  103672. const buffer = {
  103673. vertexSizeInBytes,
  103674. vertexBuffer: void 0,
  103675. usage: bufferUsage,
  103676. needsCommit: false,
  103677. arrayBuffer: void 0,
  103678. arrayViews: VertexArrayFacade._createArrayViews(
  103679. attributesForUsage,
  103680. vertexSizeInBytes
  103681. )
  103682. };
  103683. this._allBuffers.push(buffer);
  103684. }
  103685. }
  103686. this._size = 0;
  103687. this._instanced = defaultValue_default(instanced, false);
  103688. this._precreated = precreatedAttributes;
  103689. this._context = context;
  103690. this.writers = void 0;
  103691. this.va = void 0;
  103692. this.resize(sizeInVertices);
  103693. }
  103694. VertexArrayFacade._verifyAttributes = function(attributes) {
  103695. const attrs = [];
  103696. for (let i2 = 0; i2 < attributes.length; ++i2) {
  103697. const attribute = attributes[i2];
  103698. const attr = {
  103699. index: defaultValue_default(attribute.index, i2),
  103700. enabled: defaultValue_default(attribute.enabled, true),
  103701. componentsPerAttribute: attribute.componentsPerAttribute,
  103702. componentDatatype: defaultValue_default(
  103703. attribute.componentDatatype,
  103704. ComponentDatatype_default.FLOAT
  103705. ),
  103706. normalize: defaultValue_default(attribute.normalize, false),
  103707. vertexBuffer: attribute.vertexBuffer,
  103708. usage: defaultValue_default(attribute.usage, BufferUsage_default.STATIC_DRAW)
  103709. };
  103710. attrs.push(attr);
  103711. if (attr.componentsPerAttribute !== 1 && attr.componentsPerAttribute !== 2 && attr.componentsPerAttribute !== 3 && attr.componentsPerAttribute !== 4) {
  103712. throw new DeveloperError_default(
  103713. "attribute.componentsPerAttribute must be in the range [1, 4]."
  103714. );
  103715. }
  103716. const datatype = attr.componentDatatype;
  103717. if (!ComponentDatatype_default.validate(datatype)) {
  103718. throw new DeveloperError_default(
  103719. "Attribute must have a valid componentDatatype or not specify it."
  103720. );
  103721. }
  103722. if (!BufferUsage_default.validate(attr.usage)) {
  103723. throw new DeveloperError_default(
  103724. "Attribute must have a valid usage or not specify it."
  103725. );
  103726. }
  103727. }
  103728. const uniqueIndices = new Array(attrs.length);
  103729. for (let j = 0; j < attrs.length; ++j) {
  103730. const currentAttr = attrs[j];
  103731. const index2 = currentAttr.index;
  103732. if (uniqueIndices[index2]) {
  103733. throw new DeveloperError_default(
  103734. `Index ${index2} is used by more than one attribute.`
  103735. );
  103736. }
  103737. uniqueIndices[index2] = true;
  103738. }
  103739. return attrs;
  103740. };
  103741. VertexArrayFacade._vertexSizeInBytes = function(attributes) {
  103742. let sizeInBytes = 0;
  103743. const length3 = attributes.length;
  103744. for (let i2 = 0; i2 < length3; ++i2) {
  103745. const attribute = attributes[i2];
  103746. sizeInBytes += attribute.componentsPerAttribute * ComponentDatatype_default.getSizeInBytes(attribute.componentDatatype);
  103747. }
  103748. const maxComponentSizeInBytes = length3 > 0 ? ComponentDatatype_default.getSizeInBytes(attributes[0].componentDatatype) : 0;
  103749. const remainder = maxComponentSizeInBytes > 0 ? sizeInBytes % maxComponentSizeInBytes : 0;
  103750. const padding = remainder === 0 ? 0 : maxComponentSizeInBytes - remainder;
  103751. sizeInBytes += padding;
  103752. return sizeInBytes;
  103753. };
  103754. VertexArrayFacade._createArrayViews = function(attributes, vertexSizeInBytes) {
  103755. const views = [];
  103756. let offsetInBytes = 0;
  103757. const length3 = attributes.length;
  103758. for (let i2 = 0; i2 < length3; ++i2) {
  103759. const attribute = attributes[i2];
  103760. const componentDatatype = attribute.componentDatatype;
  103761. views.push({
  103762. index: attribute.index,
  103763. enabled: attribute.enabled,
  103764. componentsPerAttribute: attribute.componentsPerAttribute,
  103765. componentDatatype,
  103766. normalize: attribute.normalize,
  103767. offsetInBytes,
  103768. vertexSizeInComponentType: vertexSizeInBytes / ComponentDatatype_default.getSizeInBytes(componentDatatype),
  103769. view: void 0
  103770. });
  103771. offsetInBytes += attribute.componentsPerAttribute * ComponentDatatype_default.getSizeInBytes(componentDatatype);
  103772. }
  103773. return views;
  103774. };
  103775. VertexArrayFacade.prototype.resize = function(sizeInVertices) {
  103776. this._size = sizeInVertices;
  103777. const allBuffers = this._allBuffers;
  103778. this.writers = [];
  103779. for (let i2 = 0, len = allBuffers.length; i2 < len; ++i2) {
  103780. const buffer = allBuffers[i2];
  103781. VertexArrayFacade._resize(buffer, this._size);
  103782. VertexArrayFacade._appendWriters(this.writers, buffer);
  103783. }
  103784. destroyVA(this);
  103785. };
  103786. VertexArrayFacade._resize = function(buffer, size) {
  103787. if (buffer.vertexSizeInBytes > 0) {
  103788. const arrayBuffer = new ArrayBuffer(size * buffer.vertexSizeInBytes);
  103789. if (defined_default(buffer.arrayBuffer)) {
  103790. const destView = new Uint8Array(arrayBuffer);
  103791. const sourceView = new Uint8Array(buffer.arrayBuffer);
  103792. const sourceLength = sourceView.length;
  103793. for (let j = 0; j < sourceLength; ++j) {
  103794. destView[j] = sourceView[j];
  103795. }
  103796. }
  103797. const views = buffer.arrayViews;
  103798. const length3 = views.length;
  103799. for (let i2 = 0; i2 < length3; ++i2) {
  103800. const view = views[i2];
  103801. view.view = ComponentDatatype_default.createArrayBufferView(
  103802. view.componentDatatype,
  103803. arrayBuffer,
  103804. view.offsetInBytes
  103805. );
  103806. }
  103807. buffer.arrayBuffer = arrayBuffer;
  103808. }
  103809. };
  103810. var createWriters = [
  103811. function(buffer, view, vertexSizeInComponentType) {
  103812. return function(index2, attribute) {
  103813. view[index2 * vertexSizeInComponentType] = attribute;
  103814. buffer.needsCommit = true;
  103815. };
  103816. },
  103817. function(buffer, view, vertexSizeInComponentType) {
  103818. return function(index2, component0, component1) {
  103819. const i2 = index2 * vertexSizeInComponentType;
  103820. view[i2] = component0;
  103821. view[i2 + 1] = component1;
  103822. buffer.needsCommit = true;
  103823. };
  103824. },
  103825. function(buffer, view, vertexSizeInComponentType) {
  103826. return function(index2, component0, component1, component2) {
  103827. const i2 = index2 * vertexSizeInComponentType;
  103828. view[i2] = component0;
  103829. view[i2 + 1] = component1;
  103830. view[i2 + 2] = component2;
  103831. buffer.needsCommit = true;
  103832. };
  103833. },
  103834. function(buffer, view, vertexSizeInComponentType) {
  103835. return function(index2, component0, component1, component2, component3) {
  103836. const i2 = index2 * vertexSizeInComponentType;
  103837. view[i2] = component0;
  103838. view[i2 + 1] = component1;
  103839. view[i2 + 2] = component2;
  103840. view[i2 + 3] = component3;
  103841. buffer.needsCommit = true;
  103842. };
  103843. }
  103844. ];
  103845. VertexArrayFacade._appendWriters = function(writers, buffer) {
  103846. const arrayViews = buffer.arrayViews;
  103847. const length3 = arrayViews.length;
  103848. for (let i2 = 0; i2 < length3; ++i2) {
  103849. const arrayView = arrayViews[i2];
  103850. writers[arrayView.index] = createWriters[arrayView.componentsPerAttribute - 1](buffer, arrayView.view, arrayView.vertexSizeInComponentType);
  103851. }
  103852. };
  103853. VertexArrayFacade.prototype.commit = function(indexBuffer) {
  103854. let recreateVA = false;
  103855. const allBuffers = this._allBuffers;
  103856. let buffer;
  103857. let i2;
  103858. let length3;
  103859. for (i2 = 0, length3 = allBuffers.length; i2 < length3; ++i2) {
  103860. buffer = allBuffers[i2];
  103861. recreateVA = commit(this, buffer) || recreateVA;
  103862. }
  103863. if (recreateVA || !defined_default(this.va)) {
  103864. destroyVA(this);
  103865. const va = this.va = [];
  103866. const chunkSize = Math_default.SIXTY_FOUR_KILOBYTES - 4;
  103867. const numberOfVertexArrays = defined_default(indexBuffer) && !this._instanced ? Math.ceil(this._size / chunkSize) : 1;
  103868. for (let k = 0; k < numberOfVertexArrays; ++k) {
  103869. let attributes = [];
  103870. for (i2 = 0, length3 = allBuffers.length; i2 < length3; ++i2) {
  103871. buffer = allBuffers[i2];
  103872. const offset2 = k * (buffer.vertexSizeInBytes * chunkSize);
  103873. VertexArrayFacade._appendAttributes(
  103874. attributes,
  103875. buffer,
  103876. offset2,
  103877. this._instanced
  103878. );
  103879. }
  103880. attributes = attributes.concat(this._precreated);
  103881. va.push({
  103882. va: new VertexArray_default({
  103883. context: this._context,
  103884. attributes,
  103885. indexBuffer
  103886. }),
  103887. indicesCount: 1.5 * (k !== numberOfVertexArrays - 1 ? chunkSize : this._size % chunkSize)
  103888. });
  103889. }
  103890. }
  103891. };
  103892. function commit(vertexArrayFacade, buffer) {
  103893. if (buffer.needsCommit && buffer.vertexSizeInBytes > 0) {
  103894. buffer.needsCommit = false;
  103895. const vertexBuffer = buffer.vertexBuffer;
  103896. const vertexBufferSizeInBytes = vertexArrayFacade._size * buffer.vertexSizeInBytes;
  103897. const vertexBufferDefined = defined_default(vertexBuffer);
  103898. if (!vertexBufferDefined || vertexBuffer.sizeInBytes < vertexBufferSizeInBytes) {
  103899. if (vertexBufferDefined) {
  103900. vertexBuffer.destroy();
  103901. }
  103902. buffer.vertexBuffer = Buffer_default.createVertexBuffer({
  103903. context: vertexArrayFacade._context,
  103904. typedArray: buffer.arrayBuffer,
  103905. usage: buffer.usage
  103906. });
  103907. buffer.vertexBuffer.vertexArrayDestroyable = false;
  103908. return true;
  103909. }
  103910. buffer.vertexBuffer.copyFromArrayView(buffer.arrayBuffer);
  103911. }
  103912. return false;
  103913. }
  103914. VertexArrayFacade._appendAttributes = function(attributes, buffer, vertexBufferOffset, instanced) {
  103915. const arrayViews = buffer.arrayViews;
  103916. const length3 = arrayViews.length;
  103917. for (let i2 = 0; i2 < length3; ++i2) {
  103918. const view = arrayViews[i2];
  103919. attributes.push({
  103920. index: view.index,
  103921. enabled: view.enabled,
  103922. componentsPerAttribute: view.componentsPerAttribute,
  103923. componentDatatype: view.componentDatatype,
  103924. normalize: view.normalize,
  103925. vertexBuffer: buffer.vertexBuffer,
  103926. offsetInBytes: vertexBufferOffset + view.offsetInBytes,
  103927. strideInBytes: buffer.vertexSizeInBytes,
  103928. instanceDivisor: instanced ? 1 : 0
  103929. });
  103930. }
  103931. };
  103932. VertexArrayFacade.prototype.subCommit = function(offsetInVertices, lengthInVertices) {
  103933. if (offsetInVertices < 0 || offsetInVertices >= this._size) {
  103934. throw new DeveloperError_default(
  103935. "offsetInVertices must be greater than or equal to zero and less than the vertex array size."
  103936. );
  103937. }
  103938. if (offsetInVertices + lengthInVertices > this._size) {
  103939. throw new DeveloperError_default(
  103940. "offsetInVertices + lengthInVertices cannot exceed the vertex array size."
  103941. );
  103942. }
  103943. const allBuffers = this._allBuffers;
  103944. for (let i2 = 0, len = allBuffers.length; i2 < len; ++i2) {
  103945. subCommit(allBuffers[i2], offsetInVertices, lengthInVertices);
  103946. }
  103947. };
  103948. function subCommit(buffer, offsetInVertices, lengthInVertices) {
  103949. if (buffer.needsCommit && buffer.vertexSizeInBytes > 0) {
  103950. const byteOffset = buffer.vertexSizeInBytes * offsetInVertices;
  103951. const byteLength = buffer.vertexSizeInBytes * lengthInVertices;
  103952. buffer.vertexBuffer.copyFromArrayView(
  103953. new Uint8Array(buffer.arrayBuffer, byteOffset, byteLength),
  103954. byteOffset
  103955. );
  103956. }
  103957. }
  103958. VertexArrayFacade.prototype.endSubCommits = function() {
  103959. const allBuffers = this._allBuffers;
  103960. for (let i2 = 0, len = allBuffers.length; i2 < len; ++i2) {
  103961. allBuffers[i2].needsCommit = false;
  103962. }
  103963. };
  103964. function destroyVA(vertexArrayFacade) {
  103965. const va = vertexArrayFacade.va;
  103966. if (!defined_default(va)) {
  103967. return;
  103968. }
  103969. const length3 = va.length;
  103970. for (let i2 = 0; i2 < length3; ++i2) {
  103971. va[i2].va.destroy();
  103972. }
  103973. vertexArrayFacade.va = void 0;
  103974. }
  103975. VertexArrayFacade.prototype.isDestroyed = function() {
  103976. return false;
  103977. };
  103978. VertexArrayFacade.prototype.destroy = function() {
  103979. const allBuffers = this._allBuffers;
  103980. for (let i2 = 0, len = allBuffers.length; i2 < len; ++i2) {
  103981. const buffer = allBuffers[i2];
  103982. buffer.vertexBuffer = buffer.vertexBuffer && buffer.vertexBuffer.destroy();
  103983. }
  103984. destroyVA(this);
  103985. return destroyObject_default(this);
  103986. };
  103987. var VertexArrayFacade_default = VertexArrayFacade;
  103988. // node_modules/cesium/Source/Shaders/BillboardCollectionFS.js
  103989. var BillboardCollectionFS_default = `#ifdef GL_OES_standard_derivatives
  103990. #extension GL_OES_standard_derivatives : enable
  103991. #endif
  103992. uniform sampler2D u_atlas;
  103993. #ifdef VECTOR_TILE
  103994. uniform vec4 u_highlightColor;
  103995. #endif
  103996. varying vec2 v_textureCoordinates;
  103997. varying vec4 v_pickColor;
  103998. varying vec4 v_color;
  103999. #ifdef SDF
  104000. varying vec4 v_outlineColor;
  104001. varying float v_outlineWidth;
  104002. #endif
  104003. #ifdef FRAGMENT_DEPTH_CHECK
  104004. varying vec4 v_textureCoordinateBounds; // the min and max x and y values for the texture coordinates
  104005. varying vec4 v_originTextureCoordinateAndTranslate; // texture coordinate at the origin, billboard translate (used for label glyphs)
  104006. varying vec4 v_compressed; // x: eyeDepth, y: applyTranslate & enableDepthCheck, z: dimensions, w: imageSize
  104007. varying mat2 v_rotationMatrix;
  104008. const float SHIFT_LEFT12 = 4096.0;
  104009. const float SHIFT_LEFT1 = 2.0;
  104010. const float SHIFT_RIGHT12 = 1.0 / 4096.0;
  104011. const float SHIFT_RIGHT1 = 1.0 / 2.0;
  104012. float getGlobeDepth(vec2 adjustedST, vec2 depthLookupST, bool applyTranslate, vec2 dimensions, vec2 imageSize)
  104013. {
  104014. vec2 lookupVector = imageSize * (depthLookupST - adjustedST);
  104015. lookupVector = v_rotationMatrix * lookupVector;
  104016. vec2 labelOffset = (dimensions - imageSize) * (depthLookupST - vec2(0.0, v_originTextureCoordinateAndTranslate.y)); // aligns label glyph with bounding rectangle. Will be zero for billboards because dimensions and imageSize will be equal
  104017. vec2 translation = v_originTextureCoordinateAndTranslate.zw;
  104018. if (applyTranslate)
  104019. {
  104020. // this is only needed for labels where the horizontal origin is not LEFT
  104021. // it moves the label back to where the "origin" should be since all label glyphs are set to HorizontalOrigin.LEFT
  104022. translation += (dimensions * v_originTextureCoordinateAndTranslate.xy * vec2(1.0, 0.0));
  104023. }
  104024. vec2 st = ((lookupVector - translation + labelOffset) + gl_FragCoord.xy) / czm_viewport.zw;
  104025. float logDepthOrDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, st));
  104026. if (logDepthOrDepth == 0.0)
  104027. {
  104028. return 0.0; // not on the globe
  104029. }
  104030. vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);
  104031. return eyeCoordinate.z / eyeCoordinate.w;
  104032. }
  104033. #endif
  104034. #ifdef SDF
  104035. // Get the distance from the edge of a glyph at a given position sampling an SDF texture.
  104036. float getDistance(vec2 position)
  104037. {
  104038. return texture2D(u_atlas, position).r;
  104039. }
  104040. // Samples the sdf texture at the given position and produces a color based on the fill color and the outline.
  104041. vec4 getSDFColor(vec2 position, float outlineWidth, vec4 outlineColor, float smoothing)
  104042. {
  104043. float distance = getDistance(position);
  104044. if (outlineWidth > 0.0)
  104045. {
  104046. // Don't get the outline edge exceed the SDF_EDGE
  104047. float outlineEdge = clamp(SDF_EDGE - outlineWidth, 0.0, SDF_EDGE);
  104048. float outlineFactor = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);
  104049. vec4 sdfColor = mix(outlineColor, v_color, outlineFactor);
  104050. float alpha = smoothstep(outlineEdge - smoothing, outlineEdge + smoothing, distance);
  104051. return vec4(sdfColor.rgb, sdfColor.a * alpha);
  104052. }
  104053. else
  104054. {
  104055. float alpha = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);
  104056. return vec4(v_color.rgb, v_color.a * alpha);
  104057. }
  104058. }
  104059. #endif
  104060. void main()
  104061. {
  104062. vec4 color = texture2D(u_atlas, v_textureCoordinates);
  104063. #ifdef SDF
  104064. float outlineWidth = v_outlineWidth;
  104065. vec4 outlineColor = v_outlineColor;
  104066. // Get the current distance
  104067. float distance = getDistance(v_textureCoordinates);
  104068. #ifdef GL_OES_standard_derivatives
  104069. float smoothing = fwidth(distance);
  104070. // Get an offset that is approximately half the distance to the neighbor pixels
  104071. // 0.354 is approximately half of 1/sqrt(2)
  104072. vec2 sampleOffset = 0.354 * vec2(dFdx(v_textureCoordinates) + dFdy(v_textureCoordinates));
  104073. // Sample the center point
  104074. vec4 center = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);
  104075. // Sample the 4 neighbors
  104076. vec4 color1 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);
  104077. vec4 color2 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);
  104078. vec4 color3 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);
  104079. vec4 color4 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);
  104080. // Equally weight the center sample and the 4 neighboring samples
  104081. color = (center + color1 + color2 + color3 + color4)/5.0;
  104082. #else
  104083. // Just do a single sample
  104084. float smoothing = 1.0/32.0;
  104085. color = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);
  104086. #endif
  104087. color = czm_gammaCorrect(color);
  104088. #else
  104089. color = czm_gammaCorrect(color);
  104090. color *= czm_gammaCorrect(v_color);
  104091. #endif
  104092. // Fully transparent parts of the billboard are not pickable.
  104093. #if !defined(OPAQUE) && !defined(TRANSLUCENT)
  104094. if (color.a < 0.005) // matches 0/255 and 1/255
  104095. {
  104096. discard;
  104097. }
  104098. #else
  104099. // The billboard is rendered twice. The opaque pass discards translucent fragments
  104100. // and the translucent pass discards opaque fragments.
  104101. #ifdef OPAQUE
  104102. if (color.a < 0.995) // matches < 254/255
  104103. {
  104104. discard;
  104105. }
  104106. #else
  104107. if (color.a >= 0.995) // matches 254/255 and 255/255
  104108. {
  104109. discard;
  104110. }
  104111. #endif
  104112. #endif
  104113. #ifdef VECTOR_TILE
  104114. color *= u_highlightColor;
  104115. #endif
  104116. gl_FragColor = color;
  104117. #ifdef LOG_DEPTH
  104118. czm_writeLogDepth();
  104119. #endif
  104120. #ifdef FRAGMENT_DEPTH_CHECK
  104121. float temp = v_compressed.y;
  104122. temp = temp * SHIFT_RIGHT1;
  104123. float temp2 = (temp - floor(temp)) * SHIFT_LEFT1;
  104124. bool enableDepthTest = temp2 != 0.0;
  104125. bool applyTranslate = floor(temp) != 0.0;
  104126. if (enableDepthTest) {
  104127. temp = v_compressed.z;
  104128. temp = temp * SHIFT_RIGHT12;
  104129. vec2 dimensions;
  104130. dimensions.y = (temp - floor(temp)) * SHIFT_LEFT12;
  104131. dimensions.x = floor(temp);
  104132. temp = v_compressed.w;
  104133. temp = temp * SHIFT_RIGHT12;
  104134. vec2 imageSize;
  104135. imageSize.y = (temp - floor(temp)) * SHIFT_LEFT12;
  104136. imageSize.x = floor(temp);
  104137. vec2 adjustedST = v_textureCoordinates - v_textureCoordinateBounds.xy;
  104138. adjustedST = adjustedST / vec2(v_textureCoordinateBounds.z - v_textureCoordinateBounds.x, v_textureCoordinateBounds.w - v_textureCoordinateBounds.y);
  104139. float epsilonEyeDepth = v_compressed.x + czm_epsilon1;
  104140. float globeDepth1 = getGlobeDepth(adjustedST, v_originTextureCoordinateAndTranslate.xy, applyTranslate, dimensions, imageSize);
  104141. // negative values go into the screen
  104142. if (globeDepth1 != 0.0 && globeDepth1 > epsilonEyeDepth)
  104143. {
  104144. float globeDepth2 = getGlobeDepth(adjustedST, vec2(0.0, 1.0), applyTranslate, dimensions, imageSize); // top left corner
  104145. if (globeDepth2 != 0.0 && globeDepth2 > epsilonEyeDepth)
  104146. {
  104147. float globeDepth3 = getGlobeDepth(adjustedST, vec2(1.0, 1.0), applyTranslate, dimensions, imageSize); // top right corner
  104148. if (globeDepth3 != 0.0 && globeDepth3 > epsilonEyeDepth)
  104149. {
  104150. discard;
  104151. }
  104152. }
  104153. }
  104154. }
  104155. #endif
  104156. }
  104157. `;
  104158. // node_modules/cesium/Source/Shaders/BillboardCollectionVS.js
  104159. var BillboardCollectionVS_default = `#ifdef INSTANCED
  104160. attribute vec2 direction;
  104161. #endif
  104162. attribute vec4 positionHighAndScale;
  104163. attribute vec4 positionLowAndRotation;
  104164. attribute vec4 compressedAttribute0; // pixel offset, translate, horizontal origin, vertical origin, show, direction, texture coordinates (texture offset)
  104165. attribute vec4 compressedAttribute1; // aligned axis, translucency by distance, image width
  104166. attribute vec4 compressedAttribute2; // label horizontal origin, image height, color, pick color, size in meters, valid aligned axis, 13 bits free
  104167. attribute vec4 eyeOffset; // eye offset in meters, 4 bytes free (texture range)
  104168. attribute vec4 scaleByDistance; // near, nearScale, far, farScale
  104169. attribute vec4 pixelOffsetScaleByDistance; // near, nearScale, far, farScale
  104170. attribute vec4 compressedAttribute3; // distance display condition near, far, disableDepthTestDistance, dimensions
  104171. attribute vec2 sdf; // sdf outline color (rgb) and width (w)
  104172. #if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)
  104173. attribute vec4 textureCoordinateBoundsOrLabelTranslate; // the min and max x and y values for the texture coordinates
  104174. #endif
  104175. #ifdef VECTOR_TILE
  104176. attribute float a_batchId;
  104177. #endif
  104178. varying vec2 v_textureCoordinates;
  104179. #ifdef FRAGMENT_DEPTH_CHECK
  104180. varying vec4 v_textureCoordinateBounds;
  104181. varying vec4 v_originTextureCoordinateAndTranslate;
  104182. varying vec4 v_compressed; // x: eyeDepth, y: applyTranslate & enableDepthCheck, z: dimensions, w: imageSize
  104183. varying mat2 v_rotationMatrix;
  104184. #endif
  104185. varying vec4 v_pickColor;
  104186. varying vec4 v_color;
  104187. #ifdef SDF
  104188. varying vec4 v_outlineColor;
  104189. varying float v_outlineWidth;
  104190. #endif
  104191. const float UPPER_BOUND = 32768.0;
  104192. const float SHIFT_LEFT16 = 65536.0;
  104193. const float SHIFT_LEFT12 = 4096.0;
  104194. const float SHIFT_LEFT8 = 256.0;
  104195. const float SHIFT_LEFT7 = 128.0;
  104196. const float SHIFT_LEFT5 = 32.0;
  104197. const float SHIFT_LEFT3 = 8.0;
  104198. const float SHIFT_LEFT2 = 4.0;
  104199. const float SHIFT_LEFT1 = 2.0;
  104200. const float SHIFT_RIGHT12 = 1.0 / 4096.0;
  104201. const float SHIFT_RIGHT8 = 1.0 / 256.0;
  104202. const float SHIFT_RIGHT7 = 1.0 / 128.0;
  104203. const float SHIFT_RIGHT5 = 1.0 / 32.0;
  104204. const float SHIFT_RIGHT3 = 1.0 / 8.0;
  104205. const float SHIFT_RIGHT2 = 1.0 / 4.0;
  104206. const float SHIFT_RIGHT1 = 1.0 / 2.0;
  104207. vec4 addScreenSpaceOffset(vec4 positionEC, vec2 imageSize, float scale, vec2 direction, vec2 origin, vec2 translate, vec2 pixelOffset, vec3 alignedAxis, bool validAlignedAxis, float rotation, bool sizeInMeters, out mat2 rotationMatrix, out float mpp)
  104208. {
  104209. // Note the halfSize cannot be computed in JavaScript because it is sent via
  104210. // compressed vertex attributes that coerce it to an integer.
  104211. vec2 halfSize = imageSize * scale * 0.5;
  104212. halfSize *= ((direction * 2.0) - 1.0);
  104213. vec2 originTranslate = origin * abs(halfSize);
  104214. #if defined(ROTATION) || defined(ALIGNED_AXIS)
  104215. if (validAlignedAxis || rotation != 0.0)
  104216. {
  104217. float angle = rotation;
  104218. if (validAlignedAxis)
  104219. {
  104220. vec4 projectedAlignedAxis = czm_modelViewProjection * vec4(alignedAxis, 0.0);
  104221. angle += sign(-projectedAlignedAxis.x) * acos(sign(projectedAlignedAxis.y) * (projectedAlignedAxis.y * projectedAlignedAxis.y) /
  104222. (projectedAlignedAxis.x * projectedAlignedAxis.x + projectedAlignedAxis.y * projectedAlignedAxis.y));
  104223. }
  104224. float cosTheta = cos(angle);
  104225. float sinTheta = sin(angle);
  104226. rotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);
  104227. halfSize = rotationMatrix * halfSize;
  104228. }
  104229. else
  104230. {
  104231. rotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);
  104232. }
  104233. #endif
  104234. mpp = czm_metersPerPixel(positionEC);
  104235. positionEC.xy += (originTranslate + halfSize) * czm_branchFreeTernary(sizeInMeters, 1.0, mpp);
  104236. positionEC.xy += (translate + pixelOffset) * mpp;
  104237. return positionEC;
  104238. }
  104239. #ifdef VERTEX_DEPTH_CHECK
  104240. float getGlobeDepth(vec4 positionEC)
  104241. {
  104242. vec4 posWC = czm_eyeToWindowCoordinates(positionEC);
  104243. float globeDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, posWC.xy / czm_viewport.zw));
  104244. if (globeDepth == 0.0)
  104245. {
  104246. return 0.0; // not on the globe
  104247. }
  104248. vec4 eyeCoordinate = czm_windowToEyeCoordinates(posWC.xy, globeDepth);
  104249. return eyeCoordinate.z / eyeCoordinate.w;
  104250. }
  104251. #endif
  104252. void main()
  104253. {
  104254. // Modifying this shader may also require modifications to Billboard._computeScreenSpacePosition
  104255. // unpack attributes
  104256. vec3 positionHigh = positionHighAndScale.xyz;
  104257. vec3 positionLow = positionLowAndRotation.xyz;
  104258. float scale = positionHighAndScale.w;
  104259. #if defined(ROTATION) || defined(ALIGNED_AXIS)
  104260. float rotation = positionLowAndRotation.w;
  104261. #else
  104262. float rotation = 0.0;
  104263. #endif
  104264. float compressed = compressedAttribute0.x;
  104265. vec2 pixelOffset;
  104266. pixelOffset.x = floor(compressed * SHIFT_RIGHT7);
  104267. compressed -= pixelOffset.x * SHIFT_LEFT7;
  104268. pixelOffset.x -= UPPER_BOUND;
  104269. vec2 origin;
  104270. origin.x = floor(compressed * SHIFT_RIGHT5);
  104271. compressed -= origin.x * SHIFT_LEFT5;
  104272. origin.y = floor(compressed * SHIFT_RIGHT3);
  104273. compressed -= origin.y * SHIFT_LEFT3;
  104274. #ifdef FRAGMENT_DEPTH_CHECK
  104275. vec2 depthOrigin = origin.xy;
  104276. #endif
  104277. origin -= vec2(1.0);
  104278. float show = floor(compressed * SHIFT_RIGHT2);
  104279. compressed -= show * SHIFT_LEFT2;
  104280. #ifdef INSTANCED
  104281. vec2 textureCoordinatesBottomLeft = czm_decompressTextureCoordinates(compressedAttribute0.w);
  104282. vec2 textureCoordinatesRange = czm_decompressTextureCoordinates(eyeOffset.w);
  104283. vec2 textureCoordinates = textureCoordinatesBottomLeft + direction * textureCoordinatesRange;
  104284. #else
  104285. vec2 direction;
  104286. direction.x = floor(compressed * SHIFT_RIGHT1);
  104287. direction.y = compressed - direction.x * SHIFT_LEFT1;
  104288. vec2 textureCoordinates = czm_decompressTextureCoordinates(compressedAttribute0.w);
  104289. #endif
  104290. float temp = compressedAttribute0.y * SHIFT_RIGHT8;
  104291. pixelOffset.y = -(floor(temp) - UPPER_BOUND);
  104292. vec2 translate;
  104293. translate.y = (temp - floor(temp)) * SHIFT_LEFT16;
  104294. temp = compressedAttribute0.z * SHIFT_RIGHT8;
  104295. translate.x = floor(temp) - UPPER_BOUND;
  104296. translate.y += (temp - floor(temp)) * SHIFT_LEFT8;
  104297. translate.y -= UPPER_BOUND;
  104298. temp = compressedAttribute1.x * SHIFT_RIGHT8;
  104299. float temp2 = floor(compressedAttribute2.w * SHIFT_RIGHT2);
  104300. vec2 imageSize = vec2(floor(temp), temp2);
  104301. #ifdef FRAGMENT_DEPTH_CHECK
  104302. float labelHorizontalOrigin = floor(compressedAttribute2.w - (temp2 * SHIFT_LEFT2));
  104303. float applyTranslate = 0.0;
  104304. if (labelHorizontalOrigin != 0.0) // is a billboard, so set apply translate to false
  104305. {
  104306. applyTranslate = 1.0;
  104307. labelHorizontalOrigin -= 2.0;
  104308. depthOrigin.x = labelHorizontalOrigin + 1.0;
  104309. }
  104310. depthOrigin = vec2(1.0) - (depthOrigin * 0.5);
  104311. #endif
  104312. #ifdef EYE_DISTANCE_TRANSLUCENCY
  104313. vec4 translucencyByDistance;
  104314. translucencyByDistance.x = compressedAttribute1.z;
  104315. translucencyByDistance.z = compressedAttribute1.w;
  104316. translucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;
  104317. temp = compressedAttribute1.y * SHIFT_RIGHT8;
  104318. translucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;
  104319. #endif
  104320. #if defined(VERTEX_DEPTH_CHECK) || defined(FRAGMENT_DEPTH_CHECK)
  104321. temp = compressedAttribute3.w;
  104322. temp = temp * SHIFT_RIGHT12;
  104323. vec2 dimensions;
  104324. dimensions.y = (temp - floor(temp)) * SHIFT_LEFT12;
  104325. dimensions.x = floor(temp);
  104326. #endif
  104327. #ifdef ALIGNED_AXIS
  104328. vec3 alignedAxis = czm_octDecode(floor(compressedAttribute1.y * SHIFT_RIGHT8));
  104329. temp = compressedAttribute2.z * SHIFT_RIGHT5;
  104330. bool validAlignedAxis = (temp - floor(temp)) * SHIFT_LEFT1 > 0.0;
  104331. #else
  104332. vec3 alignedAxis = vec3(0.0);
  104333. bool validAlignedAxis = false;
  104334. #endif
  104335. vec4 pickColor;
  104336. vec4 color;
  104337. temp = compressedAttribute2.y;
  104338. temp = temp * SHIFT_RIGHT8;
  104339. pickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;
  104340. temp = floor(temp) * SHIFT_RIGHT8;
  104341. pickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;
  104342. pickColor.r = floor(temp);
  104343. temp = compressedAttribute2.x;
  104344. temp = temp * SHIFT_RIGHT8;
  104345. color.b = (temp - floor(temp)) * SHIFT_LEFT8;
  104346. temp = floor(temp) * SHIFT_RIGHT8;
  104347. color.g = (temp - floor(temp)) * SHIFT_LEFT8;
  104348. color.r = floor(temp);
  104349. temp = compressedAttribute2.z * SHIFT_RIGHT8;
  104350. bool sizeInMeters = floor((temp - floor(temp)) * SHIFT_LEFT7) > 0.0;
  104351. temp = floor(temp) * SHIFT_RIGHT8;
  104352. pickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;
  104353. pickColor /= 255.0;
  104354. color.a = floor(temp);
  104355. color /= 255.0;
  104356. ///////////////////////////////////////////////////////////////////////////
  104357. vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);
  104358. vec4 positionEC = czm_modelViewRelativeToEye * p;
  104359. #if defined(FRAGMENT_DEPTH_CHECK) || defined(VERTEX_DEPTH_CHECK)
  104360. float eyeDepth = positionEC.z;
  104361. #endif
  104362. positionEC = czm_eyeOffset(positionEC, eyeOffset.xyz);
  104363. positionEC.xyz *= show;
  104364. ///////////////////////////////////////////////////////////////////////////
  104365. #if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(EYE_DISTANCE_PIXEL_OFFSET) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE)
  104366. float lengthSq;
  104367. if (czm_sceneMode == czm_sceneMode2D)
  104368. {
  104369. // 2D camera distance is a special case
  104370. // treat all billboards as flattened to the z=0.0 plane
  104371. lengthSq = czm_eyeHeight2D.y;
  104372. }
  104373. else
  104374. {
  104375. lengthSq = dot(positionEC.xyz, positionEC.xyz);
  104376. }
  104377. #endif
  104378. #ifdef EYE_DISTANCE_SCALING
  104379. float distanceScale = czm_nearFarScalar(scaleByDistance, lengthSq);
  104380. scale *= distanceScale;
  104381. translate *= distanceScale;
  104382. // push vertex behind near plane for clipping
  104383. if (scale == 0.0)
  104384. {
  104385. positionEC.xyz = vec3(0.0);
  104386. }
  104387. #endif
  104388. float translucency = 1.0;
  104389. #ifdef EYE_DISTANCE_TRANSLUCENCY
  104390. translucency = czm_nearFarScalar(translucencyByDistance, lengthSq);
  104391. // push vertex behind near plane for clipping
  104392. if (translucency == 0.0)
  104393. {
  104394. positionEC.xyz = vec3(0.0);
  104395. }
  104396. #endif
  104397. #ifdef EYE_DISTANCE_PIXEL_OFFSET
  104398. float pixelOffsetScale = czm_nearFarScalar(pixelOffsetScaleByDistance, lengthSq);
  104399. pixelOffset *= pixelOffsetScale;
  104400. #endif
  104401. #ifdef DISTANCE_DISPLAY_CONDITION
  104402. float nearSq = compressedAttribute3.x;
  104403. float farSq = compressedAttribute3.y;
  104404. if (lengthSq < nearSq || lengthSq > farSq)
  104405. {
  104406. positionEC.xyz = vec3(0.0);
  104407. }
  104408. #endif
  104409. mat2 rotationMatrix;
  104410. float mpp;
  104411. #ifdef DISABLE_DEPTH_DISTANCE
  104412. float disableDepthTestDistance = compressedAttribute3.z;
  104413. #endif
  104414. #ifdef VERTEX_DEPTH_CHECK
  104415. if (lengthSq < disableDepthTestDistance) {
  104416. float depthsilon = 10.0;
  104417. vec2 labelTranslate = textureCoordinateBoundsOrLabelTranslate.xy;
  104418. vec4 pEC1 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
  104419. float globeDepth1 = getGlobeDepth(pEC1);
  104420. if (globeDepth1 != 0.0 && pEC1.z + depthsilon < globeDepth1)
  104421. {
  104422. vec4 pEC2 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0, 1.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
  104423. float globeDepth2 = getGlobeDepth(pEC2);
  104424. if (globeDepth2 != 0.0 && pEC2.z + depthsilon < globeDepth2)
  104425. {
  104426. vec4 pEC3 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(1.0), origin, labelTranslate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
  104427. float globeDepth3 = getGlobeDepth(pEC3);
  104428. if (globeDepth3 != 0.0 && pEC3.z + depthsilon < globeDepth3)
  104429. {
  104430. positionEC.xyz = vec3(0.0);
  104431. }
  104432. }
  104433. }
  104434. }
  104435. #endif
  104436. positionEC = addScreenSpaceOffset(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
  104437. gl_Position = czm_projection * positionEC;
  104438. v_textureCoordinates = textureCoordinates;
  104439. #ifdef LOG_DEPTH
  104440. czm_vertexLogDepth();
  104441. #endif
  104442. #ifdef DISABLE_DEPTH_DISTANCE
  104443. if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)
  104444. {
  104445. disableDepthTestDistance = czm_minimumDisableDepthTestDistance;
  104446. }
  104447. if (disableDepthTestDistance != 0.0)
  104448. {
  104449. // Don't try to "multiply both sides" by w. Greater/less-than comparisons won't work for negative values of w.
  104450. float zclip = gl_Position.z / gl_Position.w;
  104451. bool clipped = (zclip < -1.0 || zclip > 1.0);
  104452. if (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))
  104453. {
  104454. // Position z on the near plane.
  104455. gl_Position.z = -gl_Position.w;
  104456. #ifdef LOG_DEPTH
  104457. v_depthFromNearPlusOne = 1.0;
  104458. #endif
  104459. }
  104460. }
  104461. #endif
  104462. #ifdef FRAGMENT_DEPTH_CHECK
  104463. if (sizeInMeters) {
  104464. translate /= mpp;
  104465. dimensions /= mpp;
  104466. imageSize /= mpp;
  104467. }
  104468. #if defined(ROTATION) || defined(ALIGNED_AXIS)
  104469. v_rotationMatrix = rotationMatrix;
  104470. #else
  104471. v_rotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);
  104472. #endif
  104473. float enableDepthCheck = 0.0;
  104474. if (lengthSq < disableDepthTestDistance)
  104475. {
  104476. enableDepthCheck = 1.0;
  104477. }
  104478. float dw = floor(clamp(dimensions.x, 0.0, SHIFT_LEFT12));
  104479. float dh = floor(clamp(dimensions.y, 0.0, SHIFT_LEFT12));
  104480. float iw = floor(clamp(imageSize.x, 0.0, SHIFT_LEFT12));
  104481. float ih = floor(clamp(imageSize.y, 0.0, SHIFT_LEFT12));
  104482. v_compressed.x = eyeDepth;
  104483. v_compressed.y = applyTranslate * SHIFT_LEFT1 + enableDepthCheck;
  104484. v_compressed.z = dw * SHIFT_LEFT12 + dh;
  104485. v_compressed.w = iw * SHIFT_LEFT12 + ih;
  104486. v_originTextureCoordinateAndTranslate.xy = depthOrigin;
  104487. v_originTextureCoordinateAndTranslate.zw = translate;
  104488. v_textureCoordinateBounds = textureCoordinateBoundsOrLabelTranslate;
  104489. #endif
  104490. #ifdef SDF
  104491. vec4 outlineColor;
  104492. float outlineWidth;
  104493. temp = sdf.x;
  104494. temp = temp * SHIFT_RIGHT8;
  104495. outlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;
  104496. temp = floor(temp) * SHIFT_RIGHT8;
  104497. outlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;
  104498. outlineColor.r = floor(temp);
  104499. temp = sdf.y;
  104500. temp = temp * SHIFT_RIGHT8;
  104501. float temp3 = (temp - floor(temp)) * SHIFT_LEFT8;
  104502. temp = floor(temp) * SHIFT_RIGHT8;
  104503. outlineWidth = (temp - floor(temp)) * SHIFT_LEFT8;
  104504. outlineColor.a = floor(temp);
  104505. outlineColor /= 255.0;
  104506. v_outlineWidth = outlineWidth / 255.0;
  104507. v_outlineColor = outlineColor;
  104508. v_outlineColor.a *= translucency;
  104509. #endif
  104510. v_pickColor = pickColor;
  104511. v_color = color;
  104512. v_color.a *= translucency;
  104513. }
  104514. `;
  104515. // node_modules/cesium/Source/Scene/SceneTransforms.js
  104516. var SceneTransforms = {};
  104517. var actualPositionScratch = new Cartesian4_default(0, 0, 0, 1);
  104518. var positionCC = new Cartesian4_default();
  104519. var scratchViewport2 = new BoundingRectangle_default();
  104520. var scratchWindowCoord0 = new Cartesian2_default();
  104521. var scratchWindowCoord1 = new Cartesian2_default();
  104522. SceneTransforms.wgs84ToWindowCoordinates = function(scene, position, result) {
  104523. return SceneTransforms.wgs84WithEyeOffsetToWindowCoordinates(
  104524. scene,
  104525. position,
  104526. Cartesian3_default.ZERO,
  104527. result
  104528. );
  104529. };
  104530. var scratchCartesian44 = new Cartesian4_default();
  104531. var scratchEyeOffset = new Cartesian3_default();
  104532. function worldToClip(position, eyeOffset, camera, result) {
  104533. const viewMatrix = camera.viewMatrix;
  104534. const positionEC = Matrix4_default.multiplyByVector(
  104535. viewMatrix,
  104536. Cartesian4_default.fromElements(
  104537. position.x,
  104538. position.y,
  104539. position.z,
  104540. 1,
  104541. scratchCartesian44
  104542. ),
  104543. scratchCartesian44
  104544. );
  104545. const zEyeOffset = Cartesian3_default.multiplyComponents(
  104546. eyeOffset,
  104547. Cartesian3_default.normalize(positionEC, scratchEyeOffset),
  104548. scratchEyeOffset
  104549. );
  104550. positionEC.x += eyeOffset.x + zEyeOffset.x;
  104551. positionEC.y += eyeOffset.y + zEyeOffset.y;
  104552. positionEC.z += zEyeOffset.z;
  104553. return Matrix4_default.multiplyByVector(
  104554. camera.frustum.projectionMatrix,
  104555. positionEC,
  104556. result
  104557. );
  104558. }
  104559. var scratchMaxCartographic = new Cartographic_default(
  104560. Math.PI,
  104561. Math_default.PI_OVER_TWO
  104562. );
  104563. var scratchProjectedCartesian = new Cartesian3_default();
  104564. var scratchCameraPosition = new Cartesian3_default();
  104565. SceneTransforms.wgs84WithEyeOffsetToWindowCoordinates = function(scene, position, eyeOffset, result) {
  104566. if (!defined_default(scene)) {
  104567. throw new DeveloperError_default("scene is required.");
  104568. }
  104569. if (!defined_default(position)) {
  104570. throw new DeveloperError_default("position is required.");
  104571. }
  104572. const frameState = scene.frameState;
  104573. const actualPosition = SceneTransforms.computeActualWgs84Position(
  104574. frameState,
  104575. position,
  104576. actualPositionScratch
  104577. );
  104578. if (!defined_default(actualPosition)) {
  104579. return void 0;
  104580. }
  104581. const canvas = scene.canvas;
  104582. const viewport = scratchViewport2;
  104583. viewport.x = 0;
  104584. viewport.y = 0;
  104585. viewport.width = canvas.clientWidth;
  104586. viewport.height = canvas.clientHeight;
  104587. const camera = scene.camera;
  104588. let cameraCentered = false;
  104589. if (frameState.mode === SceneMode_default.SCENE2D) {
  104590. const projection = scene.mapProjection;
  104591. const maxCartographic = scratchMaxCartographic;
  104592. const maxCoord = projection.project(
  104593. maxCartographic,
  104594. scratchProjectedCartesian
  104595. );
  104596. const cameraPosition = Cartesian3_default.clone(
  104597. camera.position,
  104598. scratchCameraPosition
  104599. );
  104600. const frustum = camera.frustum.clone();
  104601. const viewportTransformation = Matrix4_default.computeViewportTransformation(
  104602. viewport,
  104603. 0,
  104604. 1,
  104605. new Matrix4_default()
  104606. );
  104607. const projectionMatrix = camera.frustum.projectionMatrix;
  104608. const x = camera.positionWC.y;
  104609. const eyePoint = Cartesian3_default.fromElements(
  104610. Math_default.sign(x) * maxCoord.x - x,
  104611. 0,
  104612. -camera.positionWC.x
  104613. );
  104614. const windowCoordinates = Transforms_default.pointToGLWindowCoordinates(
  104615. projectionMatrix,
  104616. viewportTransformation,
  104617. eyePoint
  104618. );
  104619. if (x === 0 || windowCoordinates.x <= 0 || windowCoordinates.x >= canvas.clientWidth) {
  104620. cameraCentered = true;
  104621. } else {
  104622. if (windowCoordinates.x > canvas.clientWidth * 0.5) {
  104623. viewport.width = windowCoordinates.x;
  104624. camera.frustum.right = maxCoord.x - x;
  104625. positionCC = worldToClip(actualPosition, eyeOffset, camera, positionCC);
  104626. SceneTransforms.clipToGLWindowCoordinates(
  104627. viewport,
  104628. positionCC,
  104629. scratchWindowCoord0
  104630. );
  104631. viewport.x += windowCoordinates.x;
  104632. camera.position.x = -camera.position.x;
  104633. const right = camera.frustum.right;
  104634. camera.frustum.right = -camera.frustum.left;
  104635. camera.frustum.left = -right;
  104636. positionCC = worldToClip(actualPosition, eyeOffset, camera, positionCC);
  104637. SceneTransforms.clipToGLWindowCoordinates(
  104638. viewport,
  104639. positionCC,
  104640. scratchWindowCoord1
  104641. );
  104642. } else {
  104643. viewport.x += windowCoordinates.x;
  104644. viewport.width -= windowCoordinates.x;
  104645. camera.frustum.left = -maxCoord.x - x;
  104646. positionCC = worldToClip(actualPosition, eyeOffset, camera, positionCC);
  104647. SceneTransforms.clipToGLWindowCoordinates(
  104648. viewport,
  104649. positionCC,
  104650. scratchWindowCoord0
  104651. );
  104652. viewport.x = viewport.x - viewport.width;
  104653. camera.position.x = -camera.position.x;
  104654. const left = camera.frustum.left;
  104655. camera.frustum.left = -camera.frustum.right;
  104656. camera.frustum.right = -left;
  104657. positionCC = worldToClip(actualPosition, eyeOffset, camera, positionCC);
  104658. SceneTransforms.clipToGLWindowCoordinates(
  104659. viewport,
  104660. positionCC,
  104661. scratchWindowCoord1
  104662. );
  104663. }
  104664. Cartesian3_default.clone(cameraPosition, camera.position);
  104665. camera.frustum = frustum.clone();
  104666. result = Cartesian2_default.clone(scratchWindowCoord0, result);
  104667. if (result.x < 0 || result.x > canvas.clientWidth) {
  104668. result.x = scratchWindowCoord1.x;
  104669. }
  104670. }
  104671. }
  104672. if (frameState.mode !== SceneMode_default.SCENE2D || cameraCentered) {
  104673. positionCC = worldToClip(actualPosition, eyeOffset, camera, positionCC);
  104674. if (positionCC.z < 0 && !(camera.frustum instanceof OrthographicFrustum_default) && !(camera.frustum instanceof OrthographicOffCenterFrustum_default)) {
  104675. return void 0;
  104676. }
  104677. result = SceneTransforms.clipToGLWindowCoordinates(
  104678. viewport,
  104679. positionCC,
  104680. result
  104681. );
  104682. }
  104683. result.y = canvas.clientHeight - result.y;
  104684. return result;
  104685. };
  104686. SceneTransforms.wgs84ToDrawingBufferCoordinates = function(scene, position, result) {
  104687. result = SceneTransforms.wgs84ToWindowCoordinates(scene, position, result);
  104688. if (!defined_default(result)) {
  104689. return void 0;
  104690. }
  104691. return SceneTransforms.transformWindowToDrawingBuffer(scene, result, result);
  104692. };
  104693. var projectedPosition = new Cartesian3_default();
  104694. var positionInCartographic = new Cartographic_default();
  104695. SceneTransforms.computeActualWgs84Position = function(frameState, position, result) {
  104696. const mode2 = frameState.mode;
  104697. if (mode2 === SceneMode_default.SCENE3D) {
  104698. return Cartesian3_default.clone(position, result);
  104699. }
  104700. const projection = frameState.mapProjection;
  104701. const cartographic2 = projection.ellipsoid.cartesianToCartographic(
  104702. position,
  104703. positionInCartographic
  104704. );
  104705. if (!defined_default(cartographic2)) {
  104706. return void 0;
  104707. }
  104708. projection.project(cartographic2, projectedPosition);
  104709. if (mode2 === SceneMode_default.COLUMBUS_VIEW) {
  104710. return Cartesian3_default.fromElements(
  104711. projectedPosition.z,
  104712. projectedPosition.x,
  104713. projectedPosition.y,
  104714. result
  104715. );
  104716. }
  104717. if (mode2 === SceneMode_default.SCENE2D) {
  104718. return Cartesian3_default.fromElements(
  104719. 0,
  104720. projectedPosition.x,
  104721. projectedPosition.y,
  104722. result
  104723. );
  104724. }
  104725. const morphTime = frameState.morphTime;
  104726. return Cartesian3_default.fromElements(
  104727. Math_default.lerp(projectedPosition.z, position.x, morphTime),
  104728. Math_default.lerp(projectedPosition.x, position.y, morphTime),
  104729. Math_default.lerp(projectedPosition.y, position.z, morphTime),
  104730. result
  104731. );
  104732. };
  104733. var positionNDC = new Cartesian3_default();
  104734. var positionWC = new Cartesian3_default();
  104735. var viewportTransform = new Matrix4_default();
  104736. SceneTransforms.clipToGLWindowCoordinates = function(viewport, position, result) {
  104737. Cartesian3_default.divideByScalar(position, position.w, positionNDC);
  104738. Matrix4_default.computeViewportTransformation(viewport, 0, 1, viewportTransform);
  104739. Matrix4_default.multiplyByPoint(viewportTransform, positionNDC, positionWC);
  104740. return Cartesian2_default.fromCartesian3(positionWC, result);
  104741. };
  104742. SceneTransforms.transformWindowToDrawingBuffer = function(scene, windowPosition, result) {
  104743. const canvas = scene.canvas;
  104744. const xScale = scene.drawingBufferWidth / canvas.clientWidth;
  104745. const yScale = scene.drawingBufferHeight / canvas.clientHeight;
  104746. return Cartesian2_default.fromElements(
  104747. windowPosition.x * xScale,
  104748. windowPosition.y * yScale,
  104749. result
  104750. );
  104751. };
  104752. var scratchNDC = new Cartesian4_default();
  104753. var scratchWorldCoords = new Cartesian4_default();
  104754. SceneTransforms.drawingBufferToWgs84Coordinates = function(scene, drawingBufferPosition, depth, result) {
  104755. const context = scene.context;
  104756. const uniformState = context.uniformState;
  104757. const currentFrustum = uniformState.currentFrustum;
  104758. const near = currentFrustum.x;
  104759. const far = currentFrustum.y;
  104760. if (scene.frameState.useLogDepth) {
  104761. const log2Depth = depth * uniformState.log2FarDepthFromNearPlusOne;
  104762. const depthFromNear = Math.pow(2, log2Depth) - 1;
  104763. depth = far * (1 - near / (depthFromNear + near)) / (far - near);
  104764. }
  104765. const viewport = scene.view.passState.viewport;
  104766. const ndc = Cartesian4_default.clone(Cartesian4_default.UNIT_W, scratchNDC);
  104767. ndc.x = (drawingBufferPosition.x - viewport.x) / viewport.width * 2 - 1;
  104768. ndc.y = (drawingBufferPosition.y - viewport.y) / viewport.height * 2 - 1;
  104769. ndc.z = depth * 2 - 1;
  104770. ndc.w = 1;
  104771. let worldCoords;
  104772. let frustum = scene.camera.frustum;
  104773. if (!defined_default(frustum.fovy)) {
  104774. if (defined_default(frustum._offCenterFrustum)) {
  104775. frustum = frustum._offCenterFrustum;
  104776. }
  104777. worldCoords = scratchWorldCoords;
  104778. worldCoords.x = (ndc.x * (frustum.right - frustum.left) + frustum.left + frustum.right) * 0.5;
  104779. worldCoords.y = (ndc.y * (frustum.top - frustum.bottom) + frustum.bottom + frustum.top) * 0.5;
  104780. worldCoords.z = (ndc.z * (near - far) - near - far) * 0.5;
  104781. worldCoords.w = 1;
  104782. worldCoords = Matrix4_default.multiplyByVector(
  104783. uniformState.inverseView,
  104784. worldCoords,
  104785. worldCoords
  104786. );
  104787. } else {
  104788. worldCoords = Matrix4_default.multiplyByVector(
  104789. uniformState.inverseViewProjection,
  104790. ndc,
  104791. scratchWorldCoords
  104792. );
  104793. const w = 1 / worldCoords.w;
  104794. Cartesian3_default.multiplyByScalar(worldCoords, w, worldCoords);
  104795. }
  104796. return Cartesian3_default.fromCartesian4(worldCoords, result);
  104797. };
  104798. var SceneTransforms_default = SceneTransforms;
  104799. // node_modules/cesium/Source/Scene/Billboard.js
  104800. function Billboard(options, billboardCollection) {
  104801. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  104802. if (defined_default(options.disableDepthTestDistance) && options.disableDepthTestDistance < 0) {
  104803. throw new DeveloperError_default(
  104804. "disableDepthTestDistance must be greater than or equal to 0.0."
  104805. );
  104806. }
  104807. let translucencyByDistance = options.translucencyByDistance;
  104808. let pixelOffsetScaleByDistance = options.pixelOffsetScaleByDistance;
  104809. let scaleByDistance = options.scaleByDistance;
  104810. let distanceDisplayCondition = options.distanceDisplayCondition;
  104811. if (defined_default(translucencyByDistance)) {
  104812. if (translucencyByDistance.far <= translucencyByDistance.near) {
  104813. throw new DeveloperError_default(
  104814. "translucencyByDistance.far must be greater than translucencyByDistance.near."
  104815. );
  104816. }
  104817. translucencyByDistance = NearFarScalar_default.clone(translucencyByDistance);
  104818. }
  104819. if (defined_default(pixelOffsetScaleByDistance)) {
  104820. if (pixelOffsetScaleByDistance.far <= pixelOffsetScaleByDistance.near) {
  104821. throw new DeveloperError_default(
  104822. "pixelOffsetScaleByDistance.far must be greater than pixelOffsetScaleByDistance.near."
  104823. );
  104824. }
  104825. pixelOffsetScaleByDistance = NearFarScalar_default.clone(
  104826. pixelOffsetScaleByDistance
  104827. );
  104828. }
  104829. if (defined_default(scaleByDistance)) {
  104830. if (scaleByDistance.far <= scaleByDistance.near) {
  104831. throw new DeveloperError_default(
  104832. "scaleByDistance.far must be greater than scaleByDistance.near."
  104833. );
  104834. }
  104835. scaleByDistance = NearFarScalar_default.clone(scaleByDistance);
  104836. }
  104837. if (defined_default(distanceDisplayCondition)) {
  104838. if (distanceDisplayCondition.far <= distanceDisplayCondition.near) {
  104839. throw new DeveloperError_default(
  104840. "distanceDisplayCondition.far must be greater than distanceDisplayCondition.near."
  104841. );
  104842. }
  104843. distanceDisplayCondition = DistanceDisplayCondition_default.clone(
  104844. distanceDisplayCondition
  104845. );
  104846. }
  104847. this._show = defaultValue_default(options.show, true);
  104848. this._position = Cartesian3_default.clone(
  104849. defaultValue_default(options.position, Cartesian3_default.ZERO)
  104850. );
  104851. this._actualPosition = Cartesian3_default.clone(this._position);
  104852. this._pixelOffset = Cartesian2_default.clone(
  104853. defaultValue_default(options.pixelOffset, Cartesian2_default.ZERO)
  104854. );
  104855. this._translate = new Cartesian2_default(0, 0);
  104856. this._eyeOffset = Cartesian3_default.clone(
  104857. defaultValue_default(options.eyeOffset, Cartesian3_default.ZERO)
  104858. );
  104859. this._heightReference = defaultValue_default(
  104860. options.heightReference,
  104861. HeightReference_default.NONE
  104862. );
  104863. this._verticalOrigin = defaultValue_default(
  104864. options.verticalOrigin,
  104865. VerticalOrigin_default.CENTER
  104866. );
  104867. this._horizontalOrigin = defaultValue_default(
  104868. options.horizontalOrigin,
  104869. HorizontalOrigin_default.CENTER
  104870. );
  104871. this._scale = defaultValue_default(options.scale, 1);
  104872. this._color = Color_default.clone(defaultValue_default(options.color, Color_default.WHITE));
  104873. this._rotation = defaultValue_default(options.rotation, 0);
  104874. this._alignedAxis = Cartesian3_default.clone(
  104875. defaultValue_default(options.alignedAxis, Cartesian3_default.ZERO)
  104876. );
  104877. this._width = options.width;
  104878. this._height = options.height;
  104879. this._scaleByDistance = scaleByDistance;
  104880. this._translucencyByDistance = translucencyByDistance;
  104881. this._pixelOffsetScaleByDistance = pixelOffsetScaleByDistance;
  104882. this._sizeInMeters = defaultValue_default(options.sizeInMeters, false);
  104883. this._distanceDisplayCondition = distanceDisplayCondition;
  104884. this._disableDepthTestDistance = options.disableDepthTestDistance;
  104885. this._id = options.id;
  104886. this._collection = defaultValue_default(options.collection, billboardCollection);
  104887. this._pickId = void 0;
  104888. this._pickPrimitive = defaultValue_default(options._pickPrimitive, this);
  104889. this._billboardCollection = billboardCollection;
  104890. this._dirty = false;
  104891. this._index = -1;
  104892. this._batchIndex = void 0;
  104893. this._imageIndex = -1;
  104894. this._imageIndexPromise = void 0;
  104895. this._imageId = void 0;
  104896. this._image = void 0;
  104897. this._imageSubRegion = void 0;
  104898. this._imageWidth = void 0;
  104899. this._imageHeight = void 0;
  104900. this._labelDimensions = void 0;
  104901. this._labelHorizontalOrigin = void 0;
  104902. this._labelTranslate = void 0;
  104903. const image = options.image;
  104904. let imageId = options.imageId;
  104905. if (defined_default(image)) {
  104906. if (!defined_default(imageId)) {
  104907. if (typeof image === "string") {
  104908. imageId = image;
  104909. } else if (defined_default(image.src)) {
  104910. imageId = image.src;
  104911. } else {
  104912. imageId = createGuid_default();
  104913. }
  104914. }
  104915. this._imageId = imageId;
  104916. this._image = image;
  104917. }
  104918. if (defined_default(options.imageSubRegion)) {
  104919. this._imageId = imageId;
  104920. this._imageSubRegion = options.imageSubRegion;
  104921. }
  104922. if (defined_default(this._billboardCollection._textureAtlas)) {
  104923. this._loadImage();
  104924. }
  104925. this._actualClampedPosition = void 0;
  104926. this._removeCallbackFunc = void 0;
  104927. this._mode = SceneMode_default.SCENE3D;
  104928. this._clusterShow = true;
  104929. this._outlineColor = Color_default.clone(
  104930. defaultValue_default(options.outlineColor, Color_default.BLACK)
  104931. );
  104932. this._outlineWidth = defaultValue_default(options.outlineWidth, 0);
  104933. this._updateClamping();
  104934. }
  104935. var SHOW_INDEX = Billboard.SHOW_INDEX = 0;
  104936. var POSITION_INDEX = Billboard.POSITION_INDEX = 1;
  104937. var PIXEL_OFFSET_INDEX = Billboard.PIXEL_OFFSET_INDEX = 2;
  104938. var EYE_OFFSET_INDEX = Billboard.EYE_OFFSET_INDEX = 3;
  104939. var HORIZONTAL_ORIGIN_INDEX = Billboard.HORIZONTAL_ORIGIN_INDEX = 4;
  104940. var VERTICAL_ORIGIN_INDEX = Billboard.VERTICAL_ORIGIN_INDEX = 5;
  104941. var SCALE_INDEX = Billboard.SCALE_INDEX = 6;
  104942. var IMAGE_INDEX_INDEX = Billboard.IMAGE_INDEX_INDEX = 7;
  104943. var COLOR_INDEX = Billboard.COLOR_INDEX = 8;
  104944. var ROTATION_INDEX = Billboard.ROTATION_INDEX = 9;
  104945. var ALIGNED_AXIS_INDEX = Billboard.ALIGNED_AXIS_INDEX = 10;
  104946. var SCALE_BY_DISTANCE_INDEX = Billboard.SCALE_BY_DISTANCE_INDEX = 11;
  104947. var TRANSLUCENCY_BY_DISTANCE_INDEX = Billboard.TRANSLUCENCY_BY_DISTANCE_INDEX = 12;
  104948. var PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX = Billboard.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX = 13;
  104949. var DISTANCE_DISPLAY_CONDITION = Billboard.DISTANCE_DISPLAY_CONDITION = 14;
  104950. var DISABLE_DEPTH_DISTANCE = Billboard.DISABLE_DEPTH_DISTANCE = 15;
  104951. Billboard.TEXTURE_COORDINATE_BOUNDS = 16;
  104952. var SDF_INDEX = Billboard.SDF_INDEX = 17;
  104953. Billboard.NUMBER_OF_PROPERTIES = 18;
  104954. function makeDirty(billboard, propertyChanged) {
  104955. const billboardCollection = billboard._billboardCollection;
  104956. if (defined_default(billboardCollection)) {
  104957. billboardCollection._updateBillboard(billboard, propertyChanged);
  104958. billboard._dirty = true;
  104959. }
  104960. }
  104961. Object.defineProperties(Billboard.prototype, {
  104962. show: {
  104963. get: function() {
  104964. return this._show;
  104965. },
  104966. set: function(value) {
  104967. Check_default.typeOf.bool("value", value);
  104968. if (this._show !== value) {
  104969. this._show = value;
  104970. makeDirty(this, SHOW_INDEX);
  104971. }
  104972. }
  104973. },
  104974. position: {
  104975. get: function() {
  104976. return this._position;
  104977. },
  104978. set: function(value) {
  104979. Check_default.typeOf.object("value", value);
  104980. const position = this._position;
  104981. if (!Cartesian3_default.equals(position, value)) {
  104982. Cartesian3_default.clone(value, position);
  104983. Cartesian3_default.clone(value, this._actualPosition);
  104984. this._updateClamping();
  104985. makeDirty(this, POSITION_INDEX);
  104986. }
  104987. }
  104988. },
  104989. heightReference: {
  104990. get: function() {
  104991. return this._heightReference;
  104992. },
  104993. set: function(value) {
  104994. Check_default.typeOf.number("value", value);
  104995. const heightReference = this._heightReference;
  104996. if (value !== heightReference) {
  104997. this._heightReference = value;
  104998. this._updateClamping();
  104999. makeDirty(this, POSITION_INDEX);
  105000. }
  105001. }
  105002. },
  105003. pixelOffset: {
  105004. get: function() {
  105005. return this._pixelOffset;
  105006. },
  105007. set: function(value) {
  105008. Check_default.typeOf.object("value", value);
  105009. const pixelOffset = this._pixelOffset;
  105010. if (!Cartesian2_default.equals(pixelOffset, value)) {
  105011. Cartesian2_default.clone(value, pixelOffset);
  105012. makeDirty(this, PIXEL_OFFSET_INDEX);
  105013. }
  105014. }
  105015. },
  105016. scaleByDistance: {
  105017. get: function() {
  105018. return this._scaleByDistance;
  105019. },
  105020. set: function(value) {
  105021. if (defined_default(value)) {
  105022. Check_default.typeOf.object("value", value);
  105023. if (value.far <= value.near) {
  105024. throw new DeveloperError_default(
  105025. "far distance must be greater than near distance."
  105026. );
  105027. }
  105028. }
  105029. const scaleByDistance = this._scaleByDistance;
  105030. if (!NearFarScalar_default.equals(scaleByDistance, value)) {
  105031. this._scaleByDistance = NearFarScalar_default.clone(value, scaleByDistance);
  105032. makeDirty(this, SCALE_BY_DISTANCE_INDEX);
  105033. }
  105034. }
  105035. },
  105036. translucencyByDistance: {
  105037. get: function() {
  105038. return this._translucencyByDistance;
  105039. },
  105040. set: function(value) {
  105041. if (defined_default(value)) {
  105042. Check_default.typeOf.object("value", value);
  105043. if (value.far <= value.near) {
  105044. throw new DeveloperError_default(
  105045. "far distance must be greater than near distance."
  105046. );
  105047. }
  105048. }
  105049. const translucencyByDistance = this._translucencyByDistance;
  105050. if (!NearFarScalar_default.equals(translucencyByDistance, value)) {
  105051. this._translucencyByDistance = NearFarScalar_default.clone(
  105052. value,
  105053. translucencyByDistance
  105054. );
  105055. makeDirty(this, TRANSLUCENCY_BY_DISTANCE_INDEX);
  105056. }
  105057. }
  105058. },
  105059. pixelOffsetScaleByDistance: {
  105060. get: function() {
  105061. return this._pixelOffsetScaleByDistance;
  105062. },
  105063. set: function(value) {
  105064. if (defined_default(value)) {
  105065. Check_default.typeOf.object("value", value);
  105066. if (value.far <= value.near) {
  105067. throw new DeveloperError_default(
  105068. "far distance must be greater than near distance."
  105069. );
  105070. }
  105071. }
  105072. const pixelOffsetScaleByDistance = this._pixelOffsetScaleByDistance;
  105073. if (!NearFarScalar_default.equals(pixelOffsetScaleByDistance, value)) {
  105074. this._pixelOffsetScaleByDistance = NearFarScalar_default.clone(
  105075. value,
  105076. pixelOffsetScaleByDistance
  105077. );
  105078. makeDirty(this, PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX);
  105079. }
  105080. }
  105081. },
  105082. eyeOffset: {
  105083. get: function() {
  105084. return this._eyeOffset;
  105085. },
  105086. set: function(value) {
  105087. Check_default.typeOf.object("value", value);
  105088. const eyeOffset = this._eyeOffset;
  105089. if (!Cartesian3_default.equals(eyeOffset, value)) {
  105090. Cartesian3_default.clone(value, eyeOffset);
  105091. makeDirty(this, EYE_OFFSET_INDEX);
  105092. }
  105093. }
  105094. },
  105095. horizontalOrigin: {
  105096. get: function() {
  105097. return this._horizontalOrigin;
  105098. },
  105099. set: function(value) {
  105100. Check_default.typeOf.number("value", value);
  105101. if (this._horizontalOrigin !== value) {
  105102. this._horizontalOrigin = value;
  105103. makeDirty(this, HORIZONTAL_ORIGIN_INDEX);
  105104. }
  105105. }
  105106. },
  105107. verticalOrigin: {
  105108. get: function() {
  105109. return this._verticalOrigin;
  105110. },
  105111. set: function(value) {
  105112. Check_default.typeOf.number("value", value);
  105113. if (this._verticalOrigin !== value) {
  105114. this._verticalOrigin = value;
  105115. makeDirty(this, VERTICAL_ORIGIN_INDEX);
  105116. }
  105117. }
  105118. },
  105119. scale: {
  105120. get: function() {
  105121. return this._scale;
  105122. },
  105123. set: function(value) {
  105124. Check_default.typeOf.number("value", value);
  105125. if (this._scale !== value) {
  105126. this._scale = value;
  105127. makeDirty(this, SCALE_INDEX);
  105128. }
  105129. }
  105130. },
  105131. color: {
  105132. get: function() {
  105133. return this._color;
  105134. },
  105135. set: function(value) {
  105136. Check_default.typeOf.object("value", value);
  105137. const color = this._color;
  105138. if (!Color_default.equals(color, value)) {
  105139. Color_default.clone(value, color);
  105140. makeDirty(this, COLOR_INDEX);
  105141. }
  105142. }
  105143. },
  105144. rotation: {
  105145. get: function() {
  105146. return this._rotation;
  105147. },
  105148. set: function(value) {
  105149. Check_default.typeOf.number("value", value);
  105150. if (this._rotation !== value) {
  105151. this._rotation = value;
  105152. makeDirty(this, ROTATION_INDEX);
  105153. }
  105154. }
  105155. },
  105156. alignedAxis: {
  105157. get: function() {
  105158. return this._alignedAxis;
  105159. },
  105160. set: function(value) {
  105161. Check_default.typeOf.object("value", value);
  105162. const alignedAxis = this._alignedAxis;
  105163. if (!Cartesian3_default.equals(alignedAxis, value)) {
  105164. Cartesian3_default.clone(value, alignedAxis);
  105165. makeDirty(this, ALIGNED_AXIS_INDEX);
  105166. }
  105167. }
  105168. },
  105169. width: {
  105170. get: function() {
  105171. return defaultValue_default(this._width, this._imageWidth);
  105172. },
  105173. set: function(value) {
  105174. if (defined_default(value)) {
  105175. Check_default.typeOf.number("value", value);
  105176. }
  105177. if (this._width !== value) {
  105178. this._width = value;
  105179. makeDirty(this, IMAGE_INDEX_INDEX);
  105180. }
  105181. }
  105182. },
  105183. height: {
  105184. get: function() {
  105185. return defaultValue_default(this._height, this._imageHeight);
  105186. },
  105187. set: function(value) {
  105188. if (defined_default(value)) {
  105189. Check_default.typeOf.number("value", value);
  105190. }
  105191. if (this._height !== value) {
  105192. this._height = value;
  105193. makeDirty(this, IMAGE_INDEX_INDEX);
  105194. }
  105195. }
  105196. },
  105197. sizeInMeters: {
  105198. get: function() {
  105199. return this._sizeInMeters;
  105200. },
  105201. set: function(value) {
  105202. Check_default.typeOf.bool("value", value);
  105203. if (this._sizeInMeters !== value) {
  105204. this._sizeInMeters = value;
  105205. makeDirty(this, COLOR_INDEX);
  105206. }
  105207. }
  105208. },
  105209. distanceDisplayCondition: {
  105210. get: function() {
  105211. return this._distanceDisplayCondition;
  105212. },
  105213. set: function(value) {
  105214. if (!DistanceDisplayCondition_default.equals(value, this._distanceDisplayCondition)) {
  105215. if (defined_default(value)) {
  105216. Check_default.typeOf.object("value", value);
  105217. if (value.far <= value.near) {
  105218. throw new DeveloperError_default(
  105219. "far distance must be greater than near distance."
  105220. );
  105221. }
  105222. }
  105223. this._distanceDisplayCondition = DistanceDisplayCondition_default.clone(
  105224. value,
  105225. this._distanceDisplayCondition
  105226. );
  105227. makeDirty(this, DISTANCE_DISPLAY_CONDITION);
  105228. }
  105229. }
  105230. },
  105231. disableDepthTestDistance: {
  105232. get: function() {
  105233. return this._disableDepthTestDistance;
  105234. },
  105235. set: function(value) {
  105236. if (defined_default(value)) {
  105237. Check_default.typeOf.number("value", value);
  105238. if (value < 0) {
  105239. throw new DeveloperError_default(
  105240. "disableDepthTestDistance must be greater than or equal to 0.0."
  105241. );
  105242. }
  105243. }
  105244. if (this._disableDepthTestDistance !== value) {
  105245. this._disableDepthTestDistance = value;
  105246. makeDirty(this, DISABLE_DEPTH_DISTANCE);
  105247. }
  105248. }
  105249. },
  105250. id: {
  105251. get: function() {
  105252. return this._id;
  105253. },
  105254. set: function(value) {
  105255. this._id = value;
  105256. if (defined_default(this._pickId)) {
  105257. this._pickId.object.id = value;
  105258. }
  105259. }
  105260. },
  105261. pickPrimitive: {
  105262. get: function() {
  105263. return this._pickPrimitive;
  105264. },
  105265. set: function(value) {
  105266. this._pickPrimitive = value;
  105267. if (defined_default(this._pickId)) {
  105268. this._pickId.object.primitive = value;
  105269. }
  105270. }
  105271. },
  105272. pickId: {
  105273. get: function() {
  105274. return this._pickId;
  105275. }
  105276. },
  105277. image: {
  105278. get: function() {
  105279. return this._imageId;
  105280. },
  105281. set: function(value) {
  105282. if (!defined_default(value)) {
  105283. this._imageIndex = -1;
  105284. this._imageSubRegion = void 0;
  105285. this._imageId = void 0;
  105286. this._image = void 0;
  105287. this._imageIndexPromise = void 0;
  105288. makeDirty(this, IMAGE_INDEX_INDEX);
  105289. } else if (typeof value === "string") {
  105290. this.setImage(value, value);
  105291. } else if (value instanceof Resource_default) {
  105292. this.setImage(value.url, value);
  105293. } else if (defined_default(value.src)) {
  105294. this.setImage(value.src, value);
  105295. } else {
  105296. this.setImage(createGuid_default(), value);
  105297. }
  105298. }
  105299. },
  105300. ready: {
  105301. get: function() {
  105302. return this._imageIndex !== -1;
  105303. }
  105304. },
  105305. _clampedPosition: {
  105306. get: function() {
  105307. return this._actualClampedPosition;
  105308. },
  105309. set: function(value) {
  105310. this._actualClampedPosition = Cartesian3_default.clone(
  105311. value,
  105312. this._actualClampedPosition
  105313. );
  105314. makeDirty(this, POSITION_INDEX);
  105315. }
  105316. },
  105317. clusterShow: {
  105318. get: function() {
  105319. return this._clusterShow;
  105320. },
  105321. set: function(value) {
  105322. if (this._clusterShow !== value) {
  105323. this._clusterShow = value;
  105324. makeDirty(this, SHOW_INDEX);
  105325. }
  105326. }
  105327. },
  105328. outlineColor: {
  105329. get: function() {
  105330. return this._outlineColor;
  105331. },
  105332. set: function(value) {
  105333. if (!defined_default(value)) {
  105334. throw new DeveloperError_default("value is required.");
  105335. }
  105336. const outlineColor = this._outlineColor;
  105337. if (!Color_default.equals(outlineColor, value)) {
  105338. Color_default.clone(value, outlineColor);
  105339. makeDirty(this, SDF_INDEX);
  105340. }
  105341. }
  105342. },
  105343. outlineWidth: {
  105344. get: function() {
  105345. return this._outlineWidth;
  105346. },
  105347. set: function(value) {
  105348. if (this._outlineWidth !== value) {
  105349. this._outlineWidth = value;
  105350. makeDirty(this, SDF_INDEX);
  105351. }
  105352. }
  105353. }
  105354. });
  105355. Billboard.prototype.getPickId = function(context) {
  105356. if (!defined_default(this._pickId)) {
  105357. this._pickId = context.createPickId({
  105358. primitive: this._pickPrimitive,
  105359. collection: this._collection,
  105360. id: this._id
  105361. });
  105362. }
  105363. return this._pickId;
  105364. };
  105365. Billboard.prototype._updateClamping = function() {
  105366. Billboard._updateClamping(this._billboardCollection, this);
  105367. };
  105368. var scratchCartographic6 = new Cartographic_default();
  105369. var scratchPosition9 = new Cartesian3_default();
  105370. Billboard._updateClamping = function(collection, owner) {
  105371. const scene = collection._scene;
  105372. if (!defined_default(scene) || !defined_default(scene.globe)) {
  105373. if (owner._heightReference !== HeightReference_default.NONE) {
  105374. throw new DeveloperError_default(
  105375. "Height reference is not supported without a scene and globe."
  105376. );
  105377. }
  105378. return;
  105379. }
  105380. const globe = scene.globe;
  105381. const ellipsoid = globe.ellipsoid;
  105382. const surface = globe._surface;
  105383. const mode2 = scene.frameState.mode;
  105384. const modeChanged = mode2 !== owner._mode;
  105385. owner._mode = mode2;
  105386. if ((owner._heightReference === HeightReference_default.NONE || modeChanged) && defined_default(owner._removeCallbackFunc)) {
  105387. owner._removeCallbackFunc();
  105388. owner._removeCallbackFunc = void 0;
  105389. owner._clampedPosition = void 0;
  105390. }
  105391. if (owner._heightReference === HeightReference_default.NONE || !defined_default(owner._position)) {
  105392. return;
  105393. }
  105394. const position = ellipsoid.cartesianToCartographic(owner._position);
  105395. if (!defined_default(position)) {
  105396. owner._actualClampedPosition = void 0;
  105397. return;
  105398. }
  105399. if (defined_default(owner._removeCallbackFunc)) {
  105400. owner._removeCallbackFunc();
  105401. }
  105402. function updateFunction(clampedPosition) {
  105403. if (owner._heightReference === HeightReference_default.RELATIVE_TO_GROUND) {
  105404. if (owner._mode === SceneMode_default.SCENE3D) {
  105405. const clampedCart = ellipsoid.cartesianToCartographic(
  105406. clampedPosition,
  105407. scratchCartographic6
  105408. );
  105409. clampedCart.height += position.height;
  105410. ellipsoid.cartographicToCartesian(clampedCart, clampedPosition);
  105411. } else {
  105412. clampedPosition.x += position.height;
  105413. }
  105414. }
  105415. owner._clampedPosition = Cartesian3_default.clone(
  105416. clampedPosition,
  105417. owner._clampedPosition
  105418. );
  105419. }
  105420. owner._removeCallbackFunc = surface.updateHeight(position, updateFunction);
  105421. Cartographic_default.clone(position, scratchCartographic6);
  105422. const height = globe.getHeight(position);
  105423. if (defined_default(height)) {
  105424. scratchCartographic6.height = height;
  105425. }
  105426. ellipsoid.cartographicToCartesian(scratchCartographic6, scratchPosition9);
  105427. updateFunction(scratchPosition9);
  105428. };
  105429. Billboard.prototype._loadImage = function() {
  105430. const atlas = this._billboardCollection._textureAtlas;
  105431. const imageId = this._imageId;
  105432. const image = this._image;
  105433. const imageSubRegion = this._imageSubRegion;
  105434. let imageIndexPromise;
  105435. const that = this;
  105436. function completeImageLoad(index2) {
  105437. if (that._imageId !== imageId || that._image !== image || !BoundingRectangle_default.equals(that._imageSubRegion, imageSubRegion)) {
  105438. return;
  105439. }
  105440. const textureCoordinates = atlas.textureCoordinates[index2];
  105441. that._imageWidth = atlas.texture.width * textureCoordinates.width;
  105442. that._imageHeight = atlas.texture.height * textureCoordinates.height;
  105443. that._imageIndex = index2;
  105444. that._ready = true;
  105445. that._image = void 0;
  105446. that._imageIndexPromise = void 0;
  105447. makeDirty(that, IMAGE_INDEX_INDEX);
  105448. }
  105449. if (defined_default(image)) {
  105450. const index2 = atlas.getImageIndex(imageId);
  105451. if (defined_default(index2)) {
  105452. completeImageLoad(index2);
  105453. return;
  105454. }
  105455. imageIndexPromise = atlas.addImage(imageId, image);
  105456. }
  105457. if (defined_default(imageSubRegion)) {
  105458. imageIndexPromise = atlas.addSubRegion(imageId, imageSubRegion);
  105459. }
  105460. this._imageIndexPromise = imageIndexPromise;
  105461. if (!defined_default(imageIndexPromise)) {
  105462. return;
  105463. }
  105464. imageIndexPromise.then(completeImageLoad).catch(function(error) {
  105465. console.error(`Error loading image for billboard: ${error}`);
  105466. that._imageIndexPromise = void 0;
  105467. });
  105468. };
  105469. Billboard.prototype.setImage = function(id, image) {
  105470. if (!defined_default(id)) {
  105471. throw new DeveloperError_default("id is required.");
  105472. }
  105473. if (!defined_default(image)) {
  105474. throw new DeveloperError_default("image is required.");
  105475. }
  105476. if (this._imageId === id) {
  105477. return;
  105478. }
  105479. this._imageIndex = -1;
  105480. this._imageSubRegion = void 0;
  105481. this._imageId = id;
  105482. this._image = image;
  105483. if (defined_default(this._billboardCollection._textureAtlas)) {
  105484. this._loadImage();
  105485. }
  105486. };
  105487. Billboard.prototype.setImageSubRegion = function(id, subRegion) {
  105488. if (!defined_default(id)) {
  105489. throw new DeveloperError_default("id is required.");
  105490. }
  105491. if (!defined_default(subRegion)) {
  105492. throw new DeveloperError_default("subRegion is required.");
  105493. }
  105494. if (this._imageId === id && BoundingRectangle_default.equals(this._imageSubRegion, subRegion)) {
  105495. return;
  105496. }
  105497. this._imageIndex = -1;
  105498. this._imageId = id;
  105499. this._imageSubRegion = BoundingRectangle_default.clone(subRegion);
  105500. if (defined_default(this._billboardCollection._textureAtlas)) {
  105501. this._loadImage();
  105502. }
  105503. };
  105504. Billboard.prototype._setTranslate = function(value) {
  105505. if (!defined_default(value)) {
  105506. throw new DeveloperError_default("value is required.");
  105507. }
  105508. const translate = this._translate;
  105509. if (!Cartesian2_default.equals(translate, value)) {
  105510. Cartesian2_default.clone(value, translate);
  105511. makeDirty(this, PIXEL_OFFSET_INDEX);
  105512. }
  105513. };
  105514. Billboard.prototype._getActualPosition = function() {
  105515. return defined_default(this._clampedPosition) ? this._clampedPosition : this._actualPosition;
  105516. };
  105517. Billboard.prototype._setActualPosition = function(value) {
  105518. if (!defined_default(this._clampedPosition)) {
  105519. Cartesian3_default.clone(value, this._actualPosition);
  105520. }
  105521. makeDirty(this, POSITION_INDEX);
  105522. };
  105523. var tempCartesian3 = new Cartesian4_default();
  105524. Billboard._computeActualPosition = function(billboard, position, frameState, modelMatrix) {
  105525. if (defined_default(billboard._clampedPosition)) {
  105526. if (frameState.mode !== billboard._mode) {
  105527. billboard._updateClamping();
  105528. }
  105529. return billboard._clampedPosition;
  105530. } else if (frameState.mode === SceneMode_default.SCENE3D) {
  105531. return position;
  105532. }
  105533. Matrix4_default.multiplyByPoint(modelMatrix, position, tempCartesian3);
  105534. return SceneTransforms_default.computeActualWgs84Position(frameState, tempCartesian3);
  105535. };
  105536. var scratchCartesian310 = new Cartesian3_default();
  105537. Billboard._computeScreenSpacePosition = function(modelMatrix, position, eyeOffset, pixelOffset, scene, result) {
  105538. const positionWorld = Matrix4_default.multiplyByPoint(
  105539. modelMatrix,
  105540. position,
  105541. scratchCartesian310
  105542. );
  105543. const positionWC2 = SceneTransforms_default.wgs84WithEyeOffsetToWindowCoordinates(
  105544. scene,
  105545. positionWorld,
  105546. eyeOffset,
  105547. result
  105548. );
  105549. if (!defined_default(positionWC2)) {
  105550. return void 0;
  105551. }
  105552. Cartesian2_default.add(positionWC2, pixelOffset, positionWC2);
  105553. return positionWC2;
  105554. };
  105555. var scratchPixelOffset = new Cartesian2_default(0, 0);
  105556. Billboard.prototype.computeScreenSpacePosition = function(scene, result) {
  105557. const billboardCollection = this._billboardCollection;
  105558. if (!defined_default(result)) {
  105559. result = new Cartesian2_default();
  105560. }
  105561. if (!defined_default(billboardCollection)) {
  105562. throw new DeveloperError_default(
  105563. "Billboard must be in a collection. Was it removed?"
  105564. );
  105565. }
  105566. if (!defined_default(scene)) {
  105567. throw new DeveloperError_default("scene is required.");
  105568. }
  105569. Cartesian2_default.clone(this._pixelOffset, scratchPixelOffset);
  105570. Cartesian2_default.add(scratchPixelOffset, this._translate, scratchPixelOffset);
  105571. let modelMatrix = billboardCollection.modelMatrix;
  105572. let position = this._position;
  105573. if (defined_default(this._clampedPosition)) {
  105574. position = this._clampedPosition;
  105575. if (scene.mode !== SceneMode_default.SCENE3D) {
  105576. const projection = scene.mapProjection;
  105577. const ellipsoid = projection.ellipsoid;
  105578. const cart = projection.unproject(position, scratchCartographic6);
  105579. position = ellipsoid.cartographicToCartesian(cart, scratchCartesian310);
  105580. modelMatrix = Matrix4_default.IDENTITY;
  105581. }
  105582. }
  105583. const windowCoordinates = Billboard._computeScreenSpacePosition(
  105584. modelMatrix,
  105585. position,
  105586. this._eyeOffset,
  105587. scratchPixelOffset,
  105588. scene,
  105589. result
  105590. );
  105591. return windowCoordinates;
  105592. };
  105593. Billboard.getScreenSpaceBoundingBox = function(billboard, screenSpacePosition, result) {
  105594. let width = billboard.width;
  105595. let height = billboard.height;
  105596. const scale = billboard.scale;
  105597. width *= scale;
  105598. height *= scale;
  105599. let x = screenSpacePosition.x;
  105600. if (billboard.horizontalOrigin === HorizontalOrigin_default.RIGHT) {
  105601. x -= width;
  105602. } else if (billboard.horizontalOrigin === HorizontalOrigin_default.CENTER) {
  105603. x -= width * 0.5;
  105604. }
  105605. let y = screenSpacePosition.y;
  105606. if (billboard.verticalOrigin === VerticalOrigin_default.BOTTOM || billboard.verticalOrigin === VerticalOrigin_default.BASELINE) {
  105607. y -= height;
  105608. } else if (billboard.verticalOrigin === VerticalOrigin_default.CENTER) {
  105609. y -= height * 0.5;
  105610. }
  105611. if (!defined_default(result)) {
  105612. result = new BoundingRectangle_default();
  105613. }
  105614. result.x = x;
  105615. result.y = y;
  105616. result.width = width;
  105617. result.height = height;
  105618. return result;
  105619. };
  105620. Billboard.prototype.equals = function(other) {
  105621. return this === other || defined_default(other) && this._id === other._id && Cartesian3_default.equals(this._position, other._position) && this._imageId === other._imageId && this._show === other._show && this._scale === other._scale && this._verticalOrigin === other._verticalOrigin && this._horizontalOrigin === other._horizontalOrigin && this._heightReference === other._heightReference && BoundingRectangle_default.equals(this._imageSubRegion, other._imageSubRegion) && Color_default.equals(this._color, other._color) && Cartesian2_default.equals(this._pixelOffset, other._pixelOffset) && Cartesian2_default.equals(this._translate, other._translate) && Cartesian3_default.equals(this._eyeOffset, other._eyeOffset) && NearFarScalar_default.equals(this._scaleByDistance, other._scaleByDistance) && NearFarScalar_default.equals(
  105622. this._translucencyByDistance,
  105623. other._translucencyByDistance
  105624. ) && NearFarScalar_default.equals(
  105625. this._pixelOffsetScaleByDistance,
  105626. other._pixelOffsetScaleByDistance
  105627. ) && DistanceDisplayCondition_default.equals(
  105628. this._distanceDisplayCondition,
  105629. other._distanceDisplayCondition
  105630. ) && this._disableDepthTestDistance === other._disableDepthTestDistance;
  105631. };
  105632. Billboard.prototype._destroy = function() {
  105633. if (defined_default(this._customData)) {
  105634. this._billboardCollection._scene.globe._surface.removeTileCustomData(
  105635. this._customData
  105636. );
  105637. this._customData = void 0;
  105638. }
  105639. if (defined_default(this._removeCallbackFunc)) {
  105640. this._removeCallbackFunc();
  105641. this._removeCallbackFunc = void 0;
  105642. }
  105643. this.image = void 0;
  105644. this._pickId = this._pickId && this._pickId.destroy();
  105645. this._billboardCollection = void 0;
  105646. };
  105647. var Billboard_default = Billboard;
  105648. // node_modules/cesium/Source/Scene/BlendOption.js
  105649. var BlendOption = {
  105650. OPAQUE: 0,
  105651. TRANSLUCENT: 1,
  105652. OPAQUE_AND_TRANSLUCENT: 2
  105653. };
  105654. var BlendOption_default = Object.freeze(BlendOption);
  105655. // node_modules/cesium/Source/Scene/SDFSettings.js
  105656. var SDFSettings = {
  105657. FONT_SIZE: 48,
  105658. PADDING: 10,
  105659. RADIUS: 8,
  105660. CUTOFF: 0.25
  105661. };
  105662. var SDFSettings_default = Object.freeze(SDFSettings);
  105663. // node_modules/cesium/Source/Scene/TextureAtlas.js
  105664. function TextureAtlasNode(bottomLeft, topRight, childNode1, childNode2, imageIndex) {
  105665. this.bottomLeft = defaultValue_default(bottomLeft, Cartesian2_default.ZERO);
  105666. this.topRight = defaultValue_default(topRight, Cartesian2_default.ZERO);
  105667. this.childNode1 = childNode1;
  105668. this.childNode2 = childNode2;
  105669. this.imageIndex = imageIndex;
  105670. }
  105671. var defaultInitialSize = new Cartesian2_default(16, 16);
  105672. function TextureAtlas(options) {
  105673. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  105674. const borderWidthInPixels = defaultValue_default(options.borderWidthInPixels, 1);
  105675. const initialSize = defaultValue_default(options.initialSize, defaultInitialSize);
  105676. if (!defined_default(options.context)) {
  105677. throw new DeveloperError_default("context is required.");
  105678. }
  105679. if (borderWidthInPixels < 0) {
  105680. throw new DeveloperError_default(
  105681. "borderWidthInPixels must be greater than or equal to zero."
  105682. );
  105683. }
  105684. if (initialSize.x < 1 || initialSize.y < 1) {
  105685. throw new DeveloperError_default("initialSize must be greater than zero.");
  105686. }
  105687. this._context = options.context;
  105688. this._pixelFormat = defaultValue_default(options.pixelFormat, PixelFormat_default.RGBA);
  105689. this._borderWidthInPixels = borderWidthInPixels;
  105690. this._textureCoordinates = [];
  105691. this._guid = createGuid_default();
  105692. this._idHash = {};
  105693. this._indexHash = {};
  105694. this._initialSize = initialSize;
  105695. this._root = void 0;
  105696. }
  105697. Object.defineProperties(TextureAtlas.prototype, {
  105698. borderWidthInPixels: {
  105699. get: function() {
  105700. return this._borderWidthInPixels;
  105701. }
  105702. },
  105703. textureCoordinates: {
  105704. get: function() {
  105705. return this._textureCoordinates;
  105706. }
  105707. },
  105708. texture: {
  105709. get: function() {
  105710. if (!defined_default(this._texture)) {
  105711. this._texture = new Texture_default({
  105712. context: this._context,
  105713. width: this._initialSize.x,
  105714. height: this._initialSize.y,
  105715. pixelFormat: this._pixelFormat
  105716. });
  105717. }
  105718. return this._texture;
  105719. }
  105720. },
  105721. numberOfImages: {
  105722. get: function() {
  105723. return this._textureCoordinates.length;
  105724. }
  105725. },
  105726. guid: {
  105727. get: function() {
  105728. return this._guid;
  105729. }
  105730. }
  105731. });
  105732. function resizeAtlas(textureAtlas, image) {
  105733. const context = textureAtlas._context;
  105734. const numImages = textureAtlas.numberOfImages;
  105735. const scalingFactor = 2;
  105736. const borderWidthInPixels = textureAtlas._borderWidthInPixels;
  105737. if (numImages > 0) {
  105738. const oldAtlasWidth = textureAtlas._texture.width;
  105739. const oldAtlasHeight = textureAtlas._texture.height;
  105740. const atlasWidth = scalingFactor * (oldAtlasWidth + image.width + borderWidthInPixels);
  105741. const atlasHeight = scalingFactor * (oldAtlasHeight + image.height + borderWidthInPixels);
  105742. const widthRatio = oldAtlasWidth / atlasWidth;
  105743. const heightRatio = oldAtlasHeight / atlasHeight;
  105744. const nodeBottomRight = new TextureAtlasNode(
  105745. new Cartesian2_default(oldAtlasWidth + borderWidthInPixels, borderWidthInPixels),
  105746. new Cartesian2_default(atlasWidth, oldAtlasHeight)
  105747. );
  105748. const nodeBottomHalf = new TextureAtlasNode(
  105749. new Cartesian2_default(),
  105750. new Cartesian2_default(atlasWidth, oldAtlasHeight),
  105751. textureAtlas._root,
  105752. nodeBottomRight
  105753. );
  105754. const nodeTopHalf = new TextureAtlasNode(
  105755. new Cartesian2_default(borderWidthInPixels, oldAtlasHeight + borderWidthInPixels),
  105756. new Cartesian2_default(atlasWidth, atlasHeight)
  105757. );
  105758. const nodeMain = new TextureAtlasNode(
  105759. new Cartesian2_default(),
  105760. new Cartesian2_default(atlasWidth, atlasHeight),
  105761. nodeBottomHalf,
  105762. nodeTopHalf
  105763. );
  105764. for (let i2 = 0; i2 < textureAtlas._textureCoordinates.length; i2++) {
  105765. const texCoord = textureAtlas._textureCoordinates[i2];
  105766. if (defined_default(texCoord)) {
  105767. texCoord.x *= widthRatio;
  105768. texCoord.y *= heightRatio;
  105769. texCoord.width *= widthRatio;
  105770. texCoord.height *= heightRatio;
  105771. }
  105772. }
  105773. const newTexture = new Texture_default({
  105774. context: textureAtlas._context,
  105775. width: atlasWidth,
  105776. height: atlasHeight,
  105777. pixelFormat: textureAtlas._pixelFormat
  105778. });
  105779. const framebuffer = new Framebuffer_default({
  105780. context,
  105781. colorTextures: [textureAtlas._texture],
  105782. destroyAttachments: false
  105783. });
  105784. framebuffer._bind();
  105785. newTexture.copyFromFramebuffer(0, 0, 0, 0, atlasWidth, atlasHeight);
  105786. framebuffer._unBind();
  105787. framebuffer.destroy();
  105788. textureAtlas._texture = textureAtlas._texture && textureAtlas._texture.destroy();
  105789. textureAtlas._texture = newTexture;
  105790. textureAtlas._root = nodeMain;
  105791. } else {
  105792. let initialWidth = scalingFactor * (image.width + 2 * borderWidthInPixels);
  105793. let initialHeight = scalingFactor * (image.height + 2 * borderWidthInPixels);
  105794. if (initialWidth < textureAtlas._initialSize.x) {
  105795. initialWidth = textureAtlas._initialSize.x;
  105796. }
  105797. if (initialHeight < textureAtlas._initialSize.y) {
  105798. initialHeight = textureAtlas._initialSize.y;
  105799. }
  105800. textureAtlas._texture = textureAtlas._texture && textureAtlas._texture.destroy();
  105801. textureAtlas._texture = new Texture_default({
  105802. context: textureAtlas._context,
  105803. width: initialWidth,
  105804. height: initialHeight,
  105805. pixelFormat: textureAtlas._pixelFormat
  105806. });
  105807. textureAtlas._root = new TextureAtlasNode(
  105808. new Cartesian2_default(borderWidthInPixels, borderWidthInPixels),
  105809. new Cartesian2_default(initialWidth, initialHeight)
  105810. );
  105811. }
  105812. }
  105813. function findNode2(textureAtlas, node, image) {
  105814. if (!defined_default(node)) {
  105815. return void 0;
  105816. }
  105817. if (!defined_default(node.childNode1) && !defined_default(node.childNode2)) {
  105818. if (defined_default(node.imageIndex)) {
  105819. return void 0;
  105820. }
  105821. const nodeWidth = node.topRight.x - node.bottomLeft.x;
  105822. const nodeHeight = node.topRight.y - node.bottomLeft.y;
  105823. const widthDifference = nodeWidth - image.width;
  105824. const heightDifference = nodeHeight - image.height;
  105825. if (widthDifference < 0 || heightDifference < 0) {
  105826. return void 0;
  105827. }
  105828. if (widthDifference === 0 && heightDifference === 0) {
  105829. return node;
  105830. }
  105831. if (widthDifference > heightDifference) {
  105832. node.childNode1 = new TextureAtlasNode(
  105833. new Cartesian2_default(node.bottomLeft.x, node.bottomLeft.y),
  105834. new Cartesian2_default(node.bottomLeft.x + image.width, node.topRight.y)
  105835. );
  105836. const childNode2BottomLeftX = node.bottomLeft.x + image.width + textureAtlas._borderWidthInPixels;
  105837. if (childNode2BottomLeftX < node.topRight.x) {
  105838. node.childNode2 = new TextureAtlasNode(
  105839. new Cartesian2_default(childNode2BottomLeftX, node.bottomLeft.y),
  105840. new Cartesian2_default(node.topRight.x, node.topRight.y)
  105841. );
  105842. }
  105843. } else {
  105844. node.childNode1 = new TextureAtlasNode(
  105845. new Cartesian2_default(node.bottomLeft.x, node.bottomLeft.y),
  105846. new Cartesian2_default(node.topRight.x, node.bottomLeft.y + image.height)
  105847. );
  105848. const childNode2BottomLeftY = node.bottomLeft.y + image.height + textureAtlas._borderWidthInPixels;
  105849. if (childNode2BottomLeftY < node.topRight.y) {
  105850. node.childNode2 = new TextureAtlasNode(
  105851. new Cartesian2_default(node.bottomLeft.x, childNode2BottomLeftY),
  105852. new Cartesian2_default(node.topRight.x, node.topRight.y)
  105853. );
  105854. }
  105855. }
  105856. return findNode2(textureAtlas, node.childNode1, image);
  105857. }
  105858. return findNode2(textureAtlas, node.childNode1, image) || findNode2(textureAtlas, node.childNode2, image);
  105859. }
  105860. function addImage(textureAtlas, image, index2) {
  105861. const node = findNode2(textureAtlas, textureAtlas._root, image);
  105862. if (defined_default(node)) {
  105863. node.imageIndex = index2;
  105864. const atlasWidth = textureAtlas._texture.width;
  105865. const atlasHeight = textureAtlas._texture.height;
  105866. const nodeWidth = node.topRight.x - node.bottomLeft.x;
  105867. const nodeHeight = node.topRight.y - node.bottomLeft.y;
  105868. const x = node.bottomLeft.x / atlasWidth;
  105869. const y = node.bottomLeft.y / atlasHeight;
  105870. const w = nodeWidth / atlasWidth;
  105871. const h = nodeHeight / atlasHeight;
  105872. textureAtlas._textureCoordinates[index2] = new BoundingRectangle_default(x, y, w, h);
  105873. textureAtlas._texture.copyFrom({
  105874. source: image,
  105875. xOffset: node.bottomLeft.x,
  105876. yOffset: node.bottomLeft.y
  105877. });
  105878. } else {
  105879. resizeAtlas(textureAtlas, image);
  105880. addImage(textureAtlas, image, index2);
  105881. }
  105882. textureAtlas._guid = createGuid_default();
  105883. }
  105884. function getIndex(atlas, image) {
  105885. if (!defined_default(atlas) || atlas.isDestroyed()) {
  105886. return -1;
  105887. }
  105888. const index2 = atlas.numberOfImages;
  105889. addImage(atlas, image, index2);
  105890. return index2;
  105891. }
  105892. TextureAtlas.prototype.getImageIndex = function(id) {
  105893. if (!defined_default(id)) {
  105894. throw new DeveloperError_default("id is required.");
  105895. }
  105896. return this._indexHash[id];
  105897. };
  105898. TextureAtlas.prototype.addImageSync = function(id, image) {
  105899. if (!defined_default(id)) {
  105900. throw new DeveloperError_default("id is required.");
  105901. }
  105902. if (!defined_default(image)) {
  105903. throw new DeveloperError_default("image is required.");
  105904. }
  105905. let index2 = this._indexHash[id];
  105906. if (defined_default(index2)) {
  105907. return index2;
  105908. }
  105909. index2 = getIndex(this, image);
  105910. this._idHash[id] = Promise.resolve(index2);
  105911. this._indexHash[id] = index2;
  105912. return index2;
  105913. };
  105914. TextureAtlas.prototype.addImage = function(id, image) {
  105915. if (!defined_default(id)) {
  105916. throw new DeveloperError_default("id is required.");
  105917. }
  105918. if (!defined_default(image)) {
  105919. throw new DeveloperError_default("image is required.");
  105920. }
  105921. let indexPromise = this._idHash[id];
  105922. if (defined_default(indexPromise)) {
  105923. return indexPromise;
  105924. }
  105925. if (typeof image === "function") {
  105926. image = image(id);
  105927. if (!defined_default(image)) {
  105928. throw new DeveloperError_default("image is required.");
  105929. }
  105930. } else if (typeof image === "string" || image instanceof Resource_default) {
  105931. const resource = Resource_default.createIfNeeded(image);
  105932. image = resource.fetchImage();
  105933. }
  105934. const that = this;
  105935. indexPromise = Promise.resolve(image).then(function(image2) {
  105936. const index2 = getIndex(that, image2);
  105937. that._indexHash[id] = index2;
  105938. return index2;
  105939. });
  105940. this._idHash[id] = indexPromise;
  105941. return indexPromise;
  105942. };
  105943. TextureAtlas.prototype.addSubRegion = function(id, subRegion) {
  105944. if (!defined_default(id)) {
  105945. throw new DeveloperError_default("id is required.");
  105946. }
  105947. if (!defined_default(subRegion)) {
  105948. throw new DeveloperError_default("subRegion is required.");
  105949. }
  105950. const indexPromise = this._idHash[id];
  105951. if (!defined_default(indexPromise)) {
  105952. throw new RuntimeError_default(`image with id "${id}" not found in the atlas.`);
  105953. }
  105954. const that = this;
  105955. return Promise.resolve(indexPromise).then(function(index2) {
  105956. if (index2 === -1) {
  105957. return -1;
  105958. }
  105959. const atlasWidth = that._texture.width;
  105960. const atlasHeight = that._texture.height;
  105961. const numImages = that.numberOfImages;
  105962. const baseRegion = that._textureCoordinates[index2];
  105963. const x = baseRegion.x + subRegion.x / atlasWidth;
  105964. const y = baseRegion.y + subRegion.y / atlasHeight;
  105965. const w = subRegion.width / atlasWidth;
  105966. const h = subRegion.height / atlasHeight;
  105967. that._textureCoordinates.push(new BoundingRectangle_default(x, y, w, h));
  105968. that._guid = createGuid_default();
  105969. return numImages;
  105970. });
  105971. };
  105972. TextureAtlas.prototype.isDestroyed = function() {
  105973. return false;
  105974. };
  105975. TextureAtlas.prototype.destroy = function() {
  105976. this._texture = this._texture && this._texture.destroy();
  105977. return destroyObject_default(this);
  105978. };
  105979. var TextureAtlas_default = TextureAtlas;
  105980. // node_modules/cesium/Source/Scene/BillboardCollection.js
  105981. var SHOW_INDEX2 = Billboard_default.SHOW_INDEX;
  105982. var POSITION_INDEX2 = Billboard_default.POSITION_INDEX;
  105983. var PIXEL_OFFSET_INDEX2 = Billboard_default.PIXEL_OFFSET_INDEX;
  105984. var EYE_OFFSET_INDEX2 = Billboard_default.EYE_OFFSET_INDEX;
  105985. var HORIZONTAL_ORIGIN_INDEX2 = Billboard_default.HORIZONTAL_ORIGIN_INDEX;
  105986. var VERTICAL_ORIGIN_INDEX2 = Billboard_default.VERTICAL_ORIGIN_INDEX;
  105987. var SCALE_INDEX2 = Billboard_default.SCALE_INDEX;
  105988. var IMAGE_INDEX_INDEX2 = Billboard_default.IMAGE_INDEX_INDEX;
  105989. var COLOR_INDEX2 = Billboard_default.COLOR_INDEX;
  105990. var ROTATION_INDEX2 = Billboard_default.ROTATION_INDEX;
  105991. var ALIGNED_AXIS_INDEX2 = Billboard_default.ALIGNED_AXIS_INDEX;
  105992. var SCALE_BY_DISTANCE_INDEX2 = Billboard_default.SCALE_BY_DISTANCE_INDEX;
  105993. var TRANSLUCENCY_BY_DISTANCE_INDEX2 = Billboard_default.TRANSLUCENCY_BY_DISTANCE_INDEX;
  105994. var PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX2 = Billboard_default.PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX;
  105995. var DISTANCE_DISPLAY_CONDITION_INDEX = Billboard_default.DISTANCE_DISPLAY_CONDITION;
  105996. var DISABLE_DEPTH_DISTANCE2 = Billboard_default.DISABLE_DEPTH_DISTANCE;
  105997. var TEXTURE_COORDINATE_BOUNDS = Billboard_default.TEXTURE_COORDINATE_BOUNDS;
  105998. var SDF_INDEX2 = Billboard_default.SDF_INDEX;
  105999. var NUMBER_OF_PROPERTIES = Billboard_default.NUMBER_OF_PROPERTIES;
  106000. var attributeLocations;
  106001. var attributeLocationsBatched = {
  106002. positionHighAndScale: 0,
  106003. positionLowAndRotation: 1,
  106004. compressedAttribute0: 2,
  106005. compressedAttribute1: 3,
  106006. compressedAttribute2: 4,
  106007. eyeOffset: 5,
  106008. scaleByDistance: 6,
  106009. pixelOffsetScaleByDistance: 7,
  106010. compressedAttribute3: 8,
  106011. textureCoordinateBoundsOrLabelTranslate: 9,
  106012. a_batchId: 10,
  106013. sdf: 11
  106014. };
  106015. var attributeLocationsInstanced = {
  106016. direction: 0,
  106017. positionHighAndScale: 1,
  106018. positionLowAndRotation: 2,
  106019. compressedAttribute0: 3,
  106020. compressedAttribute1: 4,
  106021. compressedAttribute2: 5,
  106022. eyeOffset: 6,
  106023. scaleByDistance: 7,
  106024. pixelOffsetScaleByDistance: 8,
  106025. compressedAttribute3: 9,
  106026. textureCoordinateBoundsOrLabelTranslate: 10,
  106027. a_batchId: 11,
  106028. sdf: 12
  106029. };
  106030. function BillboardCollection(options) {
  106031. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  106032. this._scene = options.scene;
  106033. this._batchTable = options.batchTable;
  106034. this._textureAtlas = void 0;
  106035. this._textureAtlasGUID = void 0;
  106036. this._destroyTextureAtlas = true;
  106037. this._sp = void 0;
  106038. this._spTranslucent = void 0;
  106039. this._rsOpaque = void 0;
  106040. this._rsTranslucent = void 0;
  106041. this._vaf = void 0;
  106042. this._billboards = [];
  106043. this._billboardsToUpdate = [];
  106044. this._billboardsToUpdateIndex = 0;
  106045. this._billboardsRemoved = false;
  106046. this._createVertexArray = false;
  106047. this._shaderRotation = false;
  106048. this._compiledShaderRotation = false;
  106049. this._shaderAlignedAxis = false;
  106050. this._compiledShaderAlignedAxis = false;
  106051. this._shaderScaleByDistance = false;
  106052. this._compiledShaderScaleByDistance = false;
  106053. this._shaderTranslucencyByDistance = false;
  106054. this._compiledShaderTranslucencyByDistance = false;
  106055. this._shaderPixelOffsetScaleByDistance = false;
  106056. this._compiledShaderPixelOffsetScaleByDistance = false;
  106057. this._shaderDistanceDisplayCondition = false;
  106058. this._compiledShaderDistanceDisplayCondition = false;
  106059. this._shaderDisableDepthDistance = false;
  106060. this._compiledShaderDisableDepthDistance = false;
  106061. this._shaderClampToGround = false;
  106062. this._compiledShaderClampToGround = false;
  106063. this._propertiesChanged = new Uint32Array(NUMBER_OF_PROPERTIES);
  106064. this._maxSize = 0;
  106065. this._maxEyeOffset = 0;
  106066. this._maxScale = 1;
  106067. this._maxPixelOffset = 0;
  106068. this._allHorizontalCenter = true;
  106069. this._allVerticalCenter = true;
  106070. this._allSizedInMeters = true;
  106071. this._baseVolume = new BoundingSphere_default();
  106072. this._baseVolumeWC = new BoundingSphere_default();
  106073. this._baseVolume2D = new BoundingSphere_default();
  106074. this._boundingVolume = new BoundingSphere_default();
  106075. this._boundingVolumeDirty = false;
  106076. this._colorCommands = [];
  106077. this.show = defaultValue_default(options.show, true);
  106078. this.modelMatrix = Matrix4_default.clone(
  106079. defaultValue_default(options.modelMatrix, Matrix4_default.IDENTITY)
  106080. );
  106081. this._modelMatrix = Matrix4_default.clone(Matrix4_default.IDENTITY);
  106082. this.debugShowBoundingVolume = defaultValue_default(
  106083. options.debugShowBoundingVolume,
  106084. false
  106085. );
  106086. this.debugShowTextureAtlas = defaultValue_default(
  106087. options.debugShowTextureAtlas,
  106088. false
  106089. );
  106090. this.blendOption = defaultValue_default(
  106091. options.blendOption,
  106092. BlendOption_default.OPAQUE_AND_TRANSLUCENT
  106093. );
  106094. this._blendOption = void 0;
  106095. this._mode = SceneMode_default.SCENE3D;
  106096. this._buffersUsage = [
  106097. BufferUsage_default.STATIC_DRAW,
  106098. BufferUsage_default.STATIC_DRAW,
  106099. BufferUsage_default.STATIC_DRAW,
  106100. BufferUsage_default.STATIC_DRAW,
  106101. BufferUsage_default.STATIC_DRAW,
  106102. BufferUsage_default.STATIC_DRAW,
  106103. BufferUsage_default.STATIC_DRAW,
  106104. BufferUsage_default.STATIC_DRAW,
  106105. BufferUsage_default.STATIC_DRAW,
  106106. BufferUsage_default.STATIC_DRAW,
  106107. BufferUsage_default.STATIC_DRAW,
  106108. BufferUsage_default.STATIC_DRAW,
  106109. BufferUsage_default.STATIC_DRAW,
  106110. BufferUsage_default.STATIC_DRAW,
  106111. BufferUsage_default.STATIC_DRAW,
  106112. BufferUsage_default.STATIC_DRAW
  106113. ];
  106114. this._highlightColor = Color_default.clone(Color_default.WHITE);
  106115. const that = this;
  106116. this._uniforms = {
  106117. u_atlas: function() {
  106118. return that._textureAtlas.texture;
  106119. },
  106120. u_highlightColor: function() {
  106121. return that._highlightColor;
  106122. }
  106123. };
  106124. const scene = this._scene;
  106125. if (defined_default(scene) && defined_default(scene.terrainProviderChanged)) {
  106126. this._removeCallbackFunc = scene.terrainProviderChanged.addEventListener(
  106127. function() {
  106128. const billboards = this._billboards;
  106129. const length3 = billboards.length;
  106130. for (let i2 = 0; i2 < length3; ++i2) {
  106131. if (defined_default(billboards[i2])) {
  106132. billboards[i2]._updateClamping();
  106133. }
  106134. }
  106135. },
  106136. this
  106137. );
  106138. }
  106139. }
  106140. Object.defineProperties(BillboardCollection.prototype, {
  106141. length: {
  106142. get: function() {
  106143. removeBillboards(this);
  106144. return this._billboards.length;
  106145. }
  106146. },
  106147. textureAtlas: {
  106148. get: function() {
  106149. return this._textureAtlas;
  106150. },
  106151. set: function(value) {
  106152. if (this._textureAtlas !== value) {
  106153. this._textureAtlas = this._destroyTextureAtlas && this._textureAtlas && this._textureAtlas.destroy();
  106154. this._textureAtlas = value;
  106155. this._createVertexArray = true;
  106156. }
  106157. }
  106158. },
  106159. destroyTextureAtlas: {
  106160. get: function() {
  106161. return this._destroyTextureAtlas;
  106162. },
  106163. set: function(value) {
  106164. this._destroyTextureAtlas = value;
  106165. }
  106166. }
  106167. });
  106168. function destroyBillboards(billboards) {
  106169. const length3 = billboards.length;
  106170. for (let i2 = 0; i2 < length3; ++i2) {
  106171. if (billboards[i2]) {
  106172. billboards[i2]._destroy();
  106173. }
  106174. }
  106175. }
  106176. BillboardCollection.prototype.add = function(options) {
  106177. const billboard = new Billboard_default(options, this);
  106178. billboard._index = this._billboards.length;
  106179. this._billboards.push(billboard);
  106180. this._createVertexArray = true;
  106181. return billboard;
  106182. };
  106183. BillboardCollection.prototype.remove = function(billboard) {
  106184. if (this.contains(billboard)) {
  106185. this._billboards[billboard._index] = void 0;
  106186. this._billboardsRemoved = true;
  106187. this._createVertexArray = true;
  106188. billboard._destroy();
  106189. return true;
  106190. }
  106191. return false;
  106192. };
  106193. BillboardCollection.prototype.removeAll = function() {
  106194. destroyBillboards(this._billboards);
  106195. this._billboards = [];
  106196. this._billboardsToUpdate = [];
  106197. this._billboardsToUpdateIndex = 0;
  106198. this._billboardsRemoved = false;
  106199. this._createVertexArray = true;
  106200. };
  106201. function removeBillboards(billboardCollection) {
  106202. if (billboardCollection._billboardsRemoved) {
  106203. billboardCollection._billboardsRemoved = false;
  106204. const newBillboards = [];
  106205. const billboards = billboardCollection._billboards;
  106206. const length3 = billboards.length;
  106207. for (let i2 = 0, j = 0; i2 < length3; ++i2) {
  106208. const billboard = billboards[i2];
  106209. if (defined_default(billboard)) {
  106210. billboard._index = j++;
  106211. newBillboards.push(billboard);
  106212. }
  106213. }
  106214. billboardCollection._billboards = newBillboards;
  106215. }
  106216. }
  106217. BillboardCollection.prototype._updateBillboard = function(billboard, propertyChanged) {
  106218. if (!billboard._dirty) {
  106219. this._billboardsToUpdate[this._billboardsToUpdateIndex++] = billboard;
  106220. }
  106221. ++this._propertiesChanged[propertyChanged];
  106222. };
  106223. BillboardCollection.prototype.contains = function(billboard) {
  106224. return defined_default(billboard) && billboard._billboardCollection === this;
  106225. };
  106226. BillboardCollection.prototype.get = function(index2) {
  106227. Check_default.typeOf.number("index", index2);
  106228. removeBillboards(this);
  106229. return this._billboards[index2];
  106230. };
  106231. var getIndexBuffer;
  106232. function getIndexBufferBatched(context) {
  106233. const sixteenK = 16 * 1024;
  106234. let indexBuffer = context.cache.billboardCollection_indexBufferBatched;
  106235. if (defined_default(indexBuffer)) {
  106236. return indexBuffer;
  106237. }
  106238. const length3 = sixteenK * 6 - 6;
  106239. const indices2 = new Uint16Array(length3);
  106240. for (let i2 = 0, j = 0; i2 < length3; i2 += 6, j += 4) {
  106241. indices2[i2] = j;
  106242. indices2[i2 + 1] = j + 1;
  106243. indices2[i2 + 2] = j + 2;
  106244. indices2[i2 + 3] = j + 0;
  106245. indices2[i2 + 4] = j + 2;
  106246. indices2[i2 + 5] = j + 3;
  106247. }
  106248. indexBuffer = Buffer_default.createIndexBuffer({
  106249. context,
  106250. typedArray: indices2,
  106251. usage: BufferUsage_default.STATIC_DRAW,
  106252. indexDatatype: IndexDatatype_default.UNSIGNED_SHORT
  106253. });
  106254. indexBuffer.vertexArrayDestroyable = false;
  106255. context.cache.billboardCollection_indexBufferBatched = indexBuffer;
  106256. return indexBuffer;
  106257. }
  106258. function getIndexBufferInstanced(context) {
  106259. let indexBuffer = context.cache.billboardCollection_indexBufferInstanced;
  106260. if (defined_default(indexBuffer)) {
  106261. return indexBuffer;
  106262. }
  106263. indexBuffer = Buffer_default.createIndexBuffer({
  106264. context,
  106265. typedArray: new Uint16Array([0, 1, 2, 0, 2, 3]),
  106266. usage: BufferUsage_default.STATIC_DRAW,
  106267. indexDatatype: IndexDatatype_default.UNSIGNED_SHORT
  106268. });
  106269. indexBuffer.vertexArrayDestroyable = false;
  106270. context.cache.billboardCollection_indexBufferInstanced = indexBuffer;
  106271. return indexBuffer;
  106272. }
  106273. function getVertexBufferInstanced(context) {
  106274. let vertexBuffer = context.cache.billboardCollection_vertexBufferInstanced;
  106275. if (defined_default(vertexBuffer)) {
  106276. return vertexBuffer;
  106277. }
  106278. vertexBuffer = Buffer_default.createVertexBuffer({
  106279. context,
  106280. typedArray: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),
  106281. usage: BufferUsage_default.STATIC_DRAW
  106282. });
  106283. vertexBuffer.vertexArrayDestroyable = false;
  106284. context.cache.billboardCollection_vertexBufferInstanced = vertexBuffer;
  106285. return vertexBuffer;
  106286. }
  106287. BillboardCollection.prototype.computeNewBuffersUsage = function() {
  106288. const buffersUsage = this._buffersUsage;
  106289. let usageChanged = false;
  106290. const properties = this._propertiesChanged;
  106291. for (let k = 0; k < NUMBER_OF_PROPERTIES; ++k) {
  106292. const newUsage = properties[k] === 0 ? BufferUsage_default.STATIC_DRAW : BufferUsage_default.STREAM_DRAW;
  106293. usageChanged = usageChanged || buffersUsage[k] !== newUsage;
  106294. buffersUsage[k] = newUsage;
  106295. }
  106296. return usageChanged;
  106297. };
  106298. function createVAF(context, numberOfBillboards, buffersUsage, instanced, batchTable, sdf) {
  106299. const attributes = [
  106300. {
  106301. index: attributeLocations.positionHighAndScale,
  106302. componentsPerAttribute: 4,
  106303. componentDatatype: ComponentDatatype_default.FLOAT,
  106304. usage: buffersUsage[POSITION_INDEX2]
  106305. },
  106306. {
  106307. index: attributeLocations.positionLowAndRotation,
  106308. componentsPerAttribute: 4,
  106309. componentDatatype: ComponentDatatype_default.FLOAT,
  106310. usage: buffersUsage[POSITION_INDEX2]
  106311. },
  106312. {
  106313. index: attributeLocations.compressedAttribute0,
  106314. componentsPerAttribute: 4,
  106315. componentDatatype: ComponentDatatype_default.FLOAT,
  106316. usage: buffersUsage[PIXEL_OFFSET_INDEX2]
  106317. },
  106318. {
  106319. index: attributeLocations.compressedAttribute1,
  106320. componentsPerAttribute: 4,
  106321. componentDatatype: ComponentDatatype_default.FLOAT,
  106322. usage: buffersUsage[TRANSLUCENCY_BY_DISTANCE_INDEX2]
  106323. },
  106324. {
  106325. index: attributeLocations.compressedAttribute2,
  106326. componentsPerAttribute: 4,
  106327. componentDatatype: ComponentDatatype_default.FLOAT,
  106328. usage: buffersUsage[COLOR_INDEX2]
  106329. },
  106330. {
  106331. index: attributeLocations.eyeOffset,
  106332. componentsPerAttribute: 4,
  106333. componentDatatype: ComponentDatatype_default.FLOAT,
  106334. usage: buffersUsage[EYE_OFFSET_INDEX2]
  106335. },
  106336. {
  106337. index: attributeLocations.scaleByDistance,
  106338. componentsPerAttribute: 4,
  106339. componentDatatype: ComponentDatatype_default.FLOAT,
  106340. usage: buffersUsage[SCALE_BY_DISTANCE_INDEX2]
  106341. },
  106342. {
  106343. index: attributeLocations.pixelOffsetScaleByDistance,
  106344. componentsPerAttribute: 4,
  106345. componentDatatype: ComponentDatatype_default.FLOAT,
  106346. usage: buffersUsage[PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX2]
  106347. },
  106348. {
  106349. index: attributeLocations.compressedAttribute3,
  106350. componentsPerAttribute: 4,
  106351. componentDatatype: ComponentDatatype_default.FLOAT,
  106352. usage: buffersUsage[DISTANCE_DISPLAY_CONDITION_INDEX]
  106353. },
  106354. {
  106355. index: attributeLocations.textureCoordinateBoundsOrLabelTranslate,
  106356. componentsPerAttribute: 4,
  106357. componentDatatype: ComponentDatatype_default.FLOAT,
  106358. usage: buffersUsage[TEXTURE_COORDINATE_BOUNDS]
  106359. }
  106360. ];
  106361. if (instanced) {
  106362. attributes.push({
  106363. index: attributeLocations.direction,
  106364. componentsPerAttribute: 2,
  106365. componentDatatype: ComponentDatatype_default.FLOAT,
  106366. vertexBuffer: getVertexBufferInstanced(context)
  106367. });
  106368. }
  106369. if (defined_default(batchTable)) {
  106370. attributes.push({
  106371. index: attributeLocations.a_batchId,
  106372. componentsPerAttribute: 1,
  106373. componentDatatype: ComponentDatatype_default.FLOAT,
  106374. bufferUsage: BufferUsage_default.STATIC_DRAW
  106375. });
  106376. }
  106377. if (sdf) {
  106378. attributes.push({
  106379. index: attributeLocations.sdf,
  106380. componentsPerAttribute: 2,
  106381. componentDatatype: ComponentDatatype_default.FLOAT,
  106382. usage: buffersUsage[SDF_INDEX2]
  106383. });
  106384. }
  106385. const sizeInVertices = instanced ? numberOfBillboards : 4 * numberOfBillboards;
  106386. return new VertexArrayFacade_default(context, attributes, sizeInVertices, instanced);
  106387. }
  106388. var writePositionScratch = new EncodedCartesian3_default();
  106389. function writePositionScaleAndRotation(billboardCollection, frameState, textureAtlasCoordinates, vafWriters, billboard) {
  106390. let i2;
  106391. const positionHighWriter = vafWriters[attributeLocations.positionHighAndScale];
  106392. const positionLowWriter = vafWriters[attributeLocations.positionLowAndRotation];
  106393. const position = billboard._getActualPosition();
  106394. if (billboardCollection._mode === SceneMode_default.SCENE3D) {
  106395. BoundingSphere_default.expand(
  106396. billboardCollection._baseVolume,
  106397. position,
  106398. billboardCollection._baseVolume
  106399. );
  106400. billboardCollection._boundingVolumeDirty = true;
  106401. }
  106402. EncodedCartesian3_default.fromCartesian(position, writePositionScratch);
  106403. const scale = billboard.scale;
  106404. const rotation = billboard.rotation;
  106405. if (rotation !== 0) {
  106406. billboardCollection._shaderRotation = true;
  106407. }
  106408. billboardCollection._maxScale = Math.max(
  106409. billboardCollection._maxScale,
  106410. scale
  106411. );
  106412. const high = writePositionScratch.high;
  106413. const low = writePositionScratch.low;
  106414. if (billboardCollection._instanced) {
  106415. i2 = billboard._index;
  106416. positionHighWriter(i2, high.x, high.y, high.z, scale);
  106417. positionLowWriter(i2, low.x, low.y, low.z, rotation);
  106418. } else {
  106419. i2 = billboard._index * 4;
  106420. positionHighWriter(i2 + 0, high.x, high.y, high.z, scale);
  106421. positionHighWriter(i2 + 1, high.x, high.y, high.z, scale);
  106422. positionHighWriter(i2 + 2, high.x, high.y, high.z, scale);
  106423. positionHighWriter(i2 + 3, high.x, high.y, high.z, scale);
  106424. positionLowWriter(i2 + 0, low.x, low.y, low.z, rotation);
  106425. positionLowWriter(i2 + 1, low.x, low.y, low.z, rotation);
  106426. positionLowWriter(i2 + 2, low.x, low.y, low.z, rotation);
  106427. positionLowWriter(i2 + 3, low.x, low.y, low.z, rotation);
  106428. }
  106429. }
  106430. var scratchCartesian210 = new Cartesian2_default();
  106431. var UPPER_BOUND = 32768;
  106432. var LEFT_SHIFT16 = 65536;
  106433. var LEFT_SHIFT12 = 4096;
  106434. var LEFT_SHIFT8 = 256;
  106435. var LEFT_SHIFT7 = 128;
  106436. var LEFT_SHIFT5 = 32;
  106437. var LEFT_SHIFT3 = 8;
  106438. var LEFT_SHIFT2 = 4;
  106439. var RIGHT_SHIFT8 = 1 / 256;
  106440. var LOWER_LEFT = 0;
  106441. var LOWER_RIGHT = 2;
  106442. var UPPER_RIGHT = 3;
  106443. var UPPER_LEFT = 1;
  106444. function writeCompressedAttrib0(billboardCollection, frameState, textureAtlasCoordinates, vafWriters, billboard) {
  106445. let i2;
  106446. const writer = vafWriters[attributeLocations.compressedAttribute0];
  106447. const pixelOffset = billboard.pixelOffset;
  106448. const pixelOffsetX = pixelOffset.x;
  106449. const pixelOffsetY = pixelOffset.y;
  106450. const translate = billboard._translate;
  106451. const translateX = translate.x;
  106452. const translateY = translate.y;
  106453. billboardCollection._maxPixelOffset = Math.max(
  106454. billboardCollection._maxPixelOffset,
  106455. Math.abs(pixelOffsetX + translateX),
  106456. Math.abs(-pixelOffsetY + translateY)
  106457. );
  106458. const horizontalOrigin = billboard.horizontalOrigin;
  106459. let verticalOrigin = billboard._verticalOrigin;
  106460. let show = billboard.show && billboard.clusterShow;
  106461. if (billboard.color.alpha === 0) {
  106462. show = false;
  106463. }
  106464. if (verticalOrigin === VerticalOrigin_default.BASELINE) {
  106465. verticalOrigin = VerticalOrigin_default.BOTTOM;
  106466. }
  106467. billboardCollection._allHorizontalCenter = billboardCollection._allHorizontalCenter && horizontalOrigin === HorizontalOrigin_default.CENTER;
  106468. billboardCollection._allVerticalCenter = billboardCollection._allVerticalCenter && verticalOrigin === VerticalOrigin_default.CENTER;
  106469. let bottomLeftX = 0;
  106470. let bottomLeftY = 0;
  106471. let width = 0;
  106472. let height = 0;
  106473. const index2 = billboard._imageIndex;
  106474. if (index2 !== -1) {
  106475. const imageRectangle = textureAtlasCoordinates[index2];
  106476. if (!defined_default(imageRectangle)) {
  106477. throw new DeveloperError_default(`Invalid billboard image index: ${index2}`);
  106478. }
  106479. bottomLeftX = imageRectangle.x;
  106480. bottomLeftY = imageRectangle.y;
  106481. width = imageRectangle.width;
  106482. height = imageRectangle.height;
  106483. }
  106484. const topRightX = bottomLeftX + width;
  106485. const topRightY = bottomLeftY + height;
  106486. let compressed0 = Math.floor(
  106487. Math_default.clamp(pixelOffsetX, -UPPER_BOUND, UPPER_BOUND) + UPPER_BOUND
  106488. ) * LEFT_SHIFT7;
  106489. compressed0 += (horizontalOrigin + 1) * LEFT_SHIFT5;
  106490. compressed0 += (verticalOrigin + 1) * LEFT_SHIFT3;
  106491. compressed0 += (show ? 1 : 0) * LEFT_SHIFT2;
  106492. let compressed1 = Math.floor(
  106493. Math_default.clamp(pixelOffsetY, -UPPER_BOUND, UPPER_BOUND) + UPPER_BOUND
  106494. ) * LEFT_SHIFT8;
  106495. let compressed2 = Math.floor(
  106496. Math_default.clamp(translateX, -UPPER_BOUND, UPPER_BOUND) + UPPER_BOUND
  106497. ) * LEFT_SHIFT8;
  106498. const tempTanslateY = (Math_default.clamp(translateY, -UPPER_BOUND, UPPER_BOUND) + UPPER_BOUND) * RIGHT_SHIFT8;
  106499. const upperTranslateY = Math.floor(tempTanslateY);
  106500. const lowerTranslateY = Math.floor(
  106501. (tempTanslateY - upperTranslateY) * LEFT_SHIFT8
  106502. );
  106503. compressed1 += upperTranslateY;
  106504. compressed2 += lowerTranslateY;
  106505. scratchCartesian210.x = bottomLeftX;
  106506. scratchCartesian210.y = bottomLeftY;
  106507. const compressedTexCoordsLL = AttributeCompression_default.compressTextureCoordinates(
  106508. scratchCartesian210
  106509. );
  106510. scratchCartesian210.x = topRightX;
  106511. const compressedTexCoordsLR = AttributeCompression_default.compressTextureCoordinates(
  106512. scratchCartesian210
  106513. );
  106514. scratchCartesian210.y = topRightY;
  106515. const compressedTexCoordsUR = AttributeCompression_default.compressTextureCoordinates(
  106516. scratchCartesian210
  106517. );
  106518. scratchCartesian210.x = bottomLeftX;
  106519. const compressedTexCoordsUL = AttributeCompression_default.compressTextureCoordinates(
  106520. scratchCartesian210
  106521. );
  106522. if (billboardCollection._instanced) {
  106523. i2 = billboard._index;
  106524. writer(i2, compressed0, compressed1, compressed2, compressedTexCoordsLL);
  106525. } else {
  106526. i2 = billboard._index * 4;
  106527. writer(
  106528. i2 + 0,
  106529. compressed0 + LOWER_LEFT,
  106530. compressed1,
  106531. compressed2,
  106532. compressedTexCoordsLL
  106533. );
  106534. writer(
  106535. i2 + 1,
  106536. compressed0 + LOWER_RIGHT,
  106537. compressed1,
  106538. compressed2,
  106539. compressedTexCoordsLR
  106540. );
  106541. writer(
  106542. i2 + 2,
  106543. compressed0 + UPPER_RIGHT,
  106544. compressed1,
  106545. compressed2,
  106546. compressedTexCoordsUR
  106547. );
  106548. writer(
  106549. i2 + 3,
  106550. compressed0 + UPPER_LEFT,
  106551. compressed1,
  106552. compressed2,
  106553. compressedTexCoordsUL
  106554. );
  106555. }
  106556. }
  106557. function writeCompressedAttrib1(billboardCollection, frameState, textureAtlasCoordinates, vafWriters, billboard) {
  106558. let i2;
  106559. const writer = vafWriters[attributeLocations.compressedAttribute1];
  106560. const alignedAxis = billboard.alignedAxis;
  106561. if (!Cartesian3_default.equals(alignedAxis, Cartesian3_default.ZERO)) {
  106562. billboardCollection._shaderAlignedAxis = true;
  106563. }
  106564. let near = 0;
  106565. let nearValue = 1;
  106566. let far = 1;
  106567. let farValue = 1;
  106568. const translucency = billboard.translucencyByDistance;
  106569. if (defined_default(translucency)) {
  106570. near = translucency.near;
  106571. nearValue = translucency.nearValue;
  106572. far = translucency.far;
  106573. farValue = translucency.farValue;
  106574. if (nearValue !== 1 || farValue !== 1) {
  106575. billboardCollection._shaderTranslucencyByDistance = true;
  106576. }
  106577. }
  106578. let width = 0;
  106579. const index2 = billboard._imageIndex;
  106580. if (index2 !== -1) {
  106581. const imageRectangle = textureAtlasCoordinates[index2];
  106582. if (!defined_default(imageRectangle)) {
  106583. throw new DeveloperError_default(`Invalid billboard image index: ${index2}`);
  106584. }
  106585. width = imageRectangle.width;
  106586. }
  106587. const textureWidth = billboardCollection._textureAtlas.texture.width;
  106588. const imageWidth = Math.round(
  106589. defaultValue_default(billboard.width, textureWidth * width)
  106590. );
  106591. billboardCollection._maxSize = Math.max(
  106592. billboardCollection._maxSize,
  106593. imageWidth
  106594. );
  106595. let compressed0 = Math_default.clamp(imageWidth, 0, LEFT_SHIFT16);
  106596. let compressed1 = 0;
  106597. if (Math.abs(Cartesian3_default.magnitudeSquared(alignedAxis) - 1) < Math_default.EPSILON6) {
  106598. compressed1 = AttributeCompression_default.octEncodeFloat(alignedAxis);
  106599. }
  106600. nearValue = Math_default.clamp(nearValue, 0, 1);
  106601. nearValue = nearValue === 1 ? 255 : nearValue * 255 | 0;
  106602. compressed0 = compressed0 * LEFT_SHIFT8 + nearValue;
  106603. farValue = Math_default.clamp(farValue, 0, 1);
  106604. farValue = farValue === 1 ? 255 : farValue * 255 | 0;
  106605. compressed1 = compressed1 * LEFT_SHIFT8 + farValue;
  106606. if (billboardCollection._instanced) {
  106607. i2 = billboard._index;
  106608. writer(i2, compressed0, compressed1, near, far);
  106609. } else {
  106610. i2 = billboard._index * 4;
  106611. writer(i2 + 0, compressed0, compressed1, near, far);
  106612. writer(i2 + 1, compressed0, compressed1, near, far);
  106613. writer(i2 + 2, compressed0, compressed1, near, far);
  106614. writer(i2 + 3, compressed0, compressed1, near, far);
  106615. }
  106616. }
  106617. function writeCompressedAttrib2(billboardCollection, frameState, textureAtlasCoordinates, vafWriters, billboard) {
  106618. let i2;
  106619. const writer = vafWriters[attributeLocations.compressedAttribute2];
  106620. const color = billboard.color;
  106621. const pickColor = !defined_default(billboardCollection._batchTable) ? billboard.getPickId(frameState.context).color : Color_default.WHITE;
  106622. const sizeInMeters = billboard.sizeInMeters ? 1 : 0;
  106623. const validAlignedAxis = Math.abs(Cartesian3_default.magnitudeSquared(billboard.alignedAxis) - 1) < Math_default.EPSILON6 ? 1 : 0;
  106624. billboardCollection._allSizedInMeters = billboardCollection._allSizedInMeters && sizeInMeters === 1;
  106625. let height = 0;
  106626. const index2 = billboard._imageIndex;
  106627. if (index2 !== -1) {
  106628. const imageRectangle = textureAtlasCoordinates[index2];
  106629. if (!defined_default(imageRectangle)) {
  106630. throw new DeveloperError_default(`Invalid billboard image index: ${index2}`);
  106631. }
  106632. height = imageRectangle.height;
  106633. }
  106634. const dimensions = billboardCollection._textureAtlas.texture.dimensions;
  106635. const imageHeight = Math.round(
  106636. defaultValue_default(billboard.height, dimensions.y * height)
  106637. );
  106638. billboardCollection._maxSize = Math.max(
  106639. billboardCollection._maxSize,
  106640. imageHeight
  106641. );
  106642. let labelHorizontalOrigin = defaultValue_default(
  106643. billboard._labelHorizontalOrigin,
  106644. -2
  106645. );
  106646. labelHorizontalOrigin += 2;
  106647. const compressed3 = imageHeight * LEFT_SHIFT2 + labelHorizontalOrigin;
  106648. let red = Color_default.floatToByte(color.red);
  106649. let green = Color_default.floatToByte(color.green);
  106650. let blue = Color_default.floatToByte(color.blue);
  106651. const compressed0 = red * LEFT_SHIFT16 + green * LEFT_SHIFT8 + blue;
  106652. red = Color_default.floatToByte(pickColor.red);
  106653. green = Color_default.floatToByte(pickColor.green);
  106654. blue = Color_default.floatToByte(pickColor.blue);
  106655. const compressed1 = red * LEFT_SHIFT16 + green * LEFT_SHIFT8 + blue;
  106656. let compressed2 = Color_default.floatToByte(color.alpha) * LEFT_SHIFT16 + Color_default.floatToByte(pickColor.alpha) * LEFT_SHIFT8;
  106657. compressed2 += sizeInMeters * 2 + validAlignedAxis;
  106658. if (billboardCollection._instanced) {
  106659. i2 = billboard._index;
  106660. writer(i2, compressed0, compressed1, compressed2, compressed3);
  106661. } else {
  106662. i2 = billboard._index * 4;
  106663. writer(i2 + 0, compressed0, compressed1, compressed2, compressed3);
  106664. writer(i2 + 1, compressed0, compressed1, compressed2, compressed3);
  106665. writer(i2 + 2, compressed0, compressed1, compressed2, compressed3);
  106666. writer(i2 + 3, compressed0, compressed1, compressed2, compressed3);
  106667. }
  106668. }
  106669. function writeEyeOffset(billboardCollection, frameState, textureAtlasCoordinates, vafWriters, billboard) {
  106670. let i2;
  106671. const writer = vafWriters[attributeLocations.eyeOffset];
  106672. const eyeOffset = billboard.eyeOffset;
  106673. let eyeOffsetZ = eyeOffset.z;
  106674. if (billboard._heightReference !== HeightReference_default.NONE) {
  106675. eyeOffsetZ *= 1.005;
  106676. }
  106677. billboardCollection._maxEyeOffset = Math.max(
  106678. billboardCollection._maxEyeOffset,
  106679. Math.abs(eyeOffset.x),
  106680. Math.abs(eyeOffset.y),
  106681. Math.abs(eyeOffsetZ)
  106682. );
  106683. if (billboardCollection._instanced) {
  106684. let width = 0;
  106685. let height = 0;
  106686. const index2 = billboard._imageIndex;
  106687. if (index2 !== -1) {
  106688. const imageRectangle = textureAtlasCoordinates[index2];
  106689. if (!defined_default(imageRectangle)) {
  106690. throw new DeveloperError_default(`Invalid billboard image index: ${index2}`);
  106691. }
  106692. width = imageRectangle.width;
  106693. height = imageRectangle.height;
  106694. }
  106695. scratchCartesian210.x = width;
  106696. scratchCartesian210.y = height;
  106697. const compressedTexCoordsRange = AttributeCompression_default.compressTextureCoordinates(
  106698. scratchCartesian210
  106699. );
  106700. i2 = billboard._index;
  106701. writer(i2, eyeOffset.x, eyeOffset.y, eyeOffsetZ, compressedTexCoordsRange);
  106702. } else {
  106703. i2 = billboard._index * 4;
  106704. writer(i2 + 0, eyeOffset.x, eyeOffset.y, eyeOffsetZ, 0);
  106705. writer(i2 + 1, eyeOffset.x, eyeOffset.y, eyeOffsetZ, 0);
  106706. writer(i2 + 2, eyeOffset.x, eyeOffset.y, eyeOffsetZ, 0);
  106707. writer(i2 + 3, eyeOffset.x, eyeOffset.y, eyeOffsetZ, 0);
  106708. }
  106709. }
  106710. function writeScaleByDistance(billboardCollection, frameState, textureAtlasCoordinates, vafWriters, billboard) {
  106711. let i2;
  106712. const writer = vafWriters[attributeLocations.scaleByDistance];
  106713. let near = 0;
  106714. let nearValue = 1;
  106715. let far = 1;
  106716. let farValue = 1;
  106717. const scale = billboard.scaleByDistance;
  106718. if (defined_default(scale)) {
  106719. near = scale.near;
  106720. nearValue = scale.nearValue;
  106721. far = scale.far;
  106722. farValue = scale.farValue;
  106723. if (nearValue !== 1 || farValue !== 1) {
  106724. billboardCollection._shaderScaleByDistance = true;
  106725. }
  106726. }
  106727. if (billboardCollection._instanced) {
  106728. i2 = billboard._index;
  106729. writer(i2, near, nearValue, far, farValue);
  106730. } else {
  106731. i2 = billboard._index * 4;
  106732. writer(i2 + 0, near, nearValue, far, farValue);
  106733. writer(i2 + 1, near, nearValue, far, farValue);
  106734. writer(i2 + 2, near, nearValue, far, farValue);
  106735. writer(i2 + 3, near, nearValue, far, farValue);
  106736. }
  106737. }
  106738. function writePixelOffsetScaleByDistance(billboardCollection, frameState, textureAtlasCoordinates, vafWriters, billboard) {
  106739. let i2;
  106740. const writer = vafWriters[attributeLocations.pixelOffsetScaleByDistance];
  106741. let near = 0;
  106742. let nearValue = 1;
  106743. let far = 1;
  106744. let farValue = 1;
  106745. const pixelOffsetScale = billboard.pixelOffsetScaleByDistance;
  106746. if (defined_default(pixelOffsetScale)) {
  106747. near = pixelOffsetScale.near;
  106748. nearValue = pixelOffsetScale.nearValue;
  106749. far = pixelOffsetScale.far;
  106750. farValue = pixelOffsetScale.farValue;
  106751. if (nearValue !== 1 || farValue !== 1) {
  106752. billboardCollection._shaderPixelOffsetScaleByDistance = true;
  106753. }
  106754. }
  106755. if (billboardCollection._instanced) {
  106756. i2 = billboard._index;
  106757. writer(i2, near, nearValue, far, farValue);
  106758. } else {
  106759. i2 = billboard._index * 4;
  106760. writer(i2 + 0, near, nearValue, far, farValue);
  106761. writer(i2 + 1, near, nearValue, far, farValue);
  106762. writer(i2 + 2, near, nearValue, far, farValue);
  106763. writer(i2 + 3, near, nearValue, far, farValue);
  106764. }
  106765. }
  106766. function writeCompressedAttribute3(billboardCollection, frameState, textureAtlasCoordinates, vafWriters, billboard) {
  106767. let i2;
  106768. const writer = vafWriters[attributeLocations.compressedAttribute3];
  106769. let near = 0;
  106770. let far = Number.MAX_VALUE;
  106771. const distanceDisplayCondition = billboard.distanceDisplayCondition;
  106772. if (defined_default(distanceDisplayCondition)) {
  106773. near = distanceDisplayCondition.near;
  106774. far = distanceDisplayCondition.far;
  106775. near *= near;
  106776. far *= far;
  106777. billboardCollection._shaderDistanceDisplayCondition = true;
  106778. }
  106779. let disableDepthTestDistance = billboard.disableDepthTestDistance;
  106780. const clampToGround = billboard.heightReference === HeightReference_default.CLAMP_TO_GROUND && frameState.context.depthTexture;
  106781. if (!defined_default(disableDepthTestDistance)) {
  106782. disableDepthTestDistance = clampToGround ? 5e3 : 0;
  106783. }
  106784. disableDepthTestDistance *= disableDepthTestDistance;
  106785. if (clampToGround || disableDepthTestDistance > 0) {
  106786. billboardCollection._shaderDisableDepthDistance = true;
  106787. if (disableDepthTestDistance === Number.POSITIVE_INFINITY) {
  106788. disableDepthTestDistance = -1;
  106789. }
  106790. }
  106791. let imageHeight;
  106792. let imageWidth;
  106793. if (!defined_default(billboard._labelDimensions)) {
  106794. let height = 0;
  106795. let width = 0;
  106796. const index2 = billboard._imageIndex;
  106797. if (index2 !== -1) {
  106798. const imageRectangle = textureAtlasCoordinates[index2];
  106799. if (!defined_default(imageRectangle)) {
  106800. throw new DeveloperError_default(`Invalid billboard image index: ${index2}`);
  106801. }
  106802. height = imageRectangle.height;
  106803. width = imageRectangle.width;
  106804. }
  106805. imageHeight = Math.round(
  106806. defaultValue_default(
  106807. billboard.height,
  106808. billboardCollection._textureAtlas.texture.dimensions.y * height
  106809. )
  106810. );
  106811. const textureWidth = billboardCollection._textureAtlas.texture.width;
  106812. imageWidth = Math.round(
  106813. defaultValue_default(billboard.width, textureWidth * width)
  106814. );
  106815. } else {
  106816. imageWidth = billboard._labelDimensions.x;
  106817. imageHeight = billboard._labelDimensions.y;
  106818. }
  106819. const w = Math.floor(Math_default.clamp(imageWidth, 0, LEFT_SHIFT12));
  106820. const h = Math.floor(Math_default.clamp(imageHeight, 0, LEFT_SHIFT12));
  106821. const dimensions = w * LEFT_SHIFT12 + h;
  106822. if (billboardCollection._instanced) {
  106823. i2 = billboard._index;
  106824. writer(i2, near, far, disableDepthTestDistance, dimensions);
  106825. } else {
  106826. i2 = billboard._index * 4;
  106827. writer(i2 + 0, near, far, disableDepthTestDistance, dimensions);
  106828. writer(i2 + 1, near, far, disableDepthTestDistance, dimensions);
  106829. writer(i2 + 2, near, far, disableDepthTestDistance, dimensions);
  106830. writer(i2 + 3, near, far, disableDepthTestDistance, dimensions);
  106831. }
  106832. }
  106833. function writeTextureCoordinateBoundsOrLabelTranslate(billboardCollection, frameState, textureAtlasCoordinates, vafWriters, billboard) {
  106834. if (billboard.heightReference === HeightReference_default.CLAMP_TO_GROUND) {
  106835. const scene = billboardCollection._scene;
  106836. const context = frameState.context;
  106837. const globeTranslucent = frameState.globeTranslucencyState.translucent;
  106838. const depthTestAgainstTerrain = defined_default(scene.globe) && scene.globe.depthTestAgainstTerrain;
  106839. billboardCollection._shaderClampToGround = context.depthTexture && !globeTranslucent && depthTestAgainstTerrain;
  106840. }
  106841. let i2;
  106842. const writer = vafWriters[attributeLocations.textureCoordinateBoundsOrLabelTranslate];
  106843. if (ContextLimits_default.maximumVertexTextureImageUnits > 0) {
  106844. let translateX = 0;
  106845. let translateY = 0;
  106846. if (defined_default(billboard._labelTranslate)) {
  106847. translateX = billboard._labelTranslate.x;
  106848. translateY = billboard._labelTranslate.y;
  106849. }
  106850. if (billboardCollection._instanced) {
  106851. i2 = billboard._index;
  106852. writer(i2, translateX, translateY, 0, 0);
  106853. } else {
  106854. i2 = billboard._index * 4;
  106855. writer(i2 + 0, translateX, translateY, 0, 0);
  106856. writer(i2 + 1, translateX, translateY, 0, 0);
  106857. writer(i2 + 2, translateX, translateY, 0, 0);
  106858. writer(i2 + 3, translateX, translateY, 0, 0);
  106859. }
  106860. return;
  106861. }
  106862. let minX = 0;
  106863. let minY = 0;
  106864. let width = 0;
  106865. let height = 0;
  106866. const index2 = billboard._imageIndex;
  106867. if (index2 !== -1) {
  106868. const imageRectangle = textureAtlasCoordinates[index2];
  106869. if (!defined_default(imageRectangle)) {
  106870. throw new DeveloperError_default(`Invalid billboard image index: ${index2}`);
  106871. }
  106872. minX = imageRectangle.x;
  106873. minY = imageRectangle.y;
  106874. width = imageRectangle.width;
  106875. height = imageRectangle.height;
  106876. }
  106877. const maxX = minX + width;
  106878. const maxY = minY + height;
  106879. if (billboardCollection._instanced) {
  106880. i2 = billboard._index;
  106881. writer(i2, minX, minY, maxX, maxY);
  106882. } else {
  106883. i2 = billboard._index * 4;
  106884. writer(i2 + 0, minX, minY, maxX, maxY);
  106885. writer(i2 + 1, minX, minY, maxX, maxY);
  106886. writer(i2 + 2, minX, minY, maxX, maxY);
  106887. writer(i2 + 3, minX, minY, maxX, maxY);
  106888. }
  106889. }
  106890. function writeBatchId(billboardCollection, frameState, textureAtlasCoordinates, vafWriters, billboard) {
  106891. if (!defined_default(billboardCollection._batchTable)) {
  106892. return;
  106893. }
  106894. const writer = vafWriters[attributeLocations.a_batchId];
  106895. const id = billboard._batchIndex;
  106896. let i2;
  106897. if (billboardCollection._instanced) {
  106898. i2 = billboard._index;
  106899. writer(i2, id);
  106900. } else {
  106901. i2 = billboard._index * 4;
  106902. writer(i2 + 0, id);
  106903. writer(i2 + 1, id);
  106904. writer(i2 + 2, id);
  106905. writer(i2 + 3, id);
  106906. }
  106907. }
  106908. function writeSDF(billboardCollection, frameState, textureAtlasCoordinates, vafWriters, billboard) {
  106909. if (!billboardCollection._sdf) {
  106910. return;
  106911. }
  106912. let i2;
  106913. const writer = vafWriters[attributeLocations.sdf];
  106914. const outlineColor = billboard.outlineColor;
  106915. const outlineWidth = billboard.outlineWidth;
  106916. const red = Color_default.floatToByte(outlineColor.red);
  106917. const green = Color_default.floatToByte(outlineColor.green);
  106918. const blue = Color_default.floatToByte(outlineColor.blue);
  106919. const compressed0 = red * LEFT_SHIFT16 + green * LEFT_SHIFT8 + blue;
  106920. const outlineDistance = outlineWidth / SDFSettings_default.RADIUS;
  106921. const compressed1 = Color_default.floatToByte(outlineColor.alpha) * LEFT_SHIFT16 + Color_default.floatToByte(outlineDistance) * LEFT_SHIFT8;
  106922. if (billboardCollection._instanced) {
  106923. i2 = billboard._index;
  106924. writer(i2, compressed0, compressed1);
  106925. } else {
  106926. i2 = billboard._index * 4;
  106927. writer(i2 + 0, compressed0 + LOWER_LEFT, compressed1);
  106928. writer(i2 + 1, compressed0 + LOWER_RIGHT, compressed1);
  106929. writer(i2 + 2, compressed0 + UPPER_RIGHT, compressed1);
  106930. writer(i2 + 3, compressed0 + UPPER_LEFT, compressed1);
  106931. }
  106932. }
  106933. function writeBillboard(billboardCollection, frameState, textureAtlasCoordinates, vafWriters, billboard) {
  106934. writePositionScaleAndRotation(
  106935. billboardCollection,
  106936. frameState,
  106937. textureAtlasCoordinates,
  106938. vafWriters,
  106939. billboard
  106940. );
  106941. writeCompressedAttrib0(
  106942. billboardCollection,
  106943. frameState,
  106944. textureAtlasCoordinates,
  106945. vafWriters,
  106946. billboard
  106947. );
  106948. writeCompressedAttrib1(
  106949. billboardCollection,
  106950. frameState,
  106951. textureAtlasCoordinates,
  106952. vafWriters,
  106953. billboard
  106954. );
  106955. writeCompressedAttrib2(
  106956. billboardCollection,
  106957. frameState,
  106958. textureAtlasCoordinates,
  106959. vafWriters,
  106960. billboard
  106961. );
  106962. writeEyeOffset(
  106963. billboardCollection,
  106964. frameState,
  106965. textureAtlasCoordinates,
  106966. vafWriters,
  106967. billboard
  106968. );
  106969. writeScaleByDistance(
  106970. billboardCollection,
  106971. frameState,
  106972. textureAtlasCoordinates,
  106973. vafWriters,
  106974. billboard
  106975. );
  106976. writePixelOffsetScaleByDistance(
  106977. billboardCollection,
  106978. frameState,
  106979. textureAtlasCoordinates,
  106980. vafWriters,
  106981. billboard
  106982. );
  106983. writeCompressedAttribute3(
  106984. billboardCollection,
  106985. frameState,
  106986. textureAtlasCoordinates,
  106987. vafWriters,
  106988. billboard
  106989. );
  106990. writeTextureCoordinateBoundsOrLabelTranslate(
  106991. billboardCollection,
  106992. frameState,
  106993. textureAtlasCoordinates,
  106994. vafWriters,
  106995. billboard
  106996. );
  106997. writeBatchId(
  106998. billboardCollection,
  106999. frameState,
  107000. textureAtlasCoordinates,
  107001. vafWriters,
  107002. billboard
  107003. );
  107004. writeSDF(
  107005. billboardCollection,
  107006. frameState,
  107007. textureAtlasCoordinates,
  107008. vafWriters,
  107009. billboard
  107010. );
  107011. }
  107012. function recomputeActualPositions(billboardCollection, billboards, length3, frameState, modelMatrix, recomputeBoundingVolume) {
  107013. let boundingVolume;
  107014. if (frameState.mode === SceneMode_default.SCENE3D) {
  107015. boundingVolume = billboardCollection._baseVolume;
  107016. billboardCollection._boundingVolumeDirty = true;
  107017. } else {
  107018. boundingVolume = billboardCollection._baseVolume2D;
  107019. }
  107020. const positions = [];
  107021. for (let i2 = 0; i2 < length3; ++i2) {
  107022. const billboard = billboards[i2];
  107023. const position = billboard.position;
  107024. const actualPosition = Billboard_default._computeActualPosition(
  107025. billboard,
  107026. position,
  107027. frameState,
  107028. modelMatrix
  107029. );
  107030. if (defined_default(actualPosition)) {
  107031. billboard._setActualPosition(actualPosition);
  107032. if (recomputeBoundingVolume) {
  107033. positions.push(actualPosition);
  107034. } else {
  107035. BoundingSphere_default.expand(boundingVolume, actualPosition, boundingVolume);
  107036. }
  107037. }
  107038. }
  107039. if (recomputeBoundingVolume) {
  107040. BoundingSphere_default.fromPoints(positions, boundingVolume);
  107041. }
  107042. }
  107043. function updateMode(billboardCollection, frameState) {
  107044. const mode2 = frameState.mode;
  107045. const billboards = billboardCollection._billboards;
  107046. const billboardsToUpdate = billboardCollection._billboardsToUpdate;
  107047. const modelMatrix = billboardCollection._modelMatrix;
  107048. if (billboardCollection._createVertexArray || billboardCollection._mode !== mode2 || mode2 !== SceneMode_default.SCENE3D && !Matrix4_default.equals(modelMatrix, billboardCollection.modelMatrix)) {
  107049. billboardCollection._mode = mode2;
  107050. Matrix4_default.clone(billboardCollection.modelMatrix, modelMatrix);
  107051. billboardCollection._createVertexArray = true;
  107052. if (mode2 === SceneMode_default.SCENE3D || mode2 === SceneMode_default.SCENE2D || mode2 === SceneMode_default.COLUMBUS_VIEW) {
  107053. recomputeActualPositions(
  107054. billboardCollection,
  107055. billboards,
  107056. billboards.length,
  107057. frameState,
  107058. modelMatrix,
  107059. true
  107060. );
  107061. }
  107062. } else if (mode2 === SceneMode_default.MORPHING) {
  107063. recomputeActualPositions(
  107064. billboardCollection,
  107065. billboards,
  107066. billboards.length,
  107067. frameState,
  107068. modelMatrix,
  107069. true
  107070. );
  107071. } else if (mode2 === SceneMode_default.SCENE2D || mode2 === SceneMode_default.COLUMBUS_VIEW) {
  107072. recomputeActualPositions(
  107073. billboardCollection,
  107074. billboardsToUpdate,
  107075. billboardCollection._billboardsToUpdateIndex,
  107076. frameState,
  107077. modelMatrix,
  107078. false
  107079. );
  107080. }
  107081. }
  107082. function updateBoundingVolume(collection, frameState, boundingVolume) {
  107083. let pixelScale = 1;
  107084. if (!collection._allSizedInMeters || collection._maxPixelOffset !== 0) {
  107085. pixelScale = frameState.camera.getPixelSize(
  107086. boundingVolume,
  107087. frameState.context.drawingBufferWidth,
  107088. frameState.context.drawingBufferHeight
  107089. );
  107090. }
  107091. let size = pixelScale * collection._maxScale * collection._maxSize * 2;
  107092. if (collection._allHorizontalCenter && collection._allVerticalCenter) {
  107093. size *= 0.5;
  107094. }
  107095. const offset2 = pixelScale * collection._maxPixelOffset + collection._maxEyeOffset;
  107096. boundingVolume.radius += size + offset2;
  107097. }
  107098. function createDebugCommand(billboardCollection, context) {
  107099. const fs = "uniform sampler2D billboard_texture; \nvarying vec2 v_textureCoordinates; \nvoid main() \n{ \n gl_FragColor = texture2D(billboard_texture, v_textureCoordinates); \n} \n";
  107100. const drawCommand = context.createViewportQuadCommand(fs, {
  107101. uniformMap: {
  107102. billboard_texture: function() {
  107103. return billboardCollection._textureAtlas.texture;
  107104. }
  107105. }
  107106. });
  107107. drawCommand.pass = Pass_default.OVERLAY;
  107108. return drawCommand;
  107109. }
  107110. var scratchWriterArray = [];
  107111. BillboardCollection.prototype.update = function(frameState) {
  107112. removeBillboards(this);
  107113. if (!this.show) {
  107114. return;
  107115. }
  107116. let billboards = this._billboards;
  107117. let billboardsLength = billboards.length;
  107118. const context = frameState.context;
  107119. this._instanced = context.instancedArrays;
  107120. attributeLocations = this._instanced ? attributeLocationsInstanced : attributeLocationsBatched;
  107121. getIndexBuffer = this._instanced ? getIndexBufferInstanced : getIndexBufferBatched;
  107122. let textureAtlas = this._textureAtlas;
  107123. if (!defined_default(textureAtlas)) {
  107124. textureAtlas = this._textureAtlas = new TextureAtlas_default({
  107125. context
  107126. });
  107127. for (let ii = 0; ii < billboardsLength; ++ii) {
  107128. billboards[ii]._loadImage();
  107129. }
  107130. }
  107131. const textureAtlasCoordinates = textureAtlas.textureCoordinates;
  107132. if (textureAtlasCoordinates.length === 0) {
  107133. return;
  107134. }
  107135. updateMode(this, frameState);
  107136. billboards = this._billboards;
  107137. billboardsLength = billboards.length;
  107138. const billboardsToUpdate = this._billboardsToUpdate;
  107139. const billboardsToUpdateLength = this._billboardsToUpdateIndex;
  107140. const properties = this._propertiesChanged;
  107141. const textureAtlasGUID = textureAtlas.guid;
  107142. const createVertexArray8 = this._createVertexArray || this._textureAtlasGUID !== textureAtlasGUID;
  107143. this._textureAtlasGUID = textureAtlasGUID;
  107144. let vafWriters;
  107145. const pass = frameState.passes;
  107146. const picking = pass.pick;
  107147. if (createVertexArray8 || !picking && this.computeNewBuffersUsage()) {
  107148. this._createVertexArray = false;
  107149. for (let k = 0; k < NUMBER_OF_PROPERTIES; ++k) {
  107150. properties[k] = 0;
  107151. }
  107152. this._vaf = this._vaf && this._vaf.destroy();
  107153. if (billboardsLength > 0) {
  107154. this._vaf = createVAF(
  107155. context,
  107156. billboardsLength,
  107157. this._buffersUsage,
  107158. this._instanced,
  107159. this._batchTable,
  107160. this._sdf
  107161. );
  107162. vafWriters = this._vaf.writers;
  107163. for (let i2 = 0; i2 < billboardsLength; ++i2) {
  107164. const billboard = this._billboards[i2];
  107165. billboard._dirty = false;
  107166. writeBillboard(
  107167. this,
  107168. frameState,
  107169. textureAtlasCoordinates,
  107170. vafWriters,
  107171. billboard
  107172. );
  107173. }
  107174. this._vaf.commit(getIndexBuffer(context));
  107175. }
  107176. this._billboardsToUpdateIndex = 0;
  107177. } else if (billboardsToUpdateLength > 0) {
  107178. const writers = scratchWriterArray;
  107179. writers.length = 0;
  107180. if (properties[POSITION_INDEX2] || properties[ROTATION_INDEX2] || properties[SCALE_INDEX2]) {
  107181. writers.push(writePositionScaleAndRotation);
  107182. }
  107183. if (properties[IMAGE_INDEX_INDEX2] || properties[PIXEL_OFFSET_INDEX2] || properties[HORIZONTAL_ORIGIN_INDEX2] || properties[VERTICAL_ORIGIN_INDEX2] || properties[SHOW_INDEX2]) {
  107184. writers.push(writeCompressedAttrib0);
  107185. if (this._instanced) {
  107186. writers.push(writeEyeOffset);
  107187. }
  107188. }
  107189. if (properties[IMAGE_INDEX_INDEX2] || properties[ALIGNED_AXIS_INDEX2] || properties[TRANSLUCENCY_BY_DISTANCE_INDEX2]) {
  107190. writers.push(writeCompressedAttrib1);
  107191. writers.push(writeCompressedAttrib2);
  107192. }
  107193. if (properties[IMAGE_INDEX_INDEX2] || properties[COLOR_INDEX2]) {
  107194. writers.push(writeCompressedAttrib2);
  107195. }
  107196. if (properties[EYE_OFFSET_INDEX2]) {
  107197. writers.push(writeEyeOffset);
  107198. }
  107199. if (properties[SCALE_BY_DISTANCE_INDEX2]) {
  107200. writers.push(writeScaleByDistance);
  107201. }
  107202. if (properties[PIXEL_OFFSET_SCALE_BY_DISTANCE_INDEX2]) {
  107203. writers.push(writePixelOffsetScaleByDistance);
  107204. }
  107205. if (properties[DISTANCE_DISPLAY_CONDITION_INDEX] || properties[DISABLE_DEPTH_DISTANCE2] || properties[IMAGE_INDEX_INDEX2] || properties[POSITION_INDEX2]) {
  107206. writers.push(writeCompressedAttribute3);
  107207. }
  107208. if (properties[IMAGE_INDEX_INDEX2] || properties[POSITION_INDEX2]) {
  107209. writers.push(writeTextureCoordinateBoundsOrLabelTranslate);
  107210. }
  107211. if (properties[SDF_INDEX2]) {
  107212. writers.push(writeSDF);
  107213. }
  107214. const numWriters = writers.length;
  107215. vafWriters = this._vaf.writers;
  107216. if (billboardsToUpdateLength / billboardsLength > 0.1) {
  107217. for (let m = 0; m < billboardsToUpdateLength; ++m) {
  107218. const b = billboardsToUpdate[m];
  107219. b._dirty = false;
  107220. for (let n2 = 0; n2 < numWriters; ++n2) {
  107221. writers[n2](this, frameState, textureAtlasCoordinates, vafWriters, b);
  107222. }
  107223. }
  107224. this._vaf.commit(getIndexBuffer(context));
  107225. } else {
  107226. for (let h = 0; h < billboardsToUpdateLength; ++h) {
  107227. const bb = billboardsToUpdate[h];
  107228. bb._dirty = false;
  107229. for (let o2 = 0; o2 < numWriters; ++o2) {
  107230. writers[o2](this, frameState, textureAtlasCoordinates, vafWriters, bb);
  107231. }
  107232. if (this._instanced) {
  107233. this._vaf.subCommit(bb._index, 1);
  107234. } else {
  107235. this._vaf.subCommit(bb._index * 4, 4);
  107236. }
  107237. }
  107238. this._vaf.endSubCommits();
  107239. }
  107240. this._billboardsToUpdateIndex = 0;
  107241. }
  107242. if (billboardsToUpdateLength > billboardsLength * 1.5) {
  107243. billboardsToUpdate.length = billboardsLength;
  107244. }
  107245. if (!defined_default(this._vaf) || !defined_default(this._vaf.va)) {
  107246. return;
  107247. }
  107248. if (this._boundingVolumeDirty) {
  107249. this._boundingVolumeDirty = false;
  107250. BoundingSphere_default.transform(
  107251. this._baseVolume,
  107252. this.modelMatrix,
  107253. this._baseVolumeWC
  107254. );
  107255. }
  107256. let boundingVolume;
  107257. let modelMatrix = Matrix4_default.IDENTITY;
  107258. if (frameState.mode === SceneMode_default.SCENE3D) {
  107259. modelMatrix = this.modelMatrix;
  107260. boundingVolume = BoundingSphere_default.clone(
  107261. this._baseVolumeWC,
  107262. this._boundingVolume
  107263. );
  107264. } else {
  107265. boundingVolume = BoundingSphere_default.clone(
  107266. this._baseVolume2D,
  107267. this._boundingVolume
  107268. );
  107269. }
  107270. updateBoundingVolume(this, frameState, boundingVolume);
  107271. const blendOptionChanged = this._blendOption !== this.blendOption;
  107272. this._blendOption = this.blendOption;
  107273. if (blendOptionChanged) {
  107274. if (this._blendOption === BlendOption_default.OPAQUE || this._blendOption === BlendOption_default.OPAQUE_AND_TRANSLUCENT) {
  107275. this._rsOpaque = RenderState_default.fromCache({
  107276. depthTest: {
  107277. enabled: true,
  107278. func: WebGLConstants_default.LESS
  107279. },
  107280. depthMask: true
  107281. });
  107282. } else {
  107283. this._rsOpaque = void 0;
  107284. }
  107285. const useTranslucentDepthMask = this._blendOption === BlendOption_default.TRANSLUCENT;
  107286. if (this._blendOption === BlendOption_default.TRANSLUCENT || this._blendOption === BlendOption_default.OPAQUE_AND_TRANSLUCENT) {
  107287. this._rsTranslucent = RenderState_default.fromCache({
  107288. depthTest: {
  107289. enabled: true,
  107290. func: useTranslucentDepthMask ? WebGLConstants_default.LEQUAL : WebGLConstants_default.LESS
  107291. },
  107292. depthMask: useTranslucentDepthMask,
  107293. blending: BlendingState_default.ALPHA_BLEND
  107294. });
  107295. } else {
  107296. this._rsTranslucent = void 0;
  107297. }
  107298. }
  107299. this._shaderDisableDepthDistance = this._shaderDisableDepthDistance || frameState.minimumDisableDepthTestDistance !== 0;
  107300. let vsSource;
  107301. let fsSource;
  107302. let vs;
  107303. let fs;
  107304. let vertDefines;
  107305. const supportVSTextureReads = ContextLimits_default.maximumVertexTextureImageUnits > 0;
  107306. if (blendOptionChanged || this._shaderRotation !== this._compiledShaderRotation || this._shaderAlignedAxis !== this._compiledShaderAlignedAxis || this._shaderScaleByDistance !== this._compiledShaderScaleByDistance || this._shaderTranslucencyByDistance !== this._compiledShaderTranslucencyByDistance || this._shaderPixelOffsetScaleByDistance !== this._compiledShaderPixelOffsetScaleByDistance || this._shaderDistanceDisplayCondition !== this._compiledShaderDistanceDisplayCondition || this._shaderDisableDepthDistance !== this._compiledShaderDisableDepthDistance || this._shaderClampToGround !== this._compiledShaderClampToGround || this._sdf !== this._compiledSDF) {
  107307. vsSource = BillboardCollectionVS_default;
  107308. fsSource = BillboardCollectionFS_default;
  107309. vertDefines = [];
  107310. if (defined_default(this._batchTable)) {
  107311. vertDefines.push("VECTOR_TILE");
  107312. vsSource = this._batchTable.getVertexShaderCallback(
  107313. false,
  107314. "a_batchId",
  107315. void 0
  107316. )(vsSource);
  107317. fsSource = this._batchTable.getFragmentShaderCallback(
  107318. false,
  107319. void 0
  107320. )(fsSource);
  107321. }
  107322. vs = new ShaderSource_default({
  107323. defines: vertDefines,
  107324. sources: [vsSource]
  107325. });
  107326. if (this._instanced) {
  107327. vs.defines.push("INSTANCED");
  107328. }
  107329. if (this._shaderRotation) {
  107330. vs.defines.push("ROTATION");
  107331. }
  107332. if (this._shaderAlignedAxis) {
  107333. vs.defines.push("ALIGNED_AXIS");
  107334. }
  107335. if (this._shaderScaleByDistance) {
  107336. vs.defines.push("EYE_DISTANCE_SCALING");
  107337. }
  107338. if (this._shaderTranslucencyByDistance) {
  107339. vs.defines.push("EYE_DISTANCE_TRANSLUCENCY");
  107340. }
  107341. if (this._shaderPixelOffsetScaleByDistance) {
  107342. vs.defines.push("EYE_DISTANCE_PIXEL_OFFSET");
  107343. }
  107344. if (this._shaderDistanceDisplayCondition) {
  107345. vs.defines.push("DISTANCE_DISPLAY_CONDITION");
  107346. }
  107347. if (this._shaderDisableDepthDistance) {
  107348. vs.defines.push("DISABLE_DEPTH_DISTANCE");
  107349. }
  107350. if (this._shaderClampToGround) {
  107351. if (supportVSTextureReads) {
  107352. vs.defines.push("VERTEX_DEPTH_CHECK");
  107353. } else {
  107354. vs.defines.push("FRAGMENT_DEPTH_CHECK");
  107355. }
  107356. }
  107357. const sdfEdge = 1 - SDFSettings_default.CUTOFF;
  107358. if (this._sdf) {
  107359. vs.defines.push("SDF");
  107360. }
  107361. const vectorFragDefine = defined_default(this._batchTable) ? "VECTOR_TILE" : "";
  107362. if (this._blendOption === BlendOption_default.OPAQUE_AND_TRANSLUCENT) {
  107363. fs = new ShaderSource_default({
  107364. defines: ["OPAQUE", vectorFragDefine],
  107365. sources: [fsSource]
  107366. });
  107367. if (this._shaderClampToGround) {
  107368. if (supportVSTextureReads) {
  107369. fs.defines.push("VERTEX_DEPTH_CHECK");
  107370. } else {
  107371. fs.defines.push("FRAGMENT_DEPTH_CHECK");
  107372. }
  107373. }
  107374. if (this._sdf) {
  107375. fs.defines.push("SDF");
  107376. fs.defines.push(`SDF_EDGE ${sdfEdge}`);
  107377. }
  107378. this._sp = ShaderProgram_default.replaceCache({
  107379. context,
  107380. shaderProgram: this._sp,
  107381. vertexShaderSource: vs,
  107382. fragmentShaderSource: fs,
  107383. attributeLocations
  107384. });
  107385. fs = new ShaderSource_default({
  107386. defines: ["TRANSLUCENT", vectorFragDefine],
  107387. sources: [fsSource]
  107388. });
  107389. if (this._shaderClampToGround) {
  107390. if (supportVSTextureReads) {
  107391. fs.defines.push("VERTEX_DEPTH_CHECK");
  107392. } else {
  107393. fs.defines.push("FRAGMENT_DEPTH_CHECK");
  107394. }
  107395. }
  107396. if (this._sdf) {
  107397. fs.defines.push("SDF");
  107398. fs.defines.push(`SDF_EDGE ${sdfEdge}`);
  107399. }
  107400. this._spTranslucent = ShaderProgram_default.replaceCache({
  107401. context,
  107402. shaderProgram: this._spTranslucent,
  107403. vertexShaderSource: vs,
  107404. fragmentShaderSource: fs,
  107405. attributeLocations
  107406. });
  107407. }
  107408. if (this._blendOption === BlendOption_default.OPAQUE) {
  107409. fs = new ShaderSource_default({
  107410. defines: [vectorFragDefine],
  107411. sources: [fsSource]
  107412. });
  107413. if (this._shaderClampToGround) {
  107414. if (supportVSTextureReads) {
  107415. fs.defines.push("VERTEX_DEPTH_CHECK");
  107416. } else {
  107417. fs.defines.push("FRAGMENT_DEPTH_CHECK");
  107418. }
  107419. }
  107420. if (this._sdf) {
  107421. fs.defines.push("SDF");
  107422. fs.defines.push(`SDF_EDGE ${sdfEdge}`);
  107423. }
  107424. this._sp = ShaderProgram_default.replaceCache({
  107425. context,
  107426. shaderProgram: this._sp,
  107427. vertexShaderSource: vs,
  107428. fragmentShaderSource: fs,
  107429. attributeLocations
  107430. });
  107431. }
  107432. if (this._blendOption === BlendOption_default.TRANSLUCENT) {
  107433. fs = new ShaderSource_default({
  107434. defines: [vectorFragDefine],
  107435. sources: [fsSource]
  107436. });
  107437. if (this._shaderClampToGround) {
  107438. if (supportVSTextureReads) {
  107439. fs.defines.push("VERTEX_DEPTH_CHECK");
  107440. } else {
  107441. fs.defines.push("FRAGMENT_DEPTH_CHECK");
  107442. }
  107443. }
  107444. if (this._sdf) {
  107445. fs.defines.push("SDF");
  107446. fs.defines.push(`SDF_EDGE ${sdfEdge}`);
  107447. }
  107448. this._spTranslucent = ShaderProgram_default.replaceCache({
  107449. context,
  107450. shaderProgram: this._spTranslucent,
  107451. vertexShaderSource: vs,
  107452. fragmentShaderSource: fs,
  107453. attributeLocations
  107454. });
  107455. }
  107456. this._compiledShaderRotation = this._shaderRotation;
  107457. this._compiledShaderAlignedAxis = this._shaderAlignedAxis;
  107458. this._compiledShaderScaleByDistance = this._shaderScaleByDistance;
  107459. this._compiledShaderTranslucencyByDistance = this._shaderTranslucencyByDistance;
  107460. this._compiledShaderPixelOffsetScaleByDistance = this._shaderPixelOffsetScaleByDistance;
  107461. this._compiledShaderDistanceDisplayCondition = this._shaderDistanceDisplayCondition;
  107462. this._compiledShaderDisableDepthDistance = this._shaderDisableDepthDistance;
  107463. this._compiledShaderClampToGround = this._shaderClampToGround;
  107464. this._compiledSDF = this._sdf;
  107465. }
  107466. const commandList = frameState.commandList;
  107467. if (pass.render || pass.pick) {
  107468. const colorList = this._colorCommands;
  107469. const opaque = this._blendOption === BlendOption_default.OPAQUE;
  107470. const opaqueAndTranslucent = this._blendOption === BlendOption_default.OPAQUE_AND_TRANSLUCENT;
  107471. const va = this._vaf.va;
  107472. const vaLength = va.length;
  107473. let uniforms = this._uniforms;
  107474. let pickId;
  107475. if (defined_default(this._batchTable)) {
  107476. uniforms = this._batchTable.getUniformMapCallback()(uniforms);
  107477. pickId = this._batchTable.getPickId();
  107478. } else {
  107479. pickId = "v_pickColor";
  107480. }
  107481. colorList.length = vaLength;
  107482. const totalLength = opaqueAndTranslucent ? vaLength * 2 : vaLength;
  107483. for (let j = 0; j < totalLength; ++j) {
  107484. let command = colorList[j];
  107485. if (!defined_default(command)) {
  107486. command = colorList[j] = new DrawCommand_default();
  107487. }
  107488. const opaqueCommand = opaque || opaqueAndTranslucent && j % 2 === 0;
  107489. command.pass = opaqueCommand || !opaqueAndTranslucent ? Pass_default.OPAQUE : Pass_default.TRANSLUCENT;
  107490. command.owner = this;
  107491. const index2 = opaqueAndTranslucent ? Math.floor(j / 2) : j;
  107492. command.boundingVolume = boundingVolume;
  107493. command.modelMatrix = modelMatrix;
  107494. command.count = va[index2].indicesCount;
  107495. command.shaderProgram = opaqueCommand ? this._sp : this._spTranslucent;
  107496. command.uniformMap = uniforms;
  107497. command.vertexArray = va[index2].va;
  107498. command.renderState = opaqueCommand ? this._rsOpaque : this._rsTranslucent;
  107499. command.debugShowBoundingVolume = this.debugShowBoundingVolume;
  107500. command.pickId = pickId;
  107501. if (this._instanced) {
  107502. command.count = 6;
  107503. command.instanceCount = billboardsLength;
  107504. }
  107505. commandList.push(command);
  107506. }
  107507. if (this.debugShowTextureAtlas) {
  107508. if (!defined_default(this.debugCommand)) {
  107509. this.debugCommand = createDebugCommand(this, frameState.context);
  107510. }
  107511. commandList.push(this.debugCommand);
  107512. }
  107513. }
  107514. };
  107515. BillboardCollection.prototype.isDestroyed = function() {
  107516. return false;
  107517. };
  107518. BillboardCollection.prototype.destroy = function() {
  107519. if (defined_default(this._removeCallbackFunc)) {
  107520. this._removeCallbackFunc();
  107521. this._removeCallbackFunc = void 0;
  107522. }
  107523. this._textureAtlas = this._destroyTextureAtlas && this._textureAtlas && this._textureAtlas.destroy();
  107524. this._sp = this._sp && this._sp.destroy();
  107525. this._spTranslucent = this._spTranslucent && this._spTranslucent.destroy();
  107526. this._vaf = this._vaf && this._vaf.destroy();
  107527. destroyBillboards(this._billboards);
  107528. return destroyObject_default(this);
  107529. };
  107530. var BillboardCollection_default = BillboardCollection;
  107531. // node_modules/cesium/Source/Scene/createBillboardPointCallback.js
  107532. function createBillboardPointCallback(centerAlpha, cssColor, cssOutlineColor, cssOutlineWidth, pixelSize) {
  107533. return function() {
  107534. const canvas = document.createElement("canvas");
  107535. const length3 = pixelSize + 2 * cssOutlineWidth;
  107536. canvas.height = canvas.width = length3;
  107537. const context2D = canvas.getContext("2d");
  107538. context2D.clearRect(0, 0, length3, length3);
  107539. if (cssOutlineWidth !== 0) {
  107540. context2D.beginPath();
  107541. context2D.arc(length3 / 2, length3 / 2, length3 / 2, 0, 2 * Math.PI, true);
  107542. context2D.closePath();
  107543. context2D.fillStyle = cssOutlineColor;
  107544. context2D.fill();
  107545. if (centerAlpha < 1) {
  107546. context2D.save();
  107547. context2D.globalCompositeOperation = "destination-out";
  107548. context2D.beginPath();
  107549. context2D.arc(
  107550. length3 / 2,
  107551. length3 / 2,
  107552. pixelSize / 2,
  107553. 0,
  107554. 2 * Math.PI,
  107555. true
  107556. );
  107557. context2D.closePath();
  107558. context2D.fillStyle = "black";
  107559. context2D.fill();
  107560. context2D.restore();
  107561. }
  107562. }
  107563. context2D.beginPath();
  107564. context2D.arc(length3 / 2, length3 / 2, pixelSize / 2, 0, 2 * Math.PI, true);
  107565. context2D.closePath();
  107566. context2D.fillStyle = cssColor;
  107567. context2D.fill();
  107568. return canvas;
  107569. };
  107570. }
  107571. var createBillboardPointCallback_default = createBillboardPointCallback;
  107572. // node_modules/cesium/Source/Scene/Cesium3DTilePointFeature.js
  107573. function Cesium3DTilePointFeature(content, batchId, billboard, label, polyline) {
  107574. this._content = content;
  107575. this._billboard = billboard;
  107576. this._label = label;
  107577. this._polyline = polyline;
  107578. this._batchId = batchId;
  107579. this._billboardImage = void 0;
  107580. this._billboardColor = void 0;
  107581. this._billboardOutlineColor = void 0;
  107582. this._billboardOutlineWidth = void 0;
  107583. this._billboardSize = void 0;
  107584. this._pointSize = void 0;
  107585. this._color = void 0;
  107586. this._pointSize = void 0;
  107587. this._pointOutlineColor = void 0;
  107588. this._pointOutlineWidth = void 0;
  107589. this._heightOffset = void 0;
  107590. this._pickIds = new Array(3);
  107591. setBillboardImage(this);
  107592. }
  107593. var scratchCartographic7 = new Cartographic_default();
  107594. Object.defineProperties(Cesium3DTilePointFeature.prototype, {
  107595. show: {
  107596. get: function() {
  107597. return this._label.show;
  107598. },
  107599. set: function(value) {
  107600. this._label.show = value;
  107601. this._billboard.show = value;
  107602. this._polyline.show = value;
  107603. }
  107604. },
  107605. color: {
  107606. get: function() {
  107607. return this._color;
  107608. },
  107609. set: function(value) {
  107610. this._color = Color_default.clone(value, this._color);
  107611. setBillboardImage(this);
  107612. }
  107613. },
  107614. pointSize: {
  107615. get: function() {
  107616. return this._pointSize;
  107617. },
  107618. set: function(value) {
  107619. this._pointSize = value;
  107620. setBillboardImage(this);
  107621. }
  107622. },
  107623. pointOutlineColor: {
  107624. get: function() {
  107625. return this._pointOutlineColor;
  107626. },
  107627. set: function(value) {
  107628. this._pointOutlineColor = Color_default.clone(value, this._pointOutlineColor);
  107629. setBillboardImage(this);
  107630. }
  107631. },
  107632. pointOutlineWidth: {
  107633. get: function() {
  107634. return this._pointOutlineWidth;
  107635. },
  107636. set: function(value) {
  107637. this._pointOutlineWidth = value;
  107638. setBillboardImage(this);
  107639. }
  107640. },
  107641. labelColor: {
  107642. get: function() {
  107643. return this._label.fillColor;
  107644. },
  107645. set: function(value) {
  107646. this._label.fillColor = value;
  107647. this._polyline.show = this._label.show && value.alpha > 0;
  107648. }
  107649. },
  107650. labelOutlineColor: {
  107651. get: function() {
  107652. return this._label.outlineColor;
  107653. },
  107654. set: function(value) {
  107655. this._label.outlineColor = value;
  107656. }
  107657. },
  107658. labelOutlineWidth: {
  107659. get: function() {
  107660. return this._label.outlineWidth;
  107661. },
  107662. set: function(value) {
  107663. this._label.outlineWidth = value;
  107664. }
  107665. },
  107666. font: {
  107667. get: function() {
  107668. return this._label.font;
  107669. },
  107670. set: function(value) {
  107671. this._label.font = value;
  107672. }
  107673. },
  107674. labelStyle: {
  107675. get: function() {
  107676. return this._label.style;
  107677. },
  107678. set: function(value) {
  107679. this._label.style = value;
  107680. }
  107681. },
  107682. labelText: {
  107683. get: function() {
  107684. return this._label.text;
  107685. },
  107686. set: function(value) {
  107687. if (!defined_default(value)) {
  107688. value = "";
  107689. }
  107690. this._label.text = value;
  107691. }
  107692. },
  107693. backgroundColor: {
  107694. get: function() {
  107695. return this._label.backgroundColor;
  107696. },
  107697. set: function(value) {
  107698. this._label.backgroundColor = value;
  107699. }
  107700. },
  107701. backgroundPadding: {
  107702. get: function() {
  107703. return this._label.backgroundPadding;
  107704. },
  107705. set: function(value) {
  107706. this._label.backgroundPadding = value;
  107707. }
  107708. },
  107709. backgroundEnabled: {
  107710. get: function() {
  107711. return this._label.showBackground;
  107712. },
  107713. set: function(value) {
  107714. this._label.showBackground = value;
  107715. }
  107716. },
  107717. scaleByDistance: {
  107718. get: function() {
  107719. return this._label.scaleByDistance;
  107720. },
  107721. set: function(value) {
  107722. this._label.scaleByDistance = value;
  107723. this._billboard.scaleByDistance = value;
  107724. }
  107725. },
  107726. translucencyByDistance: {
  107727. get: function() {
  107728. return this._label.translucencyByDistance;
  107729. },
  107730. set: function(value) {
  107731. this._label.translucencyByDistance = value;
  107732. this._billboard.translucencyByDistance = value;
  107733. }
  107734. },
  107735. distanceDisplayCondition: {
  107736. get: function() {
  107737. return this._label.distanceDisplayCondition;
  107738. },
  107739. set: function(value) {
  107740. this._label.distanceDisplayCondition = value;
  107741. this._polyline.distanceDisplayCondition = value;
  107742. this._billboard.distanceDisplayCondition = value;
  107743. }
  107744. },
  107745. heightOffset: {
  107746. get: function() {
  107747. return this._heightOffset;
  107748. },
  107749. set: function(value) {
  107750. const offset2 = defaultValue_default(this._heightOffset, 0);
  107751. const ellipsoid = this._content.tileset.ellipsoid;
  107752. const cart = ellipsoid.cartesianToCartographic(
  107753. this._billboard.position,
  107754. scratchCartographic7
  107755. );
  107756. cart.height = cart.height - offset2 + value;
  107757. const newPosition = ellipsoid.cartographicToCartesian(cart);
  107758. this._billboard.position = newPosition;
  107759. this._label.position = this._billboard.position;
  107760. this._polyline.positions = [this._polyline.positions[0], newPosition];
  107761. this._heightOffset = value;
  107762. }
  107763. },
  107764. anchorLineEnabled: {
  107765. get: function() {
  107766. return this._polyline.show;
  107767. },
  107768. set: function(value) {
  107769. this._polyline.show = value;
  107770. }
  107771. },
  107772. anchorLineColor: {
  107773. get: function() {
  107774. return this._polyline.material.uniforms.color;
  107775. },
  107776. set: function(value) {
  107777. this._polyline.material.uniforms.color = Color_default.clone(
  107778. value,
  107779. this._polyline.material.uniforms.color
  107780. );
  107781. }
  107782. },
  107783. image: {
  107784. get: function() {
  107785. return this._billboardImage;
  107786. },
  107787. set: function(value) {
  107788. const imageChanged = this._billboardImage !== value;
  107789. this._billboardImage = value;
  107790. if (imageChanged) {
  107791. setBillboardImage(this);
  107792. }
  107793. }
  107794. },
  107795. disableDepthTestDistance: {
  107796. get: function() {
  107797. return this._label.disableDepthTestDistance;
  107798. },
  107799. set: function(value) {
  107800. this._label.disableDepthTestDistance = value;
  107801. this._billboard.disableDepthTestDistance = value;
  107802. }
  107803. },
  107804. horizontalOrigin: {
  107805. get: function() {
  107806. return this._billboard.horizontalOrigin;
  107807. },
  107808. set: function(value) {
  107809. this._billboard.horizontalOrigin = value;
  107810. }
  107811. },
  107812. verticalOrigin: {
  107813. get: function() {
  107814. return this._billboard.verticalOrigin;
  107815. },
  107816. set: function(value) {
  107817. this._billboard.verticalOrigin = value;
  107818. }
  107819. },
  107820. labelHorizontalOrigin: {
  107821. get: function() {
  107822. return this._label.horizontalOrigin;
  107823. },
  107824. set: function(value) {
  107825. this._label.horizontalOrigin = value;
  107826. }
  107827. },
  107828. labelVerticalOrigin: {
  107829. get: function() {
  107830. return this._label.verticalOrigin;
  107831. },
  107832. set: function(value) {
  107833. this._label.verticalOrigin = value;
  107834. }
  107835. },
  107836. content: {
  107837. get: function() {
  107838. return this._content;
  107839. }
  107840. },
  107841. tileset: {
  107842. get: function() {
  107843. return this._content.tileset;
  107844. }
  107845. },
  107846. primitive: {
  107847. get: function() {
  107848. return this._content.tileset;
  107849. }
  107850. },
  107851. pickIds: {
  107852. get: function() {
  107853. const ids = this._pickIds;
  107854. ids[0] = this._billboard.pickId;
  107855. ids[1] = this._label.pickId;
  107856. ids[2] = this._polyline.pickId;
  107857. return ids;
  107858. }
  107859. }
  107860. });
  107861. Cesium3DTilePointFeature.defaultColor = Color_default.WHITE;
  107862. Cesium3DTilePointFeature.defaultPointOutlineColor = Color_default.BLACK;
  107863. Cesium3DTilePointFeature.defaultPointOutlineWidth = 0;
  107864. Cesium3DTilePointFeature.defaultPointSize = 8;
  107865. function setBillboardImage(feature2) {
  107866. const b = feature2._billboard;
  107867. if (defined_default(feature2._billboardImage) && feature2._billboardImage !== b.image) {
  107868. b.image = feature2._billboardImage;
  107869. return;
  107870. }
  107871. if (defined_default(feature2._billboardImage)) {
  107872. return;
  107873. }
  107874. const newColor = defaultValue_default(
  107875. feature2._color,
  107876. Cesium3DTilePointFeature.defaultColor
  107877. );
  107878. const newOutlineColor = defaultValue_default(
  107879. feature2._pointOutlineColor,
  107880. Cesium3DTilePointFeature.defaultPointOutlineColor
  107881. );
  107882. const newOutlineWidth = defaultValue_default(
  107883. feature2._pointOutlineWidth,
  107884. Cesium3DTilePointFeature.defaultPointOutlineWidth
  107885. );
  107886. const newPointSize = defaultValue_default(
  107887. feature2._pointSize,
  107888. Cesium3DTilePointFeature.defaultPointSize
  107889. );
  107890. const currentColor = feature2._billboardColor;
  107891. const currentOutlineColor = feature2._billboardOutlineColor;
  107892. const currentOutlineWidth = feature2._billboardOutlineWidth;
  107893. const currentPointSize = feature2._billboardSize;
  107894. if (Color_default.equals(newColor, currentColor) && Color_default.equals(newOutlineColor, currentOutlineColor) && newOutlineWidth === currentOutlineWidth && newPointSize === currentPointSize) {
  107895. return;
  107896. }
  107897. feature2._billboardColor = Color_default.clone(newColor, feature2._billboardColor);
  107898. feature2._billboardOutlineColor = Color_default.clone(
  107899. newOutlineColor,
  107900. feature2._billboardOutlineColor
  107901. );
  107902. feature2._billboardOutlineWidth = newOutlineWidth;
  107903. feature2._billboardSize = newPointSize;
  107904. const centerAlpha = newColor.alpha;
  107905. const cssColor = newColor.toCssColorString();
  107906. const cssOutlineColor = newOutlineColor.toCssColorString();
  107907. const textureId = JSON.stringify([
  107908. cssColor,
  107909. newPointSize,
  107910. cssOutlineColor,
  107911. newOutlineWidth
  107912. ]);
  107913. b.setImage(
  107914. textureId,
  107915. createBillboardPointCallback_default(
  107916. centerAlpha,
  107917. cssColor,
  107918. cssOutlineColor,
  107919. newOutlineWidth,
  107920. newPointSize
  107921. )
  107922. );
  107923. }
  107924. Cesium3DTilePointFeature.prototype.hasProperty = function(name) {
  107925. return this._content.batchTable.hasProperty(this._batchId, name);
  107926. };
  107927. Cesium3DTilePointFeature.prototype.getPropertyNames = function(results) {
  107928. return this._content.batchTable.getPropertyNames(this._batchId, results);
  107929. };
  107930. Cesium3DTilePointFeature.prototype.getProperty = function(name) {
  107931. return this._content.batchTable.getProperty(this._batchId, name);
  107932. };
  107933. Cesium3DTilePointFeature.prototype.getPropertyInherited = function(name) {
  107934. return Cesium3DTileFeature_default.getPropertyInherited(
  107935. this._content,
  107936. this._batchId,
  107937. name
  107938. );
  107939. };
  107940. Cesium3DTilePointFeature.prototype.setProperty = function(name, value) {
  107941. this._content.batchTable.setProperty(this._batchId, name, value);
  107942. this._content.featurePropertiesDirty = true;
  107943. };
  107944. Cesium3DTilePointFeature.prototype.isExactClass = function(className) {
  107945. return this._content.batchTable.isExactClass(this._batchId, className);
  107946. };
  107947. Cesium3DTilePointFeature.prototype.isClass = function(className) {
  107948. return this._content.batchTable.isClass(this._batchId, className);
  107949. };
  107950. Cesium3DTilePointFeature.prototype.getExactClassName = function() {
  107951. return this._content.batchTable.getExactClassName(this._batchId);
  107952. };
  107953. var Cesium3DTilePointFeature_default = Cesium3DTilePointFeature;
  107954. // node_modules/cesium/Source/ThirdParty/bitmap-sdf.js
  107955. var clamp_1 = clamp;
  107956. function clamp(value, min3, max3) {
  107957. return min3 < max3 ? value < min3 ? min3 : value > max3 ? max3 : value : value < max3 ? max3 : value > min3 ? min3 : value;
  107958. }
  107959. var bitmapSdf = calcSDF;
  107960. var INF = 1e20;
  107961. function calcSDF(src2, options) {
  107962. if (!options)
  107963. options = {};
  107964. var cutoff = options.cutoff == null ? 0.25 : options.cutoff;
  107965. var radius = options.radius == null ? 8 : options.radius;
  107966. var channel = options.channel || 0;
  107967. var w, h, size, data, intData, stride, ctx, canvas, imgData, i2, l2;
  107968. if (ArrayBuffer.isView(src2) || Array.isArray(src2)) {
  107969. if (!options.width || !options.height)
  107970. throw Error("For raw data width and height should be provided by options");
  107971. w = options.width, h = options.height;
  107972. data = src2;
  107973. if (!options.stride)
  107974. stride = Math.floor(src2.length / w / h);
  107975. else
  107976. stride = options.stride;
  107977. } else {
  107978. if (window.HTMLCanvasElement && src2 instanceof window.HTMLCanvasElement) {
  107979. canvas = src2;
  107980. ctx = canvas.getContext("2d");
  107981. w = canvas.width, h = canvas.height;
  107982. imgData = ctx.getImageData(0, 0, w, h);
  107983. data = imgData.data;
  107984. stride = 4;
  107985. } else if (window.CanvasRenderingContext2D && src2 instanceof window.CanvasRenderingContext2D) {
  107986. canvas = src2.canvas;
  107987. ctx = src2;
  107988. w = canvas.width, h = canvas.height;
  107989. imgData = ctx.getImageData(0, 0, w, h);
  107990. data = imgData.data;
  107991. stride = 4;
  107992. } else if (window.ImageData && src2 instanceof window.ImageData) {
  107993. imgData = src2;
  107994. w = src2.width, h = src2.height;
  107995. data = imgData.data;
  107996. stride = 4;
  107997. }
  107998. }
  107999. size = Math.max(w, h);
  108000. if (window.Uint8ClampedArray && data instanceof window.Uint8ClampedArray || window.Uint8Array && data instanceof window.Uint8Array) {
  108001. intData = data;
  108002. data = Array(w * h);
  108003. for (i2 = 0, l2 = intData.length; i2 < l2; i2++) {
  108004. data[i2] = intData[i2 * stride + channel] / 255;
  108005. }
  108006. } else {
  108007. if (stride !== 1)
  108008. throw Error("Raw data can have only 1 value per pixel");
  108009. }
  108010. var gridOuter = Array(w * h);
  108011. var gridInner = Array(w * h);
  108012. var f2 = Array(size);
  108013. var d = Array(size);
  108014. var z = Array(size + 1);
  108015. var v7 = Array(size);
  108016. for (i2 = 0, l2 = w * h; i2 < l2; i2++) {
  108017. var a4 = data[i2];
  108018. gridOuter[i2] = a4 === 1 ? 0 : a4 === 0 ? INF : Math.pow(Math.max(0, 0.5 - a4), 2);
  108019. gridInner[i2] = a4 === 1 ? INF : a4 === 0 ? 0 : Math.pow(Math.max(0, a4 - 0.5), 2);
  108020. }
  108021. edt(gridOuter, w, h, f2, d, v7, z);
  108022. edt(gridInner, w, h, f2, d, v7, z);
  108023. var dist = window.Float32Array ? new Float32Array(w * h) : new Array(w * h);
  108024. for (i2 = 0, l2 = w * h; i2 < l2; i2++) {
  108025. dist[i2] = clamp_1(1 - ((gridOuter[i2] - gridInner[i2]) / radius + cutoff), 0, 1);
  108026. }
  108027. return dist;
  108028. }
  108029. function edt(data, width, height, f2, d, v7, z) {
  108030. for (var x = 0; x < width; x++) {
  108031. for (var y = 0; y < height; y++) {
  108032. f2[y] = data[y * width + x];
  108033. }
  108034. edt1d(f2, d, v7, z, height);
  108035. for (y = 0; y < height; y++) {
  108036. data[y * width + x] = d[y];
  108037. }
  108038. }
  108039. for (y = 0; y < height; y++) {
  108040. for (x = 0; x < width; x++) {
  108041. f2[x] = data[y * width + x];
  108042. }
  108043. edt1d(f2, d, v7, z, width);
  108044. for (x = 0; x < width; x++) {
  108045. data[y * width + x] = Math.sqrt(d[x]);
  108046. }
  108047. }
  108048. }
  108049. function edt1d(f2, d, v7, z, n2) {
  108050. v7[0] = 0;
  108051. z[0] = -INF;
  108052. z[1] = +INF;
  108053. for (var q = 1, k = 0; q < n2; q++) {
  108054. var s2 = (f2[q] + q * q - (f2[v7[k]] + v7[k] * v7[k])) / (2 * q - 2 * v7[k]);
  108055. while (s2 <= z[k]) {
  108056. k--;
  108057. s2 = (f2[q] + q * q - (f2[v7[k]] + v7[k] * v7[k])) / (2 * q - 2 * v7[k]);
  108058. }
  108059. k++;
  108060. v7[k] = q;
  108061. z[k] = s2;
  108062. z[k + 1] = +INF;
  108063. }
  108064. for (q = 0, k = 0; q < n2; q++) {
  108065. while (z[k + 1] < q)
  108066. k++;
  108067. d[q] = (q - v7[k]) * (q - v7[k]) + f2[v7[k]];
  108068. }
  108069. }
  108070. // node_modules/cesium/Source/Scene/LabelStyle.js
  108071. var LabelStyle = {
  108072. FILL: 0,
  108073. OUTLINE: 1,
  108074. FILL_AND_OUTLINE: 2
  108075. };
  108076. var LabelStyle_default = Object.freeze(LabelStyle);
  108077. // node_modules/cesium/Source/Scene/Label.js
  108078. var fontInfoCache = {};
  108079. var fontInfoCacheLength = 0;
  108080. var fontInfoCacheMaxSize = 256;
  108081. var defaultBackgroundColor = new Color_default(0.165, 0.165, 0.165, 0.8);
  108082. var defaultBackgroundPadding = new Cartesian2_default(7, 5);
  108083. var textTypes = Object.freeze({
  108084. LTR: 0,
  108085. RTL: 1,
  108086. WEAK: 2,
  108087. BRACKETS: 3
  108088. });
  108089. function rebindAllGlyphs(label) {
  108090. if (!label._rebindAllGlyphs && !label._repositionAllGlyphs) {
  108091. label._labelCollection._labelsToUpdate.push(label);
  108092. }
  108093. label._rebindAllGlyphs = true;
  108094. }
  108095. function repositionAllGlyphs(label) {
  108096. if (!label._rebindAllGlyphs && !label._repositionAllGlyphs) {
  108097. label._labelCollection._labelsToUpdate.push(label);
  108098. }
  108099. label._repositionAllGlyphs = true;
  108100. }
  108101. function getCSSValue(element, property) {
  108102. return document.defaultView.getComputedStyle(element, null).getPropertyValue(property);
  108103. }
  108104. function parseFont(label) {
  108105. let fontInfo = fontInfoCache[label._font];
  108106. if (!defined_default(fontInfo)) {
  108107. const div = document.createElement("div");
  108108. div.style.position = "absolute";
  108109. div.style.opacity = 0;
  108110. div.style.font = label._font;
  108111. document.body.appendChild(div);
  108112. let lineHeight = parseFloat(getCSSValue(div, "line-height"));
  108113. if (isNaN(lineHeight)) {
  108114. lineHeight = void 0;
  108115. }
  108116. fontInfo = {
  108117. family: getCSSValue(div, "font-family"),
  108118. size: getCSSValue(div, "font-size").replace("px", ""),
  108119. style: getCSSValue(div, "font-style"),
  108120. weight: getCSSValue(div, "font-weight"),
  108121. lineHeight
  108122. };
  108123. document.body.removeChild(div);
  108124. if (fontInfoCacheLength < fontInfoCacheMaxSize) {
  108125. fontInfoCache[label._font] = fontInfo;
  108126. fontInfoCacheLength++;
  108127. }
  108128. }
  108129. label._fontFamily = fontInfo.family;
  108130. label._fontSize = fontInfo.size;
  108131. label._fontStyle = fontInfo.style;
  108132. label._fontWeight = fontInfo.weight;
  108133. label._lineHeight = fontInfo.lineHeight;
  108134. }
  108135. function Label(options, labelCollection) {
  108136. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  108137. if (defined_default(options.disableDepthTestDistance) && options.disableDepthTestDistance < 0) {
  108138. throw new DeveloperError_default(
  108139. "disableDepthTestDistance must be greater than 0.0."
  108140. );
  108141. }
  108142. let translucencyByDistance = options.translucencyByDistance;
  108143. let pixelOffsetScaleByDistance = options.pixelOffsetScaleByDistance;
  108144. let scaleByDistance = options.scaleByDistance;
  108145. let distanceDisplayCondition = options.distanceDisplayCondition;
  108146. if (defined_default(translucencyByDistance)) {
  108147. if (translucencyByDistance.far <= translucencyByDistance.near) {
  108148. throw new DeveloperError_default(
  108149. "translucencyByDistance.far must be greater than translucencyByDistance.near."
  108150. );
  108151. }
  108152. translucencyByDistance = NearFarScalar_default.clone(translucencyByDistance);
  108153. }
  108154. if (defined_default(pixelOffsetScaleByDistance)) {
  108155. if (pixelOffsetScaleByDistance.far <= pixelOffsetScaleByDistance.near) {
  108156. throw new DeveloperError_default(
  108157. "pixelOffsetScaleByDistance.far must be greater than pixelOffsetScaleByDistance.near."
  108158. );
  108159. }
  108160. pixelOffsetScaleByDistance = NearFarScalar_default.clone(
  108161. pixelOffsetScaleByDistance
  108162. );
  108163. }
  108164. if (defined_default(scaleByDistance)) {
  108165. if (scaleByDistance.far <= scaleByDistance.near) {
  108166. throw new DeveloperError_default(
  108167. "scaleByDistance.far must be greater than scaleByDistance.near."
  108168. );
  108169. }
  108170. scaleByDistance = NearFarScalar_default.clone(scaleByDistance);
  108171. }
  108172. if (defined_default(distanceDisplayCondition)) {
  108173. if (distanceDisplayCondition.far <= distanceDisplayCondition.near) {
  108174. throw new DeveloperError_default(
  108175. "distanceDisplayCondition.far must be greater than distanceDisplayCondition.near."
  108176. );
  108177. }
  108178. distanceDisplayCondition = DistanceDisplayCondition_default.clone(
  108179. distanceDisplayCondition
  108180. );
  108181. }
  108182. this._renderedText = void 0;
  108183. this._text = void 0;
  108184. this._show = defaultValue_default(options.show, true);
  108185. this._font = defaultValue_default(options.font, "30px sans-serif");
  108186. this._fillColor = Color_default.clone(defaultValue_default(options.fillColor, Color_default.WHITE));
  108187. this._outlineColor = Color_default.clone(
  108188. defaultValue_default(options.outlineColor, Color_default.BLACK)
  108189. );
  108190. this._outlineWidth = defaultValue_default(options.outlineWidth, 1);
  108191. this._showBackground = defaultValue_default(options.showBackground, false);
  108192. this._backgroundColor = Color_default.clone(
  108193. defaultValue_default(options.backgroundColor, defaultBackgroundColor)
  108194. );
  108195. this._backgroundPadding = Cartesian2_default.clone(
  108196. defaultValue_default(options.backgroundPadding, defaultBackgroundPadding)
  108197. );
  108198. this._style = defaultValue_default(options.style, LabelStyle_default.FILL);
  108199. this._verticalOrigin = defaultValue_default(
  108200. options.verticalOrigin,
  108201. VerticalOrigin_default.BASELINE
  108202. );
  108203. this._horizontalOrigin = defaultValue_default(
  108204. options.horizontalOrigin,
  108205. HorizontalOrigin_default.LEFT
  108206. );
  108207. this._pixelOffset = Cartesian2_default.clone(
  108208. defaultValue_default(options.pixelOffset, Cartesian2_default.ZERO)
  108209. );
  108210. this._eyeOffset = Cartesian3_default.clone(
  108211. defaultValue_default(options.eyeOffset, Cartesian3_default.ZERO)
  108212. );
  108213. this._position = Cartesian3_default.clone(
  108214. defaultValue_default(options.position, Cartesian3_default.ZERO)
  108215. );
  108216. this._scale = defaultValue_default(options.scale, 1);
  108217. this._id = options.id;
  108218. this._translucencyByDistance = translucencyByDistance;
  108219. this._pixelOffsetScaleByDistance = pixelOffsetScaleByDistance;
  108220. this._scaleByDistance = scaleByDistance;
  108221. this._heightReference = defaultValue_default(
  108222. options.heightReference,
  108223. HeightReference_default.NONE
  108224. );
  108225. this._distanceDisplayCondition = distanceDisplayCondition;
  108226. this._disableDepthTestDistance = options.disableDepthTestDistance;
  108227. this._labelCollection = labelCollection;
  108228. this._glyphs = [];
  108229. this._backgroundBillboard = void 0;
  108230. this._batchIndex = void 0;
  108231. this._rebindAllGlyphs = true;
  108232. this._repositionAllGlyphs = true;
  108233. this._actualClampedPosition = void 0;
  108234. this._removeCallbackFunc = void 0;
  108235. this._mode = void 0;
  108236. this._clusterShow = true;
  108237. this.text = defaultValue_default(options.text, "");
  108238. this._relativeSize = 1;
  108239. parseFont(this);
  108240. this._updateClamping();
  108241. }
  108242. Object.defineProperties(Label.prototype, {
  108243. show: {
  108244. get: function() {
  108245. return this._show;
  108246. },
  108247. set: function(value) {
  108248. if (!defined_default(value)) {
  108249. throw new DeveloperError_default("value is required.");
  108250. }
  108251. if (this._show !== value) {
  108252. this._show = value;
  108253. const glyphs = this._glyphs;
  108254. for (let i2 = 0, len = glyphs.length; i2 < len; i2++) {
  108255. const billboard = glyphs[i2].billboard;
  108256. if (defined_default(billboard)) {
  108257. billboard.show = value;
  108258. }
  108259. }
  108260. const backgroundBillboard = this._backgroundBillboard;
  108261. if (defined_default(backgroundBillboard)) {
  108262. backgroundBillboard.show = value;
  108263. }
  108264. }
  108265. }
  108266. },
  108267. position: {
  108268. get: function() {
  108269. return this._position;
  108270. },
  108271. set: function(value) {
  108272. if (!defined_default(value)) {
  108273. throw new DeveloperError_default("value is required.");
  108274. }
  108275. const position = this._position;
  108276. if (!Cartesian3_default.equals(position, value)) {
  108277. Cartesian3_default.clone(value, position);
  108278. const glyphs = this._glyphs;
  108279. for (let i2 = 0, len = glyphs.length; i2 < len; i2++) {
  108280. const billboard = glyphs[i2].billboard;
  108281. if (defined_default(billboard)) {
  108282. billboard.position = value;
  108283. }
  108284. }
  108285. const backgroundBillboard = this._backgroundBillboard;
  108286. if (defined_default(backgroundBillboard)) {
  108287. backgroundBillboard.position = value;
  108288. }
  108289. this._updateClamping();
  108290. }
  108291. }
  108292. },
  108293. heightReference: {
  108294. get: function() {
  108295. return this._heightReference;
  108296. },
  108297. set: function(value) {
  108298. if (!defined_default(value)) {
  108299. throw new DeveloperError_default("value is required.");
  108300. }
  108301. if (value !== this._heightReference) {
  108302. this._heightReference = value;
  108303. const glyphs = this._glyphs;
  108304. for (let i2 = 0, len = glyphs.length; i2 < len; i2++) {
  108305. const billboard = glyphs[i2].billboard;
  108306. if (defined_default(billboard)) {
  108307. billboard.heightReference = value;
  108308. }
  108309. }
  108310. const backgroundBillboard = this._backgroundBillboard;
  108311. if (defined_default(backgroundBillboard)) {
  108312. backgroundBillboard.heightReference = value;
  108313. }
  108314. repositionAllGlyphs(this);
  108315. this._updateClamping();
  108316. }
  108317. }
  108318. },
  108319. text: {
  108320. get: function() {
  108321. return this._text;
  108322. },
  108323. set: function(value) {
  108324. if (!defined_default(value)) {
  108325. throw new DeveloperError_default("value is required.");
  108326. }
  108327. if (this._text !== value) {
  108328. this._text = value;
  108329. const renderedValue = value.replace(/\u00ad/g, "");
  108330. this._renderedText = Label.enableRightToLeftDetection ? reverseRtl(renderedValue) : renderedValue;
  108331. rebindAllGlyphs(this);
  108332. }
  108333. }
  108334. },
  108335. font: {
  108336. get: function() {
  108337. return this._font;
  108338. },
  108339. set: function(value) {
  108340. if (!defined_default(value)) {
  108341. throw new DeveloperError_default("value is required.");
  108342. }
  108343. if (this._font !== value) {
  108344. this._font = value;
  108345. rebindAllGlyphs(this);
  108346. parseFont(this);
  108347. }
  108348. }
  108349. },
  108350. fillColor: {
  108351. get: function() {
  108352. return this._fillColor;
  108353. },
  108354. set: function(value) {
  108355. if (!defined_default(value)) {
  108356. throw new DeveloperError_default("value is required.");
  108357. }
  108358. const fillColor = this._fillColor;
  108359. if (!Color_default.equals(fillColor, value)) {
  108360. Color_default.clone(value, fillColor);
  108361. rebindAllGlyphs(this);
  108362. }
  108363. }
  108364. },
  108365. outlineColor: {
  108366. get: function() {
  108367. return this._outlineColor;
  108368. },
  108369. set: function(value) {
  108370. if (!defined_default(value)) {
  108371. throw new DeveloperError_default("value is required.");
  108372. }
  108373. const outlineColor = this._outlineColor;
  108374. if (!Color_default.equals(outlineColor, value)) {
  108375. Color_default.clone(value, outlineColor);
  108376. rebindAllGlyphs(this);
  108377. }
  108378. }
  108379. },
  108380. outlineWidth: {
  108381. get: function() {
  108382. return this._outlineWidth;
  108383. },
  108384. set: function(value) {
  108385. if (!defined_default(value)) {
  108386. throw new DeveloperError_default("value is required.");
  108387. }
  108388. if (this._outlineWidth !== value) {
  108389. this._outlineWidth = value;
  108390. rebindAllGlyphs(this);
  108391. }
  108392. }
  108393. },
  108394. showBackground: {
  108395. get: function() {
  108396. return this._showBackground;
  108397. },
  108398. set: function(value) {
  108399. if (!defined_default(value)) {
  108400. throw new DeveloperError_default("value is required.");
  108401. }
  108402. if (this._showBackground !== value) {
  108403. this._showBackground = value;
  108404. rebindAllGlyphs(this);
  108405. }
  108406. }
  108407. },
  108408. backgroundColor: {
  108409. get: function() {
  108410. return this._backgroundColor;
  108411. },
  108412. set: function(value) {
  108413. if (!defined_default(value)) {
  108414. throw new DeveloperError_default("value is required.");
  108415. }
  108416. const backgroundColor = this._backgroundColor;
  108417. if (!Color_default.equals(backgroundColor, value)) {
  108418. Color_default.clone(value, backgroundColor);
  108419. const backgroundBillboard = this._backgroundBillboard;
  108420. if (defined_default(backgroundBillboard)) {
  108421. backgroundBillboard.color = backgroundColor;
  108422. }
  108423. }
  108424. }
  108425. },
  108426. backgroundPadding: {
  108427. get: function() {
  108428. return this._backgroundPadding;
  108429. },
  108430. set: function(value) {
  108431. if (!defined_default(value)) {
  108432. throw new DeveloperError_default("value is required.");
  108433. }
  108434. const backgroundPadding = this._backgroundPadding;
  108435. if (!Cartesian2_default.equals(backgroundPadding, value)) {
  108436. Cartesian2_default.clone(value, backgroundPadding);
  108437. repositionAllGlyphs(this);
  108438. }
  108439. }
  108440. },
  108441. style: {
  108442. get: function() {
  108443. return this._style;
  108444. },
  108445. set: function(value) {
  108446. if (!defined_default(value)) {
  108447. throw new DeveloperError_default("value is required.");
  108448. }
  108449. if (this._style !== value) {
  108450. this._style = value;
  108451. rebindAllGlyphs(this);
  108452. }
  108453. }
  108454. },
  108455. pixelOffset: {
  108456. get: function() {
  108457. return this._pixelOffset;
  108458. },
  108459. set: function(value) {
  108460. if (!defined_default(value)) {
  108461. throw new DeveloperError_default("value is required.");
  108462. }
  108463. const pixelOffset = this._pixelOffset;
  108464. if (!Cartesian2_default.equals(pixelOffset, value)) {
  108465. Cartesian2_default.clone(value, pixelOffset);
  108466. const glyphs = this._glyphs;
  108467. for (let i2 = 0, len = glyphs.length; i2 < len; i2++) {
  108468. const glyph = glyphs[i2];
  108469. if (defined_default(glyph.billboard)) {
  108470. glyph.billboard.pixelOffset = value;
  108471. }
  108472. }
  108473. const backgroundBillboard = this._backgroundBillboard;
  108474. if (defined_default(backgroundBillboard)) {
  108475. backgroundBillboard.pixelOffset = value;
  108476. }
  108477. }
  108478. }
  108479. },
  108480. translucencyByDistance: {
  108481. get: function() {
  108482. return this._translucencyByDistance;
  108483. },
  108484. set: function(value) {
  108485. if (defined_default(value) && value.far <= value.near) {
  108486. throw new DeveloperError_default(
  108487. "far distance must be greater than near distance."
  108488. );
  108489. }
  108490. const translucencyByDistance = this._translucencyByDistance;
  108491. if (!NearFarScalar_default.equals(translucencyByDistance, value)) {
  108492. this._translucencyByDistance = NearFarScalar_default.clone(
  108493. value,
  108494. translucencyByDistance
  108495. );
  108496. const glyphs = this._glyphs;
  108497. for (let i2 = 0, len = glyphs.length; i2 < len; i2++) {
  108498. const glyph = glyphs[i2];
  108499. if (defined_default(glyph.billboard)) {
  108500. glyph.billboard.translucencyByDistance = value;
  108501. }
  108502. }
  108503. const backgroundBillboard = this._backgroundBillboard;
  108504. if (defined_default(backgroundBillboard)) {
  108505. backgroundBillboard.translucencyByDistance = value;
  108506. }
  108507. }
  108508. }
  108509. },
  108510. pixelOffsetScaleByDistance: {
  108511. get: function() {
  108512. return this._pixelOffsetScaleByDistance;
  108513. },
  108514. set: function(value) {
  108515. if (defined_default(value) && value.far <= value.near) {
  108516. throw new DeveloperError_default(
  108517. "far distance must be greater than near distance."
  108518. );
  108519. }
  108520. const pixelOffsetScaleByDistance = this._pixelOffsetScaleByDistance;
  108521. if (!NearFarScalar_default.equals(pixelOffsetScaleByDistance, value)) {
  108522. this._pixelOffsetScaleByDistance = NearFarScalar_default.clone(
  108523. value,
  108524. pixelOffsetScaleByDistance
  108525. );
  108526. const glyphs = this._glyphs;
  108527. for (let i2 = 0, len = glyphs.length; i2 < len; i2++) {
  108528. const glyph = glyphs[i2];
  108529. if (defined_default(glyph.billboard)) {
  108530. glyph.billboard.pixelOffsetScaleByDistance = value;
  108531. }
  108532. }
  108533. const backgroundBillboard = this._backgroundBillboard;
  108534. if (defined_default(backgroundBillboard)) {
  108535. backgroundBillboard.pixelOffsetScaleByDistance = value;
  108536. }
  108537. }
  108538. }
  108539. },
  108540. scaleByDistance: {
  108541. get: function() {
  108542. return this._scaleByDistance;
  108543. },
  108544. set: function(value) {
  108545. if (defined_default(value) && value.far <= value.near) {
  108546. throw new DeveloperError_default(
  108547. "far distance must be greater than near distance."
  108548. );
  108549. }
  108550. const scaleByDistance = this._scaleByDistance;
  108551. if (!NearFarScalar_default.equals(scaleByDistance, value)) {
  108552. this._scaleByDistance = NearFarScalar_default.clone(value, scaleByDistance);
  108553. const glyphs = this._glyphs;
  108554. for (let i2 = 0, len = glyphs.length; i2 < len; i2++) {
  108555. const glyph = glyphs[i2];
  108556. if (defined_default(glyph.billboard)) {
  108557. glyph.billboard.scaleByDistance = value;
  108558. }
  108559. }
  108560. const backgroundBillboard = this._backgroundBillboard;
  108561. if (defined_default(backgroundBillboard)) {
  108562. backgroundBillboard.scaleByDistance = value;
  108563. }
  108564. }
  108565. }
  108566. },
  108567. eyeOffset: {
  108568. get: function() {
  108569. return this._eyeOffset;
  108570. },
  108571. set: function(value) {
  108572. if (!defined_default(value)) {
  108573. throw new DeveloperError_default("value is required.");
  108574. }
  108575. const eyeOffset = this._eyeOffset;
  108576. if (!Cartesian3_default.equals(eyeOffset, value)) {
  108577. Cartesian3_default.clone(value, eyeOffset);
  108578. const glyphs = this._glyphs;
  108579. for (let i2 = 0, len = glyphs.length; i2 < len; i2++) {
  108580. const glyph = glyphs[i2];
  108581. if (defined_default(glyph.billboard)) {
  108582. glyph.billboard.eyeOffset = value;
  108583. }
  108584. }
  108585. const backgroundBillboard = this._backgroundBillboard;
  108586. if (defined_default(backgroundBillboard)) {
  108587. backgroundBillboard.eyeOffset = value;
  108588. }
  108589. }
  108590. }
  108591. },
  108592. horizontalOrigin: {
  108593. get: function() {
  108594. return this._horizontalOrigin;
  108595. },
  108596. set: function(value) {
  108597. if (!defined_default(value)) {
  108598. throw new DeveloperError_default("value is required.");
  108599. }
  108600. if (this._horizontalOrigin !== value) {
  108601. this._horizontalOrigin = value;
  108602. repositionAllGlyphs(this);
  108603. }
  108604. }
  108605. },
  108606. verticalOrigin: {
  108607. get: function() {
  108608. return this._verticalOrigin;
  108609. },
  108610. set: function(value) {
  108611. if (!defined_default(value)) {
  108612. throw new DeveloperError_default("value is required.");
  108613. }
  108614. if (this._verticalOrigin !== value) {
  108615. this._verticalOrigin = value;
  108616. const glyphs = this._glyphs;
  108617. for (let i2 = 0, len = glyphs.length; i2 < len; i2++) {
  108618. const glyph = glyphs[i2];
  108619. if (defined_default(glyph.billboard)) {
  108620. glyph.billboard.verticalOrigin = value;
  108621. }
  108622. }
  108623. const backgroundBillboard = this._backgroundBillboard;
  108624. if (defined_default(backgroundBillboard)) {
  108625. backgroundBillboard.verticalOrigin = value;
  108626. }
  108627. repositionAllGlyphs(this);
  108628. }
  108629. }
  108630. },
  108631. scale: {
  108632. get: function() {
  108633. return this._scale;
  108634. },
  108635. set: function(value) {
  108636. if (!defined_default(value)) {
  108637. throw new DeveloperError_default("value is required.");
  108638. }
  108639. if (this._scale !== value) {
  108640. this._scale = value;
  108641. const glyphs = this._glyphs;
  108642. for (let i2 = 0, len = glyphs.length; i2 < len; i2++) {
  108643. const glyph = glyphs[i2];
  108644. if (defined_default(glyph.billboard)) {
  108645. glyph.billboard.scale = value * this._relativeSize;
  108646. }
  108647. }
  108648. const backgroundBillboard = this._backgroundBillboard;
  108649. if (defined_default(backgroundBillboard)) {
  108650. backgroundBillboard.scale = value * this._relativeSize;
  108651. }
  108652. repositionAllGlyphs(this);
  108653. }
  108654. }
  108655. },
  108656. totalScale: {
  108657. get: function() {
  108658. return this._scale * this._relativeSize;
  108659. }
  108660. },
  108661. distanceDisplayCondition: {
  108662. get: function() {
  108663. return this._distanceDisplayCondition;
  108664. },
  108665. set: function(value) {
  108666. if (defined_default(value) && value.far <= value.near) {
  108667. throw new DeveloperError_default("far must be greater than near");
  108668. }
  108669. if (!DistanceDisplayCondition_default.equals(value, this._distanceDisplayCondition)) {
  108670. this._distanceDisplayCondition = DistanceDisplayCondition_default.clone(
  108671. value,
  108672. this._distanceDisplayCondition
  108673. );
  108674. const glyphs = this._glyphs;
  108675. for (let i2 = 0, len = glyphs.length; i2 < len; i2++) {
  108676. const glyph = glyphs[i2];
  108677. if (defined_default(glyph.billboard)) {
  108678. glyph.billboard.distanceDisplayCondition = value;
  108679. }
  108680. }
  108681. const backgroundBillboard = this._backgroundBillboard;
  108682. if (defined_default(backgroundBillboard)) {
  108683. backgroundBillboard.distanceDisplayCondition = value;
  108684. }
  108685. }
  108686. }
  108687. },
  108688. disableDepthTestDistance: {
  108689. get: function() {
  108690. return this._disableDepthTestDistance;
  108691. },
  108692. set: function(value) {
  108693. if (this._disableDepthTestDistance !== value) {
  108694. if (defined_default(value) && value < 0) {
  108695. throw new DeveloperError_default(
  108696. "disableDepthTestDistance must be greater than 0.0."
  108697. );
  108698. }
  108699. this._disableDepthTestDistance = value;
  108700. const glyphs = this._glyphs;
  108701. for (let i2 = 0, len = glyphs.length; i2 < len; i2++) {
  108702. const glyph = glyphs[i2];
  108703. if (defined_default(glyph.billboard)) {
  108704. glyph.billboard.disableDepthTestDistance = value;
  108705. }
  108706. }
  108707. const backgroundBillboard = this._backgroundBillboard;
  108708. if (defined_default(backgroundBillboard)) {
  108709. backgroundBillboard.disableDepthTestDistance = value;
  108710. }
  108711. }
  108712. }
  108713. },
  108714. id: {
  108715. get: function() {
  108716. return this._id;
  108717. },
  108718. set: function(value) {
  108719. if (this._id !== value) {
  108720. this._id = value;
  108721. const glyphs = this._glyphs;
  108722. for (let i2 = 0, len = glyphs.length; i2 < len; i2++) {
  108723. const glyph = glyphs[i2];
  108724. if (defined_default(glyph.billboard)) {
  108725. glyph.billboard.id = value;
  108726. }
  108727. }
  108728. const backgroundBillboard = this._backgroundBillboard;
  108729. if (defined_default(backgroundBillboard)) {
  108730. backgroundBillboard.id = value;
  108731. }
  108732. }
  108733. }
  108734. },
  108735. pickId: {
  108736. get: function() {
  108737. if (this._glyphs.length === 0 || !defined_default(this._glyphs[0].billboard)) {
  108738. return void 0;
  108739. }
  108740. return this._glyphs[0].billboard.pickId;
  108741. }
  108742. },
  108743. _clampedPosition: {
  108744. get: function() {
  108745. return this._actualClampedPosition;
  108746. },
  108747. set: function(value) {
  108748. this._actualClampedPosition = Cartesian3_default.clone(
  108749. value,
  108750. this._actualClampedPosition
  108751. );
  108752. const glyphs = this._glyphs;
  108753. for (let i2 = 0, len = glyphs.length; i2 < len; i2++) {
  108754. const glyph = glyphs[i2];
  108755. if (defined_default(glyph.billboard)) {
  108756. glyph.billboard._clampedPosition = value;
  108757. }
  108758. }
  108759. const backgroundBillboard = this._backgroundBillboard;
  108760. if (defined_default(backgroundBillboard)) {
  108761. backgroundBillboard._clampedPosition = value;
  108762. }
  108763. }
  108764. },
  108765. clusterShow: {
  108766. get: function() {
  108767. return this._clusterShow;
  108768. },
  108769. set: function(value) {
  108770. if (this._clusterShow !== value) {
  108771. this._clusterShow = value;
  108772. const glyphs = this._glyphs;
  108773. for (let i2 = 0, len = glyphs.length; i2 < len; i2++) {
  108774. const glyph = glyphs[i2];
  108775. if (defined_default(glyph.billboard)) {
  108776. glyph.billboard.clusterShow = value;
  108777. }
  108778. }
  108779. const backgroundBillboard = this._backgroundBillboard;
  108780. if (defined_default(backgroundBillboard)) {
  108781. backgroundBillboard.clusterShow = value;
  108782. }
  108783. }
  108784. }
  108785. }
  108786. });
  108787. Label.prototype._updateClamping = function() {
  108788. Billboard_default._updateClamping(this._labelCollection, this);
  108789. };
  108790. Label.prototype.computeScreenSpacePosition = function(scene, result) {
  108791. if (!defined_default(scene)) {
  108792. throw new DeveloperError_default("scene is required.");
  108793. }
  108794. if (!defined_default(result)) {
  108795. result = new Cartesian2_default();
  108796. }
  108797. const labelCollection = this._labelCollection;
  108798. const modelMatrix = labelCollection.modelMatrix;
  108799. const actualPosition = defined_default(this._actualClampedPosition) ? this._actualClampedPosition : this._position;
  108800. const windowCoordinates = Billboard_default._computeScreenSpacePosition(
  108801. modelMatrix,
  108802. actualPosition,
  108803. this._eyeOffset,
  108804. this._pixelOffset,
  108805. scene,
  108806. result
  108807. );
  108808. return windowCoordinates;
  108809. };
  108810. Label.getScreenSpaceBoundingBox = function(label, screenSpacePosition, result) {
  108811. let x = 0;
  108812. let y = 0;
  108813. let width = 0;
  108814. let height = 0;
  108815. const scale = label.totalScale;
  108816. const backgroundBillboard = label._backgroundBillboard;
  108817. if (defined_default(backgroundBillboard)) {
  108818. x = screenSpacePosition.x + backgroundBillboard._translate.x;
  108819. y = screenSpacePosition.y - backgroundBillboard._translate.y;
  108820. width = backgroundBillboard.width * scale;
  108821. height = backgroundBillboard.height * scale;
  108822. if (label.verticalOrigin === VerticalOrigin_default.BOTTOM || label.verticalOrigin === VerticalOrigin_default.BASELINE) {
  108823. y -= height;
  108824. } else if (label.verticalOrigin === VerticalOrigin_default.CENTER) {
  108825. y -= height * 0.5;
  108826. }
  108827. } else {
  108828. x = Number.POSITIVE_INFINITY;
  108829. y = Number.POSITIVE_INFINITY;
  108830. let maxX = 0;
  108831. let maxY = 0;
  108832. const glyphs = label._glyphs;
  108833. const length3 = glyphs.length;
  108834. for (let i2 = 0; i2 < length3; ++i2) {
  108835. const glyph = glyphs[i2];
  108836. const billboard = glyph.billboard;
  108837. if (!defined_default(billboard)) {
  108838. continue;
  108839. }
  108840. const glyphX = screenSpacePosition.x + billboard._translate.x;
  108841. let glyphY = screenSpacePosition.y - billboard._translate.y;
  108842. const glyphWidth = glyph.dimensions.width * scale;
  108843. const glyphHeight = glyph.dimensions.height * scale;
  108844. if (label.verticalOrigin === VerticalOrigin_default.BOTTOM || label.verticalOrigin === VerticalOrigin_default.BASELINE) {
  108845. glyphY -= glyphHeight;
  108846. } else if (label.verticalOrigin === VerticalOrigin_default.CENTER) {
  108847. glyphY -= glyphHeight * 0.5;
  108848. }
  108849. if (label._verticalOrigin === VerticalOrigin_default.TOP) {
  108850. glyphY += SDFSettings_default.PADDING * scale;
  108851. } else if (label._verticalOrigin === VerticalOrigin_default.BOTTOM || label._verticalOrigin === VerticalOrigin_default.BASELINE) {
  108852. glyphY -= SDFSettings_default.PADDING * scale;
  108853. }
  108854. x = Math.min(x, glyphX);
  108855. y = Math.min(y, glyphY);
  108856. maxX = Math.max(maxX, glyphX + glyphWidth);
  108857. maxY = Math.max(maxY, glyphY + glyphHeight);
  108858. }
  108859. width = maxX - x;
  108860. height = maxY - y;
  108861. }
  108862. if (!defined_default(result)) {
  108863. result = new BoundingRectangle_default();
  108864. }
  108865. result.x = x;
  108866. result.y = y;
  108867. result.width = width;
  108868. result.height = height;
  108869. return result;
  108870. };
  108871. Label.prototype.equals = function(other) {
  108872. return this === other || defined_default(other) && this._show === other._show && this._scale === other._scale && this._outlineWidth === other._outlineWidth && this._showBackground === other._showBackground && this._style === other._style && this._verticalOrigin === other._verticalOrigin && this._horizontalOrigin === other._horizontalOrigin && this._heightReference === other._heightReference && this._renderedText === other._renderedText && this._font === other._font && Cartesian3_default.equals(this._position, other._position) && Color_default.equals(this._fillColor, other._fillColor) && Color_default.equals(this._outlineColor, other._outlineColor) && Color_default.equals(this._backgroundColor, other._backgroundColor) && Cartesian2_default.equals(this._backgroundPadding, other._backgroundPadding) && Cartesian2_default.equals(this._pixelOffset, other._pixelOffset) && Cartesian3_default.equals(this._eyeOffset, other._eyeOffset) && NearFarScalar_default.equals(
  108873. this._translucencyByDistance,
  108874. other._translucencyByDistance
  108875. ) && NearFarScalar_default.equals(
  108876. this._pixelOffsetScaleByDistance,
  108877. other._pixelOffsetScaleByDistance
  108878. ) && NearFarScalar_default.equals(this._scaleByDistance, other._scaleByDistance) && DistanceDisplayCondition_default.equals(
  108879. this._distanceDisplayCondition,
  108880. other._distanceDisplayCondition
  108881. ) && this._disableDepthTestDistance === other._disableDepthTestDistance && this._id === other._id;
  108882. };
  108883. Label.prototype.isDestroyed = function() {
  108884. return false;
  108885. };
  108886. Label.enableRightToLeftDetection = false;
  108887. function convertTextToTypes(text2, rtlChars2) {
  108888. const ltrChars = /[a-zA-Z0-9]/;
  108889. const bracketsChars = /[()[\]{}<>]/;
  108890. const parsedText = [];
  108891. let word = "";
  108892. let lastType = textTypes.LTR;
  108893. let currentType = "";
  108894. const textLength = text2.length;
  108895. for (let textIndex = 0; textIndex < textLength; ++textIndex) {
  108896. const character = text2.charAt(textIndex);
  108897. if (rtlChars2.test(character)) {
  108898. currentType = textTypes.RTL;
  108899. } else if (ltrChars.test(character)) {
  108900. currentType = textTypes.LTR;
  108901. } else if (bracketsChars.test(character)) {
  108902. currentType = textTypes.BRACKETS;
  108903. } else {
  108904. currentType = textTypes.WEAK;
  108905. }
  108906. if (textIndex === 0) {
  108907. lastType = currentType;
  108908. }
  108909. if (lastType === currentType && currentType !== textTypes.BRACKETS) {
  108910. word += character;
  108911. } else {
  108912. if (word !== "") {
  108913. parsedText.push({ Type: lastType, Word: word });
  108914. }
  108915. lastType = currentType;
  108916. word = character;
  108917. }
  108918. }
  108919. parsedText.push({ Type: currentType, Word: word });
  108920. return parsedText;
  108921. }
  108922. function reverseWord(word) {
  108923. return word.split("").reverse().join("");
  108924. }
  108925. function spliceWord(result, pointer, word) {
  108926. return result.slice(0, pointer) + word + result.slice(pointer);
  108927. }
  108928. function reverseBrackets(bracket) {
  108929. switch (bracket) {
  108930. case "(":
  108931. return ")";
  108932. case ")":
  108933. return "(";
  108934. case "[":
  108935. return "]";
  108936. case "]":
  108937. return "[";
  108938. case "{":
  108939. return "}";
  108940. case "}":
  108941. return "{";
  108942. case "<":
  108943. return ">";
  108944. case ">":
  108945. return "<";
  108946. }
  108947. }
  108948. var hebrew = "\u05D0-\u05EA";
  108949. var arabic = "\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF";
  108950. var rtlChars = new RegExp(`[${hebrew}${arabic}]`);
  108951. function reverseRtl(value) {
  108952. const texts = value.split("\n");
  108953. let result = "";
  108954. for (let i2 = 0; i2 < texts.length; i2++) {
  108955. const text2 = texts[i2];
  108956. const rtlDir = rtlChars.test(text2.charAt(0));
  108957. const parsedText = convertTextToTypes(text2, rtlChars);
  108958. let splicePointer = 0;
  108959. let line = "";
  108960. for (let wordIndex = 0; wordIndex < parsedText.length; ++wordIndex) {
  108961. const subText = parsedText[wordIndex];
  108962. const reverse2 = subText.Type === textTypes.BRACKETS ? reverseBrackets(subText.Word) : reverseWord(subText.Word);
  108963. if (rtlDir) {
  108964. if (subText.Type === textTypes.RTL) {
  108965. line = reverse2 + line;
  108966. splicePointer = 0;
  108967. } else if (subText.Type === textTypes.LTR) {
  108968. line = spliceWord(line, splicePointer, subText.Word);
  108969. splicePointer += subText.Word.length;
  108970. } else if (subText.Type === textTypes.WEAK || subText.Type === textTypes.BRACKETS) {
  108971. if (subText.Type === textTypes.WEAK && parsedText[wordIndex - 1].Type === textTypes.BRACKETS) {
  108972. line = reverse2 + line;
  108973. } else if (parsedText[wordIndex - 1].Type === textTypes.RTL) {
  108974. line = reverse2 + line;
  108975. splicePointer = 0;
  108976. } else if (parsedText.length > wordIndex + 1) {
  108977. if (parsedText[wordIndex + 1].Type === textTypes.RTL) {
  108978. line = reverse2 + line;
  108979. splicePointer = 0;
  108980. } else {
  108981. line = spliceWord(line, splicePointer, subText.Word);
  108982. splicePointer += subText.Word.length;
  108983. }
  108984. } else {
  108985. line = spliceWord(line, 0, reverse2);
  108986. }
  108987. }
  108988. } else if (subText.Type === textTypes.RTL) {
  108989. line = spliceWord(line, splicePointer, reverse2);
  108990. } else if (subText.Type === textTypes.LTR) {
  108991. line += subText.Word;
  108992. splicePointer = line.length;
  108993. } else if (subText.Type === textTypes.WEAK || subText.Type === textTypes.BRACKETS) {
  108994. if (wordIndex > 0) {
  108995. if (parsedText[wordIndex - 1].Type === textTypes.RTL) {
  108996. if (parsedText.length > wordIndex + 1) {
  108997. if (parsedText[wordIndex + 1].Type === textTypes.RTL) {
  108998. line = spliceWord(line, splicePointer, reverse2);
  108999. } else {
  109000. line += subText.Word;
  109001. splicePointer = line.length;
  109002. }
  109003. } else {
  109004. line += subText.Word;
  109005. }
  109006. } else {
  109007. line += subText.Word;
  109008. splicePointer = line.length;
  109009. }
  109010. } else {
  109011. line += subText.Word;
  109012. splicePointer = line.length;
  109013. }
  109014. }
  109015. }
  109016. result += line;
  109017. if (i2 < texts.length - 1) {
  109018. result += "\n";
  109019. }
  109020. }
  109021. return result;
  109022. }
  109023. var Label_default = Label;
  109024. // node_modules/cesium/Source/ThirdParty/grapheme-splitter.js
  109025. var graphemeSplitter = createCommonjsModule(function(module2) {
  109026. function GraphemeSplitter() {
  109027. var CR = 0, LF = 1, Control = 2, Extend = 3, Regional_Indicator = 4, SpacingMark = 5, L = 6, V = 7, T = 8, LV = 9, LVT = 10, Other = 11, Prepend = 12, E_Base = 13, E_Modifier = 14, ZWJ = 15, Glue_After_Zwj = 16, E_Base_GAZ = 17;
  109028. var NotBreak = 0, BreakStart = 1, Break = 2, BreakLastRegional = 3, BreakPenultimateRegional = 4;
  109029. function isSurrogate(str, pos) {
  109030. return 55296 <= str.charCodeAt(pos) && str.charCodeAt(pos) <= 56319 && 56320 <= str.charCodeAt(pos + 1) && str.charCodeAt(pos + 1) <= 57343;
  109031. }
  109032. function codePointAt(str, idx) {
  109033. if (idx === void 0) {
  109034. idx = 0;
  109035. }
  109036. var code = str.charCodeAt(idx);
  109037. if (55296 <= code && code <= 56319 && idx < str.length - 1) {
  109038. var hi = code;
  109039. var low = str.charCodeAt(idx + 1);
  109040. if (56320 <= low && low <= 57343) {
  109041. return (hi - 55296) * 1024 + (low - 56320) + 65536;
  109042. }
  109043. return hi;
  109044. }
  109045. if (56320 <= code && code <= 57343 && idx >= 1) {
  109046. var hi = str.charCodeAt(idx - 1);
  109047. var low = code;
  109048. if (55296 <= hi && hi <= 56319) {
  109049. return (hi - 55296) * 1024 + (low - 56320) + 65536;
  109050. }
  109051. return low;
  109052. }
  109053. return code;
  109054. }
  109055. function shouldBreak(start, mid, end) {
  109056. var all = [start].concat(mid).concat([end]);
  109057. var previous = all[all.length - 2];
  109058. var next = end;
  109059. var eModifierIndex = all.lastIndexOf(E_Modifier);
  109060. if (eModifierIndex > 1 && all.slice(1, eModifierIndex).every(function(c14) {
  109061. return c14 == Extend;
  109062. }) && [Extend, E_Base, E_Base_GAZ].indexOf(start) == -1) {
  109063. return Break;
  109064. }
  109065. var rIIndex = all.lastIndexOf(Regional_Indicator);
  109066. if (rIIndex > 0 && all.slice(1, rIIndex).every(function(c14) {
  109067. return c14 == Regional_Indicator;
  109068. }) && [Prepend, Regional_Indicator].indexOf(previous) == -1) {
  109069. if (all.filter(function(c14) {
  109070. return c14 == Regional_Indicator;
  109071. }).length % 2 == 1) {
  109072. return BreakLastRegional;
  109073. } else {
  109074. return BreakPenultimateRegional;
  109075. }
  109076. }
  109077. if (previous == CR && next == LF) {
  109078. return NotBreak;
  109079. } else if (previous == Control || previous == CR || previous == LF) {
  109080. if (next == E_Modifier && mid.every(function(c14) {
  109081. return c14 == Extend;
  109082. })) {
  109083. return Break;
  109084. } else {
  109085. return BreakStart;
  109086. }
  109087. } else if (next == Control || next == CR || next == LF) {
  109088. return BreakStart;
  109089. } else if (previous == L && (next == L || next == V || next == LV || next == LVT)) {
  109090. return NotBreak;
  109091. } else if ((previous == LV || previous == V) && (next == V || next == T)) {
  109092. return NotBreak;
  109093. } else if ((previous == LVT || previous == T) && next == T) {
  109094. return NotBreak;
  109095. } else if (next == Extend || next == ZWJ) {
  109096. return NotBreak;
  109097. } else if (next == SpacingMark) {
  109098. return NotBreak;
  109099. } else if (previous == Prepend) {
  109100. return NotBreak;
  109101. }
  109102. var previousNonExtendIndex = all.indexOf(Extend) != -1 ? all.lastIndexOf(Extend) - 1 : all.length - 2;
  109103. if ([E_Base, E_Base_GAZ].indexOf(all[previousNonExtendIndex]) != -1 && all.slice(previousNonExtendIndex + 1, -1).every(function(c14) {
  109104. return c14 == Extend;
  109105. }) && next == E_Modifier) {
  109106. return NotBreak;
  109107. }
  109108. if (previous == ZWJ && [Glue_After_Zwj, E_Base_GAZ].indexOf(next) != -1) {
  109109. return NotBreak;
  109110. }
  109111. if (mid.indexOf(Regional_Indicator) != -1) {
  109112. return Break;
  109113. }
  109114. if (previous == Regional_Indicator && next == Regional_Indicator) {
  109115. return NotBreak;
  109116. }
  109117. return BreakStart;
  109118. }
  109119. this.nextBreak = function(string, index2) {
  109120. if (index2 === void 0) {
  109121. index2 = 0;
  109122. }
  109123. if (index2 < 0) {
  109124. return 0;
  109125. }
  109126. if (index2 >= string.length - 1) {
  109127. return string.length;
  109128. }
  109129. var prev = getGraphemeBreakProperty(codePointAt(string, index2));
  109130. var mid = [];
  109131. for (var i2 = index2 + 1; i2 < string.length; i2++) {
  109132. if (isSurrogate(string, i2 - 1)) {
  109133. continue;
  109134. }
  109135. var next = getGraphemeBreakProperty(codePointAt(string, i2));
  109136. if (shouldBreak(prev, mid, next)) {
  109137. return i2;
  109138. }
  109139. mid.push(next);
  109140. }
  109141. return string.length;
  109142. };
  109143. this.splitGraphemes = function(str) {
  109144. var res = [];
  109145. var index2 = 0;
  109146. var brk;
  109147. while ((brk = this.nextBreak(str, index2)) < str.length) {
  109148. res.push(str.slice(index2, brk));
  109149. index2 = brk;
  109150. }
  109151. if (index2 < str.length) {
  109152. res.push(str.slice(index2));
  109153. }
  109154. return res;
  109155. };
  109156. this.iterateGraphemes = function(str) {
  109157. var index2 = 0;
  109158. var res = {
  109159. next: function() {
  109160. var value;
  109161. var brk;
  109162. if ((brk = this.nextBreak(str, index2)) < str.length) {
  109163. value = str.slice(index2, brk);
  109164. index2 = brk;
  109165. return { value, done: false };
  109166. }
  109167. if (index2 < str.length) {
  109168. value = str.slice(index2);
  109169. index2 = str.length;
  109170. return { value, done: false };
  109171. }
  109172. return { value: void 0, done: true };
  109173. }.bind(this)
  109174. };
  109175. if (typeof Symbol !== "undefined" && Symbol.iterator) {
  109176. res[Symbol.iterator] = function() {
  109177. return res;
  109178. };
  109179. }
  109180. return res;
  109181. };
  109182. this.countGraphemes = function(str) {
  109183. var count = 0;
  109184. var index2 = 0;
  109185. var brk;
  109186. while ((brk = this.nextBreak(str, index2)) < str.length) {
  109187. index2 = brk;
  109188. count++;
  109189. }
  109190. if (index2 < str.length) {
  109191. count++;
  109192. }
  109193. return count;
  109194. };
  109195. function getGraphemeBreakProperty(code) {
  109196. if (1536 <= code && code <= 1541 || 1757 == code || 1807 == code || 2274 == code || 3406 == code || 69821 == code || 70082 <= code && code <= 70083 || 72250 == code || 72326 <= code && code <= 72329 || 73030 == code) {
  109197. return Prepend;
  109198. }
  109199. if (13 == code) {
  109200. return CR;
  109201. }
  109202. if (10 == code) {
  109203. return LF;
  109204. }
  109205. if (0 <= code && code <= 9 || 11 <= code && code <= 12 || 14 <= code && code <= 31 || 127 <= code && code <= 159 || 173 == code || 1564 == code || 6158 == code || 8203 == code || 8206 <= code && code <= 8207 || 8232 == code || 8233 == code || 8234 <= code && code <= 8238 || 8288 <= code && code <= 8292 || 8293 == code || 8294 <= code && code <= 8303 || 55296 <= code && code <= 57343 || 65279 == code || 65520 <= code && code <= 65528 || 65529 <= code && code <= 65531 || 113824 <= code && code <= 113827 || 119155 <= code && code <= 119162 || 917504 == code || 917505 == code || 917506 <= code && code <= 917535 || 917632 <= code && code <= 917759 || 918e3 <= code && code <= 921599) {
  109206. return Control;
  109207. }
  109208. if (768 <= code && code <= 879 || 1155 <= code && code <= 1159 || 1160 <= code && code <= 1161 || 1425 <= code && code <= 1469 || 1471 == code || 1473 <= code && code <= 1474 || 1476 <= code && code <= 1477 || 1479 == code || 1552 <= code && code <= 1562 || 1611 <= code && code <= 1631 || 1648 == code || 1750 <= code && code <= 1756 || 1759 <= code && code <= 1764 || 1767 <= code && code <= 1768 || 1770 <= code && code <= 1773 || 1809 == code || 1840 <= code && code <= 1866 || 1958 <= code && code <= 1968 || 2027 <= code && code <= 2035 || 2070 <= code && code <= 2073 || 2075 <= code && code <= 2083 || 2085 <= code && code <= 2087 || 2089 <= code && code <= 2093 || 2137 <= code && code <= 2139 || 2260 <= code && code <= 2273 || 2275 <= code && code <= 2306 || 2362 == code || 2364 == code || 2369 <= code && code <= 2376 || 2381 == code || 2385 <= code && code <= 2391 || 2402 <= code && code <= 2403 || 2433 == code || 2492 == code || 2494 == code || 2497 <= code && code <= 2500 || 2509 == code || 2519 == code || 2530 <= code && code <= 2531 || 2561 <= code && code <= 2562 || 2620 == code || 2625 <= code && code <= 2626 || 2631 <= code && code <= 2632 || 2635 <= code && code <= 2637 || 2641 == code || 2672 <= code && code <= 2673 || 2677 == code || 2689 <= code && code <= 2690 || 2748 == code || 2753 <= code && code <= 2757 || 2759 <= code && code <= 2760 || 2765 == code || 2786 <= code && code <= 2787 || 2810 <= code && code <= 2815 || 2817 == code || 2876 == code || 2878 == code || 2879 == code || 2881 <= code && code <= 2884 || 2893 == code || 2902 == code || 2903 == code || 2914 <= code && code <= 2915 || 2946 == code || 3006 == code || 3008 == code || 3021 == code || 3031 == code || 3072 == code || 3134 <= code && code <= 3136 || 3142 <= code && code <= 3144 || 3146 <= code && code <= 3149 || 3157 <= code && code <= 3158 || 3170 <= code && code <= 3171 || 3201 == code || 3260 == code || 3263 == code || 3266 == code || 3270 == code || 3276 <= code && code <= 3277 || 3285 <= code && code <= 3286 || 3298 <= code && code <= 3299 || 3328 <= code && code <= 3329 || 3387 <= code && code <= 3388 || 3390 == code || 3393 <= code && code <= 3396 || 3405 == code || 3415 == code || 3426 <= code && code <= 3427 || 3530 == code || 3535 == code || 3538 <= code && code <= 3540 || 3542 == code || 3551 == code || 3633 == code || 3636 <= code && code <= 3642 || 3655 <= code && code <= 3662 || 3761 == code || 3764 <= code && code <= 3769 || 3771 <= code && code <= 3772 || 3784 <= code && code <= 3789 || 3864 <= code && code <= 3865 || 3893 == code || 3895 == code || 3897 == code || 3953 <= code && code <= 3966 || 3968 <= code && code <= 3972 || 3974 <= code && code <= 3975 || 3981 <= code && code <= 3991 || 3993 <= code && code <= 4028 || 4038 == code || 4141 <= code && code <= 4144 || 4146 <= code && code <= 4151 || 4153 <= code && code <= 4154 || 4157 <= code && code <= 4158 || 4184 <= code && code <= 4185 || 4190 <= code && code <= 4192 || 4209 <= code && code <= 4212 || 4226 == code || 4229 <= code && code <= 4230 || 4237 == code || 4253 == code || 4957 <= code && code <= 4959 || 5906 <= code && code <= 5908 || 5938 <= code && code <= 5940 || 5970 <= code && code <= 5971 || 6002 <= code && code <= 6003 || 6068 <= code && code <= 6069 || 6071 <= code && code <= 6077 || 6086 == code || 6089 <= code && code <= 6099 || 6109 == code || 6155 <= code && code <= 6157 || 6277 <= code && code <= 6278 || 6313 == code || 6432 <= code && code <= 6434 || 6439 <= code && code <= 6440 || 6450 == code || 6457 <= code && code <= 6459 || 6679 <= code && code <= 6680 || 6683 == code || 6742 == code || 6744 <= code && code <= 6750 || 6752 == code || 6754 == code || 6757 <= code && code <= 6764 || 6771 <= code && code <= 6780 || 6783 == code || 6832 <= code && code <= 6845 || 6846 == code || 6912 <= code && code <= 6915 || 6964 == code || 6966 <= code && code <= 6970 || 6972 == code || 6978 == code || 7019 <= code && code <= 7027 || 7040 <= code && code <= 7041 || 7074 <= code && code <= 7077 || 7080 <= code && code <= 7081 || 7083 <= code && code <= 7085 || 7142 == code || 7144 <= code && code <= 7145 || 7149 == code || 7151 <= code && code <= 7153 || 7212 <= code && code <= 7219 || 7222 <= code && code <= 7223 || 7376 <= code && code <= 7378 || 7380 <= code && code <= 7392 || 7394 <= code && code <= 7400 || 7405 == code || 7412 == code || 7416 <= code && code <= 7417 || 7616 <= code && code <= 7673 || 7675 <= code && code <= 7679 || 8204 == code || 8400 <= code && code <= 8412 || 8413 <= code && code <= 8416 || 8417 == code || 8418 <= code && code <= 8420 || 8421 <= code && code <= 8432 || 11503 <= code && code <= 11505 || 11647 == code || 11744 <= code && code <= 11775 || 12330 <= code && code <= 12333 || 12334 <= code && code <= 12335 || 12441 <= code && code <= 12442 || 42607 == code || 42608 <= code && code <= 42610 || 42612 <= code && code <= 42621 || 42654 <= code && code <= 42655 || 42736 <= code && code <= 42737 || 43010 == code || 43014 == code || 43019 == code || 43045 <= code && code <= 43046 || 43204 <= code && code <= 43205 || 43232 <= code && code <= 43249 || 43302 <= code && code <= 43309 || 43335 <= code && code <= 43345 || 43392 <= code && code <= 43394 || 43443 == code || 43446 <= code && code <= 43449 || 43452 == code || 43493 == code || 43561 <= code && code <= 43566 || 43569 <= code && code <= 43570 || 43573 <= code && code <= 43574 || 43587 == code || 43596 == code || 43644 == code || 43696 == code || 43698 <= code && code <= 43700 || 43703 <= code && code <= 43704 || 43710 <= code && code <= 43711 || 43713 == code || 43756 <= code && code <= 43757 || 43766 == code || 44005 == code || 44008 == code || 44013 == code || 64286 == code || 65024 <= code && code <= 65039 || 65056 <= code && code <= 65071 || 65438 <= code && code <= 65439 || 66045 == code || 66272 == code || 66422 <= code && code <= 66426 || 68097 <= code && code <= 68099 || 68101 <= code && code <= 68102 || 68108 <= code && code <= 68111 || 68152 <= code && code <= 68154 || 68159 == code || 68325 <= code && code <= 68326 || 69633 == code || 69688 <= code && code <= 69702 || 69759 <= code && code <= 69761 || 69811 <= code && code <= 69814 || 69817 <= code && code <= 69818 || 69888 <= code && code <= 69890 || 69927 <= code && code <= 69931 || 69933 <= code && code <= 69940 || 70003 == code || 70016 <= code && code <= 70017 || 70070 <= code && code <= 70078 || 70090 <= code && code <= 70092 || 70191 <= code && code <= 70193 || 70196 == code || 70198 <= code && code <= 70199 || 70206 == code || 70367 == code || 70371 <= code && code <= 70378 || 70400 <= code && code <= 70401 || 70460 == code || 70462 == code || 70464 == code || 70487 == code || 70502 <= code && code <= 70508 || 70512 <= code && code <= 70516 || 70712 <= code && code <= 70719 || 70722 <= code && code <= 70724 || 70726 == code || 70832 == code || 70835 <= code && code <= 70840 || 70842 == code || 70845 == code || 70847 <= code && code <= 70848 || 70850 <= code && code <= 70851 || 71087 == code || 71090 <= code && code <= 71093 || 71100 <= code && code <= 71101 || 71103 <= code && code <= 71104 || 71132 <= code && code <= 71133 || 71219 <= code && code <= 71226 || 71229 == code || 71231 <= code && code <= 71232 || 71339 == code || 71341 == code || 71344 <= code && code <= 71349 || 71351 == code || 71453 <= code && code <= 71455 || 71458 <= code && code <= 71461 || 71463 <= code && code <= 71467 || 72193 <= code && code <= 72198 || 72201 <= code && code <= 72202 || 72243 <= code && code <= 72248 || 72251 <= code && code <= 72254 || 72263 == code || 72273 <= code && code <= 72278 || 72281 <= code && code <= 72283 || 72330 <= code && code <= 72342 || 72344 <= code && code <= 72345 || 72752 <= code && code <= 72758 || 72760 <= code && code <= 72765 || 72767 == code || 72850 <= code && code <= 72871 || 72874 <= code && code <= 72880 || 72882 <= code && code <= 72883 || 72885 <= code && code <= 72886 || 73009 <= code && code <= 73014 || 73018 == code || 73020 <= code && code <= 73021 || 73023 <= code && code <= 73029 || 73031 == code || 92912 <= code && code <= 92916 || 92976 <= code && code <= 92982 || 94095 <= code && code <= 94098 || 113821 <= code && code <= 113822 || 119141 == code || 119143 <= code && code <= 119145 || 119150 <= code && code <= 119154 || 119163 <= code && code <= 119170 || 119173 <= code && code <= 119179 || 119210 <= code && code <= 119213 || 119362 <= code && code <= 119364 || 121344 <= code && code <= 121398 || 121403 <= code && code <= 121452 || 121461 == code || 121476 == code || 121499 <= code && code <= 121503 || 121505 <= code && code <= 121519 || 122880 <= code && code <= 122886 || 122888 <= code && code <= 122904 || 122907 <= code && code <= 122913 || 122915 <= code && code <= 122916 || 122918 <= code && code <= 122922 || 125136 <= code && code <= 125142 || 125252 <= code && code <= 125258 || 917536 <= code && code <= 917631 || 917760 <= code && code <= 917999) {
  109209. return Extend;
  109210. }
  109211. if (127462 <= code && code <= 127487) {
  109212. return Regional_Indicator;
  109213. }
  109214. if (2307 == code || 2363 == code || 2366 <= code && code <= 2368 || 2377 <= code && code <= 2380 || 2382 <= code && code <= 2383 || 2434 <= code && code <= 2435 || 2495 <= code && code <= 2496 || 2503 <= code && code <= 2504 || 2507 <= code && code <= 2508 || 2563 == code || 2622 <= code && code <= 2624 || 2691 == code || 2750 <= code && code <= 2752 || 2761 == code || 2763 <= code && code <= 2764 || 2818 <= code && code <= 2819 || 2880 == code || 2887 <= code && code <= 2888 || 2891 <= code && code <= 2892 || 3007 == code || 3009 <= code && code <= 3010 || 3014 <= code && code <= 3016 || 3018 <= code && code <= 3020 || 3073 <= code && code <= 3075 || 3137 <= code && code <= 3140 || 3202 <= code && code <= 3203 || 3262 == code || 3264 <= code && code <= 3265 || 3267 <= code && code <= 3268 || 3271 <= code && code <= 3272 || 3274 <= code && code <= 3275 || 3330 <= code && code <= 3331 || 3391 <= code && code <= 3392 || 3398 <= code && code <= 3400 || 3402 <= code && code <= 3404 || 3458 <= code && code <= 3459 || 3536 <= code && code <= 3537 || 3544 <= code && code <= 3550 || 3570 <= code && code <= 3571 || 3635 == code || 3763 == code || 3902 <= code && code <= 3903 || 3967 == code || 4145 == code || 4155 <= code && code <= 4156 || 4182 <= code && code <= 4183 || 4228 == code || 6070 == code || 6078 <= code && code <= 6085 || 6087 <= code && code <= 6088 || 6435 <= code && code <= 6438 || 6441 <= code && code <= 6443 || 6448 <= code && code <= 6449 || 6451 <= code && code <= 6456 || 6681 <= code && code <= 6682 || 6741 == code || 6743 == code || 6765 <= code && code <= 6770 || 6916 == code || 6965 == code || 6971 == code || 6973 <= code && code <= 6977 || 6979 <= code && code <= 6980 || 7042 == code || 7073 == code || 7078 <= code && code <= 7079 || 7082 == code || 7143 == code || 7146 <= code && code <= 7148 || 7150 == code || 7154 <= code && code <= 7155 || 7204 <= code && code <= 7211 || 7220 <= code && code <= 7221 || 7393 == code || 7410 <= code && code <= 7411 || 7415 == code || 43043 <= code && code <= 43044 || 43047 == code || 43136 <= code && code <= 43137 || 43188 <= code && code <= 43203 || 43346 <= code && code <= 43347 || 43395 == code || 43444 <= code && code <= 43445 || 43450 <= code && code <= 43451 || 43453 <= code && code <= 43456 || 43567 <= code && code <= 43568 || 43571 <= code && code <= 43572 || 43597 == code || 43755 == code || 43758 <= code && code <= 43759 || 43765 == code || 44003 <= code && code <= 44004 || 44006 <= code && code <= 44007 || 44009 <= code && code <= 44010 || 44012 == code || 69632 == code || 69634 == code || 69762 == code || 69808 <= code && code <= 69810 || 69815 <= code && code <= 69816 || 69932 == code || 70018 == code || 70067 <= code && code <= 70069 || 70079 <= code && code <= 70080 || 70188 <= code && code <= 70190 || 70194 <= code && code <= 70195 || 70197 == code || 70368 <= code && code <= 70370 || 70402 <= code && code <= 70403 || 70463 == code || 70465 <= code && code <= 70468 || 70471 <= code && code <= 70472 || 70475 <= code && code <= 70477 || 70498 <= code && code <= 70499 || 70709 <= code && code <= 70711 || 70720 <= code && code <= 70721 || 70725 == code || 70833 <= code && code <= 70834 || 70841 == code || 70843 <= code && code <= 70844 || 70846 == code || 70849 == code || 71088 <= code && code <= 71089 || 71096 <= code && code <= 71099 || 71102 == code || 71216 <= code && code <= 71218 || 71227 <= code && code <= 71228 || 71230 == code || 71340 == code || 71342 <= code && code <= 71343 || 71350 == code || 71456 <= code && code <= 71457 || 71462 == code || 72199 <= code && code <= 72200 || 72249 == code || 72279 <= code && code <= 72280 || 72343 == code || 72751 == code || 72766 == code || 72873 == code || 72881 == code || 72884 == code || 94033 <= code && code <= 94078 || 119142 == code || 119149 == code) {
  109215. return SpacingMark;
  109216. }
  109217. if (4352 <= code && code <= 4447 || 43360 <= code && code <= 43388) {
  109218. return L;
  109219. }
  109220. if (4448 <= code && code <= 4519 || 55216 <= code && code <= 55238) {
  109221. return V;
  109222. }
  109223. if (4520 <= code && code <= 4607 || 55243 <= code && code <= 55291) {
  109224. return T;
  109225. }
  109226. if (44032 == code || 44060 == code || 44088 == code || 44116 == code || 44144 == code || 44172 == code || 44200 == code || 44228 == code || 44256 == code || 44284 == code || 44312 == code || 44340 == code || 44368 == code || 44396 == code || 44424 == code || 44452 == code || 44480 == code || 44508 == code || 44536 == code || 44564 == code || 44592 == code || 44620 == code || 44648 == code || 44676 == code || 44704 == code || 44732 == code || 44760 == code || 44788 == code || 44816 == code || 44844 == code || 44872 == code || 44900 == code || 44928 == code || 44956 == code || 44984 == code || 45012 == code || 45040 == code || 45068 == code || 45096 == code || 45124 == code || 45152 == code || 45180 == code || 45208 == code || 45236 == code || 45264 == code || 45292 == code || 45320 == code || 45348 == code || 45376 == code || 45404 == code || 45432 == code || 45460 == code || 45488 == code || 45516 == code || 45544 == code || 45572 == code || 45600 == code || 45628 == code || 45656 == code || 45684 == code || 45712 == code || 45740 == code || 45768 == code || 45796 == code || 45824 == code || 45852 == code || 45880 == code || 45908 == code || 45936 == code || 45964 == code || 45992 == code || 46020 == code || 46048 == code || 46076 == code || 46104 == code || 46132 == code || 46160 == code || 46188 == code || 46216 == code || 46244 == code || 46272 == code || 46300 == code || 46328 == code || 46356 == code || 46384 == code || 46412 == code || 46440 == code || 46468 == code || 46496 == code || 46524 == code || 46552 == code || 46580 == code || 46608 == code || 46636 == code || 46664 == code || 46692 == code || 46720 == code || 46748 == code || 46776 == code || 46804 == code || 46832 == code || 46860 == code || 46888 == code || 46916 == code || 46944 == code || 46972 == code || 47e3 == code || 47028 == code || 47056 == code || 47084 == code || 47112 == code || 47140 == code || 47168 == code || 47196 == code || 47224 == code || 47252 == code || 47280 == code || 47308 == code || 47336 == code || 47364 == code || 47392 == code || 47420 == code || 47448 == code || 47476 == code || 47504 == code || 47532 == code || 47560 == code || 47588 == code || 47616 == code || 47644 == code || 47672 == code || 47700 == code || 47728 == code || 47756 == code || 47784 == code || 47812 == code || 47840 == code || 47868 == code || 47896 == code || 47924 == code || 47952 == code || 47980 == code || 48008 == code || 48036 == code || 48064 == code || 48092 == code || 48120 == code || 48148 == code || 48176 == code || 48204 == code || 48232 == code || 48260 == code || 48288 == code || 48316 == code || 48344 == code || 48372 == code || 48400 == code || 48428 == code || 48456 == code || 48484 == code || 48512 == code || 48540 == code || 48568 == code || 48596 == code || 48624 == code || 48652 == code || 48680 == code || 48708 == code || 48736 == code || 48764 == code || 48792 == code || 48820 == code || 48848 == code || 48876 == code || 48904 == code || 48932 == code || 48960 == code || 48988 == code || 49016 == code || 49044 == code || 49072 == code || 49100 == code || 49128 == code || 49156 == code || 49184 == code || 49212 == code || 49240 == code || 49268 == code || 49296 == code || 49324 == code || 49352 == code || 49380 == code || 49408 == code || 49436 == code || 49464 == code || 49492 == code || 49520 == code || 49548 == code || 49576 == code || 49604 == code || 49632 == code || 49660 == code || 49688 == code || 49716 == code || 49744 == code || 49772 == code || 49800 == code || 49828 == code || 49856 == code || 49884 == code || 49912 == code || 49940 == code || 49968 == code || 49996 == code || 50024 == code || 50052 == code || 50080 == code || 50108 == code || 50136 == code || 50164 == code || 50192 == code || 50220 == code || 50248 == code || 50276 == code || 50304 == code || 50332 == code || 50360 == code || 50388 == code || 50416 == code || 50444 == code || 50472 == code || 50500 == code || 50528 == code || 50556 == code || 50584 == code || 50612 == code || 50640 == code || 50668 == code || 50696 == code || 50724 == code || 50752 == code || 50780 == code || 50808 == code || 50836 == code || 50864 == code || 50892 == code || 50920 == code || 50948 == code || 50976 == code || 51004 == code || 51032 == code || 51060 == code || 51088 == code || 51116 == code || 51144 == code || 51172 == code || 51200 == code || 51228 == code || 51256 == code || 51284 == code || 51312 == code || 51340 == code || 51368 == code || 51396 == code || 51424 == code || 51452 == code || 51480 == code || 51508 == code || 51536 == code || 51564 == code || 51592 == code || 51620 == code || 51648 == code || 51676 == code || 51704 == code || 51732 == code || 51760 == code || 51788 == code || 51816 == code || 51844 == code || 51872 == code || 51900 == code || 51928 == code || 51956 == code || 51984 == code || 52012 == code || 52040 == code || 52068 == code || 52096 == code || 52124 == code || 52152 == code || 52180 == code || 52208 == code || 52236 == code || 52264 == code || 52292 == code || 52320 == code || 52348 == code || 52376 == code || 52404 == code || 52432 == code || 52460 == code || 52488 == code || 52516 == code || 52544 == code || 52572 == code || 52600 == code || 52628 == code || 52656 == code || 52684 == code || 52712 == code || 52740 == code || 52768 == code || 52796 == code || 52824 == code || 52852 == code || 52880 == code || 52908 == code || 52936 == code || 52964 == code || 52992 == code || 53020 == code || 53048 == code || 53076 == code || 53104 == code || 53132 == code || 53160 == code || 53188 == code || 53216 == code || 53244 == code || 53272 == code || 53300 == code || 53328 == code || 53356 == code || 53384 == code || 53412 == code || 53440 == code || 53468 == code || 53496 == code || 53524 == code || 53552 == code || 53580 == code || 53608 == code || 53636 == code || 53664 == code || 53692 == code || 53720 == code || 53748 == code || 53776 == code || 53804 == code || 53832 == code || 53860 == code || 53888 == code || 53916 == code || 53944 == code || 53972 == code || 54e3 == code || 54028 == code || 54056 == code || 54084 == code || 54112 == code || 54140 == code || 54168 == code || 54196 == code || 54224 == code || 54252 == code || 54280 == code || 54308 == code || 54336 == code || 54364 == code || 54392 == code || 54420 == code || 54448 == code || 54476 == code || 54504 == code || 54532 == code || 54560 == code || 54588 == code || 54616 == code || 54644 == code || 54672 == code || 54700 == code || 54728 == code || 54756 == code || 54784 == code || 54812 == code || 54840 == code || 54868 == code || 54896 == code || 54924 == code || 54952 == code || 54980 == code || 55008 == code || 55036 == code || 55064 == code || 55092 == code || 55120 == code || 55148 == code || 55176 == code) {
  109227. return LV;
  109228. }
  109229. if (44033 <= code && code <= 44059 || 44061 <= code && code <= 44087 || 44089 <= code && code <= 44115 || 44117 <= code && code <= 44143 || 44145 <= code && code <= 44171 || 44173 <= code && code <= 44199 || 44201 <= code && code <= 44227 || 44229 <= code && code <= 44255 || 44257 <= code && code <= 44283 || 44285 <= code && code <= 44311 || 44313 <= code && code <= 44339 || 44341 <= code && code <= 44367 || 44369 <= code && code <= 44395 || 44397 <= code && code <= 44423 || 44425 <= code && code <= 44451 || 44453 <= code && code <= 44479 || 44481 <= code && code <= 44507 || 44509 <= code && code <= 44535 || 44537 <= code && code <= 44563 || 44565 <= code && code <= 44591 || 44593 <= code && code <= 44619 || 44621 <= code && code <= 44647 || 44649 <= code && code <= 44675 || 44677 <= code && code <= 44703 || 44705 <= code && code <= 44731 || 44733 <= code && code <= 44759 || 44761 <= code && code <= 44787 || 44789 <= code && code <= 44815 || 44817 <= code && code <= 44843 || 44845 <= code && code <= 44871 || 44873 <= code && code <= 44899 || 44901 <= code && code <= 44927 || 44929 <= code && code <= 44955 || 44957 <= code && code <= 44983 || 44985 <= code && code <= 45011 || 45013 <= code && code <= 45039 || 45041 <= code && code <= 45067 || 45069 <= code && code <= 45095 || 45097 <= code && code <= 45123 || 45125 <= code && code <= 45151 || 45153 <= code && code <= 45179 || 45181 <= code && code <= 45207 || 45209 <= code && code <= 45235 || 45237 <= code && code <= 45263 || 45265 <= code && code <= 45291 || 45293 <= code && code <= 45319 || 45321 <= code && code <= 45347 || 45349 <= code && code <= 45375 || 45377 <= code && code <= 45403 || 45405 <= code && code <= 45431 || 45433 <= code && code <= 45459 || 45461 <= code && code <= 45487 || 45489 <= code && code <= 45515 || 45517 <= code && code <= 45543 || 45545 <= code && code <= 45571 || 45573 <= code && code <= 45599 || 45601 <= code && code <= 45627 || 45629 <= code && code <= 45655 || 45657 <= code && code <= 45683 || 45685 <= code && code <= 45711 || 45713 <= code && code <= 45739 || 45741 <= code && code <= 45767 || 45769 <= code && code <= 45795 || 45797 <= code && code <= 45823 || 45825 <= code && code <= 45851 || 45853 <= code && code <= 45879 || 45881 <= code && code <= 45907 || 45909 <= code && code <= 45935 || 45937 <= code && code <= 45963 || 45965 <= code && code <= 45991 || 45993 <= code && code <= 46019 || 46021 <= code && code <= 46047 || 46049 <= code && code <= 46075 || 46077 <= code && code <= 46103 || 46105 <= code && code <= 46131 || 46133 <= code && code <= 46159 || 46161 <= code && code <= 46187 || 46189 <= code && code <= 46215 || 46217 <= code && code <= 46243 || 46245 <= code && code <= 46271 || 46273 <= code && code <= 46299 || 46301 <= code && code <= 46327 || 46329 <= code && code <= 46355 || 46357 <= code && code <= 46383 || 46385 <= code && code <= 46411 || 46413 <= code && code <= 46439 || 46441 <= code && code <= 46467 || 46469 <= code && code <= 46495 || 46497 <= code && code <= 46523 || 46525 <= code && code <= 46551 || 46553 <= code && code <= 46579 || 46581 <= code && code <= 46607 || 46609 <= code && code <= 46635 || 46637 <= code && code <= 46663 || 46665 <= code && code <= 46691 || 46693 <= code && code <= 46719 || 46721 <= code && code <= 46747 || 46749 <= code && code <= 46775 || 46777 <= code && code <= 46803 || 46805 <= code && code <= 46831 || 46833 <= code && code <= 46859 || 46861 <= code && code <= 46887 || 46889 <= code && code <= 46915 || 46917 <= code && code <= 46943 || 46945 <= code && code <= 46971 || 46973 <= code && code <= 46999 || 47001 <= code && code <= 47027 || 47029 <= code && code <= 47055 || 47057 <= code && code <= 47083 || 47085 <= code && code <= 47111 || 47113 <= code && code <= 47139 || 47141 <= code && code <= 47167 || 47169 <= code && code <= 47195 || 47197 <= code && code <= 47223 || 47225 <= code && code <= 47251 || 47253 <= code && code <= 47279 || 47281 <= code && code <= 47307 || 47309 <= code && code <= 47335 || 47337 <= code && code <= 47363 || 47365 <= code && code <= 47391 || 47393 <= code && code <= 47419 || 47421 <= code && code <= 47447 || 47449 <= code && code <= 47475 || 47477 <= code && code <= 47503 || 47505 <= code && code <= 47531 || 47533 <= code && code <= 47559 || 47561 <= code && code <= 47587 || 47589 <= code && code <= 47615 || 47617 <= code && code <= 47643 || 47645 <= code && code <= 47671 || 47673 <= code && code <= 47699 || 47701 <= code && code <= 47727 || 47729 <= code && code <= 47755 || 47757 <= code && code <= 47783 || 47785 <= code && code <= 47811 || 47813 <= code && code <= 47839 || 47841 <= code && code <= 47867 || 47869 <= code && code <= 47895 || 47897 <= code && code <= 47923 || 47925 <= code && code <= 47951 || 47953 <= code && code <= 47979 || 47981 <= code && code <= 48007 || 48009 <= code && code <= 48035 || 48037 <= code && code <= 48063 || 48065 <= code && code <= 48091 || 48093 <= code && code <= 48119 || 48121 <= code && code <= 48147 || 48149 <= code && code <= 48175 || 48177 <= code && code <= 48203 || 48205 <= code && code <= 48231 || 48233 <= code && code <= 48259 || 48261 <= code && code <= 48287 || 48289 <= code && code <= 48315 || 48317 <= code && code <= 48343 || 48345 <= code && code <= 48371 || 48373 <= code && code <= 48399 || 48401 <= code && code <= 48427 || 48429 <= code && code <= 48455 || 48457 <= code && code <= 48483 || 48485 <= code && code <= 48511 || 48513 <= code && code <= 48539 || 48541 <= code && code <= 48567 || 48569 <= code && code <= 48595 || 48597 <= code && code <= 48623 || 48625 <= code && code <= 48651 || 48653 <= code && code <= 48679 || 48681 <= code && code <= 48707 || 48709 <= code && code <= 48735 || 48737 <= code && code <= 48763 || 48765 <= code && code <= 48791 || 48793 <= code && code <= 48819 || 48821 <= code && code <= 48847 || 48849 <= code && code <= 48875 || 48877 <= code && code <= 48903 || 48905 <= code && code <= 48931 || 48933 <= code && code <= 48959 || 48961 <= code && code <= 48987 || 48989 <= code && code <= 49015 || 49017 <= code && code <= 49043 || 49045 <= code && code <= 49071 || 49073 <= code && code <= 49099 || 49101 <= code && code <= 49127 || 49129 <= code && code <= 49155 || 49157 <= code && code <= 49183 || 49185 <= code && code <= 49211 || 49213 <= code && code <= 49239 || 49241 <= code && code <= 49267 || 49269 <= code && code <= 49295 || 49297 <= code && code <= 49323 || 49325 <= code && code <= 49351 || 49353 <= code && code <= 49379 || 49381 <= code && code <= 49407 || 49409 <= code && code <= 49435 || 49437 <= code && code <= 49463 || 49465 <= code && code <= 49491 || 49493 <= code && code <= 49519 || 49521 <= code && code <= 49547 || 49549 <= code && code <= 49575 || 49577 <= code && code <= 49603 || 49605 <= code && code <= 49631 || 49633 <= code && code <= 49659 || 49661 <= code && code <= 49687 || 49689 <= code && code <= 49715 || 49717 <= code && code <= 49743 || 49745 <= code && code <= 49771 || 49773 <= code && code <= 49799 || 49801 <= code && code <= 49827 || 49829 <= code && code <= 49855 || 49857 <= code && code <= 49883 || 49885 <= code && code <= 49911 || 49913 <= code && code <= 49939 || 49941 <= code && code <= 49967 || 49969 <= code && code <= 49995 || 49997 <= code && code <= 50023 || 50025 <= code && code <= 50051 || 50053 <= code && code <= 50079 || 50081 <= code && code <= 50107 || 50109 <= code && code <= 50135 || 50137 <= code && code <= 50163 || 50165 <= code && code <= 50191 || 50193 <= code && code <= 50219 || 50221 <= code && code <= 50247 || 50249 <= code && code <= 50275 || 50277 <= code && code <= 50303 || 50305 <= code && code <= 50331 || 50333 <= code && code <= 50359 || 50361 <= code && code <= 50387 || 50389 <= code && code <= 50415 || 50417 <= code && code <= 50443 || 50445 <= code && code <= 50471 || 50473 <= code && code <= 50499 || 50501 <= code && code <= 50527 || 50529 <= code && code <= 50555 || 50557 <= code && code <= 50583 || 50585 <= code && code <= 50611 || 50613 <= code && code <= 50639 || 50641 <= code && code <= 50667 || 50669 <= code && code <= 50695 || 50697 <= code && code <= 50723 || 50725 <= code && code <= 50751 || 50753 <= code && code <= 50779 || 50781 <= code && code <= 50807 || 50809 <= code && code <= 50835 || 50837 <= code && code <= 50863 || 50865 <= code && code <= 50891 || 50893 <= code && code <= 50919 || 50921 <= code && code <= 50947 || 50949 <= code && code <= 50975 || 50977 <= code && code <= 51003 || 51005 <= code && code <= 51031 || 51033 <= code && code <= 51059 || 51061 <= code && code <= 51087 || 51089 <= code && code <= 51115 || 51117 <= code && code <= 51143 || 51145 <= code && code <= 51171 || 51173 <= code && code <= 51199 || 51201 <= code && code <= 51227 || 51229 <= code && code <= 51255 || 51257 <= code && code <= 51283 || 51285 <= code && code <= 51311 || 51313 <= code && code <= 51339 || 51341 <= code && code <= 51367 || 51369 <= code && code <= 51395 || 51397 <= code && code <= 51423 || 51425 <= code && code <= 51451 || 51453 <= code && code <= 51479 || 51481 <= code && code <= 51507 || 51509 <= code && code <= 51535 || 51537 <= code && code <= 51563 || 51565 <= code && code <= 51591 || 51593 <= code && code <= 51619 || 51621 <= code && code <= 51647 || 51649 <= code && code <= 51675 || 51677 <= code && code <= 51703 || 51705 <= code && code <= 51731 || 51733 <= code && code <= 51759 || 51761 <= code && code <= 51787 || 51789 <= code && code <= 51815 || 51817 <= code && code <= 51843 || 51845 <= code && code <= 51871 || 51873 <= code && code <= 51899 || 51901 <= code && code <= 51927 || 51929 <= code && code <= 51955 || 51957 <= code && code <= 51983 || 51985 <= code && code <= 52011 || 52013 <= code && code <= 52039 || 52041 <= code && code <= 52067 || 52069 <= code && code <= 52095 || 52097 <= code && code <= 52123 || 52125 <= code && code <= 52151 || 52153 <= code && code <= 52179 || 52181 <= code && code <= 52207 || 52209 <= code && code <= 52235 || 52237 <= code && code <= 52263 || 52265 <= code && code <= 52291 || 52293 <= code && code <= 52319 || 52321 <= code && code <= 52347 || 52349 <= code && code <= 52375 || 52377 <= code && code <= 52403 || 52405 <= code && code <= 52431 || 52433 <= code && code <= 52459 || 52461 <= code && code <= 52487 || 52489 <= code && code <= 52515 || 52517 <= code && code <= 52543 || 52545 <= code && code <= 52571 || 52573 <= code && code <= 52599 || 52601 <= code && code <= 52627 || 52629 <= code && code <= 52655 || 52657 <= code && code <= 52683 || 52685 <= code && code <= 52711 || 52713 <= code && code <= 52739 || 52741 <= code && code <= 52767 || 52769 <= code && code <= 52795 || 52797 <= code && code <= 52823 || 52825 <= code && code <= 52851 || 52853 <= code && code <= 52879 || 52881 <= code && code <= 52907 || 52909 <= code && code <= 52935 || 52937 <= code && code <= 52963 || 52965 <= code && code <= 52991 || 52993 <= code && code <= 53019 || 53021 <= code && code <= 53047 || 53049 <= code && code <= 53075 || 53077 <= code && code <= 53103 || 53105 <= code && code <= 53131 || 53133 <= code && code <= 53159 || 53161 <= code && code <= 53187 || 53189 <= code && code <= 53215 || 53217 <= code && code <= 53243 || 53245 <= code && code <= 53271 || 53273 <= code && code <= 53299 || 53301 <= code && code <= 53327 || 53329 <= code && code <= 53355 || 53357 <= code && code <= 53383 || 53385 <= code && code <= 53411 || 53413 <= code && code <= 53439 || 53441 <= code && code <= 53467 || 53469 <= code && code <= 53495 || 53497 <= code && code <= 53523 || 53525 <= code && code <= 53551 || 53553 <= code && code <= 53579 || 53581 <= code && code <= 53607 || 53609 <= code && code <= 53635 || 53637 <= code && code <= 53663 || 53665 <= code && code <= 53691 || 53693 <= code && code <= 53719 || 53721 <= code && code <= 53747 || 53749 <= code && code <= 53775 || 53777 <= code && code <= 53803 || 53805 <= code && code <= 53831 || 53833 <= code && code <= 53859 || 53861 <= code && code <= 53887 || 53889 <= code && code <= 53915 || 53917 <= code && code <= 53943 || 53945 <= code && code <= 53971 || 53973 <= code && code <= 53999 || 54001 <= code && code <= 54027 || 54029 <= code && code <= 54055 || 54057 <= code && code <= 54083 || 54085 <= code && code <= 54111 || 54113 <= code && code <= 54139 || 54141 <= code && code <= 54167 || 54169 <= code && code <= 54195 || 54197 <= code && code <= 54223 || 54225 <= code && code <= 54251 || 54253 <= code && code <= 54279 || 54281 <= code && code <= 54307 || 54309 <= code && code <= 54335 || 54337 <= code && code <= 54363 || 54365 <= code && code <= 54391 || 54393 <= code && code <= 54419 || 54421 <= code && code <= 54447 || 54449 <= code && code <= 54475 || 54477 <= code && code <= 54503 || 54505 <= code && code <= 54531 || 54533 <= code && code <= 54559 || 54561 <= code && code <= 54587 || 54589 <= code && code <= 54615 || 54617 <= code && code <= 54643 || 54645 <= code && code <= 54671 || 54673 <= code && code <= 54699 || 54701 <= code && code <= 54727 || 54729 <= code && code <= 54755 || 54757 <= code && code <= 54783 || 54785 <= code && code <= 54811 || 54813 <= code && code <= 54839 || 54841 <= code && code <= 54867 || 54869 <= code && code <= 54895 || 54897 <= code && code <= 54923 || 54925 <= code && code <= 54951 || 54953 <= code && code <= 54979 || 54981 <= code && code <= 55007 || 55009 <= code && code <= 55035 || 55037 <= code && code <= 55063 || 55065 <= code && code <= 55091 || 55093 <= code && code <= 55119 || 55121 <= code && code <= 55147 || 55149 <= code && code <= 55175 || 55177 <= code && code <= 55203) {
  109230. return LVT;
  109231. }
  109232. if (9757 == code || 9977 == code || 9994 <= code && code <= 9997 || 127877 == code || 127938 <= code && code <= 127940 || 127943 == code || 127946 <= code && code <= 127948 || 128066 <= code && code <= 128067 || 128070 <= code && code <= 128080 || 128110 == code || 128112 <= code && code <= 128120 || 128124 == code || 128129 <= code && code <= 128131 || 128133 <= code && code <= 128135 || 128170 == code || 128372 <= code && code <= 128373 || 128378 == code || 128400 == code || 128405 <= code && code <= 128406 || 128581 <= code && code <= 128583 || 128587 <= code && code <= 128591 || 128675 == code || 128692 <= code && code <= 128694 || 128704 == code || 128716 == code || 129304 <= code && code <= 129308 || 129310 <= code && code <= 129311 || 129318 == code || 129328 <= code && code <= 129337 || 129341 <= code && code <= 129342 || 129489 <= code && code <= 129501) {
  109233. return E_Base;
  109234. }
  109235. if (127995 <= code && code <= 127999) {
  109236. return E_Modifier;
  109237. }
  109238. if (8205 == code) {
  109239. return ZWJ;
  109240. }
  109241. if (9792 == code || 9794 == code || 9877 <= code && code <= 9878 || 9992 == code || 10084 == code || 127752 == code || 127806 == code || 127859 == code || 127891 == code || 127908 == code || 127912 == code || 127979 == code || 127981 == code || 128139 == code || 128187 <= code && code <= 128188 || 128295 == code || 128300 == code || 128488 == code || 128640 == code || 128658 == code) {
  109242. return Glue_After_Zwj;
  109243. }
  109244. if (128102 <= code && code <= 128105) {
  109245. return E_Base_GAZ;
  109246. }
  109247. return Other;
  109248. }
  109249. return this;
  109250. }
  109251. if (module2.exports) {
  109252. module2.exports = GraphemeSplitter;
  109253. }
  109254. });
  109255. // node_modules/cesium/Source/Scene/LabelCollection.js
  109256. function Glyph() {
  109257. this.textureInfo = void 0;
  109258. this.dimensions = void 0;
  109259. this.billboard = void 0;
  109260. }
  109261. function GlyphTextureInfo(labelCollection, index2, dimensions) {
  109262. this.labelCollection = labelCollection;
  109263. this.index = index2;
  109264. this.dimensions = dimensions;
  109265. }
  109266. var defaultLineSpacingPercent = 1.2;
  109267. var whitePixelCanvasId = "ID_WHITE_PIXEL";
  109268. var whitePixelSize = new Cartesian2_default(4, 4);
  109269. var whitePixelBoundingRegion = new BoundingRectangle_default(1, 1, 1, 1);
  109270. function addWhitePixelCanvas(textureAtlas, labelCollection) {
  109271. const canvas = document.createElement("canvas");
  109272. canvas.width = whitePixelSize.x;
  109273. canvas.height = whitePixelSize.y;
  109274. const context2D = canvas.getContext("2d");
  109275. context2D.fillStyle = "#fff";
  109276. context2D.fillRect(0, 0, canvas.width, canvas.height);
  109277. const index2 = textureAtlas.addImageSync(whitePixelCanvasId, canvas);
  109278. labelCollection._whitePixelIndex = index2;
  109279. }
  109280. var writeTextToCanvasParameters = {};
  109281. function createGlyphCanvas(character, font, fillColor, outlineColor, outlineWidth, style, verticalOrigin) {
  109282. writeTextToCanvasParameters.font = font;
  109283. writeTextToCanvasParameters.fillColor = fillColor;
  109284. writeTextToCanvasParameters.strokeColor = outlineColor;
  109285. writeTextToCanvasParameters.strokeWidth = outlineWidth;
  109286. writeTextToCanvasParameters.padding = SDFSettings_default.PADDING;
  109287. if (verticalOrigin === VerticalOrigin_default.CENTER) {
  109288. writeTextToCanvasParameters.textBaseline = "middle";
  109289. } else if (verticalOrigin === VerticalOrigin_default.TOP) {
  109290. writeTextToCanvasParameters.textBaseline = "top";
  109291. } else {
  109292. writeTextToCanvasParameters.textBaseline = "bottom";
  109293. }
  109294. writeTextToCanvasParameters.fill = style === LabelStyle_default.FILL || style === LabelStyle_default.FILL_AND_OUTLINE;
  109295. writeTextToCanvasParameters.stroke = style === LabelStyle_default.OUTLINE || style === LabelStyle_default.FILL_AND_OUTLINE;
  109296. writeTextToCanvasParameters.backgroundColor = Color_default.BLACK;
  109297. return writeTextToCanvas_default(character, writeTextToCanvasParameters);
  109298. }
  109299. function unbindGlyph(labelCollection, glyph) {
  109300. glyph.textureInfo = void 0;
  109301. glyph.dimensions = void 0;
  109302. const billboard = glyph.billboard;
  109303. if (defined_default(billboard)) {
  109304. billboard.show = false;
  109305. billboard.image = void 0;
  109306. if (defined_default(billboard._removeCallbackFunc)) {
  109307. billboard._removeCallbackFunc();
  109308. billboard._removeCallbackFunc = void 0;
  109309. }
  109310. labelCollection._spareBillboards.push(billboard);
  109311. glyph.billboard = void 0;
  109312. }
  109313. }
  109314. function addGlyphToTextureAtlas(textureAtlas, id, canvas, glyphTextureInfo) {
  109315. glyphTextureInfo.index = textureAtlas.addImageSync(id, canvas);
  109316. }
  109317. var splitter = new graphemeSplitter();
  109318. function rebindAllGlyphs2(labelCollection, label) {
  109319. const text2 = label._renderedText;
  109320. const graphemes = splitter.splitGraphemes(text2);
  109321. const textLength = graphemes.length;
  109322. const glyphs = label._glyphs;
  109323. const glyphsLength = glyphs.length;
  109324. let glyph;
  109325. let glyphIndex;
  109326. let textIndex;
  109327. label._relativeSize = label._fontSize / SDFSettings_default.FONT_SIZE;
  109328. if (textLength < glyphsLength) {
  109329. for (glyphIndex = textLength; glyphIndex < glyphsLength; ++glyphIndex) {
  109330. unbindGlyph(labelCollection, glyphs[glyphIndex]);
  109331. }
  109332. }
  109333. glyphs.length = textLength;
  109334. const showBackground = label._showBackground && text2.split("\n").join("").length > 0;
  109335. let backgroundBillboard = label._backgroundBillboard;
  109336. const backgroundBillboardCollection = labelCollection._backgroundBillboardCollection;
  109337. if (!showBackground) {
  109338. if (defined_default(backgroundBillboard)) {
  109339. backgroundBillboardCollection.remove(backgroundBillboard);
  109340. label._backgroundBillboard = backgroundBillboard = void 0;
  109341. }
  109342. } else {
  109343. if (!defined_default(backgroundBillboard)) {
  109344. backgroundBillboard = backgroundBillboardCollection.add({
  109345. collection: labelCollection,
  109346. image: whitePixelCanvasId,
  109347. imageSubRegion: whitePixelBoundingRegion
  109348. });
  109349. label._backgroundBillboard = backgroundBillboard;
  109350. }
  109351. backgroundBillboard.color = label._backgroundColor;
  109352. backgroundBillboard.show = label._show;
  109353. backgroundBillboard.position = label._position;
  109354. backgroundBillboard.eyeOffset = label._eyeOffset;
  109355. backgroundBillboard.pixelOffset = label._pixelOffset;
  109356. backgroundBillboard.horizontalOrigin = HorizontalOrigin_default.LEFT;
  109357. backgroundBillboard.verticalOrigin = label._verticalOrigin;
  109358. backgroundBillboard.heightReference = label._heightReference;
  109359. backgroundBillboard.scale = label.totalScale;
  109360. backgroundBillboard.pickPrimitive = label;
  109361. backgroundBillboard.id = label._id;
  109362. backgroundBillboard.translucencyByDistance = label._translucencyByDistance;
  109363. backgroundBillboard.pixelOffsetScaleByDistance = label._pixelOffsetScaleByDistance;
  109364. backgroundBillboard.scaleByDistance = label._scaleByDistance;
  109365. backgroundBillboard.distanceDisplayCondition = label._distanceDisplayCondition;
  109366. backgroundBillboard.disableDepthTestDistance = label._disableDepthTestDistance;
  109367. }
  109368. const glyphTextureCache = labelCollection._glyphTextureCache;
  109369. for (textIndex = 0; textIndex < textLength; ++textIndex) {
  109370. const character = graphemes[textIndex];
  109371. const verticalOrigin = label._verticalOrigin;
  109372. const id = JSON.stringify([
  109373. character,
  109374. label._fontFamily,
  109375. label._fontStyle,
  109376. label._fontWeight,
  109377. +verticalOrigin
  109378. ]);
  109379. let glyphTextureInfo = glyphTextureCache[id];
  109380. if (!defined_default(glyphTextureInfo)) {
  109381. const glyphFont = `${label._fontStyle} ${label._fontWeight} ${SDFSettings_default.FONT_SIZE}px ${label._fontFamily}`;
  109382. const canvas = createGlyphCanvas(
  109383. character,
  109384. glyphFont,
  109385. Color_default.WHITE,
  109386. Color_default.WHITE,
  109387. 0,
  109388. LabelStyle_default.FILL,
  109389. verticalOrigin
  109390. );
  109391. glyphTextureInfo = new GlyphTextureInfo(
  109392. labelCollection,
  109393. -1,
  109394. canvas.dimensions
  109395. );
  109396. glyphTextureCache[id] = glyphTextureInfo;
  109397. if (canvas.width > 0 && canvas.height > 0) {
  109398. const sdfValues = bitmapSdf(canvas, {
  109399. cutoff: SDFSettings_default.CUTOFF,
  109400. radius: SDFSettings_default.RADIUS
  109401. });
  109402. const ctx = canvas.getContext("2d");
  109403. const canvasWidth = canvas.width;
  109404. const canvasHeight = canvas.height;
  109405. const imgData = ctx.getImageData(0, 0, canvasWidth, canvasHeight);
  109406. for (let i2 = 0; i2 < canvasWidth; i2++) {
  109407. for (let j = 0; j < canvasHeight; j++) {
  109408. const baseIndex = j * canvasWidth + i2;
  109409. const alpha = sdfValues[baseIndex] * 255;
  109410. const imageIndex = baseIndex * 4;
  109411. imgData.data[imageIndex + 0] = alpha;
  109412. imgData.data[imageIndex + 1] = alpha;
  109413. imgData.data[imageIndex + 2] = alpha;
  109414. imgData.data[imageIndex + 3] = alpha;
  109415. }
  109416. }
  109417. ctx.putImageData(imgData, 0, 0);
  109418. if (character !== " ") {
  109419. addGlyphToTextureAtlas(
  109420. labelCollection._textureAtlas,
  109421. id,
  109422. canvas,
  109423. glyphTextureInfo
  109424. );
  109425. }
  109426. }
  109427. }
  109428. glyph = glyphs[textIndex];
  109429. if (defined_default(glyph)) {
  109430. if (glyphTextureInfo.index === -1) {
  109431. unbindGlyph(labelCollection, glyph);
  109432. } else if (defined_default(glyph.textureInfo)) {
  109433. glyph.textureInfo = void 0;
  109434. }
  109435. } else {
  109436. glyph = new Glyph();
  109437. glyphs[textIndex] = glyph;
  109438. }
  109439. glyph.textureInfo = glyphTextureInfo;
  109440. glyph.dimensions = glyphTextureInfo.dimensions;
  109441. if (glyphTextureInfo.index !== -1) {
  109442. let billboard = glyph.billboard;
  109443. const spareBillboards = labelCollection._spareBillboards;
  109444. if (!defined_default(billboard)) {
  109445. if (spareBillboards.length > 0) {
  109446. billboard = spareBillboards.pop();
  109447. } else {
  109448. billboard = labelCollection._billboardCollection.add({
  109449. collection: labelCollection
  109450. });
  109451. billboard._labelDimensions = new Cartesian2_default();
  109452. billboard._labelTranslate = new Cartesian2_default();
  109453. }
  109454. glyph.billboard = billboard;
  109455. }
  109456. billboard.show = label._show;
  109457. billboard.position = label._position;
  109458. billboard.eyeOffset = label._eyeOffset;
  109459. billboard.pixelOffset = label._pixelOffset;
  109460. billboard.horizontalOrigin = HorizontalOrigin_default.LEFT;
  109461. billboard.verticalOrigin = label._verticalOrigin;
  109462. billboard.heightReference = label._heightReference;
  109463. billboard.scale = label.totalScale;
  109464. billboard.pickPrimitive = label;
  109465. billboard.id = label._id;
  109466. billboard.image = id;
  109467. billboard.translucencyByDistance = label._translucencyByDistance;
  109468. billboard.pixelOffsetScaleByDistance = label._pixelOffsetScaleByDistance;
  109469. billboard.scaleByDistance = label._scaleByDistance;
  109470. billboard.distanceDisplayCondition = label._distanceDisplayCondition;
  109471. billboard.disableDepthTestDistance = label._disableDepthTestDistance;
  109472. billboard._batchIndex = label._batchIndex;
  109473. billboard.outlineColor = label.outlineColor;
  109474. if (label.style === LabelStyle_default.FILL_AND_OUTLINE) {
  109475. billboard.color = label._fillColor;
  109476. billboard.outlineWidth = label.outlineWidth;
  109477. } else if (label.style === LabelStyle_default.FILL) {
  109478. billboard.color = label._fillColor;
  109479. billboard.outlineWidth = 0;
  109480. } else if (label.style === LabelStyle_default.OUTLINE) {
  109481. billboard.color = Color_default.TRANSPARENT;
  109482. billboard.outlineWidth = label.outlineWidth;
  109483. }
  109484. }
  109485. }
  109486. label._repositionAllGlyphs = true;
  109487. }
  109488. function calculateWidthOffset(lineWidth, horizontalOrigin, backgroundPadding) {
  109489. if (horizontalOrigin === HorizontalOrigin_default.CENTER) {
  109490. return -lineWidth / 2;
  109491. } else if (horizontalOrigin === HorizontalOrigin_default.RIGHT) {
  109492. return -(lineWidth + backgroundPadding.x);
  109493. }
  109494. return backgroundPadding.x;
  109495. }
  109496. var glyphPixelOffset = new Cartesian2_default();
  109497. var scratchBackgroundPadding = new Cartesian2_default();
  109498. function repositionAllGlyphs2(label) {
  109499. const glyphs = label._glyphs;
  109500. const text2 = label._renderedText;
  109501. let glyph;
  109502. let dimensions;
  109503. let lastLineWidth = 0;
  109504. let maxLineWidth = 0;
  109505. const lineWidths = [];
  109506. let maxGlyphDescent = Number.NEGATIVE_INFINITY;
  109507. let maxGlyphY = 0;
  109508. let numberOfLines = 1;
  109509. let glyphIndex;
  109510. const glyphLength = glyphs.length;
  109511. const backgroundBillboard = label._backgroundBillboard;
  109512. const backgroundPadding = Cartesian2_default.clone(
  109513. defined_default(backgroundBillboard) ? label._backgroundPadding : Cartesian2_default.ZERO,
  109514. scratchBackgroundPadding
  109515. );
  109516. backgroundPadding.x /= label._relativeSize;
  109517. backgroundPadding.y /= label._relativeSize;
  109518. for (glyphIndex = 0; glyphIndex < glyphLength; ++glyphIndex) {
  109519. if (text2.charAt(glyphIndex) === "\n") {
  109520. lineWidths.push(lastLineWidth);
  109521. ++numberOfLines;
  109522. lastLineWidth = 0;
  109523. } else {
  109524. glyph = glyphs[glyphIndex];
  109525. dimensions = glyph.dimensions;
  109526. maxGlyphY = Math.max(maxGlyphY, dimensions.height - dimensions.descent);
  109527. maxGlyphDescent = Math.max(maxGlyphDescent, dimensions.descent);
  109528. lastLineWidth += dimensions.width - dimensions.minx;
  109529. if (glyphIndex < glyphLength - 1) {
  109530. lastLineWidth += glyphs[glyphIndex + 1].dimensions.minx;
  109531. }
  109532. maxLineWidth = Math.max(maxLineWidth, lastLineWidth);
  109533. }
  109534. }
  109535. lineWidths.push(lastLineWidth);
  109536. const maxLineHeight = maxGlyphY + maxGlyphDescent;
  109537. const scale = label.totalScale;
  109538. const horizontalOrigin = label._horizontalOrigin;
  109539. const verticalOrigin = label._verticalOrigin;
  109540. let lineIndex = 0;
  109541. let lineWidth = lineWidths[lineIndex];
  109542. let widthOffset = calculateWidthOffset(
  109543. lineWidth,
  109544. horizontalOrigin,
  109545. backgroundPadding
  109546. );
  109547. const lineSpacing = (defined_default(label._lineHeight) ? label._lineHeight : defaultLineSpacingPercent * label._fontSize) / label._relativeSize;
  109548. const otherLinesHeight = lineSpacing * (numberOfLines - 1);
  109549. let totalLineWidth = maxLineWidth;
  109550. let totalLineHeight = maxLineHeight + otherLinesHeight;
  109551. if (defined_default(backgroundBillboard)) {
  109552. totalLineWidth += backgroundPadding.x * 2;
  109553. totalLineHeight += backgroundPadding.y * 2;
  109554. backgroundBillboard._labelHorizontalOrigin = horizontalOrigin;
  109555. }
  109556. glyphPixelOffset.x = widthOffset * scale;
  109557. glyphPixelOffset.y = 0;
  109558. let firstCharOfLine = true;
  109559. let lineOffsetY = 0;
  109560. for (glyphIndex = 0; glyphIndex < glyphLength; ++glyphIndex) {
  109561. if (text2.charAt(glyphIndex) === "\n") {
  109562. ++lineIndex;
  109563. lineOffsetY += lineSpacing;
  109564. lineWidth = lineWidths[lineIndex];
  109565. widthOffset = calculateWidthOffset(
  109566. lineWidth,
  109567. horizontalOrigin,
  109568. backgroundPadding
  109569. );
  109570. glyphPixelOffset.x = widthOffset * scale;
  109571. firstCharOfLine = true;
  109572. } else {
  109573. glyph = glyphs[glyphIndex];
  109574. dimensions = glyph.dimensions;
  109575. if (verticalOrigin === VerticalOrigin_default.TOP) {
  109576. glyphPixelOffset.y = dimensions.height - maxGlyphY - backgroundPadding.y;
  109577. glyphPixelOffset.y += SDFSettings_default.PADDING;
  109578. } else if (verticalOrigin === VerticalOrigin_default.CENTER) {
  109579. glyphPixelOffset.y = (otherLinesHeight + dimensions.height - maxGlyphY) / 2;
  109580. } else if (verticalOrigin === VerticalOrigin_default.BASELINE) {
  109581. glyphPixelOffset.y = otherLinesHeight;
  109582. glyphPixelOffset.y -= SDFSettings_default.PADDING;
  109583. } else {
  109584. glyphPixelOffset.y = otherLinesHeight + maxGlyphDescent + backgroundPadding.y;
  109585. glyphPixelOffset.y -= SDFSettings_default.PADDING;
  109586. }
  109587. glyphPixelOffset.y = (glyphPixelOffset.y - dimensions.descent - lineOffsetY) * scale;
  109588. if (firstCharOfLine) {
  109589. glyphPixelOffset.x -= SDFSettings_default.PADDING * scale;
  109590. firstCharOfLine = false;
  109591. }
  109592. if (defined_default(glyph.billboard)) {
  109593. glyph.billboard._setTranslate(glyphPixelOffset);
  109594. glyph.billboard._labelDimensions.x = totalLineWidth;
  109595. glyph.billboard._labelDimensions.y = totalLineHeight;
  109596. glyph.billboard._labelHorizontalOrigin = horizontalOrigin;
  109597. }
  109598. if (glyphIndex < glyphLength - 1) {
  109599. const nextGlyph = glyphs[glyphIndex + 1];
  109600. glyphPixelOffset.x += (dimensions.width - dimensions.minx + nextGlyph.dimensions.minx) * scale;
  109601. }
  109602. }
  109603. }
  109604. if (defined_default(backgroundBillboard) && text2.split("\n").join("").length > 0) {
  109605. if (horizontalOrigin === HorizontalOrigin_default.CENTER) {
  109606. widthOffset = -maxLineWidth / 2 - backgroundPadding.x;
  109607. } else if (horizontalOrigin === HorizontalOrigin_default.RIGHT) {
  109608. widthOffset = -(maxLineWidth + backgroundPadding.x * 2);
  109609. } else {
  109610. widthOffset = 0;
  109611. }
  109612. glyphPixelOffset.x = widthOffset * scale;
  109613. if (verticalOrigin === VerticalOrigin_default.TOP) {
  109614. glyphPixelOffset.y = maxLineHeight - maxGlyphY - maxGlyphDescent;
  109615. } else if (verticalOrigin === VerticalOrigin_default.CENTER) {
  109616. glyphPixelOffset.y = (maxLineHeight - maxGlyphY) / 2 - maxGlyphDescent;
  109617. } else if (verticalOrigin === VerticalOrigin_default.BASELINE) {
  109618. glyphPixelOffset.y = -backgroundPadding.y - maxGlyphDescent;
  109619. } else {
  109620. glyphPixelOffset.y = 0;
  109621. }
  109622. glyphPixelOffset.y = glyphPixelOffset.y * scale;
  109623. backgroundBillboard.width = totalLineWidth;
  109624. backgroundBillboard.height = totalLineHeight;
  109625. backgroundBillboard._setTranslate(glyphPixelOffset);
  109626. backgroundBillboard._labelTranslate = Cartesian2_default.clone(
  109627. glyphPixelOffset,
  109628. backgroundBillboard._labelTranslate
  109629. );
  109630. }
  109631. if (label.heightReference === HeightReference_default.CLAMP_TO_GROUND) {
  109632. for (glyphIndex = 0; glyphIndex < glyphLength; ++glyphIndex) {
  109633. glyph = glyphs[glyphIndex];
  109634. const billboard = glyph.billboard;
  109635. if (defined_default(billboard)) {
  109636. billboard._labelTranslate = Cartesian2_default.clone(
  109637. glyphPixelOffset,
  109638. billboard._labelTranslate
  109639. );
  109640. }
  109641. }
  109642. }
  109643. }
  109644. function destroyLabel(labelCollection, label) {
  109645. const glyphs = label._glyphs;
  109646. for (let i2 = 0, len = glyphs.length; i2 < len; ++i2) {
  109647. unbindGlyph(labelCollection, glyphs[i2]);
  109648. }
  109649. if (defined_default(label._backgroundBillboard)) {
  109650. labelCollection._backgroundBillboardCollection.remove(
  109651. label._backgroundBillboard
  109652. );
  109653. label._backgroundBillboard = void 0;
  109654. }
  109655. label._labelCollection = void 0;
  109656. if (defined_default(label._removeCallbackFunc)) {
  109657. label._removeCallbackFunc();
  109658. }
  109659. destroyObject_default(label);
  109660. }
  109661. function LabelCollection(options) {
  109662. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  109663. this._scene = options.scene;
  109664. this._batchTable = options.batchTable;
  109665. this._textureAtlas = void 0;
  109666. this._backgroundTextureAtlas = void 0;
  109667. this._whitePixelIndex = void 0;
  109668. this._backgroundBillboardCollection = new BillboardCollection_default({
  109669. scene: this._scene
  109670. });
  109671. this._backgroundBillboardCollection.destroyTextureAtlas = false;
  109672. this._billboardCollection = new BillboardCollection_default({
  109673. scene: this._scene,
  109674. batchTable: this._batchTable
  109675. });
  109676. this._billboardCollection.destroyTextureAtlas = false;
  109677. this._billboardCollection._sdf = true;
  109678. this._spareBillboards = [];
  109679. this._glyphTextureCache = {};
  109680. this._labels = [];
  109681. this._labelsToUpdate = [];
  109682. this._totalGlyphCount = 0;
  109683. this._highlightColor = Color_default.clone(Color_default.WHITE);
  109684. this.show = defaultValue_default(options.show, true);
  109685. this.modelMatrix = Matrix4_default.clone(
  109686. defaultValue_default(options.modelMatrix, Matrix4_default.IDENTITY)
  109687. );
  109688. this.debugShowBoundingVolume = defaultValue_default(
  109689. options.debugShowBoundingVolume,
  109690. false
  109691. );
  109692. this.blendOption = defaultValue_default(
  109693. options.blendOption,
  109694. BlendOption_default.OPAQUE_AND_TRANSLUCENT
  109695. );
  109696. }
  109697. Object.defineProperties(LabelCollection.prototype, {
  109698. length: {
  109699. get: function() {
  109700. return this._labels.length;
  109701. }
  109702. }
  109703. });
  109704. LabelCollection.prototype.add = function(options) {
  109705. const label = new Label_default(options, this);
  109706. this._labels.push(label);
  109707. this._labelsToUpdate.push(label);
  109708. return label;
  109709. };
  109710. LabelCollection.prototype.remove = function(label) {
  109711. if (defined_default(label) && label._labelCollection === this) {
  109712. const index2 = this._labels.indexOf(label);
  109713. if (index2 !== -1) {
  109714. this._labels.splice(index2, 1);
  109715. destroyLabel(this, label);
  109716. return true;
  109717. }
  109718. }
  109719. return false;
  109720. };
  109721. LabelCollection.prototype.removeAll = function() {
  109722. const labels = this._labels;
  109723. for (let i2 = 0, len = labels.length; i2 < len; ++i2) {
  109724. destroyLabel(this, labels[i2]);
  109725. }
  109726. labels.length = 0;
  109727. };
  109728. LabelCollection.prototype.contains = function(label) {
  109729. return defined_default(label) && label._labelCollection === this;
  109730. };
  109731. LabelCollection.prototype.get = function(index2) {
  109732. if (!defined_default(index2)) {
  109733. throw new DeveloperError_default("index is required.");
  109734. }
  109735. return this._labels[index2];
  109736. };
  109737. LabelCollection.prototype.update = function(frameState) {
  109738. if (!this.show) {
  109739. return;
  109740. }
  109741. const billboardCollection = this._billboardCollection;
  109742. const backgroundBillboardCollection = this._backgroundBillboardCollection;
  109743. billboardCollection.modelMatrix = this.modelMatrix;
  109744. billboardCollection.debugShowBoundingVolume = this.debugShowBoundingVolume;
  109745. backgroundBillboardCollection.modelMatrix = this.modelMatrix;
  109746. backgroundBillboardCollection.debugShowBoundingVolume = this.debugShowBoundingVolume;
  109747. const context = frameState.context;
  109748. if (!defined_default(this._textureAtlas)) {
  109749. this._textureAtlas = new TextureAtlas_default({
  109750. context
  109751. });
  109752. billboardCollection.textureAtlas = this._textureAtlas;
  109753. }
  109754. if (!defined_default(this._backgroundTextureAtlas)) {
  109755. this._backgroundTextureAtlas = new TextureAtlas_default({
  109756. context,
  109757. initialSize: whitePixelSize
  109758. });
  109759. backgroundBillboardCollection.textureAtlas = this._backgroundTextureAtlas;
  109760. addWhitePixelCanvas(this._backgroundTextureAtlas, this);
  109761. }
  109762. const len = this._labelsToUpdate.length;
  109763. for (let i2 = 0; i2 < len; ++i2) {
  109764. const label = this._labelsToUpdate[i2];
  109765. if (label.isDestroyed()) {
  109766. continue;
  109767. }
  109768. const preUpdateGlyphCount = label._glyphs.length;
  109769. if (label._rebindAllGlyphs) {
  109770. rebindAllGlyphs2(this, label);
  109771. label._rebindAllGlyphs = false;
  109772. }
  109773. if (label._repositionAllGlyphs) {
  109774. repositionAllGlyphs2(label);
  109775. label._repositionAllGlyphs = false;
  109776. }
  109777. const glyphCountDifference = label._glyphs.length - preUpdateGlyphCount;
  109778. this._totalGlyphCount += glyphCountDifference;
  109779. }
  109780. const blendOption = backgroundBillboardCollection.length > 0 ? BlendOption_default.TRANSLUCENT : this.blendOption;
  109781. billboardCollection.blendOption = blendOption;
  109782. backgroundBillboardCollection.blendOption = blendOption;
  109783. billboardCollection._highlightColor = this._highlightColor;
  109784. backgroundBillboardCollection._highlightColor = this._highlightColor;
  109785. this._labelsToUpdate.length = 0;
  109786. backgroundBillboardCollection.update(frameState);
  109787. billboardCollection.update(frameState);
  109788. };
  109789. LabelCollection.prototype.isDestroyed = function() {
  109790. return false;
  109791. };
  109792. LabelCollection.prototype.destroy = function() {
  109793. this.removeAll();
  109794. this._billboardCollection = this._billboardCollection.destroy();
  109795. this._textureAtlas = this._textureAtlas && this._textureAtlas.destroy();
  109796. this._backgroundBillboardCollection = this._backgroundBillboardCollection.destroy();
  109797. this._backgroundTextureAtlas = this._backgroundTextureAtlas && this._backgroundTextureAtlas.destroy();
  109798. return destroyObject_default(this);
  109799. };
  109800. var LabelCollection_default = LabelCollection;
  109801. // node_modules/cesium/Source/Shaders/PolylineVS.js
  109802. var PolylineVS_default = "attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec3 position2DHigh;\nattribute vec3 position2DLow;\nattribute vec3 prevPosition3DHigh;\nattribute vec3 prevPosition3DLow;\nattribute vec3 prevPosition2DHigh;\nattribute vec3 prevPosition2DLow;\nattribute vec3 nextPosition3DHigh;\nattribute vec3 nextPosition3DLow;\nattribute vec3 nextPosition2DHigh;\nattribute vec3 nextPosition2DLow;\nattribute vec4 texCoordExpandAndBatchIndex;\n\nvarying vec2 v_st;\nvarying float v_width;\nvarying vec4 v_pickColor;\nvarying float v_polylineAngle;\n\nvoid main()\n{\n float texCoord = texCoordExpandAndBatchIndex.x;\n float expandDir = texCoordExpandAndBatchIndex.y;\n bool usePrev = texCoordExpandAndBatchIndex.z < 0.0;\n float batchTableIndex = texCoordExpandAndBatchIndex.w;\n\n vec2 widthAndShow = batchTable_getWidthAndShow(batchTableIndex);\n float width = widthAndShow.x + 0.5;\n float show = widthAndShow.y;\n\n if (width < 1.0)\n {\n show = 0.0;\n }\n\n vec4 pickColor = batchTable_getPickColor(batchTableIndex);\n\n vec4 p, prev, next;\n if (czm_morphTime == 1.0)\n {\n p = czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz);\n prev = czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz);\n next = czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz);\n }\n else if (czm_morphTime == 0.0)\n {\n p = czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);\n prev = czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy);\n next = czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy);\n }\n else\n {\n p = czm_columbusViewMorph(\n czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy),\n czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz),\n czm_morphTime);\n prev = czm_columbusViewMorph(\n czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy),\n czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz),\n czm_morphTime);\n next = czm_columbusViewMorph(\n czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy),\n czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz),\n czm_morphTime);\n }\n\n #ifdef DISTANCE_DISPLAY_CONDITION\n vec3 centerHigh = batchTable_getCenterHigh(batchTableIndex);\n vec4 centerLowAndRadius = batchTable_getCenterLowAndRadius(batchTableIndex);\n vec3 centerLow = centerLowAndRadius.xyz;\n float radius = centerLowAndRadius.w;\n vec2 distanceDisplayCondition = batchTable_getDistanceDisplayCondition(batchTableIndex);\n\n float lengthSq;\n if (czm_sceneMode == czm_sceneMode2D)\n {\n lengthSq = czm_eyeHeight2D.y;\n }\n else\n {\n vec4 center = czm_translateRelativeToEye(centerHigh.xyz, centerLow.xyz);\n lengthSq = max(0.0, dot(center.xyz, center.xyz) - radius * radius);\n }\n\n float nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x;\n float farSq = distanceDisplayCondition.y * distanceDisplayCondition.y;\n if (lengthSq < nearSq || lengthSq > farSq)\n {\n show = 0.0;\n }\n #endif\n\n float polylineAngle;\n vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, polylineAngle);\n gl_Position = czm_viewportOrthographic * positionWC * show;\n\n v_st.s = texCoord;\n v_st.t = czm_writeNonPerspective(clamp(expandDir, 0.0, 1.0), gl_Position.w);\n\n v_width = width;\n v_pickColor = pickColor;\n v_polylineAngle = polylineAngle;\n}\n";
  109803. // node_modules/cesium/Source/Scene/Polyline.js
  109804. function Polyline(options, polylineCollection) {
  109805. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  109806. this._show = defaultValue_default(options.show, true);
  109807. this._width = defaultValue_default(options.width, 1);
  109808. this._loop = defaultValue_default(options.loop, false);
  109809. this._distanceDisplayCondition = options.distanceDisplayCondition;
  109810. this._material = options.material;
  109811. if (!defined_default(this._material)) {
  109812. this._material = Material_default.fromType(Material_default.ColorType, {
  109813. color: new Color_default(1, 1, 1, 1)
  109814. });
  109815. }
  109816. let positions = options.positions;
  109817. if (!defined_default(positions)) {
  109818. positions = [];
  109819. }
  109820. this._positions = positions;
  109821. this._actualPositions = arrayRemoveDuplicates_default(
  109822. positions,
  109823. Cartesian3_default.equalsEpsilon
  109824. );
  109825. if (this._loop && this._actualPositions.length > 2) {
  109826. if (this._actualPositions === this._positions) {
  109827. this._actualPositions = positions.slice();
  109828. }
  109829. this._actualPositions.push(Cartesian3_default.clone(this._actualPositions[0]));
  109830. }
  109831. this._length = this._actualPositions.length;
  109832. this._id = options.id;
  109833. let modelMatrix;
  109834. if (defined_default(polylineCollection)) {
  109835. modelMatrix = Matrix4_default.clone(polylineCollection.modelMatrix);
  109836. }
  109837. this._modelMatrix = modelMatrix;
  109838. this._segments = PolylinePipeline_default.wrapLongitude(
  109839. this._actualPositions,
  109840. modelMatrix
  109841. );
  109842. this._actualLength = void 0;
  109843. this._propertiesChanged = new Uint32Array(NUMBER_OF_PROPERTIES2);
  109844. this._polylineCollection = polylineCollection;
  109845. this._dirty = false;
  109846. this._pickId = void 0;
  109847. this._boundingVolume = BoundingSphere_default.fromPoints(this._actualPositions);
  109848. this._boundingVolumeWC = BoundingSphere_default.transform(
  109849. this._boundingVolume,
  109850. this._modelMatrix
  109851. );
  109852. this._boundingVolume2D = new BoundingSphere_default();
  109853. }
  109854. var POSITION_INDEX3 = Polyline.POSITION_INDEX = 0;
  109855. var SHOW_INDEX3 = Polyline.SHOW_INDEX = 1;
  109856. var WIDTH_INDEX = Polyline.WIDTH_INDEX = 2;
  109857. var MATERIAL_INDEX = Polyline.MATERIAL_INDEX = 3;
  109858. var POSITION_SIZE_INDEX = Polyline.POSITION_SIZE_INDEX = 4;
  109859. var DISTANCE_DISPLAY_CONDITION2 = Polyline.DISTANCE_DISPLAY_CONDITION = 5;
  109860. var NUMBER_OF_PROPERTIES2 = Polyline.NUMBER_OF_PROPERTIES = 6;
  109861. function makeDirty2(polyline, propertyChanged) {
  109862. ++polyline._propertiesChanged[propertyChanged];
  109863. const polylineCollection = polyline._polylineCollection;
  109864. if (defined_default(polylineCollection)) {
  109865. polylineCollection._updatePolyline(polyline, propertyChanged);
  109866. polyline._dirty = true;
  109867. }
  109868. }
  109869. Object.defineProperties(Polyline.prototype, {
  109870. show: {
  109871. get: function() {
  109872. return this._show;
  109873. },
  109874. set: function(value) {
  109875. if (!defined_default(value)) {
  109876. throw new DeveloperError_default("value is required.");
  109877. }
  109878. if (value !== this._show) {
  109879. this._show = value;
  109880. makeDirty2(this, SHOW_INDEX3);
  109881. }
  109882. }
  109883. },
  109884. positions: {
  109885. get: function() {
  109886. return this._positions;
  109887. },
  109888. set: function(value) {
  109889. if (!defined_default(value)) {
  109890. throw new DeveloperError_default("value is required.");
  109891. }
  109892. let positions = arrayRemoveDuplicates_default(value, Cartesian3_default.equalsEpsilon);
  109893. if (this._loop && positions.length > 2) {
  109894. if (positions === value) {
  109895. positions = value.slice();
  109896. }
  109897. positions.push(Cartesian3_default.clone(positions[0]));
  109898. }
  109899. if (this._actualPositions.length !== positions.length || this._actualPositions.length !== this._length) {
  109900. makeDirty2(this, POSITION_SIZE_INDEX);
  109901. }
  109902. this._positions = value;
  109903. this._actualPositions = positions;
  109904. this._length = positions.length;
  109905. this._boundingVolume = BoundingSphere_default.fromPoints(
  109906. this._actualPositions,
  109907. this._boundingVolume
  109908. );
  109909. this._boundingVolumeWC = BoundingSphere_default.transform(
  109910. this._boundingVolume,
  109911. this._modelMatrix,
  109912. this._boundingVolumeWC
  109913. );
  109914. makeDirty2(this, POSITION_INDEX3);
  109915. this.update();
  109916. }
  109917. },
  109918. material: {
  109919. get: function() {
  109920. return this._material;
  109921. },
  109922. set: function(material) {
  109923. if (!defined_default(material)) {
  109924. throw new DeveloperError_default("material is required.");
  109925. }
  109926. if (this._material !== material) {
  109927. this._material = material;
  109928. makeDirty2(this, MATERIAL_INDEX);
  109929. }
  109930. }
  109931. },
  109932. width: {
  109933. get: function() {
  109934. return this._width;
  109935. },
  109936. set: function(value) {
  109937. if (!defined_default(value)) {
  109938. throw new DeveloperError_default("value is required.");
  109939. }
  109940. const width = this._width;
  109941. if (value !== width) {
  109942. this._width = value;
  109943. makeDirty2(this, WIDTH_INDEX);
  109944. }
  109945. }
  109946. },
  109947. loop: {
  109948. get: function() {
  109949. return this._loop;
  109950. },
  109951. set: function(value) {
  109952. if (!defined_default(value)) {
  109953. throw new DeveloperError_default("value is required.");
  109954. }
  109955. if (value !== this._loop) {
  109956. let positions = this._actualPositions;
  109957. if (value) {
  109958. if (positions.length > 2 && !Cartesian3_default.equals(positions[0], positions[positions.length - 1])) {
  109959. if (positions.length === this._positions.length) {
  109960. this._actualPositions = positions = this._positions.slice();
  109961. }
  109962. positions.push(Cartesian3_default.clone(positions[0]));
  109963. }
  109964. } else if (positions.length > 2 && Cartesian3_default.equals(positions[0], positions[positions.length - 1])) {
  109965. if (positions.length - 1 === this._positions.length) {
  109966. this._actualPositions = this._positions;
  109967. } else {
  109968. positions.pop();
  109969. }
  109970. }
  109971. this._loop = value;
  109972. makeDirty2(this, POSITION_SIZE_INDEX);
  109973. }
  109974. }
  109975. },
  109976. id: {
  109977. get: function() {
  109978. return this._id;
  109979. },
  109980. set: function(value) {
  109981. this._id = value;
  109982. if (defined_default(this._pickId)) {
  109983. this._pickId.object.id = value;
  109984. }
  109985. }
  109986. },
  109987. pickId: {
  109988. get: function() {
  109989. return this._pickId;
  109990. }
  109991. },
  109992. isDestroyed: {
  109993. get: function() {
  109994. return !defined_default(this._polylineCollection);
  109995. }
  109996. },
  109997. distanceDisplayCondition: {
  109998. get: function() {
  109999. return this._distanceDisplayCondition;
  110000. },
  110001. set: function(value) {
  110002. if (defined_default(value) && value.far <= value.near) {
  110003. throw new DeveloperError_default(
  110004. "far distance must be greater than near distance."
  110005. );
  110006. }
  110007. if (!DistanceDisplayCondition_default.equals(value, this._distanceDisplayCondition)) {
  110008. this._distanceDisplayCondition = DistanceDisplayCondition_default.clone(
  110009. value,
  110010. this._distanceDisplayCondition
  110011. );
  110012. makeDirty2(this, DISTANCE_DISPLAY_CONDITION2);
  110013. }
  110014. }
  110015. }
  110016. });
  110017. Polyline.prototype.update = function() {
  110018. let modelMatrix = Matrix4_default.IDENTITY;
  110019. if (defined_default(this._polylineCollection)) {
  110020. modelMatrix = this._polylineCollection.modelMatrix;
  110021. }
  110022. const segmentPositionsLength = this._segments.positions.length;
  110023. const segmentLengths = this._segments.lengths;
  110024. const positionsChanged = this._propertiesChanged[POSITION_INDEX3] > 0 || this._propertiesChanged[POSITION_SIZE_INDEX] > 0;
  110025. if (!Matrix4_default.equals(modelMatrix, this._modelMatrix) || positionsChanged) {
  110026. this._segments = PolylinePipeline_default.wrapLongitude(
  110027. this._actualPositions,
  110028. modelMatrix
  110029. );
  110030. this._boundingVolumeWC = BoundingSphere_default.transform(
  110031. this._boundingVolume,
  110032. modelMatrix,
  110033. this._boundingVolumeWC
  110034. );
  110035. }
  110036. this._modelMatrix = Matrix4_default.clone(modelMatrix, this._modelMatrix);
  110037. if (this._segments.positions.length !== segmentPositionsLength) {
  110038. makeDirty2(this, POSITION_SIZE_INDEX);
  110039. } else {
  110040. const length3 = segmentLengths.length;
  110041. for (let i2 = 0; i2 < length3; ++i2) {
  110042. if (segmentLengths[i2] !== this._segments.lengths[i2]) {
  110043. makeDirty2(this, POSITION_SIZE_INDEX);
  110044. break;
  110045. }
  110046. }
  110047. }
  110048. };
  110049. Polyline.prototype.getPickId = function(context) {
  110050. if (!defined_default(this._pickId)) {
  110051. this._pickId = context.createPickId({
  110052. primitive: this,
  110053. collection: this._polylineCollection,
  110054. id: this._id
  110055. });
  110056. }
  110057. return this._pickId;
  110058. };
  110059. Polyline.prototype._clean = function() {
  110060. this._dirty = false;
  110061. const properties = this._propertiesChanged;
  110062. for (let k = 0; k < NUMBER_OF_PROPERTIES2 - 1; ++k) {
  110063. properties[k] = 0;
  110064. }
  110065. };
  110066. Polyline.prototype._destroy = function() {
  110067. this._pickId = this._pickId && this._pickId.destroy();
  110068. this._material = this._material && this._material.destroy();
  110069. this._polylineCollection = void 0;
  110070. };
  110071. var Polyline_default = Polyline;
  110072. // node_modules/cesium/Source/Scene/PolylineCollection.js
  110073. var SHOW_INDEX4 = Polyline_default.SHOW_INDEX;
  110074. var WIDTH_INDEX2 = Polyline_default.WIDTH_INDEX;
  110075. var POSITION_INDEX4 = Polyline_default.POSITION_INDEX;
  110076. var MATERIAL_INDEX2 = Polyline_default.MATERIAL_INDEX;
  110077. var POSITION_SIZE_INDEX2 = Polyline_default.POSITION_SIZE_INDEX;
  110078. var DISTANCE_DISPLAY_CONDITION3 = Polyline_default.DISTANCE_DISPLAY_CONDITION;
  110079. var NUMBER_OF_PROPERTIES3 = Polyline_default.NUMBER_OF_PROPERTIES;
  110080. var attributeLocations2 = {
  110081. texCoordExpandAndBatchIndex: 0,
  110082. position3DHigh: 1,
  110083. position3DLow: 2,
  110084. position2DHigh: 3,
  110085. position2DLow: 4,
  110086. prevPosition3DHigh: 5,
  110087. prevPosition3DLow: 6,
  110088. prevPosition2DHigh: 7,
  110089. prevPosition2DLow: 8,
  110090. nextPosition3DHigh: 9,
  110091. nextPosition3DLow: 10,
  110092. nextPosition2DHigh: 11,
  110093. nextPosition2DLow: 12
  110094. };
  110095. function PolylineCollection(options) {
  110096. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  110097. this.show = defaultValue_default(options.show, true);
  110098. this.modelMatrix = Matrix4_default.clone(
  110099. defaultValue_default(options.modelMatrix, Matrix4_default.IDENTITY)
  110100. );
  110101. this._modelMatrix = Matrix4_default.clone(Matrix4_default.IDENTITY);
  110102. this.debugShowBoundingVolume = defaultValue_default(
  110103. options.debugShowBoundingVolume,
  110104. false
  110105. );
  110106. this._opaqueRS = void 0;
  110107. this._translucentRS = void 0;
  110108. this._colorCommands = [];
  110109. this._polylinesUpdated = false;
  110110. this._polylinesRemoved = false;
  110111. this._createVertexArray = false;
  110112. this._propertiesChanged = new Uint32Array(NUMBER_OF_PROPERTIES3);
  110113. this._polylines = [];
  110114. this._polylineBuckets = {};
  110115. this._positionBufferUsage = {
  110116. bufferUsage: BufferUsage_default.STATIC_DRAW,
  110117. frameCount: 0
  110118. };
  110119. this._mode = void 0;
  110120. this._polylinesToUpdate = [];
  110121. this._vertexArrays = [];
  110122. this._positionBuffer = void 0;
  110123. this._texCoordExpandAndBatchIndexBuffer = void 0;
  110124. this._batchTable = void 0;
  110125. this._createBatchTable = false;
  110126. this._useHighlightColor = false;
  110127. this._highlightColor = Color_default.clone(Color_default.WHITE);
  110128. const that = this;
  110129. this._uniformMap = {
  110130. u_highlightColor: function() {
  110131. return that._highlightColor;
  110132. }
  110133. };
  110134. }
  110135. Object.defineProperties(PolylineCollection.prototype, {
  110136. length: {
  110137. get: function() {
  110138. removePolylines(this);
  110139. return this._polylines.length;
  110140. }
  110141. }
  110142. });
  110143. PolylineCollection.prototype.add = function(options) {
  110144. const p2 = new Polyline_default(options, this);
  110145. p2._index = this._polylines.length;
  110146. this._polylines.push(p2);
  110147. this._createVertexArray = true;
  110148. this._createBatchTable = true;
  110149. return p2;
  110150. };
  110151. PolylineCollection.prototype.remove = function(polyline) {
  110152. if (this.contains(polyline)) {
  110153. this._polylinesRemoved = true;
  110154. this._createVertexArray = true;
  110155. this._createBatchTable = true;
  110156. if (defined_default(polyline._bucket)) {
  110157. const bucket = polyline._bucket;
  110158. bucket.shaderProgram = bucket.shaderProgram && bucket.shaderProgram.destroy();
  110159. }
  110160. polyline._destroy();
  110161. return true;
  110162. }
  110163. return false;
  110164. };
  110165. PolylineCollection.prototype.removeAll = function() {
  110166. releaseShaders(this);
  110167. destroyPolylines(this);
  110168. this._polylineBuckets = {};
  110169. this._polylinesRemoved = false;
  110170. this._polylines.length = 0;
  110171. this._polylinesToUpdate.length = 0;
  110172. this._createVertexArray = true;
  110173. };
  110174. PolylineCollection.prototype.contains = function(polyline) {
  110175. return defined_default(polyline) && polyline._polylineCollection === this;
  110176. };
  110177. PolylineCollection.prototype.get = function(index2) {
  110178. if (!defined_default(index2)) {
  110179. throw new DeveloperError_default("index is required.");
  110180. }
  110181. removePolylines(this);
  110182. return this._polylines[index2];
  110183. };
  110184. function createBatchTable2(collection, context) {
  110185. if (defined_default(collection._batchTable)) {
  110186. collection._batchTable.destroy();
  110187. }
  110188. const attributes = [
  110189. {
  110190. functionName: "batchTable_getWidthAndShow",
  110191. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  110192. componentsPerAttribute: 2
  110193. },
  110194. {
  110195. functionName: "batchTable_getPickColor",
  110196. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  110197. componentsPerAttribute: 4,
  110198. normalize: true
  110199. },
  110200. {
  110201. functionName: "batchTable_getCenterHigh",
  110202. componentDatatype: ComponentDatatype_default.FLOAT,
  110203. componentsPerAttribute: 3
  110204. },
  110205. {
  110206. functionName: "batchTable_getCenterLowAndRadius",
  110207. componentDatatype: ComponentDatatype_default.FLOAT,
  110208. componentsPerAttribute: 4
  110209. },
  110210. {
  110211. functionName: "batchTable_getDistanceDisplayCondition",
  110212. componentDatatype: ComponentDatatype_default.FLOAT,
  110213. componentsPerAttribute: 2
  110214. }
  110215. ];
  110216. collection._batchTable = new BatchTable_default(
  110217. context,
  110218. attributes,
  110219. collection._polylines.length
  110220. );
  110221. }
  110222. var scratchUpdatePolylineEncodedCartesian = new EncodedCartesian3_default();
  110223. var scratchUpdatePolylineCartesian4 = new Cartesian4_default();
  110224. var scratchNearFarCartesian2 = new Cartesian2_default();
  110225. PolylineCollection.prototype.update = function(frameState) {
  110226. removePolylines(this);
  110227. if (this._polylines.length === 0 || !this.show) {
  110228. return;
  110229. }
  110230. updateMode2(this, frameState);
  110231. const context = frameState.context;
  110232. const projection = frameState.mapProjection;
  110233. let polyline;
  110234. let properties = this._propertiesChanged;
  110235. if (this._createBatchTable) {
  110236. if (ContextLimits_default.maximumVertexTextureImageUnits === 0) {
  110237. throw new RuntimeError_default(
  110238. "Vertex texture fetch support is required to render polylines. The maximum number of vertex texture image units must be greater than zero."
  110239. );
  110240. }
  110241. createBatchTable2(this, context);
  110242. this._createBatchTable = false;
  110243. }
  110244. if (this._createVertexArray || computeNewBuffersUsage(this)) {
  110245. createVertexArrays2(this, context, projection);
  110246. } else if (this._polylinesUpdated) {
  110247. const polylinesToUpdate = this._polylinesToUpdate;
  110248. if (this._mode !== SceneMode_default.SCENE3D) {
  110249. const updateLength = polylinesToUpdate.length;
  110250. for (let i2 = 0; i2 < updateLength; ++i2) {
  110251. polyline = polylinesToUpdate[i2];
  110252. polyline.update();
  110253. }
  110254. }
  110255. if (properties[POSITION_SIZE_INDEX2] || properties[MATERIAL_INDEX2]) {
  110256. createVertexArrays2(this, context, projection);
  110257. } else {
  110258. const length3 = polylinesToUpdate.length;
  110259. const polylineBuckets = this._polylineBuckets;
  110260. for (let ii = 0; ii < length3; ++ii) {
  110261. polyline = polylinesToUpdate[ii];
  110262. properties = polyline._propertiesChanged;
  110263. const bucket = polyline._bucket;
  110264. let index2 = 0;
  110265. for (const x in polylineBuckets) {
  110266. if (polylineBuckets.hasOwnProperty(x)) {
  110267. if (polylineBuckets[x] === bucket) {
  110268. if (properties[POSITION_INDEX4]) {
  110269. bucket.writeUpdate(
  110270. index2,
  110271. polyline,
  110272. this._positionBuffer,
  110273. projection
  110274. );
  110275. }
  110276. break;
  110277. }
  110278. index2 += polylineBuckets[x].lengthOfPositions;
  110279. }
  110280. }
  110281. if (properties[SHOW_INDEX4] || properties[WIDTH_INDEX2]) {
  110282. this._batchTable.setBatchedAttribute(
  110283. polyline._index,
  110284. 0,
  110285. new Cartesian2_default(polyline._width, polyline._show)
  110286. );
  110287. }
  110288. if (this._batchTable.attributes.length > 2) {
  110289. if (properties[POSITION_INDEX4] || properties[POSITION_SIZE_INDEX2]) {
  110290. const boundingSphere = frameState.mode === SceneMode_default.SCENE2D ? polyline._boundingVolume2D : polyline._boundingVolumeWC;
  110291. const encodedCenter = EncodedCartesian3_default.fromCartesian(
  110292. boundingSphere.center,
  110293. scratchUpdatePolylineEncodedCartesian
  110294. );
  110295. const low = Cartesian4_default.fromElements(
  110296. encodedCenter.low.x,
  110297. encodedCenter.low.y,
  110298. encodedCenter.low.z,
  110299. boundingSphere.radius,
  110300. scratchUpdatePolylineCartesian4
  110301. );
  110302. this._batchTable.setBatchedAttribute(
  110303. polyline._index,
  110304. 2,
  110305. encodedCenter.high
  110306. );
  110307. this._batchTable.setBatchedAttribute(polyline._index, 3, low);
  110308. }
  110309. if (properties[DISTANCE_DISPLAY_CONDITION3]) {
  110310. const nearFarCartesian = scratchNearFarCartesian2;
  110311. nearFarCartesian.x = 0;
  110312. nearFarCartesian.y = Number.MAX_VALUE;
  110313. const distanceDisplayCondition = polyline.distanceDisplayCondition;
  110314. if (defined_default(distanceDisplayCondition)) {
  110315. nearFarCartesian.x = distanceDisplayCondition.near;
  110316. nearFarCartesian.y = distanceDisplayCondition.far;
  110317. }
  110318. this._batchTable.setBatchedAttribute(
  110319. polyline._index,
  110320. 4,
  110321. nearFarCartesian
  110322. );
  110323. }
  110324. }
  110325. polyline._clean();
  110326. }
  110327. }
  110328. polylinesToUpdate.length = 0;
  110329. this._polylinesUpdated = false;
  110330. }
  110331. properties = this._propertiesChanged;
  110332. for (let k = 0; k < NUMBER_OF_PROPERTIES3; ++k) {
  110333. properties[k] = 0;
  110334. }
  110335. let modelMatrix = Matrix4_default.IDENTITY;
  110336. if (frameState.mode === SceneMode_default.SCENE3D) {
  110337. modelMatrix = this.modelMatrix;
  110338. }
  110339. const pass = frameState.passes;
  110340. const useDepthTest = frameState.morphTime !== 0;
  110341. if (!defined_default(this._opaqueRS) || this._opaqueRS.depthTest.enabled !== useDepthTest) {
  110342. this._opaqueRS = RenderState_default.fromCache({
  110343. depthMask: useDepthTest,
  110344. depthTest: {
  110345. enabled: useDepthTest
  110346. }
  110347. });
  110348. }
  110349. if (!defined_default(this._translucentRS) || this._translucentRS.depthTest.enabled !== useDepthTest) {
  110350. this._translucentRS = RenderState_default.fromCache({
  110351. blending: BlendingState_default.ALPHA_BLEND,
  110352. depthMask: !useDepthTest,
  110353. depthTest: {
  110354. enabled: useDepthTest
  110355. }
  110356. });
  110357. }
  110358. this._batchTable.update(frameState);
  110359. if (pass.render || pass.pick) {
  110360. const colorList = this._colorCommands;
  110361. createCommandLists(this, frameState, colorList, modelMatrix);
  110362. }
  110363. };
  110364. var boundingSphereScratch = new BoundingSphere_default();
  110365. var boundingSphereScratch2 = new BoundingSphere_default();
  110366. function createCommandLists(polylineCollection, frameState, commands, modelMatrix) {
  110367. const context = frameState.context;
  110368. const commandList = frameState.commandList;
  110369. const commandsLength = commands.length;
  110370. let commandIndex = 0;
  110371. let cloneBoundingSphere = true;
  110372. const vertexArrays = polylineCollection._vertexArrays;
  110373. const debugShowBoundingVolume2 = polylineCollection.debugShowBoundingVolume;
  110374. const batchTable = polylineCollection._batchTable;
  110375. const uniformCallback = batchTable.getUniformMapCallback();
  110376. const length3 = vertexArrays.length;
  110377. for (let m = 0; m < length3; ++m) {
  110378. const va = vertexArrays[m];
  110379. const buckets = va.buckets;
  110380. const bucketLength = buckets.length;
  110381. for (let n2 = 0; n2 < bucketLength; ++n2) {
  110382. const bucketLocator = buckets[n2];
  110383. let offset2 = bucketLocator.offset;
  110384. const sp = bucketLocator.bucket.shaderProgram;
  110385. const polylines = bucketLocator.bucket.polylines;
  110386. const polylineLength = polylines.length;
  110387. let currentId2;
  110388. let currentMaterial;
  110389. let count = 0;
  110390. let command;
  110391. let uniformMap2;
  110392. for (let s2 = 0; s2 < polylineLength; ++s2) {
  110393. const polyline = polylines[s2];
  110394. const mId = createMaterialId(polyline._material);
  110395. if (mId !== currentId2) {
  110396. if (defined_default(currentId2) && count > 0) {
  110397. const translucent = currentMaterial.isTranslucent();
  110398. if (commandIndex >= commandsLength) {
  110399. command = new DrawCommand_default({
  110400. owner: polylineCollection
  110401. });
  110402. commands.push(command);
  110403. } else {
  110404. command = commands[commandIndex];
  110405. }
  110406. ++commandIndex;
  110407. uniformMap2 = combine_default(
  110408. uniformCallback(currentMaterial._uniforms),
  110409. polylineCollection._uniformMap
  110410. );
  110411. command.boundingVolume = BoundingSphere_default.clone(
  110412. boundingSphereScratch,
  110413. command.boundingVolume
  110414. );
  110415. command.modelMatrix = modelMatrix;
  110416. command.shaderProgram = sp;
  110417. command.vertexArray = va.va;
  110418. command.renderState = translucent ? polylineCollection._translucentRS : polylineCollection._opaqueRS;
  110419. command.pass = translucent ? Pass_default.TRANSLUCENT : Pass_default.OPAQUE;
  110420. command.debugShowBoundingVolume = debugShowBoundingVolume2;
  110421. command.pickId = "v_pickColor";
  110422. command.uniformMap = uniformMap2;
  110423. command.count = count;
  110424. command.offset = offset2;
  110425. offset2 += count;
  110426. count = 0;
  110427. cloneBoundingSphere = true;
  110428. commandList.push(command);
  110429. }
  110430. currentMaterial = polyline._material;
  110431. currentMaterial.update(context);
  110432. currentId2 = mId;
  110433. }
  110434. const locators = polyline._locatorBuckets;
  110435. const locatorLength = locators.length;
  110436. for (let t = 0; t < locatorLength; ++t) {
  110437. const locator = locators[t];
  110438. if (locator.locator === bucketLocator) {
  110439. count += locator.count;
  110440. }
  110441. }
  110442. let boundingVolume;
  110443. if (frameState.mode === SceneMode_default.SCENE3D) {
  110444. boundingVolume = polyline._boundingVolumeWC;
  110445. } else if (frameState.mode === SceneMode_default.COLUMBUS_VIEW) {
  110446. boundingVolume = polyline._boundingVolume2D;
  110447. } else if (frameState.mode === SceneMode_default.SCENE2D) {
  110448. if (defined_default(polyline._boundingVolume2D)) {
  110449. boundingVolume = BoundingSphere_default.clone(
  110450. polyline._boundingVolume2D,
  110451. boundingSphereScratch2
  110452. );
  110453. boundingVolume.center.x = 0;
  110454. }
  110455. } else if (defined_default(polyline._boundingVolumeWC) && defined_default(polyline._boundingVolume2D)) {
  110456. boundingVolume = BoundingSphere_default.union(
  110457. polyline._boundingVolumeWC,
  110458. polyline._boundingVolume2D,
  110459. boundingSphereScratch2
  110460. );
  110461. }
  110462. if (cloneBoundingSphere) {
  110463. cloneBoundingSphere = false;
  110464. BoundingSphere_default.clone(boundingVolume, boundingSphereScratch);
  110465. } else {
  110466. BoundingSphere_default.union(
  110467. boundingVolume,
  110468. boundingSphereScratch,
  110469. boundingSphereScratch
  110470. );
  110471. }
  110472. }
  110473. if (defined_default(currentId2) && count > 0) {
  110474. if (commandIndex >= commandsLength) {
  110475. command = new DrawCommand_default({
  110476. owner: polylineCollection
  110477. });
  110478. commands.push(command);
  110479. } else {
  110480. command = commands[commandIndex];
  110481. }
  110482. ++commandIndex;
  110483. uniformMap2 = combine_default(
  110484. uniformCallback(currentMaterial._uniforms),
  110485. polylineCollection._uniformMap
  110486. );
  110487. command.boundingVolume = BoundingSphere_default.clone(
  110488. boundingSphereScratch,
  110489. command.boundingVolume
  110490. );
  110491. command.modelMatrix = modelMatrix;
  110492. command.shaderProgram = sp;
  110493. command.vertexArray = va.va;
  110494. command.renderState = currentMaterial.isTranslucent() ? polylineCollection._translucentRS : polylineCollection._opaqueRS;
  110495. command.pass = currentMaterial.isTranslucent() ? Pass_default.TRANSLUCENT : Pass_default.OPAQUE;
  110496. command.debugShowBoundingVolume = debugShowBoundingVolume2;
  110497. command.pickId = "v_pickColor";
  110498. command.uniformMap = uniformMap2;
  110499. command.count = count;
  110500. command.offset = offset2;
  110501. cloneBoundingSphere = true;
  110502. commandList.push(command);
  110503. }
  110504. currentId2 = void 0;
  110505. }
  110506. }
  110507. commands.length = commandIndex;
  110508. }
  110509. PolylineCollection.prototype.isDestroyed = function() {
  110510. return false;
  110511. };
  110512. PolylineCollection.prototype.destroy = function() {
  110513. destroyVertexArrays(this);
  110514. releaseShaders(this);
  110515. destroyPolylines(this);
  110516. this._batchTable = this._batchTable && this._batchTable.destroy();
  110517. return destroyObject_default(this);
  110518. };
  110519. function computeNewBuffersUsage(collection) {
  110520. let usageChanged = false;
  110521. const properties = collection._propertiesChanged;
  110522. const bufferUsage = collection._positionBufferUsage;
  110523. if (properties[POSITION_INDEX4]) {
  110524. if (bufferUsage.bufferUsage !== BufferUsage_default.STREAM_DRAW) {
  110525. usageChanged = true;
  110526. bufferUsage.bufferUsage = BufferUsage_default.STREAM_DRAW;
  110527. bufferUsage.frameCount = 100;
  110528. } else {
  110529. bufferUsage.frameCount = 100;
  110530. }
  110531. } else if (bufferUsage.bufferUsage !== BufferUsage_default.STATIC_DRAW) {
  110532. if (bufferUsage.frameCount === 0) {
  110533. usageChanged = true;
  110534. bufferUsage.bufferUsage = BufferUsage_default.STATIC_DRAW;
  110535. } else {
  110536. bufferUsage.frameCount--;
  110537. }
  110538. }
  110539. return usageChanged;
  110540. }
  110541. var emptyVertexBuffer = [0, 0, 0];
  110542. function createVertexArrays2(collection, context, projection) {
  110543. collection._createVertexArray = false;
  110544. releaseShaders(collection);
  110545. destroyVertexArrays(collection);
  110546. sortPolylinesIntoBuckets(collection);
  110547. const totalIndices = [[]];
  110548. let indices2 = totalIndices[0];
  110549. const batchTable = collection._batchTable;
  110550. const useHighlightColor = collection._useHighlightColor;
  110551. const vertexBufferOffset = [0];
  110552. let offset2 = 0;
  110553. const vertexArrayBuckets = [[]];
  110554. let totalLength = 0;
  110555. const polylineBuckets = collection._polylineBuckets;
  110556. let x;
  110557. let bucket;
  110558. for (x in polylineBuckets) {
  110559. if (polylineBuckets.hasOwnProperty(x)) {
  110560. bucket = polylineBuckets[x];
  110561. bucket.updateShader(context, batchTable, useHighlightColor);
  110562. totalLength += bucket.lengthOfPositions;
  110563. }
  110564. }
  110565. if (totalLength > 0) {
  110566. const mode2 = collection._mode;
  110567. const positionArray = new Float32Array(6 * totalLength * 3);
  110568. const texCoordExpandAndBatchIndexArray = new Float32Array(totalLength * 4);
  110569. let position3DArray;
  110570. let positionIndex = 0;
  110571. let colorIndex = 0;
  110572. let texCoordExpandAndBatchIndexIndex = 0;
  110573. for (x in polylineBuckets) {
  110574. if (polylineBuckets.hasOwnProperty(x)) {
  110575. bucket = polylineBuckets[x];
  110576. bucket.write(
  110577. positionArray,
  110578. texCoordExpandAndBatchIndexArray,
  110579. positionIndex,
  110580. colorIndex,
  110581. texCoordExpandAndBatchIndexIndex,
  110582. batchTable,
  110583. context,
  110584. projection
  110585. );
  110586. if (mode2 === SceneMode_default.MORPHING) {
  110587. if (!defined_default(position3DArray)) {
  110588. position3DArray = new Float32Array(6 * totalLength * 3);
  110589. }
  110590. bucket.writeForMorph(position3DArray, positionIndex);
  110591. }
  110592. const bucketLength = bucket.lengthOfPositions;
  110593. positionIndex += 6 * bucketLength * 3;
  110594. colorIndex += bucketLength * 4;
  110595. texCoordExpandAndBatchIndexIndex += bucketLength * 4;
  110596. offset2 = bucket.updateIndices(
  110597. totalIndices,
  110598. vertexBufferOffset,
  110599. vertexArrayBuckets,
  110600. offset2
  110601. );
  110602. }
  110603. }
  110604. const positionBufferUsage = collection._positionBufferUsage.bufferUsage;
  110605. const texCoordExpandAndBatchIndexBufferUsage = BufferUsage_default.STATIC_DRAW;
  110606. collection._positionBuffer = Buffer_default.createVertexBuffer({
  110607. context,
  110608. typedArray: positionArray,
  110609. usage: positionBufferUsage
  110610. });
  110611. let position3DBuffer;
  110612. if (defined_default(position3DArray)) {
  110613. position3DBuffer = Buffer_default.createVertexBuffer({
  110614. context,
  110615. typedArray: position3DArray,
  110616. usage: positionBufferUsage
  110617. });
  110618. }
  110619. collection._texCoordExpandAndBatchIndexBuffer = Buffer_default.createVertexBuffer({
  110620. context,
  110621. typedArray: texCoordExpandAndBatchIndexArray,
  110622. usage: texCoordExpandAndBatchIndexBufferUsage
  110623. });
  110624. const positionSizeInBytes = 3 * Float32Array.BYTES_PER_ELEMENT;
  110625. const texCoordExpandAndBatchIndexSizeInBytes = 4 * Float32Array.BYTES_PER_ELEMENT;
  110626. let vbo = 0;
  110627. const numberOfIndicesArrays = totalIndices.length;
  110628. for (let k = 0; k < numberOfIndicesArrays; ++k) {
  110629. indices2 = totalIndices[k];
  110630. if (indices2.length > 0) {
  110631. const indicesArray = new Uint16Array(indices2);
  110632. const indexBuffer = Buffer_default.createIndexBuffer({
  110633. context,
  110634. typedArray: indicesArray,
  110635. usage: BufferUsage_default.STATIC_DRAW,
  110636. indexDatatype: IndexDatatype_default.UNSIGNED_SHORT
  110637. });
  110638. vbo += vertexBufferOffset[k];
  110639. const positionHighOffset = 6 * (k * (positionSizeInBytes * Math_default.SIXTY_FOUR_KILOBYTES) - vbo * positionSizeInBytes);
  110640. const positionLowOffset = positionSizeInBytes + positionHighOffset;
  110641. const prevPositionHighOffset = positionSizeInBytes + positionLowOffset;
  110642. const prevPositionLowOffset = positionSizeInBytes + prevPositionHighOffset;
  110643. const nextPositionHighOffset = positionSizeInBytes + prevPositionLowOffset;
  110644. const nextPositionLowOffset = positionSizeInBytes + nextPositionHighOffset;
  110645. const vertexTexCoordExpandAndBatchIndexBufferOffset = k * (texCoordExpandAndBatchIndexSizeInBytes * Math_default.SIXTY_FOUR_KILOBYTES) - vbo * texCoordExpandAndBatchIndexSizeInBytes;
  110646. const attributes = [
  110647. {
  110648. index: attributeLocations2.position3DHigh,
  110649. componentsPerAttribute: 3,
  110650. componentDatatype: ComponentDatatype_default.FLOAT,
  110651. offsetInBytes: positionHighOffset,
  110652. strideInBytes: 6 * positionSizeInBytes
  110653. },
  110654. {
  110655. index: attributeLocations2.position3DLow,
  110656. componentsPerAttribute: 3,
  110657. componentDatatype: ComponentDatatype_default.FLOAT,
  110658. offsetInBytes: positionLowOffset,
  110659. strideInBytes: 6 * positionSizeInBytes
  110660. },
  110661. {
  110662. index: attributeLocations2.position2DHigh,
  110663. componentsPerAttribute: 3,
  110664. componentDatatype: ComponentDatatype_default.FLOAT,
  110665. offsetInBytes: positionHighOffset,
  110666. strideInBytes: 6 * positionSizeInBytes
  110667. },
  110668. {
  110669. index: attributeLocations2.position2DLow,
  110670. componentsPerAttribute: 3,
  110671. componentDatatype: ComponentDatatype_default.FLOAT,
  110672. offsetInBytes: positionLowOffset,
  110673. strideInBytes: 6 * positionSizeInBytes
  110674. },
  110675. {
  110676. index: attributeLocations2.prevPosition3DHigh,
  110677. componentsPerAttribute: 3,
  110678. componentDatatype: ComponentDatatype_default.FLOAT,
  110679. offsetInBytes: prevPositionHighOffset,
  110680. strideInBytes: 6 * positionSizeInBytes
  110681. },
  110682. {
  110683. index: attributeLocations2.prevPosition3DLow,
  110684. componentsPerAttribute: 3,
  110685. componentDatatype: ComponentDatatype_default.FLOAT,
  110686. offsetInBytes: prevPositionLowOffset,
  110687. strideInBytes: 6 * positionSizeInBytes
  110688. },
  110689. {
  110690. index: attributeLocations2.prevPosition2DHigh,
  110691. componentsPerAttribute: 3,
  110692. componentDatatype: ComponentDatatype_default.FLOAT,
  110693. offsetInBytes: prevPositionHighOffset,
  110694. strideInBytes: 6 * positionSizeInBytes
  110695. },
  110696. {
  110697. index: attributeLocations2.prevPosition2DLow,
  110698. componentsPerAttribute: 3,
  110699. componentDatatype: ComponentDatatype_default.FLOAT,
  110700. offsetInBytes: prevPositionLowOffset,
  110701. strideInBytes: 6 * positionSizeInBytes
  110702. },
  110703. {
  110704. index: attributeLocations2.nextPosition3DHigh,
  110705. componentsPerAttribute: 3,
  110706. componentDatatype: ComponentDatatype_default.FLOAT,
  110707. offsetInBytes: nextPositionHighOffset,
  110708. strideInBytes: 6 * positionSizeInBytes
  110709. },
  110710. {
  110711. index: attributeLocations2.nextPosition3DLow,
  110712. componentsPerAttribute: 3,
  110713. componentDatatype: ComponentDatatype_default.FLOAT,
  110714. offsetInBytes: nextPositionLowOffset,
  110715. strideInBytes: 6 * positionSizeInBytes
  110716. },
  110717. {
  110718. index: attributeLocations2.nextPosition2DHigh,
  110719. componentsPerAttribute: 3,
  110720. componentDatatype: ComponentDatatype_default.FLOAT,
  110721. offsetInBytes: nextPositionHighOffset,
  110722. strideInBytes: 6 * positionSizeInBytes
  110723. },
  110724. {
  110725. index: attributeLocations2.nextPosition2DLow,
  110726. componentsPerAttribute: 3,
  110727. componentDatatype: ComponentDatatype_default.FLOAT,
  110728. offsetInBytes: nextPositionLowOffset,
  110729. strideInBytes: 6 * positionSizeInBytes
  110730. },
  110731. {
  110732. index: attributeLocations2.texCoordExpandAndBatchIndex,
  110733. componentsPerAttribute: 4,
  110734. componentDatatype: ComponentDatatype_default.FLOAT,
  110735. vertexBuffer: collection._texCoordExpandAndBatchIndexBuffer,
  110736. offsetInBytes: vertexTexCoordExpandAndBatchIndexBufferOffset
  110737. }
  110738. ];
  110739. let bufferProperty3D;
  110740. let buffer3D;
  110741. let buffer2D;
  110742. let bufferProperty2D;
  110743. if (mode2 === SceneMode_default.SCENE3D) {
  110744. buffer3D = collection._positionBuffer;
  110745. bufferProperty3D = "vertexBuffer";
  110746. buffer2D = emptyVertexBuffer;
  110747. bufferProperty2D = "value";
  110748. } else if (mode2 === SceneMode_default.SCENE2D || mode2 === SceneMode_default.COLUMBUS_VIEW) {
  110749. buffer3D = emptyVertexBuffer;
  110750. bufferProperty3D = "value";
  110751. buffer2D = collection._positionBuffer;
  110752. bufferProperty2D = "vertexBuffer";
  110753. } else {
  110754. buffer3D = position3DBuffer;
  110755. bufferProperty3D = "vertexBuffer";
  110756. buffer2D = collection._positionBuffer;
  110757. bufferProperty2D = "vertexBuffer";
  110758. }
  110759. attributes[0][bufferProperty3D] = buffer3D;
  110760. attributes[1][bufferProperty3D] = buffer3D;
  110761. attributes[2][bufferProperty2D] = buffer2D;
  110762. attributes[3][bufferProperty2D] = buffer2D;
  110763. attributes[4][bufferProperty3D] = buffer3D;
  110764. attributes[5][bufferProperty3D] = buffer3D;
  110765. attributes[6][bufferProperty2D] = buffer2D;
  110766. attributes[7][bufferProperty2D] = buffer2D;
  110767. attributes[8][bufferProperty3D] = buffer3D;
  110768. attributes[9][bufferProperty3D] = buffer3D;
  110769. attributes[10][bufferProperty2D] = buffer2D;
  110770. attributes[11][bufferProperty2D] = buffer2D;
  110771. const va = new VertexArray_default({
  110772. context,
  110773. attributes,
  110774. indexBuffer
  110775. });
  110776. collection._vertexArrays.push({
  110777. va,
  110778. buckets: vertexArrayBuckets[k]
  110779. });
  110780. }
  110781. }
  110782. }
  110783. }
  110784. function replacer(key, value) {
  110785. if (value instanceof Texture_default) {
  110786. return value.id;
  110787. }
  110788. return value;
  110789. }
  110790. var scratchUniformArray2 = [];
  110791. function createMaterialId(material) {
  110792. const uniforms = Material_default._uniformList[material.type];
  110793. const length3 = uniforms.length;
  110794. scratchUniformArray2.length = 2 * length3;
  110795. let index2 = 0;
  110796. for (let i2 = 0; i2 < length3; ++i2) {
  110797. const uniform = uniforms[i2];
  110798. scratchUniformArray2[index2] = uniform;
  110799. scratchUniformArray2[index2 + 1] = material._uniforms[uniform]();
  110800. index2 += 2;
  110801. }
  110802. return `${material.type}:${JSON.stringify(scratchUniformArray2, replacer)}`;
  110803. }
  110804. function sortPolylinesIntoBuckets(collection) {
  110805. const mode2 = collection._mode;
  110806. const modelMatrix = collection._modelMatrix;
  110807. const polylineBuckets = collection._polylineBuckets = {};
  110808. const polylines = collection._polylines;
  110809. const length3 = polylines.length;
  110810. for (let i2 = 0; i2 < length3; ++i2) {
  110811. const p2 = polylines[i2];
  110812. if (p2._actualPositions.length > 1) {
  110813. p2.update();
  110814. const material = p2.material;
  110815. let value = polylineBuckets[material.type];
  110816. if (!defined_default(value)) {
  110817. value = polylineBuckets[material.type] = new PolylineBucket(
  110818. material,
  110819. mode2,
  110820. modelMatrix
  110821. );
  110822. }
  110823. value.addPolyline(p2);
  110824. }
  110825. }
  110826. }
  110827. function updateMode2(collection, frameState) {
  110828. const mode2 = frameState.mode;
  110829. if (collection._mode !== mode2 || !Matrix4_default.equals(collection._modelMatrix, collection.modelMatrix)) {
  110830. collection._mode = mode2;
  110831. collection._modelMatrix = Matrix4_default.clone(collection.modelMatrix);
  110832. collection._createVertexArray = true;
  110833. }
  110834. }
  110835. function removePolylines(collection) {
  110836. if (collection._polylinesRemoved) {
  110837. collection._polylinesRemoved = false;
  110838. const definedPolylines = [];
  110839. const definedPolylinesToUpdate = [];
  110840. let polyIndex = 0;
  110841. let polyline;
  110842. const length3 = collection._polylines.length;
  110843. for (let i2 = 0; i2 < length3; ++i2) {
  110844. polyline = collection._polylines[i2];
  110845. if (!polyline.isDestroyed) {
  110846. polyline._index = polyIndex++;
  110847. definedPolylinesToUpdate.push(polyline);
  110848. definedPolylines.push(polyline);
  110849. }
  110850. }
  110851. collection._polylines = definedPolylines;
  110852. collection._polylinesToUpdate = definedPolylinesToUpdate;
  110853. }
  110854. }
  110855. function releaseShaders(collection) {
  110856. const polylines = collection._polylines;
  110857. const length3 = polylines.length;
  110858. for (let i2 = 0; i2 < length3; ++i2) {
  110859. if (!polylines[i2].isDestroyed) {
  110860. const bucket = polylines[i2]._bucket;
  110861. if (defined_default(bucket)) {
  110862. bucket.shaderProgram = bucket.shaderProgram && bucket.shaderProgram.destroy();
  110863. }
  110864. }
  110865. }
  110866. }
  110867. function destroyVertexArrays(collection) {
  110868. const length3 = collection._vertexArrays.length;
  110869. for (let t = 0; t < length3; ++t) {
  110870. collection._vertexArrays[t].va.destroy();
  110871. }
  110872. collection._vertexArrays.length = 0;
  110873. }
  110874. PolylineCollection.prototype._updatePolyline = function(polyline, propertyChanged) {
  110875. this._polylinesUpdated = true;
  110876. if (!polyline._dirty) {
  110877. this._polylinesToUpdate.push(polyline);
  110878. }
  110879. ++this._propertiesChanged[propertyChanged];
  110880. };
  110881. function destroyPolylines(collection) {
  110882. const polylines = collection._polylines;
  110883. const length3 = polylines.length;
  110884. for (let i2 = 0; i2 < length3; ++i2) {
  110885. if (!polylines[i2].isDestroyed) {
  110886. polylines[i2]._destroy();
  110887. }
  110888. }
  110889. }
  110890. function VertexArrayBucketLocator(count, offset2, bucket) {
  110891. this.count = count;
  110892. this.offset = offset2;
  110893. this.bucket = bucket;
  110894. }
  110895. function PolylineBucket(material, mode2, modelMatrix) {
  110896. this.polylines = [];
  110897. this.lengthOfPositions = 0;
  110898. this.material = material;
  110899. this.shaderProgram = void 0;
  110900. this.mode = mode2;
  110901. this.modelMatrix = modelMatrix;
  110902. }
  110903. PolylineBucket.prototype.addPolyline = function(p2) {
  110904. const polylines = this.polylines;
  110905. polylines.push(p2);
  110906. p2._actualLength = this.getPolylinePositionsLength(p2);
  110907. this.lengthOfPositions += p2._actualLength;
  110908. p2._bucket = this;
  110909. };
  110910. PolylineBucket.prototype.updateShader = function(context, batchTable, useHighlightColor) {
  110911. if (defined_default(this.shaderProgram)) {
  110912. return;
  110913. }
  110914. const defines = ["DISTANCE_DISPLAY_CONDITION"];
  110915. if (useHighlightColor) {
  110916. defines.push("VECTOR_TILE");
  110917. }
  110918. if (this.material.shaderSource.search(/varying\s+float\s+v_polylineAngle;/g) !== -1) {
  110919. defines.push("POLYLINE_DASH");
  110920. }
  110921. if (!FeatureDetection_default.isInternetExplorer()) {
  110922. defines.push("CLIP_POLYLINE");
  110923. }
  110924. const fs = new ShaderSource_default({
  110925. defines,
  110926. sources: [
  110927. "varying vec4 v_pickColor;\n",
  110928. this.material.shaderSource,
  110929. PolylineFS_default
  110930. ]
  110931. });
  110932. const vsSource = batchTable.getVertexShaderCallback()(PolylineVS_default);
  110933. const vs = new ShaderSource_default({
  110934. defines,
  110935. sources: [PolylineCommon_default, vsSource]
  110936. });
  110937. this.shaderProgram = ShaderProgram_default.fromCache({
  110938. context,
  110939. vertexShaderSource: vs,
  110940. fragmentShaderSource: fs,
  110941. attributeLocations: attributeLocations2
  110942. });
  110943. };
  110944. function intersectsIDL(polyline) {
  110945. return Cartesian3_default.dot(Cartesian3_default.UNIT_X, polyline._boundingVolume.center) < 0 || polyline._boundingVolume.intersectPlane(Plane_default.ORIGIN_ZX_PLANE) === Intersect_default.INTERSECTING;
  110946. }
  110947. PolylineBucket.prototype.getPolylinePositionsLength = function(polyline) {
  110948. let length3;
  110949. if (this.mode === SceneMode_default.SCENE3D || !intersectsIDL(polyline)) {
  110950. length3 = polyline._actualPositions.length;
  110951. return length3 * 4 - 4;
  110952. }
  110953. let count = 0;
  110954. const segmentLengths = polyline._segments.lengths;
  110955. length3 = segmentLengths.length;
  110956. for (let i2 = 0; i2 < length3; ++i2) {
  110957. count += segmentLengths[i2] * 4 - 4;
  110958. }
  110959. return count;
  110960. };
  110961. var scratchWritePosition = new Cartesian3_default();
  110962. var scratchWritePrevPosition = new Cartesian3_default();
  110963. var scratchWriteNextPosition = new Cartesian3_default();
  110964. var scratchWriteVector = new Cartesian3_default();
  110965. var scratchPickColorCartesian = new Cartesian4_default();
  110966. var scratchWidthShowCartesian = new Cartesian2_default();
  110967. PolylineBucket.prototype.write = function(positionArray, texCoordExpandAndBatchIndexArray, positionIndex, colorIndex, texCoordExpandAndBatchIndexIndex, batchTable, context, projection) {
  110968. const mode2 = this.mode;
  110969. const maxLon = projection.ellipsoid.maximumRadius * Math_default.PI;
  110970. const polylines = this.polylines;
  110971. const length3 = polylines.length;
  110972. for (let i2 = 0; i2 < length3; ++i2) {
  110973. const polyline = polylines[i2];
  110974. const width = polyline.width;
  110975. const show = polyline.show && width > 0;
  110976. const polylineBatchIndex = polyline._index;
  110977. const segments = this.getSegments(polyline, projection);
  110978. const positions = segments.positions;
  110979. const lengths = segments.lengths;
  110980. const positionsLength = positions.length;
  110981. const pickColor = polyline.getPickId(context).color;
  110982. let segmentIndex = 0;
  110983. let count = 0;
  110984. let position;
  110985. for (let j = 0; j < positionsLength; ++j) {
  110986. if (j === 0) {
  110987. if (polyline._loop) {
  110988. position = positions[positionsLength - 2];
  110989. } else {
  110990. position = scratchWriteVector;
  110991. Cartesian3_default.subtract(positions[0], positions[1], position);
  110992. Cartesian3_default.add(positions[0], position, position);
  110993. }
  110994. } else {
  110995. position = positions[j - 1];
  110996. }
  110997. Cartesian3_default.clone(position, scratchWritePrevPosition);
  110998. Cartesian3_default.clone(positions[j], scratchWritePosition);
  110999. if (j === positionsLength - 1) {
  111000. if (polyline._loop) {
  111001. position = positions[1];
  111002. } else {
  111003. position = scratchWriteVector;
  111004. Cartesian3_default.subtract(
  111005. positions[positionsLength - 1],
  111006. positions[positionsLength - 2],
  111007. position
  111008. );
  111009. Cartesian3_default.add(positions[positionsLength - 1], position, position);
  111010. }
  111011. } else {
  111012. position = positions[j + 1];
  111013. }
  111014. Cartesian3_default.clone(position, scratchWriteNextPosition);
  111015. const segmentLength = lengths[segmentIndex];
  111016. if (j === count + segmentLength) {
  111017. count += segmentLength;
  111018. ++segmentIndex;
  111019. }
  111020. const segmentStart = j - count === 0;
  111021. const segmentEnd = j === count + lengths[segmentIndex] - 1;
  111022. if (mode2 === SceneMode_default.SCENE2D) {
  111023. scratchWritePrevPosition.z = 0;
  111024. scratchWritePosition.z = 0;
  111025. scratchWriteNextPosition.z = 0;
  111026. }
  111027. if (mode2 === SceneMode_default.SCENE2D || mode2 === SceneMode_default.MORPHING) {
  111028. if ((segmentStart || segmentEnd) && maxLon - Math.abs(scratchWritePosition.x) < 1) {
  111029. if (scratchWritePosition.x < 0 && scratchWritePrevPosition.x > 0 || scratchWritePosition.x > 0 && scratchWritePrevPosition.x < 0) {
  111030. Cartesian3_default.clone(scratchWritePosition, scratchWritePrevPosition);
  111031. }
  111032. if (scratchWritePosition.x < 0 && scratchWriteNextPosition.x > 0 || scratchWritePosition.x > 0 && scratchWriteNextPosition.x < 0) {
  111033. Cartesian3_default.clone(scratchWritePosition, scratchWriteNextPosition);
  111034. }
  111035. }
  111036. }
  111037. const startK = segmentStart ? 2 : 0;
  111038. const endK = segmentEnd ? 2 : 4;
  111039. for (let k = startK; k < endK; ++k) {
  111040. EncodedCartesian3_default.writeElements(
  111041. scratchWritePosition,
  111042. positionArray,
  111043. positionIndex
  111044. );
  111045. EncodedCartesian3_default.writeElements(
  111046. scratchWritePrevPosition,
  111047. positionArray,
  111048. positionIndex + 6
  111049. );
  111050. EncodedCartesian3_default.writeElements(
  111051. scratchWriteNextPosition,
  111052. positionArray,
  111053. positionIndex + 12
  111054. );
  111055. const direction2 = k - 2 < 0 ? -1 : 1;
  111056. texCoordExpandAndBatchIndexArray[texCoordExpandAndBatchIndexIndex] = j / (positionsLength - 1);
  111057. texCoordExpandAndBatchIndexArray[texCoordExpandAndBatchIndexIndex + 1] = 2 * (k % 2) - 1;
  111058. texCoordExpandAndBatchIndexArray[texCoordExpandAndBatchIndexIndex + 2] = direction2;
  111059. texCoordExpandAndBatchIndexArray[texCoordExpandAndBatchIndexIndex + 3] = polylineBatchIndex;
  111060. positionIndex += 6 * 3;
  111061. texCoordExpandAndBatchIndexIndex += 4;
  111062. }
  111063. }
  111064. const colorCartesian = scratchPickColorCartesian;
  111065. colorCartesian.x = Color_default.floatToByte(pickColor.red);
  111066. colorCartesian.y = Color_default.floatToByte(pickColor.green);
  111067. colorCartesian.z = Color_default.floatToByte(pickColor.blue);
  111068. colorCartesian.w = Color_default.floatToByte(pickColor.alpha);
  111069. const widthShowCartesian = scratchWidthShowCartesian;
  111070. widthShowCartesian.x = width;
  111071. widthShowCartesian.y = show ? 1 : 0;
  111072. const boundingSphere = mode2 === SceneMode_default.SCENE2D ? polyline._boundingVolume2D : polyline._boundingVolumeWC;
  111073. const encodedCenter = EncodedCartesian3_default.fromCartesian(
  111074. boundingSphere.center,
  111075. scratchUpdatePolylineEncodedCartesian
  111076. );
  111077. const high = encodedCenter.high;
  111078. const low = Cartesian4_default.fromElements(
  111079. encodedCenter.low.x,
  111080. encodedCenter.low.y,
  111081. encodedCenter.low.z,
  111082. boundingSphere.radius,
  111083. scratchUpdatePolylineCartesian4
  111084. );
  111085. const nearFarCartesian = scratchNearFarCartesian2;
  111086. nearFarCartesian.x = 0;
  111087. nearFarCartesian.y = Number.MAX_VALUE;
  111088. const distanceDisplayCondition = polyline.distanceDisplayCondition;
  111089. if (defined_default(distanceDisplayCondition)) {
  111090. nearFarCartesian.x = distanceDisplayCondition.near;
  111091. nearFarCartesian.y = distanceDisplayCondition.far;
  111092. }
  111093. batchTable.setBatchedAttribute(polylineBatchIndex, 0, widthShowCartesian);
  111094. batchTable.setBatchedAttribute(polylineBatchIndex, 1, colorCartesian);
  111095. if (batchTable.attributes.length > 2) {
  111096. batchTable.setBatchedAttribute(polylineBatchIndex, 2, high);
  111097. batchTable.setBatchedAttribute(polylineBatchIndex, 3, low);
  111098. batchTable.setBatchedAttribute(polylineBatchIndex, 4, nearFarCartesian);
  111099. }
  111100. }
  111101. };
  111102. var morphPositionScratch = new Cartesian3_default();
  111103. var morphPrevPositionScratch = new Cartesian3_default();
  111104. var morphNextPositionScratch = new Cartesian3_default();
  111105. var morphVectorScratch = new Cartesian3_default();
  111106. PolylineBucket.prototype.writeForMorph = function(positionArray, positionIndex) {
  111107. const modelMatrix = this.modelMatrix;
  111108. const polylines = this.polylines;
  111109. const length3 = polylines.length;
  111110. for (let i2 = 0; i2 < length3; ++i2) {
  111111. const polyline = polylines[i2];
  111112. const positions = polyline._segments.positions;
  111113. const lengths = polyline._segments.lengths;
  111114. const positionsLength = positions.length;
  111115. let segmentIndex = 0;
  111116. let count = 0;
  111117. for (let j = 0; j < positionsLength; ++j) {
  111118. let prevPosition;
  111119. if (j === 0) {
  111120. if (polyline._loop) {
  111121. prevPosition = positions[positionsLength - 2];
  111122. } else {
  111123. prevPosition = morphVectorScratch;
  111124. Cartesian3_default.subtract(positions[0], positions[1], prevPosition);
  111125. Cartesian3_default.add(positions[0], prevPosition, prevPosition);
  111126. }
  111127. } else {
  111128. prevPosition = positions[j - 1];
  111129. }
  111130. prevPosition = Matrix4_default.multiplyByPoint(
  111131. modelMatrix,
  111132. prevPosition,
  111133. morphPrevPositionScratch
  111134. );
  111135. const position = Matrix4_default.multiplyByPoint(
  111136. modelMatrix,
  111137. positions[j],
  111138. morphPositionScratch
  111139. );
  111140. let nextPosition;
  111141. if (j === positionsLength - 1) {
  111142. if (polyline._loop) {
  111143. nextPosition = positions[1];
  111144. } else {
  111145. nextPosition = morphVectorScratch;
  111146. Cartesian3_default.subtract(
  111147. positions[positionsLength - 1],
  111148. positions[positionsLength - 2],
  111149. nextPosition
  111150. );
  111151. Cartesian3_default.add(
  111152. positions[positionsLength - 1],
  111153. nextPosition,
  111154. nextPosition
  111155. );
  111156. }
  111157. } else {
  111158. nextPosition = positions[j + 1];
  111159. }
  111160. nextPosition = Matrix4_default.multiplyByPoint(
  111161. modelMatrix,
  111162. nextPosition,
  111163. morphNextPositionScratch
  111164. );
  111165. const segmentLength = lengths[segmentIndex];
  111166. if (j === count + segmentLength) {
  111167. count += segmentLength;
  111168. ++segmentIndex;
  111169. }
  111170. const segmentStart = j - count === 0;
  111171. const segmentEnd = j === count + lengths[segmentIndex] - 1;
  111172. const startK = segmentStart ? 2 : 0;
  111173. const endK = segmentEnd ? 2 : 4;
  111174. for (let k = startK; k < endK; ++k) {
  111175. EncodedCartesian3_default.writeElements(position, positionArray, positionIndex);
  111176. EncodedCartesian3_default.writeElements(
  111177. prevPosition,
  111178. positionArray,
  111179. positionIndex + 6
  111180. );
  111181. EncodedCartesian3_default.writeElements(
  111182. nextPosition,
  111183. positionArray,
  111184. positionIndex + 12
  111185. );
  111186. positionIndex += 6 * 3;
  111187. }
  111188. }
  111189. }
  111190. };
  111191. var scratchSegmentLengths = new Array(1);
  111192. PolylineBucket.prototype.updateIndices = function(totalIndices, vertexBufferOffset, vertexArrayBuckets, offset2) {
  111193. let vaCount = vertexArrayBuckets.length - 1;
  111194. let bucketLocator = new VertexArrayBucketLocator(0, offset2, this);
  111195. vertexArrayBuckets[vaCount].push(bucketLocator);
  111196. let count = 0;
  111197. let indices2 = totalIndices[totalIndices.length - 1];
  111198. let indicesCount = 0;
  111199. if (indices2.length > 0) {
  111200. indicesCount = indices2[indices2.length - 1] + 1;
  111201. }
  111202. const polylines = this.polylines;
  111203. const length3 = polylines.length;
  111204. for (let i2 = 0; i2 < length3; ++i2) {
  111205. const polyline = polylines[i2];
  111206. polyline._locatorBuckets = [];
  111207. let segments;
  111208. if (this.mode === SceneMode_default.SCENE3D) {
  111209. segments = scratchSegmentLengths;
  111210. const positionsLength = polyline._actualPositions.length;
  111211. if (positionsLength > 0) {
  111212. segments[0] = positionsLength;
  111213. } else {
  111214. continue;
  111215. }
  111216. } else {
  111217. segments = polyline._segments.lengths;
  111218. }
  111219. const numberOfSegments = segments.length;
  111220. if (numberOfSegments > 0) {
  111221. let segmentIndexCount = 0;
  111222. for (let j = 0; j < numberOfSegments; ++j) {
  111223. const segmentLength = segments[j] - 1;
  111224. for (let k = 0; k < segmentLength; ++k) {
  111225. if (indicesCount + 4 > Math_default.SIXTY_FOUR_KILOBYTES) {
  111226. polyline._locatorBuckets.push({
  111227. locator: bucketLocator,
  111228. count: segmentIndexCount
  111229. });
  111230. segmentIndexCount = 0;
  111231. vertexBufferOffset.push(4);
  111232. indices2 = [];
  111233. totalIndices.push(indices2);
  111234. indicesCount = 0;
  111235. bucketLocator.count = count;
  111236. count = 0;
  111237. offset2 = 0;
  111238. bucketLocator = new VertexArrayBucketLocator(0, 0, this);
  111239. vertexArrayBuckets[++vaCount] = [bucketLocator];
  111240. }
  111241. indices2.push(indicesCount, indicesCount + 2, indicesCount + 1);
  111242. indices2.push(indicesCount + 1, indicesCount + 2, indicesCount + 3);
  111243. segmentIndexCount += 6;
  111244. count += 6;
  111245. offset2 += 6;
  111246. indicesCount += 4;
  111247. }
  111248. }
  111249. polyline._locatorBuckets.push({
  111250. locator: bucketLocator,
  111251. count: segmentIndexCount
  111252. });
  111253. if (indicesCount + 4 > Math_default.SIXTY_FOUR_KILOBYTES) {
  111254. vertexBufferOffset.push(0);
  111255. indices2 = [];
  111256. totalIndices.push(indices2);
  111257. indicesCount = 0;
  111258. bucketLocator.count = count;
  111259. offset2 = 0;
  111260. count = 0;
  111261. bucketLocator = new VertexArrayBucketLocator(0, 0, this);
  111262. vertexArrayBuckets[++vaCount] = [bucketLocator];
  111263. }
  111264. }
  111265. polyline._clean();
  111266. }
  111267. bucketLocator.count = count;
  111268. return offset2;
  111269. };
  111270. PolylineBucket.prototype.getPolylineStartIndex = function(polyline) {
  111271. const polylines = this.polylines;
  111272. let positionIndex = 0;
  111273. const length3 = polylines.length;
  111274. for (let i2 = 0; i2 < length3; ++i2) {
  111275. const p2 = polylines[i2];
  111276. if (p2 === polyline) {
  111277. break;
  111278. }
  111279. positionIndex += p2._actualLength;
  111280. }
  111281. return positionIndex;
  111282. };
  111283. var scratchSegments = {
  111284. positions: void 0,
  111285. lengths: void 0
  111286. };
  111287. var scratchLengths = new Array(1);
  111288. var pscratch = new Cartesian3_default();
  111289. var scratchCartographic8 = new Cartographic_default();
  111290. PolylineBucket.prototype.getSegments = function(polyline, projection) {
  111291. let positions = polyline._actualPositions;
  111292. if (this.mode === SceneMode_default.SCENE3D) {
  111293. scratchLengths[0] = positions.length;
  111294. scratchSegments.positions = positions;
  111295. scratchSegments.lengths = scratchLengths;
  111296. return scratchSegments;
  111297. }
  111298. if (intersectsIDL(polyline)) {
  111299. positions = polyline._segments.positions;
  111300. }
  111301. const ellipsoid = projection.ellipsoid;
  111302. const newPositions = [];
  111303. const modelMatrix = this.modelMatrix;
  111304. const length3 = positions.length;
  111305. let position;
  111306. let p2 = pscratch;
  111307. for (let n2 = 0; n2 < length3; ++n2) {
  111308. position = positions[n2];
  111309. p2 = Matrix4_default.multiplyByPoint(modelMatrix, position, p2);
  111310. newPositions.push(
  111311. projection.project(
  111312. ellipsoid.cartesianToCartographic(p2, scratchCartographic8)
  111313. )
  111314. );
  111315. }
  111316. if (newPositions.length > 0) {
  111317. polyline._boundingVolume2D = BoundingSphere_default.fromPoints(
  111318. newPositions,
  111319. polyline._boundingVolume2D
  111320. );
  111321. const center2D = polyline._boundingVolume2D.center;
  111322. polyline._boundingVolume2D.center = new Cartesian3_default(
  111323. center2D.z,
  111324. center2D.x,
  111325. center2D.y
  111326. );
  111327. }
  111328. scratchSegments.positions = newPositions;
  111329. scratchSegments.lengths = polyline._segments.lengths;
  111330. return scratchSegments;
  111331. };
  111332. var scratchPositionsArray;
  111333. PolylineBucket.prototype.writeUpdate = function(index2, polyline, positionBuffer, projection) {
  111334. const mode2 = this.mode;
  111335. const maxLon = projection.ellipsoid.maximumRadius * Math_default.PI;
  111336. let positionsLength = polyline._actualLength;
  111337. if (positionsLength) {
  111338. index2 += this.getPolylineStartIndex(polyline);
  111339. let positionArray = scratchPositionsArray;
  111340. const positionsArrayLength = 6 * positionsLength * 3;
  111341. if (!defined_default(positionArray) || positionArray.length < positionsArrayLength) {
  111342. positionArray = scratchPositionsArray = new Float32Array(
  111343. positionsArrayLength
  111344. );
  111345. } else if (positionArray.length > positionsArrayLength) {
  111346. positionArray = new Float32Array(
  111347. positionArray.buffer,
  111348. 0,
  111349. positionsArrayLength
  111350. );
  111351. }
  111352. const segments = this.getSegments(polyline, projection);
  111353. const positions = segments.positions;
  111354. const lengths = segments.lengths;
  111355. let positionIndex = 0;
  111356. let segmentIndex = 0;
  111357. let count = 0;
  111358. let position;
  111359. positionsLength = positions.length;
  111360. for (let i2 = 0; i2 < positionsLength; ++i2) {
  111361. if (i2 === 0) {
  111362. if (polyline._loop) {
  111363. position = positions[positionsLength - 2];
  111364. } else {
  111365. position = scratchWriteVector;
  111366. Cartesian3_default.subtract(positions[0], positions[1], position);
  111367. Cartesian3_default.add(positions[0], position, position);
  111368. }
  111369. } else {
  111370. position = positions[i2 - 1];
  111371. }
  111372. Cartesian3_default.clone(position, scratchWritePrevPosition);
  111373. Cartesian3_default.clone(positions[i2], scratchWritePosition);
  111374. if (i2 === positionsLength - 1) {
  111375. if (polyline._loop) {
  111376. position = positions[1];
  111377. } else {
  111378. position = scratchWriteVector;
  111379. Cartesian3_default.subtract(
  111380. positions[positionsLength - 1],
  111381. positions[positionsLength - 2],
  111382. position
  111383. );
  111384. Cartesian3_default.add(positions[positionsLength - 1], position, position);
  111385. }
  111386. } else {
  111387. position = positions[i2 + 1];
  111388. }
  111389. Cartesian3_default.clone(position, scratchWriteNextPosition);
  111390. const segmentLength = lengths[segmentIndex];
  111391. if (i2 === count + segmentLength) {
  111392. count += segmentLength;
  111393. ++segmentIndex;
  111394. }
  111395. const segmentStart = i2 - count === 0;
  111396. const segmentEnd = i2 === count + lengths[segmentIndex] - 1;
  111397. if (mode2 === SceneMode_default.SCENE2D) {
  111398. scratchWritePrevPosition.z = 0;
  111399. scratchWritePosition.z = 0;
  111400. scratchWriteNextPosition.z = 0;
  111401. }
  111402. if (mode2 === SceneMode_default.SCENE2D || mode2 === SceneMode_default.MORPHING) {
  111403. if ((segmentStart || segmentEnd) && maxLon - Math.abs(scratchWritePosition.x) < 1) {
  111404. if (scratchWritePosition.x < 0 && scratchWritePrevPosition.x > 0 || scratchWritePosition.x > 0 && scratchWritePrevPosition.x < 0) {
  111405. Cartesian3_default.clone(scratchWritePosition, scratchWritePrevPosition);
  111406. }
  111407. if (scratchWritePosition.x < 0 && scratchWriteNextPosition.x > 0 || scratchWritePosition.x > 0 && scratchWriteNextPosition.x < 0) {
  111408. Cartesian3_default.clone(scratchWritePosition, scratchWriteNextPosition);
  111409. }
  111410. }
  111411. }
  111412. const startJ = segmentStart ? 2 : 0;
  111413. const endJ = segmentEnd ? 2 : 4;
  111414. for (let j = startJ; j < endJ; ++j) {
  111415. EncodedCartesian3_default.writeElements(
  111416. scratchWritePosition,
  111417. positionArray,
  111418. positionIndex
  111419. );
  111420. EncodedCartesian3_default.writeElements(
  111421. scratchWritePrevPosition,
  111422. positionArray,
  111423. positionIndex + 6
  111424. );
  111425. EncodedCartesian3_default.writeElements(
  111426. scratchWriteNextPosition,
  111427. positionArray,
  111428. positionIndex + 12
  111429. );
  111430. positionIndex += 6 * 3;
  111431. }
  111432. }
  111433. positionBuffer.copyFromArrayView(
  111434. positionArray,
  111435. 6 * 3 * Float32Array.BYTES_PER_ELEMENT * index2
  111436. );
  111437. }
  111438. };
  111439. var PolylineCollection_default = PolylineCollection;
  111440. // node_modules/cesium/Source/Scene/Vector3DTilePoints.js
  111441. function Vector3DTilePoints(options) {
  111442. this._positions = options.positions;
  111443. this._batchTable = options.batchTable;
  111444. this._batchIds = options.batchIds;
  111445. this._rectangle = options.rectangle;
  111446. this._minHeight = options.minimumHeight;
  111447. this._maxHeight = options.maximumHeight;
  111448. this._billboardCollection = void 0;
  111449. this._labelCollection = void 0;
  111450. this._polylineCollection = void 0;
  111451. this._verticesPromise = void 0;
  111452. this._packedBuffer = void 0;
  111453. this._ready = false;
  111454. this._readyPromise = defer_default();
  111455. this._resolvedPromise = false;
  111456. }
  111457. Object.defineProperties(Vector3DTilePoints.prototype, {
  111458. pointsLength: {
  111459. get: function() {
  111460. return this._billboardCollection.length;
  111461. }
  111462. },
  111463. texturesByteLength: {
  111464. get: function() {
  111465. const billboardSize = this._billboardCollection.textureAtlas.texture.sizeInBytes;
  111466. const labelSize = this._labelCollection._textureAtlas.texture.sizeInBytes;
  111467. return billboardSize + labelSize;
  111468. }
  111469. },
  111470. readyPromise: {
  111471. get: function() {
  111472. return this._readyPromise.promise;
  111473. }
  111474. }
  111475. });
  111476. function packBuffer2(points, ellipsoid) {
  111477. const rectangle = points._rectangle;
  111478. const minimumHeight = points._minHeight;
  111479. const maximumHeight = points._maxHeight;
  111480. const packedLength = 2 + Rectangle_default.packedLength + Ellipsoid_default.packedLength;
  111481. const packedBuffer = new Float64Array(packedLength);
  111482. let offset2 = 0;
  111483. packedBuffer[offset2++] = minimumHeight;
  111484. packedBuffer[offset2++] = maximumHeight;
  111485. Rectangle_default.pack(rectangle, packedBuffer, offset2);
  111486. offset2 += Rectangle_default.packedLength;
  111487. Ellipsoid_default.pack(ellipsoid, packedBuffer, offset2);
  111488. return packedBuffer;
  111489. }
  111490. var createVerticesTaskProcessor2 = new TaskProcessor_default(
  111491. "createVectorTilePoints",
  111492. 5
  111493. );
  111494. var scratchPosition10 = new Cartesian3_default();
  111495. function createPoints(points, ellipsoid) {
  111496. if (defined_default(points._billboardCollection)) {
  111497. return;
  111498. }
  111499. let positions;
  111500. if (!defined_default(points._verticesPromise)) {
  111501. positions = points._positions;
  111502. let packedBuffer = points._packedBuffer;
  111503. if (!defined_default(packedBuffer)) {
  111504. positions = points._positions = arraySlice_default(positions);
  111505. points._batchIds = arraySlice_default(points._batchIds);
  111506. packedBuffer = points._packedBuffer = packBuffer2(points, ellipsoid);
  111507. }
  111508. const transferrableObjects = [positions.buffer, packedBuffer.buffer];
  111509. const parameters = {
  111510. positions: positions.buffer,
  111511. packedBuffer: packedBuffer.buffer
  111512. };
  111513. const verticesPromise = points._verticesPromise = createVerticesTaskProcessor2.scheduleTask(
  111514. parameters,
  111515. transferrableObjects
  111516. );
  111517. if (!defined_default(verticesPromise)) {
  111518. return;
  111519. }
  111520. verticesPromise.then(function(result) {
  111521. points._positions = new Float64Array(result.positions);
  111522. points._ready = true;
  111523. });
  111524. }
  111525. if (points._ready && !defined_default(points._billboardCollection)) {
  111526. positions = points._positions;
  111527. const batchTable = points._batchTable;
  111528. const batchIds = points._batchIds;
  111529. const billboardCollection = points._billboardCollection = new BillboardCollection_default(
  111530. { batchTable }
  111531. );
  111532. const labelCollection = points._labelCollection = new LabelCollection_default({
  111533. batchTable
  111534. });
  111535. const polylineCollection = points._polylineCollection = new PolylineCollection_default();
  111536. polylineCollection._useHighlightColor = true;
  111537. const numberOfPoints = positions.length / 3;
  111538. for (let i2 = 0; i2 < numberOfPoints; ++i2) {
  111539. const id = batchIds[i2];
  111540. const position = Cartesian3_default.unpack(positions, i2 * 3, scratchPosition10);
  111541. const b = billboardCollection.add();
  111542. b.position = position;
  111543. b._batchIndex = id;
  111544. const l2 = labelCollection.add();
  111545. l2.text = " ";
  111546. l2.position = position;
  111547. l2._batchIndex = id;
  111548. const p2 = polylineCollection.add();
  111549. p2.positions = [Cartesian3_default.clone(position), Cartesian3_default.clone(position)];
  111550. }
  111551. points._positions = void 0;
  111552. points._packedBuffer = void 0;
  111553. }
  111554. }
  111555. Vector3DTilePoints.prototype.createFeatures = function(content, features) {
  111556. const billboardCollection = this._billboardCollection;
  111557. const labelCollection = this._labelCollection;
  111558. const polylineCollection = this._polylineCollection;
  111559. const batchIds = this._batchIds;
  111560. const length3 = batchIds.length;
  111561. for (let i2 = 0; i2 < length3; ++i2) {
  111562. const batchId = batchIds[i2];
  111563. const billboard = billboardCollection.get(i2);
  111564. const label = labelCollection.get(i2);
  111565. const polyline = polylineCollection.get(i2);
  111566. features[batchId] = new Cesium3DTilePointFeature_default(
  111567. content,
  111568. batchId,
  111569. billboard,
  111570. label,
  111571. polyline
  111572. );
  111573. }
  111574. };
  111575. Vector3DTilePoints.prototype.applyDebugSettings = function(enabled, color) {
  111576. if (enabled) {
  111577. Color_default.clone(color, this._billboardCollection._highlightColor);
  111578. Color_default.clone(color, this._labelCollection._highlightColor);
  111579. Color_default.clone(color, this._polylineCollection._highlightColor);
  111580. } else {
  111581. Color_default.clone(Color_default.WHITE, this._billboardCollection._highlightColor);
  111582. Color_default.clone(Color_default.WHITE, this._labelCollection._highlightColor);
  111583. Color_default.clone(Color_default.WHITE, this._polylineCollection._highlightColor);
  111584. }
  111585. };
  111586. function clearStyle2(polygons, features) {
  111587. const batchIds = polygons._batchIds;
  111588. const length3 = batchIds.length;
  111589. for (let i2 = 0; i2 < length3; ++i2) {
  111590. const batchId = batchIds[i2];
  111591. const feature2 = features[batchId];
  111592. feature2.show = true;
  111593. feature2.pointSize = Cesium3DTilePointFeature_default.defaultPointSize;
  111594. feature2.color = Cesium3DTilePointFeature_default.defaultColor;
  111595. feature2.pointOutlineColor = Cesium3DTilePointFeature_default.defaultPointOutlineColor;
  111596. feature2.pointOutlineWidth = Cesium3DTilePointFeature_default.defaultPointOutlineWidth;
  111597. feature2.labelColor = Color_default.WHITE;
  111598. feature2.labelOutlineColor = Color_default.WHITE;
  111599. feature2.labelOutlineWidth = 1;
  111600. feature2.font = "30px sans-serif";
  111601. feature2.labelStyle = LabelStyle_default.FILL;
  111602. feature2.labelText = void 0;
  111603. feature2.backgroundColor = new Color_default(0.165, 0.165, 0.165, 0.8);
  111604. feature2.backgroundPadding = new Cartesian2_default(7, 5);
  111605. feature2.backgroundEnabled = false;
  111606. feature2.scaleByDistance = void 0;
  111607. feature2.translucencyByDistance = void 0;
  111608. feature2.distanceDisplayCondition = void 0;
  111609. feature2.heightOffset = 0;
  111610. feature2.anchorLineEnabled = false;
  111611. feature2.anchorLineColor = Color_default.WHITE;
  111612. feature2.image = void 0;
  111613. feature2.disableDepthTestDistance = 0;
  111614. feature2.horizontalOrigin = HorizontalOrigin_default.CENTER;
  111615. feature2.verticalOrigin = VerticalOrigin_default.CENTER;
  111616. feature2.labelHorizontalOrigin = HorizontalOrigin_default.RIGHT;
  111617. feature2.labelVerticalOrigin = VerticalOrigin_default.BASELINE;
  111618. }
  111619. }
  111620. var scratchColor7 = new Color_default();
  111621. var scratchColor22 = new Color_default();
  111622. var scratchColor32 = new Color_default();
  111623. var scratchColor42 = new Color_default();
  111624. var scratchColor52 = new Color_default();
  111625. var scratchColor62 = new Color_default();
  111626. var scratchScaleByDistance = new NearFarScalar_default();
  111627. var scratchTranslucencyByDistance = new NearFarScalar_default();
  111628. var scratchDistanceDisplayCondition = new DistanceDisplayCondition_default();
  111629. Vector3DTilePoints.prototype.applyStyle = function(style, features) {
  111630. if (!defined_default(style)) {
  111631. clearStyle2(this, features);
  111632. return;
  111633. }
  111634. const batchIds = this._batchIds;
  111635. const length3 = batchIds.length;
  111636. for (let i2 = 0; i2 < length3; ++i2) {
  111637. const batchId = batchIds[i2];
  111638. const feature2 = features[batchId];
  111639. if (defined_default(style.show)) {
  111640. feature2.show = style.show.evaluate(feature2);
  111641. }
  111642. if (defined_default(style.pointSize)) {
  111643. feature2.pointSize = style.pointSize.evaluate(feature2);
  111644. }
  111645. if (defined_default(style.color)) {
  111646. feature2.color = style.color.evaluateColor(feature2, scratchColor7);
  111647. }
  111648. if (defined_default(style.pointOutlineColor)) {
  111649. feature2.pointOutlineColor = style.pointOutlineColor.evaluateColor(
  111650. feature2,
  111651. scratchColor22
  111652. );
  111653. }
  111654. if (defined_default(style.pointOutlineWidth)) {
  111655. feature2.pointOutlineWidth = style.pointOutlineWidth.evaluate(feature2);
  111656. }
  111657. if (defined_default(style.labelColor)) {
  111658. feature2.labelColor = style.labelColor.evaluateColor(
  111659. feature2,
  111660. scratchColor32
  111661. );
  111662. }
  111663. if (defined_default(style.labelOutlineColor)) {
  111664. feature2.labelOutlineColor = style.labelOutlineColor.evaluateColor(
  111665. feature2,
  111666. scratchColor42
  111667. );
  111668. }
  111669. if (defined_default(style.labelOutlineWidth)) {
  111670. feature2.labelOutlineWidth = style.labelOutlineWidth.evaluate(feature2);
  111671. }
  111672. if (defined_default(style.font)) {
  111673. feature2.font = style.font.evaluate(feature2);
  111674. }
  111675. if (defined_default(style.labelStyle)) {
  111676. feature2.labelStyle = style.labelStyle.evaluate(feature2);
  111677. }
  111678. if (defined_default(style.labelText)) {
  111679. feature2.labelText = style.labelText.evaluate(feature2);
  111680. } else {
  111681. feature2.labelText = void 0;
  111682. }
  111683. if (defined_default(style.backgroundColor)) {
  111684. feature2.backgroundColor = style.backgroundColor.evaluateColor(
  111685. feature2,
  111686. scratchColor52
  111687. );
  111688. }
  111689. if (defined_default(style.backgroundPadding)) {
  111690. feature2.backgroundPadding = style.backgroundPadding.evaluate(feature2);
  111691. }
  111692. if (defined_default(style.backgroundEnabled)) {
  111693. feature2.backgroundEnabled = style.backgroundEnabled.evaluate(feature2);
  111694. }
  111695. if (defined_default(style.scaleByDistance)) {
  111696. const scaleByDistanceCart4 = style.scaleByDistance.evaluate(feature2);
  111697. scratchScaleByDistance.near = scaleByDistanceCart4.x;
  111698. scratchScaleByDistance.nearValue = scaleByDistanceCart4.y;
  111699. scratchScaleByDistance.far = scaleByDistanceCart4.z;
  111700. scratchScaleByDistance.farValue = scaleByDistanceCart4.w;
  111701. feature2.scaleByDistance = scratchScaleByDistance;
  111702. } else {
  111703. feature2.scaleByDistance = void 0;
  111704. }
  111705. if (defined_default(style.translucencyByDistance)) {
  111706. const translucencyByDistanceCart4 = style.translucencyByDistance.evaluate(
  111707. feature2
  111708. );
  111709. scratchTranslucencyByDistance.near = translucencyByDistanceCart4.x;
  111710. scratchTranslucencyByDistance.nearValue = translucencyByDistanceCart4.y;
  111711. scratchTranslucencyByDistance.far = translucencyByDistanceCart4.z;
  111712. scratchTranslucencyByDistance.farValue = translucencyByDistanceCart4.w;
  111713. feature2.translucencyByDistance = scratchTranslucencyByDistance;
  111714. } else {
  111715. feature2.translucencyByDistance = void 0;
  111716. }
  111717. if (defined_default(style.distanceDisplayCondition)) {
  111718. const distanceDisplayConditionCart2 = style.distanceDisplayCondition.evaluate(
  111719. feature2
  111720. );
  111721. scratchDistanceDisplayCondition.near = distanceDisplayConditionCart2.x;
  111722. scratchDistanceDisplayCondition.far = distanceDisplayConditionCart2.y;
  111723. feature2.distanceDisplayCondition = scratchDistanceDisplayCondition;
  111724. } else {
  111725. feature2.distanceDisplayCondition = void 0;
  111726. }
  111727. if (defined_default(style.heightOffset)) {
  111728. feature2.heightOffset = style.heightOffset.evaluate(feature2);
  111729. }
  111730. if (defined_default(style.anchorLineEnabled)) {
  111731. feature2.anchorLineEnabled = style.anchorLineEnabled.evaluate(feature2);
  111732. }
  111733. if (defined_default(style.anchorLineColor)) {
  111734. feature2.anchorLineColor = style.anchorLineColor.evaluateColor(
  111735. feature2,
  111736. scratchColor62
  111737. );
  111738. }
  111739. if (defined_default(style.image)) {
  111740. feature2.image = style.image.evaluate(feature2);
  111741. } else {
  111742. feature2.image = void 0;
  111743. }
  111744. if (defined_default(style.disableDepthTestDistance)) {
  111745. feature2.disableDepthTestDistance = style.disableDepthTestDistance.evaluate(
  111746. feature2
  111747. );
  111748. }
  111749. if (defined_default(style.horizontalOrigin)) {
  111750. feature2.horizontalOrigin = style.horizontalOrigin.evaluate(feature2);
  111751. }
  111752. if (defined_default(style.verticalOrigin)) {
  111753. feature2.verticalOrigin = style.verticalOrigin.evaluate(feature2);
  111754. }
  111755. if (defined_default(style.labelHorizontalOrigin)) {
  111756. feature2.labelHorizontalOrigin = style.labelHorizontalOrigin.evaluate(
  111757. feature2
  111758. );
  111759. }
  111760. if (defined_default(style.labelVerticalOrigin)) {
  111761. feature2.labelVerticalOrigin = style.labelVerticalOrigin.evaluate(feature2);
  111762. }
  111763. }
  111764. };
  111765. Vector3DTilePoints.prototype.update = function(frameState) {
  111766. createPoints(this, frameState.mapProjection.ellipsoid);
  111767. if (!this._ready) {
  111768. return;
  111769. }
  111770. this._polylineCollection.update(frameState);
  111771. this._billboardCollection.update(frameState);
  111772. this._labelCollection.update(frameState);
  111773. if (!this._resolvedPromise) {
  111774. this._readyPromise.resolve();
  111775. this._resolvedPromise = true;
  111776. }
  111777. };
  111778. Vector3DTilePoints.prototype.isDestroyed = function() {
  111779. return false;
  111780. };
  111781. Vector3DTilePoints.prototype.destroy = function() {
  111782. this._billboardCollection = this._billboardCollection && this._billboardCollection.destroy();
  111783. this._labelCollection = this._labelCollection && this._labelCollection.destroy();
  111784. this._polylineCollection = this._polylineCollection && this._polylineCollection.destroy();
  111785. return destroyObject_default(this);
  111786. };
  111787. var Vector3DTilePoints_default = Vector3DTilePoints;
  111788. // node_modules/cesium/Source/Scene/Vector3DTilePolygons.js
  111789. function Vector3DTilePolygons(options) {
  111790. this._batchTable = options.batchTable;
  111791. this._batchIds = options.batchIds;
  111792. this._positions = options.positions;
  111793. this._counts = options.counts;
  111794. this._indices = options.indices;
  111795. this._indexCounts = options.indexCounts;
  111796. this._indexOffsets = void 0;
  111797. this._batchTableColors = void 0;
  111798. this._packedBuffer = void 0;
  111799. this._batchedPositions = void 0;
  111800. this._transferrableBatchIds = void 0;
  111801. this._vertexBatchIds = void 0;
  111802. this._ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  111803. this._minimumHeight = options.minimumHeight;
  111804. this._maximumHeight = options.maximumHeight;
  111805. this._polygonMinimumHeights = options.polygonMinimumHeights;
  111806. this._polygonMaximumHeights = options.polygonMaximumHeights;
  111807. this._center = defaultValue_default(options.center, Cartesian3_default.ZERO);
  111808. this._rectangle = options.rectangle;
  111809. this._center = void 0;
  111810. this._boundingVolume = options.boundingVolume;
  111811. this._boundingVolumes = void 0;
  111812. this._batchedIndices = void 0;
  111813. this._ready = false;
  111814. this._readyPromise = defer_default();
  111815. this._verticesPromise = void 0;
  111816. this._primitive = void 0;
  111817. this.debugWireframe = false;
  111818. this.forceRebatch = false;
  111819. this.classificationType = ClassificationType_default.BOTH;
  111820. }
  111821. Object.defineProperties(Vector3DTilePolygons.prototype, {
  111822. trianglesLength: {
  111823. get: function() {
  111824. if (defined_default(this._primitive)) {
  111825. return this._primitive.trianglesLength;
  111826. }
  111827. return 0;
  111828. }
  111829. },
  111830. geometryByteLength: {
  111831. get: function() {
  111832. if (defined_default(this._primitive)) {
  111833. return this._primitive.geometryByteLength;
  111834. }
  111835. return 0;
  111836. }
  111837. },
  111838. readyPromise: {
  111839. get: function() {
  111840. return this._readyPromise.promise;
  111841. }
  111842. }
  111843. });
  111844. function packBuffer3(polygons) {
  111845. const packedBuffer = new Float64Array(
  111846. 3 + Cartesian3_default.packedLength + Ellipsoid_default.packedLength + Rectangle_default.packedLength
  111847. );
  111848. let offset2 = 0;
  111849. packedBuffer[offset2++] = polygons._indices.BYTES_PER_ELEMENT;
  111850. packedBuffer[offset2++] = polygons._minimumHeight;
  111851. packedBuffer[offset2++] = polygons._maximumHeight;
  111852. Cartesian3_default.pack(polygons._center, packedBuffer, offset2);
  111853. offset2 += Cartesian3_default.packedLength;
  111854. Ellipsoid_default.pack(polygons._ellipsoid, packedBuffer, offset2);
  111855. offset2 += Ellipsoid_default.packedLength;
  111856. Rectangle_default.pack(polygons._rectangle, packedBuffer, offset2);
  111857. return packedBuffer;
  111858. }
  111859. function unpackBuffer2(polygons, packedBuffer) {
  111860. let offset2 = 1;
  111861. const numBVS = packedBuffer[offset2++];
  111862. const bvs = polygons._boundingVolumes = new Array(numBVS);
  111863. for (let i2 = 0; i2 < numBVS; ++i2) {
  111864. bvs[i2] = OrientedBoundingBox_default.unpack(packedBuffer, offset2);
  111865. offset2 += OrientedBoundingBox_default.packedLength;
  111866. }
  111867. const numBatchedIndices = packedBuffer[offset2++];
  111868. const bis = polygons._batchedIndices = new Array(numBatchedIndices);
  111869. for (let j = 0; j < numBatchedIndices; ++j) {
  111870. const color = Color_default.unpack(packedBuffer, offset2);
  111871. offset2 += Color_default.packedLength;
  111872. const indexOffset = packedBuffer[offset2++];
  111873. const count = packedBuffer[offset2++];
  111874. const length3 = packedBuffer[offset2++];
  111875. const batchIds = new Array(length3);
  111876. for (let k = 0; k < length3; ++k) {
  111877. batchIds[k] = packedBuffer[offset2++];
  111878. }
  111879. bis[j] = new Vector3DTileBatch_default({
  111880. color,
  111881. offset: indexOffset,
  111882. count,
  111883. batchIds
  111884. });
  111885. }
  111886. }
  111887. var createVerticesTaskProcessor3 = new TaskProcessor_default(
  111888. "createVectorTilePolygons",
  111889. 5
  111890. );
  111891. var scratchColor8 = new Color_default();
  111892. function createPrimitive3(polygons) {
  111893. if (defined_default(polygons._primitive)) {
  111894. return;
  111895. }
  111896. if (!defined_default(polygons._verticesPromise)) {
  111897. let positions = polygons._positions;
  111898. let counts = polygons._counts;
  111899. let indexCounts = polygons._indexCounts;
  111900. let indices2 = polygons._indices;
  111901. let batchIds = polygons._transferrableBatchIds;
  111902. let batchTableColors = polygons._batchTableColors;
  111903. let packedBuffer = polygons._packedBuffer;
  111904. if (!defined_default(batchTableColors)) {
  111905. positions = polygons._positions = arraySlice_default(polygons._positions);
  111906. counts = polygons._counts = arraySlice_default(polygons._counts);
  111907. indexCounts = polygons._indexCounts = arraySlice_default(polygons._indexCounts);
  111908. indices2 = polygons._indices = arraySlice_default(polygons._indices);
  111909. polygons._center = polygons._ellipsoid.cartographicToCartesian(
  111910. Rectangle_default.center(polygons._rectangle)
  111911. );
  111912. batchIds = polygons._transferrableBatchIds = new Uint32Array(
  111913. polygons._batchIds
  111914. );
  111915. batchTableColors = polygons._batchTableColors = new Uint32Array(
  111916. batchIds.length
  111917. );
  111918. const batchTable = polygons._batchTable;
  111919. const length3 = batchTableColors.length;
  111920. for (let i2 = 0; i2 < length3; ++i2) {
  111921. const color = batchTable.getColor(i2, scratchColor8);
  111922. batchTableColors[i2] = color.toRgba();
  111923. }
  111924. packedBuffer = polygons._packedBuffer = packBuffer3(polygons);
  111925. }
  111926. const transferrableObjects = [
  111927. positions.buffer,
  111928. counts.buffer,
  111929. indexCounts.buffer,
  111930. indices2.buffer,
  111931. batchIds.buffer,
  111932. batchTableColors.buffer,
  111933. packedBuffer.buffer
  111934. ];
  111935. const parameters = {
  111936. packedBuffer: packedBuffer.buffer,
  111937. positions: positions.buffer,
  111938. counts: counts.buffer,
  111939. indexCounts: indexCounts.buffer,
  111940. indices: indices2.buffer,
  111941. batchIds: batchIds.buffer,
  111942. batchTableColors: batchTableColors.buffer
  111943. };
  111944. let minimumHeights = polygons._polygonMinimumHeights;
  111945. let maximumHeights = polygons._polygonMaximumHeights;
  111946. if (defined_default(minimumHeights) && defined_default(maximumHeights)) {
  111947. minimumHeights = arraySlice_default(minimumHeights);
  111948. maximumHeights = arraySlice_default(maximumHeights);
  111949. transferrableObjects.push(minimumHeights.buffer, maximumHeights.buffer);
  111950. parameters.minimumHeights = minimumHeights;
  111951. parameters.maximumHeights = maximumHeights;
  111952. }
  111953. const verticesPromise = polygons._verticesPromise = createVerticesTaskProcessor3.scheduleTask(
  111954. parameters,
  111955. transferrableObjects
  111956. );
  111957. if (!defined_default(verticesPromise)) {
  111958. return;
  111959. }
  111960. verticesPromise.then(function(result) {
  111961. polygons._positions = void 0;
  111962. polygons._counts = void 0;
  111963. polygons._polygonMinimumHeights = void 0;
  111964. polygons._polygonMaximumHeights = void 0;
  111965. const packedBuffer2 = new Float64Array(result.packedBuffer);
  111966. const indexDatatype = packedBuffer2[0];
  111967. unpackBuffer2(polygons, packedBuffer2);
  111968. polygons._indices = IndexDatatype_default.getSizeInBytes(indexDatatype) === 2 ? new Uint16Array(result.indices) : new Uint32Array(result.indices);
  111969. polygons._indexOffsets = new Uint32Array(result.indexOffsets);
  111970. polygons._indexCounts = new Uint32Array(result.indexCounts);
  111971. polygons._batchedPositions = new Float32Array(result.positions);
  111972. polygons._vertexBatchIds = new Uint16Array(result.batchIds);
  111973. polygons._ready = true;
  111974. });
  111975. }
  111976. if (polygons._ready && !defined_default(polygons._primitive)) {
  111977. polygons._primitive = new Vector3DTilePrimitive_default({
  111978. batchTable: polygons._batchTable,
  111979. positions: polygons._batchedPositions,
  111980. batchIds: polygons._batchIds,
  111981. vertexBatchIds: polygons._vertexBatchIds,
  111982. indices: polygons._indices,
  111983. indexOffsets: polygons._indexOffsets,
  111984. indexCounts: polygons._indexCounts,
  111985. batchedIndices: polygons._batchedIndices,
  111986. boundingVolume: polygons._boundingVolume,
  111987. boundingVolumes: polygons._boundingVolumes,
  111988. center: polygons._center
  111989. });
  111990. polygons._batchTable = void 0;
  111991. polygons._batchIds = void 0;
  111992. polygons._positions = void 0;
  111993. polygons._counts = void 0;
  111994. polygons._indices = void 0;
  111995. polygons._indexCounts = void 0;
  111996. polygons._indexOffsets = void 0;
  111997. polygons._batchTableColors = void 0;
  111998. polygons._packedBuffer = void 0;
  111999. polygons._batchedPositions = void 0;
  112000. polygons._transferrableBatchIds = void 0;
  112001. polygons._vertexBatchIds = void 0;
  112002. polygons._ellipsoid = void 0;
  112003. polygons._minimumHeight = void 0;
  112004. polygons._maximumHeight = void 0;
  112005. polygons._polygonMinimumHeights = void 0;
  112006. polygons._polygonMaximumHeights = void 0;
  112007. polygons._center = void 0;
  112008. polygons._rectangle = void 0;
  112009. polygons._boundingVolume = void 0;
  112010. polygons._boundingVolumes = void 0;
  112011. polygons._batchedIndices = void 0;
  112012. polygons._verticesPromise = void 0;
  112013. polygons._readyPromise.resolve();
  112014. }
  112015. }
  112016. Vector3DTilePolygons.prototype.createFeatures = function(content, features) {
  112017. this._primitive.createFeatures(content, features);
  112018. };
  112019. Vector3DTilePolygons.prototype.applyDebugSettings = function(enabled, color) {
  112020. this._primitive.applyDebugSettings(enabled, color);
  112021. };
  112022. Vector3DTilePolygons.prototype.applyStyle = function(style, features) {
  112023. this._primitive.applyStyle(style, features);
  112024. };
  112025. Vector3DTilePolygons.prototype.updateCommands = function(batchId, color) {
  112026. this._primitive.updateCommands(batchId, color);
  112027. };
  112028. Vector3DTilePolygons.prototype.update = function(frameState) {
  112029. createPrimitive3(this);
  112030. if (!this._ready) {
  112031. return;
  112032. }
  112033. this._primitive.debugWireframe = this.debugWireframe;
  112034. this._primitive.forceRebatch = this.forceRebatch;
  112035. this._primitive.classificationType = this.classificationType;
  112036. this._primitive.update(frameState);
  112037. };
  112038. Vector3DTilePolygons.prototype.isDestroyed = function() {
  112039. return false;
  112040. };
  112041. Vector3DTilePolygons.prototype.destroy = function() {
  112042. this._primitive = this._primitive && this._primitive.destroy();
  112043. return destroyObject_default(this);
  112044. };
  112045. var Vector3DTilePolygons_default = Vector3DTilePolygons;
  112046. // node_modules/cesium/Source/Shaders/Vector3DTilePolylinesVS.js
  112047. var Vector3DTilePolylinesVS_default = "attribute vec4 currentPosition;\nattribute vec4 previousPosition;\nattribute vec4 nextPosition;\nattribute vec2 expandAndWidth;\nattribute float a_batchId;\n\nuniform mat4 u_modifiedModelView;\n\nvoid main()\n{\n float expandDir = expandAndWidth.x;\n float width = abs(expandAndWidth.y) + 0.5;\n bool usePrev = expandAndWidth.y < 0.0;\n\n vec4 p = u_modifiedModelView * currentPosition;\n vec4 prev = u_modifiedModelView * previousPosition;\n vec4 next = u_modifiedModelView * nextPosition;\n\n float angle;\n vec4 positionWC = getPolylineWindowCoordinatesEC(p, prev, next, expandDir, width, usePrev, angle);\n gl_Position = czm_viewportOrthographic * positionWC;\n}\n";
  112048. // node_modules/cesium/Source/Scene/Vector3DTilePolylines.js
  112049. function Vector3DTilePolylines(options) {
  112050. this._positions = options.positions;
  112051. this._widths = options.widths;
  112052. this._counts = options.counts;
  112053. this._batchIds = options.batchIds;
  112054. this._ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  112055. this._minimumHeight = options.minimumHeight;
  112056. this._maximumHeight = options.maximumHeight;
  112057. this._center = options.center;
  112058. this._rectangle = options.rectangle;
  112059. this._boundingVolume = options.boundingVolume;
  112060. this._batchTable = options.batchTable;
  112061. this._va = void 0;
  112062. this._sp = void 0;
  112063. this._rs = void 0;
  112064. this._uniformMap = void 0;
  112065. this._command = void 0;
  112066. this._transferrableBatchIds = void 0;
  112067. this._packedBuffer = void 0;
  112068. this._keepDecodedPositions = options.keepDecodedPositions;
  112069. this._decodedPositions = void 0;
  112070. this._decodedPositionOffsets = void 0;
  112071. this._currentPositions = void 0;
  112072. this._previousPositions = void 0;
  112073. this._nextPositions = void 0;
  112074. this._expandAndWidth = void 0;
  112075. this._vertexBatchIds = void 0;
  112076. this._indices = void 0;
  112077. this._constantColor = Color_default.clone(Color_default.WHITE);
  112078. this._highlightColor = this._constantColor;
  112079. this._trianglesLength = 0;
  112080. this._geometryByteLength = 0;
  112081. this._ready = false;
  112082. this._readyPromise = defer_default();
  112083. this._verticesPromise = void 0;
  112084. }
  112085. Object.defineProperties(Vector3DTilePolylines.prototype, {
  112086. trianglesLength: {
  112087. get: function() {
  112088. return this._trianglesLength;
  112089. }
  112090. },
  112091. geometryByteLength: {
  112092. get: function() {
  112093. return this._geometryByteLength;
  112094. }
  112095. },
  112096. readyPromise: {
  112097. get: function() {
  112098. return this._readyPromise.promise;
  112099. }
  112100. }
  112101. });
  112102. function packBuffer4(polylines) {
  112103. const rectangle = polylines._rectangle;
  112104. const minimumHeight = polylines._minimumHeight;
  112105. const maximumHeight = polylines._maximumHeight;
  112106. const ellipsoid = polylines._ellipsoid;
  112107. const center = polylines._center;
  112108. const packedLength = 2 + Rectangle_default.packedLength + Ellipsoid_default.packedLength + Cartesian3_default.packedLength;
  112109. const packedBuffer = new Float64Array(packedLength);
  112110. let offset2 = 0;
  112111. packedBuffer[offset2++] = minimumHeight;
  112112. packedBuffer[offset2++] = maximumHeight;
  112113. Rectangle_default.pack(rectangle, packedBuffer, offset2);
  112114. offset2 += Rectangle_default.packedLength;
  112115. Ellipsoid_default.pack(ellipsoid, packedBuffer, offset2);
  112116. offset2 += Ellipsoid_default.packedLength;
  112117. Cartesian3_default.pack(center, packedBuffer, offset2);
  112118. return packedBuffer;
  112119. }
  112120. var createVerticesTaskProcessor4 = new TaskProcessor_default(
  112121. "createVectorTilePolylines",
  112122. 5
  112123. );
  112124. var attributeLocations3 = {
  112125. previousPosition: 0,
  112126. currentPosition: 1,
  112127. nextPosition: 2,
  112128. expandAndWidth: 3,
  112129. a_batchId: 4
  112130. };
  112131. function createVertexArray5(polylines, context) {
  112132. if (defined_default(polylines._va)) {
  112133. return;
  112134. }
  112135. if (!defined_default(polylines._verticesPromise)) {
  112136. let positions = polylines._positions;
  112137. let widths = polylines._widths;
  112138. let counts = polylines._counts;
  112139. let batchIds = polylines._transferrableBatchIds;
  112140. let packedBuffer = polylines._packedBuffer;
  112141. if (!defined_default(packedBuffer)) {
  112142. positions = polylines._positions = arraySlice_default(positions);
  112143. widths = polylines._widths = arraySlice_default(widths);
  112144. counts = polylines._counts = arraySlice_default(counts);
  112145. batchIds = polylines._transferrableBatchIds = arraySlice_default(
  112146. polylines._batchIds
  112147. );
  112148. packedBuffer = polylines._packedBuffer = packBuffer4(polylines);
  112149. }
  112150. const transferrableObjects = [
  112151. positions.buffer,
  112152. widths.buffer,
  112153. counts.buffer,
  112154. batchIds.buffer,
  112155. packedBuffer.buffer
  112156. ];
  112157. const parameters = {
  112158. positions: positions.buffer,
  112159. widths: widths.buffer,
  112160. counts: counts.buffer,
  112161. batchIds: batchIds.buffer,
  112162. packedBuffer: packedBuffer.buffer,
  112163. keepDecodedPositions: polylines._keepDecodedPositions
  112164. };
  112165. const verticesPromise = polylines._verticesPromise = createVerticesTaskProcessor4.scheduleTask(
  112166. parameters,
  112167. transferrableObjects
  112168. );
  112169. if (!defined_default(verticesPromise)) {
  112170. return;
  112171. }
  112172. verticesPromise.then(function(result) {
  112173. if (polylines._keepDecodedPositions) {
  112174. polylines._decodedPositions = new Float64Array(
  112175. result.decodedPositions
  112176. );
  112177. polylines._decodedPositionOffsets = new Uint32Array(
  112178. result.decodedPositionOffsets
  112179. );
  112180. }
  112181. polylines._currentPositions = new Float32Array(result.currentPositions);
  112182. polylines._previousPositions = new Float32Array(
  112183. result.previousPositions
  112184. );
  112185. polylines._nextPositions = new Float32Array(result.nextPositions);
  112186. polylines._expandAndWidth = new Float32Array(result.expandAndWidth);
  112187. polylines._vertexBatchIds = new Uint16Array(result.batchIds);
  112188. const indexDatatype = result.indexDatatype;
  112189. polylines._indices = indexDatatype === IndexDatatype_default.UNSIGNED_SHORT ? new Uint16Array(result.indices) : new Uint32Array(result.indices);
  112190. polylines._ready = true;
  112191. }).catch(function(error) {
  112192. polylines._readyPromise.reject(error);
  112193. });
  112194. }
  112195. if (polylines._ready && !defined_default(polylines._va)) {
  112196. const curPositions = polylines._currentPositions;
  112197. const prevPositions = polylines._previousPositions;
  112198. const nextPositions = polylines._nextPositions;
  112199. const expandAndWidth = polylines._expandAndWidth;
  112200. const vertexBatchIds = polylines._vertexBatchIds;
  112201. const indices2 = polylines._indices;
  112202. let byteLength = prevPositions.byteLength + curPositions.byteLength + nextPositions.byteLength;
  112203. byteLength += expandAndWidth.byteLength + vertexBatchIds.byteLength + indices2.byteLength;
  112204. polylines._trianglesLength = indices2.length / 3;
  112205. polylines._geometryByteLength = byteLength;
  112206. const prevPositionBuffer = Buffer_default.createVertexBuffer({
  112207. context,
  112208. typedArray: prevPositions,
  112209. usage: BufferUsage_default.STATIC_DRAW
  112210. });
  112211. const curPositionBuffer = Buffer_default.createVertexBuffer({
  112212. context,
  112213. typedArray: curPositions,
  112214. usage: BufferUsage_default.STATIC_DRAW
  112215. });
  112216. const nextPositionBuffer = Buffer_default.createVertexBuffer({
  112217. context,
  112218. typedArray: nextPositions,
  112219. usage: BufferUsage_default.STATIC_DRAW
  112220. });
  112221. const expandAndWidthBuffer = Buffer_default.createVertexBuffer({
  112222. context,
  112223. typedArray: expandAndWidth,
  112224. usage: BufferUsage_default.STATIC_DRAW
  112225. });
  112226. const idBuffer = Buffer_default.createVertexBuffer({
  112227. context,
  112228. typedArray: vertexBatchIds,
  112229. usage: BufferUsage_default.STATIC_DRAW
  112230. });
  112231. const indexBuffer = Buffer_default.createIndexBuffer({
  112232. context,
  112233. typedArray: indices2,
  112234. usage: BufferUsage_default.STATIC_DRAW,
  112235. indexDatatype: indices2.BYTES_PER_ELEMENT === 2 ? IndexDatatype_default.UNSIGNED_SHORT : IndexDatatype_default.UNSIGNED_INT
  112236. });
  112237. const vertexAttributes = [
  112238. {
  112239. index: attributeLocations3.previousPosition,
  112240. vertexBuffer: prevPositionBuffer,
  112241. componentDatatype: ComponentDatatype_default.FLOAT,
  112242. componentsPerAttribute: 3
  112243. },
  112244. {
  112245. index: attributeLocations3.currentPosition,
  112246. vertexBuffer: curPositionBuffer,
  112247. componentDatatype: ComponentDatatype_default.FLOAT,
  112248. componentsPerAttribute: 3
  112249. },
  112250. {
  112251. index: attributeLocations3.nextPosition,
  112252. vertexBuffer: nextPositionBuffer,
  112253. componentDatatype: ComponentDatatype_default.FLOAT,
  112254. componentsPerAttribute: 3
  112255. },
  112256. {
  112257. index: attributeLocations3.expandAndWidth,
  112258. vertexBuffer: expandAndWidthBuffer,
  112259. componentDatatype: ComponentDatatype_default.FLOAT,
  112260. componentsPerAttribute: 2
  112261. },
  112262. {
  112263. index: attributeLocations3.a_batchId,
  112264. vertexBuffer: idBuffer,
  112265. componentDatatype: ComponentDatatype_default.UNSIGNED_SHORT,
  112266. componentsPerAttribute: 1
  112267. }
  112268. ];
  112269. polylines._va = new VertexArray_default({
  112270. context,
  112271. attributes: vertexAttributes,
  112272. indexBuffer
  112273. });
  112274. polylines._positions = void 0;
  112275. polylines._widths = void 0;
  112276. polylines._counts = void 0;
  112277. polylines._ellipsoid = void 0;
  112278. polylines._minimumHeight = void 0;
  112279. polylines._maximumHeight = void 0;
  112280. polylines._rectangle = void 0;
  112281. polylines._transferrableBatchIds = void 0;
  112282. polylines._packedBuffer = void 0;
  112283. polylines._currentPositions = void 0;
  112284. polylines._previousPositions = void 0;
  112285. polylines._nextPositions = void 0;
  112286. polylines._expandAndWidth = void 0;
  112287. polylines._vertexBatchIds = void 0;
  112288. polylines._indices = void 0;
  112289. polylines._readyPromise.resolve();
  112290. }
  112291. }
  112292. var modifiedModelViewScratch3 = new Matrix4_default();
  112293. var rtcScratch3 = new Cartesian3_default();
  112294. function createUniformMap4(primitive, context) {
  112295. if (defined_default(primitive._uniformMap)) {
  112296. return;
  112297. }
  112298. primitive._uniformMap = {
  112299. u_modifiedModelView: function() {
  112300. const viewMatrix = context.uniformState.view;
  112301. Matrix4_default.clone(viewMatrix, modifiedModelViewScratch3);
  112302. Matrix4_default.multiplyByPoint(
  112303. modifiedModelViewScratch3,
  112304. primitive._center,
  112305. rtcScratch3
  112306. );
  112307. Matrix4_default.setTranslation(
  112308. modifiedModelViewScratch3,
  112309. rtcScratch3,
  112310. modifiedModelViewScratch3
  112311. );
  112312. return modifiedModelViewScratch3;
  112313. },
  112314. u_highlightColor: function() {
  112315. return primitive._highlightColor;
  112316. }
  112317. };
  112318. }
  112319. function createRenderStates5(primitive) {
  112320. if (defined_default(primitive._rs)) {
  112321. return;
  112322. }
  112323. const polygonOffset = {
  112324. enabled: true,
  112325. factor: -5,
  112326. units: -5
  112327. };
  112328. primitive._rs = RenderState_default.fromCache({
  112329. blending: BlendingState_default.ALPHA_BLEND,
  112330. depthMask: false,
  112331. depthTest: {
  112332. enabled: true
  112333. },
  112334. polygonOffset
  112335. });
  112336. }
  112337. var PolylineFS = "uniform vec4 u_highlightColor; \nvoid main()\n{\n gl_FragColor = u_highlightColor;\n}\n";
  112338. function createShaders3(primitive, context) {
  112339. if (defined_default(primitive._sp)) {
  112340. return;
  112341. }
  112342. const batchTable = primitive._batchTable;
  112343. const vsSource = batchTable.getVertexShaderCallback(
  112344. false,
  112345. "a_batchId",
  112346. void 0
  112347. )(Vector3DTilePolylinesVS_default);
  112348. const fsSource = batchTable.getFragmentShaderCallback(
  112349. false,
  112350. void 0,
  112351. false
  112352. )(PolylineFS);
  112353. const vs = new ShaderSource_default({
  112354. defines: [
  112355. "VECTOR_TILE",
  112356. !FeatureDetection_default.isInternetExplorer() ? "CLIP_POLYLINE" : ""
  112357. ],
  112358. sources: [PolylineCommon_default, vsSource]
  112359. });
  112360. const fs = new ShaderSource_default({
  112361. defines: ["VECTOR_TILE"],
  112362. sources: [fsSource]
  112363. });
  112364. primitive._sp = ShaderProgram_default.fromCache({
  112365. context,
  112366. vertexShaderSource: vs,
  112367. fragmentShaderSource: fs,
  112368. attributeLocations: attributeLocations3
  112369. });
  112370. }
  112371. function queueCommands2(primitive, frameState) {
  112372. if (!defined_default(primitive._command)) {
  112373. const uniformMap2 = primitive._batchTable.getUniformMapCallback()(
  112374. primitive._uniformMap
  112375. );
  112376. primitive._command = new DrawCommand_default({
  112377. owner: primitive,
  112378. vertexArray: primitive._va,
  112379. renderState: primitive._rs,
  112380. shaderProgram: primitive._sp,
  112381. uniformMap: uniformMap2,
  112382. boundingVolume: primitive._boundingVolume,
  112383. pass: Pass_default.TRANSLUCENT,
  112384. pickId: primitive._batchTable.getPickId()
  112385. });
  112386. }
  112387. frameState.commandList.push(primitive._command);
  112388. }
  112389. Vector3DTilePolylines.getPolylinePositions = function(polylines, batchId) {
  112390. const batchIds = polylines._batchIds;
  112391. const positions = polylines._decodedPositions;
  112392. const offsets = polylines._decodedPositionOffsets;
  112393. if (!defined_default(batchIds) || !defined_default(positions)) {
  112394. return void 0;
  112395. }
  112396. let i2;
  112397. let j;
  112398. const polylinesLength = batchIds.length;
  112399. let positionsLength = 0;
  112400. let resultCounter = 0;
  112401. for (i2 = 0; i2 < polylinesLength; ++i2) {
  112402. if (batchIds[i2] === batchId) {
  112403. positionsLength += offsets[i2 + 1] - offsets[i2];
  112404. }
  112405. }
  112406. if (positionsLength === 0) {
  112407. return void 0;
  112408. }
  112409. const results = new Float64Array(positionsLength * 3);
  112410. for (i2 = 0; i2 < polylinesLength; ++i2) {
  112411. if (batchIds[i2] === batchId) {
  112412. const offset2 = offsets[i2];
  112413. const count = offsets[i2 + 1] - offset2;
  112414. for (j = 0; j < count; ++j) {
  112415. const decodedOffset = (offset2 + j) * 3;
  112416. results[resultCounter++] = positions[decodedOffset];
  112417. results[resultCounter++] = positions[decodedOffset + 1];
  112418. results[resultCounter++] = positions[decodedOffset + 2];
  112419. }
  112420. }
  112421. }
  112422. return results;
  112423. };
  112424. Vector3DTilePolylines.prototype.getPositions = function(batchId) {
  112425. return Vector3DTilePolylines.getPolylinePositions(this, batchId);
  112426. };
  112427. Vector3DTilePolylines.prototype.createFeatures = function(content, features) {
  112428. const batchIds = this._batchIds;
  112429. const length3 = batchIds.length;
  112430. for (let i2 = 0; i2 < length3; ++i2) {
  112431. const batchId = batchIds[i2];
  112432. features[batchId] = new Cesium3DTileFeature_default(content, batchId);
  112433. }
  112434. };
  112435. Vector3DTilePolylines.prototype.applyDebugSettings = function(enabled, color) {
  112436. this._highlightColor = enabled ? color : this._constantColor;
  112437. };
  112438. function clearStyle3(polygons, features) {
  112439. const batchIds = polygons._batchIds;
  112440. const length3 = batchIds.length;
  112441. for (let i2 = 0; i2 < length3; ++i2) {
  112442. const batchId = batchIds[i2];
  112443. const feature2 = features[batchId];
  112444. feature2.show = true;
  112445. feature2.color = Color_default.WHITE;
  112446. }
  112447. }
  112448. var scratchColor9 = new Color_default();
  112449. var DEFAULT_COLOR_VALUE3 = Color_default.WHITE;
  112450. var DEFAULT_SHOW_VALUE3 = true;
  112451. Vector3DTilePolylines.prototype.applyStyle = function(style, features) {
  112452. if (!defined_default(style)) {
  112453. clearStyle3(this, features);
  112454. return;
  112455. }
  112456. const batchIds = this._batchIds;
  112457. const length3 = batchIds.length;
  112458. for (let i2 = 0; i2 < length3; ++i2) {
  112459. const batchId = batchIds[i2];
  112460. const feature2 = features[batchId];
  112461. feature2.color = defined_default(style.color) ? style.color.evaluateColor(feature2, scratchColor9) : DEFAULT_COLOR_VALUE3;
  112462. feature2.show = defined_default(style.show) ? style.show.evaluate(feature2) : DEFAULT_SHOW_VALUE3;
  112463. }
  112464. };
  112465. Vector3DTilePolylines.prototype.update = function(frameState) {
  112466. const context = frameState.context;
  112467. createVertexArray5(this, context);
  112468. createUniformMap4(this, context);
  112469. createShaders3(this, context);
  112470. createRenderStates5(this);
  112471. if (!this._ready) {
  112472. return;
  112473. }
  112474. const passes = frameState.passes;
  112475. if (passes.render || passes.pick) {
  112476. queueCommands2(this, frameState);
  112477. }
  112478. };
  112479. Vector3DTilePolylines.prototype.isDestroyed = function() {
  112480. return false;
  112481. };
  112482. Vector3DTilePolylines.prototype.destroy = function() {
  112483. this._va = this._va && this._va.destroy();
  112484. this._sp = this._sp && this._sp.destroy();
  112485. return destroyObject_default(this);
  112486. };
  112487. var Vector3DTilePolylines_default = Vector3DTilePolylines;
  112488. // node_modules/cesium/Source/Shaders/Vector3DTileClampedPolylinesVS.js
  112489. var Vector3DTileClampedPolylinesVS_default = 'attribute vec3 startEllipsoidNormal;\nattribute vec3 endEllipsoidNormal;\nattribute vec4 startPositionAndHeight;\nattribute vec4 endPositionAndHeight;\nattribute vec4 startFaceNormalAndVertexCorner;\nattribute vec4 endFaceNormalAndHalfWidth;\nattribute float a_batchId;\n\nuniform mat4 u_modifiedModelView;\nuniform vec2 u_minimumMaximumVectorHeights;\n\nvarying vec4 v_startPlaneEC;\nvarying vec4 v_endPlaneEC;\nvarying vec4 v_rightPlaneEC;\nvarying float v_halfWidth;\nvarying vec3 v_volumeUpEC;\n\nvoid main()\n{\n // vertex corner IDs\n // 3-----------7\n // /| left /|\n // / | 1 / |\n // 2-----------6 5 end\n // | / | /\n // start |/ right |/\n // 0-----------4\n //\n float isEnd = floor(startFaceNormalAndVertexCorner.w * 0.251); // 0 for front, 1 for end\n float isTop = floor(startFaceNormalAndVertexCorner.w * mix(0.51, 0.19, isEnd)); // 0 for bottom, 1 for top\n\n vec3 forward = endPositionAndHeight.xyz - startPositionAndHeight.xyz;\n vec3 right = normalize(cross(forward, startEllipsoidNormal));\n\n vec4 position = vec4(startPositionAndHeight.xyz, 1.0);\n position.xyz += forward * isEnd;\n\n v_volumeUpEC = czm_normal * normalize(cross(right, forward));\n\n // Push for volume height\n float offset;\n vec3 ellipsoidNormal = mix(startEllipsoidNormal, endEllipsoidNormal, isEnd);\n\n // offset height to create volume\n offset = mix(startPositionAndHeight.w, endPositionAndHeight.w, isEnd);\n offset = mix(u_minimumMaximumVectorHeights.y, u_minimumMaximumVectorHeights.x, isTop) - offset;\n position.xyz += offset * ellipsoidNormal;\n\n // move from RTC to EC\n position = u_modifiedModelView * position;\n right = czm_normal * right;\n\n // Push for width in a direction that is in the start or end plane and in a plane with right\n // N = normalEC ("right-facing" direction for push)\n // R = right\n // p = angle between N and R\n // w = distance to push along R if R == N\n // d = distance to push along N\n //\n // N R\n // { p| } * cos(p) = dot(N, R) = w / d\n // d | |w * d = w / dot(N, R)\n // { | }\n // o---------- polyline segment ---->\n //\n vec3 scratchNormal = mix(-startFaceNormalAndVertexCorner.xyz, endFaceNormalAndHalfWidth.xyz, isEnd);\n scratchNormal = cross(scratchNormal, mix(startEllipsoidNormal, endEllipsoidNormal, isEnd));\n vec3 miterPushNormal = czm_normal * normalize(scratchNormal);\n\n offset = 2.0 * endFaceNormalAndHalfWidth.w * max(0.0, czm_metersPerPixel(position)); // offset = widthEC\n offset = offset / dot(miterPushNormal, right);\n position.xyz += miterPushNormal * (offset * sign(0.5 - mod(startFaceNormalAndVertexCorner.w, 2.0)));\n\n gl_Position = czm_depthClamp(czm_projection * position);\n\n position = u_modifiedModelView * vec4(startPositionAndHeight.xyz, 1.0);\n vec3 startNormalEC = czm_normal * startFaceNormalAndVertexCorner.xyz;\n v_startPlaneEC = vec4(startNormalEC, -dot(startNormalEC, position.xyz));\n v_rightPlaneEC = vec4(right, -dot(right, position.xyz));\n\n position = u_modifiedModelView * vec4(endPositionAndHeight.xyz, 1.0);\n vec3 endNormalEC = czm_normal * endFaceNormalAndHalfWidth.xyz;\n v_endPlaneEC = vec4(endNormalEC, -dot(endNormalEC, position.xyz));\n v_halfWidth = endFaceNormalAndHalfWidth.w;\n}\n';
  112490. // node_modules/cesium/Source/Shaders/Vector3DTileClampedPolylinesFS.js
  112491. var Vector3DTileClampedPolylinesFS_default = "#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\n\nvarying vec4 v_startPlaneEC;\nvarying vec4 v_endPlaneEC;\nvarying vec4 v_rightPlaneEC;\nvarying float v_halfWidth;\nvarying vec3 v_volumeUpEC;\n\nuniform vec4 u_highlightColor;\nvoid main()\n{\n float logDepthOrDepth = czm_branchFreeTernary(czm_sceneMode == czm_sceneMode2D, gl_FragCoord.z, czm_unpackDepth(texture2D(czm_globeDepthTexture, gl_FragCoord.xy / czm_viewport.zw)));\n\n // Discard for sky\n if (logDepthOrDepth == 0.0) {\n#ifdef DEBUG_SHOW_VOLUME\n gl_FragColor = vec4(0.0, 0.0, 1.0, 0.5);\n return;\n#else // DEBUG_SHOW_VOLUME\n discard;\n#endif // DEBUG_SHOW_VOLUME\n }\n\n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\n eyeCoordinate /= eyeCoordinate.w;\n\n float halfMaxWidth = v_halfWidth * czm_metersPerPixel(eyeCoordinate);\n\n // Expand halfMaxWidth if direction to camera is almost perpendicular with the volume's up direction\n halfMaxWidth += halfMaxWidth * (1.0 - dot(-normalize(eyeCoordinate.xyz), v_volumeUpEC));\n\n // Check distance of the eye coordinate against the right-facing plane\n float widthwiseDistance = czm_planeDistance(v_rightPlaneEC, eyeCoordinate.xyz);\n\n // Check eye coordinate against the mitering planes\n float distanceFromStart = czm_planeDistance(v_startPlaneEC, eyeCoordinate.xyz);\n float distanceFromEnd = czm_planeDistance(v_endPlaneEC, eyeCoordinate.xyz);\n\n if (abs(widthwiseDistance) > halfMaxWidth || distanceFromStart < 0.0 || distanceFromEnd < 0.0) {\n#ifdef DEBUG_SHOW_VOLUME\n gl_FragColor = vec4(logDepthOrDepth, 0.0, 0.0, 0.5);\n return;\n#else // DEBUG_SHOW_VOLUME\n discard;\n#endif // DEBUG_SHOW_VOLUME\n }\n gl_FragColor = u_highlightColor;\n\n czm_writeDepthClamp();\n}\n";
  112492. // node_modules/cesium/Source/Scene/Vector3DTileClampedPolylines.js
  112493. function Vector3DTileClampedPolylines(options) {
  112494. this._positions = options.positions;
  112495. this._widths = options.widths;
  112496. this._counts = options.counts;
  112497. this._batchIds = options.batchIds;
  112498. this._ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  112499. this._minimumHeight = options.minimumHeight;
  112500. this._maximumHeight = options.maximumHeight;
  112501. this._center = options.center;
  112502. this._rectangle = options.rectangle;
  112503. this._batchTable = options.batchTable;
  112504. this._va = void 0;
  112505. this._sp = void 0;
  112506. this._rs = void 0;
  112507. this._uniformMap = void 0;
  112508. this._command = void 0;
  112509. this._transferrableBatchIds = void 0;
  112510. this._packedBuffer = void 0;
  112511. this._minimumMaximumVectorHeights = new Cartesian2_default(
  112512. ApproximateTerrainHeights_default._defaultMinTerrainHeight,
  112513. ApproximateTerrainHeights_default._defaultMaxTerrainHeight
  112514. );
  112515. this._boundingVolume = OrientedBoundingBox_default.fromRectangle(
  112516. options.rectangle,
  112517. ApproximateTerrainHeights_default._defaultMinTerrainHeight,
  112518. ApproximateTerrainHeights_default._defaultMaxTerrainHeight,
  112519. this._ellipsoid
  112520. );
  112521. this._classificationType = options.classificationType;
  112522. this._keepDecodedPositions = options.keepDecodedPositions;
  112523. this._decodedPositions = void 0;
  112524. this._decodedPositionOffsets = void 0;
  112525. this._startEllipsoidNormals = void 0;
  112526. this._endEllipsoidNormals = void 0;
  112527. this._startPositionAndHeights = void 0;
  112528. this._startFaceNormalAndVertexCornerIds = void 0;
  112529. this._endPositionAndHeights = void 0;
  112530. this._endFaceNormalAndHalfWidths = void 0;
  112531. this._vertexBatchIds = void 0;
  112532. this._indices = void 0;
  112533. this._constantColor = Color_default.clone(Color_default.WHITE);
  112534. this._highlightColor = this._constantColor;
  112535. this._trianglesLength = 0;
  112536. this._geometryByteLength = 0;
  112537. this._ready = false;
  112538. this._readyPromise = defer_default();
  112539. this._verticesPromise = void 0;
  112540. const that = this;
  112541. ApproximateTerrainHeights_default.initialize().then(function() {
  112542. updateMinimumMaximumHeights(that, that._rectangle, that._ellipsoid);
  112543. }).catch(function(error) {
  112544. this._readyPromise.reject(error);
  112545. });
  112546. }
  112547. Object.defineProperties(Vector3DTileClampedPolylines.prototype, {
  112548. trianglesLength: {
  112549. get: function() {
  112550. return this._trianglesLength;
  112551. }
  112552. },
  112553. geometryByteLength: {
  112554. get: function() {
  112555. return this._geometryByteLength;
  112556. }
  112557. },
  112558. readyPromise: {
  112559. get: function() {
  112560. return this._readyPromise.promise;
  112561. }
  112562. }
  112563. });
  112564. function updateMinimumMaximumHeights(polylines, rectangle, ellipsoid) {
  112565. const result = ApproximateTerrainHeights_default.getMinimumMaximumHeights(
  112566. rectangle,
  112567. ellipsoid
  112568. );
  112569. const min3 = result.minimumTerrainHeight;
  112570. const max3 = result.maximumTerrainHeight;
  112571. const minimumMaximumVectorHeights = polylines._minimumMaximumVectorHeights;
  112572. minimumMaximumVectorHeights.x = min3;
  112573. minimumMaximumVectorHeights.y = max3;
  112574. const obb = polylines._boundingVolume;
  112575. const rect = polylines._rectangle;
  112576. OrientedBoundingBox_default.fromRectangle(rect, min3, max3, ellipsoid, obb);
  112577. }
  112578. function packBuffer5(polylines) {
  112579. const rectangle = polylines._rectangle;
  112580. const minimumHeight = polylines._minimumHeight;
  112581. const maximumHeight = polylines._maximumHeight;
  112582. const ellipsoid = polylines._ellipsoid;
  112583. const center = polylines._center;
  112584. const packedLength = 2 + Rectangle_default.packedLength + Ellipsoid_default.packedLength + Cartesian3_default.packedLength;
  112585. const packedBuffer = new Float64Array(packedLength);
  112586. let offset2 = 0;
  112587. packedBuffer[offset2++] = minimumHeight;
  112588. packedBuffer[offset2++] = maximumHeight;
  112589. Rectangle_default.pack(rectangle, packedBuffer, offset2);
  112590. offset2 += Rectangle_default.packedLength;
  112591. Ellipsoid_default.pack(ellipsoid, packedBuffer, offset2);
  112592. offset2 += Ellipsoid_default.packedLength;
  112593. Cartesian3_default.pack(center, packedBuffer, offset2);
  112594. return packedBuffer;
  112595. }
  112596. var createVerticesTaskProcessor5 = new TaskProcessor_default(
  112597. "createVectorTileClampedPolylines"
  112598. );
  112599. var attributeLocations4 = {
  112600. startEllipsoidNormal: 0,
  112601. endEllipsoidNormal: 1,
  112602. startPositionAndHeight: 2,
  112603. endPositionAndHeight: 3,
  112604. startFaceNormalAndVertexCorner: 4,
  112605. endFaceNormalAndHalfWidth: 5,
  112606. a_batchId: 6
  112607. };
  112608. function createVertexArray6(polylines, context) {
  112609. if (defined_default(polylines._va)) {
  112610. return;
  112611. }
  112612. if (!defined_default(polylines._verticesPromise)) {
  112613. let positions = polylines._positions;
  112614. let widths = polylines._widths;
  112615. let counts = polylines._counts;
  112616. let batchIds = polylines._transferrableBatchIds;
  112617. let packedBuffer = polylines._packedBuffer;
  112618. if (!defined_default(packedBuffer)) {
  112619. positions = polylines._positions = arraySlice_default(positions);
  112620. widths = polylines._widths = arraySlice_default(widths);
  112621. counts = polylines._counts = arraySlice_default(counts);
  112622. batchIds = polylines._transferrableBatchIds = arraySlice_default(
  112623. polylines._batchIds
  112624. );
  112625. packedBuffer = polylines._packedBuffer = packBuffer5(polylines);
  112626. }
  112627. const transferrableObjects = [
  112628. positions.buffer,
  112629. widths.buffer,
  112630. counts.buffer,
  112631. batchIds.buffer,
  112632. packedBuffer.buffer
  112633. ];
  112634. const parameters = {
  112635. positions: positions.buffer,
  112636. widths: widths.buffer,
  112637. counts: counts.buffer,
  112638. batchIds: batchIds.buffer,
  112639. packedBuffer: packedBuffer.buffer,
  112640. keepDecodedPositions: polylines._keepDecodedPositions
  112641. };
  112642. const verticesPromise = polylines._verticesPromise = createVerticesTaskProcessor5.scheduleTask(
  112643. parameters,
  112644. transferrableObjects
  112645. );
  112646. if (!defined_default(verticesPromise)) {
  112647. return;
  112648. }
  112649. Promise.resolve(verticesPromise).then(function(result) {
  112650. if (polylines._keepDecodedPositions) {
  112651. polylines._decodedPositions = new Float64Array(
  112652. result.decodedPositions
  112653. );
  112654. polylines._decodedPositionOffsets = new Uint32Array(
  112655. result.decodedPositionOffsets
  112656. );
  112657. }
  112658. polylines._startEllipsoidNormals = new Float32Array(
  112659. result.startEllipsoidNormals
  112660. );
  112661. polylines._endEllipsoidNormals = new Float32Array(
  112662. result.endEllipsoidNormals
  112663. );
  112664. polylines._startPositionAndHeights = new Float32Array(
  112665. result.startPositionAndHeights
  112666. );
  112667. polylines._startFaceNormalAndVertexCornerIds = new Float32Array(
  112668. result.startFaceNormalAndVertexCornerIds
  112669. );
  112670. polylines._endPositionAndHeights = new Float32Array(
  112671. result.endPositionAndHeights
  112672. );
  112673. polylines._endFaceNormalAndHalfWidths = new Float32Array(
  112674. result.endFaceNormalAndHalfWidths
  112675. );
  112676. polylines._vertexBatchIds = new Uint16Array(result.vertexBatchIds);
  112677. const indexDatatype = result.indexDatatype;
  112678. polylines._indices = indexDatatype === IndexDatatype_default.UNSIGNED_SHORT ? new Uint16Array(result.indices) : new Uint32Array(result.indices);
  112679. polylines._ready = true;
  112680. }).catch(function(error) {
  112681. polylines._readyPromise.reject(error);
  112682. });
  112683. }
  112684. if (polylines._ready && !defined_default(polylines._va)) {
  112685. const startEllipsoidNormals = polylines._startEllipsoidNormals;
  112686. const endEllipsoidNormals = polylines._endEllipsoidNormals;
  112687. const startPositionAndHeights = polylines._startPositionAndHeights;
  112688. const endPositionAndHeights = polylines._endPositionAndHeights;
  112689. const startFaceNormalAndVertexCornerIds = polylines._startFaceNormalAndVertexCornerIds;
  112690. const endFaceNormalAndHalfWidths = polylines._endFaceNormalAndHalfWidths;
  112691. const batchIdAttribute = polylines._vertexBatchIds;
  112692. const indices2 = polylines._indices;
  112693. let byteLength = startEllipsoidNormals.byteLength + endEllipsoidNormals.byteLength;
  112694. byteLength += startPositionAndHeights.byteLength + endPositionAndHeights.byteLength;
  112695. byteLength += startFaceNormalAndVertexCornerIds.byteLength + endFaceNormalAndHalfWidths.byteLength;
  112696. byteLength += batchIdAttribute.byteLength + indices2.byteLength;
  112697. polylines._trianglesLength = indices2.length / 3;
  112698. polylines._geometryByteLength = byteLength;
  112699. const startEllipsoidNormalsBuffer = Buffer_default.createVertexBuffer({
  112700. context,
  112701. typedArray: startEllipsoidNormals,
  112702. usage: BufferUsage_default.STATIC_DRAW
  112703. });
  112704. const endEllipsoidNormalsBuffer = Buffer_default.createVertexBuffer({
  112705. context,
  112706. typedArray: endEllipsoidNormals,
  112707. usage: BufferUsage_default.STATIC_DRAW
  112708. });
  112709. const startPositionAndHeightsBuffer = Buffer_default.createVertexBuffer({
  112710. context,
  112711. typedArray: startPositionAndHeights,
  112712. usage: BufferUsage_default.STATIC_DRAW
  112713. });
  112714. const endPositionAndHeightsBuffer = Buffer_default.createVertexBuffer({
  112715. context,
  112716. typedArray: endPositionAndHeights,
  112717. usage: BufferUsage_default.STATIC_DRAW
  112718. });
  112719. const startFaceNormalAndVertexCornerIdsBuffer = Buffer_default.createVertexBuffer({
  112720. context,
  112721. typedArray: startFaceNormalAndVertexCornerIds,
  112722. usage: BufferUsage_default.STATIC_DRAW
  112723. });
  112724. const endFaceNormalAndHalfWidthsBuffer = Buffer_default.createVertexBuffer({
  112725. context,
  112726. typedArray: endFaceNormalAndHalfWidths,
  112727. usage: BufferUsage_default.STATIC_DRAW
  112728. });
  112729. const batchIdAttributeBuffer = Buffer_default.createVertexBuffer({
  112730. context,
  112731. typedArray: batchIdAttribute,
  112732. usage: BufferUsage_default.STATIC_DRAW
  112733. });
  112734. const indexBuffer = Buffer_default.createIndexBuffer({
  112735. context,
  112736. typedArray: indices2,
  112737. usage: BufferUsage_default.STATIC_DRAW,
  112738. indexDatatype: indices2.BYTES_PER_ELEMENT === 2 ? IndexDatatype_default.UNSIGNED_SHORT : IndexDatatype_default.UNSIGNED_INT
  112739. });
  112740. const vertexAttributes = [
  112741. {
  112742. index: attributeLocations4.startEllipsoidNormal,
  112743. vertexBuffer: startEllipsoidNormalsBuffer,
  112744. componentDatatype: ComponentDatatype_default.FLOAT,
  112745. componentsPerAttribute: 3
  112746. },
  112747. {
  112748. index: attributeLocations4.endEllipsoidNormal,
  112749. vertexBuffer: endEllipsoidNormalsBuffer,
  112750. componentDatatype: ComponentDatatype_default.FLOAT,
  112751. componentsPerAttribute: 3
  112752. },
  112753. {
  112754. index: attributeLocations4.startPositionAndHeight,
  112755. vertexBuffer: startPositionAndHeightsBuffer,
  112756. componentDatatype: ComponentDatatype_default.FLOAT,
  112757. componentsPerAttribute: 4
  112758. },
  112759. {
  112760. index: attributeLocations4.endPositionAndHeight,
  112761. vertexBuffer: endPositionAndHeightsBuffer,
  112762. componentDatatype: ComponentDatatype_default.FLOAT,
  112763. componentsPerAttribute: 4
  112764. },
  112765. {
  112766. index: attributeLocations4.startFaceNormalAndVertexCorner,
  112767. vertexBuffer: startFaceNormalAndVertexCornerIdsBuffer,
  112768. componentDatatype: ComponentDatatype_default.FLOAT,
  112769. componentsPerAttribute: 4
  112770. },
  112771. {
  112772. index: attributeLocations4.endFaceNormalAndHalfWidth,
  112773. vertexBuffer: endFaceNormalAndHalfWidthsBuffer,
  112774. componentDatatype: ComponentDatatype_default.FLOAT,
  112775. componentsPerAttribute: 4
  112776. },
  112777. {
  112778. index: attributeLocations4.a_batchId,
  112779. vertexBuffer: batchIdAttributeBuffer,
  112780. componentDatatype: ComponentDatatype_default.UNSIGNED_SHORT,
  112781. componentsPerAttribute: 1
  112782. }
  112783. ];
  112784. polylines._va = new VertexArray_default({
  112785. context,
  112786. attributes: vertexAttributes,
  112787. indexBuffer
  112788. });
  112789. polylines._positions = void 0;
  112790. polylines._widths = void 0;
  112791. polylines._counts = void 0;
  112792. polylines._ellipsoid = void 0;
  112793. polylines._minimumHeight = void 0;
  112794. polylines._maximumHeight = void 0;
  112795. polylines._rectangle = void 0;
  112796. polylines._transferrableBatchIds = void 0;
  112797. polylines._packedBuffer = void 0;
  112798. polylines._startEllipsoidNormals = void 0;
  112799. polylines._endEllipsoidNormals = void 0;
  112800. polylines._startPositionAndHeights = void 0;
  112801. polylines._startFaceNormalAndVertexCornerIds = void 0;
  112802. polylines._endPositionAndHeights = void 0;
  112803. polylines._endFaceNormalAndHalfWidths = void 0;
  112804. polylines._vertexBatchIds = void 0;
  112805. polylines._indices = void 0;
  112806. polylines._readyPromise.resolve();
  112807. }
  112808. }
  112809. var modifiedModelViewScratch4 = new Matrix4_default();
  112810. var rtcScratch4 = new Cartesian3_default();
  112811. function createUniformMap5(primitive, context) {
  112812. if (defined_default(primitive._uniformMap)) {
  112813. return;
  112814. }
  112815. primitive._uniformMap = {
  112816. u_modifiedModelView: function() {
  112817. const viewMatrix = context.uniformState.view;
  112818. Matrix4_default.clone(viewMatrix, modifiedModelViewScratch4);
  112819. Matrix4_default.multiplyByPoint(
  112820. modifiedModelViewScratch4,
  112821. primitive._center,
  112822. rtcScratch4
  112823. );
  112824. Matrix4_default.setTranslation(
  112825. modifiedModelViewScratch4,
  112826. rtcScratch4,
  112827. modifiedModelViewScratch4
  112828. );
  112829. return modifiedModelViewScratch4;
  112830. },
  112831. u_highlightColor: function() {
  112832. return primitive._highlightColor;
  112833. },
  112834. u_minimumMaximumVectorHeights: function() {
  112835. return primitive._minimumMaximumVectorHeights;
  112836. }
  112837. };
  112838. }
  112839. function getRenderState2(mask3DTiles) {
  112840. return RenderState_default.fromCache({
  112841. cull: {
  112842. enabled: true,
  112843. face: CullFace_default.FRONT
  112844. },
  112845. blending: BlendingState_default.PRE_MULTIPLIED_ALPHA_BLEND,
  112846. depthMask: false,
  112847. stencilTest: {
  112848. enabled: mask3DTiles,
  112849. frontFunction: StencilFunction_default.EQUAL,
  112850. frontOperation: {
  112851. fail: StencilOperation_default.KEEP,
  112852. zFail: StencilOperation_default.KEEP,
  112853. zPass: StencilOperation_default.KEEP
  112854. },
  112855. backFunction: StencilFunction_default.EQUAL,
  112856. backOperation: {
  112857. fail: StencilOperation_default.KEEP,
  112858. zFail: StencilOperation_default.KEEP,
  112859. zPass: StencilOperation_default.KEEP
  112860. },
  112861. reference: StencilConstants_default.CESIUM_3D_TILE_MASK,
  112862. mask: StencilConstants_default.CESIUM_3D_TILE_MASK
  112863. }
  112864. });
  112865. }
  112866. function createRenderStates6(primitive) {
  112867. if (defined_default(primitive._rs)) {
  112868. return;
  112869. }
  112870. primitive._rs = getRenderState2(false);
  112871. primitive._rs3DTiles = getRenderState2(true);
  112872. }
  112873. function createShaders4(primitive, context) {
  112874. if (defined_default(primitive._sp)) {
  112875. return;
  112876. }
  112877. const batchTable = primitive._batchTable;
  112878. const vsSource = batchTable.getVertexShaderCallback(
  112879. false,
  112880. "a_batchId",
  112881. void 0
  112882. )(Vector3DTileClampedPolylinesVS_default);
  112883. const fsSource = batchTable.getFragmentShaderCallback(
  112884. false,
  112885. void 0,
  112886. true
  112887. )(Vector3DTileClampedPolylinesFS_default);
  112888. const vs = new ShaderSource_default({
  112889. defines: [
  112890. "VECTOR_TILE",
  112891. !FeatureDetection_default.isInternetExplorer() ? "CLIP_POLYLINE" : ""
  112892. ],
  112893. sources: [PolylineCommon_default, vsSource]
  112894. });
  112895. const fs = new ShaderSource_default({
  112896. defines: ["VECTOR_TILE"],
  112897. sources: [fsSource]
  112898. });
  112899. primitive._sp = ShaderProgram_default.fromCache({
  112900. context,
  112901. vertexShaderSource: vs,
  112902. fragmentShaderSource: fs,
  112903. attributeLocations: attributeLocations4
  112904. });
  112905. }
  112906. function queueCommands3(primitive, frameState) {
  112907. let command = primitive._command;
  112908. if (!defined_default(primitive._command)) {
  112909. const uniformMap2 = primitive._batchTable.getUniformMapCallback()(
  112910. primitive._uniformMap
  112911. );
  112912. command = primitive._command = new DrawCommand_default({
  112913. owner: primitive,
  112914. vertexArray: primitive._va,
  112915. renderState: primitive._rs,
  112916. shaderProgram: primitive._sp,
  112917. uniformMap: uniformMap2,
  112918. boundingVolume: primitive._boundingVolume,
  112919. pass: Pass_default.TERRAIN_CLASSIFICATION,
  112920. pickId: primitive._batchTable.getPickId()
  112921. });
  112922. const derivedTilesetCommand = DrawCommand_default.shallowClone(
  112923. command,
  112924. command.derivedCommands.tileset
  112925. );
  112926. derivedTilesetCommand.renderState = primitive._rs3DTiles;
  112927. derivedTilesetCommand.pass = Pass_default.CESIUM_3D_TILE_CLASSIFICATION;
  112928. command.derivedCommands.tileset = derivedTilesetCommand;
  112929. }
  112930. const classificationType = primitive._classificationType;
  112931. if (classificationType === ClassificationType_default.TERRAIN || classificationType === ClassificationType_default.BOTH) {
  112932. frameState.commandList.push(command);
  112933. }
  112934. if (classificationType === ClassificationType_default.CESIUM_3D_TILE || classificationType === ClassificationType_default.BOTH) {
  112935. frameState.commandList.push(command.derivedCommands.tileset);
  112936. }
  112937. }
  112938. Vector3DTileClampedPolylines.prototype.getPositions = function(batchId) {
  112939. return Vector3DTilePolylines_default.getPolylinePositions(this, batchId);
  112940. };
  112941. Vector3DTileClampedPolylines.prototype.createFeatures = function(content, features) {
  112942. const batchIds = this._batchIds;
  112943. const length3 = batchIds.length;
  112944. for (let i2 = 0; i2 < length3; ++i2) {
  112945. const batchId = batchIds[i2];
  112946. features[batchId] = new Cesium3DTileFeature_default(content, batchId);
  112947. }
  112948. };
  112949. Vector3DTileClampedPolylines.prototype.applyDebugSettings = function(enabled, color) {
  112950. this._highlightColor = enabled ? color : this._constantColor;
  112951. };
  112952. function clearStyle4(polygons, features) {
  112953. const batchIds = polygons._batchIds;
  112954. const length3 = batchIds.length;
  112955. for (let i2 = 0; i2 < length3; ++i2) {
  112956. const batchId = batchIds[i2];
  112957. const feature2 = features[batchId];
  112958. feature2.show = true;
  112959. feature2.color = Color_default.WHITE;
  112960. }
  112961. }
  112962. var scratchColor10 = new Color_default();
  112963. var DEFAULT_COLOR_VALUE4 = Color_default.WHITE;
  112964. var DEFAULT_SHOW_VALUE4 = true;
  112965. Vector3DTileClampedPolylines.prototype.applyStyle = function(style, features) {
  112966. if (!defined_default(style)) {
  112967. clearStyle4(this, features);
  112968. return;
  112969. }
  112970. const batchIds = this._batchIds;
  112971. const length3 = batchIds.length;
  112972. for (let i2 = 0; i2 < length3; ++i2) {
  112973. const batchId = batchIds[i2];
  112974. const feature2 = features[batchId];
  112975. feature2.color = defined_default(style.color) ? style.color.evaluateColor(feature2, scratchColor10) : DEFAULT_COLOR_VALUE4;
  112976. feature2.show = defined_default(style.show) ? style.show.evaluate(feature2) : DEFAULT_SHOW_VALUE4;
  112977. }
  112978. };
  112979. Vector3DTileClampedPolylines.prototype.update = function(frameState) {
  112980. const context = frameState.context;
  112981. createVertexArray6(this, context);
  112982. createUniformMap5(this, context);
  112983. createShaders4(this, context);
  112984. createRenderStates6(this);
  112985. if (!this._ready) {
  112986. return;
  112987. }
  112988. const passes = frameState.passes;
  112989. if (passes.render || passes.pick) {
  112990. queueCommands3(this, frameState);
  112991. }
  112992. };
  112993. Vector3DTileClampedPolylines.prototype.isDestroyed = function() {
  112994. return false;
  112995. };
  112996. Vector3DTileClampedPolylines.prototype.destroy = function() {
  112997. this._va = this._va && this._va.destroy();
  112998. this._sp = this._sp && this._sp.destroy();
  112999. return destroyObject_default(this);
  113000. };
  113001. var Vector3DTileClampedPolylines_default = Vector3DTileClampedPolylines;
  113002. // node_modules/cesium/Source/Scene/Vector3DTileContent.js
  113003. function Vector3DTileContent(tileset, tile, resource, arrayBuffer, byteOffset) {
  113004. this._tileset = tileset;
  113005. this._tile = tile;
  113006. this._resource = resource;
  113007. this._polygons = void 0;
  113008. this._polylines = void 0;
  113009. this._points = void 0;
  113010. this._contentReadyPromise = void 0;
  113011. this._readyPromise = defer_default();
  113012. this._metadata = void 0;
  113013. this._batchTable = void 0;
  113014. this._features = void 0;
  113015. this.featurePropertiesDirty = false;
  113016. this._group = void 0;
  113017. initialize12(this, arrayBuffer, byteOffset);
  113018. }
  113019. Object.defineProperties(Vector3DTileContent.prototype, {
  113020. featuresLength: {
  113021. get: function() {
  113022. return defined_default(this._batchTable) ? this._batchTable.featuresLength : 0;
  113023. }
  113024. },
  113025. pointsLength: {
  113026. get: function() {
  113027. if (defined_default(this._points)) {
  113028. return this._points.pointsLength;
  113029. }
  113030. return 0;
  113031. }
  113032. },
  113033. trianglesLength: {
  113034. get: function() {
  113035. let trianglesLength = 0;
  113036. if (defined_default(this._polygons)) {
  113037. trianglesLength += this._polygons.trianglesLength;
  113038. }
  113039. if (defined_default(this._polylines)) {
  113040. trianglesLength += this._polylines.trianglesLength;
  113041. }
  113042. return trianglesLength;
  113043. }
  113044. },
  113045. geometryByteLength: {
  113046. get: function() {
  113047. let geometryByteLength = 0;
  113048. if (defined_default(this._polygons)) {
  113049. geometryByteLength += this._polygons.geometryByteLength;
  113050. }
  113051. if (defined_default(this._polylines)) {
  113052. geometryByteLength += this._polylines.geometryByteLength;
  113053. }
  113054. return geometryByteLength;
  113055. }
  113056. },
  113057. texturesByteLength: {
  113058. get: function() {
  113059. if (defined_default(this._points)) {
  113060. return this._points.texturesByteLength;
  113061. }
  113062. return 0;
  113063. }
  113064. },
  113065. batchTableByteLength: {
  113066. get: function() {
  113067. return defined_default(this._batchTable) ? this._batchTable.memorySizeInBytes : 0;
  113068. }
  113069. },
  113070. innerContents: {
  113071. get: function() {
  113072. return void 0;
  113073. }
  113074. },
  113075. readyPromise: {
  113076. get: function() {
  113077. return this._readyPromise.promise;
  113078. }
  113079. },
  113080. tileset: {
  113081. get: function() {
  113082. return this._tileset;
  113083. }
  113084. },
  113085. tile: {
  113086. get: function() {
  113087. return this._tile;
  113088. }
  113089. },
  113090. url: {
  113091. get: function() {
  113092. return this._resource.getUrlComponent(true);
  113093. }
  113094. },
  113095. metadata: {
  113096. get: function() {
  113097. return this._metadata;
  113098. },
  113099. set: function(value) {
  113100. this._metadata = value;
  113101. }
  113102. },
  113103. batchTable: {
  113104. get: function() {
  113105. return this._batchTable;
  113106. }
  113107. },
  113108. group: {
  113109. get: function() {
  113110. return this._group;
  113111. },
  113112. set: function(value) {
  113113. this._group = value;
  113114. }
  113115. }
  113116. });
  113117. function createColorChangedCallback3(content) {
  113118. return function(batchId, color) {
  113119. if (defined_default(content._polygons)) {
  113120. content._polygons.updateCommands(batchId, color);
  113121. }
  113122. };
  113123. }
  113124. function getBatchIds2(featureTableJson, featureTableBinary) {
  113125. let polygonBatchIds;
  113126. let polylineBatchIds;
  113127. let pointBatchIds;
  113128. let i2;
  113129. const numberOfPolygons = defaultValue_default(featureTableJson.POLYGONS_LENGTH, 0);
  113130. const numberOfPolylines = defaultValue_default(featureTableJson.POLYLINES_LENGTH, 0);
  113131. const numberOfPoints = defaultValue_default(featureTableJson.POINTS_LENGTH, 0);
  113132. if (numberOfPolygons > 0 && defined_default(featureTableJson.POLYGON_BATCH_IDS)) {
  113133. const polygonBatchIdsByteOffset = featureTableBinary.byteOffset + featureTableJson.POLYGON_BATCH_IDS.byteOffset;
  113134. polygonBatchIds = new Uint16Array(
  113135. featureTableBinary.buffer,
  113136. polygonBatchIdsByteOffset,
  113137. numberOfPolygons
  113138. );
  113139. }
  113140. if (numberOfPolylines > 0 && defined_default(featureTableJson.POLYLINE_BATCH_IDS)) {
  113141. const polylineBatchIdsByteOffset = featureTableBinary.byteOffset + featureTableJson.POLYLINE_BATCH_IDS.byteOffset;
  113142. polylineBatchIds = new Uint16Array(
  113143. featureTableBinary.buffer,
  113144. polylineBatchIdsByteOffset,
  113145. numberOfPolylines
  113146. );
  113147. }
  113148. if (numberOfPoints > 0 && defined_default(featureTableJson.POINT_BATCH_IDS)) {
  113149. const pointBatchIdsByteOffset = featureTableBinary.byteOffset + featureTableJson.POINT_BATCH_IDS.byteOffset;
  113150. pointBatchIds = new Uint16Array(
  113151. featureTableBinary.buffer,
  113152. pointBatchIdsByteOffset,
  113153. numberOfPoints
  113154. );
  113155. }
  113156. const atLeastOneDefined = defined_default(polygonBatchIds) || defined_default(polylineBatchIds) || defined_default(pointBatchIds);
  113157. const atLeastOneUndefined = numberOfPolygons > 0 && !defined_default(polygonBatchIds) || numberOfPolylines > 0 && !defined_default(polylineBatchIds) || numberOfPoints > 0 && !defined_default(pointBatchIds);
  113158. if (atLeastOneDefined && atLeastOneUndefined) {
  113159. throw new RuntimeError_default(
  113160. "If one group of batch ids is defined, then all batch ids must be defined."
  113161. );
  113162. }
  113163. const allUndefinedBatchIds = !defined_default(polygonBatchIds) && !defined_default(polylineBatchIds) && !defined_default(pointBatchIds);
  113164. if (allUndefinedBatchIds) {
  113165. let id = 0;
  113166. if (!defined_default(polygonBatchIds) && numberOfPolygons > 0) {
  113167. polygonBatchIds = new Uint16Array(numberOfPolygons);
  113168. for (i2 = 0; i2 < numberOfPolygons; ++i2) {
  113169. polygonBatchIds[i2] = id++;
  113170. }
  113171. }
  113172. if (!defined_default(polylineBatchIds) && numberOfPolylines > 0) {
  113173. polylineBatchIds = new Uint16Array(numberOfPolylines);
  113174. for (i2 = 0; i2 < numberOfPolylines; ++i2) {
  113175. polylineBatchIds[i2] = id++;
  113176. }
  113177. }
  113178. if (!defined_default(pointBatchIds) && numberOfPoints > 0) {
  113179. pointBatchIds = new Uint16Array(numberOfPoints);
  113180. for (i2 = 0; i2 < numberOfPoints; ++i2) {
  113181. pointBatchIds[i2] = id++;
  113182. }
  113183. }
  113184. }
  113185. return {
  113186. polygons: polygonBatchIds,
  113187. polylines: polylineBatchIds,
  113188. points: pointBatchIds
  113189. };
  113190. }
  113191. var sizeOfUint328 = Uint32Array.BYTES_PER_ELEMENT;
  113192. function createFloatingPolylines(options) {
  113193. return new Vector3DTilePolylines_default(options);
  113194. }
  113195. function createClampedPolylines(options) {
  113196. return new Vector3DTileClampedPolylines_default(options);
  113197. }
  113198. function initialize12(content, arrayBuffer, byteOffset) {
  113199. byteOffset = defaultValue_default(byteOffset, 0);
  113200. const uint8Array = new Uint8Array(arrayBuffer);
  113201. const view = new DataView(arrayBuffer);
  113202. byteOffset += sizeOfUint328;
  113203. const version = view.getUint32(byteOffset, true);
  113204. if (version !== 1) {
  113205. throw new RuntimeError_default(
  113206. `Only Vector tile version 1 is supported. Version ${version} is not.`
  113207. );
  113208. }
  113209. byteOffset += sizeOfUint328;
  113210. const byteLength = view.getUint32(byteOffset, true);
  113211. byteOffset += sizeOfUint328;
  113212. if (byteLength === 0) {
  113213. content._readyPromise.resolve(content);
  113214. return;
  113215. }
  113216. const featureTableJSONByteLength = view.getUint32(byteOffset, true);
  113217. byteOffset += sizeOfUint328;
  113218. if (featureTableJSONByteLength === 0) {
  113219. throw new RuntimeError_default(
  113220. "Feature table must have a byte length greater than zero"
  113221. );
  113222. }
  113223. const featureTableBinaryByteLength = view.getUint32(byteOffset, true);
  113224. byteOffset += sizeOfUint328;
  113225. const batchTableJSONByteLength = view.getUint32(byteOffset, true);
  113226. byteOffset += sizeOfUint328;
  113227. const batchTableBinaryByteLength = view.getUint32(byteOffset, true);
  113228. byteOffset += sizeOfUint328;
  113229. const indicesByteLength = view.getUint32(byteOffset, true);
  113230. byteOffset += sizeOfUint328;
  113231. const positionByteLength = view.getUint32(byteOffset, true);
  113232. byteOffset += sizeOfUint328;
  113233. const polylinePositionByteLength = view.getUint32(byteOffset, true);
  113234. byteOffset += sizeOfUint328;
  113235. const pointsPositionByteLength = view.getUint32(byteOffset, true);
  113236. byteOffset += sizeOfUint328;
  113237. const featureTableJson = getJsonFromTypedArray_default(
  113238. uint8Array,
  113239. byteOffset,
  113240. featureTableJSONByteLength
  113241. );
  113242. byteOffset += featureTableJSONByteLength;
  113243. const featureTableBinary = new Uint8Array(
  113244. arrayBuffer,
  113245. byteOffset,
  113246. featureTableBinaryByteLength
  113247. );
  113248. byteOffset += featureTableBinaryByteLength;
  113249. let batchTableJson;
  113250. let batchTableBinary;
  113251. if (batchTableJSONByteLength > 0) {
  113252. batchTableJson = getJsonFromTypedArray_default(
  113253. uint8Array,
  113254. byteOffset,
  113255. batchTableJSONByteLength
  113256. );
  113257. byteOffset += batchTableJSONByteLength;
  113258. if (batchTableBinaryByteLength > 0) {
  113259. batchTableBinary = new Uint8Array(
  113260. arrayBuffer,
  113261. byteOffset,
  113262. batchTableBinaryByteLength
  113263. );
  113264. batchTableBinary = new Uint8Array(batchTableBinary);
  113265. byteOffset += batchTableBinaryByteLength;
  113266. }
  113267. }
  113268. const numberOfPolygons = defaultValue_default(featureTableJson.POLYGONS_LENGTH, 0);
  113269. const numberOfPolylines = defaultValue_default(featureTableJson.POLYLINES_LENGTH, 0);
  113270. const numberOfPoints = defaultValue_default(featureTableJson.POINTS_LENGTH, 0);
  113271. const totalPrimitives = numberOfPolygons + numberOfPolylines + numberOfPoints;
  113272. const batchTable = new Cesium3DTileBatchTable_default(
  113273. content,
  113274. totalPrimitives,
  113275. batchTableJson,
  113276. batchTableBinary,
  113277. createColorChangedCallback3(content)
  113278. );
  113279. content._batchTable = batchTable;
  113280. if (totalPrimitives === 0) {
  113281. return;
  113282. }
  113283. const featureTable = new Cesium3DTileFeatureTable_default(
  113284. featureTableJson,
  113285. featureTableBinary
  113286. );
  113287. const region = featureTable.getGlobalProperty("REGION");
  113288. if (!defined_default(region)) {
  113289. throw new RuntimeError_default(
  113290. "Feature table global property: REGION must be defined"
  113291. );
  113292. }
  113293. const rectangle = Rectangle_default.unpack(region);
  113294. const minHeight = region[4];
  113295. const maxHeight = region[5];
  113296. const modelMatrix = content._tile.computedTransform;
  113297. let center = featureTable.getGlobalProperty(
  113298. "RTC_CENTER",
  113299. ComponentDatatype_default.FLOAT,
  113300. 3
  113301. );
  113302. if (defined_default(center)) {
  113303. center = Cartesian3_default.unpack(center);
  113304. Matrix4_default.multiplyByPoint(modelMatrix, center, center);
  113305. } else {
  113306. center = Rectangle_default.center(rectangle);
  113307. center.height = Math_default.lerp(minHeight, maxHeight, 0.5);
  113308. center = Ellipsoid_default.WGS84.cartographicToCartesian(center);
  113309. }
  113310. const batchIds = getBatchIds2(featureTableJson, featureTableBinary);
  113311. byteOffset += (4 - byteOffset % 4) % 4;
  113312. if (numberOfPolygons > 0) {
  113313. featureTable.featuresLength = numberOfPolygons;
  113314. const polygonCounts = defaultValue_default(
  113315. featureTable.getPropertyArray(
  113316. "POLYGON_COUNTS",
  113317. ComponentDatatype_default.UNSIGNED_INT,
  113318. 1
  113319. ),
  113320. featureTable.getPropertyArray(
  113321. "POLYGON_COUNT",
  113322. ComponentDatatype_default.UNSIGNED_INT,
  113323. 1
  113324. )
  113325. );
  113326. if (!defined_default(polygonCounts)) {
  113327. throw new RuntimeError_default(
  113328. "Feature table property: POLYGON_COUNTS must be defined when POLYGONS_LENGTH is greater than 0"
  113329. );
  113330. }
  113331. const polygonIndexCounts = defaultValue_default(
  113332. featureTable.getPropertyArray(
  113333. "POLYGON_INDEX_COUNTS",
  113334. ComponentDatatype_default.UNSIGNED_INT,
  113335. 1
  113336. ),
  113337. featureTable.getPropertyArray(
  113338. "POLYGON_INDEX_COUNT",
  113339. ComponentDatatype_default.UNSIGNED_INT,
  113340. 1
  113341. )
  113342. );
  113343. if (!defined_default(polygonIndexCounts)) {
  113344. throw new RuntimeError_default(
  113345. "Feature table property: POLYGON_INDEX_COUNTS must be defined when POLYGONS_LENGTH is greater than 0"
  113346. );
  113347. }
  113348. const numPolygonPositions = polygonCounts.reduce(function(total, count) {
  113349. return total + count * 2;
  113350. }, 0);
  113351. const numPolygonIndices = polygonIndexCounts.reduce(
  113352. function(total, count) {
  113353. return total + count;
  113354. },
  113355. 0
  113356. );
  113357. const indices2 = new Uint32Array(arrayBuffer, byteOffset, numPolygonIndices);
  113358. byteOffset += indicesByteLength;
  113359. const polygonPositions = new Uint16Array(
  113360. arrayBuffer,
  113361. byteOffset,
  113362. numPolygonPositions
  113363. );
  113364. byteOffset += positionByteLength;
  113365. let polygonMinimumHeights;
  113366. let polygonMaximumHeights;
  113367. if (defined_default(featureTableJson.POLYGON_MINIMUM_HEIGHTS) && defined_default(featureTableJson.POLYGON_MAXIMUM_HEIGHTS)) {
  113368. polygonMinimumHeights = featureTable.getPropertyArray(
  113369. "POLYGON_MINIMUM_HEIGHTS",
  113370. ComponentDatatype_default.FLOAT,
  113371. 1
  113372. );
  113373. polygonMaximumHeights = featureTable.getPropertyArray(
  113374. "POLYGON_MAXIMUM_HEIGHTS",
  113375. ComponentDatatype_default.FLOAT,
  113376. 1
  113377. );
  113378. }
  113379. content._polygons = new Vector3DTilePolygons_default({
  113380. positions: polygonPositions,
  113381. counts: polygonCounts,
  113382. indexCounts: polygonIndexCounts,
  113383. indices: indices2,
  113384. minimumHeight: minHeight,
  113385. maximumHeight: maxHeight,
  113386. polygonMinimumHeights,
  113387. polygonMaximumHeights,
  113388. center,
  113389. rectangle,
  113390. boundingVolume: content.tile.boundingVolume.boundingVolume,
  113391. batchTable,
  113392. batchIds: batchIds.polygons,
  113393. modelMatrix
  113394. });
  113395. }
  113396. if (numberOfPolylines > 0) {
  113397. featureTable.featuresLength = numberOfPolylines;
  113398. const polylineCounts = defaultValue_default(
  113399. featureTable.getPropertyArray(
  113400. "POLYLINE_COUNTS",
  113401. ComponentDatatype_default.UNSIGNED_INT,
  113402. 1
  113403. ),
  113404. featureTable.getPropertyArray(
  113405. "POLYLINE_COUNT",
  113406. ComponentDatatype_default.UNSIGNED_INT,
  113407. 1
  113408. )
  113409. );
  113410. if (!defined_default(polylineCounts)) {
  113411. throw new RuntimeError_default(
  113412. "Feature table property: POLYLINE_COUNTS must be defined when POLYLINES_LENGTH is greater than 0"
  113413. );
  113414. }
  113415. let widths = featureTable.getPropertyArray(
  113416. "POLYLINE_WIDTHS",
  113417. ComponentDatatype_default.UNSIGNED_SHORT,
  113418. 1
  113419. );
  113420. if (!defined_default(widths)) {
  113421. widths = new Uint16Array(numberOfPolylines);
  113422. for (let i2 = 0; i2 < numberOfPolylines; ++i2) {
  113423. widths[i2] = 2;
  113424. }
  113425. }
  113426. const numPolylinePositions = polylineCounts.reduce(function(total, count) {
  113427. return total + count * 3;
  113428. }, 0);
  113429. const polylinePositions = new Uint16Array(
  113430. arrayBuffer,
  113431. byteOffset,
  113432. numPolylinePositions
  113433. );
  113434. byteOffset += polylinePositionByteLength;
  113435. const tileset = content._tileset;
  113436. const examineVectorLinesFunction = tileset.examineVectorLinesFunction;
  113437. if (defined_default(examineVectorLinesFunction)) {
  113438. const decodedPositions = decodeVectorPolylinePositions_default(
  113439. new Uint16Array(polylinePositions),
  113440. rectangle,
  113441. minHeight,
  113442. maxHeight,
  113443. Ellipsoid_default.WGS84
  113444. );
  113445. examineVectorLines(
  113446. decodedPositions,
  113447. polylineCounts,
  113448. batchIds.polylines,
  113449. batchTable,
  113450. content.url,
  113451. examineVectorLinesFunction
  113452. );
  113453. }
  113454. let createPolylines = createFloatingPolylines;
  113455. if (defined_default(tileset.classificationType)) {
  113456. createPolylines = createClampedPolylines;
  113457. }
  113458. content._polylines = createPolylines({
  113459. positions: polylinePositions,
  113460. widths,
  113461. counts: polylineCounts,
  113462. batchIds: batchIds.polylines,
  113463. minimumHeight: minHeight,
  113464. maximumHeight: maxHeight,
  113465. center,
  113466. rectangle,
  113467. boundingVolume: content.tile.boundingVolume.boundingVolume,
  113468. batchTable,
  113469. classificationType: tileset.classificationType,
  113470. keepDecodedPositions: tileset.vectorKeepDecodedPositions
  113471. });
  113472. }
  113473. if (numberOfPoints > 0) {
  113474. const pointPositions = new Uint16Array(
  113475. arrayBuffer,
  113476. byteOffset,
  113477. numberOfPoints * 3
  113478. );
  113479. byteOffset += pointsPositionByteLength;
  113480. content._points = new Vector3DTilePoints_default({
  113481. positions: pointPositions,
  113482. batchIds: batchIds.points,
  113483. minimumHeight: minHeight,
  113484. maximumHeight: maxHeight,
  113485. rectangle,
  113486. batchTable
  113487. });
  113488. }
  113489. }
  113490. function createFeatures5(content) {
  113491. const featuresLength = content.featuresLength;
  113492. if (!defined_default(content._features) && featuresLength > 0) {
  113493. const features = new Array(featuresLength);
  113494. if (defined_default(content._polygons)) {
  113495. content._polygons.createFeatures(content, features);
  113496. }
  113497. if (defined_default(content._polylines)) {
  113498. content._polylines.createFeatures(content, features);
  113499. }
  113500. if (defined_default(content._points)) {
  113501. content._points.createFeatures(content, features);
  113502. }
  113503. content._features = features;
  113504. }
  113505. }
  113506. Vector3DTileContent.prototype.hasProperty = function(batchId, name) {
  113507. return this._batchTable.hasProperty(batchId, name);
  113508. };
  113509. Vector3DTileContent.prototype.getFeature = function(batchId) {
  113510. const featuresLength = this.featuresLength;
  113511. if (!defined_default(batchId) || batchId < 0 || batchId >= featuresLength) {
  113512. throw new DeveloperError_default(
  113513. `batchId is required and between zero and featuresLength - 1 (${featuresLength - 1}).`
  113514. );
  113515. }
  113516. createFeatures5(this);
  113517. return this._features[batchId];
  113518. };
  113519. Vector3DTileContent.prototype.applyDebugSettings = function(enabled, color) {
  113520. if (defined_default(this._polygons)) {
  113521. this._polygons.applyDebugSettings(enabled, color);
  113522. }
  113523. if (defined_default(this._polylines)) {
  113524. this._polylines.applyDebugSettings(enabled, color);
  113525. }
  113526. if (defined_default(this._points)) {
  113527. this._points.applyDebugSettings(enabled, color);
  113528. }
  113529. };
  113530. Vector3DTileContent.prototype.applyStyle = function(style) {
  113531. createFeatures5(this);
  113532. if (defined_default(this._polygons)) {
  113533. this._polygons.applyStyle(style, this._features);
  113534. }
  113535. if (defined_default(this._polylines)) {
  113536. this._polylines.applyStyle(style, this._features);
  113537. }
  113538. if (defined_default(this._points)) {
  113539. this._points.applyStyle(style, this._features);
  113540. }
  113541. };
  113542. Vector3DTileContent.prototype.update = function(tileset, frameState) {
  113543. let ready = true;
  113544. if (defined_default(this._polygons)) {
  113545. this._polygons.classificationType = this._tileset.classificationType;
  113546. this._polygons.debugWireframe = this._tileset.debugWireframe;
  113547. this._polygons.update(frameState);
  113548. ready = ready && this._polygons._ready;
  113549. }
  113550. if (defined_default(this._polylines)) {
  113551. this._polylines.update(frameState);
  113552. ready = ready && this._polylines._ready;
  113553. }
  113554. if (defined_default(this._points)) {
  113555. this._points.update(frameState);
  113556. ready = ready && this._points._ready;
  113557. }
  113558. if (defined_default(this._batchTable) && ready) {
  113559. this._batchTable.update(tileset, frameState);
  113560. }
  113561. if (!defined_default(this._contentReadyPromise)) {
  113562. const pointsPromise = defined_default(this._points) ? this._points.readyPromise : void 0;
  113563. const polygonPromise = defined_default(this._polygons) ? this._polygons.readyPromise : void 0;
  113564. const polylinePromise = defined_default(this._polylines) ? this._polylines.readyPromise : void 0;
  113565. const that = this;
  113566. this._contentReadyPromise = Promise.all([
  113567. pointsPromise,
  113568. polygonPromise,
  113569. polylinePromise
  113570. ]).then(function() {
  113571. that._readyPromise.resolve(that);
  113572. }).catch(function(error) {
  113573. that._readyPromise.reject(error);
  113574. });
  113575. }
  113576. };
  113577. Vector3DTileContent.prototype.getPolylinePositions = function(batchId) {
  113578. const polylines = this._polylines;
  113579. if (!defined_default(polylines)) {
  113580. return void 0;
  113581. }
  113582. return polylines.getPositions(batchId);
  113583. };
  113584. Vector3DTileContent.prototype.isDestroyed = function() {
  113585. return false;
  113586. };
  113587. Vector3DTileContent.prototype.destroy = function() {
  113588. this._polygons = this._polygons && this._polygons.destroy();
  113589. this._polylines = this._polylines && this._polylines.destroy();
  113590. this._points = this._points && this._points.destroy();
  113591. this._batchTable = this._batchTable && this._batchTable.destroy();
  113592. return destroyObject_default(this);
  113593. };
  113594. function examineVectorLines(positions, counts, batchIds, batchTable, url2, callback) {
  113595. const countsLength = counts.length;
  113596. let polylineStart = 0;
  113597. for (let i2 = 0; i2 < countsLength; i2++) {
  113598. const count = counts[i2] * 3;
  113599. const linePositions = positions.slice(polylineStart, polylineStart + count);
  113600. polylineStart += count;
  113601. callback(linePositions, batchIds[i2], url2, batchTable);
  113602. }
  113603. }
  113604. var Vector3DTileContent_default = Vector3DTileContent;
  113605. // node_modules/cesium/Source/Scene/PropertyTable.js
  113606. function PropertyTable(options) {
  113607. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  113608. Check_default.typeOf.number("options.count", options.count);
  113609. this._name = options.name;
  113610. this._id = options.id;
  113611. this._count = options.count;
  113612. this._extras = options.extras;
  113613. this._extensions = options.extensions;
  113614. this._metadataTable = options.metadataTable;
  113615. this._jsonMetadataTable = options.jsonMetadataTable;
  113616. this._batchTableHierarchy = options.batchTableHierarchy;
  113617. }
  113618. Object.defineProperties(PropertyTable.prototype, {
  113619. name: {
  113620. get: function() {
  113621. return this._name;
  113622. }
  113623. },
  113624. id: {
  113625. get: function() {
  113626. return this._id;
  113627. }
  113628. },
  113629. count: {
  113630. get: function() {
  113631. return this._count;
  113632. }
  113633. },
  113634. class: {
  113635. get: function() {
  113636. if (defined_default(this._metadataTable)) {
  113637. return this._metadataTable.class;
  113638. }
  113639. return void 0;
  113640. }
  113641. },
  113642. extras: {
  113643. get: function() {
  113644. return this._extras;
  113645. }
  113646. },
  113647. extensions: {
  113648. get: function() {
  113649. return this._extensions;
  113650. }
  113651. }
  113652. });
  113653. PropertyTable.prototype.hasProperty = function(index2, propertyId) {
  113654. Check_default.typeOf.number("index", index2);
  113655. Check_default.typeOf.string("propertyId", propertyId);
  113656. if (defined_default(this._metadataTable) && this._metadataTable.hasProperty(propertyId)) {
  113657. return true;
  113658. }
  113659. if (defined_default(this._jsonMetadataTable) && this._jsonMetadataTable.hasProperty(propertyId)) {
  113660. return true;
  113661. }
  113662. if (defined_default(this._batchTableHierarchy) && this._batchTableHierarchy.hasProperty(index2, propertyId)) {
  113663. return true;
  113664. }
  113665. return false;
  113666. };
  113667. PropertyTable.prototype.hasPropertyBySemantic = function(index2, semantic) {
  113668. Check_default.typeOf.number("index", index2);
  113669. Check_default.typeOf.string("semantic", semantic);
  113670. if (defined_default(this._metadataTable)) {
  113671. return this._metadataTable.hasPropertyBySemantic(semantic);
  113672. }
  113673. return false;
  113674. };
  113675. PropertyTable.prototype.propertyExists = function(propertyId) {
  113676. Check_default.typeOf.string("propertyId", propertyId);
  113677. if (defined_default(this._metadataTable) && this._metadataTable.hasProperty(propertyId)) {
  113678. return true;
  113679. }
  113680. if (defined_default(this._jsonMetadataTable) && this._jsonMetadataTable.hasProperty(propertyId)) {
  113681. return true;
  113682. }
  113683. if (defined_default(this._batchTableHierarchy) && this._batchTableHierarchy.propertyExists(propertyId)) {
  113684. return true;
  113685. }
  113686. return false;
  113687. };
  113688. PropertyTable.prototype.propertyExistsBySemantic = function(semantic) {
  113689. Check_default.typeOf.string("semantic", semantic);
  113690. if (defined_default(this._metadataTable)) {
  113691. return this._metadataTable.hasPropertyBySemantic(semantic);
  113692. }
  113693. return false;
  113694. };
  113695. var scratchResults = [];
  113696. PropertyTable.prototype.getPropertyIds = function(index2, results) {
  113697. results = defined_default(results) ? results : [];
  113698. results.length = 0;
  113699. if (defined_default(this._metadataTable)) {
  113700. results.push.apply(
  113701. results,
  113702. this._metadataTable.getPropertyIds(scratchResults)
  113703. );
  113704. }
  113705. if (defined_default(this._jsonMetadataTable)) {
  113706. results.push.apply(
  113707. results,
  113708. this._jsonMetadataTable.getPropertyIds(scratchResults)
  113709. );
  113710. }
  113711. if (defined_default(this._batchTableHierarchy)) {
  113712. results.push.apply(
  113713. results,
  113714. this._batchTableHierarchy.getPropertyIds(index2, scratchResults)
  113715. );
  113716. }
  113717. return results;
  113718. };
  113719. PropertyTable.prototype.getProperty = function(index2, propertyId) {
  113720. let result;
  113721. if (defined_default(this._metadataTable)) {
  113722. result = this._metadataTable.getProperty(index2, propertyId);
  113723. if (defined_default(result)) {
  113724. return result;
  113725. }
  113726. }
  113727. if (defined_default(this._jsonMetadataTable)) {
  113728. result = this._jsonMetadataTable.getProperty(index2, propertyId);
  113729. if (defined_default(result)) {
  113730. return result;
  113731. }
  113732. }
  113733. if (defined_default(this._batchTableHierarchy)) {
  113734. result = this._batchTableHierarchy.getProperty(index2, propertyId);
  113735. if (defined_default(result)) {
  113736. return result;
  113737. }
  113738. }
  113739. return void 0;
  113740. };
  113741. PropertyTable.prototype.setProperty = function(index2, propertyId, value) {
  113742. if (defined_default(this._metadataTable) && this._metadataTable.setProperty(index2, propertyId, value)) {
  113743. return true;
  113744. }
  113745. if (defined_default(this._jsonMetadataTable) && this._jsonMetadataTable.setProperty(index2, propertyId, value)) {
  113746. return true;
  113747. }
  113748. return defined_default(this._batchTableHierarchy) && this._batchTableHierarchy.setProperty(index2, propertyId, value);
  113749. };
  113750. PropertyTable.prototype.getPropertyBySemantic = function(index2, semantic) {
  113751. if (defined_default(this._metadataTable)) {
  113752. return this._metadataTable.getPropertyBySemantic(index2, semantic);
  113753. }
  113754. return void 0;
  113755. };
  113756. PropertyTable.prototype.setPropertyBySemantic = function(index2, semantic, value) {
  113757. if (defined_default(this._metadataTable)) {
  113758. return this._metadataTable.setPropertyBySemantic(index2, semantic, value);
  113759. }
  113760. return false;
  113761. };
  113762. PropertyTable.prototype.getPropertyTypedArray = function(propertyId) {
  113763. Check_default.typeOf.string("propertyId", propertyId);
  113764. if (defined_default(this._metadataTable)) {
  113765. return this._metadataTable.getPropertyTypedArray(propertyId);
  113766. }
  113767. return void 0;
  113768. };
  113769. PropertyTable.prototype.getPropertyTypedArrayBySemantic = function(semantic) {
  113770. Check_default.typeOf.string("semantic", semantic);
  113771. if (defined_default(this._metadataTable)) {
  113772. return this._metadataTable.getPropertyTypedArrayBySemantic(semantic);
  113773. }
  113774. return void 0;
  113775. };
  113776. var PropertyTable_default = PropertyTable;
  113777. // node_modules/cesium/Source/Scene/PropertyTextureProperty.js
  113778. function PropertyTextureProperty(options) {
  113779. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  113780. const property = options.property;
  113781. const classProperty = options.classProperty;
  113782. const textures = options.textures;
  113783. Check_default.typeOf.object("options.property", property);
  113784. Check_default.typeOf.object("options.classProperty", classProperty);
  113785. Check_default.typeOf.object("options.textures", textures);
  113786. const textureInfo = property;
  113787. const textureReader = GltfLoaderUtil_default.createModelTextureReader({
  113788. textureInfo,
  113789. channels: reformatChannels(property.channels),
  113790. texture: textures[textureInfo.index]
  113791. });
  113792. this._min = property.min;
  113793. this._max = property.max;
  113794. let offset2 = property.offset;
  113795. let scale = property.scale;
  113796. const hasValueTransform = classProperty.hasValueTransform || defined_default(offset2) || defined_default(scale);
  113797. offset2 = defaultValue_default(offset2, classProperty.offset);
  113798. scale = defaultValue_default(scale, classProperty.scale);
  113799. offset2 = classProperty.unpackVectorAndMatrixTypes(offset2);
  113800. scale = classProperty.unpackVectorAndMatrixTypes(scale);
  113801. this._offset = offset2;
  113802. this._scale = scale;
  113803. this._hasValueTransform = hasValueTransform;
  113804. this._textureReader = textureReader;
  113805. this._classProperty = classProperty;
  113806. this._extras = property.extras;
  113807. this._extensions = property.extensions;
  113808. }
  113809. Object.defineProperties(PropertyTextureProperty.prototype, {
  113810. textureReader: {
  113811. get: function() {
  113812. return this._textureReader;
  113813. }
  113814. },
  113815. hasValueTransform: {
  113816. get: function() {
  113817. return this._hasValueTransform;
  113818. }
  113819. },
  113820. offset: {
  113821. get: function() {
  113822. return this._offset;
  113823. }
  113824. },
  113825. scale: {
  113826. get: function() {
  113827. return this._scale;
  113828. }
  113829. },
  113830. extras: {
  113831. get: function() {
  113832. return this._extras;
  113833. }
  113834. },
  113835. extensions: {
  113836. get: function() {
  113837. return this._extensions;
  113838. }
  113839. }
  113840. });
  113841. PropertyTextureProperty.prototype.isGpuCompatible = function() {
  113842. const classProperty = this._classProperty;
  113843. const type = classProperty.type;
  113844. const componentType = classProperty.componentType;
  113845. if (classProperty.isArray) {
  113846. return !classProperty.isVariableLengthArray && classProperty.arrayLength <= 4 && type === MetadataType_default.SCALAR && componentType === MetadataComponentType_default.UINT8;
  113847. }
  113848. if (MetadataType_default.isVectorType(type) || type === MetadataType_default.SCALAR) {
  113849. return componentType === MetadataComponentType_default.UINT8;
  113850. }
  113851. return false;
  113852. };
  113853. var floatTypesByComponentCount = [void 0, "float", "vec2", "vec3", "vec4"];
  113854. var integerTypesByComponentCount = [
  113855. void 0,
  113856. "int",
  113857. "ivec2",
  113858. "ivec3",
  113859. "ivec4"
  113860. ];
  113861. PropertyTextureProperty.prototype.getGlslType = function() {
  113862. const classProperty = this._classProperty;
  113863. let componentCount = MetadataType_default.getComponentCount(classProperty.type);
  113864. if (classProperty.isArray) {
  113865. componentCount = classProperty.arrayLength;
  113866. }
  113867. if (classProperty.normalized) {
  113868. return floatTypesByComponentCount[componentCount];
  113869. }
  113870. return integerTypesByComponentCount[componentCount];
  113871. };
  113872. PropertyTextureProperty.prototype.unpackInShader = function(packedValueGlsl) {
  113873. const classProperty = this._classProperty;
  113874. if (classProperty.normalized) {
  113875. return packedValueGlsl;
  113876. }
  113877. const glslType = this.getGlslType();
  113878. return `${glslType}(255.0 * ${packedValueGlsl})`;
  113879. };
  113880. function reformatChannels(channels) {
  113881. return channels.map(function(channelIndex) {
  113882. return "rgba".charAt(channelIndex);
  113883. }).join("");
  113884. }
  113885. var PropertyTextureProperty_default = PropertyTextureProperty;
  113886. // node_modules/cesium/Source/Scene/PropertyTexture.js
  113887. function PropertyTexture(options) {
  113888. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  113889. const propertyTexture = options.propertyTexture;
  113890. const classDefinition = options.class;
  113891. const textures = options.textures;
  113892. Check_default.typeOf.object("options.propertyTexture", propertyTexture);
  113893. Check_default.typeOf.object("options.class", classDefinition);
  113894. Check_default.typeOf.object("options.textures", textures);
  113895. const extensions = propertyTexture.extensions;
  113896. const extras = propertyTexture.extras;
  113897. const properties = {};
  113898. if (defined_default(propertyTexture.properties)) {
  113899. for (const propertyId in propertyTexture.properties) {
  113900. if (propertyTexture.properties.hasOwnProperty(propertyId)) {
  113901. properties[propertyId] = new PropertyTextureProperty_default({
  113902. property: propertyTexture.properties[propertyId],
  113903. classProperty: classDefinition.properties[propertyId],
  113904. textures
  113905. });
  113906. }
  113907. }
  113908. }
  113909. this._name = options.name;
  113910. this._id = options.id;
  113911. this._class = classDefinition;
  113912. this._properties = properties;
  113913. this._extras = extras;
  113914. this._extensions = extensions;
  113915. }
  113916. Object.defineProperties(PropertyTexture.prototype, {
  113917. name: {
  113918. get: function() {
  113919. return this._name;
  113920. }
  113921. },
  113922. id: {
  113923. get: function() {
  113924. return this._id;
  113925. }
  113926. },
  113927. class: {
  113928. get: function() {
  113929. return this._class;
  113930. }
  113931. },
  113932. properties: {
  113933. get: function() {
  113934. return this._properties;
  113935. }
  113936. },
  113937. extras: {
  113938. get: function() {
  113939. return this._extras;
  113940. }
  113941. },
  113942. extensions: {
  113943. get: function() {
  113944. return this._extensions;
  113945. }
  113946. }
  113947. });
  113948. PropertyTexture.prototype.getProperty = function(propertyId) {
  113949. Check_default.typeOf.string("propertyId", propertyId);
  113950. return this._properties[propertyId];
  113951. };
  113952. var PropertyTexture_default = PropertyTexture;
  113953. // node_modules/cesium/Source/Scene/PropertyAttributeProperty.js
  113954. function PropertyAttributeProperty(options) {
  113955. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  113956. const property = options.property;
  113957. const classProperty = options.classProperty;
  113958. Check_default.typeOf.object("options.property", property);
  113959. Check_default.typeOf.object("options.classProperty", classProperty);
  113960. this._attribute = property.attribute;
  113961. this._classProperty = classProperty;
  113962. this._min = property.min;
  113963. this._max = property.max;
  113964. let offset2 = property.offset;
  113965. let scale = property.scale;
  113966. const hasValueTransform = classProperty.hasValueTransform || defined_default(offset2) || defined_default(scale);
  113967. offset2 = defaultValue_default(offset2, classProperty.offset);
  113968. scale = defaultValue_default(scale, classProperty.scale);
  113969. offset2 = classProperty.unpackVectorAndMatrixTypes(offset2);
  113970. scale = classProperty.unpackVectorAndMatrixTypes(scale);
  113971. this._offset = offset2;
  113972. this._scale = scale;
  113973. this._hasValueTransform = hasValueTransform;
  113974. this._extras = property.extras;
  113975. this._extensions = property.extensions;
  113976. }
  113977. Object.defineProperties(PropertyAttributeProperty.prototype, {
  113978. attribute: {
  113979. get: function() {
  113980. return this._attribute;
  113981. }
  113982. },
  113983. hasValueTransform: {
  113984. get: function() {
  113985. return this._hasValueTransform;
  113986. }
  113987. },
  113988. offset: {
  113989. get: function() {
  113990. return this._offset;
  113991. }
  113992. },
  113993. scale: {
  113994. get: function() {
  113995. return this._scale;
  113996. }
  113997. },
  113998. extras: {
  113999. get: function() {
  114000. return this._extras;
  114001. }
  114002. },
  114003. extensions: {
  114004. get: function() {
  114005. return this._extensions;
  114006. }
  114007. }
  114008. });
  114009. // node_modules/cesium/Source/Scene/PropertyAttribute.js
  114010. function PropertyAttribute(options) {
  114011. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  114012. const propertyAttribute = options.propertyAttribute;
  114013. const classDefinition = options.class;
  114014. Check_default.typeOf.object("options.propertyAttribute", propertyAttribute);
  114015. Check_default.typeOf.object("options.class", classDefinition);
  114016. const properties = {};
  114017. if (defined_default(propertyAttribute.properties)) {
  114018. for (const propertyId in propertyAttribute.properties) {
  114019. if (propertyAttribute.properties.hasOwnProperty(propertyId)) {
  114020. properties[propertyId] = new PropertyAttributeProperty({
  114021. property: propertyAttribute.properties[propertyId],
  114022. classProperty: classDefinition.properties[propertyId]
  114023. });
  114024. }
  114025. }
  114026. }
  114027. this._name = options.name;
  114028. this._id = options.id;
  114029. this._class = classDefinition;
  114030. this._properties = properties;
  114031. this._extras = propertyAttribute.extras;
  114032. this._extensions = propertyAttribute.extensions;
  114033. }
  114034. Object.defineProperties(PropertyAttribute.prototype, {
  114035. name: {
  114036. get: function() {
  114037. return this._name;
  114038. }
  114039. },
  114040. id: {
  114041. get: function() {
  114042. return this._id;
  114043. }
  114044. },
  114045. class: {
  114046. get: function() {
  114047. return this._class;
  114048. }
  114049. },
  114050. properties: {
  114051. get: function() {
  114052. return this._properties;
  114053. }
  114054. },
  114055. extras: {
  114056. get: function() {
  114057. return this._extras;
  114058. }
  114059. },
  114060. extensions: {
  114061. get: function() {
  114062. return this._extensions;
  114063. }
  114064. }
  114065. });
  114066. PropertyAttribute.prototype.getProperty = function(propertyId) {
  114067. Check_default.typeOf.string("propertyId", propertyId);
  114068. return this._properties[propertyId];
  114069. };
  114070. // node_modules/cesium/Source/Scene/StructuralMetadata.js
  114071. function StructuralMetadata(options) {
  114072. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  114073. Check_default.typeOf.object("options.schema", options.schema);
  114074. this._schema = options.schema;
  114075. const propertyTables = options.propertyTables;
  114076. this._propertyTableCount = defined_default(propertyTables) ? propertyTables.length : 0;
  114077. this._propertyTables = propertyTables;
  114078. this._propertyTextures = options.propertyTextures;
  114079. this._propertyAttributes = options.propertyAttributes;
  114080. this._statistics = options.statistics;
  114081. this._extras = options.extras;
  114082. this._extensions = options.extensions;
  114083. }
  114084. Object.defineProperties(StructuralMetadata.prototype, {
  114085. schema: {
  114086. get: function() {
  114087. return this._schema;
  114088. }
  114089. },
  114090. statistics: {
  114091. get: function() {
  114092. return this._statistics;
  114093. }
  114094. },
  114095. extras: {
  114096. get: function() {
  114097. return this._extras;
  114098. }
  114099. },
  114100. extensions: {
  114101. get: function() {
  114102. return this._extensions;
  114103. }
  114104. },
  114105. propertyTableCount: {
  114106. get: function() {
  114107. return this._propertyTableCount;
  114108. }
  114109. },
  114110. propertyTables: {
  114111. get: function() {
  114112. return this._propertyTables;
  114113. }
  114114. },
  114115. propertyTextures: {
  114116. get: function() {
  114117. return this._propertyTextures;
  114118. }
  114119. },
  114120. propertyAttributes: {
  114121. get: function() {
  114122. return this._propertyAttributes;
  114123. }
  114124. }
  114125. });
  114126. StructuralMetadata.prototype.getPropertyTable = function(propertyTableId) {
  114127. Check_default.typeOf.number("propertyTableId", propertyTableId);
  114128. return this._propertyTables[propertyTableId];
  114129. };
  114130. StructuralMetadata.prototype.getPropertyTexture = function(propertyTextureId) {
  114131. Check_default.typeOf.number("propertyTextureId", propertyTextureId);
  114132. return this._propertyTextures[propertyTextureId];
  114133. };
  114134. StructuralMetadata.prototype.getPropertyAttribute = function(propertyAttributeId) {
  114135. Check_default.typeOf.number("propertyAttributeId", propertyAttributeId);
  114136. return this._propertyAttributes[propertyAttributeId];
  114137. };
  114138. var StructuralMetadata_default = StructuralMetadata;
  114139. // node_modules/cesium/Source/Scene/parseStructuralMetadata.js
  114140. function parseStructuralMetadata(options) {
  114141. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  114142. const extension = options.extension;
  114143. const schema = options.schema;
  114144. Check_default.typeOf.object("options.extension", extension);
  114145. Check_default.typeOf.object("options.schema", schema);
  114146. const propertyTables = [];
  114147. if (defined_default(extension.propertyTables)) {
  114148. for (let i2 = 0; i2 < extension.propertyTables.length; i2++) {
  114149. const propertyTable = extension.propertyTables[i2];
  114150. const classDefinition = schema.classes[propertyTable.class];
  114151. const metadataTable = new MetadataTable_default({
  114152. count: propertyTable.count,
  114153. properties: propertyTable.properties,
  114154. class: classDefinition,
  114155. bufferViews: options.bufferViews
  114156. });
  114157. propertyTables.push(
  114158. new PropertyTable_default({
  114159. id: i2,
  114160. name: propertyTable.name,
  114161. count: propertyTable.count,
  114162. metadataTable,
  114163. extras: propertyTable.extras,
  114164. extensions: propertyTable.extensions
  114165. })
  114166. );
  114167. }
  114168. }
  114169. const propertyTextures = [];
  114170. if (defined_default(extension.propertyTextures)) {
  114171. for (let i2 = 0; i2 < extension.propertyTextures.length; i2++) {
  114172. const propertyTexture = extension.propertyTextures[i2];
  114173. propertyTextures.push(
  114174. new PropertyTexture_default({
  114175. id: i2,
  114176. name: propertyTexture.name,
  114177. propertyTexture,
  114178. class: schema.classes[propertyTexture.class],
  114179. textures: options.textures
  114180. })
  114181. );
  114182. }
  114183. }
  114184. const propertyAttributes = [];
  114185. if (defined_default(extension.propertyAttributes)) {
  114186. for (let i2 = 0; i2 < extension.propertyAttributes.length; i2++) {
  114187. const propertyAttribute = extension.propertyAttributes[i2];
  114188. propertyAttributes.push(
  114189. new PropertyAttribute({
  114190. id: i2,
  114191. name: propertyAttribute.name,
  114192. class: schema.classes[propertyAttribute.class],
  114193. propertyAttribute
  114194. })
  114195. );
  114196. }
  114197. }
  114198. return new StructuralMetadata_default({
  114199. schema,
  114200. propertyTables,
  114201. propertyTextures,
  114202. propertyAttributes,
  114203. statistics: extension.statistics,
  114204. extras: extension.extras,
  114205. extensions: extension.extensions
  114206. });
  114207. }
  114208. // node_modules/cesium/Source/Scene/parseFeatureMetadataLegacy.js
  114209. function parseFeatureMetadataLegacy(options) {
  114210. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  114211. const extension = options.extension;
  114212. const schema = options.schema;
  114213. Check_default.typeOf.object("options.extension", extension);
  114214. Check_default.typeOf.object("options.schema", schema);
  114215. let i2;
  114216. const propertyTables = [];
  114217. let sortedIds;
  114218. if (defined_default(extension.featureTables)) {
  114219. sortedIds = Object.keys(extension.featureTables).sort();
  114220. for (i2 = 0; i2 < sortedIds.length; i2++) {
  114221. const featureTableId = sortedIds[i2];
  114222. const featureTable = extension.featureTables[featureTableId];
  114223. const classDefinition = schema.classes[featureTable.class];
  114224. const metadataTable = new MetadataTable_default({
  114225. count: featureTable.count,
  114226. properties: featureTable.properties,
  114227. class: classDefinition,
  114228. bufferViews: options.bufferViews
  114229. });
  114230. propertyTables.push(
  114231. new PropertyTable_default({
  114232. id: featureTableId,
  114233. count: featureTable.count,
  114234. metadataTable,
  114235. extras: featureTable.extras,
  114236. extensions: featureTable.extensions
  114237. })
  114238. );
  114239. }
  114240. }
  114241. const propertyTextures = [];
  114242. if (defined_default(extension.featureTextures)) {
  114243. sortedIds = Object.keys(extension.featureTextures).sort();
  114244. for (i2 = 0; i2 < sortedIds.length; i2++) {
  114245. const featureTextureId = sortedIds[i2];
  114246. const featureTexture = extension.featureTextures[featureTextureId];
  114247. propertyTextures.push(
  114248. new PropertyTexture_default({
  114249. id: featureTextureId,
  114250. propertyTexture: transcodeToPropertyTexture(featureTexture),
  114251. class: schema.classes[featureTexture.class],
  114252. textures: options.textures
  114253. })
  114254. );
  114255. }
  114256. }
  114257. return new StructuralMetadata_default({
  114258. schema,
  114259. propertyTables,
  114260. propertyTextures,
  114261. statistics: extension.statistics,
  114262. extras: extension.extras,
  114263. extensions: extension.extensions
  114264. });
  114265. }
  114266. function transcodeToPropertyTexture(featureTexture) {
  114267. const propertyTexture = {
  114268. class: featureTexture.class,
  114269. properties: {}
  114270. };
  114271. const properties = featureTexture.properties;
  114272. for (const propertyId in properties) {
  114273. if (properties.hasOwnProperty(propertyId)) {
  114274. const oldProperty = properties[propertyId];
  114275. const property = {
  114276. channels: reformatChannels2(oldProperty.channels),
  114277. extras: oldProperty.extras,
  114278. extensions: oldProperty.extensions
  114279. };
  114280. propertyTexture.properties[propertyId] = combine_default(
  114281. oldProperty.texture,
  114282. property,
  114283. true
  114284. );
  114285. }
  114286. }
  114287. return propertyTexture;
  114288. }
  114289. function reformatChannels2(channelsString) {
  114290. const length3 = channelsString.length;
  114291. const result = new Array(length3);
  114292. for (let i2 = 0; i2 < length3; i2++) {
  114293. result[i2] = "rgba".indexOf(channelsString[i2]);
  114294. }
  114295. return result;
  114296. }
  114297. // node_modules/cesium/Source/Scene/GltfStructuralMetadataLoader.js
  114298. function GltfStructuralMetadataLoader(options) {
  114299. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  114300. const gltf = options.gltf;
  114301. const extension = options.extension;
  114302. const extensionLegacy = options.extensionLegacy;
  114303. const gltfResource = options.gltfResource;
  114304. const baseResource2 = options.baseResource;
  114305. const supportedImageFormats = options.supportedImageFormats;
  114306. const cacheKey = options.cacheKey;
  114307. const asynchronous = defaultValue_default(options.asynchronous, true);
  114308. Check_default.typeOf.object("options.gltf", gltf);
  114309. Check_default.typeOf.object("options.gltfResource", gltfResource);
  114310. Check_default.typeOf.object("options.baseResource", baseResource2);
  114311. Check_default.typeOf.object("options.supportedImageFormats", supportedImageFormats);
  114312. if (!defined_default(options.extension) && !defined_default(options.extensionLegacy)) {
  114313. throw new DeveloperError_default(
  114314. "One of options.extension or options.extensionLegacy must be specified"
  114315. );
  114316. }
  114317. this._gltfResource = gltfResource;
  114318. this._baseResource = baseResource2;
  114319. this._gltf = gltf;
  114320. this._extension = extension;
  114321. this._extensionLegacy = extensionLegacy;
  114322. this._supportedImageFormats = supportedImageFormats;
  114323. this._cacheKey = cacheKey;
  114324. this._asynchronous = asynchronous;
  114325. this._bufferViewLoaders = [];
  114326. this._textureLoaders = [];
  114327. this._schemaLoader = void 0;
  114328. this._structuralMetadata = void 0;
  114329. this._state = ResourceLoaderState_default.UNLOADED;
  114330. this._promise = defer_default();
  114331. }
  114332. if (defined_default(Object.create)) {
  114333. GltfStructuralMetadataLoader.prototype = Object.create(
  114334. ResourceLoader.prototype
  114335. );
  114336. GltfStructuralMetadataLoader.prototype.constructor = GltfStructuralMetadataLoader;
  114337. }
  114338. Object.defineProperties(GltfStructuralMetadataLoader.prototype, {
  114339. promise: {
  114340. get: function() {
  114341. return this._promise.promise;
  114342. }
  114343. },
  114344. cacheKey: {
  114345. get: function() {
  114346. return this._cacheKey;
  114347. }
  114348. },
  114349. structuralMetadata: {
  114350. get: function() {
  114351. return this._structuralMetadata;
  114352. }
  114353. }
  114354. });
  114355. GltfStructuralMetadataLoader.prototype.load = function() {
  114356. const bufferViewsPromise = loadBufferViews(this);
  114357. const texturesPromise = loadTextures(this);
  114358. const schemaPromise = loadSchema(this);
  114359. this._gltf = void 0;
  114360. this._state = ResourceLoaderState_default.LOADING;
  114361. const that = this;
  114362. Promise.all([bufferViewsPromise, texturesPromise, schemaPromise]).then(function(results) {
  114363. if (that.isDestroyed()) {
  114364. return;
  114365. }
  114366. const bufferViews = results[0];
  114367. const textures = results[1];
  114368. const schema = results[2];
  114369. if (defined_default(that._extension)) {
  114370. that._structuralMetadata = parseStructuralMetadata({
  114371. extension: that._extension,
  114372. schema,
  114373. bufferViews,
  114374. textures
  114375. });
  114376. } else {
  114377. that._structuralMetadata = parseFeatureMetadataLegacy({
  114378. extension: that._extensionLegacy,
  114379. schema,
  114380. bufferViews,
  114381. textures
  114382. });
  114383. }
  114384. that._state = ResourceLoaderState_default.READY;
  114385. that._promise.resolve(that);
  114386. }).catch(function(error) {
  114387. if (that.isDestroyed()) {
  114388. return;
  114389. }
  114390. that.unload();
  114391. that._state = ResourceLoaderState_default.FAILED;
  114392. const errorMessage = "Failed to load structural metadata";
  114393. that._promise.reject(that.getError(errorMessage, error));
  114394. });
  114395. };
  114396. function gatherBufferViewIdsFromProperties(properties, bufferViewIdSet) {
  114397. for (const propertyId in properties) {
  114398. if (properties.hasOwnProperty(propertyId)) {
  114399. const property = properties[propertyId];
  114400. const values = property.values;
  114401. const arrayOffsets = property.arrayOffsets;
  114402. const stringOffsets = property.stringOffsets;
  114403. if (defined_default(values)) {
  114404. bufferViewIdSet[values] = true;
  114405. }
  114406. if (defined_default(arrayOffsets)) {
  114407. bufferViewIdSet[arrayOffsets] = true;
  114408. }
  114409. if (defined_default(stringOffsets)) {
  114410. bufferViewIdSet[stringOffsets] = true;
  114411. }
  114412. }
  114413. }
  114414. }
  114415. function gatherBufferViewIdsFromPropertiesLegacy(properties, bufferViewIdSet) {
  114416. for (const propertyId in properties) {
  114417. if (properties.hasOwnProperty(propertyId)) {
  114418. const property = properties[propertyId];
  114419. const bufferView = property.bufferView;
  114420. const arrayOffsetBufferView = property.arrayOffsetBufferView;
  114421. const stringOffsetBufferView = property.stringOffsetBufferView;
  114422. if (defined_default(bufferView)) {
  114423. bufferViewIdSet[bufferView] = true;
  114424. }
  114425. if (defined_default(arrayOffsetBufferView)) {
  114426. bufferViewIdSet[arrayOffsetBufferView] = true;
  114427. }
  114428. if (defined_default(stringOffsetBufferView)) {
  114429. bufferViewIdSet[stringOffsetBufferView] = true;
  114430. }
  114431. }
  114432. }
  114433. }
  114434. function gatherUsedBufferViewIds(extension) {
  114435. const propertyTables = extension.propertyTables;
  114436. const bufferViewIdSet = {};
  114437. if (defined_default(propertyTables)) {
  114438. for (let i2 = 0; i2 < propertyTables.length; i2++) {
  114439. const propertyTable = propertyTables[i2];
  114440. gatherBufferViewIdsFromProperties(
  114441. propertyTable.properties,
  114442. bufferViewIdSet
  114443. );
  114444. }
  114445. }
  114446. return bufferViewIdSet;
  114447. }
  114448. function gatherUsedBufferViewIdsLegacy(extensionLegacy) {
  114449. const featureTables = extensionLegacy.featureTables;
  114450. const bufferViewIdSet = {};
  114451. if (defined_default(featureTables)) {
  114452. for (const featureTableId in featureTables) {
  114453. if (featureTables.hasOwnProperty(featureTableId)) {
  114454. const featureTable = featureTables[featureTableId];
  114455. const properties = featureTable.properties;
  114456. if (defined_default(properties)) {
  114457. gatherBufferViewIdsFromPropertiesLegacy(properties, bufferViewIdSet);
  114458. }
  114459. }
  114460. }
  114461. }
  114462. return bufferViewIdSet;
  114463. }
  114464. function loadBufferViews(structuralMetadataLoader) {
  114465. let bufferViewIds;
  114466. if (defined_default(structuralMetadataLoader._extension)) {
  114467. bufferViewIds = gatherUsedBufferViewIds(
  114468. structuralMetadataLoader._extension
  114469. );
  114470. } else {
  114471. bufferViewIds = gatherUsedBufferViewIdsLegacy(
  114472. structuralMetadataLoader._extensionLegacy
  114473. );
  114474. }
  114475. const bufferViewPromises = [];
  114476. const bufferViewLoaders = {};
  114477. for (const bufferViewId in bufferViewIds) {
  114478. if (bufferViewIds.hasOwnProperty(bufferViewId)) {
  114479. const bufferViewLoader = ResourceCache_default.loadBufferView({
  114480. gltf: structuralMetadataLoader._gltf,
  114481. bufferViewId: parseInt(bufferViewId),
  114482. gltfResource: structuralMetadataLoader._gltfResource,
  114483. baseResource: structuralMetadataLoader._baseResource
  114484. });
  114485. bufferViewPromises.push(bufferViewLoader.promise);
  114486. structuralMetadataLoader._bufferViewLoaders.push(bufferViewLoader);
  114487. bufferViewLoaders[bufferViewId] = bufferViewLoader;
  114488. }
  114489. }
  114490. return Promise.all(bufferViewPromises).then(function() {
  114491. const bufferViews = {};
  114492. for (const bufferViewId in bufferViewLoaders) {
  114493. if (bufferViewLoaders.hasOwnProperty(bufferViewId)) {
  114494. const bufferViewLoader = bufferViewLoaders[bufferViewId];
  114495. const bufferViewTypedArray = new Uint8Array(
  114496. bufferViewLoader.typedArray
  114497. );
  114498. bufferViews[bufferViewId] = bufferViewTypedArray;
  114499. }
  114500. }
  114501. unloadBufferViews(structuralMetadataLoader);
  114502. return bufferViews;
  114503. });
  114504. }
  114505. function gatherUsedTextureIds(structuralMetadataExtension) {
  114506. const textureIds = {};
  114507. const propertyTextures = structuralMetadataExtension.propertyTextures;
  114508. if (defined_default(propertyTextures)) {
  114509. for (let i2 = 0; i2 < propertyTextures.length; i2++) {
  114510. const propertyTexture = propertyTextures[i2];
  114511. const properties = propertyTexture.properties;
  114512. if (defined_default(properties)) {
  114513. gatherTextureIdsFromProperties(properties, textureIds);
  114514. }
  114515. }
  114516. }
  114517. return textureIds;
  114518. }
  114519. function gatherTextureIdsFromProperties(properties, textureIds) {
  114520. for (const propertyId in properties) {
  114521. if (properties.hasOwnProperty(propertyId)) {
  114522. const textureInfo = properties[propertyId];
  114523. textureIds[textureInfo.index] = textureInfo;
  114524. }
  114525. }
  114526. }
  114527. function gatherUsedTextureIdsLegacy(extensionLegacy) {
  114528. const textureIds = {};
  114529. const featureTextures = extensionLegacy.featureTextures;
  114530. if (defined_default(featureTextures)) {
  114531. for (const featureTextureId in featureTextures) {
  114532. if (featureTextures.hasOwnProperty(featureTextureId)) {
  114533. const featureTexture = featureTextures[featureTextureId];
  114534. const properties = featureTexture.properties;
  114535. if (defined_default(properties)) {
  114536. gatherTextureIdsFromPropertiesLegacy(properties, textureIds);
  114537. }
  114538. }
  114539. }
  114540. }
  114541. return textureIds;
  114542. }
  114543. function gatherTextureIdsFromPropertiesLegacy(properties, textureIds) {
  114544. for (const propertyId in properties) {
  114545. if (properties.hasOwnProperty(propertyId)) {
  114546. const property = properties[propertyId];
  114547. const textureInfo = property.texture;
  114548. textureIds[textureInfo.index] = textureInfo;
  114549. }
  114550. }
  114551. }
  114552. function loadTextures(structuralMetadataLoader) {
  114553. let textureIds;
  114554. if (defined_default(structuralMetadataLoader._extension)) {
  114555. textureIds = gatherUsedTextureIds(structuralMetadataLoader._extension);
  114556. } else {
  114557. textureIds = gatherUsedTextureIdsLegacy(
  114558. structuralMetadataLoader._extensionLegacy
  114559. );
  114560. }
  114561. const gltf = structuralMetadataLoader._gltf;
  114562. const gltfResource = structuralMetadataLoader._gltfResource;
  114563. const baseResource2 = structuralMetadataLoader._baseResource;
  114564. const supportedImageFormats = structuralMetadataLoader._supportedImageFormats;
  114565. const asynchronous = structuralMetadataLoader._asynchronous;
  114566. const texturePromises = [];
  114567. const textureLoaders = {};
  114568. for (const textureId in textureIds) {
  114569. if (textureIds.hasOwnProperty(textureId)) {
  114570. const textureLoader = ResourceCache_default.loadTexture({
  114571. gltf,
  114572. textureInfo: textureIds[textureId],
  114573. gltfResource,
  114574. baseResource: baseResource2,
  114575. supportedImageFormats,
  114576. asynchronous
  114577. });
  114578. texturePromises.push(textureLoader.promise);
  114579. structuralMetadataLoader._textureLoaders.push(textureLoader);
  114580. textureLoaders[textureId] = textureLoader;
  114581. }
  114582. }
  114583. return Promise.all(texturePromises).then(function() {
  114584. const textures = {};
  114585. for (const textureId in textureLoaders) {
  114586. if (textureLoaders.hasOwnProperty(textureId)) {
  114587. const textureLoader = textureLoaders[textureId];
  114588. textures[textureId] = textureLoader.texture;
  114589. }
  114590. }
  114591. return textures;
  114592. });
  114593. }
  114594. function loadSchema(structuralMetadataLoader) {
  114595. const extension = defaultValue_default(
  114596. structuralMetadataLoader._extension,
  114597. structuralMetadataLoader._extensionLegacy
  114598. );
  114599. let schemaLoader;
  114600. if (defined_default(extension.schemaUri)) {
  114601. const resource = structuralMetadataLoader._baseResource.getDerivedResource({
  114602. url: extension.schemaUri
  114603. });
  114604. schemaLoader = ResourceCache_default.loadSchema({
  114605. resource
  114606. });
  114607. } else {
  114608. schemaLoader = ResourceCache_default.loadSchema({
  114609. schema: extension.schema
  114610. });
  114611. }
  114612. structuralMetadataLoader._schemaLoader = schemaLoader;
  114613. return schemaLoader.promise.then(function(schemaLoader2) {
  114614. return schemaLoader2.schema;
  114615. });
  114616. }
  114617. GltfStructuralMetadataLoader.prototype.process = function(frameState) {
  114618. Check_default.typeOf.object("frameState", frameState);
  114619. if (this._state !== ResourceLoaderState_default.LOADING) {
  114620. return;
  114621. }
  114622. const textureLoaders = this._textureLoaders;
  114623. const textureLoadersLength = textureLoaders.length;
  114624. for (let i2 = 0; i2 < textureLoadersLength; ++i2) {
  114625. const textureLoader = textureLoaders[i2];
  114626. textureLoader.process(frameState);
  114627. }
  114628. };
  114629. function unloadBufferViews(structuralMetadataLoader) {
  114630. const bufferViewLoaders = structuralMetadataLoader._bufferViewLoaders;
  114631. const bufferViewLoadersLength = bufferViewLoaders.length;
  114632. for (let i2 = 0; i2 < bufferViewLoadersLength; ++i2) {
  114633. ResourceCache_default.unload(bufferViewLoaders[i2]);
  114634. }
  114635. structuralMetadataLoader._bufferViewLoaders.length = 0;
  114636. }
  114637. function unloadTextures(structuralMetadataLoader) {
  114638. const textureLoaders = structuralMetadataLoader._textureLoaders;
  114639. const textureLoadersLength = textureLoaders.length;
  114640. for (let i2 = 0; i2 < textureLoadersLength; ++i2) {
  114641. ResourceCache_default.unload(textureLoaders[i2]);
  114642. }
  114643. structuralMetadataLoader._textureLoaders.length = 0;
  114644. }
  114645. GltfStructuralMetadataLoader.prototype.unload = function() {
  114646. unloadBufferViews(this);
  114647. unloadTextures(this);
  114648. if (defined_default(this._schemaLoader)) {
  114649. ResourceCache_default.unload(this._schemaLoader);
  114650. }
  114651. this._schemaLoader = void 0;
  114652. this._structuralMetadata = void 0;
  114653. };
  114654. // node_modules/cesium/Source/Scene/InstanceAttributeSemantic.js
  114655. var InstanceAttributeSemantic = {
  114656. TRANSLATION: "TRANSLATION",
  114657. ROTATION: "ROTATION",
  114658. SCALE: "SCALE",
  114659. FEATURE_ID: "_FEATURE_ID"
  114660. };
  114661. InstanceAttributeSemantic.fromGltfSemantic = function(gltfSemantic) {
  114662. Check_default.typeOf.string("gltfSemantic", gltfSemantic);
  114663. let semantic = gltfSemantic;
  114664. const setIndexRegex = /^(\w+)_\d+$/;
  114665. const setIndexMatch = setIndexRegex.exec(gltfSemantic);
  114666. if (setIndexMatch !== null) {
  114667. semantic = setIndexMatch[1];
  114668. }
  114669. switch (semantic) {
  114670. case "TRANSLATION":
  114671. return InstanceAttributeSemantic.TRANSLATION;
  114672. case "ROTATION":
  114673. return InstanceAttributeSemantic.ROTATION;
  114674. case "SCALE":
  114675. return InstanceAttributeSemantic.SCALE;
  114676. case "_FEATURE_ID":
  114677. return InstanceAttributeSemantic.FEATURE_ID;
  114678. }
  114679. return void 0;
  114680. };
  114681. var InstanceAttributeSemantic_default = Object.freeze(InstanceAttributeSemantic);
  114682. // node_modules/cesium/Source/Scene/SupportedImageFormats.js
  114683. function SupportedImageFormats(options) {
  114684. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  114685. this.webp = defaultValue_default(options.webp, false);
  114686. this.basis = defaultValue_default(options.basis, false);
  114687. }
  114688. // node_modules/cesium/Source/Scene/GltfLoader.js
  114689. var Attribute2 = ModelComponents_default.Attribute;
  114690. var Indices2 = ModelComponents_default.Indices;
  114691. var FeatureIdAttribute2 = ModelComponents_default.FeatureIdAttribute;
  114692. var FeatureIdTexture2 = ModelComponents_default.FeatureIdTexture;
  114693. var FeatureIdImplicitRange2 = ModelComponents_default.FeatureIdImplicitRange;
  114694. var MorphTarget2 = ModelComponents_default.MorphTarget;
  114695. var Primitive3 = ModelComponents_default.Primitive;
  114696. var Instances2 = ModelComponents_default.Instances;
  114697. var Skin2 = ModelComponents_default.Skin;
  114698. var Node5 = ModelComponents_default.Node;
  114699. var AnimatedPropertyType2 = ModelComponents_default.AnimatedPropertyType;
  114700. var AnimationSampler2 = ModelComponents_default.AnimationSampler;
  114701. var AnimationTarget2 = ModelComponents_default.AnimationTarget;
  114702. var AnimationChannel2 = ModelComponents_default.AnimationChannel;
  114703. var Animation2 = ModelComponents_default.Animation;
  114704. var Asset2 = ModelComponents_default.Asset;
  114705. var Scene2 = ModelComponents_default.Scene;
  114706. var Components2 = ModelComponents_default.Components;
  114707. var MetallicRoughness2 = ModelComponents_default.MetallicRoughness;
  114708. var SpecularGlossiness2 = ModelComponents_default.SpecularGlossiness;
  114709. var Material3 = ModelComponents_default.Material;
  114710. var GltfLoaderState = {
  114711. UNLOADED: 0,
  114712. LOADING: 1,
  114713. LOADED: 2,
  114714. PROCESSING: 3,
  114715. PROCESSED: 4,
  114716. READY: 4,
  114717. FAILED: 5
  114718. };
  114719. function GltfLoader(options) {
  114720. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  114721. const gltfResource = options.gltfResource;
  114722. let baseResource2 = options.baseResource;
  114723. const typedArray = options.typedArray;
  114724. const releaseGltfJson = defaultValue_default(options.releaseGltfJson, false);
  114725. const asynchronous = defaultValue_default(options.asynchronous, true);
  114726. const incrementallyLoadTextures = defaultValue_default(
  114727. options.incrementallyLoadTextures,
  114728. true
  114729. );
  114730. const upAxis = defaultValue_default(options.upAxis, Axis_default.Y);
  114731. const forwardAxis = defaultValue_default(options.forwardAxis, Axis_default.Z);
  114732. const loadAsTypedArray = defaultValue_default(options.loadAsTypedArray, false);
  114733. const renameBatchIdSemantic = defaultValue_default(
  114734. options.renameBatchIdSemantic,
  114735. false
  114736. );
  114737. Check_default.typeOf.object("options.gltfResource", gltfResource);
  114738. baseResource2 = defined_default(baseResource2) ? baseResource2 : gltfResource.clone();
  114739. this._gltfJson = options.gltfJson;
  114740. this._gltfResource = gltfResource;
  114741. this._baseResource = baseResource2;
  114742. this._typedArray = typedArray;
  114743. this._releaseGltfJson = releaseGltfJson;
  114744. this._asynchronous = asynchronous;
  114745. this._incrementallyLoadTextures = incrementallyLoadTextures;
  114746. this._upAxis = upAxis;
  114747. this._forwardAxis = forwardAxis;
  114748. this._loadAsTypedArray = loadAsTypedArray;
  114749. this._renameBatchIdSemantic = renameBatchIdSemantic;
  114750. this._sortedPropertyTableIds = void 0;
  114751. this._sortedFeatureTextureIds = void 0;
  114752. this._gltfJsonLoader = void 0;
  114753. this._state = GltfLoaderState.UNLOADED;
  114754. this._textureState = GltfLoaderState.UNLOADED;
  114755. this._promise = defer_default();
  114756. this._texturesLoadedPromise = defer_default();
  114757. this._textureLoaders = [];
  114758. this._bufferViewLoaders = [];
  114759. this._geometryLoaders = [];
  114760. this._structuralMetadataLoader = void 0;
  114761. this._components = void 0;
  114762. }
  114763. if (defined_default(Object.create)) {
  114764. GltfLoader.prototype = Object.create(ResourceLoader.prototype);
  114765. GltfLoader.prototype.constructor = GltfLoader;
  114766. }
  114767. Object.defineProperties(GltfLoader.prototype, {
  114768. promise: {
  114769. get: function() {
  114770. return this._promise.promise;
  114771. }
  114772. },
  114773. cacheKey: {
  114774. get: function() {
  114775. return void 0;
  114776. }
  114777. },
  114778. components: {
  114779. get: function() {
  114780. return this._components;
  114781. }
  114782. },
  114783. texturesLoadedPromise: {
  114784. get: function() {
  114785. return this._texturesLoadedPromise.promise;
  114786. }
  114787. }
  114788. });
  114789. GltfLoader.prototype.load = function() {
  114790. const gltfJsonLoader = ResourceCache_default.loadGltfJson({
  114791. gltfResource: this._gltfResource,
  114792. baseResource: this._baseResource,
  114793. typedArray: this._typedArray,
  114794. gltfJson: this._gltfJson
  114795. });
  114796. this._gltfJsonLoader = gltfJsonLoader;
  114797. this._state = GltfLoaderState.LOADING;
  114798. this._textureState = GltfLoaderState.LOADING;
  114799. const that = this;
  114800. gltfJsonLoader.promise.then(function() {
  114801. if (that.isDestroyed()) {
  114802. return;
  114803. }
  114804. that._state = GltfLoaderState.LOADED;
  114805. that._textureState = GltfLoaderState.LOADED;
  114806. }).catch(function(error) {
  114807. if (that.isDestroyed()) {
  114808. return;
  114809. }
  114810. handleError6(that, error);
  114811. });
  114812. };
  114813. function handleError6(gltfLoader, error) {
  114814. gltfLoader.unload();
  114815. gltfLoader._state = GltfLoaderState.FAILED;
  114816. gltfLoader._textureState = GltfLoaderState.FAILED;
  114817. const errorMessage = "Failed to load glTF";
  114818. error = gltfLoader.getError(errorMessage, error);
  114819. gltfLoader._promise.reject(error);
  114820. gltfLoader._texturesLoadedPromise.reject(error);
  114821. }
  114822. function process2(loader, frameState) {
  114823. let i2;
  114824. const textureLoaders = loader._textureLoaders;
  114825. const textureLoadersLength = textureLoaders.length;
  114826. for (i2 = 0; i2 < textureLoadersLength; ++i2) {
  114827. textureLoaders[i2].process(frameState);
  114828. }
  114829. const bufferViewLoaders = loader._bufferViewLoaders;
  114830. const bufferViewLoadersLength = bufferViewLoaders.length;
  114831. for (i2 = 0; i2 < bufferViewLoadersLength; ++i2) {
  114832. bufferViewLoaders[i2].process(frameState);
  114833. }
  114834. const geometryLoaders = loader._geometryLoaders;
  114835. const geometryLoadersLength = geometryLoaders.length;
  114836. for (i2 = 0; i2 < geometryLoadersLength; ++i2) {
  114837. geometryLoaders[i2].process(frameState);
  114838. }
  114839. if (defined_default(loader._structuralMetadataLoader)) {
  114840. loader._structuralMetadataLoader.process(frameState);
  114841. }
  114842. }
  114843. GltfLoader.prototype.process = function(frameState) {
  114844. Check_default.typeOf.object("frameState", frameState);
  114845. if (!FeatureDetection_default.supportsWebP.initialized) {
  114846. FeatureDetection_default.supportsWebP.initialize();
  114847. return;
  114848. }
  114849. if (this._state === GltfLoaderState.LOADED) {
  114850. this._state = GltfLoaderState.PROCESSING;
  114851. const supportedImageFormats = new SupportedImageFormats({
  114852. webp: FeatureDetection_default.supportsWebP(),
  114853. basis: frameState.context.supportsBasis
  114854. });
  114855. let gltf;
  114856. if (defined_default(this._gltfJsonLoader)) {
  114857. gltf = this._gltfJsonLoader.gltf;
  114858. } else {
  114859. gltf = this._gltfJson;
  114860. }
  114861. parse(this, gltf, supportedImageFormats, frameState);
  114862. if (defined_default(this._gltfJsonLoader) && this._releaseGltfJson) {
  114863. ResourceCache_default.unload(this._gltfJsonLoader);
  114864. this._gltfJsonLoader = void 0;
  114865. }
  114866. }
  114867. if (this._textureState === GltfLoaderState.LOADED) {
  114868. this._textureState = GltfLoaderState.PROCESSING;
  114869. }
  114870. if (this._state === GltfLoaderState.PROCESSING || this._textureState === GltfLoaderState.PROCESSING) {
  114871. process2(this, frameState);
  114872. }
  114873. if (this._state === GltfLoaderState.PROCESSED) {
  114874. unloadBufferViews2(this);
  114875. this._state = GltfLoaderState.READY;
  114876. this._promise.resolve(this);
  114877. }
  114878. if (this._textureState === GltfLoaderState.PROCESSED) {
  114879. this._textureState = GltfLoaderState.READY;
  114880. this._texturesLoadedPromise.resolve(this);
  114881. }
  114882. };
  114883. function loadVertexBuffer(loader, gltf, accessorId, semantic, draco, dequantize, loadAsTypedArray) {
  114884. const accessor = gltf.accessors[accessorId];
  114885. const bufferViewId = accessor.bufferView;
  114886. const vertexBufferLoader = ResourceCache_default.loadVertexBuffer({
  114887. gltf,
  114888. gltfResource: loader._gltfResource,
  114889. baseResource: loader._baseResource,
  114890. bufferViewId,
  114891. draco,
  114892. attributeSemantic: semantic,
  114893. accessorId,
  114894. asynchronous: loader._asynchronous,
  114895. dequantize,
  114896. loadAsTypedArray
  114897. });
  114898. loader._geometryLoaders.push(vertexBufferLoader);
  114899. return vertexBufferLoader;
  114900. }
  114901. function loadIndexBuffer(loader, gltf, accessorId, draco, loadAsTypedArray) {
  114902. const indexBufferLoader = ResourceCache_default.loadIndexBuffer({
  114903. gltf,
  114904. accessorId,
  114905. gltfResource: loader._gltfResource,
  114906. baseResource: loader._baseResource,
  114907. draco,
  114908. asynchronous: loader._asynchronous,
  114909. loadAsTypedArray
  114910. });
  114911. loader._geometryLoaders.push(indexBufferLoader);
  114912. return indexBufferLoader;
  114913. }
  114914. function loadBufferView(loader, gltf, bufferViewId) {
  114915. const bufferViewLoader = ResourceCache_default.loadBufferView({
  114916. gltf,
  114917. bufferViewId,
  114918. gltfResource: loader._gltfResource,
  114919. baseResource: loader._baseResource
  114920. });
  114921. loader._bufferViewLoaders.push(bufferViewLoader);
  114922. return bufferViewLoader;
  114923. }
  114924. function getPackedTypedArray(gltf, accessor, bufferViewTypedArray) {
  114925. let byteOffset = accessor.byteOffset;
  114926. const byteStride = getAccessorByteStride_default(gltf, accessor);
  114927. const count = accessor.count;
  114928. const componentCount = numberOfComponentsForType_default(accessor.type);
  114929. const componentType = accessor.componentType;
  114930. const componentByteLength = ComponentDatatype_default.getSizeInBytes(componentType);
  114931. const defaultByteStride = componentByteLength * componentCount;
  114932. const componentsLength = count * componentCount;
  114933. if (byteStride === defaultByteStride) {
  114934. bufferViewTypedArray = new Uint8Array(bufferViewTypedArray);
  114935. return ComponentDatatype_default.createArrayBufferView(
  114936. componentType,
  114937. bufferViewTypedArray.buffer,
  114938. bufferViewTypedArray.byteOffset + byteOffset,
  114939. componentsLength
  114940. );
  114941. }
  114942. const accessorTypedArray = ComponentDatatype_default.createTypedArray(
  114943. componentType,
  114944. componentsLength
  114945. );
  114946. const dataView = new DataView(bufferViewTypedArray.buffer);
  114947. const components = new Array(componentCount);
  114948. const componentReader = getComponentReader_default(accessor.componentType);
  114949. byteOffset = bufferViewTypedArray.byteOffset + byteOffset;
  114950. for (let i2 = 0; i2 < count; ++i2) {
  114951. componentReader(
  114952. dataView,
  114953. byteOffset,
  114954. componentCount,
  114955. componentByteLength,
  114956. components
  114957. );
  114958. for (let j = 0; j < componentCount; ++j) {
  114959. accessorTypedArray[i2 * componentCount + j] = components[j];
  114960. }
  114961. byteOffset += byteStride;
  114962. }
  114963. return accessorTypedArray;
  114964. }
  114965. function loadDefaultAccessorValues(accessor, values) {
  114966. const accessorType = accessor.type;
  114967. if (accessorType === AttributeType_default.SCALAR) {
  114968. return arrayFill_default(values, 0);
  114969. }
  114970. const MathType = AttributeType_default.getMathType(accessorType);
  114971. return arrayFill_default(values, MathType.clone(MathType.ZERO));
  114972. }
  114973. function loadAccessorValues(accessor, packedTypedArray, values, useQuaternion) {
  114974. const accessorType = accessor.type;
  114975. const accessorCount = accessor.count;
  114976. if (accessorType === AttributeType_default.SCALAR) {
  114977. for (let i2 = 0; i2 < accessorCount; i2++) {
  114978. values[i2] = packedTypedArray[i2];
  114979. }
  114980. } else if (accessorType === AttributeType_default.VEC4 && useQuaternion) {
  114981. for (let i2 = 0; i2 < accessorCount; i2++) {
  114982. values[i2] = Quaternion_default.unpack(packedTypedArray, i2 * 4);
  114983. }
  114984. } else {
  114985. const MathType = AttributeType_default.getMathType(accessorType);
  114986. const numberOfComponents = AttributeType_default.getNumberOfComponents(
  114987. accessorType
  114988. );
  114989. for (let i2 = 0; i2 < accessorCount; i2++) {
  114990. values[i2] = MathType.unpack(packedTypedArray, i2 * numberOfComponents);
  114991. }
  114992. }
  114993. return values;
  114994. }
  114995. function loadAccessor(loader, gltf, accessorId, useQuaternion) {
  114996. const accessor = gltf.accessors[accessorId];
  114997. const accessorCount = accessor.count;
  114998. const values = new Array(accessorCount);
  114999. const bufferViewId = accessor.bufferView;
  115000. if (defined_default(bufferViewId)) {
  115001. const bufferViewLoader = loadBufferView(loader, gltf, bufferViewId);
  115002. bufferViewLoader.promise.then(function(bufferViewLoader2) {
  115003. if (loader.isDestroyed()) {
  115004. return;
  115005. }
  115006. const bufferViewTypedArray = bufferViewLoader2.typedArray;
  115007. const packedTypedArray = getPackedTypedArray(
  115008. gltf,
  115009. accessor,
  115010. bufferViewTypedArray
  115011. );
  115012. useQuaternion = defaultValue_default(useQuaternion, false);
  115013. loadAccessorValues(accessor, packedTypedArray, values, useQuaternion);
  115014. }).catch(function() {
  115015. loadDefaultAccessorValues(accessor, values);
  115016. });
  115017. return values;
  115018. }
  115019. return loadDefaultAccessorValues(accessor, values);
  115020. }
  115021. function fromArray(MathType, values) {
  115022. if (!defined_default(values)) {
  115023. return void 0;
  115024. }
  115025. if (MathType === Number) {
  115026. return values[0];
  115027. }
  115028. return MathType.unpack(values);
  115029. }
  115030. function getDefault2(MathType) {
  115031. if (MathType === Number) {
  115032. return 0;
  115033. }
  115034. return new MathType();
  115035. }
  115036. function createAttribute(gltf, accessorId, name, semantic, setIndex) {
  115037. const accessor = gltf.accessors[accessorId];
  115038. const MathType = AttributeType_default.getMathType(accessor.type);
  115039. const attribute = new Attribute2();
  115040. attribute.name = name;
  115041. attribute.semantic = semantic;
  115042. attribute.setIndex = setIndex;
  115043. attribute.constant = getDefault2(MathType);
  115044. attribute.componentDatatype = accessor.componentType;
  115045. attribute.normalized = defaultValue_default(accessor.normalized, false);
  115046. attribute.count = accessor.count;
  115047. attribute.type = accessor.type;
  115048. attribute.min = fromArray(MathType, accessor.min);
  115049. attribute.max = fromArray(MathType, accessor.max);
  115050. attribute.byteOffset = accessor.byteOffset;
  115051. attribute.byteStride = getAccessorByteStride_default(gltf, accessor);
  115052. return attribute;
  115053. }
  115054. function getSetIndex(gltfSemantic) {
  115055. const setIndexRegex = /^\w+_(\d+)$/;
  115056. const setIndexMatch = setIndexRegex.exec(gltfSemantic);
  115057. if (setIndexMatch !== null) {
  115058. return parseInt(setIndexMatch[1]);
  115059. }
  115060. return void 0;
  115061. }
  115062. function loadAttribute(loader, gltf, accessorId, semanticType, gltfSemantic, draco, dequantize, loadAsTypedArray, loadAsTypedArrayPacked) {
  115063. const accessor = gltf.accessors[accessorId];
  115064. const bufferViewId = accessor.bufferView;
  115065. let renamedSemantic = gltfSemantic;
  115066. if (loader._renameBatchIdSemantic && (gltfSemantic === "_BATCHID" || gltfSemantic === "BATCHID")) {
  115067. renamedSemantic = "_FEATURE_ID_0";
  115068. }
  115069. const name = gltfSemantic;
  115070. const modelSemantic = semanticType.fromGltfSemantic(renamedSemantic);
  115071. const setIndex = defined_default(modelSemantic) ? getSetIndex(renamedSemantic) : void 0;
  115072. const attribute = createAttribute(
  115073. gltf,
  115074. accessorId,
  115075. name,
  115076. modelSemantic,
  115077. setIndex
  115078. );
  115079. if (!defined_default(draco) && !defined_default(bufferViewId)) {
  115080. return attribute;
  115081. }
  115082. const vertexBufferLoader = loadVertexBuffer(
  115083. loader,
  115084. gltf,
  115085. accessorId,
  115086. gltfSemantic,
  115087. draco,
  115088. dequantize,
  115089. loadAsTypedArray
  115090. );
  115091. vertexBufferLoader.promise.then(function(vertexBufferLoader2) {
  115092. if (loader.isDestroyed()) {
  115093. return;
  115094. }
  115095. if (loadAsTypedArrayPacked) {
  115096. const bufferViewTypedArray = vertexBufferLoader2.typedArray;
  115097. attribute.packedTypedArray = getPackedTypedArray(
  115098. gltf,
  115099. accessor,
  115100. bufferViewTypedArray
  115101. );
  115102. attribute.byteOffset = 0;
  115103. attribute.byteStride = void 0;
  115104. } else if (loadAsTypedArray) {
  115105. attribute.typedArray = vertexBufferLoader2.typedArray;
  115106. } else {
  115107. attribute.buffer = vertexBufferLoader2.buffer;
  115108. }
  115109. attribute.count = accessor.count;
  115110. if (defined_default(draco) && defined_default(draco.attributes) && defined_default(draco.attributes[gltfSemantic])) {
  115111. attribute.byteOffset = 0;
  115112. attribute.byteStride = void 0;
  115113. attribute.quantization = vertexBufferLoader2.quantization;
  115114. }
  115115. });
  115116. return attribute;
  115117. }
  115118. function loadVertexAttribute(loader, gltf, accessorId, gltfSemantic, draco) {
  115119. return loadAttribute(
  115120. loader,
  115121. gltf,
  115122. accessorId,
  115123. VertexAttributeSemantic_default,
  115124. gltfSemantic,
  115125. draco,
  115126. false,
  115127. loader._loadAsTypedArray,
  115128. false
  115129. );
  115130. }
  115131. function loadInstancedAttribute(loader, gltf, accessorId, gltfSemantic, loadAsTypedArrayPacked) {
  115132. return loadAttribute(
  115133. loader,
  115134. gltf,
  115135. accessorId,
  115136. InstanceAttributeSemantic_default,
  115137. gltfSemantic,
  115138. void 0,
  115139. true,
  115140. loadAsTypedArrayPacked,
  115141. loadAsTypedArrayPacked
  115142. );
  115143. }
  115144. function loadIndices(loader, gltf, accessorId, draco) {
  115145. const accessor = gltf.accessors[accessorId];
  115146. const bufferViewId = accessor.bufferView;
  115147. if (!defined_default(draco) && !defined_default(bufferViewId)) {
  115148. return void 0;
  115149. }
  115150. const indices2 = new Indices2();
  115151. indices2.count = accessor.count;
  115152. const loadAsTypedArray = loader._loadAsTypedArray;
  115153. const indexBufferLoader = loadIndexBuffer(
  115154. loader,
  115155. gltf,
  115156. accessorId,
  115157. draco,
  115158. loadAsTypedArray
  115159. );
  115160. indexBufferLoader.promise.then(function(indexBufferLoader2) {
  115161. if (loader.isDestroyed()) {
  115162. return;
  115163. }
  115164. indices2.indexDatatype = indexBufferLoader2.indexDatatype;
  115165. if (defined_default(indexBufferLoader2.buffer)) {
  115166. indices2.buffer = indexBufferLoader2.buffer;
  115167. } else {
  115168. indices2.typedArray = indexBufferLoader2.typedArray;
  115169. }
  115170. });
  115171. return indices2;
  115172. }
  115173. function loadTexture(loader, gltf, textureInfo, supportedImageFormats, samplerOverride) {
  115174. const imageId = GltfLoaderUtil_default.getImageIdFromTexture({
  115175. gltf,
  115176. textureId: textureInfo.index,
  115177. supportedImageFormats
  115178. });
  115179. if (!defined_default(imageId)) {
  115180. return void 0;
  115181. }
  115182. const textureLoader = ResourceCache_default.loadTexture({
  115183. gltf,
  115184. textureInfo,
  115185. gltfResource: loader._gltfResource,
  115186. baseResource: loader._baseResource,
  115187. supportedImageFormats,
  115188. asynchronous: loader._asynchronous
  115189. });
  115190. loader._textureLoaders.push(textureLoader);
  115191. const textureReader = GltfLoaderUtil_default.createModelTextureReader({
  115192. textureInfo
  115193. });
  115194. textureLoader.promise.then(function(textureLoader2) {
  115195. if (loader.isDestroyed()) {
  115196. return;
  115197. }
  115198. textureReader.texture = textureLoader2.texture;
  115199. if (defined_default(samplerOverride)) {
  115200. textureReader.texture.sampler = samplerOverride;
  115201. }
  115202. });
  115203. return textureReader;
  115204. }
  115205. function loadMaterial(loader, gltf, gltfMaterial, supportedImageFormats) {
  115206. const material = new Material3();
  115207. const extensions = defaultValue_default(
  115208. gltfMaterial.extensions,
  115209. defaultValue_default.EMPTY_OBJECT
  115210. );
  115211. const pbrSpecularGlossiness = extensions.KHR_materials_pbrSpecularGlossiness;
  115212. const pbrMetallicRoughness = gltfMaterial.pbrMetallicRoughness;
  115213. material.unlit = defined_default(extensions.KHR_materials_unlit);
  115214. if (defined_default(pbrSpecularGlossiness)) {
  115215. const specularGlossiness = new SpecularGlossiness2();
  115216. material.specularGlossiness = specularGlossiness;
  115217. if (defined_default(pbrSpecularGlossiness.diffuseTexture)) {
  115218. specularGlossiness.diffuseTexture = loadTexture(
  115219. loader,
  115220. gltf,
  115221. pbrSpecularGlossiness.diffuseTexture,
  115222. supportedImageFormats
  115223. );
  115224. }
  115225. if (defined_default(pbrSpecularGlossiness.specularGlossinessTexture)) {
  115226. if (defined_default(pbrSpecularGlossiness.specularGlossinessTexture)) {
  115227. specularGlossiness.specularGlossinessTexture = loadTexture(
  115228. loader,
  115229. gltf,
  115230. pbrSpecularGlossiness.specularGlossinessTexture,
  115231. supportedImageFormats
  115232. );
  115233. }
  115234. }
  115235. specularGlossiness.diffuseFactor = fromArray(
  115236. Cartesian4_default,
  115237. pbrSpecularGlossiness.diffuseFactor
  115238. );
  115239. specularGlossiness.specularFactor = fromArray(
  115240. Cartesian3_default,
  115241. pbrSpecularGlossiness.specularFactor
  115242. );
  115243. specularGlossiness.glossinessFactor = pbrSpecularGlossiness.glossinessFactor;
  115244. material.pbrSpecularGlossiness = pbrSpecularGlossiness;
  115245. } else if (defined_default(pbrMetallicRoughness)) {
  115246. const metallicRoughness = new MetallicRoughness2();
  115247. material.metallicRoughness = metallicRoughness;
  115248. if (defined_default(pbrMetallicRoughness.baseColorTexture)) {
  115249. metallicRoughness.baseColorTexture = loadTexture(
  115250. loader,
  115251. gltf,
  115252. pbrMetallicRoughness.baseColorTexture,
  115253. supportedImageFormats
  115254. );
  115255. }
  115256. if (defined_default(pbrMetallicRoughness.metallicRoughnessTexture)) {
  115257. metallicRoughness.metallicRoughnessTexture = loadTexture(
  115258. loader,
  115259. gltf,
  115260. pbrMetallicRoughness.metallicRoughnessTexture,
  115261. supportedImageFormats
  115262. );
  115263. }
  115264. metallicRoughness.baseColorFactor = fromArray(
  115265. Cartesian4_default,
  115266. pbrMetallicRoughness.baseColorFactor
  115267. );
  115268. metallicRoughness.metallicFactor = pbrMetallicRoughness.metallicFactor;
  115269. metallicRoughness.roughnessFactor = pbrMetallicRoughness.roughnessFactor;
  115270. material.pbrMetallicRoughness = pbrMetallicRoughness;
  115271. }
  115272. if (defined_default(gltfMaterial.emissiveTexture)) {
  115273. material.emissiveTexture = loadTexture(
  115274. loader,
  115275. gltf,
  115276. gltfMaterial.emissiveTexture,
  115277. supportedImageFormats
  115278. );
  115279. }
  115280. if (defined_default(gltfMaterial.normalTexture)) {
  115281. material.normalTexture = loadTexture(
  115282. loader,
  115283. gltf,
  115284. gltfMaterial.normalTexture,
  115285. supportedImageFormats
  115286. );
  115287. }
  115288. if (defined_default(gltfMaterial.occlusionTexture)) {
  115289. material.occlusionTexture = loadTexture(
  115290. loader,
  115291. gltf,
  115292. gltfMaterial.occlusionTexture,
  115293. supportedImageFormats
  115294. );
  115295. }
  115296. material.emissiveFactor = fromArray(Cartesian3_default, gltfMaterial.emissiveFactor);
  115297. material.alphaMode = gltfMaterial.alphaMode;
  115298. material.alphaCutoff = gltfMaterial.alphaCutoff;
  115299. material.doubleSided = gltfMaterial.doubleSided;
  115300. return material;
  115301. }
  115302. function loadFeatureIdAttribute(featureIds, positionalLabel) {
  115303. const featureIdAttribute = new FeatureIdAttribute2();
  115304. featureIdAttribute.featureCount = featureIds.featureCount;
  115305. featureIdAttribute.nullFeatureId = featureIds.nullFeatureId;
  115306. featureIdAttribute.propertyTableId = featureIds.propertyTable;
  115307. featureIdAttribute.setIndex = featureIds.attribute;
  115308. featureIdAttribute.label = featureIds.label;
  115309. featureIdAttribute.positionalLabel = positionalLabel;
  115310. return featureIdAttribute;
  115311. }
  115312. function loadFeatureIdAttributeLegacy(gltfFeatureIdAttribute, featureTableId, featureCount, positionalLabel) {
  115313. const featureIdAttribute = new FeatureIdAttribute2();
  115314. const featureIds = gltfFeatureIdAttribute.featureIds;
  115315. featureIdAttribute.featureCount = featureCount;
  115316. featureIdAttribute.propertyTableId = featureTableId;
  115317. featureIdAttribute.setIndex = getSetIndex(featureIds.attribute);
  115318. featureIdAttribute.positionalLabel = positionalLabel;
  115319. return featureIdAttribute;
  115320. }
  115321. function loadDefaultFeatureIds(featureIds, positionalLabel) {
  115322. const featureIdRange = new FeatureIdImplicitRange2();
  115323. featureIdRange.propertyTableId = featureIds.propertyTable;
  115324. featureIdRange.featureCount = featureIds.featureCount;
  115325. featureIdRange.nullFeatureId = featureIds.nullFeatureId;
  115326. featureIdRange.label = featureIds.label;
  115327. featureIdRange.positionalLabel = positionalLabel;
  115328. featureIdRange.offset = 0;
  115329. featureIdRange.repeat = 1;
  115330. return featureIdRange;
  115331. }
  115332. function loadFeatureIdImplicitRangeLegacy(gltfFeatureIdAttribute, featureTableId, featureCount, positionalLabel) {
  115333. const featureIdRange = new FeatureIdImplicitRange2();
  115334. const featureIds = gltfFeatureIdAttribute.featureIds;
  115335. featureIdRange.propertyTableId = featureTableId;
  115336. featureIdRange.featureCount = featureCount;
  115337. featureIdRange.offset = defaultValue_default(featureIds.constant, 0);
  115338. const divisor = defaultValue_default(featureIds.divisor, 0);
  115339. featureIdRange.repeat = divisor === 0 ? void 0 : divisor;
  115340. featureIdRange.positionalLabel = positionalLabel;
  115341. return featureIdRange;
  115342. }
  115343. function loadFeatureIdTexture(loader, gltf, gltfFeatureIdTexture, supportedImageFormats, positionalLabel) {
  115344. const featureIdTexture = new FeatureIdTexture2();
  115345. featureIdTexture.featureCount = gltfFeatureIdTexture.featureCount;
  115346. featureIdTexture.nullFeatureId = gltfFeatureIdTexture.nullFeatureId;
  115347. featureIdTexture.propertyTableId = gltfFeatureIdTexture.propertyTable;
  115348. featureIdTexture.label = gltfFeatureIdTexture.label;
  115349. featureIdTexture.positionalLabel = positionalLabel;
  115350. const textureInfo = gltfFeatureIdTexture.texture;
  115351. featureIdTexture.textureReader = loadTexture(
  115352. loader,
  115353. gltf,
  115354. textureInfo,
  115355. supportedImageFormats,
  115356. Sampler_default.NEAREST
  115357. );
  115358. const channelString = textureInfo.channels.map(function(channelIndex) {
  115359. return "rgba".charAt(channelIndex);
  115360. }).join("");
  115361. featureIdTexture.textureReader.channels = channelString;
  115362. return featureIdTexture;
  115363. }
  115364. function loadFeatureIdTextureLegacy(loader, gltf, gltfFeatureIdTexture, featureTableId, supportedImageFormats, featureCount, positionalLabel) {
  115365. const featureIdTexture = new FeatureIdTexture2();
  115366. const featureIds = gltfFeatureIdTexture.featureIds;
  115367. const textureInfo = featureIds.texture;
  115368. featureIdTexture.featureCount = featureCount;
  115369. featureIdTexture.propertyTableId = featureTableId;
  115370. featureIdTexture.textureReader = loadTexture(
  115371. loader,
  115372. gltf,
  115373. textureInfo,
  115374. supportedImageFormats,
  115375. Sampler_default.NEAREST
  115376. );
  115377. featureIdTexture.textureReader.channels = featureIds.channels;
  115378. featureIdTexture.positionalLabel = positionalLabel;
  115379. return featureIdTexture;
  115380. }
  115381. function loadMorphTarget(loader, gltf, target) {
  115382. const morphTarget = new MorphTarget2();
  115383. for (const semantic in target) {
  115384. if (target.hasOwnProperty(semantic)) {
  115385. const accessorId = target[semantic];
  115386. morphTarget.attributes.push(
  115387. loadVertexAttribute(loader, gltf, accessorId, semantic, void 0)
  115388. );
  115389. }
  115390. }
  115391. return morphTarget;
  115392. }
  115393. function loadPrimitive(loader, gltf, gltfPrimitive, supportedImageFormats) {
  115394. const primitive = new Primitive3();
  115395. const materialId = gltfPrimitive.material;
  115396. if (defined_default(materialId)) {
  115397. primitive.material = loadMaterial(
  115398. loader,
  115399. gltf,
  115400. gltf.materials[materialId],
  115401. supportedImageFormats
  115402. );
  115403. }
  115404. const extensions = defaultValue_default(
  115405. gltfPrimitive.extensions,
  115406. defaultValue_default.EMPTY_OBJECT
  115407. );
  115408. const draco = extensions.KHR_draco_mesh_compression;
  115409. const attributes = gltfPrimitive.attributes;
  115410. if (defined_default(attributes)) {
  115411. for (const semantic in attributes) {
  115412. if (attributes.hasOwnProperty(semantic)) {
  115413. const accessorId = attributes[semantic];
  115414. primitive.attributes.push(
  115415. loadVertexAttribute(loader, gltf, accessorId, semantic, draco)
  115416. );
  115417. }
  115418. }
  115419. }
  115420. const targets = gltfPrimitive.targets;
  115421. if (defined_default(targets)) {
  115422. const targetsLength = targets.length;
  115423. for (let i2 = 0; i2 < targetsLength; ++i2) {
  115424. primitive.morphTargets.push(loadMorphTarget(loader, gltf, targets[i2]));
  115425. }
  115426. }
  115427. const indices2 = gltfPrimitive.indices;
  115428. if (defined_default(indices2)) {
  115429. primitive.indices = loadIndices(loader, gltf, indices2, draco);
  115430. }
  115431. const structuralMetadata = extensions.EXT_structural_metadata;
  115432. const meshFeatures = extensions.EXT_mesh_features;
  115433. const featureMetadataLegacy = extensions.EXT_feature_metadata;
  115434. const hasFeatureMetadataLegacy = defined_default(featureMetadataLegacy);
  115435. if (defined_default(meshFeatures)) {
  115436. loadPrimitiveFeatures(
  115437. loader,
  115438. gltf,
  115439. primitive,
  115440. meshFeatures,
  115441. supportedImageFormats
  115442. );
  115443. } else if (hasFeatureMetadataLegacy) {
  115444. loadPrimitiveFeaturesLegacy(
  115445. loader,
  115446. gltf,
  115447. primitive,
  115448. featureMetadataLegacy,
  115449. supportedImageFormats
  115450. );
  115451. }
  115452. if (defined_default(structuralMetadata)) {
  115453. loadPrimitiveMetadata(primitive, structuralMetadata);
  115454. } else if (hasFeatureMetadataLegacy) {
  115455. loadPrimitiveMetadataLegacy(loader, primitive, featureMetadataLegacy);
  115456. }
  115457. primitive.primitiveType = gltfPrimitive.mode;
  115458. return primitive;
  115459. }
  115460. function loadPrimitiveFeatures(loader, gltf, primitive, meshFeaturesExtension, supportedImageFormats) {
  115461. let featureIdsArray;
  115462. if (defined_default(meshFeaturesExtension) && defined_default(meshFeaturesExtension.featureIds)) {
  115463. featureIdsArray = meshFeaturesExtension.featureIds;
  115464. } else {
  115465. featureIdsArray = [];
  115466. }
  115467. for (let i2 = 0; i2 < featureIdsArray.length; i2++) {
  115468. const featureIds = featureIdsArray[i2];
  115469. const label = `featureId_${i2}`;
  115470. let featureIdComponent;
  115471. if (defined_default(featureIds.texture)) {
  115472. featureIdComponent = loadFeatureIdTexture(
  115473. loader,
  115474. gltf,
  115475. featureIds,
  115476. supportedImageFormats,
  115477. label
  115478. );
  115479. } else if (defined_default(featureIds.attribute)) {
  115480. featureIdComponent = loadFeatureIdAttribute(featureIds, label);
  115481. } else {
  115482. featureIdComponent = loadDefaultFeatureIds(featureIds, label);
  115483. }
  115484. primitive.featureIds.push(featureIdComponent);
  115485. }
  115486. }
  115487. function loadPrimitiveFeaturesLegacy(loader, gltf, primitive, metadataExtension, supportedImageFormats) {
  115488. const featureTables = gltf.extensions.EXT_feature_metadata.featureTables;
  115489. let nextFeatureIdIndex = 0;
  115490. const featureIdAttributes = metadataExtension.featureIdAttributes;
  115491. if (defined_default(featureIdAttributes)) {
  115492. const featureIdAttributesLength = featureIdAttributes.length;
  115493. for (let i2 = 0; i2 < featureIdAttributesLength; ++i2) {
  115494. const featureIdAttribute = featureIdAttributes[i2];
  115495. const featureTableId = featureIdAttribute.featureTable;
  115496. const propertyTableId = loader._sortedPropertyTableIds.indexOf(
  115497. featureTableId
  115498. );
  115499. const featureCount = featureTables[featureTableId].count;
  115500. const label = `featureId_${nextFeatureIdIndex}`;
  115501. nextFeatureIdIndex++;
  115502. let featureIdComponent;
  115503. if (defined_default(featureIdAttribute.featureIds.attribute)) {
  115504. featureIdComponent = loadFeatureIdAttributeLegacy(
  115505. featureIdAttribute,
  115506. propertyTableId,
  115507. featureCount,
  115508. label
  115509. );
  115510. } else {
  115511. featureIdComponent = loadFeatureIdImplicitRangeLegacy(
  115512. featureIdAttribute,
  115513. propertyTableId,
  115514. featureCount,
  115515. label
  115516. );
  115517. }
  115518. primitive.featureIds.push(featureIdComponent);
  115519. }
  115520. }
  115521. const featureIdTextures = metadataExtension.featureIdTextures;
  115522. if (defined_default(featureIdTextures)) {
  115523. const featureIdTexturesLength = featureIdTextures.length;
  115524. for (let i2 = 0; i2 < featureIdTexturesLength; ++i2) {
  115525. const featureIdTexture = featureIdTextures[i2];
  115526. const featureTableId = featureIdTexture.featureTable;
  115527. const propertyTableId = loader._sortedPropertyTableIds.indexOf(
  115528. featureTableId
  115529. );
  115530. const featureCount = featureTables[featureTableId].count;
  115531. const featureIdLabel = `featureId_${nextFeatureIdIndex}`;
  115532. nextFeatureIdIndex++;
  115533. const featureIdComponent = loadFeatureIdTextureLegacy(
  115534. loader,
  115535. gltf,
  115536. featureIdTexture,
  115537. propertyTableId,
  115538. supportedImageFormats,
  115539. featureCount,
  115540. featureIdLabel
  115541. );
  115542. primitive.featureIds.push(featureIdComponent);
  115543. }
  115544. }
  115545. }
  115546. function loadPrimitiveMetadata(primitive, structuralMetadataExtension) {
  115547. if (!defined_default(structuralMetadataExtension)) {
  115548. return;
  115549. }
  115550. if (defined_default(structuralMetadataExtension.propertyTextures)) {
  115551. primitive.propertyTextureIds = structuralMetadataExtension.propertyTextures;
  115552. }
  115553. if (defined_default(structuralMetadataExtension.propertyAttributes)) {
  115554. primitive.propertyAttributeIds = structuralMetadataExtension.propertyAttributes;
  115555. }
  115556. }
  115557. function loadPrimitiveMetadataLegacy(loader, primitive, metadataExtension) {
  115558. if (defined_default(metadataExtension.featureTextures)) {
  115559. primitive.propertyTextureIds = metadataExtension.featureTextures.map(
  115560. function(id) {
  115561. return loader._sortedFeatureTextureIds.indexOf(id);
  115562. }
  115563. );
  115564. }
  115565. }
  115566. function loadInstances(loader, gltf, nodeExtensions, frameState) {
  115567. const instancingExtension = nodeExtensions.EXT_mesh_gpu_instancing;
  115568. const instances = new Instances2();
  115569. const attributes = instancingExtension.attributes;
  115570. if (defined_default(attributes)) {
  115571. const hasRotation = defined_default(attributes.ROTATION);
  115572. const hasTranslationMinMax = defined_default(attributes.TRANSLATION) && defined_default(gltf.accessors[attributes.TRANSLATION].min) && defined_default(gltf.accessors[attributes.TRANSLATION].max);
  115573. for (const semantic in attributes) {
  115574. if (attributes.hasOwnProperty(semantic)) {
  115575. const loadAsTypedArrayPacked = loader._loadAsTypedArray || !frameState.context.instancedArrays || (hasRotation || !hasTranslationMinMax) && (semantic === InstanceAttributeSemantic_default.TRANSLATION || semantic === InstanceAttributeSemantic_default.ROTATION || semantic === InstanceAttributeSemantic_default.SCALE) || semantic.indexOf(InstanceAttributeSemantic_default.FEATURE_ID) >= 0;
  115576. const accessorId = attributes[semantic];
  115577. instances.attributes.push(
  115578. loadInstancedAttribute(
  115579. loader,
  115580. gltf,
  115581. accessorId,
  115582. semantic,
  115583. loadAsTypedArrayPacked
  115584. )
  115585. );
  115586. }
  115587. }
  115588. }
  115589. const instancingExtExtensions = defaultValue_default(
  115590. instancingExtension.extensions,
  115591. defaultValue_default.EMPTY_OBJECT
  115592. );
  115593. const instanceFeatures = nodeExtensions.EXT_instance_features;
  115594. const featureMetadataLegacy = instancingExtExtensions.EXT_feature_metadata;
  115595. if (defined_default(instanceFeatures)) {
  115596. loadInstanceFeatures(instances, instanceFeatures);
  115597. } else if (defined_default(featureMetadataLegacy)) {
  115598. loadInstanceFeaturesLegacy(
  115599. gltf,
  115600. instances,
  115601. featureMetadataLegacy,
  115602. loader._sortedPropertyTableIds
  115603. );
  115604. }
  115605. return instances;
  115606. }
  115607. function loadInstanceFeatures(instances, instanceFeaturesExtension) {
  115608. const featureIdsArray = instanceFeaturesExtension.featureIds;
  115609. for (let i2 = 0; i2 < featureIdsArray.length; i2++) {
  115610. const featureIds = featureIdsArray[i2];
  115611. const label = `instanceFeatureId_${i2}`;
  115612. let featureIdComponent;
  115613. if (defined_default(featureIds.attribute)) {
  115614. featureIdComponent = loadFeatureIdAttribute(featureIds, label);
  115615. } else {
  115616. featureIdComponent = loadDefaultFeatureIds(featureIds, label);
  115617. }
  115618. instances.featureIds.push(featureIdComponent);
  115619. }
  115620. }
  115621. function loadInstanceFeaturesLegacy(gltf, instances, metadataExtension, sortedPropertyTableIds) {
  115622. const featureTables = gltf.extensions.EXT_feature_metadata.featureTables;
  115623. const featureIdAttributes = metadataExtension.featureIdAttributes;
  115624. if (defined_default(featureIdAttributes)) {
  115625. const featureIdAttributesLength = featureIdAttributes.length;
  115626. for (let i2 = 0; i2 < featureIdAttributesLength; ++i2) {
  115627. const featureIdAttribute = featureIdAttributes[i2];
  115628. const featureTableId = featureIdAttribute.featureTable;
  115629. const propertyTableId = sortedPropertyTableIds.indexOf(featureTableId);
  115630. const featureCount = featureTables[featureTableId].count;
  115631. const label = `instanceFeatureId_${i2}`;
  115632. let featureIdComponent;
  115633. if (defined_default(featureIdAttribute.featureIds.attribute)) {
  115634. featureIdComponent = loadFeatureIdAttributeLegacy(
  115635. featureIdAttribute,
  115636. propertyTableId,
  115637. featureCount,
  115638. label
  115639. );
  115640. } else {
  115641. featureIdComponent = loadFeatureIdImplicitRangeLegacy(
  115642. featureIdAttribute,
  115643. propertyTableId,
  115644. featureCount,
  115645. label
  115646. );
  115647. }
  115648. instances.featureIds.push(featureIdComponent);
  115649. }
  115650. }
  115651. }
  115652. function loadNode(loader, gltf, gltfNode, supportedImageFormats, frameState) {
  115653. const node = new Node5();
  115654. node.name = gltfNode.name;
  115655. node.matrix = fromArray(Matrix4_default, gltfNode.matrix);
  115656. node.translation = fromArray(Cartesian3_default, gltfNode.translation);
  115657. node.rotation = fromArray(Quaternion_default, gltfNode.rotation);
  115658. node.scale = fromArray(Cartesian3_default, gltfNode.scale);
  115659. const meshId = gltfNode.mesh;
  115660. if (defined_default(meshId)) {
  115661. const mesh2 = gltf.meshes[meshId];
  115662. const primitives = mesh2.primitives;
  115663. const primitivesLength = primitives.length;
  115664. for (let i2 = 0; i2 < primitivesLength; ++i2) {
  115665. node.primitives.push(
  115666. loadPrimitive(loader, gltf, primitives[i2], supportedImageFormats)
  115667. );
  115668. }
  115669. const morphWeights = defaultValue_default(gltfNode.weights, mesh2.weights);
  115670. const targets = node.primitives[0].morphTargets;
  115671. const targetsLength = targets.length;
  115672. node.morphWeights = defined_default(morphWeights) ? morphWeights.slice() : arrayFill_default(new Array(targetsLength), 0);
  115673. }
  115674. const nodeExtensions = defaultValue_default(
  115675. gltfNode.extensions,
  115676. defaultValue_default.EMPTY_OBJECT
  115677. );
  115678. const instancingExtension = nodeExtensions.EXT_mesh_gpu_instancing;
  115679. if (defined_default(instancingExtension)) {
  115680. node.instances = loadInstances(loader, gltf, nodeExtensions, frameState);
  115681. }
  115682. return node;
  115683. }
  115684. function loadNodes(loader, gltf, supportedImageFormats, frameState) {
  115685. let i2;
  115686. let j;
  115687. const nodesLength = gltf.nodes.length;
  115688. const nodes = new Array(nodesLength);
  115689. for (i2 = 0; i2 < nodesLength; ++i2) {
  115690. const node = loadNode(
  115691. loader,
  115692. gltf,
  115693. gltf.nodes[i2],
  115694. supportedImageFormats,
  115695. frameState
  115696. );
  115697. node.index = i2;
  115698. nodes[i2] = node;
  115699. }
  115700. for (i2 = 0; i2 < nodesLength; ++i2) {
  115701. const childrenNodeIds = gltf.nodes[i2].children;
  115702. if (defined_default(childrenNodeIds)) {
  115703. const childrenLength = childrenNodeIds.length;
  115704. for (j = 0; j < childrenLength; ++j) {
  115705. nodes[i2].children.push(nodes[childrenNodeIds[j]]);
  115706. }
  115707. }
  115708. }
  115709. return nodes;
  115710. }
  115711. function loadSkin(loader, gltf, gltfSkin, nodes) {
  115712. const skin = new Skin2();
  115713. const jointIds = gltfSkin.joints;
  115714. const jointsLength = jointIds.length;
  115715. const joints = new Array(jointsLength);
  115716. for (let i2 = 0; i2 < jointsLength; ++i2) {
  115717. joints[i2] = nodes[jointIds[i2]];
  115718. }
  115719. skin.joints = joints;
  115720. const inverseBindMatricesAccessorId = gltfSkin.inverseBindMatrices;
  115721. if (defined_default(inverseBindMatricesAccessorId)) {
  115722. skin.inverseBindMatrices = loadAccessor(
  115723. loader,
  115724. gltf,
  115725. inverseBindMatricesAccessorId
  115726. );
  115727. } else {
  115728. skin.inverseBindMatrices = arrayFill_default(
  115729. new Array(jointsLength),
  115730. Matrix4_default.IDENTITY
  115731. );
  115732. }
  115733. return skin;
  115734. }
  115735. function loadSkins(loader, gltf, nodes) {
  115736. let i2;
  115737. const gltfSkins = gltf.skins;
  115738. if (!defined_default(gltfSkins)) {
  115739. return [];
  115740. }
  115741. const skinsLength = gltf.skins.length;
  115742. const skins = new Array(skinsLength);
  115743. for (i2 = 0; i2 < skinsLength; ++i2) {
  115744. const skin = loadSkin(loader, gltf, gltf.skins[i2], nodes);
  115745. skin.index = i2;
  115746. skins[i2] = skin;
  115747. }
  115748. const nodesLength = nodes.length;
  115749. for (i2 = 0; i2 < nodesLength; ++i2) {
  115750. const skinId = gltf.nodes[i2].skin;
  115751. if (defined_default(skinId)) {
  115752. nodes[i2].skin = skins[skinId];
  115753. }
  115754. }
  115755. return skins;
  115756. }
  115757. function loadStructuralMetadata(loader, gltf, extension, extensionLegacy, supportedImageFormats) {
  115758. const structuralMetadataLoader = new GltfStructuralMetadataLoader({
  115759. gltf,
  115760. extension,
  115761. extensionLegacy,
  115762. gltfResource: loader._gltfResource,
  115763. baseResource: loader._baseResource,
  115764. supportedImageFormats,
  115765. asynchronous: loader._asynchronous
  115766. });
  115767. structuralMetadataLoader.load();
  115768. loader._structuralMetadataLoader = structuralMetadataLoader;
  115769. return structuralMetadataLoader;
  115770. }
  115771. function loadAnimationSampler(loader, gltf, gltfSampler) {
  115772. const animationSampler = new AnimationSampler2();
  115773. const inputAccessorId = gltfSampler.input;
  115774. animationSampler.input = loadAccessor(loader, gltf, inputAccessorId);
  115775. const gltfInterpolation = gltfSampler.interpolation;
  115776. animationSampler.interpolation = defaultValue_default(
  115777. InterpolationType_default[gltfInterpolation],
  115778. InterpolationType_default.LINEAR
  115779. );
  115780. const outputAccessorId = gltfSampler.output;
  115781. animationSampler.output = loadAccessor(loader, gltf, outputAccessorId, true);
  115782. return animationSampler;
  115783. }
  115784. function loadAnimationTarget(gltfTarget, nodes) {
  115785. const animationTarget = new AnimationTarget2();
  115786. const nodeIndex = gltfTarget.node;
  115787. if (!defined_default(nodeIndex)) {
  115788. return void 0;
  115789. }
  115790. animationTarget.node = nodes[nodeIndex];
  115791. const path = gltfTarget.path.toUpperCase();
  115792. animationTarget.path = AnimatedPropertyType2[path];
  115793. return animationTarget;
  115794. }
  115795. function loadAnimationChannel(gltfChannel, samplers, nodes) {
  115796. const animationChannel = new AnimationChannel2();
  115797. const samplerIndex = gltfChannel.sampler;
  115798. animationChannel.sampler = samplers[samplerIndex];
  115799. animationChannel.target = loadAnimationTarget(gltfChannel.target, nodes);
  115800. return animationChannel;
  115801. }
  115802. function loadAnimation(loader, gltf, gltfAnimation, nodes) {
  115803. let i2;
  115804. const animation = new Animation2();
  115805. animation.name = gltfAnimation.name;
  115806. const gltfSamplers = gltfAnimation.samplers;
  115807. const samplersLength = gltfSamplers.length;
  115808. const samplers = new Array(samplersLength);
  115809. for (i2 = 0; i2 < samplersLength; i2++) {
  115810. const sampler = loadAnimationSampler(loader, gltf, gltfSamplers[i2]);
  115811. sampler.index = i2;
  115812. samplers[i2] = sampler;
  115813. }
  115814. const gltfChannels = gltfAnimation.channels;
  115815. const channelsLength = gltfChannels.length;
  115816. const channels = new Array(channelsLength);
  115817. for (i2 = 0; i2 < channelsLength; i2++) {
  115818. channels[i2] = loadAnimationChannel(gltfChannels[i2], samplers, nodes);
  115819. }
  115820. animation.samplers = samplers;
  115821. animation.channels = channels;
  115822. return animation;
  115823. }
  115824. function loadAnimations(loader, gltf, nodes) {
  115825. let i2;
  115826. const gltfAnimations = gltf.animations;
  115827. if (!defined_default(gltfAnimations)) {
  115828. return [];
  115829. }
  115830. const animationsLength = gltf.animations.length;
  115831. const animations = new Array(animationsLength);
  115832. for (i2 = 0; i2 < animationsLength; ++i2) {
  115833. const animation = loadAnimation(loader, gltf, gltf.animations[i2], nodes);
  115834. animation.index = i2;
  115835. animations[i2] = animation;
  115836. }
  115837. return animations;
  115838. }
  115839. function getSceneNodeIds(gltf) {
  115840. let nodesIds;
  115841. if (defined_default(gltf.scenes) && defined_default(gltf.scene)) {
  115842. nodesIds = gltf.scenes[gltf.scene].nodes;
  115843. }
  115844. nodesIds = defaultValue_default(nodesIds, gltf.nodes);
  115845. nodesIds = defined_default(nodesIds) ? nodesIds : [];
  115846. return nodesIds;
  115847. }
  115848. function loadScene(gltf, nodes) {
  115849. const scene = new Scene2();
  115850. const sceneNodeIds = getSceneNodeIds(gltf);
  115851. scene.nodes = sceneNodeIds.map(function(sceneNodeId) {
  115852. return nodes[sceneNodeId];
  115853. });
  115854. return scene;
  115855. }
  115856. function parse(loader, gltf, supportedImageFormats, frameState) {
  115857. const extensions = defaultValue_default(gltf.extensions, defaultValue_default.EMPTY_OBJECT);
  115858. const structuralMetadataExtension = extensions.EXT_structural_metadata;
  115859. const featureMetadataExtensionLegacy = extensions.EXT_feature_metadata;
  115860. if (defined_default(featureMetadataExtensionLegacy)) {
  115861. const featureTables = featureMetadataExtensionLegacy.featureTables;
  115862. const featureTextures = featureMetadataExtensionLegacy.featureTextures;
  115863. const allPropertyTableIds = defined_default(featureTables) ? featureTables : [];
  115864. const allFeatureTextureIds = defined_default(featureTextures) ? featureTextures : [];
  115865. loader._sortedPropertyTableIds = Object.keys(allPropertyTableIds).sort();
  115866. loader._sortedFeatureTextureIds = Object.keys(allFeatureTextureIds).sort();
  115867. }
  115868. const nodes = loadNodes(loader, gltf, supportedImageFormats, frameState);
  115869. const skins = loadSkins(loader, gltf, nodes);
  115870. const animations = loadAnimations(loader, gltf, nodes);
  115871. const scene = loadScene(gltf, nodes);
  115872. const components = new Components2();
  115873. const asset = new Asset2();
  115874. const copyright = gltf.asset.copyright;
  115875. if (defined_default(copyright)) {
  115876. const credits = copyright.split(";").map(function(string) {
  115877. return new Credit_default(string.trim());
  115878. });
  115879. asset.credits = credits;
  115880. }
  115881. components.asset = asset;
  115882. components.scene = scene;
  115883. components.nodes = nodes;
  115884. components.skins = skins;
  115885. components.animations = animations;
  115886. components.upAxis = loader._upAxis;
  115887. components.forwardAxis = loader._forwardAxis;
  115888. loader._components = components;
  115889. if (defined_default(structuralMetadataExtension) || defined_default(featureMetadataExtensionLegacy)) {
  115890. const structuralMetadataLoader = loadStructuralMetadata(
  115891. loader,
  115892. gltf,
  115893. structuralMetadataExtension,
  115894. featureMetadataExtensionLegacy,
  115895. supportedImageFormats
  115896. );
  115897. structuralMetadataLoader.promise.then(function(structuralMetadataLoader2) {
  115898. if (loader.isDestroyed()) {
  115899. return;
  115900. }
  115901. components.structuralMetadata = structuralMetadataLoader2.structuralMetadata;
  115902. });
  115903. }
  115904. const loaders = [];
  115905. loaders.push.apply(loaders, loader._bufferViewLoaders);
  115906. loaders.push.apply(loaders, loader._geometryLoaders);
  115907. if (defined_default(loader._structuralMetadataLoader)) {
  115908. loaders.push(loader._structuralMetadataLoader);
  115909. }
  115910. if (!loader._incrementallyLoadTextures) {
  115911. loaders.push.apply(loaders, loader._textureLoaders);
  115912. }
  115913. const readyPromises = loaders.map(function(loader2) {
  115914. return loader2.promise;
  115915. });
  115916. const texturePromises = loader._textureLoaders.map(function(loader2) {
  115917. return loader2.promise;
  115918. });
  115919. Promise.all(readyPromises).then(function() {
  115920. if (loader.isDestroyed()) {
  115921. return;
  115922. }
  115923. loader._state = GltfLoaderState.PROCESSED;
  115924. }).catch(function(error) {
  115925. if (loader.isDestroyed()) {
  115926. return;
  115927. }
  115928. handleError6(loader, error);
  115929. });
  115930. Promise.all(texturePromises).then(function() {
  115931. if (loader.isDestroyed()) {
  115932. return;
  115933. }
  115934. loader._textureState = GltfLoaderState.PROCESSED;
  115935. });
  115936. }
  115937. function unloadTextures2(loader) {
  115938. const textureLoaders = loader._textureLoaders;
  115939. const textureLoadersLength = textureLoaders.length;
  115940. for (let i2 = 0; i2 < textureLoadersLength; ++i2) {
  115941. ResourceCache_default.unload(textureLoaders[i2]);
  115942. }
  115943. loader._textureLoaders.length = 0;
  115944. }
  115945. function unloadBufferViews2(loader) {
  115946. const bufferViewLoaders = loader._bufferViewLoaders;
  115947. const bufferViewLoadersLength = bufferViewLoaders.length;
  115948. for (let i2 = 0; i2 < bufferViewLoadersLength; ++i2) {
  115949. ResourceCache_default.unload(bufferViewLoaders[i2]);
  115950. }
  115951. loader._bufferViewLoaders.length = 0;
  115952. }
  115953. function unloadGeometry(loader) {
  115954. const geometryLoaders = loader._geometryLoaders;
  115955. const geometryLoadersLength = geometryLoaders.length;
  115956. for (let i2 = 0; i2 < geometryLoadersLength; ++i2) {
  115957. ResourceCache_default.unload(geometryLoaders[i2]);
  115958. }
  115959. loader._geometryLoaders.length = 0;
  115960. }
  115961. function unloadStructuralMetadata(loader) {
  115962. if (defined_default(loader._structuralMetadataLoader)) {
  115963. loader._structuralMetadataLoader.destroy();
  115964. loader._structuralMetadataLoader = void 0;
  115965. }
  115966. }
  115967. GltfLoader.prototype.unload = function() {
  115968. if (defined_default(this._gltfJsonLoader)) {
  115969. ResourceCache_default.unload(this._gltfJsonLoader);
  115970. }
  115971. this._gltfJsonLoader = void 0;
  115972. unloadTextures2(this);
  115973. unloadBufferViews2(this);
  115974. unloadGeometry(this);
  115975. unloadStructuralMetadata(this);
  115976. this._components = void 0;
  115977. };
  115978. // node_modules/cesium/Source/Scene/ModelExperimental/ModelExperimentalAnimationChannel.js
  115979. var AnimatedPropertyType3 = ModelComponents_default.AnimatedPropertyType;
  115980. function ModelExperimentalAnimationChannel(options) {
  115981. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  115982. const channel = options.channel;
  115983. const runtimeAnimation = options.runtimeAnimation;
  115984. const runtimeNode = options.runtimeNode;
  115985. Check_default.typeOf.object("options.channel", channel);
  115986. Check_default.typeOf.object("options.runtimeAnimation", runtimeAnimation);
  115987. Check_default.typeOf.object("options.runtimeNode", runtimeNode);
  115988. this._channel = channel;
  115989. this._runtimeAnimation = runtimeAnimation;
  115990. this._runtimeNode = runtimeNode;
  115991. this._splines = [];
  115992. this._path = void 0;
  115993. initialize13(this);
  115994. }
  115995. Object.defineProperties(ModelExperimentalAnimationChannel.prototype, {
  115996. channel: {
  115997. get: function() {
  115998. return this._channel;
  115999. }
  116000. },
  116001. runtimeAnimation: {
  116002. get: function() {
  116003. return this._runtimeAnimation;
  116004. }
  116005. },
  116006. runtimeNode: {
  116007. get: function() {
  116008. return this._runtimeNode;
  116009. }
  116010. },
  116011. splines: {
  116012. get: function() {
  116013. return this._splines;
  116014. }
  116015. }
  116016. });
  116017. function createCubicSpline(times, points) {
  116018. const cubicPoints = [];
  116019. const inTangents = [];
  116020. const outTangents = [];
  116021. const length3 = points.length;
  116022. for (let i2 = 0; i2 < length3; i2 += 3) {
  116023. inTangents.push(points[i2]);
  116024. cubicPoints.push(points[i2 + 1]);
  116025. outTangents.push(points[i2 + 2]);
  116026. }
  116027. inTangents.splice(0, 1);
  116028. outTangents.length = outTangents.length - 1;
  116029. return new HermiteSpline_default({
  116030. times,
  116031. points: cubicPoints,
  116032. inTangents,
  116033. outTangents
  116034. });
  116035. }
  116036. function createSpline(times, points, interpolation, path) {
  116037. if (times.length === 1 && points.length === 1) {
  116038. return new ConstantSpline_default(points[0]);
  116039. }
  116040. switch (interpolation) {
  116041. case InterpolationType_default.STEP:
  116042. return new SteppedSpline_default({
  116043. times,
  116044. points
  116045. });
  116046. case InterpolationType_default.CUBICSPLINE:
  116047. return createCubicSpline(times, points);
  116048. case InterpolationType_default.LINEAR:
  116049. if (path === AnimatedPropertyType3.ROTATION) {
  116050. return new QuaternionSpline_default({
  116051. times,
  116052. points
  116053. });
  116054. }
  116055. return new LinearSpline_default({
  116056. times,
  116057. points
  116058. });
  116059. }
  116060. }
  116061. function createSplines(times, points, interpolation, path, count) {
  116062. const splines = [];
  116063. if (path === AnimatedPropertyType3.WEIGHTS) {
  116064. const pointsLength = points.length;
  116065. const outputLength = pointsLength / count;
  116066. let targetIndex, i2;
  116067. for (targetIndex = 0; targetIndex < count; targetIndex++) {
  116068. const output = new Array(outputLength);
  116069. let pointsIndex = targetIndex;
  116070. if (interpolation === InterpolationType_default.CUBICSPLINE) {
  116071. for (i2 = 0; i2 < outputLength; i2 += 3) {
  116072. output[i2] = points[pointsIndex];
  116073. output[i2 + 1] = points[pointsIndex + count];
  116074. output[i2 + 2] = points[pointsIndex + 2 * count];
  116075. pointsIndex += count * 3;
  116076. }
  116077. } else {
  116078. for (i2 = 0; i2 < outputLength; i2++) {
  116079. output[i2] = points[pointsIndex];
  116080. pointsIndex += count;
  116081. }
  116082. }
  116083. splines.push(createSpline(times, output, interpolation, path));
  116084. }
  116085. } else {
  116086. splines.push(createSpline(times, points, interpolation, path));
  116087. }
  116088. return splines;
  116089. }
  116090. var scratchVariable;
  116091. function initialize13(runtimeChannel) {
  116092. const channel = runtimeChannel._channel;
  116093. const sampler = channel.sampler;
  116094. const times = sampler.input;
  116095. const points = sampler.output;
  116096. const interpolation = sampler.interpolation;
  116097. const target = channel.target;
  116098. const path = target.path;
  116099. const runtimeNode = runtimeChannel._runtimeNode;
  116100. const count = defined_default(runtimeNode.morphWeights) ? runtimeNode.morphWeights.length : 1;
  116101. const splines = createSplines(times, points, interpolation, path, count);
  116102. runtimeChannel._splines = splines;
  116103. runtimeChannel._path = path;
  116104. switch (path) {
  116105. case AnimatedPropertyType3.TRANSLATION:
  116106. case AnimatedPropertyType3.SCALE:
  116107. scratchVariable = new Cartesian3_default();
  116108. break;
  116109. case AnimatedPropertyType3.ROTATION:
  116110. scratchVariable = new Quaternion_default();
  116111. break;
  116112. case AnimatedPropertyType3.WEIGHTS:
  116113. break;
  116114. }
  116115. }
  116116. ModelExperimentalAnimationChannel.prototype.animate = function(time) {
  116117. const splines = this._splines;
  116118. const path = this._path;
  116119. const model = this._runtimeAnimation.model;
  116120. if (path === AnimatedPropertyType3.WEIGHTS) {
  116121. const morphWeights = this._runtimeNode.morphWeights;
  116122. const length3 = morphWeights.length;
  116123. for (let i2 = 0; i2 < length3; i2++) {
  116124. const spline = splines[i2];
  116125. const localAnimationTime = model.clampAnimations ? spline.clampTime(time) : spline.wrapTime(time);
  116126. morphWeights[i2] = spline.evaluate(localAnimationTime);
  116127. }
  116128. } else {
  116129. const spline = splines[0];
  116130. const localAnimationTime = model.clampAnimations ? spline.clampTime(time) : spline.wrapTime(time);
  116131. this._runtimeNode[path] = spline.evaluate(
  116132. localAnimationTime,
  116133. scratchVariable
  116134. );
  116135. }
  116136. };
  116137. var ModelExperimentalAnimationChannel_default = ModelExperimentalAnimationChannel;
  116138. // node_modules/cesium/Source/Scene/ModelExperimental/ModelExperimentalAnimation.js
  116139. function ModelExperimentalAnimation(model, animation, options) {
  116140. this._animation = animation;
  116141. this._name = animation.name;
  116142. this._runtimeChannels = void 0;
  116143. this._startTime = JulianDate_default.clone(options.startTime);
  116144. this._delay = defaultValue_default(options.delay, 0);
  116145. this._stopTime = JulianDate_default.clone(options.stopTime);
  116146. this.removeOnStop = defaultValue_default(options.removeOnStop, false);
  116147. this._multiplier = defaultValue_default(options.multiplier, 1);
  116148. this._reverse = defaultValue_default(options.reverse, false);
  116149. this._loop = defaultValue_default(options.loop, ModelAnimationLoop_default.NONE);
  116150. this.start = new Event_default();
  116151. this.update = new Event_default();
  116152. this.stop = new Event_default();
  116153. this._state = ModelAnimationState_default.STOPPED;
  116154. this._computedStartTime = void 0;
  116155. this._duration = void 0;
  116156. const that = this;
  116157. this._raiseStartEvent = function() {
  116158. that.start.raiseEvent(model, that);
  116159. };
  116160. this._updateEventTime = 0;
  116161. this._raiseUpdateEvent = function() {
  116162. that.update.raiseEvent(model, that, that._updateEventTime);
  116163. };
  116164. this._raiseStopEvent = function() {
  116165. that.stop.raiseEvent(model, that);
  116166. };
  116167. this._model = model;
  116168. this._localStartTime = void 0;
  116169. this._localStopTime = void 0;
  116170. initialize14(this);
  116171. }
  116172. Object.defineProperties(ModelExperimentalAnimation.prototype, {
  116173. animation: {
  116174. get: function() {
  116175. return this._animation;
  116176. }
  116177. },
  116178. name: {
  116179. get: function() {
  116180. return this._name;
  116181. }
  116182. },
  116183. runtimeChannels: {
  116184. get: function() {
  116185. return this._runtimeChannels;
  116186. }
  116187. },
  116188. model: {
  116189. get: function() {
  116190. return this._model;
  116191. }
  116192. },
  116193. localStartTime: {
  116194. get: function() {
  116195. return this._localStartTime;
  116196. }
  116197. },
  116198. localStopTime: {
  116199. get: function() {
  116200. return this._localStopTime;
  116201. }
  116202. },
  116203. startTime: {
  116204. get: function() {
  116205. return this._startTime;
  116206. }
  116207. },
  116208. delay: {
  116209. get: function() {
  116210. return this._delay;
  116211. }
  116212. },
  116213. stopTime: {
  116214. get: function() {
  116215. return this._stopTime;
  116216. }
  116217. },
  116218. multiplier: {
  116219. get: function() {
  116220. return this._multiplier;
  116221. }
  116222. },
  116223. reverse: {
  116224. get: function() {
  116225. return this._reverse;
  116226. }
  116227. },
  116228. loop: {
  116229. get: function() {
  116230. return this._loop;
  116231. }
  116232. }
  116233. });
  116234. function initialize14(runtimeAnimation) {
  116235. let localStartTime = Number.MAX_VALUE;
  116236. let localStopTime = -Number.MAX_VALUE;
  116237. const sceneGraph = runtimeAnimation._model.sceneGraph;
  116238. const animation = runtimeAnimation._animation;
  116239. const channels = animation.channels;
  116240. const length3 = channels.length;
  116241. const runtimeChannels = [];
  116242. for (let i2 = 0; i2 < length3; i2++) {
  116243. const channel = channels[i2];
  116244. const target = channel.target;
  116245. if (!defined_default(target)) {
  116246. continue;
  116247. }
  116248. const nodeIndex = target.node.index;
  116249. const runtimeNode = sceneGraph._runtimeNodes[nodeIndex];
  116250. const runtimeChannel = new ModelExperimentalAnimationChannel_default({
  116251. channel,
  116252. runtimeAnimation,
  116253. runtimeNode
  116254. });
  116255. const times = channel.sampler.input;
  116256. localStartTime = Math.min(localStartTime, times[0]);
  116257. localStopTime = Math.max(localStopTime, times[times.length - 1]);
  116258. runtimeChannels.push(runtimeChannel);
  116259. }
  116260. runtimeAnimation._runtimeChannels = runtimeChannels;
  116261. runtimeAnimation._localStartTime = localStartTime;
  116262. runtimeAnimation._localStopTime = localStopTime;
  116263. }
  116264. ModelExperimentalAnimation.prototype.animate = function(time) {
  116265. const runtimeChannels = this._runtimeChannels;
  116266. const length3 = runtimeChannels.length;
  116267. for (let i2 = 0; i2 < length3; i2++) {
  116268. runtimeChannels[i2].animate(time);
  116269. }
  116270. };
  116271. var ModelExperimentalAnimation_default = ModelExperimentalAnimation;
  116272. // node_modules/cesium/Source/Scene/ModelExperimental/ModelExperimentalAnimationCollection.js
  116273. function ModelExperimentalAnimationCollection(model) {
  116274. this.animationAdded = new Event_default();
  116275. this.animationRemoved = new Event_default();
  116276. this._model = model;
  116277. this._runtimeAnimations = [];
  116278. this._previousTime = void 0;
  116279. }
  116280. Object.defineProperties(ModelExperimentalAnimationCollection.prototype, {
  116281. length: {
  116282. get: function() {
  116283. return this._runtimeAnimations.length;
  116284. }
  116285. },
  116286. model: {
  116287. get: function() {
  116288. return this._model;
  116289. }
  116290. }
  116291. });
  116292. function addAnimation(collection, animation, options) {
  116293. const model = collection._model;
  116294. const runtimeAnimation = new ModelExperimentalAnimation_default(
  116295. model,
  116296. animation,
  116297. options
  116298. );
  116299. collection._runtimeAnimations.push(runtimeAnimation);
  116300. collection.animationAdded.raiseEvent(model, runtimeAnimation);
  116301. return runtimeAnimation;
  116302. }
  116303. ModelExperimentalAnimationCollection.prototype.add = function(options) {
  116304. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  116305. const model = this._model;
  116306. if (!model.ready) {
  116307. throw new DeveloperError_default(
  116308. "Animations are not loaded. Wait for ModelExperimental.readyPromise to resolve."
  116309. );
  116310. }
  116311. const animations = model.sceneGraph.components.animations;
  116312. if (!defined_default(options.name) && !defined_default(options.index)) {
  116313. throw new DeveloperError_default(
  116314. "Either options.name or options.index must be defined."
  116315. );
  116316. }
  116317. if (defined_default(options.multiplier) && options.multiplier <= 0) {
  116318. throw new DeveloperError_default("options.multiplier must be greater than zero.");
  116319. }
  116320. if (defined_default(options.index) && (options.index >= animations.length || options.index < 0)) {
  116321. throw new DeveloperError_default("options.index must be a valid animation index.");
  116322. }
  116323. let index2 = options.index;
  116324. if (defined_default(index2)) {
  116325. return addAnimation(this, animations[index2], options);
  116326. }
  116327. const length3 = animations.length;
  116328. for (let i2 = 0; i2 < length3; ++i2) {
  116329. if (animations[i2].name === options.name) {
  116330. index2 = i2;
  116331. break;
  116332. }
  116333. }
  116334. if (!defined_default(index2)) {
  116335. throw new DeveloperError_default("options.name must be a valid animation name.");
  116336. }
  116337. return addAnimation(this, animations[index2], options);
  116338. };
  116339. ModelExperimentalAnimationCollection.prototype.addAll = function(options) {
  116340. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  116341. const model = this._model;
  116342. if (!model.ready) {
  116343. throw new DeveloperError_default(
  116344. "Animations are not loaded. Wait for Model.readyPromise to resolve."
  116345. );
  116346. }
  116347. if (defined_default(options.multiplier) && options.multiplier <= 0) {
  116348. throw new DeveloperError_default("options.multiplier must be greater than zero.");
  116349. }
  116350. const animations = model.sceneGraph.components.animations;
  116351. const addedAnimations = [];
  116352. const length3 = animations.length;
  116353. for (let i2 = 0; i2 < length3; ++i2) {
  116354. const animation = addAnimation(this, animations[i2], options);
  116355. addedAnimations.push(animation);
  116356. }
  116357. return addedAnimations;
  116358. };
  116359. ModelExperimentalAnimationCollection.prototype.remove = function(runtimeAnimation) {
  116360. if (!defined_default(runtimeAnimation)) {
  116361. return false;
  116362. }
  116363. const animations = this._runtimeAnimations;
  116364. const i2 = animations.indexOf(runtimeAnimation);
  116365. if (i2 !== -1) {
  116366. animations.splice(i2, 1);
  116367. this.animationRemoved.raiseEvent(this._model, runtimeAnimation);
  116368. return true;
  116369. }
  116370. return false;
  116371. };
  116372. ModelExperimentalAnimationCollection.prototype.removeAll = function() {
  116373. const model = this._model;
  116374. const animations = this._runtimeAnimations;
  116375. const length3 = animations.length;
  116376. this._runtimeAnimations.length = 0;
  116377. for (let i2 = 0; i2 < length3; ++i2) {
  116378. this.animationRemoved.raiseEvent(model, animations[i2]);
  116379. }
  116380. };
  116381. ModelExperimentalAnimationCollection.prototype.contains = function(runtimeAnimation) {
  116382. if (defined_default(runtimeAnimation)) {
  116383. return this._runtimeAnimations.indexOf(runtimeAnimation) !== -1;
  116384. }
  116385. return false;
  116386. };
  116387. ModelExperimentalAnimationCollection.prototype.get = function(index2) {
  116388. if (!defined_default(index2)) {
  116389. throw new DeveloperError_default("index is required.");
  116390. }
  116391. if (index2 >= this._runtimeAnimations.length || index2 < 0) {
  116392. throw new DeveloperError_default(
  116393. "index must be valid within the range of the collection"
  116394. );
  116395. }
  116396. return this._runtimeAnimations[index2];
  116397. };
  116398. var animationsToRemove2 = [];
  116399. function createAnimationRemovedFunction2(modelAnimationCollection, model, animation) {
  116400. return function() {
  116401. modelAnimationCollection.animationRemoved.raiseEvent(model, animation);
  116402. };
  116403. }
  116404. ModelExperimentalAnimationCollection.prototype.update = function(frameState) {
  116405. const runtimeAnimations = this._runtimeAnimations;
  116406. let length3 = runtimeAnimations.length;
  116407. if (length3 === 0) {
  116408. this._previousTime = void 0;
  116409. return false;
  116410. }
  116411. if (JulianDate_default.equals(frameState.time, this._previousTime)) {
  116412. return false;
  116413. }
  116414. this._previousTime = JulianDate_default.clone(frameState.time, this._previousTime);
  116415. let animationOccurred = false;
  116416. const sceneTime = frameState.time;
  116417. const model = this._model;
  116418. for (let i2 = 0; i2 < length3; ++i2) {
  116419. const runtimeAnimation = runtimeAnimations[i2];
  116420. if (!defined_default(runtimeAnimation._computedStartTime)) {
  116421. runtimeAnimation._computedStartTime = JulianDate_default.addSeconds(
  116422. defaultValue_default(runtimeAnimation.startTime, sceneTime),
  116423. runtimeAnimation.delay,
  116424. new JulianDate_default()
  116425. );
  116426. }
  116427. if (!defined_default(runtimeAnimation._duration)) {
  116428. runtimeAnimation._duration = runtimeAnimation.localStopTime * (1 / runtimeAnimation.multiplier);
  116429. }
  116430. const startTime = runtimeAnimation._computedStartTime;
  116431. const duration = runtimeAnimation._duration;
  116432. const stopTime = runtimeAnimation.stopTime;
  116433. let delta = duration !== 0 ? JulianDate_default.secondsDifference(sceneTime, startTime) / duration : 0;
  116434. if (duration !== 0 && defined_default(stopTime) && JulianDate_default.greaterThan(sceneTime, stopTime)) {
  116435. delta = JulianDate_default.secondsDifference(stopTime, startTime) / duration;
  116436. }
  116437. const pastStartTime = delta >= 0;
  116438. const repeat = runtimeAnimation.loop === ModelAnimationLoop_default.REPEAT || runtimeAnimation.loop === ModelAnimationLoop_default.MIRRORED_REPEAT;
  116439. const reachedStopTime = defined_default(stopTime) && JulianDate_default.greaterThan(sceneTime, stopTime);
  116440. const play = (pastStartTime || repeat && !defined_default(runtimeAnimation.startTime)) && (delta <= 1 || repeat) && !reachedStopTime;
  116441. if (play || runtimeAnimation._state === ModelAnimationState_default.ANIMATING) {
  116442. if (play && runtimeAnimation._state === ModelAnimationState_default.STOPPED) {
  116443. runtimeAnimation._state = ModelAnimationState_default.ANIMATING;
  116444. if (runtimeAnimation.start.numberOfListeners > 0) {
  116445. frameState.afterRender.push(runtimeAnimation._raiseStartEvent);
  116446. }
  116447. }
  116448. if (runtimeAnimation.loop === ModelAnimationLoop_default.REPEAT) {
  116449. delta = delta - Math.floor(delta);
  116450. } else if (runtimeAnimation.loop === ModelAnimationLoop_default.MIRRORED_REPEAT) {
  116451. const floor = Math.floor(delta);
  116452. const fract2 = delta - floor;
  116453. delta = floor % 2 === 1 ? 1 - fract2 : fract2;
  116454. }
  116455. if (runtimeAnimation.reverse) {
  116456. delta = 1 - delta;
  116457. }
  116458. let localAnimationTime = delta * duration * runtimeAnimation.multiplier;
  116459. localAnimationTime = Math_default.clamp(
  116460. localAnimationTime,
  116461. runtimeAnimation.localStartTime,
  116462. runtimeAnimation.localStopTime
  116463. );
  116464. runtimeAnimation.animate(localAnimationTime);
  116465. if (runtimeAnimation.update.numberOfListeners > 0) {
  116466. runtimeAnimation._updateEventTime = localAnimationTime;
  116467. frameState.afterRender.push(runtimeAnimation._raiseUpdateEvent);
  116468. }
  116469. animationOccurred = true;
  116470. if (!play) {
  116471. runtimeAnimation._state = ModelAnimationState_default.STOPPED;
  116472. if (runtimeAnimation.stop.numberOfListeners > 0) {
  116473. frameState.afterRender.push(runtimeAnimation._raiseStopEvent);
  116474. }
  116475. if (runtimeAnimation.removeOnStop) {
  116476. animationsToRemove2.push(runtimeAnimation);
  116477. }
  116478. }
  116479. }
  116480. }
  116481. length3 = animationsToRemove2.length;
  116482. for (let j = 0; j < length3; ++j) {
  116483. const animationToRemove = animationsToRemove2[j];
  116484. runtimeAnimations.splice(runtimeAnimations.indexOf(animationToRemove), 1);
  116485. frameState.afterRender.push(
  116486. createAnimationRemovedFunction2(this, model, animationToRemove)
  116487. );
  116488. }
  116489. animationsToRemove2.length = 0;
  116490. return animationOccurred;
  116491. };
  116492. var ModelExperimentalAnimationCollection_default = ModelExperimentalAnimationCollection;
  116493. // node_modules/cesium/Source/Shaders/ModelExperimental/ModelExperimentalFS.js
  116494. var ModelExperimentalFS_default = "#if defined(HAS_NORMALS) && !defined(HAS_TANGENTS) && !defined(LIGHTING_UNLIT)\n #ifdef GL_OES_standard_derivatives\n #extension GL_OES_standard_derivatives : enable\n #endif\n#endif\n\nczm_modelMaterial defaultModelMaterial()\n{\n czm_modelMaterial material;\n material.diffuse = vec3(1.0);\n material.specular = vec3(0.04); // dielectric (non-metal)\n material.roughness = 0.0;\n material.occlusion = 1.0;\n material.normalEC = vec3(0.0, 0.0, 1.0);\n material.emissive = vec3(0.0);\n material.alpha = 1.0;\n return material;\n}\n\nvec4 handleAlpha(vec3 color, float alpha)\n{\n #ifdef ALPHA_MODE_MASK\n if (alpha < u_alphaCutoff) {\n discard;\n }\n return vec4(color, 1.0);\n #elif defined(ALPHA_MODE_BLEND)\n return vec4(color, alpha);\n #else // OPAQUE\n return vec4(color, 1.0);\n #endif\n}\n\nSelectedFeature selectedFeature;\n\nvoid main()\n{\n #ifdef HAS_MODEL_SPLITTER\n modelSplitterStage();\n #endif\n\n czm_modelMaterial material = defaultModelMaterial();\n\n ProcessedAttributes attributes;\n geometryStage(attributes);\n\n FeatureIds featureIds;\n featureIdStage(featureIds, attributes);\n\n Metadata metadata;\n metadataStage(metadata, attributes);\n\n #ifdef HAS_SELECTED_FEATURE_ID\n selectedFeatureIdStage(selectedFeature, featureIds);\n #endif\n\n #ifndef CUSTOM_SHADER_REPLACE_MATERIAL\n materialStage(material, attributes, selectedFeature);\n #endif\n\n #ifdef HAS_CUSTOM_FRAGMENT_SHADER\n customShaderStage(material, attributes, featureIds, metadata);\n #endif\n\n lightingStage(material, attributes);\n\n #ifdef HAS_SELECTED_FEATURE_ID\n cpuStylingStage(material, selectedFeature);\n #endif\n\n #ifdef HAS_MODEL_COLOR\n modelColorStage(material);\n #endif\n\n vec4 color = handleAlpha(material.diffuse, material.alpha);\n\n #ifdef HAS_CLIPPING_PLANES\n modelClippingPlanesStage(color);\n #endif\n\n gl_FragColor = color;\n}\n";
  116495. // node_modules/cesium/Source/Shaders/ModelExperimental/ModelExperimentalVS.js
  116496. var ModelExperimentalVS_default = "precision highp float;\n\nczm_modelVertexOutput defaultVertexOutput(vec3 positionMC) {\n czm_modelVertexOutput vsOutput;\n vsOutput.positionMC = positionMC;\n vsOutput.pointSize = 1.0;\n return vsOutput;\n}\n\nvoid main() \n{\n // Initialize the attributes struct with all\n // attributes except quantized ones.\n ProcessedAttributes attributes;\n initializeAttributes(attributes);\n\n // Dequantize the quantized ones and add them to the\n // attributes struct.\n #ifdef USE_DEQUANTIZATION\n dequantizationStage(attributes);\n #endif\n\n #ifdef HAS_MORPH_TARGETS\n morphTargetsStage(attributes);\n #endif\n\n #ifdef HAS_SKINNING\n skinningStage(attributes);\n #endif\n\n // Compute the bitangent according to the formula in the glTF spec.\n // Normal and tangents can be affected by morphing and skinning, so\n // the bitangent should not be computed until their values are finalized.\n #ifdef HAS_BITANGENTS\n attributes.bitangentMC = normalize(cross(attributes.normalMC, attributes.tangentMC) * attributes.tangentSignMC);\n #endif\n\n FeatureIds featureIds;\n featureIdStage(featureIds, attributes);\n\n #ifdef HAS_SELECTED_FEATURE_ID\n SelectedFeature feature;\n selectedFeatureIdStage(feature, featureIds);\n cpuStylingStage(attributes.positionMC, feature);\n #endif\n\n mat4 modelView = czm_modelView;\n mat3 normal = czm_normal;\n\n // Update the position for this instance in place\n #ifdef HAS_INSTANCING\n\n // The legacy instance stage is used when rendering I3DM models that \n // encode instances transforms in world space, as opposed to glTF models\n // that use EXT_mesh_gpu_instancing, where instance transforms are encoded\n // in object space.\n #ifdef USE_LEGACY_INSTANCING\n mat4 instanceModelView;\n mat3 instanceModelViewInverseTranspose;\n \n legacyInstancingStage(attributes.positionMC, instanceModelView, instanceModelViewInverseTranspose);\n\n modelView = instanceModelView;\n normal = instanceModelViewInverseTranspose;\n #else\n instancingStage(attributes.positionMC);\n #endif\n\n #ifdef USE_PICKING\n v_pickColor = a_pickColor;\n #endif\n\n #endif\n\n Metadata metadata;\n metadataStage(metadata, attributes);\n\n #ifdef HAS_CUSTOM_VERTEX_SHADER\n czm_modelVertexOutput vsOutput = defaultVertexOutput(attributes.positionMC);\n customShaderStage(vsOutput, attributes, featureIds, metadata);\n #endif\n\n // Compute the final position in each coordinate system needed.\n // This also sets gl_Position.\n geometryStage(attributes, modelView, normal); \n\n #ifdef PRIMITIVE_TYPE_POINTS\n #ifdef HAS_CUSTOM_VERTEX_SHADER\n gl_PointSize = vsOutput.pointSize;\n #elif defined(USE_POINT_CLOUD_ATTENUATION)\n gl_PointSize = pointCloudAttenuationStage(v_positionEC);\n #else\n gl_PointSize = 1.0;\n #endif\n #endif\n}\n";
  116497. // node_modules/cesium/Source/Scene/ModelExperimental/StyleCommandsNeeded.js
  116498. var StyleCommandsNeeded2 = {
  116499. ALL_OPAQUE: 0,
  116500. ALL_TRANSLUCENT: 1,
  116501. OPAQUE_AND_TRANSLUCENT: 2
  116502. };
  116503. StyleCommandsNeeded2.getStyleCommandsNeeded = function(featuresLength, translucentFeaturesLength) {
  116504. if (translucentFeaturesLength === 0) {
  116505. return StyleCommandsNeeded2.ALL_OPAQUE;
  116506. } else if (translucentFeaturesLength === featuresLength) {
  116507. return StyleCommandsNeeded2.ALL_TRANSLUCENT;
  116508. }
  116509. return StyleCommandsNeeded2.OPAQUE_AND_TRANSLUCENT;
  116510. };
  116511. var StyleCommandsNeeded_default = Object.freeze(StyleCommandsNeeded2);
  116512. // node_modules/cesium/Source/Scene/ModelExperimental/buildDrawCommands.js
  116513. function buildDrawCommands(primitiveRenderResources, frameState) {
  116514. const shaderBuilder = primitiveRenderResources.shaderBuilder;
  116515. shaderBuilder.addVertexLines([ModelExperimentalVS_default]);
  116516. shaderBuilder.addFragmentLines([ModelExperimentalFS_default]);
  116517. const model = primitiveRenderResources.model;
  116518. let primitiveType = primitiveRenderResources.primitiveType;
  116519. const debugWireframe = model.debugWireframe && PrimitiveType_default.isTriangles(primitiveType);
  116520. const indexBuffer = getIndexBuffer2(
  116521. primitiveRenderResources,
  116522. debugWireframe,
  116523. frameState
  116524. );
  116525. const vertexArray = new VertexArray_default({
  116526. context: frameState.context,
  116527. indexBuffer,
  116528. attributes: primitiveRenderResources.attributes
  116529. });
  116530. model._resources.push(vertexArray);
  116531. let renderState = primitiveRenderResources.renderStateOptions;
  116532. if (model.opaquePass === Pass_default.CESIUM_3D_TILE) {
  116533. renderState = clone_default(renderState, true);
  116534. renderState.stencilTest = StencilConstants_default.setCesium3DTileBit();
  116535. renderState.stencilMask = StencilConstants_default.CESIUM_3D_TILE_MASK;
  116536. }
  116537. renderState = RenderState_default.fromCache(renderState);
  116538. const shaderProgram = shaderBuilder.buildShaderProgram(frameState.context);
  116539. model._resources.push(shaderProgram);
  116540. const pass = primitiveRenderResources.alphaOptions.pass;
  116541. const sceneGraph = model.sceneGraph;
  116542. const modelMatrix = Matrix4_default.multiply(
  116543. sceneGraph.computedModelMatrix,
  116544. primitiveRenderResources.runtimeNode.computedTransform,
  116545. new Matrix4_default()
  116546. );
  116547. primitiveRenderResources.boundingSphere = BoundingSphere_default.transform(
  116548. primitiveRenderResources.boundingSphere,
  116549. modelMatrix,
  116550. primitiveRenderResources.boundingSphere
  116551. );
  116552. let count = primitiveRenderResources.count;
  116553. if (debugWireframe) {
  116554. count = WireframeIndexGenerator_default.getWireframeIndicesCount(
  116555. primitiveType,
  116556. count
  116557. );
  116558. primitiveType = PrimitiveType_default.LINES;
  116559. }
  116560. const command = new DrawCommand_default({
  116561. boundingVolume: primitiveRenderResources.boundingSphere,
  116562. modelMatrix,
  116563. uniformMap: primitiveRenderResources.uniformMap,
  116564. renderState,
  116565. vertexArray,
  116566. shaderProgram,
  116567. cull: model.cull,
  116568. pass,
  116569. count,
  116570. pickId: primitiveRenderResources.pickId,
  116571. instanceCount: primitiveRenderResources.instanceCount,
  116572. primitiveType,
  116573. debugShowBoundingVolume: model.debugShowBoundingVolume,
  116574. castShadows: ShadowMode_default.castShadows(model.shadows),
  116575. receiveShadows: ShadowMode_default.receiveShadows(model.shadows)
  116576. });
  116577. const styleCommandsNeeded = primitiveRenderResources.styleCommandsNeeded;
  116578. const commandList = [];
  116579. if (defined_default(styleCommandsNeeded)) {
  116580. const derivedCommands = createDerivedCommands(command);
  116581. if (pass !== Pass_default.TRANSLUCENT) {
  116582. switch (styleCommandsNeeded) {
  116583. case StyleCommandsNeeded_default.ALL_OPAQUE:
  116584. commandList.push(command);
  116585. break;
  116586. case StyleCommandsNeeded_default.ALL_TRANSLUCENT:
  116587. commandList.push(derivedCommands.translucent);
  116588. break;
  116589. case StyleCommandsNeeded_default.OPAQUE_AND_TRANSLUCENT:
  116590. commandList.push(command, derivedCommands.translucent);
  116591. break;
  116592. default:
  116593. throw new RuntimeError_default("styleCommandsNeeded is not a valid value.");
  116594. }
  116595. } else {
  116596. commandList.push(command);
  116597. }
  116598. } else {
  116599. commandList.push(command);
  116600. }
  116601. return commandList;
  116602. }
  116603. function createDerivedCommands(command) {
  116604. const derivedCommands = {};
  116605. derivedCommands.translucent = deriveTranslucentCommand3(command);
  116606. return derivedCommands;
  116607. }
  116608. function deriveTranslucentCommand3(command) {
  116609. const derivedCommand = DrawCommand_default.shallowClone(command);
  116610. derivedCommand.pass = Pass_default.TRANSLUCENT;
  116611. const rs = clone_default(command.renderState, true);
  116612. rs.cull.enabled = false;
  116613. rs.depthTest.enabled = true;
  116614. rs.depthMask = false;
  116615. rs.blending = BlendingState_default.ALPHA_BLEND;
  116616. derivedCommand.renderState = RenderState_default.fromCache(rs);
  116617. return derivedCommand;
  116618. }
  116619. function getIndexBuffer2(primitiveRenderResources, debugWireframe, frameState) {
  116620. if (debugWireframe) {
  116621. return createWireframeIndexBuffer(primitiveRenderResources, frameState);
  116622. }
  116623. const indices2 = primitiveRenderResources.indices;
  116624. if (!defined_default(indices2)) {
  116625. return void 0;
  116626. }
  116627. if (defined_default(indices2.buffer)) {
  116628. return indices2.buffer;
  116629. }
  116630. const typedArray = indices2.typedArray;
  116631. const indexDatatype = IndexDatatype_default.fromSizeInBytes(
  116632. typedArray.BYTES_PER_ELEMENT
  116633. );
  116634. return Buffer_default.createIndexBuffer({
  116635. context: frameState.context,
  116636. typedArray,
  116637. usage: BufferUsage_default.STATIC_DRAW,
  116638. indexDatatype
  116639. });
  116640. }
  116641. function createWireframeIndexBuffer(primitiveRenderResources, frameState) {
  116642. let positionAttribute;
  116643. const attributes = primitiveRenderResources.attributes;
  116644. const length3 = attributes.length;
  116645. for (let i2 = 0; i2 < length3; i2++) {
  116646. if (attributes[i2].index === 0) {
  116647. positionAttribute = attributes[i2];
  116648. break;
  116649. }
  116650. }
  116651. const vertexCount = positionAttribute.count;
  116652. const indices2 = primitiveRenderResources.indices;
  116653. const context = frameState.context;
  116654. let originalIndices;
  116655. if (defined_default(indices2)) {
  116656. const indicesBuffer = indices2.buffer;
  116657. const indicesCount = indices2.count;
  116658. const useWebgl2 = context.webgl2;
  116659. if (useWebgl2 && defined_default(indicesBuffer)) {
  116660. originalIndices = IndexDatatype_default.createTypedArray(
  116661. vertexCount,
  116662. indicesCount
  116663. );
  116664. indicesBuffer.getBufferData(originalIndices);
  116665. } else {
  116666. originalIndices = indices2.typedArray;
  116667. }
  116668. }
  116669. const primitiveType = primitiveRenderResources.primitiveType;
  116670. const wireframeIndices = WireframeIndexGenerator_default.createWireframeIndices(
  116671. primitiveType,
  116672. vertexCount,
  116673. originalIndices
  116674. );
  116675. const indexDatatype = IndexDatatype_default.fromSizeInBytes(
  116676. wireframeIndices.BYTES_PER_ELEMENT
  116677. );
  116678. return Buffer_default.createIndexBuffer({
  116679. context,
  116680. typedArray: wireframeIndices,
  116681. usage: BufferUsage_default.STATIC_DRAW,
  116682. indexDatatype
  116683. });
  116684. }
  116685. // node_modules/cesium/Source/Shaders/ModelExperimental/ImageBasedLightingStageFS.js
  116686. var ImageBasedLightingStageFS_default = "vec3 proceduralIBL(\n vec3 positionEC,\n vec3 normalEC,\n vec3 lightDirectionEC,\n vec3 lightColorHdr,\n czm_pbrParameters pbrParameters\n) {\n vec3 v = -positionEC;\n vec3 positionWC = vec3(czm_inverseView * vec4(positionEC, 1.0));\n vec3 vWC = -normalize(positionWC);\n vec3 l = normalize(lightDirectionEC);\n vec3 n = normalEC;\n vec3 r = normalize(czm_inverseViewRotation * normalize(reflect(v, n)));\n\n float NdotL = clamp(dot(n, l), 0.001, 1.0);\n float NdotV = abs(dot(n, v)) + 0.001;\n\n // Figure out if the reflection vector hits the ellipsoid\n float vertexRadius = length(positionWC);\n float horizonDotNadir = 1.0 - min(1.0, czm_ellipsoidRadii.x / vertexRadius);\n float reflectionDotNadir = dot(r, normalize(positionWC));\n // Flipping the X vector is a cheap way to get the inverse of czm_temeToPseudoFixed, since that's a rotation about Z.\n r.x = -r.x;\n r = -normalize(czm_temeToPseudoFixed * r);\n r.x = -r.x;\n\n vec3 diffuseColor = pbrParameters.diffuseColor;\n float roughness = pbrParameters.roughness;\n vec3 specularColor = pbrParameters.f0;\n\n float inverseRoughness = 1.04 - roughness;\n inverseRoughness *= inverseRoughness;\n vec3 sceneSkyBox = textureCube(czm_environmentMap, r).rgb * inverseRoughness;\n\n float atmosphereHeight = 0.05;\n float blendRegionSize = 0.1 * ((1.0 - inverseRoughness) * 8.0 + 1.1 - horizonDotNadir);\n float blendRegionOffset = roughness * -1.0;\n float farAboveHorizon = clamp(horizonDotNadir - blendRegionSize * 0.5 + blendRegionOffset, 1.0e-10 - blendRegionSize, 0.99999);\n float aroundHorizon = clamp(horizonDotNadir + blendRegionSize * 0.5, 1.0e-10 - blendRegionSize, 0.99999);\n float farBelowHorizon = clamp(horizonDotNadir + blendRegionSize * 1.5, 1.0e-10 - blendRegionSize, 0.99999);\n float smoothstepHeight = smoothstep(0.0, atmosphereHeight, horizonDotNadir);\n vec3 belowHorizonColor = mix(vec3(0.1, 0.15, 0.25), vec3(0.4, 0.7, 0.9), smoothstepHeight);\n vec3 nadirColor = belowHorizonColor * 0.5;\n vec3 aboveHorizonColor = mix(vec3(0.9, 1.0, 1.2), belowHorizonColor, roughness * 0.5);\n vec3 blueSkyColor = mix(vec3(0.18, 0.26, 0.48), aboveHorizonColor, reflectionDotNadir * inverseRoughness * 0.5 + 0.75);\n vec3 zenithColor = mix(blueSkyColor, sceneSkyBox, smoothstepHeight);\n vec3 blueSkyDiffuseColor = vec3(0.7, 0.85, 0.9); \n float diffuseIrradianceFromEarth = (1.0 - horizonDotNadir) * (reflectionDotNadir * 0.25 + 0.75) * smoothstepHeight; \n float diffuseIrradianceFromSky = (1.0 - smoothstepHeight) * (1.0 - (reflectionDotNadir * 0.25 + 0.25));\n vec3 diffuseIrradiance = blueSkyDiffuseColor * clamp(diffuseIrradianceFromEarth + diffuseIrradianceFromSky, 0.0, 1.0);\n float notDistantRough = (1.0 - horizonDotNadir * roughness * 0.8);\n vec3 specularIrradiance = mix(zenithColor, aboveHorizonColor, smoothstep(farAboveHorizon, aroundHorizon, reflectionDotNadir) * notDistantRough);\n specularIrradiance = mix(specularIrradiance, belowHorizonColor, smoothstep(aroundHorizon, farBelowHorizon, reflectionDotNadir) * inverseRoughness);\n specularIrradiance = mix(specularIrradiance, nadirColor, smoothstep(farBelowHorizon, 1.0, reflectionDotNadir) * inverseRoughness);\n\n // Luminance model from page 40 of http://silviojemma.com/public/papers/lighting/spherical-harmonic-lighting.pdf\n #ifdef USE_SUN_LUMINANCE \n // Angle between sun and zenith\n float LdotZenith = clamp(dot(normalize(czm_inverseViewRotation * l), vWC), 0.001, 1.0);\n float S = acos(LdotZenith);\n // Angle between zenith and current pixel\n float NdotZenith = clamp(dot(normalize(czm_inverseViewRotation * n), vWC), 0.001, 1.0);\n // Angle between sun and current pixel\n float gamma = acos(NdotL);\n float numerator = ((0.91 + 10.0 * exp(-3.0 * gamma) + 0.45 * pow(NdotL, 2.0)) * (1.0 - exp(-0.32 / NdotZenith)));\n float denominator = (0.91 + 10.0 * exp(-3.0 * S) + 0.45 * pow(LdotZenith,2.0)) * (1.0 - exp(-0.32));\n float luminance = model_luminanceAtZenith * (numerator / denominator);\n #endif \n\n vec2 brdfLut = texture2D(czm_brdfLut, vec2(NdotV, roughness)).rg;\n vec3 iblColor = (diffuseIrradiance * diffuseColor * model_iblFactor.x) + (specularIrradiance * czm_srgbToLinear(specularColor * brdfLut.x + brdfLut.y) * model_iblFactor.y);\n float maximumComponent = max(max(lightColorHdr.x, lightColorHdr.y), lightColorHdr.z);\n vec3 lightColor = lightColorHdr / max(maximumComponent, 1.0);\n iblColor *= lightColor;\n\n #ifdef USE_SUN_LUMINANCE \n iblColor *= luminance;\n #endif\n\n return iblColor;\n}\n\nvec3 textureIBL(\n vec3 positionEC,\n vec3 normalEC,\n vec3 lightDirectionEC,\n czm_pbrParameters pbrParameters\n) {\n vec3 diffuseColor = pbrParameters.diffuseColor;\n float roughness = pbrParameters.roughness;\n vec3 specularColor = pbrParameters.f0;\n\n vec3 v = -positionEC;\n vec3 n = normalEC;\n vec3 l = normalize(lightDirectionEC);\n vec3 h = normalize(v + l);\n\n float NdotV = abs(dot(n, v)) + 0.001;\n float VdotH = clamp(dot(v, h), 0.0, 1.0);\n\n const mat3 yUpToZUp = mat3(\n -1.0, 0.0, 0.0,\n 0.0, 0.0, -1.0, \n 0.0, 1.0, 0.0\n ); \n vec3 cubeDir = normalize(yUpToZUp * model_iblReferenceFrameMatrix * normalize(reflect(-v, n))); \n\n #ifdef DIFFUSE_IBL \n #ifdef CUSTOM_SPHERICAL_HARMONICS\n vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, model_sphericalHarmonicCoefficients); \n #else\n vec3 diffuseIrradiance = czm_sphericalHarmonics(cubeDir, czm_sphericalHarmonicCoefficients); \n #endif \n #else \n vec3 diffuseIrradiance = vec3(0.0); \n #endif \n\n #ifdef SPECULAR_IBL\n vec3 r0 = specularColor.rgb;\n float reflectance = max(max(r0.r, r0.g), r0.b);\n vec3 r90 = vec3(clamp(reflectance * 25.0, 0.0, 1.0));\n vec3 F = fresnelSchlick2(r0, r90, VdotH);\n \n vec2 brdfLut = texture2D(czm_brdfLut, vec2(NdotV, roughness)).rg;\n #ifdef CUSTOM_SPECULAR_IBL \n vec3 specularIBL = czm_sampleOctahedralProjection(model_specularEnvironmentMaps, model_specularEnvironmentMapsSize, cubeDir, roughness * model_specularEnvironmentMapsMaximumLOD, model_specularEnvironmentMapsMaximumLOD);\n #else \n vec3 specularIBL = czm_sampleOctahedralProjection(czm_specularEnvironmentMaps, czm_specularEnvironmentMapSize, cubeDir, roughness * czm_specularEnvironmentMapsMaximumLOD, czm_specularEnvironmentMapsMaximumLOD);\n #endif \n specularIBL *= F * brdfLut.x + brdfLut.y;\n #else \n vec3 specularIBL = vec3(0.0); \n #endif\n\n return diffuseColor * diffuseIrradiance + specularColor * specularIBL;\n}\n\nvec3 imageBasedLightingStage(\n vec3 positionEC,\n vec3 normalEC,\n vec3 lightDirectionEC,\n vec3 lightColorHdr,\n czm_pbrParameters pbrParameters\n) {\n #if defined(DIFFUSE_IBL) || defined(SPECULAR_IBL)\n // Environment maps were provided, use them for IBL\n return textureIBL(\n positionEC,\n normalEC,\n lightDirectionEC,\n pbrParameters\n );\n #else\n // Use the procedural IBL if there are no environment maps\n return proceduralIBL(\n positionEC,\n normalEC,\n lightDirectionEC,\n lightColorHdr,\n pbrParameters\n );\n #endif\n}";
  116687. // node_modules/cesium/Source/Renderer/ShaderDestination.js
  116688. var ShaderDestination = {
  116689. VERTEX: 0,
  116690. FRAGMENT: 1,
  116691. BOTH: 2
  116692. };
  116693. ShaderDestination.includesVertexShader = function(destination) {
  116694. Check_default.typeOf.number("destination", destination);
  116695. return destination === ShaderDestination.VERTEX || destination === ShaderDestination.BOTH;
  116696. };
  116697. ShaderDestination.includesFragmentShader = function(destination) {
  116698. Check_default.typeOf.number("destination", destination);
  116699. return destination === ShaderDestination.FRAGMENT || destination === ShaderDestination.BOTH;
  116700. };
  116701. var ShaderDestination_default = Object.freeze(ShaderDestination);
  116702. // node_modules/cesium/Source/Scene/ModelExperimental/ImageBasedLightingPipelineStage.js
  116703. var ImageBasedLightingPipelineStage = {};
  116704. ImageBasedLightingPipelineStage.name = "ImageBasedLightingPipelineStage";
  116705. ImageBasedLightingPipelineStage.process = function(renderResources, model, frameState) {
  116706. const imageBasedLighting = model.imageBasedLighting;
  116707. const shaderBuilder = renderResources.shaderBuilder;
  116708. shaderBuilder.addDefine(
  116709. "USE_IBL_LIGHTING",
  116710. void 0,
  116711. ShaderDestination_default.FRAGMENT
  116712. );
  116713. shaderBuilder.addUniform(
  116714. "vec2",
  116715. "model_iblFactor",
  116716. ShaderDestination_default.FRAGMENT
  116717. );
  116718. if (OctahedralProjectedCubeMap_default.isSupported(frameState.context)) {
  116719. const addMatrix = imageBasedLighting.useSphericalHarmonics || imageBasedLighting.useSpecularEnvironmentMaps || imageBasedLighting.enabled;
  116720. if (addMatrix) {
  116721. shaderBuilder.addUniform(
  116722. "mat3",
  116723. "model_iblReferenceFrameMatrix",
  116724. ShaderDestination_default.FRAGMENT
  116725. );
  116726. }
  116727. if (defined_default(imageBasedLighting.sphericalHarmonicCoefficients)) {
  116728. shaderBuilder.addDefine(
  116729. "DIFFUSE_IBL",
  116730. void 0,
  116731. ShaderDestination_default.FRAGMENT
  116732. );
  116733. shaderBuilder.addDefine(
  116734. "CUSTOM_SPHERICAL_HARMONICS",
  116735. void 0,
  116736. ShaderDestination_default.FRAGMENT
  116737. );
  116738. shaderBuilder.addUniform(
  116739. "vec3",
  116740. "model_sphericalHarmonicCoefficients[9]",
  116741. ShaderDestination_default.FRAGMENT
  116742. );
  116743. } else if (imageBasedLighting.useDefaultSphericalHarmonics) {
  116744. shaderBuilder.addDefine(
  116745. "DIFFUSE_IBL",
  116746. void 0,
  116747. ShaderDestination_default.FRAGMENT
  116748. );
  116749. }
  116750. if (defined_default(imageBasedLighting.specularEnvironmentMapAtlas) && imageBasedLighting.specularEnvironmentMapAtlas.ready) {
  116751. shaderBuilder.addDefine(
  116752. "SPECULAR_IBL",
  116753. void 0,
  116754. ShaderDestination_default.FRAGMENT
  116755. );
  116756. shaderBuilder.addDefine(
  116757. "CUSTOM_SPECULAR_IBL",
  116758. void 0,
  116759. ShaderDestination_default.FRAGMENT
  116760. );
  116761. shaderBuilder.addUniform(
  116762. "sampler2D",
  116763. "model_specularEnvironmentMaps",
  116764. ShaderDestination_default.FRAGMENT
  116765. );
  116766. shaderBuilder.addUniform(
  116767. "vec2",
  116768. "model_specularEnvironmentMapsSize",
  116769. ShaderDestination_default.FRAGMENT
  116770. );
  116771. shaderBuilder.addUniform(
  116772. "float",
  116773. "model_specularEnvironmentMapsMaximumLOD",
  116774. ShaderDestination_default.FRAGMENT
  116775. );
  116776. } else if (model.useDefaultSpecularMaps) {
  116777. shaderBuilder.addDefine(
  116778. "SPECULAR_IBL",
  116779. void 0,
  116780. ShaderDestination_default.FRAGMENT
  116781. );
  116782. }
  116783. }
  116784. if (defined_default(imageBasedLighting.luminanceAtZenith)) {
  116785. shaderBuilder.addDefine(
  116786. "USE_SUN_LUMINANCE",
  116787. void 0,
  116788. ShaderDestination_default.FRAGMENT
  116789. );
  116790. shaderBuilder.addUniform(
  116791. "float",
  116792. "model_luminanceAtZenith",
  116793. ShaderDestination_default.FRAGMENT
  116794. );
  116795. }
  116796. shaderBuilder.addFragmentLines([ImageBasedLightingStageFS_default]);
  116797. const uniformMap2 = {
  116798. model_iblFactor: function() {
  116799. return imageBasedLighting.imageBasedLightingFactor;
  116800. },
  116801. model_iblReferenceFrameMatrix: function() {
  116802. return model._iblReferenceFrameMatrix;
  116803. },
  116804. model_luminanceAtZenith: function() {
  116805. return imageBasedLighting.luminanceAtZenith;
  116806. },
  116807. model_sphericalHarmonicCoefficients: function() {
  116808. return imageBasedLighting.sphericalHarmonicCoefficients;
  116809. },
  116810. model_specularEnvironmentMaps: function() {
  116811. return imageBasedLighting.specularEnvironmentMapAtlas.texture;
  116812. },
  116813. model_specularEnvironmentMapsSize: function() {
  116814. return imageBasedLighting.specularEnvironmentMapAtlas.texture.dimensions;
  116815. },
  116816. model_specularEnvironmentMapsMaximumLOD: function() {
  116817. return imageBasedLighting.specularEnvironmentMapAtlas.maximumMipmapLevel;
  116818. }
  116819. };
  116820. renderResources.uniformMap = combine_default(uniformMap2, renderResources.uniformMap);
  116821. };
  116822. var ImageBasedLightingPipelineStage_default = ImageBasedLightingPipelineStage;
  116823. // node_modules/cesium/Source/Shaders/ModelExperimental/ModelColorStageFS.js
  116824. var ModelColorStageFS_default = "void modelColorStage(inout czm_modelMaterial material)\n{\n material.diffuse = mix(material.diffuse, model_color.rgb, model_colorBlend);\n float highlight = ceil(model_colorBlend);\n material.diffuse *= mix(model_color.rgb, vec3(1.0), highlight);\n material.alpha *= model_color.a;\n}";
  116825. // node_modules/cesium/Source/Scene/ModelExperimental/ModelColorPipelineStage.js
  116826. var ModelColorPipelineStage = {};
  116827. ModelColorPipelineStage.name = "ModelColorPipelineStage";
  116828. ModelColorPipelineStage.COLOR_UNIFORM_NAME = "model_color";
  116829. ModelColorPipelineStage.COLOR_BLEND_UNIFORM_NAME = "model_colorBlend";
  116830. ModelColorPipelineStage.process = function(renderResources, model, frameState) {
  116831. const shaderBuilder = renderResources.shaderBuilder;
  116832. shaderBuilder.addDefine(
  116833. "HAS_MODEL_COLOR",
  116834. void 0,
  116835. ShaderDestination_default.FRAGMENT
  116836. );
  116837. shaderBuilder.addFragmentLines([ModelColorStageFS_default]);
  116838. const stageUniforms = {};
  116839. const color = model.color;
  116840. const renderStateOptions = renderResources.renderStateOptions;
  116841. if (color.alpha === 0) {
  116842. renderStateOptions.colorMask = {
  116843. red: false,
  116844. green: false,
  116845. blue: false,
  116846. alpha: false
  116847. };
  116848. renderStateOptions.depthMask = false;
  116849. } else if (color.alpha < 1) {
  116850. renderResources.alphaOptions.pass = Pass_default.TRANSLUCENT;
  116851. renderResources.alphaOptions.alphaMode = AlphaMode_default.BLEND;
  116852. }
  116853. shaderBuilder.addUniform(
  116854. "vec4",
  116855. ModelColorPipelineStage.COLOR_UNIFORM_NAME,
  116856. ShaderDestination_default.FRAGMENT
  116857. );
  116858. stageUniforms[ModelColorPipelineStage.COLOR_UNIFORM_NAME] = function() {
  116859. return model.color;
  116860. };
  116861. shaderBuilder.addUniform(
  116862. "float",
  116863. ModelColorPipelineStage.COLOR_BLEND_UNIFORM_NAME,
  116864. ShaderDestination_default.FRAGMENT
  116865. );
  116866. stageUniforms[ModelColorPipelineStage.COLOR_BLEND_UNIFORM_NAME] = function() {
  116867. return ColorBlendMode_default.getColorBlend(
  116868. model.colorBlendMode,
  116869. model.colorBlendAmount
  116870. );
  116871. };
  116872. renderResources.uniformMap = combine_default(
  116873. stageUniforms,
  116874. renderResources.uniformMap
  116875. );
  116876. };
  116877. var ModelColorPipelineStage_default = ModelColorPipelineStage;
  116878. // node_modules/cesium/Source/Shaders/ModelExperimental/ModelClippingPlanesStageFS.js
  116879. var ModelClippingPlanesStageFS_default = "#ifdef USE_CLIPPING_PLANES_FLOAT_TEXTURE\nvec4 getClippingPlane(\n highp sampler2D packedClippingPlanes,\n int clippingPlaneNumber,\n mat4 transform\n) {\n int pixY = clippingPlaneNumber / CLIPPING_PLANES_TEXTURE_WIDTH;\n int pixX = clippingPlaneNumber - (pixY * CLIPPING_PLANES_TEXTURE_WIDTH);\n float pixelWidth = 1.0 / float(CLIPPING_PLANES_TEXTURE_WIDTH);\n float pixelHeight = 1.0 / float(CLIPPING_PLANES_TEXTURE_HEIGHT);\n float u = (float(pixX) + 0.5) * pixelWidth; // sample from center of pixel\n float v = (float(pixY) + 0.5) * pixelHeight;\n vec4 plane = texture2D(packedClippingPlanes, vec2(u, v));\n return czm_transformPlane(plane, transform);\n}\n#else\n// Handle uint8 clipping texture instead\nvec4 getClippingPlane(\n highp sampler2D packedClippingPlanes,\n int clippingPlaneNumber,\n mat4 transform\n) {\n int clippingPlaneStartIndex = clippingPlaneNumber * 2; // clipping planes are two pixels each\n int pixY = clippingPlaneStartIndex / CLIPPING_PLANES_TEXTURE_WIDTH;\n int pixX = clippingPlaneStartIndex - (pixY * CLIPPING_PLANES_TEXTURE_WIDTH);\n float pixelWidth = 1.0 / float(CLIPPING_PLANES_TEXTURE_WIDTH);\n float pixelHeight = 1.0 / float(CLIPPING_PLANES_TEXTURE_HEIGHT);\n float u = (float(pixX) + 0.5) * pixelWidth; // sample from center of pixel\n float v = (float(pixY) + 0.5) * pixelHeight;\n vec4 oct32 = texture2D(packedClippingPlanes, vec2(u, v)) * 255.0;\n vec2 oct = vec2(oct32.x * 256.0 + oct32.y, oct32.z * 256.0 + oct32.w);\n vec4 plane;\n plane.xyz = czm_octDecode(oct, 65535.0);\n plane.w = czm_unpackFloat(texture2D(packedClippingPlanes, vec2(u + pixelWidth, v)));\n return czm_transformPlane(plane, transform);\n}\n#endif\n\nfloat clip(vec4 fragCoord, sampler2D clippingPlanes, mat4 clippingPlanesMatrix) {\n vec4 position = czm_windowToEyeCoordinates(fragCoord);\n vec3 clipNormal = vec3(0.0);\n vec3 clipPosition = vec3(0.0);\n float pixelWidth = czm_metersPerPixel(position);\n \n #ifdef UNION_CLIPPING_REGIONS\n float clipAmount; // For union planes, we want to get the min distance. So we set the initial value to the first plane distance in the loop below.\n #else\n float clipAmount = 0.0;\n bool clipped = true;\n #endif\n\n for (int i = 0; i < CLIPPING_PLANES_LENGTH; ++i) {\n vec4 clippingPlane = getClippingPlane(clippingPlanes, i, clippingPlanesMatrix);\n clipNormal = clippingPlane.xyz;\n clipPosition = -clippingPlane.w * clipNormal;\n float amount = dot(clipNormal, (position.xyz - clipPosition)) / pixelWidth;\n \n #ifdef UNION_CLIPPING_REGIONS\n clipAmount = czm_branchFreeTernary(i == 0, amount, min(amount, clipAmount));\n if (amount <= 0.0) {\n discard;\n }\n #else\n clipAmount = max(amount, clipAmount);\n clipped = clipped && (amount <= 0.0);\n #endif\n }\n\n #ifndef UNION_CLIPPING_REGIONS\n if (clipped) {\n discard;\n }\n #endif\n \n return clipAmount;\n}\n\nvoid modelClippingPlanesStage(inout vec4 color)\n{\n float clipDistance = clip(gl_FragCoord, model_clippingPlanes, model_clippingPlanesMatrix);\n vec4 clippingPlanesEdgeColor = vec4(1.0);\n clippingPlanesEdgeColor.rgb = model_clippingPlanesEdgeStyle.rgb;\n float clippingPlanesEdgeWidth = model_clippingPlanesEdgeStyle.a;\n \n if (clipDistance > 0.0 && clipDistance < clippingPlanesEdgeWidth) {\n color = clippingPlanesEdgeColor;\n }\n}\n";
  116880. // node_modules/cesium/Source/Scene/ModelExperimental/ModelClippingPlanesPipelineStage.js
  116881. var ModelClippingPlanesPipelineStage = {};
  116882. ModelClippingPlanesPipelineStage.name = "ModelClippingPlanesPipelineStage";
  116883. var textureResolutionScratch3 = new Cartesian2_default();
  116884. ModelClippingPlanesPipelineStage.process = function(renderResources, model, frameState) {
  116885. const clippingPlanes = model.clippingPlanes;
  116886. const context = frameState.context;
  116887. const shaderBuilder = renderResources.shaderBuilder;
  116888. shaderBuilder.addDefine(
  116889. "HAS_CLIPPING_PLANES",
  116890. void 0,
  116891. ShaderDestination_default.FRAGMENT
  116892. );
  116893. shaderBuilder.addDefine(
  116894. "CLIPPING_PLANES_LENGTH",
  116895. clippingPlanes.length,
  116896. ShaderDestination_default.FRAGMENT
  116897. );
  116898. if (clippingPlanes.unionClippingRegions) {
  116899. shaderBuilder.addDefine(
  116900. "UNION_CLIPPING_REGIONS",
  116901. void 0,
  116902. ShaderDestination_default.FRAGMENT
  116903. );
  116904. }
  116905. if (ClippingPlaneCollection_default.useFloatTexture(context)) {
  116906. shaderBuilder.addDefine(
  116907. "USE_CLIPPING_PLANES_FLOAT_TEXTURE",
  116908. void 0,
  116909. ShaderDestination_default.FRAGMENT
  116910. );
  116911. }
  116912. const textureResolution = ClippingPlaneCollection_default.getTextureResolution(
  116913. clippingPlanes,
  116914. context,
  116915. textureResolutionScratch3
  116916. );
  116917. shaderBuilder.addDefine(
  116918. "CLIPPING_PLANES_TEXTURE_WIDTH",
  116919. textureResolution.x,
  116920. ShaderDestination_default.FRAGMENT
  116921. );
  116922. shaderBuilder.addDefine(
  116923. "CLIPPING_PLANES_TEXTURE_HEIGHT",
  116924. textureResolution.y,
  116925. ShaderDestination_default.FRAGMENT
  116926. );
  116927. shaderBuilder.addUniform(
  116928. "sampler2D",
  116929. "model_clippingPlanes",
  116930. ShaderDestination_default.FRAGMENT
  116931. );
  116932. shaderBuilder.addUniform(
  116933. "vec4",
  116934. "model_clippingPlanesEdgeStyle",
  116935. ShaderDestination_default.FRAGMENT
  116936. );
  116937. shaderBuilder.addUniform(
  116938. "mat4",
  116939. "model_clippingPlanesMatrix",
  116940. ShaderDestination_default.FRAGMENT
  116941. );
  116942. shaderBuilder.addFragmentLines([ModelClippingPlanesStageFS_default]);
  116943. const uniformMap2 = {
  116944. model_clippingPlanes: function() {
  116945. return clippingPlanes.texture;
  116946. },
  116947. model_clippingPlanesEdgeStyle: function() {
  116948. const style = Color_default.clone(clippingPlanes.edgeColor);
  116949. style.alpha = clippingPlanes.edgeWidth;
  116950. return style;
  116951. },
  116952. model_clippingPlanesMatrix: function() {
  116953. return model._clippingPlanesMatrix;
  116954. }
  116955. };
  116956. renderResources.uniformMap = combine_default(uniformMap2, renderResources.uniformMap);
  116957. };
  116958. var ModelClippingPlanesPipelineStage_default = ModelClippingPlanesPipelineStage;
  116959. // node_modules/cesium/Source/Scene/ModelExperimental/AlphaPipelineStage.js
  116960. var AlphaPipelineStage = {};
  116961. AlphaPipelineStage.name = "AlphaPipelineStage";
  116962. AlphaPipelineStage.process = function(renderResources, primitive, frameState) {
  116963. const alphaOptions = renderResources.alphaOptions;
  116964. const model = renderResources.model;
  116965. alphaOptions.pass = defaultValue_default(alphaOptions.pass, model.opaquePass);
  116966. const renderStateOptions = renderResources.renderStateOptions;
  116967. if (alphaOptions.pass === Pass_default.TRANSLUCENT) {
  116968. renderStateOptions.blending = BlendingState_default.ALPHA_BLEND;
  116969. } else {
  116970. renderStateOptions.blending = BlendingState_default.DISABLED;
  116971. }
  116972. const shaderBuilder = renderResources.shaderBuilder;
  116973. const uniformMap2 = renderResources.uniformMap;
  116974. const alphaMode = alphaOptions.alphaMode;
  116975. if (alphaMode === AlphaMode_default.MASK) {
  116976. shaderBuilder.addDefine(
  116977. "ALPHA_MODE_MASK",
  116978. void 0,
  116979. ShaderDestination_default.FRAGMENT
  116980. );
  116981. shaderBuilder.addUniform(
  116982. "float",
  116983. "u_alphaCutoff",
  116984. ShaderDestination_default.FRAGMENT
  116985. );
  116986. uniformMap2.u_alphaCutoff = function() {
  116987. return alphaOptions.alphaCutoff;
  116988. };
  116989. } else if (alphaMode === AlphaMode_default.BLEND) {
  116990. shaderBuilder.addDefine(
  116991. "ALPHA_MODE_BLEND",
  116992. void 0,
  116993. ShaderDestination_default.FRAGMENT
  116994. );
  116995. } else {
  116996. shaderBuilder.addDefine(
  116997. "ALPHA_MODE_OPAQUE",
  116998. void 0,
  116999. ShaderDestination_default.FRAGMENT
  117000. );
  117001. }
  117002. };
  117003. var AlphaPipelineStage_default = AlphaPipelineStage;
  117004. // node_modules/cesium/Source/Scene/ModelExperimental/BatchTexturePipelineStage.js
  117005. var BatchTexturePipelineStage = {};
  117006. BatchTexturePipelineStage.name = "BatchTexturePipelineStage";
  117007. BatchTexturePipelineStage.process = function(renderResources, primitive, frameState) {
  117008. const shaderBuilder = renderResources.shaderBuilder;
  117009. const batchTextureUniforms = {};
  117010. const model = renderResources.model;
  117011. const featureTable = model.featureTables[model.featureTableId];
  117012. const featuresLength = featureTable.featuresLength;
  117013. shaderBuilder.addUniform("int", "model_featuresLength");
  117014. batchTextureUniforms.model_featuresLength = function() {
  117015. return featuresLength;
  117016. };
  117017. const batchTexture = featureTable.batchTexture;
  117018. shaderBuilder.addUniform("sampler2D", "model_batchTexture");
  117019. batchTextureUniforms.model_batchTexture = function() {
  117020. return defaultValue_default(batchTexture.batchTexture, batchTexture.defaultTexture);
  117021. };
  117022. shaderBuilder.addUniform("vec4", "model_textureStep");
  117023. batchTextureUniforms.model_textureStep = function() {
  117024. return batchTexture.textureStep;
  117025. };
  117026. if (batchTexture.textureDimensions.y > 1) {
  117027. shaderBuilder.addDefine("MULTILINE_BATCH_TEXTURE");
  117028. shaderBuilder.addUniform("vec2", "model_textureDimensions");
  117029. batchTextureUniforms.model_textureDimensions = function() {
  117030. return batchTexture.textureDimensions;
  117031. };
  117032. }
  117033. renderResources.uniformMap = combine_default(
  117034. batchTextureUniforms,
  117035. renderResources.uniformMap
  117036. );
  117037. };
  117038. var BatchTexturePipelineStage_default = BatchTexturePipelineStage;
  117039. // node_modules/cesium/Source/Scene/ModelExperimental/CustomShaderMode.js
  117040. var CustomShaderMode = {
  117041. MODIFY_MATERIAL: "MODIFY_MATERIAL",
  117042. REPLACE_MATERIAL: "REPLACE_MATERIAL"
  117043. };
  117044. CustomShaderMode.getDefineName = function(customShaderMode) {
  117045. return `CUSTOM_SHADER_${customShaderMode}`;
  117046. };
  117047. var CustomShaderMode_default = Object.freeze(CustomShaderMode);
  117048. // node_modules/cesium/Source/Shaders/ModelExperimental/CustomShaderStageVS.js
  117049. var CustomShaderStageVS_default = "void customShaderStage(\n inout czm_modelVertexOutput vsOutput, \n inout ProcessedAttributes attributes, \n FeatureIds featureIds,\n Metadata metadata\n) {\n // VertexInput and initializeInputStruct() are dynamically generated in JS, \n // see CustomShaderPipelineStage.js\n VertexInput vsInput;\n initializeInputStruct(vsInput, attributes);\n vsInput.featureIds = featureIds;\n vsInput.metadata = metadata;\n vertexMain(vsInput, vsOutput);\n attributes.positionMC = vsOutput.positionMC;\n}\n";
  117050. // node_modules/cesium/Source/Shaders/ModelExperimental/CustomShaderStageFS.js
  117051. var CustomShaderStageFS_default = "void customShaderStage(\n inout czm_modelMaterial material,\n ProcessedAttributes attributes,\n FeatureIds featureIds,\n Metadata metadata\n) {\n // FragmentInput and initializeInputStruct() are dynamically generated in JS, \n // see CustomShaderPipelineStage.js\n FragmentInput fsInput;\n initializeInputStruct(fsInput, attributes);\n fsInput.featureIds = featureIds;\n fsInput.metadata = metadata;\n fragmentMain(fsInput, material);\n}\n";
  117052. // node_modules/cesium/Source/Scene/ModelExperimental/ModelExperimentalUtility.js
  117053. function ModelExperimentalUtility() {
  117054. }
  117055. ModelExperimentalUtility.getFailedLoadFunction = function(model, type, path) {
  117056. return function(error) {
  117057. let message = `Failed to load ${type}: ${path}`;
  117058. if (defined_default(error)) {
  117059. message += `
  117060. ${error.message}`;
  117061. }
  117062. model._readyPromise.reject(new RuntimeError_default(message));
  117063. };
  117064. };
  117065. ModelExperimentalUtility.getNodeTransform = function(node) {
  117066. if (defined_default(node.matrix)) {
  117067. return node.matrix;
  117068. }
  117069. return Matrix4_default.fromTranslationQuaternionRotationScale(
  117070. defined_default(node.translation) ? node.translation : Cartesian3_default.ZERO,
  117071. defined_default(node.rotation) ? node.rotation : Quaternion_default.IDENTITY,
  117072. defined_default(node.scale) ? node.scale : Cartesian3_default.ONE
  117073. );
  117074. };
  117075. ModelExperimentalUtility.getAttributeBySemantic = function(object2, semantic, setIndex) {
  117076. const attributes = object2.attributes;
  117077. const attributesLength = attributes.length;
  117078. for (let i2 = 0; i2 < attributesLength; ++i2) {
  117079. const attribute = attributes[i2];
  117080. const matchesSetIndex = defined_default(setIndex) ? attribute.setIndex === setIndex : true;
  117081. if (attribute.semantic === semantic && matchesSetIndex) {
  117082. return attribute;
  117083. }
  117084. }
  117085. };
  117086. ModelExperimentalUtility.getAttributeByName = function(object2, name) {
  117087. const attributes = object2.attributes;
  117088. const attributesLength = attributes.length;
  117089. for (let i2 = 0; i2 < attributesLength; ++i2) {
  117090. const attribute = attributes[i2];
  117091. if (attribute.name === name) {
  117092. return attribute;
  117093. }
  117094. }
  117095. };
  117096. ModelExperimentalUtility.getFeatureIdsByLabel = function(featureIds, label) {
  117097. for (let i2 = 0; i2 < featureIds.length; i2++) {
  117098. const featureIdSet = featureIds[i2];
  117099. if (featureIdSet.positionalLabel === label || featureIdSet.label === label) {
  117100. return featureIdSet;
  117101. }
  117102. }
  117103. return void 0;
  117104. };
  117105. ModelExperimentalUtility.hasQuantizedAttributes = function(attributes) {
  117106. if (!defined_default(attributes)) {
  117107. return false;
  117108. }
  117109. for (let i2 = 0; i2 < attributes.length; i2++) {
  117110. const attribute = attributes[i2];
  117111. if (defined_default(attribute.quantization)) {
  117112. return true;
  117113. }
  117114. }
  117115. return false;
  117116. };
  117117. ModelExperimentalUtility.getAttributeInfo = function(attribute) {
  117118. const semantic = attribute.semantic;
  117119. const setIndex = attribute.setIndex;
  117120. let variableName;
  117121. let hasSemantic = false;
  117122. if (defined_default(semantic)) {
  117123. variableName = VertexAttributeSemantic_default.getVariableName(semantic, setIndex);
  117124. hasSemantic = true;
  117125. } else {
  117126. variableName = attribute.name;
  117127. variableName = variableName.replace(/^_/, "");
  117128. variableName = variableName.toLowerCase();
  117129. }
  117130. const isVertexColor = /^color_\d+$/.test(variableName);
  117131. const attributeType = attribute.type;
  117132. let glslType = AttributeType_default.getGlslType(attributeType);
  117133. if (isVertexColor) {
  117134. glslType = "vec4";
  117135. }
  117136. const isQuantized = defined_default(attribute.quantization);
  117137. let quantizedGlslType;
  117138. if (isQuantized) {
  117139. quantizedGlslType = isVertexColor ? "vec4" : AttributeType_default.getGlslType(attribute.quantization.type);
  117140. }
  117141. return {
  117142. attribute,
  117143. isQuantized,
  117144. variableName,
  117145. hasSemantic,
  117146. glslType,
  117147. quantizedGlslType
  117148. };
  117149. };
  117150. var cartesianMaxScratch = new Cartesian3_default();
  117151. var cartesianMinScratch = new Cartesian3_default();
  117152. ModelExperimentalUtility.createBoundingSphere = function(primitive, modelMatrix, instancingTranslationMax, instancingTranslationMin) {
  117153. const positionGltfAttribute = ModelExperimentalUtility.getAttributeBySemantic(
  117154. primitive,
  117155. "POSITION"
  117156. );
  117157. const positionMax = positionGltfAttribute.max;
  117158. const positionMin = positionGltfAttribute.min;
  117159. let boundingSphere;
  117160. if (defined_default(instancingTranslationMax) && defined_default(instancingTranslationMin)) {
  117161. const computedMin = Cartesian3_default.add(
  117162. positionMin,
  117163. instancingTranslationMin,
  117164. cartesianMinScratch
  117165. );
  117166. const computedMax = Cartesian3_default.add(
  117167. positionMax,
  117168. instancingTranslationMax,
  117169. cartesianMaxScratch
  117170. );
  117171. boundingSphere = BoundingSphere_default.fromCornerPoints(computedMin, computedMax);
  117172. } else {
  117173. boundingSphere = BoundingSphere_default.fromCornerPoints(positionMin, positionMax);
  117174. }
  117175. BoundingSphere_default.transform(boundingSphere, modelMatrix, boundingSphere);
  117176. return boundingSphere;
  117177. };
  117178. ModelExperimentalUtility.getAxisCorrectionMatrix = function(upAxis, forwardAxis, result) {
  117179. result = Matrix4_default.clone(Matrix4_default.IDENTITY, result);
  117180. if (upAxis === Axis_default.Y) {
  117181. result = Matrix4_default.clone(Axis_default.Y_UP_TO_Z_UP, result);
  117182. } else if (upAxis === Axis_default.X) {
  117183. result = Matrix4_default.clone(Axis_default.X_UP_TO_Z_UP, result);
  117184. }
  117185. if (forwardAxis === Axis_default.Z) {
  117186. result = Matrix4_default.multiplyTransformation(result, Axis_default.Z_UP_TO_X_UP, result);
  117187. }
  117188. return result;
  117189. };
  117190. // node_modules/cesium/Source/Shaders/ModelExperimental/FeatureIdStageFS.js
  117191. var FeatureIdStageFS_default = "void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes) {\n initializeFeatureIds(featureIds, attributes);\n initializeFeatureIdAliases(featureIds);\n}\n";
  117192. // node_modules/cesium/Source/Shaders/ModelExperimental/FeatureIdStageVS.js
  117193. var FeatureIdStageVS_default = "void featureIdStage(out FeatureIds featureIds, ProcessedAttributes attributes) \n{\n initializeFeatureIds(featureIds, attributes);\n initializeFeatureIdAliases(featureIds);\n setFeatureIdVaryings();\n}\n";
  117194. // node_modules/cesium/Source/Scene/ModelExperimental/FeatureIdPipelineStage.js
  117195. var FeatureIdPipelineStage = {};
  117196. FeatureIdPipelineStage.name = "FeatureIdPipelineStage";
  117197. FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_VS = "FeatureIdsVS";
  117198. FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_FS = "FeatureIdsFS";
  117199. FeatureIdPipelineStage.STRUCT_NAME_FEATURE_IDS = "FeatureIds";
  117200. FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS = "initializeFeatureIdsVS";
  117201. FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS = "initializeFeatureIdsFS";
  117202. FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS = "initializeFeatureIdAliasesVS";
  117203. FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS = "initializeFeatureIdAliasesFS";
  117204. FeatureIdPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS = "void initializeFeatureIds(out FeatureIds featureIds, ProcessedAttributes attributes)";
  117205. FeatureIdPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES = "void initializeFeatureIdAliases(inout FeatureIds featureIds)";
  117206. FeatureIdPipelineStage.FUNCTION_ID_SET_FEATURE_ID_VARYINGS = "setFeatureIdVaryings";
  117207. FeatureIdPipelineStage.FUNCTION_SIGNATURE_SET_FEATURE_ID_VARYINGS = "void setFeatureIdVaryings()";
  117208. FeatureIdPipelineStage.process = function(renderResources, primitive, frameState) {
  117209. const shaderBuilder = renderResources.shaderBuilder;
  117210. declareStructsAndFunctions(shaderBuilder);
  117211. const instances = renderResources.runtimeNode.node.instances;
  117212. if (defined_default(instances)) {
  117213. processInstanceFeatureIds(renderResources, instances, frameState);
  117214. }
  117215. processPrimitiveFeatureIds(renderResources, primitive, frameState);
  117216. shaderBuilder.addVertexLines([FeatureIdStageVS_default]);
  117217. shaderBuilder.addFragmentLines([FeatureIdStageFS_default]);
  117218. };
  117219. function declareStructsAndFunctions(shaderBuilder) {
  117220. shaderBuilder.addStruct(
  117221. FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_VS,
  117222. FeatureIdPipelineStage.STRUCT_NAME_FEATURE_IDS,
  117223. ShaderDestination_default.VERTEX
  117224. );
  117225. shaderBuilder.addStruct(
  117226. FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_FS,
  117227. FeatureIdPipelineStage.STRUCT_NAME_FEATURE_IDS,
  117228. ShaderDestination_default.FRAGMENT
  117229. );
  117230. shaderBuilder.addFunction(
  117231. FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,
  117232. FeatureIdPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,
  117233. ShaderDestination_default.VERTEX
  117234. );
  117235. shaderBuilder.addFunction(
  117236. FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,
  117237. FeatureIdPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_IDS,
  117238. ShaderDestination_default.FRAGMENT
  117239. );
  117240. shaderBuilder.addFunction(
  117241. FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS,
  117242. FeatureIdPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,
  117243. ShaderDestination_default.VERTEX
  117244. );
  117245. shaderBuilder.addFunction(
  117246. FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS,
  117247. FeatureIdPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_FEATURE_ID_ALIASES,
  117248. ShaderDestination_default.FRAGMENT
  117249. );
  117250. shaderBuilder.addFunction(
  117251. FeatureIdPipelineStage.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,
  117252. FeatureIdPipelineStage.FUNCTION_SIGNATURE_SET_FEATURE_ID_VARYINGS,
  117253. ShaderDestination_default.VERTEX
  117254. );
  117255. }
  117256. function processInstanceFeatureIds(renderResources, instances, frameState) {
  117257. const featureIdsArray = instances.featureIds;
  117258. const count = instances.attributes[0].count;
  117259. for (let i2 = 0; i2 < featureIdsArray.length; i2++) {
  117260. const featureIds = featureIdsArray[i2];
  117261. const variableName = featureIds.positionalLabel;
  117262. if (featureIds instanceof ModelComponents_default.FeatureIdAttribute) {
  117263. processInstanceAttribute(renderResources, featureIds, variableName);
  117264. } else {
  117265. const instanceDivisor = 1;
  117266. processImplicitRange(
  117267. renderResources,
  117268. featureIds,
  117269. variableName,
  117270. count,
  117271. instanceDivisor,
  117272. frameState
  117273. );
  117274. }
  117275. const label = featureIds.label;
  117276. if (defined_default(label)) {
  117277. addAlias(renderResources, variableName, label, ShaderDestination_default.BOTH);
  117278. }
  117279. }
  117280. }
  117281. function processPrimitiveFeatureIds(renderResources, primitive, frameState) {
  117282. const featureIdsArray = primitive.featureIds;
  117283. const positionAttribute = ModelExperimentalUtility.getAttributeBySemantic(
  117284. primitive,
  117285. VertexAttributeSemantic_default.POSITION
  117286. );
  117287. const count = positionAttribute.count;
  117288. for (let i2 = 0; i2 < featureIdsArray.length; i2++) {
  117289. const featureIds = featureIdsArray[i2];
  117290. const variableName = featureIds.positionalLabel;
  117291. let aliasDestination = ShaderDestination_default.BOTH;
  117292. if (featureIds instanceof ModelComponents_default.FeatureIdAttribute) {
  117293. processAttribute(renderResources, featureIds, variableName);
  117294. } else if (featureIds instanceof ModelComponents_default.FeatureIdImplicitRange) {
  117295. processImplicitRange(
  117296. renderResources,
  117297. featureIds,
  117298. variableName,
  117299. count,
  117300. void 0,
  117301. frameState
  117302. );
  117303. } else {
  117304. processTexture(renderResources, featureIds, variableName, i2, frameState);
  117305. aliasDestination = ShaderDestination_default.FRAGMENT;
  117306. }
  117307. const label = featureIds.label;
  117308. if (defined_default(label)) {
  117309. addAlias(renderResources, variableName, label, aliasDestination);
  117310. }
  117311. }
  117312. }
  117313. function processInstanceAttribute(renderResources, featureIdAttribute, variableName) {
  117314. const shaderBuilder = renderResources.shaderBuilder;
  117315. shaderBuilder.addStructField(
  117316. FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_VS,
  117317. "int",
  117318. variableName
  117319. );
  117320. shaderBuilder.addStructField(
  117321. FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_FS,
  117322. "int",
  117323. variableName
  117324. );
  117325. const setIndex = featureIdAttribute.setIndex;
  117326. const prefix = variableName.replace(/_\d+$/, "_");
  117327. const attributeName = `a_${prefix}${setIndex}`;
  117328. const varyingName = `v_${prefix}${setIndex}`;
  117329. const vertexLine = `featureIds.${variableName} = int(czm_round(${attributeName}));`;
  117330. const fragmentLine = `featureIds.${variableName} = int(czm_round(${varyingName}));`;
  117331. shaderBuilder.addFunctionLines(
  117332. FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,
  117333. [vertexLine]
  117334. );
  117335. shaderBuilder.addFunctionLines(
  117336. FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,
  117337. [fragmentLine]
  117338. );
  117339. shaderBuilder.addVarying("float", varyingName);
  117340. shaderBuilder.addFunctionLines(
  117341. FeatureIdPipelineStage.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,
  117342. [`${varyingName} = ${attributeName};`]
  117343. );
  117344. }
  117345. function processAttribute(renderResources, featureIdAttribute, variableName) {
  117346. const shaderBuilder = renderResources.shaderBuilder;
  117347. shaderBuilder.addStructField(
  117348. FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_VS,
  117349. "int",
  117350. variableName
  117351. );
  117352. shaderBuilder.addStructField(
  117353. FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_FS,
  117354. "int",
  117355. variableName
  117356. );
  117357. const setIndex = featureIdAttribute.setIndex;
  117358. const prefix = variableName.replace(/_\d+$/, "_");
  117359. const initializationLines = [
  117360. `featureIds.${variableName} = int(czm_round(attributes.${prefix}${setIndex}));`
  117361. ];
  117362. shaderBuilder.addFunctionLines(
  117363. FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,
  117364. initializationLines
  117365. );
  117366. shaderBuilder.addFunctionLines(
  117367. FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,
  117368. initializationLines
  117369. );
  117370. }
  117371. function processImplicitRange(renderResources, implicitFeatureIds, variableName, count, instanceDivisor, frameState) {
  117372. generateImplicitFeatureIdAttribute(
  117373. renderResources,
  117374. implicitFeatureIds,
  117375. count,
  117376. instanceDivisor,
  117377. frameState
  117378. );
  117379. const shaderBuilder = renderResources.shaderBuilder;
  117380. const implicitAttributeName = `a_implicit_${variableName}`;
  117381. shaderBuilder.addAttribute("float", implicitAttributeName);
  117382. const implicitVaryingName = `v_implicit_${variableName}`;
  117383. shaderBuilder.addVarying("float", implicitVaryingName);
  117384. shaderBuilder.addStructField(
  117385. FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_VS,
  117386. "int",
  117387. variableName
  117388. );
  117389. shaderBuilder.addStructField(
  117390. FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_FS,
  117391. "int",
  117392. variableName
  117393. );
  117394. shaderBuilder.addFunctionLines(
  117395. FeatureIdPipelineStage.FUNCTION_ID_SET_FEATURE_ID_VARYINGS,
  117396. [`${implicitVaryingName} = ${implicitAttributeName};`]
  117397. );
  117398. shaderBuilder.addFunctionLines(
  117399. FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_IDS_VS,
  117400. [`featureIds.${variableName} = int(czm_round(${implicitAttributeName}));`]
  117401. );
  117402. shaderBuilder.addFunctionLines(
  117403. FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,
  117404. [`featureIds.${variableName} = int(czm_round(${implicitVaryingName}));`]
  117405. );
  117406. }
  117407. function processTexture(renderResources, featureIdTexture, variableName, index2, frameState) {
  117408. const uniformName = `u_featureIdTexture_${index2}`;
  117409. const uniformMap2 = renderResources.uniformMap;
  117410. const textureReader = featureIdTexture.textureReader;
  117411. uniformMap2[uniformName] = function() {
  117412. return defaultValue_default(
  117413. textureReader.texture,
  117414. frameState.context.defaultTexture
  117415. );
  117416. };
  117417. const channels = textureReader.channels;
  117418. const shaderBuilder = renderResources.shaderBuilder;
  117419. shaderBuilder.addStructField(
  117420. FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_FS,
  117421. "int",
  117422. variableName
  117423. );
  117424. shaderBuilder.addUniform(
  117425. "sampler2D",
  117426. uniformName,
  117427. ShaderDestination_default.FRAGMENT
  117428. );
  117429. const texCoord = `v_texCoord_${textureReader.texCoord}`;
  117430. const textureRead = `texture2D(${uniformName}, ${texCoord}).${channels}`;
  117431. const initializationLine = `featureIds.${variableName} = czm_unpackUint(${textureRead});`;
  117432. shaderBuilder.addFunctionLines(
  117433. FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_IDS_FS,
  117434. [initializationLine]
  117435. );
  117436. }
  117437. function addAlias(renderResources, variableName, alias, shaderDestination) {
  117438. const shaderBuilder = renderResources.shaderBuilder;
  117439. const updateVS = ShaderDestination_default.includesVertexShader(shaderDestination);
  117440. if (updateVS) {
  117441. shaderBuilder.addStructField(
  117442. FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_VS,
  117443. "int",
  117444. alias
  117445. );
  117446. }
  117447. shaderBuilder.addStructField(
  117448. FeatureIdPipelineStage.STRUCT_ID_FEATURE_IDS_FS,
  117449. "int",
  117450. alias
  117451. );
  117452. const initializationLines = [
  117453. `featureIds.${alias} = featureIds.${variableName};`
  117454. ];
  117455. if (updateVS) {
  117456. shaderBuilder.addFunctionLines(
  117457. FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_VS,
  117458. initializationLines
  117459. );
  117460. }
  117461. shaderBuilder.addFunctionLines(
  117462. FeatureIdPipelineStage.FUNCTION_ID_INITIALIZE_FEATURE_ID_ALIASES_FS,
  117463. initializationLines
  117464. );
  117465. }
  117466. function generateImplicitFeatureIdAttribute(renderResources, implicitFeatureIds, count, instanceDivisor, frameState) {
  117467. const model = renderResources.model;
  117468. let vertexBuffer;
  117469. let value;
  117470. if (defined_default(implicitFeatureIds.repeat)) {
  117471. const typedArray = generateImplicitFeatureIdTypedArray(
  117472. implicitFeatureIds,
  117473. count
  117474. );
  117475. vertexBuffer = Buffer_default.createVertexBuffer({
  117476. context: frameState.context,
  117477. typedArray,
  117478. usage: BufferUsage_default.STATIC_DRAW
  117479. });
  117480. vertexBuffer.vertexArrayDestroyable = false;
  117481. model._resources.push(vertexBuffer);
  117482. } else {
  117483. value = [implicitFeatureIds.offset];
  117484. }
  117485. const generatedFeatureIdAttribute = {
  117486. index: renderResources.attributeIndex++,
  117487. instanceDivisor,
  117488. value,
  117489. vertexBuffer,
  117490. normalize: false,
  117491. componentsPerAttribute: 1,
  117492. componentDatatype: ComponentDatatype_default.FLOAT,
  117493. strideInBytes: ComponentDatatype_default.getSizeInBytes(ComponentDatatype_default.FLOAT),
  117494. offsetInBytes: 0
  117495. };
  117496. renderResources.attributes.push(generatedFeatureIdAttribute);
  117497. }
  117498. function generateImplicitFeatureIdTypedArray(implicitFeatureIds, count) {
  117499. const offset2 = implicitFeatureIds.offset;
  117500. const repeat = implicitFeatureIds.repeat;
  117501. const typedArray = new Float32Array(count);
  117502. for (let i2 = 0; i2 < count; i2++) {
  117503. typedArray[i2] = offset2 + Math.floor(i2 / repeat);
  117504. }
  117505. return typedArray;
  117506. }
  117507. var FeatureIdPipelineStage_default = FeatureIdPipelineStage;
  117508. // node_modules/cesium/Source/Shaders/ModelExperimental/MetadataStageFS.js
  117509. var MetadataStageFS_default = "void metadataStage(out Metadata metadata, ProcessedAttributes attributes)\n{\n initializeMetadata(metadata, attributes);\n}\n";
  117510. // node_modules/cesium/Source/Shaders/ModelExperimental/MetadataStageVS.js
  117511. var MetadataStageVS_default = "void metadataStage(out Metadata metadata, ProcessedAttributes attributes)\n{\n initializeMetadata(metadata, attributes);\n setMetadataVaryings();\n}\n";
  117512. // node_modules/cesium/Source/Scene/ModelExperimental/MetadataPipelineStage.js
  117513. var MetadataPipelineStage = {};
  117514. MetadataPipelineStage.name = "MetadataPipelineStage";
  117515. MetadataPipelineStage.STRUCT_ID_METADATA_VS = "MetadataVS";
  117516. MetadataPipelineStage.STRUCT_ID_METADATA_FS = "MetadataFS";
  117517. MetadataPipelineStage.STRUCT_NAME_METADATA = "Metadata";
  117518. MetadataPipelineStage.FUNCTION_ID_INITIALIZE_METADATA_VS = "initializeMetadataVS";
  117519. MetadataPipelineStage.FUNCTION_ID_INITIALIZE_METADATA_FS = "initializeMetadataFS";
  117520. MetadataPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_METADATA = "void initializeMetadata(out Metadata metadata, ProcessedAttributes attributes)";
  117521. MetadataPipelineStage.FUNCTION_ID_SET_METADATA_VARYINGS = "setMetadataVaryings";
  117522. MetadataPipelineStage.FUNCTION_SIGNATURE_SET_METADATA_VARYINGS = "void setMetadataVaryings()";
  117523. MetadataPipelineStage.process = function(renderResources, primitive, frameState) {
  117524. const shaderBuilder = renderResources.shaderBuilder;
  117525. declareStructsAndFunctions2(shaderBuilder);
  117526. shaderBuilder.addVertexLines([MetadataStageVS_default]);
  117527. shaderBuilder.addFragmentLines([MetadataStageFS_default]);
  117528. const structuralMetadata = renderResources.model.structuralMetadata;
  117529. if (!defined_default(structuralMetadata)) {
  117530. return;
  117531. }
  117532. processPropertyAttributes(renderResources, primitive, structuralMetadata);
  117533. processPropertyTextures(renderResources, structuralMetadata);
  117534. };
  117535. function declareStructsAndFunctions2(shaderBuilder) {
  117536. shaderBuilder.addStruct(
  117537. MetadataPipelineStage.STRUCT_ID_METADATA_VS,
  117538. MetadataPipelineStage.STRUCT_NAME_METADATA,
  117539. ShaderDestination_default.VERTEX
  117540. );
  117541. shaderBuilder.addStruct(
  117542. MetadataPipelineStage.STRUCT_ID_METADATA_FS,
  117543. MetadataPipelineStage.STRUCT_NAME_METADATA,
  117544. ShaderDestination_default.FRAGMENT
  117545. );
  117546. shaderBuilder.addFunction(
  117547. MetadataPipelineStage.FUNCTION_ID_INITIALIZE_METADATA_VS,
  117548. MetadataPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_METADATA,
  117549. ShaderDestination_default.VERTEX
  117550. );
  117551. shaderBuilder.addFunction(
  117552. MetadataPipelineStage.FUNCTION_ID_INITIALIZE_METADATA_FS,
  117553. MetadataPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_METADATA,
  117554. ShaderDestination_default.FRAGMENT
  117555. );
  117556. shaderBuilder.addFunction(
  117557. MetadataPipelineStage.FUNCTION_ID_SET_METADATA_VARYINGS,
  117558. MetadataPipelineStage.FUNCTION_SIGNATURE_SET_METADATA_VARYINGS,
  117559. ShaderDestination_default.VERTEX
  117560. );
  117561. }
  117562. function processPropertyAttributes(renderResources, primitive, structuralMetadata) {
  117563. const propertyAttributes = structuralMetadata.propertyAttributes;
  117564. if (!defined_default(propertyAttributes)) {
  117565. return;
  117566. }
  117567. for (let i2 = 0; i2 < propertyAttributes.length; i2++) {
  117568. const propertyAttribute = propertyAttributes[i2];
  117569. const properties = propertyAttribute.properties;
  117570. for (const propertyId in properties) {
  117571. if (properties.hasOwnProperty(propertyId)) {
  117572. const property = properties[propertyId];
  117573. const modelAttribute = ModelExperimentalUtility.getAttributeByName(
  117574. primitive,
  117575. property.attribute
  117576. );
  117577. const attributeInfo = ModelExperimentalUtility.getAttributeInfo(
  117578. modelAttribute
  117579. );
  117580. addPropertyAttributeProperty(
  117581. renderResources,
  117582. attributeInfo,
  117583. propertyId,
  117584. property
  117585. );
  117586. }
  117587. }
  117588. }
  117589. }
  117590. function addPropertyAttributeProperty(renderResources, attributeInfo, propertyId, property) {
  117591. const metadataVariable = sanitizeGlslIdentifier(propertyId);
  117592. const attributeVariable = attributeInfo.variableName;
  117593. const glslType = attributeInfo.glslType;
  117594. const shaderBuilder = renderResources.shaderBuilder;
  117595. shaderBuilder.addStructField(
  117596. MetadataPipelineStage.STRUCT_ID_METADATA_VS,
  117597. glslType,
  117598. metadataVariable
  117599. );
  117600. shaderBuilder.addStructField(
  117601. MetadataPipelineStage.STRUCT_ID_METADATA_FS,
  117602. glslType,
  117603. metadataVariable
  117604. );
  117605. let unpackedValue = `attributes.${attributeVariable}`;
  117606. if (property.hasValueTransform) {
  117607. unpackedValue = addValueTransformUniforms(unpackedValue, {
  117608. renderResources,
  117609. glslType,
  117610. metadataVariable,
  117611. shaderDestination: ShaderDestination_default.BOTH,
  117612. offset: property.offset,
  117613. scale: property.scale
  117614. });
  117615. }
  117616. const initializationLine = `metadata.${metadataVariable} = ${unpackedValue};`;
  117617. shaderBuilder.addFunctionLines(
  117618. MetadataPipelineStage.FUNCTION_ID_INITIALIZE_METADATA_VS,
  117619. [initializationLine]
  117620. );
  117621. shaderBuilder.addFunctionLines(
  117622. MetadataPipelineStage.FUNCTION_ID_INITIALIZE_METADATA_FS,
  117623. [initializationLine]
  117624. );
  117625. }
  117626. function processPropertyTextures(renderResources, structuralMetadata) {
  117627. const propertyTextures = structuralMetadata.propertyTextures;
  117628. if (!defined_default(propertyTextures)) {
  117629. return;
  117630. }
  117631. for (let i2 = 0; i2 < propertyTextures.length; i2++) {
  117632. const propertyTexture = propertyTextures[i2];
  117633. const properties = propertyTexture.properties;
  117634. for (const propertyId in properties) {
  117635. if (properties.hasOwnProperty(propertyId)) {
  117636. const property = properties[propertyId];
  117637. if (property.isGpuCompatible()) {
  117638. addPropertyTextureProperty(renderResources, propertyId, property);
  117639. }
  117640. }
  117641. }
  117642. }
  117643. }
  117644. function addPropertyTextureProperty(renderResources, propertyId, property) {
  117645. const textureReader = property.textureReader;
  117646. const textureIndex = textureReader.index;
  117647. const textureUniformName = `u_propertyTexture_${textureIndex}`;
  117648. if (!renderResources.uniformMap.hasOwnProperty(textureUniformName)) {
  117649. addPropertyTextureUniform(
  117650. renderResources,
  117651. textureUniformName,
  117652. textureReader
  117653. );
  117654. }
  117655. const metadataVariable = sanitizeGlslIdentifier(propertyId);
  117656. const glslType = property.getGlslType();
  117657. const shaderBuilder = renderResources.shaderBuilder;
  117658. shaderBuilder.addStructField(
  117659. MetadataPipelineStage.STRUCT_ID_METADATA_FS,
  117660. glslType,
  117661. metadataVariable
  117662. );
  117663. const texCoord = textureReader.texCoord;
  117664. const texCoordVariable = `attributes.texCoord_${texCoord}`;
  117665. const channels = textureReader.channels;
  117666. let unpackedValue = `texture2D(${textureUniformName}, ${texCoordVariable}).${channels}`;
  117667. unpackedValue = property.unpackInShader(unpackedValue);
  117668. if (property.hasValueTransform) {
  117669. unpackedValue = addValueTransformUniforms(unpackedValue, {
  117670. renderResources,
  117671. glslType,
  117672. metadataVariable,
  117673. shaderDestination: ShaderDestination_default.FRAGMENT,
  117674. offset: property.offset,
  117675. scale: property.scale
  117676. });
  117677. }
  117678. const initializationLine = `metadata.${metadataVariable} = ${unpackedValue};`;
  117679. shaderBuilder.addFunctionLines(
  117680. MetadataPipelineStage.FUNCTION_ID_INITIALIZE_METADATA_FS,
  117681. [initializationLine]
  117682. );
  117683. }
  117684. function addPropertyTextureUniform(renderResources, uniformName, textureReader) {
  117685. const shaderBuilder = renderResources.shaderBuilder;
  117686. shaderBuilder.addUniform(
  117687. "sampler2D",
  117688. uniformName,
  117689. ShaderDestination_default.FRAGMENT
  117690. );
  117691. const uniformMap2 = renderResources.uniformMap;
  117692. uniformMap2[uniformName] = function() {
  117693. return textureReader.texture;
  117694. };
  117695. }
  117696. function addValueTransformUniforms(valueExpression, options) {
  117697. const metadataVariable = options.metadataVariable;
  117698. const offsetUniformName = `u_${metadataVariable}_offset`;
  117699. const scaleUniformName = `u_${metadataVariable}_scale`;
  117700. const renderResources = options.renderResources;
  117701. const shaderBuilder = renderResources.shaderBuilder;
  117702. const glslType = options.glslType;
  117703. const shaderDestination = options.shaderDestination;
  117704. shaderBuilder.addUniform(glslType, offsetUniformName, shaderDestination);
  117705. shaderBuilder.addUniform(glslType, scaleUniformName, shaderDestination);
  117706. const uniformMap2 = renderResources.uniformMap;
  117707. uniformMap2[offsetUniformName] = function() {
  117708. return options.offset;
  117709. };
  117710. uniformMap2[scaleUniformName] = function() {
  117711. return options.scale;
  117712. };
  117713. return `czm_valueTransform(${offsetUniformName}, ${scaleUniformName}, ${valueExpression})`;
  117714. }
  117715. function sanitizeGlslIdentifier(identifier) {
  117716. return identifier.replaceAll(/[^_a-zA-Z0-9]+/g, "_");
  117717. }
  117718. var MetadataPipelineStage_default = MetadataPipelineStage;
  117719. // node_modules/cesium/Source/Scene/ModelExperimental/CustomShaderPipelineStage.js
  117720. var CustomShaderPipelineStage = {};
  117721. CustomShaderPipelineStage.name = "CustomShaderPipelineStage";
  117722. CustomShaderPipelineStage.STRUCT_ID_ATTRIBUTES_VS = "AttributesVS";
  117723. CustomShaderPipelineStage.STRUCT_ID_ATTRIBUTES_FS = "AttributesFS";
  117724. CustomShaderPipelineStage.STRUCT_NAME_ATTRIBUTES = "Attributes";
  117725. CustomShaderPipelineStage.STRUCT_ID_VERTEX_INPUT = "VertexInput";
  117726. CustomShaderPipelineStage.STRUCT_NAME_VERTEX_INPUT = "VertexInput";
  117727. CustomShaderPipelineStage.STRUCT_ID_FRAGMENT_INPUT = "FragmentInput";
  117728. CustomShaderPipelineStage.STRUCT_NAME_FRAGMENT_INPUT = "FragmentInput";
  117729. CustomShaderPipelineStage.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_VS = "initializeInputStructVS";
  117730. CustomShaderPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_VS = "void initializeInputStruct(out VertexInput vsInput, ProcessedAttributes attributes)";
  117731. CustomShaderPipelineStage.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_FS = "initializeInputStructFS";
  117732. CustomShaderPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_FS = "void initializeInputStruct(out FragmentInput fsInput, ProcessedAttributes attributes)";
  117733. CustomShaderPipelineStage.process = function(renderResources, primitive, frameState) {
  117734. const shaderBuilder = renderResources.shaderBuilder;
  117735. const customShader = renderResources.model.customShader;
  117736. if (defined_default(customShader.lightingModel)) {
  117737. renderResources.lightingOptions.lightingModel = customShader.lightingModel;
  117738. }
  117739. const alphaOptions = renderResources.alphaOptions;
  117740. if (customShader.isTranslucent) {
  117741. alphaOptions.pass = Pass_default.TRANSLUCENT;
  117742. alphaOptions.alphaMode = AlphaMode_default.BLEND;
  117743. } else {
  117744. alphaOptions.pass = void 0;
  117745. alphaOptions.alphaMode = AlphaMode_default.OPAQUE;
  117746. }
  117747. const generatedCode = generateShaderLines(customShader, primitive);
  117748. if (!generatedCode.customShaderEnabled) {
  117749. return;
  117750. }
  117751. addLinesToShader(shaderBuilder, customShader, generatedCode);
  117752. if (generatedCode.shouldComputePositionWC) {
  117753. shaderBuilder.addDefine(
  117754. "COMPUTE_POSITION_WC",
  117755. void 0,
  117756. ShaderDestination_default.BOTH
  117757. );
  117758. }
  117759. if (defined_default(customShader.vertexShaderText)) {
  117760. shaderBuilder.addDefine(
  117761. "HAS_CUSTOM_VERTEX_SHADER",
  117762. void 0,
  117763. ShaderDestination_default.VERTEX
  117764. );
  117765. }
  117766. if (defined_default(customShader.fragmentShaderText)) {
  117767. shaderBuilder.addDefine(
  117768. "HAS_CUSTOM_FRAGMENT_SHADER",
  117769. void 0,
  117770. ShaderDestination_default.FRAGMENT
  117771. );
  117772. const shaderModeDefine = CustomShaderMode_default.getDefineName(customShader.mode);
  117773. shaderBuilder.addDefine(
  117774. shaderModeDefine,
  117775. void 0,
  117776. ShaderDestination_default.FRAGMENT
  117777. );
  117778. }
  117779. const uniforms = customShader.uniforms;
  117780. for (const uniformName in uniforms) {
  117781. if (uniforms.hasOwnProperty(uniformName)) {
  117782. const uniform = uniforms[uniformName];
  117783. shaderBuilder.addUniform(uniform.type, uniformName);
  117784. }
  117785. }
  117786. const varyings = customShader.varyings;
  117787. for (const varyingName in varyings) {
  117788. if (varyings.hasOwnProperty(varyingName)) {
  117789. const varyingType = varyings[varyingName];
  117790. shaderBuilder.addVarying(varyingType, varyingName);
  117791. }
  117792. }
  117793. renderResources.uniformMap = combine_default(
  117794. renderResources.uniformMap,
  117795. customShader.uniformMap
  117796. );
  117797. };
  117798. function getAttributesByName(attributes) {
  117799. const names = {};
  117800. for (let i2 = 0; i2 < attributes.length; i2++) {
  117801. const attribute = attributes[i2];
  117802. const attributeInfo = ModelExperimentalUtility.getAttributeInfo(attribute);
  117803. names[attributeInfo.variableName] = attributeInfo;
  117804. }
  117805. return names;
  117806. }
  117807. var attributeTypeLUT = {
  117808. position: "vec3",
  117809. normal: "vec3",
  117810. tangent: "vec3",
  117811. bitangent: "vec3",
  117812. texCoord: "vec2",
  117813. color: "vec4",
  117814. joints: "ivec4",
  117815. weights: "vec4"
  117816. };
  117817. var attributeDefaultValueLUT = {
  117818. position: "vec3(0.0)",
  117819. normal: "vec3(0.0, 0.0, 1.0)",
  117820. tangent: "vec3(1.0, 0.0, 0.0)",
  117821. bitangent: "vec3(0.0, 1.0, 0.0)",
  117822. texCoord: "vec2(0.0)",
  117823. color: "vec4(1.0)",
  117824. joints: "ivec4(0)",
  117825. weights: "vec4(0.0)"
  117826. };
  117827. function inferAttributeDefaults(attributeName) {
  117828. let trimmed = attributeName.replace(/_[0-9]+$/, "");
  117829. trimmed = trimmed.replace(/(MC|EC)$/, "");
  117830. const glslType = attributeTypeLUT[trimmed];
  117831. const value = attributeDefaultValueLUT[trimmed];
  117832. if (!defined_default(glslType)) {
  117833. return void 0;
  117834. }
  117835. return {
  117836. attributeField: [glslType, attributeName],
  117837. value
  117838. };
  117839. }
  117840. function generateVertexShaderLines(customShader, attributesByName, vertexLines) {
  117841. const categories = partitionAttributes(
  117842. attributesByName,
  117843. customShader.usedVariablesVertex.attributeSet,
  117844. false
  117845. );
  117846. const addToShader = categories.addToShader;
  117847. const needsDefault = categories.missingAttributes;
  117848. let variableName;
  117849. let vertexInitialization;
  117850. const attributeFields = [];
  117851. const initializationLines = [];
  117852. for (variableName in addToShader) {
  117853. if (addToShader.hasOwnProperty(variableName)) {
  117854. const attributeInfo = addToShader[variableName];
  117855. const attributeField = [attributeInfo.glslType, variableName];
  117856. attributeFields.push(attributeField);
  117857. vertexInitialization = `vsInput.attributes.${variableName} = attributes.${variableName};`;
  117858. initializationLines.push(vertexInitialization);
  117859. }
  117860. }
  117861. for (let i2 = 0; i2 < needsDefault.length; i2++) {
  117862. variableName = needsDefault[i2];
  117863. const attributeDefaults = inferAttributeDefaults(variableName);
  117864. if (!defined_default(attributeDefaults)) {
  117865. CustomShaderPipelineStage._oneTimeWarning(
  117866. "CustomShaderPipelineStage.incompatiblePrimitiveVS",
  117867. `Primitive is missing attribute ${variableName}, disabling custom vertex shader`
  117868. );
  117869. return;
  117870. }
  117871. attributeFields.push(attributeDefaults.attributeField);
  117872. vertexInitialization = `vsInput.attributes.${variableName} = ${attributeDefaults.value};`;
  117873. initializationLines.push(vertexInitialization);
  117874. }
  117875. vertexLines.enabled = true;
  117876. vertexLines.attributeFields = attributeFields;
  117877. vertexLines.initializationLines = initializationLines;
  117878. }
  117879. function generatePositionBuiltins(customShader) {
  117880. const attributeFields = [];
  117881. const initializationLines = [];
  117882. const usedVariables = customShader.usedVariablesFragment.attributeSet;
  117883. if (usedVariables.hasOwnProperty("positionWC")) {
  117884. attributeFields.push(["vec3", "positionWC"]);
  117885. initializationLines.push(
  117886. "fsInput.attributes.positionWC = attributes.positionWC;"
  117887. );
  117888. }
  117889. if (usedVariables.hasOwnProperty("positionEC")) {
  117890. attributeFields.push(["vec3", "positionEC"]);
  117891. initializationLines.push(
  117892. "fsInput.attributes.positionEC = attributes.positionEC;"
  117893. );
  117894. }
  117895. return {
  117896. attributeFields,
  117897. initializationLines
  117898. };
  117899. }
  117900. function generateFragmentShaderLines(customShader, attributesByName, fragmentLines) {
  117901. const categories = partitionAttributes(
  117902. attributesByName,
  117903. customShader.usedVariablesFragment.attributeSet,
  117904. true
  117905. );
  117906. const addToShader = categories.addToShader;
  117907. const needsDefault = categories.missingAttributes;
  117908. let variableName;
  117909. let fragmentInitialization;
  117910. const attributeFields = [];
  117911. const initializationLines = [];
  117912. for (variableName in addToShader) {
  117913. if (addToShader.hasOwnProperty(variableName)) {
  117914. const attributeInfo = addToShader[variableName];
  117915. const attributeField = [attributeInfo.glslType, variableName];
  117916. attributeFields.push(attributeField);
  117917. fragmentInitialization = `fsInput.attributes.${variableName} = attributes.${variableName};`;
  117918. initializationLines.push(fragmentInitialization);
  117919. }
  117920. }
  117921. for (let i2 = 0; i2 < needsDefault.length; i2++) {
  117922. variableName = needsDefault[i2];
  117923. const attributeDefaults = inferAttributeDefaults(variableName);
  117924. if (!defined_default(attributeDefaults)) {
  117925. CustomShaderPipelineStage._oneTimeWarning(
  117926. "CustomShaderPipelineStage.incompatiblePrimitiveFS",
  117927. `Primitive is missing attribute ${variableName}, disabling custom fragment shader.`
  117928. );
  117929. return;
  117930. }
  117931. attributeFields.push(attributeDefaults.attributeField);
  117932. fragmentInitialization = `fsInput.attributes.${variableName} = ${attributeDefaults.value};`;
  117933. initializationLines.push(fragmentInitialization);
  117934. }
  117935. const positionBuiltins = generatePositionBuiltins(customShader);
  117936. fragmentLines.enabled = true;
  117937. fragmentLines.attributeFields = attributeFields.concat(
  117938. positionBuiltins.attributeFields
  117939. );
  117940. fragmentLines.initializationLines = positionBuiltins.initializationLines.concat(
  117941. initializationLines
  117942. );
  117943. }
  117944. var builtinAttributes = {
  117945. positionWC: true,
  117946. positionEC: true
  117947. };
  117948. function partitionAttributes(primitiveAttributes, shaderAttributeSet, isFragmentShader) {
  117949. let renamed;
  117950. let attributeName;
  117951. const addToShader = {};
  117952. for (attributeName in primitiveAttributes) {
  117953. if (primitiveAttributes.hasOwnProperty(attributeName)) {
  117954. const attribute = primitiveAttributes[attributeName];
  117955. renamed = attributeName;
  117956. if (isFragmentShader && attributeName === "normalMC") {
  117957. renamed = "normalEC";
  117958. } else if (isFragmentShader && attributeName === "tangentMC") {
  117959. renamed = "tangentEC";
  117960. }
  117961. if (shaderAttributeSet.hasOwnProperty(renamed)) {
  117962. addToShader[renamed] = attribute;
  117963. }
  117964. }
  117965. }
  117966. const missingAttributes = [];
  117967. for (attributeName in shaderAttributeSet) {
  117968. if (shaderAttributeSet.hasOwnProperty(attributeName)) {
  117969. if (builtinAttributes.hasOwnProperty(attributeName)) {
  117970. continue;
  117971. }
  117972. renamed = attributeName;
  117973. if (isFragmentShader && attributeName === "normalEC") {
  117974. renamed = "normalMC";
  117975. } else if (isFragmentShader && attributeName === "tangentEC") {
  117976. renamed = "tangentMC";
  117977. }
  117978. if (!primitiveAttributes.hasOwnProperty(renamed)) {
  117979. missingAttributes.push(attributeName);
  117980. }
  117981. }
  117982. }
  117983. return {
  117984. addToShader,
  117985. missingAttributes
  117986. };
  117987. }
  117988. function generateShaderLines(customShader, primitive) {
  117989. const vertexLines = {
  117990. enabled: false
  117991. };
  117992. const fragmentLines = {
  117993. enabled: false
  117994. };
  117995. const attributesByName = getAttributesByName(primitive.attributes);
  117996. if (defined_default(customShader.vertexShaderText)) {
  117997. generateVertexShaderLines(customShader, attributesByName, vertexLines);
  117998. }
  117999. if (defined_default(customShader.fragmentShaderText)) {
  118000. generateFragmentShaderLines(customShader, attributesByName, fragmentLines);
  118001. }
  118002. const attributeSetFS = customShader.usedVariablesFragment.attributeSet;
  118003. const shouldComputePositionWC = attributeSetFS.hasOwnProperty("positionWC") && fragmentLines.enabled;
  118004. return {
  118005. vertexLines,
  118006. fragmentLines,
  118007. vertexLinesEnabled: vertexLines.enabled,
  118008. fragmentLinesEnabled: fragmentLines.enabled,
  118009. customShaderEnabled: vertexLines.enabled || fragmentLines.enabled,
  118010. shouldComputePositionWC
  118011. };
  118012. }
  118013. function addVertexLinesToShader(shaderBuilder, vertexLines) {
  118014. let i2;
  118015. let structId = CustomShaderPipelineStage.STRUCT_ID_ATTRIBUTES_VS;
  118016. shaderBuilder.addStruct(
  118017. structId,
  118018. CustomShaderPipelineStage.STRUCT_NAME_ATTRIBUTES,
  118019. ShaderDestination_default.VERTEX
  118020. );
  118021. const attributeFields = vertexLines.attributeFields;
  118022. for (i2 = 0; i2 < attributeFields.length; i2++) {
  118023. const field = attributeFields[i2];
  118024. const glslType = field[0];
  118025. const variableName = field[1];
  118026. shaderBuilder.addStructField(structId, glslType, variableName);
  118027. }
  118028. structId = CustomShaderPipelineStage.STRUCT_ID_VERTEX_INPUT;
  118029. shaderBuilder.addStruct(
  118030. structId,
  118031. CustomShaderPipelineStage.STRUCT_NAME_VERTEX_INPUT,
  118032. ShaderDestination_default.VERTEX
  118033. );
  118034. shaderBuilder.addStructField(
  118035. structId,
  118036. CustomShaderPipelineStage.STRUCT_NAME_ATTRIBUTES,
  118037. "attributes"
  118038. );
  118039. shaderBuilder.addStructField(
  118040. structId,
  118041. FeatureIdPipelineStage_default.STRUCT_NAME_FEATURE_IDS,
  118042. "featureIds"
  118043. );
  118044. shaderBuilder.addStructField(
  118045. structId,
  118046. MetadataPipelineStage_default.STRUCT_NAME_METADATA,
  118047. "metadata"
  118048. );
  118049. const functionId = CustomShaderPipelineStage.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_VS;
  118050. shaderBuilder.addFunction(
  118051. functionId,
  118052. CustomShaderPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_VS,
  118053. ShaderDestination_default.VERTEX
  118054. );
  118055. const initializationLines = vertexLines.initializationLines;
  118056. shaderBuilder.addFunctionLines(functionId, initializationLines);
  118057. }
  118058. function addFragmentLinesToShader(shaderBuilder, fragmentLines) {
  118059. let i2;
  118060. let structId = CustomShaderPipelineStage.STRUCT_ID_ATTRIBUTES_FS;
  118061. shaderBuilder.addStruct(
  118062. structId,
  118063. CustomShaderPipelineStage.STRUCT_NAME_ATTRIBUTES,
  118064. ShaderDestination_default.FRAGMENT
  118065. );
  118066. let field;
  118067. let glslType;
  118068. let variableName;
  118069. const attributeFields = fragmentLines.attributeFields;
  118070. for (i2 = 0; i2 < attributeFields.length; i2++) {
  118071. field = attributeFields[i2];
  118072. glslType = field[0];
  118073. variableName = field[1];
  118074. shaderBuilder.addStructField(structId, glslType, variableName);
  118075. }
  118076. structId = CustomShaderPipelineStage.STRUCT_ID_FRAGMENT_INPUT;
  118077. shaderBuilder.addStruct(
  118078. structId,
  118079. CustomShaderPipelineStage.STRUCT_NAME_FRAGMENT_INPUT,
  118080. ShaderDestination_default.FRAGMENT
  118081. );
  118082. shaderBuilder.addStructField(
  118083. structId,
  118084. CustomShaderPipelineStage.STRUCT_NAME_ATTRIBUTES,
  118085. "attributes"
  118086. );
  118087. shaderBuilder.addStructField(
  118088. structId,
  118089. FeatureIdPipelineStage_default.STRUCT_NAME_FEATURE_IDS,
  118090. "featureIds"
  118091. );
  118092. shaderBuilder.addStructField(
  118093. structId,
  118094. MetadataPipelineStage_default.STRUCT_NAME_METADATA,
  118095. "metadata"
  118096. );
  118097. const functionId = CustomShaderPipelineStage.FUNCTION_ID_INITIALIZE_INPUT_STRUCT_FS;
  118098. shaderBuilder.addFunction(
  118099. functionId,
  118100. CustomShaderPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_INPUT_STRUCT_FS,
  118101. ShaderDestination_default.FRAGMENT
  118102. );
  118103. const initializationLines = fragmentLines.initializationLines;
  118104. shaderBuilder.addFunctionLines(functionId, initializationLines);
  118105. }
  118106. function addLinesToShader(shaderBuilder, customShader, generatedCode) {
  118107. const vertexLines = generatedCode.vertexLines;
  118108. if (vertexLines.enabled) {
  118109. addVertexLinesToShader(shaderBuilder, vertexLines);
  118110. shaderBuilder.addVertexLines([
  118111. "#line 0",
  118112. customShader.vertexShaderText,
  118113. CustomShaderStageVS_default
  118114. ]);
  118115. }
  118116. const fragmentLines = generatedCode.fragmentLines;
  118117. if (fragmentLines.enabled) {
  118118. addFragmentLinesToShader(shaderBuilder, fragmentLines);
  118119. shaderBuilder.addFragmentLines([
  118120. "#line 0",
  118121. customShader.fragmentShaderText,
  118122. CustomShaderStageFS_default
  118123. ]);
  118124. }
  118125. }
  118126. CustomShaderPipelineStage._oneTimeWarning = oneTimeWarning_default;
  118127. var CustomShaderPipelineStage_default = CustomShaderPipelineStage;
  118128. // node_modules/cesium/Source/Shaders/ModelExperimental/CPUStylingStageVS.js
  118129. var CPUStylingStageVS_default = "void filterByPassType(inout vec3 positionMC, vec4 featureColor)\n{\n bool styleTranslucent = (featureColor.a != 1.0);\n // Only render translucent features in the translucent pass (if the style or the original command has translucency).\n if (czm_pass == czm_passTranslucent && !styleTranslucent && !model_commandTranslucent)\n {\n positionMC *= 0.0;\n }\n // If the current pass is not the transluceny pass and the style is not translucent, don't rendeer the feature.\n else if (czm_pass != czm_passTranslucent && styleTranslucent)\n {\n positionMC *= 0.0;\n }\n}\n\nvoid cpuStylingStage(inout vec3 positionMC, inout SelectedFeature feature)\n{\n float show = ceil(feature.color.a);\n positionMC *= show;\n\n #ifdef HAS_SELECTED_FEATURE_ID_ATTRIBUTE\n filterByPassType(positionMC, feature.color);\n #endif\n}\n";
  118130. // node_modules/cesium/Source/Shaders/ModelExperimental/CPUStylingStageFS.js
  118131. var CPUStylingStageFS_default = "void filterByPassType(vec4 featureColor)\n{\n bool styleTranslucent = (featureColor.a != 1.0);\n // Only render translucent features in the translucent pass (if the style or the original command has translucency).\n if (czm_pass == czm_passTranslucent && !styleTranslucent && !model_commandTranslucent)\n {\n discard;\n }\n // If the current pass is not the translucent pass and the style is not translucent, don't render the feature.\n else if (czm_pass != czm_passTranslucent && styleTranslucent)\n {\n discard;\n }\n}\n\nvoid cpuStylingStage(inout czm_modelMaterial material, SelectedFeature feature)\n{\n vec4 featureColor = feature.color;\n\n if (featureColor.a == 0.0)\n {\n discard;\n }\n\n // If a feature ID vertex attribute is used, the pass type filter is applied in the vertex shader.\n // So, we only apply in in the fragment shader if the feature ID texture is used.\n #ifdef HAS_SELECTED_FEATURE_ID_TEXTURE\n filterByPassType(featureColor);\n #endif\n\n featureColor = czm_gammaCorrect(featureColor);\n\n float highlight = ceil(model_colorBlend);\n material.diffuse *= mix(featureColor.rgb, vec3(1.0), highlight);\n material.alpha *= featureColor.a;\n}\n";
  118132. // node_modules/cesium/Source/Scene/ModelExperimental/CPUStylingPipelineStage.js
  118133. var CPUStylingPipelineStage = {};
  118134. CPUStylingPipelineStage.name = "CPUStylingPipelineStage";
  118135. CPUStylingPipelineStage.process = function(renderResources, primitive, frameState) {
  118136. const model = renderResources.model;
  118137. const shaderBuilder = renderResources.shaderBuilder;
  118138. shaderBuilder.addVertexLines([CPUStylingStageVS_default]);
  118139. shaderBuilder.addFragmentLines([CPUStylingStageFS_default]);
  118140. shaderBuilder.addDefine("USE_CPU_STYLING", void 0, ShaderDestination_default.BOTH);
  118141. if (!defined_default(model.color)) {
  118142. shaderBuilder.addUniform(
  118143. "float",
  118144. ModelColorPipelineStage_default.COLOR_BLEND_UNIFORM_NAME,
  118145. ShaderDestination_default.FRAGMENT
  118146. );
  118147. renderResources.uniformMap[ModelColorPipelineStage_default.COLOR_BLEND_UNIFORM_NAME] = function() {
  118148. return ColorBlendMode_default.getColorBlend(
  118149. model.colorBlendMode,
  118150. model.colorBlendAmount
  118151. );
  118152. };
  118153. }
  118154. shaderBuilder.addUniform(
  118155. "bool",
  118156. "model_commandTranslucent",
  118157. ShaderDestination_default.BOTH
  118158. );
  118159. renderResources.uniformMap.model_commandTranslucent = function() {
  118160. return renderResources.alphaOptions.pass === Pass_default.TRANSLUCENT;
  118161. };
  118162. const featureTable = model.featureTables[model.featureTableId];
  118163. const styleCommandsNeeded = StyleCommandsNeeded_default.getStyleCommandsNeeded(
  118164. featureTable.featuresLength,
  118165. featureTable.batchTexture.translucentFeaturesLength
  118166. );
  118167. if (styleCommandsNeeded !== StyleCommandsNeeded_default.ALL_OPAQUE) {
  118168. renderResources.alphaOptions.alphaMode = AlphaMode_default.BLEND;
  118169. }
  118170. renderResources.styleCommandsNeeded = styleCommandsNeeded;
  118171. };
  118172. var CPUStylingPipelineStage_default = CPUStylingPipelineStage;
  118173. // node_modules/cesium/Source/Scene/ModelExperimental/DequantizationPipelineStage.js
  118174. var DequantizationPipelineStage = {};
  118175. DequantizationPipelineStage.name = "DequantizationPipelineStage";
  118176. DequantizationPipelineStage.FUNCTION_ID_DEQUANTIZATION_STAGE_VS = "dequantizationStage";
  118177. DequantizationPipelineStage.FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS = "void dequantizationStage(inout ProcessedAttributes attributes)";
  118178. DequantizationPipelineStage.process = function(renderResources, primitive) {
  118179. const shaderBuilder = renderResources.shaderBuilder;
  118180. shaderBuilder.addFunction(
  118181. DequantizationPipelineStage.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,
  118182. DequantizationPipelineStage.FUNCTION_SIGNATURE_DEQUANTIZATION_STAGE_VS,
  118183. ShaderDestination_default.VERTEX
  118184. );
  118185. shaderBuilder.addDefine(
  118186. "USE_DEQUANTIZATION",
  118187. void 0,
  118188. ShaderDestination_default.VERTEX
  118189. );
  118190. const attributes = primitive.attributes;
  118191. for (let i2 = 0; i2 < attributes.length; i2++) {
  118192. const attribute = attributes[i2];
  118193. const quantization = attribute.quantization;
  118194. if (!defined_default(quantization)) {
  118195. continue;
  118196. }
  118197. const attributeInfo = ModelExperimentalUtility.getAttributeInfo(attribute);
  118198. updateDequantizationFunction(shaderBuilder, attributeInfo);
  118199. addDequantizationUniforms(renderResources, attributeInfo);
  118200. }
  118201. };
  118202. function addDequantizationUniforms(renderResources, attributeInfo) {
  118203. const shaderBuilder = renderResources.shaderBuilder;
  118204. const uniformMap2 = renderResources.uniformMap;
  118205. const variableName = attributeInfo.variableName;
  118206. const quantization = attributeInfo.attribute.quantization;
  118207. if (quantization.octEncoded) {
  118208. const normalizationRange = `model_normalizationRange_${variableName}`;
  118209. shaderBuilder.addUniform(
  118210. "float",
  118211. normalizationRange,
  118212. ShaderDestination_default.VERTEX
  118213. );
  118214. uniformMap2[normalizationRange] = function() {
  118215. return quantization.normalizationRange;
  118216. };
  118217. } else {
  118218. const offset2 = `model_quantizedVolumeOffset_${variableName}`;
  118219. const stepSize = `model_quantizedVolumeStepSize_${variableName}`;
  118220. const glslType = attributeInfo.glslType;
  118221. shaderBuilder.addUniform(glslType, offset2, ShaderDestination_default.VERTEX);
  118222. shaderBuilder.addUniform(glslType, stepSize, ShaderDestination_default.VERTEX);
  118223. let quantizedVolumeOffset = quantization.quantizedVolumeOffset;
  118224. let quantizedVolumeStepSize = quantization.quantizedVolumeStepSize;
  118225. if (/^color_\d+$/.test(variableName)) {
  118226. quantizedVolumeOffset = promoteToVec4(quantizedVolumeOffset, 0);
  118227. quantizedVolumeStepSize = promoteToVec4(quantizedVolumeStepSize, 1);
  118228. }
  118229. uniformMap2[offset2] = function() {
  118230. return quantizedVolumeOffset;
  118231. };
  118232. uniformMap2[stepSize] = function() {
  118233. return quantizedVolumeStepSize;
  118234. };
  118235. }
  118236. }
  118237. function promoteToVec4(value, defaultAlpha) {
  118238. if (value instanceof Cartesian4_default) {
  118239. return value;
  118240. }
  118241. return new Cartesian4_default(value.x, value.y, value.z, defaultAlpha);
  118242. }
  118243. function updateDequantizationFunction(shaderBuilder, attributeInfo) {
  118244. const variableName = attributeInfo.variableName;
  118245. const quantization = attributeInfo.attribute.quantization;
  118246. let line;
  118247. if (quantization.octEncoded) {
  118248. line = generateOctDecodeLine(variableName, quantization);
  118249. } else {
  118250. line = generateDequantizeLine(variableName);
  118251. }
  118252. shaderBuilder.addFunctionLines(
  118253. DequantizationPipelineStage.FUNCTION_ID_DEQUANTIZATION_STAGE_VS,
  118254. [line]
  118255. );
  118256. }
  118257. function generateOctDecodeLine(variableName, quantization) {
  118258. const structField = `attributes.${variableName}`;
  118259. const quantizedAttribute = `a_quantized_${variableName}`;
  118260. const normalizationRange = `model_normalizationRange_${variableName}`;
  118261. const swizzle = quantization.octEncodedZXY ? ".zxy" : ".xyz";
  118262. return `${structField} = czm_octDecode(${quantizedAttribute}, ${normalizationRange})${swizzle};`;
  118263. }
  118264. function generateDequantizeLine(variableName) {
  118265. const structField = `attributes.${variableName}`;
  118266. const quantizedAttribute = `a_quantized_${variableName}`;
  118267. const offset2 = `model_quantizedVolumeOffset_${variableName}`;
  118268. const stepSize = `model_quantizedVolumeStepSize_${variableName}`;
  118269. return `${structField} = ${offset2} + ${quantizedAttribute} * ${stepSize};`;
  118270. }
  118271. var DequantizationPipelineStage_default = DequantizationPipelineStage;
  118272. // node_modules/cesium/Source/Shaders/ModelExperimental/GeometryStageFS.js
  118273. var GeometryStageFS_default = "void geometryStage(out ProcessedAttributes attributes)\n{\n attributes.positionMC = v_positionMC;\n attributes.positionEC = v_positionEC;\n\n #ifdef COMPUTE_POSITION_WC\n attributes.positionWC = v_positionWC;\n #endif\n\n #ifdef HAS_NORMALS\n // renormalize after interpolation\n attributes.normalEC = normalize(v_normalEC);\n #endif\n\n #ifdef HAS_TANGENTS\n attributes.tangentEC = normalize(v_tangentEC);\n #endif\n\n #ifdef HAS_BITANGENTS\n attributes.bitangentEC = normalize(v_bitangentEC);\n #endif\n\n // Everything else is dynamically generated in GeometryPipelineStage\n setDynamicVaryings(attributes);\n}\n";
  118274. // node_modules/cesium/Source/Shaders/ModelExperimental/GeometryStageVS.js
  118275. var GeometryStageVS_default = "void geometryStage(inout ProcessedAttributes attributes, mat4 modelView, mat3 normal) \n{\n // Compute positions in different coordinate systems\n vec3 positionMC = attributes.positionMC;\n v_positionMC = positionMC;\n v_positionEC = (modelView * vec4(positionMC, 1.0)).xyz;\n gl_Position = czm_projection * vec4(v_positionEC, 1.0);\n\n // Sometimes the fragment shader needs this (e.g. custom shaders)\n #ifdef COMPUTE_POSITION_WC\n // Note that this is a 32-bit position which may result in jitter on small\n // scales.\n v_positionWC = (czm_model * vec4(positionMC, 1.0)).xyz;\n #endif\n\n #ifdef HAS_NORMALS\n v_normalEC = normal * attributes.normalMC;\n #endif\n\n #ifdef HAS_TANGENTS\n v_tangentEC = normalize(normal * attributes.tangentMC); \n #endif\n\n #ifdef HAS_BITANGENTS\n v_bitangentEC = normalize(normal * attributes.bitangentMC);\n #endif\n\n // All other varyings need to be dynamically generated in\n // GeometryPipelineStage\n setDynamicVaryings(attributes);\n}\n";
  118276. // node_modules/cesium/Source/Shaders/ModelExperimental/SelectedFeatureIdStageCommon.js
  118277. var SelectedFeatureIdStageCommon_default = "vec2 computeSt(float featureId)\n{\n float stepX = model_textureStep.x;\n float centerX = model_textureStep.y;\n\n #ifdef MULTILINE_BATCH_TEXTURE\n float stepY = model_textureStep.z;\n float centerY = model_textureStep.w;\n\n float xId = mod(featureId, model_textureDimensions.x); \n float yId = floor(featureId / model_textureDimensions.x);\n \n return vec2(centerX + (xId * stepX), centerY + (yId * stepY));\n #else\n return vec2(centerX + (featureId * stepX), 0.5);\n #endif\n}\n\nvoid selectedFeatureIdStage(out SelectedFeature feature, FeatureIds featureIds)\n{ \n int featureId = featureIds.SELECTED_FEATURE_ID;\n\n\n if (featureId < model_featuresLength)\n {\n vec2 featureSt = computeSt(float(featureId));\n\n feature.id = featureId;\n feature.st = featureSt;\n feature.color = texture2D(model_batchTexture, featureSt);\n }\n // Floating point comparisons can be unreliable in GLSL, so we\n // increment the feature ID to make sure it's always greater\n // then the model_featuresLength - a condition we check for in the\n // pick ID, to avoid sampling the pick texture if the feature ID is\n // greater than the number of features.\n else\n {\n feature.id = model_featuresLength + 1;\n feature.st = vec2(0.0);\n feature.color = vec4(1.0);\n }\n\n #ifdef HAS_NULL_FEATURE_ID\n if (featureId == model_nullFeatureId) {\n feature.id = featureId;\n feature.st = vec2(0.0);\n feature.color = vec4(1.0);\n }\n #endif\n}\n";
  118278. // node_modules/cesium/Source/Scene/ModelExperimental/SelectedFeatureIdPipelineStage.js
  118279. var SelectedFeatureIdPipelineStage = {};
  118280. SelectedFeatureIdPipelineStage.name = "SelectedFeatureIdPipelineStage";
  118281. SelectedFeatureIdPipelineStage.STRUCT_ID_SELECTED_FEATURE = "SelectedFeature";
  118282. SelectedFeatureIdPipelineStage.STRUCT_NAME_SELECTED_FEATURE = "SelectedFeature";
  118283. SelectedFeatureIdPipelineStage.FUNCTION_ID_FEATURE_VARYINGS_VS = "updateFeatureStructVS";
  118284. SelectedFeatureIdPipelineStage.FUNCTION_ID_FEATURE_VARYINGS_FS = "updateFeatureStructFS";
  118285. SelectedFeatureIdPipelineStage.FUNCTION_SIGNATURE_UPDATE_FEATURE = "void updateFeatureStruct(inout SelectedFeature feature)";
  118286. SelectedFeatureIdPipelineStage.process = function(renderResources, primitive, frameState) {
  118287. const shaderBuilder = renderResources.shaderBuilder;
  118288. renderResources.hasPropertyTable = true;
  118289. const model = renderResources.model;
  118290. const node = renderResources.runtimeNode.node;
  118291. const selectedFeatureIds = getSelectedFeatureIds(model, node, primitive);
  118292. const shaderDestination = selectedFeatureIds.shaderDestination;
  118293. shaderBuilder.addDefine(
  118294. "HAS_SELECTED_FEATURE_ID",
  118295. void 0,
  118296. shaderDestination
  118297. );
  118298. shaderBuilder.addDefine(
  118299. "SELECTED_FEATURE_ID",
  118300. selectedFeatureIds.variableName,
  118301. shaderDestination
  118302. );
  118303. shaderBuilder.addDefine(
  118304. selectedFeatureIds.featureIdDefine,
  118305. void 0,
  118306. shaderDestination
  118307. );
  118308. updateFeatureStruct(shaderBuilder);
  118309. const nullFeatureId = selectedFeatureIds.featureIds.nullFeatureId;
  118310. const uniformMap2 = renderResources.uniformMap;
  118311. if (defined_default(nullFeatureId)) {
  118312. shaderBuilder.addDefine(
  118313. "HAS_NULL_FEATURE_ID",
  118314. void 0,
  118315. shaderDestination
  118316. );
  118317. shaderBuilder.addUniform("int", "model_nullFeatureId", shaderDestination);
  118318. uniformMap2.model_nullFeatureId = function() {
  118319. return nullFeatureId;
  118320. };
  118321. }
  118322. if (selectedFeatureIds.shaderDestination === ShaderDestination_default.BOTH) {
  118323. shaderBuilder.addVertexLines([SelectedFeatureIdStageCommon_default]);
  118324. }
  118325. shaderBuilder.addFragmentLines([SelectedFeatureIdStageCommon_default]);
  118326. };
  118327. function getFeatureIdDefine(featureIds) {
  118328. if (featureIds instanceof ModelComponents_default.FeatureIdTexture) {
  118329. return "HAS_SELECTED_FEATURE_ID_TEXTURE";
  118330. }
  118331. return "HAS_SELECTED_FEATURE_ID_ATTRIBUTE";
  118332. }
  118333. function getShaderDestination(featureIds) {
  118334. if (featureIds instanceof ModelComponents_default.FeatureIdTexture) {
  118335. return ShaderDestination_default.FRAGMENT;
  118336. }
  118337. return ShaderDestination_default.BOTH;
  118338. }
  118339. function getSelectedFeatureIds(model, node, primitive) {
  118340. let variableName;
  118341. let featureIds;
  118342. if (defined_default(node.instances)) {
  118343. featureIds = ModelExperimentalUtility.getFeatureIdsByLabel(
  118344. node.instances.featureIds,
  118345. model.instanceFeatureIdLabel
  118346. );
  118347. if (defined_default(featureIds)) {
  118348. variableName = defaultValue_default(featureIds.label, featureIds.positionalLabel);
  118349. return {
  118350. featureIds,
  118351. variableName,
  118352. shaderDestination: getShaderDestination(featureIds),
  118353. featureIdDefine: getFeatureIdDefine(featureIds)
  118354. };
  118355. }
  118356. }
  118357. featureIds = ModelExperimentalUtility.getFeatureIdsByLabel(
  118358. primitive.featureIds,
  118359. model.featureIdLabel
  118360. );
  118361. variableName = defaultValue_default(featureIds.label, featureIds.positionalLabel);
  118362. return {
  118363. featureIds,
  118364. variableName,
  118365. shaderDestination: getShaderDestination(featureIds),
  118366. featureIdDefine: getFeatureIdDefine(featureIds)
  118367. };
  118368. }
  118369. function updateFeatureStruct(shaderBuilder) {
  118370. shaderBuilder.addStructField(
  118371. SelectedFeatureIdPipelineStage.STRUCT_ID_SELECTED_FEATURE,
  118372. "int",
  118373. "id"
  118374. );
  118375. shaderBuilder.addStructField(
  118376. SelectedFeatureIdPipelineStage.STRUCT_ID_SELECTED_FEATURE,
  118377. "vec2",
  118378. "st"
  118379. );
  118380. shaderBuilder.addStructField(
  118381. SelectedFeatureIdPipelineStage.STRUCT_ID_SELECTED_FEATURE,
  118382. "vec4",
  118383. "color"
  118384. );
  118385. }
  118386. var SelectedFeatureIdPipelineStage_default = SelectedFeatureIdPipelineStage;
  118387. // node_modules/cesium/Source/Scene/ModelExperimental/ModelExperimentalType.js
  118388. var ModelExperimentalType = {
  118389. GLTF: "GLTF",
  118390. TILE_GLTF: "TILE_GLTF",
  118391. TILE_B3DM: "B3DM",
  118392. TILE_I3DM: "I3DM",
  118393. TILE_PNTS: "PNTS"
  118394. };
  118395. ModelExperimentalType.is3DTiles = function(modelType) {
  118396. Check_default.typeOf.string("modelType", modelType);
  118397. switch (modelType) {
  118398. case ModelExperimentalType.TILE_GLTF:
  118399. case ModelExperimentalType.TILE_B3DM:
  118400. case ModelExperimentalType.TILE_I3DM:
  118401. case ModelExperimentalType.TILE_PNTS:
  118402. return true;
  118403. case ModelExperimentalType.GLTF:
  118404. return false;
  118405. default:
  118406. throw new DeveloperError_default("modelType is not a valid value.");
  118407. }
  118408. };
  118409. var ModelExperimentalType_default = Object.freeze(ModelExperimentalType);
  118410. // node_modules/cesium/Source/Scene/ModelExperimental/GeometryPipelineStage.js
  118411. var GeometryPipelineStage = {};
  118412. GeometryPipelineStage.name = "GeometryPipelineStage";
  118413. GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_VS = "ProcessedAttributesVS";
  118414. GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS = "ProcessedAttributesFS";
  118415. GeometryPipelineStage.STRUCT_NAME_PROCESSED_ATTRIBUTES = "ProcessedAttributes";
  118416. GeometryPipelineStage.FUNCTION_ID_INITIALIZE_ATTRIBUTES = "initializeAttributes";
  118417. GeometryPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES = "void initializeAttributes(out ProcessedAttributes attributes)";
  118418. GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS = "setDynamicVaryingsVS";
  118419. GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS = "setDynamicVaryingsFS";
  118420. GeometryPipelineStage.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS = "void setDynamicVaryings(inout ProcessedAttributes attributes)";
  118421. GeometryPipelineStage.process = function(renderResources, primitive) {
  118422. const shaderBuilder = renderResources.shaderBuilder;
  118423. shaderBuilder.addStruct(
  118424. GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,
  118425. "ProcessedAttributes",
  118426. ShaderDestination_default.VERTEX
  118427. );
  118428. shaderBuilder.addStruct(
  118429. GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,
  118430. "ProcessedAttributes",
  118431. ShaderDestination_default.FRAGMENT
  118432. );
  118433. shaderBuilder.addStruct(
  118434. SelectedFeatureIdPipelineStage_default.STRUCT_ID_SELECTED_FEATURE,
  118435. SelectedFeatureIdPipelineStage_default.STRUCT_NAME_SELECTED_FEATURE,
  118436. ShaderDestination_default.BOTH
  118437. );
  118438. shaderBuilder.addFunction(
  118439. GeometryPipelineStage.FUNCTION_ID_INITIALIZE_ATTRIBUTES,
  118440. GeometryPipelineStage.FUNCTION_SIGNATURE_INITIALIZE_ATTRIBUTES,
  118441. ShaderDestination_default.VERTEX
  118442. );
  118443. shaderBuilder.addVarying("vec3", "v_positionWC");
  118444. shaderBuilder.addVarying("vec3", "v_positionEC");
  118445. shaderBuilder.addStructField(
  118446. GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,
  118447. "vec3",
  118448. "positionWC"
  118449. );
  118450. shaderBuilder.addStructField(
  118451. GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,
  118452. "vec3",
  118453. "positionEC"
  118454. );
  118455. shaderBuilder.addFunction(
  118456. GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS,
  118457. GeometryPipelineStage.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,
  118458. ShaderDestination_default.VERTEX
  118459. );
  118460. shaderBuilder.addFunction(
  118461. GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS,
  118462. GeometryPipelineStage.FUNCTION_SIGNATURE_SET_DYNAMIC_VARYINGS,
  118463. ShaderDestination_default.FRAGMENT
  118464. );
  118465. const modelType = renderResources.model.type;
  118466. if (modelType === ModelExperimentalType_default.TILE_PNTS) {
  118467. shaderBuilder.addDefine(
  118468. "HAS_SRGB_COLOR",
  118469. void 0,
  118470. ShaderDestination_default.FRAGMENT
  118471. );
  118472. }
  118473. for (let i2 = 0; i2 < primitive.attributes.length; i2++) {
  118474. const attribute = primitive.attributes[i2];
  118475. const attributeLocationCount = AttributeType_default.getAttributeLocationCount(
  118476. attribute.type
  118477. );
  118478. let index2;
  118479. if (attributeLocationCount > 1) {
  118480. index2 = renderResources.attributeIndex;
  118481. renderResources.attributeIndex += attributeLocationCount;
  118482. } else if (attribute.semantic === VertexAttributeSemantic_default.POSITION) {
  118483. index2 = 0;
  118484. } else {
  118485. index2 = renderResources.attributeIndex++;
  118486. }
  118487. processAttribute2(renderResources, attribute, index2, attributeLocationCount);
  118488. }
  118489. handleBitangents(shaderBuilder, primitive.attributes);
  118490. if (primitive.primitiveType === PrimitiveType_default.POINTS) {
  118491. shaderBuilder.addDefine("PRIMITIVE_TYPE_POINTS");
  118492. }
  118493. shaderBuilder.addVertexLines([GeometryStageVS_default]);
  118494. shaderBuilder.addFragmentLines([GeometryStageFS_default]);
  118495. };
  118496. function processAttribute2(renderResources, attribute, attributeIndex, attributeLocationCount) {
  118497. const shaderBuilder = renderResources.shaderBuilder;
  118498. const attributeInfo = ModelExperimentalUtility.getAttributeInfo(attribute);
  118499. if (attributeLocationCount > 1) {
  118500. addMatrixAttributeToRenderResources(
  118501. renderResources,
  118502. attribute,
  118503. attributeIndex,
  118504. attributeLocationCount
  118505. );
  118506. } else {
  118507. addAttributeToRenderResources(renderResources, attribute, attributeIndex);
  118508. }
  118509. addAttributeDeclaration(shaderBuilder, attributeInfo);
  118510. addVaryingDeclaration(shaderBuilder, attributeInfo);
  118511. if (defined_default(attribute.semantic)) {
  118512. addSemanticDefine(shaderBuilder, attribute);
  118513. }
  118514. updateAttributesStruct(shaderBuilder, attributeInfo);
  118515. updateInitializeAttributesFunction(shaderBuilder, attributeInfo);
  118516. updateSetDynamicVaryingsFunction(shaderBuilder, attributeInfo);
  118517. }
  118518. function addSemanticDefine(shaderBuilder, attribute) {
  118519. const semantic = attribute.semantic;
  118520. const setIndex = attribute.setIndex;
  118521. switch (semantic) {
  118522. case VertexAttributeSemantic_default.NORMAL:
  118523. shaderBuilder.addDefine("HAS_NORMALS");
  118524. break;
  118525. case VertexAttributeSemantic_default.TANGENT:
  118526. shaderBuilder.addDefine("HAS_TANGENTS");
  118527. break;
  118528. case VertexAttributeSemantic_default.FEATURE_ID:
  118529. shaderBuilder.addDefine(`HAS${semantic}_${setIndex}`);
  118530. break;
  118531. case VertexAttributeSemantic_default.TEXCOORD:
  118532. case VertexAttributeSemantic_default.COLOR:
  118533. shaderBuilder.addDefine(`HAS_${semantic}_${setIndex}`);
  118534. }
  118535. }
  118536. function addAttributeToRenderResources(renderResources, attribute, attributeIndex) {
  118537. const quantization = attribute.quantization;
  118538. let type;
  118539. let componentDatatype;
  118540. if (defined_default(quantization)) {
  118541. type = quantization.type;
  118542. componentDatatype = quantization.componentDatatype;
  118543. } else {
  118544. type = attribute.type;
  118545. componentDatatype = attribute.componentDatatype;
  118546. }
  118547. const semantic = attribute.semantic;
  118548. const setIndex = attribute.setIndex;
  118549. if (semantic === VertexAttributeSemantic_default.FEATURE_ID && setIndex >= renderResources.featureIdVertexAttributeSetIndex) {
  118550. renderResources.featureIdVertexAttributeSetIndex = setIndex + 1;
  118551. }
  118552. const vertexAttribute = {
  118553. index: attributeIndex,
  118554. value: defined_default(attribute.buffer) ? void 0 : attribute.constant,
  118555. vertexBuffer: attribute.buffer,
  118556. count: attribute.count,
  118557. componentsPerAttribute: AttributeType_default.getNumberOfComponents(type),
  118558. componentDatatype,
  118559. offsetInBytes: attribute.byteOffset,
  118560. strideInBytes: attribute.byteStride,
  118561. normalize: attribute.normalized
  118562. };
  118563. renderResources.attributes.push(vertexAttribute);
  118564. }
  118565. function addMatrixAttributeToRenderResources(renderResources, attribute, attributeIndex, columnCount) {
  118566. const quantization = attribute.quantization;
  118567. let type;
  118568. let componentDatatype;
  118569. if (defined_default(quantization)) {
  118570. type = quantization.type;
  118571. componentDatatype = quantization.componentDatatype;
  118572. } else {
  118573. type = attribute.type;
  118574. componentDatatype = attribute.componentDatatype;
  118575. }
  118576. const normalized = attribute.normalized;
  118577. const componentCount = AttributeType_default.getNumberOfComponents(type);
  118578. const componentsPerColumn = componentCount / columnCount;
  118579. const componentSizeInBytes = ComponentDatatype_default.getSizeInBytes(
  118580. componentDatatype
  118581. );
  118582. const columnLengthInBytes = componentsPerColumn * componentSizeInBytes;
  118583. const strideInBytes = attribute.byteStride;
  118584. for (let i2 = 0; i2 < columnCount; i2++) {
  118585. const offsetInBytes = attribute.byteOffset + i2 * columnLengthInBytes;
  118586. const columnAttribute = {
  118587. index: attributeIndex + i2,
  118588. vertexBuffer: attribute.buffer,
  118589. componentsPerAttribute: componentsPerColumn,
  118590. componentDatatype,
  118591. offsetInBytes,
  118592. strideInBytes,
  118593. normalize: normalized
  118594. };
  118595. renderResources.attributes.push(columnAttribute);
  118596. }
  118597. }
  118598. function addVaryingDeclaration(shaderBuilder, attributeInfo) {
  118599. const variableName = attributeInfo.variableName;
  118600. let varyingName = `v_${variableName}`;
  118601. let glslType;
  118602. if (variableName === "normalMC") {
  118603. varyingName = "v_normalEC";
  118604. glslType = attributeInfo.glslType;
  118605. } else if (variableName === "tangentMC") {
  118606. glslType = "vec3";
  118607. varyingName = "v_tangentEC";
  118608. } else {
  118609. glslType = attributeInfo.glslType;
  118610. }
  118611. shaderBuilder.addVarying(glslType, varyingName);
  118612. }
  118613. function addAttributeDeclaration(shaderBuilder, attributeInfo) {
  118614. const semantic = attributeInfo.attribute.semantic;
  118615. const variableName = attributeInfo.variableName;
  118616. let attributeName;
  118617. let glslType;
  118618. if (attributeInfo.isQuantized) {
  118619. attributeName = `a_quantized_${variableName}`;
  118620. glslType = attributeInfo.quantizedGlslType;
  118621. } else {
  118622. attributeName = `a_${variableName}`;
  118623. glslType = attributeInfo.glslType;
  118624. }
  118625. if (semantic === VertexAttributeSemantic_default.POSITION) {
  118626. shaderBuilder.setPositionAttribute(glslType, attributeName);
  118627. } else {
  118628. shaderBuilder.addAttribute(glslType, attributeName);
  118629. }
  118630. }
  118631. function updateAttributesStruct(shaderBuilder, attributeInfo) {
  118632. const vsStructId = GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_VS;
  118633. const fsStructId = GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS;
  118634. const variableName = attributeInfo.variableName;
  118635. if (variableName === "tangentMC") {
  118636. shaderBuilder.addStructField(vsStructId, "vec3", "tangentMC");
  118637. shaderBuilder.addStructField(vsStructId, "float", "tangentSignMC");
  118638. shaderBuilder.addStructField(fsStructId, "vec3", "tangentEC");
  118639. } else if (variableName === "normalMC") {
  118640. shaderBuilder.addStructField(vsStructId, "vec3", "normalMC");
  118641. shaderBuilder.addStructField(fsStructId, "vec3", "normalEC");
  118642. } else {
  118643. shaderBuilder.addStructField(
  118644. vsStructId,
  118645. attributeInfo.glslType,
  118646. variableName
  118647. );
  118648. shaderBuilder.addStructField(
  118649. fsStructId,
  118650. attributeInfo.glslType,
  118651. variableName
  118652. );
  118653. }
  118654. }
  118655. function updateInitializeAttributesFunction(shaderBuilder, attributeInfo) {
  118656. if (attributeInfo.isQuantized) {
  118657. return;
  118658. }
  118659. const functionId = GeometryPipelineStage.FUNCTION_ID_INITIALIZE_ATTRIBUTES;
  118660. const variableName = attributeInfo.variableName;
  118661. const lines = [];
  118662. if (variableName === "tangentMC") {
  118663. lines.push("attributes.tangentMC = a_tangentMC.xyz;");
  118664. lines.push("attributes.tangentSignMC = a_tangentMC.w;");
  118665. } else {
  118666. lines.push(`attributes.${variableName} = a_${variableName};`);
  118667. }
  118668. shaderBuilder.addFunctionLines(functionId, lines);
  118669. }
  118670. function updateSetDynamicVaryingsFunction(shaderBuilder, attributeInfo) {
  118671. const semantic = attributeInfo.attribute.semantic;
  118672. const setIndex = attributeInfo.attribute.setIndex;
  118673. if (defined_default(semantic) && !defined_default(setIndex)) {
  118674. return;
  118675. }
  118676. let functionId = GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_VS;
  118677. const variableName = attributeInfo.variableName;
  118678. let line = `v_${variableName} = attributes.${variableName};`;
  118679. shaderBuilder.addFunctionLines(functionId, [line]);
  118680. functionId = GeometryPipelineStage.FUNCTION_ID_SET_DYNAMIC_VARYINGS_FS;
  118681. line = `attributes.${variableName} = v_${variableName};`;
  118682. shaderBuilder.addFunctionLines(functionId, [line]);
  118683. }
  118684. function handleBitangents(shaderBuilder, attributes) {
  118685. let hasNormals = false;
  118686. let hasTangents = false;
  118687. for (let i2 = 0; i2 < attributes.length; i2++) {
  118688. const attribute = attributes[i2];
  118689. if (attribute.semantic === VertexAttributeSemantic_default.NORMAL) {
  118690. hasNormals = true;
  118691. } else if (attribute.semantic === VertexAttributeSemantic_default.TANGENT) {
  118692. hasTangents = true;
  118693. }
  118694. }
  118695. if (!hasNormals || !hasTangents) {
  118696. return;
  118697. }
  118698. shaderBuilder.addDefine("HAS_BITANGENTS");
  118699. shaderBuilder.addVarying("vec3", "v_bitangentEC");
  118700. shaderBuilder.addStructField(
  118701. GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_VS,
  118702. "vec3",
  118703. "bitangentMC"
  118704. );
  118705. shaderBuilder.addStructField(
  118706. GeometryPipelineStage.STRUCT_ID_PROCESSED_ATTRIBUTES_FS,
  118707. "vec3",
  118708. "bitangentEC"
  118709. );
  118710. }
  118711. var GeometryPipelineStage_default = GeometryPipelineStage;
  118712. // node_modules/cesium/Source/Shaders/ModelExperimental/LightingStageFS.js
  118713. var LightingStageFS_default = "#ifdef LIGHTING_PBR\nvec3 computePbrLighting(czm_modelMaterial inputMaterial, ProcessedAttributes attributes)\n{\n czm_pbrParameters pbrParameters;\n pbrParameters.diffuseColor = inputMaterial.diffuse;\n pbrParameters.f0 = inputMaterial.specular;\n pbrParameters.roughness = inputMaterial.roughness;\n \n #ifdef USE_CUSTOM_LIGHT_COLOR\n vec3 lightColorHdr = model_lightColorHdr;\n #else\n vec3 lightColorHdr = czm_lightColorHdr;\n #endif\n\n vec3 color = inputMaterial.diffuse;\n #ifdef HAS_NORMALS\n color = czm_pbrLighting(\n attributes.positionEC,\n inputMaterial.normalEC,\n czm_lightDirectionEC,\n lightColorHdr,\n pbrParameters\n );\n\n #ifdef USE_IBL_LIGHTING\n color += imageBasedLightingStage(\n attributes.positionEC,\n inputMaterial.normalEC,\n czm_lightDirectionEC,\n lightColorHdr,\n pbrParameters\n );\n #endif\n #endif\n\n color *= inputMaterial.occlusion;\n color += inputMaterial.emissive;\n\n // In HDR mode, the frame buffer is in linear color space. The\n // post-processing stages (see PostProcessStageCollection) will handle\n // tonemapping. However, if HDR is not enabled, we must tonemap else large\n // values may be clamped to 1.0\n #ifndef HDR \n color = czm_acesTonemapping(color);\n #endif \n\n return color;\n}\n#endif\n\nvoid lightingStage(inout czm_modelMaterial material, ProcessedAttributes attributes)\n{\n // Even though the lighting will only set the diffuse color,\n // pass all other properties so further stages have access to them.\n vec3 color = vec3(0.0);\n\n #ifdef LIGHTING_PBR\n color = computePbrLighting(material, attributes);\n #else // unlit\n color = material.diffuse;\n #endif\n\n // If HDR is not enabled, the frame buffer stores sRGB colors rather than\n // linear colors so the linear value must be converted.\n #ifndef HDR\n color = czm_linearToSrgb(color);\n #endif\n\n material.diffuse = color;\n}\n";
  118714. // node_modules/cesium/Source/Scene/ModelExperimental/LightingModel.js
  118715. var LightingModel = {
  118716. UNLIT: 0,
  118717. PBR: 1
  118718. };
  118719. var LightingModel_default = Object.freeze(LightingModel);
  118720. // node_modules/cesium/Source/Scene/ModelExperimental/LightingPipelineStage.js
  118721. var LightingPipelineStage = {};
  118722. LightingPipelineStage.name = "LightingPipelineStage";
  118723. LightingPipelineStage.process = function(renderResources, primitive) {
  118724. const model = renderResources.model;
  118725. const lightingOptions = renderResources.lightingOptions;
  118726. const shaderBuilder = renderResources.shaderBuilder;
  118727. if (defined_default(model.lightColor)) {
  118728. shaderBuilder.addDefine(
  118729. "USE_CUSTOM_LIGHT_COLOR",
  118730. void 0,
  118731. ShaderDestination_default.FRAGMENT
  118732. );
  118733. shaderBuilder.addUniform(
  118734. "vec3",
  118735. "model_lightColorHdr",
  118736. ShaderDestination_default.FRAGMENT
  118737. );
  118738. const uniformMap2 = renderResources.uniformMap;
  118739. uniformMap2.model_lightColorHdr = function() {
  118740. return model.lightColor;
  118741. };
  118742. }
  118743. const lightingModel = lightingOptions.lightingModel;
  118744. if (lightingModel === LightingModel_default.PBR) {
  118745. shaderBuilder.addDefine(
  118746. "LIGHTING_PBR",
  118747. void 0,
  118748. ShaderDestination_default.FRAGMENT
  118749. );
  118750. } else {
  118751. shaderBuilder.addDefine(
  118752. "LIGHTING_UNLIT",
  118753. void 0,
  118754. ShaderDestination_default.FRAGMENT
  118755. );
  118756. }
  118757. shaderBuilder.addFragmentLines([LightingStageFS_default]);
  118758. };
  118759. var LightingPipelineStage_default = LightingPipelineStage;
  118760. // node_modules/cesium/Source/Shaders/ModelExperimental/MaterialStageFS.js
  118761. var MaterialStageFS_default = "// If the style color is white, it implies the feature has not been styled.\nbool isDefaultStyleColor(vec3 color)\n{\n return all(greaterThan(color, vec3(1.0 - czm_epsilon3)));\n}\n\nvec3 blend(vec3 sourceColor, vec3 styleColor, float styleColorBlend)\n{\n vec3 blendColor = mix(sourceColor, styleColor, styleColorBlend);\n vec3 color = isDefaultStyleColor(styleColor.rgb) ? sourceColor : blendColor;\n return color;\n}\n\nvec2 computeTextureTransform(vec2 texCoord, mat3 textureTransform)\n{\n return vec2(textureTransform * vec3(texCoord, 1.0));\n}\n\n#ifdef HAS_NORMALS\nvec3 computeNormal(ProcessedAttributes attributes)\n{\n // Geometry normal. This is already normalized \n vec3 ng = attributes.normalEC;\n\n vec3 normal = ng;\n #if defined(HAS_NORMAL_TEXTURE) && !defined(USE_WIREFRAME)\n vec2 normalTexCoords = TEXCOORD_NORMAL;\n #ifdef HAS_NORMAL_TEXTURE_TRANSFORM\n normalTexCoords = computeTextureTransform(normalTexCoords, u_normalTextureTransform);\n #endif\n\n // If HAS_BITANGENTS is set, then HAS_TANGENTS is also set\n #ifdef HAS_BITANGENTS\n vec3 t = attributes.tangentEC;\n vec3 b = attributes.bitangentEC;\n mat3 tbn = mat3(t, b, ng);\n vec3 n = texture2D(u_normalTexture, normalTexCoords).rgb;\n normal = normalize(tbn * (2.0 * n - 1.0));\n #elif defined(GL_OES_standard_derivatives)\n // Compute tangents\n vec3 positionEC = attributes.positionEC;\n vec3 pos_dx = dFdx(positionEC);\n vec3 pos_dy = dFdy(positionEC);\n vec3 tex_dx = dFdx(vec3(normalTexCoords,0.0));\n vec3 tex_dy = dFdy(vec3(normalTexCoords,0.0));\n vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);\n t = normalize(t - ng * dot(ng, t));\n vec3 b = normalize(cross(ng, t));\n mat3 tbn = mat3(t, b, ng);\n vec3 n = texture2D(u_normalTexture, normalTexCoords).rgb;\n normal = normalize(tbn * (2.0 * n - 1.0));\n #endif\n #endif\n\n return normal;\n}\n#endif\n\nvoid materialStage(inout czm_modelMaterial material, ProcessedAttributes attributes, SelectedFeature feature)\n{\n\n #ifdef HAS_NORMALS\n material.normalEC = computeNormal(attributes);\n #endif\n\n vec4 baseColorWithAlpha = vec4(1.0);\n // Regardless of whether we use PBR, set a base color\n #ifdef HAS_BASE_COLOR_TEXTURE\n vec2 baseColorTexCoords = TEXCOORD_BASE_COLOR;\n\n #ifdef HAS_BASE_COLOR_TEXTURE_TRANSFORM\n baseColorTexCoords = computeTextureTransform(baseColorTexCoords, u_baseColorTextureTransform);\n #endif\n\n baseColorWithAlpha = czm_srgbToLinear(texture2D(u_baseColorTexture, baseColorTexCoords));\n\n #ifdef HAS_BASE_COLOR_FACTOR\n baseColorWithAlpha *= u_baseColorFactor;\n #endif\n #elif defined(HAS_BASE_COLOR_FACTOR)\n baseColorWithAlpha = u_baseColorFactor;\n #endif\n\n #ifdef HAS_COLOR_0\n vec4 color = attributes.color_0;\n // .pnts files store colors in the sRGB color space\n #ifdef HAS_SRGB_COLOR\n color = czm_srgbToLinear(color);\n #endif\n baseColorWithAlpha *= color;\n #endif\n\n material.diffuse = baseColorWithAlpha.rgb;\n material.alpha = baseColorWithAlpha.a;\n\n #ifdef USE_CPU_STYLING\n material.diffuse = blend(material.diffuse, feature.color.rgb, model_colorBlend);\n #endif\n\n #ifdef HAS_OCCLUSION_TEXTURE\n vec2 occlusionTexCoords = TEXCOORD_OCCLUSION;\n #ifdef HAS_OCCLUSION_TEXTURE_TRANSFORM\n occlusionTexCoords = computeTextureTransform(occlusionTexCoords, u_occlusionTextureTransform);\n #endif\n material.occlusion = texture2D(u_occlusionTexture, occlusionTexCoords).r;\n #endif\n\n #ifdef HAS_EMISSIVE_TEXTURE\n vec2 emissiveTexCoords = TEXCOORD_EMISSIVE;\n #ifdef HAS_EMISSIVE_TEXTURE_TRANSFORM\n emissiveTexCoords = computeTextureTransform(emissiveTexCoords, u_emissiveTextureTransform);\n #endif\n\n vec3 emissive = czm_srgbToLinear(texture2D(u_emissiveTexture, emissiveTexCoords).rgb);\n #ifdef HAS_EMISSIVE_FACTOR\n emissive *= u_emissiveFactor;\n #endif\n material.emissive = emissive;\n #elif defined(HAS_EMISSIVE_FACTOR)\n material.emissive = u_emissiveFactor;\n #endif\n\n #if defined(LIGHTING_PBR) && defined(USE_SPECULAR_GLOSSINESS)\n #ifdef HAS_SPECULAR_GLOSSINESS_TEXTURE\n vec2 specularGlossinessTexCoords = TEXCOORD_SPECULAR_GLOSSINESS;\n #ifdef HAS_SPECULAR_GLOSSINESS_TEXTURE_TRANSFORM\n specularGlossinessTexCoords = computeTextureTransform(specularGlossinessTexCoords, u_specularGlossinessTextureTransform);\n #endif\n\n vec4 specularGlossiness = czm_srgbToLinear(texture2D(u_specularGlossinessTexture, specularGlossinessTexCoords));\n vec3 specular = specularGlossiness.rgb;\n float glossiness = specularGlossiness.a;\n #ifdef HAS_SPECULAR_FACTOR\n specular *= u_specularFactor;\n #endif\n\n #ifdef HAS_GLOSSINESS_FACTOR\n glossiness *= u_glossinessFactor;\n #endif\n #else\n #ifdef HAS_SPECULAR_FACTOR\n vec3 specular = clamp(u_specularFactor, vec3(0.0), vec3(1.0));\n #else\n vec3 specular = vec3(1.0);\n #endif\n\n #ifdef HAS_GLOSSINESS_FACTOR\n float glossiness = clamp(u_glossinessFactor, 0.0, 1.0);\n #else\n float glossiness = 1.0;\n #endif\n #endif\n\n #ifdef HAS_DIFFUSE_TEXTURE\n vec2 diffuseTexCoords = TEXCOORD_DIFFUSE;\n #ifdef HAS_DIFFUSE_TEXTURE_TRANSFORM\n diffuseTexCoords = computeTextureTransform(diffuseTexCoords, u_diffuseTextureTransform);\n #endif\n\n vec4 diffuse = czm_srgbToLinear(texture2D(u_diffuseTexture, diffuseTexCoords));\n #ifdef HAS_DIFFUSE_FACTOR\n diffuse *= u_diffuseFactor;\n #endif\n #elif defined(HAS_DIFFUSE_FACTOR)\n vec4 diffuse = clamp(u_diffuseFactor, vec4(0.0), vec4(1.0));\n #else\n vec4 diffuse = vec4(1.0);\n #endif\n czm_pbrParameters parameters = czm_pbrSpecularGlossinessMaterial(\n diffuse.rgb,\n specular,\n glossiness\n );\n material.diffuse = parameters.diffuseColor;\n // the specular glossiness extension's alpha overrides anything set\n // by the base material.\n material.alpha = diffuse.a;\n material.specular = parameters.f0;\n material.roughness = parameters.roughness;\n #elif defined(LIGHTING_PBR)\n #ifdef HAS_METALLIC_ROUGHNESS_TEXTURE\n vec2 metallicRoughnessTexCoords = TEXCOORD_METALLIC_ROUGHNESS;\n #ifdef HAS_METALLIC_ROUGHNESS_TEXTURE_TRANSFORM\n metallicRoughnessTexCoords = computeTextureTransform(metallicRoughnessTexCoords, u_metallicRoughnessTextureTransform);\n #endif\n\n vec3 metallicRoughness = texture2D(u_metallicRoughnessTexture, metallicRoughnessTexCoords).rgb;\n float metalness = clamp(metallicRoughness.b, 0.0, 1.0);\n float roughness = clamp(metallicRoughness.g, 0.04, 1.0);\n #ifdef HAS_METALLIC_FACTOR\n metalness *= u_metallicFactor;\n #endif\n\n #ifdef HAS_ROUGHNESS_FACTOR\n roughness *= u_roughnessFactor;\n #endif\n #else\n #ifdef HAS_METALLIC_FACTOR\n float metalness = clamp(u_metallicFactor, 0.0, 1.0);\n #else\n float metalness = 1.0;\n #endif\n\n #ifdef HAS_ROUGHNESS_FACTOR\n float roughness = clamp(u_roughnessFactor, 0.04, 1.0);\n #else\n float roughness = 1.0;\n #endif\n #endif\n czm_pbrParameters parameters = czm_pbrMetallicRoughnessMaterial(\n material.diffuse,\n metalness,\n roughness\n );\n material.diffuse = parameters.diffuseColor;\n material.specular = parameters.f0;\n material.roughness = parameters.roughness;\n #endif\n}\n";
  118762. // node_modules/cesium/Source/Scene/ModelExperimental/MaterialPipelineStage.js
  118763. var Material4 = ModelComponents_default.Material;
  118764. var MetallicRoughness3 = ModelComponents_default.MetallicRoughness;
  118765. var SpecularGlossiness3 = ModelComponents_default.SpecularGlossiness;
  118766. var MaterialPipelineStage = {};
  118767. MaterialPipelineStage.name = "MaterialPipelineStage";
  118768. MaterialPipelineStage.process = function(renderResources, primitive, frameState) {
  118769. const material = primitive.material;
  118770. const uniformMap2 = renderResources.uniformMap;
  118771. const shaderBuilder = renderResources.shaderBuilder;
  118772. const defaultTexture = frameState.context.defaultTexture;
  118773. const defaultNormalTexture = frameState.context.defaultNormalTexture;
  118774. const defaultEmissiveTexture = frameState.context.defaultEmissiveTexture;
  118775. processMaterialUniforms(
  118776. material,
  118777. uniformMap2,
  118778. shaderBuilder,
  118779. defaultTexture,
  118780. defaultNormalTexture,
  118781. defaultEmissiveTexture
  118782. );
  118783. if (defined_default(material.specularGlossiness)) {
  118784. processSpecularGlossinessUniforms(
  118785. material,
  118786. uniformMap2,
  118787. shaderBuilder,
  118788. defaultTexture
  118789. );
  118790. } else {
  118791. processMetallicRoughnessUniforms(
  118792. material,
  118793. uniformMap2,
  118794. shaderBuilder,
  118795. defaultTexture
  118796. );
  118797. }
  118798. const hasNormals = ModelExperimentalUtility.getAttributeBySemantic(
  118799. primitive,
  118800. VertexAttributeSemantic_default.NORMAL
  118801. );
  118802. const lightingOptions = renderResources.lightingOptions;
  118803. if (material.unlit || !hasNormals) {
  118804. lightingOptions.lightingModel = LightingModel_default.UNLIT;
  118805. } else {
  118806. lightingOptions.lightingModel = LightingModel_default.PBR;
  118807. }
  118808. const model = renderResources.model;
  118809. const cull = model.backFaceCulling && !material.doubleSided;
  118810. const translucent = defined_default(model.color) && model.color.alpha < 1;
  118811. renderResources.renderStateOptions.cull = {
  118812. enabled: cull && !translucent
  118813. };
  118814. const alphaOptions = renderResources.alphaOptions;
  118815. if (!defined_default(alphaOptions.alphaMode)) {
  118816. alphaOptions.alphaMode = material.alphaMode;
  118817. if (material.alphaMode === AlphaMode_default.BLEND) {
  118818. alphaOptions.pass = Pass_default.TRANSLUCENT;
  118819. } else if (material.alphaMode === AlphaMode_default.MASK) {
  118820. alphaOptions.alphaCutoff = material.alphaCutoff;
  118821. }
  118822. }
  118823. shaderBuilder.addFragmentLines([MaterialStageFS_default]);
  118824. if (model.debugWireframe) {
  118825. shaderBuilder.addDefine(
  118826. "USE_WIREFRAME",
  118827. void 0,
  118828. ShaderDestination_default.FRAGMENT
  118829. );
  118830. }
  118831. };
  118832. function processTextureTransform(shaderBuilder, uniformMap2, textureReader, uniformName, defineName) {
  118833. const transformDefine = `HAS_${defineName}_TEXTURE_TRANSFORM`;
  118834. shaderBuilder.addDefine(
  118835. transformDefine,
  118836. void 0,
  118837. ShaderDestination_default.FRAGMENT
  118838. );
  118839. const transformUniformName = `${uniformName}Transform`;
  118840. shaderBuilder.addUniform(
  118841. "mat3",
  118842. transformUniformName,
  118843. ShaderDestination_default.FRAGMENT
  118844. );
  118845. uniformMap2[transformUniformName] = function() {
  118846. return textureReader.transform;
  118847. };
  118848. }
  118849. function processTexture2(shaderBuilder, uniformMap2, textureReader, uniformName, defineName, defaultTexture) {
  118850. shaderBuilder.addUniform(
  118851. "sampler2D",
  118852. uniformName,
  118853. ShaderDestination_default.FRAGMENT
  118854. );
  118855. uniformMap2[uniformName] = function() {
  118856. return defaultValue_default(textureReader.texture, defaultTexture);
  118857. };
  118858. const textureDefine = `HAS_${defineName}_TEXTURE`;
  118859. shaderBuilder.addDefine(textureDefine, void 0, ShaderDestination_default.FRAGMENT);
  118860. const texCoordIndex = textureReader.texCoord;
  118861. const texCoordVarying = `v_texCoord_${texCoordIndex}`;
  118862. const texCoordDefine = `TEXCOORD_${defineName}`;
  118863. shaderBuilder.addDefine(
  118864. texCoordDefine,
  118865. texCoordVarying,
  118866. ShaderDestination_default.FRAGMENT
  118867. );
  118868. const textureTransform = textureReader.transform;
  118869. if (defined_default(textureTransform) && !Matrix3_default.equals(textureTransform, Matrix3_default.IDENTITY)) {
  118870. processTextureTransform(
  118871. shaderBuilder,
  118872. uniformMap2,
  118873. textureReader,
  118874. uniformName,
  118875. defineName
  118876. );
  118877. }
  118878. }
  118879. function processMaterialUniforms(material, uniformMap2, shaderBuilder, defaultTexture, defaultNormalTexture, defaultEmissiveTexture) {
  118880. const emissiveTexture = material.emissiveTexture;
  118881. if (defined_default(emissiveTexture)) {
  118882. processTexture2(
  118883. shaderBuilder,
  118884. uniformMap2,
  118885. emissiveTexture,
  118886. "u_emissiveTexture",
  118887. "EMISSIVE",
  118888. defaultEmissiveTexture
  118889. );
  118890. }
  118891. const emissiveFactor = material.emissiveFactor;
  118892. if (defined_default(emissiveFactor) && !Cartesian3_default.equals(emissiveFactor, Material4.DEFAULT_EMISSIVE_FACTOR)) {
  118893. shaderBuilder.addUniform(
  118894. "vec3",
  118895. "u_emissiveFactor",
  118896. ShaderDestination_default.FRAGMENT
  118897. );
  118898. uniformMap2.u_emissiveFactor = function() {
  118899. return material.emissiveFactor;
  118900. };
  118901. shaderBuilder.addDefine(
  118902. "HAS_EMISSIVE_FACTOR",
  118903. void 0,
  118904. ShaderDestination_default.FRAGMENT
  118905. );
  118906. }
  118907. const normalTexture = material.normalTexture;
  118908. if (defined_default(normalTexture)) {
  118909. processTexture2(
  118910. shaderBuilder,
  118911. uniformMap2,
  118912. normalTexture,
  118913. "u_normalTexture",
  118914. "NORMAL",
  118915. defaultNormalTexture
  118916. );
  118917. }
  118918. const occlusionTexture = material.occlusionTexture;
  118919. if (defined_default(occlusionTexture)) {
  118920. processTexture2(
  118921. shaderBuilder,
  118922. uniformMap2,
  118923. occlusionTexture,
  118924. "u_occlusionTexture",
  118925. "OCCLUSION",
  118926. defaultTexture
  118927. );
  118928. }
  118929. }
  118930. function processSpecularGlossinessUniforms(material, uniformMap2, shaderBuilder, defaultTexture) {
  118931. const specularGlossiness = material.specularGlossiness;
  118932. shaderBuilder.addDefine(
  118933. "USE_SPECULAR_GLOSSINESS",
  118934. void 0,
  118935. ShaderDestination_default.FRAGMENT
  118936. );
  118937. const diffuseTexture = specularGlossiness.diffuseTexture;
  118938. if (defined_default(diffuseTexture)) {
  118939. processTexture2(
  118940. shaderBuilder,
  118941. uniformMap2,
  118942. diffuseTexture,
  118943. "u_diffuseTexture",
  118944. "DIFFUSE",
  118945. defaultTexture
  118946. );
  118947. }
  118948. const diffuseFactor = specularGlossiness.diffuseFactor;
  118949. if (defined_default(diffuseFactor) && !Cartesian4_default.equals(diffuseFactor, SpecularGlossiness3.DEFAULT_DIFFUSE_FACTOR)) {
  118950. shaderBuilder.addUniform(
  118951. "vec4",
  118952. "u_diffuseFactor",
  118953. ShaderDestination_default.FRAGMENT
  118954. );
  118955. uniformMap2.u_diffuseFactor = function() {
  118956. return specularGlossiness.diffuseFactor;
  118957. };
  118958. shaderBuilder.addDefine(
  118959. "HAS_DIFFUSE_FACTOR",
  118960. void 0,
  118961. ShaderDestination_default.FRAGMENT
  118962. );
  118963. }
  118964. const specularGlossinessTexture = specularGlossiness.specularGlossinessTexture;
  118965. if (defined_default(specularGlossinessTexture)) {
  118966. processTexture2(
  118967. shaderBuilder,
  118968. uniformMap2,
  118969. specularGlossinessTexture,
  118970. "u_specularGlossinessTexture",
  118971. "SPECULAR_GLOSSINESS",
  118972. defaultTexture
  118973. );
  118974. }
  118975. const specularFactor = specularGlossiness.specularFactor;
  118976. if (defined_default(specularFactor) && !Cartesian3_default.equals(
  118977. specularFactor,
  118978. SpecularGlossiness3.DEFAULT_SPECULAR_FACTOR
  118979. )) {
  118980. shaderBuilder.addUniform(
  118981. "vec3",
  118982. "u_specularFactor",
  118983. ShaderDestination_default.FRAGMENT
  118984. );
  118985. uniformMap2.u_specularFactor = function() {
  118986. return specularGlossiness.specularFactor;
  118987. };
  118988. shaderBuilder.addDefine(
  118989. "HAS_SPECULAR_FACTOR",
  118990. void 0,
  118991. ShaderDestination_default.FRAGMENT
  118992. );
  118993. }
  118994. const glossinessFactor = specularGlossiness.glossinessFactor;
  118995. if (defined_default(glossinessFactor) && glossinessFactor !== SpecularGlossiness3.DEFAULT_GLOSSINESS_FACTOR) {
  118996. shaderBuilder.addUniform(
  118997. "float",
  118998. "u_glossinessFactor",
  118999. ShaderDestination_default.FRAGMENT
  119000. );
  119001. uniformMap2.u_glossinessFactor = function() {
  119002. return specularGlossiness.glossinessFactor;
  119003. };
  119004. shaderBuilder.addDefine(
  119005. "HAS_GLOSSINESS_FACTOR",
  119006. void 0,
  119007. ShaderDestination_default.FRAGMENT
  119008. );
  119009. }
  119010. }
  119011. function processMetallicRoughnessUniforms(material, uniformMap2, shaderBuilder, defaultTexture) {
  119012. const metallicRoughness = material.metallicRoughness;
  119013. shaderBuilder.addDefine(
  119014. "USE_METALLIC_ROUGHNESS",
  119015. void 0,
  119016. ShaderDestination_default.FRAGMENT
  119017. );
  119018. const baseColorTexture = metallicRoughness.baseColorTexture;
  119019. if (defined_default(baseColorTexture)) {
  119020. processTexture2(
  119021. shaderBuilder,
  119022. uniformMap2,
  119023. baseColorTexture,
  119024. "u_baseColorTexture",
  119025. "BASE_COLOR",
  119026. defaultTexture
  119027. );
  119028. }
  119029. const baseColorFactor = metallicRoughness.baseColorFactor;
  119030. if (defined_default(baseColorFactor) && !Cartesian4_default.equals(
  119031. baseColorFactor,
  119032. MetallicRoughness3.DEFAULT_BASE_COLOR_FACTOR
  119033. )) {
  119034. shaderBuilder.addUniform(
  119035. "vec4",
  119036. "u_baseColorFactor",
  119037. ShaderDestination_default.FRAGMENT
  119038. );
  119039. uniformMap2.u_baseColorFactor = function() {
  119040. return metallicRoughness.baseColorFactor;
  119041. };
  119042. shaderBuilder.addDefine(
  119043. "HAS_BASE_COLOR_FACTOR",
  119044. void 0,
  119045. ShaderDestination_default.FRAGMENT
  119046. );
  119047. }
  119048. const metallicRoughnessTexture = metallicRoughness.metallicRoughnessTexture;
  119049. if (defined_default(metallicRoughnessTexture)) {
  119050. processTexture2(
  119051. shaderBuilder,
  119052. uniformMap2,
  119053. metallicRoughnessTexture,
  119054. "u_metallicRoughnessTexture",
  119055. "METALLIC_ROUGHNESS",
  119056. defaultTexture
  119057. );
  119058. }
  119059. const metallicFactor = metallicRoughness.metallicFactor;
  119060. if (defined_default(metallicFactor) && metallicFactor !== MetallicRoughness3.DEFAULT_METALLIC_FACTOR) {
  119061. shaderBuilder.addUniform(
  119062. "float",
  119063. "u_metallicFactor",
  119064. ShaderDestination_default.FRAGMENT
  119065. );
  119066. uniformMap2.u_metallicFactor = function() {
  119067. return metallicRoughness.metallicFactor;
  119068. };
  119069. shaderBuilder.addDefine(
  119070. "HAS_METALLIC_FACTOR",
  119071. void 0,
  119072. ShaderDestination_default.FRAGMENT
  119073. );
  119074. }
  119075. const roughnessFactor = metallicRoughness.roughnessFactor;
  119076. if (defined_default(roughnessFactor) && roughnessFactor !== MetallicRoughness3.DEFAULT_ROUGHNESS_FACTOR) {
  119077. shaderBuilder.addUniform(
  119078. "float",
  119079. "u_roughnessFactor",
  119080. ShaderDestination_default.FRAGMENT
  119081. );
  119082. uniformMap2.u_roughnessFactor = function() {
  119083. return metallicRoughness.roughnessFactor;
  119084. };
  119085. shaderBuilder.addDefine(
  119086. "HAS_ROUGHNESS_FACTOR",
  119087. void 0,
  119088. ShaderDestination_default.FRAGMENT
  119089. );
  119090. }
  119091. }
  119092. MaterialPipelineStage._processTexture = processTexture2;
  119093. MaterialPipelineStage._processTextureTransform = processTextureTransform;
  119094. var MaterialPipelineStage_default = MaterialPipelineStage;
  119095. // node_modules/cesium/Source/Shaders/ModelExperimental/MorphTargetsStageVS.js
  119096. var MorphTargetsStageVS_default = "void morphTargetsStage(inout ProcessedAttributes attributes) \n{\n vec3 positionMC = attributes.positionMC;\n attributes.positionMC = getMorphedPosition(positionMC);\n\n #ifdef HAS_NORMALS\n vec3 normalMC = attributes.normalMC;\n attributes.normalMC = getMorphedNormal(normalMC);\n #endif\n\n #ifdef HAS_TANGENTS\n vec3 tangentMC = attributes.tangentMC;\n attributes.tangentMC = getMorphedTangent(tangentMC);\n #endif\n}";
  119097. // node_modules/cesium/Source/Scene/ModelExperimental/MorphTargetsPipelineStage.js
  119098. var MorphTargetsPipelineStage = {};
  119099. MorphTargetsPipelineStage.name = "MorphTargetsPipelineStage";
  119100. MorphTargetsPipelineStage.FUNCTION_ID_GET_MORPHED_POSITION = "getMorphedPosition";
  119101. MorphTargetsPipelineStage.FUNCTION_SIGNATURE_GET_MORPHED_POSITION = "vec3 getMorphedPosition(in vec3 position)";
  119102. MorphTargetsPipelineStage.FUNCTION_ID_GET_MORPHED_NORMAL = "getMorphedNormal";
  119103. MorphTargetsPipelineStage.FUNCTION_SIGNATURE_GET_MORPHED_NORMAL = "vec3 getMorphedNormal(in vec3 normal)";
  119104. MorphTargetsPipelineStage.FUNCTION_ID_GET_MORPHED_TANGENT = "getMorphedTangent";
  119105. MorphTargetsPipelineStage.FUNCTION_SIGNATURE_GET_MORPHED_TANGENT = "vec3 getMorphedTangent(in vec3 tangent)";
  119106. MorphTargetsPipelineStage.process = function(renderResources, primitive) {
  119107. const shaderBuilder = renderResources.shaderBuilder;
  119108. shaderBuilder.addDefine(
  119109. "HAS_MORPH_TARGETS",
  119110. void 0,
  119111. ShaderDestination_default.VERTEX
  119112. );
  119113. addGetMorphedAttributeFunctionDeclarations(shaderBuilder);
  119114. for (let i2 = 0; i2 < primitive.morphTargets.length; i2++) {
  119115. const morphTarget = primitive.morphTargets[i2];
  119116. const attributes = morphTarget.attributes;
  119117. for (let j = 0; j < attributes.length; j++) {
  119118. const attribute = attributes[j];
  119119. const semantic = attribute.semantic;
  119120. if (semantic !== VertexAttributeSemantic_default.POSITION && semantic !== VertexAttributeSemantic_default.NORMAL && semantic !== VertexAttributeSemantic_default.TANGENT) {
  119121. continue;
  119122. }
  119123. processMorphTargetAttribute(
  119124. renderResources,
  119125. attribute,
  119126. renderResources.attributeIndex,
  119127. i2
  119128. );
  119129. renderResources.attributeIndex++;
  119130. }
  119131. }
  119132. addGetMorphedAttributeFunctionReturns(shaderBuilder);
  119133. const weights2 = renderResources.runtimeNode.morphWeights;
  119134. const weightsLength = weights2.length;
  119135. shaderBuilder.addUniform(
  119136. "float",
  119137. `u_morphWeights[${weightsLength}]`,
  119138. ShaderDestination_default.VERTEX
  119139. );
  119140. shaderBuilder.addVertexLines([MorphTargetsStageVS_default]);
  119141. const uniformMap2 = {
  119142. u_morphWeights: function() {
  119143. return renderResources.runtimeNode.morphWeights;
  119144. }
  119145. };
  119146. renderResources.uniformMap = combine_default(uniformMap2, renderResources.uniformMap);
  119147. };
  119148. var scratchAttributeInfo = {
  119149. attributeString: void 0,
  119150. functionId: void 0
  119151. };
  119152. function processMorphTargetAttribute(renderResources, attribute, attributeIndex, morphTargetIndex) {
  119153. const shaderBuilder = renderResources.shaderBuilder;
  119154. addMorphTargetAttributeToRenderResources(
  119155. renderResources,
  119156. attribute,
  119157. attributeIndex
  119158. );
  119159. const attributeInfo = getMorphTargetAttributeInfo(
  119160. attribute,
  119161. scratchAttributeInfo
  119162. );
  119163. addMorphTargetAttributeDeclarationAndFunctionLine(
  119164. shaderBuilder,
  119165. attributeInfo,
  119166. morphTargetIndex
  119167. );
  119168. }
  119169. function addMorphTargetAttributeToRenderResources(renderResources, attribute, attributeIndex) {
  119170. const vertexAttribute = {
  119171. index: attributeIndex,
  119172. value: defined_default(attribute.buffer) ? void 0 : attribute.constant,
  119173. vertexBuffer: attribute.buffer,
  119174. componentsPerAttribute: AttributeType_default.getNumberOfComponents(attribute.type),
  119175. componentDatatype: attribute.componentDatatype,
  119176. offsetInBytes: attribute.byteOffset,
  119177. strideInBytes: attribute.byteStride,
  119178. normalize: attribute.normalized
  119179. };
  119180. renderResources.attributes.push(vertexAttribute);
  119181. }
  119182. function getMorphTargetAttributeInfo(attribute, result) {
  119183. const semantic = attribute.semantic;
  119184. switch (semantic) {
  119185. case VertexAttributeSemantic_default.POSITION:
  119186. result.attributeString = "Position";
  119187. result.functionId = MorphTargetsPipelineStage.FUNCTION_ID_GET_MORPHED_POSITION;
  119188. break;
  119189. case VertexAttributeSemantic_default.NORMAL:
  119190. result.attributeString = "Normal";
  119191. result.functionId = MorphTargetsPipelineStage.FUNCTION_ID_GET_MORPHED_NORMAL;
  119192. break;
  119193. case VertexAttributeSemantic_default.TANGENT:
  119194. result.attributeString = "Tangent";
  119195. result.functionId = MorphTargetsPipelineStage.FUNCTION_ID_GET_MORPHED_TANGENT;
  119196. break;
  119197. default:
  119198. break;
  119199. }
  119200. return result;
  119201. }
  119202. function addMorphTargetAttributeDeclarationAndFunctionLine(shaderBuilder, attributeInfo, morphTargetIndex) {
  119203. const attributeString = attributeInfo.attributeString;
  119204. const attributeName = `a_target${attributeString}_${morphTargetIndex}`;
  119205. const line = `morphed${attributeString} += u_morphWeights[${morphTargetIndex}] * a_target${attributeString}_${morphTargetIndex};`;
  119206. shaderBuilder.addAttribute("vec3", attributeName);
  119207. shaderBuilder.addFunctionLines(attributeInfo.functionId, [line]);
  119208. }
  119209. function addGetMorphedAttributeFunctionDeclarations(shaderBuilder) {
  119210. shaderBuilder.addFunction(
  119211. MorphTargetsPipelineStage.FUNCTION_ID_GET_MORPHED_POSITION,
  119212. MorphTargetsPipelineStage.FUNCTION_SIGNATURE_GET_MORPHED_POSITION,
  119213. ShaderDestination_default.VERTEX
  119214. );
  119215. const positionLine = "vec3 morphedPosition = position;";
  119216. shaderBuilder.addFunctionLines(
  119217. MorphTargetsPipelineStage.FUNCTION_ID_GET_MORPHED_POSITION,
  119218. [positionLine]
  119219. );
  119220. shaderBuilder.addFunction(
  119221. MorphTargetsPipelineStage.FUNCTION_ID_GET_MORPHED_NORMAL,
  119222. MorphTargetsPipelineStage.FUNCTION_SIGNATURE_GET_MORPHED_NORMAL,
  119223. ShaderDestination_default.VERTEX
  119224. );
  119225. const normalLine = "vec3 morphedNormal = normal;";
  119226. shaderBuilder.addFunctionLines(
  119227. MorphTargetsPipelineStage.FUNCTION_ID_GET_MORPHED_NORMAL,
  119228. [normalLine]
  119229. );
  119230. shaderBuilder.addFunction(
  119231. MorphTargetsPipelineStage.FUNCTION_ID_GET_MORPHED_TANGENT,
  119232. MorphTargetsPipelineStage.FUNCTION_SIGNATURE_GET_MORPHED_TANGENT,
  119233. ShaderDestination_default.VERTEX
  119234. );
  119235. const tangentLine = "vec3 morphedTangent = tangent;";
  119236. shaderBuilder.addFunctionLines(
  119237. MorphTargetsPipelineStage.FUNCTION_ID_GET_MORPHED_TANGENT,
  119238. [tangentLine]
  119239. );
  119240. }
  119241. function addGetMorphedAttributeFunctionReturns(shaderBuilder) {
  119242. const positionLine = "return morphedPosition;";
  119243. shaderBuilder.addFunctionLines(
  119244. MorphTargetsPipelineStage.FUNCTION_ID_GET_MORPHED_POSITION,
  119245. [positionLine]
  119246. );
  119247. const normalLine = "return morphedNormal;";
  119248. shaderBuilder.addFunctionLines(
  119249. MorphTargetsPipelineStage.FUNCTION_ID_GET_MORPHED_NORMAL,
  119250. [normalLine]
  119251. );
  119252. const tangentLine = "return morphedTangent;";
  119253. shaderBuilder.addFunctionLines(
  119254. MorphTargetsPipelineStage.FUNCTION_ID_GET_MORPHED_TANGENT,
  119255. [tangentLine]
  119256. );
  119257. }
  119258. var MorphTargetsPipelineStage_default = MorphTargetsPipelineStage;
  119259. // node_modules/cesium/Source/Scene/ModelExperimental/PickingPipelineStage.js
  119260. var PickingPipelineStage = {};
  119261. PickingPipelineStage.name = "PickingPipelineStage";
  119262. PickingPipelineStage.process = function(renderResources, primitive, frameState) {
  119263. const context = frameState.context;
  119264. const runtimeNode = renderResources.runtimeNode;
  119265. const shaderBuilder = renderResources.shaderBuilder;
  119266. const model = renderResources.model;
  119267. const instances = runtimeNode.node.instances;
  119268. if (renderResources.hasPropertyTable) {
  119269. processPickTexture(renderResources, primitive, instances, context);
  119270. } else if (defined_default(instances)) {
  119271. processInstancedPickIds(renderResources, instances, context);
  119272. } else {
  119273. const pickObject = buildPickObject(renderResources);
  119274. const pickId = context.createPickId(pickObject);
  119275. model._resources.push(pickId);
  119276. shaderBuilder.addUniform(
  119277. "vec4",
  119278. "czm_pickColor",
  119279. ShaderDestination_default.FRAGMENT
  119280. );
  119281. const uniformMap2 = renderResources.uniformMap;
  119282. uniformMap2.czm_pickColor = function() {
  119283. return pickId.color;
  119284. };
  119285. renderResources.pickId = "czm_pickColor";
  119286. }
  119287. };
  119288. function buildPickObject(renderResources, instanceId) {
  119289. const model = renderResources.model;
  119290. const detailPickObject = {
  119291. model,
  119292. node: renderResources.runtimeNode,
  119293. primitive: renderResources.runtimePrimitive
  119294. };
  119295. let pickObject;
  119296. if (ModelExperimentalType_default.is3DTiles(model.type)) {
  119297. const content = model.content;
  119298. pickObject = {
  119299. content,
  119300. primitive: content.tileset,
  119301. detail: detailPickObject
  119302. };
  119303. } else {
  119304. pickObject = {
  119305. primitive: model,
  119306. detail: detailPickObject
  119307. };
  119308. }
  119309. if (defined_default(instanceId)) {
  119310. pickObject.instanceId = instanceId;
  119311. }
  119312. return pickObject;
  119313. }
  119314. function processPickTexture(renderResources, primitive, instances) {
  119315. const model = renderResources.model;
  119316. let featureTableId;
  119317. let featureIdAttribute;
  119318. const featureIdLabel = model.featureIdLabel;
  119319. const instanceFeatureIdLabel = model.instanceFeatureIdLabel;
  119320. if (defined_default(model.featureTableId)) {
  119321. featureTableId = model.featureTableId;
  119322. } else if (defined_default(instances)) {
  119323. featureIdAttribute = ModelExperimentalUtility.getFeatureIdsByLabel(
  119324. instances.featureIds,
  119325. instanceFeatureIdLabel
  119326. );
  119327. featureTableId = featureIdAttribute.propertyTableId;
  119328. } else {
  119329. featureIdAttribute = ModelExperimentalUtility.getFeatureIdsByLabel(
  119330. primitive.featureIds,
  119331. featureIdLabel
  119332. );
  119333. featureTableId = featureIdAttribute.propertyTableId;
  119334. }
  119335. const featureTable = model.featureTables[featureTableId];
  119336. const shaderBuilder = renderResources.shaderBuilder;
  119337. shaderBuilder.addUniform(
  119338. "sampler2D",
  119339. "model_pickTexture",
  119340. ShaderDestination_default.FRAGMENT
  119341. );
  119342. const batchTexture = featureTable.batchTexture;
  119343. renderResources.uniformMap.model_pickTexture = function() {
  119344. return defaultValue_default(batchTexture.pickTexture, batchTexture.defaultTexture);
  119345. };
  119346. renderResources.pickId = "((selectedFeature.id < int(model_featuresLength)) ? texture2D(model_pickTexture, selectedFeature.st) : vec4(0.0))";
  119347. }
  119348. function processInstancedPickIds(renderResources, instances, context) {
  119349. const instanceCount = renderResources.instanceCount;
  119350. const pickIds = new Array(instanceCount);
  119351. const pickIdsTypedArray = new Uint8Array(instanceCount * 4);
  119352. const model = renderResources.model;
  119353. const modelResources = model._resources;
  119354. for (let i2 = 0; i2 < instanceCount; i2++) {
  119355. const pickObject = buildPickObject(renderResources, i2);
  119356. const pickId = context.createPickId(pickObject);
  119357. modelResources.push(pickId);
  119358. pickIds[i2] = pickId;
  119359. const pickColor = pickId.color;
  119360. pickIdsTypedArray[i2 * 4 + 0] = Color_default.floatToByte(pickColor.red);
  119361. pickIdsTypedArray[i2 * 4 + 1] = Color_default.floatToByte(pickColor.green);
  119362. pickIdsTypedArray[i2 * 4 + 2] = Color_default.floatToByte(pickColor.blue);
  119363. pickIdsTypedArray[i2 * 4 + 3] = Color_default.floatToByte(pickColor.alpha);
  119364. }
  119365. const pickIdsBuffer = Buffer_default.createVertexBuffer({
  119366. context,
  119367. typedArray: pickIdsTypedArray,
  119368. usage: BufferUsage_default.STATIC_DRAW
  119369. });
  119370. pickIdsBuffer.vertexArrayDestroyable = false;
  119371. modelResources.push(pickIdsBuffer);
  119372. const pickIdsVertexAttribute = {
  119373. index: renderResources.attributeIndex++,
  119374. vertexBuffer: pickIdsBuffer,
  119375. componentsPerAttribute: 4,
  119376. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  119377. normalize: true,
  119378. offsetInBytes: 0,
  119379. strideInBytes: 0,
  119380. instanceDivisor: 1
  119381. };
  119382. renderResources.attributes.push(pickIdsVertexAttribute);
  119383. const shaderBuilder = renderResources.shaderBuilder;
  119384. shaderBuilder.addDefine("USE_PICKING", void 0, ShaderDestination_default.BOTH);
  119385. shaderBuilder.addAttribute("vec4", "a_pickColor");
  119386. shaderBuilder.addVarying("vec4", "v_pickColor");
  119387. renderResources.pickId = "v_pickColor";
  119388. }
  119389. var PickingPipelineStage_default = PickingPipelineStage;
  119390. // node_modules/cesium/Source/Shaders/ModelExperimental/PointCloudAttenuationStageVS.js
  119391. var PointCloudAttenuationStageVS_default = "float pointCloudAttenuationStage(vec3 positionEC) {\n // Variables are packed into a single vector to minimize gl.uniformXXX() calls\n float pointSize = model_pointCloudAttenuation.x;\n float geometricError = model_pointCloudAttenuation.y;\n float depthMultiplier = model_pointCloudAttenuation.z;\n float depth = -positionEC.z;\n return min((geometricError / depth) * depthMultiplier, pointSize);\n}\n";
  119392. // node_modules/cesium/Source/Scene/ModelExperimental/PointCloudAttenuationPipelineStage.js
  119393. var PointCloudAttenuationPipelineStage = {};
  119394. PointCloudAttenuationPipelineStage.name = "PointCloudAttenuationPipelineStage";
  119395. var scratchAttenuationUniform = new Cartesian3_default();
  119396. PointCloudAttenuationPipelineStage.process = function(renderResources, primitive, frameState) {
  119397. const shaderBuilder = renderResources.shaderBuilder;
  119398. shaderBuilder.addVertexLines([PointCloudAttenuationStageVS_default]);
  119399. shaderBuilder.addDefine(
  119400. "USE_POINT_CLOUD_ATTENUATION",
  119401. void 0,
  119402. ShaderDestination_default.VERTEX
  119403. );
  119404. const model = renderResources.model;
  119405. const pointCloudShading = model.pointCloudShading;
  119406. let content;
  119407. let is3DTiles;
  119408. let usesAddRefinement;
  119409. if (ModelExperimentalType_default.is3DTiles(model.type)) {
  119410. is3DTiles = true;
  119411. content = model.content;
  119412. usesAddRefinement = content.tile.refine === Cesium3DTileRefine_default.ADD;
  119413. }
  119414. shaderBuilder.addUniform(
  119415. "vec3",
  119416. "model_pointCloudAttenuation",
  119417. ShaderDestination_default.VERTEX
  119418. );
  119419. renderResources.uniformMap.model_pointCloudAttenuation = function() {
  119420. const scratch = scratchAttenuationUniform;
  119421. let defaultPointSize = 1;
  119422. if (is3DTiles) {
  119423. defaultPointSize = usesAddRefinement ? 5 : content.tileset.maximumScreenSpaceError;
  119424. }
  119425. scratch.x = defaultValue_default(
  119426. pointCloudShading.maximumAttenuation,
  119427. defaultPointSize
  119428. );
  119429. scratch.x *= frameState.pixelRatio;
  119430. const geometricError = getGeometricError3(
  119431. renderResources,
  119432. primitive,
  119433. pointCloudShading,
  119434. content
  119435. );
  119436. scratch.y = geometricError * pointCloudShading.geometricErrorScale;
  119437. const context = frameState.context;
  119438. const frustum = frameState.camera.frustum;
  119439. let depthMultiplier;
  119440. if (frameState.mode === SceneMode_default.SCENE2D || frustum instanceof OrthographicFrustum_default) {
  119441. depthMultiplier = Number.POSITIVE_INFINITY;
  119442. } else {
  119443. depthMultiplier = context.drawingBufferHeight / frameState.camera.frustum.sseDenominator;
  119444. }
  119445. scratch.z = depthMultiplier;
  119446. return scratch;
  119447. };
  119448. };
  119449. var scratchDimensions = new Cartesian3_default();
  119450. function getGeometricError3(renderResources, primitive, pointCloudShading, content) {
  119451. if (defined_default(content)) {
  119452. const geometricError = content.tile.geometricError;
  119453. if (geometricError > 0) {
  119454. return geometricError;
  119455. }
  119456. }
  119457. if (defined_default(pointCloudShading.baseResolution)) {
  119458. return pointCloudShading.baseResolution;
  119459. }
  119460. const positionAttribute = ModelExperimentalUtility.getAttributeBySemantic(
  119461. primitive,
  119462. VertexAttributeSemantic_default.POSITION
  119463. );
  119464. const pointsLength = positionAttribute.count;
  119465. const nodeTransform = renderResources.runtimeNode.transform;
  119466. let dimensions = Cartesian3_default.subtract(
  119467. positionAttribute.max,
  119468. positionAttribute.min,
  119469. scratchDimensions
  119470. );
  119471. dimensions = Matrix4_default.multiplyByPointAsVector(
  119472. nodeTransform,
  119473. dimensions,
  119474. scratchDimensions
  119475. );
  119476. const volume = dimensions.x * dimensions.y * dimensions.z;
  119477. const geometricErrorEstimate = Math_default.cbrt(volume / pointsLength);
  119478. return geometricErrorEstimate;
  119479. }
  119480. var PointCloudAttenuationPipelineStage_default = PointCloudAttenuationPipelineStage;
  119481. // node_modules/cesium/Source/Shaders/ModelExperimental/SkinningStageVS.js
  119482. var SkinningStageVS_default = "void skinningStage(inout ProcessedAttributes attributes) \n{\n mat4 skinningMatrix = getSkinningMatrix();\n mat3 skinningMatrixMat3 = mat3(skinningMatrix);\n\n vec4 positionMC = vec4(attributes.positionMC, 1.0);\n attributes.positionMC = vec3(skinningMatrix * positionMC);\n\n #ifdef HAS_NORMALS\n vec3 normalMC = attributes.normalMC;\n attributes.normalMC = skinningMatrixMat3 * normalMC;\n #endif\n\n #ifdef HAS_TANGENTS\n vec3 tangentMC = attributes.tangentMC;\n attributes.tangentMC = skinningMatrixMat3 * tangentMC;\n #endif\n}";
  119483. // node_modules/cesium/Source/Scene/ModelExperimental/SkinningPipelineStage.js
  119484. var SkinningPipelineStage = {};
  119485. SkinningPipelineStage.name = "SkinningPipelineStage";
  119486. SkinningPipelineStage.FUNCTION_ID_GET_SKINNING_MATRIX = "getSkinningMatrix";
  119487. SkinningPipelineStage.FUNCTION_SIGNATURE_GET_SKINNING_MATRIX = "mat4 getSkinningMatrix()";
  119488. SkinningPipelineStage.process = function(renderResources, primitive) {
  119489. const shaderBuilder = renderResources.shaderBuilder;
  119490. shaderBuilder.addDefine("HAS_SKINNING", void 0, ShaderDestination_default.VERTEX);
  119491. addGetSkinningMatrixFunction(shaderBuilder, primitive);
  119492. const runtimeNode = renderResources.runtimeNode;
  119493. const jointMatrices = runtimeNode.computedJointMatrices;
  119494. shaderBuilder.addUniform(
  119495. "mat4",
  119496. `u_jointMatrices[${jointMatrices.length}]`,
  119497. ShaderDestination_default.VERTEX
  119498. );
  119499. shaderBuilder.addVertexLines([SkinningStageVS_default]);
  119500. const uniformMap2 = {
  119501. u_jointMatrices: function() {
  119502. return runtimeNode.computedJointMatrices;
  119503. }
  119504. };
  119505. renderResources.uniformMap = combine_default(uniformMap2, renderResources.uniformMap);
  119506. };
  119507. function getMaximumAttributeSetIndex(primitive) {
  119508. let setIndex = -1;
  119509. const attributes = primitive.attributes;
  119510. const length3 = attributes.length;
  119511. for (let i2 = 0; i2 < length3; i2++) {
  119512. const attribute = attributes[i2];
  119513. const isJointsOrWeights = attribute.semantic === VertexAttributeSemantic_default.JOINTS || attribute.semantic === VertexAttributeSemantic_default.WEIGHTS;
  119514. if (!isJointsOrWeights) {
  119515. continue;
  119516. }
  119517. setIndex = Math.max(setIndex, attribute.setIndex);
  119518. }
  119519. return setIndex;
  119520. }
  119521. function addGetSkinningMatrixFunction(shaderBuilder, primitive) {
  119522. shaderBuilder.addFunction(
  119523. SkinningPipelineStage.FUNCTION_ID_GET_SKINNING_MATRIX,
  119524. SkinningPipelineStage.FUNCTION_SIGNATURE_GET_SKINNING_MATRIX,
  119525. ShaderDestination_default.VERTEX
  119526. );
  119527. const initialLine = "mat4 skinnedMatrix = mat4(0);";
  119528. shaderBuilder.addFunctionLines(
  119529. SkinningPipelineStage.FUNCTION_ID_GET_SKINNING_MATRIX,
  119530. [initialLine]
  119531. );
  119532. let setIndex;
  119533. let componentIndex;
  119534. const componentStrings = ["x", "y", "z", "w"];
  119535. const maximumSetIndex = getMaximumAttributeSetIndex(primitive);
  119536. for (setIndex = 0; setIndex <= maximumSetIndex; setIndex++) {
  119537. for (componentIndex = 0; componentIndex <= 3; componentIndex++) {
  119538. const component = componentStrings[componentIndex];
  119539. const line = `skinnedMatrix += a_weights_${setIndex}.${component} * u_jointMatrices[int(a_joints_${setIndex}.${component})];`;
  119540. shaderBuilder.addFunctionLines(
  119541. SkinningPipelineStage.FUNCTION_ID_GET_SKINNING_MATRIX,
  119542. [line]
  119543. );
  119544. }
  119545. }
  119546. const returnLine = "return skinnedMatrix;";
  119547. shaderBuilder.addFunctionLines(
  119548. SkinningPipelineStage.FUNCTION_ID_GET_SKINNING_MATRIX,
  119549. [returnLine]
  119550. );
  119551. }
  119552. var SkinningPipelineStage_default = SkinningPipelineStage;
  119553. // node_modules/cesium/Source/Scene/ModelExperimental/ModelExperimentalPrimitive.js
  119554. function ModelExperimentalPrimitive(options) {
  119555. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  119556. const primitive = options.primitive;
  119557. const node = options.node;
  119558. const model = options.model;
  119559. Check_default.typeOf.object("options.primitive", primitive);
  119560. Check_default.typeOf.object("options.node", node);
  119561. Check_default.typeOf.object("options.model", model);
  119562. this.primitive = primitive;
  119563. this.node = node;
  119564. this.model = model;
  119565. this.pipelineStages = [];
  119566. this.drawCommands = [];
  119567. this.boundingSphere = void 0;
  119568. this.updateStages = [];
  119569. this.configurePipeline();
  119570. }
  119571. ModelExperimentalPrimitive.prototype.configurePipeline = function() {
  119572. const pipelineStages = this.pipelineStages;
  119573. pipelineStages.length = 0;
  119574. const primitive = this.primitive;
  119575. const node = this.node;
  119576. const model = this.model;
  119577. const customShader = model.customShader;
  119578. const hasMorphTargets = defined_default(primitive.morphTargets) && primitive.morphTargets.length > 0;
  119579. const hasSkinning = defined_default(node.skin);
  119580. const hasCustomShader = defined_default(customShader);
  119581. const hasCustomFragmentShader = hasCustomShader && defined_default(customShader.fragmentShaderText);
  119582. const materialsEnabled = !hasCustomFragmentShader || customShader.mode !== CustomShaderMode_default.REPLACE_MATERIAL;
  119583. const hasQuantization = ModelExperimentalUtility.hasQuantizedAttributes(
  119584. primitive.attributes
  119585. );
  119586. const pointCloudShading = model.pointCloudShading;
  119587. const hasAttenuation = defined_default(pointCloudShading) && pointCloudShading.attenuation;
  119588. const featureIdFlags = inspectFeatureIds(model, node, primitive);
  119589. pipelineStages.push(GeometryPipelineStage_default);
  119590. if (hasMorphTargets) {
  119591. pipelineStages.push(MorphTargetsPipelineStage_default);
  119592. }
  119593. if (hasSkinning) {
  119594. pipelineStages.push(SkinningPipelineStage_default);
  119595. }
  119596. if (hasAttenuation && primitive.primitiveType === PrimitiveType_default.POINTS) {
  119597. pipelineStages.push(PointCloudAttenuationPipelineStage_default);
  119598. }
  119599. if (hasQuantization) {
  119600. pipelineStages.push(DequantizationPipelineStage_default);
  119601. }
  119602. if (materialsEnabled) {
  119603. pipelineStages.push(MaterialPipelineStage_default);
  119604. }
  119605. pipelineStages.push(FeatureIdPipelineStage_default);
  119606. pipelineStages.push(MetadataPipelineStage_default);
  119607. if (featureIdFlags.hasPropertyTable) {
  119608. pipelineStages.push(SelectedFeatureIdPipelineStage_default);
  119609. pipelineStages.push(BatchTexturePipelineStage_default);
  119610. pipelineStages.push(CPUStylingPipelineStage_default);
  119611. }
  119612. if (hasCustomShader) {
  119613. pipelineStages.push(CustomShaderPipelineStage_default);
  119614. }
  119615. pipelineStages.push(LightingPipelineStage_default);
  119616. if (model.allowPicking) {
  119617. pipelineStages.push(PickingPipelineStage_default);
  119618. }
  119619. pipelineStages.push(AlphaPipelineStage_default);
  119620. return;
  119621. };
  119622. function inspectFeatureIds(model, node, primitive) {
  119623. let featureIds;
  119624. if (defined_default(node.instances)) {
  119625. featureIds = ModelExperimentalUtility.getFeatureIdsByLabel(
  119626. node.instances.featureIds,
  119627. model.instanceFeatureIdLabel
  119628. );
  119629. if (defined_default(featureIds)) {
  119630. return {
  119631. hasFeatureIds: true,
  119632. hasPropertyTable: defined_default(featureIds.propertyTableId)
  119633. };
  119634. }
  119635. }
  119636. featureIds = ModelExperimentalUtility.getFeatureIdsByLabel(
  119637. primitive.featureIds,
  119638. model.featureIdLabel
  119639. );
  119640. if (defined_default(featureIds)) {
  119641. return {
  119642. hasFeatureIds: true,
  119643. hasPropertyTable: defined_default(featureIds.propertyTableId)
  119644. };
  119645. }
  119646. return {
  119647. hasFeatureIds: false,
  119648. hasPropertyTable: false
  119649. };
  119650. }
  119651. // node_modules/cesium/Source/Shaders/ModelExperimental/InstancingStageCommon.js
  119652. var InstancingStageCommon_default = "mat4 getInstancingTransform()\n{\n mat4 instancingTransform;\n\n #ifdef HAS_INSTANCE_MATRICES\n instancingTransform = mat4(\n a_instancingTransformRow0.x, a_instancingTransformRow1.x, a_instancingTransformRow2.x, 0.0, // Column 1\n a_instancingTransformRow0.y, a_instancingTransformRow1.y, a_instancingTransformRow2.y, 0.0, // Column 2\n a_instancingTransformRow0.z, a_instancingTransformRow1.z, a_instancingTransformRow2.z, 0.0, // Column 3\n a_instancingTransformRow0.w, a_instancingTransformRow1.w, a_instancingTransformRow2.w, 1.0 // Column 4\n );\n #else\n vec3 translation = vec3(0.0, 0.0, 0.0);\n vec3 scale = vec3(1.0, 1.0, 1.0);\n \n #ifdef HAS_INSTANCE_TRANSLATION\n translation = a_instanceTranslation;\n #endif\n #ifdef HAS_INSTANCE_SCALE\n scale = a_instanceScale;\n #endif\n\n instancingTransform = mat4(\n scale.x, 0.0, 0.0, 0.0,\n 0.0, scale.y, 0.0, 0.0,\n 0.0, 0.0, scale.z, 0.0,\n translation.x, translation.y, translation.z, 1.0\n ); \n #endif\n\n return instancingTransform;\n}\n";
  119653. // node_modules/cesium/Source/Shaders/ModelExperimental/InstancingStageVS.js
  119654. var InstancingStageVS_default = "void instancingStage(inout vec3 positionMC) \n{\n mat4 instancingTransform = getInstancingTransform();\n\n positionMC = (instancingTransform * vec4(positionMC, 1.0)).xyz;\n}\n";
  119655. // node_modules/cesium/Source/Shaders/ModelExperimental/LegacyInstancingStageVS.js
  119656. var LegacyInstancingStageVS_default = "void legacyInstancingStage(inout vec3 positionMC, out mat4 instanceModelView, out mat3 instanceModelViewInverseTranspose)\n{\n mat4 instancingTransform = getInstancingTransform();\n\n mat4 instanceModel = instancingTransform * u_instance_nodeTransform;\n instanceModelView = u_instance_modifiedModelView;\n instanceModelViewInverseTranspose = mat3(u_instance_modifiedModelView * instanceModel);\n\n positionMC = (instanceModel * vec4(positionMC, 1.0)).xyz;\n}\n";
  119657. // node_modules/cesium/Source/Scene/ModelExperimental/InstancingPipelineStage.js
  119658. var modelViewScratch = new Matrix4_default();
  119659. var nodeTransformScratch = new Matrix4_default();
  119660. var InstancingPipelineStage = {};
  119661. InstancingPipelineStage.name = "InstancingPipelineStage";
  119662. InstancingPipelineStage.process = function(renderResources, node, frameState) {
  119663. const instances = node.instances;
  119664. const count = instances.attributes[0].count;
  119665. let instancingVertexAttributes = [];
  119666. const sceneGraph = renderResources.model.sceneGraph;
  119667. const shaderBuilder = renderResources.shaderBuilder;
  119668. shaderBuilder.addDefine("HAS_INSTANCING");
  119669. shaderBuilder.addVertexLines([InstancingStageCommon_default]);
  119670. const translationAttribute = ModelExperimentalUtility.getAttributeBySemantic(
  119671. instances,
  119672. InstanceAttributeSemantic_default.TRANSLATION
  119673. );
  119674. let translationMax;
  119675. let translationMin;
  119676. if (defined_default(translationAttribute)) {
  119677. translationMax = translationAttribute.max;
  119678. translationMin = translationAttribute.min;
  119679. }
  119680. const rotationAttribute = ModelExperimentalUtility.getAttributeBySemantic(
  119681. instances,
  119682. InstanceAttributeSemantic_default.ROTATION
  119683. );
  119684. if (defined_default(rotationAttribute) || !defined_default(translationMax) || !defined_default(translationMin)) {
  119685. instancingVertexAttributes = processMatrixAttributes(
  119686. node,
  119687. count,
  119688. renderResources,
  119689. frameState
  119690. );
  119691. } else {
  119692. if (defined_default(translationAttribute)) {
  119693. instancingVertexAttributes.push({
  119694. index: renderResources.attributeIndex++,
  119695. vertexBuffer: translationAttribute.buffer,
  119696. componentsPerAttribute: AttributeType_default.getNumberOfComponents(
  119697. translationAttribute.type
  119698. ),
  119699. componentDatatype: translationAttribute.componentDatatype,
  119700. normalize: false,
  119701. offsetInBytes: translationAttribute.byteOffset,
  119702. strideInBytes: translationAttribute.byteStride,
  119703. instanceDivisor: 1
  119704. });
  119705. renderResources.instancingTranslationMax = translationMax;
  119706. renderResources.instancingTranslationMin = translationMin;
  119707. shaderBuilder.addDefine("HAS_INSTANCE_TRANSLATION");
  119708. shaderBuilder.addAttribute("vec3", "a_instanceTranslation");
  119709. }
  119710. const scaleAttribute = ModelExperimentalUtility.getAttributeBySemantic(
  119711. instances,
  119712. InstanceAttributeSemantic_default.SCALE
  119713. );
  119714. if (defined_default(scaleAttribute)) {
  119715. instancingVertexAttributes.push({
  119716. index: renderResources.attributeIndex++,
  119717. vertexBuffer: scaleAttribute.buffer,
  119718. componentsPerAttribute: AttributeType_default.getNumberOfComponents(
  119719. scaleAttribute.type
  119720. ),
  119721. componentDatatype: scaleAttribute.componentDatatype,
  119722. normalize: false,
  119723. offsetInBytes: scaleAttribute.byteOffset,
  119724. strideInBytes: scaleAttribute.byteStride,
  119725. instanceDivisor: 1
  119726. });
  119727. shaderBuilder.addDefine("HAS_INSTANCE_SCALE");
  119728. shaderBuilder.addAttribute("vec3", "a_instanceScale");
  119729. }
  119730. }
  119731. processFeatureIdAttributes(
  119732. renderResources,
  119733. frameState,
  119734. instances,
  119735. instancingVertexAttributes
  119736. );
  119737. if (instances.transformInWorldSpace) {
  119738. const uniformMap2 = renderResources.uniformMap;
  119739. shaderBuilder.addDefine(
  119740. "USE_LEGACY_INSTANCING",
  119741. void 0,
  119742. ShaderDestination_default.VERTEX
  119743. );
  119744. shaderBuilder.addUniform(
  119745. "mat4",
  119746. "u_instance_modifiedModelView",
  119747. ShaderDestination_default.VERTEX
  119748. );
  119749. shaderBuilder.addUniform(
  119750. "mat4",
  119751. "u_instance_nodeTransform",
  119752. ShaderDestination_default.VERTEX
  119753. );
  119754. uniformMap2.u_instance_modifiedModelView = function() {
  119755. const modifiedModelMatrix = Matrix4_default.multiplyTransformation(
  119756. renderResources.model.modelMatrix,
  119757. sceneGraph.components.transform,
  119758. modelViewScratch
  119759. );
  119760. return Matrix4_default.multiplyTransformation(
  119761. frameState.context.uniformState.view,
  119762. modifiedModelMatrix,
  119763. modelViewScratch
  119764. );
  119765. };
  119766. uniformMap2.u_instance_nodeTransform = function() {
  119767. return Matrix4_default.multiplyTransformation(
  119768. sceneGraph.axisCorrectionMatrix,
  119769. renderResources.runtimeNode.computedTransform,
  119770. nodeTransformScratch
  119771. );
  119772. };
  119773. shaderBuilder.addVertexLines([LegacyInstancingStageVS_default]);
  119774. } else {
  119775. shaderBuilder.addVertexLines([InstancingStageVS_default]);
  119776. }
  119777. renderResources.instanceCount = count;
  119778. renderResources.attributes.push.apply(
  119779. renderResources.attributes,
  119780. instancingVertexAttributes
  119781. );
  119782. };
  119783. var translationScratch = new Cartesian3_default();
  119784. var rotationScratch = new Quaternion_default();
  119785. var scaleScratch = new Cartesian3_default();
  119786. var transformScratch = new Matrix4_default();
  119787. function getInstanceTransformsTypedArray(instances, count, renderResources) {
  119788. const elements = 12;
  119789. const transformsTypedArray = new Float32Array(count * elements);
  119790. const translationAttribute = ModelExperimentalUtility.getAttributeBySemantic(
  119791. instances,
  119792. InstanceAttributeSemantic_default.TRANSLATION
  119793. );
  119794. const rotationAttribute = ModelExperimentalUtility.getAttributeBySemantic(
  119795. instances,
  119796. InstanceAttributeSemantic_default.ROTATION
  119797. );
  119798. const scaleAttribute = ModelExperimentalUtility.getAttributeBySemantic(
  119799. instances,
  119800. InstanceAttributeSemantic_default.SCALE
  119801. );
  119802. const instancingTranslationMax = new Cartesian3_default(
  119803. -Number.MAX_VALUE,
  119804. -Number.MAX_VALUE,
  119805. -Number.MAX_VALUE
  119806. );
  119807. const instancingTranslationMin = new Cartesian3_default(
  119808. Number.MAX_VALUE,
  119809. Number.MAX_VALUE,
  119810. Number.MAX_VALUE
  119811. );
  119812. const hasTranslation = defined_default(translationAttribute);
  119813. const hasRotation = defined_default(rotationAttribute);
  119814. const hasScale = defined_default(scaleAttribute);
  119815. const translationTypedArray = hasTranslation ? translationAttribute.packedTypedArray : new Float32Array(count * 3);
  119816. const rotationTypedArray = hasRotation ? rotationAttribute.packedTypedArray : new Float32Array(count * 4);
  119817. let scaleTypedArray;
  119818. if (hasScale) {
  119819. scaleTypedArray = scaleAttribute.packedTypedArray;
  119820. } else {
  119821. scaleTypedArray = new Float32Array(count * 3);
  119822. scaleTypedArray.fill(1);
  119823. }
  119824. for (let i2 = 0; i2 < count; i2++) {
  119825. const translation3 = new Cartesian3_default(
  119826. translationTypedArray[i2 * 3],
  119827. translationTypedArray[i2 * 3 + 1],
  119828. translationTypedArray[i2 * 3 + 2],
  119829. translationScratch
  119830. );
  119831. Cartesian3_default.maximumByComponent(
  119832. instancingTranslationMax,
  119833. translation3,
  119834. instancingTranslationMax
  119835. );
  119836. Cartesian3_default.minimumByComponent(
  119837. instancingTranslationMin,
  119838. translation3,
  119839. instancingTranslationMin
  119840. );
  119841. const rotation = new Quaternion_default(
  119842. rotationTypedArray[i2 * 4],
  119843. rotationTypedArray[i2 * 4 + 1],
  119844. rotationTypedArray[i2 * 4 + 2],
  119845. hasRotation ? rotationTypedArray[i2 * 4 + 3] : 1,
  119846. rotationScratch
  119847. );
  119848. const scale = new Cartesian3_default(
  119849. scaleTypedArray[i2 * 3],
  119850. scaleTypedArray[i2 * 3 + 1],
  119851. scaleTypedArray[i2 * 3 + 2],
  119852. scaleScratch
  119853. );
  119854. const transform4 = Matrix4_default.fromTranslationQuaternionRotationScale(
  119855. translation3,
  119856. rotation,
  119857. scale,
  119858. transformScratch
  119859. );
  119860. const offset2 = elements * i2;
  119861. transformsTypedArray[offset2 + 0] = transform4[0];
  119862. transformsTypedArray[offset2 + 1] = transform4[4];
  119863. transformsTypedArray[offset2 + 2] = transform4[8];
  119864. transformsTypedArray[offset2 + 3] = transform4[12];
  119865. transformsTypedArray[offset2 + 4] = transform4[1];
  119866. transformsTypedArray[offset2 + 5] = transform4[5];
  119867. transformsTypedArray[offset2 + 6] = transform4[9];
  119868. transformsTypedArray[offset2 + 7] = transform4[13];
  119869. transformsTypedArray[offset2 + 8] = transform4[2];
  119870. transformsTypedArray[offset2 + 9] = transform4[6];
  119871. transformsTypedArray[offset2 + 10] = transform4[10];
  119872. transformsTypedArray[offset2 + 11] = transform4[14];
  119873. renderResources.instancingTranslationMax = instancingTranslationMax;
  119874. renderResources.instancingTranslationMin = instancingTranslationMin;
  119875. }
  119876. return transformsTypedArray;
  119877. }
  119878. function processFeatureIdAttributes(renderResources, frameState, instances, instancingVertexAttributes) {
  119879. const attributes = instances.attributes;
  119880. const model = renderResources.model;
  119881. const shaderBuilder = renderResources.shaderBuilder;
  119882. for (let i2 = 0; i2 < attributes.length; i2++) {
  119883. const attribute = attributes[i2];
  119884. if (attribute.semantic !== InstanceAttributeSemantic_default.FEATURE_ID) {
  119885. continue;
  119886. }
  119887. if (attribute.setIndex >= renderResources.featureIdVertexAttributeSetIndex) {
  119888. renderResources.featureIdVertexAttributeSetIndex = attribute.setIndex + 1;
  119889. }
  119890. const vertexBuffer = Buffer_default.createVertexBuffer({
  119891. context: frameState.context,
  119892. typedArray: attribute.packedTypedArray,
  119893. usage: BufferUsage_default.STATIC_DRAW
  119894. });
  119895. vertexBuffer.vertexArrayDestroyable = false;
  119896. model._resources.push(vertexBuffer);
  119897. instancingVertexAttributes.push({
  119898. index: renderResources.attributeIndex++,
  119899. vertexBuffer,
  119900. componentsPerAttribute: AttributeType_default.getNumberOfComponents(
  119901. attribute.type
  119902. ),
  119903. componentDatatype: attribute.componentDatatype,
  119904. normalize: false,
  119905. offsetInBytes: attribute.byteOffset,
  119906. strideInBytes: attribute.byteStride,
  119907. instanceDivisor: 1
  119908. });
  119909. shaderBuilder.addAttribute(
  119910. "float",
  119911. `a_instanceFeatureId_${attribute.setIndex}`
  119912. );
  119913. }
  119914. }
  119915. function processMatrixAttributes(node, count, renderResources, frameState) {
  119916. const transformsTypedArray = getInstanceTransformsTypedArray(
  119917. node.instances,
  119918. count,
  119919. renderResources
  119920. );
  119921. const transformsVertexBuffer = Buffer_default.createVertexBuffer({
  119922. context: frameState.context,
  119923. typedArray: transformsTypedArray,
  119924. usage: BufferUsage_default.STATIC_DRAW
  119925. });
  119926. transformsVertexBuffer.vertexArrayDestroyable = false;
  119927. renderResources.model._resources.push(transformsVertexBuffer);
  119928. const vertexSizeInFloats = 12;
  119929. const componentByteSize = ComponentDatatype_default.getSizeInBytes(
  119930. ComponentDatatype_default.FLOAT
  119931. );
  119932. const strideInBytes = componentByteSize * vertexSizeInFloats;
  119933. const instancingVertexAttributes = [
  119934. {
  119935. index: renderResources.attributeIndex++,
  119936. vertexBuffer: transformsVertexBuffer,
  119937. componentsPerAttribute: 4,
  119938. componentDatatype: ComponentDatatype_default.FLOAT,
  119939. normalize: false,
  119940. offsetInBytes: 0,
  119941. strideInBytes,
  119942. instanceDivisor: 1
  119943. },
  119944. {
  119945. index: renderResources.attributeIndex++,
  119946. vertexBuffer: transformsVertexBuffer,
  119947. componentsPerAttribute: 4,
  119948. componentDatatype: ComponentDatatype_default.FLOAT,
  119949. normalize: false,
  119950. offsetInBytes: componentByteSize * 4,
  119951. strideInBytes,
  119952. instanceDivisor: 1
  119953. },
  119954. {
  119955. index: renderResources.attributeIndex++,
  119956. vertexBuffer: transformsVertexBuffer,
  119957. componentsPerAttribute: 4,
  119958. componentDatatype: ComponentDatatype_default.FLOAT,
  119959. normalize: false,
  119960. offsetInBytes: componentByteSize * 8,
  119961. strideInBytes,
  119962. instanceDivisor: 1
  119963. }
  119964. ];
  119965. const shaderBuilder = renderResources.shaderBuilder;
  119966. shaderBuilder.addDefine("HAS_INSTANCE_MATRICES");
  119967. shaderBuilder.addAttribute("vec4", "a_instancingTransformRow0");
  119968. shaderBuilder.addAttribute("vec4", "a_instancingTransformRow1");
  119969. shaderBuilder.addAttribute("vec4", "a_instancingTransformRow2");
  119970. return instancingVertexAttributes;
  119971. }
  119972. InstancingPipelineStage._getInstanceTransformsTypedArray = getInstanceTransformsTypedArray;
  119973. var InstancingPipelineStage_default = InstancingPipelineStage;
  119974. // node_modules/cesium/Source/Scene/ModelExperimental/ModelMatrixUpdateStage.js
  119975. var ModelMatrixUpdateStage = {};
  119976. ModelMatrixUpdateStage.name = "ModelMatrixUpdateStage";
  119977. ModelMatrixUpdateStage.update = function(runtimeNode, sceneGraph, frameState) {
  119978. if (runtimeNode._transformDirty) {
  119979. updateRuntimeNode(runtimeNode, sceneGraph, runtimeNode.transformToRoot);
  119980. runtimeNode._transformDirty = false;
  119981. }
  119982. };
  119983. function updateRuntimeNode(runtimeNode, sceneGraph, transformToRoot) {
  119984. let i2, j;
  119985. transformToRoot = Matrix4_default.multiplyTransformation(
  119986. transformToRoot,
  119987. runtimeNode.transform,
  119988. new Matrix4_default()
  119989. );
  119990. runtimeNode.updateComputedTransform();
  119991. const primitivesLength = runtimeNode.runtimePrimitives.length;
  119992. for (i2 = 0; i2 < primitivesLength; i2++) {
  119993. const runtimePrimitive = runtimeNode.runtimePrimitives[i2];
  119994. const drawCommandsLength = runtimePrimitive.drawCommands.length;
  119995. for (j = 0; j < drawCommandsLength; j++) {
  119996. const drawCommand = runtimePrimitive.drawCommands[j];
  119997. drawCommand.modelMatrix = Matrix4_default.multiplyTransformation(
  119998. sceneGraph._computedModelMatrix,
  119999. transformToRoot,
  120000. drawCommand.modelMatrix
  120001. );
  120002. drawCommand.boundingVolume = BoundingSphere_default.transform(
  120003. runtimePrimitive.boundingSphere,
  120004. drawCommand.modelMatrix,
  120005. drawCommand.boundingVolume
  120006. );
  120007. }
  120008. }
  120009. const childrenLength = runtimeNode.children.length;
  120010. for (i2 = 0; i2 < childrenLength; i2++) {
  120011. const childRuntimeNode = sceneGraph._runtimeNodes[runtimeNode.children[i2]];
  120012. childRuntimeNode._transformToRoot = Matrix4_default.clone(
  120013. transformToRoot,
  120014. childRuntimeNode._transformToRoot
  120015. );
  120016. updateRuntimeNode(childRuntimeNode, sceneGraph, transformToRoot);
  120017. childRuntimeNode._transformDirty = false;
  120018. }
  120019. }
  120020. var ModelMatrixUpdateStage_default = ModelMatrixUpdateStage;
  120021. // node_modules/cesium/Source/Scene/ModelExperimental/ModelExperimentalNode.js
  120022. function ModelExperimentalNode(options) {
  120023. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  120024. Check_default.typeOf.object("options.node", options.node);
  120025. Check_default.typeOf.object("options.transform", options.transform);
  120026. Check_default.typeOf.object("options.transformToRoot", options.transformToRoot);
  120027. Check_default.typeOf.object("options.sceneGraph", options.sceneGraph);
  120028. Check_default.typeOf.object("options.children", options.children);
  120029. const sceneGraph = options.sceneGraph;
  120030. const transform4 = options.transform;
  120031. const transformToRoot = options.transformToRoot;
  120032. const node = options.node;
  120033. this._sceneGraph = sceneGraph;
  120034. this._children = options.children;
  120035. this._node = node;
  120036. this._name = node.name;
  120037. this._originalTransform = Matrix4_default.clone(transform4, this._originalTransform);
  120038. this._transform = Matrix4_default.clone(transform4, this._transform);
  120039. this._transformToRoot = Matrix4_default.clone(transformToRoot, this._transformToRoot);
  120040. this._originalTransform = Matrix4_default.clone(transform4, this._originalTransform);
  120041. const computedTransform = Matrix4_default.multiply(
  120042. transformToRoot,
  120043. transform4,
  120044. new Matrix4_default()
  120045. );
  120046. this._computedTransform = computedTransform;
  120047. this._transformDirty = false;
  120048. this._transformParameters = defined_default(node.matrix) ? void 0 : new TranslationRotationScale_default(node.translation, node.rotation, node.scale);
  120049. this._morphWeights = defined_default(node.morphWeights) ? node.morphWeights.slice() : [];
  120050. this._runtimeSkin = void 0;
  120051. this._computedJointMatrices = [];
  120052. this.pipelineStages = [];
  120053. this.runtimePrimitives = [];
  120054. this.updateStages = [];
  120055. this.configurePipeline();
  120056. }
  120057. Object.defineProperties(ModelExperimentalNode.prototype, {
  120058. node: {
  120059. get: function() {
  120060. return this._node;
  120061. }
  120062. },
  120063. sceneGraph: {
  120064. get: function() {
  120065. return this._sceneGraph;
  120066. }
  120067. },
  120068. children: {
  120069. get: function() {
  120070. return this._children;
  120071. }
  120072. },
  120073. transform: {
  120074. get: function() {
  120075. return this._transform;
  120076. },
  120077. set: function(value) {
  120078. if (Matrix4_default.equals(this._transform, value)) {
  120079. return;
  120080. }
  120081. this._transformDirty = true;
  120082. this._transform = Matrix4_default.clone(value, this._transform);
  120083. }
  120084. },
  120085. transformToRoot: {
  120086. get: function() {
  120087. return this._transformToRoot;
  120088. }
  120089. },
  120090. computedTransform: {
  120091. get: function() {
  120092. return this._computedTransform;
  120093. }
  120094. },
  120095. originalTransform: {
  120096. get: function() {
  120097. return this._originalTransform;
  120098. }
  120099. },
  120100. translation: {
  120101. get: function() {
  120102. return defined_default(this._transformParameters) ? this._transformParameters.translation : void 0;
  120103. },
  120104. set: function(value) {
  120105. const transformParameters = this._transformParameters;
  120106. if (!defined_default(transformParameters)) {
  120107. throw new DeveloperError_default(
  120108. "The translation of a node cannot be set if it was defined using a matrix in the model."
  120109. );
  120110. }
  120111. const currentTranslation = transformParameters.translation;
  120112. if (Cartesian3_default.equals(currentTranslation, value)) {
  120113. return;
  120114. }
  120115. transformParameters.translation = Cartesian3_default.clone(
  120116. value,
  120117. transformParameters.translation
  120118. );
  120119. updateTransformFromParameters(this, transformParameters);
  120120. }
  120121. },
  120122. rotation: {
  120123. get: function() {
  120124. return defined_default(this._transformParameters) ? this._transformParameters.rotation : void 0;
  120125. },
  120126. set: function(value) {
  120127. const transformParameters = this._transformParameters;
  120128. if (!defined_default(transformParameters)) {
  120129. throw new DeveloperError_default(
  120130. "The rotation of a node cannot be set if it was defined using a matrix in the model."
  120131. );
  120132. }
  120133. const currentRotation = transformParameters.rotation;
  120134. if (Quaternion_default.equals(currentRotation, value)) {
  120135. return;
  120136. }
  120137. transformParameters.rotation = Quaternion_default.clone(
  120138. value,
  120139. transformParameters.rotation
  120140. );
  120141. updateTransformFromParameters(this, transformParameters);
  120142. }
  120143. },
  120144. scale: {
  120145. get: function() {
  120146. return defined_default(this._transformParameters) ? this._transformParameters.scale : void 0;
  120147. },
  120148. set: function(value) {
  120149. const transformParameters = this._transformParameters;
  120150. if (!defined_default(transformParameters)) {
  120151. throw new DeveloperError_default(
  120152. "The scale of a node cannot be set if it was defined using a matrix in the model."
  120153. );
  120154. }
  120155. const currentScale = transformParameters.scale;
  120156. if (Cartesian3_default.equals(currentScale, value)) {
  120157. return;
  120158. }
  120159. transformParameters.scale = Cartesian3_default.clone(
  120160. value,
  120161. transformParameters.scale
  120162. );
  120163. updateTransformFromParameters(this, transformParameters);
  120164. }
  120165. },
  120166. morphWeights: {
  120167. get: function() {
  120168. return this._morphWeights;
  120169. },
  120170. set: function(value) {
  120171. const valueLength = value.length;
  120172. if (this._morphWeights.length !== valueLength) {
  120173. throw new DeveloperError_default(
  120174. "value must have the same length as the original weights array."
  120175. );
  120176. }
  120177. for (let i2 = 0; i2 < valueLength; i2++) {
  120178. this._morphWeights[i2] = value[i2];
  120179. }
  120180. }
  120181. },
  120182. runtimeSkin: {
  120183. get: function() {
  120184. return this._runtimeSkin;
  120185. }
  120186. },
  120187. computedJointMatrices: {
  120188. get: function() {
  120189. return this._computedJointMatrices;
  120190. }
  120191. }
  120192. });
  120193. function updateTransformFromParameters(runtimeNode, transformParameters) {
  120194. runtimeNode._transformDirty = true;
  120195. runtimeNode._transform = Matrix4_default.fromTranslationRotationScale(
  120196. transformParameters,
  120197. runtimeNode._transform
  120198. );
  120199. }
  120200. ModelExperimentalNode.prototype.getChild = function(index2) {
  120201. Check_default.typeOf.number("index", index2);
  120202. if (index2 < 0 || index2 >= this.children.length) {
  120203. throw new DeveloperError_default(
  120204. "index must be greater than or equal to 0 and less than the number of children."
  120205. );
  120206. }
  120207. return this.sceneGraph.runtimeNodes[this.children[index2]];
  120208. };
  120209. ModelExperimentalNode.prototype.configurePipeline = function() {
  120210. const node = this.node;
  120211. const pipelineStages = this.pipelineStages;
  120212. pipelineStages.length = 0;
  120213. const updateStages = this.updateStages;
  120214. updateStages.length = 0;
  120215. if (defined_default(node.instances)) {
  120216. pipelineStages.push(InstancingPipelineStage_default);
  120217. }
  120218. updateStages.push(ModelMatrixUpdateStage_default);
  120219. };
  120220. ModelExperimentalNode.prototype.updateComputedTransform = function() {
  120221. this._computedTransform = Matrix4_default.multiply(
  120222. this._transformToRoot,
  120223. this._transform,
  120224. this._computedTransform
  120225. );
  120226. };
  120227. ModelExperimentalNode.prototype.updateJointMatrices = function() {
  120228. const runtimeSkin = this._runtimeSkin;
  120229. if (!defined_default(runtimeSkin)) {
  120230. return;
  120231. }
  120232. runtimeSkin.updateJointMatrices();
  120233. const computedJointMatrices = this._computedJointMatrices;
  120234. const skinJointMatrices = runtimeSkin.jointMatrices;
  120235. const length3 = skinJointMatrices.length;
  120236. for (let i2 = 0; i2 < length3; i2++) {
  120237. if (!defined_default(computedJointMatrices[i2])) {
  120238. computedJointMatrices[i2] = new Matrix4_default();
  120239. }
  120240. const nodeWorldTransform = Matrix4_default.multiplyTransformation(
  120241. this.transformToRoot,
  120242. this.transform,
  120243. computedJointMatrices[i2]
  120244. );
  120245. const inverseNodeWorldTransform = Matrix4_default.inverseTransformation(
  120246. nodeWorldTransform,
  120247. computedJointMatrices[i2]
  120248. );
  120249. computedJointMatrices[i2] = Matrix4_default.multiplyTransformation(
  120250. inverseNodeWorldTransform,
  120251. skinJointMatrices[i2],
  120252. computedJointMatrices[i2]
  120253. );
  120254. }
  120255. };
  120256. // node_modules/cesium/Source/Scene/ModelExperimental/ModelExperimentalSkin.js
  120257. function ModelExperimentalSkin(options) {
  120258. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  120259. Check_default.typeOf.object("options.skin", options.skin);
  120260. Check_default.typeOf.object("options.sceneGraph", options.sceneGraph);
  120261. this._sceneGraph = options.sceneGraph;
  120262. const skin = options.skin;
  120263. this._skin = skin;
  120264. this._inverseBindMatrices = void 0;
  120265. this._joints = [];
  120266. this._jointMatrices = [];
  120267. initialize15(this);
  120268. }
  120269. Object.defineProperties(ModelExperimentalSkin.prototype, {
  120270. skin: {
  120271. get: function() {
  120272. return this._skin;
  120273. }
  120274. },
  120275. sceneGraph: {
  120276. get: function() {
  120277. return this._sceneGraph;
  120278. }
  120279. },
  120280. inverseBindMatrices: {
  120281. get: function() {
  120282. return this._inverseBindMatrices;
  120283. }
  120284. },
  120285. joints: {
  120286. get: function() {
  120287. return this._joints;
  120288. }
  120289. },
  120290. jointMatrices: {
  120291. get: function() {
  120292. return this._jointMatrices;
  120293. }
  120294. }
  120295. });
  120296. function initialize15(runtimeSkin) {
  120297. const skin = runtimeSkin.skin;
  120298. const inverseBindMatrices = skin.inverseBindMatrices;
  120299. runtimeSkin._inverseBindMatrices = inverseBindMatrices;
  120300. const joints = skin.joints;
  120301. const length3 = joints.length;
  120302. const runtimeNodes = runtimeSkin.sceneGraph._runtimeNodes;
  120303. const runtimeJoints = runtimeSkin.joints;
  120304. const runtimeJointMatrices = runtimeSkin._jointMatrices;
  120305. for (let i2 = 0; i2 < length3; i2++) {
  120306. const jointIndex = joints[i2].index;
  120307. const runtimeNode = runtimeNodes[jointIndex];
  120308. runtimeJoints.push(runtimeNode);
  120309. const inverseBindMatrix = inverseBindMatrices[i2];
  120310. const jointMatrix = computeJointMatrix(
  120311. runtimeNode,
  120312. inverseBindMatrix,
  120313. new Matrix4_default()
  120314. );
  120315. runtimeJointMatrices.push(jointMatrix);
  120316. }
  120317. }
  120318. function computeJointMatrix(joint, inverseBindMatrix, result) {
  120319. const jointWorldTransform = Matrix4_default.multiplyTransformation(
  120320. joint.transformToRoot,
  120321. joint.transform,
  120322. result
  120323. );
  120324. result = Matrix4_default.multiplyTransformation(
  120325. jointWorldTransform,
  120326. inverseBindMatrix,
  120327. result
  120328. );
  120329. return result;
  120330. }
  120331. ModelExperimentalSkin.prototype.updateJointMatrices = function() {
  120332. const jointMatrices = this._jointMatrices;
  120333. const length3 = jointMatrices.length;
  120334. for (let i2 = 0; i2 < length3; i2++) {
  120335. const joint = this.joints[i2];
  120336. const inverseBindMatrix = this.inverseBindMatrices[i2];
  120337. jointMatrices[i2] = computeJointMatrix(
  120338. joint,
  120339. inverseBindMatrix,
  120340. jointMatrices[i2]
  120341. );
  120342. }
  120343. };
  120344. // node_modules/cesium/Source/Scene/ModelExperimental/ModelAlphaOptions.js
  120345. function ModelAlphaOptions() {
  120346. this.pass = void 0;
  120347. this.alphaMode = void 0;
  120348. this.alphaCutoff = void 0;
  120349. }
  120350. // node_modules/cesium/Source/Renderer/ShaderStruct.js
  120351. function ShaderStruct(name) {
  120352. this.name = name;
  120353. this.fields = [];
  120354. }
  120355. ShaderStruct.prototype.addField = function(type, identifier) {
  120356. const field = ` ${type} ${identifier};`;
  120357. this.fields.push(field);
  120358. };
  120359. ShaderStruct.prototype.generateGlslLines = function() {
  120360. let fields = this.fields;
  120361. if (fields.length === 0) {
  120362. fields = [" float _empty;"];
  120363. }
  120364. return [].concat(`struct ${this.name}`, "{", fields, "};");
  120365. };
  120366. // node_modules/cesium/Source/Renderer/ShaderFunction.js
  120367. function ShaderFunction(signature) {
  120368. this.signature = signature;
  120369. this.body = [];
  120370. }
  120371. ShaderFunction.prototype.addLines = function(lines) {
  120372. const paddedLines = lines.map(function(line) {
  120373. return ` ${line}`;
  120374. });
  120375. Array.prototype.push.apply(this.body, paddedLines);
  120376. };
  120377. ShaderFunction.prototype.generateGlslLines = function() {
  120378. return [].concat(this.signature, "{", this.body, "}");
  120379. };
  120380. // node_modules/cesium/Source/Renderer/ShaderBuilder.js
  120381. function ShaderBuilder() {
  120382. this._positionAttributeLine = void 0;
  120383. this._nextAttributeLocation = 1;
  120384. this._attributeLocations = {};
  120385. this._attributeLines = [];
  120386. this._structs = {};
  120387. this._functions = {};
  120388. this._vertexShaderParts = {
  120389. defineLines: [],
  120390. uniformLines: [],
  120391. shaderLines: [],
  120392. varyingLines: [],
  120393. structIds: [],
  120394. functionIds: []
  120395. };
  120396. this._fragmentShaderParts = {
  120397. defineLines: [],
  120398. uniformLines: [],
  120399. shaderLines: [],
  120400. varyingLines: [],
  120401. structIds: [],
  120402. functionIds: []
  120403. };
  120404. }
  120405. Object.defineProperties(ShaderBuilder.prototype, {
  120406. attributeLocations: {
  120407. get: function() {
  120408. return this._attributeLocations;
  120409. }
  120410. }
  120411. });
  120412. ShaderBuilder.prototype.addDefine = function(identifier, value, destination) {
  120413. Check_default.typeOf.string("identifier", identifier);
  120414. destination = defaultValue_default(destination, ShaderDestination_default.BOTH);
  120415. let line = identifier;
  120416. if (defined_default(value)) {
  120417. line += ` ${value.toString()}`;
  120418. }
  120419. if (ShaderDestination_default.includesVertexShader(destination)) {
  120420. this._vertexShaderParts.defineLines.push(line);
  120421. }
  120422. if (ShaderDestination_default.includesFragmentShader(destination)) {
  120423. this._fragmentShaderParts.defineLines.push(line);
  120424. }
  120425. };
  120426. ShaderBuilder.prototype.addStruct = function(structId, structName, destination) {
  120427. Check_default.typeOf.string("structId", structId);
  120428. Check_default.typeOf.string("structName", structName);
  120429. Check_default.typeOf.number("destination", destination);
  120430. this._structs[structId] = new ShaderStruct(structName);
  120431. if (ShaderDestination_default.includesVertexShader(destination)) {
  120432. this._vertexShaderParts.structIds.push(structId);
  120433. }
  120434. if (ShaderDestination_default.includesFragmentShader(destination)) {
  120435. this._fragmentShaderParts.structIds.push(structId);
  120436. }
  120437. };
  120438. ShaderBuilder.prototype.addStructField = function(structId, type, identifier) {
  120439. Check_default.typeOf.string("structId", structId);
  120440. Check_default.typeOf.string("type", type);
  120441. Check_default.typeOf.string("identifier", identifier);
  120442. this._structs[structId].addField(type, identifier);
  120443. };
  120444. ShaderBuilder.prototype.addFunction = function(functionName, signature, destination) {
  120445. Check_default.typeOf.string("functionName", functionName);
  120446. Check_default.typeOf.string("signature", signature);
  120447. Check_default.typeOf.number("destination", destination);
  120448. this._functions[functionName] = new ShaderFunction(signature);
  120449. if (ShaderDestination_default.includesVertexShader(destination)) {
  120450. this._vertexShaderParts.functionIds.push(functionName);
  120451. }
  120452. if (ShaderDestination_default.includesFragmentShader(destination)) {
  120453. this._fragmentShaderParts.functionIds.push(functionName);
  120454. }
  120455. };
  120456. ShaderBuilder.prototype.addFunctionLines = function(functionName, lines) {
  120457. Check_default.typeOf.string("functionName", functionName);
  120458. Check_default.typeOf.object("lines", lines);
  120459. this._functions[functionName].addLines(lines);
  120460. };
  120461. ShaderBuilder.prototype.addUniform = function(type, identifier, destination) {
  120462. Check_default.typeOf.string("type", type);
  120463. Check_default.typeOf.string("identifier", identifier);
  120464. destination = defaultValue_default(destination, ShaderDestination_default.BOTH);
  120465. const line = `uniform ${type} ${identifier};`;
  120466. if (ShaderDestination_default.includesVertexShader(destination)) {
  120467. this._vertexShaderParts.uniformLines.push(line);
  120468. }
  120469. if (ShaderDestination_default.includesFragmentShader(destination)) {
  120470. this._fragmentShaderParts.uniformLines.push(line);
  120471. }
  120472. };
  120473. ShaderBuilder.prototype.setPositionAttribute = function(type, identifier) {
  120474. Check_default.typeOf.string("type", type);
  120475. Check_default.typeOf.string("identifier", identifier);
  120476. if (defined_default(this._positionAttributeLine)) {
  120477. throw new DeveloperError_default(
  120478. "setPositionAttribute() must be called exactly once for the attribute used for gl_Position. For other attributes, use addAttribute()"
  120479. );
  120480. }
  120481. this._positionAttributeLine = `attribute ${type} ${identifier};`;
  120482. this._attributeLocations[identifier] = 0;
  120483. return 0;
  120484. };
  120485. ShaderBuilder.prototype.addAttribute = function(type, identifier) {
  120486. Check_default.typeOf.string("type", type);
  120487. Check_default.typeOf.string("identifier", identifier);
  120488. const line = `attribute ${type} ${identifier};`;
  120489. this._attributeLines.push(line);
  120490. const location2 = this._nextAttributeLocation;
  120491. this._attributeLocations[identifier] = location2;
  120492. this._nextAttributeLocation += getAttributeLocationCount(type);
  120493. return location2;
  120494. };
  120495. ShaderBuilder.prototype.addVarying = function(type, identifier) {
  120496. Check_default.typeOf.string("type", type);
  120497. Check_default.typeOf.string("identifier", identifier);
  120498. const line = `varying ${type} ${identifier};`;
  120499. this._vertexShaderParts.varyingLines.push(line);
  120500. this._fragmentShaderParts.varyingLines.push(line);
  120501. };
  120502. ShaderBuilder.prototype.addVertexLines = function(lines) {
  120503. Check_default.typeOf.object("lines", lines);
  120504. Array.prototype.push.apply(this._vertexShaderParts.shaderLines, lines);
  120505. };
  120506. ShaderBuilder.prototype.addFragmentLines = function(lines) {
  120507. Check_default.typeOf.object("lines", lines);
  120508. Array.prototype.push.apply(this._fragmentShaderParts.shaderLines, lines);
  120509. };
  120510. ShaderBuilder.prototype.buildShaderProgram = function(context) {
  120511. Check_default.typeOf.object("context", context);
  120512. const positionAttribute = defined_default(this._positionAttributeLine) ? [this._positionAttributeLine] : [];
  120513. const structLines = generateStructLines(this);
  120514. const functionLines = generateFunctionLines(this);
  120515. const vertexLines = positionAttribute.concat(
  120516. this._attributeLines,
  120517. this._vertexShaderParts.uniformLines,
  120518. this._vertexShaderParts.varyingLines,
  120519. structLines.vertexLines,
  120520. functionLines.vertexLines,
  120521. this._vertexShaderParts.shaderLines
  120522. ).join("\n");
  120523. const vertexShaderSource = new ShaderSource_default({
  120524. defines: this._vertexShaderParts.defineLines,
  120525. sources: [vertexLines]
  120526. });
  120527. const fragmentLines = this._fragmentShaderParts.uniformLines.concat(
  120528. this._fragmentShaderParts.varyingLines,
  120529. structLines.fragmentLines,
  120530. functionLines.fragmentLines,
  120531. this._fragmentShaderParts.shaderLines
  120532. ).join("\n");
  120533. const fragmentShaderSource = new ShaderSource_default({
  120534. defines: this._fragmentShaderParts.defineLines,
  120535. sources: [fragmentLines]
  120536. });
  120537. return ShaderProgram_default.fromCache({
  120538. context,
  120539. vertexShaderSource,
  120540. fragmentShaderSource,
  120541. attributeLocations: this._attributeLocations
  120542. });
  120543. };
  120544. ShaderBuilder.prototype.clone = function() {
  120545. return clone_default(this, true);
  120546. };
  120547. function generateStructLines(shaderBuilder) {
  120548. const vertexLines = [];
  120549. const fragmentLines = [];
  120550. let i2;
  120551. let structIds = shaderBuilder._vertexShaderParts.structIds;
  120552. let structId;
  120553. let struct;
  120554. let structLines;
  120555. for (i2 = 0; i2 < structIds.length; i2++) {
  120556. structId = structIds[i2];
  120557. struct = shaderBuilder._structs[structId];
  120558. structLines = struct.generateGlslLines();
  120559. vertexLines.push.apply(vertexLines, structLines);
  120560. }
  120561. structIds = shaderBuilder._fragmentShaderParts.structIds;
  120562. for (i2 = 0; i2 < structIds.length; i2++) {
  120563. structId = structIds[i2];
  120564. struct = shaderBuilder._structs[structId];
  120565. structLines = struct.generateGlslLines();
  120566. fragmentLines.push.apply(fragmentLines, structLines);
  120567. }
  120568. return {
  120569. vertexLines,
  120570. fragmentLines
  120571. };
  120572. }
  120573. function getAttributeLocationCount(glslType) {
  120574. switch (glslType) {
  120575. case "mat2":
  120576. return 2;
  120577. case "mat3":
  120578. return 3;
  120579. case "mat4":
  120580. return 4;
  120581. default:
  120582. return 1;
  120583. }
  120584. }
  120585. function generateFunctionLines(shaderBuilder) {
  120586. const vertexLines = [];
  120587. const fragmentLines = [];
  120588. let i2;
  120589. let functionIds = shaderBuilder._vertexShaderParts.functionIds;
  120590. let functionId;
  120591. let func;
  120592. let functionLines;
  120593. for (i2 = 0; i2 < functionIds.length; i2++) {
  120594. functionId = functionIds[i2];
  120595. func = shaderBuilder._functions[functionId];
  120596. functionLines = func.generateGlslLines();
  120597. vertexLines.push.apply(vertexLines, functionLines);
  120598. }
  120599. functionIds = shaderBuilder._fragmentShaderParts.functionIds;
  120600. for (i2 = 0; i2 < functionIds.length; i2++) {
  120601. functionId = functionIds[i2];
  120602. func = shaderBuilder._functions[functionId];
  120603. functionLines = func.generateGlslLines();
  120604. fragmentLines.push.apply(fragmentLines, functionLines);
  120605. }
  120606. return {
  120607. vertexLines,
  120608. fragmentLines
  120609. };
  120610. }
  120611. // node_modules/cesium/Source/Scene/ModelExperimental/ModelRenderResources.js
  120612. function ModelRenderResources(model) {
  120613. Check_default.typeOf.object("model", model);
  120614. this.shaderBuilder = new ShaderBuilder();
  120615. this.model = model;
  120616. this.uniformMap = {};
  120617. this.alphaOptions = new ModelAlphaOptions();
  120618. this.renderStateOptions = {};
  120619. }
  120620. // node_modules/cesium/Source/Shaders/ModelExperimental/ModelSplitterStageFS.js
  120621. var ModelSplitterStageFS_default = "void modelSplitterStage()\n{\n // Don't split when rendering the shadow map, because it is rendered from\n // the perspective of a totally different camera.\n#ifndef SHADOW_MAP\n if (model_splitDirection < 0.0 && gl_FragCoord.x > czm_splitPosition) discard;\n if (model_splitDirection > 0.0 && gl_FragCoord.x < czm_splitPosition) discard;\n#endif\n}\n";
  120622. // node_modules/cesium/Source/Scene/ModelExperimental/ModelSplitterPipelineStage.js
  120623. var ModelSplitterPipelineStage = {};
  120624. ModelSplitterPipelineStage.name = "ModelSplitterPipelineStage";
  120625. ModelSplitterPipelineStage.SPLIT_DIRECTION_UNIFORM_NAME = "model_splitDirection";
  120626. ModelSplitterPipelineStage.process = function(renderResources, model, frameState) {
  120627. const shaderBuilder = renderResources.shaderBuilder;
  120628. shaderBuilder.addDefine(
  120629. "HAS_MODEL_SPLITTER",
  120630. void 0,
  120631. ShaderDestination_default.FRAGMENT
  120632. );
  120633. shaderBuilder.addFragmentLines([ModelSplitterStageFS_default]);
  120634. const stageUniforms = {};
  120635. shaderBuilder.addUniform(
  120636. "float",
  120637. ModelSplitterPipelineStage.SPLIT_DIRECTION_UNIFORM_NAME,
  120638. ShaderDestination_default.FRAGMENT
  120639. );
  120640. stageUniforms[ModelSplitterPipelineStage.SPLIT_DIRECTION_UNIFORM_NAME] = function() {
  120641. return model.splitDirection;
  120642. };
  120643. renderResources.uniformMap = combine_default(
  120644. stageUniforms,
  120645. renderResources.uniformMap
  120646. );
  120647. };
  120648. var ModelSplitterPipelineStage_default = ModelSplitterPipelineStage;
  120649. // node_modules/cesium/Source/Scene/ModelExperimental/NodeRenderResources.js
  120650. function NodeRenderResources(modelRenderResources, runtimeNode) {
  120651. Check_default.typeOf.object("modelRenderResources", modelRenderResources);
  120652. Check_default.typeOf.object("runtimeNode", runtimeNode);
  120653. this.model = modelRenderResources.model;
  120654. this.shaderBuilder = modelRenderResources.shaderBuilder.clone();
  120655. this.uniformMap = clone_default(modelRenderResources.uniformMap);
  120656. this.alphaOptions = clone_default(modelRenderResources.alphaOptions);
  120657. this.renderStateOptions = clone_default(modelRenderResources.renderStateOptions);
  120658. this.runtimeNode = runtimeNode;
  120659. this.attributes = [];
  120660. this.attributeIndex = 1;
  120661. this.featureIdVertexAttributeSetIndex = 0;
  120662. this.instanceCount = 0;
  120663. this.instancingTranslationMax = void 0;
  120664. this.instancingTranslationMin = void 0;
  120665. }
  120666. // node_modules/cesium/Source/Scene/ModelExperimental/ModelLightingOptions.js
  120667. function ModelLightingOptions(options) {
  120668. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  120669. this.lightingModel = defaultValue_default(options.lightingModel, LightingModel_default.UNLIT);
  120670. }
  120671. // node_modules/cesium/Source/Scene/ModelExperimental/PrimitiveRenderResources.js
  120672. function PrimitiveRenderResources(nodeRenderResources, runtimePrimitive) {
  120673. Check_default.typeOf.object("nodeRenderResources", nodeRenderResources);
  120674. Check_default.typeOf.object("runtimePrimitive", runtimePrimitive);
  120675. this.model = nodeRenderResources.model;
  120676. this.runtimeNode = nodeRenderResources.runtimeNode;
  120677. this.attributes = nodeRenderResources.attributes.slice();
  120678. this.attributeIndex = nodeRenderResources.attributeIndex;
  120679. this.featureIdVertexAttributeSetIndex = nodeRenderResources.featureIdVertexAttributeSetIndex;
  120680. this.hasPropertyTable = false;
  120681. this.uniformMap = clone_default(nodeRenderResources.uniformMap);
  120682. this.alphaOptions = clone_default(nodeRenderResources.alphaOptions);
  120683. this.shaderBuilder = nodeRenderResources.shaderBuilder.clone();
  120684. this.instanceCount = nodeRenderResources.instanceCount;
  120685. this.runtimePrimitive = runtimePrimitive;
  120686. const primitive = runtimePrimitive.primitive;
  120687. this.count = defined_default(primitive.indices) ? primitive.indices.count : ModelExperimentalUtility.getAttributeBySemantic(primitive, "POSITION").count;
  120688. this.indices = primitive.indices;
  120689. this.primitiveType = primitive.primitiveType;
  120690. this.boundingSphere = ModelExperimentalUtility.createBoundingSphere(
  120691. primitive,
  120692. Matrix4_default.IDENTITY,
  120693. nodeRenderResources.instancingTranslationMax,
  120694. nodeRenderResources.instancingTranslationMin
  120695. );
  120696. this.lightingOptions = new ModelLightingOptions();
  120697. this.pickId = void 0;
  120698. this.renderStateOptions = combine_default(nodeRenderResources.renderStateOptions, {
  120699. depthTest: {
  120700. enabled: true,
  120701. func: DepthFunction_default.LESS_OR_EQUAL
  120702. },
  120703. blending: BlendingState_default.DISABLED
  120704. });
  120705. this.styleCommandsNeeded = void 0;
  120706. }
  120707. // node_modules/cesium/Source/Scene/ModelExperimental/ModelExperimentalSceneGraph.js
  120708. function ModelExperimentalSceneGraph(options) {
  120709. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  120710. const components = options.modelComponents;
  120711. Check_default.typeOf.object("options.model", options.model);
  120712. Check_default.typeOf.object("options.modelComponents", components);
  120713. this._model = options.model;
  120714. this._components = components;
  120715. this._pipelineStages = [];
  120716. this._updateStages = [];
  120717. this._runtimeNodes = [];
  120718. this._rootNodes = [];
  120719. this._skinnedNodes = [];
  120720. this._runtimeSkins = [];
  120721. this._drawCommands = [];
  120722. this.modelPipelineStages = [];
  120723. this._boundingSphere = void 0;
  120724. this._computedModelMatrix = Matrix4_default.clone(Matrix4_default.IDENTITY);
  120725. this._axisCorrectionMatrix = ModelExperimentalUtility.getAxisCorrectionMatrix(
  120726. components.upAxis,
  120727. components.forwardAxis,
  120728. new Matrix4_default()
  120729. );
  120730. initialize16(this);
  120731. }
  120732. Object.defineProperties(ModelExperimentalSceneGraph.prototype, {
  120733. components: {
  120734. get: function() {
  120735. return this._components;
  120736. }
  120737. },
  120738. computedModelMatrix: {
  120739. get: function() {
  120740. return this._computedModelMatrix;
  120741. }
  120742. },
  120743. axisCorrectionMatrix: {
  120744. get: function() {
  120745. return this._axisCorrectionMatrix;
  120746. }
  120747. },
  120748. boundingSphere: {
  120749. get: function() {
  120750. return this._boundingSphere;
  120751. }
  120752. }
  120753. });
  120754. function initialize16(sceneGraph) {
  120755. const components = sceneGraph._components;
  120756. const scene = components.scene;
  120757. computeModelMatrix(sceneGraph);
  120758. const nodes = components.nodes;
  120759. const nodesLength = nodes.length;
  120760. sceneGraph._runtimeNodes = new Array(nodesLength);
  120761. const rootNodes = scene.nodes;
  120762. const rootNodesLength = rootNodes.length;
  120763. const transformToRoot = Matrix4_default.IDENTITY;
  120764. for (let i2 = 0; i2 < rootNodesLength; i2++) {
  120765. const rootNode = scene.nodes[i2];
  120766. const rootNodeIndex = traverseSceneGraph(
  120767. sceneGraph,
  120768. rootNode,
  120769. transformToRoot
  120770. );
  120771. sceneGraph._rootNodes.push(rootNodeIndex);
  120772. }
  120773. const skins = components.skins;
  120774. const runtimeSkins = sceneGraph._runtimeSkins;
  120775. const skinsLength = skins.length;
  120776. for (let i2 = 0; i2 < skinsLength; i2++) {
  120777. const skin = skins[i2];
  120778. runtimeSkins.push(
  120779. new ModelExperimentalSkin({
  120780. skin,
  120781. sceneGraph
  120782. })
  120783. );
  120784. }
  120785. const skinnedNodes = sceneGraph._skinnedNodes;
  120786. const skinnedNodesLength = skinnedNodes.length;
  120787. for (let i2 = 0; i2 < skinnedNodesLength; i2++) {
  120788. const skinnedNodeIndex = skinnedNodes[i2];
  120789. const skinnedNode = sceneGraph._runtimeNodes[skinnedNodeIndex];
  120790. const skin = nodes[skinnedNodeIndex].skin;
  120791. const skinIndex = skin.index;
  120792. skinnedNode._runtimeSkin = runtimeSkins[skinIndex];
  120793. skinnedNode.updateJointMatrices();
  120794. }
  120795. }
  120796. function computeModelMatrix(sceneGraph) {
  120797. const components = sceneGraph._components;
  120798. const model = sceneGraph._model;
  120799. sceneGraph._computedModelMatrix = Matrix4_default.multiplyTransformation(
  120800. model.modelMatrix,
  120801. components.transform,
  120802. sceneGraph._computedModelMatrix
  120803. );
  120804. sceneGraph._computedModelMatrix = Matrix4_default.multiplyTransformation(
  120805. sceneGraph._computedModelMatrix,
  120806. sceneGraph._axisCorrectionMatrix,
  120807. sceneGraph._computedModelMatrix
  120808. );
  120809. sceneGraph._computedModelMatrix = Matrix4_default.multiplyByUniformScale(
  120810. sceneGraph._computedModelMatrix,
  120811. model.computedScale,
  120812. sceneGraph._computedModelMatrix
  120813. );
  120814. }
  120815. function traverseSceneGraph(sceneGraph, node, transformToRoot) {
  120816. const childrenIndices = [];
  120817. const transform4 = ModelExperimentalUtility.getNodeTransform(node);
  120818. const childrenLength = node.children.length;
  120819. for (let i2 = 0; i2 < childrenLength; i2++) {
  120820. const childNode = node.children[i2];
  120821. const childNodeTransformToRoot = Matrix4_default.multiplyTransformation(
  120822. transformToRoot,
  120823. transform4,
  120824. new Matrix4_default()
  120825. );
  120826. const childIndex = traverseSceneGraph(
  120827. sceneGraph,
  120828. childNode,
  120829. childNodeTransformToRoot
  120830. );
  120831. childrenIndices.push(childIndex);
  120832. }
  120833. const runtimeNode = new ModelExperimentalNode({
  120834. node,
  120835. transform: transform4,
  120836. transformToRoot,
  120837. children: childrenIndices,
  120838. sceneGraph
  120839. });
  120840. const primitivesLength = node.primitives.length;
  120841. for (let i2 = 0; i2 < primitivesLength; i2++) {
  120842. runtimeNode.runtimePrimitives.push(
  120843. new ModelExperimentalPrimitive({
  120844. primitive: node.primitives[i2],
  120845. node,
  120846. model: sceneGraph._model
  120847. })
  120848. );
  120849. }
  120850. const index2 = node.index;
  120851. sceneGraph._runtimeNodes[index2] = runtimeNode;
  120852. if (defined_default(node.skin)) {
  120853. sceneGraph._skinnedNodes.push(index2);
  120854. }
  120855. return index2;
  120856. }
  120857. ModelExperimentalSceneGraph.prototype.buildDrawCommands = function(frameState) {
  120858. const model = this._model;
  120859. const modelRenderResources = new ModelRenderResources(model);
  120860. this.configurePipeline();
  120861. const modelPipelineStages = this.modelPipelineStages;
  120862. let i2, j, k;
  120863. for (i2 = 0; i2 < modelPipelineStages.length; i2++) {
  120864. const modelPipelineStage = modelPipelineStages[i2];
  120865. modelPipelineStage.process(modelRenderResources, model, frameState);
  120866. }
  120867. const boundingSpheres = [];
  120868. for (i2 = 0; i2 < this._runtimeNodes.length; i2++) {
  120869. const runtimeNode = this._runtimeNodes[i2];
  120870. runtimeNode.configurePipeline();
  120871. const nodePipelineStages = runtimeNode.pipelineStages;
  120872. const nodeRenderResources = new NodeRenderResources(
  120873. modelRenderResources,
  120874. runtimeNode
  120875. );
  120876. for (j = 0; j < nodePipelineStages.length; j++) {
  120877. const nodePipelineStage = nodePipelineStages[j];
  120878. nodePipelineStage.process(
  120879. nodeRenderResources,
  120880. runtimeNode.node,
  120881. frameState
  120882. );
  120883. }
  120884. for (j = 0; j < runtimeNode.runtimePrimitives.length; j++) {
  120885. const runtimePrimitive = runtimeNode.runtimePrimitives[j];
  120886. runtimePrimitive.configurePipeline();
  120887. const primitivePipelineStages = runtimePrimitive.pipelineStages;
  120888. const primitiveRenderResources = new PrimitiveRenderResources(
  120889. nodeRenderResources,
  120890. runtimePrimitive
  120891. );
  120892. for (k = 0; k < primitivePipelineStages.length; k++) {
  120893. const primitivePipelineStage = primitivePipelineStages[k];
  120894. primitivePipelineStage.process(
  120895. primitiveRenderResources,
  120896. runtimePrimitive.primitive,
  120897. frameState
  120898. );
  120899. }
  120900. runtimePrimitive.boundingSphere = BoundingSphere_default.clone(
  120901. primitiveRenderResources.boundingSphere
  120902. );
  120903. boundingSpheres.push(runtimePrimitive.boundingSphere);
  120904. const drawCommands = buildDrawCommands(
  120905. primitiveRenderResources,
  120906. frameState
  120907. );
  120908. runtimePrimitive.drawCommands = drawCommands;
  120909. }
  120910. }
  120911. this._boundingSphere = BoundingSphere_default.fromBoundingSpheres(boundingSpheres);
  120912. model._boundingSphere = BoundingSphere_default.transform(
  120913. this._boundingSphere,
  120914. model.modelMatrix,
  120915. model._boundingSphere
  120916. );
  120917. model._initialRadius = model._boundingSphere.radius;
  120918. model._boundingSphere.radius *= model._clampedScale;
  120919. };
  120920. ModelExperimentalSceneGraph.prototype.configurePipeline = function() {
  120921. const modelPipelineStages = this.modelPipelineStages;
  120922. modelPipelineStages.length = 0;
  120923. const model = this._model;
  120924. if (defined_default(model.color)) {
  120925. modelPipelineStages.push(ModelColorPipelineStage_default);
  120926. }
  120927. if (model.imageBasedLighting.enabled) {
  120928. modelPipelineStages.push(ImageBasedLightingPipelineStage_default);
  120929. }
  120930. if (model.isClippingEnabled()) {
  120931. modelPipelineStages.push(ModelClippingPlanesPipelineStage_default);
  120932. }
  120933. if (defined_default(model.splitDirection) && model.splitDirection !== SplitDirection_default.NONE) {
  120934. modelPipelineStages.push(ModelSplitterPipelineStage_default);
  120935. }
  120936. };
  120937. ModelExperimentalSceneGraph.prototype.update = function(frameState, updateForAnimations) {
  120938. let i2, j, k;
  120939. for (i2 = 0; i2 < this._runtimeNodes.length; i2++) {
  120940. const runtimeNode = this._runtimeNodes[i2];
  120941. for (j = 0; j < runtimeNode.updateStages.length; j++) {
  120942. const nodeUpdateStage = runtimeNode.updateStages[j];
  120943. nodeUpdateStage.update(runtimeNode, this, frameState);
  120944. }
  120945. if (updateForAnimations) {
  120946. this.updateJointMatrices();
  120947. }
  120948. for (j = 0; j < runtimeNode.runtimePrimitives.length; j++) {
  120949. const runtimePrimitive = runtimeNode.runtimePrimitives[j];
  120950. for (k = 0; k < runtimePrimitive.updateStages.length; k++) {
  120951. const stage = runtimePrimitive.updateStages[k];
  120952. stage.update(runtimePrimitive);
  120953. }
  120954. }
  120955. }
  120956. };
  120957. ModelExperimentalSceneGraph.prototype.updateModelMatrix = function() {
  120958. computeModelMatrix(this);
  120959. const rootNodes = this._rootNodes;
  120960. for (let i2 = 0; i2 < rootNodes.length; i2++) {
  120961. const node = this._runtimeNodes[rootNodes[i2]];
  120962. node._transformDirty = true;
  120963. }
  120964. };
  120965. ModelExperimentalSceneGraph.prototype.updateJointMatrices = function() {
  120966. const skinnedNodes = this._skinnedNodes;
  120967. const length3 = skinnedNodes.length;
  120968. for (let i2 = 0; i2 < length3; i2++) {
  120969. const nodeIndex = skinnedNodes[i2];
  120970. const runtimeNode = this._runtimeNodes[nodeIndex];
  120971. runtimeNode.updateJointMatrices();
  120972. }
  120973. };
  120974. function forEachRuntimePrimitive(sceneGraph, callback) {
  120975. for (let i2 = 0; i2 < sceneGraph._runtimeNodes.length; i2++) {
  120976. const runtimeNode = sceneGraph._runtimeNodes[i2];
  120977. for (let j = 0; j < runtimeNode.runtimePrimitives.length; j++) {
  120978. const runtimePrimitive = runtimeNode.runtimePrimitives[j];
  120979. callback(runtimePrimitive);
  120980. }
  120981. }
  120982. }
  120983. ModelExperimentalSceneGraph.prototype.updateBackFaceCulling = function(backFaceCulling) {
  120984. const model = this._model;
  120985. forEachRuntimePrimitive(this, function(runtimePrimitive) {
  120986. for (let k = 0; k < runtimePrimitive.drawCommands.length; k++) {
  120987. const drawCommand = runtimePrimitive.drawCommands[k];
  120988. const renderState = clone_default(drawCommand.renderState, true);
  120989. const doubleSided = runtimePrimitive.primitive.material.doubleSided;
  120990. const translucent = defined_default(model.color) && model.color.alpha < 1;
  120991. renderState.cull.enabled = backFaceCulling && !doubleSided && !translucent;
  120992. drawCommand.renderState = RenderState_default.fromCache(renderState);
  120993. }
  120994. });
  120995. };
  120996. ModelExperimentalSceneGraph.prototype.updateShadows = function(shadowMode) {
  120997. const model = this._model;
  120998. const castShadows = ShadowMode_default.castShadows(model.shadows);
  120999. const receiveShadows = ShadowMode_default.receiveShadows(model.shadows);
  121000. forEachRuntimePrimitive(this, function(runtimePrimitive) {
  121001. for (let k = 0; k < runtimePrimitive.drawCommands.length; k++) {
  121002. const drawCommand = runtimePrimitive.drawCommands[k];
  121003. drawCommand.castShadows = castShadows;
  121004. drawCommand.receiveShadows = receiveShadows;
  121005. }
  121006. });
  121007. };
  121008. ModelExperimentalSceneGraph.prototype.getDrawCommands = function() {
  121009. const drawCommands = [];
  121010. forEachRuntimePrimitive(this, function(runtimePrimitive) {
  121011. drawCommands.push.apply(drawCommands, runtimePrimitive.drawCommands);
  121012. });
  121013. return drawCommands;
  121014. };
  121015. // node_modules/cesium/Source/Scene/ModelExperimental/ModelFeature.js
  121016. function ModelFeature(options) {
  121017. this._model = options.model;
  121018. this._featureTable = options.featureTable;
  121019. this._featureId = options.featureId;
  121020. this._color = void 0;
  121021. }
  121022. Object.defineProperties(ModelFeature.prototype, {
  121023. show: {
  121024. get: function() {
  121025. return this._featureTable.getShow(this._featureId);
  121026. },
  121027. set: function(value) {
  121028. this._featureTable.setShow(this._featureId, value);
  121029. }
  121030. },
  121031. color: {
  121032. get: function() {
  121033. if (!defined_default(this._color)) {
  121034. this._color = new Color_default();
  121035. }
  121036. return this._featureTable.getColor(this._featureId, this._color);
  121037. },
  121038. set: function(value) {
  121039. this._featureTable.setColor(this._featureId, value);
  121040. }
  121041. },
  121042. primitive: {
  121043. get: function() {
  121044. return this._model;
  121045. }
  121046. },
  121047. featureTable: {
  121048. get: function() {
  121049. return this._featureTable;
  121050. }
  121051. },
  121052. featureId: {
  121053. get: function() {
  121054. return this._featureId;
  121055. }
  121056. }
  121057. });
  121058. ModelFeature.prototype.hasProperty = function(name) {
  121059. return this._featureTable.hasProperty(this._featureId, name);
  121060. };
  121061. ModelFeature.prototype.getProperty = function(name) {
  121062. return this._featureTable.getProperty(this._featureId, name);
  121063. };
  121064. ModelFeature.prototype.getPropertyInherited = function(name) {
  121065. if (this._featureTable.hasPropertyBySemantic(this._featureId, name)) {
  121066. return this._featureTable.getPropertyBySemantic(this._featureId, name);
  121067. }
  121068. return this._featureTable.getProperty(this._featureId, name);
  121069. };
  121070. ModelFeature.prototype.getPropertyNames = function(results) {
  121071. return this._featureTable.getPropertyNames(results);
  121072. };
  121073. ModelFeature.prototype.setProperty = function(name, value) {
  121074. return this._featureTable.setProperty(this._featureId, name, value);
  121075. };
  121076. // node_modules/cesium/Source/Scene/ModelExperimental/ModelFeatureTable.js
  121077. function ModelFeatureTable(options) {
  121078. const model = options.model;
  121079. const propertyTable = options.propertyTable;
  121080. Check_default.typeOf.object("propertyTable", propertyTable);
  121081. Check_default.typeOf.object("model", model);
  121082. this._propertyTable = propertyTable;
  121083. this._model = model;
  121084. this._features = void 0;
  121085. this._featuresLength = 0;
  121086. this._batchTexture = void 0;
  121087. this._styleCommandsNeededDirty = false;
  121088. this._styleCommandsNeeded = StyleCommandsNeeded_default.ALL_OPAQUE;
  121089. initialize17(this);
  121090. }
  121091. Object.defineProperties(ModelFeatureTable.prototype, {
  121092. batchTexture: {
  121093. get: function() {
  121094. return this._batchTexture;
  121095. }
  121096. },
  121097. featuresLength: {
  121098. get: function() {
  121099. return this._featuresLength;
  121100. }
  121101. },
  121102. styleCommandsNeededDirty: {
  121103. get: function() {
  121104. return this._styleCommandsNeededDirty;
  121105. }
  121106. }
  121107. });
  121108. function initialize17(modelFeatureTable) {
  121109. const model = modelFeatureTable._model;
  121110. const is3DTiles = ModelExperimentalType_default.is3DTiles(model.type);
  121111. const featuresLength = modelFeatureTable._propertyTable.count;
  121112. if (featuresLength === 0) {
  121113. return;
  121114. }
  121115. let i2;
  121116. const features = new Array(featuresLength);
  121117. if (is3DTiles) {
  121118. const content = model.content;
  121119. for (i2 = 0; i2 < featuresLength; i2++) {
  121120. features[i2] = new Cesium3DTileFeature_default(content, i2);
  121121. }
  121122. } else {
  121123. for (i2 = 0; i2 < featuresLength; i2++) {
  121124. features[i2] = new ModelFeature({
  121125. model,
  121126. featureId: i2,
  121127. featureTable: modelFeatureTable
  121128. });
  121129. }
  121130. }
  121131. modelFeatureTable._features = features;
  121132. modelFeatureTable._featuresLength = featuresLength;
  121133. modelFeatureTable._batchTexture = new BatchTexture({
  121134. featuresLength,
  121135. owner: modelFeatureTable,
  121136. statistics: is3DTiles ? model.content.tileset.statistics : modelFeatureTable._statistics
  121137. });
  121138. }
  121139. ModelFeatureTable.prototype.update = function(frameState) {
  121140. this._styleCommandsNeededDirty = false;
  121141. this._batchTexture.update(void 0, frameState);
  121142. const currentStyleCommandsNeeded = StyleCommandsNeeded_default.getStyleCommandsNeeded(
  121143. this._featuresLength,
  121144. this._batchTexture.translucentFeaturesLength
  121145. );
  121146. if (this._styleCommandsNeeded !== currentStyleCommandsNeeded) {
  121147. this._styleCommandsNeededDirty = true;
  121148. this._styleCommandsNeeded = currentStyleCommandsNeeded;
  121149. }
  121150. };
  121151. ModelFeatureTable.prototype.setShow = function(featureId, show) {
  121152. this._batchTexture.setShow(featureId, show);
  121153. };
  121154. ModelFeatureTable.prototype.setAllShow = function(show) {
  121155. this._batchTexture.setAllShow(show);
  121156. };
  121157. ModelFeatureTable.prototype.getShow = function(featureId) {
  121158. return this._batchTexture.getShow(featureId);
  121159. };
  121160. ModelFeatureTable.prototype.setColor = function(featureId, color) {
  121161. this._batchTexture.setColor(featureId, color);
  121162. };
  121163. ModelFeatureTable.prototype.setAllColor = function(color) {
  121164. this._batchTexture.setAllColor(color);
  121165. };
  121166. ModelFeatureTable.prototype.getColor = function(featureId, result) {
  121167. return this._batchTexture.getColor(featureId, result);
  121168. };
  121169. ModelFeatureTable.prototype.getPickColor = function(featureId) {
  121170. return this._batchTexture.getPickColor(featureId);
  121171. };
  121172. ModelFeatureTable.prototype.getFeature = function(featureId) {
  121173. return this._features[featureId];
  121174. };
  121175. ModelFeatureTable.prototype.hasProperty = function(featureId, propertyName) {
  121176. return this._propertyTable.hasProperty(featureId, propertyName);
  121177. };
  121178. ModelFeatureTable.prototype.hasPropertyBySemantic = function(featureId, propertyName) {
  121179. return this._propertyTable.hasPropertyBySemantic(featureId, propertyName);
  121180. };
  121181. ModelFeatureTable.prototype.getProperty = function(featureId, name) {
  121182. return this._propertyTable.getProperty(featureId, name);
  121183. };
  121184. ModelFeatureTable.prototype.getPropertyBySemantic = function(featureId, semantic) {
  121185. return this._propertyTable.getPropertyBySemantic(featureId, semantic);
  121186. };
  121187. ModelFeatureTable.prototype.getPropertyNames = function(results) {
  121188. return this._propertyTable.getPropertyIds(results);
  121189. };
  121190. ModelFeatureTable.prototype.setProperty = function(featureId, name, value) {
  121191. return this._propertyTable.setProperty(featureId, name, value);
  121192. };
  121193. var scratchColor11 = new Color_default();
  121194. ModelFeatureTable.prototype.applyStyle = function(style) {
  121195. if (!defined_default(style)) {
  121196. this.setAllColor(BatchTexture.DEFAULT_COLOR_VALUE);
  121197. this.setAllShow(BatchTexture.DEFAULT_SHOW_VALUE);
  121198. return;
  121199. }
  121200. for (let i2 = 0; i2 < this._featuresLength; i2++) {
  121201. const feature2 = this.getFeature(i2);
  121202. const color = defined_default(style.color) ? defaultValue_default(
  121203. style.color.evaluateColor(feature2, scratchColor11),
  121204. BatchTexture.DEFAULT_COLOR_VALUE
  121205. ) : BatchTexture.DEFAULT_COLOR_VALUE;
  121206. const show = defined_default(style.show) ? defaultValue_default(
  121207. style.show.evaluate(feature2),
  121208. BatchTexture.DEFAULT_SHOW_VALUE
  121209. ) : BatchTexture.DEFAULT_SHOW_VALUE;
  121210. this.setColor(i2, color);
  121211. this.setShow(i2, show);
  121212. }
  121213. };
  121214. ModelFeatureTable.prototype.isDestroyed = function() {
  121215. return false;
  121216. };
  121217. ModelFeatureTable.prototype.destroy = function(frameState) {
  121218. this._batchTexture.destroy();
  121219. destroyObject_default(this);
  121220. };
  121221. // node_modules/cesium/Source/Scene/JsonMetadataTable.js
  121222. var emptyClass = {};
  121223. function JsonMetadataTable(options) {
  121224. Check_default.typeOf.number.greaterThan("options.count", options.count, 0);
  121225. Check_default.typeOf.object("options.properties", options.properties);
  121226. this._count = options.count;
  121227. this._properties = clone_default(options.properties, true);
  121228. }
  121229. JsonMetadataTable.prototype.hasProperty = function(propertyId) {
  121230. return MetadataEntity_default.hasProperty(propertyId, this._properties, emptyClass);
  121231. };
  121232. JsonMetadataTable.prototype.getPropertyIds = function(results) {
  121233. return MetadataEntity_default.getPropertyIds(this._properties, emptyClass, results);
  121234. };
  121235. JsonMetadataTable.prototype.getProperty = function(index2, propertyId) {
  121236. Check_default.typeOf.number("index", index2);
  121237. Check_default.typeOf.string("propertyId", propertyId);
  121238. if (index2 < 0 || index2 >= this._count) {
  121239. throw new DeveloperError_default(`index must be in the range [0, ${this._count})`);
  121240. }
  121241. const property = this._properties[propertyId];
  121242. if (defined_default(property)) {
  121243. return clone_default(property[index2], true);
  121244. }
  121245. return void 0;
  121246. };
  121247. JsonMetadataTable.prototype.setProperty = function(index2, propertyId, value) {
  121248. Check_default.typeOf.number("index", index2);
  121249. Check_default.typeOf.string("propertyId", propertyId);
  121250. if (index2 < 0 || index2 >= this._count) {
  121251. throw new DeveloperError_default(`index must be in the range [0, ${this._count})`);
  121252. }
  121253. const property = this._properties[propertyId];
  121254. if (defined_default(property)) {
  121255. property[index2] = clone_default(value, true);
  121256. return true;
  121257. }
  121258. return false;
  121259. };
  121260. // node_modules/cesium/Source/Scene/parseBatchTable.js
  121261. function parseBatchTable(options) {
  121262. Check_default.typeOf.number("options.count", options.count);
  121263. Check_default.typeOf.object("options.batchTable", options.batchTable);
  121264. const featureCount = options.count;
  121265. const batchTable = options.batchTable;
  121266. const binaryBody = options.binaryBody;
  121267. const partitionResults = partitionProperties(batchTable);
  121268. const jsonMetadataTable = new JsonMetadataTable({
  121269. count: featureCount,
  121270. properties: partitionResults.jsonProperties
  121271. });
  121272. const hierarchy = initializeHierarchy2(partitionResults.hierarchy, binaryBody);
  121273. const className = MetadataClass_default.BATCH_TABLE_CLASS_NAME;
  121274. const binaryResults = transcodeBinaryProperties(
  121275. featureCount,
  121276. className,
  121277. partitionResults.binaryProperties,
  121278. binaryBody
  121279. );
  121280. const featureTableJson = binaryResults.featureTableJson;
  121281. const metadataTable = new MetadataTable_default({
  121282. count: featureTableJson.count,
  121283. properties: featureTableJson.properties,
  121284. class: binaryResults.transcodedClass,
  121285. bufferViews: binaryResults.bufferViewsU8
  121286. });
  121287. const propertyTable = new PropertyTable_default({
  121288. id: 0,
  121289. name: "Batch Table",
  121290. count: featureTableJson.count,
  121291. metadataTable,
  121292. jsonMetadataTable,
  121293. batchTableHierarchy: hierarchy
  121294. });
  121295. return new StructuralMetadata_default({
  121296. schema: binaryResults.transcodedSchema,
  121297. propertyTables: [propertyTable],
  121298. extensions: partitionResults.extensions,
  121299. extras: partitionResults.extras
  121300. });
  121301. }
  121302. function partitionProperties(batchTable) {
  121303. const legacyHierarchy = batchTable.HIERARCHY;
  121304. const extras = batchTable.extras;
  121305. const extensions = batchTable.extensions;
  121306. let hierarchyExtension;
  121307. if (defined_default(legacyHierarchy)) {
  121308. parseBatchTable._deprecationWarning(
  121309. "batchTableHierarchyExtension",
  121310. "The batch table HIERARCHY property has been moved to an extension. Use extensions.3DTILES_batch_table_hierarchy instead."
  121311. );
  121312. hierarchyExtension = legacyHierarchy;
  121313. } else if (defined_default(extensions)) {
  121314. hierarchyExtension = extensions["3DTILES_batch_table_hierarchy"];
  121315. }
  121316. const jsonProperties = {};
  121317. const binaryProperties = {};
  121318. for (const propertyId in batchTable) {
  121319. if (!batchTable.hasOwnProperty(propertyId) || propertyId === "HIERARCHY" || propertyId === "extensions" || propertyId === "extras") {
  121320. continue;
  121321. }
  121322. const property = batchTable[propertyId];
  121323. if (Array.isArray(property)) {
  121324. jsonProperties[propertyId] = property;
  121325. } else {
  121326. binaryProperties[propertyId] = property;
  121327. }
  121328. }
  121329. return {
  121330. binaryProperties,
  121331. jsonProperties,
  121332. hierarchy: hierarchyExtension,
  121333. extras,
  121334. extensions
  121335. };
  121336. }
  121337. function transcodeBinaryProperties(featureCount, className, binaryProperties, binaryBody) {
  121338. const classProperties = {};
  121339. const featureTableProperties = {};
  121340. const bufferViewsU8 = {};
  121341. let bufferViewCount = 0;
  121342. for (const propertyId in binaryProperties) {
  121343. if (!binaryProperties.hasOwnProperty(propertyId)) {
  121344. continue;
  121345. }
  121346. if (!defined_default(binaryBody)) {
  121347. throw new RuntimeError_default(
  121348. `Property ${propertyId} requires a batch table binary.`
  121349. );
  121350. }
  121351. const property = binaryProperties[propertyId];
  121352. const binaryAccessor = getBinaryAccessor_default(property);
  121353. featureTableProperties[propertyId] = {
  121354. bufferView: bufferViewCount
  121355. };
  121356. classProperties[propertyId] = transcodePropertyType(property);
  121357. bufferViewsU8[bufferViewCount] = binaryAccessor.createArrayBufferView(
  121358. binaryBody.buffer,
  121359. binaryBody.byteOffset + property.byteOffset,
  121360. featureCount
  121361. );
  121362. bufferViewCount++;
  121363. }
  121364. const schemaJson = {
  121365. classes: {}
  121366. };
  121367. schemaJson.classes[className] = {
  121368. properties: classProperties
  121369. };
  121370. const transcodedSchema = new MetadataSchema_default(schemaJson);
  121371. const featureTableJson = {
  121372. class: className,
  121373. count: featureCount,
  121374. properties: featureTableProperties
  121375. };
  121376. return {
  121377. featureTableJson,
  121378. bufferViewsU8,
  121379. transcodedSchema,
  121380. transcodedClass: transcodedSchema.classes[className]
  121381. };
  121382. }
  121383. function transcodePropertyType(property) {
  121384. const componentType = transcodeComponentType(property.componentType);
  121385. return {
  121386. type: property.type,
  121387. componentType
  121388. };
  121389. }
  121390. function transcodeComponentType(componentType) {
  121391. switch (componentType) {
  121392. case "BYTE":
  121393. return "INT8";
  121394. case "UNSIGNED_BYTE":
  121395. return "UINT8";
  121396. case "SHORT":
  121397. return "INT16";
  121398. case "UNSIGNED_SHORT":
  121399. return "UINT16";
  121400. case "INT":
  121401. return "INT32";
  121402. case "UNSIGNED_INT":
  121403. return "UINT32";
  121404. case "FLOAT":
  121405. return "FLOAT32";
  121406. case "DOUBLE":
  121407. return "FLOAT64";
  121408. }
  121409. }
  121410. function initializeHierarchy2(hierarchyExtension, binaryBody) {
  121411. if (defined_default(hierarchyExtension)) {
  121412. return new BatchTableHierarchy({
  121413. extension: hierarchyExtension,
  121414. binaryBody
  121415. });
  121416. }
  121417. return void 0;
  121418. }
  121419. parseBatchTable._deprecationWarning = deprecationWarning_default;
  121420. // node_modules/cesium/Source/Scene/ModelExperimental/B3dmLoader.js
  121421. var B3dmLoaderState = {
  121422. UNLOADED: 0,
  121423. LOADING: 1,
  121424. PROCESSING: 2,
  121425. READY: 3,
  121426. FAILED: 4
  121427. };
  121428. var FeatureIdAttribute3 = ModelComponents_default.FeatureIdAttribute;
  121429. function B3dmLoader(options) {
  121430. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  121431. const b3dmResource = options.b3dmResource;
  121432. let baseResource2 = options.baseResource;
  121433. const arrayBuffer = options.arrayBuffer;
  121434. const byteOffset = defaultValue_default(options.byteOffset, 0);
  121435. const releaseGltfJson = defaultValue_default(options.releaseGltfJson, false);
  121436. const asynchronous = defaultValue_default(options.asynchronous, true);
  121437. const incrementallyLoadTextures = defaultValue_default(
  121438. options.incrementallyLoadTextures,
  121439. true
  121440. );
  121441. const upAxis = defaultValue_default(options.upAxis, Axis_default.Y);
  121442. const forwardAxis = defaultValue_default(options.forwardAxis, Axis_default.X);
  121443. const loadAsTypedArray = defaultValue_default(options.loadAsTypedArray, false);
  121444. Check_default.typeOf.object("options.b3dmResource", b3dmResource);
  121445. Check_default.typeOf.object("options.arrayBuffer", arrayBuffer);
  121446. baseResource2 = defined_default(baseResource2) ? baseResource2 : b3dmResource.clone();
  121447. this._b3dmResource = b3dmResource;
  121448. this._baseResource = baseResource2;
  121449. this._arrayBuffer = arrayBuffer;
  121450. this._byteOffset = byteOffset;
  121451. this._releaseGltfJson = releaseGltfJson;
  121452. this._asynchronous = asynchronous;
  121453. this._incrementallyLoadTextures = incrementallyLoadTextures;
  121454. this._upAxis = upAxis;
  121455. this._forwardAxis = forwardAxis;
  121456. this._loadAsTypedArray = loadAsTypedArray;
  121457. this._state = B3dmLoaderState.UNLOADED;
  121458. this._promise = defer_default();
  121459. this._gltfLoader = void 0;
  121460. this._batchLength = 0;
  121461. this._propertyTable = void 0;
  121462. this._batchTable = void 0;
  121463. this._components = void 0;
  121464. this._transform = Matrix4_default.IDENTITY;
  121465. }
  121466. if (defined_default(Object.create)) {
  121467. B3dmLoader.prototype = Object.create(ResourceLoader.prototype);
  121468. B3dmLoader.prototype.constructor = B3dmLoader;
  121469. }
  121470. Object.defineProperties(B3dmLoader.prototype, {
  121471. promise: {
  121472. get: function() {
  121473. return this._promise.promise;
  121474. }
  121475. },
  121476. texturesLoadedPromise: {
  121477. get: function() {
  121478. return this._gltfLoader.texturesLoadedPromise;
  121479. }
  121480. },
  121481. cacheKey: {
  121482. get: function() {
  121483. return void 0;
  121484. }
  121485. },
  121486. components: {
  121487. get: function() {
  121488. return this._components;
  121489. }
  121490. }
  121491. });
  121492. B3dmLoader.prototype.load = function() {
  121493. const b3dm = B3dmParser_default.parse(this._arrayBuffer, this._byteOffset);
  121494. let batchLength = b3dm.batchLength;
  121495. const featureTableJson = b3dm.featureTableJson;
  121496. const featureTableBinary = b3dm.featureTableBinary;
  121497. const batchTableJson = b3dm.batchTableJson;
  121498. const batchTableBinary = b3dm.batchTableBinary;
  121499. const featureTable = new Cesium3DTileFeatureTable_default(
  121500. featureTableJson,
  121501. featureTableBinary
  121502. );
  121503. batchLength = featureTable.getGlobalProperty("BATCH_LENGTH");
  121504. this._batchLength = batchLength;
  121505. const rtcCenter = featureTable.getGlobalProperty(
  121506. "RTC_CENTER",
  121507. ComponentDatatype_default.FLOAT,
  121508. 3
  121509. );
  121510. if (defined_default(rtcCenter)) {
  121511. this._transform = Matrix4_default.fromTranslation(Cartesian3_default.fromArray(rtcCenter));
  121512. }
  121513. this._batchTable = {
  121514. json: batchTableJson,
  121515. binary: batchTableBinary
  121516. };
  121517. const gltfLoader = new GltfLoader({
  121518. typedArray: b3dm.gltf,
  121519. upAxis: this._upAxis,
  121520. forwardAxis: this._forwardAxis,
  121521. gltfResource: this._b3dmResource,
  121522. baseResource: this._baseResource,
  121523. releaseGltfJson: this._releaseGltfJson,
  121524. incrementallyLoadTextures: this._incrementallyLoadTextures,
  121525. loadAsTypedArray: this._loadAsTypedArray,
  121526. renameBatchIdSemantic: true
  121527. });
  121528. this._gltfLoader = gltfLoader;
  121529. this._state = B3dmLoaderState.LOADING;
  121530. const that = this;
  121531. gltfLoader.load();
  121532. gltfLoader.promise.then(function() {
  121533. if (that.isDestroyed()) {
  121534. return;
  121535. }
  121536. const components = gltfLoader.components;
  121537. components.transform = that._transform;
  121538. createStructuralMetadata(that, components);
  121539. that._components = components;
  121540. that._state = B3dmLoaderState.READY;
  121541. that._promise.resolve(that);
  121542. }).catch(function(error) {
  121543. if (that.isDestroyed()) {
  121544. return;
  121545. }
  121546. handleError7(that, error);
  121547. });
  121548. };
  121549. function handleError7(b3dmLoader, error) {
  121550. b3dmLoader.unload();
  121551. b3dmLoader._state = B3dmLoaderState.FAILED;
  121552. const errorMessage = "Failed to load b3dm";
  121553. error = b3dmLoader.getError(errorMessage, error);
  121554. b3dmLoader._promise.reject(error);
  121555. }
  121556. B3dmLoader.prototype.process = function(frameState) {
  121557. Check_default.typeOf.object("frameState", frameState);
  121558. if (this._state === B3dmLoaderState.LOADING) {
  121559. this._state = B3dmLoaderState.PROCESSING;
  121560. }
  121561. if (this._state === B3dmLoaderState.PROCESSING) {
  121562. this._gltfLoader.process(frameState);
  121563. }
  121564. };
  121565. function createStructuralMetadata(loader, components) {
  121566. const batchTable = loader._batchTable;
  121567. const batchLength = loader._batchLength;
  121568. if (batchLength === 0) {
  121569. return;
  121570. }
  121571. let structuralMetadata;
  121572. if (defined_default(batchTable.json)) {
  121573. structuralMetadata = parseBatchTable({
  121574. count: batchLength,
  121575. batchTable: batchTable.json,
  121576. binaryBody: batchTable.binary
  121577. });
  121578. } else {
  121579. const emptyPropertyTable = new PropertyTable_default({
  121580. name: MetadataClass_default.BATCH_TABLE_CLASS_NAME,
  121581. count: batchLength
  121582. });
  121583. structuralMetadata = new StructuralMetadata_default({
  121584. schema: {},
  121585. propertyTables: [emptyPropertyTable]
  121586. });
  121587. }
  121588. const nodes = components.scene.nodes;
  121589. const length3 = nodes.length;
  121590. for (let i2 = 0; i2 < length3; i2++) {
  121591. processNode(nodes[i2]);
  121592. }
  121593. components.structuralMetadata = structuralMetadata;
  121594. }
  121595. function processNode(node) {
  121596. const childrenLength = node.children.length;
  121597. for (let i2 = 0; i2 < childrenLength; i2++) {
  121598. processNode(node.children[i2]);
  121599. }
  121600. const primitivesLength = node.primitives.length;
  121601. for (let i2 = 0; i2 < primitivesLength; i2++) {
  121602. const primitive = node.primitives[i2];
  121603. const featureIdVertexAttribute = ModelExperimentalUtility.getAttributeBySemantic(
  121604. primitive,
  121605. VertexAttributeSemantic_default.FEATURE_ID
  121606. );
  121607. if (defined_default(featureIdVertexAttribute)) {
  121608. featureIdVertexAttribute.setIndex = 0;
  121609. const featureIdAttribute = new FeatureIdAttribute3();
  121610. featureIdAttribute.propertyTableId = 0;
  121611. featureIdAttribute.setIndex = 0;
  121612. featureIdAttribute.positionalLabel = "featureId_0";
  121613. primitive.featureIds.push(featureIdAttribute);
  121614. }
  121615. }
  121616. }
  121617. B3dmLoader.prototype.unload = function() {
  121618. if (defined_default(this._gltfLoader)) {
  121619. this._gltfLoader.unload();
  121620. }
  121621. this._components = void 0;
  121622. };
  121623. var B3dmLoader_default = B3dmLoader;
  121624. // node_modules/cesium/Source/Scene/ModelExperimental/PntsLoader.js
  121625. var Components3 = ModelComponents_default.Components;
  121626. var Scene3 = ModelComponents_default.Scene;
  121627. var Node6 = ModelComponents_default.Node;
  121628. var Primitive4 = ModelComponents_default.Primitive;
  121629. var Attribute3 = ModelComponents_default.Attribute;
  121630. var Quantization2 = ModelComponents_default.Quantization;
  121631. var FeatureIdAttribute4 = ModelComponents_default.FeatureIdAttribute;
  121632. var Material5 = ModelComponents_default.Material;
  121633. var MetallicRoughness4 = ModelComponents_default.MetallicRoughness;
  121634. function PntsLoader(options) {
  121635. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  121636. const arrayBuffer = options.arrayBuffer;
  121637. const byteOffset = defaultValue_default(options.byteOffset, 0);
  121638. Check_default.typeOf.object("options.arrayBuffer", arrayBuffer);
  121639. this._arrayBuffer = arrayBuffer;
  121640. this._byteOffset = byteOffset;
  121641. this._parsedContent = void 0;
  121642. this._decodePromise = void 0;
  121643. this._decodedAttributes = void 0;
  121644. this._promise = defer_default();
  121645. this._state = ResourceLoaderState_default.UNLOADED;
  121646. this._buffers = [];
  121647. this._components = void 0;
  121648. this._transform = Matrix4_default.IDENTITY;
  121649. }
  121650. if (defined_default(Object.create)) {
  121651. PntsLoader.prototype = Object.create(ResourceLoader.prototype);
  121652. PntsLoader.prototype.constructor = PntsLoader;
  121653. }
  121654. Object.defineProperties(PntsLoader.prototype, {
  121655. promise: {
  121656. get: function() {
  121657. return this._promise.promise;
  121658. }
  121659. },
  121660. cacheKey: {
  121661. get: function() {
  121662. return void 0;
  121663. }
  121664. },
  121665. components: {
  121666. get: function() {
  121667. return this._components;
  121668. }
  121669. },
  121670. transform: {
  121671. get: function() {
  121672. return this._transform;
  121673. }
  121674. }
  121675. });
  121676. PntsLoader.prototype.load = function() {
  121677. this._parsedContent = PntsParser_default.parse(this._arrayBuffer, this._byteOffset);
  121678. this._state = ResourceLoaderState_default.PROCESSING;
  121679. };
  121680. PntsLoader.prototype.process = function(frameState) {
  121681. if (this._state === ResourceLoaderState_default.PROCESSING) {
  121682. if (!defined_default(this._decodePromise)) {
  121683. decodeDraco2(this, frameState.context);
  121684. }
  121685. }
  121686. };
  121687. function decodeDraco2(loader, context) {
  121688. const parsedContent = loader._parsedContent;
  121689. const draco = parsedContent.draco;
  121690. let decodePromise;
  121691. if (!defined_default(draco)) {
  121692. decodePromise = Promise.resolve();
  121693. } else {
  121694. decodePromise = DracoLoader_default.decodePointCloud(draco, context);
  121695. }
  121696. if (!defined_default(decodePromise)) {
  121697. return;
  121698. }
  121699. loader._decodePromise = decodePromise;
  121700. decodePromise.then(function(decodeDracoResult) {
  121701. if (loader.isDestroyed()) {
  121702. return;
  121703. }
  121704. if (defined_default(decodeDracoResult)) {
  121705. processDracoAttributes(loader, draco, decodeDracoResult);
  121706. }
  121707. makeComponents(loader, context);
  121708. loader._state = ResourceLoaderState_default.READY;
  121709. loader._promise.resolve(loader);
  121710. }).catch(function(error) {
  121711. loader.unload();
  121712. loader._state = ResourceLoaderState_default.FAILED;
  121713. const errorMessage = "Failed to load Draco";
  121714. loader._promise.reject(loader.getError(errorMessage, error));
  121715. });
  121716. }
  121717. function processDracoAttributes(loader, draco, result) {
  121718. loader._state = ResourceLoaderState_default.READY;
  121719. const parsedContent = loader._parsedContent;
  121720. let attribute;
  121721. if (defined_default(result.POSITION)) {
  121722. attribute = {
  121723. name: "POSITION",
  121724. semantic: VertexAttributeSemantic_default.POSITION,
  121725. typedArray: result.POSITION.array,
  121726. componentDatatype: ComponentDatatype_default.FLOAT,
  121727. type: AttributeType_default.VEC3,
  121728. isQuantized: false
  121729. };
  121730. if (defined_default(result.POSITION.data.quantization)) {
  121731. const quantization = result.POSITION.data.quantization;
  121732. const range2 = quantization.range;
  121733. const quantizedVolumeScale = Cartesian3_default.fromElements(range2, range2, range2);
  121734. const quantizedVolumeOffset = Cartesian3_default.unpack(quantization.minValues);
  121735. const quantizedRange = (1 << quantization.quantizationBits) - 1;
  121736. attribute.isQuantized = true;
  121737. attribute.quantizedRange = quantizedRange;
  121738. attribute.quantizedVolumeOffset = quantizedVolumeOffset;
  121739. attribute.quantizedVolumeScale = quantizedVolumeScale;
  121740. attribute.quantizedComponentDatatype = ComponentDatatype_default.UNSIGNED_SHORT;
  121741. attribute.quantizedType = AttributeType_default.VEC3;
  121742. }
  121743. parsedContent.positions = attribute;
  121744. }
  121745. if (defined_default(result.NORMAL)) {
  121746. attribute = {
  121747. name: "NORMAL",
  121748. semantic: VertexAttributeSemantic_default.NORMAL,
  121749. typedArray: result.NORMAL.array,
  121750. componentDatatype: ComponentDatatype_default.FLOAT,
  121751. type: AttributeType_default.VEC3,
  121752. isQuantized: false,
  121753. octEncoded: false,
  121754. octEncodedZXY: false
  121755. };
  121756. if (defined_default(result.NORMAL.data.quantization)) {
  121757. const octEncodedRange = (1 << result.NORMAL.data.quantization.quantizationBits) - 1;
  121758. attribute.quantizedRange = octEncodedRange;
  121759. attribute.octEncoded = true;
  121760. attribute.octEncodedZXY = true;
  121761. attribute.quantizedComponentDatatype = ComponentDatatype_default.UNSIGNED_BYTE;
  121762. attribute.quantizedType = AttributeType_default.VEC2;
  121763. }
  121764. parsedContent.normals = attribute;
  121765. }
  121766. if (defined_default(result.RGBA)) {
  121767. parsedContent.colors = {
  121768. name: "COLOR",
  121769. semantic: VertexAttributeSemantic_default.COLOR,
  121770. setIndex: 0,
  121771. typedArray: result.RGBA.array,
  121772. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  121773. type: AttributeType_default.VEC4,
  121774. normalized: true,
  121775. isTranslucent: true
  121776. };
  121777. } else if (defined_default(result.RGB)) {
  121778. parsedContent.colors = {
  121779. name: "COLOR",
  121780. semantic: VertexAttributeSemantic_default.COLOR,
  121781. setIndex: 0,
  121782. typedArray: result.RGB.array,
  121783. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  121784. type: AttributeType_default.VEC3,
  121785. normalized: true,
  121786. isTranslucent: false
  121787. };
  121788. }
  121789. if (defined_default(result.BATCH_ID)) {
  121790. const batchIds = result.BATCH_ID.array;
  121791. parsedContent.batchIds = {
  121792. name: "_FEATURE_ID",
  121793. semantic: VertexAttributeSemantic_default.FEATURE_ID,
  121794. setIndex: 0,
  121795. typedArray: batchIds,
  121796. componentDatatype: ComponentDatatype_default.fromTypedArray(batchIds),
  121797. type: AttributeType_default.SCALAR
  121798. };
  121799. }
  121800. let styleableProperties = parsedContent.styleableProperties;
  121801. const batchTableProperties = draco.batchTableProperties;
  121802. for (const name in batchTableProperties) {
  121803. if (batchTableProperties.hasOwnProperty(name)) {
  121804. const property = result[name];
  121805. if (!defined_default(styleableProperties)) {
  121806. styleableProperties = {};
  121807. }
  121808. styleableProperties[name] = {
  121809. typedArray: property.array,
  121810. componentCount: property.data.componentsPerAttribute
  121811. };
  121812. }
  121813. }
  121814. parsedContent.styleableProperties = styleableProperties;
  121815. }
  121816. function makeAttribute(loader, attributeInfo, context) {
  121817. let typedArray = attributeInfo.typedArray;
  121818. let quantization;
  121819. if (attributeInfo.octEncoded) {
  121820. quantization = new Quantization2();
  121821. quantization.octEncoded = attributeInfo.octEncoded;
  121822. quantization.octEncodedZXY = attributeInfo.octEncodedZXY;
  121823. quantization.normalizationRange = attributeInfo.quantizedRange;
  121824. quantization.type = attributeInfo.quantizedType;
  121825. quantization.componentDatatype = attributeInfo.quantizedComponentDatatype;
  121826. }
  121827. if (attributeInfo.isQuantized) {
  121828. quantization = new Quantization2();
  121829. const normalizationRange = attributeInfo.quantizedRange;
  121830. quantization.normalizationRange = normalizationRange;
  121831. quantization.quantizedVolumeOffset = Cartesian3_default.ZERO;
  121832. const quantizedVolumeDimensions = attributeInfo.quantizedVolumeScale;
  121833. quantization.quantizedVolumeDimensions = quantizedVolumeDimensions;
  121834. quantization.quantizedVolumeStepSize = Cartesian3_default.divideByScalar(
  121835. quantizedVolumeDimensions,
  121836. normalizationRange,
  121837. new Cartesian3_default()
  121838. );
  121839. quantization.componentDatatype = attributeInfo.quantizedComponentDatatype;
  121840. quantization.type = attributeInfo.quantizedType;
  121841. }
  121842. const attribute = new Attribute3();
  121843. attribute.name = attributeInfo.name;
  121844. attribute.semantic = attributeInfo.semantic;
  121845. attribute.setIndex = attributeInfo.setIndex;
  121846. attribute.componentDatatype = attributeInfo.componentDatatype;
  121847. attribute.type = attributeInfo.type;
  121848. attribute.normalized = defaultValue_default(attributeInfo.normalized, false);
  121849. attribute.min = attributeInfo.min;
  121850. attribute.max = attributeInfo.max;
  121851. attribute.quantization = quantization;
  121852. if (attributeInfo.isRGB565) {
  121853. typedArray = AttributeCompression_default.decodeRGB565(typedArray);
  121854. }
  121855. if (defined_default(attributeInfo.constantColor)) {
  121856. const packedColor = new Array(4);
  121857. attribute.constant = Color_default.pack(attributeInfo.constantColor, packedColor);
  121858. } else {
  121859. const buffer = Buffer_default.createVertexBuffer({
  121860. typedArray,
  121861. context,
  121862. usage: BufferUsage_default.STATIC_DRAW
  121863. });
  121864. buffer.vertexArrayDestroyable = false;
  121865. loader._buffers.push(buffer);
  121866. attribute.buffer = buffer;
  121867. }
  121868. return attribute;
  121869. }
  121870. var randomNumberGenerator3;
  121871. var randomValues2;
  121872. function getRandomValues2(samplesLength) {
  121873. if (!defined_default(randomValues2)) {
  121874. randomNumberGenerator3 = new mersenneTwister(0);
  121875. randomValues2 = new Array(samplesLength);
  121876. for (let i2 = 0; i2 < samplesLength; ++i2) {
  121877. randomValues2[i2] = randomNumberGenerator3.random();
  121878. }
  121879. }
  121880. return randomValues2;
  121881. }
  121882. var scratchMin4 = new Cartesian3_default();
  121883. var scratchMax4 = new Cartesian3_default();
  121884. var scratchPosition11 = new Cartesian3_default();
  121885. function computeApproximateExtrema(positions) {
  121886. const positionsArray = positions.typedArray;
  121887. const maximumSamplesLength = 20;
  121888. const pointsLength = positionsArray.length / 3;
  121889. const samplesLength = Math.min(pointsLength, maximumSamplesLength);
  121890. const randomValues3 = getRandomValues2(maximumSamplesLength);
  121891. const maxValue = Number.MAX_VALUE;
  121892. const minValue = -Number.MAX_VALUE;
  121893. let min3 = Cartesian3_default.fromElements(maxValue, maxValue, maxValue, scratchMin4);
  121894. let max3 = Cartesian3_default.fromElements(minValue, minValue, minValue, scratchMax4);
  121895. let i2;
  121896. let index2;
  121897. let position;
  121898. if (positions.isQuantized) {
  121899. min3 = Cartesian3_default.ZERO;
  121900. max3 = positions.quantizedVolumeScale;
  121901. } else {
  121902. for (i2 = 0; i2 < samplesLength; ++i2) {
  121903. index2 = Math.floor(randomValues3[i2] * pointsLength);
  121904. position = Cartesian3_default.unpack(positionsArray, index2 * 3, scratchPosition11);
  121905. Cartesian3_default.minimumByComponent(min3, position, min3);
  121906. Cartesian3_default.maximumByComponent(max3, position, max3);
  121907. }
  121908. }
  121909. positions.min = Cartesian3_default.clone(min3);
  121910. positions.max = Cartesian3_default.clone(max3);
  121911. }
  121912. var defaultColorAttribute = {
  121913. name: VertexAttributeSemantic_default.COLOR,
  121914. semantic: VertexAttributeSemantic_default.COLOR,
  121915. setIndex: 0,
  121916. constantColor: Color_default.DARKGRAY,
  121917. componentDatatype: ComponentDatatype_default.FLOAT,
  121918. type: AttributeType_default.VEC4,
  121919. isQuantized: false,
  121920. isTranslucent: false
  121921. };
  121922. function makeAttributes(loader, parsedContent, context) {
  121923. const attributes = [];
  121924. let attribute;
  121925. const positions = parsedContent.positions;
  121926. if (defined_default(positions)) {
  121927. computeApproximateExtrema(positions);
  121928. attribute = makeAttribute(loader, positions, context);
  121929. attribute.count = parsedContent.pointsLength;
  121930. attributes.push(attribute);
  121931. }
  121932. if (defined_default(parsedContent.normals)) {
  121933. attribute = makeAttribute(loader, parsedContent.normals, context);
  121934. attributes.push(attribute);
  121935. }
  121936. if (defined_default(parsedContent.colors)) {
  121937. attribute = makeAttribute(loader, parsedContent.colors, context);
  121938. attributes.push(attribute);
  121939. } else {
  121940. attribute = makeAttribute(loader, defaultColorAttribute, context);
  121941. attributes.push(attribute);
  121942. }
  121943. if (defined_default(parsedContent.batchIds)) {
  121944. attribute = makeAttribute(loader, parsedContent.batchIds, context);
  121945. attributes.push(attribute);
  121946. }
  121947. return attributes;
  121948. }
  121949. function makeStructuralMetadata(parsedContent) {
  121950. const batchLength = parsedContent.batchLength;
  121951. const pointsLength = parsedContent.pointsLength;
  121952. const batchTableBinary = parsedContent.batchTableBinary;
  121953. if (defined_default(batchTableBinary)) {
  121954. const count = defaultValue_default(batchLength, pointsLength);
  121955. return parseBatchTable({
  121956. count,
  121957. batchTable: parsedContent.batchTableJson,
  121958. binaryBody: batchTableBinary
  121959. });
  121960. }
  121961. const emptyPropertyTable = new PropertyTable_default({
  121962. name: MetadataClass_default.BATCH_TABLE_CLASS_NAME,
  121963. count: pointsLength
  121964. });
  121965. return new StructuralMetadata_default({
  121966. schema: {},
  121967. propertyTables: [emptyPropertyTable]
  121968. });
  121969. }
  121970. function makeComponents(loader, context) {
  121971. const parsedContent = loader._parsedContent;
  121972. const metallicRoughness = new MetallicRoughness4();
  121973. metallicRoughness.metallicFactor = 0;
  121974. metallicRoughness.roughnessFactor = 0.9;
  121975. const material = new Material5();
  121976. material.metallicRoughness = metallicRoughness;
  121977. const colors = parsedContent.colors;
  121978. if (defined_default(colors) && colors.isTranslucent) {
  121979. material.alphaMode = AlphaMode_default.BLEND;
  121980. }
  121981. const isUnlit = !defined_default(parsedContent.normals);
  121982. material.unlit = isUnlit;
  121983. const primitive = new Primitive4();
  121984. primitive.attributes = makeAttributes(loader, parsedContent, context);
  121985. primitive.primitiveType = PrimitiveType_default.POINTS;
  121986. primitive.material = material;
  121987. if (defined_default(parsedContent.batchIds)) {
  121988. const featureIdAttribute = new FeatureIdAttribute4();
  121989. featureIdAttribute.propertyTableId = 0;
  121990. featureIdAttribute.setIndex = 0;
  121991. featureIdAttribute.positionalLabel = "featureId_0";
  121992. primitive.featureIds.push(featureIdAttribute);
  121993. }
  121994. const node = new Node6();
  121995. node.index = 0;
  121996. node.primitives = [primitive];
  121997. const scene = new Scene3();
  121998. scene.nodes = [node];
  121999. scene.upAxis = Axis_default.Z;
  122000. scene.forwardAxis = Axis_default.X;
  122001. const components = new Components3();
  122002. components.scene = scene;
  122003. components.nodes = [node];
  122004. components.structuralMetadata = makeStructuralMetadata(parsedContent);
  122005. if (defined_default(parsedContent.rtcCenter)) {
  122006. components.transform = Matrix4_default.multiplyByTranslation(
  122007. components.transform,
  122008. parsedContent.rtcCenter,
  122009. components.transform
  122010. );
  122011. }
  122012. const positions = parsedContent.positions;
  122013. if (defined_default(positions) && positions.isQuantized) {
  122014. components.transform = Matrix4_default.multiplyByTranslation(
  122015. components.transform,
  122016. positions.quantizedVolumeOffset,
  122017. components.transform
  122018. );
  122019. }
  122020. loader._components = components;
  122021. loader._parsedContent = void 0;
  122022. }
  122023. PntsLoader.prototype.unload = function() {
  122024. const buffers = this._buffers;
  122025. for (let i2 = 0; i2 < buffers.length; i2++) {
  122026. buffers[i2].destroy();
  122027. }
  122028. buffers.length = 0;
  122029. this._components = void 0;
  122030. this._parsedContent = void 0;
  122031. };
  122032. // node_modules/cesium/Source/Scene/ModelExperimental/I3dmLoader.js
  122033. var I3dmLoaderState = {
  122034. UNLOADED: 0,
  122035. LOADING: 1,
  122036. PROCESSING: 2,
  122037. READY: 3,
  122038. FAILED: 4
  122039. };
  122040. var Attribute4 = ModelComponents_default.Attribute;
  122041. var FeatureIdAttribute5 = ModelComponents_default.FeatureIdAttribute;
  122042. var Instances3 = ModelComponents_default.Instances;
  122043. function I3dmLoader(options) {
  122044. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  122045. const i3dmResource = options.i3dmResource;
  122046. const arrayBuffer = options.arrayBuffer;
  122047. let baseResource2 = options.baseResource;
  122048. const byteOffset = defaultValue_default(options.byteOffset, 0);
  122049. const releaseGltfJson = defaultValue_default(options.releaseGltfJson, false);
  122050. const asynchronous = defaultValue_default(options.asynchronous, true);
  122051. const incrementallyLoadTextures = defaultValue_default(
  122052. options.incrementallyLoadTextures,
  122053. true
  122054. );
  122055. const upAxis = defaultValue_default(options.upAxis, Axis_default.Y);
  122056. const forwardAxis = defaultValue_default(options.forwardAxis, Axis_default.X);
  122057. const loadAsTypedArray = defaultValue_default(options.loadAsTypedArray, false);
  122058. Check_default.typeOf.object("options.i3dmResource", i3dmResource);
  122059. Check_default.typeOf.object("options.arrayBuffer", arrayBuffer);
  122060. baseResource2 = defined_default(baseResource2) ? baseResource2 : i3dmResource.clone();
  122061. this._i3dmResource = i3dmResource;
  122062. this._baseResource = baseResource2;
  122063. this._arrayBuffer = arrayBuffer;
  122064. this._byteOffset = byteOffset;
  122065. this._releaseGltfJson = releaseGltfJson;
  122066. this._asynchronous = asynchronous;
  122067. this._incrementallyLoadTextures = incrementallyLoadTextures;
  122068. this._upAxis = upAxis;
  122069. this._forwardAxis = forwardAxis;
  122070. this._loadAsTypedArray = loadAsTypedArray;
  122071. this._state = I3dmLoaderState.UNLOADED;
  122072. this._promise = defer_default();
  122073. this._gltfLoader = void 0;
  122074. this._transform = Matrix4_default.IDENTITY;
  122075. this._batchTable = void 0;
  122076. this._featureTable = void 0;
  122077. this._instancesLength = 0;
  122078. }
  122079. if (defined_default(Object.create)) {
  122080. I3dmLoader.prototype = Object.create(ResourceLoader.prototype);
  122081. I3dmLoader.prototype.constructor = I3dmLoader;
  122082. }
  122083. Object.defineProperties(I3dmLoader.prototype, {
  122084. promise: {
  122085. get: function() {
  122086. return this._promise.promise;
  122087. }
  122088. },
  122089. texturesLoadedPromise: {
  122090. get: function() {
  122091. return this._gltfLoader.texturesLoadedPromise;
  122092. }
  122093. },
  122094. cacheKey: {
  122095. get: function() {
  122096. return void 0;
  122097. }
  122098. },
  122099. components: {
  122100. get: function() {
  122101. return this._components;
  122102. }
  122103. }
  122104. });
  122105. I3dmLoader.prototype.load = function() {
  122106. const i3dm = I3dmParser_default.parse(this._arrayBuffer, this._byteOffset);
  122107. const featureTableJson = i3dm.featureTableJson;
  122108. const featureTableBinary = i3dm.featureTableBinary;
  122109. const batchTableJson = i3dm.batchTableJson;
  122110. const batchTableBinary = i3dm.batchTableBinary;
  122111. const gltfFormat = i3dm.gltfFormat;
  122112. const featureTable = new Cesium3DTileFeatureTable_default(
  122113. featureTableJson,
  122114. featureTableBinary
  122115. );
  122116. this._featureTable = featureTable;
  122117. const instancesLength = featureTable.getGlobalProperty("INSTANCES_LENGTH");
  122118. featureTable.featuresLength = instancesLength;
  122119. if (!defined_default(instancesLength)) {
  122120. throw new RuntimeError_default(
  122121. "Feature table global property: INSTANCES_LENGTH must be defined"
  122122. );
  122123. }
  122124. this._instancesLength = instancesLength;
  122125. const rtcCenter = featureTable.getGlobalProperty(
  122126. "RTC_CENTER",
  122127. ComponentDatatype_default.FLOAT,
  122128. 3
  122129. );
  122130. if (defined_default(rtcCenter)) {
  122131. this._transform = Matrix4_default.fromTranslation(Cartesian3_default.fromArray(rtcCenter));
  122132. }
  122133. this._batchTable = {
  122134. json: batchTableJson,
  122135. binary: batchTableBinary
  122136. };
  122137. const loaderOptions = {
  122138. upAxis: this._upAxis,
  122139. forwardAxis: this._forwardAxis,
  122140. releaseGltfJson: this._releaseGltfJson,
  122141. incrementallyLoadTextures: this._incrementallyLoadTextures,
  122142. loadAsTypedArray: this._loadAsTypedArray
  122143. };
  122144. if (gltfFormat === 0) {
  122145. let gltfUrl = getStringFromTypedArray_default(i3dm.gltf);
  122146. gltfUrl = gltfUrl.replace(/[\s\0]+$/, "");
  122147. const gltfResource = this._baseResource.getDerivedResource({
  122148. url: gltfUrl
  122149. });
  122150. loaderOptions.gltfResource = gltfResource;
  122151. loaderOptions.baseResource = gltfResource;
  122152. } else {
  122153. loaderOptions.gltfResource = this._i3dmResource;
  122154. loaderOptions.typedArray = i3dm.gltf;
  122155. }
  122156. const gltfLoader = new GltfLoader(loaderOptions);
  122157. this._gltfLoader = gltfLoader;
  122158. this._state = I3dmLoaderState.LOADING;
  122159. const that = this;
  122160. gltfLoader.load();
  122161. gltfLoader.promise.then(function() {
  122162. if (that.isDestroyed()) {
  122163. return;
  122164. }
  122165. const components = gltfLoader.components;
  122166. components.transform = that._transform;
  122167. createInstances2(that, components);
  122168. createStructuralMetadata2(that, components);
  122169. that._components = components;
  122170. that._state = I3dmLoaderState.READY;
  122171. that._promise.resolve(that);
  122172. }).catch(function(error) {
  122173. if (that.isDestroyed()) {
  122174. return;
  122175. }
  122176. handleError8(that, error);
  122177. });
  122178. };
  122179. function handleError8(i3dmLoader, error) {
  122180. i3dmLoader.unload();
  122181. i3dmLoader._state = I3dmLoaderState.FAILED;
  122182. const errorMessage = "Failed to load I3DM";
  122183. error = i3dmLoader.getError(errorMessage, error);
  122184. i3dmLoader._promise.reject(error);
  122185. }
  122186. I3dmLoader.prototype.process = function(frameState) {
  122187. Check_default.typeOf.object("frameState", frameState);
  122188. if (this._state === I3dmLoaderState.LOADING) {
  122189. this._state = I3dmLoaderState.PROCESSING;
  122190. }
  122191. if (this._state === I3dmLoaderState.PROCESSING) {
  122192. this._gltfLoader.process(frameState);
  122193. }
  122194. };
  122195. function createStructuralMetadata2(loader, components) {
  122196. const batchTable = loader._batchTable;
  122197. const instancesLength = loader._instancesLength;
  122198. if (instancesLength === 0) {
  122199. return;
  122200. }
  122201. let structuralMetadata;
  122202. if (defined_default(batchTable.json)) {
  122203. structuralMetadata = parseBatchTable({
  122204. count: instancesLength,
  122205. batchTable: batchTable.json,
  122206. binaryBody: batchTable.binary
  122207. });
  122208. } else {
  122209. const emptyPropertyTable = new PropertyTable_default({
  122210. name: MetadataClass_default.BATCH_TABLE_CLASS_NAME,
  122211. count: instancesLength
  122212. });
  122213. structuralMetadata = new StructuralMetadata_default({
  122214. schema: {},
  122215. propertyTables: [emptyPropertyTable]
  122216. });
  122217. }
  122218. components.structuralMetadata = structuralMetadata;
  122219. }
  122220. var positionScratch8 = new Cartesian3_default();
  122221. var propertyScratch12 = new Array(4);
  122222. function createInstances2(loader, components) {
  122223. let i2;
  122224. const featureTable = loader._featureTable;
  122225. const instancesLength = loader._instancesLength;
  122226. if (instancesLength === 0) {
  122227. return;
  122228. }
  122229. const rtcCenter = featureTable.getGlobalProperty(
  122230. "RTC_CENTER",
  122231. ComponentDatatype_default.FLOAT,
  122232. 3
  122233. );
  122234. const eastNorthUp = featureTable.getGlobalProperty("EAST_NORTH_UP");
  122235. const hasRotation = featureTable.hasProperty("NORMAL_UP") || featureTable.hasProperty("NORMAL_UP_OCT32P") || eastNorthUp;
  122236. const hasScale = featureTable.hasProperty("SCALE") || featureTable.hasProperty("SCALE_NON_UNIFORM");
  122237. const translationTypedArray = getPositions(featureTable, instancesLength);
  122238. let rotationTypedArray;
  122239. if (hasRotation) {
  122240. rotationTypedArray = new Float32Array(4 * instancesLength);
  122241. }
  122242. let scaleTypedArray;
  122243. if (hasScale) {
  122244. scaleTypedArray = new Float32Array(3 * instancesLength);
  122245. }
  122246. const featureIdArray = new Float32Array(instancesLength);
  122247. const instancePositions = Cartesian3_default.unpackArray(translationTypedArray);
  122248. let instancePosition = new Cartesian3_default();
  122249. const instanceNormalRight = new Cartesian3_default();
  122250. const instanceNormalUp = new Cartesian3_default();
  122251. const instanceNormalForward = new Cartesian3_default();
  122252. const instanceRotation = new Matrix3_default();
  122253. const instanceQuaternion = new Quaternion_default();
  122254. const instanceQuaternionArray = new Array(4);
  122255. const instanceScale = new Cartesian3_default();
  122256. const instanceScaleArray = new Array(3);
  122257. const instanceTransform = new Matrix4_default();
  122258. if (!defined_default(rtcCenter)) {
  122259. const positionBoundingSphere = BoundingSphere_default.fromPoints(instancePositions);
  122260. for (i2 = 0; i2 < instancePositions.length; i2++) {
  122261. Cartesian3_default.subtract(
  122262. instancePositions[i2],
  122263. positionBoundingSphere.center,
  122264. positionScratch8
  122265. );
  122266. translationTypedArray[3 * i2 + 0] = positionScratch8.x;
  122267. translationTypedArray[3 * i2 + 1] = positionScratch8.y;
  122268. translationTypedArray[3 * i2 + 2] = positionScratch8.z;
  122269. }
  122270. components.transform = Matrix4_default.fromTranslation(
  122271. positionBoundingSphere.center
  122272. );
  122273. }
  122274. for (i2 = 0; i2 < instancesLength; i2++) {
  122275. instancePosition = Cartesian3_default.clone(instancePositions[i2]);
  122276. if (defined_default(rtcCenter)) {
  122277. Cartesian3_default.add(
  122278. instancePosition,
  122279. Cartesian3_default.unpack(rtcCenter),
  122280. instancePosition
  122281. );
  122282. }
  122283. if (hasRotation) {
  122284. processRotation(
  122285. featureTable,
  122286. eastNorthUp,
  122287. i2,
  122288. instanceQuaternion,
  122289. instancePosition,
  122290. instanceNormalUp,
  122291. instanceNormalRight,
  122292. instanceNormalForward,
  122293. instanceRotation,
  122294. instanceTransform
  122295. );
  122296. Quaternion_default.pack(instanceQuaternion, instanceQuaternionArray, 0);
  122297. rotationTypedArray[4 * i2 + 0] = instanceQuaternionArray[0];
  122298. rotationTypedArray[4 * i2 + 1] = instanceQuaternionArray[1];
  122299. rotationTypedArray[4 * i2 + 2] = instanceQuaternionArray[2];
  122300. rotationTypedArray[4 * i2 + 3] = instanceQuaternionArray[3];
  122301. }
  122302. if (hasScale) {
  122303. processScale(featureTable, i2, instanceScale);
  122304. Cartesian3_default.pack(instanceScale, instanceScaleArray, 0);
  122305. scaleTypedArray[3 * i2 + 0] = instanceScaleArray[0];
  122306. scaleTypedArray[3 * i2 + 1] = instanceScaleArray[1];
  122307. scaleTypedArray[3 * i2 + 2] = instanceScaleArray[2];
  122308. }
  122309. let batchId = featureTable.getProperty(
  122310. "BATCH_ID",
  122311. ComponentDatatype_default.UNSIGNED_SHORT,
  122312. 1,
  122313. i2
  122314. );
  122315. if (!defined_default(batchId)) {
  122316. batchId = i2;
  122317. }
  122318. featureIdArray[i2] = batchId;
  122319. }
  122320. const instances = new Instances3();
  122321. instances.transformInWorldSpace = true;
  122322. const translationAttribute = new Attribute4();
  122323. translationAttribute.name = "Instance Translation";
  122324. translationAttribute.semantic = InstanceAttributeSemantic_default.TRANSLATION;
  122325. translationAttribute.componentDatatype = ComponentDatatype_default.FLOAT;
  122326. translationAttribute.type = AttributeType_default.VEC3;
  122327. translationAttribute.count = instancesLength;
  122328. translationAttribute.packedTypedArray = translationTypedArray;
  122329. instances.attributes.push(translationAttribute);
  122330. if (hasRotation) {
  122331. const rotationAttribute = new Attribute4();
  122332. rotationAttribute.name = "Instance Rotation";
  122333. rotationAttribute.semantic = InstanceAttributeSemantic_default.ROTATION;
  122334. rotationAttribute.componentDatatype = ComponentDatatype_default.FLOAT;
  122335. rotationAttribute.type = AttributeType_default.VEC4;
  122336. rotationAttribute.count = instancesLength;
  122337. rotationAttribute.packedTypedArray = rotationTypedArray;
  122338. instances.attributes.push(rotationAttribute);
  122339. }
  122340. if (hasScale) {
  122341. const scaleAttribute = new Attribute4();
  122342. scaleAttribute.name = "Instance Scale";
  122343. scaleAttribute.semantic = InstanceAttributeSemantic_default.SCALE;
  122344. scaleAttribute.componentDatatype = ComponentDatatype_default.FLOAT;
  122345. scaleAttribute.type = AttributeType_default.VEC3;
  122346. scaleAttribute.count = instancesLength;
  122347. scaleAttribute.packedTypedArray = scaleTypedArray;
  122348. instances.attributes.push(scaleAttribute);
  122349. }
  122350. const featureIdAttribute = new Attribute4();
  122351. featureIdAttribute.name = "Instance Feature ID";
  122352. featureIdAttribute.setIndex = 0;
  122353. featureIdAttribute.semantic = InstanceAttributeSemantic_default.FEATURE_ID;
  122354. featureIdAttribute.componentDatatype = ComponentDatatype_default.FLOAT;
  122355. featureIdAttribute.type = AttributeType_default.SCALAR;
  122356. featureIdAttribute.count = instancesLength;
  122357. featureIdAttribute.packedTypedArray = featureIdArray;
  122358. instances.attributes.push(featureIdAttribute);
  122359. const featureIdInstanceAttribute = new FeatureIdAttribute5();
  122360. featureIdInstanceAttribute.propertyTableId = 0;
  122361. featureIdInstanceAttribute.setIndex = 0;
  122362. featureIdInstanceAttribute.positionalLabel = "instanceFeatureId_0";
  122363. instances.featureIds.push(featureIdInstanceAttribute);
  122364. for (i2 = 0; i2 < components.nodes.length; i2++) {
  122365. const node = components.nodes[i2];
  122366. if (node.primitives.length > 0) {
  122367. node.instances = instances;
  122368. }
  122369. }
  122370. }
  122371. function getPositions(featureTable, instancesLength) {
  122372. if (featureTable.hasProperty("POSITION")) {
  122373. return featureTable.getPropertyArray(
  122374. "POSITION",
  122375. ComponentDatatype_default.FLOAT,
  122376. 3
  122377. );
  122378. } else if (featureTable.hasProperty("POSITION_QUANTIZED")) {
  122379. const quantizedPositions = featureTable.getPropertyArray(
  122380. "POSITION_QUANTIZED",
  122381. ComponentDatatype_default.UNSIGNED_SHORT,
  122382. 3
  122383. );
  122384. const quantizedVolumeOffset = featureTable.getGlobalProperty(
  122385. "QUANTIZED_VOLUME_OFFSET",
  122386. ComponentDatatype_default.FLOAT,
  122387. 3
  122388. );
  122389. if (!defined_default(quantizedVolumeOffset)) {
  122390. throw new RuntimeError_default(
  122391. "Global property: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions."
  122392. );
  122393. }
  122394. const quantizedVolumeScale = featureTable.getGlobalProperty(
  122395. "QUANTIZED_VOLUME_SCALE",
  122396. ComponentDatatype_default.FLOAT,
  122397. 3
  122398. );
  122399. if (!defined_default(quantizedVolumeScale)) {
  122400. throw new RuntimeError_default(
  122401. "Global property: QUANTIZED_VOLUME_SCALE must be defined for quantized positions."
  122402. );
  122403. }
  122404. for (let i2 = 0; i2 < quantizedPositions.length / 3; i2++) {
  122405. const quantizedPosition = quantizedPositions[i2];
  122406. for (let j = 0; j < 3; j++) {
  122407. quantizedPositions[3 * i2 + j] = quantizedPosition[j] / 65535 * quantizedVolumeScale[j] + quantizedVolumeOffset[j];
  122408. }
  122409. }
  122410. return quantizedPositions;
  122411. } else {
  122412. throw new RuntimeError_default(
  122413. "Either POSITION or POSITION_QUANTIZED must be defined for each instance."
  122414. );
  122415. }
  122416. }
  122417. var propertyScratch22 = new Array(4);
  122418. function processRotation(featureTable, eastNorthUp, i2, instanceQuaternion, instancePosition, instanceNormalUp, instanceNormalRight, instanceNormalForward, instanceRotation, instanceTransform) {
  122419. const normalUp = featureTable.getProperty(
  122420. "NORMAL_UP",
  122421. ComponentDatatype_default.FLOAT,
  122422. 3,
  122423. i2,
  122424. propertyScratch12
  122425. );
  122426. const normalRight = featureTable.getProperty(
  122427. "NORMAL_RIGHT",
  122428. ComponentDatatype_default.FLOAT,
  122429. 3,
  122430. i2,
  122431. propertyScratch22
  122432. );
  122433. let hasCustomOrientation = false;
  122434. if (defined_default(normalUp)) {
  122435. if (!defined_default(normalRight)) {
  122436. throw new RuntimeError_default(
  122437. "To define a custom orientation, both NORMAL_UP and NORMAL_RIGHT must be defined."
  122438. );
  122439. }
  122440. Cartesian3_default.unpack(normalUp, 0, instanceNormalUp);
  122441. Cartesian3_default.unpack(normalRight, 0, instanceNormalRight);
  122442. hasCustomOrientation = true;
  122443. } else {
  122444. const octNormalUp = featureTable.getProperty(
  122445. "NORMAL_UP_OCT32P",
  122446. ComponentDatatype_default.UNSIGNED_SHORT,
  122447. 2,
  122448. i2,
  122449. propertyScratch12
  122450. );
  122451. const octNormalRight = featureTable.getProperty(
  122452. "NORMAL_RIGHT_OCT32P",
  122453. ComponentDatatype_default.UNSIGNED_SHORT,
  122454. 2,
  122455. i2,
  122456. propertyScratch22
  122457. );
  122458. if (defined_default(octNormalUp)) {
  122459. if (!defined_default(octNormalRight)) {
  122460. throw new RuntimeError_default(
  122461. "To define a custom orientation with oct-encoded vectors, both NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P must be defined."
  122462. );
  122463. }
  122464. AttributeCompression_default.octDecodeInRange(
  122465. octNormalUp[0],
  122466. octNormalUp[1],
  122467. 65535,
  122468. instanceNormalUp
  122469. );
  122470. AttributeCompression_default.octDecodeInRange(
  122471. octNormalRight[0],
  122472. octNormalRight[1],
  122473. 65535,
  122474. instanceNormalRight
  122475. );
  122476. hasCustomOrientation = true;
  122477. } else if (eastNorthUp) {
  122478. Transforms_default.eastNorthUpToFixedFrame(
  122479. instancePosition,
  122480. Ellipsoid_default.WGS84,
  122481. instanceTransform
  122482. );
  122483. Matrix4_default.getMatrix3(instanceTransform, instanceRotation);
  122484. } else {
  122485. Matrix3_default.clone(Matrix3_default.IDENTITY, instanceRotation);
  122486. }
  122487. }
  122488. if (hasCustomOrientation) {
  122489. Cartesian3_default.cross(
  122490. instanceNormalRight,
  122491. instanceNormalUp,
  122492. instanceNormalForward
  122493. );
  122494. Cartesian3_default.normalize(instanceNormalForward, instanceNormalForward);
  122495. Matrix3_default.setColumn(
  122496. instanceRotation,
  122497. 0,
  122498. instanceNormalRight,
  122499. instanceRotation
  122500. );
  122501. Matrix3_default.setColumn(instanceRotation, 1, instanceNormalUp, instanceRotation);
  122502. Matrix3_default.setColumn(
  122503. instanceRotation,
  122504. 2,
  122505. instanceNormalForward,
  122506. instanceRotation
  122507. );
  122508. }
  122509. Quaternion_default.fromRotationMatrix(instanceRotation, instanceQuaternion);
  122510. }
  122511. function processScale(featureTable, i2, instanceScale) {
  122512. instanceScale = Cartesian3_default.fromElements(1, 1, 1, instanceScale);
  122513. const scale = featureTable.getProperty(
  122514. "SCALE",
  122515. ComponentDatatype_default.FLOAT,
  122516. 1,
  122517. i2
  122518. );
  122519. if (defined_default(scale)) {
  122520. Cartesian3_default.multiplyByScalar(instanceScale, scale, instanceScale);
  122521. }
  122522. const nonUniformScale = featureTable.getProperty(
  122523. "SCALE_NON_UNIFORM",
  122524. ComponentDatatype_default.FLOAT,
  122525. 3,
  122526. i2,
  122527. propertyScratch12
  122528. );
  122529. if (defined_default(nonUniformScale)) {
  122530. instanceScale.x *= nonUniformScale[0];
  122531. instanceScale.y *= nonUniformScale[1];
  122532. instanceScale.z *= nonUniformScale[2];
  122533. }
  122534. }
  122535. I3dmLoader.prototype.unload = function() {
  122536. if (defined_default(this._gltfLoader)) {
  122537. this._gltfLoader.unload();
  122538. }
  122539. this._components = void 0;
  122540. };
  122541. var I3dmLoader_default = I3dmLoader;
  122542. // node_modules/cesium/Source/Scene/ModelExperimental/ModelExperimental.js
  122543. function ModelExperimental(options) {
  122544. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  122545. Check_default.typeOf.object("options.loader", options.loader);
  122546. Check_default.typeOf.object("options.resource", options.resource);
  122547. this._loader = options.loader;
  122548. this._resource = options.resource;
  122549. this.type = defaultValue_default(options.type, ModelExperimentalType_default.GLTF);
  122550. this.modelMatrix = Matrix4_default.clone(
  122551. defaultValue_default(options.modelMatrix, Matrix4_default.IDENTITY)
  122552. );
  122553. this._modelMatrix = Matrix4_default.clone(this.modelMatrix);
  122554. this._scale = defaultValue_default(options.scale, 1);
  122555. this._minimumPixelSize = defaultValue_default(options.minimumPixelSize, 0);
  122556. this._maximumScale = options.maximumScale;
  122557. this._clampedScale = defined_default(this._maximumScale) ? Math.min(this._scale, this._maximumScale) : this._scale;
  122558. this._computedScale = this._clampedScale;
  122559. this._updateModelMatrix = false;
  122560. this.referenceMatrix = void 0;
  122561. this._iblReferenceFrameMatrix = Matrix3_default.clone(Matrix3_default.IDENTITY);
  122562. this._resourcesLoaded = false;
  122563. this._drawCommandsBuilt = false;
  122564. this._ready = false;
  122565. this._readyPromise = defer_default();
  122566. this._customShader = options.customShader;
  122567. this._content = options.content;
  122568. this._texturesLoaded = false;
  122569. this._defaultTexture = void 0;
  122570. this._activeAnimations = new ModelExperimentalAnimationCollection_default(this);
  122571. this._clampAnimations = defaultValue_default(options.clampAnimations, true);
  122572. const color = options.color;
  122573. this._color = defaultValue_default(color) ? Color_default.clone(color) : void 0;
  122574. this._colorBlendMode = defaultValue_default(
  122575. options.colorBlendMode,
  122576. ColorBlendMode_default.HIGHLIGHT
  122577. );
  122578. this._colorBlendAmount = defaultValue_default(options.colorBlendAmount, 0.5);
  122579. this._cull = defaultValue_default(options.cull, true);
  122580. this._opaquePass = defaultValue_default(options.opaquePass, Pass_default.OPAQUE);
  122581. this._allowPicking = defaultValue_default(options.allowPicking, true);
  122582. this._show = defaultValue_default(options.show, true);
  122583. this._style = void 0;
  122584. let featureIdLabel = defaultValue_default(options.featureIdLabel, "featureId_0");
  122585. if (typeof featureIdLabel === "number") {
  122586. featureIdLabel = `featureId_${featureIdLabel}`;
  122587. }
  122588. this._featureIdLabel = featureIdLabel;
  122589. let instanceFeatureIdLabel = defaultValue_default(
  122590. options.instanceFeatureIdLabel,
  122591. "instanceFeatureId_0"
  122592. );
  122593. if (typeof instanceFeatureIdLabel === "number") {
  122594. instanceFeatureIdLabel = `instanceFeatureId_${instanceFeatureIdLabel}`;
  122595. }
  122596. this._instanceFeatureIdLabel = instanceFeatureIdLabel;
  122597. this._featureTables = [];
  122598. this._featureTableId = void 0;
  122599. this._featureTableIdDirty = true;
  122600. this._resources = [];
  122601. this._boundingSphere = new BoundingSphere_default();
  122602. this._initialRadius = void 0;
  122603. const pointCloudShading = new PointCloudShading_default(options.pointCloudShading);
  122604. this._attenuation = pointCloudShading.attenuation;
  122605. this._pointCloudShading = pointCloudShading;
  122606. const clippingPlanes = options.clippingPlanes;
  122607. if (defined_default(clippingPlanes) && clippingPlanes.owner === void 0) {
  122608. ClippingPlaneCollection_default.setOwner(clippingPlanes, this, "_clippingPlanes");
  122609. } else {
  122610. this._clippingPlanes = clippingPlanes;
  122611. }
  122612. this._clippingPlanesState = 0;
  122613. this._clippingPlanesMatrix = Matrix4_default.clone(Matrix4_default.IDENTITY);
  122614. this._lightColor = Cartesian3_default.clone(options.lightColor);
  122615. this._imageBasedLighting = defined_default(options.imageBasedLighting) ? options.imageBasedLighting : new ImageBasedLighting();
  122616. this._shouldDestroyImageBasedLighting = !defined_default(options.imageBasedLighting);
  122617. this._backFaceCulling = defaultValue_default(options.backFaceCulling, true);
  122618. this._backFaceCullingDirty = false;
  122619. this._shadows = defaultValue_default(options.shadows, ShadowMode_default.ENABLED);
  122620. this._shadowsDirty = false;
  122621. this._debugShowBoundingVolumeDirty = false;
  122622. this._debugShowBoundingVolume = defaultValue_default(
  122623. options.debugShowBoundingVolume,
  122624. false
  122625. );
  122626. this._debugWireframe = defaultValue_default(options.debugWireframe, false);
  122627. this._showCreditsOnScreen = defaultValue_default(options.showCreditsOnScreen, false);
  122628. this._splitDirection = defaultValue_default(
  122629. options.splitDirection,
  122630. SplitDirection_default.NONE
  122631. );
  122632. initialize18(this);
  122633. }
  122634. function createModelFeatureTables(model, structuralMetadata) {
  122635. const featureTables = model._featureTables;
  122636. const propertyTables = structuralMetadata.propertyTables;
  122637. for (let i2 = 0; i2 < propertyTables.length; i2++) {
  122638. const propertyTable = propertyTables[i2];
  122639. const modelFeatureTable = new ModelFeatureTable({
  122640. model,
  122641. propertyTable
  122642. });
  122643. featureTables.push(modelFeatureTable);
  122644. }
  122645. return featureTables;
  122646. }
  122647. function selectFeatureTableId(components, model) {
  122648. const featureIdLabel = model._featureIdLabel;
  122649. const instanceFeatureIdLabel = model._instanceFeatureIdLabel;
  122650. let i2, j;
  122651. let featureIdAttribute;
  122652. let node;
  122653. for (i2 = 0; i2 < components.nodes.length; i2++) {
  122654. node = components.nodes[i2];
  122655. if (defined_default(node.instances)) {
  122656. featureIdAttribute = ModelExperimentalUtility.getFeatureIdsByLabel(
  122657. node.instances.featureIds,
  122658. instanceFeatureIdLabel
  122659. );
  122660. if (defined_default(featureIdAttribute) && defined_default(featureIdAttribute.propertyTableId)) {
  122661. return featureIdAttribute.propertyTableId;
  122662. }
  122663. }
  122664. }
  122665. for (i2 = 0; i2 < components.nodes.length; i2++) {
  122666. node = components.nodes[i2];
  122667. for (j = 0; j < node.primitives.length; j++) {
  122668. const primitive = node.primitives[j];
  122669. const featureIds = ModelExperimentalUtility.getFeatureIdsByLabel(
  122670. primitive.featureIds,
  122671. featureIdLabel
  122672. );
  122673. if (defined_default(featureIds)) {
  122674. return featureIds.propertyTableId;
  122675. }
  122676. }
  122677. }
  122678. }
  122679. function initialize18(model) {
  122680. const loader = model._loader;
  122681. const resource = model._resource;
  122682. loader.load();
  122683. loader.promise.then(function(loader2) {
  122684. const components = loader2.components;
  122685. const structuralMetadata = components.structuralMetadata;
  122686. if (defined_default(structuralMetadata) && structuralMetadata.propertyTableCount > 0) {
  122687. createModelFeatureTables(model, structuralMetadata);
  122688. }
  122689. model._sceneGraph = new ModelExperimentalSceneGraph({
  122690. model,
  122691. modelComponents: components
  122692. });
  122693. model._resourcesLoaded = true;
  122694. }).catch(
  122695. ModelExperimentalUtility.getFailedLoadFunction(model, "model", resource)
  122696. );
  122697. const texturesLoadedPromise = defaultValue_default(
  122698. loader.texturesLoadedPromise,
  122699. Promise.resolve()
  122700. );
  122701. texturesLoadedPromise.then(function() {
  122702. model._texturesLoaded = true;
  122703. }).catch(
  122704. ModelExperimentalUtility.getFailedLoadFunction(model, "model", resource)
  122705. );
  122706. }
  122707. Object.defineProperties(ModelExperimental.prototype, {
  122708. ready: {
  122709. get: function() {
  122710. return this._ready;
  122711. }
  122712. },
  122713. readyPromise: {
  122714. get: function() {
  122715. return this._readyPromise.promise;
  122716. }
  122717. },
  122718. loader: {
  122719. get: function() {
  122720. return this._loader;
  122721. }
  122722. },
  122723. activeAnimations: {
  122724. get: function() {
  122725. return this._activeAnimations;
  122726. }
  122727. },
  122728. clampAnimations: {
  122729. get: function() {
  122730. return this._clampAnimations;
  122731. },
  122732. set: function(value) {
  122733. this._clampAnimations = value;
  122734. }
  122735. },
  122736. cull: {
  122737. get: function() {
  122738. return this._cull;
  122739. }
  122740. },
  122741. opaquePass: {
  122742. get: function() {
  122743. return this._opaquePass;
  122744. }
  122745. },
  122746. pointCloudShading: {
  122747. get: function() {
  122748. return this._pointCloudShading;
  122749. },
  122750. set: function(value) {
  122751. Check_default.defined("pointCloudShading", value);
  122752. if (value !== this._pointCloudShading) {
  122753. this.resetDrawCommands();
  122754. }
  122755. this._pointCloudShading = value;
  122756. }
  122757. },
  122758. customShader: {
  122759. get: function() {
  122760. return this._customShader;
  122761. },
  122762. set: function(value) {
  122763. if (value !== this._customShader) {
  122764. this.resetDrawCommands();
  122765. }
  122766. this._customShader = value;
  122767. }
  122768. },
  122769. sceneGraph: {
  122770. get: function() {
  122771. return this._sceneGraph;
  122772. }
  122773. },
  122774. content: {
  122775. get: function() {
  122776. return this._content;
  122777. }
  122778. },
  122779. structuralMetadata: {
  122780. get: function() {
  122781. return this._sceneGraph.components.structuralMetadata;
  122782. }
  122783. },
  122784. featureTableId: {
  122785. get: function() {
  122786. return this._featureTableId;
  122787. },
  122788. set: function(value) {
  122789. this._featureTableId = value;
  122790. }
  122791. },
  122792. featureTables: {
  122793. get: function() {
  122794. return this._featureTables;
  122795. },
  122796. set: function(value) {
  122797. this._featureTables = value;
  122798. }
  122799. },
  122800. allowPicking: {
  122801. get: function() {
  122802. return this._allowPicking;
  122803. }
  122804. },
  122805. style: {
  122806. get: function() {
  122807. return this._style;
  122808. },
  122809. set: function(value) {
  122810. if (value !== this._style) {
  122811. this.applyStyle(value);
  122812. }
  122813. this._style = value;
  122814. }
  122815. },
  122816. color: {
  122817. get: function() {
  122818. return this._color;
  122819. },
  122820. set: function(value) {
  122821. if (!Color_default.equals(this._color, value)) {
  122822. this.resetDrawCommands();
  122823. }
  122824. this._color = Color_default.clone(value, this._color);
  122825. }
  122826. },
  122827. colorBlendMode: {
  122828. get: function() {
  122829. return this._colorBlendMode;
  122830. },
  122831. set: function(value) {
  122832. this._colorBlendMode = value;
  122833. }
  122834. },
  122835. colorBlendAmount: {
  122836. get: function() {
  122837. return this._colorBlendAmount;
  122838. },
  122839. set: function(value) {
  122840. this._colorBlendAmount = value;
  122841. }
  122842. },
  122843. boundingSphere: {
  122844. get: function() {
  122845. if (!this._ready) {
  122846. throw new DeveloperError_default(
  122847. "The model is not loaded. Use ModelExperimental.readyPromise or wait for ModelExperimental.ready to be true."
  122848. );
  122849. }
  122850. return this._boundingSphere;
  122851. }
  122852. },
  122853. debugShowBoundingVolume: {
  122854. get: function() {
  122855. return this._debugShowBoundingVolume;
  122856. },
  122857. set: function(value) {
  122858. if (this._debugShowBoundingVolume !== value) {
  122859. this._debugShowBoundingVolumeDirty = true;
  122860. }
  122861. this._debugShowBoundingVolume = value;
  122862. }
  122863. },
  122864. debugWireframe: {
  122865. get: function() {
  122866. return this._debugWireframe;
  122867. },
  122868. set: function(value) {
  122869. if (this._debugWireframe !== value) {
  122870. this.resetDrawCommands();
  122871. }
  122872. this._debugWireframe = value;
  122873. }
  122874. },
  122875. show: {
  122876. get: function() {
  122877. return this._show;
  122878. },
  122879. set: function(value) {
  122880. this._show = value;
  122881. }
  122882. },
  122883. featureIdLabel: {
  122884. get: function() {
  122885. return this._featureIdLabel;
  122886. },
  122887. set: function(value) {
  122888. if (typeof value === "number") {
  122889. value = `featureId_${value}`;
  122890. }
  122891. Check_default.typeOf.string("value", value);
  122892. if (value !== this._featureIdLabel) {
  122893. this._featureTableIdDirty = true;
  122894. }
  122895. this._featureIdLabel = value;
  122896. }
  122897. },
  122898. instanceFeatureIdLabel: {
  122899. get: function() {
  122900. return this._instanceFeatureIdLabel;
  122901. },
  122902. set: function(value) {
  122903. if (typeof value === "number") {
  122904. value = `instanceFeatureId_${value}`;
  122905. }
  122906. Check_default.typeOf.string("value", value);
  122907. if (value !== this._instanceFeatureIdLabel) {
  122908. this._featureTableIdDirty = true;
  122909. }
  122910. this._instanceFeatureIdLabel = value;
  122911. }
  122912. },
  122913. clippingPlanes: {
  122914. get: function() {
  122915. return this._clippingPlanes;
  122916. },
  122917. set: function(value) {
  122918. if (value !== this._clippingPlanes) {
  122919. ClippingPlaneCollection_default.setOwner(value, this, "_clippingPlanes");
  122920. this.resetDrawCommands();
  122921. }
  122922. }
  122923. },
  122924. lightColor: {
  122925. get: function() {
  122926. return this._lightColor;
  122927. },
  122928. set: function(value) {
  122929. if (defined_default(value) !== defined_default(this._lightColor)) {
  122930. this.resetDrawCommands();
  122931. }
  122932. this._lightColor = Cartesian3_default.clone(value, this._lightColor);
  122933. }
  122934. },
  122935. imageBasedLighting: {
  122936. get: function() {
  122937. return this._imageBasedLighting;
  122938. },
  122939. set: function(value) {
  122940. Check_default.typeOf.object("imageBasedLighting", this._imageBasedLighting);
  122941. if (value !== this._imageBasedLighting) {
  122942. if (this._shouldDestroyImageBasedLighting && !this._imageBasedLighting.isDestroyed()) {
  122943. this._imageBasedLighting.destroy();
  122944. }
  122945. this._imageBasedLighting = value;
  122946. this._shouldDestroyImageBasedLighting = false;
  122947. this.resetDrawCommands();
  122948. }
  122949. }
  122950. },
  122951. backFaceCulling: {
  122952. get: function() {
  122953. return this._backFaceCulling;
  122954. },
  122955. set: function(value) {
  122956. if (value !== this._backFaceCulling) {
  122957. this._backFaceCullingDirty = true;
  122958. }
  122959. this._backFaceCulling = value;
  122960. }
  122961. },
  122962. scale: {
  122963. get: function() {
  122964. return this._scale;
  122965. },
  122966. set: function(value) {
  122967. if (value !== this._scale) {
  122968. this._updateModelMatrix = true;
  122969. }
  122970. this._scale = value;
  122971. }
  122972. },
  122973. computedScale: {
  122974. get: function() {
  122975. return this._computedScale;
  122976. }
  122977. },
  122978. minimumPixelSize: {
  122979. get: function() {
  122980. return this._minimumPixelSize;
  122981. },
  122982. set: function(value) {
  122983. if (value !== this._minimumPixelSize) {
  122984. this._updateModelMatrix = true;
  122985. }
  122986. this._minimumPixelSize = value;
  122987. }
  122988. },
  122989. maximumScale: {
  122990. get: function() {
  122991. return this._maximumScale;
  122992. },
  122993. set: function(value) {
  122994. if (value !== this._maximumScale) {
  122995. this._updateModelMatrix = true;
  122996. }
  122997. this._maximumScale = value;
  122998. }
  122999. },
  123000. shadows: {
  123001. get: function() {
  123002. return this._shadows;
  123003. },
  123004. set: function(value) {
  123005. if (value !== this._shadows) {
  123006. this._shadowsDirty = true;
  123007. }
  123008. this._shadows = value;
  123009. }
  123010. },
  123011. showCreditsOnScreen: {
  123012. get: function() {
  123013. return this._showCreditsOnScreen;
  123014. },
  123015. set: function(value) {
  123016. this._showCreditsOnScreen = value;
  123017. }
  123018. },
  123019. splitDirection: {
  123020. get: function() {
  123021. return this._splitDirection;
  123022. },
  123023. set: function(value) {
  123024. if (this._splitDirection !== value) {
  123025. this.resetDrawCommands();
  123026. }
  123027. this._splitDirection = value;
  123028. }
  123029. }
  123030. });
  123031. ModelExperimental.prototype.resetDrawCommands = function() {
  123032. if (!this._drawCommandsBuilt) {
  123033. return;
  123034. }
  123035. this.destroyResources();
  123036. this._drawCommandsBuilt = false;
  123037. };
  123038. var scratchIBLReferenceFrameMatrix42 = new Matrix4_default();
  123039. var scratchIBLReferenceFrameMatrix32 = new Matrix3_default();
  123040. var scratchClippingPlanesMatrix3 = new Matrix4_default();
  123041. ModelExperimental.prototype.update = function(frameState) {
  123042. if (!this._resourcesLoaded || !this._texturesLoaded) {
  123043. this._loader.process(frameState);
  123044. }
  123045. if (defined_default(this._customShader)) {
  123046. this._customShader.update(frameState);
  123047. }
  123048. if (this.pointCloudShading.attenuation !== this._attenuation) {
  123049. this.resetDrawCommands();
  123050. this._attenuation = this.pointCloudShading.attenuation;
  123051. }
  123052. const context = frameState.context;
  123053. const referenceMatrix = defaultValue_default(this.referenceMatrix, this.modelMatrix);
  123054. this._imageBasedLighting.update(frameState);
  123055. if (this._imageBasedLighting.useSphericalHarmonicCoefficients || this._imageBasedLighting.useSpecularEnvironmentMaps) {
  123056. let iblReferenceFrameMatrix3 = scratchIBLReferenceFrameMatrix32;
  123057. let iblReferenceFrameMatrix4 = scratchIBLReferenceFrameMatrix42;
  123058. iblReferenceFrameMatrix4 = Matrix4_default.multiply(
  123059. context.uniformState.view3D,
  123060. referenceMatrix,
  123061. iblReferenceFrameMatrix4
  123062. );
  123063. iblReferenceFrameMatrix3 = Matrix4_default.getMatrix3(
  123064. iblReferenceFrameMatrix4,
  123065. iblReferenceFrameMatrix3
  123066. );
  123067. iblReferenceFrameMatrix3 = Matrix3_default.getRotation(
  123068. iblReferenceFrameMatrix3,
  123069. iblReferenceFrameMatrix3
  123070. );
  123071. this._iblReferenceFrameMatrix = Matrix3_default.transpose(
  123072. iblReferenceFrameMatrix3,
  123073. this._iblReferenceFrameMatrix
  123074. );
  123075. }
  123076. if (this._imageBasedLighting.shouldRegenerateShaders) {
  123077. this.resetDrawCommands();
  123078. }
  123079. let currentClippingPlanesState = 0;
  123080. if (this.isClippingEnabled()) {
  123081. if (this._clippingPlanes.owner === this) {
  123082. this._clippingPlanes.update(frameState);
  123083. }
  123084. let clippingPlanesMatrix = scratchClippingPlanesMatrix3;
  123085. clippingPlanesMatrix = Matrix4_default.multiply(
  123086. context.uniformState.view3D,
  123087. referenceMatrix,
  123088. clippingPlanesMatrix
  123089. );
  123090. clippingPlanesMatrix = Matrix4_default.multiply(
  123091. clippingPlanesMatrix,
  123092. this._clippingPlanes.modelMatrix,
  123093. clippingPlanesMatrix
  123094. );
  123095. this._clippingPlanesMatrix = Matrix4_default.inverseTranspose(
  123096. clippingPlanesMatrix,
  123097. this._clippingPlanesMatrix
  123098. );
  123099. currentClippingPlanesState = this._clippingPlanes.clippingPlanesState;
  123100. }
  123101. if (currentClippingPlanesState !== this._clippingPlanesState) {
  123102. this.resetDrawCommands();
  123103. this._clippingPlanesState = currentClippingPlanesState;
  123104. }
  123105. this._defaultTexture = context.defaultTexture;
  123106. if (!this._resourcesLoaded) {
  123107. return;
  123108. }
  123109. if (this._featureTableIdDirty) {
  123110. updateFeatureTableId(this);
  123111. this._featureTableIdDirty = false;
  123112. }
  123113. const featureTables = this._featureTables;
  123114. for (let i2 = 0; i2 < featureTables.length; i2++) {
  123115. featureTables[i2].update(frameState);
  123116. if (featureTables[i2].styleCommandsNeededDirty) {
  123117. this.resetDrawCommands();
  123118. }
  123119. }
  123120. if (!this._drawCommandsBuilt) {
  123121. this._sceneGraph.buildDrawCommands(frameState);
  123122. this._drawCommandsBuilt = true;
  123123. const model = this;
  123124. if (!model._ready) {
  123125. frameState.afterRender.push(function() {
  123126. model._ready = true;
  123127. model._readyPromise.resolve(model);
  123128. });
  123129. return;
  123130. }
  123131. }
  123132. if (this._debugShowBoundingVolumeDirty) {
  123133. updateShowBoundingVolume3(this._sceneGraph, this._debugShowBoundingVolume);
  123134. this._debugShowBoundingVolumeDirty = false;
  123135. }
  123136. if (!Matrix4_default.equals(this.modelMatrix, this._modelMatrix)) {
  123137. this._updateModelMatrix = true;
  123138. this._modelMatrix = Matrix4_default.clone(this.modelMatrix, this._modelMatrix);
  123139. this._boundingSphere = BoundingSphere_default.transform(
  123140. this._sceneGraph.boundingSphere,
  123141. this.modelMatrix,
  123142. this._boundingSphere
  123143. );
  123144. }
  123145. if (this._updateModelMatrix || this._minimumPixelSize !== 0) {
  123146. this._clampedScale = defined_default(this._maximumScale) ? Math.min(this._scale, this._maximumScale) : this._scale;
  123147. this._boundingSphere.radius = this._initialRadius * this._clampedScale;
  123148. this._computedScale = getScale2(this, frameState);
  123149. this._sceneGraph.updateModelMatrix();
  123150. this._updateModelMatrix = false;
  123151. }
  123152. if (this._backFaceCullingDirty) {
  123153. this.sceneGraph.updateBackFaceCulling(this._backFaceCulling);
  123154. this._backFaceCullingDirty = false;
  123155. }
  123156. if (this._shadowsDirty) {
  123157. this.sceneGraph.updateShadows(this._shadows);
  123158. this._shadowsDirty = false;
  123159. }
  123160. const updateForAnimations = this._activeAnimations.update(frameState);
  123161. this._sceneGraph.update(frameState, updateForAnimations);
  123162. if (this._show && this._computedScale !== 0) {
  123163. const asset = this._sceneGraph.components.asset;
  123164. const credits = asset.credits;
  123165. const length3 = credits.length;
  123166. for (let i2 = 0; i2 < length3; i2++) {
  123167. const credit = credits[i2];
  123168. credit.showOnScreen = this._showCreditsOnScreen;
  123169. frameState.creditDisplay.addCredit(credit);
  123170. }
  123171. const drawCommands = this._sceneGraph.getDrawCommands();
  123172. frameState.commandList.push.apply(frameState.commandList, drawCommands);
  123173. }
  123174. };
  123175. function updateFeatureTableId(model) {
  123176. const components = model._sceneGraph.components;
  123177. const structuralMetadata = components.structuralMetadata;
  123178. if (defined_default(structuralMetadata) && structuralMetadata.propertyTableCount > 0) {
  123179. model.featureTableId = selectFeatureTableId(components, model);
  123180. model.applyStyle(model._style);
  123181. }
  123182. }
  123183. var scratchBoundingSphere5 = new BoundingSphere_default();
  123184. function scaleInPixels2(positionWC2, radius, frameState) {
  123185. scratchBoundingSphere5.center = positionWC2;
  123186. scratchBoundingSphere5.radius = radius;
  123187. return frameState.camera.getPixelSize(
  123188. scratchBoundingSphere5,
  123189. frameState.context.drawingBufferWidth,
  123190. frameState.context.drawingBufferHeight
  123191. );
  123192. }
  123193. var scratchPosition12 = new Cartesian3_default();
  123194. function getScale2(model, frameState) {
  123195. let scale = model.scale;
  123196. if (model.minimumPixelSize !== 0) {
  123197. const context = frameState.context;
  123198. const maxPixelSize = Math.max(
  123199. context.drawingBufferWidth,
  123200. context.drawingBufferHeight
  123201. );
  123202. const m = model.modelMatrix;
  123203. scratchPosition12.x = m[12];
  123204. scratchPosition12.y = m[13];
  123205. scratchPosition12.z = m[14];
  123206. const radius = model.boundingSphere.radius;
  123207. const metersPerPixel = scaleInPixels2(scratchPosition12, radius, frameState);
  123208. const pixelsPerMeter = 1 / metersPerPixel;
  123209. const diameterInPixels = Math.min(
  123210. pixelsPerMeter * (2 * radius),
  123211. maxPixelSize
  123212. );
  123213. if (diameterInPixels < model.minimumPixelSize) {
  123214. scale = model.minimumPixelSize * metersPerPixel / (2 * model._initialRadius);
  123215. }
  123216. }
  123217. return defined_default(model.maximumScale) ? Math.min(model.maximumScale, scale) : scale;
  123218. }
  123219. ModelExperimental.prototype.isClippingEnabled = function() {
  123220. const clippingPlanes = this._clippingPlanes;
  123221. return defined_default(clippingPlanes) && clippingPlanes.enabled && clippingPlanes.length !== 0;
  123222. };
  123223. ModelExperimental.prototype.isDestroyed = function() {
  123224. return false;
  123225. };
  123226. ModelExperimental.prototype.destroy = function() {
  123227. const loader = this._loader;
  123228. if (defined_default(loader)) {
  123229. loader.destroy();
  123230. }
  123231. const featureTables = this._featureTables;
  123232. if (defined_default(featureTables)) {
  123233. for (let i2 = 0; i2 < featureTables.length; i2++) {
  123234. featureTables[i2].destroy();
  123235. }
  123236. }
  123237. this.destroyResources();
  123238. const clippingPlaneCollection = this._clippingPlanes;
  123239. if (defined_default(clippingPlaneCollection) && !clippingPlaneCollection.isDestroyed() && clippingPlaneCollection.owner === this) {
  123240. clippingPlaneCollection.destroy();
  123241. }
  123242. this._clippingPlanes = void 0;
  123243. if (this._shouldDestroyImageBasedLighting && !this._imageBasedLighting.isDestroyed()) {
  123244. this._imageBasedLighting.destroy();
  123245. }
  123246. this._imageBasedLighting = void 0;
  123247. destroyObject_default(this);
  123248. };
  123249. ModelExperimental.prototype.destroyResources = function() {
  123250. const resources = this._resources;
  123251. for (let i2 = 0; i2 < resources.length; i2++) {
  123252. resources[i2].destroy();
  123253. }
  123254. this._resources = [];
  123255. };
  123256. ModelExperimental.fromGltf = function(options) {
  123257. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  123258. Check_default.defined("options.gltf", options.gltf);
  123259. const loaderOptions = {
  123260. releaseGltfJson: options.releaseGltfJson,
  123261. incrementallyLoadTextures: options.incrementallyLoadTextures,
  123262. upAxis: options.upAxis,
  123263. forwardAxis: options.forwardAxis
  123264. };
  123265. const gltf = options.gltf;
  123266. const basePath = defaultValue_default(options.basePath, "");
  123267. const baseResource2 = Resource_default.createIfNeeded(basePath);
  123268. if (defined_default(gltf.asset)) {
  123269. loaderOptions.gltfJson = gltf;
  123270. loaderOptions.baseResource = baseResource2;
  123271. loaderOptions.gltfResource = baseResource2;
  123272. } else if (gltf instanceof Uint8Array) {
  123273. loaderOptions.typedArray = gltf;
  123274. loaderOptions.baseResource = baseResource2;
  123275. loaderOptions.gltfResource = baseResource2;
  123276. } else {
  123277. loaderOptions.gltfResource = Resource_default.createIfNeeded(options.gltf);
  123278. }
  123279. const loader = new GltfLoader(loaderOptions);
  123280. const is3DTiles = defined_default(options.content);
  123281. const type = is3DTiles ? ModelExperimentalType_default.TILE_GLTF : ModelExperimentalType_default.GLTF;
  123282. const modelOptions = makeModelOptions(loader, type, options);
  123283. modelOptions.resource = loaderOptions.gltfResource;
  123284. const model = new ModelExperimental(modelOptions);
  123285. return model;
  123286. };
  123287. ModelExperimental.fromB3dm = function(options) {
  123288. const loaderOptions = {
  123289. b3dmResource: options.resource,
  123290. arrayBuffer: options.arrayBuffer,
  123291. byteOffset: options.byteOffset,
  123292. releaseGltfJson: options.releaseGltfJson,
  123293. incrementallyLoadTextures: options.incrementallyLoadTextures,
  123294. upAxis: options.upAxis,
  123295. forwardAxis: options.forwardAxis
  123296. };
  123297. const loader = new B3dmLoader_default(loaderOptions);
  123298. const modelOptions = makeModelOptions(
  123299. loader,
  123300. ModelExperimentalType_default.TILE_B3DM,
  123301. options
  123302. );
  123303. const model = new ModelExperimental(modelOptions);
  123304. return model;
  123305. };
  123306. ModelExperimental.fromPnts = function(options) {
  123307. const loaderOptions = {
  123308. arrayBuffer: options.arrayBuffer,
  123309. byteOffset: options.byteOffset
  123310. };
  123311. const loader = new PntsLoader(loaderOptions);
  123312. const modelOptions = makeModelOptions(
  123313. loader,
  123314. ModelExperimentalType_default.TILE_PNTS,
  123315. options
  123316. );
  123317. const model = new ModelExperimental(modelOptions);
  123318. return model;
  123319. };
  123320. ModelExperimental.fromI3dm = function(options) {
  123321. const loaderOptions = {
  123322. i3dmResource: options.resource,
  123323. arrayBuffer: options.arrayBuffer,
  123324. byteOffset: options.byteOffset,
  123325. releaseGltfJson: options.releaseGltfJson,
  123326. incrementallyLoadTextures: options.incrementallyLoadTextures,
  123327. upAxis: options.upAxis,
  123328. forwardAxis: options.forwardAxis
  123329. };
  123330. const loader = new I3dmLoader_default(loaderOptions);
  123331. const modelOptions = makeModelOptions(
  123332. loader,
  123333. ModelExperimentalType_default.TILE_I3DM,
  123334. options
  123335. );
  123336. const model = new ModelExperimental(modelOptions);
  123337. return model;
  123338. };
  123339. function updateShowBoundingVolume3(sceneGraph, debugShowBoundingVolume2) {
  123340. const drawCommands = sceneGraph._drawCommands;
  123341. for (let i2 = 0; i2 < drawCommands.length; i2++) {
  123342. drawCommands[i2].debugShowBoundingVolume = debugShowBoundingVolume2;
  123343. }
  123344. }
  123345. ModelExperimental.prototype.applyColorAndShow = function(style) {
  123346. const hasColorStyle = defined_default(style) && defined_default(style.color);
  123347. const hasShowStyle = defined_default(style) && defined_default(style.show);
  123348. this._color = hasColorStyle ? style.color.evaluateColor(void 0, this._color) : Color_default.clone(Color_default.WHITE, this._color);
  123349. this._show = hasShowStyle ? style.show.evaluate(void 0) : true;
  123350. };
  123351. ModelExperimental.prototype.applyStyle = function(style) {
  123352. if (defined_default(this.featureTableId) && this.featureTables[this.featureTableId].featuresLength > 0) {
  123353. const featureTable = this.featureTables[this.featureTableId];
  123354. featureTable.applyStyle(style);
  123355. } else {
  123356. this.applyColorAndShow(style);
  123357. }
  123358. this.resetDrawCommands();
  123359. };
  123360. function makeModelOptions(loader, modelType, options) {
  123361. return {
  123362. loader,
  123363. type: modelType,
  123364. resource: options.resource,
  123365. modelMatrix: options.modelMatrix,
  123366. scale: options.scale,
  123367. minimumPixelSize: options.minimumPixelSize,
  123368. maximumScale: options.maximumScale,
  123369. debugShowBoundingVolume: options.debugShowBoundingVolume,
  123370. debugWireframe: options.debugWireframe,
  123371. cull: options.cull,
  123372. opaquePass: options.opaquePass,
  123373. allowPicking: options.allowPicking,
  123374. customShader: options.customShader,
  123375. content: options.content,
  123376. show: options.show,
  123377. color: options.color,
  123378. colorBlendAmount: options.colorBlendAmount,
  123379. colorBlendMode: options.colorBlendMode,
  123380. featureIdLabel: options.featureIdLabel,
  123381. instanceFeatureIdLabel: options.instanceFeatureIdLabel,
  123382. pointCloudShading: options.pointCloudShading,
  123383. clippingPlanes: options.clippingPlanes,
  123384. lightColor: options.lightColor,
  123385. imageBasedLighting: options.imageBasedLighting,
  123386. backFaceCulling: options.backFaceCulling,
  123387. shadows: options.shadows,
  123388. showCreditsOnScreen: options.showCreditsOnScreen,
  123389. splitDirection: options.splitDirection
  123390. };
  123391. }
  123392. // node_modules/cesium/Source/Scene/ModelExperimental/ModelExperimental3DTileContent.js
  123393. function ModelExperimental3DTileContent(tileset, tile, resource) {
  123394. this._tileset = tileset;
  123395. this._tile = tile;
  123396. this._resource = resource;
  123397. this._model = void 0;
  123398. this._metadata = void 0;
  123399. this._group = void 0;
  123400. }
  123401. Object.defineProperties(ModelExperimental3DTileContent.prototype, {
  123402. featuresLength: {
  123403. get: function() {
  123404. const model = this._model;
  123405. const featureTables = model.featureTables;
  123406. const featureTableId = model.featureTableId;
  123407. if (defined_default(featureTables) && defined_default(featureTables[featureTableId])) {
  123408. return featureTables[featureTableId].featuresLength;
  123409. }
  123410. return 0;
  123411. }
  123412. },
  123413. pointsLength: {
  123414. get: function() {
  123415. return 0;
  123416. }
  123417. },
  123418. trianglesLength: {
  123419. get: function() {
  123420. return 0;
  123421. }
  123422. },
  123423. geometryByteLength: {
  123424. get: function() {
  123425. return 0;
  123426. }
  123427. },
  123428. texturesByteLength: {
  123429. get: function() {
  123430. return 0;
  123431. }
  123432. },
  123433. batchTableByteLength: {
  123434. get: function() {
  123435. return 0;
  123436. }
  123437. },
  123438. innerContents: {
  123439. get: function() {
  123440. return void 0;
  123441. }
  123442. },
  123443. readyPromise: {
  123444. get: function() {
  123445. return this._model.readyPromise;
  123446. }
  123447. },
  123448. tileset: {
  123449. get: function() {
  123450. return this._tileset;
  123451. }
  123452. },
  123453. tile: {
  123454. get: function() {
  123455. return this._tile;
  123456. }
  123457. },
  123458. url: {
  123459. get: function() {
  123460. return this._resource.getUrlComponent(true);
  123461. }
  123462. },
  123463. batchTable: {
  123464. get: function() {
  123465. const model = this._model;
  123466. const featureTables = model.featureTables;
  123467. const featureTableId = model.featureTableId;
  123468. if (defined_default(featureTables) && defined_default(featureTables[featureTableId])) {
  123469. return featureTables[featureTableId];
  123470. }
  123471. return void 0;
  123472. }
  123473. },
  123474. metadata: {
  123475. get: function() {
  123476. return this._metadata;
  123477. },
  123478. set: function(value) {
  123479. this._metadata = value;
  123480. }
  123481. },
  123482. group: {
  123483. get: function() {
  123484. return this._group;
  123485. },
  123486. set: function(value) {
  123487. this._group = value;
  123488. }
  123489. }
  123490. });
  123491. ModelExperimental3DTileContent.prototype.getFeature = function(featureId) {
  123492. const model = this._model;
  123493. const featureTableId = model.featureTableId;
  123494. if (!defined_default(featureTableId)) {
  123495. return void 0;
  123496. }
  123497. const featureTable = model.featureTables[featureTableId];
  123498. return featureTable.getFeature(featureId);
  123499. };
  123500. ModelExperimental3DTileContent.prototype.hasProperty = function(featureId, name) {
  123501. const model = this._model;
  123502. const featureTableId = model.featureTableId;
  123503. if (!defined_default(featureTableId)) {
  123504. return false;
  123505. }
  123506. const featureTable = model.featureTables[featureTableId];
  123507. return featureTable.hasProperty(featureId, name);
  123508. };
  123509. ModelExperimental3DTileContent.prototype.applyDebugSettings = function(enabled, color) {
  123510. color = enabled ? color : Color_default.WHITE;
  123511. if (this.featuresLength === 0) {
  123512. this._model.color = color;
  123513. } else if (defined_default(this.batchTable)) {
  123514. this.batchTable.setAllColor(color);
  123515. }
  123516. };
  123517. ModelExperimental3DTileContent.prototype.applyStyle = function(style) {
  123518. this._model.style = style;
  123519. };
  123520. ModelExperimental3DTileContent.prototype.update = function(tileset, frameState) {
  123521. const model = this._model;
  123522. const tile = this._tile;
  123523. model.colorBlendAmount = tileset.colorBlendAmount;
  123524. model.colorBlendMode = tileset.colorBlendMode;
  123525. model.modelMatrix = tile.computedTransform;
  123526. model.customShader = tileset.customShader;
  123527. model.pointCloudShading = tileset.pointCloudShading;
  123528. model.featureIdLabel = tileset.featureIdLabel;
  123529. model.instanceFeatureIdLabel = tileset.instanceFeatureIdLabel;
  123530. model.lightColor = tileset.lightColor;
  123531. model.imageBasedLighting = tileset.imageBasedLighting;
  123532. model.backFaceCulling = tileset.backFaceCulling;
  123533. model.shadows = tileset.shadows;
  123534. model.showCreditsOnScreen = tileset.showCreditsOnScreen;
  123535. model.splitDirection = tileset.splitDirection;
  123536. model.debugWireframe = tileset.debugWireframe;
  123537. const tilesetClippingPlanes = tileset.clippingPlanes;
  123538. model.referenceMatrix = tileset.clippingPlanesOriginMatrix;
  123539. if (defined_default(tilesetClippingPlanes) && tile.clippingPlanesDirty) {
  123540. model._clippingPlanes = tilesetClippingPlanes.enabled && tile._isClipped ? tilesetClippingPlanes : void 0;
  123541. }
  123542. if (defined_default(tilesetClippingPlanes) && defined_default(model._clippingPlanes) && model._clippingPlanes !== tilesetClippingPlanes) {
  123543. model._clippingPlanes = tilesetClippingPlanes;
  123544. }
  123545. model.update(frameState);
  123546. };
  123547. ModelExperimental3DTileContent.prototype.isDestroyed = function() {
  123548. return false;
  123549. };
  123550. ModelExperimental3DTileContent.prototype.destroy = function() {
  123551. this._model = this._model && this._model.destroy();
  123552. return destroyObject_default(this);
  123553. };
  123554. ModelExperimental3DTileContent.fromGltf = function(tileset, tile, resource, gltf) {
  123555. const content = new ModelExperimental3DTileContent(tileset, tile, resource);
  123556. const additionalOptions = {
  123557. gltf,
  123558. basePath: resource
  123559. };
  123560. const modelOptions = makeModelOptions2(
  123561. tileset,
  123562. tile,
  123563. content,
  123564. additionalOptions
  123565. );
  123566. content._model = ModelExperimental.fromGltf(modelOptions);
  123567. return content;
  123568. };
  123569. ModelExperimental3DTileContent.fromB3dm = function(tileset, tile, resource, arrayBuffer, byteOffset) {
  123570. const content = new ModelExperimental3DTileContent(tileset, tile, resource);
  123571. const additionalOptions = {
  123572. arrayBuffer,
  123573. byteOffset,
  123574. resource
  123575. };
  123576. const modelOptions = makeModelOptions2(
  123577. tileset,
  123578. tile,
  123579. content,
  123580. additionalOptions
  123581. );
  123582. content._model = ModelExperimental.fromB3dm(modelOptions);
  123583. return content;
  123584. };
  123585. ModelExperimental3DTileContent.fromI3dm = function(tileset, tile, resource, arrayBuffer, byteOffset) {
  123586. const content = new ModelExperimental3DTileContent(tileset, tile, resource);
  123587. const additionalOptions = {
  123588. arrayBuffer,
  123589. byteOffset,
  123590. resource
  123591. };
  123592. const modelOptions = makeModelOptions2(
  123593. tileset,
  123594. tile,
  123595. content,
  123596. additionalOptions
  123597. );
  123598. content._model = ModelExperimental.fromI3dm(modelOptions);
  123599. return content;
  123600. };
  123601. ModelExperimental3DTileContent.fromPnts = function(tileset, tile, resource, arrayBuffer, byteOffset) {
  123602. const content = new ModelExperimental3DTileContent(tileset, tile, resource);
  123603. const additionalOptions = {
  123604. arrayBuffer,
  123605. byteOffset,
  123606. resource
  123607. };
  123608. const modelOptions = makeModelOptions2(
  123609. tileset,
  123610. tile,
  123611. content,
  123612. additionalOptions
  123613. );
  123614. content._model = ModelExperimental.fromPnts(modelOptions);
  123615. return content;
  123616. };
  123617. function makeModelOptions2(tileset, tile, content, additionalOptions) {
  123618. const mainOptions = {
  123619. cull: false,
  123620. releaseGltfJson: true,
  123621. opaquePass: Pass_default.CESIUM_3D_TILE,
  123622. modelMatrix: tile.computedTransform,
  123623. upAxis: tileset._gltfUpAxis,
  123624. forwardAxis: Axis_default.X,
  123625. incrementallyLoadTextures: false,
  123626. customShader: tileset.customShader,
  123627. content,
  123628. show: tileset.show,
  123629. colorBlendMode: tileset.colorBlendMode,
  123630. colorBlendAmount: tileset.colorBlendAmount,
  123631. lightColor: tileset.lightColor,
  123632. imageBasedLighting: tileset.imageBasedLighting,
  123633. featureIdLabel: tileset.featureIdLabel,
  123634. instanceFeatureIdLabel: tileset.instanceFeatureIdLabel,
  123635. pointCloudShading: tileset.pointCloudShading,
  123636. clippingPlanes: tileset.clippingPlanes,
  123637. backFaceCulling: tileset.backFaceCulling,
  123638. shadows: tileset.shadows,
  123639. showCreditsOnScreen: tileset.showCreditsOnScreen,
  123640. splitDirection: tileset.splitDirection,
  123641. debugWireframe: tileset.debugWireframe
  123642. };
  123643. return combine_default(additionalOptions, mainOptions);
  123644. }
  123645. // node_modules/cesium/Source/Scene/Cesium3DTileContentFactory.js
  123646. var Cesium3DTileContentFactory = {
  123647. b3dm: function(tileset, tile, resource, arrayBuffer, byteOffset) {
  123648. if (tileset.enableModelExperimental) {
  123649. return ModelExperimental3DTileContent.fromB3dm(
  123650. tileset,
  123651. tile,
  123652. resource,
  123653. arrayBuffer,
  123654. byteOffset
  123655. );
  123656. }
  123657. return new Batched3DModel3DTileContent_default(
  123658. tileset,
  123659. tile,
  123660. resource,
  123661. arrayBuffer,
  123662. byteOffset
  123663. );
  123664. },
  123665. pnts: function(tileset, tile, resource, arrayBuffer, byteOffset) {
  123666. if (tileset.enableModelExperimental) {
  123667. return ModelExperimental3DTileContent.fromPnts(
  123668. tileset,
  123669. tile,
  123670. resource,
  123671. arrayBuffer,
  123672. byteOffset
  123673. );
  123674. }
  123675. return new PointCloud3DTileContent_default(
  123676. tileset,
  123677. tile,
  123678. resource,
  123679. arrayBuffer,
  123680. byteOffset
  123681. );
  123682. },
  123683. i3dm: function(tileset, tile, resource, arrayBuffer, byteOffset) {
  123684. if (tileset.enableModelExperimental) {
  123685. return ModelExperimental3DTileContent.fromI3dm(
  123686. tileset,
  123687. tile,
  123688. resource,
  123689. arrayBuffer,
  123690. byteOffset
  123691. );
  123692. }
  123693. return new Instanced3DModel3DTileContent_default(
  123694. tileset,
  123695. tile,
  123696. resource,
  123697. arrayBuffer,
  123698. byteOffset
  123699. );
  123700. },
  123701. cmpt: function(tileset, tile, resource, arrayBuffer, byteOffset) {
  123702. return new Composite3DTileContent_default(
  123703. tileset,
  123704. tile,
  123705. resource,
  123706. arrayBuffer,
  123707. byteOffset,
  123708. Cesium3DTileContentFactory
  123709. );
  123710. },
  123711. externalTileset: function(tileset, tile, resource, json) {
  123712. return new Tileset3DTileContent_default(tileset, tile, resource, json);
  123713. },
  123714. geom: function(tileset, tile, resource, arrayBuffer, byteOffset) {
  123715. return new Geometry3DTileContent_default(
  123716. tileset,
  123717. tile,
  123718. resource,
  123719. arrayBuffer,
  123720. byteOffset
  123721. );
  123722. },
  123723. vctr: function(tileset, tile, resource, arrayBuffer, byteOffset) {
  123724. return new Vector3DTileContent_default(
  123725. tileset,
  123726. tile,
  123727. resource,
  123728. arrayBuffer,
  123729. byteOffset
  123730. );
  123731. },
  123732. subt: function(tileset, tile, resource, arrayBuffer, byteOffset) {
  123733. return new Implicit3DTileContent(
  123734. tileset,
  123735. tile,
  123736. resource,
  123737. void 0,
  123738. arrayBuffer,
  123739. byteOffset
  123740. );
  123741. },
  123742. subtreeJson: function(tileset, tile, resource, json) {
  123743. return new Implicit3DTileContent(tileset, tile, resource, json);
  123744. },
  123745. glb: function(tileset, tile, resource, arrayBuffer, byteOffset) {
  123746. const arrayBufferByteLength = arrayBuffer.byteLength;
  123747. if (arrayBufferByteLength < 12) {
  123748. throw new RuntimeError_default("Invalid glb content");
  123749. }
  123750. const dataView = new DataView(arrayBuffer, byteOffset);
  123751. const byteLength = dataView.getUint32(8, true);
  123752. const glb = new Uint8Array(arrayBuffer, byteOffset, byteLength);
  123753. return ModelExperimental3DTileContent.fromGltf(
  123754. tileset,
  123755. tile,
  123756. resource,
  123757. glb
  123758. );
  123759. },
  123760. gltf: function(tileset, tile, resource, json) {
  123761. return ModelExperimental3DTileContent.fromGltf(
  123762. tileset,
  123763. tile,
  123764. resource,
  123765. json
  123766. );
  123767. }
  123768. };
  123769. var Cesium3DTileContentFactory_default = Cesium3DTileContentFactory;
  123770. // node_modules/cesium/Source/Scene/Cesium3DTileContentState.js
  123771. var Cesium3DTileContentState = {
  123772. UNLOADED: 0,
  123773. LOADING: 1,
  123774. PROCESSING: 2,
  123775. READY: 3,
  123776. EXPIRED: 4,
  123777. FAILED: 5
  123778. };
  123779. var Cesium3DTileContentState_default = Object.freeze(Cesium3DTileContentState);
  123780. // node_modules/cesium/Source/Scene/Cesium3DTileContentType.js
  123781. var Cesium3DTileContentType = {
  123782. BATCHED_3D_MODEL: "b3dm",
  123783. INSTANCED_3D_MODEL: "i3dm",
  123784. COMPOSITE: "cmpt",
  123785. POINT_CLOUD: "pnts",
  123786. VECTOR: "vctr",
  123787. GEOMETRY: "geom",
  123788. GLTF: "gltf",
  123789. GLTF_BINARY: "glb",
  123790. IMPLICIT_SUBTREE: "subt",
  123791. IMPLICIT_SUBTREE_JSON: "subtreeJson",
  123792. EXTERNAL_TILESET: "externalTileset",
  123793. MULTIPLE_CONTENT: "multipleContent"
  123794. };
  123795. Cesium3DTileContentType.isBinaryFormat = function(contentType) {
  123796. switch (contentType) {
  123797. case Cesium3DTileContentType.BATCHED_3D_MODEL:
  123798. case Cesium3DTileContentType.INSTANCED_3D_MODEL:
  123799. case Cesium3DTileContentType.COMPOSITE:
  123800. case Cesium3DTileContentType.POINT_CLOUD:
  123801. case Cesium3DTileContentType.VECTOR:
  123802. case Cesium3DTileContentType.GEOMETRY:
  123803. case Cesium3DTileContentType.IMPLICIT_SUBTREE:
  123804. case Cesium3DTileContentType.GLTF_BINARY:
  123805. return true;
  123806. default:
  123807. return false;
  123808. }
  123809. };
  123810. var Cesium3DTileContentType_default = Object.freeze(Cesium3DTileContentType);
  123811. // node_modules/cesium/Source/Scene/Cesium3DTileOptimizationHint.js
  123812. var Cesium3DTileOptimizationHint = {
  123813. NOT_COMPUTED: -1,
  123814. USE_OPTIMIZATION: 1,
  123815. SKIP_OPTIMIZATION: 0
  123816. };
  123817. var Cesium3DTileOptimizationHint_default = Object.freeze(Cesium3DTileOptimizationHint);
  123818. // node_modules/cesium/Source/Scene/Cesium3DTilesetMostDetailedTraversal.js
  123819. function Cesium3DTilesetMostDetailedTraversal() {
  123820. }
  123821. var traversal = {
  123822. stack: new ManagedArray_default(),
  123823. stackMaximumLength: 0
  123824. };
  123825. Cesium3DTilesetMostDetailedTraversal.selectTiles = function(tileset, frameState) {
  123826. tileset._selectedTiles.length = 0;
  123827. tileset._requestedTiles.length = 0;
  123828. tileset._hasMixedContent = false;
  123829. let ready = true;
  123830. const root = tileset.root;
  123831. root.updateVisibility(frameState);
  123832. if (!isVisible(root)) {
  123833. return ready;
  123834. }
  123835. const stack = traversal.stack;
  123836. stack.push(tileset.root);
  123837. while (stack.length > 0) {
  123838. traversal.stackMaximumLength = Math.max(
  123839. traversal.stackMaximumLength,
  123840. stack.length
  123841. );
  123842. const tile = stack.pop();
  123843. const add2 = tile.refine === Cesium3DTileRefine_default.ADD;
  123844. const replace = tile.refine === Cesium3DTileRefine_default.REPLACE;
  123845. const traverse = canTraverse(tileset, tile);
  123846. if (traverse) {
  123847. updateAndPushChildren(tileset, tile, stack, frameState);
  123848. }
  123849. if (add2 || replace && !traverse) {
  123850. loadTile(tileset, tile);
  123851. touchTile(tileset, tile, frameState);
  123852. selectDesiredTile(tileset, tile, frameState);
  123853. if (!hasEmptyContent(tile) && !tile.contentAvailable) {
  123854. ready = false;
  123855. }
  123856. }
  123857. visitTile(tileset);
  123858. }
  123859. traversal.stack.trim(traversal.stackMaximumLength);
  123860. return ready;
  123861. };
  123862. function isVisible(tile) {
  123863. return tile._visible && tile._inRequestVolume;
  123864. }
  123865. function hasEmptyContent(tile) {
  123866. return tile.hasEmptyContent || tile.hasTilesetContent || tile.hasImplicitContent;
  123867. }
  123868. function hasUnloadedContent(tile) {
  123869. return !hasEmptyContent(tile) && tile.contentUnloaded;
  123870. }
  123871. function canTraverse(tileset, tile) {
  123872. if (tile.children.length === 0) {
  123873. return false;
  123874. }
  123875. if (tile.hasTilesetContent || tile.hasImplicitContent) {
  123876. return !tile.contentExpired;
  123877. }
  123878. if (tile.hasEmptyContent) {
  123879. return true;
  123880. }
  123881. return true;
  123882. }
  123883. function updateAndPushChildren(tileset, tile, stack, frameState) {
  123884. const children = tile.children;
  123885. const length3 = children.length;
  123886. for (let i2 = 0; i2 < length3; ++i2) {
  123887. const child = children[i2];
  123888. child.updateVisibility(frameState);
  123889. if (isVisible(child)) {
  123890. stack.push(child);
  123891. }
  123892. }
  123893. }
  123894. function loadTile(tileset, tile) {
  123895. if (hasUnloadedContent(tile) || tile.contentExpired) {
  123896. tile._priority = 0;
  123897. tileset._requestedTiles.push(tile);
  123898. }
  123899. }
  123900. function touchTile(tileset, tile, frameState) {
  123901. if (tile._touchedFrame === frameState.frameNumber) {
  123902. return;
  123903. }
  123904. tileset._cache.touch(tile);
  123905. tile._touchedFrame = frameState.frameNumber;
  123906. }
  123907. function visitTile(tileset) {
  123908. ++tileset.statistics.visited;
  123909. }
  123910. function selectDesiredTile(tileset, tile, frameState) {
  123911. if (tile.contentAvailable && tile.contentVisibility(frameState) !== Intersect_default.OUTSIDE) {
  123912. tileset._selectedTiles.push(tile);
  123913. }
  123914. }
  123915. var Cesium3DTilesetMostDetailedTraversal_default = Cesium3DTilesetMostDetailedTraversal;
  123916. // node_modules/cesium/Source/Scene/Cesium3DTilesetTraversal.js
  123917. function Cesium3DTilesetTraversal() {
  123918. }
  123919. function isVisible2(tile) {
  123920. return tile._visible && tile._inRequestVolume;
  123921. }
  123922. var traversal2 = {
  123923. stack: new ManagedArray_default(),
  123924. stackMaximumLength: 0
  123925. };
  123926. var emptyTraversal = {
  123927. stack: new ManagedArray_default(),
  123928. stackMaximumLength: 0
  123929. };
  123930. var descendantTraversal = {
  123931. stack: new ManagedArray_default(),
  123932. stackMaximumLength: 0
  123933. };
  123934. var selectionTraversal = {
  123935. stack: new ManagedArray_default(),
  123936. stackMaximumLength: 0,
  123937. ancestorStack: new ManagedArray_default(),
  123938. ancestorStackMaximumLength: 0
  123939. };
  123940. var descendantSelectionDepth = 2;
  123941. Cesium3DTilesetTraversal.selectTiles = function(tileset, frameState) {
  123942. tileset._requestedTiles.length = 0;
  123943. if (tileset.debugFreezeFrame) {
  123944. return;
  123945. }
  123946. tileset._selectedTiles.length = 0;
  123947. tileset._selectedTilesToStyle.length = 0;
  123948. tileset._emptyTiles.length = 0;
  123949. tileset._hasMixedContent = false;
  123950. const root = tileset.root;
  123951. updateTile(tileset, root, frameState);
  123952. if (!isVisible2(root)) {
  123953. return;
  123954. }
  123955. if (root.getScreenSpaceError(frameState, true) <= tileset._maximumScreenSpaceError) {
  123956. return;
  123957. }
  123958. if (!skipLevelOfDetail(tileset)) {
  123959. executeBaseTraversal(tileset, root, frameState);
  123960. } else if (tileset.immediatelyLoadDesiredLevelOfDetail) {
  123961. executeSkipTraversal(tileset, root, frameState);
  123962. } else {
  123963. executeBaseAndSkipTraversal(tileset, root, frameState);
  123964. }
  123965. traversal2.stack.trim(traversal2.stackMaximumLength);
  123966. emptyTraversal.stack.trim(emptyTraversal.stackMaximumLength);
  123967. descendantTraversal.stack.trim(descendantTraversal.stackMaximumLength);
  123968. selectionTraversal.stack.trim(selectionTraversal.stackMaximumLength);
  123969. selectionTraversal.ancestorStack.trim(
  123970. selectionTraversal.ancestorStackMaximumLength
  123971. );
  123972. const requestedTiles = tileset._requestedTiles;
  123973. const length3 = requestedTiles.length;
  123974. for (let i2 = 0; i2 < length3; ++i2) {
  123975. requestedTiles[i2].updatePriority();
  123976. }
  123977. };
  123978. function executeBaseTraversal(tileset, root, frameState) {
  123979. const baseScreenSpaceError = tileset._maximumScreenSpaceError;
  123980. const maximumScreenSpaceError = tileset._maximumScreenSpaceError;
  123981. executeTraversal(
  123982. tileset,
  123983. root,
  123984. baseScreenSpaceError,
  123985. maximumScreenSpaceError,
  123986. frameState
  123987. );
  123988. }
  123989. function executeSkipTraversal(tileset, root, frameState) {
  123990. const baseScreenSpaceError = Number.MAX_VALUE;
  123991. const maximumScreenSpaceError = tileset._maximumScreenSpaceError;
  123992. executeTraversal(
  123993. tileset,
  123994. root,
  123995. baseScreenSpaceError,
  123996. maximumScreenSpaceError,
  123997. frameState
  123998. );
  123999. traverseAndSelect(tileset, root, frameState);
  124000. }
  124001. function executeBaseAndSkipTraversal(tileset, root, frameState) {
  124002. const baseScreenSpaceError = Math.max(
  124003. tileset.baseScreenSpaceError,
  124004. tileset.maximumScreenSpaceError
  124005. );
  124006. const maximumScreenSpaceError = tileset.maximumScreenSpaceError;
  124007. executeTraversal(
  124008. tileset,
  124009. root,
  124010. baseScreenSpaceError,
  124011. maximumScreenSpaceError,
  124012. frameState
  124013. );
  124014. traverseAndSelect(tileset, root, frameState);
  124015. }
  124016. function skipLevelOfDetail(tileset) {
  124017. return tileset._skipLevelOfDetail;
  124018. }
  124019. function addEmptyTile(tileset, tile) {
  124020. tileset._emptyTiles.push(tile);
  124021. }
  124022. function selectTile(tileset, tile, frameState) {
  124023. if (tile.contentVisibility(frameState) !== Intersect_default.OUTSIDE) {
  124024. const tileContent = tile.content;
  124025. if (tileContent.featurePropertiesDirty) {
  124026. tileContent.featurePropertiesDirty = false;
  124027. tile.lastStyleTime = 0;
  124028. tileset._selectedTilesToStyle.push(tile);
  124029. } else if (tile._selectedFrame < frameState.frameNumber - 1) {
  124030. tileset._selectedTilesToStyle.push(tile);
  124031. }
  124032. tile._selectedFrame = frameState.frameNumber;
  124033. tileset._selectedTiles.push(tile);
  124034. }
  124035. }
  124036. function selectDescendants(tileset, root, frameState) {
  124037. const stack = descendantTraversal.stack;
  124038. stack.push(root);
  124039. while (stack.length > 0) {
  124040. descendantTraversal.stackMaximumLength = Math.max(
  124041. descendantTraversal.stackMaximumLength,
  124042. stack.length
  124043. );
  124044. const tile = stack.pop();
  124045. const children = tile.children;
  124046. const childrenLength = children.length;
  124047. for (let i2 = 0; i2 < childrenLength; ++i2) {
  124048. const child = children[i2];
  124049. if (isVisible2(child)) {
  124050. if (child.contentAvailable) {
  124051. updateTile(tileset, child, frameState);
  124052. touchTile2(tileset, child, frameState);
  124053. selectTile(tileset, child, frameState);
  124054. } else if (child._depth - root._depth < descendantSelectionDepth) {
  124055. stack.push(child);
  124056. }
  124057. }
  124058. }
  124059. }
  124060. }
  124061. function selectDesiredTile2(tileset, tile, frameState) {
  124062. if (!skipLevelOfDetail(tileset)) {
  124063. if (tile.contentAvailable) {
  124064. selectTile(tileset, tile, frameState);
  124065. }
  124066. return;
  124067. }
  124068. const loadedTile = tile.contentAvailable ? tile : tile._ancestorWithContentAvailable;
  124069. if (defined_default(loadedTile)) {
  124070. loadedTile._shouldSelect = true;
  124071. } else {
  124072. selectDescendants(tileset, tile, frameState);
  124073. }
  124074. }
  124075. function visitTile2(tileset, tile, frameState) {
  124076. ++tileset._statistics.visited;
  124077. tile._visitedFrame = frameState.frameNumber;
  124078. }
  124079. function touchTile2(tileset, tile, frameState) {
  124080. if (tile._touchedFrame === frameState.frameNumber) {
  124081. return;
  124082. }
  124083. tileset._cache.touch(tile);
  124084. tile._touchedFrame = frameState.frameNumber;
  124085. }
  124086. function updateMinimumMaximumPriority(tileset, tile) {
  124087. tileset._maximumPriority.distance = Math.max(
  124088. tile._priorityHolder._distanceToCamera,
  124089. tileset._maximumPriority.distance
  124090. );
  124091. tileset._minimumPriority.distance = Math.min(
  124092. tile._priorityHolder._distanceToCamera,
  124093. tileset._minimumPriority.distance
  124094. );
  124095. tileset._maximumPriority.depth = Math.max(
  124096. tile._depth,
  124097. tileset._maximumPriority.depth
  124098. );
  124099. tileset._minimumPriority.depth = Math.min(
  124100. tile._depth,
  124101. tileset._minimumPriority.depth
  124102. );
  124103. tileset._maximumPriority.foveatedFactor = Math.max(
  124104. tile._priorityHolder._foveatedFactor,
  124105. tileset._maximumPriority.foveatedFactor
  124106. );
  124107. tileset._minimumPriority.foveatedFactor = Math.min(
  124108. tile._priorityHolder._foveatedFactor,
  124109. tileset._minimumPriority.foveatedFactor
  124110. );
  124111. tileset._maximumPriority.reverseScreenSpaceError = Math.max(
  124112. tile._priorityReverseScreenSpaceError,
  124113. tileset._maximumPriority.reverseScreenSpaceError
  124114. );
  124115. tileset._minimumPriority.reverseScreenSpaceError = Math.min(
  124116. tile._priorityReverseScreenSpaceError,
  124117. tileset._minimumPriority.reverseScreenSpaceError
  124118. );
  124119. }
  124120. function isOnScreenLongEnough(tileset, tile, frameState) {
  124121. if (!tileset._cullRequestsWhileMoving) {
  124122. return true;
  124123. }
  124124. const sphere = tile.boundingSphere;
  124125. const diameter = Math.max(sphere.radius * 2, 1);
  124126. const camera = frameState.camera;
  124127. const deltaMagnitude = camera.positionWCDeltaMagnitude !== 0 ? camera.positionWCDeltaMagnitude : camera.positionWCDeltaMagnitudeLastFrame;
  124128. const movementRatio = tileset.cullRequestsWhileMovingMultiplier * deltaMagnitude / diameter;
  124129. return movementRatio < 1;
  124130. }
  124131. function loadTile2(tileset, tile, frameState) {
  124132. if (tile._requestedFrame === frameState.frameNumber || !hasUnloadedContent2(tile) && !tile.contentExpired) {
  124133. return;
  124134. }
  124135. if (!isOnScreenLongEnough(tileset, tile, frameState)) {
  124136. return;
  124137. }
  124138. const cameraHasNotStoppedMovingLongEnough = frameState.camera.timeSinceMoved < tileset.foveatedTimeDelay;
  124139. if (tile.priorityDeferred && cameraHasNotStoppedMovingLongEnough) {
  124140. return;
  124141. }
  124142. tile._requestedFrame = frameState.frameNumber;
  124143. tileset._requestedTiles.push(tile);
  124144. }
  124145. function updateVisibility(tileset, tile, frameState) {
  124146. if (tile._updatedVisibilityFrame === tileset._updatedVisibilityFrame) {
  124147. return;
  124148. }
  124149. tile.updateVisibility(frameState);
  124150. tile._updatedVisibilityFrame = tileset._updatedVisibilityFrame;
  124151. }
  124152. function anyChildrenVisible(tileset, tile, frameState) {
  124153. let anyVisible = false;
  124154. const children = tile.children;
  124155. const length3 = children.length;
  124156. for (let i2 = 0; i2 < length3; ++i2) {
  124157. const child = children[i2];
  124158. updateVisibility(tileset, child, frameState);
  124159. anyVisible = anyVisible || isVisible2(child);
  124160. }
  124161. return anyVisible;
  124162. }
  124163. function meetsScreenSpaceErrorEarly(tileset, tile, frameState) {
  124164. const parent = tile.parent;
  124165. if (!defined_default(parent) || parent.hasTilesetContent || parent.hasImplicitContent || parent.refine !== Cesium3DTileRefine_default.ADD) {
  124166. return false;
  124167. }
  124168. return tile.getScreenSpaceError(frameState, true) <= tileset._maximumScreenSpaceError;
  124169. }
  124170. function updateTileVisibility(tileset, tile, frameState) {
  124171. updateVisibility(tileset, tile, frameState);
  124172. if (!isVisible2(tile)) {
  124173. return;
  124174. }
  124175. const hasChildren = tile.children.length > 0;
  124176. if ((tile.hasTilesetContent || tile.hasImplicitContent) && hasChildren) {
  124177. const child = tile.children[0];
  124178. updateTileVisibility(tileset, child, frameState);
  124179. tile._visible = child._visible;
  124180. return;
  124181. }
  124182. if (meetsScreenSpaceErrorEarly(tileset, tile, frameState)) {
  124183. tile._visible = false;
  124184. return;
  124185. }
  124186. const replace = tile.refine === Cesium3DTileRefine_default.REPLACE;
  124187. const useOptimization = tile._optimChildrenWithinParent === Cesium3DTileOptimizationHint_default.USE_OPTIMIZATION;
  124188. if (replace && useOptimization && hasChildren) {
  124189. if (!anyChildrenVisible(tileset, tile, frameState)) {
  124190. ++tileset._statistics.numberOfTilesCulledWithChildrenUnion;
  124191. tile._visible = false;
  124192. return;
  124193. }
  124194. }
  124195. }
  124196. function updateTile(tileset, tile, frameState) {
  124197. updateTileVisibility(tileset, tile, frameState);
  124198. tile.updateExpiration();
  124199. tile._wasMinPriorityChild = false;
  124200. tile._priorityHolder = tile;
  124201. updateMinimumMaximumPriority(tileset, tile);
  124202. tile._shouldSelect = false;
  124203. tile._finalResolution = true;
  124204. }
  124205. function updateTileAncestorContentLinks(tile, frameState) {
  124206. tile._ancestorWithContent = void 0;
  124207. tile._ancestorWithContentAvailable = void 0;
  124208. const parent = tile.parent;
  124209. if (defined_default(parent)) {
  124210. const hasContent = !hasUnloadedContent2(parent) || parent._requestedFrame === frameState.frameNumber;
  124211. tile._ancestorWithContent = hasContent ? parent : parent._ancestorWithContent;
  124212. tile._ancestorWithContentAvailable = parent.contentAvailable ? parent : parent._ancestorWithContentAvailable;
  124213. }
  124214. }
  124215. function hasEmptyContent2(tile) {
  124216. return tile.hasEmptyContent || tile.hasTilesetContent || tile.hasImplicitContent;
  124217. }
  124218. function hasUnloadedContent2(tile) {
  124219. return !hasEmptyContent2(tile) && tile.contentUnloaded;
  124220. }
  124221. function reachedSkippingThreshold(tileset, tile) {
  124222. const ancestor = tile._ancestorWithContent;
  124223. return !tileset.immediatelyLoadDesiredLevelOfDetail && (tile._priorityProgressiveResolutionScreenSpaceErrorLeaf || defined_default(ancestor) && tile._screenSpaceError < ancestor._screenSpaceError / tileset.skipScreenSpaceErrorFactor && tile._depth > ancestor._depth + tileset.skipLevels);
  124224. }
  124225. function sortChildrenByDistanceToCamera(a4, b) {
  124226. if (b._distanceToCamera === 0 && a4._distanceToCamera === 0) {
  124227. return b._centerZDepth - a4._centerZDepth;
  124228. }
  124229. return b._distanceToCamera - a4._distanceToCamera;
  124230. }
  124231. function updateAndPushChildren2(tileset, tile, stack, frameState) {
  124232. let i2;
  124233. const replace = tile.refine === Cesium3DTileRefine_default.REPLACE;
  124234. const children = tile.children;
  124235. const length3 = children.length;
  124236. for (i2 = 0; i2 < length3; ++i2) {
  124237. updateTile(tileset, children[i2], frameState);
  124238. }
  124239. children.sort(sortChildrenByDistanceToCamera);
  124240. const checkRefines = !skipLevelOfDetail(tileset) && replace && !hasEmptyContent2(tile);
  124241. let refines = true;
  124242. let anyChildrenVisible2 = false;
  124243. let minIndex = -1;
  124244. let minimumPriority = Number.MAX_VALUE;
  124245. let child;
  124246. for (i2 = 0; i2 < length3; ++i2) {
  124247. child = children[i2];
  124248. if (isVisible2(child)) {
  124249. stack.push(child);
  124250. if (child._foveatedFactor < minimumPriority) {
  124251. minIndex = i2;
  124252. minimumPriority = child._foveatedFactor;
  124253. }
  124254. anyChildrenVisible2 = true;
  124255. } else if (checkRefines || tileset.loadSiblings) {
  124256. if (child._foveatedFactor < minimumPriority) {
  124257. minIndex = i2;
  124258. minimumPriority = child._foveatedFactor;
  124259. }
  124260. loadTile2(tileset, child, frameState);
  124261. touchTile2(tileset, child, frameState);
  124262. }
  124263. if (checkRefines) {
  124264. let childRefines;
  124265. if (!child._inRequestVolume) {
  124266. childRefines = false;
  124267. } else if (hasEmptyContent2(child)) {
  124268. childRefines = executeEmptyTraversal(tileset, child, frameState);
  124269. } else {
  124270. childRefines = child.contentAvailable;
  124271. }
  124272. refines = refines && childRefines;
  124273. }
  124274. }
  124275. if (!anyChildrenVisible2) {
  124276. refines = false;
  124277. }
  124278. if (minIndex !== -1 && !skipLevelOfDetail(tileset) && replace) {
  124279. const minPriorityChild = children[minIndex];
  124280. minPriorityChild._wasMinPriorityChild = true;
  124281. const priorityHolder = (tile._wasMinPriorityChild || tile === tileset.root) && minimumPriority <= tile._priorityHolder._foveatedFactor ? tile._priorityHolder : tile;
  124282. priorityHolder._foveatedFactor = Math.min(
  124283. minPriorityChild._foveatedFactor,
  124284. priorityHolder._foveatedFactor
  124285. );
  124286. priorityHolder._distanceToCamera = Math.min(
  124287. minPriorityChild._distanceToCamera,
  124288. priorityHolder._distanceToCamera
  124289. );
  124290. for (i2 = 0; i2 < length3; ++i2) {
  124291. child = children[i2];
  124292. child._priorityHolder = priorityHolder;
  124293. }
  124294. }
  124295. return refines;
  124296. }
  124297. function inBaseTraversal(tileset, tile, baseScreenSpaceError) {
  124298. if (!skipLevelOfDetail(tileset)) {
  124299. return true;
  124300. }
  124301. if (tileset.immediatelyLoadDesiredLevelOfDetail) {
  124302. return false;
  124303. }
  124304. if (!defined_default(tile._ancestorWithContent)) {
  124305. return true;
  124306. }
  124307. if (tile._screenSpaceError === 0) {
  124308. return tile.parent._screenSpaceError > baseScreenSpaceError;
  124309. }
  124310. return tile._screenSpaceError > baseScreenSpaceError;
  124311. }
  124312. function canTraverse2(tileset, tile) {
  124313. if (tile.children.length === 0) {
  124314. return false;
  124315. }
  124316. if (tile.hasTilesetContent || tile.hasImplicitContent) {
  124317. return !tile.contentExpired;
  124318. }
  124319. return tile._screenSpaceError > tileset._maximumScreenSpaceError;
  124320. }
  124321. function executeTraversal(tileset, root, baseScreenSpaceError, maximumScreenSpaceError, frameState) {
  124322. const stack = traversal2.stack;
  124323. stack.push(root);
  124324. while (stack.length > 0) {
  124325. traversal2.stackMaximumLength = Math.max(
  124326. traversal2.stackMaximumLength,
  124327. stack.length
  124328. );
  124329. const tile = stack.pop();
  124330. updateTileAncestorContentLinks(tile, frameState);
  124331. const baseTraversal = inBaseTraversal(tileset, tile, baseScreenSpaceError);
  124332. const add2 = tile.refine === Cesium3DTileRefine_default.ADD;
  124333. const replace = tile.refine === Cesium3DTileRefine_default.REPLACE;
  124334. const parent = tile.parent;
  124335. const parentRefines = !defined_default(parent) || parent._refines;
  124336. let refines = false;
  124337. if (canTraverse2(tileset, tile)) {
  124338. refines = updateAndPushChildren2(tileset, tile, stack, frameState) && parentRefines;
  124339. }
  124340. const stoppedRefining = !refines && parentRefines;
  124341. if (hasEmptyContent2(tile)) {
  124342. addEmptyTile(tileset, tile, frameState);
  124343. loadTile2(tileset, tile, frameState);
  124344. if (stoppedRefining) {
  124345. selectDesiredTile2(tileset, tile, frameState);
  124346. }
  124347. } else if (add2) {
  124348. selectDesiredTile2(tileset, tile, frameState);
  124349. loadTile2(tileset, tile, frameState);
  124350. } else if (replace) {
  124351. if (baseTraversal) {
  124352. loadTile2(tileset, tile, frameState);
  124353. if (stoppedRefining) {
  124354. selectDesiredTile2(tileset, tile, frameState);
  124355. }
  124356. } else if (stoppedRefining) {
  124357. selectDesiredTile2(tileset, tile, frameState);
  124358. loadTile2(tileset, tile, frameState);
  124359. } else if (reachedSkippingThreshold(tileset, tile)) {
  124360. loadTile2(tileset, tile, frameState);
  124361. }
  124362. }
  124363. visitTile2(tileset, tile, frameState);
  124364. touchTile2(tileset, tile, frameState);
  124365. tile._refines = refines;
  124366. }
  124367. }
  124368. function executeEmptyTraversal(tileset, root, frameState) {
  124369. let allDescendantsLoaded = true;
  124370. const stack = emptyTraversal.stack;
  124371. stack.push(root);
  124372. while (stack.length > 0) {
  124373. emptyTraversal.stackMaximumLength = Math.max(
  124374. emptyTraversal.stackMaximumLength,
  124375. stack.length
  124376. );
  124377. const tile = stack.pop();
  124378. const children = tile.children;
  124379. const childrenLength = children.length;
  124380. const emptyContent = hasEmptyContent2(tile);
  124381. const traverse = emptyContent && canTraverse2(tileset, tile);
  124382. const emptyLeaf = emptyContent && tile.children.length === 0;
  124383. if (!traverse && !tile.contentAvailable && !emptyLeaf) {
  124384. allDescendantsLoaded = false;
  124385. }
  124386. updateTile(tileset, tile, frameState);
  124387. if (!isVisible2(tile)) {
  124388. loadTile2(tileset, tile, frameState);
  124389. touchTile2(tileset, tile, frameState);
  124390. }
  124391. if (traverse) {
  124392. for (let i2 = 0; i2 < childrenLength; ++i2) {
  124393. const child = children[i2];
  124394. stack.push(child);
  124395. }
  124396. }
  124397. }
  124398. return allDescendantsLoaded;
  124399. }
  124400. function traverseAndSelect(tileset, root, frameState) {
  124401. const stack = selectionTraversal.stack;
  124402. const ancestorStack = selectionTraversal.ancestorStack;
  124403. let lastAncestor;
  124404. stack.push(root);
  124405. while (stack.length > 0 || ancestorStack.length > 0) {
  124406. selectionTraversal.stackMaximumLength = Math.max(
  124407. selectionTraversal.stackMaximumLength,
  124408. stack.length
  124409. );
  124410. selectionTraversal.ancestorStackMaximumLength = Math.max(
  124411. selectionTraversal.ancestorStackMaximumLength,
  124412. ancestorStack.length
  124413. );
  124414. if (ancestorStack.length > 0) {
  124415. const waitingTile = ancestorStack.peek();
  124416. if (waitingTile._stackLength === stack.length) {
  124417. ancestorStack.pop();
  124418. if (waitingTile !== lastAncestor) {
  124419. waitingTile._finalResolution = false;
  124420. }
  124421. selectTile(tileset, waitingTile, frameState);
  124422. continue;
  124423. }
  124424. }
  124425. const tile = stack.pop();
  124426. if (!defined_default(tile)) {
  124427. continue;
  124428. }
  124429. const add2 = tile.refine === Cesium3DTileRefine_default.ADD;
  124430. const shouldSelect = tile._shouldSelect;
  124431. const children = tile.children;
  124432. const childrenLength = children.length;
  124433. const traverse = canTraverse2(tileset, tile);
  124434. if (shouldSelect) {
  124435. if (add2) {
  124436. selectTile(tileset, tile, frameState);
  124437. } else {
  124438. tile._selectionDepth = ancestorStack.length;
  124439. if (tile._selectionDepth > 0) {
  124440. tileset._hasMixedContent = true;
  124441. }
  124442. lastAncestor = tile;
  124443. if (!traverse) {
  124444. selectTile(tileset, tile, frameState);
  124445. continue;
  124446. }
  124447. ancestorStack.push(tile);
  124448. tile._stackLength = stack.length;
  124449. }
  124450. }
  124451. if (traverse) {
  124452. for (let i2 = 0; i2 < childrenLength; ++i2) {
  124453. const child = children[i2];
  124454. if (isVisible2(child)) {
  124455. stack.push(child);
  124456. }
  124457. }
  124458. }
  124459. }
  124460. }
  124461. var Cesium3DTilesetTraversal_default = Cesium3DTilesetTraversal;
  124462. // node_modules/cesium/Source/Scene/Cesium3DTilePass.js
  124463. var Cesium3DTilePass = {
  124464. RENDER: 0,
  124465. PICK: 1,
  124466. SHADOW: 2,
  124467. PRELOAD: 3,
  124468. PRELOAD_FLIGHT: 4,
  124469. REQUEST_RENDER_MODE_DEFER_CHECK: 5,
  124470. MOST_DETAILED_PRELOAD: 6,
  124471. MOST_DETAILED_PICK: 7,
  124472. NUMBER_OF_PASSES: 8
  124473. };
  124474. var passOptions = new Array(Cesium3DTilePass.NUMBER_OF_PASSES);
  124475. passOptions[Cesium3DTilePass.RENDER] = Object.freeze({
  124476. traversal: Cesium3DTilesetTraversal_default,
  124477. isRender: true,
  124478. requestTiles: true,
  124479. ignoreCommands: false
  124480. });
  124481. passOptions[Cesium3DTilePass.PICK] = Object.freeze({
  124482. traversal: Cesium3DTilesetTraversal_default,
  124483. isRender: false,
  124484. requestTiles: false,
  124485. ignoreCommands: false
  124486. });
  124487. passOptions[Cesium3DTilePass.SHADOW] = Object.freeze({
  124488. traversal: Cesium3DTilesetTraversal_default,
  124489. isRender: false,
  124490. requestTiles: true,
  124491. ignoreCommands: false
  124492. });
  124493. passOptions[Cesium3DTilePass.PRELOAD] = Object.freeze({
  124494. traversal: Cesium3DTilesetTraversal_default,
  124495. isRender: false,
  124496. requestTiles: true,
  124497. ignoreCommands: true
  124498. });
  124499. passOptions[Cesium3DTilePass.PRELOAD_FLIGHT] = Object.freeze({
  124500. traversal: Cesium3DTilesetTraversal_default,
  124501. isRender: false,
  124502. requestTiles: true,
  124503. ignoreCommands: true
  124504. });
  124505. passOptions[Cesium3DTilePass.REQUEST_RENDER_MODE_DEFER_CHECK] = Object.freeze({
  124506. traversal: Cesium3DTilesetTraversal_default,
  124507. isRender: false,
  124508. requestTiles: true,
  124509. ignoreCommands: true
  124510. });
  124511. passOptions[Cesium3DTilePass.MOST_DETAILED_PRELOAD] = Object.freeze({
  124512. traversal: Cesium3DTilesetMostDetailedTraversal_default,
  124513. isRender: false,
  124514. requestTiles: true,
  124515. ignoreCommands: true
  124516. });
  124517. passOptions[Cesium3DTilePass.MOST_DETAILED_PICK] = Object.freeze({
  124518. traversal: Cesium3DTilesetMostDetailedTraversal_default,
  124519. isRender: false,
  124520. requestTiles: false,
  124521. ignoreCommands: false
  124522. });
  124523. Cesium3DTilePass.getPassOptions = function(pass) {
  124524. return passOptions[pass];
  124525. };
  124526. var Cesium3DTilePass_default = Object.freeze(Cesium3DTilePass);
  124527. // node_modules/cesium/Source/Scene/Empty3DTileContent.js
  124528. function Empty3DTileContent(tileset, tile) {
  124529. this._tileset = tileset;
  124530. this._tile = tile;
  124531. this.featurePropertiesDirty = false;
  124532. }
  124533. Object.defineProperties(Empty3DTileContent.prototype, {
  124534. featuresLength: {
  124535. get: function() {
  124536. return 0;
  124537. }
  124538. },
  124539. pointsLength: {
  124540. get: function() {
  124541. return 0;
  124542. }
  124543. },
  124544. trianglesLength: {
  124545. get: function() {
  124546. return 0;
  124547. }
  124548. },
  124549. geometryByteLength: {
  124550. get: function() {
  124551. return 0;
  124552. }
  124553. },
  124554. texturesByteLength: {
  124555. get: function() {
  124556. return 0;
  124557. }
  124558. },
  124559. batchTableByteLength: {
  124560. get: function() {
  124561. return 0;
  124562. }
  124563. },
  124564. innerContents: {
  124565. get: function() {
  124566. return void 0;
  124567. }
  124568. },
  124569. readyPromise: {
  124570. get: function() {
  124571. return void 0;
  124572. }
  124573. },
  124574. tileset: {
  124575. get: function() {
  124576. return this._tileset;
  124577. }
  124578. },
  124579. tile: {
  124580. get: function() {
  124581. return this._tile;
  124582. }
  124583. },
  124584. url: {
  124585. get: function() {
  124586. return void 0;
  124587. }
  124588. },
  124589. metadata: {
  124590. get: function() {
  124591. return void 0;
  124592. },
  124593. set: function(value) {
  124594. throw new DeveloperError_default(
  124595. "Empty3DTileContent cannot have content metadata"
  124596. );
  124597. }
  124598. },
  124599. batchTable: {
  124600. get: function() {
  124601. return void 0;
  124602. }
  124603. },
  124604. group: {
  124605. get: function() {
  124606. return void 0;
  124607. },
  124608. set: function(value) {
  124609. throw new DeveloperError_default("Empty3DTileContent cannot have group metadata");
  124610. }
  124611. }
  124612. });
  124613. Empty3DTileContent.prototype.hasProperty = function(batchId, name) {
  124614. return false;
  124615. };
  124616. Empty3DTileContent.prototype.getFeature = function(batchId) {
  124617. return void 0;
  124618. };
  124619. Empty3DTileContent.prototype.applyDebugSettings = function(enabled, color) {
  124620. };
  124621. Empty3DTileContent.prototype.applyStyle = function(style) {
  124622. };
  124623. Empty3DTileContent.prototype.update = function(tileset, frameState) {
  124624. };
  124625. Empty3DTileContent.prototype.isDestroyed = function() {
  124626. return false;
  124627. };
  124628. Empty3DTileContent.prototype.destroy = function() {
  124629. return destroyObject_default(this);
  124630. };
  124631. var Empty3DTileContent_default = Empty3DTileContent;
  124632. // node_modules/cesium/Source/Scene/ContentMetadata.js
  124633. function ContentMetadata(options) {
  124634. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  124635. const content = options.content;
  124636. const metadataClass = options.class;
  124637. Check_default.typeOf.object("options.content", content);
  124638. Check_default.typeOf.object("options.class", metadataClass);
  124639. this._class = metadataClass;
  124640. this._properties = content.properties;
  124641. this._extensions = content.extensions;
  124642. this._extras = content.extras;
  124643. }
  124644. Object.defineProperties(ContentMetadata.prototype, {
  124645. class: {
  124646. get: function() {
  124647. return this._class;
  124648. }
  124649. },
  124650. extras: {
  124651. get: function() {
  124652. return this._extras;
  124653. }
  124654. },
  124655. extensions: {
  124656. get: function() {
  124657. return this._extensions;
  124658. }
  124659. }
  124660. });
  124661. ContentMetadata.prototype.hasProperty = function(propertyId) {
  124662. return MetadataEntity_default.hasProperty(propertyId, this._properties, this._class);
  124663. };
  124664. ContentMetadata.prototype.hasPropertyBySemantic = function(semantic) {
  124665. return MetadataEntity_default.hasPropertyBySemantic(
  124666. semantic,
  124667. this._properties,
  124668. this._class
  124669. );
  124670. };
  124671. ContentMetadata.prototype.getPropertyIds = function(results) {
  124672. return MetadataEntity_default.getPropertyIds(this._properties, this._class, results);
  124673. };
  124674. ContentMetadata.prototype.getProperty = function(propertyId) {
  124675. return MetadataEntity_default.getProperty(propertyId, this._properties, this._class);
  124676. };
  124677. ContentMetadata.prototype.setProperty = function(propertyId, value) {
  124678. return MetadataEntity_default.setProperty(
  124679. propertyId,
  124680. value,
  124681. this._properties,
  124682. this._class
  124683. );
  124684. };
  124685. ContentMetadata.prototype.getPropertyBySemantic = function(semantic) {
  124686. return MetadataEntity_default.getPropertyBySemantic(
  124687. semantic,
  124688. this._properties,
  124689. this._class
  124690. );
  124691. };
  124692. ContentMetadata.prototype.setPropertyBySemantic = function(semantic, value) {
  124693. return MetadataEntity_default.setPropertyBySemantic(
  124694. semantic,
  124695. value,
  124696. this._properties,
  124697. this._class
  124698. );
  124699. };
  124700. // node_modules/cesium/Source/Scene/findContentMetadata.js
  124701. function findContentMetadata(tileset, contentHeader) {
  124702. const metadataJson = hasExtension(contentHeader, "3DTILES_metadata") ? contentHeader.extensions["3DTILES_metadata"] : contentHeader.metadata;
  124703. if (!defined_default(metadataJson)) {
  124704. return void 0;
  124705. }
  124706. const classes = tileset.schema.classes;
  124707. if (defined_default(metadataJson.class)) {
  124708. const contentClass = classes[metadataJson.class];
  124709. return new ContentMetadata({
  124710. content: metadataJson,
  124711. class: contentClass
  124712. });
  124713. }
  124714. return void 0;
  124715. }
  124716. // node_modules/cesium/Source/Scene/findGroupMetadata.js
  124717. function findGroupMetadata(tileset, contentHeader) {
  124718. const metadataExtension = tileset.metadataExtension;
  124719. if (!defined_default(metadataExtension)) {
  124720. return void 0;
  124721. }
  124722. const groups = metadataExtension.groups;
  124723. const group = hasExtension(contentHeader, "3DTILES_metadata") ? contentHeader.extensions["3DTILES_metadata"].group : contentHeader.group;
  124724. if (typeof group === "number") {
  124725. return groups[group];
  124726. }
  124727. const index2 = metadataExtension.groupIds.findIndex(function(id) {
  124728. return id === group;
  124729. });
  124730. return index2 >= 0 ? groups[index2] : void 0;
  124731. }
  124732. // node_modules/cesium/Source/Scene/TileMetadata.js
  124733. function TileMetadata(options) {
  124734. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  124735. const tile = options.tile;
  124736. const metadataClass = options.class;
  124737. Check_default.typeOf.object("options.tile", tile);
  124738. Check_default.typeOf.object("options.class", metadataClass);
  124739. this._class = metadataClass;
  124740. this._properties = tile.properties;
  124741. this._extensions = tile.extensions;
  124742. this._extras = tile.extras;
  124743. }
  124744. Object.defineProperties(TileMetadata.prototype, {
  124745. class: {
  124746. get: function() {
  124747. return this._class;
  124748. }
  124749. },
  124750. extras: {
  124751. get: function() {
  124752. return this._extras;
  124753. }
  124754. },
  124755. extensions: {
  124756. get: function() {
  124757. return this._extensions;
  124758. }
  124759. }
  124760. });
  124761. TileMetadata.prototype.hasProperty = function(propertyId) {
  124762. return MetadataEntity_default.hasProperty(propertyId, this._properties, this._class);
  124763. };
  124764. TileMetadata.prototype.hasPropertyBySemantic = function(semantic) {
  124765. return MetadataEntity_default.hasPropertyBySemantic(
  124766. semantic,
  124767. this._properties,
  124768. this._class
  124769. );
  124770. };
  124771. TileMetadata.prototype.getPropertyIds = function(results) {
  124772. return MetadataEntity_default.getPropertyIds(this._properties, this._class, results);
  124773. };
  124774. TileMetadata.prototype.getProperty = function(propertyId) {
  124775. return MetadataEntity_default.getProperty(propertyId, this._properties, this._class);
  124776. };
  124777. TileMetadata.prototype.setProperty = function(propertyId, value) {
  124778. return MetadataEntity_default.setProperty(
  124779. propertyId,
  124780. value,
  124781. this._properties,
  124782. this._class
  124783. );
  124784. };
  124785. TileMetadata.prototype.getPropertyBySemantic = function(semantic) {
  124786. return MetadataEntity_default.getPropertyBySemantic(
  124787. semantic,
  124788. this._properties,
  124789. this._class
  124790. );
  124791. };
  124792. TileMetadata.prototype.setPropertyBySemantic = function(semantic, value) {
  124793. return MetadataEntity_default.setPropertyBySemantic(
  124794. semantic,
  124795. value,
  124796. this._properties,
  124797. this._class
  124798. );
  124799. };
  124800. // node_modules/cesium/Source/Scene/findTileMetadata.js
  124801. function findTileMetadata(tileset, tileHeader) {
  124802. const metadataJson = hasExtension(tileHeader, "3DTILES_metadata") ? tileHeader.extensions["3DTILES_metadata"] : tileHeader.metadata;
  124803. if (!defined_default(metadataJson)) {
  124804. return void 0;
  124805. }
  124806. const classes = tileset.schema.classes;
  124807. if (defined_default(metadataJson.class)) {
  124808. const tileClass = classes[metadataJson.class];
  124809. return new TileMetadata({
  124810. tile: metadataJson,
  124811. class: tileClass
  124812. });
  124813. }
  124814. return void 0;
  124815. }
  124816. // node_modules/cesium/Source/Scene/preprocess3DTileContent.js
  124817. function preprocess3DTileContent(arrayBuffer) {
  124818. const uint8Array = new Uint8Array(arrayBuffer);
  124819. let contentType = getMagic_default(uint8Array);
  124820. if (contentType === "glTF") {
  124821. contentType = "glb";
  124822. }
  124823. if (Cesium3DTileContentType_default.isBinaryFormat(contentType)) {
  124824. return {
  124825. contentType,
  124826. binaryPayload: uint8Array
  124827. };
  124828. }
  124829. const json = getJsonContent(uint8Array);
  124830. if (defined_default(json.root)) {
  124831. return {
  124832. contentType: Cesium3DTileContentType_default.EXTERNAL_TILESET,
  124833. jsonPayload: json
  124834. };
  124835. }
  124836. if (defined_default(json.asset)) {
  124837. return {
  124838. contentType: Cesium3DTileContentType_default.GLTF,
  124839. jsonPayload: json
  124840. };
  124841. }
  124842. if (defined_default(json.tileAvailability)) {
  124843. return {
  124844. contentType: Cesium3DTileContentType_default.IMPLICIT_SUBTREE_JSON,
  124845. jsonPayload: json
  124846. };
  124847. }
  124848. throw new RuntimeError_default("Invalid tile content.");
  124849. }
  124850. function getJsonContent(uint8Array) {
  124851. let json;
  124852. try {
  124853. json = getJsonFromTypedArray_default(uint8Array);
  124854. } catch (error) {
  124855. throw new RuntimeError_default("Invalid tile content.");
  124856. }
  124857. return json;
  124858. }
  124859. // node_modules/cesium/Source/Scene/Multiple3DTileContent.js
  124860. function Multiple3DTileContent(tileset, tile, tilesetResource, contentsJson) {
  124861. this._tileset = tileset;
  124862. this._tile = tile;
  124863. this._tilesetResource = tilesetResource;
  124864. this._contents = [];
  124865. const contentHeaders = defined_default(contentsJson.contents) ? contentsJson.contents : contentsJson.content;
  124866. this._innerContentHeaders = contentHeaders;
  124867. this._requestsInFlight = 0;
  124868. this._cancelCount = 0;
  124869. const contentCount = this._innerContentHeaders.length;
  124870. this._arrayFetchPromises = new Array(contentCount);
  124871. this._requests = new Array(contentCount);
  124872. this._innerContentResources = new Array(contentCount);
  124873. this._serverKeys = new Array(contentCount);
  124874. for (let i2 = 0; i2 < contentCount; i2++) {
  124875. const contentResource = tilesetResource.getDerivedResource({
  124876. url: contentHeaders[i2].uri
  124877. });
  124878. const serverKey = RequestScheduler_default.getServerKey(
  124879. contentResource.getUrlComponent()
  124880. );
  124881. this._innerContentResources[i2] = contentResource;
  124882. this._serverKeys[i2] = serverKey;
  124883. }
  124884. this._contentsFetchedPromise = void 0;
  124885. this._readyPromise = defer_default();
  124886. }
  124887. Object.defineProperties(Multiple3DTileContent.prototype, {
  124888. featurePropertiesDirty: {
  124889. get: function() {
  124890. const contents = this._contents;
  124891. const length3 = contents.length;
  124892. for (let i2 = 0; i2 < length3; ++i2) {
  124893. if (contents[i2].featurePropertiesDirty) {
  124894. return true;
  124895. }
  124896. }
  124897. return false;
  124898. },
  124899. set: function(value) {
  124900. const contents = this._contents;
  124901. const length3 = contents.length;
  124902. for (let i2 = 0; i2 < length3; ++i2) {
  124903. contents[i2].featurePropertiesDirty = value;
  124904. }
  124905. }
  124906. },
  124907. featuresLength: {
  124908. get: function() {
  124909. return 0;
  124910. }
  124911. },
  124912. pointsLength: {
  124913. get: function() {
  124914. return 0;
  124915. }
  124916. },
  124917. trianglesLength: {
  124918. get: function() {
  124919. return 0;
  124920. }
  124921. },
  124922. geometryByteLength: {
  124923. get: function() {
  124924. return 0;
  124925. }
  124926. },
  124927. texturesByteLength: {
  124928. get: function() {
  124929. return 0;
  124930. }
  124931. },
  124932. batchTableByteLength: {
  124933. get: function() {
  124934. return 0;
  124935. }
  124936. },
  124937. innerContents: {
  124938. get: function() {
  124939. return this._contents;
  124940. }
  124941. },
  124942. readyPromise: {
  124943. get: function() {
  124944. return this._readyPromise.promise;
  124945. }
  124946. },
  124947. tileset: {
  124948. get: function() {
  124949. return this._tileset;
  124950. }
  124951. },
  124952. tile: {
  124953. get: function() {
  124954. return this._tile;
  124955. }
  124956. },
  124957. url: {
  124958. get: function() {
  124959. return void 0;
  124960. }
  124961. },
  124962. metadata: {
  124963. get: function() {
  124964. return void 0;
  124965. },
  124966. set: function() {
  124967. throw new DeveloperError_default("Multiple3DTileContent cannot have metadata");
  124968. }
  124969. },
  124970. batchTable: {
  124971. get: function() {
  124972. return void 0;
  124973. }
  124974. },
  124975. group: {
  124976. get: function() {
  124977. return void 0;
  124978. },
  124979. set: function() {
  124980. throw new DeveloperError_default(
  124981. "Multiple3DTileContent cannot have group metadata"
  124982. );
  124983. }
  124984. },
  124985. innerContentUrls: {
  124986. get: function() {
  124987. return this._innerContentHeaders.map(function(contentHeader) {
  124988. return contentHeader.uri;
  124989. });
  124990. }
  124991. },
  124992. contentsFetchedPromise: {
  124993. get: function() {
  124994. if (defined_default(this._contentsFetchedPromise)) {
  124995. return this._contentsFetchedPromise.promise;
  124996. }
  124997. return void 0;
  124998. }
  124999. }
  125000. });
  125001. function updatePendingRequests(multipleContents, deltaRequestCount) {
  125002. multipleContents._requestsInFlight += deltaRequestCount;
  125003. multipleContents.tileset.statistics.numberOfPendingRequests += deltaRequestCount;
  125004. }
  125005. function cancelPendingRequests(multipleContents, originalContentState) {
  125006. multipleContents._cancelCount++;
  125007. multipleContents._tile._contentState = originalContentState;
  125008. multipleContents.tileset.statistics.numberOfPendingRequests -= multipleContents._requestsInFlight;
  125009. multipleContents._requestsInFlight = 0;
  125010. const contentCount = multipleContents._innerContentHeaders.length;
  125011. multipleContents._arrayFetchPromises = new Array(contentCount);
  125012. }
  125013. Multiple3DTileContent.prototype.requestInnerContents = function() {
  125014. if (!canScheduleAllRequests(this._serverKeys)) {
  125015. return this._serverKeys.length;
  125016. }
  125017. const contentHeaders = this._innerContentHeaders;
  125018. updatePendingRequests(this, contentHeaders.length);
  125019. for (let i2 = 0; i2 < contentHeaders.length; i2++) {
  125020. this._arrayFetchPromises[i2] = requestInnerContent(
  125021. this,
  125022. i2,
  125023. this._cancelCount,
  125024. this._tile._contentState
  125025. );
  125026. }
  125027. if (!defined_default(this._contentsFetchedPromise)) {
  125028. this._contentsFetchedPromise = defer_default();
  125029. }
  125030. createInnerContents(this);
  125031. return 0;
  125032. };
  125033. function canScheduleAllRequests(serverKeys) {
  125034. const requestCountsByServer = {};
  125035. for (let i2 = 0; i2 < serverKeys.length; i2++) {
  125036. const serverKey = serverKeys[i2];
  125037. if (defined_default(requestCountsByServer[serverKey])) {
  125038. requestCountsByServer[serverKey]++;
  125039. } else {
  125040. requestCountsByServer[serverKey] = 1;
  125041. }
  125042. }
  125043. for (const key in requestCountsByServer) {
  125044. if (requestCountsByServer.hasOwnProperty(key) && !RequestScheduler_default.serverHasOpenSlots(key, requestCountsByServer[key])) {
  125045. return false;
  125046. }
  125047. }
  125048. return RequestScheduler_default.heapHasOpenSlots(serverKeys.length);
  125049. }
  125050. function requestInnerContent(multipleContents, index2, originalCancelCount, originalContentState) {
  125051. const contentResource = multipleContents._innerContentResources[index2].clone();
  125052. const tile = multipleContents.tile;
  125053. const priorityFunction = function() {
  125054. return tile._priority;
  125055. };
  125056. const serverKey = multipleContents._serverKeys[index2];
  125057. const request = new Request_default({
  125058. throttle: true,
  125059. throttleByServer: true,
  125060. type: RequestType_default.TILES3D,
  125061. priorityFunction,
  125062. serverKey
  125063. });
  125064. contentResource.request = request;
  125065. multipleContents._requests[index2] = request;
  125066. return contentResource.fetchArrayBuffer().then(function(arrayBuffer) {
  125067. if (originalCancelCount < multipleContents._cancelCount) {
  125068. return void 0;
  125069. }
  125070. updatePendingRequests(multipleContents, -1);
  125071. return arrayBuffer;
  125072. }).catch(function(error) {
  125073. if (originalCancelCount < multipleContents._cancelCount) {
  125074. return void 0;
  125075. }
  125076. if (contentResource.request.state === RequestState_default.CANCELLED) {
  125077. cancelPendingRequests(multipleContents, originalContentState);
  125078. return void 0;
  125079. }
  125080. updatePendingRequests(multipleContents, -1);
  125081. handleInnerContentFailed(multipleContents, index2, error);
  125082. return void 0;
  125083. });
  125084. }
  125085. function createInnerContents(multipleContents) {
  125086. const originalCancelCount = multipleContents._cancelCount;
  125087. Promise.all(multipleContents._arrayFetchPromises).then(function(arrayBuffers) {
  125088. if (originalCancelCount < multipleContents._cancelCount) {
  125089. return void 0;
  125090. }
  125091. return arrayBuffers.map(function(arrayBuffer, i2) {
  125092. if (!defined_default(arrayBuffer)) {
  125093. return void 0;
  125094. }
  125095. try {
  125096. return createInnerContent(multipleContents, arrayBuffer, i2);
  125097. } catch (error) {
  125098. handleInnerContentFailed(multipleContents, i2, error);
  125099. return void 0;
  125100. }
  125101. });
  125102. }).then(function(contents) {
  125103. if (!defined_default(contents)) {
  125104. if (defined_default(multipleContents._contentsFetchedPromise)) {
  125105. multipleContents._contentsFetchedPromise.resolve();
  125106. multipleContents._contentsFetchedPromise = void 0;
  125107. }
  125108. return;
  125109. }
  125110. multipleContents._contents = contents.filter(defined_default);
  125111. awaitReadyPromises(multipleContents);
  125112. if (defined_default(multipleContents._contentsFetchedPromise)) {
  125113. multipleContents._contentsFetchedPromise.resolve();
  125114. }
  125115. }).catch(function(error) {
  125116. if (defined_default(multipleContents._contentsFetchedPromise)) {
  125117. multipleContents._contentsFetchedPromise.reject(error);
  125118. }
  125119. });
  125120. }
  125121. function createInnerContent(multipleContents, arrayBuffer, index2) {
  125122. const preprocessed = preprocess3DTileContent(arrayBuffer);
  125123. if (preprocessed.contentType === Cesium3DTileContentType_default.EXTERNAL_TILESET) {
  125124. throw new RuntimeError_default(
  125125. "External tilesets are disallowed inside multiple contents"
  125126. );
  125127. }
  125128. multipleContents._disableSkipLevelOfDetail = multipleContents._disableSkipLevelOfDetail || preprocessed.contentType === Cesium3DTileContentType_default.GEOMETRY || preprocessed.contentType === Cesium3DTileContentType_default.VECTOR;
  125129. const tileset = multipleContents._tileset;
  125130. const resource = multipleContents._innerContentResources[index2];
  125131. const tile = multipleContents._tile;
  125132. let content;
  125133. const contentFactory = Cesium3DTileContentFactory_default[preprocessed.contentType];
  125134. if (defined_default(preprocessed.binaryPayload)) {
  125135. content = contentFactory(
  125136. tileset,
  125137. tile,
  125138. resource,
  125139. preprocessed.binaryPayload.buffer,
  125140. 0
  125141. );
  125142. } else {
  125143. content = contentFactory(tileset, tile, resource, preprocessed.jsonPayload);
  125144. }
  125145. const contentHeader = multipleContents._innerContentHeaders[index2];
  125146. if (tile.hasImplicitContentMetadata) {
  125147. const subtree = tile.implicitSubtree;
  125148. const coordinates = tile.implicitCoordinates;
  125149. content.metadata = subtree.getContentMetadataView(coordinates, index2);
  125150. } else if (!tile.hasImplicitContent) {
  125151. content.metadata = findContentMetadata(tileset, contentHeader);
  125152. }
  125153. const groupMetadata = findGroupMetadata(tileset, contentHeader);
  125154. if (defined_default(groupMetadata)) {
  125155. content.group = new Cesium3DContentGroup({
  125156. metadata: groupMetadata
  125157. });
  125158. }
  125159. return content;
  125160. }
  125161. function awaitReadyPromises(multipleContents) {
  125162. const readyPromises = multipleContents._contents.map(function(content) {
  125163. return content.readyPromise;
  125164. });
  125165. Promise.all(readyPromises).then(function() {
  125166. multipleContents._readyPromise.resolve(multipleContents);
  125167. }).catch(function(error) {
  125168. multipleContents._readyPromise.reject(error);
  125169. });
  125170. }
  125171. function handleInnerContentFailed(multipleContents, index2, error) {
  125172. const tileset = multipleContents._tileset;
  125173. const url2 = multipleContents._innerContentResources[index2].url;
  125174. const message = defined_default(error.message) ? error.message : error.toString();
  125175. if (tileset.tileFailed.numberOfListeners > 0) {
  125176. tileset.tileFailed.raiseEvent({
  125177. url: url2,
  125178. message
  125179. });
  125180. } else {
  125181. console.log(`A content failed to load: ${url2}`);
  125182. console.log(`Error: ${message}`);
  125183. }
  125184. }
  125185. Multiple3DTileContent.prototype.cancelRequests = function() {
  125186. for (let i2 = 0; i2 < this._requests.length; i2++) {
  125187. const request = this._requests[i2];
  125188. if (defined_default(request)) {
  125189. request.cancel();
  125190. }
  125191. }
  125192. };
  125193. Multiple3DTileContent.prototype.hasProperty = function(batchId, name) {
  125194. return false;
  125195. };
  125196. Multiple3DTileContent.prototype.getFeature = function(batchId) {
  125197. return void 0;
  125198. };
  125199. Multiple3DTileContent.prototype.applyDebugSettings = function(enabled, color) {
  125200. const contents = this._contents;
  125201. const length3 = contents.length;
  125202. for (let i2 = 0; i2 < length3; ++i2) {
  125203. contents[i2].applyDebugSettings(enabled, color);
  125204. }
  125205. };
  125206. Multiple3DTileContent.prototype.applyStyle = function(style) {
  125207. const contents = this._contents;
  125208. const length3 = contents.length;
  125209. for (let i2 = 0; i2 < length3; ++i2) {
  125210. contents[i2].applyStyle(style);
  125211. }
  125212. };
  125213. Multiple3DTileContent.prototype.update = function(tileset, frameState) {
  125214. const contents = this._contents;
  125215. const length3 = contents.length;
  125216. for (let i2 = 0; i2 < length3; ++i2) {
  125217. contents[i2].update(tileset, frameState);
  125218. }
  125219. };
  125220. Multiple3DTileContent.prototype.isDestroyed = function() {
  125221. return false;
  125222. };
  125223. Multiple3DTileContent.prototype.destroy = function() {
  125224. const contents = this._contents;
  125225. const length3 = contents.length;
  125226. for (let i2 = 0; i2 < length3; ++i2) {
  125227. contents[i2].destroy();
  125228. }
  125229. return destroyObject_default(this);
  125230. };
  125231. // node_modules/cesium/Source/Scene/TileBoundingRegion.js
  125232. function TileBoundingRegion(options) {
  125233. Check_default.typeOf.object("options", options);
  125234. Check_default.typeOf.object("options.rectangle", options.rectangle);
  125235. this.rectangle = Rectangle_default.clone(options.rectangle);
  125236. this.minimumHeight = defaultValue_default(options.minimumHeight, 0);
  125237. this.maximumHeight = defaultValue_default(options.maximumHeight, 0);
  125238. this.southwestCornerCartesian = new Cartesian3_default();
  125239. this.northeastCornerCartesian = new Cartesian3_default();
  125240. this.westNormal = new Cartesian3_default();
  125241. this.southNormal = new Cartesian3_default();
  125242. this.eastNormal = new Cartesian3_default();
  125243. this.northNormal = new Cartesian3_default();
  125244. const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  125245. computeBox(this, options.rectangle, ellipsoid);
  125246. this._orientedBoundingBox = void 0;
  125247. this._boundingSphere = void 0;
  125248. if (defaultValue_default(options.computeBoundingVolumes, true)) {
  125249. this.computeBoundingVolumes(ellipsoid);
  125250. }
  125251. }
  125252. Object.defineProperties(TileBoundingRegion.prototype, {
  125253. boundingVolume: {
  125254. get: function() {
  125255. return this._orientedBoundingBox;
  125256. }
  125257. },
  125258. boundingSphere: {
  125259. get: function() {
  125260. return this._boundingSphere;
  125261. }
  125262. }
  125263. });
  125264. TileBoundingRegion.prototype.computeBoundingVolumes = function(ellipsoid) {
  125265. this._orientedBoundingBox = OrientedBoundingBox_default.fromRectangle(
  125266. this.rectangle,
  125267. this.minimumHeight,
  125268. this.maximumHeight,
  125269. ellipsoid
  125270. );
  125271. this._boundingSphere = BoundingSphere_default.fromOrientedBoundingBox(
  125272. this._orientedBoundingBox
  125273. );
  125274. };
  125275. var cartesian3Scratch7 = new Cartesian3_default();
  125276. var cartesian3Scratch23 = new Cartesian3_default();
  125277. var cartesian3Scratch32 = new Cartesian3_default();
  125278. var eastWestNormalScratch = new Cartesian3_default();
  125279. var westernMidpointScratch = new Cartesian3_default();
  125280. var easternMidpointScratch = new Cartesian3_default();
  125281. var cartographicScratch3 = new Cartographic_default();
  125282. var planeScratch = new Plane_default(Cartesian3_default.UNIT_X, 0);
  125283. var rayScratch = new Ray_default();
  125284. function computeBox(tileBB, rectangle, ellipsoid) {
  125285. ellipsoid.cartographicToCartesian(
  125286. Rectangle_default.southwest(rectangle),
  125287. tileBB.southwestCornerCartesian
  125288. );
  125289. ellipsoid.cartographicToCartesian(
  125290. Rectangle_default.northeast(rectangle),
  125291. tileBB.northeastCornerCartesian
  125292. );
  125293. cartographicScratch3.longitude = rectangle.west;
  125294. cartographicScratch3.latitude = (rectangle.south + rectangle.north) * 0.5;
  125295. cartographicScratch3.height = 0;
  125296. const westernMidpointCartesian = ellipsoid.cartographicToCartesian(
  125297. cartographicScratch3,
  125298. westernMidpointScratch
  125299. );
  125300. const westNormal = Cartesian3_default.cross(
  125301. westernMidpointCartesian,
  125302. Cartesian3_default.UNIT_Z,
  125303. cartesian3Scratch7
  125304. );
  125305. Cartesian3_default.normalize(westNormal, tileBB.westNormal);
  125306. cartographicScratch3.longitude = rectangle.east;
  125307. const easternMidpointCartesian = ellipsoid.cartographicToCartesian(
  125308. cartographicScratch3,
  125309. easternMidpointScratch
  125310. );
  125311. const eastNormal = Cartesian3_default.cross(
  125312. Cartesian3_default.UNIT_Z,
  125313. easternMidpointCartesian,
  125314. cartesian3Scratch7
  125315. );
  125316. Cartesian3_default.normalize(eastNormal, tileBB.eastNormal);
  125317. const westVector = Cartesian3_default.subtract(
  125318. westernMidpointCartesian,
  125319. easternMidpointCartesian,
  125320. cartesian3Scratch7
  125321. );
  125322. const eastWestNormal = Cartesian3_default.normalize(
  125323. westVector,
  125324. eastWestNormalScratch
  125325. );
  125326. const south = rectangle.south;
  125327. let southSurfaceNormal;
  125328. if (south > 0) {
  125329. cartographicScratch3.longitude = (rectangle.west + rectangle.east) * 0.5;
  125330. cartographicScratch3.latitude = south;
  125331. const southCenterCartesian = ellipsoid.cartographicToCartesian(
  125332. cartographicScratch3,
  125333. rayScratch.origin
  125334. );
  125335. Cartesian3_default.clone(eastWestNormal, rayScratch.direction);
  125336. const westPlane = Plane_default.fromPointNormal(
  125337. tileBB.southwestCornerCartesian,
  125338. tileBB.westNormal,
  125339. planeScratch
  125340. );
  125341. IntersectionTests_default.rayPlane(
  125342. rayScratch,
  125343. westPlane,
  125344. tileBB.southwestCornerCartesian
  125345. );
  125346. southSurfaceNormal = ellipsoid.geodeticSurfaceNormal(
  125347. southCenterCartesian,
  125348. cartesian3Scratch23
  125349. );
  125350. } else {
  125351. southSurfaceNormal = ellipsoid.geodeticSurfaceNormalCartographic(
  125352. Rectangle_default.southeast(rectangle),
  125353. cartesian3Scratch23
  125354. );
  125355. }
  125356. const southNormal = Cartesian3_default.cross(
  125357. southSurfaceNormal,
  125358. westVector,
  125359. cartesian3Scratch32
  125360. );
  125361. Cartesian3_default.normalize(southNormal, tileBB.southNormal);
  125362. const north = rectangle.north;
  125363. let northSurfaceNormal;
  125364. if (north < 0) {
  125365. cartographicScratch3.longitude = (rectangle.west + rectangle.east) * 0.5;
  125366. cartographicScratch3.latitude = north;
  125367. const northCenterCartesian = ellipsoid.cartographicToCartesian(
  125368. cartographicScratch3,
  125369. rayScratch.origin
  125370. );
  125371. Cartesian3_default.negate(eastWestNormal, rayScratch.direction);
  125372. const eastPlane = Plane_default.fromPointNormal(
  125373. tileBB.northeastCornerCartesian,
  125374. tileBB.eastNormal,
  125375. planeScratch
  125376. );
  125377. IntersectionTests_default.rayPlane(
  125378. rayScratch,
  125379. eastPlane,
  125380. tileBB.northeastCornerCartesian
  125381. );
  125382. northSurfaceNormal = ellipsoid.geodeticSurfaceNormal(
  125383. northCenterCartesian,
  125384. cartesian3Scratch23
  125385. );
  125386. } else {
  125387. northSurfaceNormal = ellipsoid.geodeticSurfaceNormalCartographic(
  125388. Rectangle_default.northwest(rectangle),
  125389. cartesian3Scratch23
  125390. );
  125391. }
  125392. const northNormal = Cartesian3_default.cross(
  125393. westVector,
  125394. northSurfaceNormal,
  125395. cartesian3Scratch32
  125396. );
  125397. Cartesian3_default.normalize(northNormal, tileBB.northNormal);
  125398. }
  125399. var southwestCornerScratch = new Cartesian3_default();
  125400. var northeastCornerScratch = new Cartesian3_default();
  125401. var negativeUnitY = new Cartesian3_default(0, -1, 0);
  125402. var negativeUnitZ = new Cartesian3_default(0, 0, -1);
  125403. var vectorScratch = new Cartesian3_default();
  125404. function distanceToCameraRegion(tileBB, frameState) {
  125405. const camera = frameState.camera;
  125406. const cameraCartesianPosition = camera.positionWC;
  125407. const cameraCartographicPosition = camera.positionCartographic;
  125408. let result = 0;
  125409. if (!Rectangle_default.contains(tileBB.rectangle, cameraCartographicPosition)) {
  125410. let southwestCornerCartesian = tileBB.southwestCornerCartesian;
  125411. let northeastCornerCartesian = tileBB.northeastCornerCartesian;
  125412. let westNormal = tileBB.westNormal;
  125413. let southNormal = tileBB.southNormal;
  125414. let eastNormal = tileBB.eastNormal;
  125415. let northNormal = tileBB.northNormal;
  125416. if (frameState.mode !== SceneMode_default.SCENE3D) {
  125417. southwestCornerCartesian = frameState.mapProjection.project(
  125418. Rectangle_default.southwest(tileBB.rectangle),
  125419. southwestCornerScratch
  125420. );
  125421. southwestCornerCartesian.z = southwestCornerCartesian.y;
  125422. southwestCornerCartesian.y = southwestCornerCartesian.x;
  125423. southwestCornerCartesian.x = 0;
  125424. northeastCornerCartesian = frameState.mapProjection.project(
  125425. Rectangle_default.northeast(tileBB.rectangle),
  125426. northeastCornerScratch
  125427. );
  125428. northeastCornerCartesian.z = northeastCornerCartesian.y;
  125429. northeastCornerCartesian.y = northeastCornerCartesian.x;
  125430. northeastCornerCartesian.x = 0;
  125431. westNormal = negativeUnitY;
  125432. eastNormal = Cartesian3_default.UNIT_Y;
  125433. southNormal = negativeUnitZ;
  125434. northNormal = Cartesian3_default.UNIT_Z;
  125435. }
  125436. const vectorFromSouthwestCorner = Cartesian3_default.subtract(
  125437. cameraCartesianPosition,
  125438. southwestCornerCartesian,
  125439. vectorScratch
  125440. );
  125441. const distanceToWestPlane = Cartesian3_default.dot(
  125442. vectorFromSouthwestCorner,
  125443. westNormal
  125444. );
  125445. const distanceToSouthPlane = Cartesian3_default.dot(
  125446. vectorFromSouthwestCorner,
  125447. southNormal
  125448. );
  125449. const vectorFromNortheastCorner = Cartesian3_default.subtract(
  125450. cameraCartesianPosition,
  125451. northeastCornerCartesian,
  125452. vectorScratch
  125453. );
  125454. const distanceToEastPlane = Cartesian3_default.dot(
  125455. vectorFromNortheastCorner,
  125456. eastNormal
  125457. );
  125458. const distanceToNorthPlane = Cartesian3_default.dot(
  125459. vectorFromNortheastCorner,
  125460. northNormal
  125461. );
  125462. if (distanceToWestPlane > 0) {
  125463. result += distanceToWestPlane * distanceToWestPlane;
  125464. } else if (distanceToEastPlane > 0) {
  125465. result += distanceToEastPlane * distanceToEastPlane;
  125466. }
  125467. if (distanceToSouthPlane > 0) {
  125468. result += distanceToSouthPlane * distanceToSouthPlane;
  125469. } else if (distanceToNorthPlane > 0) {
  125470. result += distanceToNorthPlane * distanceToNorthPlane;
  125471. }
  125472. }
  125473. let cameraHeight;
  125474. let minimumHeight;
  125475. let maximumHeight;
  125476. if (frameState.mode === SceneMode_default.SCENE3D) {
  125477. cameraHeight = cameraCartographicPosition.height;
  125478. minimumHeight = tileBB.minimumHeight;
  125479. maximumHeight = tileBB.maximumHeight;
  125480. } else {
  125481. cameraHeight = cameraCartesianPosition.x;
  125482. minimumHeight = 0;
  125483. maximumHeight = 0;
  125484. }
  125485. if (cameraHeight > maximumHeight) {
  125486. const distanceAboveTop = cameraHeight - maximumHeight;
  125487. result += distanceAboveTop * distanceAboveTop;
  125488. } else if (cameraHeight < minimumHeight) {
  125489. const distanceBelowBottom = minimumHeight - cameraHeight;
  125490. result += distanceBelowBottom * distanceBelowBottom;
  125491. }
  125492. return Math.sqrt(result);
  125493. }
  125494. TileBoundingRegion.prototype.distanceToCamera = function(frameState) {
  125495. Check_default.defined("frameState", frameState);
  125496. const regionResult = distanceToCameraRegion(this, frameState);
  125497. if (frameState.mode === SceneMode_default.SCENE3D && defined_default(this._orientedBoundingBox)) {
  125498. const obbResult = Math.sqrt(
  125499. this._orientedBoundingBox.distanceSquaredTo(frameState.camera.positionWC)
  125500. );
  125501. return Math.max(regionResult, obbResult);
  125502. }
  125503. return regionResult;
  125504. };
  125505. TileBoundingRegion.prototype.intersectPlane = function(plane) {
  125506. Check_default.defined("plane", plane);
  125507. return this._orientedBoundingBox.intersectPlane(plane);
  125508. };
  125509. TileBoundingRegion.prototype.createDebugVolume = function(color) {
  125510. Check_default.defined("color", color);
  125511. const modelMatrix = new Matrix4_default.clone(Matrix4_default.IDENTITY);
  125512. const geometry = new RectangleOutlineGeometry_default({
  125513. rectangle: this.rectangle,
  125514. height: this.minimumHeight,
  125515. extrudedHeight: this.maximumHeight
  125516. });
  125517. const instance = new GeometryInstance_default({
  125518. geometry,
  125519. id: "outline",
  125520. modelMatrix,
  125521. attributes: {
  125522. color: ColorGeometryInstanceAttribute_default.fromColor(color)
  125523. }
  125524. });
  125525. return new Primitive_default({
  125526. geometryInstances: instance,
  125527. appearance: new PerInstanceColorAppearance_default({
  125528. translucent: false,
  125529. flat: true
  125530. }),
  125531. asynchronous: false
  125532. });
  125533. };
  125534. var TileBoundingRegion_default = TileBoundingRegion;
  125535. // node_modules/cesium/Source/Scene/TileBoundingS2Cell.js
  125536. var centerCartographicScratch = new Cartographic_default();
  125537. function TileBoundingS2Cell(options) {
  125538. Check_default.typeOf.object("options", options);
  125539. Check_default.typeOf.string("options.token", options.token);
  125540. const s2Cell = S2Cell_default.fromToken(options.token);
  125541. const minimumHeight = defaultValue_default(options.minimumHeight, 0);
  125542. const maximumHeight = defaultValue_default(options.maximumHeight, 0);
  125543. const ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  125544. this.s2Cell = s2Cell;
  125545. this.minimumHeight = minimumHeight;
  125546. this.maximumHeight = maximumHeight;
  125547. this.ellipsoid = ellipsoid;
  125548. const boundingPlanes = computeBoundingPlanes(
  125549. s2Cell,
  125550. minimumHeight,
  125551. maximumHeight,
  125552. ellipsoid
  125553. );
  125554. this._boundingPlanes = boundingPlanes;
  125555. const vertices = computeVertices(boundingPlanes);
  125556. this._vertices = vertices;
  125557. this._edgeNormals = new Array(6);
  125558. this._edgeNormals[0] = computeEdgeNormals(
  125559. boundingPlanes[0],
  125560. vertices.slice(0, 4)
  125561. );
  125562. let i2;
  125563. for (i2 = 0; i2 < 4; i2++) {
  125564. this._edgeNormals[0][i2] = Cartesian3_default.negate(
  125565. this._edgeNormals[0][i2],
  125566. this._edgeNormals[0][i2]
  125567. );
  125568. }
  125569. this._edgeNormals[1] = computeEdgeNormals(
  125570. boundingPlanes[1],
  125571. vertices.slice(4, 8)
  125572. );
  125573. for (i2 = 0; i2 < 4; i2++) {
  125574. this._edgeNormals[2 + i2] = computeEdgeNormals(boundingPlanes[2 + i2], [
  125575. vertices[i2 % 4],
  125576. vertices[(i2 + 1) % 4],
  125577. vertices[4 + (i2 + 1) % 4],
  125578. vertices[4 + i2]
  125579. ]);
  125580. }
  125581. this._planeVertices = [
  125582. this._vertices.slice(0, 4),
  125583. this._vertices.slice(4, 8)
  125584. ];
  125585. for (i2 = 0; i2 < 4; i2++) {
  125586. this._planeVertices.push([
  125587. this._vertices[i2 % 4],
  125588. this._vertices[(i2 + 1) % 4],
  125589. this._vertices[4 + (i2 + 1) % 4],
  125590. this._vertices[4 + i2]
  125591. ]);
  125592. }
  125593. const center = s2Cell.getCenter();
  125594. centerCartographicScratch = ellipsoid.cartesianToCartographic(
  125595. center,
  125596. centerCartographicScratch
  125597. );
  125598. centerCartographicScratch.height = (maximumHeight + minimumHeight) / 2;
  125599. this.center = ellipsoid.cartographicToCartesian(
  125600. centerCartographicScratch,
  125601. center
  125602. );
  125603. this._boundingSphere = BoundingSphere_default.fromPoints(vertices);
  125604. }
  125605. var centerGeodeticNormalScratch = new Cartesian3_default();
  125606. var topCartographicScratch = new Cartographic_default();
  125607. var topScratch = new Cartesian3_default();
  125608. var vertexCartographicScratch = new Cartographic_default();
  125609. var vertexScratch = new Cartesian3_default();
  125610. var vertexGeodeticNormalScratch = new Cartesian3_default();
  125611. var sideNormalScratch = new Cartesian3_default();
  125612. var sideScratch = new Cartesian3_default();
  125613. function computeBoundingPlanes(s2Cell, minimumHeight, maximumHeight, ellipsoid) {
  125614. const planes = new Array(6);
  125615. const centerPoint = s2Cell.getCenter();
  125616. const centerSurfaceNormal = ellipsoid.geodeticSurfaceNormal(
  125617. centerPoint,
  125618. centerGeodeticNormalScratch
  125619. );
  125620. const topCartographic = ellipsoid.cartesianToCartographic(
  125621. centerPoint,
  125622. topCartographicScratch
  125623. );
  125624. topCartographic.height = maximumHeight;
  125625. const top = ellipsoid.cartographicToCartesian(topCartographic, topScratch);
  125626. const topPlane = Plane_default.fromPointNormal(top, centerSurfaceNormal);
  125627. planes[0] = topPlane;
  125628. let maxDistance = 0;
  125629. let i2;
  125630. const vertices = [];
  125631. let vertex, vertexCartographic;
  125632. for (i2 = 0; i2 < 4; i2++) {
  125633. vertex = s2Cell.getVertex(i2);
  125634. vertices[i2] = vertex;
  125635. vertexCartographic = ellipsoid.cartesianToCartographic(
  125636. vertex,
  125637. vertexCartographicScratch
  125638. );
  125639. vertexCartographic.height = minimumHeight;
  125640. const distance2 = Plane_default.getPointDistance(
  125641. topPlane,
  125642. ellipsoid.cartographicToCartesian(vertexCartographic, vertexScratch)
  125643. );
  125644. if (distance2 < maxDistance) {
  125645. maxDistance = distance2;
  125646. }
  125647. }
  125648. const bottomPlane = Plane_default.clone(topPlane);
  125649. bottomPlane.normal = Cartesian3_default.negate(
  125650. bottomPlane.normal,
  125651. bottomPlane.normal
  125652. );
  125653. bottomPlane.distance = bottomPlane.distance * -1 + maxDistance;
  125654. planes[1] = bottomPlane;
  125655. for (i2 = 0; i2 < 4; i2++) {
  125656. vertex = vertices[i2];
  125657. const adjacentVertex = vertices[(i2 + 1) % 4];
  125658. const geodeticNormal = ellipsoid.geodeticSurfaceNormal(
  125659. vertex,
  125660. vertexGeodeticNormalScratch
  125661. );
  125662. const side = Cartesian3_default.subtract(adjacentVertex, vertex, sideScratch);
  125663. let sideNormal = Cartesian3_default.cross(side, geodeticNormal, sideNormalScratch);
  125664. sideNormal = Cartesian3_default.normalize(sideNormal, sideNormal);
  125665. planes[2 + i2] = Plane_default.fromPointNormal(vertex, sideNormal);
  125666. }
  125667. return planes;
  125668. }
  125669. var n0Scratch = new Cartesian3_default();
  125670. var n1Scratch = new Cartesian3_default();
  125671. var n2Scratch = new Cartesian3_default();
  125672. var x0Scratch = new Cartesian3_default();
  125673. var x1Scratch = new Cartesian3_default();
  125674. var x2Scratch = new Cartesian3_default();
  125675. var t0Scratch = new Cartesian3_default();
  125676. var t1Scratch = new Cartesian3_default();
  125677. var t2Scratch = new Cartesian3_default();
  125678. var f0Scratch = new Cartesian3_default();
  125679. var f1Scratch = new Cartesian3_default();
  125680. var f2Scratch = new Cartesian3_default();
  125681. var sScratch2 = new Cartesian3_default();
  125682. var matrixScratch = new Matrix3_default();
  125683. function computeIntersection(p0, p1, p2) {
  125684. n0Scratch = p0.normal;
  125685. n1Scratch = p1.normal;
  125686. n2Scratch = p2.normal;
  125687. x0Scratch = Cartesian3_default.multiplyByScalar(p0.normal, -p0.distance, x0Scratch);
  125688. x1Scratch = Cartesian3_default.multiplyByScalar(p1.normal, -p1.distance, x1Scratch);
  125689. x2Scratch = Cartesian3_default.multiplyByScalar(p2.normal, -p2.distance, x2Scratch);
  125690. f0Scratch = Cartesian3_default.multiplyByScalar(
  125691. Cartesian3_default.cross(n1Scratch, n2Scratch, t0Scratch),
  125692. Cartesian3_default.dot(x0Scratch, n0Scratch),
  125693. f0Scratch
  125694. );
  125695. f1Scratch = Cartesian3_default.multiplyByScalar(
  125696. Cartesian3_default.cross(n2Scratch, n0Scratch, t1Scratch),
  125697. Cartesian3_default.dot(x1Scratch, n1Scratch),
  125698. f1Scratch
  125699. );
  125700. f2Scratch = Cartesian3_default.multiplyByScalar(
  125701. Cartesian3_default.cross(n0Scratch, n1Scratch, t2Scratch),
  125702. Cartesian3_default.dot(x2Scratch, n2Scratch),
  125703. f2Scratch
  125704. );
  125705. matrixScratch[0] = n0Scratch.x;
  125706. matrixScratch[1] = n1Scratch.x;
  125707. matrixScratch[2] = n2Scratch.x;
  125708. matrixScratch[3] = n0Scratch.y;
  125709. matrixScratch[4] = n1Scratch.y;
  125710. matrixScratch[5] = n2Scratch.y;
  125711. matrixScratch[6] = n0Scratch.z;
  125712. matrixScratch[7] = n1Scratch.z;
  125713. matrixScratch[8] = n2Scratch.z;
  125714. const determinant = Matrix3_default.determinant(matrixScratch);
  125715. sScratch2 = Cartesian3_default.add(f0Scratch, f1Scratch, sScratch2);
  125716. sScratch2 = Cartesian3_default.add(sScratch2, f2Scratch, sScratch2);
  125717. return new Cartesian3_default(
  125718. sScratch2.x / determinant,
  125719. sScratch2.y / determinant,
  125720. sScratch2.z / determinant
  125721. );
  125722. }
  125723. function computeVertices(boundingPlanes) {
  125724. const vertices = new Array(8);
  125725. for (let i2 = 0; i2 < 4; i2++) {
  125726. vertices[i2] = computeIntersection(
  125727. boundingPlanes[0],
  125728. boundingPlanes[2 + (i2 + 3) % 4],
  125729. boundingPlanes[2 + i2 % 4]
  125730. );
  125731. vertices[i2 + 4] = computeIntersection(
  125732. boundingPlanes[1],
  125733. boundingPlanes[2 + (i2 + 3) % 4],
  125734. boundingPlanes[2 + i2 % 4]
  125735. );
  125736. }
  125737. return vertices;
  125738. }
  125739. var edgeScratch = new Cartesian3_default();
  125740. var edgeNormalScratch = new Cartesian3_default();
  125741. function computeEdgeNormals(plane, vertices) {
  125742. const edgeNormals = [];
  125743. for (let i2 = 0; i2 < 4; i2++) {
  125744. edgeScratch = Cartesian3_default.subtract(
  125745. vertices[(i2 + 1) % 4],
  125746. vertices[i2],
  125747. edgeScratch
  125748. );
  125749. edgeNormalScratch = Cartesian3_default.cross(
  125750. plane.normal,
  125751. edgeScratch,
  125752. edgeNormalScratch
  125753. );
  125754. edgeNormalScratch = Cartesian3_default.normalize(
  125755. edgeNormalScratch,
  125756. edgeNormalScratch
  125757. );
  125758. edgeNormals[i2] = Cartesian3_default.clone(edgeNormalScratch);
  125759. }
  125760. return edgeNormals;
  125761. }
  125762. Object.defineProperties(TileBoundingS2Cell.prototype, {
  125763. boundingVolume: {
  125764. get: function() {
  125765. return this;
  125766. }
  125767. },
  125768. boundingSphere: {
  125769. get: function() {
  125770. return this._boundingSphere;
  125771. }
  125772. }
  125773. });
  125774. var facePointScratch = new Cartesian3_default();
  125775. TileBoundingS2Cell.prototype.distanceToCamera = function(frameState) {
  125776. Check_default.defined("frameState", frameState);
  125777. const point = frameState.camera.positionWC;
  125778. const selectedPlaneIndices = [];
  125779. const vertices = [];
  125780. let edgeNormals;
  125781. if (Plane_default.getPointDistance(this._boundingPlanes[0], point) > 0) {
  125782. selectedPlaneIndices.push(0);
  125783. vertices.push(this._planeVertices[0]);
  125784. edgeNormals = this._edgeNormals[0];
  125785. } else if (Plane_default.getPointDistance(this._boundingPlanes[1], point) > 0) {
  125786. selectedPlaneIndices.push(1);
  125787. vertices.push(this._planeVertices[1]);
  125788. edgeNormals = this._edgeNormals[1];
  125789. }
  125790. let i2;
  125791. let sidePlaneIndex;
  125792. for (i2 = 0; i2 < 4; i2++) {
  125793. sidePlaneIndex = 2 + i2;
  125794. if (Plane_default.getPointDistance(this._boundingPlanes[sidePlaneIndex], point) > 0) {
  125795. selectedPlaneIndices.push(sidePlaneIndex);
  125796. vertices.push(this._planeVertices[sidePlaneIndex]);
  125797. edgeNormals = this._edgeNormals[sidePlaneIndex];
  125798. }
  125799. }
  125800. if (selectedPlaneIndices.length === 0) {
  125801. return 0;
  125802. }
  125803. let facePoint;
  125804. let selectedPlane;
  125805. if (selectedPlaneIndices.length === 1) {
  125806. selectedPlane = this._boundingPlanes[selectedPlaneIndices[0]];
  125807. facePoint = closestPointPolygon(
  125808. Plane_default.projectPointOntoPlane(selectedPlane, point, facePointScratch),
  125809. vertices[0],
  125810. selectedPlane,
  125811. edgeNormals
  125812. );
  125813. return Cartesian3_default.distance(facePoint, point);
  125814. } else if (selectedPlaneIndices.length === 2) {
  125815. if (selectedPlaneIndices[0] === 0) {
  125816. const edge = [
  125817. this._vertices[4 * selectedPlaneIndices[0] + (selectedPlaneIndices[1] - 2)],
  125818. this._vertices[4 * selectedPlaneIndices[0] + (selectedPlaneIndices[1] - 2 + 1) % 4]
  125819. ];
  125820. facePoint = closestPointLineSegment(point, edge[0], edge[1]);
  125821. return Cartesian3_default.distance(facePoint, point);
  125822. }
  125823. let minimumDistance = Number.MAX_VALUE;
  125824. let distance2;
  125825. for (i2 = 0; i2 < 2; i2++) {
  125826. selectedPlane = this._boundingPlanes[selectedPlaneIndices[i2]];
  125827. facePoint = closestPointPolygon(
  125828. Plane_default.projectPointOntoPlane(selectedPlane, point, facePointScratch),
  125829. vertices[i2],
  125830. selectedPlane,
  125831. this._edgeNormals[selectedPlaneIndices[i2]]
  125832. );
  125833. distance2 = Cartesian3_default.distanceSquared(facePoint, point);
  125834. if (distance2 < minimumDistance) {
  125835. minimumDistance = distance2;
  125836. }
  125837. }
  125838. return Math.sqrt(minimumDistance);
  125839. } else if (selectedPlaneIndices.length > 3) {
  125840. facePoint = closestPointPolygon(
  125841. Plane_default.projectPointOntoPlane(
  125842. this._boundingPlanes[1],
  125843. point,
  125844. facePointScratch
  125845. ),
  125846. this._planeVertices[1],
  125847. this._boundingPlanes[1],
  125848. this._edgeNormals[1]
  125849. );
  125850. return Cartesian3_default.distance(facePoint, point);
  125851. }
  125852. const skip = selectedPlaneIndices[1] === 2 && selectedPlaneIndices[2] === 5 ? 0 : 1;
  125853. if (selectedPlaneIndices[0] === 0) {
  125854. return Cartesian3_default.distance(
  125855. point,
  125856. this._vertices[(selectedPlaneIndices[1] - 2 + skip) % 4]
  125857. );
  125858. }
  125859. return Cartesian3_default.distance(
  125860. point,
  125861. this._vertices[4 + (selectedPlaneIndices[1] - 2 + skip) % 4]
  125862. );
  125863. };
  125864. var dScratch2 = new Cartesian3_default();
  125865. var pL0Scratch = new Cartesian3_default();
  125866. function closestPointLineSegment(p2, l0, l1) {
  125867. const d = Cartesian3_default.subtract(l1, l0, dScratch2);
  125868. const pL0 = Cartesian3_default.subtract(p2, l0, pL0Scratch);
  125869. let t = Cartesian3_default.dot(d, pL0);
  125870. if (t <= 0) {
  125871. return l0;
  125872. }
  125873. const dMag = Cartesian3_default.dot(d, d);
  125874. if (t >= dMag) {
  125875. return l1;
  125876. }
  125877. t = t / dMag;
  125878. return new Cartesian3_default(
  125879. (1 - t) * l0.x + t * l1.x,
  125880. (1 - t) * l0.y + t * l1.y,
  125881. (1 - t) * l0.z + t * l1.z
  125882. );
  125883. }
  125884. var edgePlaneScratch = new Plane_default(Cartesian3_default.UNIT_X, 0);
  125885. function closestPointPolygon(p2, vertices, plane, edgeNormals) {
  125886. let minDistance = Number.MAX_VALUE;
  125887. let distance2;
  125888. let closestPoint;
  125889. let closestPointOnEdge;
  125890. for (let i2 = 0; i2 < vertices.length; i2++) {
  125891. const edgePlane = Plane_default.fromPointNormal(
  125892. vertices[i2],
  125893. edgeNormals[i2],
  125894. edgePlaneScratch
  125895. );
  125896. const edgePlaneDistance = Plane_default.getPointDistance(edgePlane, p2);
  125897. if (edgePlaneDistance < 0) {
  125898. continue;
  125899. }
  125900. closestPointOnEdge = closestPointLineSegment(
  125901. p2,
  125902. vertices[i2],
  125903. vertices[(i2 + 1) % 4]
  125904. );
  125905. distance2 = Cartesian3_default.distance(p2, closestPointOnEdge);
  125906. if (distance2 < minDistance) {
  125907. minDistance = distance2;
  125908. closestPoint = closestPointOnEdge;
  125909. }
  125910. }
  125911. if (!defined_default(closestPoint)) {
  125912. return p2;
  125913. }
  125914. return closestPoint;
  125915. }
  125916. TileBoundingS2Cell.prototype.intersectPlane = function(plane) {
  125917. Check_default.defined("plane", plane);
  125918. let plusCount = 0;
  125919. let negCount = 0;
  125920. for (let i2 = 0; i2 < this._vertices.length; i2++) {
  125921. const distanceToPlane = Cartesian3_default.dot(plane.normal, this._vertices[i2]) + plane.distance;
  125922. if (distanceToPlane < 0) {
  125923. negCount++;
  125924. } else {
  125925. plusCount++;
  125926. }
  125927. }
  125928. if (plusCount === this._vertices.length) {
  125929. return Intersect_default.INSIDE;
  125930. } else if (negCount === this._vertices.length) {
  125931. return Intersect_default.OUTSIDE;
  125932. }
  125933. return Intersect_default.INTERSECTING;
  125934. };
  125935. TileBoundingS2Cell.prototype.createDebugVolume = function(color) {
  125936. Check_default.defined("color", color);
  125937. const modelMatrix = new Matrix4_default.clone(Matrix4_default.IDENTITY);
  125938. const topPlanePolygon = new CoplanarPolygonOutlineGeometry_default({
  125939. polygonHierarchy: {
  125940. positions: this._planeVertices[0]
  125941. }
  125942. });
  125943. const topPlaneGeometry = CoplanarPolygonOutlineGeometry_default.createGeometry(
  125944. topPlanePolygon
  125945. );
  125946. const topPlaneInstance = new GeometryInstance_default({
  125947. geometry: topPlaneGeometry,
  125948. id: "outline",
  125949. modelMatrix,
  125950. attributes: {
  125951. color: ColorGeometryInstanceAttribute_default.fromColor(color)
  125952. }
  125953. });
  125954. const bottomPlanePolygon = new CoplanarPolygonOutlineGeometry_default({
  125955. polygonHierarchy: {
  125956. positions: this._planeVertices[1]
  125957. }
  125958. });
  125959. const bottomPlaneGeometry = CoplanarPolygonOutlineGeometry_default.createGeometry(
  125960. bottomPlanePolygon
  125961. );
  125962. const bottomPlaneInstance = new GeometryInstance_default({
  125963. geometry: bottomPlaneGeometry,
  125964. id: "outline",
  125965. modelMatrix,
  125966. attributes: {
  125967. color: ColorGeometryInstanceAttribute_default.fromColor(color)
  125968. }
  125969. });
  125970. const sideInstances = [];
  125971. for (let i2 = 0; i2 < 4; i2++) {
  125972. const sidePlanePolygon = new CoplanarPolygonOutlineGeometry_default({
  125973. polygonHierarchy: {
  125974. positions: this._planeVertices[2 + i2]
  125975. }
  125976. });
  125977. const sidePlaneGeometry = CoplanarPolygonOutlineGeometry_default.createGeometry(
  125978. sidePlanePolygon
  125979. );
  125980. sideInstances[i2] = new GeometryInstance_default({
  125981. geometry: sidePlaneGeometry,
  125982. id: "outline",
  125983. modelMatrix,
  125984. attributes: {
  125985. color: ColorGeometryInstanceAttribute_default.fromColor(color)
  125986. }
  125987. });
  125988. }
  125989. return new Primitive_default({
  125990. geometryInstances: [
  125991. sideInstances[0],
  125992. sideInstances[1],
  125993. sideInstances[2],
  125994. sideInstances[3],
  125995. bottomPlaneInstance,
  125996. topPlaneInstance
  125997. ],
  125998. appearance: new PerInstanceColorAppearance_default({
  125999. translucent: false,
  126000. flat: true
  126001. }),
  126002. asynchronous: false
  126003. });
  126004. };
  126005. var TileBoundingS2Cell_default = TileBoundingS2Cell;
  126006. // node_modules/cesium/Source/Scene/TileBoundingSphere.js
  126007. function TileBoundingSphere(center, radius) {
  126008. if (radius === 0) {
  126009. radius = Math_default.EPSILON7;
  126010. }
  126011. this._boundingSphere = new BoundingSphere_default(center, radius);
  126012. }
  126013. Object.defineProperties(TileBoundingSphere.prototype, {
  126014. center: {
  126015. get: function() {
  126016. return this._boundingSphere.center;
  126017. }
  126018. },
  126019. radius: {
  126020. get: function() {
  126021. return this._boundingSphere.radius;
  126022. }
  126023. },
  126024. boundingVolume: {
  126025. get: function() {
  126026. return this._boundingSphere;
  126027. }
  126028. },
  126029. boundingSphere: {
  126030. get: function() {
  126031. return this._boundingSphere;
  126032. }
  126033. }
  126034. });
  126035. TileBoundingSphere.prototype.distanceToCamera = function(frameState) {
  126036. Check_default.defined("frameState", frameState);
  126037. const boundingSphere = this._boundingSphere;
  126038. return Math.max(
  126039. 0,
  126040. Cartesian3_default.distance(boundingSphere.center, frameState.camera.positionWC) - boundingSphere.radius
  126041. );
  126042. };
  126043. TileBoundingSphere.prototype.intersectPlane = function(plane) {
  126044. Check_default.defined("plane", plane);
  126045. return BoundingSphere_default.intersectPlane(this._boundingSphere, plane);
  126046. };
  126047. TileBoundingSphere.prototype.update = function(center, radius) {
  126048. Cartesian3_default.clone(center, this._boundingSphere.center);
  126049. this._boundingSphere.radius = radius;
  126050. };
  126051. TileBoundingSphere.prototype.createDebugVolume = function(color) {
  126052. Check_default.defined("color", color);
  126053. const geometry = new SphereOutlineGeometry_default({
  126054. radius: this.radius
  126055. });
  126056. const modelMatrix = Matrix4_default.fromTranslation(
  126057. this.center,
  126058. new Matrix4_default.clone(Matrix4_default.IDENTITY)
  126059. );
  126060. const instance = new GeometryInstance_default({
  126061. geometry,
  126062. id: "outline",
  126063. modelMatrix,
  126064. attributes: {
  126065. color: ColorGeometryInstanceAttribute_default.fromColor(color)
  126066. }
  126067. });
  126068. return new Primitive_default({
  126069. geometryInstances: instance,
  126070. appearance: new PerInstanceColorAppearance_default({
  126071. translucent: false,
  126072. flat: true
  126073. }),
  126074. asynchronous: false
  126075. });
  126076. };
  126077. var TileBoundingSphere_default = TileBoundingSphere;
  126078. // node_modules/cesium/Source/Scene/TileOrientedBoundingBox.js
  126079. var scratchU = new Cartesian3_default();
  126080. var scratchV = new Cartesian3_default();
  126081. var scratchW2 = new Cartesian3_default();
  126082. var scratchCartesian11 = new Cartesian3_default();
  126083. function computeMissingVector(a4, b, result) {
  126084. result = Cartesian3_default.cross(a4, b, result);
  126085. const magnitude = Cartesian3_default.magnitude(result);
  126086. return Cartesian3_default.multiplyByScalar(
  126087. result,
  126088. Math_default.EPSILON7 / magnitude,
  126089. result
  126090. );
  126091. }
  126092. function findOrthogonalVector(a4, result) {
  126093. const temp = Cartesian3_default.normalize(a4, scratchCartesian11);
  126094. const b = Cartesian3_default.equalsEpsilon(
  126095. temp,
  126096. Cartesian3_default.UNIT_X,
  126097. Math_default.EPSILON6
  126098. ) ? Cartesian3_default.UNIT_Y : Cartesian3_default.UNIT_X;
  126099. return computeMissingVector(a4, b, result);
  126100. }
  126101. function checkHalfAxes(halfAxes) {
  126102. let u3 = Matrix3_default.getColumn(halfAxes, 0, scratchU);
  126103. let v7 = Matrix3_default.getColumn(halfAxes, 1, scratchV);
  126104. let w = Matrix3_default.getColumn(halfAxes, 2, scratchW2);
  126105. const uZero = Cartesian3_default.equals(u3, Cartesian3_default.ZERO);
  126106. const vZero = Cartesian3_default.equals(v7, Cartesian3_default.ZERO);
  126107. const wZero = Cartesian3_default.equals(w, Cartesian3_default.ZERO);
  126108. if (!uZero && !vZero && !wZero) {
  126109. return halfAxes;
  126110. }
  126111. if (uZero && vZero && wZero) {
  126112. halfAxes[0] = Math_default.EPSILON7;
  126113. halfAxes[4] = Math_default.EPSILON7;
  126114. halfAxes[8] = Math_default.EPSILON7;
  126115. return halfAxes;
  126116. }
  126117. if (uZero && !vZero && !wZero) {
  126118. u3 = computeMissingVector(v7, w, u3);
  126119. } else if (!uZero && vZero && !wZero) {
  126120. v7 = computeMissingVector(u3, w, v7);
  126121. } else if (!uZero && !vZero && wZero) {
  126122. w = computeMissingVector(v7, u3, w);
  126123. } else if (!uZero) {
  126124. v7 = findOrthogonalVector(u3, v7);
  126125. w = computeMissingVector(v7, u3, w);
  126126. } else if (!vZero) {
  126127. u3 = findOrthogonalVector(v7, u3);
  126128. w = computeMissingVector(v7, u3, w);
  126129. } else if (!wZero) {
  126130. u3 = findOrthogonalVector(w, u3);
  126131. v7 = computeMissingVector(w, u3, v7);
  126132. }
  126133. Matrix3_default.setColumn(halfAxes, 0, u3, halfAxes);
  126134. Matrix3_default.setColumn(halfAxes, 1, v7, halfAxes);
  126135. Matrix3_default.setColumn(halfAxes, 2, w, halfAxes);
  126136. return halfAxes;
  126137. }
  126138. function TileOrientedBoundingBox(center, halfAxes) {
  126139. halfAxes = checkHalfAxes(halfAxes);
  126140. this._orientedBoundingBox = new OrientedBoundingBox_default(center, halfAxes);
  126141. this._boundingSphere = BoundingSphere_default.fromOrientedBoundingBox(
  126142. this._orientedBoundingBox
  126143. );
  126144. }
  126145. Object.defineProperties(TileOrientedBoundingBox.prototype, {
  126146. boundingVolume: {
  126147. get: function() {
  126148. return this._orientedBoundingBox;
  126149. }
  126150. },
  126151. boundingSphere: {
  126152. get: function() {
  126153. return this._boundingSphere;
  126154. }
  126155. }
  126156. });
  126157. TileOrientedBoundingBox.prototype.distanceToCamera = function(frameState) {
  126158. Check_default.defined("frameState", frameState);
  126159. return Math.sqrt(
  126160. this._orientedBoundingBox.distanceSquaredTo(frameState.camera.positionWC)
  126161. );
  126162. };
  126163. TileOrientedBoundingBox.prototype.intersectPlane = function(plane) {
  126164. Check_default.defined("plane", plane);
  126165. return this._orientedBoundingBox.intersectPlane(plane);
  126166. };
  126167. TileOrientedBoundingBox.prototype.update = function(center, halfAxes) {
  126168. Cartesian3_default.clone(center, this._orientedBoundingBox.center);
  126169. halfAxes = checkHalfAxes(halfAxes);
  126170. Matrix3_default.clone(halfAxes, this._orientedBoundingBox.halfAxes);
  126171. BoundingSphere_default.fromOrientedBoundingBox(
  126172. this._orientedBoundingBox,
  126173. this._boundingSphere
  126174. );
  126175. };
  126176. TileOrientedBoundingBox.prototype.createDebugVolume = function(color) {
  126177. Check_default.defined("color", color);
  126178. const geometry = new BoxOutlineGeometry_default({
  126179. minimum: new Cartesian3_default(-1, -1, -1),
  126180. maximum: new Cartesian3_default(1, 1, 1)
  126181. });
  126182. const modelMatrix = Matrix4_default.fromRotationTranslation(
  126183. this.boundingVolume.halfAxes,
  126184. this.boundingVolume.center
  126185. );
  126186. const instance = new GeometryInstance_default({
  126187. geometry,
  126188. id: "outline",
  126189. modelMatrix,
  126190. attributes: {
  126191. color: ColorGeometryInstanceAttribute_default.fromColor(color)
  126192. }
  126193. });
  126194. return new Primitive_default({
  126195. geometryInstances: instance,
  126196. appearance: new PerInstanceColorAppearance_default({
  126197. translucent: false,
  126198. flat: true
  126199. }),
  126200. asynchronous: false
  126201. });
  126202. };
  126203. var TileOrientedBoundingBox_default = TileOrientedBoundingBox;
  126204. // node_modules/cesium/Source/Scene/Cesium3DTile.js
  126205. function Cesium3DTile(tileset, baseResource2, header, parent) {
  126206. this._tileset = tileset;
  126207. this._header = header;
  126208. const hasContentsArray = defined_default(header.contents);
  126209. const hasMultipleContents = hasContentsArray && header.contents.length > 1 || hasExtension(header, "3DTILES_multiple_contents");
  126210. const contentHeader = hasContentsArray && !hasMultipleContents ? header.contents[0] : header.content;
  126211. this.transform = defined_default(header.transform) ? Matrix4_default.unpack(header.transform) : Matrix4_default.clone(Matrix4_default.IDENTITY);
  126212. const parentTransform = defined_default(parent) ? parent.computedTransform : tileset.modelMatrix;
  126213. const computedTransform = Matrix4_default.multiply(
  126214. parentTransform,
  126215. this.transform,
  126216. new Matrix4_default()
  126217. );
  126218. const parentInitialTransform = defined_default(parent) ? parent._initialTransform : Matrix4_default.IDENTITY;
  126219. this._initialTransform = Matrix4_default.multiply(
  126220. parentInitialTransform,
  126221. this.transform,
  126222. new Matrix4_default()
  126223. );
  126224. this.computedTransform = computedTransform;
  126225. this._boundingVolume = this.createBoundingVolume(
  126226. header.boundingVolume,
  126227. computedTransform
  126228. );
  126229. this._boundingVolume2D = void 0;
  126230. let contentBoundingVolume;
  126231. if (defined_default(contentHeader) && defined_default(contentHeader.boundingVolume)) {
  126232. contentBoundingVolume = this.createBoundingVolume(
  126233. contentHeader.boundingVolume,
  126234. computedTransform
  126235. );
  126236. }
  126237. this._contentBoundingVolume = contentBoundingVolume;
  126238. this._contentBoundingVolume2D = void 0;
  126239. let viewerRequestVolume;
  126240. if (defined_default(header.viewerRequestVolume)) {
  126241. viewerRequestVolume = this.createBoundingVolume(
  126242. header.viewerRequestVolume,
  126243. computedTransform
  126244. );
  126245. }
  126246. this._viewerRequestVolume = viewerRequestVolume;
  126247. this.geometricError = header.geometricError;
  126248. this._geometricError = header.geometricError;
  126249. if (!defined_default(this._geometricError)) {
  126250. this._geometricError = defined_default(parent) ? parent.geometricError : tileset._geometricError;
  126251. Cesium3DTile._deprecationWarning(
  126252. "geometricErrorUndefined",
  126253. "Required property geometricError is undefined for this tile. Using parent's geometric error instead."
  126254. );
  126255. }
  126256. this.updateGeometricErrorScale();
  126257. let refine;
  126258. if (defined_default(header.refine)) {
  126259. if (header.refine === "replace" || header.refine === "add") {
  126260. Cesium3DTile._deprecationWarning(
  126261. "lowercase-refine",
  126262. `This tile uses a lowercase refine "${header.refine}". Instead use "${header.refine.toUpperCase()}".`
  126263. );
  126264. }
  126265. refine = header.refine.toUpperCase() === "REPLACE" ? Cesium3DTileRefine_default.REPLACE : Cesium3DTileRefine_default.ADD;
  126266. } else if (defined_default(parent)) {
  126267. refine = parent.refine;
  126268. } else {
  126269. refine = Cesium3DTileRefine_default.REPLACE;
  126270. }
  126271. this.refine = refine;
  126272. this.children = [];
  126273. this.parent = parent;
  126274. let content;
  126275. let hasEmptyContent3 = false;
  126276. let contentState;
  126277. let contentResource;
  126278. let serverKey;
  126279. baseResource2 = Resource_default.createIfNeeded(baseResource2);
  126280. if (hasMultipleContents) {
  126281. contentState = Cesium3DTileContentState_default.UNLOADED;
  126282. contentResource = baseResource2.clone();
  126283. } else if (defined_default(contentHeader)) {
  126284. let contentHeaderUri = contentHeader.uri;
  126285. if (defined_default(contentHeader.url)) {
  126286. Cesium3DTile._deprecationWarning(
  126287. "contentUrl",
  126288. 'This tileset JSON uses the "content.url" property which has been deprecated. Use "content.uri" instead.'
  126289. );
  126290. contentHeaderUri = contentHeader.url;
  126291. }
  126292. contentState = Cesium3DTileContentState_default.UNLOADED;
  126293. contentResource = baseResource2.getDerivedResource({
  126294. url: contentHeaderUri
  126295. });
  126296. serverKey = RequestScheduler_default.getServerKey(
  126297. contentResource.getUrlComponent()
  126298. );
  126299. } else {
  126300. content = new Empty3DTileContent_default(tileset, this);
  126301. hasEmptyContent3 = true;
  126302. contentState = Cesium3DTileContentState_default.READY;
  126303. }
  126304. this._content = content;
  126305. this._contentResource = contentResource;
  126306. this._contentState = contentState;
  126307. this._contentReadyToProcessPromise = void 0;
  126308. this._contentReadyPromise = void 0;
  126309. this._expiredContent = void 0;
  126310. this._serverKey = serverKey;
  126311. this.hasEmptyContent = hasEmptyContent3;
  126312. this.hasTilesetContent = false;
  126313. this.hasImplicitContent = false;
  126314. this.hasImplicitContentMetadata = false;
  126315. this.hasMultipleContents = hasMultipleContents;
  126316. this.metadata = findTileMetadata(tileset, header);
  126317. this.cacheNode = void 0;
  126318. const expire = header.expire;
  126319. let expireDuration;
  126320. let expireDate;
  126321. if (defined_default(expire)) {
  126322. expireDuration = expire.duration;
  126323. if (defined_default(expire.date)) {
  126324. expireDate = JulianDate_default.fromIso8601(expire.date);
  126325. }
  126326. }
  126327. this.expireDuration = expireDuration;
  126328. this.expireDate = expireDate;
  126329. this.lastStyleTime = 0;
  126330. this._optimChildrenWithinParent = Cesium3DTileOptimizationHint_default.NOT_COMPUTED;
  126331. this.clippingPlanesDirty = false;
  126332. this.priorityDeferred = false;
  126333. this.implicitTileset = void 0;
  126334. this.implicitCoordinates = void 0;
  126335. this.implicitSubtree = void 0;
  126336. this._distanceToCamera = 0;
  126337. this._centerZDepth = 0;
  126338. this._screenSpaceError = 0;
  126339. this._screenSpaceErrorProgressiveResolution = 0;
  126340. this._visibilityPlaneMask = 0;
  126341. this._visible = false;
  126342. this._inRequestVolume = false;
  126343. this._finalResolution = true;
  126344. this._depth = 0;
  126345. this._stackLength = 0;
  126346. this._selectionDepth = 0;
  126347. this._updatedVisibilityFrame = 0;
  126348. this._touchedFrame = 0;
  126349. this._visitedFrame = 0;
  126350. this._selectedFrame = 0;
  126351. this._requestedFrame = 0;
  126352. this._ancestorWithContent = void 0;
  126353. this._ancestorWithContentAvailable = void 0;
  126354. this._refines = false;
  126355. this._shouldSelect = false;
  126356. this._isClipped = true;
  126357. this._clippingPlanesState = 0;
  126358. this._debugBoundingVolume = void 0;
  126359. this._debugContentBoundingVolume = void 0;
  126360. this._debugViewerRequestVolume = void 0;
  126361. this._debugColor = Color_default.fromRandom({ alpha: 1 });
  126362. this._debugColorizeTiles = false;
  126363. this._priority = 0;
  126364. this._priorityHolder = this;
  126365. this._priorityProgressiveResolution = false;
  126366. this._priorityProgressiveResolutionScreenSpaceErrorLeaf = false;
  126367. this._priorityReverseScreenSpaceError = 0;
  126368. this._foveatedFactor = 0;
  126369. this._wasMinPriorityChild = false;
  126370. this._loadTimestamp = new JulianDate_default();
  126371. this._commandsLength = 0;
  126372. this._color = void 0;
  126373. this._colorDirty = false;
  126374. this._request = void 0;
  126375. }
  126376. Cesium3DTile._deprecationWarning = deprecationWarning_default;
  126377. Object.defineProperties(Cesium3DTile.prototype, {
  126378. tileset: {
  126379. get: function() {
  126380. return this._tileset;
  126381. }
  126382. },
  126383. content: {
  126384. get: function() {
  126385. return this._content;
  126386. }
  126387. },
  126388. boundingVolume: {
  126389. get: function() {
  126390. return this._boundingVolume;
  126391. }
  126392. },
  126393. contentBoundingVolume: {
  126394. get: function() {
  126395. return defaultValue_default(this._contentBoundingVolume, this._boundingVolume);
  126396. }
  126397. },
  126398. boundingSphere: {
  126399. get: function() {
  126400. return this._boundingVolume.boundingSphere;
  126401. }
  126402. },
  126403. extras: {
  126404. get: function() {
  126405. return this._header.extras;
  126406. }
  126407. },
  126408. color: {
  126409. get: function() {
  126410. if (!defined_default(this._color)) {
  126411. this._color = new Color_default();
  126412. }
  126413. return Color_default.clone(this._color);
  126414. },
  126415. set: function(value) {
  126416. this._color = Color_default.clone(value, this._color);
  126417. this._colorDirty = true;
  126418. }
  126419. },
  126420. contentAvailable: {
  126421. get: function() {
  126422. return this.contentReady && !this.hasEmptyContent && !this.hasTilesetContent && !this.hasImplicitContent || defined_default(this._expiredContent) && !this.contentFailed;
  126423. }
  126424. },
  126425. contentReady: {
  126426. get: function() {
  126427. return this._contentState === Cesium3DTileContentState_default.READY;
  126428. }
  126429. },
  126430. contentUnloaded: {
  126431. get: function() {
  126432. return this._contentState === Cesium3DTileContentState_default.UNLOADED;
  126433. }
  126434. },
  126435. contentExpired: {
  126436. get: function() {
  126437. return this._contentState === Cesium3DTileContentState_default.EXPIRED;
  126438. }
  126439. },
  126440. contentFailed: {
  126441. get: function() {
  126442. return this._contentState === Cesium3DTileContentState_default.FAILED;
  126443. }
  126444. },
  126445. contentReadyToProcessPromise: {
  126446. get: function() {
  126447. if (defined_default(this._contentReadyToProcessPromise)) {
  126448. return this._contentReadyToProcessPromise.promise;
  126449. }
  126450. return void 0;
  126451. }
  126452. },
  126453. contentReadyPromise: {
  126454. get: function() {
  126455. if (defined_default(this._contentReadyPromise)) {
  126456. return this._contentReadyPromise.promise;
  126457. }
  126458. return void 0;
  126459. }
  126460. },
  126461. commandsLength: {
  126462. get: function() {
  126463. return this._commandsLength;
  126464. }
  126465. }
  126466. });
  126467. var scratchCartesian18 = new Cartesian3_default();
  126468. function isPriorityDeferred(tile, frameState) {
  126469. const tileset = tile._tileset;
  126470. const camera = frameState.camera;
  126471. const boundingSphere = tile.boundingSphere;
  126472. const radius = boundingSphere.radius;
  126473. const scaledCameraDirection = Cartesian3_default.multiplyByScalar(
  126474. camera.directionWC,
  126475. tile._centerZDepth,
  126476. scratchCartesian18
  126477. );
  126478. const closestPointOnLine = Cartesian3_default.add(
  126479. camera.positionWC,
  126480. scaledCameraDirection,
  126481. scratchCartesian18
  126482. );
  126483. const toLine = Cartesian3_default.subtract(
  126484. closestPointOnLine,
  126485. boundingSphere.center,
  126486. scratchCartesian18
  126487. );
  126488. const distanceToCenterLine = Cartesian3_default.magnitude(toLine);
  126489. const notTouchingSphere = distanceToCenterLine > radius;
  126490. if (notTouchingSphere) {
  126491. const toLineNormalized = Cartesian3_default.normalize(toLine, scratchCartesian18);
  126492. const scaledToLine = Cartesian3_default.multiplyByScalar(
  126493. toLineNormalized,
  126494. radius,
  126495. scratchCartesian18
  126496. );
  126497. const closestOnSphere = Cartesian3_default.add(
  126498. boundingSphere.center,
  126499. scaledToLine,
  126500. scratchCartesian18
  126501. );
  126502. const toClosestOnSphere = Cartesian3_default.subtract(
  126503. closestOnSphere,
  126504. camera.positionWC,
  126505. scratchCartesian18
  126506. );
  126507. const toClosestOnSphereNormalize = Cartesian3_default.normalize(
  126508. toClosestOnSphere,
  126509. scratchCartesian18
  126510. );
  126511. tile._foveatedFactor = 1 - Math.abs(Cartesian3_default.dot(camera.directionWC, toClosestOnSphereNormalize));
  126512. } else {
  126513. tile._foveatedFactor = 0;
  126514. }
  126515. const replace = tile.refine === Cesium3DTileRefine_default.REPLACE;
  126516. const skipLevelOfDetail2 = tileset._skipLevelOfDetail;
  126517. if (replace && !skipLevelOfDetail2 || !tileset.foveatedScreenSpaceError || tileset.foveatedConeSize === 1 || tile._priorityProgressiveResolution && replace && skipLevelOfDetail2 || tileset._pass === Cesium3DTilePass_default.PRELOAD_FLIGHT || tileset._pass === Cesium3DTilePass_default.PRELOAD) {
  126518. return false;
  126519. }
  126520. const maximumFovatedFactor = 1 - Math.cos(camera.frustum.fov * 0.5);
  126521. const foveatedConeFactor = tileset.foveatedConeSize * maximumFovatedFactor;
  126522. if (tile._foveatedFactor <= foveatedConeFactor) {
  126523. return false;
  126524. }
  126525. const range2 = maximumFovatedFactor - foveatedConeFactor;
  126526. const normalizedFoveatedFactor = Math_default.clamp(
  126527. (tile._foveatedFactor - foveatedConeFactor) / range2,
  126528. 0,
  126529. 1
  126530. );
  126531. const sseRelaxation = tileset.foveatedInterpolationCallback(
  126532. tileset.foveatedMinimumScreenSpaceErrorRelaxation,
  126533. tileset.maximumScreenSpaceError,
  126534. normalizedFoveatedFactor
  126535. );
  126536. const sse = tile._screenSpaceError === 0 && defined_default(tile.parent) ? tile.parent._screenSpaceError * 0.5 : tile._screenSpaceError;
  126537. return tileset.maximumScreenSpaceError - sseRelaxation <= sse;
  126538. }
  126539. var scratchJulianDate2 = new JulianDate_default();
  126540. Cesium3DTile.prototype.getScreenSpaceError = function(frameState, useParentGeometricError, progressiveResolutionHeightFraction) {
  126541. const tileset = this._tileset;
  126542. const heightFraction = defaultValue_default(progressiveResolutionHeightFraction, 1);
  126543. const parentGeometricError = defined_default(this.parent) ? this.parent.geometricError : tileset._geometricError;
  126544. const geometricError = useParentGeometricError ? parentGeometricError : this.geometricError;
  126545. if (geometricError === 0) {
  126546. return 0;
  126547. }
  126548. const camera = frameState.camera;
  126549. let frustum = camera.frustum;
  126550. const context = frameState.context;
  126551. const width = context.drawingBufferWidth;
  126552. const height = context.drawingBufferHeight * heightFraction;
  126553. let error;
  126554. if (frameState.mode === SceneMode_default.SCENE2D || frustum instanceof OrthographicFrustum_default) {
  126555. if (defined_default(frustum._offCenterFrustum)) {
  126556. frustum = frustum._offCenterFrustum;
  126557. }
  126558. const pixelSize = Math.max(frustum.top - frustum.bottom, frustum.right - frustum.left) / Math.max(width, height);
  126559. error = geometricError / pixelSize;
  126560. } else {
  126561. const distance2 = Math.max(this._distanceToCamera, Math_default.EPSILON7);
  126562. const sseDenominator = camera.frustum.sseDenominator;
  126563. error = geometricError * height / (distance2 * sseDenominator);
  126564. if (tileset.dynamicScreenSpaceError) {
  126565. const density = tileset._dynamicScreenSpaceErrorComputedDensity;
  126566. const factor2 = tileset.dynamicScreenSpaceErrorFactor;
  126567. const dynamicError = Math_default.fog(distance2, density) * factor2;
  126568. error -= dynamicError;
  126569. }
  126570. }
  126571. error /= frameState.pixelRatio;
  126572. return error;
  126573. };
  126574. function isPriorityProgressiveResolution(tileset, tile) {
  126575. if (tileset.progressiveResolutionHeightFraction <= 0 || tileset.progressiveResolutionHeightFraction > 0.5) {
  126576. return false;
  126577. }
  126578. let isProgressiveResolutionTile = tile._screenSpaceErrorProgressiveResolution > tileset._maximumScreenSpaceError;
  126579. tile._priorityProgressiveResolutionScreenSpaceErrorLeaf = false;
  126580. const parent = tile.parent;
  126581. const maximumScreenSpaceError = tileset._maximumScreenSpaceError;
  126582. const tilePasses = tile._screenSpaceErrorProgressiveResolution <= maximumScreenSpaceError;
  126583. const parentFails = defined_default(parent) && parent._screenSpaceErrorProgressiveResolution > maximumScreenSpaceError;
  126584. if (tilePasses && parentFails) {
  126585. tile._priorityProgressiveResolutionScreenSpaceErrorLeaf = true;
  126586. isProgressiveResolutionTile = true;
  126587. }
  126588. return isProgressiveResolutionTile;
  126589. }
  126590. function getPriorityReverseScreenSpaceError(tileset, tile) {
  126591. const parent = tile.parent;
  126592. const useParentScreenSpaceError = defined_default(parent) && (!tileset._skipLevelOfDetail || tile._screenSpaceError === 0 || parent.hasTilesetContent || parent.hasImplicitContent);
  126593. const screenSpaceError2 = useParentScreenSpaceError ? parent._screenSpaceError : tile._screenSpaceError;
  126594. return tileset.root._screenSpaceError - screenSpaceError2;
  126595. }
  126596. Cesium3DTile.prototype.updateVisibility = function(frameState) {
  126597. const parent = this.parent;
  126598. const tileset = this._tileset;
  126599. const parentTransform = defined_default(parent) ? parent.computedTransform : tileset.modelMatrix;
  126600. const parentVisibilityPlaneMask = defined_default(parent) ? parent._visibilityPlaneMask : CullingVolume_default.MASK_INDETERMINATE;
  126601. this.updateTransform(parentTransform);
  126602. this._distanceToCamera = this.distanceToTile(frameState);
  126603. this._centerZDepth = this.distanceToTileCenter(frameState);
  126604. this._screenSpaceError = this.getScreenSpaceError(frameState, false);
  126605. this._screenSpaceErrorProgressiveResolution = this.getScreenSpaceError(
  126606. frameState,
  126607. false,
  126608. tileset.progressiveResolutionHeightFraction
  126609. );
  126610. this._visibilityPlaneMask = this.visibility(
  126611. frameState,
  126612. parentVisibilityPlaneMask
  126613. );
  126614. this._visible = this._visibilityPlaneMask !== CullingVolume_default.MASK_OUTSIDE;
  126615. this._inRequestVolume = this.insideViewerRequestVolume(frameState);
  126616. this._priorityReverseScreenSpaceError = getPriorityReverseScreenSpaceError(
  126617. tileset,
  126618. this
  126619. );
  126620. this._priorityProgressiveResolution = isPriorityProgressiveResolution(
  126621. tileset,
  126622. this
  126623. );
  126624. this.priorityDeferred = isPriorityDeferred(this, frameState);
  126625. };
  126626. Cesium3DTile.prototype.updateExpiration = function() {
  126627. if (defined_default(this.expireDate) && this.contentReady && !this.hasEmptyContent && !this.hasMultipleContents) {
  126628. const now = JulianDate_default.now(scratchJulianDate2);
  126629. if (JulianDate_default.lessThan(this.expireDate, now)) {
  126630. this._contentState = Cesium3DTileContentState_default.EXPIRED;
  126631. this._expiredContent = this._content;
  126632. }
  126633. }
  126634. };
  126635. function updateExpireDate(tile) {
  126636. if (defined_default(tile.expireDuration)) {
  126637. const expireDurationDate = JulianDate_default.now(scratchJulianDate2);
  126638. JulianDate_default.addSeconds(
  126639. expireDurationDate,
  126640. tile.expireDuration,
  126641. expireDurationDate
  126642. );
  126643. if (defined_default(tile.expireDate)) {
  126644. if (JulianDate_default.lessThan(tile.expireDate, expireDurationDate)) {
  126645. JulianDate_default.clone(expireDurationDate, tile.expireDate);
  126646. }
  126647. } else {
  126648. tile.expireDate = JulianDate_default.clone(expireDurationDate);
  126649. }
  126650. }
  126651. }
  126652. function createPriorityFunction(tile) {
  126653. return function() {
  126654. return tile._priority;
  126655. };
  126656. }
  126657. Cesium3DTile.prototype.requestContent = function() {
  126658. if (this.hasEmptyContent) {
  126659. return 0;
  126660. }
  126661. if (this.hasMultipleContents) {
  126662. return requestMultipleContents(this);
  126663. }
  126664. return requestSingleContent(this);
  126665. };
  126666. function requestMultipleContents(tile) {
  126667. let multipleContents = tile._content;
  126668. const tileset = tile._tileset;
  126669. if (!defined_default(multipleContents)) {
  126670. const contentsJson = hasExtension(tile._header, "3DTILES_multiple_contents") ? tile._header.extensions["3DTILES_multiple_contents"] : tile._header;
  126671. multipleContents = new Multiple3DTileContent(
  126672. tileset,
  126673. tile,
  126674. tile._contentResource.clone(),
  126675. contentsJson
  126676. );
  126677. tile._content = multipleContents;
  126678. }
  126679. const backloggedRequestCount = multipleContents.requestInnerContents();
  126680. if (backloggedRequestCount > 0) {
  126681. return backloggedRequestCount;
  126682. }
  126683. tile._contentState = Cesium3DTileContentState_default.LOADING;
  126684. tile._contentReadyToProcessPromise = defer_default();
  126685. tile._contentReadyPromise = defer_default();
  126686. multipleContents.contentsFetchedPromise.then(function() {
  126687. if (tile._contentState !== Cesium3DTileContentState_default.LOADING) {
  126688. return;
  126689. }
  126690. if (tile.isDestroyed()) {
  126691. multipleContentFailed(
  126692. tile,
  126693. tileset,
  126694. "Tile was unloaded while content was loading"
  126695. );
  126696. return;
  126697. }
  126698. tile._contentState = Cesium3DTileContentState_default.PROCESSING;
  126699. tile._contentReadyToProcessPromise.resolve(multipleContents);
  126700. return multipleContents.readyPromise.then(function(content) {
  126701. if (tile.isDestroyed()) {
  126702. multipleContentFailed(
  126703. tile,
  126704. tileset,
  126705. "Tile was unloaded while content was processing"
  126706. );
  126707. return;
  126708. }
  126709. tile._selectedFrame = 0;
  126710. tile.lastStyleTime = 0;
  126711. JulianDate_default.now(tile._loadTimestamp);
  126712. tile._contentState = Cesium3DTileContentState_default.READY;
  126713. tile._contentReadyPromise.resolve(content);
  126714. });
  126715. }).catch(function(error) {
  126716. multipleContentFailed(tile, tileset, error);
  126717. });
  126718. return 0;
  126719. }
  126720. function multipleContentFailed(tile, tileset, error) {
  126721. if (tile._contentState === Cesium3DTileContentState_default.PROCESSING) {
  126722. --tileset.statistics.numberOfTilesProcessing;
  126723. }
  126724. tile._contentState = Cesium3DTileContentState_default.FAILED;
  126725. tile._contentReadyPromise.reject(error);
  126726. tile._contentReadyToProcessPromise.reject(error);
  126727. }
  126728. function requestSingleContent(tile) {
  126729. const resource = tile._contentResource.clone();
  126730. const expired = tile.contentExpired;
  126731. if (expired) {
  126732. resource.setQueryParameters({
  126733. expired: tile.expireDate.toString()
  126734. });
  126735. }
  126736. const request = new Request_default({
  126737. throttle: true,
  126738. throttleByServer: true,
  126739. type: RequestType_default.TILES3D,
  126740. priorityFunction: createPriorityFunction(tile),
  126741. serverKey: tile._serverKey
  126742. });
  126743. tile._request = request;
  126744. resource.request = request;
  126745. const promise = resource.fetchArrayBuffer();
  126746. if (!defined_default(promise)) {
  126747. return 1;
  126748. }
  126749. const previousState = tile._contentState;
  126750. const tileset = tile._tileset;
  126751. tile._contentState = Cesium3DTileContentState_default.LOADING;
  126752. tile._contentReadyToProcessPromise = defer_default();
  126753. tile._contentReadyPromise = defer_default();
  126754. ++tileset.statistics.numberOfPendingRequests;
  126755. promise.then(function(arrayBuffer) {
  126756. if (tile.isDestroyed()) {
  126757. singleContentFailed(tile, tileset);
  126758. return;
  126759. }
  126760. const content = makeContent(tile, arrayBuffer);
  126761. if (expired) {
  126762. tile.expireDate = void 0;
  126763. }
  126764. tile._content = content;
  126765. tile._contentState = Cesium3DTileContentState_default.PROCESSING;
  126766. tile._contentReadyToProcessPromise.resolve(content);
  126767. --tileset.statistics.numberOfPendingRequests;
  126768. return content.readyPromise.then(function(content2) {
  126769. if (tile.isDestroyed()) {
  126770. singleContentFailed(tile, tileset);
  126771. return;
  126772. }
  126773. updateExpireDate(tile);
  126774. tile._selectedFrame = 0;
  126775. tile.lastStyleTime = 0;
  126776. JulianDate_default.now(tile._loadTimestamp);
  126777. tile._contentState = Cesium3DTileContentState_default.READY;
  126778. tile._contentReadyPromise.resolve(content2);
  126779. });
  126780. }).catch(function(error) {
  126781. if (request.state === RequestState_default.CANCELLED) {
  126782. tile._contentState = previousState;
  126783. --tileset.statistics.numberOfPendingRequests;
  126784. ++tileset.statistics.numberOfAttemptedRequests;
  126785. return;
  126786. }
  126787. singleContentFailed(tile, tileset, error);
  126788. });
  126789. return 0;
  126790. }
  126791. function singleContentFailed(tile, tileset, error) {
  126792. if (tile._contentState === Cesium3DTileContentState_default.PROCESSING) {
  126793. --tileset.statistics.numberOfTilesProcessing;
  126794. } else {
  126795. --tileset.statistics.numberOfPendingRequests;
  126796. }
  126797. tile._contentState = Cesium3DTileContentState_default.FAILED;
  126798. tile._contentReadyPromise.reject(error);
  126799. tile._contentReadyToProcessPromise.reject(error);
  126800. }
  126801. function makeContent(tile, arrayBuffer) {
  126802. const preprocessed = preprocess3DTileContent(arrayBuffer);
  126803. const tileset = tile._tileset;
  126804. tileset._disableSkipLevelOfDetail = tileset._disableSkipLevelOfDetail || preprocessed.contentType === Cesium3DTileContentType_default.GEOMETRY || preprocessed.contentType === Cesium3DTileContentType_default.VECTOR;
  126805. if (preprocessed.contentType === Cesium3DTileContentType_default.IMPLICIT_SUBTREE || preprocessed.contentType === Cesium3DTileContentType_default.IMPLICIT_SUBTREE_JSON) {
  126806. tile.hasImplicitContent = true;
  126807. }
  126808. if (preprocessed.contentType === Cesium3DTileContentType_default.EXTERNAL_TILESET) {
  126809. tile.hasTilesetContent = true;
  126810. }
  126811. let content;
  126812. const contentFactory = Cesium3DTileContentFactory_default[preprocessed.contentType];
  126813. if (defined_default(preprocessed.binaryPayload)) {
  126814. content = contentFactory(
  126815. tileset,
  126816. tile,
  126817. tile._contentResource,
  126818. preprocessed.binaryPayload.buffer,
  126819. 0
  126820. );
  126821. } else {
  126822. content = contentFactory(
  126823. tileset,
  126824. tile,
  126825. tile._contentResource,
  126826. preprocessed.jsonPayload
  126827. );
  126828. }
  126829. const contentHeader = defined_default(tile._header.contents) ? tile._header.contents[0] : tile._header.content;
  126830. if (tile.hasImplicitContentMetadata) {
  126831. const subtree = tile.implicitSubtree;
  126832. const coordinates = tile.implicitCoordinates;
  126833. content.metadata = subtree.getContentMetadataView(coordinates, 0);
  126834. } else if (!tile.hasImplicitContent) {
  126835. content.metadata = findContentMetadata(tileset, contentHeader);
  126836. }
  126837. const groupMetadata = findGroupMetadata(tileset, contentHeader);
  126838. if (defined_default(groupMetadata)) {
  126839. content.group = new Cesium3DContentGroup({
  126840. metadata: groupMetadata
  126841. });
  126842. }
  126843. return content;
  126844. }
  126845. Cesium3DTile.prototype.cancelRequests = function() {
  126846. if (this.hasMultipleContents) {
  126847. this._content.cancelRequests();
  126848. } else {
  126849. this._request.cancel();
  126850. }
  126851. };
  126852. Cesium3DTile.prototype.unloadContent = function() {
  126853. if (this.hasEmptyContent || this.hasTilesetContent || this.hasImplicitContent) {
  126854. return;
  126855. }
  126856. this._content = this._content && this._content.destroy();
  126857. this._contentState = Cesium3DTileContentState_default.UNLOADED;
  126858. this._contentReadyToProcessPromise = void 0;
  126859. this._contentReadyPromise = void 0;
  126860. this.lastStyleTime = 0;
  126861. this.clippingPlanesDirty = this._clippingPlanesState === 0;
  126862. this._clippingPlanesState = 0;
  126863. this._debugColorizeTiles = false;
  126864. this._debugBoundingVolume = this._debugBoundingVolume && this._debugBoundingVolume.destroy();
  126865. this._debugContentBoundingVolume = this._debugContentBoundingVolume && this._debugContentBoundingVolume.destroy();
  126866. this._debugViewerRequestVolume = this._debugViewerRequestVolume && this._debugViewerRequestVolume.destroy();
  126867. };
  126868. var scratchProjectedBoundingSphere = new BoundingSphere_default();
  126869. function getBoundingVolume(tile, frameState) {
  126870. if (frameState.mode !== SceneMode_default.SCENE3D && !defined_default(tile._boundingVolume2D)) {
  126871. const boundingSphere = tile._boundingVolume.boundingSphere;
  126872. const sphere = BoundingSphere_default.projectTo2D(
  126873. boundingSphere,
  126874. frameState.mapProjection,
  126875. scratchProjectedBoundingSphere
  126876. );
  126877. tile._boundingVolume2D = new TileBoundingSphere_default(
  126878. sphere.center,
  126879. sphere.radius
  126880. );
  126881. }
  126882. return frameState.mode !== SceneMode_default.SCENE3D ? tile._boundingVolume2D : tile._boundingVolume;
  126883. }
  126884. function getContentBoundingVolume2(tile, frameState) {
  126885. if (frameState.mode !== SceneMode_default.SCENE3D && !defined_default(tile._contentBoundingVolume2D)) {
  126886. const boundingSphere = tile._contentBoundingVolume.boundingSphere;
  126887. const sphere = BoundingSphere_default.projectTo2D(
  126888. boundingSphere,
  126889. frameState.mapProjection,
  126890. scratchProjectedBoundingSphere
  126891. );
  126892. tile._contentBoundingVolume2D = new TileBoundingSphere_default(
  126893. sphere.center,
  126894. sphere.radius
  126895. );
  126896. }
  126897. return frameState.mode !== SceneMode_default.SCENE3D ? tile._contentBoundingVolume2D : tile._contentBoundingVolume;
  126898. }
  126899. Cesium3DTile.prototype.visibility = function(frameState, parentVisibilityPlaneMask) {
  126900. const cullingVolume = frameState.cullingVolume;
  126901. const boundingVolume = getBoundingVolume(this, frameState);
  126902. const tileset = this._tileset;
  126903. const clippingPlanes = tileset.clippingPlanes;
  126904. if (defined_default(clippingPlanes) && clippingPlanes.enabled) {
  126905. const intersection = clippingPlanes.computeIntersectionWithBoundingVolume(
  126906. boundingVolume,
  126907. tileset.clippingPlanesOriginMatrix
  126908. );
  126909. this._isClipped = intersection !== Intersect_default.INSIDE;
  126910. if (intersection === Intersect_default.OUTSIDE) {
  126911. return CullingVolume_default.MASK_OUTSIDE;
  126912. }
  126913. }
  126914. return cullingVolume.computeVisibilityWithPlaneMask(
  126915. boundingVolume,
  126916. parentVisibilityPlaneMask
  126917. );
  126918. };
  126919. Cesium3DTile.prototype.contentVisibility = function(frameState) {
  126920. if (!defined_default(this._contentBoundingVolume)) {
  126921. return Intersect_default.INSIDE;
  126922. }
  126923. if (this._visibilityPlaneMask === CullingVolume_default.MASK_INSIDE) {
  126924. return Intersect_default.INSIDE;
  126925. }
  126926. const cullingVolume = frameState.cullingVolume;
  126927. const boundingVolume = getContentBoundingVolume2(this, frameState);
  126928. const tileset = this._tileset;
  126929. const clippingPlanes = tileset.clippingPlanes;
  126930. if (defined_default(clippingPlanes) && clippingPlanes.enabled) {
  126931. const intersection = clippingPlanes.computeIntersectionWithBoundingVolume(
  126932. boundingVolume,
  126933. tileset.clippingPlanesOriginMatrix
  126934. );
  126935. this._isClipped = intersection !== Intersect_default.INSIDE;
  126936. if (intersection === Intersect_default.OUTSIDE) {
  126937. return Intersect_default.OUTSIDE;
  126938. }
  126939. }
  126940. return cullingVolume.computeVisibility(boundingVolume);
  126941. };
  126942. Cesium3DTile.prototype.distanceToTile = function(frameState) {
  126943. const boundingVolume = getBoundingVolume(this, frameState);
  126944. return boundingVolume.distanceToCamera(frameState);
  126945. };
  126946. var scratchToTileCenter = new Cartesian3_default();
  126947. Cesium3DTile.prototype.distanceToTileCenter = function(frameState) {
  126948. const tileBoundingVolume = getBoundingVolume(this, frameState);
  126949. const boundingVolume = tileBoundingVolume.boundingVolume;
  126950. const toCenter = Cartesian3_default.subtract(
  126951. boundingVolume.center,
  126952. frameState.camera.positionWC,
  126953. scratchToTileCenter
  126954. );
  126955. return Cartesian3_default.dot(frameState.camera.directionWC, toCenter);
  126956. };
  126957. Cesium3DTile.prototype.insideViewerRequestVolume = function(frameState) {
  126958. const viewerRequestVolume = this._viewerRequestVolume;
  126959. return !defined_default(viewerRequestVolume) || viewerRequestVolume.distanceToCamera(frameState) === 0;
  126960. };
  126961. var scratchMatrix4 = new Matrix3_default();
  126962. var scratchScale4 = new Cartesian3_default();
  126963. var scratchHalfAxes2 = new Matrix3_default();
  126964. var scratchCenter5 = new Cartesian3_default();
  126965. var scratchRectangle4 = new Rectangle_default();
  126966. var scratchOrientedBoundingBox = new OrientedBoundingBox_default();
  126967. var scratchTransform = new Matrix4_default();
  126968. function createBox(box, transform4, result) {
  126969. let center = Cartesian3_default.fromElements(box[0], box[1], box[2], scratchCenter5);
  126970. let halfAxes = Matrix3_default.fromArray(box, 3, scratchHalfAxes2);
  126971. center = Matrix4_default.multiplyByPoint(transform4, center, center);
  126972. const rotationScale = Matrix4_default.getMatrix3(transform4, scratchMatrix4);
  126973. halfAxes = Matrix3_default.multiply(rotationScale, halfAxes, halfAxes);
  126974. if (defined_default(result)) {
  126975. result.update(center, halfAxes);
  126976. return result;
  126977. }
  126978. return new TileOrientedBoundingBox_default(center, halfAxes);
  126979. }
  126980. function createBoxFromTransformedRegion(region, transform4, initialTransform, result) {
  126981. const rectangle = Rectangle_default.unpack(region, 0, scratchRectangle4);
  126982. const minimumHeight = region[4];
  126983. const maximumHeight = region[5];
  126984. const orientedBoundingBox = OrientedBoundingBox_default.fromRectangle(
  126985. rectangle,
  126986. minimumHeight,
  126987. maximumHeight,
  126988. Ellipsoid_default.WGS84,
  126989. scratchOrientedBoundingBox
  126990. );
  126991. let center = orientedBoundingBox.center;
  126992. let halfAxes = orientedBoundingBox.halfAxes;
  126993. transform4 = Matrix4_default.multiplyTransformation(
  126994. transform4,
  126995. Matrix4_default.inverseTransformation(initialTransform, scratchTransform),
  126996. scratchTransform
  126997. );
  126998. center = Matrix4_default.multiplyByPoint(transform4, center, center);
  126999. const rotationScale = Matrix4_default.getMatrix3(transform4, scratchMatrix4);
  127000. halfAxes = Matrix3_default.multiply(rotationScale, halfAxes, halfAxes);
  127001. if (defined_default(result) && result instanceof TileOrientedBoundingBox_default) {
  127002. result.update(center, halfAxes);
  127003. return result;
  127004. }
  127005. return new TileOrientedBoundingBox_default(center, halfAxes);
  127006. }
  127007. function createRegion(region, transform4, initialTransform, result) {
  127008. if (!Matrix4_default.equalsEpsilon(transform4, initialTransform, Math_default.EPSILON8)) {
  127009. return createBoxFromTransformedRegion(
  127010. region,
  127011. transform4,
  127012. initialTransform,
  127013. result
  127014. );
  127015. }
  127016. if (defined_default(result)) {
  127017. return result;
  127018. }
  127019. const rectangleRegion = Rectangle_default.unpack(region, 0, scratchRectangle4);
  127020. return new TileBoundingRegion_default({
  127021. rectangle: rectangleRegion,
  127022. minimumHeight: region[4],
  127023. maximumHeight: region[5]
  127024. });
  127025. }
  127026. function createSphere(sphere, transform4, result) {
  127027. let center = Cartesian3_default.fromElements(
  127028. sphere[0],
  127029. sphere[1],
  127030. sphere[2],
  127031. scratchCenter5
  127032. );
  127033. let radius = sphere[3];
  127034. center = Matrix4_default.multiplyByPoint(transform4, center, center);
  127035. const scale = Matrix4_default.getScale(transform4, scratchScale4);
  127036. const uniformScale = Cartesian3_default.maximumComponent(scale);
  127037. radius *= uniformScale;
  127038. if (defined_default(result)) {
  127039. result.update(center, radius);
  127040. return result;
  127041. }
  127042. return new TileBoundingSphere_default(center, radius);
  127043. }
  127044. Cesium3DTile.prototype.createBoundingVolume = function(boundingVolumeHeader, transform4, result) {
  127045. if (!defined_default(boundingVolumeHeader)) {
  127046. throw new RuntimeError_default("boundingVolume must be defined");
  127047. }
  127048. if (hasExtension(boundingVolumeHeader, "3DTILES_bounding_volume_S2")) {
  127049. return new TileBoundingS2Cell_default(
  127050. boundingVolumeHeader.extensions["3DTILES_bounding_volume_S2"]
  127051. );
  127052. }
  127053. if (defined_default(boundingVolumeHeader.box)) {
  127054. return createBox(boundingVolumeHeader.box, transform4, result);
  127055. }
  127056. if (defined_default(boundingVolumeHeader.region)) {
  127057. return createRegion(
  127058. boundingVolumeHeader.region,
  127059. transform4,
  127060. this._initialTransform,
  127061. result
  127062. );
  127063. }
  127064. if (defined_default(boundingVolumeHeader.sphere)) {
  127065. return createSphere(boundingVolumeHeader.sphere, transform4, result);
  127066. }
  127067. throw new RuntimeError_default(
  127068. "boundingVolume must contain a sphere, region, or box"
  127069. );
  127070. };
  127071. Cesium3DTile.prototype.updateTransform = function(parentTransform) {
  127072. parentTransform = defaultValue_default(parentTransform, Matrix4_default.IDENTITY);
  127073. const computedTransform = Matrix4_default.multiply(
  127074. parentTransform,
  127075. this.transform,
  127076. scratchTransform
  127077. );
  127078. const transformChanged = !Matrix4_default.equals(
  127079. computedTransform,
  127080. this.computedTransform
  127081. );
  127082. if (!transformChanged) {
  127083. return;
  127084. }
  127085. Matrix4_default.clone(computedTransform, this.computedTransform);
  127086. const header = this._header;
  127087. const content = this._header.content;
  127088. this._boundingVolume = this.createBoundingVolume(
  127089. header.boundingVolume,
  127090. this.computedTransform,
  127091. this._boundingVolume
  127092. );
  127093. if (defined_default(this._contentBoundingVolume)) {
  127094. this._contentBoundingVolume = this.createBoundingVolume(
  127095. content.boundingVolume,
  127096. this.computedTransform,
  127097. this._contentBoundingVolume
  127098. );
  127099. }
  127100. if (defined_default(this._viewerRequestVolume)) {
  127101. this._viewerRequestVolume = this.createBoundingVolume(
  127102. header.viewerRequestVolume,
  127103. this.computedTransform,
  127104. this._viewerRequestVolume
  127105. );
  127106. }
  127107. this.updateGeometricErrorScale();
  127108. this._debugBoundingVolume = this._debugBoundingVolume && this._debugBoundingVolume.destroy();
  127109. this._debugContentBoundingVolume = this._debugContentBoundingVolume && this._debugContentBoundingVolume.destroy();
  127110. this._debugViewerRequestVolume = this._debugViewerRequestVolume && this._debugViewerRequestVolume.destroy();
  127111. };
  127112. Cesium3DTile.prototype.updateGeometricErrorScale = function() {
  127113. const scale = Matrix4_default.getScale(this.computedTransform, scratchScale4);
  127114. const uniformScale = Cartesian3_default.maximumComponent(scale);
  127115. this.geometricError = this._geometricError * uniformScale;
  127116. };
  127117. function applyDebugSettings(tile, tileset, frameState, passOptions2) {
  127118. if (!passOptions2.isRender) {
  127119. return;
  127120. }
  127121. const hasContentBoundingVolume = defined_default(tile._header.content) && defined_default(tile._header.content.boundingVolume);
  127122. const empty = tile.hasEmptyContent || tile.hasTilesetContent || tile.hasImplicitContent;
  127123. const showVolume = tileset.debugShowBoundingVolume || tileset.debugShowContentBoundingVolume && !hasContentBoundingVolume;
  127124. if (showVolume) {
  127125. let color;
  127126. if (!tile._finalResolution) {
  127127. color = Color_default.YELLOW;
  127128. } else if (empty) {
  127129. color = Color_default.DARKGRAY;
  127130. } else {
  127131. color = Color_default.WHITE;
  127132. }
  127133. if (!defined_default(tile._debugBoundingVolume)) {
  127134. tile._debugBoundingVolume = tile._boundingVolume.createDebugVolume(color);
  127135. }
  127136. tile._debugBoundingVolume.update(frameState);
  127137. const attributes = tile._debugBoundingVolume.getGeometryInstanceAttributes(
  127138. "outline"
  127139. );
  127140. attributes.color = ColorGeometryInstanceAttribute_default.toValue(
  127141. color,
  127142. attributes.color
  127143. );
  127144. } else if (!showVolume && defined_default(tile._debugBoundingVolume)) {
  127145. tile._debugBoundingVolume = tile._debugBoundingVolume.destroy();
  127146. }
  127147. if (tileset.debugShowContentBoundingVolume && hasContentBoundingVolume) {
  127148. if (!defined_default(tile._debugContentBoundingVolume)) {
  127149. tile._debugContentBoundingVolume = tile._contentBoundingVolume.createDebugVolume(
  127150. Color_default.BLUE
  127151. );
  127152. }
  127153. tile._debugContentBoundingVolume.update(frameState);
  127154. } else if (!tileset.debugShowContentBoundingVolume && defined_default(tile._debugContentBoundingVolume)) {
  127155. tile._debugContentBoundingVolume = tile._debugContentBoundingVolume.destroy();
  127156. }
  127157. if (tileset.debugShowViewerRequestVolume && defined_default(tile._viewerRequestVolume)) {
  127158. if (!defined_default(tile._debugViewerRequestVolume)) {
  127159. tile._debugViewerRequestVolume = tile._viewerRequestVolume.createDebugVolume(
  127160. Color_default.YELLOW
  127161. );
  127162. }
  127163. tile._debugViewerRequestVolume.update(frameState);
  127164. } else if (!tileset.debugShowViewerRequestVolume && defined_default(tile._debugViewerRequestVolume)) {
  127165. tile._debugViewerRequestVolume = tile._debugViewerRequestVolume.destroy();
  127166. }
  127167. const debugColorizeTilesOn = tileset.debugColorizeTiles && !tile._debugColorizeTiles || defined_default(tileset._heatmap.tilePropertyName);
  127168. const debugColorizeTilesOff = !tileset.debugColorizeTiles && tile._debugColorizeTiles;
  127169. if (debugColorizeTilesOn) {
  127170. tileset._heatmap.colorize(tile, frameState);
  127171. tile._debugColorizeTiles = true;
  127172. tile.color = tile._debugColor;
  127173. } else if (debugColorizeTilesOff) {
  127174. tile._debugColorizeTiles = false;
  127175. tile.color = Color_default.WHITE;
  127176. }
  127177. if (tile._colorDirty) {
  127178. tile._colorDirty = false;
  127179. tile._content.applyDebugSettings(true, tile._color);
  127180. }
  127181. if (debugColorizeTilesOff) {
  127182. tileset.makeStyleDirty();
  127183. }
  127184. }
  127185. function updateContent(tile, tileset, frameState) {
  127186. const content = tile._content;
  127187. const expiredContent = tile._expiredContent;
  127188. if (!tile.hasMultipleContents && defined_default(expiredContent)) {
  127189. if (!tile.contentReady) {
  127190. expiredContent.update(tileset, frameState);
  127191. return;
  127192. }
  127193. tile._expiredContent.destroy();
  127194. tile._expiredContent = void 0;
  127195. }
  127196. content.update(tileset, frameState);
  127197. }
  127198. function updateClippingPlanes2(tile, tileset) {
  127199. const clippingPlanes = tileset.clippingPlanes;
  127200. let currentClippingPlanesState = 0;
  127201. if (defined_default(clippingPlanes) && tile._isClipped && clippingPlanes.enabled) {
  127202. currentClippingPlanesState = clippingPlanes.clippingPlanesState;
  127203. }
  127204. if (currentClippingPlanesState !== tile._clippingPlanesState) {
  127205. tile._clippingPlanesState = currentClippingPlanesState;
  127206. tile.clippingPlanesDirty = true;
  127207. }
  127208. }
  127209. Cesium3DTile.prototype.update = function(tileset, frameState, passOptions2) {
  127210. const commandStart = frameState.commandList.length;
  127211. updateClippingPlanes2(this, tileset);
  127212. applyDebugSettings(this, tileset, frameState, passOptions2);
  127213. updateContent(this, tileset, frameState);
  127214. const commandEnd = frameState.commandList.length;
  127215. const commandsLength = commandEnd - commandStart;
  127216. this._commandsLength = commandsLength;
  127217. for (let i2 = 0; i2 < commandsLength; ++i2) {
  127218. const command = frameState.commandList[commandStart + i2];
  127219. const translucent = command.pass === Pass_default.TRANSLUCENT;
  127220. command.depthForTranslucentClassification = translucent;
  127221. }
  127222. this.clippingPlanesDirty = false;
  127223. };
  127224. var scratchCommandList = [];
  127225. Cesium3DTile.prototype.process = function(tileset, frameState) {
  127226. const savedCommandList = frameState.commandList;
  127227. frameState.commandList = scratchCommandList;
  127228. this._content.update(tileset, frameState);
  127229. scratchCommandList.length = 0;
  127230. frameState.commandList = savedCommandList;
  127231. };
  127232. function isolateDigits(normalizedValue, numberOfDigits, leftShift) {
  127233. const scaled = normalizedValue * Math.pow(10, numberOfDigits);
  127234. const integer = parseInt(scaled);
  127235. return integer * Math.pow(10, leftShift);
  127236. }
  127237. function priorityNormalizeAndClamp(value, minimum, maximum) {
  127238. return Math.max(
  127239. Math_default.normalize(value, minimum, maximum) - Math_default.EPSILON7,
  127240. 0
  127241. );
  127242. }
  127243. Cesium3DTile.prototype.updatePriority = function() {
  127244. const tileset = this.tileset;
  127245. const preferLeaves = tileset.preferLeaves;
  127246. const minimumPriority = tileset._minimumPriority;
  127247. const maximumPriority = tileset._maximumPriority;
  127248. const digitsForANumber = 4;
  127249. const digitsForABoolean = 1;
  127250. const preferredSortingLeftShift = 0;
  127251. const preferredSortingDigitsCount = digitsForANumber;
  127252. const foveatedLeftShift = preferredSortingLeftShift + preferredSortingDigitsCount;
  127253. const foveatedDigitsCount = digitsForANumber;
  127254. const preloadProgressiveResolutionLeftShift = foveatedLeftShift + foveatedDigitsCount;
  127255. const preloadProgressiveResolutionDigitsCount = digitsForABoolean;
  127256. const preloadProgressiveResolutionScale = Math.pow(
  127257. 10,
  127258. preloadProgressiveResolutionLeftShift
  127259. );
  127260. const foveatedDeferLeftShift = preloadProgressiveResolutionLeftShift + preloadProgressiveResolutionDigitsCount;
  127261. const foveatedDeferDigitsCount = digitsForABoolean;
  127262. const foveatedDeferScale = Math.pow(10, foveatedDeferLeftShift);
  127263. const preloadFlightLeftShift = foveatedDeferLeftShift + foveatedDeferDigitsCount;
  127264. const preloadFlightScale = Math.pow(10, preloadFlightLeftShift);
  127265. let depthDigits = priorityNormalizeAndClamp(
  127266. this._depth,
  127267. minimumPriority.depth,
  127268. maximumPriority.depth
  127269. );
  127270. depthDigits = preferLeaves ? 1 - depthDigits : depthDigits;
  127271. const useDistance = !tileset._skipLevelOfDetail && this.refine === Cesium3DTileRefine_default.REPLACE;
  127272. const normalizedPreferredSorting = useDistance ? priorityNormalizeAndClamp(
  127273. this._priorityHolder._distanceToCamera,
  127274. minimumPriority.distance,
  127275. maximumPriority.distance
  127276. ) : priorityNormalizeAndClamp(
  127277. this._priorityReverseScreenSpaceError,
  127278. minimumPriority.reverseScreenSpaceError,
  127279. maximumPriority.reverseScreenSpaceError
  127280. );
  127281. const preferredSortingDigits = isolateDigits(
  127282. normalizedPreferredSorting,
  127283. preferredSortingDigitsCount,
  127284. preferredSortingLeftShift
  127285. );
  127286. const preloadProgressiveResolutionDigits = this._priorityProgressiveResolution ? 0 : preloadProgressiveResolutionScale;
  127287. const normalizedFoveatedFactor = priorityNormalizeAndClamp(
  127288. this._priorityHolder._foveatedFactor,
  127289. minimumPriority.foveatedFactor,
  127290. maximumPriority.foveatedFactor
  127291. );
  127292. const foveatedDigits = isolateDigits(
  127293. normalizedFoveatedFactor,
  127294. foveatedDigitsCount,
  127295. foveatedLeftShift
  127296. );
  127297. const foveatedDeferDigits = this.priorityDeferred ? foveatedDeferScale : 0;
  127298. const preloadFlightDigits = tileset._pass === Cesium3DTilePass_default.PRELOAD_FLIGHT ? 0 : preloadFlightScale;
  127299. this._priority = depthDigits + preferredSortingDigits + preloadProgressiveResolutionDigits + foveatedDigits + foveatedDeferDigits + preloadFlightDigits;
  127300. };
  127301. Cesium3DTile.prototype.isDestroyed = function() {
  127302. return false;
  127303. };
  127304. Cesium3DTile.prototype.destroy = function() {
  127305. this._content = this._content && this._content.destroy();
  127306. this._expiredContent = this._expiredContent && !this._expiredContent.isDestroyed() && this._expiredContent.destroy();
  127307. this._debugBoundingVolume = this._debugBoundingVolume && this._debugBoundingVolume.destroy();
  127308. this._debugContentBoundingVolume = this._debugContentBoundingVolume && this._debugContentBoundingVolume.destroy();
  127309. this._debugViewerRequestVolume = this._debugViewerRequestVolume && this._debugViewerRequestVolume.destroy();
  127310. return destroyObject_default(this);
  127311. };
  127312. var Cesium3DTile_default = Cesium3DTile;
  127313. // node_modules/cesium/Source/Scene/GroupMetadata.js
  127314. function GroupMetadata(options) {
  127315. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  127316. const id = options.id;
  127317. const group = options.group;
  127318. const metadataClass = options.class;
  127319. Check_default.typeOf.object("options.group", group);
  127320. Check_default.typeOf.object("options.class", metadataClass);
  127321. const properties = defined_default(group.properties) ? group.properties : {};
  127322. this._class = metadataClass;
  127323. this._properties = properties;
  127324. this._id = id;
  127325. this._extras = group.extras;
  127326. this._extensions = group.extensions;
  127327. }
  127328. Object.defineProperties(GroupMetadata.prototype, {
  127329. class: {
  127330. get: function() {
  127331. return this._class;
  127332. }
  127333. },
  127334. id: {
  127335. get: function() {
  127336. return this._id;
  127337. }
  127338. },
  127339. extras: {
  127340. get: function() {
  127341. return this._extras;
  127342. }
  127343. },
  127344. extensions: {
  127345. get: function() {
  127346. return this._extensions;
  127347. }
  127348. }
  127349. });
  127350. GroupMetadata.prototype.hasProperty = function(propertyId) {
  127351. return MetadataEntity_default.hasProperty(propertyId, this._properties, this._class);
  127352. };
  127353. GroupMetadata.prototype.hasPropertyBySemantic = function(semantic) {
  127354. return MetadataEntity_default.hasPropertyBySemantic(
  127355. semantic,
  127356. this._properties,
  127357. this._class
  127358. );
  127359. };
  127360. GroupMetadata.prototype.getPropertyIds = function(results) {
  127361. return MetadataEntity_default.getPropertyIds(this._properties, this._class, results);
  127362. };
  127363. GroupMetadata.prototype.getProperty = function(propertyId) {
  127364. return MetadataEntity_default.getProperty(propertyId, this._properties, this._class);
  127365. };
  127366. GroupMetadata.prototype.setProperty = function(propertyId, value) {
  127367. return MetadataEntity_default.setProperty(
  127368. propertyId,
  127369. value,
  127370. this._properties,
  127371. this._class
  127372. );
  127373. };
  127374. GroupMetadata.prototype.getPropertyBySemantic = function(semantic) {
  127375. return MetadataEntity_default.getPropertyBySemantic(
  127376. semantic,
  127377. this._properties,
  127378. this._class
  127379. );
  127380. };
  127381. GroupMetadata.prototype.setPropertyBySemantic = function(semantic, value) {
  127382. return MetadataEntity_default.setPropertyBySemantic(
  127383. semantic,
  127384. value,
  127385. this._properties,
  127386. this._class
  127387. );
  127388. };
  127389. var GroupMetadata_default = GroupMetadata;
  127390. // node_modules/cesium/Source/Scene/TilesetMetadata.js
  127391. function TilesetMetadata(options) {
  127392. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  127393. const tileset = options.tileset;
  127394. const metadataClass = options.class;
  127395. Check_default.typeOf.object("options.tileset", tileset);
  127396. Check_default.typeOf.object("options.class", metadataClass);
  127397. const properties = defined_default(tileset.properties) ? tileset.properties : {};
  127398. this._class = metadataClass;
  127399. this._properties = properties;
  127400. this._extras = tileset.extras;
  127401. this._extensions = tileset.extensions;
  127402. }
  127403. Object.defineProperties(TilesetMetadata.prototype, {
  127404. class: {
  127405. get: function() {
  127406. return this._class;
  127407. }
  127408. },
  127409. extras: {
  127410. get: function() {
  127411. return this._extras;
  127412. }
  127413. },
  127414. extensions: {
  127415. get: function() {
  127416. return this._extensions;
  127417. }
  127418. }
  127419. });
  127420. TilesetMetadata.prototype.hasProperty = function(propertyId) {
  127421. return MetadataEntity_default.hasProperty(propertyId, this._properties, this._class);
  127422. };
  127423. TilesetMetadata.prototype.hasPropertyBySemantic = function(semantic) {
  127424. return MetadataEntity_default.hasPropertyBySemantic(
  127425. semantic,
  127426. this._properties,
  127427. this._class
  127428. );
  127429. };
  127430. TilesetMetadata.prototype.getPropertyIds = function(results) {
  127431. return MetadataEntity_default.getPropertyIds(this._properties, this._class, results);
  127432. };
  127433. TilesetMetadata.prototype.getProperty = function(propertyId) {
  127434. return MetadataEntity_default.getProperty(propertyId, this._properties, this._class);
  127435. };
  127436. TilesetMetadata.prototype.setProperty = function(propertyId, value) {
  127437. return MetadataEntity_default.setProperty(
  127438. propertyId,
  127439. value,
  127440. this._properties,
  127441. this._class
  127442. );
  127443. };
  127444. TilesetMetadata.prototype.getPropertyBySemantic = function(semantic) {
  127445. return MetadataEntity_default.getPropertyBySemantic(
  127446. semantic,
  127447. this._properties,
  127448. this._class
  127449. );
  127450. };
  127451. TilesetMetadata.prototype.setPropertyBySemantic = function(semantic, value) {
  127452. return MetadataEntity_default.setPropertyBySemantic(
  127453. semantic,
  127454. value,
  127455. this._properties,
  127456. this._class
  127457. );
  127458. };
  127459. var TilesetMetadata_default = TilesetMetadata;
  127460. // node_modules/cesium/Source/Scene/Cesium3DTilesetMetadata.js
  127461. function Cesium3DTilesetMetadata(options) {
  127462. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  127463. const metadataJson = options.metadataJson;
  127464. const schema = options.schema;
  127465. Check_default.typeOf.object("options.metadataJson", metadataJson);
  127466. Check_default.typeOf.object("options.schema", schema);
  127467. const metadata = defaultValue_default(metadataJson.metadata, metadataJson.tileset);
  127468. let tileset;
  127469. if (defined_default(metadata)) {
  127470. tileset = new TilesetMetadata_default({
  127471. tileset: metadata,
  127472. class: schema.classes[metadata.class]
  127473. });
  127474. }
  127475. let groupIds = [];
  127476. const groups = [];
  127477. const groupsJson = metadataJson.groups;
  127478. if (Array.isArray(groupsJson)) {
  127479. const length3 = groupsJson.length;
  127480. for (let i2 = 0; i2 < length3; i2++) {
  127481. const group = groupsJson[i2];
  127482. groups.push(
  127483. new GroupMetadata_default({
  127484. group,
  127485. class: schema.classes[group.class]
  127486. })
  127487. );
  127488. }
  127489. } else if (defined_default(groupsJson)) {
  127490. groupIds = Object.keys(groupsJson).sort();
  127491. const length3 = groupIds.length;
  127492. for (let i2 = 0; i2 < length3; i2++) {
  127493. const groupId = groupIds[i2];
  127494. if (groupsJson.hasOwnProperty(groupId)) {
  127495. const group = groupsJson[groupId];
  127496. groups.push(
  127497. new GroupMetadata_default({
  127498. id: groupId,
  127499. group: groupsJson[groupId],
  127500. class: schema.classes[group.class]
  127501. })
  127502. );
  127503. }
  127504. }
  127505. }
  127506. this._schema = schema;
  127507. this._groups = groups;
  127508. this._groupIds = groupIds;
  127509. this._tileset = tileset;
  127510. this._statistics = metadataJson.statistics;
  127511. this._extras = metadataJson.extras;
  127512. this._extensions = metadataJson.extensions;
  127513. }
  127514. Object.defineProperties(Cesium3DTilesetMetadata.prototype, {
  127515. schema: {
  127516. get: function() {
  127517. return this._schema;
  127518. }
  127519. },
  127520. groups: {
  127521. get: function() {
  127522. return this._groups;
  127523. }
  127524. },
  127525. groupIds: {
  127526. get: function() {
  127527. return this._groupIds;
  127528. }
  127529. },
  127530. tileset: {
  127531. get: function() {
  127532. return this._tileset;
  127533. }
  127534. },
  127535. statistics: {
  127536. get: function() {
  127537. return this._statistics;
  127538. }
  127539. },
  127540. extras: {
  127541. get: function() {
  127542. return this._extras;
  127543. }
  127544. },
  127545. extensions: {
  127546. get: function() {
  127547. return this._extensions;
  127548. }
  127549. }
  127550. });
  127551. var Cesium3DTilesetMetadata_default = Cesium3DTilesetMetadata;
  127552. // node_modules/cesium/Source/Scene/Cesium3DTileOptimizations.js
  127553. var Cesium3DTileOptimizations = {};
  127554. var scratchAxis = new Cartesian3_default();
  127555. Cesium3DTileOptimizations.checkChildrenWithinParent = function(tile) {
  127556. Check_default.typeOf.object("tile", tile);
  127557. const children = tile.children;
  127558. const length3 = children.length;
  127559. const boundingVolume = tile.boundingVolume;
  127560. if (boundingVolume instanceof TileOrientedBoundingBox_default || boundingVolume instanceof TileBoundingRegion_default) {
  127561. const orientedBoundingBox = boundingVolume._orientedBoundingBox;
  127562. tile._optimChildrenWithinParent = Cesium3DTileOptimizationHint_default.USE_OPTIMIZATION;
  127563. for (let i2 = 0; i2 < length3; ++i2) {
  127564. const child = children[i2];
  127565. const childBoundingVolume = child.boundingVolume;
  127566. if (!(childBoundingVolume instanceof TileOrientedBoundingBox_default || childBoundingVolume instanceof TileBoundingRegion_default)) {
  127567. tile._optimChildrenWithinParent = Cesium3DTileOptimizationHint_default.SKIP_OPTIMIZATION;
  127568. break;
  127569. }
  127570. const childOrientedBoundingBox = childBoundingVolume._orientedBoundingBox;
  127571. const axis = Cartesian3_default.subtract(
  127572. childOrientedBoundingBox.center,
  127573. orientedBoundingBox.center,
  127574. scratchAxis
  127575. );
  127576. const axisLength = Cartesian3_default.magnitude(axis);
  127577. Cartesian3_default.divideByScalar(axis, axisLength, axis);
  127578. const proj1 = Math.abs(orientedBoundingBox.halfAxes[0] * axis.x) + Math.abs(orientedBoundingBox.halfAxes[1] * axis.y) + Math.abs(orientedBoundingBox.halfAxes[2] * axis.z) + Math.abs(orientedBoundingBox.halfAxes[3] * axis.x) + Math.abs(orientedBoundingBox.halfAxes[4] * axis.y) + Math.abs(orientedBoundingBox.halfAxes[5] * axis.z) + Math.abs(orientedBoundingBox.halfAxes[6] * axis.x) + Math.abs(orientedBoundingBox.halfAxes[7] * axis.y) + Math.abs(orientedBoundingBox.halfAxes[8] * axis.z);
  127579. const proj2 = Math.abs(childOrientedBoundingBox.halfAxes[0] * axis.x) + Math.abs(childOrientedBoundingBox.halfAxes[1] * axis.y) + Math.abs(childOrientedBoundingBox.halfAxes[2] * axis.z) + Math.abs(childOrientedBoundingBox.halfAxes[3] * axis.x) + Math.abs(childOrientedBoundingBox.halfAxes[4] * axis.y) + Math.abs(childOrientedBoundingBox.halfAxes[5] * axis.z) + Math.abs(childOrientedBoundingBox.halfAxes[6] * axis.x) + Math.abs(childOrientedBoundingBox.halfAxes[7] * axis.y) + Math.abs(childOrientedBoundingBox.halfAxes[8] * axis.z);
  127580. if (proj1 <= proj2 + axisLength) {
  127581. tile._optimChildrenWithinParent = Cesium3DTileOptimizationHint_default.SKIP_OPTIMIZATION;
  127582. break;
  127583. }
  127584. }
  127585. }
  127586. return tile._optimChildrenWithinParent === Cesium3DTileOptimizationHint_default.USE_OPTIMIZATION;
  127587. };
  127588. var Cesium3DTileOptimizations_default = Cesium3DTileOptimizations;
  127589. // node_modules/cesium/Source/Scene/Cesium3DTilesetCache.js
  127590. function Cesium3DTilesetCache() {
  127591. this._list = new DoublyLinkedList_default();
  127592. this._sentinel = this._list.add();
  127593. this._trimTiles = false;
  127594. }
  127595. Cesium3DTilesetCache.prototype.reset = function() {
  127596. this._list.splice(this._list.tail, this._sentinel);
  127597. };
  127598. Cesium3DTilesetCache.prototype.touch = function(tile) {
  127599. const node = tile.cacheNode;
  127600. if (defined_default(node)) {
  127601. this._list.splice(this._sentinel, node);
  127602. }
  127603. };
  127604. Cesium3DTilesetCache.prototype.add = function(tile) {
  127605. if (!defined_default(tile.cacheNode)) {
  127606. tile.cacheNode = this._list.add(tile);
  127607. }
  127608. };
  127609. Cesium3DTilesetCache.prototype.unloadTile = function(tileset, tile, unloadCallback) {
  127610. const node = tile.cacheNode;
  127611. if (!defined_default(node)) {
  127612. return;
  127613. }
  127614. this._list.remove(node);
  127615. tile.cacheNode = void 0;
  127616. unloadCallback(tileset, tile);
  127617. };
  127618. Cesium3DTilesetCache.prototype.unloadTiles = function(tileset, unloadCallback) {
  127619. const trimTiles = this._trimTiles;
  127620. this._trimTiles = false;
  127621. const list = this._list;
  127622. const maximumMemoryUsageInBytes = tileset.maximumMemoryUsage * 1024 * 1024;
  127623. const sentinel = this._sentinel;
  127624. let node = list.head;
  127625. while (node !== sentinel && (tileset.totalMemoryUsageInBytes > maximumMemoryUsageInBytes || trimTiles)) {
  127626. const tile = node.item;
  127627. node = node.next;
  127628. this.unloadTile(tileset, tile, unloadCallback);
  127629. }
  127630. };
  127631. Cesium3DTilesetCache.prototype.trim = function() {
  127632. this._trimTiles = true;
  127633. };
  127634. var Cesium3DTilesetCache_default = Cesium3DTilesetCache;
  127635. // node_modules/cesium/Source/Scene/Cesium3DTilesetHeatmap.js
  127636. function Cesium3DTilesetHeatmap(tilePropertyName) {
  127637. this.tilePropertyName = tilePropertyName;
  127638. this._minimum = Number.MAX_VALUE;
  127639. this._maximum = -Number.MAX_VALUE;
  127640. this._previousMinimum = Number.MAX_VALUE;
  127641. this._previousMaximum = -Number.MAX_VALUE;
  127642. this._referenceMinimum = {};
  127643. this._referenceMaximum = {};
  127644. }
  127645. function getHeatmapValue(tileValue, tilePropertyName) {
  127646. let value;
  127647. if (tilePropertyName === "_loadTimestamp") {
  127648. value = JulianDate_default.toDate(tileValue).getTime();
  127649. } else {
  127650. value = tileValue;
  127651. }
  127652. return value;
  127653. }
  127654. Cesium3DTilesetHeatmap.prototype.setReferenceMinimumMaximum = function(minimum, maximum, tilePropertyName) {
  127655. this._referenceMinimum[tilePropertyName] = getHeatmapValue(
  127656. minimum,
  127657. tilePropertyName
  127658. );
  127659. this._referenceMaximum[tilePropertyName] = getHeatmapValue(
  127660. maximum,
  127661. tilePropertyName
  127662. );
  127663. };
  127664. function getHeatmapValueAndUpdateMinimumMaximum(heatmap, tile) {
  127665. const tilePropertyName = heatmap.tilePropertyName;
  127666. if (defined_default(tilePropertyName)) {
  127667. const heatmapValue = getHeatmapValue(
  127668. tile[tilePropertyName],
  127669. tilePropertyName
  127670. );
  127671. if (!defined_default(heatmapValue)) {
  127672. heatmap.tilePropertyName = void 0;
  127673. return heatmapValue;
  127674. }
  127675. heatmap._maximum = Math.max(heatmapValue, heatmap._maximum);
  127676. heatmap._minimum = Math.min(heatmapValue, heatmap._minimum);
  127677. return heatmapValue;
  127678. }
  127679. }
  127680. var heatmapColors = [
  127681. new Color_default(0.1, 0.1, 0.1, 1),
  127682. new Color_default(0.153, 0.278, 0.878, 1),
  127683. new Color_default(0.827, 0.231, 0.49, 1),
  127684. new Color_default(0.827, 0.188, 0.22, 1),
  127685. new Color_default(1, 0.592, 0.259, 1),
  127686. new Color_default(1, 0.843, 0, 1)
  127687. ];
  127688. Cesium3DTilesetHeatmap.prototype.colorize = function(tile, frameState) {
  127689. const tilePropertyName = this.tilePropertyName;
  127690. if (!defined_default(tilePropertyName) || !tile.contentAvailable || tile._selectedFrame !== frameState.frameNumber) {
  127691. return;
  127692. }
  127693. const heatmapValue = getHeatmapValueAndUpdateMinimumMaximum(this, tile);
  127694. const minimum = this._previousMinimum;
  127695. const maximum = this._previousMaximum;
  127696. if (minimum === Number.MAX_VALUE || maximum === -Number.MAX_VALUE) {
  127697. return;
  127698. }
  127699. const shiftedMax = maximum - minimum + Math_default.EPSILON7;
  127700. const shiftedValue = Math_default.clamp(
  127701. heatmapValue - minimum,
  127702. 0,
  127703. shiftedMax
  127704. );
  127705. const zeroToOne = shiftedValue / shiftedMax;
  127706. const lastIndex = heatmapColors.length - 1;
  127707. const colorPosition = zeroToOne * lastIndex;
  127708. const colorPositionFloor = Math.floor(colorPosition);
  127709. const colorPositionCeil = Math.ceil(colorPosition);
  127710. const t = colorPosition - colorPositionFloor;
  127711. const colorZero = heatmapColors[colorPositionFloor];
  127712. const colorOne = heatmapColors[colorPositionCeil];
  127713. const finalColor = Color_default.clone(Color_default.WHITE);
  127714. finalColor.red = Math_default.lerp(colorZero.red, colorOne.red, t);
  127715. finalColor.green = Math_default.lerp(colorZero.green, colorOne.green, t);
  127716. finalColor.blue = Math_default.lerp(colorZero.blue, colorOne.blue, t);
  127717. tile._debugColor = finalColor;
  127718. };
  127719. Cesium3DTilesetHeatmap.prototype.resetMinimumMaximum = function() {
  127720. const tilePropertyName = this.tilePropertyName;
  127721. if (defined_default(tilePropertyName)) {
  127722. const referenceMinimum = this._referenceMinimum[tilePropertyName];
  127723. const referenceMaximum = this._referenceMaximum[tilePropertyName];
  127724. const useReference = defined_default(referenceMinimum) && defined_default(referenceMaximum);
  127725. this._previousMinimum = useReference ? referenceMinimum : this._minimum;
  127726. this._previousMaximum = useReference ? referenceMaximum : this._maximum;
  127727. this._minimum = Number.MAX_VALUE;
  127728. this._maximum = -Number.MAX_VALUE;
  127729. }
  127730. };
  127731. var Cesium3DTilesetHeatmap_default = Cesium3DTilesetHeatmap;
  127732. // node_modules/cesium/Source/Scene/Cesium3DTilesetStatistics.js
  127733. function Cesium3DTilesetStatistics() {
  127734. this.selected = 0;
  127735. this.visited = 0;
  127736. this.numberOfCommands = 0;
  127737. this.numberOfAttemptedRequests = 0;
  127738. this.numberOfPendingRequests = 0;
  127739. this.numberOfTilesProcessing = 0;
  127740. this.numberOfTilesWithContentReady = 0;
  127741. this.numberOfTilesTotal = 0;
  127742. this.numberOfLoadedTilesTotal = 0;
  127743. this.numberOfFeaturesSelected = 0;
  127744. this.numberOfFeaturesLoaded = 0;
  127745. this.numberOfPointsSelected = 0;
  127746. this.numberOfPointsLoaded = 0;
  127747. this.numberOfTrianglesSelected = 0;
  127748. this.numberOfTilesStyled = 0;
  127749. this.numberOfFeaturesStyled = 0;
  127750. this.numberOfTilesCulledWithChildrenUnion = 0;
  127751. this.geometryByteLength = 0;
  127752. this.texturesByteLength = 0;
  127753. this.batchTableByteLength = 0;
  127754. }
  127755. Cesium3DTilesetStatistics.prototype.clear = function() {
  127756. this.selected = 0;
  127757. this.visited = 0;
  127758. this.numberOfCommands = 0;
  127759. this.numberOfAttemptedRequests = 0;
  127760. this.numberOfFeaturesSelected = 0;
  127761. this.numberOfPointsSelected = 0;
  127762. this.numberOfTrianglesSelected = 0;
  127763. this.numberOfTilesStyled = 0;
  127764. this.numberOfFeaturesStyled = 0;
  127765. this.numberOfTilesCulledWithChildrenUnion = 0;
  127766. };
  127767. function updatePointAndFeatureCounts(statistics2, content, decrement, load5) {
  127768. const contents = content.innerContents;
  127769. const pointsLength = content.pointsLength;
  127770. const trianglesLength = content.trianglesLength;
  127771. const featuresLength = content.featuresLength;
  127772. const geometryByteLength = content.geometryByteLength;
  127773. const texturesByteLength = content.texturesByteLength;
  127774. const batchTableByteLength = content.batchTableByteLength;
  127775. if (load5) {
  127776. statistics2.numberOfFeaturesLoaded += decrement ? -featuresLength : featuresLength;
  127777. statistics2.numberOfPointsLoaded += decrement ? -pointsLength : pointsLength;
  127778. statistics2.geometryByteLength += decrement ? -geometryByteLength : geometryByteLength;
  127779. statistics2.texturesByteLength += decrement ? -texturesByteLength : texturesByteLength;
  127780. statistics2.batchTableByteLength += decrement ? -batchTableByteLength : batchTableByteLength;
  127781. } else {
  127782. statistics2.numberOfFeaturesSelected += decrement ? -featuresLength : featuresLength;
  127783. statistics2.numberOfPointsSelected += decrement ? -pointsLength : pointsLength;
  127784. statistics2.numberOfTrianglesSelected += decrement ? -trianglesLength : trianglesLength;
  127785. }
  127786. if (defined_default(contents)) {
  127787. const length3 = contents.length;
  127788. for (let i2 = 0; i2 < length3; ++i2) {
  127789. updatePointAndFeatureCounts(statistics2, contents[i2], decrement, load5);
  127790. }
  127791. }
  127792. }
  127793. Cesium3DTilesetStatistics.prototype.incrementSelectionCounts = function(content) {
  127794. updatePointAndFeatureCounts(this, content, false, false);
  127795. };
  127796. Cesium3DTilesetStatistics.prototype.incrementLoadCounts = function(content) {
  127797. updatePointAndFeatureCounts(this, content, false, true);
  127798. };
  127799. Cesium3DTilesetStatistics.prototype.decrementLoadCounts = function(content) {
  127800. updatePointAndFeatureCounts(this, content, true, true);
  127801. };
  127802. Cesium3DTilesetStatistics.clone = function(statistics2, result) {
  127803. result.selected = statistics2.selected;
  127804. result.visited = statistics2.visited;
  127805. result.numberOfCommands = statistics2.numberOfCommands;
  127806. result.selected = statistics2.selected;
  127807. result.numberOfAttemptedRequests = statistics2.numberOfAttemptedRequests;
  127808. result.numberOfPendingRequests = statistics2.numberOfPendingRequests;
  127809. result.numberOfTilesProcessing = statistics2.numberOfTilesProcessing;
  127810. result.numberOfTilesWithContentReady = statistics2.numberOfTilesWithContentReady;
  127811. result.numberOfTilesTotal = statistics2.numberOfTilesTotal;
  127812. result.numberOfFeaturesSelected = statistics2.numberOfFeaturesSelected;
  127813. result.numberOfFeaturesLoaded = statistics2.numberOfFeaturesLoaded;
  127814. result.numberOfPointsSelected = statistics2.numberOfPointsSelected;
  127815. result.numberOfPointsLoaded = statistics2.numberOfPointsLoaded;
  127816. result.numberOfTrianglesSelected = statistics2.numberOfTrianglesSelected;
  127817. result.numberOfTilesStyled = statistics2.numberOfTilesStyled;
  127818. result.numberOfFeaturesStyled = statistics2.numberOfFeaturesStyled;
  127819. result.numberOfTilesCulledWithChildrenUnion = statistics2.numberOfTilesCulledWithChildrenUnion;
  127820. result.geometryByteLength = statistics2.geometryByteLength;
  127821. result.texturesByteLength = statistics2.texturesByteLength;
  127822. result.batchTableByteLength = statistics2.batchTableByteLength;
  127823. };
  127824. var Cesium3DTilesetStatistics_default = Cesium3DTilesetStatistics;
  127825. // node_modules/cesium/Source/Scene/Cesium3DTileStyleEngine.js
  127826. function Cesium3DTileStyleEngine() {
  127827. this._style = void 0;
  127828. this._styleDirty = false;
  127829. this._lastStyleTime = 0;
  127830. }
  127831. Object.defineProperties(Cesium3DTileStyleEngine.prototype, {
  127832. style: {
  127833. get: function() {
  127834. return this._style;
  127835. },
  127836. set: function(value) {
  127837. if (value === this._style) {
  127838. return;
  127839. }
  127840. this._style = value;
  127841. this._styleDirty = true;
  127842. }
  127843. }
  127844. });
  127845. Cesium3DTileStyleEngine.prototype.makeDirty = function() {
  127846. this._styleDirty = true;
  127847. };
  127848. Cesium3DTileStyleEngine.prototype.resetDirty = function() {
  127849. this._styleDirty = false;
  127850. };
  127851. Cesium3DTileStyleEngine.prototype.applyStyle = function(tileset) {
  127852. if (!tileset.ready) {
  127853. return;
  127854. }
  127855. if (defined_default(this._style) && !this._style.ready) {
  127856. return;
  127857. }
  127858. const styleDirty = this._styleDirty;
  127859. if (styleDirty) {
  127860. ++this._lastStyleTime;
  127861. }
  127862. const lastStyleTime = this._lastStyleTime;
  127863. const statistics2 = tileset._statistics;
  127864. const tiles = styleDirty ? tileset._selectedTiles : tileset._selectedTilesToStyle;
  127865. const length3 = tiles.length;
  127866. for (let i2 = 0; i2 < length3; ++i2) {
  127867. const tile = tiles[i2];
  127868. if (tile.lastStyleTime !== lastStyleTime) {
  127869. const content = tile.content;
  127870. tile.lastStyleTime = lastStyleTime;
  127871. content.applyStyle(this._style);
  127872. statistics2.numberOfFeaturesStyled += content.featuresLength;
  127873. ++statistics2.numberOfTilesStyled;
  127874. }
  127875. }
  127876. };
  127877. var Cesium3DTileStyleEngine_default = Cesium3DTileStyleEngine;
  127878. // node_modules/cesium/Source/Scene/ImplicitTileset.js
  127879. function ImplicitTileset(baseResource2, tileJson, metadataSchema) {
  127880. const implicitTiling = hasExtension(tileJson, "3DTILES_implicit_tiling") ? tileJson.extensions["3DTILES_implicit_tiling"] : tileJson.implicitTiling;
  127881. Check_default.typeOf.object("implicitTiling", implicitTiling);
  127882. this.baseResource = baseResource2;
  127883. this.geometricError = tileJson.geometricError;
  127884. this.metadataSchema = metadataSchema;
  127885. const boundingVolume = tileJson.boundingVolume;
  127886. if (!defined_default(boundingVolume.box) && !defined_default(boundingVolume.region) && !hasExtension(boundingVolume, "3DTILES_bounding_volume_S2")) {
  127887. throw new RuntimeError_default(
  127888. "Only box, region and 3DTILES_bounding_volume_S2 are supported for implicit tiling"
  127889. );
  127890. }
  127891. this.boundingVolume = boundingVolume;
  127892. this.refine = tileJson.refine;
  127893. this.subtreeUriTemplate = new Resource_default({ url: implicitTiling.subtrees.uri });
  127894. this.contentUriTemplates = [];
  127895. this.contentHeaders = [];
  127896. const contentHeaders = gatherContentHeaders(tileJson);
  127897. for (let i2 = 0; i2 < contentHeaders.length; i2++) {
  127898. const contentHeader = contentHeaders[i2];
  127899. this.contentHeaders.push(clone_default(contentHeader, true));
  127900. const contentResource = new Resource_default({ url: contentHeader.uri });
  127901. this.contentUriTemplates.push(contentResource);
  127902. }
  127903. this.contentCount = this.contentHeaders.length;
  127904. this.tileHeader = makeTileHeaderTemplate(tileJson);
  127905. this.subdivisionScheme = ImplicitSubdivisionScheme_default[implicitTiling.subdivisionScheme];
  127906. this.branchingFactor = ImplicitSubdivisionScheme_default.getBranchingFactor(
  127907. this.subdivisionScheme
  127908. );
  127909. this.subtreeLevels = implicitTiling.subtreeLevels;
  127910. if (defined_default(implicitTiling.availableLevels)) {
  127911. this.availableLevels = implicitTiling.availableLevels;
  127912. } else {
  127913. this.availableLevels = implicitTiling.maximumLevel + 1;
  127914. }
  127915. }
  127916. function gatherContentHeaders(tileJson) {
  127917. if (hasExtension(tileJson, "3DTILES_multiple_contents")) {
  127918. const extension = tileJson.extensions["3DTILES_multiple_contents"];
  127919. return defined_default(extension.contents) ? extension.contents : extension.content;
  127920. }
  127921. if (defined_default(tileJson.contents)) {
  127922. return tileJson.contents;
  127923. }
  127924. if (defined_default(tileJson.content)) {
  127925. return [tileJson.content];
  127926. }
  127927. return [];
  127928. }
  127929. function makeTileHeaderTemplate(tileJson) {
  127930. const template = clone_default(tileJson, true);
  127931. if (defined_default(template.extensions)) {
  127932. delete template.extensions["3DTILES_implicit_tiling"];
  127933. delete template.extensions["3DTILES_multiple_contents"];
  127934. if (Object.keys(template.extensions).length === 0) {
  127935. delete template.extensions;
  127936. }
  127937. }
  127938. delete template.implicitTiling;
  127939. delete template.contents;
  127940. delete template.content;
  127941. return template;
  127942. }
  127943. // node_modules/cesium/Source/Scene/ImplicitTileCoordinates.js
  127944. function ImplicitTileCoordinates(options) {
  127945. Check_default.typeOf.string("options.subdivisionScheme", options.subdivisionScheme);
  127946. Check_default.typeOf.number("options.subtreeLevels", options.subtreeLevels);
  127947. Check_default.typeOf.number("options.level", options.level);
  127948. Check_default.typeOf.number("options.x", options.x);
  127949. Check_default.typeOf.number("options.y", options.y);
  127950. if (options.subdivisionScheme === ImplicitSubdivisionScheme_default.OCTREE) {
  127951. Check_default.typeOf.number("options.z", options.z);
  127952. }
  127953. if (options.level < 0) {
  127954. throw new DeveloperError_default("level must be non-negative");
  127955. }
  127956. if (options.x < 0) {
  127957. throw new DeveloperError_default("x must be non-negative");
  127958. }
  127959. if (options.y < 0) {
  127960. throw new DeveloperError_default("y must be non-negative");
  127961. }
  127962. if (options.subdivisionScheme === ImplicitSubdivisionScheme_default.OCTREE) {
  127963. if (options.z < 0) {
  127964. throw new DeveloperError_default("z must be non-negative");
  127965. }
  127966. }
  127967. const dimensionAtLevel = 1 << options.level;
  127968. if (options.x >= dimensionAtLevel) {
  127969. throw new DeveloperError_default("x is out of range");
  127970. }
  127971. if (options.y >= dimensionAtLevel) {
  127972. throw new DeveloperError_default("y is out of range");
  127973. }
  127974. if (options.subdivisionScheme === ImplicitSubdivisionScheme_default.OCTREE) {
  127975. if (options.z >= dimensionAtLevel) {
  127976. throw new DeveloperError_default("z is out of range");
  127977. }
  127978. }
  127979. this.subdivisionScheme = options.subdivisionScheme;
  127980. this.subtreeLevels = options.subtreeLevels;
  127981. this.level = options.level;
  127982. this.x = options.x;
  127983. this.y = options.y;
  127984. this.z = void 0;
  127985. if (options.subdivisionScheme === ImplicitSubdivisionScheme_default.OCTREE) {
  127986. this.z = options.z;
  127987. }
  127988. }
  127989. Object.defineProperties(ImplicitTileCoordinates.prototype, {
  127990. childIndex: {
  127991. get: function() {
  127992. let childIndex = 0;
  127993. childIndex |= this.x & 1;
  127994. childIndex |= (this.y & 1) << 1;
  127995. if (this.subdivisionScheme === ImplicitSubdivisionScheme_default.OCTREE) {
  127996. childIndex |= (this.z & 1) << 2;
  127997. }
  127998. return childIndex;
  127999. }
  128000. },
  128001. mortonIndex: {
  128002. get: function() {
  128003. if (this.subdivisionScheme === ImplicitSubdivisionScheme_default.OCTREE) {
  128004. return MortonOrder_default.encode3D(this.x, this.y, this.z);
  128005. }
  128006. return MortonOrder_default.encode2D(this.x, this.y);
  128007. }
  128008. },
  128009. tileIndex: {
  128010. get: function() {
  128011. const levelOffset = this.subdivisionScheme === ImplicitSubdivisionScheme_default.OCTREE ? ((1 << 3 * this.level) - 1) / 7 : ((1 << 2 * this.level) - 1) / 3;
  128012. const mortonIndex = this.mortonIndex;
  128013. return levelOffset + mortonIndex;
  128014. }
  128015. }
  128016. });
  128017. function checkMatchingSubtreeShape(a4, b) {
  128018. if (a4.subdivisionScheme !== b.subdivisionScheme) {
  128019. throw new DeveloperError_default("coordinates must have same subdivisionScheme");
  128020. }
  128021. if (a4.subtreeLevels !== b.subtreeLevels) {
  128022. throw new DeveloperError_default("coordinates must have same subtreeLevels");
  128023. }
  128024. }
  128025. ImplicitTileCoordinates.prototype.getDescendantCoordinates = function(offsetCoordinates) {
  128026. Check_default.typeOf.object("offsetCoordinates", offsetCoordinates);
  128027. checkMatchingSubtreeShape(this, offsetCoordinates);
  128028. const descendantLevel = this.level + offsetCoordinates.level;
  128029. const descendantX = (this.x << offsetCoordinates.level) + offsetCoordinates.x;
  128030. const descendantY = (this.y << offsetCoordinates.level) + offsetCoordinates.y;
  128031. if (this.subdivisionScheme === ImplicitSubdivisionScheme_default.OCTREE) {
  128032. const descendantZ = (this.z << offsetCoordinates.level) + offsetCoordinates.z;
  128033. return new ImplicitTileCoordinates({
  128034. subdivisionScheme: this.subdivisionScheme,
  128035. subtreeLevels: this.subtreeLevels,
  128036. level: descendantLevel,
  128037. x: descendantX,
  128038. y: descendantY,
  128039. z: descendantZ
  128040. });
  128041. }
  128042. return new ImplicitTileCoordinates({
  128043. subdivisionScheme: this.subdivisionScheme,
  128044. subtreeLevels: this.subtreeLevels,
  128045. level: descendantLevel,
  128046. x: descendantX,
  128047. y: descendantY
  128048. });
  128049. };
  128050. ImplicitTileCoordinates.prototype.getAncestorCoordinates = function(offsetLevels) {
  128051. Check_default.typeOf.number("offsetLevels", offsetLevels);
  128052. if (offsetLevels < 0) {
  128053. throw new DeveloperError_default("offsetLevels must be non-negative");
  128054. }
  128055. if (offsetLevels > this.level) {
  128056. throw new DeveloperError_default("ancestor cannot be above the tileset root");
  128057. }
  128058. const divisor = 1 << offsetLevels;
  128059. const ancestorLevel = this.level - offsetLevels;
  128060. const ancestorX = Math.floor(this.x / divisor);
  128061. const ancestorY = Math.floor(this.y / divisor);
  128062. if (this.subdivisionScheme === ImplicitSubdivisionScheme_default.OCTREE) {
  128063. const ancestorZ = Math.floor(this.z / divisor);
  128064. return new ImplicitTileCoordinates({
  128065. subdivisionScheme: this.subdivisionScheme,
  128066. subtreeLevels: this.subtreeLevels,
  128067. level: ancestorLevel,
  128068. x: ancestorX,
  128069. y: ancestorY,
  128070. z: ancestorZ
  128071. });
  128072. }
  128073. return new ImplicitTileCoordinates({
  128074. subdivisionScheme: this.subdivisionScheme,
  128075. subtreeLevels: this.subtreeLevels,
  128076. level: ancestorLevel,
  128077. x: ancestorX,
  128078. y: ancestorY
  128079. });
  128080. };
  128081. ImplicitTileCoordinates.prototype.getOffsetCoordinates = function(descendantCoordinates) {
  128082. Check_default.typeOf.object("descendantCoordinates", descendantCoordinates);
  128083. if (!this.isEqual(descendantCoordinates) && !this.isAncestor(descendantCoordinates)) {
  128084. throw new DeveloperError_default("this is not an ancestor of descendant");
  128085. }
  128086. checkMatchingSubtreeShape(this, descendantCoordinates);
  128087. const offsetLevel = descendantCoordinates.level - this.level;
  128088. const dimensionAtOffsetLevel = 1 << offsetLevel;
  128089. const offsetX = descendantCoordinates.x % dimensionAtOffsetLevel;
  128090. const offsetY = descendantCoordinates.y % dimensionAtOffsetLevel;
  128091. if (this.subdivisionScheme === ImplicitSubdivisionScheme_default.OCTREE) {
  128092. const offsetZ = descendantCoordinates.z % dimensionAtOffsetLevel;
  128093. return new ImplicitTileCoordinates({
  128094. subdivisionScheme: this.subdivisionScheme,
  128095. subtreeLevels: this.subtreeLevels,
  128096. level: offsetLevel,
  128097. x: offsetX,
  128098. y: offsetY,
  128099. z: offsetZ
  128100. });
  128101. }
  128102. return new ImplicitTileCoordinates({
  128103. subdivisionScheme: this.subdivisionScheme,
  128104. subtreeLevels: this.subtreeLevels,
  128105. level: offsetLevel,
  128106. x: offsetX,
  128107. y: offsetY
  128108. });
  128109. };
  128110. ImplicitTileCoordinates.prototype.getChildCoordinates = function(childIndex) {
  128111. Check_default.typeOf.number("childIndex", childIndex);
  128112. const branchingFactor = ImplicitSubdivisionScheme_default.getBranchingFactor(
  128113. this.subdivisionScheme
  128114. );
  128115. if (childIndex < 0 || branchingFactor <= childIndex) {
  128116. throw new DeveloperError_default(
  128117. `childIndex must be at least 0 and less than ${branchingFactor}`
  128118. );
  128119. }
  128120. const level = this.level + 1;
  128121. const x = 2 * this.x + childIndex % 2;
  128122. const y = 2 * this.y + Math.floor(childIndex / 2) % 2;
  128123. if (this.subdivisionScheme === ImplicitSubdivisionScheme_default.OCTREE) {
  128124. const z = 2 * this.z + Math.floor(childIndex / 4) % 2;
  128125. return new ImplicitTileCoordinates({
  128126. subdivisionScheme: this.subdivisionScheme,
  128127. subtreeLevels: this.subtreeLevels,
  128128. level,
  128129. x,
  128130. y,
  128131. z
  128132. });
  128133. }
  128134. return new ImplicitTileCoordinates({
  128135. subdivisionScheme: this.subdivisionScheme,
  128136. subtreeLevels: this.subtreeLevels,
  128137. level,
  128138. x,
  128139. y
  128140. });
  128141. };
  128142. ImplicitTileCoordinates.prototype.getSubtreeCoordinates = function() {
  128143. return this.getAncestorCoordinates(this.level % this.subtreeLevels);
  128144. };
  128145. ImplicitTileCoordinates.prototype.getParentSubtreeCoordinates = function() {
  128146. return this.getAncestorCoordinates(
  128147. this.level % this.subtreeLevels + this.subtreeLevels
  128148. );
  128149. };
  128150. ImplicitTileCoordinates.prototype.isAncestor = function(descendantCoordinates) {
  128151. Check_default.typeOf.object("descendantCoordinates", descendantCoordinates);
  128152. checkMatchingSubtreeShape(this, descendantCoordinates);
  128153. const levelDifference = descendantCoordinates.level - this.level;
  128154. if (levelDifference <= 0) {
  128155. return false;
  128156. }
  128157. const ancestorX = descendantCoordinates.x >> levelDifference;
  128158. const ancestorY = descendantCoordinates.y >> levelDifference;
  128159. const isAncestorX = this.x === ancestorX;
  128160. const isAncestorY = this.y === ancestorY;
  128161. if (this.subdivisionScheme === ImplicitSubdivisionScheme_default.OCTREE) {
  128162. const ancestorZ = descendantCoordinates.z >> levelDifference;
  128163. const isAncestorZ = this.z === ancestorZ;
  128164. return isAncestorX && isAncestorY && isAncestorZ;
  128165. }
  128166. return isAncestorX && isAncestorY;
  128167. };
  128168. ImplicitTileCoordinates.prototype.isEqual = function(otherCoordinates) {
  128169. Check_default.typeOf.object("otherCoordinates", otherCoordinates);
  128170. return this.subdivisionScheme === otherCoordinates.subdivisionScheme && this.subtreeLevels === otherCoordinates.subtreeLevels && this.level === otherCoordinates.level && this.x === otherCoordinates.x && this.y === otherCoordinates.y && (this.subdivisionScheme === ImplicitSubdivisionScheme_default.OCTREE ? this.z === otherCoordinates.z : true);
  128171. };
  128172. ImplicitTileCoordinates.prototype.isImplicitTilesetRoot = function() {
  128173. return this.level === 0;
  128174. };
  128175. ImplicitTileCoordinates.prototype.isSubtreeRoot = function() {
  128176. return this.level % this.subtreeLevels === 0;
  128177. };
  128178. ImplicitTileCoordinates.prototype.isBottomOfSubtree = function() {
  128179. return this.level % this.subtreeLevels === this.subtreeLevels - 1;
  128180. };
  128181. ImplicitTileCoordinates.prototype.getTemplateValues = function() {
  128182. const values = {
  128183. level: this.level,
  128184. x: this.x,
  128185. y: this.y
  128186. };
  128187. if (this.subdivisionScheme === ImplicitSubdivisionScheme_default.OCTREE) {
  128188. values.z = this.z;
  128189. }
  128190. return values;
  128191. };
  128192. var scratchCoordinatesArray = [0, 0, 0];
  128193. ImplicitTileCoordinates.fromMortonIndex = function(subdivisionScheme, subtreeLevels, level, mortonIndex) {
  128194. let coordinatesArray;
  128195. if (subdivisionScheme === ImplicitSubdivisionScheme_default.OCTREE) {
  128196. coordinatesArray = MortonOrder_default.decode3D(
  128197. mortonIndex,
  128198. scratchCoordinatesArray
  128199. );
  128200. return new ImplicitTileCoordinates({
  128201. subdivisionScheme,
  128202. subtreeLevels,
  128203. level,
  128204. x: coordinatesArray[0],
  128205. y: coordinatesArray[1],
  128206. z: coordinatesArray[2]
  128207. });
  128208. }
  128209. coordinatesArray = MortonOrder_default.decode2D(mortonIndex, scratchCoordinatesArray);
  128210. return new ImplicitTileCoordinates({
  128211. subdivisionScheme,
  128212. subtreeLevels,
  128213. level,
  128214. x: coordinatesArray[0],
  128215. y: coordinatesArray[1]
  128216. });
  128217. };
  128218. ImplicitTileCoordinates.fromTileIndex = function(subdivisionScheme, subtreeLevels, tileIndex) {
  128219. let level;
  128220. let levelOffset;
  128221. let mortonIndex;
  128222. if (subdivisionScheme === ImplicitSubdivisionScheme_default.OCTREE) {
  128223. level = Math.floor(Math_default.log2(7 * tileIndex + 1) / 3);
  128224. levelOffset = ((1 << 3 * level) - 1) / 7;
  128225. mortonIndex = tileIndex - levelOffset;
  128226. } else {
  128227. level = Math.floor(Math_default.log2(3 * tileIndex + 1) / 2);
  128228. levelOffset = ((1 << 2 * level) - 1) / 3;
  128229. mortonIndex = tileIndex - levelOffset;
  128230. }
  128231. return ImplicitTileCoordinates.fromMortonIndex(
  128232. subdivisionScheme,
  128233. subtreeLevels,
  128234. level,
  128235. mortonIndex
  128236. );
  128237. };
  128238. // node_modules/cesium/Source/Scene/Cesium3DTileset.js
  128239. function Cesium3DTileset(options) {
  128240. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  128241. Check_default.defined("options.url", options.url);
  128242. this._url = void 0;
  128243. this._basePath = void 0;
  128244. this._root = void 0;
  128245. this._resource = void 0;
  128246. this._asset = void 0;
  128247. this._properties = void 0;
  128248. this._geometricError = void 0;
  128249. this._extensionsUsed = void 0;
  128250. this._extensions = void 0;
  128251. this._gltfUpAxis = void 0;
  128252. this._cache = new Cesium3DTilesetCache_default();
  128253. this._processingQueue = [];
  128254. this._selectedTiles = [];
  128255. this._emptyTiles = [];
  128256. this._requestedTiles = [];
  128257. this._selectedTilesToStyle = [];
  128258. this._loadTimestamp = void 0;
  128259. this._timeSinceLoad = 0;
  128260. this._updatedVisibilityFrame = 0;
  128261. this._updatedModelMatrixFrame = 0;
  128262. this._modelMatrixChanged = false;
  128263. this._previousModelMatrix = void 0;
  128264. this._extras = void 0;
  128265. this._credits = void 0;
  128266. this._showCreditsOnScreen = defaultValue_default(options.showCreditsOnScreen, false);
  128267. this._cullWithChildrenBounds = defaultValue_default(
  128268. options.cullWithChildrenBounds,
  128269. true
  128270. );
  128271. this._allTilesAdditive = true;
  128272. this._hasMixedContent = false;
  128273. this._stencilClearCommand = void 0;
  128274. this._backfaceCommands = new ManagedArray_default();
  128275. this._maximumScreenSpaceError = defaultValue_default(
  128276. options.maximumScreenSpaceError,
  128277. 16
  128278. );
  128279. this._maximumMemoryUsage = defaultValue_default(options.maximumMemoryUsage, 512);
  128280. this._styleEngine = new Cesium3DTileStyleEngine_default();
  128281. this._modelMatrix = defined_default(options.modelMatrix) ? Matrix4_default.clone(options.modelMatrix) : Matrix4_default.clone(Matrix4_default.IDENTITY);
  128282. this._statistics = new Cesium3DTilesetStatistics_default();
  128283. this._statisticsLast = new Cesium3DTilesetStatistics_default();
  128284. this._statisticsPerPass = new Array(Cesium3DTilePass_default.NUMBER_OF_PASSES);
  128285. for (let i2 = 0; i2 < Cesium3DTilePass_default.NUMBER_OF_PASSES; ++i2) {
  128286. this._statisticsPerPass[i2] = new Cesium3DTilesetStatistics_default();
  128287. }
  128288. this._requestedTilesInFlight = [];
  128289. this._maximumPriority = {
  128290. foveatedFactor: -Number.MAX_VALUE,
  128291. depth: -Number.MAX_VALUE,
  128292. distance: -Number.MAX_VALUE,
  128293. reverseScreenSpaceError: -Number.MAX_VALUE
  128294. };
  128295. this._minimumPriority = {
  128296. foveatedFactor: Number.MAX_VALUE,
  128297. depth: Number.MAX_VALUE,
  128298. distance: Number.MAX_VALUE,
  128299. reverseScreenSpaceError: Number.MAX_VALUE
  128300. };
  128301. this._heatmap = new Cesium3DTilesetHeatmap_default(
  128302. options.debugHeatmapTilePropertyName
  128303. );
  128304. this.cullRequestsWhileMoving = defaultValue_default(
  128305. options.cullRequestsWhileMoving,
  128306. true
  128307. );
  128308. this._cullRequestsWhileMoving = false;
  128309. this.cullRequestsWhileMovingMultiplier = defaultValue_default(
  128310. options.cullRequestsWhileMovingMultiplier,
  128311. 60
  128312. );
  128313. this.progressiveResolutionHeightFraction = Math_default.clamp(
  128314. defaultValue_default(options.progressiveResolutionHeightFraction, 0.3),
  128315. 0,
  128316. 0.5
  128317. );
  128318. this.preferLeaves = defaultValue_default(options.preferLeaves, false);
  128319. this._tilesLoaded = false;
  128320. this._initialTilesLoaded = false;
  128321. this._tileDebugLabels = void 0;
  128322. this._readyPromise = defer_default();
  128323. this._classificationType = options.classificationType;
  128324. this._ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  128325. this._initialClippingPlanesOriginMatrix = Matrix4_default.IDENTITY;
  128326. this._clippingPlanesOriginMatrix = void 0;
  128327. this._clippingPlanesOriginMatrixDirty = true;
  128328. this._vectorClassificationOnly = defaultValue_default(
  128329. options.vectorClassificationOnly,
  128330. false
  128331. );
  128332. this._vectorKeepDecodedPositions = defaultValue_default(
  128333. options.vectorKeepDecodedPositions,
  128334. false
  128335. );
  128336. this.preloadWhenHidden = defaultValue_default(options.preloadWhenHidden, false);
  128337. this.preloadFlightDestinations = defaultValue_default(
  128338. options.preloadFlightDestinations,
  128339. true
  128340. );
  128341. this._pass = void 0;
  128342. this.dynamicScreenSpaceError = defaultValue_default(
  128343. options.dynamicScreenSpaceError,
  128344. false
  128345. );
  128346. this.foveatedScreenSpaceError = defaultValue_default(
  128347. options.foveatedScreenSpaceError,
  128348. true
  128349. );
  128350. this._foveatedConeSize = defaultValue_default(options.foveatedConeSize, 0.1);
  128351. this._foveatedMinimumScreenSpaceErrorRelaxation = defaultValue_default(
  128352. options.foveatedMinimumScreenSpaceErrorRelaxation,
  128353. 0
  128354. );
  128355. this.foveatedInterpolationCallback = defaultValue_default(
  128356. options.foveatedInterpolationCallback,
  128357. Math_default.lerp
  128358. );
  128359. this.foveatedTimeDelay = defaultValue_default(options.foveatedTimeDelay, 0.2);
  128360. this.dynamicScreenSpaceErrorDensity = 278e-5;
  128361. this.dynamicScreenSpaceErrorFactor = 4;
  128362. this.dynamicScreenSpaceErrorHeightFalloff = 0.25;
  128363. this._dynamicScreenSpaceErrorComputedDensity = 0;
  128364. this.shadows = defaultValue_default(options.shadows, ShadowMode_default.ENABLED);
  128365. this.show = defaultValue_default(options.show, true);
  128366. this.colorBlendMode = Cesium3DTileColorBlendMode_default.HIGHLIGHT;
  128367. this.colorBlendAmount = 0.5;
  128368. this._pointCloudShading = new PointCloudShading_default(options.pointCloudShading);
  128369. this._pointCloudEyeDomeLighting = new PointCloudEyeDomeLighting_default2();
  128370. this.loadProgress = new Event_default();
  128371. this.allTilesLoaded = new Event_default();
  128372. this.initialTilesLoaded = new Event_default();
  128373. this.tileLoad = new Event_default();
  128374. this.tileUnload = new Event_default();
  128375. this.tileFailed = new Event_default();
  128376. this.tileVisible = new Event_default();
  128377. this.skipLevelOfDetail = defaultValue_default(options.skipLevelOfDetail, false);
  128378. this._skipLevelOfDetail = this.skipLevelOfDetail;
  128379. this._disableSkipLevelOfDetail = false;
  128380. this.baseScreenSpaceError = defaultValue_default(options.baseScreenSpaceError, 1024);
  128381. this.skipScreenSpaceErrorFactor = defaultValue_default(
  128382. options.skipScreenSpaceErrorFactor,
  128383. 16
  128384. );
  128385. this.skipLevels = defaultValue_default(options.skipLevels, 1);
  128386. this.immediatelyLoadDesiredLevelOfDetail = defaultValue_default(
  128387. options.immediatelyLoadDesiredLevelOfDetail,
  128388. false
  128389. );
  128390. this.loadSiblings = defaultValue_default(options.loadSiblings, false);
  128391. this._clippingPlanes = void 0;
  128392. this.clippingPlanes = options.clippingPlanes;
  128393. const hasIndividualIBLParameters = defined_default(options.imageBasedLightingFactor) || defined_default(options.luminanceAtZenith) || defined_default(options.sphericalHarmonicCoefficients) || defined_default(options.specularEnvironmentMaps);
  128394. if (defined_default(options.imageBasedLighting)) {
  128395. this._imageBasedLighting = options.imageBasedLighting;
  128396. this._shouldDestroyImageBasedLighting = false;
  128397. } else if (hasIndividualIBLParameters) {
  128398. deprecationWarning_default(
  128399. "ImageBasedLightingConstructor",
  128400. "Individual image-based lighting parameters were deprecated in Cesium 1.92. They will be removed in version 1.94. Use options.imageBasedLighting instead."
  128401. );
  128402. this._imageBasedLighting = new ImageBasedLighting({
  128403. imageBasedLightingFactor: options.imageBasedLightingFactor,
  128404. luminanceAtZenith: options.luminanceAtZenith,
  128405. sphericalHarmonicCoefficients: options.sphericalHarmonicCoefficients,
  128406. specularEnvironmentMaps: options.specularEnvironmentMaps
  128407. });
  128408. this._shouldDestroyImageBasedLighting = true;
  128409. } else {
  128410. this._imageBasedLighting = new ImageBasedLighting();
  128411. this._shouldDestroyImageBasedLighting = true;
  128412. }
  128413. this.lightColor = options.lightColor;
  128414. this.backFaceCulling = defaultValue_default(options.backFaceCulling, true);
  128415. this.showOutline = defaultValue_default(options.showOutline, true);
  128416. this.splitDirection = defaultValue_default(
  128417. options.splitDirection,
  128418. SplitDirection_default.NONE
  128419. );
  128420. this.debugFreezeFrame = defaultValue_default(options.debugFreezeFrame, false);
  128421. this.debugColorizeTiles = defaultValue_default(options.debugColorizeTiles, false);
  128422. this.debugWireframe = defaultValue_default(options.debugWireframe, false);
  128423. this.debugShowBoundingVolume = defaultValue_default(
  128424. options.debugShowBoundingVolume,
  128425. false
  128426. );
  128427. this.debugShowContentBoundingVolume = defaultValue_default(
  128428. options.debugShowContentBoundingVolume,
  128429. false
  128430. );
  128431. this.debugShowViewerRequestVolume = defaultValue_default(
  128432. options.debugShowViewerRequestVolume,
  128433. false
  128434. );
  128435. this._tileDebugLabels = void 0;
  128436. this.debugPickedTileLabelOnly = false;
  128437. this.debugPickedTile = void 0;
  128438. this.debugPickPosition = void 0;
  128439. this.debugShowGeometricError = defaultValue_default(
  128440. options.debugShowGeometricError,
  128441. false
  128442. );
  128443. this.debugShowRenderingStatistics = defaultValue_default(
  128444. options.debugShowRenderingStatistics,
  128445. false
  128446. );
  128447. this.debugShowMemoryUsage = defaultValue_default(options.debugShowMemoryUsage, false);
  128448. this.debugShowUrl = defaultValue_default(options.debugShowUrl, false);
  128449. this.examineVectorLinesFunction = void 0;
  128450. this._metadataExtension = void 0;
  128451. this._customShader = options.customShader;
  128452. this.enableModelExperimental = defaultValue_default(
  128453. options.enableModelExperimental,
  128454. ExperimentalFeatures_default.enableModelExperimental
  128455. );
  128456. let featureIdLabel = defaultValue_default(options.featureIdLabel, "featureId_0");
  128457. if (typeof featureIdLabel === "number") {
  128458. featureIdLabel = `featureId_${featureIdLabel}`;
  128459. }
  128460. this._featureIdLabel = featureIdLabel;
  128461. let instanceFeatureIdLabel = defaultValue_default(
  128462. options.instanceFeatureIdLabel,
  128463. "instanceFeatureId_0"
  128464. );
  128465. if (typeof instanceFeatureIdLabel === "number") {
  128466. instanceFeatureIdLabel = `instanceFeatureId_${instanceFeatureIdLabel}`;
  128467. }
  128468. this._instanceFeatureIdLabel = instanceFeatureIdLabel;
  128469. this._schemaLoader = void 0;
  128470. const that = this;
  128471. let resource;
  128472. Promise.resolve(options.url).then(function(url2) {
  128473. let basePath;
  128474. resource = Resource_default.createIfNeeded(url2);
  128475. that._resource = resource;
  128476. that._credits = resource.credits;
  128477. if (resource.extension === "json") {
  128478. basePath = resource.getBaseUri(true);
  128479. } else if (resource.isDataUri) {
  128480. basePath = "";
  128481. }
  128482. that._url = resource.url;
  128483. that._basePath = basePath;
  128484. return Cesium3DTileset.loadJson(resource);
  128485. }).then(function(tilesetJson) {
  128486. return processMetadataExtension(that, tilesetJson);
  128487. }).then(function(tilesetJson) {
  128488. that._root = that.loadTileset(resource, tilesetJson);
  128489. const gltfUpAxis = defined_default(tilesetJson.asset.gltfUpAxis) ? Axis_default.fromName(tilesetJson.asset.gltfUpAxis) : Axis_default.Y;
  128490. const asset = tilesetJson.asset;
  128491. that._asset = asset;
  128492. that._properties = tilesetJson.properties;
  128493. that._geometricError = tilesetJson.geometricError;
  128494. that._extensionsUsed = tilesetJson.extensionsUsed;
  128495. that._extensions = tilesetJson.extensions;
  128496. that._gltfUpAxis = gltfUpAxis;
  128497. that._extras = tilesetJson.extras;
  128498. const extras = asset.extras;
  128499. if (defined_default(extras) && defined_default(extras.cesium) && defined_default(extras.cesium.credits)) {
  128500. const extraCredits = extras.cesium.credits;
  128501. let credits = that._credits;
  128502. if (!defined_default(credits)) {
  128503. credits = [];
  128504. that._credits = credits;
  128505. }
  128506. for (let i2 = 0; i2 < extraCredits.length; ++i2) {
  128507. const credit = extraCredits[i2];
  128508. credits.push(new Credit_default(credit.html, that._showCreditsOnScreen));
  128509. }
  128510. }
  128511. const boundingVolume = that._root.createBoundingVolume(
  128512. tilesetJson.root.boundingVolume,
  128513. Matrix4_default.IDENTITY
  128514. );
  128515. const clippingPlanesOrigin = boundingVolume.boundingSphere.center;
  128516. const originCartographic = that._ellipsoid.cartesianToCartographic(
  128517. clippingPlanesOrigin
  128518. );
  128519. if (defined_default(originCartographic) && originCartographic.height > ApproximateTerrainHeights_default._defaultMinTerrainHeight) {
  128520. that._initialClippingPlanesOriginMatrix = Transforms_default.eastNorthUpToFixedFrame(
  128521. clippingPlanesOrigin
  128522. );
  128523. }
  128524. that._clippingPlanesOriginMatrix = Matrix4_default.clone(
  128525. that._initialClippingPlanesOriginMatrix
  128526. );
  128527. that._readyPromise.resolve(that);
  128528. }).catch(function(error) {
  128529. that._readyPromise.reject(error);
  128530. });
  128531. }
  128532. Object.defineProperties(Cesium3DTileset.prototype, {
  128533. isCesium3DTileset: {
  128534. get: function() {
  128535. return true;
  128536. }
  128537. },
  128538. asset: {
  128539. get: function() {
  128540. if (!this.ready) {
  128541. throw new DeveloperError_default(
  128542. "The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true."
  128543. );
  128544. }
  128545. return this._asset;
  128546. }
  128547. },
  128548. extensions: {
  128549. get: function() {
  128550. if (!this.ready) {
  128551. throw new DeveloperError_default(
  128552. "The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true."
  128553. );
  128554. }
  128555. return this._extensions;
  128556. }
  128557. },
  128558. clippingPlanes: {
  128559. get: function() {
  128560. return this._clippingPlanes;
  128561. },
  128562. set: function(value) {
  128563. ClippingPlaneCollection_default.setOwner(value, this, "_clippingPlanes");
  128564. }
  128565. },
  128566. properties: {
  128567. get: function() {
  128568. if (!this.ready) {
  128569. throw new DeveloperError_default(
  128570. "The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true."
  128571. );
  128572. }
  128573. return this._properties;
  128574. }
  128575. },
  128576. ready: {
  128577. get: function() {
  128578. return defined_default(this._root);
  128579. }
  128580. },
  128581. readyPromise: {
  128582. get: function() {
  128583. return this._readyPromise.promise;
  128584. }
  128585. },
  128586. tilesLoaded: {
  128587. get: function() {
  128588. return this._tilesLoaded;
  128589. }
  128590. },
  128591. resource: {
  128592. get: function() {
  128593. return this._resource;
  128594. }
  128595. },
  128596. basePath: {
  128597. get: function() {
  128598. deprecationWarning_default(
  128599. "Cesium3DTileset.basePath",
  128600. "Cesium3DTileset.basePath has been deprecated. All tiles are relative to the url of the tileset JSON file that contains them. Use the url property instead."
  128601. );
  128602. return this._basePath;
  128603. }
  128604. },
  128605. style: {
  128606. get: function() {
  128607. return this._styleEngine.style;
  128608. },
  128609. set: function(value) {
  128610. this._styleEngine.style = value;
  128611. }
  128612. },
  128613. customShader: {
  128614. get: function() {
  128615. return this._customShader;
  128616. },
  128617. set: function(value) {
  128618. this._customShader = value;
  128619. }
  128620. },
  128621. metadataExtension: {
  128622. get: function() {
  128623. return this._metadataExtension;
  128624. }
  128625. },
  128626. metadata: {
  128627. get: function() {
  128628. if (defined_default(this._metadataExtension)) {
  128629. return this._metadataExtension.tileset;
  128630. }
  128631. return void 0;
  128632. }
  128633. },
  128634. schema: {
  128635. get: function() {
  128636. if (defined_default(this._metadataExtension)) {
  128637. return this._metadataExtension.schema;
  128638. }
  128639. return void 0;
  128640. }
  128641. },
  128642. maximumScreenSpaceError: {
  128643. get: function() {
  128644. return this._maximumScreenSpaceError;
  128645. },
  128646. set: function(value) {
  128647. Check_default.typeOf.number.greaterThanOrEquals(
  128648. "maximumScreenSpaceError",
  128649. value,
  128650. 0
  128651. );
  128652. this._maximumScreenSpaceError = value;
  128653. }
  128654. },
  128655. maximumMemoryUsage: {
  128656. get: function() {
  128657. return this._maximumMemoryUsage;
  128658. },
  128659. set: function(value) {
  128660. Check_default.typeOf.number.greaterThanOrEquals("value", value, 0);
  128661. this._maximumMemoryUsage = value;
  128662. }
  128663. },
  128664. pointCloudShading: {
  128665. get: function() {
  128666. return this._pointCloudShading;
  128667. },
  128668. set: function(value) {
  128669. Check_default.defined("pointCloudShading", value);
  128670. this._pointCloudShading = value;
  128671. }
  128672. },
  128673. root: {
  128674. get: function() {
  128675. if (!this.ready) {
  128676. throw new DeveloperError_default(
  128677. "The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true."
  128678. );
  128679. }
  128680. return this._root;
  128681. }
  128682. },
  128683. boundingSphere: {
  128684. get: function() {
  128685. if (!this.ready) {
  128686. throw new DeveloperError_default(
  128687. "The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true."
  128688. );
  128689. }
  128690. this._root.updateTransform(this._modelMatrix);
  128691. return this._root.boundingSphere;
  128692. }
  128693. },
  128694. modelMatrix: {
  128695. get: function() {
  128696. return this._modelMatrix;
  128697. },
  128698. set: function(value) {
  128699. this._modelMatrix = Matrix4_default.clone(value, this._modelMatrix);
  128700. }
  128701. },
  128702. timeSinceLoad: {
  128703. get: function() {
  128704. return this._timeSinceLoad;
  128705. }
  128706. },
  128707. totalMemoryUsageInBytes: {
  128708. get: function() {
  128709. const statistics2 = this._statistics;
  128710. return statistics2.texturesByteLength + statistics2.geometryByteLength + statistics2.batchTableByteLength;
  128711. }
  128712. },
  128713. clippingPlanesOriginMatrix: {
  128714. get: function() {
  128715. if (!defined_default(this._clippingPlanesOriginMatrix)) {
  128716. return Matrix4_default.IDENTITY;
  128717. }
  128718. if (this._clippingPlanesOriginMatrixDirty) {
  128719. Matrix4_default.multiply(
  128720. this.root.computedTransform,
  128721. this._initialClippingPlanesOriginMatrix,
  128722. this._clippingPlanesOriginMatrix
  128723. );
  128724. this._clippingPlanesOriginMatrixDirty = false;
  128725. }
  128726. return this._clippingPlanesOriginMatrix;
  128727. }
  128728. },
  128729. styleEngine: {
  128730. get: function() {
  128731. return this._styleEngine;
  128732. }
  128733. },
  128734. statistics: {
  128735. get: function() {
  128736. return this._statistics;
  128737. }
  128738. },
  128739. classificationType: {
  128740. get: function() {
  128741. return this._classificationType;
  128742. }
  128743. },
  128744. ellipsoid: {
  128745. get: function() {
  128746. return this._ellipsoid;
  128747. }
  128748. },
  128749. foveatedConeSize: {
  128750. get: function() {
  128751. return this._foveatedConeSize;
  128752. },
  128753. set: function(value) {
  128754. Check_default.typeOf.number.greaterThanOrEquals("foveatedConeSize", value, 0);
  128755. Check_default.typeOf.number.lessThanOrEquals("foveatedConeSize", value, 1);
  128756. this._foveatedConeSize = value;
  128757. }
  128758. },
  128759. foveatedMinimumScreenSpaceErrorRelaxation: {
  128760. get: function() {
  128761. return this._foveatedMinimumScreenSpaceErrorRelaxation;
  128762. },
  128763. set: function(value) {
  128764. Check_default.typeOf.number.greaterThanOrEquals(
  128765. "foveatedMinimumScreenSpaceErrorRelaxation",
  128766. value,
  128767. 0
  128768. );
  128769. Check_default.typeOf.number.lessThanOrEquals(
  128770. "foveatedMinimumScreenSpaceErrorRelaxation",
  128771. value,
  128772. this.maximumScreenSpaceError
  128773. );
  128774. this._foveatedMinimumScreenSpaceErrorRelaxation = value;
  128775. }
  128776. },
  128777. extras: {
  128778. get: function() {
  128779. if (!this.ready) {
  128780. throw new DeveloperError_default(
  128781. "The tileset is not loaded. Use Cesium3DTileset.readyPromise or wait for Cesium3DTileset.ready to be true."
  128782. );
  128783. }
  128784. return this._extras;
  128785. }
  128786. },
  128787. imageBasedLighting: {
  128788. get: function() {
  128789. return this._imageBasedLighting;
  128790. },
  128791. set: function(value) {
  128792. Check_default.typeOf.object("imageBasedLighting", this._imageBasedLighting);
  128793. if (value !== this._imageBasedLighting) {
  128794. if (this._shouldDestroyImageBasedLighting && !this._imageBasedLighting.isDestroyed()) {
  128795. this._imageBasedLighting.destroy();
  128796. }
  128797. this._imageBasedLighting = value;
  128798. this._shouldDestroyImageBasedLighting = false;
  128799. }
  128800. }
  128801. },
  128802. imageBasedLightingFactor: {
  128803. get: function() {
  128804. return this._imageBasedLighting.imageBasedLightingFactor;
  128805. },
  128806. set: function(value) {
  128807. this._imageBasedLighting.imageBasedLightingFactor = value;
  128808. }
  128809. },
  128810. luminanceAtZenith: {
  128811. get: function() {
  128812. return this._imageBasedLighting.luminanceAtZenith;
  128813. },
  128814. set: function(value) {
  128815. this._imageBasedLighting.luminanceAtZenith = value;
  128816. }
  128817. },
  128818. sphericalHarmonicCoefficients: {
  128819. get: function() {
  128820. return this._imageBasedLighting.sphericalHarmonicCoefficients;
  128821. },
  128822. set: function(value) {
  128823. this._imageBasedLighting.sphericalHarmonicCoefficients = value;
  128824. }
  128825. },
  128826. specularEnvironmentMaps: {
  128827. get: function() {
  128828. return this._imageBasedLighting.specularEnvironmentMaps;
  128829. },
  128830. set: function(value) {
  128831. this._imageBasedLighting.specularEnvironmentMaps = value;
  128832. }
  128833. },
  128834. vectorClassificationOnly: {
  128835. get: function() {
  128836. return this._vectorClassificationOnly;
  128837. }
  128838. },
  128839. vectorKeepDecodedPositions: {
  128840. get: function() {
  128841. return this._vectorKeepDecodedPositions;
  128842. }
  128843. },
  128844. showCreditsOnScreen: {
  128845. get: function() {
  128846. return this._showCreditsOnScreen;
  128847. },
  128848. set: function(value) {
  128849. this._showCreditsOnScreen = value;
  128850. }
  128851. },
  128852. featureIdLabel: {
  128853. get: function() {
  128854. return this._featureIdLabel;
  128855. },
  128856. set: function(value) {
  128857. if (typeof value === "number") {
  128858. value = `featureId_${value}`;
  128859. }
  128860. Check_default.typeOf.string("value", value);
  128861. this._featureIdLabel = value;
  128862. }
  128863. },
  128864. instanceFeatureIdLabel: {
  128865. get: function() {
  128866. return this._instanceFeatureIdLabel;
  128867. },
  128868. set: function(value) {
  128869. if (typeof value === "number") {
  128870. value = `instanceFeatureId_${value}`;
  128871. }
  128872. Check_default.typeOf.string("value", value);
  128873. this._instanceFeatureIdLabel = value;
  128874. }
  128875. }
  128876. });
  128877. Cesium3DTileset.loadJson = function(tilesetUrl) {
  128878. const resource = Resource_default.createIfNeeded(tilesetUrl);
  128879. return resource.fetchJson();
  128880. };
  128881. Cesium3DTileset.prototype.makeStyleDirty = function() {
  128882. this._styleEngine.makeDirty();
  128883. };
  128884. Cesium3DTileset.prototype.loadTileset = function(resource, tilesetJson, parentTile) {
  128885. const asset = tilesetJson.asset;
  128886. if (!defined_default(asset)) {
  128887. throw new RuntimeError_default("Tileset must have an asset property.");
  128888. }
  128889. if (asset.version !== "0.0" && asset.version !== "1.0" && asset.version !== "1.1") {
  128890. throw new RuntimeError_default(
  128891. "The tileset must be 3D Tiles version 0.0, 1.0, or 1.1"
  128892. );
  128893. }
  128894. if (defined_default(tilesetJson.extensionsRequired)) {
  128895. Cesium3DTileset.checkSupportedExtensions(tilesetJson.extensionsRequired);
  128896. }
  128897. const statistics2 = this._statistics;
  128898. const tilesetVersion = asset.tilesetVersion;
  128899. if (defined_default(tilesetVersion)) {
  128900. this._basePath += `?v=${tilesetVersion}`;
  128901. resource = resource.clone();
  128902. resource.setQueryParameters({ v: tilesetVersion });
  128903. }
  128904. const rootTile = makeTile2(this, resource, tilesetJson.root, parentTile);
  128905. if (defined_default(parentTile)) {
  128906. parentTile.children.push(rootTile);
  128907. rootTile._depth = parentTile._depth + 1;
  128908. }
  128909. const stack = [];
  128910. stack.push(rootTile);
  128911. while (stack.length > 0) {
  128912. const tile = stack.pop();
  128913. ++statistics2.numberOfTilesTotal;
  128914. this._allTilesAdditive = this._allTilesAdditive && tile.refine === Cesium3DTileRefine_default.ADD;
  128915. const children = tile._header.children;
  128916. if (defined_default(children)) {
  128917. const length3 = children.length;
  128918. for (let i2 = 0; i2 < length3; ++i2) {
  128919. const childHeader = children[i2];
  128920. const childTile = makeTile2(this, resource, childHeader, tile);
  128921. tile.children.push(childTile);
  128922. childTile._depth = tile._depth + 1;
  128923. stack.push(childTile);
  128924. }
  128925. }
  128926. if (this._cullWithChildrenBounds) {
  128927. Cesium3DTileOptimizations_default.checkChildrenWithinParent(tile);
  128928. }
  128929. }
  128930. return rootTile;
  128931. };
  128932. function makeTile2(tileset, baseResource2, tileHeader, parentTile) {
  128933. const hasImplicitTiling = defined_default(tileHeader.implicitTiling) || hasExtension(tileHeader, "3DTILES_implicit_tiling");
  128934. if (hasImplicitTiling) {
  128935. const metadataSchema = tileset.schema;
  128936. const implicitTileset = new ImplicitTileset(
  128937. baseResource2,
  128938. tileHeader,
  128939. metadataSchema
  128940. );
  128941. const rootCoordinates = new ImplicitTileCoordinates({
  128942. subdivisionScheme: implicitTileset.subdivisionScheme,
  128943. subtreeLevels: implicitTileset.subtreeLevels,
  128944. level: 0,
  128945. x: 0,
  128946. y: 0,
  128947. z: 0
  128948. });
  128949. const contentUri = implicitTileset.subtreeUriTemplate.getDerivedResource({
  128950. templateValues: rootCoordinates.getTemplateValues()
  128951. }).url;
  128952. const deepCopy = true;
  128953. const tileJson = clone_default(tileHeader, deepCopy);
  128954. tileJson.contents = [
  128955. {
  128956. uri: contentUri
  128957. }
  128958. ];
  128959. delete tileJson.content;
  128960. delete tileJson.extensions;
  128961. const tile = new Cesium3DTile_default(tileset, baseResource2, tileJson, parentTile);
  128962. tile.implicitTileset = implicitTileset;
  128963. tile.implicitCoordinates = rootCoordinates;
  128964. return tile;
  128965. }
  128966. return new Cesium3DTile_default(tileset, baseResource2, tileHeader, parentTile);
  128967. }
  128968. function processMetadataExtension(tileset, tilesetJson) {
  128969. const metadataJson = hasExtension(tilesetJson, "3DTILES_metadata") ? tilesetJson.extensions["3DTILES_metadata"] : tilesetJson;
  128970. let schemaLoader;
  128971. if (defined_default(metadataJson.schemaUri)) {
  128972. const resource = tileset._resource.getDerivedResource({
  128973. url: metadataJson.schemaUri
  128974. });
  128975. schemaLoader = ResourceCache_default.loadSchema({
  128976. resource
  128977. });
  128978. } else if (defined_default(metadataJson.schema)) {
  128979. schemaLoader = ResourceCache_default.loadSchema({
  128980. schema: metadataJson.schema
  128981. });
  128982. } else {
  128983. return Promise.resolve(tilesetJson);
  128984. }
  128985. tileset._schemaLoader = schemaLoader;
  128986. return schemaLoader.promise.then(function(schemaLoader2) {
  128987. tileset._metadataExtension = new Cesium3DTilesetMetadata_default({
  128988. schema: schemaLoader2.schema,
  128989. metadataJson
  128990. });
  128991. return tilesetJson;
  128992. });
  128993. }
  128994. var scratchPositionNormal = new Cartesian3_default();
  128995. var scratchCartographic9 = new Cartographic_default();
  128996. var scratchMatrix5 = new Matrix4_default();
  128997. var scratchCenter6 = new Cartesian3_default();
  128998. var scratchPosition13 = new Cartesian3_default();
  128999. var scratchDirection = new Cartesian3_default();
  129000. function updateDynamicScreenSpaceError(tileset, frameState) {
  129001. let up;
  129002. let direction2;
  129003. let height;
  129004. let minimumHeight;
  129005. let maximumHeight;
  129006. const camera = frameState.camera;
  129007. const root = tileset._root;
  129008. const tileBoundingVolume = root.contentBoundingVolume;
  129009. if (tileBoundingVolume instanceof TileBoundingRegion_default) {
  129010. up = Cartesian3_default.normalize(camera.positionWC, scratchPositionNormal);
  129011. direction2 = camera.directionWC;
  129012. height = camera.positionCartographic.height;
  129013. minimumHeight = tileBoundingVolume.minimumHeight;
  129014. maximumHeight = tileBoundingVolume.maximumHeight;
  129015. } else {
  129016. const transformLocal = Matrix4_default.inverseTransformation(
  129017. root.computedTransform,
  129018. scratchMatrix5
  129019. );
  129020. const ellipsoid = frameState.mapProjection.ellipsoid;
  129021. const boundingVolume = tileBoundingVolume.boundingVolume;
  129022. const centerLocal = Matrix4_default.multiplyByPoint(
  129023. transformLocal,
  129024. boundingVolume.center,
  129025. scratchCenter6
  129026. );
  129027. if (Cartesian3_default.magnitude(centerLocal) > ellipsoid.minimumRadius) {
  129028. const centerCartographic = Cartographic_default.fromCartesian(
  129029. centerLocal,
  129030. ellipsoid,
  129031. scratchCartographic9
  129032. );
  129033. up = Cartesian3_default.normalize(camera.positionWC, scratchPositionNormal);
  129034. direction2 = camera.directionWC;
  129035. height = camera.positionCartographic.height;
  129036. minimumHeight = 0;
  129037. maximumHeight = centerCartographic.height * 2;
  129038. } else {
  129039. const positionLocal = Matrix4_default.multiplyByPoint(
  129040. transformLocal,
  129041. camera.positionWC,
  129042. scratchPosition13
  129043. );
  129044. up = Cartesian3_default.UNIT_Z;
  129045. direction2 = Matrix4_default.multiplyByPointAsVector(
  129046. transformLocal,
  129047. camera.directionWC,
  129048. scratchDirection
  129049. );
  129050. direction2 = Cartesian3_default.normalize(direction2, direction2);
  129051. height = positionLocal.z;
  129052. if (tileBoundingVolume instanceof TileOrientedBoundingBox_default) {
  129053. const boxHeight = root._header.boundingVolume.box[11];
  129054. minimumHeight = centerLocal.z - boxHeight;
  129055. maximumHeight = centerLocal.z + boxHeight;
  129056. } else if (tileBoundingVolume instanceof TileBoundingSphere_default) {
  129057. const radius = boundingVolume.radius;
  129058. minimumHeight = centerLocal.z - radius;
  129059. maximumHeight = centerLocal.z + radius;
  129060. }
  129061. }
  129062. }
  129063. const heightFalloff = tileset.dynamicScreenSpaceErrorHeightFalloff;
  129064. const heightClose = minimumHeight + (maximumHeight - minimumHeight) * heightFalloff;
  129065. const heightFar = maximumHeight;
  129066. const t = Math_default.clamp(
  129067. (height - heightClose) / (heightFar - heightClose),
  129068. 0,
  129069. 1
  129070. );
  129071. const dot2 = Math.abs(Cartesian3_default.dot(direction2, up));
  129072. let horizonFactor = 1 - dot2;
  129073. horizonFactor = horizonFactor * (1 - t);
  129074. let density = tileset.dynamicScreenSpaceErrorDensity;
  129075. density *= horizonFactor;
  129076. tileset._dynamicScreenSpaceErrorComputedDensity = density;
  129077. }
  129078. function requestContent(tileset, tile) {
  129079. if (tile.hasEmptyContent) {
  129080. return;
  129081. }
  129082. const statistics2 = tileset._statistics;
  129083. const expired = tile.contentExpired;
  129084. const attemptedRequests = tile.requestContent();
  129085. if (attemptedRequests > 0) {
  129086. statistics2.numberOfAttemptedRequests += attemptedRequests;
  129087. return;
  129088. }
  129089. if (expired) {
  129090. if (tile.hasTilesetContent || tile.hasImplicitContent) {
  129091. destroySubtree(tileset, tile);
  129092. } else {
  129093. statistics2.decrementLoadCounts(tile.content);
  129094. --statistics2.numberOfTilesWithContentReady;
  129095. }
  129096. }
  129097. tileset._requestedTilesInFlight.push(tile);
  129098. tile.contentReadyToProcessPromise.then(addToProcessingQueue(tileset, tile));
  129099. tile.contentReadyPromise.then(handleTileSuccess(tileset, tile)).catch(handleTileFailure(tileset, tile));
  129100. }
  129101. function sortRequestByPriority(a4, b) {
  129102. return a4._priority - b._priority;
  129103. }
  129104. Cesium3DTileset.prototype.postPassesUpdate = function(frameState) {
  129105. if (!this.ready) {
  129106. return;
  129107. }
  129108. cancelOutOfViewRequests(this, frameState);
  129109. raiseLoadProgressEvent(this, frameState);
  129110. this._cache.unloadTiles(this, unloadTile);
  129111. this._styleEngine.resetDirty();
  129112. };
  129113. Cesium3DTileset.prototype.prePassesUpdate = function(frameState) {
  129114. if (!this.ready) {
  129115. return;
  129116. }
  129117. processTiles(this, frameState);
  129118. const clippingPlanes = this._clippingPlanes;
  129119. this._clippingPlanesOriginMatrixDirty = true;
  129120. if (defined_default(clippingPlanes) && clippingPlanes.enabled) {
  129121. clippingPlanes.update(frameState);
  129122. }
  129123. if (!defined_default(this._loadTimestamp)) {
  129124. this._loadTimestamp = JulianDate_default.clone(frameState.time);
  129125. }
  129126. this._timeSinceLoad = Math.max(
  129127. JulianDate_default.secondsDifference(frameState.time, this._loadTimestamp) * 1e3,
  129128. 0
  129129. );
  129130. this._skipLevelOfDetail = this.skipLevelOfDetail && !defined_default(this._classificationType) && !this._disableSkipLevelOfDetail && !this._allTilesAdditive;
  129131. if (this.dynamicScreenSpaceError) {
  129132. updateDynamicScreenSpaceError(this, frameState);
  129133. }
  129134. if (frameState.newFrame) {
  129135. this._cache.reset();
  129136. }
  129137. };
  129138. function cancelOutOfViewRequests(tileset, frameState) {
  129139. const requestedTilesInFlight = tileset._requestedTilesInFlight;
  129140. let removeCount = 0;
  129141. const length3 = requestedTilesInFlight.length;
  129142. for (let i2 = 0; i2 < length3; ++i2) {
  129143. const tile = requestedTilesInFlight[i2];
  129144. const outOfView = frameState.frameNumber - tile._touchedFrame >= 1;
  129145. if (tile._contentState !== Cesium3DTileContentState_default.LOADING) {
  129146. ++removeCount;
  129147. continue;
  129148. } else if (outOfView) {
  129149. tile.cancelRequests();
  129150. ++removeCount;
  129151. continue;
  129152. }
  129153. if (removeCount > 0) {
  129154. requestedTilesInFlight[i2 - removeCount] = tile;
  129155. }
  129156. }
  129157. requestedTilesInFlight.length -= removeCount;
  129158. }
  129159. function requestTiles(tileset, isAsync) {
  129160. const requestedTiles = tileset._requestedTiles;
  129161. const length3 = requestedTiles.length;
  129162. requestedTiles.sort(sortRequestByPriority);
  129163. for (let i2 = 0; i2 < length3; ++i2) {
  129164. requestContent(tileset, requestedTiles[i2]);
  129165. }
  129166. }
  129167. function addToProcessingQueue(tileset, tile) {
  129168. return function() {
  129169. tileset._processingQueue.push(tile);
  129170. ++tileset._statistics.numberOfTilesProcessing;
  129171. };
  129172. }
  129173. function handleTileFailure(tileset, tile) {
  129174. return function(error) {
  129175. const url2 = tile._contentResource.url;
  129176. const message = defined_default(error.message) ? error.message : error.toString();
  129177. if (tileset.tileFailed.numberOfListeners > 0) {
  129178. tileset.tileFailed.raiseEvent({
  129179. url: url2,
  129180. message
  129181. });
  129182. } else {
  129183. console.log(`A 3D tile failed to load: ${url2}`);
  129184. console.log(`Error: ${message}`);
  129185. }
  129186. };
  129187. }
  129188. function handleTileSuccess(tileset, tile) {
  129189. return function() {
  129190. --tileset._statistics.numberOfTilesProcessing;
  129191. if (!tile.hasTilesetContent && !tile.hasImplicitContent) {
  129192. tileset._statistics.incrementLoadCounts(tile.content);
  129193. ++tileset._statistics.numberOfTilesWithContentReady;
  129194. ++tileset._statistics.numberOfLoadedTilesTotal;
  129195. tileset._cache.add(tile);
  129196. }
  129197. tileset.tileLoad.raiseEvent(tile);
  129198. };
  129199. }
  129200. function filterProcessingQueue(tileset) {
  129201. const tiles = tileset._processingQueue;
  129202. const length3 = tiles.length;
  129203. let removeCount = 0;
  129204. for (let i2 = 0; i2 < length3; ++i2) {
  129205. const tile = tiles[i2];
  129206. if (tile._contentState !== Cesium3DTileContentState_default.PROCESSING) {
  129207. ++removeCount;
  129208. continue;
  129209. }
  129210. if (removeCount > 0) {
  129211. tiles[i2 - removeCount] = tile;
  129212. }
  129213. }
  129214. tiles.length -= removeCount;
  129215. }
  129216. function processTiles(tileset, frameState) {
  129217. filterProcessingQueue(tileset);
  129218. const tiles = tileset._processingQueue;
  129219. const length3 = tiles.length;
  129220. for (let i2 = 0; i2 < length3; ++i2) {
  129221. tiles[i2].process(tileset, frameState);
  129222. }
  129223. }
  129224. var scratchCartesian19 = new Cartesian3_default();
  129225. var stringOptions = {
  129226. maximumFractionDigits: 3
  129227. };
  129228. function formatMemoryString(memorySizeInBytes) {
  129229. const memoryInMegabytes = memorySizeInBytes / 1048576;
  129230. if (memoryInMegabytes < 1) {
  129231. return memoryInMegabytes.toLocaleString(void 0, stringOptions);
  129232. }
  129233. return Math.round(memoryInMegabytes).toLocaleString();
  129234. }
  129235. function computeTileLabelPosition(tile) {
  129236. const boundingVolume = tile.boundingVolume.boundingVolume;
  129237. const halfAxes = boundingVolume.halfAxes;
  129238. const radius = boundingVolume.radius;
  129239. let position = Cartesian3_default.clone(boundingVolume.center, scratchCartesian19);
  129240. if (defined_default(halfAxes)) {
  129241. position.x += 0.75 * (halfAxes[0] + halfAxes[3] + halfAxes[6]);
  129242. position.y += 0.75 * (halfAxes[1] + halfAxes[4] + halfAxes[7]);
  129243. position.z += 0.75 * (halfAxes[2] + halfAxes[5] + halfAxes[8]);
  129244. } else if (defined_default(radius)) {
  129245. let normal2 = Cartesian3_default.normalize(boundingVolume.center, scratchCartesian19);
  129246. normal2 = Cartesian3_default.multiplyByScalar(
  129247. normal2,
  129248. 0.75 * radius,
  129249. scratchCartesian19
  129250. );
  129251. position = Cartesian3_default.add(normal2, boundingVolume.center, scratchCartesian19);
  129252. }
  129253. return position;
  129254. }
  129255. function addTileDebugLabel(tile, tileset, position) {
  129256. let labelString = "";
  129257. let attributes = 0;
  129258. if (tileset.debugShowGeometricError) {
  129259. labelString += `
  129260. Geometric error: ${tile.geometricError}`;
  129261. attributes++;
  129262. }
  129263. if (tileset.debugShowRenderingStatistics) {
  129264. labelString += `
  129265. Commands: ${tile.commandsLength}`;
  129266. attributes++;
  129267. const numberOfPoints = tile.content.pointsLength;
  129268. if (numberOfPoints > 0) {
  129269. labelString += `
  129270. Points: ${tile.content.pointsLength}`;
  129271. attributes++;
  129272. }
  129273. const numberOfTriangles = tile.content.trianglesLength;
  129274. if (numberOfTriangles > 0) {
  129275. labelString += `
  129276. Triangles: ${tile.content.trianglesLength}`;
  129277. attributes++;
  129278. }
  129279. labelString += `
  129280. Features: ${tile.content.featuresLength}`;
  129281. attributes++;
  129282. }
  129283. if (tileset.debugShowMemoryUsage) {
  129284. labelString += `
  129285. Texture Memory: ${formatMemoryString(
  129286. tile.content.texturesByteLength
  129287. )}`;
  129288. labelString += `
  129289. Geometry Memory: ${formatMemoryString(
  129290. tile.content.geometryByteLength
  129291. )}`;
  129292. attributes += 2;
  129293. }
  129294. if (tileset.debugShowUrl) {
  129295. if (tile.hasMultipleContents) {
  129296. labelString += "\nUrls:";
  129297. const urls = tile.content.innerContentUrls;
  129298. for (let i2 = 0; i2 < urls.length; i2++) {
  129299. labelString += `
  129300. - ${urls[i2]}`;
  129301. }
  129302. attributes += urls.length;
  129303. } else {
  129304. labelString += `
  129305. Url: ${tile._header.content.uri}`;
  129306. attributes++;
  129307. }
  129308. }
  129309. const newLabel = {
  129310. text: labelString.substring(1),
  129311. position,
  129312. font: `${19 - attributes}px sans-serif`,
  129313. showBackground: true,
  129314. disableDepthTestDistance: Number.POSITIVE_INFINITY
  129315. };
  129316. return tileset._tileDebugLabels.add(newLabel);
  129317. }
  129318. function updateTileDebugLabels(tileset, frameState) {
  129319. let i2;
  129320. let tile;
  129321. const selectedTiles = tileset._selectedTiles;
  129322. const selectedLength = selectedTiles.length;
  129323. const emptyTiles = tileset._emptyTiles;
  129324. const emptyLength = emptyTiles.length;
  129325. tileset._tileDebugLabels.removeAll();
  129326. if (tileset.debugPickedTileLabelOnly) {
  129327. if (defined_default(tileset.debugPickedTile)) {
  129328. const position = defined_default(tileset.debugPickPosition) ? tileset.debugPickPosition : computeTileLabelPosition(tileset.debugPickedTile);
  129329. const label = addTileDebugLabel(
  129330. tileset.debugPickedTile,
  129331. tileset,
  129332. position
  129333. );
  129334. label.pixelOffset = new Cartesian2_default(15, -15);
  129335. }
  129336. } else {
  129337. for (i2 = 0; i2 < selectedLength; ++i2) {
  129338. tile = selectedTiles[i2];
  129339. addTileDebugLabel(tile, tileset, computeTileLabelPosition(tile));
  129340. }
  129341. for (i2 = 0; i2 < emptyLength; ++i2) {
  129342. tile = emptyTiles[i2];
  129343. if (tile.hasTilesetContent || tile.hasImplicitContent) {
  129344. addTileDebugLabel(tile, tileset, computeTileLabelPosition(tile));
  129345. }
  129346. }
  129347. }
  129348. tileset._tileDebugLabels.update(frameState);
  129349. }
  129350. function updateTiles(tileset, frameState, passOptions2) {
  129351. tileset._styleEngine.applyStyle(tileset);
  129352. const isRender = passOptions2.isRender;
  129353. const statistics2 = tileset._statistics;
  129354. const commandList = frameState.commandList;
  129355. const numberOfInitialCommands = commandList.length;
  129356. const selectedTiles = tileset._selectedTiles;
  129357. const selectedLength = selectedTiles.length;
  129358. const emptyTiles = tileset._emptyTiles;
  129359. const emptyLength = emptyTiles.length;
  129360. const tileVisible = tileset.tileVisible;
  129361. let i2;
  129362. let tile;
  129363. const bivariateVisibilityTest = tileset._skipLevelOfDetail && tileset._hasMixedContent && frameState.context.stencilBuffer && selectedLength > 0;
  129364. tileset._backfaceCommands.length = 0;
  129365. if (bivariateVisibilityTest) {
  129366. if (!defined_default(tileset._stencilClearCommand)) {
  129367. tileset._stencilClearCommand = new ClearCommand_default({
  129368. stencil: 0,
  129369. pass: Pass_default.CESIUM_3D_TILE,
  129370. renderState: RenderState_default.fromCache({
  129371. stencilMask: StencilConstants_default.SKIP_LOD_MASK
  129372. })
  129373. });
  129374. }
  129375. commandList.push(tileset._stencilClearCommand);
  129376. }
  129377. const lengthBeforeUpdate = commandList.length;
  129378. for (i2 = 0; i2 < selectedLength; ++i2) {
  129379. tile = selectedTiles[i2];
  129380. if (isRender) {
  129381. tileVisible.raiseEvent(tile);
  129382. }
  129383. tile.update(tileset, frameState, passOptions2);
  129384. statistics2.incrementSelectionCounts(tile.content);
  129385. ++statistics2.selected;
  129386. }
  129387. for (i2 = 0; i2 < emptyLength; ++i2) {
  129388. tile = emptyTiles[i2];
  129389. tile.update(tileset, frameState, passOptions2);
  129390. }
  129391. let addedCommandsLength = commandList.length - lengthBeforeUpdate;
  129392. tileset._backfaceCommands.trim();
  129393. if (bivariateVisibilityTest) {
  129394. const backfaceCommands = tileset._backfaceCommands.values;
  129395. const backfaceCommandsLength = backfaceCommands.length;
  129396. commandList.length += backfaceCommandsLength;
  129397. for (i2 = addedCommandsLength - 1; i2 >= 0; --i2) {
  129398. commandList[lengthBeforeUpdate + backfaceCommandsLength + i2] = commandList[lengthBeforeUpdate + i2];
  129399. }
  129400. for (i2 = 0; i2 < backfaceCommandsLength; ++i2) {
  129401. commandList[lengthBeforeUpdate + i2] = backfaceCommands[i2];
  129402. }
  129403. }
  129404. addedCommandsLength = commandList.length - numberOfInitialCommands;
  129405. statistics2.numberOfCommands = addedCommandsLength;
  129406. if (isRender && tileset.pointCloudShading.attenuation && tileset.pointCloudShading.eyeDomeLighting && addedCommandsLength > 0) {
  129407. tileset._pointCloudEyeDomeLighting.update(
  129408. frameState,
  129409. numberOfInitialCommands,
  129410. tileset.pointCloudShading,
  129411. tileset.boundingSphere
  129412. );
  129413. }
  129414. if (isRender) {
  129415. if (tileset.debugShowGeometricError || tileset.debugShowRenderingStatistics || tileset.debugShowMemoryUsage || tileset.debugShowUrl) {
  129416. if (!defined_default(tileset._tileDebugLabels)) {
  129417. tileset._tileDebugLabels = new LabelCollection_default();
  129418. }
  129419. updateTileDebugLabels(tileset, frameState);
  129420. } else {
  129421. tileset._tileDebugLabels = tileset._tileDebugLabels && tileset._tileDebugLabels.destroy();
  129422. }
  129423. }
  129424. }
  129425. var scratchStack2 = [];
  129426. function destroySubtree(tileset, tile) {
  129427. const root = tile;
  129428. const stack = scratchStack2;
  129429. stack.push(tile);
  129430. while (stack.length > 0) {
  129431. tile = stack.pop();
  129432. const children = tile.children;
  129433. const length3 = children.length;
  129434. for (let i2 = 0; i2 < length3; ++i2) {
  129435. stack.push(children[i2]);
  129436. }
  129437. if (tile !== root) {
  129438. destroyTile(tileset, tile);
  129439. --tileset._statistics.numberOfTilesTotal;
  129440. }
  129441. }
  129442. root.children = [];
  129443. }
  129444. function unloadTile(tileset, tile) {
  129445. tileset.tileUnload.raiseEvent(tile);
  129446. tileset._statistics.decrementLoadCounts(tile.content);
  129447. --tileset._statistics.numberOfTilesWithContentReady;
  129448. tile.unloadContent();
  129449. }
  129450. function destroyTile(tileset, tile) {
  129451. tileset._cache.unloadTile(tileset, tile, unloadTile);
  129452. tile.destroy();
  129453. }
  129454. Cesium3DTileset.prototype.trimLoadedTiles = function() {
  129455. this._cache.trim();
  129456. };
  129457. function raiseLoadProgressEvent(tileset, frameState) {
  129458. const statistics2 = tileset._statistics;
  129459. const statisticsLast = tileset._statisticsLast;
  129460. const numberOfPendingRequests = statistics2.numberOfPendingRequests;
  129461. const numberOfTilesProcessing = statistics2.numberOfTilesProcessing;
  129462. const lastNumberOfPendingRequest = statisticsLast.numberOfPendingRequests;
  129463. const lastNumberOfTilesProcessing = statisticsLast.numberOfTilesProcessing;
  129464. Cesium3DTilesetStatistics_default.clone(statistics2, statisticsLast);
  129465. const progressChanged = numberOfPendingRequests !== lastNumberOfPendingRequest || numberOfTilesProcessing !== lastNumberOfTilesProcessing;
  129466. if (progressChanged) {
  129467. frameState.afterRender.push(function() {
  129468. tileset.loadProgress.raiseEvent(
  129469. numberOfPendingRequests,
  129470. numberOfTilesProcessing
  129471. );
  129472. });
  129473. }
  129474. tileset._tilesLoaded = statistics2.numberOfPendingRequests === 0 && statistics2.numberOfTilesProcessing === 0 && statistics2.numberOfAttemptedRequests === 0;
  129475. if (progressChanged && tileset._tilesLoaded) {
  129476. frameState.afterRender.push(function() {
  129477. tileset.allTilesLoaded.raiseEvent();
  129478. });
  129479. if (!tileset._initialTilesLoaded) {
  129480. tileset._initialTilesLoaded = true;
  129481. frameState.afterRender.push(function() {
  129482. tileset.initialTilesLoaded.raiseEvent();
  129483. });
  129484. }
  129485. }
  129486. }
  129487. function resetMinimumMaximum(tileset) {
  129488. tileset._heatmap.resetMinimumMaximum();
  129489. tileset._minimumPriority.depth = Number.MAX_VALUE;
  129490. tileset._maximumPriority.depth = -Number.MAX_VALUE;
  129491. tileset._minimumPriority.foveatedFactor = Number.MAX_VALUE;
  129492. tileset._maximumPriority.foveatedFactor = -Number.MAX_VALUE;
  129493. tileset._minimumPriority.distance = Number.MAX_VALUE;
  129494. tileset._maximumPriority.distance = -Number.MAX_VALUE;
  129495. tileset._minimumPriority.reverseScreenSpaceError = Number.MAX_VALUE;
  129496. tileset._maximumPriority.reverseScreenSpaceError = -Number.MAX_VALUE;
  129497. }
  129498. function detectModelMatrixChanged(tileset, frameState) {
  129499. if (frameState.frameNumber !== tileset._updatedModelMatrixFrame || !defined_default(tileset._previousModelMatrix)) {
  129500. tileset._updatedModelMatrixFrame = frameState.frameNumber;
  129501. tileset._modelMatrixChanged = !Matrix4_default.equals(
  129502. tileset.modelMatrix,
  129503. tileset._previousModelMatrix
  129504. );
  129505. if (tileset._modelMatrixChanged) {
  129506. tileset._previousModelMatrix = Matrix4_default.clone(
  129507. tileset.modelMatrix,
  129508. tileset._previousModelMatrix
  129509. );
  129510. }
  129511. }
  129512. }
  129513. function update5(tileset, frameState, passStatistics, passOptions2) {
  129514. if (frameState.mode === SceneMode_default.MORPHING) {
  129515. return false;
  129516. }
  129517. if (!tileset.ready) {
  129518. return false;
  129519. }
  129520. const statistics2 = tileset._statistics;
  129521. statistics2.clear();
  129522. const isRender = passOptions2.isRender;
  129523. ++tileset._updatedVisibilityFrame;
  129524. resetMinimumMaximum(tileset);
  129525. detectModelMatrixChanged(tileset, frameState);
  129526. tileset._cullRequestsWhileMoving = tileset.cullRequestsWhileMoving && !tileset._modelMatrixChanged;
  129527. const ready = passOptions2.traversal.selectTiles(tileset, frameState);
  129528. if (passOptions2.requestTiles) {
  129529. requestTiles(tileset);
  129530. }
  129531. updateTiles(tileset, frameState, passOptions2);
  129532. Cesium3DTilesetStatistics_default.clone(statistics2, passStatistics);
  129533. if (isRender) {
  129534. const credits = tileset._credits;
  129535. if (defined_default(credits) && statistics2.selected !== 0) {
  129536. const length3 = credits.length;
  129537. for (let i2 = 0; i2 < length3; ++i2) {
  129538. const credit = credits[i2];
  129539. credit.showOnScreen = tileset._showCreditsOnScreen;
  129540. frameState.creditDisplay.addCredit(credit);
  129541. }
  129542. }
  129543. }
  129544. return ready;
  129545. }
  129546. Cesium3DTileset.prototype.update = function(frameState) {
  129547. this.updateForPass(frameState, frameState.tilesetPassState);
  129548. };
  129549. Cesium3DTileset.prototype.updateForPass = function(frameState, tilesetPassState) {
  129550. Check_default.typeOf.object("frameState", frameState);
  129551. Check_default.typeOf.object("tilesetPassState", tilesetPassState);
  129552. const pass = tilesetPassState.pass;
  129553. if (pass === Cesium3DTilePass_default.PRELOAD && (!this.preloadWhenHidden || this.show) || pass === Cesium3DTilePass_default.PRELOAD_FLIGHT && (!this.preloadFlightDestinations || !this.show && !this.preloadWhenHidden) || pass === Cesium3DTilePass_default.REQUEST_RENDER_MODE_DEFER_CHECK && (!this._cullRequestsWhileMoving && this.foveatedTimeDelay <= 0 || !this.show)) {
  129554. return;
  129555. }
  129556. const originalCommandList = frameState.commandList;
  129557. const originalCamera = frameState.camera;
  129558. const originalCullingVolume = frameState.cullingVolume;
  129559. tilesetPassState.ready = false;
  129560. const passOptions2 = Cesium3DTilePass_default.getPassOptions(pass);
  129561. const ignoreCommands = passOptions2.ignoreCommands;
  129562. const commandList = defaultValue_default(
  129563. tilesetPassState.commandList,
  129564. originalCommandList
  129565. );
  129566. const commandStart = commandList.length;
  129567. frameState.commandList = commandList;
  129568. frameState.camera = defaultValue_default(tilesetPassState.camera, originalCamera);
  129569. frameState.cullingVolume = defaultValue_default(
  129570. tilesetPassState.cullingVolume,
  129571. originalCullingVolume
  129572. );
  129573. const passStatistics = this._statisticsPerPass[pass];
  129574. if (this.show || ignoreCommands) {
  129575. this._pass = pass;
  129576. tilesetPassState.ready = update5(
  129577. this,
  129578. frameState,
  129579. passStatistics,
  129580. passOptions2
  129581. );
  129582. }
  129583. if (ignoreCommands) {
  129584. commandList.length = commandStart;
  129585. }
  129586. frameState.commandList = originalCommandList;
  129587. frameState.camera = originalCamera;
  129588. frameState.cullingVolume = originalCullingVolume;
  129589. };
  129590. Cesium3DTileset.prototype.hasExtension = function(extensionName) {
  129591. if (!defined_default(this._extensionsUsed)) {
  129592. return false;
  129593. }
  129594. return this._extensionsUsed.indexOf(extensionName) > -1;
  129595. };
  129596. Cesium3DTileset.prototype.isDestroyed = function() {
  129597. return false;
  129598. };
  129599. Cesium3DTileset.prototype.destroy = function() {
  129600. this._tileDebugLabels = this._tileDebugLabels && this._tileDebugLabels.destroy();
  129601. this._clippingPlanes = this._clippingPlanes && this._clippingPlanes.destroy();
  129602. if (defined_default(this._schemaLoader)) {
  129603. ResourceCache_default.unload(this._schemaLoader);
  129604. }
  129605. if (defined_default(this._root)) {
  129606. const stack = scratchStack2;
  129607. stack.push(this._root);
  129608. while (stack.length > 0) {
  129609. const tile = stack.pop();
  129610. tile.destroy();
  129611. const children = tile.children;
  129612. const length3 = children.length;
  129613. for (let i2 = 0; i2 < length3; ++i2) {
  129614. stack.push(children[i2]);
  129615. }
  129616. }
  129617. }
  129618. this._root = void 0;
  129619. if (this._shouldDestroyImageBasedLighting && !this._imageBasedLighting.isDestroyed()) {
  129620. this._imageBasedLighting.destroy();
  129621. }
  129622. this._imageBasedLighting = void 0;
  129623. return destroyObject_default(this);
  129624. };
  129625. Cesium3DTileset.supportedExtensions = {
  129626. "3DTILES_metadata": true,
  129627. "3DTILES_implicit_tiling": true,
  129628. "3DTILES_content_gltf": true,
  129629. "3DTILES_multiple_contents": true,
  129630. "3DTILES_bounding_volume_S2": true,
  129631. "3DTILES_batch_table_hierarchy": true,
  129632. "3DTILES_draco_point_compression": true
  129633. };
  129634. Cesium3DTileset.checkSupportedExtensions = function(extensionsRequired) {
  129635. for (let i2 = 0; i2 < extensionsRequired.length; i2++) {
  129636. if (!Cesium3DTileset.supportedExtensions[extensionsRequired[i2]]) {
  129637. throw new RuntimeError_default(
  129638. `Unsupported 3D Tiles Extension: ${extensionsRequired[i2]}`
  129639. );
  129640. }
  129641. }
  129642. };
  129643. var Cesium3DTileset_default = Cesium3DTileset;
  129644. // node_modules/cesium/Source/DataSources/Cesium3DTilesetVisualizer.js
  129645. var modelMatrixScratch = new Matrix4_default();
  129646. function Cesium3DTilesetVisualizer(scene, entityCollection) {
  129647. if (!defined_default(scene)) {
  129648. throw new DeveloperError_default("scene is required.");
  129649. }
  129650. if (!defined_default(entityCollection)) {
  129651. throw new DeveloperError_default("entityCollection is required.");
  129652. }
  129653. entityCollection.collectionChanged.addEventListener(
  129654. Cesium3DTilesetVisualizer.prototype._onCollectionChanged,
  129655. this
  129656. );
  129657. this._scene = scene;
  129658. this._primitives = scene.primitives;
  129659. this._entityCollection = entityCollection;
  129660. this._tilesetHash = {};
  129661. this._entitiesToVisualize = new AssociativeArray_default();
  129662. this._onCollectionChanged(entityCollection, entityCollection.values, [], []);
  129663. }
  129664. Cesium3DTilesetVisualizer.prototype.update = function(time) {
  129665. if (!defined_default(time)) {
  129666. throw new DeveloperError_default("time is required.");
  129667. }
  129668. const entities = this._entitiesToVisualize.values;
  129669. const tilesetHash = this._tilesetHash;
  129670. const primitives = this._primitives;
  129671. for (let i2 = 0, len = entities.length; i2 < len; i2++) {
  129672. const entity = entities[i2];
  129673. const tilesetGraphics = entity._tileset;
  129674. let resource;
  129675. let tilesetData = tilesetHash[entity.id];
  129676. const show = entity.isShowing && entity.isAvailable(time) && Property_default.getValueOrDefault(tilesetGraphics._show, time, true);
  129677. let modelMatrix;
  129678. if (show) {
  129679. modelMatrix = entity.computeModelMatrix(time, modelMatrixScratch);
  129680. resource = Resource_default.createIfNeeded(
  129681. Property_default.getValueOrUndefined(tilesetGraphics._uri, time)
  129682. );
  129683. }
  129684. if (!show) {
  129685. if (defined_default(tilesetData)) {
  129686. tilesetData.tilesetPrimitive.show = false;
  129687. }
  129688. continue;
  129689. }
  129690. let tileset = defined_default(tilesetData) ? tilesetData.tilesetPrimitive : void 0;
  129691. if (!defined_default(tileset) || resource.url !== tilesetData.url) {
  129692. if (defined_default(tileset)) {
  129693. primitives.removeAndDestroy(tileset);
  129694. delete tilesetHash[entity.id];
  129695. }
  129696. tileset = new Cesium3DTileset_default({
  129697. url: resource
  129698. });
  129699. tileset.id = entity;
  129700. primitives.add(tileset);
  129701. tilesetData = {
  129702. tilesetPrimitive: tileset,
  129703. url: resource.url,
  129704. loadFail: false
  129705. };
  129706. tilesetHash[entity.id] = tilesetData;
  129707. checkLoad(tileset, entity, tilesetHash);
  129708. }
  129709. tileset.show = true;
  129710. if (defined_default(modelMatrix)) {
  129711. tileset.modelMatrix = modelMatrix;
  129712. }
  129713. tileset.maximumScreenSpaceError = Property_default.getValueOrDefault(
  129714. tilesetGraphics.maximumScreenSpaceError,
  129715. time,
  129716. tileset.maximumScreenSpaceError
  129717. );
  129718. }
  129719. return true;
  129720. };
  129721. Cesium3DTilesetVisualizer.prototype.isDestroyed = function() {
  129722. return false;
  129723. };
  129724. Cesium3DTilesetVisualizer.prototype.destroy = function() {
  129725. this._entityCollection.collectionChanged.removeEventListener(
  129726. Cesium3DTilesetVisualizer.prototype._onCollectionChanged,
  129727. this
  129728. );
  129729. const entities = this._entitiesToVisualize.values;
  129730. const tilesetHash = this._tilesetHash;
  129731. const primitives = this._primitives;
  129732. for (let i2 = entities.length - 1; i2 > -1; i2--) {
  129733. removeTileset(this, entities[i2], tilesetHash, primitives);
  129734. }
  129735. return destroyObject_default(this);
  129736. };
  129737. Cesium3DTilesetVisualizer.prototype.getBoundingSphere = function(entity, result) {
  129738. if (!defined_default(entity)) {
  129739. throw new DeveloperError_default("entity is required.");
  129740. }
  129741. if (!defined_default(result)) {
  129742. throw new DeveloperError_default("result is required.");
  129743. }
  129744. const tilesetData = this._tilesetHash[entity.id];
  129745. if (!defined_default(tilesetData) || tilesetData.loadFail) {
  129746. return BoundingSphereState_default.FAILED;
  129747. }
  129748. const primitive = tilesetData.tilesetPrimitive;
  129749. if (!defined_default(primitive) || !primitive.show) {
  129750. return BoundingSphereState_default.FAILED;
  129751. }
  129752. if (!primitive.ready) {
  129753. return BoundingSphereState_default.PENDING;
  129754. }
  129755. BoundingSphere_default.clone(primitive.boundingSphere, result);
  129756. return BoundingSphereState_default.DONE;
  129757. };
  129758. Cesium3DTilesetVisualizer.prototype._onCollectionChanged = function(entityCollection, added, removed, changed) {
  129759. let i2;
  129760. let entity;
  129761. const entities = this._entitiesToVisualize;
  129762. const tilesetHash = this._tilesetHash;
  129763. const primitives = this._primitives;
  129764. for (i2 = added.length - 1; i2 > -1; i2--) {
  129765. entity = added[i2];
  129766. if (defined_default(entity._tileset)) {
  129767. entities.set(entity.id, entity);
  129768. }
  129769. }
  129770. for (i2 = changed.length - 1; i2 > -1; i2--) {
  129771. entity = changed[i2];
  129772. if (defined_default(entity._tileset)) {
  129773. entities.set(entity.id, entity);
  129774. } else {
  129775. removeTileset(this, entity, tilesetHash, primitives);
  129776. entities.remove(entity.id);
  129777. }
  129778. }
  129779. for (i2 = removed.length - 1; i2 > -1; i2--) {
  129780. entity = removed[i2];
  129781. removeTileset(this, entity, tilesetHash, primitives);
  129782. entities.remove(entity.id);
  129783. }
  129784. };
  129785. function removeTileset(visualizer, entity, tilesetHash, primitives) {
  129786. const tilesetData = tilesetHash[entity.id];
  129787. if (defined_default(tilesetData)) {
  129788. primitives.removeAndDestroy(tilesetData.tilesetPrimitive);
  129789. delete tilesetHash[entity.id];
  129790. }
  129791. }
  129792. function checkLoad(primitive, entity, tilesetHash) {
  129793. primitive.readyPromise.catch(function(error) {
  129794. console.error(error);
  129795. tilesetHash[entity.id].loadFail = true;
  129796. });
  129797. }
  129798. var Cesium3DTilesetVisualizer_default = Cesium3DTilesetVisualizer;
  129799. // node_modules/cesium/Source/DataSources/CheckerboardMaterialProperty.js
  129800. var defaultEvenColor = Color_default.WHITE;
  129801. var defaultOddColor = Color_default.BLACK;
  129802. var defaultRepeat2 = new Cartesian2_default(2, 2);
  129803. function CheckerboardMaterialProperty(options) {
  129804. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  129805. this._definitionChanged = new Event_default();
  129806. this._evenColor = void 0;
  129807. this._evenColorSubscription = void 0;
  129808. this._oddColor = void 0;
  129809. this._oddColorSubscription = void 0;
  129810. this._repeat = void 0;
  129811. this._repeatSubscription = void 0;
  129812. this.evenColor = options.evenColor;
  129813. this.oddColor = options.oddColor;
  129814. this.repeat = options.repeat;
  129815. }
  129816. Object.defineProperties(CheckerboardMaterialProperty.prototype, {
  129817. isConstant: {
  129818. get: function() {
  129819. return Property_default.isConstant(this._evenColor) && Property_default.isConstant(this._oddColor) && Property_default.isConstant(this._repeat);
  129820. }
  129821. },
  129822. definitionChanged: {
  129823. get: function() {
  129824. return this._definitionChanged;
  129825. }
  129826. },
  129827. evenColor: createPropertyDescriptor_default("evenColor"),
  129828. oddColor: createPropertyDescriptor_default("oddColor"),
  129829. repeat: createPropertyDescriptor_default("repeat")
  129830. });
  129831. CheckerboardMaterialProperty.prototype.getType = function(time) {
  129832. return "Checkerboard";
  129833. };
  129834. CheckerboardMaterialProperty.prototype.getValue = function(time, result) {
  129835. if (!defined_default(result)) {
  129836. result = {};
  129837. }
  129838. result.lightColor = Property_default.getValueOrClonedDefault(
  129839. this._evenColor,
  129840. time,
  129841. defaultEvenColor,
  129842. result.lightColor
  129843. );
  129844. result.darkColor = Property_default.getValueOrClonedDefault(
  129845. this._oddColor,
  129846. time,
  129847. defaultOddColor,
  129848. result.darkColor
  129849. );
  129850. result.repeat = Property_default.getValueOrDefault(this._repeat, time, defaultRepeat2);
  129851. return result;
  129852. };
  129853. CheckerboardMaterialProperty.prototype.equals = function(other) {
  129854. return this === other || other instanceof CheckerboardMaterialProperty && Property_default.equals(this._evenColor, other._evenColor) && Property_default.equals(this._oddColor, other._oddColor) && Property_default.equals(this._repeat, other._repeat);
  129855. };
  129856. var CheckerboardMaterialProperty_default = CheckerboardMaterialProperty;
  129857. // node_modules/cesium/Source/DataSources/EntityCollection.js
  129858. var entityOptionsScratch = {
  129859. id: void 0
  129860. };
  129861. function fireChangedEvent(collection) {
  129862. if (collection._firing) {
  129863. collection._refire = true;
  129864. return;
  129865. }
  129866. if (collection._suspendCount === 0) {
  129867. const added = collection._addedEntities;
  129868. const removed = collection._removedEntities;
  129869. const changed = collection._changedEntities;
  129870. if (changed.length !== 0 || added.length !== 0 || removed.length !== 0) {
  129871. collection._firing = true;
  129872. do {
  129873. collection._refire = false;
  129874. const addedArray = added.values.slice(0);
  129875. const removedArray = removed.values.slice(0);
  129876. const changedArray = changed.values.slice(0);
  129877. added.removeAll();
  129878. removed.removeAll();
  129879. changed.removeAll();
  129880. collection._collectionChanged.raiseEvent(
  129881. collection,
  129882. addedArray,
  129883. removedArray,
  129884. changedArray
  129885. );
  129886. } while (collection._refire);
  129887. collection._firing = false;
  129888. }
  129889. }
  129890. }
  129891. function EntityCollection(owner) {
  129892. this._owner = owner;
  129893. this._entities = new AssociativeArray_default();
  129894. this._addedEntities = new AssociativeArray_default();
  129895. this._removedEntities = new AssociativeArray_default();
  129896. this._changedEntities = new AssociativeArray_default();
  129897. this._suspendCount = 0;
  129898. this._collectionChanged = new Event_default();
  129899. this._id = createGuid_default();
  129900. this._show = true;
  129901. this._firing = false;
  129902. this._refire = false;
  129903. }
  129904. EntityCollection.prototype.suspendEvents = function() {
  129905. this._suspendCount++;
  129906. };
  129907. EntityCollection.prototype.resumeEvents = function() {
  129908. if (this._suspendCount === 0) {
  129909. throw new DeveloperError_default(
  129910. "resumeEvents can not be called before suspendEvents."
  129911. );
  129912. }
  129913. this._suspendCount--;
  129914. fireChangedEvent(this);
  129915. };
  129916. Object.defineProperties(EntityCollection.prototype, {
  129917. collectionChanged: {
  129918. get: function() {
  129919. return this._collectionChanged;
  129920. }
  129921. },
  129922. id: {
  129923. get: function() {
  129924. return this._id;
  129925. }
  129926. },
  129927. values: {
  129928. get: function() {
  129929. return this._entities.values;
  129930. }
  129931. },
  129932. show: {
  129933. get: function() {
  129934. return this._show;
  129935. },
  129936. set: function(value) {
  129937. if (!defined_default(value)) {
  129938. throw new DeveloperError_default("value is required.");
  129939. }
  129940. if (value === this._show) {
  129941. return;
  129942. }
  129943. this.suspendEvents();
  129944. let i2;
  129945. const oldShows = [];
  129946. const entities = this._entities.values;
  129947. const entitiesLength = entities.length;
  129948. for (i2 = 0; i2 < entitiesLength; i2++) {
  129949. oldShows.push(entities[i2].isShowing);
  129950. }
  129951. this._show = value;
  129952. for (i2 = 0; i2 < entitiesLength; i2++) {
  129953. const oldShow = oldShows[i2];
  129954. const entity = entities[i2];
  129955. if (oldShow !== entity.isShowing) {
  129956. entity.definitionChanged.raiseEvent(
  129957. entity,
  129958. "isShowing",
  129959. entity.isShowing,
  129960. oldShow
  129961. );
  129962. }
  129963. }
  129964. this.resumeEvents();
  129965. }
  129966. },
  129967. owner: {
  129968. get: function() {
  129969. return this._owner;
  129970. }
  129971. }
  129972. });
  129973. EntityCollection.prototype.computeAvailability = function() {
  129974. let startTime = Iso8601_default.MAXIMUM_VALUE;
  129975. let stopTime = Iso8601_default.MINIMUM_VALUE;
  129976. const entities = this._entities.values;
  129977. for (let i2 = 0, len = entities.length; i2 < len; i2++) {
  129978. const entity = entities[i2];
  129979. const availability = entity.availability;
  129980. if (defined_default(availability)) {
  129981. const start = availability.start;
  129982. const stop2 = availability.stop;
  129983. if (JulianDate_default.lessThan(start, startTime) && !start.equals(Iso8601_default.MINIMUM_VALUE)) {
  129984. startTime = start;
  129985. }
  129986. if (JulianDate_default.greaterThan(stop2, stopTime) && !stop2.equals(Iso8601_default.MAXIMUM_VALUE)) {
  129987. stopTime = stop2;
  129988. }
  129989. }
  129990. }
  129991. if (Iso8601_default.MAXIMUM_VALUE.equals(startTime)) {
  129992. startTime = Iso8601_default.MINIMUM_VALUE;
  129993. }
  129994. if (Iso8601_default.MINIMUM_VALUE.equals(stopTime)) {
  129995. stopTime = Iso8601_default.MAXIMUM_VALUE;
  129996. }
  129997. return new TimeInterval_default({
  129998. start: startTime,
  129999. stop: stopTime
  130000. });
  130001. };
  130002. EntityCollection.prototype.add = function(entity) {
  130003. if (!defined_default(entity)) {
  130004. throw new DeveloperError_default("entity is required.");
  130005. }
  130006. if (!(entity instanceof Entity_default)) {
  130007. entity = new Entity_default(entity);
  130008. }
  130009. const id = entity.id;
  130010. const entities = this._entities;
  130011. if (entities.contains(id)) {
  130012. throw new RuntimeError_default(
  130013. `An entity with id ${id} already exists in this collection.`
  130014. );
  130015. }
  130016. entity.entityCollection = this;
  130017. entities.set(id, entity);
  130018. if (!this._removedEntities.remove(id)) {
  130019. this._addedEntities.set(id, entity);
  130020. }
  130021. entity.definitionChanged.addEventListener(
  130022. EntityCollection.prototype._onEntityDefinitionChanged,
  130023. this
  130024. );
  130025. fireChangedEvent(this);
  130026. return entity;
  130027. };
  130028. EntityCollection.prototype.remove = function(entity) {
  130029. if (!defined_default(entity)) {
  130030. return false;
  130031. }
  130032. return this.removeById(entity.id);
  130033. };
  130034. EntityCollection.prototype.contains = function(entity) {
  130035. if (!defined_default(entity)) {
  130036. throw new DeveloperError_default("entity is required");
  130037. }
  130038. return this._entities.get(entity.id) === entity;
  130039. };
  130040. EntityCollection.prototype.removeById = function(id) {
  130041. if (!defined_default(id)) {
  130042. return false;
  130043. }
  130044. const entities = this._entities;
  130045. const entity = entities.get(id);
  130046. if (!this._entities.remove(id)) {
  130047. return false;
  130048. }
  130049. if (!this._addedEntities.remove(id)) {
  130050. this._removedEntities.set(id, entity);
  130051. this._changedEntities.remove(id);
  130052. }
  130053. this._entities.remove(id);
  130054. entity.definitionChanged.removeEventListener(
  130055. EntityCollection.prototype._onEntityDefinitionChanged,
  130056. this
  130057. );
  130058. fireChangedEvent(this);
  130059. return true;
  130060. };
  130061. EntityCollection.prototype.removeAll = function() {
  130062. const entities = this._entities;
  130063. const entitiesLength = entities.length;
  130064. const array = entities.values;
  130065. const addedEntities = this._addedEntities;
  130066. const removed = this._removedEntities;
  130067. for (let i2 = 0; i2 < entitiesLength; i2++) {
  130068. const existingItem = array[i2];
  130069. const existingItemId = existingItem.id;
  130070. const addedItem = addedEntities.get(existingItemId);
  130071. if (!defined_default(addedItem)) {
  130072. existingItem.definitionChanged.removeEventListener(
  130073. EntityCollection.prototype._onEntityDefinitionChanged,
  130074. this
  130075. );
  130076. removed.set(existingItemId, existingItem);
  130077. }
  130078. }
  130079. entities.removeAll();
  130080. addedEntities.removeAll();
  130081. this._changedEntities.removeAll();
  130082. fireChangedEvent(this);
  130083. };
  130084. EntityCollection.prototype.getById = function(id) {
  130085. if (!defined_default(id)) {
  130086. throw new DeveloperError_default("id is required.");
  130087. }
  130088. return this._entities.get(id);
  130089. };
  130090. EntityCollection.prototype.getOrCreateEntity = function(id) {
  130091. if (!defined_default(id)) {
  130092. throw new DeveloperError_default("id is required.");
  130093. }
  130094. let entity = this._entities.get(id);
  130095. if (!defined_default(entity)) {
  130096. entityOptionsScratch.id = id;
  130097. entity = new Entity_default(entityOptionsScratch);
  130098. this.add(entity);
  130099. }
  130100. return entity;
  130101. };
  130102. EntityCollection.prototype._onEntityDefinitionChanged = function(entity) {
  130103. const id = entity.id;
  130104. if (!this._addedEntities.contains(id)) {
  130105. this._changedEntities.set(id, entity);
  130106. }
  130107. fireChangedEvent(this);
  130108. };
  130109. var EntityCollection_default = EntityCollection;
  130110. // node_modules/cesium/Source/DataSources/CompositeEntityCollection.js
  130111. var entityOptionsScratch2 = {
  130112. id: void 0
  130113. };
  130114. var entityIdScratch = new Array(2);
  130115. function clean(entity) {
  130116. const propertyNames = entity.propertyNames;
  130117. const propertyNamesLength = propertyNames.length;
  130118. for (let i2 = 0; i2 < propertyNamesLength; i2++) {
  130119. entity[propertyNames[i2]] = void 0;
  130120. }
  130121. entity._name = void 0;
  130122. entity._availability = void 0;
  130123. }
  130124. function subscribeToEntity(that, eventHash, collectionId, entity) {
  130125. entityIdScratch[0] = collectionId;
  130126. entityIdScratch[1] = entity.id;
  130127. eventHash[JSON.stringify(entityIdScratch)] = entity.definitionChanged.addEventListener(
  130128. CompositeEntityCollection.prototype._onDefinitionChanged,
  130129. that
  130130. );
  130131. }
  130132. function unsubscribeFromEntity(that, eventHash, collectionId, entity) {
  130133. entityIdScratch[0] = collectionId;
  130134. entityIdScratch[1] = entity.id;
  130135. const id = JSON.stringify(entityIdScratch);
  130136. eventHash[id]();
  130137. eventHash[id] = void 0;
  130138. }
  130139. function recomposite(that) {
  130140. that._shouldRecomposite = true;
  130141. if (that._suspendCount !== 0) {
  130142. return;
  130143. }
  130144. const collections = that._collections;
  130145. const collectionsLength = collections.length;
  130146. const collectionsCopy = that._collectionsCopy;
  130147. const collectionsCopyLength = collectionsCopy.length;
  130148. let i2;
  130149. let entity;
  130150. let entities;
  130151. let iEntities;
  130152. let collection;
  130153. const composite = that._composite;
  130154. const newEntities = new EntityCollection_default(that);
  130155. const eventHash = that._eventHash;
  130156. let collectionId;
  130157. for (i2 = 0; i2 < collectionsCopyLength; i2++) {
  130158. collection = collectionsCopy[i2];
  130159. collection.collectionChanged.removeEventListener(
  130160. CompositeEntityCollection.prototype._onCollectionChanged,
  130161. that
  130162. );
  130163. entities = collection.values;
  130164. collectionId = collection.id;
  130165. for (iEntities = entities.length - 1; iEntities > -1; iEntities--) {
  130166. entity = entities[iEntities];
  130167. unsubscribeFromEntity(that, eventHash, collectionId, entity);
  130168. }
  130169. }
  130170. for (i2 = collectionsLength - 1; i2 >= 0; i2--) {
  130171. collection = collections[i2];
  130172. collection.collectionChanged.addEventListener(
  130173. CompositeEntityCollection.prototype._onCollectionChanged,
  130174. that
  130175. );
  130176. entities = collection.values;
  130177. collectionId = collection.id;
  130178. for (iEntities = entities.length - 1; iEntities > -1; iEntities--) {
  130179. entity = entities[iEntities];
  130180. subscribeToEntity(that, eventHash, collectionId, entity);
  130181. let compositeEntity = newEntities.getById(entity.id);
  130182. if (!defined_default(compositeEntity)) {
  130183. compositeEntity = composite.getById(entity.id);
  130184. if (!defined_default(compositeEntity)) {
  130185. entityOptionsScratch2.id = entity.id;
  130186. compositeEntity = new Entity_default(entityOptionsScratch2);
  130187. } else {
  130188. clean(compositeEntity);
  130189. }
  130190. newEntities.add(compositeEntity);
  130191. }
  130192. compositeEntity.merge(entity);
  130193. }
  130194. }
  130195. that._collectionsCopy = collections.slice(0);
  130196. composite.suspendEvents();
  130197. composite.removeAll();
  130198. const newEntitiesArray = newEntities.values;
  130199. for (i2 = 0; i2 < newEntitiesArray.length; i2++) {
  130200. composite.add(newEntitiesArray[i2]);
  130201. }
  130202. composite.resumeEvents();
  130203. }
  130204. function CompositeEntityCollection(collections, owner) {
  130205. this._owner = owner;
  130206. this._composite = new EntityCollection_default(this);
  130207. this._suspendCount = 0;
  130208. this._collections = defined_default(collections) ? collections.slice() : [];
  130209. this._collectionsCopy = [];
  130210. this._id = createGuid_default();
  130211. this._eventHash = {};
  130212. recomposite(this);
  130213. this._shouldRecomposite = false;
  130214. }
  130215. Object.defineProperties(CompositeEntityCollection.prototype, {
  130216. collectionChanged: {
  130217. get: function() {
  130218. return this._composite._collectionChanged;
  130219. }
  130220. },
  130221. id: {
  130222. get: function() {
  130223. return this._id;
  130224. }
  130225. },
  130226. values: {
  130227. get: function() {
  130228. return this._composite.values;
  130229. }
  130230. },
  130231. owner: {
  130232. get: function() {
  130233. return this._owner;
  130234. }
  130235. }
  130236. });
  130237. CompositeEntityCollection.prototype.addCollection = function(collection, index2) {
  130238. const hasIndex = defined_default(index2);
  130239. if (!defined_default(collection)) {
  130240. throw new DeveloperError_default("collection is required.");
  130241. }
  130242. if (hasIndex) {
  130243. if (index2 < 0) {
  130244. throw new DeveloperError_default("index must be greater than or equal to zero.");
  130245. } else if (index2 > this._collections.length) {
  130246. throw new DeveloperError_default(
  130247. "index must be less than or equal to the number of collections."
  130248. );
  130249. }
  130250. }
  130251. if (!hasIndex) {
  130252. index2 = this._collections.length;
  130253. this._collections.push(collection);
  130254. } else {
  130255. this._collections.splice(index2, 0, collection);
  130256. }
  130257. recomposite(this);
  130258. };
  130259. CompositeEntityCollection.prototype.removeCollection = function(collection) {
  130260. const index2 = this._collections.indexOf(collection);
  130261. if (index2 !== -1) {
  130262. this._collections.splice(index2, 1);
  130263. recomposite(this);
  130264. return true;
  130265. }
  130266. return false;
  130267. };
  130268. CompositeEntityCollection.prototype.removeAllCollections = function() {
  130269. this._collections.length = 0;
  130270. recomposite(this);
  130271. };
  130272. CompositeEntityCollection.prototype.containsCollection = function(collection) {
  130273. return this._collections.indexOf(collection) !== -1;
  130274. };
  130275. CompositeEntityCollection.prototype.contains = function(entity) {
  130276. return this._composite.contains(entity);
  130277. };
  130278. CompositeEntityCollection.prototype.indexOfCollection = function(collection) {
  130279. return this._collections.indexOf(collection);
  130280. };
  130281. CompositeEntityCollection.prototype.getCollection = function(index2) {
  130282. if (!defined_default(index2)) {
  130283. throw new DeveloperError_default("index is required.", "index");
  130284. }
  130285. return this._collections[index2];
  130286. };
  130287. CompositeEntityCollection.prototype.getCollectionsLength = function() {
  130288. return this._collections.length;
  130289. };
  130290. function getCollectionIndex(collections, collection) {
  130291. if (!defined_default(collection)) {
  130292. throw new DeveloperError_default("collection is required.");
  130293. }
  130294. const index2 = collections.indexOf(collection);
  130295. if (index2 === -1) {
  130296. throw new DeveloperError_default("collection is not in this composite.");
  130297. }
  130298. return index2;
  130299. }
  130300. function swapCollections(composite, i2, j) {
  130301. const arr = composite._collections;
  130302. i2 = Math_default.clamp(i2, 0, arr.length - 1);
  130303. j = Math_default.clamp(j, 0, arr.length - 1);
  130304. if (i2 === j) {
  130305. return;
  130306. }
  130307. const temp = arr[i2];
  130308. arr[i2] = arr[j];
  130309. arr[j] = temp;
  130310. recomposite(composite);
  130311. }
  130312. CompositeEntityCollection.prototype.raiseCollection = function(collection) {
  130313. const index2 = getCollectionIndex(this._collections, collection);
  130314. swapCollections(this, index2, index2 + 1);
  130315. };
  130316. CompositeEntityCollection.prototype.lowerCollection = function(collection) {
  130317. const index2 = getCollectionIndex(this._collections, collection);
  130318. swapCollections(this, index2, index2 - 1);
  130319. };
  130320. CompositeEntityCollection.prototype.raiseCollectionToTop = function(collection) {
  130321. const index2 = getCollectionIndex(this._collections, collection);
  130322. if (index2 === this._collections.length - 1) {
  130323. return;
  130324. }
  130325. this._collections.splice(index2, 1);
  130326. this._collections.push(collection);
  130327. recomposite(this);
  130328. };
  130329. CompositeEntityCollection.prototype.lowerCollectionToBottom = function(collection) {
  130330. const index2 = getCollectionIndex(this._collections, collection);
  130331. if (index2 === 0) {
  130332. return;
  130333. }
  130334. this._collections.splice(index2, 1);
  130335. this._collections.splice(0, 0, collection);
  130336. recomposite(this);
  130337. };
  130338. CompositeEntityCollection.prototype.suspendEvents = function() {
  130339. this._suspendCount++;
  130340. this._composite.suspendEvents();
  130341. };
  130342. CompositeEntityCollection.prototype.resumeEvents = function() {
  130343. if (this._suspendCount === 0) {
  130344. throw new DeveloperError_default(
  130345. "resumeEvents can not be called before suspendEvents."
  130346. );
  130347. }
  130348. this._suspendCount--;
  130349. if (this._shouldRecomposite && this._suspendCount === 0) {
  130350. recomposite(this);
  130351. this._shouldRecomposite = false;
  130352. }
  130353. this._composite.resumeEvents();
  130354. };
  130355. CompositeEntityCollection.prototype.computeAvailability = function() {
  130356. return this._composite.computeAvailability();
  130357. };
  130358. CompositeEntityCollection.prototype.getById = function(id) {
  130359. return this._composite.getById(id);
  130360. };
  130361. CompositeEntityCollection.prototype._onCollectionChanged = function(collection, added, removed) {
  130362. const collections = this._collectionsCopy;
  130363. const collectionsLength = collections.length;
  130364. const composite = this._composite;
  130365. composite.suspendEvents();
  130366. let i2;
  130367. let q;
  130368. let entity;
  130369. let compositeEntity;
  130370. const removedLength = removed.length;
  130371. const eventHash = this._eventHash;
  130372. const collectionId = collection.id;
  130373. for (i2 = 0; i2 < removedLength; i2++) {
  130374. const removedEntity = removed[i2];
  130375. unsubscribeFromEntity(this, eventHash, collectionId, removedEntity);
  130376. const removedId = removedEntity.id;
  130377. for (q = collectionsLength - 1; q >= 0; q--) {
  130378. entity = collections[q].getById(removedId);
  130379. if (defined_default(entity)) {
  130380. if (!defined_default(compositeEntity)) {
  130381. compositeEntity = composite.getById(removedId);
  130382. clean(compositeEntity);
  130383. }
  130384. compositeEntity.merge(entity);
  130385. }
  130386. }
  130387. if (!defined_default(compositeEntity)) {
  130388. composite.removeById(removedId);
  130389. }
  130390. compositeEntity = void 0;
  130391. }
  130392. const addedLength = added.length;
  130393. for (i2 = 0; i2 < addedLength; i2++) {
  130394. const addedEntity = added[i2];
  130395. subscribeToEntity(this, eventHash, collectionId, addedEntity);
  130396. const addedId = addedEntity.id;
  130397. for (q = collectionsLength - 1; q >= 0; q--) {
  130398. entity = collections[q].getById(addedId);
  130399. if (defined_default(entity)) {
  130400. if (!defined_default(compositeEntity)) {
  130401. compositeEntity = composite.getById(addedId);
  130402. if (!defined_default(compositeEntity)) {
  130403. entityOptionsScratch2.id = addedId;
  130404. compositeEntity = new Entity_default(entityOptionsScratch2);
  130405. composite.add(compositeEntity);
  130406. } else {
  130407. clean(compositeEntity);
  130408. }
  130409. }
  130410. compositeEntity.merge(entity);
  130411. }
  130412. }
  130413. compositeEntity = void 0;
  130414. }
  130415. composite.resumeEvents();
  130416. };
  130417. CompositeEntityCollection.prototype._onDefinitionChanged = function(entity, propertyName, newValue, oldValue2) {
  130418. const collections = this._collections;
  130419. const composite = this._composite;
  130420. const collectionsLength = collections.length;
  130421. const id = entity.id;
  130422. const compositeEntity = composite.getById(id);
  130423. let compositeProperty = compositeEntity[propertyName];
  130424. const newProperty = !defined_default(compositeProperty);
  130425. let firstTime = true;
  130426. for (let q = collectionsLength - 1; q >= 0; q--) {
  130427. const innerEntity = collections[q].getById(entity.id);
  130428. if (defined_default(innerEntity)) {
  130429. const property = innerEntity[propertyName];
  130430. if (defined_default(property)) {
  130431. if (firstTime) {
  130432. firstTime = false;
  130433. if (defined_default(property.merge) && defined_default(property.clone)) {
  130434. compositeProperty = property.clone(compositeProperty);
  130435. } else {
  130436. compositeProperty = property;
  130437. break;
  130438. }
  130439. }
  130440. compositeProperty.merge(property);
  130441. }
  130442. }
  130443. }
  130444. if (newProperty && compositeEntity.propertyNames.indexOf(propertyName) === -1) {
  130445. compositeEntity.addProperty(propertyName);
  130446. }
  130447. compositeEntity[propertyName] = compositeProperty;
  130448. };
  130449. var CompositeEntityCollection_default = CompositeEntityCollection;
  130450. // node_modules/cesium/Source/DataSources/CompositeProperty.js
  130451. function subscribeAll(property, eventHelper, definitionChanged, intervals) {
  130452. function callback() {
  130453. definitionChanged.raiseEvent(property);
  130454. }
  130455. const items = [];
  130456. eventHelper.removeAll();
  130457. const length3 = intervals.length;
  130458. for (let i2 = 0; i2 < length3; i2++) {
  130459. const interval = intervals.get(i2);
  130460. if (defined_default(interval.data) && items.indexOf(interval.data) === -1) {
  130461. eventHelper.add(interval.data.definitionChanged, callback);
  130462. }
  130463. }
  130464. }
  130465. function CompositeProperty() {
  130466. this._eventHelper = new EventHelper_default();
  130467. this._definitionChanged = new Event_default();
  130468. this._intervals = new TimeIntervalCollection_default();
  130469. this._intervals.changedEvent.addEventListener(
  130470. CompositeProperty.prototype._intervalsChanged,
  130471. this
  130472. );
  130473. }
  130474. Object.defineProperties(CompositeProperty.prototype, {
  130475. isConstant: {
  130476. get: function() {
  130477. return this._intervals.isEmpty;
  130478. }
  130479. },
  130480. definitionChanged: {
  130481. get: function() {
  130482. return this._definitionChanged;
  130483. }
  130484. },
  130485. intervals: {
  130486. get: function() {
  130487. return this._intervals;
  130488. }
  130489. }
  130490. });
  130491. CompositeProperty.prototype.getValue = function(time, result) {
  130492. if (!defined_default(time)) {
  130493. throw new DeveloperError_default("time is required");
  130494. }
  130495. const innerProperty = this._intervals.findDataForIntervalContainingDate(time);
  130496. if (defined_default(innerProperty)) {
  130497. return innerProperty.getValue(time, result);
  130498. }
  130499. return void 0;
  130500. };
  130501. CompositeProperty.prototype.equals = function(other) {
  130502. return this === other || other instanceof CompositeProperty && this._intervals.equals(other._intervals, Property_default.equals);
  130503. };
  130504. CompositeProperty.prototype._intervalsChanged = function() {
  130505. subscribeAll(
  130506. this,
  130507. this._eventHelper,
  130508. this._definitionChanged,
  130509. this._intervals
  130510. );
  130511. this._definitionChanged.raiseEvent(this);
  130512. };
  130513. var CompositeProperty_default = CompositeProperty;
  130514. // node_modules/cesium/Source/DataSources/CompositeMaterialProperty.js
  130515. function CompositeMaterialProperty() {
  130516. this._definitionChanged = new Event_default();
  130517. this._composite = new CompositeProperty_default();
  130518. this._composite.definitionChanged.addEventListener(
  130519. CompositeMaterialProperty.prototype._raiseDefinitionChanged,
  130520. this
  130521. );
  130522. }
  130523. Object.defineProperties(CompositeMaterialProperty.prototype, {
  130524. isConstant: {
  130525. get: function() {
  130526. return this._composite.isConstant;
  130527. }
  130528. },
  130529. definitionChanged: {
  130530. get: function() {
  130531. return this._definitionChanged;
  130532. }
  130533. },
  130534. intervals: {
  130535. get: function() {
  130536. return this._composite._intervals;
  130537. }
  130538. }
  130539. });
  130540. CompositeMaterialProperty.prototype.getType = function(time) {
  130541. if (!defined_default(time)) {
  130542. throw new DeveloperError_default("time is required");
  130543. }
  130544. const innerProperty = this._composite._intervals.findDataForIntervalContainingDate(
  130545. time
  130546. );
  130547. if (defined_default(innerProperty)) {
  130548. return innerProperty.getType(time);
  130549. }
  130550. return void 0;
  130551. };
  130552. CompositeMaterialProperty.prototype.getValue = function(time, result) {
  130553. if (!defined_default(time)) {
  130554. throw new DeveloperError_default("time is required");
  130555. }
  130556. const innerProperty = this._composite._intervals.findDataForIntervalContainingDate(
  130557. time
  130558. );
  130559. if (defined_default(innerProperty)) {
  130560. return innerProperty.getValue(time, result);
  130561. }
  130562. return void 0;
  130563. };
  130564. CompositeMaterialProperty.prototype.equals = function(other) {
  130565. return this === other || other instanceof CompositeMaterialProperty && this._composite.equals(other._composite, Property_default.equals);
  130566. };
  130567. CompositeMaterialProperty.prototype._raiseDefinitionChanged = function() {
  130568. this._definitionChanged.raiseEvent(this);
  130569. };
  130570. var CompositeMaterialProperty_default = CompositeMaterialProperty;
  130571. // node_modules/cesium/Source/DataSources/CompositePositionProperty.js
  130572. function CompositePositionProperty(referenceFrame) {
  130573. this._referenceFrame = defaultValue_default(referenceFrame, ReferenceFrame_default.FIXED);
  130574. this._definitionChanged = new Event_default();
  130575. this._composite = new CompositeProperty_default();
  130576. this._composite.definitionChanged.addEventListener(
  130577. CompositePositionProperty.prototype._raiseDefinitionChanged,
  130578. this
  130579. );
  130580. }
  130581. Object.defineProperties(CompositePositionProperty.prototype, {
  130582. isConstant: {
  130583. get: function() {
  130584. return this._composite.isConstant;
  130585. }
  130586. },
  130587. definitionChanged: {
  130588. get: function() {
  130589. return this._definitionChanged;
  130590. }
  130591. },
  130592. intervals: {
  130593. get: function() {
  130594. return this._composite.intervals;
  130595. }
  130596. },
  130597. referenceFrame: {
  130598. get: function() {
  130599. return this._referenceFrame;
  130600. },
  130601. set: function(value) {
  130602. this._referenceFrame = value;
  130603. }
  130604. }
  130605. });
  130606. CompositePositionProperty.prototype.getValue = function(time, result) {
  130607. return this.getValueInReferenceFrame(time, ReferenceFrame_default.FIXED, result);
  130608. };
  130609. CompositePositionProperty.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) {
  130610. if (!defined_default(time)) {
  130611. throw new DeveloperError_default("time is required.");
  130612. }
  130613. if (!defined_default(referenceFrame)) {
  130614. throw new DeveloperError_default("referenceFrame is required.");
  130615. }
  130616. const innerProperty = this._composite._intervals.findDataForIntervalContainingDate(
  130617. time
  130618. );
  130619. if (defined_default(innerProperty)) {
  130620. return innerProperty.getValueInReferenceFrame(time, referenceFrame, result);
  130621. }
  130622. return void 0;
  130623. };
  130624. CompositePositionProperty.prototype.equals = function(other) {
  130625. return this === other || other instanceof CompositePositionProperty && this._referenceFrame === other._referenceFrame && this._composite.equals(other._composite, Property_default.equals);
  130626. };
  130627. CompositePositionProperty.prototype._raiseDefinitionChanged = function() {
  130628. this._definitionChanged.raiseEvent(this);
  130629. };
  130630. var CompositePositionProperty_default = CompositePositionProperty;
  130631. // node_modules/cesium/Source/DataSources/GroundGeometryUpdater.js
  130632. var defaultZIndex = new ConstantProperty_default(0);
  130633. function GroundGeometryUpdater(options) {
  130634. GeometryUpdater_default.call(this, options);
  130635. this._zIndex = 0;
  130636. this._terrainOffsetProperty = void 0;
  130637. }
  130638. if (defined_default(Object.create)) {
  130639. GroundGeometryUpdater.prototype = Object.create(GeometryUpdater_default.prototype);
  130640. GroundGeometryUpdater.prototype.constructor = GroundGeometryUpdater;
  130641. }
  130642. Object.defineProperties(GroundGeometryUpdater.prototype, {
  130643. zIndex: {
  130644. get: function() {
  130645. return this._zIndex;
  130646. }
  130647. },
  130648. terrainOffsetProperty: {
  130649. get: function() {
  130650. return this._terrainOffsetProperty;
  130651. }
  130652. }
  130653. });
  130654. GroundGeometryUpdater.prototype._isOnTerrain = function(entity, geometry) {
  130655. return this._fillEnabled && !defined_default(geometry.height) && !defined_default(geometry.extrudedHeight) && GroundPrimitive_default.isSupported(this._scene);
  130656. };
  130657. GroundGeometryUpdater.prototype._getIsClosed = function(options) {
  130658. const height = options.height;
  130659. const extrudedHeight = options.extrudedHeight;
  130660. return height === 0 || defined_default(extrudedHeight) && extrudedHeight !== height;
  130661. };
  130662. GroundGeometryUpdater.prototype._computeCenter = DeveloperError_default.throwInstantiationError;
  130663. GroundGeometryUpdater.prototype._onEntityPropertyChanged = function(entity, propertyName, newValue, oldValue2) {
  130664. GeometryUpdater_default.prototype._onEntityPropertyChanged.call(
  130665. this,
  130666. entity,
  130667. propertyName,
  130668. newValue,
  130669. oldValue2
  130670. );
  130671. if (this._observedPropertyNames.indexOf(propertyName) === -1) {
  130672. return;
  130673. }
  130674. const geometry = this._entity[this._geometryPropertyName];
  130675. if (!defined_default(geometry)) {
  130676. return;
  130677. }
  130678. if (defined_default(geometry.zIndex) && (defined_default(geometry.height) || defined_default(geometry.extrudedHeight))) {
  130679. oneTimeWarning_default(oneTimeWarning_default.geometryZIndex);
  130680. }
  130681. this._zIndex = defaultValue_default(geometry.zIndex, defaultZIndex);
  130682. if (defined_default(this._terrainOffsetProperty)) {
  130683. this._terrainOffsetProperty.destroy();
  130684. this._terrainOffsetProperty = void 0;
  130685. }
  130686. const heightReferenceProperty = geometry.heightReference;
  130687. const extrudedHeightReferenceProperty = geometry.extrudedHeightReference;
  130688. if (defined_default(heightReferenceProperty) || defined_default(extrudedHeightReferenceProperty)) {
  130689. const centerPosition = new CallbackProperty_default(
  130690. this._computeCenter.bind(this),
  130691. !this._dynamic
  130692. );
  130693. this._terrainOffsetProperty = new TerrainOffsetProperty_default(
  130694. this._scene,
  130695. centerPosition,
  130696. heightReferenceProperty,
  130697. extrudedHeightReferenceProperty
  130698. );
  130699. }
  130700. };
  130701. GroundGeometryUpdater.prototype.destroy = function() {
  130702. if (defined_default(this._terrainOffsetProperty)) {
  130703. this._terrainOffsetProperty.destroy();
  130704. this._terrainOffsetProperty = void 0;
  130705. }
  130706. GeometryUpdater_default.prototype.destroy.call(this);
  130707. };
  130708. GroundGeometryUpdater.getGeometryHeight = function(height, heightReference) {
  130709. Check_default.defined("heightReference", heightReference);
  130710. if (!defined_default(height)) {
  130711. if (heightReference !== HeightReference_default.NONE) {
  130712. oneTimeWarning_default(oneTimeWarning_default.geometryHeightReference);
  130713. }
  130714. return;
  130715. }
  130716. if (heightReference !== HeightReference_default.CLAMP_TO_GROUND) {
  130717. return height;
  130718. }
  130719. return 0;
  130720. };
  130721. GroundGeometryUpdater.getGeometryExtrudedHeight = function(extrudedHeight, extrudedHeightReference) {
  130722. Check_default.defined("extrudedHeightReference", extrudedHeightReference);
  130723. if (!defined_default(extrudedHeight)) {
  130724. if (extrudedHeightReference !== HeightReference_default.NONE) {
  130725. oneTimeWarning_default(oneTimeWarning_default.geometryExtrudedHeightReference);
  130726. }
  130727. return;
  130728. }
  130729. if (extrudedHeightReference !== HeightReference_default.CLAMP_TO_GROUND) {
  130730. return extrudedHeight;
  130731. }
  130732. return GroundGeometryUpdater.CLAMP_TO_GROUND;
  130733. };
  130734. GroundGeometryUpdater.CLAMP_TO_GROUND = "clamp";
  130735. GroundGeometryUpdater.computeGeometryOffsetAttribute = function(height, heightReference, extrudedHeight, extrudedHeightReference) {
  130736. if (!defined_default(height) || !defined_default(heightReference)) {
  130737. heightReference = HeightReference_default.NONE;
  130738. }
  130739. if (!defined_default(extrudedHeight) || !defined_default(extrudedHeightReference)) {
  130740. extrudedHeightReference = HeightReference_default.NONE;
  130741. }
  130742. let n2 = 0;
  130743. if (heightReference !== HeightReference_default.NONE) {
  130744. n2++;
  130745. }
  130746. if (extrudedHeightReference === HeightReference_default.RELATIVE_TO_GROUND) {
  130747. n2++;
  130748. }
  130749. if (n2 === 2) {
  130750. return GeometryOffsetAttribute_default.ALL;
  130751. }
  130752. if (n2 === 1) {
  130753. return GeometryOffsetAttribute_default.TOP;
  130754. }
  130755. return void 0;
  130756. };
  130757. var GroundGeometryUpdater_default = GroundGeometryUpdater;
  130758. // node_modules/cesium/Source/DataSources/CorridorGeometryUpdater.js
  130759. var scratchColor12 = new Color_default();
  130760. var defaultOffset2 = Cartesian3_default.ZERO;
  130761. var offsetScratch5 = new Cartesian3_default();
  130762. var scratchRectangle5 = new Rectangle_default();
  130763. function CorridorGeometryOptions(entity) {
  130764. this.id = entity;
  130765. this.vertexFormat = void 0;
  130766. this.positions = void 0;
  130767. this.width = void 0;
  130768. this.cornerType = void 0;
  130769. this.height = void 0;
  130770. this.extrudedHeight = void 0;
  130771. this.granularity = void 0;
  130772. this.offsetAttribute = void 0;
  130773. }
  130774. function CorridorGeometryUpdater(entity, scene) {
  130775. GroundGeometryUpdater_default.call(this, {
  130776. entity,
  130777. scene,
  130778. geometryOptions: new CorridorGeometryOptions(entity),
  130779. geometryPropertyName: "corridor",
  130780. observedPropertyNames: ["availability", "corridor"]
  130781. });
  130782. this._onEntityPropertyChanged(entity, "corridor", entity.corridor, void 0);
  130783. }
  130784. if (defined_default(Object.create)) {
  130785. CorridorGeometryUpdater.prototype = Object.create(
  130786. GroundGeometryUpdater_default.prototype
  130787. );
  130788. CorridorGeometryUpdater.prototype.constructor = CorridorGeometryUpdater;
  130789. }
  130790. CorridorGeometryUpdater.prototype.createFillGeometryInstance = function(time) {
  130791. Check_default.defined("time", time);
  130792. if (!this._fillEnabled) {
  130793. throw new DeveloperError_default(
  130794. "This instance does not represent a filled geometry."
  130795. );
  130796. }
  130797. const entity = this._entity;
  130798. const isAvailable = entity.isAvailable(time);
  130799. const attributes = {
  130800. show: new ShowGeometryInstanceAttribute_default(
  130801. isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time)
  130802. ),
  130803. distanceDisplayCondition: DistanceDisplayConditionGeometryInstanceAttribute_default.fromDistanceDisplayCondition(
  130804. this._distanceDisplayConditionProperty.getValue(time)
  130805. ),
  130806. offset: void 0,
  130807. color: void 0
  130808. };
  130809. if (this._materialProperty instanceof ColorMaterialProperty_default) {
  130810. let currentColor;
  130811. if (defined_default(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) {
  130812. currentColor = this._materialProperty.color.getValue(time, scratchColor12);
  130813. }
  130814. if (!defined_default(currentColor)) {
  130815. currentColor = Color_default.WHITE;
  130816. }
  130817. attributes.color = ColorGeometryInstanceAttribute_default.fromColor(currentColor);
  130818. }
  130819. if (defined_default(this._options.offsetAttribute)) {
  130820. attributes.offset = OffsetGeometryInstanceAttribute_default.fromCartesian3(
  130821. Property_default.getValueOrDefault(
  130822. this._terrainOffsetProperty,
  130823. time,
  130824. defaultOffset2,
  130825. offsetScratch5
  130826. )
  130827. );
  130828. }
  130829. return new GeometryInstance_default({
  130830. id: entity,
  130831. geometry: new CorridorGeometry_default(this._options),
  130832. attributes
  130833. });
  130834. };
  130835. CorridorGeometryUpdater.prototype.createOutlineGeometryInstance = function(time) {
  130836. Check_default.defined("time", time);
  130837. if (!this._outlineEnabled) {
  130838. throw new DeveloperError_default(
  130839. "This instance does not represent an outlined geometry."
  130840. );
  130841. }
  130842. const entity = this._entity;
  130843. const isAvailable = entity.isAvailable(time);
  130844. const outlineColor = Property_default.getValueOrDefault(
  130845. this._outlineColorProperty,
  130846. time,
  130847. Color_default.BLACK,
  130848. scratchColor12
  130849. );
  130850. const attributes = {
  130851. show: new ShowGeometryInstanceAttribute_default(
  130852. isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)
  130853. ),
  130854. color: ColorGeometryInstanceAttribute_default.fromColor(outlineColor),
  130855. distanceDisplayCondition: DistanceDisplayConditionGeometryInstanceAttribute_default.fromDistanceDisplayCondition(
  130856. this._distanceDisplayConditionProperty.getValue(time)
  130857. ),
  130858. offset: void 0
  130859. };
  130860. if (defined_default(this._options.offsetAttribute)) {
  130861. attributes.offset = OffsetGeometryInstanceAttribute_default.fromCartesian3(
  130862. Property_default.getValueOrDefault(
  130863. this._terrainOffsetProperty,
  130864. time,
  130865. defaultOffset2,
  130866. offsetScratch5
  130867. )
  130868. );
  130869. }
  130870. return new GeometryInstance_default({
  130871. id: entity,
  130872. geometry: new CorridorOutlineGeometry_default(this._options),
  130873. attributes
  130874. });
  130875. };
  130876. CorridorGeometryUpdater.prototype._computeCenter = function(time, result) {
  130877. const positions = Property_default.getValueOrUndefined(
  130878. this._entity.corridor.positions,
  130879. time
  130880. );
  130881. if (!defined_default(positions) || positions.length === 0) {
  130882. return;
  130883. }
  130884. return Cartesian3_default.clone(
  130885. positions[Math.floor(positions.length / 2)],
  130886. result
  130887. );
  130888. };
  130889. CorridorGeometryUpdater.prototype._isHidden = function(entity, corridor) {
  130890. return !defined_default(corridor.positions) || !defined_default(corridor.width) || GeometryUpdater_default.prototype._isHidden.call(this, entity, corridor);
  130891. };
  130892. CorridorGeometryUpdater.prototype._isDynamic = function(entity, corridor) {
  130893. return !corridor.positions.isConstant || !Property_default.isConstant(corridor.height) || !Property_default.isConstant(corridor.extrudedHeight) || !Property_default.isConstant(corridor.granularity) || !Property_default.isConstant(corridor.width) || !Property_default.isConstant(corridor.outlineWidth) || !Property_default.isConstant(corridor.cornerType) || !Property_default.isConstant(corridor.zIndex) || this._onTerrain && !Property_default.isConstant(this._materialProperty) && !(this._materialProperty instanceof ColorMaterialProperty_default);
  130894. };
  130895. CorridorGeometryUpdater.prototype._setStaticOptions = function(entity, corridor) {
  130896. let heightValue = Property_default.getValueOrUndefined(
  130897. corridor.height,
  130898. Iso8601_default.MINIMUM_VALUE
  130899. );
  130900. const heightReferenceValue = Property_default.getValueOrDefault(
  130901. corridor.heightReference,
  130902. Iso8601_default.MINIMUM_VALUE,
  130903. HeightReference_default.NONE
  130904. );
  130905. let extrudedHeightValue = Property_default.getValueOrUndefined(
  130906. corridor.extrudedHeight,
  130907. Iso8601_default.MINIMUM_VALUE
  130908. );
  130909. const extrudedHeightReferenceValue = Property_default.getValueOrDefault(
  130910. corridor.extrudedHeightReference,
  130911. Iso8601_default.MINIMUM_VALUE,
  130912. HeightReference_default.NONE
  130913. );
  130914. if (defined_default(extrudedHeightValue) && !defined_default(heightValue)) {
  130915. heightValue = 0;
  130916. }
  130917. const options = this._options;
  130918. options.vertexFormat = this._materialProperty instanceof ColorMaterialProperty_default ? PerInstanceColorAppearance_default.VERTEX_FORMAT : MaterialAppearance_default.MaterialSupport.TEXTURED.vertexFormat;
  130919. options.positions = corridor.positions.getValue(
  130920. Iso8601_default.MINIMUM_VALUE,
  130921. options.positions
  130922. );
  130923. options.width = corridor.width.getValue(Iso8601_default.MINIMUM_VALUE);
  130924. options.granularity = Property_default.getValueOrUndefined(
  130925. corridor.granularity,
  130926. Iso8601_default.MINIMUM_VALUE
  130927. );
  130928. options.cornerType = Property_default.getValueOrUndefined(
  130929. corridor.cornerType,
  130930. Iso8601_default.MINIMUM_VALUE
  130931. );
  130932. options.offsetAttribute = GroundGeometryUpdater_default.computeGeometryOffsetAttribute(
  130933. heightValue,
  130934. heightReferenceValue,
  130935. extrudedHeightValue,
  130936. extrudedHeightReferenceValue
  130937. );
  130938. options.height = GroundGeometryUpdater_default.getGeometryHeight(
  130939. heightValue,
  130940. heightReferenceValue
  130941. );
  130942. extrudedHeightValue = GroundGeometryUpdater_default.getGeometryExtrudedHeight(
  130943. extrudedHeightValue,
  130944. extrudedHeightReferenceValue
  130945. );
  130946. if (extrudedHeightValue === GroundGeometryUpdater_default.CLAMP_TO_GROUND) {
  130947. extrudedHeightValue = ApproximateTerrainHeights_default.getMinimumMaximumHeights(
  130948. CorridorGeometry_default.computeRectangle(options, scratchRectangle5)
  130949. ).minimumTerrainHeight;
  130950. }
  130951. options.extrudedHeight = extrudedHeightValue;
  130952. };
  130953. CorridorGeometryUpdater.DynamicGeometryUpdater = DynamicCorridorGeometryUpdater;
  130954. function DynamicCorridorGeometryUpdater(geometryUpdater, primitives, groundPrimitives) {
  130955. DynamicGeometryUpdater_default.call(
  130956. this,
  130957. geometryUpdater,
  130958. primitives,
  130959. groundPrimitives
  130960. );
  130961. }
  130962. if (defined_default(Object.create)) {
  130963. DynamicCorridorGeometryUpdater.prototype = Object.create(
  130964. DynamicGeometryUpdater_default.prototype
  130965. );
  130966. DynamicCorridorGeometryUpdater.prototype.constructor = DynamicCorridorGeometryUpdater;
  130967. }
  130968. DynamicCorridorGeometryUpdater.prototype._isHidden = function(entity, corridor, time) {
  130969. const options = this._options;
  130970. return !defined_default(options.positions) || !defined_default(options.width) || DynamicGeometryUpdater_default.prototype._isHidden.call(
  130971. this,
  130972. entity,
  130973. corridor,
  130974. time
  130975. );
  130976. };
  130977. DynamicCorridorGeometryUpdater.prototype._setOptions = function(entity, corridor, time) {
  130978. const options = this._options;
  130979. let heightValue = Property_default.getValueOrUndefined(corridor.height, time);
  130980. const heightReferenceValue = Property_default.getValueOrDefault(
  130981. corridor.heightReference,
  130982. time,
  130983. HeightReference_default.NONE
  130984. );
  130985. let extrudedHeightValue = Property_default.getValueOrUndefined(
  130986. corridor.extrudedHeight,
  130987. time
  130988. );
  130989. const extrudedHeightReferenceValue = Property_default.getValueOrDefault(
  130990. corridor.extrudedHeightReference,
  130991. time,
  130992. HeightReference_default.NONE
  130993. );
  130994. if (defined_default(extrudedHeightValue) && !defined_default(heightValue)) {
  130995. heightValue = 0;
  130996. }
  130997. options.positions = Property_default.getValueOrUndefined(corridor.positions, time);
  130998. options.width = Property_default.getValueOrUndefined(corridor.width, time);
  130999. options.granularity = Property_default.getValueOrUndefined(
  131000. corridor.granularity,
  131001. time
  131002. );
  131003. options.cornerType = Property_default.getValueOrUndefined(corridor.cornerType, time);
  131004. options.offsetAttribute = GroundGeometryUpdater_default.computeGeometryOffsetAttribute(
  131005. heightValue,
  131006. heightReferenceValue,
  131007. extrudedHeightValue,
  131008. extrudedHeightReferenceValue
  131009. );
  131010. options.height = GroundGeometryUpdater_default.getGeometryHeight(
  131011. heightValue,
  131012. heightReferenceValue
  131013. );
  131014. extrudedHeightValue = GroundGeometryUpdater_default.getGeometryExtrudedHeight(
  131015. extrudedHeightValue,
  131016. extrudedHeightReferenceValue
  131017. );
  131018. if (extrudedHeightValue === GroundGeometryUpdater_default.CLAMP_TO_GROUND) {
  131019. extrudedHeightValue = ApproximateTerrainHeights_default.getMinimumMaximumHeights(
  131020. CorridorGeometry_default.computeRectangle(options, scratchRectangle5)
  131021. ).minimumTerrainHeight;
  131022. }
  131023. options.extrudedHeight = extrudedHeightValue;
  131024. };
  131025. var CorridorGeometryUpdater_default = CorridorGeometryUpdater;
  131026. // node_modules/cesium/Source/DataSources/DataSource.js
  131027. function DataSource() {
  131028. DeveloperError_default.throwInstantiationError();
  131029. }
  131030. Object.defineProperties(DataSource.prototype, {
  131031. name: {
  131032. get: DeveloperError_default.throwInstantiationError
  131033. },
  131034. clock: {
  131035. get: DeveloperError_default.throwInstantiationError
  131036. },
  131037. entities: {
  131038. get: DeveloperError_default.throwInstantiationError
  131039. },
  131040. isLoading: {
  131041. get: DeveloperError_default.throwInstantiationError
  131042. },
  131043. changedEvent: {
  131044. get: DeveloperError_default.throwInstantiationError
  131045. },
  131046. errorEvent: {
  131047. get: DeveloperError_default.throwInstantiationError
  131048. },
  131049. loadingEvent: {
  131050. get: DeveloperError_default.throwInstantiationError
  131051. },
  131052. show: {
  131053. get: DeveloperError_default.throwInstantiationError
  131054. },
  131055. clustering: {
  131056. get: DeveloperError_default.throwInstantiationError
  131057. }
  131058. });
  131059. DataSource.prototype.update = function(time) {
  131060. DeveloperError_default.throwInstantiationError();
  131061. };
  131062. DataSource.setLoading = function(dataSource, isLoading) {
  131063. if (dataSource._isLoading !== isLoading) {
  131064. if (isLoading) {
  131065. dataSource._entityCollection.suspendEvents();
  131066. } else {
  131067. dataSource._entityCollection.resumeEvents();
  131068. }
  131069. dataSource._isLoading = isLoading;
  131070. dataSource._loading.raiseEvent(dataSource, isLoading);
  131071. }
  131072. };
  131073. var DataSource_default = DataSource;
  131074. // node_modules/cesium/Source/Scene/PointPrimitive.js
  131075. function PointPrimitive(options, pointPrimitiveCollection) {
  131076. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  131077. if (defined_default(options.disableDepthTestDistance) && options.disableDepthTestDistance < 0) {
  131078. throw new DeveloperError_default(
  131079. "disableDepthTestDistance must be greater than or equal to 0.0."
  131080. );
  131081. }
  131082. let translucencyByDistance = options.translucencyByDistance;
  131083. let scaleByDistance = options.scaleByDistance;
  131084. let distanceDisplayCondition = options.distanceDisplayCondition;
  131085. if (defined_default(translucencyByDistance)) {
  131086. if (translucencyByDistance.far <= translucencyByDistance.near) {
  131087. throw new DeveloperError_default(
  131088. "translucencyByDistance.far must be greater than translucencyByDistance.near."
  131089. );
  131090. }
  131091. translucencyByDistance = NearFarScalar_default.clone(translucencyByDistance);
  131092. }
  131093. if (defined_default(scaleByDistance)) {
  131094. if (scaleByDistance.far <= scaleByDistance.near) {
  131095. throw new DeveloperError_default(
  131096. "scaleByDistance.far must be greater than scaleByDistance.near."
  131097. );
  131098. }
  131099. scaleByDistance = NearFarScalar_default.clone(scaleByDistance);
  131100. }
  131101. if (defined_default(distanceDisplayCondition)) {
  131102. if (distanceDisplayCondition.far <= distanceDisplayCondition.near) {
  131103. throw new DeveloperError_default(
  131104. "distanceDisplayCondition.far must be greater than distanceDisplayCondition.near."
  131105. );
  131106. }
  131107. distanceDisplayCondition = DistanceDisplayCondition_default.clone(
  131108. distanceDisplayCondition
  131109. );
  131110. }
  131111. this._show = defaultValue_default(options.show, true);
  131112. this._position = Cartesian3_default.clone(
  131113. defaultValue_default(options.position, Cartesian3_default.ZERO)
  131114. );
  131115. this._actualPosition = Cartesian3_default.clone(this._position);
  131116. this._color = Color_default.clone(defaultValue_default(options.color, Color_default.WHITE));
  131117. this._outlineColor = Color_default.clone(
  131118. defaultValue_default(options.outlineColor, Color_default.TRANSPARENT)
  131119. );
  131120. this._outlineWidth = defaultValue_default(options.outlineWidth, 0);
  131121. this._pixelSize = defaultValue_default(options.pixelSize, 10);
  131122. this._scaleByDistance = scaleByDistance;
  131123. this._translucencyByDistance = translucencyByDistance;
  131124. this._distanceDisplayCondition = distanceDisplayCondition;
  131125. this._disableDepthTestDistance = defaultValue_default(
  131126. options.disableDepthTestDistance,
  131127. 0
  131128. );
  131129. this._id = options.id;
  131130. this._collection = defaultValue_default(options.collection, pointPrimitiveCollection);
  131131. this._clusterShow = true;
  131132. this._pickId = void 0;
  131133. this._pointPrimitiveCollection = pointPrimitiveCollection;
  131134. this._dirty = false;
  131135. this._index = -1;
  131136. }
  131137. var SHOW_INDEX5 = PointPrimitive.SHOW_INDEX = 0;
  131138. var POSITION_INDEX5 = PointPrimitive.POSITION_INDEX = 1;
  131139. var COLOR_INDEX3 = PointPrimitive.COLOR_INDEX = 2;
  131140. var OUTLINE_COLOR_INDEX = PointPrimitive.OUTLINE_COLOR_INDEX = 3;
  131141. var OUTLINE_WIDTH_INDEX = PointPrimitive.OUTLINE_WIDTH_INDEX = 4;
  131142. var PIXEL_SIZE_INDEX = PointPrimitive.PIXEL_SIZE_INDEX = 5;
  131143. var SCALE_BY_DISTANCE_INDEX3 = PointPrimitive.SCALE_BY_DISTANCE_INDEX = 6;
  131144. var TRANSLUCENCY_BY_DISTANCE_INDEX3 = PointPrimitive.TRANSLUCENCY_BY_DISTANCE_INDEX = 7;
  131145. var DISTANCE_DISPLAY_CONDITION_INDEX2 = PointPrimitive.DISTANCE_DISPLAY_CONDITION_INDEX = 8;
  131146. var DISABLE_DEPTH_DISTANCE_INDEX = PointPrimitive.DISABLE_DEPTH_DISTANCE_INDEX = 9;
  131147. PointPrimitive.NUMBER_OF_PROPERTIES = 10;
  131148. function makeDirty3(pointPrimitive, propertyChanged) {
  131149. const pointPrimitiveCollection = pointPrimitive._pointPrimitiveCollection;
  131150. if (defined_default(pointPrimitiveCollection)) {
  131151. pointPrimitiveCollection._updatePointPrimitive(
  131152. pointPrimitive,
  131153. propertyChanged
  131154. );
  131155. pointPrimitive._dirty = true;
  131156. }
  131157. }
  131158. Object.defineProperties(PointPrimitive.prototype, {
  131159. show: {
  131160. get: function() {
  131161. return this._show;
  131162. },
  131163. set: function(value) {
  131164. if (!defined_default(value)) {
  131165. throw new DeveloperError_default("value is required.");
  131166. }
  131167. if (this._show !== value) {
  131168. this._show = value;
  131169. makeDirty3(this, SHOW_INDEX5);
  131170. }
  131171. }
  131172. },
  131173. position: {
  131174. get: function() {
  131175. return this._position;
  131176. },
  131177. set: function(value) {
  131178. if (!defined_default(value)) {
  131179. throw new DeveloperError_default("value is required.");
  131180. }
  131181. const position = this._position;
  131182. if (!Cartesian3_default.equals(position, value)) {
  131183. Cartesian3_default.clone(value, position);
  131184. Cartesian3_default.clone(value, this._actualPosition);
  131185. makeDirty3(this, POSITION_INDEX5);
  131186. }
  131187. }
  131188. },
  131189. scaleByDistance: {
  131190. get: function() {
  131191. return this._scaleByDistance;
  131192. },
  131193. set: function(value) {
  131194. if (defined_default(value) && value.far <= value.near) {
  131195. throw new DeveloperError_default(
  131196. "far distance must be greater than near distance."
  131197. );
  131198. }
  131199. const scaleByDistance = this._scaleByDistance;
  131200. if (!NearFarScalar_default.equals(scaleByDistance, value)) {
  131201. this._scaleByDistance = NearFarScalar_default.clone(value, scaleByDistance);
  131202. makeDirty3(this, SCALE_BY_DISTANCE_INDEX3);
  131203. }
  131204. }
  131205. },
  131206. translucencyByDistance: {
  131207. get: function() {
  131208. return this._translucencyByDistance;
  131209. },
  131210. set: function(value) {
  131211. if (defined_default(value) && value.far <= value.near) {
  131212. throw new DeveloperError_default(
  131213. "far distance must be greater than near distance."
  131214. );
  131215. }
  131216. const translucencyByDistance = this._translucencyByDistance;
  131217. if (!NearFarScalar_default.equals(translucencyByDistance, value)) {
  131218. this._translucencyByDistance = NearFarScalar_default.clone(
  131219. value,
  131220. translucencyByDistance
  131221. );
  131222. makeDirty3(this, TRANSLUCENCY_BY_DISTANCE_INDEX3);
  131223. }
  131224. }
  131225. },
  131226. pixelSize: {
  131227. get: function() {
  131228. return this._pixelSize;
  131229. },
  131230. set: function(value) {
  131231. if (!defined_default(value)) {
  131232. throw new DeveloperError_default("value is required.");
  131233. }
  131234. if (this._pixelSize !== value) {
  131235. this._pixelSize = value;
  131236. makeDirty3(this, PIXEL_SIZE_INDEX);
  131237. }
  131238. }
  131239. },
  131240. color: {
  131241. get: function() {
  131242. return this._color;
  131243. },
  131244. set: function(value) {
  131245. if (!defined_default(value)) {
  131246. throw new DeveloperError_default("value is required.");
  131247. }
  131248. const color = this._color;
  131249. if (!Color_default.equals(color, value)) {
  131250. Color_default.clone(value, color);
  131251. makeDirty3(this, COLOR_INDEX3);
  131252. }
  131253. }
  131254. },
  131255. outlineColor: {
  131256. get: function() {
  131257. return this._outlineColor;
  131258. },
  131259. set: function(value) {
  131260. if (!defined_default(value)) {
  131261. throw new DeveloperError_default("value is required.");
  131262. }
  131263. const outlineColor = this._outlineColor;
  131264. if (!Color_default.equals(outlineColor, value)) {
  131265. Color_default.clone(value, outlineColor);
  131266. makeDirty3(this, OUTLINE_COLOR_INDEX);
  131267. }
  131268. }
  131269. },
  131270. outlineWidth: {
  131271. get: function() {
  131272. return this._outlineWidth;
  131273. },
  131274. set: function(value) {
  131275. if (!defined_default(value)) {
  131276. throw new DeveloperError_default("value is required.");
  131277. }
  131278. if (this._outlineWidth !== value) {
  131279. this._outlineWidth = value;
  131280. makeDirty3(this, OUTLINE_WIDTH_INDEX);
  131281. }
  131282. }
  131283. },
  131284. distanceDisplayCondition: {
  131285. get: function() {
  131286. return this._distanceDisplayCondition;
  131287. },
  131288. set: function(value) {
  131289. if (defined_default(value) && value.far <= value.near) {
  131290. throw new DeveloperError_default("far must be greater than near");
  131291. }
  131292. if (!DistanceDisplayCondition_default.equals(this._distanceDisplayCondition, value)) {
  131293. this._distanceDisplayCondition = DistanceDisplayCondition_default.clone(
  131294. value,
  131295. this._distanceDisplayCondition
  131296. );
  131297. makeDirty3(this, DISTANCE_DISPLAY_CONDITION_INDEX2);
  131298. }
  131299. }
  131300. },
  131301. disableDepthTestDistance: {
  131302. get: function() {
  131303. return this._disableDepthTestDistance;
  131304. },
  131305. set: function(value) {
  131306. if (this._disableDepthTestDistance !== value) {
  131307. if (!defined_default(value) || value < 0) {
  131308. throw new DeveloperError_default(
  131309. "disableDepthTestDistance must be greater than or equal to 0.0."
  131310. );
  131311. }
  131312. this._disableDepthTestDistance = value;
  131313. makeDirty3(this, DISABLE_DEPTH_DISTANCE_INDEX);
  131314. }
  131315. }
  131316. },
  131317. id: {
  131318. get: function() {
  131319. return this._id;
  131320. },
  131321. set: function(value) {
  131322. this._id = value;
  131323. if (defined_default(this._pickId)) {
  131324. this._pickId.object.id = value;
  131325. }
  131326. }
  131327. },
  131328. pickId: {
  131329. get: function() {
  131330. return this._pickId;
  131331. }
  131332. },
  131333. clusterShow: {
  131334. get: function() {
  131335. return this._clusterShow;
  131336. },
  131337. set: function(value) {
  131338. if (this._clusterShow !== value) {
  131339. this._clusterShow = value;
  131340. makeDirty3(this, SHOW_INDEX5);
  131341. }
  131342. }
  131343. }
  131344. });
  131345. PointPrimitive.prototype.getPickId = function(context) {
  131346. if (!defined_default(this._pickId)) {
  131347. this._pickId = context.createPickId({
  131348. primitive: this,
  131349. collection: this._collection,
  131350. id: this._id
  131351. });
  131352. }
  131353. return this._pickId;
  131354. };
  131355. PointPrimitive.prototype._getActualPosition = function() {
  131356. return this._actualPosition;
  131357. };
  131358. PointPrimitive.prototype._setActualPosition = function(value) {
  131359. Cartesian3_default.clone(value, this._actualPosition);
  131360. makeDirty3(this, POSITION_INDEX5);
  131361. };
  131362. var tempCartesian32 = new Cartesian4_default();
  131363. PointPrimitive._computeActualPosition = function(position, frameState, modelMatrix) {
  131364. if (frameState.mode === SceneMode_default.SCENE3D) {
  131365. return position;
  131366. }
  131367. Matrix4_default.multiplyByPoint(modelMatrix, position, tempCartesian32);
  131368. return SceneTransforms_default.computeActualWgs84Position(frameState, tempCartesian32);
  131369. };
  131370. var scratchCartesian45 = new Cartesian4_default();
  131371. PointPrimitive._computeScreenSpacePosition = function(modelMatrix, position, scene, result) {
  131372. const positionWorld = Matrix4_default.multiplyByVector(
  131373. modelMatrix,
  131374. Cartesian4_default.fromElements(
  131375. position.x,
  131376. position.y,
  131377. position.z,
  131378. 1,
  131379. scratchCartesian45
  131380. ),
  131381. scratchCartesian45
  131382. );
  131383. const positionWC2 = SceneTransforms_default.wgs84ToWindowCoordinates(
  131384. scene,
  131385. positionWorld,
  131386. result
  131387. );
  131388. return positionWC2;
  131389. };
  131390. PointPrimitive.prototype.computeScreenSpacePosition = function(scene, result) {
  131391. const pointPrimitiveCollection = this._pointPrimitiveCollection;
  131392. if (!defined_default(result)) {
  131393. result = new Cartesian2_default();
  131394. }
  131395. if (!defined_default(pointPrimitiveCollection)) {
  131396. throw new DeveloperError_default("PointPrimitive must be in a collection.");
  131397. }
  131398. if (!defined_default(scene)) {
  131399. throw new DeveloperError_default("scene is required.");
  131400. }
  131401. const modelMatrix = pointPrimitiveCollection.modelMatrix;
  131402. const windowCoordinates = PointPrimitive._computeScreenSpacePosition(
  131403. modelMatrix,
  131404. this._actualPosition,
  131405. scene,
  131406. result
  131407. );
  131408. if (!defined_default(windowCoordinates)) {
  131409. return void 0;
  131410. }
  131411. windowCoordinates.y = scene.canvas.clientHeight - windowCoordinates.y;
  131412. return windowCoordinates;
  131413. };
  131414. PointPrimitive.getScreenSpaceBoundingBox = function(point, screenSpacePosition, result) {
  131415. const size = point.pixelSize;
  131416. const halfSize = size * 0.5;
  131417. const x = screenSpacePosition.x - halfSize;
  131418. const y = screenSpacePosition.y - halfSize;
  131419. const width = size;
  131420. const height = size;
  131421. if (!defined_default(result)) {
  131422. result = new BoundingRectangle_default();
  131423. }
  131424. result.x = x;
  131425. result.y = y;
  131426. result.width = width;
  131427. result.height = height;
  131428. return result;
  131429. };
  131430. PointPrimitive.prototype.equals = function(other) {
  131431. return this === other || defined_default(other) && this._id === other._id && Cartesian3_default.equals(this._position, other._position) && Color_default.equals(this._color, other._color) && this._pixelSize === other._pixelSize && this._outlineWidth === other._outlineWidth && this._show === other._show && Color_default.equals(this._outlineColor, other._outlineColor) && NearFarScalar_default.equals(this._scaleByDistance, other._scaleByDistance) && NearFarScalar_default.equals(
  131432. this._translucencyByDistance,
  131433. other._translucencyByDistance
  131434. ) && DistanceDisplayCondition_default.equals(
  131435. this._distanceDisplayCondition,
  131436. other._distanceDisplayCondition
  131437. ) && this._disableDepthTestDistance === other._disableDepthTestDistance;
  131438. };
  131439. PointPrimitive.prototype._destroy = function() {
  131440. this._pickId = this._pickId && this._pickId.destroy();
  131441. this._pointPrimitiveCollection = void 0;
  131442. };
  131443. var PointPrimitive_default = PointPrimitive;
  131444. // node_modules/cesium/Source/Shaders/PointPrimitiveCollectionFS.js
  131445. var PointPrimitiveCollectionFS_default = "varying vec4 v_color;\nvarying vec4 v_outlineColor;\nvarying float v_innerPercent;\nvarying float v_pixelDistance;\nvarying vec4 v_pickColor;\n\nvoid main()\n{\n // The distance in UV space from this fragment to the center of the point, at most 0.5.\n float distanceToCenter = length(gl_PointCoord - vec2(0.5));\n // The max distance stops one pixel shy of the edge to leave space for anti-aliasing.\n float maxDistance = max(0.0, 0.5 - v_pixelDistance);\n float wholeAlpha = 1.0 - smoothstep(maxDistance, 0.5, distanceToCenter);\n float innerAlpha = 1.0 - smoothstep(maxDistance * v_innerPercent, 0.5 * v_innerPercent, distanceToCenter);\n\n vec4 color = mix(v_outlineColor, v_color, innerAlpha);\n color.a *= wholeAlpha;\n\n// Fully transparent parts of the billboard are not pickable.\n#if !defined(OPAQUE) && !defined(TRANSLUCENT)\n if (color.a < 0.005) // matches 0/255 and 1/255\n {\n discard;\n }\n#else\n// The billboard is rendered twice. The opaque pass discards translucent fragments\n// and the translucent pass discards opaque fragments.\n#ifdef OPAQUE\n if (color.a < 0.995) // matches < 254/255\n {\n discard;\n }\n#else\n if (color.a >= 0.995) // matches 254/255 and 255/255\n {\n discard;\n }\n#endif\n#endif\n\n gl_FragColor = czm_gammaCorrect(color);\n czm_writeLogDepth();\n}\n";
  131446. // node_modules/cesium/Source/Shaders/PointPrimitiveCollectionVS.js
  131447. var PointPrimitiveCollectionVS_default = `uniform float u_maxTotalPointSize;
  131448. attribute vec4 positionHighAndSize;
  131449. attribute vec4 positionLowAndOutline;
  131450. attribute vec4 compressedAttribute0; // color, outlineColor, pick color
  131451. attribute vec4 compressedAttribute1; // show, translucency by distance, some free space
  131452. attribute vec4 scaleByDistance; // near, nearScale, far, farScale
  131453. attribute vec3 distanceDisplayConditionAndDisableDepth; // near, far, disableDepthTestDistance
  131454. varying vec4 v_color;
  131455. varying vec4 v_outlineColor;
  131456. varying float v_innerPercent;
  131457. varying float v_pixelDistance;
  131458. varying vec4 v_pickColor;
  131459. const float SHIFT_LEFT8 = 256.0;
  131460. const float SHIFT_RIGHT8 = 1.0 / 256.0;
  131461. void main()
  131462. {
  131463. // Modifying this shader may also require modifications to PointPrimitive._computeScreenSpacePosition
  131464. // unpack attributes
  131465. vec3 positionHigh = positionHighAndSize.xyz;
  131466. vec3 positionLow = positionLowAndOutline.xyz;
  131467. float outlineWidthBothSides = 2.0 * positionLowAndOutline.w;
  131468. float totalSize = positionHighAndSize.w + outlineWidthBothSides;
  131469. float outlinePercent = outlineWidthBothSides / totalSize;
  131470. // Scale in response to browser-zoom.
  131471. totalSize *= czm_pixelRatio;
  131472. // Add padding for anti-aliasing on both sides.
  131473. totalSize += 3.0;
  131474. float temp = compressedAttribute1.x * SHIFT_RIGHT8;
  131475. float show = floor(temp);
  131476. #ifdef EYE_DISTANCE_TRANSLUCENCY
  131477. vec4 translucencyByDistance;
  131478. translucencyByDistance.x = compressedAttribute1.z;
  131479. translucencyByDistance.z = compressedAttribute1.w;
  131480. translucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;
  131481. temp = compressedAttribute1.y * SHIFT_RIGHT8;
  131482. translucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;
  131483. #endif
  131484. ///////////////////////////////////////////////////////////////////////////
  131485. vec4 color;
  131486. vec4 outlineColor;
  131487. vec4 pickColor;
  131488. // compressedAttribute0.z => pickColor.rgb
  131489. temp = compressedAttribute0.z * SHIFT_RIGHT8;
  131490. pickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;
  131491. temp = floor(temp) * SHIFT_RIGHT8;
  131492. pickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;
  131493. pickColor.r = floor(temp);
  131494. // compressedAttribute0.x => color.rgb
  131495. temp = compressedAttribute0.x * SHIFT_RIGHT8;
  131496. color.b = (temp - floor(temp)) * SHIFT_LEFT8;
  131497. temp = floor(temp) * SHIFT_RIGHT8;
  131498. color.g = (temp - floor(temp)) * SHIFT_LEFT8;
  131499. color.r = floor(temp);
  131500. // compressedAttribute0.y => outlineColor.rgb
  131501. temp = compressedAttribute0.y * SHIFT_RIGHT8;
  131502. outlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;
  131503. temp = floor(temp) * SHIFT_RIGHT8;
  131504. outlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;
  131505. outlineColor.r = floor(temp);
  131506. // compressedAttribute0.w => color.a, outlineColor.a, pickColor.a
  131507. temp = compressedAttribute0.w * SHIFT_RIGHT8;
  131508. pickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;
  131509. pickColor = pickColor / 255.0;
  131510. temp = floor(temp) * SHIFT_RIGHT8;
  131511. outlineColor.a = (temp - floor(temp)) * SHIFT_LEFT8;
  131512. outlineColor /= 255.0;
  131513. color.a = floor(temp);
  131514. color /= 255.0;
  131515. ///////////////////////////////////////////////////////////////////////////
  131516. vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);
  131517. vec4 positionEC = czm_modelViewRelativeToEye * p;
  131518. ///////////////////////////////////////////////////////////////////////////
  131519. #if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE)
  131520. float lengthSq;
  131521. if (czm_sceneMode == czm_sceneMode2D)
  131522. {
  131523. // 2D camera distance is a special case
  131524. // treat all billboards as flattened to the z=0.0 plane
  131525. lengthSq = czm_eyeHeight2D.y;
  131526. }
  131527. else
  131528. {
  131529. lengthSq = dot(positionEC.xyz, positionEC.xyz);
  131530. }
  131531. #endif
  131532. #ifdef EYE_DISTANCE_SCALING
  131533. totalSize *= czm_nearFarScalar(scaleByDistance, lengthSq);
  131534. #endif
  131535. // Clamp to max point size.
  131536. totalSize = min(totalSize, u_maxTotalPointSize);
  131537. // If size is too small, push vertex behind near plane for clipping.
  131538. // Note that context.minimumAliasedPointSize "will be at most 1.0".
  131539. if (totalSize < 1.0)
  131540. {
  131541. positionEC.xyz = vec3(0.0);
  131542. totalSize = 1.0;
  131543. }
  131544. float translucency = 1.0;
  131545. #ifdef EYE_DISTANCE_TRANSLUCENCY
  131546. translucency = czm_nearFarScalar(translucencyByDistance, lengthSq);
  131547. // push vertex behind near plane for clipping
  131548. if (translucency < 0.004)
  131549. {
  131550. positionEC.xyz = vec3(0.0);
  131551. }
  131552. #endif
  131553. #ifdef DISTANCE_DISPLAY_CONDITION
  131554. float nearSq = distanceDisplayConditionAndDisableDepth.x;
  131555. float farSq = distanceDisplayConditionAndDisableDepth.y;
  131556. if (lengthSq < nearSq || lengthSq > farSq) {
  131557. // push vertex behind camera to force it to be clipped
  131558. positionEC.xyz = vec3(0.0, 0.0, 1.0);
  131559. }
  131560. #endif
  131561. gl_Position = czm_projection * positionEC;
  131562. czm_vertexLogDepth();
  131563. #ifdef DISABLE_DEPTH_DISTANCE
  131564. float disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z;
  131565. if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)
  131566. {
  131567. disableDepthTestDistance = czm_minimumDisableDepthTestDistance;
  131568. }
  131569. if (disableDepthTestDistance != 0.0)
  131570. {
  131571. // Don't try to "multiply both sides" by w. Greater/less-than comparisons won't work for negative values of w.
  131572. float zclip = gl_Position.z / gl_Position.w;
  131573. bool clipped = (zclip < -1.0 || zclip > 1.0);
  131574. if (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))
  131575. {
  131576. // Position z on the near plane.
  131577. gl_Position.z = -gl_Position.w;
  131578. #ifdef LOG_DEPTH
  131579. czm_vertexLogDepth(vec4(czm_currentFrustum.x));
  131580. #endif
  131581. }
  131582. }
  131583. #endif
  131584. v_color = color;
  131585. v_color.a *= translucency * show;
  131586. v_outlineColor = outlineColor;
  131587. v_outlineColor.a *= translucency * show;
  131588. v_innerPercent = 1.0 - outlinePercent;
  131589. v_pixelDistance = 2.0 / totalSize;
  131590. gl_PointSize = totalSize * show;
  131591. gl_Position *= show;
  131592. v_pickColor = pickColor;
  131593. }
  131594. `;
  131595. // node_modules/cesium/Source/Scene/PointPrimitiveCollection.js
  131596. var SHOW_INDEX6 = PointPrimitive_default.SHOW_INDEX;
  131597. var POSITION_INDEX6 = PointPrimitive_default.POSITION_INDEX;
  131598. var COLOR_INDEX4 = PointPrimitive_default.COLOR_INDEX;
  131599. var OUTLINE_COLOR_INDEX2 = PointPrimitive_default.OUTLINE_COLOR_INDEX;
  131600. var OUTLINE_WIDTH_INDEX2 = PointPrimitive_default.OUTLINE_WIDTH_INDEX;
  131601. var PIXEL_SIZE_INDEX2 = PointPrimitive_default.PIXEL_SIZE_INDEX;
  131602. var SCALE_BY_DISTANCE_INDEX4 = PointPrimitive_default.SCALE_BY_DISTANCE_INDEX;
  131603. var TRANSLUCENCY_BY_DISTANCE_INDEX4 = PointPrimitive_default.TRANSLUCENCY_BY_DISTANCE_INDEX;
  131604. var DISTANCE_DISPLAY_CONDITION_INDEX3 = PointPrimitive_default.DISTANCE_DISPLAY_CONDITION_INDEX;
  131605. var DISABLE_DEPTH_DISTANCE_INDEX2 = PointPrimitive_default.DISABLE_DEPTH_DISTANCE_INDEX;
  131606. var NUMBER_OF_PROPERTIES4 = PointPrimitive_default.NUMBER_OF_PROPERTIES;
  131607. var attributeLocations5 = {
  131608. positionHighAndSize: 0,
  131609. positionLowAndOutline: 1,
  131610. compressedAttribute0: 2,
  131611. compressedAttribute1: 3,
  131612. scaleByDistance: 4,
  131613. distanceDisplayConditionAndDisableDepth: 5
  131614. };
  131615. function PointPrimitiveCollection(options) {
  131616. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  131617. this._sp = void 0;
  131618. this._spTranslucent = void 0;
  131619. this._rsOpaque = void 0;
  131620. this._rsTranslucent = void 0;
  131621. this._vaf = void 0;
  131622. this._pointPrimitives = [];
  131623. this._pointPrimitivesToUpdate = [];
  131624. this._pointPrimitivesToUpdateIndex = 0;
  131625. this._pointPrimitivesRemoved = false;
  131626. this._createVertexArray = false;
  131627. this._shaderScaleByDistance = false;
  131628. this._compiledShaderScaleByDistance = false;
  131629. this._shaderTranslucencyByDistance = false;
  131630. this._compiledShaderTranslucencyByDistance = false;
  131631. this._shaderDistanceDisplayCondition = false;
  131632. this._compiledShaderDistanceDisplayCondition = false;
  131633. this._shaderDisableDepthDistance = false;
  131634. this._compiledShaderDisableDepthDistance = false;
  131635. this._propertiesChanged = new Uint32Array(NUMBER_OF_PROPERTIES4);
  131636. this._maxPixelSize = 1;
  131637. this._baseVolume = new BoundingSphere_default();
  131638. this._baseVolumeWC = new BoundingSphere_default();
  131639. this._baseVolume2D = new BoundingSphere_default();
  131640. this._boundingVolume = new BoundingSphere_default();
  131641. this._boundingVolumeDirty = false;
  131642. this._colorCommands = [];
  131643. this.show = defaultValue_default(options.show, true);
  131644. this.modelMatrix = Matrix4_default.clone(
  131645. defaultValue_default(options.modelMatrix, Matrix4_default.IDENTITY)
  131646. );
  131647. this._modelMatrix = Matrix4_default.clone(Matrix4_default.IDENTITY);
  131648. this.debugShowBoundingVolume = defaultValue_default(
  131649. options.debugShowBoundingVolume,
  131650. false
  131651. );
  131652. this.blendOption = defaultValue_default(
  131653. options.blendOption,
  131654. BlendOption_default.OPAQUE_AND_TRANSLUCENT
  131655. );
  131656. this._blendOption = void 0;
  131657. this._mode = SceneMode_default.SCENE3D;
  131658. this._maxTotalPointSize = 1;
  131659. this._buffersUsage = [
  131660. BufferUsage_default.STATIC_DRAW,
  131661. BufferUsage_default.STATIC_DRAW,
  131662. BufferUsage_default.STATIC_DRAW,
  131663. BufferUsage_default.STATIC_DRAW,
  131664. BufferUsage_default.STATIC_DRAW,
  131665. BufferUsage_default.STATIC_DRAW,
  131666. BufferUsage_default.STATIC_DRAW,
  131667. BufferUsage_default.STATIC_DRAW,
  131668. BufferUsage_default.STATIC_DRAW
  131669. ];
  131670. const that = this;
  131671. this._uniforms = {
  131672. u_maxTotalPointSize: function() {
  131673. return that._maxTotalPointSize;
  131674. }
  131675. };
  131676. }
  131677. Object.defineProperties(PointPrimitiveCollection.prototype, {
  131678. length: {
  131679. get: function() {
  131680. removePointPrimitives(this);
  131681. return this._pointPrimitives.length;
  131682. }
  131683. }
  131684. });
  131685. function destroyPointPrimitives(pointPrimitives) {
  131686. const length3 = pointPrimitives.length;
  131687. for (let i2 = 0; i2 < length3; ++i2) {
  131688. if (pointPrimitives[i2]) {
  131689. pointPrimitives[i2]._destroy();
  131690. }
  131691. }
  131692. }
  131693. PointPrimitiveCollection.prototype.add = function(options) {
  131694. const p2 = new PointPrimitive_default(options, this);
  131695. p2._index = this._pointPrimitives.length;
  131696. this._pointPrimitives.push(p2);
  131697. this._createVertexArray = true;
  131698. return p2;
  131699. };
  131700. PointPrimitiveCollection.prototype.remove = function(pointPrimitive) {
  131701. if (this.contains(pointPrimitive)) {
  131702. this._pointPrimitives[pointPrimitive._index] = null;
  131703. this._pointPrimitivesRemoved = true;
  131704. this._createVertexArray = true;
  131705. pointPrimitive._destroy();
  131706. return true;
  131707. }
  131708. return false;
  131709. };
  131710. PointPrimitiveCollection.prototype.removeAll = function() {
  131711. destroyPointPrimitives(this._pointPrimitives);
  131712. this._pointPrimitives = [];
  131713. this._pointPrimitivesToUpdate = [];
  131714. this._pointPrimitivesToUpdateIndex = 0;
  131715. this._pointPrimitivesRemoved = false;
  131716. this._createVertexArray = true;
  131717. };
  131718. function removePointPrimitives(pointPrimitiveCollection) {
  131719. if (pointPrimitiveCollection._pointPrimitivesRemoved) {
  131720. pointPrimitiveCollection._pointPrimitivesRemoved = false;
  131721. const newPointPrimitives = [];
  131722. const pointPrimitives = pointPrimitiveCollection._pointPrimitives;
  131723. const length3 = pointPrimitives.length;
  131724. for (let i2 = 0, j = 0; i2 < length3; ++i2) {
  131725. const pointPrimitive = pointPrimitives[i2];
  131726. if (pointPrimitive) {
  131727. pointPrimitive._index = j++;
  131728. newPointPrimitives.push(pointPrimitive);
  131729. }
  131730. }
  131731. pointPrimitiveCollection._pointPrimitives = newPointPrimitives;
  131732. }
  131733. }
  131734. PointPrimitiveCollection.prototype._updatePointPrimitive = function(pointPrimitive, propertyChanged) {
  131735. if (!pointPrimitive._dirty) {
  131736. this._pointPrimitivesToUpdate[this._pointPrimitivesToUpdateIndex++] = pointPrimitive;
  131737. }
  131738. ++this._propertiesChanged[propertyChanged];
  131739. };
  131740. PointPrimitiveCollection.prototype.contains = function(pointPrimitive) {
  131741. return defined_default(pointPrimitive) && pointPrimitive._pointPrimitiveCollection === this;
  131742. };
  131743. PointPrimitiveCollection.prototype.get = function(index2) {
  131744. if (!defined_default(index2)) {
  131745. throw new DeveloperError_default("index is required.");
  131746. }
  131747. removePointPrimitives(this);
  131748. return this._pointPrimitives[index2];
  131749. };
  131750. PointPrimitiveCollection.prototype.computeNewBuffersUsage = function() {
  131751. const buffersUsage = this._buffersUsage;
  131752. let usageChanged = false;
  131753. const properties = this._propertiesChanged;
  131754. for (let k = 0; k < NUMBER_OF_PROPERTIES4; ++k) {
  131755. const newUsage = properties[k] === 0 ? BufferUsage_default.STATIC_DRAW : BufferUsage_default.STREAM_DRAW;
  131756. usageChanged = usageChanged || buffersUsage[k] !== newUsage;
  131757. buffersUsage[k] = newUsage;
  131758. }
  131759. return usageChanged;
  131760. };
  131761. function createVAF2(context, numberOfPointPrimitives, buffersUsage) {
  131762. return new VertexArrayFacade_default(
  131763. context,
  131764. [
  131765. {
  131766. index: attributeLocations5.positionHighAndSize,
  131767. componentsPerAttribute: 4,
  131768. componentDatatype: ComponentDatatype_default.FLOAT,
  131769. usage: buffersUsage[POSITION_INDEX6]
  131770. },
  131771. {
  131772. index: attributeLocations5.positionLowAndShow,
  131773. componentsPerAttribute: 4,
  131774. componentDatatype: ComponentDatatype_default.FLOAT,
  131775. usage: buffersUsage[POSITION_INDEX6]
  131776. },
  131777. {
  131778. index: attributeLocations5.compressedAttribute0,
  131779. componentsPerAttribute: 4,
  131780. componentDatatype: ComponentDatatype_default.FLOAT,
  131781. usage: buffersUsage[COLOR_INDEX4]
  131782. },
  131783. {
  131784. index: attributeLocations5.compressedAttribute1,
  131785. componentsPerAttribute: 4,
  131786. componentDatatype: ComponentDatatype_default.FLOAT,
  131787. usage: buffersUsage[TRANSLUCENCY_BY_DISTANCE_INDEX4]
  131788. },
  131789. {
  131790. index: attributeLocations5.scaleByDistance,
  131791. componentsPerAttribute: 4,
  131792. componentDatatype: ComponentDatatype_default.FLOAT,
  131793. usage: buffersUsage[SCALE_BY_DISTANCE_INDEX4]
  131794. },
  131795. {
  131796. index: attributeLocations5.distanceDisplayConditionAndDisableDepth,
  131797. componentsPerAttribute: 3,
  131798. componentDatatype: ComponentDatatype_default.FLOAT,
  131799. usage: buffersUsage[DISTANCE_DISPLAY_CONDITION_INDEX3]
  131800. }
  131801. ],
  131802. numberOfPointPrimitives
  131803. );
  131804. }
  131805. var writePositionScratch2 = new EncodedCartesian3_default();
  131806. function writePositionSizeAndOutline(pointPrimitiveCollection, context, vafWriters, pointPrimitive) {
  131807. const i2 = pointPrimitive._index;
  131808. const position = pointPrimitive._getActualPosition();
  131809. if (pointPrimitiveCollection._mode === SceneMode_default.SCENE3D) {
  131810. BoundingSphere_default.expand(
  131811. pointPrimitiveCollection._baseVolume,
  131812. position,
  131813. pointPrimitiveCollection._baseVolume
  131814. );
  131815. pointPrimitiveCollection._boundingVolumeDirty = true;
  131816. }
  131817. EncodedCartesian3_default.fromCartesian(position, writePositionScratch2);
  131818. const pixelSize = pointPrimitive.pixelSize;
  131819. const outlineWidth = pointPrimitive.outlineWidth;
  131820. pointPrimitiveCollection._maxPixelSize = Math.max(
  131821. pointPrimitiveCollection._maxPixelSize,
  131822. pixelSize + outlineWidth
  131823. );
  131824. const positionHighWriter = vafWriters[attributeLocations5.positionHighAndSize];
  131825. const high = writePositionScratch2.high;
  131826. positionHighWriter(i2, high.x, high.y, high.z, pixelSize);
  131827. const positionLowWriter = vafWriters[attributeLocations5.positionLowAndOutline];
  131828. const low = writePositionScratch2.low;
  131829. positionLowWriter(i2, low.x, low.y, low.z, outlineWidth);
  131830. }
  131831. var LEFT_SHIFT162 = 65536;
  131832. var LEFT_SHIFT82 = 256;
  131833. function writeCompressedAttrib02(pointPrimitiveCollection, context, vafWriters, pointPrimitive) {
  131834. const i2 = pointPrimitive._index;
  131835. const color = pointPrimitive.color;
  131836. const pickColor = pointPrimitive.getPickId(context).color;
  131837. const outlineColor = pointPrimitive.outlineColor;
  131838. let red = Color_default.floatToByte(color.red);
  131839. let green = Color_default.floatToByte(color.green);
  131840. let blue = Color_default.floatToByte(color.blue);
  131841. const compressed0 = red * LEFT_SHIFT162 + green * LEFT_SHIFT82 + blue;
  131842. red = Color_default.floatToByte(outlineColor.red);
  131843. green = Color_default.floatToByte(outlineColor.green);
  131844. blue = Color_default.floatToByte(outlineColor.blue);
  131845. const compressed1 = red * LEFT_SHIFT162 + green * LEFT_SHIFT82 + blue;
  131846. red = Color_default.floatToByte(pickColor.red);
  131847. green = Color_default.floatToByte(pickColor.green);
  131848. blue = Color_default.floatToByte(pickColor.blue);
  131849. const compressed2 = red * LEFT_SHIFT162 + green * LEFT_SHIFT82 + blue;
  131850. const compressed3 = Color_default.floatToByte(color.alpha) * LEFT_SHIFT162 + Color_default.floatToByte(outlineColor.alpha) * LEFT_SHIFT82 + Color_default.floatToByte(pickColor.alpha);
  131851. const writer = vafWriters[attributeLocations5.compressedAttribute0];
  131852. writer(i2, compressed0, compressed1, compressed2, compressed3);
  131853. }
  131854. function writeCompressedAttrib12(pointPrimitiveCollection, context, vafWriters, pointPrimitive) {
  131855. const i2 = pointPrimitive._index;
  131856. let near = 0;
  131857. let nearValue = 1;
  131858. let far = 1;
  131859. let farValue = 1;
  131860. const translucency = pointPrimitive.translucencyByDistance;
  131861. if (defined_default(translucency)) {
  131862. near = translucency.near;
  131863. nearValue = translucency.nearValue;
  131864. far = translucency.far;
  131865. farValue = translucency.farValue;
  131866. if (nearValue !== 1 || farValue !== 1) {
  131867. pointPrimitiveCollection._shaderTranslucencyByDistance = true;
  131868. }
  131869. }
  131870. let show = pointPrimitive.show && pointPrimitive.clusterShow;
  131871. if (pointPrimitive.color.alpha === 0 && pointPrimitive.outlineColor.alpha === 0) {
  131872. show = false;
  131873. }
  131874. nearValue = Math_default.clamp(nearValue, 0, 1);
  131875. nearValue = nearValue === 1 ? 255 : nearValue * 255 | 0;
  131876. const compressed0 = (show ? 1 : 0) * LEFT_SHIFT82 + nearValue;
  131877. farValue = Math_default.clamp(farValue, 0, 1);
  131878. farValue = farValue === 1 ? 255 : farValue * 255 | 0;
  131879. const compressed1 = farValue;
  131880. const writer = vafWriters[attributeLocations5.compressedAttribute1];
  131881. writer(i2, compressed0, compressed1, near, far);
  131882. }
  131883. function writeScaleByDistance2(pointPrimitiveCollection, context, vafWriters, pointPrimitive) {
  131884. const i2 = pointPrimitive._index;
  131885. const writer = vafWriters[attributeLocations5.scaleByDistance];
  131886. let near = 0;
  131887. let nearValue = 1;
  131888. let far = 1;
  131889. let farValue = 1;
  131890. const scale = pointPrimitive.scaleByDistance;
  131891. if (defined_default(scale)) {
  131892. near = scale.near;
  131893. nearValue = scale.nearValue;
  131894. far = scale.far;
  131895. farValue = scale.farValue;
  131896. if (nearValue !== 1 || farValue !== 1) {
  131897. pointPrimitiveCollection._shaderScaleByDistance = true;
  131898. }
  131899. }
  131900. writer(i2, near, nearValue, far, farValue);
  131901. }
  131902. function writeDistanceDisplayConditionAndDepthDisable(pointPrimitiveCollection, context, vafWriters, pointPrimitive) {
  131903. const i2 = pointPrimitive._index;
  131904. const writer = vafWriters[attributeLocations5.distanceDisplayConditionAndDisableDepth];
  131905. let near = 0;
  131906. let far = Number.MAX_VALUE;
  131907. const distanceDisplayCondition = pointPrimitive.distanceDisplayCondition;
  131908. if (defined_default(distanceDisplayCondition)) {
  131909. near = distanceDisplayCondition.near;
  131910. far = distanceDisplayCondition.far;
  131911. near *= near;
  131912. far *= far;
  131913. pointPrimitiveCollection._shaderDistanceDisplayCondition = true;
  131914. }
  131915. let disableDepthTestDistance = pointPrimitive.disableDepthTestDistance;
  131916. disableDepthTestDistance *= disableDepthTestDistance;
  131917. if (disableDepthTestDistance > 0) {
  131918. pointPrimitiveCollection._shaderDisableDepthDistance = true;
  131919. if (disableDepthTestDistance === Number.POSITIVE_INFINITY) {
  131920. disableDepthTestDistance = -1;
  131921. }
  131922. }
  131923. writer(i2, near, far, disableDepthTestDistance);
  131924. }
  131925. function writePointPrimitive(pointPrimitiveCollection, context, vafWriters, pointPrimitive) {
  131926. writePositionSizeAndOutline(
  131927. pointPrimitiveCollection,
  131928. context,
  131929. vafWriters,
  131930. pointPrimitive
  131931. );
  131932. writeCompressedAttrib02(
  131933. pointPrimitiveCollection,
  131934. context,
  131935. vafWriters,
  131936. pointPrimitive
  131937. );
  131938. writeCompressedAttrib12(
  131939. pointPrimitiveCollection,
  131940. context,
  131941. vafWriters,
  131942. pointPrimitive
  131943. );
  131944. writeScaleByDistance2(
  131945. pointPrimitiveCollection,
  131946. context,
  131947. vafWriters,
  131948. pointPrimitive
  131949. );
  131950. writeDistanceDisplayConditionAndDepthDisable(
  131951. pointPrimitiveCollection,
  131952. context,
  131953. vafWriters,
  131954. pointPrimitive
  131955. );
  131956. }
  131957. function recomputeActualPositions2(pointPrimitiveCollection, pointPrimitives, length3, frameState, modelMatrix, recomputeBoundingVolume) {
  131958. let boundingVolume;
  131959. if (frameState.mode === SceneMode_default.SCENE3D) {
  131960. boundingVolume = pointPrimitiveCollection._baseVolume;
  131961. pointPrimitiveCollection._boundingVolumeDirty = true;
  131962. } else {
  131963. boundingVolume = pointPrimitiveCollection._baseVolume2D;
  131964. }
  131965. const positions = [];
  131966. for (let i2 = 0; i2 < length3; ++i2) {
  131967. const pointPrimitive = pointPrimitives[i2];
  131968. const position = pointPrimitive.position;
  131969. const actualPosition = PointPrimitive_default._computeActualPosition(
  131970. position,
  131971. frameState,
  131972. modelMatrix
  131973. );
  131974. if (defined_default(actualPosition)) {
  131975. pointPrimitive._setActualPosition(actualPosition);
  131976. if (recomputeBoundingVolume) {
  131977. positions.push(actualPosition);
  131978. } else {
  131979. BoundingSphere_default.expand(boundingVolume, actualPosition, boundingVolume);
  131980. }
  131981. }
  131982. }
  131983. if (recomputeBoundingVolume) {
  131984. BoundingSphere_default.fromPoints(positions, boundingVolume);
  131985. }
  131986. }
  131987. function updateMode3(pointPrimitiveCollection, frameState) {
  131988. const mode2 = frameState.mode;
  131989. const pointPrimitives = pointPrimitiveCollection._pointPrimitives;
  131990. const pointPrimitivesToUpdate = pointPrimitiveCollection._pointPrimitivesToUpdate;
  131991. const modelMatrix = pointPrimitiveCollection._modelMatrix;
  131992. if (pointPrimitiveCollection._createVertexArray || pointPrimitiveCollection._mode !== mode2 || mode2 !== SceneMode_default.SCENE3D && !Matrix4_default.equals(modelMatrix, pointPrimitiveCollection.modelMatrix)) {
  131993. pointPrimitiveCollection._mode = mode2;
  131994. Matrix4_default.clone(pointPrimitiveCollection.modelMatrix, modelMatrix);
  131995. pointPrimitiveCollection._createVertexArray = true;
  131996. if (mode2 === SceneMode_default.SCENE3D || mode2 === SceneMode_default.SCENE2D || mode2 === SceneMode_default.COLUMBUS_VIEW) {
  131997. recomputeActualPositions2(
  131998. pointPrimitiveCollection,
  131999. pointPrimitives,
  132000. pointPrimitives.length,
  132001. frameState,
  132002. modelMatrix,
  132003. true
  132004. );
  132005. }
  132006. } else if (mode2 === SceneMode_default.MORPHING) {
  132007. recomputeActualPositions2(
  132008. pointPrimitiveCollection,
  132009. pointPrimitives,
  132010. pointPrimitives.length,
  132011. frameState,
  132012. modelMatrix,
  132013. true
  132014. );
  132015. } else if (mode2 === SceneMode_default.SCENE2D || mode2 === SceneMode_default.COLUMBUS_VIEW) {
  132016. recomputeActualPositions2(
  132017. pointPrimitiveCollection,
  132018. pointPrimitivesToUpdate,
  132019. pointPrimitiveCollection._pointPrimitivesToUpdateIndex,
  132020. frameState,
  132021. modelMatrix,
  132022. false
  132023. );
  132024. }
  132025. }
  132026. function updateBoundingVolume2(collection, frameState, boundingVolume) {
  132027. const pixelSize = frameState.camera.getPixelSize(
  132028. boundingVolume,
  132029. frameState.context.drawingBufferWidth,
  132030. frameState.context.drawingBufferHeight
  132031. );
  132032. const size = pixelSize * collection._maxPixelSize;
  132033. boundingVolume.radius += size;
  132034. }
  132035. var scratchWriterArray2 = [];
  132036. PointPrimitiveCollection.prototype.update = function(frameState) {
  132037. removePointPrimitives(this);
  132038. if (!this.show) {
  132039. return;
  132040. }
  132041. this._maxTotalPointSize = ContextLimits_default.maximumAliasedPointSize;
  132042. updateMode3(this, frameState);
  132043. const pointPrimitives = this._pointPrimitives;
  132044. const pointPrimitivesLength = pointPrimitives.length;
  132045. const pointPrimitivesToUpdate = this._pointPrimitivesToUpdate;
  132046. const pointPrimitivesToUpdateLength = this._pointPrimitivesToUpdateIndex;
  132047. const properties = this._propertiesChanged;
  132048. const createVertexArray8 = this._createVertexArray;
  132049. let vafWriters;
  132050. const context = frameState.context;
  132051. const pass = frameState.passes;
  132052. const picking = pass.pick;
  132053. if (createVertexArray8 || !picking && this.computeNewBuffersUsage()) {
  132054. this._createVertexArray = false;
  132055. for (let k = 0; k < NUMBER_OF_PROPERTIES4; ++k) {
  132056. properties[k] = 0;
  132057. }
  132058. this._vaf = this._vaf && this._vaf.destroy();
  132059. if (pointPrimitivesLength > 0) {
  132060. this._vaf = createVAF2(context, pointPrimitivesLength, this._buffersUsage);
  132061. vafWriters = this._vaf.writers;
  132062. for (let i2 = 0; i2 < pointPrimitivesLength; ++i2) {
  132063. const pointPrimitive = this._pointPrimitives[i2];
  132064. pointPrimitive._dirty = false;
  132065. writePointPrimitive(this, context, vafWriters, pointPrimitive);
  132066. }
  132067. this._vaf.commit();
  132068. }
  132069. this._pointPrimitivesToUpdateIndex = 0;
  132070. } else if (pointPrimitivesToUpdateLength > 0) {
  132071. const writers = scratchWriterArray2;
  132072. writers.length = 0;
  132073. if (properties[POSITION_INDEX6] || properties[OUTLINE_WIDTH_INDEX2] || properties[PIXEL_SIZE_INDEX2]) {
  132074. writers.push(writePositionSizeAndOutline);
  132075. }
  132076. if (properties[COLOR_INDEX4] || properties[OUTLINE_COLOR_INDEX2]) {
  132077. writers.push(writeCompressedAttrib02);
  132078. }
  132079. if (properties[SHOW_INDEX6] || properties[TRANSLUCENCY_BY_DISTANCE_INDEX4]) {
  132080. writers.push(writeCompressedAttrib12);
  132081. }
  132082. if (properties[SCALE_BY_DISTANCE_INDEX4]) {
  132083. writers.push(writeScaleByDistance2);
  132084. }
  132085. if (properties[DISTANCE_DISPLAY_CONDITION_INDEX3] || properties[DISABLE_DEPTH_DISTANCE_INDEX2]) {
  132086. writers.push(writeDistanceDisplayConditionAndDepthDisable);
  132087. }
  132088. const numWriters = writers.length;
  132089. vafWriters = this._vaf.writers;
  132090. if (pointPrimitivesToUpdateLength / pointPrimitivesLength > 0.1) {
  132091. for (let m = 0; m < pointPrimitivesToUpdateLength; ++m) {
  132092. const b = pointPrimitivesToUpdate[m];
  132093. b._dirty = false;
  132094. for (let n2 = 0; n2 < numWriters; ++n2) {
  132095. writers[n2](this, context, vafWriters, b);
  132096. }
  132097. }
  132098. this._vaf.commit();
  132099. } else {
  132100. for (let h = 0; h < pointPrimitivesToUpdateLength; ++h) {
  132101. const bb = pointPrimitivesToUpdate[h];
  132102. bb._dirty = false;
  132103. for (let o2 = 0; o2 < numWriters; ++o2) {
  132104. writers[o2](this, context, vafWriters, bb);
  132105. }
  132106. this._vaf.subCommit(bb._index, 1);
  132107. }
  132108. this._vaf.endSubCommits();
  132109. }
  132110. this._pointPrimitivesToUpdateIndex = 0;
  132111. }
  132112. if (pointPrimitivesToUpdateLength > pointPrimitivesLength * 1.5) {
  132113. pointPrimitivesToUpdate.length = pointPrimitivesLength;
  132114. }
  132115. if (!defined_default(this._vaf) || !defined_default(this._vaf.va)) {
  132116. return;
  132117. }
  132118. if (this._boundingVolumeDirty) {
  132119. this._boundingVolumeDirty = false;
  132120. BoundingSphere_default.transform(
  132121. this._baseVolume,
  132122. this.modelMatrix,
  132123. this._baseVolumeWC
  132124. );
  132125. }
  132126. let boundingVolume;
  132127. let modelMatrix = Matrix4_default.IDENTITY;
  132128. if (frameState.mode === SceneMode_default.SCENE3D) {
  132129. modelMatrix = this.modelMatrix;
  132130. boundingVolume = BoundingSphere_default.clone(
  132131. this._baseVolumeWC,
  132132. this._boundingVolume
  132133. );
  132134. } else {
  132135. boundingVolume = BoundingSphere_default.clone(
  132136. this._baseVolume2D,
  132137. this._boundingVolume
  132138. );
  132139. }
  132140. updateBoundingVolume2(this, frameState, boundingVolume);
  132141. const blendOptionChanged = this._blendOption !== this.blendOption;
  132142. this._blendOption = this.blendOption;
  132143. if (blendOptionChanged) {
  132144. if (this._blendOption === BlendOption_default.OPAQUE || this._blendOption === BlendOption_default.OPAQUE_AND_TRANSLUCENT) {
  132145. this._rsOpaque = RenderState_default.fromCache({
  132146. depthTest: {
  132147. enabled: true,
  132148. func: WebGLConstants_default.LEQUAL
  132149. },
  132150. depthMask: true
  132151. });
  132152. } else {
  132153. this._rsOpaque = void 0;
  132154. }
  132155. if (this._blendOption === BlendOption_default.TRANSLUCENT || this._blendOption === BlendOption_default.OPAQUE_AND_TRANSLUCENT) {
  132156. this._rsTranslucent = RenderState_default.fromCache({
  132157. depthTest: {
  132158. enabled: true,
  132159. func: WebGLConstants_default.LEQUAL
  132160. },
  132161. depthMask: false,
  132162. blending: BlendingState_default.ALPHA_BLEND
  132163. });
  132164. } else {
  132165. this._rsTranslucent = void 0;
  132166. }
  132167. }
  132168. this._shaderDisableDepthDistance = this._shaderDisableDepthDistance || frameState.minimumDisableDepthTestDistance !== 0;
  132169. let vs;
  132170. let fs;
  132171. if (blendOptionChanged || this._shaderScaleByDistance && !this._compiledShaderScaleByDistance || this._shaderTranslucencyByDistance && !this._compiledShaderTranslucencyByDistance || this._shaderDistanceDisplayCondition && !this._compiledShaderDistanceDisplayCondition || this._shaderDisableDepthDistance !== this._compiledShaderDisableDepthDistance) {
  132172. vs = new ShaderSource_default({
  132173. sources: [PointPrimitiveCollectionVS_default]
  132174. });
  132175. if (this._shaderScaleByDistance) {
  132176. vs.defines.push("EYE_DISTANCE_SCALING");
  132177. }
  132178. if (this._shaderTranslucencyByDistance) {
  132179. vs.defines.push("EYE_DISTANCE_TRANSLUCENCY");
  132180. }
  132181. if (this._shaderDistanceDisplayCondition) {
  132182. vs.defines.push("DISTANCE_DISPLAY_CONDITION");
  132183. }
  132184. if (this._shaderDisableDepthDistance) {
  132185. vs.defines.push("DISABLE_DEPTH_DISTANCE");
  132186. }
  132187. if (this._blendOption === BlendOption_default.OPAQUE_AND_TRANSLUCENT) {
  132188. fs = new ShaderSource_default({
  132189. defines: ["OPAQUE"],
  132190. sources: [PointPrimitiveCollectionFS_default]
  132191. });
  132192. this._sp = ShaderProgram_default.replaceCache({
  132193. context,
  132194. shaderProgram: this._sp,
  132195. vertexShaderSource: vs,
  132196. fragmentShaderSource: fs,
  132197. attributeLocations: attributeLocations5
  132198. });
  132199. fs = new ShaderSource_default({
  132200. defines: ["TRANSLUCENT"],
  132201. sources: [PointPrimitiveCollectionFS_default]
  132202. });
  132203. this._spTranslucent = ShaderProgram_default.replaceCache({
  132204. context,
  132205. shaderProgram: this._spTranslucent,
  132206. vertexShaderSource: vs,
  132207. fragmentShaderSource: fs,
  132208. attributeLocations: attributeLocations5
  132209. });
  132210. }
  132211. if (this._blendOption === BlendOption_default.OPAQUE) {
  132212. fs = new ShaderSource_default({
  132213. sources: [PointPrimitiveCollectionFS_default]
  132214. });
  132215. this._sp = ShaderProgram_default.replaceCache({
  132216. context,
  132217. shaderProgram: this._sp,
  132218. vertexShaderSource: vs,
  132219. fragmentShaderSource: fs,
  132220. attributeLocations: attributeLocations5
  132221. });
  132222. }
  132223. if (this._blendOption === BlendOption_default.TRANSLUCENT) {
  132224. fs = new ShaderSource_default({
  132225. sources: [PointPrimitiveCollectionFS_default]
  132226. });
  132227. this._spTranslucent = ShaderProgram_default.replaceCache({
  132228. context,
  132229. shaderProgram: this._spTranslucent,
  132230. vertexShaderSource: vs,
  132231. fragmentShaderSource: fs,
  132232. attributeLocations: attributeLocations5
  132233. });
  132234. }
  132235. this._compiledShaderScaleByDistance = this._shaderScaleByDistance;
  132236. this._compiledShaderTranslucencyByDistance = this._shaderTranslucencyByDistance;
  132237. this._compiledShaderDistanceDisplayCondition = this._shaderDistanceDisplayCondition;
  132238. this._compiledShaderDisableDepthDistance = this._shaderDisableDepthDistance;
  132239. }
  132240. let va;
  132241. let vaLength;
  132242. let command;
  132243. let j;
  132244. const commandList = frameState.commandList;
  132245. if (pass.render || picking) {
  132246. const colorList = this._colorCommands;
  132247. const opaque = this._blendOption === BlendOption_default.OPAQUE;
  132248. const opaqueAndTranslucent = this._blendOption === BlendOption_default.OPAQUE_AND_TRANSLUCENT;
  132249. va = this._vaf.va;
  132250. vaLength = va.length;
  132251. colorList.length = vaLength;
  132252. const totalLength = opaqueAndTranslucent ? vaLength * 2 : vaLength;
  132253. for (j = 0; j < totalLength; ++j) {
  132254. const opaqueCommand = opaque || opaqueAndTranslucent && j % 2 === 0;
  132255. command = colorList[j];
  132256. if (!defined_default(command)) {
  132257. command = colorList[j] = new DrawCommand_default();
  132258. }
  132259. command.primitiveType = PrimitiveType_default.POINTS;
  132260. command.pass = opaqueCommand || !opaqueAndTranslucent ? Pass_default.OPAQUE : Pass_default.TRANSLUCENT;
  132261. command.owner = this;
  132262. const index2 = opaqueAndTranslucent ? Math.floor(j / 2) : j;
  132263. command.boundingVolume = boundingVolume;
  132264. command.modelMatrix = modelMatrix;
  132265. command.shaderProgram = opaqueCommand ? this._sp : this._spTranslucent;
  132266. command.uniformMap = this._uniforms;
  132267. command.vertexArray = va[index2].va;
  132268. command.renderState = opaqueCommand ? this._rsOpaque : this._rsTranslucent;
  132269. command.debugShowBoundingVolume = this.debugShowBoundingVolume;
  132270. command.pickId = "v_pickColor";
  132271. commandList.push(command);
  132272. }
  132273. }
  132274. };
  132275. PointPrimitiveCollection.prototype.isDestroyed = function() {
  132276. return false;
  132277. };
  132278. PointPrimitiveCollection.prototype.destroy = function() {
  132279. this._sp = this._sp && this._sp.destroy();
  132280. this._spTranslucent = this._spTranslucent && this._spTranslucent.destroy();
  132281. this._spPick = this._spPick && this._spPick.destroy();
  132282. this._vaf = this._vaf && this._vaf.destroy();
  132283. destroyPointPrimitives(this._pointPrimitives);
  132284. return destroyObject_default(this);
  132285. };
  132286. var PointPrimitiveCollection_default = PointPrimitiveCollection;
  132287. // node_modules/cesium/Source/ThirdParty/kdbush.js
  132288. function sortKD(ids, coords, nodeSize, left, right, depth) {
  132289. if (right - left <= nodeSize)
  132290. return;
  132291. const m = left + right >> 1;
  132292. select(ids, coords, m, left, right, depth % 2);
  132293. sortKD(ids, coords, nodeSize, left, m - 1, depth + 1);
  132294. sortKD(ids, coords, nodeSize, m + 1, right, depth + 1);
  132295. }
  132296. function select(ids, coords, k, left, right, inc) {
  132297. while (right > left) {
  132298. if (right - left > 600) {
  132299. const n2 = right - left + 1;
  132300. const m = k - left + 1;
  132301. const z = Math.log(n2);
  132302. const s2 = 0.5 * Math.exp(2 * z / 3);
  132303. const sd = 0.5 * Math.sqrt(z * s2 * (n2 - s2) / n2) * (m - n2 / 2 < 0 ? -1 : 1);
  132304. const newLeft = Math.max(left, Math.floor(k - m * s2 / n2 + sd));
  132305. const newRight = Math.min(right, Math.floor(k + (n2 - m) * s2 / n2 + sd));
  132306. select(ids, coords, k, newLeft, newRight, inc);
  132307. }
  132308. const t = coords[2 * k + inc];
  132309. let i2 = left;
  132310. let j = right;
  132311. swapItem(ids, coords, left, k);
  132312. if (coords[2 * right + inc] > t)
  132313. swapItem(ids, coords, left, right);
  132314. while (i2 < j) {
  132315. swapItem(ids, coords, i2, j);
  132316. i2++;
  132317. j--;
  132318. while (coords[2 * i2 + inc] < t)
  132319. i2++;
  132320. while (coords[2 * j + inc] > t)
  132321. j--;
  132322. }
  132323. if (coords[2 * left + inc] === t)
  132324. swapItem(ids, coords, left, j);
  132325. else {
  132326. j++;
  132327. swapItem(ids, coords, j, right);
  132328. }
  132329. if (j <= k)
  132330. left = j + 1;
  132331. if (k <= j)
  132332. right = j - 1;
  132333. }
  132334. }
  132335. function swapItem(ids, coords, i2, j) {
  132336. swap4(ids, i2, j);
  132337. swap4(coords, 2 * i2, 2 * j);
  132338. swap4(coords, 2 * i2 + 1, 2 * j + 1);
  132339. }
  132340. function swap4(arr, i2, j) {
  132341. const tmp2 = arr[i2];
  132342. arr[i2] = arr[j];
  132343. arr[j] = tmp2;
  132344. }
  132345. function range(ids, coords, minX, minY, maxX, maxY, nodeSize) {
  132346. const stack = [0, ids.length - 1, 0];
  132347. const result = [];
  132348. let x, y;
  132349. while (stack.length) {
  132350. const axis = stack.pop();
  132351. const right = stack.pop();
  132352. const left = stack.pop();
  132353. if (right - left <= nodeSize) {
  132354. for (let i2 = left; i2 <= right; i2++) {
  132355. x = coords[2 * i2];
  132356. y = coords[2 * i2 + 1];
  132357. if (x >= minX && x <= maxX && y >= minY && y <= maxY)
  132358. result.push(ids[i2]);
  132359. }
  132360. continue;
  132361. }
  132362. const m = Math.floor((left + right) / 2);
  132363. x = coords[2 * m];
  132364. y = coords[2 * m + 1];
  132365. if (x >= minX && x <= maxX && y >= minY && y <= maxY)
  132366. result.push(ids[m]);
  132367. const nextAxis = (axis + 1) % 2;
  132368. if (axis === 0 ? minX <= x : minY <= y) {
  132369. stack.push(left);
  132370. stack.push(m - 1);
  132371. stack.push(nextAxis);
  132372. }
  132373. if (axis === 0 ? maxX >= x : maxY >= y) {
  132374. stack.push(m + 1);
  132375. stack.push(right);
  132376. stack.push(nextAxis);
  132377. }
  132378. }
  132379. return result;
  132380. }
  132381. function within(ids, coords, qx, qy, r2, nodeSize) {
  132382. const stack = [0, ids.length - 1, 0];
  132383. const result = [];
  132384. const r22 = r2 * r2;
  132385. while (stack.length) {
  132386. const axis = stack.pop();
  132387. const right = stack.pop();
  132388. const left = stack.pop();
  132389. if (right - left <= nodeSize) {
  132390. for (let i2 = left; i2 <= right; i2++) {
  132391. if (sqDist(coords[2 * i2], coords[2 * i2 + 1], qx, qy) <= r22)
  132392. result.push(ids[i2]);
  132393. }
  132394. continue;
  132395. }
  132396. const m = Math.floor((left + right) / 2);
  132397. const x = coords[2 * m];
  132398. const y = coords[2 * m + 1];
  132399. if (sqDist(x, y, qx, qy) <= r22)
  132400. result.push(ids[m]);
  132401. const nextAxis = (axis + 1) % 2;
  132402. if (axis === 0 ? qx - r2 <= x : qy - r2 <= y) {
  132403. stack.push(left);
  132404. stack.push(m - 1);
  132405. stack.push(nextAxis);
  132406. }
  132407. if (axis === 0 ? qx + r2 >= x : qy + r2 >= y) {
  132408. stack.push(m + 1);
  132409. stack.push(right);
  132410. stack.push(nextAxis);
  132411. }
  132412. }
  132413. return result;
  132414. }
  132415. function sqDist(ax, ay, bx, by) {
  132416. const dx = ax - bx;
  132417. const dy = ay - by;
  132418. return dx * dx + dy * dy;
  132419. }
  132420. var defaultGetX = (p2) => p2[0];
  132421. var defaultGetY = (p2) => p2[1];
  132422. var KDBush = class {
  132423. constructor(points, getX2 = defaultGetX, getY2 = defaultGetY, nodeSize = 64, ArrayType = Float64Array) {
  132424. this.nodeSize = nodeSize;
  132425. this.points = points;
  132426. const IndexArrayType = points.length < 65536 ? Uint16Array : Uint32Array;
  132427. const ids = this.ids = new IndexArrayType(points.length);
  132428. const coords = this.coords = new ArrayType(points.length * 2);
  132429. for (let i2 = 0; i2 < points.length; i2++) {
  132430. ids[i2] = i2;
  132431. coords[2 * i2] = getX2(points[i2]);
  132432. coords[2 * i2 + 1] = getY2(points[i2]);
  132433. }
  132434. sortKD(ids, coords, nodeSize, 0, ids.length - 1, 0);
  132435. }
  132436. range(minX, minY, maxX, maxY) {
  132437. return range(this.ids, this.coords, minX, minY, maxX, maxY, this.nodeSize);
  132438. }
  132439. within(x, y, r2) {
  132440. return within(this.ids, this.coords, x, y, r2, this.nodeSize);
  132441. }
  132442. };
  132443. // node_modules/cesium/Source/DataSources/EntityCluster.js
  132444. function EntityCluster(options) {
  132445. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  132446. this._enabled = defaultValue_default(options.enabled, false);
  132447. this._pixelRange = defaultValue_default(options.pixelRange, 80);
  132448. this._minimumClusterSize = defaultValue_default(options.minimumClusterSize, 2);
  132449. this._clusterBillboards = defaultValue_default(options.clusterBillboards, true);
  132450. this._clusterLabels = defaultValue_default(options.clusterLabels, true);
  132451. this._clusterPoints = defaultValue_default(options.clusterPoints, true);
  132452. this._labelCollection = void 0;
  132453. this._billboardCollection = void 0;
  132454. this._pointCollection = void 0;
  132455. this._clusterBillboardCollection = void 0;
  132456. this._clusterLabelCollection = void 0;
  132457. this._clusterPointCollection = void 0;
  132458. this._collectionIndicesByEntity = {};
  132459. this._unusedLabelIndices = [];
  132460. this._unusedBillboardIndices = [];
  132461. this._unusedPointIndices = [];
  132462. this._previousClusters = [];
  132463. this._previousHeight = void 0;
  132464. this._enabledDirty = false;
  132465. this._clusterDirty = false;
  132466. this._cluster = void 0;
  132467. this._removeEventListener = void 0;
  132468. this._clusterEvent = new Event_default();
  132469. this.show = defaultValue_default(options.show, true);
  132470. }
  132471. function getX(point) {
  132472. return point.coord.x;
  132473. }
  132474. function getY(point) {
  132475. return point.coord.y;
  132476. }
  132477. function expandBoundingBox(bbox2, pixelRange) {
  132478. bbox2.x -= pixelRange;
  132479. bbox2.y -= pixelRange;
  132480. bbox2.width += pixelRange * 2;
  132481. bbox2.height += pixelRange * 2;
  132482. }
  132483. var labelBoundingBoxScratch = new BoundingRectangle_default();
  132484. function getBoundingBox(item, coord, pixelRange, entityCluster, result) {
  132485. if (defined_default(item._labelCollection) && entityCluster._clusterLabels) {
  132486. result = Label_default.getScreenSpaceBoundingBox(item, coord, result);
  132487. } else if (defined_default(item._billboardCollection) && entityCluster._clusterBillboards) {
  132488. result = Billboard_default.getScreenSpaceBoundingBox(item, coord, result);
  132489. } else if (defined_default(item._pointPrimitiveCollection) && entityCluster._clusterPoints) {
  132490. result = PointPrimitive_default.getScreenSpaceBoundingBox(item, coord, result);
  132491. }
  132492. expandBoundingBox(result, pixelRange);
  132493. if (entityCluster._clusterLabels && !defined_default(item._labelCollection) && defined_default(item.id) && hasLabelIndex(entityCluster, item.id.id) && defined_default(item.id._label)) {
  132494. const labelIndex = entityCluster._collectionIndicesByEntity[item.id.id].labelIndex;
  132495. const label = entityCluster._labelCollection.get(labelIndex);
  132496. const labelBBox = Label_default.getScreenSpaceBoundingBox(
  132497. label,
  132498. coord,
  132499. labelBoundingBoxScratch
  132500. );
  132501. expandBoundingBox(labelBBox, pixelRange);
  132502. result = BoundingRectangle_default.union(result, labelBBox, result);
  132503. }
  132504. return result;
  132505. }
  132506. function addNonClusteredItem(item, entityCluster) {
  132507. item.clusterShow = true;
  132508. if (!defined_default(item._labelCollection) && defined_default(item.id) && hasLabelIndex(entityCluster, item.id.id) && defined_default(item.id._label)) {
  132509. const labelIndex = entityCluster._collectionIndicesByEntity[item.id.id].labelIndex;
  132510. const label = entityCluster._labelCollection.get(labelIndex);
  132511. label.clusterShow = true;
  132512. }
  132513. }
  132514. function addCluster(position, numPoints, ids, entityCluster) {
  132515. const cluster = {
  132516. billboard: entityCluster._clusterBillboardCollection.add(),
  132517. label: entityCluster._clusterLabelCollection.add(),
  132518. point: entityCluster._clusterPointCollection.add()
  132519. };
  132520. cluster.billboard.show = false;
  132521. cluster.point.show = false;
  132522. cluster.label.show = true;
  132523. cluster.label.text = numPoints.toLocaleString();
  132524. cluster.label.id = ids;
  132525. cluster.billboard.position = cluster.label.position = cluster.point.position = position;
  132526. entityCluster._clusterEvent.raiseEvent(ids, cluster);
  132527. }
  132528. function hasLabelIndex(entityCluster, entityId) {
  132529. return defined_default(entityCluster) && defined_default(entityCluster._collectionIndicesByEntity[entityId]) && defined_default(entityCluster._collectionIndicesByEntity[entityId].labelIndex);
  132530. }
  132531. function getScreenSpacePositions(collection, points, scene, occluder, entityCluster) {
  132532. if (!defined_default(collection)) {
  132533. return;
  132534. }
  132535. const length3 = collection.length;
  132536. for (let i2 = 0; i2 < length3; ++i2) {
  132537. const item = collection.get(i2);
  132538. item.clusterShow = false;
  132539. if (!item.show || entityCluster._scene.mode === SceneMode_default.SCENE3D && !occluder.isPointVisible(item.position)) {
  132540. continue;
  132541. }
  132542. const canClusterLabels = entityCluster._clusterLabels && defined_default(item._labelCollection);
  132543. const canClusterBillboards = entityCluster._clusterBillboards && defined_default(item.id._billboard);
  132544. const canClusterPoints = entityCluster._clusterPoints && defined_default(item.id._point);
  132545. if (canClusterLabels && (canClusterPoints || canClusterBillboards)) {
  132546. continue;
  132547. }
  132548. const coord = item.computeScreenSpacePosition(scene);
  132549. if (!defined_default(coord)) {
  132550. continue;
  132551. }
  132552. points.push({
  132553. index: i2,
  132554. collection,
  132555. clustered: false,
  132556. coord
  132557. });
  132558. }
  132559. }
  132560. var pointBoundinRectangleScratch = new BoundingRectangle_default();
  132561. var totalBoundingRectangleScratch = new BoundingRectangle_default();
  132562. var neighborBoundingRectangleScratch = new BoundingRectangle_default();
  132563. function createDeclutterCallback(entityCluster) {
  132564. return function(amount) {
  132565. if (defined_default(amount) && amount < 0.05 || !entityCluster.enabled) {
  132566. return;
  132567. }
  132568. const scene = entityCluster._scene;
  132569. const labelCollection = entityCluster._labelCollection;
  132570. const billboardCollection = entityCluster._billboardCollection;
  132571. const pointCollection = entityCluster._pointCollection;
  132572. if (!defined_default(labelCollection) && !defined_default(billboardCollection) && !defined_default(pointCollection) || !entityCluster._clusterBillboards && !entityCluster._clusterLabels && !entityCluster._clusterPoints) {
  132573. return;
  132574. }
  132575. let clusteredLabelCollection = entityCluster._clusterLabelCollection;
  132576. let clusteredBillboardCollection = entityCluster._clusterBillboardCollection;
  132577. let clusteredPointCollection = entityCluster._clusterPointCollection;
  132578. if (defined_default(clusteredLabelCollection)) {
  132579. clusteredLabelCollection.removeAll();
  132580. } else {
  132581. clusteredLabelCollection = entityCluster._clusterLabelCollection = new LabelCollection_default(
  132582. {
  132583. scene
  132584. }
  132585. );
  132586. }
  132587. if (defined_default(clusteredBillboardCollection)) {
  132588. clusteredBillboardCollection.removeAll();
  132589. } else {
  132590. clusteredBillboardCollection = entityCluster._clusterBillboardCollection = new BillboardCollection_default(
  132591. {
  132592. scene
  132593. }
  132594. );
  132595. }
  132596. if (defined_default(clusteredPointCollection)) {
  132597. clusteredPointCollection.removeAll();
  132598. } else {
  132599. clusteredPointCollection = entityCluster._clusterPointCollection = new PointPrimitiveCollection_default();
  132600. }
  132601. const pixelRange = entityCluster._pixelRange;
  132602. const minimumClusterSize = entityCluster._minimumClusterSize;
  132603. const clusters = entityCluster._previousClusters;
  132604. const newClusters = [];
  132605. const previousHeight = entityCluster._previousHeight;
  132606. const currentHeight = scene.camera.positionCartographic.height;
  132607. const ellipsoid = scene.mapProjection.ellipsoid;
  132608. const cameraPosition = scene.camera.positionWC;
  132609. const occluder = new EllipsoidalOccluder_default(ellipsoid, cameraPosition);
  132610. const points = [];
  132611. if (entityCluster._clusterLabels) {
  132612. getScreenSpacePositions(
  132613. labelCollection,
  132614. points,
  132615. scene,
  132616. occluder,
  132617. entityCluster
  132618. );
  132619. }
  132620. if (entityCluster._clusterBillboards) {
  132621. getScreenSpacePositions(
  132622. billboardCollection,
  132623. points,
  132624. scene,
  132625. occluder,
  132626. entityCluster
  132627. );
  132628. }
  132629. if (entityCluster._clusterPoints) {
  132630. getScreenSpacePositions(
  132631. pointCollection,
  132632. points,
  132633. scene,
  132634. occluder,
  132635. entityCluster
  132636. );
  132637. }
  132638. let i2;
  132639. let j;
  132640. let length3;
  132641. let bbox2;
  132642. let neighbors2;
  132643. let neighborLength;
  132644. let neighborIndex;
  132645. let neighborPoint;
  132646. let ids;
  132647. let numPoints;
  132648. let collection;
  132649. let collectionIndex;
  132650. const index2 = new KDBush(points, getX, getY, 64, Int32Array);
  132651. if (currentHeight < previousHeight) {
  132652. length3 = clusters.length;
  132653. for (i2 = 0; i2 < length3; ++i2) {
  132654. const cluster = clusters[i2];
  132655. if (!occluder.isPointVisible(cluster.position)) {
  132656. continue;
  132657. }
  132658. const coord = Billboard_default._computeScreenSpacePosition(
  132659. Matrix4_default.IDENTITY,
  132660. cluster.position,
  132661. Cartesian3_default.ZERO,
  132662. Cartesian2_default.ZERO,
  132663. scene
  132664. );
  132665. if (!defined_default(coord)) {
  132666. continue;
  132667. }
  132668. const factor2 = 1 - currentHeight / previousHeight;
  132669. let width = cluster.width = cluster.width * factor2;
  132670. let height = cluster.height = cluster.height * factor2;
  132671. width = Math.max(width, cluster.minimumWidth);
  132672. height = Math.max(height, cluster.minimumHeight);
  132673. const minX = coord.x - width * 0.5;
  132674. const minY = coord.y - height * 0.5;
  132675. const maxX = coord.x + width;
  132676. const maxY = coord.y + height;
  132677. neighbors2 = index2.range(minX, minY, maxX, maxY);
  132678. neighborLength = neighbors2.length;
  132679. numPoints = 0;
  132680. ids = [];
  132681. for (j = 0; j < neighborLength; ++j) {
  132682. neighborIndex = neighbors2[j];
  132683. neighborPoint = points[neighborIndex];
  132684. if (!neighborPoint.clustered) {
  132685. ++numPoints;
  132686. collection = neighborPoint.collection;
  132687. collectionIndex = neighborPoint.index;
  132688. ids.push(collection.get(collectionIndex).id);
  132689. }
  132690. }
  132691. if (numPoints >= minimumClusterSize) {
  132692. addCluster(cluster.position, numPoints, ids, entityCluster);
  132693. newClusters.push(cluster);
  132694. for (j = 0; j < neighborLength; ++j) {
  132695. points[neighbors2[j]].clustered = true;
  132696. }
  132697. }
  132698. }
  132699. }
  132700. length3 = points.length;
  132701. for (i2 = 0; i2 < length3; ++i2) {
  132702. const point = points[i2];
  132703. if (point.clustered) {
  132704. continue;
  132705. }
  132706. point.clustered = true;
  132707. collection = point.collection;
  132708. collectionIndex = point.index;
  132709. const item = collection.get(collectionIndex);
  132710. bbox2 = getBoundingBox(
  132711. item,
  132712. point.coord,
  132713. pixelRange,
  132714. entityCluster,
  132715. pointBoundinRectangleScratch
  132716. );
  132717. const totalBBox = BoundingRectangle_default.clone(
  132718. bbox2,
  132719. totalBoundingRectangleScratch
  132720. );
  132721. neighbors2 = index2.range(
  132722. bbox2.x,
  132723. bbox2.y,
  132724. bbox2.x + bbox2.width,
  132725. bbox2.y + bbox2.height
  132726. );
  132727. neighborLength = neighbors2.length;
  132728. const clusterPosition = Cartesian3_default.clone(item.position);
  132729. numPoints = 1;
  132730. ids = [item.id];
  132731. for (j = 0; j < neighborLength; ++j) {
  132732. neighborIndex = neighbors2[j];
  132733. neighborPoint = points[neighborIndex];
  132734. if (!neighborPoint.clustered) {
  132735. const neighborItem = neighborPoint.collection.get(
  132736. neighborPoint.index
  132737. );
  132738. const neighborBBox = getBoundingBox(
  132739. neighborItem,
  132740. neighborPoint.coord,
  132741. pixelRange,
  132742. entityCluster,
  132743. neighborBoundingRectangleScratch
  132744. );
  132745. Cartesian3_default.add(
  132746. neighborItem.position,
  132747. clusterPosition,
  132748. clusterPosition
  132749. );
  132750. BoundingRectangle_default.union(totalBBox, neighborBBox, totalBBox);
  132751. ++numPoints;
  132752. ids.push(neighborItem.id);
  132753. }
  132754. }
  132755. if (numPoints >= minimumClusterSize) {
  132756. const position = Cartesian3_default.multiplyByScalar(
  132757. clusterPosition,
  132758. 1 / numPoints,
  132759. clusterPosition
  132760. );
  132761. addCluster(position, numPoints, ids, entityCluster);
  132762. newClusters.push({
  132763. position,
  132764. width: totalBBox.width,
  132765. height: totalBBox.height,
  132766. minimumWidth: bbox2.width,
  132767. minimumHeight: bbox2.height
  132768. });
  132769. for (j = 0; j < neighborLength; ++j) {
  132770. points[neighbors2[j]].clustered = true;
  132771. }
  132772. } else {
  132773. addNonClusteredItem(item, entityCluster);
  132774. }
  132775. }
  132776. if (clusteredLabelCollection.length === 0) {
  132777. clusteredLabelCollection.destroy();
  132778. entityCluster._clusterLabelCollection = void 0;
  132779. }
  132780. if (clusteredBillboardCollection.length === 0) {
  132781. clusteredBillboardCollection.destroy();
  132782. entityCluster._clusterBillboardCollection = void 0;
  132783. }
  132784. if (clusteredPointCollection.length === 0) {
  132785. clusteredPointCollection.destroy();
  132786. entityCluster._clusterPointCollection = void 0;
  132787. }
  132788. entityCluster._previousClusters = newClusters;
  132789. entityCluster._previousHeight = currentHeight;
  132790. };
  132791. }
  132792. EntityCluster.prototype._initialize = function(scene) {
  132793. this._scene = scene;
  132794. const cluster = createDeclutterCallback(this);
  132795. this._cluster = cluster;
  132796. this._removeEventListener = scene.camera.changed.addEventListener(cluster);
  132797. };
  132798. Object.defineProperties(EntityCluster.prototype, {
  132799. enabled: {
  132800. get: function() {
  132801. return this._enabled;
  132802. },
  132803. set: function(value) {
  132804. this._enabledDirty = value !== this._enabled;
  132805. this._enabled = value;
  132806. }
  132807. },
  132808. pixelRange: {
  132809. get: function() {
  132810. return this._pixelRange;
  132811. },
  132812. set: function(value) {
  132813. this._clusterDirty = this._clusterDirty || value !== this._pixelRange;
  132814. this._pixelRange = value;
  132815. }
  132816. },
  132817. minimumClusterSize: {
  132818. get: function() {
  132819. return this._minimumClusterSize;
  132820. },
  132821. set: function(value) {
  132822. this._clusterDirty = this._clusterDirty || value !== this._minimumClusterSize;
  132823. this._minimumClusterSize = value;
  132824. }
  132825. },
  132826. clusterEvent: {
  132827. get: function() {
  132828. return this._clusterEvent;
  132829. }
  132830. },
  132831. clusterBillboards: {
  132832. get: function() {
  132833. return this._clusterBillboards;
  132834. },
  132835. set: function(value) {
  132836. this._clusterDirty = this._clusterDirty || value !== this._clusterBillboards;
  132837. this._clusterBillboards = value;
  132838. }
  132839. },
  132840. clusterLabels: {
  132841. get: function() {
  132842. return this._clusterLabels;
  132843. },
  132844. set: function(value) {
  132845. this._clusterDirty = this._clusterDirty || value !== this._clusterLabels;
  132846. this._clusterLabels = value;
  132847. }
  132848. },
  132849. clusterPoints: {
  132850. get: function() {
  132851. return this._clusterPoints;
  132852. },
  132853. set: function(value) {
  132854. this._clusterDirty = this._clusterDirty || value !== this._clusterPoints;
  132855. this._clusterPoints = value;
  132856. }
  132857. }
  132858. });
  132859. function createGetEntity(collectionProperty, CollectionConstructor, unusedIndicesProperty, entityIndexProperty) {
  132860. return function(entity) {
  132861. let collection = this[collectionProperty];
  132862. if (!defined_default(this._collectionIndicesByEntity)) {
  132863. this._collectionIndicesByEntity = {};
  132864. }
  132865. let entityIndices = this._collectionIndicesByEntity[entity.id];
  132866. if (!defined_default(entityIndices)) {
  132867. entityIndices = this._collectionIndicesByEntity[entity.id] = {
  132868. billboardIndex: void 0,
  132869. labelIndex: void 0,
  132870. pointIndex: void 0
  132871. };
  132872. }
  132873. if (defined_default(collection) && defined_default(entityIndices[entityIndexProperty])) {
  132874. return collection.get(entityIndices[entityIndexProperty]);
  132875. }
  132876. if (!defined_default(collection)) {
  132877. collection = this[collectionProperty] = new CollectionConstructor({
  132878. scene: this._scene
  132879. });
  132880. }
  132881. let index2;
  132882. let entityItem;
  132883. const unusedIndices = this[unusedIndicesProperty];
  132884. if (unusedIndices.length > 0) {
  132885. index2 = unusedIndices.pop();
  132886. entityItem = collection.get(index2);
  132887. } else {
  132888. entityItem = collection.add();
  132889. index2 = collection.length - 1;
  132890. }
  132891. entityIndices[entityIndexProperty] = index2;
  132892. const that = this;
  132893. Promise.resolve().then(function() {
  132894. that._clusterDirty = true;
  132895. });
  132896. return entityItem;
  132897. };
  132898. }
  132899. function removeEntityIndicesIfUnused(entityCluster, entityId) {
  132900. const indices2 = entityCluster._collectionIndicesByEntity[entityId];
  132901. if (!defined_default(indices2.billboardIndex) && !defined_default(indices2.labelIndex) && !defined_default(indices2.pointIndex)) {
  132902. delete entityCluster._collectionIndicesByEntity[entityId];
  132903. }
  132904. }
  132905. EntityCluster.prototype.getLabel = createGetEntity(
  132906. "_labelCollection",
  132907. LabelCollection_default,
  132908. "_unusedLabelIndices",
  132909. "labelIndex"
  132910. );
  132911. EntityCluster.prototype.removeLabel = function(entity) {
  132912. const entityIndices = this._collectionIndicesByEntity && this._collectionIndicesByEntity[entity.id];
  132913. if (!defined_default(this._labelCollection) || !defined_default(entityIndices) || !defined_default(entityIndices.labelIndex)) {
  132914. return;
  132915. }
  132916. const index2 = entityIndices.labelIndex;
  132917. entityIndices.labelIndex = void 0;
  132918. removeEntityIndicesIfUnused(this, entity.id);
  132919. const label = this._labelCollection.get(index2);
  132920. label.show = false;
  132921. label.text = "";
  132922. label.id = void 0;
  132923. this._unusedLabelIndices.push(index2);
  132924. this._clusterDirty = true;
  132925. };
  132926. EntityCluster.prototype.getBillboard = createGetEntity(
  132927. "_billboardCollection",
  132928. BillboardCollection_default,
  132929. "_unusedBillboardIndices",
  132930. "billboardIndex"
  132931. );
  132932. EntityCluster.prototype.removeBillboard = function(entity) {
  132933. const entityIndices = this._collectionIndicesByEntity && this._collectionIndicesByEntity[entity.id];
  132934. if (!defined_default(this._billboardCollection) || !defined_default(entityIndices) || !defined_default(entityIndices.billboardIndex)) {
  132935. return;
  132936. }
  132937. const index2 = entityIndices.billboardIndex;
  132938. entityIndices.billboardIndex = void 0;
  132939. removeEntityIndicesIfUnused(this, entity.id);
  132940. const billboard = this._billboardCollection.get(index2);
  132941. billboard.id = void 0;
  132942. billboard.show = false;
  132943. billboard.image = void 0;
  132944. this._unusedBillboardIndices.push(index2);
  132945. this._clusterDirty = true;
  132946. };
  132947. EntityCluster.prototype.getPoint = createGetEntity(
  132948. "_pointCollection",
  132949. PointPrimitiveCollection_default,
  132950. "_unusedPointIndices",
  132951. "pointIndex"
  132952. );
  132953. EntityCluster.prototype.removePoint = function(entity) {
  132954. const entityIndices = this._collectionIndicesByEntity && this._collectionIndicesByEntity[entity.id];
  132955. if (!defined_default(this._pointCollection) || !defined_default(entityIndices) || !defined_default(entityIndices.pointIndex)) {
  132956. return;
  132957. }
  132958. const index2 = entityIndices.pointIndex;
  132959. entityIndices.pointIndex = void 0;
  132960. removeEntityIndicesIfUnused(this, entity.id);
  132961. const point = this._pointCollection.get(index2);
  132962. point.show = false;
  132963. point.id = void 0;
  132964. this._unusedPointIndices.push(index2);
  132965. this._clusterDirty = true;
  132966. };
  132967. function disableCollectionClustering(collection) {
  132968. if (!defined_default(collection)) {
  132969. return;
  132970. }
  132971. const length3 = collection.length;
  132972. for (let i2 = 0; i2 < length3; ++i2) {
  132973. collection.get(i2).clusterShow = true;
  132974. }
  132975. }
  132976. function updateEnable(entityCluster) {
  132977. if (entityCluster.enabled) {
  132978. return;
  132979. }
  132980. if (defined_default(entityCluster._clusterLabelCollection)) {
  132981. entityCluster._clusterLabelCollection.destroy();
  132982. }
  132983. if (defined_default(entityCluster._clusterBillboardCollection)) {
  132984. entityCluster._clusterBillboardCollection.destroy();
  132985. }
  132986. if (defined_default(entityCluster._clusterPointCollection)) {
  132987. entityCluster._clusterPointCollection.destroy();
  132988. }
  132989. entityCluster._clusterLabelCollection = void 0;
  132990. entityCluster._clusterBillboardCollection = void 0;
  132991. entityCluster._clusterPointCollection = void 0;
  132992. disableCollectionClustering(entityCluster._labelCollection);
  132993. disableCollectionClustering(entityCluster._billboardCollection);
  132994. disableCollectionClustering(entityCluster._pointCollection);
  132995. }
  132996. EntityCluster.prototype.update = function(frameState) {
  132997. if (!this.show) {
  132998. return;
  132999. }
  133000. let commandList;
  133001. if (defined_default(this._labelCollection) && this._labelCollection.length > 0 && this._labelCollection.get(0)._glyphs.length === 0) {
  133002. commandList = frameState.commandList;
  133003. frameState.commandList = [];
  133004. this._labelCollection.update(frameState);
  133005. frameState.commandList = commandList;
  133006. }
  133007. if (defined_default(this._billboardCollection) && this._billboardCollection.length > 0 && !defined_default(this._billboardCollection.get(0).width)) {
  133008. commandList = frameState.commandList;
  133009. frameState.commandList = [];
  133010. this._billboardCollection.update(frameState);
  133011. frameState.commandList = commandList;
  133012. }
  133013. if (this._enabledDirty) {
  133014. this._enabledDirty = false;
  133015. updateEnable(this);
  133016. this._clusterDirty = true;
  133017. }
  133018. if (this._clusterDirty) {
  133019. this._clusterDirty = false;
  133020. this._cluster();
  133021. }
  133022. if (defined_default(this._clusterLabelCollection)) {
  133023. this._clusterLabelCollection.update(frameState);
  133024. }
  133025. if (defined_default(this._clusterBillboardCollection)) {
  133026. this._clusterBillboardCollection.update(frameState);
  133027. }
  133028. if (defined_default(this._clusterPointCollection)) {
  133029. this._clusterPointCollection.update(frameState);
  133030. }
  133031. if (defined_default(this._labelCollection)) {
  133032. this._labelCollection.update(frameState);
  133033. }
  133034. if (defined_default(this._billboardCollection)) {
  133035. this._billboardCollection.update(frameState);
  133036. }
  133037. if (defined_default(this._pointCollection)) {
  133038. this._pointCollection.update(frameState);
  133039. }
  133040. };
  133041. EntityCluster.prototype.destroy = function() {
  133042. this._labelCollection = this._labelCollection && this._labelCollection.destroy();
  133043. this._billboardCollection = this._billboardCollection && this._billboardCollection.destroy();
  133044. this._pointCollection = this._pointCollection && this._pointCollection.destroy();
  133045. this._clusterLabelCollection = this._clusterLabelCollection && this._clusterLabelCollection.destroy();
  133046. this._clusterBillboardCollection = this._clusterBillboardCollection && this._clusterBillboardCollection.destroy();
  133047. this._clusterPointCollection = this._clusterPointCollection && this._clusterPointCollection.destroy();
  133048. if (defined_default(this._removeEventListener)) {
  133049. this._removeEventListener();
  133050. this._removeEventListener = void 0;
  133051. }
  133052. this._labelCollection = void 0;
  133053. this._billboardCollection = void 0;
  133054. this._pointCollection = void 0;
  133055. this._clusterBillboardCollection = void 0;
  133056. this._clusterLabelCollection = void 0;
  133057. this._clusterPointCollection = void 0;
  133058. this._collectionIndicesByEntity = void 0;
  133059. this._unusedLabelIndices = [];
  133060. this._unusedBillboardIndices = [];
  133061. this._unusedPointIndices = [];
  133062. this._previousClusters = [];
  133063. this._previousHeight = void 0;
  133064. this._enabledDirty = false;
  133065. this._pixelRangeDirty = false;
  133066. this._minimumClusterSizeDirty = false;
  133067. return void 0;
  133068. };
  133069. var EntityCluster_default = EntityCluster;
  133070. // node_modules/cesium/Source/DataSources/CustomDataSource.js
  133071. function CustomDataSource(name) {
  133072. this._name = name;
  133073. this._clock = void 0;
  133074. this._changed = new Event_default();
  133075. this._error = new Event_default();
  133076. this._isLoading = false;
  133077. this._loading = new Event_default();
  133078. this._entityCollection = new EntityCollection_default(this);
  133079. this._entityCluster = new EntityCluster_default();
  133080. }
  133081. Object.defineProperties(CustomDataSource.prototype, {
  133082. name: {
  133083. get: function() {
  133084. return this._name;
  133085. },
  133086. set: function(value) {
  133087. if (this._name !== value) {
  133088. this._name = value;
  133089. this._changed.raiseEvent(this);
  133090. }
  133091. }
  133092. },
  133093. clock: {
  133094. get: function() {
  133095. return this._clock;
  133096. },
  133097. set: function(value) {
  133098. if (this._clock !== value) {
  133099. this._clock = value;
  133100. this._changed.raiseEvent(this);
  133101. }
  133102. }
  133103. },
  133104. entities: {
  133105. get: function() {
  133106. return this._entityCollection;
  133107. }
  133108. },
  133109. isLoading: {
  133110. get: function() {
  133111. return this._isLoading;
  133112. },
  133113. set: function(value) {
  133114. DataSource_default.setLoading(this, value);
  133115. }
  133116. },
  133117. changedEvent: {
  133118. get: function() {
  133119. return this._changed;
  133120. }
  133121. },
  133122. errorEvent: {
  133123. get: function() {
  133124. return this._error;
  133125. }
  133126. },
  133127. loadingEvent: {
  133128. get: function() {
  133129. return this._loading;
  133130. }
  133131. },
  133132. show: {
  133133. get: function() {
  133134. return this._entityCollection.show;
  133135. },
  133136. set: function(value) {
  133137. this._entityCollection.show = value;
  133138. }
  133139. },
  133140. clustering: {
  133141. get: function() {
  133142. return this._entityCluster;
  133143. },
  133144. set: function(value) {
  133145. if (!defined_default(value)) {
  133146. throw new DeveloperError_default("value must be defined.");
  133147. }
  133148. this._entityCluster = value;
  133149. }
  133150. }
  133151. });
  133152. CustomDataSource.prototype.update = function(time) {
  133153. return true;
  133154. };
  133155. var CustomDataSource_default = CustomDataSource;
  133156. // node_modules/cesium/Source/DataSources/CylinderGeometryUpdater.js
  133157. var defaultOffset3 = Cartesian3_default.ZERO;
  133158. var offsetScratch6 = new Cartesian3_default();
  133159. var positionScratch9 = new Cartesian3_default();
  133160. var scratchColor13 = new Color_default();
  133161. function CylinderGeometryOptions(entity) {
  133162. this.id = entity;
  133163. this.vertexFormat = void 0;
  133164. this.length = void 0;
  133165. this.topRadius = void 0;
  133166. this.bottomRadius = void 0;
  133167. this.slices = void 0;
  133168. this.numberOfVerticalLines = void 0;
  133169. this.offsetAttribute = void 0;
  133170. }
  133171. function CylinderGeometryUpdater(entity, scene) {
  133172. GeometryUpdater_default.call(this, {
  133173. entity,
  133174. scene,
  133175. geometryOptions: new CylinderGeometryOptions(entity),
  133176. geometryPropertyName: "cylinder",
  133177. observedPropertyNames: [
  133178. "availability",
  133179. "position",
  133180. "orientation",
  133181. "cylinder"
  133182. ]
  133183. });
  133184. this._onEntityPropertyChanged(entity, "cylinder", entity.cylinder, void 0);
  133185. }
  133186. if (defined_default(Object.create)) {
  133187. CylinderGeometryUpdater.prototype = Object.create(GeometryUpdater_default.prototype);
  133188. CylinderGeometryUpdater.prototype.constructor = CylinderGeometryUpdater;
  133189. }
  133190. Object.defineProperties(CylinderGeometryUpdater.prototype, {
  133191. terrainOffsetProperty: {
  133192. get: function() {
  133193. return this._terrainOffsetProperty;
  133194. }
  133195. }
  133196. });
  133197. CylinderGeometryUpdater.prototype.createFillGeometryInstance = function(time) {
  133198. Check_default.defined("time", time);
  133199. if (!this._fillEnabled) {
  133200. throw new DeveloperError_default(
  133201. "This instance does not represent a filled geometry."
  133202. );
  133203. }
  133204. const entity = this._entity;
  133205. const isAvailable = entity.isAvailable(time);
  133206. const show = new ShowGeometryInstanceAttribute_default(
  133207. isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time)
  133208. );
  133209. const distanceDisplayCondition = this._distanceDisplayConditionProperty.getValue(
  133210. time
  133211. );
  133212. const distanceDisplayConditionAttribute = DistanceDisplayConditionGeometryInstanceAttribute_default.fromDistanceDisplayCondition(
  133213. distanceDisplayCondition
  133214. );
  133215. const attributes = {
  133216. show,
  133217. distanceDisplayCondition: distanceDisplayConditionAttribute,
  133218. color: void 0,
  133219. offset: void 0
  133220. };
  133221. if (this._materialProperty instanceof ColorMaterialProperty_default) {
  133222. let currentColor;
  133223. if (defined_default(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) {
  133224. currentColor = this._materialProperty.color.getValue(time, scratchColor13);
  133225. }
  133226. if (!defined_default(currentColor)) {
  133227. currentColor = Color_default.WHITE;
  133228. }
  133229. attributes.color = ColorGeometryInstanceAttribute_default.fromColor(currentColor);
  133230. }
  133231. if (defined_default(this._options.offsetAttribute)) {
  133232. attributes.offset = OffsetGeometryInstanceAttribute_default.fromCartesian3(
  133233. Property_default.getValueOrDefault(
  133234. this._terrainOffsetProperty,
  133235. time,
  133236. defaultOffset3,
  133237. offsetScratch6
  133238. )
  133239. );
  133240. }
  133241. return new GeometryInstance_default({
  133242. id: entity,
  133243. geometry: new CylinderGeometry_default(this._options),
  133244. modelMatrix: entity.computeModelMatrixForHeightReference(
  133245. time,
  133246. entity.cylinder.heightReference,
  133247. this._options.length * 0.5,
  133248. this._scene.mapProjection.ellipsoid
  133249. ),
  133250. attributes
  133251. });
  133252. };
  133253. CylinderGeometryUpdater.prototype.createOutlineGeometryInstance = function(time) {
  133254. Check_default.defined("time", time);
  133255. if (!this._outlineEnabled) {
  133256. throw new DeveloperError_default(
  133257. "This instance does not represent an outlined geometry."
  133258. );
  133259. }
  133260. const entity = this._entity;
  133261. const isAvailable = entity.isAvailable(time);
  133262. const outlineColor = Property_default.getValueOrDefault(
  133263. this._outlineColorProperty,
  133264. time,
  133265. Color_default.BLACK,
  133266. scratchColor13
  133267. );
  133268. const distanceDisplayCondition = this._distanceDisplayConditionProperty.getValue(
  133269. time
  133270. );
  133271. const attributes = {
  133272. show: new ShowGeometryInstanceAttribute_default(
  133273. isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)
  133274. ),
  133275. color: ColorGeometryInstanceAttribute_default.fromColor(outlineColor),
  133276. distanceDisplayCondition: DistanceDisplayConditionGeometryInstanceAttribute_default.fromDistanceDisplayCondition(
  133277. distanceDisplayCondition
  133278. ),
  133279. offset: void 0
  133280. };
  133281. if (defined_default(this._options.offsetAttribute)) {
  133282. attributes.offset = OffsetGeometryInstanceAttribute_default.fromCartesian3(
  133283. Property_default.getValueOrDefault(
  133284. this._terrainOffsetProperty,
  133285. time,
  133286. defaultOffset3,
  133287. offsetScratch6
  133288. )
  133289. );
  133290. }
  133291. return new GeometryInstance_default({
  133292. id: entity,
  133293. geometry: new CylinderOutlineGeometry_default(this._options),
  133294. modelMatrix: entity.computeModelMatrixForHeightReference(
  133295. time,
  133296. entity.cylinder.heightReference,
  133297. this._options.length * 0.5,
  133298. this._scene.mapProjection.ellipsoid
  133299. ),
  133300. attributes
  133301. });
  133302. };
  133303. CylinderGeometryUpdater.prototype._computeCenter = function(time, result) {
  133304. return Property_default.getValueOrUndefined(this._entity.position, time, result);
  133305. };
  133306. CylinderGeometryUpdater.prototype._isHidden = function(entity, cylinder) {
  133307. return !defined_default(entity.position) || !defined_default(cylinder.length) || !defined_default(cylinder.topRadius) || !defined_default(cylinder.bottomRadius) || GeometryUpdater_default.prototype._isHidden.call(this, entity, cylinder);
  133308. };
  133309. CylinderGeometryUpdater.prototype._isDynamic = function(entity, cylinder) {
  133310. return !entity.position.isConstant || !Property_default.isConstant(entity.orientation) || !cylinder.length.isConstant || !cylinder.topRadius.isConstant || !cylinder.bottomRadius.isConstant || !Property_default.isConstant(cylinder.slices) || !Property_default.isConstant(cylinder.outlineWidth) || !Property_default.isConstant(cylinder.numberOfVerticalLines);
  133311. };
  133312. CylinderGeometryUpdater.prototype._setStaticOptions = function(entity, cylinder) {
  133313. const heightReference = Property_default.getValueOrDefault(
  133314. cylinder.heightReference,
  133315. Iso8601_default.MINIMUM_VALUE,
  133316. HeightReference_default.NONE
  133317. );
  133318. const options = this._options;
  133319. options.vertexFormat = this._materialProperty instanceof ColorMaterialProperty_default ? PerInstanceColorAppearance_default.VERTEX_FORMAT : MaterialAppearance_default.MaterialSupport.TEXTURED.vertexFormat;
  133320. options.length = cylinder.length.getValue(Iso8601_default.MINIMUM_VALUE);
  133321. options.topRadius = cylinder.topRadius.getValue(Iso8601_default.MINIMUM_VALUE);
  133322. options.bottomRadius = cylinder.bottomRadius.getValue(Iso8601_default.MINIMUM_VALUE);
  133323. options.slices = Property_default.getValueOrUndefined(
  133324. cylinder.slices,
  133325. Iso8601_default.MINIMUM_VALUE
  133326. );
  133327. options.numberOfVerticalLines = Property_default.getValueOrUndefined(
  133328. cylinder.numberOfVerticalLines,
  133329. Iso8601_default.MINIMUM_VALUE
  133330. );
  133331. options.offsetAttribute = heightReference !== HeightReference_default.NONE ? GeometryOffsetAttribute_default.ALL : void 0;
  133332. };
  133333. CylinderGeometryUpdater.prototype._onEntityPropertyChanged = heightReferenceOnEntityPropertyChanged_default;
  133334. CylinderGeometryUpdater.DynamicGeometryUpdater = DynamicCylinderGeometryUpdater;
  133335. function DynamicCylinderGeometryUpdater(geometryUpdater, primitives, groundPrimitives) {
  133336. DynamicGeometryUpdater_default.call(
  133337. this,
  133338. geometryUpdater,
  133339. primitives,
  133340. groundPrimitives
  133341. );
  133342. }
  133343. if (defined_default(Object.create)) {
  133344. DynamicCylinderGeometryUpdater.prototype = Object.create(
  133345. DynamicGeometryUpdater_default.prototype
  133346. );
  133347. DynamicCylinderGeometryUpdater.prototype.constructor = DynamicCylinderGeometryUpdater;
  133348. }
  133349. DynamicCylinderGeometryUpdater.prototype._isHidden = function(entity, cylinder, time) {
  133350. const options = this._options;
  133351. const position = Property_default.getValueOrUndefined(
  133352. entity.position,
  133353. time,
  133354. positionScratch9
  133355. );
  133356. return !defined_default(position) || !defined_default(options.length) || !defined_default(options.topRadius) || !defined_default(options.bottomRadius) || DynamicGeometryUpdater_default.prototype._isHidden.call(
  133357. this,
  133358. entity,
  133359. cylinder,
  133360. time
  133361. );
  133362. };
  133363. DynamicCylinderGeometryUpdater.prototype._setOptions = function(entity, cylinder, time) {
  133364. const heightReference = Property_default.getValueOrDefault(
  133365. cylinder.heightReference,
  133366. time,
  133367. HeightReference_default.NONE
  133368. );
  133369. const options = this._options;
  133370. options.length = Property_default.getValueOrUndefined(cylinder.length, time);
  133371. options.topRadius = Property_default.getValueOrUndefined(cylinder.topRadius, time);
  133372. options.bottomRadius = Property_default.getValueOrUndefined(
  133373. cylinder.bottomRadius,
  133374. time
  133375. );
  133376. options.slices = Property_default.getValueOrUndefined(cylinder.slices, time);
  133377. options.numberOfVerticalLines = Property_default.getValueOrUndefined(
  133378. cylinder.numberOfVerticalLines,
  133379. time
  133380. );
  133381. options.offsetAttribute = heightReference !== HeightReference_default.NONE ? GeometryOffsetAttribute_default.ALL : void 0;
  133382. };
  133383. var CylinderGeometryUpdater_default = CylinderGeometryUpdater;
  133384. // node_modules/cesium/Source/DataSources/DataSourceClock.js
  133385. function DataSourceClock() {
  133386. this._definitionChanged = new Event_default();
  133387. this._startTime = void 0;
  133388. this._stopTime = void 0;
  133389. this._currentTime = void 0;
  133390. this._clockRange = void 0;
  133391. this._clockStep = void 0;
  133392. this._multiplier = void 0;
  133393. }
  133394. Object.defineProperties(DataSourceClock.prototype, {
  133395. definitionChanged: {
  133396. get: function() {
  133397. return this._definitionChanged;
  133398. }
  133399. },
  133400. startTime: createRawPropertyDescriptor_default("startTime"),
  133401. stopTime: createRawPropertyDescriptor_default("stopTime"),
  133402. currentTime: createRawPropertyDescriptor_default("currentTime"),
  133403. clockRange: createRawPropertyDescriptor_default("clockRange"),
  133404. clockStep: createRawPropertyDescriptor_default("clockStep"),
  133405. multiplier: createRawPropertyDescriptor_default("multiplier")
  133406. });
  133407. DataSourceClock.prototype.clone = function(result) {
  133408. if (!defined_default(result)) {
  133409. result = new DataSourceClock();
  133410. }
  133411. result.startTime = this.startTime;
  133412. result.stopTime = this.stopTime;
  133413. result.currentTime = this.currentTime;
  133414. result.clockRange = this.clockRange;
  133415. result.clockStep = this.clockStep;
  133416. result.multiplier = this.multiplier;
  133417. return result;
  133418. };
  133419. DataSourceClock.prototype.equals = function(other) {
  133420. return this === other || defined_default(other) && JulianDate_default.equals(this.startTime, other.startTime) && JulianDate_default.equals(this.stopTime, other.stopTime) && JulianDate_default.equals(this.currentTime, other.currentTime) && this.clockRange === other.clockRange && this.clockStep === other.clockStep && this.multiplier === other.multiplier;
  133421. };
  133422. DataSourceClock.prototype.merge = function(source) {
  133423. if (!defined_default(source)) {
  133424. throw new DeveloperError_default("source is required.");
  133425. }
  133426. this.startTime = defaultValue_default(this.startTime, source.startTime);
  133427. this.stopTime = defaultValue_default(this.stopTime, source.stopTime);
  133428. this.currentTime = defaultValue_default(this.currentTime, source.currentTime);
  133429. this.clockRange = defaultValue_default(this.clockRange, source.clockRange);
  133430. this.clockStep = defaultValue_default(this.clockStep, source.clockStep);
  133431. this.multiplier = defaultValue_default(this.multiplier, source.multiplier);
  133432. };
  133433. DataSourceClock.prototype.getValue = function(result) {
  133434. if (!defined_default(result)) {
  133435. result = new Clock_default();
  133436. }
  133437. result.startTime = defaultValue_default(this.startTime, result.startTime);
  133438. result.stopTime = defaultValue_default(this.stopTime, result.stopTime);
  133439. result.currentTime = defaultValue_default(this.currentTime, result.currentTime);
  133440. result.clockRange = defaultValue_default(this.clockRange, result.clockRange);
  133441. result.multiplier = defaultValue_default(this.multiplier, result.multiplier);
  133442. result.clockStep = defaultValue_default(this.clockStep, result.clockStep);
  133443. return result;
  133444. };
  133445. var DataSourceClock_default = DataSourceClock;
  133446. // node_modules/cesium/Source/DataSources/GridMaterialProperty.js
  133447. var defaultColor3 = Color_default.WHITE;
  133448. var defaultCellAlpha = 0.1;
  133449. var defaultLineCount = new Cartesian2_default(8, 8);
  133450. var defaultLineOffset = new Cartesian2_default(0, 0);
  133451. var defaultLineThickness = new Cartesian2_default(1, 1);
  133452. function GridMaterialProperty(options) {
  133453. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  133454. this._definitionChanged = new Event_default();
  133455. this._color = void 0;
  133456. this._colorSubscription = void 0;
  133457. this._cellAlpha = void 0;
  133458. this._cellAlphaSubscription = void 0;
  133459. this._lineCount = void 0;
  133460. this._lineCountSubscription = void 0;
  133461. this._lineThickness = void 0;
  133462. this._lineThicknessSubscription = void 0;
  133463. this._lineOffset = void 0;
  133464. this._lineOffsetSubscription = void 0;
  133465. this.color = options.color;
  133466. this.cellAlpha = options.cellAlpha;
  133467. this.lineCount = options.lineCount;
  133468. this.lineThickness = options.lineThickness;
  133469. this.lineOffset = options.lineOffset;
  133470. }
  133471. Object.defineProperties(GridMaterialProperty.prototype, {
  133472. isConstant: {
  133473. get: function() {
  133474. return Property_default.isConstant(this._color) && Property_default.isConstant(this._cellAlpha) && Property_default.isConstant(this._lineCount) && Property_default.isConstant(this._lineThickness) && Property_default.isConstant(this._lineOffset);
  133475. }
  133476. },
  133477. definitionChanged: {
  133478. get: function() {
  133479. return this._definitionChanged;
  133480. }
  133481. },
  133482. color: createPropertyDescriptor_default("color"),
  133483. cellAlpha: createPropertyDescriptor_default("cellAlpha"),
  133484. lineCount: createPropertyDescriptor_default("lineCount"),
  133485. lineThickness: createPropertyDescriptor_default("lineThickness"),
  133486. lineOffset: createPropertyDescriptor_default("lineOffset")
  133487. });
  133488. GridMaterialProperty.prototype.getType = function(time) {
  133489. return "Grid";
  133490. };
  133491. GridMaterialProperty.prototype.getValue = function(time, result) {
  133492. if (!defined_default(result)) {
  133493. result = {};
  133494. }
  133495. result.color = Property_default.getValueOrClonedDefault(
  133496. this._color,
  133497. time,
  133498. defaultColor3,
  133499. result.color
  133500. );
  133501. result.cellAlpha = Property_default.getValueOrDefault(
  133502. this._cellAlpha,
  133503. time,
  133504. defaultCellAlpha
  133505. );
  133506. result.lineCount = Property_default.getValueOrClonedDefault(
  133507. this._lineCount,
  133508. time,
  133509. defaultLineCount,
  133510. result.lineCount
  133511. );
  133512. result.lineThickness = Property_default.getValueOrClonedDefault(
  133513. this._lineThickness,
  133514. time,
  133515. defaultLineThickness,
  133516. result.lineThickness
  133517. );
  133518. result.lineOffset = Property_default.getValueOrClonedDefault(
  133519. this._lineOffset,
  133520. time,
  133521. defaultLineOffset,
  133522. result.lineOffset
  133523. );
  133524. return result;
  133525. };
  133526. GridMaterialProperty.prototype.equals = function(other) {
  133527. return this === other || other instanceof GridMaterialProperty && Property_default.equals(this._color, other._color) && Property_default.equals(this._cellAlpha, other._cellAlpha) && Property_default.equals(this._lineCount, other._lineCount) && Property_default.equals(this._lineThickness, other._lineThickness) && Property_default.equals(this._lineOffset, other._lineOffset);
  133528. };
  133529. var GridMaterialProperty_default = GridMaterialProperty;
  133530. // node_modules/cesium/Source/DataSources/PolylineArrowMaterialProperty.js
  133531. function PolylineArrowMaterialProperty(color) {
  133532. this._definitionChanged = new Event_default();
  133533. this._color = void 0;
  133534. this._colorSubscription = void 0;
  133535. this.color = color;
  133536. }
  133537. Object.defineProperties(PolylineArrowMaterialProperty.prototype, {
  133538. isConstant: {
  133539. get: function() {
  133540. return Property_default.isConstant(this._color);
  133541. }
  133542. },
  133543. definitionChanged: {
  133544. get: function() {
  133545. return this._definitionChanged;
  133546. }
  133547. },
  133548. color: createPropertyDescriptor_default("color")
  133549. });
  133550. PolylineArrowMaterialProperty.prototype.getType = function(time) {
  133551. return "PolylineArrow";
  133552. };
  133553. PolylineArrowMaterialProperty.prototype.getValue = function(time, result) {
  133554. if (!defined_default(result)) {
  133555. result = {};
  133556. }
  133557. result.color = Property_default.getValueOrClonedDefault(
  133558. this._color,
  133559. time,
  133560. Color_default.WHITE,
  133561. result.color
  133562. );
  133563. return result;
  133564. };
  133565. PolylineArrowMaterialProperty.prototype.equals = function(other) {
  133566. return this === other || other instanceof PolylineArrowMaterialProperty && Property_default.equals(this._color, other._color);
  133567. };
  133568. var PolylineArrowMaterialProperty_default = PolylineArrowMaterialProperty;
  133569. // node_modules/cesium/Source/DataSources/PolylineDashMaterialProperty.js
  133570. var defaultColor4 = Color_default.WHITE;
  133571. var defaultGapColor = Color_default.TRANSPARENT;
  133572. var defaultDashLength = 16;
  133573. var defaultDashPattern = 255;
  133574. function PolylineDashMaterialProperty(options) {
  133575. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  133576. this._definitionChanged = new Event_default();
  133577. this._color = void 0;
  133578. this._colorSubscription = void 0;
  133579. this._gapColor = void 0;
  133580. this._gapColorSubscription = void 0;
  133581. this._dashLength = void 0;
  133582. this._dashLengthSubscription = void 0;
  133583. this._dashPattern = void 0;
  133584. this._dashPatternSubscription = void 0;
  133585. this.color = options.color;
  133586. this.gapColor = options.gapColor;
  133587. this.dashLength = options.dashLength;
  133588. this.dashPattern = options.dashPattern;
  133589. }
  133590. Object.defineProperties(PolylineDashMaterialProperty.prototype, {
  133591. isConstant: {
  133592. get: function() {
  133593. return Property_default.isConstant(this._color) && Property_default.isConstant(this._gapColor) && Property_default.isConstant(this._dashLength) && Property_default.isConstant(this._dashPattern);
  133594. }
  133595. },
  133596. definitionChanged: {
  133597. get: function() {
  133598. return this._definitionChanged;
  133599. }
  133600. },
  133601. color: createPropertyDescriptor_default("color"),
  133602. gapColor: createPropertyDescriptor_default("gapColor"),
  133603. dashLength: createPropertyDescriptor_default("dashLength"),
  133604. dashPattern: createPropertyDescriptor_default("dashPattern")
  133605. });
  133606. PolylineDashMaterialProperty.prototype.getType = function(time) {
  133607. return "PolylineDash";
  133608. };
  133609. PolylineDashMaterialProperty.prototype.getValue = function(time, result) {
  133610. if (!defined_default(result)) {
  133611. result = {};
  133612. }
  133613. result.color = Property_default.getValueOrClonedDefault(
  133614. this._color,
  133615. time,
  133616. defaultColor4,
  133617. result.color
  133618. );
  133619. result.gapColor = Property_default.getValueOrClonedDefault(
  133620. this._gapColor,
  133621. time,
  133622. defaultGapColor,
  133623. result.gapColor
  133624. );
  133625. result.dashLength = Property_default.getValueOrDefault(
  133626. this._dashLength,
  133627. time,
  133628. defaultDashLength,
  133629. result.dashLength
  133630. );
  133631. result.dashPattern = Property_default.getValueOrDefault(
  133632. this._dashPattern,
  133633. time,
  133634. defaultDashPattern,
  133635. result.dashPattern
  133636. );
  133637. return result;
  133638. };
  133639. PolylineDashMaterialProperty.prototype.equals = function(other) {
  133640. return this === other || other instanceof PolylineDashMaterialProperty && Property_default.equals(this._color, other._color) && Property_default.equals(this._gapColor, other._gapColor) && Property_default.equals(this._dashLength, other._dashLength) && Property_default.equals(this._dashPattern, other._dashPattern);
  133641. };
  133642. var PolylineDashMaterialProperty_default = PolylineDashMaterialProperty;
  133643. // node_modules/cesium/Source/DataSources/PolylineGlowMaterialProperty.js
  133644. var defaultColor5 = Color_default.WHITE;
  133645. var defaultGlowPower = 0.25;
  133646. var defaultTaperPower = 1;
  133647. function PolylineGlowMaterialProperty(options) {
  133648. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  133649. this._definitionChanged = new Event_default();
  133650. this._color = void 0;
  133651. this._colorSubscription = void 0;
  133652. this._glowPower = void 0;
  133653. this._glowPowerSubscription = void 0;
  133654. this._taperPower = void 0;
  133655. this._taperPowerSubscription = void 0;
  133656. this.color = options.color;
  133657. this.glowPower = options.glowPower;
  133658. this.taperPower = options.taperPower;
  133659. }
  133660. Object.defineProperties(PolylineGlowMaterialProperty.prototype, {
  133661. isConstant: {
  133662. get: function() {
  133663. return Property_default.isConstant(this._color) && Property_default.isConstant(this._glow);
  133664. }
  133665. },
  133666. definitionChanged: {
  133667. get: function() {
  133668. return this._definitionChanged;
  133669. }
  133670. },
  133671. color: createPropertyDescriptor_default("color"),
  133672. glowPower: createPropertyDescriptor_default("glowPower"),
  133673. taperPower: createPropertyDescriptor_default("taperPower")
  133674. });
  133675. PolylineGlowMaterialProperty.prototype.getType = function(time) {
  133676. return "PolylineGlow";
  133677. };
  133678. PolylineGlowMaterialProperty.prototype.getValue = function(time, result) {
  133679. if (!defined_default(result)) {
  133680. result = {};
  133681. }
  133682. result.color = Property_default.getValueOrClonedDefault(
  133683. this._color,
  133684. time,
  133685. defaultColor5,
  133686. result.color
  133687. );
  133688. result.glowPower = Property_default.getValueOrDefault(
  133689. this._glowPower,
  133690. time,
  133691. defaultGlowPower,
  133692. result.glowPower
  133693. );
  133694. result.taperPower = Property_default.getValueOrDefault(
  133695. this._taperPower,
  133696. time,
  133697. defaultTaperPower,
  133698. result.taperPower
  133699. );
  133700. return result;
  133701. };
  133702. PolylineGlowMaterialProperty.prototype.equals = function(other) {
  133703. return this === other || other instanceof PolylineGlowMaterialProperty && Property_default.equals(this._color, other._color) && Property_default.equals(this._glowPower, other._glowPower) && Property_default.equals(this._taperPower, other._taperPower);
  133704. };
  133705. var PolylineGlowMaterialProperty_default = PolylineGlowMaterialProperty;
  133706. // node_modules/cesium/Source/DataSources/PolylineOutlineMaterialProperty.js
  133707. var defaultColor6 = Color_default.WHITE;
  133708. var defaultOutlineColor2 = Color_default.BLACK;
  133709. var defaultOutlineWidth = 1;
  133710. function PolylineOutlineMaterialProperty(options) {
  133711. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  133712. this._definitionChanged = new Event_default();
  133713. this._color = void 0;
  133714. this._colorSubscription = void 0;
  133715. this._outlineColor = void 0;
  133716. this._outlineColorSubscription = void 0;
  133717. this._outlineWidth = void 0;
  133718. this._outlineWidthSubscription = void 0;
  133719. this.color = options.color;
  133720. this.outlineColor = options.outlineColor;
  133721. this.outlineWidth = options.outlineWidth;
  133722. }
  133723. Object.defineProperties(PolylineOutlineMaterialProperty.prototype, {
  133724. isConstant: {
  133725. get: function() {
  133726. return Property_default.isConstant(this._color) && Property_default.isConstant(this._outlineColor) && Property_default.isConstant(this._outlineWidth);
  133727. }
  133728. },
  133729. definitionChanged: {
  133730. get: function() {
  133731. return this._definitionChanged;
  133732. }
  133733. },
  133734. color: createPropertyDescriptor_default("color"),
  133735. outlineColor: createPropertyDescriptor_default("outlineColor"),
  133736. outlineWidth: createPropertyDescriptor_default("outlineWidth")
  133737. });
  133738. PolylineOutlineMaterialProperty.prototype.getType = function(time) {
  133739. return "PolylineOutline";
  133740. };
  133741. PolylineOutlineMaterialProperty.prototype.getValue = function(time, result) {
  133742. if (!defined_default(result)) {
  133743. result = {};
  133744. }
  133745. result.color = Property_default.getValueOrClonedDefault(
  133746. this._color,
  133747. time,
  133748. defaultColor6,
  133749. result.color
  133750. );
  133751. result.outlineColor = Property_default.getValueOrClonedDefault(
  133752. this._outlineColor,
  133753. time,
  133754. defaultOutlineColor2,
  133755. result.outlineColor
  133756. );
  133757. result.outlineWidth = Property_default.getValueOrDefault(
  133758. this._outlineWidth,
  133759. time,
  133760. defaultOutlineWidth
  133761. );
  133762. return result;
  133763. };
  133764. PolylineOutlineMaterialProperty.prototype.equals = function(other) {
  133765. return this === other || other instanceof PolylineOutlineMaterialProperty && Property_default.equals(this._color, other._color) && Property_default.equals(this._outlineColor, other._outlineColor) && Property_default.equals(this._outlineWidth, other._outlineWidth);
  133766. };
  133767. var PolylineOutlineMaterialProperty_default = PolylineOutlineMaterialProperty;
  133768. // node_modules/cesium/Source/DataSources/PositionPropertyArray.js
  133769. function PositionPropertyArray(value, referenceFrame) {
  133770. this._value = void 0;
  133771. this._definitionChanged = new Event_default();
  133772. this._eventHelper = new EventHelper_default();
  133773. this._referenceFrame = defaultValue_default(referenceFrame, ReferenceFrame_default.FIXED);
  133774. this.setValue(value);
  133775. }
  133776. Object.defineProperties(PositionPropertyArray.prototype, {
  133777. isConstant: {
  133778. get: function() {
  133779. const value = this._value;
  133780. if (!defined_default(value)) {
  133781. return true;
  133782. }
  133783. const length3 = value.length;
  133784. for (let i2 = 0; i2 < length3; i2++) {
  133785. if (!Property_default.isConstant(value[i2])) {
  133786. return false;
  133787. }
  133788. }
  133789. return true;
  133790. }
  133791. },
  133792. definitionChanged: {
  133793. get: function() {
  133794. return this._definitionChanged;
  133795. }
  133796. },
  133797. referenceFrame: {
  133798. get: function() {
  133799. return this._referenceFrame;
  133800. }
  133801. }
  133802. });
  133803. PositionPropertyArray.prototype.getValue = function(time, result) {
  133804. return this.getValueInReferenceFrame(time, ReferenceFrame_default.FIXED, result);
  133805. };
  133806. PositionPropertyArray.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) {
  133807. if (!defined_default(time)) {
  133808. throw new DeveloperError_default("time is required.");
  133809. }
  133810. if (!defined_default(referenceFrame)) {
  133811. throw new DeveloperError_default("referenceFrame is required.");
  133812. }
  133813. const value = this._value;
  133814. if (!defined_default(value)) {
  133815. return void 0;
  133816. }
  133817. const length3 = value.length;
  133818. if (!defined_default(result)) {
  133819. result = new Array(length3);
  133820. }
  133821. let i2 = 0;
  133822. let x = 0;
  133823. while (i2 < length3) {
  133824. const property = value[i2];
  133825. const itemValue = property.getValueInReferenceFrame(
  133826. time,
  133827. referenceFrame,
  133828. result[i2]
  133829. );
  133830. if (defined_default(itemValue)) {
  133831. result[x] = itemValue;
  133832. x++;
  133833. }
  133834. i2++;
  133835. }
  133836. result.length = x;
  133837. return result;
  133838. };
  133839. PositionPropertyArray.prototype.setValue = function(value) {
  133840. const eventHelper = this._eventHelper;
  133841. eventHelper.removeAll();
  133842. if (defined_default(value)) {
  133843. this._value = value.slice();
  133844. const length3 = value.length;
  133845. for (let i2 = 0; i2 < length3; i2++) {
  133846. const property = value[i2];
  133847. if (defined_default(property)) {
  133848. eventHelper.add(
  133849. property.definitionChanged,
  133850. PositionPropertyArray.prototype._raiseDefinitionChanged,
  133851. this
  133852. );
  133853. }
  133854. }
  133855. } else {
  133856. this._value = void 0;
  133857. }
  133858. this._definitionChanged.raiseEvent(this);
  133859. };
  133860. PositionPropertyArray.prototype.equals = function(other) {
  133861. return this === other || other instanceof PositionPropertyArray && this._referenceFrame === other._referenceFrame && Property_default.arrayEquals(this._value, other._value);
  133862. };
  133863. PositionPropertyArray.prototype._raiseDefinitionChanged = function() {
  133864. this._definitionChanged.raiseEvent(this);
  133865. };
  133866. var PositionPropertyArray_default = PositionPropertyArray;
  133867. // node_modules/cesium/Source/DataSources/PropertyArray.js
  133868. function PropertyArray(value) {
  133869. this._value = void 0;
  133870. this._definitionChanged = new Event_default();
  133871. this._eventHelper = new EventHelper_default();
  133872. this.setValue(value);
  133873. }
  133874. Object.defineProperties(PropertyArray.prototype, {
  133875. isConstant: {
  133876. get: function() {
  133877. const value = this._value;
  133878. if (!defined_default(value)) {
  133879. return true;
  133880. }
  133881. const length3 = value.length;
  133882. for (let i2 = 0; i2 < length3; i2++) {
  133883. if (!Property_default.isConstant(value[i2])) {
  133884. return false;
  133885. }
  133886. }
  133887. return true;
  133888. }
  133889. },
  133890. definitionChanged: {
  133891. get: function() {
  133892. return this._definitionChanged;
  133893. }
  133894. }
  133895. });
  133896. PropertyArray.prototype.getValue = function(time, result) {
  133897. if (!defined_default(time)) {
  133898. throw new DeveloperError_default("time is required.");
  133899. }
  133900. const value = this._value;
  133901. if (!defined_default(value)) {
  133902. return void 0;
  133903. }
  133904. const length3 = value.length;
  133905. if (!defined_default(result)) {
  133906. result = new Array(length3);
  133907. }
  133908. let i2 = 0;
  133909. let x = 0;
  133910. while (i2 < length3) {
  133911. const property = this._value[i2];
  133912. const itemValue = property.getValue(time, result[i2]);
  133913. if (defined_default(itemValue)) {
  133914. result[x] = itemValue;
  133915. x++;
  133916. }
  133917. i2++;
  133918. }
  133919. result.length = x;
  133920. return result;
  133921. };
  133922. PropertyArray.prototype.setValue = function(value) {
  133923. const eventHelper = this._eventHelper;
  133924. eventHelper.removeAll();
  133925. if (defined_default(value)) {
  133926. this._value = value.slice();
  133927. const length3 = value.length;
  133928. for (let i2 = 0; i2 < length3; i2++) {
  133929. const property = value[i2];
  133930. if (defined_default(property)) {
  133931. eventHelper.add(
  133932. property.definitionChanged,
  133933. PropertyArray.prototype._raiseDefinitionChanged,
  133934. this
  133935. );
  133936. }
  133937. }
  133938. } else {
  133939. this._value = void 0;
  133940. }
  133941. this._definitionChanged.raiseEvent(this);
  133942. };
  133943. PropertyArray.prototype.equals = function(other) {
  133944. return this === other || other instanceof PropertyArray && Property_default.arrayEquals(this._value, other._value);
  133945. };
  133946. PropertyArray.prototype._raiseDefinitionChanged = function() {
  133947. this._definitionChanged.raiseEvent(this);
  133948. };
  133949. var PropertyArray_default = PropertyArray;
  133950. // node_modules/cesium/Source/DataSources/ReferenceProperty.js
  133951. function resolve(that) {
  133952. let targetProperty = that._targetProperty;
  133953. if (!defined_default(targetProperty)) {
  133954. let targetEntity = that._targetEntity;
  133955. if (!defined_default(targetEntity)) {
  133956. targetEntity = that._targetCollection.getById(that._targetId);
  133957. if (!defined_default(targetEntity)) {
  133958. that._targetEntity = that._targetProperty = void 0;
  133959. return;
  133960. }
  133961. targetEntity.definitionChanged.addEventListener(
  133962. ReferenceProperty.prototype._onTargetEntityDefinitionChanged,
  133963. that
  133964. );
  133965. that._targetEntity = targetEntity;
  133966. }
  133967. const targetPropertyNames = that._targetPropertyNames;
  133968. targetProperty = that._targetEntity;
  133969. for (let i2 = 0, len = targetPropertyNames.length; i2 < len && defined_default(targetProperty); ++i2) {
  133970. targetProperty = targetProperty[targetPropertyNames[i2]];
  133971. }
  133972. that._targetProperty = targetProperty;
  133973. }
  133974. return targetProperty;
  133975. }
  133976. function ReferenceProperty(targetCollection, targetId, targetPropertyNames) {
  133977. if (!defined_default(targetCollection)) {
  133978. throw new DeveloperError_default("targetCollection is required.");
  133979. }
  133980. if (!defined_default(targetId) || targetId === "") {
  133981. throw new DeveloperError_default("targetId is required.");
  133982. }
  133983. if (!defined_default(targetPropertyNames) || targetPropertyNames.length === 0) {
  133984. throw new DeveloperError_default("targetPropertyNames is required.");
  133985. }
  133986. for (let i2 = 0; i2 < targetPropertyNames.length; i2++) {
  133987. const item = targetPropertyNames[i2];
  133988. if (!defined_default(item) || item === "") {
  133989. throw new DeveloperError_default("reference contains invalid properties.");
  133990. }
  133991. }
  133992. this._targetCollection = targetCollection;
  133993. this._targetId = targetId;
  133994. this._targetPropertyNames = targetPropertyNames;
  133995. this._targetProperty = void 0;
  133996. this._targetEntity = void 0;
  133997. this._definitionChanged = new Event_default();
  133998. targetCollection.collectionChanged.addEventListener(
  133999. ReferenceProperty.prototype._onCollectionChanged,
  134000. this
  134001. );
  134002. }
  134003. Object.defineProperties(ReferenceProperty.prototype, {
  134004. isConstant: {
  134005. get: function() {
  134006. return Property_default.isConstant(resolve(this));
  134007. }
  134008. },
  134009. definitionChanged: {
  134010. get: function() {
  134011. return this._definitionChanged;
  134012. }
  134013. },
  134014. referenceFrame: {
  134015. get: function() {
  134016. const target = resolve(this);
  134017. return defined_default(target) ? target.referenceFrame : void 0;
  134018. }
  134019. },
  134020. targetId: {
  134021. get: function() {
  134022. return this._targetId;
  134023. }
  134024. },
  134025. targetCollection: {
  134026. get: function() {
  134027. return this._targetCollection;
  134028. }
  134029. },
  134030. targetPropertyNames: {
  134031. get: function() {
  134032. return this._targetPropertyNames;
  134033. }
  134034. },
  134035. resolvedProperty: {
  134036. get: function() {
  134037. return resolve(this);
  134038. }
  134039. }
  134040. });
  134041. ReferenceProperty.fromString = function(targetCollection, referenceString) {
  134042. if (!defined_default(targetCollection)) {
  134043. throw new DeveloperError_default("targetCollection is required.");
  134044. }
  134045. if (!defined_default(referenceString)) {
  134046. throw new DeveloperError_default("referenceString is required.");
  134047. }
  134048. let identifier;
  134049. const values = [];
  134050. let inIdentifier = true;
  134051. let isEscaped = false;
  134052. let token = "";
  134053. for (let i2 = 0; i2 < referenceString.length; ++i2) {
  134054. const c14 = referenceString.charAt(i2);
  134055. if (isEscaped) {
  134056. token += c14;
  134057. isEscaped = false;
  134058. } else if (c14 === "\\") {
  134059. isEscaped = true;
  134060. } else if (inIdentifier && c14 === "#") {
  134061. identifier = token;
  134062. inIdentifier = false;
  134063. token = "";
  134064. } else if (!inIdentifier && c14 === ".") {
  134065. values.push(token);
  134066. token = "";
  134067. } else {
  134068. token += c14;
  134069. }
  134070. }
  134071. values.push(token);
  134072. return new ReferenceProperty(targetCollection, identifier, values);
  134073. };
  134074. ReferenceProperty.prototype.getValue = function(time, result) {
  134075. const target = resolve(this);
  134076. return defined_default(target) ? target.getValue(time, result) : void 0;
  134077. };
  134078. ReferenceProperty.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) {
  134079. const target = resolve(this);
  134080. return defined_default(target) ? target.getValueInReferenceFrame(time, referenceFrame, result) : void 0;
  134081. };
  134082. ReferenceProperty.prototype.getType = function(time) {
  134083. const target = resolve(this);
  134084. return defined_default(target) ? target.getType(time) : void 0;
  134085. };
  134086. ReferenceProperty.prototype.equals = function(other) {
  134087. if (this === other) {
  134088. return true;
  134089. }
  134090. const names = this._targetPropertyNames;
  134091. const otherNames = other._targetPropertyNames;
  134092. if (this._targetCollection !== other._targetCollection || this._targetId !== other._targetId || names.length !== otherNames.length) {
  134093. return false;
  134094. }
  134095. const length3 = this._targetPropertyNames.length;
  134096. for (let i2 = 0; i2 < length3; i2++) {
  134097. if (names[i2] !== otherNames[i2]) {
  134098. return false;
  134099. }
  134100. }
  134101. return true;
  134102. };
  134103. ReferenceProperty.prototype._onTargetEntityDefinitionChanged = function(targetEntity, name, value, oldValue2) {
  134104. if (defined_default(this._targetProperty) && this._targetPropertyNames[0] === name) {
  134105. this._targetProperty = void 0;
  134106. this._definitionChanged.raiseEvent(this);
  134107. }
  134108. };
  134109. ReferenceProperty.prototype._onCollectionChanged = function(collection, added, removed) {
  134110. let targetEntity = this._targetEntity;
  134111. if (defined_default(targetEntity) && removed.indexOf(targetEntity) !== -1) {
  134112. targetEntity.definitionChanged.removeEventListener(
  134113. ReferenceProperty.prototype._onTargetEntityDefinitionChanged,
  134114. this
  134115. );
  134116. this._targetEntity = this._targetProperty = void 0;
  134117. } else if (!defined_default(targetEntity)) {
  134118. targetEntity = resolve(this);
  134119. if (defined_default(targetEntity)) {
  134120. this._definitionChanged.raiseEvent(this);
  134121. }
  134122. }
  134123. };
  134124. var ReferenceProperty_default = ReferenceProperty;
  134125. // node_modules/cesium/Source/DataSources/Rotation.js
  134126. var Rotation = {
  134127. packedLength: 1,
  134128. pack: function(value, array, startingIndex) {
  134129. if (!defined_default(value)) {
  134130. throw new DeveloperError_default("value is required");
  134131. }
  134132. if (!defined_default(array)) {
  134133. throw new DeveloperError_default("array is required");
  134134. }
  134135. startingIndex = defaultValue_default(startingIndex, 0);
  134136. array[startingIndex] = value;
  134137. return array;
  134138. },
  134139. unpack: function(array, startingIndex, result) {
  134140. if (!defined_default(array)) {
  134141. throw new DeveloperError_default("array is required");
  134142. }
  134143. startingIndex = defaultValue_default(startingIndex, 0);
  134144. return array[startingIndex];
  134145. },
  134146. convertPackedArrayForInterpolation: function(packedArray, startingIndex, lastIndex, result) {
  134147. if (!defined_default(packedArray)) {
  134148. throw new DeveloperError_default("packedArray is required");
  134149. }
  134150. if (!defined_default(result)) {
  134151. result = [];
  134152. }
  134153. startingIndex = defaultValue_default(startingIndex, 0);
  134154. lastIndex = defaultValue_default(lastIndex, packedArray.length);
  134155. let previousValue;
  134156. for (let i2 = 0, len = lastIndex - startingIndex + 1; i2 < len; i2++) {
  134157. const value = packedArray[startingIndex + i2];
  134158. if (i2 === 0 || Math.abs(previousValue - value) < Math.PI) {
  134159. result[i2] = value;
  134160. } else {
  134161. result[i2] = value - Math_default.TWO_PI;
  134162. }
  134163. previousValue = value;
  134164. }
  134165. },
  134166. unpackInterpolationResult: function(array, sourceArray, firstIndex, lastIndex, result) {
  134167. if (!defined_default(array)) {
  134168. throw new DeveloperError_default("array is required");
  134169. }
  134170. if (!defined_default(sourceArray)) {
  134171. throw new DeveloperError_default("sourceArray is required");
  134172. }
  134173. result = array[0];
  134174. if (result < 0) {
  134175. return result + Math_default.TWO_PI;
  134176. }
  134177. return result;
  134178. }
  134179. };
  134180. var Rotation_default = Rotation;
  134181. // node_modules/cesium/Source/DataSources/SampledProperty.js
  134182. var PackableNumber = {
  134183. packedLength: 1,
  134184. pack: function(value, array, startingIndex) {
  134185. startingIndex = defaultValue_default(startingIndex, 0);
  134186. array[startingIndex] = value;
  134187. },
  134188. unpack: function(array, startingIndex, result) {
  134189. startingIndex = defaultValue_default(startingIndex, 0);
  134190. return array[startingIndex];
  134191. }
  134192. };
  134193. function arrayInsert(array, startIndex, items) {
  134194. let i2;
  134195. const arrayLength = array.length;
  134196. const itemsLength = items.length;
  134197. const newLength = arrayLength + itemsLength;
  134198. array.length = newLength;
  134199. if (arrayLength !== startIndex) {
  134200. let q = arrayLength - 1;
  134201. for (i2 = newLength - 1; i2 >= startIndex; i2--) {
  134202. array[i2] = array[q--];
  134203. }
  134204. }
  134205. for (i2 = 0; i2 < itemsLength; i2++) {
  134206. array[startIndex++] = items[i2];
  134207. }
  134208. }
  134209. function convertDate(date, epoch2) {
  134210. if (date instanceof JulianDate_default) {
  134211. return date;
  134212. }
  134213. if (typeof date === "string") {
  134214. return JulianDate_default.fromIso8601(date);
  134215. }
  134216. return JulianDate_default.addSeconds(epoch2, date, new JulianDate_default());
  134217. }
  134218. var timesSpliceArgs = [];
  134219. var valuesSpliceArgs = [];
  134220. function mergeNewSamples(epoch2, times, values, newData, packedLength) {
  134221. let newDataIndex = 0;
  134222. let i2;
  134223. let prevItem;
  134224. let timesInsertionPoint;
  134225. let valuesInsertionPoint;
  134226. let currentTime;
  134227. let nextTime;
  134228. while (newDataIndex < newData.length) {
  134229. currentTime = convertDate(newData[newDataIndex], epoch2);
  134230. timesInsertionPoint = binarySearch_default(times, currentTime, JulianDate_default.compare);
  134231. let timesSpliceArgsCount = 0;
  134232. let valuesSpliceArgsCount = 0;
  134233. if (timesInsertionPoint < 0) {
  134234. timesInsertionPoint = ~timesInsertionPoint;
  134235. valuesInsertionPoint = timesInsertionPoint * packedLength;
  134236. prevItem = void 0;
  134237. nextTime = times[timesInsertionPoint];
  134238. while (newDataIndex < newData.length) {
  134239. currentTime = convertDate(newData[newDataIndex], epoch2);
  134240. if (defined_default(prevItem) && JulianDate_default.compare(prevItem, currentTime) >= 0 || defined_default(nextTime) && JulianDate_default.compare(currentTime, nextTime) >= 0) {
  134241. break;
  134242. }
  134243. timesSpliceArgs[timesSpliceArgsCount++] = currentTime;
  134244. newDataIndex = newDataIndex + 1;
  134245. for (i2 = 0; i2 < packedLength; i2++) {
  134246. valuesSpliceArgs[valuesSpliceArgsCount++] = newData[newDataIndex];
  134247. newDataIndex = newDataIndex + 1;
  134248. }
  134249. prevItem = currentTime;
  134250. }
  134251. if (timesSpliceArgsCount > 0) {
  134252. valuesSpliceArgs.length = valuesSpliceArgsCount;
  134253. arrayInsert(values, valuesInsertionPoint, valuesSpliceArgs);
  134254. timesSpliceArgs.length = timesSpliceArgsCount;
  134255. arrayInsert(times, timesInsertionPoint, timesSpliceArgs);
  134256. }
  134257. } else {
  134258. for (i2 = 0; i2 < packedLength; i2++) {
  134259. newDataIndex++;
  134260. values[timesInsertionPoint * packedLength + i2] = newData[newDataIndex];
  134261. }
  134262. newDataIndex++;
  134263. }
  134264. }
  134265. }
  134266. function SampledProperty(type, derivativeTypes) {
  134267. Check_default.defined("type", type);
  134268. let innerType = type;
  134269. if (innerType === Number) {
  134270. innerType = PackableNumber;
  134271. }
  134272. let packedLength = innerType.packedLength;
  134273. let packedInterpolationLength = defaultValue_default(
  134274. innerType.packedInterpolationLength,
  134275. packedLength
  134276. );
  134277. let inputOrder = 0;
  134278. let innerDerivativeTypes;
  134279. if (defined_default(derivativeTypes)) {
  134280. const length3 = derivativeTypes.length;
  134281. innerDerivativeTypes = new Array(length3);
  134282. for (let i2 = 0; i2 < length3; i2++) {
  134283. let derivativeType = derivativeTypes[i2];
  134284. if (derivativeType === Number) {
  134285. derivativeType = PackableNumber;
  134286. }
  134287. const derivativePackedLength = derivativeType.packedLength;
  134288. packedLength += derivativePackedLength;
  134289. packedInterpolationLength += defaultValue_default(
  134290. derivativeType.packedInterpolationLength,
  134291. derivativePackedLength
  134292. );
  134293. innerDerivativeTypes[i2] = derivativeType;
  134294. }
  134295. inputOrder = length3;
  134296. }
  134297. this._type = type;
  134298. this._innerType = innerType;
  134299. this._interpolationDegree = 1;
  134300. this._interpolationAlgorithm = LinearApproximation_default;
  134301. this._numberOfPoints = 0;
  134302. this._times = [];
  134303. this._values = [];
  134304. this._xTable = [];
  134305. this._yTable = [];
  134306. this._packedLength = packedLength;
  134307. this._packedInterpolationLength = packedInterpolationLength;
  134308. this._updateTableLength = true;
  134309. this._interpolationResult = new Array(packedInterpolationLength);
  134310. this._definitionChanged = new Event_default();
  134311. this._derivativeTypes = derivativeTypes;
  134312. this._innerDerivativeTypes = innerDerivativeTypes;
  134313. this._inputOrder = inputOrder;
  134314. this._forwardExtrapolationType = ExtrapolationType_default.NONE;
  134315. this._forwardExtrapolationDuration = 0;
  134316. this._backwardExtrapolationType = ExtrapolationType_default.NONE;
  134317. this._backwardExtrapolationDuration = 0;
  134318. }
  134319. Object.defineProperties(SampledProperty.prototype, {
  134320. isConstant: {
  134321. get: function() {
  134322. return this._values.length === 0;
  134323. }
  134324. },
  134325. definitionChanged: {
  134326. get: function() {
  134327. return this._definitionChanged;
  134328. }
  134329. },
  134330. type: {
  134331. get: function() {
  134332. return this._type;
  134333. }
  134334. },
  134335. derivativeTypes: {
  134336. get: function() {
  134337. return this._derivativeTypes;
  134338. }
  134339. },
  134340. interpolationDegree: {
  134341. get: function() {
  134342. return this._interpolationDegree;
  134343. }
  134344. },
  134345. interpolationAlgorithm: {
  134346. get: function() {
  134347. return this._interpolationAlgorithm;
  134348. }
  134349. },
  134350. forwardExtrapolationType: {
  134351. get: function() {
  134352. return this._forwardExtrapolationType;
  134353. },
  134354. set: function(value) {
  134355. if (this._forwardExtrapolationType !== value) {
  134356. this._forwardExtrapolationType = value;
  134357. this._definitionChanged.raiseEvent(this);
  134358. }
  134359. }
  134360. },
  134361. forwardExtrapolationDuration: {
  134362. get: function() {
  134363. return this._forwardExtrapolationDuration;
  134364. },
  134365. set: function(value) {
  134366. if (this._forwardExtrapolationDuration !== value) {
  134367. this._forwardExtrapolationDuration = value;
  134368. this._definitionChanged.raiseEvent(this);
  134369. }
  134370. }
  134371. },
  134372. backwardExtrapolationType: {
  134373. get: function() {
  134374. return this._backwardExtrapolationType;
  134375. },
  134376. set: function(value) {
  134377. if (this._backwardExtrapolationType !== value) {
  134378. this._backwardExtrapolationType = value;
  134379. this._definitionChanged.raiseEvent(this);
  134380. }
  134381. }
  134382. },
  134383. backwardExtrapolationDuration: {
  134384. get: function() {
  134385. return this._backwardExtrapolationDuration;
  134386. },
  134387. set: function(value) {
  134388. if (this._backwardExtrapolationDuration !== value) {
  134389. this._backwardExtrapolationDuration = value;
  134390. this._definitionChanged.raiseEvent(this);
  134391. }
  134392. }
  134393. }
  134394. });
  134395. SampledProperty.prototype.getValue = function(time, result) {
  134396. Check_default.defined("time", time);
  134397. const times = this._times;
  134398. const timesLength = times.length;
  134399. if (timesLength === 0) {
  134400. return void 0;
  134401. }
  134402. let timeout;
  134403. const innerType = this._innerType;
  134404. const values = this._values;
  134405. let index2 = binarySearch_default(times, time, JulianDate_default.compare);
  134406. if (index2 < 0) {
  134407. index2 = ~index2;
  134408. if (index2 === 0) {
  134409. const startTime = times[index2];
  134410. timeout = this._backwardExtrapolationDuration;
  134411. if (this._backwardExtrapolationType === ExtrapolationType_default.NONE || timeout !== 0 && JulianDate_default.secondsDifference(startTime, time) > timeout) {
  134412. return void 0;
  134413. }
  134414. if (this._backwardExtrapolationType === ExtrapolationType_default.HOLD) {
  134415. return innerType.unpack(values, 0, result);
  134416. }
  134417. }
  134418. if (index2 >= timesLength) {
  134419. index2 = timesLength - 1;
  134420. const endTime = times[index2];
  134421. timeout = this._forwardExtrapolationDuration;
  134422. if (this._forwardExtrapolationType === ExtrapolationType_default.NONE || timeout !== 0 && JulianDate_default.secondsDifference(time, endTime) > timeout) {
  134423. return void 0;
  134424. }
  134425. if (this._forwardExtrapolationType === ExtrapolationType_default.HOLD) {
  134426. index2 = timesLength - 1;
  134427. return innerType.unpack(values, index2 * innerType.packedLength, result);
  134428. }
  134429. }
  134430. const xTable = this._xTable;
  134431. const yTable = this._yTable;
  134432. const interpolationAlgorithm = this._interpolationAlgorithm;
  134433. const packedInterpolationLength = this._packedInterpolationLength;
  134434. const inputOrder = this._inputOrder;
  134435. if (this._updateTableLength) {
  134436. this._updateTableLength = false;
  134437. const numberOfPoints = Math.min(
  134438. interpolationAlgorithm.getRequiredDataPoints(
  134439. this._interpolationDegree,
  134440. inputOrder
  134441. ),
  134442. timesLength
  134443. );
  134444. if (numberOfPoints !== this._numberOfPoints) {
  134445. this._numberOfPoints = numberOfPoints;
  134446. xTable.length = numberOfPoints;
  134447. yTable.length = numberOfPoints * packedInterpolationLength;
  134448. }
  134449. }
  134450. const degree = this._numberOfPoints - 1;
  134451. if (degree < 1) {
  134452. return void 0;
  134453. }
  134454. let firstIndex = 0;
  134455. let lastIndex = timesLength - 1;
  134456. const pointsInCollection = lastIndex - firstIndex + 1;
  134457. if (pointsInCollection >= degree + 1) {
  134458. let computedFirstIndex = index2 - (degree / 2 | 0) - 1;
  134459. if (computedFirstIndex < firstIndex) {
  134460. computedFirstIndex = firstIndex;
  134461. }
  134462. let computedLastIndex = computedFirstIndex + degree;
  134463. if (computedLastIndex > lastIndex) {
  134464. computedLastIndex = lastIndex;
  134465. computedFirstIndex = computedLastIndex - degree;
  134466. if (computedFirstIndex < firstIndex) {
  134467. computedFirstIndex = firstIndex;
  134468. }
  134469. }
  134470. firstIndex = computedFirstIndex;
  134471. lastIndex = computedLastIndex;
  134472. }
  134473. const length3 = lastIndex - firstIndex + 1;
  134474. for (let i2 = 0; i2 < length3; ++i2) {
  134475. xTable[i2] = JulianDate_default.secondsDifference(
  134476. times[firstIndex + i2],
  134477. times[lastIndex]
  134478. );
  134479. }
  134480. if (!defined_default(innerType.convertPackedArrayForInterpolation)) {
  134481. let destinationIndex = 0;
  134482. const packedLength = this._packedLength;
  134483. let sourceIndex = firstIndex * packedLength;
  134484. const stop2 = (lastIndex + 1) * packedLength;
  134485. while (sourceIndex < stop2) {
  134486. yTable[destinationIndex] = values[sourceIndex];
  134487. sourceIndex++;
  134488. destinationIndex++;
  134489. }
  134490. } else {
  134491. innerType.convertPackedArrayForInterpolation(
  134492. values,
  134493. firstIndex,
  134494. lastIndex,
  134495. yTable
  134496. );
  134497. }
  134498. const x = JulianDate_default.secondsDifference(time, times[lastIndex]);
  134499. let interpolationResult;
  134500. if (inputOrder === 0 || !defined_default(interpolationAlgorithm.interpolate)) {
  134501. interpolationResult = interpolationAlgorithm.interpolateOrderZero(
  134502. x,
  134503. xTable,
  134504. yTable,
  134505. packedInterpolationLength,
  134506. this._interpolationResult
  134507. );
  134508. } else {
  134509. const yStride = Math.floor(packedInterpolationLength / (inputOrder + 1));
  134510. interpolationResult = interpolationAlgorithm.interpolate(
  134511. x,
  134512. xTable,
  134513. yTable,
  134514. yStride,
  134515. inputOrder,
  134516. inputOrder,
  134517. this._interpolationResult
  134518. );
  134519. }
  134520. if (!defined_default(innerType.unpackInterpolationResult)) {
  134521. return innerType.unpack(interpolationResult, 0, result);
  134522. }
  134523. return innerType.unpackInterpolationResult(
  134524. interpolationResult,
  134525. values,
  134526. firstIndex,
  134527. lastIndex,
  134528. result
  134529. );
  134530. }
  134531. return innerType.unpack(values, index2 * this._packedLength, result);
  134532. };
  134533. SampledProperty.prototype.setInterpolationOptions = function(options) {
  134534. if (!defined_default(options)) {
  134535. return;
  134536. }
  134537. let valuesChanged = false;
  134538. const interpolationAlgorithm = options.interpolationAlgorithm;
  134539. const interpolationDegree = options.interpolationDegree;
  134540. if (defined_default(interpolationAlgorithm) && this._interpolationAlgorithm !== interpolationAlgorithm) {
  134541. this._interpolationAlgorithm = interpolationAlgorithm;
  134542. valuesChanged = true;
  134543. }
  134544. if (defined_default(interpolationDegree) && this._interpolationDegree !== interpolationDegree) {
  134545. this._interpolationDegree = interpolationDegree;
  134546. valuesChanged = true;
  134547. }
  134548. if (valuesChanged) {
  134549. this._updateTableLength = true;
  134550. this._definitionChanged.raiseEvent(this);
  134551. }
  134552. };
  134553. SampledProperty.prototype.addSample = function(time, value, derivatives) {
  134554. const innerDerivativeTypes = this._innerDerivativeTypes;
  134555. const hasDerivatives = defined_default(innerDerivativeTypes);
  134556. Check_default.defined("time", time);
  134557. Check_default.defined("value", value);
  134558. if (hasDerivatives) {
  134559. Check_default.defined("derivatives", derivatives);
  134560. }
  134561. const innerType = this._innerType;
  134562. const data = [];
  134563. data.push(time);
  134564. innerType.pack(value, data, data.length);
  134565. if (hasDerivatives) {
  134566. const derivativesLength = innerDerivativeTypes.length;
  134567. for (let x = 0; x < derivativesLength; x++) {
  134568. innerDerivativeTypes[x].pack(derivatives[x], data, data.length);
  134569. }
  134570. }
  134571. mergeNewSamples(
  134572. void 0,
  134573. this._times,
  134574. this._values,
  134575. data,
  134576. this._packedLength
  134577. );
  134578. this._updateTableLength = true;
  134579. this._definitionChanged.raiseEvent(this);
  134580. };
  134581. SampledProperty.prototype.addSamples = function(times, values, derivativeValues) {
  134582. const innerDerivativeTypes = this._innerDerivativeTypes;
  134583. const hasDerivatives = defined_default(innerDerivativeTypes);
  134584. Check_default.defined("times", times);
  134585. Check_default.defined("values", values);
  134586. if (times.length !== values.length) {
  134587. throw new DeveloperError_default("times and values must be the same length.");
  134588. }
  134589. if (hasDerivatives && (!defined_default(derivativeValues) || derivativeValues.length !== times.length)) {
  134590. throw new DeveloperError_default(
  134591. "times and derivativeValues must be the same length."
  134592. );
  134593. }
  134594. const innerType = this._innerType;
  134595. const length3 = times.length;
  134596. const data = [];
  134597. for (let i2 = 0; i2 < length3; i2++) {
  134598. data.push(times[i2]);
  134599. innerType.pack(values[i2], data, data.length);
  134600. if (hasDerivatives) {
  134601. const derivatives = derivativeValues[i2];
  134602. const derivativesLength = innerDerivativeTypes.length;
  134603. for (let x = 0; x < derivativesLength; x++) {
  134604. innerDerivativeTypes[x].pack(derivatives[x], data, data.length);
  134605. }
  134606. }
  134607. }
  134608. mergeNewSamples(
  134609. void 0,
  134610. this._times,
  134611. this._values,
  134612. data,
  134613. this._packedLength
  134614. );
  134615. this._updateTableLength = true;
  134616. this._definitionChanged.raiseEvent(this);
  134617. };
  134618. SampledProperty.prototype.addSamplesPackedArray = function(packedSamples, epoch2) {
  134619. Check_default.defined("packedSamples", packedSamples);
  134620. mergeNewSamples(
  134621. epoch2,
  134622. this._times,
  134623. this._values,
  134624. packedSamples,
  134625. this._packedLength
  134626. );
  134627. this._updateTableLength = true;
  134628. this._definitionChanged.raiseEvent(this);
  134629. };
  134630. SampledProperty.prototype.removeSample = function(time) {
  134631. Check_default.defined("time", time);
  134632. const index2 = binarySearch_default(this._times, time, JulianDate_default.compare);
  134633. if (index2 < 0) {
  134634. return false;
  134635. }
  134636. removeSamples(this, index2, 1);
  134637. return true;
  134638. };
  134639. function removeSamples(property, startIndex, numberToRemove) {
  134640. const packedLength = property._packedLength;
  134641. property._times.splice(startIndex, numberToRemove);
  134642. property._values.splice(
  134643. startIndex * packedLength,
  134644. numberToRemove * packedLength
  134645. );
  134646. property._updateTableLength = true;
  134647. property._definitionChanged.raiseEvent(property);
  134648. }
  134649. SampledProperty.prototype.removeSamples = function(timeInterval) {
  134650. Check_default.defined("timeInterval", timeInterval);
  134651. const times = this._times;
  134652. let startIndex = binarySearch_default(times, timeInterval.start, JulianDate_default.compare);
  134653. if (startIndex < 0) {
  134654. startIndex = ~startIndex;
  134655. } else if (!timeInterval.isStartIncluded) {
  134656. ++startIndex;
  134657. }
  134658. let stopIndex = binarySearch_default(times, timeInterval.stop, JulianDate_default.compare);
  134659. if (stopIndex < 0) {
  134660. stopIndex = ~stopIndex;
  134661. } else if (timeInterval.isStopIncluded) {
  134662. ++stopIndex;
  134663. }
  134664. removeSamples(this, startIndex, stopIndex - startIndex);
  134665. };
  134666. SampledProperty.prototype.equals = function(other) {
  134667. if (this === other) {
  134668. return true;
  134669. }
  134670. if (!defined_default(other)) {
  134671. return false;
  134672. }
  134673. if (this._type !== other._type || this._interpolationDegree !== other._interpolationDegree || this._interpolationAlgorithm !== other._interpolationAlgorithm) {
  134674. return false;
  134675. }
  134676. const derivativeTypes = this._derivativeTypes;
  134677. const hasDerivatives = defined_default(derivativeTypes);
  134678. const otherDerivativeTypes = other._derivativeTypes;
  134679. const otherHasDerivatives = defined_default(otherDerivativeTypes);
  134680. if (hasDerivatives !== otherHasDerivatives) {
  134681. return false;
  134682. }
  134683. let i2;
  134684. let length3;
  134685. if (hasDerivatives) {
  134686. length3 = derivativeTypes.length;
  134687. if (length3 !== otherDerivativeTypes.length) {
  134688. return false;
  134689. }
  134690. for (i2 = 0; i2 < length3; i2++) {
  134691. if (derivativeTypes[i2] !== otherDerivativeTypes[i2]) {
  134692. return false;
  134693. }
  134694. }
  134695. }
  134696. const times = this._times;
  134697. const otherTimes = other._times;
  134698. length3 = times.length;
  134699. if (length3 !== otherTimes.length) {
  134700. return false;
  134701. }
  134702. for (i2 = 0; i2 < length3; i2++) {
  134703. if (!JulianDate_default.equals(times[i2], otherTimes[i2])) {
  134704. return false;
  134705. }
  134706. }
  134707. const values = this._values;
  134708. const otherValues = other._values;
  134709. length3 = values.length;
  134710. for (i2 = 0; i2 < length3; i2++) {
  134711. if (values[i2] !== otherValues[i2]) {
  134712. return false;
  134713. }
  134714. }
  134715. return true;
  134716. };
  134717. SampledProperty._mergeNewSamples = mergeNewSamples;
  134718. var SampledProperty_default = SampledProperty;
  134719. // node_modules/cesium/Source/DataSources/SampledPositionProperty.js
  134720. function SampledPositionProperty(referenceFrame, numberOfDerivatives) {
  134721. numberOfDerivatives = defaultValue_default(numberOfDerivatives, 0);
  134722. let derivativeTypes;
  134723. if (numberOfDerivatives > 0) {
  134724. derivativeTypes = new Array(numberOfDerivatives);
  134725. for (let i2 = 0; i2 < numberOfDerivatives; i2++) {
  134726. derivativeTypes[i2] = Cartesian3_default;
  134727. }
  134728. }
  134729. this._numberOfDerivatives = numberOfDerivatives;
  134730. this._property = new SampledProperty_default(Cartesian3_default, derivativeTypes);
  134731. this._definitionChanged = new Event_default();
  134732. this._referenceFrame = defaultValue_default(referenceFrame, ReferenceFrame_default.FIXED);
  134733. this._property._definitionChanged.addEventListener(function() {
  134734. this._definitionChanged.raiseEvent(this);
  134735. }, this);
  134736. }
  134737. Object.defineProperties(SampledPositionProperty.prototype, {
  134738. isConstant: {
  134739. get: function() {
  134740. return this._property.isConstant;
  134741. }
  134742. },
  134743. definitionChanged: {
  134744. get: function() {
  134745. return this._definitionChanged;
  134746. }
  134747. },
  134748. referenceFrame: {
  134749. get: function() {
  134750. return this._referenceFrame;
  134751. }
  134752. },
  134753. interpolationDegree: {
  134754. get: function() {
  134755. return this._property.interpolationDegree;
  134756. }
  134757. },
  134758. interpolationAlgorithm: {
  134759. get: function() {
  134760. return this._property.interpolationAlgorithm;
  134761. }
  134762. },
  134763. numberOfDerivatives: {
  134764. get: function() {
  134765. return this._numberOfDerivatives;
  134766. }
  134767. },
  134768. forwardExtrapolationType: {
  134769. get: function() {
  134770. return this._property.forwardExtrapolationType;
  134771. },
  134772. set: function(value) {
  134773. this._property.forwardExtrapolationType = value;
  134774. }
  134775. },
  134776. forwardExtrapolationDuration: {
  134777. get: function() {
  134778. return this._property.forwardExtrapolationDuration;
  134779. },
  134780. set: function(value) {
  134781. this._property.forwardExtrapolationDuration = value;
  134782. }
  134783. },
  134784. backwardExtrapolationType: {
  134785. get: function() {
  134786. return this._property.backwardExtrapolationType;
  134787. },
  134788. set: function(value) {
  134789. this._property.backwardExtrapolationType = value;
  134790. }
  134791. },
  134792. backwardExtrapolationDuration: {
  134793. get: function() {
  134794. return this._property.backwardExtrapolationDuration;
  134795. },
  134796. set: function(value) {
  134797. this._property.backwardExtrapolationDuration = value;
  134798. }
  134799. }
  134800. });
  134801. SampledPositionProperty.prototype.getValue = function(time, result) {
  134802. return this.getValueInReferenceFrame(time, ReferenceFrame_default.FIXED, result);
  134803. };
  134804. SampledPositionProperty.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) {
  134805. Check_default.defined("time", time);
  134806. Check_default.defined("referenceFrame", referenceFrame);
  134807. result = this._property.getValue(time, result);
  134808. if (defined_default(result)) {
  134809. return PositionProperty_default.convertToReferenceFrame(
  134810. time,
  134811. result,
  134812. this._referenceFrame,
  134813. referenceFrame,
  134814. result
  134815. );
  134816. }
  134817. return void 0;
  134818. };
  134819. SampledPositionProperty.prototype.setInterpolationOptions = function(options) {
  134820. this._property.setInterpolationOptions(options);
  134821. };
  134822. SampledPositionProperty.prototype.addSample = function(time, position, derivatives) {
  134823. const numberOfDerivatives = this._numberOfDerivatives;
  134824. if (numberOfDerivatives > 0 && (!defined_default(derivatives) || derivatives.length !== numberOfDerivatives)) {
  134825. throw new DeveloperError_default(
  134826. "derivatives length must be equal to the number of derivatives."
  134827. );
  134828. }
  134829. this._property.addSample(time, position, derivatives);
  134830. };
  134831. SampledPositionProperty.prototype.addSamples = function(times, positions, derivatives) {
  134832. this._property.addSamples(times, positions, derivatives);
  134833. };
  134834. SampledPositionProperty.prototype.addSamplesPackedArray = function(packedSamples, epoch2) {
  134835. this._property.addSamplesPackedArray(packedSamples, epoch2);
  134836. };
  134837. SampledPositionProperty.prototype.removeSample = function(time) {
  134838. return this._property.removeSample(time);
  134839. };
  134840. SampledPositionProperty.prototype.removeSamples = function(timeInterval) {
  134841. this._property.removeSamples(timeInterval);
  134842. };
  134843. SampledPositionProperty.prototype.equals = function(other) {
  134844. return this === other || other instanceof SampledPositionProperty && Property_default.equals(this._property, other._property) && this._referenceFrame === other._referenceFrame;
  134845. };
  134846. var SampledPositionProperty_default = SampledPositionProperty;
  134847. // node_modules/cesium/Source/DataSources/StripeOrientation.js
  134848. var StripeOrientation = {
  134849. HORIZONTAL: 0,
  134850. VERTICAL: 1
  134851. };
  134852. var StripeOrientation_default = Object.freeze(StripeOrientation);
  134853. // node_modules/cesium/Source/DataSources/StripeMaterialProperty.js
  134854. var defaultOrientation = StripeOrientation_default.HORIZONTAL;
  134855. var defaultEvenColor2 = Color_default.WHITE;
  134856. var defaultOddColor2 = Color_default.BLACK;
  134857. var defaultOffset4 = 0;
  134858. var defaultRepeat3 = 1;
  134859. function StripeMaterialProperty(options) {
  134860. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  134861. this._definitionChanged = new Event_default();
  134862. this._orientation = void 0;
  134863. this._orientationSubscription = void 0;
  134864. this._evenColor = void 0;
  134865. this._evenColorSubscription = void 0;
  134866. this._oddColor = void 0;
  134867. this._oddColorSubscription = void 0;
  134868. this._offset = void 0;
  134869. this._offsetSubscription = void 0;
  134870. this._repeat = void 0;
  134871. this._repeatSubscription = void 0;
  134872. this.orientation = options.orientation;
  134873. this.evenColor = options.evenColor;
  134874. this.oddColor = options.oddColor;
  134875. this.offset = options.offset;
  134876. this.repeat = options.repeat;
  134877. }
  134878. Object.defineProperties(StripeMaterialProperty.prototype, {
  134879. isConstant: {
  134880. get: function() {
  134881. return Property_default.isConstant(this._orientation) && Property_default.isConstant(this._evenColor) && Property_default.isConstant(this._oddColor) && Property_default.isConstant(this._offset) && Property_default.isConstant(this._repeat);
  134882. }
  134883. },
  134884. definitionChanged: {
  134885. get: function() {
  134886. return this._definitionChanged;
  134887. }
  134888. },
  134889. orientation: createPropertyDescriptor_default("orientation"),
  134890. evenColor: createPropertyDescriptor_default("evenColor"),
  134891. oddColor: createPropertyDescriptor_default("oddColor"),
  134892. offset: createPropertyDescriptor_default("offset"),
  134893. repeat: createPropertyDescriptor_default("repeat")
  134894. });
  134895. StripeMaterialProperty.prototype.getType = function(time) {
  134896. return "Stripe";
  134897. };
  134898. StripeMaterialProperty.prototype.getValue = function(time, result) {
  134899. if (!defined_default(result)) {
  134900. result = {};
  134901. }
  134902. result.horizontal = Property_default.getValueOrDefault(this._orientation, time, defaultOrientation) === StripeOrientation_default.HORIZONTAL;
  134903. result.evenColor = Property_default.getValueOrClonedDefault(
  134904. this._evenColor,
  134905. time,
  134906. defaultEvenColor2,
  134907. result.evenColor
  134908. );
  134909. result.oddColor = Property_default.getValueOrClonedDefault(
  134910. this._oddColor,
  134911. time,
  134912. defaultOddColor2,
  134913. result.oddColor
  134914. );
  134915. result.offset = Property_default.getValueOrDefault(this._offset, time, defaultOffset4);
  134916. result.repeat = Property_default.getValueOrDefault(this._repeat, time, defaultRepeat3);
  134917. return result;
  134918. };
  134919. StripeMaterialProperty.prototype.equals = function(other) {
  134920. return this === other || other instanceof StripeMaterialProperty && Property_default.equals(this._orientation, other._orientation) && Property_default.equals(this._evenColor, other._evenColor) && Property_default.equals(this._oddColor, other._oddColor) && Property_default.equals(this._offset, other._offset) && Property_default.equals(this._repeat, other._repeat);
  134921. };
  134922. var StripeMaterialProperty_default = StripeMaterialProperty;
  134923. // node_modules/cesium/Source/DataSources/TimeIntervalCollectionPositionProperty.js
  134924. function TimeIntervalCollectionPositionProperty(referenceFrame) {
  134925. this._definitionChanged = new Event_default();
  134926. this._intervals = new TimeIntervalCollection_default();
  134927. this._intervals.changedEvent.addEventListener(
  134928. TimeIntervalCollectionPositionProperty.prototype._intervalsChanged,
  134929. this
  134930. );
  134931. this._referenceFrame = defaultValue_default(referenceFrame, ReferenceFrame_default.FIXED);
  134932. }
  134933. Object.defineProperties(TimeIntervalCollectionPositionProperty.prototype, {
  134934. isConstant: {
  134935. get: function() {
  134936. return this._intervals.isEmpty;
  134937. }
  134938. },
  134939. definitionChanged: {
  134940. get: function() {
  134941. return this._definitionChanged;
  134942. }
  134943. },
  134944. intervals: {
  134945. get: function() {
  134946. return this._intervals;
  134947. }
  134948. },
  134949. referenceFrame: {
  134950. get: function() {
  134951. return this._referenceFrame;
  134952. }
  134953. }
  134954. });
  134955. TimeIntervalCollectionPositionProperty.prototype.getValue = function(time, result) {
  134956. return this.getValueInReferenceFrame(time, ReferenceFrame_default.FIXED, result);
  134957. };
  134958. TimeIntervalCollectionPositionProperty.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) {
  134959. if (!defined_default(time)) {
  134960. throw new DeveloperError_default("time is required.");
  134961. }
  134962. if (!defined_default(referenceFrame)) {
  134963. throw new DeveloperError_default("referenceFrame is required.");
  134964. }
  134965. const position = this._intervals.findDataForIntervalContainingDate(time);
  134966. if (defined_default(position)) {
  134967. return PositionProperty_default.convertToReferenceFrame(
  134968. time,
  134969. position,
  134970. this._referenceFrame,
  134971. referenceFrame,
  134972. result
  134973. );
  134974. }
  134975. return void 0;
  134976. };
  134977. TimeIntervalCollectionPositionProperty.prototype.equals = function(other) {
  134978. return this === other || other instanceof TimeIntervalCollectionPositionProperty && this._intervals.equals(other._intervals, Property_default.equals) && this._referenceFrame === other._referenceFrame;
  134979. };
  134980. TimeIntervalCollectionPositionProperty.prototype._intervalsChanged = function() {
  134981. this._definitionChanged.raiseEvent(this);
  134982. };
  134983. var TimeIntervalCollectionPositionProperty_default = TimeIntervalCollectionPositionProperty;
  134984. // node_modules/cesium/Source/DataSources/TimeIntervalCollectionProperty.js
  134985. function TimeIntervalCollectionProperty() {
  134986. this._definitionChanged = new Event_default();
  134987. this._intervals = new TimeIntervalCollection_default();
  134988. this._intervals.changedEvent.addEventListener(
  134989. TimeIntervalCollectionProperty.prototype._intervalsChanged,
  134990. this
  134991. );
  134992. }
  134993. Object.defineProperties(TimeIntervalCollectionProperty.prototype, {
  134994. isConstant: {
  134995. get: function() {
  134996. return this._intervals.isEmpty;
  134997. }
  134998. },
  134999. definitionChanged: {
  135000. get: function() {
  135001. return this._definitionChanged;
  135002. }
  135003. },
  135004. intervals: {
  135005. get: function() {
  135006. return this._intervals;
  135007. }
  135008. }
  135009. });
  135010. TimeIntervalCollectionProperty.prototype.getValue = function(time, result) {
  135011. if (!defined_default(time)) {
  135012. throw new DeveloperError_default("time is required");
  135013. }
  135014. const value = this._intervals.findDataForIntervalContainingDate(time);
  135015. if (defined_default(value) && typeof value.clone === "function") {
  135016. return value.clone(result);
  135017. }
  135018. return value;
  135019. };
  135020. TimeIntervalCollectionProperty.prototype.equals = function(other) {
  135021. return this === other || other instanceof TimeIntervalCollectionProperty && this._intervals.equals(other._intervals, Property_default.equals);
  135022. };
  135023. TimeIntervalCollectionProperty.prototype._intervalsChanged = function() {
  135024. this._definitionChanged.raiseEvent(this);
  135025. };
  135026. var TimeIntervalCollectionProperty_default = TimeIntervalCollectionProperty;
  135027. // node_modules/cesium/Source/DataSources/VelocityVectorProperty.js
  135028. function VelocityVectorProperty(position, normalize2) {
  135029. this._position = void 0;
  135030. this._subscription = void 0;
  135031. this._definitionChanged = new Event_default();
  135032. this._normalize = defaultValue_default(normalize2, true);
  135033. this.position = position;
  135034. }
  135035. Object.defineProperties(VelocityVectorProperty.prototype, {
  135036. isConstant: {
  135037. get: function() {
  135038. return Property_default.isConstant(this._position);
  135039. }
  135040. },
  135041. definitionChanged: {
  135042. get: function() {
  135043. return this._definitionChanged;
  135044. }
  135045. },
  135046. position: {
  135047. get: function() {
  135048. return this._position;
  135049. },
  135050. set: function(value) {
  135051. const oldValue2 = this._position;
  135052. if (oldValue2 !== value) {
  135053. if (defined_default(oldValue2)) {
  135054. this._subscription();
  135055. }
  135056. this._position = value;
  135057. if (defined_default(value)) {
  135058. this._subscription = value._definitionChanged.addEventListener(
  135059. function() {
  135060. this._definitionChanged.raiseEvent(this);
  135061. },
  135062. this
  135063. );
  135064. }
  135065. this._definitionChanged.raiseEvent(this);
  135066. }
  135067. }
  135068. },
  135069. normalize: {
  135070. get: function() {
  135071. return this._normalize;
  135072. },
  135073. set: function(value) {
  135074. if (this._normalize === value) {
  135075. return;
  135076. }
  135077. this._normalize = value;
  135078. this._definitionChanged.raiseEvent(this);
  135079. }
  135080. }
  135081. });
  135082. var position1Scratch = new Cartesian3_default();
  135083. var position2Scratch = new Cartesian3_default();
  135084. var timeScratch = new JulianDate_default();
  135085. var step = 1 / 60;
  135086. VelocityVectorProperty.prototype.getValue = function(time, result) {
  135087. return this._getValue(time, result);
  135088. };
  135089. VelocityVectorProperty.prototype._getValue = function(time, velocityResult, positionResult) {
  135090. if (!defined_default(time)) {
  135091. throw new DeveloperError_default("time is required");
  135092. }
  135093. if (!defined_default(velocityResult)) {
  135094. velocityResult = new Cartesian3_default();
  135095. }
  135096. const property = this._position;
  135097. if (Property_default.isConstant(property)) {
  135098. return this._normalize ? void 0 : Cartesian3_default.clone(Cartesian3_default.ZERO, velocityResult);
  135099. }
  135100. let position1 = property.getValue(time, position1Scratch);
  135101. let position2 = property.getValue(
  135102. JulianDate_default.addSeconds(time, step, timeScratch),
  135103. position2Scratch
  135104. );
  135105. if (!defined_default(position1)) {
  135106. return void 0;
  135107. }
  135108. if (!defined_default(position2)) {
  135109. position2 = position1;
  135110. position1 = property.getValue(
  135111. JulianDate_default.addSeconds(time, -step, timeScratch),
  135112. position2Scratch
  135113. );
  135114. if (!defined_default(position1)) {
  135115. return void 0;
  135116. }
  135117. }
  135118. if (Cartesian3_default.equals(position1, position2)) {
  135119. return this._normalize ? void 0 : Cartesian3_default.clone(Cartesian3_default.ZERO, velocityResult);
  135120. }
  135121. if (defined_default(positionResult)) {
  135122. position1.clone(positionResult);
  135123. }
  135124. const velocity = Cartesian3_default.subtract(position2, position1, velocityResult);
  135125. if (this._normalize) {
  135126. return Cartesian3_default.normalize(velocity, velocityResult);
  135127. }
  135128. return Cartesian3_default.divideByScalar(velocity, step, velocityResult);
  135129. };
  135130. VelocityVectorProperty.prototype.equals = function(other) {
  135131. return this === other || other instanceof VelocityVectorProperty && Property_default.equals(this._position, other._position);
  135132. };
  135133. var VelocityVectorProperty_default = VelocityVectorProperty;
  135134. // node_modules/cesium/Source/DataSources/VelocityOrientationProperty.js
  135135. function VelocityOrientationProperty(position, ellipsoid) {
  135136. this._velocityVectorProperty = new VelocityVectorProperty_default(position, true);
  135137. this._subscription = void 0;
  135138. this._ellipsoid = void 0;
  135139. this._definitionChanged = new Event_default();
  135140. this.ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  135141. const that = this;
  135142. this._velocityVectorProperty.definitionChanged.addEventListener(function() {
  135143. that._definitionChanged.raiseEvent(that);
  135144. });
  135145. }
  135146. Object.defineProperties(VelocityOrientationProperty.prototype, {
  135147. isConstant: {
  135148. get: function() {
  135149. return Property_default.isConstant(this._velocityVectorProperty);
  135150. }
  135151. },
  135152. definitionChanged: {
  135153. get: function() {
  135154. return this._definitionChanged;
  135155. }
  135156. },
  135157. position: {
  135158. get: function() {
  135159. return this._velocityVectorProperty.position;
  135160. },
  135161. set: function(value) {
  135162. this._velocityVectorProperty.position = value;
  135163. }
  135164. },
  135165. ellipsoid: {
  135166. get: function() {
  135167. return this._ellipsoid;
  135168. },
  135169. set: function(value) {
  135170. const oldValue2 = this._ellipsoid;
  135171. if (oldValue2 !== value) {
  135172. this._ellipsoid = value;
  135173. this._definitionChanged.raiseEvent(this);
  135174. }
  135175. }
  135176. }
  135177. });
  135178. var positionScratch10 = new Cartesian3_default();
  135179. var velocityScratch = new Cartesian3_default();
  135180. var rotationScratch2 = new Matrix3_default();
  135181. VelocityOrientationProperty.prototype.getValue = function(time, result) {
  135182. const velocity = this._velocityVectorProperty._getValue(
  135183. time,
  135184. velocityScratch,
  135185. positionScratch10
  135186. );
  135187. if (!defined_default(velocity)) {
  135188. return void 0;
  135189. }
  135190. Transforms_default.rotationMatrixFromPositionVelocity(
  135191. positionScratch10,
  135192. velocity,
  135193. this._ellipsoid,
  135194. rotationScratch2
  135195. );
  135196. return Quaternion_default.fromRotationMatrix(rotationScratch2, result);
  135197. };
  135198. VelocityOrientationProperty.prototype.equals = function(other) {
  135199. return this === other || other instanceof VelocityOrientationProperty && Property_default.equals(
  135200. this._velocityVectorProperty,
  135201. other._velocityVectorProperty
  135202. ) && (this._ellipsoid === other._ellipsoid || this._ellipsoid.equals(other._ellipsoid));
  135203. };
  135204. var VelocityOrientationProperty_default = VelocityOrientationProperty;
  135205. // node_modules/cesium/Source/DataSources/CzmlDataSource.js
  135206. function UnitCartesian3() {
  135207. }
  135208. UnitCartesian3.packedLength = Cartesian3_default.packedLength;
  135209. UnitCartesian3.unpack = Cartesian3_default.unpack;
  135210. UnitCartesian3.pack = Cartesian3_default.pack;
  135211. var currentId;
  135212. function createReferenceProperty(entityCollection, referenceString) {
  135213. if (referenceString[0] === "#") {
  135214. referenceString = currentId + referenceString;
  135215. }
  135216. return ReferenceProperty_default.fromString(entityCollection, referenceString);
  135217. }
  135218. function createSpecializedProperty(type, entityCollection, packetData) {
  135219. if (defined_default(packetData.reference)) {
  135220. return createReferenceProperty(entityCollection, packetData.reference);
  135221. }
  135222. if (defined_default(packetData.velocityReference)) {
  135223. const referenceProperty = createReferenceProperty(
  135224. entityCollection,
  135225. packetData.velocityReference
  135226. );
  135227. switch (type) {
  135228. case Cartesian3_default:
  135229. case UnitCartesian3:
  135230. return new VelocityVectorProperty_default(
  135231. referenceProperty,
  135232. type === UnitCartesian3
  135233. );
  135234. case Quaternion_default:
  135235. return new VelocityOrientationProperty_default(referenceProperty);
  135236. }
  135237. }
  135238. throw new RuntimeError_default(`${JSON.stringify(packetData)} is not valid CZML.`);
  135239. }
  135240. function createAdapterProperty(property, adapterFunction) {
  135241. return new CallbackProperty_default(function(time, result) {
  135242. return adapterFunction(property.getValue(time, result));
  135243. }, property.isConstant);
  135244. }
  135245. var scratchCartesian20 = new Cartesian3_default();
  135246. var scratchSpherical = new Spherical_default();
  135247. var scratchCartographic10 = new Cartographic_default();
  135248. var scratchTimeInterval = new TimeInterval_default();
  135249. var scratchQuaternion = new Quaternion_default();
  135250. function unwrapColorInterval(czmlInterval) {
  135251. let rgbaf = czmlInterval.rgbaf;
  135252. if (defined_default(rgbaf)) {
  135253. return rgbaf;
  135254. }
  135255. const rgba = czmlInterval.rgba;
  135256. if (!defined_default(rgba)) {
  135257. return void 0;
  135258. }
  135259. const length3 = rgba.length;
  135260. if (length3 === Color_default.packedLength) {
  135261. return [
  135262. Color_default.byteToFloat(rgba[0]),
  135263. Color_default.byteToFloat(rgba[1]),
  135264. Color_default.byteToFloat(rgba[2]),
  135265. Color_default.byteToFloat(rgba[3])
  135266. ];
  135267. }
  135268. rgbaf = new Array(length3);
  135269. for (let i2 = 0; i2 < length3; i2 += 5) {
  135270. rgbaf[i2] = rgba[i2];
  135271. rgbaf[i2 + 1] = Color_default.byteToFloat(rgba[i2 + 1]);
  135272. rgbaf[i2 + 2] = Color_default.byteToFloat(rgba[i2 + 2]);
  135273. rgbaf[i2 + 3] = Color_default.byteToFloat(rgba[i2 + 3]);
  135274. rgbaf[i2 + 4] = Color_default.byteToFloat(rgba[i2 + 4]);
  135275. }
  135276. return rgbaf;
  135277. }
  135278. function unwrapUriInterval(czmlInterval, sourceUri) {
  135279. const uri = defaultValue_default(czmlInterval.uri, czmlInterval);
  135280. if (defined_default(sourceUri)) {
  135281. return sourceUri.getDerivedResource({
  135282. url: uri
  135283. });
  135284. }
  135285. return Resource_default.createIfNeeded(uri);
  135286. }
  135287. function unwrapRectangleInterval(czmlInterval) {
  135288. let wsen = czmlInterval.wsen;
  135289. if (defined_default(wsen)) {
  135290. return wsen;
  135291. }
  135292. const wsenDegrees = czmlInterval.wsenDegrees;
  135293. if (!defined_default(wsenDegrees)) {
  135294. return void 0;
  135295. }
  135296. const length3 = wsenDegrees.length;
  135297. if (length3 === Rectangle_default.packedLength) {
  135298. return [
  135299. Math_default.toRadians(wsenDegrees[0]),
  135300. Math_default.toRadians(wsenDegrees[1]),
  135301. Math_default.toRadians(wsenDegrees[2]),
  135302. Math_default.toRadians(wsenDegrees[3])
  135303. ];
  135304. }
  135305. wsen = new Array(length3);
  135306. for (let i2 = 0; i2 < length3; i2 += 5) {
  135307. wsen[i2] = wsenDegrees[i2];
  135308. wsen[i2 + 1] = Math_default.toRadians(wsenDegrees[i2 + 1]);
  135309. wsen[i2 + 2] = Math_default.toRadians(wsenDegrees[i2 + 2]);
  135310. wsen[i2 + 3] = Math_default.toRadians(wsenDegrees[i2 + 3]);
  135311. wsen[i2 + 4] = Math_default.toRadians(wsenDegrees[i2 + 4]);
  135312. }
  135313. return wsen;
  135314. }
  135315. function convertUnitSphericalToCartesian(unitSpherical) {
  135316. const length3 = unitSpherical.length;
  135317. scratchSpherical.magnitude = 1;
  135318. if (length3 === 2) {
  135319. scratchSpherical.clock = unitSpherical[0];
  135320. scratchSpherical.cone = unitSpherical[1];
  135321. Cartesian3_default.fromSpherical(scratchSpherical, scratchCartesian20);
  135322. return [scratchCartesian20.x, scratchCartesian20.y, scratchCartesian20.z];
  135323. }
  135324. const result = new Array(length3 / 3 * 4);
  135325. for (let i2 = 0, j = 0; i2 < length3; i2 += 3, j += 4) {
  135326. result[j] = unitSpherical[i2];
  135327. scratchSpherical.clock = unitSpherical[i2 + 1];
  135328. scratchSpherical.cone = unitSpherical[i2 + 2];
  135329. Cartesian3_default.fromSpherical(scratchSpherical, scratchCartesian20);
  135330. result[j + 1] = scratchCartesian20.x;
  135331. result[j + 2] = scratchCartesian20.y;
  135332. result[j + 3] = scratchCartesian20.z;
  135333. }
  135334. return result;
  135335. }
  135336. function convertSphericalToCartesian(spherical) {
  135337. const length3 = spherical.length;
  135338. if (length3 === 3) {
  135339. scratchSpherical.clock = spherical[0];
  135340. scratchSpherical.cone = spherical[1];
  135341. scratchSpherical.magnitude = spherical[2];
  135342. Cartesian3_default.fromSpherical(scratchSpherical, scratchCartesian20);
  135343. return [scratchCartesian20.x, scratchCartesian20.y, scratchCartesian20.z];
  135344. }
  135345. const result = new Array(length3);
  135346. for (let i2 = 0; i2 < length3; i2 += 4) {
  135347. result[i2] = spherical[i2];
  135348. scratchSpherical.clock = spherical[i2 + 1];
  135349. scratchSpherical.cone = spherical[i2 + 2];
  135350. scratchSpherical.magnitude = spherical[i2 + 3];
  135351. Cartesian3_default.fromSpherical(scratchSpherical, scratchCartesian20);
  135352. result[i2 + 1] = scratchCartesian20.x;
  135353. result[i2 + 2] = scratchCartesian20.y;
  135354. result[i2 + 3] = scratchCartesian20.z;
  135355. }
  135356. return result;
  135357. }
  135358. function convertCartographicRadiansToCartesian(cartographicRadians) {
  135359. const length3 = cartographicRadians.length;
  135360. if (length3 === 3) {
  135361. scratchCartographic10.longitude = cartographicRadians[0];
  135362. scratchCartographic10.latitude = cartographicRadians[1];
  135363. scratchCartographic10.height = cartographicRadians[2];
  135364. Ellipsoid_default.WGS84.cartographicToCartesian(
  135365. scratchCartographic10,
  135366. scratchCartesian20
  135367. );
  135368. return [scratchCartesian20.x, scratchCartesian20.y, scratchCartesian20.z];
  135369. }
  135370. const result = new Array(length3);
  135371. for (let i2 = 0; i2 < length3; i2 += 4) {
  135372. result[i2] = cartographicRadians[i2];
  135373. scratchCartographic10.longitude = cartographicRadians[i2 + 1];
  135374. scratchCartographic10.latitude = cartographicRadians[i2 + 2];
  135375. scratchCartographic10.height = cartographicRadians[i2 + 3];
  135376. Ellipsoid_default.WGS84.cartographicToCartesian(
  135377. scratchCartographic10,
  135378. scratchCartesian20
  135379. );
  135380. result[i2 + 1] = scratchCartesian20.x;
  135381. result[i2 + 2] = scratchCartesian20.y;
  135382. result[i2 + 3] = scratchCartesian20.z;
  135383. }
  135384. return result;
  135385. }
  135386. function convertCartographicDegreesToCartesian(cartographicDegrees) {
  135387. const length3 = cartographicDegrees.length;
  135388. if (length3 === 3) {
  135389. scratchCartographic10.longitude = Math_default.toRadians(
  135390. cartographicDegrees[0]
  135391. );
  135392. scratchCartographic10.latitude = Math_default.toRadians(cartographicDegrees[1]);
  135393. scratchCartographic10.height = cartographicDegrees[2];
  135394. Ellipsoid_default.WGS84.cartographicToCartesian(
  135395. scratchCartographic10,
  135396. scratchCartesian20
  135397. );
  135398. return [scratchCartesian20.x, scratchCartesian20.y, scratchCartesian20.z];
  135399. }
  135400. const result = new Array(length3);
  135401. for (let i2 = 0; i2 < length3; i2 += 4) {
  135402. result[i2] = cartographicDegrees[i2];
  135403. scratchCartographic10.longitude = Math_default.toRadians(
  135404. cartographicDegrees[i2 + 1]
  135405. );
  135406. scratchCartographic10.latitude = Math_default.toRadians(
  135407. cartographicDegrees[i2 + 2]
  135408. );
  135409. scratchCartographic10.height = cartographicDegrees[i2 + 3];
  135410. Ellipsoid_default.WGS84.cartographicToCartesian(
  135411. scratchCartographic10,
  135412. scratchCartesian20
  135413. );
  135414. result[i2 + 1] = scratchCartesian20.x;
  135415. result[i2 + 2] = scratchCartesian20.y;
  135416. result[i2 + 3] = scratchCartesian20.z;
  135417. }
  135418. return result;
  135419. }
  135420. function unwrapCartesianInterval(czmlInterval) {
  135421. const cartesian11 = czmlInterval.cartesian;
  135422. if (defined_default(cartesian11)) {
  135423. return cartesian11;
  135424. }
  135425. const cartesianVelocity = czmlInterval.cartesianVelocity;
  135426. if (defined_default(cartesianVelocity)) {
  135427. return cartesianVelocity;
  135428. }
  135429. const unitCartesian = czmlInterval.unitCartesian;
  135430. if (defined_default(unitCartesian)) {
  135431. return unitCartesian;
  135432. }
  135433. const unitSpherical = czmlInterval.unitSpherical;
  135434. if (defined_default(unitSpherical)) {
  135435. return convertUnitSphericalToCartesian(unitSpherical);
  135436. }
  135437. const spherical = czmlInterval.spherical;
  135438. if (defined_default(spherical)) {
  135439. return convertSphericalToCartesian(spherical);
  135440. }
  135441. const cartographicRadians = czmlInterval.cartographicRadians;
  135442. if (defined_default(cartographicRadians)) {
  135443. return convertCartographicRadiansToCartesian(cartographicRadians);
  135444. }
  135445. const cartographicDegrees = czmlInterval.cartographicDegrees;
  135446. if (defined_default(cartographicDegrees)) {
  135447. return convertCartographicDegreesToCartesian(cartographicDegrees);
  135448. }
  135449. throw new RuntimeError_default(
  135450. `${JSON.stringify(czmlInterval)} is not a valid CZML interval.`
  135451. );
  135452. }
  135453. function normalizePackedCartesianArray(array, startingIndex) {
  135454. Cartesian3_default.unpack(array, startingIndex, scratchCartesian20);
  135455. Cartesian3_default.normalize(scratchCartesian20, scratchCartesian20);
  135456. Cartesian3_default.pack(scratchCartesian20, array, startingIndex);
  135457. }
  135458. function unwrapUnitCartesianInterval(czmlInterval) {
  135459. const cartesian11 = unwrapCartesianInterval(czmlInterval);
  135460. if (cartesian11.length === 3) {
  135461. normalizePackedCartesianArray(cartesian11, 0);
  135462. return cartesian11;
  135463. }
  135464. for (let i2 = 1; i2 < cartesian11.length; i2 += 4) {
  135465. normalizePackedCartesianArray(cartesian11, i2);
  135466. }
  135467. return cartesian11;
  135468. }
  135469. function normalizePackedQuaternionArray(array, startingIndex) {
  135470. Quaternion_default.unpack(array, startingIndex, scratchQuaternion);
  135471. Quaternion_default.normalize(scratchQuaternion, scratchQuaternion);
  135472. Quaternion_default.pack(scratchQuaternion, array, startingIndex);
  135473. }
  135474. function unwrapQuaternionInterval(czmlInterval) {
  135475. const unitQuaternion = czmlInterval.unitQuaternion;
  135476. if (defined_default(unitQuaternion)) {
  135477. if (unitQuaternion.length === 4) {
  135478. normalizePackedQuaternionArray(unitQuaternion, 0);
  135479. return unitQuaternion;
  135480. }
  135481. for (let i2 = 1; i2 < unitQuaternion.length; i2 += 5) {
  135482. normalizePackedQuaternionArray(unitQuaternion, i2);
  135483. }
  135484. }
  135485. return unitQuaternion;
  135486. }
  135487. function getPropertyType(czmlInterval) {
  135488. if (typeof czmlInterval === "boolean") {
  135489. return Boolean;
  135490. } else if (typeof czmlInterval === "number") {
  135491. return Number;
  135492. } else if (typeof czmlInterval === "string") {
  135493. return String;
  135494. } else if (czmlInterval.hasOwnProperty("array")) {
  135495. return Array;
  135496. } else if (czmlInterval.hasOwnProperty("boolean")) {
  135497. return Boolean;
  135498. } else if (czmlInterval.hasOwnProperty("boundingRectangle")) {
  135499. return BoundingRectangle_default;
  135500. } else if (czmlInterval.hasOwnProperty("cartesian2")) {
  135501. return Cartesian2_default;
  135502. } else if (czmlInterval.hasOwnProperty("cartesian") || czmlInterval.hasOwnProperty("spherical") || czmlInterval.hasOwnProperty("cartographicRadians") || czmlInterval.hasOwnProperty("cartographicDegrees")) {
  135503. return Cartesian3_default;
  135504. } else if (czmlInterval.hasOwnProperty("unitCartesian") || czmlInterval.hasOwnProperty("unitSpherical")) {
  135505. return UnitCartesian3;
  135506. } else if (czmlInterval.hasOwnProperty("rgba") || czmlInterval.hasOwnProperty("rgbaf")) {
  135507. return Color_default;
  135508. } else if (czmlInterval.hasOwnProperty("arcType")) {
  135509. return ArcType_default;
  135510. } else if (czmlInterval.hasOwnProperty("classificationType")) {
  135511. return ClassificationType_default;
  135512. } else if (czmlInterval.hasOwnProperty("colorBlendMode")) {
  135513. return ColorBlendMode_default;
  135514. } else if (czmlInterval.hasOwnProperty("cornerType")) {
  135515. return CornerType_default;
  135516. } else if (czmlInterval.hasOwnProperty("heightReference")) {
  135517. return HeightReference_default;
  135518. } else if (czmlInterval.hasOwnProperty("horizontalOrigin")) {
  135519. return HorizontalOrigin_default;
  135520. } else if (czmlInterval.hasOwnProperty("date")) {
  135521. return JulianDate_default;
  135522. } else if (czmlInterval.hasOwnProperty("labelStyle")) {
  135523. return LabelStyle_default;
  135524. } else if (czmlInterval.hasOwnProperty("number")) {
  135525. return Number;
  135526. } else if (czmlInterval.hasOwnProperty("nearFarScalar")) {
  135527. return NearFarScalar_default;
  135528. } else if (czmlInterval.hasOwnProperty("distanceDisplayCondition")) {
  135529. return DistanceDisplayCondition_default;
  135530. } else if (czmlInterval.hasOwnProperty("object") || czmlInterval.hasOwnProperty("value")) {
  135531. return Object;
  135532. } else if (czmlInterval.hasOwnProperty("unitQuaternion")) {
  135533. return Quaternion_default;
  135534. } else if (czmlInterval.hasOwnProperty("shadowMode")) {
  135535. return ShadowMode_default;
  135536. } else if (czmlInterval.hasOwnProperty("string")) {
  135537. return String;
  135538. } else if (czmlInterval.hasOwnProperty("stripeOrientation")) {
  135539. return StripeOrientation_default;
  135540. } else if (czmlInterval.hasOwnProperty("wsen") || czmlInterval.hasOwnProperty("wsenDegrees")) {
  135541. return Rectangle_default;
  135542. } else if (czmlInterval.hasOwnProperty("uri")) {
  135543. return URI;
  135544. } else if (czmlInterval.hasOwnProperty("verticalOrigin")) {
  135545. return VerticalOrigin_default;
  135546. }
  135547. return Object;
  135548. }
  135549. function unwrapInterval(type, czmlInterval, sourceUri) {
  135550. switch (type) {
  135551. case ArcType_default:
  135552. return ArcType_default[defaultValue_default(czmlInterval.arcType, czmlInterval)];
  135553. case Array:
  135554. return czmlInterval.array;
  135555. case Boolean:
  135556. return defaultValue_default(czmlInterval["boolean"], czmlInterval);
  135557. case BoundingRectangle_default:
  135558. return czmlInterval.boundingRectangle;
  135559. case Cartesian2_default:
  135560. return czmlInterval.cartesian2;
  135561. case Cartesian3_default:
  135562. return unwrapCartesianInterval(czmlInterval);
  135563. case UnitCartesian3:
  135564. return unwrapUnitCartesianInterval(czmlInterval);
  135565. case Color_default:
  135566. return unwrapColorInterval(czmlInterval);
  135567. case ClassificationType_default:
  135568. return ClassificationType_default[defaultValue_default(czmlInterval.classificationType, czmlInterval)];
  135569. case ColorBlendMode_default:
  135570. return ColorBlendMode_default[defaultValue_default(czmlInterval.colorBlendMode, czmlInterval)];
  135571. case CornerType_default:
  135572. return CornerType_default[defaultValue_default(czmlInterval.cornerType, czmlInterval)];
  135573. case HeightReference_default:
  135574. return HeightReference_default[defaultValue_default(czmlInterval.heightReference, czmlInterval)];
  135575. case HorizontalOrigin_default:
  135576. return HorizontalOrigin_default[defaultValue_default(czmlInterval.horizontalOrigin, czmlInterval)];
  135577. case Image:
  135578. return unwrapUriInterval(czmlInterval, sourceUri);
  135579. case JulianDate_default:
  135580. return JulianDate_default.fromIso8601(
  135581. defaultValue_default(czmlInterval.date, czmlInterval)
  135582. );
  135583. case LabelStyle_default:
  135584. return LabelStyle_default[defaultValue_default(czmlInterval.labelStyle, czmlInterval)];
  135585. case Number:
  135586. return defaultValue_default(czmlInterval.number, czmlInterval);
  135587. case NearFarScalar_default:
  135588. return czmlInterval.nearFarScalar;
  135589. case DistanceDisplayCondition_default:
  135590. return czmlInterval.distanceDisplayCondition;
  135591. case Object:
  135592. return defaultValue_default(
  135593. defaultValue_default(czmlInterval.object, czmlInterval.value),
  135594. czmlInterval
  135595. );
  135596. case Quaternion_default:
  135597. return unwrapQuaternionInterval(czmlInterval);
  135598. case Rotation_default:
  135599. return defaultValue_default(czmlInterval.number, czmlInterval);
  135600. case ShadowMode_default:
  135601. return ShadowMode_default[defaultValue_default(
  135602. defaultValue_default(czmlInterval.shadowMode, czmlInterval.shadows),
  135603. czmlInterval
  135604. )];
  135605. case String:
  135606. return defaultValue_default(czmlInterval.string, czmlInterval);
  135607. case StripeOrientation_default:
  135608. return StripeOrientation_default[defaultValue_default(czmlInterval.stripeOrientation, czmlInterval)];
  135609. case Rectangle_default:
  135610. return unwrapRectangleInterval(czmlInterval);
  135611. case URI:
  135612. return unwrapUriInterval(czmlInterval, sourceUri);
  135613. case VerticalOrigin_default:
  135614. return VerticalOrigin_default[defaultValue_default(czmlInterval.verticalOrigin, czmlInterval)];
  135615. default:
  135616. throw new RuntimeError_default(type);
  135617. }
  135618. }
  135619. var interpolators = {
  135620. HERMITE: HermitePolynomialApproximation_default,
  135621. LAGRANGE: LagrangePolynomialApproximation_default,
  135622. LINEAR: LinearApproximation_default
  135623. };
  135624. function updateInterpolationSettings(packetData, property) {
  135625. const interpolationAlgorithm = packetData.interpolationAlgorithm;
  135626. const interpolationDegree = packetData.interpolationDegree;
  135627. if (defined_default(interpolationAlgorithm) || defined_default(interpolationDegree)) {
  135628. property.setInterpolationOptions({
  135629. interpolationAlgorithm: interpolators[interpolationAlgorithm],
  135630. interpolationDegree
  135631. });
  135632. }
  135633. const forwardExtrapolationType = packetData.forwardExtrapolationType;
  135634. if (defined_default(forwardExtrapolationType)) {
  135635. property.forwardExtrapolationType = ExtrapolationType_default[forwardExtrapolationType];
  135636. }
  135637. const forwardExtrapolationDuration = packetData.forwardExtrapolationDuration;
  135638. if (defined_default(forwardExtrapolationDuration)) {
  135639. property.forwardExtrapolationDuration = forwardExtrapolationDuration;
  135640. }
  135641. const backwardExtrapolationType = packetData.backwardExtrapolationType;
  135642. if (defined_default(backwardExtrapolationType)) {
  135643. property.backwardExtrapolationType = ExtrapolationType_default[backwardExtrapolationType];
  135644. }
  135645. const backwardExtrapolationDuration = packetData.backwardExtrapolationDuration;
  135646. if (defined_default(backwardExtrapolationDuration)) {
  135647. property.backwardExtrapolationDuration = backwardExtrapolationDuration;
  135648. }
  135649. }
  135650. var iso8601Scratch = {
  135651. iso8601: void 0
  135652. };
  135653. function intervalFromString(intervalString) {
  135654. if (!defined_default(intervalString)) {
  135655. return void 0;
  135656. }
  135657. iso8601Scratch.iso8601 = intervalString;
  135658. return TimeInterval_default.fromIso8601(iso8601Scratch);
  135659. }
  135660. function wrapPropertyInInfiniteInterval(property) {
  135661. const interval = Iso8601_default.MAXIMUM_INTERVAL.clone();
  135662. interval.data = property;
  135663. return interval;
  135664. }
  135665. function convertPropertyToComposite(property) {
  135666. const composite = new CompositeProperty_default();
  135667. composite.intervals.addInterval(wrapPropertyInInfiniteInterval(property));
  135668. return composite;
  135669. }
  135670. function convertPositionPropertyToComposite(property) {
  135671. const composite = new CompositePositionProperty_default(property.referenceFrame);
  135672. composite.intervals.addInterval(wrapPropertyInInfiniteInterval(property));
  135673. return composite;
  135674. }
  135675. function processProperty(type, object2, propertyName, packetData, constrainedInterval, sourceUri, entityCollection) {
  135676. let combinedInterval = intervalFromString(packetData.interval);
  135677. if (defined_default(constrainedInterval)) {
  135678. if (defined_default(combinedInterval)) {
  135679. combinedInterval = TimeInterval_default.intersect(
  135680. combinedInterval,
  135681. constrainedInterval,
  135682. scratchTimeInterval
  135683. );
  135684. } else {
  135685. combinedInterval = constrainedInterval;
  135686. }
  135687. }
  135688. let packedLength;
  135689. let unwrappedInterval;
  135690. let unwrappedIntervalLength;
  135691. const isValue = !defined_default(packetData.reference) && !defined_default(packetData.velocityReference);
  135692. const hasInterval = defined_default(combinedInterval) && !combinedInterval.equals(Iso8601_default.MAXIMUM_INTERVAL);
  135693. if (packetData.delete === true) {
  135694. if (!hasInterval) {
  135695. object2[propertyName] = void 0;
  135696. return;
  135697. }
  135698. return removePropertyData(object2[propertyName], combinedInterval);
  135699. }
  135700. let isSampled = false;
  135701. if (isValue) {
  135702. unwrappedInterval = unwrapInterval(type, packetData, sourceUri);
  135703. if (!defined_default(unwrappedInterval)) {
  135704. return;
  135705. }
  135706. packedLength = defaultValue_default(type.packedLength, 1);
  135707. unwrappedIntervalLength = defaultValue_default(unwrappedInterval.length, 1);
  135708. isSampled = !defined_default(packetData.array) && typeof unwrappedInterval !== "string" && unwrappedIntervalLength > packedLength && type !== Object;
  135709. }
  135710. const needsUnpacking = typeof type.unpack === "function" && type !== Rotation_default;
  135711. if (!isSampled && !hasInterval) {
  135712. if (isValue) {
  135713. object2[propertyName] = new ConstantProperty_default(
  135714. needsUnpacking ? type.unpack(unwrappedInterval, 0) : unwrappedInterval
  135715. );
  135716. } else {
  135717. object2[propertyName] = createSpecializedProperty(
  135718. type,
  135719. entityCollection,
  135720. packetData
  135721. );
  135722. }
  135723. return;
  135724. }
  135725. let property = object2[propertyName];
  135726. let epoch2;
  135727. const packetEpoch = packetData.epoch;
  135728. if (defined_default(packetEpoch)) {
  135729. epoch2 = JulianDate_default.fromIso8601(packetEpoch);
  135730. }
  135731. if (isSampled && !hasInterval) {
  135732. if (!(property instanceof SampledProperty_default)) {
  135733. object2[propertyName] = property = new SampledProperty_default(type);
  135734. }
  135735. property.addSamplesPackedArray(unwrappedInterval, epoch2);
  135736. updateInterpolationSettings(packetData, property);
  135737. return;
  135738. }
  135739. let interval;
  135740. if (!isSampled && hasInterval) {
  135741. combinedInterval = combinedInterval.clone();
  135742. if (isValue) {
  135743. combinedInterval.data = needsUnpacking ? type.unpack(unwrappedInterval, 0) : unwrappedInterval;
  135744. } else {
  135745. combinedInterval.data = createSpecializedProperty(
  135746. type,
  135747. entityCollection,
  135748. packetData
  135749. );
  135750. }
  135751. if (!defined_default(property)) {
  135752. object2[propertyName] = property = isValue ? new TimeIntervalCollectionProperty_default() : new CompositeProperty_default();
  135753. }
  135754. if (isValue && property instanceof TimeIntervalCollectionProperty_default) {
  135755. property.intervals.addInterval(combinedInterval);
  135756. } else if (property instanceof CompositeProperty_default) {
  135757. if (isValue) {
  135758. combinedInterval.data = new ConstantProperty_default(combinedInterval.data);
  135759. }
  135760. property.intervals.addInterval(combinedInterval);
  135761. } else {
  135762. object2[propertyName] = property = convertPropertyToComposite(property);
  135763. if (isValue) {
  135764. combinedInterval.data = new ConstantProperty_default(combinedInterval.data);
  135765. }
  135766. property.intervals.addInterval(combinedInterval);
  135767. }
  135768. return;
  135769. }
  135770. if (!defined_default(property)) {
  135771. object2[propertyName] = property = new CompositeProperty_default();
  135772. }
  135773. if (!(property instanceof CompositeProperty_default)) {
  135774. object2[propertyName] = property = convertPropertyToComposite(property);
  135775. }
  135776. const intervals = property.intervals;
  135777. interval = intervals.findInterval(combinedInterval);
  135778. if (!defined_default(interval) || !(interval.data instanceof SampledProperty_default)) {
  135779. interval = combinedInterval.clone();
  135780. interval.data = new SampledProperty_default(type);
  135781. intervals.addInterval(interval);
  135782. }
  135783. interval.data.addSamplesPackedArray(unwrappedInterval, epoch2);
  135784. updateInterpolationSettings(packetData, interval.data);
  135785. }
  135786. function removePropertyData(property, interval) {
  135787. if (property instanceof SampledProperty_default) {
  135788. property.removeSamples(interval);
  135789. return;
  135790. } else if (property instanceof TimeIntervalCollectionProperty_default) {
  135791. property.intervals.removeInterval(interval);
  135792. return;
  135793. } else if (property instanceof CompositeProperty_default) {
  135794. const intervals = property.intervals;
  135795. for (let i2 = 0; i2 < intervals.length; ++i2) {
  135796. const intersection = TimeInterval_default.intersect(
  135797. intervals.get(i2),
  135798. interval,
  135799. scratchTimeInterval
  135800. );
  135801. if (!intersection.isEmpty) {
  135802. removePropertyData(intersection.data, interval);
  135803. }
  135804. }
  135805. intervals.removeInterval(interval);
  135806. return;
  135807. }
  135808. }
  135809. function processPacketData(type, object2, propertyName, packetData, interval, sourceUri, entityCollection) {
  135810. if (!defined_default(packetData)) {
  135811. return;
  135812. }
  135813. if (Array.isArray(packetData)) {
  135814. for (let i2 = 0, len = packetData.length; i2 < len; ++i2) {
  135815. processProperty(
  135816. type,
  135817. object2,
  135818. propertyName,
  135819. packetData[i2],
  135820. interval,
  135821. sourceUri,
  135822. entityCollection
  135823. );
  135824. }
  135825. } else {
  135826. processProperty(
  135827. type,
  135828. object2,
  135829. propertyName,
  135830. packetData,
  135831. interval,
  135832. sourceUri,
  135833. entityCollection
  135834. );
  135835. }
  135836. }
  135837. function processPositionProperty(object2, propertyName, packetData, constrainedInterval, sourceUri, entityCollection) {
  135838. let combinedInterval = intervalFromString(packetData.interval);
  135839. if (defined_default(constrainedInterval)) {
  135840. if (defined_default(combinedInterval)) {
  135841. combinedInterval = TimeInterval_default.intersect(
  135842. combinedInterval,
  135843. constrainedInterval,
  135844. scratchTimeInterval
  135845. );
  135846. } else {
  135847. combinedInterval = constrainedInterval;
  135848. }
  135849. }
  135850. const numberOfDerivatives = defined_default(packetData.cartesianVelocity) ? 1 : 0;
  135851. const packedLength = Cartesian3_default.packedLength * (numberOfDerivatives + 1);
  135852. let unwrappedInterval;
  135853. let unwrappedIntervalLength;
  135854. const isValue = !defined_default(packetData.reference);
  135855. const hasInterval = defined_default(combinedInterval) && !combinedInterval.equals(Iso8601_default.MAXIMUM_INTERVAL);
  135856. if (packetData.delete === true) {
  135857. if (!hasInterval) {
  135858. object2[propertyName] = void 0;
  135859. return;
  135860. }
  135861. return removePositionPropertyData(object2[propertyName], combinedInterval);
  135862. }
  135863. let referenceFrame;
  135864. let isSampled = false;
  135865. if (isValue) {
  135866. if (defined_default(packetData.referenceFrame)) {
  135867. referenceFrame = ReferenceFrame_default[packetData.referenceFrame];
  135868. }
  135869. referenceFrame = defaultValue_default(referenceFrame, ReferenceFrame_default.FIXED);
  135870. unwrappedInterval = unwrapCartesianInterval(packetData);
  135871. unwrappedIntervalLength = defaultValue_default(unwrappedInterval.length, 1);
  135872. isSampled = unwrappedIntervalLength > packedLength;
  135873. }
  135874. if (!isSampled && !hasInterval) {
  135875. if (isValue) {
  135876. object2[propertyName] = new ConstantPositionProperty_default(
  135877. Cartesian3_default.unpack(unwrappedInterval),
  135878. referenceFrame
  135879. );
  135880. } else {
  135881. object2[propertyName] = createReferenceProperty(
  135882. entityCollection,
  135883. packetData.reference
  135884. );
  135885. }
  135886. return;
  135887. }
  135888. let property = object2[propertyName];
  135889. let epoch2;
  135890. const packetEpoch = packetData.epoch;
  135891. if (defined_default(packetEpoch)) {
  135892. epoch2 = JulianDate_default.fromIso8601(packetEpoch);
  135893. }
  135894. if (isSampled && !hasInterval) {
  135895. if (!(property instanceof SampledPositionProperty_default) || defined_default(referenceFrame) && property.referenceFrame !== referenceFrame) {
  135896. object2[propertyName] = property = new SampledPositionProperty_default(
  135897. referenceFrame,
  135898. numberOfDerivatives
  135899. );
  135900. }
  135901. property.addSamplesPackedArray(unwrappedInterval, epoch2);
  135902. updateInterpolationSettings(packetData, property);
  135903. return;
  135904. }
  135905. let interval;
  135906. if (!isSampled && hasInterval) {
  135907. combinedInterval = combinedInterval.clone();
  135908. if (isValue) {
  135909. combinedInterval.data = Cartesian3_default.unpack(unwrappedInterval);
  135910. } else {
  135911. combinedInterval.data = createReferenceProperty(
  135912. entityCollection,
  135913. packetData.reference
  135914. );
  135915. }
  135916. if (!defined_default(property)) {
  135917. if (isValue) {
  135918. property = new TimeIntervalCollectionPositionProperty_default(referenceFrame);
  135919. } else {
  135920. property = new CompositePositionProperty_default(referenceFrame);
  135921. }
  135922. object2[propertyName] = property;
  135923. }
  135924. if (isValue && property instanceof TimeIntervalCollectionPositionProperty_default && defined_default(referenceFrame) && property.referenceFrame === referenceFrame) {
  135925. property.intervals.addInterval(combinedInterval);
  135926. } else if (property instanceof CompositePositionProperty_default) {
  135927. if (isValue) {
  135928. combinedInterval.data = new ConstantPositionProperty_default(
  135929. combinedInterval.data,
  135930. referenceFrame
  135931. );
  135932. }
  135933. property.intervals.addInterval(combinedInterval);
  135934. } else {
  135935. object2[propertyName] = property = convertPositionPropertyToComposite(
  135936. property
  135937. );
  135938. if (isValue) {
  135939. combinedInterval.data = new ConstantPositionProperty_default(
  135940. combinedInterval.data,
  135941. referenceFrame
  135942. );
  135943. }
  135944. property.intervals.addInterval(combinedInterval);
  135945. }
  135946. return;
  135947. }
  135948. if (!defined_default(property)) {
  135949. object2[propertyName] = property = new CompositePositionProperty_default(
  135950. referenceFrame
  135951. );
  135952. } else if (!(property instanceof CompositePositionProperty_default)) {
  135953. object2[propertyName] = property = convertPositionPropertyToComposite(
  135954. property
  135955. );
  135956. }
  135957. const intervals = property.intervals;
  135958. interval = intervals.findInterval(combinedInterval);
  135959. if (!defined_default(interval) || !(interval.data instanceof SampledPositionProperty_default) || defined_default(referenceFrame) && interval.data.referenceFrame !== referenceFrame) {
  135960. interval = combinedInterval.clone();
  135961. interval.data = new SampledPositionProperty_default(
  135962. referenceFrame,
  135963. numberOfDerivatives
  135964. );
  135965. intervals.addInterval(interval);
  135966. }
  135967. interval.data.addSamplesPackedArray(unwrappedInterval, epoch2);
  135968. updateInterpolationSettings(packetData, interval.data);
  135969. }
  135970. function removePositionPropertyData(property, interval) {
  135971. if (property instanceof SampledPositionProperty_default) {
  135972. property.removeSamples(interval);
  135973. return;
  135974. } else if (property instanceof TimeIntervalCollectionPositionProperty_default) {
  135975. property.intervals.removeInterval(interval);
  135976. return;
  135977. } else if (property instanceof CompositePositionProperty_default) {
  135978. const intervals = property.intervals;
  135979. for (let i2 = 0; i2 < intervals.length; ++i2) {
  135980. const intersection = TimeInterval_default.intersect(
  135981. intervals.get(i2),
  135982. interval,
  135983. scratchTimeInterval
  135984. );
  135985. if (!intersection.isEmpty) {
  135986. removePositionPropertyData(intersection.data, interval);
  135987. }
  135988. }
  135989. intervals.removeInterval(interval);
  135990. return;
  135991. }
  135992. }
  135993. function processPositionPacketData(object2, propertyName, packetData, interval, sourceUri, entityCollection) {
  135994. if (!defined_default(packetData)) {
  135995. return;
  135996. }
  135997. if (Array.isArray(packetData)) {
  135998. for (let i2 = 0, len = packetData.length; i2 < len; ++i2) {
  135999. processPositionProperty(
  136000. object2,
  136001. propertyName,
  136002. packetData[i2],
  136003. interval,
  136004. sourceUri,
  136005. entityCollection
  136006. );
  136007. }
  136008. } else {
  136009. processPositionProperty(
  136010. object2,
  136011. propertyName,
  136012. packetData,
  136013. interval,
  136014. sourceUri,
  136015. entityCollection
  136016. );
  136017. }
  136018. }
  136019. function processShapePacketData(object2, propertyName, packetData, entityCollection) {
  136020. if (defined_default(packetData.references)) {
  136021. processReferencesArrayPacketData(
  136022. object2,
  136023. propertyName,
  136024. packetData.references,
  136025. packetData.interval,
  136026. entityCollection,
  136027. PropertyArray_default,
  136028. CompositeProperty_default
  136029. );
  136030. } else {
  136031. if (defined_default(packetData.cartesian2)) {
  136032. packetData.array = Cartesian2_default.unpackArray(packetData.cartesian2);
  136033. } else if (defined_default(packetData.cartesian)) {
  136034. packetData.array = Cartesian2_default.unpackArray(packetData.cartesian);
  136035. }
  136036. if (defined_default(packetData.array)) {
  136037. processPacketData(
  136038. Array,
  136039. object2,
  136040. propertyName,
  136041. packetData,
  136042. void 0,
  136043. void 0,
  136044. entityCollection
  136045. );
  136046. }
  136047. }
  136048. }
  136049. function processMaterialProperty(object2, propertyName, packetData, constrainedInterval, sourceUri, entityCollection) {
  136050. let combinedInterval = intervalFromString(packetData.interval);
  136051. if (defined_default(constrainedInterval)) {
  136052. if (defined_default(combinedInterval)) {
  136053. combinedInterval = TimeInterval_default.intersect(
  136054. combinedInterval,
  136055. constrainedInterval,
  136056. scratchTimeInterval
  136057. );
  136058. } else {
  136059. combinedInterval = constrainedInterval;
  136060. }
  136061. }
  136062. let property = object2[propertyName];
  136063. let existingMaterial;
  136064. let existingInterval;
  136065. if (defined_default(combinedInterval)) {
  136066. if (!(property instanceof CompositeMaterialProperty_default)) {
  136067. property = new CompositeMaterialProperty_default();
  136068. object2[propertyName] = property;
  136069. }
  136070. const thisIntervals = property.intervals;
  136071. existingInterval = thisIntervals.findInterval({
  136072. start: combinedInterval.start,
  136073. stop: combinedInterval.stop
  136074. });
  136075. if (defined_default(existingInterval)) {
  136076. existingMaterial = existingInterval.data;
  136077. } else {
  136078. existingInterval = combinedInterval.clone();
  136079. thisIntervals.addInterval(existingInterval);
  136080. }
  136081. } else {
  136082. existingMaterial = property;
  136083. }
  136084. let materialData;
  136085. if (defined_default(packetData.solidColor)) {
  136086. if (!(existingMaterial instanceof ColorMaterialProperty_default)) {
  136087. existingMaterial = new ColorMaterialProperty_default();
  136088. }
  136089. materialData = packetData.solidColor;
  136090. processPacketData(
  136091. Color_default,
  136092. existingMaterial,
  136093. "color",
  136094. materialData.color,
  136095. void 0,
  136096. void 0,
  136097. entityCollection
  136098. );
  136099. } else if (defined_default(packetData.grid)) {
  136100. if (!(existingMaterial instanceof GridMaterialProperty_default)) {
  136101. existingMaterial = new GridMaterialProperty_default();
  136102. }
  136103. materialData = packetData.grid;
  136104. processPacketData(
  136105. Color_default,
  136106. existingMaterial,
  136107. "color",
  136108. materialData.color,
  136109. void 0,
  136110. sourceUri,
  136111. entityCollection
  136112. );
  136113. processPacketData(
  136114. Number,
  136115. existingMaterial,
  136116. "cellAlpha",
  136117. materialData.cellAlpha,
  136118. void 0,
  136119. sourceUri,
  136120. entityCollection
  136121. );
  136122. processPacketData(
  136123. Cartesian2_default,
  136124. existingMaterial,
  136125. "lineCount",
  136126. materialData.lineCount,
  136127. void 0,
  136128. sourceUri,
  136129. entityCollection
  136130. );
  136131. processPacketData(
  136132. Cartesian2_default,
  136133. existingMaterial,
  136134. "lineThickness",
  136135. materialData.lineThickness,
  136136. void 0,
  136137. sourceUri,
  136138. entityCollection
  136139. );
  136140. processPacketData(
  136141. Cartesian2_default,
  136142. existingMaterial,
  136143. "lineOffset",
  136144. materialData.lineOffset,
  136145. void 0,
  136146. sourceUri,
  136147. entityCollection
  136148. );
  136149. } else if (defined_default(packetData.image)) {
  136150. if (!(existingMaterial instanceof ImageMaterialProperty_default)) {
  136151. existingMaterial = new ImageMaterialProperty_default();
  136152. }
  136153. materialData = packetData.image;
  136154. processPacketData(
  136155. Image,
  136156. existingMaterial,
  136157. "image",
  136158. materialData.image,
  136159. void 0,
  136160. sourceUri,
  136161. entityCollection
  136162. );
  136163. processPacketData(
  136164. Cartesian2_default,
  136165. existingMaterial,
  136166. "repeat",
  136167. materialData.repeat,
  136168. void 0,
  136169. sourceUri,
  136170. entityCollection
  136171. );
  136172. processPacketData(
  136173. Color_default,
  136174. existingMaterial,
  136175. "color",
  136176. materialData.color,
  136177. void 0,
  136178. sourceUri,
  136179. entityCollection
  136180. );
  136181. processPacketData(
  136182. Boolean,
  136183. existingMaterial,
  136184. "transparent",
  136185. materialData.transparent,
  136186. void 0,
  136187. sourceUri,
  136188. entityCollection
  136189. );
  136190. } else if (defined_default(packetData.stripe)) {
  136191. if (!(existingMaterial instanceof StripeMaterialProperty_default)) {
  136192. existingMaterial = new StripeMaterialProperty_default();
  136193. }
  136194. materialData = packetData.stripe;
  136195. processPacketData(
  136196. StripeOrientation_default,
  136197. existingMaterial,
  136198. "orientation",
  136199. materialData.orientation,
  136200. void 0,
  136201. sourceUri,
  136202. entityCollection
  136203. );
  136204. processPacketData(
  136205. Color_default,
  136206. existingMaterial,
  136207. "evenColor",
  136208. materialData.evenColor,
  136209. void 0,
  136210. sourceUri,
  136211. entityCollection
  136212. );
  136213. processPacketData(
  136214. Color_default,
  136215. existingMaterial,
  136216. "oddColor",
  136217. materialData.oddColor,
  136218. void 0,
  136219. sourceUri,
  136220. entityCollection
  136221. );
  136222. processPacketData(
  136223. Number,
  136224. existingMaterial,
  136225. "offset",
  136226. materialData.offset,
  136227. void 0,
  136228. sourceUri,
  136229. entityCollection
  136230. );
  136231. processPacketData(
  136232. Number,
  136233. existingMaterial,
  136234. "repeat",
  136235. materialData.repeat,
  136236. void 0,
  136237. sourceUri,
  136238. entityCollection
  136239. );
  136240. } else if (defined_default(packetData.polylineOutline)) {
  136241. if (!(existingMaterial instanceof PolylineOutlineMaterialProperty_default)) {
  136242. existingMaterial = new PolylineOutlineMaterialProperty_default();
  136243. }
  136244. materialData = packetData.polylineOutline;
  136245. processPacketData(
  136246. Color_default,
  136247. existingMaterial,
  136248. "color",
  136249. materialData.color,
  136250. void 0,
  136251. sourceUri,
  136252. entityCollection
  136253. );
  136254. processPacketData(
  136255. Color_default,
  136256. existingMaterial,
  136257. "outlineColor",
  136258. materialData.outlineColor,
  136259. void 0,
  136260. sourceUri,
  136261. entityCollection
  136262. );
  136263. processPacketData(
  136264. Number,
  136265. existingMaterial,
  136266. "outlineWidth",
  136267. materialData.outlineWidth,
  136268. void 0,
  136269. sourceUri,
  136270. entityCollection
  136271. );
  136272. } else if (defined_default(packetData.polylineGlow)) {
  136273. if (!(existingMaterial instanceof PolylineGlowMaterialProperty_default)) {
  136274. existingMaterial = new PolylineGlowMaterialProperty_default();
  136275. }
  136276. materialData = packetData.polylineGlow;
  136277. processPacketData(
  136278. Color_default,
  136279. existingMaterial,
  136280. "color",
  136281. materialData.color,
  136282. void 0,
  136283. sourceUri,
  136284. entityCollection
  136285. );
  136286. processPacketData(
  136287. Number,
  136288. existingMaterial,
  136289. "glowPower",
  136290. materialData.glowPower,
  136291. void 0,
  136292. sourceUri,
  136293. entityCollection
  136294. );
  136295. processPacketData(
  136296. Number,
  136297. existingMaterial,
  136298. "taperPower",
  136299. materialData.taperPower,
  136300. void 0,
  136301. sourceUri,
  136302. entityCollection
  136303. );
  136304. } else if (defined_default(packetData.polylineArrow)) {
  136305. if (!(existingMaterial instanceof PolylineArrowMaterialProperty_default)) {
  136306. existingMaterial = new PolylineArrowMaterialProperty_default();
  136307. }
  136308. materialData = packetData.polylineArrow;
  136309. processPacketData(
  136310. Color_default,
  136311. existingMaterial,
  136312. "color",
  136313. materialData.color,
  136314. void 0,
  136315. void 0,
  136316. entityCollection
  136317. );
  136318. } else if (defined_default(packetData.polylineDash)) {
  136319. if (!(existingMaterial instanceof PolylineDashMaterialProperty_default)) {
  136320. existingMaterial = new PolylineDashMaterialProperty_default();
  136321. }
  136322. materialData = packetData.polylineDash;
  136323. processPacketData(
  136324. Color_default,
  136325. existingMaterial,
  136326. "color",
  136327. materialData.color,
  136328. void 0,
  136329. void 0,
  136330. entityCollection
  136331. );
  136332. processPacketData(
  136333. Color_default,
  136334. existingMaterial,
  136335. "gapColor",
  136336. materialData.gapColor,
  136337. void 0,
  136338. void 0,
  136339. entityCollection
  136340. );
  136341. processPacketData(
  136342. Number,
  136343. existingMaterial,
  136344. "dashLength",
  136345. materialData.dashLength,
  136346. void 0,
  136347. sourceUri,
  136348. entityCollection
  136349. );
  136350. processPacketData(
  136351. Number,
  136352. existingMaterial,
  136353. "dashPattern",
  136354. materialData.dashPattern,
  136355. void 0,
  136356. sourceUri,
  136357. entityCollection
  136358. );
  136359. } else if (defined_default(packetData.checkerboard)) {
  136360. if (!(existingMaterial instanceof CheckerboardMaterialProperty_default)) {
  136361. existingMaterial = new CheckerboardMaterialProperty_default();
  136362. }
  136363. materialData = packetData.checkerboard;
  136364. processPacketData(
  136365. Color_default,
  136366. existingMaterial,
  136367. "evenColor",
  136368. materialData.evenColor,
  136369. void 0,
  136370. sourceUri,
  136371. entityCollection
  136372. );
  136373. processPacketData(
  136374. Color_default,
  136375. existingMaterial,
  136376. "oddColor",
  136377. materialData.oddColor,
  136378. void 0,
  136379. sourceUri,
  136380. entityCollection
  136381. );
  136382. processPacketData(
  136383. Cartesian2_default,
  136384. existingMaterial,
  136385. "repeat",
  136386. materialData.repeat,
  136387. void 0,
  136388. sourceUri,
  136389. entityCollection
  136390. );
  136391. }
  136392. if (defined_default(existingInterval)) {
  136393. existingInterval.data = existingMaterial;
  136394. } else {
  136395. object2[propertyName] = existingMaterial;
  136396. }
  136397. }
  136398. function processMaterialPacketData(object2, propertyName, packetData, interval, sourceUri, entityCollection) {
  136399. if (!defined_default(packetData)) {
  136400. return;
  136401. }
  136402. if (Array.isArray(packetData)) {
  136403. for (let i2 = 0, len = packetData.length; i2 < len; ++i2) {
  136404. processMaterialProperty(
  136405. object2,
  136406. propertyName,
  136407. packetData[i2],
  136408. interval,
  136409. sourceUri,
  136410. entityCollection
  136411. );
  136412. }
  136413. } else {
  136414. processMaterialProperty(
  136415. object2,
  136416. propertyName,
  136417. packetData,
  136418. interval,
  136419. sourceUri,
  136420. entityCollection
  136421. );
  136422. }
  136423. }
  136424. function processName(entity, packet, entityCollection, sourceUri) {
  136425. const nameData = packet.name;
  136426. if (defined_default(nameData)) {
  136427. entity.name = packet.name;
  136428. }
  136429. }
  136430. function processDescription(entity, packet, entityCollection, sourceUri) {
  136431. const descriptionData = packet.description;
  136432. if (defined_default(descriptionData)) {
  136433. processPacketData(
  136434. String,
  136435. entity,
  136436. "description",
  136437. descriptionData,
  136438. void 0,
  136439. sourceUri,
  136440. entityCollection
  136441. );
  136442. }
  136443. }
  136444. function processPosition(entity, packet, entityCollection, sourceUri) {
  136445. const positionData = packet.position;
  136446. if (defined_default(positionData)) {
  136447. processPositionPacketData(
  136448. entity,
  136449. "position",
  136450. positionData,
  136451. void 0,
  136452. sourceUri,
  136453. entityCollection
  136454. );
  136455. }
  136456. }
  136457. function processViewFrom(entity, packet, entityCollection, sourceUri) {
  136458. const viewFromData = packet.viewFrom;
  136459. if (defined_default(viewFromData)) {
  136460. processPacketData(
  136461. Cartesian3_default,
  136462. entity,
  136463. "viewFrom",
  136464. viewFromData,
  136465. void 0,
  136466. sourceUri,
  136467. entityCollection
  136468. );
  136469. }
  136470. }
  136471. function processOrientation(entity, packet, entityCollection, sourceUri) {
  136472. const orientationData = packet.orientation;
  136473. if (defined_default(orientationData)) {
  136474. processPacketData(
  136475. Quaternion_default,
  136476. entity,
  136477. "orientation",
  136478. orientationData,
  136479. void 0,
  136480. sourceUri,
  136481. entityCollection
  136482. );
  136483. }
  136484. }
  136485. function processProperties(entity, packet, entityCollection, sourceUri) {
  136486. const propertiesData = packet.properties;
  136487. if (defined_default(propertiesData)) {
  136488. if (!defined_default(entity.properties)) {
  136489. entity.properties = new PropertyBag_default();
  136490. }
  136491. for (const key in propertiesData) {
  136492. if (propertiesData.hasOwnProperty(key)) {
  136493. if (!entity.properties.hasProperty(key)) {
  136494. entity.properties.addProperty(key);
  136495. }
  136496. const propertyData = propertiesData[key];
  136497. if (Array.isArray(propertyData)) {
  136498. for (let i2 = 0, len = propertyData.length; i2 < len; ++i2) {
  136499. processProperty(
  136500. getPropertyType(propertyData[i2]),
  136501. entity.properties,
  136502. key,
  136503. propertyData[i2],
  136504. void 0,
  136505. sourceUri,
  136506. entityCollection
  136507. );
  136508. }
  136509. } else {
  136510. processProperty(
  136511. getPropertyType(propertyData),
  136512. entity.properties,
  136513. key,
  136514. propertyData,
  136515. void 0,
  136516. sourceUri,
  136517. entityCollection
  136518. );
  136519. }
  136520. }
  136521. }
  136522. }
  136523. }
  136524. function processReferencesArrayPacketData(object2, propertyName, references, interval, entityCollection, PropertyArrayType, CompositePropertyArrayType) {
  136525. const properties = references.map(function(reference) {
  136526. return createReferenceProperty(entityCollection, reference);
  136527. });
  136528. if (defined_default(interval)) {
  136529. interval = intervalFromString(interval);
  136530. let property = object2[propertyName];
  136531. if (!(property instanceof CompositePropertyArrayType)) {
  136532. const composite = new CompositePropertyArrayType();
  136533. composite.intervals.addInterval(wrapPropertyInInfiniteInterval(property));
  136534. object2[propertyName] = property = composite;
  136535. }
  136536. interval.data = new PropertyArrayType(properties);
  136537. property.intervals.addInterval(interval);
  136538. } else {
  136539. object2[propertyName] = new PropertyArrayType(properties);
  136540. }
  136541. }
  136542. function processArrayPacketData(object2, propertyName, packetData, entityCollection) {
  136543. const references = packetData.references;
  136544. if (defined_default(references)) {
  136545. processReferencesArrayPacketData(
  136546. object2,
  136547. propertyName,
  136548. references,
  136549. packetData.interval,
  136550. entityCollection,
  136551. PropertyArray_default,
  136552. CompositeProperty_default
  136553. );
  136554. } else {
  136555. processPacketData(
  136556. Array,
  136557. object2,
  136558. propertyName,
  136559. packetData,
  136560. void 0,
  136561. void 0,
  136562. entityCollection
  136563. );
  136564. }
  136565. }
  136566. function processArray(object2, propertyName, packetData, entityCollection) {
  136567. if (!defined_default(packetData)) {
  136568. return;
  136569. }
  136570. if (Array.isArray(packetData)) {
  136571. for (let i2 = 0, length3 = packetData.length; i2 < length3; ++i2) {
  136572. processArrayPacketData(
  136573. object2,
  136574. propertyName,
  136575. packetData[i2],
  136576. entityCollection
  136577. );
  136578. }
  136579. } else {
  136580. processArrayPacketData(object2, propertyName, packetData, entityCollection);
  136581. }
  136582. }
  136583. function processPositionArrayPacketData(object2, propertyName, packetData, entityCollection) {
  136584. const references = packetData.references;
  136585. if (defined_default(references)) {
  136586. processReferencesArrayPacketData(
  136587. object2,
  136588. propertyName,
  136589. references,
  136590. packetData.interval,
  136591. entityCollection,
  136592. PositionPropertyArray_default,
  136593. CompositePositionProperty_default
  136594. );
  136595. } else {
  136596. if (defined_default(packetData.cartesian)) {
  136597. packetData.array = Cartesian3_default.unpackArray(packetData.cartesian);
  136598. } else if (defined_default(packetData.cartographicRadians)) {
  136599. packetData.array = Cartesian3_default.fromRadiansArrayHeights(
  136600. packetData.cartographicRadians
  136601. );
  136602. } else if (defined_default(packetData.cartographicDegrees)) {
  136603. packetData.array = Cartesian3_default.fromDegreesArrayHeights(
  136604. packetData.cartographicDegrees
  136605. );
  136606. }
  136607. if (defined_default(packetData.array)) {
  136608. processPacketData(
  136609. Array,
  136610. object2,
  136611. propertyName,
  136612. packetData,
  136613. void 0,
  136614. void 0,
  136615. entityCollection
  136616. );
  136617. }
  136618. }
  136619. }
  136620. function processPositionArray(object2, propertyName, packetData, entityCollection) {
  136621. if (!defined_default(packetData)) {
  136622. return;
  136623. }
  136624. if (Array.isArray(packetData)) {
  136625. for (let i2 = 0, length3 = packetData.length; i2 < length3; ++i2) {
  136626. processPositionArrayPacketData(
  136627. object2,
  136628. propertyName,
  136629. packetData[i2],
  136630. entityCollection
  136631. );
  136632. }
  136633. } else {
  136634. processPositionArrayPacketData(
  136635. object2,
  136636. propertyName,
  136637. packetData,
  136638. entityCollection
  136639. );
  136640. }
  136641. }
  136642. function unpackCartesianArray(array) {
  136643. return Cartesian3_default.unpackArray(array);
  136644. }
  136645. function unpackCartographicRadiansArray(array) {
  136646. return Cartesian3_default.fromRadiansArrayHeights(array);
  136647. }
  136648. function unpackCartographicDegreesArray(array) {
  136649. return Cartesian3_default.fromDegreesArrayHeights(array);
  136650. }
  136651. function processPositionArrayOfArraysPacketData(object2, propertyName, packetData, entityCollection) {
  136652. const references = packetData.references;
  136653. if (defined_default(references)) {
  136654. const properties = references.map(function(referenceArray) {
  136655. const tempObj = {};
  136656. processReferencesArrayPacketData(
  136657. tempObj,
  136658. "positions",
  136659. referenceArray,
  136660. packetData.interval,
  136661. entityCollection,
  136662. PositionPropertyArray_default,
  136663. CompositePositionProperty_default
  136664. );
  136665. return tempObj.positions;
  136666. });
  136667. object2[propertyName] = new PositionPropertyArray_default(properties);
  136668. } else {
  136669. if (defined_default(packetData.cartesian)) {
  136670. packetData.array = packetData.cartesian.map(unpackCartesianArray);
  136671. } else if (defined_default(packetData.cartographicRadians)) {
  136672. packetData.array = packetData.cartographicRadians.map(
  136673. unpackCartographicRadiansArray
  136674. );
  136675. } else if (defined_default(packetData.cartographicDegrees)) {
  136676. packetData.array = packetData.cartographicDegrees.map(
  136677. unpackCartographicDegreesArray
  136678. );
  136679. }
  136680. if (defined_default(packetData.array)) {
  136681. processPacketData(
  136682. Array,
  136683. object2,
  136684. propertyName,
  136685. packetData,
  136686. void 0,
  136687. void 0,
  136688. entityCollection
  136689. );
  136690. }
  136691. }
  136692. }
  136693. function processPositionArrayOfArrays(object2, propertyName, packetData, entityCollection) {
  136694. if (!defined_default(packetData)) {
  136695. return;
  136696. }
  136697. if (Array.isArray(packetData)) {
  136698. for (let i2 = 0, length3 = packetData.length; i2 < length3; ++i2) {
  136699. processPositionArrayOfArraysPacketData(
  136700. object2,
  136701. propertyName,
  136702. packetData[i2],
  136703. entityCollection
  136704. );
  136705. }
  136706. } else {
  136707. processPositionArrayOfArraysPacketData(
  136708. object2,
  136709. propertyName,
  136710. packetData,
  136711. entityCollection
  136712. );
  136713. }
  136714. }
  136715. function processShape(object2, propertyName, packetData, entityCollection) {
  136716. if (!defined_default(packetData)) {
  136717. return;
  136718. }
  136719. if (Array.isArray(packetData)) {
  136720. for (let i2 = 0, length3 = packetData.length; i2 < length3; i2++) {
  136721. processShapePacketData(
  136722. object2,
  136723. propertyName,
  136724. packetData[i2],
  136725. entityCollection
  136726. );
  136727. }
  136728. } else {
  136729. processShapePacketData(object2, propertyName, packetData, entityCollection);
  136730. }
  136731. }
  136732. function processAvailability(entity, packet, entityCollection, sourceUri) {
  136733. const packetData = packet.availability;
  136734. if (!defined_default(packetData)) {
  136735. return;
  136736. }
  136737. let intervals;
  136738. if (Array.isArray(packetData)) {
  136739. for (let i2 = 0, len = packetData.length; i2 < len; ++i2) {
  136740. if (!defined_default(intervals)) {
  136741. intervals = new TimeIntervalCollection_default();
  136742. }
  136743. intervals.addInterval(intervalFromString(packetData[i2]));
  136744. }
  136745. } else {
  136746. intervals = new TimeIntervalCollection_default();
  136747. intervals.addInterval(intervalFromString(packetData));
  136748. }
  136749. entity.availability = intervals;
  136750. }
  136751. function processAlignedAxis(billboard, packetData, interval, sourceUri, entityCollection) {
  136752. if (!defined_default(packetData)) {
  136753. return;
  136754. }
  136755. processPacketData(
  136756. UnitCartesian3,
  136757. billboard,
  136758. "alignedAxis",
  136759. packetData,
  136760. interval,
  136761. sourceUri,
  136762. entityCollection
  136763. );
  136764. }
  136765. function processBillboard(entity, packet, entityCollection, sourceUri) {
  136766. const billboardData = packet.billboard;
  136767. if (!defined_default(billboardData)) {
  136768. return;
  136769. }
  136770. const interval = intervalFromString(billboardData.interval);
  136771. let billboard = entity.billboard;
  136772. if (!defined_default(billboard)) {
  136773. entity.billboard = billboard = new BillboardGraphics_default();
  136774. }
  136775. processPacketData(
  136776. Boolean,
  136777. billboard,
  136778. "show",
  136779. billboardData.show,
  136780. interval,
  136781. sourceUri,
  136782. entityCollection
  136783. );
  136784. processPacketData(
  136785. Image,
  136786. billboard,
  136787. "image",
  136788. billboardData.image,
  136789. interval,
  136790. sourceUri,
  136791. entityCollection
  136792. );
  136793. processPacketData(
  136794. Number,
  136795. billboard,
  136796. "scale",
  136797. billboardData.scale,
  136798. interval,
  136799. sourceUri,
  136800. entityCollection
  136801. );
  136802. processPacketData(
  136803. Cartesian2_default,
  136804. billboard,
  136805. "pixelOffset",
  136806. billboardData.pixelOffset,
  136807. interval,
  136808. sourceUri,
  136809. entityCollection
  136810. );
  136811. processPacketData(
  136812. Cartesian3_default,
  136813. billboard,
  136814. "eyeOffset",
  136815. billboardData.eyeOffset,
  136816. interval,
  136817. sourceUri,
  136818. entityCollection
  136819. );
  136820. processPacketData(
  136821. HorizontalOrigin_default,
  136822. billboard,
  136823. "horizontalOrigin",
  136824. billboardData.horizontalOrigin,
  136825. interval,
  136826. sourceUri,
  136827. entityCollection
  136828. );
  136829. processPacketData(
  136830. VerticalOrigin_default,
  136831. billboard,
  136832. "verticalOrigin",
  136833. billboardData.verticalOrigin,
  136834. interval,
  136835. sourceUri,
  136836. entityCollection
  136837. );
  136838. processPacketData(
  136839. HeightReference_default,
  136840. billboard,
  136841. "heightReference",
  136842. billboardData.heightReference,
  136843. interval,
  136844. sourceUri,
  136845. entityCollection
  136846. );
  136847. processPacketData(
  136848. Color_default,
  136849. billboard,
  136850. "color",
  136851. billboardData.color,
  136852. interval,
  136853. sourceUri,
  136854. entityCollection
  136855. );
  136856. processPacketData(
  136857. Rotation_default,
  136858. billboard,
  136859. "rotation",
  136860. billboardData.rotation,
  136861. interval,
  136862. sourceUri,
  136863. entityCollection
  136864. );
  136865. processAlignedAxis(
  136866. billboard,
  136867. billboardData.alignedAxis,
  136868. interval,
  136869. sourceUri,
  136870. entityCollection
  136871. );
  136872. processPacketData(
  136873. Boolean,
  136874. billboard,
  136875. "sizeInMeters",
  136876. billboardData.sizeInMeters,
  136877. interval,
  136878. sourceUri,
  136879. entityCollection
  136880. );
  136881. processPacketData(
  136882. Number,
  136883. billboard,
  136884. "width",
  136885. billboardData.width,
  136886. interval,
  136887. sourceUri,
  136888. entityCollection
  136889. );
  136890. processPacketData(
  136891. Number,
  136892. billboard,
  136893. "height",
  136894. billboardData.height,
  136895. interval,
  136896. sourceUri,
  136897. entityCollection
  136898. );
  136899. processPacketData(
  136900. NearFarScalar_default,
  136901. billboard,
  136902. "scaleByDistance",
  136903. billboardData.scaleByDistance,
  136904. interval,
  136905. sourceUri,
  136906. entityCollection
  136907. );
  136908. processPacketData(
  136909. NearFarScalar_default,
  136910. billboard,
  136911. "translucencyByDistance",
  136912. billboardData.translucencyByDistance,
  136913. interval,
  136914. sourceUri,
  136915. entityCollection
  136916. );
  136917. processPacketData(
  136918. NearFarScalar_default,
  136919. billboard,
  136920. "pixelOffsetScaleByDistance",
  136921. billboardData.pixelOffsetScaleByDistance,
  136922. interval,
  136923. sourceUri,
  136924. entityCollection
  136925. );
  136926. processPacketData(
  136927. BoundingRectangle_default,
  136928. billboard,
  136929. "imageSubRegion",
  136930. billboardData.imageSubRegion,
  136931. interval,
  136932. sourceUri,
  136933. entityCollection
  136934. );
  136935. processPacketData(
  136936. DistanceDisplayCondition_default,
  136937. billboard,
  136938. "distanceDisplayCondition",
  136939. billboardData.distanceDisplayCondition,
  136940. interval,
  136941. sourceUri,
  136942. entityCollection
  136943. );
  136944. processPacketData(
  136945. Number,
  136946. billboard,
  136947. "disableDepthTestDistance",
  136948. billboardData.disableDepthTestDistance,
  136949. interval,
  136950. sourceUri,
  136951. entityCollection
  136952. );
  136953. }
  136954. function processBox(entity, packet, entityCollection, sourceUri) {
  136955. const boxData = packet.box;
  136956. if (!defined_default(boxData)) {
  136957. return;
  136958. }
  136959. const interval = intervalFromString(boxData.interval);
  136960. let box = entity.box;
  136961. if (!defined_default(box)) {
  136962. entity.box = box = new BoxGraphics_default();
  136963. }
  136964. processPacketData(
  136965. Boolean,
  136966. box,
  136967. "show",
  136968. boxData.show,
  136969. interval,
  136970. sourceUri,
  136971. entityCollection
  136972. );
  136973. processPacketData(
  136974. Cartesian3_default,
  136975. box,
  136976. "dimensions",
  136977. boxData.dimensions,
  136978. interval,
  136979. sourceUri,
  136980. entityCollection
  136981. );
  136982. processPacketData(
  136983. HeightReference_default,
  136984. box,
  136985. "heightReference",
  136986. boxData.heightReference,
  136987. interval,
  136988. sourceUri,
  136989. entityCollection
  136990. );
  136991. processPacketData(
  136992. Boolean,
  136993. box,
  136994. "fill",
  136995. boxData.fill,
  136996. interval,
  136997. sourceUri,
  136998. entityCollection
  136999. );
  137000. processMaterialPacketData(
  137001. box,
  137002. "material",
  137003. boxData.material,
  137004. interval,
  137005. sourceUri,
  137006. entityCollection
  137007. );
  137008. processPacketData(
  137009. Boolean,
  137010. box,
  137011. "outline",
  137012. boxData.outline,
  137013. interval,
  137014. sourceUri,
  137015. entityCollection
  137016. );
  137017. processPacketData(
  137018. Color_default,
  137019. box,
  137020. "outlineColor",
  137021. boxData.outlineColor,
  137022. interval,
  137023. sourceUri,
  137024. entityCollection
  137025. );
  137026. processPacketData(
  137027. Number,
  137028. box,
  137029. "outlineWidth",
  137030. boxData.outlineWidth,
  137031. interval,
  137032. sourceUri,
  137033. entityCollection
  137034. );
  137035. processPacketData(
  137036. ShadowMode_default,
  137037. box,
  137038. "shadows",
  137039. boxData.shadows,
  137040. interval,
  137041. sourceUri,
  137042. entityCollection
  137043. );
  137044. processPacketData(
  137045. DistanceDisplayCondition_default,
  137046. box,
  137047. "distanceDisplayCondition",
  137048. boxData.distanceDisplayCondition,
  137049. interval,
  137050. sourceUri,
  137051. entityCollection
  137052. );
  137053. }
  137054. function processCorridor(entity, packet, entityCollection, sourceUri) {
  137055. const corridorData = packet.corridor;
  137056. if (!defined_default(corridorData)) {
  137057. return;
  137058. }
  137059. const interval = intervalFromString(corridorData.interval);
  137060. let corridor = entity.corridor;
  137061. if (!defined_default(corridor)) {
  137062. entity.corridor = corridor = new CorridorGraphics_default();
  137063. }
  137064. processPacketData(
  137065. Boolean,
  137066. corridor,
  137067. "show",
  137068. corridorData.show,
  137069. interval,
  137070. sourceUri,
  137071. entityCollection
  137072. );
  137073. processPositionArray(
  137074. corridor,
  137075. "positions",
  137076. corridorData.positions,
  137077. entityCollection
  137078. );
  137079. processPacketData(
  137080. Number,
  137081. corridor,
  137082. "width",
  137083. corridorData.width,
  137084. interval,
  137085. sourceUri,
  137086. entityCollection
  137087. );
  137088. processPacketData(
  137089. Number,
  137090. corridor,
  137091. "height",
  137092. corridorData.height,
  137093. interval,
  137094. sourceUri,
  137095. entityCollection
  137096. );
  137097. processPacketData(
  137098. HeightReference_default,
  137099. corridor,
  137100. "heightReference",
  137101. corridorData.heightReference,
  137102. interval,
  137103. sourceUri,
  137104. entityCollection
  137105. );
  137106. processPacketData(
  137107. Number,
  137108. corridor,
  137109. "extrudedHeight",
  137110. corridorData.extrudedHeight,
  137111. interval,
  137112. sourceUri,
  137113. entityCollection
  137114. );
  137115. processPacketData(
  137116. HeightReference_default,
  137117. corridor,
  137118. "extrudedHeightReference",
  137119. corridorData.extrudedHeightReference,
  137120. interval,
  137121. sourceUri,
  137122. entityCollection
  137123. );
  137124. processPacketData(
  137125. CornerType_default,
  137126. corridor,
  137127. "cornerType",
  137128. corridorData.cornerType,
  137129. interval,
  137130. sourceUri,
  137131. entityCollection
  137132. );
  137133. processPacketData(
  137134. Number,
  137135. corridor,
  137136. "granularity",
  137137. corridorData.granularity,
  137138. interval,
  137139. sourceUri,
  137140. entityCollection
  137141. );
  137142. processPacketData(
  137143. Boolean,
  137144. corridor,
  137145. "fill",
  137146. corridorData.fill,
  137147. interval,
  137148. sourceUri,
  137149. entityCollection
  137150. );
  137151. processMaterialPacketData(
  137152. corridor,
  137153. "material",
  137154. corridorData.material,
  137155. interval,
  137156. sourceUri,
  137157. entityCollection
  137158. );
  137159. processPacketData(
  137160. Boolean,
  137161. corridor,
  137162. "outline",
  137163. corridorData.outline,
  137164. interval,
  137165. sourceUri,
  137166. entityCollection
  137167. );
  137168. processPacketData(
  137169. Color_default,
  137170. corridor,
  137171. "outlineColor",
  137172. corridorData.outlineColor,
  137173. interval,
  137174. sourceUri,
  137175. entityCollection
  137176. );
  137177. processPacketData(
  137178. Number,
  137179. corridor,
  137180. "outlineWidth",
  137181. corridorData.outlineWidth,
  137182. interval,
  137183. sourceUri,
  137184. entityCollection
  137185. );
  137186. processPacketData(
  137187. ShadowMode_default,
  137188. corridor,
  137189. "shadows",
  137190. corridorData.shadows,
  137191. interval,
  137192. sourceUri,
  137193. entityCollection
  137194. );
  137195. processPacketData(
  137196. DistanceDisplayCondition_default,
  137197. corridor,
  137198. "distanceDisplayCondition",
  137199. corridorData.distanceDisplayCondition,
  137200. interval,
  137201. sourceUri,
  137202. entityCollection
  137203. );
  137204. processPacketData(
  137205. ClassificationType_default,
  137206. corridor,
  137207. "classificationType",
  137208. corridorData.classificationType,
  137209. interval,
  137210. sourceUri,
  137211. entityCollection
  137212. );
  137213. processPacketData(
  137214. Number,
  137215. corridor,
  137216. "zIndex",
  137217. corridorData.zIndex,
  137218. interval,
  137219. sourceUri,
  137220. entityCollection
  137221. );
  137222. }
  137223. function processCylinder(entity, packet, entityCollection, sourceUri) {
  137224. const cylinderData = packet.cylinder;
  137225. if (!defined_default(cylinderData)) {
  137226. return;
  137227. }
  137228. const interval = intervalFromString(cylinderData.interval);
  137229. let cylinder = entity.cylinder;
  137230. if (!defined_default(cylinder)) {
  137231. entity.cylinder = cylinder = new CylinderGraphics_default();
  137232. }
  137233. processPacketData(
  137234. Boolean,
  137235. cylinder,
  137236. "show",
  137237. cylinderData.show,
  137238. interval,
  137239. sourceUri,
  137240. entityCollection
  137241. );
  137242. processPacketData(
  137243. Number,
  137244. cylinder,
  137245. "length",
  137246. cylinderData.length,
  137247. interval,
  137248. sourceUri,
  137249. entityCollection
  137250. );
  137251. processPacketData(
  137252. Number,
  137253. cylinder,
  137254. "topRadius",
  137255. cylinderData.topRadius,
  137256. interval,
  137257. sourceUri,
  137258. entityCollection
  137259. );
  137260. processPacketData(
  137261. Number,
  137262. cylinder,
  137263. "bottomRadius",
  137264. cylinderData.bottomRadius,
  137265. interval,
  137266. sourceUri,
  137267. entityCollection
  137268. );
  137269. processPacketData(
  137270. HeightReference_default,
  137271. cylinder,
  137272. "heightReference",
  137273. cylinderData.heightReference,
  137274. interval,
  137275. sourceUri,
  137276. entityCollection
  137277. );
  137278. processPacketData(
  137279. Boolean,
  137280. cylinder,
  137281. "fill",
  137282. cylinderData.fill,
  137283. interval,
  137284. sourceUri,
  137285. entityCollection
  137286. );
  137287. processMaterialPacketData(
  137288. cylinder,
  137289. "material",
  137290. cylinderData.material,
  137291. interval,
  137292. sourceUri,
  137293. entityCollection
  137294. );
  137295. processPacketData(
  137296. Boolean,
  137297. cylinder,
  137298. "outline",
  137299. cylinderData.outline,
  137300. interval,
  137301. sourceUri,
  137302. entityCollection
  137303. );
  137304. processPacketData(
  137305. Color_default,
  137306. cylinder,
  137307. "outlineColor",
  137308. cylinderData.outlineColor,
  137309. interval,
  137310. sourceUri,
  137311. entityCollection
  137312. );
  137313. processPacketData(
  137314. Number,
  137315. cylinder,
  137316. "outlineWidth",
  137317. cylinderData.outlineWidth,
  137318. interval,
  137319. sourceUri,
  137320. entityCollection
  137321. );
  137322. processPacketData(
  137323. Number,
  137324. cylinder,
  137325. "numberOfVerticalLines",
  137326. cylinderData.numberOfVerticalLines,
  137327. interval,
  137328. sourceUri,
  137329. entityCollection
  137330. );
  137331. processPacketData(
  137332. Number,
  137333. cylinder,
  137334. "slices",
  137335. cylinderData.slices,
  137336. interval,
  137337. sourceUri,
  137338. entityCollection
  137339. );
  137340. processPacketData(
  137341. ShadowMode_default,
  137342. cylinder,
  137343. "shadows",
  137344. cylinderData.shadows,
  137345. interval,
  137346. sourceUri,
  137347. entityCollection
  137348. );
  137349. processPacketData(
  137350. DistanceDisplayCondition_default,
  137351. cylinder,
  137352. "distanceDisplayCondition",
  137353. cylinderData.distanceDisplayCondition,
  137354. interval,
  137355. sourceUri,
  137356. entityCollection
  137357. );
  137358. }
  137359. function processDocument(packet, dataSource) {
  137360. const version = packet.version;
  137361. if (defined_default(version)) {
  137362. if (typeof version === "string") {
  137363. const tokens = version.split(".");
  137364. if (tokens.length === 2) {
  137365. if (tokens[0] !== "1") {
  137366. throw new RuntimeError_default("Cesium only supports CZML version 1.");
  137367. }
  137368. dataSource._version = version;
  137369. }
  137370. }
  137371. }
  137372. if (!defined_default(dataSource._version)) {
  137373. throw new RuntimeError_default(
  137374. "CZML version information invalid. It is expected to be a property on the document object in the <Major>.<Minor> version format."
  137375. );
  137376. }
  137377. const documentPacket = dataSource._documentPacket;
  137378. if (defined_default(packet.name)) {
  137379. documentPacket.name = packet.name;
  137380. }
  137381. const clockPacket = packet.clock;
  137382. if (defined_default(clockPacket)) {
  137383. const clock = documentPacket.clock;
  137384. if (!defined_default(clock)) {
  137385. documentPacket.clock = {
  137386. interval: clockPacket.interval,
  137387. currentTime: clockPacket.currentTime,
  137388. range: clockPacket.range,
  137389. step: clockPacket.step,
  137390. multiplier: clockPacket.multiplier
  137391. };
  137392. } else {
  137393. clock.interval = defaultValue_default(clockPacket.interval, clock.interval);
  137394. clock.currentTime = defaultValue_default(
  137395. clockPacket.currentTime,
  137396. clock.currentTime
  137397. );
  137398. clock.range = defaultValue_default(clockPacket.range, clock.range);
  137399. clock.step = defaultValue_default(clockPacket.step, clock.step);
  137400. clock.multiplier = defaultValue_default(clockPacket.multiplier, clock.multiplier);
  137401. }
  137402. }
  137403. }
  137404. function processEllipse(entity, packet, entityCollection, sourceUri) {
  137405. const ellipseData = packet.ellipse;
  137406. if (!defined_default(ellipseData)) {
  137407. return;
  137408. }
  137409. const interval = intervalFromString(ellipseData.interval);
  137410. let ellipse = entity.ellipse;
  137411. if (!defined_default(ellipse)) {
  137412. entity.ellipse = ellipse = new EllipseGraphics_default();
  137413. }
  137414. processPacketData(
  137415. Boolean,
  137416. ellipse,
  137417. "show",
  137418. ellipseData.show,
  137419. interval,
  137420. sourceUri,
  137421. entityCollection
  137422. );
  137423. processPacketData(
  137424. Number,
  137425. ellipse,
  137426. "semiMajorAxis",
  137427. ellipseData.semiMajorAxis,
  137428. interval,
  137429. sourceUri,
  137430. entityCollection
  137431. );
  137432. processPacketData(
  137433. Number,
  137434. ellipse,
  137435. "semiMinorAxis",
  137436. ellipseData.semiMinorAxis,
  137437. interval,
  137438. sourceUri,
  137439. entityCollection
  137440. );
  137441. processPacketData(
  137442. Number,
  137443. ellipse,
  137444. "height",
  137445. ellipseData.height,
  137446. interval,
  137447. sourceUri,
  137448. entityCollection
  137449. );
  137450. processPacketData(
  137451. HeightReference_default,
  137452. ellipse,
  137453. "heightReference",
  137454. ellipseData.heightReference,
  137455. interval,
  137456. sourceUri,
  137457. entityCollection
  137458. );
  137459. processPacketData(
  137460. Number,
  137461. ellipse,
  137462. "extrudedHeight",
  137463. ellipseData.extrudedHeight,
  137464. interval,
  137465. sourceUri,
  137466. entityCollection
  137467. );
  137468. processPacketData(
  137469. HeightReference_default,
  137470. ellipse,
  137471. "extrudedHeightReference",
  137472. ellipseData.extrudedHeightReference,
  137473. interval,
  137474. sourceUri,
  137475. entityCollection
  137476. );
  137477. processPacketData(
  137478. Rotation_default,
  137479. ellipse,
  137480. "rotation",
  137481. ellipseData.rotation,
  137482. interval,
  137483. sourceUri,
  137484. entityCollection
  137485. );
  137486. processPacketData(
  137487. Rotation_default,
  137488. ellipse,
  137489. "stRotation",
  137490. ellipseData.stRotation,
  137491. interval,
  137492. sourceUri,
  137493. entityCollection
  137494. );
  137495. processPacketData(
  137496. Number,
  137497. ellipse,
  137498. "granularity",
  137499. ellipseData.granularity,
  137500. interval,
  137501. sourceUri,
  137502. entityCollection
  137503. );
  137504. processPacketData(
  137505. Boolean,
  137506. ellipse,
  137507. "fill",
  137508. ellipseData.fill,
  137509. interval,
  137510. sourceUri,
  137511. entityCollection
  137512. );
  137513. processMaterialPacketData(
  137514. ellipse,
  137515. "material",
  137516. ellipseData.material,
  137517. interval,
  137518. sourceUri,
  137519. entityCollection
  137520. );
  137521. processPacketData(
  137522. Boolean,
  137523. ellipse,
  137524. "outline",
  137525. ellipseData.outline,
  137526. interval,
  137527. sourceUri,
  137528. entityCollection
  137529. );
  137530. processPacketData(
  137531. Color_default,
  137532. ellipse,
  137533. "outlineColor",
  137534. ellipseData.outlineColor,
  137535. interval,
  137536. sourceUri,
  137537. entityCollection
  137538. );
  137539. processPacketData(
  137540. Number,
  137541. ellipse,
  137542. "outlineWidth",
  137543. ellipseData.outlineWidth,
  137544. interval,
  137545. sourceUri,
  137546. entityCollection
  137547. );
  137548. processPacketData(
  137549. Number,
  137550. ellipse,
  137551. "numberOfVerticalLines",
  137552. ellipseData.numberOfVerticalLines,
  137553. interval,
  137554. sourceUri,
  137555. entityCollection
  137556. );
  137557. processPacketData(
  137558. ShadowMode_default,
  137559. ellipse,
  137560. "shadows",
  137561. ellipseData.shadows,
  137562. interval,
  137563. sourceUri,
  137564. entityCollection
  137565. );
  137566. processPacketData(
  137567. DistanceDisplayCondition_default,
  137568. ellipse,
  137569. "distanceDisplayCondition",
  137570. ellipseData.distanceDisplayCondition,
  137571. interval,
  137572. sourceUri,
  137573. entityCollection
  137574. );
  137575. processPacketData(
  137576. ClassificationType_default,
  137577. ellipse,
  137578. "classificationType",
  137579. ellipseData.classificationType,
  137580. interval,
  137581. sourceUri,
  137582. entityCollection
  137583. );
  137584. processPacketData(
  137585. Number,
  137586. ellipse,
  137587. "zIndex",
  137588. ellipseData.zIndex,
  137589. interval,
  137590. sourceUri,
  137591. entityCollection
  137592. );
  137593. }
  137594. function processEllipsoid(entity, packet, entityCollection, sourceUri) {
  137595. const ellipsoidData = packet.ellipsoid;
  137596. if (!defined_default(ellipsoidData)) {
  137597. return;
  137598. }
  137599. const interval = intervalFromString(ellipsoidData.interval);
  137600. let ellipsoid = entity.ellipsoid;
  137601. if (!defined_default(ellipsoid)) {
  137602. entity.ellipsoid = ellipsoid = new EllipsoidGraphics_default();
  137603. }
  137604. processPacketData(
  137605. Boolean,
  137606. ellipsoid,
  137607. "show",
  137608. ellipsoidData.show,
  137609. interval,
  137610. sourceUri,
  137611. entityCollection
  137612. );
  137613. processPacketData(
  137614. Cartesian3_default,
  137615. ellipsoid,
  137616. "radii",
  137617. ellipsoidData.radii,
  137618. interval,
  137619. sourceUri,
  137620. entityCollection
  137621. );
  137622. processPacketData(
  137623. Cartesian3_default,
  137624. ellipsoid,
  137625. "innerRadii",
  137626. ellipsoidData.innerRadii,
  137627. interval,
  137628. sourceUri,
  137629. entityCollection
  137630. );
  137631. processPacketData(
  137632. Number,
  137633. ellipsoid,
  137634. "minimumClock",
  137635. ellipsoidData.minimumClock,
  137636. interval,
  137637. sourceUri,
  137638. entityCollection
  137639. );
  137640. processPacketData(
  137641. Number,
  137642. ellipsoid,
  137643. "maximumClock",
  137644. ellipsoidData.maximumClock,
  137645. interval,
  137646. sourceUri,
  137647. entityCollection
  137648. );
  137649. processPacketData(
  137650. Number,
  137651. ellipsoid,
  137652. "minimumCone",
  137653. ellipsoidData.minimumCone,
  137654. interval,
  137655. sourceUri,
  137656. entityCollection
  137657. );
  137658. processPacketData(
  137659. Number,
  137660. ellipsoid,
  137661. "maximumCone",
  137662. ellipsoidData.maximumCone,
  137663. interval,
  137664. sourceUri,
  137665. entityCollection
  137666. );
  137667. processPacketData(
  137668. HeightReference_default,
  137669. ellipsoid,
  137670. "heightReference",
  137671. ellipsoidData.heightReference,
  137672. interval,
  137673. sourceUri,
  137674. entityCollection
  137675. );
  137676. processPacketData(
  137677. Boolean,
  137678. ellipsoid,
  137679. "fill",
  137680. ellipsoidData.fill,
  137681. interval,
  137682. sourceUri,
  137683. entityCollection
  137684. );
  137685. processMaterialPacketData(
  137686. ellipsoid,
  137687. "material",
  137688. ellipsoidData.material,
  137689. interval,
  137690. sourceUri,
  137691. entityCollection
  137692. );
  137693. processPacketData(
  137694. Boolean,
  137695. ellipsoid,
  137696. "outline",
  137697. ellipsoidData.outline,
  137698. interval,
  137699. sourceUri,
  137700. entityCollection
  137701. );
  137702. processPacketData(
  137703. Color_default,
  137704. ellipsoid,
  137705. "outlineColor",
  137706. ellipsoidData.outlineColor,
  137707. interval,
  137708. sourceUri,
  137709. entityCollection
  137710. );
  137711. processPacketData(
  137712. Number,
  137713. ellipsoid,
  137714. "outlineWidth",
  137715. ellipsoidData.outlineWidth,
  137716. interval,
  137717. sourceUri,
  137718. entityCollection
  137719. );
  137720. processPacketData(
  137721. Number,
  137722. ellipsoid,
  137723. "stackPartitions",
  137724. ellipsoidData.stackPartitions,
  137725. interval,
  137726. sourceUri,
  137727. entityCollection
  137728. );
  137729. processPacketData(
  137730. Number,
  137731. ellipsoid,
  137732. "slicePartitions",
  137733. ellipsoidData.slicePartitions,
  137734. interval,
  137735. sourceUri,
  137736. entityCollection
  137737. );
  137738. processPacketData(
  137739. Number,
  137740. ellipsoid,
  137741. "subdivisions",
  137742. ellipsoidData.subdivisions,
  137743. interval,
  137744. sourceUri,
  137745. entityCollection
  137746. );
  137747. processPacketData(
  137748. ShadowMode_default,
  137749. ellipsoid,
  137750. "shadows",
  137751. ellipsoidData.shadows,
  137752. interval,
  137753. sourceUri,
  137754. entityCollection
  137755. );
  137756. processPacketData(
  137757. DistanceDisplayCondition_default,
  137758. ellipsoid,
  137759. "distanceDisplayCondition",
  137760. ellipsoidData.distanceDisplayCondition,
  137761. interval,
  137762. sourceUri,
  137763. entityCollection
  137764. );
  137765. }
  137766. function processLabel(entity, packet, entityCollection, sourceUri) {
  137767. const labelData = packet.label;
  137768. if (!defined_default(labelData)) {
  137769. return;
  137770. }
  137771. const interval = intervalFromString(labelData.interval);
  137772. let label = entity.label;
  137773. if (!defined_default(label)) {
  137774. entity.label = label = new LabelGraphics_default();
  137775. }
  137776. processPacketData(
  137777. Boolean,
  137778. label,
  137779. "show",
  137780. labelData.show,
  137781. interval,
  137782. sourceUri,
  137783. entityCollection
  137784. );
  137785. processPacketData(
  137786. String,
  137787. label,
  137788. "text",
  137789. labelData.text,
  137790. interval,
  137791. sourceUri,
  137792. entityCollection
  137793. );
  137794. processPacketData(
  137795. String,
  137796. label,
  137797. "font",
  137798. labelData.font,
  137799. interval,
  137800. sourceUri,
  137801. entityCollection
  137802. );
  137803. processPacketData(
  137804. LabelStyle_default,
  137805. label,
  137806. "style",
  137807. labelData.style,
  137808. interval,
  137809. sourceUri,
  137810. entityCollection
  137811. );
  137812. processPacketData(
  137813. Number,
  137814. label,
  137815. "scale",
  137816. labelData.scale,
  137817. interval,
  137818. sourceUri,
  137819. entityCollection
  137820. );
  137821. processPacketData(
  137822. Boolean,
  137823. label,
  137824. "showBackground",
  137825. labelData.showBackground,
  137826. interval,
  137827. sourceUri,
  137828. entityCollection
  137829. );
  137830. processPacketData(
  137831. Color_default,
  137832. label,
  137833. "backgroundColor",
  137834. labelData.backgroundColor,
  137835. interval,
  137836. sourceUri,
  137837. entityCollection
  137838. );
  137839. processPacketData(
  137840. Cartesian2_default,
  137841. label,
  137842. "backgroundPadding",
  137843. labelData.backgroundPadding,
  137844. interval,
  137845. sourceUri,
  137846. entityCollection
  137847. );
  137848. processPacketData(
  137849. Cartesian2_default,
  137850. label,
  137851. "pixelOffset",
  137852. labelData.pixelOffset,
  137853. interval,
  137854. sourceUri,
  137855. entityCollection
  137856. );
  137857. processPacketData(
  137858. Cartesian3_default,
  137859. label,
  137860. "eyeOffset",
  137861. labelData.eyeOffset,
  137862. interval,
  137863. sourceUri,
  137864. entityCollection
  137865. );
  137866. processPacketData(
  137867. HorizontalOrigin_default,
  137868. label,
  137869. "horizontalOrigin",
  137870. labelData.horizontalOrigin,
  137871. interval,
  137872. sourceUri,
  137873. entityCollection
  137874. );
  137875. processPacketData(
  137876. VerticalOrigin_default,
  137877. label,
  137878. "verticalOrigin",
  137879. labelData.verticalOrigin,
  137880. interval,
  137881. sourceUri,
  137882. entityCollection
  137883. );
  137884. processPacketData(
  137885. HeightReference_default,
  137886. label,
  137887. "heightReference",
  137888. labelData.heightReference,
  137889. interval,
  137890. sourceUri,
  137891. entityCollection
  137892. );
  137893. processPacketData(
  137894. Color_default,
  137895. label,
  137896. "fillColor",
  137897. labelData.fillColor,
  137898. interval,
  137899. sourceUri,
  137900. entityCollection
  137901. );
  137902. processPacketData(
  137903. Color_default,
  137904. label,
  137905. "outlineColor",
  137906. labelData.outlineColor,
  137907. interval,
  137908. sourceUri,
  137909. entityCollection
  137910. );
  137911. processPacketData(
  137912. Number,
  137913. label,
  137914. "outlineWidth",
  137915. labelData.outlineWidth,
  137916. interval,
  137917. sourceUri,
  137918. entityCollection
  137919. );
  137920. processPacketData(
  137921. NearFarScalar_default,
  137922. label,
  137923. "translucencyByDistance",
  137924. labelData.translucencyByDistance,
  137925. interval,
  137926. sourceUri,
  137927. entityCollection
  137928. );
  137929. processPacketData(
  137930. NearFarScalar_default,
  137931. label,
  137932. "pixelOffsetScaleByDistance",
  137933. labelData.pixelOffsetScaleByDistance,
  137934. interval,
  137935. sourceUri,
  137936. entityCollection
  137937. );
  137938. processPacketData(
  137939. NearFarScalar_default,
  137940. label,
  137941. "scaleByDistance",
  137942. labelData.scaleByDistance,
  137943. interval,
  137944. sourceUri,
  137945. entityCollection
  137946. );
  137947. processPacketData(
  137948. DistanceDisplayCondition_default,
  137949. label,
  137950. "distanceDisplayCondition",
  137951. labelData.distanceDisplayCondition,
  137952. interval,
  137953. sourceUri,
  137954. entityCollection
  137955. );
  137956. processPacketData(
  137957. Number,
  137958. label,
  137959. "disableDepthTestDistance",
  137960. labelData.disableDepthTestDistance,
  137961. interval,
  137962. sourceUri,
  137963. entityCollection
  137964. );
  137965. }
  137966. function processModel(entity, packet, entityCollection, sourceUri) {
  137967. const modelData = packet.model;
  137968. if (!defined_default(modelData)) {
  137969. return;
  137970. }
  137971. const interval = intervalFromString(modelData.interval);
  137972. let model = entity.model;
  137973. if (!defined_default(model)) {
  137974. entity.model = model = new ModelGraphics_default();
  137975. }
  137976. processPacketData(
  137977. Boolean,
  137978. model,
  137979. "show",
  137980. modelData.show,
  137981. interval,
  137982. sourceUri,
  137983. entityCollection
  137984. );
  137985. processPacketData(
  137986. URI,
  137987. model,
  137988. "uri",
  137989. modelData.gltf,
  137990. interval,
  137991. sourceUri,
  137992. entityCollection
  137993. );
  137994. processPacketData(
  137995. Number,
  137996. model,
  137997. "scale",
  137998. modelData.scale,
  137999. interval,
  138000. sourceUri,
  138001. entityCollection
  138002. );
  138003. processPacketData(
  138004. Number,
  138005. model,
  138006. "minimumPixelSize",
  138007. modelData.minimumPixelSize,
  138008. interval,
  138009. sourceUri,
  138010. entityCollection
  138011. );
  138012. processPacketData(
  138013. Number,
  138014. model,
  138015. "maximumScale",
  138016. modelData.maximumScale,
  138017. interval,
  138018. sourceUri,
  138019. entityCollection
  138020. );
  138021. processPacketData(
  138022. Boolean,
  138023. model,
  138024. "incrementallyLoadTextures",
  138025. modelData.incrementallyLoadTextures,
  138026. interval,
  138027. sourceUri,
  138028. entityCollection
  138029. );
  138030. processPacketData(
  138031. Boolean,
  138032. model,
  138033. "runAnimations",
  138034. modelData.runAnimations,
  138035. interval,
  138036. sourceUri,
  138037. entityCollection
  138038. );
  138039. processPacketData(
  138040. Boolean,
  138041. model,
  138042. "clampAnimations",
  138043. modelData.clampAnimations,
  138044. interval,
  138045. sourceUri,
  138046. entityCollection
  138047. );
  138048. processPacketData(
  138049. ShadowMode_default,
  138050. model,
  138051. "shadows",
  138052. modelData.shadows,
  138053. interval,
  138054. sourceUri,
  138055. entityCollection
  138056. );
  138057. processPacketData(
  138058. HeightReference_default,
  138059. model,
  138060. "heightReference",
  138061. modelData.heightReference,
  138062. interval,
  138063. sourceUri,
  138064. entityCollection
  138065. );
  138066. processPacketData(
  138067. Color_default,
  138068. model,
  138069. "silhouetteColor",
  138070. modelData.silhouetteColor,
  138071. interval,
  138072. sourceUri,
  138073. entityCollection
  138074. );
  138075. processPacketData(
  138076. Number,
  138077. model,
  138078. "silhouetteSize",
  138079. modelData.silhouetteSize,
  138080. interval,
  138081. sourceUri,
  138082. entityCollection
  138083. );
  138084. processPacketData(
  138085. Color_default,
  138086. model,
  138087. "color",
  138088. modelData.color,
  138089. interval,
  138090. sourceUri,
  138091. entityCollection
  138092. );
  138093. processPacketData(
  138094. ColorBlendMode_default,
  138095. model,
  138096. "colorBlendMode",
  138097. modelData.colorBlendMode,
  138098. interval,
  138099. sourceUri,
  138100. entityCollection
  138101. );
  138102. processPacketData(
  138103. Number,
  138104. model,
  138105. "colorBlendAmount",
  138106. modelData.colorBlendAmount,
  138107. interval,
  138108. sourceUri,
  138109. entityCollection
  138110. );
  138111. processPacketData(
  138112. DistanceDisplayCondition_default,
  138113. model,
  138114. "distanceDisplayCondition",
  138115. modelData.distanceDisplayCondition,
  138116. interval,
  138117. sourceUri,
  138118. entityCollection
  138119. );
  138120. let i2, len;
  138121. const nodeTransformationsData = modelData.nodeTransformations;
  138122. if (defined_default(nodeTransformationsData)) {
  138123. if (Array.isArray(nodeTransformationsData)) {
  138124. for (i2 = 0, len = nodeTransformationsData.length; i2 < len; ++i2) {
  138125. processNodeTransformations(
  138126. model,
  138127. nodeTransformationsData[i2],
  138128. interval,
  138129. sourceUri,
  138130. entityCollection
  138131. );
  138132. }
  138133. } else {
  138134. processNodeTransformations(
  138135. model,
  138136. nodeTransformationsData,
  138137. interval,
  138138. sourceUri,
  138139. entityCollection
  138140. );
  138141. }
  138142. }
  138143. const articulationsData = modelData.articulations;
  138144. if (defined_default(articulationsData)) {
  138145. if (Array.isArray(articulationsData)) {
  138146. for (i2 = 0, len = articulationsData.length; i2 < len; ++i2) {
  138147. processArticulations(
  138148. model,
  138149. articulationsData[i2],
  138150. interval,
  138151. sourceUri,
  138152. entityCollection
  138153. );
  138154. }
  138155. } else {
  138156. processArticulations(
  138157. model,
  138158. articulationsData,
  138159. interval,
  138160. sourceUri,
  138161. entityCollection
  138162. );
  138163. }
  138164. }
  138165. }
  138166. function processNodeTransformations(model, nodeTransformationsData, constrainedInterval, sourceUri, entityCollection) {
  138167. let combinedInterval = intervalFromString(nodeTransformationsData.interval);
  138168. if (defined_default(constrainedInterval)) {
  138169. if (defined_default(combinedInterval)) {
  138170. combinedInterval = TimeInterval_default.intersect(
  138171. combinedInterval,
  138172. constrainedInterval,
  138173. scratchTimeInterval
  138174. );
  138175. } else {
  138176. combinedInterval = constrainedInterval;
  138177. }
  138178. }
  138179. let nodeTransformations = model.nodeTransformations;
  138180. const nodeNames = Object.keys(nodeTransformationsData);
  138181. for (let i2 = 0, len = nodeNames.length; i2 < len; ++i2) {
  138182. const nodeName = nodeNames[i2];
  138183. if (nodeName === "interval") {
  138184. continue;
  138185. }
  138186. const nodeTransformationData = nodeTransformationsData[nodeName];
  138187. if (!defined_default(nodeTransformationData)) {
  138188. continue;
  138189. }
  138190. if (!defined_default(nodeTransformations)) {
  138191. model.nodeTransformations = nodeTransformations = new PropertyBag_default();
  138192. }
  138193. if (!nodeTransformations.hasProperty(nodeName)) {
  138194. nodeTransformations.addProperty(nodeName);
  138195. }
  138196. let nodeTransformation = nodeTransformations[nodeName];
  138197. if (!defined_default(nodeTransformation)) {
  138198. nodeTransformations[nodeName] = nodeTransformation = new NodeTransformationProperty_default();
  138199. }
  138200. processPacketData(
  138201. Cartesian3_default,
  138202. nodeTransformation,
  138203. "translation",
  138204. nodeTransformationData.translation,
  138205. combinedInterval,
  138206. sourceUri,
  138207. entityCollection
  138208. );
  138209. processPacketData(
  138210. Quaternion_default,
  138211. nodeTransformation,
  138212. "rotation",
  138213. nodeTransformationData.rotation,
  138214. combinedInterval,
  138215. sourceUri,
  138216. entityCollection
  138217. );
  138218. processPacketData(
  138219. Cartesian3_default,
  138220. nodeTransformation,
  138221. "scale",
  138222. nodeTransformationData.scale,
  138223. combinedInterval,
  138224. sourceUri,
  138225. entityCollection
  138226. );
  138227. }
  138228. }
  138229. function processArticulations(model, articulationsData, constrainedInterval, sourceUri, entityCollection) {
  138230. let combinedInterval = intervalFromString(articulationsData.interval);
  138231. if (defined_default(constrainedInterval)) {
  138232. if (defined_default(combinedInterval)) {
  138233. combinedInterval = TimeInterval_default.intersect(
  138234. combinedInterval,
  138235. constrainedInterval,
  138236. scratchTimeInterval
  138237. );
  138238. } else {
  138239. combinedInterval = constrainedInterval;
  138240. }
  138241. }
  138242. let articulations = model.articulations;
  138243. const keys = Object.keys(articulationsData);
  138244. for (let i2 = 0, len = keys.length; i2 < len; ++i2) {
  138245. const key = keys[i2];
  138246. if (key === "interval") {
  138247. continue;
  138248. }
  138249. const articulationStageData = articulationsData[key];
  138250. if (!defined_default(articulationStageData)) {
  138251. continue;
  138252. }
  138253. if (!defined_default(articulations)) {
  138254. model.articulations = articulations = new PropertyBag_default();
  138255. }
  138256. if (!articulations.hasProperty(key)) {
  138257. articulations.addProperty(key);
  138258. }
  138259. processPacketData(
  138260. Number,
  138261. articulations,
  138262. key,
  138263. articulationStageData,
  138264. combinedInterval,
  138265. sourceUri,
  138266. entityCollection
  138267. );
  138268. }
  138269. }
  138270. function processPath(entity, packet, entityCollection, sourceUri) {
  138271. const pathData = packet.path;
  138272. if (!defined_default(pathData)) {
  138273. return;
  138274. }
  138275. const interval = intervalFromString(pathData.interval);
  138276. let path = entity.path;
  138277. if (!defined_default(path)) {
  138278. entity.path = path = new PathGraphics_default();
  138279. }
  138280. processPacketData(
  138281. Boolean,
  138282. path,
  138283. "show",
  138284. pathData.show,
  138285. interval,
  138286. sourceUri,
  138287. entityCollection
  138288. );
  138289. processPacketData(
  138290. Number,
  138291. path,
  138292. "leadTime",
  138293. pathData.leadTime,
  138294. interval,
  138295. sourceUri,
  138296. entityCollection
  138297. );
  138298. processPacketData(
  138299. Number,
  138300. path,
  138301. "trailTime",
  138302. pathData.trailTime,
  138303. interval,
  138304. sourceUri,
  138305. entityCollection
  138306. );
  138307. processPacketData(
  138308. Number,
  138309. path,
  138310. "width",
  138311. pathData.width,
  138312. interval,
  138313. sourceUri,
  138314. entityCollection
  138315. );
  138316. processPacketData(
  138317. Number,
  138318. path,
  138319. "resolution",
  138320. pathData.resolution,
  138321. interval,
  138322. sourceUri,
  138323. entityCollection
  138324. );
  138325. processMaterialPacketData(
  138326. path,
  138327. "material",
  138328. pathData.material,
  138329. interval,
  138330. sourceUri,
  138331. entityCollection
  138332. );
  138333. processPacketData(
  138334. DistanceDisplayCondition_default,
  138335. path,
  138336. "distanceDisplayCondition",
  138337. pathData.distanceDisplayCondition,
  138338. interval,
  138339. sourceUri,
  138340. entityCollection
  138341. );
  138342. }
  138343. function processPoint(entity, packet, entityCollection, sourceUri) {
  138344. const pointData = packet.point;
  138345. if (!defined_default(pointData)) {
  138346. return;
  138347. }
  138348. const interval = intervalFromString(pointData.interval);
  138349. let point = entity.point;
  138350. if (!defined_default(point)) {
  138351. entity.point = point = new PointGraphics_default();
  138352. }
  138353. processPacketData(
  138354. Boolean,
  138355. point,
  138356. "show",
  138357. pointData.show,
  138358. interval,
  138359. sourceUri,
  138360. entityCollection
  138361. );
  138362. processPacketData(
  138363. Number,
  138364. point,
  138365. "pixelSize",
  138366. pointData.pixelSize,
  138367. interval,
  138368. sourceUri,
  138369. entityCollection
  138370. );
  138371. processPacketData(
  138372. HeightReference_default,
  138373. point,
  138374. "heightReference",
  138375. pointData.heightReference,
  138376. interval,
  138377. sourceUri,
  138378. entityCollection
  138379. );
  138380. processPacketData(
  138381. Color_default,
  138382. point,
  138383. "color",
  138384. pointData.color,
  138385. interval,
  138386. sourceUri,
  138387. entityCollection
  138388. );
  138389. processPacketData(
  138390. Color_default,
  138391. point,
  138392. "outlineColor",
  138393. pointData.outlineColor,
  138394. interval,
  138395. sourceUri,
  138396. entityCollection
  138397. );
  138398. processPacketData(
  138399. Number,
  138400. point,
  138401. "outlineWidth",
  138402. pointData.outlineWidth,
  138403. interval,
  138404. sourceUri,
  138405. entityCollection
  138406. );
  138407. processPacketData(
  138408. NearFarScalar_default,
  138409. point,
  138410. "scaleByDistance",
  138411. pointData.scaleByDistance,
  138412. interval,
  138413. sourceUri,
  138414. entityCollection
  138415. );
  138416. processPacketData(
  138417. NearFarScalar_default,
  138418. point,
  138419. "translucencyByDistance",
  138420. pointData.translucencyByDistance,
  138421. interval,
  138422. sourceUri,
  138423. entityCollection
  138424. );
  138425. processPacketData(
  138426. DistanceDisplayCondition_default,
  138427. point,
  138428. "distanceDisplayCondition",
  138429. pointData.distanceDisplayCondition,
  138430. interval,
  138431. sourceUri,
  138432. entityCollection
  138433. );
  138434. processPacketData(
  138435. Number,
  138436. point,
  138437. "disableDepthTestDistance",
  138438. pointData.disableDepthTestDistance,
  138439. interval,
  138440. sourceUri,
  138441. entityCollection
  138442. );
  138443. }
  138444. function PolygonHierarchyProperty(polygon) {
  138445. this.polygon = polygon;
  138446. this._definitionChanged = new Event_default();
  138447. }
  138448. Object.defineProperties(PolygonHierarchyProperty.prototype, {
  138449. isConstant: {
  138450. get: function() {
  138451. const positions = this.polygon._positions;
  138452. const holes = this.polygon._holes;
  138453. return (!defined_default(positions) || positions.isConstant) && (!defined_default(holes) || holes.isConstant);
  138454. }
  138455. },
  138456. definitionChanged: {
  138457. get: function() {
  138458. return this._definitionChanged;
  138459. }
  138460. }
  138461. });
  138462. PolygonHierarchyProperty.prototype.getValue = function(time, result) {
  138463. let positions;
  138464. if (defined_default(this.polygon._positions)) {
  138465. positions = this.polygon._positions.getValue(time);
  138466. }
  138467. let holes;
  138468. if (defined_default(this.polygon._holes)) {
  138469. holes = this.polygon._holes.getValue(time);
  138470. if (defined_default(holes)) {
  138471. holes = holes.map(function(holePositions) {
  138472. return new PolygonHierarchy_default(holePositions);
  138473. });
  138474. }
  138475. }
  138476. if (!defined_default(result)) {
  138477. return new PolygonHierarchy_default(positions, holes);
  138478. }
  138479. result.positions = positions;
  138480. result.holes = holes;
  138481. return result;
  138482. };
  138483. PolygonHierarchyProperty.prototype.equals = function(other) {
  138484. return this === other || other instanceof PolygonHierarchyProperty && Property_default.equals(this.polygon._positions, other.polygon._positions) && Property_default.equals(this.polygon._holes, other.polygon._holes);
  138485. };
  138486. function processPolygon(entity, packet, entityCollection, sourceUri) {
  138487. const polygonData = packet.polygon;
  138488. if (!defined_default(polygonData)) {
  138489. return;
  138490. }
  138491. const interval = intervalFromString(polygonData.interval);
  138492. let polygon = entity.polygon;
  138493. if (!defined_default(polygon)) {
  138494. entity.polygon = polygon = new PolygonGraphics_default();
  138495. }
  138496. processPacketData(
  138497. Boolean,
  138498. polygon,
  138499. "show",
  138500. polygonData.show,
  138501. interval,
  138502. sourceUri,
  138503. entityCollection
  138504. );
  138505. processPositionArray(
  138506. polygon,
  138507. "_positions",
  138508. polygonData.positions,
  138509. entityCollection
  138510. );
  138511. processPositionArrayOfArrays(
  138512. polygon,
  138513. "_holes",
  138514. polygonData.holes,
  138515. entityCollection
  138516. );
  138517. if (defined_default(polygon._positions) || defined_default(polygon._holes)) {
  138518. polygon.hierarchy = new PolygonHierarchyProperty(polygon);
  138519. }
  138520. processPacketData(
  138521. Number,
  138522. polygon,
  138523. "height",
  138524. polygonData.height,
  138525. interval,
  138526. sourceUri,
  138527. entityCollection
  138528. );
  138529. processPacketData(
  138530. HeightReference_default,
  138531. polygon,
  138532. "heightReference",
  138533. polygonData.heightReference,
  138534. interval,
  138535. sourceUri,
  138536. entityCollection
  138537. );
  138538. processPacketData(
  138539. Number,
  138540. polygon,
  138541. "extrudedHeight",
  138542. polygonData.extrudedHeight,
  138543. interval,
  138544. sourceUri,
  138545. entityCollection
  138546. );
  138547. processPacketData(
  138548. HeightReference_default,
  138549. polygon,
  138550. "extrudedHeightReference",
  138551. polygonData.extrudedHeightReference,
  138552. interval,
  138553. sourceUri,
  138554. entityCollection
  138555. );
  138556. processPacketData(
  138557. Rotation_default,
  138558. polygon,
  138559. "stRotation",
  138560. polygonData.stRotation,
  138561. interval,
  138562. sourceUri,
  138563. entityCollection
  138564. );
  138565. processPacketData(
  138566. Number,
  138567. polygon,
  138568. "granularity",
  138569. polygonData.granularity,
  138570. interval,
  138571. sourceUri,
  138572. entityCollection
  138573. );
  138574. processPacketData(
  138575. Boolean,
  138576. polygon,
  138577. "fill",
  138578. polygonData.fill,
  138579. interval,
  138580. sourceUri,
  138581. entityCollection
  138582. );
  138583. processMaterialPacketData(
  138584. polygon,
  138585. "material",
  138586. polygonData.material,
  138587. interval,
  138588. sourceUri,
  138589. entityCollection
  138590. );
  138591. processPacketData(
  138592. Boolean,
  138593. polygon,
  138594. "outline",
  138595. polygonData.outline,
  138596. interval,
  138597. sourceUri,
  138598. entityCollection
  138599. );
  138600. processPacketData(
  138601. Color_default,
  138602. polygon,
  138603. "outlineColor",
  138604. polygonData.outlineColor,
  138605. interval,
  138606. sourceUri,
  138607. entityCollection
  138608. );
  138609. processPacketData(
  138610. Number,
  138611. polygon,
  138612. "outlineWidth",
  138613. polygonData.outlineWidth,
  138614. interval,
  138615. sourceUri,
  138616. entityCollection
  138617. );
  138618. processPacketData(
  138619. Boolean,
  138620. polygon,
  138621. "perPositionHeight",
  138622. polygonData.perPositionHeight,
  138623. interval,
  138624. sourceUri,
  138625. entityCollection
  138626. );
  138627. processPacketData(
  138628. Boolean,
  138629. polygon,
  138630. "closeTop",
  138631. polygonData.closeTop,
  138632. interval,
  138633. sourceUri,
  138634. entityCollection
  138635. );
  138636. processPacketData(
  138637. Boolean,
  138638. polygon,
  138639. "closeBottom",
  138640. polygonData.closeBottom,
  138641. interval,
  138642. sourceUri,
  138643. entityCollection
  138644. );
  138645. processPacketData(
  138646. ArcType_default,
  138647. polygon,
  138648. "arcType",
  138649. polygonData.arcType,
  138650. interval,
  138651. sourceUri,
  138652. entityCollection
  138653. );
  138654. processPacketData(
  138655. ShadowMode_default,
  138656. polygon,
  138657. "shadows",
  138658. polygonData.shadows,
  138659. interval,
  138660. sourceUri,
  138661. entityCollection
  138662. );
  138663. processPacketData(
  138664. DistanceDisplayCondition_default,
  138665. polygon,
  138666. "distanceDisplayCondition",
  138667. polygonData.distanceDisplayCondition,
  138668. interval,
  138669. sourceUri,
  138670. entityCollection
  138671. );
  138672. processPacketData(
  138673. ClassificationType_default,
  138674. polygon,
  138675. "classificationType",
  138676. polygonData.classificationType,
  138677. interval,
  138678. sourceUri,
  138679. entityCollection
  138680. );
  138681. processPacketData(
  138682. Number,
  138683. polygon,
  138684. "zIndex",
  138685. polygonData.zIndex,
  138686. interval,
  138687. sourceUri,
  138688. entityCollection
  138689. );
  138690. }
  138691. function adaptFollowSurfaceToArcType(followSurface) {
  138692. return followSurface ? ArcType_default.GEODESIC : ArcType_default.NONE;
  138693. }
  138694. function processPolyline(entity, packet, entityCollection, sourceUri) {
  138695. const polylineData = packet.polyline;
  138696. if (!defined_default(polylineData)) {
  138697. return;
  138698. }
  138699. const interval = intervalFromString(polylineData.interval);
  138700. let polyline = entity.polyline;
  138701. if (!defined_default(polyline)) {
  138702. entity.polyline = polyline = new PolylineGraphics_default();
  138703. }
  138704. processPacketData(
  138705. Boolean,
  138706. polyline,
  138707. "show",
  138708. polylineData.show,
  138709. interval,
  138710. sourceUri,
  138711. entityCollection
  138712. );
  138713. processPositionArray(
  138714. polyline,
  138715. "positions",
  138716. polylineData.positions,
  138717. entityCollection
  138718. );
  138719. processPacketData(
  138720. Number,
  138721. polyline,
  138722. "width",
  138723. polylineData.width,
  138724. interval,
  138725. sourceUri,
  138726. entityCollection
  138727. );
  138728. processPacketData(
  138729. Number,
  138730. polyline,
  138731. "granularity",
  138732. polylineData.granularity,
  138733. interval,
  138734. sourceUri,
  138735. entityCollection
  138736. );
  138737. processMaterialPacketData(
  138738. polyline,
  138739. "material",
  138740. polylineData.material,
  138741. interval,
  138742. sourceUri,
  138743. entityCollection
  138744. );
  138745. processMaterialPacketData(
  138746. polyline,
  138747. "depthFailMaterial",
  138748. polylineData.depthFailMaterial,
  138749. interval,
  138750. sourceUri,
  138751. entityCollection
  138752. );
  138753. processPacketData(
  138754. ArcType_default,
  138755. polyline,
  138756. "arcType",
  138757. polylineData.arcType,
  138758. interval,
  138759. sourceUri,
  138760. entityCollection
  138761. );
  138762. processPacketData(
  138763. Boolean,
  138764. polyline,
  138765. "clampToGround",
  138766. polylineData.clampToGround,
  138767. interval,
  138768. sourceUri,
  138769. entityCollection
  138770. );
  138771. processPacketData(
  138772. ShadowMode_default,
  138773. polyline,
  138774. "shadows",
  138775. polylineData.shadows,
  138776. interval,
  138777. sourceUri,
  138778. entityCollection
  138779. );
  138780. processPacketData(
  138781. DistanceDisplayCondition_default,
  138782. polyline,
  138783. "distanceDisplayCondition",
  138784. polylineData.distanceDisplayCondition,
  138785. interval,
  138786. sourceUri,
  138787. entityCollection
  138788. );
  138789. processPacketData(
  138790. ClassificationType_default,
  138791. polyline,
  138792. "classificationType",
  138793. polylineData.classificationType,
  138794. interval,
  138795. sourceUri,
  138796. entityCollection
  138797. );
  138798. processPacketData(
  138799. Number,
  138800. polyline,
  138801. "zIndex",
  138802. polylineData.zIndex,
  138803. interval,
  138804. sourceUri,
  138805. entityCollection
  138806. );
  138807. if (defined_default(polylineData.followSurface) && !defined_default(polylineData.arcType)) {
  138808. const tempObj = {};
  138809. processPacketData(
  138810. Boolean,
  138811. tempObj,
  138812. "followSurface",
  138813. polylineData.followSurface,
  138814. interval,
  138815. sourceUri,
  138816. entityCollection
  138817. );
  138818. polyline.arcType = createAdapterProperty(
  138819. tempObj.followSurface,
  138820. adaptFollowSurfaceToArcType
  138821. );
  138822. }
  138823. }
  138824. function processPolylineVolume(entity, packet, entityCollection, sourceUri) {
  138825. const polylineVolumeData = packet.polylineVolume;
  138826. if (!defined_default(polylineVolumeData)) {
  138827. return;
  138828. }
  138829. const interval = intervalFromString(polylineVolumeData.interval);
  138830. let polylineVolume = entity.polylineVolume;
  138831. if (!defined_default(polylineVolume)) {
  138832. entity.polylineVolume = polylineVolume = new PolylineVolumeGraphics_default();
  138833. }
  138834. processPositionArray(
  138835. polylineVolume,
  138836. "positions",
  138837. polylineVolumeData.positions,
  138838. entityCollection
  138839. );
  138840. processShape(
  138841. polylineVolume,
  138842. "shape",
  138843. polylineVolumeData.shape,
  138844. entityCollection
  138845. );
  138846. processPacketData(
  138847. Boolean,
  138848. polylineVolume,
  138849. "show",
  138850. polylineVolumeData.show,
  138851. interval,
  138852. sourceUri,
  138853. entityCollection
  138854. );
  138855. processPacketData(
  138856. CornerType_default,
  138857. polylineVolume,
  138858. "cornerType",
  138859. polylineVolumeData.cornerType,
  138860. interval,
  138861. sourceUri,
  138862. entityCollection
  138863. );
  138864. processPacketData(
  138865. Boolean,
  138866. polylineVolume,
  138867. "fill",
  138868. polylineVolumeData.fill,
  138869. interval,
  138870. sourceUri,
  138871. entityCollection
  138872. );
  138873. processMaterialPacketData(
  138874. polylineVolume,
  138875. "material",
  138876. polylineVolumeData.material,
  138877. interval,
  138878. sourceUri,
  138879. entityCollection
  138880. );
  138881. processPacketData(
  138882. Boolean,
  138883. polylineVolume,
  138884. "outline",
  138885. polylineVolumeData.outline,
  138886. interval,
  138887. sourceUri,
  138888. entityCollection
  138889. );
  138890. processPacketData(
  138891. Color_default,
  138892. polylineVolume,
  138893. "outlineColor",
  138894. polylineVolumeData.outlineColor,
  138895. interval,
  138896. sourceUri,
  138897. entityCollection
  138898. );
  138899. processPacketData(
  138900. Number,
  138901. polylineVolume,
  138902. "outlineWidth",
  138903. polylineVolumeData.outlineWidth,
  138904. interval,
  138905. sourceUri,
  138906. entityCollection
  138907. );
  138908. processPacketData(
  138909. Number,
  138910. polylineVolume,
  138911. "granularity",
  138912. polylineVolumeData.granularity,
  138913. interval,
  138914. sourceUri,
  138915. entityCollection
  138916. );
  138917. processPacketData(
  138918. ShadowMode_default,
  138919. polylineVolume,
  138920. "shadows",
  138921. polylineVolumeData.shadows,
  138922. interval,
  138923. sourceUri,
  138924. entityCollection
  138925. );
  138926. processPacketData(
  138927. DistanceDisplayCondition_default,
  138928. polylineVolume,
  138929. "distanceDisplayCondition",
  138930. polylineVolumeData.distanceDisplayCondition,
  138931. interval,
  138932. sourceUri,
  138933. entityCollection
  138934. );
  138935. }
  138936. function processRectangle(entity, packet, entityCollection, sourceUri) {
  138937. const rectangleData = packet.rectangle;
  138938. if (!defined_default(rectangleData)) {
  138939. return;
  138940. }
  138941. const interval = intervalFromString(rectangleData.interval);
  138942. let rectangle = entity.rectangle;
  138943. if (!defined_default(rectangle)) {
  138944. entity.rectangle = rectangle = new RectangleGraphics_default();
  138945. }
  138946. processPacketData(
  138947. Boolean,
  138948. rectangle,
  138949. "show",
  138950. rectangleData.show,
  138951. interval,
  138952. sourceUri,
  138953. entityCollection
  138954. );
  138955. processPacketData(
  138956. Rectangle_default,
  138957. rectangle,
  138958. "coordinates",
  138959. rectangleData.coordinates,
  138960. interval,
  138961. sourceUri,
  138962. entityCollection
  138963. );
  138964. processPacketData(
  138965. Number,
  138966. rectangle,
  138967. "height",
  138968. rectangleData.height,
  138969. interval,
  138970. sourceUri,
  138971. entityCollection
  138972. );
  138973. processPacketData(
  138974. HeightReference_default,
  138975. rectangle,
  138976. "heightReference",
  138977. rectangleData.heightReference,
  138978. interval,
  138979. sourceUri,
  138980. entityCollection
  138981. );
  138982. processPacketData(
  138983. Number,
  138984. rectangle,
  138985. "extrudedHeight",
  138986. rectangleData.extrudedHeight,
  138987. interval,
  138988. sourceUri,
  138989. entityCollection
  138990. );
  138991. processPacketData(
  138992. HeightReference_default,
  138993. rectangle,
  138994. "extrudedHeightReference",
  138995. rectangleData.extrudedHeightReference,
  138996. interval,
  138997. sourceUri,
  138998. entityCollection
  138999. );
  139000. processPacketData(
  139001. Rotation_default,
  139002. rectangle,
  139003. "rotation",
  139004. rectangleData.rotation,
  139005. interval,
  139006. sourceUri,
  139007. entityCollection
  139008. );
  139009. processPacketData(
  139010. Rotation_default,
  139011. rectangle,
  139012. "stRotation",
  139013. rectangleData.stRotation,
  139014. interval,
  139015. sourceUri,
  139016. entityCollection
  139017. );
  139018. processPacketData(
  139019. Number,
  139020. rectangle,
  139021. "granularity",
  139022. rectangleData.granularity,
  139023. interval,
  139024. sourceUri,
  139025. entityCollection
  139026. );
  139027. processPacketData(
  139028. Boolean,
  139029. rectangle,
  139030. "fill",
  139031. rectangleData.fill,
  139032. interval,
  139033. sourceUri,
  139034. entityCollection
  139035. );
  139036. processMaterialPacketData(
  139037. rectangle,
  139038. "material",
  139039. rectangleData.material,
  139040. interval,
  139041. sourceUri,
  139042. entityCollection
  139043. );
  139044. processPacketData(
  139045. Boolean,
  139046. rectangle,
  139047. "outline",
  139048. rectangleData.outline,
  139049. interval,
  139050. sourceUri,
  139051. entityCollection
  139052. );
  139053. processPacketData(
  139054. Color_default,
  139055. rectangle,
  139056. "outlineColor",
  139057. rectangleData.outlineColor,
  139058. interval,
  139059. sourceUri,
  139060. entityCollection
  139061. );
  139062. processPacketData(
  139063. Number,
  139064. rectangle,
  139065. "outlineWidth",
  139066. rectangleData.outlineWidth,
  139067. interval,
  139068. sourceUri,
  139069. entityCollection
  139070. );
  139071. processPacketData(
  139072. ShadowMode_default,
  139073. rectangle,
  139074. "shadows",
  139075. rectangleData.shadows,
  139076. interval,
  139077. sourceUri,
  139078. entityCollection
  139079. );
  139080. processPacketData(
  139081. DistanceDisplayCondition_default,
  139082. rectangle,
  139083. "distanceDisplayCondition",
  139084. rectangleData.distanceDisplayCondition,
  139085. interval,
  139086. sourceUri,
  139087. entityCollection
  139088. );
  139089. processPacketData(
  139090. ClassificationType_default,
  139091. rectangle,
  139092. "classificationType",
  139093. rectangleData.classificationType,
  139094. interval,
  139095. sourceUri,
  139096. entityCollection
  139097. );
  139098. processPacketData(
  139099. Number,
  139100. rectangle,
  139101. "zIndex",
  139102. rectangleData.zIndex,
  139103. interval,
  139104. sourceUri,
  139105. entityCollection
  139106. );
  139107. }
  139108. function processTileset(entity, packet, entityCollection, sourceUri) {
  139109. const tilesetData = packet.tileset;
  139110. if (!defined_default(tilesetData)) {
  139111. return;
  139112. }
  139113. const interval = intervalFromString(tilesetData.interval);
  139114. let tileset = entity.tileset;
  139115. if (!defined_default(tileset)) {
  139116. entity.tileset = tileset = new Cesium3DTilesetGraphics_default();
  139117. }
  139118. processPacketData(
  139119. Boolean,
  139120. tileset,
  139121. "show",
  139122. tilesetData.show,
  139123. interval,
  139124. sourceUri,
  139125. entityCollection
  139126. );
  139127. processPacketData(
  139128. URI,
  139129. tileset,
  139130. "uri",
  139131. tilesetData.uri,
  139132. interval,
  139133. sourceUri,
  139134. entityCollection
  139135. );
  139136. processPacketData(
  139137. Number,
  139138. tileset,
  139139. "maximumScreenSpaceError",
  139140. tilesetData.maximumScreenSpaceError,
  139141. interval,
  139142. sourceUri,
  139143. entityCollection
  139144. );
  139145. }
  139146. function processWall(entity, packet, entityCollection, sourceUri) {
  139147. const wallData = packet.wall;
  139148. if (!defined_default(wallData)) {
  139149. return;
  139150. }
  139151. const interval = intervalFromString(wallData.interval);
  139152. let wall = entity.wall;
  139153. if (!defined_default(wall)) {
  139154. entity.wall = wall = new WallGraphics_default();
  139155. }
  139156. processPacketData(
  139157. Boolean,
  139158. wall,
  139159. "show",
  139160. wallData.show,
  139161. interval,
  139162. sourceUri,
  139163. entityCollection
  139164. );
  139165. processPositionArray(wall, "positions", wallData.positions, entityCollection);
  139166. processArray(
  139167. wall,
  139168. "minimumHeights",
  139169. wallData.minimumHeights,
  139170. entityCollection
  139171. );
  139172. processArray(
  139173. wall,
  139174. "maximumHeights",
  139175. wallData.maximumHeights,
  139176. entityCollection
  139177. );
  139178. processPacketData(
  139179. Number,
  139180. wall,
  139181. "granularity",
  139182. wallData.granularity,
  139183. interval,
  139184. sourceUri,
  139185. entityCollection
  139186. );
  139187. processPacketData(
  139188. Boolean,
  139189. wall,
  139190. "fill",
  139191. wallData.fill,
  139192. interval,
  139193. sourceUri,
  139194. entityCollection
  139195. );
  139196. processMaterialPacketData(
  139197. wall,
  139198. "material",
  139199. wallData.material,
  139200. interval,
  139201. sourceUri,
  139202. entityCollection
  139203. );
  139204. processPacketData(
  139205. Boolean,
  139206. wall,
  139207. "outline",
  139208. wallData.outline,
  139209. interval,
  139210. sourceUri,
  139211. entityCollection
  139212. );
  139213. processPacketData(
  139214. Color_default,
  139215. wall,
  139216. "outlineColor",
  139217. wallData.outlineColor,
  139218. interval,
  139219. sourceUri,
  139220. entityCollection
  139221. );
  139222. processPacketData(
  139223. Number,
  139224. wall,
  139225. "outlineWidth",
  139226. wallData.outlineWidth,
  139227. interval,
  139228. sourceUri,
  139229. entityCollection
  139230. );
  139231. processPacketData(
  139232. ShadowMode_default,
  139233. wall,
  139234. "shadows",
  139235. wallData.shadows,
  139236. interval,
  139237. sourceUri,
  139238. entityCollection
  139239. );
  139240. processPacketData(
  139241. DistanceDisplayCondition_default,
  139242. wall,
  139243. "distanceDisplayCondition",
  139244. wallData.distanceDisplayCondition,
  139245. interval,
  139246. sourceUri,
  139247. entityCollection
  139248. );
  139249. }
  139250. function processCzmlPacket(packet, entityCollection, updaterFunctions, sourceUri, dataSource) {
  139251. let objectId = packet.id;
  139252. if (!defined_default(objectId)) {
  139253. objectId = createGuid_default();
  139254. }
  139255. currentId = objectId;
  139256. if (!defined_default(dataSource._version) && objectId !== "document") {
  139257. throw new RuntimeError_default(
  139258. "The first CZML packet is required to be the document object."
  139259. );
  139260. }
  139261. if (packet["delete"] === true) {
  139262. entityCollection.removeById(objectId);
  139263. } else if (objectId === "document") {
  139264. processDocument(packet, dataSource);
  139265. } else {
  139266. const entity = entityCollection.getOrCreateEntity(objectId);
  139267. const parentId = packet.parent;
  139268. if (defined_default(parentId)) {
  139269. entity.parent = entityCollection.getOrCreateEntity(parentId);
  139270. }
  139271. for (let i2 = updaterFunctions.length - 1; i2 > -1; i2--) {
  139272. updaterFunctions[i2](entity, packet, entityCollection, sourceUri);
  139273. }
  139274. }
  139275. currentId = void 0;
  139276. }
  139277. function updateClock(dataSource) {
  139278. let clock;
  139279. const clockPacket = dataSource._documentPacket.clock;
  139280. if (!defined_default(clockPacket)) {
  139281. if (!defined_default(dataSource._clock)) {
  139282. const availability = dataSource._entityCollection.computeAvailability();
  139283. if (!availability.start.equals(Iso8601_default.MINIMUM_VALUE)) {
  139284. const startTime = availability.start;
  139285. const stopTime = availability.stop;
  139286. const totalSeconds = JulianDate_default.secondsDifference(stopTime, startTime);
  139287. const multiplier = Math.round(totalSeconds / 120);
  139288. clock = new DataSourceClock_default();
  139289. clock.startTime = JulianDate_default.clone(startTime);
  139290. clock.stopTime = JulianDate_default.clone(stopTime);
  139291. clock.clockRange = ClockRange_default.LOOP_STOP;
  139292. clock.multiplier = multiplier;
  139293. clock.currentTime = JulianDate_default.clone(startTime);
  139294. clock.clockStep = ClockStep_default.SYSTEM_CLOCK_MULTIPLIER;
  139295. dataSource._clock = clock;
  139296. return true;
  139297. }
  139298. }
  139299. return false;
  139300. }
  139301. if (defined_default(dataSource._clock)) {
  139302. clock = dataSource._clock.clone();
  139303. } else {
  139304. clock = new DataSourceClock_default();
  139305. clock.startTime = Iso8601_default.MINIMUM_VALUE.clone();
  139306. clock.stopTime = Iso8601_default.MAXIMUM_VALUE.clone();
  139307. clock.currentTime = Iso8601_default.MINIMUM_VALUE.clone();
  139308. clock.clockRange = ClockRange_default.LOOP_STOP;
  139309. clock.clockStep = ClockStep_default.SYSTEM_CLOCK_MULTIPLIER;
  139310. clock.multiplier = 1;
  139311. }
  139312. const interval = intervalFromString(clockPacket.interval);
  139313. if (defined_default(interval)) {
  139314. clock.startTime = interval.start;
  139315. clock.stopTime = interval.stop;
  139316. }
  139317. if (defined_default(clockPacket.currentTime)) {
  139318. clock.currentTime = JulianDate_default.fromIso8601(clockPacket.currentTime);
  139319. }
  139320. if (defined_default(clockPacket.range)) {
  139321. clock.clockRange = defaultValue_default(
  139322. ClockRange_default[clockPacket.range],
  139323. ClockRange_default.LOOP_STOP
  139324. );
  139325. }
  139326. if (defined_default(clockPacket.step)) {
  139327. clock.clockStep = defaultValue_default(
  139328. ClockStep_default[clockPacket.step],
  139329. ClockStep_default.SYSTEM_CLOCK_MULTIPLIER
  139330. );
  139331. }
  139332. if (defined_default(clockPacket.multiplier)) {
  139333. clock.multiplier = clockPacket.multiplier;
  139334. }
  139335. if (!clock.equals(dataSource._clock)) {
  139336. dataSource._clock = clock.clone(dataSource._clock);
  139337. return true;
  139338. }
  139339. return false;
  139340. }
  139341. function load(dataSource, czml, options, clear2) {
  139342. if (!defined_default(czml)) {
  139343. throw new DeveloperError_default("czml is required.");
  139344. }
  139345. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  139346. let promise = czml;
  139347. let sourceUri = options.sourceUri;
  139348. let credit = options.credit;
  139349. if (typeof credit === "string") {
  139350. credit = new Credit_default(credit);
  139351. }
  139352. dataSource._credit = credit;
  139353. if (typeof czml === "string" || czml instanceof Resource_default) {
  139354. czml = Resource_default.createIfNeeded(czml);
  139355. promise = czml.fetchJson();
  139356. sourceUri = defaultValue_default(sourceUri, czml.clone());
  139357. const resourceCredits = dataSource._resourceCredits;
  139358. const credits = czml.credits;
  139359. if (defined_default(credits)) {
  139360. const length3 = credits.length;
  139361. for (let i2 = 0; i2 < length3; i2++) {
  139362. resourceCredits.push(credits[i2]);
  139363. }
  139364. }
  139365. }
  139366. sourceUri = Resource_default.createIfNeeded(sourceUri);
  139367. DataSource_default.setLoading(dataSource, true);
  139368. return Promise.resolve(promise).then(function(czml2) {
  139369. return loadCzml(dataSource, czml2, sourceUri, clear2);
  139370. }).catch(function(error) {
  139371. DataSource_default.setLoading(dataSource, false);
  139372. dataSource._error.raiseEvent(dataSource, error);
  139373. console.log(error);
  139374. return Promise.reject(error);
  139375. });
  139376. }
  139377. function loadCzml(dataSource, czml, sourceUri, clear2) {
  139378. DataSource_default.setLoading(dataSource, true);
  139379. const entityCollection = dataSource._entityCollection;
  139380. if (clear2) {
  139381. dataSource._version = void 0;
  139382. dataSource._documentPacket = new DocumentPacket();
  139383. entityCollection.removeAll();
  139384. }
  139385. CzmlDataSource._processCzml(
  139386. czml,
  139387. entityCollection,
  139388. sourceUri,
  139389. void 0,
  139390. dataSource
  139391. );
  139392. let raiseChangedEvent = updateClock(dataSource);
  139393. const documentPacket = dataSource._documentPacket;
  139394. if (defined_default(documentPacket.name) && dataSource._name !== documentPacket.name) {
  139395. dataSource._name = documentPacket.name;
  139396. raiseChangedEvent = true;
  139397. } else if (!defined_default(dataSource._name) && defined_default(sourceUri)) {
  139398. dataSource._name = getFilenameFromUri_default(sourceUri.getUrlComponent());
  139399. raiseChangedEvent = true;
  139400. }
  139401. DataSource_default.setLoading(dataSource, false);
  139402. if (raiseChangedEvent) {
  139403. dataSource._changed.raiseEvent(dataSource);
  139404. }
  139405. return dataSource;
  139406. }
  139407. function DocumentPacket() {
  139408. this.name = void 0;
  139409. this.clock = void 0;
  139410. }
  139411. function CzmlDataSource(name) {
  139412. this._name = name;
  139413. this._changed = new Event_default();
  139414. this._error = new Event_default();
  139415. this._isLoading = false;
  139416. this._loading = new Event_default();
  139417. this._clock = void 0;
  139418. this._documentPacket = new DocumentPacket();
  139419. this._version = void 0;
  139420. this._entityCollection = new EntityCollection_default(this);
  139421. this._entityCluster = new EntityCluster_default();
  139422. this._credit = void 0;
  139423. this._resourceCredits = [];
  139424. }
  139425. CzmlDataSource.load = function(czml, options) {
  139426. return new CzmlDataSource().load(czml, options);
  139427. };
  139428. Object.defineProperties(CzmlDataSource.prototype, {
  139429. name: {
  139430. get: function() {
  139431. return this._name;
  139432. }
  139433. },
  139434. clock: {
  139435. get: function() {
  139436. return this._clock;
  139437. }
  139438. },
  139439. entities: {
  139440. get: function() {
  139441. return this._entityCollection;
  139442. }
  139443. },
  139444. isLoading: {
  139445. get: function() {
  139446. return this._isLoading;
  139447. }
  139448. },
  139449. changedEvent: {
  139450. get: function() {
  139451. return this._changed;
  139452. }
  139453. },
  139454. errorEvent: {
  139455. get: function() {
  139456. return this._error;
  139457. }
  139458. },
  139459. loadingEvent: {
  139460. get: function() {
  139461. return this._loading;
  139462. }
  139463. },
  139464. show: {
  139465. get: function() {
  139466. return this._entityCollection.show;
  139467. },
  139468. set: function(value) {
  139469. this._entityCollection.show = value;
  139470. }
  139471. },
  139472. clustering: {
  139473. get: function() {
  139474. return this._entityCluster;
  139475. },
  139476. set: function(value) {
  139477. if (!defined_default(value)) {
  139478. throw new DeveloperError_default("value must be defined.");
  139479. }
  139480. this._entityCluster = value;
  139481. }
  139482. },
  139483. credit: {
  139484. get: function() {
  139485. return this._credit;
  139486. }
  139487. }
  139488. });
  139489. CzmlDataSource.updaters = [
  139490. processBillboard,
  139491. processBox,
  139492. processCorridor,
  139493. processCylinder,
  139494. processEllipse,
  139495. processEllipsoid,
  139496. processLabel,
  139497. processModel,
  139498. processName,
  139499. processDescription,
  139500. processPath,
  139501. processPoint,
  139502. processPolygon,
  139503. processPolyline,
  139504. processPolylineVolume,
  139505. processProperties,
  139506. processRectangle,
  139507. processPosition,
  139508. processTileset,
  139509. processViewFrom,
  139510. processWall,
  139511. processOrientation,
  139512. processAvailability
  139513. ];
  139514. CzmlDataSource.prototype.process = function(czml, options) {
  139515. return load(this, czml, options, false);
  139516. };
  139517. CzmlDataSource.prototype.load = function(czml, options) {
  139518. return load(this, czml, options, true);
  139519. };
  139520. CzmlDataSource.prototype.update = function(time) {
  139521. return true;
  139522. };
  139523. CzmlDataSource.processPacketData = processPacketData;
  139524. CzmlDataSource.processPositionPacketData = processPositionPacketData;
  139525. CzmlDataSource.processMaterialPacketData = processMaterialPacketData;
  139526. CzmlDataSource._processCzml = function(czml, entityCollection, sourceUri, updaterFunctions, dataSource) {
  139527. updaterFunctions = defaultValue_default(updaterFunctions, CzmlDataSource.updaters);
  139528. if (Array.isArray(czml)) {
  139529. for (let i2 = 0, len = czml.length; i2 < len; ++i2) {
  139530. processCzmlPacket(
  139531. czml[i2],
  139532. entityCollection,
  139533. updaterFunctions,
  139534. sourceUri,
  139535. dataSource
  139536. );
  139537. }
  139538. } else {
  139539. processCzmlPacket(
  139540. czml,
  139541. entityCollection,
  139542. updaterFunctions,
  139543. sourceUri,
  139544. dataSource
  139545. );
  139546. }
  139547. };
  139548. var CzmlDataSource_default = CzmlDataSource;
  139549. // node_modules/cesium/Source/DataSources/DataSourceCollection.js
  139550. function DataSourceCollection() {
  139551. this._dataSources = [];
  139552. this._dataSourceAdded = new Event_default();
  139553. this._dataSourceRemoved = new Event_default();
  139554. this._dataSourceMoved = new Event_default();
  139555. }
  139556. Object.defineProperties(DataSourceCollection.prototype, {
  139557. length: {
  139558. get: function() {
  139559. return this._dataSources.length;
  139560. }
  139561. },
  139562. dataSourceAdded: {
  139563. get: function() {
  139564. return this._dataSourceAdded;
  139565. }
  139566. },
  139567. dataSourceRemoved: {
  139568. get: function() {
  139569. return this._dataSourceRemoved;
  139570. }
  139571. },
  139572. dataSourceMoved: {
  139573. get: function() {
  139574. return this._dataSourceMoved;
  139575. }
  139576. }
  139577. });
  139578. DataSourceCollection.prototype.add = function(dataSource) {
  139579. if (!defined_default(dataSource)) {
  139580. throw new DeveloperError_default("dataSource is required.");
  139581. }
  139582. const that = this;
  139583. const dataSources = this._dataSources;
  139584. return Promise.resolve(dataSource).then(function(value) {
  139585. if (dataSources === that._dataSources) {
  139586. that._dataSources.push(value);
  139587. that._dataSourceAdded.raiseEvent(that, value);
  139588. }
  139589. return value;
  139590. });
  139591. };
  139592. DataSourceCollection.prototype.remove = function(dataSource, destroy2) {
  139593. destroy2 = defaultValue_default(destroy2, false);
  139594. const index2 = this._dataSources.indexOf(dataSource);
  139595. if (index2 !== -1) {
  139596. this._dataSources.splice(index2, 1);
  139597. this._dataSourceRemoved.raiseEvent(this, dataSource);
  139598. if (destroy2 && typeof dataSource.destroy === "function") {
  139599. dataSource.destroy();
  139600. }
  139601. return true;
  139602. }
  139603. return false;
  139604. };
  139605. DataSourceCollection.prototype.removeAll = function(destroy2) {
  139606. destroy2 = defaultValue_default(destroy2, false);
  139607. const dataSources = this._dataSources;
  139608. for (let i2 = 0, len = dataSources.length; i2 < len; ++i2) {
  139609. const dataSource = dataSources[i2];
  139610. this._dataSourceRemoved.raiseEvent(this, dataSource);
  139611. if (destroy2 && typeof dataSource.destroy === "function") {
  139612. dataSource.destroy();
  139613. }
  139614. }
  139615. this._dataSources = [];
  139616. };
  139617. DataSourceCollection.prototype.contains = function(dataSource) {
  139618. return this.indexOf(dataSource) !== -1;
  139619. };
  139620. DataSourceCollection.prototype.indexOf = function(dataSource) {
  139621. return this._dataSources.indexOf(dataSource);
  139622. };
  139623. DataSourceCollection.prototype.get = function(index2) {
  139624. if (!defined_default(index2)) {
  139625. throw new DeveloperError_default("index is required.");
  139626. }
  139627. return this._dataSources[index2];
  139628. };
  139629. DataSourceCollection.prototype.getByName = function(name) {
  139630. if (!defined_default(name)) {
  139631. throw new DeveloperError_default("name is required.");
  139632. }
  139633. return this._dataSources.filter(function(dataSource) {
  139634. return dataSource.name === name;
  139635. });
  139636. };
  139637. function getIndex2(dataSources, dataSource) {
  139638. if (!defined_default(dataSource)) {
  139639. throw new DeveloperError_default("dataSource is required.");
  139640. }
  139641. const index2 = dataSources.indexOf(dataSource);
  139642. if (index2 === -1) {
  139643. throw new DeveloperError_default("dataSource is not in this collection.");
  139644. }
  139645. return index2;
  139646. }
  139647. function swapDataSources(collection, i2, j) {
  139648. const arr = collection._dataSources;
  139649. const length3 = arr.length - 1;
  139650. i2 = Math_default.clamp(i2, 0, length3);
  139651. j = Math_default.clamp(j, 0, length3);
  139652. if (i2 === j) {
  139653. return;
  139654. }
  139655. const temp = arr[i2];
  139656. arr[i2] = arr[j];
  139657. arr[j] = temp;
  139658. collection.dataSourceMoved.raiseEvent(temp, j, i2);
  139659. }
  139660. DataSourceCollection.prototype.raise = function(dataSource) {
  139661. const index2 = getIndex2(this._dataSources, dataSource);
  139662. swapDataSources(this, index2, index2 + 1);
  139663. };
  139664. DataSourceCollection.prototype.lower = function(dataSource) {
  139665. const index2 = getIndex2(this._dataSources, dataSource);
  139666. swapDataSources(this, index2, index2 - 1);
  139667. };
  139668. DataSourceCollection.prototype.raiseToTop = function(dataSource) {
  139669. const index2 = getIndex2(this._dataSources, dataSource);
  139670. if (index2 === this._dataSources.length - 1) {
  139671. return;
  139672. }
  139673. this._dataSources.splice(index2, 1);
  139674. this._dataSources.push(dataSource);
  139675. this.dataSourceMoved.raiseEvent(
  139676. dataSource,
  139677. this._dataSources.length - 1,
  139678. index2
  139679. );
  139680. };
  139681. DataSourceCollection.prototype.lowerToBottom = function(dataSource) {
  139682. const index2 = getIndex2(this._dataSources, dataSource);
  139683. if (index2 === 0) {
  139684. return;
  139685. }
  139686. this._dataSources.splice(index2, 1);
  139687. this._dataSources.splice(0, 0, dataSource);
  139688. this.dataSourceMoved.raiseEvent(dataSource, 0, index2);
  139689. };
  139690. DataSourceCollection.prototype.isDestroyed = function() {
  139691. return false;
  139692. };
  139693. DataSourceCollection.prototype.destroy = function() {
  139694. this.removeAll(true);
  139695. return destroyObject_default(this);
  139696. };
  139697. var DataSourceCollection_default = DataSourceCollection;
  139698. // node_modules/cesium/Source/Scene/PrimitiveCollection.js
  139699. function PrimitiveCollection(options) {
  139700. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  139701. this._primitives = [];
  139702. this._guid = createGuid_default();
  139703. this._zIndex = void 0;
  139704. this.show = defaultValue_default(options.show, true);
  139705. this.destroyPrimitives = defaultValue_default(options.destroyPrimitives, true);
  139706. }
  139707. Object.defineProperties(PrimitiveCollection.prototype, {
  139708. length: {
  139709. get: function() {
  139710. return this._primitives.length;
  139711. }
  139712. }
  139713. });
  139714. PrimitiveCollection.prototype.add = function(primitive, index2) {
  139715. const hasIndex = defined_default(index2);
  139716. if (!defined_default(primitive)) {
  139717. throw new DeveloperError_default("primitive is required.");
  139718. }
  139719. if (hasIndex) {
  139720. if (index2 < 0) {
  139721. throw new DeveloperError_default("index must be greater than or equal to zero.");
  139722. } else if (index2 > this._primitives.length) {
  139723. throw new DeveloperError_default(
  139724. "index must be less than or equal to the number of primitives."
  139725. );
  139726. }
  139727. }
  139728. const external = primitive._external = primitive._external || {};
  139729. const composites = external._composites = external._composites || {};
  139730. composites[this._guid] = {
  139731. collection: this
  139732. };
  139733. if (!hasIndex) {
  139734. this._primitives.push(primitive);
  139735. } else {
  139736. this._primitives.splice(index2, 0, primitive);
  139737. }
  139738. return primitive;
  139739. };
  139740. PrimitiveCollection.prototype.remove = function(primitive) {
  139741. if (this.contains(primitive)) {
  139742. const index2 = this._primitives.indexOf(primitive);
  139743. if (index2 !== -1) {
  139744. this._primitives.splice(index2, 1);
  139745. delete primitive._external._composites[this._guid];
  139746. if (this.destroyPrimitives) {
  139747. primitive.destroy();
  139748. }
  139749. return true;
  139750. }
  139751. }
  139752. return false;
  139753. };
  139754. PrimitiveCollection.prototype.removeAndDestroy = function(primitive) {
  139755. const removed = this.remove(primitive);
  139756. if (removed && !this.destroyPrimitives) {
  139757. primitive.destroy();
  139758. }
  139759. return removed;
  139760. };
  139761. PrimitiveCollection.prototype.removeAll = function() {
  139762. const primitives = this._primitives;
  139763. const length3 = primitives.length;
  139764. for (let i2 = 0; i2 < length3; ++i2) {
  139765. delete primitives[i2]._external._composites[this._guid];
  139766. if (this.destroyPrimitives) {
  139767. primitives[i2].destroy();
  139768. }
  139769. }
  139770. this._primitives = [];
  139771. };
  139772. PrimitiveCollection.prototype.contains = function(primitive) {
  139773. return !!(defined_default(primitive) && primitive._external && primitive._external._composites && primitive._external._composites[this._guid]);
  139774. };
  139775. function getPrimitiveIndex(compositePrimitive, primitive) {
  139776. if (!compositePrimitive.contains(primitive)) {
  139777. throw new DeveloperError_default("primitive is not in this collection.");
  139778. }
  139779. return compositePrimitive._primitives.indexOf(primitive);
  139780. }
  139781. PrimitiveCollection.prototype.raise = function(primitive) {
  139782. if (defined_default(primitive)) {
  139783. const index2 = getPrimitiveIndex(this, primitive);
  139784. const primitives = this._primitives;
  139785. if (index2 !== primitives.length - 1) {
  139786. const p2 = primitives[index2];
  139787. primitives[index2] = primitives[index2 + 1];
  139788. primitives[index2 + 1] = p2;
  139789. }
  139790. }
  139791. };
  139792. PrimitiveCollection.prototype.raiseToTop = function(primitive) {
  139793. if (defined_default(primitive)) {
  139794. const index2 = getPrimitiveIndex(this, primitive);
  139795. const primitives = this._primitives;
  139796. if (index2 !== primitives.length - 1) {
  139797. primitives.splice(index2, 1);
  139798. primitives.push(primitive);
  139799. }
  139800. }
  139801. };
  139802. PrimitiveCollection.prototype.lower = function(primitive) {
  139803. if (defined_default(primitive)) {
  139804. const index2 = getPrimitiveIndex(this, primitive);
  139805. const primitives = this._primitives;
  139806. if (index2 !== 0) {
  139807. const p2 = primitives[index2];
  139808. primitives[index2] = primitives[index2 - 1];
  139809. primitives[index2 - 1] = p2;
  139810. }
  139811. }
  139812. };
  139813. PrimitiveCollection.prototype.lowerToBottom = function(primitive) {
  139814. if (defined_default(primitive)) {
  139815. const index2 = getPrimitiveIndex(this, primitive);
  139816. const primitives = this._primitives;
  139817. if (index2 !== 0) {
  139818. primitives.splice(index2, 1);
  139819. primitives.unshift(primitive);
  139820. }
  139821. }
  139822. };
  139823. PrimitiveCollection.prototype.get = function(index2) {
  139824. if (!defined_default(index2)) {
  139825. throw new DeveloperError_default("index is required.");
  139826. }
  139827. return this._primitives[index2];
  139828. };
  139829. PrimitiveCollection.prototype.update = function(frameState) {
  139830. if (!this.show) {
  139831. return;
  139832. }
  139833. const primitives = this._primitives;
  139834. for (let i2 = 0; i2 < primitives.length; ++i2) {
  139835. primitives[i2].update(frameState);
  139836. }
  139837. };
  139838. PrimitiveCollection.prototype.prePassesUpdate = function(frameState) {
  139839. const primitives = this._primitives;
  139840. for (let i2 = 0; i2 < primitives.length; ++i2) {
  139841. const primitive = primitives[i2];
  139842. if (defined_default(primitive.prePassesUpdate)) {
  139843. primitive.prePassesUpdate(frameState);
  139844. }
  139845. }
  139846. };
  139847. PrimitiveCollection.prototype.updateForPass = function(frameState, passState) {
  139848. const primitives = this._primitives;
  139849. for (let i2 = 0; i2 < primitives.length; ++i2) {
  139850. const primitive = primitives[i2];
  139851. if (defined_default(primitive.updateForPass)) {
  139852. primitive.updateForPass(frameState, passState);
  139853. }
  139854. }
  139855. };
  139856. PrimitiveCollection.prototype.postPassesUpdate = function(frameState) {
  139857. const primitives = this._primitives;
  139858. for (let i2 = 0; i2 < primitives.length; ++i2) {
  139859. const primitive = primitives[i2];
  139860. if (defined_default(primitive.postPassesUpdate)) {
  139861. primitive.postPassesUpdate(frameState);
  139862. }
  139863. }
  139864. };
  139865. PrimitiveCollection.prototype.isDestroyed = function() {
  139866. return false;
  139867. };
  139868. PrimitiveCollection.prototype.destroy = function() {
  139869. this.removeAll();
  139870. return destroyObject_default(this);
  139871. };
  139872. var PrimitiveCollection_default = PrimitiveCollection;
  139873. // node_modules/cesium/Source/Scene/OrderedGroundPrimitiveCollection.js
  139874. function OrderedGroundPrimitiveCollection() {
  139875. this._length = 0;
  139876. this._collections = {};
  139877. this._collectionsArray = [];
  139878. this.show = true;
  139879. }
  139880. Object.defineProperties(OrderedGroundPrimitiveCollection.prototype, {
  139881. length: {
  139882. get: function() {
  139883. return this._length;
  139884. }
  139885. }
  139886. });
  139887. OrderedGroundPrimitiveCollection.prototype.add = function(primitive, zIndex) {
  139888. Check_default.defined("primitive", primitive);
  139889. if (defined_default(zIndex)) {
  139890. Check_default.typeOf.number("zIndex", zIndex);
  139891. }
  139892. zIndex = defaultValue_default(zIndex, 0);
  139893. let collection = this._collections[zIndex];
  139894. if (!defined_default(collection)) {
  139895. collection = new PrimitiveCollection_default({ destroyPrimitives: false });
  139896. collection._zIndex = zIndex;
  139897. this._collections[zIndex] = collection;
  139898. const array = this._collectionsArray;
  139899. let i2 = 0;
  139900. while (i2 < array.length && array[i2]._zIndex < zIndex) {
  139901. i2++;
  139902. }
  139903. array.splice(i2, 0, collection);
  139904. }
  139905. collection.add(primitive);
  139906. this._length++;
  139907. primitive._zIndex = zIndex;
  139908. return primitive;
  139909. };
  139910. OrderedGroundPrimitiveCollection.prototype.set = function(primitive, zIndex) {
  139911. Check_default.defined("primitive", primitive);
  139912. Check_default.typeOf.number("zIndex", zIndex);
  139913. if (zIndex === primitive._zIndex) {
  139914. return primitive;
  139915. }
  139916. this.remove(primitive, true);
  139917. this.add(primitive, zIndex);
  139918. return primitive;
  139919. };
  139920. OrderedGroundPrimitiveCollection.prototype.remove = function(primitive, doNotDestroy) {
  139921. if (this.contains(primitive)) {
  139922. const index2 = primitive._zIndex;
  139923. const collection = this._collections[index2];
  139924. let result;
  139925. if (doNotDestroy) {
  139926. result = collection.remove(primitive);
  139927. } else {
  139928. result = collection.removeAndDestroy(primitive);
  139929. }
  139930. if (result) {
  139931. this._length--;
  139932. }
  139933. if (collection.length === 0) {
  139934. this._collectionsArray.splice(
  139935. this._collectionsArray.indexOf(collection),
  139936. 1
  139937. );
  139938. this._collections[index2] = void 0;
  139939. collection.destroy();
  139940. }
  139941. return result;
  139942. }
  139943. return false;
  139944. };
  139945. OrderedGroundPrimitiveCollection.prototype.removeAll = function() {
  139946. const collections = this._collectionsArray;
  139947. for (let i2 = 0; i2 < collections.length; i2++) {
  139948. const collection = collections[i2];
  139949. collection.destroyPrimitives = true;
  139950. collection.destroy();
  139951. }
  139952. this._collections = {};
  139953. this._collectionsArray = [];
  139954. this._length = 0;
  139955. };
  139956. OrderedGroundPrimitiveCollection.prototype.contains = function(primitive) {
  139957. if (!defined_default(primitive)) {
  139958. return false;
  139959. }
  139960. const collection = this._collections[primitive._zIndex];
  139961. return defined_default(collection) && collection.contains(primitive);
  139962. };
  139963. OrderedGroundPrimitiveCollection.prototype.update = function(frameState) {
  139964. if (!this.show) {
  139965. return;
  139966. }
  139967. const collections = this._collectionsArray;
  139968. for (let i2 = 0; i2 < collections.length; i2++) {
  139969. collections[i2].update(frameState);
  139970. }
  139971. };
  139972. OrderedGroundPrimitiveCollection.prototype.isDestroyed = function() {
  139973. return false;
  139974. };
  139975. OrderedGroundPrimitiveCollection.prototype.destroy = function() {
  139976. this.removeAll();
  139977. return destroyObject_default(this);
  139978. };
  139979. var OrderedGroundPrimitiveCollection_default = OrderedGroundPrimitiveCollection;
  139980. // node_modules/cesium/Source/DataSources/DynamicGeometryBatch.js
  139981. function DynamicGeometryBatch(primitives, orderedGroundPrimitives) {
  139982. this._primitives = primitives;
  139983. this._orderedGroundPrimitives = orderedGroundPrimitives;
  139984. this._dynamicUpdaters = new AssociativeArray_default();
  139985. }
  139986. DynamicGeometryBatch.prototype.add = function(time, updater) {
  139987. this._dynamicUpdaters.set(
  139988. updater.id,
  139989. updater.createDynamicUpdater(
  139990. this._primitives,
  139991. this._orderedGroundPrimitives
  139992. )
  139993. );
  139994. };
  139995. DynamicGeometryBatch.prototype.remove = function(updater) {
  139996. const id = updater.id;
  139997. const dynamicUpdater = this._dynamicUpdaters.get(id);
  139998. if (defined_default(dynamicUpdater)) {
  139999. this._dynamicUpdaters.remove(id);
  140000. dynamicUpdater.destroy();
  140001. }
  140002. };
  140003. DynamicGeometryBatch.prototype.update = function(time) {
  140004. const geometries = this._dynamicUpdaters.values;
  140005. for (let i2 = 0, len = geometries.length; i2 < len; i2++) {
  140006. geometries[i2].update(time);
  140007. }
  140008. return true;
  140009. };
  140010. DynamicGeometryBatch.prototype.removeAllPrimitives = function() {
  140011. const geometries = this._dynamicUpdaters.values;
  140012. for (let i2 = 0, len = geometries.length; i2 < len; i2++) {
  140013. geometries[i2].destroy();
  140014. }
  140015. this._dynamicUpdaters.removeAll();
  140016. };
  140017. DynamicGeometryBatch.prototype.getBoundingSphere = function(updater, result) {
  140018. updater = this._dynamicUpdaters.get(updater.id);
  140019. if (defined_default(updater) && defined_default(updater.getBoundingSphere)) {
  140020. return updater.getBoundingSphere(result);
  140021. }
  140022. return BoundingSphereState_default.FAILED;
  140023. };
  140024. var DynamicGeometryBatch_default = DynamicGeometryBatch;
  140025. // node_modules/cesium/Source/DataSources/EllipseGeometryUpdater.js
  140026. var scratchColor14 = new Color_default();
  140027. var defaultOffset5 = Cartesian3_default.ZERO;
  140028. var offsetScratch7 = new Cartesian3_default();
  140029. var scratchRectangle6 = new Rectangle_default();
  140030. function EllipseGeometryOptions(entity) {
  140031. this.id = entity;
  140032. this.vertexFormat = void 0;
  140033. this.center = void 0;
  140034. this.semiMajorAxis = void 0;
  140035. this.semiMinorAxis = void 0;
  140036. this.rotation = void 0;
  140037. this.height = void 0;
  140038. this.extrudedHeight = void 0;
  140039. this.granularity = void 0;
  140040. this.stRotation = void 0;
  140041. this.numberOfVerticalLines = void 0;
  140042. this.offsetAttribute = void 0;
  140043. }
  140044. function EllipseGeometryUpdater(entity, scene) {
  140045. GroundGeometryUpdater_default.call(this, {
  140046. entity,
  140047. scene,
  140048. geometryOptions: new EllipseGeometryOptions(entity),
  140049. geometryPropertyName: "ellipse",
  140050. observedPropertyNames: ["availability", "position", "ellipse"]
  140051. });
  140052. this._onEntityPropertyChanged(entity, "ellipse", entity.ellipse, void 0);
  140053. }
  140054. if (defined_default(Object.create)) {
  140055. EllipseGeometryUpdater.prototype = Object.create(
  140056. GroundGeometryUpdater_default.prototype
  140057. );
  140058. EllipseGeometryUpdater.prototype.constructor = EllipseGeometryUpdater;
  140059. }
  140060. EllipseGeometryUpdater.prototype.createFillGeometryInstance = function(time) {
  140061. Check_default.defined("time", time);
  140062. if (!this._fillEnabled) {
  140063. throw new DeveloperError_default(
  140064. "This instance does not represent a filled geometry."
  140065. );
  140066. }
  140067. const entity = this._entity;
  140068. const isAvailable = entity.isAvailable(time);
  140069. const attributes = {
  140070. show: new ShowGeometryInstanceAttribute_default(
  140071. isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time)
  140072. ),
  140073. distanceDisplayCondition: DistanceDisplayConditionGeometryInstanceAttribute_default.fromDistanceDisplayCondition(
  140074. this._distanceDisplayConditionProperty.getValue(time)
  140075. ),
  140076. offset: void 0,
  140077. color: void 0
  140078. };
  140079. if (this._materialProperty instanceof ColorMaterialProperty_default) {
  140080. let currentColor;
  140081. if (defined_default(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) {
  140082. currentColor = this._materialProperty.color.getValue(time, scratchColor14);
  140083. }
  140084. if (!defined_default(currentColor)) {
  140085. currentColor = Color_default.WHITE;
  140086. }
  140087. attributes.color = ColorGeometryInstanceAttribute_default.fromColor(currentColor);
  140088. }
  140089. if (defined_default(this._options.offsetAttribute)) {
  140090. attributes.offset = OffsetGeometryInstanceAttribute_default.fromCartesian3(
  140091. Property_default.getValueOrDefault(
  140092. this._terrainOffsetProperty,
  140093. time,
  140094. defaultOffset5,
  140095. offsetScratch7
  140096. )
  140097. );
  140098. }
  140099. return new GeometryInstance_default({
  140100. id: entity,
  140101. geometry: new EllipseGeometry_default(this._options),
  140102. attributes
  140103. });
  140104. };
  140105. EllipseGeometryUpdater.prototype.createOutlineGeometryInstance = function(time) {
  140106. Check_default.defined("time", time);
  140107. if (!this._outlineEnabled) {
  140108. throw new DeveloperError_default(
  140109. "This instance does not represent an outlined geometry."
  140110. );
  140111. }
  140112. const entity = this._entity;
  140113. const isAvailable = entity.isAvailable(time);
  140114. const outlineColor = Property_default.getValueOrDefault(
  140115. this._outlineColorProperty,
  140116. time,
  140117. Color_default.BLACK,
  140118. scratchColor14
  140119. );
  140120. const distanceDisplayCondition = this._distanceDisplayConditionProperty.getValue(
  140121. time
  140122. );
  140123. const attributes = {
  140124. show: new ShowGeometryInstanceAttribute_default(
  140125. isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)
  140126. ),
  140127. color: ColorGeometryInstanceAttribute_default.fromColor(outlineColor),
  140128. distanceDisplayCondition: DistanceDisplayConditionGeometryInstanceAttribute_default.fromDistanceDisplayCondition(
  140129. distanceDisplayCondition
  140130. ),
  140131. offset: void 0
  140132. };
  140133. if (defined_default(this._options.offsetAttribute)) {
  140134. attributes.offset = OffsetGeometryInstanceAttribute_default.fromCartesian3(
  140135. Property_default.getValueOrDefault(
  140136. this._terrainOffsetProperty,
  140137. time,
  140138. defaultOffset5,
  140139. offsetScratch7
  140140. )
  140141. );
  140142. }
  140143. return new GeometryInstance_default({
  140144. id: entity,
  140145. geometry: new EllipseOutlineGeometry_default(this._options),
  140146. attributes
  140147. });
  140148. };
  140149. EllipseGeometryUpdater.prototype._computeCenter = function(time, result) {
  140150. return Property_default.getValueOrUndefined(this._entity.position, time, result);
  140151. };
  140152. EllipseGeometryUpdater.prototype._isHidden = function(entity, ellipse) {
  140153. const position = entity.position;
  140154. return !defined_default(position) || !defined_default(ellipse.semiMajorAxis) || !defined_default(ellipse.semiMinorAxis) || GeometryUpdater_default.prototype._isHidden.call(this, entity, ellipse);
  140155. };
  140156. EllipseGeometryUpdater.prototype._isDynamic = function(entity, ellipse) {
  140157. return !entity.position.isConstant || !ellipse.semiMajorAxis.isConstant || !ellipse.semiMinorAxis.isConstant || !Property_default.isConstant(ellipse.rotation) || !Property_default.isConstant(ellipse.height) || !Property_default.isConstant(ellipse.extrudedHeight) || !Property_default.isConstant(ellipse.granularity) || !Property_default.isConstant(ellipse.stRotation) || !Property_default.isConstant(ellipse.outlineWidth) || !Property_default.isConstant(ellipse.numberOfVerticalLines) || !Property_default.isConstant(ellipse.zIndex) || this._onTerrain && !Property_default.isConstant(this._materialProperty) && !(this._materialProperty instanceof ColorMaterialProperty_default);
  140158. };
  140159. EllipseGeometryUpdater.prototype._setStaticOptions = function(entity, ellipse) {
  140160. let heightValue = Property_default.getValueOrUndefined(
  140161. ellipse.height,
  140162. Iso8601_default.MINIMUM_VALUE
  140163. );
  140164. const heightReferenceValue = Property_default.getValueOrDefault(
  140165. ellipse.heightReference,
  140166. Iso8601_default.MINIMUM_VALUE,
  140167. HeightReference_default.NONE
  140168. );
  140169. let extrudedHeightValue = Property_default.getValueOrUndefined(
  140170. ellipse.extrudedHeight,
  140171. Iso8601_default.MINIMUM_VALUE
  140172. );
  140173. const extrudedHeightReferenceValue = Property_default.getValueOrDefault(
  140174. ellipse.extrudedHeightReference,
  140175. Iso8601_default.MINIMUM_VALUE,
  140176. HeightReference_default.NONE
  140177. );
  140178. if (defined_default(extrudedHeightValue) && !defined_default(heightValue)) {
  140179. heightValue = 0;
  140180. }
  140181. const options = this._options;
  140182. options.vertexFormat = this._materialProperty instanceof ColorMaterialProperty_default ? PerInstanceColorAppearance_default.VERTEX_FORMAT : MaterialAppearance_default.MaterialSupport.TEXTURED.vertexFormat;
  140183. options.center = entity.position.getValue(
  140184. Iso8601_default.MINIMUM_VALUE,
  140185. options.center
  140186. );
  140187. options.semiMajorAxis = ellipse.semiMajorAxis.getValue(
  140188. Iso8601_default.MINIMUM_VALUE,
  140189. options.semiMajorAxis
  140190. );
  140191. options.semiMinorAxis = ellipse.semiMinorAxis.getValue(
  140192. Iso8601_default.MINIMUM_VALUE,
  140193. options.semiMinorAxis
  140194. );
  140195. options.rotation = Property_default.getValueOrUndefined(
  140196. ellipse.rotation,
  140197. Iso8601_default.MINIMUM_VALUE
  140198. );
  140199. options.granularity = Property_default.getValueOrUndefined(
  140200. ellipse.granularity,
  140201. Iso8601_default.MINIMUM_VALUE
  140202. );
  140203. options.stRotation = Property_default.getValueOrUndefined(
  140204. ellipse.stRotation,
  140205. Iso8601_default.MINIMUM_VALUE
  140206. );
  140207. options.numberOfVerticalLines = Property_default.getValueOrUndefined(
  140208. ellipse.numberOfVerticalLines,
  140209. Iso8601_default.MINIMUM_VALUE
  140210. );
  140211. options.offsetAttribute = GroundGeometryUpdater_default.computeGeometryOffsetAttribute(
  140212. heightValue,
  140213. heightReferenceValue,
  140214. extrudedHeightValue,
  140215. extrudedHeightReferenceValue
  140216. );
  140217. options.height = GroundGeometryUpdater_default.getGeometryHeight(
  140218. heightValue,
  140219. heightReferenceValue
  140220. );
  140221. extrudedHeightValue = GroundGeometryUpdater_default.getGeometryExtrudedHeight(
  140222. extrudedHeightValue,
  140223. extrudedHeightReferenceValue
  140224. );
  140225. if (extrudedHeightValue === GroundGeometryUpdater_default.CLAMP_TO_GROUND) {
  140226. extrudedHeightValue = ApproximateTerrainHeights_default.getMinimumMaximumHeights(
  140227. EllipseGeometry_default.computeRectangle(options, scratchRectangle6)
  140228. ).minimumTerrainHeight;
  140229. }
  140230. options.extrudedHeight = extrudedHeightValue;
  140231. };
  140232. EllipseGeometryUpdater.DynamicGeometryUpdater = DynamicEllipseGeometryUpdater;
  140233. function DynamicEllipseGeometryUpdater(geometryUpdater, primitives, groundPrimitives) {
  140234. DynamicGeometryUpdater_default.call(
  140235. this,
  140236. geometryUpdater,
  140237. primitives,
  140238. groundPrimitives
  140239. );
  140240. }
  140241. if (defined_default(Object.create)) {
  140242. DynamicEllipseGeometryUpdater.prototype = Object.create(
  140243. DynamicGeometryUpdater_default.prototype
  140244. );
  140245. DynamicEllipseGeometryUpdater.prototype.constructor = DynamicEllipseGeometryUpdater;
  140246. }
  140247. DynamicEllipseGeometryUpdater.prototype._isHidden = function(entity, ellipse, time) {
  140248. const options = this._options;
  140249. return !defined_default(options.center) || !defined_default(options.semiMajorAxis) || !defined_default(options.semiMinorAxis) || DynamicGeometryUpdater_default.prototype._isHidden.call(this, entity, ellipse, time);
  140250. };
  140251. DynamicEllipseGeometryUpdater.prototype._setOptions = function(entity, ellipse, time) {
  140252. const options = this._options;
  140253. let heightValue = Property_default.getValueOrUndefined(ellipse.height, time);
  140254. const heightReferenceValue = Property_default.getValueOrDefault(
  140255. ellipse.heightReference,
  140256. time,
  140257. HeightReference_default.NONE
  140258. );
  140259. let extrudedHeightValue = Property_default.getValueOrUndefined(
  140260. ellipse.extrudedHeight,
  140261. time
  140262. );
  140263. const extrudedHeightReferenceValue = Property_default.getValueOrDefault(
  140264. ellipse.extrudedHeightReference,
  140265. time,
  140266. HeightReference_default.NONE
  140267. );
  140268. if (defined_default(extrudedHeightValue) && !defined_default(heightValue)) {
  140269. heightValue = 0;
  140270. }
  140271. options.center = Property_default.getValueOrUndefined(
  140272. entity.position,
  140273. time,
  140274. options.center
  140275. );
  140276. options.semiMajorAxis = Property_default.getValueOrUndefined(
  140277. ellipse.semiMajorAxis,
  140278. time
  140279. );
  140280. options.semiMinorAxis = Property_default.getValueOrUndefined(
  140281. ellipse.semiMinorAxis,
  140282. time
  140283. );
  140284. options.rotation = Property_default.getValueOrUndefined(ellipse.rotation, time);
  140285. options.granularity = Property_default.getValueOrUndefined(ellipse.granularity, time);
  140286. options.stRotation = Property_default.getValueOrUndefined(ellipse.stRotation, time);
  140287. options.numberOfVerticalLines = Property_default.getValueOrUndefined(
  140288. ellipse.numberOfVerticalLines,
  140289. time
  140290. );
  140291. options.offsetAttribute = GroundGeometryUpdater_default.computeGeometryOffsetAttribute(
  140292. heightValue,
  140293. heightReferenceValue,
  140294. extrudedHeightValue,
  140295. extrudedHeightReferenceValue
  140296. );
  140297. options.height = GroundGeometryUpdater_default.getGeometryHeight(
  140298. heightValue,
  140299. heightReferenceValue
  140300. );
  140301. extrudedHeightValue = GroundGeometryUpdater_default.getGeometryExtrudedHeight(
  140302. extrudedHeightValue,
  140303. extrudedHeightReferenceValue
  140304. );
  140305. if (extrudedHeightValue === GroundGeometryUpdater_default.CLAMP_TO_GROUND) {
  140306. extrudedHeightValue = ApproximateTerrainHeights_default.getMinimumMaximumHeights(
  140307. EllipseGeometry_default.computeRectangle(options, scratchRectangle6)
  140308. ).minimumTerrainHeight;
  140309. }
  140310. options.extrudedHeight = extrudedHeightValue;
  140311. };
  140312. var EllipseGeometryUpdater_default = EllipseGeometryUpdater;
  140313. // node_modules/cesium/Source/DataSources/EllipsoidGeometryUpdater.js
  140314. var defaultMaterial2 = new ColorMaterialProperty_default(Color_default.WHITE);
  140315. var defaultOffset6 = Cartesian3_default.ZERO;
  140316. var offsetScratch8 = new Cartesian3_default();
  140317. var radiiScratch = new Cartesian3_default();
  140318. var innerRadiiScratch = new Cartesian3_default();
  140319. var scratchColor15 = new Color_default();
  140320. var unitSphere = new Cartesian3_default(1, 1, 1);
  140321. function EllipsoidGeometryOptions(entity) {
  140322. this.id = entity;
  140323. this.vertexFormat = void 0;
  140324. this.radii = void 0;
  140325. this.innerRadii = void 0;
  140326. this.minimumClock = void 0;
  140327. this.maximumClock = void 0;
  140328. this.minimumCone = void 0;
  140329. this.maximumCone = void 0;
  140330. this.stackPartitions = void 0;
  140331. this.slicePartitions = void 0;
  140332. this.subdivisions = void 0;
  140333. this.offsetAttribute = void 0;
  140334. }
  140335. function EllipsoidGeometryUpdater(entity, scene) {
  140336. GeometryUpdater_default.call(this, {
  140337. entity,
  140338. scene,
  140339. geometryOptions: new EllipsoidGeometryOptions(entity),
  140340. geometryPropertyName: "ellipsoid",
  140341. observedPropertyNames: [
  140342. "availability",
  140343. "position",
  140344. "orientation",
  140345. "ellipsoid"
  140346. ]
  140347. });
  140348. this._onEntityPropertyChanged(
  140349. entity,
  140350. "ellipsoid",
  140351. entity.ellipsoid,
  140352. void 0
  140353. );
  140354. }
  140355. if (defined_default(Object.create)) {
  140356. EllipsoidGeometryUpdater.prototype = Object.create(GeometryUpdater_default.prototype);
  140357. EllipsoidGeometryUpdater.prototype.constructor = EllipsoidGeometryUpdater;
  140358. }
  140359. Object.defineProperties(EllipsoidGeometryUpdater.prototype, {
  140360. terrainOffsetProperty: {
  140361. get: function() {
  140362. return this._terrainOffsetProperty;
  140363. }
  140364. }
  140365. });
  140366. EllipsoidGeometryUpdater.prototype.createFillGeometryInstance = function(time, skipModelMatrix, modelMatrixResult) {
  140367. Check_default.defined("time", time);
  140368. const entity = this._entity;
  140369. const isAvailable = entity.isAvailable(time);
  140370. let color;
  140371. const show = new ShowGeometryInstanceAttribute_default(
  140372. isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time)
  140373. );
  140374. const distanceDisplayCondition = this._distanceDisplayConditionProperty.getValue(
  140375. time
  140376. );
  140377. const distanceDisplayConditionAttribute = DistanceDisplayConditionGeometryInstanceAttribute_default.fromDistanceDisplayCondition(
  140378. distanceDisplayCondition
  140379. );
  140380. const attributes = {
  140381. show,
  140382. distanceDisplayCondition: distanceDisplayConditionAttribute,
  140383. color: void 0,
  140384. offset: void 0
  140385. };
  140386. if (this._materialProperty instanceof ColorMaterialProperty_default) {
  140387. let currentColor;
  140388. if (defined_default(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) {
  140389. currentColor = this._materialProperty.color.getValue(time, scratchColor15);
  140390. }
  140391. if (!defined_default(currentColor)) {
  140392. currentColor = Color_default.WHITE;
  140393. }
  140394. color = ColorGeometryInstanceAttribute_default.fromColor(currentColor);
  140395. attributes.color = color;
  140396. }
  140397. if (defined_default(this._options.offsetAttribute)) {
  140398. attributes.offset = OffsetGeometryInstanceAttribute_default.fromCartesian3(
  140399. Property_default.getValueOrDefault(
  140400. this._terrainOffsetProperty,
  140401. time,
  140402. defaultOffset6,
  140403. offsetScratch8
  140404. )
  140405. );
  140406. }
  140407. return new GeometryInstance_default({
  140408. id: entity,
  140409. geometry: new EllipsoidGeometry_default(this._options),
  140410. modelMatrix: skipModelMatrix ? void 0 : entity.computeModelMatrixForHeightReference(
  140411. time,
  140412. entity.ellipsoid.heightReference,
  140413. this._options.radii.z * 0.5,
  140414. this._scene.mapProjection.ellipsoid,
  140415. modelMatrixResult
  140416. ),
  140417. attributes
  140418. });
  140419. };
  140420. EllipsoidGeometryUpdater.prototype.createOutlineGeometryInstance = function(time, skipModelMatrix, modelMatrixResult) {
  140421. Check_default.defined("time", time);
  140422. const entity = this._entity;
  140423. const isAvailable = entity.isAvailable(time);
  140424. const outlineColor = Property_default.getValueOrDefault(
  140425. this._outlineColorProperty,
  140426. time,
  140427. Color_default.BLACK,
  140428. scratchColor15
  140429. );
  140430. const distanceDisplayCondition = this._distanceDisplayConditionProperty.getValue(
  140431. time
  140432. );
  140433. const attributes = {
  140434. show: new ShowGeometryInstanceAttribute_default(
  140435. isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)
  140436. ),
  140437. color: ColorGeometryInstanceAttribute_default.fromColor(outlineColor),
  140438. distanceDisplayCondition: DistanceDisplayConditionGeometryInstanceAttribute_default.fromDistanceDisplayCondition(
  140439. distanceDisplayCondition
  140440. ),
  140441. offset: void 0
  140442. };
  140443. if (defined_default(this._options.offsetAttribute)) {
  140444. attributes.offset = OffsetGeometryInstanceAttribute_default.fromCartesian3(
  140445. Property_default.getValueOrDefault(
  140446. this._terrainOffsetProperty,
  140447. time,
  140448. defaultOffset6,
  140449. offsetScratch8
  140450. )
  140451. );
  140452. }
  140453. return new GeometryInstance_default({
  140454. id: entity,
  140455. geometry: new EllipsoidOutlineGeometry_default(this._options),
  140456. modelMatrix: skipModelMatrix ? void 0 : entity.computeModelMatrixForHeightReference(
  140457. time,
  140458. entity.ellipsoid.heightReference,
  140459. this._options.radii.z * 0.5,
  140460. this._scene.mapProjection.ellipsoid,
  140461. modelMatrixResult
  140462. ),
  140463. attributes
  140464. });
  140465. };
  140466. EllipsoidGeometryUpdater.prototype._computeCenter = function(time, result) {
  140467. return Property_default.getValueOrUndefined(this._entity.position, time, result);
  140468. };
  140469. EllipsoidGeometryUpdater.prototype._isHidden = function(entity, ellipsoid) {
  140470. return !defined_default(entity.position) || !defined_default(ellipsoid.radii) || GeometryUpdater_default.prototype._isHidden.call(this, entity, ellipsoid);
  140471. };
  140472. EllipsoidGeometryUpdater.prototype._isDynamic = function(entity, ellipsoid) {
  140473. return !entity.position.isConstant || !Property_default.isConstant(entity.orientation) || !ellipsoid.radii.isConstant || !Property_default.isConstant(ellipsoid.innerRadii) || !Property_default.isConstant(ellipsoid.stackPartitions) || !Property_default.isConstant(ellipsoid.slicePartitions) || !Property_default.isConstant(ellipsoid.outlineWidth) || !Property_default.isConstant(ellipsoid.minimumClock) || !Property_default.isConstant(ellipsoid.maximumClock) || !Property_default.isConstant(ellipsoid.minimumCone) || !Property_default.isConstant(ellipsoid.maximumCone) || !Property_default.isConstant(ellipsoid.subdivisions);
  140474. };
  140475. EllipsoidGeometryUpdater.prototype._setStaticOptions = function(entity, ellipsoid) {
  140476. const heightReference = Property_default.getValueOrDefault(
  140477. ellipsoid.heightReference,
  140478. Iso8601_default.MINIMUM_VALUE,
  140479. HeightReference_default.NONE
  140480. );
  140481. const options = this._options;
  140482. options.vertexFormat = this._materialProperty instanceof ColorMaterialProperty_default ? PerInstanceColorAppearance_default.VERTEX_FORMAT : MaterialAppearance_default.MaterialSupport.TEXTURED.vertexFormat;
  140483. options.radii = ellipsoid.radii.getValue(
  140484. Iso8601_default.MINIMUM_VALUE,
  140485. options.radii
  140486. );
  140487. options.innerRadii = Property_default.getValueOrUndefined(
  140488. ellipsoid.innerRadii,
  140489. options.radii
  140490. );
  140491. options.minimumClock = Property_default.getValueOrUndefined(
  140492. ellipsoid.minimumClock,
  140493. Iso8601_default.MINIMUM_VALUE
  140494. );
  140495. options.maximumClock = Property_default.getValueOrUndefined(
  140496. ellipsoid.maximumClock,
  140497. Iso8601_default.MINIMUM_VALUE
  140498. );
  140499. options.minimumCone = Property_default.getValueOrUndefined(
  140500. ellipsoid.minimumCone,
  140501. Iso8601_default.MINIMUM_VALUE
  140502. );
  140503. options.maximumCone = Property_default.getValueOrUndefined(
  140504. ellipsoid.maximumCone,
  140505. Iso8601_default.MINIMUM_VALUE
  140506. );
  140507. options.stackPartitions = Property_default.getValueOrUndefined(
  140508. ellipsoid.stackPartitions,
  140509. Iso8601_default.MINIMUM_VALUE
  140510. );
  140511. options.slicePartitions = Property_default.getValueOrUndefined(
  140512. ellipsoid.slicePartitions,
  140513. Iso8601_default.MINIMUM_VALUE
  140514. );
  140515. options.subdivisions = Property_default.getValueOrUndefined(
  140516. ellipsoid.subdivisions,
  140517. Iso8601_default.MINIMUM_VALUE
  140518. );
  140519. options.offsetAttribute = heightReference !== HeightReference_default.NONE ? GeometryOffsetAttribute_default.ALL : void 0;
  140520. };
  140521. EllipsoidGeometryUpdater.prototype._onEntityPropertyChanged = heightReferenceOnEntityPropertyChanged_default;
  140522. EllipsoidGeometryUpdater.DynamicGeometryUpdater = DynamicEllipsoidGeometryUpdater;
  140523. function DynamicEllipsoidGeometryUpdater(geometryUpdater, primitives, groundPrimitives) {
  140524. DynamicGeometryUpdater_default.call(
  140525. this,
  140526. geometryUpdater,
  140527. primitives,
  140528. groundPrimitives
  140529. );
  140530. this._scene = geometryUpdater._scene;
  140531. this._modelMatrix = new Matrix4_default();
  140532. this._attributes = void 0;
  140533. this._outlineAttributes = void 0;
  140534. this._lastSceneMode = void 0;
  140535. this._lastShow = void 0;
  140536. this._lastOutlineShow = void 0;
  140537. this._lastOutlineWidth = void 0;
  140538. this._lastOutlineColor = void 0;
  140539. this._lastOffset = new Cartesian3_default();
  140540. this._material = {};
  140541. }
  140542. if (defined_default(Object.create)) {
  140543. DynamicEllipsoidGeometryUpdater.prototype = Object.create(
  140544. DynamicGeometryUpdater_default.prototype
  140545. );
  140546. DynamicEllipsoidGeometryUpdater.prototype.constructor = DynamicEllipsoidGeometryUpdater;
  140547. }
  140548. DynamicEllipsoidGeometryUpdater.prototype.update = function(time) {
  140549. Check_default.defined("time", time);
  140550. const entity = this._entity;
  140551. const ellipsoid = entity.ellipsoid;
  140552. if (!entity.isShowing || !entity.isAvailable(time) || !Property_default.getValueOrDefault(ellipsoid.show, time, true)) {
  140553. if (defined_default(this._primitive)) {
  140554. this._primitive.show = false;
  140555. }
  140556. if (defined_default(this._outlinePrimitive)) {
  140557. this._outlinePrimitive.show = false;
  140558. }
  140559. return;
  140560. }
  140561. const radii = Property_default.getValueOrUndefined(
  140562. ellipsoid.radii,
  140563. time,
  140564. radiiScratch
  140565. );
  140566. let modelMatrix = defined_default(radii) ? entity.computeModelMatrixForHeightReference(
  140567. time,
  140568. ellipsoid.heightReference,
  140569. radii.z * 0.5,
  140570. this._scene.mapProjection.ellipsoid,
  140571. this._modelMatrix
  140572. ) : void 0;
  140573. if (!defined_default(modelMatrix) || !defined_default(radii)) {
  140574. if (defined_default(this._primitive)) {
  140575. this._primitive.show = false;
  140576. }
  140577. if (defined_default(this._outlinePrimitive)) {
  140578. this._outlinePrimitive.show = false;
  140579. }
  140580. return;
  140581. }
  140582. const showFill = Property_default.getValueOrDefault(ellipsoid.fill, time, true);
  140583. const showOutline = Property_default.getValueOrDefault(
  140584. ellipsoid.outline,
  140585. time,
  140586. false
  140587. );
  140588. const outlineColor = Property_default.getValueOrClonedDefault(
  140589. ellipsoid.outlineColor,
  140590. time,
  140591. Color_default.BLACK,
  140592. scratchColor15
  140593. );
  140594. const material = MaterialProperty_default.getValue(
  140595. time,
  140596. defaultValue_default(ellipsoid.material, defaultMaterial2),
  140597. this._material
  140598. );
  140599. const innerRadii = Property_default.getValueOrUndefined(
  140600. ellipsoid.innerRadii,
  140601. time,
  140602. innerRadiiScratch
  140603. );
  140604. const minimumClock = Property_default.getValueOrUndefined(
  140605. ellipsoid.minimumClock,
  140606. time
  140607. );
  140608. const maximumClock = Property_default.getValueOrUndefined(
  140609. ellipsoid.maximumClock,
  140610. time
  140611. );
  140612. const minimumCone = Property_default.getValueOrUndefined(ellipsoid.minimumCone, time);
  140613. const maximumCone = Property_default.getValueOrUndefined(ellipsoid.maximumCone, time);
  140614. const stackPartitions = Property_default.getValueOrUndefined(
  140615. ellipsoid.stackPartitions,
  140616. time
  140617. );
  140618. const slicePartitions = Property_default.getValueOrUndefined(
  140619. ellipsoid.slicePartitions,
  140620. time
  140621. );
  140622. const subdivisions = Property_default.getValueOrUndefined(
  140623. ellipsoid.subdivisions,
  140624. time
  140625. );
  140626. const outlineWidth = Property_default.getValueOrDefault(
  140627. ellipsoid.outlineWidth,
  140628. time,
  140629. 1
  140630. );
  140631. const heightReference = Property_default.getValueOrDefault(
  140632. ellipsoid.heightReference,
  140633. time,
  140634. HeightReference_default.NONE
  140635. );
  140636. const offsetAttribute = heightReference !== HeightReference_default.NONE ? GeometryOffsetAttribute_default.ALL : void 0;
  140637. const sceneMode = this._scene.mode;
  140638. const in3D = sceneMode === SceneMode_default.SCENE3D && heightReference === HeightReference_default.NONE;
  140639. const options = this._options;
  140640. const shadows = this._geometryUpdater.shadowsProperty.getValue(time);
  140641. const distanceDisplayConditionProperty = this._geometryUpdater.distanceDisplayConditionProperty;
  140642. const distanceDisplayCondition = distanceDisplayConditionProperty.getValue(
  140643. time
  140644. );
  140645. const offset2 = Property_default.getValueOrDefault(
  140646. this._geometryUpdater.terrainOffsetProperty,
  140647. time,
  140648. defaultOffset6,
  140649. offsetScratch8
  140650. );
  140651. const rebuildPrimitives = !in3D || this._lastSceneMode !== sceneMode || !defined_default(this._primitive) || options.stackPartitions !== stackPartitions || options.slicePartitions !== slicePartitions || defined_default(innerRadii) && !Cartesian3_default.equals(options.innerRadii !== innerRadii) || options.minimumClock !== minimumClock || options.maximumClock !== maximumClock || options.minimumCone !== minimumCone || options.maximumCone !== maximumCone || options.subdivisions !== subdivisions || this._lastOutlineWidth !== outlineWidth || options.offsetAttribute !== offsetAttribute;
  140652. if (rebuildPrimitives) {
  140653. const primitives = this._primitives;
  140654. primitives.removeAndDestroy(this._primitive);
  140655. primitives.removeAndDestroy(this._outlinePrimitive);
  140656. this._primitive = void 0;
  140657. this._outlinePrimitive = void 0;
  140658. this._lastSceneMode = sceneMode;
  140659. this._lastOutlineWidth = outlineWidth;
  140660. options.stackPartitions = stackPartitions;
  140661. options.slicePartitions = slicePartitions;
  140662. options.subdivisions = subdivisions;
  140663. options.offsetAttribute = offsetAttribute;
  140664. options.radii = Cartesian3_default.clone(in3D ? unitSphere : radii, options.radii);
  140665. if (defined_default(innerRadii)) {
  140666. if (in3D) {
  140667. const mag = Cartesian3_default.magnitude(radii);
  140668. options.innerRadii = Cartesian3_default.fromElements(
  140669. innerRadii.x / mag,
  140670. innerRadii.y / mag,
  140671. innerRadii.z / mag,
  140672. options.innerRadii
  140673. );
  140674. } else {
  140675. options.innerRadii = Cartesian3_default.clone(innerRadii, options.innerRadii);
  140676. }
  140677. } else {
  140678. options.innerRadii = void 0;
  140679. }
  140680. options.minimumClock = minimumClock;
  140681. options.maximumClock = maximumClock;
  140682. options.minimumCone = minimumCone;
  140683. options.maximumCone = maximumCone;
  140684. const appearance = new MaterialAppearance_default({
  140685. material,
  140686. translucent: material.isTranslucent(),
  140687. closed: true
  140688. });
  140689. options.vertexFormat = appearance.vertexFormat;
  140690. const fillInstance = this._geometryUpdater.createFillGeometryInstance(
  140691. time,
  140692. in3D,
  140693. this._modelMatrix
  140694. );
  140695. this._primitive = primitives.add(
  140696. new Primitive_default({
  140697. geometryInstances: fillInstance,
  140698. appearance,
  140699. asynchronous: false,
  140700. shadows
  140701. })
  140702. );
  140703. const outlineInstance = this._geometryUpdater.createOutlineGeometryInstance(
  140704. time,
  140705. in3D,
  140706. this._modelMatrix
  140707. );
  140708. this._outlinePrimitive = primitives.add(
  140709. new Primitive_default({
  140710. geometryInstances: outlineInstance,
  140711. appearance: new PerInstanceColorAppearance_default({
  140712. flat: true,
  140713. translucent: outlineInstance.attributes.color.value[3] !== 255,
  140714. renderState: {
  140715. lineWidth: this._geometryUpdater._scene.clampLineWidth(
  140716. outlineWidth
  140717. )
  140718. }
  140719. }),
  140720. asynchronous: false,
  140721. shadows
  140722. })
  140723. );
  140724. this._lastShow = showFill;
  140725. this._lastOutlineShow = showOutline;
  140726. this._lastOutlineColor = Color_default.clone(outlineColor, this._lastOutlineColor);
  140727. this._lastDistanceDisplayCondition = distanceDisplayCondition;
  140728. this._lastOffset = Cartesian3_default.clone(offset2, this._lastOffset);
  140729. } else if (this._primitive.ready) {
  140730. const primitive = this._primitive;
  140731. const outlinePrimitive = this._outlinePrimitive;
  140732. primitive.show = true;
  140733. outlinePrimitive.show = true;
  140734. primitive.appearance.material = material;
  140735. let attributes = this._attributes;
  140736. if (!defined_default(attributes)) {
  140737. attributes = primitive.getGeometryInstanceAttributes(entity);
  140738. this._attributes = attributes;
  140739. }
  140740. if (showFill !== this._lastShow) {
  140741. attributes.show = ShowGeometryInstanceAttribute_default.toValue(
  140742. showFill,
  140743. attributes.show
  140744. );
  140745. this._lastShow = showFill;
  140746. }
  140747. let outlineAttributes = this._outlineAttributes;
  140748. if (!defined_default(outlineAttributes)) {
  140749. outlineAttributes = outlinePrimitive.getGeometryInstanceAttributes(
  140750. entity
  140751. );
  140752. this._outlineAttributes = outlineAttributes;
  140753. }
  140754. if (showOutline !== this._lastOutlineShow) {
  140755. outlineAttributes.show = ShowGeometryInstanceAttribute_default.toValue(
  140756. showOutline,
  140757. outlineAttributes.show
  140758. );
  140759. this._lastOutlineShow = showOutline;
  140760. }
  140761. if (!Color_default.equals(outlineColor, this._lastOutlineColor)) {
  140762. outlineAttributes.color = ColorGeometryInstanceAttribute_default.toValue(
  140763. outlineColor,
  140764. outlineAttributes.color
  140765. );
  140766. Color_default.clone(outlineColor, this._lastOutlineColor);
  140767. }
  140768. if (!DistanceDisplayCondition_default.equals(
  140769. distanceDisplayCondition,
  140770. this._lastDistanceDisplayCondition
  140771. )) {
  140772. attributes.distanceDisplayCondition = DistanceDisplayConditionGeometryInstanceAttribute_default.toValue(
  140773. distanceDisplayCondition,
  140774. attributes.distanceDisplayCondition
  140775. );
  140776. outlineAttributes.distanceDisplayCondition = DistanceDisplayConditionGeometryInstanceAttribute_default.toValue(
  140777. distanceDisplayCondition,
  140778. outlineAttributes.distanceDisplayCondition
  140779. );
  140780. DistanceDisplayCondition_default.clone(
  140781. distanceDisplayCondition,
  140782. this._lastDistanceDisplayCondition
  140783. );
  140784. }
  140785. if (!Cartesian3_default.equals(offset2, this._lastOffset)) {
  140786. attributes.offset = OffsetGeometryInstanceAttribute_default.toValue(
  140787. offset2,
  140788. attributes.offset
  140789. );
  140790. outlineAttributes.offset = OffsetGeometryInstanceAttribute_default.toValue(
  140791. offset2,
  140792. attributes.offset
  140793. );
  140794. Cartesian3_default.clone(offset2, this._lastOffset);
  140795. }
  140796. }
  140797. if (in3D) {
  140798. radii.x = Math.max(radii.x, 1e-3);
  140799. radii.y = Math.max(radii.y, 1e-3);
  140800. radii.z = Math.max(radii.z, 1e-3);
  140801. modelMatrix = Matrix4_default.multiplyByScale(modelMatrix, radii, modelMatrix);
  140802. this._primitive.modelMatrix = modelMatrix;
  140803. this._outlinePrimitive.modelMatrix = modelMatrix;
  140804. }
  140805. };
  140806. var EllipsoidGeometryUpdater_default = EllipsoidGeometryUpdater;
  140807. // node_modules/cesium/Source/DataSources/PlaneGeometryUpdater.js
  140808. var positionScratch11 = new Cartesian3_default();
  140809. var scratchColor16 = new Color_default();
  140810. function PlaneGeometryOptions(entity) {
  140811. this.id = entity;
  140812. this.vertexFormat = void 0;
  140813. this.plane = void 0;
  140814. this.dimensions = void 0;
  140815. }
  140816. function PlaneGeometryUpdater(entity, scene) {
  140817. GeometryUpdater_default.call(this, {
  140818. entity,
  140819. scene,
  140820. geometryOptions: new PlaneGeometryOptions(entity),
  140821. geometryPropertyName: "plane",
  140822. observedPropertyNames: ["availability", "position", "orientation", "plane"]
  140823. });
  140824. this._onEntityPropertyChanged(entity, "plane", entity.plane, void 0);
  140825. }
  140826. if (defined_default(Object.create)) {
  140827. PlaneGeometryUpdater.prototype = Object.create(GeometryUpdater_default.prototype);
  140828. PlaneGeometryUpdater.prototype.constructor = PlaneGeometryUpdater;
  140829. }
  140830. PlaneGeometryUpdater.prototype.createFillGeometryInstance = function(time) {
  140831. Check_default.defined("time", time);
  140832. if (!this._fillEnabled) {
  140833. throw new DeveloperError_default(
  140834. "This instance does not represent a filled geometry."
  140835. );
  140836. }
  140837. const entity = this._entity;
  140838. const isAvailable = entity.isAvailable(time);
  140839. let attributes;
  140840. let color;
  140841. const show = new ShowGeometryInstanceAttribute_default(
  140842. isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time)
  140843. );
  140844. const distanceDisplayCondition = this._distanceDisplayConditionProperty.getValue(
  140845. time
  140846. );
  140847. const distanceDisplayConditionAttribute = DistanceDisplayConditionGeometryInstanceAttribute_default.fromDistanceDisplayCondition(
  140848. distanceDisplayCondition
  140849. );
  140850. if (this._materialProperty instanceof ColorMaterialProperty_default) {
  140851. let currentColor;
  140852. if (defined_default(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) {
  140853. currentColor = this._materialProperty.color.getValue(time, scratchColor16);
  140854. }
  140855. if (!defined_default(currentColor)) {
  140856. currentColor = Color_default.WHITE;
  140857. }
  140858. color = ColorGeometryInstanceAttribute_default.fromColor(currentColor);
  140859. attributes = {
  140860. show,
  140861. distanceDisplayCondition: distanceDisplayConditionAttribute,
  140862. color
  140863. };
  140864. } else {
  140865. attributes = {
  140866. show,
  140867. distanceDisplayCondition: distanceDisplayConditionAttribute
  140868. };
  140869. }
  140870. const planeGraphics = entity.plane;
  140871. const options = this._options;
  140872. let modelMatrix = entity.computeModelMatrix(time);
  140873. const plane = Property_default.getValueOrDefault(
  140874. planeGraphics.plane,
  140875. time,
  140876. options.plane
  140877. );
  140878. const dimensions = Property_default.getValueOrUndefined(
  140879. planeGraphics.dimensions,
  140880. time,
  140881. options.dimensions
  140882. );
  140883. options.plane = plane;
  140884. options.dimensions = dimensions;
  140885. modelMatrix = createPrimitiveMatrix(
  140886. plane,
  140887. dimensions,
  140888. modelMatrix,
  140889. modelMatrix
  140890. );
  140891. return new GeometryInstance_default({
  140892. id: entity,
  140893. geometry: new PlaneGeometry_default(this._options),
  140894. modelMatrix,
  140895. attributes
  140896. });
  140897. };
  140898. PlaneGeometryUpdater.prototype.createOutlineGeometryInstance = function(time) {
  140899. Check_default.defined("time", time);
  140900. if (!this._outlineEnabled) {
  140901. throw new DeveloperError_default(
  140902. "This instance does not represent an outlined geometry."
  140903. );
  140904. }
  140905. const entity = this._entity;
  140906. const isAvailable = entity.isAvailable(time);
  140907. const outlineColor = Property_default.getValueOrDefault(
  140908. this._outlineColorProperty,
  140909. time,
  140910. Color_default.BLACK,
  140911. scratchColor16
  140912. );
  140913. const distanceDisplayCondition = this._distanceDisplayConditionProperty.getValue(
  140914. time
  140915. );
  140916. const planeGraphics = entity.plane;
  140917. const options = this._options;
  140918. let modelMatrix = entity.computeModelMatrix(time);
  140919. const plane = Property_default.getValueOrDefault(
  140920. planeGraphics.plane,
  140921. time,
  140922. options.plane
  140923. );
  140924. const dimensions = Property_default.getValueOrUndefined(
  140925. planeGraphics.dimensions,
  140926. time,
  140927. options.dimensions
  140928. );
  140929. options.plane = plane;
  140930. options.dimensions = dimensions;
  140931. modelMatrix = createPrimitiveMatrix(
  140932. plane,
  140933. dimensions,
  140934. modelMatrix,
  140935. modelMatrix
  140936. );
  140937. return new GeometryInstance_default({
  140938. id: entity,
  140939. geometry: new PlaneOutlineGeometry_default(),
  140940. modelMatrix,
  140941. attributes: {
  140942. show: new ShowGeometryInstanceAttribute_default(
  140943. isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)
  140944. ),
  140945. color: ColorGeometryInstanceAttribute_default.fromColor(outlineColor),
  140946. distanceDisplayCondition: DistanceDisplayConditionGeometryInstanceAttribute_default.fromDistanceDisplayCondition(
  140947. distanceDisplayCondition
  140948. )
  140949. }
  140950. });
  140951. };
  140952. PlaneGeometryUpdater.prototype._isHidden = function(entity, plane) {
  140953. return !defined_default(plane.plane) || !defined_default(plane.dimensions) || !defined_default(entity.position) || GeometryUpdater_default.prototype._isHidden.call(this, entity, plane);
  140954. };
  140955. PlaneGeometryUpdater.prototype._getIsClosed = function(options) {
  140956. return false;
  140957. };
  140958. PlaneGeometryUpdater.prototype._isDynamic = function(entity, plane) {
  140959. return !entity.position.isConstant || !Property_default.isConstant(entity.orientation) || !plane.plane.isConstant || !plane.dimensions.isConstant || !Property_default.isConstant(plane.outlineWidth);
  140960. };
  140961. PlaneGeometryUpdater.prototype._setStaticOptions = function(entity, plane) {
  140962. const isColorMaterial = this._materialProperty instanceof ColorMaterialProperty_default;
  140963. const options = this._options;
  140964. options.vertexFormat = isColorMaterial ? PerInstanceColorAppearance_default.VERTEX_FORMAT : MaterialAppearance_default.MaterialSupport.TEXTURED.vertexFormat;
  140965. options.plane = plane.plane.getValue(Iso8601_default.MINIMUM_VALUE, options.plane);
  140966. options.dimensions = plane.dimensions.getValue(
  140967. Iso8601_default.MINIMUM_VALUE,
  140968. options.dimensions
  140969. );
  140970. };
  140971. PlaneGeometryUpdater.DynamicGeometryUpdater = DynamicPlaneGeometryUpdater;
  140972. function DynamicPlaneGeometryUpdater(geometryUpdater, primitives, groundPrimitives) {
  140973. DynamicGeometryUpdater_default.call(
  140974. this,
  140975. geometryUpdater,
  140976. primitives,
  140977. groundPrimitives
  140978. );
  140979. }
  140980. if (defined_default(Object.create)) {
  140981. DynamicPlaneGeometryUpdater.prototype = Object.create(
  140982. DynamicGeometryUpdater_default.prototype
  140983. );
  140984. DynamicPlaneGeometryUpdater.prototype.constructor = DynamicPlaneGeometryUpdater;
  140985. }
  140986. DynamicPlaneGeometryUpdater.prototype._isHidden = function(entity, plane, time) {
  140987. const options = this._options;
  140988. const position = Property_default.getValueOrUndefined(
  140989. entity.position,
  140990. time,
  140991. positionScratch11
  140992. );
  140993. return !defined_default(position) || !defined_default(options.plane) || !defined_default(options.dimensions) || DynamicGeometryUpdater_default.prototype._isHidden.call(this, entity, plane, time);
  140994. };
  140995. DynamicPlaneGeometryUpdater.prototype._setOptions = function(entity, plane, time) {
  140996. const options = this._options;
  140997. options.plane = Property_default.getValueOrDefault(plane.plane, time, options.plane);
  140998. options.dimensions = Property_default.getValueOrUndefined(
  140999. plane.dimensions,
  141000. time,
  141001. options.dimensions
  141002. );
  141003. };
  141004. var scratchAxis2 = new Cartesian3_default();
  141005. var scratchUp = new Cartesian3_default();
  141006. var scratchTranslation = new Cartesian3_default();
  141007. var scratchScale5 = new Cartesian3_default();
  141008. var scratchRotation2 = new Matrix3_default();
  141009. var scratchRotationScale2 = new Matrix3_default();
  141010. var scratchLocalTransform = new Matrix4_default();
  141011. function createPrimitiveMatrix(plane, dimensions, transform4, result) {
  141012. const normal2 = plane.normal;
  141013. const distance2 = plane.distance;
  141014. const translation3 = Cartesian3_default.multiplyByScalar(
  141015. normal2,
  141016. -distance2,
  141017. scratchTranslation
  141018. );
  141019. let up = Cartesian3_default.clone(Cartesian3_default.UNIT_Z, scratchUp);
  141020. if (Math_default.equalsEpsilon(
  141021. Math.abs(Cartesian3_default.dot(up, normal2)),
  141022. 1,
  141023. Math_default.EPSILON8
  141024. )) {
  141025. up = Cartesian3_default.clone(Cartesian3_default.UNIT_Y, up);
  141026. }
  141027. const left = Cartesian3_default.cross(up, normal2, scratchAxis2);
  141028. up = Cartesian3_default.cross(normal2, left, up);
  141029. Cartesian3_default.normalize(left, left);
  141030. Cartesian3_default.normalize(up, up);
  141031. const rotationMatrix = scratchRotation2;
  141032. Matrix3_default.setColumn(rotationMatrix, 0, left, rotationMatrix);
  141033. Matrix3_default.setColumn(rotationMatrix, 1, up, rotationMatrix);
  141034. Matrix3_default.setColumn(rotationMatrix, 2, normal2, rotationMatrix);
  141035. const scale = Cartesian3_default.fromElements(
  141036. dimensions.x,
  141037. dimensions.y,
  141038. 1,
  141039. scratchScale5
  141040. );
  141041. const rotationScaleMatrix = Matrix3_default.multiplyByScale(
  141042. rotationMatrix,
  141043. scale,
  141044. scratchRotationScale2
  141045. );
  141046. const localTransform = Matrix4_default.fromRotationTranslation(
  141047. rotationScaleMatrix,
  141048. translation3,
  141049. scratchLocalTransform
  141050. );
  141051. return Matrix4_default.multiplyTransformation(transform4, localTransform, result);
  141052. }
  141053. PlaneGeometryUpdater.createPrimitiveMatrix = createPrimitiveMatrix;
  141054. var PlaneGeometryUpdater_default = PlaneGeometryUpdater;
  141055. // node_modules/cesium/Source/DataSources/PolygonGeometryUpdater.js
  141056. var heightAndPerPositionHeightWarning = "Entity polygons cannot have both height and perPositionHeight. height will be ignored";
  141057. var heightReferenceAndPerPositionHeightWarning = "heightReference is not supported for entity polygons with perPositionHeight. heightReference will be ignored";
  141058. var scratchColor17 = new Color_default();
  141059. var defaultOffset7 = Cartesian3_default.ZERO;
  141060. var offsetScratch9 = new Cartesian3_default();
  141061. var scratchRectangle7 = new Rectangle_default();
  141062. var scratch2DPositions = [];
  141063. var cart2Scratch = new Cartesian2_default();
  141064. function PolygonGeometryOptions(entity) {
  141065. this.id = entity;
  141066. this.vertexFormat = void 0;
  141067. this.polygonHierarchy = void 0;
  141068. this.perPositionHeight = void 0;
  141069. this.closeTop = void 0;
  141070. this.closeBottom = void 0;
  141071. this.height = void 0;
  141072. this.extrudedHeight = void 0;
  141073. this.granularity = void 0;
  141074. this.stRotation = void 0;
  141075. this.offsetAttribute = void 0;
  141076. this.arcType = void 0;
  141077. }
  141078. function PolygonGeometryUpdater(entity, scene) {
  141079. GroundGeometryUpdater_default.call(this, {
  141080. entity,
  141081. scene,
  141082. geometryOptions: new PolygonGeometryOptions(entity),
  141083. geometryPropertyName: "polygon",
  141084. observedPropertyNames: ["availability", "polygon"]
  141085. });
  141086. this._onEntityPropertyChanged(entity, "polygon", entity.polygon, void 0);
  141087. }
  141088. if (defined_default(Object.create)) {
  141089. PolygonGeometryUpdater.prototype = Object.create(
  141090. GroundGeometryUpdater_default.prototype
  141091. );
  141092. PolygonGeometryUpdater.prototype.constructor = PolygonGeometryUpdater;
  141093. }
  141094. PolygonGeometryUpdater.prototype.createFillGeometryInstance = function(time) {
  141095. Check_default.defined("time", time);
  141096. if (!this._fillEnabled) {
  141097. throw new DeveloperError_default(
  141098. "This instance does not represent a filled geometry."
  141099. );
  141100. }
  141101. const entity = this._entity;
  141102. const isAvailable = entity.isAvailable(time);
  141103. const options = this._options;
  141104. const attributes = {
  141105. show: new ShowGeometryInstanceAttribute_default(
  141106. isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time)
  141107. ),
  141108. distanceDisplayCondition: DistanceDisplayConditionGeometryInstanceAttribute_default.fromDistanceDisplayCondition(
  141109. this._distanceDisplayConditionProperty.getValue(time)
  141110. ),
  141111. offset: void 0,
  141112. color: void 0
  141113. };
  141114. if (this._materialProperty instanceof ColorMaterialProperty_default) {
  141115. let currentColor;
  141116. if (defined_default(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) {
  141117. currentColor = this._materialProperty.color.getValue(time, scratchColor17);
  141118. }
  141119. if (!defined_default(currentColor)) {
  141120. currentColor = Color_default.WHITE;
  141121. }
  141122. attributes.color = ColorGeometryInstanceAttribute_default.fromColor(currentColor);
  141123. }
  141124. if (defined_default(options.offsetAttribute)) {
  141125. attributes.offset = OffsetGeometryInstanceAttribute_default.fromCartesian3(
  141126. Property_default.getValueOrDefault(
  141127. this._terrainOffsetProperty,
  141128. time,
  141129. defaultOffset7,
  141130. offsetScratch9
  141131. )
  141132. );
  141133. }
  141134. let geometry;
  141135. if (options.perPositionHeight && !defined_default(options.extrudedHeight)) {
  141136. geometry = new CoplanarPolygonGeometry_default(options);
  141137. } else {
  141138. geometry = new PolygonGeometry_default(options);
  141139. }
  141140. return new GeometryInstance_default({
  141141. id: entity,
  141142. geometry,
  141143. attributes
  141144. });
  141145. };
  141146. PolygonGeometryUpdater.prototype.createOutlineGeometryInstance = function(time) {
  141147. Check_default.defined("time", time);
  141148. if (!this._outlineEnabled) {
  141149. throw new DeveloperError_default(
  141150. "This instance does not represent an outlined geometry."
  141151. );
  141152. }
  141153. const entity = this._entity;
  141154. const isAvailable = entity.isAvailable(time);
  141155. const options = this._options;
  141156. const outlineColor = Property_default.getValueOrDefault(
  141157. this._outlineColorProperty,
  141158. time,
  141159. Color_default.BLACK,
  141160. scratchColor17
  141161. );
  141162. const distanceDisplayCondition = this._distanceDisplayConditionProperty.getValue(
  141163. time
  141164. );
  141165. const attributes = {
  141166. show: new ShowGeometryInstanceAttribute_default(
  141167. isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)
  141168. ),
  141169. color: ColorGeometryInstanceAttribute_default.fromColor(outlineColor),
  141170. distanceDisplayCondition: DistanceDisplayConditionGeometryInstanceAttribute_default.fromDistanceDisplayCondition(
  141171. distanceDisplayCondition
  141172. ),
  141173. offset: void 0
  141174. };
  141175. if (defined_default(options.offsetAttribute)) {
  141176. attributes.offset = OffsetGeometryInstanceAttribute_default.fromCartesian3(
  141177. Property_default.getValueOrDefault(
  141178. this._terrainOffsetProperty,
  141179. time,
  141180. defaultOffset7,
  141181. offsetScratch9
  141182. )
  141183. );
  141184. }
  141185. let geometry;
  141186. if (options.perPositionHeight && !defined_default(options.extrudedHeight)) {
  141187. geometry = new CoplanarPolygonOutlineGeometry_default(options);
  141188. } else {
  141189. geometry = new PolygonOutlineGeometry_default(options);
  141190. }
  141191. return new GeometryInstance_default({
  141192. id: entity,
  141193. geometry,
  141194. attributes
  141195. });
  141196. };
  141197. PolygonGeometryUpdater.prototype._computeCenter = function(time, result) {
  141198. const hierarchy = Property_default.getValueOrUndefined(
  141199. this._entity.polygon.hierarchy,
  141200. time
  141201. );
  141202. if (!defined_default(hierarchy)) {
  141203. return;
  141204. }
  141205. const positions = hierarchy.positions;
  141206. if (positions.length === 0) {
  141207. return;
  141208. }
  141209. const ellipsoid = this._scene.mapProjection.ellipsoid;
  141210. const tangentPlane = EllipsoidTangentPlane_default.fromPoints(positions, ellipsoid);
  141211. const positions2D = tangentPlane.projectPointsOntoPlane(
  141212. positions,
  141213. scratch2DPositions
  141214. );
  141215. const length3 = positions2D.length;
  141216. let area2 = 0;
  141217. let j = length3 - 1;
  141218. let centroid2D = new Cartesian2_default();
  141219. for (let i2 = 0; i2 < length3; j = i2++) {
  141220. const p1 = positions2D[i2];
  141221. const p2 = positions2D[j];
  141222. const f2 = p1.x * p2.y - p2.x * p1.y;
  141223. let sum = Cartesian2_default.add(p1, p2, cart2Scratch);
  141224. sum = Cartesian2_default.multiplyByScalar(sum, f2, sum);
  141225. centroid2D = Cartesian2_default.add(centroid2D, sum, centroid2D);
  141226. area2 += f2;
  141227. }
  141228. const a4 = 1 / (area2 * 3);
  141229. centroid2D = Cartesian2_default.multiplyByScalar(centroid2D, a4, centroid2D);
  141230. return tangentPlane.projectPointOntoEllipsoid(centroid2D, result);
  141231. };
  141232. PolygonGeometryUpdater.prototype._isHidden = function(entity, polygon) {
  141233. return !defined_default(polygon.hierarchy) || GeometryUpdater_default.prototype._isHidden.call(this, entity, polygon);
  141234. };
  141235. PolygonGeometryUpdater.prototype._isOnTerrain = function(entity, polygon) {
  141236. const onTerrain = GroundGeometryUpdater_default.prototype._isOnTerrain.call(
  141237. this,
  141238. entity,
  141239. polygon
  141240. );
  141241. const perPositionHeightProperty = polygon.perPositionHeight;
  141242. const perPositionHeightEnabled = defined_default(perPositionHeightProperty) && (perPositionHeightProperty.isConstant ? perPositionHeightProperty.getValue(Iso8601_default.MINIMUM_VALUE) : true);
  141243. return onTerrain && !perPositionHeightEnabled;
  141244. };
  141245. PolygonGeometryUpdater.prototype._isDynamic = function(entity, polygon) {
  141246. return !polygon.hierarchy.isConstant || !Property_default.isConstant(polygon.height) || !Property_default.isConstant(polygon.extrudedHeight) || !Property_default.isConstant(polygon.granularity) || !Property_default.isConstant(polygon.stRotation) || !Property_default.isConstant(polygon.outlineWidth) || !Property_default.isConstant(polygon.perPositionHeight) || !Property_default.isConstant(polygon.closeTop) || !Property_default.isConstant(polygon.closeBottom) || !Property_default.isConstant(polygon.zIndex) || !Property_default.isConstant(polygon.arcType) || this._onTerrain && !Property_default.isConstant(this._materialProperty) && !(this._materialProperty instanceof ColorMaterialProperty_default);
  141247. };
  141248. PolygonGeometryUpdater.prototype._setStaticOptions = function(entity, polygon) {
  141249. const isColorMaterial = this._materialProperty instanceof ColorMaterialProperty_default;
  141250. const options = this._options;
  141251. options.vertexFormat = isColorMaterial ? PerInstanceColorAppearance_default.VERTEX_FORMAT : MaterialAppearance_default.MaterialSupport.TEXTURED.vertexFormat;
  141252. const hierarchyValue = polygon.hierarchy.getValue(Iso8601_default.MINIMUM_VALUE);
  141253. let heightValue = Property_default.getValueOrUndefined(
  141254. polygon.height,
  141255. Iso8601_default.MINIMUM_VALUE
  141256. );
  141257. const heightReferenceValue = Property_default.getValueOrDefault(
  141258. polygon.heightReference,
  141259. Iso8601_default.MINIMUM_VALUE,
  141260. HeightReference_default.NONE
  141261. );
  141262. let extrudedHeightValue = Property_default.getValueOrUndefined(
  141263. polygon.extrudedHeight,
  141264. Iso8601_default.MINIMUM_VALUE
  141265. );
  141266. const extrudedHeightReferenceValue = Property_default.getValueOrDefault(
  141267. polygon.extrudedHeightReference,
  141268. Iso8601_default.MINIMUM_VALUE,
  141269. HeightReference_default.NONE
  141270. );
  141271. const perPositionHeightValue = Property_default.getValueOrDefault(
  141272. polygon.perPositionHeight,
  141273. Iso8601_default.MINIMUM_VALUE,
  141274. false
  141275. );
  141276. heightValue = GroundGeometryUpdater_default.getGeometryHeight(
  141277. heightValue,
  141278. heightReferenceValue
  141279. );
  141280. let offsetAttribute;
  141281. if (perPositionHeightValue) {
  141282. if (defined_default(heightValue)) {
  141283. heightValue = void 0;
  141284. oneTimeWarning_default(heightAndPerPositionHeightWarning);
  141285. }
  141286. if (heightReferenceValue !== HeightReference_default.NONE && perPositionHeightValue) {
  141287. heightValue = void 0;
  141288. oneTimeWarning_default(heightReferenceAndPerPositionHeightWarning);
  141289. }
  141290. } else {
  141291. if (defined_default(extrudedHeightValue) && !defined_default(heightValue)) {
  141292. heightValue = 0;
  141293. }
  141294. offsetAttribute = GroundGeometryUpdater_default.computeGeometryOffsetAttribute(
  141295. heightValue,
  141296. heightReferenceValue,
  141297. extrudedHeightValue,
  141298. extrudedHeightReferenceValue
  141299. );
  141300. }
  141301. options.polygonHierarchy = hierarchyValue;
  141302. options.granularity = Property_default.getValueOrUndefined(
  141303. polygon.granularity,
  141304. Iso8601_default.MINIMUM_VALUE
  141305. );
  141306. options.stRotation = Property_default.getValueOrUndefined(
  141307. polygon.stRotation,
  141308. Iso8601_default.MINIMUM_VALUE
  141309. );
  141310. options.perPositionHeight = perPositionHeightValue;
  141311. options.closeTop = Property_default.getValueOrDefault(
  141312. polygon.closeTop,
  141313. Iso8601_default.MINIMUM_VALUE,
  141314. true
  141315. );
  141316. options.closeBottom = Property_default.getValueOrDefault(
  141317. polygon.closeBottom,
  141318. Iso8601_default.MINIMUM_VALUE,
  141319. true
  141320. );
  141321. options.offsetAttribute = offsetAttribute;
  141322. options.height = heightValue;
  141323. options.arcType = Property_default.getValueOrDefault(
  141324. polygon.arcType,
  141325. Iso8601_default.MINIMUM_VALUE,
  141326. ArcType_default.GEODESIC
  141327. );
  141328. extrudedHeightValue = GroundGeometryUpdater_default.getGeometryExtrudedHeight(
  141329. extrudedHeightValue,
  141330. extrudedHeightReferenceValue
  141331. );
  141332. if (extrudedHeightValue === GroundGeometryUpdater_default.CLAMP_TO_GROUND) {
  141333. extrudedHeightValue = ApproximateTerrainHeights_default.getMinimumMaximumHeights(
  141334. PolygonGeometry_default.computeRectangle(options, scratchRectangle7)
  141335. ).minimumTerrainHeight;
  141336. }
  141337. options.extrudedHeight = extrudedHeightValue;
  141338. };
  141339. PolygonGeometryUpdater.prototype._getIsClosed = function(options) {
  141340. const height = options.height;
  141341. const extrudedHeight = options.extrudedHeight;
  141342. const isExtruded = defined_default(extrudedHeight) && extrudedHeight !== height;
  141343. return !options.perPositionHeight && (!isExtruded && height === 0 || isExtruded && options.closeTop && options.closeBottom);
  141344. };
  141345. PolygonGeometryUpdater.DynamicGeometryUpdater = DyanmicPolygonGeometryUpdater;
  141346. function DyanmicPolygonGeometryUpdater(geometryUpdater, primitives, groundPrimitives) {
  141347. DynamicGeometryUpdater_default.call(
  141348. this,
  141349. geometryUpdater,
  141350. primitives,
  141351. groundPrimitives
  141352. );
  141353. }
  141354. if (defined_default(Object.create)) {
  141355. DyanmicPolygonGeometryUpdater.prototype = Object.create(
  141356. DynamicGeometryUpdater_default.prototype
  141357. );
  141358. DyanmicPolygonGeometryUpdater.prototype.constructor = DyanmicPolygonGeometryUpdater;
  141359. }
  141360. DyanmicPolygonGeometryUpdater.prototype._isHidden = function(entity, polygon, time) {
  141361. return !defined_default(this._options.polygonHierarchy) || DynamicGeometryUpdater_default.prototype._isHidden.call(this, entity, polygon, time);
  141362. };
  141363. DyanmicPolygonGeometryUpdater.prototype._setOptions = function(entity, polygon, time) {
  141364. const options = this._options;
  141365. options.polygonHierarchy = Property_default.getValueOrUndefined(
  141366. polygon.hierarchy,
  141367. time
  141368. );
  141369. let heightValue = Property_default.getValueOrUndefined(polygon.height, time);
  141370. const heightReferenceValue = Property_default.getValueOrDefault(
  141371. polygon.heightReference,
  141372. time,
  141373. HeightReference_default.NONE
  141374. );
  141375. const extrudedHeightReferenceValue = Property_default.getValueOrDefault(
  141376. polygon.extrudedHeightReference,
  141377. time,
  141378. HeightReference_default.NONE
  141379. );
  141380. let extrudedHeightValue = Property_default.getValueOrUndefined(
  141381. polygon.extrudedHeight,
  141382. time
  141383. );
  141384. const perPositionHeightValue = Property_default.getValueOrUndefined(
  141385. polygon.perPositionHeight,
  141386. time
  141387. );
  141388. heightValue = GroundGeometryUpdater_default.getGeometryHeight(
  141389. heightValue,
  141390. extrudedHeightReferenceValue
  141391. );
  141392. let offsetAttribute;
  141393. if (perPositionHeightValue) {
  141394. if (defined_default(heightValue)) {
  141395. heightValue = void 0;
  141396. oneTimeWarning_default(heightAndPerPositionHeightWarning);
  141397. }
  141398. if (heightReferenceValue !== HeightReference_default.NONE && perPositionHeightValue) {
  141399. heightValue = void 0;
  141400. oneTimeWarning_default(heightReferenceAndPerPositionHeightWarning);
  141401. }
  141402. } else {
  141403. if (defined_default(extrudedHeightValue) && !defined_default(heightValue)) {
  141404. heightValue = 0;
  141405. }
  141406. offsetAttribute = GroundGeometryUpdater_default.computeGeometryOffsetAttribute(
  141407. heightValue,
  141408. heightReferenceValue,
  141409. extrudedHeightValue,
  141410. extrudedHeightReferenceValue
  141411. );
  141412. }
  141413. options.granularity = Property_default.getValueOrUndefined(polygon.granularity, time);
  141414. options.stRotation = Property_default.getValueOrUndefined(polygon.stRotation, time);
  141415. options.perPositionHeight = Property_default.getValueOrUndefined(
  141416. polygon.perPositionHeight,
  141417. time
  141418. );
  141419. options.closeTop = Property_default.getValueOrDefault(polygon.closeTop, time, true);
  141420. options.closeBottom = Property_default.getValueOrDefault(
  141421. polygon.closeBottom,
  141422. time,
  141423. true
  141424. );
  141425. options.offsetAttribute = offsetAttribute;
  141426. options.height = heightValue;
  141427. options.arcType = Property_default.getValueOrDefault(
  141428. polygon.arcType,
  141429. time,
  141430. ArcType_default.GEODESIC
  141431. );
  141432. extrudedHeightValue = GroundGeometryUpdater_default.getGeometryExtrudedHeight(
  141433. extrudedHeightValue,
  141434. extrudedHeightReferenceValue
  141435. );
  141436. if (extrudedHeightValue === GroundGeometryUpdater_default.CLAMP_TO_GROUND) {
  141437. extrudedHeightValue = ApproximateTerrainHeights_default.getMinimumMaximumHeights(
  141438. PolygonGeometry_default.computeRectangle(options, scratchRectangle7)
  141439. ).minimumTerrainHeight;
  141440. }
  141441. options.extrudedHeight = extrudedHeightValue;
  141442. };
  141443. var PolygonGeometryUpdater_default = PolygonGeometryUpdater;
  141444. // node_modules/cesium/Source/DataSources/PolylineVolumeGeometryUpdater.js
  141445. var scratchColor18 = new Color_default();
  141446. function PolylineVolumeGeometryOptions(entity) {
  141447. this.id = entity;
  141448. this.vertexFormat = void 0;
  141449. this.polylinePositions = void 0;
  141450. this.shapePositions = void 0;
  141451. this.cornerType = void 0;
  141452. this.granularity = void 0;
  141453. }
  141454. function PolylineVolumeGeometryUpdater(entity, scene) {
  141455. GeometryUpdater_default.call(this, {
  141456. entity,
  141457. scene,
  141458. geometryOptions: new PolylineVolumeGeometryOptions(entity),
  141459. geometryPropertyName: "polylineVolume",
  141460. observedPropertyNames: ["availability", "polylineVolume"]
  141461. });
  141462. this._onEntityPropertyChanged(
  141463. entity,
  141464. "polylineVolume",
  141465. entity.polylineVolume,
  141466. void 0
  141467. );
  141468. }
  141469. if (defined_default(Object.create)) {
  141470. PolylineVolumeGeometryUpdater.prototype = Object.create(
  141471. GeometryUpdater_default.prototype
  141472. );
  141473. PolylineVolumeGeometryUpdater.prototype.constructor = PolylineVolumeGeometryUpdater;
  141474. }
  141475. PolylineVolumeGeometryUpdater.prototype.createFillGeometryInstance = function(time) {
  141476. Check_default.defined("time", time);
  141477. if (!this._fillEnabled) {
  141478. throw new DeveloperError_default(
  141479. "This instance does not represent a filled geometry."
  141480. );
  141481. }
  141482. const entity = this._entity;
  141483. const isAvailable = entity.isAvailable(time);
  141484. let attributes;
  141485. let color;
  141486. const show = new ShowGeometryInstanceAttribute_default(
  141487. isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time)
  141488. );
  141489. const distanceDisplayCondition = this._distanceDisplayConditionProperty.getValue(
  141490. time
  141491. );
  141492. const distanceDisplayConditionAttribute = DistanceDisplayConditionGeometryInstanceAttribute_default.fromDistanceDisplayCondition(
  141493. distanceDisplayCondition
  141494. );
  141495. if (this._materialProperty instanceof ColorMaterialProperty_default) {
  141496. let currentColor;
  141497. if (defined_default(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) {
  141498. currentColor = this._materialProperty.color.getValue(time, scratchColor18);
  141499. }
  141500. if (!defined_default(currentColor)) {
  141501. currentColor = Color_default.WHITE;
  141502. }
  141503. color = ColorGeometryInstanceAttribute_default.fromColor(currentColor);
  141504. attributes = {
  141505. show,
  141506. distanceDisplayCondition: distanceDisplayConditionAttribute,
  141507. color
  141508. };
  141509. } else {
  141510. attributes = {
  141511. show,
  141512. distanceDisplayCondition: distanceDisplayConditionAttribute
  141513. };
  141514. }
  141515. return new GeometryInstance_default({
  141516. id: entity,
  141517. geometry: new PolylineVolumeGeometry_default(this._options),
  141518. attributes
  141519. });
  141520. };
  141521. PolylineVolumeGeometryUpdater.prototype.createOutlineGeometryInstance = function(time) {
  141522. Check_default.defined("time", time);
  141523. if (!this._outlineEnabled) {
  141524. throw new DeveloperError_default(
  141525. "This instance does not represent an outlined geometry."
  141526. );
  141527. }
  141528. const entity = this._entity;
  141529. const isAvailable = entity.isAvailable(time);
  141530. const outlineColor = Property_default.getValueOrDefault(
  141531. this._outlineColorProperty,
  141532. time,
  141533. Color_default.BLACK,
  141534. scratchColor18
  141535. );
  141536. const distanceDisplayCondition = this._distanceDisplayConditionProperty.getValue(
  141537. time
  141538. );
  141539. return new GeometryInstance_default({
  141540. id: entity,
  141541. geometry: new PolylineVolumeOutlineGeometry_default(this._options),
  141542. attributes: {
  141543. show: new ShowGeometryInstanceAttribute_default(
  141544. isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)
  141545. ),
  141546. color: ColorGeometryInstanceAttribute_default.fromColor(outlineColor),
  141547. distanceDisplayCondition: DistanceDisplayConditionGeometryInstanceAttribute_default.fromDistanceDisplayCondition(
  141548. distanceDisplayCondition
  141549. )
  141550. }
  141551. });
  141552. };
  141553. PolylineVolumeGeometryUpdater.prototype._isHidden = function(entity, polylineVolume) {
  141554. return !defined_default(polylineVolume.positions) || !defined_default(polylineVolume.shape) || GeometryUpdater_default.prototype._isHidden.call(this, entity, polylineVolume);
  141555. };
  141556. PolylineVolumeGeometryUpdater.prototype._isDynamic = function(entity, polylineVolume) {
  141557. return !polylineVolume.positions.isConstant || !polylineVolume.shape.isConstant || !Property_default.isConstant(polylineVolume.granularity) || !Property_default.isConstant(polylineVolume.outlineWidth) || !Property_default.isConstant(polylineVolume.cornerType);
  141558. };
  141559. PolylineVolumeGeometryUpdater.prototype._setStaticOptions = function(entity, polylineVolume) {
  141560. const granularity = polylineVolume.granularity;
  141561. const cornerType = polylineVolume.cornerType;
  141562. const options = this._options;
  141563. const isColorMaterial = this._materialProperty instanceof ColorMaterialProperty_default;
  141564. options.vertexFormat = isColorMaterial ? PerInstanceColorAppearance_default.VERTEX_FORMAT : MaterialAppearance_default.MaterialSupport.TEXTURED.vertexFormat;
  141565. options.polylinePositions = polylineVolume.positions.getValue(
  141566. Iso8601_default.MINIMUM_VALUE,
  141567. options.polylinePositions
  141568. );
  141569. options.shapePositions = polylineVolume.shape.getValue(
  141570. Iso8601_default.MINIMUM_VALUE,
  141571. options.shape
  141572. );
  141573. options.granularity = defined_default(granularity) ? granularity.getValue(Iso8601_default.MINIMUM_VALUE) : void 0;
  141574. options.cornerType = defined_default(cornerType) ? cornerType.getValue(Iso8601_default.MINIMUM_VALUE) : void 0;
  141575. };
  141576. PolylineVolumeGeometryUpdater.DynamicGeometryUpdater = DynamicPolylineVolumeGeometryUpdater;
  141577. function DynamicPolylineVolumeGeometryUpdater(geometryUpdater, primitives, groundPrimitives) {
  141578. DynamicGeometryUpdater_default.call(
  141579. this,
  141580. geometryUpdater,
  141581. primitives,
  141582. groundPrimitives
  141583. );
  141584. }
  141585. if (defined_default(Object.create)) {
  141586. DynamicPolylineVolumeGeometryUpdater.prototype = Object.create(
  141587. DynamicGeometryUpdater_default.prototype
  141588. );
  141589. DynamicPolylineVolumeGeometryUpdater.prototype.constructor = DynamicPolylineVolumeGeometryUpdater;
  141590. }
  141591. DynamicPolylineVolumeGeometryUpdater.prototype._isHidden = function(entity, polylineVolume, time) {
  141592. const options = this._options;
  141593. return !defined_default(options.polylinePositions) || !defined_default(options.shapePositions) || DynamicGeometryUpdater_default.prototype._isHidden.call(
  141594. this,
  141595. entity,
  141596. polylineVolume,
  141597. time
  141598. );
  141599. };
  141600. DynamicPolylineVolumeGeometryUpdater.prototype._setOptions = function(entity, polylineVolume, time) {
  141601. const options = this._options;
  141602. options.polylinePositions = Property_default.getValueOrUndefined(
  141603. polylineVolume.positions,
  141604. time,
  141605. options.polylinePositions
  141606. );
  141607. options.shapePositions = Property_default.getValueOrUndefined(
  141608. polylineVolume.shape,
  141609. time
  141610. );
  141611. options.granularity = Property_default.getValueOrUndefined(
  141612. polylineVolume.granularity,
  141613. time
  141614. );
  141615. options.cornerType = Property_default.getValueOrUndefined(
  141616. polylineVolume.cornerType,
  141617. time
  141618. );
  141619. };
  141620. var PolylineVolumeGeometryUpdater_default = PolylineVolumeGeometryUpdater;
  141621. // node_modules/cesium/Source/DataSources/RectangleGeometryUpdater.js
  141622. var scratchColor19 = new Color_default();
  141623. var defaultOffset8 = Cartesian3_default.ZERO;
  141624. var offsetScratch10 = new Cartesian3_default();
  141625. var scratchRectangle8 = new Rectangle_default();
  141626. var scratchCenterRect = new Rectangle_default();
  141627. var scratchCarto3 = new Cartographic_default();
  141628. function RectangleGeometryOptions(entity) {
  141629. this.id = entity;
  141630. this.vertexFormat = void 0;
  141631. this.rectangle = void 0;
  141632. this.height = void 0;
  141633. this.extrudedHeight = void 0;
  141634. this.granularity = void 0;
  141635. this.stRotation = void 0;
  141636. this.rotation = void 0;
  141637. this.offsetAttribute = void 0;
  141638. }
  141639. function RectangleGeometryUpdater(entity, scene) {
  141640. GroundGeometryUpdater_default.call(this, {
  141641. entity,
  141642. scene,
  141643. geometryOptions: new RectangleGeometryOptions(entity),
  141644. geometryPropertyName: "rectangle",
  141645. observedPropertyNames: ["availability", "rectangle"]
  141646. });
  141647. this._onEntityPropertyChanged(
  141648. entity,
  141649. "rectangle",
  141650. entity.rectangle,
  141651. void 0
  141652. );
  141653. }
  141654. if (defined_default(Object.create)) {
  141655. RectangleGeometryUpdater.prototype = Object.create(
  141656. GroundGeometryUpdater_default.prototype
  141657. );
  141658. RectangleGeometryUpdater.prototype.constructor = RectangleGeometryUpdater;
  141659. }
  141660. RectangleGeometryUpdater.prototype.createFillGeometryInstance = function(time) {
  141661. Check_default.defined("time", time);
  141662. if (!this._fillEnabled) {
  141663. throw new DeveloperError_default(
  141664. "This instance does not represent a filled geometry."
  141665. );
  141666. }
  141667. const entity = this._entity;
  141668. const isAvailable = entity.isAvailable(time);
  141669. const attributes = {
  141670. show: new ShowGeometryInstanceAttribute_default(
  141671. isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time)
  141672. ),
  141673. distanceDisplayCondition: DistanceDisplayConditionGeometryInstanceAttribute_default.fromDistanceDisplayCondition(
  141674. this._distanceDisplayConditionProperty.getValue(time)
  141675. ),
  141676. offset: void 0,
  141677. color: void 0
  141678. };
  141679. if (this._materialProperty instanceof ColorMaterialProperty_default) {
  141680. let currentColor;
  141681. if (defined_default(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) {
  141682. currentColor = this._materialProperty.color.getValue(time, scratchColor19);
  141683. }
  141684. if (!defined_default(currentColor)) {
  141685. currentColor = Color_default.WHITE;
  141686. }
  141687. attributes.color = ColorGeometryInstanceAttribute_default.fromColor(currentColor);
  141688. }
  141689. if (defined_default(this._options.offsetAttribute)) {
  141690. attributes.offset = OffsetGeometryInstanceAttribute_default.fromCartesian3(
  141691. Property_default.getValueOrDefault(
  141692. this._terrainOffsetProperty,
  141693. time,
  141694. defaultOffset8,
  141695. offsetScratch10
  141696. )
  141697. );
  141698. }
  141699. return new GeometryInstance_default({
  141700. id: entity,
  141701. geometry: new RectangleGeometry_default(this._options),
  141702. attributes
  141703. });
  141704. };
  141705. RectangleGeometryUpdater.prototype.createOutlineGeometryInstance = function(time) {
  141706. Check_default.defined("time", time);
  141707. if (!this._outlineEnabled) {
  141708. throw new DeveloperError_default(
  141709. "This instance does not represent an outlined geometry."
  141710. );
  141711. }
  141712. const entity = this._entity;
  141713. const isAvailable = entity.isAvailable(time);
  141714. const outlineColor = Property_default.getValueOrDefault(
  141715. this._outlineColorProperty,
  141716. time,
  141717. Color_default.BLACK,
  141718. scratchColor19
  141719. );
  141720. const distanceDisplayCondition = this._distanceDisplayConditionProperty.getValue(
  141721. time
  141722. );
  141723. const attributes = {
  141724. show: new ShowGeometryInstanceAttribute_default(
  141725. isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)
  141726. ),
  141727. color: ColorGeometryInstanceAttribute_default.fromColor(outlineColor),
  141728. distanceDisplayCondition: DistanceDisplayConditionGeometryInstanceAttribute_default.fromDistanceDisplayCondition(
  141729. distanceDisplayCondition
  141730. ),
  141731. offset: void 0
  141732. };
  141733. if (defined_default(this._options.offsetAttribute)) {
  141734. attributes.offset = OffsetGeometryInstanceAttribute_default.fromCartesian3(
  141735. Property_default.getValueOrDefault(
  141736. this._terrainOffsetProperty,
  141737. time,
  141738. defaultOffset8,
  141739. offsetScratch10
  141740. )
  141741. );
  141742. }
  141743. return new GeometryInstance_default({
  141744. id: entity,
  141745. geometry: new RectangleOutlineGeometry_default(this._options),
  141746. attributes
  141747. });
  141748. };
  141749. RectangleGeometryUpdater.prototype._computeCenter = function(time, result) {
  141750. const rect = Property_default.getValueOrUndefined(
  141751. this._entity.rectangle.coordinates,
  141752. time,
  141753. scratchCenterRect
  141754. );
  141755. if (!defined_default(rect)) {
  141756. return;
  141757. }
  141758. const center = Rectangle_default.center(rect, scratchCarto3);
  141759. return Cartographic_default.toCartesian(center, Ellipsoid_default.WGS84, result);
  141760. };
  141761. RectangleGeometryUpdater.prototype._isHidden = function(entity, rectangle) {
  141762. return !defined_default(rectangle.coordinates) || GeometryUpdater_default.prototype._isHidden.call(this, entity, rectangle);
  141763. };
  141764. RectangleGeometryUpdater.prototype._isDynamic = function(entity, rectangle) {
  141765. return !rectangle.coordinates.isConstant || !Property_default.isConstant(rectangle.height) || !Property_default.isConstant(rectangle.extrudedHeight) || !Property_default.isConstant(rectangle.granularity) || !Property_default.isConstant(rectangle.stRotation) || !Property_default.isConstant(rectangle.rotation) || !Property_default.isConstant(rectangle.outlineWidth) || !Property_default.isConstant(rectangle.zIndex) || this._onTerrain && !Property_default.isConstant(this._materialProperty) && !(this._materialProperty instanceof ColorMaterialProperty_default);
  141766. };
  141767. RectangleGeometryUpdater.prototype._setStaticOptions = function(entity, rectangle) {
  141768. const isColorMaterial = this._materialProperty instanceof ColorMaterialProperty_default;
  141769. let heightValue = Property_default.getValueOrUndefined(
  141770. rectangle.height,
  141771. Iso8601_default.MINIMUM_VALUE
  141772. );
  141773. const heightReferenceValue = Property_default.getValueOrDefault(
  141774. rectangle.heightReference,
  141775. Iso8601_default.MINIMUM_VALUE,
  141776. HeightReference_default.NONE
  141777. );
  141778. let extrudedHeightValue = Property_default.getValueOrUndefined(
  141779. rectangle.extrudedHeight,
  141780. Iso8601_default.MINIMUM_VALUE
  141781. );
  141782. const extrudedHeightReferenceValue = Property_default.getValueOrDefault(
  141783. rectangle.extrudedHeightReference,
  141784. Iso8601_default.MINIMUM_VALUE,
  141785. HeightReference_default.NONE
  141786. );
  141787. if (defined_default(extrudedHeightValue) && !defined_default(heightValue)) {
  141788. heightValue = 0;
  141789. }
  141790. const options = this._options;
  141791. options.vertexFormat = isColorMaterial ? PerInstanceColorAppearance_default.VERTEX_FORMAT : MaterialAppearance_default.MaterialSupport.TEXTURED.vertexFormat;
  141792. options.rectangle = rectangle.coordinates.getValue(
  141793. Iso8601_default.MINIMUM_VALUE,
  141794. options.rectangle
  141795. );
  141796. options.granularity = Property_default.getValueOrUndefined(
  141797. rectangle.granularity,
  141798. Iso8601_default.MINIMUM_VALUE
  141799. );
  141800. options.stRotation = Property_default.getValueOrUndefined(
  141801. rectangle.stRotation,
  141802. Iso8601_default.MINIMUM_VALUE
  141803. );
  141804. options.rotation = Property_default.getValueOrUndefined(
  141805. rectangle.rotation,
  141806. Iso8601_default.MINIMUM_VALUE
  141807. );
  141808. options.offsetAttribute = GroundGeometryUpdater_default.computeGeometryOffsetAttribute(
  141809. heightValue,
  141810. heightReferenceValue,
  141811. extrudedHeightValue,
  141812. extrudedHeightReferenceValue
  141813. );
  141814. options.height = GroundGeometryUpdater_default.getGeometryHeight(
  141815. heightValue,
  141816. heightReferenceValue
  141817. );
  141818. extrudedHeightValue = GroundGeometryUpdater_default.getGeometryExtrudedHeight(
  141819. extrudedHeightValue,
  141820. extrudedHeightReferenceValue
  141821. );
  141822. if (extrudedHeightValue === GroundGeometryUpdater_default.CLAMP_TO_GROUND) {
  141823. extrudedHeightValue = ApproximateTerrainHeights_default.getMinimumMaximumHeights(
  141824. RectangleGeometry_default.computeRectangle(options, scratchRectangle8)
  141825. ).minimumTerrainHeight;
  141826. }
  141827. options.extrudedHeight = extrudedHeightValue;
  141828. };
  141829. RectangleGeometryUpdater.DynamicGeometryUpdater = DynamicRectangleGeometryUpdater;
  141830. function DynamicRectangleGeometryUpdater(geometryUpdater, primitives, groundPrimitives) {
  141831. DynamicGeometryUpdater_default.call(
  141832. this,
  141833. geometryUpdater,
  141834. primitives,
  141835. groundPrimitives
  141836. );
  141837. }
  141838. if (defined_default(Object.create)) {
  141839. DynamicRectangleGeometryUpdater.prototype = Object.create(
  141840. DynamicGeometryUpdater_default.prototype
  141841. );
  141842. DynamicRectangleGeometryUpdater.prototype.constructor = DynamicRectangleGeometryUpdater;
  141843. }
  141844. DynamicRectangleGeometryUpdater.prototype._isHidden = function(entity, rectangle, time) {
  141845. return !defined_default(this._options.rectangle) || DynamicGeometryUpdater_default.prototype._isHidden.call(
  141846. this,
  141847. entity,
  141848. rectangle,
  141849. time
  141850. );
  141851. };
  141852. DynamicRectangleGeometryUpdater.prototype._setOptions = function(entity, rectangle, time) {
  141853. const options = this._options;
  141854. let heightValue = Property_default.getValueOrUndefined(rectangle.height, time);
  141855. const heightReferenceValue = Property_default.getValueOrDefault(
  141856. rectangle.heightReference,
  141857. time,
  141858. HeightReference_default.NONE
  141859. );
  141860. let extrudedHeightValue = Property_default.getValueOrUndefined(
  141861. rectangle.extrudedHeight,
  141862. time
  141863. );
  141864. const extrudedHeightReferenceValue = Property_default.getValueOrDefault(
  141865. rectangle.extrudedHeightReference,
  141866. time,
  141867. HeightReference_default.NONE
  141868. );
  141869. if (defined_default(extrudedHeightValue) && !defined_default(heightValue)) {
  141870. heightValue = 0;
  141871. }
  141872. options.rectangle = Property_default.getValueOrUndefined(
  141873. rectangle.coordinates,
  141874. time,
  141875. options.rectangle
  141876. );
  141877. options.granularity = Property_default.getValueOrUndefined(
  141878. rectangle.granularity,
  141879. time
  141880. );
  141881. options.stRotation = Property_default.getValueOrUndefined(rectangle.stRotation, time);
  141882. options.rotation = Property_default.getValueOrUndefined(rectangle.rotation, time);
  141883. options.offsetAttribute = GroundGeometryUpdater_default.computeGeometryOffsetAttribute(
  141884. heightValue,
  141885. heightReferenceValue,
  141886. extrudedHeightValue,
  141887. extrudedHeightReferenceValue
  141888. );
  141889. options.height = GroundGeometryUpdater_default.getGeometryHeight(
  141890. heightValue,
  141891. heightReferenceValue
  141892. );
  141893. extrudedHeightValue = GroundGeometryUpdater_default.getGeometryExtrudedHeight(
  141894. extrudedHeightValue,
  141895. extrudedHeightReferenceValue
  141896. );
  141897. if (extrudedHeightValue === GroundGeometryUpdater_default.CLAMP_TO_GROUND) {
  141898. extrudedHeightValue = ApproximateTerrainHeights_default.getMinimumMaximumHeights(
  141899. RectangleGeometry_default.computeRectangle(options, scratchRectangle8)
  141900. ).minimumTerrainHeight;
  141901. }
  141902. options.extrudedHeight = extrudedHeightValue;
  141903. };
  141904. var RectangleGeometryUpdater_default = RectangleGeometryUpdater;
  141905. // node_modules/cesium/Source/DataSources/StaticGeometryColorBatch.js
  141906. var colorScratch3 = new Color_default();
  141907. var distanceDisplayConditionScratch2 = new DistanceDisplayCondition_default();
  141908. var defaultDistanceDisplayCondition2 = new DistanceDisplayCondition_default();
  141909. var defaultOffset9 = Cartesian3_default.ZERO;
  141910. var offsetScratch11 = new Cartesian3_default();
  141911. function Batch(primitives, translucent, appearanceType, depthFailAppearanceType, depthFailMaterialProperty, closed, shadows) {
  141912. this.translucent = translucent;
  141913. this.appearanceType = appearanceType;
  141914. this.depthFailAppearanceType = depthFailAppearanceType;
  141915. this.depthFailMaterialProperty = depthFailMaterialProperty;
  141916. this.depthFailMaterial = void 0;
  141917. this.closed = closed;
  141918. this.shadows = shadows;
  141919. this.primitives = primitives;
  141920. this.createPrimitive = false;
  141921. this.waitingOnCreate = false;
  141922. this.primitive = void 0;
  141923. this.oldPrimitive = void 0;
  141924. this.geometry = new AssociativeArray_default();
  141925. this.updaters = new AssociativeArray_default();
  141926. this.updatersWithAttributes = new AssociativeArray_default();
  141927. this.attributes = new AssociativeArray_default();
  141928. this.subscriptions = new AssociativeArray_default();
  141929. this.showsUpdated = new AssociativeArray_default();
  141930. this.itemsToRemove = [];
  141931. this.invalidated = false;
  141932. let removeMaterialSubscription;
  141933. if (defined_default(depthFailMaterialProperty)) {
  141934. removeMaterialSubscription = depthFailMaterialProperty.definitionChanged.addEventListener(
  141935. Batch.prototype.onMaterialChanged,
  141936. this
  141937. );
  141938. }
  141939. this.removeMaterialSubscription = removeMaterialSubscription;
  141940. }
  141941. Batch.prototype.onMaterialChanged = function() {
  141942. this.invalidated = true;
  141943. };
  141944. Batch.prototype.isMaterial = function(updater) {
  141945. const material = this.depthFailMaterialProperty;
  141946. const updaterMaterial = updater.depthFailMaterialProperty;
  141947. if (updaterMaterial === material) {
  141948. return true;
  141949. }
  141950. if (defined_default(material)) {
  141951. return material.equals(updaterMaterial);
  141952. }
  141953. return false;
  141954. };
  141955. Batch.prototype.add = function(updater, instance) {
  141956. const id = updater.id;
  141957. this.createPrimitive = true;
  141958. this.geometry.set(id, instance);
  141959. this.updaters.set(id, updater);
  141960. if (!updater.hasConstantFill || !updater.fillMaterialProperty.isConstant || !Property_default.isConstant(updater.distanceDisplayConditionProperty) || !Property_default.isConstant(updater.terrainOffsetProperty)) {
  141961. this.updatersWithAttributes.set(id, updater);
  141962. } else {
  141963. const that = this;
  141964. this.subscriptions.set(
  141965. id,
  141966. updater.entity.definitionChanged.addEventListener(function(entity, propertyName, newValue, oldValue2) {
  141967. if (propertyName === "isShowing") {
  141968. that.showsUpdated.set(updater.id, updater);
  141969. }
  141970. })
  141971. );
  141972. }
  141973. };
  141974. Batch.prototype.remove = function(updater) {
  141975. const id = updater.id;
  141976. this.createPrimitive = this.geometry.remove(id) || this.createPrimitive;
  141977. if (this.updaters.remove(id)) {
  141978. this.updatersWithAttributes.remove(id);
  141979. const unsubscribe2 = this.subscriptions.get(id);
  141980. if (defined_default(unsubscribe2)) {
  141981. unsubscribe2();
  141982. this.subscriptions.remove(id);
  141983. this.showsUpdated.remove(id);
  141984. }
  141985. return true;
  141986. }
  141987. return false;
  141988. };
  141989. Batch.prototype.update = function(time) {
  141990. let isUpdated = true;
  141991. let removedCount = 0;
  141992. let primitive = this.primitive;
  141993. const primitives = this.primitives;
  141994. let i2;
  141995. if (this.createPrimitive) {
  141996. const geometries = this.geometry.values;
  141997. const geometriesLength = geometries.length;
  141998. if (geometriesLength > 0) {
  141999. if (defined_default(primitive)) {
  142000. if (!defined_default(this.oldPrimitive)) {
  142001. this.oldPrimitive = primitive;
  142002. } else {
  142003. primitives.remove(primitive);
  142004. }
  142005. }
  142006. let depthFailAppearance;
  142007. if (defined_default(this.depthFailAppearanceType)) {
  142008. if (defined_default(this.depthFailMaterialProperty)) {
  142009. this.depthFailMaterial = MaterialProperty_default.getValue(
  142010. time,
  142011. this.depthFailMaterialProperty,
  142012. this.depthFailMaterial
  142013. );
  142014. }
  142015. depthFailAppearance = new this.depthFailAppearanceType({
  142016. material: this.depthFailMaterial,
  142017. translucent: this.translucent,
  142018. closed: this.closed
  142019. });
  142020. }
  142021. primitive = new Primitive_default({
  142022. show: false,
  142023. asynchronous: true,
  142024. geometryInstances: geometries.slice(),
  142025. appearance: new this.appearanceType({
  142026. translucent: this.translucent,
  142027. closed: this.closed
  142028. }),
  142029. depthFailAppearance,
  142030. shadows: this.shadows
  142031. });
  142032. primitives.add(primitive);
  142033. isUpdated = false;
  142034. } else {
  142035. if (defined_default(primitive)) {
  142036. primitives.remove(primitive);
  142037. primitive = void 0;
  142038. }
  142039. const oldPrimitive = this.oldPrimitive;
  142040. if (defined_default(oldPrimitive)) {
  142041. primitives.remove(oldPrimitive);
  142042. this.oldPrimitive = void 0;
  142043. }
  142044. }
  142045. this.attributes.removeAll();
  142046. this.primitive = primitive;
  142047. this.createPrimitive = false;
  142048. this.waitingOnCreate = true;
  142049. } else if (defined_default(primitive) && primitive.ready) {
  142050. primitive.show = true;
  142051. if (defined_default(this.oldPrimitive)) {
  142052. primitives.remove(this.oldPrimitive);
  142053. this.oldPrimitive = void 0;
  142054. }
  142055. if (defined_default(this.depthFailAppearanceType) && !(this.depthFailMaterialProperty instanceof ColorMaterialProperty_default)) {
  142056. this.depthFailMaterial = MaterialProperty_default.getValue(
  142057. time,
  142058. this.depthFailMaterialProperty,
  142059. this.depthFailMaterial
  142060. );
  142061. this.primitive.depthFailAppearance.material = this.depthFailMaterial;
  142062. }
  142063. const updatersWithAttributes = this.updatersWithAttributes.values;
  142064. const length3 = updatersWithAttributes.length;
  142065. const waitingOnCreate = this.waitingOnCreate;
  142066. for (i2 = 0; i2 < length3; i2++) {
  142067. const updater = updatersWithAttributes[i2];
  142068. const instance = this.geometry.get(updater.id);
  142069. let attributes = this.attributes.get(instance.id.id);
  142070. if (!defined_default(attributes)) {
  142071. attributes = primitive.getGeometryInstanceAttributes(instance.id);
  142072. this.attributes.set(instance.id.id, attributes);
  142073. }
  142074. if (!updater.fillMaterialProperty.isConstant || waitingOnCreate) {
  142075. const colorProperty = updater.fillMaterialProperty.color;
  142076. const resultColor = Property_default.getValueOrDefault(
  142077. colorProperty,
  142078. time,
  142079. Color_default.WHITE,
  142080. colorScratch3
  142081. );
  142082. if (!Color_default.equals(attributes._lastColor, resultColor)) {
  142083. attributes._lastColor = Color_default.clone(
  142084. resultColor,
  142085. attributes._lastColor
  142086. );
  142087. attributes.color = ColorGeometryInstanceAttribute_default.toValue(
  142088. resultColor,
  142089. attributes.color
  142090. );
  142091. if (this.translucent && attributes.color[3] === 255 || !this.translucent && attributes.color[3] !== 255) {
  142092. this.itemsToRemove[removedCount++] = updater;
  142093. }
  142094. }
  142095. }
  142096. if (defined_default(this.depthFailAppearanceType) && updater.depthFailMaterialProperty instanceof ColorMaterialProperty_default && (!updater.depthFailMaterialProperty.isConstant || waitingOnCreate)) {
  142097. const depthFailColorProperty = updater.depthFailMaterialProperty.color;
  142098. const depthColor = Property_default.getValueOrDefault(
  142099. depthFailColorProperty,
  142100. time,
  142101. Color_default.WHITE,
  142102. colorScratch3
  142103. );
  142104. if (!Color_default.equals(attributes._lastDepthFailColor, depthColor)) {
  142105. attributes._lastDepthFailColor = Color_default.clone(
  142106. depthColor,
  142107. attributes._lastDepthFailColor
  142108. );
  142109. attributes.depthFailColor = ColorGeometryInstanceAttribute_default.toValue(
  142110. depthColor,
  142111. attributes.depthFailColor
  142112. );
  142113. }
  142114. }
  142115. const show = updater.entity.isShowing && (updater.hasConstantFill || updater.isFilled(time));
  142116. const currentShow = attributes.show[0] === 1;
  142117. if (show !== currentShow) {
  142118. attributes.show = ShowGeometryInstanceAttribute_default.toValue(
  142119. show,
  142120. attributes.show
  142121. );
  142122. }
  142123. const distanceDisplayConditionProperty = updater.distanceDisplayConditionProperty;
  142124. if (!Property_default.isConstant(distanceDisplayConditionProperty)) {
  142125. const distanceDisplayCondition = Property_default.getValueOrDefault(
  142126. distanceDisplayConditionProperty,
  142127. time,
  142128. defaultDistanceDisplayCondition2,
  142129. distanceDisplayConditionScratch2
  142130. );
  142131. if (!DistanceDisplayCondition_default.equals(
  142132. distanceDisplayCondition,
  142133. attributes._lastDistanceDisplayCondition
  142134. )) {
  142135. attributes._lastDistanceDisplayCondition = DistanceDisplayCondition_default.clone(
  142136. distanceDisplayCondition,
  142137. attributes._lastDistanceDisplayCondition
  142138. );
  142139. attributes.distanceDisplayCondition = DistanceDisplayConditionGeometryInstanceAttribute_default.toValue(
  142140. distanceDisplayCondition,
  142141. attributes.distanceDisplayCondition
  142142. );
  142143. }
  142144. }
  142145. const offsetProperty = updater.terrainOffsetProperty;
  142146. if (!Property_default.isConstant(offsetProperty)) {
  142147. const offset2 = Property_default.getValueOrDefault(
  142148. offsetProperty,
  142149. time,
  142150. defaultOffset9,
  142151. offsetScratch11
  142152. );
  142153. if (!Cartesian3_default.equals(offset2, attributes._lastOffset)) {
  142154. attributes._lastOffset = Cartesian3_default.clone(
  142155. offset2,
  142156. attributes._lastOffset
  142157. );
  142158. attributes.offset = OffsetGeometryInstanceAttribute_default.toValue(
  142159. offset2,
  142160. attributes.offset
  142161. );
  142162. }
  142163. }
  142164. }
  142165. this.updateShows(primitive);
  142166. this.waitingOnCreate = false;
  142167. } else if (defined_default(primitive) && !primitive.ready) {
  142168. isUpdated = false;
  142169. }
  142170. this.itemsToRemove.length = removedCount;
  142171. return isUpdated;
  142172. };
  142173. Batch.prototype.updateShows = function(primitive) {
  142174. const showsUpdated = this.showsUpdated.values;
  142175. const length3 = showsUpdated.length;
  142176. for (let i2 = 0; i2 < length3; i2++) {
  142177. const updater = showsUpdated[i2];
  142178. const instance = this.geometry.get(updater.id);
  142179. let attributes = this.attributes.get(instance.id.id);
  142180. if (!defined_default(attributes)) {
  142181. attributes = primitive.getGeometryInstanceAttributes(instance.id);
  142182. this.attributes.set(instance.id.id, attributes);
  142183. }
  142184. const show = updater.entity.isShowing;
  142185. const currentShow = attributes.show[0] === 1;
  142186. if (show !== currentShow) {
  142187. attributes.show = ShowGeometryInstanceAttribute_default.toValue(
  142188. show,
  142189. attributes.show
  142190. );
  142191. instance.attributes.show.value[0] = attributes.show[0];
  142192. }
  142193. }
  142194. this.showsUpdated.removeAll();
  142195. };
  142196. Batch.prototype.contains = function(updater) {
  142197. return this.updaters.contains(updater.id);
  142198. };
  142199. Batch.prototype.getBoundingSphere = function(updater, result) {
  142200. const primitive = this.primitive;
  142201. if (!primitive.ready) {
  142202. return BoundingSphereState_default.PENDING;
  142203. }
  142204. const attributes = primitive.getGeometryInstanceAttributes(updater.entity);
  142205. if (!defined_default(attributes) || !defined_default(attributes.boundingSphere) || defined_default(attributes.show) && attributes.show[0] === 0) {
  142206. return BoundingSphereState_default.FAILED;
  142207. }
  142208. attributes.boundingSphere.clone(result);
  142209. return BoundingSphereState_default.DONE;
  142210. };
  142211. Batch.prototype.destroy = function() {
  142212. const primitive = this.primitive;
  142213. const primitives = this.primitives;
  142214. if (defined_default(primitive)) {
  142215. primitives.remove(primitive);
  142216. }
  142217. const oldPrimitive = this.oldPrimitive;
  142218. if (defined_default(oldPrimitive)) {
  142219. primitives.remove(oldPrimitive);
  142220. }
  142221. if (defined_default(this.removeMaterialSubscription)) {
  142222. this.removeMaterialSubscription();
  142223. }
  142224. };
  142225. function StaticGeometryColorBatch(primitives, appearanceType, depthFailAppearanceType, closed, shadows) {
  142226. this._solidItems = [];
  142227. this._translucentItems = [];
  142228. this._primitives = primitives;
  142229. this._appearanceType = appearanceType;
  142230. this._depthFailAppearanceType = depthFailAppearanceType;
  142231. this._closed = closed;
  142232. this._shadows = shadows;
  142233. }
  142234. StaticGeometryColorBatch.prototype.add = function(time, updater) {
  142235. let items;
  142236. let translucent;
  142237. const instance = updater.createFillGeometryInstance(time);
  142238. if (instance.attributes.color.value[3] === 255) {
  142239. items = this._solidItems;
  142240. translucent = false;
  142241. } else {
  142242. items = this._translucentItems;
  142243. translucent = true;
  142244. }
  142245. const length3 = items.length;
  142246. for (let i2 = 0; i2 < length3; i2++) {
  142247. const item = items[i2];
  142248. if (item.isMaterial(updater)) {
  142249. item.add(updater, instance);
  142250. return;
  142251. }
  142252. }
  142253. const batch = new Batch(
  142254. this._primitives,
  142255. translucent,
  142256. this._appearanceType,
  142257. this._depthFailAppearanceType,
  142258. updater.depthFailMaterialProperty,
  142259. this._closed,
  142260. this._shadows
  142261. );
  142262. batch.add(updater, instance);
  142263. items.push(batch);
  142264. };
  142265. function removeItem(items, updater) {
  142266. const length3 = items.length;
  142267. for (let i2 = length3 - 1; i2 >= 0; i2--) {
  142268. const item = items[i2];
  142269. if (item.remove(updater)) {
  142270. if (item.updaters.length === 0) {
  142271. items.splice(i2, 1);
  142272. item.destroy();
  142273. }
  142274. return true;
  142275. }
  142276. }
  142277. return false;
  142278. }
  142279. StaticGeometryColorBatch.prototype.remove = function(updater) {
  142280. if (!removeItem(this._solidItems, updater)) {
  142281. removeItem(this._translucentItems, updater);
  142282. }
  142283. };
  142284. function moveItems(batch, items, time) {
  142285. let itemsMoved = false;
  142286. const length3 = items.length;
  142287. for (let i2 = 0; i2 < length3; ++i2) {
  142288. const item = items[i2];
  142289. const itemsToRemove = item.itemsToRemove;
  142290. const itemsToMoveLength = itemsToRemove.length;
  142291. if (itemsToMoveLength > 0) {
  142292. for (i2 = 0; i2 < itemsToMoveLength; i2++) {
  142293. const updater = itemsToRemove[i2];
  142294. item.remove(updater);
  142295. batch.add(time, updater);
  142296. itemsMoved = true;
  142297. }
  142298. }
  142299. }
  142300. return itemsMoved;
  142301. }
  142302. function updateItems(batch, items, time, isUpdated) {
  142303. let length3 = items.length;
  142304. let i2;
  142305. for (i2 = length3 - 1; i2 >= 0; i2--) {
  142306. const item = items[i2];
  142307. if (item.invalidated) {
  142308. items.splice(i2, 1);
  142309. const updaters = item.updaters.values;
  142310. const updatersLength = updaters.length;
  142311. for (let h = 0; h < updatersLength; h++) {
  142312. batch.add(time, updaters[h]);
  142313. }
  142314. item.destroy();
  142315. }
  142316. }
  142317. length3 = items.length;
  142318. for (i2 = 0; i2 < length3; ++i2) {
  142319. isUpdated = items[i2].update(time) && isUpdated;
  142320. }
  142321. return isUpdated;
  142322. }
  142323. StaticGeometryColorBatch.prototype.update = function(time) {
  142324. let isUpdated = updateItems(this, this._solidItems, time, true);
  142325. isUpdated = updateItems(this, this._translucentItems, time, isUpdated) && isUpdated;
  142326. const solidsMoved = moveItems(this, this._solidItems, time);
  142327. const translucentsMoved = moveItems(this, this._translucentItems, time);
  142328. if (solidsMoved || translucentsMoved) {
  142329. isUpdated = updateItems(this, this._solidItems, time, isUpdated) && isUpdated;
  142330. isUpdated = updateItems(this, this._translucentItems, time, isUpdated) && isUpdated;
  142331. }
  142332. return isUpdated;
  142333. };
  142334. function getBoundingSphere(items, updater, result) {
  142335. const length3 = items.length;
  142336. for (let i2 = 0; i2 < length3; i2++) {
  142337. const item = items[i2];
  142338. if (item.contains(updater)) {
  142339. return item.getBoundingSphere(updater, result);
  142340. }
  142341. }
  142342. return BoundingSphereState_default.FAILED;
  142343. }
  142344. StaticGeometryColorBatch.prototype.getBoundingSphere = function(updater, result) {
  142345. const boundingSphere = getBoundingSphere(this._solidItems, updater, result);
  142346. if (boundingSphere === BoundingSphereState_default.FAILED) {
  142347. return getBoundingSphere(this._translucentItems, updater, result);
  142348. }
  142349. return boundingSphere;
  142350. };
  142351. function removeAllPrimitives(items) {
  142352. const length3 = items.length;
  142353. for (let i2 = 0; i2 < length3; i2++) {
  142354. items[i2].destroy();
  142355. }
  142356. items.length = 0;
  142357. }
  142358. StaticGeometryColorBatch.prototype.removeAllPrimitives = function() {
  142359. removeAllPrimitives(this._solidItems);
  142360. removeAllPrimitives(this._translucentItems);
  142361. };
  142362. var StaticGeometryColorBatch_default = StaticGeometryColorBatch;
  142363. // node_modules/cesium/Source/DataSources/StaticGeometryPerMaterialBatch.js
  142364. var distanceDisplayConditionScratch3 = new DistanceDisplayCondition_default();
  142365. var defaultDistanceDisplayCondition3 = new DistanceDisplayCondition_default();
  142366. var defaultOffset10 = Cartesian3_default.ZERO;
  142367. var offsetScratch12 = new Cartesian3_default();
  142368. function Batch2(primitives, appearanceType, materialProperty, depthFailAppearanceType, depthFailMaterialProperty, closed, shadows) {
  142369. this.primitives = primitives;
  142370. this.appearanceType = appearanceType;
  142371. this.materialProperty = materialProperty;
  142372. this.depthFailAppearanceType = depthFailAppearanceType;
  142373. this.depthFailMaterialProperty = depthFailMaterialProperty;
  142374. this.closed = closed;
  142375. this.shadows = shadows;
  142376. this.updaters = new AssociativeArray_default();
  142377. this.createPrimitive = true;
  142378. this.primitive = void 0;
  142379. this.oldPrimitive = void 0;
  142380. this.geometry = new AssociativeArray_default();
  142381. this.material = void 0;
  142382. this.depthFailMaterial = void 0;
  142383. this.updatersWithAttributes = new AssociativeArray_default();
  142384. this.attributes = new AssociativeArray_default();
  142385. this.invalidated = false;
  142386. this.removeMaterialSubscription = materialProperty.definitionChanged.addEventListener(
  142387. Batch2.prototype.onMaterialChanged,
  142388. this
  142389. );
  142390. this.subscriptions = new AssociativeArray_default();
  142391. this.showsUpdated = new AssociativeArray_default();
  142392. }
  142393. Batch2.prototype.onMaterialChanged = function() {
  142394. this.invalidated = true;
  142395. };
  142396. Batch2.prototype.isMaterial = function(updater) {
  142397. const material = this.materialProperty;
  142398. const updaterMaterial = updater.fillMaterialProperty;
  142399. const depthFailMaterial = this.depthFailMaterialProperty;
  142400. const updaterDepthFailMaterial = updater.depthFailMaterialProperty;
  142401. if (updaterMaterial === material && updaterDepthFailMaterial === depthFailMaterial) {
  142402. return true;
  142403. }
  142404. let equals2 = defined_default(material) && material.equals(updaterMaterial);
  142405. equals2 = (!defined_default(depthFailMaterial) && !defined_default(updaterDepthFailMaterial) || defined_default(depthFailMaterial) && depthFailMaterial.equals(updaterDepthFailMaterial)) && equals2;
  142406. return equals2;
  142407. };
  142408. Batch2.prototype.add = function(time, updater) {
  142409. const id = updater.id;
  142410. this.updaters.set(id, updater);
  142411. this.geometry.set(id, updater.createFillGeometryInstance(time));
  142412. if (!updater.hasConstantFill || !updater.fillMaterialProperty.isConstant || !Property_default.isConstant(updater.distanceDisplayConditionProperty) || !Property_default.isConstant(updater.terrainOffsetProperty)) {
  142413. this.updatersWithAttributes.set(id, updater);
  142414. } else {
  142415. const that = this;
  142416. this.subscriptions.set(
  142417. id,
  142418. updater.entity.definitionChanged.addEventListener(function(entity, propertyName, newValue, oldValue2) {
  142419. if (propertyName === "isShowing") {
  142420. that.showsUpdated.set(updater.id, updater);
  142421. }
  142422. })
  142423. );
  142424. }
  142425. this.createPrimitive = true;
  142426. };
  142427. Batch2.prototype.remove = function(updater) {
  142428. const id = updater.id;
  142429. this.createPrimitive = this.geometry.remove(id) || this.createPrimitive;
  142430. if (this.updaters.remove(id)) {
  142431. this.updatersWithAttributes.remove(id);
  142432. const unsubscribe2 = this.subscriptions.get(id);
  142433. if (defined_default(unsubscribe2)) {
  142434. unsubscribe2();
  142435. this.subscriptions.remove(id);
  142436. this.showsUpdated.remove(id);
  142437. }
  142438. return true;
  142439. }
  142440. return false;
  142441. };
  142442. var colorScratch4 = new Color_default();
  142443. Batch2.prototype.update = function(time) {
  142444. let isUpdated = true;
  142445. let primitive = this.primitive;
  142446. const primitives = this.primitives;
  142447. const geometries = this.geometry.values;
  142448. let i2;
  142449. if (this.createPrimitive) {
  142450. const geometriesLength = geometries.length;
  142451. if (geometriesLength > 0) {
  142452. if (defined_default(primitive)) {
  142453. if (!defined_default(this.oldPrimitive)) {
  142454. this.oldPrimitive = primitive;
  142455. } else {
  142456. primitives.remove(primitive);
  142457. }
  142458. }
  142459. this.material = MaterialProperty_default.getValue(
  142460. time,
  142461. this.materialProperty,
  142462. this.material
  142463. );
  142464. let depthFailAppearance;
  142465. if (defined_default(this.depthFailMaterialProperty)) {
  142466. this.depthFailMaterial = MaterialProperty_default.getValue(
  142467. time,
  142468. this.depthFailMaterialProperty,
  142469. this.depthFailMaterial
  142470. );
  142471. depthFailAppearance = new this.depthFailAppearanceType({
  142472. material: this.depthFailMaterial,
  142473. translucent: this.depthFailMaterial.isTranslucent(),
  142474. closed: this.closed
  142475. });
  142476. }
  142477. primitive = new Primitive_default({
  142478. show: false,
  142479. asynchronous: true,
  142480. geometryInstances: geometries.slice(),
  142481. appearance: new this.appearanceType({
  142482. material: this.material,
  142483. translucent: this.material.isTranslucent(),
  142484. closed: this.closed
  142485. }),
  142486. depthFailAppearance,
  142487. shadows: this.shadows
  142488. });
  142489. primitives.add(primitive);
  142490. isUpdated = false;
  142491. } else {
  142492. if (defined_default(primitive)) {
  142493. primitives.remove(primitive);
  142494. primitive = void 0;
  142495. }
  142496. const oldPrimitive = this.oldPrimitive;
  142497. if (defined_default(oldPrimitive)) {
  142498. primitives.remove(oldPrimitive);
  142499. this.oldPrimitive = void 0;
  142500. }
  142501. }
  142502. this.attributes.removeAll();
  142503. this.primitive = primitive;
  142504. this.createPrimitive = false;
  142505. } else if (defined_default(primitive) && primitive.ready) {
  142506. primitive.show = true;
  142507. if (defined_default(this.oldPrimitive)) {
  142508. primitives.remove(this.oldPrimitive);
  142509. this.oldPrimitive = void 0;
  142510. }
  142511. this.material = MaterialProperty_default.getValue(
  142512. time,
  142513. this.materialProperty,
  142514. this.material
  142515. );
  142516. this.primitive.appearance.material = this.material;
  142517. if (defined_default(this.depthFailAppearanceType) && !(this.depthFailMaterialProperty instanceof ColorMaterialProperty_default)) {
  142518. this.depthFailMaterial = MaterialProperty_default.getValue(
  142519. time,
  142520. this.depthFailMaterialProperty,
  142521. this.depthFailMaterial
  142522. );
  142523. this.primitive.depthFailAppearance.material = this.depthFailMaterial;
  142524. }
  142525. const updatersWithAttributes = this.updatersWithAttributes.values;
  142526. const length3 = updatersWithAttributes.length;
  142527. for (i2 = 0; i2 < length3; i2++) {
  142528. const updater = updatersWithAttributes[i2];
  142529. const entity = updater.entity;
  142530. const instance = this.geometry.get(updater.id);
  142531. let attributes = this.attributes.get(instance.id.id);
  142532. if (!defined_default(attributes)) {
  142533. attributes = primitive.getGeometryInstanceAttributes(instance.id);
  142534. this.attributes.set(instance.id.id, attributes);
  142535. }
  142536. if (defined_default(this.depthFailAppearanceType) && this.depthFailMaterialProperty instanceof ColorMaterialProperty_default && !updater.depthFailMaterialProperty.isConstant) {
  142537. const depthFailColorProperty = updater.depthFailMaterialProperty.color;
  142538. const depthFailColor = Property_default.getValueOrDefault(
  142539. depthFailColorProperty,
  142540. time,
  142541. Color_default.WHITE,
  142542. colorScratch4
  142543. );
  142544. if (!Color_default.equals(attributes._lastDepthFailColor, depthFailColor)) {
  142545. attributes._lastDepthFailColor = Color_default.clone(
  142546. depthFailColor,
  142547. attributes._lastDepthFailColor
  142548. );
  142549. attributes.depthFailColor = ColorGeometryInstanceAttribute_default.toValue(
  142550. depthFailColor,
  142551. attributes.depthFailColor
  142552. );
  142553. }
  142554. }
  142555. const show = entity.isShowing && (updater.hasConstantFill || updater.isFilled(time));
  142556. const currentShow = attributes.show[0] === 1;
  142557. if (show !== currentShow) {
  142558. attributes.show = ShowGeometryInstanceAttribute_default.toValue(
  142559. show,
  142560. attributes.show
  142561. );
  142562. }
  142563. const distanceDisplayConditionProperty = updater.distanceDisplayConditionProperty;
  142564. if (!Property_default.isConstant(distanceDisplayConditionProperty)) {
  142565. const distanceDisplayCondition = Property_default.getValueOrDefault(
  142566. distanceDisplayConditionProperty,
  142567. time,
  142568. defaultDistanceDisplayCondition3,
  142569. distanceDisplayConditionScratch3
  142570. );
  142571. if (!DistanceDisplayCondition_default.equals(
  142572. distanceDisplayCondition,
  142573. attributes._lastDistanceDisplayCondition
  142574. )) {
  142575. attributes._lastDistanceDisplayCondition = DistanceDisplayCondition_default.clone(
  142576. distanceDisplayCondition,
  142577. attributes._lastDistanceDisplayCondition
  142578. );
  142579. attributes.distanceDisplayCondition = DistanceDisplayConditionGeometryInstanceAttribute_default.toValue(
  142580. distanceDisplayCondition,
  142581. attributes.distanceDisplayCondition
  142582. );
  142583. }
  142584. }
  142585. const offsetProperty = updater.terrainOffsetProperty;
  142586. if (!Property_default.isConstant(offsetProperty)) {
  142587. const offset2 = Property_default.getValueOrDefault(
  142588. offsetProperty,
  142589. time,
  142590. defaultOffset10,
  142591. offsetScratch12
  142592. );
  142593. if (!Cartesian3_default.equals(offset2, attributes._lastOffset)) {
  142594. attributes._lastOffset = Cartesian3_default.clone(
  142595. offset2,
  142596. attributes._lastOffset
  142597. );
  142598. attributes.offset = OffsetGeometryInstanceAttribute_default.toValue(
  142599. offset2,
  142600. attributes.offset
  142601. );
  142602. }
  142603. }
  142604. }
  142605. this.updateShows(primitive);
  142606. } else if (defined_default(primitive) && !primitive.ready) {
  142607. isUpdated = false;
  142608. }
  142609. return isUpdated;
  142610. };
  142611. Batch2.prototype.updateShows = function(primitive) {
  142612. const showsUpdated = this.showsUpdated.values;
  142613. const length3 = showsUpdated.length;
  142614. for (let i2 = 0; i2 < length3; i2++) {
  142615. const updater = showsUpdated[i2];
  142616. const entity = updater.entity;
  142617. const instance = this.geometry.get(updater.id);
  142618. let attributes = this.attributes.get(instance.id.id);
  142619. if (!defined_default(attributes)) {
  142620. attributes = primitive.getGeometryInstanceAttributes(instance.id);
  142621. this.attributes.set(instance.id.id, attributes);
  142622. }
  142623. const show = entity.isShowing;
  142624. const currentShow = attributes.show[0] === 1;
  142625. if (show !== currentShow) {
  142626. attributes.show = ShowGeometryInstanceAttribute_default.toValue(
  142627. show,
  142628. attributes.show
  142629. );
  142630. instance.attributes.show.value[0] = attributes.show[0];
  142631. }
  142632. }
  142633. this.showsUpdated.removeAll();
  142634. };
  142635. Batch2.prototype.contains = function(updater) {
  142636. return this.updaters.contains(updater.id);
  142637. };
  142638. Batch2.prototype.getBoundingSphere = function(updater, result) {
  142639. const primitive = this.primitive;
  142640. if (!primitive.ready) {
  142641. return BoundingSphereState_default.PENDING;
  142642. }
  142643. const attributes = primitive.getGeometryInstanceAttributes(updater.entity);
  142644. if (!defined_default(attributes) || !defined_default(attributes.boundingSphere) || defined_default(attributes.show) && attributes.show[0] === 0) {
  142645. return BoundingSphereState_default.FAILED;
  142646. }
  142647. attributes.boundingSphere.clone(result);
  142648. return BoundingSphereState_default.DONE;
  142649. };
  142650. Batch2.prototype.destroy = function() {
  142651. const primitive = this.primitive;
  142652. const primitives = this.primitives;
  142653. if (defined_default(primitive)) {
  142654. primitives.remove(primitive);
  142655. }
  142656. const oldPrimitive = this.oldPrimitive;
  142657. if (defined_default(oldPrimitive)) {
  142658. primitives.remove(oldPrimitive);
  142659. }
  142660. this.removeMaterialSubscription();
  142661. };
  142662. function StaticGeometryPerMaterialBatch(primitives, appearanceType, depthFailAppearanceType, closed, shadows) {
  142663. this._items = [];
  142664. this._primitives = primitives;
  142665. this._appearanceType = appearanceType;
  142666. this._depthFailAppearanceType = depthFailAppearanceType;
  142667. this._closed = closed;
  142668. this._shadows = shadows;
  142669. }
  142670. StaticGeometryPerMaterialBatch.prototype.add = function(time, updater) {
  142671. const items = this._items;
  142672. const length3 = items.length;
  142673. for (let i2 = 0; i2 < length3; i2++) {
  142674. const item = items[i2];
  142675. if (item.isMaterial(updater)) {
  142676. item.add(time, updater);
  142677. return;
  142678. }
  142679. }
  142680. const batch = new Batch2(
  142681. this._primitives,
  142682. this._appearanceType,
  142683. updater.fillMaterialProperty,
  142684. this._depthFailAppearanceType,
  142685. updater.depthFailMaterialProperty,
  142686. this._closed,
  142687. this._shadows
  142688. );
  142689. batch.add(time, updater);
  142690. items.push(batch);
  142691. };
  142692. StaticGeometryPerMaterialBatch.prototype.remove = function(updater) {
  142693. const items = this._items;
  142694. const length3 = items.length;
  142695. for (let i2 = length3 - 1; i2 >= 0; i2--) {
  142696. const item = items[i2];
  142697. if (item.remove(updater)) {
  142698. if (item.updaters.length === 0) {
  142699. items.splice(i2, 1);
  142700. item.destroy();
  142701. }
  142702. break;
  142703. }
  142704. }
  142705. };
  142706. StaticGeometryPerMaterialBatch.prototype.update = function(time) {
  142707. let i2;
  142708. const items = this._items;
  142709. const length3 = items.length;
  142710. for (i2 = length3 - 1; i2 >= 0; i2--) {
  142711. const item = items[i2];
  142712. if (item.invalidated) {
  142713. items.splice(i2, 1);
  142714. const updaters = item.updaters.values;
  142715. const updatersLength = updaters.length;
  142716. for (let h = 0; h < updatersLength; h++) {
  142717. this.add(time, updaters[h]);
  142718. }
  142719. item.destroy();
  142720. }
  142721. }
  142722. let isUpdated = true;
  142723. for (i2 = 0; i2 < items.length; i2++) {
  142724. isUpdated = items[i2].update(time) && isUpdated;
  142725. }
  142726. return isUpdated;
  142727. };
  142728. StaticGeometryPerMaterialBatch.prototype.getBoundingSphere = function(updater, result) {
  142729. const items = this._items;
  142730. const length3 = items.length;
  142731. for (let i2 = 0; i2 < length3; i2++) {
  142732. const item = items[i2];
  142733. if (item.contains(updater)) {
  142734. return item.getBoundingSphere(updater, result);
  142735. }
  142736. }
  142737. return BoundingSphereState_default.FAILED;
  142738. };
  142739. StaticGeometryPerMaterialBatch.prototype.removeAllPrimitives = function() {
  142740. const items = this._items;
  142741. const length3 = items.length;
  142742. for (let i2 = 0; i2 < length3; i2++) {
  142743. items[i2].destroy();
  142744. }
  142745. this._items.length = 0;
  142746. };
  142747. var StaticGeometryPerMaterialBatch_default = StaticGeometryPerMaterialBatch;
  142748. // node_modules/cesium/Source/DataSources/StaticGroundGeometryColorBatch.js
  142749. var colorScratch5 = new Color_default();
  142750. var distanceDisplayConditionScratch4 = new DistanceDisplayCondition_default();
  142751. var defaultDistanceDisplayCondition4 = new DistanceDisplayCondition_default();
  142752. function Batch3(primitives, classificationType, color, zIndex) {
  142753. this.primitives = primitives;
  142754. this.zIndex = zIndex;
  142755. this.classificationType = classificationType;
  142756. this.color = color;
  142757. this.createPrimitive = false;
  142758. this.waitingOnCreate = false;
  142759. this.primitive = void 0;
  142760. this.oldPrimitive = void 0;
  142761. this.geometry = new AssociativeArray_default();
  142762. this.updaters = new AssociativeArray_default();
  142763. this.updatersWithAttributes = new AssociativeArray_default();
  142764. this.attributes = new AssociativeArray_default();
  142765. this.subscriptions = new AssociativeArray_default();
  142766. this.showsUpdated = new AssociativeArray_default();
  142767. this.itemsToRemove = [];
  142768. this.isDirty = false;
  142769. this.rectangleCollisionCheck = new RectangleCollisionChecker_default();
  142770. }
  142771. Batch3.prototype.overlapping = function(rectangle) {
  142772. return this.rectangleCollisionCheck.collides(rectangle);
  142773. };
  142774. Batch3.prototype.add = function(updater, instance) {
  142775. const id = updater.id;
  142776. this.createPrimitive = true;
  142777. this.geometry.set(id, instance);
  142778. this.updaters.set(id, updater);
  142779. this.rectangleCollisionCheck.insert(id, instance.geometry.rectangle);
  142780. if (!updater.hasConstantFill || !updater.fillMaterialProperty.isConstant || !Property_default.isConstant(updater.distanceDisplayConditionProperty)) {
  142781. this.updatersWithAttributes.set(id, updater);
  142782. } else {
  142783. const that = this;
  142784. this.subscriptions.set(
  142785. id,
  142786. updater.entity.definitionChanged.addEventListener(function(entity, propertyName, newValue, oldValue2) {
  142787. if (propertyName === "isShowing") {
  142788. that.showsUpdated.set(updater.id, updater);
  142789. }
  142790. })
  142791. );
  142792. }
  142793. };
  142794. Batch3.prototype.remove = function(updater) {
  142795. const id = updater.id;
  142796. const geometryInstance = this.geometry.get(id);
  142797. this.createPrimitive = this.geometry.remove(id) || this.createPrimitive;
  142798. if (this.updaters.remove(id)) {
  142799. this.rectangleCollisionCheck.remove(
  142800. id,
  142801. geometryInstance.geometry.rectangle
  142802. );
  142803. this.updatersWithAttributes.remove(id);
  142804. const unsubscribe2 = this.subscriptions.get(id);
  142805. if (defined_default(unsubscribe2)) {
  142806. unsubscribe2();
  142807. this.subscriptions.remove(id);
  142808. this.showsUpdated.remove(id);
  142809. }
  142810. return true;
  142811. }
  142812. return false;
  142813. };
  142814. Batch3.prototype.update = function(time) {
  142815. let isUpdated = true;
  142816. const removedCount = 0;
  142817. let primitive = this.primitive;
  142818. const primitives = this.primitives;
  142819. let i2;
  142820. if (this.createPrimitive) {
  142821. const geometries = this.geometry.values;
  142822. const geometriesLength = geometries.length;
  142823. if (geometriesLength > 0) {
  142824. if (defined_default(primitive)) {
  142825. if (!defined_default(this.oldPrimitive)) {
  142826. this.oldPrimitive = primitive;
  142827. } else {
  142828. primitives.remove(primitive);
  142829. }
  142830. }
  142831. primitive = new GroundPrimitive_default({
  142832. show: false,
  142833. asynchronous: true,
  142834. geometryInstances: geometries.slice(),
  142835. classificationType: this.classificationType
  142836. });
  142837. primitives.add(primitive, this.zIndex);
  142838. isUpdated = false;
  142839. } else {
  142840. if (defined_default(primitive)) {
  142841. primitives.remove(primitive);
  142842. primitive = void 0;
  142843. }
  142844. const oldPrimitive = this.oldPrimitive;
  142845. if (defined_default(oldPrimitive)) {
  142846. primitives.remove(oldPrimitive);
  142847. this.oldPrimitive = void 0;
  142848. }
  142849. }
  142850. this.attributes.removeAll();
  142851. this.primitive = primitive;
  142852. this.createPrimitive = false;
  142853. this.waitingOnCreate = true;
  142854. } else if (defined_default(primitive) && primitive.ready) {
  142855. primitive.show = true;
  142856. if (defined_default(this.oldPrimitive)) {
  142857. primitives.remove(this.oldPrimitive);
  142858. this.oldPrimitive = void 0;
  142859. }
  142860. const updatersWithAttributes = this.updatersWithAttributes.values;
  142861. const length3 = updatersWithAttributes.length;
  142862. const waitingOnCreate = this.waitingOnCreate;
  142863. for (i2 = 0; i2 < length3; i2++) {
  142864. const updater = updatersWithAttributes[i2];
  142865. const instance = this.geometry.get(updater.id);
  142866. let attributes = this.attributes.get(instance.id.id);
  142867. if (!defined_default(attributes)) {
  142868. attributes = primitive.getGeometryInstanceAttributes(instance.id);
  142869. this.attributes.set(instance.id.id, attributes);
  142870. }
  142871. if (!updater.fillMaterialProperty.isConstant || waitingOnCreate) {
  142872. const colorProperty = updater.fillMaterialProperty.color;
  142873. const fillColor = Property_default.getValueOrDefault(
  142874. colorProperty,
  142875. time,
  142876. Color_default.WHITE,
  142877. colorScratch5
  142878. );
  142879. if (!Color_default.equals(attributes._lastColor, fillColor)) {
  142880. attributes._lastColor = Color_default.clone(fillColor, attributes._lastColor);
  142881. attributes.color = ColorGeometryInstanceAttribute_default.toValue(
  142882. fillColor,
  142883. attributes.color
  142884. );
  142885. }
  142886. }
  142887. const show = updater.entity.isShowing && (updater.hasConstantFill || updater.isFilled(time));
  142888. const currentShow = attributes.show[0] === 1;
  142889. if (show !== currentShow) {
  142890. attributes.show = ShowGeometryInstanceAttribute_default.toValue(
  142891. show,
  142892. attributes.show
  142893. );
  142894. }
  142895. const distanceDisplayConditionProperty = updater.distanceDisplayConditionProperty;
  142896. if (!Property_default.isConstant(distanceDisplayConditionProperty)) {
  142897. const distanceDisplayCondition = Property_default.getValueOrDefault(
  142898. distanceDisplayConditionProperty,
  142899. time,
  142900. defaultDistanceDisplayCondition4,
  142901. distanceDisplayConditionScratch4
  142902. );
  142903. if (!DistanceDisplayCondition_default.equals(
  142904. distanceDisplayCondition,
  142905. attributes._lastDistanceDisplayCondition
  142906. )) {
  142907. attributes._lastDistanceDisplayCondition = DistanceDisplayCondition_default.clone(
  142908. distanceDisplayCondition,
  142909. attributes._lastDistanceDisplayCondition
  142910. );
  142911. attributes.distanceDisplayCondition = DistanceDisplayConditionGeometryInstanceAttribute_default.toValue(
  142912. distanceDisplayCondition,
  142913. attributes.distanceDisplayCondition
  142914. );
  142915. }
  142916. }
  142917. }
  142918. this.updateShows(primitive);
  142919. this.waitingOnCreate = false;
  142920. } else if (defined_default(primitive) && !primitive.ready) {
  142921. isUpdated = false;
  142922. }
  142923. this.itemsToRemove.length = removedCount;
  142924. return isUpdated;
  142925. };
  142926. Batch3.prototype.updateShows = function(primitive) {
  142927. const showsUpdated = this.showsUpdated.values;
  142928. const length3 = showsUpdated.length;
  142929. for (let i2 = 0; i2 < length3; i2++) {
  142930. const updater = showsUpdated[i2];
  142931. const instance = this.geometry.get(updater.id);
  142932. let attributes = this.attributes.get(instance.id.id);
  142933. if (!defined_default(attributes)) {
  142934. attributes = primitive.getGeometryInstanceAttributes(instance.id);
  142935. this.attributes.set(instance.id.id, attributes);
  142936. }
  142937. const show = updater.entity.isShowing;
  142938. const currentShow = attributes.show[0] === 1;
  142939. if (show !== currentShow) {
  142940. attributes.show = ShowGeometryInstanceAttribute_default.toValue(
  142941. show,
  142942. attributes.show
  142943. );
  142944. instance.attributes.show.value[0] = attributes.show[0];
  142945. }
  142946. }
  142947. this.showsUpdated.removeAll();
  142948. };
  142949. Batch3.prototype.contains = function(updater) {
  142950. return this.updaters.contains(updater.id);
  142951. };
  142952. Batch3.prototype.getBoundingSphere = function(updater, result) {
  142953. const primitive = this.primitive;
  142954. if (!primitive.ready) {
  142955. return BoundingSphereState_default.PENDING;
  142956. }
  142957. const bs = primitive.getBoundingSphere(updater.entity);
  142958. if (!defined_default(bs)) {
  142959. return BoundingSphereState_default.FAILED;
  142960. }
  142961. bs.clone(result);
  142962. return BoundingSphereState_default.DONE;
  142963. };
  142964. Batch3.prototype.removeAllPrimitives = function() {
  142965. const primitives = this.primitives;
  142966. const primitive = this.primitive;
  142967. if (defined_default(primitive)) {
  142968. primitives.remove(primitive);
  142969. this.primitive = void 0;
  142970. this.geometry.removeAll();
  142971. this.updaters.removeAll();
  142972. }
  142973. const oldPrimitive = this.oldPrimitive;
  142974. if (defined_default(oldPrimitive)) {
  142975. primitives.remove(oldPrimitive);
  142976. this.oldPrimitive = void 0;
  142977. }
  142978. };
  142979. function StaticGroundGeometryColorBatch(primitives, classificationType) {
  142980. this._batches = [];
  142981. this._primitives = primitives;
  142982. this._classificationType = classificationType;
  142983. }
  142984. StaticGroundGeometryColorBatch.prototype.add = function(time, updater) {
  142985. const instance = updater.createFillGeometryInstance(time);
  142986. const batches = this._batches;
  142987. const zIndex = Property_default.getValueOrDefault(updater.zIndex, 0);
  142988. let batch;
  142989. const length3 = batches.length;
  142990. for (let i2 = 0; i2 < length3; ++i2) {
  142991. const item = batches[i2];
  142992. if (item.zIndex === zIndex && !item.overlapping(instance.geometry.rectangle)) {
  142993. batch = item;
  142994. break;
  142995. }
  142996. }
  142997. if (!defined_default(batch)) {
  142998. batch = new Batch3(
  142999. this._primitives,
  143000. this._classificationType,
  143001. instance.attributes.color.value,
  143002. zIndex
  143003. );
  143004. batches.push(batch);
  143005. }
  143006. batch.add(updater, instance);
  143007. return batch;
  143008. };
  143009. StaticGroundGeometryColorBatch.prototype.remove = function(updater) {
  143010. const batches = this._batches;
  143011. const count = batches.length;
  143012. for (let i2 = 0; i2 < count; ++i2) {
  143013. if (batches[i2].remove(updater)) {
  143014. return;
  143015. }
  143016. }
  143017. };
  143018. StaticGroundGeometryColorBatch.prototype.update = function(time) {
  143019. let i2;
  143020. let updater;
  143021. let isUpdated = true;
  143022. const batches = this._batches;
  143023. const batchCount = batches.length;
  143024. for (i2 = 0; i2 < batchCount; ++i2) {
  143025. isUpdated = batches[i2].update(time) && isUpdated;
  143026. }
  143027. for (i2 = 0; i2 < batchCount; ++i2) {
  143028. const oldBatch = batches[i2];
  143029. const itemsToRemove = oldBatch.itemsToRemove;
  143030. const itemsToMoveLength = itemsToRemove.length;
  143031. for (let j = 0; j < itemsToMoveLength; j++) {
  143032. updater = itemsToRemove[j];
  143033. oldBatch.remove(updater);
  143034. const newBatch = this.add(time, updater);
  143035. oldBatch.isDirty = true;
  143036. newBatch.isDirty = true;
  143037. }
  143038. }
  143039. for (i2 = batchCount - 1; i2 >= 0; --i2) {
  143040. const batch = batches[i2];
  143041. if (batch.isDirty) {
  143042. isUpdated = batches[i2].update(time) && isUpdated;
  143043. batch.isDirty = false;
  143044. }
  143045. if (batch.geometry.length === 0) {
  143046. batches.splice(i2, 1);
  143047. }
  143048. }
  143049. return isUpdated;
  143050. };
  143051. StaticGroundGeometryColorBatch.prototype.getBoundingSphere = function(updater, result) {
  143052. const batches = this._batches;
  143053. const batchCount = batches.length;
  143054. for (let i2 = 0; i2 < batchCount; ++i2) {
  143055. const batch = batches[i2];
  143056. if (batch.contains(updater)) {
  143057. return batch.getBoundingSphere(updater, result);
  143058. }
  143059. }
  143060. return BoundingSphereState_default.FAILED;
  143061. };
  143062. StaticGroundGeometryColorBatch.prototype.removeAllPrimitives = function() {
  143063. const batches = this._batches;
  143064. const batchCount = batches.length;
  143065. for (let i2 = 0; i2 < batchCount; ++i2) {
  143066. batches[i2].removeAllPrimitives();
  143067. }
  143068. };
  143069. var StaticGroundGeometryColorBatch_default = StaticGroundGeometryColorBatch;
  143070. // node_modules/cesium/Source/DataSources/StaticGroundGeometryPerMaterialBatch.js
  143071. var distanceDisplayConditionScratch5 = new DistanceDisplayCondition_default();
  143072. var defaultDistanceDisplayCondition5 = new DistanceDisplayCondition_default();
  143073. function Batch4(primitives, classificationType, appearanceType, materialProperty, usingSphericalTextureCoordinates, zIndex) {
  143074. this.primitives = primitives;
  143075. this.classificationType = classificationType;
  143076. this.appearanceType = appearanceType;
  143077. this.materialProperty = materialProperty;
  143078. this.updaters = new AssociativeArray_default();
  143079. this.createPrimitive = true;
  143080. this.primitive = void 0;
  143081. this.oldPrimitive = void 0;
  143082. this.geometry = new AssociativeArray_default();
  143083. this.material = void 0;
  143084. this.updatersWithAttributes = new AssociativeArray_default();
  143085. this.attributes = new AssociativeArray_default();
  143086. this.invalidated = false;
  143087. this.removeMaterialSubscription = materialProperty.definitionChanged.addEventListener(
  143088. Batch4.prototype.onMaterialChanged,
  143089. this
  143090. );
  143091. this.subscriptions = new AssociativeArray_default();
  143092. this.showsUpdated = new AssociativeArray_default();
  143093. this.usingSphericalTextureCoordinates = usingSphericalTextureCoordinates;
  143094. this.zIndex = zIndex;
  143095. this.rectangleCollisionCheck = new RectangleCollisionChecker_default();
  143096. }
  143097. Batch4.prototype.onMaterialChanged = function() {
  143098. this.invalidated = true;
  143099. };
  143100. Batch4.prototype.overlapping = function(rectangle) {
  143101. return this.rectangleCollisionCheck.collides(rectangle);
  143102. };
  143103. Batch4.prototype.isMaterial = function(updater) {
  143104. const material = this.materialProperty;
  143105. const updaterMaterial = updater.fillMaterialProperty;
  143106. if (updaterMaterial === material || updaterMaterial instanceof ColorMaterialProperty_default && material instanceof ColorMaterialProperty_default) {
  143107. return true;
  143108. }
  143109. return defined_default(material) && material.equals(updaterMaterial);
  143110. };
  143111. Batch4.prototype.add = function(time, updater, geometryInstance) {
  143112. const id = updater.id;
  143113. this.updaters.set(id, updater);
  143114. this.geometry.set(id, geometryInstance);
  143115. this.rectangleCollisionCheck.insert(id, geometryInstance.geometry.rectangle);
  143116. if (!updater.hasConstantFill || !updater.fillMaterialProperty.isConstant || !Property_default.isConstant(updater.distanceDisplayConditionProperty)) {
  143117. this.updatersWithAttributes.set(id, updater);
  143118. } else {
  143119. const that = this;
  143120. this.subscriptions.set(
  143121. id,
  143122. updater.entity.definitionChanged.addEventListener(function(entity, propertyName, newValue, oldValue2) {
  143123. if (propertyName === "isShowing") {
  143124. that.showsUpdated.set(updater.id, updater);
  143125. }
  143126. })
  143127. );
  143128. }
  143129. this.createPrimitive = true;
  143130. };
  143131. Batch4.prototype.remove = function(updater) {
  143132. const id = updater.id;
  143133. const geometryInstance = this.geometry.get(id);
  143134. this.createPrimitive = this.geometry.remove(id) || this.createPrimitive;
  143135. if (this.updaters.remove(id)) {
  143136. this.rectangleCollisionCheck.remove(
  143137. id,
  143138. geometryInstance.geometry.rectangle
  143139. );
  143140. this.updatersWithAttributes.remove(id);
  143141. const unsubscribe2 = this.subscriptions.get(id);
  143142. if (defined_default(unsubscribe2)) {
  143143. unsubscribe2();
  143144. this.subscriptions.remove(id);
  143145. }
  143146. return true;
  143147. }
  143148. return false;
  143149. };
  143150. Batch4.prototype.update = function(time) {
  143151. let isUpdated = true;
  143152. let primitive = this.primitive;
  143153. const primitives = this.primitives;
  143154. const geometries = this.geometry.values;
  143155. let i2;
  143156. if (this.createPrimitive) {
  143157. const geometriesLength = geometries.length;
  143158. if (geometriesLength > 0) {
  143159. if (defined_default(primitive)) {
  143160. if (!defined_default(this.oldPrimitive)) {
  143161. this.oldPrimitive = primitive;
  143162. } else {
  143163. primitives.remove(primitive);
  143164. }
  143165. }
  143166. this.material = MaterialProperty_default.getValue(
  143167. time,
  143168. this.materialProperty,
  143169. this.material
  143170. );
  143171. primitive = new GroundPrimitive_default({
  143172. show: false,
  143173. asynchronous: true,
  143174. geometryInstances: geometries.slice(),
  143175. appearance: new this.appearanceType({
  143176. material: this.material
  143177. }),
  143178. classificationType: this.classificationType
  143179. });
  143180. primitives.add(primitive, this.zIndex);
  143181. isUpdated = false;
  143182. } else {
  143183. if (defined_default(primitive)) {
  143184. primitives.remove(primitive);
  143185. primitive = void 0;
  143186. }
  143187. const oldPrimitive = this.oldPrimitive;
  143188. if (defined_default(oldPrimitive)) {
  143189. primitives.remove(oldPrimitive);
  143190. this.oldPrimitive = void 0;
  143191. }
  143192. }
  143193. this.attributes.removeAll();
  143194. this.primitive = primitive;
  143195. this.createPrimitive = false;
  143196. } else if (defined_default(primitive) && primitive.ready) {
  143197. primitive.show = true;
  143198. if (defined_default(this.oldPrimitive)) {
  143199. primitives.remove(this.oldPrimitive);
  143200. this.oldPrimitive = void 0;
  143201. }
  143202. this.material = MaterialProperty_default.getValue(
  143203. time,
  143204. this.materialProperty,
  143205. this.material
  143206. );
  143207. this.primitive.appearance.material = this.material;
  143208. const updatersWithAttributes = this.updatersWithAttributes.values;
  143209. const length3 = updatersWithAttributes.length;
  143210. for (i2 = 0; i2 < length3; i2++) {
  143211. const updater = updatersWithAttributes[i2];
  143212. const entity = updater.entity;
  143213. const instance = this.geometry.get(updater.id);
  143214. let attributes = this.attributes.get(instance.id.id);
  143215. if (!defined_default(attributes)) {
  143216. attributes = primitive.getGeometryInstanceAttributes(instance.id);
  143217. this.attributes.set(instance.id.id, attributes);
  143218. }
  143219. const show = entity.isShowing && (updater.hasConstantFill || updater.isFilled(time));
  143220. const currentShow = attributes.show[0] === 1;
  143221. if (show !== currentShow) {
  143222. attributes.show = ShowGeometryInstanceAttribute_default.toValue(
  143223. show,
  143224. attributes.show
  143225. );
  143226. }
  143227. const distanceDisplayConditionProperty = updater.distanceDisplayConditionProperty;
  143228. if (!Property_default.isConstant(distanceDisplayConditionProperty)) {
  143229. const distanceDisplayCondition = Property_default.getValueOrDefault(
  143230. distanceDisplayConditionProperty,
  143231. time,
  143232. defaultDistanceDisplayCondition5,
  143233. distanceDisplayConditionScratch5
  143234. );
  143235. if (!DistanceDisplayCondition_default.equals(
  143236. distanceDisplayCondition,
  143237. attributes._lastDistanceDisplayCondition
  143238. )) {
  143239. attributes._lastDistanceDisplayCondition = DistanceDisplayCondition_default.clone(
  143240. distanceDisplayCondition,
  143241. attributes._lastDistanceDisplayCondition
  143242. );
  143243. attributes.distanceDisplayCondition = DistanceDisplayConditionGeometryInstanceAttribute_default.toValue(
  143244. distanceDisplayCondition,
  143245. attributes.distanceDisplayCondition
  143246. );
  143247. }
  143248. }
  143249. }
  143250. this.updateShows(primitive);
  143251. } else if (defined_default(primitive) && !primitive.ready) {
  143252. isUpdated = false;
  143253. }
  143254. return isUpdated;
  143255. };
  143256. Batch4.prototype.updateShows = function(primitive) {
  143257. const showsUpdated = this.showsUpdated.values;
  143258. const length3 = showsUpdated.length;
  143259. for (let i2 = 0; i2 < length3; i2++) {
  143260. const updater = showsUpdated[i2];
  143261. const entity = updater.entity;
  143262. const instance = this.geometry.get(updater.id);
  143263. let attributes = this.attributes.get(instance.id.id);
  143264. if (!defined_default(attributes)) {
  143265. attributes = primitive.getGeometryInstanceAttributes(instance.id);
  143266. this.attributes.set(instance.id.id, attributes);
  143267. }
  143268. const show = entity.isShowing;
  143269. const currentShow = attributes.show[0] === 1;
  143270. if (show !== currentShow) {
  143271. attributes.show = ShowGeometryInstanceAttribute_default.toValue(
  143272. show,
  143273. attributes.show
  143274. );
  143275. instance.attributes.show.value[0] = attributes.show[0];
  143276. }
  143277. }
  143278. this.showsUpdated.removeAll();
  143279. };
  143280. Batch4.prototype.contains = function(updater) {
  143281. return this.updaters.contains(updater.id);
  143282. };
  143283. Batch4.prototype.getBoundingSphere = function(updater, result) {
  143284. const primitive = this.primitive;
  143285. if (!primitive.ready) {
  143286. return BoundingSphereState_default.PENDING;
  143287. }
  143288. const attributes = primitive.getGeometryInstanceAttributes(updater.entity);
  143289. if (!defined_default(attributes) || !defined_default(attributes.boundingSphere) || defined_default(attributes.show) && attributes.show[0] === 0) {
  143290. return BoundingSphereState_default.FAILED;
  143291. }
  143292. attributes.boundingSphere.clone(result);
  143293. return BoundingSphereState_default.DONE;
  143294. };
  143295. Batch4.prototype.destroy = function() {
  143296. const primitive = this.primitive;
  143297. const primitives = this.primitives;
  143298. if (defined_default(primitive)) {
  143299. primitives.remove(primitive);
  143300. }
  143301. const oldPrimitive = this.oldPrimitive;
  143302. if (defined_default(oldPrimitive)) {
  143303. primitives.remove(oldPrimitive);
  143304. }
  143305. this.removeMaterialSubscription();
  143306. };
  143307. function StaticGroundGeometryPerMaterialBatch(primitives, classificationType, appearanceType) {
  143308. this._items = [];
  143309. this._primitives = primitives;
  143310. this._classificationType = classificationType;
  143311. this._appearanceType = appearanceType;
  143312. }
  143313. StaticGroundGeometryPerMaterialBatch.prototype.add = function(time, updater) {
  143314. const items = this._items;
  143315. const length3 = items.length;
  143316. const geometryInstance = updater.createFillGeometryInstance(time);
  143317. const usingSphericalTextureCoordinates = ShadowVolumeAppearance_default.shouldUseSphericalCoordinates(
  143318. geometryInstance.geometry.rectangle
  143319. );
  143320. const zIndex = Property_default.getValueOrDefault(updater.zIndex, 0);
  143321. for (let i2 = 0; i2 < length3; ++i2) {
  143322. const item = items[i2];
  143323. if (item.isMaterial(updater) && item.usingSphericalTextureCoordinates === usingSphericalTextureCoordinates && item.zIndex === zIndex && !item.overlapping(geometryInstance.geometry.rectangle)) {
  143324. item.add(time, updater, geometryInstance);
  143325. return;
  143326. }
  143327. }
  143328. const batch = new Batch4(
  143329. this._primitives,
  143330. this._classificationType,
  143331. this._appearanceType,
  143332. updater.fillMaterialProperty,
  143333. usingSphericalTextureCoordinates,
  143334. zIndex
  143335. );
  143336. batch.add(time, updater, geometryInstance);
  143337. items.push(batch);
  143338. };
  143339. StaticGroundGeometryPerMaterialBatch.prototype.remove = function(updater) {
  143340. const items = this._items;
  143341. const length3 = items.length;
  143342. for (let i2 = length3 - 1; i2 >= 0; i2--) {
  143343. const item = items[i2];
  143344. if (item.remove(updater)) {
  143345. if (item.updaters.length === 0) {
  143346. items.splice(i2, 1);
  143347. item.destroy();
  143348. }
  143349. break;
  143350. }
  143351. }
  143352. };
  143353. StaticGroundGeometryPerMaterialBatch.prototype.update = function(time) {
  143354. let i2;
  143355. const items = this._items;
  143356. const length3 = items.length;
  143357. for (i2 = length3 - 1; i2 >= 0; i2--) {
  143358. const item = items[i2];
  143359. if (item.invalidated) {
  143360. items.splice(i2, 1);
  143361. const updaters = item.updaters.values;
  143362. const updatersLength = updaters.length;
  143363. for (let h = 0; h < updatersLength; h++) {
  143364. this.add(time, updaters[h]);
  143365. }
  143366. item.destroy();
  143367. }
  143368. }
  143369. let isUpdated = true;
  143370. for (i2 = 0; i2 < items.length; i2++) {
  143371. isUpdated = items[i2].update(time) && isUpdated;
  143372. }
  143373. return isUpdated;
  143374. };
  143375. StaticGroundGeometryPerMaterialBatch.prototype.getBoundingSphere = function(updater, result) {
  143376. const items = this._items;
  143377. const length3 = items.length;
  143378. for (let i2 = 0; i2 < length3; i2++) {
  143379. const item = items[i2];
  143380. if (item.contains(updater)) {
  143381. return item.getBoundingSphere(updater, result);
  143382. }
  143383. }
  143384. return BoundingSphereState_default.FAILED;
  143385. };
  143386. StaticGroundGeometryPerMaterialBatch.prototype.removeAllPrimitives = function() {
  143387. const items = this._items;
  143388. const length3 = items.length;
  143389. for (let i2 = 0; i2 < length3; i2++) {
  143390. items[i2].destroy();
  143391. }
  143392. this._items.length = 0;
  143393. };
  143394. var StaticGroundGeometryPerMaterialBatch_default = StaticGroundGeometryPerMaterialBatch;
  143395. // node_modules/cesium/Source/DataSources/StaticOutlineGeometryBatch.js
  143396. var colorScratch6 = new Color_default();
  143397. var distanceDisplayConditionScratch6 = new DistanceDisplayCondition_default();
  143398. var defaultDistanceDisplayCondition6 = new DistanceDisplayCondition_default();
  143399. var defaultOffset11 = Cartesian3_default.ZERO;
  143400. var offsetScratch13 = new Cartesian3_default();
  143401. function Batch5(primitives, translucent, width, shadows) {
  143402. this.translucent = translucent;
  143403. this.width = width;
  143404. this.shadows = shadows;
  143405. this.primitives = primitives;
  143406. this.createPrimitive = false;
  143407. this.waitingOnCreate = false;
  143408. this.primitive = void 0;
  143409. this.oldPrimitive = void 0;
  143410. this.geometry = new AssociativeArray_default();
  143411. this.updaters = new AssociativeArray_default();
  143412. this.updatersWithAttributes = new AssociativeArray_default();
  143413. this.attributes = new AssociativeArray_default();
  143414. this.itemsToRemove = [];
  143415. this.subscriptions = new AssociativeArray_default();
  143416. this.showsUpdated = new AssociativeArray_default();
  143417. }
  143418. Batch5.prototype.add = function(updater, instance) {
  143419. const id = updater.id;
  143420. this.createPrimitive = true;
  143421. this.geometry.set(id, instance);
  143422. this.updaters.set(id, updater);
  143423. if (!updater.hasConstantOutline || !updater.outlineColorProperty.isConstant || !Property_default.isConstant(updater.distanceDisplayConditionProperty) || !Property_default.isConstant(updater.terrainOffsetProperty)) {
  143424. this.updatersWithAttributes.set(id, updater);
  143425. } else {
  143426. const that = this;
  143427. this.subscriptions.set(
  143428. id,
  143429. updater.entity.definitionChanged.addEventListener(function(entity, propertyName, newValue, oldValue2) {
  143430. if (propertyName === "isShowing") {
  143431. that.showsUpdated.set(updater.id, updater);
  143432. }
  143433. })
  143434. );
  143435. }
  143436. };
  143437. Batch5.prototype.remove = function(updater) {
  143438. const id = updater.id;
  143439. this.createPrimitive = this.geometry.remove(id) || this.createPrimitive;
  143440. if (this.updaters.remove(id)) {
  143441. this.updatersWithAttributes.remove(id);
  143442. const unsubscribe2 = this.subscriptions.get(id);
  143443. if (defined_default(unsubscribe2)) {
  143444. unsubscribe2();
  143445. this.subscriptions.remove(id);
  143446. this.showsUpdated.remove(id);
  143447. }
  143448. return true;
  143449. }
  143450. return false;
  143451. };
  143452. Batch5.prototype.update = function(time) {
  143453. let isUpdated = true;
  143454. let removedCount = 0;
  143455. let primitive = this.primitive;
  143456. const primitives = this.primitives;
  143457. let i2;
  143458. if (this.createPrimitive) {
  143459. const geometries = this.geometry.values;
  143460. const geometriesLength = geometries.length;
  143461. if (geometriesLength > 0) {
  143462. if (defined_default(primitive)) {
  143463. if (!defined_default(this.oldPrimitive)) {
  143464. this.oldPrimitive = primitive;
  143465. } else {
  143466. primitives.remove(primitive);
  143467. }
  143468. }
  143469. primitive = new Primitive_default({
  143470. show: false,
  143471. asynchronous: true,
  143472. geometryInstances: geometries.slice(),
  143473. appearance: new PerInstanceColorAppearance_default({
  143474. flat: true,
  143475. translucent: this.translucent,
  143476. renderState: {
  143477. lineWidth: this.width
  143478. }
  143479. }),
  143480. shadows: this.shadows
  143481. });
  143482. primitives.add(primitive);
  143483. isUpdated = false;
  143484. } else {
  143485. if (defined_default(primitive)) {
  143486. primitives.remove(primitive);
  143487. primitive = void 0;
  143488. }
  143489. const oldPrimitive = this.oldPrimitive;
  143490. if (defined_default(oldPrimitive)) {
  143491. primitives.remove(oldPrimitive);
  143492. this.oldPrimitive = void 0;
  143493. }
  143494. }
  143495. this.attributes.removeAll();
  143496. this.primitive = primitive;
  143497. this.createPrimitive = false;
  143498. this.waitingOnCreate = true;
  143499. } else if (defined_default(primitive) && primitive.ready) {
  143500. primitive.show = true;
  143501. if (defined_default(this.oldPrimitive)) {
  143502. primitives.remove(this.oldPrimitive);
  143503. this.oldPrimitive = void 0;
  143504. }
  143505. const updatersWithAttributes = this.updatersWithAttributes.values;
  143506. const length3 = updatersWithAttributes.length;
  143507. const waitingOnCreate = this.waitingOnCreate;
  143508. for (i2 = 0; i2 < length3; i2++) {
  143509. const updater = updatersWithAttributes[i2];
  143510. const instance = this.geometry.get(updater.id);
  143511. let attributes = this.attributes.get(instance.id.id);
  143512. if (!defined_default(attributes)) {
  143513. attributes = primitive.getGeometryInstanceAttributes(instance.id);
  143514. this.attributes.set(instance.id.id, attributes);
  143515. }
  143516. if (!updater.outlineColorProperty.isConstant || waitingOnCreate) {
  143517. const outlineColorProperty = updater.outlineColorProperty;
  143518. const outlineColor = Property_default.getValueOrDefault(
  143519. outlineColorProperty,
  143520. time,
  143521. Color_default.WHITE,
  143522. colorScratch6
  143523. );
  143524. if (!Color_default.equals(attributes._lastColor, outlineColor)) {
  143525. attributes._lastColor = Color_default.clone(
  143526. outlineColor,
  143527. attributes._lastColor
  143528. );
  143529. attributes.color = ColorGeometryInstanceAttribute_default.toValue(
  143530. outlineColor,
  143531. attributes.color
  143532. );
  143533. if (this.translucent && attributes.color[3] === 255 || !this.translucent && attributes.color[3] !== 255) {
  143534. this.itemsToRemove[removedCount++] = updater;
  143535. }
  143536. }
  143537. }
  143538. const show = updater.entity.isShowing && (updater.hasConstantOutline || updater.isOutlineVisible(time));
  143539. const currentShow = attributes.show[0] === 1;
  143540. if (show !== currentShow) {
  143541. attributes.show = ShowGeometryInstanceAttribute_default.toValue(
  143542. show,
  143543. attributes.show
  143544. );
  143545. }
  143546. const distanceDisplayConditionProperty = updater.distanceDisplayConditionProperty;
  143547. if (!Property_default.isConstant(distanceDisplayConditionProperty)) {
  143548. const distanceDisplayCondition = Property_default.getValueOrDefault(
  143549. distanceDisplayConditionProperty,
  143550. time,
  143551. defaultDistanceDisplayCondition6,
  143552. distanceDisplayConditionScratch6
  143553. );
  143554. if (!DistanceDisplayCondition_default.equals(
  143555. distanceDisplayCondition,
  143556. attributes._lastDistanceDisplayCondition
  143557. )) {
  143558. attributes._lastDistanceDisplayCondition = DistanceDisplayCondition_default.clone(
  143559. distanceDisplayCondition,
  143560. attributes._lastDistanceDisplayCondition
  143561. );
  143562. attributes.distanceDisplayCondition = DistanceDisplayConditionGeometryInstanceAttribute_default.toValue(
  143563. distanceDisplayCondition,
  143564. attributes.distanceDisplayCondition
  143565. );
  143566. }
  143567. }
  143568. const offsetProperty = updater.terrainOffsetProperty;
  143569. if (!Property_default.isConstant(offsetProperty)) {
  143570. const offset2 = Property_default.getValueOrDefault(
  143571. offsetProperty,
  143572. time,
  143573. defaultOffset11,
  143574. offsetScratch13
  143575. );
  143576. if (!Cartesian3_default.equals(offset2, attributes._lastOffset)) {
  143577. attributes._lastOffset = Cartesian3_default.clone(
  143578. offset2,
  143579. attributes._lastOffset
  143580. );
  143581. attributes.offset = OffsetGeometryInstanceAttribute_default.toValue(
  143582. offset2,
  143583. attributes.offset
  143584. );
  143585. }
  143586. }
  143587. }
  143588. this.updateShows(primitive);
  143589. this.waitingOnCreate = false;
  143590. } else if (defined_default(primitive) && !primitive.ready) {
  143591. isUpdated = false;
  143592. }
  143593. this.itemsToRemove.length = removedCount;
  143594. return isUpdated;
  143595. };
  143596. Batch5.prototype.updateShows = function(primitive) {
  143597. const showsUpdated = this.showsUpdated.values;
  143598. const length3 = showsUpdated.length;
  143599. for (let i2 = 0; i2 < length3; i2++) {
  143600. const updater = showsUpdated[i2];
  143601. const instance = this.geometry.get(updater.id);
  143602. let attributes = this.attributes.get(instance.id.id);
  143603. if (!defined_default(attributes)) {
  143604. attributes = primitive.getGeometryInstanceAttributes(instance.id);
  143605. this.attributes.set(instance.id.id, attributes);
  143606. }
  143607. const show = updater.entity.isShowing;
  143608. const currentShow = attributes.show[0] === 1;
  143609. if (show !== currentShow) {
  143610. attributes.show = ShowGeometryInstanceAttribute_default.toValue(
  143611. show,
  143612. attributes.show
  143613. );
  143614. instance.attributes.show.value[0] = attributes.show[0];
  143615. }
  143616. }
  143617. this.showsUpdated.removeAll();
  143618. };
  143619. Batch5.prototype.contains = function(updater) {
  143620. return this.updaters.contains(updater.id);
  143621. };
  143622. Batch5.prototype.getBoundingSphere = function(updater, result) {
  143623. const primitive = this.primitive;
  143624. if (!primitive.ready) {
  143625. return BoundingSphereState_default.PENDING;
  143626. }
  143627. const attributes = primitive.getGeometryInstanceAttributes(updater.entity);
  143628. if (!defined_default(attributes) || !defined_default(attributes.boundingSphere) || defined_default(attributes.show) && attributes.show[0] === 0) {
  143629. return BoundingSphereState_default.FAILED;
  143630. }
  143631. attributes.boundingSphere.clone(result);
  143632. return BoundingSphereState_default.DONE;
  143633. };
  143634. Batch5.prototype.removeAllPrimitives = function() {
  143635. const primitives = this.primitives;
  143636. const primitive = this.primitive;
  143637. if (defined_default(primitive)) {
  143638. primitives.remove(primitive);
  143639. this.primitive = void 0;
  143640. this.geometry.removeAll();
  143641. this.updaters.removeAll();
  143642. }
  143643. const oldPrimitive = this.oldPrimitive;
  143644. if (defined_default(oldPrimitive)) {
  143645. primitives.remove(oldPrimitive);
  143646. this.oldPrimitive = void 0;
  143647. }
  143648. };
  143649. function StaticOutlineGeometryBatch(primitives, scene, shadows) {
  143650. this._primitives = primitives;
  143651. this._scene = scene;
  143652. this._shadows = shadows;
  143653. this._solidBatches = new AssociativeArray_default();
  143654. this._translucentBatches = new AssociativeArray_default();
  143655. }
  143656. StaticOutlineGeometryBatch.prototype.add = function(time, updater) {
  143657. const instance = updater.createOutlineGeometryInstance(time);
  143658. const width = this._scene.clampLineWidth(updater.outlineWidth);
  143659. let batches;
  143660. let batch;
  143661. if (instance.attributes.color.value[3] === 255) {
  143662. batches = this._solidBatches;
  143663. batch = batches.get(width);
  143664. if (!defined_default(batch)) {
  143665. batch = new Batch5(this._primitives, false, width, this._shadows);
  143666. batches.set(width, batch);
  143667. }
  143668. batch.add(updater, instance);
  143669. } else {
  143670. batches = this._translucentBatches;
  143671. batch = batches.get(width);
  143672. if (!defined_default(batch)) {
  143673. batch = new Batch5(this._primitives, true, width, this._shadows);
  143674. batches.set(width, batch);
  143675. }
  143676. batch.add(updater, instance);
  143677. }
  143678. };
  143679. StaticOutlineGeometryBatch.prototype.remove = function(updater) {
  143680. let i2;
  143681. const solidBatches = this._solidBatches.values;
  143682. const solidBatchesLength = solidBatches.length;
  143683. for (i2 = 0; i2 < solidBatchesLength; i2++) {
  143684. if (solidBatches[i2].remove(updater)) {
  143685. return;
  143686. }
  143687. }
  143688. const translucentBatches = this._translucentBatches.values;
  143689. const translucentBatchesLength = translucentBatches.length;
  143690. for (i2 = 0; i2 < translucentBatchesLength; i2++) {
  143691. if (translucentBatches[i2].remove(updater)) {
  143692. return;
  143693. }
  143694. }
  143695. };
  143696. StaticOutlineGeometryBatch.prototype.update = function(time) {
  143697. let i2;
  143698. let x;
  143699. let updater;
  143700. let batch;
  143701. const solidBatches = this._solidBatches.values;
  143702. const solidBatchesLength = solidBatches.length;
  143703. const translucentBatches = this._translucentBatches.values;
  143704. const translucentBatchesLength = translucentBatches.length;
  143705. let itemsToRemove;
  143706. let isUpdated = true;
  143707. let needUpdate = false;
  143708. do {
  143709. needUpdate = false;
  143710. for (x = 0; x < solidBatchesLength; x++) {
  143711. batch = solidBatches[x];
  143712. isUpdated = batch.update(time);
  143713. itemsToRemove = batch.itemsToRemove;
  143714. const solidsToMoveLength = itemsToRemove.length;
  143715. if (solidsToMoveLength > 0) {
  143716. needUpdate = true;
  143717. for (i2 = 0; i2 < solidsToMoveLength; i2++) {
  143718. updater = itemsToRemove[i2];
  143719. batch.remove(updater);
  143720. this.add(time, updater);
  143721. }
  143722. }
  143723. }
  143724. for (x = 0; x < translucentBatchesLength; x++) {
  143725. batch = translucentBatches[x];
  143726. isUpdated = batch.update(time);
  143727. itemsToRemove = batch.itemsToRemove;
  143728. const translucentToMoveLength = itemsToRemove.length;
  143729. if (translucentToMoveLength > 0) {
  143730. needUpdate = true;
  143731. for (i2 = 0; i2 < translucentToMoveLength; i2++) {
  143732. updater = itemsToRemove[i2];
  143733. batch.remove(updater);
  143734. this.add(time, updater);
  143735. }
  143736. }
  143737. }
  143738. } while (needUpdate);
  143739. return isUpdated;
  143740. };
  143741. StaticOutlineGeometryBatch.prototype.getBoundingSphere = function(updater, result) {
  143742. let i2;
  143743. const solidBatches = this._solidBatches.values;
  143744. const solidBatchesLength = solidBatches.length;
  143745. for (i2 = 0; i2 < solidBatchesLength; i2++) {
  143746. const solidBatch = solidBatches[i2];
  143747. if (solidBatch.contains(updater)) {
  143748. return solidBatch.getBoundingSphere(updater, result);
  143749. }
  143750. }
  143751. const translucentBatches = this._translucentBatches.values;
  143752. const translucentBatchesLength = translucentBatches.length;
  143753. for (i2 = 0; i2 < translucentBatchesLength; i2++) {
  143754. const translucentBatch = translucentBatches[i2];
  143755. if (translucentBatch.contains(updater)) {
  143756. return translucentBatch.getBoundingSphere(updater, result);
  143757. }
  143758. }
  143759. return BoundingSphereState_default.FAILED;
  143760. };
  143761. StaticOutlineGeometryBatch.prototype.removeAllPrimitives = function() {
  143762. let i2;
  143763. const solidBatches = this._solidBatches.values;
  143764. const solidBatchesLength = solidBatches.length;
  143765. for (i2 = 0; i2 < solidBatchesLength; i2++) {
  143766. solidBatches[i2].removeAllPrimitives();
  143767. }
  143768. const translucentBatches = this._translucentBatches.values;
  143769. const translucentBatchesLength = translucentBatches.length;
  143770. for (i2 = 0; i2 < translucentBatchesLength; i2++) {
  143771. translucentBatches[i2].removeAllPrimitives();
  143772. }
  143773. };
  143774. var StaticOutlineGeometryBatch_default = StaticOutlineGeometryBatch;
  143775. // node_modules/cesium/Source/DataSources/WallGeometryUpdater.js
  143776. var scratchColor20 = new Color_default();
  143777. function WallGeometryOptions(entity) {
  143778. this.id = entity;
  143779. this.vertexFormat = void 0;
  143780. this.positions = void 0;
  143781. this.minimumHeights = void 0;
  143782. this.maximumHeights = void 0;
  143783. this.granularity = void 0;
  143784. }
  143785. function WallGeometryUpdater(entity, scene) {
  143786. GeometryUpdater_default.call(this, {
  143787. entity,
  143788. scene,
  143789. geometryOptions: new WallGeometryOptions(entity),
  143790. geometryPropertyName: "wall",
  143791. observedPropertyNames: ["availability", "wall"]
  143792. });
  143793. this._onEntityPropertyChanged(entity, "wall", entity.wall, void 0);
  143794. }
  143795. if (defined_default(Object.create)) {
  143796. WallGeometryUpdater.prototype = Object.create(GeometryUpdater_default.prototype);
  143797. WallGeometryUpdater.prototype.constructor = WallGeometryUpdater;
  143798. }
  143799. WallGeometryUpdater.prototype.createFillGeometryInstance = function(time) {
  143800. Check_default.defined("time", time);
  143801. if (!this._fillEnabled) {
  143802. throw new DeveloperError_default(
  143803. "This instance does not represent a filled geometry."
  143804. );
  143805. }
  143806. const entity = this._entity;
  143807. const isAvailable = entity.isAvailable(time);
  143808. let attributes;
  143809. let color;
  143810. const show = new ShowGeometryInstanceAttribute_default(
  143811. isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time)
  143812. );
  143813. const distanceDisplayCondition = this._distanceDisplayConditionProperty.getValue(
  143814. time
  143815. );
  143816. const distanceDisplayConditionAttribute = DistanceDisplayConditionGeometryInstanceAttribute_default.fromDistanceDisplayCondition(
  143817. distanceDisplayCondition
  143818. );
  143819. if (this._materialProperty instanceof ColorMaterialProperty_default) {
  143820. let currentColor;
  143821. if (defined_default(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) {
  143822. currentColor = this._materialProperty.color.getValue(time, scratchColor20);
  143823. }
  143824. if (!defined_default(currentColor)) {
  143825. currentColor = Color_default.WHITE;
  143826. }
  143827. color = ColorGeometryInstanceAttribute_default.fromColor(currentColor);
  143828. attributes = {
  143829. show,
  143830. distanceDisplayCondition: distanceDisplayConditionAttribute,
  143831. color
  143832. };
  143833. } else {
  143834. attributes = {
  143835. show,
  143836. distanceDisplayCondition: distanceDisplayConditionAttribute
  143837. };
  143838. }
  143839. return new GeometryInstance_default({
  143840. id: entity,
  143841. geometry: new WallGeometry_default(this._options),
  143842. attributes
  143843. });
  143844. };
  143845. WallGeometryUpdater.prototype.createOutlineGeometryInstance = function(time) {
  143846. Check_default.defined("time", time);
  143847. if (!this._outlineEnabled) {
  143848. throw new DeveloperError_default(
  143849. "This instance does not represent an outlined geometry."
  143850. );
  143851. }
  143852. const entity = this._entity;
  143853. const isAvailable = entity.isAvailable(time);
  143854. const outlineColor = Property_default.getValueOrDefault(
  143855. this._outlineColorProperty,
  143856. time,
  143857. Color_default.BLACK,
  143858. scratchColor20
  143859. );
  143860. const distanceDisplayCondition = this._distanceDisplayConditionProperty.getValue(
  143861. time
  143862. );
  143863. return new GeometryInstance_default({
  143864. id: entity,
  143865. geometry: new WallOutlineGeometry_default(this._options),
  143866. attributes: {
  143867. show: new ShowGeometryInstanceAttribute_default(
  143868. isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)
  143869. ),
  143870. color: ColorGeometryInstanceAttribute_default.fromColor(outlineColor),
  143871. distanceDisplayCondition: DistanceDisplayConditionGeometryInstanceAttribute_default.fromDistanceDisplayCondition(
  143872. distanceDisplayCondition
  143873. )
  143874. }
  143875. });
  143876. };
  143877. WallGeometryUpdater.prototype._isHidden = function(entity, wall) {
  143878. return !defined_default(wall.positions) || GeometryUpdater_default.prototype._isHidden.call(this, entity, wall);
  143879. };
  143880. WallGeometryUpdater.prototype._getIsClosed = function(options) {
  143881. return false;
  143882. };
  143883. WallGeometryUpdater.prototype._isDynamic = function(entity, wall) {
  143884. return !wall.positions.isConstant || !Property_default.isConstant(wall.minimumHeights) || !Property_default.isConstant(wall.maximumHeights) || !Property_default.isConstant(wall.outlineWidth) || !Property_default.isConstant(wall.granularity);
  143885. };
  143886. WallGeometryUpdater.prototype._setStaticOptions = function(entity, wall) {
  143887. const minimumHeights = wall.minimumHeights;
  143888. const maximumHeights = wall.maximumHeights;
  143889. const granularity = wall.granularity;
  143890. const isColorMaterial = this._materialProperty instanceof ColorMaterialProperty_default;
  143891. const options = this._options;
  143892. options.vertexFormat = isColorMaterial ? PerInstanceColorAppearance_default.VERTEX_FORMAT : MaterialAppearance_default.MaterialSupport.TEXTURED.vertexFormat;
  143893. options.positions = wall.positions.getValue(
  143894. Iso8601_default.MINIMUM_VALUE,
  143895. options.positions
  143896. );
  143897. options.minimumHeights = defined_default(minimumHeights) ? minimumHeights.getValue(Iso8601_default.MINIMUM_VALUE, options.minimumHeights) : void 0;
  143898. options.maximumHeights = defined_default(maximumHeights) ? maximumHeights.getValue(Iso8601_default.MINIMUM_VALUE, options.maximumHeights) : void 0;
  143899. options.granularity = defined_default(granularity) ? granularity.getValue(Iso8601_default.MINIMUM_VALUE) : void 0;
  143900. };
  143901. WallGeometryUpdater.DynamicGeometryUpdater = DynamicWallGeometryUpdater;
  143902. function DynamicWallGeometryUpdater(geometryUpdater, primitives, groundPrimitives) {
  143903. DynamicGeometryUpdater_default.call(
  143904. this,
  143905. geometryUpdater,
  143906. primitives,
  143907. groundPrimitives
  143908. );
  143909. }
  143910. if (defined_default(Object.create)) {
  143911. DynamicWallGeometryUpdater.prototype = Object.create(
  143912. DynamicGeometryUpdater_default.prototype
  143913. );
  143914. DynamicWallGeometryUpdater.prototype.constructor = DynamicWallGeometryUpdater;
  143915. }
  143916. DynamicWallGeometryUpdater.prototype._isHidden = function(entity, wall, time) {
  143917. return !defined_default(this._options.positions) || DynamicGeometryUpdater_default.prototype._isHidden.call(this, entity, wall, time);
  143918. };
  143919. DynamicWallGeometryUpdater.prototype._setOptions = function(entity, wall, time) {
  143920. const options = this._options;
  143921. options.positions = Property_default.getValueOrUndefined(
  143922. wall.positions,
  143923. time,
  143924. options.positions
  143925. );
  143926. options.minimumHeights = Property_default.getValueOrUndefined(
  143927. wall.minimumHeights,
  143928. time,
  143929. options.minimumHeights
  143930. );
  143931. options.maximumHeights = Property_default.getValueOrUndefined(
  143932. wall.maximumHeights,
  143933. time,
  143934. options.maximumHeights
  143935. );
  143936. options.granularity = Property_default.getValueOrUndefined(wall.granularity, time);
  143937. };
  143938. var WallGeometryUpdater_default = WallGeometryUpdater;
  143939. // node_modules/cesium/Source/DataSources/GeometryVisualizer.js
  143940. var emptyArray = [];
  143941. var geometryUpdaters = [
  143942. BoxGeometryUpdater_default,
  143943. CylinderGeometryUpdater_default,
  143944. CorridorGeometryUpdater_default,
  143945. EllipseGeometryUpdater_default,
  143946. EllipsoidGeometryUpdater_default,
  143947. PlaneGeometryUpdater_default,
  143948. PolygonGeometryUpdater_default,
  143949. PolylineVolumeGeometryUpdater_default,
  143950. RectangleGeometryUpdater_default,
  143951. WallGeometryUpdater_default
  143952. ];
  143953. function GeometryUpdaterSet(entity, scene) {
  143954. this.entity = entity;
  143955. this.scene = scene;
  143956. const updaters = new Array(geometryUpdaters.length);
  143957. const geometryChanged = new Event_default();
  143958. function raiseEvent(geometry) {
  143959. geometryChanged.raiseEvent(geometry);
  143960. }
  143961. const eventHelper = new EventHelper_default();
  143962. for (let i2 = 0; i2 < updaters.length; i2++) {
  143963. const updater = new geometryUpdaters[i2](entity, scene);
  143964. eventHelper.add(updater.geometryChanged, raiseEvent);
  143965. updaters[i2] = updater;
  143966. }
  143967. this.updaters = updaters;
  143968. this.geometryChanged = geometryChanged;
  143969. this.eventHelper = eventHelper;
  143970. this._removeEntitySubscription = entity.definitionChanged.addEventListener(
  143971. GeometryUpdaterSet.prototype._onEntityPropertyChanged,
  143972. this
  143973. );
  143974. }
  143975. GeometryUpdaterSet.prototype._onEntityPropertyChanged = function(entity, propertyName, newValue, oldValue2) {
  143976. const updaters = this.updaters;
  143977. for (let i2 = 0; i2 < updaters.length; i2++) {
  143978. updaters[i2]._onEntityPropertyChanged(
  143979. entity,
  143980. propertyName,
  143981. newValue,
  143982. oldValue2
  143983. );
  143984. }
  143985. };
  143986. GeometryUpdaterSet.prototype.forEach = function(callback) {
  143987. const updaters = this.updaters;
  143988. for (let i2 = 0; i2 < updaters.length; i2++) {
  143989. callback(updaters[i2]);
  143990. }
  143991. };
  143992. GeometryUpdaterSet.prototype.destroy = function() {
  143993. this.eventHelper.removeAll();
  143994. const updaters = this.updaters;
  143995. for (let i2 = 0; i2 < updaters.length; i2++) {
  143996. updaters[i2].destroy();
  143997. }
  143998. this._removeEntitySubscription();
  143999. destroyObject_default(this);
  144000. };
  144001. function GeometryVisualizer(scene, entityCollection, primitives, groundPrimitives) {
  144002. Check_default.defined("scene", scene);
  144003. Check_default.defined("entityCollection", entityCollection);
  144004. primitives = defaultValue_default(primitives, scene.primitives);
  144005. groundPrimitives = defaultValue_default(groundPrimitives, scene.groundPrimitives);
  144006. this._scene = scene;
  144007. this._primitives = primitives;
  144008. this._groundPrimitives = groundPrimitives;
  144009. this._entityCollection = void 0;
  144010. this._addedObjects = new AssociativeArray_default();
  144011. this._removedObjects = new AssociativeArray_default();
  144012. this._changedObjects = new AssociativeArray_default();
  144013. const numberOfShadowModes = ShadowMode_default.NUMBER_OF_SHADOW_MODES;
  144014. this._outlineBatches = new Array(numberOfShadowModes * 2);
  144015. this._closedColorBatches = new Array(numberOfShadowModes * 2);
  144016. this._closedMaterialBatches = new Array(numberOfShadowModes * 2);
  144017. this._openColorBatches = new Array(numberOfShadowModes * 2);
  144018. this._openMaterialBatches = new Array(numberOfShadowModes * 2);
  144019. const supportsMaterialsforEntitiesOnTerrain = Entity_default.supportsMaterialsforEntitiesOnTerrain(
  144020. scene
  144021. );
  144022. this._supportsMaterialsforEntitiesOnTerrain = supportsMaterialsforEntitiesOnTerrain;
  144023. let i2;
  144024. for (i2 = 0; i2 < numberOfShadowModes; ++i2) {
  144025. this._outlineBatches[i2] = new StaticOutlineGeometryBatch_default(
  144026. primitives,
  144027. scene,
  144028. i2,
  144029. false
  144030. );
  144031. this._outlineBatches[numberOfShadowModes + i2] = new StaticOutlineGeometryBatch_default(primitives, scene, i2, true);
  144032. this._closedColorBatches[i2] = new StaticGeometryColorBatch_default(
  144033. primitives,
  144034. PerInstanceColorAppearance_default,
  144035. void 0,
  144036. true,
  144037. i2,
  144038. true
  144039. );
  144040. this._closedColorBatches[numberOfShadowModes + i2] = new StaticGeometryColorBatch_default(
  144041. primitives,
  144042. PerInstanceColorAppearance_default,
  144043. void 0,
  144044. true,
  144045. i2,
  144046. false
  144047. );
  144048. this._closedMaterialBatches[i2] = new StaticGeometryPerMaterialBatch_default(
  144049. primitives,
  144050. MaterialAppearance_default,
  144051. void 0,
  144052. true,
  144053. i2,
  144054. true
  144055. );
  144056. this._closedMaterialBatches[numberOfShadowModes + i2] = new StaticGeometryPerMaterialBatch_default(
  144057. primitives,
  144058. MaterialAppearance_default,
  144059. void 0,
  144060. true,
  144061. i2,
  144062. false
  144063. );
  144064. this._openColorBatches[i2] = new StaticGeometryColorBatch_default(
  144065. primitives,
  144066. PerInstanceColorAppearance_default,
  144067. void 0,
  144068. false,
  144069. i2,
  144070. true
  144071. );
  144072. this._openColorBatches[numberOfShadowModes + i2] = new StaticGeometryColorBatch_default(
  144073. primitives,
  144074. PerInstanceColorAppearance_default,
  144075. void 0,
  144076. false,
  144077. i2,
  144078. false
  144079. );
  144080. this._openMaterialBatches[i2] = new StaticGeometryPerMaterialBatch_default(
  144081. primitives,
  144082. MaterialAppearance_default,
  144083. void 0,
  144084. false,
  144085. i2,
  144086. true
  144087. );
  144088. this._openMaterialBatches[numberOfShadowModes + i2] = new StaticGeometryPerMaterialBatch_default(
  144089. primitives,
  144090. MaterialAppearance_default,
  144091. void 0,
  144092. false,
  144093. i2,
  144094. false
  144095. );
  144096. }
  144097. const numberOfClassificationTypes = ClassificationType_default.NUMBER_OF_CLASSIFICATION_TYPES;
  144098. const groundColorBatches = new Array(numberOfClassificationTypes);
  144099. const groundMaterialBatches = [];
  144100. if (supportsMaterialsforEntitiesOnTerrain) {
  144101. for (i2 = 0; i2 < numberOfClassificationTypes; ++i2) {
  144102. groundMaterialBatches.push(
  144103. new StaticGroundGeometryPerMaterialBatch_default(
  144104. groundPrimitives,
  144105. i2,
  144106. MaterialAppearance_default
  144107. )
  144108. );
  144109. groundColorBatches[i2] = new StaticGroundGeometryColorBatch_default(
  144110. groundPrimitives,
  144111. i2
  144112. );
  144113. }
  144114. } else {
  144115. for (i2 = 0; i2 < numberOfClassificationTypes; ++i2) {
  144116. groundColorBatches[i2] = new StaticGroundGeometryColorBatch_default(
  144117. groundPrimitives,
  144118. i2
  144119. );
  144120. }
  144121. }
  144122. this._groundColorBatches = groundColorBatches;
  144123. this._groundMaterialBatches = groundMaterialBatches;
  144124. this._dynamicBatch = new DynamicGeometryBatch_default(primitives, groundPrimitives);
  144125. this._batches = this._outlineBatches.concat(
  144126. this._closedColorBatches,
  144127. this._closedMaterialBatches,
  144128. this._openColorBatches,
  144129. this._openMaterialBatches,
  144130. this._groundColorBatches,
  144131. this._groundMaterialBatches,
  144132. this._dynamicBatch
  144133. );
  144134. this._subscriptions = new AssociativeArray_default();
  144135. this._updaterSets = new AssociativeArray_default();
  144136. this._entityCollection = entityCollection;
  144137. entityCollection.collectionChanged.addEventListener(
  144138. GeometryVisualizer.prototype._onCollectionChanged,
  144139. this
  144140. );
  144141. this._onCollectionChanged(
  144142. entityCollection,
  144143. entityCollection.values,
  144144. emptyArray
  144145. );
  144146. }
  144147. GeometryVisualizer.prototype.update = function(time) {
  144148. Check_default.defined("time", time);
  144149. const addedObjects = this._addedObjects;
  144150. const added = addedObjects.values;
  144151. const removedObjects = this._removedObjects;
  144152. const removed = removedObjects.values;
  144153. const changedObjects = this._changedObjects;
  144154. const changed = changedObjects.values;
  144155. let i2;
  144156. let entity;
  144157. let id;
  144158. let updaterSet;
  144159. const that = this;
  144160. for (i2 = changed.length - 1; i2 > -1; i2--) {
  144161. entity = changed[i2];
  144162. id = entity.id;
  144163. updaterSet = this._updaterSets.get(id);
  144164. if (updaterSet.entity === entity) {
  144165. updaterSet.forEach(function(updater) {
  144166. that._removeUpdater(updater);
  144167. that._insertUpdaterIntoBatch(time, updater);
  144168. });
  144169. } else {
  144170. removed.push(entity);
  144171. added.push(entity);
  144172. }
  144173. }
  144174. for (i2 = removed.length - 1; i2 > -1; i2--) {
  144175. entity = removed[i2];
  144176. id = entity.id;
  144177. updaterSet = this._updaterSets.get(id);
  144178. updaterSet.forEach(this._removeUpdater.bind(this));
  144179. updaterSet.destroy();
  144180. this._updaterSets.remove(id);
  144181. this._subscriptions.get(id)();
  144182. this._subscriptions.remove(id);
  144183. }
  144184. for (i2 = added.length - 1; i2 > -1; i2--) {
  144185. entity = added[i2];
  144186. id = entity.id;
  144187. updaterSet = new GeometryUpdaterSet(entity, this._scene);
  144188. this._updaterSets.set(id, updaterSet);
  144189. updaterSet.forEach(function(updater) {
  144190. that._insertUpdaterIntoBatch(time, updater);
  144191. });
  144192. this._subscriptions.set(
  144193. id,
  144194. updaterSet.geometryChanged.addEventListener(
  144195. GeometryVisualizer._onGeometryChanged,
  144196. this
  144197. )
  144198. );
  144199. }
  144200. addedObjects.removeAll();
  144201. removedObjects.removeAll();
  144202. changedObjects.removeAll();
  144203. let isUpdated = true;
  144204. const batches = this._batches;
  144205. const length3 = batches.length;
  144206. for (i2 = 0; i2 < length3; i2++) {
  144207. isUpdated = batches[i2].update(time) && isUpdated;
  144208. }
  144209. return isUpdated;
  144210. };
  144211. var getBoundingSphereArrayScratch = [];
  144212. var getBoundingSphereBoundingSphereScratch = new BoundingSphere_default();
  144213. GeometryVisualizer.prototype.getBoundingSphere = function(entity, result) {
  144214. Check_default.defined("entity", entity);
  144215. Check_default.defined("result", result);
  144216. const boundingSpheres = getBoundingSphereArrayScratch;
  144217. const tmp2 = getBoundingSphereBoundingSphereScratch;
  144218. let count = 0;
  144219. let state = BoundingSphereState_default.DONE;
  144220. const batches = this._batches;
  144221. const batchesLength = batches.length;
  144222. const id = entity.id;
  144223. const updaters = this._updaterSets.get(id).updaters;
  144224. for (let j = 0; j < updaters.length; j++) {
  144225. const updater = updaters[j];
  144226. for (let i2 = 0; i2 < batchesLength; i2++) {
  144227. state = batches[i2].getBoundingSphere(updater, tmp2);
  144228. if (state === BoundingSphereState_default.PENDING) {
  144229. return BoundingSphereState_default.PENDING;
  144230. } else if (state === BoundingSphereState_default.DONE) {
  144231. boundingSpheres[count] = BoundingSphere_default.clone(
  144232. tmp2,
  144233. boundingSpheres[count]
  144234. );
  144235. count++;
  144236. }
  144237. }
  144238. }
  144239. if (count === 0) {
  144240. return BoundingSphereState_default.FAILED;
  144241. }
  144242. boundingSpheres.length = count;
  144243. BoundingSphere_default.fromBoundingSpheres(boundingSpheres, result);
  144244. return BoundingSphereState_default.DONE;
  144245. };
  144246. GeometryVisualizer.prototype.isDestroyed = function() {
  144247. return false;
  144248. };
  144249. GeometryVisualizer.prototype.destroy = function() {
  144250. this._entityCollection.collectionChanged.removeEventListener(
  144251. GeometryVisualizer.prototype._onCollectionChanged,
  144252. this
  144253. );
  144254. this._addedObjects.removeAll();
  144255. this._removedObjects.removeAll();
  144256. let i2;
  144257. const batches = this._batches;
  144258. let length3 = batches.length;
  144259. for (i2 = 0; i2 < length3; i2++) {
  144260. batches[i2].removeAllPrimitives();
  144261. }
  144262. const subscriptions = this._subscriptions.values;
  144263. length3 = subscriptions.length;
  144264. for (i2 = 0; i2 < length3; i2++) {
  144265. subscriptions[i2]();
  144266. }
  144267. this._subscriptions.removeAll();
  144268. const updaterSets = this._updaterSets.values;
  144269. length3 = updaterSets.length;
  144270. for (i2 = 0; i2 < length3; i2++) {
  144271. updaterSets[i2].destroy();
  144272. }
  144273. this._updaterSets.removeAll();
  144274. return destroyObject_default(this);
  144275. };
  144276. GeometryVisualizer.prototype._removeUpdater = function(updater) {
  144277. const batches = this._batches;
  144278. const length3 = batches.length;
  144279. for (let i2 = 0; i2 < length3; i2++) {
  144280. batches[i2].remove(updater);
  144281. }
  144282. };
  144283. GeometryVisualizer.prototype._insertUpdaterIntoBatch = function(time, updater) {
  144284. if (updater.isDynamic) {
  144285. this._dynamicBatch.add(time, updater);
  144286. return;
  144287. }
  144288. let shadows;
  144289. if (updater.outlineEnabled || updater.fillEnabled) {
  144290. shadows = updater.shadowsProperty.getValue(time);
  144291. }
  144292. const numberOfShadowModes = ShadowMode_default.NUMBER_OF_SHADOW_MODES;
  144293. if (updater.outlineEnabled) {
  144294. if (defined_default(updater.terrainOffsetProperty)) {
  144295. this._outlineBatches[numberOfShadowModes + shadows].add(time, updater);
  144296. } else {
  144297. this._outlineBatches[shadows].add(time, updater);
  144298. }
  144299. }
  144300. if (updater.fillEnabled) {
  144301. if (updater.onTerrain) {
  144302. const classificationType = updater.classificationTypeProperty.getValue(
  144303. time
  144304. );
  144305. if (updater.fillMaterialProperty instanceof ColorMaterialProperty_default) {
  144306. this._groundColorBatches[classificationType].add(time, updater);
  144307. } else {
  144308. this._groundMaterialBatches[classificationType].add(time, updater);
  144309. }
  144310. } else if (updater.isClosed) {
  144311. if (updater.fillMaterialProperty instanceof ColorMaterialProperty_default) {
  144312. if (defined_default(updater.terrainOffsetProperty)) {
  144313. this._closedColorBatches[numberOfShadowModes + shadows].add(
  144314. time,
  144315. updater
  144316. );
  144317. } else {
  144318. this._closedColorBatches[shadows].add(time, updater);
  144319. }
  144320. } else if (defined_default(updater.terrainOffsetProperty)) {
  144321. this._closedMaterialBatches[numberOfShadowModes + shadows].add(
  144322. time,
  144323. updater
  144324. );
  144325. } else {
  144326. this._closedMaterialBatches[shadows].add(time, updater);
  144327. }
  144328. } else if (updater.fillMaterialProperty instanceof ColorMaterialProperty_default) {
  144329. if (defined_default(updater.terrainOffsetProperty)) {
  144330. this._openColorBatches[numberOfShadowModes + shadows].add(
  144331. time,
  144332. updater
  144333. );
  144334. } else {
  144335. this._openColorBatches[shadows].add(time, updater);
  144336. }
  144337. } else if (defined_default(updater.terrainOffsetProperty)) {
  144338. this._openMaterialBatches[numberOfShadowModes + shadows].add(
  144339. time,
  144340. updater
  144341. );
  144342. } else {
  144343. this._openMaterialBatches[shadows].add(time, updater);
  144344. }
  144345. }
  144346. };
  144347. GeometryVisualizer._onGeometryChanged = function(updater) {
  144348. const removedObjects = this._removedObjects;
  144349. const changedObjects = this._changedObjects;
  144350. const entity = updater.entity;
  144351. const id = entity.id;
  144352. if (!defined_default(removedObjects.get(id)) && !defined_default(changedObjects.get(id))) {
  144353. changedObjects.set(id, entity);
  144354. }
  144355. };
  144356. GeometryVisualizer.prototype._onCollectionChanged = function(entityCollection, added, removed) {
  144357. const addedObjects = this._addedObjects;
  144358. const removedObjects = this._removedObjects;
  144359. const changedObjects = this._changedObjects;
  144360. let i2;
  144361. let id;
  144362. let entity;
  144363. for (i2 = removed.length - 1; i2 > -1; i2--) {
  144364. entity = removed[i2];
  144365. id = entity.id;
  144366. if (!addedObjects.remove(id)) {
  144367. removedObjects.set(id, entity);
  144368. changedObjects.remove(id);
  144369. }
  144370. }
  144371. for (i2 = added.length - 1; i2 > -1; i2--) {
  144372. entity = added[i2];
  144373. id = entity.id;
  144374. if (removedObjects.remove(id)) {
  144375. changedObjects.set(id, entity);
  144376. } else {
  144377. addedObjects.set(id, entity);
  144378. }
  144379. }
  144380. };
  144381. var GeometryVisualizer_default = GeometryVisualizer;
  144382. // node_modules/cesium/Source/DataSources/LabelVisualizer.js
  144383. var defaultScale4 = 1;
  144384. var defaultFont = "30px sans-serif";
  144385. var defaultStyle = LabelStyle_default.FILL;
  144386. var defaultFillColor = Color_default.WHITE;
  144387. var defaultOutlineColor3 = Color_default.BLACK;
  144388. var defaultOutlineWidth2 = 1;
  144389. var defaultShowBackground = false;
  144390. var defaultBackgroundColor2 = new Color_default(0.165, 0.165, 0.165, 0.8);
  144391. var defaultBackgroundPadding2 = new Cartesian2_default(7, 5);
  144392. var defaultPixelOffset2 = Cartesian2_default.ZERO;
  144393. var defaultEyeOffset2 = Cartesian3_default.ZERO;
  144394. var defaultHeightReference2 = HeightReference_default.NONE;
  144395. var defaultHorizontalOrigin2 = HorizontalOrigin_default.CENTER;
  144396. var defaultVerticalOrigin2 = VerticalOrigin_default.CENTER;
  144397. var positionScratch12 = new Cartesian3_default();
  144398. var fillColorScratch = new Color_default();
  144399. var outlineColorScratch = new Color_default();
  144400. var backgroundColorScratch = new Color_default();
  144401. var backgroundPaddingScratch = new Cartesian2_default();
  144402. var eyeOffsetScratch2 = new Cartesian3_default();
  144403. var pixelOffsetScratch2 = new Cartesian2_default();
  144404. var translucencyByDistanceScratch2 = new NearFarScalar_default();
  144405. var pixelOffsetScaleByDistanceScratch2 = new NearFarScalar_default();
  144406. var scaleByDistanceScratch2 = new NearFarScalar_default();
  144407. var distanceDisplayConditionScratch7 = new DistanceDisplayCondition_default();
  144408. function EntityData2(entity) {
  144409. this.entity = entity;
  144410. this.label = void 0;
  144411. this.index = void 0;
  144412. }
  144413. function LabelVisualizer(entityCluster, entityCollection) {
  144414. if (!defined_default(entityCluster)) {
  144415. throw new DeveloperError_default("entityCluster is required.");
  144416. }
  144417. if (!defined_default(entityCollection)) {
  144418. throw new DeveloperError_default("entityCollection is required.");
  144419. }
  144420. entityCollection.collectionChanged.addEventListener(
  144421. LabelVisualizer.prototype._onCollectionChanged,
  144422. this
  144423. );
  144424. this._cluster = entityCluster;
  144425. this._entityCollection = entityCollection;
  144426. this._items = new AssociativeArray_default();
  144427. this._onCollectionChanged(entityCollection, entityCollection.values, [], []);
  144428. }
  144429. LabelVisualizer.prototype.update = function(time) {
  144430. if (!defined_default(time)) {
  144431. throw new DeveloperError_default("time is required.");
  144432. }
  144433. const items = this._items.values;
  144434. const cluster = this._cluster;
  144435. for (let i2 = 0, len = items.length; i2 < len; i2++) {
  144436. const item = items[i2];
  144437. const entity = item.entity;
  144438. const labelGraphics = entity._label;
  144439. let text2;
  144440. let label = item.label;
  144441. let show = entity.isShowing && entity.isAvailable(time) && Property_default.getValueOrDefault(labelGraphics._show, time, true);
  144442. let position;
  144443. if (show) {
  144444. position = Property_default.getValueOrUndefined(
  144445. entity._position,
  144446. time,
  144447. positionScratch12
  144448. );
  144449. text2 = Property_default.getValueOrUndefined(labelGraphics._text, time);
  144450. show = defined_default(position) && defined_default(text2);
  144451. }
  144452. if (!show) {
  144453. returnPrimitive2(item, entity, cluster);
  144454. continue;
  144455. }
  144456. if (!Property_default.isConstant(entity._position)) {
  144457. cluster._clusterDirty = true;
  144458. }
  144459. let updateClamping2 = false;
  144460. const heightReference = Property_default.getValueOrDefault(
  144461. labelGraphics._heightReference,
  144462. time,
  144463. defaultHeightReference2
  144464. );
  144465. if (!defined_default(label)) {
  144466. label = cluster.getLabel(entity);
  144467. label.id = entity;
  144468. item.label = label;
  144469. updateClamping2 = Cartesian3_default.equals(label.position, position) && label.heightReference === heightReference;
  144470. }
  144471. label.show = true;
  144472. label.position = position;
  144473. label.text = text2;
  144474. label.scale = Property_default.getValueOrDefault(
  144475. labelGraphics._scale,
  144476. time,
  144477. defaultScale4
  144478. );
  144479. label.font = Property_default.getValueOrDefault(
  144480. labelGraphics._font,
  144481. time,
  144482. defaultFont
  144483. );
  144484. label.style = Property_default.getValueOrDefault(
  144485. labelGraphics._style,
  144486. time,
  144487. defaultStyle
  144488. );
  144489. label.fillColor = Property_default.getValueOrDefault(
  144490. labelGraphics._fillColor,
  144491. time,
  144492. defaultFillColor,
  144493. fillColorScratch
  144494. );
  144495. label.outlineColor = Property_default.getValueOrDefault(
  144496. labelGraphics._outlineColor,
  144497. time,
  144498. defaultOutlineColor3,
  144499. outlineColorScratch
  144500. );
  144501. label.outlineWidth = Property_default.getValueOrDefault(
  144502. labelGraphics._outlineWidth,
  144503. time,
  144504. defaultOutlineWidth2
  144505. );
  144506. label.showBackground = Property_default.getValueOrDefault(
  144507. labelGraphics._showBackground,
  144508. time,
  144509. defaultShowBackground
  144510. );
  144511. label.backgroundColor = Property_default.getValueOrDefault(
  144512. labelGraphics._backgroundColor,
  144513. time,
  144514. defaultBackgroundColor2,
  144515. backgroundColorScratch
  144516. );
  144517. label.backgroundPadding = Property_default.getValueOrDefault(
  144518. labelGraphics._backgroundPadding,
  144519. time,
  144520. defaultBackgroundPadding2,
  144521. backgroundPaddingScratch
  144522. );
  144523. label.pixelOffset = Property_default.getValueOrDefault(
  144524. labelGraphics._pixelOffset,
  144525. time,
  144526. defaultPixelOffset2,
  144527. pixelOffsetScratch2
  144528. );
  144529. label.eyeOffset = Property_default.getValueOrDefault(
  144530. labelGraphics._eyeOffset,
  144531. time,
  144532. defaultEyeOffset2,
  144533. eyeOffsetScratch2
  144534. );
  144535. label.heightReference = heightReference;
  144536. label.horizontalOrigin = Property_default.getValueOrDefault(
  144537. labelGraphics._horizontalOrigin,
  144538. time,
  144539. defaultHorizontalOrigin2
  144540. );
  144541. label.verticalOrigin = Property_default.getValueOrDefault(
  144542. labelGraphics._verticalOrigin,
  144543. time,
  144544. defaultVerticalOrigin2
  144545. );
  144546. label.translucencyByDistance = Property_default.getValueOrUndefined(
  144547. labelGraphics._translucencyByDistance,
  144548. time,
  144549. translucencyByDistanceScratch2
  144550. );
  144551. label.pixelOffsetScaleByDistance = Property_default.getValueOrUndefined(
  144552. labelGraphics._pixelOffsetScaleByDistance,
  144553. time,
  144554. pixelOffsetScaleByDistanceScratch2
  144555. );
  144556. label.scaleByDistance = Property_default.getValueOrUndefined(
  144557. labelGraphics._scaleByDistance,
  144558. time,
  144559. scaleByDistanceScratch2
  144560. );
  144561. label.distanceDisplayCondition = Property_default.getValueOrUndefined(
  144562. labelGraphics._distanceDisplayCondition,
  144563. time,
  144564. distanceDisplayConditionScratch7
  144565. );
  144566. label.disableDepthTestDistance = Property_default.getValueOrUndefined(
  144567. labelGraphics._disableDepthTestDistance,
  144568. time
  144569. );
  144570. if (updateClamping2) {
  144571. label._updateClamping();
  144572. }
  144573. }
  144574. return true;
  144575. };
  144576. LabelVisualizer.prototype.getBoundingSphere = function(entity, result) {
  144577. if (!defined_default(entity)) {
  144578. throw new DeveloperError_default("entity is required.");
  144579. }
  144580. if (!defined_default(result)) {
  144581. throw new DeveloperError_default("result is required.");
  144582. }
  144583. const item = this._items.get(entity.id);
  144584. if (!defined_default(item) || !defined_default(item.label)) {
  144585. return BoundingSphereState_default.FAILED;
  144586. }
  144587. const label = item.label;
  144588. result.center = Cartesian3_default.clone(
  144589. defaultValue_default(label._clampedPosition, label.position),
  144590. result.center
  144591. );
  144592. result.radius = 0;
  144593. return BoundingSphereState_default.DONE;
  144594. };
  144595. LabelVisualizer.prototype.isDestroyed = function() {
  144596. return false;
  144597. };
  144598. LabelVisualizer.prototype.destroy = function() {
  144599. this._entityCollection.collectionChanged.removeEventListener(
  144600. LabelVisualizer.prototype._onCollectionChanged,
  144601. this
  144602. );
  144603. const entities = this._entityCollection.values;
  144604. for (let i2 = 0; i2 < entities.length; i2++) {
  144605. this._cluster.removeLabel(entities[i2]);
  144606. }
  144607. return destroyObject_default(this);
  144608. };
  144609. LabelVisualizer.prototype._onCollectionChanged = function(entityCollection, added, removed, changed) {
  144610. let i2;
  144611. let entity;
  144612. const items = this._items;
  144613. const cluster = this._cluster;
  144614. for (i2 = added.length - 1; i2 > -1; i2--) {
  144615. entity = added[i2];
  144616. if (defined_default(entity._label) && defined_default(entity._position)) {
  144617. items.set(entity.id, new EntityData2(entity));
  144618. }
  144619. }
  144620. for (i2 = changed.length - 1; i2 > -1; i2--) {
  144621. entity = changed[i2];
  144622. if (defined_default(entity._label) && defined_default(entity._position)) {
  144623. if (!items.contains(entity.id)) {
  144624. items.set(entity.id, new EntityData2(entity));
  144625. }
  144626. } else {
  144627. returnPrimitive2(items.get(entity.id), entity, cluster);
  144628. items.remove(entity.id);
  144629. }
  144630. }
  144631. for (i2 = removed.length - 1; i2 > -1; i2--) {
  144632. entity = removed[i2];
  144633. returnPrimitive2(items.get(entity.id), entity, cluster);
  144634. items.remove(entity.id);
  144635. }
  144636. };
  144637. function returnPrimitive2(item, entity, cluster) {
  144638. if (defined_default(item)) {
  144639. item.label = void 0;
  144640. cluster.removeLabel(entity);
  144641. }
  144642. }
  144643. var LabelVisualizer_default = LabelVisualizer;
  144644. // node_modules/cesium/Source/DataSources/ModelVisualizer.js
  144645. var defaultScale5 = 1;
  144646. var defaultMinimumPixelSize = 0;
  144647. var defaultIncrementallyLoadTextures = true;
  144648. var defaultClampAnimations = true;
  144649. var defaultShadows2 = ShadowMode_default.ENABLED;
  144650. var defaultHeightReference3 = HeightReference_default.NONE;
  144651. var defaultSilhouetteColor = Color_default.RED;
  144652. var defaultSilhouetteSize = 0;
  144653. var defaultColor7 = Color_default.WHITE;
  144654. var defaultColorBlendMode = ColorBlendMode_default.HIGHLIGHT;
  144655. var defaultColorBlendAmount = 0.5;
  144656. var defaultImageBasedLightingFactor = new Cartesian2_default(1, 1);
  144657. var modelMatrixScratch2 = new Matrix4_default();
  144658. var nodeMatrixScratch = new Matrix4_default();
  144659. function ModelVisualizer(scene, entityCollection) {
  144660. if (!defined_default(scene)) {
  144661. throw new DeveloperError_default("scene is required.");
  144662. }
  144663. if (!defined_default(entityCollection)) {
  144664. throw new DeveloperError_default("entityCollection is required.");
  144665. }
  144666. entityCollection.collectionChanged.addEventListener(
  144667. ModelVisualizer.prototype._onCollectionChanged,
  144668. this
  144669. );
  144670. this._scene = scene;
  144671. this._primitives = scene.primitives;
  144672. this._entityCollection = entityCollection;
  144673. this._modelHash = {};
  144674. this._entitiesToVisualize = new AssociativeArray_default();
  144675. this._onCollectionChanged(entityCollection, entityCollection.values, [], []);
  144676. }
  144677. ModelVisualizer.prototype.update = function(time) {
  144678. if (!defined_default(time)) {
  144679. throw new DeveloperError_default("time is required.");
  144680. }
  144681. const entities = this._entitiesToVisualize.values;
  144682. const modelHash = this._modelHash;
  144683. const primitives = this._primitives;
  144684. for (let i2 = 0, len = entities.length; i2 < len; i2++) {
  144685. const entity = entities[i2];
  144686. const modelGraphics = entity._model;
  144687. let resource;
  144688. let modelData = modelHash[entity.id];
  144689. let show = entity.isShowing && entity.isAvailable(time) && Property_default.getValueOrDefault(modelGraphics._show, time, true);
  144690. let modelMatrix;
  144691. if (show) {
  144692. modelMatrix = entity.computeModelMatrix(time, modelMatrixScratch2);
  144693. resource = Resource_default.createIfNeeded(
  144694. Property_default.getValueOrUndefined(modelGraphics._uri, time)
  144695. );
  144696. show = defined_default(modelMatrix) && defined_default(resource);
  144697. }
  144698. if (!show) {
  144699. if (defined_default(modelData)) {
  144700. modelData.modelPrimitive.show = false;
  144701. }
  144702. continue;
  144703. }
  144704. let model = defined_default(modelData) ? modelData.modelPrimitive : void 0;
  144705. if (!defined_default(model) || resource.url !== modelData.url) {
  144706. if (defined_default(model)) {
  144707. primitives.removeAndDestroy(model);
  144708. delete modelHash[entity.id];
  144709. }
  144710. model = Model_default.fromGltf({
  144711. url: resource,
  144712. incrementallyLoadTextures: Property_default.getValueOrDefault(
  144713. modelGraphics._incrementallyLoadTextures,
  144714. time,
  144715. defaultIncrementallyLoadTextures
  144716. ),
  144717. scene: this._scene
  144718. });
  144719. model.id = entity;
  144720. primitives.add(model);
  144721. modelData = {
  144722. modelPrimitive: model,
  144723. url: resource.url,
  144724. animationsRunning: false,
  144725. nodeTransformationsScratch: {},
  144726. articulationsScratch: {},
  144727. loadFail: false
  144728. };
  144729. modelHash[entity.id] = modelData;
  144730. checkModelLoad(model, entity, modelHash);
  144731. }
  144732. model.show = true;
  144733. model.scale = Property_default.getValueOrDefault(
  144734. modelGraphics._scale,
  144735. time,
  144736. defaultScale5
  144737. );
  144738. model.minimumPixelSize = Property_default.getValueOrDefault(
  144739. modelGraphics._minimumPixelSize,
  144740. time,
  144741. defaultMinimumPixelSize
  144742. );
  144743. model.maximumScale = Property_default.getValueOrUndefined(
  144744. modelGraphics._maximumScale,
  144745. time
  144746. );
  144747. model.modelMatrix = Matrix4_default.clone(modelMatrix, model.modelMatrix);
  144748. model.shadows = Property_default.getValueOrDefault(
  144749. modelGraphics._shadows,
  144750. time,
  144751. defaultShadows2
  144752. );
  144753. model.heightReference = Property_default.getValueOrDefault(
  144754. modelGraphics._heightReference,
  144755. time,
  144756. defaultHeightReference3
  144757. );
  144758. model.distanceDisplayCondition = Property_default.getValueOrUndefined(
  144759. modelGraphics._distanceDisplayCondition,
  144760. time
  144761. );
  144762. model.silhouetteColor = Property_default.getValueOrDefault(
  144763. modelGraphics._silhouetteColor,
  144764. time,
  144765. defaultSilhouetteColor,
  144766. model._silhouetteColor
  144767. );
  144768. model.silhouetteSize = Property_default.getValueOrDefault(
  144769. modelGraphics._silhouetteSize,
  144770. time,
  144771. defaultSilhouetteSize
  144772. );
  144773. model.color = Property_default.getValueOrDefault(
  144774. modelGraphics._color,
  144775. time,
  144776. defaultColor7,
  144777. model._color
  144778. );
  144779. model.colorBlendMode = Property_default.getValueOrDefault(
  144780. modelGraphics._colorBlendMode,
  144781. time,
  144782. defaultColorBlendMode
  144783. );
  144784. model.colorBlendAmount = Property_default.getValueOrDefault(
  144785. modelGraphics._colorBlendAmount,
  144786. time,
  144787. defaultColorBlendAmount
  144788. );
  144789. model.clippingPlanes = Property_default.getValueOrUndefined(
  144790. modelGraphics._clippingPlanes,
  144791. time
  144792. );
  144793. model.clampAnimations = Property_default.getValueOrDefault(
  144794. modelGraphics._clampAnimations,
  144795. time,
  144796. defaultClampAnimations
  144797. );
  144798. model.imageBasedLighting.imageBasedLightingFactor = Property_default.getValueOrDefault(
  144799. modelGraphics._imageBasedLightingFactor,
  144800. time,
  144801. defaultImageBasedLightingFactor
  144802. );
  144803. model.lightColor = Property_default.getValueOrUndefined(
  144804. modelGraphics._lightColor,
  144805. time
  144806. );
  144807. if (model.ready) {
  144808. const runAnimations = Property_default.getValueOrDefault(
  144809. modelGraphics._runAnimations,
  144810. time,
  144811. true
  144812. );
  144813. if (modelData.animationsRunning !== runAnimations) {
  144814. if (runAnimations) {
  144815. model.activeAnimations.addAll({
  144816. loop: ModelAnimationLoop_default.REPEAT
  144817. });
  144818. } else {
  144819. model.activeAnimations.removeAll();
  144820. }
  144821. modelData.animationsRunning = runAnimations;
  144822. }
  144823. const nodeTransformations = Property_default.getValueOrUndefined(
  144824. modelGraphics._nodeTransformations,
  144825. time,
  144826. modelData.nodeTransformationsScratch
  144827. );
  144828. if (defined_default(nodeTransformations)) {
  144829. const nodeNames = Object.keys(nodeTransformations);
  144830. for (let nodeIndex = 0, nodeLength = nodeNames.length; nodeIndex < nodeLength; ++nodeIndex) {
  144831. const nodeName = nodeNames[nodeIndex];
  144832. const nodeTransformation = nodeTransformations[nodeName];
  144833. if (!defined_default(nodeTransformation)) {
  144834. continue;
  144835. }
  144836. const modelNode = model.getNode(nodeName);
  144837. if (!defined_default(modelNode)) {
  144838. continue;
  144839. }
  144840. const transformationMatrix = Matrix4_default.fromTranslationRotationScale(
  144841. nodeTransformation,
  144842. nodeMatrixScratch
  144843. );
  144844. modelNode.matrix = Matrix4_default.multiply(
  144845. modelNode.originalMatrix,
  144846. transformationMatrix,
  144847. transformationMatrix
  144848. );
  144849. }
  144850. }
  144851. let anyArticulationUpdated = false;
  144852. const articulations = Property_default.getValueOrUndefined(
  144853. modelGraphics._articulations,
  144854. time,
  144855. modelData.articulationsScratch
  144856. );
  144857. if (defined_default(articulations)) {
  144858. const articulationStageKeys = Object.keys(articulations);
  144859. for (let s2 = 0, numKeys = articulationStageKeys.length; s2 < numKeys; ++s2) {
  144860. const key = articulationStageKeys[s2];
  144861. const articulationStageValue = articulations[key];
  144862. if (!defined_default(articulationStageValue)) {
  144863. continue;
  144864. }
  144865. anyArticulationUpdated = true;
  144866. model.setArticulationStage(key, articulationStageValue);
  144867. }
  144868. }
  144869. if (anyArticulationUpdated) {
  144870. model.applyArticulations();
  144871. }
  144872. }
  144873. }
  144874. return true;
  144875. };
  144876. ModelVisualizer.prototype.isDestroyed = function() {
  144877. return false;
  144878. };
  144879. ModelVisualizer.prototype.destroy = function() {
  144880. this._entityCollection.collectionChanged.removeEventListener(
  144881. ModelVisualizer.prototype._onCollectionChanged,
  144882. this
  144883. );
  144884. const entities = this._entitiesToVisualize.values;
  144885. const modelHash = this._modelHash;
  144886. const primitives = this._primitives;
  144887. for (let i2 = entities.length - 1; i2 > -1; i2--) {
  144888. removeModel(this, entities[i2], modelHash, primitives);
  144889. }
  144890. return destroyObject_default(this);
  144891. };
  144892. ModelVisualizer.prototype.getBoundingSphere = function(entity, result) {
  144893. if (!defined_default(entity)) {
  144894. throw new DeveloperError_default("entity is required.");
  144895. }
  144896. if (!defined_default(result)) {
  144897. throw new DeveloperError_default("result is required.");
  144898. }
  144899. const modelData = this._modelHash[entity.id];
  144900. if (!defined_default(modelData) || modelData.loadFail) {
  144901. return BoundingSphereState_default.FAILED;
  144902. }
  144903. const model = modelData.modelPrimitive;
  144904. if (!defined_default(model) || !model.show) {
  144905. return BoundingSphereState_default.FAILED;
  144906. }
  144907. if (!model.ready) {
  144908. return BoundingSphereState_default.PENDING;
  144909. }
  144910. if (model.heightReference === HeightReference_default.NONE) {
  144911. BoundingSphere_default.transform(model.boundingSphere, model.modelMatrix, result);
  144912. } else {
  144913. if (!defined_default(model._clampedModelMatrix)) {
  144914. return BoundingSphereState_default.PENDING;
  144915. }
  144916. BoundingSphere_default.transform(
  144917. model.boundingSphere,
  144918. model._clampedModelMatrix,
  144919. result
  144920. );
  144921. }
  144922. return BoundingSphereState_default.DONE;
  144923. };
  144924. ModelVisualizer.prototype._onCollectionChanged = function(entityCollection, added, removed, changed) {
  144925. let i2;
  144926. let entity;
  144927. const entities = this._entitiesToVisualize;
  144928. const modelHash = this._modelHash;
  144929. const primitives = this._primitives;
  144930. for (i2 = added.length - 1; i2 > -1; i2--) {
  144931. entity = added[i2];
  144932. if (defined_default(entity._model) && defined_default(entity._position)) {
  144933. entities.set(entity.id, entity);
  144934. }
  144935. }
  144936. for (i2 = changed.length - 1; i2 > -1; i2--) {
  144937. entity = changed[i2];
  144938. if (defined_default(entity._model) && defined_default(entity._position)) {
  144939. clearNodeTransformationsArticulationsScratch(entity, modelHash);
  144940. entities.set(entity.id, entity);
  144941. } else {
  144942. removeModel(this, entity, modelHash, primitives);
  144943. entities.remove(entity.id);
  144944. }
  144945. }
  144946. for (i2 = removed.length - 1; i2 > -1; i2--) {
  144947. entity = removed[i2];
  144948. removeModel(this, entity, modelHash, primitives);
  144949. entities.remove(entity.id);
  144950. }
  144951. };
  144952. function removeModel(visualizer, entity, modelHash, primitives) {
  144953. const modelData = modelHash[entity.id];
  144954. if (defined_default(modelData)) {
  144955. primitives.removeAndDestroy(modelData.modelPrimitive);
  144956. delete modelHash[entity.id];
  144957. }
  144958. }
  144959. function clearNodeTransformationsArticulationsScratch(entity, modelHash) {
  144960. const modelData = modelHash[entity.id];
  144961. if (defined_default(modelData)) {
  144962. modelData.nodeTransformationsScratch = {};
  144963. modelData.articulationsScratch = {};
  144964. }
  144965. }
  144966. function checkModelLoad(model, entity, modelHash) {
  144967. model.readyPromise.catch(function(error) {
  144968. console.error(error);
  144969. modelHash[entity.id].loadFail = true;
  144970. });
  144971. }
  144972. var ModelVisualizer_default = ModelVisualizer;
  144973. // node_modules/cesium/Source/DataSources/ScaledPositionProperty.js
  144974. function ScaledPositionProperty(value) {
  144975. this._definitionChanged = new Event_default();
  144976. this._value = void 0;
  144977. this._removeSubscription = void 0;
  144978. this.setValue(value);
  144979. }
  144980. Object.defineProperties(ScaledPositionProperty.prototype, {
  144981. isConstant: {
  144982. get: function() {
  144983. return Property_default.isConstant(this._value);
  144984. }
  144985. },
  144986. definitionChanged: {
  144987. get: function() {
  144988. return this._definitionChanged;
  144989. }
  144990. },
  144991. referenceFrame: {
  144992. get: function() {
  144993. return defined_default(this._value) ? this._value.referenceFrame : ReferenceFrame_default.FIXED;
  144994. }
  144995. }
  144996. });
  144997. ScaledPositionProperty.prototype.getValue = function(time, result) {
  144998. return this.getValueInReferenceFrame(time, ReferenceFrame_default.FIXED, result);
  144999. };
  145000. ScaledPositionProperty.prototype.setValue = function(value) {
  145001. if (this._value !== value) {
  145002. this._value = value;
  145003. if (defined_default(this._removeSubscription)) {
  145004. this._removeSubscription();
  145005. this._removeSubscription = void 0;
  145006. }
  145007. if (defined_default(value)) {
  145008. this._removeSubscription = value.definitionChanged.addEventListener(
  145009. this._raiseDefinitionChanged,
  145010. this
  145011. );
  145012. }
  145013. this._definitionChanged.raiseEvent(this);
  145014. }
  145015. };
  145016. ScaledPositionProperty.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) {
  145017. if (!defined_default(time)) {
  145018. throw new DeveloperError_default("time is required.");
  145019. }
  145020. if (!defined_default(referenceFrame)) {
  145021. throw new DeveloperError_default("referenceFrame is required.");
  145022. }
  145023. if (!defined_default(this._value)) {
  145024. return void 0;
  145025. }
  145026. result = this._value.getValueInReferenceFrame(time, referenceFrame, result);
  145027. return defined_default(result) ? Ellipsoid_default.WGS84.scaleToGeodeticSurface(result, result) : void 0;
  145028. };
  145029. ScaledPositionProperty.prototype.equals = function(other) {
  145030. return this === other || other instanceof ScaledPositionProperty && this._value === other._value;
  145031. };
  145032. ScaledPositionProperty.prototype._raiseDefinitionChanged = function() {
  145033. this._definitionChanged.raiseEvent(this);
  145034. };
  145035. var ScaledPositionProperty_default = ScaledPositionProperty;
  145036. // node_modules/cesium/Source/DataSources/PathVisualizer.js
  145037. var defaultResolution = 60;
  145038. var defaultWidth = 1;
  145039. var scratchTimeInterval2 = new TimeInterval_default();
  145040. var subSampleCompositePropertyScratch = new TimeInterval_default();
  145041. var subSampleIntervalPropertyScratch = new TimeInterval_default();
  145042. function EntityData3(entity) {
  145043. this.entity = entity;
  145044. this.polyline = void 0;
  145045. this.index = void 0;
  145046. this.updater = void 0;
  145047. }
  145048. function subSampleSampledProperty(property, start, stop2, times, updateTime, referenceFrame, maximumStep, startingIndex, result) {
  145049. let r2 = startingIndex;
  145050. let tmp2;
  145051. tmp2 = property.getValueInReferenceFrame(start, referenceFrame, result[r2]);
  145052. if (defined_default(tmp2)) {
  145053. result[r2++] = tmp2;
  145054. }
  145055. let steppedOnNow = !defined_default(updateTime) || JulianDate_default.lessThanOrEquals(updateTime, start) || JulianDate_default.greaterThanOrEquals(updateTime, stop2);
  145056. let t = 0;
  145057. const len = times.length;
  145058. let current = times[t];
  145059. const loopStop = stop2;
  145060. let sampling = false;
  145061. let sampleStepsToTake;
  145062. let sampleStepsTaken;
  145063. let sampleStepSize;
  145064. while (t < len) {
  145065. if (!steppedOnNow && JulianDate_default.greaterThanOrEquals(current, updateTime)) {
  145066. tmp2 = property.getValueInReferenceFrame(
  145067. updateTime,
  145068. referenceFrame,
  145069. result[r2]
  145070. );
  145071. if (defined_default(tmp2)) {
  145072. result[r2++] = tmp2;
  145073. }
  145074. steppedOnNow = true;
  145075. }
  145076. if (JulianDate_default.greaterThan(current, start) && JulianDate_default.lessThan(current, loopStop) && !current.equals(updateTime)) {
  145077. tmp2 = property.getValueInReferenceFrame(
  145078. current,
  145079. referenceFrame,
  145080. result[r2]
  145081. );
  145082. if (defined_default(tmp2)) {
  145083. result[r2++] = tmp2;
  145084. }
  145085. }
  145086. if (t < len - 1) {
  145087. if (maximumStep > 0 && !sampling) {
  145088. const next = times[t + 1];
  145089. const secondsUntilNext = JulianDate_default.secondsDifference(next, current);
  145090. sampling = secondsUntilNext > maximumStep;
  145091. if (sampling) {
  145092. sampleStepsToTake = Math.ceil(secondsUntilNext / maximumStep);
  145093. sampleStepsTaken = 0;
  145094. sampleStepSize = secondsUntilNext / Math.max(sampleStepsToTake, 2);
  145095. sampleStepsToTake = Math.max(sampleStepsToTake - 1, 1);
  145096. }
  145097. }
  145098. if (sampling && sampleStepsTaken < sampleStepsToTake) {
  145099. current = JulianDate_default.addSeconds(
  145100. current,
  145101. sampleStepSize,
  145102. new JulianDate_default()
  145103. );
  145104. sampleStepsTaken++;
  145105. continue;
  145106. }
  145107. }
  145108. sampling = false;
  145109. t++;
  145110. current = times[t];
  145111. }
  145112. tmp2 = property.getValueInReferenceFrame(stop2, referenceFrame, result[r2]);
  145113. if (defined_default(tmp2)) {
  145114. result[r2++] = tmp2;
  145115. }
  145116. return r2;
  145117. }
  145118. function subSampleGenericProperty(property, start, stop2, updateTime, referenceFrame, maximumStep, startingIndex, result) {
  145119. let tmp2;
  145120. let i2 = 0;
  145121. let index2 = startingIndex;
  145122. let time = start;
  145123. const stepSize = Math.max(maximumStep, 60);
  145124. let steppedOnNow = !defined_default(updateTime) || JulianDate_default.lessThanOrEquals(updateTime, start) || JulianDate_default.greaterThanOrEquals(updateTime, stop2);
  145125. while (JulianDate_default.lessThan(time, stop2)) {
  145126. if (!steppedOnNow && JulianDate_default.greaterThanOrEquals(time, updateTime)) {
  145127. steppedOnNow = true;
  145128. tmp2 = property.getValueInReferenceFrame(
  145129. updateTime,
  145130. referenceFrame,
  145131. result[index2]
  145132. );
  145133. if (defined_default(tmp2)) {
  145134. result[index2] = tmp2;
  145135. index2++;
  145136. }
  145137. }
  145138. tmp2 = property.getValueInReferenceFrame(
  145139. time,
  145140. referenceFrame,
  145141. result[index2]
  145142. );
  145143. if (defined_default(tmp2)) {
  145144. result[index2] = tmp2;
  145145. index2++;
  145146. }
  145147. i2++;
  145148. time = JulianDate_default.addSeconds(start, stepSize * i2, new JulianDate_default());
  145149. }
  145150. tmp2 = property.getValueInReferenceFrame(stop2, referenceFrame, result[index2]);
  145151. if (defined_default(tmp2)) {
  145152. result[index2] = tmp2;
  145153. index2++;
  145154. }
  145155. return index2;
  145156. }
  145157. function subSampleIntervalProperty(property, start, stop2, updateTime, referenceFrame, maximumStep, startingIndex, result) {
  145158. subSampleIntervalPropertyScratch.start = start;
  145159. subSampleIntervalPropertyScratch.stop = stop2;
  145160. let index2 = startingIndex;
  145161. const intervals = property.intervals;
  145162. for (let i2 = 0; i2 < intervals.length; i2++) {
  145163. const interval = intervals.get(i2);
  145164. if (!TimeInterval_default.intersect(
  145165. interval,
  145166. subSampleIntervalPropertyScratch,
  145167. scratchTimeInterval2
  145168. ).isEmpty) {
  145169. let time = interval.start;
  145170. if (!interval.isStartIncluded) {
  145171. if (interval.isStopIncluded) {
  145172. time = interval.stop;
  145173. } else {
  145174. time = JulianDate_default.addSeconds(
  145175. interval.start,
  145176. JulianDate_default.secondsDifference(interval.stop, interval.start) / 2,
  145177. new JulianDate_default()
  145178. );
  145179. }
  145180. }
  145181. const tmp2 = property.getValueInReferenceFrame(
  145182. time,
  145183. referenceFrame,
  145184. result[index2]
  145185. );
  145186. if (defined_default(tmp2)) {
  145187. result[index2] = tmp2;
  145188. index2++;
  145189. }
  145190. }
  145191. }
  145192. return index2;
  145193. }
  145194. function subSampleConstantProperty(property, start, stop2, updateTime, referenceFrame, maximumStep, startingIndex, result) {
  145195. const tmp2 = property.getValueInReferenceFrame(
  145196. start,
  145197. referenceFrame,
  145198. result[startingIndex]
  145199. );
  145200. if (defined_default(tmp2)) {
  145201. result[startingIndex++] = tmp2;
  145202. }
  145203. return startingIndex;
  145204. }
  145205. function subSampleCompositeProperty(property, start, stop2, updateTime, referenceFrame, maximumStep, startingIndex, result) {
  145206. subSampleCompositePropertyScratch.start = start;
  145207. subSampleCompositePropertyScratch.stop = stop2;
  145208. let index2 = startingIndex;
  145209. const intervals = property.intervals;
  145210. for (let i2 = 0; i2 < intervals.length; i2++) {
  145211. const interval = intervals.get(i2);
  145212. if (!TimeInterval_default.intersect(
  145213. interval,
  145214. subSampleCompositePropertyScratch,
  145215. scratchTimeInterval2
  145216. ).isEmpty) {
  145217. const intervalStart = interval.start;
  145218. const intervalStop = interval.stop;
  145219. let sampleStart = start;
  145220. if (JulianDate_default.greaterThan(intervalStart, sampleStart)) {
  145221. sampleStart = intervalStart;
  145222. }
  145223. let sampleStop = stop2;
  145224. if (JulianDate_default.lessThan(intervalStop, sampleStop)) {
  145225. sampleStop = intervalStop;
  145226. }
  145227. index2 = reallySubSample(
  145228. interval.data,
  145229. sampleStart,
  145230. sampleStop,
  145231. updateTime,
  145232. referenceFrame,
  145233. maximumStep,
  145234. index2,
  145235. result
  145236. );
  145237. }
  145238. }
  145239. return index2;
  145240. }
  145241. function reallySubSample(property, start, stop2, updateTime, referenceFrame, maximumStep, index2, result) {
  145242. while (property instanceof ReferenceProperty_default) {
  145243. property = property.resolvedProperty;
  145244. }
  145245. if (property instanceof SampledPositionProperty_default) {
  145246. const times = property._property._times;
  145247. index2 = subSampleSampledProperty(
  145248. property,
  145249. start,
  145250. stop2,
  145251. times,
  145252. updateTime,
  145253. referenceFrame,
  145254. maximumStep,
  145255. index2,
  145256. result
  145257. );
  145258. } else if (property instanceof CompositePositionProperty_default) {
  145259. index2 = subSampleCompositeProperty(
  145260. property,
  145261. start,
  145262. stop2,
  145263. updateTime,
  145264. referenceFrame,
  145265. maximumStep,
  145266. index2,
  145267. result
  145268. );
  145269. } else if (property instanceof TimeIntervalCollectionPositionProperty_default) {
  145270. index2 = subSampleIntervalProperty(
  145271. property,
  145272. start,
  145273. stop2,
  145274. updateTime,
  145275. referenceFrame,
  145276. maximumStep,
  145277. index2,
  145278. result
  145279. );
  145280. } else if (property instanceof ConstantPositionProperty_default || property instanceof ScaledPositionProperty_default && Property_default.isConstant(property)) {
  145281. index2 = subSampleConstantProperty(
  145282. property,
  145283. start,
  145284. stop2,
  145285. updateTime,
  145286. referenceFrame,
  145287. maximumStep,
  145288. index2,
  145289. result
  145290. );
  145291. } else {
  145292. index2 = subSampleGenericProperty(
  145293. property,
  145294. start,
  145295. stop2,
  145296. updateTime,
  145297. referenceFrame,
  145298. maximumStep,
  145299. index2,
  145300. result
  145301. );
  145302. }
  145303. return index2;
  145304. }
  145305. function subSample(property, start, stop2, updateTime, referenceFrame, maximumStep, result) {
  145306. if (!defined_default(result)) {
  145307. result = [];
  145308. }
  145309. const length3 = reallySubSample(
  145310. property,
  145311. start,
  145312. stop2,
  145313. updateTime,
  145314. referenceFrame,
  145315. maximumStep,
  145316. 0,
  145317. result
  145318. );
  145319. result.length = length3;
  145320. return result;
  145321. }
  145322. var toFixedScratch = new Matrix3_default();
  145323. function PolylineUpdater(scene, referenceFrame) {
  145324. this._unusedIndexes = [];
  145325. this._polylineCollection = new PolylineCollection_default();
  145326. this._scene = scene;
  145327. this._referenceFrame = referenceFrame;
  145328. scene.primitives.add(this._polylineCollection);
  145329. }
  145330. PolylineUpdater.prototype.update = function(time) {
  145331. if (this._referenceFrame === ReferenceFrame_default.INERTIAL) {
  145332. let toFixed = Transforms_default.computeIcrfToFixedMatrix(time, toFixedScratch);
  145333. if (!defined_default(toFixed)) {
  145334. toFixed = Transforms_default.computeTemeToPseudoFixedMatrix(time, toFixedScratch);
  145335. }
  145336. Matrix4_default.fromRotationTranslation(
  145337. toFixed,
  145338. Cartesian3_default.ZERO,
  145339. this._polylineCollection.modelMatrix
  145340. );
  145341. }
  145342. };
  145343. PolylineUpdater.prototype.updateObject = function(time, item) {
  145344. const entity = item.entity;
  145345. const pathGraphics = entity._path;
  145346. const positionProperty = entity._position;
  145347. let sampleStart;
  145348. let sampleStop;
  145349. const showProperty = pathGraphics._show;
  145350. let polyline = item.polyline;
  145351. let show = entity.isShowing && entity.isAvailable(time) && (!defined_default(showProperty) || showProperty.getValue(time));
  145352. if (show) {
  145353. const leadTime = Property_default.getValueOrUndefined(pathGraphics._leadTime, time);
  145354. const trailTime = Property_default.getValueOrUndefined(
  145355. pathGraphics._trailTime,
  145356. time
  145357. );
  145358. const availability = entity._availability;
  145359. const hasAvailability = defined_default(availability);
  145360. const hasLeadTime = defined_default(leadTime);
  145361. const hasTrailTime = defined_default(trailTime);
  145362. show = hasAvailability || hasLeadTime && hasTrailTime;
  145363. if (show) {
  145364. if (hasTrailTime) {
  145365. sampleStart = JulianDate_default.addSeconds(time, -trailTime, new JulianDate_default());
  145366. }
  145367. if (hasLeadTime) {
  145368. sampleStop = JulianDate_default.addSeconds(time, leadTime, new JulianDate_default());
  145369. }
  145370. if (hasAvailability) {
  145371. const start = availability.start;
  145372. const stop2 = availability.stop;
  145373. if (!hasTrailTime || JulianDate_default.greaterThan(start, sampleStart)) {
  145374. sampleStart = start;
  145375. }
  145376. if (!hasLeadTime || JulianDate_default.lessThan(stop2, sampleStop)) {
  145377. sampleStop = stop2;
  145378. }
  145379. }
  145380. show = JulianDate_default.lessThan(sampleStart, sampleStop);
  145381. }
  145382. }
  145383. if (!show) {
  145384. if (defined_default(polyline)) {
  145385. this._unusedIndexes.push(item.index);
  145386. item.polyline = void 0;
  145387. polyline.show = false;
  145388. item.index = void 0;
  145389. }
  145390. return;
  145391. }
  145392. if (!defined_default(polyline)) {
  145393. const unusedIndexes = this._unusedIndexes;
  145394. const length3 = unusedIndexes.length;
  145395. if (length3 > 0) {
  145396. const index2 = unusedIndexes.pop();
  145397. polyline = this._polylineCollection.get(index2);
  145398. item.index = index2;
  145399. } else {
  145400. item.index = this._polylineCollection.length;
  145401. polyline = this._polylineCollection.add();
  145402. }
  145403. polyline.id = entity;
  145404. item.polyline = polyline;
  145405. }
  145406. const resolution = Property_default.getValueOrDefault(
  145407. pathGraphics._resolution,
  145408. time,
  145409. defaultResolution
  145410. );
  145411. polyline.show = true;
  145412. polyline.positions = subSample(
  145413. positionProperty,
  145414. sampleStart,
  145415. sampleStop,
  145416. time,
  145417. this._referenceFrame,
  145418. resolution,
  145419. polyline.positions.slice()
  145420. );
  145421. polyline.material = MaterialProperty_default.getValue(
  145422. time,
  145423. pathGraphics._material,
  145424. polyline.material
  145425. );
  145426. polyline.width = Property_default.getValueOrDefault(
  145427. pathGraphics._width,
  145428. time,
  145429. defaultWidth
  145430. );
  145431. polyline.distanceDisplayCondition = Property_default.getValueOrUndefined(
  145432. pathGraphics._distanceDisplayCondition,
  145433. time,
  145434. polyline.distanceDisplayCondition
  145435. );
  145436. };
  145437. PolylineUpdater.prototype.removeObject = function(item) {
  145438. const polyline = item.polyline;
  145439. if (defined_default(polyline)) {
  145440. this._unusedIndexes.push(item.index);
  145441. item.polyline = void 0;
  145442. polyline.show = false;
  145443. polyline.id = void 0;
  145444. item.index = void 0;
  145445. }
  145446. };
  145447. PolylineUpdater.prototype.destroy = function() {
  145448. this._scene.primitives.remove(this._polylineCollection);
  145449. return destroyObject_default(this);
  145450. };
  145451. function PathVisualizer(scene, entityCollection) {
  145452. if (!defined_default(scene)) {
  145453. throw new DeveloperError_default("scene is required.");
  145454. }
  145455. if (!defined_default(entityCollection)) {
  145456. throw new DeveloperError_default("entityCollection is required.");
  145457. }
  145458. entityCollection.collectionChanged.addEventListener(
  145459. PathVisualizer.prototype._onCollectionChanged,
  145460. this
  145461. );
  145462. this._scene = scene;
  145463. this._updaters = {};
  145464. this._entityCollection = entityCollection;
  145465. this._items = new AssociativeArray_default();
  145466. this._onCollectionChanged(entityCollection, entityCollection.values, [], []);
  145467. }
  145468. PathVisualizer.prototype.update = function(time) {
  145469. if (!defined_default(time)) {
  145470. throw new DeveloperError_default("time is required.");
  145471. }
  145472. const updaters = this._updaters;
  145473. for (const key in updaters) {
  145474. if (updaters.hasOwnProperty(key)) {
  145475. updaters[key].update(time);
  145476. }
  145477. }
  145478. const items = this._items.values;
  145479. if (items.length === 0 && defined_default(this._updaters) && Object.keys(this._updaters).length > 0) {
  145480. for (const u3 in updaters) {
  145481. if (updaters.hasOwnProperty(u3)) {
  145482. updaters[u3].destroy();
  145483. }
  145484. }
  145485. this._updaters = {};
  145486. }
  145487. for (let i2 = 0, len = items.length; i2 < len; i2++) {
  145488. const item = items[i2];
  145489. const entity = item.entity;
  145490. const positionProperty = entity._position;
  145491. const lastUpdater = item.updater;
  145492. let frameToVisualize = ReferenceFrame_default.FIXED;
  145493. if (this._scene.mode === SceneMode_default.SCENE3D) {
  145494. frameToVisualize = positionProperty.referenceFrame;
  145495. }
  145496. let currentUpdater = this._updaters[frameToVisualize];
  145497. if (lastUpdater === currentUpdater && defined_default(currentUpdater)) {
  145498. currentUpdater.updateObject(time, item);
  145499. continue;
  145500. }
  145501. if (defined_default(lastUpdater)) {
  145502. lastUpdater.removeObject(item);
  145503. }
  145504. if (!defined_default(currentUpdater)) {
  145505. currentUpdater = new PolylineUpdater(this._scene, frameToVisualize);
  145506. currentUpdater.update(time);
  145507. this._updaters[frameToVisualize] = currentUpdater;
  145508. }
  145509. item.updater = currentUpdater;
  145510. if (defined_default(currentUpdater)) {
  145511. currentUpdater.updateObject(time, item);
  145512. }
  145513. }
  145514. return true;
  145515. };
  145516. PathVisualizer.prototype.isDestroyed = function() {
  145517. return false;
  145518. };
  145519. PathVisualizer.prototype.destroy = function() {
  145520. this._entityCollection.collectionChanged.removeEventListener(
  145521. PathVisualizer.prototype._onCollectionChanged,
  145522. this
  145523. );
  145524. const updaters = this._updaters;
  145525. for (const key in updaters) {
  145526. if (updaters.hasOwnProperty(key)) {
  145527. updaters[key].destroy();
  145528. }
  145529. }
  145530. return destroyObject_default(this);
  145531. };
  145532. PathVisualizer.prototype._onCollectionChanged = function(entityCollection, added, removed, changed) {
  145533. let i2;
  145534. let entity;
  145535. let item;
  145536. const items = this._items;
  145537. for (i2 = added.length - 1; i2 > -1; i2--) {
  145538. entity = added[i2];
  145539. if (defined_default(entity._path) && defined_default(entity._position)) {
  145540. items.set(entity.id, new EntityData3(entity));
  145541. }
  145542. }
  145543. for (i2 = changed.length - 1; i2 > -1; i2--) {
  145544. entity = changed[i2];
  145545. if (defined_default(entity._path) && defined_default(entity._position)) {
  145546. if (!items.contains(entity.id)) {
  145547. items.set(entity.id, new EntityData3(entity));
  145548. }
  145549. } else {
  145550. item = items.get(entity.id);
  145551. if (defined_default(item)) {
  145552. if (defined_default(item.updater)) {
  145553. item.updater.removeObject(item);
  145554. }
  145555. items.remove(entity.id);
  145556. }
  145557. }
  145558. }
  145559. for (i2 = removed.length - 1; i2 > -1; i2--) {
  145560. entity = removed[i2];
  145561. item = items.get(entity.id);
  145562. if (defined_default(item)) {
  145563. if (defined_default(item.updater)) {
  145564. item.updater.removeObject(item);
  145565. }
  145566. items.remove(entity.id);
  145567. }
  145568. }
  145569. };
  145570. PathVisualizer._subSample = subSample;
  145571. var PathVisualizer_default = PathVisualizer;
  145572. // node_modules/cesium/Source/DataSources/PointVisualizer.js
  145573. var defaultColor8 = Color_default.WHITE;
  145574. var defaultOutlineColor4 = Color_default.BLACK;
  145575. var defaultOutlineWidth3 = 0;
  145576. var defaultPixelSize = 1;
  145577. var defaultDisableDepthTestDistance = 0;
  145578. var colorScratch7 = new Color_default();
  145579. var positionScratch13 = new Cartesian3_default();
  145580. var outlineColorScratch2 = new Color_default();
  145581. var scaleByDistanceScratch3 = new NearFarScalar_default();
  145582. var translucencyByDistanceScratch3 = new NearFarScalar_default();
  145583. var distanceDisplayConditionScratch8 = new DistanceDisplayCondition_default();
  145584. function EntityData4(entity) {
  145585. this.entity = entity;
  145586. this.pointPrimitive = void 0;
  145587. this.billboard = void 0;
  145588. this.color = void 0;
  145589. this.outlineColor = void 0;
  145590. this.pixelSize = void 0;
  145591. this.outlineWidth = void 0;
  145592. }
  145593. function PointVisualizer(entityCluster, entityCollection) {
  145594. if (!defined_default(entityCluster)) {
  145595. throw new DeveloperError_default("entityCluster is required.");
  145596. }
  145597. if (!defined_default(entityCollection)) {
  145598. throw new DeveloperError_default("entityCollection is required.");
  145599. }
  145600. entityCollection.collectionChanged.addEventListener(
  145601. PointVisualizer.prototype._onCollectionChanged,
  145602. this
  145603. );
  145604. this._cluster = entityCluster;
  145605. this._entityCollection = entityCollection;
  145606. this._items = new AssociativeArray_default();
  145607. this._onCollectionChanged(entityCollection, entityCollection.values, [], []);
  145608. }
  145609. PointVisualizer.prototype.update = function(time) {
  145610. if (!defined_default(time)) {
  145611. throw new DeveloperError_default("time is required.");
  145612. }
  145613. const items = this._items.values;
  145614. const cluster = this._cluster;
  145615. for (let i2 = 0, len = items.length; i2 < len; i2++) {
  145616. const item = items[i2];
  145617. const entity = item.entity;
  145618. const pointGraphics = entity._point;
  145619. let pointPrimitive = item.pointPrimitive;
  145620. let billboard = item.billboard;
  145621. const heightReference = Property_default.getValueOrDefault(
  145622. pointGraphics._heightReference,
  145623. time,
  145624. HeightReference_default.NONE
  145625. );
  145626. let show = entity.isShowing && entity.isAvailable(time) && Property_default.getValueOrDefault(pointGraphics._show, time, true);
  145627. let position;
  145628. if (show) {
  145629. position = Property_default.getValueOrUndefined(
  145630. entity._position,
  145631. time,
  145632. positionScratch13
  145633. );
  145634. show = defined_default(position);
  145635. }
  145636. if (!show) {
  145637. returnPrimitive3(item, entity, cluster);
  145638. continue;
  145639. }
  145640. if (!Property_default.isConstant(entity._position)) {
  145641. cluster._clusterDirty = true;
  145642. }
  145643. let needsRedraw = false;
  145644. let updateClamping2 = false;
  145645. if (heightReference !== HeightReference_default.NONE && !defined_default(billboard)) {
  145646. if (defined_default(pointPrimitive)) {
  145647. returnPrimitive3(item, entity, cluster);
  145648. pointPrimitive = void 0;
  145649. }
  145650. billboard = cluster.getBillboard(entity);
  145651. billboard.id = entity;
  145652. billboard.image = void 0;
  145653. item.billboard = billboard;
  145654. needsRedraw = true;
  145655. updateClamping2 = Cartesian3_default.equals(billboard.position, position) && billboard.heightReference === heightReference;
  145656. } else if (heightReference === HeightReference_default.NONE && !defined_default(pointPrimitive)) {
  145657. if (defined_default(billboard)) {
  145658. returnPrimitive3(item, entity, cluster);
  145659. billboard = void 0;
  145660. }
  145661. pointPrimitive = cluster.getPoint(entity);
  145662. pointPrimitive.id = entity;
  145663. item.pointPrimitive = pointPrimitive;
  145664. }
  145665. if (defined_default(pointPrimitive)) {
  145666. pointPrimitive.show = true;
  145667. pointPrimitive.position = position;
  145668. pointPrimitive.scaleByDistance = Property_default.getValueOrUndefined(
  145669. pointGraphics._scaleByDistance,
  145670. time,
  145671. scaleByDistanceScratch3
  145672. );
  145673. pointPrimitive.translucencyByDistance = Property_default.getValueOrUndefined(
  145674. pointGraphics._translucencyByDistance,
  145675. time,
  145676. translucencyByDistanceScratch3
  145677. );
  145678. pointPrimitive.color = Property_default.getValueOrDefault(
  145679. pointGraphics._color,
  145680. time,
  145681. defaultColor8,
  145682. colorScratch7
  145683. );
  145684. pointPrimitive.outlineColor = Property_default.getValueOrDefault(
  145685. pointGraphics._outlineColor,
  145686. time,
  145687. defaultOutlineColor4,
  145688. outlineColorScratch2
  145689. );
  145690. pointPrimitive.outlineWidth = Property_default.getValueOrDefault(
  145691. pointGraphics._outlineWidth,
  145692. time,
  145693. defaultOutlineWidth3
  145694. );
  145695. pointPrimitive.pixelSize = Property_default.getValueOrDefault(
  145696. pointGraphics._pixelSize,
  145697. time,
  145698. defaultPixelSize
  145699. );
  145700. pointPrimitive.distanceDisplayCondition = Property_default.getValueOrUndefined(
  145701. pointGraphics._distanceDisplayCondition,
  145702. time,
  145703. distanceDisplayConditionScratch8
  145704. );
  145705. pointPrimitive.disableDepthTestDistance = Property_default.getValueOrDefault(
  145706. pointGraphics._disableDepthTestDistance,
  145707. time,
  145708. defaultDisableDepthTestDistance
  145709. );
  145710. } else if (defined_default(billboard)) {
  145711. billboard.show = true;
  145712. billboard.position = position;
  145713. billboard.scaleByDistance = Property_default.getValueOrUndefined(
  145714. pointGraphics._scaleByDistance,
  145715. time,
  145716. scaleByDistanceScratch3
  145717. );
  145718. billboard.translucencyByDistance = Property_default.getValueOrUndefined(
  145719. pointGraphics._translucencyByDistance,
  145720. time,
  145721. translucencyByDistanceScratch3
  145722. );
  145723. billboard.distanceDisplayCondition = Property_default.getValueOrUndefined(
  145724. pointGraphics._distanceDisplayCondition,
  145725. time,
  145726. distanceDisplayConditionScratch8
  145727. );
  145728. billboard.disableDepthTestDistance = Property_default.getValueOrDefault(
  145729. pointGraphics._disableDepthTestDistance,
  145730. time,
  145731. defaultDisableDepthTestDistance
  145732. );
  145733. billboard.heightReference = heightReference;
  145734. const newColor = Property_default.getValueOrDefault(
  145735. pointGraphics._color,
  145736. time,
  145737. defaultColor8,
  145738. colorScratch7
  145739. );
  145740. const newOutlineColor = Property_default.getValueOrDefault(
  145741. pointGraphics._outlineColor,
  145742. time,
  145743. defaultOutlineColor4,
  145744. outlineColorScratch2
  145745. );
  145746. const newOutlineWidth = Math.round(
  145747. Property_default.getValueOrDefault(
  145748. pointGraphics._outlineWidth,
  145749. time,
  145750. defaultOutlineWidth3
  145751. )
  145752. );
  145753. let newPixelSize = Math.max(
  145754. 1,
  145755. Math.round(
  145756. Property_default.getValueOrDefault(
  145757. pointGraphics._pixelSize,
  145758. time,
  145759. defaultPixelSize
  145760. )
  145761. )
  145762. );
  145763. if (newOutlineWidth > 0) {
  145764. billboard.scale = 1;
  145765. needsRedraw = needsRedraw || newOutlineWidth !== item.outlineWidth || newPixelSize !== item.pixelSize || !Color_default.equals(newColor, item.color) || !Color_default.equals(newOutlineColor, item.outlineColor);
  145766. } else {
  145767. billboard.scale = newPixelSize / 50;
  145768. newPixelSize = 50;
  145769. needsRedraw = needsRedraw || newOutlineWidth !== item.outlineWidth || !Color_default.equals(newColor, item.color) || !Color_default.equals(newOutlineColor, item.outlineColor);
  145770. }
  145771. if (needsRedraw) {
  145772. item.color = Color_default.clone(newColor, item.color);
  145773. item.outlineColor = Color_default.clone(newOutlineColor, item.outlineColor);
  145774. item.pixelSize = newPixelSize;
  145775. item.outlineWidth = newOutlineWidth;
  145776. const centerAlpha = newColor.alpha;
  145777. const cssColor = newColor.toCssColorString();
  145778. const cssOutlineColor = newOutlineColor.toCssColorString();
  145779. const textureId = JSON.stringify([
  145780. cssColor,
  145781. newPixelSize,
  145782. cssOutlineColor,
  145783. newOutlineWidth
  145784. ]);
  145785. billboard.setImage(
  145786. textureId,
  145787. createBillboardPointCallback_default(
  145788. centerAlpha,
  145789. cssColor,
  145790. cssOutlineColor,
  145791. newOutlineWidth,
  145792. newPixelSize
  145793. )
  145794. );
  145795. }
  145796. if (updateClamping2) {
  145797. billboard._updateClamping();
  145798. }
  145799. }
  145800. }
  145801. return true;
  145802. };
  145803. PointVisualizer.prototype.getBoundingSphere = function(entity, result) {
  145804. if (!defined_default(entity)) {
  145805. throw new DeveloperError_default("entity is required.");
  145806. }
  145807. if (!defined_default(result)) {
  145808. throw new DeveloperError_default("result is required.");
  145809. }
  145810. const item = this._items.get(entity.id);
  145811. if (!defined_default(item) || !(defined_default(item.pointPrimitive) || defined_default(item.billboard))) {
  145812. return BoundingSphereState_default.FAILED;
  145813. }
  145814. if (defined_default(item.pointPrimitive)) {
  145815. result.center = Cartesian3_default.clone(
  145816. item.pointPrimitive.position,
  145817. result.center
  145818. );
  145819. } else {
  145820. const billboard = item.billboard;
  145821. if (!defined_default(billboard._clampedPosition)) {
  145822. return BoundingSphereState_default.PENDING;
  145823. }
  145824. result.center = Cartesian3_default.clone(billboard._clampedPosition, result.center);
  145825. }
  145826. result.radius = 0;
  145827. return BoundingSphereState_default.DONE;
  145828. };
  145829. PointVisualizer.prototype.isDestroyed = function() {
  145830. return false;
  145831. };
  145832. PointVisualizer.prototype.destroy = function() {
  145833. this._entityCollection.collectionChanged.removeEventListener(
  145834. PointVisualizer.prototype._onCollectionChanged,
  145835. this
  145836. );
  145837. const entities = this._entityCollection.values;
  145838. for (let i2 = 0; i2 < entities.length; i2++) {
  145839. this._cluster.removePoint(entities[i2]);
  145840. }
  145841. return destroyObject_default(this);
  145842. };
  145843. PointVisualizer.prototype._onCollectionChanged = function(entityCollection, added, removed, changed) {
  145844. let i2;
  145845. let entity;
  145846. const items = this._items;
  145847. const cluster = this._cluster;
  145848. for (i2 = added.length - 1; i2 > -1; i2--) {
  145849. entity = added[i2];
  145850. if (defined_default(entity._point) && defined_default(entity._position)) {
  145851. items.set(entity.id, new EntityData4(entity));
  145852. }
  145853. }
  145854. for (i2 = changed.length - 1; i2 > -1; i2--) {
  145855. entity = changed[i2];
  145856. if (defined_default(entity._point) && defined_default(entity._position)) {
  145857. if (!items.contains(entity.id)) {
  145858. items.set(entity.id, new EntityData4(entity));
  145859. }
  145860. } else {
  145861. returnPrimitive3(items.get(entity.id), entity, cluster);
  145862. items.remove(entity.id);
  145863. }
  145864. }
  145865. for (i2 = removed.length - 1; i2 > -1; i2--) {
  145866. entity = removed[i2];
  145867. returnPrimitive3(items.get(entity.id), entity, cluster);
  145868. items.remove(entity.id);
  145869. }
  145870. };
  145871. function returnPrimitive3(item, entity, cluster) {
  145872. if (defined_default(item)) {
  145873. const pointPrimitive = item.pointPrimitive;
  145874. if (defined_default(pointPrimitive)) {
  145875. item.pointPrimitive = void 0;
  145876. cluster.removePoint(entity);
  145877. return;
  145878. }
  145879. const billboard = item.billboard;
  145880. if (defined_default(billboard)) {
  145881. item.billboard = void 0;
  145882. cluster.removeBillboard(entity);
  145883. }
  145884. }
  145885. }
  145886. var PointVisualizer_default = PointVisualizer;
  145887. // node_modules/cesium/Source/DataSources/PolylineGeometryUpdater.js
  145888. var defaultZIndex2 = new ConstantProperty_default(0);
  145889. var polylineCollections = {};
  145890. var scratchColor21 = new Color_default();
  145891. var defaultMaterial3 = new ColorMaterialProperty_default(Color_default.WHITE);
  145892. var defaultShow2 = new ConstantProperty_default(true);
  145893. var defaultShadows3 = new ConstantProperty_default(ShadowMode_default.DISABLED);
  145894. var defaultDistanceDisplayCondition7 = new ConstantProperty_default(
  145895. new DistanceDisplayCondition_default()
  145896. );
  145897. var defaultClassificationType2 = new ConstantProperty_default(ClassificationType_default.BOTH);
  145898. function GeometryOptions() {
  145899. this.vertexFormat = void 0;
  145900. this.positions = void 0;
  145901. this.width = void 0;
  145902. this.arcType = void 0;
  145903. this.granularity = void 0;
  145904. }
  145905. function GroundGeometryOptions() {
  145906. this.positions = void 0;
  145907. this.width = void 0;
  145908. this.arcType = void 0;
  145909. this.granularity = void 0;
  145910. }
  145911. function PolylineGeometryUpdater(entity, scene) {
  145912. if (!defined_default(entity)) {
  145913. throw new DeveloperError_default("entity is required");
  145914. }
  145915. if (!defined_default(scene)) {
  145916. throw new DeveloperError_default("scene is required");
  145917. }
  145918. this._entity = entity;
  145919. this._scene = scene;
  145920. this._entitySubscription = entity.definitionChanged.addEventListener(
  145921. PolylineGeometryUpdater.prototype._onEntityPropertyChanged,
  145922. this
  145923. );
  145924. this._fillEnabled = false;
  145925. this._dynamic = false;
  145926. this._geometryChanged = new Event_default();
  145927. this._showProperty = void 0;
  145928. this._materialProperty = void 0;
  145929. this._shadowsProperty = void 0;
  145930. this._distanceDisplayConditionProperty = void 0;
  145931. this._classificationTypeProperty = void 0;
  145932. this._depthFailMaterialProperty = void 0;
  145933. this._geometryOptions = new GeometryOptions();
  145934. this._groundGeometryOptions = new GroundGeometryOptions();
  145935. this._id = `polyline-${entity.id}`;
  145936. this._clampToGround = false;
  145937. this._supportsPolylinesOnTerrain = Entity_default.supportsPolylinesOnTerrain(scene);
  145938. this._zIndex = 0;
  145939. this._onEntityPropertyChanged(entity, "polyline", entity.polyline, void 0);
  145940. }
  145941. Object.defineProperties(PolylineGeometryUpdater.prototype, {
  145942. id: {
  145943. get: function() {
  145944. return this._id;
  145945. }
  145946. },
  145947. entity: {
  145948. get: function() {
  145949. return this._entity;
  145950. }
  145951. },
  145952. fillEnabled: {
  145953. get: function() {
  145954. return this._fillEnabled;
  145955. }
  145956. },
  145957. hasConstantFill: {
  145958. get: function() {
  145959. return !this._fillEnabled || !defined_default(this._entity.availability) && Property_default.isConstant(this._showProperty);
  145960. }
  145961. },
  145962. fillMaterialProperty: {
  145963. get: function() {
  145964. return this._materialProperty;
  145965. }
  145966. },
  145967. depthFailMaterialProperty: {
  145968. get: function() {
  145969. return this._depthFailMaterialProperty;
  145970. }
  145971. },
  145972. outlineEnabled: {
  145973. value: false
  145974. },
  145975. hasConstantOutline: {
  145976. value: true
  145977. },
  145978. outlineColorProperty: {
  145979. value: void 0
  145980. },
  145981. shadowsProperty: {
  145982. get: function() {
  145983. return this._shadowsProperty;
  145984. }
  145985. },
  145986. distanceDisplayConditionProperty: {
  145987. get: function() {
  145988. return this._distanceDisplayConditionProperty;
  145989. }
  145990. },
  145991. classificationTypeProperty: {
  145992. get: function() {
  145993. return this._classificationTypeProperty;
  145994. }
  145995. },
  145996. isDynamic: {
  145997. get: function() {
  145998. return this._dynamic;
  145999. }
  146000. },
  146001. isClosed: {
  146002. value: false
  146003. },
  146004. geometryChanged: {
  146005. get: function() {
  146006. return this._geometryChanged;
  146007. }
  146008. },
  146009. arcType: {
  146010. get: function() {
  146011. return this._arcType;
  146012. }
  146013. },
  146014. clampToGround: {
  146015. get: function() {
  146016. return this._clampToGround && this._supportsPolylinesOnTerrain;
  146017. }
  146018. },
  146019. zIndex: {
  146020. get: function() {
  146021. return this._zIndex;
  146022. }
  146023. }
  146024. });
  146025. PolylineGeometryUpdater.prototype.isOutlineVisible = function(time) {
  146026. return false;
  146027. };
  146028. PolylineGeometryUpdater.prototype.isFilled = function(time) {
  146029. const entity = this._entity;
  146030. const visible = this._fillEnabled && entity.isAvailable(time) && this._showProperty.getValue(time);
  146031. return defaultValue_default(visible, false);
  146032. };
  146033. PolylineGeometryUpdater.prototype.createFillGeometryInstance = function(time) {
  146034. if (!defined_default(time)) {
  146035. throw new DeveloperError_default("time is required.");
  146036. }
  146037. if (!this._fillEnabled) {
  146038. throw new DeveloperError_default(
  146039. "This instance does not represent a filled geometry."
  146040. );
  146041. }
  146042. const entity = this._entity;
  146043. const isAvailable = entity.isAvailable(time);
  146044. const show = new ShowGeometryInstanceAttribute_default(
  146045. isAvailable && entity.isShowing && this._showProperty.getValue(time)
  146046. );
  146047. const distanceDisplayCondition = this._distanceDisplayConditionProperty.getValue(
  146048. time
  146049. );
  146050. const distanceDisplayConditionAttribute = DistanceDisplayConditionGeometryInstanceAttribute_default.fromDistanceDisplayCondition(
  146051. distanceDisplayCondition
  146052. );
  146053. const attributes = {
  146054. show,
  146055. distanceDisplayCondition: distanceDisplayConditionAttribute
  146056. };
  146057. let currentColor;
  146058. if (this._materialProperty instanceof ColorMaterialProperty_default) {
  146059. if (defined_default(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) {
  146060. currentColor = this._materialProperty.color.getValue(time, scratchColor21);
  146061. }
  146062. if (!defined_default(currentColor)) {
  146063. currentColor = Color_default.WHITE;
  146064. }
  146065. attributes.color = ColorGeometryInstanceAttribute_default.fromColor(currentColor);
  146066. }
  146067. if (this.clampToGround) {
  146068. return new GeometryInstance_default({
  146069. id: entity,
  146070. geometry: new GroundPolylineGeometry_default(this._groundGeometryOptions),
  146071. attributes
  146072. });
  146073. }
  146074. if (defined_default(this._depthFailMaterialProperty) && this._depthFailMaterialProperty instanceof ColorMaterialProperty_default) {
  146075. if (defined_default(this._depthFailMaterialProperty.color) && (this._depthFailMaterialProperty.color.isConstant || isAvailable)) {
  146076. currentColor = this._depthFailMaterialProperty.color.getValue(
  146077. time,
  146078. scratchColor21
  146079. );
  146080. }
  146081. if (!defined_default(currentColor)) {
  146082. currentColor = Color_default.WHITE;
  146083. }
  146084. attributes.depthFailColor = ColorGeometryInstanceAttribute_default.fromColor(
  146085. currentColor
  146086. );
  146087. }
  146088. return new GeometryInstance_default({
  146089. id: entity,
  146090. geometry: new PolylineGeometry_default(this._geometryOptions),
  146091. attributes
  146092. });
  146093. };
  146094. PolylineGeometryUpdater.prototype.createOutlineGeometryInstance = function(time) {
  146095. throw new DeveloperError_default(
  146096. "This instance does not represent an outlined geometry."
  146097. );
  146098. };
  146099. PolylineGeometryUpdater.prototype.isDestroyed = function() {
  146100. return false;
  146101. };
  146102. PolylineGeometryUpdater.prototype.destroy = function() {
  146103. this._entitySubscription();
  146104. destroyObject_default(this);
  146105. };
  146106. PolylineGeometryUpdater.prototype._onEntityPropertyChanged = function(entity, propertyName, newValue, oldValue2) {
  146107. if (!(propertyName === "availability" || propertyName === "polyline")) {
  146108. return;
  146109. }
  146110. const polyline = this._entity.polyline;
  146111. if (!defined_default(polyline)) {
  146112. if (this._fillEnabled) {
  146113. this._fillEnabled = false;
  146114. this._geometryChanged.raiseEvent(this);
  146115. }
  146116. return;
  146117. }
  146118. const positionsProperty = polyline.positions;
  146119. const show = polyline.show;
  146120. if (defined_default(show) && show.isConstant && !show.getValue(Iso8601_default.MINIMUM_VALUE) || !defined_default(positionsProperty)) {
  146121. if (this._fillEnabled) {
  146122. this._fillEnabled = false;
  146123. this._geometryChanged.raiseEvent(this);
  146124. }
  146125. return;
  146126. }
  146127. const zIndex = polyline.zIndex;
  146128. const material = defaultValue_default(polyline.material, defaultMaterial3);
  146129. const isColorMaterial = material instanceof ColorMaterialProperty_default;
  146130. this._materialProperty = material;
  146131. this._depthFailMaterialProperty = polyline.depthFailMaterial;
  146132. this._showProperty = defaultValue_default(show, defaultShow2);
  146133. this._shadowsProperty = defaultValue_default(polyline.shadows, defaultShadows3);
  146134. this._distanceDisplayConditionProperty = defaultValue_default(
  146135. polyline.distanceDisplayCondition,
  146136. defaultDistanceDisplayCondition7
  146137. );
  146138. this._classificationTypeProperty = defaultValue_default(
  146139. polyline.classificationType,
  146140. defaultClassificationType2
  146141. );
  146142. this._fillEnabled = true;
  146143. this._zIndex = defaultValue_default(zIndex, defaultZIndex2);
  146144. const width = polyline.width;
  146145. const arcType = polyline.arcType;
  146146. const clampToGround = polyline.clampToGround;
  146147. const granularity = polyline.granularity;
  146148. if (!positionsProperty.isConstant || !Property_default.isConstant(width) || !Property_default.isConstant(arcType) || !Property_default.isConstant(granularity) || !Property_default.isConstant(clampToGround) || !Property_default.isConstant(zIndex)) {
  146149. if (!this._dynamic) {
  146150. this._dynamic = true;
  146151. this._geometryChanged.raiseEvent(this);
  146152. }
  146153. } else {
  146154. const geometryOptions = this._geometryOptions;
  146155. const positions = positionsProperty.getValue(
  146156. Iso8601_default.MINIMUM_VALUE,
  146157. geometryOptions.positions
  146158. );
  146159. if (!defined_default(positions) || positions.length < 2) {
  146160. if (this._fillEnabled) {
  146161. this._fillEnabled = false;
  146162. this._geometryChanged.raiseEvent(this);
  146163. }
  146164. return;
  146165. }
  146166. let vertexFormat;
  146167. if (isColorMaterial && (!defined_default(this._depthFailMaterialProperty) || this._depthFailMaterialProperty instanceof ColorMaterialProperty_default)) {
  146168. vertexFormat = PolylineColorAppearance_default.VERTEX_FORMAT;
  146169. } else {
  146170. vertexFormat = PolylineMaterialAppearance_default.VERTEX_FORMAT;
  146171. }
  146172. geometryOptions.vertexFormat = vertexFormat;
  146173. geometryOptions.positions = positions;
  146174. geometryOptions.width = defined_default(width) ? width.getValue(Iso8601_default.MINIMUM_VALUE) : void 0;
  146175. geometryOptions.arcType = defined_default(arcType) ? arcType.getValue(Iso8601_default.MINIMUM_VALUE) : void 0;
  146176. geometryOptions.granularity = defined_default(granularity) ? granularity.getValue(Iso8601_default.MINIMUM_VALUE) : void 0;
  146177. const groundGeometryOptions = this._groundGeometryOptions;
  146178. groundGeometryOptions.positions = positions;
  146179. groundGeometryOptions.width = geometryOptions.width;
  146180. groundGeometryOptions.arcType = geometryOptions.arcType;
  146181. groundGeometryOptions.granularity = geometryOptions.granularity;
  146182. this._clampToGround = defined_default(clampToGround) ? clampToGround.getValue(Iso8601_default.MINIMUM_VALUE) : false;
  146183. if (!this._clampToGround && defined_default(zIndex)) {
  146184. oneTimeWarning_default(
  146185. "Entity polylines must have clampToGround: true when using zIndex. zIndex will be ignored."
  146186. );
  146187. }
  146188. this._dynamic = false;
  146189. this._geometryChanged.raiseEvent(this);
  146190. }
  146191. };
  146192. PolylineGeometryUpdater.prototype.createDynamicUpdater = function(primitives, groundPrimitives) {
  146193. Check_default.defined("primitives", primitives);
  146194. Check_default.defined("groundPrimitives", groundPrimitives);
  146195. if (!this._dynamic) {
  146196. throw new DeveloperError_default(
  146197. "This instance does not represent dynamic geometry."
  146198. );
  146199. }
  146200. return new DynamicGeometryUpdater2(primitives, groundPrimitives, this);
  146201. };
  146202. var generateCartesianArcOptions = {
  146203. positions: void 0,
  146204. granularity: void 0,
  146205. height: void 0,
  146206. ellipsoid: void 0
  146207. };
  146208. function DynamicGeometryUpdater2(primitives, groundPrimitives, geometryUpdater) {
  146209. this._line = void 0;
  146210. this._primitives = primitives;
  146211. this._groundPrimitives = groundPrimitives;
  146212. this._groundPolylinePrimitive = void 0;
  146213. this._material = void 0;
  146214. this._geometryUpdater = geometryUpdater;
  146215. this._positions = [];
  146216. }
  146217. function getLine(dynamicGeometryUpdater) {
  146218. if (defined_default(dynamicGeometryUpdater._line)) {
  146219. return dynamicGeometryUpdater._line;
  146220. }
  146221. const sceneId = dynamicGeometryUpdater._geometryUpdater._scene.id;
  146222. let polylineCollection = polylineCollections[sceneId];
  146223. const primitives = dynamicGeometryUpdater._primitives;
  146224. if (!defined_default(polylineCollection) || polylineCollection.isDestroyed()) {
  146225. polylineCollection = new PolylineCollection_default();
  146226. polylineCollections[sceneId] = polylineCollection;
  146227. primitives.add(polylineCollection);
  146228. } else if (!primitives.contains(polylineCollection)) {
  146229. primitives.add(polylineCollection);
  146230. }
  146231. const line = polylineCollection.add();
  146232. line.id = dynamicGeometryUpdater._geometryUpdater._entity;
  146233. dynamicGeometryUpdater._line = line;
  146234. return line;
  146235. }
  146236. DynamicGeometryUpdater2.prototype.update = function(time) {
  146237. const geometryUpdater = this._geometryUpdater;
  146238. const entity = geometryUpdater._entity;
  146239. const polyline = entity.polyline;
  146240. const positionsProperty = polyline.positions;
  146241. let positions = Property_default.getValueOrUndefined(
  146242. positionsProperty,
  146243. time,
  146244. this._positions
  146245. );
  146246. geometryUpdater._clampToGround = Property_default.getValueOrDefault(
  146247. polyline._clampToGround,
  146248. time,
  146249. false
  146250. );
  146251. geometryUpdater._groundGeometryOptions.positions = positions;
  146252. geometryUpdater._groundGeometryOptions.width = Property_default.getValueOrDefault(
  146253. polyline._width,
  146254. time,
  146255. 1
  146256. );
  146257. geometryUpdater._groundGeometryOptions.arcType = Property_default.getValueOrDefault(
  146258. polyline._arcType,
  146259. time,
  146260. ArcType_default.GEODESIC
  146261. );
  146262. geometryUpdater._groundGeometryOptions.granularity = Property_default.getValueOrDefault(
  146263. polyline._granularity,
  146264. time,
  146265. 9999
  146266. );
  146267. const groundPrimitives = this._groundPrimitives;
  146268. if (defined_default(this._groundPolylinePrimitive)) {
  146269. groundPrimitives.remove(this._groundPolylinePrimitive);
  146270. this._groundPolylinePrimitive = void 0;
  146271. }
  146272. if (geometryUpdater.clampToGround) {
  146273. if (!entity.isShowing || !entity.isAvailable(time) || !Property_default.getValueOrDefault(polyline._show, time, true)) {
  146274. return;
  146275. }
  146276. if (!defined_default(positions) || positions.length < 2) {
  146277. return;
  146278. }
  146279. const fillMaterialProperty = geometryUpdater.fillMaterialProperty;
  146280. let appearance;
  146281. if (fillMaterialProperty instanceof ColorMaterialProperty_default) {
  146282. appearance = new PolylineColorAppearance_default();
  146283. } else {
  146284. const material = MaterialProperty_default.getValue(
  146285. time,
  146286. fillMaterialProperty,
  146287. this._material
  146288. );
  146289. appearance = new PolylineMaterialAppearance_default({
  146290. material,
  146291. translucent: material.isTranslucent()
  146292. });
  146293. this._material = material;
  146294. }
  146295. this._groundPolylinePrimitive = groundPrimitives.add(
  146296. new GroundPolylinePrimitive_default({
  146297. geometryInstances: geometryUpdater.createFillGeometryInstance(time),
  146298. appearance,
  146299. classificationType: geometryUpdater.classificationTypeProperty.getValue(
  146300. time
  146301. ),
  146302. asynchronous: false
  146303. }),
  146304. Property_default.getValueOrUndefined(geometryUpdater.zIndex, time)
  146305. );
  146306. if (defined_default(this._line)) {
  146307. this._line.show = false;
  146308. }
  146309. return;
  146310. }
  146311. const line = getLine(this);
  146312. if (!entity.isShowing || !entity.isAvailable(time) || !Property_default.getValueOrDefault(polyline._show, time, true)) {
  146313. line.show = false;
  146314. return;
  146315. }
  146316. if (!defined_default(positions) || positions.length < 2) {
  146317. line.show = false;
  146318. return;
  146319. }
  146320. let arcType = ArcType_default.GEODESIC;
  146321. arcType = Property_default.getValueOrDefault(polyline._arcType, time, arcType);
  146322. const globe = geometryUpdater._scene.globe;
  146323. if (arcType !== ArcType_default.NONE && defined_default(globe)) {
  146324. generateCartesianArcOptions.ellipsoid = globe.ellipsoid;
  146325. generateCartesianArcOptions.positions = positions;
  146326. generateCartesianArcOptions.granularity = Property_default.getValueOrUndefined(
  146327. polyline._granularity,
  146328. time
  146329. );
  146330. generateCartesianArcOptions.height = PolylinePipeline_default.extractHeights(
  146331. positions,
  146332. globe.ellipsoid
  146333. );
  146334. if (arcType === ArcType_default.GEODESIC) {
  146335. positions = PolylinePipeline_default.generateCartesianArc(
  146336. generateCartesianArcOptions
  146337. );
  146338. } else {
  146339. positions = PolylinePipeline_default.generateCartesianRhumbArc(
  146340. generateCartesianArcOptions
  146341. );
  146342. }
  146343. }
  146344. line.show = true;
  146345. line.positions = positions.slice();
  146346. line.material = MaterialProperty_default.getValue(
  146347. time,
  146348. geometryUpdater.fillMaterialProperty,
  146349. line.material
  146350. );
  146351. line.width = Property_default.getValueOrDefault(polyline._width, time, 1);
  146352. line.distanceDisplayCondition = Property_default.getValueOrUndefined(
  146353. polyline._distanceDisplayCondition,
  146354. time,
  146355. line.distanceDisplayCondition
  146356. );
  146357. };
  146358. DynamicGeometryUpdater2.prototype.getBoundingSphere = function(result) {
  146359. Check_default.defined("result", result);
  146360. if (!this._geometryUpdater.clampToGround) {
  146361. const line = getLine(this);
  146362. if (line.show && line.positions.length > 0) {
  146363. BoundingSphere_default.fromPoints(line.positions, result);
  146364. return BoundingSphereState_default.DONE;
  146365. }
  146366. } else {
  146367. const groundPolylinePrimitive = this._groundPolylinePrimitive;
  146368. if (defined_default(groundPolylinePrimitive) && groundPolylinePrimitive.show && groundPolylinePrimitive.ready) {
  146369. const attributes = groundPolylinePrimitive.getGeometryInstanceAttributes(
  146370. this._geometryUpdater._entity
  146371. );
  146372. if (defined_default(attributes) && defined_default(attributes.boundingSphere)) {
  146373. BoundingSphere_default.clone(attributes.boundingSphere, result);
  146374. return BoundingSphereState_default.DONE;
  146375. }
  146376. }
  146377. if (defined_default(groundPolylinePrimitive) && !groundPolylinePrimitive.ready) {
  146378. return BoundingSphereState_default.PENDING;
  146379. }
  146380. return BoundingSphereState_default.DONE;
  146381. }
  146382. return BoundingSphereState_default.FAILED;
  146383. };
  146384. DynamicGeometryUpdater2.prototype.isDestroyed = function() {
  146385. return false;
  146386. };
  146387. DynamicGeometryUpdater2.prototype.destroy = function() {
  146388. const geometryUpdater = this._geometryUpdater;
  146389. const sceneId = geometryUpdater._scene.id;
  146390. const polylineCollection = polylineCollections[sceneId];
  146391. if (defined_default(polylineCollection)) {
  146392. polylineCollection.remove(this._line);
  146393. if (polylineCollection.length === 0) {
  146394. this._primitives.removeAndDestroy(polylineCollection);
  146395. delete polylineCollections[sceneId];
  146396. }
  146397. }
  146398. if (defined_default(this._groundPolylinePrimitive)) {
  146399. this._groundPrimitives.remove(this._groundPolylinePrimitive);
  146400. }
  146401. destroyObject_default(this);
  146402. };
  146403. var PolylineGeometryUpdater_default = PolylineGeometryUpdater;
  146404. // node_modules/cesium/Source/DataSources/StaticGroundPolylinePerMaterialBatch.js
  146405. var scratchColor23 = new Color_default();
  146406. var distanceDisplayConditionScratch9 = new DistanceDisplayCondition_default();
  146407. var defaultDistanceDisplayCondition8 = new DistanceDisplayCondition_default();
  146408. function Batch6(orderedGroundPrimitives, classificationType, materialProperty, zIndex, asynchronous) {
  146409. let appearanceType;
  146410. if (materialProperty instanceof ColorMaterialProperty_default) {
  146411. appearanceType = PolylineColorAppearance_default;
  146412. } else {
  146413. appearanceType = PolylineMaterialAppearance_default;
  146414. }
  146415. this.orderedGroundPrimitives = orderedGroundPrimitives;
  146416. this.classificationType = classificationType;
  146417. this.appearanceType = appearanceType;
  146418. this.materialProperty = materialProperty;
  146419. this.updaters = new AssociativeArray_default();
  146420. this.createPrimitive = true;
  146421. this.primitive = void 0;
  146422. this.oldPrimitive = void 0;
  146423. this.geometry = new AssociativeArray_default();
  146424. this.material = void 0;
  146425. this.updatersWithAttributes = new AssociativeArray_default();
  146426. this.attributes = new AssociativeArray_default();
  146427. this.invalidated = false;
  146428. this.removeMaterialSubscription = materialProperty.definitionChanged.addEventListener(
  146429. Batch6.prototype.onMaterialChanged,
  146430. this
  146431. );
  146432. this.subscriptions = new AssociativeArray_default();
  146433. this.showsUpdated = new AssociativeArray_default();
  146434. this.zIndex = zIndex;
  146435. this._asynchronous = asynchronous;
  146436. }
  146437. Batch6.prototype.onMaterialChanged = function() {
  146438. this.invalidated = true;
  146439. };
  146440. Batch6.prototype.isMaterial = function(updater) {
  146441. const material = this.materialProperty;
  146442. const updaterMaterial = updater.fillMaterialProperty;
  146443. if (updaterMaterial === material || updaterMaterial instanceof ColorMaterialProperty_default && material instanceof ColorMaterialProperty_default) {
  146444. return true;
  146445. }
  146446. return defined_default(material) && material.equals(updaterMaterial);
  146447. };
  146448. Batch6.prototype.add = function(time, updater, geometryInstance) {
  146449. const id = updater.id;
  146450. this.updaters.set(id, updater);
  146451. this.geometry.set(id, geometryInstance);
  146452. if (!updater.hasConstantFill || !updater.fillMaterialProperty.isConstant || !Property_default.isConstant(updater.distanceDisplayConditionProperty)) {
  146453. this.updatersWithAttributes.set(id, updater);
  146454. } else {
  146455. const that = this;
  146456. this.subscriptions.set(
  146457. id,
  146458. updater.entity.definitionChanged.addEventListener(function(entity, propertyName, newValue, oldValue2) {
  146459. if (propertyName === "isShowing") {
  146460. that.showsUpdated.set(updater.id, updater);
  146461. }
  146462. })
  146463. );
  146464. }
  146465. this.createPrimitive = true;
  146466. };
  146467. Batch6.prototype.remove = function(updater) {
  146468. const id = updater.id;
  146469. this.createPrimitive = this.geometry.remove(id) || this.createPrimitive;
  146470. if (this.updaters.remove(id)) {
  146471. this.updatersWithAttributes.remove(id);
  146472. const unsubscribe2 = this.subscriptions.get(id);
  146473. if (defined_default(unsubscribe2)) {
  146474. unsubscribe2();
  146475. this.subscriptions.remove(id);
  146476. }
  146477. return true;
  146478. }
  146479. return false;
  146480. };
  146481. Batch6.prototype.update = function(time) {
  146482. let isUpdated = true;
  146483. let primitive = this.primitive;
  146484. const orderedGroundPrimitives = this.orderedGroundPrimitives;
  146485. const geometries = this.geometry.values;
  146486. let i2;
  146487. if (this.createPrimitive) {
  146488. const geometriesLength = geometries.length;
  146489. if (geometriesLength > 0) {
  146490. if (defined_default(primitive)) {
  146491. if (!defined_default(this.oldPrimitive)) {
  146492. this.oldPrimitive = primitive;
  146493. } else {
  146494. orderedGroundPrimitives.remove(primitive);
  146495. }
  146496. }
  146497. primitive = new GroundPolylinePrimitive_default({
  146498. show: false,
  146499. asynchronous: this._asynchronous,
  146500. geometryInstances: geometries.slice(),
  146501. appearance: new this.appearanceType(),
  146502. classificationType: this.classificationType
  146503. });
  146504. if (this.appearanceType === PolylineMaterialAppearance_default) {
  146505. this.material = MaterialProperty_default.getValue(
  146506. time,
  146507. this.materialProperty,
  146508. this.material
  146509. );
  146510. primitive.appearance.material = this.material;
  146511. }
  146512. orderedGroundPrimitives.add(primitive, this.zIndex);
  146513. isUpdated = false;
  146514. } else {
  146515. if (defined_default(primitive)) {
  146516. orderedGroundPrimitives.remove(primitive);
  146517. primitive = void 0;
  146518. }
  146519. const oldPrimitive = this.oldPrimitive;
  146520. if (defined_default(oldPrimitive)) {
  146521. orderedGroundPrimitives.remove(oldPrimitive);
  146522. this.oldPrimitive = void 0;
  146523. }
  146524. }
  146525. this.attributes.removeAll();
  146526. this.primitive = primitive;
  146527. this.createPrimitive = false;
  146528. } else if (defined_default(primitive) && primitive.ready) {
  146529. primitive.show = true;
  146530. if (defined_default(this.oldPrimitive)) {
  146531. orderedGroundPrimitives.remove(this.oldPrimitive);
  146532. this.oldPrimitive = void 0;
  146533. }
  146534. if (this.appearanceType === PolylineMaterialAppearance_default) {
  146535. this.material = MaterialProperty_default.getValue(
  146536. time,
  146537. this.materialProperty,
  146538. this.material
  146539. );
  146540. this.primitive.appearance.material = this.material;
  146541. }
  146542. const updatersWithAttributes = this.updatersWithAttributes.values;
  146543. const length3 = updatersWithAttributes.length;
  146544. for (i2 = 0; i2 < length3; i2++) {
  146545. const updater = updatersWithAttributes[i2];
  146546. const entity = updater.entity;
  146547. const instance = this.geometry.get(updater.id);
  146548. let attributes = this.attributes.get(instance.id.id);
  146549. if (!defined_default(attributes)) {
  146550. attributes = primitive.getGeometryInstanceAttributes(instance.id);
  146551. this.attributes.set(instance.id.id, attributes);
  146552. }
  146553. if (!updater.fillMaterialProperty.isConstant) {
  146554. const colorProperty = updater.fillMaterialProperty.color;
  146555. const resultColor = Property_default.getValueOrDefault(
  146556. colorProperty,
  146557. time,
  146558. Color_default.WHITE,
  146559. scratchColor23
  146560. );
  146561. if (!Color_default.equals(attributes._lastColor, resultColor)) {
  146562. attributes._lastColor = Color_default.clone(
  146563. resultColor,
  146564. attributes._lastColor
  146565. );
  146566. attributes.color = ColorGeometryInstanceAttribute_default.toValue(
  146567. resultColor,
  146568. attributes.color
  146569. );
  146570. }
  146571. }
  146572. const show = entity.isShowing && (updater.hasConstantFill || updater.isFilled(time));
  146573. const currentShow = attributes.show[0] === 1;
  146574. if (show !== currentShow) {
  146575. attributes.show = ShowGeometryInstanceAttribute_default.toValue(
  146576. show,
  146577. attributes.show
  146578. );
  146579. }
  146580. const distanceDisplayConditionProperty = updater.distanceDisplayConditionProperty;
  146581. if (!Property_default.isConstant(distanceDisplayConditionProperty)) {
  146582. const distanceDisplayCondition = Property_default.getValueOrDefault(
  146583. distanceDisplayConditionProperty,
  146584. time,
  146585. defaultDistanceDisplayCondition8,
  146586. distanceDisplayConditionScratch9
  146587. );
  146588. if (!DistanceDisplayCondition_default.equals(
  146589. distanceDisplayCondition,
  146590. attributes._lastDistanceDisplayCondition
  146591. )) {
  146592. attributes._lastDistanceDisplayCondition = DistanceDisplayCondition_default.clone(
  146593. distanceDisplayCondition,
  146594. attributes._lastDistanceDisplayCondition
  146595. );
  146596. attributes.distanceDisplayCondition = DistanceDisplayConditionGeometryInstanceAttribute_default.toValue(
  146597. distanceDisplayCondition,
  146598. attributes.distanceDisplayCondition
  146599. );
  146600. }
  146601. }
  146602. }
  146603. this.updateShows(primitive);
  146604. } else if (defined_default(primitive) && !primitive.ready) {
  146605. isUpdated = false;
  146606. }
  146607. return isUpdated;
  146608. };
  146609. Batch6.prototype.updateShows = function(primitive) {
  146610. const showsUpdated = this.showsUpdated.values;
  146611. const length3 = showsUpdated.length;
  146612. for (let i2 = 0; i2 < length3; i2++) {
  146613. const updater = showsUpdated[i2];
  146614. const entity = updater.entity;
  146615. const instance = this.geometry.get(updater.id);
  146616. let attributes = this.attributes.get(instance.id.id);
  146617. if (!defined_default(attributes)) {
  146618. attributes = primitive.getGeometryInstanceAttributes(instance.id);
  146619. this.attributes.set(instance.id.id, attributes);
  146620. }
  146621. const show = entity.isShowing;
  146622. const currentShow = attributes.show[0] === 1;
  146623. if (show !== currentShow) {
  146624. attributes.show = ShowGeometryInstanceAttribute_default.toValue(
  146625. show,
  146626. attributes.show
  146627. );
  146628. instance.attributes.show.value[0] = attributes.show[0];
  146629. }
  146630. }
  146631. this.showsUpdated.removeAll();
  146632. };
  146633. Batch6.prototype.contains = function(updater) {
  146634. return this.updaters.contains(updater.id);
  146635. };
  146636. Batch6.prototype.getBoundingSphere = function(updater, result) {
  146637. const primitive = this.primitive;
  146638. if (!primitive.ready) {
  146639. return BoundingSphereState_default.PENDING;
  146640. }
  146641. const attributes = primitive.getGeometryInstanceAttributes(updater.entity);
  146642. if (!defined_default(attributes) || !defined_default(attributes.boundingSphere) || defined_default(attributes.show) && attributes.show[0] === 0) {
  146643. return BoundingSphereState_default.FAILED;
  146644. }
  146645. attributes.boundingSphere.clone(result);
  146646. return BoundingSphereState_default.DONE;
  146647. };
  146648. Batch6.prototype.destroy = function() {
  146649. const primitive = this.primitive;
  146650. const orderedGroundPrimitives = this.orderedGroundPrimitives;
  146651. if (defined_default(primitive)) {
  146652. orderedGroundPrimitives.remove(primitive);
  146653. }
  146654. const oldPrimitive = this.oldPrimitive;
  146655. if (defined_default(oldPrimitive)) {
  146656. orderedGroundPrimitives.remove(oldPrimitive);
  146657. }
  146658. this.removeMaterialSubscription();
  146659. };
  146660. function StaticGroundPolylinePerMaterialBatch(orderedGroundPrimitives, classificationType, asynchronous) {
  146661. this._items = [];
  146662. this._orderedGroundPrimitives = orderedGroundPrimitives;
  146663. this._classificationType = classificationType;
  146664. this._asynchronous = defaultValue_default(asynchronous, true);
  146665. }
  146666. StaticGroundPolylinePerMaterialBatch.prototype.add = function(time, updater) {
  146667. const items = this._items;
  146668. const length3 = items.length;
  146669. const geometryInstance = updater.createFillGeometryInstance(time);
  146670. const zIndex = Property_default.getValueOrDefault(updater.zIndex, 0);
  146671. for (let i2 = 0; i2 < length3; ++i2) {
  146672. const item = items[i2];
  146673. if (item.isMaterial(updater) && item.zIndex === zIndex) {
  146674. item.add(time, updater, geometryInstance);
  146675. return;
  146676. }
  146677. }
  146678. const batch = new Batch6(
  146679. this._orderedGroundPrimitives,
  146680. this._classificationType,
  146681. updater.fillMaterialProperty,
  146682. zIndex,
  146683. this._asynchronous
  146684. );
  146685. batch.add(time, updater, geometryInstance);
  146686. items.push(batch);
  146687. };
  146688. StaticGroundPolylinePerMaterialBatch.prototype.remove = function(updater) {
  146689. const items = this._items;
  146690. const length3 = items.length;
  146691. for (let i2 = length3 - 1; i2 >= 0; i2--) {
  146692. const item = items[i2];
  146693. if (item.remove(updater)) {
  146694. if (item.updaters.length === 0) {
  146695. items.splice(i2, 1);
  146696. item.destroy();
  146697. }
  146698. break;
  146699. }
  146700. }
  146701. };
  146702. StaticGroundPolylinePerMaterialBatch.prototype.update = function(time) {
  146703. let i2;
  146704. const items = this._items;
  146705. const length3 = items.length;
  146706. for (i2 = length3 - 1; i2 >= 0; i2--) {
  146707. const item = items[i2];
  146708. if (item.invalidated) {
  146709. items.splice(i2, 1);
  146710. const updaters = item.updaters.values;
  146711. const updatersLength = updaters.length;
  146712. for (let h = 0; h < updatersLength; h++) {
  146713. this.add(time, updaters[h]);
  146714. }
  146715. item.destroy();
  146716. }
  146717. }
  146718. let isUpdated = true;
  146719. for (i2 = 0; i2 < items.length; i2++) {
  146720. isUpdated = items[i2].update(time) && isUpdated;
  146721. }
  146722. return isUpdated;
  146723. };
  146724. StaticGroundPolylinePerMaterialBatch.prototype.getBoundingSphere = function(updater, result) {
  146725. const items = this._items;
  146726. const length3 = items.length;
  146727. for (let i2 = 0; i2 < length3; i2++) {
  146728. const item = items[i2];
  146729. if (item.contains(updater)) {
  146730. return item.getBoundingSphere(updater, result);
  146731. }
  146732. }
  146733. return BoundingSphereState_default.FAILED;
  146734. };
  146735. StaticGroundPolylinePerMaterialBatch.prototype.removeAllPrimitives = function() {
  146736. const items = this._items;
  146737. const length3 = items.length;
  146738. for (let i2 = 0; i2 < length3; i2++) {
  146739. items[i2].destroy();
  146740. }
  146741. this._items.length = 0;
  146742. };
  146743. var StaticGroundPolylinePerMaterialBatch_default = StaticGroundPolylinePerMaterialBatch;
  146744. // node_modules/cesium/Source/DataSources/PolylineVisualizer.js
  146745. var emptyArray2 = [];
  146746. function removeUpdater(that, updater) {
  146747. const batches = that._batches;
  146748. const length3 = batches.length;
  146749. for (let i2 = 0; i2 < length3; i2++) {
  146750. batches[i2].remove(updater);
  146751. }
  146752. }
  146753. function insertUpdaterIntoBatch(that, time, updater) {
  146754. if (updater.isDynamic) {
  146755. that._dynamicBatch.add(time, updater);
  146756. return;
  146757. }
  146758. if (updater.clampToGround && updater.fillEnabled) {
  146759. const classificationType = updater.classificationTypeProperty.getValue(
  146760. time
  146761. );
  146762. that._groundBatches[classificationType].add(time, updater);
  146763. return;
  146764. }
  146765. let shadows;
  146766. if (updater.fillEnabled) {
  146767. shadows = updater.shadowsProperty.getValue(time);
  146768. }
  146769. let multiplier = 0;
  146770. if (defined_default(updater.depthFailMaterialProperty)) {
  146771. multiplier = updater.depthFailMaterialProperty instanceof ColorMaterialProperty_default ? 1 : 2;
  146772. }
  146773. let index2;
  146774. if (defined_default(shadows)) {
  146775. index2 = shadows + multiplier * ShadowMode_default.NUMBER_OF_SHADOW_MODES;
  146776. }
  146777. if (updater.fillEnabled) {
  146778. if (updater.fillMaterialProperty instanceof ColorMaterialProperty_default) {
  146779. that._colorBatches[index2].add(time, updater);
  146780. } else {
  146781. that._materialBatches[index2].add(time, updater);
  146782. }
  146783. }
  146784. }
  146785. function PolylineVisualizer(scene, entityCollection, primitives, groundPrimitives) {
  146786. Check_default.defined("scene", scene);
  146787. Check_default.defined("entityCollection", entityCollection);
  146788. groundPrimitives = defaultValue_default(groundPrimitives, scene.groundPrimitives);
  146789. primitives = defaultValue_default(primitives, scene.primitives);
  146790. this._scene = scene;
  146791. this._primitives = primitives;
  146792. this._entityCollection = void 0;
  146793. this._addedObjects = new AssociativeArray_default();
  146794. this._removedObjects = new AssociativeArray_default();
  146795. this._changedObjects = new AssociativeArray_default();
  146796. let i2;
  146797. const numberOfShadowModes = ShadowMode_default.NUMBER_OF_SHADOW_MODES;
  146798. this._colorBatches = new Array(numberOfShadowModes * 3);
  146799. this._materialBatches = new Array(numberOfShadowModes * 3);
  146800. for (i2 = 0; i2 < numberOfShadowModes; ++i2) {
  146801. this._colorBatches[i2] = new StaticGeometryColorBatch_default(
  146802. primitives,
  146803. PolylineColorAppearance_default,
  146804. void 0,
  146805. false,
  146806. i2
  146807. );
  146808. this._materialBatches[i2] = new StaticGeometryPerMaterialBatch_default(
  146809. primitives,
  146810. PolylineMaterialAppearance_default,
  146811. void 0,
  146812. false,
  146813. i2
  146814. );
  146815. this._colorBatches[i2 + numberOfShadowModes] = new StaticGeometryColorBatch_default(
  146816. primitives,
  146817. PolylineColorAppearance_default,
  146818. PolylineColorAppearance_default,
  146819. false,
  146820. i2
  146821. );
  146822. this._materialBatches[i2 + numberOfShadowModes] = new StaticGeometryPerMaterialBatch_default(
  146823. primitives,
  146824. PolylineMaterialAppearance_default,
  146825. PolylineColorAppearance_default,
  146826. false,
  146827. i2
  146828. );
  146829. this._colorBatches[i2 + numberOfShadowModes * 2] = new StaticGeometryColorBatch_default(
  146830. primitives,
  146831. PolylineColorAppearance_default,
  146832. PolylineMaterialAppearance_default,
  146833. false,
  146834. i2
  146835. );
  146836. this._materialBatches[i2 + numberOfShadowModes * 2] = new StaticGeometryPerMaterialBatch_default(
  146837. primitives,
  146838. PolylineMaterialAppearance_default,
  146839. PolylineMaterialAppearance_default,
  146840. false,
  146841. i2
  146842. );
  146843. }
  146844. this._dynamicBatch = new DynamicGeometryBatch_default(primitives, groundPrimitives);
  146845. const numberOfClassificationTypes = ClassificationType_default.NUMBER_OF_CLASSIFICATION_TYPES;
  146846. this._groundBatches = new Array(numberOfClassificationTypes);
  146847. for (i2 = 0; i2 < numberOfClassificationTypes; ++i2) {
  146848. this._groundBatches[i2] = new StaticGroundPolylinePerMaterialBatch_default(
  146849. groundPrimitives,
  146850. i2
  146851. );
  146852. }
  146853. this._batches = this._colorBatches.concat(
  146854. this._materialBatches,
  146855. this._dynamicBatch,
  146856. this._groundBatches
  146857. );
  146858. this._subscriptions = new AssociativeArray_default();
  146859. this._updaters = new AssociativeArray_default();
  146860. this._entityCollection = entityCollection;
  146861. entityCollection.collectionChanged.addEventListener(
  146862. PolylineVisualizer.prototype._onCollectionChanged,
  146863. this
  146864. );
  146865. this._onCollectionChanged(
  146866. entityCollection,
  146867. entityCollection.values,
  146868. emptyArray2
  146869. );
  146870. }
  146871. PolylineVisualizer.prototype.update = function(time) {
  146872. Check_default.defined("time", time);
  146873. const addedObjects = this._addedObjects;
  146874. const added = addedObjects.values;
  146875. const removedObjects = this._removedObjects;
  146876. const removed = removedObjects.values;
  146877. const changedObjects = this._changedObjects;
  146878. const changed = changedObjects.values;
  146879. let i2;
  146880. let entity;
  146881. let id;
  146882. let updater;
  146883. for (i2 = changed.length - 1; i2 > -1; i2--) {
  146884. entity = changed[i2];
  146885. id = entity.id;
  146886. updater = this._updaters.get(id);
  146887. if (updater.entity === entity) {
  146888. removeUpdater(this, updater);
  146889. insertUpdaterIntoBatch(this, time, updater);
  146890. } else {
  146891. removed.push(entity);
  146892. added.push(entity);
  146893. }
  146894. }
  146895. for (i2 = removed.length - 1; i2 > -1; i2--) {
  146896. entity = removed[i2];
  146897. id = entity.id;
  146898. updater = this._updaters.get(id);
  146899. removeUpdater(this, updater);
  146900. updater.destroy();
  146901. this._updaters.remove(id);
  146902. this._subscriptions.get(id)();
  146903. this._subscriptions.remove(id);
  146904. }
  146905. for (i2 = added.length - 1; i2 > -1; i2--) {
  146906. entity = added[i2];
  146907. id = entity.id;
  146908. updater = new PolylineGeometryUpdater_default(entity, this._scene);
  146909. this._updaters.set(id, updater);
  146910. insertUpdaterIntoBatch(this, time, updater);
  146911. this._subscriptions.set(
  146912. id,
  146913. updater.geometryChanged.addEventListener(
  146914. PolylineVisualizer._onGeometryChanged,
  146915. this
  146916. )
  146917. );
  146918. }
  146919. addedObjects.removeAll();
  146920. removedObjects.removeAll();
  146921. changedObjects.removeAll();
  146922. let isUpdated = true;
  146923. const batches = this._batches;
  146924. const length3 = batches.length;
  146925. for (i2 = 0; i2 < length3; i2++) {
  146926. isUpdated = batches[i2].update(time) && isUpdated;
  146927. }
  146928. return isUpdated;
  146929. };
  146930. var getBoundingSphereArrayScratch2 = [];
  146931. var getBoundingSphereBoundingSphereScratch2 = new BoundingSphere_default();
  146932. PolylineVisualizer.prototype.getBoundingSphere = function(entity, result) {
  146933. Check_default.defined("entity", entity);
  146934. Check_default.defined("result", result);
  146935. const boundingSpheres = getBoundingSphereArrayScratch2;
  146936. const tmp2 = getBoundingSphereBoundingSphereScratch2;
  146937. let count = 0;
  146938. let state = BoundingSphereState_default.DONE;
  146939. const batches = this._batches;
  146940. const batchesLength = batches.length;
  146941. const updater = this._updaters.get(entity.id);
  146942. for (let i2 = 0; i2 < batchesLength; i2++) {
  146943. state = batches[i2].getBoundingSphere(updater, tmp2);
  146944. if (state === BoundingSphereState_default.PENDING) {
  146945. return BoundingSphereState_default.PENDING;
  146946. } else if (state === BoundingSphereState_default.DONE) {
  146947. boundingSpheres[count] = BoundingSphere_default.clone(
  146948. tmp2,
  146949. boundingSpheres[count]
  146950. );
  146951. count++;
  146952. }
  146953. }
  146954. if (count === 0) {
  146955. return BoundingSphereState_default.FAILED;
  146956. }
  146957. boundingSpheres.length = count;
  146958. BoundingSphere_default.fromBoundingSpheres(boundingSpheres, result);
  146959. return BoundingSphereState_default.DONE;
  146960. };
  146961. PolylineVisualizer.prototype.isDestroyed = function() {
  146962. return false;
  146963. };
  146964. PolylineVisualizer.prototype.destroy = function() {
  146965. this._entityCollection.collectionChanged.removeEventListener(
  146966. PolylineVisualizer.prototype._onCollectionChanged,
  146967. this
  146968. );
  146969. this._addedObjects.removeAll();
  146970. this._removedObjects.removeAll();
  146971. let i2;
  146972. const batches = this._batches;
  146973. let length3 = batches.length;
  146974. for (i2 = 0; i2 < length3; i2++) {
  146975. batches[i2].removeAllPrimitives();
  146976. }
  146977. const subscriptions = this._subscriptions.values;
  146978. length3 = subscriptions.length;
  146979. for (i2 = 0; i2 < length3; i2++) {
  146980. subscriptions[i2]();
  146981. }
  146982. this._subscriptions.removeAll();
  146983. return destroyObject_default(this);
  146984. };
  146985. PolylineVisualizer._onGeometryChanged = function(updater) {
  146986. const removedObjects = this._removedObjects;
  146987. const changedObjects = this._changedObjects;
  146988. const entity = updater.entity;
  146989. const id = entity.id;
  146990. if (!defined_default(removedObjects.get(id)) && !defined_default(changedObjects.get(id))) {
  146991. changedObjects.set(id, entity);
  146992. }
  146993. };
  146994. PolylineVisualizer.prototype._onCollectionChanged = function(entityCollection, added, removed) {
  146995. const addedObjects = this._addedObjects;
  146996. const removedObjects = this._removedObjects;
  146997. const changedObjects = this._changedObjects;
  146998. let i2;
  146999. let id;
  147000. let entity;
  147001. for (i2 = removed.length - 1; i2 > -1; i2--) {
  147002. entity = removed[i2];
  147003. id = entity.id;
  147004. if (!addedObjects.remove(id)) {
  147005. removedObjects.set(id, entity);
  147006. changedObjects.remove(id);
  147007. }
  147008. }
  147009. for (i2 = added.length - 1; i2 > -1; i2--) {
  147010. entity = added[i2];
  147011. id = entity.id;
  147012. if (removedObjects.remove(id)) {
  147013. changedObjects.set(id, entity);
  147014. } else {
  147015. addedObjects.set(id, entity);
  147016. }
  147017. }
  147018. };
  147019. var PolylineVisualizer_default = PolylineVisualizer;
  147020. // node_modules/cesium/Source/DataSources/DataSourceDisplay.js
  147021. function DataSourceDisplay(options) {
  147022. Check_default.typeOf.object("options", options);
  147023. Check_default.typeOf.object("options.scene", options.scene);
  147024. Check_default.typeOf.object(
  147025. "options.dataSourceCollection",
  147026. options.dataSourceCollection
  147027. );
  147028. GroundPrimitive_default.initializeTerrainHeights();
  147029. GroundPolylinePrimitive_default.initializeTerrainHeights();
  147030. const scene = options.scene;
  147031. const dataSourceCollection = options.dataSourceCollection;
  147032. this._eventHelper = new EventHelper_default();
  147033. this._eventHelper.add(
  147034. dataSourceCollection.dataSourceAdded,
  147035. this._onDataSourceAdded,
  147036. this
  147037. );
  147038. this._eventHelper.add(
  147039. dataSourceCollection.dataSourceRemoved,
  147040. this._onDataSourceRemoved,
  147041. this
  147042. );
  147043. this._eventHelper.add(
  147044. dataSourceCollection.dataSourceMoved,
  147045. this._onDataSourceMoved,
  147046. this
  147047. );
  147048. this._eventHelper.add(scene.postRender, this._postRender, this);
  147049. this._dataSourceCollection = dataSourceCollection;
  147050. this._scene = scene;
  147051. this._visualizersCallback = defaultValue_default(
  147052. options.visualizersCallback,
  147053. DataSourceDisplay.defaultVisualizersCallback
  147054. );
  147055. let primitivesAdded = false;
  147056. const primitives = new PrimitiveCollection_default();
  147057. const groundPrimitives = new PrimitiveCollection_default();
  147058. if (dataSourceCollection.length > 0) {
  147059. scene.primitives.add(primitives);
  147060. scene.groundPrimitives.add(groundPrimitives);
  147061. primitivesAdded = true;
  147062. }
  147063. this._primitives = primitives;
  147064. this._groundPrimitives = groundPrimitives;
  147065. for (let i2 = 0, len = dataSourceCollection.length; i2 < len; i2++) {
  147066. this._onDataSourceAdded(dataSourceCollection, dataSourceCollection.get(i2));
  147067. }
  147068. const defaultDataSource = new CustomDataSource_default();
  147069. this._onDataSourceAdded(void 0, defaultDataSource);
  147070. this._defaultDataSource = defaultDataSource;
  147071. let removeDefaultDataSourceListener;
  147072. let removeDataSourceCollectionListener;
  147073. if (!primitivesAdded) {
  147074. const that = this;
  147075. const addPrimitives = function() {
  147076. scene.primitives.add(primitives);
  147077. scene.groundPrimitives.add(groundPrimitives);
  147078. removeDefaultDataSourceListener();
  147079. removeDataSourceCollectionListener();
  147080. that._removeDefaultDataSourceListener = void 0;
  147081. that._removeDataSourceCollectionListener = void 0;
  147082. };
  147083. removeDefaultDataSourceListener = defaultDataSource.entities.collectionChanged.addEventListener(
  147084. addPrimitives
  147085. );
  147086. removeDataSourceCollectionListener = dataSourceCollection.dataSourceAdded.addEventListener(
  147087. addPrimitives
  147088. );
  147089. }
  147090. this._removeDefaultDataSourceListener = removeDefaultDataSourceListener;
  147091. this._removeDataSourceCollectionListener = removeDataSourceCollectionListener;
  147092. this._ready = false;
  147093. }
  147094. DataSourceDisplay.defaultVisualizersCallback = function(scene, entityCluster, dataSource) {
  147095. const entities = dataSource.entities;
  147096. return [
  147097. new BillboardVisualizer_default(entityCluster, entities),
  147098. new GeometryVisualizer_default(
  147099. scene,
  147100. entities,
  147101. dataSource._primitives,
  147102. dataSource._groundPrimitives
  147103. ),
  147104. new LabelVisualizer_default(entityCluster, entities),
  147105. new ModelVisualizer_default(scene, entities),
  147106. new Cesium3DTilesetVisualizer_default(scene, entities),
  147107. new PointVisualizer_default(entityCluster, entities),
  147108. new PathVisualizer_default(scene, entities),
  147109. new PolylineVisualizer_default(
  147110. scene,
  147111. entities,
  147112. dataSource._primitives,
  147113. dataSource._groundPrimitives
  147114. )
  147115. ];
  147116. };
  147117. Object.defineProperties(DataSourceDisplay.prototype, {
  147118. scene: {
  147119. get: function() {
  147120. return this._scene;
  147121. }
  147122. },
  147123. dataSources: {
  147124. get: function() {
  147125. return this._dataSourceCollection;
  147126. }
  147127. },
  147128. defaultDataSource: {
  147129. get: function() {
  147130. return this._defaultDataSource;
  147131. }
  147132. },
  147133. ready: {
  147134. get: function() {
  147135. return this._ready;
  147136. }
  147137. }
  147138. });
  147139. DataSourceDisplay.prototype.isDestroyed = function() {
  147140. return false;
  147141. };
  147142. DataSourceDisplay.prototype.destroy = function() {
  147143. this._eventHelper.removeAll();
  147144. const dataSourceCollection = this._dataSourceCollection;
  147145. for (let i2 = 0, length3 = dataSourceCollection.length; i2 < length3; ++i2) {
  147146. this._onDataSourceRemoved(
  147147. this._dataSourceCollection,
  147148. dataSourceCollection.get(i2)
  147149. );
  147150. }
  147151. this._onDataSourceRemoved(void 0, this._defaultDataSource);
  147152. if (defined_default(this._removeDefaultDataSourceListener)) {
  147153. this._removeDefaultDataSourceListener();
  147154. this._removeDataSourceCollectionListener();
  147155. } else {
  147156. this._scene.primitives.remove(this._primitives);
  147157. this._scene.groundPrimitives.remove(this._groundPrimitives);
  147158. }
  147159. return destroyObject_default(this);
  147160. };
  147161. DataSourceDisplay.prototype.update = function(time) {
  147162. Check_default.defined("time", time);
  147163. if (!ApproximateTerrainHeights_default.initialized) {
  147164. this._ready = false;
  147165. return false;
  147166. }
  147167. let result = true;
  147168. let i2;
  147169. let x;
  147170. let visualizers;
  147171. let vLength;
  147172. const dataSources = this._dataSourceCollection;
  147173. const length3 = dataSources.length;
  147174. for (i2 = 0; i2 < length3; i2++) {
  147175. const dataSource = dataSources.get(i2);
  147176. if (defined_default(dataSource.update)) {
  147177. result = dataSource.update(time) && result;
  147178. }
  147179. visualizers = dataSource._visualizers;
  147180. vLength = visualizers.length;
  147181. for (x = 0; x < vLength; x++) {
  147182. result = visualizers[x].update(time) && result;
  147183. }
  147184. }
  147185. visualizers = this._defaultDataSource._visualizers;
  147186. vLength = visualizers.length;
  147187. for (x = 0; x < vLength; x++) {
  147188. result = visualizers[x].update(time) && result;
  147189. }
  147190. this._ready = result;
  147191. return result;
  147192. };
  147193. DataSourceDisplay.prototype._postRender = function() {
  147194. const frameState = this._scene.frameState;
  147195. const dataSources = this._dataSourceCollection;
  147196. const length3 = dataSources.length;
  147197. for (let i2 = 0; i2 < length3; i2++) {
  147198. const dataSource = dataSources.get(i2);
  147199. const credit = dataSource.credit;
  147200. if (defined_default(credit)) {
  147201. frameState.creditDisplay.addCredit(credit);
  147202. }
  147203. const credits = dataSource._resourceCredits;
  147204. if (defined_default(credits)) {
  147205. const creditCount = credits.length;
  147206. for (let c14 = 0; c14 < creditCount; c14++) {
  147207. frameState.creditDisplay.addCredit(credits[c14]);
  147208. }
  147209. }
  147210. }
  147211. };
  147212. var getBoundingSphereArrayScratch3 = [];
  147213. var getBoundingSphereBoundingSphereScratch3 = new BoundingSphere_default();
  147214. DataSourceDisplay.prototype.getBoundingSphere = function(entity, allowPartial, result) {
  147215. Check_default.defined("entity", entity);
  147216. Check_default.typeOf.bool("allowPartial", allowPartial);
  147217. Check_default.defined("result", result);
  147218. if (!this._ready) {
  147219. return BoundingSphereState_default.PENDING;
  147220. }
  147221. let i2;
  147222. let length3;
  147223. let dataSource = this._defaultDataSource;
  147224. if (!dataSource.entities.contains(entity)) {
  147225. dataSource = void 0;
  147226. const dataSources = this._dataSourceCollection;
  147227. length3 = dataSources.length;
  147228. for (i2 = 0; i2 < length3; i2++) {
  147229. const d = dataSources.get(i2);
  147230. if (d.entities.contains(entity)) {
  147231. dataSource = d;
  147232. break;
  147233. }
  147234. }
  147235. }
  147236. if (!defined_default(dataSource)) {
  147237. return BoundingSphereState_default.FAILED;
  147238. }
  147239. const boundingSpheres = getBoundingSphereArrayScratch3;
  147240. const tmp2 = getBoundingSphereBoundingSphereScratch3;
  147241. let count = 0;
  147242. let state = BoundingSphereState_default.DONE;
  147243. const visualizers = dataSource._visualizers;
  147244. const visualizersLength = visualizers.length;
  147245. for (i2 = 0; i2 < visualizersLength; i2++) {
  147246. const visualizer = visualizers[i2];
  147247. if (defined_default(visualizer.getBoundingSphere)) {
  147248. state = visualizers[i2].getBoundingSphere(entity, tmp2);
  147249. if (!allowPartial && state === BoundingSphereState_default.PENDING) {
  147250. return BoundingSphereState_default.PENDING;
  147251. } else if (state === BoundingSphereState_default.DONE) {
  147252. boundingSpheres[count] = BoundingSphere_default.clone(
  147253. tmp2,
  147254. boundingSpheres[count]
  147255. );
  147256. count++;
  147257. }
  147258. }
  147259. }
  147260. if (count === 0) {
  147261. return BoundingSphereState_default.FAILED;
  147262. }
  147263. boundingSpheres.length = count;
  147264. BoundingSphere_default.fromBoundingSpheres(boundingSpheres, result);
  147265. return BoundingSphereState_default.DONE;
  147266. };
  147267. DataSourceDisplay.prototype._onDataSourceAdded = function(dataSourceCollection, dataSource) {
  147268. const scene = this._scene;
  147269. const displayPrimitives = this._primitives;
  147270. const displayGroundPrimitives = this._groundPrimitives;
  147271. const primitives = displayPrimitives.add(new PrimitiveCollection_default());
  147272. const groundPrimitives = displayGroundPrimitives.add(
  147273. new OrderedGroundPrimitiveCollection_default()
  147274. );
  147275. dataSource._primitives = primitives;
  147276. dataSource._groundPrimitives = groundPrimitives;
  147277. const entityCluster = dataSource.clustering;
  147278. entityCluster._initialize(scene);
  147279. primitives.add(entityCluster);
  147280. dataSource._visualizers = this._visualizersCallback(
  147281. scene,
  147282. entityCluster,
  147283. dataSource
  147284. );
  147285. };
  147286. DataSourceDisplay.prototype._onDataSourceRemoved = function(dataSourceCollection, dataSource) {
  147287. const displayPrimitives = this._primitives;
  147288. const displayGroundPrimitives = this._groundPrimitives;
  147289. const primitives = dataSource._primitives;
  147290. const groundPrimitives = dataSource._groundPrimitives;
  147291. const entityCluster = dataSource.clustering;
  147292. primitives.remove(entityCluster);
  147293. const visualizers = dataSource._visualizers;
  147294. const length3 = visualizers.length;
  147295. for (let i2 = 0; i2 < length3; i2++) {
  147296. visualizers[i2].destroy();
  147297. }
  147298. displayPrimitives.remove(primitives);
  147299. displayGroundPrimitives.remove(groundPrimitives);
  147300. dataSource._visualizers = void 0;
  147301. };
  147302. DataSourceDisplay.prototype._onDataSourceMoved = function(dataSource, newIndex, oldIndex) {
  147303. const displayPrimitives = this._primitives;
  147304. const displayGroundPrimitives = this._groundPrimitives;
  147305. const primitives = dataSource._primitives;
  147306. const groundPrimitives = dataSource._groundPrimitives;
  147307. if (newIndex === oldIndex + 1) {
  147308. displayPrimitives.raise(primitives);
  147309. displayGroundPrimitives.raise(groundPrimitives);
  147310. } else if (newIndex === oldIndex - 1) {
  147311. displayPrimitives.lower(primitives);
  147312. displayGroundPrimitives.lower(groundPrimitives);
  147313. } else if (newIndex === 0) {
  147314. displayPrimitives.lowerToBottom(primitives);
  147315. displayGroundPrimitives.lowerToBottom(groundPrimitives);
  147316. displayPrimitives.raise(primitives);
  147317. displayGroundPrimitives.raise(groundPrimitives);
  147318. } else {
  147319. displayPrimitives.raiseToTop(primitives);
  147320. displayGroundPrimitives.raiseToTop(groundPrimitives);
  147321. }
  147322. };
  147323. var DataSourceDisplay_default = DataSourceDisplay;
  147324. // node_modules/cesium/Source/DataSources/EntityView.js
  147325. var updateTransformMatrix3Scratch1 = new Matrix3_default();
  147326. var updateTransformMatrix3Scratch2 = new Matrix3_default();
  147327. var updateTransformMatrix3Scratch3 = new Matrix3_default();
  147328. var updateTransformMatrix4Scratch = new Matrix4_default();
  147329. var updateTransformCartesian3Scratch1 = new Cartesian3_default();
  147330. var updateTransformCartesian3Scratch2 = new Cartesian3_default();
  147331. var updateTransformCartesian3Scratch3 = new Cartesian3_default();
  147332. var updateTransformCartesian3Scratch4 = new Cartesian3_default();
  147333. var updateTransformCartesian3Scratch5 = new Cartesian3_default();
  147334. var updateTransformCartesian3Scratch6 = new Cartesian3_default();
  147335. var deltaTime = new JulianDate_default();
  147336. var northUpAxisFactor = 1.25;
  147337. function updateTransform(that, camera, updateLookAt, saveCamera, positionProperty, time, ellipsoid) {
  147338. const mode2 = that.scene.mode;
  147339. let cartesian11 = positionProperty.getValue(time, that._lastCartesian);
  147340. if (defined_default(cartesian11)) {
  147341. let hasBasis = false;
  147342. let invertVelocity = false;
  147343. let xBasis;
  147344. let yBasis;
  147345. let zBasis;
  147346. if (mode2 === SceneMode_default.SCENE3D) {
  147347. JulianDate_default.addSeconds(time, 1e-3, deltaTime);
  147348. let deltaCartesian = positionProperty.getValue(
  147349. deltaTime,
  147350. updateTransformCartesian3Scratch1
  147351. );
  147352. if (!defined_default(deltaCartesian)) {
  147353. JulianDate_default.addSeconds(time, -1e-3, deltaTime);
  147354. deltaCartesian = positionProperty.getValue(
  147355. deltaTime,
  147356. updateTransformCartesian3Scratch1
  147357. );
  147358. invertVelocity = true;
  147359. }
  147360. if (defined_default(deltaCartesian)) {
  147361. let toInertial = Transforms_default.computeFixedToIcrfMatrix(
  147362. time,
  147363. updateTransformMatrix3Scratch1
  147364. );
  147365. let toInertialDelta = Transforms_default.computeFixedToIcrfMatrix(
  147366. deltaTime,
  147367. updateTransformMatrix3Scratch2
  147368. );
  147369. let toFixed;
  147370. if (!defined_default(toInertial) || !defined_default(toInertialDelta)) {
  147371. toFixed = Transforms_default.computeTemeToPseudoFixedMatrix(
  147372. time,
  147373. updateTransformMatrix3Scratch3
  147374. );
  147375. toInertial = Matrix3_default.transpose(
  147376. toFixed,
  147377. updateTransformMatrix3Scratch1
  147378. );
  147379. toInertialDelta = Transforms_default.computeTemeToPseudoFixedMatrix(
  147380. deltaTime,
  147381. updateTransformMatrix3Scratch2
  147382. );
  147383. Matrix3_default.transpose(toInertialDelta, toInertialDelta);
  147384. } else {
  147385. toFixed = Matrix3_default.transpose(
  147386. toInertial,
  147387. updateTransformMatrix3Scratch3
  147388. );
  147389. }
  147390. const inertialCartesian = Matrix3_default.multiplyByVector(
  147391. toInertial,
  147392. cartesian11,
  147393. updateTransformCartesian3Scratch5
  147394. );
  147395. const inertialDeltaCartesian = Matrix3_default.multiplyByVector(
  147396. toInertialDelta,
  147397. deltaCartesian,
  147398. updateTransformCartesian3Scratch6
  147399. );
  147400. Cartesian3_default.subtract(
  147401. inertialCartesian,
  147402. inertialDeltaCartesian,
  147403. updateTransformCartesian3Scratch4
  147404. );
  147405. const inertialVelocity = Cartesian3_default.magnitude(updateTransformCartesian3Scratch4) * 1e3;
  147406. const mu = Math_default.GRAVITATIONALPARAMETER;
  147407. const semiMajorAxis = -mu / (inertialVelocity * inertialVelocity - 2 * mu / Cartesian3_default.magnitude(inertialCartesian));
  147408. if (semiMajorAxis < 0 || semiMajorAxis > northUpAxisFactor * ellipsoid.maximumRadius) {
  147409. xBasis = updateTransformCartesian3Scratch2;
  147410. Cartesian3_default.normalize(cartesian11, xBasis);
  147411. Cartesian3_default.negate(xBasis, xBasis);
  147412. zBasis = Cartesian3_default.clone(
  147413. Cartesian3_default.UNIT_Z,
  147414. updateTransformCartesian3Scratch3
  147415. );
  147416. yBasis = Cartesian3_default.cross(
  147417. zBasis,
  147418. xBasis,
  147419. updateTransformCartesian3Scratch1
  147420. );
  147421. if (Cartesian3_default.magnitude(yBasis) > Math_default.EPSILON7) {
  147422. Cartesian3_default.normalize(xBasis, xBasis);
  147423. Cartesian3_default.normalize(yBasis, yBasis);
  147424. zBasis = Cartesian3_default.cross(
  147425. xBasis,
  147426. yBasis,
  147427. updateTransformCartesian3Scratch3
  147428. );
  147429. Cartesian3_default.normalize(zBasis, zBasis);
  147430. hasBasis = true;
  147431. }
  147432. } else if (!Cartesian3_default.equalsEpsilon(
  147433. cartesian11,
  147434. deltaCartesian,
  147435. Math_default.EPSILON7
  147436. )) {
  147437. zBasis = updateTransformCartesian3Scratch2;
  147438. Cartesian3_default.normalize(inertialCartesian, zBasis);
  147439. Cartesian3_default.normalize(inertialDeltaCartesian, inertialDeltaCartesian);
  147440. yBasis = Cartesian3_default.cross(
  147441. zBasis,
  147442. inertialDeltaCartesian,
  147443. updateTransformCartesian3Scratch3
  147444. );
  147445. if (invertVelocity) {
  147446. yBasis = Cartesian3_default.multiplyByScalar(yBasis, -1, yBasis);
  147447. }
  147448. if (!Cartesian3_default.equalsEpsilon(
  147449. yBasis,
  147450. Cartesian3_default.ZERO,
  147451. Math_default.EPSILON7
  147452. )) {
  147453. xBasis = Cartesian3_default.cross(
  147454. yBasis,
  147455. zBasis,
  147456. updateTransformCartesian3Scratch1
  147457. );
  147458. Matrix3_default.multiplyByVector(toFixed, xBasis, xBasis);
  147459. Matrix3_default.multiplyByVector(toFixed, yBasis, yBasis);
  147460. Matrix3_default.multiplyByVector(toFixed, zBasis, zBasis);
  147461. Cartesian3_default.normalize(xBasis, xBasis);
  147462. Cartesian3_default.normalize(yBasis, yBasis);
  147463. Cartesian3_default.normalize(zBasis, zBasis);
  147464. hasBasis = true;
  147465. }
  147466. }
  147467. }
  147468. }
  147469. if (defined_default(that.boundingSphere)) {
  147470. cartesian11 = that.boundingSphere.center;
  147471. }
  147472. let position;
  147473. let direction2;
  147474. let up;
  147475. if (saveCamera) {
  147476. position = Cartesian3_default.clone(
  147477. camera.position,
  147478. updateTransformCartesian3Scratch4
  147479. );
  147480. direction2 = Cartesian3_default.clone(
  147481. camera.direction,
  147482. updateTransformCartesian3Scratch5
  147483. );
  147484. up = Cartesian3_default.clone(camera.up, updateTransformCartesian3Scratch6);
  147485. }
  147486. const transform4 = updateTransformMatrix4Scratch;
  147487. if (hasBasis) {
  147488. transform4[0] = xBasis.x;
  147489. transform4[1] = xBasis.y;
  147490. transform4[2] = xBasis.z;
  147491. transform4[3] = 0;
  147492. transform4[4] = yBasis.x;
  147493. transform4[5] = yBasis.y;
  147494. transform4[6] = yBasis.z;
  147495. transform4[7] = 0;
  147496. transform4[8] = zBasis.x;
  147497. transform4[9] = zBasis.y;
  147498. transform4[10] = zBasis.z;
  147499. transform4[11] = 0;
  147500. transform4[12] = cartesian11.x;
  147501. transform4[13] = cartesian11.y;
  147502. transform4[14] = cartesian11.z;
  147503. transform4[15] = 0;
  147504. } else {
  147505. Transforms_default.eastNorthUpToFixedFrame(cartesian11, ellipsoid, transform4);
  147506. }
  147507. camera._setTransform(transform4);
  147508. if (saveCamera) {
  147509. Cartesian3_default.clone(position, camera.position);
  147510. Cartesian3_default.clone(direction2, camera.direction);
  147511. Cartesian3_default.clone(up, camera.up);
  147512. Cartesian3_default.cross(direction2, up, camera.right);
  147513. }
  147514. }
  147515. if (updateLookAt) {
  147516. const offset2 = mode2 === SceneMode_default.SCENE2D || Cartesian3_default.equals(that._offset3D, Cartesian3_default.ZERO) ? void 0 : that._offset3D;
  147517. camera.lookAtTransform(camera.transform, offset2);
  147518. }
  147519. }
  147520. function EntityView(entity, scene, ellipsoid) {
  147521. Check_default.defined("entity", entity);
  147522. Check_default.defined("scene", scene);
  147523. this.entity = entity;
  147524. this.scene = scene;
  147525. this.ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  147526. this.boundingSphere = void 0;
  147527. this._lastEntity = void 0;
  147528. this._mode = void 0;
  147529. this._lastCartesian = new Cartesian3_default();
  147530. this._defaultOffset3D = void 0;
  147531. this._offset3D = new Cartesian3_default();
  147532. }
  147533. Object.defineProperties(EntityView, {
  147534. defaultOffset3D: {
  147535. get: function() {
  147536. return this._defaultOffset3D;
  147537. },
  147538. set: function(vector) {
  147539. this._defaultOffset3D = Cartesian3_default.clone(vector, new Cartesian3_default());
  147540. }
  147541. }
  147542. });
  147543. EntityView.defaultOffset3D = new Cartesian3_default(-14e3, 3500, 3500);
  147544. var scratchHeadingPitchRange = new HeadingPitchRange_default();
  147545. var scratchCartesian21 = new Cartesian3_default();
  147546. EntityView.prototype.update = function(time, boundingSphere) {
  147547. Check_default.defined("time", time);
  147548. const scene = this.scene;
  147549. const ellipsoid = this.ellipsoid;
  147550. const sceneMode = scene.mode;
  147551. if (sceneMode === SceneMode_default.MORPHING) {
  147552. return;
  147553. }
  147554. const entity = this.entity;
  147555. const positionProperty = entity.position;
  147556. if (!defined_default(positionProperty)) {
  147557. return;
  147558. }
  147559. const objectChanged = entity !== this._lastEntity;
  147560. const sceneModeChanged = sceneMode !== this._mode;
  147561. const camera = scene.camera;
  147562. let updateLookAt = objectChanged || sceneModeChanged;
  147563. let saveCamera = true;
  147564. if (objectChanged) {
  147565. const viewFromProperty = entity.viewFrom;
  147566. const hasViewFrom = defined_default(viewFromProperty);
  147567. if (!hasViewFrom && defined_default(boundingSphere)) {
  147568. scratchHeadingPitchRange.pitch = -Math_default.PI_OVER_FOUR;
  147569. scratchHeadingPitchRange.range = 0;
  147570. const position = positionProperty.getValue(time, scratchCartesian21);
  147571. if (defined_default(position)) {
  147572. const factor2 = 2 - 1 / Math.max(
  147573. 1,
  147574. Cartesian3_default.magnitude(position) / ellipsoid.maximumRadius
  147575. );
  147576. scratchHeadingPitchRange.pitch *= factor2;
  147577. }
  147578. camera.viewBoundingSphere(boundingSphere, scratchHeadingPitchRange);
  147579. this.boundingSphere = boundingSphere;
  147580. updateLookAt = false;
  147581. saveCamera = false;
  147582. } else if (!hasViewFrom || !defined_default(viewFromProperty.getValue(time, this._offset3D))) {
  147583. Cartesian3_default.clone(EntityView._defaultOffset3D, this._offset3D);
  147584. }
  147585. } else if (!sceneModeChanged && this._mode !== SceneMode_default.SCENE2D) {
  147586. Cartesian3_default.clone(camera.position, this._offset3D);
  147587. }
  147588. this._lastEntity = entity;
  147589. this._mode = sceneMode;
  147590. updateTransform(
  147591. this,
  147592. camera,
  147593. updateLookAt,
  147594. saveCamera,
  147595. positionProperty,
  147596. time,
  147597. ellipsoid
  147598. );
  147599. };
  147600. var EntityView_default = EntityView;
  147601. // node_modules/cesium/Source/ThirdParty/topojson.js
  147602. function identity(x) {
  147603. return x;
  147604. }
  147605. function transform2(transform4) {
  147606. if (transform4 == null)
  147607. return identity;
  147608. var x0, y0, kx = transform4.scale[0], ky = transform4.scale[1], dx = transform4.translate[0], dy = transform4.translate[1];
  147609. return function(input, i2) {
  147610. if (!i2)
  147611. x0 = y0 = 0;
  147612. var j = 2, n2 = input.length, output = new Array(n2);
  147613. output[0] = (x0 += input[0]) * kx + dx;
  147614. output[1] = (y0 += input[1]) * ky + dy;
  147615. while (j < n2)
  147616. output[j] = input[j], ++j;
  147617. return output;
  147618. };
  147619. }
  147620. function bbox(topology) {
  147621. var t = transform2(topology.transform), key, x0 = Infinity, y0 = x0, x1 = -x0, y1 = -x0;
  147622. function bboxPoint(p2) {
  147623. p2 = t(p2);
  147624. if (p2[0] < x0)
  147625. x0 = p2[0];
  147626. if (p2[0] > x1)
  147627. x1 = p2[0];
  147628. if (p2[1] < y0)
  147629. y0 = p2[1];
  147630. if (p2[1] > y1)
  147631. y1 = p2[1];
  147632. }
  147633. function bboxGeometry(o2) {
  147634. switch (o2.type) {
  147635. case "GeometryCollection":
  147636. o2.geometries.forEach(bboxGeometry);
  147637. break;
  147638. case "Point":
  147639. bboxPoint(o2.coordinates);
  147640. break;
  147641. case "MultiPoint":
  147642. o2.coordinates.forEach(bboxPoint);
  147643. break;
  147644. }
  147645. }
  147646. topology.arcs.forEach(function(arc) {
  147647. var i2 = -1, n2 = arc.length, p2;
  147648. while (++i2 < n2) {
  147649. p2 = t(arc[i2], i2);
  147650. if (p2[0] < x0)
  147651. x0 = p2[0];
  147652. if (p2[0] > x1)
  147653. x1 = p2[0];
  147654. if (p2[1] < y0)
  147655. y0 = p2[1];
  147656. if (p2[1] > y1)
  147657. y1 = p2[1];
  147658. }
  147659. });
  147660. for (key in topology.objects) {
  147661. bboxGeometry(topology.objects[key]);
  147662. }
  147663. return [x0, y0, x1, y1];
  147664. }
  147665. function reverse(array, n2) {
  147666. var t, j = array.length, i2 = j - n2;
  147667. while (i2 < --j)
  147668. t = array[i2], array[i2++] = array[j], array[j] = t;
  147669. }
  147670. function feature(topology, o2) {
  147671. if (typeof o2 === "string")
  147672. o2 = topology.objects[o2];
  147673. return o2.type === "GeometryCollection" ? { type: "FeatureCollection", features: o2.geometries.map(function(o3) {
  147674. return feature$1(topology, o3);
  147675. }) } : feature$1(topology, o2);
  147676. }
  147677. function feature$1(topology, o2) {
  147678. var id = o2.id, bbox2 = o2.bbox, properties = o2.properties == null ? {} : o2.properties, geometry = object(topology, o2);
  147679. return id == null && bbox2 == null ? { type: "Feature", properties, geometry } : bbox2 == null ? { type: "Feature", id, properties, geometry } : { type: "Feature", id, bbox: bbox2, properties, geometry };
  147680. }
  147681. function object(topology, o2) {
  147682. var transformPoint2 = transform2(topology.transform), arcs = topology.arcs;
  147683. function arc(i2, points) {
  147684. if (points.length)
  147685. points.pop();
  147686. for (var a4 = arcs[i2 < 0 ? ~i2 : i2], k = 0, n2 = a4.length; k < n2; ++k) {
  147687. points.push(transformPoint2(a4[k], k));
  147688. }
  147689. if (i2 < 0)
  147690. reverse(points, n2);
  147691. }
  147692. function point(p2) {
  147693. return transformPoint2(p2);
  147694. }
  147695. function line(arcs2) {
  147696. var points = [];
  147697. for (var i2 = 0, n2 = arcs2.length; i2 < n2; ++i2)
  147698. arc(arcs2[i2], points);
  147699. if (points.length < 2)
  147700. points.push(points[0]);
  147701. return points;
  147702. }
  147703. function ring(arcs2) {
  147704. var points = line(arcs2);
  147705. while (points.length < 4)
  147706. points.push(points[0]);
  147707. return points;
  147708. }
  147709. function polygon(arcs2) {
  147710. return arcs2.map(ring);
  147711. }
  147712. function geometry(o3) {
  147713. var type = o3.type, coordinates;
  147714. switch (type) {
  147715. case "GeometryCollection":
  147716. return { type, geometries: o3.geometries.map(geometry) };
  147717. case "Point":
  147718. coordinates = point(o3.coordinates);
  147719. break;
  147720. case "MultiPoint":
  147721. coordinates = o3.coordinates.map(point);
  147722. break;
  147723. case "LineString":
  147724. coordinates = line(o3.arcs);
  147725. break;
  147726. case "MultiLineString":
  147727. coordinates = o3.arcs.map(line);
  147728. break;
  147729. case "Polygon":
  147730. coordinates = polygon(o3.arcs);
  147731. break;
  147732. case "MultiPolygon":
  147733. coordinates = o3.arcs.map(polygon);
  147734. break;
  147735. default:
  147736. return null;
  147737. }
  147738. return { type, coordinates };
  147739. }
  147740. return geometry(o2);
  147741. }
  147742. function stitch(topology, arcs) {
  147743. var stitchedArcs = {}, fragmentByStart = {}, fragmentByEnd = {}, fragments = [], emptyIndex = -1;
  147744. arcs.forEach(function(i2, j) {
  147745. var arc = topology.arcs[i2 < 0 ? ~i2 : i2], t;
  147746. if (arc.length < 3 && !arc[1][0] && !arc[1][1]) {
  147747. t = arcs[++emptyIndex], arcs[emptyIndex] = i2, arcs[j] = t;
  147748. }
  147749. });
  147750. arcs.forEach(function(i2) {
  147751. var e2 = ends(i2), start = e2[0], end = e2[1], f2, g;
  147752. if (f2 = fragmentByEnd[start]) {
  147753. delete fragmentByEnd[f2.end];
  147754. f2.push(i2);
  147755. f2.end = end;
  147756. if (g = fragmentByStart[end]) {
  147757. delete fragmentByStart[g.start];
  147758. var fg = g === f2 ? f2 : f2.concat(g);
  147759. fragmentByStart[fg.start = f2.start] = fragmentByEnd[fg.end = g.end] = fg;
  147760. } else {
  147761. fragmentByStart[f2.start] = fragmentByEnd[f2.end] = f2;
  147762. }
  147763. } else if (f2 = fragmentByStart[end]) {
  147764. delete fragmentByStart[f2.start];
  147765. f2.unshift(i2);
  147766. f2.start = start;
  147767. if (g = fragmentByEnd[start]) {
  147768. delete fragmentByEnd[g.end];
  147769. var gf = g === f2 ? f2 : g.concat(f2);
  147770. fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f2.end] = gf;
  147771. } else {
  147772. fragmentByStart[f2.start] = fragmentByEnd[f2.end] = f2;
  147773. }
  147774. } else {
  147775. f2 = [i2];
  147776. fragmentByStart[f2.start = start] = fragmentByEnd[f2.end = end] = f2;
  147777. }
  147778. });
  147779. function ends(i2) {
  147780. var arc = topology.arcs[i2 < 0 ? ~i2 : i2], p0 = arc[0], p1;
  147781. if (topology.transform)
  147782. p1 = [0, 0], arc.forEach(function(dp) {
  147783. p1[0] += dp[0], p1[1] += dp[1];
  147784. });
  147785. else
  147786. p1 = arc[arc.length - 1];
  147787. return i2 < 0 ? [p1, p0] : [p0, p1];
  147788. }
  147789. function flush(fragmentByEnd2, fragmentByStart2) {
  147790. for (var k in fragmentByEnd2) {
  147791. var f2 = fragmentByEnd2[k];
  147792. delete fragmentByStart2[f2.start];
  147793. delete f2.start;
  147794. delete f2.end;
  147795. f2.forEach(function(i2) {
  147796. stitchedArcs[i2 < 0 ? ~i2 : i2] = 1;
  147797. });
  147798. fragments.push(f2);
  147799. }
  147800. }
  147801. flush(fragmentByEnd, fragmentByStart);
  147802. flush(fragmentByStart, fragmentByEnd);
  147803. arcs.forEach(function(i2) {
  147804. if (!stitchedArcs[i2 < 0 ? ~i2 : i2])
  147805. fragments.push([i2]);
  147806. });
  147807. return fragments;
  147808. }
  147809. function mesh(topology) {
  147810. return object(topology, meshArcs.apply(this, arguments));
  147811. }
  147812. function meshArcs(topology, object2, filter) {
  147813. var arcs, i2, n2;
  147814. if (arguments.length > 1)
  147815. arcs = extractArcs(topology, object2, filter);
  147816. else
  147817. for (i2 = 0, arcs = new Array(n2 = topology.arcs.length); i2 < n2; ++i2)
  147818. arcs[i2] = i2;
  147819. return { type: "MultiLineString", arcs: stitch(topology, arcs) };
  147820. }
  147821. function extractArcs(topology, object2, filter) {
  147822. var arcs = [], geomsByArc = [], geom;
  147823. function extract0(i2) {
  147824. var j = i2 < 0 ? ~i2 : i2;
  147825. (geomsByArc[j] || (geomsByArc[j] = [])).push({ i: i2, g: geom });
  147826. }
  147827. function extract1(arcs2) {
  147828. arcs2.forEach(extract0);
  147829. }
  147830. function extract2(arcs2) {
  147831. arcs2.forEach(extract1);
  147832. }
  147833. function extract3(arcs2) {
  147834. arcs2.forEach(extract2);
  147835. }
  147836. function geometry(o2) {
  147837. switch (geom = o2, o2.type) {
  147838. case "GeometryCollection":
  147839. o2.geometries.forEach(geometry);
  147840. break;
  147841. case "LineString":
  147842. extract1(o2.arcs);
  147843. break;
  147844. case "MultiLineString":
  147845. case "Polygon":
  147846. extract2(o2.arcs);
  147847. break;
  147848. case "MultiPolygon":
  147849. extract3(o2.arcs);
  147850. break;
  147851. }
  147852. }
  147853. geometry(object2);
  147854. geomsByArc.forEach(filter == null ? function(geoms) {
  147855. arcs.push(geoms[0].i);
  147856. } : function(geoms) {
  147857. if (filter(geoms[0].g, geoms[geoms.length - 1].g))
  147858. arcs.push(geoms[0].i);
  147859. });
  147860. return arcs;
  147861. }
  147862. function planarRingArea(ring) {
  147863. var i2 = -1, n2 = ring.length, a4, b = ring[n2 - 1], area2 = 0;
  147864. while (++i2 < n2)
  147865. a4 = b, b = ring[i2], area2 += a4[0] * b[1] - a4[1] * b[0];
  147866. return Math.abs(area2);
  147867. }
  147868. function merge2(topology) {
  147869. return object(topology, mergeArcs.apply(this, arguments));
  147870. }
  147871. function mergeArcs(topology, objects) {
  147872. var polygonsByArc = {}, polygons = [], groups = [];
  147873. objects.forEach(geometry);
  147874. function geometry(o2) {
  147875. switch (o2.type) {
  147876. case "GeometryCollection":
  147877. o2.geometries.forEach(geometry);
  147878. break;
  147879. case "Polygon":
  147880. extract(o2.arcs);
  147881. break;
  147882. case "MultiPolygon":
  147883. o2.arcs.forEach(extract);
  147884. break;
  147885. }
  147886. }
  147887. function extract(polygon) {
  147888. polygon.forEach(function(ring) {
  147889. ring.forEach(function(arc) {
  147890. (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon);
  147891. });
  147892. });
  147893. polygons.push(polygon);
  147894. }
  147895. function area2(ring) {
  147896. return planarRingArea(object(topology, { type: "Polygon", arcs: [ring] }).coordinates[0]);
  147897. }
  147898. polygons.forEach(function(polygon) {
  147899. if (!polygon._) {
  147900. var group = [], neighbors2 = [polygon];
  147901. polygon._ = 1;
  147902. groups.push(group);
  147903. while (polygon = neighbors2.pop()) {
  147904. group.push(polygon);
  147905. polygon.forEach(function(ring) {
  147906. ring.forEach(function(arc) {
  147907. polygonsByArc[arc < 0 ? ~arc : arc].forEach(function(polygon2) {
  147908. if (!polygon2._) {
  147909. polygon2._ = 1;
  147910. neighbors2.push(polygon2);
  147911. }
  147912. });
  147913. });
  147914. });
  147915. }
  147916. }
  147917. });
  147918. polygons.forEach(function(polygon) {
  147919. delete polygon._;
  147920. });
  147921. return {
  147922. type: "MultiPolygon",
  147923. arcs: groups.map(function(polygons2) {
  147924. var arcs = [], n2;
  147925. polygons2.forEach(function(polygon) {
  147926. polygon.forEach(function(ring) {
  147927. ring.forEach(function(arc) {
  147928. if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) {
  147929. arcs.push(arc);
  147930. }
  147931. });
  147932. });
  147933. });
  147934. arcs = stitch(topology, arcs);
  147935. if ((n2 = arcs.length) > 1) {
  147936. for (var i2 = 1, k = area2(arcs[0]), ki, t; i2 < n2; ++i2) {
  147937. if ((ki = area2(arcs[i2])) > k) {
  147938. t = arcs[0], arcs[0] = arcs[i2], arcs[i2] = t, k = ki;
  147939. }
  147940. }
  147941. }
  147942. return arcs;
  147943. }).filter(function(arcs) {
  147944. return arcs.length > 0;
  147945. })
  147946. };
  147947. }
  147948. function bisect(a4, x) {
  147949. var lo = 0, hi = a4.length;
  147950. while (lo < hi) {
  147951. var mid = lo + hi >>> 1;
  147952. if (a4[mid] < x)
  147953. lo = mid + 1;
  147954. else
  147955. hi = mid;
  147956. }
  147957. return lo;
  147958. }
  147959. function neighbors(objects) {
  147960. var indexesByArc = {}, neighbors2 = objects.map(function() {
  147961. return [];
  147962. });
  147963. function line(arcs, i3) {
  147964. arcs.forEach(function(a4) {
  147965. if (a4 < 0)
  147966. a4 = ~a4;
  147967. var o2 = indexesByArc[a4];
  147968. if (o2)
  147969. o2.push(i3);
  147970. else
  147971. indexesByArc[a4] = [i3];
  147972. });
  147973. }
  147974. function polygon(arcs, i3) {
  147975. arcs.forEach(function(arc) {
  147976. line(arc, i3);
  147977. });
  147978. }
  147979. function geometry(o2, i3) {
  147980. if (o2.type === "GeometryCollection")
  147981. o2.geometries.forEach(function(o3) {
  147982. geometry(o3, i3);
  147983. });
  147984. else if (o2.type in geometryType)
  147985. geometryType[o2.type](o2.arcs, i3);
  147986. }
  147987. var geometryType = {
  147988. LineString: line,
  147989. MultiLineString: polygon,
  147990. Polygon: polygon,
  147991. MultiPolygon: function(arcs, i3) {
  147992. arcs.forEach(function(arc) {
  147993. polygon(arc, i3);
  147994. });
  147995. }
  147996. };
  147997. objects.forEach(geometry);
  147998. for (var i2 in indexesByArc) {
  147999. for (var indexes = indexesByArc[i2], m = indexes.length, j = 0; j < m; ++j) {
  148000. for (var k = j + 1; k < m; ++k) {
  148001. var ij = indexes[j], ik = indexes[k], n2;
  148002. if ((n2 = neighbors2[ij])[i2 = bisect(n2, ik)] !== ik)
  148003. n2.splice(i2, 0, ik);
  148004. if ((n2 = neighbors2[ik])[i2 = bisect(n2, ij)] !== ij)
  148005. n2.splice(i2, 0, ij);
  148006. }
  148007. }
  148008. }
  148009. return neighbors2;
  148010. }
  148011. function untransform(transform4) {
  148012. if (transform4 == null)
  148013. return identity;
  148014. var x0, y0, kx = transform4.scale[0], ky = transform4.scale[1], dx = transform4.translate[0], dy = transform4.translate[1];
  148015. return function(input, i2) {
  148016. if (!i2)
  148017. x0 = y0 = 0;
  148018. var j = 2, n2 = input.length, output = new Array(n2), x1 = Math.round((input[0] - dx) / kx), y1 = Math.round((input[1] - dy) / ky);
  148019. output[0] = x1 - x0, x0 = x1;
  148020. output[1] = y1 - y0, y0 = y1;
  148021. while (j < n2)
  148022. output[j] = input[j], ++j;
  148023. return output;
  148024. };
  148025. }
  148026. function quantize(topology, transform4) {
  148027. if (topology.transform)
  148028. throw new Error("already quantized");
  148029. if (!transform4 || !transform4.scale) {
  148030. if (!((n2 = Math.floor(transform4)) >= 2))
  148031. throw new Error("n must be \u22652");
  148032. box = topology.bbox || bbox(topology);
  148033. var x0 = box[0], y0 = box[1], x1 = box[2], y1 = box[3], n2;
  148034. transform4 = { scale: [x1 - x0 ? (x1 - x0) / (n2 - 1) : 1, y1 - y0 ? (y1 - y0) / (n2 - 1) : 1], translate: [x0, y0] };
  148035. } else {
  148036. box = topology.bbox;
  148037. }
  148038. var t = untransform(transform4), box, key, inputs = topology.objects, outputs = {};
  148039. function quantizePoint(point) {
  148040. return t(point);
  148041. }
  148042. function quantizeGeometry(input) {
  148043. var output;
  148044. switch (input.type) {
  148045. case "GeometryCollection":
  148046. output = { type: "GeometryCollection", geometries: input.geometries.map(quantizeGeometry) };
  148047. break;
  148048. case "Point":
  148049. output = { type: "Point", coordinates: quantizePoint(input.coordinates) };
  148050. break;
  148051. case "MultiPoint":
  148052. output = { type: "MultiPoint", coordinates: input.coordinates.map(quantizePoint) };
  148053. break;
  148054. default:
  148055. return input;
  148056. }
  148057. if (input.id != null)
  148058. output.id = input.id;
  148059. if (input.bbox != null)
  148060. output.bbox = input.bbox;
  148061. if (input.properties != null)
  148062. output.properties = input.properties;
  148063. return output;
  148064. }
  148065. function quantizeArc(input) {
  148066. var i2 = 0, j = 1, n3 = input.length, p2, output = new Array(n3);
  148067. output[0] = t(input[0], 0);
  148068. while (++i2 < n3)
  148069. if ((p2 = t(input[i2], i2))[0] || p2[1])
  148070. output[j++] = p2;
  148071. if (j === 1)
  148072. output[j++] = [0, 0];
  148073. output.length = j;
  148074. return output;
  148075. }
  148076. for (key in inputs)
  148077. outputs[key] = quantizeGeometry(inputs[key]);
  148078. return {
  148079. type: "Topology",
  148080. bbox: box,
  148081. transform: transform4,
  148082. objects: outputs,
  148083. arcs: topology.arcs.map(quantizeArc)
  148084. };
  148085. }
  148086. var index = Object.freeze({
  148087. __proto__: null,
  148088. bbox,
  148089. feature,
  148090. mesh,
  148091. meshArcs,
  148092. merge: merge2,
  148093. mergeArcs,
  148094. neighbors,
  148095. quantize,
  148096. transform: transform2,
  148097. untransform
  148098. });
  148099. // node_modules/cesium/Source/DataSources/GeoJsonDataSource.js
  148100. function defaultCrsFunction(coordinates) {
  148101. return Cartesian3_default.fromDegrees(coordinates[0], coordinates[1], coordinates[2]);
  148102. }
  148103. var crsNames = {
  148104. "urn:ogc:def:crs:OGC:1.3:CRS84": defaultCrsFunction,
  148105. "EPSG:4326": defaultCrsFunction,
  148106. "urn:ogc:def:crs:EPSG::4326": defaultCrsFunction
  148107. };
  148108. var crsLinkHrefs = {};
  148109. var crsLinkTypes = {};
  148110. var defaultMarkerSize = 48;
  148111. var defaultMarkerSymbol;
  148112. var defaultMarkerColor = Color_default.ROYALBLUE;
  148113. var defaultStroke = Color_default.YELLOW;
  148114. var defaultStrokeWidth = 2;
  148115. var defaultFill2 = Color_default.fromBytes(255, 255, 0, 100);
  148116. var defaultClampToGround = false;
  148117. var sizes = {
  148118. small: 24,
  148119. medium: 48,
  148120. large: 64
  148121. };
  148122. var simpleStyleIdentifiers = [
  148123. "title",
  148124. "description",
  148125. "marker-size",
  148126. "marker-symbol",
  148127. "marker-color",
  148128. "stroke",
  148129. "stroke-opacity",
  148130. "stroke-width",
  148131. "fill",
  148132. "fill-opacity"
  148133. ];
  148134. function defaultDescribe(properties, nameProperty) {
  148135. let html2 = "";
  148136. for (const key in properties) {
  148137. if (properties.hasOwnProperty(key)) {
  148138. if (key === nameProperty || simpleStyleIdentifiers.indexOf(key) !== -1) {
  148139. continue;
  148140. }
  148141. const value = properties[key];
  148142. if (defined_default(value)) {
  148143. if (typeof value === "object") {
  148144. html2 += `<tr><th>${key}</th><td>${defaultDescribe(value)}</td></tr>`;
  148145. } else {
  148146. html2 += `<tr><th>${key}</th><td>${value}</td></tr>`;
  148147. }
  148148. }
  148149. }
  148150. }
  148151. if (html2.length > 0) {
  148152. html2 = `<table class="cesium-infoBox-defaultTable"><tbody>${html2}</tbody></table>`;
  148153. }
  148154. return html2;
  148155. }
  148156. function createDescriptionCallback(describe, properties, nameProperty) {
  148157. let description;
  148158. return function(time, result) {
  148159. if (!defined_default(description)) {
  148160. description = describe(properties, nameProperty);
  148161. }
  148162. return description;
  148163. };
  148164. }
  148165. function defaultDescribeProperty(properties, nameProperty) {
  148166. return new CallbackProperty_default(
  148167. createDescriptionCallback(defaultDescribe, properties, nameProperty),
  148168. true
  148169. );
  148170. }
  148171. function createObject(geoJson, entityCollection, describe) {
  148172. let id = geoJson.id;
  148173. if (!defined_default(id) || geoJson.type !== "Feature") {
  148174. id = createGuid_default();
  148175. } else {
  148176. let i2 = 2;
  148177. let finalId = id;
  148178. while (defined_default(entityCollection.getById(finalId))) {
  148179. finalId = `${id}_${i2}`;
  148180. i2++;
  148181. }
  148182. id = finalId;
  148183. }
  148184. const entity = entityCollection.getOrCreateEntity(id);
  148185. const properties = geoJson.properties;
  148186. if (defined_default(properties)) {
  148187. entity.properties = properties;
  148188. let nameProperty;
  148189. const name = properties.title;
  148190. if (defined_default(name)) {
  148191. entity.name = name;
  148192. nameProperty = "title";
  148193. } else {
  148194. let namePropertyPrecedence = Number.MAX_VALUE;
  148195. for (const key in properties) {
  148196. if (properties.hasOwnProperty(key) && properties[key]) {
  148197. const lowerKey = key.toLowerCase();
  148198. if (namePropertyPrecedence > 1 && lowerKey === "title") {
  148199. namePropertyPrecedence = 1;
  148200. nameProperty = key;
  148201. break;
  148202. } else if (namePropertyPrecedence > 2 && lowerKey === "name") {
  148203. namePropertyPrecedence = 2;
  148204. nameProperty = key;
  148205. } else if (namePropertyPrecedence > 3 && /title/i.test(key)) {
  148206. namePropertyPrecedence = 3;
  148207. nameProperty = key;
  148208. } else if (namePropertyPrecedence > 4 && /name/i.test(key)) {
  148209. namePropertyPrecedence = 4;
  148210. nameProperty = key;
  148211. }
  148212. }
  148213. }
  148214. if (defined_default(nameProperty)) {
  148215. entity.name = properties[nameProperty];
  148216. }
  148217. }
  148218. const description = properties.description;
  148219. if (description !== null) {
  148220. entity.description = !defined_default(description) ? describe(properties, nameProperty) : new ConstantProperty_default(description);
  148221. }
  148222. }
  148223. return entity;
  148224. }
  148225. function coordinatesArrayToCartesianArray(coordinates, crsFunction) {
  148226. const positions = new Array(coordinates.length);
  148227. for (let i2 = 0; i2 < coordinates.length; i2++) {
  148228. positions[i2] = crsFunction(coordinates[i2]);
  148229. }
  148230. return positions;
  148231. }
  148232. var geoJsonObjectTypes = {
  148233. Feature: processFeature,
  148234. FeatureCollection: processFeatureCollection,
  148235. GeometryCollection: processGeometryCollection,
  148236. LineString: processLineString,
  148237. MultiLineString: processMultiLineString,
  148238. MultiPoint: processMultiPoint,
  148239. MultiPolygon: processMultiPolygon,
  148240. Point: processPoint2,
  148241. Polygon: processPolygon2,
  148242. Topology: processTopology
  148243. };
  148244. var geometryTypes = {
  148245. GeometryCollection: processGeometryCollection,
  148246. LineString: processLineString,
  148247. MultiLineString: processMultiLineString,
  148248. MultiPoint: processMultiPoint,
  148249. MultiPolygon: processMultiPolygon,
  148250. Point: processPoint2,
  148251. Polygon: processPolygon2,
  148252. Topology: processTopology
  148253. };
  148254. function processFeature(dataSource, feature2, notUsed, crsFunction, options) {
  148255. if (feature2.geometry === null) {
  148256. createObject(feature2, dataSource._entityCollection, options.describe);
  148257. return;
  148258. }
  148259. if (!defined_default(feature2.geometry)) {
  148260. throw new RuntimeError_default("feature.geometry is required.");
  148261. }
  148262. const geometryType = feature2.geometry.type;
  148263. const geometryHandler = geometryTypes[geometryType];
  148264. if (!defined_default(geometryHandler)) {
  148265. throw new RuntimeError_default(`Unknown geometry type: ${geometryType}`);
  148266. }
  148267. geometryHandler(dataSource, feature2, feature2.geometry, crsFunction, options);
  148268. }
  148269. function processFeatureCollection(dataSource, featureCollection, notUsed, crsFunction, options) {
  148270. const features = featureCollection.features;
  148271. for (let i2 = 0, len = features.length; i2 < len; i2++) {
  148272. processFeature(dataSource, features[i2], void 0, crsFunction, options);
  148273. }
  148274. }
  148275. function processGeometryCollection(dataSource, geoJson, geometryCollection, crsFunction, options) {
  148276. const geometries = geometryCollection.geometries;
  148277. for (let i2 = 0, len = geometries.length; i2 < len; i2++) {
  148278. const geometry = geometries[i2];
  148279. const geometryType = geometry.type;
  148280. const geometryHandler = geometryTypes[geometryType];
  148281. if (!defined_default(geometryHandler)) {
  148282. throw new RuntimeError_default(`Unknown geometry type: ${geometryType}`);
  148283. }
  148284. geometryHandler(dataSource, geoJson, geometry, crsFunction, options);
  148285. }
  148286. }
  148287. function createPoint(dataSource, geoJson, crsFunction, coordinates, options) {
  148288. let symbol = options.markerSymbol;
  148289. let color = options.markerColor;
  148290. let size = options.markerSize;
  148291. const properties = geoJson.properties;
  148292. if (defined_default(properties)) {
  148293. const cssColor = properties["marker-color"];
  148294. if (defined_default(cssColor)) {
  148295. color = Color_default.fromCssColorString(cssColor);
  148296. }
  148297. size = defaultValue_default(sizes[properties["marker-size"]], size);
  148298. const markerSymbol = properties["marker-symbol"];
  148299. if (defined_default(markerSymbol)) {
  148300. symbol = markerSymbol;
  148301. }
  148302. }
  148303. let canvasOrPromise;
  148304. if (defined_default(symbol)) {
  148305. if (symbol.length === 1) {
  148306. canvasOrPromise = dataSource._pinBuilder.fromText(
  148307. symbol.toUpperCase(),
  148308. color,
  148309. size
  148310. );
  148311. } else {
  148312. canvasOrPromise = dataSource._pinBuilder.fromMakiIconId(
  148313. symbol,
  148314. color,
  148315. size
  148316. );
  148317. }
  148318. } else {
  148319. canvasOrPromise = dataSource._pinBuilder.fromColor(color, size);
  148320. }
  148321. const billboard = new BillboardGraphics_default();
  148322. billboard.verticalOrigin = new ConstantProperty_default(VerticalOrigin_default.BOTTOM);
  148323. if (coordinates.length === 2 && options.clampToGround) {
  148324. billboard.heightReference = HeightReference_default.CLAMP_TO_GROUND;
  148325. }
  148326. const entity = createObject(
  148327. geoJson,
  148328. dataSource._entityCollection,
  148329. options.describe
  148330. );
  148331. entity.billboard = billboard;
  148332. entity.position = new ConstantPositionProperty_default(crsFunction(coordinates));
  148333. const promise = Promise.resolve(canvasOrPromise).then(function(image) {
  148334. billboard.image = new ConstantProperty_default(image);
  148335. }).catch(function() {
  148336. billboard.image = new ConstantProperty_default(
  148337. dataSource._pinBuilder.fromColor(color, size)
  148338. );
  148339. });
  148340. dataSource._promises.push(promise);
  148341. }
  148342. function processPoint2(dataSource, geoJson, geometry, crsFunction, options) {
  148343. createPoint(dataSource, geoJson, crsFunction, geometry.coordinates, options);
  148344. }
  148345. function processMultiPoint(dataSource, geoJson, geometry, crsFunction, options) {
  148346. const coordinates = geometry.coordinates;
  148347. for (let i2 = 0; i2 < coordinates.length; i2++) {
  148348. createPoint(dataSource, geoJson, crsFunction, coordinates[i2], options);
  148349. }
  148350. }
  148351. function createLineString(dataSource, geoJson, crsFunction, coordinates, options) {
  148352. let material = options.strokeMaterialProperty;
  148353. let widthProperty = options.strokeWidthProperty;
  148354. const properties = geoJson.properties;
  148355. if (defined_default(properties)) {
  148356. const width = properties["stroke-width"];
  148357. if (defined_default(width)) {
  148358. widthProperty = new ConstantProperty_default(width);
  148359. }
  148360. let color;
  148361. const stroke = properties.stroke;
  148362. if (defined_default(stroke)) {
  148363. color = Color_default.fromCssColorString(stroke);
  148364. }
  148365. const opacity = properties["stroke-opacity"];
  148366. if (defined_default(opacity) && opacity !== 1) {
  148367. if (!defined_default(color)) {
  148368. color = material.color.getValue().clone();
  148369. }
  148370. color.alpha = opacity;
  148371. }
  148372. if (defined_default(color)) {
  148373. material = new ColorMaterialProperty_default(color);
  148374. }
  148375. }
  148376. const entity = createObject(
  148377. geoJson,
  148378. dataSource._entityCollection,
  148379. options.describe
  148380. );
  148381. const polylineGraphics = new PolylineGraphics_default();
  148382. entity.polyline = polylineGraphics;
  148383. polylineGraphics.clampToGround = options.clampToGround;
  148384. polylineGraphics.material = material;
  148385. polylineGraphics.width = widthProperty;
  148386. polylineGraphics.positions = new ConstantProperty_default(
  148387. coordinatesArrayToCartesianArray(coordinates, crsFunction)
  148388. );
  148389. polylineGraphics.arcType = ArcType_default.RHUMB;
  148390. }
  148391. function processLineString(dataSource, geoJson, geometry, crsFunction, options) {
  148392. createLineString(
  148393. dataSource,
  148394. geoJson,
  148395. crsFunction,
  148396. geometry.coordinates,
  148397. options
  148398. );
  148399. }
  148400. function processMultiLineString(dataSource, geoJson, geometry, crsFunction, options) {
  148401. const lineStrings = geometry.coordinates;
  148402. for (let i2 = 0; i2 < lineStrings.length; i2++) {
  148403. createLineString(dataSource, geoJson, crsFunction, lineStrings[i2], options);
  148404. }
  148405. }
  148406. function createPolygon(dataSource, geoJson, crsFunction, coordinates, options) {
  148407. if (coordinates.length === 0 || coordinates[0].length === 0) {
  148408. return;
  148409. }
  148410. let outlineColorProperty = options.strokeMaterialProperty.color;
  148411. let material = options.fillMaterialProperty;
  148412. let widthProperty = options.strokeWidthProperty;
  148413. const properties = geoJson.properties;
  148414. if (defined_default(properties)) {
  148415. const width = properties["stroke-width"];
  148416. if (defined_default(width)) {
  148417. widthProperty = new ConstantProperty_default(width);
  148418. }
  148419. let color;
  148420. const stroke = properties.stroke;
  148421. if (defined_default(stroke)) {
  148422. color = Color_default.fromCssColorString(stroke);
  148423. }
  148424. let opacity = properties["stroke-opacity"];
  148425. if (defined_default(opacity) && opacity !== 1) {
  148426. if (!defined_default(color)) {
  148427. color = outlineColorProperty.getValue().clone();
  148428. }
  148429. color.alpha = opacity;
  148430. }
  148431. if (defined_default(color)) {
  148432. outlineColorProperty = new ConstantProperty_default(color);
  148433. }
  148434. let fillColor;
  148435. const fill = properties.fill;
  148436. const materialColor = material.color.getValue();
  148437. if (defined_default(fill)) {
  148438. fillColor = Color_default.fromCssColorString(fill);
  148439. fillColor.alpha = materialColor.alpha;
  148440. }
  148441. opacity = properties["fill-opacity"];
  148442. if (defined_default(opacity) && opacity !== materialColor.alpha) {
  148443. if (!defined_default(fillColor)) {
  148444. fillColor = materialColor.clone();
  148445. }
  148446. fillColor.alpha = opacity;
  148447. }
  148448. if (defined_default(fillColor)) {
  148449. material = new ColorMaterialProperty_default(fillColor);
  148450. }
  148451. }
  148452. const polygon = new PolygonGraphics_default();
  148453. polygon.outline = new ConstantProperty_default(true);
  148454. polygon.outlineColor = outlineColorProperty;
  148455. polygon.outlineWidth = widthProperty;
  148456. polygon.material = material;
  148457. polygon.arcType = ArcType_default.RHUMB;
  148458. const holes = [];
  148459. for (let i2 = 1, len = coordinates.length; i2 < len; i2++) {
  148460. holes.push(
  148461. new PolygonHierarchy_default(
  148462. coordinatesArrayToCartesianArray(coordinates[i2], crsFunction)
  148463. )
  148464. );
  148465. }
  148466. const positions = coordinates[0];
  148467. polygon.hierarchy = new ConstantProperty_default(
  148468. new PolygonHierarchy_default(
  148469. coordinatesArrayToCartesianArray(positions, crsFunction),
  148470. holes
  148471. )
  148472. );
  148473. if (positions[0].length > 2) {
  148474. polygon.perPositionHeight = new ConstantProperty_default(true);
  148475. } else if (!options.clampToGround) {
  148476. polygon.height = 0;
  148477. }
  148478. const entity = createObject(
  148479. geoJson,
  148480. dataSource._entityCollection,
  148481. options.describe
  148482. );
  148483. entity.polygon = polygon;
  148484. }
  148485. function processPolygon2(dataSource, geoJson, geometry, crsFunction, options) {
  148486. createPolygon(
  148487. dataSource,
  148488. geoJson,
  148489. crsFunction,
  148490. geometry.coordinates,
  148491. options
  148492. );
  148493. }
  148494. function processMultiPolygon(dataSource, geoJson, geometry, crsFunction, options) {
  148495. const polygons = geometry.coordinates;
  148496. for (let i2 = 0; i2 < polygons.length; i2++) {
  148497. createPolygon(dataSource, geoJson, crsFunction, polygons[i2], options);
  148498. }
  148499. }
  148500. function processTopology(dataSource, geoJson, geometry, crsFunction, options) {
  148501. for (const property in geometry.objects) {
  148502. if (geometry.objects.hasOwnProperty(property)) {
  148503. const feature2 = index.feature(geometry, geometry.objects[property]);
  148504. const typeHandler = geoJsonObjectTypes[feature2.type];
  148505. typeHandler(dataSource, feature2, feature2, crsFunction, options);
  148506. }
  148507. }
  148508. }
  148509. function GeoJsonDataSource(name) {
  148510. this._name = name;
  148511. this._changed = new Event_default();
  148512. this._error = new Event_default();
  148513. this._isLoading = false;
  148514. this._loading = new Event_default();
  148515. this._entityCollection = new EntityCollection_default(this);
  148516. this._promises = [];
  148517. this._pinBuilder = new PinBuilder_default();
  148518. this._entityCluster = new EntityCluster_default();
  148519. this._credit = void 0;
  148520. this._resourceCredits = [];
  148521. }
  148522. GeoJsonDataSource.load = function(data, options) {
  148523. return new GeoJsonDataSource().load(data, options);
  148524. };
  148525. Object.defineProperties(GeoJsonDataSource, {
  148526. markerSize: {
  148527. get: function() {
  148528. return defaultMarkerSize;
  148529. },
  148530. set: function(value) {
  148531. defaultMarkerSize = value;
  148532. }
  148533. },
  148534. markerSymbol: {
  148535. get: function() {
  148536. return defaultMarkerSymbol;
  148537. },
  148538. set: function(value) {
  148539. defaultMarkerSymbol = value;
  148540. }
  148541. },
  148542. markerColor: {
  148543. get: function() {
  148544. return defaultMarkerColor;
  148545. },
  148546. set: function(value) {
  148547. defaultMarkerColor = value;
  148548. }
  148549. },
  148550. stroke: {
  148551. get: function() {
  148552. return defaultStroke;
  148553. },
  148554. set: function(value) {
  148555. defaultStroke = value;
  148556. }
  148557. },
  148558. strokeWidth: {
  148559. get: function() {
  148560. return defaultStrokeWidth;
  148561. },
  148562. set: function(value) {
  148563. defaultStrokeWidth = value;
  148564. }
  148565. },
  148566. fill: {
  148567. get: function() {
  148568. return defaultFill2;
  148569. },
  148570. set: function(value) {
  148571. defaultFill2 = value;
  148572. }
  148573. },
  148574. clampToGround: {
  148575. get: function() {
  148576. return defaultClampToGround;
  148577. },
  148578. set: function(value) {
  148579. defaultClampToGround = value;
  148580. }
  148581. },
  148582. crsNames: {
  148583. get: function() {
  148584. return crsNames;
  148585. }
  148586. },
  148587. crsLinkHrefs: {
  148588. get: function() {
  148589. return crsLinkHrefs;
  148590. }
  148591. },
  148592. crsLinkTypes: {
  148593. get: function() {
  148594. return crsLinkTypes;
  148595. }
  148596. }
  148597. });
  148598. Object.defineProperties(GeoJsonDataSource.prototype, {
  148599. name: {
  148600. get: function() {
  148601. return this._name;
  148602. },
  148603. set: function(value) {
  148604. if (this._name !== value) {
  148605. this._name = value;
  148606. this._changed.raiseEvent(this);
  148607. }
  148608. }
  148609. },
  148610. clock: {
  148611. value: void 0,
  148612. writable: false
  148613. },
  148614. entities: {
  148615. get: function() {
  148616. return this._entityCollection;
  148617. }
  148618. },
  148619. isLoading: {
  148620. get: function() {
  148621. return this._isLoading;
  148622. }
  148623. },
  148624. changedEvent: {
  148625. get: function() {
  148626. return this._changed;
  148627. }
  148628. },
  148629. errorEvent: {
  148630. get: function() {
  148631. return this._error;
  148632. }
  148633. },
  148634. loadingEvent: {
  148635. get: function() {
  148636. return this._loading;
  148637. }
  148638. },
  148639. show: {
  148640. get: function() {
  148641. return this._entityCollection.show;
  148642. },
  148643. set: function(value) {
  148644. this._entityCollection.show = value;
  148645. }
  148646. },
  148647. clustering: {
  148648. get: function() {
  148649. return this._entityCluster;
  148650. },
  148651. set: function(value) {
  148652. if (!defined_default(value)) {
  148653. throw new DeveloperError_default("value must be defined.");
  148654. }
  148655. this._entityCluster = value;
  148656. }
  148657. },
  148658. credit: {
  148659. get: function() {
  148660. return this._credit;
  148661. }
  148662. }
  148663. });
  148664. GeoJsonDataSource.prototype.load = function(data, options) {
  148665. return preload(this, data, options, true);
  148666. };
  148667. GeoJsonDataSource.prototype.process = function(data, options) {
  148668. return preload(this, data, options, false);
  148669. };
  148670. function preload(that, data, options, clear2) {
  148671. if (!defined_default(data)) {
  148672. throw new DeveloperError_default("data is required.");
  148673. }
  148674. DataSource_default.setLoading(that, true);
  148675. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  148676. let credit = options.credit;
  148677. if (typeof credit === "string") {
  148678. credit = new Credit_default(credit);
  148679. }
  148680. that._credit = credit;
  148681. let promise = data;
  148682. let sourceUri = options.sourceUri;
  148683. if (typeof data === "string" || data instanceof Resource_default) {
  148684. data = Resource_default.createIfNeeded(data);
  148685. promise = data.fetchJson();
  148686. sourceUri = defaultValue_default(sourceUri, data.getUrlComponent());
  148687. const resourceCredits = that._resourceCredits;
  148688. const credits = data.credits;
  148689. if (defined_default(credits)) {
  148690. const length3 = credits.length;
  148691. for (let i2 = 0; i2 < length3; i2++) {
  148692. resourceCredits.push(credits[i2]);
  148693. }
  148694. }
  148695. }
  148696. options = {
  148697. describe: defaultValue_default(options.describe, defaultDescribeProperty),
  148698. markerSize: defaultValue_default(options.markerSize, defaultMarkerSize),
  148699. markerSymbol: defaultValue_default(options.markerSymbol, defaultMarkerSymbol),
  148700. markerColor: defaultValue_default(options.markerColor, defaultMarkerColor),
  148701. strokeWidthProperty: new ConstantProperty_default(
  148702. defaultValue_default(options.strokeWidth, defaultStrokeWidth)
  148703. ),
  148704. strokeMaterialProperty: new ColorMaterialProperty_default(
  148705. defaultValue_default(options.stroke, defaultStroke)
  148706. ),
  148707. fillMaterialProperty: new ColorMaterialProperty_default(
  148708. defaultValue_default(options.fill, defaultFill2)
  148709. ),
  148710. clampToGround: defaultValue_default(options.clampToGround, defaultClampToGround)
  148711. };
  148712. return Promise.resolve(promise).then(function(geoJson) {
  148713. return load2(that, geoJson, options, sourceUri, clear2);
  148714. }).catch(function(error) {
  148715. DataSource_default.setLoading(that, false);
  148716. that._error.raiseEvent(that, error);
  148717. throw error;
  148718. });
  148719. }
  148720. GeoJsonDataSource.prototype.update = function(time) {
  148721. return true;
  148722. };
  148723. function load2(that, geoJson, options, sourceUri, clear2) {
  148724. let name;
  148725. if (defined_default(sourceUri)) {
  148726. name = getFilenameFromUri_default(sourceUri);
  148727. }
  148728. if (defined_default(name) && that._name !== name) {
  148729. that._name = name;
  148730. that._changed.raiseEvent(that);
  148731. }
  148732. const typeHandler = geoJsonObjectTypes[geoJson.type];
  148733. if (!defined_default(typeHandler)) {
  148734. throw new RuntimeError_default(`Unsupported GeoJSON object type: ${geoJson.type}`);
  148735. }
  148736. const crs = geoJson.crs;
  148737. let crsFunction = crs !== null ? defaultCrsFunction : null;
  148738. if (defined_default(crs)) {
  148739. if (!defined_default(crs.properties)) {
  148740. throw new RuntimeError_default("crs.properties is undefined.");
  148741. }
  148742. const properties = crs.properties;
  148743. if (crs.type === "name") {
  148744. crsFunction = crsNames[properties.name];
  148745. if (!defined_default(crsFunction)) {
  148746. throw new RuntimeError_default(`Unknown crs name: ${properties.name}`);
  148747. }
  148748. } else if (crs.type === "link") {
  148749. let handler = crsLinkHrefs[properties.href];
  148750. if (!defined_default(handler)) {
  148751. handler = crsLinkTypes[properties.type];
  148752. }
  148753. if (!defined_default(handler)) {
  148754. throw new RuntimeError_default(
  148755. `Unable to resolve crs link: ${JSON.stringify(properties)}`
  148756. );
  148757. }
  148758. crsFunction = handler(properties);
  148759. } else if (crs.type === "EPSG") {
  148760. crsFunction = crsNames[`EPSG:${properties.code}`];
  148761. if (!defined_default(crsFunction)) {
  148762. throw new RuntimeError_default(`Unknown crs EPSG code: ${properties.code}`);
  148763. }
  148764. } else {
  148765. throw new RuntimeError_default(`Unknown crs type: ${crs.type}`);
  148766. }
  148767. }
  148768. return Promise.resolve(crsFunction).then(function(crsFunction2) {
  148769. if (clear2) {
  148770. that._entityCollection.removeAll();
  148771. }
  148772. if (crsFunction2 !== null) {
  148773. typeHandler(that, geoJson, geoJson, crsFunction2, options);
  148774. }
  148775. return Promise.all(that._promises).then(function() {
  148776. that._promises.length = 0;
  148777. DataSource_default.setLoading(that, false);
  148778. return that;
  148779. });
  148780. });
  148781. }
  148782. var GeoJsonDataSource_default = GeoJsonDataSource;
  148783. // node_modules/cesium/Source/ThirdParty/Autolinker.js
  148784. function defaults(dest, src2) {
  148785. for (var prop in src2) {
  148786. if (src2.hasOwnProperty(prop) && dest[prop] === void 0) {
  148787. dest[prop] = src2[prop];
  148788. }
  148789. }
  148790. return dest;
  148791. }
  148792. function ellipsis(str, truncateLen, ellipsisChars) {
  148793. var ellipsisLength;
  148794. if (str.length > truncateLen) {
  148795. if (ellipsisChars == null) {
  148796. ellipsisChars = "&hellip;";
  148797. ellipsisLength = 3;
  148798. } else {
  148799. ellipsisLength = ellipsisChars.length;
  148800. }
  148801. str = str.substring(0, truncateLen - ellipsisLength) + ellipsisChars;
  148802. }
  148803. return str;
  148804. }
  148805. function indexOf2(arr, element) {
  148806. if (Array.prototype.indexOf) {
  148807. return arr.indexOf(element);
  148808. } else {
  148809. for (var i2 = 0, len = arr.length; i2 < len; i2++) {
  148810. if (arr[i2] === element)
  148811. return i2;
  148812. }
  148813. return -1;
  148814. }
  148815. }
  148816. function remove2(arr, fn) {
  148817. for (var i2 = arr.length - 1; i2 >= 0; i2--) {
  148818. if (fn(arr[i2]) === true) {
  148819. arr.splice(i2, 1);
  148820. }
  148821. }
  148822. }
  148823. function splitAndCapture(str, splitRegex) {
  148824. if (!splitRegex.global)
  148825. throw new Error("`splitRegex` must have the 'g' flag set");
  148826. var result = [], lastIdx = 0, match;
  148827. while (match = splitRegex.exec(str)) {
  148828. result.push(str.substring(lastIdx, match.index));
  148829. result.push(match[0]);
  148830. lastIdx = match.index + match[0].length;
  148831. }
  148832. result.push(str.substring(lastIdx));
  148833. return result;
  148834. }
  148835. function throwUnhandledCaseError(theValue) {
  148836. throw new Error("Unhandled case for value: '".concat(theValue, "'"));
  148837. }
  148838. var HtmlTag = function() {
  148839. function HtmlTag2(cfg) {
  148840. if (cfg === void 0) {
  148841. cfg = {};
  148842. }
  148843. this.tagName = "";
  148844. this.attrs = {};
  148845. this.innerHTML = "";
  148846. this.whitespaceRegex = /\s+/;
  148847. this.tagName = cfg.tagName || "";
  148848. this.attrs = cfg.attrs || {};
  148849. this.innerHTML = cfg.innerHtml || cfg.innerHTML || "";
  148850. }
  148851. HtmlTag2.prototype.setTagName = function(tagName) {
  148852. this.tagName = tagName;
  148853. return this;
  148854. };
  148855. HtmlTag2.prototype.getTagName = function() {
  148856. return this.tagName || "";
  148857. };
  148858. HtmlTag2.prototype.setAttr = function(attrName, attrValue) {
  148859. var tagAttrs = this.getAttrs();
  148860. tagAttrs[attrName] = attrValue;
  148861. return this;
  148862. };
  148863. HtmlTag2.prototype.getAttr = function(attrName) {
  148864. return this.getAttrs()[attrName];
  148865. };
  148866. HtmlTag2.prototype.setAttrs = function(attrs) {
  148867. Object.assign(this.getAttrs(), attrs);
  148868. return this;
  148869. };
  148870. HtmlTag2.prototype.getAttrs = function() {
  148871. return this.attrs || (this.attrs = {});
  148872. };
  148873. HtmlTag2.prototype.setClass = function(cssClass) {
  148874. return this.setAttr("class", cssClass);
  148875. };
  148876. HtmlTag2.prototype.addClass = function(cssClass) {
  148877. var classAttr = this.getClass(), whitespaceRegex = this.whitespaceRegex, classes = !classAttr ? [] : classAttr.split(whitespaceRegex), newClasses = cssClass.split(whitespaceRegex), newClass;
  148878. while (newClass = newClasses.shift()) {
  148879. if (indexOf2(classes, newClass) === -1) {
  148880. classes.push(newClass);
  148881. }
  148882. }
  148883. this.getAttrs()["class"] = classes.join(" ");
  148884. return this;
  148885. };
  148886. HtmlTag2.prototype.removeClass = function(cssClass) {
  148887. var classAttr = this.getClass(), whitespaceRegex = this.whitespaceRegex, classes = !classAttr ? [] : classAttr.split(whitespaceRegex), removeClasses = cssClass.split(whitespaceRegex), removeClass;
  148888. while (classes.length && (removeClass = removeClasses.shift())) {
  148889. var idx = indexOf2(classes, removeClass);
  148890. if (idx !== -1) {
  148891. classes.splice(idx, 1);
  148892. }
  148893. }
  148894. this.getAttrs()["class"] = classes.join(" ");
  148895. return this;
  148896. };
  148897. HtmlTag2.prototype.getClass = function() {
  148898. return this.getAttrs()["class"] || "";
  148899. };
  148900. HtmlTag2.prototype.hasClass = function(cssClass) {
  148901. return (" " + this.getClass() + " ").indexOf(" " + cssClass + " ") !== -1;
  148902. };
  148903. HtmlTag2.prototype.setInnerHTML = function(html2) {
  148904. this.innerHTML = html2;
  148905. return this;
  148906. };
  148907. HtmlTag2.prototype.setInnerHtml = function(html2) {
  148908. return this.setInnerHTML(html2);
  148909. };
  148910. HtmlTag2.prototype.getInnerHTML = function() {
  148911. return this.innerHTML || "";
  148912. };
  148913. HtmlTag2.prototype.getInnerHtml = function() {
  148914. return this.getInnerHTML();
  148915. };
  148916. HtmlTag2.prototype.toAnchorString = function() {
  148917. var tagName = this.getTagName(), attrsStr = this.buildAttrsStr();
  148918. attrsStr = attrsStr ? " " + attrsStr : "";
  148919. return ["<", tagName, attrsStr, ">", this.getInnerHtml(), "</", tagName, ">"].join("");
  148920. };
  148921. HtmlTag2.prototype.buildAttrsStr = function() {
  148922. if (!this.attrs)
  148923. return "";
  148924. var attrs = this.getAttrs(), attrsArr = [];
  148925. for (var prop in attrs) {
  148926. if (attrs.hasOwnProperty(prop)) {
  148927. attrsArr.push(prop + '="' + attrs[prop] + '"');
  148928. }
  148929. }
  148930. return attrsArr.join(" ");
  148931. };
  148932. return HtmlTag2;
  148933. }();
  148934. function truncateSmart(url2, truncateLen, ellipsisChars) {
  148935. var ellipsisLengthBeforeParsing;
  148936. var ellipsisLength;
  148937. if (ellipsisChars == null) {
  148938. ellipsisChars = "&hellip;";
  148939. ellipsisLength = 3;
  148940. ellipsisLengthBeforeParsing = 8;
  148941. } else {
  148942. ellipsisLength = ellipsisChars.length;
  148943. ellipsisLengthBeforeParsing = ellipsisChars.length;
  148944. }
  148945. var parse_url = function(url3) {
  148946. var urlObj2 = {};
  148947. var urlSub = url3;
  148948. var match = urlSub.match(/^([a-z]+):\/\//i);
  148949. if (match) {
  148950. urlObj2.scheme = match[1];
  148951. urlSub = urlSub.substr(match[0].length);
  148952. }
  148953. match = urlSub.match(/^(.*?)(?=(\?|#|\/|$))/i);
  148954. if (match) {
  148955. urlObj2.host = match[1];
  148956. urlSub = urlSub.substr(match[0].length);
  148957. }
  148958. match = urlSub.match(/^\/(.*?)(?=(\?|#|$))/i);
  148959. if (match) {
  148960. urlObj2.path = match[1];
  148961. urlSub = urlSub.substr(match[0].length);
  148962. }
  148963. match = urlSub.match(/^\?(.*?)(?=(#|$))/i);
  148964. if (match) {
  148965. urlObj2.query = match[1];
  148966. urlSub = urlSub.substr(match[0].length);
  148967. }
  148968. match = urlSub.match(/^#(.*?)$/i);
  148969. if (match) {
  148970. urlObj2.fragment = match[1];
  148971. }
  148972. return urlObj2;
  148973. };
  148974. var buildUrl = function(urlObj2) {
  148975. var url3 = "";
  148976. if (urlObj2.scheme && urlObj2.host) {
  148977. url3 += urlObj2.scheme + "://";
  148978. }
  148979. if (urlObj2.host) {
  148980. url3 += urlObj2.host;
  148981. }
  148982. if (urlObj2.path) {
  148983. url3 += "/" + urlObj2.path;
  148984. }
  148985. if (urlObj2.query) {
  148986. url3 += "?" + urlObj2.query;
  148987. }
  148988. if (urlObj2.fragment) {
  148989. url3 += "#" + urlObj2.fragment;
  148990. }
  148991. return url3;
  148992. };
  148993. var buildSegment = function(segment, remainingAvailableLength3) {
  148994. var remainingAvailableLengthHalf = remainingAvailableLength3 / 2, startOffset = Math.ceil(remainingAvailableLengthHalf), endOffset = -1 * Math.floor(remainingAvailableLengthHalf), end2 = "";
  148995. if (endOffset < 0) {
  148996. end2 = segment.substr(endOffset);
  148997. }
  148998. return segment.substr(0, startOffset) + ellipsisChars + end2;
  148999. };
  149000. if (url2.length <= truncateLen) {
  149001. return url2;
  149002. }
  149003. var availableLength = truncateLen - ellipsisLength;
  149004. var urlObj = parse_url(url2);
  149005. if (urlObj.query) {
  149006. var matchQuery = urlObj.query.match(/^(.*?)(?=(\?|\#))(.*?)$/i);
  149007. if (matchQuery) {
  149008. urlObj.query = urlObj.query.substr(0, matchQuery[1].length);
  149009. url2 = buildUrl(urlObj);
  149010. }
  149011. }
  149012. if (url2.length <= truncateLen) {
  149013. return url2;
  149014. }
  149015. if (urlObj.host) {
  149016. urlObj.host = urlObj.host.replace(/^www\./, "");
  149017. url2 = buildUrl(urlObj);
  149018. }
  149019. if (url2.length <= truncateLen) {
  149020. return url2;
  149021. }
  149022. var str = "";
  149023. if (urlObj.host) {
  149024. str += urlObj.host;
  149025. }
  149026. if (str.length >= availableLength) {
  149027. if (urlObj.host.length == truncateLen) {
  149028. return (urlObj.host.substr(0, truncateLen - ellipsisLength) + ellipsisChars).substr(0, availableLength + ellipsisLengthBeforeParsing);
  149029. }
  149030. return buildSegment(str, availableLength).substr(0, availableLength + ellipsisLengthBeforeParsing);
  149031. }
  149032. var pathAndQuery = "";
  149033. if (urlObj.path) {
  149034. pathAndQuery += "/" + urlObj.path;
  149035. }
  149036. if (urlObj.query) {
  149037. pathAndQuery += "?" + urlObj.query;
  149038. }
  149039. if (pathAndQuery) {
  149040. if ((str + pathAndQuery).length >= availableLength) {
  149041. if ((str + pathAndQuery).length == truncateLen) {
  149042. return (str + pathAndQuery).substr(0, truncateLen);
  149043. }
  149044. var remainingAvailableLength = availableLength - str.length;
  149045. return (str + buildSegment(pathAndQuery, remainingAvailableLength)).substr(0, availableLength + ellipsisLengthBeforeParsing);
  149046. } else {
  149047. str += pathAndQuery;
  149048. }
  149049. }
  149050. if (urlObj.fragment) {
  149051. var fragment = "#" + urlObj.fragment;
  149052. if ((str + fragment).length >= availableLength) {
  149053. if ((str + fragment).length == truncateLen) {
  149054. return (str + fragment).substr(0, truncateLen);
  149055. }
  149056. var remainingAvailableLength2 = availableLength - str.length;
  149057. return (str + buildSegment(fragment, remainingAvailableLength2)).substr(0, availableLength + ellipsisLengthBeforeParsing);
  149058. } else {
  149059. str += fragment;
  149060. }
  149061. }
  149062. if (urlObj.scheme && urlObj.host) {
  149063. var scheme = urlObj.scheme + "://";
  149064. if ((str + scheme).length < availableLength) {
  149065. return (scheme + str).substr(0, truncateLen);
  149066. }
  149067. }
  149068. if (str.length <= truncateLen) {
  149069. return str;
  149070. }
  149071. var end = "";
  149072. if (availableLength > 0) {
  149073. end = str.substr(-1 * Math.floor(availableLength / 2));
  149074. }
  149075. return (str.substr(0, Math.ceil(availableLength / 2)) + ellipsisChars + end).substr(0, availableLength + ellipsisLengthBeforeParsing);
  149076. }
  149077. function truncateMiddle(url2, truncateLen, ellipsisChars) {
  149078. if (url2.length <= truncateLen) {
  149079. return url2;
  149080. }
  149081. var ellipsisLengthBeforeParsing;
  149082. var ellipsisLength;
  149083. if (ellipsisChars == null) {
  149084. ellipsisChars = "&hellip;";
  149085. ellipsisLengthBeforeParsing = 8;
  149086. ellipsisLength = 3;
  149087. } else {
  149088. ellipsisLengthBeforeParsing = ellipsisChars.length;
  149089. ellipsisLength = ellipsisChars.length;
  149090. }
  149091. var availableLength = truncateLen - ellipsisLength;
  149092. var end = "";
  149093. if (availableLength > 0) {
  149094. end = url2.substr(-1 * Math.floor(availableLength / 2));
  149095. }
  149096. return (url2.substr(0, Math.ceil(availableLength / 2)) + ellipsisChars + end).substr(0, availableLength + ellipsisLengthBeforeParsing);
  149097. }
  149098. function truncateEnd(anchorText, truncateLen, ellipsisChars) {
  149099. return ellipsis(anchorText, truncateLen, ellipsisChars);
  149100. }
  149101. var AnchorTagBuilder = function() {
  149102. function AnchorTagBuilder2(cfg) {
  149103. if (cfg === void 0) {
  149104. cfg = {};
  149105. }
  149106. this.newWindow = false;
  149107. this.truncate = {};
  149108. this.className = "";
  149109. this.newWindow = cfg.newWindow || false;
  149110. this.truncate = cfg.truncate || {};
  149111. this.className = cfg.className || "";
  149112. }
  149113. AnchorTagBuilder2.prototype.build = function(match) {
  149114. return new HtmlTag({
  149115. tagName: "a",
  149116. attrs: this.createAttrs(match),
  149117. innerHtml: this.processAnchorText(match.getAnchorText())
  149118. });
  149119. };
  149120. AnchorTagBuilder2.prototype.createAttrs = function(match) {
  149121. var attrs = {
  149122. "href": match.getAnchorHref()
  149123. };
  149124. var cssClass = this.createCssClass(match);
  149125. if (cssClass) {
  149126. attrs["class"] = cssClass;
  149127. }
  149128. if (this.newWindow) {
  149129. attrs["target"] = "_blank";
  149130. attrs["rel"] = "noopener noreferrer";
  149131. }
  149132. if (this.truncate) {
  149133. if (this.truncate.length && this.truncate.length < match.getAnchorText().length) {
  149134. attrs["title"] = match.getAnchorHref();
  149135. }
  149136. }
  149137. return attrs;
  149138. };
  149139. AnchorTagBuilder2.prototype.createCssClass = function(match) {
  149140. var className = this.className;
  149141. if (!className) {
  149142. return "";
  149143. } else {
  149144. var returnClasses = [className], cssClassSuffixes = match.getCssClassSuffixes();
  149145. for (var i2 = 0, len = cssClassSuffixes.length; i2 < len; i2++) {
  149146. returnClasses.push(className + "-" + cssClassSuffixes[i2]);
  149147. }
  149148. return returnClasses.join(" ");
  149149. }
  149150. };
  149151. AnchorTagBuilder2.prototype.processAnchorText = function(anchorText) {
  149152. anchorText = this.doTruncate(anchorText);
  149153. return anchorText;
  149154. };
  149155. AnchorTagBuilder2.prototype.doTruncate = function(anchorText) {
  149156. var truncate = this.truncate;
  149157. if (!truncate || !truncate.length)
  149158. return anchorText;
  149159. var truncateLength = truncate.length, truncateLocation = truncate.location;
  149160. if (truncateLocation === "smart") {
  149161. return truncateSmart(anchorText, truncateLength);
  149162. } else if (truncateLocation === "middle") {
  149163. return truncateMiddle(anchorText, truncateLength);
  149164. } else {
  149165. return truncateEnd(anchorText, truncateLength);
  149166. }
  149167. };
  149168. return AnchorTagBuilder2;
  149169. }();
  149170. var Match = function() {
  149171. function Match2(cfg) {
  149172. this.__jsduckDummyDocProp = null;
  149173. this.matchedText = "";
  149174. this.offset = 0;
  149175. this.tagBuilder = cfg.tagBuilder;
  149176. this.matchedText = cfg.matchedText;
  149177. this.offset = cfg.offset;
  149178. }
  149179. Match2.prototype.getMatchedText = function() {
  149180. return this.matchedText;
  149181. };
  149182. Match2.prototype.setOffset = function(offset2) {
  149183. this.offset = offset2;
  149184. };
  149185. Match2.prototype.getOffset = function() {
  149186. return this.offset;
  149187. };
  149188. Match2.prototype.getCssClassSuffixes = function() {
  149189. return [this.getType()];
  149190. };
  149191. Match2.prototype.buildTag = function() {
  149192. return this.tagBuilder.build(this);
  149193. };
  149194. return Match2;
  149195. }();
  149196. var extendStatics = function(d, b) {
  149197. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
  149198. d2.__proto__ = b2;
  149199. } || function(d2, b2) {
  149200. for (var p2 in b2)
  149201. if (Object.prototype.hasOwnProperty.call(b2, p2))
  149202. d2[p2] = b2[p2];
  149203. };
  149204. return extendStatics(d, b);
  149205. };
  149206. function __extends(d, b) {
  149207. if (typeof b !== "function" && b !== null)
  149208. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  149209. extendStatics(d, b);
  149210. function __() {
  149211. this.constructor = d;
  149212. }
  149213. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  149214. }
  149215. var __assign = function() {
  149216. __assign = Object.assign || function __assign2(t) {
  149217. for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) {
  149218. s2 = arguments[i2];
  149219. for (var p2 in s2)
  149220. if (Object.prototype.hasOwnProperty.call(s2, p2))
  149221. t[p2] = s2[p2];
  149222. }
  149223. return t;
  149224. };
  149225. return __assign.apply(this, arguments);
  149226. };
  149227. var EmailMatch = function(_super) {
  149228. __extends(EmailMatch2, _super);
  149229. function EmailMatch2(cfg) {
  149230. var _this = _super.call(this, cfg) || this;
  149231. _this.email = "";
  149232. _this.email = cfg.email;
  149233. return _this;
  149234. }
  149235. EmailMatch2.prototype.getType = function() {
  149236. return "email";
  149237. };
  149238. EmailMatch2.prototype.getEmail = function() {
  149239. return this.email;
  149240. };
  149241. EmailMatch2.prototype.getAnchorHref = function() {
  149242. return "mailto:" + this.email;
  149243. };
  149244. EmailMatch2.prototype.getAnchorText = function() {
  149245. return this.email;
  149246. };
  149247. return EmailMatch2;
  149248. }(Match);
  149249. var HashtagMatch = function(_super) {
  149250. __extends(HashtagMatch2, _super);
  149251. function HashtagMatch2(cfg) {
  149252. var _this = _super.call(this, cfg) || this;
  149253. _this.serviceName = "";
  149254. _this.hashtag = "";
  149255. _this.serviceName = cfg.serviceName;
  149256. _this.hashtag = cfg.hashtag;
  149257. return _this;
  149258. }
  149259. HashtagMatch2.prototype.getType = function() {
  149260. return "hashtag";
  149261. };
  149262. HashtagMatch2.prototype.getServiceName = function() {
  149263. return this.serviceName;
  149264. };
  149265. HashtagMatch2.prototype.getHashtag = function() {
  149266. return this.hashtag;
  149267. };
  149268. HashtagMatch2.prototype.getAnchorHref = function() {
  149269. var serviceName = this.serviceName, hashtag = this.hashtag;
  149270. switch (serviceName) {
  149271. case "twitter":
  149272. return "https://twitter.com/hashtag/" + hashtag;
  149273. case "facebook":
  149274. return "https://www.facebook.com/hashtag/" + hashtag;
  149275. case "instagram":
  149276. return "https://instagram.com/explore/tags/" + hashtag;
  149277. case "tiktok":
  149278. return "https://www.tiktok.com/tag/" + hashtag;
  149279. default:
  149280. throw new Error("Unknown service name to point hashtag to: " + serviceName);
  149281. }
  149282. };
  149283. HashtagMatch2.prototype.getAnchorText = function() {
  149284. return "#" + this.hashtag;
  149285. };
  149286. return HashtagMatch2;
  149287. }(Match);
  149288. var MentionMatch = function(_super) {
  149289. __extends(MentionMatch2, _super);
  149290. function MentionMatch2(cfg) {
  149291. var _this = _super.call(this, cfg) || this;
  149292. _this.serviceName = "twitter";
  149293. _this.mention = "";
  149294. _this.mention = cfg.mention;
  149295. _this.serviceName = cfg.serviceName;
  149296. return _this;
  149297. }
  149298. MentionMatch2.prototype.getType = function() {
  149299. return "mention";
  149300. };
  149301. MentionMatch2.prototype.getMention = function() {
  149302. return this.mention;
  149303. };
  149304. MentionMatch2.prototype.getServiceName = function() {
  149305. return this.serviceName;
  149306. };
  149307. MentionMatch2.prototype.getAnchorHref = function() {
  149308. switch (this.serviceName) {
  149309. case "twitter":
  149310. return "https://twitter.com/" + this.mention;
  149311. case "instagram":
  149312. return "https://instagram.com/" + this.mention;
  149313. case "soundcloud":
  149314. return "https://soundcloud.com/" + this.mention;
  149315. case "tiktok":
  149316. return "https://www.tiktok.com/@" + this.mention;
  149317. default:
  149318. throw new Error("Unknown service name to point mention to: " + this.serviceName);
  149319. }
  149320. };
  149321. MentionMatch2.prototype.getAnchorText = function() {
  149322. return "@" + this.mention;
  149323. };
  149324. MentionMatch2.prototype.getCssClassSuffixes = function() {
  149325. var cssClassSuffixes = _super.prototype.getCssClassSuffixes.call(this), serviceName = this.getServiceName();
  149326. if (serviceName) {
  149327. cssClassSuffixes.push(serviceName);
  149328. }
  149329. return cssClassSuffixes;
  149330. };
  149331. return MentionMatch2;
  149332. }(Match);
  149333. var PhoneMatch = function(_super) {
  149334. __extends(PhoneMatch2, _super);
  149335. function PhoneMatch2(cfg) {
  149336. var _this = _super.call(this, cfg) || this;
  149337. _this.number = "";
  149338. _this.plusSign = false;
  149339. _this.number = cfg.number;
  149340. _this.plusSign = cfg.plusSign;
  149341. return _this;
  149342. }
  149343. PhoneMatch2.prototype.getType = function() {
  149344. return "phone";
  149345. };
  149346. PhoneMatch2.prototype.getPhoneNumber = function() {
  149347. return this.number;
  149348. };
  149349. PhoneMatch2.prototype.getNumber = function() {
  149350. return this.getPhoneNumber();
  149351. };
  149352. PhoneMatch2.prototype.getAnchorHref = function() {
  149353. return "tel:" + (this.plusSign ? "+" : "") + this.number;
  149354. };
  149355. PhoneMatch2.prototype.getAnchorText = function() {
  149356. return this.matchedText;
  149357. };
  149358. return PhoneMatch2;
  149359. }(Match);
  149360. var UrlMatch = function(_super) {
  149361. __extends(UrlMatch2, _super);
  149362. function UrlMatch2(cfg) {
  149363. var _this = _super.call(this, cfg) || this;
  149364. _this.url = "";
  149365. _this.urlMatchType = "scheme";
  149366. _this.protocolUrlMatch = false;
  149367. _this.protocolRelativeMatch = false;
  149368. _this.stripPrefix = { scheme: true, www: true };
  149369. _this.stripTrailingSlash = true;
  149370. _this.decodePercentEncoding = true;
  149371. _this.schemePrefixRegex = /^(https?:\/\/)?/i;
  149372. _this.wwwPrefixRegex = /^(https?:\/\/)?(www\.)?/i;
  149373. _this.protocolRelativeRegex = /^\/\//;
  149374. _this.protocolPrepended = false;
  149375. _this.urlMatchType = cfg.urlMatchType;
  149376. _this.url = cfg.url;
  149377. _this.protocolUrlMatch = cfg.protocolUrlMatch;
  149378. _this.protocolRelativeMatch = cfg.protocolRelativeMatch;
  149379. _this.stripPrefix = cfg.stripPrefix;
  149380. _this.stripTrailingSlash = cfg.stripTrailingSlash;
  149381. _this.decodePercentEncoding = cfg.decodePercentEncoding;
  149382. return _this;
  149383. }
  149384. UrlMatch2.prototype.getType = function() {
  149385. return "url";
  149386. };
  149387. UrlMatch2.prototype.getUrlMatchType = function() {
  149388. return this.urlMatchType;
  149389. };
  149390. UrlMatch2.prototype.getUrl = function() {
  149391. var url2 = this.url;
  149392. if (!this.protocolRelativeMatch && !this.protocolUrlMatch && !this.protocolPrepended) {
  149393. url2 = this.url = "http://" + url2;
  149394. this.protocolPrepended = true;
  149395. }
  149396. return url2;
  149397. };
  149398. UrlMatch2.prototype.getAnchorHref = function() {
  149399. var url2 = this.getUrl();
  149400. return url2.replace(/&amp;/g, "&");
  149401. };
  149402. UrlMatch2.prototype.getAnchorText = function() {
  149403. var anchorText = this.getMatchedText();
  149404. if (this.protocolRelativeMatch) {
  149405. anchorText = this.stripProtocolRelativePrefix(anchorText);
  149406. }
  149407. if (this.stripPrefix.scheme) {
  149408. anchorText = this.stripSchemePrefix(anchorText);
  149409. }
  149410. if (this.stripPrefix.www) {
  149411. anchorText = this.stripWwwPrefix(anchorText);
  149412. }
  149413. if (this.stripTrailingSlash) {
  149414. anchorText = this.removeTrailingSlash(anchorText);
  149415. }
  149416. if (this.decodePercentEncoding) {
  149417. anchorText = this.removePercentEncoding(anchorText);
  149418. }
  149419. return anchorText;
  149420. };
  149421. UrlMatch2.prototype.stripSchemePrefix = function(url2) {
  149422. return url2.replace(this.schemePrefixRegex, "");
  149423. };
  149424. UrlMatch2.prototype.stripWwwPrefix = function(url2) {
  149425. return url2.replace(this.wwwPrefixRegex, "$1");
  149426. };
  149427. UrlMatch2.prototype.stripProtocolRelativePrefix = function(text2) {
  149428. return text2.replace(this.protocolRelativeRegex, "");
  149429. };
  149430. UrlMatch2.prototype.removeTrailingSlash = function(anchorText) {
  149431. if (anchorText.charAt(anchorText.length - 1) === "/") {
  149432. anchorText = anchorText.slice(0, -1);
  149433. }
  149434. return anchorText;
  149435. };
  149436. UrlMatch2.prototype.removePercentEncoding = function(anchorText) {
  149437. var preProcessedEntityAnchorText = anchorText.replace(/%22/gi, "&quot;").replace(/%26/gi, "&amp;").replace(/%27/gi, "&#39;").replace(/%3C/gi, "&lt;").replace(/%3E/gi, "&gt;");
  149438. try {
  149439. return decodeURIComponent(preProcessedEntityAnchorText);
  149440. } catch (e2) {
  149441. return preProcessedEntityAnchorText;
  149442. }
  149443. };
  149444. return UrlMatch2;
  149445. }(Match);
  149446. var Matcher = function() {
  149447. function Matcher2(cfg) {
  149448. this.__jsduckDummyDocProp = null;
  149449. this.tagBuilder = cfg.tagBuilder;
  149450. }
  149451. return Matcher2;
  149452. }();
  149453. var letterRe = /[A-Za-z]/;
  149454. var digitRe = /[\d]/;
  149455. var nonDigitRe = /[\D]/;
  149456. var whitespaceRe = /\s/;
  149457. var quoteRe = /['"]/;
  149458. var controlCharsRe = /[\x00-\x1F\x7F]/;
  149459. var alphaCharsStr = /A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/.source;
  149460. var emojiStr = /\u2700-\u27bf\udde6-\uddff\ud800-\udbff\udc00-\udfff\ufe0e\ufe0f\u0300-\u036f\ufe20-\ufe23\u20d0-\u20f0\ud83c\udffb-\udfff\u200d\u3299\u3297\u303d\u3030\u24c2\ud83c\udd70-\udd71\udd7e-\udd7f\udd8e\udd91-\udd9a\udde6-\uddff\ude01-\ude02\ude1a\ude2f\ude32-\ude3a\ude50-\ude51\u203c\u2049\u25aa-\u25ab\u25b6\u25c0\u25fb-\u25fe\u00a9\u00ae\u2122\u2139\udc04\u2600-\u26FF\u2b05\u2b06\u2b07\u2b1b\u2b1c\u2b50\u2b55\u231a\u231b\u2328\u23cf\u23e9-\u23f3\u23f8-\u23fa\udccf\u2935\u2934\u2190-\u21ff/.source;
  149461. var marksStr = /\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F/.source;
  149462. var alphaCharsAndMarksStr = alphaCharsStr + emojiStr + marksStr;
  149463. var decimalNumbersStr = /0-9\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0BE6-\u0BEF\u0C66-\u0C6F\u0CE6-\u0CEF\u0D66-\u0D6F\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F29\u1040-\u1049\u1090-\u1099\u17E0-\u17E9\u1810-\u1819\u1946-\u194F\u19D0-\u19D9\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\uA620-\uA629\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19/.source;
  149464. var alphaNumericCharsStr = alphaCharsAndMarksStr + decimalNumbersStr;
  149465. var alphaNumericAndMarksCharsStr = alphaCharsAndMarksStr + decimalNumbersStr;
  149466. var ipStr = "(?:[" + decimalNumbersStr + "]{1,3}\\.){3}[" + decimalNumbersStr + "]{1,3}";
  149467. var domainLabelStr = "[" + alphaNumericAndMarksCharsStr + "](?:[" + alphaNumericAndMarksCharsStr + "\\-]{0,61}[" + alphaNumericAndMarksCharsStr + "])?";
  149468. var getDomainLabelStr = function(group) {
  149469. return "(?=(" + domainLabelStr + "))\\" + group;
  149470. };
  149471. var getDomainNameStr = function(group) {
  149472. return "(?:" + getDomainLabelStr(group) + "(?:\\." + getDomainLabelStr(group + 1) + "){0,126}|" + ipStr + ")";
  149473. };
  149474. var domainNameCharRegex = new RegExp("[".concat(alphaNumericAndMarksCharsStr, "]"));
  149475. var tldRegex = /(?:xn--vermgensberatung-pwb|xn--vermgensberater-ctb|xn--clchc0ea0b2g2a9gcd|xn--w4r85el8fhu5dnra|northwesternmutual|travelersinsurance|vermögensberatung|xn--3oq18vl8pn36a|xn--5su34j936bgsg|xn--bck1b9a5dre4c|xn--mgbah1a3hjkrd|xn--mgbai9azgqp6j|xn--mgberp4a5d4ar|xn--xkc2dl3a5ee0h|vermögensberater|xn--fzys8d69uvgm|xn--mgba7c0bbn0a|xn--mgbcpq6gpa1a|xn--xkc2al3hye2a|americanexpress|kerryproperties|sandvikcoromant|xn--i1b6b1a6a2e|xn--kcrx77d1x4a|xn--lgbbat1ad8j|xn--mgba3a4f16a|xn--mgbaakc7dvf|xn--mgbc0a9azcg|xn--nqv7fs00ema|afamilycompany|americanfamily|bananarepublic|cancerresearch|cookingchannel|kerrylogistics|weatherchannel|xn--54b7fta0cc|xn--6qq986b3xl|xn--80aqecdr1a|xn--b4w605ferd|xn--fiq228c5hs|xn--h2breg3eve|xn--jlq480n2rg|xn--jlq61u9w7b|xn--mgba3a3ejt|xn--mgbaam7a8h|xn--mgbayh7gpa|xn--mgbbh1a71e|xn--mgbca7dzdo|xn--mgbi4ecexp|xn--mgbx4cd0ab|xn--rvc1e0am3e|international|lifeinsurance|travelchannel|wolterskluwer|xn--cckwcxetd|xn--eckvdtc9d|xn--fpcrj9c3d|xn--fzc2c9e2c|xn--h2brj9c8c|xn--tiq49xqyj|xn--yfro4i67o|xn--ygbi2ammx|construction|lplfinancial|scholarships|versicherung|xn--3e0b707e|xn--45br5cyl|xn--4dbrk0ce|xn--80adxhks|xn--80asehdb|xn--8y0a063a|xn--gckr3f0f|xn--mgb9awbf|xn--mgbab2bd|xn--mgbgu82a|xn--mgbpl2fh|xn--mgbt3dhd|xn--mk1bu44c|xn--ngbc5azd|xn--ngbe9e0a|xn--ogbpf8fl|xn--qcka1pmc|accountants|barclaycard|blackfriday|blockbuster|bridgestone|calvinklein|contractors|creditunion|engineering|enterprises|foodnetwork|investments|kerryhotels|lamborghini|motorcycles|olayangroup|photography|playstation|productions|progressive|redumbrella|williamhill|xn--11b4c3d|xn--1ck2e1b|xn--1qqw23a|xn--2scrj9c|xn--3bst00m|xn--3ds443g|xn--3hcrj9c|xn--42c2d9a|xn--45brj9c|xn--55qw42g|xn--6frz82g|xn--80ao21a|xn--9krt00a|xn--cck2b3b|xn--czr694b|xn--d1acj3b|xn--efvy88h|xn--fct429k|xn--fjq720a|xn--flw351e|xn--g2xx48c|xn--gecrj9c|xn--gk3at1e|xn--h2brj9c|xn--hxt814e|xn--imr513n|xn--j6w193g|xn--jvr189m|xn--kprw13d|xn--kpry57d|xn--mgbbh1a|xn--mgbtx2b|xn--mix891f|xn--nyqy26a|xn--otu796d|xn--pgbs0dh|xn--q9jyb4c|xn--rhqv96g|xn--rovu88b|xn--s9brj9c|xn--ses554g|xn--t60b56a|xn--vuq861b|xn--w4rs40l|xn--xhq521b|xn--zfr164b|சிங்கப்பூர்|accountant|apartments|associates|basketball|bnpparibas|boehringer|capitalone|consulting|creditcard|cuisinella|eurovision|extraspace|foundation|healthcare|immobilien|industries|management|mitsubishi|nextdirect|properties|protection|prudential|realestate|republican|restaurant|schaeffler|swiftcover|tatamotors|technology|university|vlaanderen|volkswagen|xn--30rr7y|xn--3pxu8k|xn--45q11c|xn--4gbrim|xn--55qx5d|xn--5tzm5g|xn--80aswg|xn--90a3ac|xn--9dbq2a|xn--9et52u|xn--c2br7g|xn--cg4bki|xn--czrs0t|xn--czru2d|xn--fiq64b|xn--fiqs8s|xn--fiqz9s|xn--io0a7i|xn--kput3i|xn--mxtq1m|xn--o3cw4h|xn--pssy2u|xn--q7ce6a|xn--unup4y|xn--wgbh1c|xn--wgbl6a|xn--y9a3aq|accenture|alfaromeo|allfinanz|amsterdam|analytics|aquarelle|barcelona|bloomberg|christmas|community|directory|education|equipment|fairwinds|financial|firestone|fresenius|frontdoor|furniture|goldpoint|hisamitsu|homedepot|homegoods|homesense|institute|insurance|kuokgroup|lancaster|landrover|lifestyle|marketing|marshalls|melbourne|microsoft|panasonic|passagens|pramerica|richardli|scjohnson|shangrila|solutions|statebank|statefarm|stockholm|travelers|vacations|xn--90ais|xn--c1avg|xn--d1alf|xn--e1a4c|xn--fhbei|xn--j1aef|xn--j1amh|xn--l1acc|xn--ngbrx|xn--nqv7f|xn--p1acf|xn--qxa6a|xn--tckwe|xn--vhquv|yodobashi|موريتانيا|abudhabi|airforce|allstate|attorney|barclays|barefoot|bargains|baseball|boutique|bradesco|broadway|brussels|budapest|builders|business|capetown|catering|catholic|cipriani|cityeats|cleaning|clinique|clothing|commbank|computer|delivery|deloitte|democrat|diamonds|discount|discover|download|engineer|ericsson|etisalat|exchange|feedback|fidelity|firmdale|football|frontier|goodyear|grainger|graphics|guardian|hdfcbank|helsinki|holdings|hospital|infiniti|ipiranga|istanbul|jpmorgan|lighting|lundbeck|marriott|maserati|mckinsey|memorial|merckmsd|mortgage|observer|partners|pharmacy|pictures|plumbing|property|redstone|reliance|saarland|samsclub|security|services|shopping|showtime|softbank|software|stcgroup|supplies|training|vanguard|ventures|verisign|woodside|xn--90ae|xn--node|xn--p1ai|xn--qxam|yokohama|السعودية|abogado|academy|agakhan|alibaba|android|athleta|auction|audible|auspost|avianca|banamex|bauhaus|bentley|bestbuy|booking|brother|bugatti|capital|caravan|careers|channel|charity|chintai|citadel|clubmed|college|cologne|comcast|company|compare|contact|cooking|corsica|country|coupons|courses|cricket|cruises|dentist|digital|domains|exposed|express|farmers|fashion|ferrari|ferrero|finance|fishing|fitness|flights|florist|flowers|forsale|frogans|fujitsu|gallery|genting|godaddy|grocery|guitars|hamburg|hangout|hitachi|holiday|hosting|hoteles|hotmail|hyundai|ismaili|jewelry|juniper|kitchen|komatsu|lacaixa|lanxess|lasalle|latrobe|leclerc|limited|lincoln|markets|monster|netbank|netflix|network|neustar|okinawa|oldnavy|organic|origins|philips|pioneer|politie|realtor|recipes|rentals|reviews|rexroth|samsung|sandvik|schmidt|schwarz|science|shiksha|singles|staples|storage|support|surgery|systems|temasek|theater|theatre|tickets|tiffany|toshiba|trading|walmart|wanggou|watches|weather|website|wedding|whoswho|windows|winners|xfinity|yamaxun|youtube|zuerich|католик|اتصالات|البحرين|الجزائر|العليان|پاکستان|كاثوليك|இந்தியா|abarth|abbott|abbvie|africa|agency|airbus|airtel|alipay|alsace|alstom|amazon|anquan|aramco|author|bayern|beauty|berlin|bharti|bostik|boston|broker|camera|career|casino|center|chanel|chrome|church|circle|claims|clinic|coffee|comsec|condos|coupon|credit|cruise|dating|datsun|dealer|degree|dental|design|direct|doctor|dunlop|dupont|durban|emerck|energy|estate|events|expert|family|flickr|futbol|gallup|garden|george|giving|global|google|gratis|health|hermes|hiphop|hockey|hotels|hughes|imamat|insure|intuit|jaguar|joburg|juegos|kaufen|kinder|kindle|kosher|lancia|latino|lawyer|lefrak|living|locker|london|luxury|madrid|maison|makeup|market|mattel|mobile|monash|mormon|moscow|museum|mutual|nagoya|natura|nissan|nissay|norton|nowruz|office|olayan|online|oracle|orange|otsuka|pfizer|photos|physio|pictet|quebec|racing|realty|reisen|repair|report|review|rocher|rogers|ryukyu|safety|sakura|sanofi|school|schule|search|secure|select|shouji|soccer|social|stream|studio|supply|suzuki|swatch|sydney|taipei|taobao|target|tattoo|tennis|tienda|tjmaxx|tkmaxx|toyota|travel|unicom|viajes|viking|villas|virgin|vision|voting|voyage|vuelos|walter|webcam|xihuan|yachts|yandex|zappos|москва|онлайн|ابوظبي|ارامكو|الاردن|المغرب|امارات|فلسطين|مليسيا|भारतम्|இலங்கை|ファッション|actor|adult|aetna|amfam|amica|apple|archi|audio|autos|azure|baidu|beats|bible|bingo|black|boats|bosch|build|canon|cards|chase|cheap|cisco|citic|click|cloud|coach|codes|crown|cymru|dabur|dance|deals|delta|drive|dubai|earth|edeka|email|epson|faith|fedex|final|forex|forum|gallo|games|gifts|gives|glade|glass|globo|gmail|green|gripe|group|gucci|guide|homes|honda|horse|house|hyatt|ikano|irish|jetzt|koeln|kyoto|lamer|lease|legal|lexus|lilly|linde|lipsy|lixil|loans|locus|lotte|lotto|macys|mango|media|miami|money|movie|nexus|nikon|ninja|nokia|nowtv|omega|osaka|paris|parts|party|phone|photo|pizza|place|poker|praxi|press|prime|promo|quest|radio|rehab|reise|ricoh|rocks|rodeo|rugby|salon|sener|seven|sharp|shell|shoes|skype|sling|smart|smile|solar|space|sport|stada|store|study|style|sucks|swiss|tatar|tires|tirol|tmall|today|tokyo|tools|toray|total|tours|trade|trust|tunes|tushu|ubank|vegas|video|vodka|volvo|wales|watch|weber|weibo|works|world|xerox|yahoo|ישראל|ایران|بازار|بھارت|سودان|سورية|همراه|भारोत|संगठन|বাংলা|భారత్|ഭാരതം|嘉里大酒店|aarp|able|adac|aero|akdn|ally|amex|arab|army|arpa|arte|asda|asia|audi|auto|baby|band|bank|bbva|beer|best|bike|bing|blog|blue|bofa|bond|book|buzz|cafe|call|camp|care|cars|casa|case|cash|cbre|cern|chat|citi|city|club|cool|coop|cyou|data|date|dclk|deal|dell|desi|diet|dish|docs|duck|dvag|erni|fage|fail|fans|farm|fast|fiat|fido|film|fire|fish|flir|food|ford|free|fund|game|gbiz|gent|ggee|gift|gmbh|gold|golf|goog|guge|guru|hair|haus|hdfc|help|here|hgtv|host|hsbc|icbc|ieee|imdb|immo|info|itau|java|jeep|jobs|jprs|kddi|kiwi|kpmg|kred|land|lego|lgbt|lidl|life|like|limo|link|live|loan|loft|love|ltda|luxe|maif|meet|meme|menu|mini|mint|mobi|moda|moto|name|navy|news|next|nico|nike|ollo|open|page|pars|pccw|pics|ping|pink|play|plus|pohl|porn|post|prod|prof|qpon|raid|read|reit|rent|rest|rich|rmit|room|rsvp|ruhr|safe|sale|sarl|save|saxo|scot|seat|seek|sexy|shaw|shia|shop|show|silk|sina|site|skin|sncf|sohu|song|sony|spot|star|surf|talk|taxi|team|tech|teva|tiaa|tips|town|toys|tube|vana|visa|viva|vivo|vote|voto|wang|weir|wien|wiki|wine|work|xbox|yoga|zara|zero|zone|дети|сайт|بارت|بيتك|ڀارت|تونس|شبكة|عراق|عمان|موقع|भारत|ভারত|ভাৰত|ਭਾਰਤ|ભારત|ଭାରତ|ಭಾರತ|ලංකා|アマゾン|グーグル|クラウド|ポイント|大众汽车|组织机构|電訊盈科|香格里拉|aaa|abb|abc|aco|ads|aeg|afl|aig|anz|aol|app|art|aws|axa|bar|bbc|bbt|bcg|bcn|bet|bid|bio|biz|bms|bmw|bom|boo|bot|box|buy|bzh|cab|cal|cam|car|cat|cba|cbn|cbs|ceo|cfa|cfd|com|cpa|crs|csc|dad|day|dds|dev|dhl|diy|dnp|dog|dot|dtv|dvr|eat|eco|edu|esq|eus|fan|fit|fly|foo|fox|frl|ftr|fun|fyi|gal|gap|gay|gdn|gea|gle|gmo|gmx|goo|gop|got|gov|hbo|hiv|hkt|hot|how|ibm|ice|icu|ifm|inc|ing|ink|int|ist|itv|jcb|jio|jll|jmp|jnj|jot|joy|kfh|kia|kim|kpn|krd|lat|law|lds|llc|llp|lol|lpl|ltd|man|map|mba|med|men|mil|mit|mlb|mls|mma|moe|moi|mom|mov|msd|mtn|mtr|nab|nba|nec|net|new|nfl|ngo|nhk|now|nra|nrw|ntt|nyc|obi|off|one|ong|onl|ooo|org|ott|ovh|pay|pet|phd|pid|pin|pnc|pro|pru|pub|pwc|qvc|red|ren|ril|rio|rip|run|rwe|sap|sas|sbi|sbs|sca|scb|ses|sew|sex|sfr|ski|sky|soy|spa|srl|stc|tab|tax|tci|tdk|tel|thd|tjx|top|trv|tui|tvs|ubs|uno|uol|ups|vet|vig|vin|vip|wed|win|wme|wow|wtc|wtf|xin|xxx|xyz|you|yun|zip|бел|ком|қаз|мкд|мон|орг|рус|срб|укр|հայ|קום|عرب|قطر|كوم|مصر|कॉम|नेट|คอม|ไทย|ລາວ|ストア|セール|みんな|中文网|亚马逊|天主教|我爱你|新加坡|淡马锡|诺基亚|飞利浦|ac|ad|ae|af|ag|ai|al|am|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|ss|st|su|sv|sx|sy|sz|tc|td|tf|tg|th|tj|tk|tl|tm|tn|to|tr|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|za|zm|zw|ελ|ευ|бг|ею|рф|გე|닷넷|닷컴|삼성|한국|コム|世界|中信|中国|中國|企业|佛山|信息|健康|八卦|公司|公益|台湾|台灣|商城|商店|商标|嘉里|在线|大拿|娱乐|家電|广东|微博|慈善|手机|招聘|政务|政府|新闻|时尚|書籍|机构|游戏|澳門|点看|移动|网址|网店|网站|网络|联通|谷歌|购物|通販|集团|食品|餐厅|香港)/;
  149476. var localPartCharRegex = new RegExp("[".concat(alphaNumericAndMarksCharsStr, "!#$%&'*+/=?^_`{|}~-]"));
  149477. var strictTldRegex = new RegExp("^".concat(tldRegex.source, "$"));
  149478. var EmailMatcher = function(_super) {
  149479. __extends(EmailMatcher2, _super);
  149480. function EmailMatcher2() {
  149481. var _this = _super !== null && _super.apply(this, arguments) || this;
  149482. _this.localPartCharRegex = localPartCharRegex;
  149483. _this.strictTldRegex = strictTldRegex;
  149484. return _this;
  149485. }
  149486. EmailMatcher2.prototype.parseMatches = function(text2) {
  149487. var tagBuilder = this.tagBuilder, localPartCharRegex2 = this.localPartCharRegex, strictTldRegex2 = this.strictTldRegex, matches = [], len = text2.length, noCurrentEmailMatch = new CurrentEmailMatch();
  149488. var mailtoTransitions = {
  149489. "m": "a",
  149490. "a": "i",
  149491. "i": "l",
  149492. "l": "t",
  149493. "t": "o",
  149494. "o": ":"
  149495. };
  149496. var charIdx = 0, state = 0, currentEmailMatch = noCurrentEmailMatch;
  149497. while (charIdx < len) {
  149498. var char = text2.charAt(charIdx);
  149499. switch (state) {
  149500. case 0:
  149501. stateNonEmailAddress(char);
  149502. break;
  149503. case 1:
  149504. stateMailTo(text2.charAt(charIdx - 1), char);
  149505. break;
  149506. case 2:
  149507. stateLocalPart(char);
  149508. break;
  149509. case 3:
  149510. stateLocalPartDot(char);
  149511. break;
  149512. case 4:
  149513. stateAtSign(char);
  149514. break;
  149515. case 5:
  149516. stateDomainChar(char);
  149517. break;
  149518. case 6:
  149519. stateDomainHyphen(char);
  149520. break;
  149521. case 7:
  149522. stateDomainDot(char);
  149523. break;
  149524. default:
  149525. throwUnhandledCaseError(state);
  149526. }
  149527. charIdx++;
  149528. }
  149529. captureMatchIfValidAndReset();
  149530. return matches;
  149531. function stateNonEmailAddress(char2) {
  149532. if (char2 === "m") {
  149533. beginEmailMatch(1);
  149534. } else if (localPartCharRegex2.test(char2)) {
  149535. beginEmailMatch();
  149536. } else
  149537. ;
  149538. }
  149539. function stateMailTo(prevChar, char2) {
  149540. if (prevChar === ":") {
  149541. if (localPartCharRegex2.test(char2)) {
  149542. state = 2;
  149543. currentEmailMatch = new CurrentEmailMatch(__assign(__assign({}, currentEmailMatch), { hasMailtoPrefix: true }));
  149544. } else {
  149545. resetToNonEmailMatchState();
  149546. }
  149547. } else if (mailtoTransitions[prevChar] === char2)
  149548. ;
  149549. else if (localPartCharRegex2.test(char2)) {
  149550. state = 2;
  149551. } else if (char2 === ".") {
  149552. state = 3;
  149553. } else if (char2 === "@") {
  149554. state = 4;
  149555. } else {
  149556. resetToNonEmailMatchState();
  149557. }
  149558. }
  149559. function stateLocalPart(char2) {
  149560. if (char2 === ".") {
  149561. state = 3;
  149562. } else if (char2 === "@") {
  149563. state = 4;
  149564. } else if (localPartCharRegex2.test(char2))
  149565. ;
  149566. else {
  149567. resetToNonEmailMatchState();
  149568. }
  149569. }
  149570. function stateLocalPartDot(char2) {
  149571. if (char2 === ".") {
  149572. resetToNonEmailMatchState();
  149573. } else if (char2 === "@") {
  149574. resetToNonEmailMatchState();
  149575. } else if (localPartCharRegex2.test(char2)) {
  149576. state = 2;
  149577. } else {
  149578. resetToNonEmailMatchState();
  149579. }
  149580. }
  149581. function stateAtSign(char2) {
  149582. if (domainNameCharRegex.test(char2)) {
  149583. state = 5;
  149584. } else {
  149585. resetToNonEmailMatchState();
  149586. }
  149587. }
  149588. function stateDomainChar(char2) {
  149589. if (char2 === ".") {
  149590. state = 7;
  149591. } else if (char2 === "-") {
  149592. state = 6;
  149593. } else if (domainNameCharRegex.test(char2))
  149594. ;
  149595. else {
  149596. captureMatchIfValidAndReset();
  149597. }
  149598. }
  149599. function stateDomainHyphen(char2) {
  149600. if (char2 === "-" || char2 === ".") {
  149601. captureMatchIfValidAndReset();
  149602. } else if (domainNameCharRegex.test(char2)) {
  149603. state = 5;
  149604. } else {
  149605. captureMatchIfValidAndReset();
  149606. }
  149607. }
  149608. function stateDomainDot(char2) {
  149609. if (char2 === "." || char2 === "-") {
  149610. captureMatchIfValidAndReset();
  149611. } else if (domainNameCharRegex.test(char2)) {
  149612. state = 5;
  149613. currentEmailMatch = new CurrentEmailMatch(__assign(__assign({}, currentEmailMatch), { hasDomainDot: true }));
  149614. } else {
  149615. captureMatchIfValidAndReset();
  149616. }
  149617. }
  149618. function beginEmailMatch(newState) {
  149619. if (newState === void 0) {
  149620. newState = 2;
  149621. }
  149622. state = newState;
  149623. currentEmailMatch = new CurrentEmailMatch({ idx: charIdx });
  149624. }
  149625. function resetToNonEmailMatchState() {
  149626. state = 0;
  149627. currentEmailMatch = noCurrentEmailMatch;
  149628. }
  149629. function captureMatchIfValidAndReset() {
  149630. if (currentEmailMatch.hasDomainDot) {
  149631. var matchedText = text2.slice(currentEmailMatch.idx, charIdx);
  149632. if (/[-.]$/.test(matchedText)) {
  149633. matchedText = matchedText.slice(0, -1);
  149634. }
  149635. var emailAddress = currentEmailMatch.hasMailtoPrefix ? matchedText.slice("mailto:".length) : matchedText;
  149636. if (doesEmailHaveValidTld(emailAddress)) {
  149637. matches.push(new EmailMatch({
  149638. tagBuilder,
  149639. matchedText,
  149640. offset: currentEmailMatch.idx,
  149641. email: emailAddress
  149642. }));
  149643. }
  149644. }
  149645. resetToNonEmailMatchState();
  149646. function doesEmailHaveValidTld(emailAddress2) {
  149647. var emailAddressTld = emailAddress2.split(".").pop() || "";
  149648. var emailAddressNormalized = emailAddressTld.toLowerCase();
  149649. var isValidTld = strictTldRegex2.test(emailAddressNormalized);
  149650. return isValidTld;
  149651. }
  149652. }
  149653. };
  149654. return EmailMatcher2;
  149655. }(Matcher);
  149656. var CurrentEmailMatch = function() {
  149657. function CurrentEmailMatch2(cfg) {
  149658. if (cfg === void 0) {
  149659. cfg = {};
  149660. }
  149661. this.idx = cfg.idx !== void 0 ? cfg.idx : -1;
  149662. this.hasMailtoPrefix = !!cfg.hasMailtoPrefix;
  149663. this.hasDomainDot = !!cfg.hasDomainDot;
  149664. }
  149665. return CurrentEmailMatch2;
  149666. }();
  149667. var UrlMatchValidator = function() {
  149668. function UrlMatchValidator2() {
  149669. }
  149670. UrlMatchValidator2.isValid = function(urlMatch, protocolUrlMatch) {
  149671. if (protocolUrlMatch && !this.isValidUriScheme(protocolUrlMatch) || this.urlMatchDoesNotHaveProtocolOrDot(urlMatch, protocolUrlMatch) || this.urlMatchDoesNotHaveAtLeastOneWordChar(urlMatch, protocolUrlMatch) && !this.isValidIpAddress(urlMatch) || this.containsMultipleDots(urlMatch)) {
  149672. return false;
  149673. }
  149674. return true;
  149675. };
  149676. UrlMatchValidator2.isValidIpAddress = function(uriSchemeMatch) {
  149677. var newRegex = new RegExp(this.hasFullProtocolRegex.source + this.ipRegex.source);
  149678. var uriScheme = uriSchemeMatch.match(newRegex);
  149679. return uriScheme !== null;
  149680. };
  149681. UrlMatchValidator2.containsMultipleDots = function(urlMatch) {
  149682. var stringBeforeSlash = urlMatch;
  149683. if (this.hasFullProtocolRegex.test(urlMatch)) {
  149684. stringBeforeSlash = urlMatch.split("://")[1];
  149685. }
  149686. return stringBeforeSlash.split("/")[0].indexOf("..") > -1;
  149687. };
  149688. UrlMatchValidator2.isValidUriScheme = function(uriSchemeMatch) {
  149689. var uriSchemeMatchArr = uriSchemeMatch.match(this.uriSchemeRegex), uriScheme = uriSchemeMatchArr && uriSchemeMatchArr[0].toLowerCase();
  149690. return uriScheme !== "javascript:" && uriScheme !== "vbscript:";
  149691. };
  149692. UrlMatchValidator2.urlMatchDoesNotHaveProtocolOrDot = function(urlMatch, protocolUrlMatch) {
  149693. return !!urlMatch && (!protocolUrlMatch || !this.hasFullProtocolRegex.test(protocolUrlMatch)) && urlMatch.indexOf(".") === -1;
  149694. };
  149695. UrlMatchValidator2.urlMatchDoesNotHaveAtLeastOneWordChar = function(urlMatch, protocolUrlMatch) {
  149696. if (urlMatch && protocolUrlMatch) {
  149697. return !this.hasFullProtocolRegex.test(protocolUrlMatch) && !this.hasWordCharAfterProtocolRegex.test(urlMatch);
  149698. } else {
  149699. return false;
  149700. }
  149701. };
  149702. UrlMatchValidator2.hasFullProtocolRegex = /^[A-Za-z][-.+A-Za-z0-9]*:\/\//;
  149703. UrlMatchValidator2.uriSchemeRegex = /^[A-Za-z][-.+A-Za-z0-9]*:/;
  149704. UrlMatchValidator2.hasWordCharAfterProtocolRegex = new RegExp(":[^\\s]*?[" + alphaCharsStr + "]");
  149705. UrlMatchValidator2.ipRegex = /[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?\.[0-9][0-9]?[0-9]?(:[0-9]*)?\/?$/;
  149706. return UrlMatchValidator2;
  149707. }();
  149708. var matcherRegex$1 = function() {
  149709. var schemeRegex = /(?:[A-Za-z][-.+A-Za-z0-9]{0,63}:(?![A-Za-z][-.+A-Za-z0-9]{0,63}:\/\/)(?!\d+\/?)(?:\/\/)?)/, wwwRegex = /(?:www\.)/, urlSuffixRegex = new RegExp("[/?#](?:[" + alphaNumericAndMarksCharsStr + "\\-+&@#/%=~_()|'$*\\[\\]{}?!:,.;^\u2713]*[" + alphaNumericAndMarksCharsStr + "\\-+&@#/%=~_()|'$*\\[\\]{}\u2713])?");
  149710. return new RegExp([
  149711. "(?:",
  149712. "(",
  149713. schemeRegex.source,
  149714. getDomainNameStr(2),
  149715. ")",
  149716. "|",
  149717. "(",
  149718. "(//)?",
  149719. wwwRegex.source,
  149720. getDomainNameStr(6),
  149721. ")",
  149722. "|",
  149723. "(",
  149724. "(//)?",
  149725. getDomainNameStr(10) + "\\.",
  149726. tldRegex.source,
  149727. "(?![-" + alphaNumericCharsStr + "])",
  149728. ")",
  149729. ")",
  149730. "(?::[0-9]+)?",
  149731. "(?:" + urlSuffixRegex.source + ")?"
  149732. ].join(""), "gi");
  149733. }();
  149734. var wordCharRegExp = new RegExp("[" + alphaNumericAndMarksCharsStr + "]");
  149735. var UrlMatcher = function(_super) {
  149736. __extends(UrlMatcher2, _super);
  149737. function UrlMatcher2(cfg) {
  149738. var _this = _super.call(this, cfg) || this;
  149739. _this.stripPrefix = { scheme: true, www: true };
  149740. _this.stripTrailingSlash = true;
  149741. _this.decodePercentEncoding = true;
  149742. _this.matcherRegex = matcherRegex$1;
  149743. _this.wordCharRegExp = wordCharRegExp;
  149744. _this.stripPrefix = cfg.stripPrefix;
  149745. _this.stripTrailingSlash = cfg.stripTrailingSlash;
  149746. _this.decodePercentEncoding = cfg.decodePercentEncoding;
  149747. return _this;
  149748. }
  149749. UrlMatcher2.prototype.parseMatches = function(text2) {
  149750. var matcherRegex2 = this.matcherRegex, stripPrefix = this.stripPrefix, stripTrailingSlash = this.stripTrailingSlash, decodePercentEncoding = this.decodePercentEncoding, tagBuilder = this.tagBuilder, matches = [], match;
  149751. var _loop_1 = function() {
  149752. var matchStr = match[0], schemeUrlMatch = match[1], wwwUrlMatch = match[4], wwwProtocolRelativeMatch = match[5], tldProtocolRelativeMatch = match[9], offset2 = match.index, protocolRelativeMatch = wwwProtocolRelativeMatch || tldProtocolRelativeMatch, prevChar = text2.charAt(offset2 - 1);
  149753. if (!UrlMatchValidator.isValid(matchStr, schemeUrlMatch)) {
  149754. return "continue";
  149755. }
  149756. if (offset2 > 0 && prevChar === "@") {
  149757. return "continue";
  149758. }
  149759. if (offset2 > 0 && protocolRelativeMatch && this_1.wordCharRegExp.test(prevChar)) {
  149760. return "continue";
  149761. }
  149762. if (/\?$/.test(matchStr)) {
  149763. matchStr = matchStr.substr(0, matchStr.length - 1);
  149764. }
  149765. if (this_1.matchHasUnbalancedClosingParen(matchStr)) {
  149766. matchStr = matchStr.substr(0, matchStr.length - 1);
  149767. } else {
  149768. var pos = this_1.matchHasInvalidCharAfterTld(matchStr, schemeUrlMatch);
  149769. if (pos > -1) {
  149770. matchStr = matchStr.substr(0, pos);
  149771. }
  149772. }
  149773. var foundCommonScheme = ["http://", "https://"].find(function(commonScheme) {
  149774. return !!schemeUrlMatch && schemeUrlMatch.indexOf(commonScheme) !== -1;
  149775. });
  149776. if (foundCommonScheme) {
  149777. var indexOfSchemeStart = matchStr.indexOf(foundCommonScheme);
  149778. matchStr = matchStr.substr(indexOfSchemeStart);
  149779. schemeUrlMatch = schemeUrlMatch.substr(indexOfSchemeStart);
  149780. offset2 = offset2 + indexOfSchemeStart;
  149781. }
  149782. var urlMatchType = schemeUrlMatch ? "scheme" : wwwUrlMatch ? "www" : "tld", protocolUrlMatch = !!schemeUrlMatch;
  149783. matches.push(new UrlMatch({
  149784. tagBuilder,
  149785. matchedText: matchStr,
  149786. offset: offset2,
  149787. urlMatchType,
  149788. url: matchStr,
  149789. protocolUrlMatch,
  149790. protocolRelativeMatch: !!protocolRelativeMatch,
  149791. stripPrefix,
  149792. stripTrailingSlash,
  149793. decodePercentEncoding
  149794. }));
  149795. };
  149796. var this_1 = this;
  149797. while ((match = matcherRegex2.exec(text2)) !== null) {
  149798. _loop_1();
  149799. }
  149800. return matches;
  149801. };
  149802. UrlMatcher2.prototype.matchHasUnbalancedClosingParen = function(matchStr) {
  149803. var endChar = matchStr.charAt(matchStr.length - 1);
  149804. var startChar;
  149805. if (endChar === ")") {
  149806. startChar = "(";
  149807. } else if (endChar === "]") {
  149808. startChar = "[";
  149809. } else if (endChar === "}") {
  149810. startChar = "{";
  149811. } else {
  149812. return false;
  149813. }
  149814. var numOpenBraces = 0;
  149815. for (var i2 = 0, len = matchStr.length - 1; i2 < len; i2++) {
  149816. var char = matchStr.charAt(i2);
  149817. if (char === startChar) {
  149818. numOpenBraces++;
  149819. } else if (char === endChar) {
  149820. numOpenBraces = Math.max(numOpenBraces - 1, 0);
  149821. }
  149822. }
  149823. if (numOpenBraces === 0) {
  149824. return true;
  149825. }
  149826. return false;
  149827. };
  149828. UrlMatcher2.prototype.matchHasInvalidCharAfterTld = function(urlMatch, schemeUrlMatch) {
  149829. if (!urlMatch) {
  149830. return -1;
  149831. }
  149832. var offset2 = 0;
  149833. if (schemeUrlMatch) {
  149834. offset2 = urlMatch.indexOf(":");
  149835. urlMatch = urlMatch.slice(offset2);
  149836. }
  149837. var re = new RegExp("^((.?//)?[-." + alphaNumericAndMarksCharsStr + "]*[-" + alphaNumericAndMarksCharsStr + "]\\.[-" + alphaNumericAndMarksCharsStr + "]+)");
  149838. var res = re.exec(urlMatch);
  149839. if (res === null) {
  149840. return -1;
  149841. }
  149842. offset2 += res[1].length;
  149843. urlMatch = urlMatch.slice(res[1].length);
  149844. if (/^[^-.A-Za-z0-9:\/?#]/.test(urlMatch)) {
  149845. return offset2;
  149846. }
  149847. return -1;
  149848. };
  149849. return UrlMatcher2;
  149850. }(Matcher);
  149851. var matcherRegex = new RegExp("#[_".concat(alphaNumericAndMarksCharsStr, "]{1,139}(?![_").concat(alphaNumericAndMarksCharsStr, "])"), "g");
  149852. var nonWordCharRegex$1 = new RegExp("[^" + alphaNumericAndMarksCharsStr + "]");
  149853. var HashtagMatcher = function(_super) {
  149854. __extends(HashtagMatcher2, _super);
  149855. function HashtagMatcher2(cfg) {
  149856. var _this = _super.call(this, cfg) || this;
  149857. _this.serviceName = "twitter";
  149858. _this.matcherRegex = matcherRegex;
  149859. _this.nonWordCharRegex = nonWordCharRegex$1;
  149860. _this.serviceName = cfg.serviceName;
  149861. return _this;
  149862. }
  149863. HashtagMatcher2.prototype.parseMatches = function(text2) {
  149864. var matcherRegex2 = this.matcherRegex, nonWordCharRegex2 = this.nonWordCharRegex, serviceName = this.serviceName, tagBuilder = this.tagBuilder, matches = [], match;
  149865. while ((match = matcherRegex2.exec(text2)) !== null) {
  149866. var offset2 = match.index, prevChar = text2.charAt(offset2 - 1);
  149867. if (offset2 === 0 || nonWordCharRegex2.test(prevChar)) {
  149868. var matchedText = match[0], hashtag = match[0].slice(1);
  149869. matches.push(new HashtagMatch({
  149870. tagBuilder,
  149871. matchedText,
  149872. offset: offset2,
  149873. serviceName,
  149874. hashtag
  149875. }));
  149876. }
  149877. }
  149878. return matches;
  149879. };
  149880. return HashtagMatcher2;
  149881. }(Matcher);
  149882. var mostPhoneNumbers = /(?:(?:(?:(\+)?\d{1,3}[-\040.]?)?\(?\d{3}\)?[-\040.]?\d{3}[-\040.]?\d{4})|(?:(\+)(?:9[976]\d|8[987530]\d|6[987]\d|5[90]\d|42\d|3[875]\d|2[98654321]\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)[-\040.]?(?:\d[-\040.]?){6,12}\d+))([,;]+[0-9]+#?)*/;
  149883. var japanesePhoneRe = /(0([1-9]{1}-?[1-9]\d{3}|[1-9]{2}-?\d{3}|[1-9]{2}\d{1}-?\d{2}|[1-9]{2}\d{2}-?\d{1})-?\d{4}|0[789]0-?\d{4}-?\d{4}|050-?\d{4}-?\d{4})/;
  149884. var phoneMatcherRegex = new RegExp("".concat(mostPhoneNumbers.source, "|").concat(japanesePhoneRe.source), "g");
  149885. var PhoneMatcher = function(_super) {
  149886. __extends(PhoneMatcher2, _super);
  149887. function PhoneMatcher2() {
  149888. var _this = _super !== null && _super.apply(this, arguments) || this;
  149889. _this.matcherRegex = phoneMatcherRegex;
  149890. return _this;
  149891. }
  149892. PhoneMatcher2.prototype.parseMatches = function(text2) {
  149893. var matcherRegex2 = this.matcherRegex, tagBuilder = this.tagBuilder, matches = [], match;
  149894. while ((match = matcherRegex2.exec(text2)) !== null) {
  149895. var matchedText = match[0], cleanNumber = matchedText.replace(/[^0-9,;#]/g, ""), plusSign = !!(match[1] || match[2]), before = match.index == 0 ? "" : text2.substr(match.index - 1, 1), after = text2.substr(match.index + matchedText.length, 1), contextClear = !before.match(/\d/) && !after.match(/\d/);
  149896. if (this.testMatch(match[3]) && this.testMatch(matchedText) && contextClear) {
  149897. matches.push(new PhoneMatch({
  149898. tagBuilder,
  149899. matchedText,
  149900. offset: match.index,
  149901. number: cleanNumber,
  149902. plusSign
  149903. }));
  149904. }
  149905. }
  149906. return matches;
  149907. };
  149908. PhoneMatcher2.prototype.testMatch = function(text2) {
  149909. return nonDigitRe.test(text2);
  149910. };
  149911. return PhoneMatcher2;
  149912. }(Matcher);
  149913. var twitterRegex = new RegExp("@[_".concat(alphaNumericAndMarksCharsStr, "]{1,50}(?![_").concat(alphaNumericAndMarksCharsStr, "])"), "g");
  149914. var instagramRegex = new RegExp("@[_.".concat(alphaNumericAndMarksCharsStr, "]{1,30}(?![_").concat(alphaNumericAndMarksCharsStr, "])"), "g");
  149915. var soundcloudRegex = new RegExp("@[-_.".concat(alphaNumericAndMarksCharsStr, "]{1,50}(?![-_").concat(alphaNumericAndMarksCharsStr, "])"), "g");
  149916. var tiktokRegex = new RegExp("@[_.".concat(alphaNumericAndMarksCharsStr, "]{1,23}[_").concat(alphaNumericAndMarksCharsStr, "](?![_").concat(alphaNumericAndMarksCharsStr, "])"), "g");
  149917. var nonWordCharRegex = new RegExp("[^" + alphaNumericAndMarksCharsStr + "]");
  149918. var MentionMatcher = function(_super) {
  149919. __extends(MentionMatcher2, _super);
  149920. function MentionMatcher2(cfg) {
  149921. var _this = _super.call(this, cfg) || this;
  149922. _this.serviceName = "twitter";
  149923. _this.matcherRegexes = {
  149924. "twitter": twitterRegex,
  149925. "instagram": instagramRegex,
  149926. "soundcloud": soundcloudRegex,
  149927. "tiktok": tiktokRegex
  149928. };
  149929. _this.nonWordCharRegex = nonWordCharRegex;
  149930. _this.serviceName = cfg.serviceName;
  149931. return _this;
  149932. }
  149933. MentionMatcher2.prototype.parseMatches = function(text2) {
  149934. var serviceName = this.serviceName, matcherRegex2 = this.matcherRegexes[this.serviceName], nonWordCharRegex2 = this.nonWordCharRegex, tagBuilder = this.tagBuilder, matches = [], match;
  149935. if (!matcherRegex2) {
  149936. return matches;
  149937. }
  149938. while ((match = matcherRegex2.exec(text2)) !== null) {
  149939. var offset2 = match.index, prevChar = text2.charAt(offset2 - 1);
  149940. if (offset2 === 0 || nonWordCharRegex2.test(prevChar)) {
  149941. var matchedText = match[0].replace(/\.+$/g, ""), mention = matchedText.slice(1);
  149942. matches.push(new MentionMatch({
  149943. tagBuilder,
  149944. matchedText,
  149945. offset: offset2,
  149946. serviceName,
  149947. mention
  149948. }));
  149949. }
  149950. }
  149951. return matches;
  149952. };
  149953. return MentionMatcher2;
  149954. }(Matcher);
  149955. function parseHtml(html2, _a) {
  149956. var onOpenTag = _a.onOpenTag, onCloseTag = _a.onCloseTag, onText = _a.onText, onComment = _a.onComment, onDoctype = _a.onDoctype;
  149957. var noCurrentTag = new CurrentTag();
  149958. var charIdx = 0, len = html2.length, state = 0, currentDataIdx = 0, currentTag = noCurrentTag;
  149959. while (charIdx < len) {
  149960. var char = html2.charAt(charIdx);
  149961. switch (state) {
  149962. case 0:
  149963. stateData(char);
  149964. break;
  149965. case 1:
  149966. stateTagOpen(char);
  149967. break;
  149968. case 2:
  149969. stateEndTagOpen(char);
  149970. break;
  149971. case 3:
  149972. stateTagName(char);
  149973. break;
  149974. case 4:
  149975. stateBeforeAttributeName(char);
  149976. break;
  149977. case 5:
  149978. stateAttributeName(char);
  149979. break;
  149980. case 6:
  149981. stateAfterAttributeName(char);
  149982. break;
  149983. case 7:
  149984. stateBeforeAttributeValue(char);
  149985. break;
  149986. case 8:
  149987. stateAttributeValueDoubleQuoted(char);
  149988. break;
  149989. case 9:
  149990. stateAttributeValueSingleQuoted(char);
  149991. break;
  149992. case 10:
  149993. stateAttributeValueUnquoted(char);
  149994. break;
  149995. case 11:
  149996. stateAfterAttributeValueQuoted(char);
  149997. break;
  149998. case 12:
  149999. stateSelfClosingStartTag(char);
  150000. break;
  150001. case 13:
  150002. stateMarkupDeclarationOpen();
  150003. break;
  150004. case 14:
  150005. stateCommentStart(char);
  150006. break;
  150007. case 15:
  150008. stateCommentStartDash(char);
  150009. break;
  150010. case 16:
  150011. stateComment(char);
  150012. break;
  150013. case 17:
  150014. stateCommentEndDash(char);
  150015. break;
  150016. case 18:
  150017. stateCommentEnd(char);
  150018. break;
  150019. case 19:
  150020. stateCommentEndBang(char);
  150021. break;
  150022. case 20:
  150023. stateDoctype(char);
  150024. break;
  150025. default:
  150026. throwUnhandledCaseError(state);
  150027. }
  150028. charIdx++;
  150029. }
  150030. if (currentDataIdx < charIdx) {
  150031. emitText();
  150032. }
  150033. function stateData(char2) {
  150034. if (char2 === "<") {
  150035. startNewTag();
  150036. }
  150037. }
  150038. function stateTagOpen(char2) {
  150039. if (char2 === "!") {
  150040. state = 13;
  150041. } else if (char2 === "/") {
  150042. state = 2;
  150043. currentTag = new CurrentTag(__assign(__assign({}, currentTag), { isClosing: true }));
  150044. } else if (char2 === "<") {
  150045. startNewTag();
  150046. } else if (letterRe.test(char2)) {
  150047. state = 3;
  150048. currentTag = new CurrentTag(__assign(__assign({}, currentTag), { isOpening: true }));
  150049. } else {
  150050. state = 0;
  150051. currentTag = noCurrentTag;
  150052. }
  150053. }
  150054. function stateTagName(char2) {
  150055. if (whitespaceRe.test(char2)) {
  150056. currentTag = new CurrentTag(__assign(__assign({}, currentTag), { name: captureTagName() }));
  150057. state = 4;
  150058. } else if (char2 === "<") {
  150059. startNewTag();
  150060. } else if (char2 === "/") {
  150061. currentTag = new CurrentTag(__assign(__assign({}, currentTag), { name: captureTagName() }));
  150062. state = 12;
  150063. } else if (char2 === ">") {
  150064. currentTag = new CurrentTag(__assign(__assign({}, currentTag), { name: captureTagName() }));
  150065. emitTagAndPreviousTextNode();
  150066. } else if (!letterRe.test(char2) && !digitRe.test(char2) && char2 !== ":") {
  150067. resetToDataState();
  150068. } else
  150069. ;
  150070. }
  150071. function stateEndTagOpen(char2) {
  150072. if (char2 === ">") {
  150073. resetToDataState();
  150074. } else if (letterRe.test(char2)) {
  150075. state = 3;
  150076. } else {
  150077. resetToDataState();
  150078. }
  150079. }
  150080. function stateBeforeAttributeName(char2) {
  150081. if (whitespaceRe.test(char2))
  150082. ;
  150083. else if (char2 === "/") {
  150084. state = 12;
  150085. } else if (char2 === ">") {
  150086. emitTagAndPreviousTextNode();
  150087. } else if (char2 === "<") {
  150088. startNewTag();
  150089. } else if (char2 === "=" || quoteRe.test(char2) || controlCharsRe.test(char2)) {
  150090. resetToDataState();
  150091. } else {
  150092. state = 5;
  150093. }
  150094. }
  150095. function stateAttributeName(char2) {
  150096. if (whitespaceRe.test(char2)) {
  150097. state = 6;
  150098. } else if (char2 === "/") {
  150099. state = 12;
  150100. } else if (char2 === "=") {
  150101. state = 7;
  150102. } else if (char2 === ">") {
  150103. emitTagAndPreviousTextNode();
  150104. } else if (char2 === "<") {
  150105. startNewTag();
  150106. } else if (quoteRe.test(char2)) {
  150107. resetToDataState();
  150108. } else
  150109. ;
  150110. }
  150111. function stateAfterAttributeName(char2) {
  150112. if (whitespaceRe.test(char2))
  150113. ;
  150114. else if (char2 === "/") {
  150115. state = 12;
  150116. } else if (char2 === "=") {
  150117. state = 7;
  150118. } else if (char2 === ">") {
  150119. emitTagAndPreviousTextNode();
  150120. } else if (char2 === "<") {
  150121. startNewTag();
  150122. } else if (quoteRe.test(char2)) {
  150123. resetToDataState();
  150124. } else {
  150125. state = 5;
  150126. }
  150127. }
  150128. function stateBeforeAttributeValue(char2) {
  150129. if (whitespaceRe.test(char2))
  150130. ;
  150131. else if (char2 === '"') {
  150132. state = 8;
  150133. } else if (char2 === "'") {
  150134. state = 9;
  150135. } else if (/[>=`]/.test(char2)) {
  150136. resetToDataState();
  150137. } else if (char2 === "<") {
  150138. startNewTag();
  150139. } else {
  150140. state = 10;
  150141. }
  150142. }
  150143. function stateAttributeValueDoubleQuoted(char2) {
  150144. if (char2 === '"') {
  150145. state = 11;
  150146. }
  150147. }
  150148. function stateAttributeValueSingleQuoted(char2) {
  150149. if (char2 === "'") {
  150150. state = 11;
  150151. }
  150152. }
  150153. function stateAttributeValueUnquoted(char2) {
  150154. if (whitespaceRe.test(char2)) {
  150155. state = 4;
  150156. } else if (char2 === ">") {
  150157. emitTagAndPreviousTextNode();
  150158. } else if (char2 === "<") {
  150159. startNewTag();
  150160. } else
  150161. ;
  150162. }
  150163. function stateAfterAttributeValueQuoted(char2) {
  150164. if (whitespaceRe.test(char2)) {
  150165. state = 4;
  150166. } else if (char2 === "/") {
  150167. state = 12;
  150168. } else if (char2 === ">") {
  150169. emitTagAndPreviousTextNode();
  150170. } else if (char2 === "<") {
  150171. startNewTag();
  150172. } else {
  150173. state = 4;
  150174. reconsumeCurrentCharacter();
  150175. }
  150176. }
  150177. function stateSelfClosingStartTag(char2) {
  150178. if (char2 === ">") {
  150179. currentTag = new CurrentTag(__assign(__assign({}, currentTag), { isClosing: true }));
  150180. emitTagAndPreviousTextNode();
  150181. } else {
  150182. state = 4;
  150183. }
  150184. }
  150185. function stateMarkupDeclarationOpen(char2) {
  150186. if (html2.substr(charIdx, 2) === "--") {
  150187. charIdx += 2;
  150188. currentTag = new CurrentTag(__assign(__assign({}, currentTag), { type: "comment" }));
  150189. state = 14;
  150190. } else if (html2.substr(charIdx, 7).toUpperCase() === "DOCTYPE") {
  150191. charIdx += 7;
  150192. currentTag = new CurrentTag(__assign(__assign({}, currentTag), { type: "doctype" }));
  150193. state = 20;
  150194. } else {
  150195. resetToDataState();
  150196. }
  150197. }
  150198. function stateCommentStart(char2) {
  150199. if (char2 === "-") {
  150200. state = 15;
  150201. } else if (char2 === ">") {
  150202. resetToDataState();
  150203. } else {
  150204. state = 16;
  150205. }
  150206. }
  150207. function stateCommentStartDash(char2) {
  150208. if (char2 === "-") {
  150209. state = 18;
  150210. } else if (char2 === ">") {
  150211. resetToDataState();
  150212. } else {
  150213. state = 16;
  150214. }
  150215. }
  150216. function stateComment(char2) {
  150217. if (char2 === "-") {
  150218. state = 17;
  150219. }
  150220. }
  150221. function stateCommentEndDash(char2) {
  150222. if (char2 === "-") {
  150223. state = 18;
  150224. } else {
  150225. state = 16;
  150226. }
  150227. }
  150228. function stateCommentEnd(char2) {
  150229. if (char2 === ">") {
  150230. emitTagAndPreviousTextNode();
  150231. } else if (char2 === "!") {
  150232. state = 19;
  150233. } else if (char2 === "-")
  150234. ;
  150235. else {
  150236. state = 16;
  150237. }
  150238. }
  150239. function stateCommentEndBang(char2) {
  150240. if (char2 === "-") {
  150241. state = 17;
  150242. } else if (char2 === ">") {
  150243. emitTagAndPreviousTextNode();
  150244. } else {
  150245. state = 16;
  150246. }
  150247. }
  150248. function stateDoctype(char2) {
  150249. if (char2 === ">") {
  150250. emitTagAndPreviousTextNode();
  150251. } else if (char2 === "<") {
  150252. startNewTag();
  150253. } else
  150254. ;
  150255. }
  150256. function resetToDataState() {
  150257. state = 0;
  150258. currentTag = noCurrentTag;
  150259. }
  150260. function startNewTag() {
  150261. state = 1;
  150262. currentTag = new CurrentTag({ idx: charIdx });
  150263. }
  150264. function emitTagAndPreviousTextNode() {
  150265. var textBeforeTag = html2.slice(currentDataIdx, currentTag.idx);
  150266. if (textBeforeTag) {
  150267. onText(textBeforeTag, currentDataIdx);
  150268. }
  150269. if (currentTag.type === "comment") {
  150270. onComment(currentTag.idx);
  150271. } else if (currentTag.type === "doctype") {
  150272. onDoctype(currentTag.idx);
  150273. } else {
  150274. if (currentTag.isOpening) {
  150275. onOpenTag(currentTag.name, currentTag.idx);
  150276. }
  150277. if (currentTag.isClosing) {
  150278. onCloseTag(currentTag.name, currentTag.idx);
  150279. }
  150280. }
  150281. resetToDataState();
  150282. currentDataIdx = charIdx + 1;
  150283. }
  150284. function emitText() {
  150285. var text2 = html2.slice(currentDataIdx, charIdx);
  150286. onText(text2, currentDataIdx);
  150287. currentDataIdx = charIdx + 1;
  150288. }
  150289. function captureTagName() {
  150290. var startIdx = currentTag.idx + (currentTag.isClosing ? 2 : 1);
  150291. return html2.slice(startIdx, charIdx).toLowerCase();
  150292. }
  150293. function reconsumeCurrentCharacter() {
  150294. charIdx--;
  150295. }
  150296. }
  150297. var CurrentTag = function() {
  150298. function CurrentTag2(cfg) {
  150299. if (cfg === void 0) {
  150300. cfg = {};
  150301. }
  150302. this.idx = cfg.idx !== void 0 ? cfg.idx : -1;
  150303. this.type = cfg.type || "tag";
  150304. this.name = cfg.name || "";
  150305. this.isOpening = !!cfg.isOpening;
  150306. this.isClosing = !!cfg.isClosing;
  150307. }
  150308. return CurrentTag2;
  150309. }();
  150310. var Autolinker = function() {
  150311. function Autolinker2(cfg) {
  150312. if (cfg === void 0) {
  150313. cfg = {};
  150314. }
  150315. this.version = Autolinker2.version;
  150316. this.urls = {};
  150317. this.email = true;
  150318. this.phone = true;
  150319. this.hashtag = false;
  150320. this.mention = false;
  150321. this.newWindow = true;
  150322. this.stripPrefix = { scheme: true, www: true };
  150323. this.stripTrailingSlash = true;
  150324. this.decodePercentEncoding = true;
  150325. this.truncate = { length: 0, location: "end" };
  150326. this.className = "";
  150327. this.replaceFn = null;
  150328. this.context = void 0;
  150329. this.sanitizeHtml = false;
  150330. this.matchers = null;
  150331. this.tagBuilder = null;
  150332. this.urls = this.normalizeUrlsCfg(cfg.urls);
  150333. this.email = typeof cfg.email === "boolean" ? cfg.email : this.email;
  150334. this.phone = typeof cfg.phone === "boolean" ? cfg.phone : this.phone;
  150335. this.hashtag = cfg.hashtag || this.hashtag;
  150336. this.mention = cfg.mention || this.mention;
  150337. this.newWindow = typeof cfg.newWindow === "boolean" ? cfg.newWindow : this.newWindow;
  150338. this.stripPrefix = this.normalizeStripPrefixCfg(cfg.stripPrefix);
  150339. this.stripTrailingSlash = typeof cfg.stripTrailingSlash === "boolean" ? cfg.stripTrailingSlash : this.stripTrailingSlash;
  150340. this.decodePercentEncoding = typeof cfg.decodePercentEncoding === "boolean" ? cfg.decodePercentEncoding : this.decodePercentEncoding;
  150341. this.sanitizeHtml = cfg.sanitizeHtml || false;
  150342. var mention = this.mention;
  150343. if (mention !== false && ["twitter", "instagram", "soundcloud", "tiktok"].indexOf(mention) === -1) {
  150344. throw new Error("invalid `mention` cfg '".concat(mention, "' - see docs"));
  150345. }
  150346. var hashtag = this.hashtag;
  150347. if (hashtag !== false && ["twitter", "facebook", "instagram", "tiktok"].indexOf(hashtag) === -1) {
  150348. throw new Error("invalid `hashtag` cfg '".concat(hashtag, "' - see docs"));
  150349. }
  150350. this.truncate = this.normalizeTruncateCfg(cfg.truncate);
  150351. this.className = cfg.className || this.className;
  150352. this.replaceFn = cfg.replaceFn || this.replaceFn;
  150353. this.context = cfg.context || this;
  150354. }
  150355. Autolinker2.link = function(textOrHtml, options) {
  150356. var autolinker3 = new Autolinker2(options);
  150357. return autolinker3.link(textOrHtml);
  150358. };
  150359. Autolinker2.parse = function(textOrHtml, options) {
  150360. var autolinker3 = new Autolinker2(options);
  150361. return autolinker3.parse(textOrHtml);
  150362. };
  150363. Autolinker2.prototype.normalizeUrlsCfg = function(urls) {
  150364. if (urls == null)
  150365. urls = true;
  150366. if (typeof urls === "boolean") {
  150367. return { schemeMatches: urls, wwwMatches: urls, tldMatches: urls };
  150368. } else {
  150369. return {
  150370. schemeMatches: typeof urls.schemeMatches === "boolean" ? urls.schemeMatches : true,
  150371. wwwMatches: typeof urls.wwwMatches === "boolean" ? urls.wwwMatches : true,
  150372. tldMatches: typeof urls.tldMatches === "boolean" ? urls.tldMatches : true
  150373. };
  150374. }
  150375. };
  150376. Autolinker2.prototype.normalizeStripPrefixCfg = function(stripPrefix) {
  150377. if (stripPrefix == null)
  150378. stripPrefix = true;
  150379. if (typeof stripPrefix === "boolean") {
  150380. return { scheme: stripPrefix, www: stripPrefix };
  150381. } else {
  150382. return {
  150383. scheme: typeof stripPrefix.scheme === "boolean" ? stripPrefix.scheme : true,
  150384. www: typeof stripPrefix.www === "boolean" ? stripPrefix.www : true
  150385. };
  150386. }
  150387. };
  150388. Autolinker2.prototype.normalizeTruncateCfg = function(truncate) {
  150389. if (typeof truncate === "number") {
  150390. return { length: truncate, location: "end" };
  150391. } else {
  150392. return defaults(truncate || {}, {
  150393. length: Number.POSITIVE_INFINITY,
  150394. location: "end"
  150395. });
  150396. }
  150397. };
  150398. Autolinker2.prototype.parse = function(textOrHtml) {
  150399. var _this = this;
  150400. var skipTagNames = ["a", "style", "script"], skipTagsStackCount = 0, matches = [];
  150401. parseHtml(textOrHtml, {
  150402. onOpenTag: function(tagName) {
  150403. if (skipTagNames.indexOf(tagName) >= 0) {
  150404. skipTagsStackCount++;
  150405. }
  150406. },
  150407. onText: function(text2, offset2) {
  150408. if (skipTagsStackCount === 0) {
  150409. var htmlCharacterEntitiesRegex = /(&nbsp;|&#160;|&lt;|&#60;|&gt;|&#62;|&quot;|&#34;|&#39;)/gi;
  150410. var textSplit = splitAndCapture(text2, htmlCharacterEntitiesRegex);
  150411. var currentOffset_1 = offset2;
  150412. textSplit.forEach(function(splitText, i2) {
  150413. if (i2 % 2 === 0) {
  150414. var textNodeMatches = _this.parseText(splitText, currentOffset_1);
  150415. matches.push.apply(matches, textNodeMatches);
  150416. }
  150417. currentOffset_1 += splitText.length;
  150418. });
  150419. }
  150420. },
  150421. onCloseTag: function(tagName) {
  150422. if (skipTagNames.indexOf(tagName) >= 0) {
  150423. skipTagsStackCount = Math.max(skipTagsStackCount - 1, 0);
  150424. }
  150425. },
  150426. onComment: function(offset2) {
  150427. },
  150428. onDoctype: function(offset2) {
  150429. }
  150430. });
  150431. matches = this.compactMatches(matches);
  150432. matches = this.removeUnwantedMatches(matches);
  150433. return matches;
  150434. };
  150435. Autolinker2.prototype.compactMatches = function(matches) {
  150436. matches.sort(function(a4, b) {
  150437. return a4.getOffset() - b.getOffset();
  150438. });
  150439. var i2 = 0;
  150440. while (i2 < matches.length - 1) {
  150441. var match = matches[i2], offset2 = match.getOffset(), matchedTextLength = match.getMatchedText().length, endIdx = offset2 + matchedTextLength;
  150442. if (i2 + 1 < matches.length) {
  150443. if (matches[i2 + 1].getOffset() === offset2) {
  150444. var removeIdx = matches[i2 + 1].getMatchedText().length > matchedTextLength ? i2 : i2 + 1;
  150445. matches.splice(removeIdx, 1);
  150446. continue;
  150447. }
  150448. if (matches[i2 + 1].getOffset() < endIdx) {
  150449. matches.splice(i2 + 1, 1);
  150450. continue;
  150451. }
  150452. }
  150453. i2++;
  150454. }
  150455. return matches;
  150456. };
  150457. Autolinker2.prototype.removeUnwantedMatches = function(matches) {
  150458. if (!this.hashtag)
  150459. remove2(matches, function(match) {
  150460. return match.getType() === "hashtag";
  150461. });
  150462. if (!this.email)
  150463. remove2(matches, function(match) {
  150464. return match.getType() === "email";
  150465. });
  150466. if (!this.phone)
  150467. remove2(matches, function(match) {
  150468. return match.getType() === "phone";
  150469. });
  150470. if (!this.mention)
  150471. remove2(matches, function(match) {
  150472. return match.getType() === "mention";
  150473. });
  150474. if (!this.urls.schemeMatches) {
  150475. remove2(matches, function(m) {
  150476. return m.getType() === "url" && m.getUrlMatchType() === "scheme";
  150477. });
  150478. }
  150479. if (!this.urls.wwwMatches) {
  150480. remove2(matches, function(m) {
  150481. return m.getType() === "url" && m.getUrlMatchType() === "www";
  150482. });
  150483. }
  150484. if (!this.urls.tldMatches) {
  150485. remove2(matches, function(m) {
  150486. return m.getType() === "url" && m.getUrlMatchType() === "tld";
  150487. });
  150488. }
  150489. return matches;
  150490. };
  150491. Autolinker2.prototype.parseText = function(text2, offset2) {
  150492. if (offset2 === void 0) {
  150493. offset2 = 0;
  150494. }
  150495. offset2 = offset2 || 0;
  150496. var matchers = this.getMatchers(), matches = [];
  150497. for (var i2 = 0, numMatchers = matchers.length; i2 < numMatchers; i2++) {
  150498. var textMatches = matchers[i2].parseMatches(text2);
  150499. for (var j = 0, numTextMatches = textMatches.length; j < numTextMatches; j++) {
  150500. textMatches[j].setOffset(offset2 + textMatches[j].getOffset());
  150501. }
  150502. matches.push.apply(matches, textMatches);
  150503. }
  150504. return matches;
  150505. };
  150506. Autolinker2.prototype.link = function(textOrHtml) {
  150507. if (!textOrHtml) {
  150508. return "";
  150509. }
  150510. if (this.sanitizeHtml) {
  150511. textOrHtml = textOrHtml.replace(/</g, "&lt;").replace(/>/g, "&gt;");
  150512. }
  150513. var matches = this.parse(textOrHtml), newHtml = [], lastIndex = 0;
  150514. for (var i2 = 0, len = matches.length; i2 < len; i2++) {
  150515. var match = matches[i2];
  150516. newHtml.push(textOrHtml.substring(lastIndex, match.getOffset()));
  150517. newHtml.push(this.createMatchReturnVal(match));
  150518. lastIndex = match.getOffset() + match.getMatchedText().length;
  150519. }
  150520. newHtml.push(textOrHtml.substring(lastIndex));
  150521. return newHtml.join("");
  150522. };
  150523. Autolinker2.prototype.createMatchReturnVal = function(match) {
  150524. var replaceFnResult;
  150525. if (this.replaceFn) {
  150526. replaceFnResult = this.replaceFn.call(this.context, match);
  150527. }
  150528. if (typeof replaceFnResult === "string") {
  150529. return replaceFnResult;
  150530. } else if (replaceFnResult === false) {
  150531. return match.getMatchedText();
  150532. } else if (replaceFnResult instanceof HtmlTag) {
  150533. return replaceFnResult.toAnchorString();
  150534. } else {
  150535. var anchorTag = match.buildTag();
  150536. return anchorTag.toAnchorString();
  150537. }
  150538. };
  150539. Autolinker2.prototype.getMatchers = function() {
  150540. if (!this.matchers) {
  150541. var tagBuilder = this.getTagBuilder();
  150542. var matchers = [
  150543. new HashtagMatcher({ tagBuilder, serviceName: this.hashtag }),
  150544. new EmailMatcher({ tagBuilder }),
  150545. new PhoneMatcher({ tagBuilder }),
  150546. new MentionMatcher({ tagBuilder, serviceName: this.mention }),
  150547. new UrlMatcher({ tagBuilder, stripPrefix: this.stripPrefix, stripTrailingSlash: this.stripTrailingSlash, decodePercentEncoding: this.decodePercentEncoding })
  150548. ];
  150549. return this.matchers = matchers;
  150550. } else {
  150551. return this.matchers;
  150552. }
  150553. };
  150554. Autolinker2.prototype.getTagBuilder = function() {
  150555. var tagBuilder = this.tagBuilder;
  150556. if (!tagBuilder) {
  150557. tagBuilder = this.tagBuilder = new AnchorTagBuilder({
  150558. newWindow: this.newWindow,
  150559. truncate: this.truncate,
  150560. className: this.className
  150561. });
  150562. }
  150563. return tagBuilder;
  150564. };
  150565. Autolinker2.version = "3.15.0";
  150566. Autolinker2.AnchorTagBuilder = AnchorTagBuilder;
  150567. Autolinker2.HtmlTag = HtmlTag;
  150568. Autolinker2.matcher = {
  150569. Email: EmailMatcher,
  150570. Hashtag: HashtagMatcher,
  150571. Matcher,
  150572. Mention: MentionMatcher,
  150573. Phone: PhoneMatcher,
  150574. Url: UrlMatcher
  150575. };
  150576. Autolinker2.match = {
  150577. Email: EmailMatch,
  150578. Hashtag: HashtagMatch,
  150579. Match,
  150580. Mention: MentionMatch,
  150581. Phone: PhoneMatch,
  150582. Url: UrlMatch
  150583. };
  150584. return Autolinker2;
  150585. }();
  150586. // node_modules/cesium/Source/DataSources/GpxDataSource.js
  150587. var parser;
  150588. if (typeof DOMParser !== "undefined") {
  150589. parser = new DOMParser();
  150590. }
  150591. var autolinker = new Autolinker({
  150592. stripPrefix: false,
  150593. email: false,
  150594. replaceFn: function(linker, match) {
  150595. if (!match.protocolUrlMatch) {
  150596. return false;
  150597. }
  150598. }
  150599. });
  150600. var BILLBOARD_SIZE = 32;
  150601. var BILLBOARD_NEAR_DISTANCE = 2414016;
  150602. var BILLBOARD_NEAR_RATIO = 1;
  150603. var BILLBOARD_FAR_DISTANCE = 16093e3;
  150604. var BILLBOARD_FAR_RATIO = 0.1;
  150605. var gpxNamespaces = [null, void 0, "http://www.topografix.com/GPX/1/1"];
  150606. var namespaces = {
  150607. gpx: gpxNamespaces
  150608. };
  150609. function readBlobAsText(blob) {
  150610. const deferred = defer_default();
  150611. const reader = new FileReader();
  150612. reader.addEventListener("load", function() {
  150613. deferred.resolve(reader.result);
  150614. });
  150615. reader.addEventListener("error", function() {
  150616. deferred.reject(reader.error);
  150617. });
  150618. reader.readAsText(blob);
  150619. return deferred.promise;
  150620. }
  150621. function getOrCreateEntity(node, entityCollection) {
  150622. let id = queryStringAttribute(node, "id");
  150623. id = defined_default(id) ? id : createGuid_default();
  150624. const entity = entityCollection.getOrCreateEntity(id);
  150625. return entity;
  150626. }
  150627. function readCoordinateFromNode(node) {
  150628. const longitude = queryNumericAttribute(node, "lon");
  150629. const latitude = queryNumericAttribute(node, "lat");
  150630. const elevation = queryNumericValue(node, "ele", namespaces.gpx);
  150631. return Cartesian3_default.fromDegrees(longitude, latitude, elevation);
  150632. }
  150633. function queryNumericAttribute(node, attributeName) {
  150634. if (!defined_default(node)) {
  150635. return void 0;
  150636. }
  150637. const value = node.getAttribute(attributeName);
  150638. if (value !== null) {
  150639. const result = parseFloat(value);
  150640. return !isNaN(result) ? result : void 0;
  150641. }
  150642. return void 0;
  150643. }
  150644. function queryStringAttribute(node, attributeName) {
  150645. if (!defined_default(node)) {
  150646. return void 0;
  150647. }
  150648. const value = node.getAttribute(attributeName);
  150649. return value !== null ? value : void 0;
  150650. }
  150651. function queryFirstNode(node, tagName, namespace) {
  150652. if (!defined_default(node)) {
  150653. return void 0;
  150654. }
  150655. const childNodes = node.childNodes;
  150656. const length3 = childNodes.length;
  150657. for (let q = 0; q < length3; q++) {
  150658. const child = childNodes[q];
  150659. if (child.localName === tagName && namespace.indexOf(child.namespaceURI) !== -1) {
  150660. return child;
  150661. }
  150662. }
  150663. return void 0;
  150664. }
  150665. function queryNodes(node, tagName, namespace) {
  150666. if (!defined_default(node)) {
  150667. return void 0;
  150668. }
  150669. const result = [];
  150670. const childNodes = node.getElementsByTagName(tagName);
  150671. const length3 = childNodes.length;
  150672. for (let q = 0; q < length3; q++) {
  150673. const child = childNodes[q];
  150674. if (child.localName === tagName && namespace.indexOf(child.namespaceURI) !== -1) {
  150675. result.push(child);
  150676. }
  150677. }
  150678. return result;
  150679. }
  150680. function queryNumericValue(node, tagName, namespace) {
  150681. const resultNode = queryFirstNode(node, tagName, namespace);
  150682. if (defined_default(resultNode)) {
  150683. const result = parseFloat(resultNode.textContent);
  150684. return !isNaN(result) ? result : void 0;
  150685. }
  150686. return void 0;
  150687. }
  150688. function queryStringValue(node, tagName, namespace) {
  150689. const result = queryFirstNode(node, tagName, namespace);
  150690. if (defined_default(result)) {
  150691. return result.textContent.trim();
  150692. }
  150693. return void 0;
  150694. }
  150695. function createDefaultBillboard(image) {
  150696. const billboard = new BillboardGraphics_default();
  150697. billboard.width = BILLBOARD_SIZE;
  150698. billboard.height = BILLBOARD_SIZE;
  150699. billboard.scaleByDistance = new NearFarScalar_default(
  150700. BILLBOARD_NEAR_DISTANCE,
  150701. BILLBOARD_NEAR_RATIO,
  150702. BILLBOARD_FAR_DISTANCE,
  150703. BILLBOARD_FAR_RATIO
  150704. );
  150705. billboard.pixelOffsetScaleByDistance = new NearFarScalar_default(
  150706. BILLBOARD_NEAR_DISTANCE,
  150707. BILLBOARD_NEAR_RATIO,
  150708. BILLBOARD_FAR_DISTANCE,
  150709. BILLBOARD_FAR_RATIO
  150710. );
  150711. billboard.verticalOrigin = new ConstantProperty_default(VerticalOrigin_default.BOTTOM);
  150712. billboard.image = image;
  150713. return billboard;
  150714. }
  150715. function createDefaultLabel() {
  150716. const label = new LabelGraphics_default();
  150717. label.translucencyByDistance = new NearFarScalar_default(3e6, 1, 5e6, 0);
  150718. label.pixelOffset = new Cartesian2_default(17, 0);
  150719. label.horizontalOrigin = HorizontalOrigin_default.LEFT;
  150720. label.font = "16px sans-serif";
  150721. label.style = LabelStyle_default.FILL_AND_OUTLINE;
  150722. return label;
  150723. }
  150724. function createDefaultPolyline(color) {
  150725. const polyline = new PolylineGraphics_default();
  150726. polyline.width = 4;
  150727. polyline.material = new PolylineOutlineMaterialProperty_default();
  150728. polyline.material.color = defined_default(color) ? color : Color_default.RED;
  150729. polyline.material.outlineWidth = 2;
  150730. polyline.material.outlineColor = Color_default.BLACK;
  150731. return polyline;
  150732. }
  150733. var descriptiveInfoTypes = {
  150734. time: {
  150735. text: "Time",
  150736. tag: "time"
  150737. },
  150738. comment: {
  150739. text: "Comment",
  150740. tag: "cmt"
  150741. },
  150742. description: {
  150743. text: "Description",
  150744. tag: "desc"
  150745. },
  150746. source: {
  150747. text: "Source",
  150748. tag: "src"
  150749. },
  150750. number: {
  150751. text: "GPS track/route number",
  150752. tag: "number"
  150753. },
  150754. type: {
  150755. text: "Type",
  150756. tag: "type"
  150757. }
  150758. };
  150759. var scratchDiv;
  150760. if (typeof document !== "undefined") {
  150761. scratchDiv = document.createElement("div");
  150762. }
  150763. function processDescription2(node, entity) {
  150764. let i2;
  150765. let text2 = "";
  150766. const infoTypeNames = Object.keys(descriptiveInfoTypes);
  150767. const length3 = infoTypeNames.length;
  150768. for (i2 = 0; i2 < length3; i2++) {
  150769. const infoTypeName = infoTypeNames[i2];
  150770. const infoType = descriptiveInfoTypes[infoTypeName];
  150771. infoType.value = defaultValue_default(
  150772. queryStringValue(node, infoType.tag, namespaces.gpx),
  150773. ""
  150774. );
  150775. if (defined_default(infoType.value) && infoType.value !== "") {
  150776. text2 = `${text2}<p>${infoType.text}: ${infoType.value}</p>`;
  150777. }
  150778. }
  150779. if (!defined_default(text2) || text2 === "") {
  150780. return;
  150781. }
  150782. text2 = autolinker.link(text2);
  150783. scratchDiv.innerHTML = text2;
  150784. const links = scratchDiv.querySelectorAll("a");
  150785. for (i2 = 0; i2 < links.length; i2++) {
  150786. links[i2].setAttribute("target", "_blank");
  150787. }
  150788. const background = Color_default.WHITE;
  150789. const foreground = Color_default.BLACK;
  150790. let tmp2 = '<div class="cesium-infoBox-description-lighter" style="';
  150791. tmp2 += "overflow:auto;";
  150792. tmp2 += "word-wrap:break-word;";
  150793. tmp2 += `background-color:${background.toCssColorString()};`;
  150794. tmp2 += `color:${foreground.toCssColorString()};`;
  150795. tmp2 += '">';
  150796. tmp2 += `${scratchDiv.innerHTML}</div>`;
  150797. scratchDiv.innerHTML = "";
  150798. return tmp2;
  150799. }
  150800. function processWpt(dataSource, geometryNode, entityCollection, options) {
  150801. const position = readCoordinateFromNode(geometryNode);
  150802. const entity = getOrCreateEntity(geometryNode, entityCollection);
  150803. entity.position = position;
  150804. const image = defined_default(options.waypointImage) ? options.waypointImage : dataSource._pinBuilder.fromMakiIconId(
  150805. "marker",
  150806. Color_default.RED,
  150807. BILLBOARD_SIZE
  150808. );
  150809. entity.billboard = createDefaultBillboard(image);
  150810. const name = queryStringValue(geometryNode, "name", namespaces.gpx);
  150811. entity.name = name;
  150812. entity.label = createDefaultLabel();
  150813. entity.label.text = name;
  150814. entity.description = processDescription2(geometryNode, entity);
  150815. if (options.clampToGround) {
  150816. entity.billboard.heightReference = HeightReference_default.CLAMP_TO_GROUND;
  150817. entity.label.heightReference = HeightReference_default.CLAMP_TO_GROUND;
  150818. }
  150819. }
  150820. function processRte(dataSource, geometryNode, entityCollection, options) {
  150821. const entity = getOrCreateEntity(geometryNode, entityCollection);
  150822. entity.description = processDescription2(geometryNode, entity);
  150823. const routePoints = queryNodes(geometryNode, "rtept", namespaces.gpx);
  150824. const coordinateTuples = new Array(routePoints.length);
  150825. for (let i2 = 0; i2 < routePoints.length; i2++) {
  150826. processWpt(dataSource, routePoints[i2], entityCollection, options);
  150827. coordinateTuples[i2] = readCoordinateFromNode(routePoints[i2]);
  150828. }
  150829. entity.polyline = createDefaultPolyline(options.routeColor);
  150830. if (options.clampToGround) {
  150831. entity.polyline.clampToGround = true;
  150832. }
  150833. entity.polyline.positions = coordinateTuples;
  150834. }
  150835. function processTrk(dataSource, geometryNode, entityCollection, options) {
  150836. const entity = getOrCreateEntity(geometryNode, entityCollection);
  150837. entity.description = processDescription2(geometryNode, entity);
  150838. const trackSegs = queryNodes(geometryNode, "trkseg", namespaces.gpx);
  150839. let positions = [];
  150840. let times = [];
  150841. let trackSegInfo;
  150842. let isTimeDynamic = true;
  150843. const property = new SampledPositionProperty_default();
  150844. for (let i2 = 0; i2 < trackSegs.length; i2++) {
  150845. trackSegInfo = processTrkSeg(trackSegs[i2]);
  150846. positions = positions.concat(trackSegInfo.positions);
  150847. if (trackSegInfo.times.length > 0) {
  150848. times = times.concat(trackSegInfo.times);
  150849. property.addSamples(times, positions);
  150850. isTimeDynamic = isTimeDynamic && true;
  150851. } else {
  150852. isTimeDynamic = false;
  150853. }
  150854. }
  150855. if (isTimeDynamic) {
  150856. const image = defined_default(options.waypointImage) ? options.waypointImage : dataSource._pinBuilder.fromMakiIconId(
  150857. "marker",
  150858. Color_default.RED,
  150859. BILLBOARD_SIZE
  150860. );
  150861. entity.billboard = createDefaultBillboard(image);
  150862. entity.position = property;
  150863. if (options.clampToGround) {
  150864. entity.billboard.heightReference = HeightReference_default.CLAMP_TO_GROUND;
  150865. }
  150866. entity.availability = new TimeIntervalCollection_default();
  150867. entity.availability.addInterval(
  150868. new TimeInterval_default({
  150869. start: times[0],
  150870. stop: times[times.length - 1]
  150871. })
  150872. );
  150873. }
  150874. entity.polyline = createDefaultPolyline(options.trackColor);
  150875. entity.polyline.positions = positions;
  150876. if (options.clampToGround) {
  150877. entity.polyline.clampToGround = true;
  150878. }
  150879. }
  150880. function processTrkSeg(node) {
  150881. const result = {
  150882. positions: [],
  150883. times: []
  150884. };
  150885. const trackPoints = queryNodes(node, "trkpt", namespaces.gpx);
  150886. let time;
  150887. for (let i2 = 0; i2 < trackPoints.length; i2++) {
  150888. const position = readCoordinateFromNode(trackPoints[i2]);
  150889. result.positions.push(position);
  150890. time = queryStringValue(trackPoints[i2], "time", namespaces.gpx);
  150891. if (defined_default(time)) {
  150892. result.times.push(JulianDate_default.fromIso8601(time));
  150893. }
  150894. }
  150895. return result;
  150896. }
  150897. function processMetadata(node) {
  150898. const metadataNode = queryFirstNode(node, "metadata", namespaces.gpx);
  150899. if (defined_default(metadataNode)) {
  150900. const metadata = {
  150901. name: queryStringValue(metadataNode, "name", namespaces.gpx),
  150902. desc: queryStringValue(metadataNode, "desc", namespaces.gpx),
  150903. author: getPerson(metadataNode),
  150904. copyright: getCopyright(metadataNode),
  150905. link: getLink(metadataNode),
  150906. time: queryStringValue(metadataNode, "time", namespaces.gpx),
  150907. keywords: queryStringValue(metadataNode, "keywords", namespaces.gpx),
  150908. bounds: getBounds(metadataNode)
  150909. };
  150910. if (defined_default(metadata.name) || defined_default(metadata.desc) || defined_default(metadata.author) || defined_default(metadata.copyright) || defined_default(metadata.link) || defined_default(metadata.time) || defined_default(metadata.keywords) || defined_default(metadata.bounds)) {
  150911. return metadata;
  150912. }
  150913. }
  150914. return void 0;
  150915. }
  150916. function getPerson(node) {
  150917. const personNode = queryFirstNode(node, "author", namespaces.gpx);
  150918. if (defined_default(personNode)) {
  150919. const person = {
  150920. name: queryStringValue(personNode, "name", namespaces.gpx),
  150921. email: getEmail(personNode),
  150922. link: getLink(personNode)
  150923. };
  150924. if (defined_default(person.name) || defined_default(person.email) || defined_default(person.link)) {
  150925. return person;
  150926. }
  150927. }
  150928. return void 0;
  150929. }
  150930. function getEmail(node) {
  150931. const emailNode = queryFirstNode(node, "email", namespaces.gpx);
  150932. if (defined_default(emailNode)) {
  150933. const id = queryStringValue(emailNode, "id", namespaces.gpx);
  150934. const domain = queryStringValue(emailNode, "domain", namespaces.gpx);
  150935. return `${id}@${domain}`;
  150936. }
  150937. return void 0;
  150938. }
  150939. function getLink(node) {
  150940. const linkNode = queryFirstNode(node, "link", namespaces.gpx);
  150941. if (defined_default(linkNode)) {
  150942. const link = {
  150943. href: queryStringAttribute(linkNode, "href"),
  150944. text: queryStringValue(linkNode, "text", namespaces.gpx),
  150945. mimeType: queryStringValue(linkNode, "type", namespaces.gpx)
  150946. };
  150947. if (defined_default(link.href) || defined_default(link.text) || defined_default(link.mimeType)) {
  150948. return link;
  150949. }
  150950. }
  150951. return void 0;
  150952. }
  150953. function getCopyright(node) {
  150954. const copyrightNode = queryFirstNode(node, "copyright", namespaces.gpx);
  150955. if (defined_default(copyrightNode)) {
  150956. const copyright = {
  150957. author: queryStringAttribute(copyrightNode, "author"),
  150958. year: queryStringValue(copyrightNode, "year", namespaces.gpx),
  150959. license: queryStringValue(copyrightNode, "license", namespaces.gpx)
  150960. };
  150961. if (defined_default(copyright.author) || defined_default(copyright.year) || defined_default(copyright.license)) {
  150962. return copyright;
  150963. }
  150964. }
  150965. return void 0;
  150966. }
  150967. function getBounds(node) {
  150968. const boundsNode = queryFirstNode(node, "bounds", namespaces.gpx);
  150969. if (defined_default(boundsNode)) {
  150970. const bounds = {
  150971. minLat: queryNumericValue(boundsNode, "minlat", namespaces.gpx),
  150972. maxLat: queryNumericValue(boundsNode, "maxlat", namespaces.gpx),
  150973. minLon: queryNumericValue(boundsNode, "minlon", namespaces.gpx),
  150974. maxLon: queryNumericValue(boundsNode, "maxlon", namespaces.gpx)
  150975. };
  150976. if (defined_default(bounds.minLat) || defined_default(bounds.maxLat) || defined_default(bounds.minLon) || defined_default(bounds.maxLon)) {
  150977. return bounds;
  150978. }
  150979. }
  150980. return void 0;
  150981. }
  150982. var complexTypes = {
  150983. wpt: processWpt,
  150984. rte: processRte,
  150985. trk: processTrk
  150986. };
  150987. function processGpx(dataSource, node, entityCollection, options) {
  150988. const complexTypeNames = Object.keys(complexTypes);
  150989. const complexTypeNamesLength = complexTypeNames.length;
  150990. for (let i2 = 0; i2 < complexTypeNamesLength; i2++) {
  150991. const typeName = complexTypeNames[i2];
  150992. const processComplexTypeNode = complexTypes[typeName];
  150993. const childNodes = node.childNodes;
  150994. const length3 = childNodes.length;
  150995. for (let q = 0; q < length3; q++) {
  150996. const child = childNodes[q];
  150997. if (child.localName === typeName && namespaces.gpx.indexOf(child.namespaceURI) !== -1) {
  150998. processComplexTypeNode(dataSource, child, entityCollection, options);
  150999. }
  151000. }
  151001. }
  151002. }
  151003. function loadGpx(dataSource, gpx, options) {
  151004. const entityCollection = dataSource._entityCollection;
  151005. entityCollection.removeAll();
  151006. const element = gpx.documentElement;
  151007. const version = queryStringAttribute(element, "version");
  151008. const creator = queryStringAttribute(element, "creator");
  151009. let name;
  151010. const metadata = processMetadata(element);
  151011. if (defined_default(metadata)) {
  151012. name = metadata.name;
  151013. }
  151014. if (element.localName === "gpx") {
  151015. processGpx(dataSource, element, entityCollection, options);
  151016. } else {
  151017. console.log(`GPX - Unsupported node: ${element.localName}`);
  151018. }
  151019. let clock;
  151020. const availability = entityCollection.computeAvailability();
  151021. let start = availability.start;
  151022. let stop2 = availability.stop;
  151023. const isMinStart = JulianDate_default.equals(start, Iso8601_default.MINIMUM_VALUE);
  151024. const isMaxStop = JulianDate_default.equals(stop2, Iso8601_default.MAXIMUM_VALUE);
  151025. if (!isMinStart || !isMaxStop) {
  151026. let date;
  151027. if (isMinStart) {
  151028. date = new Date();
  151029. date.setHours(0, 0, 0, 0);
  151030. start = JulianDate_default.fromDate(date);
  151031. }
  151032. if (isMaxStop) {
  151033. date = new Date();
  151034. date.setHours(24, 0, 0, 0);
  151035. stop2 = JulianDate_default.fromDate(date);
  151036. }
  151037. clock = new DataSourceClock_default();
  151038. clock.startTime = start;
  151039. clock.stopTime = stop2;
  151040. clock.currentTime = JulianDate_default.clone(start);
  151041. clock.clockRange = ClockRange_default.LOOP_STOP;
  151042. clock.clockStep = ClockStep_default.SYSTEM_CLOCK_MULTIPLIER;
  151043. clock.multiplier = Math.round(
  151044. Math.min(
  151045. Math.max(JulianDate_default.secondsDifference(stop2, start) / 60, 1),
  151046. 31556900
  151047. )
  151048. );
  151049. }
  151050. let changed = false;
  151051. if (dataSource._name !== name) {
  151052. dataSource._name = name;
  151053. changed = true;
  151054. }
  151055. if (dataSource._creator !== creator) {
  151056. dataSource._creator = creator;
  151057. changed = true;
  151058. }
  151059. if (metadataChanged(dataSource._metadata, metadata)) {
  151060. dataSource._metadata = metadata;
  151061. changed = true;
  151062. }
  151063. if (dataSource._version !== version) {
  151064. dataSource._version = version;
  151065. changed = true;
  151066. }
  151067. if (clock !== dataSource._clock) {
  151068. changed = true;
  151069. dataSource._clock = clock;
  151070. }
  151071. if (changed) {
  151072. dataSource._changed.raiseEvent(dataSource);
  151073. }
  151074. DataSource_default.setLoading(dataSource, false);
  151075. return dataSource;
  151076. }
  151077. function metadataChanged(old, current) {
  151078. if (!defined_default(old) && !defined_default(current)) {
  151079. return false;
  151080. } else if (defined_default(old) && defined_default(current)) {
  151081. if (old.name !== current.name || old.dec !== current.desc || old.src !== current.src || old.author !== current.author || old.copyright !== current.copyright || old.link !== current.link || old.time !== current.time || old.bounds !== current.bounds) {
  151082. return true;
  151083. }
  151084. return false;
  151085. }
  151086. return true;
  151087. }
  151088. function load3(dataSource, entityCollection, data, options) {
  151089. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  151090. let promise = data;
  151091. if (typeof data === "string" || data instanceof Resource_default) {
  151092. data = Resource_default.createIfNeeded(data);
  151093. promise = data.fetchBlob();
  151094. const resourceCredits = dataSource._resourceCredits;
  151095. const credits = data.credits;
  151096. if (defined_default(credits)) {
  151097. const length3 = credits.length;
  151098. for (let i2 = 0; i2 < length3; i2++) {
  151099. resourceCredits.push(credits[i2]);
  151100. }
  151101. }
  151102. }
  151103. return Promise.resolve(promise).then(function(dataToLoad) {
  151104. if (dataToLoad instanceof Blob) {
  151105. return readBlobAsText(dataToLoad).then(function(text2) {
  151106. let gpx;
  151107. let error;
  151108. try {
  151109. gpx = parser.parseFromString(text2, "application/xml");
  151110. } catch (e2) {
  151111. error = e2.toString();
  151112. }
  151113. if (defined_default(error) || gpx.body || gpx.documentElement.tagName === "parsererror") {
  151114. let msg = defined_default(error) ? error : gpx.documentElement.firstChild.nodeValue;
  151115. if (!msg) {
  151116. msg = gpx.body.innerText;
  151117. }
  151118. throw new RuntimeError_default(msg);
  151119. }
  151120. return loadGpx(dataSource, gpx, options);
  151121. });
  151122. }
  151123. return loadGpx(dataSource, dataToLoad, options);
  151124. }).catch(function(error) {
  151125. dataSource._error.raiseEvent(dataSource, error);
  151126. console.log(error);
  151127. return Promise.reject(error);
  151128. });
  151129. }
  151130. function GpxDataSource() {
  151131. this._changed = new Event_default();
  151132. this._error = new Event_default();
  151133. this._loading = new Event_default();
  151134. this._clock = void 0;
  151135. this._entityCollection = new EntityCollection_default();
  151136. this._entityCluster = new EntityCluster_default();
  151137. this._name = void 0;
  151138. this._version = void 0;
  151139. this._creator = void 0;
  151140. this._metadata = void 0;
  151141. this._isLoading = false;
  151142. this._pinBuilder = new PinBuilder_default();
  151143. }
  151144. GpxDataSource.load = function(data, options) {
  151145. return new GpxDataSource().load(data, options);
  151146. };
  151147. Object.defineProperties(GpxDataSource.prototype, {
  151148. name: {
  151149. get: function() {
  151150. return this._name;
  151151. }
  151152. },
  151153. version: {
  151154. get: function() {
  151155. return this._version;
  151156. }
  151157. },
  151158. creator: {
  151159. get: function() {
  151160. return this._creator;
  151161. }
  151162. },
  151163. metadata: {
  151164. get: function() {
  151165. return this._metadata;
  151166. }
  151167. },
  151168. clock: {
  151169. get: function() {
  151170. return this._clock;
  151171. }
  151172. },
  151173. entities: {
  151174. get: function() {
  151175. return this._entityCollection;
  151176. }
  151177. },
  151178. isLoading: {
  151179. get: function() {
  151180. return this._isLoading;
  151181. }
  151182. },
  151183. changedEvent: {
  151184. get: function() {
  151185. return this._changed;
  151186. }
  151187. },
  151188. errorEvent: {
  151189. get: function() {
  151190. return this._error;
  151191. }
  151192. },
  151193. loadingEvent: {
  151194. get: function() {
  151195. return this._loading;
  151196. }
  151197. },
  151198. show: {
  151199. get: function() {
  151200. return this._entityCollection.show;
  151201. },
  151202. set: function(value) {
  151203. this._entityCollection.show = value;
  151204. }
  151205. },
  151206. clustering: {
  151207. get: function() {
  151208. return this._entityCluster;
  151209. },
  151210. set: function(value) {
  151211. if (!defined_default(value)) {
  151212. throw new DeveloperError_default("value must be defined.");
  151213. }
  151214. this._entityCluster = value;
  151215. }
  151216. }
  151217. });
  151218. GpxDataSource.prototype.update = function(time) {
  151219. return true;
  151220. };
  151221. GpxDataSource.prototype.load = function(data, options) {
  151222. if (!defined_default(data)) {
  151223. throw new DeveloperError_default("data is required.");
  151224. }
  151225. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  151226. DataSource_default.setLoading(this, true);
  151227. const oldName = this._name;
  151228. const that = this;
  151229. return load3(this, this._entityCollection, data, options).then(function() {
  151230. let clock;
  151231. const availability = that._entityCollection.computeAvailability();
  151232. let start = availability.start;
  151233. let stop2 = availability.stop;
  151234. const isMinStart = JulianDate_default.equals(start, Iso8601_default.MINIMUM_VALUE);
  151235. const isMaxStop = JulianDate_default.equals(stop2, Iso8601_default.MAXIMUM_VALUE);
  151236. if (!isMinStart || !isMaxStop) {
  151237. let date;
  151238. if (isMinStart) {
  151239. date = new Date();
  151240. date.setHours(0, 0, 0, 0);
  151241. start = JulianDate_default.fromDate(date);
  151242. }
  151243. if (isMaxStop) {
  151244. date = new Date();
  151245. date.setHours(24, 0, 0, 0);
  151246. stop2 = JulianDate_default.fromDate(date);
  151247. }
  151248. clock = new DataSourceClock_default();
  151249. clock.startTime = start;
  151250. clock.stopTime = stop2;
  151251. clock.currentTime = JulianDate_default.clone(start);
  151252. clock.clockRange = ClockRange_default.LOOP_STOP;
  151253. clock.clockStep = ClockStep_default.SYSTEM_CLOCK_MULTIPLIER;
  151254. clock.multiplier = Math.round(
  151255. Math.min(
  151256. Math.max(JulianDate_default.secondsDifference(stop2, start) / 60, 1),
  151257. 31556900
  151258. )
  151259. );
  151260. }
  151261. let changed = false;
  151262. if (clock !== that._clock) {
  151263. that._clock = clock;
  151264. changed = true;
  151265. }
  151266. if (oldName !== that._name) {
  151267. changed = true;
  151268. }
  151269. if (changed) {
  151270. that._changed.raiseEvent(that);
  151271. }
  151272. DataSource_default.setLoading(that, false);
  151273. return that;
  151274. }).catch(function(error) {
  151275. DataSource_default.setLoading(that, false);
  151276. that._error.raiseEvent(that, error);
  151277. console.log(error);
  151278. return Promise.reject(error);
  151279. });
  151280. };
  151281. var GpxDataSource_default = GpxDataSource;
  151282. // node_modules/cesium/Source/DataSources/KmlCamera.js
  151283. function KmlCamera(position, headingPitchRoll) {
  151284. this.position = position;
  151285. this.headingPitchRoll = headingPitchRoll;
  151286. }
  151287. var KmlCamera_default = KmlCamera;
  151288. // node_modules/cesium/Source/ThirdParty/zip.js
  151289. var MAX_BITS$1 = 15;
  151290. var D_CODES = 30;
  151291. var BL_CODES = 19;
  151292. var LENGTH_CODES = 29;
  151293. var LITERALS = 256;
  151294. var L_CODES = LITERALS + 1 + LENGTH_CODES;
  151295. var HEAP_SIZE = 2 * L_CODES + 1;
  151296. var END_BLOCK = 256;
  151297. var MAX_BL_BITS = 7;
  151298. var REP_3_6 = 16;
  151299. var REPZ_3_10 = 17;
  151300. var REPZ_11_138 = 18;
  151301. var Buf_size = 8 * 2;
  151302. var Z_DEFAULT_COMPRESSION = -1;
  151303. var Z_FILTERED = 1;
  151304. var Z_HUFFMAN_ONLY = 2;
  151305. var Z_DEFAULT_STRATEGY = 0;
  151306. var Z_NO_FLUSH$1 = 0;
  151307. var Z_PARTIAL_FLUSH = 1;
  151308. var Z_FULL_FLUSH = 3;
  151309. var Z_FINISH$1 = 4;
  151310. var Z_OK$1 = 0;
  151311. var Z_STREAM_END$1 = 1;
  151312. var Z_NEED_DICT$1 = 2;
  151313. var Z_STREAM_ERROR$1 = -2;
  151314. var Z_DATA_ERROR$1 = -3;
  151315. var Z_BUF_ERROR$1 = -5;
  151316. function extractArray(array) {
  151317. return flatArray(array.map(([length3, value]) => new Array(length3).fill(value, 0, length3)));
  151318. }
  151319. function flatArray(array) {
  151320. return array.reduce((a4, b) => a4.concat(Array.isArray(b) ? flatArray(b) : b), []);
  151321. }
  151322. var _dist_code = [0, 1, 2, 3].concat(...extractArray([
  151323. [2, 4],
  151324. [2, 5],
  151325. [4, 6],
  151326. [4, 7],
  151327. [8, 8],
  151328. [8, 9],
  151329. [16, 10],
  151330. [16, 11],
  151331. [32, 12],
  151332. [32, 13],
  151333. [64, 14],
  151334. [64, 15],
  151335. [2, 0],
  151336. [1, 16],
  151337. [1, 17],
  151338. [2, 18],
  151339. [2, 19],
  151340. [4, 20],
  151341. [4, 21],
  151342. [8, 22],
  151343. [8, 23],
  151344. [16, 24],
  151345. [16, 25],
  151346. [32, 26],
  151347. [32, 27],
  151348. [64, 28],
  151349. [64, 29]
  151350. ]));
  151351. function Tree() {
  151352. const that = this;
  151353. function gen_bitlen(s2) {
  151354. const tree = that.dyn_tree;
  151355. const stree = that.stat_desc.static_tree;
  151356. const extra = that.stat_desc.extra_bits;
  151357. const base = that.stat_desc.extra_base;
  151358. const max_length = that.stat_desc.max_length;
  151359. let h;
  151360. let n2, m;
  151361. let bits;
  151362. let xbits;
  151363. let f2;
  151364. let overflow = 0;
  151365. for (bits = 0; bits <= MAX_BITS$1; bits++)
  151366. s2.bl_count[bits] = 0;
  151367. tree[s2.heap[s2.heap_max] * 2 + 1] = 0;
  151368. for (h = s2.heap_max + 1; h < HEAP_SIZE; h++) {
  151369. n2 = s2.heap[h];
  151370. bits = tree[tree[n2 * 2 + 1] * 2 + 1] + 1;
  151371. if (bits > max_length) {
  151372. bits = max_length;
  151373. overflow++;
  151374. }
  151375. tree[n2 * 2 + 1] = bits;
  151376. if (n2 > that.max_code)
  151377. continue;
  151378. s2.bl_count[bits]++;
  151379. xbits = 0;
  151380. if (n2 >= base)
  151381. xbits = extra[n2 - base];
  151382. f2 = tree[n2 * 2];
  151383. s2.opt_len += f2 * (bits + xbits);
  151384. if (stree)
  151385. s2.static_len += f2 * (stree[n2 * 2 + 1] + xbits);
  151386. }
  151387. if (overflow === 0)
  151388. return;
  151389. do {
  151390. bits = max_length - 1;
  151391. while (s2.bl_count[bits] === 0)
  151392. bits--;
  151393. s2.bl_count[bits]--;
  151394. s2.bl_count[bits + 1] += 2;
  151395. s2.bl_count[max_length]--;
  151396. overflow -= 2;
  151397. } while (overflow > 0);
  151398. for (bits = max_length; bits !== 0; bits--) {
  151399. n2 = s2.bl_count[bits];
  151400. while (n2 !== 0) {
  151401. m = s2.heap[--h];
  151402. if (m > that.max_code)
  151403. continue;
  151404. if (tree[m * 2 + 1] != bits) {
  151405. s2.opt_len += (bits - tree[m * 2 + 1]) * tree[m * 2];
  151406. tree[m * 2 + 1] = bits;
  151407. }
  151408. n2--;
  151409. }
  151410. }
  151411. }
  151412. function bi_reverse(code, len) {
  151413. let res = 0;
  151414. do {
  151415. res |= code & 1;
  151416. code >>>= 1;
  151417. res <<= 1;
  151418. } while (--len > 0);
  151419. return res >>> 1;
  151420. }
  151421. function gen_codes(tree, max_code, bl_count) {
  151422. const next_code = [];
  151423. let code = 0;
  151424. let bits;
  151425. let n2;
  151426. let len;
  151427. for (bits = 1; bits <= MAX_BITS$1; bits++) {
  151428. next_code[bits] = code = code + bl_count[bits - 1] << 1;
  151429. }
  151430. for (n2 = 0; n2 <= max_code; n2++) {
  151431. len = tree[n2 * 2 + 1];
  151432. if (len === 0)
  151433. continue;
  151434. tree[n2 * 2] = bi_reverse(next_code[len]++, len);
  151435. }
  151436. }
  151437. that.build_tree = function(s2) {
  151438. const tree = that.dyn_tree;
  151439. const stree = that.stat_desc.static_tree;
  151440. const elems = that.stat_desc.elems;
  151441. let n2, m;
  151442. let max_code = -1;
  151443. let node;
  151444. s2.heap_len = 0;
  151445. s2.heap_max = HEAP_SIZE;
  151446. for (n2 = 0; n2 < elems; n2++) {
  151447. if (tree[n2 * 2] !== 0) {
  151448. s2.heap[++s2.heap_len] = max_code = n2;
  151449. s2.depth[n2] = 0;
  151450. } else {
  151451. tree[n2 * 2 + 1] = 0;
  151452. }
  151453. }
  151454. while (s2.heap_len < 2) {
  151455. node = s2.heap[++s2.heap_len] = max_code < 2 ? ++max_code : 0;
  151456. tree[node * 2] = 1;
  151457. s2.depth[node] = 0;
  151458. s2.opt_len--;
  151459. if (stree)
  151460. s2.static_len -= stree[node * 2 + 1];
  151461. }
  151462. that.max_code = max_code;
  151463. for (n2 = Math.floor(s2.heap_len / 2); n2 >= 1; n2--)
  151464. s2.pqdownheap(tree, n2);
  151465. node = elems;
  151466. do {
  151467. n2 = s2.heap[1];
  151468. s2.heap[1] = s2.heap[s2.heap_len--];
  151469. s2.pqdownheap(tree, 1);
  151470. m = s2.heap[1];
  151471. s2.heap[--s2.heap_max] = n2;
  151472. s2.heap[--s2.heap_max] = m;
  151473. tree[node * 2] = tree[n2 * 2] + tree[m * 2];
  151474. s2.depth[node] = Math.max(s2.depth[n2], s2.depth[m]) + 1;
  151475. tree[n2 * 2 + 1] = tree[m * 2 + 1] = node;
  151476. s2.heap[1] = node++;
  151477. s2.pqdownheap(tree, 1);
  151478. } while (s2.heap_len >= 2);
  151479. s2.heap[--s2.heap_max] = s2.heap[1];
  151480. gen_bitlen(s2);
  151481. gen_codes(tree, that.max_code, s2.bl_count);
  151482. };
  151483. }
  151484. Tree._length_code = [0, 1, 2, 3, 4, 5, 6, 7].concat(...extractArray([
  151485. [2, 8],
  151486. [2, 9],
  151487. [2, 10],
  151488. [2, 11],
  151489. [4, 12],
  151490. [4, 13],
  151491. [4, 14],
  151492. [4, 15],
  151493. [8, 16],
  151494. [8, 17],
  151495. [8, 18],
  151496. [8, 19],
  151497. [16, 20],
  151498. [16, 21],
  151499. [16, 22],
  151500. [16, 23],
  151501. [32, 24],
  151502. [32, 25],
  151503. [32, 26],
  151504. [31, 27],
  151505. [1, 28]
  151506. ]));
  151507. Tree.base_length = [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 0];
  151508. Tree.base_dist = [
  151509. 0,
  151510. 1,
  151511. 2,
  151512. 3,
  151513. 4,
  151514. 6,
  151515. 8,
  151516. 12,
  151517. 16,
  151518. 24,
  151519. 32,
  151520. 48,
  151521. 64,
  151522. 96,
  151523. 128,
  151524. 192,
  151525. 256,
  151526. 384,
  151527. 512,
  151528. 768,
  151529. 1024,
  151530. 1536,
  151531. 2048,
  151532. 3072,
  151533. 4096,
  151534. 6144,
  151535. 8192,
  151536. 12288,
  151537. 16384,
  151538. 24576
  151539. ];
  151540. Tree.d_code = function(dist) {
  151541. return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];
  151542. };
  151543. Tree.extra_lbits = [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];
  151544. Tree.extra_dbits = [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];
  151545. Tree.extra_blbits = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7];
  151546. Tree.bl_order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
  151547. function StaticTree(static_tree, extra_bits, extra_base, elems, max_length) {
  151548. const that = this;
  151549. that.static_tree = static_tree;
  151550. that.extra_bits = extra_bits;
  151551. that.extra_base = extra_base;
  151552. that.elems = elems;
  151553. that.max_length = max_length;
  151554. }
  151555. var static_ltree2_first_part = [
  151556. 12,
  151557. 140,
  151558. 76,
  151559. 204,
  151560. 44,
  151561. 172,
  151562. 108,
  151563. 236,
  151564. 28,
  151565. 156,
  151566. 92,
  151567. 220,
  151568. 60,
  151569. 188,
  151570. 124,
  151571. 252,
  151572. 2,
  151573. 130,
  151574. 66,
  151575. 194,
  151576. 34,
  151577. 162,
  151578. 98,
  151579. 226,
  151580. 18,
  151581. 146,
  151582. 82,
  151583. 210,
  151584. 50,
  151585. 178,
  151586. 114,
  151587. 242,
  151588. 10,
  151589. 138,
  151590. 74,
  151591. 202,
  151592. 42,
  151593. 170,
  151594. 106,
  151595. 234,
  151596. 26,
  151597. 154,
  151598. 90,
  151599. 218,
  151600. 58,
  151601. 186,
  151602. 122,
  151603. 250,
  151604. 6,
  151605. 134,
  151606. 70,
  151607. 198,
  151608. 38,
  151609. 166,
  151610. 102,
  151611. 230,
  151612. 22,
  151613. 150,
  151614. 86,
  151615. 214,
  151616. 54,
  151617. 182,
  151618. 118,
  151619. 246,
  151620. 14,
  151621. 142,
  151622. 78,
  151623. 206,
  151624. 46,
  151625. 174,
  151626. 110,
  151627. 238,
  151628. 30,
  151629. 158,
  151630. 94,
  151631. 222,
  151632. 62,
  151633. 190,
  151634. 126,
  151635. 254,
  151636. 1,
  151637. 129,
  151638. 65,
  151639. 193,
  151640. 33,
  151641. 161,
  151642. 97,
  151643. 225,
  151644. 17,
  151645. 145,
  151646. 81,
  151647. 209,
  151648. 49,
  151649. 177,
  151650. 113,
  151651. 241,
  151652. 9,
  151653. 137,
  151654. 73,
  151655. 201,
  151656. 41,
  151657. 169,
  151658. 105,
  151659. 233,
  151660. 25,
  151661. 153,
  151662. 89,
  151663. 217,
  151664. 57,
  151665. 185,
  151666. 121,
  151667. 249,
  151668. 5,
  151669. 133,
  151670. 69,
  151671. 197,
  151672. 37,
  151673. 165,
  151674. 101,
  151675. 229,
  151676. 21,
  151677. 149,
  151678. 85,
  151679. 213,
  151680. 53,
  151681. 181,
  151682. 117,
  151683. 245,
  151684. 13,
  151685. 141,
  151686. 77,
  151687. 205,
  151688. 45,
  151689. 173,
  151690. 109,
  151691. 237,
  151692. 29,
  151693. 157,
  151694. 93,
  151695. 221,
  151696. 61,
  151697. 189,
  151698. 125,
  151699. 253,
  151700. 19,
  151701. 275,
  151702. 147,
  151703. 403,
  151704. 83,
  151705. 339,
  151706. 211,
  151707. 467,
  151708. 51,
  151709. 307,
  151710. 179,
  151711. 435,
  151712. 115,
  151713. 371,
  151714. 243,
  151715. 499,
  151716. 11,
  151717. 267,
  151718. 139,
  151719. 395,
  151720. 75,
  151721. 331,
  151722. 203,
  151723. 459,
  151724. 43,
  151725. 299,
  151726. 171,
  151727. 427,
  151728. 107,
  151729. 363,
  151730. 235,
  151731. 491,
  151732. 27,
  151733. 283,
  151734. 155,
  151735. 411,
  151736. 91,
  151737. 347,
  151738. 219,
  151739. 475,
  151740. 59,
  151741. 315,
  151742. 187,
  151743. 443,
  151744. 123,
  151745. 379,
  151746. 251,
  151747. 507,
  151748. 7,
  151749. 263,
  151750. 135,
  151751. 391,
  151752. 71,
  151753. 327,
  151754. 199,
  151755. 455,
  151756. 39,
  151757. 295,
  151758. 167,
  151759. 423,
  151760. 103,
  151761. 359,
  151762. 231,
  151763. 487,
  151764. 23,
  151765. 279,
  151766. 151,
  151767. 407,
  151768. 87,
  151769. 343,
  151770. 215,
  151771. 471,
  151772. 55,
  151773. 311,
  151774. 183,
  151775. 439,
  151776. 119,
  151777. 375,
  151778. 247,
  151779. 503,
  151780. 15,
  151781. 271,
  151782. 143,
  151783. 399,
  151784. 79,
  151785. 335,
  151786. 207,
  151787. 463,
  151788. 47,
  151789. 303,
  151790. 175,
  151791. 431,
  151792. 111,
  151793. 367,
  151794. 239,
  151795. 495,
  151796. 31,
  151797. 287,
  151798. 159,
  151799. 415,
  151800. 95,
  151801. 351,
  151802. 223,
  151803. 479,
  151804. 63,
  151805. 319,
  151806. 191,
  151807. 447,
  151808. 127,
  151809. 383,
  151810. 255,
  151811. 511,
  151812. 0,
  151813. 64,
  151814. 32,
  151815. 96,
  151816. 16,
  151817. 80,
  151818. 48,
  151819. 112,
  151820. 8,
  151821. 72,
  151822. 40,
  151823. 104,
  151824. 24,
  151825. 88,
  151826. 56,
  151827. 120,
  151828. 4,
  151829. 68,
  151830. 36,
  151831. 100,
  151832. 20,
  151833. 84,
  151834. 52,
  151835. 116,
  151836. 3,
  151837. 131,
  151838. 67,
  151839. 195,
  151840. 35,
  151841. 163,
  151842. 99,
  151843. 227
  151844. ];
  151845. var static_ltree2_second_part = extractArray([[144, 8], [112, 9], [24, 7], [8, 8]]);
  151846. StaticTree.static_ltree = flatArray(static_ltree2_first_part.map((value, index2) => [value, static_ltree2_second_part[index2]]));
  151847. var static_dtree_first_part = [0, 16, 8, 24, 4, 20, 12, 28, 2, 18, 10, 26, 6, 22, 14, 30, 1, 17, 9, 25, 5, 21, 13, 29, 3, 19, 11, 27, 7, 23];
  151848. var static_dtree_second_part = extractArray([[30, 5]]);
  151849. StaticTree.static_dtree = flatArray(static_dtree_first_part.map((value, index2) => [value, static_dtree_second_part[index2]]));
  151850. StaticTree.static_l_desc = new StaticTree(StaticTree.static_ltree, Tree.extra_lbits, LITERALS + 1, L_CODES, MAX_BITS$1);
  151851. StaticTree.static_d_desc = new StaticTree(StaticTree.static_dtree, Tree.extra_dbits, 0, D_CODES, MAX_BITS$1);
  151852. StaticTree.static_bl_desc = new StaticTree(null, Tree.extra_blbits, 0, BL_CODES, MAX_BL_BITS);
  151853. var MAX_MEM_LEVEL = 9;
  151854. var DEF_MEM_LEVEL = 8;
  151855. function Config(good_length, max_lazy, nice_length, max_chain, func) {
  151856. const that = this;
  151857. that.good_length = good_length;
  151858. that.max_lazy = max_lazy;
  151859. that.nice_length = nice_length;
  151860. that.max_chain = max_chain;
  151861. that.func = func;
  151862. }
  151863. var STORED$1 = 0;
  151864. var FAST = 1;
  151865. var SLOW = 2;
  151866. var config_table = [
  151867. new Config(0, 0, 0, 0, STORED$1),
  151868. new Config(4, 4, 8, 4, FAST),
  151869. new Config(4, 5, 16, 8, FAST),
  151870. new Config(4, 6, 32, 32, FAST),
  151871. new Config(4, 4, 16, 16, SLOW),
  151872. new Config(8, 16, 32, 32, SLOW),
  151873. new Config(8, 16, 128, 128, SLOW),
  151874. new Config(8, 32, 128, 256, SLOW),
  151875. new Config(32, 128, 258, 1024, SLOW),
  151876. new Config(32, 258, 258, 4096, SLOW)
  151877. ];
  151878. var z_errmsg = [
  151879. "need dictionary",
  151880. "stream end",
  151881. "",
  151882. "",
  151883. "stream error",
  151884. "data error",
  151885. "",
  151886. "buffer error",
  151887. "",
  151888. ""
  151889. ];
  151890. var NeedMore = 0;
  151891. var BlockDone = 1;
  151892. var FinishStarted = 2;
  151893. var FinishDone = 3;
  151894. var PRESET_DICT$1 = 32;
  151895. var INIT_STATE = 42;
  151896. var BUSY_STATE = 113;
  151897. var FINISH_STATE = 666;
  151898. var Z_DEFLATED$1 = 8;
  151899. var STORED_BLOCK = 0;
  151900. var STATIC_TREES = 1;
  151901. var DYN_TREES = 2;
  151902. var MIN_MATCH = 3;
  151903. var MAX_MATCH = 258;
  151904. var MIN_LOOKAHEAD = MAX_MATCH + MIN_MATCH + 1;
  151905. function smaller(tree, n2, m, depth) {
  151906. const tn2 = tree[n2 * 2];
  151907. const tm2 = tree[m * 2];
  151908. return tn2 < tm2 || tn2 == tm2 && depth[n2] <= depth[m];
  151909. }
  151910. function Deflate$1() {
  151911. const that = this;
  151912. let strm;
  151913. let status;
  151914. let pending_buf_size;
  151915. let last_flush;
  151916. let w_size;
  151917. let w_bits;
  151918. let w_mask;
  151919. let win;
  151920. let window_size;
  151921. let prev;
  151922. let head;
  151923. let ins_h;
  151924. let hash_size;
  151925. let hash_bits;
  151926. let hash_mask;
  151927. let hash_shift;
  151928. let block_start;
  151929. let match_length;
  151930. let prev_match;
  151931. let match_available;
  151932. let strstart;
  151933. let match_start;
  151934. let lookahead;
  151935. let prev_length;
  151936. let max_chain_length;
  151937. let max_lazy_match;
  151938. let level;
  151939. let strategy;
  151940. let good_match;
  151941. let nice_match;
  151942. let dyn_ltree;
  151943. let dyn_dtree;
  151944. let bl_tree;
  151945. const l_desc = new Tree();
  151946. const d_desc = new Tree();
  151947. const bl_desc = new Tree();
  151948. that.depth = [];
  151949. let lit_bufsize;
  151950. let last_lit;
  151951. let matches;
  151952. let last_eob_len;
  151953. let bi_buf;
  151954. let bi_valid;
  151955. that.bl_count = [];
  151956. that.heap = [];
  151957. dyn_ltree = [];
  151958. dyn_dtree = [];
  151959. bl_tree = [];
  151960. function lm_init() {
  151961. window_size = 2 * w_size;
  151962. head[hash_size - 1] = 0;
  151963. for (let i2 = 0; i2 < hash_size - 1; i2++) {
  151964. head[i2] = 0;
  151965. }
  151966. max_lazy_match = config_table[level].max_lazy;
  151967. good_match = config_table[level].good_length;
  151968. nice_match = config_table[level].nice_length;
  151969. max_chain_length = config_table[level].max_chain;
  151970. strstart = 0;
  151971. block_start = 0;
  151972. lookahead = 0;
  151973. match_length = prev_length = MIN_MATCH - 1;
  151974. match_available = 0;
  151975. ins_h = 0;
  151976. }
  151977. function init_block() {
  151978. let i2;
  151979. for (i2 = 0; i2 < L_CODES; i2++)
  151980. dyn_ltree[i2 * 2] = 0;
  151981. for (i2 = 0; i2 < D_CODES; i2++)
  151982. dyn_dtree[i2 * 2] = 0;
  151983. for (i2 = 0; i2 < BL_CODES; i2++)
  151984. bl_tree[i2 * 2] = 0;
  151985. dyn_ltree[END_BLOCK * 2] = 1;
  151986. that.opt_len = that.static_len = 0;
  151987. last_lit = matches = 0;
  151988. }
  151989. function tr_init() {
  151990. l_desc.dyn_tree = dyn_ltree;
  151991. l_desc.stat_desc = StaticTree.static_l_desc;
  151992. d_desc.dyn_tree = dyn_dtree;
  151993. d_desc.stat_desc = StaticTree.static_d_desc;
  151994. bl_desc.dyn_tree = bl_tree;
  151995. bl_desc.stat_desc = StaticTree.static_bl_desc;
  151996. bi_buf = 0;
  151997. bi_valid = 0;
  151998. last_eob_len = 8;
  151999. init_block();
  152000. }
  152001. that.pqdownheap = function(tree, k) {
  152002. const heap = that.heap;
  152003. const v7 = heap[k];
  152004. let j = k << 1;
  152005. while (j <= that.heap_len) {
  152006. if (j < that.heap_len && smaller(tree, heap[j + 1], heap[j], that.depth)) {
  152007. j++;
  152008. }
  152009. if (smaller(tree, v7, heap[j], that.depth))
  152010. break;
  152011. heap[k] = heap[j];
  152012. k = j;
  152013. j <<= 1;
  152014. }
  152015. heap[k] = v7;
  152016. };
  152017. function scan_tree(tree, max_code) {
  152018. let prevlen = -1;
  152019. let curlen;
  152020. let nextlen = tree[0 * 2 + 1];
  152021. let count = 0;
  152022. let max_count = 7;
  152023. let min_count = 4;
  152024. if (nextlen === 0) {
  152025. max_count = 138;
  152026. min_count = 3;
  152027. }
  152028. tree[(max_code + 1) * 2 + 1] = 65535;
  152029. for (let n2 = 0; n2 <= max_code; n2++) {
  152030. curlen = nextlen;
  152031. nextlen = tree[(n2 + 1) * 2 + 1];
  152032. if (++count < max_count && curlen == nextlen) {
  152033. continue;
  152034. } else if (count < min_count) {
  152035. bl_tree[curlen * 2] += count;
  152036. } else if (curlen !== 0) {
  152037. if (curlen != prevlen)
  152038. bl_tree[curlen * 2]++;
  152039. bl_tree[REP_3_6 * 2]++;
  152040. } else if (count <= 10) {
  152041. bl_tree[REPZ_3_10 * 2]++;
  152042. } else {
  152043. bl_tree[REPZ_11_138 * 2]++;
  152044. }
  152045. count = 0;
  152046. prevlen = curlen;
  152047. if (nextlen === 0) {
  152048. max_count = 138;
  152049. min_count = 3;
  152050. } else if (curlen == nextlen) {
  152051. max_count = 6;
  152052. min_count = 3;
  152053. } else {
  152054. max_count = 7;
  152055. min_count = 4;
  152056. }
  152057. }
  152058. }
  152059. function build_bl_tree() {
  152060. let max_blindex;
  152061. scan_tree(dyn_ltree, l_desc.max_code);
  152062. scan_tree(dyn_dtree, d_desc.max_code);
  152063. bl_desc.build_tree(that);
  152064. for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) {
  152065. if (bl_tree[Tree.bl_order[max_blindex] * 2 + 1] !== 0)
  152066. break;
  152067. }
  152068. that.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4;
  152069. return max_blindex;
  152070. }
  152071. function put_byte(p2) {
  152072. that.pending_buf[that.pending++] = p2;
  152073. }
  152074. function put_short(w) {
  152075. put_byte(w & 255);
  152076. put_byte(w >>> 8 & 255);
  152077. }
  152078. function putShortMSB(b) {
  152079. put_byte(b >> 8 & 255);
  152080. put_byte(b & 255 & 255);
  152081. }
  152082. function send_bits(value, length3) {
  152083. let val;
  152084. const len = length3;
  152085. if (bi_valid > Buf_size - len) {
  152086. val = value;
  152087. bi_buf |= val << bi_valid & 65535;
  152088. put_short(bi_buf);
  152089. bi_buf = val >>> Buf_size - bi_valid;
  152090. bi_valid += len - Buf_size;
  152091. } else {
  152092. bi_buf |= value << bi_valid & 65535;
  152093. bi_valid += len;
  152094. }
  152095. }
  152096. function send_code(c14, tree) {
  152097. const c22 = c14 * 2;
  152098. send_bits(tree[c22] & 65535, tree[c22 + 1] & 65535);
  152099. }
  152100. function send_tree(tree, max_code) {
  152101. let n2;
  152102. let prevlen = -1;
  152103. let curlen;
  152104. let nextlen = tree[0 * 2 + 1];
  152105. let count = 0;
  152106. let max_count = 7;
  152107. let min_count = 4;
  152108. if (nextlen === 0) {
  152109. max_count = 138;
  152110. min_count = 3;
  152111. }
  152112. for (n2 = 0; n2 <= max_code; n2++) {
  152113. curlen = nextlen;
  152114. nextlen = tree[(n2 + 1) * 2 + 1];
  152115. if (++count < max_count && curlen == nextlen) {
  152116. continue;
  152117. } else if (count < min_count) {
  152118. do {
  152119. send_code(curlen, bl_tree);
  152120. } while (--count !== 0);
  152121. } else if (curlen !== 0) {
  152122. if (curlen != prevlen) {
  152123. send_code(curlen, bl_tree);
  152124. count--;
  152125. }
  152126. send_code(REP_3_6, bl_tree);
  152127. send_bits(count - 3, 2);
  152128. } else if (count <= 10) {
  152129. send_code(REPZ_3_10, bl_tree);
  152130. send_bits(count - 3, 3);
  152131. } else {
  152132. send_code(REPZ_11_138, bl_tree);
  152133. send_bits(count - 11, 7);
  152134. }
  152135. count = 0;
  152136. prevlen = curlen;
  152137. if (nextlen === 0) {
  152138. max_count = 138;
  152139. min_count = 3;
  152140. } else if (curlen == nextlen) {
  152141. max_count = 6;
  152142. min_count = 3;
  152143. } else {
  152144. max_count = 7;
  152145. min_count = 4;
  152146. }
  152147. }
  152148. }
  152149. function send_all_trees(lcodes, dcodes, blcodes) {
  152150. let rank;
  152151. send_bits(lcodes - 257, 5);
  152152. send_bits(dcodes - 1, 5);
  152153. send_bits(blcodes - 4, 4);
  152154. for (rank = 0; rank < blcodes; rank++) {
  152155. send_bits(bl_tree[Tree.bl_order[rank] * 2 + 1], 3);
  152156. }
  152157. send_tree(dyn_ltree, lcodes - 1);
  152158. send_tree(dyn_dtree, dcodes - 1);
  152159. }
  152160. function bi_flush() {
  152161. if (bi_valid == 16) {
  152162. put_short(bi_buf);
  152163. bi_buf = 0;
  152164. bi_valid = 0;
  152165. } else if (bi_valid >= 8) {
  152166. put_byte(bi_buf & 255);
  152167. bi_buf >>>= 8;
  152168. bi_valid -= 8;
  152169. }
  152170. }
  152171. function _tr_align() {
  152172. send_bits(STATIC_TREES << 1, 3);
  152173. send_code(END_BLOCK, StaticTree.static_ltree);
  152174. bi_flush();
  152175. if (1 + last_eob_len + 10 - bi_valid < 9) {
  152176. send_bits(STATIC_TREES << 1, 3);
  152177. send_code(END_BLOCK, StaticTree.static_ltree);
  152178. bi_flush();
  152179. }
  152180. last_eob_len = 7;
  152181. }
  152182. function _tr_tally(dist, lc) {
  152183. let out_length, in_length, dcode;
  152184. that.dist_buf[last_lit] = dist;
  152185. that.lc_buf[last_lit] = lc & 255;
  152186. last_lit++;
  152187. if (dist === 0) {
  152188. dyn_ltree[lc * 2]++;
  152189. } else {
  152190. matches++;
  152191. dist--;
  152192. dyn_ltree[(Tree._length_code[lc] + LITERALS + 1) * 2]++;
  152193. dyn_dtree[Tree.d_code(dist) * 2]++;
  152194. }
  152195. if ((last_lit & 8191) === 0 && level > 2) {
  152196. out_length = last_lit * 8;
  152197. in_length = strstart - block_start;
  152198. for (dcode = 0; dcode < D_CODES; dcode++) {
  152199. out_length += dyn_dtree[dcode * 2] * (5 + Tree.extra_dbits[dcode]);
  152200. }
  152201. out_length >>>= 3;
  152202. if (matches < Math.floor(last_lit / 2) && out_length < Math.floor(in_length / 2))
  152203. return true;
  152204. }
  152205. return last_lit == lit_bufsize - 1;
  152206. }
  152207. function compress_block(ltree, dtree) {
  152208. let dist;
  152209. let lc;
  152210. let lx = 0;
  152211. let code;
  152212. let extra;
  152213. if (last_lit !== 0) {
  152214. do {
  152215. dist = that.dist_buf[lx];
  152216. lc = that.lc_buf[lx];
  152217. lx++;
  152218. if (dist === 0) {
  152219. send_code(lc, ltree);
  152220. } else {
  152221. code = Tree._length_code[lc];
  152222. send_code(code + LITERALS + 1, ltree);
  152223. extra = Tree.extra_lbits[code];
  152224. if (extra !== 0) {
  152225. lc -= Tree.base_length[code];
  152226. send_bits(lc, extra);
  152227. }
  152228. dist--;
  152229. code = Tree.d_code(dist);
  152230. send_code(code, dtree);
  152231. extra = Tree.extra_dbits[code];
  152232. if (extra !== 0) {
  152233. dist -= Tree.base_dist[code];
  152234. send_bits(dist, extra);
  152235. }
  152236. }
  152237. } while (lx < last_lit);
  152238. }
  152239. send_code(END_BLOCK, ltree);
  152240. last_eob_len = ltree[END_BLOCK * 2 + 1];
  152241. }
  152242. function bi_windup() {
  152243. if (bi_valid > 8) {
  152244. put_short(bi_buf);
  152245. } else if (bi_valid > 0) {
  152246. put_byte(bi_buf & 255);
  152247. }
  152248. bi_buf = 0;
  152249. bi_valid = 0;
  152250. }
  152251. function copy_block(buf, len, header) {
  152252. bi_windup();
  152253. last_eob_len = 8;
  152254. if (header) {
  152255. put_short(len);
  152256. put_short(~len);
  152257. }
  152258. that.pending_buf.set(win.subarray(buf, buf + len), that.pending);
  152259. that.pending += len;
  152260. }
  152261. function _tr_stored_block(buf, stored_len, eof) {
  152262. send_bits((STORED_BLOCK << 1) + (eof ? 1 : 0), 3);
  152263. copy_block(buf, stored_len, true);
  152264. }
  152265. function _tr_flush_block(buf, stored_len, eof) {
  152266. let opt_lenb, static_lenb;
  152267. let max_blindex = 0;
  152268. if (level > 0) {
  152269. l_desc.build_tree(that);
  152270. d_desc.build_tree(that);
  152271. max_blindex = build_bl_tree();
  152272. opt_lenb = that.opt_len + 3 + 7 >>> 3;
  152273. static_lenb = that.static_len + 3 + 7 >>> 3;
  152274. if (static_lenb <= opt_lenb)
  152275. opt_lenb = static_lenb;
  152276. } else {
  152277. opt_lenb = static_lenb = stored_len + 5;
  152278. }
  152279. if (stored_len + 4 <= opt_lenb && buf != -1) {
  152280. _tr_stored_block(buf, stored_len, eof);
  152281. } else if (static_lenb == opt_lenb) {
  152282. send_bits((STATIC_TREES << 1) + (eof ? 1 : 0), 3);
  152283. compress_block(StaticTree.static_ltree, StaticTree.static_dtree);
  152284. } else {
  152285. send_bits((DYN_TREES << 1) + (eof ? 1 : 0), 3);
  152286. send_all_trees(l_desc.max_code + 1, d_desc.max_code + 1, max_blindex + 1);
  152287. compress_block(dyn_ltree, dyn_dtree);
  152288. }
  152289. init_block();
  152290. if (eof) {
  152291. bi_windup();
  152292. }
  152293. }
  152294. function flush_block_only(eof) {
  152295. _tr_flush_block(block_start >= 0 ? block_start : -1, strstart - block_start, eof);
  152296. block_start = strstart;
  152297. strm.flush_pending();
  152298. }
  152299. function fill_window() {
  152300. let n2, m;
  152301. let p2;
  152302. let more;
  152303. do {
  152304. more = window_size - lookahead - strstart;
  152305. if (more === 0 && strstart === 0 && lookahead === 0) {
  152306. more = w_size;
  152307. } else if (more == -1) {
  152308. more--;
  152309. } else if (strstart >= w_size + w_size - MIN_LOOKAHEAD) {
  152310. win.set(win.subarray(w_size, w_size + w_size), 0);
  152311. match_start -= w_size;
  152312. strstart -= w_size;
  152313. block_start -= w_size;
  152314. n2 = hash_size;
  152315. p2 = n2;
  152316. do {
  152317. m = head[--p2] & 65535;
  152318. head[p2] = m >= w_size ? m - w_size : 0;
  152319. } while (--n2 !== 0);
  152320. n2 = w_size;
  152321. p2 = n2;
  152322. do {
  152323. m = prev[--p2] & 65535;
  152324. prev[p2] = m >= w_size ? m - w_size : 0;
  152325. } while (--n2 !== 0);
  152326. more += w_size;
  152327. }
  152328. if (strm.avail_in === 0)
  152329. return;
  152330. n2 = strm.read_buf(win, strstart + lookahead, more);
  152331. lookahead += n2;
  152332. if (lookahead >= MIN_MATCH) {
  152333. ins_h = win[strstart] & 255;
  152334. ins_h = (ins_h << hash_shift ^ win[strstart + 1] & 255) & hash_mask;
  152335. }
  152336. } while (lookahead < MIN_LOOKAHEAD && strm.avail_in !== 0);
  152337. }
  152338. function deflate_stored(flush) {
  152339. let max_block_size = 65535;
  152340. let max_start;
  152341. if (max_block_size > pending_buf_size - 5) {
  152342. max_block_size = pending_buf_size - 5;
  152343. }
  152344. while (true) {
  152345. if (lookahead <= 1) {
  152346. fill_window();
  152347. if (lookahead === 0 && flush == Z_NO_FLUSH$1)
  152348. return NeedMore;
  152349. if (lookahead === 0)
  152350. break;
  152351. }
  152352. strstart += lookahead;
  152353. lookahead = 0;
  152354. max_start = block_start + max_block_size;
  152355. if (strstart === 0 || strstart >= max_start) {
  152356. lookahead = strstart - max_start;
  152357. strstart = max_start;
  152358. flush_block_only(false);
  152359. if (strm.avail_out === 0)
  152360. return NeedMore;
  152361. }
  152362. if (strstart - block_start >= w_size - MIN_LOOKAHEAD) {
  152363. flush_block_only(false);
  152364. if (strm.avail_out === 0)
  152365. return NeedMore;
  152366. }
  152367. }
  152368. flush_block_only(flush == Z_FINISH$1);
  152369. if (strm.avail_out === 0)
  152370. return flush == Z_FINISH$1 ? FinishStarted : NeedMore;
  152371. return flush == Z_FINISH$1 ? FinishDone : BlockDone;
  152372. }
  152373. function longest_match(cur_match) {
  152374. let chain_length = max_chain_length;
  152375. let scan = strstart;
  152376. let match;
  152377. let len;
  152378. let best_len = prev_length;
  152379. const limit = strstart > w_size - MIN_LOOKAHEAD ? strstart - (w_size - MIN_LOOKAHEAD) : 0;
  152380. let _nice_match = nice_match;
  152381. const wmask = w_mask;
  152382. const strend = strstart + MAX_MATCH;
  152383. let scan_end1 = win[scan + best_len - 1];
  152384. let scan_end = win[scan + best_len];
  152385. if (prev_length >= good_match) {
  152386. chain_length >>= 2;
  152387. }
  152388. if (_nice_match > lookahead)
  152389. _nice_match = lookahead;
  152390. do {
  152391. match = cur_match;
  152392. if (win[match + best_len] != scan_end || win[match + best_len - 1] != scan_end1 || win[match] != win[scan] || win[++match] != win[scan + 1])
  152393. continue;
  152394. scan += 2;
  152395. match++;
  152396. do {
  152397. } while (win[++scan] == win[++match] && win[++scan] == win[++match] && win[++scan] == win[++match] && win[++scan] == win[++match] && win[++scan] == win[++match] && win[++scan] == win[++match] && win[++scan] == win[++match] && win[++scan] == win[++match] && scan < strend);
  152398. len = MAX_MATCH - (strend - scan);
  152399. scan = strend - MAX_MATCH;
  152400. if (len > best_len) {
  152401. match_start = cur_match;
  152402. best_len = len;
  152403. if (len >= _nice_match)
  152404. break;
  152405. scan_end1 = win[scan + best_len - 1];
  152406. scan_end = win[scan + best_len];
  152407. }
  152408. } while ((cur_match = prev[cur_match & wmask] & 65535) > limit && --chain_length !== 0);
  152409. if (best_len <= lookahead)
  152410. return best_len;
  152411. return lookahead;
  152412. }
  152413. function deflate_fast(flush) {
  152414. let hash_head = 0;
  152415. let bflush;
  152416. while (true) {
  152417. if (lookahead < MIN_LOOKAHEAD) {
  152418. fill_window();
  152419. if (lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH$1) {
  152420. return NeedMore;
  152421. }
  152422. if (lookahead === 0)
  152423. break;
  152424. }
  152425. if (lookahead >= MIN_MATCH) {
  152426. ins_h = (ins_h << hash_shift ^ win[strstart + (MIN_MATCH - 1)] & 255) & hash_mask;
  152427. hash_head = head[ins_h] & 65535;
  152428. prev[strstart & w_mask] = head[ins_h];
  152429. head[ins_h] = strstart;
  152430. }
  152431. if (hash_head !== 0 && (strstart - hash_head & 65535) <= w_size - MIN_LOOKAHEAD) {
  152432. if (strategy != Z_HUFFMAN_ONLY) {
  152433. match_length = longest_match(hash_head);
  152434. }
  152435. }
  152436. if (match_length >= MIN_MATCH) {
  152437. bflush = _tr_tally(strstart - match_start, match_length - MIN_MATCH);
  152438. lookahead -= match_length;
  152439. if (match_length <= max_lazy_match && lookahead >= MIN_MATCH) {
  152440. match_length--;
  152441. do {
  152442. strstart++;
  152443. ins_h = (ins_h << hash_shift ^ win[strstart + (MIN_MATCH - 1)] & 255) & hash_mask;
  152444. hash_head = head[ins_h] & 65535;
  152445. prev[strstart & w_mask] = head[ins_h];
  152446. head[ins_h] = strstart;
  152447. } while (--match_length !== 0);
  152448. strstart++;
  152449. } else {
  152450. strstart += match_length;
  152451. match_length = 0;
  152452. ins_h = win[strstart] & 255;
  152453. ins_h = (ins_h << hash_shift ^ win[strstart + 1] & 255) & hash_mask;
  152454. }
  152455. } else {
  152456. bflush = _tr_tally(0, win[strstart] & 255);
  152457. lookahead--;
  152458. strstart++;
  152459. }
  152460. if (bflush) {
  152461. flush_block_only(false);
  152462. if (strm.avail_out === 0)
  152463. return NeedMore;
  152464. }
  152465. }
  152466. flush_block_only(flush == Z_FINISH$1);
  152467. if (strm.avail_out === 0) {
  152468. if (flush == Z_FINISH$1)
  152469. return FinishStarted;
  152470. else
  152471. return NeedMore;
  152472. }
  152473. return flush == Z_FINISH$1 ? FinishDone : BlockDone;
  152474. }
  152475. function deflate_slow(flush) {
  152476. let hash_head = 0;
  152477. let bflush;
  152478. let max_insert;
  152479. while (true) {
  152480. if (lookahead < MIN_LOOKAHEAD) {
  152481. fill_window();
  152482. if (lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH$1) {
  152483. return NeedMore;
  152484. }
  152485. if (lookahead === 0)
  152486. break;
  152487. }
  152488. if (lookahead >= MIN_MATCH) {
  152489. ins_h = (ins_h << hash_shift ^ win[strstart + (MIN_MATCH - 1)] & 255) & hash_mask;
  152490. hash_head = head[ins_h] & 65535;
  152491. prev[strstart & w_mask] = head[ins_h];
  152492. head[ins_h] = strstart;
  152493. }
  152494. prev_length = match_length;
  152495. prev_match = match_start;
  152496. match_length = MIN_MATCH - 1;
  152497. if (hash_head !== 0 && prev_length < max_lazy_match && (strstart - hash_head & 65535) <= w_size - MIN_LOOKAHEAD) {
  152498. if (strategy != Z_HUFFMAN_ONLY) {
  152499. match_length = longest_match(hash_head);
  152500. }
  152501. if (match_length <= 5 && (strategy == Z_FILTERED || match_length == MIN_MATCH && strstart - match_start > 4096)) {
  152502. match_length = MIN_MATCH - 1;
  152503. }
  152504. }
  152505. if (prev_length >= MIN_MATCH && match_length <= prev_length) {
  152506. max_insert = strstart + lookahead - MIN_MATCH;
  152507. bflush = _tr_tally(strstart - 1 - prev_match, prev_length - MIN_MATCH);
  152508. lookahead -= prev_length - 1;
  152509. prev_length -= 2;
  152510. do {
  152511. if (++strstart <= max_insert) {
  152512. ins_h = (ins_h << hash_shift ^ win[strstart + (MIN_MATCH - 1)] & 255) & hash_mask;
  152513. hash_head = head[ins_h] & 65535;
  152514. prev[strstart & w_mask] = head[ins_h];
  152515. head[ins_h] = strstart;
  152516. }
  152517. } while (--prev_length !== 0);
  152518. match_available = 0;
  152519. match_length = MIN_MATCH - 1;
  152520. strstart++;
  152521. if (bflush) {
  152522. flush_block_only(false);
  152523. if (strm.avail_out === 0)
  152524. return NeedMore;
  152525. }
  152526. } else if (match_available !== 0) {
  152527. bflush = _tr_tally(0, win[strstart - 1] & 255);
  152528. if (bflush) {
  152529. flush_block_only(false);
  152530. }
  152531. strstart++;
  152532. lookahead--;
  152533. if (strm.avail_out === 0)
  152534. return NeedMore;
  152535. } else {
  152536. match_available = 1;
  152537. strstart++;
  152538. lookahead--;
  152539. }
  152540. }
  152541. if (match_available !== 0) {
  152542. bflush = _tr_tally(0, win[strstart - 1] & 255);
  152543. match_available = 0;
  152544. }
  152545. flush_block_only(flush == Z_FINISH$1);
  152546. if (strm.avail_out === 0) {
  152547. if (flush == Z_FINISH$1)
  152548. return FinishStarted;
  152549. else
  152550. return NeedMore;
  152551. }
  152552. return flush == Z_FINISH$1 ? FinishDone : BlockDone;
  152553. }
  152554. function deflateReset(strm2) {
  152555. strm2.total_in = strm2.total_out = 0;
  152556. strm2.msg = null;
  152557. that.pending = 0;
  152558. that.pending_out = 0;
  152559. status = BUSY_STATE;
  152560. last_flush = Z_NO_FLUSH$1;
  152561. tr_init();
  152562. lm_init();
  152563. return Z_OK$1;
  152564. }
  152565. that.deflateInit = function(strm2, _level, bits, _method, memLevel, _strategy) {
  152566. if (!_method)
  152567. _method = Z_DEFLATED$1;
  152568. if (!memLevel)
  152569. memLevel = DEF_MEM_LEVEL;
  152570. if (!_strategy)
  152571. _strategy = Z_DEFAULT_STRATEGY;
  152572. strm2.msg = null;
  152573. if (_level == Z_DEFAULT_COMPRESSION)
  152574. _level = 6;
  152575. if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || _method != Z_DEFLATED$1 || bits < 9 || bits > 15 || _level < 0 || _level > 9 || _strategy < 0 || _strategy > Z_HUFFMAN_ONLY) {
  152576. return Z_STREAM_ERROR$1;
  152577. }
  152578. strm2.dstate = that;
  152579. w_bits = bits;
  152580. w_size = 1 << w_bits;
  152581. w_mask = w_size - 1;
  152582. hash_bits = memLevel + 7;
  152583. hash_size = 1 << hash_bits;
  152584. hash_mask = hash_size - 1;
  152585. hash_shift = Math.floor((hash_bits + MIN_MATCH - 1) / MIN_MATCH);
  152586. win = new Uint8Array(w_size * 2);
  152587. prev = [];
  152588. head = [];
  152589. lit_bufsize = 1 << memLevel + 6;
  152590. that.pending_buf = new Uint8Array(lit_bufsize * 4);
  152591. pending_buf_size = lit_bufsize * 4;
  152592. that.dist_buf = new Uint16Array(lit_bufsize);
  152593. that.lc_buf = new Uint8Array(lit_bufsize);
  152594. level = _level;
  152595. strategy = _strategy;
  152596. return deflateReset(strm2);
  152597. };
  152598. that.deflateEnd = function() {
  152599. if (status != INIT_STATE && status != BUSY_STATE && status != FINISH_STATE) {
  152600. return Z_STREAM_ERROR$1;
  152601. }
  152602. that.lc_buf = null;
  152603. that.dist_buf = null;
  152604. that.pending_buf = null;
  152605. head = null;
  152606. prev = null;
  152607. win = null;
  152608. that.dstate = null;
  152609. return status == BUSY_STATE ? Z_DATA_ERROR$1 : Z_OK$1;
  152610. };
  152611. that.deflateParams = function(strm2, _level, _strategy) {
  152612. let err = Z_OK$1;
  152613. if (_level == Z_DEFAULT_COMPRESSION) {
  152614. _level = 6;
  152615. }
  152616. if (_level < 0 || _level > 9 || _strategy < 0 || _strategy > Z_HUFFMAN_ONLY) {
  152617. return Z_STREAM_ERROR$1;
  152618. }
  152619. if (config_table[level].func != config_table[_level].func && strm2.total_in !== 0) {
  152620. err = strm2.deflate(Z_PARTIAL_FLUSH);
  152621. }
  152622. if (level != _level) {
  152623. level = _level;
  152624. max_lazy_match = config_table[level].max_lazy;
  152625. good_match = config_table[level].good_length;
  152626. nice_match = config_table[level].nice_length;
  152627. max_chain_length = config_table[level].max_chain;
  152628. }
  152629. strategy = _strategy;
  152630. return err;
  152631. };
  152632. that.deflateSetDictionary = function(strm2, dictionary, dictLength) {
  152633. let length3 = dictLength;
  152634. let n2, index2 = 0;
  152635. if (!dictionary || status != INIT_STATE)
  152636. return Z_STREAM_ERROR$1;
  152637. if (length3 < MIN_MATCH)
  152638. return Z_OK$1;
  152639. if (length3 > w_size - MIN_LOOKAHEAD) {
  152640. length3 = w_size - MIN_LOOKAHEAD;
  152641. index2 = dictLength - length3;
  152642. }
  152643. win.set(dictionary.subarray(index2, index2 + length3), 0);
  152644. strstart = length3;
  152645. block_start = length3;
  152646. ins_h = win[0] & 255;
  152647. ins_h = (ins_h << hash_shift ^ win[1] & 255) & hash_mask;
  152648. for (n2 = 0; n2 <= length3 - MIN_MATCH; n2++) {
  152649. ins_h = (ins_h << hash_shift ^ win[n2 + (MIN_MATCH - 1)] & 255) & hash_mask;
  152650. prev[n2 & w_mask] = head[ins_h];
  152651. head[ins_h] = n2;
  152652. }
  152653. return Z_OK$1;
  152654. };
  152655. that.deflate = function(_strm, flush) {
  152656. let i2, header, level_flags, old_flush, bstate;
  152657. if (flush > Z_FINISH$1 || flush < 0) {
  152658. return Z_STREAM_ERROR$1;
  152659. }
  152660. if (!_strm.next_out || !_strm.next_in && _strm.avail_in !== 0 || status == FINISH_STATE && flush != Z_FINISH$1) {
  152661. _strm.msg = z_errmsg[Z_NEED_DICT$1 - Z_STREAM_ERROR$1];
  152662. return Z_STREAM_ERROR$1;
  152663. }
  152664. if (_strm.avail_out === 0) {
  152665. _strm.msg = z_errmsg[Z_NEED_DICT$1 - Z_BUF_ERROR$1];
  152666. return Z_BUF_ERROR$1;
  152667. }
  152668. strm = _strm;
  152669. old_flush = last_flush;
  152670. last_flush = flush;
  152671. if (status == INIT_STATE) {
  152672. header = Z_DEFLATED$1 + (w_bits - 8 << 4) << 8;
  152673. level_flags = (level - 1 & 255) >> 1;
  152674. if (level_flags > 3)
  152675. level_flags = 3;
  152676. header |= level_flags << 6;
  152677. if (strstart !== 0)
  152678. header |= PRESET_DICT$1;
  152679. header += 31 - header % 31;
  152680. status = BUSY_STATE;
  152681. putShortMSB(header);
  152682. }
  152683. if (that.pending !== 0) {
  152684. strm.flush_pending();
  152685. if (strm.avail_out === 0) {
  152686. last_flush = -1;
  152687. return Z_OK$1;
  152688. }
  152689. } else if (strm.avail_in === 0 && flush <= old_flush && flush != Z_FINISH$1) {
  152690. strm.msg = z_errmsg[Z_NEED_DICT$1 - Z_BUF_ERROR$1];
  152691. return Z_BUF_ERROR$1;
  152692. }
  152693. if (status == FINISH_STATE && strm.avail_in !== 0) {
  152694. _strm.msg = z_errmsg[Z_NEED_DICT$1 - Z_BUF_ERROR$1];
  152695. return Z_BUF_ERROR$1;
  152696. }
  152697. if (strm.avail_in !== 0 || lookahead !== 0 || flush != Z_NO_FLUSH$1 && status != FINISH_STATE) {
  152698. bstate = -1;
  152699. switch (config_table[level].func) {
  152700. case STORED$1:
  152701. bstate = deflate_stored(flush);
  152702. break;
  152703. case FAST:
  152704. bstate = deflate_fast(flush);
  152705. break;
  152706. case SLOW:
  152707. bstate = deflate_slow(flush);
  152708. break;
  152709. }
  152710. if (bstate == FinishStarted || bstate == FinishDone) {
  152711. status = FINISH_STATE;
  152712. }
  152713. if (bstate == NeedMore || bstate == FinishStarted) {
  152714. if (strm.avail_out === 0) {
  152715. last_flush = -1;
  152716. }
  152717. return Z_OK$1;
  152718. }
  152719. if (bstate == BlockDone) {
  152720. if (flush == Z_PARTIAL_FLUSH) {
  152721. _tr_align();
  152722. } else {
  152723. _tr_stored_block(0, 0, false);
  152724. if (flush == Z_FULL_FLUSH) {
  152725. for (i2 = 0; i2 < hash_size; i2++)
  152726. head[i2] = 0;
  152727. }
  152728. }
  152729. strm.flush_pending();
  152730. if (strm.avail_out === 0) {
  152731. last_flush = -1;
  152732. return Z_OK$1;
  152733. }
  152734. }
  152735. }
  152736. if (flush != Z_FINISH$1)
  152737. return Z_OK$1;
  152738. return Z_STREAM_END$1;
  152739. };
  152740. }
  152741. function ZStream$1() {
  152742. const that = this;
  152743. that.next_in_index = 0;
  152744. that.next_out_index = 0;
  152745. that.avail_in = 0;
  152746. that.total_in = 0;
  152747. that.avail_out = 0;
  152748. that.total_out = 0;
  152749. }
  152750. ZStream$1.prototype = {
  152751. deflateInit: function(level, bits) {
  152752. const that = this;
  152753. that.dstate = new Deflate$1();
  152754. if (!bits)
  152755. bits = MAX_BITS$1;
  152756. return that.dstate.deflateInit(that, level, bits);
  152757. },
  152758. deflate: function(flush) {
  152759. const that = this;
  152760. if (!that.dstate) {
  152761. return Z_STREAM_ERROR$1;
  152762. }
  152763. return that.dstate.deflate(that, flush);
  152764. },
  152765. deflateEnd: function() {
  152766. const that = this;
  152767. if (!that.dstate)
  152768. return Z_STREAM_ERROR$1;
  152769. const ret = that.dstate.deflateEnd();
  152770. that.dstate = null;
  152771. return ret;
  152772. },
  152773. deflateParams: function(level, strategy) {
  152774. const that = this;
  152775. if (!that.dstate)
  152776. return Z_STREAM_ERROR$1;
  152777. return that.dstate.deflateParams(that, level, strategy);
  152778. },
  152779. deflateSetDictionary: function(dictionary, dictLength) {
  152780. const that = this;
  152781. if (!that.dstate)
  152782. return Z_STREAM_ERROR$1;
  152783. return that.dstate.deflateSetDictionary(that, dictionary, dictLength);
  152784. },
  152785. read_buf: function(buf, start, size) {
  152786. const that = this;
  152787. let len = that.avail_in;
  152788. if (len > size)
  152789. len = size;
  152790. if (len === 0)
  152791. return 0;
  152792. that.avail_in -= len;
  152793. buf.set(that.next_in.subarray(that.next_in_index, that.next_in_index + len), start);
  152794. that.next_in_index += len;
  152795. that.total_in += len;
  152796. return len;
  152797. },
  152798. flush_pending: function() {
  152799. const that = this;
  152800. let len = that.dstate.pending;
  152801. if (len > that.avail_out)
  152802. len = that.avail_out;
  152803. if (len === 0)
  152804. return;
  152805. that.next_out.set(that.dstate.pending_buf.subarray(that.dstate.pending_out, that.dstate.pending_out + len), that.next_out_index);
  152806. that.next_out_index += len;
  152807. that.dstate.pending_out += len;
  152808. that.total_out += len;
  152809. that.avail_out -= len;
  152810. that.dstate.pending -= len;
  152811. if (that.dstate.pending === 0) {
  152812. that.dstate.pending_out = 0;
  152813. }
  152814. }
  152815. };
  152816. function ZipDeflate(options) {
  152817. const that = this;
  152818. const z = new ZStream$1();
  152819. const bufsize = getMaximumCompressedSize$1(options && options.chunkSize ? options.chunkSize : 64 * 1024);
  152820. const flush = Z_NO_FLUSH$1;
  152821. const buf = new Uint8Array(bufsize);
  152822. let level = options ? options.level : Z_DEFAULT_COMPRESSION;
  152823. if (typeof level == "undefined")
  152824. level = Z_DEFAULT_COMPRESSION;
  152825. z.deflateInit(level);
  152826. z.next_out = buf;
  152827. that.append = function(data, onprogress) {
  152828. let err, array, lastIndex = 0, bufferIndex = 0, bufferSize = 0;
  152829. const buffers = [];
  152830. if (!data.length)
  152831. return;
  152832. z.next_in_index = 0;
  152833. z.next_in = data;
  152834. z.avail_in = data.length;
  152835. do {
  152836. z.next_out_index = 0;
  152837. z.avail_out = bufsize;
  152838. err = z.deflate(flush);
  152839. if (err != Z_OK$1)
  152840. throw new Error("deflating: " + z.msg);
  152841. if (z.next_out_index)
  152842. if (z.next_out_index == bufsize)
  152843. buffers.push(new Uint8Array(buf));
  152844. else
  152845. buffers.push(buf.slice(0, z.next_out_index));
  152846. bufferSize += z.next_out_index;
  152847. if (onprogress && z.next_in_index > 0 && z.next_in_index != lastIndex) {
  152848. onprogress(z.next_in_index);
  152849. lastIndex = z.next_in_index;
  152850. }
  152851. } while (z.avail_in > 0 || z.avail_out === 0);
  152852. if (buffers.length > 1) {
  152853. array = new Uint8Array(bufferSize);
  152854. buffers.forEach(function(chunk) {
  152855. array.set(chunk, bufferIndex);
  152856. bufferIndex += chunk.length;
  152857. });
  152858. } else {
  152859. array = buffers[0] || new Uint8Array(0);
  152860. }
  152861. return array;
  152862. };
  152863. that.flush = function() {
  152864. let err, array, bufferIndex = 0, bufferSize = 0;
  152865. const buffers = [];
  152866. do {
  152867. z.next_out_index = 0;
  152868. z.avail_out = bufsize;
  152869. err = z.deflate(Z_FINISH$1);
  152870. if (err != Z_STREAM_END$1 && err != Z_OK$1)
  152871. throw new Error("deflating: " + z.msg);
  152872. if (bufsize - z.avail_out > 0)
  152873. buffers.push(buf.slice(0, z.next_out_index));
  152874. bufferSize += z.next_out_index;
  152875. } while (z.avail_in > 0 || z.avail_out === 0);
  152876. z.deflateEnd();
  152877. array = new Uint8Array(bufferSize);
  152878. buffers.forEach(function(chunk) {
  152879. array.set(chunk, bufferIndex);
  152880. bufferIndex += chunk.length;
  152881. });
  152882. return array;
  152883. };
  152884. }
  152885. function getMaximumCompressedSize$1(uncompressedSize) {
  152886. return uncompressedSize + 5 * (Math.floor(uncompressedSize / 16383) + 1);
  152887. }
  152888. var MAX_BITS = 15;
  152889. var Z_OK = 0;
  152890. var Z_STREAM_END = 1;
  152891. var Z_NEED_DICT = 2;
  152892. var Z_STREAM_ERROR = -2;
  152893. var Z_DATA_ERROR = -3;
  152894. var Z_MEM_ERROR = -4;
  152895. var Z_BUF_ERROR = -5;
  152896. var inflate_mask = [
  152897. 0,
  152898. 1,
  152899. 3,
  152900. 7,
  152901. 15,
  152902. 31,
  152903. 63,
  152904. 127,
  152905. 255,
  152906. 511,
  152907. 1023,
  152908. 2047,
  152909. 4095,
  152910. 8191,
  152911. 16383,
  152912. 32767,
  152913. 65535
  152914. ];
  152915. var MANY = 1440;
  152916. var Z_NO_FLUSH = 0;
  152917. var Z_FINISH = 4;
  152918. var fixed_bl = 9;
  152919. var fixed_bd = 5;
  152920. var fixed_tl = [
  152921. 96,
  152922. 7,
  152923. 256,
  152924. 0,
  152925. 8,
  152926. 80,
  152927. 0,
  152928. 8,
  152929. 16,
  152930. 84,
  152931. 8,
  152932. 115,
  152933. 82,
  152934. 7,
  152935. 31,
  152936. 0,
  152937. 8,
  152938. 112,
  152939. 0,
  152940. 8,
  152941. 48,
  152942. 0,
  152943. 9,
  152944. 192,
  152945. 80,
  152946. 7,
  152947. 10,
  152948. 0,
  152949. 8,
  152950. 96,
  152951. 0,
  152952. 8,
  152953. 32,
  152954. 0,
  152955. 9,
  152956. 160,
  152957. 0,
  152958. 8,
  152959. 0,
  152960. 0,
  152961. 8,
  152962. 128,
  152963. 0,
  152964. 8,
  152965. 64,
  152966. 0,
  152967. 9,
  152968. 224,
  152969. 80,
  152970. 7,
  152971. 6,
  152972. 0,
  152973. 8,
  152974. 88,
  152975. 0,
  152976. 8,
  152977. 24,
  152978. 0,
  152979. 9,
  152980. 144,
  152981. 83,
  152982. 7,
  152983. 59,
  152984. 0,
  152985. 8,
  152986. 120,
  152987. 0,
  152988. 8,
  152989. 56,
  152990. 0,
  152991. 9,
  152992. 208,
  152993. 81,
  152994. 7,
  152995. 17,
  152996. 0,
  152997. 8,
  152998. 104,
  152999. 0,
  153000. 8,
  153001. 40,
  153002. 0,
  153003. 9,
  153004. 176,
  153005. 0,
  153006. 8,
  153007. 8,
  153008. 0,
  153009. 8,
  153010. 136,
  153011. 0,
  153012. 8,
  153013. 72,
  153014. 0,
  153015. 9,
  153016. 240,
  153017. 80,
  153018. 7,
  153019. 4,
  153020. 0,
  153021. 8,
  153022. 84,
  153023. 0,
  153024. 8,
  153025. 20,
  153026. 85,
  153027. 8,
  153028. 227,
  153029. 83,
  153030. 7,
  153031. 43,
  153032. 0,
  153033. 8,
  153034. 116,
  153035. 0,
  153036. 8,
  153037. 52,
  153038. 0,
  153039. 9,
  153040. 200,
  153041. 81,
  153042. 7,
  153043. 13,
  153044. 0,
  153045. 8,
  153046. 100,
  153047. 0,
  153048. 8,
  153049. 36,
  153050. 0,
  153051. 9,
  153052. 168,
  153053. 0,
  153054. 8,
  153055. 4,
  153056. 0,
  153057. 8,
  153058. 132,
  153059. 0,
  153060. 8,
  153061. 68,
  153062. 0,
  153063. 9,
  153064. 232,
  153065. 80,
  153066. 7,
  153067. 8,
  153068. 0,
  153069. 8,
  153070. 92,
  153071. 0,
  153072. 8,
  153073. 28,
  153074. 0,
  153075. 9,
  153076. 152,
  153077. 84,
  153078. 7,
  153079. 83,
  153080. 0,
  153081. 8,
  153082. 124,
  153083. 0,
  153084. 8,
  153085. 60,
  153086. 0,
  153087. 9,
  153088. 216,
  153089. 82,
  153090. 7,
  153091. 23,
  153092. 0,
  153093. 8,
  153094. 108,
  153095. 0,
  153096. 8,
  153097. 44,
  153098. 0,
  153099. 9,
  153100. 184,
  153101. 0,
  153102. 8,
  153103. 12,
  153104. 0,
  153105. 8,
  153106. 140,
  153107. 0,
  153108. 8,
  153109. 76,
  153110. 0,
  153111. 9,
  153112. 248,
  153113. 80,
  153114. 7,
  153115. 3,
  153116. 0,
  153117. 8,
  153118. 82,
  153119. 0,
  153120. 8,
  153121. 18,
  153122. 85,
  153123. 8,
  153124. 163,
  153125. 83,
  153126. 7,
  153127. 35,
  153128. 0,
  153129. 8,
  153130. 114,
  153131. 0,
  153132. 8,
  153133. 50,
  153134. 0,
  153135. 9,
  153136. 196,
  153137. 81,
  153138. 7,
  153139. 11,
  153140. 0,
  153141. 8,
  153142. 98,
  153143. 0,
  153144. 8,
  153145. 34,
  153146. 0,
  153147. 9,
  153148. 164,
  153149. 0,
  153150. 8,
  153151. 2,
  153152. 0,
  153153. 8,
  153154. 130,
  153155. 0,
  153156. 8,
  153157. 66,
  153158. 0,
  153159. 9,
  153160. 228,
  153161. 80,
  153162. 7,
  153163. 7,
  153164. 0,
  153165. 8,
  153166. 90,
  153167. 0,
  153168. 8,
  153169. 26,
  153170. 0,
  153171. 9,
  153172. 148,
  153173. 84,
  153174. 7,
  153175. 67,
  153176. 0,
  153177. 8,
  153178. 122,
  153179. 0,
  153180. 8,
  153181. 58,
  153182. 0,
  153183. 9,
  153184. 212,
  153185. 82,
  153186. 7,
  153187. 19,
  153188. 0,
  153189. 8,
  153190. 106,
  153191. 0,
  153192. 8,
  153193. 42,
  153194. 0,
  153195. 9,
  153196. 180,
  153197. 0,
  153198. 8,
  153199. 10,
  153200. 0,
  153201. 8,
  153202. 138,
  153203. 0,
  153204. 8,
  153205. 74,
  153206. 0,
  153207. 9,
  153208. 244,
  153209. 80,
  153210. 7,
  153211. 5,
  153212. 0,
  153213. 8,
  153214. 86,
  153215. 0,
  153216. 8,
  153217. 22,
  153218. 192,
  153219. 8,
  153220. 0,
  153221. 83,
  153222. 7,
  153223. 51,
  153224. 0,
  153225. 8,
  153226. 118,
  153227. 0,
  153228. 8,
  153229. 54,
  153230. 0,
  153231. 9,
  153232. 204,
  153233. 81,
  153234. 7,
  153235. 15,
  153236. 0,
  153237. 8,
  153238. 102,
  153239. 0,
  153240. 8,
  153241. 38,
  153242. 0,
  153243. 9,
  153244. 172,
  153245. 0,
  153246. 8,
  153247. 6,
  153248. 0,
  153249. 8,
  153250. 134,
  153251. 0,
  153252. 8,
  153253. 70,
  153254. 0,
  153255. 9,
  153256. 236,
  153257. 80,
  153258. 7,
  153259. 9,
  153260. 0,
  153261. 8,
  153262. 94,
  153263. 0,
  153264. 8,
  153265. 30,
  153266. 0,
  153267. 9,
  153268. 156,
  153269. 84,
  153270. 7,
  153271. 99,
  153272. 0,
  153273. 8,
  153274. 126,
  153275. 0,
  153276. 8,
  153277. 62,
  153278. 0,
  153279. 9,
  153280. 220,
  153281. 82,
  153282. 7,
  153283. 27,
  153284. 0,
  153285. 8,
  153286. 110,
  153287. 0,
  153288. 8,
  153289. 46,
  153290. 0,
  153291. 9,
  153292. 188,
  153293. 0,
  153294. 8,
  153295. 14,
  153296. 0,
  153297. 8,
  153298. 142,
  153299. 0,
  153300. 8,
  153301. 78,
  153302. 0,
  153303. 9,
  153304. 252,
  153305. 96,
  153306. 7,
  153307. 256,
  153308. 0,
  153309. 8,
  153310. 81,
  153311. 0,
  153312. 8,
  153313. 17,
  153314. 85,
  153315. 8,
  153316. 131,
  153317. 82,
  153318. 7,
  153319. 31,
  153320. 0,
  153321. 8,
  153322. 113,
  153323. 0,
  153324. 8,
  153325. 49,
  153326. 0,
  153327. 9,
  153328. 194,
  153329. 80,
  153330. 7,
  153331. 10,
  153332. 0,
  153333. 8,
  153334. 97,
  153335. 0,
  153336. 8,
  153337. 33,
  153338. 0,
  153339. 9,
  153340. 162,
  153341. 0,
  153342. 8,
  153343. 1,
  153344. 0,
  153345. 8,
  153346. 129,
  153347. 0,
  153348. 8,
  153349. 65,
  153350. 0,
  153351. 9,
  153352. 226,
  153353. 80,
  153354. 7,
  153355. 6,
  153356. 0,
  153357. 8,
  153358. 89,
  153359. 0,
  153360. 8,
  153361. 25,
  153362. 0,
  153363. 9,
  153364. 146,
  153365. 83,
  153366. 7,
  153367. 59,
  153368. 0,
  153369. 8,
  153370. 121,
  153371. 0,
  153372. 8,
  153373. 57,
  153374. 0,
  153375. 9,
  153376. 210,
  153377. 81,
  153378. 7,
  153379. 17,
  153380. 0,
  153381. 8,
  153382. 105,
  153383. 0,
  153384. 8,
  153385. 41,
  153386. 0,
  153387. 9,
  153388. 178,
  153389. 0,
  153390. 8,
  153391. 9,
  153392. 0,
  153393. 8,
  153394. 137,
  153395. 0,
  153396. 8,
  153397. 73,
  153398. 0,
  153399. 9,
  153400. 242,
  153401. 80,
  153402. 7,
  153403. 4,
  153404. 0,
  153405. 8,
  153406. 85,
  153407. 0,
  153408. 8,
  153409. 21,
  153410. 80,
  153411. 8,
  153412. 258,
  153413. 83,
  153414. 7,
  153415. 43,
  153416. 0,
  153417. 8,
  153418. 117,
  153419. 0,
  153420. 8,
  153421. 53,
  153422. 0,
  153423. 9,
  153424. 202,
  153425. 81,
  153426. 7,
  153427. 13,
  153428. 0,
  153429. 8,
  153430. 101,
  153431. 0,
  153432. 8,
  153433. 37,
  153434. 0,
  153435. 9,
  153436. 170,
  153437. 0,
  153438. 8,
  153439. 5,
  153440. 0,
  153441. 8,
  153442. 133,
  153443. 0,
  153444. 8,
  153445. 69,
  153446. 0,
  153447. 9,
  153448. 234,
  153449. 80,
  153450. 7,
  153451. 8,
  153452. 0,
  153453. 8,
  153454. 93,
  153455. 0,
  153456. 8,
  153457. 29,
  153458. 0,
  153459. 9,
  153460. 154,
  153461. 84,
  153462. 7,
  153463. 83,
  153464. 0,
  153465. 8,
  153466. 125,
  153467. 0,
  153468. 8,
  153469. 61,
  153470. 0,
  153471. 9,
  153472. 218,
  153473. 82,
  153474. 7,
  153475. 23,
  153476. 0,
  153477. 8,
  153478. 109,
  153479. 0,
  153480. 8,
  153481. 45,
  153482. 0,
  153483. 9,
  153484. 186,
  153485. 0,
  153486. 8,
  153487. 13,
  153488. 0,
  153489. 8,
  153490. 141,
  153491. 0,
  153492. 8,
  153493. 77,
  153494. 0,
  153495. 9,
  153496. 250,
  153497. 80,
  153498. 7,
  153499. 3,
  153500. 0,
  153501. 8,
  153502. 83,
  153503. 0,
  153504. 8,
  153505. 19,
  153506. 85,
  153507. 8,
  153508. 195,
  153509. 83,
  153510. 7,
  153511. 35,
  153512. 0,
  153513. 8,
  153514. 115,
  153515. 0,
  153516. 8,
  153517. 51,
  153518. 0,
  153519. 9,
  153520. 198,
  153521. 81,
  153522. 7,
  153523. 11,
  153524. 0,
  153525. 8,
  153526. 99,
  153527. 0,
  153528. 8,
  153529. 35,
  153530. 0,
  153531. 9,
  153532. 166,
  153533. 0,
  153534. 8,
  153535. 3,
  153536. 0,
  153537. 8,
  153538. 131,
  153539. 0,
  153540. 8,
  153541. 67,
  153542. 0,
  153543. 9,
  153544. 230,
  153545. 80,
  153546. 7,
  153547. 7,
  153548. 0,
  153549. 8,
  153550. 91,
  153551. 0,
  153552. 8,
  153553. 27,
  153554. 0,
  153555. 9,
  153556. 150,
  153557. 84,
  153558. 7,
  153559. 67,
  153560. 0,
  153561. 8,
  153562. 123,
  153563. 0,
  153564. 8,
  153565. 59,
  153566. 0,
  153567. 9,
  153568. 214,
  153569. 82,
  153570. 7,
  153571. 19,
  153572. 0,
  153573. 8,
  153574. 107,
  153575. 0,
  153576. 8,
  153577. 43,
  153578. 0,
  153579. 9,
  153580. 182,
  153581. 0,
  153582. 8,
  153583. 11,
  153584. 0,
  153585. 8,
  153586. 139,
  153587. 0,
  153588. 8,
  153589. 75,
  153590. 0,
  153591. 9,
  153592. 246,
  153593. 80,
  153594. 7,
  153595. 5,
  153596. 0,
  153597. 8,
  153598. 87,
  153599. 0,
  153600. 8,
  153601. 23,
  153602. 192,
  153603. 8,
  153604. 0,
  153605. 83,
  153606. 7,
  153607. 51,
  153608. 0,
  153609. 8,
  153610. 119,
  153611. 0,
  153612. 8,
  153613. 55,
  153614. 0,
  153615. 9,
  153616. 206,
  153617. 81,
  153618. 7,
  153619. 15,
  153620. 0,
  153621. 8,
  153622. 103,
  153623. 0,
  153624. 8,
  153625. 39,
  153626. 0,
  153627. 9,
  153628. 174,
  153629. 0,
  153630. 8,
  153631. 7,
  153632. 0,
  153633. 8,
  153634. 135,
  153635. 0,
  153636. 8,
  153637. 71,
  153638. 0,
  153639. 9,
  153640. 238,
  153641. 80,
  153642. 7,
  153643. 9,
  153644. 0,
  153645. 8,
  153646. 95,
  153647. 0,
  153648. 8,
  153649. 31,
  153650. 0,
  153651. 9,
  153652. 158,
  153653. 84,
  153654. 7,
  153655. 99,
  153656. 0,
  153657. 8,
  153658. 127,
  153659. 0,
  153660. 8,
  153661. 63,
  153662. 0,
  153663. 9,
  153664. 222,
  153665. 82,
  153666. 7,
  153667. 27,
  153668. 0,
  153669. 8,
  153670. 111,
  153671. 0,
  153672. 8,
  153673. 47,
  153674. 0,
  153675. 9,
  153676. 190,
  153677. 0,
  153678. 8,
  153679. 15,
  153680. 0,
  153681. 8,
  153682. 143,
  153683. 0,
  153684. 8,
  153685. 79,
  153686. 0,
  153687. 9,
  153688. 254,
  153689. 96,
  153690. 7,
  153691. 256,
  153692. 0,
  153693. 8,
  153694. 80,
  153695. 0,
  153696. 8,
  153697. 16,
  153698. 84,
  153699. 8,
  153700. 115,
  153701. 82,
  153702. 7,
  153703. 31,
  153704. 0,
  153705. 8,
  153706. 112,
  153707. 0,
  153708. 8,
  153709. 48,
  153710. 0,
  153711. 9,
  153712. 193,
  153713. 80,
  153714. 7,
  153715. 10,
  153716. 0,
  153717. 8,
  153718. 96,
  153719. 0,
  153720. 8,
  153721. 32,
  153722. 0,
  153723. 9,
  153724. 161,
  153725. 0,
  153726. 8,
  153727. 0,
  153728. 0,
  153729. 8,
  153730. 128,
  153731. 0,
  153732. 8,
  153733. 64,
  153734. 0,
  153735. 9,
  153736. 225,
  153737. 80,
  153738. 7,
  153739. 6,
  153740. 0,
  153741. 8,
  153742. 88,
  153743. 0,
  153744. 8,
  153745. 24,
  153746. 0,
  153747. 9,
  153748. 145,
  153749. 83,
  153750. 7,
  153751. 59,
  153752. 0,
  153753. 8,
  153754. 120,
  153755. 0,
  153756. 8,
  153757. 56,
  153758. 0,
  153759. 9,
  153760. 209,
  153761. 81,
  153762. 7,
  153763. 17,
  153764. 0,
  153765. 8,
  153766. 104,
  153767. 0,
  153768. 8,
  153769. 40,
  153770. 0,
  153771. 9,
  153772. 177,
  153773. 0,
  153774. 8,
  153775. 8,
  153776. 0,
  153777. 8,
  153778. 136,
  153779. 0,
  153780. 8,
  153781. 72,
  153782. 0,
  153783. 9,
  153784. 241,
  153785. 80,
  153786. 7,
  153787. 4,
  153788. 0,
  153789. 8,
  153790. 84,
  153791. 0,
  153792. 8,
  153793. 20,
  153794. 85,
  153795. 8,
  153796. 227,
  153797. 83,
  153798. 7,
  153799. 43,
  153800. 0,
  153801. 8,
  153802. 116,
  153803. 0,
  153804. 8,
  153805. 52,
  153806. 0,
  153807. 9,
  153808. 201,
  153809. 81,
  153810. 7,
  153811. 13,
  153812. 0,
  153813. 8,
  153814. 100,
  153815. 0,
  153816. 8,
  153817. 36,
  153818. 0,
  153819. 9,
  153820. 169,
  153821. 0,
  153822. 8,
  153823. 4,
  153824. 0,
  153825. 8,
  153826. 132,
  153827. 0,
  153828. 8,
  153829. 68,
  153830. 0,
  153831. 9,
  153832. 233,
  153833. 80,
  153834. 7,
  153835. 8,
  153836. 0,
  153837. 8,
  153838. 92,
  153839. 0,
  153840. 8,
  153841. 28,
  153842. 0,
  153843. 9,
  153844. 153,
  153845. 84,
  153846. 7,
  153847. 83,
  153848. 0,
  153849. 8,
  153850. 124,
  153851. 0,
  153852. 8,
  153853. 60,
  153854. 0,
  153855. 9,
  153856. 217,
  153857. 82,
  153858. 7,
  153859. 23,
  153860. 0,
  153861. 8,
  153862. 108,
  153863. 0,
  153864. 8,
  153865. 44,
  153866. 0,
  153867. 9,
  153868. 185,
  153869. 0,
  153870. 8,
  153871. 12,
  153872. 0,
  153873. 8,
  153874. 140,
  153875. 0,
  153876. 8,
  153877. 76,
  153878. 0,
  153879. 9,
  153880. 249,
  153881. 80,
  153882. 7,
  153883. 3,
  153884. 0,
  153885. 8,
  153886. 82,
  153887. 0,
  153888. 8,
  153889. 18,
  153890. 85,
  153891. 8,
  153892. 163,
  153893. 83,
  153894. 7,
  153895. 35,
  153896. 0,
  153897. 8,
  153898. 114,
  153899. 0,
  153900. 8,
  153901. 50,
  153902. 0,
  153903. 9,
  153904. 197,
  153905. 81,
  153906. 7,
  153907. 11,
  153908. 0,
  153909. 8,
  153910. 98,
  153911. 0,
  153912. 8,
  153913. 34,
  153914. 0,
  153915. 9,
  153916. 165,
  153917. 0,
  153918. 8,
  153919. 2,
  153920. 0,
  153921. 8,
  153922. 130,
  153923. 0,
  153924. 8,
  153925. 66,
  153926. 0,
  153927. 9,
  153928. 229,
  153929. 80,
  153930. 7,
  153931. 7,
  153932. 0,
  153933. 8,
  153934. 90,
  153935. 0,
  153936. 8,
  153937. 26,
  153938. 0,
  153939. 9,
  153940. 149,
  153941. 84,
  153942. 7,
  153943. 67,
  153944. 0,
  153945. 8,
  153946. 122,
  153947. 0,
  153948. 8,
  153949. 58,
  153950. 0,
  153951. 9,
  153952. 213,
  153953. 82,
  153954. 7,
  153955. 19,
  153956. 0,
  153957. 8,
  153958. 106,
  153959. 0,
  153960. 8,
  153961. 42,
  153962. 0,
  153963. 9,
  153964. 181,
  153965. 0,
  153966. 8,
  153967. 10,
  153968. 0,
  153969. 8,
  153970. 138,
  153971. 0,
  153972. 8,
  153973. 74,
  153974. 0,
  153975. 9,
  153976. 245,
  153977. 80,
  153978. 7,
  153979. 5,
  153980. 0,
  153981. 8,
  153982. 86,
  153983. 0,
  153984. 8,
  153985. 22,
  153986. 192,
  153987. 8,
  153988. 0,
  153989. 83,
  153990. 7,
  153991. 51,
  153992. 0,
  153993. 8,
  153994. 118,
  153995. 0,
  153996. 8,
  153997. 54,
  153998. 0,
  153999. 9,
  154000. 205,
  154001. 81,
  154002. 7,
  154003. 15,
  154004. 0,
  154005. 8,
  154006. 102,
  154007. 0,
  154008. 8,
  154009. 38,
  154010. 0,
  154011. 9,
  154012. 173,
  154013. 0,
  154014. 8,
  154015. 6,
  154016. 0,
  154017. 8,
  154018. 134,
  154019. 0,
  154020. 8,
  154021. 70,
  154022. 0,
  154023. 9,
  154024. 237,
  154025. 80,
  154026. 7,
  154027. 9,
  154028. 0,
  154029. 8,
  154030. 94,
  154031. 0,
  154032. 8,
  154033. 30,
  154034. 0,
  154035. 9,
  154036. 157,
  154037. 84,
  154038. 7,
  154039. 99,
  154040. 0,
  154041. 8,
  154042. 126,
  154043. 0,
  154044. 8,
  154045. 62,
  154046. 0,
  154047. 9,
  154048. 221,
  154049. 82,
  154050. 7,
  154051. 27,
  154052. 0,
  154053. 8,
  154054. 110,
  154055. 0,
  154056. 8,
  154057. 46,
  154058. 0,
  154059. 9,
  154060. 189,
  154061. 0,
  154062. 8,
  154063. 14,
  154064. 0,
  154065. 8,
  154066. 142,
  154067. 0,
  154068. 8,
  154069. 78,
  154070. 0,
  154071. 9,
  154072. 253,
  154073. 96,
  154074. 7,
  154075. 256,
  154076. 0,
  154077. 8,
  154078. 81,
  154079. 0,
  154080. 8,
  154081. 17,
  154082. 85,
  154083. 8,
  154084. 131,
  154085. 82,
  154086. 7,
  154087. 31,
  154088. 0,
  154089. 8,
  154090. 113,
  154091. 0,
  154092. 8,
  154093. 49,
  154094. 0,
  154095. 9,
  154096. 195,
  154097. 80,
  154098. 7,
  154099. 10,
  154100. 0,
  154101. 8,
  154102. 97,
  154103. 0,
  154104. 8,
  154105. 33,
  154106. 0,
  154107. 9,
  154108. 163,
  154109. 0,
  154110. 8,
  154111. 1,
  154112. 0,
  154113. 8,
  154114. 129,
  154115. 0,
  154116. 8,
  154117. 65,
  154118. 0,
  154119. 9,
  154120. 227,
  154121. 80,
  154122. 7,
  154123. 6,
  154124. 0,
  154125. 8,
  154126. 89,
  154127. 0,
  154128. 8,
  154129. 25,
  154130. 0,
  154131. 9,
  154132. 147,
  154133. 83,
  154134. 7,
  154135. 59,
  154136. 0,
  154137. 8,
  154138. 121,
  154139. 0,
  154140. 8,
  154141. 57,
  154142. 0,
  154143. 9,
  154144. 211,
  154145. 81,
  154146. 7,
  154147. 17,
  154148. 0,
  154149. 8,
  154150. 105,
  154151. 0,
  154152. 8,
  154153. 41,
  154154. 0,
  154155. 9,
  154156. 179,
  154157. 0,
  154158. 8,
  154159. 9,
  154160. 0,
  154161. 8,
  154162. 137,
  154163. 0,
  154164. 8,
  154165. 73,
  154166. 0,
  154167. 9,
  154168. 243,
  154169. 80,
  154170. 7,
  154171. 4,
  154172. 0,
  154173. 8,
  154174. 85,
  154175. 0,
  154176. 8,
  154177. 21,
  154178. 80,
  154179. 8,
  154180. 258,
  154181. 83,
  154182. 7,
  154183. 43,
  154184. 0,
  154185. 8,
  154186. 117,
  154187. 0,
  154188. 8,
  154189. 53,
  154190. 0,
  154191. 9,
  154192. 203,
  154193. 81,
  154194. 7,
  154195. 13,
  154196. 0,
  154197. 8,
  154198. 101,
  154199. 0,
  154200. 8,
  154201. 37,
  154202. 0,
  154203. 9,
  154204. 171,
  154205. 0,
  154206. 8,
  154207. 5,
  154208. 0,
  154209. 8,
  154210. 133,
  154211. 0,
  154212. 8,
  154213. 69,
  154214. 0,
  154215. 9,
  154216. 235,
  154217. 80,
  154218. 7,
  154219. 8,
  154220. 0,
  154221. 8,
  154222. 93,
  154223. 0,
  154224. 8,
  154225. 29,
  154226. 0,
  154227. 9,
  154228. 155,
  154229. 84,
  154230. 7,
  154231. 83,
  154232. 0,
  154233. 8,
  154234. 125,
  154235. 0,
  154236. 8,
  154237. 61,
  154238. 0,
  154239. 9,
  154240. 219,
  154241. 82,
  154242. 7,
  154243. 23,
  154244. 0,
  154245. 8,
  154246. 109,
  154247. 0,
  154248. 8,
  154249. 45,
  154250. 0,
  154251. 9,
  154252. 187,
  154253. 0,
  154254. 8,
  154255. 13,
  154256. 0,
  154257. 8,
  154258. 141,
  154259. 0,
  154260. 8,
  154261. 77,
  154262. 0,
  154263. 9,
  154264. 251,
  154265. 80,
  154266. 7,
  154267. 3,
  154268. 0,
  154269. 8,
  154270. 83,
  154271. 0,
  154272. 8,
  154273. 19,
  154274. 85,
  154275. 8,
  154276. 195,
  154277. 83,
  154278. 7,
  154279. 35,
  154280. 0,
  154281. 8,
  154282. 115,
  154283. 0,
  154284. 8,
  154285. 51,
  154286. 0,
  154287. 9,
  154288. 199,
  154289. 81,
  154290. 7,
  154291. 11,
  154292. 0,
  154293. 8,
  154294. 99,
  154295. 0,
  154296. 8,
  154297. 35,
  154298. 0,
  154299. 9,
  154300. 167,
  154301. 0,
  154302. 8,
  154303. 3,
  154304. 0,
  154305. 8,
  154306. 131,
  154307. 0,
  154308. 8,
  154309. 67,
  154310. 0,
  154311. 9,
  154312. 231,
  154313. 80,
  154314. 7,
  154315. 7,
  154316. 0,
  154317. 8,
  154318. 91,
  154319. 0,
  154320. 8,
  154321. 27,
  154322. 0,
  154323. 9,
  154324. 151,
  154325. 84,
  154326. 7,
  154327. 67,
  154328. 0,
  154329. 8,
  154330. 123,
  154331. 0,
  154332. 8,
  154333. 59,
  154334. 0,
  154335. 9,
  154336. 215,
  154337. 82,
  154338. 7,
  154339. 19,
  154340. 0,
  154341. 8,
  154342. 107,
  154343. 0,
  154344. 8,
  154345. 43,
  154346. 0,
  154347. 9,
  154348. 183,
  154349. 0,
  154350. 8,
  154351. 11,
  154352. 0,
  154353. 8,
  154354. 139,
  154355. 0,
  154356. 8,
  154357. 75,
  154358. 0,
  154359. 9,
  154360. 247,
  154361. 80,
  154362. 7,
  154363. 5,
  154364. 0,
  154365. 8,
  154366. 87,
  154367. 0,
  154368. 8,
  154369. 23,
  154370. 192,
  154371. 8,
  154372. 0,
  154373. 83,
  154374. 7,
  154375. 51,
  154376. 0,
  154377. 8,
  154378. 119,
  154379. 0,
  154380. 8,
  154381. 55,
  154382. 0,
  154383. 9,
  154384. 207,
  154385. 81,
  154386. 7,
  154387. 15,
  154388. 0,
  154389. 8,
  154390. 103,
  154391. 0,
  154392. 8,
  154393. 39,
  154394. 0,
  154395. 9,
  154396. 175,
  154397. 0,
  154398. 8,
  154399. 7,
  154400. 0,
  154401. 8,
  154402. 135,
  154403. 0,
  154404. 8,
  154405. 71,
  154406. 0,
  154407. 9,
  154408. 239,
  154409. 80,
  154410. 7,
  154411. 9,
  154412. 0,
  154413. 8,
  154414. 95,
  154415. 0,
  154416. 8,
  154417. 31,
  154418. 0,
  154419. 9,
  154420. 159,
  154421. 84,
  154422. 7,
  154423. 99,
  154424. 0,
  154425. 8,
  154426. 127,
  154427. 0,
  154428. 8,
  154429. 63,
  154430. 0,
  154431. 9,
  154432. 223,
  154433. 82,
  154434. 7,
  154435. 27,
  154436. 0,
  154437. 8,
  154438. 111,
  154439. 0,
  154440. 8,
  154441. 47,
  154442. 0,
  154443. 9,
  154444. 191,
  154445. 0,
  154446. 8,
  154447. 15,
  154448. 0,
  154449. 8,
  154450. 143,
  154451. 0,
  154452. 8,
  154453. 79,
  154454. 0,
  154455. 9,
  154456. 255
  154457. ];
  154458. var fixed_td = [
  154459. 80,
  154460. 5,
  154461. 1,
  154462. 87,
  154463. 5,
  154464. 257,
  154465. 83,
  154466. 5,
  154467. 17,
  154468. 91,
  154469. 5,
  154470. 4097,
  154471. 81,
  154472. 5,
  154473. 5,
  154474. 89,
  154475. 5,
  154476. 1025,
  154477. 85,
  154478. 5,
  154479. 65,
  154480. 93,
  154481. 5,
  154482. 16385,
  154483. 80,
  154484. 5,
  154485. 3,
  154486. 88,
  154487. 5,
  154488. 513,
  154489. 84,
  154490. 5,
  154491. 33,
  154492. 92,
  154493. 5,
  154494. 8193,
  154495. 82,
  154496. 5,
  154497. 9,
  154498. 90,
  154499. 5,
  154500. 2049,
  154501. 86,
  154502. 5,
  154503. 129,
  154504. 192,
  154505. 5,
  154506. 24577,
  154507. 80,
  154508. 5,
  154509. 2,
  154510. 87,
  154511. 5,
  154512. 385,
  154513. 83,
  154514. 5,
  154515. 25,
  154516. 91,
  154517. 5,
  154518. 6145,
  154519. 81,
  154520. 5,
  154521. 7,
  154522. 89,
  154523. 5,
  154524. 1537,
  154525. 85,
  154526. 5,
  154527. 97,
  154528. 93,
  154529. 5,
  154530. 24577,
  154531. 80,
  154532. 5,
  154533. 4,
  154534. 88,
  154535. 5,
  154536. 769,
  154537. 84,
  154538. 5,
  154539. 49,
  154540. 92,
  154541. 5,
  154542. 12289,
  154543. 82,
  154544. 5,
  154545. 13,
  154546. 90,
  154547. 5,
  154548. 3073,
  154549. 86,
  154550. 5,
  154551. 193,
  154552. 192,
  154553. 5,
  154554. 24577
  154555. ];
  154556. var cplens = [
  154557. 3,
  154558. 4,
  154559. 5,
  154560. 6,
  154561. 7,
  154562. 8,
  154563. 9,
  154564. 10,
  154565. 11,
  154566. 13,
  154567. 15,
  154568. 17,
  154569. 19,
  154570. 23,
  154571. 27,
  154572. 31,
  154573. 35,
  154574. 43,
  154575. 51,
  154576. 59,
  154577. 67,
  154578. 83,
  154579. 99,
  154580. 115,
  154581. 131,
  154582. 163,
  154583. 195,
  154584. 227,
  154585. 258,
  154586. 0,
  154587. 0
  154588. ];
  154589. var cplext = [
  154590. 0,
  154591. 0,
  154592. 0,
  154593. 0,
  154594. 0,
  154595. 0,
  154596. 0,
  154597. 0,
  154598. 1,
  154599. 1,
  154600. 1,
  154601. 1,
  154602. 2,
  154603. 2,
  154604. 2,
  154605. 2,
  154606. 3,
  154607. 3,
  154608. 3,
  154609. 3,
  154610. 4,
  154611. 4,
  154612. 4,
  154613. 4,
  154614. 5,
  154615. 5,
  154616. 5,
  154617. 5,
  154618. 0,
  154619. 112,
  154620. 112
  154621. ];
  154622. var cpdist = [
  154623. 1,
  154624. 2,
  154625. 3,
  154626. 4,
  154627. 5,
  154628. 7,
  154629. 9,
  154630. 13,
  154631. 17,
  154632. 25,
  154633. 33,
  154634. 49,
  154635. 65,
  154636. 97,
  154637. 129,
  154638. 193,
  154639. 257,
  154640. 385,
  154641. 513,
  154642. 769,
  154643. 1025,
  154644. 1537,
  154645. 2049,
  154646. 3073,
  154647. 4097,
  154648. 6145,
  154649. 8193,
  154650. 12289,
  154651. 16385,
  154652. 24577
  154653. ];
  154654. var cpdext = [
  154655. 0,
  154656. 0,
  154657. 0,
  154658. 0,
  154659. 1,
  154660. 1,
  154661. 2,
  154662. 2,
  154663. 3,
  154664. 3,
  154665. 4,
  154666. 4,
  154667. 5,
  154668. 5,
  154669. 6,
  154670. 6,
  154671. 7,
  154672. 7,
  154673. 8,
  154674. 8,
  154675. 9,
  154676. 9,
  154677. 10,
  154678. 10,
  154679. 11,
  154680. 11,
  154681. 12,
  154682. 12,
  154683. 13,
  154684. 13
  154685. ];
  154686. var BMAX = 15;
  154687. function InfTree() {
  154688. const that = this;
  154689. let hn;
  154690. let v7;
  154691. let c14;
  154692. let r2;
  154693. let u3;
  154694. let x;
  154695. function huft_build(b, bindex, n2, s2, d, e2, t, m, hp, hn2, v8) {
  154696. let a4;
  154697. let f2;
  154698. let g;
  154699. let h;
  154700. let i2;
  154701. let j;
  154702. let k;
  154703. let l2;
  154704. let mask;
  154705. let p2;
  154706. let q;
  154707. let w;
  154708. let xp;
  154709. let y;
  154710. let z;
  154711. p2 = 0;
  154712. i2 = n2;
  154713. do {
  154714. c14[b[bindex + p2]]++;
  154715. p2++;
  154716. i2--;
  154717. } while (i2 !== 0);
  154718. if (c14[0] == n2) {
  154719. t[0] = -1;
  154720. m[0] = 0;
  154721. return Z_OK;
  154722. }
  154723. l2 = m[0];
  154724. for (j = 1; j <= BMAX; j++)
  154725. if (c14[j] !== 0)
  154726. break;
  154727. k = j;
  154728. if (l2 < j) {
  154729. l2 = j;
  154730. }
  154731. for (i2 = BMAX; i2 !== 0; i2--) {
  154732. if (c14[i2] !== 0)
  154733. break;
  154734. }
  154735. g = i2;
  154736. if (l2 > i2) {
  154737. l2 = i2;
  154738. }
  154739. m[0] = l2;
  154740. for (y = 1 << j; j < i2; j++, y <<= 1) {
  154741. if ((y -= c14[j]) < 0) {
  154742. return Z_DATA_ERROR;
  154743. }
  154744. }
  154745. if ((y -= c14[i2]) < 0) {
  154746. return Z_DATA_ERROR;
  154747. }
  154748. c14[i2] += y;
  154749. x[1] = j = 0;
  154750. p2 = 1;
  154751. xp = 2;
  154752. while (--i2 !== 0) {
  154753. x[xp] = j += c14[p2];
  154754. xp++;
  154755. p2++;
  154756. }
  154757. i2 = 0;
  154758. p2 = 0;
  154759. do {
  154760. if ((j = b[bindex + p2]) !== 0) {
  154761. v8[x[j]++] = i2;
  154762. }
  154763. p2++;
  154764. } while (++i2 < n2);
  154765. n2 = x[g];
  154766. x[0] = i2 = 0;
  154767. p2 = 0;
  154768. h = -1;
  154769. w = -l2;
  154770. u3[0] = 0;
  154771. q = 0;
  154772. z = 0;
  154773. for (; k <= g; k++) {
  154774. a4 = c14[k];
  154775. while (a4-- !== 0) {
  154776. while (k > w + l2) {
  154777. h++;
  154778. w += l2;
  154779. z = g - w;
  154780. z = z > l2 ? l2 : z;
  154781. if ((f2 = 1 << (j = k - w)) > a4 + 1) {
  154782. f2 -= a4 + 1;
  154783. xp = k;
  154784. if (j < z) {
  154785. while (++j < z) {
  154786. if ((f2 <<= 1) <= c14[++xp])
  154787. break;
  154788. f2 -= c14[xp];
  154789. }
  154790. }
  154791. }
  154792. z = 1 << j;
  154793. if (hn2[0] + z > MANY) {
  154794. return Z_DATA_ERROR;
  154795. }
  154796. u3[h] = q = hn2[0];
  154797. hn2[0] += z;
  154798. if (h !== 0) {
  154799. x[h] = i2;
  154800. r2[0] = j;
  154801. r2[1] = l2;
  154802. j = i2 >>> w - l2;
  154803. r2[2] = q - u3[h - 1] - j;
  154804. hp.set(r2, (u3[h - 1] + j) * 3);
  154805. } else {
  154806. t[0] = q;
  154807. }
  154808. }
  154809. r2[1] = k - w;
  154810. if (p2 >= n2) {
  154811. r2[0] = 128 + 64;
  154812. } else if (v8[p2] < s2) {
  154813. r2[0] = v8[p2] < 256 ? 0 : 32 + 64;
  154814. r2[2] = v8[p2++];
  154815. } else {
  154816. r2[0] = e2[v8[p2] - s2] + 16 + 64;
  154817. r2[2] = d[v8[p2++] - s2];
  154818. }
  154819. f2 = 1 << k - w;
  154820. for (j = i2 >>> w; j < z; j += f2) {
  154821. hp.set(r2, (q + j) * 3);
  154822. }
  154823. for (j = 1 << k - 1; (i2 & j) !== 0; j >>>= 1) {
  154824. i2 ^= j;
  154825. }
  154826. i2 ^= j;
  154827. mask = (1 << w) - 1;
  154828. while ((i2 & mask) != x[h]) {
  154829. h--;
  154830. w -= l2;
  154831. mask = (1 << w) - 1;
  154832. }
  154833. }
  154834. }
  154835. return y !== 0 && g != 1 ? Z_BUF_ERROR : Z_OK;
  154836. }
  154837. function initWorkArea(vsize) {
  154838. let i2;
  154839. if (!hn) {
  154840. hn = [];
  154841. v7 = [];
  154842. c14 = new Int32Array(BMAX + 1);
  154843. r2 = [];
  154844. u3 = new Int32Array(BMAX);
  154845. x = new Int32Array(BMAX + 1);
  154846. }
  154847. if (v7.length < vsize) {
  154848. v7 = [];
  154849. }
  154850. for (i2 = 0; i2 < vsize; i2++) {
  154851. v7[i2] = 0;
  154852. }
  154853. for (i2 = 0; i2 < BMAX + 1; i2++) {
  154854. c14[i2] = 0;
  154855. }
  154856. for (i2 = 0; i2 < 3; i2++) {
  154857. r2[i2] = 0;
  154858. }
  154859. u3.set(c14.subarray(0, BMAX), 0);
  154860. x.set(c14.subarray(0, BMAX + 1), 0);
  154861. }
  154862. that.inflate_trees_bits = function(c15, bb, tb, hp, z) {
  154863. let result;
  154864. initWorkArea(19);
  154865. hn[0] = 0;
  154866. result = huft_build(c15, 0, 19, 19, null, null, tb, bb, hp, hn, v7);
  154867. if (result == Z_DATA_ERROR) {
  154868. z.msg = "oversubscribed dynamic bit lengths tree";
  154869. } else if (result == Z_BUF_ERROR || bb[0] === 0) {
  154870. z.msg = "incomplete dynamic bit lengths tree";
  154871. result = Z_DATA_ERROR;
  154872. }
  154873. return result;
  154874. };
  154875. that.inflate_trees_dynamic = function(nl, nd, c15, bl, bd, tl, td, hp, z) {
  154876. let result;
  154877. initWorkArea(288);
  154878. hn[0] = 0;
  154879. result = huft_build(c15, 0, nl, 257, cplens, cplext, tl, bl, hp, hn, v7);
  154880. if (result != Z_OK || bl[0] === 0) {
  154881. if (result == Z_DATA_ERROR) {
  154882. z.msg = "oversubscribed literal/length tree";
  154883. } else if (result != Z_MEM_ERROR) {
  154884. z.msg = "incomplete literal/length tree";
  154885. result = Z_DATA_ERROR;
  154886. }
  154887. return result;
  154888. }
  154889. initWorkArea(288);
  154890. result = huft_build(c15, nl, nd, 0, cpdist, cpdext, td, bd, hp, hn, v7);
  154891. if (result != Z_OK || bd[0] === 0 && nl > 257) {
  154892. if (result == Z_DATA_ERROR) {
  154893. z.msg = "oversubscribed distance tree";
  154894. } else if (result == Z_BUF_ERROR) {
  154895. z.msg = "incomplete distance tree";
  154896. result = Z_DATA_ERROR;
  154897. } else if (result != Z_MEM_ERROR) {
  154898. z.msg = "empty distance tree with lengths";
  154899. result = Z_DATA_ERROR;
  154900. }
  154901. return result;
  154902. }
  154903. return Z_OK;
  154904. };
  154905. }
  154906. InfTree.inflate_trees_fixed = function(bl, bd, tl, td) {
  154907. bl[0] = fixed_bl;
  154908. bd[0] = fixed_bd;
  154909. tl[0] = fixed_tl;
  154910. td[0] = fixed_td;
  154911. return Z_OK;
  154912. };
  154913. var START = 0;
  154914. var LEN = 1;
  154915. var LENEXT = 2;
  154916. var DIST = 3;
  154917. var DISTEXT = 4;
  154918. var COPY = 5;
  154919. var LIT = 6;
  154920. var WASH = 7;
  154921. var END = 8;
  154922. var BADCODE = 9;
  154923. function InfCodes() {
  154924. const that = this;
  154925. let mode2;
  154926. let len = 0;
  154927. let tree;
  154928. let tree_index = 0;
  154929. let need = 0;
  154930. let lit = 0;
  154931. let get2 = 0;
  154932. let dist = 0;
  154933. let lbits = 0;
  154934. let dbits = 0;
  154935. let ltree;
  154936. let ltree_index = 0;
  154937. let dtree;
  154938. let dtree_index = 0;
  154939. function inflate_fast2(bl, bd, tl, tl_index, td, td_index, s2, z) {
  154940. let t;
  154941. let tp;
  154942. let tp_index;
  154943. let e2;
  154944. let b;
  154945. let k;
  154946. let p2;
  154947. let n2;
  154948. let q;
  154949. let m;
  154950. let ml;
  154951. let md;
  154952. let c14;
  154953. let d;
  154954. let r2;
  154955. let tp_index_t_3;
  154956. p2 = z.next_in_index;
  154957. n2 = z.avail_in;
  154958. b = s2.bitb;
  154959. k = s2.bitk;
  154960. q = s2.write;
  154961. m = q < s2.read ? s2.read - q - 1 : s2.end - q;
  154962. ml = inflate_mask[bl];
  154963. md = inflate_mask[bd];
  154964. do {
  154965. while (k < 20) {
  154966. n2--;
  154967. b |= (z.read_byte(p2++) & 255) << k;
  154968. k += 8;
  154969. }
  154970. t = b & ml;
  154971. tp = tl;
  154972. tp_index = tl_index;
  154973. tp_index_t_3 = (tp_index + t) * 3;
  154974. if ((e2 = tp[tp_index_t_3]) === 0) {
  154975. b >>= tp[tp_index_t_3 + 1];
  154976. k -= tp[tp_index_t_3 + 1];
  154977. s2.win[q++] = tp[tp_index_t_3 + 2];
  154978. m--;
  154979. continue;
  154980. }
  154981. do {
  154982. b >>= tp[tp_index_t_3 + 1];
  154983. k -= tp[tp_index_t_3 + 1];
  154984. if ((e2 & 16) !== 0) {
  154985. e2 &= 15;
  154986. c14 = tp[tp_index_t_3 + 2] + (b & inflate_mask[e2]);
  154987. b >>= e2;
  154988. k -= e2;
  154989. while (k < 15) {
  154990. n2--;
  154991. b |= (z.read_byte(p2++) & 255) << k;
  154992. k += 8;
  154993. }
  154994. t = b & md;
  154995. tp = td;
  154996. tp_index = td_index;
  154997. tp_index_t_3 = (tp_index + t) * 3;
  154998. e2 = tp[tp_index_t_3];
  154999. do {
  155000. b >>= tp[tp_index_t_3 + 1];
  155001. k -= tp[tp_index_t_3 + 1];
  155002. if ((e2 & 16) !== 0) {
  155003. e2 &= 15;
  155004. while (k < e2) {
  155005. n2--;
  155006. b |= (z.read_byte(p2++) & 255) << k;
  155007. k += 8;
  155008. }
  155009. d = tp[tp_index_t_3 + 2] + (b & inflate_mask[e2]);
  155010. b >>= e2;
  155011. k -= e2;
  155012. m -= c14;
  155013. if (q >= d) {
  155014. r2 = q - d;
  155015. if (q - r2 > 0 && 2 > q - r2) {
  155016. s2.win[q++] = s2.win[r2++];
  155017. s2.win[q++] = s2.win[r2++];
  155018. c14 -= 2;
  155019. } else {
  155020. s2.win.set(s2.win.subarray(r2, r2 + 2), q);
  155021. q += 2;
  155022. r2 += 2;
  155023. c14 -= 2;
  155024. }
  155025. } else {
  155026. r2 = q - d;
  155027. do {
  155028. r2 += s2.end;
  155029. } while (r2 < 0);
  155030. e2 = s2.end - r2;
  155031. if (c14 > e2) {
  155032. c14 -= e2;
  155033. if (q - r2 > 0 && e2 > q - r2) {
  155034. do {
  155035. s2.win[q++] = s2.win[r2++];
  155036. } while (--e2 !== 0);
  155037. } else {
  155038. s2.win.set(s2.win.subarray(r2, r2 + e2), q);
  155039. q += e2;
  155040. r2 += e2;
  155041. e2 = 0;
  155042. }
  155043. r2 = 0;
  155044. }
  155045. }
  155046. if (q - r2 > 0 && c14 > q - r2) {
  155047. do {
  155048. s2.win[q++] = s2.win[r2++];
  155049. } while (--c14 !== 0);
  155050. } else {
  155051. s2.win.set(s2.win.subarray(r2, r2 + c14), q);
  155052. q += c14;
  155053. r2 += c14;
  155054. c14 = 0;
  155055. }
  155056. break;
  155057. } else if ((e2 & 64) === 0) {
  155058. t += tp[tp_index_t_3 + 2];
  155059. t += b & inflate_mask[e2];
  155060. tp_index_t_3 = (tp_index + t) * 3;
  155061. e2 = tp[tp_index_t_3];
  155062. } else {
  155063. z.msg = "invalid distance code";
  155064. c14 = z.avail_in - n2;
  155065. c14 = k >> 3 < c14 ? k >> 3 : c14;
  155066. n2 += c14;
  155067. p2 -= c14;
  155068. k -= c14 << 3;
  155069. s2.bitb = b;
  155070. s2.bitk = k;
  155071. z.avail_in = n2;
  155072. z.total_in += p2 - z.next_in_index;
  155073. z.next_in_index = p2;
  155074. s2.write = q;
  155075. return Z_DATA_ERROR;
  155076. }
  155077. } while (true);
  155078. break;
  155079. }
  155080. if ((e2 & 64) === 0) {
  155081. t += tp[tp_index_t_3 + 2];
  155082. t += b & inflate_mask[e2];
  155083. tp_index_t_3 = (tp_index + t) * 3;
  155084. if ((e2 = tp[tp_index_t_3]) === 0) {
  155085. b >>= tp[tp_index_t_3 + 1];
  155086. k -= tp[tp_index_t_3 + 1];
  155087. s2.win[q++] = tp[tp_index_t_3 + 2];
  155088. m--;
  155089. break;
  155090. }
  155091. } else if ((e2 & 32) !== 0) {
  155092. c14 = z.avail_in - n2;
  155093. c14 = k >> 3 < c14 ? k >> 3 : c14;
  155094. n2 += c14;
  155095. p2 -= c14;
  155096. k -= c14 << 3;
  155097. s2.bitb = b;
  155098. s2.bitk = k;
  155099. z.avail_in = n2;
  155100. z.total_in += p2 - z.next_in_index;
  155101. z.next_in_index = p2;
  155102. s2.write = q;
  155103. return Z_STREAM_END;
  155104. } else {
  155105. z.msg = "invalid literal/length code";
  155106. c14 = z.avail_in - n2;
  155107. c14 = k >> 3 < c14 ? k >> 3 : c14;
  155108. n2 += c14;
  155109. p2 -= c14;
  155110. k -= c14 << 3;
  155111. s2.bitb = b;
  155112. s2.bitk = k;
  155113. z.avail_in = n2;
  155114. z.total_in += p2 - z.next_in_index;
  155115. z.next_in_index = p2;
  155116. s2.write = q;
  155117. return Z_DATA_ERROR;
  155118. }
  155119. } while (true);
  155120. } while (m >= 258 && n2 >= 10);
  155121. c14 = z.avail_in - n2;
  155122. c14 = k >> 3 < c14 ? k >> 3 : c14;
  155123. n2 += c14;
  155124. p2 -= c14;
  155125. k -= c14 << 3;
  155126. s2.bitb = b;
  155127. s2.bitk = k;
  155128. z.avail_in = n2;
  155129. z.total_in += p2 - z.next_in_index;
  155130. z.next_in_index = p2;
  155131. s2.write = q;
  155132. return Z_OK;
  155133. }
  155134. that.init = function(bl, bd, tl, tl_index, td, td_index) {
  155135. mode2 = START;
  155136. lbits = bl;
  155137. dbits = bd;
  155138. ltree = tl;
  155139. ltree_index = tl_index;
  155140. dtree = td;
  155141. dtree_index = td_index;
  155142. tree = null;
  155143. };
  155144. that.proc = function(s2, z, r2) {
  155145. let j;
  155146. let tindex;
  155147. let e2;
  155148. let b = 0;
  155149. let k = 0;
  155150. let p2 = 0;
  155151. let n2;
  155152. let q;
  155153. let m;
  155154. let f2;
  155155. p2 = z.next_in_index;
  155156. n2 = z.avail_in;
  155157. b = s2.bitb;
  155158. k = s2.bitk;
  155159. q = s2.write;
  155160. m = q < s2.read ? s2.read - q - 1 : s2.end - q;
  155161. while (true) {
  155162. switch (mode2) {
  155163. case START:
  155164. if (m >= 258 && n2 >= 10) {
  155165. s2.bitb = b;
  155166. s2.bitk = k;
  155167. z.avail_in = n2;
  155168. z.total_in += p2 - z.next_in_index;
  155169. z.next_in_index = p2;
  155170. s2.write = q;
  155171. r2 = inflate_fast2(lbits, dbits, ltree, ltree_index, dtree, dtree_index, s2, z);
  155172. p2 = z.next_in_index;
  155173. n2 = z.avail_in;
  155174. b = s2.bitb;
  155175. k = s2.bitk;
  155176. q = s2.write;
  155177. m = q < s2.read ? s2.read - q - 1 : s2.end - q;
  155178. if (r2 != Z_OK) {
  155179. mode2 = r2 == Z_STREAM_END ? WASH : BADCODE;
  155180. break;
  155181. }
  155182. }
  155183. need = lbits;
  155184. tree = ltree;
  155185. tree_index = ltree_index;
  155186. mode2 = LEN;
  155187. case LEN:
  155188. j = need;
  155189. while (k < j) {
  155190. if (n2 !== 0)
  155191. r2 = Z_OK;
  155192. else {
  155193. s2.bitb = b;
  155194. s2.bitk = k;
  155195. z.avail_in = n2;
  155196. z.total_in += p2 - z.next_in_index;
  155197. z.next_in_index = p2;
  155198. s2.write = q;
  155199. return s2.inflate_flush(z, r2);
  155200. }
  155201. n2--;
  155202. b |= (z.read_byte(p2++) & 255) << k;
  155203. k += 8;
  155204. }
  155205. tindex = (tree_index + (b & inflate_mask[j])) * 3;
  155206. b >>>= tree[tindex + 1];
  155207. k -= tree[tindex + 1];
  155208. e2 = tree[tindex];
  155209. if (e2 === 0) {
  155210. lit = tree[tindex + 2];
  155211. mode2 = LIT;
  155212. break;
  155213. }
  155214. if ((e2 & 16) !== 0) {
  155215. get2 = e2 & 15;
  155216. len = tree[tindex + 2];
  155217. mode2 = LENEXT;
  155218. break;
  155219. }
  155220. if ((e2 & 64) === 0) {
  155221. need = e2;
  155222. tree_index = tindex / 3 + tree[tindex + 2];
  155223. break;
  155224. }
  155225. if ((e2 & 32) !== 0) {
  155226. mode2 = WASH;
  155227. break;
  155228. }
  155229. mode2 = BADCODE;
  155230. z.msg = "invalid literal/length code";
  155231. r2 = Z_DATA_ERROR;
  155232. s2.bitb = b;
  155233. s2.bitk = k;
  155234. z.avail_in = n2;
  155235. z.total_in += p2 - z.next_in_index;
  155236. z.next_in_index = p2;
  155237. s2.write = q;
  155238. return s2.inflate_flush(z, r2);
  155239. case LENEXT:
  155240. j = get2;
  155241. while (k < j) {
  155242. if (n2 !== 0)
  155243. r2 = Z_OK;
  155244. else {
  155245. s2.bitb = b;
  155246. s2.bitk = k;
  155247. z.avail_in = n2;
  155248. z.total_in += p2 - z.next_in_index;
  155249. z.next_in_index = p2;
  155250. s2.write = q;
  155251. return s2.inflate_flush(z, r2);
  155252. }
  155253. n2--;
  155254. b |= (z.read_byte(p2++) & 255) << k;
  155255. k += 8;
  155256. }
  155257. len += b & inflate_mask[j];
  155258. b >>= j;
  155259. k -= j;
  155260. need = dbits;
  155261. tree = dtree;
  155262. tree_index = dtree_index;
  155263. mode2 = DIST;
  155264. case DIST:
  155265. j = need;
  155266. while (k < j) {
  155267. if (n2 !== 0)
  155268. r2 = Z_OK;
  155269. else {
  155270. s2.bitb = b;
  155271. s2.bitk = k;
  155272. z.avail_in = n2;
  155273. z.total_in += p2 - z.next_in_index;
  155274. z.next_in_index = p2;
  155275. s2.write = q;
  155276. return s2.inflate_flush(z, r2);
  155277. }
  155278. n2--;
  155279. b |= (z.read_byte(p2++) & 255) << k;
  155280. k += 8;
  155281. }
  155282. tindex = (tree_index + (b & inflate_mask[j])) * 3;
  155283. b >>= tree[tindex + 1];
  155284. k -= tree[tindex + 1];
  155285. e2 = tree[tindex];
  155286. if ((e2 & 16) !== 0) {
  155287. get2 = e2 & 15;
  155288. dist = tree[tindex + 2];
  155289. mode2 = DISTEXT;
  155290. break;
  155291. }
  155292. if ((e2 & 64) === 0) {
  155293. need = e2;
  155294. tree_index = tindex / 3 + tree[tindex + 2];
  155295. break;
  155296. }
  155297. mode2 = BADCODE;
  155298. z.msg = "invalid distance code";
  155299. r2 = Z_DATA_ERROR;
  155300. s2.bitb = b;
  155301. s2.bitk = k;
  155302. z.avail_in = n2;
  155303. z.total_in += p2 - z.next_in_index;
  155304. z.next_in_index = p2;
  155305. s2.write = q;
  155306. return s2.inflate_flush(z, r2);
  155307. case DISTEXT:
  155308. j = get2;
  155309. while (k < j) {
  155310. if (n2 !== 0)
  155311. r2 = Z_OK;
  155312. else {
  155313. s2.bitb = b;
  155314. s2.bitk = k;
  155315. z.avail_in = n2;
  155316. z.total_in += p2 - z.next_in_index;
  155317. z.next_in_index = p2;
  155318. s2.write = q;
  155319. return s2.inflate_flush(z, r2);
  155320. }
  155321. n2--;
  155322. b |= (z.read_byte(p2++) & 255) << k;
  155323. k += 8;
  155324. }
  155325. dist += b & inflate_mask[j];
  155326. b >>= j;
  155327. k -= j;
  155328. mode2 = COPY;
  155329. case COPY:
  155330. f2 = q - dist;
  155331. while (f2 < 0) {
  155332. f2 += s2.end;
  155333. }
  155334. while (len !== 0) {
  155335. if (m === 0) {
  155336. if (q == s2.end && s2.read !== 0) {
  155337. q = 0;
  155338. m = q < s2.read ? s2.read - q - 1 : s2.end - q;
  155339. }
  155340. if (m === 0) {
  155341. s2.write = q;
  155342. r2 = s2.inflate_flush(z, r2);
  155343. q = s2.write;
  155344. m = q < s2.read ? s2.read - q - 1 : s2.end - q;
  155345. if (q == s2.end && s2.read !== 0) {
  155346. q = 0;
  155347. m = q < s2.read ? s2.read - q - 1 : s2.end - q;
  155348. }
  155349. if (m === 0) {
  155350. s2.bitb = b;
  155351. s2.bitk = k;
  155352. z.avail_in = n2;
  155353. z.total_in += p2 - z.next_in_index;
  155354. z.next_in_index = p2;
  155355. s2.write = q;
  155356. return s2.inflate_flush(z, r2);
  155357. }
  155358. }
  155359. }
  155360. s2.win[q++] = s2.win[f2++];
  155361. m--;
  155362. if (f2 == s2.end)
  155363. f2 = 0;
  155364. len--;
  155365. }
  155366. mode2 = START;
  155367. break;
  155368. case LIT:
  155369. if (m === 0) {
  155370. if (q == s2.end && s2.read !== 0) {
  155371. q = 0;
  155372. m = q < s2.read ? s2.read - q - 1 : s2.end - q;
  155373. }
  155374. if (m === 0) {
  155375. s2.write = q;
  155376. r2 = s2.inflate_flush(z, r2);
  155377. q = s2.write;
  155378. m = q < s2.read ? s2.read - q - 1 : s2.end - q;
  155379. if (q == s2.end && s2.read !== 0) {
  155380. q = 0;
  155381. m = q < s2.read ? s2.read - q - 1 : s2.end - q;
  155382. }
  155383. if (m === 0) {
  155384. s2.bitb = b;
  155385. s2.bitk = k;
  155386. z.avail_in = n2;
  155387. z.total_in += p2 - z.next_in_index;
  155388. z.next_in_index = p2;
  155389. s2.write = q;
  155390. return s2.inflate_flush(z, r2);
  155391. }
  155392. }
  155393. }
  155394. r2 = Z_OK;
  155395. s2.win[q++] = lit;
  155396. m--;
  155397. mode2 = START;
  155398. break;
  155399. case WASH:
  155400. if (k > 7) {
  155401. k -= 8;
  155402. n2++;
  155403. p2--;
  155404. }
  155405. s2.write = q;
  155406. r2 = s2.inflate_flush(z, r2);
  155407. q = s2.write;
  155408. m = q < s2.read ? s2.read - q - 1 : s2.end - q;
  155409. if (s2.read != s2.write) {
  155410. s2.bitb = b;
  155411. s2.bitk = k;
  155412. z.avail_in = n2;
  155413. z.total_in += p2 - z.next_in_index;
  155414. z.next_in_index = p2;
  155415. s2.write = q;
  155416. return s2.inflate_flush(z, r2);
  155417. }
  155418. mode2 = END;
  155419. case END:
  155420. r2 = Z_STREAM_END;
  155421. s2.bitb = b;
  155422. s2.bitk = k;
  155423. z.avail_in = n2;
  155424. z.total_in += p2 - z.next_in_index;
  155425. z.next_in_index = p2;
  155426. s2.write = q;
  155427. return s2.inflate_flush(z, r2);
  155428. case BADCODE:
  155429. r2 = Z_DATA_ERROR;
  155430. s2.bitb = b;
  155431. s2.bitk = k;
  155432. z.avail_in = n2;
  155433. z.total_in += p2 - z.next_in_index;
  155434. z.next_in_index = p2;
  155435. s2.write = q;
  155436. return s2.inflate_flush(z, r2);
  155437. default:
  155438. r2 = Z_STREAM_ERROR;
  155439. s2.bitb = b;
  155440. s2.bitk = k;
  155441. z.avail_in = n2;
  155442. z.total_in += p2 - z.next_in_index;
  155443. z.next_in_index = p2;
  155444. s2.write = q;
  155445. return s2.inflate_flush(z, r2);
  155446. }
  155447. }
  155448. };
  155449. that.free = function() {
  155450. };
  155451. }
  155452. var border = [
  155453. 16,
  155454. 17,
  155455. 18,
  155456. 0,
  155457. 8,
  155458. 7,
  155459. 9,
  155460. 6,
  155461. 10,
  155462. 5,
  155463. 11,
  155464. 4,
  155465. 12,
  155466. 3,
  155467. 13,
  155468. 2,
  155469. 14,
  155470. 1,
  155471. 15
  155472. ];
  155473. var TYPE = 0;
  155474. var LENS = 1;
  155475. var STORED = 2;
  155476. var TABLE = 3;
  155477. var BTREE = 4;
  155478. var DTREE = 5;
  155479. var CODES = 6;
  155480. var DRY = 7;
  155481. var DONELOCKS = 8;
  155482. var BADBLOCKS = 9;
  155483. function InfBlocks(z, w) {
  155484. const that = this;
  155485. let mode2 = TYPE;
  155486. let left = 0;
  155487. let table2 = 0;
  155488. let index2 = 0;
  155489. let blens;
  155490. const bb = [0];
  155491. const tb = [0];
  155492. const codes = new InfCodes();
  155493. let last = 0;
  155494. let hufts = new Int32Array(MANY * 3);
  155495. const check = 0;
  155496. const inftree = new InfTree();
  155497. that.bitk = 0;
  155498. that.bitb = 0;
  155499. that.win = new Uint8Array(w);
  155500. that.end = w;
  155501. that.read = 0;
  155502. that.write = 0;
  155503. that.reset = function(z2, c14) {
  155504. if (c14)
  155505. c14[0] = check;
  155506. if (mode2 == CODES) {
  155507. codes.free(z2);
  155508. }
  155509. mode2 = TYPE;
  155510. that.bitk = 0;
  155511. that.bitb = 0;
  155512. that.read = that.write = 0;
  155513. };
  155514. that.reset(z, null);
  155515. that.inflate_flush = function(z2, r2) {
  155516. let n2;
  155517. let p2;
  155518. let q;
  155519. p2 = z2.next_out_index;
  155520. q = that.read;
  155521. n2 = (q <= that.write ? that.write : that.end) - q;
  155522. if (n2 > z2.avail_out)
  155523. n2 = z2.avail_out;
  155524. if (n2 !== 0 && r2 == Z_BUF_ERROR)
  155525. r2 = Z_OK;
  155526. z2.avail_out -= n2;
  155527. z2.total_out += n2;
  155528. z2.next_out.set(that.win.subarray(q, q + n2), p2);
  155529. p2 += n2;
  155530. q += n2;
  155531. if (q == that.end) {
  155532. q = 0;
  155533. if (that.write == that.end)
  155534. that.write = 0;
  155535. n2 = that.write - q;
  155536. if (n2 > z2.avail_out)
  155537. n2 = z2.avail_out;
  155538. if (n2 !== 0 && r2 == Z_BUF_ERROR)
  155539. r2 = Z_OK;
  155540. z2.avail_out -= n2;
  155541. z2.total_out += n2;
  155542. z2.next_out.set(that.win.subarray(q, q + n2), p2);
  155543. p2 += n2;
  155544. q += n2;
  155545. }
  155546. z2.next_out_index = p2;
  155547. that.read = q;
  155548. return r2;
  155549. };
  155550. that.proc = function(z2, r2) {
  155551. let t;
  155552. let b;
  155553. let k;
  155554. let p2;
  155555. let n2;
  155556. let q;
  155557. let m;
  155558. let i2;
  155559. p2 = z2.next_in_index;
  155560. n2 = z2.avail_in;
  155561. b = that.bitb;
  155562. k = that.bitk;
  155563. q = that.write;
  155564. m = q < that.read ? that.read - q - 1 : that.end - q;
  155565. while (true) {
  155566. let bl, bd, tl, td, bl_, bd_, tl_, td_;
  155567. switch (mode2) {
  155568. case TYPE:
  155569. while (k < 3) {
  155570. if (n2 !== 0) {
  155571. r2 = Z_OK;
  155572. } else {
  155573. that.bitb = b;
  155574. that.bitk = k;
  155575. z2.avail_in = n2;
  155576. z2.total_in += p2 - z2.next_in_index;
  155577. z2.next_in_index = p2;
  155578. that.write = q;
  155579. return that.inflate_flush(z2, r2);
  155580. }
  155581. n2--;
  155582. b |= (z2.read_byte(p2++) & 255) << k;
  155583. k += 8;
  155584. }
  155585. t = b & 7;
  155586. last = t & 1;
  155587. switch (t >>> 1) {
  155588. case 0:
  155589. b >>>= 3;
  155590. k -= 3;
  155591. t = k & 7;
  155592. b >>>= t;
  155593. k -= t;
  155594. mode2 = LENS;
  155595. break;
  155596. case 1:
  155597. bl = [];
  155598. bd = [];
  155599. tl = [[]];
  155600. td = [[]];
  155601. InfTree.inflate_trees_fixed(bl, bd, tl, td);
  155602. codes.init(bl[0], bd[0], tl[0], 0, td[0], 0);
  155603. b >>>= 3;
  155604. k -= 3;
  155605. mode2 = CODES;
  155606. break;
  155607. case 2:
  155608. b >>>= 3;
  155609. k -= 3;
  155610. mode2 = TABLE;
  155611. break;
  155612. case 3:
  155613. b >>>= 3;
  155614. k -= 3;
  155615. mode2 = BADBLOCKS;
  155616. z2.msg = "invalid block type";
  155617. r2 = Z_DATA_ERROR;
  155618. that.bitb = b;
  155619. that.bitk = k;
  155620. z2.avail_in = n2;
  155621. z2.total_in += p2 - z2.next_in_index;
  155622. z2.next_in_index = p2;
  155623. that.write = q;
  155624. return that.inflate_flush(z2, r2);
  155625. }
  155626. break;
  155627. case LENS:
  155628. while (k < 32) {
  155629. if (n2 !== 0) {
  155630. r2 = Z_OK;
  155631. } else {
  155632. that.bitb = b;
  155633. that.bitk = k;
  155634. z2.avail_in = n2;
  155635. z2.total_in += p2 - z2.next_in_index;
  155636. z2.next_in_index = p2;
  155637. that.write = q;
  155638. return that.inflate_flush(z2, r2);
  155639. }
  155640. n2--;
  155641. b |= (z2.read_byte(p2++) & 255) << k;
  155642. k += 8;
  155643. }
  155644. if ((~b >>> 16 & 65535) != (b & 65535)) {
  155645. mode2 = BADBLOCKS;
  155646. z2.msg = "invalid stored block lengths";
  155647. r2 = Z_DATA_ERROR;
  155648. that.bitb = b;
  155649. that.bitk = k;
  155650. z2.avail_in = n2;
  155651. z2.total_in += p2 - z2.next_in_index;
  155652. z2.next_in_index = p2;
  155653. that.write = q;
  155654. return that.inflate_flush(z2, r2);
  155655. }
  155656. left = b & 65535;
  155657. b = k = 0;
  155658. mode2 = left !== 0 ? STORED : last !== 0 ? DRY : TYPE;
  155659. break;
  155660. case STORED:
  155661. if (n2 === 0) {
  155662. that.bitb = b;
  155663. that.bitk = k;
  155664. z2.avail_in = n2;
  155665. z2.total_in += p2 - z2.next_in_index;
  155666. z2.next_in_index = p2;
  155667. that.write = q;
  155668. return that.inflate_flush(z2, r2);
  155669. }
  155670. if (m === 0) {
  155671. if (q == that.end && that.read !== 0) {
  155672. q = 0;
  155673. m = q < that.read ? that.read - q - 1 : that.end - q;
  155674. }
  155675. if (m === 0) {
  155676. that.write = q;
  155677. r2 = that.inflate_flush(z2, r2);
  155678. q = that.write;
  155679. m = q < that.read ? that.read - q - 1 : that.end - q;
  155680. if (q == that.end && that.read !== 0) {
  155681. q = 0;
  155682. m = q < that.read ? that.read - q - 1 : that.end - q;
  155683. }
  155684. if (m === 0) {
  155685. that.bitb = b;
  155686. that.bitk = k;
  155687. z2.avail_in = n2;
  155688. z2.total_in += p2 - z2.next_in_index;
  155689. z2.next_in_index = p2;
  155690. that.write = q;
  155691. return that.inflate_flush(z2, r2);
  155692. }
  155693. }
  155694. }
  155695. r2 = Z_OK;
  155696. t = left;
  155697. if (t > n2)
  155698. t = n2;
  155699. if (t > m)
  155700. t = m;
  155701. that.win.set(z2.read_buf(p2, t), q);
  155702. p2 += t;
  155703. n2 -= t;
  155704. q += t;
  155705. m -= t;
  155706. if ((left -= t) !== 0)
  155707. break;
  155708. mode2 = last !== 0 ? DRY : TYPE;
  155709. break;
  155710. case TABLE:
  155711. while (k < 14) {
  155712. if (n2 !== 0) {
  155713. r2 = Z_OK;
  155714. } else {
  155715. that.bitb = b;
  155716. that.bitk = k;
  155717. z2.avail_in = n2;
  155718. z2.total_in += p2 - z2.next_in_index;
  155719. z2.next_in_index = p2;
  155720. that.write = q;
  155721. return that.inflate_flush(z2, r2);
  155722. }
  155723. n2--;
  155724. b |= (z2.read_byte(p2++) & 255) << k;
  155725. k += 8;
  155726. }
  155727. table2 = t = b & 16383;
  155728. if ((t & 31) > 29 || (t >> 5 & 31) > 29) {
  155729. mode2 = BADBLOCKS;
  155730. z2.msg = "too many length or distance symbols";
  155731. r2 = Z_DATA_ERROR;
  155732. that.bitb = b;
  155733. that.bitk = k;
  155734. z2.avail_in = n2;
  155735. z2.total_in += p2 - z2.next_in_index;
  155736. z2.next_in_index = p2;
  155737. that.write = q;
  155738. return that.inflate_flush(z2, r2);
  155739. }
  155740. t = 258 + (t & 31) + (t >> 5 & 31);
  155741. if (!blens || blens.length < t) {
  155742. blens = [];
  155743. } else {
  155744. for (i2 = 0; i2 < t; i2++) {
  155745. blens[i2] = 0;
  155746. }
  155747. }
  155748. b >>>= 14;
  155749. k -= 14;
  155750. index2 = 0;
  155751. mode2 = BTREE;
  155752. case BTREE:
  155753. while (index2 < 4 + (table2 >>> 10)) {
  155754. while (k < 3) {
  155755. if (n2 !== 0) {
  155756. r2 = Z_OK;
  155757. } else {
  155758. that.bitb = b;
  155759. that.bitk = k;
  155760. z2.avail_in = n2;
  155761. z2.total_in += p2 - z2.next_in_index;
  155762. z2.next_in_index = p2;
  155763. that.write = q;
  155764. return that.inflate_flush(z2, r2);
  155765. }
  155766. n2--;
  155767. b |= (z2.read_byte(p2++) & 255) << k;
  155768. k += 8;
  155769. }
  155770. blens[border[index2++]] = b & 7;
  155771. b >>>= 3;
  155772. k -= 3;
  155773. }
  155774. while (index2 < 19) {
  155775. blens[border[index2++]] = 0;
  155776. }
  155777. bb[0] = 7;
  155778. t = inftree.inflate_trees_bits(blens, bb, tb, hufts, z2);
  155779. if (t != Z_OK) {
  155780. r2 = t;
  155781. if (r2 == Z_DATA_ERROR) {
  155782. blens = null;
  155783. mode2 = BADBLOCKS;
  155784. }
  155785. that.bitb = b;
  155786. that.bitk = k;
  155787. z2.avail_in = n2;
  155788. z2.total_in += p2 - z2.next_in_index;
  155789. z2.next_in_index = p2;
  155790. that.write = q;
  155791. return that.inflate_flush(z2, r2);
  155792. }
  155793. index2 = 0;
  155794. mode2 = DTREE;
  155795. case DTREE:
  155796. while (true) {
  155797. t = table2;
  155798. if (index2 >= 258 + (t & 31) + (t >> 5 & 31)) {
  155799. break;
  155800. }
  155801. let j, c14;
  155802. t = bb[0];
  155803. while (k < t) {
  155804. if (n2 !== 0) {
  155805. r2 = Z_OK;
  155806. } else {
  155807. that.bitb = b;
  155808. that.bitk = k;
  155809. z2.avail_in = n2;
  155810. z2.total_in += p2 - z2.next_in_index;
  155811. z2.next_in_index = p2;
  155812. that.write = q;
  155813. return that.inflate_flush(z2, r2);
  155814. }
  155815. n2--;
  155816. b |= (z2.read_byte(p2++) & 255) << k;
  155817. k += 8;
  155818. }
  155819. t = hufts[(tb[0] + (b & inflate_mask[t])) * 3 + 1];
  155820. c14 = hufts[(tb[0] + (b & inflate_mask[t])) * 3 + 2];
  155821. if (c14 < 16) {
  155822. b >>>= t;
  155823. k -= t;
  155824. blens[index2++] = c14;
  155825. } else {
  155826. i2 = c14 == 18 ? 7 : c14 - 14;
  155827. j = c14 == 18 ? 11 : 3;
  155828. while (k < t + i2) {
  155829. if (n2 !== 0) {
  155830. r2 = Z_OK;
  155831. } else {
  155832. that.bitb = b;
  155833. that.bitk = k;
  155834. z2.avail_in = n2;
  155835. z2.total_in += p2 - z2.next_in_index;
  155836. z2.next_in_index = p2;
  155837. that.write = q;
  155838. return that.inflate_flush(z2, r2);
  155839. }
  155840. n2--;
  155841. b |= (z2.read_byte(p2++) & 255) << k;
  155842. k += 8;
  155843. }
  155844. b >>>= t;
  155845. k -= t;
  155846. j += b & inflate_mask[i2];
  155847. b >>>= i2;
  155848. k -= i2;
  155849. i2 = index2;
  155850. t = table2;
  155851. if (i2 + j > 258 + (t & 31) + (t >> 5 & 31) || c14 == 16 && i2 < 1) {
  155852. blens = null;
  155853. mode2 = BADBLOCKS;
  155854. z2.msg = "invalid bit length repeat";
  155855. r2 = Z_DATA_ERROR;
  155856. that.bitb = b;
  155857. that.bitk = k;
  155858. z2.avail_in = n2;
  155859. z2.total_in += p2 - z2.next_in_index;
  155860. z2.next_in_index = p2;
  155861. that.write = q;
  155862. return that.inflate_flush(z2, r2);
  155863. }
  155864. c14 = c14 == 16 ? blens[i2 - 1] : 0;
  155865. do {
  155866. blens[i2++] = c14;
  155867. } while (--j !== 0);
  155868. index2 = i2;
  155869. }
  155870. }
  155871. tb[0] = -1;
  155872. bl_ = [];
  155873. bd_ = [];
  155874. tl_ = [];
  155875. td_ = [];
  155876. bl_[0] = 9;
  155877. bd_[0] = 6;
  155878. t = table2;
  155879. t = inftree.inflate_trees_dynamic(257 + (t & 31), 1 + (t >> 5 & 31), blens, bl_, bd_, tl_, td_, hufts, z2);
  155880. if (t != Z_OK) {
  155881. if (t == Z_DATA_ERROR) {
  155882. blens = null;
  155883. mode2 = BADBLOCKS;
  155884. }
  155885. r2 = t;
  155886. that.bitb = b;
  155887. that.bitk = k;
  155888. z2.avail_in = n2;
  155889. z2.total_in += p2 - z2.next_in_index;
  155890. z2.next_in_index = p2;
  155891. that.write = q;
  155892. return that.inflate_flush(z2, r2);
  155893. }
  155894. codes.init(bl_[0], bd_[0], hufts, tl_[0], hufts, td_[0]);
  155895. mode2 = CODES;
  155896. case CODES:
  155897. that.bitb = b;
  155898. that.bitk = k;
  155899. z2.avail_in = n2;
  155900. z2.total_in += p2 - z2.next_in_index;
  155901. z2.next_in_index = p2;
  155902. that.write = q;
  155903. if ((r2 = codes.proc(that, z2, r2)) != Z_STREAM_END) {
  155904. return that.inflate_flush(z2, r2);
  155905. }
  155906. r2 = Z_OK;
  155907. codes.free(z2);
  155908. p2 = z2.next_in_index;
  155909. n2 = z2.avail_in;
  155910. b = that.bitb;
  155911. k = that.bitk;
  155912. q = that.write;
  155913. m = q < that.read ? that.read - q - 1 : that.end - q;
  155914. if (last === 0) {
  155915. mode2 = TYPE;
  155916. break;
  155917. }
  155918. mode2 = DRY;
  155919. case DRY:
  155920. that.write = q;
  155921. r2 = that.inflate_flush(z2, r2);
  155922. q = that.write;
  155923. m = q < that.read ? that.read - q - 1 : that.end - q;
  155924. if (that.read != that.write) {
  155925. that.bitb = b;
  155926. that.bitk = k;
  155927. z2.avail_in = n2;
  155928. z2.total_in += p2 - z2.next_in_index;
  155929. z2.next_in_index = p2;
  155930. that.write = q;
  155931. return that.inflate_flush(z2, r2);
  155932. }
  155933. mode2 = DONELOCKS;
  155934. case DONELOCKS:
  155935. r2 = Z_STREAM_END;
  155936. that.bitb = b;
  155937. that.bitk = k;
  155938. z2.avail_in = n2;
  155939. z2.total_in += p2 - z2.next_in_index;
  155940. z2.next_in_index = p2;
  155941. that.write = q;
  155942. return that.inflate_flush(z2, r2);
  155943. case BADBLOCKS:
  155944. r2 = Z_DATA_ERROR;
  155945. that.bitb = b;
  155946. that.bitk = k;
  155947. z2.avail_in = n2;
  155948. z2.total_in += p2 - z2.next_in_index;
  155949. z2.next_in_index = p2;
  155950. that.write = q;
  155951. return that.inflate_flush(z2, r2);
  155952. default:
  155953. r2 = Z_STREAM_ERROR;
  155954. that.bitb = b;
  155955. that.bitk = k;
  155956. z2.avail_in = n2;
  155957. z2.total_in += p2 - z2.next_in_index;
  155958. z2.next_in_index = p2;
  155959. that.write = q;
  155960. return that.inflate_flush(z2, r2);
  155961. }
  155962. }
  155963. };
  155964. that.free = function(z2) {
  155965. that.reset(z2, null);
  155966. that.win = null;
  155967. hufts = null;
  155968. };
  155969. that.set_dictionary = function(d, start, n2) {
  155970. that.win.set(d.subarray(start, start + n2), 0);
  155971. that.read = that.write = n2;
  155972. };
  155973. that.sync_point = function() {
  155974. return mode2 == LENS ? 1 : 0;
  155975. };
  155976. }
  155977. var PRESET_DICT = 32;
  155978. var Z_DEFLATED = 8;
  155979. var METHOD = 0;
  155980. var FLAG = 1;
  155981. var DICT4 = 2;
  155982. var DICT3 = 3;
  155983. var DICT2 = 4;
  155984. var DICT1 = 5;
  155985. var DICT0 = 6;
  155986. var BLOCKS = 7;
  155987. var DONE = 12;
  155988. var BAD = 13;
  155989. var mark = [0, 0, 255, 255];
  155990. function Inflate$1() {
  155991. const that = this;
  155992. that.mode = 0;
  155993. that.method = 0;
  155994. that.was = [0];
  155995. that.need = 0;
  155996. that.marker = 0;
  155997. that.wbits = 0;
  155998. function inflateReset3(z) {
  155999. if (!z || !z.istate)
  156000. return Z_STREAM_ERROR;
  156001. z.total_in = z.total_out = 0;
  156002. z.msg = null;
  156003. z.istate.mode = BLOCKS;
  156004. z.istate.blocks.reset(z, null);
  156005. return Z_OK;
  156006. }
  156007. that.inflateEnd = function(z) {
  156008. if (that.blocks)
  156009. that.blocks.free(z);
  156010. that.blocks = null;
  156011. return Z_OK;
  156012. };
  156013. that.inflateInit = function(z, w) {
  156014. z.msg = null;
  156015. that.blocks = null;
  156016. if (w < 8 || w > 15) {
  156017. that.inflateEnd(z);
  156018. return Z_STREAM_ERROR;
  156019. }
  156020. that.wbits = w;
  156021. z.istate.blocks = new InfBlocks(z, 1 << w);
  156022. inflateReset3(z);
  156023. return Z_OK;
  156024. };
  156025. that.inflate = function(z, f2) {
  156026. let r2;
  156027. let b;
  156028. if (!z || !z.istate || !z.next_in)
  156029. return Z_STREAM_ERROR;
  156030. const istate = z.istate;
  156031. f2 = f2 == Z_FINISH ? Z_BUF_ERROR : Z_OK;
  156032. r2 = Z_BUF_ERROR;
  156033. while (true) {
  156034. switch (istate.mode) {
  156035. case METHOD:
  156036. if (z.avail_in === 0)
  156037. return r2;
  156038. r2 = f2;
  156039. z.avail_in--;
  156040. z.total_in++;
  156041. if (((istate.method = z.read_byte(z.next_in_index++)) & 15) != Z_DEFLATED) {
  156042. istate.mode = BAD;
  156043. z.msg = "unknown compression method";
  156044. istate.marker = 5;
  156045. break;
  156046. }
  156047. if ((istate.method >> 4) + 8 > istate.wbits) {
  156048. istate.mode = BAD;
  156049. z.msg = "invalid win size";
  156050. istate.marker = 5;
  156051. break;
  156052. }
  156053. istate.mode = FLAG;
  156054. case FLAG:
  156055. if (z.avail_in === 0)
  156056. return r2;
  156057. r2 = f2;
  156058. z.avail_in--;
  156059. z.total_in++;
  156060. b = z.read_byte(z.next_in_index++) & 255;
  156061. if (((istate.method << 8) + b) % 31 !== 0) {
  156062. istate.mode = BAD;
  156063. z.msg = "incorrect header check";
  156064. istate.marker = 5;
  156065. break;
  156066. }
  156067. if ((b & PRESET_DICT) === 0) {
  156068. istate.mode = BLOCKS;
  156069. break;
  156070. }
  156071. istate.mode = DICT4;
  156072. case DICT4:
  156073. if (z.avail_in === 0)
  156074. return r2;
  156075. r2 = f2;
  156076. z.avail_in--;
  156077. z.total_in++;
  156078. istate.need = (z.read_byte(z.next_in_index++) & 255) << 24 & 4278190080;
  156079. istate.mode = DICT3;
  156080. case DICT3:
  156081. if (z.avail_in === 0)
  156082. return r2;
  156083. r2 = f2;
  156084. z.avail_in--;
  156085. z.total_in++;
  156086. istate.need += (z.read_byte(z.next_in_index++) & 255) << 16 & 16711680;
  156087. istate.mode = DICT2;
  156088. case DICT2:
  156089. if (z.avail_in === 0)
  156090. return r2;
  156091. r2 = f2;
  156092. z.avail_in--;
  156093. z.total_in++;
  156094. istate.need += (z.read_byte(z.next_in_index++) & 255) << 8 & 65280;
  156095. istate.mode = DICT1;
  156096. case DICT1:
  156097. if (z.avail_in === 0)
  156098. return r2;
  156099. r2 = f2;
  156100. z.avail_in--;
  156101. z.total_in++;
  156102. istate.need += z.read_byte(z.next_in_index++) & 255;
  156103. istate.mode = DICT0;
  156104. return Z_NEED_DICT;
  156105. case DICT0:
  156106. istate.mode = BAD;
  156107. z.msg = "need dictionary";
  156108. istate.marker = 0;
  156109. return Z_STREAM_ERROR;
  156110. case BLOCKS:
  156111. r2 = istate.blocks.proc(z, r2);
  156112. if (r2 == Z_DATA_ERROR) {
  156113. istate.mode = BAD;
  156114. istate.marker = 0;
  156115. break;
  156116. }
  156117. if (r2 == Z_OK) {
  156118. r2 = f2;
  156119. }
  156120. if (r2 != Z_STREAM_END) {
  156121. return r2;
  156122. }
  156123. r2 = f2;
  156124. istate.blocks.reset(z, istate.was);
  156125. istate.mode = DONE;
  156126. case DONE:
  156127. z.avail_in = 0;
  156128. return Z_STREAM_END;
  156129. case BAD:
  156130. return Z_DATA_ERROR;
  156131. default:
  156132. return Z_STREAM_ERROR;
  156133. }
  156134. }
  156135. };
  156136. that.inflateSetDictionary = function(z, dictionary, dictLength) {
  156137. let index2 = 0, length3 = dictLength;
  156138. if (!z || !z.istate || z.istate.mode != DICT0)
  156139. return Z_STREAM_ERROR;
  156140. const istate = z.istate;
  156141. if (length3 >= 1 << istate.wbits) {
  156142. length3 = (1 << istate.wbits) - 1;
  156143. index2 = dictLength - length3;
  156144. }
  156145. istate.blocks.set_dictionary(dictionary, index2, length3);
  156146. istate.mode = BLOCKS;
  156147. return Z_OK;
  156148. };
  156149. that.inflateSync = function(z) {
  156150. let n2;
  156151. let p2;
  156152. let m;
  156153. let r2, w;
  156154. if (!z || !z.istate)
  156155. return Z_STREAM_ERROR;
  156156. const istate = z.istate;
  156157. if (istate.mode != BAD) {
  156158. istate.mode = BAD;
  156159. istate.marker = 0;
  156160. }
  156161. if ((n2 = z.avail_in) === 0)
  156162. return Z_BUF_ERROR;
  156163. p2 = z.next_in_index;
  156164. m = istate.marker;
  156165. while (n2 !== 0 && m < 4) {
  156166. if (z.read_byte(p2) == mark[m]) {
  156167. m++;
  156168. } else if (z.read_byte(p2) !== 0) {
  156169. m = 0;
  156170. } else {
  156171. m = 4 - m;
  156172. }
  156173. p2++;
  156174. n2--;
  156175. }
  156176. z.total_in += p2 - z.next_in_index;
  156177. z.next_in_index = p2;
  156178. z.avail_in = n2;
  156179. istate.marker = m;
  156180. if (m != 4) {
  156181. return Z_DATA_ERROR;
  156182. }
  156183. r2 = z.total_in;
  156184. w = z.total_out;
  156185. inflateReset3(z);
  156186. z.total_in = r2;
  156187. z.total_out = w;
  156188. istate.mode = BLOCKS;
  156189. return Z_OK;
  156190. };
  156191. that.inflateSyncPoint = function(z) {
  156192. if (!z || !z.istate || !z.istate.blocks)
  156193. return Z_STREAM_ERROR;
  156194. return z.istate.blocks.sync_point();
  156195. };
  156196. }
  156197. function ZStream() {
  156198. }
  156199. ZStream.prototype = {
  156200. inflateInit: function(bits) {
  156201. const that = this;
  156202. that.istate = new Inflate$1();
  156203. if (!bits)
  156204. bits = MAX_BITS;
  156205. return that.istate.inflateInit(that, bits);
  156206. },
  156207. inflate: function(f2) {
  156208. const that = this;
  156209. if (!that.istate)
  156210. return Z_STREAM_ERROR;
  156211. return that.istate.inflate(that, f2);
  156212. },
  156213. inflateEnd: function() {
  156214. const that = this;
  156215. if (!that.istate)
  156216. return Z_STREAM_ERROR;
  156217. const ret = that.istate.inflateEnd(that);
  156218. that.istate = null;
  156219. return ret;
  156220. },
  156221. inflateSync: function() {
  156222. const that = this;
  156223. if (!that.istate)
  156224. return Z_STREAM_ERROR;
  156225. return that.istate.inflateSync(that);
  156226. },
  156227. inflateSetDictionary: function(dictionary, dictLength) {
  156228. const that = this;
  156229. if (!that.istate)
  156230. return Z_STREAM_ERROR;
  156231. return that.istate.inflateSetDictionary(that, dictionary, dictLength);
  156232. },
  156233. read_byte: function(start) {
  156234. const that = this;
  156235. return that.next_in[start];
  156236. },
  156237. read_buf: function(start, size) {
  156238. const that = this;
  156239. return that.next_in.subarray(start, start + size);
  156240. }
  156241. };
  156242. function ZipInflate(options) {
  156243. const that = this;
  156244. const z = new ZStream();
  156245. const bufsize = options && options.chunkSize ? Math.floor(options.chunkSize * 2) : 128 * 1024;
  156246. const flush = Z_NO_FLUSH;
  156247. const buf = new Uint8Array(bufsize);
  156248. let nomoreinput = false;
  156249. z.inflateInit();
  156250. z.next_out = buf;
  156251. that.append = function(data, onprogress) {
  156252. const buffers = [];
  156253. let err, array, lastIndex = 0, bufferIndex = 0, bufferSize = 0;
  156254. if (data.length === 0)
  156255. return;
  156256. z.next_in_index = 0;
  156257. z.next_in = data;
  156258. z.avail_in = data.length;
  156259. do {
  156260. z.next_out_index = 0;
  156261. z.avail_out = bufsize;
  156262. if (z.avail_in === 0 && !nomoreinput) {
  156263. z.next_in_index = 0;
  156264. nomoreinput = true;
  156265. }
  156266. err = z.inflate(flush);
  156267. if (nomoreinput && err === Z_BUF_ERROR) {
  156268. if (z.avail_in !== 0)
  156269. throw new Error("inflating: bad input");
  156270. } else if (err !== Z_OK && err !== Z_STREAM_END)
  156271. throw new Error("inflating: " + z.msg);
  156272. if ((nomoreinput || err === Z_STREAM_END) && z.avail_in === data.length)
  156273. throw new Error("inflating: bad input");
  156274. if (z.next_out_index)
  156275. if (z.next_out_index === bufsize)
  156276. buffers.push(new Uint8Array(buf));
  156277. else
  156278. buffers.push(buf.slice(0, z.next_out_index));
  156279. bufferSize += z.next_out_index;
  156280. if (onprogress && z.next_in_index > 0 && z.next_in_index != lastIndex) {
  156281. onprogress(z.next_in_index);
  156282. lastIndex = z.next_in_index;
  156283. }
  156284. } while (z.avail_in > 0 || z.avail_out === 0);
  156285. if (buffers.length > 1) {
  156286. array = new Uint8Array(bufferSize);
  156287. buffers.forEach(function(chunk) {
  156288. array.set(chunk, bufferIndex);
  156289. bufferIndex += chunk.length;
  156290. });
  156291. } else {
  156292. array = buffers[0] || new Uint8Array(0);
  156293. }
  156294. return array;
  156295. };
  156296. that.flush = function() {
  156297. z.inflateEnd();
  156298. };
  156299. }
  156300. var DEFAULT_CONFIGURATION = {
  156301. chunkSize: 512 * 1024,
  156302. maxWorkers: typeof navigator != "undefined" && navigator.hardwareConcurrency || 2,
  156303. terminateWorkerTimeout: 5e3,
  156304. useWebWorkers: true,
  156305. workerScripts: void 0
  156306. };
  156307. var config = Object.assign({}, DEFAULT_CONFIGURATION);
  156308. function getConfiguration() {
  156309. return config;
  156310. }
  156311. function configure(configuration) {
  156312. if (configuration.baseURL !== void 0) {
  156313. config.baseURL = configuration.baseURL;
  156314. }
  156315. if (configuration.chunkSize !== void 0) {
  156316. config.chunkSize = configuration.chunkSize;
  156317. }
  156318. if (configuration.maxWorkers !== void 0) {
  156319. config.maxWorkers = configuration.maxWorkers;
  156320. }
  156321. if (configuration.terminateWorkerTimeout !== void 0) {
  156322. config.terminateWorkerTimeout = configuration.terminateWorkerTimeout;
  156323. }
  156324. if (configuration.useWebWorkers !== void 0) {
  156325. config.useWebWorkers = configuration.useWebWorkers;
  156326. }
  156327. if (configuration.Deflate !== void 0) {
  156328. config.Deflate = configuration.Deflate;
  156329. }
  156330. if (configuration.Inflate !== void 0) {
  156331. config.Inflate = configuration.Inflate;
  156332. }
  156333. if (configuration.workerScripts !== void 0) {
  156334. if (configuration.workerScripts.deflate) {
  156335. if (!Array.isArray(configuration.workerScripts.deflate)) {
  156336. throw new Error("workerScripts.deflate must be an array");
  156337. }
  156338. if (!config.workerScripts) {
  156339. config.workerScripts = {};
  156340. }
  156341. config.workerScripts.deflate = configuration.workerScripts.deflate;
  156342. }
  156343. if (configuration.workerScripts.inflate) {
  156344. if (!Array.isArray(configuration.workerScripts.inflate)) {
  156345. throw new Error("workerScripts.inflate must be an array");
  156346. }
  156347. if (!config.workerScripts) {
  156348. config.workerScripts = {};
  156349. }
  156350. config.workerScripts.inflate = configuration.workerScripts.inflate;
  156351. }
  156352. }
  156353. }
  156354. function getMimeType() {
  156355. return "application/octet-stream";
  156356. }
  156357. var table = [];
  156358. for (let i2 = 0; i2 < 256; i2++) {
  156359. let t = i2;
  156360. for (let j = 0; j < 8; j++) {
  156361. if (t & 1) {
  156362. t = t >>> 1 ^ 3988292384;
  156363. } else {
  156364. t = t >>> 1;
  156365. }
  156366. }
  156367. table[i2] = t;
  156368. }
  156369. var Crc32 = class {
  156370. constructor(crc) {
  156371. this.crc = crc || -1;
  156372. }
  156373. append(data) {
  156374. let crc = this.crc | 0;
  156375. for (let offset2 = 0, length3 = data.length | 0; offset2 < length3; offset2++) {
  156376. crc = crc >>> 8 ^ table[(crc ^ data[offset2]) & 255];
  156377. }
  156378. this.crc = crc;
  156379. }
  156380. get() {
  156381. return ~this.crc;
  156382. }
  156383. };
  156384. function encodeText(value) {
  156385. if (typeof TextEncoder == "undefined") {
  156386. value = unescape(encodeURIComponent(value));
  156387. const result = new Uint8Array(value.length);
  156388. for (let i2 = 0; i2 < result.length; i2++) {
  156389. result[i2] = value.charCodeAt(i2);
  156390. }
  156391. return result;
  156392. } else {
  156393. return new TextEncoder().encode(value);
  156394. }
  156395. }
  156396. var bitArray = {
  156397. concat(a1, a22) {
  156398. if (a1.length === 0 || a22.length === 0) {
  156399. return a1.concat(a22);
  156400. }
  156401. const last = a1[a1.length - 1], shift = bitArray.getPartial(last);
  156402. if (shift === 32) {
  156403. return a1.concat(a22);
  156404. } else {
  156405. return bitArray._shiftRight(a22, shift, last | 0, a1.slice(0, a1.length - 1));
  156406. }
  156407. },
  156408. bitLength(a4) {
  156409. const l2 = a4.length;
  156410. if (l2 === 0) {
  156411. return 0;
  156412. }
  156413. const x = a4[l2 - 1];
  156414. return (l2 - 1) * 32 + bitArray.getPartial(x);
  156415. },
  156416. clamp(a4, len) {
  156417. if (a4.length * 32 < len) {
  156418. return a4;
  156419. }
  156420. a4 = a4.slice(0, Math.ceil(len / 32));
  156421. const l2 = a4.length;
  156422. len = len & 31;
  156423. if (l2 > 0 && len) {
  156424. a4[l2 - 1] = bitArray.partial(len, a4[l2 - 1] & 2147483648 >> len - 1, 1);
  156425. }
  156426. return a4;
  156427. },
  156428. partial(len, x, _end) {
  156429. if (len === 32) {
  156430. return x;
  156431. }
  156432. return (_end ? x | 0 : x << 32 - len) + len * 1099511627776;
  156433. },
  156434. getPartial(x) {
  156435. return Math.round(x / 1099511627776) || 32;
  156436. },
  156437. _shiftRight(a4, shift, carry, out) {
  156438. if (out === void 0) {
  156439. out = [];
  156440. }
  156441. for (; shift >= 32; shift -= 32) {
  156442. out.push(carry);
  156443. carry = 0;
  156444. }
  156445. if (shift === 0) {
  156446. return out.concat(a4);
  156447. }
  156448. for (let i2 = 0; i2 < a4.length; i2++) {
  156449. out.push(carry | a4[i2] >>> shift);
  156450. carry = a4[i2] << 32 - shift;
  156451. }
  156452. const last2 = a4.length ? a4[a4.length - 1] : 0;
  156453. const shift2 = bitArray.getPartial(last2);
  156454. out.push(bitArray.partial(shift + shift2 & 31, shift + shift2 > 32 ? carry : out.pop(), 1));
  156455. return out;
  156456. }
  156457. };
  156458. var codec = {
  156459. bytes: {
  156460. fromBits(arr) {
  156461. const bl = bitArray.bitLength(arr);
  156462. const byteLength = bl / 8;
  156463. const out = new Uint8Array(byteLength);
  156464. let tmp2;
  156465. for (let i2 = 0; i2 < byteLength; i2++) {
  156466. if ((i2 & 3) === 0) {
  156467. tmp2 = arr[i2 / 4];
  156468. }
  156469. out[i2] = tmp2 >>> 24;
  156470. tmp2 <<= 8;
  156471. }
  156472. return out;
  156473. },
  156474. toBits(bytes) {
  156475. const out = [];
  156476. let i2;
  156477. let tmp2 = 0;
  156478. for (i2 = 0; i2 < bytes.length; i2++) {
  156479. tmp2 = tmp2 << 8 | bytes[i2];
  156480. if ((i2 & 3) === 3) {
  156481. out.push(tmp2);
  156482. tmp2 = 0;
  156483. }
  156484. }
  156485. if (i2 & 3) {
  156486. out.push(bitArray.partial(8 * (i2 & 3), tmp2));
  156487. }
  156488. return out;
  156489. }
  156490. }
  156491. };
  156492. var hash = {};
  156493. hash.sha1 = function(hash2) {
  156494. if (hash2) {
  156495. this._h = hash2._h.slice(0);
  156496. this._buffer = hash2._buffer.slice(0);
  156497. this._length = hash2._length;
  156498. } else {
  156499. this.reset();
  156500. }
  156501. };
  156502. hash.sha1.prototype = {
  156503. blockSize: 512,
  156504. reset: function() {
  156505. const sha1 = this;
  156506. sha1._h = this._init.slice(0);
  156507. sha1._buffer = [];
  156508. sha1._length = 0;
  156509. return sha1;
  156510. },
  156511. update: function(data) {
  156512. const sha1 = this;
  156513. if (typeof data === "string") {
  156514. data = codec.utf8String.toBits(data);
  156515. }
  156516. const b = sha1._buffer = bitArray.concat(sha1._buffer, data);
  156517. const ol = sha1._length;
  156518. const nl = sha1._length = ol + bitArray.bitLength(data);
  156519. if (nl > 9007199254740991) {
  156520. throw new Error("Cannot hash more than 2^53 - 1 bits");
  156521. }
  156522. const c14 = new Uint32Array(b);
  156523. let j = 0;
  156524. for (let i2 = sha1.blockSize + ol - (sha1.blockSize + ol & sha1.blockSize - 1); i2 <= nl; i2 += sha1.blockSize) {
  156525. sha1._block(c14.subarray(16 * j, 16 * (j + 1)));
  156526. j += 1;
  156527. }
  156528. b.splice(0, 16 * j);
  156529. return sha1;
  156530. },
  156531. finalize: function() {
  156532. const sha1 = this;
  156533. let b = sha1._buffer;
  156534. const h = sha1._h;
  156535. b = bitArray.concat(b, [bitArray.partial(1, 1)]);
  156536. for (let i2 = b.length + 2; i2 & 15; i2++) {
  156537. b.push(0);
  156538. }
  156539. b.push(Math.floor(sha1._length / 4294967296));
  156540. b.push(sha1._length | 0);
  156541. while (b.length) {
  156542. sha1._block(b.splice(0, 16));
  156543. }
  156544. sha1.reset();
  156545. return h;
  156546. },
  156547. _init: [1732584193, 4023233417, 2562383102, 271733878, 3285377520],
  156548. _key: [1518500249, 1859775393, 2400959708, 3395469782],
  156549. _f: function(t, b, c14, d) {
  156550. if (t <= 19) {
  156551. return b & c14 | ~b & d;
  156552. } else if (t <= 39) {
  156553. return b ^ c14 ^ d;
  156554. } else if (t <= 59) {
  156555. return b & c14 | b & d | c14 & d;
  156556. } else if (t <= 79) {
  156557. return b ^ c14 ^ d;
  156558. }
  156559. },
  156560. _S: function(n2, x) {
  156561. return x << n2 | x >>> 32 - n2;
  156562. },
  156563. _block: function(words) {
  156564. const sha1 = this;
  156565. const h = sha1._h;
  156566. const w = Array(80);
  156567. for (let j = 0; j < 16; j++) {
  156568. w[j] = words[j];
  156569. }
  156570. let a4 = h[0];
  156571. let b = h[1];
  156572. let c14 = h[2];
  156573. let d = h[3];
  156574. let e2 = h[4];
  156575. for (let t = 0; t <= 79; t++) {
  156576. if (t >= 16) {
  156577. w[t] = sha1._S(1, w[t - 3] ^ w[t - 8] ^ w[t - 14] ^ w[t - 16]);
  156578. }
  156579. const tmp2 = sha1._S(5, a4) + sha1._f(t, b, c14, d) + e2 + w[t] + sha1._key[Math.floor(t / 20)] | 0;
  156580. e2 = d;
  156581. d = c14;
  156582. c14 = sha1._S(30, b);
  156583. b = a4;
  156584. a4 = tmp2;
  156585. }
  156586. h[0] = h[0] + a4 | 0;
  156587. h[1] = h[1] + b | 0;
  156588. h[2] = h[2] + c14 | 0;
  156589. h[3] = h[3] + d | 0;
  156590. h[4] = h[4] + e2 | 0;
  156591. }
  156592. };
  156593. var cipher = {};
  156594. cipher.aes = class {
  156595. constructor(key) {
  156596. const aes = this;
  156597. aes._tables = [[[], [], [], [], []], [[], [], [], [], []]];
  156598. if (!aes._tables[0][0][0]) {
  156599. aes._precompute();
  156600. }
  156601. const sbox = aes._tables[0][4];
  156602. const decTable = aes._tables[1];
  156603. const keyLen = key.length;
  156604. let i2, encKey, decKey, rcon = 1;
  156605. if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) {
  156606. throw new Error("invalid aes key size");
  156607. }
  156608. aes._key = [encKey = key.slice(0), decKey = []];
  156609. for (i2 = keyLen; i2 < 4 * keyLen + 28; i2++) {
  156610. let tmp2 = encKey[i2 - 1];
  156611. if (i2 % keyLen === 0 || keyLen === 8 && i2 % keyLen === 4) {
  156612. tmp2 = sbox[tmp2 >>> 24] << 24 ^ sbox[tmp2 >> 16 & 255] << 16 ^ sbox[tmp2 >> 8 & 255] << 8 ^ sbox[tmp2 & 255];
  156613. if (i2 % keyLen === 0) {
  156614. tmp2 = tmp2 << 8 ^ tmp2 >>> 24 ^ rcon << 24;
  156615. rcon = rcon << 1 ^ (rcon >> 7) * 283;
  156616. }
  156617. }
  156618. encKey[i2] = encKey[i2 - keyLen] ^ tmp2;
  156619. }
  156620. for (let j = 0; i2; j++, i2--) {
  156621. const tmp2 = encKey[j & 3 ? i2 : i2 - 4];
  156622. if (i2 <= 4 || j < 4) {
  156623. decKey[j] = tmp2;
  156624. } else {
  156625. decKey[j] = decTable[0][sbox[tmp2 >>> 24]] ^ decTable[1][sbox[tmp2 >> 16 & 255]] ^ decTable[2][sbox[tmp2 >> 8 & 255]] ^ decTable[3][sbox[tmp2 & 255]];
  156626. }
  156627. }
  156628. }
  156629. encrypt(data) {
  156630. return this._crypt(data, 0);
  156631. }
  156632. decrypt(data) {
  156633. return this._crypt(data, 1);
  156634. }
  156635. _precompute() {
  156636. const encTable = this._tables[0];
  156637. const decTable = this._tables[1];
  156638. const sbox = encTable[4];
  156639. const sboxInv = decTable[4];
  156640. const d = [];
  156641. const th = [];
  156642. let xInv, x2, x4, x8;
  156643. for (let i2 = 0; i2 < 256; i2++) {
  156644. th[(d[i2] = i2 << 1 ^ (i2 >> 7) * 283) ^ i2] = i2;
  156645. }
  156646. for (let x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) {
  156647. let s2 = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4;
  156648. s2 = s2 >> 8 ^ s2 & 255 ^ 99;
  156649. sbox[x] = s2;
  156650. sboxInv[s2] = x;
  156651. x8 = d[x4 = d[x2 = d[x]]];
  156652. let tDec = x8 * 16843009 ^ x4 * 65537 ^ x2 * 257 ^ x * 16843008;
  156653. let tEnc = d[s2] * 257 ^ s2 * 16843008;
  156654. for (let i2 = 0; i2 < 4; i2++) {
  156655. encTable[i2][x] = tEnc = tEnc << 24 ^ tEnc >>> 8;
  156656. decTable[i2][s2] = tDec = tDec << 24 ^ tDec >>> 8;
  156657. }
  156658. }
  156659. for (let i2 = 0; i2 < 5; i2++) {
  156660. encTable[i2] = encTable[i2].slice(0);
  156661. decTable[i2] = decTable[i2].slice(0);
  156662. }
  156663. }
  156664. _crypt(input, dir) {
  156665. if (input.length !== 4) {
  156666. throw new Error("invalid aes block size");
  156667. }
  156668. const key = this._key[dir];
  156669. const nInnerRounds = key.length / 4 - 2;
  156670. const out = [0, 0, 0, 0];
  156671. const table2 = this._tables[dir];
  156672. const t0 = table2[0];
  156673. const t1 = table2[1];
  156674. const t2 = table2[2];
  156675. const t3 = table2[3];
  156676. const sbox = table2[4];
  156677. let a4 = input[0] ^ key[0];
  156678. let b = input[dir ? 3 : 1] ^ key[1];
  156679. let c14 = input[2] ^ key[2];
  156680. let d = input[dir ? 1 : 3] ^ key[3];
  156681. let kIndex = 4;
  156682. let a22, b2, c22;
  156683. for (let i2 = 0; i2 < nInnerRounds; i2++) {
  156684. a22 = t0[a4 >>> 24] ^ t1[b >> 16 & 255] ^ t2[c14 >> 8 & 255] ^ t3[d & 255] ^ key[kIndex];
  156685. b2 = t0[b >>> 24] ^ t1[c14 >> 16 & 255] ^ t2[d >> 8 & 255] ^ t3[a4 & 255] ^ key[kIndex + 1];
  156686. c22 = t0[c14 >>> 24] ^ t1[d >> 16 & 255] ^ t2[a4 >> 8 & 255] ^ t3[b & 255] ^ key[kIndex + 2];
  156687. d = t0[d >>> 24] ^ t1[a4 >> 16 & 255] ^ t2[b >> 8 & 255] ^ t3[c14 & 255] ^ key[kIndex + 3];
  156688. kIndex += 4;
  156689. a4 = a22;
  156690. b = b2;
  156691. c14 = c22;
  156692. }
  156693. for (let i2 = 0; i2 < 4; i2++) {
  156694. out[dir ? 3 & -i2 : i2] = sbox[a4 >>> 24] << 24 ^ sbox[b >> 16 & 255] << 16 ^ sbox[c14 >> 8 & 255] << 8 ^ sbox[d & 255] ^ key[kIndex++];
  156695. a22 = a4;
  156696. a4 = b;
  156697. b = c14;
  156698. c14 = d;
  156699. d = a22;
  156700. }
  156701. return out;
  156702. }
  156703. };
  156704. var random = {
  156705. getRandomValues(typedArray) {
  156706. const words = new Uint32Array(typedArray.buffer);
  156707. const r2 = (m_w) => {
  156708. let m_z = 987654321;
  156709. const mask = 4294967295;
  156710. return function() {
  156711. m_z = 36969 * (m_z & 65535) + (m_z >> 16) & mask;
  156712. m_w = 18e3 * (m_w & 65535) + (m_w >> 16) & mask;
  156713. const result = ((m_z << 16) + m_w & mask) / 4294967296 + 0.5;
  156714. return result * (Math.random() > 0.5 ? 1 : -1);
  156715. };
  156716. };
  156717. for (let i2 = 0, rcache; i2 < typedArray.length; i2 += 4) {
  156718. let _r = r2((rcache || Math.random()) * 4294967296);
  156719. rcache = _r() * 987654071;
  156720. words[i2 / 4] = _r() * 4294967296 | 0;
  156721. }
  156722. return typedArray;
  156723. }
  156724. };
  156725. var mode = {};
  156726. mode.ctrGladman = class {
  156727. constructor(prf, iv) {
  156728. this._prf = prf;
  156729. this._initIv = iv;
  156730. this._iv = iv;
  156731. }
  156732. reset() {
  156733. this._iv = this._initIv;
  156734. }
  156735. update(data) {
  156736. return this.calculate(this._prf, data, this._iv);
  156737. }
  156738. incWord(word) {
  156739. if ((word >> 24 & 255) === 255) {
  156740. let b1 = word >> 16 & 255;
  156741. let b2 = word >> 8 & 255;
  156742. let b3 = word & 255;
  156743. if (b1 === 255) {
  156744. b1 = 0;
  156745. if (b2 === 255) {
  156746. b2 = 0;
  156747. if (b3 === 255) {
  156748. b3 = 0;
  156749. } else {
  156750. ++b3;
  156751. }
  156752. } else {
  156753. ++b2;
  156754. }
  156755. } else {
  156756. ++b1;
  156757. }
  156758. word = 0;
  156759. word += b1 << 16;
  156760. word += b2 << 8;
  156761. word += b3;
  156762. } else {
  156763. word += 1 << 24;
  156764. }
  156765. return word;
  156766. }
  156767. incCounter(counter) {
  156768. if ((counter[0] = this.incWord(counter[0])) === 0) {
  156769. counter[1] = this.incWord(counter[1]);
  156770. }
  156771. }
  156772. calculate(prf, data, iv) {
  156773. let l2;
  156774. if (!(l2 = data.length)) {
  156775. return [];
  156776. }
  156777. const bl = bitArray.bitLength(data);
  156778. for (let i2 = 0; i2 < l2; i2 += 4) {
  156779. this.incCounter(iv);
  156780. const e2 = prf.encrypt(iv);
  156781. data[i2] ^= e2[0];
  156782. data[i2 + 1] ^= e2[1];
  156783. data[i2 + 2] ^= e2[2];
  156784. data[i2 + 3] ^= e2[3];
  156785. }
  156786. return bitArray.clamp(data, bl);
  156787. }
  156788. };
  156789. var misc = {
  156790. importKey(password) {
  156791. return new misc.hmacSha1(codec.bytes.toBits(password));
  156792. },
  156793. pbkdf2(prf, salt, count, length3) {
  156794. count = count || 1e4;
  156795. if (length3 < 0 || count < 0) {
  156796. throw new Error("invalid params to pbkdf2");
  156797. }
  156798. const byteLength = (length3 >> 5) + 1 << 2;
  156799. let u3, ui, i2, j, k;
  156800. const arrayBuffer = new ArrayBuffer(byteLength);
  156801. let out = new DataView(arrayBuffer);
  156802. let outLength = 0;
  156803. const b = bitArray;
  156804. salt = codec.bytes.toBits(salt);
  156805. for (k = 1; outLength < (byteLength || 1); k++) {
  156806. u3 = ui = prf.encrypt(b.concat(salt, [k]));
  156807. for (i2 = 1; i2 < count; i2++) {
  156808. ui = prf.encrypt(ui);
  156809. for (j = 0; j < ui.length; j++) {
  156810. u3[j] ^= ui[j];
  156811. }
  156812. }
  156813. for (i2 = 0; outLength < (byteLength || 1) && i2 < u3.length; i2++) {
  156814. out.setInt32(outLength, u3[i2]);
  156815. outLength += 4;
  156816. }
  156817. }
  156818. return arrayBuffer.slice(0, length3 / 8);
  156819. }
  156820. };
  156821. misc.hmacSha1 = class {
  156822. constructor(key) {
  156823. const hmac = this;
  156824. const Hash = hmac._hash = hash.sha1;
  156825. const exKey = [[], []];
  156826. const bs = Hash.prototype.blockSize / 32;
  156827. hmac._baseHash = [new Hash(), new Hash()];
  156828. if (key.length > bs) {
  156829. key = Hash.hash(key);
  156830. }
  156831. for (let i2 = 0; i2 < bs; i2++) {
  156832. exKey[0][i2] = key[i2] ^ 909522486;
  156833. exKey[1][i2] = key[i2] ^ 1549556828;
  156834. }
  156835. hmac._baseHash[0].update(exKey[0]);
  156836. hmac._baseHash[1].update(exKey[1]);
  156837. hmac._resultHash = new Hash(hmac._baseHash[0]);
  156838. }
  156839. reset() {
  156840. const hmac = this;
  156841. hmac._resultHash = new hmac._hash(hmac._baseHash[0]);
  156842. hmac._updated = false;
  156843. }
  156844. update(data) {
  156845. const hmac = this;
  156846. hmac._updated = true;
  156847. hmac._resultHash.update(data);
  156848. }
  156849. digest() {
  156850. const hmac = this;
  156851. const w = hmac._resultHash.finalize();
  156852. const result = new hmac._hash(hmac._baseHash[1]).update(w).finalize();
  156853. hmac.reset();
  156854. return result;
  156855. }
  156856. encrypt(data) {
  156857. if (!this._updated) {
  156858. this.update(data);
  156859. return this.digest(data);
  156860. } else {
  156861. throw new Error("encrypt on already updated hmac called!");
  156862. }
  156863. }
  156864. };
  156865. var ERR_INVALID_PASSWORD = "Invalid pasword";
  156866. var BLOCK_LENGTH = 16;
  156867. var RAW_FORMAT = "raw";
  156868. var PBKDF2_ALGORITHM = { name: "PBKDF2" };
  156869. var HASH_ALGORITHM = { name: "HMAC" };
  156870. var HASH_FUNCTION = "SHA-1";
  156871. var BASE_KEY_ALGORITHM = Object.assign({ hash: HASH_ALGORITHM }, PBKDF2_ALGORITHM);
  156872. var DERIVED_BITS_ALGORITHM = Object.assign({ iterations: 1e3, hash: { name: HASH_FUNCTION } }, PBKDF2_ALGORITHM);
  156873. var DERIVED_BITS_USAGE = ["deriveBits"];
  156874. var SALT_LENGTH = [8, 12, 16];
  156875. var KEY_LENGTH = [16, 24, 32];
  156876. var SIGNATURE_LENGTH = 10;
  156877. var COUNTER_DEFAULT_VALUE = [0, 0, 0, 0];
  156878. var CRYPTO_API_SUPPORTED = typeof crypto != "undefined";
  156879. var SUBTLE_API_SUPPORTED = CRYPTO_API_SUPPORTED && typeof crypto.subtle != "undefined";
  156880. var codecBytes = codec.bytes;
  156881. var Aes = cipher.aes;
  156882. var CtrGladman = mode.ctrGladman;
  156883. var HmacSha1 = misc.hmacSha1;
  156884. var AESDecrypt = class {
  156885. constructor(password, signed, strength) {
  156886. Object.assign(this, {
  156887. password,
  156888. signed,
  156889. strength: strength - 1,
  156890. pendingInput: new Uint8Array(0)
  156891. });
  156892. }
  156893. async append(input) {
  156894. const aesCrypto = this;
  156895. if (aesCrypto.password) {
  156896. const preamble = subarray(input, 0, SALT_LENGTH[aesCrypto.strength] + 2);
  156897. await createDecryptionKeys(aesCrypto, preamble, aesCrypto.password);
  156898. aesCrypto.password = null;
  156899. aesCrypto.aesCtrGladman = new CtrGladman(new Aes(aesCrypto.keys.key), Array.from(COUNTER_DEFAULT_VALUE));
  156900. aesCrypto.hmac = new HmacSha1(aesCrypto.keys.authentication);
  156901. input = subarray(input, SALT_LENGTH[aesCrypto.strength] + 2);
  156902. }
  156903. const output = new Uint8Array(input.length - SIGNATURE_LENGTH - (input.length - SIGNATURE_LENGTH) % BLOCK_LENGTH);
  156904. return append(aesCrypto, input, output, 0, SIGNATURE_LENGTH, true);
  156905. }
  156906. flush() {
  156907. const aesCrypto = this;
  156908. const pendingInput = aesCrypto.pendingInput;
  156909. const chunkToDecrypt = subarray(pendingInput, 0, pendingInput.length - SIGNATURE_LENGTH);
  156910. const originalSignature = subarray(pendingInput, pendingInput.length - SIGNATURE_LENGTH);
  156911. let decryptedChunkArray = new Uint8Array(0);
  156912. if (chunkToDecrypt.length) {
  156913. const encryptedChunk = codecBytes.toBits(chunkToDecrypt);
  156914. aesCrypto.hmac.update(encryptedChunk);
  156915. const decryptedChunk = aesCrypto.aesCtrGladman.update(encryptedChunk);
  156916. decryptedChunkArray = codecBytes.fromBits(decryptedChunk);
  156917. }
  156918. let valid = true;
  156919. if (aesCrypto.signed) {
  156920. const signature = subarray(codecBytes.fromBits(aesCrypto.hmac.digest()), 0, SIGNATURE_LENGTH);
  156921. for (let indexSignature = 0; indexSignature < SIGNATURE_LENGTH; indexSignature++) {
  156922. if (signature[indexSignature] != originalSignature[indexSignature]) {
  156923. valid = false;
  156924. }
  156925. }
  156926. }
  156927. return {
  156928. valid,
  156929. data: decryptedChunkArray
  156930. };
  156931. }
  156932. };
  156933. var AESEncrypt = class {
  156934. constructor(password, strength) {
  156935. Object.assign(this, {
  156936. password,
  156937. strength: strength - 1,
  156938. pendingInput: new Uint8Array(0)
  156939. });
  156940. }
  156941. async append(input) {
  156942. const aesCrypto = this;
  156943. let preamble = new Uint8Array(0);
  156944. if (aesCrypto.password) {
  156945. preamble = await createEncryptionKeys(aesCrypto, aesCrypto.password);
  156946. aesCrypto.password = null;
  156947. aesCrypto.aesCtrGladman = new CtrGladman(new Aes(aesCrypto.keys.key), Array.from(COUNTER_DEFAULT_VALUE));
  156948. aesCrypto.hmac = new HmacSha1(aesCrypto.keys.authentication);
  156949. }
  156950. const output = new Uint8Array(preamble.length + input.length - input.length % BLOCK_LENGTH);
  156951. output.set(preamble, 0);
  156952. return append(aesCrypto, input, output, preamble.length, 0);
  156953. }
  156954. flush() {
  156955. const aesCrypto = this;
  156956. let encryptedChunkArray = new Uint8Array(0);
  156957. if (aesCrypto.pendingInput.length) {
  156958. const encryptedChunk = aesCrypto.aesCtrGladman.update(codecBytes.toBits(aesCrypto.pendingInput));
  156959. aesCrypto.hmac.update(encryptedChunk);
  156960. encryptedChunkArray = codecBytes.fromBits(encryptedChunk);
  156961. }
  156962. const signature = subarray(codecBytes.fromBits(aesCrypto.hmac.digest()), 0, SIGNATURE_LENGTH);
  156963. return {
  156964. data: concat(encryptedChunkArray, signature),
  156965. signature
  156966. };
  156967. }
  156968. };
  156969. function append(aesCrypto, input, output, paddingStart, paddingEnd, verifySignature) {
  156970. const inputLength = input.length - paddingEnd;
  156971. if (aesCrypto.pendingInput.length) {
  156972. input = concat(aesCrypto.pendingInput, input);
  156973. output = expand(output, inputLength - inputLength % BLOCK_LENGTH);
  156974. }
  156975. let offset2;
  156976. for (offset2 = 0; offset2 <= inputLength - BLOCK_LENGTH; offset2 += BLOCK_LENGTH) {
  156977. const inputChunk = codecBytes.toBits(subarray(input, offset2, offset2 + BLOCK_LENGTH));
  156978. if (verifySignature) {
  156979. aesCrypto.hmac.update(inputChunk);
  156980. }
  156981. const outputChunk = aesCrypto.aesCtrGladman.update(inputChunk);
  156982. if (!verifySignature) {
  156983. aesCrypto.hmac.update(outputChunk);
  156984. }
  156985. output.set(codecBytes.fromBits(outputChunk), offset2 + paddingStart);
  156986. }
  156987. aesCrypto.pendingInput = subarray(input, offset2);
  156988. return output;
  156989. }
  156990. async function createDecryptionKeys(decrypt2, preambleArray, password) {
  156991. await createKeys$1(decrypt2, password, subarray(preambleArray, 0, SALT_LENGTH[decrypt2.strength]));
  156992. const passwordVerification = subarray(preambleArray, SALT_LENGTH[decrypt2.strength]);
  156993. const passwordVerificationKey = decrypt2.keys.passwordVerification;
  156994. if (passwordVerificationKey[0] != passwordVerification[0] || passwordVerificationKey[1] != passwordVerification[1]) {
  156995. throw new Error(ERR_INVALID_PASSWORD);
  156996. }
  156997. }
  156998. async function createEncryptionKeys(encrypt2, password) {
  156999. const salt = getRandomValues3(new Uint8Array(SALT_LENGTH[encrypt2.strength]));
  157000. await createKeys$1(encrypt2, password, salt);
  157001. return concat(salt, encrypt2.keys.passwordVerification);
  157002. }
  157003. async function createKeys$1(target, password, salt) {
  157004. const encodedPassword = encodeText(password);
  157005. const basekey = await importKey(RAW_FORMAT, encodedPassword, BASE_KEY_ALGORITHM, false, DERIVED_BITS_USAGE);
  157006. const derivedBits = await deriveBits(Object.assign({ salt }, DERIVED_BITS_ALGORITHM), basekey, 8 * (KEY_LENGTH[target.strength] * 2 + 2));
  157007. const compositeKey = new Uint8Array(derivedBits);
  157008. target.keys = {
  157009. key: codecBytes.toBits(subarray(compositeKey, 0, KEY_LENGTH[target.strength])),
  157010. authentication: codecBytes.toBits(subarray(compositeKey, KEY_LENGTH[target.strength], KEY_LENGTH[target.strength] * 2)),
  157011. passwordVerification: subarray(compositeKey, KEY_LENGTH[target.strength] * 2)
  157012. };
  157013. }
  157014. function getRandomValues3(array) {
  157015. if (CRYPTO_API_SUPPORTED && typeof crypto.getRandomValues == "function") {
  157016. return crypto.getRandomValues(array);
  157017. } else {
  157018. return random.getRandomValues(array);
  157019. }
  157020. }
  157021. async function importKey(format, password, algorithm, extractable, keyUsages) {
  157022. if (CRYPTO_API_SUPPORTED && SUBTLE_API_SUPPORTED && typeof crypto.subtle.importKey == "function") {
  157023. return crypto.subtle.importKey(format, password, algorithm, extractable, keyUsages);
  157024. } else {
  157025. return misc.importKey(password);
  157026. }
  157027. }
  157028. async function deriveBits(algorithm, baseKey, length3) {
  157029. if (CRYPTO_API_SUPPORTED && SUBTLE_API_SUPPORTED && typeof crypto.subtle.deriveBits == "function") {
  157030. return await crypto.subtle.deriveBits(algorithm, baseKey, length3);
  157031. } else {
  157032. return misc.pbkdf2(baseKey, algorithm.salt, DERIVED_BITS_ALGORITHM.iterations, length3);
  157033. }
  157034. }
  157035. function concat(leftArray, rightArray) {
  157036. let array = leftArray;
  157037. if (leftArray.length + rightArray.length) {
  157038. array = new Uint8Array(leftArray.length + rightArray.length);
  157039. array.set(leftArray, 0);
  157040. array.set(rightArray, leftArray.length);
  157041. }
  157042. return array;
  157043. }
  157044. function expand(inputArray, length3) {
  157045. if (length3 && length3 > inputArray.length) {
  157046. const array = inputArray;
  157047. inputArray = new Uint8Array(length3);
  157048. inputArray.set(array, 0);
  157049. }
  157050. return inputArray;
  157051. }
  157052. function subarray(array, begin, end) {
  157053. return array.subarray(begin, end);
  157054. }
  157055. var HEADER_LENGTH = 12;
  157056. var ZipCryptoDecrypt = class {
  157057. constructor(password, passwordVerification) {
  157058. const zipCrypto = this;
  157059. Object.assign(zipCrypto, {
  157060. password,
  157061. passwordVerification
  157062. });
  157063. createKeys(zipCrypto, password);
  157064. }
  157065. append(input) {
  157066. const zipCrypto = this;
  157067. if (zipCrypto.password) {
  157068. const decryptedHeader = decrypt(zipCrypto, input.subarray(0, HEADER_LENGTH));
  157069. zipCrypto.password = null;
  157070. if (decryptedHeader[HEADER_LENGTH - 1] != zipCrypto.passwordVerification) {
  157071. throw new Error(ERR_INVALID_PASSWORD);
  157072. }
  157073. input = input.subarray(HEADER_LENGTH);
  157074. }
  157075. return decrypt(zipCrypto, input);
  157076. }
  157077. flush() {
  157078. return {
  157079. valid: true,
  157080. data: new Uint8Array(0)
  157081. };
  157082. }
  157083. };
  157084. var ZipCryptoEncrypt = class {
  157085. constructor(password, passwordVerification) {
  157086. const zipCrypto = this;
  157087. Object.assign(zipCrypto, {
  157088. password,
  157089. passwordVerification
  157090. });
  157091. createKeys(zipCrypto, password);
  157092. }
  157093. append(input) {
  157094. const zipCrypto = this;
  157095. let output;
  157096. let offset2;
  157097. if (zipCrypto.password) {
  157098. zipCrypto.password = null;
  157099. const header = crypto.getRandomValues(new Uint8Array(HEADER_LENGTH));
  157100. header[HEADER_LENGTH - 1] = zipCrypto.passwordVerification;
  157101. output = new Uint8Array(input.length + header.length);
  157102. output.set(encrypt(zipCrypto, header), 0);
  157103. offset2 = HEADER_LENGTH;
  157104. } else {
  157105. output = new Uint8Array(input.length);
  157106. offset2 = 0;
  157107. }
  157108. output.set(encrypt(zipCrypto, input), offset2);
  157109. return output;
  157110. }
  157111. flush() {
  157112. return {
  157113. data: new Uint8Array(0)
  157114. };
  157115. }
  157116. };
  157117. function decrypt(target, input) {
  157118. const output = new Uint8Array(input.length);
  157119. for (let index2 = 0; index2 < input.length; index2++) {
  157120. output[index2] = getByte(target) ^ input[index2];
  157121. updateKeys(target, output[index2]);
  157122. }
  157123. return output;
  157124. }
  157125. function encrypt(target, input) {
  157126. const output = new Uint8Array(input.length);
  157127. for (let index2 = 0; index2 < input.length; index2++) {
  157128. output[index2] = getByte(target) ^ input[index2];
  157129. updateKeys(target, input[index2]);
  157130. }
  157131. return output;
  157132. }
  157133. function createKeys(target, password) {
  157134. target.keys = [305419896, 591751049, 878082192];
  157135. target.crcKey0 = new Crc32(target.keys[0]);
  157136. target.crcKey2 = new Crc32(target.keys[2]);
  157137. for (let index2 = 0; index2 < password.length; index2++) {
  157138. updateKeys(target, password.charCodeAt(index2));
  157139. }
  157140. }
  157141. function updateKeys(target, byte) {
  157142. target.crcKey0.append([byte]);
  157143. target.keys[0] = ~target.crcKey0.get();
  157144. target.keys[1] = getInt32(target.keys[1] + getInt8(target.keys[0]));
  157145. target.keys[1] = getInt32(Math.imul(target.keys[1], 134775813) + 1);
  157146. target.crcKey2.append([target.keys[1] >>> 24]);
  157147. target.keys[2] = ~target.crcKey2.get();
  157148. }
  157149. function getByte(target) {
  157150. const temp = target.keys[2] | 2;
  157151. return getInt8(Math.imul(temp, temp ^ 1) >>> 8);
  157152. }
  157153. function getInt8(number) {
  157154. return number & 255;
  157155. }
  157156. function getInt32(number) {
  157157. return number & 4294967295;
  157158. }
  157159. var CODEC_DEFLATE = "deflate";
  157160. var CODEC_INFLATE = "inflate";
  157161. var ERR_INVALID_SIGNATURE = "Invalid signature";
  157162. var Inflate = class {
  157163. constructor(codecConstructor, {
  157164. signature,
  157165. password,
  157166. signed,
  157167. compressed,
  157168. zipCrypto,
  157169. passwordVerification,
  157170. encryptionStrength
  157171. }, { chunkSize }) {
  157172. const encrypted = Boolean(password);
  157173. Object.assign(this, {
  157174. signature,
  157175. encrypted,
  157176. signed,
  157177. compressed,
  157178. inflate: compressed && new codecConstructor({ chunkSize }),
  157179. crc32: signed && new Crc32(),
  157180. zipCrypto,
  157181. decrypt: encrypted && zipCrypto ? new ZipCryptoDecrypt(password, passwordVerification) : new AESDecrypt(password, signed, encryptionStrength)
  157182. });
  157183. }
  157184. async append(data) {
  157185. const codec2 = this;
  157186. if (codec2.encrypted && data.length) {
  157187. data = await codec2.decrypt.append(data);
  157188. }
  157189. if (codec2.compressed && data.length) {
  157190. data = await codec2.inflate.append(data);
  157191. }
  157192. if ((!codec2.encrypted || codec2.zipCrypto) && codec2.signed && data.length) {
  157193. codec2.crc32.append(data);
  157194. }
  157195. return data;
  157196. }
  157197. async flush() {
  157198. const codec2 = this;
  157199. let signature;
  157200. let data = new Uint8Array(0);
  157201. if (codec2.encrypted) {
  157202. const result = codec2.decrypt.flush();
  157203. if (!result.valid) {
  157204. throw new Error(ERR_INVALID_SIGNATURE);
  157205. }
  157206. data = result.data;
  157207. }
  157208. if ((!codec2.encrypted || codec2.zipCrypto) && codec2.signed) {
  157209. const dataViewSignature = new DataView(new Uint8Array(4).buffer);
  157210. signature = codec2.crc32.get();
  157211. dataViewSignature.setUint32(0, signature);
  157212. if (codec2.signature != dataViewSignature.getUint32(0, false)) {
  157213. throw new Error(ERR_INVALID_SIGNATURE);
  157214. }
  157215. }
  157216. if (codec2.compressed) {
  157217. data = await codec2.inflate.append(data) || new Uint8Array(0);
  157218. await codec2.inflate.flush();
  157219. }
  157220. return { data, signature };
  157221. }
  157222. };
  157223. var Deflate = class {
  157224. constructor(codecConstructor, {
  157225. encrypted,
  157226. signed,
  157227. compressed,
  157228. level,
  157229. zipCrypto,
  157230. password,
  157231. passwordVerification,
  157232. encryptionStrength
  157233. }, { chunkSize }) {
  157234. Object.assign(this, {
  157235. encrypted,
  157236. signed,
  157237. compressed,
  157238. deflate: compressed && new codecConstructor({ level: level || 5, chunkSize }),
  157239. crc32: signed && new Crc32(),
  157240. zipCrypto,
  157241. encrypt: encrypted && zipCrypto ? new ZipCryptoEncrypt(password, passwordVerification) : new AESEncrypt(password, encryptionStrength)
  157242. });
  157243. }
  157244. async append(inputData) {
  157245. const codec2 = this;
  157246. let data = inputData;
  157247. if (codec2.compressed && inputData.length) {
  157248. data = await codec2.deflate.append(inputData);
  157249. }
  157250. if (codec2.encrypted && data.length) {
  157251. data = await codec2.encrypt.append(data);
  157252. }
  157253. if ((!codec2.encrypted || codec2.zipCrypto) && codec2.signed && inputData.length) {
  157254. codec2.crc32.append(inputData);
  157255. }
  157256. return data;
  157257. }
  157258. async flush() {
  157259. const codec2 = this;
  157260. let signature;
  157261. let data = new Uint8Array(0);
  157262. if (codec2.compressed) {
  157263. data = await codec2.deflate.flush() || new Uint8Array(0);
  157264. }
  157265. if (codec2.encrypted) {
  157266. data = await codec2.encrypt.append(data);
  157267. const result = codec2.encrypt.flush();
  157268. signature = result.signature;
  157269. const newData = new Uint8Array(data.length + result.data.length);
  157270. newData.set(data, 0);
  157271. newData.set(result.data, data.length);
  157272. data = newData;
  157273. }
  157274. if ((!codec2.encrypted || codec2.zipCrypto) && codec2.signed) {
  157275. signature = codec2.crc32.get();
  157276. }
  157277. return { data, signature };
  157278. }
  157279. };
  157280. function createCodec$1(codecConstructor, options, config2) {
  157281. if (options.codecType.startsWith(CODEC_DEFLATE)) {
  157282. return new Deflate(codecConstructor, options, config2);
  157283. } else if (options.codecType.startsWith(CODEC_INFLATE)) {
  157284. return new Inflate(codecConstructor, options, config2);
  157285. }
  157286. }
  157287. var MESSAGE_INIT = "init";
  157288. var MESSAGE_APPEND = "append";
  157289. var MESSAGE_FLUSH = "flush";
  157290. var MESSAGE_EVENT_TYPE = "message";
  157291. var classicWorkersSupported = true;
  157292. var getWorker = (workerData, codecConstructor, options, config2, onTaskFinished, webWorker, scripts) => {
  157293. Object.assign(workerData, {
  157294. busy: true,
  157295. codecConstructor,
  157296. options: Object.assign({}, options),
  157297. scripts,
  157298. terminate() {
  157299. if (workerData.worker && !workerData.busy) {
  157300. workerData.worker.terminate();
  157301. workerData.interface = null;
  157302. }
  157303. },
  157304. onTaskFinished() {
  157305. workerData.busy = false;
  157306. onTaskFinished(workerData);
  157307. }
  157308. });
  157309. return webWorker ? createWebWorkerInterface(workerData, config2) : createWorkerInterface(workerData, config2);
  157310. };
  157311. function createWorkerInterface(workerData, config2) {
  157312. const interfaceCodec = createCodec$1(workerData.codecConstructor, workerData.options, config2);
  157313. return {
  157314. async append(data) {
  157315. try {
  157316. return await interfaceCodec.append(data);
  157317. } catch (error) {
  157318. workerData.onTaskFinished();
  157319. throw error;
  157320. }
  157321. },
  157322. async flush() {
  157323. try {
  157324. return await interfaceCodec.flush();
  157325. } finally {
  157326. workerData.onTaskFinished();
  157327. }
  157328. },
  157329. abort() {
  157330. workerData.onTaskFinished();
  157331. }
  157332. };
  157333. }
  157334. function createWebWorkerInterface(workerData, config2) {
  157335. let messageTask;
  157336. const workerOptions = { type: "module" };
  157337. if (!workerData.interface) {
  157338. if (!classicWorkersSupported) {
  157339. workerData.worker = getWorker2(workerOptions, config2.baseURL);
  157340. } else {
  157341. try {
  157342. workerData.worker = getWorker2({}, config2.baseURL);
  157343. } catch (error) {
  157344. classicWorkersSupported = false;
  157345. workerData.worker = getWorker2(workerOptions, config2.baseURL);
  157346. }
  157347. }
  157348. workerData.worker.addEventListener(MESSAGE_EVENT_TYPE, onMessage, false);
  157349. workerData.interface = {
  157350. append(data) {
  157351. return initAndSendMessage({ type: MESSAGE_APPEND, data });
  157352. },
  157353. flush() {
  157354. return initAndSendMessage({ type: MESSAGE_FLUSH });
  157355. },
  157356. abort() {
  157357. workerData.onTaskFinished();
  157358. }
  157359. };
  157360. }
  157361. return workerData.interface;
  157362. function getWorker2(options, baseURL) {
  157363. let url2, scriptUrl;
  157364. url2 = workerData.scripts[0];
  157365. if (typeof url2 == "function") {
  157366. url2 = url2();
  157367. }
  157368. try {
  157369. scriptUrl = new URL(url2, baseURL);
  157370. } catch (error) {
  157371. scriptUrl = url2;
  157372. }
  157373. return new Worker(scriptUrl, options);
  157374. }
  157375. async function initAndSendMessage(message) {
  157376. if (!messageTask) {
  157377. const options = workerData.options;
  157378. const scripts = workerData.scripts.slice(1);
  157379. await sendMessage({ scripts, type: MESSAGE_INIT, options, config: { chunkSize: config2.chunkSize } });
  157380. }
  157381. return sendMessage(message);
  157382. }
  157383. function sendMessage(message) {
  157384. const worker = workerData.worker;
  157385. const result = new Promise((resolve2, reject) => messageTask = { resolve: resolve2, reject });
  157386. try {
  157387. if (message.data) {
  157388. try {
  157389. message.data = message.data.buffer;
  157390. worker.postMessage(message, [message.data]);
  157391. } catch (error) {
  157392. worker.postMessage(message);
  157393. }
  157394. } else {
  157395. worker.postMessage(message);
  157396. }
  157397. } catch (error) {
  157398. messageTask.reject(error);
  157399. messageTask = null;
  157400. workerData.onTaskFinished();
  157401. }
  157402. return result;
  157403. }
  157404. function onMessage(event) {
  157405. const message = event.data;
  157406. if (messageTask) {
  157407. const reponseError = message.error;
  157408. const type = message.type;
  157409. if (reponseError) {
  157410. const error = new Error(reponseError.message);
  157411. error.stack = reponseError.stack;
  157412. messageTask.reject(error);
  157413. messageTask = null;
  157414. workerData.onTaskFinished();
  157415. } else if (type == MESSAGE_INIT || type == MESSAGE_FLUSH || type == MESSAGE_APPEND) {
  157416. const data = message.data;
  157417. if (type == MESSAGE_FLUSH) {
  157418. messageTask.resolve({ data: new Uint8Array(data), signature: message.signature });
  157419. messageTask = null;
  157420. workerData.onTaskFinished();
  157421. } else {
  157422. messageTask.resolve(data && new Uint8Array(data));
  157423. }
  157424. }
  157425. }
  157426. }
  157427. }
  157428. var pool = [];
  157429. var pendingRequests = [];
  157430. function createCodec(codecConstructor, options, config2) {
  157431. const streamCopy = !options.compressed && !options.signed && !options.encrypted;
  157432. const webWorker = !streamCopy && (options.useWebWorkers || options.useWebWorkers === void 0 && config2.useWebWorkers);
  157433. const scripts = webWorker && config2.workerScripts ? config2.workerScripts[options.codecType] : [];
  157434. if (pool.length < config2.maxWorkers) {
  157435. const workerData = {};
  157436. pool.push(workerData);
  157437. return getWorker(workerData, codecConstructor, options, config2, onTaskFinished, webWorker, scripts);
  157438. } else {
  157439. const workerData = pool.find((workerData2) => !workerData2.busy);
  157440. if (workerData) {
  157441. clearTerminateTimeout(workerData);
  157442. return getWorker(workerData, codecConstructor, options, config2, onTaskFinished, webWorker, scripts);
  157443. } else {
  157444. return new Promise((resolve2) => pendingRequests.push({ resolve: resolve2, codecConstructor, options, webWorker, scripts }));
  157445. }
  157446. }
  157447. function onTaskFinished(workerData) {
  157448. if (pendingRequests.length) {
  157449. const [{ resolve: resolve2, codecConstructor: codecConstructor2, options: options2, webWorker: webWorker2, scripts: scripts2 }] = pendingRequests.splice(0, 1);
  157450. resolve2(getWorker(workerData, codecConstructor2, options2, config2, onTaskFinished, webWorker2, scripts2));
  157451. } else if (workerData.worker) {
  157452. clearTerminateTimeout(workerData);
  157453. if (Number.isFinite(config2.terminateWorkerTimeout) && config2.terminateWorkerTimeout >= 0) {
  157454. workerData.terminateTimeout = setTimeout(() => {
  157455. pool = pool.filter((data) => data != workerData);
  157456. workerData.terminate();
  157457. }, config2.terminateWorkerTimeout);
  157458. }
  157459. } else {
  157460. pool = pool.filter((data) => data != workerData);
  157461. }
  157462. }
  157463. }
  157464. function clearTerminateTimeout(workerData) {
  157465. if (workerData.terminateTimeout) {
  157466. clearTimeout(workerData.terminateTimeout);
  157467. workerData.terminateTimeout = null;
  157468. }
  157469. }
  157470. function terminateWorkers() {
  157471. pool.forEach((workerData) => {
  157472. clearTerminateTimeout(workerData);
  157473. workerData.terminate();
  157474. });
  157475. }
  157476. var MINIMUM_CHUNK_SIZE = 64;
  157477. var ERR_ABORT = "Abort error";
  157478. async function processData(codec2, reader, writer, offset2, inputLength, config2, options) {
  157479. const chunkSize = Math.max(config2.chunkSize, MINIMUM_CHUNK_SIZE);
  157480. return processChunk();
  157481. async function processChunk(chunkOffset = 0, outputLength = 0) {
  157482. const signal = options.signal;
  157483. if (chunkOffset < inputLength) {
  157484. testAborted(signal, codec2);
  157485. const inputData = await reader.readUint8Array(chunkOffset + offset2, Math.min(chunkSize, inputLength - chunkOffset));
  157486. const chunkLength = inputData.length;
  157487. testAborted(signal, codec2);
  157488. const data = await codec2.append(inputData);
  157489. testAborted(signal, codec2);
  157490. outputLength += await writeData(writer, data);
  157491. if (options.onprogress) {
  157492. try {
  157493. options.onprogress(chunkOffset + chunkLength, inputLength);
  157494. } catch (error) {
  157495. }
  157496. }
  157497. return processChunk(chunkOffset + chunkSize, outputLength);
  157498. } else {
  157499. const result = await codec2.flush();
  157500. outputLength += await writeData(writer, result.data);
  157501. return { signature: result.signature, length: outputLength };
  157502. }
  157503. }
  157504. }
  157505. function testAborted(signal, codec2) {
  157506. if (signal && signal.aborted) {
  157507. codec2.abort();
  157508. throw new Error(ERR_ABORT);
  157509. }
  157510. }
  157511. async function writeData(writer, data) {
  157512. if (data.length) {
  157513. await writer.writeUint8Array(data);
  157514. }
  157515. return data.length;
  157516. }
  157517. var ERR_HTTP_STATUS = "HTTP error ";
  157518. var ERR_HTTP_RANGE = "HTTP Range not supported";
  157519. var CONTENT_TYPE_TEXT_PLAIN = "text/plain";
  157520. var HTTP_HEADER_CONTENT_LENGTH = "Content-Length";
  157521. var HTTP_HEADER_CONTENT_RANGE = "Content-Range";
  157522. var HTTP_HEADER_ACCEPT_RANGES = "Accept-Ranges";
  157523. var HTTP_HEADER_RANGE = "Range";
  157524. var HTTP_METHOD_HEAD = "HEAD";
  157525. var HTTP_METHOD_GET = "GET";
  157526. var HTTP_RANGE_UNIT = "bytes";
  157527. var Stream = class {
  157528. constructor() {
  157529. this.size = 0;
  157530. }
  157531. init() {
  157532. this.initialized = true;
  157533. }
  157534. };
  157535. var Reader = class extends Stream {
  157536. };
  157537. var Writer = class extends Stream {
  157538. writeUint8Array(array) {
  157539. this.size += array.length;
  157540. }
  157541. };
  157542. var TextReader = class extends Reader {
  157543. constructor(text2) {
  157544. super();
  157545. this.blobReader = new BlobReader(new Blob([text2], { type: CONTENT_TYPE_TEXT_PLAIN }));
  157546. }
  157547. async init() {
  157548. super.init();
  157549. this.blobReader.init();
  157550. this.size = this.blobReader.size;
  157551. }
  157552. async readUint8Array(offset2, length3) {
  157553. return this.blobReader.readUint8Array(offset2, length3);
  157554. }
  157555. };
  157556. var TextWriter = class extends Writer {
  157557. constructor(encoding) {
  157558. super();
  157559. this.encoding = encoding;
  157560. this.blob = new Blob([], { type: CONTENT_TYPE_TEXT_PLAIN });
  157561. }
  157562. async writeUint8Array(array) {
  157563. super.writeUint8Array(array);
  157564. this.blob = new Blob([this.blob, array.buffer], { type: CONTENT_TYPE_TEXT_PLAIN });
  157565. }
  157566. getData() {
  157567. if (this.blob.text) {
  157568. return this.blob.text();
  157569. } else {
  157570. const reader = new FileReader();
  157571. return new Promise((resolve2, reject) => {
  157572. reader.onload = (event) => resolve2(event.target.result);
  157573. reader.onerror = () => reject(reader.error);
  157574. reader.readAsText(this.blob, this.encoding);
  157575. });
  157576. }
  157577. }
  157578. };
  157579. var Data64URIReader = class extends Reader {
  157580. constructor(dataURI) {
  157581. super();
  157582. this.dataURI = dataURI;
  157583. let dataEnd = dataURI.length;
  157584. while (dataURI.charAt(dataEnd - 1) == "=") {
  157585. dataEnd--;
  157586. }
  157587. this.dataStart = dataURI.indexOf(",") + 1;
  157588. this.size = Math.floor((dataEnd - this.dataStart) * 0.75);
  157589. }
  157590. async readUint8Array(offset2, length3) {
  157591. const dataArray = new Uint8Array(length3);
  157592. const start = Math.floor(offset2 / 3) * 4;
  157593. const bytes = atob(this.dataURI.substring(start + this.dataStart, Math.ceil((offset2 + length3) / 3) * 4 + this.dataStart));
  157594. const delta = offset2 - Math.floor(start / 4) * 3;
  157595. for (let indexByte = delta; indexByte < delta + length3; indexByte++) {
  157596. dataArray[indexByte - delta] = bytes.charCodeAt(indexByte);
  157597. }
  157598. return dataArray;
  157599. }
  157600. };
  157601. var Data64URIWriter = class extends Writer {
  157602. constructor(contentType) {
  157603. super();
  157604. this.data = "data:" + (contentType || "") + ";base64,";
  157605. this.pending = [];
  157606. }
  157607. async writeUint8Array(array) {
  157608. super.writeUint8Array(array);
  157609. let indexArray = 0;
  157610. let dataString = this.pending;
  157611. const delta = this.pending.length;
  157612. this.pending = "";
  157613. for (indexArray = 0; indexArray < Math.floor((delta + array.length) / 3) * 3 - delta; indexArray++) {
  157614. dataString += String.fromCharCode(array[indexArray]);
  157615. }
  157616. for (; indexArray < array.length; indexArray++) {
  157617. this.pending += String.fromCharCode(array[indexArray]);
  157618. }
  157619. if (dataString.length > 2) {
  157620. this.data += btoa(dataString);
  157621. } else {
  157622. this.pending = dataString;
  157623. }
  157624. }
  157625. getData() {
  157626. return this.data + btoa(this.pending);
  157627. }
  157628. };
  157629. var BlobReader = class extends Reader {
  157630. constructor(blob) {
  157631. super();
  157632. this.blob = blob;
  157633. this.size = blob.size;
  157634. }
  157635. async readUint8Array(offset2, length3) {
  157636. if (this.blob.arrayBuffer) {
  157637. return new Uint8Array(await this.blob.slice(offset2, offset2 + length3).arrayBuffer());
  157638. } else {
  157639. const reader = new FileReader();
  157640. return new Promise((resolve2, reject) => {
  157641. reader.onload = (event) => resolve2(new Uint8Array(event.target.result));
  157642. reader.onerror = () => reject(reader.error);
  157643. reader.readAsArrayBuffer(this.blob.slice(offset2, offset2 + length3));
  157644. });
  157645. }
  157646. }
  157647. };
  157648. var BlobWriter = class extends Writer {
  157649. constructor(contentType) {
  157650. super();
  157651. this.contentType = contentType;
  157652. this.arrayBuffersMaxlength = 8;
  157653. initArrayBuffers(this);
  157654. }
  157655. async writeUint8Array(array) {
  157656. super.writeUint8Array(array);
  157657. if (this.arrayBuffers.length == this.arrayBuffersMaxlength) {
  157658. flushArrayBuffers(this);
  157659. }
  157660. this.arrayBuffers.push(array.buffer);
  157661. }
  157662. getData() {
  157663. if (!this.blob) {
  157664. if (this.arrayBuffers.length) {
  157665. flushArrayBuffers(this);
  157666. }
  157667. this.blob = this.pendingBlob;
  157668. initArrayBuffers(this);
  157669. }
  157670. return this.blob;
  157671. }
  157672. };
  157673. function initArrayBuffers(blobWriter) {
  157674. blobWriter.pendingBlob = new Blob([], { type: blobWriter.contentType });
  157675. blobWriter.arrayBuffers = [];
  157676. }
  157677. function flushArrayBuffers(blobWriter) {
  157678. blobWriter.pendingBlob = new Blob([blobWriter.pendingBlob, ...blobWriter.arrayBuffers], { type: blobWriter.contentType });
  157679. blobWriter.arrayBuffers = [];
  157680. }
  157681. var WritableStreamWriter = class extends Writer {
  157682. constructor(writableStream) {
  157683. super();
  157684. this.writableStream = writableStream;
  157685. this.writer = writableStream.getWriter();
  157686. }
  157687. async writeUint8Array(array) {
  157688. await this.writer.ready;
  157689. return this.writer.write(array);
  157690. }
  157691. async getData() {
  157692. await this.writer.ready;
  157693. await this.writer.close();
  157694. return this.writableStream;
  157695. }
  157696. };
  157697. var FetchReader = class extends Reader {
  157698. constructor(url2, options) {
  157699. super();
  157700. this.url = url2;
  157701. this.preventHeadRequest = options.preventHeadRequest;
  157702. this.useRangeHeader = options.useRangeHeader;
  157703. this.forceRangeRequests = options.forceRangeRequests;
  157704. this.options = Object.assign({}, options);
  157705. delete this.options.preventHeadRequest;
  157706. delete this.options.useRangeHeader;
  157707. delete this.options.forceRangeRequests;
  157708. delete this.options.useXHR;
  157709. }
  157710. async init() {
  157711. super.init();
  157712. await initHttpReader(this, sendFetchRequest, getFetchRequestData);
  157713. }
  157714. async readUint8Array(index2, length3) {
  157715. return readUint8ArrayHttpReader(this, index2, length3, sendFetchRequest, getFetchRequestData);
  157716. }
  157717. };
  157718. var XHRReader = class extends Reader {
  157719. constructor(url2, options) {
  157720. super();
  157721. this.url = url2;
  157722. this.preventHeadRequest = options.preventHeadRequest;
  157723. this.useRangeHeader = options.useRangeHeader;
  157724. this.forceRangeRequests = options.forceRangeRequests;
  157725. this.options = options;
  157726. }
  157727. async init() {
  157728. super.init();
  157729. await initHttpReader(this, sendXMLHttpRequest, getXMLHttpRequestData);
  157730. }
  157731. async readUint8Array(index2, length3) {
  157732. return readUint8ArrayHttpReader(this, index2, length3, sendXMLHttpRequest, getXMLHttpRequestData);
  157733. }
  157734. };
  157735. async function initHttpReader(httpReader, sendRequest, getRequestData2) {
  157736. if (isHttpFamily(httpReader.url) && (httpReader.useRangeHeader || httpReader.forceRangeRequests)) {
  157737. const response = await sendRequest(HTTP_METHOD_GET, httpReader, getRangeHeaders(httpReader));
  157738. if (!httpReader.forceRangeRequests && response.headers.get(HTTP_HEADER_ACCEPT_RANGES) != HTTP_RANGE_UNIT) {
  157739. throw new Error(ERR_HTTP_RANGE);
  157740. } else {
  157741. let contentSize;
  157742. const contentRangeHeader = response.headers.get(HTTP_HEADER_CONTENT_RANGE);
  157743. if (contentRangeHeader) {
  157744. const splitHeader = contentRangeHeader.trim().split(/\s*\/\s*/);
  157745. if (splitHeader.length) {
  157746. const headerValue = splitHeader[1];
  157747. if (headerValue && headerValue != "*") {
  157748. contentSize = Number(headerValue);
  157749. }
  157750. }
  157751. }
  157752. if (contentSize === void 0) {
  157753. await getContentLength(httpReader, sendRequest, getRequestData2);
  157754. } else {
  157755. httpReader.size = contentSize;
  157756. }
  157757. }
  157758. } else {
  157759. await getContentLength(httpReader, sendRequest, getRequestData2);
  157760. }
  157761. }
  157762. async function readUint8ArrayHttpReader(httpReader, index2, length3, sendRequest, getRequestData2) {
  157763. if (httpReader.useRangeHeader || httpReader.forceRangeRequests) {
  157764. const response = await sendRequest(HTTP_METHOD_GET, httpReader, getRangeHeaders(httpReader, index2, length3));
  157765. if (response.status != 206) {
  157766. throw new Error(ERR_HTTP_RANGE);
  157767. }
  157768. return new Uint8Array(await response.arrayBuffer());
  157769. } else {
  157770. if (!httpReader.data) {
  157771. await getRequestData2(httpReader, httpReader.options);
  157772. }
  157773. return new Uint8Array(httpReader.data.subarray(index2, index2 + length3));
  157774. }
  157775. }
  157776. function getRangeHeaders(httpReader, index2 = 0, length3 = 1) {
  157777. return Object.assign({}, getHeaders(httpReader), { [HTTP_HEADER_RANGE]: HTTP_RANGE_UNIT + "=" + index2 + "-" + (index2 + length3 - 1) });
  157778. }
  157779. function getHeaders(httpReader) {
  157780. let headers = httpReader.options.headers;
  157781. if (headers) {
  157782. if (Symbol.iterator in headers) {
  157783. return Object.fromEntries(headers);
  157784. } else {
  157785. return headers;
  157786. }
  157787. }
  157788. }
  157789. async function getFetchRequestData(httpReader) {
  157790. await getRequestData(httpReader, sendFetchRequest);
  157791. }
  157792. async function getXMLHttpRequestData(httpReader) {
  157793. await getRequestData(httpReader, sendXMLHttpRequest);
  157794. }
  157795. async function getRequestData(httpReader, sendRequest) {
  157796. const response = await sendRequest(HTTP_METHOD_GET, httpReader, getHeaders(httpReader));
  157797. httpReader.data = new Uint8Array(await response.arrayBuffer());
  157798. if (!httpReader.size) {
  157799. httpReader.size = httpReader.data.length;
  157800. }
  157801. }
  157802. async function getContentLength(httpReader, sendRequest, getRequestData2) {
  157803. if (httpReader.preventHeadRequest) {
  157804. await getRequestData2(httpReader, httpReader.options);
  157805. } else {
  157806. const response = await sendRequest(HTTP_METHOD_HEAD, httpReader, getHeaders(httpReader));
  157807. const contentLength = response.headers.get(HTTP_HEADER_CONTENT_LENGTH);
  157808. if (contentLength) {
  157809. httpReader.size = Number(contentLength);
  157810. } else {
  157811. await getRequestData2(httpReader, httpReader.options);
  157812. }
  157813. }
  157814. }
  157815. async function sendFetchRequest(method, { options, url: url2 }, headers) {
  157816. const response = await fetch(url2, Object.assign({}, options, { method, headers }));
  157817. if (response.status < 400) {
  157818. return response;
  157819. } else {
  157820. throw new Error(ERR_HTTP_STATUS + (response.statusText || response.status));
  157821. }
  157822. }
  157823. function sendXMLHttpRequest(method, { url: url2 }, headers) {
  157824. return new Promise((resolve2, reject) => {
  157825. const request = new XMLHttpRequest();
  157826. request.addEventListener("load", () => {
  157827. if (request.status < 400) {
  157828. const headers2 = [];
  157829. request.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((header) => {
  157830. const splitHeader = header.trim().split(/\s*:\s*/);
  157831. splitHeader[0] = splitHeader[0].trim().replace(/^[a-z]|-[a-z]/g, (value) => value.toUpperCase());
  157832. headers2.push(splitHeader);
  157833. });
  157834. resolve2({
  157835. status: request.status,
  157836. arrayBuffer: () => request.response,
  157837. headers: new Map(headers2)
  157838. });
  157839. } else {
  157840. reject(new Error(ERR_HTTP_STATUS + (request.statusText || request.status)));
  157841. }
  157842. }, false);
  157843. request.addEventListener("error", (event) => reject(event.detail.error), false);
  157844. request.open(method, url2);
  157845. if (headers) {
  157846. for (const entry of Object.entries(headers)) {
  157847. request.setRequestHeader(entry[0], entry[1]);
  157848. }
  157849. }
  157850. request.responseType = "arraybuffer";
  157851. request.send();
  157852. });
  157853. }
  157854. var HttpReader = class extends Reader {
  157855. constructor(url2, options = {}) {
  157856. super();
  157857. this.url = url2;
  157858. if (options.useXHR) {
  157859. this.reader = new XHRReader(url2, options);
  157860. } else {
  157861. this.reader = new FetchReader(url2, options);
  157862. }
  157863. }
  157864. set size(value) {
  157865. }
  157866. get size() {
  157867. return this.reader.size;
  157868. }
  157869. async init() {
  157870. super.init();
  157871. await this.reader.init();
  157872. }
  157873. async readUint8Array(index2, length3) {
  157874. return this.reader.readUint8Array(index2, length3);
  157875. }
  157876. };
  157877. var HttpRangeReader = class extends HttpReader {
  157878. constructor(url2, options = {}) {
  157879. options.useRangeHeader = true;
  157880. super(url2, options);
  157881. }
  157882. };
  157883. var Uint8ArrayReader = class extends Reader {
  157884. constructor(array) {
  157885. super();
  157886. this.array = array;
  157887. this.size = array.length;
  157888. }
  157889. async readUint8Array(index2, length3) {
  157890. return this.array.slice(index2, index2 + length3);
  157891. }
  157892. };
  157893. var Uint8ArrayWriter = class extends Writer {
  157894. constructor() {
  157895. super();
  157896. this.array = new Uint8Array(0);
  157897. }
  157898. async writeUint8Array(array) {
  157899. super.writeUint8Array(array);
  157900. const previousArray = this.array;
  157901. this.array = new Uint8Array(previousArray.length + array.length);
  157902. this.array.set(previousArray);
  157903. this.array.set(array, previousArray.length);
  157904. }
  157905. getData() {
  157906. return this.array;
  157907. }
  157908. };
  157909. function isHttpFamily(url2) {
  157910. if (typeof document != "undefined") {
  157911. const anchor = document.createElement("a");
  157912. anchor.href = url2;
  157913. return anchor.protocol == "http:" || anchor.protocol == "https:";
  157914. } else {
  157915. return /^https?:\/\//i.test(url2);
  157916. }
  157917. }
  157918. var MAX_32_BITS = 4294967295;
  157919. var MAX_16_BITS = 65535;
  157920. var COMPRESSION_METHOD_DEFLATE = 8;
  157921. var COMPRESSION_METHOD_STORE = 0;
  157922. var COMPRESSION_METHOD_AES = 99;
  157923. var LOCAL_FILE_HEADER_SIGNATURE = 67324752;
  157924. var DATA_DESCRIPTOR_RECORD_SIGNATURE = 134695760;
  157925. var CENTRAL_FILE_HEADER_SIGNATURE = 33639248;
  157926. var END_OF_CENTRAL_DIR_SIGNATURE = 101010256;
  157927. var ZIP64_END_OF_CENTRAL_DIR_SIGNATURE = 101075792;
  157928. var ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE = 117853008;
  157929. var END_OF_CENTRAL_DIR_LENGTH = 22;
  157930. var ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH = 20;
  157931. var ZIP64_END_OF_CENTRAL_DIR_LENGTH = 56;
  157932. var ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH = END_OF_CENTRAL_DIR_LENGTH + ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH + ZIP64_END_OF_CENTRAL_DIR_LENGTH;
  157933. var ZIP64_TOTAL_NUMBER_OF_DISKS = 1;
  157934. var EXTRAFIELD_TYPE_ZIP64 = 1;
  157935. var EXTRAFIELD_TYPE_AES = 39169;
  157936. var EXTRAFIELD_TYPE_NTFS = 10;
  157937. var EXTRAFIELD_TYPE_NTFS_TAG1 = 1;
  157938. var EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP = 21589;
  157939. var EXTRAFIELD_TYPE_UNICODE_PATH = 28789;
  157940. var EXTRAFIELD_TYPE_UNICODE_COMMENT = 25461;
  157941. var BITFLAG_ENCRYPTED = 1;
  157942. var BITFLAG_LEVEL = 6;
  157943. var BITFLAG_DATA_DESCRIPTOR = 8;
  157944. var BITFLAG_LANG_ENCODING_FLAG = 2048;
  157945. var FILE_ATTR_MSDOS_DIR_MASK = 16;
  157946. var VERSION_DEFLATE = 20;
  157947. var VERSION_ZIP64 = 45;
  157948. var VERSION_AES = 51;
  157949. var DIRECTORY_SIGNATURE = "/";
  157950. var MAX_DATE = new Date(2107, 11, 31);
  157951. var MIN_DATE = new Date(1980, 0, 1);
  157952. var CP437 = "\0\u263A\u263B\u2665\u2666\u2663\u2660\u2022\u25D8\u25CB\u25D9\u2642\u2640\u266A\u266B\u263C\u25BA\u25C4\u2195\u203C\xB6\xA7\u25AC\u21A8\u2191\u2193\u2192\u2190\u221F\u2194\u25B2\u25BC !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\u2302\xC7\xFC\xE9\xE2\xE4\xE0\xE5\xE7\xEA\xEB\xE8\xEF\xEE\xEC\xC4\xC5\xC9\xE6\xC6\xF4\xF6\xF2\xFB\xF9\xFF\xD6\xDC\xA2\xA3\xA5\u20A7\u0192\xE1\xED\xF3\xFA\xF1\xD1\xAA\xBA\xBF\u2310\xAC\xBD\xBC\xA1\xAB\xBB\u2591\u2592\u2593\u2502\u2524\u2561\u2562\u2556\u2555\u2563\u2551\u2557\u255D\u255C\u255B\u2510\u2514\u2534\u252C\u251C\u2500\u253C\u255E\u255F\u255A\u2554\u2569\u2566\u2560\u2550\u256C\u2567\u2568\u2564\u2565\u2559\u2558\u2552\u2553\u256B\u256A\u2518\u250C\u2588\u2584\u258C\u2590\u2580\u03B1\xDF\u0393\u03C0\u03A3\u03C3\xB5\u03C4\u03A6\u0398\u03A9\u03B4\u221E\u03C6\u03B5\u2229\u2261\xB1\u2265\u2264\u2320\u2321\xF7\u2248\xB0\u2219\xB7\u221A\u207F\xB2\u25A0 ".split("");
  157953. var decodeCP437 = (stringValue) => {
  157954. let result = "";
  157955. for (let indexCharacter = 0; indexCharacter < stringValue.length; indexCharacter++) {
  157956. result += CP437[stringValue[indexCharacter]];
  157957. }
  157958. return result;
  157959. };
  157960. async function decodeText(value, encoding) {
  157961. if (encoding && encoding.trim().toLowerCase() == "cp437") {
  157962. return decodeCP437(value);
  157963. } else if (typeof TextDecoder == "undefined") {
  157964. const fileReader = new FileReader();
  157965. return new Promise((resolve2, reject) => {
  157966. fileReader.onload = (event) => resolve2(event.target.result);
  157967. fileReader.onerror = () => reject(fileReader.error);
  157968. fileReader.readAsText(new Blob([value]));
  157969. });
  157970. } else {
  157971. return new TextDecoder(encoding).decode(value);
  157972. }
  157973. }
  157974. var PROPERTY_NAMES = [
  157975. "filename",
  157976. "rawFilename",
  157977. "directory",
  157978. "encrypted",
  157979. "compressedSize",
  157980. "uncompressedSize",
  157981. "lastModDate",
  157982. "rawLastModDate",
  157983. "comment",
  157984. "rawComment",
  157985. "signature",
  157986. "extraField",
  157987. "rawExtraField",
  157988. "bitFlag",
  157989. "extraFieldZip64",
  157990. "extraFieldUnicodePath",
  157991. "extraFieldUnicodeComment",
  157992. "extraFieldAES",
  157993. "filenameUTF8",
  157994. "commentUTF8",
  157995. "offset",
  157996. "zip64",
  157997. "compressionMethod",
  157998. "extraFieldNTFS",
  157999. "lastAccessDate",
  158000. "creationDate",
  158001. "extraFieldExtendedTimestamp",
  158002. "version",
  158003. "versionMadeBy",
  158004. "msDosCompatible",
  158005. "internalFileAttribute",
  158006. "externalFileAttribute"
  158007. ];
  158008. var Entry = class {
  158009. constructor(data) {
  158010. PROPERTY_NAMES.forEach((name) => this[name] = data[name]);
  158011. }
  158012. };
  158013. var ERR_BAD_FORMAT = "File format is not recognized";
  158014. var ERR_EOCDR_NOT_FOUND = "End of central directory not found";
  158015. var ERR_EOCDR_ZIP64_NOT_FOUND = "End of Zip64 central directory not found";
  158016. var ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND = "End of Zip64 central directory locator not found";
  158017. var ERR_CENTRAL_DIRECTORY_NOT_FOUND = "Central directory header not found";
  158018. var ERR_LOCAL_FILE_HEADER_NOT_FOUND = "Local file header not found";
  158019. var ERR_EXTRAFIELD_ZIP64_NOT_FOUND = "Zip64 extra field not found";
  158020. var ERR_ENCRYPTED = "File contains encrypted entry";
  158021. var ERR_UNSUPPORTED_ENCRYPTION = "Encryption method not supported";
  158022. var ERR_UNSUPPORTED_COMPRESSION = "Compression method not supported";
  158023. var CHARSET_UTF8 = "utf-8";
  158024. var CHARSET_CP437 = "cp437";
  158025. var ZIP64_PROPERTIES = ["uncompressedSize", "compressedSize", "offset"];
  158026. var ZipReader = class {
  158027. constructor(reader, options = {}) {
  158028. Object.assign(this, {
  158029. reader,
  158030. options,
  158031. config: getConfiguration()
  158032. });
  158033. }
  158034. async getEntries(options = {}) {
  158035. const zipReader = this;
  158036. const reader = zipReader.reader;
  158037. if (!reader.initialized) {
  158038. await reader.init();
  158039. }
  158040. if (reader.size < END_OF_CENTRAL_DIR_LENGTH) {
  158041. throw new Error(ERR_BAD_FORMAT);
  158042. }
  158043. const endOfDirectoryInfo = await seekSignature(reader, END_OF_CENTRAL_DIR_SIGNATURE, reader.size, END_OF_CENTRAL_DIR_LENGTH, MAX_16_BITS * 16);
  158044. if (!endOfDirectoryInfo) {
  158045. throw new Error(ERR_EOCDR_NOT_FOUND);
  158046. }
  158047. const endOfDirectoryView = getDataView$1(endOfDirectoryInfo);
  158048. let directoryDataLength = getUint32(endOfDirectoryView, 12);
  158049. let directoryDataOffset = getUint32(endOfDirectoryView, 16);
  158050. let filesLength = getUint16(endOfDirectoryView, 8);
  158051. let prependedDataLength = 0;
  158052. if (directoryDataOffset == MAX_32_BITS || directoryDataLength == MAX_32_BITS || filesLength == MAX_16_BITS) {
  158053. const endOfDirectoryLocatorArray = await readUint8Array(reader, endOfDirectoryInfo.offset - ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH, ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH);
  158054. const endOfDirectoryLocatorView = getDataView$1(endOfDirectoryLocatorArray);
  158055. if (getUint32(endOfDirectoryLocatorView, 0) != ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE) {
  158056. throw new Error(ERR_EOCDR_ZIP64_NOT_FOUND);
  158057. }
  158058. directoryDataOffset = getBigUint64(endOfDirectoryLocatorView, 8);
  158059. let endOfDirectoryArray = await readUint8Array(reader, directoryDataOffset, ZIP64_END_OF_CENTRAL_DIR_LENGTH);
  158060. let endOfDirectoryView2 = getDataView$1(endOfDirectoryArray);
  158061. const expectedDirectoryDataOffset = endOfDirectoryInfo.offset - ZIP64_END_OF_CENTRAL_DIR_LOCATOR_LENGTH - ZIP64_END_OF_CENTRAL_DIR_LENGTH;
  158062. if (getUint32(endOfDirectoryView2, 0) != ZIP64_END_OF_CENTRAL_DIR_SIGNATURE && directoryDataOffset != expectedDirectoryDataOffset) {
  158063. const originalDirectoryDataOffset = directoryDataOffset;
  158064. directoryDataOffset = expectedDirectoryDataOffset;
  158065. prependedDataLength = directoryDataOffset - originalDirectoryDataOffset;
  158066. endOfDirectoryArray = await readUint8Array(reader, directoryDataOffset, ZIP64_END_OF_CENTRAL_DIR_LENGTH);
  158067. endOfDirectoryView2 = getDataView$1(endOfDirectoryArray);
  158068. }
  158069. if (getUint32(endOfDirectoryView2, 0) != ZIP64_END_OF_CENTRAL_DIR_SIGNATURE) {
  158070. throw new Error(ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND);
  158071. }
  158072. filesLength = getBigUint64(endOfDirectoryView2, 32);
  158073. directoryDataLength = getBigUint64(endOfDirectoryView2, 40);
  158074. directoryDataOffset -= directoryDataLength;
  158075. }
  158076. if (directoryDataOffset < 0 || directoryDataOffset >= reader.size) {
  158077. throw new Error(ERR_BAD_FORMAT);
  158078. }
  158079. let offset2 = 0;
  158080. let directoryArray = await readUint8Array(reader, directoryDataOffset, directoryDataLength);
  158081. let directoryView = getDataView$1(directoryArray);
  158082. if (directoryDataLength) {
  158083. const expectedDirectoryDataOffset = endOfDirectoryInfo.offset - directoryDataLength;
  158084. if (getUint32(directoryView, offset2) != CENTRAL_FILE_HEADER_SIGNATURE && directoryDataOffset != expectedDirectoryDataOffset) {
  158085. const originalDirectoryDataOffset = directoryDataOffset;
  158086. directoryDataOffset = expectedDirectoryDataOffset;
  158087. prependedDataLength = directoryDataOffset - originalDirectoryDataOffset;
  158088. directoryArray = await readUint8Array(reader, directoryDataOffset, directoryDataLength);
  158089. directoryView = getDataView$1(directoryArray);
  158090. }
  158091. }
  158092. if (directoryDataOffset < 0 || directoryDataOffset >= reader.size) {
  158093. throw new Error(ERR_BAD_FORMAT);
  158094. }
  158095. const entries = [];
  158096. for (let indexFile = 0; indexFile < filesLength; indexFile++) {
  158097. const fileEntry = new ZipEntry(reader, zipReader.config, zipReader.options);
  158098. if (getUint32(directoryView, offset2) != CENTRAL_FILE_HEADER_SIGNATURE) {
  158099. throw new Error(ERR_CENTRAL_DIRECTORY_NOT_FOUND);
  158100. }
  158101. readCommonHeader(fileEntry, directoryView, offset2 + 6);
  158102. const languageEncodingFlag = Boolean(fileEntry.bitFlag.languageEncodingFlag);
  158103. const filenameOffset = offset2 + 46;
  158104. const extraFieldOffset = filenameOffset + fileEntry.filenameLength;
  158105. const commentOffset = extraFieldOffset + fileEntry.extraFieldLength;
  158106. const versionMadeBy = getUint16(directoryView, offset2 + 4);
  158107. const msDosCompatible = (versionMadeBy & 0) == 0;
  158108. Object.assign(fileEntry, {
  158109. versionMadeBy,
  158110. msDosCompatible,
  158111. compressedSize: 0,
  158112. uncompressedSize: 0,
  158113. commentLength: getUint16(directoryView, offset2 + 32),
  158114. directory: msDosCompatible && (getUint8(directoryView, offset2 + 38) & FILE_ATTR_MSDOS_DIR_MASK) == FILE_ATTR_MSDOS_DIR_MASK,
  158115. offset: getUint32(directoryView, offset2 + 42) + prependedDataLength,
  158116. internalFileAttribute: getUint32(directoryView, offset2 + 34),
  158117. externalFileAttribute: getUint32(directoryView, offset2 + 38),
  158118. rawFilename: directoryArray.subarray(filenameOffset, extraFieldOffset),
  158119. filenameUTF8: languageEncodingFlag,
  158120. commentUTF8: languageEncodingFlag,
  158121. rawExtraField: directoryArray.subarray(extraFieldOffset, commentOffset)
  158122. });
  158123. const endOffset = commentOffset + fileEntry.commentLength;
  158124. fileEntry.rawComment = directoryArray.subarray(commentOffset, endOffset);
  158125. const filenameEncoding = getOptionValue$1(zipReader, options, "filenameEncoding");
  158126. const commentEncoding = getOptionValue$1(zipReader, options, "commentEncoding");
  158127. const [filename, comment] = await Promise.all([
  158128. decodeText(fileEntry.rawFilename, fileEntry.filenameUTF8 ? CHARSET_UTF8 : filenameEncoding || CHARSET_CP437),
  158129. decodeText(fileEntry.rawComment, fileEntry.commentUTF8 ? CHARSET_UTF8 : commentEncoding || CHARSET_CP437)
  158130. ]);
  158131. fileEntry.filename = filename;
  158132. fileEntry.comment = comment;
  158133. if (!fileEntry.directory && fileEntry.filename.endsWith(DIRECTORY_SIGNATURE)) {
  158134. fileEntry.directory = true;
  158135. }
  158136. await readCommonFooter(fileEntry, fileEntry, directoryView, offset2 + 6);
  158137. const entry = new Entry(fileEntry);
  158138. entry.getData = (writer, options2) => fileEntry.getData(writer, entry, options2);
  158139. entries.push(entry);
  158140. offset2 = endOffset;
  158141. if (options.onprogress) {
  158142. try {
  158143. options.onprogress(indexFile + 1, filesLength, new Entry(fileEntry));
  158144. } catch (error) {
  158145. }
  158146. }
  158147. }
  158148. return entries;
  158149. }
  158150. async close() {
  158151. }
  158152. };
  158153. var ZipEntry = class {
  158154. constructor(reader, config2, options) {
  158155. Object.assign(this, {
  158156. reader,
  158157. config: config2,
  158158. options
  158159. });
  158160. }
  158161. async getData(writer, fileEntry, options = {}) {
  158162. const zipEntry = this;
  158163. const {
  158164. reader,
  158165. offset: offset2,
  158166. extraFieldAES,
  158167. compressionMethod,
  158168. config: config2,
  158169. bitFlag,
  158170. signature,
  158171. rawLastModDate,
  158172. compressedSize
  158173. } = zipEntry;
  158174. const localDirectory = zipEntry.localDirectory = {};
  158175. if (!reader.initialized) {
  158176. await reader.init();
  158177. }
  158178. let dataArray = await readUint8Array(reader, offset2, 30);
  158179. const dataView = getDataView$1(dataArray);
  158180. let password = getOptionValue$1(zipEntry, options, "password");
  158181. password = password && password.length && password;
  158182. if (extraFieldAES) {
  158183. if (extraFieldAES.originalCompressionMethod != COMPRESSION_METHOD_AES) {
  158184. throw new Error(ERR_UNSUPPORTED_COMPRESSION);
  158185. }
  158186. }
  158187. if (compressionMethod != COMPRESSION_METHOD_STORE && compressionMethod != COMPRESSION_METHOD_DEFLATE) {
  158188. throw new Error(ERR_UNSUPPORTED_COMPRESSION);
  158189. }
  158190. if (getUint32(dataView, 0) != LOCAL_FILE_HEADER_SIGNATURE) {
  158191. throw new Error(ERR_LOCAL_FILE_HEADER_NOT_FOUND);
  158192. }
  158193. readCommonHeader(localDirectory, dataView, 4);
  158194. dataArray = await readUint8Array(reader, offset2, 30 + localDirectory.filenameLength + localDirectory.extraFieldLength);
  158195. localDirectory.rawExtraField = dataArray.subarray(30 + localDirectory.filenameLength);
  158196. await readCommonFooter(zipEntry, localDirectory, dataView, 4);
  158197. fileEntry.lastAccessDate = localDirectory.lastAccessDate;
  158198. fileEntry.creationDate = localDirectory.creationDate;
  158199. const encrypted = zipEntry.encrypted && localDirectory.encrypted;
  158200. const zipCrypto = encrypted && !extraFieldAES;
  158201. if (encrypted) {
  158202. if (!zipCrypto && extraFieldAES.strength === void 0) {
  158203. throw new Error(ERR_UNSUPPORTED_ENCRYPTION);
  158204. } else if (!password) {
  158205. throw new Error(ERR_ENCRYPTED);
  158206. }
  158207. }
  158208. const codec2 = await createCodec(config2.Inflate, {
  158209. codecType: CODEC_INFLATE,
  158210. password,
  158211. zipCrypto,
  158212. encryptionStrength: extraFieldAES && extraFieldAES.strength,
  158213. signed: getOptionValue$1(zipEntry, options, "checkSignature"),
  158214. passwordVerification: zipCrypto && (bitFlag.dataDescriptor ? rawLastModDate >>> 8 & 255 : signature >>> 24 & 255),
  158215. signature,
  158216. compressed: compressionMethod != 0,
  158217. encrypted,
  158218. useWebWorkers: getOptionValue$1(zipEntry, options, "useWebWorkers")
  158219. }, config2);
  158220. if (!writer.initialized) {
  158221. await writer.init();
  158222. }
  158223. const signal = getOptionValue$1(zipEntry, options, "signal");
  158224. const dataOffset = offset2 + 30 + localDirectory.filenameLength + localDirectory.extraFieldLength;
  158225. await processData(codec2, reader, writer, dataOffset, compressedSize, config2, { onprogress: options.onprogress, signal });
  158226. return writer.getData();
  158227. }
  158228. };
  158229. function readCommonHeader(directory, dataView, offset2) {
  158230. const rawBitFlag = directory.rawBitFlag = getUint16(dataView, offset2 + 2);
  158231. const encrypted = (rawBitFlag & BITFLAG_ENCRYPTED) == BITFLAG_ENCRYPTED;
  158232. const rawLastModDate = getUint32(dataView, offset2 + 6);
  158233. Object.assign(directory, {
  158234. encrypted,
  158235. version: getUint16(dataView, offset2),
  158236. bitFlag: {
  158237. level: (rawBitFlag & BITFLAG_LEVEL) >> 1,
  158238. dataDescriptor: (rawBitFlag & BITFLAG_DATA_DESCRIPTOR) == BITFLAG_DATA_DESCRIPTOR,
  158239. languageEncodingFlag: (rawBitFlag & BITFLAG_LANG_ENCODING_FLAG) == BITFLAG_LANG_ENCODING_FLAG
  158240. },
  158241. rawLastModDate,
  158242. lastModDate: getDate(rawLastModDate),
  158243. filenameLength: getUint16(dataView, offset2 + 22),
  158244. extraFieldLength: getUint16(dataView, offset2 + 24)
  158245. });
  158246. }
  158247. async function readCommonFooter(fileEntry, directory, dataView, offset2) {
  158248. const rawExtraField = directory.rawExtraField;
  158249. const extraField = directory.extraField = /* @__PURE__ */ new Map();
  158250. const rawExtraFieldView = getDataView$1(new Uint8Array(rawExtraField));
  158251. let offsetExtraField = 0;
  158252. try {
  158253. while (offsetExtraField < rawExtraField.length) {
  158254. const type = getUint16(rawExtraFieldView, offsetExtraField);
  158255. const size = getUint16(rawExtraFieldView, offsetExtraField + 2);
  158256. extraField.set(type, {
  158257. type,
  158258. data: rawExtraField.slice(offsetExtraField + 4, offsetExtraField + 4 + size)
  158259. });
  158260. offsetExtraField += 4 + size;
  158261. }
  158262. } catch (error) {
  158263. }
  158264. const compressionMethod = getUint16(dataView, offset2 + 4);
  158265. directory.signature = getUint32(dataView, offset2 + 10);
  158266. directory.uncompressedSize = getUint32(dataView, offset2 + 18);
  158267. directory.compressedSize = getUint32(dataView, offset2 + 14);
  158268. const extraFieldZip64 = extraField.get(EXTRAFIELD_TYPE_ZIP64);
  158269. if (extraFieldZip64) {
  158270. readExtraFieldZip64(extraFieldZip64, directory);
  158271. directory.extraFieldZip64 = extraFieldZip64;
  158272. }
  158273. const extraFieldUnicodePath = extraField.get(EXTRAFIELD_TYPE_UNICODE_PATH);
  158274. if (extraFieldUnicodePath) {
  158275. await readExtraFieldUnicode(extraFieldUnicodePath, "filename", "rawFilename", directory, fileEntry);
  158276. directory.extraFieldUnicodePath = extraFieldUnicodePath;
  158277. }
  158278. const extraFieldUnicodeComment = extraField.get(EXTRAFIELD_TYPE_UNICODE_COMMENT);
  158279. if (extraFieldUnicodeComment) {
  158280. await readExtraFieldUnicode(extraFieldUnicodeComment, "comment", "rawComment", directory, fileEntry);
  158281. directory.extraFieldUnicodeComment = extraFieldUnicodeComment;
  158282. }
  158283. const extraFieldAES = extraField.get(EXTRAFIELD_TYPE_AES);
  158284. if (extraFieldAES) {
  158285. readExtraFieldAES(extraFieldAES, directory, compressionMethod);
  158286. directory.extraFieldAES = extraFieldAES;
  158287. } else {
  158288. directory.compressionMethod = compressionMethod;
  158289. }
  158290. const extraFieldNTFS = extraField.get(EXTRAFIELD_TYPE_NTFS);
  158291. if (extraFieldNTFS) {
  158292. readExtraFieldNTFS(extraFieldNTFS, directory);
  158293. directory.extraFieldNTFS = extraFieldNTFS;
  158294. }
  158295. const extraFieldExtendedTimestamp = extraField.get(EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
  158296. if (extraFieldExtendedTimestamp) {
  158297. readExtraFieldExtendedTimestamp(extraFieldExtendedTimestamp, directory);
  158298. directory.extraFieldExtendedTimestamp = extraFieldExtendedTimestamp;
  158299. }
  158300. }
  158301. function readExtraFieldZip64(extraFieldZip64, directory) {
  158302. directory.zip64 = true;
  158303. const extraFieldView = getDataView$1(extraFieldZip64.data);
  158304. extraFieldZip64.values = [];
  158305. for (let indexValue = 0; indexValue < Math.floor(extraFieldZip64.data.length / 8); indexValue++) {
  158306. extraFieldZip64.values.push(getBigUint64(extraFieldView, 0 + indexValue * 8));
  158307. }
  158308. const missingProperties = ZIP64_PROPERTIES.filter((propertyName) => directory[propertyName] == MAX_32_BITS);
  158309. for (let indexMissingProperty = 0; indexMissingProperty < missingProperties.length; indexMissingProperty++) {
  158310. extraFieldZip64[missingProperties[indexMissingProperty]] = extraFieldZip64.values[indexMissingProperty];
  158311. }
  158312. ZIP64_PROPERTIES.forEach((propertyName) => {
  158313. if (directory[propertyName] == MAX_32_BITS) {
  158314. if (extraFieldZip64[propertyName] !== void 0) {
  158315. directory[propertyName] = extraFieldZip64[propertyName];
  158316. } else {
  158317. throw new Error(ERR_EXTRAFIELD_ZIP64_NOT_FOUND);
  158318. }
  158319. }
  158320. });
  158321. }
  158322. async function readExtraFieldUnicode(extraFieldUnicode, propertyName, rawPropertyName, directory, fileEntry) {
  158323. const extraFieldView = getDataView$1(extraFieldUnicode.data);
  158324. extraFieldUnicode.version = getUint8(extraFieldView, 0);
  158325. extraFieldUnicode.signature = getUint32(extraFieldView, 1);
  158326. const crc322 = new Crc32();
  158327. crc322.append(fileEntry[rawPropertyName]);
  158328. const dataViewSignature = getDataView$1(new Uint8Array(4));
  158329. dataViewSignature.setUint32(0, crc322.get(), true);
  158330. extraFieldUnicode[propertyName] = await decodeText(extraFieldUnicode.data.subarray(5));
  158331. extraFieldUnicode.valid = !fileEntry.bitFlag.languageEncodingFlag && extraFieldUnicode.signature == getUint32(dataViewSignature, 0);
  158332. if (extraFieldUnicode.valid) {
  158333. directory[propertyName] = extraFieldUnicode[propertyName];
  158334. directory[propertyName + "UTF8"] = true;
  158335. }
  158336. }
  158337. function readExtraFieldAES(extraFieldAES, directory, compressionMethod) {
  158338. const extraFieldView = getDataView$1(extraFieldAES.data);
  158339. extraFieldAES.vendorVersion = getUint8(extraFieldView, 0);
  158340. extraFieldAES.vendorId = getUint8(extraFieldView, 2);
  158341. const strength = getUint8(extraFieldView, 4);
  158342. extraFieldAES.strength = strength;
  158343. extraFieldAES.originalCompressionMethod = compressionMethod;
  158344. directory.compressionMethod = extraFieldAES.compressionMethod = getUint16(extraFieldView, 5);
  158345. }
  158346. function readExtraFieldNTFS(extraFieldNTFS, directory) {
  158347. const extraFieldView = getDataView$1(extraFieldNTFS.data);
  158348. let offsetExtraField = 4;
  158349. let tag1Data;
  158350. try {
  158351. while (offsetExtraField < extraFieldNTFS.data.length && !tag1Data) {
  158352. const tagValue = getUint16(extraFieldView, offsetExtraField);
  158353. const attributeSize = getUint16(extraFieldView, offsetExtraField + 2);
  158354. if (tagValue == EXTRAFIELD_TYPE_NTFS_TAG1) {
  158355. tag1Data = extraFieldNTFS.data.slice(offsetExtraField + 4, offsetExtraField + 4 + attributeSize);
  158356. }
  158357. offsetExtraField += 4 + attributeSize;
  158358. }
  158359. } catch (error) {
  158360. }
  158361. try {
  158362. if (tag1Data && tag1Data.length == 24) {
  158363. const tag1View = getDataView$1(tag1Data);
  158364. const rawLastModDate = tag1View.getBigUint64(0, true);
  158365. const rawLastAccessDate = tag1View.getBigUint64(8, true);
  158366. const rawCreationDate = tag1View.getBigUint64(16, true);
  158367. Object.assign(extraFieldNTFS, {
  158368. rawLastModDate,
  158369. rawLastAccessDate,
  158370. rawCreationDate
  158371. });
  158372. const lastModDate = getDateNTFS(rawLastModDate);
  158373. const lastAccessDate = getDateNTFS(rawLastAccessDate);
  158374. const creationDate = getDateNTFS(rawCreationDate);
  158375. const extraFieldData = { lastModDate, lastAccessDate, creationDate };
  158376. Object.assign(extraFieldNTFS, extraFieldData);
  158377. Object.assign(directory, extraFieldData);
  158378. }
  158379. } catch (error) {
  158380. }
  158381. }
  158382. function readExtraFieldExtendedTimestamp(extraFieldExtendedTimestamp, directory) {
  158383. const extraFieldView = getDataView$1(extraFieldExtendedTimestamp.data);
  158384. const flags = getUint8(extraFieldView, 0);
  158385. const timeProperties = [];
  158386. const timeRawProperties = [];
  158387. if ((flags & 1) == 1) {
  158388. timeProperties.push("lastModDate");
  158389. timeRawProperties.push("rawLastModDate");
  158390. }
  158391. if ((flags & 2) == 2) {
  158392. timeProperties.push("lastAccessDate");
  158393. timeRawProperties.push("rawLastAccessDate");
  158394. }
  158395. if ((flags & 4) == 4) {
  158396. timeProperties.push("creationDate");
  158397. timeRawProperties.push("rawCreationDate");
  158398. }
  158399. let offset2 = 1;
  158400. timeProperties.forEach((propertyName, indexProperty) => {
  158401. if (extraFieldExtendedTimestamp.data.length >= offset2 + 4) {
  158402. const time = getUint32(extraFieldView, offset2);
  158403. directory[propertyName] = extraFieldExtendedTimestamp[propertyName] = new Date(time * 1e3);
  158404. const rawPropertyName = timeRawProperties[indexProperty];
  158405. extraFieldExtendedTimestamp[rawPropertyName] = time;
  158406. }
  158407. offset2 += 4;
  158408. });
  158409. }
  158410. async function seekSignature(reader, signature, startOffset, minimumBytes, maximumLength) {
  158411. const signatureArray = new Uint8Array(4);
  158412. const signatureView = getDataView$1(signatureArray);
  158413. setUint32$1(signatureView, 0, signature);
  158414. const maximumBytes = minimumBytes + maximumLength;
  158415. return await seek(minimumBytes) || await seek(Math.min(maximumBytes, startOffset));
  158416. async function seek(length3) {
  158417. const offset2 = startOffset - length3;
  158418. const bytes = await readUint8Array(reader, offset2, length3);
  158419. for (let indexByte = bytes.length - minimumBytes; indexByte >= 0; indexByte--) {
  158420. if (bytes[indexByte] == signatureArray[0] && bytes[indexByte + 1] == signatureArray[1] && bytes[indexByte + 2] == signatureArray[2] && bytes[indexByte + 3] == signatureArray[3]) {
  158421. return {
  158422. offset: offset2 + indexByte,
  158423. buffer: bytes.slice(indexByte, indexByte + minimumBytes).buffer
  158424. };
  158425. }
  158426. }
  158427. }
  158428. }
  158429. function getOptionValue$1(zipReader, options, name) {
  158430. return options[name] === void 0 ? zipReader.options[name] : options[name];
  158431. }
  158432. function getDate(timeRaw) {
  158433. const date = (timeRaw & 4294901760) >> 16, time = timeRaw & 65535;
  158434. try {
  158435. return new Date(1980 + ((date & 65024) >> 9), ((date & 480) >> 5) - 1, date & 31, (time & 63488) >> 11, (time & 2016) >> 5, (time & 31) * 2, 0);
  158436. } catch (error) {
  158437. }
  158438. }
  158439. function getDateNTFS(timeRaw) {
  158440. return new Date(Number(timeRaw / BigInt(1e4) - BigInt(116444736e5)));
  158441. }
  158442. function getUint8(view, offset2) {
  158443. return view.getUint8(offset2);
  158444. }
  158445. function getUint16(view, offset2) {
  158446. return view.getUint16(offset2, true);
  158447. }
  158448. function getUint32(view, offset2) {
  158449. return view.getUint32(offset2, true);
  158450. }
  158451. function getBigUint64(view, offset2) {
  158452. return Number(view.getBigUint64(offset2, true));
  158453. }
  158454. function setUint32$1(view, offset2, value) {
  158455. view.setUint32(offset2, value, true);
  158456. }
  158457. function getDataView$1(array) {
  158458. return new DataView(array.buffer);
  158459. }
  158460. function readUint8Array(reader, offset2, size) {
  158461. return reader.readUint8Array(offset2, size);
  158462. }
  158463. var ERR_DUPLICATED_NAME = "File already exists";
  158464. var ERR_INVALID_COMMENT = "Zip file comment exceeds 64KB";
  158465. var ERR_INVALID_ENTRY_COMMENT = "File entry comment exceeds 64KB";
  158466. var ERR_INVALID_ENTRY_NAME = "File entry name exceeds 64KB";
  158467. var ERR_INVALID_VERSION = "Version exceeds 65535";
  158468. var ERR_INVALID_ENCRYPTION_STRENGTH = "The strength must equal 1, 2, or 3";
  158469. var ERR_INVALID_EXTRAFIELD_TYPE = "Extra field type exceeds 65535";
  158470. var ERR_INVALID_EXTRAFIELD_DATA = "Extra field data exceeds 64KB";
  158471. var ERR_UNSUPPORTED_FORMAT = "Zip64 is not supported";
  158472. var EXTRAFIELD_DATA_AES = new Uint8Array([7, 0, 2, 0, 65, 69, 3, 0, 0]);
  158473. var EXTRAFIELD_LENGTH_ZIP64 = 24;
  158474. var workers = 0;
  158475. var ZipWriter = class {
  158476. constructor(writer, options = {}) {
  158477. Object.assign(this, {
  158478. writer,
  158479. options,
  158480. config: getConfiguration(),
  158481. files: /* @__PURE__ */ new Map(),
  158482. offset: writer.size,
  158483. pendingCompressedSize: 0,
  158484. pendingEntries: []
  158485. });
  158486. }
  158487. async add(name = "", reader, options = {}) {
  158488. const zipWriter = this;
  158489. if (workers < zipWriter.config.maxWorkers) {
  158490. workers++;
  158491. try {
  158492. return await addFile(zipWriter, name, reader, options);
  158493. } finally {
  158494. workers--;
  158495. const pendingEntry = zipWriter.pendingEntries.shift();
  158496. if (pendingEntry) {
  158497. zipWriter.add(pendingEntry.name, pendingEntry.reader, pendingEntry.options).then(pendingEntry.resolve).catch(pendingEntry.reject);
  158498. }
  158499. }
  158500. } else {
  158501. return new Promise((resolve2, reject) => zipWriter.pendingEntries.push({ name, reader, options, resolve: resolve2, reject }));
  158502. }
  158503. }
  158504. async close(comment = new Uint8Array(0), options = {}) {
  158505. await closeFile(this, comment, options);
  158506. return this.writer.getData();
  158507. }
  158508. };
  158509. async function addFile(zipWriter, name, reader, options) {
  158510. name = name.trim();
  158511. if (options.directory && !name.endsWith(DIRECTORY_SIGNATURE)) {
  158512. name += DIRECTORY_SIGNATURE;
  158513. } else {
  158514. options.directory = name.endsWith(DIRECTORY_SIGNATURE);
  158515. }
  158516. if (zipWriter.files.has(name)) {
  158517. throw new Error(ERR_DUPLICATED_NAME);
  158518. }
  158519. const rawFilename = encodeText(name);
  158520. if (rawFilename.length > MAX_16_BITS) {
  158521. throw new Error(ERR_INVALID_ENTRY_NAME);
  158522. }
  158523. const comment = options.comment || "";
  158524. const rawComment = encodeText(comment);
  158525. if (rawComment.length > MAX_16_BITS) {
  158526. throw new Error(ERR_INVALID_ENTRY_COMMENT);
  158527. }
  158528. const version = zipWriter.options.version || options.version || 0;
  158529. if (version > MAX_16_BITS) {
  158530. throw new Error(ERR_INVALID_VERSION);
  158531. }
  158532. const versionMadeBy = zipWriter.options.versionMadeBy || options.versionMadeBy || 20;
  158533. if (versionMadeBy > MAX_16_BITS) {
  158534. throw new Error(ERR_INVALID_VERSION);
  158535. }
  158536. const lastModDate = getOptionValue(zipWriter, options, "lastModDate") || new Date();
  158537. const lastAccessDate = getOptionValue(zipWriter, options, "lastAccessDate");
  158538. const creationDate = getOptionValue(zipWriter, options, "creationDate");
  158539. const password = getOptionValue(zipWriter, options, "password");
  158540. const encryptionStrength = getOptionValue(zipWriter, options, "encryptionStrength") || 3;
  158541. const zipCrypto = getOptionValue(zipWriter, options, "zipCrypto");
  158542. if (password !== void 0 && encryptionStrength !== void 0 && (encryptionStrength < 1 || encryptionStrength > 3)) {
  158543. throw new Error(ERR_INVALID_ENCRYPTION_STRENGTH);
  158544. }
  158545. let rawExtraField = new Uint8Array(0);
  158546. const extraField = options.extraField;
  158547. if (extraField) {
  158548. let extraFieldSize = 0;
  158549. let offset2 = 0;
  158550. extraField.forEach((data) => extraFieldSize += 4 + data.length);
  158551. rawExtraField = new Uint8Array(extraFieldSize);
  158552. extraField.forEach((data, type) => {
  158553. if (type > MAX_16_BITS) {
  158554. throw new Error(ERR_INVALID_EXTRAFIELD_TYPE);
  158555. }
  158556. if (data.length > MAX_16_BITS) {
  158557. throw new Error(ERR_INVALID_EXTRAFIELD_DATA);
  158558. }
  158559. arraySet(rawExtraField, new Uint16Array([type]), offset2);
  158560. arraySet(rawExtraField, new Uint16Array([data.length]), offset2 + 2);
  158561. arraySet(rawExtraField, data, offset2 + 4);
  158562. offset2 += 4 + data.length;
  158563. });
  158564. }
  158565. let extendedTimestamp = getOptionValue(zipWriter, options, "extendedTimestamp");
  158566. if (extendedTimestamp === void 0) {
  158567. extendedTimestamp = true;
  158568. }
  158569. let maximumCompressedSize = 0;
  158570. let keepOrder = getOptionValue(zipWriter, options, "keepOrder");
  158571. if (keepOrder === void 0) {
  158572. keepOrder = true;
  158573. }
  158574. let uncompressedSize = 0;
  158575. let msDosCompatible = getOptionValue(zipWriter, options, "msDosCompatible");
  158576. if (msDosCompatible === void 0) {
  158577. msDosCompatible = true;
  158578. }
  158579. const internalFileAttribute = getOptionValue(zipWriter, options, "internalFileAttribute") || 0;
  158580. const externalFileAttribute = getOptionValue(zipWriter, options, "externalFileAttribute") || 0;
  158581. if (reader) {
  158582. if (!reader.initialized) {
  158583. await reader.init();
  158584. }
  158585. uncompressedSize = reader.size;
  158586. maximumCompressedSize = getMaximumCompressedSize(uncompressedSize);
  158587. }
  158588. let zip64 = options.zip64 || zipWriter.options.zip64 || false;
  158589. if (zipWriter.offset + zipWriter.pendingCompressedSize >= MAX_32_BITS || uncompressedSize >= MAX_32_BITS || maximumCompressedSize >= MAX_32_BITS) {
  158590. if (options.zip64 === false || zipWriter.options.zip64 === false || !keepOrder) {
  158591. throw new Error(ERR_UNSUPPORTED_FORMAT);
  158592. } else {
  158593. zip64 = true;
  158594. }
  158595. }
  158596. zipWriter.pendingCompressedSize += maximumCompressedSize;
  158597. await Promise.resolve();
  158598. const level = getOptionValue(zipWriter, options, "level");
  158599. const useWebWorkers = getOptionValue(zipWriter, options, "useWebWorkers");
  158600. const bufferedWrite = getOptionValue(zipWriter, options, "bufferedWrite");
  158601. let dataDescriptor = getOptionValue(zipWriter, options, "dataDescriptor");
  158602. let dataDescriptorSignature = getOptionValue(zipWriter, options, "dataDescriptorSignature");
  158603. const signal = getOptionValue(zipWriter, options, "signal");
  158604. if (dataDescriptor === void 0) {
  158605. dataDescriptor = true;
  158606. }
  158607. if (dataDescriptor && dataDescriptorSignature === void 0) {
  158608. dataDescriptorSignature = true;
  158609. }
  158610. const fileEntry = await getFileEntry(zipWriter, name, reader, Object.assign({}, options, {
  158611. rawFilename,
  158612. rawComment,
  158613. version,
  158614. versionMadeBy,
  158615. lastModDate,
  158616. lastAccessDate,
  158617. creationDate,
  158618. rawExtraField,
  158619. zip64,
  158620. password,
  158621. level,
  158622. useWebWorkers,
  158623. encryptionStrength,
  158624. extendedTimestamp,
  158625. zipCrypto,
  158626. bufferedWrite,
  158627. keepOrder,
  158628. dataDescriptor,
  158629. dataDescriptorSignature,
  158630. signal,
  158631. msDosCompatible,
  158632. internalFileAttribute,
  158633. externalFileAttribute
  158634. }));
  158635. if (maximumCompressedSize) {
  158636. zipWriter.pendingCompressedSize -= maximumCompressedSize;
  158637. }
  158638. Object.assign(fileEntry, { name, comment, extraField });
  158639. return new Entry(fileEntry);
  158640. }
  158641. async function getFileEntry(zipWriter, name, reader, options) {
  158642. const files = zipWriter.files;
  158643. const writer = zipWriter.writer;
  158644. const previousFileEntry = Array.from(files.values()).pop();
  158645. let fileEntry = {};
  158646. let bufferedWrite;
  158647. let resolveLockUnbufferedWrite;
  158648. let resolveLockCurrentFileEntry;
  158649. files.set(name, fileEntry);
  158650. try {
  158651. let lockPreviousFileEntry;
  158652. let fileWriter;
  158653. let lockCurrentFileEntry;
  158654. if (options.keepOrder) {
  158655. lockPreviousFileEntry = previousFileEntry && previousFileEntry.lock;
  158656. }
  158657. fileEntry.lock = lockCurrentFileEntry = new Promise((resolve2) => resolveLockCurrentFileEntry = resolve2);
  158658. if (options.bufferedWrite || zipWriter.lockWrite || !options.dataDescriptor) {
  158659. fileWriter = new BlobWriter();
  158660. fileWriter.init();
  158661. bufferedWrite = true;
  158662. } else {
  158663. zipWriter.lockWrite = new Promise((resolve2) => resolveLockUnbufferedWrite = resolve2);
  158664. if (!writer.initialized) {
  158665. await writer.init();
  158666. }
  158667. fileWriter = writer;
  158668. }
  158669. fileEntry = await createFileEntry(reader, fileWriter, zipWriter.config, options);
  158670. fileEntry.lock = lockCurrentFileEntry;
  158671. files.set(name, fileEntry);
  158672. fileEntry.filename = name;
  158673. if (bufferedWrite) {
  158674. let indexWrittenData = 0;
  158675. const blob = fileWriter.getData();
  158676. await Promise.all([zipWriter.lockWrite, lockPreviousFileEntry]);
  158677. let pendingFileEntry;
  158678. do {
  158679. pendingFileEntry = Array.from(files.values()).find((fileEntry2) => fileEntry2.writingBufferedData);
  158680. if (pendingFileEntry) {
  158681. await pendingFileEntry.lock;
  158682. }
  158683. } while (pendingFileEntry && pendingFileEntry.lock);
  158684. fileEntry.writingBufferedData = true;
  158685. if (!options.dataDescriptor) {
  158686. const headerLength = 26;
  158687. const arrayBuffer = await sliceAsArrayBuffer(blob, 0, headerLength);
  158688. const arrayBufferView = new DataView(arrayBuffer);
  158689. if (!fileEntry.encrypted || options.zipCrypto) {
  158690. setUint32(arrayBufferView, 14, fileEntry.signature);
  158691. }
  158692. if (fileEntry.zip64) {
  158693. setUint32(arrayBufferView, 18, MAX_32_BITS);
  158694. setUint32(arrayBufferView, 22, MAX_32_BITS);
  158695. } else {
  158696. setUint32(arrayBufferView, 18, fileEntry.compressedSize);
  158697. setUint32(arrayBufferView, 22, fileEntry.uncompressedSize);
  158698. }
  158699. await writer.writeUint8Array(new Uint8Array(arrayBuffer));
  158700. indexWrittenData = headerLength;
  158701. }
  158702. await writeBlob(writer, blob, indexWrittenData);
  158703. delete fileEntry.writingBufferedData;
  158704. }
  158705. fileEntry.offset = zipWriter.offset;
  158706. if (fileEntry.zip64) {
  158707. const rawExtraFieldZip64View = getDataView(fileEntry.rawExtraFieldZip64);
  158708. setBigUint64(rawExtraFieldZip64View, 20, BigInt(fileEntry.offset));
  158709. } else if (fileEntry.offset >= MAX_32_BITS) {
  158710. throw new Error(ERR_UNSUPPORTED_FORMAT);
  158711. }
  158712. zipWriter.offset += fileEntry.length;
  158713. return fileEntry;
  158714. } catch (error) {
  158715. if (bufferedWrite && fileEntry.writingBufferedData || !bufferedWrite && fileEntry.dataWritten) {
  158716. error.corruptedEntry = zipWriter.hasCorruptedEntries = true;
  158717. if (fileEntry.uncompressedSize) {
  158718. zipWriter.offset += fileEntry.uncompressedSize;
  158719. }
  158720. }
  158721. files.delete(name);
  158722. throw error;
  158723. } finally {
  158724. resolveLockCurrentFileEntry();
  158725. if (resolveLockUnbufferedWrite) {
  158726. resolveLockUnbufferedWrite();
  158727. }
  158728. }
  158729. }
  158730. async function createFileEntry(reader, writer, config2, options) {
  158731. const {
  158732. rawFilename,
  158733. lastAccessDate,
  158734. creationDate,
  158735. password,
  158736. level,
  158737. zip64,
  158738. zipCrypto,
  158739. dataDescriptor,
  158740. dataDescriptorSignature,
  158741. directory,
  158742. version,
  158743. versionMadeBy,
  158744. rawComment,
  158745. rawExtraField,
  158746. useWebWorkers,
  158747. onprogress,
  158748. signal,
  158749. encryptionStrength,
  158750. extendedTimestamp,
  158751. msDosCompatible,
  158752. internalFileAttribute,
  158753. externalFileAttribute
  158754. } = options;
  158755. const encrypted = Boolean(password && password.length);
  158756. const compressed = level !== 0 && !directory;
  158757. let rawExtraFieldAES;
  158758. if (encrypted && !zipCrypto) {
  158759. rawExtraFieldAES = new Uint8Array(EXTRAFIELD_DATA_AES.length + 2);
  158760. const extraFieldAESView = getDataView(rawExtraFieldAES);
  158761. setUint16(extraFieldAESView, 0, EXTRAFIELD_TYPE_AES);
  158762. arraySet(rawExtraFieldAES, EXTRAFIELD_DATA_AES, 2);
  158763. setUint8(extraFieldAESView, 8, encryptionStrength);
  158764. } else {
  158765. rawExtraFieldAES = new Uint8Array(0);
  158766. }
  158767. let rawExtraFieldNTFS;
  158768. let rawExtraFieldExtendedTimestamp;
  158769. if (extendedTimestamp) {
  158770. rawExtraFieldExtendedTimestamp = new Uint8Array(9 + (lastAccessDate ? 4 : 0) + (creationDate ? 4 : 0));
  158771. const extraFieldExtendedTimestampView = getDataView(rawExtraFieldExtendedTimestamp);
  158772. setUint16(extraFieldExtendedTimestampView, 0, EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
  158773. setUint16(extraFieldExtendedTimestampView, 2, rawExtraFieldExtendedTimestamp.length - 4);
  158774. const extraFieldExtendedTimestampFlag = 1 + (lastAccessDate ? 2 : 0) + (creationDate ? 4 : 0);
  158775. setUint8(extraFieldExtendedTimestampView, 4, extraFieldExtendedTimestampFlag);
  158776. setUint32(extraFieldExtendedTimestampView, 5, Math.floor(options.lastModDate.getTime() / 1e3));
  158777. if (lastAccessDate) {
  158778. setUint32(extraFieldExtendedTimestampView, 9, Math.floor(lastAccessDate.getTime() / 1e3));
  158779. }
  158780. if (creationDate) {
  158781. setUint32(extraFieldExtendedTimestampView, 13, Math.floor(creationDate.getTime() / 1e3));
  158782. }
  158783. try {
  158784. rawExtraFieldNTFS = new Uint8Array(36);
  158785. const extraFieldNTFSView = getDataView(rawExtraFieldNTFS);
  158786. const lastModTimeNTFS = getTimeNTFS(options.lastModDate);
  158787. setUint16(extraFieldNTFSView, 0, EXTRAFIELD_TYPE_NTFS);
  158788. setUint16(extraFieldNTFSView, 2, 32);
  158789. setUint16(extraFieldNTFSView, 8, EXTRAFIELD_TYPE_NTFS_TAG1);
  158790. setUint16(extraFieldNTFSView, 10, 24);
  158791. setBigUint64(extraFieldNTFSView, 12, lastModTimeNTFS);
  158792. setBigUint64(extraFieldNTFSView, 20, getTimeNTFS(lastAccessDate) || lastModTimeNTFS);
  158793. setBigUint64(extraFieldNTFSView, 28, getTimeNTFS(creationDate) || lastModTimeNTFS);
  158794. } catch (error) {
  158795. rawExtraFieldNTFS = new Uint8Array(0);
  158796. }
  158797. } else {
  158798. rawExtraFieldNTFS = rawExtraFieldExtendedTimestamp = new Uint8Array(0);
  158799. }
  158800. const fileEntry = {
  158801. version: version || VERSION_DEFLATE,
  158802. versionMadeBy,
  158803. zip64,
  158804. directory: Boolean(directory),
  158805. filenameUTF8: true,
  158806. rawFilename,
  158807. commentUTF8: true,
  158808. rawComment,
  158809. rawExtraFieldZip64: zip64 ? new Uint8Array(EXTRAFIELD_LENGTH_ZIP64 + 4) : new Uint8Array(0),
  158810. rawExtraFieldExtendedTimestamp,
  158811. rawExtraFieldNTFS,
  158812. rawExtraFieldAES,
  158813. rawExtraField,
  158814. extendedTimestamp,
  158815. msDosCompatible,
  158816. internalFileAttribute,
  158817. externalFileAttribute
  158818. };
  158819. let uncompressedSize = fileEntry.uncompressedSize = 0;
  158820. let bitFlag = BITFLAG_LANG_ENCODING_FLAG;
  158821. if (dataDescriptor) {
  158822. bitFlag = bitFlag | BITFLAG_DATA_DESCRIPTOR;
  158823. }
  158824. let compressionMethod = COMPRESSION_METHOD_STORE;
  158825. if (compressed) {
  158826. compressionMethod = COMPRESSION_METHOD_DEFLATE;
  158827. }
  158828. if (zip64) {
  158829. fileEntry.version = fileEntry.version > VERSION_ZIP64 ? fileEntry.version : VERSION_ZIP64;
  158830. }
  158831. if (encrypted) {
  158832. bitFlag = bitFlag | BITFLAG_ENCRYPTED;
  158833. if (!zipCrypto) {
  158834. fileEntry.version = fileEntry.version > VERSION_AES ? fileEntry.version : VERSION_AES;
  158835. compressionMethod = COMPRESSION_METHOD_AES;
  158836. if (compressed) {
  158837. fileEntry.rawExtraFieldAES[9] = COMPRESSION_METHOD_DEFLATE;
  158838. }
  158839. }
  158840. }
  158841. fileEntry.compressionMethod = compressionMethod;
  158842. const headerArray = fileEntry.headerArray = new Uint8Array(26);
  158843. const headerView = getDataView(headerArray);
  158844. setUint16(headerView, 0, fileEntry.version);
  158845. setUint16(headerView, 2, bitFlag);
  158846. setUint16(headerView, 4, compressionMethod);
  158847. const dateArray = new Uint32Array(1);
  158848. const dateView = getDataView(dateArray);
  158849. let lastModDate;
  158850. if (options.lastModDate < MIN_DATE) {
  158851. lastModDate = MIN_DATE;
  158852. } else if (options.lastModDate > MAX_DATE) {
  158853. lastModDate = MAX_DATE;
  158854. } else {
  158855. lastModDate = options.lastModDate;
  158856. }
  158857. setUint16(dateView, 0, (lastModDate.getHours() << 6 | lastModDate.getMinutes()) << 5 | lastModDate.getSeconds() / 2);
  158858. setUint16(dateView, 2, (lastModDate.getFullYear() - 1980 << 4 | lastModDate.getMonth() + 1) << 5 | lastModDate.getDate());
  158859. const rawLastModDate = dateArray[0];
  158860. setUint32(headerView, 6, rawLastModDate);
  158861. setUint16(headerView, 22, rawFilename.length);
  158862. const extraFieldLength = rawExtraFieldAES.length + rawExtraFieldExtendedTimestamp.length + rawExtraFieldNTFS.length + fileEntry.rawExtraField.length;
  158863. setUint16(headerView, 24, extraFieldLength);
  158864. const localHeaderArray = new Uint8Array(30 + rawFilename.length + extraFieldLength);
  158865. const localHeaderView = getDataView(localHeaderArray);
  158866. setUint32(localHeaderView, 0, LOCAL_FILE_HEADER_SIGNATURE);
  158867. arraySet(localHeaderArray, headerArray, 4);
  158868. arraySet(localHeaderArray, rawFilename, 30);
  158869. arraySet(localHeaderArray, rawExtraFieldAES, 30 + rawFilename.length);
  158870. arraySet(localHeaderArray, rawExtraFieldExtendedTimestamp, 30 + rawFilename.length + rawExtraFieldAES.length);
  158871. arraySet(localHeaderArray, rawExtraFieldNTFS, 30 + rawFilename.length + rawExtraFieldAES.length + rawExtraFieldExtendedTimestamp.length);
  158872. arraySet(localHeaderArray, fileEntry.rawExtraField, 30 + rawFilename.length + rawExtraFieldAES.length + rawExtraFieldExtendedTimestamp.length + rawExtraFieldNTFS.length);
  158873. let result;
  158874. let compressedSize = 0;
  158875. if (reader) {
  158876. uncompressedSize = fileEntry.uncompressedSize = reader.size;
  158877. const codec2 = await createCodec(config2.Deflate, {
  158878. codecType: CODEC_DEFLATE,
  158879. level,
  158880. password,
  158881. encryptionStrength,
  158882. zipCrypto: encrypted && zipCrypto,
  158883. passwordVerification: encrypted && zipCrypto && rawLastModDate >> 8 & 255,
  158884. signed: true,
  158885. compressed,
  158886. encrypted,
  158887. useWebWorkers
  158888. }, config2);
  158889. await writer.writeUint8Array(localHeaderArray);
  158890. fileEntry.dataWritten = true;
  158891. result = await processData(codec2, reader, writer, 0, uncompressedSize, config2, { onprogress, signal });
  158892. compressedSize = result.length;
  158893. } else {
  158894. await writer.writeUint8Array(localHeaderArray);
  158895. fileEntry.dataWritten = true;
  158896. }
  158897. let dataDescriptorArray = new Uint8Array(0);
  158898. let dataDescriptorView, dataDescriptorOffset = 0;
  158899. if (dataDescriptor) {
  158900. dataDescriptorArray = new Uint8Array(zip64 ? dataDescriptorSignature ? 24 : 20 : dataDescriptorSignature ? 16 : 12);
  158901. dataDescriptorView = getDataView(dataDescriptorArray);
  158902. if (dataDescriptorSignature) {
  158903. dataDescriptorOffset = 4;
  158904. setUint32(dataDescriptorView, 0, DATA_DESCRIPTOR_RECORD_SIGNATURE);
  158905. }
  158906. }
  158907. if (reader) {
  158908. const signature = result.signature;
  158909. if ((!encrypted || zipCrypto) && signature !== void 0) {
  158910. setUint32(headerView, 10, signature);
  158911. fileEntry.signature = signature;
  158912. if (dataDescriptor) {
  158913. setUint32(dataDescriptorView, dataDescriptorOffset, signature);
  158914. }
  158915. }
  158916. if (zip64) {
  158917. const rawExtraFieldZip64View = getDataView(fileEntry.rawExtraFieldZip64);
  158918. setUint16(rawExtraFieldZip64View, 0, EXTRAFIELD_TYPE_ZIP64);
  158919. setUint16(rawExtraFieldZip64View, 2, EXTRAFIELD_LENGTH_ZIP64);
  158920. setUint32(headerView, 14, MAX_32_BITS);
  158921. setBigUint64(rawExtraFieldZip64View, 12, BigInt(compressedSize));
  158922. setUint32(headerView, 18, MAX_32_BITS);
  158923. setBigUint64(rawExtraFieldZip64View, 4, BigInt(uncompressedSize));
  158924. if (dataDescriptor) {
  158925. setBigUint64(dataDescriptorView, dataDescriptorOffset + 4, BigInt(compressedSize));
  158926. setBigUint64(dataDescriptorView, dataDescriptorOffset + 12, BigInt(uncompressedSize));
  158927. }
  158928. } else {
  158929. setUint32(headerView, 14, compressedSize);
  158930. setUint32(headerView, 18, uncompressedSize);
  158931. if (dataDescriptor) {
  158932. setUint32(dataDescriptorView, dataDescriptorOffset + 4, compressedSize);
  158933. setUint32(dataDescriptorView, dataDescriptorOffset + 8, uncompressedSize);
  158934. }
  158935. }
  158936. }
  158937. if (dataDescriptor) {
  158938. await writer.writeUint8Array(dataDescriptorArray);
  158939. }
  158940. const length3 = localHeaderArray.length + compressedSize + dataDescriptorArray.length;
  158941. Object.assign(fileEntry, { compressedSize, lastModDate, rawLastModDate, creationDate, lastAccessDate, encrypted, length: length3 });
  158942. return fileEntry;
  158943. }
  158944. async function closeFile(zipWriter, comment, options) {
  158945. const writer = zipWriter.writer;
  158946. const files = zipWriter.files;
  158947. let offset2 = 0;
  158948. let directoryDataLength = 0;
  158949. let directoryOffset = zipWriter.offset;
  158950. let filesLength = files.size;
  158951. for (const [, fileEntry] of files) {
  158952. directoryDataLength += 46 + fileEntry.rawFilename.length + fileEntry.rawComment.length + fileEntry.rawExtraFieldZip64.length + fileEntry.rawExtraFieldAES.length + fileEntry.rawExtraFieldExtendedTimestamp.length + fileEntry.rawExtraFieldNTFS.length + fileEntry.rawExtraField.length;
  158953. }
  158954. let zip64 = options.zip64 || zipWriter.options.zip64 || false;
  158955. if (directoryOffset >= MAX_32_BITS || directoryDataLength >= MAX_32_BITS || filesLength >= MAX_16_BITS) {
  158956. if (options.zip64 === false || zipWriter.options.zip64 === false) {
  158957. throw new Error(ERR_UNSUPPORTED_FORMAT);
  158958. } else {
  158959. zip64 = true;
  158960. }
  158961. }
  158962. const directoryArray = new Uint8Array(directoryDataLength + (zip64 ? ZIP64_END_OF_CENTRAL_DIR_TOTAL_LENGTH : END_OF_CENTRAL_DIR_LENGTH));
  158963. const directoryView = getDataView(directoryArray);
  158964. if (comment && comment.length) {
  158965. if (comment.length <= MAX_16_BITS) {
  158966. setUint16(directoryView, offset2 + 20, comment.length);
  158967. } else {
  158968. throw new Error(ERR_INVALID_COMMENT);
  158969. }
  158970. }
  158971. for (const [indexFileEntry, fileEntry] of Array.from(files.values()).entries()) {
  158972. const {
  158973. rawFilename,
  158974. rawExtraFieldZip64,
  158975. rawExtraFieldAES,
  158976. rawExtraField,
  158977. rawComment,
  158978. versionMadeBy,
  158979. headerArray,
  158980. directory,
  158981. zip64: zip642,
  158982. msDosCompatible,
  158983. internalFileAttribute,
  158984. externalFileAttribute
  158985. } = fileEntry;
  158986. let rawExtraFieldExtendedTimestamp;
  158987. let rawExtraFieldNTFS;
  158988. if (fileEntry.extendedTimestamp) {
  158989. rawExtraFieldNTFS = fileEntry.rawExtraFieldNTFS;
  158990. rawExtraFieldExtendedTimestamp = new Uint8Array(9);
  158991. const extraFieldExtendedTimestampView = getDataView(rawExtraFieldExtendedTimestamp);
  158992. setUint16(extraFieldExtendedTimestampView, 0, EXTRAFIELD_TYPE_EXTENDED_TIMESTAMP);
  158993. setUint16(extraFieldExtendedTimestampView, 2, rawExtraFieldExtendedTimestamp.length - 4);
  158994. setUint8(extraFieldExtendedTimestampView, 4, 1);
  158995. setUint32(extraFieldExtendedTimestampView, 5, Math.floor(fileEntry.lastModDate.getTime() / 1e3));
  158996. } else {
  158997. rawExtraFieldNTFS = rawExtraFieldExtendedTimestamp = new Uint8Array(0);
  158998. }
  158999. const extraFieldLength = rawExtraFieldZip64.length + rawExtraFieldAES.length + rawExtraFieldExtendedTimestamp.length + rawExtraFieldNTFS.length + rawExtraField.length;
  159000. setUint32(directoryView, offset2, CENTRAL_FILE_HEADER_SIGNATURE);
  159001. setUint16(directoryView, offset2 + 4, versionMadeBy);
  159002. arraySet(directoryArray, headerArray, offset2 + 6);
  159003. setUint16(directoryView, offset2 + 30, extraFieldLength);
  159004. setUint16(directoryView, offset2 + 32, rawComment.length);
  159005. setUint32(directoryView, offset2 + 34, internalFileAttribute);
  159006. if (externalFileAttribute) {
  159007. setUint32(directoryView, offset2 + 38, externalFileAttribute);
  159008. } else if (directory && msDosCompatible) {
  159009. setUint8(directoryView, offset2 + 38, FILE_ATTR_MSDOS_DIR_MASK);
  159010. }
  159011. if (zip642) {
  159012. setUint32(directoryView, offset2 + 42, MAX_32_BITS);
  159013. } else {
  159014. setUint32(directoryView, offset2 + 42, fileEntry.offset);
  159015. }
  159016. arraySet(directoryArray, rawFilename, offset2 + 46);
  159017. arraySet(directoryArray, rawExtraFieldZip64, offset2 + 46 + rawFilename.length);
  159018. arraySet(directoryArray, rawExtraFieldAES, offset2 + 46 + rawFilename.length + rawExtraFieldZip64.length);
  159019. arraySet(directoryArray, rawExtraFieldExtendedTimestamp, offset2 + 46 + rawFilename.length + rawExtraFieldZip64.length + rawExtraFieldAES.length);
  159020. arraySet(directoryArray, rawExtraFieldNTFS, offset2 + 46 + rawFilename.length + rawExtraFieldZip64.length + rawExtraFieldAES.length + rawExtraFieldExtendedTimestamp.length);
  159021. arraySet(directoryArray, rawExtraField, offset2 + 46 + rawFilename.length + rawExtraFieldZip64.length + rawExtraFieldAES.length + rawExtraFieldExtendedTimestamp.length + rawExtraFieldNTFS.length);
  159022. arraySet(directoryArray, rawComment, offset2 + 46 + rawFilename.length + extraFieldLength);
  159023. offset2 += 46 + rawFilename.length + extraFieldLength + rawComment.length;
  159024. if (options.onprogress) {
  159025. try {
  159026. options.onprogress(indexFileEntry + 1, files.size, new Entry(fileEntry));
  159027. } catch (error) {
  159028. }
  159029. }
  159030. }
  159031. if (zip64) {
  159032. setUint32(directoryView, offset2, ZIP64_END_OF_CENTRAL_DIR_SIGNATURE);
  159033. setBigUint64(directoryView, offset2 + 4, BigInt(44));
  159034. setUint16(directoryView, offset2 + 12, 45);
  159035. setUint16(directoryView, offset2 + 14, 45);
  159036. setBigUint64(directoryView, offset2 + 24, BigInt(filesLength));
  159037. setBigUint64(directoryView, offset2 + 32, BigInt(filesLength));
  159038. setBigUint64(directoryView, offset2 + 40, BigInt(directoryDataLength));
  159039. setBigUint64(directoryView, offset2 + 48, BigInt(directoryOffset));
  159040. setUint32(directoryView, offset2 + 56, ZIP64_END_OF_CENTRAL_DIR_LOCATOR_SIGNATURE);
  159041. setBigUint64(directoryView, offset2 + 64, BigInt(directoryOffset) + BigInt(directoryDataLength));
  159042. setUint32(directoryView, offset2 + 72, ZIP64_TOTAL_NUMBER_OF_DISKS);
  159043. filesLength = MAX_16_BITS;
  159044. directoryOffset = MAX_32_BITS;
  159045. directoryDataLength = MAX_32_BITS;
  159046. offset2 += 76;
  159047. }
  159048. setUint32(directoryView, offset2, END_OF_CENTRAL_DIR_SIGNATURE);
  159049. setUint16(directoryView, offset2 + 8, filesLength);
  159050. setUint16(directoryView, offset2 + 10, filesLength);
  159051. setUint32(directoryView, offset2 + 12, directoryDataLength);
  159052. setUint32(directoryView, offset2 + 16, directoryOffset);
  159053. await writer.writeUint8Array(directoryArray);
  159054. if (comment && comment.length) {
  159055. await writer.writeUint8Array(comment);
  159056. }
  159057. }
  159058. function sliceAsArrayBuffer(blob, start, end) {
  159059. if (blob.arrayBuffer) {
  159060. if (start || end) {
  159061. return blob.slice(start, end).arrayBuffer();
  159062. } else {
  159063. return blob.arrayBuffer();
  159064. }
  159065. } else {
  159066. const fileReader = new FileReader();
  159067. return new Promise((resolve2, reject) => {
  159068. fileReader.onload = (event) => resolve2(event.target.result);
  159069. fileReader.onerror = () => reject(fileReader.error);
  159070. fileReader.readAsArrayBuffer(start || end ? blob.slice(start, end) : blob);
  159071. });
  159072. }
  159073. }
  159074. async function writeBlob(writer, blob, start = 0) {
  159075. const blockSize = 512 * 1024 * 1024;
  159076. await writeSlice();
  159077. async function writeSlice() {
  159078. if (start < blob.size) {
  159079. const arrayBuffer = await sliceAsArrayBuffer(blob, start, start + blockSize);
  159080. await writer.writeUint8Array(new Uint8Array(arrayBuffer));
  159081. start += blockSize;
  159082. await writeSlice();
  159083. }
  159084. }
  159085. }
  159086. function getTimeNTFS(date) {
  159087. if (date) {
  159088. return (BigInt(date.getTime()) + BigInt(116444736e5)) * BigInt(1e4);
  159089. }
  159090. }
  159091. function getOptionValue(zipWriter, options, name) {
  159092. return options[name] === void 0 ? zipWriter.options[name] : options[name];
  159093. }
  159094. function getMaximumCompressedSize(uncompressedSize) {
  159095. return uncompressedSize + 5 * (Math.floor(uncompressedSize / 16383) + 1);
  159096. }
  159097. function setUint8(view, offset2, value) {
  159098. view.setUint8(offset2, value);
  159099. }
  159100. function setUint16(view, offset2, value) {
  159101. view.setUint16(offset2, value, true);
  159102. }
  159103. function setUint32(view, offset2, value) {
  159104. view.setUint32(offset2, value, true);
  159105. }
  159106. function setBigUint64(view, offset2, value) {
  159107. view.setBigUint64(offset2, value, true);
  159108. }
  159109. function arraySet(array, typedArray, offset2) {
  159110. array.set(typedArray, offset2);
  159111. }
  159112. function getDataView(array) {
  159113. return new DataView(array.buffer);
  159114. }
  159115. configure({ Deflate: ZipDeflate, Inflate: ZipInflate });
  159116. var zipNoWorker = Object.freeze({
  159117. __proto__: null,
  159118. configure,
  159119. getMimeType,
  159120. terminateWorkers,
  159121. ERR_ABORT,
  159122. Reader,
  159123. Writer,
  159124. TextReader,
  159125. TextWriter,
  159126. Data64URIReader,
  159127. Data64URIWriter,
  159128. BlobReader,
  159129. BlobWriter,
  159130. Uint8ArrayReader,
  159131. Uint8ArrayWriter,
  159132. HttpReader,
  159133. HttpRangeReader,
  159134. WritableStreamWriter,
  159135. ERR_HTTP_RANGE,
  159136. ZipReader,
  159137. ERR_BAD_FORMAT,
  159138. ERR_EOCDR_NOT_FOUND,
  159139. ERR_EOCDR_ZIP64_NOT_FOUND,
  159140. ERR_EOCDR_LOCATOR_ZIP64_NOT_FOUND,
  159141. ERR_CENTRAL_DIRECTORY_NOT_FOUND,
  159142. ERR_LOCAL_FILE_HEADER_NOT_FOUND,
  159143. ERR_EXTRAFIELD_ZIP64_NOT_FOUND,
  159144. ERR_ENCRYPTED,
  159145. ERR_UNSUPPORTED_ENCRYPTION,
  159146. ERR_UNSUPPORTED_COMPRESSION,
  159147. ERR_INVALID_SIGNATURE,
  159148. ERR_INVALID_PASSWORD,
  159149. ZipWriter,
  159150. ERR_DUPLICATED_NAME,
  159151. ERR_INVALID_COMMENT,
  159152. ERR_INVALID_ENTRY_NAME,
  159153. ERR_INVALID_ENTRY_COMMENT,
  159154. ERR_INVALID_VERSION,
  159155. ERR_INVALID_EXTRAFIELD_TYPE,
  159156. ERR_INVALID_EXTRAFIELD_DATA,
  159157. ERR_INVALID_ENCRYPTION_STRENGTH,
  159158. ERR_UNSUPPORTED_FORMAT
  159159. });
  159160. // node_modules/cesium/Source/Widgets/getElement.js
  159161. function getElement(element) {
  159162. if (typeof element === "string") {
  159163. const foundElement = document.getElementById(element);
  159164. if (foundElement === null) {
  159165. throw new DeveloperError_default(
  159166. `Element with id "${element}" does not exist in the document.`
  159167. );
  159168. }
  159169. element = foundElement;
  159170. }
  159171. return element;
  159172. }
  159173. var getElement_default = getElement;
  159174. // node_modules/cesium/Source/DataSources/KmlLookAt.js
  159175. function KmlLookAt(position, headingPitchRange) {
  159176. this.position = position;
  159177. this.headingPitchRange = headingPitchRange;
  159178. }
  159179. var KmlLookAt_default = KmlLookAt;
  159180. // node_modules/cesium/Source/DataSources/KmlTour.js
  159181. function KmlTour(name, id) {
  159182. this.id = id;
  159183. this.name = name;
  159184. this.playlistIndex = 0;
  159185. this.playlist = [];
  159186. this.tourStart = new Event_default();
  159187. this.tourEnd = new Event_default();
  159188. this.entryStart = new Event_default();
  159189. this.entryEnd = new Event_default();
  159190. this._activeEntries = [];
  159191. }
  159192. KmlTour.prototype.addPlaylistEntry = function(entry) {
  159193. this.playlist.push(entry);
  159194. };
  159195. KmlTour.prototype.play = function(viewer, cameraOptions) {
  159196. this.tourStart.raiseEvent();
  159197. const tour = this;
  159198. playEntry.call(this, viewer, cameraOptions, function(terminated) {
  159199. tour.playlistIndex = 0;
  159200. if (!terminated) {
  159201. cancelAllEntries(tour._activeEntries);
  159202. }
  159203. tour.tourEnd.raiseEvent(terminated);
  159204. });
  159205. };
  159206. KmlTour.prototype.stop = function() {
  159207. cancelAllEntries(this._activeEntries);
  159208. };
  159209. function cancelAllEntries(activeEntries) {
  159210. for (let entry = activeEntries.pop(); entry !== void 0; entry = activeEntries.pop()) {
  159211. entry.stop();
  159212. }
  159213. }
  159214. function playEntry(viewer, cameraOptions, allDone) {
  159215. const entry = this.playlist[this.playlistIndex];
  159216. if (entry) {
  159217. const _playNext = playNext.bind(this, viewer, cameraOptions, allDone);
  159218. this._activeEntries.push(entry);
  159219. this.entryStart.raiseEvent(entry);
  159220. if (entry.blocking) {
  159221. entry.play(_playNext, viewer.scene.camera, cameraOptions);
  159222. } else {
  159223. const tour = this;
  159224. entry.play(function() {
  159225. tour.entryEnd.raiseEvent(entry);
  159226. const indx = tour._activeEntries.indexOf(entry);
  159227. if (indx >= 0) {
  159228. tour._activeEntries.splice(indx, 1);
  159229. }
  159230. });
  159231. _playNext(viewer, cameraOptions, allDone);
  159232. }
  159233. } else if (defined_default(allDone)) {
  159234. allDone(false);
  159235. }
  159236. }
  159237. function playNext(viewer, cameraOptions, allDone, terminated) {
  159238. const entry = this.playlist[this.playlistIndex];
  159239. this.entryEnd.raiseEvent(entry, terminated);
  159240. if (terminated) {
  159241. allDone(terminated);
  159242. } else {
  159243. const indx = this._activeEntries.indexOf(entry);
  159244. if (indx >= 0) {
  159245. this._activeEntries.splice(indx, 1);
  159246. }
  159247. this.playlistIndex++;
  159248. playEntry.call(this, viewer, cameraOptions, allDone);
  159249. }
  159250. }
  159251. var KmlTour_default = KmlTour;
  159252. // node_modules/cesium/Source/DataSources/KmlTourFlyTo.js
  159253. function KmlTourFlyTo(duration, flyToMode, view) {
  159254. this.type = "KmlTourFlyTo";
  159255. this.blocking = true;
  159256. this.activeCamera = null;
  159257. this.activeCallback = null;
  159258. this.duration = duration;
  159259. this.view = view;
  159260. this.flyToMode = flyToMode;
  159261. }
  159262. KmlTourFlyTo.prototype.play = function(done, camera, cameraOptions) {
  159263. this.activeCamera = camera;
  159264. if (defined_default(done) && done !== null) {
  159265. const self2 = this;
  159266. this.activeCallback = function(terminated) {
  159267. delete self2.activeCallback;
  159268. delete self2.activeCamera;
  159269. done(defined_default(terminated) ? false : terminated);
  159270. };
  159271. }
  159272. const options = this.getCameraOptions(cameraOptions);
  159273. if (this.view.headingPitchRoll) {
  159274. camera.flyTo(options);
  159275. } else if (this.view.headingPitchRange) {
  159276. const target = new BoundingSphere_default(this.view.position);
  159277. camera.flyToBoundingSphere(target, options);
  159278. }
  159279. };
  159280. KmlTourFlyTo.prototype.stop = function() {
  159281. if (defined_default(this.activeCamera)) {
  159282. this.activeCamera.cancelFlight();
  159283. }
  159284. if (defined_default(this.activeCallback)) {
  159285. this.activeCallback(true);
  159286. }
  159287. };
  159288. KmlTourFlyTo.prototype.getCameraOptions = function(cameraOptions) {
  159289. let options = {
  159290. duration: this.duration
  159291. };
  159292. if (defined_default(this.activeCallback)) {
  159293. options.complete = this.activeCallback;
  159294. }
  159295. if (this.flyToMode === "smooth") {
  159296. options.easingFunction = EasingFunction_default.LINEAR_NONE;
  159297. }
  159298. if (this.view.headingPitchRoll) {
  159299. options.destination = this.view.position;
  159300. options.orientation = this.view.headingPitchRoll;
  159301. } else if (this.view.headingPitchRange) {
  159302. options.offset = this.view.headingPitchRange;
  159303. }
  159304. if (defined_default(cameraOptions)) {
  159305. options = combine_default(options, cameraOptions);
  159306. }
  159307. return options;
  159308. };
  159309. var KmlTourFlyTo_default = KmlTourFlyTo;
  159310. // node_modules/cesium/Source/DataSources/KmlTourWait.js
  159311. function KmlTourWait(duration) {
  159312. this.type = "KmlTourWait";
  159313. this.blocking = true;
  159314. this.duration = duration;
  159315. this.timeout = null;
  159316. }
  159317. KmlTourWait.prototype.play = function(done) {
  159318. const self2 = this;
  159319. this.activeCallback = done;
  159320. this.timeout = setTimeout(function() {
  159321. delete self2.activeCallback;
  159322. done(false);
  159323. }, this.duration * 1e3);
  159324. };
  159325. KmlTourWait.prototype.stop = function() {
  159326. clearTimeout(this.timeout);
  159327. if (defined_default(this.activeCallback)) {
  159328. this.activeCallback(true);
  159329. }
  159330. };
  159331. var KmlTourWait_default = KmlTourWait;
  159332. // node_modules/cesium/Source/DataSources/KmlDataSource.js
  159333. var MimeTypes = {
  159334. avi: "video/x-msvideo",
  159335. bmp: "image/bmp",
  159336. bz2: "application/x-bzip2",
  159337. chm: "application/vnd.ms-htmlhelp",
  159338. css: "text/css",
  159339. csv: "text/csv",
  159340. doc: "application/msword",
  159341. dvi: "application/x-dvi",
  159342. eps: "application/postscript",
  159343. flv: "video/x-flv",
  159344. gif: "image/gif",
  159345. gz: "application/x-gzip",
  159346. htm: "text/html",
  159347. html: "text/html",
  159348. ico: "image/vnd.microsoft.icon",
  159349. jnlp: "application/x-java-jnlp-file",
  159350. jpeg: "image/jpeg",
  159351. jpg: "image/jpeg",
  159352. m3u: "audio/x-mpegurl",
  159353. m4v: "video/mp4",
  159354. mathml: "application/mathml+xml",
  159355. mid: "audio/midi",
  159356. midi: "audio/midi",
  159357. mov: "video/quicktime",
  159358. mp3: "audio/mpeg",
  159359. mp4: "video/mp4",
  159360. mp4v: "video/mp4",
  159361. mpeg: "video/mpeg",
  159362. mpg: "video/mpeg",
  159363. odp: "application/vnd.oasis.opendocument.presentation",
  159364. ods: "application/vnd.oasis.opendocument.spreadsheet",
  159365. odt: "application/vnd.oasis.opendocument.text",
  159366. ogg: "application/ogg",
  159367. pdf: "application/pdf",
  159368. png: "image/png",
  159369. pps: "application/vnd.ms-powerpoint",
  159370. ppt: "application/vnd.ms-powerpoint",
  159371. ps: "application/postscript",
  159372. qt: "video/quicktime",
  159373. rdf: "application/rdf+xml",
  159374. rss: "application/rss+xml",
  159375. rtf: "application/rtf",
  159376. svg: "image/svg+xml",
  159377. swf: "application/x-shockwave-flash",
  159378. text: "text/plain",
  159379. tif: "image/tiff",
  159380. tiff: "image/tiff",
  159381. txt: "text/plain",
  159382. wav: "audio/x-wav",
  159383. wma: "audio/x-ms-wma",
  159384. wmv: "video/x-ms-wmv",
  159385. xml: "application/xml",
  159386. zip: "application/zip",
  159387. detectFromFilename: function(filename) {
  159388. let ext = filename.toLowerCase();
  159389. ext = getExtensionFromUri_default(ext);
  159390. return MimeTypes[ext];
  159391. }
  159392. };
  159393. var parser2;
  159394. if (typeof DOMParser !== "undefined") {
  159395. parser2 = new DOMParser();
  159396. }
  159397. var autolinker2 = new Autolinker({
  159398. stripPrefix: false,
  159399. email: false,
  159400. replaceFn: function(match) {
  159401. if (!match.protocolUrlMatch) {
  159402. return false;
  159403. }
  159404. }
  159405. });
  159406. var BILLBOARD_SIZE2 = 32;
  159407. var BILLBOARD_NEAR_DISTANCE2 = 2414016;
  159408. var BILLBOARD_NEAR_RATIO2 = 1;
  159409. var BILLBOARD_FAR_DISTANCE2 = 16093e3;
  159410. var BILLBOARD_FAR_RATIO2 = 0.1;
  159411. var kmlNamespaces = [
  159412. null,
  159413. void 0,
  159414. "http://www.opengis.net/kml/2.2",
  159415. "http://earth.google.com/kml/2.2",
  159416. "http://earth.google.com/kml/2.1",
  159417. "http://earth.google.com/kml/2.0"
  159418. ];
  159419. var gxNamespaces = ["http://www.google.com/kml/ext/2.2"];
  159420. var atomNamespaces = ["http://www.w3.org/2005/Atom"];
  159421. var namespaces2 = {
  159422. kml: kmlNamespaces,
  159423. gx: gxNamespaces,
  159424. atom: atomNamespaces,
  159425. kmlgx: kmlNamespaces.concat(gxNamespaces)
  159426. };
  159427. var featureTypes = {
  159428. Document: processDocument2,
  159429. Folder: processFolder,
  159430. Placemark: processPlacemark,
  159431. NetworkLink: processNetworkLink,
  159432. GroundOverlay: processGroundOverlay,
  159433. PhotoOverlay: processUnsupportedFeature,
  159434. ScreenOverlay: processScreenOverlay,
  159435. Tour: processTour
  159436. };
  159437. function DeferredLoading(dataSource) {
  159438. this._dataSource = dataSource;
  159439. this._deferred = defer_default();
  159440. this._stack = [];
  159441. this._promises = [];
  159442. this._timeoutSet = false;
  159443. this._used = false;
  159444. this._started = 0;
  159445. this._timeThreshold = 1e3;
  159446. }
  159447. Object.defineProperties(DeferredLoading.prototype, {
  159448. dataSource: {
  159449. get: function() {
  159450. return this._dataSource;
  159451. }
  159452. }
  159453. });
  159454. DeferredLoading.prototype.addNodes = function(nodes, processingData) {
  159455. this._stack.push({
  159456. nodes,
  159457. index: 0,
  159458. processingData
  159459. });
  159460. this._used = true;
  159461. };
  159462. DeferredLoading.prototype.addPromise = function(promise) {
  159463. this._promises.push(promise);
  159464. };
  159465. DeferredLoading.prototype.wait = function() {
  159466. const deferred = this._deferred;
  159467. if (!this._used) {
  159468. deferred.resolve();
  159469. }
  159470. return Promise.all([deferred.promise, Promise.all(this._promises)]);
  159471. };
  159472. DeferredLoading.prototype.process = function() {
  159473. const isFirstCall = this._stack.length === 1;
  159474. if (isFirstCall) {
  159475. this._started = KmlDataSource._getTimestamp();
  159476. }
  159477. return this._process(isFirstCall);
  159478. };
  159479. DeferredLoading.prototype._giveUpTime = function() {
  159480. if (this._timeoutSet) {
  159481. return;
  159482. }
  159483. this._timeoutSet = true;
  159484. this._timeThreshold = 50;
  159485. const that = this;
  159486. setTimeout(function() {
  159487. that._timeoutSet = false;
  159488. that._started = KmlDataSource._getTimestamp();
  159489. that._process(true);
  159490. }, 0);
  159491. };
  159492. DeferredLoading.prototype._nextNode = function() {
  159493. const stack = this._stack;
  159494. const top = stack[stack.length - 1];
  159495. const index2 = top.index;
  159496. const nodes = top.nodes;
  159497. if (index2 === nodes.length) {
  159498. return;
  159499. }
  159500. ++top.index;
  159501. return nodes[index2];
  159502. };
  159503. DeferredLoading.prototype._pop = function() {
  159504. const stack = this._stack;
  159505. stack.pop();
  159506. if (stack.length === 0) {
  159507. this._deferred.resolve();
  159508. return false;
  159509. }
  159510. return true;
  159511. };
  159512. DeferredLoading.prototype._process = function(isFirstCall) {
  159513. const dataSource = this.dataSource;
  159514. const processingData = this._stack[this._stack.length - 1].processingData;
  159515. let child = this._nextNode();
  159516. while (defined_default(child)) {
  159517. const featureProcessor = featureTypes[child.localName];
  159518. if (defined_default(featureProcessor) && (namespaces2.kml.indexOf(child.namespaceURI) !== -1 || namespaces2.gx.indexOf(child.namespaceURI) !== -1)) {
  159519. featureProcessor(dataSource, child, processingData, this);
  159520. if (this._timeoutSet || KmlDataSource._getTimestamp() > this._started + this._timeThreshold) {
  159521. this._giveUpTime();
  159522. return;
  159523. }
  159524. }
  159525. child = this._nextNode();
  159526. }
  159527. if (this._pop() && isFirstCall) {
  159528. this._process(true);
  159529. }
  159530. };
  159531. function isZipFile(blob) {
  159532. const magicBlob = blob.slice(0, Math.min(4, blob.size));
  159533. const deferred = defer_default();
  159534. const reader = new FileReader();
  159535. reader.addEventListener("load", function() {
  159536. deferred.resolve(
  159537. new DataView(reader.result).getUint32(0, false) === 1347093252
  159538. );
  159539. });
  159540. reader.addEventListener("error", function() {
  159541. deferred.reject(reader.error);
  159542. });
  159543. reader.readAsArrayBuffer(magicBlob);
  159544. return deferred.promise;
  159545. }
  159546. function readBlobAsText2(blob) {
  159547. const deferred = defer_default();
  159548. const reader = new FileReader();
  159549. reader.addEventListener("load", function() {
  159550. deferred.resolve(reader.result);
  159551. });
  159552. reader.addEventListener("error", function() {
  159553. deferred.reject(reader.error);
  159554. });
  159555. reader.readAsText(blob);
  159556. return deferred.promise;
  159557. }
  159558. function insertNamespaces(text2) {
  159559. const namespaceMap = {
  159560. xsi: "http://www.w3.org/2001/XMLSchema-instance"
  159561. };
  159562. let firstPart, lastPart, reg, declaration;
  159563. for (const key in namespaceMap) {
  159564. if (namespaceMap.hasOwnProperty(key)) {
  159565. reg = RegExp(`[< ]${key}:`);
  159566. declaration = `xmlns:${key}=`;
  159567. if (reg.test(text2) && text2.indexOf(declaration) === -1) {
  159568. if (!defined_default(firstPart)) {
  159569. firstPart = text2.substr(0, text2.indexOf("<kml") + 4);
  159570. lastPart = text2.substr(firstPart.length);
  159571. }
  159572. firstPart += ` ${declaration}"${namespaceMap[key]}"`;
  159573. }
  159574. }
  159575. }
  159576. if (defined_default(firstPart)) {
  159577. text2 = firstPart + lastPart;
  159578. }
  159579. return text2;
  159580. }
  159581. function removeDuplicateNamespaces(text2) {
  159582. let index2 = text2.indexOf("xmlns:");
  159583. const endDeclaration = text2.indexOf(">", index2);
  159584. let namespace, startIndex, endIndex;
  159585. while (index2 !== -1 && index2 < endDeclaration) {
  159586. namespace = text2.slice(index2, text2.indexOf('"', index2));
  159587. startIndex = index2;
  159588. index2 = text2.indexOf(namespace, index2 + 1);
  159589. if (index2 !== -1) {
  159590. endIndex = text2.indexOf('"', text2.indexOf('"', index2) + 1);
  159591. text2 = text2.slice(0, index2 - 1) + text2.slice(endIndex + 1, text2.length);
  159592. index2 = text2.indexOf("xmlns:", startIndex - 1);
  159593. } else {
  159594. index2 = text2.indexOf("xmlns:", startIndex + 1);
  159595. }
  159596. }
  159597. return text2;
  159598. }
  159599. function loadXmlFromZip(entry, uriResolver) {
  159600. return Promise.resolve(entry.getData(new zipNoWorker.TextWriter())).then(function(text2) {
  159601. text2 = insertNamespaces(text2);
  159602. text2 = removeDuplicateNamespaces(text2);
  159603. uriResolver.kml = parser2.parseFromString(text2, "application/xml");
  159604. });
  159605. }
  159606. function loadDataUriFromZip(entry, uriResolver) {
  159607. const mimeType = defaultValue_default(
  159608. MimeTypes.detectFromFilename(entry.filename),
  159609. "application/octet-stream"
  159610. );
  159611. return Promise.resolve(entry.getData(new zipNoWorker.Data64URIWriter(mimeType))).then(
  159612. function(dataUri) {
  159613. uriResolver[entry.filename] = dataUri;
  159614. }
  159615. );
  159616. }
  159617. function embedDataUris(div, elementType, attributeName, uriResolver) {
  159618. const keys = uriResolver.keys;
  159619. const baseUri = new URI(".");
  159620. const elements = div.querySelectorAll(elementType);
  159621. for (let i2 = 0; i2 < elements.length; i2++) {
  159622. const element = elements[i2];
  159623. const value = element.getAttribute(attributeName);
  159624. const relativeUri = new URI(value);
  159625. const uri = relativeUri.absoluteTo(baseUri).toString();
  159626. const index2 = keys.indexOf(uri);
  159627. if (index2 !== -1) {
  159628. const key = keys[index2];
  159629. element.setAttribute(attributeName, uriResolver[key]);
  159630. if (elementType === "a" && element.getAttribute("download") === null) {
  159631. element.setAttribute("download", key);
  159632. }
  159633. }
  159634. }
  159635. }
  159636. function applyBasePath(div, elementType, attributeName, sourceResource) {
  159637. const elements = div.querySelectorAll(elementType);
  159638. for (let i2 = 0; i2 < elements.length; i2++) {
  159639. const element = elements[i2];
  159640. const value = element.getAttribute(attributeName);
  159641. const resource = resolveHref(value, sourceResource);
  159642. element.setAttribute(attributeName, resource.url);
  159643. }
  159644. }
  159645. function createEntity(node, entityCollection, context) {
  159646. let id = queryStringAttribute2(node, "id");
  159647. id = defined_default(id) && id.length !== 0 ? id : createGuid_default();
  159648. if (defined_default(context)) {
  159649. id = context + id;
  159650. }
  159651. let entity = entityCollection.getById(id);
  159652. if (defined_default(entity)) {
  159653. id = createGuid_default();
  159654. if (defined_default(context)) {
  159655. id = context + id;
  159656. }
  159657. }
  159658. entity = entityCollection.add(new Entity_default({ id }));
  159659. if (!defined_default(entity.kml)) {
  159660. entity.addProperty("kml");
  159661. entity.kml = new KmlFeatureData();
  159662. }
  159663. return entity;
  159664. }
  159665. function isExtrudable(altitudeMode, gxAltitudeMode) {
  159666. return altitudeMode === "absolute" || altitudeMode === "relativeToGround" || gxAltitudeMode === "relativeToSeaFloor";
  159667. }
  159668. function readCoordinate(value, ellipsoid) {
  159669. if (!defined_default(value)) {
  159670. return Cartesian3_default.fromDegrees(0, 0, 0, ellipsoid);
  159671. }
  159672. const digits = value.match(/[^\s,\n]+/g);
  159673. if (!defined_default(digits)) {
  159674. return Cartesian3_default.fromDegrees(0, 0, 0, ellipsoid);
  159675. }
  159676. let longitude = parseFloat(digits[0]);
  159677. let latitude = parseFloat(digits[1]);
  159678. let height = parseFloat(digits[2]);
  159679. longitude = isNaN(longitude) ? 0 : longitude;
  159680. latitude = isNaN(latitude) ? 0 : latitude;
  159681. height = isNaN(height) ? 0 : height;
  159682. return Cartesian3_default.fromDegrees(longitude, latitude, height, ellipsoid);
  159683. }
  159684. function readCoordinates(element, ellipsoid) {
  159685. if (!defined_default(element)) {
  159686. return void 0;
  159687. }
  159688. const tuples = element.textContent.match(/[^\s\n]+/g);
  159689. if (!defined_default(tuples)) {
  159690. return void 0;
  159691. }
  159692. const length3 = tuples.length;
  159693. const result = new Array(length3);
  159694. let resultIndex = 0;
  159695. for (let i2 = 0; i2 < length3; i2++) {
  159696. result[resultIndex++] = readCoordinate(tuples[i2], ellipsoid);
  159697. }
  159698. return result;
  159699. }
  159700. function queryNumericAttribute2(node, attributeName) {
  159701. if (!defined_default(node)) {
  159702. return void 0;
  159703. }
  159704. const value = node.getAttribute(attributeName);
  159705. if (value !== null) {
  159706. const result = parseFloat(value);
  159707. return !isNaN(result) ? result : void 0;
  159708. }
  159709. return void 0;
  159710. }
  159711. function queryStringAttribute2(node, attributeName) {
  159712. if (!defined_default(node)) {
  159713. return void 0;
  159714. }
  159715. const value = node.getAttribute(attributeName);
  159716. return value !== null ? value : void 0;
  159717. }
  159718. function queryFirstNode2(node, tagName, namespace) {
  159719. if (!defined_default(node)) {
  159720. return void 0;
  159721. }
  159722. const childNodes = node.childNodes;
  159723. const length3 = childNodes.length;
  159724. for (let q = 0; q < length3; q++) {
  159725. const child = childNodes[q];
  159726. if (child.localName === tagName && namespace.indexOf(child.namespaceURI) !== -1) {
  159727. return child;
  159728. }
  159729. }
  159730. return void 0;
  159731. }
  159732. function queryNodes2(node, tagName, namespace) {
  159733. if (!defined_default(node)) {
  159734. return void 0;
  159735. }
  159736. const result = [];
  159737. const childNodes = node.getElementsByTagNameNS("*", tagName);
  159738. const length3 = childNodes.length;
  159739. for (let q = 0; q < length3; q++) {
  159740. const child = childNodes[q];
  159741. if (child.localName === tagName && namespace.indexOf(child.namespaceURI) !== -1) {
  159742. result.push(child);
  159743. }
  159744. }
  159745. return result;
  159746. }
  159747. function queryChildNodes(node, tagName, namespace) {
  159748. if (!defined_default(node)) {
  159749. return [];
  159750. }
  159751. const result = [];
  159752. const childNodes = node.childNodes;
  159753. const length3 = childNodes.length;
  159754. for (let q = 0; q < length3; q++) {
  159755. const child = childNodes[q];
  159756. if (child.localName === tagName && namespace.indexOf(child.namespaceURI) !== -1) {
  159757. result.push(child);
  159758. }
  159759. }
  159760. return result;
  159761. }
  159762. function queryNumericValue2(node, tagName, namespace) {
  159763. const resultNode = queryFirstNode2(node, tagName, namespace);
  159764. if (defined_default(resultNode)) {
  159765. const result = parseFloat(resultNode.textContent);
  159766. return !isNaN(result) ? result : void 0;
  159767. }
  159768. return void 0;
  159769. }
  159770. function queryStringValue2(node, tagName, namespace) {
  159771. const result = queryFirstNode2(node, tagName, namespace);
  159772. if (defined_default(result)) {
  159773. return result.textContent.trim();
  159774. }
  159775. return void 0;
  159776. }
  159777. function queryBooleanValue(node, tagName, namespace) {
  159778. const result = queryFirstNode2(node, tagName, namespace);
  159779. if (defined_default(result)) {
  159780. const value = result.textContent.trim();
  159781. return value === "1" || /^true$/i.test(value);
  159782. }
  159783. return void 0;
  159784. }
  159785. function resolveHref(href, sourceResource, uriResolver) {
  159786. if (!defined_default(href)) {
  159787. return void 0;
  159788. }
  159789. let resource;
  159790. if (defined_default(uriResolver)) {
  159791. href = href.replace(/\\/g, "/");
  159792. let blob = uriResolver[href];
  159793. if (defined_default(blob)) {
  159794. resource = new Resource_default({
  159795. url: blob
  159796. });
  159797. } else {
  159798. const baseUri = new URI(sourceResource.getUrlComponent());
  159799. const uri = new URI(href);
  159800. blob = uriResolver[uri.absoluteTo(baseUri)];
  159801. if (defined_default(blob)) {
  159802. resource = new Resource_default({
  159803. url: blob
  159804. });
  159805. }
  159806. }
  159807. }
  159808. if (!defined_default(resource)) {
  159809. resource = sourceResource.getDerivedResource({
  159810. url: href
  159811. });
  159812. }
  159813. return resource;
  159814. }
  159815. var colorOptions = {
  159816. maximumRed: void 0,
  159817. red: void 0,
  159818. maximumGreen: void 0,
  159819. green: void 0,
  159820. maximumBlue: void 0,
  159821. blue: void 0
  159822. };
  159823. function parseColorString(value, isRandom) {
  159824. if (!defined_default(value) || /^\s*$/gm.test(value)) {
  159825. return void 0;
  159826. }
  159827. if (value[0] === "#") {
  159828. value = value.substring(1);
  159829. }
  159830. const alpha = parseInt(value.substring(0, 2), 16) / 255;
  159831. const blue = parseInt(value.substring(2, 4), 16) / 255;
  159832. const green = parseInt(value.substring(4, 6), 16) / 255;
  159833. const red = parseInt(value.substring(6, 8), 16) / 255;
  159834. if (!isRandom) {
  159835. return new Color_default(red, green, blue, alpha);
  159836. }
  159837. if (red > 0) {
  159838. colorOptions.maximumRed = red;
  159839. colorOptions.red = void 0;
  159840. } else {
  159841. colorOptions.maximumRed = void 0;
  159842. colorOptions.red = 0;
  159843. }
  159844. if (green > 0) {
  159845. colorOptions.maximumGreen = green;
  159846. colorOptions.green = void 0;
  159847. } else {
  159848. colorOptions.maximumGreen = void 0;
  159849. colorOptions.green = 0;
  159850. }
  159851. if (blue > 0) {
  159852. colorOptions.maximumBlue = blue;
  159853. colorOptions.blue = void 0;
  159854. } else {
  159855. colorOptions.maximumBlue = void 0;
  159856. colorOptions.blue = 0;
  159857. }
  159858. colorOptions.alpha = alpha;
  159859. return Color_default.fromRandom(colorOptions);
  159860. }
  159861. function queryColorValue(node, tagName, namespace) {
  159862. const value = queryStringValue2(node, tagName, namespace);
  159863. if (!defined_default(value)) {
  159864. return void 0;
  159865. }
  159866. return parseColorString(
  159867. value,
  159868. queryStringValue2(node, "colorMode", namespace) === "random"
  159869. );
  159870. }
  159871. function processTimeStamp(featureNode) {
  159872. const node = queryFirstNode2(featureNode, "TimeStamp", namespaces2.kmlgx);
  159873. const whenString = queryStringValue2(node, "when", namespaces2.kmlgx);
  159874. if (!defined_default(node) || !defined_default(whenString) || whenString.length === 0) {
  159875. return void 0;
  159876. }
  159877. const when = JulianDate_default.fromIso8601(whenString);
  159878. const result = new TimeIntervalCollection_default();
  159879. result.addInterval(
  159880. new TimeInterval_default({
  159881. start: when,
  159882. stop: Iso8601_default.MAXIMUM_VALUE
  159883. })
  159884. );
  159885. return result;
  159886. }
  159887. function processTimeSpan(featureNode) {
  159888. const node = queryFirstNode2(featureNode, "TimeSpan", namespaces2.kmlgx);
  159889. if (!defined_default(node)) {
  159890. return void 0;
  159891. }
  159892. let result;
  159893. const beginNode = queryFirstNode2(node, "begin", namespaces2.kmlgx);
  159894. let beginDate = defined_default(beginNode) ? JulianDate_default.fromIso8601(beginNode.textContent) : void 0;
  159895. const endNode = queryFirstNode2(node, "end", namespaces2.kmlgx);
  159896. let endDate = defined_default(endNode) ? JulianDate_default.fromIso8601(endNode.textContent) : void 0;
  159897. if (defined_default(beginDate) && defined_default(endDate)) {
  159898. if (JulianDate_default.lessThan(endDate, beginDate)) {
  159899. const tmp2 = beginDate;
  159900. beginDate = endDate;
  159901. endDate = tmp2;
  159902. }
  159903. result = new TimeIntervalCollection_default();
  159904. result.addInterval(
  159905. new TimeInterval_default({
  159906. start: beginDate,
  159907. stop: endDate
  159908. })
  159909. );
  159910. } else if (defined_default(beginDate)) {
  159911. result = new TimeIntervalCollection_default();
  159912. result.addInterval(
  159913. new TimeInterval_default({
  159914. start: beginDate,
  159915. stop: Iso8601_default.MAXIMUM_VALUE
  159916. })
  159917. );
  159918. } else if (defined_default(endDate)) {
  159919. result = new TimeIntervalCollection_default();
  159920. result.addInterval(
  159921. new TimeInterval_default({
  159922. start: Iso8601_default.MINIMUM_VALUE,
  159923. stop: endDate
  159924. })
  159925. );
  159926. }
  159927. return result;
  159928. }
  159929. function createDefaultBillboard2() {
  159930. const billboard = new BillboardGraphics_default();
  159931. billboard.width = BILLBOARD_SIZE2;
  159932. billboard.height = BILLBOARD_SIZE2;
  159933. billboard.scaleByDistance = new NearFarScalar_default(
  159934. BILLBOARD_NEAR_DISTANCE2,
  159935. BILLBOARD_NEAR_RATIO2,
  159936. BILLBOARD_FAR_DISTANCE2,
  159937. BILLBOARD_FAR_RATIO2
  159938. );
  159939. billboard.pixelOffsetScaleByDistance = new NearFarScalar_default(
  159940. BILLBOARD_NEAR_DISTANCE2,
  159941. BILLBOARD_NEAR_RATIO2,
  159942. BILLBOARD_FAR_DISTANCE2,
  159943. BILLBOARD_FAR_RATIO2
  159944. );
  159945. return billboard;
  159946. }
  159947. function createDefaultPolygon() {
  159948. const polygon = new PolygonGraphics_default();
  159949. polygon.outline = true;
  159950. polygon.outlineColor = Color_default.WHITE;
  159951. return polygon;
  159952. }
  159953. function createDefaultLabel2() {
  159954. const label = new LabelGraphics_default();
  159955. label.translucencyByDistance = new NearFarScalar_default(3e6, 1, 5e6, 0);
  159956. label.pixelOffset = new Cartesian2_default(17, 0);
  159957. label.horizontalOrigin = HorizontalOrigin_default.LEFT;
  159958. label.font = "16px sans-serif";
  159959. label.style = LabelStyle_default.FILL_AND_OUTLINE;
  159960. return label;
  159961. }
  159962. function getIconHref(iconNode, dataSource, sourceResource, uriResolver, canRefresh) {
  159963. let href = queryStringValue2(iconNode, "href", namespaces2.kml);
  159964. if (!defined_default(href) || href.length === 0) {
  159965. return void 0;
  159966. }
  159967. if (href.indexOf("root://icons/palette-") === 0) {
  159968. const palette = href.charAt(21);
  159969. let x = defaultValue_default(queryNumericValue2(iconNode, "x", namespaces2.gx), 0);
  159970. let y = defaultValue_default(queryNumericValue2(iconNode, "y", namespaces2.gx), 0);
  159971. x = Math.min(x / 32, 7);
  159972. y = 7 - Math.min(y / 32, 7);
  159973. const iconNum = 8 * y + x;
  159974. href = `https://maps.google.com/mapfiles/kml/pal${palette}/icon${iconNum}.png`;
  159975. }
  159976. const hrefResource = resolveHref(href, sourceResource, uriResolver);
  159977. if (canRefresh) {
  159978. const refreshMode = queryStringValue2(
  159979. iconNode,
  159980. "refreshMode",
  159981. namespaces2.kml
  159982. );
  159983. const viewRefreshMode = queryStringValue2(
  159984. iconNode,
  159985. "viewRefreshMode",
  159986. namespaces2.kml
  159987. );
  159988. if (refreshMode === "onInterval" || refreshMode === "onExpire") {
  159989. oneTimeWarning_default(
  159990. `kml-refreshMode-${refreshMode}`,
  159991. `KML - Unsupported Icon refreshMode: ${refreshMode}`
  159992. );
  159993. } else if (viewRefreshMode === "onStop" || viewRefreshMode === "onRegion") {
  159994. oneTimeWarning_default(
  159995. `kml-refreshMode-${viewRefreshMode}`,
  159996. `KML - Unsupported Icon viewRefreshMode: ${viewRefreshMode}`
  159997. );
  159998. }
  159999. const viewBoundScale = defaultValue_default(
  160000. queryStringValue2(iconNode, "viewBoundScale", namespaces2.kml),
  160001. 1
  160002. );
  160003. const defaultViewFormat = viewRefreshMode === "onStop" ? "BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]" : "";
  160004. const viewFormat = defaultValue_default(
  160005. queryStringValue2(iconNode, "viewFormat", namespaces2.kml),
  160006. defaultViewFormat
  160007. );
  160008. const httpQuery = queryStringValue2(iconNode, "httpQuery", namespaces2.kml);
  160009. if (defined_default(viewFormat)) {
  160010. hrefResource.setQueryParameters(queryToObject_default(cleanupString(viewFormat)));
  160011. }
  160012. if (defined_default(httpQuery)) {
  160013. hrefResource.setQueryParameters(queryToObject_default(cleanupString(httpQuery)));
  160014. }
  160015. const ellipsoid = dataSource._ellipsoid;
  160016. processNetworkLinkQueryString(
  160017. hrefResource,
  160018. dataSource.camera,
  160019. dataSource.canvas,
  160020. viewBoundScale,
  160021. dataSource._lastCameraView.bbox,
  160022. ellipsoid
  160023. );
  160024. return hrefResource;
  160025. }
  160026. return hrefResource;
  160027. }
  160028. function processBillboardIcon(dataSource, node, targetEntity, sourceResource, uriResolver) {
  160029. let scale = queryNumericValue2(node, "scale", namespaces2.kml);
  160030. const heading = queryNumericValue2(node, "heading", namespaces2.kml);
  160031. const color = queryColorValue(node, "color", namespaces2.kml);
  160032. const iconNode = queryFirstNode2(node, "Icon", namespaces2.kml);
  160033. let icon = getIconHref(
  160034. iconNode,
  160035. dataSource,
  160036. sourceResource,
  160037. uriResolver,
  160038. false
  160039. );
  160040. if (defined_default(iconNode) && !defined_default(icon)) {
  160041. icon = false;
  160042. }
  160043. const x = queryNumericValue2(iconNode, "x", namespaces2.gx);
  160044. const y = queryNumericValue2(iconNode, "y", namespaces2.gx);
  160045. const w = queryNumericValue2(iconNode, "w", namespaces2.gx);
  160046. const h = queryNumericValue2(iconNode, "h", namespaces2.gx);
  160047. const hotSpotNode = queryFirstNode2(node, "hotSpot", namespaces2.kml);
  160048. const hotSpotX = queryNumericAttribute2(hotSpotNode, "x");
  160049. const hotSpotY = queryNumericAttribute2(hotSpotNode, "y");
  160050. const hotSpotXUnit = queryStringAttribute2(hotSpotNode, "xunits");
  160051. const hotSpotYUnit = queryStringAttribute2(hotSpotNode, "yunits");
  160052. let billboard = targetEntity.billboard;
  160053. if (!defined_default(billboard)) {
  160054. billboard = createDefaultBillboard2();
  160055. targetEntity.billboard = billboard;
  160056. }
  160057. billboard.image = icon;
  160058. billboard.scale = scale;
  160059. billboard.color = color;
  160060. if (defined_default(x) || defined_default(y) || defined_default(w) || defined_default(h)) {
  160061. billboard.imageSubRegion = new BoundingRectangle_default(x, y, w, h);
  160062. }
  160063. if (defined_default(heading) && heading !== 0) {
  160064. billboard.rotation = Math_default.toRadians(-heading);
  160065. billboard.alignedAxis = Cartesian3_default.UNIT_Z;
  160066. }
  160067. scale = defaultValue_default(scale, 1);
  160068. let xOffset;
  160069. let yOffset;
  160070. if (defined_default(hotSpotX)) {
  160071. if (hotSpotXUnit === "pixels") {
  160072. xOffset = -hotSpotX * scale;
  160073. } else if (hotSpotXUnit === "insetPixels") {
  160074. xOffset = (hotSpotX - BILLBOARD_SIZE2) * scale;
  160075. } else if (hotSpotXUnit === "fraction") {
  160076. xOffset = -hotSpotX * BILLBOARD_SIZE2 * scale;
  160077. }
  160078. xOffset += BILLBOARD_SIZE2 * 0.5 * scale;
  160079. }
  160080. if (defined_default(hotSpotY)) {
  160081. if (hotSpotYUnit === "pixels") {
  160082. yOffset = hotSpotY * scale;
  160083. } else if (hotSpotYUnit === "insetPixels") {
  160084. yOffset = (-hotSpotY + BILLBOARD_SIZE2) * scale;
  160085. } else if (hotSpotYUnit === "fraction") {
  160086. yOffset = hotSpotY * BILLBOARD_SIZE2 * scale;
  160087. }
  160088. yOffset -= BILLBOARD_SIZE2 * 0.5 * scale;
  160089. }
  160090. if (defined_default(xOffset) || defined_default(yOffset)) {
  160091. billboard.pixelOffset = new Cartesian2_default(xOffset, yOffset);
  160092. }
  160093. }
  160094. function applyStyle(dataSource, styleNode, targetEntity, sourceResource, uriResolver) {
  160095. for (let i2 = 0, len = styleNode.childNodes.length; i2 < len; i2++) {
  160096. const node = styleNode.childNodes.item(i2);
  160097. if (node.localName === "IconStyle") {
  160098. processBillboardIcon(
  160099. dataSource,
  160100. node,
  160101. targetEntity,
  160102. sourceResource,
  160103. uriResolver
  160104. );
  160105. } else if (node.localName === "LabelStyle") {
  160106. let label = targetEntity.label;
  160107. if (!defined_default(label)) {
  160108. label = createDefaultLabel2();
  160109. targetEntity.label = label;
  160110. }
  160111. label.scale = defaultValue_default(
  160112. queryNumericValue2(node, "scale", namespaces2.kml),
  160113. label.scale
  160114. );
  160115. label.fillColor = defaultValue_default(
  160116. queryColorValue(node, "color", namespaces2.kml),
  160117. label.fillColor
  160118. );
  160119. label.text = targetEntity.name;
  160120. } else if (node.localName === "LineStyle") {
  160121. let polyline = targetEntity.polyline;
  160122. if (!defined_default(polyline)) {
  160123. polyline = new PolylineGraphics_default();
  160124. targetEntity.polyline = polyline;
  160125. }
  160126. polyline.width = queryNumericValue2(node, "width", namespaces2.kml);
  160127. polyline.material = queryColorValue(node, "color", namespaces2.kml);
  160128. if (defined_default(queryColorValue(node, "outerColor", namespaces2.gx))) {
  160129. oneTimeWarning_default(
  160130. "kml-gx:outerColor",
  160131. "KML - gx:outerColor is not supported in a LineStyle"
  160132. );
  160133. }
  160134. if (defined_default(queryNumericValue2(node, "outerWidth", namespaces2.gx))) {
  160135. oneTimeWarning_default(
  160136. "kml-gx:outerWidth",
  160137. "KML - gx:outerWidth is not supported in a LineStyle"
  160138. );
  160139. }
  160140. if (defined_default(queryNumericValue2(node, "physicalWidth", namespaces2.gx))) {
  160141. oneTimeWarning_default(
  160142. "kml-gx:physicalWidth",
  160143. "KML - gx:physicalWidth is not supported in a LineStyle"
  160144. );
  160145. }
  160146. if (defined_default(queryBooleanValue(node, "labelVisibility", namespaces2.gx))) {
  160147. oneTimeWarning_default(
  160148. "kml-gx:labelVisibility",
  160149. "KML - gx:labelVisibility is not supported in a LineStyle"
  160150. );
  160151. }
  160152. } else if (node.localName === "PolyStyle") {
  160153. let polygon = targetEntity.polygon;
  160154. if (!defined_default(polygon)) {
  160155. polygon = createDefaultPolygon();
  160156. targetEntity.polygon = polygon;
  160157. }
  160158. polygon.material = defaultValue_default(
  160159. queryColorValue(node, "color", namespaces2.kml),
  160160. polygon.material
  160161. );
  160162. polygon.fill = defaultValue_default(
  160163. queryBooleanValue(node, "fill", namespaces2.kml),
  160164. polygon.fill
  160165. );
  160166. polygon.outline = defaultValue_default(
  160167. queryBooleanValue(node, "outline", namespaces2.kml),
  160168. polygon.outline
  160169. );
  160170. } else if (node.localName === "BalloonStyle") {
  160171. const bgColor = defaultValue_default(
  160172. parseColorString(queryStringValue2(node, "bgColor", namespaces2.kml)),
  160173. Color_default.WHITE
  160174. );
  160175. const textColor2 = defaultValue_default(
  160176. parseColorString(queryStringValue2(node, "textColor", namespaces2.kml)),
  160177. Color_default.BLACK
  160178. );
  160179. const text2 = queryStringValue2(node, "text", namespaces2.kml);
  160180. targetEntity.addProperty("balloonStyle");
  160181. targetEntity.balloonStyle = {
  160182. bgColor,
  160183. textColor: textColor2,
  160184. text: text2
  160185. };
  160186. } else if (node.localName === "ListStyle") {
  160187. const listItemType = queryStringValue2(
  160188. node,
  160189. "listItemType",
  160190. namespaces2.kml
  160191. );
  160192. if (listItemType === "radioFolder" || listItemType === "checkOffOnly") {
  160193. oneTimeWarning_default(
  160194. `kml-listStyle-${listItemType}`,
  160195. `KML - Unsupported ListStyle with listItemType: ${listItemType}`
  160196. );
  160197. }
  160198. }
  160199. }
  160200. }
  160201. function computeFinalStyle(dataSource, placeMark, styleCollection, sourceResource, uriResolver) {
  160202. const result = new Entity_default();
  160203. let styleEntity;
  160204. let styleIndex = -1;
  160205. const childNodes = placeMark.childNodes;
  160206. const length3 = childNodes.length;
  160207. for (let q = 0; q < length3; q++) {
  160208. const child = childNodes[q];
  160209. if (child.localName === "Style" || child.localName === "StyleMap") {
  160210. styleIndex = q;
  160211. }
  160212. }
  160213. if (styleIndex !== -1) {
  160214. const inlineStyleNode = childNodes[styleIndex];
  160215. if (inlineStyleNode.localName === "Style") {
  160216. applyStyle(
  160217. dataSource,
  160218. inlineStyleNode,
  160219. result,
  160220. sourceResource,
  160221. uriResolver
  160222. );
  160223. } else {
  160224. const pairs = queryChildNodes(inlineStyleNode, "Pair", namespaces2.kml);
  160225. for (let p2 = 0; p2 < pairs.length; p2++) {
  160226. const pair = pairs[p2];
  160227. const key = queryStringValue2(pair, "key", namespaces2.kml);
  160228. if (key === "normal") {
  160229. const styleUrl = queryStringValue2(pair, "styleUrl", namespaces2.kml);
  160230. if (defined_default(styleUrl)) {
  160231. styleEntity = styleCollection.getById(styleUrl);
  160232. if (!defined_default(styleEntity)) {
  160233. styleEntity = styleCollection.getById(`#${styleUrl}`);
  160234. }
  160235. if (defined_default(styleEntity)) {
  160236. result.merge(styleEntity);
  160237. }
  160238. } else {
  160239. const node = queryFirstNode2(pair, "Style", namespaces2.kml);
  160240. applyStyle(dataSource, node, result, sourceResource, uriResolver);
  160241. }
  160242. } else {
  160243. oneTimeWarning_default(
  160244. `kml-styleMap-${key}`,
  160245. `KML - Unsupported StyleMap key: ${key}`
  160246. );
  160247. }
  160248. }
  160249. }
  160250. }
  160251. const externalStyle = queryStringValue2(placeMark, "styleUrl", namespaces2.kml);
  160252. if (defined_default(externalStyle)) {
  160253. let id = externalStyle;
  160254. if (externalStyle[0] !== "#" && externalStyle.indexOf("#") !== -1) {
  160255. const tokens = externalStyle.split("#");
  160256. const uri = tokens[0];
  160257. const resource = sourceResource.getDerivedResource({
  160258. url: uri
  160259. });
  160260. id = `${resource.getUrlComponent()}#${tokens[1]}`;
  160261. }
  160262. styleEntity = styleCollection.getById(id);
  160263. if (!defined_default(styleEntity)) {
  160264. styleEntity = styleCollection.getById(`#${id}`);
  160265. }
  160266. if (defined_default(styleEntity)) {
  160267. result.merge(styleEntity);
  160268. }
  160269. }
  160270. return result;
  160271. }
  160272. function processExternalStyles(dataSource, resource, styleCollection) {
  160273. return resource.fetchXML().then(function(styleKml) {
  160274. return processStyles(dataSource, styleKml, styleCollection, resource, true);
  160275. });
  160276. }
  160277. function processStyles(dataSource, kml, styleCollection, sourceResource, isExternal, uriResolver) {
  160278. let i2;
  160279. let id;
  160280. let styleEntity;
  160281. let node;
  160282. const styleNodes = queryNodes2(kml, "Style", namespaces2.kml);
  160283. if (defined_default(styleNodes)) {
  160284. const styleNodesLength = styleNodes.length;
  160285. for (i2 = 0; i2 < styleNodesLength; i2++) {
  160286. node = styleNodes[i2];
  160287. id = queryStringAttribute2(node, "id");
  160288. if (defined_default(id)) {
  160289. id = `#${id}`;
  160290. if (isExternal && defined_default(sourceResource)) {
  160291. id = sourceResource.getUrlComponent() + id;
  160292. }
  160293. if (!defined_default(styleCollection.getById(id))) {
  160294. styleEntity = new Entity_default({
  160295. id
  160296. });
  160297. styleCollection.add(styleEntity);
  160298. applyStyle(
  160299. dataSource,
  160300. node,
  160301. styleEntity,
  160302. sourceResource,
  160303. uriResolver
  160304. );
  160305. }
  160306. }
  160307. }
  160308. }
  160309. const styleMaps = queryNodes2(kml, "StyleMap", namespaces2.kml);
  160310. if (defined_default(styleMaps)) {
  160311. const styleMapsLength = styleMaps.length;
  160312. for (i2 = 0; i2 < styleMapsLength; i2++) {
  160313. const styleMap = styleMaps[i2];
  160314. id = queryStringAttribute2(styleMap, "id");
  160315. if (defined_default(id)) {
  160316. const pairs = queryChildNodes(styleMap, "Pair", namespaces2.kml);
  160317. for (let p2 = 0; p2 < pairs.length; p2++) {
  160318. const pair = pairs[p2];
  160319. const key = queryStringValue2(pair, "key", namespaces2.kml);
  160320. if (key === "normal") {
  160321. id = `#${id}`;
  160322. if (isExternal && defined_default(sourceResource)) {
  160323. id = sourceResource.getUrlComponent() + id;
  160324. }
  160325. if (!defined_default(styleCollection.getById(id))) {
  160326. styleEntity = styleCollection.getOrCreateEntity(id);
  160327. let styleUrl = queryStringValue2(pair, "styleUrl", namespaces2.kml);
  160328. if (defined_default(styleUrl)) {
  160329. if (styleUrl[0] !== "#") {
  160330. styleUrl = `#${styleUrl}`;
  160331. }
  160332. if (isExternal && defined_default(sourceResource)) {
  160333. styleUrl = sourceResource.getUrlComponent() + styleUrl;
  160334. }
  160335. const base = styleCollection.getById(styleUrl);
  160336. if (defined_default(base)) {
  160337. styleEntity.merge(base);
  160338. }
  160339. } else {
  160340. node = queryFirstNode2(pair, "Style", namespaces2.kml);
  160341. applyStyle(
  160342. dataSource,
  160343. node,
  160344. styleEntity,
  160345. sourceResource,
  160346. uriResolver
  160347. );
  160348. }
  160349. }
  160350. } else {
  160351. oneTimeWarning_default(
  160352. `kml-styleMap-${key}`,
  160353. `KML - Unsupported StyleMap key: ${key}`
  160354. );
  160355. }
  160356. }
  160357. }
  160358. }
  160359. }
  160360. const promises = [];
  160361. const styleUrlNodes = kml.getElementsByTagName("styleUrl");
  160362. const styleUrlNodesLength = styleUrlNodes.length;
  160363. for (i2 = 0; i2 < styleUrlNodesLength; i2++) {
  160364. const styleReference = styleUrlNodes[i2].textContent;
  160365. if (styleReference[0] !== "#") {
  160366. const tokens = styleReference.split("#");
  160367. if (tokens.length === 2) {
  160368. const uri = tokens[0];
  160369. const resource = sourceResource.getDerivedResource({
  160370. url: uri
  160371. });
  160372. promises.push(
  160373. processExternalStyles(dataSource, resource, styleCollection)
  160374. );
  160375. }
  160376. }
  160377. }
  160378. return promises;
  160379. }
  160380. function createDropLine(entityCollection, entity, styleEntity) {
  160381. const entityPosition = new ReferenceProperty_default(entityCollection, entity.id, [
  160382. "position"
  160383. ]);
  160384. const surfacePosition = new ScaledPositionProperty_default(entity.position);
  160385. entity.polyline = defined_default(styleEntity.polyline) ? styleEntity.polyline.clone() : new PolylineGraphics_default();
  160386. entity.polyline.positions = new PositionPropertyArray_default([
  160387. entityPosition,
  160388. surfacePosition
  160389. ]);
  160390. }
  160391. function heightReferenceFromAltitudeMode(altitudeMode, gxAltitudeMode) {
  160392. if (!defined_default(altitudeMode) && !defined_default(gxAltitudeMode) || altitudeMode === "clampToGround") {
  160393. return HeightReference_default.CLAMP_TO_GROUND;
  160394. }
  160395. if (altitudeMode === "relativeToGround") {
  160396. return HeightReference_default.RELATIVE_TO_GROUND;
  160397. }
  160398. if (altitudeMode === "absolute") {
  160399. return HeightReference_default.NONE;
  160400. }
  160401. if (gxAltitudeMode === "clampToSeaFloor") {
  160402. oneTimeWarning_default(
  160403. "kml-gx:altitudeMode-clampToSeaFloor",
  160404. "KML - <gx:altitudeMode>:clampToSeaFloor is currently not supported, using <kml:altitudeMode>:clampToGround."
  160405. );
  160406. return HeightReference_default.CLAMP_TO_GROUND;
  160407. }
  160408. if (gxAltitudeMode === "relativeToSeaFloor") {
  160409. oneTimeWarning_default(
  160410. "kml-gx:altitudeMode-relativeToSeaFloor",
  160411. "KML - <gx:altitudeMode>:relativeToSeaFloor is currently not supported, using <kml:altitudeMode>:relativeToGround."
  160412. );
  160413. return HeightReference_default.RELATIVE_TO_GROUND;
  160414. }
  160415. if (defined_default(altitudeMode)) {
  160416. oneTimeWarning_default(
  160417. "kml-altitudeMode-unknown",
  160418. `KML - Unknown <kml:altitudeMode>:${altitudeMode}, using <kml:altitudeMode>:CLAMP_TO_GROUND.`
  160419. );
  160420. } else {
  160421. oneTimeWarning_default(
  160422. "kml-gx:altitudeMode-unknown",
  160423. `KML - Unknown <gx:altitudeMode>:${gxAltitudeMode}, using <kml:altitudeMode>:CLAMP_TO_GROUND.`
  160424. );
  160425. }
  160426. return HeightReference_default.CLAMP_TO_GROUND;
  160427. }
  160428. function createPositionPropertyFromAltitudeMode(property, altitudeMode, gxAltitudeMode) {
  160429. if (gxAltitudeMode === "relativeToSeaFloor" || altitudeMode === "absolute" || altitudeMode === "relativeToGround") {
  160430. return property;
  160431. }
  160432. if (defined_default(altitudeMode) && altitudeMode !== "clampToGround" || defined_default(gxAltitudeMode) && gxAltitudeMode !== "clampToSeaFloor") {
  160433. oneTimeWarning_default(
  160434. "kml-altitudeMode-unknown",
  160435. `KML - Unknown altitudeMode: ${defaultValue_default(
  160436. altitudeMode,
  160437. gxAltitudeMode
  160438. )}`
  160439. );
  160440. }
  160441. return new ScaledPositionProperty_default(property);
  160442. }
  160443. function createPositionPropertyArrayFromAltitudeMode(properties, altitudeMode, gxAltitudeMode, ellipsoid) {
  160444. if (!defined_default(properties)) {
  160445. return void 0;
  160446. }
  160447. if (gxAltitudeMode === "relativeToSeaFloor" || altitudeMode === "absolute" || altitudeMode === "relativeToGround") {
  160448. return properties;
  160449. }
  160450. if (defined_default(altitudeMode) && altitudeMode !== "clampToGround" || defined_default(gxAltitudeMode) && gxAltitudeMode !== "clampToSeaFloor") {
  160451. oneTimeWarning_default(
  160452. "kml-altitudeMode-unknown",
  160453. `KML - Unknown altitudeMode: ${defaultValue_default(
  160454. altitudeMode,
  160455. gxAltitudeMode
  160456. )}`
  160457. );
  160458. }
  160459. const propertiesLength = properties.length;
  160460. for (let i2 = 0; i2 < propertiesLength; i2++) {
  160461. const property = properties[i2];
  160462. ellipsoid.scaleToGeodeticSurface(property, property);
  160463. }
  160464. return properties;
  160465. }
  160466. function processPositionGraphics(dataSource, entity, styleEntity, heightReference) {
  160467. let label = entity.label;
  160468. if (!defined_default(label)) {
  160469. label = defined_default(styleEntity.label) ? styleEntity.label.clone() : createDefaultLabel2();
  160470. entity.label = label;
  160471. }
  160472. label.text = entity.name;
  160473. let billboard = entity.billboard;
  160474. if (!defined_default(billboard)) {
  160475. billboard = defined_default(styleEntity.billboard) ? styleEntity.billboard.clone() : createDefaultBillboard2();
  160476. entity.billboard = billboard;
  160477. }
  160478. if (!defined_default(billboard.image)) {
  160479. billboard.image = dataSource._pinBuilder.fromColor(Color_default.YELLOW, 64);
  160480. } else if (!billboard.image.getValue()) {
  160481. billboard.image = void 0;
  160482. }
  160483. let scale = 1;
  160484. if (defined_default(billboard.scale)) {
  160485. scale = billboard.scale.getValue();
  160486. if (scale !== 0) {
  160487. label.pixelOffset = new Cartesian2_default(scale * 16 + 1, 0);
  160488. } else {
  160489. label.pixelOffset = void 0;
  160490. label.horizontalOrigin = void 0;
  160491. }
  160492. }
  160493. if (defined_default(heightReference) && dataSource._clampToGround) {
  160494. billboard.heightReference = heightReference;
  160495. label.heightReference = heightReference;
  160496. }
  160497. }
  160498. function processPathGraphics(entity, styleEntity) {
  160499. let path = entity.path;
  160500. if (!defined_default(path)) {
  160501. path = new PathGraphics_default();
  160502. path.leadTime = 0;
  160503. entity.path = path;
  160504. }
  160505. const polyline = styleEntity.polyline;
  160506. if (defined_default(polyline)) {
  160507. path.material = polyline.material;
  160508. path.width = polyline.width;
  160509. }
  160510. }
  160511. function processPoint3(dataSource, entityCollection, geometryNode, entity, styleEntity) {
  160512. const coordinatesString = queryStringValue2(
  160513. geometryNode,
  160514. "coordinates",
  160515. namespaces2.kml
  160516. );
  160517. const altitudeMode = queryStringValue2(
  160518. geometryNode,
  160519. "altitudeMode",
  160520. namespaces2.kml
  160521. );
  160522. const gxAltitudeMode = queryStringValue2(
  160523. geometryNode,
  160524. "altitudeMode",
  160525. namespaces2.gx
  160526. );
  160527. const extrude = queryBooleanValue(geometryNode, "extrude", namespaces2.kml);
  160528. const ellipsoid = dataSource._ellipsoid;
  160529. const position = readCoordinate(coordinatesString, ellipsoid);
  160530. entity.position = position;
  160531. processPositionGraphics(
  160532. dataSource,
  160533. entity,
  160534. styleEntity,
  160535. heightReferenceFromAltitudeMode(altitudeMode, gxAltitudeMode)
  160536. );
  160537. if (extrude && isExtrudable(altitudeMode, gxAltitudeMode)) {
  160538. createDropLine(entityCollection, entity, styleEntity);
  160539. }
  160540. return true;
  160541. }
  160542. function processLineStringOrLinearRing(dataSource, entityCollection, geometryNode, entity, styleEntity) {
  160543. const coordinatesNode = queryFirstNode2(
  160544. geometryNode,
  160545. "coordinates",
  160546. namespaces2.kml
  160547. );
  160548. const altitudeMode = queryStringValue2(
  160549. geometryNode,
  160550. "altitudeMode",
  160551. namespaces2.kml
  160552. );
  160553. const gxAltitudeMode = queryStringValue2(
  160554. geometryNode,
  160555. "altitudeMode",
  160556. namespaces2.gx
  160557. );
  160558. const extrude = queryBooleanValue(geometryNode, "extrude", namespaces2.kml);
  160559. const tessellate = queryBooleanValue(
  160560. geometryNode,
  160561. "tessellate",
  160562. namespaces2.kml
  160563. );
  160564. const canExtrude = isExtrudable(altitudeMode, gxAltitudeMode);
  160565. const zIndex = queryNumericValue2(geometryNode, "drawOrder", namespaces2.gx);
  160566. const ellipsoid = dataSource._ellipsoid;
  160567. const coordinates = readCoordinates(coordinatesNode, ellipsoid);
  160568. let polyline = styleEntity.polyline;
  160569. if (canExtrude && extrude) {
  160570. const wall = new WallGraphics_default();
  160571. entity.wall = wall;
  160572. wall.positions = coordinates;
  160573. const polygon = styleEntity.polygon;
  160574. if (defined_default(polygon)) {
  160575. wall.fill = polygon.fill;
  160576. wall.material = polygon.material;
  160577. }
  160578. wall.outline = true;
  160579. if (defined_default(polyline)) {
  160580. wall.outlineColor = defined_default(polyline.material) ? polyline.material.color : Color_default.WHITE;
  160581. wall.outlineWidth = polyline.width;
  160582. } else if (defined_default(polygon)) {
  160583. wall.outlineColor = defined_default(polygon.material) ? polygon.material.color : Color_default.WHITE;
  160584. }
  160585. } else if (dataSource._clampToGround && !canExtrude && tessellate) {
  160586. const polylineGraphics = new PolylineGraphics_default();
  160587. polylineGraphics.clampToGround = true;
  160588. entity.polyline = polylineGraphics;
  160589. polylineGraphics.positions = coordinates;
  160590. if (defined_default(polyline)) {
  160591. polylineGraphics.material = defined_default(polyline.material) ? polyline.material.color.getValue(Iso8601_default.MINIMUM_VALUE) : Color_default.WHITE;
  160592. polylineGraphics.width = defaultValue_default(polyline.width, 1);
  160593. } else {
  160594. polylineGraphics.material = Color_default.WHITE;
  160595. polylineGraphics.width = 1;
  160596. }
  160597. polylineGraphics.zIndex = zIndex;
  160598. } else {
  160599. if (defined_default(zIndex)) {
  160600. oneTimeWarning_default(
  160601. "kml-gx:drawOrder",
  160602. "KML - gx:drawOrder is not supported in LineStrings when clampToGround is false"
  160603. );
  160604. }
  160605. if (dataSource._clampToGround && !tessellate) {
  160606. oneTimeWarning_default(
  160607. "kml-line-tesselate",
  160608. "Ignoring clampToGround for KML lines without the tessellate flag."
  160609. );
  160610. }
  160611. polyline = defined_default(polyline) ? polyline.clone() : new PolylineGraphics_default();
  160612. entity.polyline = polyline;
  160613. polyline.positions = createPositionPropertyArrayFromAltitudeMode(
  160614. coordinates,
  160615. altitudeMode,
  160616. gxAltitudeMode,
  160617. ellipsoid
  160618. );
  160619. if (!tessellate || canExtrude) {
  160620. polyline.arcType = ArcType_default.NONE;
  160621. }
  160622. }
  160623. return true;
  160624. }
  160625. function processPolygon3(dataSource, entityCollection, geometryNode, entity, styleEntity) {
  160626. const outerBoundaryIsNode = queryFirstNode2(
  160627. geometryNode,
  160628. "outerBoundaryIs",
  160629. namespaces2.kml
  160630. );
  160631. let linearRingNode = queryFirstNode2(
  160632. outerBoundaryIsNode,
  160633. "LinearRing",
  160634. namespaces2.kml
  160635. );
  160636. let coordinatesNode = queryFirstNode2(
  160637. linearRingNode,
  160638. "coordinates",
  160639. namespaces2.kml
  160640. );
  160641. const ellipsoid = dataSource._ellipsoid;
  160642. let coordinates = readCoordinates(coordinatesNode, ellipsoid);
  160643. const extrude = queryBooleanValue(geometryNode, "extrude", namespaces2.kml);
  160644. const altitudeMode = queryStringValue2(
  160645. geometryNode,
  160646. "altitudeMode",
  160647. namespaces2.kml
  160648. );
  160649. const gxAltitudeMode = queryStringValue2(
  160650. geometryNode,
  160651. "altitudeMode",
  160652. namespaces2.gx
  160653. );
  160654. const canExtrude = isExtrudable(altitudeMode, gxAltitudeMode);
  160655. const polygon = defined_default(styleEntity.polygon) ? styleEntity.polygon.clone() : createDefaultPolygon();
  160656. const polyline = styleEntity.polyline;
  160657. if (defined_default(polyline)) {
  160658. polygon.outlineColor = defined_default(polyline.material) ? polyline.material.color : Color_default.WHITE;
  160659. polygon.outlineWidth = polyline.width;
  160660. }
  160661. entity.polygon = polygon;
  160662. if (canExtrude) {
  160663. polygon.perPositionHeight = true;
  160664. polygon.extrudedHeight = extrude ? 0 : void 0;
  160665. } else if (!dataSource._clampToGround) {
  160666. polygon.height = 0;
  160667. }
  160668. if (defined_default(coordinates)) {
  160669. const hierarchy = new PolygonHierarchy_default(coordinates);
  160670. const innerBoundaryIsNodes = queryChildNodes(
  160671. geometryNode,
  160672. "innerBoundaryIs",
  160673. namespaces2.kml
  160674. );
  160675. for (let j = 0; j < innerBoundaryIsNodes.length; j++) {
  160676. linearRingNode = queryChildNodes(
  160677. innerBoundaryIsNodes[j],
  160678. "LinearRing",
  160679. namespaces2.kml
  160680. );
  160681. for (let k = 0; k < linearRingNode.length; k++) {
  160682. coordinatesNode = queryFirstNode2(
  160683. linearRingNode[k],
  160684. "coordinates",
  160685. namespaces2.kml
  160686. );
  160687. coordinates = readCoordinates(coordinatesNode, ellipsoid);
  160688. if (defined_default(coordinates)) {
  160689. hierarchy.holes.push(new PolygonHierarchy_default(coordinates));
  160690. }
  160691. }
  160692. }
  160693. polygon.hierarchy = hierarchy;
  160694. }
  160695. return true;
  160696. }
  160697. function processTrack(dataSource, entityCollection, geometryNode, entity, styleEntity) {
  160698. const altitudeMode = queryStringValue2(
  160699. geometryNode,
  160700. "altitudeMode",
  160701. namespaces2.kml
  160702. );
  160703. const gxAltitudeMode = queryStringValue2(
  160704. geometryNode,
  160705. "altitudeMode",
  160706. namespaces2.gx
  160707. );
  160708. const coordNodes = queryChildNodes(geometryNode, "coord", namespaces2.gx);
  160709. const angleNodes = queryChildNodes(geometryNode, "angles", namespaces2.gx);
  160710. const timeNodes = queryChildNodes(geometryNode, "when", namespaces2.kml);
  160711. const extrude = queryBooleanValue(geometryNode, "extrude", namespaces2.kml);
  160712. const canExtrude = isExtrudable(altitudeMode, gxAltitudeMode);
  160713. const ellipsoid = dataSource._ellipsoid;
  160714. if (angleNodes.length > 0) {
  160715. oneTimeWarning_default(
  160716. "kml-gx:angles",
  160717. "KML - gx:angles are not supported in gx:Tracks"
  160718. );
  160719. }
  160720. const length3 = Math.min(coordNodes.length, timeNodes.length);
  160721. const coordinates = [];
  160722. const times = [];
  160723. for (let i2 = 0; i2 < length3; i2++) {
  160724. const position = readCoordinate(coordNodes[i2].textContent, ellipsoid);
  160725. coordinates.push(position);
  160726. times.push(JulianDate_default.fromIso8601(timeNodes[i2].textContent));
  160727. }
  160728. const property = new SampledPositionProperty_default();
  160729. property.addSamples(times, coordinates);
  160730. entity.position = property;
  160731. processPositionGraphics(
  160732. dataSource,
  160733. entity,
  160734. styleEntity,
  160735. heightReferenceFromAltitudeMode(altitudeMode, gxAltitudeMode)
  160736. );
  160737. processPathGraphics(entity, styleEntity);
  160738. entity.availability = new TimeIntervalCollection_default();
  160739. if (timeNodes.length > 0) {
  160740. entity.availability.addInterval(
  160741. new TimeInterval_default({
  160742. start: times[0],
  160743. stop: times[times.length - 1]
  160744. })
  160745. );
  160746. }
  160747. if (canExtrude && extrude) {
  160748. createDropLine(entityCollection, entity, styleEntity);
  160749. }
  160750. return true;
  160751. }
  160752. function addToMultiTrack(times, positions, composite, availability, dropShowProperty, extrude, altitudeMode, gxAltitudeMode, includeEndPoints) {
  160753. const start = times[0];
  160754. const stop2 = times[times.length - 1];
  160755. const data = new SampledPositionProperty_default();
  160756. data.addSamples(times, positions);
  160757. composite.intervals.addInterval(
  160758. new TimeInterval_default({
  160759. start,
  160760. stop: stop2,
  160761. isStartIncluded: includeEndPoints,
  160762. isStopIncluded: includeEndPoints,
  160763. data: createPositionPropertyFromAltitudeMode(
  160764. data,
  160765. altitudeMode,
  160766. gxAltitudeMode
  160767. )
  160768. })
  160769. );
  160770. availability.addInterval(
  160771. new TimeInterval_default({
  160772. start,
  160773. stop: stop2,
  160774. isStartIncluded: includeEndPoints,
  160775. isStopIncluded: includeEndPoints
  160776. })
  160777. );
  160778. dropShowProperty.intervals.addInterval(
  160779. new TimeInterval_default({
  160780. start,
  160781. stop: stop2,
  160782. isStartIncluded: includeEndPoints,
  160783. isStopIncluded: includeEndPoints,
  160784. data: extrude
  160785. })
  160786. );
  160787. }
  160788. function processMultiTrack(dataSource, entityCollection, geometryNode, entity, styleEntity) {
  160789. const interpolate2 = queryBooleanValue(
  160790. geometryNode,
  160791. "interpolate",
  160792. namespaces2.gx
  160793. );
  160794. const trackNodes = queryChildNodes(geometryNode, "Track", namespaces2.gx);
  160795. let times;
  160796. let lastStop;
  160797. let lastStopPosition;
  160798. let needDropLine = false;
  160799. const dropShowProperty = new TimeIntervalCollectionProperty_default();
  160800. const availability = new TimeIntervalCollection_default();
  160801. const composite = new CompositePositionProperty_default();
  160802. const ellipsoid = dataSource._ellipsoid;
  160803. for (let i2 = 0, len = trackNodes.length; i2 < len; i2++) {
  160804. const trackNode = trackNodes[i2];
  160805. const timeNodes = queryChildNodes(trackNode, "when", namespaces2.kml);
  160806. const coordNodes = queryChildNodes(trackNode, "coord", namespaces2.gx);
  160807. const altitudeMode = queryStringValue2(
  160808. trackNode,
  160809. "altitudeMode",
  160810. namespaces2.kml
  160811. );
  160812. const gxAltitudeMode = queryStringValue2(
  160813. trackNode,
  160814. "altitudeMode",
  160815. namespaces2.gx
  160816. );
  160817. const canExtrude = isExtrudable(altitudeMode, gxAltitudeMode);
  160818. const extrude = queryBooleanValue(trackNode, "extrude", namespaces2.kml);
  160819. const length3 = Math.min(coordNodes.length, timeNodes.length);
  160820. const positions = [];
  160821. times = [];
  160822. for (let x = 0; x < length3; x++) {
  160823. const position = readCoordinate(coordNodes[x].textContent, ellipsoid);
  160824. positions.push(position);
  160825. times.push(JulianDate_default.fromIso8601(timeNodes[x].textContent));
  160826. }
  160827. if (interpolate2) {
  160828. if (defined_default(lastStop)) {
  160829. addToMultiTrack(
  160830. [lastStop, times[0]],
  160831. [lastStopPosition, positions[0]],
  160832. composite,
  160833. availability,
  160834. dropShowProperty,
  160835. false,
  160836. "absolute",
  160837. void 0,
  160838. false
  160839. );
  160840. }
  160841. lastStop = times[length3 - 1];
  160842. lastStopPosition = positions[positions.length - 1];
  160843. }
  160844. addToMultiTrack(
  160845. times,
  160846. positions,
  160847. composite,
  160848. availability,
  160849. dropShowProperty,
  160850. canExtrude && extrude,
  160851. altitudeMode,
  160852. gxAltitudeMode,
  160853. true
  160854. );
  160855. needDropLine = needDropLine || canExtrude && extrude;
  160856. }
  160857. entity.availability = availability;
  160858. entity.position = composite;
  160859. processPositionGraphics(dataSource, entity, styleEntity);
  160860. processPathGraphics(entity, styleEntity);
  160861. if (needDropLine) {
  160862. createDropLine(entityCollection, entity, styleEntity);
  160863. entity.polyline.show = dropShowProperty;
  160864. }
  160865. return true;
  160866. }
  160867. var geometryTypes2 = {
  160868. Point: processPoint3,
  160869. LineString: processLineStringOrLinearRing,
  160870. LinearRing: processLineStringOrLinearRing,
  160871. Polygon: processPolygon3,
  160872. Track: processTrack,
  160873. MultiTrack: processMultiTrack,
  160874. MultiGeometry: processMultiGeometry,
  160875. Model: processUnsupportedGeometry
  160876. };
  160877. function processMultiGeometry(dataSource, entityCollection, geometryNode, entity, styleEntity, context) {
  160878. const childNodes = geometryNode.childNodes;
  160879. let hasGeometry = false;
  160880. for (let i2 = 0, len = childNodes.length; i2 < len; i2++) {
  160881. const childNode = childNodes.item(i2);
  160882. const geometryProcessor = geometryTypes2[childNode.localName];
  160883. if (defined_default(geometryProcessor)) {
  160884. const childEntity = createEntity(childNode, entityCollection, context);
  160885. childEntity.parent = entity;
  160886. childEntity.name = entity.name;
  160887. childEntity.availability = entity.availability;
  160888. childEntity.description = entity.description;
  160889. childEntity.kml = entity.kml;
  160890. if (geometryProcessor(
  160891. dataSource,
  160892. entityCollection,
  160893. childNode,
  160894. childEntity,
  160895. styleEntity
  160896. )) {
  160897. hasGeometry = true;
  160898. }
  160899. }
  160900. }
  160901. return hasGeometry;
  160902. }
  160903. function processUnsupportedGeometry(dataSource, entityCollection, geometryNode, entity, styleEntity) {
  160904. oneTimeWarning_default(
  160905. "kml-unsupportedGeometry",
  160906. `KML - Unsupported geometry: ${geometryNode.localName}`
  160907. );
  160908. return false;
  160909. }
  160910. function processExtendedData(node, entity) {
  160911. const extendedDataNode = queryFirstNode2(node, "ExtendedData", namespaces2.kml);
  160912. if (!defined_default(extendedDataNode)) {
  160913. return void 0;
  160914. }
  160915. if (defined_default(queryFirstNode2(extendedDataNode, "SchemaData", namespaces2.kml))) {
  160916. oneTimeWarning_default("kml-schemaData", "KML - SchemaData is unsupported");
  160917. }
  160918. if (defined_default(queryStringAttribute2(extendedDataNode, "xmlns:prefix"))) {
  160919. oneTimeWarning_default(
  160920. "kml-extendedData",
  160921. "KML - ExtendedData with xmlns:prefix is unsupported"
  160922. );
  160923. }
  160924. const result = {};
  160925. const dataNodes = queryChildNodes(extendedDataNode, "Data", namespaces2.kml);
  160926. if (defined_default(dataNodes)) {
  160927. const length3 = dataNodes.length;
  160928. for (let i2 = 0; i2 < length3; i2++) {
  160929. const dataNode = dataNodes[i2];
  160930. const name = queryStringAttribute2(dataNode, "name");
  160931. if (defined_default(name)) {
  160932. result[name] = {
  160933. displayName: queryStringValue2(
  160934. dataNode,
  160935. "displayName",
  160936. namespaces2.kml
  160937. ),
  160938. value: queryStringValue2(dataNode, "value", namespaces2.kml)
  160939. };
  160940. }
  160941. }
  160942. }
  160943. entity.kml.extendedData = result;
  160944. }
  160945. var scratchDiv2;
  160946. if (typeof document !== "undefined") {
  160947. scratchDiv2 = document.createElement("div");
  160948. }
  160949. function processDescription3(node, entity, styleEntity, uriResolver, sourceResource) {
  160950. let i2;
  160951. let key;
  160952. let keys;
  160953. const kmlData = entity.kml;
  160954. const extendedData = kmlData.extendedData;
  160955. const description = queryStringValue2(node, "description", namespaces2.kml);
  160956. const balloonStyle = defaultValue_default(
  160957. entity.balloonStyle,
  160958. styleEntity.balloonStyle
  160959. );
  160960. let background = Color_default.WHITE;
  160961. let foreground = Color_default.BLACK;
  160962. let text2 = description;
  160963. if (defined_default(balloonStyle)) {
  160964. background = defaultValue_default(balloonStyle.bgColor, Color_default.WHITE);
  160965. foreground = defaultValue_default(balloonStyle.textColor, Color_default.BLACK);
  160966. text2 = defaultValue_default(balloonStyle.text, description);
  160967. }
  160968. let value;
  160969. if (defined_default(text2)) {
  160970. text2 = text2.replace("$[name]", defaultValue_default(entity.name, ""));
  160971. text2 = text2.replace("$[description]", defaultValue_default(description, ""));
  160972. text2 = text2.replace("$[address]", defaultValue_default(kmlData.address, ""));
  160973. text2 = text2.replace("$[Snippet]", defaultValue_default(kmlData.snippet, ""));
  160974. text2 = text2.replace("$[id]", entity.id);
  160975. text2 = text2.replace("$[geDirections]", "");
  160976. if (defined_default(extendedData)) {
  160977. const matches = text2.match(/\$\[.+?\]/g);
  160978. if (matches !== null) {
  160979. for (i2 = 0; i2 < matches.length; i2++) {
  160980. const token = matches[i2];
  160981. let propertyName = token.substr(2, token.length - 3);
  160982. const isDisplayName = /\/displayName$/.test(propertyName);
  160983. propertyName = propertyName.replace(/\/displayName$/, "");
  160984. value = extendedData[propertyName];
  160985. if (defined_default(value)) {
  160986. value = isDisplayName ? value.displayName : value.value;
  160987. }
  160988. if (defined_default(value)) {
  160989. text2 = text2.replace(token, defaultValue_default(value, ""));
  160990. }
  160991. }
  160992. }
  160993. }
  160994. } else if (defined_default(extendedData)) {
  160995. keys = Object.keys(extendedData);
  160996. if (keys.length > 0) {
  160997. text2 = '<table class="cesium-infoBox-defaultTable cesium-infoBox-defaultTable-lighter"><tbody>';
  160998. for (i2 = 0; i2 < keys.length; i2++) {
  160999. key = keys[i2];
  161000. value = extendedData[key];
  161001. text2 += `<tr><th>${defaultValue_default(
  161002. value.displayName,
  161003. key
  161004. )}</th><td>${defaultValue_default(value.value, "")}</td></tr>`;
  161005. }
  161006. text2 += "</tbody></table>";
  161007. }
  161008. }
  161009. if (!defined_default(text2)) {
  161010. return;
  161011. }
  161012. text2 = autolinker2.link(text2);
  161013. scratchDiv2.innerHTML = text2;
  161014. const links = scratchDiv2.querySelectorAll("a");
  161015. for (i2 = 0; i2 < links.length; i2++) {
  161016. links[i2].setAttribute("target", "_blank");
  161017. }
  161018. if (defined_default(uriResolver) && uriResolver.keys.length > 1) {
  161019. embedDataUris(scratchDiv2, "a", "href", uriResolver);
  161020. embedDataUris(scratchDiv2, "link", "href", uriResolver);
  161021. embedDataUris(scratchDiv2, "area", "href", uriResolver);
  161022. embedDataUris(scratchDiv2, "img", "src", uriResolver);
  161023. embedDataUris(scratchDiv2, "iframe", "src", uriResolver);
  161024. embedDataUris(scratchDiv2, "video", "src", uriResolver);
  161025. embedDataUris(scratchDiv2, "audio", "src", uriResolver);
  161026. embedDataUris(scratchDiv2, "source", "src", uriResolver);
  161027. embedDataUris(scratchDiv2, "track", "src", uriResolver);
  161028. embedDataUris(scratchDiv2, "input", "src", uriResolver);
  161029. embedDataUris(scratchDiv2, "embed", "src", uriResolver);
  161030. embedDataUris(scratchDiv2, "script", "src", uriResolver);
  161031. embedDataUris(scratchDiv2, "video", "poster", uriResolver);
  161032. }
  161033. applyBasePath(scratchDiv2, "a", "href", sourceResource);
  161034. applyBasePath(scratchDiv2, "link", "href", sourceResource);
  161035. applyBasePath(scratchDiv2, "area", "href", sourceResource);
  161036. applyBasePath(scratchDiv2, "img", "src", sourceResource);
  161037. applyBasePath(scratchDiv2, "iframe", "src", sourceResource);
  161038. applyBasePath(scratchDiv2, "video", "src", sourceResource);
  161039. applyBasePath(scratchDiv2, "audio", "src", sourceResource);
  161040. applyBasePath(scratchDiv2, "source", "src", sourceResource);
  161041. applyBasePath(scratchDiv2, "track", "src", sourceResource);
  161042. applyBasePath(scratchDiv2, "input", "src", sourceResource);
  161043. applyBasePath(scratchDiv2, "embed", "src", sourceResource);
  161044. applyBasePath(scratchDiv2, "script", "src", sourceResource);
  161045. applyBasePath(scratchDiv2, "video", "poster", sourceResource);
  161046. let tmp2 = '<div class="cesium-infoBox-description-lighter" style="';
  161047. tmp2 += "overflow:auto;";
  161048. tmp2 += "word-wrap:break-word;";
  161049. tmp2 += `background-color:${background.toCssColorString()};`;
  161050. tmp2 += `color:${foreground.toCssColorString()};`;
  161051. tmp2 += '">';
  161052. tmp2 += `${scratchDiv2.innerHTML}</div>`;
  161053. scratchDiv2.innerHTML = "";
  161054. entity.description = tmp2;
  161055. }
  161056. function processFeature2(dataSource, featureNode, processingData) {
  161057. const entityCollection = processingData.entityCollection;
  161058. const parent = processingData.parentEntity;
  161059. const sourceResource = processingData.sourceResource;
  161060. const uriResolver = processingData.uriResolver;
  161061. const entity = createEntity(
  161062. featureNode,
  161063. entityCollection,
  161064. processingData.context
  161065. );
  161066. const kmlData = entity.kml;
  161067. const styleEntity = computeFinalStyle(
  161068. dataSource,
  161069. featureNode,
  161070. processingData.styleCollection,
  161071. sourceResource,
  161072. uriResolver
  161073. );
  161074. const name = queryStringValue2(featureNode, "name", namespaces2.kml);
  161075. entity.name = name;
  161076. entity.parent = parent;
  161077. let availability = processTimeSpan(featureNode);
  161078. if (!defined_default(availability)) {
  161079. availability = processTimeStamp(featureNode);
  161080. }
  161081. entity.availability = availability;
  161082. mergeAvailabilityWithParent(entity);
  161083. function ancestryIsVisible(parentEntity) {
  161084. if (!parentEntity) {
  161085. return true;
  161086. }
  161087. return parentEntity.show && ancestryIsVisible(parentEntity.parent);
  161088. }
  161089. const visibility = queryBooleanValue(
  161090. featureNode,
  161091. "visibility",
  161092. namespaces2.kml
  161093. );
  161094. entity.show = ancestryIsVisible(parent) && defaultValue_default(visibility, true);
  161095. const authorNode = queryFirstNode2(featureNode, "author", namespaces2.atom);
  161096. const author = kmlData.author;
  161097. author.name = queryStringValue2(authorNode, "name", namespaces2.atom);
  161098. author.uri = queryStringValue2(authorNode, "uri", namespaces2.atom);
  161099. author.email = queryStringValue2(authorNode, "email", namespaces2.atom);
  161100. const linkNode = queryFirstNode2(featureNode, "link", namespaces2.atom);
  161101. const link = kmlData.link;
  161102. link.href = queryStringAttribute2(linkNode, "href");
  161103. link.hreflang = queryStringAttribute2(linkNode, "hreflang");
  161104. link.rel = queryStringAttribute2(linkNode, "rel");
  161105. link.type = queryStringAttribute2(linkNode, "type");
  161106. link.title = queryStringAttribute2(linkNode, "title");
  161107. link.length = queryStringAttribute2(linkNode, "length");
  161108. kmlData.address = queryStringValue2(featureNode, "address", namespaces2.kml);
  161109. kmlData.phoneNumber = queryStringValue2(
  161110. featureNode,
  161111. "phoneNumber",
  161112. namespaces2.kml
  161113. );
  161114. kmlData.snippet = queryStringValue2(featureNode, "Snippet", namespaces2.kml);
  161115. processExtendedData(featureNode, entity);
  161116. processDescription3(
  161117. featureNode,
  161118. entity,
  161119. styleEntity,
  161120. uriResolver,
  161121. sourceResource
  161122. );
  161123. const ellipsoid = dataSource._ellipsoid;
  161124. processLookAt(featureNode, entity, ellipsoid);
  161125. processCamera(featureNode, entity, ellipsoid);
  161126. if (defined_default(queryFirstNode2(featureNode, "Region", namespaces2.kml))) {
  161127. oneTimeWarning_default("kml-region", "KML - Placemark Regions are unsupported");
  161128. }
  161129. return {
  161130. entity,
  161131. styleEntity
  161132. };
  161133. }
  161134. function processDocument2(dataSource, node, processingData, deferredLoading) {
  161135. deferredLoading.addNodes(node.childNodes, processingData);
  161136. deferredLoading.process();
  161137. }
  161138. function processFolder(dataSource, node, processingData, deferredLoading) {
  161139. const r2 = processFeature2(dataSource, node, processingData);
  161140. const newProcessingData = clone_default(processingData);
  161141. newProcessingData.parentEntity = r2.entity;
  161142. processDocument2(dataSource, node, newProcessingData, deferredLoading);
  161143. }
  161144. function processPlacemark(dataSource, placemark, processingData, deferredLoading) {
  161145. const r2 = processFeature2(dataSource, placemark, processingData);
  161146. const entity = r2.entity;
  161147. const styleEntity = r2.styleEntity;
  161148. let hasGeometry = false;
  161149. const childNodes = placemark.childNodes;
  161150. for (let i2 = 0, len = childNodes.length; i2 < len && !hasGeometry; i2++) {
  161151. const childNode = childNodes.item(i2);
  161152. const geometryProcessor = geometryTypes2[childNode.localName];
  161153. if (defined_default(geometryProcessor)) {
  161154. geometryProcessor(
  161155. dataSource,
  161156. processingData.entityCollection,
  161157. childNode,
  161158. entity,
  161159. styleEntity,
  161160. entity.id
  161161. );
  161162. hasGeometry = true;
  161163. }
  161164. }
  161165. if (!hasGeometry) {
  161166. entity.merge(styleEntity);
  161167. processPositionGraphics(dataSource, entity, styleEntity);
  161168. }
  161169. }
  161170. var playlistNodeProcessors = {
  161171. FlyTo: processTourFlyTo,
  161172. Wait: processTourWait,
  161173. SoundCue: processTourUnsupportedNode,
  161174. AnimatedUpdate: processTourUnsupportedNode,
  161175. TourControl: processTourUnsupportedNode
  161176. };
  161177. function processTour(dataSource, node, processingData, deferredLoading) {
  161178. const name = queryStringValue2(node, "name", namespaces2.kml);
  161179. const id = queryStringAttribute2(node, "id");
  161180. const tour = new KmlTour_default(name, id);
  161181. const playlistNode = queryFirstNode2(node, "Playlist", namespaces2.gx);
  161182. if (playlistNode) {
  161183. const ellipsoid = dataSource._ellipsoid;
  161184. const childNodes = playlistNode.childNodes;
  161185. for (let i2 = 0; i2 < childNodes.length; i2++) {
  161186. const entryNode = childNodes[i2];
  161187. if (entryNode.localName) {
  161188. const playlistNodeProcessor = playlistNodeProcessors[entryNode.localName];
  161189. if (playlistNodeProcessor) {
  161190. playlistNodeProcessor(tour, entryNode, ellipsoid);
  161191. } else {
  161192. console.log(
  161193. `Unknown KML Tour playlist entry type ${entryNode.localName}`
  161194. );
  161195. }
  161196. }
  161197. }
  161198. }
  161199. dataSource._kmlTours.push(tour);
  161200. }
  161201. function processTourUnsupportedNode(tour, entryNode) {
  161202. oneTimeWarning_default(`KML Tour unsupported node ${entryNode.localName}`);
  161203. }
  161204. function processTourWait(tour, entryNode) {
  161205. const duration = queryNumericValue2(entryNode, "duration", namespaces2.gx);
  161206. tour.addPlaylistEntry(new KmlTourWait_default(duration));
  161207. }
  161208. function processTourFlyTo(tour, entryNode, ellipsoid) {
  161209. const duration = queryNumericValue2(entryNode, "duration", namespaces2.gx);
  161210. const flyToMode = queryStringValue2(entryNode, "flyToMode", namespaces2.gx);
  161211. const t = { kml: {} };
  161212. processLookAt(entryNode, t, ellipsoid);
  161213. processCamera(entryNode, t, ellipsoid);
  161214. const view = t.kml.lookAt || t.kml.camera;
  161215. const flyto = new KmlTourFlyTo_default(duration, flyToMode, view);
  161216. tour.addPlaylistEntry(flyto);
  161217. }
  161218. function processCamera(featureNode, entity, ellipsoid) {
  161219. const camera = queryFirstNode2(featureNode, "Camera", namespaces2.kml);
  161220. if (defined_default(camera)) {
  161221. const lon = defaultValue_default(
  161222. queryNumericValue2(camera, "longitude", namespaces2.kml),
  161223. 0
  161224. );
  161225. const lat = defaultValue_default(
  161226. queryNumericValue2(camera, "latitude", namespaces2.kml),
  161227. 0
  161228. );
  161229. const altitude = defaultValue_default(
  161230. queryNumericValue2(camera, "altitude", namespaces2.kml),
  161231. 0
  161232. );
  161233. const heading = defaultValue_default(
  161234. queryNumericValue2(camera, "heading", namespaces2.kml),
  161235. 0
  161236. );
  161237. const tilt = defaultValue_default(
  161238. queryNumericValue2(camera, "tilt", namespaces2.kml),
  161239. 0
  161240. );
  161241. const roll = defaultValue_default(
  161242. queryNumericValue2(camera, "roll", namespaces2.kml),
  161243. 0
  161244. );
  161245. const position = Cartesian3_default.fromDegrees(lon, lat, altitude, ellipsoid);
  161246. const hpr = HeadingPitchRoll_default.fromDegrees(heading, tilt - 90, roll);
  161247. entity.kml.camera = new KmlCamera_default(position, hpr);
  161248. }
  161249. }
  161250. function processLookAt(featureNode, entity, ellipsoid) {
  161251. const lookAt = queryFirstNode2(featureNode, "LookAt", namespaces2.kml);
  161252. if (defined_default(lookAt)) {
  161253. const lon = defaultValue_default(
  161254. queryNumericValue2(lookAt, "longitude", namespaces2.kml),
  161255. 0
  161256. );
  161257. const lat = defaultValue_default(
  161258. queryNumericValue2(lookAt, "latitude", namespaces2.kml),
  161259. 0
  161260. );
  161261. const altitude = defaultValue_default(
  161262. queryNumericValue2(lookAt, "altitude", namespaces2.kml),
  161263. 0
  161264. );
  161265. let heading = queryNumericValue2(lookAt, "heading", namespaces2.kml);
  161266. let tilt = queryNumericValue2(lookAt, "tilt", namespaces2.kml);
  161267. const range2 = defaultValue_default(
  161268. queryNumericValue2(lookAt, "range", namespaces2.kml),
  161269. 0
  161270. );
  161271. tilt = Math_default.toRadians(defaultValue_default(tilt, 0));
  161272. heading = Math_default.toRadians(defaultValue_default(heading, 0));
  161273. const hpr = new HeadingPitchRange_default(
  161274. heading,
  161275. tilt - Math_default.PI_OVER_TWO,
  161276. range2
  161277. );
  161278. const viewPoint = Cartesian3_default.fromDegrees(lon, lat, altitude, ellipsoid);
  161279. entity.kml.lookAt = new KmlLookAt_default(viewPoint, hpr);
  161280. }
  161281. }
  161282. function processScreenOverlay(dataSource, screenOverlayNode, processingData, deferredLoading) {
  161283. const screenOverlay = processingData.screenOverlayContainer;
  161284. if (!defined_default(screenOverlay)) {
  161285. return void 0;
  161286. }
  161287. const sourceResource = processingData.sourceResource;
  161288. const uriResolver = processingData.uriResolver;
  161289. const iconNode = queryFirstNode2(screenOverlayNode, "Icon", namespaces2.kml);
  161290. const icon = getIconHref(
  161291. iconNode,
  161292. dataSource,
  161293. sourceResource,
  161294. uriResolver,
  161295. false
  161296. );
  161297. if (!defined_default(icon)) {
  161298. return void 0;
  161299. }
  161300. const img = document.createElement("img");
  161301. dataSource._screenOverlays.push(img);
  161302. img.src = icon.url;
  161303. img.onload = function() {
  161304. const styles = ["position: absolute"];
  161305. const screenXY = queryFirstNode2(
  161306. screenOverlayNode,
  161307. "screenXY",
  161308. namespaces2.kml
  161309. );
  161310. const overlayXY = queryFirstNode2(
  161311. screenOverlayNode,
  161312. "overlayXY",
  161313. namespaces2.kml
  161314. );
  161315. const size = queryFirstNode2(screenOverlayNode, "size", namespaces2.kml);
  161316. let x, y;
  161317. let xUnit, yUnit;
  161318. let xStyle, yStyle;
  161319. if (defined_default(size)) {
  161320. x = queryNumericAttribute2(size, "x");
  161321. y = queryNumericAttribute2(size, "y");
  161322. xUnit = queryStringAttribute2(size, "xunits");
  161323. yUnit = queryStringAttribute2(size, "yunits");
  161324. if (defined_default(x) && x !== -1 && x !== 0) {
  161325. if (xUnit === "fraction") {
  161326. xStyle = `width: ${Math.floor(x * 100)}%`;
  161327. } else if (xUnit === "pixels") {
  161328. xStyle = `width: ${x}px`;
  161329. }
  161330. styles.push(xStyle);
  161331. }
  161332. if (defined_default(y) && y !== -1 && y !== 0) {
  161333. if (yUnit === "fraction") {
  161334. yStyle = `height: ${Math.floor(y * 100)}%`;
  161335. } else if (yUnit === "pixels") {
  161336. yStyle = `height: ${y}px`;
  161337. }
  161338. styles.push(yStyle);
  161339. }
  161340. }
  161341. img.style = styles.join(";");
  161342. let xOrigin = 0;
  161343. let yOrigin = img.height;
  161344. if (defined_default(overlayXY)) {
  161345. x = queryNumericAttribute2(overlayXY, "x");
  161346. y = queryNumericAttribute2(overlayXY, "y");
  161347. xUnit = queryStringAttribute2(overlayXY, "xunits");
  161348. yUnit = queryStringAttribute2(overlayXY, "yunits");
  161349. if (defined_default(x)) {
  161350. if (xUnit === "fraction") {
  161351. xOrigin = x * img.width;
  161352. } else if (xUnit === "pixels") {
  161353. xOrigin = x;
  161354. } else if (xUnit === "insetPixels") {
  161355. xOrigin = x;
  161356. }
  161357. }
  161358. if (defined_default(y)) {
  161359. if (yUnit === "fraction") {
  161360. yOrigin = y * img.height;
  161361. } else if (yUnit === "pixels") {
  161362. yOrigin = y;
  161363. } else if (yUnit === "insetPixels") {
  161364. yOrigin = y;
  161365. }
  161366. }
  161367. }
  161368. if (defined_default(screenXY)) {
  161369. x = queryNumericAttribute2(screenXY, "x");
  161370. y = queryNumericAttribute2(screenXY, "y");
  161371. xUnit = queryStringAttribute2(screenXY, "xunits");
  161372. yUnit = queryStringAttribute2(screenXY, "yunits");
  161373. if (defined_default(x)) {
  161374. if (xUnit === "fraction") {
  161375. xStyle = `${"left: calc("}${Math.floor(
  161376. x * 100
  161377. )}% - ${xOrigin}px)`;
  161378. } else if (xUnit === "pixels") {
  161379. xStyle = `left: ${x - xOrigin}px`;
  161380. } else if (xUnit === "insetPixels") {
  161381. xStyle = `right: ${x - xOrigin}px`;
  161382. }
  161383. styles.push(xStyle);
  161384. }
  161385. if (defined_default(y)) {
  161386. if (yUnit === "fraction") {
  161387. yStyle = `${"bottom: calc("}${Math.floor(
  161388. y * 100
  161389. )}% - ${yOrigin}px)`;
  161390. } else if (yUnit === "pixels") {
  161391. yStyle = `bottom: ${y - yOrigin}px`;
  161392. } else if (yUnit === "insetPixels") {
  161393. yStyle = `top: ${y - yOrigin}px`;
  161394. }
  161395. styles.push(yStyle);
  161396. }
  161397. }
  161398. img.style = styles.join(";");
  161399. };
  161400. screenOverlay.appendChild(img);
  161401. }
  161402. function processGroundOverlay(dataSource, groundOverlay, processingData, deferredLoading) {
  161403. const r2 = processFeature2(dataSource, groundOverlay, processingData);
  161404. const entity = r2.entity;
  161405. let geometry;
  161406. let isLatLonQuad = false;
  161407. const ellipsoid = dataSource._ellipsoid;
  161408. const positions = readCoordinates(
  161409. queryFirstNode2(groundOverlay, "LatLonQuad", namespaces2.gx),
  161410. ellipsoid
  161411. );
  161412. const zIndex = queryNumericValue2(groundOverlay, "drawOrder", namespaces2.kml);
  161413. if (defined_default(positions)) {
  161414. geometry = createDefaultPolygon();
  161415. geometry.hierarchy = new PolygonHierarchy_default(positions);
  161416. geometry.zIndex = zIndex;
  161417. entity.polygon = geometry;
  161418. isLatLonQuad = true;
  161419. } else {
  161420. geometry = new RectangleGraphics_default();
  161421. geometry.zIndex = zIndex;
  161422. entity.rectangle = geometry;
  161423. const latLonBox = queryFirstNode2(
  161424. groundOverlay,
  161425. "LatLonBox",
  161426. namespaces2.kml
  161427. );
  161428. if (defined_default(latLonBox)) {
  161429. let west = queryNumericValue2(latLonBox, "west", namespaces2.kml);
  161430. let south = queryNumericValue2(latLonBox, "south", namespaces2.kml);
  161431. let east = queryNumericValue2(latLonBox, "east", namespaces2.kml);
  161432. let north = queryNumericValue2(latLonBox, "north", namespaces2.kml);
  161433. if (defined_default(west)) {
  161434. west = Math_default.negativePiToPi(Math_default.toRadians(west));
  161435. }
  161436. if (defined_default(south)) {
  161437. south = Math_default.clampToLatitudeRange(Math_default.toRadians(south));
  161438. }
  161439. if (defined_default(east)) {
  161440. east = Math_default.negativePiToPi(Math_default.toRadians(east));
  161441. }
  161442. if (defined_default(north)) {
  161443. north = Math_default.clampToLatitudeRange(Math_default.toRadians(north));
  161444. }
  161445. geometry.coordinates = new Rectangle_default(west, south, east, north);
  161446. const rotation = queryNumericValue2(latLonBox, "rotation", namespaces2.kml);
  161447. if (defined_default(rotation)) {
  161448. const rotationRadians = Math_default.toRadians(rotation);
  161449. geometry.rotation = rotationRadians;
  161450. geometry.stRotation = rotationRadians;
  161451. }
  161452. }
  161453. }
  161454. const iconNode = queryFirstNode2(groundOverlay, "Icon", namespaces2.kml);
  161455. const href = getIconHref(
  161456. iconNode,
  161457. dataSource,
  161458. processingData.sourceResource,
  161459. processingData.uriResolver,
  161460. true
  161461. );
  161462. if (defined_default(href)) {
  161463. if (isLatLonQuad) {
  161464. oneTimeWarning_default(
  161465. "kml-gx:LatLonQuad",
  161466. "KML - gx:LatLonQuad Icon does not support texture projection."
  161467. );
  161468. }
  161469. const x = queryNumericValue2(iconNode, "x", namespaces2.gx);
  161470. const y = queryNumericValue2(iconNode, "y", namespaces2.gx);
  161471. const w = queryNumericValue2(iconNode, "w", namespaces2.gx);
  161472. const h = queryNumericValue2(iconNode, "h", namespaces2.gx);
  161473. if (defined_default(x) || defined_default(y) || defined_default(w) || defined_default(h)) {
  161474. oneTimeWarning_default(
  161475. "kml-groundOverlay-xywh",
  161476. "KML - gx:x, gx:y, gx:w, gx:h aren't supported for GroundOverlays"
  161477. );
  161478. }
  161479. geometry.material = href;
  161480. geometry.material.color = queryColorValue(
  161481. groundOverlay,
  161482. "color",
  161483. namespaces2.kml
  161484. );
  161485. geometry.material.transparent = true;
  161486. } else {
  161487. geometry.material = queryColorValue(groundOverlay, "color", namespaces2.kml);
  161488. }
  161489. let altitudeMode = queryStringValue2(
  161490. groundOverlay,
  161491. "altitudeMode",
  161492. namespaces2.kml
  161493. );
  161494. if (defined_default(altitudeMode)) {
  161495. if (altitudeMode === "absolute") {
  161496. geometry.height = queryNumericValue2(
  161497. groundOverlay,
  161498. "altitude",
  161499. namespaces2.kml
  161500. );
  161501. geometry.zIndex = void 0;
  161502. } else if (altitudeMode !== "clampToGround") {
  161503. oneTimeWarning_default(
  161504. "kml-altitudeMode-unknown",
  161505. `KML - Unknown altitudeMode: ${altitudeMode}`
  161506. );
  161507. }
  161508. } else {
  161509. altitudeMode = queryStringValue2(
  161510. groundOverlay,
  161511. "altitudeMode",
  161512. namespaces2.gx
  161513. );
  161514. if (altitudeMode === "relativeToSeaFloor") {
  161515. oneTimeWarning_default(
  161516. "kml-altitudeMode-relativeToSeaFloor",
  161517. "KML - altitudeMode relativeToSeaFloor is currently not supported, treating as absolute."
  161518. );
  161519. geometry.height = queryNumericValue2(
  161520. groundOverlay,
  161521. "altitude",
  161522. namespaces2.kml
  161523. );
  161524. geometry.zIndex = void 0;
  161525. } else if (altitudeMode === "clampToSeaFloor") {
  161526. oneTimeWarning_default(
  161527. "kml-altitudeMode-clampToSeaFloor",
  161528. "KML - altitudeMode clampToSeaFloor is currently not supported, treating as clampToGround."
  161529. );
  161530. } else if (defined_default(altitudeMode)) {
  161531. oneTimeWarning_default(
  161532. "kml-altitudeMode-unknown",
  161533. `KML - Unknown altitudeMode: ${altitudeMode}`
  161534. );
  161535. }
  161536. }
  161537. }
  161538. function processUnsupportedFeature(dataSource, node, processingData, deferredLoading) {
  161539. dataSource._unsupportedNode.raiseEvent(
  161540. dataSource,
  161541. processingData.parentEntity,
  161542. node,
  161543. processingData.entityCollection,
  161544. processingData.styleCollection,
  161545. processingData.sourceResource,
  161546. processingData.uriResolver
  161547. );
  161548. oneTimeWarning_default(
  161549. `kml-unsupportedFeature-${node.nodeName}`,
  161550. `KML - Unsupported feature: ${node.nodeName}`
  161551. );
  161552. }
  161553. var RefreshMode = {
  161554. INTERVAL: 0,
  161555. EXPIRE: 1,
  161556. STOP: 2
  161557. };
  161558. function cleanupString(s2) {
  161559. if (!defined_default(s2) || s2.length === 0) {
  161560. return "";
  161561. }
  161562. const sFirst = s2[0];
  161563. if (sFirst === "&" || sFirst === "?") {
  161564. s2 = s2.substring(1);
  161565. }
  161566. return s2;
  161567. }
  161568. var zeroRectangle = new Rectangle_default();
  161569. var scratchCartographic11 = new Cartographic_default();
  161570. var scratchCartesian211 = new Cartesian2_default();
  161571. var scratchCartesian311 = new Cartesian3_default();
  161572. function processNetworkLinkQueryString(resource, camera, canvas, viewBoundScale, bbox2, ellipsoid) {
  161573. function fixLatitude(value) {
  161574. if (value < -Math_default.PI_OVER_TWO) {
  161575. return -Math_default.PI_OVER_TWO;
  161576. } else if (value > Math_default.PI_OVER_TWO) {
  161577. return Math_default.PI_OVER_TWO;
  161578. }
  161579. return value;
  161580. }
  161581. function fixLongitude(value) {
  161582. if (value > Math_default.PI) {
  161583. return value - Math_default.TWO_PI;
  161584. } else if (value < -Math_default.PI) {
  161585. return value + Math_default.TWO_PI;
  161586. }
  161587. return value;
  161588. }
  161589. let queryString = objectToQuery_default(resource.queryParameters);
  161590. queryString = queryString.replace(/%5B/g, "[").replace(/%5D/g, "]");
  161591. if (defined_default(camera) && camera._mode !== SceneMode_default.MORPHING) {
  161592. let centerCartesian2;
  161593. let centerCartographic;
  161594. bbox2 = defaultValue_default(bbox2, zeroRectangle);
  161595. if (defined_default(canvas)) {
  161596. scratchCartesian211.x = canvas.clientWidth * 0.5;
  161597. scratchCartesian211.y = canvas.clientHeight * 0.5;
  161598. centerCartesian2 = camera.pickEllipsoid(
  161599. scratchCartesian211,
  161600. ellipsoid,
  161601. scratchCartesian311
  161602. );
  161603. }
  161604. if (defined_default(centerCartesian2)) {
  161605. centerCartographic = ellipsoid.cartesianToCartographic(
  161606. centerCartesian2,
  161607. scratchCartographic11
  161608. );
  161609. } else {
  161610. centerCartographic = Rectangle_default.center(bbox2, scratchCartographic11);
  161611. centerCartesian2 = ellipsoid.cartographicToCartesian(centerCartographic);
  161612. }
  161613. if (defined_default(viewBoundScale) && !Math_default.equalsEpsilon(viewBoundScale, 1, Math_default.EPSILON9)) {
  161614. const newHalfWidth = bbox2.width * viewBoundScale * 0.5;
  161615. const newHalfHeight = bbox2.height * viewBoundScale * 0.5;
  161616. bbox2 = new Rectangle_default(
  161617. fixLongitude(centerCartographic.longitude - newHalfWidth),
  161618. fixLatitude(centerCartographic.latitude - newHalfHeight),
  161619. fixLongitude(centerCartographic.longitude + newHalfWidth),
  161620. fixLatitude(centerCartographic.latitude + newHalfHeight)
  161621. );
  161622. }
  161623. queryString = queryString.replace(
  161624. "[bboxWest]",
  161625. Math_default.toDegrees(bbox2.west).toString()
  161626. );
  161627. queryString = queryString.replace(
  161628. "[bboxSouth]",
  161629. Math_default.toDegrees(bbox2.south).toString()
  161630. );
  161631. queryString = queryString.replace(
  161632. "[bboxEast]",
  161633. Math_default.toDegrees(bbox2.east).toString()
  161634. );
  161635. queryString = queryString.replace(
  161636. "[bboxNorth]",
  161637. Math_default.toDegrees(bbox2.north).toString()
  161638. );
  161639. const lon = Math_default.toDegrees(centerCartographic.longitude).toString();
  161640. const lat = Math_default.toDegrees(centerCartographic.latitude).toString();
  161641. queryString = queryString.replace("[lookatLon]", lon);
  161642. queryString = queryString.replace("[lookatLat]", lat);
  161643. queryString = queryString.replace(
  161644. "[lookatTilt]",
  161645. Math_default.toDegrees(camera.pitch).toString()
  161646. );
  161647. queryString = queryString.replace(
  161648. "[lookatHeading]",
  161649. Math_default.toDegrees(camera.heading).toString()
  161650. );
  161651. queryString = queryString.replace(
  161652. "[lookatRange]",
  161653. Cartesian3_default.distance(camera.positionWC, centerCartesian2)
  161654. );
  161655. queryString = queryString.replace("[lookatTerrainLon]", lon);
  161656. queryString = queryString.replace("[lookatTerrainLat]", lat);
  161657. queryString = queryString.replace(
  161658. "[lookatTerrainAlt]",
  161659. centerCartographic.height.toString()
  161660. );
  161661. ellipsoid.cartesianToCartographic(camera.positionWC, scratchCartographic11);
  161662. queryString = queryString.replace(
  161663. "[cameraLon]",
  161664. Math_default.toDegrees(scratchCartographic11.longitude).toString()
  161665. );
  161666. queryString = queryString.replace(
  161667. "[cameraLat]",
  161668. Math_default.toDegrees(scratchCartographic11.latitude).toString()
  161669. );
  161670. queryString = queryString.replace(
  161671. "[cameraAlt]",
  161672. Math_default.toDegrees(scratchCartographic11.height).toString()
  161673. );
  161674. const frustum = camera.frustum;
  161675. const aspectRatio = frustum.aspectRatio;
  161676. let horizFov = "";
  161677. let vertFov = "";
  161678. if (defined_default(aspectRatio)) {
  161679. const fov = Math_default.toDegrees(frustum.fov);
  161680. if (aspectRatio > 1) {
  161681. horizFov = fov;
  161682. vertFov = fov / aspectRatio;
  161683. } else {
  161684. vertFov = fov;
  161685. horizFov = fov * aspectRatio;
  161686. }
  161687. }
  161688. queryString = queryString.replace("[horizFov]", horizFov.toString());
  161689. queryString = queryString.replace("[vertFov]", vertFov.toString());
  161690. } else {
  161691. queryString = queryString.replace("[bboxWest]", "-180");
  161692. queryString = queryString.replace("[bboxSouth]", "-90");
  161693. queryString = queryString.replace("[bboxEast]", "180");
  161694. queryString = queryString.replace("[bboxNorth]", "90");
  161695. queryString = queryString.replace("[lookatLon]", "");
  161696. queryString = queryString.replace("[lookatLat]", "");
  161697. queryString = queryString.replace("[lookatRange]", "");
  161698. queryString = queryString.replace("[lookatTilt]", "");
  161699. queryString = queryString.replace("[lookatHeading]", "");
  161700. queryString = queryString.replace("[lookatTerrainLon]", "");
  161701. queryString = queryString.replace("[lookatTerrainLat]", "");
  161702. queryString = queryString.replace("[lookatTerrainAlt]", "");
  161703. queryString = queryString.replace("[cameraLon]", "");
  161704. queryString = queryString.replace("[cameraLat]", "");
  161705. queryString = queryString.replace("[cameraAlt]", "");
  161706. queryString = queryString.replace("[horizFov]", "");
  161707. queryString = queryString.replace("[vertFov]", "");
  161708. }
  161709. if (defined_default(canvas)) {
  161710. queryString = queryString.replace("[horizPixels]", canvas.clientWidth);
  161711. queryString = queryString.replace("[vertPixels]", canvas.clientHeight);
  161712. } else {
  161713. queryString = queryString.replace("[horizPixels]", "");
  161714. queryString = queryString.replace("[vertPixels]", "");
  161715. }
  161716. queryString = queryString.replace("[terrainEnabled]", "1");
  161717. queryString = queryString.replace("[clientVersion]", "1");
  161718. queryString = queryString.replace("[kmlVersion]", "2.2");
  161719. queryString = queryString.replace("[clientName]", "Cesium");
  161720. queryString = queryString.replace("[language]", "English");
  161721. resource.setQueryParameters(queryToObject_default(queryString));
  161722. }
  161723. function processNetworkLink(dataSource, node, processingData, deferredLoading) {
  161724. const r2 = processFeature2(dataSource, node, processingData);
  161725. const networkEntity = r2.entity;
  161726. const sourceResource = processingData.sourceResource;
  161727. const uriResolver = processingData.uriResolver;
  161728. let link = queryFirstNode2(node, "Link", namespaces2.kml);
  161729. if (!defined_default(link)) {
  161730. link = queryFirstNode2(node, "Url", namespaces2.kml);
  161731. }
  161732. if (defined_default(link)) {
  161733. let href = queryStringValue2(link, "href", namespaces2.kml);
  161734. let viewRefreshMode;
  161735. let viewBoundScale;
  161736. if (defined_default(href)) {
  161737. let newSourceUri = href;
  161738. href = resolveHref(href, sourceResource, processingData.uriResolver);
  161739. if (/^data:/.test(href.getUrlComponent())) {
  161740. if (!/\.kmz/i.test(sourceResource.getUrlComponent())) {
  161741. newSourceUri = sourceResource.getDerivedResource({
  161742. url: newSourceUri
  161743. });
  161744. }
  161745. } else {
  161746. newSourceUri = href.clone();
  161747. viewRefreshMode = queryStringValue2(
  161748. link,
  161749. "viewRefreshMode",
  161750. namespaces2.kml
  161751. );
  161752. viewBoundScale = defaultValue_default(
  161753. queryStringValue2(link, "viewBoundScale", namespaces2.kml),
  161754. 1
  161755. );
  161756. const defaultViewFormat = viewRefreshMode === "onStop" ? "BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]" : "";
  161757. const viewFormat = defaultValue_default(
  161758. queryStringValue2(link, "viewFormat", namespaces2.kml),
  161759. defaultViewFormat
  161760. );
  161761. const httpQuery = queryStringValue2(link, "httpQuery", namespaces2.kml);
  161762. if (defined_default(viewFormat)) {
  161763. href.setQueryParameters(queryToObject_default(cleanupString(viewFormat)));
  161764. }
  161765. if (defined_default(httpQuery)) {
  161766. href.setQueryParameters(queryToObject_default(cleanupString(httpQuery)));
  161767. }
  161768. const ellipsoid = dataSource._ellipsoid;
  161769. processNetworkLinkQueryString(
  161770. href,
  161771. dataSource.camera,
  161772. dataSource.canvas,
  161773. viewBoundScale,
  161774. dataSource._lastCameraView.bbox,
  161775. ellipsoid
  161776. );
  161777. }
  161778. const options = {
  161779. sourceUri: newSourceUri,
  161780. uriResolver,
  161781. context: networkEntity.id,
  161782. screenOverlayContainer: processingData.screenOverlayContainer
  161783. };
  161784. const networkLinkCollection = new EntityCollection_default();
  161785. const promise = load4(dataSource, networkLinkCollection, href, options).then(function(rootElement) {
  161786. const entities = dataSource._entityCollection;
  161787. const newEntities = networkLinkCollection.values;
  161788. entities.suspendEvents();
  161789. for (let i2 = 0; i2 < newEntities.length; i2++) {
  161790. const newEntity = newEntities[i2];
  161791. if (!defined_default(newEntity.parent)) {
  161792. newEntity.parent = networkEntity;
  161793. mergeAvailabilityWithParent(newEntity);
  161794. }
  161795. entities.add(newEntity);
  161796. }
  161797. entities.resumeEvents();
  161798. const refreshMode = queryStringValue2(
  161799. link,
  161800. "refreshMode",
  161801. namespaces2.kml
  161802. );
  161803. let refreshInterval = defaultValue_default(
  161804. queryNumericValue2(link, "refreshInterval", namespaces2.kml),
  161805. 0
  161806. );
  161807. if (refreshMode === "onInterval" && refreshInterval > 0 || refreshMode === "onExpire" || viewRefreshMode === "onStop") {
  161808. const networkLinkControl = queryFirstNode2(
  161809. rootElement,
  161810. "NetworkLinkControl",
  161811. namespaces2.kml
  161812. );
  161813. const hasNetworkLinkControl = defined_default(networkLinkControl);
  161814. const now = JulianDate_default.now();
  161815. const networkLinkInfo = {
  161816. id: createGuid_default(),
  161817. href,
  161818. cookie: {},
  161819. lastUpdated: now,
  161820. updating: false,
  161821. entity: networkEntity,
  161822. viewBoundScale,
  161823. needsUpdate: false,
  161824. cameraUpdateTime: now
  161825. };
  161826. let minRefreshPeriod = 0;
  161827. if (hasNetworkLinkControl) {
  161828. networkLinkInfo.cookie = queryToObject_default(
  161829. defaultValue_default(
  161830. queryStringValue2(
  161831. networkLinkControl,
  161832. "cookie",
  161833. namespaces2.kml
  161834. ),
  161835. ""
  161836. )
  161837. );
  161838. minRefreshPeriod = defaultValue_default(
  161839. queryNumericValue2(
  161840. networkLinkControl,
  161841. "minRefreshPeriod",
  161842. namespaces2.kml
  161843. ),
  161844. 0
  161845. );
  161846. }
  161847. if (refreshMode === "onInterval") {
  161848. if (hasNetworkLinkControl) {
  161849. refreshInterval = Math.max(minRefreshPeriod, refreshInterval);
  161850. }
  161851. networkLinkInfo.refreshMode = RefreshMode.INTERVAL;
  161852. networkLinkInfo.time = refreshInterval;
  161853. } else if (refreshMode === "onExpire") {
  161854. let expires;
  161855. if (hasNetworkLinkControl) {
  161856. expires = queryStringValue2(
  161857. networkLinkControl,
  161858. "expires",
  161859. namespaces2.kml
  161860. );
  161861. }
  161862. if (defined_default(expires)) {
  161863. try {
  161864. const date = JulianDate_default.fromIso8601(expires);
  161865. const diff = JulianDate_default.secondsDifference(date, now);
  161866. if (diff > 0 && diff < minRefreshPeriod) {
  161867. JulianDate_default.addSeconds(now, minRefreshPeriod, date);
  161868. }
  161869. networkLinkInfo.refreshMode = RefreshMode.EXPIRE;
  161870. networkLinkInfo.time = date;
  161871. } catch (e2) {
  161872. oneTimeWarning_default(
  161873. "kml-refreshMode-onInterval-onExpire",
  161874. "KML - NetworkLinkControl expires is not a valid date"
  161875. );
  161876. }
  161877. } else {
  161878. oneTimeWarning_default(
  161879. "kml-refreshMode-onExpire",
  161880. "KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element"
  161881. );
  161882. }
  161883. } else if (defined_default(dataSource.camera)) {
  161884. networkLinkInfo.refreshMode = RefreshMode.STOP;
  161885. networkLinkInfo.time = defaultValue_default(
  161886. queryNumericValue2(link, "viewRefreshTime", namespaces2.kml),
  161887. 0
  161888. );
  161889. } else {
  161890. oneTimeWarning_default(
  161891. "kml-refrehMode-onStop-noCamera",
  161892. "A NetworkLink with viewRefreshMode=onStop requires the `camera` property to be defined."
  161893. );
  161894. }
  161895. if (defined_default(networkLinkInfo.refreshMode)) {
  161896. dataSource._networkLinks.set(networkLinkInfo.id, networkLinkInfo);
  161897. }
  161898. } else if (viewRefreshMode === "onRegion") {
  161899. oneTimeWarning_default(
  161900. "kml-refrehMode-onRegion",
  161901. "KML - Unsupported viewRefreshMode: onRegion"
  161902. );
  161903. }
  161904. }).catch(function(error) {
  161905. oneTimeWarning_default(`An error occured during loading ${href.url}`);
  161906. dataSource._error.raiseEvent(dataSource, error);
  161907. });
  161908. deferredLoading.addPromise(promise);
  161909. }
  161910. }
  161911. }
  161912. function processFeatureNode(dataSource, node, processingData, deferredLoading) {
  161913. const featureProcessor = featureTypes[node.localName];
  161914. if (defined_default(featureProcessor)) {
  161915. return featureProcessor(dataSource, node, processingData, deferredLoading);
  161916. }
  161917. return processUnsupportedFeature(
  161918. dataSource,
  161919. node,
  161920. processingData,
  161921. deferredLoading
  161922. );
  161923. }
  161924. function loadKml(dataSource, entityCollection, kml, sourceResource, uriResolver, screenOverlayContainer, context) {
  161925. entityCollection.removeAll();
  161926. const documentElement = kml.documentElement;
  161927. const document2 = documentElement.localName === "Document" ? documentElement : queryFirstNode2(documentElement, "Document", namespaces2.kml);
  161928. let name = queryStringValue2(document2, "name", namespaces2.kml);
  161929. if (!defined_default(name)) {
  161930. name = getFilenameFromUri_default(sourceResource.getUrlComponent());
  161931. }
  161932. if (!defined_default(dataSource._name)) {
  161933. dataSource._name = name;
  161934. }
  161935. const deferredLoading = new KmlDataSource._DeferredLoading(dataSource);
  161936. const styleCollection = new EntityCollection_default(dataSource);
  161937. return Promise.all(
  161938. processStyles(
  161939. dataSource,
  161940. kml,
  161941. styleCollection,
  161942. sourceResource,
  161943. false,
  161944. uriResolver
  161945. )
  161946. ).then(function() {
  161947. let element = kml.documentElement;
  161948. if (element.localName === "kml") {
  161949. const childNodes = element.childNodes;
  161950. for (let i2 = 0; i2 < childNodes.length; i2++) {
  161951. const tmp2 = childNodes[i2];
  161952. if (defined_default(featureTypes[tmp2.localName])) {
  161953. element = tmp2;
  161954. break;
  161955. }
  161956. }
  161957. }
  161958. const processingData = {
  161959. parentEntity: void 0,
  161960. entityCollection,
  161961. styleCollection,
  161962. sourceResource,
  161963. uriResolver,
  161964. context,
  161965. screenOverlayContainer
  161966. };
  161967. entityCollection.suspendEvents();
  161968. processFeatureNode(dataSource, element, processingData, deferredLoading);
  161969. entityCollection.resumeEvents();
  161970. return deferredLoading.wait().then(function() {
  161971. return kml.documentElement;
  161972. });
  161973. });
  161974. }
  161975. function loadKmz(dataSource, entityCollection, blob, sourceResource, screenOverlayContainer) {
  161976. const zWorkerUrl = buildModuleUrl_default("ThirdParty/Workers/z-worker-pako.js");
  161977. zipNoWorker.configure({
  161978. workerScripts: {
  161979. deflate: [zWorkerUrl, "./pako_deflate.min.js"],
  161980. inflate: [zWorkerUrl, "./pako_inflate.min.js"]
  161981. }
  161982. });
  161983. const reader = new zipNoWorker.ZipReader(new zipNoWorker.BlobReader(blob));
  161984. return Promise.resolve(reader.getEntries()).then(function(entries) {
  161985. const promises = [];
  161986. const uriResolver = {};
  161987. let docEntry;
  161988. for (let i2 = 0; i2 < entries.length; i2++) {
  161989. const entry = entries[i2];
  161990. if (!entry.directory) {
  161991. if (/\.kml$/i.test(entry.filename)) {
  161992. if (!defined_default(docEntry) || !/\//i.test(entry.filename)) {
  161993. if (defined_default(docEntry)) {
  161994. promises.push(loadDataUriFromZip(docEntry, uriResolver));
  161995. }
  161996. docEntry = entry;
  161997. } else {
  161998. promises.push(loadDataUriFromZip(entry, uriResolver));
  161999. }
  162000. } else {
  162001. promises.push(loadDataUriFromZip(entry, uriResolver));
  162002. }
  162003. }
  162004. }
  162005. if (defined_default(docEntry)) {
  162006. promises.push(loadXmlFromZip(docEntry, uriResolver));
  162007. }
  162008. return Promise.all(promises).then(function() {
  162009. reader.close();
  162010. if (!defined_default(uriResolver.kml)) {
  162011. throw new RuntimeError_default("KMZ file does not contain a KML document.");
  162012. }
  162013. uriResolver.keys = Object.keys(uriResolver);
  162014. return loadKml(
  162015. dataSource,
  162016. entityCollection,
  162017. uriResolver.kml,
  162018. sourceResource,
  162019. uriResolver,
  162020. screenOverlayContainer
  162021. );
  162022. });
  162023. });
  162024. }
  162025. function load4(dataSource, entityCollection, data, options) {
  162026. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  162027. let sourceUri = options.sourceUri;
  162028. const uriResolver = options.uriResolver;
  162029. const context = options.context;
  162030. let screenOverlayContainer = options.screenOverlayContainer;
  162031. let promise = data;
  162032. if (typeof data === "string" || data instanceof Resource_default) {
  162033. data = Resource_default.createIfNeeded(data);
  162034. promise = data.fetchBlob();
  162035. sourceUri = defaultValue_default(sourceUri, data.clone());
  162036. const resourceCredits = dataSource._resourceCredits;
  162037. const credits = data.credits;
  162038. if (defined_default(credits)) {
  162039. const length3 = credits.length;
  162040. for (let i2 = 0; i2 < length3; i2++) {
  162041. resourceCredits.push(credits[i2]);
  162042. }
  162043. }
  162044. } else {
  162045. sourceUri = defaultValue_default(sourceUri, Resource_default.DEFAULT.clone());
  162046. }
  162047. sourceUri = Resource_default.createIfNeeded(sourceUri);
  162048. if (defined_default(screenOverlayContainer)) {
  162049. screenOverlayContainer = getElement_default(screenOverlayContainer);
  162050. }
  162051. return Promise.resolve(promise).then(function(dataToLoad) {
  162052. if (dataToLoad instanceof Blob) {
  162053. return isZipFile(dataToLoad).then(function(isZip) {
  162054. if (isZip) {
  162055. return loadKmz(
  162056. dataSource,
  162057. entityCollection,
  162058. dataToLoad,
  162059. sourceUri,
  162060. screenOverlayContainer
  162061. );
  162062. }
  162063. return readBlobAsText2(dataToLoad).then(function(text2) {
  162064. text2 = insertNamespaces(text2);
  162065. text2 = removeDuplicateNamespaces(text2);
  162066. let kml;
  162067. let error;
  162068. try {
  162069. kml = parser2.parseFromString(text2, "application/xml");
  162070. } catch (e2) {
  162071. error = e2.toString();
  162072. }
  162073. if (defined_default(error) || kml.body || kml.documentElement.tagName === "parsererror") {
  162074. let msg = defined_default(error) ? error : kml.documentElement.firstChild.nodeValue;
  162075. if (!msg) {
  162076. msg = kml.body.innerText;
  162077. }
  162078. throw new RuntimeError_default(msg);
  162079. }
  162080. return loadKml(
  162081. dataSource,
  162082. entityCollection,
  162083. kml,
  162084. sourceUri,
  162085. uriResolver,
  162086. screenOverlayContainer,
  162087. context
  162088. );
  162089. });
  162090. });
  162091. }
  162092. return loadKml(
  162093. dataSource,
  162094. entityCollection,
  162095. dataToLoad,
  162096. sourceUri,
  162097. uriResolver,
  162098. screenOverlayContainer,
  162099. context
  162100. );
  162101. }).catch(function(error) {
  162102. dataSource._error.raiseEvent(dataSource, error);
  162103. console.log(error);
  162104. return Promise.reject(error);
  162105. });
  162106. }
  162107. function KmlDataSource(options) {
  162108. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  162109. const camera = options.camera;
  162110. const canvas = options.canvas;
  162111. this._changed = new Event_default();
  162112. this._error = new Event_default();
  162113. this._loading = new Event_default();
  162114. this._refresh = new Event_default();
  162115. this._unsupportedNode = new Event_default();
  162116. this._clock = void 0;
  162117. this._entityCollection = new EntityCollection_default(this);
  162118. this._name = void 0;
  162119. this._isLoading = false;
  162120. this._pinBuilder = new PinBuilder_default();
  162121. this._networkLinks = new AssociativeArray_default();
  162122. this._entityCluster = new EntityCluster_default();
  162123. this.canvas = canvas;
  162124. this.camera = camera;
  162125. this._lastCameraView = {
  162126. position: defined_default(camera) ? Cartesian3_default.clone(camera.positionWC) : void 0,
  162127. direction: defined_default(camera) ? Cartesian3_default.clone(camera.directionWC) : void 0,
  162128. up: defined_default(camera) ? Cartesian3_default.clone(camera.upWC) : void 0,
  162129. bbox: defined_default(camera) ? camera.computeViewRectangle() : Rectangle_default.clone(Rectangle_default.MAX_VALUE)
  162130. };
  162131. this._ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84);
  162132. let credit = options.credit;
  162133. if (typeof credit === "string") {
  162134. credit = new Credit_default(credit);
  162135. }
  162136. this._credit = credit;
  162137. this._resourceCredits = [];
  162138. this._kmlTours = [];
  162139. this._screenOverlays = [];
  162140. }
  162141. KmlDataSource.load = function(data, options) {
  162142. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  162143. const dataSource = new KmlDataSource(options);
  162144. return dataSource.load(data, options);
  162145. };
  162146. Object.defineProperties(KmlDataSource.prototype, {
  162147. name: {
  162148. get: function() {
  162149. return this._name;
  162150. },
  162151. set: function(value) {
  162152. if (this._name !== value) {
  162153. this._name = value;
  162154. this._changed.raiseEvent(this);
  162155. }
  162156. }
  162157. },
  162158. clock: {
  162159. get: function() {
  162160. return this._clock;
  162161. }
  162162. },
  162163. entities: {
  162164. get: function() {
  162165. return this._entityCollection;
  162166. }
  162167. },
  162168. isLoading: {
  162169. get: function() {
  162170. return this._isLoading;
  162171. }
  162172. },
  162173. changedEvent: {
  162174. get: function() {
  162175. return this._changed;
  162176. }
  162177. },
  162178. errorEvent: {
  162179. get: function() {
  162180. return this._error;
  162181. }
  162182. },
  162183. loadingEvent: {
  162184. get: function() {
  162185. return this._loading;
  162186. }
  162187. },
  162188. refreshEvent: {
  162189. get: function() {
  162190. return this._refresh;
  162191. }
  162192. },
  162193. unsupportedNodeEvent: {
  162194. get: function() {
  162195. return this._unsupportedNode;
  162196. }
  162197. },
  162198. show: {
  162199. get: function() {
  162200. return this._entityCollection.show;
  162201. },
  162202. set: function(value) {
  162203. this._entityCollection.show = value;
  162204. }
  162205. },
  162206. clustering: {
  162207. get: function() {
  162208. return this._entityCluster;
  162209. },
  162210. set: function(value) {
  162211. if (!defined_default(value)) {
  162212. throw new DeveloperError_default("value must be defined.");
  162213. }
  162214. this._entityCluster = value;
  162215. }
  162216. },
  162217. credit: {
  162218. get: function() {
  162219. return this._credit;
  162220. }
  162221. },
  162222. kmlTours: {
  162223. get: function() {
  162224. return this._kmlTours;
  162225. }
  162226. }
  162227. });
  162228. KmlDataSource.prototype.load = function(data, options) {
  162229. if (!defined_default(data)) {
  162230. throw new DeveloperError_default("data is required.");
  162231. }
  162232. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  162233. DataSource_default.setLoading(this, true);
  162234. const oldName = this._name;
  162235. this._name = void 0;
  162236. this._clampToGround = defaultValue_default(options.clampToGround, false);
  162237. const that = this;
  162238. return load4(this, this._entityCollection, data, options).then(function() {
  162239. let clock;
  162240. const availability = that._entityCollection.computeAvailability();
  162241. let start = availability.start;
  162242. let stop2 = availability.stop;
  162243. const isMinStart = JulianDate_default.equals(start, Iso8601_default.MINIMUM_VALUE);
  162244. const isMaxStop = JulianDate_default.equals(stop2, Iso8601_default.MAXIMUM_VALUE);
  162245. if (!isMinStart || !isMaxStop) {
  162246. let date;
  162247. if (isMinStart) {
  162248. date = new Date();
  162249. date.setHours(0, 0, 0, 0);
  162250. start = JulianDate_default.fromDate(date);
  162251. }
  162252. if (isMaxStop) {
  162253. date = new Date();
  162254. date.setHours(24, 0, 0, 0);
  162255. stop2 = JulianDate_default.fromDate(date);
  162256. }
  162257. clock = new DataSourceClock_default();
  162258. clock.startTime = start;
  162259. clock.stopTime = stop2;
  162260. clock.currentTime = JulianDate_default.clone(start);
  162261. clock.clockRange = ClockRange_default.LOOP_STOP;
  162262. clock.clockStep = ClockStep_default.SYSTEM_CLOCK_MULTIPLIER;
  162263. clock.multiplier = Math.round(
  162264. Math.min(
  162265. Math.max(JulianDate_default.secondsDifference(stop2, start) / 60, 1),
  162266. 31556900
  162267. )
  162268. );
  162269. }
  162270. let changed = false;
  162271. if (clock !== that._clock) {
  162272. that._clock = clock;
  162273. changed = true;
  162274. }
  162275. if (oldName !== that._name) {
  162276. changed = true;
  162277. }
  162278. if (changed) {
  162279. that._changed.raiseEvent(that);
  162280. }
  162281. DataSource_default.setLoading(that, false);
  162282. return that;
  162283. }).catch(function(error) {
  162284. DataSource_default.setLoading(that, false);
  162285. that._error.raiseEvent(that, error);
  162286. console.log(error);
  162287. return Promise.reject(error);
  162288. });
  162289. };
  162290. KmlDataSource.prototype.destroy = function() {
  162291. while (this._screenOverlays.length > 0) {
  162292. const elem = this._screenOverlays.pop();
  162293. elem.remove();
  162294. }
  162295. };
  162296. function mergeAvailabilityWithParent(child) {
  162297. const parent = child.parent;
  162298. if (defined_default(parent)) {
  162299. const parentAvailability = parent.availability;
  162300. if (defined_default(parentAvailability)) {
  162301. const childAvailability = child.availability;
  162302. if (defined_default(childAvailability)) {
  162303. childAvailability.intersect(parentAvailability);
  162304. } else {
  162305. child.availability = parentAvailability;
  162306. }
  162307. }
  162308. }
  162309. }
  162310. function getNetworkLinkUpdateCallback(dataSource, networkLink, newEntityCollection, networkLinks, processedHref) {
  162311. return function(rootElement) {
  162312. if (!networkLinks.contains(networkLink.id)) {
  162313. return;
  162314. }
  162315. let remove4 = false;
  162316. const networkLinkControl = queryFirstNode2(
  162317. rootElement,
  162318. "NetworkLinkControl",
  162319. namespaces2.kml
  162320. );
  162321. const hasNetworkLinkControl = defined_default(networkLinkControl);
  162322. let minRefreshPeriod = 0;
  162323. if (hasNetworkLinkControl) {
  162324. if (defined_default(queryFirstNode2(networkLinkControl, "Update", namespaces2.kml))) {
  162325. oneTimeWarning_default(
  162326. "kml-networkLinkControl-update",
  162327. "KML - NetworkLinkControl updates aren't supported."
  162328. );
  162329. networkLink.updating = false;
  162330. networkLinks.remove(networkLink.id);
  162331. return;
  162332. }
  162333. networkLink.cookie = queryToObject_default(
  162334. defaultValue_default(
  162335. queryStringValue2(networkLinkControl, "cookie", namespaces2.kml),
  162336. ""
  162337. )
  162338. );
  162339. minRefreshPeriod = defaultValue_default(
  162340. queryNumericValue2(
  162341. networkLinkControl,
  162342. "minRefreshPeriod",
  162343. namespaces2.kml
  162344. ),
  162345. 0
  162346. );
  162347. }
  162348. const now = JulianDate_default.now();
  162349. const refreshMode = networkLink.refreshMode;
  162350. if (refreshMode === RefreshMode.INTERVAL) {
  162351. if (defined_default(networkLinkControl)) {
  162352. networkLink.time = Math.max(minRefreshPeriod, networkLink.time);
  162353. }
  162354. } else if (refreshMode === RefreshMode.EXPIRE) {
  162355. let expires;
  162356. if (defined_default(networkLinkControl)) {
  162357. expires = queryStringValue2(
  162358. networkLinkControl,
  162359. "expires",
  162360. namespaces2.kml
  162361. );
  162362. }
  162363. if (defined_default(expires)) {
  162364. try {
  162365. const date = JulianDate_default.fromIso8601(expires);
  162366. const diff = JulianDate_default.secondsDifference(date, now);
  162367. if (diff > 0 && diff < minRefreshPeriod) {
  162368. JulianDate_default.addSeconds(now, minRefreshPeriod, date);
  162369. }
  162370. networkLink.time = date;
  162371. } catch (e2) {
  162372. oneTimeWarning_default(
  162373. "kml-networkLinkControl-expires",
  162374. "KML - NetworkLinkControl expires is not a valid date"
  162375. );
  162376. remove4 = true;
  162377. }
  162378. } else {
  162379. oneTimeWarning_default(
  162380. "kml-refreshMode-onExpire",
  162381. "KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element"
  162382. );
  162383. remove4 = true;
  162384. }
  162385. }
  162386. const networkLinkEntity = networkLink.entity;
  162387. const entityCollection = dataSource._entityCollection;
  162388. const newEntities = newEntityCollection.values;
  162389. function removeChildren(entity) {
  162390. entityCollection.remove(entity);
  162391. const children = entity._children;
  162392. const count = children.length;
  162393. for (let i3 = 0; i3 < count; ++i3) {
  162394. removeChildren(children[i3]);
  162395. }
  162396. }
  162397. entityCollection.suspendEvents();
  162398. const entitiesCopy = entityCollection.values.slice();
  162399. let i2;
  162400. for (i2 = 0; i2 < entitiesCopy.length; ++i2) {
  162401. const entityToRemove = entitiesCopy[i2];
  162402. if (entityToRemove.parent === networkLinkEntity) {
  162403. entityToRemove.parent = void 0;
  162404. removeChildren(entityToRemove);
  162405. }
  162406. }
  162407. entityCollection.resumeEvents();
  162408. entityCollection.suspendEvents();
  162409. for (i2 = 0; i2 < newEntities.length; i2++) {
  162410. const newEntity = newEntities[i2];
  162411. if (!defined_default(newEntity.parent)) {
  162412. newEntity.parent = networkLinkEntity;
  162413. mergeAvailabilityWithParent(newEntity);
  162414. }
  162415. entityCollection.add(newEntity);
  162416. }
  162417. entityCollection.resumeEvents();
  162418. if (remove4) {
  162419. networkLinks.remove(networkLink.id);
  162420. } else {
  162421. networkLink.lastUpdated = now;
  162422. }
  162423. const availability = entityCollection.computeAvailability();
  162424. const start = availability.start;
  162425. const stop2 = availability.stop;
  162426. const isMinStart = JulianDate_default.equals(start, Iso8601_default.MINIMUM_VALUE);
  162427. const isMaxStop = JulianDate_default.equals(stop2, Iso8601_default.MAXIMUM_VALUE);
  162428. if (!isMinStart || !isMaxStop) {
  162429. const clock = dataSource._clock;
  162430. if (clock.startTime !== start || clock.stopTime !== stop2) {
  162431. clock.startTime = start;
  162432. clock.stopTime = stop2;
  162433. dataSource._changed.raiseEvent(dataSource);
  162434. }
  162435. }
  162436. networkLink.updating = false;
  162437. networkLink.needsUpdate = false;
  162438. dataSource._refresh.raiseEvent(
  162439. dataSource,
  162440. processedHref.getUrlComponent(true)
  162441. );
  162442. };
  162443. }
  162444. var entitiesToIgnore = new AssociativeArray_default();
  162445. KmlDataSource.prototype.update = function(time) {
  162446. const networkLinks = this._networkLinks;
  162447. if (networkLinks.length === 0) {
  162448. return true;
  162449. }
  162450. const now = JulianDate_default.now();
  162451. const that = this;
  162452. entitiesToIgnore.removeAll();
  162453. function recurseIgnoreEntities(entity) {
  162454. const children = entity._children;
  162455. const count = children.length;
  162456. for (let i2 = 0; i2 < count; ++i2) {
  162457. const child = children[i2];
  162458. entitiesToIgnore.set(child.id, child);
  162459. recurseIgnoreEntities(child);
  162460. }
  162461. }
  162462. let cameraViewUpdate = false;
  162463. const lastCameraView = this._lastCameraView;
  162464. const camera = this.camera;
  162465. if (defined_default(camera) && !(camera.positionWC.equalsEpsilon(
  162466. lastCameraView.position,
  162467. Math_default.EPSILON7
  162468. ) && camera.directionWC.equalsEpsilon(
  162469. lastCameraView.direction,
  162470. Math_default.EPSILON7
  162471. ) && camera.upWC.equalsEpsilon(lastCameraView.up, Math_default.EPSILON7))) {
  162472. lastCameraView.position = Cartesian3_default.clone(camera.positionWC);
  162473. lastCameraView.direction = Cartesian3_default.clone(camera.directionWC);
  162474. lastCameraView.up = Cartesian3_default.clone(camera.upWC);
  162475. lastCameraView.bbox = camera.computeViewRectangle();
  162476. cameraViewUpdate = true;
  162477. }
  162478. const newNetworkLinks = new AssociativeArray_default();
  162479. let changed = false;
  162480. networkLinks.values.forEach(function(networkLink) {
  162481. const entity = networkLink.entity;
  162482. if (entitiesToIgnore.contains(entity.id)) {
  162483. return;
  162484. }
  162485. if (!networkLink.updating) {
  162486. let doUpdate = false;
  162487. if (networkLink.refreshMode === RefreshMode.INTERVAL) {
  162488. if (JulianDate_default.secondsDifference(now, networkLink.lastUpdated) > networkLink.time) {
  162489. doUpdate = true;
  162490. }
  162491. } else if (networkLink.refreshMode === RefreshMode.EXPIRE) {
  162492. if (JulianDate_default.greaterThan(now, networkLink.time)) {
  162493. doUpdate = true;
  162494. }
  162495. } else if (networkLink.refreshMode === RefreshMode.STOP) {
  162496. if (cameraViewUpdate) {
  162497. networkLink.needsUpdate = true;
  162498. networkLink.cameraUpdateTime = now;
  162499. }
  162500. if (networkLink.needsUpdate && JulianDate_default.secondsDifference(now, networkLink.cameraUpdateTime) >= networkLink.time) {
  162501. doUpdate = true;
  162502. }
  162503. }
  162504. if (doUpdate) {
  162505. recurseIgnoreEntities(entity);
  162506. networkLink.updating = true;
  162507. const newEntityCollection = new EntityCollection_default();
  162508. const href = networkLink.href.clone();
  162509. href.setQueryParameters(networkLink.cookie);
  162510. const ellipsoid = defaultValue_default(that._ellipsoid, Ellipsoid_default.WGS84);
  162511. processNetworkLinkQueryString(
  162512. href,
  162513. that.camera,
  162514. that.canvas,
  162515. networkLink.viewBoundScale,
  162516. lastCameraView.bbox,
  162517. ellipsoid
  162518. );
  162519. load4(that, newEntityCollection, href, {
  162520. context: entity.id
  162521. }).then(
  162522. getNetworkLinkUpdateCallback(
  162523. that,
  162524. networkLink,
  162525. newEntityCollection,
  162526. newNetworkLinks,
  162527. href
  162528. )
  162529. ).catch(function(error) {
  162530. const msg = `NetworkLink ${networkLink.href} refresh failed: ${error}`;
  162531. console.log(msg);
  162532. that._error.raiseEvent(that, msg);
  162533. });
  162534. changed = true;
  162535. }
  162536. }
  162537. newNetworkLinks.set(networkLink.id, networkLink);
  162538. });
  162539. if (changed) {
  162540. this._networkLinks = newNetworkLinks;
  162541. this._changed.raiseEvent(this);
  162542. }
  162543. return true;
  162544. };
  162545. function KmlFeatureData() {
  162546. this.author = {
  162547. name: void 0,
  162548. uri: void 0,
  162549. email: void 0
  162550. };
  162551. this.link = {
  162552. href: void 0,
  162553. hreflang: void 0,
  162554. rel: void 0,
  162555. type: void 0,
  162556. title: void 0,
  162557. length: void 0
  162558. };
  162559. this.address = void 0;
  162560. this.phoneNumber = void 0;
  162561. this.snippet = void 0;
  162562. this.extendedData = void 0;
  162563. }
  162564. KmlDataSource._DeferredLoading = DeferredLoading;
  162565. KmlDataSource._getTimestamp = getTimestamp_default;
  162566. var KmlDataSource_default = KmlDataSource;
  162567. // node_modules/cesium/Source/DataSources/Visualizer.js
  162568. function Visualizer() {
  162569. DeveloperError_default.throwInstantiationError();
  162570. }
  162571. Visualizer.prototype.update = DeveloperError_default.throwInstantiationError;
  162572. Visualizer.prototype.getBoundingSphere = DeveloperError_default.throwInstantiationError;
  162573. Visualizer.prototype.isDestroyed = DeveloperError_default.throwInstantiationError;
  162574. Visualizer.prototype.destroy = DeveloperError_default.throwInstantiationError;
  162575. var Visualizer_default = Visualizer;
  162576. // node_modules/cesium/Source/DataSources/exportKml.js
  162577. var BILLBOARD_SIZE3 = 32;
  162578. var kmlNamespace = "http://www.opengis.net/kml/2.2";
  162579. var gxNamespace = "http://www.google.com/kml/ext/2.2";
  162580. var xmlnsNamespace = "http://www.w3.org/2000/xmlns/";
  162581. function ExternalFileHandler(modelCallback) {
  162582. this._files = {};
  162583. this._promises = [];
  162584. this._count = 0;
  162585. this._modelCallback = modelCallback;
  162586. }
  162587. var imageTypeRegex = /^data:image\/([^,;]+)/;
  162588. ExternalFileHandler.prototype.texture = function(texture) {
  162589. const that = this;
  162590. let filename;
  162591. if (typeof texture === "string" || texture instanceof Resource_default) {
  162592. texture = Resource_default.createIfNeeded(texture);
  162593. if (!texture.isDataUri) {
  162594. return texture.url;
  162595. }
  162596. const regexResult = texture.url.match(imageTypeRegex);
  162597. filename = `texture_${++this._count}`;
  162598. if (defined_default(regexResult)) {
  162599. filename += `.${regexResult[1]}`;
  162600. }
  162601. const promise = texture.fetchBlob().then(function(blob) {
  162602. that._files[filename] = blob;
  162603. });
  162604. this._promises.push(promise);
  162605. return filename;
  162606. }
  162607. if (texture instanceof HTMLCanvasElement) {
  162608. const deferred = defer_default();
  162609. this._promises.push(deferred.promise);
  162610. filename = `texture_${++this._count}.png`;
  162611. texture.toBlob(function(blob) {
  162612. that._files[filename] = blob;
  162613. deferred.resolve();
  162614. });
  162615. return filename;
  162616. }
  162617. return "";
  162618. };
  162619. function getModelBlobHander(that, filename) {
  162620. return function(blob) {
  162621. that._files[filename] = blob;
  162622. };
  162623. }
  162624. ExternalFileHandler.prototype.model = function(model, time) {
  162625. const modelCallback = this._modelCallback;
  162626. if (!defined_default(modelCallback)) {
  162627. throw new RuntimeError_default(
  162628. "Encountered a model entity while exporting to KML, but no model callback was supplied."
  162629. );
  162630. }
  162631. const externalFiles = {};
  162632. const url2 = modelCallback(model, time, externalFiles);
  162633. for (const filename in externalFiles) {
  162634. if (externalFiles.hasOwnProperty(filename)) {
  162635. const promise = Promise.resolve(externalFiles[filename]);
  162636. this._promises.push(promise);
  162637. promise.then(getModelBlobHander(this, filename));
  162638. }
  162639. }
  162640. return url2;
  162641. };
  162642. Object.defineProperties(ExternalFileHandler.prototype, {
  162643. promise: {
  162644. get: function() {
  162645. return Promise.all(this._promises);
  162646. }
  162647. },
  162648. files: {
  162649. get: function() {
  162650. return this._files;
  162651. }
  162652. }
  162653. });
  162654. function ValueGetter(time) {
  162655. this._time = time;
  162656. }
  162657. ValueGetter.prototype.get = function(property, defaultVal, result) {
  162658. let value;
  162659. if (defined_default(property)) {
  162660. value = defined_default(property.getValue) ? property.getValue(this._time, result) : property;
  162661. }
  162662. return defaultValue_default(value, defaultVal);
  162663. };
  162664. ValueGetter.prototype.getColor = function(property, defaultVal) {
  162665. const result = this.get(property, defaultVal);
  162666. if (defined_default(result)) {
  162667. return colorToString(result);
  162668. }
  162669. };
  162670. ValueGetter.prototype.getMaterialType = function(property) {
  162671. if (!defined_default(property)) {
  162672. return;
  162673. }
  162674. return property.getType(this._time);
  162675. };
  162676. function StyleCache() {
  162677. this._ids = {};
  162678. this._styles = {};
  162679. this._count = 0;
  162680. }
  162681. StyleCache.prototype.get = function(element) {
  162682. const ids = this._ids;
  162683. const key = element.innerHTML;
  162684. if (defined_default(ids[key])) {
  162685. return ids[key];
  162686. }
  162687. let styleId = `style-${++this._count}`;
  162688. element.setAttribute("id", styleId);
  162689. styleId = `#${styleId}`;
  162690. ids[key] = styleId;
  162691. this._styles[key] = element;
  162692. return styleId;
  162693. };
  162694. StyleCache.prototype.save = function(parentElement) {
  162695. const styles = this._styles;
  162696. const firstElement = parentElement.childNodes[0];
  162697. for (const key in styles) {
  162698. if (styles.hasOwnProperty(key)) {
  162699. parentElement.insertBefore(styles[key], firstElement);
  162700. }
  162701. }
  162702. };
  162703. function IdManager() {
  162704. this._ids = {};
  162705. }
  162706. IdManager.prototype.get = function(id) {
  162707. if (!defined_default(id)) {
  162708. return this.get(createGuid_default());
  162709. }
  162710. const ids = this._ids;
  162711. if (!defined_default(ids[id])) {
  162712. ids[id] = 0;
  162713. return id;
  162714. }
  162715. return `${id.toString()}-${++ids[id]}`;
  162716. };
  162717. function exportKml(options) {
  162718. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  162719. const entities = options.entities;
  162720. const kmz = defaultValue_default(options.kmz, false);
  162721. if (!defined_default(entities)) {
  162722. throw new DeveloperError_default("entities is required.");
  162723. }
  162724. const state = exportKml._createState(options);
  162725. const rootEntities = entities.values.filter(function(entity) {
  162726. return !defined_default(entity.parent);
  162727. });
  162728. const kmlDoc = state.kmlDoc;
  162729. const kmlElement = kmlDoc.documentElement;
  162730. kmlElement.setAttributeNS(xmlnsNamespace, "xmlns:gx", gxNamespace);
  162731. const kmlDocumentElement = kmlDoc.createElement("Document");
  162732. kmlElement.appendChild(kmlDocumentElement);
  162733. recurseEntities(state, kmlDocumentElement, rootEntities);
  162734. state.styleCache.save(kmlDocumentElement);
  162735. const externalFileHandler = state.externalFileHandler;
  162736. return externalFileHandler.promise.then(function() {
  162737. const serializer = new XMLSerializer();
  162738. const kmlString = serializer.serializeToString(state.kmlDoc);
  162739. if (kmz) {
  162740. return createKmz(kmlString, externalFileHandler.files);
  162741. }
  162742. return {
  162743. kml: kmlString,
  162744. externalFiles: externalFileHandler.files
  162745. };
  162746. });
  162747. }
  162748. function createKmz(kmlString, externalFiles) {
  162749. const zWorkerUrl = buildModuleUrl_default("ThirdParty/Workers/z-worker-pako.js");
  162750. zipNoWorker.configure({
  162751. workerScripts: {
  162752. deflate: [zWorkerUrl, "./pako_deflate.min.js"],
  162753. inflate: [zWorkerUrl, "./pako_inflate.min.js"]
  162754. }
  162755. });
  162756. const blobWriter = new zipNoWorker.BlobWriter();
  162757. const writer = new zipNoWorker.ZipWriter(blobWriter);
  162758. return writer.add("doc.kml", new zipNoWorker.TextReader(kmlString)).then(function() {
  162759. const keys = Object.keys(externalFiles);
  162760. return addExternalFilesToZip(writer, keys, externalFiles, 0);
  162761. }).then(function() {
  162762. return writer.close();
  162763. }).then(function(blob) {
  162764. return {
  162765. kmz: blob
  162766. };
  162767. });
  162768. }
  162769. function addExternalFilesToZip(writer, keys, externalFiles, index2) {
  162770. if (keys.length === index2) {
  162771. return;
  162772. }
  162773. const filename = keys[index2];
  162774. return writer.add(filename, new zipNoWorker.BlobReader(externalFiles[filename])).then(function() {
  162775. return addExternalFilesToZip(writer, keys, externalFiles, index2 + 1);
  162776. });
  162777. }
  162778. exportKml._createState = function(options) {
  162779. const entities = options.entities;
  162780. const styleCache = new StyleCache();
  162781. const entityAvailability = entities.computeAvailability();
  162782. const time = defined_default(options.time) ? options.time : entityAvailability.start;
  162783. let defaultAvailability = defaultValue_default(
  162784. options.defaultAvailability,
  162785. entityAvailability
  162786. );
  162787. const sampleDuration = defaultValue_default(options.sampleDuration, 60);
  162788. if (defaultAvailability.start === Iso8601_default.MINIMUM_VALUE) {
  162789. if (defaultAvailability.stop === Iso8601_default.MAXIMUM_VALUE) {
  162790. defaultAvailability = new TimeInterval_default();
  162791. } else {
  162792. JulianDate_default.addSeconds(
  162793. defaultAvailability.stop,
  162794. -10 * sampleDuration,
  162795. defaultAvailability.start
  162796. );
  162797. }
  162798. } else if (defaultAvailability.stop === Iso8601_default.MAXIMUM_VALUE) {
  162799. JulianDate_default.addSeconds(
  162800. defaultAvailability.start,
  162801. 10 * sampleDuration,
  162802. defaultAvailability.stop
  162803. );
  162804. }
  162805. const externalFileHandler = new ExternalFileHandler(options.modelCallback);
  162806. const kmlDoc = document.implementation.createDocument(kmlNamespace, "kml");
  162807. return {
  162808. kmlDoc,
  162809. ellipsoid: defaultValue_default(options.ellipsoid, Ellipsoid_default.WGS84),
  162810. idManager: new IdManager(),
  162811. styleCache,
  162812. externalFileHandler,
  162813. time,
  162814. valueGetter: new ValueGetter(time),
  162815. sampleDuration,
  162816. defaultAvailability: new TimeIntervalCollection_default([defaultAvailability])
  162817. };
  162818. };
  162819. function recurseEntities(state, parentNode, entities) {
  162820. const kmlDoc = state.kmlDoc;
  162821. const styleCache = state.styleCache;
  162822. const valueGetter = state.valueGetter;
  162823. const idManager = state.idManager;
  162824. const count = entities.length;
  162825. let overlays;
  162826. let geometries;
  162827. let styles;
  162828. for (let i2 = 0; i2 < count; ++i2) {
  162829. const entity = entities[i2];
  162830. overlays = [];
  162831. geometries = [];
  162832. styles = [];
  162833. createPoint2(state, entity, geometries, styles);
  162834. createLineString2(state, entity.polyline, geometries, styles);
  162835. createPolygon2(state, entity.rectangle, geometries, styles, overlays);
  162836. createPolygon2(state, entity.polygon, geometries, styles, overlays);
  162837. createModel2(state, entity, entity.model, geometries, styles);
  162838. let timeSpan;
  162839. const availability = entity.availability;
  162840. if (defined_default(availability)) {
  162841. timeSpan = kmlDoc.createElement("TimeSpan");
  162842. if (!JulianDate_default.equals(availability.start, Iso8601_default.MINIMUM_VALUE)) {
  162843. timeSpan.appendChild(
  162844. createBasicElementWithText(
  162845. kmlDoc,
  162846. "begin",
  162847. JulianDate_default.toIso8601(availability.start)
  162848. )
  162849. );
  162850. }
  162851. if (!JulianDate_default.equals(availability.stop, Iso8601_default.MAXIMUM_VALUE)) {
  162852. timeSpan.appendChild(
  162853. createBasicElementWithText(
  162854. kmlDoc,
  162855. "end",
  162856. JulianDate_default.toIso8601(availability.stop)
  162857. )
  162858. );
  162859. }
  162860. }
  162861. for (let overlayIndex = 0; overlayIndex < overlays.length; ++overlayIndex) {
  162862. const overlay = overlays[overlayIndex];
  162863. overlay.setAttribute("id", idManager.get(entity.id));
  162864. overlay.appendChild(
  162865. createBasicElementWithText(kmlDoc, "name", entity.name)
  162866. );
  162867. overlay.appendChild(
  162868. createBasicElementWithText(kmlDoc, "visibility", entity.show)
  162869. );
  162870. overlay.appendChild(
  162871. createBasicElementWithText(kmlDoc, "description", entity.description)
  162872. );
  162873. if (defined_default(timeSpan)) {
  162874. overlay.appendChild(timeSpan);
  162875. }
  162876. parentNode.appendChild(overlay);
  162877. }
  162878. const geometryCount = geometries.length;
  162879. if (geometryCount > 0) {
  162880. const placemark = kmlDoc.createElement("Placemark");
  162881. placemark.setAttribute("id", idManager.get(entity.id));
  162882. let name = entity.name;
  162883. const labelGraphics = entity.label;
  162884. if (defined_default(labelGraphics)) {
  162885. const labelStyle = kmlDoc.createElement("LabelStyle");
  162886. const text2 = valueGetter.get(labelGraphics.text);
  162887. name = defined_default(text2) && text2.length > 0 ? text2 : name;
  162888. const color = valueGetter.getColor(labelGraphics.fillColor);
  162889. if (defined_default(color)) {
  162890. labelStyle.appendChild(
  162891. createBasicElementWithText(kmlDoc, "color", color)
  162892. );
  162893. labelStyle.appendChild(
  162894. createBasicElementWithText(kmlDoc, "colorMode", "normal")
  162895. );
  162896. }
  162897. const scale = valueGetter.get(labelGraphics.scale);
  162898. if (defined_default(scale)) {
  162899. labelStyle.appendChild(
  162900. createBasicElementWithText(kmlDoc, "scale", scale)
  162901. );
  162902. }
  162903. styles.push(labelStyle);
  162904. }
  162905. placemark.appendChild(createBasicElementWithText(kmlDoc, "name", name));
  162906. placemark.appendChild(
  162907. createBasicElementWithText(kmlDoc, "visibility", entity.show)
  162908. );
  162909. placemark.appendChild(
  162910. createBasicElementWithText(kmlDoc, "description", entity.description)
  162911. );
  162912. if (defined_default(timeSpan)) {
  162913. placemark.appendChild(timeSpan);
  162914. }
  162915. parentNode.appendChild(placemark);
  162916. const styleCount = styles.length;
  162917. if (styleCount > 0) {
  162918. const style = kmlDoc.createElement("Style");
  162919. for (let styleIndex = 0; styleIndex < styleCount; ++styleIndex) {
  162920. style.appendChild(styles[styleIndex]);
  162921. }
  162922. placemark.appendChild(
  162923. createBasicElementWithText(kmlDoc, "styleUrl", styleCache.get(style))
  162924. );
  162925. }
  162926. if (geometries.length === 1) {
  162927. placemark.appendChild(geometries[0]);
  162928. } else if (geometries.length > 1) {
  162929. const multigeometry = kmlDoc.createElement("MultiGeometry");
  162930. for (let geometryIndex = 0; geometryIndex < geometryCount; ++geometryIndex) {
  162931. multigeometry.appendChild(geometries[geometryIndex]);
  162932. }
  162933. placemark.appendChild(multigeometry);
  162934. }
  162935. }
  162936. const children = entity._children;
  162937. if (children.length > 0) {
  162938. const folderNode = kmlDoc.createElement("Folder");
  162939. folderNode.setAttribute("id", idManager.get(entity.id));
  162940. folderNode.appendChild(
  162941. createBasicElementWithText(kmlDoc, "name", entity.name)
  162942. );
  162943. folderNode.appendChild(
  162944. createBasicElementWithText(kmlDoc, "visibility", entity.show)
  162945. );
  162946. folderNode.appendChild(
  162947. createBasicElementWithText(kmlDoc, "description", entity.description)
  162948. );
  162949. parentNode.appendChild(folderNode);
  162950. recurseEntities(state, folderNode, children);
  162951. }
  162952. }
  162953. }
  162954. var scratchCartesian312 = new Cartesian3_default();
  162955. var scratchCartographic14 = new Cartographic_default();
  162956. var scratchJulianDate3 = new JulianDate_default();
  162957. function createPoint2(state, entity, geometries, styles) {
  162958. const kmlDoc = state.kmlDoc;
  162959. const ellipsoid = state.ellipsoid;
  162960. const valueGetter = state.valueGetter;
  162961. const pointGraphics = defaultValue_default(entity.billboard, entity.point);
  162962. if (!defined_default(pointGraphics) && !defined_default(entity.path)) {
  162963. return;
  162964. }
  162965. const entityPositionProperty = entity.position;
  162966. if (!entityPositionProperty.isConstant) {
  162967. createTracks(state, entity, pointGraphics, geometries, styles);
  162968. return;
  162969. }
  162970. valueGetter.get(entityPositionProperty, void 0, scratchCartesian312);
  162971. const coordinates = createBasicElementWithText(
  162972. kmlDoc,
  162973. "coordinates",
  162974. getCoordinates(scratchCartesian312, ellipsoid)
  162975. );
  162976. const pointGeometry = kmlDoc.createElement("Point");
  162977. const altitudeMode = kmlDoc.createElement("altitudeMode");
  162978. altitudeMode.appendChild(
  162979. getAltitudeMode(state, pointGraphics.heightReference)
  162980. );
  162981. pointGeometry.appendChild(altitudeMode);
  162982. pointGeometry.appendChild(coordinates);
  162983. geometries.push(pointGeometry);
  162984. const iconStyle = pointGraphics instanceof BillboardGraphics_default ? createIconStyleFromBillboard(state, pointGraphics) : createIconStyleFromPoint(state, pointGraphics);
  162985. styles.push(iconStyle);
  162986. }
  162987. function createTracks(state, entity, pointGraphics, geometries, styles) {
  162988. const kmlDoc = state.kmlDoc;
  162989. const ellipsoid = state.ellipsoid;
  162990. const valueGetter = state.valueGetter;
  162991. let intervals;
  162992. const entityPositionProperty = entity.position;
  162993. let useEntityPositionProperty = true;
  162994. if (entityPositionProperty instanceof CompositePositionProperty_default) {
  162995. intervals = entityPositionProperty.intervals;
  162996. useEntityPositionProperty = false;
  162997. } else {
  162998. intervals = defaultValue_default(entity.availability, state.defaultAvailability);
  162999. }
  163000. const isModel = pointGraphics instanceof ModelGraphics_default;
  163001. let i2, j, times;
  163002. const tracks = [];
  163003. for (i2 = 0; i2 < intervals.length; ++i2) {
  163004. const interval = intervals.get(i2);
  163005. let positionProperty = useEntityPositionProperty ? entityPositionProperty : interval.data;
  163006. const trackAltitudeMode = kmlDoc.createElement("altitudeMode");
  163007. if (positionProperty instanceof ScaledPositionProperty_default) {
  163008. positionProperty = positionProperty._value;
  163009. trackAltitudeMode.appendChild(
  163010. getAltitudeMode(state, HeightReference_default.CLAMP_TO_GROUND)
  163011. );
  163012. } else if (defined_default(pointGraphics)) {
  163013. trackAltitudeMode.appendChild(
  163014. getAltitudeMode(state, pointGraphics.heightReference)
  163015. );
  163016. } else {
  163017. trackAltitudeMode.appendChild(
  163018. getAltitudeMode(state, HeightReference_default.NONE)
  163019. );
  163020. }
  163021. const positionTimes = [];
  163022. const positionValues = [];
  163023. if (positionProperty.isConstant) {
  163024. valueGetter.get(positionProperty, void 0, scratchCartesian312);
  163025. const constCoordinates = createBasicElementWithText(
  163026. kmlDoc,
  163027. "coordinates",
  163028. getCoordinates(scratchCartesian312, ellipsoid)
  163029. );
  163030. positionTimes.push(JulianDate_default.toIso8601(interval.start));
  163031. positionValues.push(constCoordinates);
  163032. positionTimes.push(JulianDate_default.toIso8601(interval.stop));
  163033. positionValues.push(constCoordinates);
  163034. } else if (positionProperty instanceof SampledPositionProperty_default) {
  163035. times = positionProperty._property._times;
  163036. for (j = 0; j < times.length; ++j) {
  163037. positionTimes.push(JulianDate_default.toIso8601(times[j]));
  163038. positionProperty.getValueInReferenceFrame(
  163039. times[j],
  163040. ReferenceFrame_default.FIXED,
  163041. scratchCartesian312
  163042. );
  163043. positionValues.push(getCoordinates(scratchCartesian312, ellipsoid));
  163044. }
  163045. } else if (positionProperty instanceof SampledProperty_default) {
  163046. times = positionProperty._times;
  163047. const values = positionProperty._values;
  163048. for (j = 0; j < times.length; ++j) {
  163049. positionTimes.push(JulianDate_default.toIso8601(times[j]));
  163050. Cartesian3_default.fromArray(values, j * 3, scratchCartesian312);
  163051. positionValues.push(getCoordinates(scratchCartesian312, ellipsoid));
  163052. }
  163053. } else {
  163054. const duration = state.sampleDuration;
  163055. interval.start.clone(scratchJulianDate3);
  163056. if (!interval.isStartIncluded) {
  163057. JulianDate_default.addSeconds(scratchJulianDate3, duration, scratchJulianDate3);
  163058. }
  163059. const stopDate = interval.stop;
  163060. while (JulianDate_default.lessThan(scratchJulianDate3, stopDate)) {
  163061. positionProperty.getValue(scratchJulianDate3, scratchCartesian312);
  163062. positionTimes.push(JulianDate_default.toIso8601(scratchJulianDate3));
  163063. positionValues.push(getCoordinates(scratchCartesian312, ellipsoid));
  163064. JulianDate_default.addSeconds(scratchJulianDate3, duration, scratchJulianDate3);
  163065. }
  163066. if (interval.isStopIncluded && JulianDate_default.equals(scratchJulianDate3, stopDate)) {
  163067. positionProperty.getValue(scratchJulianDate3, scratchCartesian312);
  163068. positionTimes.push(JulianDate_default.toIso8601(scratchJulianDate3));
  163069. positionValues.push(getCoordinates(scratchCartesian312, ellipsoid));
  163070. }
  163071. }
  163072. const trackGeometry = kmlDoc.createElementNS(gxNamespace, "Track");
  163073. trackGeometry.appendChild(trackAltitudeMode);
  163074. for (let k = 0; k < positionTimes.length; ++k) {
  163075. const when = createBasicElementWithText(kmlDoc, "when", positionTimes[k]);
  163076. const coord = createBasicElementWithText(
  163077. kmlDoc,
  163078. "coord",
  163079. positionValues[k],
  163080. gxNamespace
  163081. );
  163082. trackGeometry.appendChild(when);
  163083. trackGeometry.appendChild(coord);
  163084. }
  163085. if (isModel) {
  163086. trackGeometry.appendChild(createModelGeometry(state, pointGraphics));
  163087. }
  163088. tracks.push(trackGeometry);
  163089. }
  163090. if (tracks.length === 1) {
  163091. geometries.push(tracks[0]);
  163092. } else if (tracks.length > 1) {
  163093. const multiTrackGeometry = kmlDoc.createElementNS(
  163094. gxNamespace,
  163095. "MultiTrack"
  163096. );
  163097. for (i2 = 0; i2 < tracks.length; ++i2) {
  163098. multiTrackGeometry.appendChild(tracks[i2]);
  163099. }
  163100. geometries.push(multiTrackGeometry);
  163101. }
  163102. if (defined_default(pointGraphics) && !isModel) {
  163103. const iconStyle = pointGraphics instanceof BillboardGraphics_default ? createIconStyleFromBillboard(state, pointGraphics) : createIconStyleFromPoint(state, pointGraphics);
  163104. styles.push(iconStyle);
  163105. }
  163106. const path = entity.path;
  163107. if (defined_default(path)) {
  163108. const width = valueGetter.get(path.width);
  163109. const material = path.material;
  163110. if (defined_default(material) || defined_default(width)) {
  163111. const lineStyle = kmlDoc.createElement("LineStyle");
  163112. if (defined_default(width)) {
  163113. lineStyle.appendChild(
  163114. createBasicElementWithText(kmlDoc, "width", width)
  163115. );
  163116. }
  163117. processMaterial(state, material, lineStyle);
  163118. styles.push(lineStyle);
  163119. }
  163120. }
  163121. }
  163122. function createIconStyleFromPoint(state, pointGraphics) {
  163123. const kmlDoc = state.kmlDoc;
  163124. const valueGetter = state.valueGetter;
  163125. const iconStyle = kmlDoc.createElement("IconStyle");
  163126. const color = valueGetter.getColor(pointGraphics.color);
  163127. if (defined_default(color)) {
  163128. iconStyle.appendChild(createBasicElementWithText(kmlDoc, "color", color));
  163129. iconStyle.appendChild(
  163130. createBasicElementWithText(kmlDoc, "colorMode", "normal")
  163131. );
  163132. }
  163133. const pixelSize = valueGetter.get(pointGraphics.pixelSize);
  163134. if (defined_default(pixelSize)) {
  163135. iconStyle.appendChild(
  163136. createBasicElementWithText(kmlDoc, "scale", pixelSize / BILLBOARD_SIZE3)
  163137. );
  163138. }
  163139. return iconStyle;
  163140. }
  163141. function createIconStyleFromBillboard(state, billboardGraphics) {
  163142. const kmlDoc = state.kmlDoc;
  163143. const valueGetter = state.valueGetter;
  163144. const externalFileHandler = state.externalFileHandler;
  163145. const iconStyle = kmlDoc.createElement("IconStyle");
  163146. let image = valueGetter.get(billboardGraphics.image);
  163147. if (defined_default(image)) {
  163148. image = externalFileHandler.texture(image);
  163149. const icon = kmlDoc.createElement("Icon");
  163150. icon.appendChild(createBasicElementWithText(kmlDoc, "href", image));
  163151. const imageSubRegion = valueGetter.get(billboardGraphics.imageSubRegion);
  163152. if (defined_default(imageSubRegion)) {
  163153. icon.appendChild(
  163154. createBasicElementWithText(kmlDoc, "x", imageSubRegion.x, gxNamespace)
  163155. );
  163156. icon.appendChild(
  163157. createBasicElementWithText(kmlDoc, "y", imageSubRegion.y, gxNamespace)
  163158. );
  163159. icon.appendChild(
  163160. createBasicElementWithText(
  163161. kmlDoc,
  163162. "w",
  163163. imageSubRegion.width,
  163164. gxNamespace
  163165. )
  163166. );
  163167. icon.appendChild(
  163168. createBasicElementWithText(
  163169. kmlDoc,
  163170. "h",
  163171. imageSubRegion.height,
  163172. gxNamespace
  163173. )
  163174. );
  163175. }
  163176. iconStyle.appendChild(icon);
  163177. }
  163178. const color = valueGetter.getColor(billboardGraphics.color);
  163179. if (defined_default(color)) {
  163180. iconStyle.appendChild(createBasicElementWithText(kmlDoc, "color", color));
  163181. iconStyle.appendChild(
  163182. createBasicElementWithText(kmlDoc, "colorMode", "normal")
  163183. );
  163184. }
  163185. let scale = valueGetter.get(billboardGraphics.scale);
  163186. if (defined_default(scale)) {
  163187. iconStyle.appendChild(createBasicElementWithText(kmlDoc, "scale", scale));
  163188. }
  163189. const pixelOffset = valueGetter.get(billboardGraphics.pixelOffset);
  163190. if (defined_default(pixelOffset)) {
  163191. scale = defaultValue_default(scale, 1);
  163192. Cartesian2_default.divideByScalar(pixelOffset, scale, pixelOffset);
  163193. const width = valueGetter.get(billboardGraphics.width, BILLBOARD_SIZE3);
  163194. const height = valueGetter.get(billboardGraphics.height, BILLBOARD_SIZE3);
  163195. const horizontalOrigin = valueGetter.get(
  163196. billboardGraphics.horizontalOrigin,
  163197. HorizontalOrigin_default.CENTER
  163198. );
  163199. if (horizontalOrigin === HorizontalOrigin_default.CENTER) {
  163200. pixelOffset.x -= width * 0.5;
  163201. } else if (horizontalOrigin === HorizontalOrigin_default.RIGHT) {
  163202. pixelOffset.x -= width;
  163203. }
  163204. const verticalOrigin = valueGetter.get(
  163205. billboardGraphics.verticalOrigin,
  163206. VerticalOrigin_default.CENTER
  163207. );
  163208. if (verticalOrigin === VerticalOrigin_default.TOP) {
  163209. pixelOffset.y += height;
  163210. } else if (verticalOrigin === VerticalOrigin_default.CENTER) {
  163211. pixelOffset.y += height * 0.5;
  163212. }
  163213. const hotSpot = kmlDoc.createElement("hotSpot");
  163214. hotSpot.setAttribute("x", -pixelOffset.x);
  163215. hotSpot.setAttribute("y", pixelOffset.y);
  163216. hotSpot.setAttribute("xunits", "pixels");
  163217. hotSpot.setAttribute("yunits", "pixels");
  163218. iconStyle.appendChild(hotSpot);
  163219. }
  163220. let rotation = valueGetter.get(billboardGraphics.rotation);
  163221. const alignedAxis = valueGetter.get(billboardGraphics.alignedAxis);
  163222. if (defined_default(rotation) && Cartesian3_default.equals(Cartesian3_default.UNIT_Z, alignedAxis)) {
  163223. rotation = Math_default.toDegrees(-rotation);
  163224. if (rotation === 0) {
  163225. rotation = 360;
  163226. }
  163227. iconStyle.appendChild(
  163228. createBasicElementWithText(kmlDoc, "heading", rotation)
  163229. );
  163230. }
  163231. return iconStyle;
  163232. }
  163233. function createLineString2(state, polylineGraphics, geometries, styles) {
  163234. const kmlDoc = state.kmlDoc;
  163235. const ellipsoid = state.ellipsoid;
  163236. const valueGetter = state.valueGetter;
  163237. if (!defined_default(polylineGraphics)) {
  163238. return;
  163239. }
  163240. const lineStringGeometry = kmlDoc.createElement("LineString");
  163241. const altitudeMode = kmlDoc.createElement("altitudeMode");
  163242. const clampToGround = valueGetter.get(polylineGraphics.clampToGround, false);
  163243. let altitudeModeText;
  163244. if (clampToGround) {
  163245. lineStringGeometry.appendChild(
  163246. createBasicElementWithText(kmlDoc, "tessellate", true)
  163247. );
  163248. altitudeModeText = kmlDoc.createTextNode("clampToGround");
  163249. } else {
  163250. altitudeModeText = kmlDoc.createTextNode("absolute");
  163251. }
  163252. altitudeMode.appendChild(altitudeModeText);
  163253. lineStringGeometry.appendChild(altitudeMode);
  163254. const positionsProperty = polylineGraphics.positions;
  163255. const cartesians = valueGetter.get(positionsProperty);
  163256. const coordinates = createBasicElementWithText(
  163257. kmlDoc,
  163258. "coordinates",
  163259. getCoordinates(cartesians, ellipsoid)
  163260. );
  163261. lineStringGeometry.appendChild(coordinates);
  163262. const zIndex = valueGetter.get(polylineGraphics.zIndex);
  163263. if (clampToGround && defined_default(zIndex)) {
  163264. lineStringGeometry.appendChild(
  163265. createBasicElementWithText(kmlDoc, "drawOrder", zIndex, gxNamespace)
  163266. );
  163267. }
  163268. geometries.push(lineStringGeometry);
  163269. const lineStyle = kmlDoc.createElement("LineStyle");
  163270. const width = valueGetter.get(polylineGraphics.width);
  163271. if (defined_default(width)) {
  163272. lineStyle.appendChild(createBasicElementWithText(kmlDoc, "width", width));
  163273. }
  163274. processMaterial(state, polylineGraphics.material, lineStyle);
  163275. styles.push(lineStyle);
  163276. }
  163277. function getRectangleBoundaries(state, rectangleGraphics, extrudedHeight) {
  163278. const kmlDoc = state.kmlDoc;
  163279. const valueGetter = state.valueGetter;
  163280. let height = valueGetter.get(rectangleGraphics.height, 0);
  163281. if (extrudedHeight > 0) {
  163282. height = extrudedHeight;
  163283. }
  163284. const coordinatesProperty = rectangleGraphics.coordinates;
  163285. const rectangle = valueGetter.get(coordinatesProperty);
  163286. const coordinateStrings = [];
  163287. const cornerFunction = [
  163288. Rectangle_default.northeast,
  163289. Rectangle_default.southeast,
  163290. Rectangle_default.southwest,
  163291. Rectangle_default.northwest
  163292. ];
  163293. for (let i2 = 0; i2 < 4; ++i2) {
  163294. cornerFunction[i2](rectangle, scratchCartographic14);
  163295. coordinateStrings.push(
  163296. `${Math_default.toDegrees(
  163297. scratchCartographic14.longitude
  163298. )},${Math_default.toDegrees(scratchCartographic14.latitude)},${height}`
  163299. );
  163300. }
  163301. const coordinates = createBasicElementWithText(
  163302. kmlDoc,
  163303. "coordinates",
  163304. coordinateStrings.join(" ")
  163305. );
  163306. const outerBoundaryIs = kmlDoc.createElement("outerBoundaryIs");
  163307. const linearRing = kmlDoc.createElement("LinearRing");
  163308. linearRing.appendChild(coordinates);
  163309. outerBoundaryIs.appendChild(linearRing);
  163310. return [outerBoundaryIs];
  163311. }
  163312. function getLinearRing(state, positions, height, perPositionHeight) {
  163313. const kmlDoc = state.kmlDoc;
  163314. const ellipsoid = state.ellipsoid;
  163315. const coordinateStrings = [];
  163316. const positionCount = positions.length;
  163317. for (let i2 = 0; i2 < positionCount; ++i2) {
  163318. Cartographic_default.fromCartesian(positions[i2], ellipsoid, scratchCartographic14);
  163319. coordinateStrings.push(
  163320. `${Math_default.toDegrees(
  163321. scratchCartographic14.longitude
  163322. )},${Math_default.toDegrees(scratchCartographic14.latitude)},${perPositionHeight ? scratchCartographic14.height : height}`
  163323. );
  163324. }
  163325. const coordinates = createBasicElementWithText(
  163326. kmlDoc,
  163327. "coordinates",
  163328. coordinateStrings.join(" ")
  163329. );
  163330. const linearRing = kmlDoc.createElement("LinearRing");
  163331. linearRing.appendChild(coordinates);
  163332. return linearRing;
  163333. }
  163334. function getPolygonBoundaries(state, polygonGraphics, extrudedHeight) {
  163335. const kmlDoc = state.kmlDoc;
  163336. const valueGetter = state.valueGetter;
  163337. let height = valueGetter.get(polygonGraphics.height, 0);
  163338. const perPositionHeight = valueGetter.get(
  163339. polygonGraphics.perPositionHeight,
  163340. false
  163341. );
  163342. if (!perPositionHeight && extrudedHeight > 0) {
  163343. height = extrudedHeight;
  163344. }
  163345. const boundaries = [];
  163346. const hierarchyProperty = polygonGraphics.hierarchy;
  163347. const hierarchy = valueGetter.get(hierarchyProperty);
  163348. const positions = Array.isArray(hierarchy) ? hierarchy : hierarchy.positions;
  163349. const outerBoundaryIs = kmlDoc.createElement("outerBoundaryIs");
  163350. outerBoundaryIs.appendChild(
  163351. getLinearRing(state, positions, height, perPositionHeight)
  163352. );
  163353. boundaries.push(outerBoundaryIs);
  163354. const holes = hierarchy.holes;
  163355. if (defined_default(holes)) {
  163356. const holeCount = holes.length;
  163357. for (let i2 = 0; i2 < holeCount; ++i2) {
  163358. const innerBoundaryIs = kmlDoc.createElement("innerBoundaryIs");
  163359. innerBoundaryIs.appendChild(
  163360. getLinearRing(state, holes[i2].positions, height, perPositionHeight)
  163361. );
  163362. boundaries.push(innerBoundaryIs);
  163363. }
  163364. }
  163365. return boundaries;
  163366. }
  163367. function createPolygon2(state, geometry, geometries, styles, overlays) {
  163368. const kmlDoc = state.kmlDoc;
  163369. const valueGetter = state.valueGetter;
  163370. if (!defined_default(geometry)) {
  163371. return;
  163372. }
  163373. const isRectangle = geometry instanceof RectangleGraphics_default;
  163374. if (isRectangle && valueGetter.getMaterialType(geometry.material) === "Image") {
  163375. createGroundOverlay(state, geometry, overlays);
  163376. return;
  163377. }
  163378. const polygonGeometry = kmlDoc.createElement("Polygon");
  163379. const extrudedHeight = valueGetter.get(geometry.extrudedHeight, 0);
  163380. if (extrudedHeight > 0) {
  163381. polygonGeometry.appendChild(
  163382. createBasicElementWithText(kmlDoc, "extrude", true)
  163383. );
  163384. }
  163385. const boundaries = isRectangle ? getRectangleBoundaries(state, geometry, extrudedHeight) : getPolygonBoundaries(state, geometry, extrudedHeight);
  163386. const boundaryCount = boundaries.length;
  163387. for (let i2 = 0; i2 < boundaryCount; ++i2) {
  163388. polygonGeometry.appendChild(boundaries[i2]);
  163389. }
  163390. const altitudeMode = kmlDoc.createElement("altitudeMode");
  163391. altitudeMode.appendChild(getAltitudeMode(state, geometry.heightReference));
  163392. polygonGeometry.appendChild(altitudeMode);
  163393. geometries.push(polygonGeometry);
  163394. const polyStyle = kmlDoc.createElement("PolyStyle");
  163395. const fill = valueGetter.get(geometry.fill, false);
  163396. if (fill) {
  163397. polyStyle.appendChild(createBasicElementWithText(kmlDoc, "fill", fill));
  163398. }
  163399. processMaterial(state, geometry.material, polyStyle);
  163400. const outline = valueGetter.get(geometry.outline, false);
  163401. if (outline) {
  163402. polyStyle.appendChild(
  163403. createBasicElementWithText(kmlDoc, "outline", outline)
  163404. );
  163405. const lineStyle = kmlDoc.createElement("LineStyle");
  163406. const outlineWidth = valueGetter.get(geometry.outlineWidth, 1);
  163407. lineStyle.appendChild(
  163408. createBasicElementWithText(kmlDoc, "width", outlineWidth)
  163409. );
  163410. const outlineColor = valueGetter.getColor(
  163411. geometry.outlineColor,
  163412. Color_default.BLACK
  163413. );
  163414. lineStyle.appendChild(
  163415. createBasicElementWithText(kmlDoc, "color", outlineColor)
  163416. );
  163417. lineStyle.appendChild(
  163418. createBasicElementWithText(kmlDoc, "colorMode", "normal")
  163419. );
  163420. styles.push(lineStyle);
  163421. }
  163422. styles.push(polyStyle);
  163423. }
  163424. function createGroundOverlay(state, rectangleGraphics, overlays) {
  163425. const kmlDoc = state.kmlDoc;
  163426. const valueGetter = state.valueGetter;
  163427. const externalFileHandler = state.externalFileHandler;
  163428. const groundOverlay = kmlDoc.createElement("GroundOverlay");
  163429. const altitudeMode = kmlDoc.createElement("altitudeMode");
  163430. altitudeMode.appendChild(
  163431. getAltitudeMode(state, rectangleGraphics.heightReference)
  163432. );
  163433. groundOverlay.appendChild(altitudeMode);
  163434. const height = valueGetter.get(rectangleGraphics.height);
  163435. if (defined_default(height)) {
  163436. groundOverlay.appendChild(
  163437. createBasicElementWithText(kmlDoc, "altitude", height)
  163438. );
  163439. }
  163440. const rectangle = valueGetter.get(rectangleGraphics.coordinates);
  163441. const latLonBox = kmlDoc.createElement("LatLonBox");
  163442. latLonBox.appendChild(
  163443. createBasicElementWithText(
  163444. kmlDoc,
  163445. "north",
  163446. Math_default.toDegrees(rectangle.north)
  163447. )
  163448. );
  163449. latLonBox.appendChild(
  163450. createBasicElementWithText(
  163451. kmlDoc,
  163452. "south",
  163453. Math_default.toDegrees(rectangle.south)
  163454. )
  163455. );
  163456. latLonBox.appendChild(
  163457. createBasicElementWithText(
  163458. kmlDoc,
  163459. "east",
  163460. Math_default.toDegrees(rectangle.east)
  163461. )
  163462. );
  163463. latLonBox.appendChild(
  163464. createBasicElementWithText(
  163465. kmlDoc,
  163466. "west",
  163467. Math_default.toDegrees(rectangle.west)
  163468. )
  163469. );
  163470. groundOverlay.appendChild(latLonBox);
  163471. const material = valueGetter.get(rectangleGraphics.material);
  163472. const href = externalFileHandler.texture(material.image);
  163473. const icon = kmlDoc.createElement("Icon");
  163474. icon.appendChild(createBasicElementWithText(kmlDoc, "href", href));
  163475. groundOverlay.appendChild(icon);
  163476. const color = material.color;
  163477. if (defined_default(color)) {
  163478. groundOverlay.appendChild(
  163479. createBasicElementWithText(kmlDoc, "color", colorToString(material.color))
  163480. );
  163481. }
  163482. overlays.push(groundOverlay);
  163483. }
  163484. function createModelGeometry(state, modelGraphics) {
  163485. const kmlDoc = state.kmlDoc;
  163486. const valueGetter = state.valueGetter;
  163487. const externalFileHandler = state.externalFileHandler;
  163488. const modelGeometry = kmlDoc.createElement("Model");
  163489. const scale = valueGetter.get(modelGraphics.scale);
  163490. if (defined_default(scale)) {
  163491. const scaleElement = kmlDoc.createElement("scale");
  163492. scaleElement.appendChild(createBasicElementWithText(kmlDoc, "x", scale));
  163493. scaleElement.appendChild(createBasicElementWithText(kmlDoc, "y", scale));
  163494. scaleElement.appendChild(createBasicElementWithText(kmlDoc, "z", scale));
  163495. modelGeometry.appendChild(scaleElement);
  163496. }
  163497. const link = kmlDoc.createElement("Link");
  163498. const uri = externalFileHandler.model(modelGraphics, state.time);
  163499. link.appendChild(createBasicElementWithText(kmlDoc, "href", uri));
  163500. modelGeometry.appendChild(link);
  163501. return modelGeometry;
  163502. }
  163503. function createModel2(state, entity, modelGraphics, geometries, styles) {
  163504. const kmlDoc = state.kmlDoc;
  163505. const ellipsoid = state.ellipsoid;
  163506. const valueGetter = state.valueGetter;
  163507. if (!defined_default(modelGraphics)) {
  163508. return;
  163509. }
  163510. const entityPositionProperty = entity.position;
  163511. if (!entityPositionProperty.isConstant) {
  163512. createTracks(state, entity, modelGraphics, geometries, styles);
  163513. return;
  163514. }
  163515. const modelGeometry = createModelGeometry(state, modelGraphics);
  163516. const altitudeMode = kmlDoc.createElement("altitudeMode");
  163517. altitudeMode.appendChild(
  163518. getAltitudeMode(state, modelGraphics.heightReference)
  163519. );
  163520. modelGeometry.appendChild(altitudeMode);
  163521. valueGetter.get(entityPositionProperty, void 0, scratchCartesian312);
  163522. Cartographic_default.fromCartesian(scratchCartesian312, ellipsoid, scratchCartographic14);
  163523. const location2 = kmlDoc.createElement("Location");
  163524. location2.appendChild(
  163525. createBasicElementWithText(
  163526. kmlDoc,
  163527. "longitude",
  163528. Math_default.toDegrees(scratchCartographic14.longitude)
  163529. )
  163530. );
  163531. location2.appendChild(
  163532. createBasicElementWithText(
  163533. kmlDoc,
  163534. "latitude",
  163535. Math_default.toDegrees(scratchCartographic14.latitude)
  163536. )
  163537. );
  163538. location2.appendChild(
  163539. createBasicElementWithText(kmlDoc, "altitude", scratchCartographic14.height)
  163540. );
  163541. modelGeometry.appendChild(location2);
  163542. geometries.push(modelGeometry);
  163543. }
  163544. function processMaterial(state, materialProperty, style) {
  163545. const kmlDoc = state.kmlDoc;
  163546. const valueGetter = state.valueGetter;
  163547. if (!defined_default(materialProperty)) {
  163548. return;
  163549. }
  163550. const material = valueGetter.get(materialProperty);
  163551. if (!defined_default(material)) {
  163552. return;
  163553. }
  163554. let color;
  163555. const type = valueGetter.getMaterialType(materialProperty);
  163556. let outlineColor;
  163557. let outlineWidth;
  163558. switch (type) {
  163559. case "Image":
  163560. color = colorToString(Color_default.WHITE);
  163561. break;
  163562. case "Color":
  163563. case "Grid":
  163564. case "PolylineGlow":
  163565. case "PolylineArrow":
  163566. case "PolylineDash":
  163567. color = colorToString(material.color);
  163568. break;
  163569. case "PolylineOutline":
  163570. color = colorToString(material.color);
  163571. outlineColor = colorToString(material.outlineColor);
  163572. outlineWidth = material.outlineWidth;
  163573. style.appendChild(
  163574. createBasicElementWithText(
  163575. kmlDoc,
  163576. "outerColor",
  163577. outlineColor,
  163578. gxNamespace
  163579. )
  163580. );
  163581. style.appendChild(
  163582. createBasicElementWithText(
  163583. kmlDoc,
  163584. "outerWidth",
  163585. outlineWidth,
  163586. gxNamespace
  163587. )
  163588. );
  163589. break;
  163590. case "Stripe":
  163591. color = colorToString(material.oddColor);
  163592. break;
  163593. }
  163594. if (defined_default(color)) {
  163595. style.appendChild(createBasicElementWithText(kmlDoc, "color", color));
  163596. style.appendChild(
  163597. createBasicElementWithText(kmlDoc, "colorMode", "normal")
  163598. );
  163599. }
  163600. }
  163601. function getAltitudeMode(state, heightReferenceProperty) {
  163602. const kmlDoc = state.kmlDoc;
  163603. const valueGetter = state.valueGetter;
  163604. const heightReference = valueGetter.get(
  163605. heightReferenceProperty,
  163606. HeightReference_default.NONE
  163607. );
  163608. let altitudeModeText;
  163609. switch (heightReference) {
  163610. case HeightReference_default.NONE:
  163611. altitudeModeText = kmlDoc.createTextNode("absolute");
  163612. break;
  163613. case HeightReference_default.CLAMP_TO_GROUND:
  163614. altitudeModeText = kmlDoc.createTextNode("clampToGround");
  163615. break;
  163616. case HeightReference_default.RELATIVE_TO_GROUND:
  163617. altitudeModeText = kmlDoc.createTextNode("relativeToGround");
  163618. break;
  163619. }
  163620. return altitudeModeText;
  163621. }
  163622. function getCoordinates(coordinates, ellipsoid) {
  163623. if (!Array.isArray(coordinates)) {
  163624. coordinates = [coordinates];
  163625. }
  163626. const count = coordinates.length;
  163627. const coordinateStrings = [];
  163628. for (let i2 = 0; i2 < count; ++i2) {
  163629. Cartographic_default.fromCartesian(coordinates[i2], ellipsoid, scratchCartographic14);
  163630. coordinateStrings.push(
  163631. `${Math_default.toDegrees(
  163632. scratchCartographic14.longitude
  163633. )},${Math_default.toDegrees(scratchCartographic14.latitude)},${scratchCartographic14.height}`
  163634. );
  163635. }
  163636. return coordinateStrings.join(" ");
  163637. }
  163638. function createBasicElementWithText(kmlDoc, elementName, elementValue, namespace) {
  163639. elementValue = defaultValue_default(elementValue, "");
  163640. if (typeof elementValue === "boolean") {
  163641. elementValue = elementValue ? "1" : "0";
  163642. }
  163643. const element = defined_default(namespace) ? kmlDoc.createElementNS(namespace, elementName) : kmlDoc.createElement(elementName);
  163644. const text2 = elementValue === "string" && elementValue.indexOf("<") !== -1 ? kmlDoc.createCDATASection(elementValue) : kmlDoc.createTextNode(elementValue);
  163645. element.appendChild(text2);
  163646. return element;
  163647. }
  163648. function colorToString(color) {
  163649. let result = "";
  163650. const bytes = color.toBytes();
  163651. for (let i2 = 3; i2 >= 0; --i2) {
  163652. result += bytes[i2] < 16 ? `0${bytes[i2].toString(16)}` : bytes[i2].toString(16);
  163653. }
  163654. return result;
  163655. }
  163656. var exportKml_default = exportKml;
  163657. // node_modules/cesium/Source/Shaders/ViewportQuadVS.js
  163658. var ViewportQuadVS_default = "attribute vec4 position;\nattribute vec2 textureCoordinates;\n\nvarying vec2 v_textureCoordinates;\n\nvoid main() \n{\n gl_Position = position;\n v_textureCoordinates = textureCoordinates;\n}\n";
  163659. // node_modules/cesium/Source/Renderer/ComputeEngine.js
  163660. function ComputeEngine(context) {
  163661. this._context = context;
  163662. }
  163663. var renderStateScratch;
  163664. var drawCommandScratch = new DrawCommand_default({
  163665. primitiveType: PrimitiveType_default.TRIANGLES
  163666. });
  163667. var clearCommandScratch = new ClearCommand_default({
  163668. color: new Color_default(0, 0, 0, 0)
  163669. });
  163670. function createFramebuffer(context, outputTexture) {
  163671. return new Framebuffer_default({
  163672. context,
  163673. colorTextures: [outputTexture],
  163674. destroyAttachments: false
  163675. });
  163676. }
  163677. function createViewportQuadShader(context, fragmentShaderSource) {
  163678. return ShaderProgram_default.fromCache({
  163679. context,
  163680. vertexShaderSource: ViewportQuadVS_default,
  163681. fragmentShaderSource,
  163682. attributeLocations: {
  163683. position: 0,
  163684. textureCoordinates: 1
  163685. }
  163686. });
  163687. }
  163688. function createRenderState(width, height) {
  163689. if (!defined_default(renderStateScratch) || renderStateScratch.viewport.width !== width || renderStateScratch.viewport.height !== height) {
  163690. renderStateScratch = RenderState_default.fromCache({
  163691. viewport: new BoundingRectangle_default(0, 0, width, height)
  163692. });
  163693. }
  163694. return renderStateScratch;
  163695. }
  163696. ComputeEngine.prototype.execute = function(computeCommand) {
  163697. Check_default.defined("computeCommand", computeCommand);
  163698. if (defined_default(computeCommand.preExecute)) {
  163699. computeCommand.preExecute(computeCommand);
  163700. }
  163701. if (!defined_default(computeCommand.fragmentShaderSource) && !defined_default(computeCommand.shaderProgram)) {
  163702. throw new DeveloperError_default(
  163703. "computeCommand.fragmentShaderSource or computeCommand.shaderProgram is required."
  163704. );
  163705. }
  163706. Check_default.defined("computeCommand.outputTexture", computeCommand.outputTexture);
  163707. const outputTexture = computeCommand.outputTexture;
  163708. const width = outputTexture.width;
  163709. const height = outputTexture.height;
  163710. const context = this._context;
  163711. const vertexArray = defined_default(computeCommand.vertexArray) ? computeCommand.vertexArray : context.getViewportQuadVertexArray();
  163712. const shaderProgram = defined_default(computeCommand.shaderProgram) ? computeCommand.shaderProgram : createViewportQuadShader(context, computeCommand.fragmentShaderSource);
  163713. const framebuffer = createFramebuffer(context, outputTexture);
  163714. const renderState = createRenderState(width, height);
  163715. const uniformMap2 = computeCommand.uniformMap;
  163716. const clearCommand = clearCommandScratch;
  163717. clearCommand.framebuffer = framebuffer;
  163718. clearCommand.renderState = renderState;
  163719. clearCommand.execute(context);
  163720. const drawCommand = drawCommandScratch;
  163721. drawCommand.vertexArray = vertexArray;
  163722. drawCommand.renderState = renderState;
  163723. drawCommand.shaderProgram = shaderProgram;
  163724. drawCommand.uniformMap = uniformMap2;
  163725. drawCommand.framebuffer = framebuffer;
  163726. drawCommand.execute(context);
  163727. framebuffer.destroy();
  163728. if (!computeCommand.persists) {
  163729. shaderProgram.destroy();
  163730. if (defined_default(computeCommand.vertexArray)) {
  163731. vertexArray.destroy();
  163732. }
  163733. }
  163734. if (defined_default(computeCommand.postExecute)) {
  163735. computeCommand.postExecute(outputTexture);
  163736. }
  163737. };
  163738. ComputeEngine.prototype.isDestroyed = function() {
  163739. return false;
  163740. };
  163741. ComputeEngine.prototype.destroy = function() {
  163742. return destroyObject_default(this);
  163743. };
  163744. var ComputeEngine_default = ComputeEngine;
  163745. // node_modules/cesium/Source/Renderer/PassState.js
  163746. function PassState(context) {
  163747. this.context = context;
  163748. this.framebuffer = void 0;
  163749. this.blendingEnabled = void 0;
  163750. this.scissorTest = void 0;
  163751. this.viewport = void 0;
  163752. }
  163753. var PassState_default = PassState;
  163754. // node_modules/cesium/Source/Renderer/ShaderCache.js
  163755. function ShaderCache(context) {
  163756. this._context = context;
  163757. this._shaders = {};
  163758. this._numberOfShaders = 0;
  163759. this._shadersToRelease = {};
  163760. }
  163761. Object.defineProperties(ShaderCache.prototype, {
  163762. numberOfShaders: {
  163763. get: function() {
  163764. return this._numberOfShaders;
  163765. }
  163766. }
  163767. });
  163768. ShaderCache.prototype.replaceShaderProgram = function(options) {
  163769. if (defined_default(options.shaderProgram)) {
  163770. options.shaderProgram.destroy();
  163771. }
  163772. return this.getShaderProgram(options);
  163773. };
  163774. ShaderCache.prototype.getShaderProgram = function(options) {
  163775. let vertexShaderSource = options.vertexShaderSource;
  163776. let fragmentShaderSource = options.fragmentShaderSource;
  163777. const attributeLocations8 = options.attributeLocations;
  163778. if (typeof vertexShaderSource === "string") {
  163779. vertexShaderSource = new ShaderSource_default({
  163780. sources: [vertexShaderSource]
  163781. });
  163782. }
  163783. if (typeof fragmentShaderSource === "string") {
  163784. fragmentShaderSource = new ShaderSource_default({
  163785. sources: [fragmentShaderSource]
  163786. });
  163787. }
  163788. const vertexShaderText = vertexShaderSource.createCombinedVertexShader(
  163789. this._context
  163790. );
  163791. const fragmentShaderText = fragmentShaderSource.createCombinedFragmentShader(
  163792. this._context
  163793. );
  163794. const keyword = vertexShaderText + fragmentShaderText + JSON.stringify(attributeLocations8);
  163795. let cachedShader;
  163796. if (defined_default(this._shaders[keyword])) {
  163797. cachedShader = this._shaders[keyword];
  163798. delete this._shadersToRelease[keyword];
  163799. } else {
  163800. const context = this._context;
  163801. const shaderProgram = new ShaderProgram_default({
  163802. gl: context._gl,
  163803. logShaderCompilation: context.logShaderCompilation,
  163804. debugShaders: context.debugShaders,
  163805. vertexShaderSource,
  163806. vertexShaderText,
  163807. fragmentShaderSource,
  163808. fragmentShaderText,
  163809. attributeLocations: attributeLocations8
  163810. });
  163811. cachedShader = {
  163812. cache: this,
  163813. shaderProgram,
  163814. keyword,
  163815. derivedKeywords: [],
  163816. count: 0
  163817. };
  163818. shaderProgram._cachedShader = cachedShader;
  163819. this._shaders[keyword] = cachedShader;
  163820. ++this._numberOfShaders;
  163821. }
  163822. ++cachedShader.count;
  163823. return cachedShader.shaderProgram;
  163824. };
  163825. ShaderCache.prototype.replaceDerivedShaderProgram = function(shaderProgram, keyword, options) {
  163826. const cachedShader = shaderProgram._cachedShader;
  163827. const derivedKeyword = keyword + cachedShader.keyword;
  163828. const cachedDerivedShader = this._shaders[derivedKeyword];
  163829. if (defined_default(cachedDerivedShader)) {
  163830. destroyShader(this, cachedDerivedShader);
  163831. const index2 = cachedShader.derivedKeywords.indexOf(keyword);
  163832. if (index2 > -1) {
  163833. cachedShader.derivedKeywords.splice(index2, 1);
  163834. }
  163835. }
  163836. return this.createDerivedShaderProgram(shaderProgram, keyword, options);
  163837. };
  163838. ShaderCache.prototype.getDerivedShaderProgram = function(shaderProgram, keyword) {
  163839. const cachedShader = shaderProgram._cachedShader;
  163840. const derivedKeyword = keyword + cachedShader.keyword;
  163841. const cachedDerivedShader = this._shaders[derivedKeyword];
  163842. if (!defined_default(cachedDerivedShader)) {
  163843. return void 0;
  163844. }
  163845. return cachedDerivedShader.shaderProgram;
  163846. };
  163847. ShaderCache.prototype.createDerivedShaderProgram = function(shaderProgram, keyword, options) {
  163848. const cachedShader = shaderProgram._cachedShader;
  163849. const derivedKeyword = keyword + cachedShader.keyword;
  163850. let vertexShaderSource = options.vertexShaderSource;
  163851. let fragmentShaderSource = options.fragmentShaderSource;
  163852. const attributeLocations8 = options.attributeLocations;
  163853. if (typeof vertexShaderSource === "string") {
  163854. vertexShaderSource = new ShaderSource_default({
  163855. sources: [vertexShaderSource]
  163856. });
  163857. }
  163858. if (typeof fragmentShaderSource === "string") {
  163859. fragmentShaderSource = new ShaderSource_default({
  163860. sources: [fragmentShaderSource]
  163861. });
  163862. }
  163863. const context = this._context;
  163864. const vertexShaderText = vertexShaderSource.createCombinedVertexShader(
  163865. context
  163866. );
  163867. const fragmentShaderText = fragmentShaderSource.createCombinedFragmentShader(
  163868. context
  163869. );
  163870. const derivedShaderProgram = new ShaderProgram_default({
  163871. gl: context._gl,
  163872. logShaderCompilation: context.logShaderCompilation,
  163873. debugShaders: context.debugShaders,
  163874. vertexShaderSource,
  163875. vertexShaderText,
  163876. fragmentShaderSource,
  163877. fragmentShaderText,
  163878. attributeLocations: attributeLocations8
  163879. });
  163880. const derivedCachedShader = {
  163881. cache: this,
  163882. shaderProgram: derivedShaderProgram,
  163883. keyword: derivedKeyword,
  163884. derivedKeywords: [],
  163885. count: 0
  163886. };
  163887. cachedShader.derivedKeywords.push(keyword);
  163888. derivedShaderProgram._cachedShader = derivedCachedShader;
  163889. this._shaders[derivedKeyword] = derivedCachedShader;
  163890. return derivedShaderProgram;
  163891. };
  163892. function destroyShader(cache, cachedShader) {
  163893. const derivedKeywords = cachedShader.derivedKeywords;
  163894. const length3 = derivedKeywords.length;
  163895. for (let i2 = 0; i2 < length3; ++i2) {
  163896. const keyword = derivedKeywords[i2] + cachedShader.keyword;
  163897. const derivedCachedShader = cache._shaders[keyword];
  163898. destroyShader(cache, derivedCachedShader);
  163899. }
  163900. delete cache._shaders[cachedShader.keyword];
  163901. cachedShader.shaderProgram.finalDestroy();
  163902. }
  163903. ShaderCache.prototype.destroyReleasedShaderPrograms = function() {
  163904. const shadersToRelease = this._shadersToRelease;
  163905. for (const keyword in shadersToRelease) {
  163906. if (shadersToRelease.hasOwnProperty(keyword)) {
  163907. const cachedShader = shadersToRelease[keyword];
  163908. destroyShader(this, cachedShader);
  163909. --this._numberOfShaders;
  163910. }
  163911. }
  163912. this._shadersToRelease = {};
  163913. };
  163914. ShaderCache.prototype.releaseShaderProgram = function(shaderProgram) {
  163915. if (defined_default(shaderProgram)) {
  163916. const cachedShader = shaderProgram._cachedShader;
  163917. if (cachedShader && --cachedShader.count === 0) {
  163918. this._shadersToRelease[cachedShader.keyword] = cachedShader;
  163919. }
  163920. }
  163921. };
  163922. ShaderCache.prototype.isDestroyed = function() {
  163923. return false;
  163924. };
  163925. ShaderCache.prototype.destroy = function() {
  163926. const shaders = this._shaders;
  163927. for (const keyword in shaders) {
  163928. if (shaders.hasOwnProperty(keyword)) {
  163929. shaders[keyword].shaderProgram.finalDestroy();
  163930. }
  163931. }
  163932. return destroyObject_default(this);
  163933. };
  163934. var ShaderCache_default = ShaderCache;
  163935. // node_modules/cesium/Source/Renderer/TextureCache.js
  163936. function TextureCache() {
  163937. this._textures = {};
  163938. this._numberOfTextures = 0;
  163939. this._texturesToRelease = {};
  163940. }
  163941. Object.defineProperties(TextureCache.prototype, {
  163942. numberOfTextures: {
  163943. get: function() {
  163944. return this._numberOfTextures;
  163945. }
  163946. }
  163947. });
  163948. TextureCache.prototype.getTexture = function(keyword) {
  163949. const cachedTexture = this._textures[keyword];
  163950. if (!defined_default(cachedTexture)) {
  163951. return void 0;
  163952. }
  163953. delete this._texturesToRelease[keyword];
  163954. ++cachedTexture.count;
  163955. return cachedTexture.texture;
  163956. };
  163957. TextureCache.prototype.addTexture = function(keyword, texture) {
  163958. const cachedTexture = {
  163959. texture,
  163960. count: 1
  163961. };
  163962. texture.finalDestroy = texture.destroy;
  163963. const that = this;
  163964. texture.destroy = function() {
  163965. if (--cachedTexture.count === 0) {
  163966. that._texturesToRelease[keyword] = cachedTexture;
  163967. }
  163968. };
  163969. this._textures[keyword] = cachedTexture;
  163970. ++this._numberOfTextures;
  163971. };
  163972. TextureCache.prototype.destroyReleasedTextures = function() {
  163973. const texturesToRelease = this._texturesToRelease;
  163974. for (const keyword in texturesToRelease) {
  163975. if (texturesToRelease.hasOwnProperty(keyword)) {
  163976. const cachedTexture = texturesToRelease[keyword];
  163977. delete this._textures[keyword];
  163978. cachedTexture.texture.finalDestroy();
  163979. --this._numberOfTextures;
  163980. }
  163981. }
  163982. this._texturesToRelease = {};
  163983. };
  163984. TextureCache.prototype.isDestroyed = function() {
  163985. return false;
  163986. };
  163987. TextureCache.prototype.destroy = function() {
  163988. const textures = this._textures;
  163989. for (const keyword in textures) {
  163990. if (textures.hasOwnProperty(keyword)) {
  163991. textures[keyword].texture.finalDestroy();
  163992. }
  163993. }
  163994. return destroyObject_default(this);
  163995. };
  163996. var TextureCache_default = TextureCache;
  163997. // node_modules/cesium/Source/Scene/SunLight.js
  163998. function SunLight(options) {
  163999. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  164000. this.color = Color_default.clone(defaultValue_default(options.color, Color_default.WHITE));
  164001. this.intensity = defaultValue_default(options.intensity, 2);
  164002. }
  164003. var SunLight_default = SunLight;
  164004. // node_modules/cesium/Source/Renderer/UniformState.js
  164005. function UniformState() {
  164006. this.globeDepthTexture = void 0;
  164007. this.gamma = void 0;
  164008. this._viewport = new BoundingRectangle_default();
  164009. this._viewportCartesian4 = new Cartesian4_default();
  164010. this._viewportDirty = false;
  164011. this._viewportOrthographicMatrix = Matrix4_default.clone(Matrix4_default.IDENTITY);
  164012. this._viewportTransformation = Matrix4_default.clone(Matrix4_default.IDENTITY);
  164013. this._model = Matrix4_default.clone(Matrix4_default.IDENTITY);
  164014. this._view = Matrix4_default.clone(Matrix4_default.IDENTITY);
  164015. this._inverseView = Matrix4_default.clone(Matrix4_default.IDENTITY);
  164016. this._projection = Matrix4_default.clone(Matrix4_default.IDENTITY);
  164017. this._infiniteProjection = Matrix4_default.clone(Matrix4_default.IDENTITY);
  164018. this._entireFrustum = new Cartesian2_default();
  164019. this._currentFrustum = new Cartesian2_default();
  164020. this._frustumPlanes = new Cartesian4_default();
  164021. this._farDepthFromNearPlusOne = void 0;
  164022. this._log2FarDepthFromNearPlusOne = void 0;
  164023. this._oneOverLog2FarDepthFromNearPlusOne = void 0;
  164024. this._frameState = void 0;
  164025. this._temeToPseudoFixed = Matrix3_default.clone(Matrix4_default.IDENTITY);
  164026. this._view3DDirty = true;
  164027. this._view3D = new Matrix4_default();
  164028. this._inverseView3DDirty = true;
  164029. this._inverseView3D = new Matrix4_default();
  164030. this._inverseModelDirty = true;
  164031. this._inverseModel = new Matrix4_default();
  164032. this._inverseTransposeModelDirty = true;
  164033. this._inverseTransposeModel = new Matrix3_default();
  164034. this._viewRotation = new Matrix3_default();
  164035. this._inverseViewRotation = new Matrix3_default();
  164036. this._viewRotation3D = new Matrix3_default();
  164037. this._inverseViewRotation3D = new Matrix3_default();
  164038. this._inverseProjectionDirty = true;
  164039. this._inverseProjection = new Matrix4_default();
  164040. this._modelViewDirty = true;
  164041. this._modelView = new Matrix4_default();
  164042. this._modelView3DDirty = true;
  164043. this._modelView3D = new Matrix4_default();
  164044. this._modelViewRelativeToEyeDirty = true;
  164045. this._modelViewRelativeToEye = new Matrix4_default();
  164046. this._inverseModelViewDirty = true;
  164047. this._inverseModelView = new Matrix4_default();
  164048. this._inverseModelView3DDirty = true;
  164049. this._inverseModelView3D = new Matrix4_default();
  164050. this._viewProjectionDirty = true;
  164051. this._viewProjection = new Matrix4_default();
  164052. this._inverseViewProjectionDirty = true;
  164053. this._inverseViewProjection = new Matrix4_default();
  164054. this._modelViewProjectionDirty = true;
  164055. this._modelViewProjection = new Matrix4_default();
  164056. this._inverseModelViewProjectionDirty = true;
  164057. this._inverseModelViewProjection = new Matrix4_default();
  164058. this._modelViewProjectionRelativeToEyeDirty = true;
  164059. this._modelViewProjectionRelativeToEye = new Matrix4_default();
  164060. this._modelViewInfiniteProjectionDirty = true;
  164061. this._modelViewInfiniteProjection = new Matrix4_default();
  164062. this._normalDirty = true;
  164063. this._normal = new Matrix3_default();
  164064. this._normal3DDirty = true;
  164065. this._normal3D = new Matrix3_default();
  164066. this._inverseNormalDirty = true;
  164067. this._inverseNormal = new Matrix3_default();
  164068. this._inverseNormal3DDirty = true;
  164069. this._inverseNormal3D = new Matrix3_default();
  164070. this._encodedCameraPositionMCDirty = true;
  164071. this._encodedCameraPositionMC = new EncodedCartesian3_default();
  164072. this._cameraPosition = new Cartesian3_default();
  164073. this._sunPositionWC = new Cartesian3_default();
  164074. this._sunPositionColumbusView = new Cartesian3_default();
  164075. this._sunDirectionWC = new Cartesian3_default();
  164076. this._sunDirectionEC = new Cartesian3_default();
  164077. this._moonDirectionEC = new Cartesian3_default();
  164078. this._lightDirectionWC = new Cartesian3_default();
  164079. this._lightDirectionEC = new Cartesian3_default();
  164080. this._lightColor = new Cartesian3_default();
  164081. this._lightColorHdr = new Cartesian3_default();
  164082. this._pass = void 0;
  164083. this._mode = void 0;
  164084. this._mapProjection = void 0;
  164085. this._ellipsoid = void 0;
  164086. this._cameraDirection = new Cartesian3_default();
  164087. this._cameraRight = new Cartesian3_default();
  164088. this._cameraUp = new Cartesian3_default();
  164089. this._frustum2DWidth = 0;
  164090. this._eyeHeight = 0;
  164091. this._eyeHeight2D = new Cartesian2_default();
  164092. this._pixelRatio = 1;
  164093. this._orthographicIn3D = false;
  164094. this._backgroundColor = new Color_default();
  164095. this._brdfLut = void 0;
  164096. this._environmentMap = void 0;
  164097. this._sphericalHarmonicCoefficients = void 0;
  164098. this._specularEnvironmentMaps = void 0;
  164099. this._specularEnvironmentMapsDimensions = new Cartesian2_default();
  164100. this._specularEnvironmentMapsMaximumLOD = void 0;
  164101. this._fogDensity = void 0;
  164102. this._invertClassificationColor = void 0;
  164103. this._splitPosition = 0;
  164104. this._pixelSizePerMeter = void 0;
  164105. this._geometricToleranceOverMeter = void 0;
  164106. this._minimumDisableDepthTestDistance = void 0;
  164107. }
  164108. Object.defineProperties(UniformState.prototype, {
  164109. frameState: {
  164110. get: function() {
  164111. return this._frameState;
  164112. }
  164113. },
  164114. viewport: {
  164115. get: function() {
  164116. return this._viewport;
  164117. },
  164118. set: function(viewport) {
  164119. if (!BoundingRectangle_default.equals(viewport, this._viewport)) {
  164120. BoundingRectangle_default.clone(viewport, this._viewport);
  164121. const v7 = this._viewport;
  164122. const vc = this._viewportCartesian4;
  164123. vc.x = v7.x;
  164124. vc.y = v7.y;
  164125. vc.z = v7.width;
  164126. vc.w = v7.height;
  164127. this._viewportDirty = true;
  164128. }
  164129. }
  164130. },
  164131. viewportCartesian4: {
  164132. get: function() {
  164133. return this._viewportCartesian4;
  164134. }
  164135. },
  164136. viewportOrthographic: {
  164137. get: function() {
  164138. cleanViewport(this);
  164139. return this._viewportOrthographicMatrix;
  164140. }
  164141. },
  164142. viewportTransformation: {
  164143. get: function() {
  164144. cleanViewport(this);
  164145. return this._viewportTransformation;
  164146. }
  164147. },
  164148. model: {
  164149. get: function() {
  164150. return this._model;
  164151. },
  164152. set: function(matrix) {
  164153. Matrix4_default.clone(matrix, this._model);
  164154. this._modelView3DDirty = true;
  164155. this._inverseModelView3DDirty = true;
  164156. this._inverseModelDirty = true;
  164157. this._inverseTransposeModelDirty = true;
  164158. this._modelViewDirty = true;
  164159. this._inverseModelViewDirty = true;
  164160. this._modelViewRelativeToEyeDirty = true;
  164161. this._inverseModelViewDirty = true;
  164162. this._modelViewProjectionDirty = true;
  164163. this._inverseModelViewProjectionDirty = true;
  164164. this._modelViewProjectionRelativeToEyeDirty = true;
  164165. this._modelViewInfiniteProjectionDirty = true;
  164166. this._normalDirty = true;
  164167. this._inverseNormalDirty = true;
  164168. this._normal3DDirty = true;
  164169. this._inverseNormal3DDirty = true;
  164170. this._encodedCameraPositionMCDirty = true;
  164171. }
  164172. },
  164173. inverseModel: {
  164174. get: function() {
  164175. if (this._inverseModelDirty) {
  164176. this._inverseModelDirty = false;
  164177. Matrix4_default.inverse(this._model, this._inverseModel);
  164178. }
  164179. return this._inverseModel;
  164180. }
  164181. },
  164182. inverseTransposeModel: {
  164183. get: function() {
  164184. const m = this._inverseTransposeModel;
  164185. if (this._inverseTransposeModelDirty) {
  164186. this._inverseTransposeModelDirty = false;
  164187. Matrix4_default.getMatrix3(this.inverseModel, m);
  164188. Matrix3_default.transpose(m, m);
  164189. }
  164190. return m;
  164191. }
  164192. },
  164193. view: {
  164194. get: function() {
  164195. return this._view;
  164196. }
  164197. },
  164198. view3D: {
  164199. get: function() {
  164200. updateView3D(this);
  164201. return this._view3D;
  164202. }
  164203. },
  164204. viewRotation: {
  164205. get: function() {
  164206. updateView3D(this);
  164207. return this._viewRotation;
  164208. }
  164209. },
  164210. viewRotation3D: {
  164211. get: function() {
  164212. updateView3D(this);
  164213. return this._viewRotation3D;
  164214. }
  164215. },
  164216. inverseView: {
  164217. get: function() {
  164218. return this._inverseView;
  164219. }
  164220. },
  164221. inverseView3D: {
  164222. get: function() {
  164223. updateInverseView3D(this);
  164224. return this._inverseView3D;
  164225. }
  164226. },
  164227. inverseViewRotation: {
  164228. get: function() {
  164229. return this._inverseViewRotation;
  164230. }
  164231. },
  164232. inverseViewRotation3D: {
  164233. get: function() {
  164234. updateInverseView3D(this);
  164235. return this._inverseViewRotation3D;
  164236. }
  164237. },
  164238. projection: {
  164239. get: function() {
  164240. return this._projection;
  164241. }
  164242. },
  164243. inverseProjection: {
  164244. get: function() {
  164245. cleanInverseProjection(this);
  164246. return this._inverseProjection;
  164247. }
  164248. },
  164249. infiniteProjection: {
  164250. get: function() {
  164251. return this._infiniteProjection;
  164252. }
  164253. },
  164254. modelView: {
  164255. get: function() {
  164256. cleanModelView(this);
  164257. return this._modelView;
  164258. }
  164259. },
  164260. modelView3D: {
  164261. get: function() {
  164262. cleanModelView3D(this);
  164263. return this._modelView3D;
  164264. }
  164265. },
  164266. modelViewRelativeToEye: {
  164267. get: function() {
  164268. cleanModelViewRelativeToEye(this);
  164269. return this._modelViewRelativeToEye;
  164270. }
  164271. },
  164272. inverseModelView: {
  164273. get: function() {
  164274. cleanInverseModelView(this);
  164275. return this._inverseModelView;
  164276. }
  164277. },
  164278. inverseModelView3D: {
  164279. get: function() {
  164280. cleanInverseModelView3D(this);
  164281. return this._inverseModelView3D;
  164282. }
  164283. },
  164284. viewProjection: {
  164285. get: function() {
  164286. cleanViewProjection(this);
  164287. return this._viewProjection;
  164288. }
  164289. },
  164290. inverseViewProjection: {
  164291. get: function() {
  164292. cleanInverseViewProjection(this);
  164293. return this._inverseViewProjection;
  164294. }
  164295. },
  164296. modelViewProjection: {
  164297. get: function() {
  164298. cleanModelViewProjection(this);
  164299. return this._modelViewProjection;
  164300. }
  164301. },
  164302. inverseModelViewProjection: {
  164303. get: function() {
  164304. cleanInverseModelViewProjection(this);
  164305. return this._inverseModelViewProjection;
  164306. }
  164307. },
  164308. modelViewProjectionRelativeToEye: {
  164309. get: function() {
  164310. cleanModelViewProjectionRelativeToEye(this);
  164311. return this._modelViewProjectionRelativeToEye;
  164312. }
  164313. },
  164314. modelViewInfiniteProjection: {
  164315. get: function() {
  164316. cleanModelViewInfiniteProjection(this);
  164317. return this._modelViewInfiniteProjection;
  164318. }
  164319. },
  164320. normal: {
  164321. get: function() {
  164322. cleanNormal(this);
  164323. return this._normal;
  164324. }
  164325. },
  164326. normal3D: {
  164327. get: function() {
  164328. cleanNormal3D(this);
  164329. return this._normal3D;
  164330. }
  164331. },
  164332. inverseNormal: {
  164333. get: function() {
  164334. cleanInverseNormal(this);
  164335. return this._inverseNormal;
  164336. }
  164337. },
  164338. inverseNormal3D: {
  164339. get: function() {
  164340. cleanInverseNormal3D(this);
  164341. return this._inverseNormal3D;
  164342. }
  164343. },
  164344. entireFrustum: {
  164345. get: function() {
  164346. return this._entireFrustum;
  164347. }
  164348. },
  164349. currentFrustum: {
  164350. get: function() {
  164351. return this._currentFrustum;
  164352. }
  164353. },
  164354. frustumPlanes: {
  164355. get: function() {
  164356. return this._frustumPlanes;
  164357. }
  164358. },
  164359. farDepthFromNearPlusOne: {
  164360. get: function() {
  164361. return this._farDepthFromNearPlusOne;
  164362. }
  164363. },
  164364. log2FarDepthFromNearPlusOne: {
  164365. get: function() {
  164366. return this._log2FarDepthFromNearPlusOne;
  164367. }
  164368. },
  164369. oneOverLog2FarDepthFromNearPlusOne: {
  164370. get: function() {
  164371. return this._oneOverLog2FarDepthFromNearPlusOne;
  164372. }
  164373. },
  164374. eyeHeight: {
  164375. get: function() {
  164376. return this._eyeHeight;
  164377. }
  164378. },
  164379. eyeHeight2D: {
  164380. get: function() {
  164381. return this._eyeHeight2D;
  164382. }
  164383. },
  164384. sunPositionWC: {
  164385. get: function() {
  164386. return this._sunPositionWC;
  164387. }
  164388. },
  164389. sunPositionColumbusView: {
  164390. get: function() {
  164391. return this._sunPositionColumbusView;
  164392. }
  164393. },
  164394. sunDirectionWC: {
  164395. get: function() {
  164396. return this._sunDirectionWC;
  164397. }
  164398. },
  164399. sunDirectionEC: {
  164400. get: function() {
  164401. return this._sunDirectionEC;
  164402. }
  164403. },
  164404. moonDirectionEC: {
  164405. get: function() {
  164406. return this._moonDirectionEC;
  164407. }
  164408. },
  164409. lightDirectionWC: {
  164410. get: function() {
  164411. return this._lightDirectionWC;
  164412. }
  164413. },
  164414. lightDirectionEC: {
  164415. get: function() {
  164416. return this._lightDirectionEC;
  164417. }
  164418. },
  164419. lightColor: {
  164420. get: function() {
  164421. return this._lightColor;
  164422. }
  164423. },
  164424. lightColorHdr: {
  164425. get: function() {
  164426. return this._lightColorHdr;
  164427. }
  164428. },
  164429. encodedCameraPositionMCHigh: {
  164430. get: function() {
  164431. cleanEncodedCameraPositionMC(this);
  164432. return this._encodedCameraPositionMC.high;
  164433. }
  164434. },
  164435. encodedCameraPositionMCLow: {
  164436. get: function() {
  164437. cleanEncodedCameraPositionMC(this);
  164438. return this._encodedCameraPositionMC.low;
  164439. }
  164440. },
  164441. temeToPseudoFixedMatrix: {
  164442. get: function() {
  164443. return this._temeToPseudoFixed;
  164444. }
  164445. },
  164446. pixelRatio: {
  164447. get: function() {
  164448. return this._pixelRatio;
  164449. }
  164450. },
  164451. fogDensity: {
  164452. get: function() {
  164453. return this._fogDensity;
  164454. }
  164455. },
  164456. geometricToleranceOverMeter: {
  164457. get: function() {
  164458. return this._geometricToleranceOverMeter;
  164459. }
  164460. },
  164461. pass: {
  164462. get: function() {
  164463. return this._pass;
  164464. }
  164465. },
  164466. backgroundColor: {
  164467. get: function() {
  164468. return this._backgroundColor;
  164469. }
  164470. },
  164471. brdfLut: {
  164472. get: function() {
  164473. return this._brdfLut;
  164474. }
  164475. },
  164476. environmentMap: {
  164477. get: function() {
  164478. return this._environmentMap;
  164479. }
  164480. },
  164481. sphericalHarmonicCoefficients: {
  164482. get: function() {
  164483. return this._sphericalHarmonicCoefficients;
  164484. }
  164485. },
  164486. specularEnvironmentMaps: {
  164487. get: function() {
  164488. return this._specularEnvironmentMaps;
  164489. }
  164490. },
  164491. specularEnvironmentMapsDimensions: {
  164492. get: function() {
  164493. return this._specularEnvironmentMapsDimensions;
  164494. }
  164495. },
  164496. specularEnvironmentMapsMaximumLOD: {
  164497. get: function() {
  164498. return this._specularEnvironmentMapsMaximumLOD;
  164499. }
  164500. },
  164501. imagerySplitPosition: {
  164502. get: function() {
  164503. deprecationWarning_default(
  164504. "UniformState.imagerySplitPosition",
  164505. "czm_imagerySplitPosition has been deprecated in Cesium 1.92. It will be removed in Cesium 1.94. Use czm_splitPosition instead."
  164506. );
  164507. return this._splitPosition;
  164508. }
  164509. },
  164510. splitPosition: {
  164511. get: function() {
  164512. return this._splitPosition;
  164513. }
  164514. },
  164515. minimumDisableDepthTestDistance: {
  164516. get: function() {
  164517. return this._minimumDisableDepthTestDistance;
  164518. }
  164519. },
  164520. invertClassificationColor: {
  164521. get: function() {
  164522. return this._invertClassificationColor;
  164523. }
  164524. },
  164525. orthographicIn3D: {
  164526. get: function() {
  164527. return this._orthographicIn3D;
  164528. }
  164529. },
  164530. ellipsoid: {
  164531. get: function() {
  164532. return defaultValue_default(this._ellipsoid, Ellipsoid_default.WGS84);
  164533. }
  164534. }
  164535. });
  164536. function setView(uniformState, matrix) {
  164537. Matrix4_default.clone(matrix, uniformState._view);
  164538. Matrix4_default.getMatrix3(matrix, uniformState._viewRotation);
  164539. uniformState._view3DDirty = true;
  164540. uniformState._inverseView3DDirty = true;
  164541. uniformState._modelViewDirty = true;
  164542. uniformState._modelView3DDirty = true;
  164543. uniformState._modelViewRelativeToEyeDirty = true;
  164544. uniformState._inverseModelViewDirty = true;
  164545. uniformState._inverseModelView3DDirty = true;
  164546. uniformState._viewProjectionDirty = true;
  164547. uniformState._inverseViewProjectionDirty = true;
  164548. uniformState._modelViewProjectionDirty = true;
  164549. uniformState._modelViewProjectionRelativeToEyeDirty = true;
  164550. uniformState._modelViewInfiniteProjectionDirty = true;
  164551. uniformState._normalDirty = true;
  164552. uniformState._inverseNormalDirty = true;
  164553. uniformState._normal3DDirty = true;
  164554. uniformState._inverseNormal3DDirty = true;
  164555. }
  164556. function setInverseView(uniformState, matrix) {
  164557. Matrix4_default.clone(matrix, uniformState._inverseView);
  164558. Matrix4_default.getMatrix3(matrix, uniformState._inverseViewRotation);
  164559. }
  164560. function setProjection(uniformState, matrix) {
  164561. Matrix4_default.clone(matrix, uniformState._projection);
  164562. uniformState._inverseProjectionDirty = true;
  164563. uniformState._viewProjectionDirty = true;
  164564. uniformState._inverseViewProjectionDirty = true;
  164565. uniformState._modelViewProjectionDirty = true;
  164566. uniformState._modelViewProjectionRelativeToEyeDirty = true;
  164567. }
  164568. function setInfiniteProjection(uniformState, matrix) {
  164569. Matrix4_default.clone(matrix, uniformState._infiniteProjection);
  164570. uniformState._modelViewInfiniteProjectionDirty = true;
  164571. }
  164572. function setCamera(uniformState, camera) {
  164573. Cartesian3_default.clone(camera.positionWC, uniformState._cameraPosition);
  164574. Cartesian3_default.clone(camera.directionWC, uniformState._cameraDirection);
  164575. Cartesian3_default.clone(camera.rightWC, uniformState._cameraRight);
  164576. Cartesian3_default.clone(camera.upWC, uniformState._cameraUp);
  164577. const positionCartographic = camera.positionCartographic;
  164578. if (!defined_default(positionCartographic)) {
  164579. uniformState._eyeHeight = -uniformState._ellipsoid.maximumRadius;
  164580. } else {
  164581. uniformState._eyeHeight = positionCartographic.height;
  164582. }
  164583. uniformState._encodedCameraPositionMCDirty = true;
  164584. }
  164585. var transformMatrix = new Matrix3_default();
  164586. var sunCartographicScratch = new Cartographic_default();
  164587. function setSunAndMoonDirections(uniformState, frameState) {
  164588. if (!defined_default(
  164589. Transforms_default.computeIcrfToFixedMatrix(frameState.time, transformMatrix)
  164590. )) {
  164591. transformMatrix = Transforms_default.computeTemeToPseudoFixedMatrix(
  164592. frameState.time,
  164593. transformMatrix
  164594. );
  164595. }
  164596. let position = Simon1994PlanetaryPositions_default.computeSunPositionInEarthInertialFrame(
  164597. frameState.time,
  164598. uniformState._sunPositionWC
  164599. );
  164600. Matrix3_default.multiplyByVector(transformMatrix, position, position);
  164601. Cartesian3_default.normalize(position, uniformState._sunDirectionWC);
  164602. position = Matrix3_default.multiplyByVector(
  164603. uniformState.viewRotation3D,
  164604. position,
  164605. uniformState._sunDirectionEC
  164606. );
  164607. Cartesian3_default.normalize(position, position);
  164608. position = Simon1994PlanetaryPositions_default.computeMoonPositionInEarthInertialFrame(
  164609. frameState.time,
  164610. uniformState._moonDirectionEC
  164611. );
  164612. Matrix3_default.multiplyByVector(transformMatrix, position, position);
  164613. Matrix3_default.multiplyByVector(uniformState.viewRotation3D, position, position);
  164614. Cartesian3_default.normalize(position, position);
  164615. const projection = frameState.mapProjection;
  164616. const ellipsoid = projection.ellipsoid;
  164617. const sunCartographic = ellipsoid.cartesianToCartographic(
  164618. uniformState._sunPositionWC,
  164619. sunCartographicScratch
  164620. );
  164621. projection.project(sunCartographic, uniformState._sunPositionColumbusView);
  164622. }
  164623. UniformState.prototype.updateCamera = function(camera) {
  164624. setView(this, camera.viewMatrix);
  164625. setInverseView(this, camera.inverseViewMatrix);
  164626. setCamera(this, camera);
  164627. this._entireFrustum.x = camera.frustum.near;
  164628. this._entireFrustum.y = camera.frustum.far;
  164629. this.updateFrustum(camera.frustum);
  164630. this._orthographicIn3D = this._mode !== SceneMode_default.SCENE2D && camera.frustum instanceof OrthographicFrustum_default;
  164631. };
  164632. UniformState.prototype.updateFrustum = function(frustum) {
  164633. setProjection(this, frustum.projectionMatrix);
  164634. if (defined_default(frustum.infiniteProjectionMatrix)) {
  164635. setInfiniteProjection(this, frustum.infiniteProjectionMatrix);
  164636. }
  164637. this._currentFrustum.x = frustum.near;
  164638. this._currentFrustum.y = frustum.far;
  164639. this._farDepthFromNearPlusOne = frustum.far - frustum.near + 1;
  164640. this._log2FarDepthFromNearPlusOne = Math_default.log2(
  164641. this._farDepthFromNearPlusOne
  164642. );
  164643. this._oneOverLog2FarDepthFromNearPlusOne = 1 / this._log2FarDepthFromNearPlusOne;
  164644. if (defined_default(frustum._offCenterFrustum)) {
  164645. frustum = frustum._offCenterFrustum;
  164646. }
  164647. this._frustumPlanes.x = frustum.top;
  164648. this._frustumPlanes.y = frustum.bottom;
  164649. this._frustumPlanes.z = frustum.left;
  164650. this._frustumPlanes.w = frustum.right;
  164651. };
  164652. UniformState.prototype.updatePass = function(pass) {
  164653. this._pass = pass;
  164654. };
  164655. var EMPTY_ARRAY = [];
  164656. var defaultLight = new SunLight_default();
  164657. UniformState.prototype.update = function(frameState) {
  164658. this._mode = frameState.mode;
  164659. this._mapProjection = frameState.mapProjection;
  164660. this._ellipsoid = frameState.mapProjection.ellipsoid;
  164661. this._pixelRatio = frameState.pixelRatio;
  164662. const camera = frameState.camera;
  164663. this.updateCamera(camera);
  164664. if (frameState.mode === SceneMode_default.SCENE2D) {
  164665. this._frustum2DWidth = camera.frustum.right - camera.frustum.left;
  164666. this._eyeHeight2D.x = this._frustum2DWidth * 0.5;
  164667. this._eyeHeight2D.y = this._eyeHeight2D.x * this._eyeHeight2D.x;
  164668. } else {
  164669. this._frustum2DWidth = 0;
  164670. this._eyeHeight2D.x = 0;
  164671. this._eyeHeight2D.y = 0;
  164672. }
  164673. setSunAndMoonDirections(this, frameState);
  164674. const light = defaultValue_default(frameState.light, defaultLight);
  164675. if (light instanceof SunLight_default) {
  164676. this._lightDirectionWC = Cartesian3_default.clone(
  164677. this._sunDirectionWC,
  164678. this._lightDirectionWC
  164679. );
  164680. this._lightDirectionEC = Cartesian3_default.clone(
  164681. this._sunDirectionEC,
  164682. this._lightDirectionEC
  164683. );
  164684. } else {
  164685. this._lightDirectionWC = Cartesian3_default.normalize(
  164686. Cartesian3_default.negate(light.direction, this._lightDirectionWC),
  164687. this._lightDirectionWC
  164688. );
  164689. this._lightDirectionEC = Matrix3_default.multiplyByVector(
  164690. this.viewRotation3D,
  164691. this._lightDirectionWC,
  164692. this._lightDirectionEC
  164693. );
  164694. }
  164695. const lightColor = light.color;
  164696. let lightColorHdr = Cartesian3_default.fromElements(
  164697. lightColor.red,
  164698. lightColor.green,
  164699. lightColor.blue,
  164700. this._lightColorHdr
  164701. );
  164702. lightColorHdr = Cartesian3_default.multiplyByScalar(
  164703. lightColorHdr,
  164704. light.intensity,
  164705. lightColorHdr
  164706. );
  164707. const maximumComponent = Cartesian3_default.maximumComponent(lightColorHdr);
  164708. if (maximumComponent > 1) {
  164709. Cartesian3_default.divideByScalar(
  164710. lightColorHdr,
  164711. maximumComponent,
  164712. this._lightColor
  164713. );
  164714. } else {
  164715. Cartesian3_default.clone(lightColorHdr, this._lightColor);
  164716. }
  164717. const brdfLutGenerator = frameState.brdfLutGenerator;
  164718. const brdfLut = defined_default(brdfLutGenerator) ? brdfLutGenerator.colorTexture : void 0;
  164719. this._brdfLut = brdfLut;
  164720. this._environmentMap = defaultValue_default(
  164721. frameState.environmentMap,
  164722. frameState.context.defaultCubeMap
  164723. );
  164724. this._sphericalHarmonicCoefficients = defaultValue_default(
  164725. frameState.sphericalHarmonicCoefficients,
  164726. EMPTY_ARRAY
  164727. );
  164728. this._specularEnvironmentMaps = frameState.specularEnvironmentMaps;
  164729. this._specularEnvironmentMapsMaximumLOD = frameState.specularEnvironmentMapsMaximumLOD;
  164730. if (defined_default(this._specularEnvironmentMaps)) {
  164731. Cartesian2_default.clone(
  164732. this._specularEnvironmentMaps.dimensions,
  164733. this._specularEnvironmentMapsDimensions
  164734. );
  164735. }
  164736. this._fogDensity = frameState.fog.density;
  164737. this._invertClassificationColor = frameState.invertClassificationColor;
  164738. this._frameState = frameState;
  164739. this._temeToPseudoFixed = Transforms_default.computeTemeToPseudoFixedMatrix(
  164740. frameState.time,
  164741. this._temeToPseudoFixed
  164742. );
  164743. this._splitPosition = frameState.splitPosition * frameState.context.drawingBufferWidth;
  164744. const fov = camera.frustum.fov;
  164745. const viewport = this._viewport;
  164746. let pixelSizePerMeter;
  164747. if (defined_default(fov)) {
  164748. if (viewport.height > viewport.width) {
  164749. pixelSizePerMeter = Math.tan(0.5 * fov) * 2 / viewport.height;
  164750. } else {
  164751. pixelSizePerMeter = Math.tan(0.5 * fov) * 2 / viewport.width;
  164752. }
  164753. } else {
  164754. pixelSizePerMeter = 1 / Math.max(viewport.width, viewport.height);
  164755. }
  164756. this._geometricToleranceOverMeter = pixelSizePerMeter * frameState.maximumScreenSpaceError;
  164757. Color_default.clone(frameState.backgroundColor, this._backgroundColor);
  164758. this._minimumDisableDepthTestDistance = frameState.minimumDisableDepthTestDistance;
  164759. this._minimumDisableDepthTestDistance *= this._minimumDisableDepthTestDistance;
  164760. if (this._minimumDisableDepthTestDistance === Number.POSITIVE_INFINITY) {
  164761. this._minimumDisableDepthTestDistance = -1;
  164762. }
  164763. };
  164764. function cleanViewport(uniformState) {
  164765. if (uniformState._viewportDirty) {
  164766. const v7 = uniformState._viewport;
  164767. Matrix4_default.computeOrthographicOffCenter(
  164768. v7.x,
  164769. v7.x + v7.width,
  164770. v7.y,
  164771. v7.y + v7.height,
  164772. 0,
  164773. 1,
  164774. uniformState._viewportOrthographicMatrix
  164775. );
  164776. Matrix4_default.computeViewportTransformation(
  164777. v7,
  164778. 0,
  164779. 1,
  164780. uniformState._viewportTransformation
  164781. );
  164782. uniformState._viewportDirty = false;
  164783. }
  164784. }
  164785. function cleanInverseProjection(uniformState) {
  164786. if (uniformState._inverseProjectionDirty) {
  164787. uniformState._inverseProjectionDirty = false;
  164788. if (uniformState._mode !== SceneMode_default.SCENE2D && uniformState._mode !== SceneMode_default.MORPHING && !uniformState._orthographicIn3D) {
  164789. Matrix4_default.inverse(
  164790. uniformState._projection,
  164791. uniformState._inverseProjection
  164792. );
  164793. } else {
  164794. Matrix4_default.clone(Matrix4_default.ZERO, uniformState._inverseProjection);
  164795. }
  164796. }
  164797. }
  164798. function cleanModelView(uniformState) {
  164799. if (uniformState._modelViewDirty) {
  164800. uniformState._modelViewDirty = false;
  164801. Matrix4_default.multiplyTransformation(
  164802. uniformState._view,
  164803. uniformState._model,
  164804. uniformState._modelView
  164805. );
  164806. }
  164807. }
  164808. function cleanModelView3D(uniformState) {
  164809. if (uniformState._modelView3DDirty) {
  164810. uniformState._modelView3DDirty = false;
  164811. Matrix4_default.multiplyTransformation(
  164812. uniformState.view3D,
  164813. uniformState._model,
  164814. uniformState._modelView3D
  164815. );
  164816. }
  164817. }
  164818. function cleanInverseModelView(uniformState) {
  164819. if (uniformState._inverseModelViewDirty) {
  164820. uniformState._inverseModelViewDirty = false;
  164821. Matrix4_default.inverse(uniformState.modelView, uniformState._inverseModelView);
  164822. }
  164823. }
  164824. function cleanInverseModelView3D(uniformState) {
  164825. if (uniformState._inverseModelView3DDirty) {
  164826. uniformState._inverseModelView3DDirty = false;
  164827. Matrix4_default.inverse(uniformState.modelView3D, uniformState._inverseModelView3D);
  164828. }
  164829. }
  164830. function cleanViewProjection(uniformState) {
  164831. if (uniformState._viewProjectionDirty) {
  164832. uniformState._viewProjectionDirty = false;
  164833. Matrix4_default.multiply(
  164834. uniformState._projection,
  164835. uniformState._view,
  164836. uniformState._viewProjection
  164837. );
  164838. }
  164839. }
  164840. function cleanInverseViewProjection(uniformState) {
  164841. if (uniformState._inverseViewProjectionDirty) {
  164842. uniformState._inverseViewProjectionDirty = false;
  164843. Matrix4_default.inverse(
  164844. uniformState.viewProjection,
  164845. uniformState._inverseViewProjection
  164846. );
  164847. }
  164848. }
  164849. function cleanModelViewProjection(uniformState) {
  164850. if (uniformState._modelViewProjectionDirty) {
  164851. uniformState._modelViewProjectionDirty = false;
  164852. Matrix4_default.multiply(
  164853. uniformState._projection,
  164854. uniformState.modelView,
  164855. uniformState._modelViewProjection
  164856. );
  164857. }
  164858. }
  164859. function cleanModelViewRelativeToEye(uniformState) {
  164860. if (uniformState._modelViewRelativeToEyeDirty) {
  164861. uniformState._modelViewRelativeToEyeDirty = false;
  164862. const mv = uniformState.modelView;
  164863. const mvRte = uniformState._modelViewRelativeToEye;
  164864. mvRte[0] = mv[0];
  164865. mvRte[1] = mv[1];
  164866. mvRte[2] = mv[2];
  164867. mvRte[3] = mv[3];
  164868. mvRte[4] = mv[4];
  164869. mvRte[5] = mv[5];
  164870. mvRte[6] = mv[6];
  164871. mvRte[7] = mv[7];
  164872. mvRte[8] = mv[8];
  164873. mvRte[9] = mv[9];
  164874. mvRte[10] = mv[10];
  164875. mvRte[11] = mv[11];
  164876. mvRte[12] = 0;
  164877. mvRte[13] = 0;
  164878. mvRte[14] = 0;
  164879. mvRte[15] = mv[15];
  164880. }
  164881. }
  164882. function cleanInverseModelViewProjection(uniformState) {
  164883. if (uniformState._inverseModelViewProjectionDirty) {
  164884. uniformState._inverseModelViewProjectionDirty = false;
  164885. Matrix4_default.inverse(
  164886. uniformState.modelViewProjection,
  164887. uniformState._inverseModelViewProjection
  164888. );
  164889. }
  164890. }
  164891. function cleanModelViewProjectionRelativeToEye(uniformState) {
  164892. if (uniformState._modelViewProjectionRelativeToEyeDirty) {
  164893. uniformState._modelViewProjectionRelativeToEyeDirty = false;
  164894. Matrix4_default.multiply(
  164895. uniformState._projection,
  164896. uniformState.modelViewRelativeToEye,
  164897. uniformState._modelViewProjectionRelativeToEye
  164898. );
  164899. }
  164900. }
  164901. function cleanModelViewInfiniteProjection(uniformState) {
  164902. if (uniformState._modelViewInfiniteProjectionDirty) {
  164903. uniformState._modelViewInfiniteProjectionDirty = false;
  164904. Matrix4_default.multiply(
  164905. uniformState._infiniteProjection,
  164906. uniformState.modelView,
  164907. uniformState._modelViewInfiniteProjection
  164908. );
  164909. }
  164910. }
  164911. function cleanNormal(uniformState) {
  164912. if (uniformState._normalDirty) {
  164913. uniformState._normalDirty = false;
  164914. const m = uniformState._normal;
  164915. Matrix4_default.getMatrix3(uniformState.inverseModelView, m);
  164916. Matrix3_default.getRotation(m, m);
  164917. Matrix3_default.transpose(m, m);
  164918. }
  164919. }
  164920. function cleanNormal3D(uniformState) {
  164921. if (uniformState._normal3DDirty) {
  164922. uniformState._normal3DDirty = false;
  164923. const m = uniformState._normal3D;
  164924. Matrix4_default.getMatrix3(uniformState.inverseModelView3D, m);
  164925. Matrix3_default.getRotation(m, m);
  164926. Matrix3_default.transpose(m, m);
  164927. }
  164928. }
  164929. function cleanInverseNormal(uniformState) {
  164930. if (uniformState._inverseNormalDirty) {
  164931. uniformState._inverseNormalDirty = false;
  164932. Matrix4_default.getMatrix3(
  164933. uniformState.inverseModelView,
  164934. uniformState._inverseNormal
  164935. );
  164936. Matrix3_default.getRotation(
  164937. uniformState._inverseNormal,
  164938. uniformState._inverseNormal
  164939. );
  164940. }
  164941. }
  164942. function cleanInverseNormal3D(uniformState) {
  164943. if (uniformState._inverseNormal3DDirty) {
  164944. uniformState._inverseNormal3DDirty = false;
  164945. Matrix4_default.getMatrix3(
  164946. uniformState.inverseModelView3D,
  164947. uniformState._inverseNormal3D
  164948. );
  164949. Matrix3_default.getRotation(
  164950. uniformState._inverseNormal3D,
  164951. uniformState._inverseNormal3D
  164952. );
  164953. }
  164954. }
  164955. var cameraPositionMC = new Cartesian3_default();
  164956. function cleanEncodedCameraPositionMC(uniformState) {
  164957. if (uniformState._encodedCameraPositionMCDirty) {
  164958. uniformState._encodedCameraPositionMCDirty = false;
  164959. Matrix4_default.multiplyByPoint(
  164960. uniformState.inverseModel,
  164961. uniformState._cameraPosition,
  164962. cameraPositionMC
  164963. );
  164964. EncodedCartesian3_default.fromCartesian(
  164965. cameraPositionMC,
  164966. uniformState._encodedCameraPositionMC
  164967. );
  164968. }
  164969. }
  164970. var view2Dto3DPScratch = new Cartesian3_default();
  164971. var view2Dto3DRScratch = new Cartesian3_default();
  164972. var view2Dto3DUScratch = new Cartesian3_default();
  164973. var view2Dto3DDScratch = new Cartesian3_default();
  164974. var view2Dto3DCartographicScratch = new Cartographic_default();
  164975. var view2Dto3DCartesian3Scratch = new Cartesian3_default();
  164976. var view2Dto3DMatrix4Scratch = new Matrix4_default();
  164977. function view2Dto3D(position2D, direction2D, right2D, up2D, frustum2DWidth, mode2, projection, result) {
  164978. const p2 = view2Dto3DPScratch;
  164979. p2.x = position2D.y;
  164980. p2.y = position2D.z;
  164981. p2.z = position2D.x;
  164982. const r2 = view2Dto3DRScratch;
  164983. r2.x = right2D.y;
  164984. r2.y = right2D.z;
  164985. r2.z = right2D.x;
  164986. const u3 = view2Dto3DUScratch;
  164987. u3.x = up2D.y;
  164988. u3.y = up2D.z;
  164989. u3.z = up2D.x;
  164990. const d = view2Dto3DDScratch;
  164991. d.x = direction2D.y;
  164992. d.y = direction2D.z;
  164993. d.z = direction2D.x;
  164994. if (mode2 === SceneMode_default.SCENE2D) {
  164995. p2.z = frustum2DWidth * 0.5;
  164996. }
  164997. const cartographic2 = projection.unproject(p2, view2Dto3DCartographicScratch);
  164998. cartographic2.longitude = Math_default.clamp(
  164999. cartographic2.longitude,
  165000. -Math.PI,
  165001. Math.PI
  165002. );
  165003. cartographic2.latitude = Math_default.clamp(
  165004. cartographic2.latitude,
  165005. -Math_default.PI_OVER_TWO,
  165006. Math_default.PI_OVER_TWO
  165007. );
  165008. const ellipsoid = projection.ellipsoid;
  165009. const position3D = ellipsoid.cartographicToCartesian(
  165010. cartographic2,
  165011. view2Dto3DCartesian3Scratch
  165012. );
  165013. const enuToFixed = Transforms_default.eastNorthUpToFixedFrame(
  165014. position3D,
  165015. ellipsoid,
  165016. view2Dto3DMatrix4Scratch
  165017. );
  165018. Matrix4_default.multiplyByPointAsVector(enuToFixed, r2, r2);
  165019. Matrix4_default.multiplyByPointAsVector(enuToFixed, u3, u3);
  165020. Matrix4_default.multiplyByPointAsVector(enuToFixed, d, d);
  165021. if (!defined_default(result)) {
  165022. result = new Matrix4_default();
  165023. }
  165024. result[0] = r2.x;
  165025. result[1] = u3.x;
  165026. result[2] = -d.x;
  165027. result[3] = 0;
  165028. result[4] = r2.y;
  165029. result[5] = u3.y;
  165030. result[6] = -d.y;
  165031. result[7] = 0;
  165032. result[8] = r2.z;
  165033. result[9] = u3.z;
  165034. result[10] = -d.z;
  165035. result[11] = 0;
  165036. result[12] = -Cartesian3_default.dot(r2, position3D);
  165037. result[13] = -Cartesian3_default.dot(u3, position3D);
  165038. result[14] = Cartesian3_default.dot(d, position3D);
  165039. result[15] = 1;
  165040. return result;
  165041. }
  165042. function updateView3D(that) {
  165043. if (that._view3DDirty) {
  165044. if (that._mode === SceneMode_default.SCENE3D) {
  165045. Matrix4_default.clone(that._view, that._view3D);
  165046. } else {
  165047. view2Dto3D(
  165048. that._cameraPosition,
  165049. that._cameraDirection,
  165050. that._cameraRight,
  165051. that._cameraUp,
  165052. that._frustum2DWidth,
  165053. that._mode,
  165054. that._mapProjection,
  165055. that._view3D
  165056. );
  165057. }
  165058. Matrix4_default.getMatrix3(that._view3D, that._viewRotation3D);
  165059. that._view3DDirty = false;
  165060. }
  165061. }
  165062. function updateInverseView3D(that) {
  165063. if (that._inverseView3DDirty) {
  165064. Matrix4_default.inverseTransformation(that.view3D, that._inverseView3D);
  165065. Matrix4_default.getMatrix3(that._inverseView3D, that._inverseViewRotation3D);
  165066. that._inverseView3DDirty = false;
  165067. }
  165068. }
  165069. var UniformState_default = UniformState;
  165070. // node_modules/cesium/Source/Renderer/Context.js
  165071. function errorToString(gl, error) {
  165072. let message = "WebGL Error: ";
  165073. switch (error) {
  165074. case gl.INVALID_ENUM:
  165075. message += "INVALID_ENUM";
  165076. break;
  165077. case gl.INVALID_VALUE:
  165078. message += "INVALID_VALUE";
  165079. break;
  165080. case gl.INVALID_OPERATION:
  165081. message += "INVALID_OPERATION";
  165082. break;
  165083. case gl.OUT_OF_MEMORY:
  165084. message += "OUT_OF_MEMORY";
  165085. break;
  165086. case gl.CONTEXT_LOST_WEBGL:
  165087. message += "CONTEXT_LOST_WEBGL lost";
  165088. break;
  165089. default:
  165090. message += `Unknown (${error})`;
  165091. }
  165092. return message;
  165093. }
  165094. function createErrorMessage(gl, glFunc, glFuncArguments, error) {
  165095. let message = `${errorToString(gl, error)}: ${glFunc.name}(`;
  165096. for (let i2 = 0; i2 < glFuncArguments.length; ++i2) {
  165097. if (i2 !== 0) {
  165098. message += ", ";
  165099. }
  165100. message += glFuncArguments[i2];
  165101. }
  165102. message += ");";
  165103. return message;
  165104. }
  165105. function throwOnError(gl, glFunc, glFuncArguments) {
  165106. const error = gl.getError();
  165107. if (error !== gl.NO_ERROR) {
  165108. throw new RuntimeError_default(
  165109. createErrorMessage(gl, glFunc, glFuncArguments, error)
  165110. );
  165111. }
  165112. }
  165113. function makeGetterSetter(gl, propertyName, logFunction) {
  165114. return {
  165115. get: function() {
  165116. const value = gl[propertyName];
  165117. logFunction(gl, `get: ${propertyName}`, value);
  165118. return gl[propertyName];
  165119. },
  165120. set: function(value) {
  165121. gl[propertyName] = value;
  165122. logFunction(gl, `set: ${propertyName}`, value);
  165123. }
  165124. };
  165125. }
  165126. function wrapGL(gl, logFunction) {
  165127. if (!defined_default(logFunction)) {
  165128. return gl;
  165129. }
  165130. function wrapFunction2(property) {
  165131. return function() {
  165132. const result = property.apply(gl, arguments);
  165133. logFunction(gl, property, arguments);
  165134. return result;
  165135. };
  165136. }
  165137. const glWrapper = {};
  165138. for (const propertyName in gl) {
  165139. const property = gl[propertyName];
  165140. if (property instanceof Function) {
  165141. glWrapper[propertyName] = wrapFunction2(property);
  165142. } else {
  165143. Object.defineProperty(
  165144. glWrapper,
  165145. propertyName,
  165146. makeGetterSetter(gl, propertyName, logFunction)
  165147. );
  165148. }
  165149. }
  165150. return glWrapper;
  165151. }
  165152. function getExtension(gl, names) {
  165153. const length3 = names.length;
  165154. for (let i2 = 0; i2 < length3; ++i2) {
  165155. const extension = gl.getExtension(names[i2]);
  165156. if (extension) {
  165157. return extension;
  165158. }
  165159. }
  165160. return void 0;
  165161. }
  165162. function Context(canvas, options) {
  165163. if (typeof WebGLRenderingContext === "undefined") {
  165164. throw new RuntimeError_default(
  165165. "The browser does not support WebGL. Visit http://get.webgl.org."
  165166. );
  165167. }
  165168. Check_default.defined("canvas", canvas);
  165169. this._canvas = canvas;
  165170. options = clone_default(options, true);
  165171. options = defaultValue_default(options, {});
  165172. options.allowTextureFilterAnisotropic = defaultValue_default(
  165173. options.allowTextureFilterAnisotropic,
  165174. true
  165175. );
  165176. const webglOptions = defaultValue_default(options.webgl, {});
  165177. webglOptions.alpha = defaultValue_default(webglOptions.alpha, false);
  165178. webglOptions.stencil = defaultValue_default(webglOptions.stencil, true);
  165179. const requestWebgl2 = defaultValue_default(options.requestWebgl2, false) && typeof WebGL2RenderingContext !== "undefined";
  165180. let webgl2 = false;
  165181. let glContext;
  165182. const getWebGLStub = options.getWebGLStub;
  165183. if (!defined_default(getWebGLStub)) {
  165184. if (requestWebgl2) {
  165185. glContext = canvas.getContext("webgl2", webglOptions) || canvas.getContext("experimental-webgl2", webglOptions) || void 0;
  165186. if (defined_default(glContext)) {
  165187. webgl2 = true;
  165188. }
  165189. }
  165190. if (!defined_default(glContext)) {
  165191. glContext = canvas.getContext("webgl", webglOptions) || canvas.getContext("experimental-webgl", webglOptions) || void 0;
  165192. }
  165193. if (!defined_default(glContext)) {
  165194. throw new RuntimeError_default(
  165195. "The browser supports WebGL, but initialization failed."
  165196. );
  165197. }
  165198. } else {
  165199. glContext = getWebGLStub(canvas, webglOptions);
  165200. }
  165201. this._originalGLContext = glContext;
  165202. this._gl = glContext;
  165203. this._webgl2 = webgl2;
  165204. this._id = createGuid_default();
  165205. this.validateFramebuffer = false;
  165206. this.validateShaderProgram = false;
  165207. this.logShaderCompilation = false;
  165208. this._throwOnWebGLError = false;
  165209. this._shaderCache = new ShaderCache_default(this);
  165210. this._textureCache = new TextureCache_default();
  165211. const gl = glContext;
  165212. this._stencilBits = gl.getParameter(gl.STENCIL_BITS);
  165213. ContextLimits_default._maximumCombinedTextureImageUnits = gl.getParameter(
  165214. gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS
  165215. );
  165216. ContextLimits_default._maximumCubeMapSize = gl.getParameter(
  165217. gl.MAX_CUBE_MAP_TEXTURE_SIZE
  165218. );
  165219. ContextLimits_default._maximumFragmentUniformVectors = gl.getParameter(
  165220. gl.MAX_FRAGMENT_UNIFORM_VECTORS
  165221. );
  165222. ContextLimits_default._maximumTextureImageUnits = gl.getParameter(
  165223. gl.MAX_TEXTURE_IMAGE_UNITS
  165224. );
  165225. ContextLimits_default._maximumRenderbufferSize = gl.getParameter(
  165226. gl.MAX_RENDERBUFFER_SIZE
  165227. );
  165228. ContextLimits_default._maximumTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);
  165229. ContextLimits_default._maximumVaryingVectors = gl.getParameter(
  165230. gl.MAX_VARYING_VECTORS
  165231. );
  165232. ContextLimits_default._maximumVertexAttributes = gl.getParameter(
  165233. gl.MAX_VERTEX_ATTRIBS
  165234. );
  165235. ContextLimits_default._maximumVertexTextureImageUnits = gl.getParameter(
  165236. gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS
  165237. );
  165238. ContextLimits_default._maximumVertexUniformVectors = gl.getParameter(
  165239. gl.MAX_VERTEX_UNIFORM_VECTORS
  165240. );
  165241. ContextLimits_default._maximumSamples = this._webgl2 ? gl.getParameter(gl.MAX_SAMPLES) : 0;
  165242. const aliasedLineWidthRange = gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE);
  165243. ContextLimits_default._minimumAliasedLineWidth = aliasedLineWidthRange[0];
  165244. ContextLimits_default._maximumAliasedLineWidth = aliasedLineWidthRange[1];
  165245. const aliasedPointSizeRange = gl.getParameter(gl.ALIASED_POINT_SIZE_RANGE);
  165246. ContextLimits_default._minimumAliasedPointSize = aliasedPointSizeRange[0];
  165247. ContextLimits_default._maximumAliasedPointSize = aliasedPointSizeRange[1];
  165248. const maximumViewportDimensions = gl.getParameter(gl.MAX_VIEWPORT_DIMS);
  165249. ContextLimits_default._maximumViewportWidth = maximumViewportDimensions[0];
  165250. ContextLimits_default._maximumViewportHeight = maximumViewportDimensions[1];
  165251. const highpFloat = gl.getShaderPrecisionFormat(
  165252. gl.FRAGMENT_SHADER,
  165253. gl.HIGH_FLOAT
  165254. );
  165255. ContextLimits_default._highpFloatSupported = highpFloat.precision !== 0;
  165256. const highpInt = gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_INT);
  165257. ContextLimits_default._highpIntSupported = highpInt.rangeMax !== 0;
  165258. this._antialias = gl.getContextAttributes().antialias;
  165259. this._standardDerivatives = !!getExtension(gl, ["OES_standard_derivatives"]);
  165260. this._blendMinmax = !!getExtension(gl, ["EXT_blend_minmax"]);
  165261. this._elementIndexUint = !!getExtension(gl, ["OES_element_index_uint"]);
  165262. this._depthTexture = !!getExtension(gl, [
  165263. "WEBGL_depth_texture",
  165264. "WEBKIT_WEBGL_depth_texture"
  165265. ]);
  165266. this._fragDepth = !!getExtension(gl, ["EXT_frag_depth"]);
  165267. this._debugShaders = getExtension(gl, ["WEBGL_debug_shaders"]);
  165268. this._textureFloat = !!getExtension(gl, ["OES_texture_float"]);
  165269. this._textureHalfFloat = !!getExtension(gl, ["OES_texture_half_float"]);
  165270. this._textureFloatLinear = !!getExtension(gl, ["OES_texture_float_linear"]);
  165271. this._textureHalfFloatLinear = !!getExtension(gl, [
  165272. "OES_texture_half_float_linear"
  165273. ]);
  165274. this._colorBufferFloat = !!getExtension(gl, [
  165275. "EXT_color_buffer_float",
  165276. "WEBGL_color_buffer_float"
  165277. ]);
  165278. this._floatBlend = !!getExtension(gl, ["EXT_float_blend"]);
  165279. this._colorBufferHalfFloat = !!getExtension(gl, [
  165280. "EXT_color_buffer_half_float"
  165281. ]);
  165282. this._s3tc = !!getExtension(gl, [
  165283. "WEBGL_compressed_texture_s3tc",
  165284. "MOZ_WEBGL_compressed_texture_s3tc",
  165285. "WEBKIT_WEBGL_compressed_texture_s3tc"
  165286. ]);
  165287. this._pvrtc = !!getExtension(gl, [
  165288. "WEBGL_compressed_texture_pvrtc",
  165289. "WEBKIT_WEBGL_compressed_texture_pvrtc"
  165290. ]);
  165291. this._astc = !!getExtension(gl, ["WEBGL_compressed_texture_astc"]);
  165292. this._etc = !!getExtension(gl, ["WEBG_compressed_texture_etc"]);
  165293. this._etc1 = !!getExtension(gl, ["WEBGL_compressed_texture_etc1"]);
  165294. this._bc7 = !!getExtension(gl, ["EXT_texture_compression_bptc"]);
  165295. loadKTX2_default.setKTX2SupportedFormats(
  165296. this._s3tc,
  165297. this._pvrtc,
  165298. this._astc,
  165299. this._etc,
  165300. this._etc1,
  165301. this._bc7
  165302. );
  165303. const textureFilterAnisotropic = options.allowTextureFilterAnisotropic ? getExtension(gl, [
  165304. "EXT_texture_filter_anisotropic",
  165305. "WEBKIT_EXT_texture_filter_anisotropic"
  165306. ]) : void 0;
  165307. this._textureFilterAnisotropic = textureFilterAnisotropic;
  165308. ContextLimits_default._maximumTextureFilterAnisotropy = defined_default(
  165309. textureFilterAnisotropic
  165310. ) ? gl.getParameter(textureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 1;
  165311. let glCreateVertexArray;
  165312. let glBindVertexArray;
  165313. let glDeleteVertexArray;
  165314. let glDrawElementsInstanced;
  165315. let glDrawArraysInstanced;
  165316. let glVertexAttribDivisor;
  165317. let glDrawBuffers;
  165318. let vertexArrayObject;
  165319. let instancedArrays;
  165320. let drawBuffers;
  165321. if (webgl2) {
  165322. const that = this;
  165323. glCreateVertexArray = function() {
  165324. return that._gl.createVertexArray();
  165325. };
  165326. glBindVertexArray = function(vao) {
  165327. that._gl.bindVertexArray(vao);
  165328. };
  165329. glDeleteVertexArray = function(vao) {
  165330. that._gl.deleteVertexArray(vao);
  165331. };
  165332. glDrawElementsInstanced = function(mode2, count, type, offset2, instanceCount) {
  165333. gl.drawElementsInstanced(mode2, count, type, offset2, instanceCount);
  165334. };
  165335. glDrawArraysInstanced = function(mode2, first, count, instanceCount) {
  165336. gl.drawArraysInstanced(mode2, first, count, instanceCount);
  165337. };
  165338. glVertexAttribDivisor = function(index2, divisor) {
  165339. gl.vertexAttribDivisor(index2, divisor);
  165340. };
  165341. glDrawBuffers = function(buffers) {
  165342. gl.drawBuffers(buffers);
  165343. };
  165344. } else {
  165345. vertexArrayObject = getExtension(gl, ["OES_vertex_array_object"]);
  165346. if (defined_default(vertexArrayObject)) {
  165347. glCreateVertexArray = function() {
  165348. return vertexArrayObject.createVertexArrayOES();
  165349. };
  165350. glBindVertexArray = function(vertexArray) {
  165351. vertexArrayObject.bindVertexArrayOES(vertexArray);
  165352. };
  165353. glDeleteVertexArray = function(vertexArray) {
  165354. vertexArrayObject.deleteVertexArrayOES(vertexArray);
  165355. };
  165356. }
  165357. instancedArrays = getExtension(gl, ["ANGLE_instanced_arrays"]);
  165358. if (defined_default(instancedArrays)) {
  165359. glDrawElementsInstanced = function(mode2, count, type, offset2, instanceCount) {
  165360. instancedArrays.drawElementsInstancedANGLE(
  165361. mode2,
  165362. count,
  165363. type,
  165364. offset2,
  165365. instanceCount
  165366. );
  165367. };
  165368. glDrawArraysInstanced = function(mode2, first, count, instanceCount) {
  165369. instancedArrays.drawArraysInstancedANGLE(
  165370. mode2,
  165371. first,
  165372. count,
  165373. instanceCount
  165374. );
  165375. };
  165376. glVertexAttribDivisor = function(index2, divisor) {
  165377. instancedArrays.vertexAttribDivisorANGLE(index2, divisor);
  165378. };
  165379. }
  165380. drawBuffers = getExtension(gl, ["WEBGL_draw_buffers"]);
  165381. if (defined_default(drawBuffers)) {
  165382. glDrawBuffers = function(buffers) {
  165383. drawBuffers.drawBuffersWEBGL(buffers);
  165384. };
  165385. }
  165386. }
  165387. this.glCreateVertexArray = glCreateVertexArray;
  165388. this.glBindVertexArray = glBindVertexArray;
  165389. this.glDeleteVertexArray = glDeleteVertexArray;
  165390. this.glDrawElementsInstanced = glDrawElementsInstanced;
  165391. this.glDrawArraysInstanced = glDrawArraysInstanced;
  165392. this.glVertexAttribDivisor = glVertexAttribDivisor;
  165393. this.glDrawBuffers = glDrawBuffers;
  165394. this._vertexArrayObject = !!vertexArrayObject;
  165395. this._instancedArrays = !!instancedArrays;
  165396. this._drawBuffers = !!drawBuffers;
  165397. ContextLimits_default._maximumDrawBuffers = this.drawBuffers ? gl.getParameter(WebGLConstants_default.MAX_DRAW_BUFFERS) : 1;
  165398. ContextLimits_default._maximumColorAttachments = this.drawBuffers ? gl.getParameter(WebGLConstants_default.MAX_COLOR_ATTACHMENTS) : 1;
  165399. this._clearColor = new Color_default(0, 0, 0, 0);
  165400. this._clearDepth = 1;
  165401. this._clearStencil = 0;
  165402. const us = new UniformState_default();
  165403. const ps = new PassState_default(this);
  165404. const rs = RenderState_default.fromCache();
  165405. this._defaultPassState = ps;
  165406. this._defaultRenderState = rs;
  165407. this._defaultTexture = void 0;
  165408. this._defaultEmissiveTexture = void 0;
  165409. this._defaultNormalTexture = void 0;
  165410. this._defaultCubeMap = void 0;
  165411. this._us = us;
  165412. this._currentRenderState = rs;
  165413. this._currentPassState = ps;
  165414. this._currentFramebuffer = void 0;
  165415. this._maxFrameTextureUnitIndex = 0;
  165416. this._vertexAttribDivisors = [];
  165417. this._previousDrawInstanced = false;
  165418. for (let i2 = 0; i2 < ContextLimits_default._maximumVertexAttributes; i2++) {
  165419. this._vertexAttribDivisors.push(0);
  165420. }
  165421. this._pickObjects = {};
  165422. this._nextPickColor = new Uint32Array(1);
  165423. this.options = options;
  165424. this.cache = {};
  165425. RenderState_default.apply(gl, rs, ps);
  165426. }
  165427. var defaultFramebufferMarker = {};
  165428. Object.defineProperties(Context.prototype, {
  165429. id: {
  165430. get: function() {
  165431. return this._id;
  165432. }
  165433. },
  165434. webgl2: {
  165435. get: function() {
  165436. return this._webgl2;
  165437. }
  165438. },
  165439. canvas: {
  165440. get: function() {
  165441. return this._canvas;
  165442. }
  165443. },
  165444. shaderCache: {
  165445. get: function() {
  165446. return this._shaderCache;
  165447. }
  165448. },
  165449. textureCache: {
  165450. get: function() {
  165451. return this._textureCache;
  165452. }
  165453. },
  165454. uniformState: {
  165455. get: function() {
  165456. return this._us;
  165457. }
  165458. },
  165459. stencilBits: {
  165460. get: function() {
  165461. return this._stencilBits;
  165462. }
  165463. },
  165464. stencilBuffer: {
  165465. get: function() {
  165466. return this._stencilBits >= 8;
  165467. }
  165468. },
  165469. antialias: {
  165470. get: function() {
  165471. return this._antialias;
  165472. }
  165473. },
  165474. msaa: {
  165475. get: function() {
  165476. return this._webgl2;
  165477. }
  165478. },
  165479. standardDerivatives: {
  165480. get: function() {
  165481. return this._standardDerivatives || this._webgl2;
  165482. }
  165483. },
  165484. floatBlend: {
  165485. get: function() {
  165486. return this._floatBlend;
  165487. }
  165488. },
  165489. blendMinmax: {
  165490. get: function() {
  165491. return this._blendMinmax || this._webgl2;
  165492. }
  165493. },
  165494. elementIndexUint: {
  165495. get: function() {
  165496. return this._elementIndexUint || this._webgl2;
  165497. }
  165498. },
  165499. depthTexture: {
  165500. get: function() {
  165501. return this._depthTexture || this._webgl2;
  165502. }
  165503. },
  165504. floatingPointTexture: {
  165505. get: function() {
  165506. return this._webgl2 || this._textureFloat;
  165507. }
  165508. },
  165509. halfFloatingPointTexture: {
  165510. get: function() {
  165511. return this._webgl2 || this._textureHalfFloat;
  165512. }
  165513. },
  165514. textureFloatLinear: {
  165515. get: function() {
  165516. return this._textureFloatLinear;
  165517. }
  165518. },
  165519. textureHalfFloatLinear: {
  165520. get: function() {
  165521. return this._webgl2 && this._textureFloatLinear || !this._webgl2 && this._textureHalfFloatLinear;
  165522. }
  165523. },
  165524. textureFilterAnisotropic: {
  165525. get: function() {
  165526. return !!this._textureFilterAnisotropic;
  165527. }
  165528. },
  165529. s3tc: {
  165530. get: function() {
  165531. return this._s3tc;
  165532. }
  165533. },
  165534. pvrtc: {
  165535. get: function() {
  165536. return this._pvrtc;
  165537. }
  165538. },
  165539. astc: {
  165540. get: function() {
  165541. return this._astc;
  165542. }
  165543. },
  165544. etc: {
  165545. get: function() {
  165546. return this._etc;
  165547. }
  165548. },
  165549. etc1: {
  165550. get: function() {
  165551. return this._etc1;
  165552. }
  165553. },
  165554. bc7: {
  165555. get: function() {
  165556. return this._bc7;
  165557. }
  165558. },
  165559. supportsBasis: {
  165560. get: function() {
  165561. return this._s3tc || this._pvrtc || this._astc || this._etc || this._etc1 || this._bc7;
  165562. }
  165563. },
  165564. vertexArrayObject: {
  165565. get: function() {
  165566. return this._vertexArrayObject || this._webgl2;
  165567. }
  165568. },
  165569. fragmentDepth: {
  165570. get: function() {
  165571. return this._fragDepth || this._webgl2;
  165572. }
  165573. },
  165574. instancedArrays: {
  165575. get: function() {
  165576. return this._instancedArrays || this._webgl2;
  165577. }
  165578. },
  165579. colorBufferFloat: {
  165580. get: function() {
  165581. return this._colorBufferFloat;
  165582. }
  165583. },
  165584. colorBufferHalfFloat: {
  165585. get: function() {
  165586. return this._webgl2 && this._colorBufferFloat || !this._webgl2 && this._colorBufferHalfFloat;
  165587. }
  165588. },
  165589. drawBuffers: {
  165590. get: function() {
  165591. return this._drawBuffers || this._webgl2;
  165592. }
  165593. },
  165594. debugShaders: {
  165595. get: function() {
  165596. return this._debugShaders;
  165597. }
  165598. },
  165599. throwOnWebGLError: {
  165600. get: function() {
  165601. return this._throwOnWebGLError;
  165602. },
  165603. set: function(value) {
  165604. this._throwOnWebGLError = value;
  165605. this._gl = wrapGL(
  165606. this._originalGLContext,
  165607. value ? throwOnError : void 0
  165608. );
  165609. }
  165610. },
  165611. defaultTexture: {
  165612. get: function() {
  165613. if (this._defaultTexture === void 0) {
  165614. this._defaultTexture = new Texture_default({
  165615. context: this,
  165616. source: {
  165617. width: 1,
  165618. height: 1,
  165619. arrayBufferView: new Uint8Array([255, 255, 255, 255])
  165620. },
  165621. flipY: false
  165622. });
  165623. }
  165624. return this._defaultTexture;
  165625. }
  165626. },
  165627. defaultEmissiveTexture: {
  165628. get: function() {
  165629. if (this._defaultEmissiveTexture === void 0) {
  165630. this._defaultEmissiveTexture = new Texture_default({
  165631. context: this,
  165632. pixelFormat: PixelFormat_default.RGB,
  165633. source: {
  165634. width: 1,
  165635. height: 1,
  165636. arrayBufferView: new Uint8Array([0, 0, 0])
  165637. },
  165638. flipY: false
  165639. });
  165640. }
  165641. return this._defaultEmissiveTexture;
  165642. }
  165643. },
  165644. defaultNormalTexture: {
  165645. get: function() {
  165646. if (this._defaultNormalTexture === void 0) {
  165647. this._defaultNormalTexture = new Texture_default({
  165648. context: this,
  165649. pixelFormat: PixelFormat_default.RGB,
  165650. source: {
  165651. width: 1,
  165652. height: 1,
  165653. arrayBufferView: new Uint8Array([128, 128, 255])
  165654. },
  165655. flipY: false
  165656. });
  165657. }
  165658. return this._defaultNormalTexture;
  165659. }
  165660. },
  165661. defaultCubeMap: {
  165662. get: function() {
  165663. if (this._defaultCubeMap === void 0) {
  165664. const face = {
  165665. width: 1,
  165666. height: 1,
  165667. arrayBufferView: new Uint8Array([255, 255, 255, 255])
  165668. };
  165669. this._defaultCubeMap = new CubeMap_default({
  165670. context: this,
  165671. source: {
  165672. positiveX: face,
  165673. negativeX: face,
  165674. positiveY: face,
  165675. negativeY: face,
  165676. positiveZ: face,
  165677. negativeZ: face
  165678. },
  165679. flipY: false
  165680. });
  165681. }
  165682. return this._defaultCubeMap;
  165683. }
  165684. },
  165685. drawingBufferHeight: {
  165686. get: function() {
  165687. return this._gl.drawingBufferHeight;
  165688. }
  165689. },
  165690. drawingBufferWidth: {
  165691. get: function() {
  165692. return this._gl.drawingBufferWidth;
  165693. }
  165694. },
  165695. defaultFramebuffer: {
  165696. get: function() {
  165697. return defaultFramebufferMarker;
  165698. }
  165699. }
  165700. });
  165701. function validateFramebuffer(context) {
  165702. if (context.validateFramebuffer) {
  165703. const gl = context._gl;
  165704. const status = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
  165705. if (status !== gl.FRAMEBUFFER_COMPLETE) {
  165706. let message;
  165707. switch (status) {
  165708. case gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
  165709. message = "Framebuffer is not complete. Incomplete attachment: at least one attachment point with a renderbuffer or texture attached has its attached object no longer in existence or has an attached image with a width or height of zero, or the color attachment point has a non-color-renderable image attached, or the depth attachment point has a non-depth-renderable image attached, or the stencil attachment point has a non-stencil-renderable image attached. Color-renderable formats include GL_RGBA4, GL_RGB5_A1, and GL_RGB565. GL_DEPTH_COMPONENT16 is the only depth-renderable format. GL_STENCIL_INDEX8 is the only stencil-renderable format.";
  165710. break;
  165711. case gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
  165712. message = "Framebuffer is not complete. Incomplete dimensions: not all attached images have the same width and height.";
  165713. break;
  165714. case gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
  165715. message = "Framebuffer is not complete. Missing attachment: no images are attached to the framebuffer.";
  165716. break;
  165717. case gl.FRAMEBUFFER_UNSUPPORTED:
  165718. message = "Framebuffer is not complete. Unsupported: the combination of internal formats of the attached images violates an implementation-dependent set of restrictions.";
  165719. break;
  165720. }
  165721. throw new DeveloperError_default(message);
  165722. }
  165723. }
  165724. }
  165725. function applyRenderState(context, renderState, passState, clear2) {
  165726. const previousRenderState = context._currentRenderState;
  165727. const previousPassState = context._currentPassState;
  165728. context._currentRenderState = renderState;
  165729. context._currentPassState = passState;
  165730. RenderState_default.partialApply(
  165731. context._gl,
  165732. previousRenderState,
  165733. renderState,
  165734. previousPassState,
  165735. passState,
  165736. clear2
  165737. );
  165738. }
  165739. var scratchBackBufferArray;
  165740. if (typeof WebGLRenderingContext !== "undefined") {
  165741. scratchBackBufferArray = [WebGLConstants_default.BACK];
  165742. }
  165743. function bindFramebuffer(context, framebuffer) {
  165744. if (framebuffer !== context._currentFramebuffer) {
  165745. context._currentFramebuffer = framebuffer;
  165746. let buffers = scratchBackBufferArray;
  165747. if (defined_default(framebuffer)) {
  165748. framebuffer._bind();
  165749. validateFramebuffer(context);
  165750. buffers = framebuffer._getActiveColorAttachments();
  165751. } else {
  165752. const gl = context._gl;
  165753. gl.bindFramebuffer(gl.FRAMEBUFFER, null);
  165754. }
  165755. if (context.drawBuffers) {
  165756. context.glDrawBuffers(buffers);
  165757. }
  165758. }
  165759. }
  165760. var defaultClearCommand = new ClearCommand_default();
  165761. Context.prototype.clear = function(clearCommand, passState) {
  165762. clearCommand = defaultValue_default(clearCommand, defaultClearCommand);
  165763. passState = defaultValue_default(passState, this._defaultPassState);
  165764. const gl = this._gl;
  165765. let bitmask = 0;
  165766. const c14 = clearCommand.color;
  165767. const d = clearCommand.depth;
  165768. const s2 = clearCommand.stencil;
  165769. if (defined_default(c14)) {
  165770. if (!Color_default.equals(this._clearColor, c14)) {
  165771. Color_default.clone(c14, this._clearColor);
  165772. gl.clearColor(c14.red, c14.green, c14.blue, c14.alpha);
  165773. }
  165774. bitmask |= gl.COLOR_BUFFER_BIT;
  165775. }
  165776. if (defined_default(d)) {
  165777. if (d !== this._clearDepth) {
  165778. this._clearDepth = d;
  165779. gl.clearDepth(d);
  165780. }
  165781. bitmask |= gl.DEPTH_BUFFER_BIT;
  165782. }
  165783. if (defined_default(s2)) {
  165784. if (s2 !== this._clearStencil) {
  165785. this._clearStencil = s2;
  165786. gl.clearStencil(s2);
  165787. }
  165788. bitmask |= gl.STENCIL_BUFFER_BIT;
  165789. }
  165790. const rs = defaultValue_default(clearCommand.renderState, this._defaultRenderState);
  165791. applyRenderState(this, rs, passState, true);
  165792. const framebuffer = defaultValue_default(
  165793. clearCommand.framebuffer,
  165794. passState.framebuffer
  165795. );
  165796. bindFramebuffer(this, framebuffer);
  165797. gl.clear(bitmask);
  165798. };
  165799. function beginDraw(context, framebuffer, passState, shaderProgram, renderState) {
  165800. if (defined_default(framebuffer) && renderState.depthTest) {
  165801. if (renderState.depthTest.enabled && !framebuffer.hasDepthAttachment) {
  165802. throw new DeveloperError_default(
  165803. "The depth test can not be enabled (drawCommand.renderState.depthTest.enabled) because the framebuffer (drawCommand.framebuffer) does not have a depth or depth-stencil renderbuffer."
  165804. );
  165805. }
  165806. }
  165807. bindFramebuffer(context, framebuffer);
  165808. applyRenderState(context, renderState, passState, false);
  165809. shaderProgram._bind();
  165810. context._maxFrameTextureUnitIndex = Math.max(
  165811. context._maxFrameTextureUnitIndex,
  165812. shaderProgram.maximumTextureUnitIndex
  165813. );
  165814. }
  165815. function continueDraw(context, drawCommand, shaderProgram, uniformMap2) {
  165816. const primitiveType = drawCommand._primitiveType;
  165817. const va = drawCommand._vertexArray;
  165818. let offset2 = drawCommand._offset;
  165819. let count = drawCommand._count;
  165820. const instanceCount = drawCommand.instanceCount;
  165821. if (!PrimitiveType_default.validate(primitiveType)) {
  165822. throw new DeveloperError_default(
  165823. "drawCommand.primitiveType is required and must be valid."
  165824. );
  165825. }
  165826. Check_default.defined("drawCommand.vertexArray", va);
  165827. Check_default.typeOf.number.greaterThanOrEquals("drawCommand.offset", offset2, 0);
  165828. if (defined_default(count)) {
  165829. Check_default.typeOf.number.greaterThanOrEquals("drawCommand.count", count, 0);
  165830. }
  165831. Check_default.typeOf.number.greaterThanOrEquals(
  165832. "drawCommand.instanceCount",
  165833. instanceCount,
  165834. 0
  165835. );
  165836. if (instanceCount > 0 && !context.instancedArrays) {
  165837. throw new DeveloperError_default("Instanced arrays extension is not supported");
  165838. }
  165839. context._us.model = defaultValue_default(drawCommand._modelMatrix, Matrix4_default.IDENTITY);
  165840. shaderProgram._setUniforms(
  165841. uniformMap2,
  165842. context._us,
  165843. context.validateShaderProgram
  165844. );
  165845. va._bind();
  165846. const indexBuffer = va.indexBuffer;
  165847. if (defined_default(indexBuffer)) {
  165848. offset2 = offset2 * indexBuffer.bytesPerIndex;
  165849. count = defaultValue_default(count, indexBuffer.numberOfIndices);
  165850. if (instanceCount === 0) {
  165851. context._gl.drawElements(
  165852. primitiveType,
  165853. count,
  165854. indexBuffer.indexDatatype,
  165855. offset2
  165856. );
  165857. } else {
  165858. context.glDrawElementsInstanced(
  165859. primitiveType,
  165860. count,
  165861. indexBuffer.indexDatatype,
  165862. offset2,
  165863. instanceCount
  165864. );
  165865. }
  165866. } else {
  165867. count = defaultValue_default(count, va.numberOfVertices);
  165868. if (instanceCount === 0) {
  165869. context._gl.drawArrays(primitiveType, offset2, count);
  165870. } else {
  165871. context.glDrawArraysInstanced(
  165872. primitiveType,
  165873. offset2,
  165874. count,
  165875. instanceCount
  165876. );
  165877. }
  165878. }
  165879. va._unBind();
  165880. }
  165881. Context.prototype.draw = function(drawCommand, passState, shaderProgram, uniformMap2) {
  165882. Check_default.defined("drawCommand", drawCommand);
  165883. Check_default.defined("drawCommand.shaderProgram", drawCommand._shaderProgram);
  165884. passState = defaultValue_default(passState, this._defaultPassState);
  165885. const framebuffer = defaultValue_default(
  165886. drawCommand._framebuffer,
  165887. passState.framebuffer
  165888. );
  165889. const renderState = defaultValue_default(
  165890. drawCommand._renderState,
  165891. this._defaultRenderState
  165892. );
  165893. shaderProgram = defaultValue_default(shaderProgram, drawCommand._shaderProgram);
  165894. uniformMap2 = defaultValue_default(uniformMap2, drawCommand._uniformMap);
  165895. beginDraw(this, framebuffer, passState, shaderProgram, renderState);
  165896. continueDraw(this, drawCommand, shaderProgram, uniformMap2);
  165897. };
  165898. Context.prototype.endFrame = function() {
  165899. const gl = this._gl;
  165900. gl.useProgram(null);
  165901. this._currentFramebuffer = void 0;
  165902. gl.bindFramebuffer(gl.FRAMEBUFFER, null);
  165903. const buffers = scratchBackBufferArray;
  165904. if (this.drawBuffers) {
  165905. this.glDrawBuffers(buffers);
  165906. }
  165907. const length3 = this._maxFrameTextureUnitIndex;
  165908. this._maxFrameTextureUnitIndex = 0;
  165909. for (let i2 = 0; i2 < length3; ++i2) {
  165910. gl.activeTexture(gl.TEXTURE0 + i2);
  165911. gl.bindTexture(gl.TEXTURE_2D, null);
  165912. gl.bindTexture(gl.TEXTURE_CUBE_MAP, null);
  165913. }
  165914. };
  165915. Context.prototype.readPixels = function(readState) {
  165916. const gl = this._gl;
  165917. readState = defaultValue_default(readState, defaultValue_default.EMPTY_OBJECT);
  165918. const x = Math.max(defaultValue_default(readState.x, 0), 0);
  165919. const y = Math.max(defaultValue_default(readState.y, 0), 0);
  165920. const width = defaultValue_default(readState.width, gl.drawingBufferWidth);
  165921. const height = defaultValue_default(readState.height, gl.drawingBufferHeight);
  165922. const framebuffer = readState.framebuffer;
  165923. Check_default.typeOf.number.greaterThan("readState.width", width, 0);
  165924. Check_default.typeOf.number.greaterThan("readState.height", height, 0);
  165925. let pixelDatatype = PixelDatatype_default.UNSIGNED_BYTE;
  165926. if (defined_default(framebuffer) && framebuffer.numberOfColorAttachments > 0) {
  165927. pixelDatatype = framebuffer.getColorTexture(0).pixelDatatype;
  165928. }
  165929. const pixels = PixelFormat_default.createTypedArray(
  165930. PixelFormat_default.RGBA,
  165931. pixelDatatype,
  165932. width,
  165933. height
  165934. );
  165935. bindFramebuffer(this, framebuffer);
  165936. gl.readPixels(
  165937. x,
  165938. y,
  165939. width,
  165940. height,
  165941. PixelFormat_default.RGBA,
  165942. PixelDatatype_default.toWebGLConstant(pixelDatatype, this),
  165943. pixels
  165944. );
  165945. return pixels;
  165946. };
  165947. var viewportQuadAttributeLocations = {
  165948. position: 0,
  165949. textureCoordinates: 1
  165950. };
  165951. Context.prototype.getViewportQuadVertexArray = function() {
  165952. let vertexArray = this.cache.viewportQuad_vertexArray;
  165953. if (!defined_default(vertexArray)) {
  165954. const geometry = new Geometry_default({
  165955. attributes: {
  165956. position: new GeometryAttribute_default({
  165957. componentDatatype: ComponentDatatype_default.FLOAT,
  165958. componentsPerAttribute: 2,
  165959. values: [-1, -1, 1, -1, 1, 1, -1, 1]
  165960. }),
  165961. textureCoordinates: new GeometryAttribute_default({
  165962. componentDatatype: ComponentDatatype_default.FLOAT,
  165963. componentsPerAttribute: 2,
  165964. values: [0, 0, 1, 0, 1, 1, 0, 1]
  165965. })
  165966. },
  165967. indices: new Uint16Array([0, 1, 2, 0, 2, 3]),
  165968. primitiveType: PrimitiveType_default.TRIANGLES
  165969. });
  165970. vertexArray = VertexArray_default.fromGeometry({
  165971. context: this,
  165972. geometry,
  165973. attributeLocations: viewportQuadAttributeLocations,
  165974. bufferUsage: BufferUsage_default.STATIC_DRAW,
  165975. interleave: true
  165976. });
  165977. this.cache.viewportQuad_vertexArray = vertexArray;
  165978. }
  165979. return vertexArray;
  165980. };
  165981. Context.prototype.createViewportQuadCommand = function(fragmentShaderSource, overrides) {
  165982. overrides = defaultValue_default(overrides, defaultValue_default.EMPTY_OBJECT);
  165983. return new DrawCommand_default({
  165984. vertexArray: this.getViewportQuadVertexArray(),
  165985. primitiveType: PrimitiveType_default.TRIANGLES,
  165986. renderState: overrides.renderState,
  165987. shaderProgram: ShaderProgram_default.fromCache({
  165988. context: this,
  165989. vertexShaderSource: ViewportQuadVS_default,
  165990. fragmentShaderSource,
  165991. attributeLocations: viewportQuadAttributeLocations
  165992. }),
  165993. uniformMap: overrides.uniformMap,
  165994. owner: overrides.owner,
  165995. framebuffer: overrides.framebuffer,
  165996. pass: overrides.pass
  165997. });
  165998. };
  165999. Context.prototype.getObjectByPickColor = function(pickColor) {
  166000. Check_default.defined("pickColor", pickColor);
  166001. return this._pickObjects[pickColor.toRgba()];
  166002. };
  166003. function PickId(pickObjects, key, color) {
  166004. this._pickObjects = pickObjects;
  166005. this.key = key;
  166006. this.color = color;
  166007. }
  166008. Object.defineProperties(PickId.prototype, {
  166009. object: {
  166010. get: function() {
  166011. return this._pickObjects[this.key];
  166012. },
  166013. set: function(value) {
  166014. this._pickObjects[this.key] = value;
  166015. }
  166016. }
  166017. });
  166018. PickId.prototype.destroy = function() {
  166019. delete this._pickObjects[this.key];
  166020. return void 0;
  166021. };
  166022. Context.prototype.createPickId = function(object2) {
  166023. Check_default.defined("object", object2);
  166024. ++this._nextPickColor[0];
  166025. const key = this._nextPickColor[0];
  166026. if (key === 0) {
  166027. throw new RuntimeError_default("Out of unique Pick IDs.");
  166028. }
  166029. this._pickObjects[key] = object2;
  166030. return new PickId(this._pickObjects, key, Color_default.fromRgba(key));
  166031. };
  166032. Context.prototype.isDestroyed = function() {
  166033. return false;
  166034. };
  166035. Context.prototype.destroy = function() {
  166036. const cache = this.cache;
  166037. for (const property in cache) {
  166038. if (cache.hasOwnProperty(property)) {
  166039. const propertyValue = cache[property];
  166040. if (defined_default(propertyValue.destroy)) {
  166041. propertyValue.destroy();
  166042. }
  166043. }
  166044. }
  166045. this._shaderCache = this._shaderCache.destroy();
  166046. this._textureCache = this._textureCache.destroy();
  166047. this._defaultTexture = this._defaultTexture && this._defaultTexture.destroy();
  166048. this._defaultEmissiveTexture = this._defaultEmissiveTexture && this._defaultEmissiveTexture.destroy();
  166049. this._defaultNormalTexture = this._defaultNormalTexture && this._defaultNormalTexture.destroy();
  166050. this._defaultCubeMap = this._defaultCubeMap && this._defaultCubeMap.destroy();
  166051. return destroyObject_default(this);
  166052. };
  166053. var Context_default = Context;
  166054. // node_modules/cesium/Source/Renderer/loadCubeMap.js
  166055. function loadCubeMap(context, urls, skipColorSpaceConversion) {
  166056. Check_default.defined("context", context);
  166057. if (!defined_default(urls) || !defined_default(urls.positiveX) || !defined_default(urls.negativeX) || !defined_default(urls.positiveY) || !defined_default(urls.negativeY) || !defined_default(urls.positiveZ) || !defined_default(urls.negativeZ)) {
  166058. throw new DeveloperError_default(
  166059. "urls is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties."
  166060. );
  166061. }
  166062. const flipOptions = {
  166063. flipY: true,
  166064. skipColorSpaceConversion,
  166065. preferImageBitmap: true
  166066. };
  166067. const facePromises = [
  166068. Resource_default.createIfNeeded(urls.positiveX).fetchImage(flipOptions),
  166069. Resource_default.createIfNeeded(urls.negativeX).fetchImage(flipOptions),
  166070. Resource_default.createIfNeeded(urls.positiveY).fetchImage(flipOptions),
  166071. Resource_default.createIfNeeded(urls.negativeY).fetchImage(flipOptions),
  166072. Resource_default.createIfNeeded(urls.positiveZ).fetchImage(flipOptions),
  166073. Resource_default.createIfNeeded(urls.negativeZ).fetchImage(flipOptions)
  166074. ];
  166075. return Promise.all(facePromises).then(function(images) {
  166076. return new CubeMap_default({
  166077. context,
  166078. source: {
  166079. positiveX: images[0],
  166080. negativeX: images[1],
  166081. positiveY: images[2],
  166082. negativeY: images[3],
  166083. positiveZ: images[4],
  166084. negativeZ: images[5]
  166085. }
  166086. });
  166087. });
  166088. }
  166089. var loadCubeMap_default = loadCubeMap;
  166090. // node_modules/cesium/Source/Scene/DiscardMissingTileImagePolicy.js
  166091. function DiscardMissingTileImagePolicy(options) {
  166092. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  166093. if (!defined_default(options.missingImageUrl)) {
  166094. throw new DeveloperError_default("options.missingImageUrl is required.");
  166095. }
  166096. if (!defined_default(options.pixelsToCheck)) {
  166097. throw new DeveloperError_default("options.pixelsToCheck is required.");
  166098. }
  166099. this._pixelsToCheck = options.pixelsToCheck;
  166100. this._missingImagePixels = void 0;
  166101. this._missingImageByteLength = void 0;
  166102. this._isReady = false;
  166103. const resource = Resource_default.createIfNeeded(options.missingImageUrl);
  166104. const that = this;
  166105. function success(image) {
  166106. if (defined_default(image.blob)) {
  166107. that._missingImageByteLength = image.blob.size;
  166108. }
  166109. let pixels = getImagePixels_default(image);
  166110. if (options.disableCheckIfAllPixelsAreTransparent) {
  166111. let allAreTransparent = true;
  166112. const width = image.width;
  166113. const pixelsToCheck = options.pixelsToCheck;
  166114. for (let i2 = 0, len = pixelsToCheck.length; allAreTransparent && i2 < len; ++i2) {
  166115. const pos = pixelsToCheck[i2];
  166116. const index2 = pos.x * 4 + pos.y * width;
  166117. const alpha = pixels[index2 + 3];
  166118. if (alpha > 0) {
  166119. allAreTransparent = false;
  166120. }
  166121. }
  166122. if (allAreTransparent) {
  166123. pixels = void 0;
  166124. }
  166125. }
  166126. that._missingImagePixels = pixels;
  166127. that._isReady = true;
  166128. }
  166129. function failure() {
  166130. that._missingImagePixels = void 0;
  166131. that._isReady = true;
  166132. }
  166133. resource.fetchImage({
  166134. preferBlob: true,
  166135. preferImageBitmap: true,
  166136. flipY: true
  166137. }).then(success).catch(failure);
  166138. }
  166139. DiscardMissingTileImagePolicy.prototype.isReady = function() {
  166140. return this._isReady;
  166141. };
  166142. DiscardMissingTileImagePolicy.prototype.shouldDiscardImage = function(image) {
  166143. if (!this._isReady) {
  166144. throw new DeveloperError_default(
  166145. "shouldDiscardImage must not be called before the discard policy is ready."
  166146. );
  166147. }
  166148. const pixelsToCheck = this._pixelsToCheck;
  166149. const missingImagePixels = this._missingImagePixels;
  166150. if (!defined_default(missingImagePixels)) {
  166151. return false;
  166152. }
  166153. if (defined_default(image.blob) && image.blob.size !== this._missingImageByteLength) {
  166154. return false;
  166155. }
  166156. const pixels = getImagePixels_default(image);
  166157. const width = image.width;
  166158. for (let i2 = 0, len = pixelsToCheck.length; i2 < len; ++i2) {
  166159. const pos = pixelsToCheck[i2];
  166160. const index2 = pos.x * 4 + pos.y * width;
  166161. for (let offset2 = 0; offset2 < 4; ++offset2) {
  166162. const pixel = index2 + offset2;
  166163. if (pixels[pixel] !== missingImagePixels[pixel]) {
  166164. return false;
  166165. }
  166166. }
  166167. }
  166168. return true;
  166169. };
  166170. var DiscardMissingTileImagePolicy_default = DiscardMissingTileImagePolicy;
  166171. // node_modules/cesium/Source/Scene/ImageryLayerFeatureInfo.js
  166172. function ImageryLayerFeatureInfo() {
  166173. this.name = void 0;
  166174. this.description = void 0;
  166175. this.position = void 0;
  166176. this.data = void 0;
  166177. this.imageryLayer = void 0;
  166178. }
  166179. ImageryLayerFeatureInfo.prototype.configureNameFromProperties = function(properties) {
  166180. let namePropertyPrecedence = 10;
  166181. let nameProperty;
  166182. for (const key in properties) {
  166183. if (properties.hasOwnProperty(key) && properties[key]) {
  166184. const lowerKey = key.toLowerCase();
  166185. if (namePropertyPrecedence > 1 && lowerKey === "name") {
  166186. namePropertyPrecedence = 1;
  166187. nameProperty = key;
  166188. } else if (namePropertyPrecedence > 2 && lowerKey === "title") {
  166189. namePropertyPrecedence = 2;
  166190. nameProperty = key;
  166191. } else if (namePropertyPrecedence > 3 && /name/i.test(key)) {
  166192. namePropertyPrecedence = 3;
  166193. nameProperty = key;
  166194. } else if (namePropertyPrecedence > 4 && /title/i.test(key)) {
  166195. namePropertyPrecedence = 4;
  166196. nameProperty = key;
  166197. }
  166198. }
  166199. }
  166200. if (defined_default(nameProperty)) {
  166201. this.name = properties[nameProperty];
  166202. }
  166203. };
  166204. ImageryLayerFeatureInfo.prototype.configureDescriptionFromProperties = function(properties) {
  166205. function describe(properties2) {
  166206. let html2 = '<table class="cesium-infoBox-defaultTable">';
  166207. for (const key in properties2) {
  166208. if (properties2.hasOwnProperty(key)) {
  166209. const value = properties2[key];
  166210. if (defined_default(value)) {
  166211. if (typeof value === "object") {
  166212. html2 += `<tr><td>${key}</td><td>${describe(value)}</td></tr>`;
  166213. } else {
  166214. html2 += `<tr><td>${key}</td><td>${value}</td></tr>`;
  166215. }
  166216. }
  166217. }
  166218. }
  166219. html2 += "</table>";
  166220. return html2;
  166221. }
  166222. this.description = describe(properties);
  166223. };
  166224. var ImageryLayerFeatureInfo_default = ImageryLayerFeatureInfo;
  166225. // node_modules/cesium/Source/Scene/ImageryProvider.js
  166226. function ImageryProvider() {
  166227. this.defaultAlpha = void 0;
  166228. this.defaultNightAlpha = void 0;
  166229. this.defaultDayAlpha = void 0;
  166230. this.defaultBrightness = void 0;
  166231. this.defaultContrast = void 0;
  166232. this.defaultHue = void 0;
  166233. this.defaultSaturation = void 0;
  166234. this.defaultGamma = void 0;
  166235. this.defaultMinificationFilter = void 0;
  166236. this.defaultMagnificationFilter = void 0;
  166237. DeveloperError_default.throwInstantiationError();
  166238. }
  166239. Object.defineProperties(ImageryProvider.prototype, {
  166240. ready: {
  166241. get: DeveloperError_default.throwInstantiationError
  166242. },
  166243. readyPromise: {
  166244. get: DeveloperError_default.throwInstantiationError
  166245. },
  166246. rectangle: {
  166247. get: DeveloperError_default.throwInstantiationError
  166248. },
  166249. tileWidth: {
  166250. get: DeveloperError_default.throwInstantiationError
  166251. },
  166252. tileHeight: {
  166253. get: DeveloperError_default.throwInstantiationError
  166254. },
  166255. maximumLevel: {
  166256. get: DeveloperError_default.throwInstantiationError
  166257. },
  166258. minimumLevel: {
  166259. get: DeveloperError_default.throwInstantiationError
  166260. },
  166261. tilingScheme: {
  166262. get: DeveloperError_default.throwInstantiationError
  166263. },
  166264. tileDiscardPolicy: {
  166265. get: DeveloperError_default.throwInstantiationError
  166266. },
  166267. errorEvent: {
  166268. get: DeveloperError_default.throwInstantiationError
  166269. },
  166270. credit: {
  166271. get: DeveloperError_default.throwInstantiationError
  166272. },
  166273. proxy: {
  166274. get: DeveloperError_default.throwInstantiationError
  166275. },
  166276. hasAlphaChannel: {
  166277. get: DeveloperError_default.throwInstantiationError
  166278. }
  166279. });
  166280. ImageryProvider.prototype.getTileCredits = function(x, y, level) {
  166281. DeveloperError_default.throwInstantiationError();
  166282. };
  166283. ImageryProvider.prototype.requestImage = function(x, y, level, request) {
  166284. DeveloperError_default.throwInstantiationError();
  166285. };
  166286. ImageryProvider.prototype.pickFeatures = function(x, y, level, longitude, latitude) {
  166287. DeveloperError_default.throwInstantiationError();
  166288. };
  166289. var ktx2Regex4 = /\.ktx2$/i;
  166290. ImageryProvider.loadImage = function(imageryProvider, url2) {
  166291. Check_default.defined("url", url2);
  166292. const resource = Resource_default.createIfNeeded(url2);
  166293. if (ktx2Regex4.test(resource.url)) {
  166294. return loadKTX2_default(resource);
  166295. } else if (defined_default(imageryProvider) && defined_default(imageryProvider.tileDiscardPolicy)) {
  166296. return resource.fetchImage({
  166297. preferBlob: true,
  166298. preferImageBitmap: true,
  166299. flipY: true
  166300. });
  166301. }
  166302. return resource.fetchImage({
  166303. preferImageBitmap: true,
  166304. flipY: true
  166305. });
  166306. };
  166307. var ImageryProvider_default = ImageryProvider;
  166308. // node_modules/cesium/Source/Scene/ArcGisMapServerImageryProvider.js
  166309. function ArcGisMapServerImageryProvider(options) {
  166310. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  166311. if (!defined_default(options.url)) {
  166312. throw new DeveloperError_default("options.url is required.");
  166313. }
  166314. this.defaultAlpha = void 0;
  166315. this.defaultNightAlpha = void 0;
  166316. this.defaultDayAlpha = void 0;
  166317. this.defaultBrightness = void 0;
  166318. this.defaultContrast = void 0;
  166319. this.defaultHue = void 0;
  166320. this.defaultSaturation = void 0;
  166321. this.defaultGamma = void 0;
  166322. this.defaultMinificationFilter = void 0;
  166323. this.defaultMagnificationFilter = void 0;
  166324. const resource = Resource_default.createIfNeeded(options.url);
  166325. resource.appendForwardSlash();
  166326. if (defined_default(options.token)) {
  166327. resource.setQueryParameters({
  166328. token: options.token
  166329. });
  166330. }
  166331. this._resource = resource;
  166332. this._tileDiscardPolicy = options.tileDiscardPolicy;
  166333. this._tileWidth = defaultValue_default(options.tileWidth, 256);
  166334. this._tileHeight = defaultValue_default(options.tileHeight, 256);
  166335. this._maximumLevel = options.maximumLevel;
  166336. this._tilingScheme = defaultValue_default(
  166337. options.tilingScheme,
  166338. new GeographicTilingScheme_default({ ellipsoid: options.ellipsoid })
  166339. );
  166340. this._useTiles = defaultValue_default(options.usePreCachedTilesIfAvailable, true);
  166341. this._rectangle = defaultValue_default(
  166342. options.rectangle,
  166343. this._tilingScheme.rectangle
  166344. );
  166345. this._layers = options.layers;
  166346. let credit = options.credit;
  166347. if (typeof credit === "string") {
  166348. credit = new Credit_default(credit);
  166349. }
  166350. this._credit = credit;
  166351. this.enablePickFeatures = defaultValue_default(options.enablePickFeatures, true);
  166352. this._errorEvent = new Event_default();
  166353. this._ready = false;
  166354. this._readyPromise = defer_default();
  166355. const that = this;
  166356. let metadataError;
  166357. function metadataSuccess(data) {
  166358. const tileInfo = data.tileInfo;
  166359. if (!defined_default(tileInfo)) {
  166360. that._useTiles = false;
  166361. } else {
  166362. that._tileWidth = tileInfo.rows;
  166363. that._tileHeight = tileInfo.cols;
  166364. if (tileInfo.spatialReference.wkid === 102100 || tileInfo.spatialReference.wkid === 102113) {
  166365. that._tilingScheme = new WebMercatorTilingScheme_default({
  166366. ellipsoid: options.ellipsoid
  166367. });
  166368. } else if (data.tileInfo.spatialReference.wkid === 4326) {
  166369. that._tilingScheme = new GeographicTilingScheme_default({
  166370. ellipsoid: options.ellipsoid
  166371. });
  166372. } else {
  166373. const message = `Tile spatial reference WKID ${data.tileInfo.spatialReference.wkid} is not supported.`;
  166374. metadataError = TileProviderError_default.handleError(
  166375. metadataError,
  166376. that,
  166377. that._errorEvent,
  166378. message,
  166379. void 0,
  166380. void 0,
  166381. void 0,
  166382. requestMetadata
  166383. );
  166384. if (!metadataError.retry) {
  166385. that._readyPromise.reject(new RuntimeError_default(message));
  166386. }
  166387. return;
  166388. }
  166389. that._maximumLevel = data.tileInfo.lods.length - 1;
  166390. if (defined_default(data.fullExtent)) {
  166391. if (defined_default(data.fullExtent.spatialReference) && defined_default(data.fullExtent.spatialReference.wkid)) {
  166392. if (data.fullExtent.spatialReference.wkid === 102100 || data.fullExtent.spatialReference.wkid === 102113) {
  166393. const projection = new WebMercatorProjection_default();
  166394. const extent = data.fullExtent;
  166395. const sw = projection.unproject(
  166396. new Cartesian3_default(
  166397. Math.max(
  166398. extent.xmin,
  166399. -that._tilingScheme.ellipsoid.maximumRadius * Math.PI
  166400. ),
  166401. Math.max(
  166402. extent.ymin,
  166403. -that._tilingScheme.ellipsoid.maximumRadius * Math.PI
  166404. ),
  166405. 0
  166406. )
  166407. );
  166408. const ne = projection.unproject(
  166409. new Cartesian3_default(
  166410. Math.min(
  166411. extent.xmax,
  166412. that._tilingScheme.ellipsoid.maximumRadius * Math.PI
  166413. ),
  166414. Math.min(
  166415. extent.ymax,
  166416. that._tilingScheme.ellipsoid.maximumRadius * Math.PI
  166417. ),
  166418. 0
  166419. )
  166420. );
  166421. that._rectangle = new Rectangle_default(
  166422. sw.longitude,
  166423. sw.latitude,
  166424. ne.longitude,
  166425. ne.latitude
  166426. );
  166427. } else if (data.fullExtent.spatialReference.wkid === 4326) {
  166428. that._rectangle = Rectangle_default.fromDegrees(
  166429. data.fullExtent.xmin,
  166430. data.fullExtent.ymin,
  166431. data.fullExtent.xmax,
  166432. data.fullExtent.ymax
  166433. );
  166434. } else {
  166435. const extentMessage = `fullExtent.spatialReference WKID ${data.fullExtent.spatialReference.wkid} is not supported.`;
  166436. metadataError = TileProviderError_default.handleError(
  166437. metadataError,
  166438. that,
  166439. that._errorEvent,
  166440. extentMessage,
  166441. void 0,
  166442. void 0,
  166443. void 0,
  166444. requestMetadata
  166445. );
  166446. if (!metadataError.retry) {
  166447. that._readyPromise.reject(new RuntimeError_default(extentMessage));
  166448. }
  166449. return;
  166450. }
  166451. }
  166452. } else {
  166453. that._rectangle = that._tilingScheme.rectangle;
  166454. }
  166455. if (!defined_default(that._tileDiscardPolicy)) {
  166456. that._tileDiscardPolicy = new DiscardMissingTileImagePolicy_default({
  166457. missingImageUrl: buildImageResource(that, 0, 0, that._maximumLevel).url,
  166458. pixelsToCheck: [
  166459. new Cartesian2_default(0, 0),
  166460. new Cartesian2_default(200, 20),
  166461. new Cartesian2_default(20, 200),
  166462. new Cartesian2_default(80, 110),
  166463. new Cartesian2_default(160, 130)
  166464. ],
  166465. disableCheckIfAllPixelsAreTransparent: true
  166466. });
  166467. }
  166468. that._useTiles = true;
  166469. }
  166470. if (defined_default(data.copyrightText) && data.copyrightText.length > 0) {
  166471. that._credit = new Credit_default(data.copyrightText);
  166472. }
  166473. that._ready = true;
  166474. that._readyPromise.resolve(true);
  166475. TileProviderError_default.handleSuccess(metadataError);
  166476. }
  166477. function metadataFailure(e2) {
  166478. const message = `An error occurred while accessing ${that._resource.url}.`;
  166479. metadataError = TileProviderError_default.handleError(
  166480. metadataError,
  166481. that,
  166482. that._errorEvent,
  166483. message,
  166484. void 0,
  166485. void 0,
  166486. void 0,
  166487. requestMetadata
  166488. );
  166489. that._readyPromise.reject(new RuntimeError_default(message));
  166490. }
  166491. function requestMetadata() {
  166492. const resource2 = that._resource.getDerivedResource({
  166493. queryParameters: {
  166494. f: "json"
  166495. }
  166496. });
  166497. resource2.fetchJsonp().then(function(result) {
  166498. metadataSuccess(result);
  166499. }).catch(function(e2) {
  166500. metadataFailure(e2);
  166501. });
  166502. }
  166503. if (this._useTiles) {
  166504. requestMetadata();
  166505. } else {
  166506. this._ready = true;
  166507. this._readyPromise.resolve(true);
  166508. }
  166509. }
  166510. function buildImageResource(imageryProvider, x, y, level, request) {
  166511. let resource;
  166512. if (imageryProvider._useTiles) {
  166513. resource = imageryProvider._resource.getDerivedResource({
  166514. url: `tile/${level}/${y}/${x}`,
  166515. request
  166516. });
  166517. } else {
  166518. const nativeRectangle = imageryProvider._tilingScheme.tileXYToNativeRectangle(
  166519. x,
  166520. y,
  166521. level
  166522. );
  166523. const bbox2 = `${nativeRectangle.west},${nativeRectangle.south},${nativeRectangle.east},${nativeRectangle.north}`;
  166524. const query = {
  166525. bbox: bbox2,
  166526. size: `${imageryProvider._tileWidth},${imageryProvider._tileHeight}`,
  166527. format: "png32",
  166528. transparent: true,
  166529. f: "image"
  166530. };
  166531. if (imageryProvider._tilingScheme.projection instanceof GeographicProjection_default) {
  166532. query.bboxSR = 4326;
  166533. query.imageSR = 4326;
  166534. } else {
  166535. query.bboxSR = 3857;
  166536. query.imageSR = 3857;
  166537. }
  166538. if (imageryProvider.layers) {
  166539. query.layers = `show:${imageryProvider.layers}`;
  166540. }
  166541. resource = imageryProvider._resource.getDerivedResource({
  166542. url: "export",
  166543. request,
  166544. queryParameters: query
  166545. });
  166546. }
  166547. return resource;
  166548. }
  166549. Object.defineProperties(ArcGisMapServerImageryProvider.prototype, {
  166550. url: {
  166551. get: function() {
  166552. return this._resource._url;
  166553. }
  166554. },
  166555. token: {
  166556. get: function() {
  166557. return this._resource.queryParameters.token;
  166558. }
  166559. },
  166560. proxy: {
  166561. get: function() {
  166562. return this._resource.proxy;
  166563. }
  166564. },
  166565. tileWidth: {
  166566. get: function() {
  166567. if (!this._ready) {
  166568. throw new DeveloperError_default(
  166569. "tileWidth must not be called before the imagery provider is ready."
  166570. );
  166571. }
  166572. return this._tileWidth;
  166573. }
  166574. },
  166575. tileHeight: {
  166576. get: function() {
  166577. if (!this._ready) {
  166578. throw new DeveloperError_default(
  166579. "tileHeight must not be called before the imagery provider is ready."
  166580. );
  166581. }
  166582. return this._tileHeight;
  166583. }
  166584. },
  166585. maximumLevel: {
  166586. get: function() {
  166587. if (!this._ready) {
  166588. throw new DeveloperError_default(
  166589. "maximumLevel must not be called before the imagery provider is ready."
  166590. );
  166591. }
  166592. return this._maximumLevel;
  166593. }
  166594. },
  166595. minimumLevel: {
  166596. get: function() {
  166597. if (!this._ready) {
  166598. throw new DeveloperError_default(
  166599. "minimumLevel must not be called before the imagery provider is ready."
  166600. );
  166601. }
  166602. return 0;
  166603. }
  166604. },
  166605. tilingScheme: {
  166606. get: function() {
  166607. if (!this._ready) {
  166608. throw new DeveloperError_default(
  166609. "tilingScheme must not be called before the imagery provider is ready."
  166610. );
  166611. }
  166612. return this._tilingScheme;
  166613. }
  166614. },
  166615. rectangle: {
  166616. get: function() {
  166617. if (!this._ready) {
  166618. throw new DeveloperError_default(
  166619. "rectangle must not be called before the imagery provider is ready."
  166620. );
  166621. }
  166622. return this._rectangle;
  166623. }
  166624. },
  166625. tileDiscardPolicy: {
  166626. get: function() {
  166627. if (!this._ready) {
  166628. throw new DeveloperError_default(
  166629. "tileDiscardPolicy must not be called before the imagery provider is ready."
  166630. );
  166631. }
  166632. return this._tileDiscardPolicy;
  166633. }
  166634. },
  166635. errorEvent: {
  166636. get: function() {
  166637. return this._errorEvent;
  166638. }
  166639. },
  166640. ready: {
  166641. get: function() {
  166642. return this._ready;
  166643. }
  166644. },
  166645. readyPromise: {
  166646. get: function() {
  166647. return this._readyPromise.promise;
  166648. }
  166649. },
  166650. credit: {
  166651. get: function() {
  166652. return this._credit;
  166653. }
  166654. },
  166655. usingPrecachedTiles: {
  166656. get: function() {
  166657. return this._useTiles;
  166658. }
  166659. },
  166660. hasAlphaChannel: {
  166661. get: function() {
  166662. return true;
  166663. }
  166664. },
  166665. layers: {
  166666. get: function() {
  166667. return this._layers;
  166668. }
  166669. }
  166670. });
  166671. ArcGisMapServerImageryProvider.prototype.getTileCredits = function(x, y, level) {
  166672. return void 0;
  166673. };
  166674. ArcGisMapServerImageryProvider.prototype.requestImage = function(x, y, level, request) {
  166675. if (!this._ready) {
  166676. throw new DeveloperError_default(
  166677. "requestImage must not be called before the imagery provider is ready."
  166678. );
  166679. }
  166680. return ImageryProvider_default.loadImage(
  166681. this,
  166682. buildImageResource(this, x, y, level, request)
  166683. );
  166684. };
  166685. ArcGisMapServerImageryProvider.prototype.pickFeatures = function(x, y, level, longitude, latitude) {
  166686. if (!this._ready) {
  166687. throw new DeveloperError_default(
  166688. "pickFeatures must not be called before the imagery provider is ready."
  166689. );
  166690. }
  166691. if (!this.enablePickFeatures) {
  166692. return void 0;
  166693. }
  166694. const rectangle = this._tilingScheme.tileXYToNativeRectangle(x, y, level);
  166695. let horizontal;
  166696. let vertical;
  166697. let sr;
  166698. if (this._tilingScheme.projection instanceof GeographicProjection_default) {
  166699. horizontal = Math_default.toDegrees(longitude);
  166700. vertical = Math_default.toDegrees(latitude);
  166701. sr = "4326";
  166702. } else {
  166703. const projected = this._tilingScheme.projection.project(
  166704. new Cartographic_default(longitude, latitude, 0)
  166705. );
  166706. horizontal = projected.x;
  166707. vertical = projected.y;
  166708. sr = "3857";
  166709. }
  166710. let layers = "visible";
  166711. if (defined_default(this._layers)) {
  166712. layers += `:${this._layers}`;
  166713. }
  166714. const query = {
  166715. f: "json",
  166716. tolerance: 2,
  166717. geometryType: "esriGeometryPoint",
  166718. geometry: `${horizontal},${vertical}`,
  166719. mapExtent: `${rectangle.west},${rectangle.south},${rectangle.east},${rectangle.north}`,
  166720. imageDisplay: `${this._tileWidth},${this._tileHeight},96`,
  166721. sr,
  166722. layers
  166723. };
  166724. const resource = this._resource.getDerivedResource({
  166725. url: "identify",
  166726. queryParameters: query
  166727. });
  166728. return resource.fetchJson().then(function(json) {
  166729. const result = [];
  166730. const features = json.results;
  166731. if (!defined_default(features)) {
  166732. return result;
  166733. }
  166734. for (let i2 = 0; i2 < features.length; ++i2) {
  166735. const feature2 = features[i2];
  166736. const featureInfo = new ImageryLayerFeatureInfo_default();
  166737. featureInfo.data = feature2;
  166738. featureInfo.name = feature2.value;
  166739. featureInfo.properties = feature2.attributes;
  166740. featureInfo.configureDescriptionFromProperties(feature2.attributes);
  166741. if (feature2.geometryType === "esriGeometryPoint" && feature2.geometry) {
  166742. const wkid = feature2.geometry.spatialReference && feature2.geometry.spatialReference.wkid ? feature2.geometry.spatialReference.wkid : 4326;
  166743. if (wkid === 4326 || wkid === 4283) {
  166744. featureInfo.position = Cartographic_default.fromDegrees(
  166745. feature2.geometry.x,
  166746. feature2.geometry.y,
  166747. feature2.geometry.z
  166748. );
  166749. } else if (wkid === 102100 || wkid === 900913 || wkid === 3857) {
  166750. const projection = new WebMercatorProjection_default();
  166751. featureInfo.position = projection.unproject(
  166752. new Cartesian3_default(
  166753. feature2.geometry.x,
  166754. feature2.geometry.y,
  166755. feature2.geometry.z
  166756. )
  166757. );
  166758. }
  166759. }
  166760. result.push(featureInfo);
  166761. }
  166762. return result;
  166763. });
  166764. };
  166765. var ArcGisMapServerImageryProvider_default = ArcGisMapServerImageryProvider;
  166766. // node_modules/cesium/Source/Scene/AutoExposure.js
  166767. function AutoExposure() {
  166768. this._uniformMap = void 0;
  166769. this._command = void 0;
  166770. this._colorTexture = void 0;
  166771. this._depthTexture = void 0;
  166772. this._ready = false;
  166773. this._name = "czm_autoexposure";
  166774. this._logDepthChanged = void 0;
  166775. this._useLogDepth = void 0;
  166776. this._framebuffers = void 0;
  166777. this._previousLuminance = new FramebufferManager_default();
  166778. this._commands = void 0;
  166779. this._clearCommand = void 0;
  166780. this._minMaxLuminance = new Cartesian2_default();
  166781. this.enabled = true;
  166782. this._enabled = true;
  166783. this.minimumLuminance = 0.1;
  166784. this.maximumLuminance = 10;
  166785. }
  166786. Object.defineProperties(AutoExposure.prototype, {
  166787. ready: {
  166788. get: function() {
  166789. return this._ready;
  166790. }
  166791. },
  166792. name: {
  166793. get: function() {
  166794. return this._name;
  166795. }
  166796. },
  166797. outputTexture: {
  166798. get: function() {
  166799. const framebuffers = this._framebuffers;
  166800. if (!defined_default(framebuffers)) {
  166801. return void 0;
  166802. }
  166803. return framebuffers[framebuffers.length - 1].getColorTexture(0);
  166804. }
  166805. }
  166806. });
  166807. function destroyFramebuffers(autoexposure) {
  166808. const framebuffers = autoexposure._framebuffers;
  166809. if (!defined_default(framebuffers)) {
  166810. return;
  166811. }
  166812. const length3 = framebuffers.length;
  166813. for (let i2 = 0; i2 < length3; ++i2) {
  166814. framebuffers[i2].destroy();
  166815. }
  166816. autoexposure._framebuffers = void 0;
  166817. autoexposure._previousLuminance.destroy();
  166818. autoexposure._previousLuminance = void 0;
  166819. }
  166820. function createFramebuffers(autoexposure, context) {
  166821. destroyFramebuffers(autoexposure);
  166822. let width = autoexposure._width;
  166823. let height = autoexposure._height;
  166824. const pixelDatatype = context.halfFloatingPointTexture ? PixelDatatype_default.HALF_FLOAT : PixelDatatype_default.FLOAT;
  166825. const length3 = Math.ceil(Math.log(Math.max(width, height)) / Math.log(3));
  166826. const framebuffers = new Array(length3);
  166827. for (let i2 = 0; i2 < length3; ++i2) {
  166828. width = Math.max(Math.ceil(width / 3), 1);
  166829. height = Math.max(Math.ceil(height / 3), 1);
  166830. framebuffers[i2] = new FramebufferManager_default();
  166831. framebuffers[i2].update(context, width, height, 1, pixelDatatype);
  166832. }
  166833. const lastTexture = framebuffers[length3 - 1].getColorTexture(0);
  166834. autoexposure._previousLuminance.update(
  166835. context,
  166836. lastTexture.width,
  166837. lastTexture.height,
  166838. 1,
  166839. pixelDatatype
  166840. );
  166841. autoexposure._framebuffers = framebuffers;
  166842. }
  166843. function destroyCommands(autoexposure) {
  166844. const commands = autoexposure._commands;
  166845. if (!defined_default(commands)) {
  166846. return;
  166847. }
  166848. const length3 = commands.length;
  166849. for (let i2 = 0; i2 < length3; ++i2) {
  166850. commands[i2].shaderProgram.destroy();
  166851. }
  166852. autoexposure._commands = void 0;
  166853. }
  166854. function createUniformMap6(autoexposure, index2) {
  166855. let uniforms;
  166856. if (index2 === 0) {
  166857. uniforms = {
  166858. colorTexture: function() {
  166859. return autoexposure._colorTexture;
  166860. },
  166861. colorTextureDimensions: function() {
  166862. return autoexposure._colorTexture.dimensions;
  166863. }
  166864. };
  166865. } else {
  166866. const texture = autoexposure._framebuffers[index2 - 1].getColorTexture(0);
  166867. uniforms = {
  166868. colorTexture: function() {
  166869. return texture;
  166870. },
  166871. colorTextureDimensions: function() {
  166872. return texture.dimensions;
  166873. }
  166874. };
  166875. }
  166876. uniforms.minMaxLuminance = function() {
  166877. return autoexposure._minMaxLuminance;
  166878. };
  166879. uniforms.previousLuminance = function() {
  166880. return autoexposure._previousLuminance.getColorTexture(0);
  166881. };
  166882. return uniforms;
  166883. }
  166884. function getShaderSource(index2, length3) {
  166885. let source = "uniform sampler2D colorTexture; \nvarying vec2 v_textureCoordinates; \nfloat sampleTexture(vec2 offset) { \n";
  166886. if (index2 === 0) {
  166887. source += " vec4 color = texture2D(colorTexture, v_textureCoordinates + offset); \n return czm_luminance(color.rgb); \n";
  166888. } else {
  166889. source += " return texture2D(colorTexture, v_textureCoordinates + offset).r; \n";
  166890. }
  166891. source += "}\n\n";
  166892. source += "uniform vec2 colorTextureDimensions; \nuniform vec2 minMaxLuminance; \nuniform sampler2D previousLuminance; \nvoid main() { \n float color = 0.0; \n float xStep = 1.0 / colorTextureDimensions.x; \n float yStep = 1.0 / colorTextureDimensions.y; \n int count = 0; \n for (int i = 0; i < 3; ++i) { \n for (int j = 0; j < 3; ++j) { \n vec2 offset; \n offset.x = -xStep + float(i) * xStep; \n offset.y = -yStep + float(j) * yStep; \n if (offset.x < 0.0 || offset.x > 1.0 || offset.y < 0.0 || offset.y > 1.0) { \n continue; \n } \n color += sampleTexture(offset); \n ++count; \n } \n } \n if (count > 0) { \n color /= float(count); \n } \n";
  166893. if (index2 === length3 - 1) {
  166894. source += " float previous = texture2D(previousLuminance, vec2(0.5)).r; \n color = clamp(color, minMaxLuminance.x, minMaxLuminance.y); \n color = previous + (color - previous) / (60.0 * 1.5); \n color = clamp(color, minMaxLuminance.x, minMaxLuminance.y); \n";
  166895. }
  166896. source += " gl_FragColor = vec4(color); \n} \n";
  166897. return source;
  166898. }
  166899. function createCommands6(autoexposure, context) {
  166900. destroyCommands(autoexposure);
  166901. const framebuffers = autoexposure._framebuffers;
  166902. const length3 = framebuffers.length;
  166903. const commands = new Array(length3);
  166904. for (let i2 = 0; i2 < length3; ++i2) {
  166905. commands[i2] = context.createViewportQuadCommand(
  166906. getShaderSource(i2, length3),
  166907. {
  166908. framebuffer: framebuffers[i2].framebuffer,
  166909. uniformMap: createUniformMap6(autoexposure, i2)
  166910. }
  166911. );
  166912. }
  166913. autoexposure._commands = commands;
  166914. }
  166915. AutoExposure.prototype.clear = function(context) {
  166916. const framebuffers = this._framebuffers;
  166917. if (!defined_default(framebuffers)) {
  166918. return;
  166919. }
  166920. let clearCommand = this._clearCommand;
  166921. if (!defined_default(clearCommand)) {
  166922. clearCommand = this._clearCommand = new ClearCommand_default({
  166923. color: new Color_default(0, 0, 0, 0),
  166924. framebuffer: void 0
  166925. });
  166926. }
  166927. const length3 = framebuffers.length;
  166928. for (let i2 = 0; i2 < length3; ++i2) {
  166929. framebuffers[i2].clear(context, clearCommand);
  166930. }
  166931. };
  166932. AutoExposure.prototype.update = function(context) {
  166933. const width = context.drawingBufferWidth;
  166934. const height = context.drawingBufferHeight;
  166935. if (width !== this._width || height !== this._height) {
  166936. this._width = width;
  166937. this._height = height;
  166938. createFramebuffers(this, context);
  166939. createCommands6(this, context);
  166940. if (!this._ready) {
  166941. this._ready = true;
  166942. }
  166943. }
  166944. this._minMaxLuminance.x = this.minimumLuminance;
  166945. this._minMaxLuminance.y = this.maximumLuminance;
  166946. const framebuffers = this._framebuffers;
  166947. const temp = framebuffers[framebuffers.length - 1];
  166948. framebuffers[framebuffers.length - 1] = this._previousLuminance;
  166949. this._commands[this._commands.length - 1].framebuffer = this._previousLuminance.framebuffer;
  166950. this._previousLuminance = temp;
  166951. };
  166952. AutoExposure.prototype.execute = function(context, colorTexture) {
  166953. this._colorTexture = colorTexture;
  166954. const commands = this._commands;
  166955. if (!defined_default(commands)) {
  166956. return;
  166957. }
  166958. const length3 = commands.length;
  166959. for (let i2 = 0; i2 < length3; ++i2) {
  166960. commands[i2].execute(context);
  166961. }
  166962. };
  166963. AutoExposure.prototype.isDestroyed = function() {
  166964. return false;
  166965. };
  166966. AutoExposure.prototype.destroy = function() {
  166967. destroyFramebuffers(this);
  166968. destroyCommands(this);
  166969. return destroyObject_default(this);
  166970. };
  166971. var AutoExposure_default = AutoExposure;
  166972. // node_modules/cesium/Source/Scene/BingMapsStyle.js
  166973. var BingMapsStyle = {
  166974. AERIAL: "Aerial",
  166975. AERIAL_WITH_LABELS: "AerialWithLabels",
  166976. AERIAL_WITH_LABELS_ON_DEMAND: "AerialWithLabelsOnDemand",
  166977. ROAD: "Road",
  166978. ROAD_ON_DEMAND: "RoadOnDemand",
  166979. CANVAS_DARK: "CanvasDark",
  166980. CANVAS_LIGHT: "CanvasLight",
  166981. CANVAS_GRAY: "CanvasGray",
  166982. ORDNANCE_SURVEY: "OrdnanceSurvey",
  166983. COLLINS_BART: "CollinsBart"
  166984. };
  166985. var BingMapsStyle_default = Object.freeze(BingMapsStyle);
  166986. // node_modules/cesium/Source/Scene/DiscardEmptyTileImagePolicy.js
  166987. function DiscardEmptyTileImagePolicy(options) {
  166988. }
  166989. DiscardEmptyTileImagePolicy.prototype.isReady = function() {
  166990. return true;
  166991. };
  166992. DiscardEmptyTileImagePolicy.prototype.shouldDiscardImage = function(image) {
  166993. return DiscardEmptyTileImagePolicy.EMPTY_IMAGE === image;
  166994. };
  166995. var emptyImage;
  166996. Object.defineProperties(DiscardEmptyTileImagePolicy, {
  166997. EMPTY_IMAGE: {
  166998. get: function() {
  166999. if (!defined_default(emptyImage)) {
  167000. emptyImage = new Image();
  167001. emptyImage.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
  167002. }
  167003. return emptyImage;
  167004. }
  167005. }
  167006. });
  167007. var DiscardEmptyTileImagePolicy_default = DiscardEmptyTileImagePolicy;
  167008. // node_modules/cesium/Source/Scene/BingMapsImageryProvider.js
  167009. function BingMapsImageryProvider(options) {
  167010. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  167011. const accessKey = options.key;
  167012. if (!defined_default(options.url)) {
  167013. throw new DeveloperError_default("options.url is required.");
  167014. }
  167015. if (!defined_default(accessKey)) {
  167016. throw new DeveloperError_default("options.key is required.");
  167017. }
  167018. this.defaultAlpha = void 0;
  167019. this.defaultNightAlpha = void 0;
  167020. this.defaultDayAlpha = void 0;
  167021. this.defaultBrightness = void 0;
  167022. this.defaultContrast = void 0;
  167023. this.defaultHue = void 0;
  167024. this.defaultSaturation = void 0;
  167025. this.defaultGamma = 1;
  167026. this.defaultMinificationFilter = void 0;
  167027. this.defaultMagnificationFilter = void 0;
  167028. this._key = accessKey;
  167029. this._resource = Resource_default.createIfNeeded(options.url);
  167030. this._resource.appendForwardSlash();
  167031. this._tileProtocol = options.tileProtocol;
  167032. this._mapStyle = defaultValue_default(options.mapStyle, BingMapsStyle_default.AERIAL);
  167033. this._culture = defaultValue_default(options.culture, "");
  167034. this._tileDiscardPolicy = options.tileDiscardPolicy;
  167035. if (!defined_default(this._tileDiscardPolicy)) {
  167036. this._tileDiscardPolicy = new DiscardEmptyTileImagePolicy_default();
  167037. }
  167038. this._proxy = options.proxy;
  167039. this._credit = new Credit_default(
  167040. `<a href="http://www.bing.com"><img src="${BingMapsImageryProvider.logoUrl}" title="Bing Imagery"/></a>`
  167041. );
  167042. this._tilingScheme = new WebMercatorTilingScheme_default({
  167043. numberOfLevelZeroTilesX: 2,
  167044. numberOfLevelZeroTilesY: 2,
  167045. ellipsoid: options.ellipsoid
  167046. });
  167047. this._tileWidth = void 0;
  167048. this._tileHeight = void 0;
  167049. this._maximumLevel = void 0;
  167050. this._imageUrlTemplate = void 0;
  167051. this._imageUrlSubdomains = void 0;
  167052. this._errorEvent = new Event_default();
  167053. this._ready = false;
  167054. this._readyPromise = defer_default();
  167055. let tileProtocol = this._tileProtocol;
  167056. if (defined_default(tileProtocol)) {
  167057. if (tileProtocol.length > 0 && tileProtocol[tileProtocol.length - 1] === ":") {
  167058. tileProtocol = tileProtocol.substr(0, tileProtocol.length - 1);
  167059. }
  167060. } else {
  167061. const documentProtocol = document.location.protocol;
  167062. tileProtocol = documentProtocol === "http:" ? "http" : "https";
  167063. }
  167064. const metadataResource = this._resource.getDerivedResource({
  167065. url: `REST/v1/Imagery/Metadata/${this._mapStyle}`,
  167066. queryParameters: {
  167067. incl: "ImageryProviders",
  167068. key: this._key,
  167069. uriScheme: tileProtocol
  167070. }
  167071. });
  167072. const that = this;
  167073. let metadataError;
  167074. function metadataSuccess(data) {
  167075. if (data.resourceSets.length !== 1) {
  167076. metadataFailure();
  167077. return;
  167078. }
  167079. const resource = data.resourceSets[0].resources[0];
  167080. that._tileWidth = resource.imageWidth;
  167081. that._tileHeight = resource.imageHeight;
  167082. that._maximumLevel = resource.zoomMax - 1;
  167083. that._imageUrlSubdomains = resource.imageUrlSubdomains;
  167084. that._imageUrlTemplate = resource.imageUrl;
  167085. let attributionList = that._attributionList = resource.imageryProviders;
  167086. if (!attributionList) {
  167087. attributionList = that._attributionList = [];
  167088. }
  167089. for (let attributionIndex = 0, attributionLength = attributionList.length; attributionIndex < attributionLength; ++attributionIndex) {
  167090. const attribution = attributionList[attributionIndex];
  167091. if (attribution.credit instanceof Credit_default) {
  167092. break;
  167093. }
  167094. attribution.credit = new Credit_default(attribution.attribution);
  167095. const coverageAreas = attribution.coverageAreas;
  167096. for (let areaIndex = 0, areaLength = attribution.coverageAreas.length; areaIndex < areaLength; ++areaIndex) {
  167097. const area2 = coverageAreas[areaIndex];
  167098. const bbox2 = area2.bbox;
  167099. area2.bbox = new Rectangle_default(
  167100. Math_default.toRadians(bbox2[1]),
  167101. Math_default.toRadians(bbox2[0]),
  167102. Math_default.toRadians(bbox2[3]),
  167103. Math_default.toRadians(bbox2[2])
  167104. );
  167105. }
  167106. }
  167107. that._ready = true;
  167108. that._readyPromise.resolve(true);
  167109. TileProviderError_default.handleSuccess(metadataError);
  167110. }
  167111. function metadataFailure(e2) {
  167112. const message = `An error occurred while accessing ${metadataResource.url}.`;
  167113. metadataError = TileProviderError_default.handleError(
  167114. metadataError,
  167115. that,
  167116. that._errorEvent,
  167117. message,
  167118. void 0,
  167119. void 0,
  167120. void 0,
  167121. requestMetadata
  167122. );
  167123. that._readyPromise.reject(new RuntimeError_default(message));
  167124. }
  167125. const cacheKey = metadataResource.url;
  167126. function requestMetadata() {
  167127. const promise2 = metadataResource.fetchJsonp("jsonp");
  167128. BingMapsImageryProvider._metadataCache[cacheKey] = promise2;
  167129. promise2.then(metadataSuccess).catch(metadataFailure);
  167130. }
  167131. const promise = BingMapsImageryProvider._metadataCache[cacheKey];
  167132. if (defined_default(promise)) {
  167133. promise.then(metadataSuccess).catch(metadataFailure);
  167134. } else {
  167135. requestMetadata();
  167136. }
  167137. }
  167138. Object.defineProperties(BingMapsImageryProvider.prototype, {
  167139. url: {
  167140. get: function() {
  167141. return this._resource.url;
  167142. }
  167143. },
  167144. proxy: {
  167145. get: function() {
  167146. return this._resource.proxy;
  167147. }
  167148. },
  167149. key: {
  167150. get: function() {
  167151. return this._key;
  167152. }
  167153. },
  167154. mapStyle: {
  167155. get: function() {
  167156. return this._mapStyle;
  167157. }
  167158. },
  167159. culture: {
  167160. get: function() {
  167161. return this._culture;
  167162. }
  167163. },
  167164. tileWidth: {
  167165. get: function() {
  167166. if (!this._ready) {
  167167. throw new DeveloperError_default(
  167168. "tileWidth must not be called before the imagery provider is ready."
  167169. );
  167170. }
  167171. return this._tileWidth;
  167172. }
  167173. },
  167174. tileHeight: {
  167175. get: function() {
  167176. if (!this._ready) {
  167177. throw new DeveloperError_default(
  167178. "tileHeight must not be called before the imagery provider is ready."
  167179. );
  167180. }
  167181. return this._tileHeight;
  167182. }
  167183. },
  167184. maximumLevel: {
  167185. get: function() {
  167186. if (!this._ready) {
  167187. throw new DeveloperError_default(
  167188. "maximumLevel must not be called before the imagery provider is ready."
  167189. );
  167190. }
  167191. return this._maximumLevel;
  167192. }
  167193. },
  167194. minimumLevel: {
  167195. get: function() {
  167196. if (!this._ready) {
  167197. throw new DeveloperError_default(
  167198. "minimumLevel must not be called before the imagery provider is ready."
  167199. );
  167200. }
  167201. return 0;
  167202. }
  167203. },
  167204. tilingScheme: {
  167205. get: function() {
  167206. if (!this._ready) {
  167207. throw new DeveloperError_default(
  167208. "tilingScheme must not be called before the imagery provider is ready."
  167209. );
  167210. }
  167211. return this._tilingScheme;
  167212. }
  167213. },
  167214. rectangle: {
  167215. get: function() {
  167216. if (!this._ready) {
  167217. throw new DeveloperError_default(
  167218. "rectangle must not be called before the imagery provider is ready."
  167219. );
  167220. }
  167221. return this._tilingScheme.rectangle;
  167222. }
  167223. },
  167224. tileDiscardPolicy: {
  167225. get: function() {
  167226. if (!this._ready) {
  167227. throw new DeveloperError_default(
  167228. "tileDiscardPolicy must not be called before the imagery provider is ready."
  167229. );
  167230. }
  167231. return this._tileDiscardPolicy;
  167232. }
  167233. },
  167234. errorEvent: {
  167235. get: function() {
  167236. return this._errorEvent;
  167237. }
  167238. },
  167239. ready: {
  167240. get: function() {
  167241. return this._ready;
  167242. }
  167243. },
  167244. readyPromise: {
  167245. get: function() {
  167246. return this._readyPromise.promise;
  167247. }
  167248. },
  167249. credit: {
  167250. get: function() {
  167251. return this._credit;
  167252. }
  167253. },
  167254. hasAlphaChannel: {
  167255. get: function() {
  167256. return false;
  167257. }
  167258. }
  167259. });
  167260. var rectangleScratch6 = new Rectangle_default();
  167261. BingMapsImageryProvider.prototype.getTileCredits = function(x, y, level) {
  167262. if (!this._ready) {
  167263. throw new DeveloperError_default(
  167264. "getTileCredits must not be called before the imagery provider is ready."
  167265. );
  167266. }
  167267. const rectangle = this._tilingScheme.tileXYToRectangle(
  167268. x,
  167269. y,
  167270. level,
  167271. rectangleScratch6
  167272. );
  167273. const result = getRectangleAttribution(
  167274. this._attributionList,
  167275. level,
  167276. rectangle
  167277. );
  167278. return result;
  167279. };
  167280. BingMapsImageryProvider.prototype.requestImage = function(x, y, level, request) {
  167281. if (!this._ready) {
  167282. throw new DeveloperError_default(
  167283. "requestImage must not be called before the imagery provider is ready."
  167284. );
  167285. }
  167286. const promise = ImageryProvider_default.loadImage(
  167287. this,
  167288. buildImageResource2(this, x, y, level, request)
  167289. );
  167290. if (defined_default(promise)) {
  167291. return promise.catch(function(error) {
  167292. if (defined_default(error.blob) && error.blob.size === 0) {
  167293. return DiscardEmptyTileImagePolicy_default.EMPTY_IMAGE;
  167294. }
  167295. return Promise.reject(error);
  167296. });
  167297. }
  167298. return void 0;
  167299. };
  167300. BingMapsImageryProvider.prototype.pickFeatures = function(x, y, level, longitude, latitude) {
  167301. return void 0;
  167302. };
  167303. BingMapsImageryProvider.tileXYToQuadKey = function(x, y, level) {
  167304. let quadkey = "";
  167305. for (let i2 = level; i2 >= 0; --i2) {
  167306. const bitmask = 1 << i2;
  167307. let digit = 0;
  167308. if ((x & bitmask) !== 0) {
  167309. digit |= 1;
  167310. }
  167311. if ((y & bitmask) !== 0) {
  167312. digit |= 2;
  167313. }
  167314. quadkey += digit;
  167315. }
  167316. return quadkey;
  167317. };
  167318. BingMapsImageryProvider.quadKeyToTileXY = function(quadkey) {
  167319. let x = 0;
  167320. let y = 0;
  167321. const level = quadkey.length - 1;
  167322. for (let i2 = level; i2 >= 0; --i2) {
  167323. const bitmask = 1 << i2;
  167324. const digit = +quadkey[level - i2];
  167325. if ((digit & 1) !== 0) {
  167326. x |= bitmask;
  167327. }
  167328. if ((digit & 2) !== 0) {
  167329. y |= bitmask;
  167330. }
  167331. }
  167332. return {
  167333. x,
  167334. y,
  167335. level
  167336. };
  167337. };
  167338. BingMapsImageryProvider._logoUrl = void 0;
  167339. Object.defineProperties(BingMapsImageryProvider, {
  167340. logoUrl: {
  167341. get: function() {
  167342. if (!defined_default(BingMapsImageryProvider._logoUrl)) {
  167343. BingMapsImageryProvider._logoUrl = buildModuleUrl_default(
  167344. "Assets/Images/bing_maps_credit.png"
  167345. );
  167346. }
  167347. return BingMapsImageryProvider._logoUrl;
  167348. },
  167349. set: function(value) {
  167350. Check_default.defined("value", value);
  167351. BingMapsImageryProvider._logoUrl = value;
  167352. }
  167353. }
  167354. });
  167355. function buildImageResource2(imageryProvider, x, y, level, request) {
  167356. const imageUrl = imageryProvider._imageUrlTemplate;
  167357. const subdomains = imageryProvider._imageUrlSubdomains;
  167358. const subdomainIndex = (x + y + level) % subdomains.length;
  167359. return imageryProvider._resource.getDerivedResource({
  167360. url: imageUrl,
  167361. request,
  167362. templateValues: {
  167363. quadkey: BingMapsImageryProvider.tileXYToQuadKey(x, y, level),
  167364. subdomain: subdomains[subdomainIndex],
  167365. culture: imageryProvider._culture
  167366. },
  167367. queryParameters: {
  167368. n: "z"
  167369. }
  167370. });
  167371. }
  167372. var intersectionScratch2 = new Rectangle_default();
  167373. function getRectangleAttribution(attributionList, level, rectangle) {
  167374. ++level;
  167375. const result = [];
  167376. for (let attributionIndex = 0, attributionLength = attributionList.length; attributionIndex < attributionLength; ++attributionIndex) {
  167377. const attribution = attributionList[attributionIndex];
  167378. const coverageAreas = attribution.coverageAreas;
  167379. let included = false;
  167380. for (let areaIndex = 0, areaLength = attribution.coverageAreas.length; !included && areaIndex < areaLength; ++areaIndex) {
  167381. const area2 = coverageAreas[areaIndex];
  167382. if (level >= area2.zoomMin && level <= area2.zoomMax) {
  167383. const intersection = Rectangle_default.intersection(
  167384. rectangle,
  167385. area2.bbox,
  167386. intersectionScratch2
  167387. );
  167388. if (defined_default(intersection)) {
  167389. included = true;
  167390. }
  167391. }
  167392. }
  167393. if (included) {
  167394. result.push(attribution.credit);
  167395. }
  167396. }
  167397. return result;
  167398. }
  167399. BingMapsImageryProvider._metadataCache = {};
  167400. var BingMapsImageryProvider_default = BingMapsImageryProvider;
  167401. // node_modules/cesium/Source/Scene/BoxEmitter.js
  167402. var defaultDimensions = new Cartesian3_default(1, 1, 1);
  167403. function BoxEmitter(dimensions) {
  167404. dimensions = defaultValue_default(dimensions, defaultDimensions);
  167405. Check_default.defined("dimensions", dimensions);
  167406. Check_default.typeOf.number.greaterThanOrEquals("dimensions.x", dimensions.x, 0);
  167407. Check_default.typeOf.number.greaterThanOrEquals("dimensions.y", dimensions.y, 0);
  167408. Check_default.typeOf.number.greaterThanOrEquals("dimensions.z", dimensions.z, 0);
  167409. this._dimensions = Cartesian3_default.clone(dimensions);
  167410. }
  167411. Object.defineProperties(BoxEmitter.prototype, {
  167412. dimensions: {
  167413. get: function() {
  167414. return this._dimensions;
  167415. },
  167416. set: function(value) {
  167417. Check_default.defined("value", value);
  167418. Check_default.typeOf.number.greaterThanOrEquals("value.x", value.x, 0);
  167419. Check_default.typeOf.number.greaterThanOrEquals("value.y", value.y, 0);
  167420. Check_default.typeOf.number.greaterThanOrEquals("value.z", value.z, 0);
  167421. Cartesian3_default.clone(value, this._dimensions);
  167422. }
  167423. }
  167424. });
  167425. var scratchHalfDim = new Cartesian3_default();
  167426. BoxEmitter.prototype.emit = function(particle) {
  167427. const dim = this._dimensions;
  167428. const halfDim = Cartesian3_default.multiplyByScalar(dim, 0.5, scratchHalfDim);
  167429. const x = Math_default.randomBetween(-halfDim.x, halfDim.x);
  167430. const y = Math_default.randomBetween(-halfDim.y, halfDim.y);
  167431. const z = Math_default.randomBetween(-halfDim.z, halfDim.z);
  167432. particle.position = Cartesian3_default.fromElements(x, y, z, particle.position);
  167433. particle.velocity = Cartesian3_default.normalize(
  167434. particle.position,
  167435. particle.velocity
  167436. );
  167437. };
  167438. var BoxEmitter_default = BoxEmitter;
  167439. // node_modules/cesium/Source/Shaders/BrdfLutGeneratorFS.js
  167440. var BrdfLutGeneratorFS_default = "varying vec2 v_textureCoordinates;\nconst float M_PI = 3.141592653589793;\n\nfloat vdcRadicalInverse(int i)\n{\n float r;\n float base = 2.0;\n float value = 0.0;\n float invBase = 1.0 / base;\n float invBi = invBase;\n for (int x = 0; x < 100; x++)\n {\n if (i <= 0)\n {\n break;\n }\n r = mod(float(i), base);\n value += r * invBi;\n invBi *= invBase;\n i = int(float(i) * invBase);\n }\n return value;\n}\n\nvec2 hammersley2D(int i, int N)\n{\n return vec2(float(i) / float(N), vdcRadicalInverse(i));\n}\n\nvec3 importanceSampleGGX(vec2 xi, float roughness, vec3 N)\n{\n float a = roughness * roughness;\n float phi = 2.0 * M_PI * xi.x;\n float cosTheta = sqrt((1.0 - xi.y) / (1.0 + (a * a - 1.0) * xi.y));\n float sinTheta = sqrt(1.0 - cosTheta * cosTheta);\n vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);\n vec3 upVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\n vec3 tangentX = normalize(cross(upVector, N));\n vec3 tangentY = cross(N, tangentX);\n return tangentX * H.x + tangentY * H.y + N * H.z;\n}\n\nfloat G1_Smith(float NdotV, float k)\n{\n return NdotV / (NdotV * (1.0 - k) + k);\n}\n\nfloat G_Smith(float roughness, float NdotV, float NdotL)\n{\n float k = roughness * roughness / 2.0;\n return G1_Smith(NdotV, k) * G1_Smith(NdotL, k);\n}\n\nvec2 integrateBrdf(float roughness, float NdotV)\n{\n vec3 V = vec3(sqrt(1.0 - NdotV * NdotV), 0.0, NdotV);\n float A = 0.0;\n float B = 0.0;\n const int NumSamples = 1024;\n for (int i = 0; i < NumSamples; i++)\n {\n vec2 xi = hammersley2D(i, NumSamples);\n vec3 H = importanceSampleGGX(xi, roughness, vec3(0.0, 0.0, 1.0));\n vec3 L = 2.0 * dot(V, H) * H - V;\n float NdotL = clamp(L.z, 0.0, 1.0);\n float NdotH = clamp(H.z, 0.0, 1.0);\n float VdotH = clamp(dot(V, H), 0.0, 1.0);\n if (NdotL > 0.0)\n {\n float G = G_Smith(roughness, NdotV, NdotL);\n float G_Vis = G * VdotH / (NdotH * NdotV);\n float Fc = pow(1.0 - VdotH, 5.0);\n A += (1.0 - Fc) * G_Vis;\n B += Fc * G_Vis;\n }\n }\n return vec2(A, B) / float(NumSamples);\n}\n\nvoid main()\n{\n gl_FragColor = vec4(integrateBrdf(v_textureCoordinates.y, v_textureCoordinates.x), 0.0, 1.0);\n}\n";
  167441. // node_modules/cesium/Source/Scene/BrdfLutGenerator.js
  167442. function BrdfLutGenerator() {
  167443. this._colorTexture = void 0;
  167444. this._drawCommand = void 0;
  167445. }
  167446. Object.defineProperties(BrdfLutGenerator.prototype, {
  167447. colorTexture: {
  167448. get: function() {
  167449. return this._colorTexture;
  167450. }
  167451. }
  167452. });
  167453. function createCommand2(generator, context, framebuffer) {
  167454. const drawCommand = context.createViewportQuadCommand(BrdfLutGeneratorFS_default, {
  167455. framebuffer,
  167456. renderState: RenderState_default.fromCache({
  167457. viewport: new BoundingRectangle_default(0, 0, 256, 256)
  167458. })
  167459. });
  167460. generator._drawCommand = drawCommand;
  167461. }
  167462. BrdfLutGenerator.prototype.update = function(frameState) {
  167463. if (!defined_default(this._colorTexture)) {
  167464. const context = frameState.context;
  167465. const colorTexture = new Texture_default({
  167466. context,
  167467. width: 256,
  167468. height: 256,
  167469. pixelFormat: PixelFormat_default.RGBA,
  167470. pixelDatatype: PixelDatatype_default.UNSIGNED_BYTE,
  167471. sampler: Sampler_default.NEAREST
  167472. });
  167473. this._colorTexture = colorTexture;
  167474. const framebuffer = new Framebuffer_default({
  167475. context,
  167476. colorTextures: [colorTexture],
  167477. destroyAttachments: false
  167478. });
  167479. createCommand2(this, context, framebuffer);
  167480. this._drawCommand.execute(context);
  167481. framebuffer.destroy();
  167482. this._drawCommand.shaderProgram = this._drawCommand.shaderProgram && this._drawCommand.shaderProgram.destroy();
  167483. }
  167484. };
  167485. BrdfLutGenerator.prototype.isDestroyed = function() {
  167486. return false;
  167487. };
  167488. BrdfLutGenerator.prototype.destroy = function() {
  167489. this._colorTexture = this._colorTexture && this._colorTexture.destroy();
  167490. return destroyObject_default(this);
  167491. };
  167492. var BrdfLutGenerator_default = BrdfLutGenerator;
  167493. // node_modules/cesium/Source/Scene/CameraFlightPath.js
  167494. var CameraFlightPath = {};
  167495. function getAltitude(frustum, dx, dy) {
  167496. let near;
  167497. let top;
  167498. let right;
  167499. if (frustum instanceof PerspectiveFrustum_default) {
  167500. const tanTheta = Math.tan(0.5 * frustum.fovy);
  167501. near = frustum.near;
  167502. top = frustum.near * tanTheta;
  167503. right = frustum.aspectRatio * top;
  167504. return Math.max(dx * near / right, dy * near / top);
  167505. } else if (frustum instanceof PerspectiveOffCenterFrustum_default) {
  167506. near = frustum.near;
  167507. top = frustum.top;
  167508. right = frustum.right;
  167509. return Math.max(dx * near / right, dy * near / top);
  167510. }
  167511. return Math.max(dx, dy);
  167512. }
  167513. var scratchCart = new Cartesian3_default();
  167514. var scratchCart23 = new Cartesian3_default();
  167515. function createPitchFunction(startPitch, endPitch, heightFunction, pitchAdjustHeight) {
  167516. if (defined_default(pitchAdjustHeight) && heightFunction(0.5) > pitchAdjustHeight) {
  167517. const startHeight = heightFunction(0);
  167518. const endHeight = heightFunction(1);
  167519. const middleHeight = heightFunction(0.5);
  167520. const d1 = middleHeight - startHeight;
  167521. const d2 = middleHeight - endHeight;
  167522. return function(time) {
  167523. const altitude = heightFunction(time);
  167524. if (time <= 0.5) {
  167525. const t1 = (altitude - startHeight) / d1;
  167526. return Math_default.lerp(startPitch, -Math_default.PI_OVER_TWO, t1);
  167527. }
  167528. const t2 = (altitude - endHeight) / d2;
  167529. return Math_default.lerp(-Math_default.PI_OVER_TWO, endPitch, 1 - t2);
  167530. };
  167531. }
  167532. return function(time) {
  167533. return Math_default.lerp(startPitch, endPitch, time);
  167534. };
  167535. }
  167536. function createHeightFunction(camera, destination, startHeight, endHeight, optionAltitude) {
  167537. let altitude = optionAltitude;
  167538. const maxHeight = Math.max(startHeight, endHeight);
  167539. if (!defined_default(altitude)) {
  167540. const start = camera.position;
  167541. const end = destination;
  167542. const up = camera.up;
  167543. const right = camera.right;
  167544. const frustum = camera.frustum;
  167545. const diff = Cartesian3_default.subtract(start, end, scratchCart);
  167546. const verticalDistance = Cartesian3_default.magnitude(
  167547. Cartesian3_default.multiplyByScalar(up, Cartesian3_default.dot(diff, up), scratchCart23)
  167548. );
  167549. const horizontalDistance = Cartesian3_default.magnitude(
  167550. Cartesian3_default.multiplyByScalar(
  167551. right,
  167552. Cartesian3_default.dot(diff, right),
  167553. scratchCart23
  167554. )
  167555. );
  167556. altitude = Math.min(
  167557. getAltitude(frustum, verticalDistance, horizontalDistance) * 0.2,
  167558. 1e9
  167559. );
  167560. }
  167561. if (maxHeight < altitude) {
  167562. const power = 8;
  167563. const factor2 = 1e6;
  167564. const s2 = -Math.pow((altitude - startHeight) * factor2, 1 / power);
  167565. const e2 = Math.pow((altitude - endHeight) * factor2, 1 / power);
  167566. return function(t) {
  167567. const x = t * (e2 - s2) + s2;
  167568. return -Math.pow(x, power) / factor2 + altitude;
  167569. };
  167570. }
  167571. return function(t) {
  167572. return Math_default.lerp(startHeight, endHeight, t);
  167573. };
  167574. }
  167575. function adjustAngleForLERP(startAngle, endAngle) {
  167576. if (Math_default.equalsEpsilon(
  167577. startAngle,
  167578. Math_default.TWO_PI,
  167579. Math_default.EPSILON11
  167580. )) {
  167581. startAngle = 0;
  167582. }
  167583. if (endAngle > startAngle + Math.PI) {
  167584. startAngle += Math_default.TWO_PI;
  167585. } else if (endAngle < startAngle - Math.PI) {
  167586. startAngle -= Math_default.TWO_PI;
  167587. }
  167588. return startAngle;
  167589. }
  167590. var scratchStart = new Cartesian3_default();
  167591. function createUpdateCV(scene, duration, destination, heading, pitch, roll, optionAltitude, optionPitchAdjustHeight) {
  167592. const camera = scene.camera;
  167593. const start = Cartesian3_default.clone(camera.position, scratchStart);
  167594. const startPitch = camera.pitch;
  167595. const startHeading = adjustAngleForLERP(camera.heading, heading);
  167596. const startRoll = adjustAngleForLERP(camera.roll, roll);
  167597. const heightFunction = createHeightFunction(
  167598. camera,
  167599. destination,
  167600. start.z,
  167601. destination.z,
  167602. optionAltitude
  167603. );
  167604. const pitchFunction = createPitchFunction(
  167605. startPitch,
  167606. pitch,
  167607. heightFunction,
  167608. optionPitchAdjustHeight
  167609. );
  167610. function update7(value) {
  167611. const time = value.time / duration;
  167612. camera.setView({
  167613. orientation: {
  167614. heading: Math_default.lerp(startHeading, heading, time),
  167615. pitch: pitchFunction(time),
  167616. roll: Math_default.lerp(startRoll, roll, time)
  167617. }
  167618. });
  167619. Cartesian2_default.lerp(start, destination, time, camera.position);
  167620. camera.position.z = heightFunction(time);
  167621. }
  167622. return update7;
  167623. }
  167624. function useLongestFlight(startCart, destCart) {
  167625. if (startCart.longitude < destCart.longitude) {
  167626. startCart.longitude += Math_default.TWO_PI;
  167627. } else {
  167628. destCart.longitude += Math_default.TWO_PI;
  167629. }
  167630. }
  167631. function useShortestFlight(startCart, destCart) {
  167632. const diff = startCart.longitude - destCart.longitude;
  167633. if (diff < -Math_default.PI) {
  167634. startCart.longitude += Math_default.TWO_PI;
  167635. } else if (diff > Math_default.PI) {
  167636. destCart.longitude += Math_default.TWO_PI;
  167637. }
  167638. }
  167639. var scratchStartCart = new Cartographic_default();
  167640. var scratchEndCart = new Cartographic_default();
  167641. function createUpdate3D(scene, duration, destination, heading, pitch, roll, optionAltitude, optionFlyOverLongitude, optionFlyOverLongitudeWeight, optionPitchAdjustHeight) {
  167642. const camera = scene.camera;
  167643. const projection = scene.mapProjection;
  167644. const ellipsoid = projection.ellipsoid;
  167645. const startCart = Cartographic_default.clone(
  167646. camera.positionCartographic,
  167647. scratchStartCart
  167648. );
  167649. const startPitch = camera.pitch;
  167650. const startHeading = adjustAngleForLERP(camera.heading, heading);
  167651. const startRoll = adjustAngleForLERP(camera.roll, roll);
  167652. const destCart = ellipsoid.cartesianToCartographic(
  167653. destination,
  167654. scratchEndCart
  167655. );
  167656. startCart.longitude = Math_default.zeroToTwoPi(startCart.longitude);
  167657. destCart.longitude = Math_default.zeroToTwoPi(destCart.longitude);
  167658. let useLongFlight = false;
  167659. if (defined_default(optionFlyOverLongitude)) {
  167660. const hitLon = Math_default.zeroToTwoPi(optionFlyOverLongitude);
  167661. const lonMin = Math.min(startCart.longitude, destCart.longitude);
  167662. const lonMax = Math.max(startCart.longitude, destCart.longitude);
  167663. const hitInside = hitLon >= lonMin && hitLon <= lonMax;
  167664. if (defined_default(optionFlyOverLongitudeWeight)) {
  167665. const din = Math.abs(startCart.longitude - destCart.longitude);
  167666. const dot2 = Math_default.TWO_PI - din;
  167667. const hitDistance = hitInside ? din : dot2;
  167668. const offDistance = hitInside ? dot2 : din;
  167669. if (hitDistance < offDistance * optionFlyOverLongitudeWeight && !hitInside) {
  167670. useLongFlight = true;
  167671. }
  167672. } else if (!hitInside) {
  167673. useLongFlight = true;
  167674. }
  167675. }
  167676. if (useLongFlight) {
  167677. useLongestFlight(startCart, destCart);
  167678. } else {
  167679. useShortestFlight(startCart, destCart);
  167680. }
  167681. const heightFunction = createHeightFunction(
  167682. camera,
  167683. destination,
  167684. startCart.height,
  167685. destCart.height,
  167686. optionAltitude
  167687. );
  167688. const pitchFunction = createPitchFunction(
  167689. startPitch,
  167690. pitch,
  167691. heightFunction,
  167692. optionPitchAdjustHeight
  167693. );
  167694. function isolateUpdateFunction() {
  167695. const startLongitude = startCart.longitude;
  167696. const destLongitude = destCart.longitude;
  167697. const startLatitude = startCart.latitude;
  167698. const destLatitude = destCart.latitude;
  167699. return function update7(value) {
  167700. const time = value.time / duration;
  167701. const position = Cartesian3_default.fromRadians(
  167702. Math_default.lerp(startLongitude, destLongitude, time),
  167703. Math_default.lerp(startLatitude, destLatitude, time),
  167704. heightFunction(time),
  167705. ellipsoid
  167706. );
  167707. camera.setView({
  167708. destination: position,
  167709. orientation: {
  167710. heading: Math_default.lerp(startHeading, heading, time),
  167711. pitch: pitchFunction(time),
  167712. roll: Math_default.lerp(startRoll, roll, time)
  167713. }
  167714. });
  167715. };
  167716. }
  167717. return isolateUpdateFunction();
  167718. }
  167719. function createUpdate2D(scene, duration, destination, heading, pitch, roll, optionAltitude) {
  167720. const camera = scene.camera;
  167721. const start = Cartesian3_default.clone(camera.position, scratchStart);
  167722. const startHeading = adjustAngleForLERP(camera.heading, heading);
  167723. const startHeight = camera.frustum.right - camera.frustum.left;
  167724. const heightFunction = createHeightFunction(
  167725. camera,
  167726. destination,
  167727. startHeight,
  167728. destination.z,
  167729. optionAltitude
  167730. );
  167731. function update7(value) {
  167732. const time = value.time / duration;
  167733. camera.setView({
  167734. orientation: {
  167735. heading: Math_default.lerp(startHeading, heading, time)
  167736. }
  167737. });
  167738. Cartesian2_default.lerp(start, destination, time, camera.position);
  167739. const zoom = heightFunction(time);
  167740. const frustum = camera.frustum;
  167741. const ratio = frustum.top / frustum.right;
  167742. const incrementAmount = (zoom - (frustum.right - frustum.left)) * 0.5;
  167743. frustum.right += incrementAmount;
  167744. frustum.left -= incrementAmount;
  167745. frustum.top = ratio * frustum.right;
  167746. frustum.bottom = -frustum.top;
  167747. }
  167748. return update7;
  167749. }
  167750. var scratchCartographic15 = new Cartographic_default();
  167751. var scratchDestination = new Cartesian3_default();
  167752. function emptyFlight(complete, cancel) {
  167753. return {
  167754. startObject: {},
  167755. stopObject: {},
  167756. duration: 0,
  167757. complete,
  167758. cancel
  167759. };
  167760. }
  167761. function wrapCallback(controller, cb) {
  167762. function wrapped() {
  167763. if (typeof cb === "function") {
  167764. cb();
  167765. }
  167766. controller.enableInputs = true;
  167767. }
  167768. return wrapped;
  167769. }
  167770. CameraFlightPath.createTween = function(scene, options) {
  167771. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  167772. let destination = options.destination;
  167773. if (!defined_default(scene)) {
  167774. throw new DeveloperError_default("scene is required.");
  167775. }
  167776. if (!defined_default(destination)) {
  167777. throw new DeveloperError_default("destination is required.");
  167778. }
  167779. const mode2 = scene.mode;
  167780. if (mode2 === SceneMode_default.MORPHING) {
  167781. return emptyFlight();
  167782. }
  167783. const convert = defaultValue_default(options.convert, true);
  167784. const projection = scene.mapProjection;
  167785. const ellipsoid = projection.ellipsoid;
  167786. const maximumHeight = options.maximumHeight;
  167787. const flyOverLongitude = options.flyOverLongitude;
  167788. const flyOverLongitudeWeight = options.flyOverLongitudeWeight;
  167789. const pitchAdjustHeight = options.pitchAdjustHeight;
  167790. let easingFunction = options.easingFunction;
  167791. if (convert && mode2 !== SceneMode_default.SCENE3D) {
  167792. ellipsoid.cartesianToCartographic(destination, scratchCartographic15);
  167793. destination = projection.project(scratchCartographic15, scratchDestination);
  167794. }
  167795. const camera = scene.camera;
  167796. const transform4 = options.endTransform;
  167797. if (defined_default(transform4)) {
  167798. camera._setTransform(transform4);
  167799. }
  167800. let duration = options.duration;
  167801. if (!defined_default(duration)) {
  167802. duration = Math.ceil(Cartesian3_default.distance(camera.position, destination) / 1e6) + 2;
  167803. duration = Math.min(duration, 3);
  167804. }
  167805. const heading = defaultValue_default(options.heading, 0);
  167806. const pitch = defaultValue_default(options.pitch, -Math_default.PI_OVER_TWO);
  167807. const roll = defaultValue_default(options.roll, 0);
  167808. const controller = scene.screenSpaceCameraController;
  167809. controller.enableInputs = false;
  167810. const complete = wrapCallback(controller, options.complete);
  167811. const cancel = wrapCallback(controller, options.cancel);
  167812. const frustum = camera.frustum;
  167813. let empty = scene.mode === SceneMode_default.SCENE2D;
  167814. empty = empty && Cartesian2_default.equalsEpsilon(camera.position, destination, Math_default.EPSILON6);
  167815. empty = empty && Math_default.equalsEpsilon(
  167816. Math.max(frustum.right - frustum.left, frustum.top - frustum.bottom),
  167817. destination.z,
  167818. Math_default.EPSILON6
  167819. );
  167820. empty = empty || scene.mode !== SceneMode_default.SCENE2D && Cartesian3_default.equalsEpsilon(
  167821. destination,
  167822. camera.position,
  167823. Math_default.EPSILON10
  167824. );
  167825. empty = empty && Math_default.equalsEpsilon(
  167826. Math_default.negativePiToPi(heading),
  167827. Math_default.negativePiToPi(camera.heading),
  167828. Math_default.EPSILON10
  167829. ) && Math_default.equalsEpsilon(
  167830. Math_default.negativePiToPi(pitch),
  167831. Math_default.negativePiToPi(camera.pitch),
  167832. Math_default.EPSILON10
  167833. ) && Math_default.equalsEpsilon(
  167834. Math_default.negativePiToPi(roll),
  167835. Math_default.negativePiToPi(camera.roll),
  167836. Math_default.EPSILON10
  167837. );
  167838. if (empty) {
  167839. return emptyFlight(complete, cancel);
  167840. }
  167841. const updateFunctions2 = new Array(4);
  167842. updateFunctions2[SceneMode_default.SCENE2D] = createUpdate2D;
  167843. updateFunctions2[SceneMode_default.SCENE3D] = createUpdate3D;
  167844. updateFunctions2[SceneMode_default.COLUMBUS_VIEW] = createUpdateCV;
  167845. if (duration <= 0) {
  167846. const newOnComplete = function() {
  167847. const update8 = updateFunctions2[mode2](
  167848. scene,
  167849. 1,
  167850. destination,
  167851. heading,
  167852. pitch,
  167853. roll,
  167854. maximumHeight,
  167855. flyOverLongitude,
  167856. flyOverLongitudeWeight,
  167857. pitchAdjustHeight
  167858. );
  167859. update8({ time: 1 });
  167860. if (typeof complete === "function") {
  167861. complete();
  167862. }
  167863. };
  167864. return emptyFlight(newOnComplete, cancel);
  167865. }
  167866. const update7 = updateFunctions2[mode2](
  167867. scene,
  167868. duration,
  167869. destination,
  167870. heading,
  167871. pitch,
  167872. roll,
  167873. maximumHeight,
  167874. flyOverLongitude,
  167875. flyOverLongitudeWeight,
  167876. pitchAdjustHeight
  167877. );
  167878. if (!defined_default(easingFunction)) {
  167879. const startHeight = camera.positionCartographic.height;
  167880. const endHeight = mode2 === SceneMode_default.SCENE3D ? ellipsoid.cartesianToCartographic(destination).height : destination.z;
  167881. if (startHeight > endHeight && startHeight > 11500) {
  167882. easingFunction = EasingFunction_default.CUBIC_OUT;
  167883. } else {
  167884. easingFunction = EasingFunction_default.QUINTIC_IN_OUT;
  167885. }
  167886. }
  167887. return {
  167888. duration,
  167889. easingFunction,
  167890. startObject: {
  167891. time: 0
  167892. },
  167893. stopObject: {
  167894. time: duration
  167895. },
  167896. update: update7,
  167897. complete,
  167898. cancel
  167899. };
  167900. };
  167901. var CameraFlightPath_default = CameraFlightPath;
  167902. // node_modules/cesium/Source/Scene/MapMode2D.js
  167903. var MapMode2D = {
  167904. ROTATE: 0,
  167905. INFINITE_SCROLL: 1
  167906. };
  167907. var MapMode2D_default = Object.freeze(MapMode2D);
  167908. // node_modules/cesium/Source/Scene/Camera.js
  167909. function Camera(scene) {
  167910. if (!defined_default(scene)) {
  167911. throw new DeveloperError_default("scene is required.");
  167912. }
  167913. this._scene = scene;
  167914. this._transform = Matrix4_default.clone(Matrix4_default.IDENTITY);
  167915. this._invTransform = Matrix4_default.clone(Matrix4_default.IDENTITY);
  167916. this._actualTransform = Matrix4_default.clone(Matrix4_default.IDENTITY);
  167917. this._actualInvTransform = Matrix4_default.clone(Matrix4_default.IDENTITY);
  167918. this._transformChanged = false;
  167919. this.position = new Cartesian3_default();
  167920. this._position = new Cartesian3_default();
  167921. this._positionWC = new Cartesian3_default();
  167922. this._positionCartographic = new Cartographic_default();
  167923. this._oldPositionWC = void 0;
  167924. this.positionWCDeltaMagnitude = 0;
  167925. this.positionWCDeltaMagnitudeLastFrame = 0;
  167926. this.timeSinceMoved = 0;
  167927. this._lastMovedTimestamp = 0;
  167928. this.direction = new Cartesian3_default();
  167929. this._direction = new Cartesian3_default();
  167930. this._directionWC = new Cartesian3_default();
  167931. this.up = new Cartesian3_default();
  167932. this._up = new Cartesian3_default();
  167933. this._upWC = new Cartesian3_default();
  167934. this.right = new Cartesian3_default();
  167935. this._right = new Cartesian3_default();
  167936. this._rightWC = new Cartesian3_default();
  167937. this.frustum = new PerspectiveFrustum_default();
  167938. this.frustum.aspectRatio = scene.drawingBufferWidth / scene.drawingBufferHeight;
  167939. this.frustum.fov = Math_default.toRadians(60);
  167940. this.defaultMoveAmount = 1e5;
  167941. this.defaultLookAmount = Math.PI / 60;
  167942. this.defaultRotateAmount = Math.PI / 3600;
  167943. this.defaultZoomAmount = 1e5;
  167944. this.constrainedAxis = void 0;
  167945. this.maximumZoomFactor = 1.5;
  167946. this._moveStart = new Event_default();
  167947. this._moveEnd = new Event_default();
  167948. this._changed = new Event_default();
  167949. this._changedPosition = void 0;
  167950. this._changedDirection = void 0;
  167951. this._changedFrustum = void 0;
  167952. this._changedHeading = void 0;
  167953. this.percentageChanged = 0.5;
  167954. this._viewMatrix = new Matrix4_default();
  167955. this._invViewMatrix = new Matrix4_default();
  167956. updateViewMatrix(this);
  167957. this._mode = SceneMode_default.SCENE3D;
  167958. this._modeChanged = true;
  167959. const projection = scene.mapProjection;
  167960. this._projection = projection;
  167961. this._maxCoord = projection.project(
  167962. new Cartographic_default(Math.PI, Math_default.PI_OVER_TWO)
  167963. );
  167964. this._max2Dfrustum = void 0;
  167965. rectangleCameraPosition3D(
  167966. this,
  167967. Camera.DEFAULT_VIEW_RECTANGLE,
  167968. this.position,
  167969. true
  167970. );
  167971. let mag = Cartesian3_default.magnitude(this.position);
  167972. mag += mag * Camera.DEFAULT_VIEW_FACTOR;
  167973. Cartesian3_default.normalize(this.position, this.position);
  167974. Cartesian3_default.multiplyByScalar(this.position, mag, this.position);
  167975. }
  167976. Camera.TRANSFORM_2D = new Matrix4_default(
  167977. 0,
  167978. 0,
  167979. 1,
  167980. 0,
  167981. 1,
  167982. 0,
  167983. 0,
  167984. 0,
  167985. 0,
  167986. 1,
  167987. 0,
  167988. 0,
  167989. 0,
  167990. 0,
  167991. 0,
  167992. 1
  167993. );
  167994. Camera.TRANSFORM_2D_INVERSE = Matrix4_default.inverseTransformation(
  167995. Camera.TRANSFORM_2D,
  167996. new Matrix4_default()
  167997. );
  167998. Camera.DEFAULT_VIEW_RECTANGLE = Rectangle_default.fromDegrees(
  167999. -95,
  168000. -20,
  168001. -70,
  168002. 90
  168003. );
  168004. Camera.DEFAULT_VIEW_FACTOR = 0.5;
  168005. Camera.DEFAULT_OFFSET = new HeadingPitchRange_default(
  168006. 0,
  168007. -Math_default.PI_OVER_FOUR,
  168008. 0
  168009. );
  168010. function updateViewMatrix(camera) {
  168011. Matrix4_default.computeView(
  168012. camera._position,
  168013. camera._direction,
  168014. camera._up,
  168015. camera._right,
  168016. camera._viewMatrix
  168017. );
  168018. Matrix4_default.multiply(
  168019. camera._viewMatrix,
  168020. camera._actualInvTransform,
  168021. camera._viewMatrix
  168022. );
  168023. Matrix4_default.inverseTransformation(camera._viewMatrix, camera._invViewMatrix);
  168024. }
  168025. function updateCameraDeltas(camera) {
  168026. if (!defined_default(camera._oldPositionWC)) {
  168027. camera._oldPositionWC = Cartesian3_default.clone(
  168028. camera.positionWC,
  168029. camera._oldPositionWC
  168030. );
  168031. } else {
  168032. camera.positionWCDeltaMagnitudeLastFrame = camera.positionWCDeltaMagnitude;
  168033. const delta = Cartesian3_default.subtract(
  168034. camera.positionWC,
  168035. camera._oldPositionWC,
  168036. camera._oldPositionWC
  168037. );
  168038. camera.positionWCDeltaMagnitude = Cartesian3_default.magnitude(delta);
  168039. camera._oldPositionWC = Cartesian3_default.clone(
  168040. camera.positionWC,
  168041. camera._oldPositionWC
  168042. );
  168043. if (camera.positionWCDeltaMagnitude > 0) {
  168044. camera.timeSinceMoved = 0;
  168045. camera._lastMovedTimestamp = getTimestamp_default();
  168046. } else {
  168047. camera.timeSinceMoved = Math.max(getTimestamp_default() - camera._lastMovedTimestamp, 0) / 1e3;
  168048. }
  168049. }
  168050. }
  168051. Camera.prototype.canPreloadFlight = function() {
  168052. return defined_default(this._currentFlight) && this._mode !== SceneMode_default.SCENE2D;
  168053. };
  168054. Camera.prototype._updateCameraChanged = function() {
  168055. const camera = this;
  168056. updateCameraDeltas(camera);
  168057. if (camera._changed.numberOfListeners === 0) {
  168058. return;
  168059. }
  168060. const percentageChanged = camera.percentageChanged;
  168061. const currentHeading = camera.heading;
  168062. if (!defined_default(camera._changedHeading)) {
  168063. camera._changedHeading = currentHeading;
  168064. }
  168065. let delta = Math.abs(camera._changedHeading - currentHeading) % Math_default.TWO_PI;
  168066. delta = delta > Math_default.PI ? Math_default.TWO_PI - delta : delta;
  168067. const headingChangedPercentage = delta / Math.PI;
  168068. if (headingChangedPercentage > percentageChanged) {
  168069. camera._changed.raiseEvent(headingChangedPercentage);
  168070. camera._changedHeading = currentHeading;
  168071. }
  168072. if (camera._mode === SceneMode_default.SCENE2D) {
  168073. if (!defined_default(camera._changedFrustum)) {
  168074. camera._changedPosition = Cartesian3_default.clone(
  168075. camera.position,
  168076. camera._changedPosition
  168077. );
  168078. camera._changedFrustum = camera.frustum.clone();
  168079. return;
  168080. }
  168081. const position = camera.position;
  168082. const lastPosition = camera._changedPosition;
  168083. const frustum = camera.frustum;
  168084. const lastFrustum = camera._changedFrustum;
  168085. const x0 = position.x + frustum.left;
  168086. const x1 = position.x + frustum.right;
  168087. const x2 = lastPosition.x + lastFrustum.left;
  168088. const x3 = lastPosition.x + lastFrustum.right;
  168089. const y0 = position.y + frustum.bottom;
  168090. const y1 = position.y + frustum.top;
  168091. const y2 = lastPosition.y + lastFrustum.bottom;
  168092. const y3 = lastPosition.y + lastFrustum.top;
  168093. const leftX = Math.max(x0, x2);
  168094. const rightX = Math.min(x1, x3);
  168095. const bottomY = Math.max(y0, y2);
  168096. const topY = Math.min(y1, y3);
  168097. let areaPercentage;
  168098. if (leftX >= rightX || bottomY >= y1) {
  168099. areaPercentage = 1;
  168100. } else {
  168101. let areaRef = lastFrustum;
  168102. if (x0 < x2 && x1 > x3 && y0 < y2 && y1 > y3) {
  168103. areaRef = frustum;
  168104. }
  168105. areaPercentage = 1 - (rightX - leftX) * (topY - bottomY) / ((areaRef.right - areaRef.left) * (areaRef.top - areaRef.bottom));
  168106. }
  168107. if (areaPercentage > percentageChanged) {
  168108. camera._changed.raiseEvent(areaPercentage);
  168109. camera._changedPosition = Cartesian3_default.clone(
  168110. camera.position,
  168111. camera._changedPosition
  168112. );
  168113. camera._changedFrustum = camera.frustum.clone(camera._changedFrustum);
  168114. }
  168115. return;
  168116. }
  168117. if (!defined_default(camera._changedDirection)) {
  168118. camera._changedPosition = Cartesian3_default.clone(
  168119. camera.positionWC,
  168120. camera._changedPosition
  168121. );
  168122. camera._changedDirection = Cartesian3_default.clone(
  168123. camera.directionWC,
  168124. camera._changedDirection
  168125. );
  168126. return;
  168127. }
  168128. const dirAngle = Math_default.acosClamped(
  168129. Cartesian3_default.dot(camera.directionWC, camera._changedDirection)
  168130. );
  168131. let dirPercentage;
  168132. if (defined_default(camera.frustum.fovy)) {
  168133. dirPercentage = dirAngle / (camera.frustum.fovy * 0.5);
  168134. } else {
  168135. dirPercentage = dirAngle;
  168136. }
  168137. const distance2 = Cartesian3_default.distance(
  168138. camera.positionWC,
  168139. camera._changedPosition
  168140. );
  168141. const heightPercentage = distance2 / camera.positionCartographic.height;
  168142. if (dirPercentage > percentageChanged || heightPercentage > percentageChanged) {
  168143. camera._changed.raiseEvent(Math.max(dirPercentage, heightPercentage));
  168144. camera._changedPosition = Cartesian3_default.clone(
  168145. camera.positionWC,
  168146. camera._changedPosition
  168147. );
  168148. camera._changedDirection = Cartesian3_default.clone(
  168149. camera.directionWC,
  168150. camera._changedDirection
  168151. );
  168152. }
  168153. };
  168154. function convertTransformForColumbusView(camera) {
  168155. Transforms_default.basisTo2D(
  168156. camera._projection,
  168157. camera._transform,
  168158. camera._actualTransform
  168159. );
  168160. }
  168161. var scratchCartographic16 = new Cartographic_default();
  168162. var scratchCartesian3Projection2 = new Cartesian3_default();
  168163. var scratchCartesian313 = new Cartesian3_default();
  168164. var scratchCartesian4Origin = new Cartesian4_default();
  168165. var scratchCartesian4NewOrigin = new Cartesian4_default();
  168166. var scratchCartesian4NewXAxis = new Cartesian4_default();
  168167. var scratchCartesian4NewYAxis = new Cartesian4_default();
  168168. var scratchCartesian4NewZAxis = new Cartesian4_default();
  168169. function convertTransformFor2D(camera) {
  168170. const projection = camera._projection;
  168171. const ellipsoid = projection.ellipsoid;
  168172. const origin = Matrix4_default.getColumn(
  168173. camera._transform,
  168174. 3,
  168175. scratchCartesian4Origin
  168176. );
  168177. const cartographic2 = ellipsoid.cartesianToCartographic(
  168178. origin,
  168179. scratchCartographic16
  168180. );
  168181. const projectedPosition2 = projection.project(
  168182. cartographic2,
  168183. scratchCartesian3Projection2
  168184. );
  168185. const newOrigin = scratchCartesian4NewOrigin;
  168186. newOrigin.x = projectedPosition2.z;
  168187. newOrigin.y = projectedPosition2.x;
  168188. newOrigin.z = projectedPosition2.y;
  168189. newOrigin.w = 1;
  168190. const newZAxis = Cartesian4_default.clone(
  168191. Cartesian4_default.UNIT_X,
  168192. scratchCartesian4NewZAxis
  168193. );
  168194. const xAxis = Cartesian4_default.add(
  168195. Matrix4_default.getColumn(camera._transform, 0, scratchCartesian313),
  168196. origin,
  168197. scratchCartesian313
  168198. );
  168199. ellipsoid.cartesianToCartographic(xAxis, cartographic2);
  168200. projection.project(cartographic2, projectedPosition2);
  168201. const newXAxis = scratchCartesian4NewXAxis;
  168202. newXAxis.x = projectedPosition2.z;
  168203. newXAxis.y = projectedPosition2.x;
  168204. newXAxis.z = projectedPosition2.y;
  168205. newXAxis.w = 0;
  168206. Cartesian3_default.subtract(newXAxis, newOrigin, newXAxis);
  168207. newXAxis.x = 0;
  168208. const newYAxis = scratchCartesian4NewYAxis;
  168209. if (Cartesian3_default.magnitudeSquared(newXAxis) > Math_default.EPSILON10) {
  168210. Cartesian3_default.cross(newZAxis, newXAxis, newYAxis);
  168211. } else {
  168212. const yAxis = Cartesian4_default.add(
  168213. Matrix4_default.getColumn(camera._transform, 1, scratchCartesian313),
  168214. origin,
  168215. scratchCartesian313
  168216. );
  168217. ellipsoid.cartesianToCartographic(yAxis, cartographic2);
  168218. projection.project(cartographic2, projectedPosition2);
  168219. newYAxis.x = projectedPosition2.z;
  168220. newYAxis.y = projectedPosition2.x;
  168221. newYAxis.z = projectedPosition2.y;
  168222. newYAxis.w = 0;
  168223. Cartesian3_default.subtract(newYAxis, newOrigin, newYAxis);
  168224. newYAxis.x = 0;
  168225. if (Cartesian3_default.magnitudeSquared(newYAxis) < Math_default.EPSILON10) {
  168226. Cartesian4_default.clone(Cartesian4_default.UNIT_Y, newXAxis);
  168227. Cartesian4_default.clone(Cartesian4_default.UNIT_Z, newYAxis);
  168228. }
  168229. }
  168230. Cartesian3_default.cross(newYAxis, newZAxis, newXAxis);
  168231. Cartesian3_default.normalize(newXAxis, newXAxis);
  168232. Cartesian3_default.cross(newZAxis, newXAxis, newYAxis);
  168233. Cartesian3_default.normalize(newYAxis, newYAxis);
  168234. Matrix4_default.setColumn(
  168235. camera._actualTransform,
  168236. 0,
  168237. newXAxis,
  168238. camera._actualTransform
  168239. );
  168240. Matrix4_default.setColumn(
  168241. camera._actualTransform,
  168242. 1,
  168243. newYAxis,
  168244. camera._actualTransform
  168245. );
  168246. Matrix4_default.setColumn(
  168247. camera._actualTransform,
  168248. 2,
  168249. newZAxis,
  168250. camera._actualTransform
  168251. );
  168252. Matrix4_default.setColumn(
  168253. camera._actualTransform,
  168254. 3,
  168255. newOrigin,
  168256. camera._actualTransform
  168257. );
  168258. }
  168259. var scratchCartesian30 = new Cartesian3_default();
  168260. function updateMembers(camera) {
  168261. const mode2 = camera._mode;
  168262. let heightChanged = false;
  168263. let height = 0;
  168264. if (mode2 === SceneMode_default.SCENE2D) {
  168265. height = camera.frustum.right - camera.frustum.left;
  168266. heightChanged = height !== camera._positionCartographic.height;
  168267. }
  168268. let position = camera._position;
  168269. const positionChanged = !Cartesian3_default.equals(position, camera.position) || heightChanged;
  168270. if (positionChanged) {
  168271. position = Cartesian3_default.clone(camera.position, camera._position);
  168272. }
  168273. let direction2 = camera._direction;
  168274. const directionChanged = !Cartesian3_default.equals(direction2, camera.direction);
  168275. if (directionChanged) {
  168276. Cartesian3_default.normalize(camera.direction, camera.direction);
  168277. direction2 = Cartesian3_default.clone(camera.direction, camera._direction);
  168278. }
  168279. let up = camera._up;
  168280. const upChanged = !Cartesian3_default.equals(up, camera.up);
  168281. if (upChanged) {
  168282. Cartesian3_default.normalize(camera.up, camera.up);
  168283. up = Cartesian3_default.clone(camera.up, camera._up);
  168284. }
  168285. let right = camera._right;
  168286. const rightChanged = !Cartesian3_default.equals(right, camera.right);
  168287. if (rightChanged) {
  168288. Cartesian3_default.normalize(camera.right, camera.right);
  168289. right = Cartesian3_default.clone(camera.right, camera._right);
  168290. }
  168291. const transformChanged = camera._transformChanged || camera._modeChanged;
  168292. camera._transformChanged = false;
  168293. if (transformChanged) {
  168294. Matrix4_default.inverseTransformation(camera._transform, camera._invTransform);
  168295. if (camera._mode === SceneMode_default.COLUMBUS_VIEW || camera._mode === SceneMode_default.SCENE2D) {
  168296. if (Matrix4_default.equals(Matrix4_default.IDENTITY, camera._transform)) {
  168297. Matrix4_default.clone(Camera.TRANSFORM_2D, camera._actualTransform);
  168298. } else if (camera._mode === SceneMode_default.COLUMBUS_VIEW) {
  168299. convertTransformForColumbusView(camera);
  168300. } else {
  168301. convertTransformFor2D(camera);
  168302. }
  168303. } else {
  168304. Matrix4_default.clone(camera._transform, camera._actualTransform);
  168305. }
  168306. Matrix4_default.inverseTransformation(
  168307. camera._actualTransform,
  168308. camera._actualInvTransform
  168309. );
  168310. camera._modeChanged = false;
  168311. }
  168312. const transform4 = camera._actualTransform;
  168313. if (positionChanged || transformChanged) {
  168314. camera._positionWC = Matrix4_default.multiplyByPoint(
  168315. transform4,
  168316. position,
  168317. camera._positionWC
  168318. );
  168319. if (mode2 === SceneMode_default.SCENE3D || mode2 === SceneMode_default.MORPHING) {
  168320. camera._positionCartographic = camera._projection.ellipsoid.cartesianToCartographic(
  168321. camera._positionWC,
  168322. camera._positionCartographic
  168323. );
  168324. } else {
  168325. const positionENU = scratchCartesian30;
  168326. positionENU.x = camera._positionWC.y;
  168327. positionENU.y = camera._positionWC.z;
  168328. positionENU.z = camera._positionWC.x;
  168329. if (mode2 === SceneMode_default.SCENE2D) {
  168330. positionENU.z = height;
  168331. }
  168332. camera._projection.unproject(positionENU, camera._positionCartographic);
  168333. }
  168334. }
  168335. if (directionChanged || upChanged || rightChanged) {
  168336. const det = Cartesian3_default.dot(
  168337. direction2,
  168338. Cartesian3_default.cross(up, right, scratchCartesian30)
  168339. );
  168340. if (Math.abs(1 - det) > Math_default.EPSILON2) {
  168341. const invUpMag = 1 / Cartesian3_default.magnitudeSquared(up);
  168342. const scalar = Cartesian3_default.dot(up, direction2) * invUpMag;
  168343. const w0 = Cartesian3_default.multiplyByScalar(
  168344. direction2,
  168345. scalar,
  168346. scratchCartesian30
  168347. );
  168348. up = Cartesian3_default.normalize(
  168349. Cartesian3_default.subtract(up, w0, camera._up),
  168350. camera._up
  168351. );
  168352. Cartesian3_default.clone(up, camera.up);
  168353. right = Cartesian3_default.cross(direction2, up, camera._right);
  168354. Cartesian3_default.clone(right, camera.right);
  168355. }
  168356. }
  168357. if (directionChanged || transformChanged) {
  168358. camera._directionWC = Matrix4_default.multiplyByPointAsVector(
  168359. transform4,
  168360. direction2,
  168361. camera._directionWC
  168362. );
  168363. Cartesian3_default.normalize(camera._directionWC, camera._directionWC);
  168364. }
  168365. if (upChanged || transformChanged) {
  168366. camera._upWC = Matrix4_default.multiplyByPointAsVector(transform4, up, camera._upWC);
  168367. Cartesian3_default.normalize(camera._upWC, camera._upWC);
  168368. }
  168369. if (rightChanged || transformChanged) {
  168370. camera._rightWC = Matrix4_default.multiplyByPointAsVector(
  168371. transform4,
  168372. right,
  168373. camera._rightWC
  168374. );
  168375. Cartesian3_default.normalize(camera._rightWC, camera._rightWC);
  168376. }
  168377. if (positionChanged || directionChanged || upChanged || rightChanged || transformChanged) {
  168378. updateViewMatrix(camera);
  168379. }
  168380. }
  168381. function getHeading(direction2, up) {
  168382. let heading;
  168383. if (!Math_default.equalsEpsilon(Math.abs(direction2.z), 1, Math_default.EPSILON3)) {
  168384. heading = Math.atan2(direction2.y, direction2.x) - Math_default.PI_OVER_TWO;
  168385. } else {
  168386. heading = Math.atan2(up.y, up.x) - Math_default.PI_OVER_TWO;
  168387. }
  168388. return Math_default.TWO_PI - Math_default.zeroToTwoPi(heading);
  168389. }
  168390. function getPitch(direction2) {
  168391. return Math_default.PI_OVER_TWO - Math_default.acosClamped(direction2.z);
  168392. }
  168393. function getRoll(direction2, up, right) {
  168394. let roll = 0;
  168395. if (!Math_default.equalsEpsilon(Math.abs(direction2.z), 1, Math_default.EPSILON3)) {
  168396. roll = Math.atan2(-right.z, up.z);
  168397. roll = Math_default.zeroToTwoPi(roll + Math_default.TWO_PI);
  168398. }
  168399. return roll;
  168400. }
  168401. var scratchHPRMatrix1 = new Matrix4_default();
  168402. var scratchHPRMatrix2 = new Matrix4_default();
  168403. Object.defineProperties(Camera.prototype, {
  168404. transform: {
  168405. get: function() {
  168406. return this._transform;
  168407. }
  168408. },
  168409. inverseTransform: {
  168410. get: function() {
  168411. updateMembers(this);
  168412. return this._invTransform;
  168413. }
  168414. },
  168415. viewMatrix: {
  168416. get: function() {
  168417. updateMembers(this);
  168418. return this._viewMatrix;
  168419. }
  168420. },
  168421. inverseViewMatrix: {
  168422. get: function() {
  168423. updateMembers(this);
  168424. return this._invViewMatrix;
  168425. }
  168426. },
  168427. positionCartographic: {
  168428. get: function() {
  168429. updateMembers(this);
  168430. return this._positionCartographic;
  168431. }
  168432. },
  168433. positionWC: {
  168434. get: function() {
  168435. updateMembers(this);
  168436. return this._positionWC;
  168437. }
  168438. },
  168439. directionWC: {
  168440. get: function() {
  168441. updateMembers(this);
  168442. return this._directionWC;
  168443. }
  168444. },
  168445. upWC: {
  168446. get: function() {
  168447. updateMembers(this);
  168448. return this._upWC;
  168449. }
  168450. },
  168451. rightWC: {
  168452. get: function() {
  168453. updateMembers(this);
  168454. return this._rightWC;
  168455. }
  168456. },
  168457. heading: {
  168458. get: function() {
  168459. if (this._mode !== SceneMode_default.MORPHING) {
  168460. const ellipsoid = this._projection.ellipsoid;
  168461. const oldTransform = Matrix4_default.clone(this._transform, scratchHPRMatrix1);
  168462. const transform4 = Transforms_default.eastNorthUpToFixedFrame(
  168463. this.positionWC,
  168464. ellipsoid,
  168465. scratchHPRMatrix2
  168466. );
  168467. this._setTransform(transform4);
  168468. const heading = getHeading(this.direction, this.up);
  168469. this._setTransform(oldTransform);
  168470. return heading;
  168471. }
  168472. return void 0;
  168473. }
  168474. },
  168475. pitch: {
  168476. get: function() {
  168477. if (this._mode !== SceneMode_default.MORPHING) {
  168478. const ellipsoid = this._projection.ellipsoid;
  168479. const oldTransform = Matrix4_default.clone(this._transform, scratchHPRMatrix1);
  168480. const transform4 = Transforms_default.eastNorthUpToFixedFrame(
  168481. this.positionWC,
  168482. ellipsoid,
  168483. scratchHPRMatrix2
  168484. );
  168485. this._setTransform(transform4);
  168486. const pitch = getPitch(this.direction);
  168487. this._setTransform(oldTransform);
  168488. return pitch;
  168489. }
  168490. return void 0;
  168491. }
  168492. },
  168493. roll: {
  168494. get: function() {
  168495. if (this._mode !== SceneMode_default.MORPHING) {
  168496. const ellipsoid = this._projection.ellipsoid;
  168497. const oldTransform = Matrix4_default.clone(this._transform, scratchHPRMatrix1);
  168498. const transform4 = Transforms_default.eastNorthUpToFixedFrame(
  168499. this.positionWC,
  168500. ellipsoid,
  168501. scratchHPRMatrix2
  168502. );
  168503. this._setTransform(transform4);
  168504. const roll = getRoll(this.direction, this.up, this.right);
  168505. this._setTransform(oldTransform);
  168506. return roll;
  168507. }
  168508. return void 0;
  168509. }
  168510. },
  168511. moveStart: {
  168512. get: function() {
  168513. return this._moveStart;
  168514. }
  168515. },
  168516. moveEnd: {
  168517. get: function() {
  168518. return this._moveEnd;
  168519. }
  168520. },
  168521. changed: {
  168522. get: function() {
  168523. return this._changed;
  168524. }
  168525. }
  168526. });
  168527. Camera.prototype.update = function(mode2) {
  168528. if (!defined_default(mode2)) {
  168529. throw new DeveloperError_default("mode is required.");
  168530. }
  168531. if (mode2 === SceneMode_default.SCENE2D && !(this.frustum instanceof OrthographicOffCenterFrustum_default)) {
  168532. throw new DeveloperError_default(
  168533. "An OrthographicOffCenterFrustum is required in 2D."
  168534. );
  168535. }
  168536. if ((mode2 === SceneMode_default.SCENE3D || mode2 === SceneMode_default.COLUMBUS_VIEW) && !(this.frustum instanceof PerspectiveFrustum_default) && !(this.frustum instanceof OrthographicFrustum_default)) {
  168537. throw new DeveloperError_default(
  168538. "A PerspectiveFrustum or OrthographicFrustum is required in 3D and Columbus view"
  168539. );
  168540. }
  168541. let updateFrustum = false;
  168542. if (mode2 !== this._mode) {
  168543. this._mode = mode2;
  168544. this._modeChanged = mode2 !== SceneMode_default.MORPHING;
  168545. updateFrustum = this._mode === SceneMode_default.SCENE2D;
  168546. }
  168547. if (updateFrustum) {
  168548. const frustum = this._max2Dfrustum = this.frustum.clone();
  168549. if (!(frustum instanceof OrthographicOffCenterFrustum_default)) {
  168550. throw new DeveloperError_default(
  168551. "The camera frustum is expected to be orthographic for 2D camera control."
  168552. );
  168553. }
  168554. const maxZoomOut = 2;
  168555. const ratio = frustum.top / frustum.right;
  168556. frustum.right = this._maxCoord.x * maxZoomOut;
  168557. frustum.left = -frustum.right;
  168558. frustum.top = ratio * frustum.right;
  168559. frustum.bottom = -frustum.top;
  168560. }
  168561. if (this._mode === SceneMode_default.SCENE2D) {
  168562. clampMove2D(this, this.position);
  168563. }
  168564. };
  168565. var setTransformPosition = new Cartesian3_default();
  168566. var setTransformUp = new Cartesian3_default();
  168567. var setTransformDirection = new Cartesian3_default();
  168568. Camera.prototype._setTransform = function(transform4) {
  168569. const position = Cartesian3_default.clone(this.positionWC, setTransformPosition);
  168570. const up = Cartesian3_default.clone(this.upWC, setTransformUp);
  168571. const direction2 = Cartesian3_default.clone(this.directionWC, setTransformDirection);
  168572. Matrix4_default.clone(transform4, this._transform);
  168573. this._transformChanged = true;
  168574. updateMembers(this);
  168575. const inverse = this._actualInvTransform;
  168576. Matrix4_default.multiplyByPoint(inverse, position, this.position);
  168577. Matrix4_default.multiplyByPointAsVector(inverse, direction2, this.direction);
  168578. Matrix4_default.multiplyByPointAsVector(inverse, up, this.up);
  168579. Cartesian3_default.cross(this.direction, this.up, this.right);
  168580. updateMembers(this);
  168581. };
  168582. var scratchAdjustOrthographicFrustumMousePosition = new Cartesian2_default();
  168583. var scratchPickRay = new Ray_default();
  168584. var scratchRayIntersection = new Cartesian3_default();
  168585. var scratchDepthIntersection = new Cartesian3_default();
  168586. function calculateOrthographicFrustumWidth(camera) {
  168587. if (!Matrix4_default.equals(Matrix4_default.IDENTITY, camera.transform)) {
  168588. return Cartesian3_default.magnitude(camera.position);
  168589. }
  168590. const scene = camera._scene;
  168591. const globe = scene.globe;
  168592. const mousePosition = scratchAdjustOrthographicFrustumMousePosition;
  168593. mousePosition.x = scene.drawingBufferWidth / 2;
  168594. mousePosition.y = scene.drawingBufferHeight / 2;
  168595. let rayIntersection;
  168596. if (defined_default(globe)) {
  168597. const ray = camera.getPickRay(mousePosition, scratchPickRay);
  168598. rayIntersection = globe.pickWorldCoordinates(
  168599. ray,
  168600. scene,
  168601. true,
  168602. scratchRayIntersection
  168603. );
  168604. }
  168605. let depthIntersection;
  168606. if (scene.pickPositionSupported) {
  168607. depthIntersection = scene.pickPositionWorldCoordinates(
  168608. mousePosition,
  168609. scratchDepthIntersection
  168610. );
  168611. }
  168612. let distance2;
  168613. if (defined_default(rayIntersection) || defined_default(depthIntersection)) {
  168614. const depthDistance = defined_default(depthIntersection) ? Cartesian3_default.distance(depthIntersection, camera.positionWC) : Number.POSITIVE_INFINITY;
  168615. const rayDistance = defined_default(rayIntersection) ? Cartesian3_default.distance(rayIntersection, camera.positionWC) : Number.POSITIVE_INFINITY;
  168616. distance2 = Math.min(depthDistance, rayDistance);
  168617. } else {
  168618. distance2 = Math.max(camera.positionCartographic.height, 0);
  168619. }
  168620. return distance2;
  168621. }
  168622. Camera.prototype._adjustOrthographicFrustum = function(zooming) {
  168623. if (!(this.frustum instanceof OrthographicFrustum_default)) {
  168624. return;
  168625. }
  168626. if (!zooming && this._positionCartographic.height < 15e4) {
  168627. return;
  168628. }
  168629. this.frustum.width = calculateOrthographicFrustumWidth(this);
  168630. };
  168631. var scratchSetViewCartesian = new Cartesian3_default();
  168632. var scratchSetViewTransform1 = new Matrix4_default();
  168633. var scratchSetViewTransform2 = new Matrix4_default();
  168634. var scratchSetViewQuaternion = new Quaternion_default();
  168635. var scratchSetViewMatrix3 = new Matrix3_default();
  168636. var scratchSetViewCartographic = new Cartographic_default();
  168637. function setView3D(camera, position, hpr) {
  168638. const currentTransform = Matrix4_default.clone(
  168639. camera.transform,
  168640. scratchSetViewTransform1
  168641. );
  168642. const localTransform = Transforms_default.eastNorthUpToFixedFrame(
  168643. position,
  168644. camera._projection.ellipsoid,
  168645. scratchSetViewTransform2
  168646. );
  168647. camera._setTransform(localTransform);
  168648. Cartesian3_default.clone(Cartesian3_default.ZERO, camera.position);
  168649. hpr.heading = hpr.heading - Math_default.PI_OVER_TWO;
  168650. const rotQuat = Quaternion_default.fromHeadingPitchRoll(
  168651. hpr,
  168652. scratchSetViewQuaternion
  168653. );
  168654. const rotMat = Matrix3_default.fromQuaternion(rotQuat, scratchSetViewMatrix3);
  168655. Matrix3_default.getColumn(rotMat, 0, camera.direction);
  168656. Matrix3_default.getColumn(rotMat, 2, camera.up);
  168657. Cartesian3_default.cross(camera.direction, camera.up, camera.right);
  168658. camera._setTransform(currentTransform);
  168659. camera._adjustOrthographicFrustum(true);
  168660. }
  168661. function setViewCV(camera, position, hpr, convert) {
  168662. const currentTransform = Matrix4_default.clone(
  168663. camera.transform,
  168664. scratchSetViewTransform1
  168665. );
  168666. camera._setTransform(Matrix4_default.IDENTITY);
  168667. if (!Cartesian3_default.equals(position, camera.positionWC)) {
  168668. if (convert) {
  168669. const projection = camera._projection;
  168670. const cartographic2 = projection.ellipsoid.cartesianToCartographic(
  168671. position,
  168672. scratchSetViewCartographic
  168673. );
  168674. position = projection.project(cartographic2, scratchSetViewCartesian);
  168675. }
  168676. Cartesian3_default.clone(position, camera.position);
  168677. }
  168678. hpr.heading = hpr.heading - Math_default.PI_OVER_TWO;
  168679. const rotQuat = Quaternion_default.fromHeadingPitchRoll(
  168680. hpr,
  168681. scratchSetViewQuaternion
  168682. );
  168683. const rotMat = Matrix3_default.fromQuaternion(rotQuat, scratchSetViewMatrix3);
  168684. Matrix3_default.getColumn(rotMat, 0, camera.direction);
  168685. Matrix3_default.getColumn(rotMat, 2, camera.up);
  168686. Cartesian3_default.cross(camera.direction, camera.up, camera.right);
  168687. camera._setTransform(currentTransform);
  168688. camera._adjustOrthographicFrustum(true);
  168689. }
  168690. function setView2D(camera, position, hpr, convert) {
  168691. const currentTransform = Matrix4_default.clone(
  168692. camera.transform,
  168693. scratchSetViewTransform1
  168694. );
  168695. camera._setTransform(Matrix4_default.IDENTITY);
  168696. if (!Cartesian3_default.equals(position, camera.positionWC)) {
  168697. if (convert) {
  168698. const projection = camera._projection;
  168699. const cartographic2 = projection.ellipsoid.cartesianToCartographic(
  168700. position,
  168701. scratchSetViewCartographic
  168702. );
  168703. position = projection.project(cartographic2, scratchSetViewCartesian);
  168704. }
  168705. Cartesian2_default.clone(position, camera.position);
  168706. const newLeft = -position.z * 0.5;
  168707. const newRight = -newLeft;
  168708. const frustum = camera.frustum;
  168709. if (newRight > newLeft) {
  168710. const ratio = frustum.top / frustum.right;
  168711. frustum.right = newRight;
  168712. frustum.left = newLeft;
  168713. frustum.top = frustum.right * ratio;
  168714. frustum.bottom = -frustum.top;
  168715. }
  168716. }
  168717. if (camera._scene.mapMode2D === MapMode2D_default.ROTATE) {
  168718. hpr.heading = hpr.heading - Math_default.PI_OVER_TWO;
  168719. hpr.pitch = -Math_default.PI_OVER_TWO;
  168720. hpr.roll = 0;
  168721. const rotQuat = Quaternion_default.fromHeadingPitchRoll(
  168722. hpr,
  168723. scratchSetViewQuaternion
  168724. );
  168725. const rotMat = Matrix3_default.fromQuaternion(rotQuat, scratchSetViewMatrix3);
  168726. Matrix3_default.getColumn(rotMat, 2, camera.up);
  168727. Cartesian3_default.cross(camera.direction, camera.up, camera.right);
  168728. }
  168729. camera._setTransform(currentTransform);
  168730. }
  168731. var scratchToHPRDirection = new Cartesian3_default();
  168732. var scratchToHPRUp = new Cartesian3_default();
  168733. var scratchToHPRRight = new Cartesian3_default();
  168734. function directionUpToHeadingPitchRoll(camera, position, orientation, result) {
  168735. const direction2 = Cartesian3_default.clone(
  168736. orientation.direction,
  168737. scratchToHPRDirection
  168738. );
  168739. const up = Cartesian3_default.clone(orientation.up, scratchToHPRUp);
  168740. if (camera._scene.mode === SceneMode_default.SCENE3D) {
  168741. const ellipsoid = camera._projection.ellipsoid;
  168742. const transform4 = Transforms_default.eastNorthUpToFixedFrame(
  168743. position,
  168744. ellipsoid,
  168745. scratchHPRMatrix1
  168746. );
  168747. const invTransform = Matrix4_default.inverseTransformation(
  168748. transform4,
  168749. scratchHPRMatrix2
  168750. );
  168751. Matrix4_default.multiplyByPointAsVector(invTransform, direction2, direction2);
  168752. Matrix4_default.multiplyByPointAsVector(invTransform, up, up);
  168753. }
  168754. const right = Cartesian3_default.cross(direction2, up, scratchToHPRRight);
  168755. result.heading = getHeading(direction2, up);
  168756. result.pitch = getPitch(direction2);
  168757. result.roll = getRoll(direction2, up, right);
  168758. return result;
  168759. }
  168760. var scratchSetViewOptions = {
  168761. destination: void 0,
  168762. orientation: {
  168763. direction: void 0,
  168764. up: void 0,
  168765. heading: void 0,
  168766. pitch: void 0,
  168767. roll: void 0
  168768. },
  168769. convert: void 0,
  168770. endTransform: void 0
  168771. };
  168772. var scratchHpr = new HeadingPitchRoll_default();
  168773. Camera.prototype.setView = function(options) {
  168774. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  168775. let orientation = defaultValue_default(
  168776. options.orientation,
  168777. defaultValue_default.EMPTY_OBJECT
  168778. );
  168779. const mode2 = this._mode;
  168780. if (mode2 === SceneMode_default.MORPHING) {
  168781. return;
  168782. }
  168783. if (defined_default(options.endTransform)) {
  168784. this._setTransform(options.endTransform);
  168785. }
  168786. let convert = defaultValue_default(options.convert, true);
  168787. let destination = defaultValue_default(
  168788. options.destination,
  168789. Cartesian3_default.clone(this.positionWC, scratchSetViewCartesian)
  168790. );
  168791. if (defined_default(destination) && defined_default(destination.west)) {
  168792. destination = this.getRectangleCameraCoordinates(
  168793. destination,
  168794. scratchSetViewCartesian
  168795. );
  168796. convert = false;
  168797. }
  168798. if (defined_default(orientation.direction)) {
  168799. orientation = directionUpToHeadingPitchRoll(
  168800. this,
  168801. destination,
  168802. orientation,
  168803. scratchSetViewOptions.orientation
  168804. );
  168805. }
  168806. scratchHpr.heading = defaultValue_default(orientation.heading, 0);
  168807. scratchHpr.pitch = defaultValue_default(orientation.pitch, -Math_default.PI_OVER_TWO);
  168808. scratchHpr.roll = defaultValue_default(orientation.roll, 0);
  168809. if (mode2 === SceneMode_default.SCENE3D) {
  168810. setView3D(this, destination, scratchHpr);
  168811. } else if (mode2 === SceneMode_default.SCENE2D) {
  168812. setView2D(this, destination, scratchHpr, convert);
  168813. } else {
  168814. setViewCV(this, destination, scratchHpr, convert);
  168815. }
  168816. };
  168817. var pitchScratch = new Cartesian3_default();
  168818. Camera.prototype.flyHome = function(duration) {
  168819. const mode2 = this._mode;
  168820. if (mode2 === SceneMode_default.MORPHING) {
  168821. this._scene.completeMorph();
  168822. }
  168823. if (mode2 === SceneMode_default.SCENE2D) {
  168824. this.flyTo({
  168825. destination: Camera.DEFAULT_VIEW_RECTANGLE,
  168826. duration,
  168827. endTransform: Matrix4_default.IDENTITY
  168828. });
  168829. } else if (mode2 === SceneMode_default.SCENE3D) {
  168830. const destination = this.getRectangleCameraCoordinates(
  168831. Camera.DEFAULT_VIEW_RECTANGLE
  168832. );
  168833. let mag = Cartesian3_default.magnitude(destination);
  168834. mag += mag * Camera.DEFAULT_VIEW_FACTOR;
  168835. Cartesian3_default.normalize(destination, destination);
  168836. Cartesian3_default.multiplyByScalar(destination, mag, destination);
  168837. this.flyTo({
  168838. destination,
  168839. duration,
  168840. endTransform: Matrix4_default.IDENTITY
  168841. });
  168842. } else if (mode2 === SceneMode_default.COLUMBUS_VIEW) {
  168843. const maxRadii = this._projection.ellipsoid.maximumRadius;
  168844. let position = new Cartesian3_default(0, -1, 1);
  168845. position = Cartesian3_default.multiplyByScalar(
  168846. Cartesian3_default.normalize(position, position),
  168847. 5 * maxRadii,
  168848. position
  168849. );
  168850. this.flyTo({
  168851. destination: position,
  168852. duration,
  168853. orientation: {
  168854. heading: 0,
  168855. pitch: -Math.acos(Cartesian3_default.normalize(position, pitchScratch).z),
  168856. roll: 0
  168857. },
  168858. endTransform: Matrix4_default.IDENTITY,
  168859. convert: false
  168860. });
  168861. }
  168862. };
  168863. Camera.prototype.worldToCameraCoordinates = function(cartesian11, result) {
  168864. if (!defined_default(cartesian11)) {
  168865. throw new DeveloperError_default("cartesian is required.");
  168866. }
  168867. if (!defined_default(result)) {
  168868. result = new Cartesian4_default();
  168869. }
  168870. updateMembers(this);
  168871. return Matrix4_default.multiplyByVector(this._actualInvTransform, cartesian11, result);
  168872. };
  168873. Camera.prototype.worldToCameraCoordinatesPoint = function(cartesian11, result) {
  168874. if (!defined_default(cartesian11)) {
  168875. throw new DeveloperError_default("cartesian is required.");
  168876. }
  168877. if (!defined_default(result)) {
  168878. result = new Cartesian3_default();
  168879. }
  168880. updateMembers(this);
  168881. return Matrix4_default.multiplyByPoint(this._actualInvTransform, cartesian11, result);
  168882. };
  168883. Camera.prototype.worldToCameraCoordinatesVector = function(cartesian11, result) {
  168884. if (!defined_default(cartesian11)) {
  168885. throw new DeveloperError_default("cartesian is required.");
  168886. }
  168887. if (!defined_default(result)) {
  168888. result = new Cartesian3_default();
  168889. }
  168890. updateMembers(this);
  168891. return Matrix4_default.multiplyByPointAsVector(
  168892. this._actualInvTransform,
  168893. cartesian11,
  168894. result
  168895. );
  168896. };
  168897. Camera.prototype.cameraToWorldCoordinates = function(cartesian11, result) {
  168898. if (!defined_default(cartesian11)) {
  168899. throw new DeveloperError_default("cartesian is required.");
  168900. }
  168901. if (!defined_default(result)) {
  168902. result = new Cartesian4_default();
  168903. }
  168904. updateMembers(this);
  168905. return Matrix4_default.multiplyByVector(this._actualTransform, cartesian11, result);
  168906. };
  168907. Camera.prototype.cameraToWorldCoordinatesPoint = function(cartesian11, result) {
  168908. if (!defined_default(cartesian11)) {
  168909. throw new DeveloperError_default("cartesian is required.");
  168910. }
  168911. if (!defined_default(result)) {
  168912. result = new Cartesian3_default();
  168913. }
  168914. updateMembers(this);
  168915. return Matrix4_default.multiplyByPoint(this._actualTransform, cartesian11, result);
  168916. };
  168917. Camera.prototype.cameraToWorldCoordinatesVector = function(cartesian11, result) {
  168918. if (!defined_default(cartesian11)) {
  168919. throw new DeveloperError_default("cartesian is required.");
  168920. }
  168921. if (!defined_default(result)) {
  168922. result = new Cartesian3_default();
  168923. }
  168924. updateMembers(this);
  168925. return Matrix4_default.multiplyByPointAsVector(
  168926. this._actualTransform,
  168927. cartesian11,
  168928. result
  168929. );
  168930. };
  168931. function clampMove2D(camera, position) {
  168932. const rotatable2D = camera._scene.mapMode2D === MapMode2D_default.ROTATE;
  168933. const maxProjectedX = camera._maxCoord.x;
  168934. const maxProjectedY = camera._maxCoord.y;
  168935. let minX;
  168936. let maxX;
  168937. if (rotatable2D) {
  168938. maxX = maxProjectedX;
  168939. minX = -maxX;
  168940. } else {
  168941. maxX = position.x - maxProjectedX * 2;
  168942. minX = position.x + maxProjectedX * 2;
  168943. }
  168944. if (position.x > maxProjectedX) {
  168945. position.x = maxX;
  168946. }
  168947. if (position.x < -maxProjectedX) {
  168948. position.x = minX;
  168949. }
  168950. if (position.y > maxProjectedY) {
  168951. position.y = maxProjectedY;
  168952. }
  168953. if (position.y < -maxProjectedY) {
  168954. position.y = -maxProjectedY;
  168955. }
  168956. }
  168957. var moveScratch = new Cartesian3_default();
  168958. Camera.prototype.move = function(direction2, amount) {
  168959. if (!defined_default(direction2)) {
  168960. throw new DeveloperError_default("direction is required.");
  168961. }
  168962. const cameraPosition = this.position;
  168963. Cartesian3_default.multiplyByScalar(direction2, amount, moveScratch);
  168964. Cartesian3_default.add(cameraPosition, moveScratch, cameraPosition);
  168965. if (this._mode === SceneMode_default.SCENE2D) {
  168966. clampMove2D(this, cameraPosition);
  168967. }
  168968. this._adjustOrthographicFrustum(true);
  168969. };
  168970. Camera.prototype.moveForward = function(amount) {
  168971. amount = defaultValue_default(amount, this.defaultMoveAmount);
  168972. if (this._mode === SceneMode_default.SCENE2D) {
  168973. zoom2D(this, amount);
  168974. } else {
  168975. this.move(this.direction, amount);
  168976. }
  168977. };
  168978. Camera.prototype.moveBackward = function(amount) {
  168979. amount = defaultValue_default(amount, this.defaultMoveAmount);
  168980. if (this._mode === SceneMode_default.SCENE2D) {
  168981. zoom2D(this, -amount);
  168982. } else {
  168983. this.move(this.direction, -amount);
  168984. }
  168985. };
  168986. Camera.prototype.moveUp = function(amount) {
  168987. amount = defaultValue_default(amount, this.defaultMoveAmount);
  168988. this.move(this.up, amount);
  168989. };
  168990. Camera.prototype.moveDown = function(amount) {
  168991. amount = defaultValue_default(amount, this.defaultMoveAmount);
  168992. this.move(this.up, -amount);
  168993. };
  168994. Camera.prototype.moveRight = function(amount) {
  168995. amount = defaultValue_default(amount, this.defaultMoveAmount);
  168996. this.move(this.right, amount);
  168997. };
  168998. Camera.prototype.moveLeft = function(amount) {
  168999. amount = defaultValue_default(amount, this.defaultMoveAmount);
  169000. this.move(this.right, -amount);
  169001. };
  169002. Camera.prototype.lookLeft = function(amount) {
  169003. amount = defaultValue_default(amount, this.defaultLookAmount);
  169004. if (this._mode !== SceneMode_default.SCENE2D) {
  169005. this.look(this.up, -amount);
  169006. }
  169007. };
  169008. Camera.prototype.lookRight = function(amount) {
  169009. amount = defaultValue_default(amount, this.defaultLookAmount);
  169010. if (this._mode !== SceneMode_default.SCENE2D) {
  169011. this.look(this.up, amount);
  169012. }
  169013. };
  169014. Camera.prototype.lookUp = function(amount) {
  169015. amount = defaultValue_default(amount, this.defaultLookAmount);
  169016. if (this._mode !== SceneMode_default.SCENE2D) {
  169017. this.look(this.right, -amount);
  169018. }
  169019. };
  169020. Camera.prototype.lookDown = function(amount) {
  169021. amount = defaultValue_default(amount, this.defaultLookAmount);
  169022. if (this._mode !== SceneMode_default.SCENE2D) {
  169023. this.look(this.right, amount);
  169024. }
  169025. };
  169026. var lookScratchQuaternion = new Quaternion_default();
  169027. var lookScratchMatrix = new Matrix3_default();
  169028. Camera.prototype.look = function(axis, angle) {
  169029. if (!defined_default(axis)) {
  169030. throw new DeveloperError_default("axis is required.");
  169031. }
  169032. const turnAngle = defaultValue_default(angle, this.defaultLookAmount);
  169033. const quaternion = Quaternion_default.fromAxisAngle(
  169034. axis,
  169035. -turnAngle,
  169036. lookScratchQuaternion
  169037. );
  169038. const rotation = Matrix3_default.fromQuaternion(quaternion, lookScratchMatrix);
  169039. const direction2 = this.direction;
  169040. const up = this.up;
  169041. const right = this.right;
  169042. Matrix3_default.multiplyByVector(rotation, direction2, direction2);
  169043. Matrix3_default.multiplyByVector(rotation, up, up);
  169044. Matrix3_default.multiplyByVector(rotation, right, right);
  169045. };
  169046. Camera.prototype.twistLeft = function(amount) {
  169047. amount = defaultValue_default(amount, this.defaultLookAmount);
  169048. this.look(this.direction, amount);
  169049. };
  169050. Camera.prototype.twistRight = function(amount) {
  169051. amount = defaultValue_default(amount, this.defaultLookAmount);
  169052. this.look(this.direction, -amount);
  169053. };
  169054. var rotateScratchQuaternion = new Quaternion_default();
  169055. var rotateScratchMatrix = new Matrix3_default();
  169056. Camera.prototype.rotate = function(axis, angle) {
  169057. if (!defined_default(axis)) {
  169058. throw new DeveloperError_default("axis is required.");
  169059. }
  169060. const turnAngle = defaultValue_default(angle, this.defaultRotateAmount);
  169061. const quaternion = Quaternion_default.fromAxisAngle(
  169062. axis,
  169063. -turnAngle,
  169064. rotateScratchQuaternion
  169065. );
  169066. const rotation = Matrix3_default.fromQuaternion(quaternion, rotateScratchMatrix);
  169067. Matrix3_default.multiplyByVector(rotation, this.position, this.position);
  169068. Matrix3_default.multiplyByVector(rotation, this.direction, this.direction);
  169069. Matrix3_default.multiplyByVector(rotation, this.up, this.up);
  169070. Cartesian3_default.cross(this.direction, this.up, this.right);
  169071. Cartesian3_default.cross(this.right, this.direction, this.up);
  169072. this._adjustOrthographicFrustum(false);
  169073. };
  169074. Camera.prototype.rotateDown = function(angle) {
  169075. angle = defaultValue_default(angle, this.defaultRotateAmount);
  169076. rotateVertical(this, angle);
  169077. };
  169078. Camera.prototype.rotateUp = function(angle) {
  169079. angle = defaultValue_default(angle, this.defaultRotateAmount);
  169080. rotateVertical(this, -angle);
  169081. };
  169082. var rotateVertScratchP = new Cartesian3_default();
  169083. var rotateVertScratchA = new Cartesian3_default();
  169084. var rotateVertScratchTan = new Cartesian3_default();
  169085. var rotateVertScratchNegate = new Cartesian3_default();
  169086. function rotateVertical(camera, angle) {
  169087. const position = camera.position;
  169088. if (defined_default(camera.constrainedAxis) && !Cartesian3_default.equalsEpsilon(
  169089. camera.position,
  169090. Cartesian3_default.ZERO,
  169091. Math_default.EPSILON2
  169092. )) {
  169093. const p2 = Cartesian3_default.normalize(position, rotateVertScratchP);
  169094. const northParallel = Cartesian3_default.equalsEpsilon(
  169095. p2,
  169096. camera.constrainedAxis,
  169097. Math_default.EPSILON2
  169098. );
  169099. const southParallel = Cartesian3_default.equalsEpsilon(
  169100. p2,
  169101. Cartesian3_default.negate(camera.constrainedAxis, rotateVertScratchNegate),
  169102. Math_default.EPSILON2
  169103. );
  169104. if (!northParallel && !southParallel) {
  169105. const constrainedAxis = Cartesian3_default.normalize(
  169106. camera.constrainedAxis,
  169107. rotateVertScratchA
  169108. );
  169109. let dot2 = Cartesian3_default.dot(p2, constrainedAxis);
  169110. let angleToAxis = Math_default.acosClamped(dot2);
  169111. if (angle > 0 && angle > angleToAxis) {
  169112. angle = angleToAxis - Math_default.EPSILON4;
  169113. }
  169114. dot2 = Cartesian3_default.dot(
  169115. p2,
  169116. Cartesian3_default.negate(constrainedAxis, rotateVertScratchNegate)
  169117. );
  169118. angleToAxis = Math_default.acosClamped(dot2);
  169119. if (angle < 0 && -angle > angleToAxis) {
  169120. angle = -angleToAxis + Math_default.EPSILON4;
  169121. }
  169122. const tangent = Cartesian3_default.cross(
  169123. constrainedAxis,
  169124. p2,
  169125. rotateVertScratchTan
  169126. );
  169127. camera.rotate(tangent, angle);
  169128. } else if (northParallel && angle < 0 || southParallel && angle > 0) {
  169129. camera.rotate(camera.right, angle);
  169130. }
  169131. } else {
  169132. camera.rotate(camera.right, angle);
  169133. }
  169134. }
  169135. Camera.prototype.rotateRight = function(angle) {
  169136. angle = defaultValue_default(angle, this.defaultRotateAmount);
  169137. rotateHorizontal(this, -angle);
  169138. };
  169139. Camera.prototype.rotateLeft = function(angle) {
  169140. angle = defaultValue_default(angle, this.defaultRotateAmount);
  169141. rotateHorizontal(this, angle);
  169142. };
  169143. function rotateHorizontal(camera, angle) {
  169144. if (defined_default(camera.constrainedAxis)) {
  169145. camera.rotate(camera.constrainedAxis, angle);
  169146. } else {
  169147. camera.rotate(camera.up, angle);
  169148. }
  169149. }
  169150. function zoom2D(camera, amount) {
  169151. const frustum = camera.frustum;
  169152. if (!(frustum instanceof OrthographicOffCenterFrustum_default) || !defined_default(frustum.left) || !defined_default(frustum.right) || !defined_default(frustum.bottom) || !defined_default(frustum.top)) {
  169153. throw new DeveloperError_default(
  169154. "The camera frustum is expected to be orthographic for 2D camera control."
  169155. );
  169156. }
  169157. let ratio;
  169158. amount = amount * 0.5;
  169159. if (Math.abs(frustum.top) + Math.abs(frustum.bottom) > Math.abs(frustum.left) + Math.abs(frustum.right)) {
  169160. let newTop = frustum.top - amount;
  169161. let newBottom = frustum.bottom + amount;
  169162. let maxBottom = camera._maxCoord.y;
  169163. if (camera._scene.mapMode2D === MapMode2D_default.ROTATE) {
  169164. maxBottom *= camera.maximumZoomFactor;
  169165. }
  169166. if (newBottom > maxBottom) {
  169167. newBottom = maxBottom;
  169168. newTop = -maxBottom;
  169169. }
  169170. if (newTop <= newBottom) {
  169171. newTop = 1;
  169172. newBottom = -1;
  169173. }
  169174. ratio = frustum.right / frustum.top;
  169175. frustum.top = newTop;
  169176. frustum.bottom = newBottom;
  169177. frustum.right = frustum.top * ratio;
  169178. frustum.left = -frustum.right;
  169179. } else {
  169180. let newRight = frustum.right - amount;
  169181. let newLeft = frustum.left + amount;
  169182. let maxRight = camera._maxCoord.x;
  169183. if (camera._scene.mapMode2D === MapMode2D_default.ROTATE) {
  169184. maxRight *= camera.maximumZoomFactor;
  169185. }
  169186. if (newRight > maxRight) {
  169187. newRight = maxRight;
  169188. newLeft = -maxRight;
  169189. }
  169190. if (newRight <= newLeft) {
  169191. newRight = 1;
  169192. newLeft = -1;
  169193. }
  169194. ratio = frustum.top / frustum.right;
  169195. frustum.right = newRight;
  169196. frustum.left = newLeft;
  169197. frustum.top = frustum.right * ratio;
  169198. frustum.bottom = -frustum.top;
  169199. }
  169200. }
  169201. function zoom3D(camera, amount) {
  169202. camera.move(camera.direction, amount);
  169203. }
  169204. Camera.prototype.zoomIn = function(amount) {
  169205. amount = defaultValue_default(amount, this.defaultZoomAmount);
  169206. if (this._mode === SceneMode_default.SCENE2D) {
  169207. zoom2D(this, amount);
  169208. } else {
  169209. zoom3D(this, amount);
  169210. }
  169211. };
  169212. Camera.prototype.zoomOut = function(amount) {
  169213. amount = defaultValue_default(amount, this.defaultZoomAmount);
  169214. if (this._mode === SceneMode_default.SCENE2D) {
  169215. zoom2D(this, -amount);
  169216. } else {
  169217. zoom3D(this, -amount);
  169218. }
  169219. };
  169220. Camera.prototype.getMagnitude = function() {
  169221. if (this._mode === SceneMode_default.SCENE3D) {
  169222. return Cartesian3_default.magnitude(this.position);
  169223. } else if (this._mode === SceneMode_default.COLUMBUS_VIEW) {
  169224. return Math.abs(this.position.z);
  169225. } else if (this._mode === SceneMode_default.SCENE2D) {
  169226. return Math.max(
  169227. this.frustum.right - this.frustum.left,
  169228. this.frustum.top - this.frustum.bottom
  169229. );
  169230. }
  169231. };
  169232. var scratchLookAtMatrix4 = new Matrix4_default();
  169233. Camera.prototype.lookAt = function(target, offset2) {
  169234. if (!defined_default(target)) {
  169235. throw new DeveloperError_default("target is required");
  169236. }
  169237. if (!defined_default(offset2)) {
  169238. throw new DeveloperError_default("offset is required");
  169239. }
  169240. if (this._mode === SceneMode_default.MORPHING) {
  169241. throw new DeveloperError_default("lookAt is not supported while morphing.");
  169242. }
  169243. const transform4 = Transforms_default.eastNorthUpToFixedFrame(
  169244. target,
  169245. Ellipsoid_default.WGS84,
  169246. scratchLookAtMatrix4
  169247. );
  169248. this.lookAtTransform(transform4, offset2);
  169249. };
  169250. var scratchLookAtHeadingPitchRangeOffset = new Cartesian3_default();
  169251. var scratchLookAtHeadingPitchRangeQuaternion1 = new Quaternion_default();
  169252. var scratchLookAtHeadingPitchRangeQuaternion2 = new Quaternion_default();
  169253. var scratchHeadingPitchRangeMatrix3 = new Matrix3_default();
  169254. function offsetFromHeadingPitchRange(heading, pitch, range2) {
  169255. pitch = Math_default.clamp(
  169256. pitch,
  169257. -Math_default.PI_OVER_TWO,
  169258. Math_default.PI_OVER_TWO
  169259. );
  169260. heading = Math_default.zeroToTwoPi(heading) - Math_default.PI_OVER_TWO;
  169261. const pitchQuat = Quaternion_default.fromAxisAngle(
  169262. Cartesian3_default.UNIT_Y,
  169263. -pitch,
  169264. scratchLookAtHeadingPitchRangeQuaternion1
  169265. );
  169266. const headingQuat = Quaternion_default.fromAxisAngle(
  169267. Cartesian3_default.UNIT_Z,
  169268. -heading,
  169269. scratchLookAtHeadingPitchRangeQuaternion2
  169270. );
  169271. const rotQuat = Quaternion_default.multiply(headingQuat, pitchQuat, headingQuat);
  169272. const rotMatrix3 = Matrix3_default.fromQuaternion(
  169273. rotQuat,
  169274. scratchHeadingPitchRangeMatrix3
  169275. );
  169276. const offset2 = Cartesian3_default.clone(
  169277. Cartesian3_default.UNIT_X,
  169278. scratchLookAtHeadingPitchRangeOffset
  169279. );
  169280. Matrix3_default.multiplyByVector(rotMatrix3, offset2, offset2);
  169281. Cartesian3_default.negate(offset2, offset2);
  169282. Cartesian3_default.multiplyByScalar(offset2, range2, offset2);
  169283. return offset2;
  169284. }
  169285. Camera.prototype.lookAtTransform = function(transform4, offset2) {
  169286. if (!defined_default(transform4)) {
  169287. throw new DeveloperError_default("transform is required");
  169288. }
  169289. if (this._mode === SceneMode_default.MORPHING) {
  169290. throw new DeveloperError_default(
  169291. "lookAtTransform is not supported while morphing."
  169292. );
  169293. }
  169294. this._setTransform(transform4);
  169295. if (!defined_default(offset2)) {
  169296. return;
  169297. }
  169298. let cartesianOffset;
  169299. if (defined_default(offset2.heading)) {
  169300. cartesianOffset = offsetFromHeadingPitchRange(
  169301. offset2.heading,
  169302. offset2.pitch,
  169303. offset2.range
  169304. );
  169305. } else {
  169306. cartesianOffset = offset2;
  169307. }
  169308. if (this._mode === SceneMode_default.SCENE2D) {
  169309. Cartesian2_default.clone(Cartesian2_default.ZERO, this.position);
  169310. Cartesian3_default.negate(cartesianOffset, this.up);
  169311. this.up.z = 0;
  169312. if (Cartesian3_default.magnitudeSquared(this.up) < Math_default.EPSILON10) {
  169313. Cartesian3_default.clone(Cartesian3_default.UNIT_Y, this.up);
  169314. }
  169315. Cartesian3_default.normalize(this.up, this.up);
  169316. this._setTransform(Matrix4_default.IDENTITY);
  169317. Cartesian3_default.negate(Cartesian3_default.UNIT_Z, this.direction);
  169318. Cartesian3_default.cross(this.direction, this.up, this.right);
  169319. Cartesian3_default.normalize(this.right, this.right);
  169320. const frustum = this.frustum;
  169321. const ratio = frustum.top / frustum.right;
  169322. frustum.right = Cartesian3_default.magnitude(cartesianOffset) * 0.5;
  169323. frustum.left = -frustum.right;
  169324. frustum.top = ratio * frustum.right;
  169325. frustum.bottom = -frustum.top;
  169326. this._setTransform(transform4);
  169327. return;
  169328. }
  169329. Cartesian3_default.clone(cartesianOffset, this.position);
  169330. Cartesian3_default.negate(this.position, this.direction);
  169331. Cartesian3_default.normalize(this.direction, this.direction);
  169332. Cartesian3_default.cross(this.direction, Cartesian3_default.UNIT_Z, this.right);
  169333. if (Cartesian3_default.magnitudeSquared(this.right) < Math_default.EPSILON10) {
  169334. Cartesian3_default.clone(Cartesian3_default.UNIT_X, this.right);
  169335. }
  169336. Cartesian3_default.normalize(this.right, this.right);
  169337. Cartesian3_default.cross(this.right, this.direction, this.up);
  169338. Cartesian3_default.normalize(this.up, this.up);
  169339. this._adjustOrthographicFrustum(true);
  169340. };
  169341. var viewRectangle3DCartographic1 = new Cartographic_default();
  169342. var viewRectangle3DCartographic2 = new Cartographic_default();
  169343. var viewRectangle3DNorthEast = new Cartesian3_default();
  169344. var viewRectangle3DSouthWest = new Cartesian3_default();
  169345. var viewRectangle3DNorthWest = new Cartesian3_default();
  169346. var viewRectangle3DSouthEast = new Cartesian3_default();
  169347. var viewRectangle3DNorthCenter = new Cartesian3_default();
  169348. var viewRectangle3DSouthCenter = new Cartesian3_default();
  169349. var viewRectangle3DCenter = new Cartesian3_default();
  169350. var viewRectangle3DEquator = new Cartesian3_default();
  169351. var defaultRF = {
  169352. direction: new Cartesian3_default(),
  169353. right: new Cartesian3_default(),
  169354. up: new Cartesian3_default()
  169355. };
  169356. var viewRectangle3DEllipsoidGeodesic;
  169357. function computeD(direction2, upOrRight, corner, tanThetaOrPhi) {
  169358. const opposite = Math.abs(Cartesian3_default.dot(upOrRight, corner));
  169359. return opposite / tanThetaOrPhi - Cartesian3_default.dot(direction2, corner);
  169360. }
  169361. function rectangleCameraPosition3D(camera, rectangle, result, updateCamera) {
  169362. const ellipsoid = camera._projection.ellipsoid;
  169363. const cameraRF = updateCamera ? camera : defaultRF;
  169364. const north = rectangle.north;
  169365. const south = rectangle.south;
  169366. let east = rectangle.east;
  169367. const west = rectangle.west;
  169368. if (west > east) {
  169369. east += Math_default.TWO_PI;
  169370. }
  169371. const longitude = (west + east) * 0.5;
  169372. let latitude;
  169373. if (south < -Math_default.PI_OVER_TWO + Math_default.RADIANS_PER_DEGREE && north > Math_default.PI_OVER_TWO - Math_default.RADIANS_PER_DEGREE) {
  169374. latitude = 0;
  169375. } else {
  169376. const northCartographic = viewRectangle3DCartographic1;
  169377. northCartographic.longitude = longitude;
  169378. northCartographic.latitude = north;
  169379. northCartographic.height = 0;
  169380. const southCartographic = viewRectangle3DCartographic2;
  169381. southCartographic.longitude = longitude;
  169382. southCartographic.latitude = south;
  169383. southCartographic.height = 0;
  169384. let ellipsoidGeodesic3 = viewRectangle3DEllipsoidGeodesic;
  169385. if (!defined_default(ellipsoidGeodesic3) || ellipsoidGeodesic3.ellipsoid !== ellipsoid) {
  169386. viewRectangle3DEllipsoidGeodesic = ellipsoidGeodesic3 = new EllipsoidGeodesic_default(
  169387. void 0,
  169388. void 0,
  169389. ellipsoid
  169390. );
  169391. }
  169392. ellipsoidGeodesic3.setEndPoints(northCartographic, southCartographic);
  169393. latitude = ellipsoidGeodesic3.interpolateUsingFraction(
  169394. 0.5,
  169395. viewRectangle3DCartographic1
  169396. ).latitude;
  169397. }
  169398. const centerCartographic = viewRectangle3DCartographic1;
  169399. centerCartographic.longitude = longitude;
  169400. centerCartographic.latitude = latitude;
  169401. centerCartographic.height = 0;
  169402. const center = ellipsoid.cartographicToCartesian(
  169403. centerCartographic,
  169404. viewRectangle3DCenter
  169405. );
  169406. const cart = viewRectangle3DCartographic1;
  169407. cart.longitude = east;
  169408. cart.latitude = north;
  169409. const northEast = ellipsoid.cartographicToCartesian(
  169410. cart,
  169411. viewRectangle3DNorthEast
  169412. );
  169413. cart.longitude = west;
  169414. const northWest = ellipsoid.cartographicToCartesian(
  169415. cart,
  169416. viewRectangle3DNorthWest
  169417. );
  169418. cart.longitude = longitude;
  169419. const northCenter = ellipsoid.cartographicToCartesian(
  169420. cart,
  169421. viewRectangle3DNorthCenter
  169422. );
  169423. cart.latitude = south;
  169424. const southCenter = ellipsoid.cartographicToCartesian(
  169425. cart,
  169426. viewRectangle3DSouthCenter
  169427. );
  169428. cart.longitude = east;
  169429. const southEast = ellipsoid.cartographicToCartesian(
  169430. cart,
  169431. viewRectangle3DSouthEast
  169432. );
  169433. cart.longitude = west;
  169434. const southWest = ellipsoid.cartographicToCartesian(
  169435. cart,
  169436. viewRectangle3DSouthWest
  169437. );
  169438. Cartesian3_default.subtract(northWest, center, northWest);
  169439. Cartesian3_default.subtract(southEast, center, southEast);
  169440. Cartesian3_default.subtract(northEast, center, northEast);
  169441. Cartesian3_default.subtract(southWest, center, southWest);
  169442. Cartesian3_default.subtract(northCenter, center, northCenter);
  169443. Cartesian3_default.subtract(southCenter, center, southCenter);
  169444. const direction2 = ellipsoid.geodeticSurfaceNormal(center, cameraRF.direction);
  169445. Cartesian3_default.negate(direction2, direction2);
  169446. const right = Cartesian3_default.cross(direction2, Cartesian3_default.UNIT_Z, cameraRF.right);
  169447. Cartesian3_default.normalize(right, right);
  169448. const up = Cartesian3_default.cross(right, direction2, cameraRF.up);
  169449. let d;
  169450. if (camera.frustum instanceof OrthographicFrustum_default) {
  169451. const width = Math.max(
  169452. Cartesian3_default.distance(northEast, northWest),
  169453. Cartesian3_default.distance(southEast, southWest)
  169454. );
  169455. const height = Math.max(
  169456. Cartesian3_default.distance(northEast, southEast),
  169457. Cartesian3_default.distance(northWest, southWest)
  169458. );
  169459. let rightScalar;
  169460. let topScalar;
  169461. const ratio = camera.frustum._offCenterFrustum.right / camera.frustum._offCenterFrustum.top;
  169462. const heightRatio = height * ratio;
  169463. if (width > heightRatio) {
  169464. rightScalar = width;
  169465. topScalar = rightScalar / ratio;
  169466. } else {
  169467. topScalar = height;
  169468. rightScalar = heightRatio;
  169469. }
  169470. d = Math.max(rightScalar, topScalar);
  169471. } else {
  169472. const tanPhi = Math.tan(camera.frustum.fovy * 0.5);
  169473. const tanTheta = camera.frustum.aspectRatio * tanPhi;
  169474. d = Math.max(
  169475. computeD(direction2, up, northWest, tanPhi),
  169476. computeD(direction2, up, southEast, tanPhi),
  169477. computeD(direction2, up, northEast, tanPhi),
  169478. computeD(direction2, up, southWest, tanPhi),
  169479. computeD(direction2, up, northCenter, tanPhi),
  169480. computeD(direction2, up, southCenter, tanPhi),
  169481. computeD(direction2, right, northWest, tanTheta),
  169482. computeD(direction2, right, southEast, tanTheta),
  169483. computeD(direction2, right, northEast, tanTheta),
  169484. computeD(direction2, right, southWest, tanTheta),
  169485. computeD(direction2, right, northCenter, tanTheta),
  169486. computeD(direction2, right, southCenter, tanTheta)
  169487. );
  169488. if (south < 0 && north > 0) {
  169489. const equatorCartographic = viewRectangle3DCartographic1;
  169490. equatorCartographic.longitude = west;
  169491. equatorCartographic.latitude = 0;
  169492. equatorCartographic.height = 0;
  169493. let equatorPosition = ellipsoid.cartographicToCartesian(
  169494. equatorCartographic,
  169495. viewRectangle3DEquator
  169496. );
  169497. Cartesian3_default.subtract(equatorPosition, center, equatorPosition);
  169498. d = Math.max(
  169499. d,
  169500. computeD(direction2, up, equatorPosition, tanPhi),
  169501. computeD(direction2, right, equatorPosition, tanTheta)
  169502. );
  169503. equatorCartographic.longitude = east;
  169504. equatorPosition = ellipsoid.cartographicToCartesian(
  169505. equatorCartographic,
  169506. viewRectangle3DEquator
  169507. );
  169508. Cartesian3_default.subtract(equatorPosition, center, equatorPosition);
  169509. d = Math.max(
  169510. d,
  169511. computeD(direction2, up, equatorPosition, tanPhi),
  169512. computeD(direction2, right, equatorPosition, tanTheta)
  169513. );
  169514. }
  169515. }
  169516. return Cartesian3_default.add(
  169517. center,
  169518. Cartesian3_default.multiplyByScalar(direction2, -d, viewRectangle3DEquator),
  169519. result
  169520. );
  169521. }
  169522. var viewRectangleCVCartographic = new Cartographic_default();
  169523. var viewRectangleCVNorthEast = new Cartesian3_default();
  169524. var viewRectangleCVSouthWest = new Cartesian3_default();
  169525. function rectangleCameraPositionColumbusView(camera, rectangle, result) {
  169526. const projection = camera._projection;
  169527. if (rectangle.west > rectangle.east) {
  169528. rectangle = Rectangle_default.MAX_VALUE;
  169529. }
  169530. const transform4 = camera._actualTransform;
  169531. const invTransform = camera._actualInvTransform;
  169532. const cart = viewRectangleCVCartographic;
  169533. cart.longitude = rectangle.east;
  169534. cart.latitude = rectangle.north;
  169535. const northEast = projection.project(cart, viewRectangleCVNorthEast);
  169536. Matrix4_default.multiplyByPoint(transform4, northEast, northEast);
  169537. Matrix4_default.multiplyByPoint(invTransform, northEast, northEast);
  169538. cart.longitude = rectangle.west;
  169539. cart.latitude = rectangle.south;
  169540. const southWest = projection.project(cart, viewRectangleCVSouthWest);
  169541. Matrix4_default.multiplyByPoint(transform4, southWest, southWest);
  169542. Matrix4_default.multiplyByPoint(invTransform, southWest, southWest);
  169543. result.x = (northEast.x - southWest.x) * 0.5 + southWest.x;
  169544. result.y = (northEast.y - southWest.y) * 0.5 + southWest.y;
  169545. if (defined_default(camera.frustum.fovy)) {
  169546. const tanPhi = Math.tan(camera.frustum.fovy * 0.5);
  169547. const tanTheta = camera.frustum.aspectRatio * tanPhi;
  169548. result.z = Math.max(
  169549. (northEast.x - southWest.x) / tanTheta,
  169550. (northEast.y - southWest.y) / tanPhi
  169551. ) * 0.5;
  169552. } else {
  169553. const width = northEast.x - southWest.x;
  169554. const height = northEast.y - southWest.y;
  169555. result.z = Math.max(width, height);
  169556. }
  169557. return result;
  169558. }
  169559. var viewRectangle2DCartographic = new Cartographic_default();
  169560. var viewRectangle2DNorthEast = new Cartesian3_default();
  169561. var viewRectangle2DSouthWest = new Cartesian3_default();
  169562. function rectangleCameraPosition2D(camera, rectangle, result) {
  169563. const projection = camera._projection;
  169564. let east = rectangle.east;
  169565. if (rectangle.west > rectangle.east) {
  169566. if (camera._scene.mapMode2D === MapMode2D_default.INFINITE_SCROLL) {
  169567. east += Math_default.TWO_PI;
  169568. } else {
  169569. rectangle = Rectangle_default.MAX_VALUE;
  169570. east = rectangle.east;
  169571. }
  169572. }
  169573. let cart = viewRectangle2DCartographic;
  169574. cart.longitude = east;
  169575. cart.latitude = rectangle.north;
  169576. const northEast = projection.project(cart, viewRectangle2DNorthEast);
  169577. cart.longitude = rectangle.west;
  169578. cart.latitude = rectangle.south;
  169579. const southWest = projection.project(cart, viewRectangle2DSouthWest);
  169580. const width = Math.abs(northEast.x - southWest.x) * 0.5;
  169581. let height = Math.abs(northEast.y - southWest.y) * 0.5;
  169582. let right, top;
  169583. const ratio = camera.frustum.right / camera.frustum.top;
  169584. const heightRatio = height * ratio;
  169585. if (width > heightRatio) {
  169586. right = width;
  169587. top = right / ratio;
  169588. } else {
  169589. top = height;
  169590. right = heightRatio;
  169591. }
  169592. height = Math.max(2 * right, 2 * top);
  169593. result.x = (northEast.x - southWest.x) * 0.5 + southWest.x;
  169594. result.y = (northEast.y - southWest.y) * 0.5 + southWest.y;
  169595. cart = projection.unproject(result, cart);
  169596. cart.height = height;
  169597. result = projection.project(cart, result);
  169598. return result;
  169599. }
  169600. Camera.prototype.getRectangleCameraCoordinates = function(rectangle, result) {
  169601. if (!defined_default(rectangle)) {
  169602. throw new DeveloperError_default("rectangle is required");
  169603. }
  169604. const mode2 = this._mode;
  169605. if (!defined_default(result)) {
  169606. result = new Cartesian3_default();
  169607. }
  169608. if (mode2 === SceneMode_default.SCENE3D) {
  169609. return rectangleCameraPosition3D(this, rectangle, result);
  169610. } else if (mode2 === SceneMode_default.COLUMBUS_VIEW) {
  169611. return rectangleCameraPositionColumbusView(this, rectangle, result);
  169612. } else if (mode2 === SceneMode_default.SCENE2D) {
  169613. return rectangleCameraPosition2D(this, rectangle, result);
  169614. }
  169615. return void 0;
  169616. };
  169617. var pickEllipsoid3DRay = new Ray_default();
  169618. function pickEllipsoid3D(camera, windowPosition, ellipsoid, result) {
  169619. ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  169620. const ray = camera.getPickRay(windowPosition, pickEllipsoid3DRay);
  169621. const intersection = IntersectionTests_default.rayEllipsoid(ray, ellipsoid);
  169622. if (!intersection) {
  169623. return void 0;
  169624. }
  169625. const t = intersection.start > 0 ? intersection.start : intersection.stop;
  169626. return Ray_default.getPoint(ray, t, result);
  169627. }
  169628. var pickEllipsoid2DRay = new Ray_default();
  169629. function pickMap2D(camera, windowPosition, projection, result) {
  169630. const ray = camera.getPickRay(windowPosition, pickEllipsoid2DRay);
  169631. let position = ray.origin;
  169632. position = Cartesian3_default.fromElements(position.y, position.z, 0, position);
  169633. const cart = projection.unproject(position);
  169634. if (cart.latitude < -Math_default.PI_OVER_TWO || cart.latitude > Math_default.PI_OVER_TWO) {
  169635. return void 0;
  169636. }
  169637. return projection.ellipsoid.cartographicToCartesian(cart, result);
  169638. }
  169639. var pickEllipsoidCVRay = new Ray_default();
  169640. function pickMapColumbusView(camera, windowPosition, projection, result) {
  169641. const ray = camera.getPickRay(windowPosition, pickEllipsoidCVRay);
  169642. const scalar = -ray.origin.x / ray.direction.x;
  169643. Ray_default.getPoint(ray, scalar, result);
  169644. const cart = projection.unproject(new Cartesian3_default(result.y, result.z, 0));
  169645. if (cart.latitude < -Math_default.PI_OVER_TWO || cart.latitude > Math_default.PI_OVER_TWO || cart.longitude < -Math.PI || cart.longitude > Math.PI) {
  169646. return void 0;
  169647. }
  169648. return projection.ellipsoid.cartographicToCartesian(cart, result);
  169649. }
  169650. Camera.prototype.pickEllipsoid = function(windowPosition, ellipsoid, result) {
  169651. if (!defined_default(windowPosition)) {
  169652. throw new DeveloperError_default("windowPosition is required.");
  169653. }
  169654. const canvas = this._scene.canvas;
  169655. if (canvas.clientWidth === 0 || canvas.clientHeight === 0) {
  169656. return void 0;
  169657. }
  169658. if (!defined_default(result)) {
  169659. result = new Cartesian3_default();
  169660. }
  169661. ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  169662. if (this._mode === SceneMode_default.SCENE3D) {
  169663. result = pickEllipsoid3D(this, windowPosition, ellipsoid, result);
  169664. } else if (this._mode === SceneMode_default.SCENE2D) {
  169665. result = pickMap2D(this, windowPosition, this._projection, result);
  169666. } else if (this._mode === SceneMode_default.COLUMBUS_VIEW) {
  169667. result = pickMapColumbusView(
  169668. this,
  169669. windowPosition,
  169670. this._projection,
  169671. result
  169672. );
  169673. } else {
  169674. return void 0;
  169675. }
  169676. return result;
  169677. };
  169678. var pickPerspCenter = new Cartesian3_default();
  169679. var pickPerspXDir = new Cartesian3_default();
  169680. var pickPerspYDir = new Cartesian3_default();
  169681. function getPickRayPerspective(camera, windowPosition, result) {
  169682. const canvas = camera._scene.canvas;
  169683. const width = canvas.clientWidth;
  169684. const height = canvas.clientHeight;
  169685. const tanPhi = Math.tan(camera.frustum.fovy * 0.5);
  169686. const tanTheta = camera.frustum.aspectRatio * tanPhi;
  169687. const near = camera.frustum.near;
  169688. const x = 2 / width * windowPosition.x - 1;
  169689. const y = 2 / height * (height - windowPosition.y) - 1;
  169690. const position = camera.positionWC;
  169691. Cartesian3_default.clone(position, result.origin);
  169692. const nearCenter = Cartesian3_default.multiplyByScalar(
  169693. camera.directionWC,
  169694. near,
  169695. pickPerspCenter
  169696. );
  169697. Cartesian3_default.add(position, nearCenter, nearCenter);
  169698. const xDir = Cartesian3_default.multiplyByScalar(
  169699. camera.rightWC,
  169700. x * near * tanTheta,
  169701. pickPerspXDir
  169702. );
  169703. const yDir = Cartesian3_default.multiplyByScalar(
  169704. camera.upWC,
  169705. y * near * tanPhi,
  169706. pickPerspYDir
  169707. );
  169708. const direction2 = Cartesian3_default.add(nearCenter, xDir, result.direction);
  169709. Cartesian3_default.add(direction2, yDir, direction2);
  169710. Cartesian3_default.subtract(direction2, position, direction2);
  169711. Cartesian3_default.normalize(direction2, direction2);
  169712. return result;
  169713. }
  169714. var scratchDirection2 = new Cartesian3_default();
  169715. function getPickRayOrthographic(camera, windowPosition, result) {
  169716. const canvas = camera._scene.canvas;
  169717. const width = canvas.clientWidth;
  169718. const height = canvas.clientHeight;
  169719. let frustum = camera.frustum;
  169720. if (defined_default(frustum._offCenterFrustum)) {
  169721. frustum = frustum._offCenterFrustum;
  169722. }
  169723. let x = 2 / width * windowPosition.x - 1;
  169724. x *= (frustum.right - frustum.left) * 0.5;
  169725. let y = 2 / height * (height - windowPosition.y) - 1;
  169726. y *= (frustum.top - frustum.bottom) * 0.5;
  169727. const origin = result.origin;
  169728. Cartesian3_default.clone(camera.position, origin);
  169729. Cartesian3_default.multiplyByScalar(camera.right, x, scratchDirection2);
  169730. Cartesian3_default.add(scratchDirection2, origin, origin);
  169731. Cartesian3_default.multiplyByScalar(camera.up, y, scratchDirection2);
  169732. Cartesian3_default.add(scratchDirection2, origin, origin);
  169733. Cartesian3_default.clone(camera.directionWC, result.direction);
  169734. if (camera._mode === SceneMode_default.COLUMBUS_VIEW || camera._mode === SceneMode_default.SCENE2D) {
  169735. Cartesian3_default.fromElements(
  169736. result.origin.z,
  169737. result.origin.x,
  169738. result.origin.y,
  169739. result.origin
  169740. );
  169741. }
  169742. return result;
  169743. }
  169744. Camera.prototype.getPickRay = function(windowPosition, result) {
  169745. if (!defined_default(windowPosition)) {
  169746. throw new DeveloperError_default("windowPosition is required.");
  169747. }
  169748. if (!defined_default(result)) {
  169749. result = new Ray_default();
  169750. }
  169751. const canvas = this._scene.canvas;
  169752. if (canvas.clientWidth <= 0 || canvas.clientHeight <= 0) {
  169753. return void 0;
  169754. }
  169755. const frustum = this.frustum;
  169756. if (defined_default(frustum.aspectRatio) && defined_default(frustum.fov) && defined_default(frustum.near)) {
  169757. return getPickRayPerspective(this, windowPosition, result);
  169758. }
  169759. return getPickRayOrthographic(this, windowPosition, result);
  169760. };
  169761. var scratchToCenter2 = new Cartesian3_default();
  169762. var scratchProj = new Cartesian3_default();
  169763. Camera.prototype.distanceToBoundingSphere = function(boundingSphere) {
  169764. if (!defined_default(boundingSphere)) {
  169765. throw new DeveloperError_default("boundingSphere is required.");
  169766. }
  169767. const toCenter = Cartesian3_default.subtract(
  169768. this.positionWC,
  169769. boundingSphere.center,
  169770. scratchToCenter2
  169771. );
  169772. const proj2 = Cartesian3_default.multiplyByScalar(
  169773. this.directionWC,
  169774. Cartesian3_default.dot(toCenter, this.directionWC),
  169775. scratchProj
  169776. );
  169777. return Math.max(0, Cartesian3_default.magnitude(proj2) - boundingSphere.radius);
  169778. };
  169779. var scratchPixelSize = new Cartesian2_default();
  169780. Camera.prototype.getPixelSize = function(boundingSphere, drawingBufferWidth, drawingBufferHeight) {
  169781. if (!defined_default(boundingSphere)) {
  169782. throw new DeveloperError_default("boundingSphere is required.");
  169783. }
  169784. if (!defined_default(drawingBufferWidth)) {
  169785. throw new DeveloperError_default("drawingBufferWidth is required.");
  169786. }
  169787. if (!defined_default(drawingBufferHeight)) {
  169788. throw new DeveloperError_default("drawingBufferHeight is required.");
  169789. }
  169790. const distance2 = this.distanceToBoundingSphere(boundingSphere);
  169791. const pixelSize = this.frustum.getPixelDimensions(
  169792. drawingBufferWidth,
  169793. drawingBufferHeight,
  169794. distance2,
  169795. this._scene.pixelRatio,
  169796. scratchPixelSize
  169797. );
  169798. return Math.max(pixelSize.x, pixelSize.y);
  169799. };
  169800. function createAnimationTemplateCV(camera, position, center, maxX, maxY, duration) {
  169801. const newPosition = Cartesian3_default.clone(position);
  169802. if (center.y > maxX) {
  169803. newPosition.y -= center.y - maxX;
  169804. } else if (center.y < -maxX) {
  169805. newPosition.y += -maxX - center.y;
  169806. }
  169807. if (center.z > maxY) {
  169808. newPosition.z -= center.z - maxY;
  169809. } else if (center.z < -maxY) {
  169810. newPosition.z += -maxY - center.z;
  169811. }
  169812. function updateCV2(value) {
  169813. const interp = Cartesian3_default.lerp(
  169814. position,
  169815. newPosition,
  169816. value.time,
  169817. new Cartesian3_default()
  169818. );
  169819. camera.worldToCameraCoordinatesPoint(interp, camera.position);
  169820. }
  169821. return {
  169822. easingFunction: EasingFunction_default.EXPONENTIAL_OUT,
  169823. startObject: {
  169824. time: 0
  169825. },
  169826. stopObject: {
  169827. time: 1
  169828. },
  169829. duration,
  169830. update: updateCV2
  169831. };
  169832. }
  169833. var normalScratch5 = new Cartesian3_default();
  169834. var centerScratch5 = new Cartesian3_default();
  169835. var posScratch = new Cartesian3_default();
  169836. var scratchCartesian3Subtract = new Cartesian3_default();
  169837. function createAnimationCV(camera, duration) {
  169838. let position = camera.position;
  169839. const direction2 = camera.direction;
  169840. const normal2 = camera.worldToCameraCoordinatesVector(
  169841. Cartesian3_default.UNIT_X,
  169842. normalScratch5
  169843. );
  169844. const scalar = -Cartesian3_default.dot(normal2, position) / Cartesian3_default.dot(normal2, direction2);
  169845. const center = Cartesian3_default.add(
  169846. position,
  169847. Cartesian3_default.multiplyByScalar(direction2, scalar, centerScratch5),
  169848. centerScratch5
  169849. );
  169850. camera.cameraToWorldCoordinatesPoint(center, center);
  169851. position = camera.cameraToWorldCoordinatesPoint(camera.position, posScratch);
  169852. const tanPhi = Math.tan(camera.frustum.fovy * 0.5);
  169853. const tanTheta = camera.frustum.aspectRatio * tanPhi;
  169854. const distToC = Cartesian3_default.magnitude(
  169855. Cartesian3_default.subtract(position, center, scratchCartesian3Subtract)
  169856. );
  169857. const dWidth = tanTheta * distToC;
  169858. const dHeight = tanPhi * distToC;
  169859. const mapWidth = camera._maxCoord.x;
  169860. const mapHeight = camera._maxCoord.y;
  169861. const maxX = Math.max(dWidth - mapWidth, mapWidth);
  169862. const maxY = Math.max(dHeight - mapHeight, mapHeight);
  169863. if (position.z < -maxX || position.z > maxX || position.y < -maxY || position.y > maxY) {
  169864. const translateX = center.y < -maxX || center.y > maxX;
  169865. const translateY = center.z < -maxY || center.z > maxY;
  169866. if (translateX || translateY) {
  169867. return createAnimationTemplateCV(
  169868. camera,
  169869. position,
  169870. center,
  169871. maxX,
  169872. maxY,
  169873. duration
  169874. );
  169875. }
  169876. }
  169877. return void 0;
  169878. }
  169879. Camera.prototype.createCorrectPositionTween = function(duration) {
  169880. if (!defined_default(duration)) {
  169881. throw new DeveloperError_default("duration is required.");
  169882. }
  169883. if (this._mode === SceneMode_default.COLUMBUS_VIEW) {
  169884. return createAnimationCV(this, duration);
  169885. }
  169886. return void 0;
  169887. };
  169888. var scratchFlyToDestination = new Cartesian3_default();
  169889. var newOptions = {
  169890. destination: void 0,
  169891. heading: void 0,
  169892. pitch: void 0,
  169893. roll: void 0,
  169894. duration: void 0,
  169895. complete: void 0,
  169896. cancel: void 0,
  169897. endTransform: void 0,
  169898. maximumHeight: void 0,
  169899. easingFunction: void 0
  169900. };
  169901. Camera.prototype.cancelFlight = function() {
  169902. if (defined_default(this._currentFlight)) {
  169903. this._currentFlight.cancelTween();
  169904. this._currentFlight = void 0;
  169905. }
  169906. };
  169907. Camera.prototype.completeFlight = function() {
  169908. if (defined_default(this._currentFlight)) {
  169909. this._currentFlight.cancelTween();
  169910. const options = {
  169911. destination: void 0,
  169912. orientation: {
  169913. heading: void 0,
  169914. pitch: void 0,
  169915. roll: void 0
  169916. }
  169917. };
  169918. options.destination = newOptions.destination;
  169919. options.orientation.heading = newOptions.heading;
  169920. options.orientation.pitch = newOptions.pitch;
  169921. options.orientation.roll = newOptions.roll;
  169922. this.setView(options);
  169923. if (defined_default(this._currentFlight.complete)) {
  169924. this._currentFlight.complete();
  169925. }
  169926. this._currentFlight = void 0;
  169927. }
  169928. };
  169929. Camera.prototype.flyTo = function(options) {
  169930. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  169931. let destination = options.destination;
  169932. if (!defined_default(destination)) {
  169933. throw new DeveloperError_default("destination is required.");
  169934. }
  169935. const mode2 = this._mode;
  169936. if (mode2 === SceneMode_default.MORPHING) {
  169937. return;
  169938. }
  169939. this.cancelFlight();
  169940. let orientation = defaultValue_default(
  169941. options.orientation,
  169942. defaultValue_default.EMPTY_OBJECT
  169943. );
  169944. if (defined_default(orientation.direction)) {
  169945. orientation = directionUpToHeadingPitchRoll(
  169946. this,
  169947. destination,
  169948. orientation,
  169949. scratchSetViewOptions.orientation
  169950. );
  169951. }
  169952. if (defined_default(options.duration) && options.duration <= 0) {
  169953. const setViewOptions = scratchSetViewOptions;
  169954. setViewOptions.destination = options.destination;
  169955. setViewOptions.orientation.heading = orientation.heading;
  169956. setViewOptions.orientation.pitch = orientation.pitch;
  169957. setViewOptions.orientation.roll = orientation.roll;
  169958. setViewOptions.convert = options.convert;
  169959. setViewOptions.endTransform = options.endTransform;
  169960. this.setView(setViewOptions);
  169961. if (typeof options.complete === "function") {
  169962. options.complete();
  169963. }
  169964. return;
  169965. }
  169966. const isRectangle = defined_default(destination.west);
  169967. if (isRectangle) {
  169968. destination = this.getRectangleCameraCoordinates(
  169969. destination,
  169970. scratchFlyToDestination
  169971. );
  169972. }
  169973. const that = this;
  169974. let flightTween;
  169975. newOptions.destination = destination;
  169976. newOptions.heading = orientation.heading;
  169977. newOptions.pitch = orientation.pitch;
  169978. newOptions.roll = orientation.roll;
  169979. newOptions.duration = options.duration;
  169980. newOptions.complete = function() {
  169981. if (flightTween === that._currentFlight) {
  169982. that._currentFlight = void 0;
  169983. }
  169984. if (defined_default(options.complete)) {
  169985. options.complete();
  169986. }
  169987. };
  169988. newOptions.cancel = options.cancel;
  169989. newOptions.endTransform = options.endTransform;
  169990. newOptions.convert = isRectangle ? false : options.convert;
  169991. newOptions.maximumHeight = options.maximumHeight;
  169992. newOptions.pitchAdjustHeight = options.pitchAdjustHeight;
  169993. newOptions.flyOverLongitude = options.flyOverLongitude;
  169994. newOptions.flyOverLongitudeWeight = options.flyOverLongitudeWeight;
  169995. newOptions.easingFunction = options.easingFunction;
  169996. const scene = this._scene;
  169997. const tweenOptions = CameraFlightPath_default.createTween(scene, newOptions);
  169998. if (tweenOptions.duration === 0) {
  169999. if (typeof tweenOptions.complete === "function") {
  170000. tweenOptions.complete();
  170001. }
  170002. return;
  170003. }
  170004. flightTween = scene.tweens.add(tweenOptions);
  170005. this._currentFlight = flightTween;
  170006. let preloadFlightCamera = this._scene.preloadFlightCamera;
  170007. if (this._mode !== SceneMode_default.SCENE2D) {
  170008. if (!defined_default(preloadFlightCamera)) {
  170009. preloadFlightCamera = Camera.clone(this);
  170010. }
  170011. preloadFlightCamera.setView({
  170012. destination,
  170013. orientation
  170014. });
  170015. this._scene.preloadFlightCullingVolume = preloadFlightCamera.frustum.computeCullingVolume(
  170016. preloadFlightCamera.positionWC,
  170017. preloadFlightCamera.directionWC,
  170018. preloadFlightCamera.upWC
  170019. );
  170020. }
  170021. };
  170022. function distanceToBoundingSphere3D(camera, radius) {
  170023. const frustum = camera.frustum;
  170024. const tanPhi = Math.tan(frustum.fovy * 0.5);
  170025. const tanTheta = frustum.aspectRatio * tanPhi;
  170026. return Math.max(radius / tanTheta, radius / tanPhi);
  170027. }
  170028. function distanceToBoundingSphere2D(camera, radius) {
  170029. let frustum = camera.frustum;
  170030. if (defined_default(frustum._offCenterFrustum)) {
  170031. frustum = frustum._offCenterFrustum;
  170032. }
  170033. let right, top;
  170034. const ratio = frustum.right / frustum.top;
  170035. const heightRatio = radius * ratio;
  170036. if (radius > heightRatio) {
  170037. right = radius;
  170038. top = right / ratio;
  170039. } else {
  170040. top = radius;
  170041. right = heightRatio;
  170042. }
  170043. return Math.max(right, top) * 1.5;
  170044. }
  170045. var MINIMUM_ZOOM = 100;
  170046. function adjustBoundingSphereOffset(camera, boundingSphere, offset2) {
  170047. offset2 = HeadingPitchRange_default.clone(
  170048. defined_default(offset2) ? offset2 : Camera.DEFAULT_OFFSET
  170049. );
  170050. const minimumZoom = camera._scene.screenSpaceCameraController.minimumZoomDistance;
  170051. const maximumZoom = camera._scene.screenSpaceCameraController.maximumZoomDistance;
  170052. const range2 = offset2.range;
  170053. if (!defined_default(range2) || range2 === 0) {
  170054. const radius = boundingSphere.radius;
  170055. if (radius === 0) {
  170056. offset2.range = MINIMUM_ZOOM;
  170057. } else if (camera.frustum instanceof OrthographicFrustum_default || camera._mode === SceneMode_default.SCENE2D) {
  170058. offset2.range = distanceToBoundingSphere2D(camera, radius);
  170059. } else {
  170060. offset2.range = distanceToBoundingSphere3D(camera, radius);
  170061. }
  170062. offset2.range = Math_default.clamp(offset2.range, minimumZoom, maximumZoom);
  170063. }
  170064. return offset2;
  170065. }
  170066. Camera.prototype.viewBoundingSphere = function(boundingSphere, offset2) {
  170067. if (!defined_default(boundingSphere)) {
  170068. throw new DeveloperError_default("boundingSphere is required.");
  170069. }
  170070. if (this._mode === SceneMode_default.MORPHING) {
  170071. throw new DeveloperError_default(
  170072. "viewBoundingSphere is not supported while morphing."
  170073. );
  170074. }
  170075. offset2 = adjustBoundingSphereOffset(this, boundingSphere, offset2);
  170076. this.lookAt(boundingSphere.center, offset2);
  170077. };
  170078. var scratchflyToBoundingSphereTransform = new Matrix4_default();
  170079. var scratchflyToBoundingSphereDestination = new Cartesian3_default();
  170080. var scratchflyToBoundingSphereDirection = new Cartesian3_default();
  170081. var scratchflyToBoundingSphereUp = new Cartesian3_default();
  170082. var scratchflyToBoundingSphereRight = new Cartesian3_default();
  170083. var scratchFlyToBoundingSphereCart4 = new Cartesian4_default();
  170084. var scratchFlyToBoundingSphereQuaternion = new Quaternion_default();
  170085. var scratchFlyToBoundingSphereMatrix3 = new Matrix3_default();
  170086. Camera.prototype.flyToBoundingSphere = function(boundingSphere, options) {
  170087. if (!defined_default(boundingSphere)) {
  170088. throw new DeveloperError_default("boundingSphere is required.");
  170089. }
  170090. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  170091. const scene2D = this._mode === SceneMode_default.SCENE2D || this._mode === SceneMode_default.COLUMBUS_VIEW;
  170092. this._setTransform(Matrix4_default.IDENTITY);
  170093. const offset2 = adjustBoundingSphereOffset(
  170094. this,
  170095. boundingSphere,
  170096. options.offset
  170097. );
  170098. let position;
  170099. if (scene2D) {
  170100. position = Cartesian3_default.multiplyByScalar(
  170101. Cartesian3_default.UNIT_Z,
  170102. offset2.range,
  170103. scratchflyToBoundingSphereDestination
  170104. );
  170105. } else {
  170106. position = offsetFromHeadingPitchRange(
  170107. offset2.heading,
  170108. offset2.pitch,
  170109. offset2.range
  170110. );
  170111. }
  170112. const transform4 = Transforms_default.eastNorthUpToFixedFrame(
  170113. boundingSphere.center,
  170114. Ellipsoid_default.WGS84,
  170115. scratchflyToBoundingSphereTransform
  170116. );
  170117. Matrix4_default.multiplyByPoint(transform4, position, position);
  170118. let direction2;
  170119. let up;
  170120. if (!scene2D) {
  170121. direction2 = Cartesian3_default.subtract(
  170122. boundingSphere.center,
  170123. position,
  170124. scratchflyToBoundingSphereDirection
  170125. );
  170126. Cartesian3_default.normalize(direction2, direction2);
  170127. up = Matrix4_default.multiplyByPointAsVector(
  170128. transform4,
  170129. Cartesian3_default.UNIT_Z,
  170130. scratchflyToBoundingSphereUp
  170131. );
  170132. if (1 - Math.abs(Cartesian3_default.dot(direction2, up)) < Math_default.EPSILON6) {
  170133. const rotateQuat = Quaternion_default.fromAxisAngle(
  170134. direction2,
  170135. offset2.heading,
  170136. scratchFlyToBoundingSphereQuaternion
  170137. );
  170138. const rotation = Matrix3_default.fromQuaternion(
  170139. rotateQuat,
  170140. scratchFlyToBoundingSphereMatrix3
  170141. );
  170142. Cartesian3_default.fromCartesian4(
  170143. Matrix4_default.getColumn(transform4, 1, scratchFlyToBoundingSphereCart4),
  170144. up
  170145. );
  170146. Matrix3_default.multiplyByVector(rotation, up, up);
  170147. }
  170148. const right = Cartesian3_default.cross(
  170149. direction2,
  170150. up,
  170151. scratchflyToBoundingSphereRight
  170152. );
  170153. Cartesian3_default.cross(right, direction2, up);
  170154. Cartesian3_default.normalize(up, up);
  170155. }
  170156. this.flyTo({
  170157. destination: position,
  170158. orientation: {
  170159. direction: direction2,
  170160. up
  170161. },
  170162. duration: options.duration,
  170163. complete: options.complete,
  170164. cancel: options.cancel,
  170165. endTransform: options.endTransform,
  170166. maximumHeight: options.maximumHeight,
  170167. easingFunction: options.easingFunction,
  170168. flyOverLongitude: options.flyOverLongitude,
  170169. flyOverLongitudeWeight: options.flyOverLongitudeWeight,
  170170. pitchAdjustHeight: options.pitchAdjustHeight
  170171. });
  170172. };
  170173. var scratchCartesian3_1 = new Cartesian3_default();
  170174. var scratchCartesian3_2 = new Cartesian3_default();
  170175. var scratchCartesian3_3 = new Cartesian3_default();
  170176. var scratchCartesian3_4 = new Cartesian3_default();
  170177. var horizonPoints = [
  170178. new Cartesian3_default(),
  170179. new Cartesian3_default(),
  170180. new Cartesian3_default(),
  170181. new Cartesian3_default()
  170182. ];
  170183. function computeHorizonQuad(camera, ellipsoid) {
  170184. const radii = ellipsoid.radii;
  170185. const p2 = camera.positionWC;
  170186. const q = Cartesian3_default.multiplyComponents(
  170187. ellipsoid.oneOverRadii,
  170188. p2,
  170189. scratchCartesian3_1
  170190. );
  170191. const qMagnitude = Cartesian3_default.magnitude(q);
  170192. const qUnit = Cartesian3_default.normalize(q, scratchCartesian3_2);
  170193. let eUnit;
  170194. let nUnit;
  170195. if (Cartesian3_default.equalsEpsilon(qUnit, Cartesian3_default.UNIT_Z, Math_default.EPSILON10)) {
  170196. eUnit = new Cartesian3_default(0, 1, 0);
  170197. nUnit = new Cartesian3_default(0, 0, 1);
  170198. } else {
  170199. eUnit = Cartesian3_default.normalize(
  170200. Cartesian3_default.cross(Cartesian3_default.UNIT_Z, qUnit, scratchCartesian3_3),
  170201. scratchCartesian3_3
  170202. );
  170203. nUnit = Cartesian3_default.normalize(
  170204. Cartesian3_default.cross(qUnit, eUnit, scratchCartesian3_4),
  170205. scratchCartesian3_4
  170206. );
  170207. }
  170208. const wMagnitude = Math.sqrt(Cartesian3_default.magnitudeSquared(q) - 1);
  170209. const center = Cartesian3_default.multiplyByScalar(
  170210. qUnit,
  170211. 1 / qMagnitude,
  170212. scratchCartesian3_1
  170213. );
  170214. const scalar = wMagnitude / qMagnitude;
  170215. const eastOffset = Cartesian3_default.multiplyByScalar(
  170216. eUnit,
  170217. scalar,
  170218. scratchCartesian3_2
  170219. );
  170220. const northOffset = Cartesian3_default.multiplyByScalar(
  170221. nUnit,
  170222. scalar,
  170223. scratchCartesian3_3
  170224. );
  170225. const upperLeft = Cartesian3_default.add(center, northOffset, horizonPoints[0]);
  170226. Cartesian3_default.subtract(upperLeft, eastOffset, upperLeft);
  170227. Cartesian3_default.multiplyComponents(radii, upperLeft, upperLeft);
  170228. const lowerLeft = Cartesian3_default.subtract(center, northOffset, horizonPoints[1]);
  170229. Cartesian3_default.subtract(lowerLeft, eastOffset, lowerLeft);
  170230. Cartesian3_default.multiplyComponents(radii, lowerLeft, lowerLeft);
  170231. const lowerRight = Cartesian3_default.subtract(center, northOffset, horizonPoints[2]);
  170232. Cartesian3_default.add(lowerRight, eastOffset, lowerRight);
  170233. Cartesian3_default.multiplyComponents(radii, lowerRight, lowerRight);
  170234. const upperRight = Cartesian3_default.add(center, northOffset, horizonPoints[3]);
  170235. Cartesian3_default.add(upperRight, eastOffset, upperRight);
  170236. Cartesian3_default.multiplyComponents(radii, upperRight, upperRight);
  170237. return horizonPoints;
  170238. }
  170239. var scratchPickCartesian2 = new Cartesian2_default();
  170240. var scratchRectCartesian = new Cartesian3_default();
  170241. var cartoArray = [
  170242. new Cartographic_default(),
  170243. new Cartographic_default(),
  170244. new Cartographic_default(),
  170245. new Cartographic_default()
  170246. ];
  170247. function addToResult(x, y, index2, camera, ellipsoid, computedHorizonQuad) {
  170248. scratchPickCartesian2.x = x;
  170249. scratchPickCartesian2.y = y;
  170250. const r2 = camera.pickEllipsoid(
  170251. scratchPickCartesian2,
  170252. ellipsoid,
  170253. scratchRectCartesian
  170254. );
  170255. if (defined_default(r2)) {
  170256. cartoArray[index2] = ellipsoid.cartesianToCartographic(r2, cartoArray[index2]);
  170257. return 1;
  170258. }
  170259. cartoArray[index2] = ellipsoid.cartesianToCartographic(
  170260. computedHorizonQuad[index2],
  170261. cartoArray[index2]
  170262. );
  170263. return 0;
  170264. }
  170265. Camera.prototype.computeViewRectangle = function(ellipsoid, result) {
  170266. ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  170267. const cullingVolume = this.frustum.computeCullingVolume(
  170268. this.positionWC,
  170269. this.directionWC,
  170270. this.upWC
  170271. );
  170272. const boundingSphere = new BoundingSphere_default(
  170273. Cartesian3_default.ZERO,
  170274. ellipsoid.maximumRadius
  170275. );
  170276. const visibility = cullingVolume.computeVisibility(boundingSphere);
  170277. if (visibility === Intersect_default.OUTSIDE) {
  170278. return void 0;
  170279. }
  170280. const canvas = this._scene.canvas;
  170281. const width = canvas.clientWidth;
  170282. const height = canvas.clientHeight;
  170283. let successfulPickCount = 0;
  170284. const computedHorizonQuad = computeHorizonQuad(this, ellipsoid);
  170285. successfulPickCount += addToResult(
  170286. 0,
  170287. 0,
  170288. 0,
  170289. this,
  170290. ellipsoid,
  170291. computedHorizonQuad
  170292. );
  170293. successfulPickCount += addToResult(
  170294. 0,
  170295. height,
  170296. 1,
  170297. this,
  170298. ellipsoid,
  170299. computedHorizonQuad
  170300. );
  170301. successfulPickCount += addToResult(
  170302. width,
  170303. height,
  170304. 2,
  170305. this,
  170306. ellipsoid,
  170307. computedHorizonQuad
  170308. );
  170309. successfulPickCount += addToResult(
  170310. width,
  170311. 0,
  170312. 3,
  170313. this,
  170314. ellipsoid,
  170315. computedHorizonQuad
  170316. );
  170317. if (successfulPickCount < 2) {
  170318. return Rectangle_default.MAX_VALUE;
  170319. }
  170320. result = Rectangle_default.fromCartographicArray(cartoArray, result);
  170321. let distance2 = 0;
  170322. let lastLon = cartoArray[3].longitude;
  170323. for (let i2 = 0; i2 < 4; ++i2) {
  170324. const lon = cartoArray[i2].longitude;
  170325. const diff = Math.abs(lon - lastLon);
  170326. if (diff > Math_default.PI) {
  170327. distance2 += Math_default.TWO_PI - diff;
  170328. } else {
  170329. distance2 += diff;
  170330. }
  170331. lastLon = lon;
  170332. }
  170333. if (Math_default.equalsEpsilon(
  170334. Math.abs(distance2),
  170335. Math_default.TWO_PI,
  170336. Math_default.EPSILON9
  170337. )) {
  170338. result.west = -Math_default.PI;
  170339. result.east = Math_default.PI;
  170340. if (cartoArray[0].latitude >= 0) {
  170341. result.north = Math_default.PI_OVER_TWO;
  170342. } else {
  170343. result.south = -Math_default.PI_OVER_TWO;
  170344. }
  170345. }
  170346. return result;
  170347. };
  170348. Camera.prototype.switchToPerspectiveFrustum = function() {
  170349. if (this._mode === SceneMode_default.SCENE2D || this.frustum instanceof PerspectiveFrustum_default) {
  170350. return;
  170351. }
  170352. const scene = this._scene;
  170353. this.frustum = new PerspectiveFrustum_default();
  170354. this.frustum.aspectRatio = scene.drawingBufferWidth / scene.drawingBufferHeight;
  170355. this.frustum.fov = Math_default.toRadians(60);
  170356. };
  170357. Camera.prototype.switchToOrthographicFrustum = function() {
  170358. if (this._mode === SceneMode_default.SCENE2D || this.frustum instanceof OrthographicFrustum_default) {
  170359. return;
  170360. }
  170361. const frustumWidth = calculateOrthographicFrustumWidth(this);
  170362. const scene = this._scene;
  170363. this.frustum = new OrthographicFrustum_default();
  170364. this.frustum.aspectRatio = scene.drawingBufferWidth / scene.drawingBufferHeight;
  170365. this.frustum.width = frustumWidth;
  170366. };
  170367. Camera.clone = function(camera, result) {
  170368. if (!defined_default(result)) {
  170369. result = new Camera(camera._scene);
  170370. }
  170371. Cartesian3_default.clone(camera.position, result.position);
  170372. Cartesian3_default.clone(camera.direction, result.direction);
  170373. Cartesian3_default.clone(camera.up, result.up);
  170374. Cartesian3_default.clone(camera.right, result.right);
  170375. Matrix4_default.clone(camera._transform, result.transform);
  170376. result._transformChanged = true;
  170377. result.frustum = camera.frustum.clone();
  170378. return result;
  170379. };
  170380. var Camera_default = Camera;
  170381. // node_modules/cesium/Source/Scene/CameraEventType.js
  170382. var CameraEventType = {
  170383. LEFT_DRAG: 0,
  170384. RIGHT_DRAG: 1,
  170385. MIDDLE_DRAG: 2,
  170386. WHEEL: 3,
  170387. PINCH: 4
  170388. };
  170389. var CameraEventType_default = Object.freeze(CameraEventType);
  170390. // node_modules/cesium/Source/Scene/CameraEventAggregator.js
  170391. function getKey(type, modifier) {
  170392. let key = type;
  170393. if (defined_default(modifier)) {
  170394. key += `+${modifier}`;
  170395. }
  170396. return key;
  170397. }
  170398. function clonePinchMovement(pinchMovement, result) {
  170399. Cartesian2_default.clone(
  170400. pinchMovement.distance.startPosition,
  170401. result.distance.startPosition
  170402. );
  170403. Cartesian2_default.clone(
  170404. pinchMovement.distance.endPosition,
  170405. result.distance.endPosition
  170406. );
  170407. Cartesian2_default.clone(
  170408. pinchMovement.angleAndHeight.startPosition,
  170409. result.angleAndHeight.startPosition
  170410. );
  170411. Cartesian2_default.clone(
  170412. pinchMovement.angleAndHeight.endPosition,
  170413. result.angleAndHeight.endPosition
  170414. );
  170415. }
  170416. function listenToPinch(aggregator, modifier, canvas) {
  170417. const key = getKey(CameraEventType_default.PINCH, modifier);
  170418. const update7 = aggregator._update;
  170419. const isDown = aggregator._isDown;
  170420. const eventStartPosition = aggregator._eventStartPosition;
  170421. const pressTime = aggregator._pressTime;
  170422. const releaseTime = aggregator._releaseTime;
  170423. update7[key] = true;
  170424. isDown[key] = false;
  170425. eventStartPosition[key] = new Cartesian2_default();
  170426. let movement = aggregator._movement[key];
  170427. if (!defined_default(movement)) {
  170428. movement = aggregator._movement[key] = {};
  170429. }
  170430. movement.distance = {
  170431. startPosition: new Cartesian2_default(),
  170432. endPosition: new Cartesian2_default()
  170433. };
  170434. movement.angleAndHeight = {
  170435. startPosition: new Cartesian2_default(),
  170436. endPosition: new Cartesian2_default()
  170437. };
  170438. movement.prevAngle = 0;
  170439. aggregator._eventHandler.setInputAction(
  170440. function(event) {
  170441. aggregator._buttonsDown++;
  170442. isDown[key] = true;
  170443. pressTime[key] = new Date();
  170444. Cartesian2_default.lerp(
  170445. event.position1,
  170446. event.position2,
  170447. 0.5,
  170448. eventStartPosition[key]
  170449. );
  170450. },
  170451. ScreenSpaceEventType_default.PINCH_START,
  170452. modifier
  170453. );
  170454. aggregator._eventHandler.setInputAction(
  170455. function() {
  170456. aggregator._buttonsDown = Math.max(aggregator._buttonsDown - 1, 0);
  170457. isDown[key] = false;
  170458. releaseTime[key] = new Date();
  170459. },
  170460. ScreenSpaceEventType_default.PINCH_END,
  170461. modifier
  170462. );
  170463. aggregator._eventHandler.setInputAction(
  170464. function(mouseMovement) {
  170465. if (isDown[key]) {
  170466. if (!update7[key]) {
  170467. Cartesian2_default.clone(
  170468. mouseMovement.distance.endPosition,
  170469. movement.distance.endPosition
  170470. );
  170471. Cartesian2_default.clone(
  170472. mouseMovement.angleAndHeight.endPosition,
  170473. movement.angleAndHeight.endPosition
  170474. );
  170475. } else {
  170476. clonePinchMovement(mouseMovement, movement);
  170477. update7[key] = false;
  170478. movement.prevAngle = movement.angleAndHeight.startPosition.x;
  170479. }
  170480. let angle = movement.angleAndHeight.endPosition.x;
  170481. const prevAngle = movement.prevAngle;
  170482. const TwoPI = Math.PI * 2;
  170483. while (angle >= prevAngle + Math.PI) {
  170484. angle -= TwoPI;
  170485. }
  170486. while (angle < prevAngle - Math.PI) {
  170487. angle += TwoPI;
  170488. }
  170489. movement.angleAndHeight.endPosition.x = -angle * canvas.clientWidth / 12;
  170490. movement.angleAndHeight.startPosition.x = -prevAngle * canvas.clientWidth / 12;
  170491. }
  170492. },
  170493. ScreenSpaceEventType_default.PINCH_MOVE,
  170494. modifier
  170495. );
  170496. }
  170497. function listenToWheel(aggregator, modifier) {
  170498. const key = getKey(CameraEventType_default.WHEEL, modifier);
  170499. const update7 = aggregator._update;
  170500. update7[key] = true;
  170501. let movement = aggregator._movement[key];
  170502. if (!defined_default(movement)) {
  170503. movement = aggregator._movement[key] = {};
  170504. }
  170505. movement.startPosition = new Cartesian2_default();
  170506. movement.endPosition = new Cartesian2_default();
  170507. aggregator._eventHandler.setInputAction(
  170508. function(delta) {
  170509. const arcLength = 15 * Math_default.toRadians(delta);
  170510. if (!update7[key]) {
  170511. movement.endPosition.y = movement.endPosition.y + arcLength;
  170512. } else {
  170513. Cartesian2_default.clone(Cartesian2_default.ZERO, movement.startPosition);
  170514. movement.endPosition.x = 0;
  170515. movement.endPosition.y = arcLength;
  170516. update7[key] = false;
  170517. }
  170518. },
  170519. ScreenSpaceEventType_default.WHEEL,
  170520. modifier
  170521. );
  170522. }
  170523. function listenMouseButtonDownUp(aggregator, modifier, type) {
  170524. const key = getKey(type, modifier);
  170525. const isDown = aggregator._isDown;
  170526. const eventStartPosition = aggregator._eventStartPosition;
  170527. const pressTime = aggregator._pressTime;
  170528. const releaseTime = aggregator._releaseTime;
  170529. isDown[key] = false;
  170530. eventStartPosition[key] = new Cartesian2_default();
  170531. let lastMovement = aggregator._lastMovement[key];
  170532. if (!defined_default(lastMovement)) {
  170533. lastMovement = aggregator._lastMovement[key] = {
  170534. startPosition: new Cartesian2_default(),
  170535. endPosition: new Cartesian2_default(),
  170536. valid: false
  170537. };
  170538. }
  170539. let down;
  170540. let up;
  170541. if (type === CameraEventType_default.LEFT_DRAG) {
  170542. down = ScreenSpaceEventType_default.LEFT_DOWN;
  170543. up = ScreenSpaceEventType_default.LEFT_UP;
  170544. } else if (type === CameraEventType_default.RIGHT_DRAG) {
  170545. down = ScreenSpaceEventType_default.RIGHT_DOWN;
  170546. up = ScreenSpaceEventType_default.RIGHT_UP;
  170547. } else if (type === CameraEventType_default.MIDDLE_DRAG) {
  170548. down = ScreenSpaceEventType_default.MIDDLE_DOWN;
  170549. up = ScreenSpaceEventType_default.MIDDLE_UP;
  170550. }
  170551. aggregator._eventHandler.setInputAction(
  170552. function(event) {
  170553. aggregator._buttonsDown++;
  170554. lastMovement.valid = false;
  170555. isDown[key] = true;
  170556. pressTime[key] = new Date();
  170557. Cartesian2_default.clone(event.position, eventStartPosition[key]);
  170558. },
  170559. down,
  170560. modifier
  170561. );
  170562. aggregator._eventHandler.setInputAction(
  170563. function() {
  170564. aggregator._buttonsDown = Math.max(aggregator._buttonsDown - 1, 0);
  170565. isDown[key] = false;
  170566. releaseTime[key] = new Date();
  170567. },
  170568. up,
  170569. modifier
  170570. );
  170571. }
  170572. function cloneMouseMovement(mouseMovement, result) {
  170573. Cartesian2_default.clone(mouseMovement.startPosition, result.startPosition);
  170574. Cartesian2_default.clone(mouseMovement.endPosition, result.endPosition);
  170575. }
  170576. function listenMouseMove(aggregator, modifier) {
  170577. const update7 = aggregator._update;
  170578. const movement = aggregator._movement;
  170579. const lastMovement = aggregator._lastMovement;
  170580. const isDown = aggregator._isDown;
  170581. for (const typeName in CameraEventType_default) {
  170582. if (CameraEventType_default.hasOwnProperty(typeName)) {
  170583. const type = CameraEventType_default[typeName];
  170584. if (defined_default(type)) {
  170585. const key = getKey(type, modifier);
  170586. update7[key] = true;
  170587. if (!defined_default(aggregator._lastMovement[key])) {
  170588. aggregator._lastMovement[key] = {
  170589. startPosition: new Cartesian2_default(),
  170590. endPosition: new Cartesian2_default(),
  170591. valid: false
  170592. };
  170593. }
  170594. if (!defined_default(aggregator._movement[key])) {
  170595. aggregator._movement[key] = {
  170596. startPosition: new Cartesian2_default(),
  170597. endPosition: new Cartesian2_default()
  170598. };
  170599. }
  170600. }
  170601. }
  170602. }
  170603. aggregator._eventHandler.setInputAction(
  170604. function(mouseMovement) {
  170605. for (const typeName in CameraEventType_default) {
  170606. if (CameraEventType_default.hasOwnProperty(typeName)) {
  170607. const type = CameraEventType_default[typeName];
  170608. if (defined_default(type)) {
  170609. const key = getKey(type, modifier);
  170610. if (isDown[key]) {
  170611. if (!update7[key]) {
  170612. Cartesian2_default.clone(
  170613. mouseMovement.endPosition,
  170614. movement[key].endPosition
  170615. );
  170616. } else {
  170617. cloneMouseMovement(movement[key], lastMovement[key]);
  170618. lastMovement[key].valid = true;
  170619. cloneMouseMovement(mouseMovement, movement[key]);
  170620. update7[key] = false;
  170621. }
  170622. }
  170623. }
  170624. }
  170625. }
  170626. Cartesian2_default.clone(
  170627. mouseMovement.endPosition,
  170628. aggregator._currentMousePosition
  170629. );
  170630. },
  170631. ScreenSpaceEventType_default.MOUSE_MOVE,
  170632. modifier
  170633. );
  170634. }
  170635. function CameraEventAggregator(canvas) {
  170636. if (!defined_default(canvas)) {
  170637. throw new DeveloperError_default("canvas is required.");
  170638. }
  170639. this._eventHandler = new ScreenSpaceEventHandler_default(canvas);
  170640. this._update = {};
  170641. this._movement = {};
  170642. this._lastMovement = {};
  170643. this._isDown = {};
  170644. this._eventStartPosition = {};
  170645. this._pressTime = {};
  170646. this._releaseTime = {};
  170647. this._buttonsDown = 0;
  170648. this._currentMousePosition = new Cartesian2_default();
  170649. listenToWheel(this, void 0);
  170650. listenToPinch(this, void 0, canvas);
  170651. listenMouseButtonDownUp(this, void 0, CameraEventType_default.LEFT_DRAG);
  170652. listenMouseButtonDownUp(this, void 0, CameraEventType_default.RIGHT_DRAG);
  170653. listenMouseButtonDownUp(this, void 0, CameraEventType_default.MIDDLE_DRAG);
  170654. listenMouseMove(this, void 0);
  170655. for (const modifierName in KeyboardEventModifier_default) {
  170656. if (KeyboardEventModifier_default.hasOwnProperty(modifierName)) {
  170657. const modifier = KeyboardEventModifier_default[modifierName];
  170658. if (defined_default(modifier)) {
  170659. listenToWheel(this, modifier);
  170660. listenToPinch(this, modifier, canvas);
  170661. listenMouseButtonDownUp(this, modifier, CameraEventType_default.LEFT_DRAG);
  170662. listenMouseButtonDownUp(this, modifier, CameraEventType_default.RIGHT_DRAG);
  170663. listenMouseButtonDownUp(this, modifier, CameraEventType_default.MIDDLE_DRAG);
  170664. listenMouseMove(this, modifier);
  170665. }
  170666. }
  170667. }
  170668. }
  170669. Object.defineProperties(CameraEventAggregator.prototype, {
  170670. currentMousePosition: {
  170671. get: function() {
  170672. return this._currentMousePosition;
  170673. }
  170674. },
  170675. anyButtonDown: {
  170676. get: function() {
  170677. const wheelMoved = !this._update[getKey(CameraEventType_default.WHEEL)] || !this._update[getKey(CameraEventType_default.WHEEL, KeyboardEventModifier_default.SHIFT)] || !this._update[getKey(CameraEventType_default.WHEEL, KeyboardEventModifier_default.CTRL)] || !this._update[getKey(CameraEventType_default.WHEEL, KeyboardEventModifier_default.ALT)];
  170678. return this._buttonsDown > 0 || wheelMoved;
  170679. }
  170680. }
  170681. });
  170682. CameraEventAggregator.prototype.isMoving = function(type, modifier) {
  170683. if (!defined_default(type)) {
  170684. throw new DeveloperError_default("type is required.");
  170685. }
  170686. const key = getKey(type, modifier);
  170687. return !this._update[key];
  170688. };
  170689. CameraEventAggregator.prototype.getMovement = function(type, modifier) {
  170690. if (!defined_default(type)) {
  170691. throw new DeveloperError_default("type is required.");
  170692. }
  170693. const key = getKey(type, modifier);
  170694. const movement = this._movement[key];
  170695. return movement;
  170696. };
  170697. CameraEventAggregator.prototype.getLastMovement = function(type, modifier) {
  170698. if (!defined_default(type)) {
  170699. throw new DeveloperError_default("type is required.");
  170700. }
  170701. const key = getKey(type, modifier);
  170702. const lastMovement = this._lastMovement[key];
  170703. if (lastMovement.valid) {
  170704. return lastMovement;
  170705. }
  170706. return void 0;
  170707. };
  170708. CameraEventAggregator.prototype.isButtonDown = function(type, modifier) {
  170709. if (!defined_default(type)) {
  170710. throw new DeveloperError_default("type is required.");
  170711. }
  170712. const key = getKey(type, modifier);
  170713. return this._isDown[key];
  170714. };
  170715. CameraEventAggregator.prototype.getStartMousePosition = function(type, modifier) {
  170716. if (!defined_default(type)) {
  170717. throw new DeveloperError_default("type is required.");
  170718. }
  170719. if (type === CameraEventType_default.WHEEL) {
  170720. return this._currentMousePosition;
  170721. }
  170722. const key = getKey(type, modifier);
  170723. return this._eventStartPosition[key];
  170724. };
  170725. CameraEventAggregator.prototype.getButtonPressTime = function(type, modifier) {
  170726. if (!defined_default(type)) {
  170727. throw new DeveloperError_default("type is required.");
  170728. }
  170729. const key = getKey(type, modifier);
  170730. return this._pressTime[key];
  170731. };
  170732. CameraEventAggregator.prototype.getButtonReleaseTime = function(type, modifier) {
  170733. if (!defined_default(type)) {
  170734. throw new DeveloperError_default("type is required.");
  170735. }
  170736. const key = getKey(type, modifier);
  170737. return this._releaseTime[key];
  170738. };
  170739. CameraEventAggregator.prototype.reset = function() {
  170740. for (const name in this._update) {
  170741. if (this._update.hasOwnProperty(name)) {
  170742. this._update[name] = true;
  170743. }
  170744. }
  170745. };
  170746. CameraEventAggregator.prototype.isDestroyed = function() {
  170747. return false;
  170748. };
  170749. CameraEventAggregator.prototype.destroy = function() {
  170750. this._eventHandler = this._eventHandler && this._eventHandler.destroy();
  170751. return destroyObject_default(this);
  170752. };
  170753. var CameraEventAggregator_default = CameraEventAggregator;
  170754. // node_modules/cesium/Source/Scene/Cesium3DTileContent.js
  170755. function Cesium3DTileContent() {
  170756. this.featurePropertiesDirty = false;
  170757. }
  170758. Object.defineProperties(Cesium3DTileContent.prototype, {
  170759. featuresLength: {
  170760. get: function() {
  170761. DeveloperError_default.throwInstantiationError();
  170762. }
  170763. },
  170764. pointsLength: {
  170765. get: function() {
  170766. DeveloperError_default.throwInstantiationError();
  170767. }
  170768. },
  170769. trianglesLength: {
  170770. get: function() {
  170771. DeveloperError_default.throwInstantiationError();
  170772. }
  170773. },
  170774. geometryByteLength: {
  170775. get: function() {
  170776. DeveloperError_default.throwInstantiationError();
  170777. }
  170778. },
  170779. texturesByteLength: {
  170780. get: function() {
  170781. DeveloperError_default.throwInstantiationError();
  170782. }
  170783. },
  170784. batchTableByteLength: {
  170785. get: function() {
  170786. DeveloperError_default.throwInstantiationError();
  170787. }
  170788. },
  170789. innerContents: {
  170790. get: function() {
  170791. DeveloperError_default.throwInstantiationError();
  170792. }
  170793. },
  170794. readyPromise: {
  170795. get: function() {
  170796. DeveloperError_default.throwInstantiationError();
  170797. }
  170798. },
  170799. tileset: {
  170800. get: function() {
  170801. DeveloperError_default.throwInstantiationError();
  170802. }
  170803. },
  170804. tile: {
  170805. get: function() {
  170806. DeveloperError_default.throwInstantiationError();
  170807. }
  170808. },
  170809. url: {
  170810. get: function() {
  170811. DeveloperError_default.throwInstantiationError();
  170812. }
  170813. },
  170814. batchTable: {
  170815. get: function() {
  170816. DeveloperError_default.throwInstantiationError();
  170817. }
  170818. },
  170819. metadata: {
  170820. get: function() {
  170821. DeveloperError_default.throwInstantiationError();
  170822. },
  170823. set: function(value) {
  170824. DeveloperError_default.throwInstantiationError();
  170825. }
  170826. },
  170827. group: {
  170828. get: function() {
  170829. DeveloperError_default.throwInstantiationError();
  170830. },
  170831. set: function(value) {
  170832. DeveloperError_default.throwInstantiationError();
  170833. }
  170834. }
  170835. });
  170836. Cesium3DTileContent.prototype.hasProperty = function(batchId, name) {
  170837. DeveloperError_default.throwInstantiationError();
  170838. };
  170839. Cesium3DTileContent.prototype.getFeature = function(batchId) {
  170840. DeveloperError_default.throwInstantiationError();
  170841. };
  170842. Cesium3DTileContent.prototype.applyDebugSettings = function(enabled, color) {
  170843. DeveloperError_default.throwInstantiationError();
  170844. };
  170845. Cesium3DTileContent.prototype.applyStyle = function(style) {
  170846. DeveloperError_default.throwInstantiationError();
  170847. };
  170848. Cesium3DTileContent.prototype.update = function(tileset, frameState) {
  170849. DeveloperError_default.throwInstantiationError();
  170850. };
  170851. Cesium3DTileContent.prototype.isDestroyed = function() {
  170852. DeveloperError_default.throwInstantiationError();
  170853. };
  170854. Cesium3DTileContent.prototype.destroy = function() {
  170855. DeveloperError_default.throwInstantiationError();
  170856. };
  170857. var Cesium3DTileContent_default = Cesium3DTileContent;
  170858. // node_modules/cesium/Source/Scene/Cesium3DTilePassState.js
  170859. function Cesium3DTilePassState(options) {
  170860. Check_default.typeOf.object("options", options);
  170861. Check_default.typeOf.number("options.pass", options.pass);
  170862. this.pass = options.pass;
  170863. this.commandList = options.commandList;
  170864. this.camera = options.camera;
  170865. this.cullingVolume = options.cullingVolume;
  170866. this.ready = false;
  170867. }
  170868. var Cesium3DTilePassState_default = Cesium3DTilePassState;
  170869. // node_modules/cesium/Source/Scene/ConditionsExpression.js
  170870. function ConditionsExpression(conditionsExpression, defines) {
  170871. this._conditionsExpression = clone_default(conditionsExpression, true);
  170872. this._conditions = conditionsExpression.conditions;
  170873. this._runtimeConditions = void 0;
  170874. setRuntime(this, defines);
  170875. }
  170876. Object.defineProperties(ConditionsExpression.prototype, {
  170877. conditionsExpression: {
  170878. get: function() {
  170879. return this._conditionsExpression;
  170880. }
  170881. }
  170882. });
  170883. function Statement(condition, expression) {
  170884. this.condition = condition;
  170885. this.expression = expression;
  170886. }
  170887. function setRuntime(expression, defines) {
  170888. const runtimeConditions = [];
  170889. const conditions = expression._conditions;
  170890. if (!defined_default(conditions)) {
  170891. return;
  170892. }
  170893. const length3 = conditions.length;
  170894. for (let i2 = 0; i2 < length3; ++i2) {
  170895. const statement = conditions[i2];
  170896. const cond = String(statement[0]);
  170897. const condExpression = String(statement[1]);
  170898. runtimeConditions.push(
  170899. new Statement(
  170900. new Expression_default(cond, defines),
  170901. new Expression_default(condExpression, defines)
  170902. )
  170903. );
  170904. }
  170905. expression._runtimeConditions = runtimeConditions;
  170906. }
  170907. ConditionsExpression.prototype.evaluate = function(feature2, result) {
  170908. const conditions = this._runtimeConditions;
  170909. if (!defined_default(conditions)) {
  170910. return void 0;
  170911. }
  170912. const length3 = conditions.length;
  170913. for (let i2 = 0; i2 < length3; ++i2) {
  170914. const statement = conditions[i2];
  170915. if (statement.condition.evaluate(feature2)) {
  170916. return statement.expression.evaluate(feature2, result);
  170917. }
  170918. }
  170919. };
  170920. ConditionsExpression.prototype.evaluateColor = function(feature2, result) {
  170921. const conditions = this._runtimeConditions;
  170922. if (!defined_default(conditions)) {
  170923. return void 0;
  170924. }
  170925. const length3 = conditions.length;
  170926. for (let i2 = 0; i2 < length3; ++i2) {
  170927. const statement = conditions[i2];
  170928. if (statement.condition.evaluate(feature2)) {
  170929. return statement.expression.evaluateColor(feature2, result);
  170930. }
  170931. }
  170932. };
  170933. ConditionsExpression.prototype.getShaderFunction = function(functionSignature, variableSubstitutionMap, shaderState, returnType) {
  170934. const conditions = this._runtimeConditions;
  170935. if (!defined_default(conditions) || conditions.length === 0) {
  170936. return void 0;
  170937. }
  170938. let shaderFunction = "";
  170939. const length3 = conditions.length;
  170940. for (let i2 = 0; i2 < length3; ++i2) {
  170941. const statement = conditions[i2];
  170942. const condition = statement.condition.getShaderExpression(
  170943. variableSubstitutionMap,
  170944. shaderState
  170945. );
  170946. const expression = statement.expression.getShaderExpression(
  170947. variableSubstitutionMap,
  170948. shaderState
  170949. );
  170950. shaderFunction += ` ${i2 === 0 ? "if" : "else if"} (${condition})
  170951. {
  170952. return ${expression};
  170953. }
  170954. `;
  170955. }
  170956. shaderFunction = `${returnType} ${functionSignature}
  170957. {
  170958. ${shaderFunction} return ${returnType}(1.0);
  170959. }
  170960. `;
  170961. return shaderFunction;
  170962. };
  170963. ConditionsExpression.prototype.getVariables = function() {
  170964. let variables = [];
  170965. const conditions = this._runtimeConditions;
  170966. if (!defined_default(conditions) || conditions.length === 0) {
  170967. return variables;
  170968. }
  170969. const length3 = conditions.length;
  170970. for (let i2 = 0; i2 < length3; ++i2) {
  170971. const statement = conditions[i2];
  170972. variables.push.apply(variables, statement.condition.getVariables());
  170973. variables.push.apply(variables, statement.expression.getVariables());
  170974. }
  170975. variables = variables.filter(function(variable, index2, variables2) {
  170976. return variables2.indexOf(variable) === index2;
  170977. });
  170978. return variables;
  170979. };
  170980. var ConditionsExpression_default = ConditionsExpression;
  170981. // node_modules/cesium/Source/Scene/Cesium3DTileStyle.js
  170982. function Cesium3DTileStyle(style) {
  170983. this._style = {};
  170984. this._ready = false;
  170985. this._show = void 0;
  170986. this._color = void 0;
  170987. this._pointSize = void 0;
  170988. this._pointOutlineColor = void 0;
  170989. this._pointOutlineWidth = void 0;
  170990. this._labelColor = void 0;
  170991. this._labelOutlineColor = void 0;
  170992. this._labelOutlineWidth = void 0;
  170993. this._font = void 0;
  170994. this._labelStyle = void 0;
  170995. this._labelText = void 0;
  170996. this._backgroundColor = void 0;
  170997. this._backgroundPadding = void 0;
  170998. this._backgroundEnabled = void 0;
  170999. this._scaleByDistance = void 0;
  171000. this._translucencyByDistance = void 0;
  171001. this._distanceDisplayCondition = void 0;
  171002. this._heightOffset = void 0;
  171003. this._anchorLineEnabled = void 0;
  171004. this._anchorLineColor = void 0;
  171005. this._image = void 0;
  171006. this._disableDepthTestDistance = void 0;
  171007. this._horizontalOrigin = void 0;
  171008. this._verticalOrigin = void 0;
  171009. this._labelHorizontalOrigin = void 0;
  171010. this._labelVerticalOrigin = void 0;
  171011. this._meta = void 0;
  171012. this._colorShaderFunction = void 0;
  171013. this._showShaderFunction = void 0;
  171014. this._pointSizeShaderFunction = void 0;
  171015. this._colorShaderFunctionReady = false;
  171016. this._showShaderFunctionReady = false;
  171017. this._pointSizeShaderFunctionReady = false;
  171018. this._colorShaderTranslucent = false;
  171019. let promise;
  171020. if (typeof style === "string" || style instanceof Resource_default) {
  171021. const resource = Resource_default.createIfNeeded(style);
  171022. promise = resource.fetchJson(style);
  171023. } else {
  171024. promise = Promise.resolve(style);
  171025. }
  171026. const that = this;
  171027. this._readyPromise = promise.then(function(styleJson) {
  171028. setup(that, styleJson);
  171029. return that;
  171030. });
  171031. }
  171032. function setup(that, styleJson) {
  171033. styleJson = defaultValue_default(clone_default(styleJson, true), that._style);
  171034. that._style = styleJson;
  171035. that.show = styleJson.show;
  171036. that.color = styleJson.color;
  171037. that.pointSize = styleJson.pointSize;
  171038. that.pointOutlineColor = styleJson.pointOutlineColor;
  171039. that.pointOutlineWidth = styleJson.pointOutlineWidth;
  171040. that.labelColor = styleJson.labelColor;
  171041. that.labelOutlineColor = styleJson.labelOutlineColor;
  171042. that.labelOutlineWidth = styleJson.labelOutlineWidth;
  171043. that.labelStyle = styleJson.labelStyle;
  171044. that.font = styleJson.font;
  171045. that.labelText = styleJson.labelText;
  171046. that.backgroundColor = styleJson.backgroundColor;
  171047. that.backgroundPadding = styleJson.backgroundPadding;
  171048. that.backgroundEnabled = styleJson.backgroundEnabled;
  171049. that.scaleByDistance = styleJson.scaleByDistance;
  171050. that.translucencyByDistance = styleJson.translucencyByDistance;
  171051. that.distanceDisplayCondition = styleJson.distanceDisplayCondition;
  171052. that.heightOffset = styleJson.heightOffset;
  171053. that.anchorLineEnabled = styleJson.anchorLineEnabled;
  171054. that.anchorLineColor = styleJson.anchorLineColor;
  171055. that.image = styleJson.image;
  171056. that.disableDepthTestDistance = styleJson.disableDepthTestDistance;
  171057. that.horizontalOrigin = styleJson.horizontalOrigin;
  171058. that.verticalOrigin = styleJson.verticalOrigin;
  171059. that.labelHorizontalOrigin = styleJson.labelHorizontalOrigin;
  171060. that.labelVerticalOrigin = styleJson.labelVerticalOrigin;
  171061. const meta = {};
  171062. if (defined_default(styleJson.meta)) {
  171063. const defines = styleJson.defines;
  171064. const metaJson = defaultValue_default(styleJson.meta, defaultValue_default.EMPTY_OBJECT);
  171065. for (const property in metaJson) {
  171066. if (metaJson.hasOwnProperty(property)) {
  171067. meta[property] = new Expression_default(metaJson[property], defines);
  171068. }
  171069. }
  171070. }
  171071. that._meta = meta;
  171072. that._ready = true;
  171073. }
  171074. function getExpression(tileStyle, value) {
  171075. const defines = defaultValue_default(tileStyle._style, defaultValue_default.EMPTY_OBJECT).defines;
  171076. if (!defined_default(value)) {
  171077. return void 0;
  171078. } else if (typeof value === "boolean" || typeof value === "number") {
  171079. return new Expression_default(String(value));
  171080. } else if (typeof value === "string") {
  171081. return new Expression_default(value, defines);
  171082. } else if (defined_default(value.conditions)) {
  171083. return new ConditionsExpression_default(value, defines);
  171084. }
  171085. return value;
  171086. }
  171087. function getJsonFromExpression(expression) {
  171088. if (!defined_default(expression)) {
  171089. return void 0;
  171090. } else if (defined_default(expression.expression)) {
  171091. return expression.expression;
  171092. } else if (defined_default(expression.conditionsExpression)) {
  171093. return clone_default(expression.conditionsExpression, true);
  171094. }
  171095. return expression;
  171096. }
  171097. Object.defineProperties(Cesium3DTileStyle.prototype, {
  171098. style: {
  171099. get: function() {
  171100. if (!this._ready) {
  171101. throw new DeveloperError_default(
  171102. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171103. );
  171104. }
  171105. return this._style;
  171106. }
  171107. },
  171108. ready: {
  171109. get: function() {
  171110. return this._ready;
  171111. }
  171112. },
  171113. readyPromise: {
  171114. get: function() {
  171115. return this._readyPromise;
  171116. }
  171117. },
  171118. show: {
  171119. get: function() {
  171120. if (!this._ready) {
  171121. throw new DeveloperError_default(
  171122. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171123. );
  171124. }
  171125. return this._show;
  171126. },
  171127. set: function(value) {
  171128. this._show = getExpression(this, value);
  171129. this._style.show = getJsonFromExpression(this._show);
  171130. this._showShaderFunctionReady = false;
  171131. }
  171132. },
  171133. color: {
  171134. get: function() {
  171135. if (!this._ready) {
  171136. throw new DeveloperError_default(
  171137. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171138. );
  171139. }
  171140. return this._color;
  171141. },
  171142. set: function(value) {
  171143. this._color = getExpression(this, value);
  171144. this._style.color = getJsonFromExpression(this._color);
  171145. this._colorShaderFunctionReady = false;
  171146. }
  171147. },
  171148. pointSize: {
  171149. get: function() {
  171150. if (!this._ready) {
  171151. throw new DeveloperError_default(
  171152. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171153. );
  171154. }
  171155. return this._pointSize;
  171156. },
  171157. set: function(value) {
  171158. this._pointSize = getExpression(this, value);
  171159. this._style.pointSize = getJsonFromExpression(this._pointSize);
  171160. this._pointSizeShaderFunctionReady = false;
  171161. }
  171162. },
  171163. pointOutlineColor: {
  171164. get: function() {
  171165. if (!this._ready) {
  171166. throw new DeveloperError_default(
  171167. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171168. );
  171169. }
  171170. return this._pointOutlineColor;
  171171. },
  171172. set: function(value) {
  171173. this._pointOutlineColor = getExpression(this, value);
  171174. this._style.pointOutlineColor = getJsonFromExpression(
  171175. this._pointOutlineColor
  171176. );
  171177. }
  171178. },
  171179. pointOutlineWidth: {
  171180. get: function() {
  171181. if (!this._ready) {
  171182. throw new DeveloperError_default(
  171183. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171184. );
  171185. }
  171186. return this._pointOutlineWidth;
  171187. },
  171188. set: function(value) {
  171189. this._pointOutlineWidth = getExpression(this, value);
  171190. this._style.pointOutlineWidth = getJsonFromExpression(
  171191. this._pointOutlineWidth
  171192. );
  171193. }
  171194. },
  171195. labelColor: {
  171196. get: function() {
  171197. if (!this._ready) {
  171198. throw new DeveloperError_default(
  171199. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171200. );
  171201. }
  171202. return this._labelColor;
  171203. },
  171204. set: function(value) {
  171205. this._labelColor = getExpression(this, value);
  171206. this._style.labelColor = getJsonFromExpression(this._labelColor);
  171207. }
  171208. },
  171209. labelOutlineColor: {
  171210. get: function() {
  171211. if (!this._ready) {
  171212. throw new DeveloperError_default(
  171213. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171214. );
  171215. }
  171216. return this._labelOutlineColor;
  171217. },
  171218. set: function(value) {
  171219. this._labelOutlineColor = getExpression(this, value);
  171220. this._style.labelOutlineColor = getJsonFromExpression(
  171221. this._labelOutlineColor
  171222. );
  171223. }
  171224. },
  171225. labelOutlineWidth: {
  171226. get: function() {
  171227. if (!this._ready) {
  171228. throw new DeveloperError_default(
  171229. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171230. );
  171231. }
  171232. return this._labelOutlineWidth;
  171233. },
  171234. set: function(value) {
  171235. this._labelOutlineWidth = getExpression(this, value);
  171236. this._style.labelOutlineWidth = getJsonFromExpression(
  171237. this._labelOutlineWidth
  171238. );
  171239. }
  171240. },
  171241. font: {
  171242. get: function() {
  171243. if (!this._ready) {
  171244. throw new DeveloperError_default(
  171245. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171246. );
  171247. }
  171248. return this._font;
  171249. },
  171250. set: function(value) {
  171251. this._font = getExpression(this, value);
  171252. this._style.font = getJsonFromExpression(this._font);
  171253. }
  171254. },
  171255. labelStyle: {
  171256. get: function() {
  171257. if (!this._ready) {
  171258. throw new DeveloperError_default(
  171259. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171260. );
  171261. }
  171262. return this._labelStyle;
  171263. },
  171264. set: function(value) {
  171265. this._labelStyle = getExpression(this, value);
  171266. this._style.labelStyle = getJsonFromExpression(this._labelStyle);
  171267. }
  171268. },
  171269. labelText: {
  171270. get: function() {
  171271. if (!this._ready) {
  171272. throw new DeveloperError_default(
  171273. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171274. );
  171275. }
  171276. return this._labelText;
  171277. },
  171278. set: function(value) {
  171279. this._labelText = getExpression(this, value);
  171280. this._style.labelText = getJsonFromExpression(this._labelText);
  171281. }
  171282. },
  171283. backgroundColor: {
  171284. get: function() {
  171285. if (!this._ready) {
  171286. throw new DeveloperError_default(
  171287. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171288. );
  171289. }
  171290. return this._backgroundColor;
  171291. },
  171292. set: function(value) {
  171293. this._backgroundColor = getExpression(this, value);
  171294. this._style.backgroundColor = getJsonFromExpression(
  171295. this._backgroundColor
  171296. );
  171297. }
  171298. },
  171299. backgroundPadding: {
  171300. get: function() {
  171301. if (!this._ready) {
  171302. throw new DeveloperError_default(
  171303. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171304. );
  171305. }
  171306. return this._backgroundPadding;
  171307. },
  171308. set: function(value) {
  171309. this._backgroundPadding = getExpression(this, value);
  171310. this._style.backgroundPadding = getJsonFromExpression(
  171311. this._backgroundPadding
  171312. );
  171313. }
  171314. },
  171315. backgroundEnabled: {
  171316. get: function() {
  171317. if (!this._ready) {
  171318. throw new DeveloperError_default(
  171319. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171320. );
  171321. }
  171322. return this._backgroundEnabled;
  171323. },
  171324. set: function(value) {
  171325. this._backgroundEnabled = getExpression(this, value);
  171326. this._style.backgroundEnabled = getJsonFromExpression(
  171327. this._backgroundEnabled
  171328. );
  171329. }
  171330. },
  171331. scaleByDistance: {
  171332. get: function() {
  171333. if (!this._ready) {
  171334. throw new DeveloperError_default(
  171335. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171336. );
  171337. }
  171338. return this._scaleByDistance;
  171339. },
  171340. set: function(value) {
  171341. this._scaleByDistance = getExpression(this, value);
  171342. this._style.scaleByDistance = getJsonFromExpression(
  171343. this._scaleByDistance
  171344. );
  171345. }
  171346. },
  171347. translucencyByDistance: {
  171348. get: function() {
  171349. if (!this._ready) {
  171350. throw new DeveloperError_default(
  171351. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171352. );
  171353. }
  171354. return this._translucencyByDistance;
  171355. },
  171356. set: function(value) {
  171357. this._translucencyByDistance = getExpression(this, value);
  171358. this._style.translucencyByDistance = getJsonFromExpression(
  171359. this._translucencyByDistance
  171360. );
  171361. }
  171362. },
  171363. distanceDisplayCondition: {
  171364. get: function() {
  171365. if (!this._ready) {
  171366. throw new DeveloperError_default(
  171367. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171368. );
  171369. }
  171370. return this._distanceDisplayCondition;
  171371. },
  171372. set: function(value) {
  171373. this._distanceDisplayCondition = getExpression(this, value);
  171374. this._style.distanceDisplayCondition = getJsonFromExpression(
  171375. this._distanceDisplayCondition
  171376. );
  171377. }
  171378. },
  171379. heightOffset: {
  171380. get: function() {
  171381. if (!this._ready) {
  171382. throw new DeveloperError_default(
  171383. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171384. );
  171385. }
  171386. return this._heightOffset;
  171387. },
  171388. set: function(value) {
  171389. this._heightOffset = getExpression(this, value);
  171390. this._style.heightOffset = getJsonFromExpression(this._heightOffset);
  171391. }
  171392. },
  171393. anchorLineEnabled: {
  171394. get: function() {
  171395. if (!this._ready) {
  171396. throw new DeveloperError_default(
  171397. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171398. );
  171399. }
  171400. return this._anchorLineEnabled;
  171401. },
  171402. set: function(value) {
  171403. this._anchorLineEnabled = getExpression(this, value);
  171404. this._style.anchorLineEnabled = getJsonFromExpression(
  171405. this._anchorLineEnabled
  171406. );
  171407. }
  171408. },
  171409. anchorLineColor: {
  171410. get: function() {
  171411. if (!this._ready) {
  171412. throw new DeveloperError_default(
  171413. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171414. );
  171415. }
  171416. return this._anchorLineColor;
  171417. },
  171418. set: function(value) {
  171419. this._anchorLineColor = getExpression(this, value);
  171420. this._style.anchorLineColor = getJsonFromExpression(
  171421. this._anchorLineColor
  171422. );
  171423. }
  171424. },
  171425. image: {
  171426. get: function() {
  171427. if (!this._ready) {
  171428. throw new DeveloperError_default(
  171429. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171430. );
  171431. }
  171432. return this._image;
  171433. },
  171434. set: function(value) {
  171435. this._image = getExpression(this, value);
  171436. this._style.image = getJsonFromExpression(this._image);
  171437. }
  171438. },
  171439. disableDepthTestDistance: {
  171440. get: function() {
  171441. if (!this._ready) {
  171442. throw new DeveloperError_default(
  171443. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171444. );
  171445. }
  171446. return this._disableDepthTestDistance;
  171447. },
  171448. set: function(value) {
  171449. this._disableDepthTestDistance = getExpression(this, value);
  171450. this._style.disableDepthTestDistance = getJsonFromExpression(
  171451. this._disableDepthTestDistance
  171452. );
  171453. }
  171454. },
  171455. horizontalOrigin: {
  171456. get: function() {
  171457. if (!this._ready) {
  171458. throw new DeveloperError_default(
  171459. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171460. );
  171461. }
  171462. return this._horizontalOrigin;
  171463. },
  171464. set: function(value) {
  171465. this._horizontalOrigin = getExpression(this, value);
  171466. this._style.horizontalOrigin = getJsonFromExpression(
  171467. this._horizontalOrigin
  171468. );
  171469. }
  171470. },
  171471. verticalOrigin: {
  171472. get: function() {
  171473. if (!this._ready) {
  171474. throw new DeveloperError_default(
  171475. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171476. );
  171477. }
  171478. return this._verticalOrigin;
  171479. },
  171480. set: function(value) {
  171481. this._verticalOrigin = getExpression(this, value);
  171482. this._style.verticalOrigin = getJsonFromExpression(this._verticalOrigin);
  171483. }
  171484. },
  171485. labelHorizontalOrigin: {
  171486. get: function() {
  171487. if (!this._ready) {
  171488. throw new DeveloperError_default(
  171489. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171490. );
  171491. }
  171492. return this._labelHorizontalOrigin;
  171493. },
  171494. set: function(value) {
  171495. this._labelHorizontalOrigin = getExpression(this, value);
  171496. this._style.labelHorizontalOrigin = getJsonFromExpression(
  171497. this._labelHorizontalOrigin
  171498. );
  171499. }
  171500. },
  171501. labelVerticalOrigin: {
  171502. get: function() {
  171503. if (!this._ready) {
  171504. throw new DeveloperError_default(
  171505. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171506. );
  171507. }
  171508. return this._labelVerticalOrigin;
  171509. },
  171510. set: function(value) {
  171511. this._labelVerticalOrigin = getExpression(this, value);
  171512. this._style.labelVerticalOrigin = getJsonFromExpression(
  171513. this._labelVerticalOrigin
  171514. );
  171515. }
  171516. },
  171517. meta: {
  171518. get: function() {
  171519. if (!this._ready) {
  171520. throw new DeveloperError_default(
  171521. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  171522. );
  171523. }
  171524. return this._meta;
  171525. },
  171526. set: function(value) {
  171527. this._meta = value;
  171528. }
  171529. }
  171530. });
  171531. Cesium3DTileStyle.prototype.getColorShaderFunction = function(functionSignature, variableSubstitutionMap, shaderState) {
  171532. if (this._colorShaderFunctionReady) {
  171533. shaderState.translucent = this._colorShaderTranslucent;
  171534. return this._colorShaderFunction;
  171535. }
  171536. this._colorShaderFunctionReady = true;
  171537. if (defined_default(this.color) && defined_default(this.color.getShaderFunction)) {
  171538. this._colorShaderFunction = this.color.getShaderFunction(
  171539. functionSignature,
  171540. variableSubstitutionMap,
  171541. shaderState,
  171542. "vec4"
  171543. );
  171544. } else {
  171545. this._colorShaderFunction = void 0;
  171546. }
  171547. this._colorShaderTranslucent = shaderState.translucent;
  171548. return this._colorShaderFunction;
  171549. };
  171550. Cesium3DTileStyle.prototype.getShowShaderFunction = function(functionSignature, variableSubstitutionMap, shaderState) {
  171551. if (this._showShaderFunctionReady) {
  171552. return this._showShaderFunction;
  171553. }
  171554. this._showShaderFunctionReady = true;
  171555. if (defined_default(this.show) && defined_default(this.show.getShaderFunction)) {
  171556. this._showShaderFunction = this.show.getShaderFunction(
  171557. functionSignature,
  171558. variableSubstitutionMap,
  171559. shaderState,
  171560. "bool"
  171561. );
  171562. } else {
  171563. this._showShaderFunction = void 0;
  171564. }
  171565. return this._showShaderFunction;
  171566. };
  171567. Cesium3DTileStyle.prototype.getPointSizeShaderFunction = function(functionSignature, variableSubstitutionMap, shaderState) {
  171568. if (this._pointSizeShaderFunctionReady) {
  171569. return this._pointSizeShaderFunction;
  171570. }
  171571. this._pointSizeShaderFunctionReady = true;
  171572. if (defined_default(this.pointSize) && defined_default(this.pointSize.getShaderFunction)) {
  171573. this._pointSizeShaderFunction = this.pointSize.getShaderFunction(
  171574. functionSignature,
  171575. variableSubstitutionMap,
  171576. shaderState,
  171577. "float"
  171578. );
  171579. } else {
  171580. this._pointSizeShaderFunction = void 0;
  171581. }
  171582. return this._pointSizeShaderFunction;
  171583. };
  171584. Cesium3DTileStyle.prototype.getVariables = function() {
  171585. let variables = [];
  171586. if (defined_default(this.color) && defined_default(this.color.getVariables)) {
  171587. variables.push.apply(variables, this.color.getVariables());
  171588. }
  171589. if (defined_default(this.show) && defined_default(this.show.getVariables)) {
  171590. variables.push.apply(variables, this.show.getVariables());
  171591. }
  171592. if (defined_default(this.pointSize) && defined_default(this.pointSize.getVariables)) {
  171593. variables.push.apply(variables, this.pointSize.getVariables());
  171594. }
  171595. variables = variables.filter(function(variable, index2, variables2) {
  171596. return variables2.indexOf(variable) === index2;
  171597. });
  171598. return variables;
  171599. };
  171600. var Cesium3DTileStyle_default = Cesium3DTileStyle;
  171601. // node_modules/cesium/Source/Scene/CircleEmitter.js
  171602. function CircleEmitter(radius) {
  171603. radius = defaultValue_default(radius, 1);
  171604. Check_default.typeOf.number.greaterThan("radius", radius, 0);
  171605. this._radius = defaultValue_default(radius, 1);
  171606. }
  171607. Object.defineProperties(CircleEmitter.prototype, {
  171608. radius: {
  171609. get: function() {
  171610. return this._radius;
  171611. },
  171612. set: function(value) {
  171613. Check_default.typeOf.number.greaterThan("value", value, 0);
  171614. this._radius = value;
  171615. }
  171616. }
  171617. });
  171618. CircleEmitter.prototype.emit = function(particle) {
  171619. const theta = Math_default.randomBetween(0, Math_default.TWO_PI);
  171620. const rad = Math_default.randomBetween(0, this._radius);
  171621. const x = rad * Math.cos(theta);
  171622. const y = rad * Math.sin(theta);
  171623. const z = 0;
  171624. particle.position = Cartesian3_default.fromElements(x, y, z, particle.position);
  171625. particle.velocity = Cartesian3_default.clone(Cartesian3_default.UNIT_Z, particle.velocity);
  171626. };
  171627. var CircleEmitter_default = CircleEmitter;
  171628. // node_modules/cesium/Source/Scene/CloudType.js
  171629. var CloudType = {
  171630. CUMULUS: 0
  171631. };
  171632. CloudType.validate = function(cloudType) {
  171633. return cloudType === CloudType.CUMULUS;
  171634. };
  171635. var CloudType_default = Object.freeze(CloudType);
  171636. // node_modules/cesium/Source/Shaders/CloudCollectionFS.js
  171637. var CloudCollectionFS_default = `uniform sampler2D u_noiseTexture;
  171638. uniform vec3 u_noiseTextureDimensions;
  171639. uniform float u_noiseDetail;
  171640. varying vec2 v_offset;
  171641. varying vec3 v_maximumSize;
  171642. varying vec4 v_color;
  171643. varying float v_slice;
  171644. varying float v_brightness;
  171645. float wrap(float value, float rangeLength) {
  171646. if(value < 0.0) {
  171647. float absValue = abs(value);
  171648. float modValue = mod(absValue, rangeLength);
  171649. return mod(rangeLength - modValue, rangeLength);
  171650. }
  171651. return mod(value, rangeLength);
  171652. }
  171653. vec3 wrapVec(vec3 value, float rangeLength) {
  171654. return vec3(wrap(value.x, rangeLength),
  171655. wrap(value.y, rangeLength),
  171656. wrap(value.z, rangeLength));
  171657. }
  171658. float textureSliceWidth = u_noiseTextureDimensions.x;
  171659. float noiseTextureRows = u_noiseTextureDimensions.y;
  171660. float inverseNoiseTextureRows = u_noiseTextureDimensions.z;
  171661. float textureSliceWidthSquared = textureSliceWidth * textureSliceWidth;
  171662. vec2 inverseNoiseTextureDimensions = vec2(noiseTextureRows / textureSliceWidthSquared,
  171663. inverseNoiseTextureRows / textureSliceWidth);
  171664. vec2 voxelToUV(vec3 voxelIndex) {
  171665. vec3 wrappedIndex = wrapVec(voxelIndex, textureSliceWidth);
  171666. float column = mod(wrappedIndex.z, textureSliceWidth * inverseNoiseTextureRows);
  171667. float row = floor(wrappedIndex.z / textureSliceWidth * noiseTextureRows);
  171668. float xPixelCoord = wrappedIndex.x + column * textureSliceWidth;
  171669. float yPixelCoord = wrappedIndex.y + row * textureSliceWidth;
  171670. return vec2(xPixelCoord, yPixelCoord) * inverseNoiseTextureDimensions;
  171671. }
  171672. // Interpolate a voxel with its neighbor (along the positive X-axis)
  171673. vec4 lerpSamplesX(vec3 voxelIndex, float x) {
  171674. vec2 uv0 = voxelToUV(voxelIndex);
  171675. vec2 uv1 = voxelToUV(voxelIndex + vec3(1.0, 0.0, 0.0));
  171676. vec4 sample0 = texture2D(u_noiseTexture, uv0);
  171677. vec4 sample1 = texture2D(u_noiseTexture, uv1);
  171678. return mix(sample0, sample1, x);
  171679. }
  171680. vec4 sampleNoiseTexture(vec3 position) {
  171681. vec3 recenteredPos = position + vec3(textureSliceWidth / 2.0);
  171682. vec3 lerpValue = fract(recenteredPos);
  171683. vec3 voxelIndex = floor(recenteredPos);
  171684. vec4 xLerp00 = lerpSamplesX(voxelIndex, lerpValue.x);
  171685. vec4 xLerp01 = lerpSamplesX(voxelIndex + vec3(0.0, 0.0, 1.0), lerpValue.x);
  171686. vec4 xLerp10 = lerpSamplesX(voxelIndex + vec3(0.0, 1.0, 0.0), lerpValue.x);
  171687. vec4 xLerp11 = lerpSamplesX(voxelIndex + vec3(0.0, 1.0, 1.0), lerpValue.x);
  171688. vec4 yLerp0 = mix(xLerp00, xLerp10, lerpValue.y);
  171689. vec4 yLerp1 = mix(xLerp01, xLerp11, lerpValue.y);
  171690. return mix(yLerp0, yLerp1, lerpValue.z);
  171691. }
  171692. // Intersection with a unit sphere with radius 0.5 at center (0, 0, 0).
  171693. bool intersectSphere(vec3 origin, vec3 dir, float slice,
  171694. out vec3 point, out vec3 normal) {
  171695. float A = dot(dir, dir);
  171696. float B = dot(origin, dir);
  171697. float C = dot(origin, origin) - 0.25;
  171698. float discriminant = (B * B) - (A * C);
  171699. if(discriminant < 0.0) {
  171700. return false;
  171701. }
  171702. float root = sqrt(discriminant);
  171703. float t = (-B - root) / A;
  171704. if(t < 0.0) {
  171705. t = (-B + root) / A;
  171706. }
  171707. point = origin + t * dir;
  171708. if(slice >= 0.0) {
  171709. point.z = (slice / 2.0) - 0.5;
  171710. if(length(point) > 0.5) {
  171711. return false;
  171712. }
  171713. }
  171714. normal = normalize(point);
  171715. point -= czm_epsilon2 * normal;
  171716. return true;
  171717. }
  171718. // Transforms the ray origin and direction into unit sphere space,
  171719. // then transforms the result back into the ellipsoid's space.
  171720. bool intersectEllipsoid(vec3 origin, vec3 dir, vec3 center, vec3 scale, float slice,
  171721. out vec3 point, out vec3 normal) {
  171722. if(scale.x <= 0.01 || scale.y < 0.01 || scale.z < 0.01) {
  171723. return false;
  171724. }
  171725. vec3 o = (origin - center) / scale;
  171726. vec3 d = dir / scale;
  171727. vec3 p, n;
  171728. bool intersected = intersectSphere(o, d, slice, p, n);
  171729. if(intersected) {
  171730. point = (p * scale) + center;
  171731. normal = n;
  171732. }
  171733. return intersected;
  171734. }
  171735. // Assume that if phase shift is being called for octave i,
  171736. // the frequency is of i - 1. This saves us from doing extra
  171737. // division / multiplication operations.
  171738. vec2 phaseShift2D(vec2 p, vec2 freq) {
  171739. return (czm_pi / 2.0) * sin(freq.yx * p.yx);
  171740. }
  171741. vec2 phaseShift3D(vec3 p, vec2 freq) {
  171742. return phaseShift2D(p.xy, freq) + czm_pi * vec2(sin(freq.x * p.z));
  171743. }
  171744. // The cloud texture function derived from Gardner's 1985 paper,
  171745. // "Visual Simulation of Clouds."
  171746. // https://www.cs.drexel.edu/~david/Classes/Papers/p297-gardner.pdf
  171747. const float T0 = 0.6; // contrast of the texture pattern
  171748. const float k = 0.1; // computed to produce a maximum value of 1
  171749. const float C0 = 0.8; // coefficient
  171750. const float FX0 = 0.6; // frequency X
  171751. const float FY0 = 0.6; // frequency Y
  171752. const int octaves = 5;
  171753. float T(vec3 point) {
  171754. vec2 sum = vec2(0.0);
  171755. float Ci = C0;
  171756. vec2 FXY = vec2(FX0, FY0);
  171757. vec2 PXY = vec2(0.0);
  171758. for(int i = 1; i <= octaves; i++) {
  171759. PXY = phaseShift3D(point, FXY);
  171760. Ci *= 0.707;
  171761. FXY *= 2.0;
  171762. vec2 sinTerm = sin(FXY * point.xy + PXY);
  171763. sum += Ci * sinTerm + vec2(T0);
  171764. }
  171765. return k * sum.x * sum.y;
  171766. }
  171767. const float a = 0.5; // fraction of surface reflection due to ambient or scattered light,
  171768. const float t = 0.4; // fraction of texture shading
  171769. const float s = 0.25; // fraction of specular reflection
  171770. float I(float Id, float Is, float It) {
  171771. return (1.0 - a) * ((1.0 - t) * ((1.0 - s) * Id + s * Is) + t * It) + a;
  171772. }
  171773. const vec3 lightDir = normalize(vec3(0.2, -1.0, 0.7));
  171774. vec4 drawCloud(vec3 rayOrigin, vec3 rayDir, vec3 cloudCenter, vec3 cloudScale, float cloudSlice,
  171775. float brightness) {
  171776. vec3 cloudPoint, cloudNormal;
  171777. if(!intersectEllipsoid(rayOrigin, rayDir, cloudCenter, cloudScale, cloudSlice,
  171778. cloudPoint, cloudNormal)) {
  171779. return vec4(0.0);
  171780. }
  171781. float Id = clamp(dot(cloudNormal, -lightDir), 0.0, 1.0); // diffuse reflection
  171782. float Is = max(pow(dot(-lightDir, -rayDir), 2.0), 0.0); // specular reflection
  171783. float It = T(cloudPoint); // texture function
  171784. float intensity = I(Id, Is, It);
  171785. vec3 color = vec3(intensity * clamp(brightness, 0.1, 1.0));
  171786. vec4 noise = sampleNoiseTexture(u_noiseDetail * cloudPoint);
  171787. float W = noise.x;
  171788. float W2 = noise.y;
  171789. float W3 = noise.z;
  171790. // The dot product between the cloud's normal and the ray's direction is greatest
  171791. // in the center of the ellipsoid's surface. It decreases towards the edge.
  171792. // Thus, it is used to blur the areas leading to the edges of the ellipsoid,
  171793. // so that no harsh lines appear.
  171794. // The first (and biggest) layer of worley noise is then subtracted from this.
  171795. // The final result is scaled up so that the base cloud is not too translucent.
  171796. float ndDot = clamp(dot(cloudNormal, -rayDir), 0.0, 1.0);
  171797. float TR = pow(ndDot, 3.0) - W; // translucency
  171798. TR *= 1.3;
  171799. // Subtracting the second and third layers of worley noise is more complicated.
  171800. // If these layers of noise were simply subtracted from the current translucency,
  171801. // the shape derived from the first layer of noise would be completely deleted.
  171802. // The erosion of this noise should thus be constricted to the edges of the cloud.
  171803. // However, because the edges of the ellipsoid were already blurred away, mapping
  171804. // the noise to (1.0 - ndDot) will have no impact on most of the cloud's appearance.
  171805. // The value of (0.5 - ndDot) provides the best compromise.
  171806. float minusDot = 0.5 - ndDot;
  171807. // Even with the previous calculation, subtracting the second layer of wnoise
  171808. // erode too much of the cloud. The addition of it, however, will detailed
  171809. // volume to the cloud. As long as the noise is only added and not subtracted,
  171810. // the results are aesthetically pleasing.
  171811. // The minusDot product is mapped in a way that it is larger at the edges of
  171812. // the ellipsoid, so a subtraction and min operation are used instead of
  171813. // an addition and max one.
  171814. TR -= min(minusDot * W2, 0.0);
  171815. // The third level of worley noise is subtracted from the result, with some
  171816. // modifications. First, a scalar is added to minusDot so that the noise
  171817. // starts affecting the shape farther away from the center of the ellipsoid's
  171818. // surface. Then, it is scaled down so its impact is not too intense.
  171819. TR -= 0.8 * (minusDot + 0.25) * W3;
  171820. // The texture function's shading does not correlate with the shape of the cloud
  171821. // produced by the layers of noise, so an extra shading scalar is calculated.
  171822. // The darkest areas of the cloud are assigned to be where the noise erodes
  171823. // the cloud the most. This is then interpolated based on the translucency
  171824. // and the diffuse shading term of that point in the cloud.
  171825. float shading = mix(1.0 - 0.8 * W * W, 1.0, Id * TR);
  171826. // To avoid values that are too dark, this scalar is increased by a small amount
  171827. // and clamped so it never goes to zero.
  171828. shading = clamp(shading + 0.2, 0.3, 1.0);
  171829. // Finally, the contrast of the cloud's color is increased.
  171830. vec3 finalColor = mix(vec3(0.5), shading * color, 1.15);
  171831. return vec4(finalColor, clamp(TR, 0.0, 1.0)) * v_color;
  171832. }
  171833. void main() {
  171834. #ifdef DEBUG_BILLBOARDS
  171835. gl_FragColor = vec4(0.0, 0.5, 0.5, 1.0);
  171836. #endif
  171837. // To avoid calculations with high values,
  171838. // we raycast from an arbitrarily smaller space.
  171839. vec2 coordinate = v_maximumSize.xy * v_offset;
  171840. vec3 ellipsoidScale = 0.82 * v_maximumSize;
  171841. vec3 ellipsoidCenter = vec3(0.0);
  171842. float zOffset = max(ellipsoidScale.z - 10.0, 0.0);
  171843. vec3 eye = vec3(0, 0, -10.0 - zOffset);
  171844. vec3 rayDir = normalize(vec3(coordinate, 1.0) - eye);
  171845. vec3 rayOrigin = eye;
  171846. #ifdef DEBUG_ELLIPSOIDS
  171847. vec3 point, normal;
  171848. if(intersectEllipsoid(rayOrigin, rayDir, ellipsoidCenter, ellipsoidScale, v_slice,
  171849. point, normal)) {
  171850. gl_FragColor = v_brightness * v_color;
  171851. }
  171852. #else
  171853. #ifndef DEBUG_BILLBOARDS
  171854. vec4 cloud = drawCloud(rayOrigin, rayDir,
  171855. ellipsoidCenter, ellipsoidScale, v_slice, v_brightness);
  171856. if(cloud.w < 0.01) {
  171857. discard;
  171858. }
  171859. gl_FragColor = cloud;
  171860. #endif
  171861. #endif
  171862. }
  171863. `;
  171864. // node_modules/cesium/Source/Shaders/CloudCollectionVS.js
  171865. var CloudCollectionVS_default = "#ifdef INSTANCED\nattribute vec2 direction;\n#endif\nattribute vec4 positionHighAndScaleX;\nattribute vec4 positionLowAndScaleY;\nattribute vec4 packedAttribute0;\nattribute vec4 packedAttribute1;\nattribute vec4 color;\n\nvarying vec2 v_offset;\nvarying vec3 v_maximumSize;\nvarying vec4 v_color;\nvarying float v_slice;\nvarying float v_brightness;\n\nvoid main() {\n // Unpack attributes.\n vec3 positionHigh = positionHighAndScaleX.xyz;\n vec3 positionLow = positionLowAndScaleY.xyz;\n vec2 scale = vec2(positionHighAndScaleX.w, positionLowAndScaleY.w);\n\n float show = packedAttribute0.x;\n float brightness = packedAttribute0.y;\n vec2 coordinates = packedAttribute0.wz;\n vec3 maximumSize = packedAttribute1.xyz;\n float slice = packedAttribute1.w;\n\n#ifdef INSTANCED\n vec2 dir = direction;\n#else\n vec2 dir = coordinates;\n#endif\n\n vec2 offset = dir - vec2(0.5, 0.5);\n vec2 scaledOffset = scale * offset;\n vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\n vec4 positionEC = czm_modelViewRelativeToEye * p;\n positionEC.xy += scaledOffset;\n \n positionEC.xyz *= show;\n gl_Position = czm_projection * positionEC;\n\n v_offset = offset;\n v_maximumSize = maximumSize;\n v_color = color;\n v_slice = slice;\n v_brightness = brightness;\n}\n";
  171866. // node_modules/cesium/Source/Shaders/CloudNoiseFS.js
  171867. var CloudNoiseFS_default = "uniform vec3 u_noiseTextureDimensions;\nuniform float u_noiseDetail;\nuniform vec3 u_noiseOffset;\nvarying vec2 v_position;\n\nfloat textureSliceWidth = u_noiseTextureDimensions.x;\nfloat inverseNoiseTextureRows = u_noiseTextureDimensions.z;\n\nfloat wrap(float value, float rangeLength) {\n if(value < 0.0) {\n float absValue = abs(value);\n float modValue = mod(absValue, rangeLength);\n return mod(rangeLength - modValue, rangeLength);\n }\n return mod(value, rangeLength);\n}\n\nvec3 wrapVec(vec3 value, float rangeLength) {\n return vec3(wrap(value.x, rangeLength),\n wrap(value.y, rangeLength),\n wrap(value.z, rangeLength));\n}\n\nvec3 random3(vec3 p) {\n float dot1 = dot(p, vec3(127.1, 311.7, 932.8));\n float dot2 = dot(p, vec3(269.5, 183.3, 421.4));\n return fract(vec3(sin(dot1 - dot2), cos(dot1 * dot2), dot1 * dot2));\n}\n\n// Frequency corresponds to cell size.\n// The higher the frequency, the smaller the cell size.\nvec3 getWorleyCellPoint(vec3 centerCell, vec3 offset, float freq) {\n vec3 cell = centerCell + offset;\n cell = wrapVec(cell, textureSliceWidth / u_noiseDetail);\n cell += floor(u_noiseOffset / u_noiseDetail);\n vec3 p = offset + random3(cell);\n return p;\n}\n\nfloat worleyNoise(vec3 p, float freq) {\n vec3 centerCell = floor(p * freq);\n vec3 pointInCell = fract(p * freq);\n float shortestDistance = 1000.0;\n\n for(float z = -1.0; z <= 1.0; z++) {\n for(float y = -1.0; y <= 1.0; y++) {\n for(float x = -1.0; x <= 1.0; x++) {\n vec3 offset = vec3(x, y, z);\n vec3 point = getWorleyCellPoint(centerCell, offset, freq);\n\n float distance = length(pointInCell - point);\n if(distance < shortestDistance) {\n shortestDistance = distance;\n }\n }\n }\n }\n\n return shortestDistance;\n}\n\nconst float MAX_FBM_ITERATIONS = 10.0;\n\nfloat worleyFBMNoise(vec3 p, float octaves, float scale) {\n float noise = 0.0;\n float freq = 1.0;\n float persistence = 0.625;\n for(float i = 0.0; i < MAX_FBM_ITERATIONS; i++) {\n if(i >= octaves) {\n break;\n }\n\n noise += worleyNoise(p * scale, freq * scale) * persistence;\n persistence *= 0.5;\n freq *= 2.0;\n }\n return noise;\n}\n\nvoid main() {\n float x = mod(v_position.x, textureSliceWidth);\n float y = mod(v_position.y, textureSliceWidth);\n float sliceRow = floor(v_position.y / textureSliceWidth);\n float z = floor(v_position.x / textureSliceWidth) + sliceRow * inverseNoiseTextureRows * textureSliceWidth;\n\n vec3 position = vec3(x, y, z);\n position /= u_noiseDetail;\n float worley0 = clamp(worleyFBMNoise(position, 3.0, 1.0), 0.0, 1.0);\n float worley1 = clamp(worleyFBMNoise(position, 3.0, 2.0), 0.0, 1.0);\n float worley2 = clamp(worleyFBMNoise(position, 3.0, 3.0), 0.0, 1.0);\n gl_FragColor = vec4(worley0, worley1, worley2, 1.0);\n}\n";
  171868. // node_modules/cesium/Source/Shaders/CloudNoiseVS.js
  171869. var CloudNoiseVS_default = "uniform vec3 u_noiseTextureDimensions;\nattribute vec2 position;\n\nvarying vec2 v_position;\n\nvoid main()\n{\n gl_Position = vec4(position, 0.1, 1.0);\n\n float textureSliceWidth = u_noiseTextureDimensions.x;\n float noiseTextureRows = u_noiseTextureDimensions.y;\n float inverseNoiseTextureRows = u_noiseTextureDimensions.z;\n vec2 transformedPos = (position * 0.5) + vec2(0.5);\n transformedPos *= textureSliceWidth;\n transformedPos.x *= textureSliceWidth * inverseNoiseTextureRows;\n transformedPos.y *= noiseTextureRows;\n v_position = transformedPos;\n}\n";
  171870. // node_modules/cesium/Source/Scene/CumulusCloud.js
  171871. function CumulusCloud(options, cloudCollection) {
  171872. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  171873. this._show = defaultValue_default(options.show, true);
  171874. this._position = Cartesian3_default.clone(
  171875. defaultValue_default(options.position, Cartesian3_default.ZERO)
  171876. );
  171877. if (!defined_default(options.scale) && defined_default(options.maximumSize)) {
  171878. this._maximumSize = Cartesian3_default.clone(options.maximumSize);
  171879. this._scale = new Cartesian2_default(this._maximumSize.x, this._maximumSize.y);
  171880. } else {
  171881. this._scale = Cartesian2_default.clone(
  171882. defaultValue_default(options.scale, new Cartesian2_default(20, 12))
  171883. );
  171884. const defaultMaxSize = new Cartesian3_default(
  171885. this._scale.x,
  171886. this._scale.y,
  171887. Math.min(this._scale.x, this._scale.y) / 1.5
  171888. );
  171889. this._maximumSize = Cartesian3_default.clone(
  171890. defaultValue_default(options.maximumSize, defaultMaxSize)
  171891. );
  171892. }
  171893. this._slice = defaultValue_default(options.slice, -1);
  171894. this._color = Color_default.clone(defaultValue_default(options.color, Color_default.WHITE));
  171895. this._brightness = defaultValue_default(options.brightness, 1);
  171896. this._cloudCollection = cloudCollection;
  171897. this._index = -1;
  171898. }
  171899. var SHOW_INDEX7 = CumulusCloud.SHOW_INDEX = 0;
  171900. var POSITION_INDEX7 = CumulusCloud.POSITION_INDEX = 1;
  171901. var SCALE_INDEX3 = CumulusCloud.SCALE_INDEX = 2;
  171902. var MAXIMUM_SIZE_INDEX = CumulusCloud.MAXIMUM_SIZE_INDEX = 3;
  171903. var SLICE_INDEX = CumulusCloud.SLICE_INDEX = 4;
  171904. var BRIGHTNESS_INDEX = CumulusCloud.BRIGHTNESS_INDEX = 5;
  171905. var COLOR_INDEX5 = CumulusCloud.COLOR_INDEX = 6;
  171906. CumulusCloud.NUMBER_OF_PROPERTIES = 7;
  171907. function makeDirty4(cloud, propertyChanged) {
  171908. const cloudCollection = cloud._cloudCollection;
  171909. if (defined_default(cloudCollection)) {
  171910. cloudCollection._updateCloud(cloud, propertyChanged);
  171911. cloud._dirty = true;
  171912. }
  171913. }
  171914. Object.defineProperties(CumulusCloud.prototype, {
  171915. show: {
  171916. get: function() {
  171917. return this._show;
  171918. },
  171919. set: function(value) {
  171920. Check_default.typeOf.bool("value", value);
  171921. if (this._show !== value) {
  171922. this._show = value;
  171923. makeDirty4(this, SHOW_INDEX7);
  171924. }
  171925. }
  171926. },
  171927. position: {
  171928. get: function() {
  171929. return this._position;
  171930. },
  171931. set: function(value) {
  171932. Check_default.typeOf.object("value", value);
  171933. const position = this._position;
  171934. if (!Cartesian3_default.equals(position, value)) {
  171935. Cartesian3_default.clone(value, position);
  171936. makeDirty4(this, POSITION_INDEX7);
  171937. }
  171938. }
  171939. },
  171940. scale: {
  171941. get: function() {
  171942. return this._scale;
  171943. },
  171944. set: function(value) {
  171945. Check_default.typeOf.object("value", value);
  171946. const scale = this._scale;
  171947. if (!Cartesian2_default.equals(scale, value)) {
  171948. Cartesian2_default.clone(value, scale);
  171949. makeDirty4(this, SCALE_INDEX3);
  171950. }
  171951. }
  171952. },
  171953. maximumSize: {
  171954. get: function() {
  171955. return this._maximumSize;
  171956. },
  171957. set: function(value) {
  171958. Check_default.typeOf.object("value", value);
  171959. const maximumSize = this._maximumSize;
  171960. if (!Cartesian3_default.equals(maximumSize, value)) {
  171961. Cartesian3_default.clone(value, maximumSize);
  171962. makeDirty4(this, MAXIMUM_SIZE_INDEX);
  171963. }
  171964. }
  171965. },
  171966. color: {
  171967. get: function() {
  171968. return this._color;
  171969. },
  171970. set: function(value) {
  171971. Check_default.typeOf.object("value", value);
  171972. const color = this._color;
  171973. if (!Color_default.equals(color, value)) {
  171974. Color_default.clone(value, color);
  171975. makeDirty4(this, COLOR_INDEX5);
  171976. }
  171977. }
  171978. },
  171979. slice: {
  171980. get: function() {
  171981. return this._slice;
  171982. },
  171983. set: function(value) {
  171984. Check_default.typeOf.number("value", value);
  171985. const slice = this._slice;
  171986. if (slice !== value) {
  171987. this._slice = value;
  171988. makeDirty4(this, SLICE_INDEX);
  171989. }
  171990. }
  171991. },
  171992. brightness: {
  171993. get: function() {
  171994. return this._brightness;
  171995. },
  171996. set: function(value) {
  171997. Check_default.typeOf.number("value", value);
  171998. const brightness = this._brightness;
  171999. if (brightness !== value) {
  172000. this._brightness = value;
  172001. makeDirty4(this, BRIGHTNESS_INDEX);
  172002. }
  172003. }
  172004. }
  172005. });
  172006. CumulusCloud.prototype._destroy = function() {
  172007. this._cloudCollection = void 0;
  172008. };
  172009. var CumulusCloud_default = CumulusCloud;
  172010. // node_modules/cesium/Source/Scene/CloudCollection.js
  172011. var attributeLocations6;
  172012. var scratchTextureDimensions = new Cartesian3_default();
  172013. var attributeLocationsBatched2 = {
  172014. positionHighAndScaleX: 0,
  172015. positionLowAndScaleY: 1,
  172016. packedAttribute0: 2,
  172017. packedAttribute1: 3,
  172018. color: 4
  172019. };
  172020. var attributeLocationsInstanced2 = {
  172021. direction: 0,
  172022. positionHighAndScaleX: 1,
  172023. positionLowAndScaleY: 2,
  172024. packedAttribute0: 3,
  172025. packedAttribute1: 4,
  172026. color: 5
  172027. };
  172028. var SHOW_INDEX8 = CumulusCloud_default.SHOW_INDEX;
  172029. var POSITION_INDEX8 = CumulusCloud_default.POSITION_INDEX;
  172030. var SCALE_INDEX4 = CumulusCloud_default.SCALE_INDEX;
  172031. var MAXIMUM_SIZE_INDEX2 = CumulusCloud_default.MAXIMUM_SIZE_INDEX;
  172032. var SLICE_INDEX2 = CumulusCloud_default.SLICE_INDEX;
  172033. var BRIGHTNESS_INDEX2 = CumulusCloud_default.BRIGHTNESS_INDEX;
  172034. var NUMBER_OF_PROPERTIES5 = CumulusCloud_default.NUMBER_OF_PROPERTIES;
  172035. var COLOR_INDEX6 = CumulusCloud_default.COLOR_INDEX;
  172036. function CloudCollection(options) {
  172037. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  172038. this._clouds = [];
  172039. this._cloudsToUpdate = [];
  172040. this._cloudsToUpdateIndex = 0;
  172041. this._cloudsRemoved = false;
  172042. this._createVertexArray = false;
  172043. this._propertiesChanged = new Uint32Array(NUMBER_OF_PROPERTIES5);
  172044. this._noiseTexture = void 0;
  172045. this._textureSliceWidth = 128;
  172046. this._noiseTextureRows = 4;
  172047. this.noiseDetail = defaultValue_default(options.noiseDetail, 16);
  172048. this.noiseOffset = Cartesian3_default.clone(
  172049. defaultValue_default(options.noiseOffset, Cartesian3_default.ZERO)
  172050. );
  172051. this._loading = false;
  172052. this._ready = false;
  172053. const that = this;
  172054. this._uniforms = {
  172055. u_noiseTexture: function() {
  172056. return that._noiseTexture;
  172057. },
  172058. u_noiseTextureDimensions: getNoiseTextureDimensions(that),
  172059. u_noiseDetail: function() {
  172060. return that.noiseDetail;
  172061. }
  172062. };
  172063. this._vaNoise = void 0;
  172064. this._spNoise = void 0;
  172065. this._spCreated = false;
  172066. this._sp = void 0;
  172067. this._rs = void 0;
  172068. this.show = defaultValue_default(options.show, true);
  172069. this._colorCommands = [];
  172070. this.debugBillboards = defaultValue_default(options.debugBillboards, false);
  172071. this._compiledDebugBillboards = false;
  172072. this.debugEllipsoids = defaultValue_default(options.debugEllipsoids, false);
  172073. this._compiledDebugEllipsoids = false;
  172074. }
  172075. function getNoiseTextureDimensions(collection) {
  172076. return function() {
  172077. scratchTextureDimensions.x = collection._textureSliceWidth;
  172078. scratchTextureDimensions.y = collection._noiseTextureRows;
  172079. scratchTextureDimensions.z = 1 / collection._noiseTextureRows;
  172080. return scratchTextureDimensions;
  172081. };
  172082. }
  172083. Object.defineProperties(CloudCollection.prototype, {
  172084. length: {
  172085. get: function() {
  172086. removeClouds(this);
  172087. return this._clouds.length;
  172088. }
  172089. }
  172090. });
  172091. function destroyClouds(clouds) {
  172092. const length3 = clouds.length;
  172093. for (let i2 = 0; i2 < length3; ++i2) {
  172094. if (clouds[i2]) {
  172095. clouds[i2]._destroy();
  172096. }
  172097. }
  172098. }
  172099. CloudCollection.prototype.add = function(options) {
  172100. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  172101. const cloudType = defaultValue_default(options.cloudType, CloudType_default.CUMULUS);
  172102. if (!CloudType_default.validate(cloudType)) {
  172103. throw new DeveloperError_default("invalid cloud type");
  172104. }
  172105. let cloud;
  172106. if (cloudType === CloudType_default.CUMULUS) {
  172107. cloud = new CumulusCloud_default(options, this);
  172108. cloud._index = this._clouds.length;
  172109. this._clouds.push(cloud);
  172110. this._createVertexArray = true;
  172111. }
  172112. return cloud;
  172113. };
  172114. CloudCollection.prototype.remove = function(cloud) {
  172115. if (this.contains(cloud)) {
  172116. this._clouds[cloud._index] = void 0;
  172117. this._cloudsRemoved = true;
  172118. this._createVertexArray = true;
  172119. cloud._destroy();
  172120. return true;
  172121. }
  172122. return false;
  172123. };
  172124. CloudCollection.prototype.removeAll = function() {
  172125. destroyClouds(this._clouds);
  172126. this._clouds = [];
  172127. this._cloudsToUpdate = [];
  172128. this._cloudsToUpdateIndex = 0;
  172129. this._cloudsRemoved = false;
  172130. this._createVertexArray = true;
  172131. };
  172132. function removeClouds(cloudCollection) {
  172133. if (cloudCollection._cloudsRemoved) {
  172134. cloudCollection._cloudsRemoved = false;
  172135. const newClouds = [];
  172136. const clouds = cloudCollection._clouds;
  172137. const length3 = clouds.length;
  172138. for (let i2 = 0, j = 0; i2 < length3; ++i2) {
  172139. const cloud = clouds[i2];
  172140. if (defined_default(cloud)) {
  172141. clouds._index = j++;
  172142. newClouds.push(cloud);
  172143. }
  172144. }
  172145. cloudCollection._clouds = newClouds;
  172146. }
  172147. }
  172148. CloudCollection.prototype._updateCloud = function(cloud, propertyChanged) {
  172149. if (!cloud._dirty) {
  172150. this._cloudsToUpdate[this._cloudsToUpdateIndex++] = cloud;
  172151. }
  172152. ++this._propertiesChanged[propertyChanged];
  172153. };
  172154. CloudCollection.prototype.contains = function(cloud) {
  172155. return defined_default(cloud) && cloud._cloudCollection === this;
  172156. };
  172157. CloudCollection.prototype.get = function(index2) {
  172158. Check_default.typeOf.number("index", index2);
  172159. removeClouds(this);
  172160. return this._clouds[index2];
  172161. };
  172162. var texturePositions = new Float32Array([
  172163. -1,
  172164. -1,
  172165. 1,
  172166. -1,
  172167. 1,
  172168. 1,
  172169. -1,
  172170. 1
  172171. ]);
  172172. var textureIndices = new Uint16Array([0, 1, 2, 0, 2, 3]);
  172173. function createTextureVA(context) {
  172174. const positionBuffer = Buffer_default.createVertexBuffer({
  172175. context,
  172176. typedArray: texturePositions,
  172177. usage: BufferUsage_default.STATIC_DRAW
  172178. });
  172179. const indexBuffer = Buffer_default.createIndexBuffer({
  172180. context,
  172181. typedArray: textureIndices,
  172182. usage: BufferUsage_default.STATIC_DRAW,
  172183. indexDatatype: IndexDatatype_default.UNSIGNED_SHORT
  172184. });
  172185. const attributes = [
  172186. {
  172187. index: 0,
  172188. vertexBuffer: positionBuffer,
  172189. componentsPerAttribute: 2,
  172190. componentDatatype: ComponentDatatype_default.FLOAT
  172191. }
  172192. ];
  172193. return new VertexArray_default({
  172194. context,
  172195. attributes,
  172196. indexBuffer
  172197. });
  172198. }
  172199. var getIndexBuffer3;
  172200. function getIndexBufferBatched2(context) {
  172201. const sixteenK = 16 * 1024;
  172202. let indexBuffer = context.cache.cloudCollection_indexBufferBatched;
  172203. if (defined_default(indexBuffer)) {
  172204. return indexBuffer;
  172205. }
  172206. const length3 = sixteenK * 6 - 6;
  172207. const indices2 = new Uint16Array(length3);
  172208. for (let i2 = 0, j = 0; i2 < length3; i2 += 6, j += 4) {
  172209. indices2[i2] = j;
  172210. indices2[i2 + 1] = j + 1;
  172211. indices2[i2 + 2] = j + 2;
  172212. indices2[i2 + 3] = j;
  172213. indices2[i2 + 4] = j + 2;
  172214. indices2[i2 + 5] = j + 3;
  172215. }
  172216. indexBuffer = Buffer_default.createIndexBuffer({
  172217. context,
  172218. typedArray: indices2,
  172219. usage: BufferUsage_default.STATIC_DRAW,
  172220. indexDatatype: IndexDatatype_default.UNSIGNED_SHORT
  172221. });
  172222. indexBuffer.vertexArrayDestroyable = false;
  172223. context.cache.cloudCollection_indexBufferBatched = indexBuffer;
  172224. return indexBuffer;
  172225. }
  172226. function getIndexBufferInstanced2(context) {
  172227. let indexBuffer = context.cache.cloudCollection_indexBufferInstanced;
  172228. if (defined_default(indexBuffer)) {
  172229. return indexBuffer;
  172230. }
  172231. indexBuffer = Buffer_default.createIndexBuffer({
  172232. context,
  172233. typedArray: new Uint16Array([0, 1, 2, 0, 2, 3]),
  172234. usage: BufferUsage_default.STATIC_DRAW,
  172235. indexDatatype: IndexDatatype_default.UNSIGNED_SHORT
  172236. });
  172237. indexBuffer.vertexArrayDestroyable = false;
  172238. context.cache.cloudCollection_indexBufferInstanced = indexBuffer;
  172239. return indexBuffer;
  172240. }
  172241. function getVertexBufferInstanced2(context) {
  172242. let vertexBuffer = context.cache.cloudCollection_vertexBufferInstanced;
  172243. if (defined_default(vertexBuffer)) {
  172244. return vertexBuffer;
  172245. }
  172246. vertexBuffer = Buffer_default.createVertexBuffer({
  172247. context,
  172248. typedArray: new Float32Array([0, 0, 1, 0, 1, 1, 0, 1]),
  172249. usage: BufferUsage_default.STATIC_DRAW
  172250. });
  172251. vertexBuffer.vertexArrayDestroyable = false;
  172252. context.cache.cloudCollection_vertexBufferInstanced = vertexBuffer;
  172253. return vertexBuffer;
  172254. }
  172255. function createVAF3(context, numberOfClouds, instanced) {
  172256. const attributes = [
  172257. {
  172258. index: attributeLocations6.positionHighAndScaleX,
  172259. componentsPerAttribute: 4,
  172260. componentDatatype: ComponentDatatype_default.FLOAT,
  172261. usage: BufferUsage_default.STATIC_DRAW
  172262. },
  172263. {
  172264. index: attributeLocations6.positionLowAndScaleY,
  172265. componentsPerAttribute: 4,
  172266. componentDatatype: ComponentDatatype_default.FLOAT,
  172267. usage: BufferUsage_default.STATIC_DRAW
  172268. },
  172269. {
  172270. index: attributeLocations6.packedAttribute0,
  172271. componentsPerAttribute: 4,
  172272. componentDatatype: ComponentDatatype_default.FLOAT,
  172273. usage: BufferUsage_default.STATIC_DRAW
  172274. },
  172275. {
  172276. index: attributeLocations6.packedAttribute1,
  172277. componentsPerAttribute: 4,
  172278. componentDatatype: ComponentDatatype_default.FLOAT,
  172279. usage: BufferUsage_default.STATIC_DRAW
  172280. },
  172281. {
  172282. index: attributeLocations6.color,
  172283. componentsPerAttribute: 4,
  172284. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE,
  172285. normalize: true,
  172286. usage: BufferUsage_default.STATIC_DRAW
  172287. }
  172288. ];
  172289. if (instanced) {
  172290. attributes.push({
  172291. index: attributeLocations6.direction,
  172292. componentsPerAttribute: 2,
  172293. componentDatatype: ComponentDatatype_default.FLOAT,
  172294. vertexBuffer: getVertexBufferInstanced2(context)
  172295. });
  172296. }
  172297. const sizeInVertices = instanced ? numberOfClouds : 4 * numberOfClouds;
  172298. return new VertexArrayFacade_default(context, attributes, sizeInVertices, instanced);
  172299. }
  172300. var writePositionScratch3 = new EncodedCartesian3_default();
  172301. function writePositionAndScale(cloudCollection, frameState, vafWriters, cloud) {
  172302. let i2;
  172303. const positionHighWriter = vafWriters[attributeLocations6.positionHighAndScaleX];
  172304. const positionLowWriter = vafWriters[attributeLocations6.positionLowAndScaleY];
  172305. const position = cloud.position;
  172306. EncodedCartesian3_default.fromCartesian(position, writePositionScratch3);
  172307. const scale = cloud.scale;
  172308. const high = writePositionScratch3.high;
  172309. const low = writePositionScratch3.low;
  172310. if (cloudCollection._instanced) {
  172311. i2 = cloud._index;
  172312. positionHighWriter(i2, high.x, high.y, high.z, scale.x);
  172313. positionLowWriter(i2, low.x, low.y, low.z, scale.y);
  172314. } else {
  172315. i2 = cloud._index * 4;
  172316. positionHighWriter(i2 + 0, high.x, high.y, high.z, scale.x);
  172317. positionHighWriter(i2 + 1, high.x, high.y, high.z, scale.x);
  172318. positionHighWriter(i2 + 2, high.x, high.y, high.z, scale.x);
  172319. positionHighWriter(i2 + 3, high.x, high.y, high.z, scale.x);
  172320. positionLowWriter(i2 + 0, low.x, low.y, low.z, scale.y);
  172321. positionLowWriter(i2 + 1, low.x, low.y, low.z, scale.y);
  172322. positionLowWriter(i2 + 2, low.x, low.y, low.z, scale.y);
  172323. positionLowWriter(i2 + 3, low.x, low.y, low.z, scale.y);
  172324. }
  172325. }
  172326. function writePackedAttribute0(cloudCollection, frameState, vafWriters, cloud) {
  172327. let i2;
  172328. const writer = vafWriters[attributeLocations6.packedAttribute0];
  172329. const show = cloud.show;
  172330. const brightness = cloud.brightness;
  172331. if (cloudCollection._instanced) {
  172332. i2 = cloud._index;
  172333. writer(i2, show, brightness, 0, 0);
  172334. } else {
  172335. i2 = cloud._index * 4;
  172336. writer(i2 + 0, show, brightness, 0, 0);
  172337. writer(i2 + 1, show, brightness, 1, 0);
  172338. writer(i2 + 2, show, brightness, 1, 1);
  172339. writer(i2 + 3, show, brightness, 0, 1);
  172340. }
  172341. }
  172342. function writePackedAttribute1(cloudCollection, frameState, vafWriters, cloud) {
  172343. let i2;
  172344. const writer = vafWriters[attributeLocations6.packedAttribute1];
  172345. const maximumSize = cloud.maximumSize;
  172346. const slice = cloud.slice;
  172347. if (cloudCollection._instanced) {
  172348. i2 = cloud._index;
  172349. writer(i2, maximumSize.x, maximumSize.y, maximumSize.z, slice);
  172350. } else {
  172351. i2 = cloud._index * 4;
  172352. writer(i2 + 0, maximumSize.x, maximumSize.y, maximumSize.z, slice);
  172353. writer(i2 + 1, maximumSize.x, maximumSize.y, maximumSize.z, slice);
  172354. writer(i2 + 2, maximumSize.x, maximumSize.y, maximumSize.z, slice);
  172355. writer(i2 + 3, maximumSize.x, maximumSize.y, maximumSize.z, slice);
  172356. }
  172357. }
  172358. function writeColor(cloudCollection, frameState, vafWriters, cloud) {
  172359. let i2;
  172360. const writer = vafWriters[attributeLocations6.color];
  172361. const color = cloud.color;
  172362. const red = Color_default.floatToByte(color.red);
  172363. const green = Color_default.floatToByte(color.green);
  172364. const blue = Color_default.floatToByte(color.blue);
  172365. const alpha = Color_default.floatToByte(color.alpha);
  172366. if (cloudCollection._instanced) {
  172367. i2 = cloud._index;
  172368. writer(i2, red, green, blue, alpha);
  172369. } else {
  172370. i2 = cloud._index * 4;
  172371. writer(i2 + 0, red, green, blue, alpha);
  172372. writer(i2 + 1, red, green, blue, alpha);
  172373. writer(i2 + 2, red, green, blue, alpha);
  172374. writer(i2 + 3, red, green, blue, alpha);
  172375. }
  172376. }
  172377. function writeCloud(cloudCollection, frameState, vafWriters, cloud) {
  172378. writePositionAndScale(cloudCollection, frameState, vafWriters, cloud);
  172379. writePackedAttribute0(cloudCollection, frameState, vafWriters, cloud);
  172380. writePackedAttribute1(cloudCollection, frameState, vafWriters, cloud);
  172381. writeColor(cloudCollection, frameState, vafWriters, cloud);
  172382. }
  172383. function createNoiseTexture(cloudCollection, frameState, vsSource, fsSource) {
  172384. const that = cloudCollection;
  172385. const textureSliceWidth = that._textureSliceWidth;
  172386. const noiseTextureRows = that._noiseTextureRows;
  172387. if (textureSliceWidth / noiseTextureRows < 1 || textureSliceWidth % noiseTextureRows !== 0) {
  172388. throw new DeveloperError_default(
  172389. "noiseTextureRows must evenly divide textureSliceWidth"
  172390. );
  172391. }
  172392. const context = frameState.context;
  172393. that._vaNoise = createTextureVA(context);
  172394. that._spNoise = ShaderProgram_default.fromCache({
  172395. context,
  172396. vertexShaderSource: vsSource,
  172397. fragmentShaderSource: fsSource,
  172398. attributeLocations: {
  172399. position: 0
  172400. }
  172401. });
  172402. const noiseDetail = that.noiseDetail;
  172403. const noiseOffset = that.noiseOffset;
  172404. that._noiseTexture = new Texture_default({
  172405. context,
  172406. width: textureSliceWidth * textureSliceWidth / noiseTextureRows,
  172407. height: textureSliceWidth * noiseTextureRows,
  172408. pixelDatatype: PixelDatatype_default.UNSIGNED_BYTE,
  172409. pixelFormat: PixelFormat_default.RGBA,
  172410. sampler: new Sampler_default({
  172411. wrapS: TextureWrap_default.REPEAT,
  172412. wrapT: TextureWrap_default.REPEAT,
  172413. minificationFilter: TextureMinificationFilter_default.NEAREST,
  172414. magnificationFilter: TextureMagnificationFilter_default.NEAREST
  172415. })
  172416. });
  172417. const textureCommand = new ComputeCommand_default({
  172418. vertexArray: that._vaNoise,
  172419. shaderProgram: that._spNoise,
  172420. outputTexture: that._noiseTexture,
  172421. uniformMap: {
  172422. u_noiseTextureDimensions: getNoiseTextureDimensions(that),
  172423. u_noiseDetail: function() {
  172424. return noiseDetail;
  172425. },
  172426. u_noiseOffset: function() {
  172427. return noiseOffset;
  172428. }
  172429. },
  172430. persists: false,
  172431. owner: cloudCollection,
  172432. postExecute: function(texture) {
  172433. that._ready = true;
  172434. that._loading = false;
  172435. }
  172436. });
  172437. frameState.commandList.push(textureCommand);
  172438. that._loading = true;
  172439. }
  172440. function createVertexArray7(cloudCollection, frameState) {
  172441. const that = cloudCollection;
  172442. const context = frameState.context;
  172443. that._createVertexArray = false;
  172444. that._vaf = that._vaf && that._vaf.destroy();
  172445. const clouds = cloudCollection._clouds;
  172446. const cloudsLength = clouds.length;
  172447. if (cloudsLength > 0) {
  172448. that._vaf = createVAF3(context, cloudsLength, that._instanced);
  172449. const vafWriters = that._vaf.writers;
  172450. let i2;
  172451. for (i2 = 0; i2 < cloudsLength; ++i2) {
  172452. const cloud = clouds[i2];
  172453. writeCloud(cloudCollection, frameState, vafWriters, cloud);
  172454. }
  172455. that._vaf.commit(getIndexBuffer3(context));
  172456. }
  172457. }
  172458. var scratchWriterArray3 = [];
  172459. function updateClouds(cloudCollection, frameState) {
  172460. const context = frameState.context;
  172461. const that = cloudCollection;
  172462. const clouds = that._clouds;
  172463. const cloudsLength = clouds.length;
  172464. const cloudsToUpdate = that._cloudsToUpdate;
  172465. const cloudsToUpdateLength = that._cloudsToUpdateIndex;
  172466. const properties = that._propertiesChanged;
  172467. const writers = scratchWriterArray3;
  172468. writers.length = 0;
  172469. if (properties[POSITION_INDEX8] || properties[SCALE_INDEX4]) {
  172470. writers.push(writePositionAndScale);
  172471. }
  172472. if (properties[SHOW_INDEX8] || properties[BRIGHTNESS_INDEX2]) {
  172473. writers.push(writePackedAttribute0);
  172474. }
  172475. if (properties[MAXIMUM_SIZE_INDEX2] || properties[SLICE_INDEX2]) {
  172476. writers.push(writePackedAttribute1);
  172477. }
  172478. if (properties[COLOR_INDEX6]) {
  172479. writers.push(writeColor);
  172480. }
  172481. const numWriters = writers.length;
  172482. const vafWriters = that._vaf.writers;
  172483. let i2, c14, w;
  172484. if (cloudsToUpdateLength / cloudsLength > 0.1) {
  172485. for (i2 = 0; i2 < cloudsToUpdateLength; ++i2) {
  172486. c14 = cloudsToUpdate[i2];
  172487. c14._dirty = false;
  172488. for (w = 0; w < numWriters; ++w) {
  172489. writers[w](cloudCollection, frameState, vafWriters, c14);
  172490. }
  172491. }
  172492. that._vaf.commit(getIndexBuffer3(context));
  172493. } else {
  172494. for (i2 = 0; i2 < cloudsToUpdateLength; ++i2) {
  172495. c14 = cloudsToUpdate[i2];
  172496. c14._dirty = false;
  172497. for (w = 0; w < numWriters; ++w) {
  172498. writers[w](cloudCollection, frameState, vafWriters, c14);
  172499. }
  172500. if (that._instanced) {
  172501. that._vaf.subCommit(c14._index, 1);
  172502. } else {
  172503. that._vaf.subCommit(c14._index * 4, 4);
  172504. }
  172505. }
  172506. that._vaf.endSubCommits();
  172507. }
  172508. that._cloudsToUpdateIndex = 0;
  172509. }
  172510. function createShaderProgram4(cloudCollection, frameState, vsSource, fsSource) {
  172511. const context = frameState.context;
  172512. const that = cloudCollection;
  172513. const vs = new ShaderSource_default({
  172514. defines: [],
  172515. sources: [vsSource]
  172516. });
  172517. if (that._instanced) {
  172518. vs.defines.push("INSTANCED");
  172519. }
  172520. const fs = new ShaderSource_default({
  172521. defines: [],
  172522. sources: [fsSource]
  172523. });
  172524. if (that.debugBillboards) {
  172525. fs.defines.push("DEBUG_BILLBOARDS");
  172526. }
  172527. if (that.debugEllipsoids) {
  172528. fs.defines.push("DEBUG_ELLIPSOIDS");
  172529. }
  172530. that._sp = ShaderProgram_default.replaceCache({
  172531. context,
  172532. shaderProgram: that._sp,
  172533. vertexShaderSource: vs,
  172534. fragmentShaderSource: fs,
  172535. attributeLocations: attributeLocations6
  172536. });
  172537. that._rs = RenderState_default.fromCache({
  172538. depthTest: {
  172539. enabled: true,
  172540. func: WebGLConstants_default.LESS
  172541. },
  172542. depthMask: false,
  172543. blending: BlendingState_default.ALPHA_BLEND
  172544. });
  172545. that._spCreated = true;
  172546. that._compiledDebugBillboards = that.debugBillboards;
  172547. that._compiledDebugEllipsoids = that.debugEllipsoids;
  172548. }
  172549. function createDrawCommands(cloudCollection, frameState) {
  172550. const that = cloudCollection;
  172551. const pass = frameState.passes;
  172552. const uniforms = that._uniforms;
  172553. const commandList = frameState.commandList;
  172554. if (pass.render) {
  172555. const colorList = that._colorCommands;
  172556. const va = that._vaf.va;
  172557. const vaLength = va.length;
  172558. colorList.length = vaLength;
  172559. for (let i2 = 0; i2 < vaLength; i2++) {
  172560. let command = colorList[i2];
  172561. if (!defined_default(command)) {
  172562. command = colorList[i2] = new DrawCommand_default();
  172563. }
  172564. command.pass = Pass_default.TRANSLUCENT;
  172565. command.owner = cloudCollection;
  172566. command.uniformMap = uniforms;
  172567. command.count = va[i2].indicesCount;
  172568. command.vertexArray = va[i2].va;
  172569. command.shaderProgram = that._sp;
  172570. command.renderState = that._rs;
  172571. if (that._instanced) {
  172572. command.count = 6;
  172573. command.instanceCount = that._clouds.length;
  172574. }
  172575. commandList.push(command);
  172576. }
  172577. }
  172578. }
  172579. CloudCollection.prototype.update = function(frameState) {
  172580. removeClouds(this);
  172581. if (!this.show) {
  172582. return;
  172583. }
  172584. const debugging = this.debugBillboards || this.debugEllipsoids;
  172585. this._ready = debugging ? true : defined_default(this._noiseTexture);
  172586. if (!this._ready && !this._loading && !debugging) {
  172587. createNoiseTexture(this, frameState, CloudNoiseVS_default, CloudNoiseFS_default);
  172588. }
  172589. this._instanced = frameState.context.instancedArrays;
  172590. attributeLocations6 = this._instanced ? attributeLocationsInstanced2 : attributeLocationsBatched2;
  172591. getIndexBuffer3 = this._instanced ? getIndexBufferInstanced2 : getIndexBufferBatched2;
  172592. const clouds = this._clouds;
  172593. const cloudsLength = clouds.length;
  172594. const cloudsToUpdate = this._cloudsToUpdate;
  172595. const cloudsToUpdateLength = this._cloudsToUpdateIndex;
  172596. if (this._createVertexArray) {
  172597. createVertexArray7(this, frameState);
  172598. } else if (cloudsToUpdateLength > 0) {
  172599. updateClouds(this, frameState);
  172600. }
  172601. if (cloudsToUpdateLength > cloudsLength * 1.5) {
  172602. cloudsToUpdate.length = cloudsLength;
  172603. }
  172604. if (!defined_default(this._vaf) || !defined_default(this._vaf.va) || !this._ready & !debugging) {
  172605. return;
  172606. }
  172607. if (!this._spCreated || this.debugBillboards !== this._compiledDebugBillboards || this.debugEllipsoids !== this._compiledDebugEllipsoids) {
  172608. createShaderProgram4(this, frameState, CloudCollectionVS_default, CloudCollectionFS_default);
  172609. }
  172610. createDrawCommands(this, frameState);
  172611. };
  172612. CloudCollection.prototype.isDestroyed = function() {
  172613. return false;
  172614. };
  172615. CloudCollection.prototype.destroy = function() {
  172616. this._noiseTexture = this._noiseTexture && this._noiseTexture.destroy();
  172617. this._sp = this._sp && this._sp.destroy();
  172618. this._vaf = this._vaf && this._vaf.destroy();
  172619. destroyClouds(this._clouds);
  172620. return destroyObject_default(this);
  172621. };
  172622. var CloudCollection_default = CloudCollection;
  172623. // node_modules/cesium/Source/Scene/ConeEmitter.js
  172624. var defaultAngle = Math_default.toRadians(30);
  172625. function ConeEmitter(angle) {
  172626. this._angle = defaultValue_default(angle, defaultAngle);
  172627. }
  172628. Object.defineProperties(ConeEmitter.prototype, {
  172629. angle: {
  172630. get: function() {
  172631. return this._angle;
  172632. },
  172633. set: function(value) {
  172634. Check_default.typeOf.number("value", value);
  172635. this._angle = value;
  172636. }
  172637. }
  172638. });
  172639. ConeEmitter.prototype.emit = function(particle) {
  172640. const radius = Math.tan(this._angle);
  172641. const theta = Math_default.randomBetween(0, Math_default.TWO_PI);
  172642. const rad = Math_default.randomBetween(0, radius);
  172643. const x = rad * Math.cos(theta);
  172644. const y = rad * Math.sin(theta);
  172645. const z = 1;
  172646. particle.velocity = Cartesian3_default.fromElements(x, y, z, particle.velocity);
  172647. Cartesian3_default.normalize(particle.velocity, particle.velocity);
  172648. particle.position = Cartesian3_default.clone(Cartesian3_default.ZERO, particle.position);
  172649. };
  172650. var ConeEmitter_default = ConeEmitter;
  172651. // node_modules/cesium/Source/Scene/CreditDisplay.js
  172652. var mobileWidth = 576;
  172653. var lightboxHeight = 100;
  172654. var textColor = "#ffffff";
  172655. var highlightColor = "#48b";
  172656. function CreditDisplayElement(credit, count) {
  172657. this.credit = credit;
  172658. this.count = defaultValue_default(count, 1);
  172659. }
  172660. function contains2(credits, credit) {
  172661. const len = credits.length;
  172662. for (let i2 = 0; i2 < len; i2++) {
  172663. const existingCredit = credits[i2];
  172664. if (Credit_default.equals(existingCredit, credit)) {
  172665. return true;
  172666. }
  172667. }
  172668. return false;
  172669. }
  172670. function swapCesiumCredit(creditDisplay) {
  172671. const previousCredit = creditDisplay._previousCesiumCredit;
  172672. const currentCredit = creditDisplay._currentCesiumCredit;
  172673. if (Credit_default.equals(currentCredit, previousCredit)) {
  172674. return;
  172675. }
  172676. if (defined_default(previousCredit)) {
  172677. creditDisplay._cesiumCreditContainer.removeChild(previousCredit.element);
  172678. }
  172679. if (defined_default(currentCredit)) {
  172680. creditDisplay._cesiumCreditContainer.appendChild(currentCredit.element);
  172681. }
  172682. creditDisplay._previousCesiumCredit = currentCredit;
  172683. }
  172684. var delimiterClassName = "cesium-credit-delimiter";
  172685. function createDelimiterElement(delimiter) {
  172686. const delimiterElement = document.createElement("span");
  172687. delimiterElement.textContent = delimiter;
  172688. delimiterElement.className = delimiterClassName;
  172689. return delimiterElement;
  172690. }
  172691. function createCreditElement(element, elementWrapperTagName) {
  172692. if (defined_default(elementWrapperTagName)) {
  172693. const wrapper = document.createElement(elementWrapperTagName);
  172694. wrapper._creditId = element._creditId;
  172695. wrapper.appendChild(element);
  172696. element = wrapper;
  172697. }
  172698. return element;
  172699. }
  172700. function displayCredits(container, credits, delimiter, elementWrapperTagName) {
  172701. const childNodes = container.childNodes;
  172702. let domIndex = -1;
  172703. credits.sort(function(credit1, credit2) {
  172704. return credit2.count - credit1.count;
  172705. });
  172706. for (let creditIndex = 0; creditIndex < credits.length; ++creditIndex) {
  172707. const credit = credits[creditIndex].credit;
  172708. if (defined_default(credit)) {
  172709. domIndex = creditIndex;
  172710. if (defined_default(delimiter)) {
  172711. domIndex *= 2;
  172712. if (creditIndex > 0) {
  172713. const delimiterDomIndex = domIndex - 1;
  172714. if (childNodes.length <= delimiterDomIndex) {
  172715. container.appendChild(createDelimiterElement(delimiter));
  172716. } else {
  172717. const existingDelimiter = childNodes[delimiterDomIndex];
  172718. if (existingDelimiter.className !== delimiterClassName) {
  172719. container.replaceChild(
  172720. createDelimiterElement(delimiter),
  172721. existingDelimiter
  172722. );
  172723. }
  172724. }
  172725. }
  172726. }
  172727. const element = credit.element;
  172728. if (childNodes.length <= domIndex) {
  172729. container.appendChild(
  172730. createCreditElement(element, elementWrapperTagName)
  172731. );
  172732. } else {
  172733. const existingElement = childNodes[domIndex];
  172734. if (existingElement._creditId !== credit._id) {
  172735. container.replaceChild(
  172736. createCreditElement(element, elementWrapperTagName),
  172737. existingElement
  172738. );
  172739. }
  172740. }
  172741. }
  172742. }
  172743. ++domIndex;
  172744. while (domIndex < childNodes.length) {
  172745. container.removeChild(childNodes[domIndex]);
  172746. }
  172747. }
  172748. function styleLightboxContainer(that) {
  172749. const lightboxCredits = that._lightboxCredits;
  172750. const width = that.viewport.clientWidth;
  172751. const height = that.viewport.clientHeight;
  172752. if (width !== that._lastViewportWidth) {
  172753. if (width < mobileWidth) {
  172754. lightboxCredits.className = "cesium-credit-lightbox cesium-credit-lightbox-mobile";
  172755. lightboxCredits.style.marginTop = "0";
  172756. } else {
  172757. lightboxCredits.className = "cesium-credit-lightbox cesium-credit-lightbox-expanded";
  172758. lightboxCredits.style.marginTop = `${Math.floor(
  172759. (height - lightboxCredits.clientHeight) * 0.5
  172760. )}px`;
  172761. }
  172762. that._lastViewportWidth = width;
  172763. }
  172764. if (width >= mobileWidth && height !== that._lastViewportHeight) {
  172765. lightboxCredits.style.marginTop = `${Math.floor(
  172766. (height - lightboxCredits.clientHeight) * 0.5
  172767. )}px`;
  172768. that._lastViewportHeight = height;
  172769. }
  172770. }
  172771. function addStyle(selector, styles) {
  172772. let style = `${selector} {`;
  172773. for (const attribute in styles) {
  172774. if (styles.hasOwnProperty(attribute)) {
  172775. style += `${attribute}: ${styles[attribute]}; `;
  172776. }
  172777. }
  172778. style += " }\n";
  172779. return style;
  172780. }
  172781. function appendCss() {
  172782. let style = "";
  172783. style += addStyle(".cesium-credit-lightbox-overlay", {
  172784. display: "none",
  172785. "z-index": "1",
  172786. position: "absolute",
  172787. top: "0",
  172788. left: "0",
  172789. width: "100%",
  172790. height: "100%",
  172791. "background-color": "rgba(80, 80, 80, 0.8)"
  172792. });
  172793. style += addStyle(".cesium-credit-lightbox", {
  172794. "background-color": "#303336",
  172795. color: textColor,
  172796. position: "relative",
  172797. "min-height": `${lightboxHeight}px`,
  172798. margin: "auto"
  172799. });
  172800. style += addStyle(
  172801. ".cesium-credit-lightbox > ul > li a, .cesium-credit-lightbox > ul > li a:visited",
  172802. {
  172803. color: textColor
  172804. }
  172805. );
  172806. style += addStyle(".cesium-credit-lightbox > ul > li a:hover", {
  172807. color: highlightColor
  172808. });
  172809. style += addStyle(".cesium-credit-lightbox.cesium-credit-lightbox-expanded", {
  172810. border: "1px solid #444",
  172811. "border-radius": "5px",
  172812. "max-width": "370px"
  172813. });
  172814. style += addStyle(".cesium-credit-lightbox.cesium-credit-lightbox-mobile", {
  172815. height: "100%",
  172816. width: "100%"
  172817. });
  172818. style += addStyle(".cesium-credit-lightbox-title", {
  172819. padding: "20px 20px 0 20px"
  172820. });
  172821. style += addStyle(".cesium-credit-lightbox-close", {
  172822. "font-size": "18pt",
  172823. cursor: "pointer",
  172824. position: "absolute",
  172825. top: "0",
  172826. right: "6px",
  172827. color: textColor
  172828. });
  172829. style += addStyle(".cesium-credit-lightbox-close:hover", {
  172830. color: highlightColor
  172831. });
  172832. style += addStyle(".cesium-credit-lightbox > ul", {
  172833. margin: "0",
  172834. padding: "12px 20px 12px 40px",
  172835. "font-size": "13px"
  172836. });
  172837. style += addStyle(".cesium-credit-lightbox > ul > li", {
  172838. "padding-bottom": "6px"
  172839. });
  172840. style += addStyle(".cesium-credit-lightbox > ul > li *", {
  172841. padding: "0",
  172842. margin: "0"
  172843. });
  172844. style += addStyle(".cesium-credit-expand-link", {
  172845. "padding-left": "5px",
  172846. cursor: "pointer",
  172847. "text-decoration": "underline",
  172848. color: textColor
  172849. });
  172850. style += addStyle(".cesium-credit-expand-link:hover", {
  172851. color: highlightColor
  172852. });
  172853. style += addStyle(".cesium-credit-text", {
  172854. color: textColor
  172855. });
  172856. style += addStyle(
  172857. ".cesium-credit-textContainer *, .cesium-credit-logoContainer *",
  172858. {
  172859. display: "inline"
  172860. }
  172861. );
  172862. const head = document.head;
  172863. const css = document.createElement("style");
  172864. css.innerHTML = style;
  172865. head.insertBefore(css, head.firstChild);
  172866. }
  172867. function CreditDisplay(container, delimiter, viewport) {
  172868. Check_default.defined("container", container);
  172869. const that = this;
  172870. viewport = defaultValue_default(viewport, document.body);
  172871. const lightbox = document.createElement("div");
  172872. lightbox.className = "cesium-credit-lightbox-overlay";
  172873. viewport.appendChild(lightbox);
  172874. const lightboxCredits = document.createElement("div");
  172875. lightboxCredits.className = "cesium-credit-lightbox";
  172876. lightbox.appendChild(lightboxCredits);
  172877. function hideLightbox(event) {
  172878. if (lightboxCredits.contains(event.target)) {
  172879. return;
  172880. }
  172881. that.hideLightbox();
  172882. }
  172883. lightbox.addEventListener("click", hideLightbox, false);
  172884. const title = document.createElement("div");
  172885. title.className = "cesium-credit-lightbox-title";
  172886. title.textContent = "Data provided by:";
  172887. lightboxCredits.appendChild(title);
  172888. const closeButton = document.createElement("a");
  172889. closeButton.onclick = this.hideLightbox.bind(this);
  172890. closeButton.innerHTML = "&times;";
  172891. closeButton.className = "cesium-credit-lightbox-close";
  172892. lightboxCredits.appendChild(closeButton);
  172893. const creditList = document.createElement("ul");
  172894. lightboxCredits.appendChild(creditList);
  172895. const cesiumCreditContainer = document.createElement("div");
  172896. cesiumCreditContainer.className = "cesium-credit-logoContainer";
  172897. cesiumCreditContainer.style.display = "inline";
  172898. container.appendChild(cesiumCreditContainer);
  172899. const screenContainer = document.createElement("div");
  172900. screenContainer.className = "cesium-credit-textContainer";
  172901. screenContainer.style.display = "inline";
  172902. container.appendChild(screenContainer);
  172903. const expandLink = document.createElement("a");
  172904. expandLink.className = "cesium-credit-expand-link";
  172905. expandLink.onclick = this.showLightbox.bind(this);
  172906. expandLink.textContent = "Data attribution";
  172907. container.appendChild(expandLink);
  172908. appendCss();
  172909. const cesiumCredit = Credit_default.clone(CreditDisplay.cesiumCredit);
  172910. this._delimiter = defaultValue_default(delimiter, " \u2022 ");
  172911. this._screenContainer = screenContainer;
  172912. this._cesiumCreditContainer = cesiumCreditContainer;
  172913. this._lastViewportHeight = void 0;
  172914. this._lastViewportWidth = void 0;
  172915. this._lightboxCredits = lightboxCredits;
  172916. this._creditList = creditList;
  172917. this._lightbox = lightbox;
  172918. this._hideLightbox = hideLightbox;
  172919. this._expandLink = expandLink;
  172920. this._expanded = false;
  172921. this._defaultCredits = [];
  172922. this._cesiumCredit = cesiumCredit;
  172923. this._previousCesiumCredit = void 0;
  172924. this._currentCesiumCredit = cesiumCredit;
  172925. this._creditDisplayElementPool = [];
  172926. this._creditDisplayElementIndex = 0;
  172927. this._currentFrameCredits = {
  172928. screenCredits: new AssociativeArray_default(),
  172929. lightboxCredits: new AssociativeArray_default()
  172930. };
  172931. this._defaultCredit = void 0;
  172932. this.viewport = viewport;
  172933. this.container = container;
  172934. }
  172935. function setCredit(creditDisplay, credits, credit, count) {
  172936. count = defaultValue_default(count, 1);
  172937. let creditDisplayElement = credits.get(credit.id);
  172938. if (!defined_default(creditDisplayElement)) {
  172939. const pool2 = creditDisplay._creditDisplayElementPool;
  172940. const poolIndex = creditDisplay._creditDisplayElementPoolIndex;
  172941. if (poolIndex < pool2.length) {
  172942. creditDisplayElement = pool2[poolIndex];
  172943. creditDisplayElement.credit = credit;
  172944. creditDisplayElement.count = count;
  172945. } else {
  172946. creditDisplayElement = new CreditDisplayElement(credit, count);
  172947. pool2.push(creditDisplayElement);
  172948. }
  172949. ++creditDisplay._creditDisplayElementPoolIndex;
  172950. credits.set(credit.id, creditDisplayElement);
  172951. } else if (creditDisplayElement.count < Number.MAX_VALUE) {
  172952. creditDisplayElement.count += count;
  172953. }
  172954. }
  172955. CreditDisplay.prototype.addCredit = function(credit) {
  172956. Check_default.defined("credit", credit);
  172957. if (credit._isIon) {
  172958. if (!defined_default(this._defaultCredit)) {
  172959. this._defaultCredit = Credit_default.clone(getDefaultCredit());
  172960. }
  172961. this._currentCesiumCredit = this._defaultCredit;
  172962. return;
  172963. }
  172964. let credits;
  172965. if (!credit.showOnScreen) {
  172966. credits = this._currentFrameCredits.lightboxCredits;
  172967. } else {
  172968. credits = this._currentFrameCredits.screenCredits;
  172969. }
  172970. setCredit(this, credits, credit);
  172971. };
  172972. CreditDisplay.prototype.addDefaultCredit = function(credit) {
  172973. Check_default.defined("credit", credit);
  172974. const defaultCredits = this._defaultCredits;
  172975. if (!contains2(defaultCredits, credit)) {
  172976. defaultCredits.push(credit);
  172977. }
  172978. };
  172979. CreditDisplay.prototype.removeDefaultCredit = function(credit) {
  172980. Check_default.defined("credit", credit);
  172981. const defaultCredits = this._defaultCredits;
  172982. const index2 = defaultCredits.indexOf(credit);
  172983. if (index2 !== -1) {
  172984. defaultCredits.splice(index2, 1);
  172985. }
  172986. };
  172987. CreditDisplay.prototype.showLightbox = function() {
  172988. this._lightbox.style.display = "block";
  172989. this._expanded = true;
  172990. };
  172991. CreditDisplay.prototype.hideLightbox = function() {
  172992. this._lightbox.style.display = "none";
  172993. this._expanded = false;
  172994. };
  172995. CreditDisplay.prototype.update = function() {
  172996. if (this._expanded) {
  172997. styleLightboxContainer(this);
  172998. }
  172999. };
  173000. CreditDisplay.prototype.beginFrame = function() {
  173001. const currentFrameCredits = this._currentFrameCredits;
  173002. this._creditDisplayElementPoolIndex = 0;
  173003. const screenCredits = currentFrameCredits.screenCredits;
  173004. screenCredits.removeAll();
  173005. const defaultCredits = this._defaultCredits;
  173006. for (let i2 = 0; i2 < defaultCredits.length; ++i2) {
  173007. const defaultCredit5 = defaultCredits[i2];
  173008. setCredit(this, screenCredits, defaultCredit5, Number.MAX_VALUE);
  173009. }
  173010. currentFrameCredits.lightboxCredits.removeAll();
  173011. if (!Credit_default.equals(CreditDisplay.cesiumCredit, this._cesiumCredit)) {
  173012. this._cesiumCredit = Credit_default.clone(CreditDisplay.cesiumCredit);
  173013. }
  173014. this._currentCesiumCredit = this._cesiumCredit;
  173015. };
  173016. CreditDisplay.prototype.endFrame = function() {
  173017. const screenCredits = this._currentFrameCredits.screenCredits.values;
  173018. displayCredits(
  173019. this._screenContainer,
  173020. screenCredits,
  173021. this._delimiter,
  173022. void 0
  173023. );
  173024. const lightboxCredits = this._currentFrameCredits.lightboxCredits.values;
  173025. this._expandLink.style.display = lightboxCredits.length > 0 ? "inline" : "none";
  173026. displayCredits(this._creditList, lightboxCredits, void 0, "li");
  173027. swapCesiumCredit(this);
  173028. };
  173029. CreditDisplay.prototype.destroy = function() {
  173030. this._lightbox.removeEventListener("click", this._hideLightbox, false);
  173031. this.container.removeChild(this._cesiumCreditContainer);
  173032. this.container.removeChild(this._screenContainer);
  173033. this.container.removeChild(this._expandLink);
  173034. this.viewport.removeChild(this._lightbox);
  173035. return destroyObject_default(this);
  173036. };
  173037. CreditDisplay.prototype.isDestroyed = function() {
  173038. return false;
  173039. };
  173040. CreditDisplay._cesiumCredit = void 0;
  173041. CreditDisplay._cesiumCreditInitialized = false;
  173042. var defaultCredit;
  173043. function getDefaultCredit() {
  173044. if (!defined_default(defaultCredit)) {
  173045. let logo = buildModuleUrl_default("Assets/Images/ion-credit.png");
  173046. if (logo.indexOf("http://") !== 0 && logo.indexOf("https://") !== 0 && logo.indexOf("data:") !== 0) {
  173047. const logoUrl = new URI(logo);
  173048. logo = logoUrl.path();
  173049. }
  173050. defaultCredit = new Credit_default(
  173051. `<a href="https://cesium.com/" target="_blank"><img src="${logo}" title="Cesium ion"/></a>`,
  173052. true
  173053. );
  173054. }
  173055. if (!CreditDisplay._cesiumCreditInitialized) {
  173056. CreditDisplay._cesiumCredit = defaultCredit;
  173057. CreditDisplay._cesiumCreditInitialized = true;
  173058. }
  173059. return defaultCredit;
  173060. }
  173061. Object.defineProperties(CreditDisplay, {
  173062. cesiumCredit: {
  173063. get: function() {
  173064. getDefaultCredit();
  173065. return CreditDisplay._cesiumCredit;
  173066. },
  173067. set: function(value) {
  173068. CreditDisplay._cesiumCredit = value;
  173069. CreditDisplay._cesiumCreditInitialized = true;
  173070. }
  173071. }
  173072. });
  173073. CreditDisplay.CreditDisplayElement = CreditDisplayElement;
  173074. var CreditDisplay_default = CreditDisplay;
  173075. // node_modules/cesium/Source/Scene/DebugAppearance.js
  173076. function DebugAppearance(options) {
  173077. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  173078. const attributeName = options.attributeName;
  173079. let perInstanceAttribute = options.perInstanceAttribute;
  173080. if (!defined_default(attributeName)) {
  173081. throw new DeveloperError_default("options.attributeName is required.");
  173082. }
  173083. if (!defined_default(perInstanceAttribute)) {
  173084. perInstanceAttribute = false;
  173085. }
  173086. let glslDatatype = defaultValue_default(options.glslDatatype, "vec3");
  173087. const varyingName = `v_${attributeName}`;
  173088. let getColor;
  173089. if (attributeName === "normal" || attributeName === "tangent" || attributeName === "bitangent") {
  173090. getColor = `vec4 getColor() { return vec4((${varyingName} + vec3(1.0)) * 0.5, 1.0); }
  173091. `;
  173092. } else {
  173093. if (attributeName === "st") {
  173094. glslDatatype = "vec2";
  173095. }
  173096. switch (glslDatatype) {
  173097. case "float":
  173098. getColor = `vec4 getColor() { return vec4(vec3(${varyingName}), 1.0); }
  173099. `;
  173100. break;
  173101. case "vec2":
  173102. getColor = `vec4 getColor() { return vec4(${varyingName}, 0.0, 1.0); }
  173103. `;
  173104. break;
  173105. case "vec3":
  173106. getColor = `vec4 getColor() { return vec4(${varyingName}, 1.0); }
  173107. `;
  173108. break;
  173109. case "vec4":
  173110. getColor = `vec4 getColor() { return ${varyingName}; }
  173111. `;
  173112. break;
  173113. default:
  173114. throw new DeveloperError_default(
  173115. "options.glslDatatype must be float, vec2, vec3, or vec4."
  173116. );
  173117. }
  173118. }
  173119. const vs = `${"attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute float batchId;\n"}${perInstanceAttribute ? "" : `attribute ${glslDatatype} ${attributeName};
  173120. `}varying ${glslDatatype} ${varyingName};
  173121. void main()
  173122. {
  173123. vec4 p = czm_translateRelativeToEye(position3DHigh, position3DLow);
  173124. ${perInstanceAttribute ? `${varyingName} = czm_batchTable_${attributeName}(batchId);
  173125. ` : `${varyingName} = ${attributeName};
  173126. `}gl_Position = czm_modelViewProjectionRelativeToEye * p;
  173127. }`;
  173128. const fs = `varying ${glslDatatype} ${varyingName};
  173129. ${getColor}
  173130. void main()
  173131. {
  173132. gl_FragColor = getColor();
  173133. }`;
  173134. this.material = void 0;
  173135. this.translucent = defaultValue_default(options.translucent, false);
  173136. this._vertexShaderSource = defaultValue_default(options.vertexShaderSource, vs);
  173137. this._fragmentShaderSource = defaultValue_default(options.fragmentShaderSource, fs);
  173138. this._renderState = Appearance_default.getDefaultRenderState(
  173139. false,
  173140. false,
  173141. options.renderState
  173142. );
  173143. this._closed = defaultValue_default(options.closed, false);
  173144. this._attributeName = attributeName;
  173145. this._glslDatatype = glslDatatype;
  173146. }
  173147. Object.defineProperties(DebugAppearance.prototype, {
  173148. vertexShaderSource: {
  173149. get: function() {
  173150. return this._vertexShaderSource;
  173151. }
  173152. },
  173153. fragmentShaderSource: {
  173154. get: function() {
  173155. return this._fragmentShaderSource;
  173156. }
  173157. },
  173158. renderState: {
  173159. get: function() {
  173160. return this._renderState;
  173161. }
  173162. },
  173163. closed: {
  173164. get: function() {
  173165. return this._closed;
  173166. }
  173167. },
  173168. attributeName: {
  173169. get: function() {
  173170. return this._attributeName;
  173171. }
  173172. },
  173173. glslDatatype: {
  173174. get: function() {
  173175. return this._glslDatatype;
  173176. }
  173177. }
  173178. });
  173179. DebugAppearance.prototype.getFragmentShaderSource = Appearance_default.prototype.getFragmentShaderSource;
  173180. DebugAppearance.prototype.isTranslucent = Appearance_default.prototype.isTranslucent;
  173181. DebugAppearance.prototype.getRenderState = Appearance_default.prototype.getRenderState;
  173182. var DebugAppearance_default = DebugAppearance;
  173183. // node_modules/cesium/Source/Scene/DebugCameraPrimitive.js
  173184. function DebugCameraPrimitive(options) {
  173185. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  173186. if (!defined_default(options.camera)) {
  173187. throw new DeveloperError_default("options.camera is required.");
  173188. }
  173189. this._camera = options.camera;
  173190. this._frustumSplits = options.frustumSplits;
  173191. this._color = defaultValue_default(options.color, Color_default.CYAN);
  173192. this._updateOnChange = defaultValue_default(options.updateOnChange, true);
  173193. this.show = defaultValue_default(options.show, true);
  173194. this.id = options.id;
  173195. this._id = void 0;
  173196. this._outlinePrimitives = [];
  173197. this._planesPrimitives = [];
  173198. }
  173199. var scratchRight2 = new Cartesian3_default();
  173200. var scratchRotation3 = new Matrix3_default();
  173201. var scratchOrientation = new Quaternion_default();
  173202. var scratchPerspective = new PerspectiveFrustum_default();
  173203. var scratchPerspectiveOffCenter = new PerspectiveOffCenterFrustum_default();
  173204. var scratchOrthographic = new OrthographicFrustum_default();
  173205. var scratchOrthographicOffCenter = new OrthographicOffCenterFrustum_default();
  173206. var scratchColor24 = new Color_default();
  173207. var scratchSplits = [1, 1e5];
  173208. DebugCameraPrimitive.prototype.update = function(frameState) {
  173209. if (!this.show) {
  173210. return;
  173211. }
  173212. const planesPrimitives = this._planesPrimitives;
  173213. const outlinePrimitives = this._outlinePrimitives;
  173214. let i2;
  173215. let length3;
  173216. if (this._updateOnChange) {
  173217. length3 = planesPrimitives.length;
  173218. for (i2 = 0; i2 < length3; ++i2) {
  173219. outlinePrimitives[i2] = outlinePrimitives[i2] && outlinePrimitives[i2].destroy();
  173220. planesPrimitives[i2] = planesPrimitives[i2] && planesPrimitives[i2].destroy();
  173221. }
  173222. planesPrimitives.length = 0;
  173223. outlinePrimitives.length = 0;
  173224. }
  173225. if (planesPrimitives.length === 0) {
  173226. const camera = this._camera;
  173227. const cameraFrustum = camera.frustum;
  173228. let frustum;
  173229. if (cameraFrustum instanceof PerspectiveFrustum_default) {
  173230. frustum = scratchPerspective;
  173231. } else if (cameraFrustum instanceof PerspectiveOffCenterFrustum_default) {
  173232. frustum = scratchPerspectiveOffCenter;
  173233. } else if (cameraFrustum instanceof OrthographicFrustum_default) {
  173234. frustum = scratchOrthographic;
  173235. } else {
  173236. frustum = scratchOrthographicOffCenter;
  173237. }
  173238. frustum = cameraFrustum.clone(frustum);
  173239. let numFrustums;
  173240. let frustumSplits2 = this._frustumSplits;
  173241. if (!defined_default(frustumSplits2) || frustumSplits2.length <= 1) {
  173242. frustumSplits2 = scratchSplits;
  173243. frustumSplits2[0] = this._camera.frustum.near;
  173244. frustumSplits2[1] = this._camera.frustum.far;
  173245. numFrustums = 1;
  173246. } else {
  173247. numFrustums = frustumSplits2.length - 1;
  173248. }
  173249. const position = camera.positionWC;
  173250. const direction2 = camera.directionWC;
  173251. const up = camera.upWC;
  173252. let right = camera.rightWC;
  173253. right = Cartesian3_default.negate(right, scratchRight2);
  173254. const rotation = scratchRotation3;
  173255. Matrix3_default.setColumn(rotation, 0, right, rotation);
  173256. Matrix3_default.setColumn(rotation, 1, up, rotation);
  173257. Matrix3_default.setColumn(rotation, 2, direction2, rotation);
  173258. const orientation = Quaternion_default.fromRotationMatrix(
  173259. rotation,
  173260. scratchOrientation
  173261. );
  173262. planesPrimitives.length = outlinePrimitives.length = numFrustums;
  173263. for (i2 = 0; i2 < numFrustums; ++i2) {
  173264. frustum.near = frustumSplits2[i2];
  173265. frustum.far = frustumSplits2[i2 + 1];
  173266. planesPrimitives[i2] = new Primitive_default({
  173267. geometryInstances: new GeometryInstance_default({
  173268. geometry: new FrustumGeometry_default({
  173269. origin: position,
  173270. orientation,
  173271. frustum,
  173272. _drawNearPlane: i2 === 0
  173273. }),
  173274. attributes: {
  173275. color: ColorGeometryInstanceAttribute_default.fromColor(
  173276. Color_default.fromAlpha(this._color, 0.1, scratchColor24)
  173277. )
  173278. },
  173279. id: this.id,
  173280. pickPrimitive: this
  173281. }),
  173282. appearance: new PerInstanceColorAppearance_default({
  173283. translucent: true,
  173284. flat: true
  173285. }),
  173286. asynchronous: false
  173287. });
  173288. outlinePrimitives[i2] = new Primitive_default({
  173289. geometryInstances: new GeometryInstance_default({
  173290. geometry: new FrustumOutlineGeometry_default({
  173291. origin: position,
  173292. orientation,
  173293. frustum,
  173294. _drawNearPlane: i2 === 0
  173295. }),
  173296. attributes: {
  173297. color: ColorGeometryInstanceAttribute_default.fromColor(this._color)
  173298. },
  173299. id: this.id,
  173300. pickPrimitive: this
  173301. }),
  173302. appearance: new PerInstanceColorAppearance_default({
  173303. translucent: false,
  173304. flat: true
  173305. }),
  173306. asynchronous: false
  173307. });
  173308. }
  173309. }
  173310. length3 = planesPrimitives.length;
  173311. for (i2 = 0; i2 < length3; ++i2) {
  173312. outlinePrimitives[i2].update(frameState);
  173313. planesPrimitives[i2].update(frameState);
  173314. }
  173315. };
  173316. DebugCameraPrimitive.prototype.isDestroyed = function() {
  173317. return false;
  173318. };
  173319. DebugCameraPrimitive.prototype.destroy = function() {
  173320. const length3 = this._planesPrimitives.length;
  173321. for (let i2 = 0; i2 < length3; ++i2) {
  173322. this._outlinePrimitives[i2] = this._outlinePrimitives[i2] && this._outlinePrimitives[i2].destroy();
  173323. this._planesPrimitives[i2] = this._planesPrimitives[i2] && this._planesPrimitives[i2].destroy();
  173324. }
  173325. return destroyObject_default(this);
  173326. };
  173327. var DebugCameraPrimitive_default = DebugCameraPrimitive;
  173328. // node_modules/cesium/Source/Scene/DebugInspector.js
  173329. function DebugInspector() {
  173330. this._cachedShowFrustumsShaders = {};
  173331. }
  173332. function getAttributeLocations3(shaderProgram) {
  173333. const attributeLocations8 = {};
  173334. const attributes = shaderProgram.vertexAttributes;
  173335. for (const a4 in attributes) {
  173336. if (attributes.hasOwnProperty(a4)) {
  173337. attributeLocations8[a4] = attributes[a4].index;
  173338. }
  173339. }
  173340. return attributeLocations8;
  173341. }
  173342. function createDebugShowFrustumsShaderProgram(scene, shaderProgram) {
  173343. const context = scene.context;
  173344. const sp = shaderProgram;
  173345. const fs = sp.fragmentShaderSource.clone();
  173346. const targets = [];
  173347. fs.sources = fs.sources.map(function(source) {
  173348. source = ShaderSource_default.replaceMain(source, "czm_Debug_main");
  173349. const re = /gl_FragData\[(\d+)\]/g;
  173350. let match;
  173351. while ((match = re.exec(source)) !== null) {
  173352. if (targets.indexOf(match[1]) === -1) {
  173353. targets.push(match[1]);
  173354. }
  173355. }
  173356. return source;
  173357. });
  173358. const length3 = targets.length;
  173359. let newMain = "";
  173360. newMain += "uniform vec3 debugShowCommandsColor;\n";
  173361. newMain += "uniform vec3 debugShowFrustumsColor;\n";
  173362. newMain += "void main() \n{ \n czm_Debug_main(); \n";
  173363. let i2;
  173364. if (length3 > 0) {
  173365. for (i2 = 0; i2 < length3; ++i2) {
  173366. newMain += ` gl_FragData[${targets[i2]}].rgb *= debugShowCommandsColor;
  173367. `;
  173368. newMain += ` gl_FragData[${targets[i2]}].rgb *= debugShowFrustumsColor;
  173369. `;
  173370. }
  173371. } else {
  173372. newMain += " gl_FragColor.rgb *= debugShowCommandsColor;\n";
  173373. newMain += " gl_FragColor.rgb *= debugShowFrustumsColor;\n";
  173374. }
  173375. newMain += "}";
  173376. fs.sources.push(newMain);
  173377. const attributeLocations8 = getAttributeLocations3(sp);
  173378. return ShaderProgram_default.fromCache({
  173379. context,
  173380. vertexShaderSource: sp.vertexShaderSource,
  173381. fragmentShaderSource: fs,
  173382. attributeLocations: attributeLocations8
  173383. });
  173384. }
  173385. var scratchFrustumColor = new Color_default();
  173386. function createDebugShowFrustumsUniformMap(scene, command) {
  173387. let debugUniformMap;
  173388. if (!defined_default(command.uniformMap)) {
  173389. debugUniformMap = {};
  173390. } else {
  173391. debugUniformMap = command.uniformMap;
  173392. }
  173393. if (defined_default(debugUniformMap.debugShowCommandsColor) || defined_default(debugUniformMap.debugShowFrustumsColor)) {
  173394. return debugUniformMap;
  173395. }
  173396. debugUniformMap.debugShowCommandsColor = function() {
  173397. if (!scene.debugShowCommands) {
  173398. return Color_default.WHITE;
  173399. }
  173400. if (!defined_default(command._debugColor)) {
  173401. command._debugColor = Color_default.fromRandom();
  173402. }
  173403. return command._debugColor;
  173404. };
  173405. debugUniformMap.debugShowFrustumsColor = function() {
  173406. if (!scene.debugShowFrustums) {
  173407. return Color_default.WHITE;
  173408. }
  173409. scratchFrustumColor.red = command.debugOverlappingFrustums & 1 << 0 ? 1 : 0;
  173410. scratchFrustumColor.green = command.debugOverlappingFrustums & 1 << 1 ? 1 : 0;
  173411. scratchFrustumColor.blue = command.debugOverlappingFrustums & 1 << 2 ? 1 : 0;
  173412. scratchFrustumColor.alpha = 1;
  173413. return scratchFrustumColor;
  173414. };
  173415. return debugUniformMap;
  173416. }
  173417. var scratchShowFrustumCommand = new DrawCommand_default();
  173418. DebugInspector.prototype.executeDebugShowFrustumsCommand = function(scene, command, passState) {
  173419. const shaderProgramId = command.shaderProgram.id;
  173420. let debugShaderProgram = this._cachedShowFrustumsShaders[shaderProgramId];
  173421. if (!defined_default(debugShaderProgram)) {
  173422. debugShaderProgram = createDebugShowFrustumsShaderProgram(
  173423. scene,
  173424. command.shaderProgram
  173425. );
  173426. this._cachedShowFrustumsShaders[shaderProgramId] = debugShaderProgram;
  173427. }
  173428. const debugCommand = DrawCommand_default.shallowClone(
  173429. command,
  173430. scratchShowFrustumCommand
  173431. );
  173432. debugCommand.shaderProgram = debugShaderProgram;
  173433. debugCommand.uniformMap = createDebugShowFrustumsUniformMap(scene, command);
  173434. debugCommand.execute(scene.context, passState);
  173435. };
  173436. var DebugInspector_default = DebugInspector;
  173437. // node_modules/cesium/Source/Scene/DebugModelMatrixPrimitive.js
  173438. function DebugModelMatrixPrimitive(options) {
  173439. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  173440. this.length = defaultValue_default(options.length, 1e7);
  173441. this._length = void 0;
  173442. this.width = defaultValue_default(options.width, 2);
  173443. this._width = void 0;
  173444. this.show = defaultValue_default(options.show, true);
  173445. this.modelMatrix = Matrix4_default.clone(
  173446. defaultValue_default(options.modelMatrix, Matrix4_default.IDENTITY)
  173447. );
  173448. this._modelMatrix = new Matrix4_default();
  173449. this.id = options.id;
  173450. this._id = void 0;
  173451. this._primitive = void 0;
  173452. }
  173453. DebugModelMatrixPrimitive.prototype.update = function(frameState) {
  173454. if (!this.show) {
  173455. return;
  173456. }
  173457. if (!defined_default(this._primitive) || !Matrix4_default.equals(this._modelMatrix, this.modelMatrix) || this._length !== this.length || this._width !== this.width || this._id !== this.id) {
  173458. this._modelMatrix = Matrix4_default.clone(this.modelMatrix, this._modelMatrix);
  173459. this._length = this.length;
  173460. this._width = this.width;
  173461. this._id = this.id;
  173462. if (defined_default(this._primitive)) {
  173463. this._primitive.destroy();
  173464. }
  173465. if (this.modelMatrix[12] === 0 && this.modelMatrix[13] === 0 && this.modelMatrix[14] === 0) {
  173466. this.modelMatrix[14] = 0.01;
  173467. }
  173468. const x = new GeometryInstance_default({
  173469. geometry: new PolylineGeometry_default({
  173470. positions: [Cartesian3_default.ZERO, Cartesian3_default.UNIT_X],
  173471. width: this.width,
  173472. vertexFormat: PolylineColorAppearance_default.VERTEX_FORMAT,
  173473. colors: [Color_default.RED, Color_default.RED],
  173474. arcType: ArcType_default.NONE
  173475. }),
  173476. modelMatrix: Matrix4_default.multiplyByUniformScale(
  173477. this.modelMatrix,
  173478. this.length,
  173479. new Matrix4_default()
  173480. ),
  173481. id: this.id,
  173482. pickPrimitive: this
  173483. });
  173484. const y = new GeometryInstance_default({
  173485. geometry: new PolylineGeometry_default({
  173486. positions: [Cartesian3_default.ZERO, Cartesian3_default.UNIT_Y],
  173487. width: this.width,
  173488. vertexFormat: PolylineColorAppearance_default.VERTEX_FORMAT,
  173489. colors: [Color_default.GREEN, Color_default.GREEN],
  173490. arcType: ArcType_default.NONE
  173491. }),
  173492. modelMatrix: Matrix4_default.multiplyByUniformScale(
  173493. this.modelMatrix,
  173494. this.length,
  173495. new Matrix4_default()
  173496. ),
  173497. id: this.id,
  173498. pickPrimitive: this
  173499. });
  173500. const z = new GeometryInstance_default({
  173501. geometry: new PolylineGeometry_default({
  173502. positions: [Cartesian3_default.ZERO, Cartesian3_default.UNIT_Z],
  173503. width: this.width,
  173504. vertexFormat: PolylineColorAppearance_default.VERTEX_FORMAT,
  173505. colors: [Color_default.BLUE, Color_default.BLUE],
  173506. arcType: ArcType_default.NONE
  173507. }),
  173508. modelMatrix: Matrix4_default.multiplyByUniformScale(
  173509. this.modelMatrix,
  173510. this.length,
  173511. new Matrix4_default()
  173512. ),
  173513. id: this.id,
  173514. pickPrimitive: this
  173515. });
  173516. this._primitive = new Primitive_default({
  173517. geometryInstances: [x, y, z],
  173518. appearance: new PolylineColorAppearance_default(),
  173519. asynchronous: false
  173520. });
  173521. }
  173522. this._primitive.update(frameState);
  173523. };
  173524. DebugModelMatrixPrimitive.prototype.isDestroyed = function() {
  173525. return false;
  173526. };
  173527. DebugModelMatrixPrimitive.prototype.destroy = function() {
  173528. this._primitive = this._primitive && this._primitive.destroy();
  173529. return destroyObject_default(this);
  173530. };
  173531. var DebugModelMatrixPrimitive_default = DebugModelMatrixPrimitive;
  173532. // node_modules/cesium/Source/Shaders/DepthPlaneFS.js
  173533. var DepthPlaneFS_default = "varying vec4 positionEC;\n\nvoid main()\n{\n vec3 position;\n vec3 direction;\n if (czm_orthographicIn3D == 1.0)\n {\n vec2 uv = (gl_FragCoord.xy - czm_viewport.xy) / czm_viewport.zw;\n vec2 minPlane = vec2(czm_frustumPlanes.z, czm_frustumPlanes.y); // left, bottom\n vec2 maxPlane = vec2(czm_frustumPlanes.w, czm_frustumPlanes.x); // right, top\n position = vec3(mix(minPlane, maxPlane, uv), 0.0);\n direction = vec3(0.0, 0.0, -1.0);\n } \n else \n {\n position = vec3(0.0);\n direction = normalize(positionEC.xyz);\n }\n\n czm_ray ray = czm_ray(position, direction);\n\n vec3 ellipsoid_center = czm_view[3].xyz;\n\n czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii);\n if (!czm_isEmpty(intersection))\n {\n gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);\n }\n else\n {\n discard;\n }\n\n czm_writeLogDepth();\n}\n";
  173534. // node_modules/cesium/Source/Shaders/DepthPlaneVS.js
  173535. var DepthPlaneVS_default = "attribute vec4 position;\n\nvarying vec4 positionEC;\n\nvoid main()\n{\n positionEC = czm_modelView * position;\n gl_Position = czm_projection * positionEC;\n\n czm_vertexLogDepth();\n}\n";
  173536. // node_modules/cesium/Source/Scene/DepthPlane.js
  173537. function DepthPlane(depthPlaneEllipsoidOffset) {
  173538. this._rs = void 0;
  173539. this._sp = void 0;
  173540. this._va = void 0;
  173541. this._command = void 0;
  173542. this._mode = void 0;
  173543. this._useLogDepth = false;
  173544. this._ellipsoidOffset = defaultValue_default(depthPlaneEllipsoidOffset, 0);
  173545. }
  173546. var depthQuadScratch = FeatureDetection_default.supportsTypedArrays() ? new Float32Array(12) : [];
  173547. var scratchCartesian110 = new Cartesian3_default();
  173548. var scratchCartesian212 = new Cartesian3_default();
  173549. var scratchCartesian314 = new Cartesian3_default();
  173550. var scratchCartesian46 = new Cartesian3_default();
  173551. var scratchCartesian53 = new Cartesian3_default();
  173552. function computeDepthQuad(ellipsoid, frameState) {
  173553. const radii = ellipsoid.radii;
  173554. const camera = frameState.camera;
  173555. let center, eastOffset, northOffset;
  173556. if (camera.frustum instanceof OrthographicFrustum_default) {
  173557. center = Cartesian3_default.ZERO;
  173558. eastOffset = camera.rightWC;
  173559. northOffset = camera.upWC;
  173560. } else {
  173561. const p2 = camera.positionWC;
  173562. const q = Cartesian3_default.multiplyComponents(
  173563. ellipsoid.oneOverRadii,
  173564. p2,
  173565. scratchCartesian110
  173566. );
  173567. const qUnit = Cartesian3_default.normalize(q, scratchCartesian212);
  173568. const eUnit = Cartesian3_default.normalize(
  173569. Cartesian3_default.cross(Cartesian3_default.UNIT_Z, q, scratchCartesian314),
  173570. scratchCartesian314
  173571. );
  173572. const nUnit = Cartesian3_default.normalize(
  173573. Cartesian3_default.cross(qUnit, eUnit, scratchCartesian46),
  173574. scratchCartesian46
  173575. );
  173576. const qMagnitude = Cartesian3_default.magnitude(q);
  173577. const wMagnitude = Math.sqrt(qMagnitude * qMagnitude - 1);
  173578. center = Cartesian3_default.multiplyByScalar(
  173579. qUnit,
  173580. 1 / qMagnitude,
  173581. scratchCartesian110
  173582. );
  173583. const scalar = wMagnitude / qMagnitude;
  173584. eastOffset = Cartesian3_default.multiplyByScalar(eUnit, scalar, scratchCartesian212);
  173585. northOffset = Cartesian3_default.multiplyByScalar(nUnit, scalar, scratchCartesian314);
  173586. }
  173587. const upperLeft = Cartesian3_default.add(center, northOffset, scratchCartesian53);
  173588. Cartesian3_default.subtract(upperLeft, eastOffset, upperLeft);
  173589. Cartesian3_default.multiplyComponents(radii, upperLeft, upperLeft);
  173590. Cartesian3_default.pack(upperLeft, depthQuadScratch, 0);
  173591. const lowerLeft = Cartesian3_default.subtract(center, northOffset, scratchCartesian53);
  173592. Cartesian3_default.subtract(lowerLeft, eastOffset, lowerLeft);
  173593. Cartesian3_default.multiplyComponents(radii, lowerLeft, lowerLeft);
  173594. Cartesian3_default.pack(lowerLeft, depthQuadScratch, 3);
  173595. const upperRight = Cartesian3_default.add(center, northOffset, scratchCartesian53);
  173596. Cartesian3_default.add(upperRight, eastOffset, upperRight);
  173597. Cartesian3_default.multiplyComponents(radii, upperRight, upperRight);
  173598. Cartesian3_default.pack(upperRight, depthQuadScratch, 6);
  173599. const lowerRight = Cartesian3_default.subtract(
  173600. center,
  173601. northOffset,
  173602. scratchCartesian53
  173603. );
  173604. Cartesian3_default.add(lowerRight, eastOffset, lowerRight);
  173605. Cartesian3_default.multiplyComponents(radii, lowerRight, lowerRight);
  173606. Cartesian3_default.pack(lowerRight, depthQuadScratch, 9);
  173607. return depthQuadScratch;
  173608. }
  173609. DepthPlane.prototype.update = function(frameState) {
  173610. this._mode = frameState.mode;
  173611. if (frameState.mode !== SceneMode_default.SCENE3D) {
  173612. return;
  173613. }
  173614. const context = frameState.context;
  173615. const radii = frameState.mapProjection.ellipsoid.radii;
  173616. const ellipsoid = new Ellipsoid_default(
  173617. radii.x + this._ellipsoidOffset,
  173618. radii.y + this._ellipsoidOffset,
  173619. radii.z + this._ellipsoidOffset
  173620. );
  173621. const useLogDepth = frameState.useLogDepth;
  173622. if (!defined_default(this._command)) {
  173623. this._rs = RenderState_default.fromCache({
  173624. cull: {
  173625. enabled: true
  173626. },
  173627. depthTest: {
  173628. enabled: true
  173629. },
  173630. colorMask: {
  173631. red: false,
  173632. green: false,
  173633. blue: false,
  173634. alpha: false
  173635. }
  173636. });
  173637. this._command = new DrawCommand_default({
  173638. renderState: this._rs,
  173639. boundingVolume: new BoundingSphere_default(
  173640. Cartesian3_default.ZERO,
  173641. ellipsoid.maximumRadius
  173642. ),
  173643. pass: Pass_default.OPAQUE,
  173644. owner: this
  173645. });
  173646. }
  173647. if (!defined_default(this._sp) || this._useLogDepth !== useLogDepth) {
  173648. this._useLogDepth = useLogDepth;
  173649. const vs = new ShaderSource_default({
  173650. sources: [DepthPlaneVS_default]
  173651. });
  173652. const fs = new ShaderSource_default({
  173653. sources: [DepthPlaneFS_default]
  173654. });
  173655. if (useLogDepth) {
  173656. const extension = "#ifdef GL_EXT_frag_depth \n#extension GL_EXT_frag_depth : enable \n#endif \n\n";
  173657. fs.sources.push(extension);
  173658. fs.defines.push("LOG_DEPTH");
  173659. vs.defines.push("LOG_DEPTH");
  173660. }
  173661. this._sp = ShaderProgram_default.replaceCache({
  173662. shaderProgram: this._sp,
  173663. context,
  173664. vertexShaderSource: vs,
  173665. fragmentShaderSource: fs,
  173666. attributeLocations: {
  173667. position: 0
  173668. }
  173669. });
  173670. this._command.shaderProgram = this._sp;
  173671. }
  173672. const depthQuad = computeDepthQuad(ellipsoid, frameState);
  173673. if (!defined_default(this._va)) {
  173674. const geometry = new Geometry_default({
  173675. attributes: {
  173676. position: new GeometryAttribute_default({
  173677. componentDatatype: ComponentDatatype_default.FLOAT,
  173678. componentsPerAttribute: 3,
  173679. values: depthQuad
  173680. })
  173681. },
  173682. indices: [0, 1, 2, 2, 1, 3],
  173683. primitiveType: PrimitiveType_default.TRIANGLES
  173684. });
  173685. this._va = VertexArray_default.fromGeometry({
  173686. context,
  173687. geometry,
  173688. attributeLocations: {
  173689. position: 0
  173690. },
  173691. bufferUsage: BufferUsage_default.DYNAMIC_DRAW
  173692. });
  173693. this._command.vertexArray = this._va;
  173694. } else {
  173695. this._va.getAttribute(0).vertexBuffer.copyFromArrayView(depthQuad);
  173696. }
  173697. };
  173698. DepthPlane.prototype.execute = function(context, passState) {
  173699. if (this._mode === SceneMode_default.SCENE3D) {
  173700. this._command.execute(context, passState);
  173701. }
  173702. };
  173703. DepthPlane.prototype.isDestroyed = function() {
  173704. return false;
  173705. };
  173706. DepthPlane.prototype.destroy = function() {
  173707. this._sp = this._sp && this._sp.destroy();
  173708. this._va = this._va && this._va.destroy();
  173709. };
  173710. var DepthPlane_default = DepthPlane;
  173711. // node_modules/cesium/Source/Scene/DerivedCommand.js
  173712. function DerivedCommand() {
  173713. }
  173714. var fragDepthRegex = /\bgl_FragDepthEXT\b/;
  173715. var discardRegex = /\bdiscard\b/;
  173716. function getDepthOnlyShaderProgram(context, shaderProgram) {
  173717. let shader = context.shaderCache.getDerivedShaderProgram(
  173718. shaderProgram,
  173719. "depthOnly"
  173720. );
  173721. if (!defined_default(shader)) {
  173722. const attributeLocations8 = shaderProgram._attributeLocations;
  173723. let fs = shaderProgram.fragmentShaderSource;
  173724. let i2;
  173725. let writesDepthOrDiscards = false;
  173726. const sources = fs.sources;
  173727. let length3 = sources.length;
  173728. for (i2 = 0; i2 < length3; ++i2) {
  173729. if (fragDepthRegex.test(sources[i2]) || discardRegex.test(sources[i2])) {
  173730. writesDepthOrDiscards = true;
  173731. break;
  173732. }
  173733. }
  173734. let usesLogDepth = false;
  173735. const defines = fs.defines;
  173736. length3 = defines.length;
  173737. for (i2 = 0; i2 < length3; ++i2) {
  173738. if (defines[i2] === "LOG_DEPTH") {
  173739. usesLogDepth = true;
  173740. break;
  173741. }
  173742. }
  173743. let source;
  173744. if (!writesDepthOrDiscards && !usesLogDepth) {
  173745. source = "void main() \n{ \n gl_FragColor = vec4(1.0); \n} \n";
  173746. fs = new ShaderSource_default({
  173747. sources: [source]
  173748. });
  173749. } else if (!writesDepthOrDiscards && usesLogDepth) {
  173750. source = "#ifdef GL_EXT_frag_depth \n#extension GL_EXT_frag_depth : enable \n#endif \n\nvoid main() \n{ \n gl_FragColor = vec4(1.0); \n czm_writeLogDepth(); \n} \n";
  173751. fs = new ShaderSource_default({
  173752. defines: ["LOG_DEPTH"],
  173753. sources: [source]
  173754. });
  173755. }
  173756. shader = context.shaderCache.createDerivedShaderProgram(
  173757. shaderProgram,
  173758. "depthOnly",
  173759. {
  173760. vertexShaderSource: shaderProgram.vertexShaderSource,
  173761. fragmentShaderSource: fs,
  173762. attributeLocations: attributeLocations8
  173763. }
  173764. );
  173765. }
  173766. return shader;
  173767. }
  173768. function getDepthOnlyRenderState(scene, renderState) {
  173769. const cache = scene._depthOnlyRenderStateCache;
  173770. let depthOnlyState = cache[renderState.id];
  173771. if (!defined_default(depthOnlyState)) {
  173772. const rs = RenderState_default.getState(renderState);
  173773. rs.depthMask = true;
  173774. rs.colorMask = {
  173775. red: false,
  173776. green: false,
  173777. blue: false,
  173778. alpha: false
  173779. };
  173780. depthOnlyState = RenderState_default.fromCache(rs);
  173781. cache[renderState.id] = depthOnlyState;
  173782. }
  173783. return depthOnlyState;
  173784. }
  173785. DerivedCommand.createDepthOnlyDerivedCommand = function(scene, command, context, result) {
  173786. if (!defined_default(result)) {
  173787. result = {};
  173788. }
  173789. let shader;
  173790. let renderState;
  173791. if (defined_default(result.depthOnlyCommand)) {
  173792. shader = result.depthOnlyCommand.shaderProgram;
  173793. renderState = result.depthOnlyCommand.renderState;
  173794. }
  173795. result.depthOnlyCommand = DrawCommand_default.shallowClone(
  173796. command,
  173797. result.depthOnlyCommand
  173798. );
  173799. if (!defined_default(shader) || result.shaderProgramId !== command.shaderProgram.id) {
  173800. result.depthOnlyCommand.shaderProgram = getDepthOnlyShaderProgram(
  173801. context,
  173802. command.shaderProgram
  173803. );
  173804. result.depthOnlyCommand.renderState = getDepthOnlyRenderState(
  173805. scene,
  173806. command.renderState
  173807. );
  173808. result.shaderProgramId = command.shaderProgram.id;
  173809. } else {
  173810. result.depthOnlyCommand.shaderProgram = shader;
  173811. result.depthOnlyCommand.renderState = renderState;
  173812. }
  173813. return result;
  173814. };
  173815. var writeLogDepthRegex = /\s+czm_writeLogDepth\(/;
  173816. var vertexlogDepthRegex = /\s+czm_vertexLogDepth\(/;
  173817. var extensionRegex = /\s*#extension\s+GL_EXT_frag_depth\s*:\s*enable/;
  173818. function getLogDepthShaderProgram(context, shaderProgram) {
  173819. let shader = context.shaderCache.getDerivedShaderProgram(
  173820. shaderProgram,
  173821. "logDepth"
  173822. );
  173823. if (!defined_default(shader)) {
  173824. const attributeLocations8 = shaderProgram._attributeLocations;
  173825. const vs = shaderProgram.vertexShaderSource.clone();
  173826. const fs = shaderProgram.fragmentShaderSource.clone();
  173827. vs.defines = defined_default(vs.defines) ? vs.defines.slice(0) : [];
  173828. vs.defines.push("LOG_DEPTH");
  173829. fs.defines = defined_default(fs.defines) ? fs.defines.slice(0) : [];
  173830. fs.defines.push("LOG_DEPTH");
  173831. let i2;
  173832. let logMain;
  173833. let writesLogDepth = false;
  173834. let sources = vs.sources;
  173835. let length3 = sources.length;
  173836. for (i2 = 0; i2 < length3; ++i2) {
  173837. if (vertexlogDepthRegex.test(sources[i2])) {
  173838. writesLogDepth = true;
  173839. break;
  173840. }
  173841. }
  173842. if (!writesLogDepth) {
  173843. for (i2 = 0; i2 < length3; ++i2) {
  173844. sources[i2] = ShaderSource_default.replaceMain(sources[i2], "czm_log_depth_main");
  173845. }
  173846. logMain = "\n\nvoid main() \n{ \n czm_log_depth_main(); \n czm_vertexLogDepth(); \n} \n";
  173847. sources.push(logMain);
  173848. }
  173849. sources = fs.sources;
  173850. length3 = sources.length;
  173851. writesLogDepth = false;
  173852. for (i2 = 0; i2 < length3; ++i2) {
  173853. if (writeLogDepthRegex.test(sources[i2])) {
  173854. writesLogDepth = true;
  173855. }
  173856. }
  173857. if (fs.defines.indexOf("LOG_DEPTH_WRITE") !== -1) {
  173858. writesLogDepth = true;
  173859. }
  173860. let addExtension = true;
  173861. for (i2 = 0; i2 < length3; ++i2) {
  173862. if (extensionRegex.test(sources[i2])) {
  173863. addExtension = false;
  173864. }
  173865. }
  173866. let logSource = "";
  173867. if (addExtension) {
  173868. logSource += "#ifdef GL_EXT_frag_depth \n#extension GL_EXT_frag_depth : enable \n#endif \n\n";
  173869. }
  173870. if (!writesLogDepth) {
  173871. for (i2 = 0; i2 < length3; i2++) {
  173872. sources[i2] = ShaderSource_default.replaceMain(sources[i2], "czm_log_depth_main");
  173873. }
  173874. logSource += "\nvoid main() \n{ \n czm_log_depth_main(); \n czm_writeLogDepth(); \n} \n";
  173875. }
  173876. sources.push(logSource);
  173877. shader = context.shaderCache.createDerivedShaderProgram(
  173878. shaderProgram,
  173879. "logDepth",
  173880. {
  173881. vertexShaderSource: vs,
  173882. fragmentShaderSource: fs,
  173883. attributeLocations: attributeLocations8
  173884. }
  173885. );
  173886. }
  173887. return shader;
  173888. }
  173889. DerivedCommand.createLogDepthCommand = function(command, context, result) {
  173890. if (!defined_default(result)) {
  173891. result = {};
  173892. }
  173893. let shader;
  173894. if (defined_default(result.command)) {
  173895. shader = result.command.shaderProgram;
  173896. }
  173897. result.command = DrawCommand_default.shallowClone(command, result.command);
  173898. if (!defined_default(shader) || result.shaderProgramId !== command.shaderProgram.id) {
  173899. result.command.shaderProgram = getLogDepthShaderProgram(
  173900. context,
  173901. command.shaderProgram
  173902. );
  173903. result.shaderProgramId = command.shaderProgram.id;
  173904. } else {
  173905. result.command.shaderProgram = shader;
  173906. }
  173907. return result;
  173908. };
  173909. function getPickShaderProgram(context, shaderProgram, pickId) {
  173910. let shader = context.shaderCache.getDerivedShaderProgram(
  173911. shaderProgram,
  173912. "pick"
  173913. );
  173914. if (!defined_default(shader)) {
  173915. const attributeLocations8 = shaderProgram._attributeLocations;
  173916. let fs = shaderProgram.fragmentShaderSource;
  173917. const sources = fs.sources;
  173918. const length3 = sources.length;
  173919. const newMain = `${"void main() \n{ \n czm_non_pick_main(); \n if (gl_FragColor.a == 0.0) { \n discard; \n } \n gl_FragColor = "}${pickId};
  173920. }
  173921. `;
  173922. const newSources = new Array(length3 + 1);
  173923. for (let i2 = 0; i2 < length3; ++i2) {
  173924. newSources[i2] = ShaderSource_default.replaceMain(sources[i2], "czm_non_pick_main");
  173925. }
  173926. newSources[length3] = newMain;
  173927. fs = new ShaderSource_default({
  173928. sources: newSources,
  173929. defines: fs.defines
  173930. });
  173931. shader = context.shaderCache.createDerivedShaderProgram(
  173932. shaderProgram,
  173933. "pick",
  173934. {
  173935. vertexShaderSource: shaderProgram.vertexShaderSource,
  173936. fragmentShaderSource: fs,
  173937. attributeLocations: attributeLocations8
  173938. }
  173939. );
  173940. }
  173941. return shader;
  173942. }
  173943. function getPickRenderState(scene, renderState) {
  173944. const cache = scene.picking.pickRenderStateCache;
  173945. let pickState = cache[renderState.id];
  173946. if (!defined_default(pickState)) {
  173947. const rs = RenderState_default.getState(renderState);
  173948. rs.blending.enabled = false;
  173949. rs.depthMask = true;
  173950. pickState = RenderState_default.fromCache(rs);
  173951. cache[renderState.id] = pickState;
  173952. }
  173953. return pickState;
  173954. }
  173955. DerivedCommand.createPickDerivedCommand = function(scene, command, context, result) {
  173956. if (!defined_default(result)) {
  173957. result = {};
  173958. }
  173959. let shader;
  173960. let renderState;
  173961. if (defined_default(result.pickCommand)) {
  173962. shader = result.pickCommand.shaderProgram;
  173963. renderState = result.pickCommand.renderState;
  173964. }
  173965. result.pickCommand = DrawCommand_default.shallowClone(command, result.pickCommand);
  173966. if (!defined_default(shader) || result.shaderProgramId !== command.shaderProgram.id) {
  173967. result.pickCommand.shaderProgram = getPickShaderProgram(
  173968. context,
  173969. command.shaderProgram,
  173970. command.pickId
  173971. );
  173972. result.pickCommand.renderState = getPickRenderState(
  173973. scene,
  173974. command.renderState
  173975. );
  173976. result.shaderProgramId = command.shaderProgram.id;
  173977. } else {
  173978. result.pickCommand.shaderProgram = shader;
  173979. result.pickCommand.renderState = renderState;
  173980. }
  173981. return result;
  173982. };
  173983. function getHdrShaderProgram(context, shaderProgram) {
  173984. let shader = context.shaderCache.getDerivedShaderProgram(
  173985. shaderProgram,
  173986. "HDR"
  173987. );
  173988. if (!defined_default(shader)) {
  173989. const attributeLocations8 = shaderProgram._attributeLocations;
  173990. const vs = shaderProgram.vertexShaderSource.clone();
  173991. const fs = shaderProgram.fragmentShaderSource.clone();
  173992. vs.defines = defined_default(vs.defines) ? vs.defines.slice(0) : [];
  173993. vs.defines.push("HDR");
  173994. fs.defines = defined_default(fs.defines) ? fs.defines.slice(0) : [];
  173995. fs.defines.push("HDR");
  173996. shader = context.shaderCache.createDerivedShaderProgram(
  173997. shaderProgram,
  173998. "HDR",
  173999. {
  174000. vertexShaderSource: vs,
  174001. fragmentShaderSource: fs,
  174002. attributeLocations: attributeLocations8
  174003. }
  174004. );
  174005. }
  174006. return shader;
  174007. }
  174008. DerivedCommand.createHdrCommand = function(command, context, result) {
  174009. if (!defined_default(result)) {
  174010. result = {};
  174011. }
  174012. let shader;
  174013. if (defined_default(result.command)) {
  174014. shader = result.command.shaderProgram;
  174015. }
  174016. result.command = DrawCommand_default.shallowClone(command, result.command);
  174017. if (!defined_default(shader) || result.shaderProgramId !== command.shaderProgram.id) {
  174018. result.command.shaderProgram = getHdrShaderProgram(
  174019. context,
  174020. command.shaderProgram
  174021. );
  174022. result.shaderProgramId = command.shaderProgram.id;
  174023. } else {
  174024. result.command.shaderProgram = shader;
  174025. }
  174026. return result;
  174027. };
  174028. var DerivedCommand_default = DerivedCommand;
  174029. // node_modules/cesium/Source/Scene/DeviceOrientationCameraController.js
  174030. function DeviceOrientationCameraController(scene) {
  174031. if (!defined_default(scene)) {
  174032. throw new DeveloperError_default("scene is required.");
  174033. }
  174034. this._scene = scene;
  174035. this._lastAlpha = void 0;
  174036. this._lastBeta = void 0;
  174037. this._lastGamma = void 0;
  174038. this._alpha = void 0;
  174039. this._beta = void 0;
  174040. this._gamma = void 0;
  174041. const that = this;
  174042. function callback(e2) {
  174043. const alpha = e2.alpha;
  174044. if (!defined_default(alpha)) {
  174045. that._alpha = void 0;
  174046. that._beta = void 0;
  174047. that._gamma = void 0;
  174048. return;
  174049. }
  174050. that._alpha = Math_default.toRadians(alpha);
  174051. that._beta = Math_default.toRadians(e2.beta);
  174052. that._gamma = Math_default.toRadians(e2.gamma);
  174053. }
  174054. window.addEventListener("deviceorientation", callback, false);
  174055. this._removeListener = function() {
  174056. window.removeEventListener("deviceorientation", callback, false);
  174057. };
  174058. }
  174059. var scratchQuaternion1 = new Quaternion_default();
  174060. var scratchQuaternion2 = new Quaternion_default();
  174061. var scratchMatrix32 = new Matrix3_default();
  174062. function rotate2(camera, alpha, beta, gamma) {
  174063. const direction2 = camera.direction;
  174064. const right = camera.right;
  174065. const up = camera.up;
  174066. const bQuat = Quaternion_default.fromAxisAngle(direction2, beta, scratchQuaternion2);
  174067. const gQuat = Quaternion_default.fromAxisAngle(right, gamma, scratchQuaternion1);
  174068. const rotQuat = Quaternion_default.multiply(gQuat, bQuat, gQuat);
  174069. const aQuat = Quaternion_default.fromAxisAngle(up, alpha, scratchQuaternion2);
  174070. Quaternion_default.multiply(aQuat, rotQuat, rotQuat);
  174071. const matrix = Matrix3_default.fromQuaternion(rotQuat, scratchMatrix32);
  174072. Matrix3_default.multiplyByVector(matrix, right, right);
  174073. Matrix3_default.multiplyByVector(matrix, up, up);
  174074. Matrix3_default.multiplyByVector(matrix, direction2, direction2);
  174075. }
  174076. DeviceOrientationCameraController.prototype.update = function() {
  174077. if (!defined_default(this._alpha)) {
  174078. return;
  174079. }
  174080. if (!defined_default(this._lastAlpha)) {
  174081. this._lastAlpha = this._alpha;
  174082. this._lastBeta = this._beta;
  174083. this._lastGamma = this._gamma;
  174084. }
  174085. const a4 = this._lastAlpha - this._alpha;
  174086. const b = this._lastBeta - this._beta;
  174087. const g = this._lastGamma - this._gamma;
  174088. rotate2(this._scene.camera, -a4, b, g);
  174089. this._lastAlpha = this._alpha;
  174090. this._lastBeta = this._beta;
  174091. this._lastGamma = this._gamma;
  174092. };
  174093. DeviceOrientationCameraController.prototype.isDestroyed = function() {
  174094. return false;
  174095. };
  174096. DeviceOrientationCameraController.prototype.destroy = function() {
  174097. this._removeListener();
  174098. return destroyObject_default(this);
  174099. };
  174100. var DeviceOrientationCameraController_default = DeviceOrientationCameraController;
  174101. // node_modules/cesium/Source/Scene/DirectionalLight.js
  174102. function DirectionalLight(options) {
  174103. Check_default.typeOf.object("options", options);
  174104. Check_default.typeOf.object("options.direction", options.direction);
  174105. if (Cartesian3_default.equals(options.direction, Cartesian3_default.ZERO)) {
  174106. throw new DeveloperError_default("options.direction cannot be zero-length");
  174107. }
  174108. this.direction = Cartesian3_default.clone(options.direction);
  174109. this.color = Color_default.clone(defaultValue_default(options.color, Color_default.WHITE));
  174110. this.intensity = defaultValue_default(options.intensity, 1);
  174111. }
  174112. var DirectionalLight_default = DirectionalLight;
  174113. // node_modules/cesium/Source/Shaders/EllipsoidFS.js
  174114. var EllipsoidFS_default = "#ifdef WRITE_DEPTH\n#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n#endif\n#endif\n\nuniform vec3 u_radii;\nuniform vec3 u_oneOverEllipsoidRadiiSquared;\n\nvarying vec3 v_positionEC;\n\nvec4 computeEllipsoidColor(czm_ray ray, float intersection, float side)\n{\n vec3 positionEC = czm_pointAlongRay(ray, intersection);\n vec3 positionMC = (czm_inverseModelView * vec4(positionEC, 1.0)).xyz;\n vec3 geodeticNormal = normalize(czm_geodeticSurfaceNormal(positionMC, vec3(0.0), u_oneOverEllipsoidRadiiSquared));\n vec3 sphericalNormal = normalize(positionMC / u_radii);\n vec3 normalMC = geodeticNormal * side; // normalized surface normal (always facing the viewer) in model coordinates\n vec3 normalEC = normalize(czm_normal * normalMC); // normalized surface normal in eye coordiantes\n\n vec2 st = czm_ellipsoidWgs84TextureCoordinates(sphericalNormal);\n vec3 positionToEyeEC = -positionEC;\n\n czm_materialInput materialInput;\n materialInput.s = st.s;\n materialInput.st = st;\n materialInput.str = (positionMC + u_radii) / u_radii;\n materialInput.normalEC = normalEC;\n materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);\n materialInput.positionToEyeEC = positionToEyeEC;\n czm_material material = czm_getMaterial(materialInput);\n\n#ifdef ONLY_SUN_LIGHTING\n return czm_private_phong(normalize(positionToEyeEC), material, czm_sunDirectionEC);\n#else\n return czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n#endif\n}\n\nvoid main()\n{\n // PERFORMANCE_TODO: When dynamic branching is available, compute ratio of maximum and minimum radii\n // in the vertex shader. Only when it is larger than some constant, march along the ray.\n // Otherwise perform one intersection test which will be the common case.\n\n // Test if the ray intersects a sphere with the ellipsoid's maximum radius.\n // For very oblate ellipsoids, using the ellipsoid's radii for an intersection test\n // may cause false negatives. This will discard fragments before marching the ray forward.\n float maxRadius = max(u_radii.x, max(u_radii.y, u_radii.z)) * 1.5;\n vec3 direction = normalize(v_positionEC);\n vec3 ellipsoidCenter = czm_modelView[3].xyz;\n\n float t1 = -1.0;\n float t2 = -1.0;\n\n float b = -2.0 * dot(direction, ellipsoidCenter);\n float c = dot(ellipsoidCenter, ellipsoidCenter) - maxRadius * maxRadius;\n\n float discriminant = b * b - 4.0 * c;\n if (discriminant >= 0.0) {\n t1 = (-b - sqrt(discriminant)) * 0.5;\n t2 = (-b + sqrt(discriminant)) * 0.5;\n }\n\n if (t1 < 0.0 && t2 < 0.0) {\n discard;\n }\n\n float t = min(t1, t2);\n if (t < 0.0) {\n t = 0.0;\n }\n\n // March ray forward to intersection with larger sphere and find\n czm_ray ray = czm_ray(t * direction, direction);\n\n vec3 ellipsoid_inverseRadii = vec3(1.0 / u_radii.x, 1.0 / u_radii.y, 1.0 / u_radii.z);\n\n czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoidCenter, ellipsoid_inverseRadii);\n\n if (czm_isEmpty(intersection))\n {\n discard;\n }\n\n // If the viewer is outside, compute outsideFaceColor, with normals facing outward.\n vec4 outsideFaceColor = (intersection.start != 0.0) ? computeEllipsoidColor(ray, intersection.start, 1.0) : vec4(0.0);\n\n // If the viewer either is inside or can see inside, compute insideFaceColor, with normals facing inward.\n vec4 insideFaceColor = (outsideFaceColor.a < 1.0) ? computeEllipsoidColor(ray, intersection.stop, -1.0) : vec4(0.0);\n\n gl_FragColor = mix(insideFaceColor, outsideFaceColor, outsideFaceColor.a);\n gl_FragColor.a = 1.0 - (1.0 - insideFaceColor.a) * (1.0 - outsideFaceColor.a);\n\n#ifdef WRITE_DEPTH\n#ifdef GL_EXT_frag_depth\n t = (intersection.start != 0.0) ? intersection.start : intersection.stop;\n vec3 positionEC = czm_pointAlongRay(ray, t);\n vec4 positionCC = czm_projection * vec4(positionEC, 1.0);\n#ifdef LOG_DEPTH\n czm_writeLogDepth(1.0 + positionCC.w);\n#else\n float z = positionCC.z / positionCC.w;\n\n float n = czm_depthRange.near;\n float f = czm_depthRange.far;\n\n gl_FragDepthEXT = (z * (f - n) + f + n) * 0.5;\n#endif\n#endif\n#endif\n}\n";
  174115. // node_modules/cesium/Source/Shaders/EllipsoidVS.js
  174116. var EllipsoidVS_default = "attribute vec3 position;\n\nuniform vec3 u_radii;\n\nvarying vec3 v_positionEC;\n\nvoid main()\n{\n // In the vertex data, the cube goes from (-1.0, -1.0, -1.0) to (1.0, 1.0, 1.0) in model coordinates.\n // Scale to consider the radii. We could also do this once on the CPU when using the BoxGeometry,\n // but doing it here allows us to change the radii without rewriting the vertex data, and\n // allows all ellipsoids to reuse the same vertex data.\n vec4 p = vec4(u_radii * position, 1.0);\n\n v_positionEC = (czm_modelView * p).xyz; // position in eye coordinates\n gl_Position = czm_modelViewProjection * p; // position in clip coordinates\n\n // With multi-frustum, when the ellipsoid primitive is positioned on the intersection of two frustums\n // and close to terrain, the terrain (writes depth) in the closest frustum can overwrite part of the\n // ellipsoid (does not write depth) that was rendered in the farther frustum.\n //\n // Here, we clamp the depth in the vertex shader to avoid being overwritten; however, this creates\n // artifacts since some fragments can be alpha blended twice. This is solved by only rendering\n // the ellipsoid in the closest frustum to the viewer.\n gl_Position.z = clamp(gl_Position.z, czm_depthRange.near, czm_depthRange.far);\n\n czm_vertexLogDepth();\n}\n";
  174117. // node_modules/cesium/Source/Scene/EllipsoidPrimitive.js
  174118. var attributeLocations7 = {
  174119. position: 0
  174120. };
  174121. function EllipsoidPrimitive(options) {
  174122. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  174123. this.center = Cartesian3_default.clone(defaultValue_default(options.center, Cartesian3_default.ZERO));
  174124. this._center = new Cartesian3_default();
  174125. this.radii = Cartesian3_default.clone(options.radii);
  174126. this._radii = new Cartesian3_default();
  174127. this._oneOverEllipsoidRadiiSquared = new Cartesian3_default();
  174128. this._boundingSphere = new BoundingSphere_default();
  174129. this.modelMatrix = Matrix4_default.clone(
  174130. defaultValue_default(options.modelMatrix, Matrix4_default.IDENTITY)
  174131. );
  174132. this._modelMatrix = new Matrix4_default();
  174133. this._computedModelMatrix = new Matrix4_default();
  174134. this.show = defaultValue_default(options.show, true);
  174135. this.material = defaultValue_default(
  174136. options.material,
  174137. Material_default.fromType(Material_default.ColorType)
  174138. );
  174139. this._material = void 0;
  174140. this._translucent = void 0;
  174141. this.id = options.id;
  174142. this._id = void 0;
  174143. this.debugShowBoundingVolume = defaultValue_default(
  174144. options.debugShowBoundingVolume,
  174145. false
  174146. );
  174147. this.onlySunLighting = defaultValue_default(options.onlySunLighting, false);
  174148. this._onlySunLighting = false;
  174149. this._depthTestEnabled = defaultValue_default(options.depthTestEnabled, true);
  174150. this._useLogDepth = false;
  174151. this._sp = void 0;
  174152. this._rs = void 0;
  174153. this._va = void 0;
  174154. this._pickSP = void 0;
  174155. this._pickId = void 0;
  174156. this._colorCommand = new DrawCommand_default({
  174157. owner: defaultValue_default(options._owner, this)
  174158. });
  174159. this._pickCommand = new DrawCommand_default({
  174160. owner: defaultValue_default(options._owner, this),
  174161. pickOnly: true
  174162. });
  174163. const that = this;
  174164. this._uniforms = {
  174165. u_radii: function() {
  174166. return that.radii;
  174167. },
  174168. u_oneOverEllipsoidRadiiSquared: function() {
  174169. return that._oneOverEllipsoidRadiiSquared;
  174170. }
  174171. };
  174172. this._pickUniforms = {
  174173. czm_pickColor: function() {
  174174. return that._pickId.color;
  174175. }
  174176. };
  174177. }
  174178. function getVertexArray(context) {
  174179. let vertexArray = context.cache.ellipsoidPrimitive_vertexArray;
  174180. if (defined_default(vertexArray)) {
  174181. return vertexArray;
  174182. }
  174183. const geometry = BoxGeometry_default.createGeometry(
  174184. BoxGeometry_default.fromDimensions({
  174185. dimensions: new Cartesian3_default(2, 2, 2),
  174186. vertexFormat: VertexFormat_default.POSITION_ONLY
  174187. })
  174188. );
  174189. vertexArray = VertexArray_default.fromGeometry({
  174190. context,
  174191. geometry,
  174192. attributeLocations: attributeLocations7,
  174193. bufferUsage: BufferUsage_default.STATIC_DRAW,
  174194. interleave: true
  174195. });
  174196. context.cache.ellipsoidPrimitive_vertexArray = vertexArray;
  174197. return vertexArray;
  174198. }
  174199. var logDepthExtension = "#ifdef GL_EXT_frag_depth \n#extension GL_EXT_frag_depth : enable \n#endif \n\n";
  174200. EllipsoidPrimitive.prototype.update = function(frameState) {
  174201. if (!this.show || frameState.mode !== SceneMode_default.SCENE3D || !defined_default(this.center) || !defined_default(this.radii)) {
  174202. return;
  174203. }
  174204. if (!defined_default(this.material)) {
  174205. throw new DeveloperError_default("this.material must be defined.");
  174206. }
  174207. const context = frameState.context;
  174208. const translucent = this.material.isTranslucent();
  174209. const translucencyChanged = this._translucent !== translucent;
  174210. if (!defined_default(this._rs) || translucencyChanged) {
  174211. this._translucent = translucent;
  174212. this._rs = RenderState_default.fromCache({
  174213. cull: {
  174214. enabled: true,
  174215. face: CullFace_default.FRONT
  174216. },
  174217. depthTest: {
  174218. enabled: this._depthTestEnabled
  174219. },
  174220. depthMask: !translucent && context.fragmentDepth,
  174221. blending: translucent ? BlendingState_default.ALPHA_BLEND : void 0
  174222. });
  174223. }
  174224. if (!defined_default(this._va)) {
  174225. this._va = getVertexArray(context);
  174226. }
  174227. let boundingSphereDirty = false;
  174228. const radii = this.radii;
  174229. if (!Cartesian3_default.equals(this._radii, radii)) {
  174230. Cartesian3_default.clone(radii, this._radii);
  174231. const r2 = this._oneOverEllipsoidRadiiSquared;
  174232. r2.x = 1 / (radii.x * radii.x);
  174233. r2.y = 1 / (radii.y * radii.y);
  174234. r2.z = 1 / (radii.z * radii.z);
  174235. boundingSphereDirty = true;
  174236. }
  174237. if (!Matrix4_default.equals(this.modelMatrix, this._modelMatrix) || !Cartesian3_default.equals(this.center, this._center)) {
  174238. Matrix4_default.clone(this.modelMatrix, this._modelMatrix);
  174239. Cartesian3_default.clone(this.center, this._center);
  174240. Matrix4_default.multiplyByTranslation(
  174241. this.modelMatrix,
  174242. this.center,
  174243. this._computedModelMatrix
  174244. );
  174245. boundingSphereDirty = true;
  174246. }
  174247. if (boundingSphereDirty) {
  174248. Cartesian3_default.clone(Cartesian3_default.ZERO, this._boundingSphere.center);
  174249. this._boundingSphere.radius = Cartesian3_default.maximumComponent(radii);
  174250. BoundingSphere_default.transform(
  174251. this._boundingSphere,
  174252. this._computedModelMatrix,
  174253. this._boundingSphere
  174254. );
  174255. }
  174256. const materialChanged = this._material !== this.material;
  174257. this._material = this.material;
  174258. this._material.update(context);
  174259. const lightingChanged = this.onlySunLighting !== this._onlySunLighting;
  174260. this._onlySunLighting = this.onlySunLighting;
  174261. const useLogDepth = frameState.useLogDepth;
  174262. const useLogDepthChanged = this._useLogDepth !== useLogDepth;
  174263. this._useLogDepth = useLogDepth;
  174264. const colorCommand = this._colorCommand;
  174265. let vs;
  174266. let fs;
  174267. if (materialChanged || lightingChanged || translucencyChanged || useLogDepthChanged) {
  174268. vs = new ShaderSource_default({
  174269. sources: [EllipsoidVS_default]
  174270. });
  174271. fs = new ShaderSource_default({
  174272. sources: [this.material.shaderSource, EllipsoidFS_default]
  174273. });
  174274. if (this.onlySunLighting) {
  174275. fs.defines.push("ONLY_SUN_LIGHTING");
  174276. }
  174277. if (!translucent && context.fragmentDepth) {
  174278. fs.defines.push("WRITE_DEPTH");
  174279. }
  174280. if (this._useLogDepth) {
  174281. vs.defines.push("LOG_DEPTH");
  174282. fs.defines.push("LOG_DEPTH");
  174283. fs.sources.push(logDepthExtension);
  174284. }
  174285. this._sp = ShaderProgram_default.replaceCache({
  174286. context,
  174287. shaderProgram: this._sp,
  174288. vertexShaderSource: vs,
  174289. fragmentShaderSource: fs,
  174290. attributeLocations: attributeLocations7
  174291. });
  174292. colorCommand.vertexArray = this._va;
  174293. colorCommand.renderState = this._rs;
  174294. colorCommand.shaderProgram = this._sp;
  174295. colorCommand.uniformMap = combine_default(this._uniforms, this.material._uniforms);
  174296. colorCommand.executeInClosestFrustum = translucent;
  174297. }
  174298. const commandList = frameState.commandList;
  174299. const passes = frameState.passes;
  174300. if (passes.render) {
  174301. colorCommand.boundingVolume = this._boundingSphere;
  174302. colorCommand.debugShowBoundingVolume = this.debugShowBoundingVolume;
  174303. colorCommand.modelMatrix = this._computedModelMatrix;
  174304. colorCommand.pass = translucent ? Pass_default.TRANSLUCENT : Pass_default.OPAQUE;
  174305. commandList.push(colorCommand);
  174306. }
  174307. if (passes.pick) {
  174308. const pickCommand = this._pickCommand;
  174309. if (!defined_default(this._pickId) || this._id !== this.id) {
  174310. this._id = this.id;
  174311. this._pickId = this._pickId && this._pickId.destroy();
  174312. this._pickId = context.createPickId({
  174313. primitive: this,
  174314. id: this.id
  174315. });
  174316. }
  174317. if (materialChanged || lightingChanged || !defined_default(this._pickSP) || useLogDepthChanged) {
  174318. vs = new ShaderSource_default({
  174319. sources: [EllipsoidVS_default]
  174320. });
  174321. fs = new ShaderSource_default({
  174322. sources: [this.material.shaderSource, EllipsoidFS_default],
  174323. pickColorQualifier: "uniform"
  174324. });
  174325. if (this.onlySunLighting) {
  174326. fs.defines.push("ONLY_SUN_LIGHTING");
  174327. }
  174328. if (!translucent && context.fragmentDepth) {
  174329. fs.defines.push("WRITE_DEPTH");
  174330. }
  174331. if (this._useLogDepth) {
  174332. vs.defines.push("LOG_DEPTH");
  174333. fs.defines.push("LOG_DEPTH");
  174334. fs.sources.push(logDepthExtension);
  174335. }
  174336. this._pickSP = ShaderProgram_default.replaceCache({
  174337. context,
  174338. shaderProgram: this._pickSP,
  174339. vertexShaderSource: vs,
  174340. fragmentShaderSource: fs,
  174341. attributeLocations: attributeLocations7
  174342. });
  174343. pickCommand.vertexArray = this._va;
  174344. pickCommand.renderState = this._rs;
  174345. pickCommand.shaderProgram = this._pickSP;
  174346. pickCommand.uniformMap = combine_default(
  174347. combine_default(this._uniforms, this._pickUniforms),
  174348. this.material._uniforms
  174349. );
  174350. pickCommand.executeInClosestFrustum = translucent;
  174351. }
  174352. pickCommand.boundingVolume = this._boundingSphere;
  174353. pickCommand.modelMatrix = this._computedModelMatrix;
  174354. pickCommand.pass = translucent ? Pass_default.TRANSLUCENT : Pass_default.OPAQUE;
  174355. commandList.push(pickCommand);
  174356. }
  174357. };
  174358. EllipsoidPrimitive.prototype.isDestroyed = function() {
  174359. return false;
  174360. };
  174361. EllipsoidPrimitive.prototype.destroy = function() {
  174362. this._sp = this._sp && this._sp.destroy();
  174363. this._pickSP = this._pickSP && this._pickSP.destroy();
  174364. this._pickId = this._pickId && this._pickId.destroy();
  174365. return destroyObject_default(this);
  174366. };
  174367. var EllipsoidPrimitive_default = EllipsoidPrimitive;
  174368. // node_modules/cesium/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.js
  174369. var EllipsoidSurfaceAppearanceFS_default = "varying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\n\nvoid main()\n{\n czm_materialInput materialInput;\n\n vec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\n#ifdef FACE_FORWARD\n normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\n\n materialInput.s = v_st.s;\n materialInput.st = v_st;\n materialInput.str = vec3(v_st, 0.0);\n\n // Convert tangent space material normal to eye space\n materialInput.normalEC = normalEC;\n materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);\n\n // Convert view vector to world space\n vec3 positionToEyeEC = -v_positionEC;\n materialInput.positionToEyeEC = positionToEyeEC;\n\n czm_material material = czm_getMaterial(materialInput);\n\n#ifdef FLAT\n gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\n gl_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n#endif\n}\n";
  174370. // node_modules/cesium/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.js
  174371. var EllipsoidSurfaceAppearanceVS_default = "attribute vec3 position3DHigh;\nattribute vec3 position3DLow;\nattribute vec2 st;\nattribute float batchId;\n\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\n\nvoid main()\n{\n vec4 p = czm_computePosition();\n\n v_positionMC = position3DHigh + position3DLow; // position in model coordinates\n v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates\n v_st = st;\n\n gl_Position = czm_modelViewProjectionRelativeToEye * p;\n}\n";
  174372. // node_modules/cesium/Source/Scene/EllipsoidSurfaceAppearance.js
  174373. function EllipsoidSurfaceAppearance(options) {
  174374. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  174375. const translucent = defaultValue_default(options.translucent, true);
  174376. const aboveGround = defaultValue_default(options.aboveGround, false);
  174377. this.material = defined_default(options.material) ? options.material : Material_default.fromType(Material_default.ColorType);
  174378. this.translucent = defaultValue_default(options.translucent, true);
  174379. this._vertexShaderSource = defaultValue_default(
  174380. options.vertexShaderSource,
  174381. EllipsoidSurfaceAppearanceVS_default
  174382. );
  174383. this._fragmentShaderSource = defaultValue_default(
  174384. options.fragmentShaderSource,
  174385. EllipsoidSurfaceAppearanceFS_default
  174386. );
  174387. this._renderState = Appearance_default.getDefaultRenderState(
  174388. translucent,
  174389. !aboveGround,
  174390. options.renderState
  174391. );
  174392. this._closed = false;
  174393. this._flat = defaultValue_default(options.flat, false);
  174394. this._faceForward = defaultValue_default(options.faceForward, aboveGround);
  174395. this._aboveGround = aboveGround;
  174396. }
  174397. Object.defineProperties(EllipsoidSurfaceAppearance.prototype, {
  174398. vertexShaderSource: {
  174399. get: function() {
  174400. return this._vertexShaderSource;
  174401. }
  174402. },
  174403. fragmentShaderSource: {
  174404. get: function() {
  174405. return this._fragmentShaderSource;
  174406. }
  174407. },
  174408. renderState: {
  174409. get: function() {
  174410. return this._renderState;
  174411. }
  174412. },
  174413. closed: {
  174414. get: function() {
  174415. return this._closed;
  174416. }
  174417. },
  174418. vertexFormat: {
  174419. get: function() {
  174420. return EllipsoidSurfaceAppearance.VERTEX_FORMAT;
  174421. }
  174422. },
  174423. flat: {
  174424. get: function() {
  174425. return this._flat;
  174426. }
  174427. },
  174428. faceForward: {
  174429. get: function() {
  174430. return this._faceForward;
  174431. }
  174432. },
  174433. aboveGround: {
  174434. get: function() {
  174435. return this._aboveGround;
  174436. }
  174437. }
  174438. });
  174439. EllipsoidSurfaceAppearance.VERTEX_FORMAT = VertexFormat_default.POSITION_AND_ST;
  174440. EllipsoidSurfaceAppearance.prototype.getFragmentShaderSource = Appearance_default.prototype.getFragmentShaderSource;
  174441. EllipsoidSurfaceAppearance.prototype.isTranslucent = Appearance_default.prototype.isTranslucent;
  174442. EllipsoidSurfaceAppearance.prototype.getRenderState = Appearance_default.prototype.getRenderState;
  174443. var EllipsoidSurfaceAppearance_default = EllipsoidSurfaceAppearance;
  174444. // node_modules/cesium/Source/Scene/Fog.js
  174445. function Fog() {
  174446. this.enabled = true;
  174447. this.renderable = true;
  174448. this.density = 2e-4;
  174449. this.screenSpaceErrorFactor = 2;
  174450. this.minimumBrightness = 0.03;
  174451. }
  174452. var heightsTable = [
  174453. 359.393,
  174454. 800.749,
  174455. 1275.6501,
  174456. 2151.1192,
  174457. 3141.7763,
  174458. 4777.5198,
  174459. 6281.2493,
  174460. 12364.307,
  174461. 15900.765,
  174462. 49889.0549,
  174463. 78026.8259,
  174464. 99260.7344,
  174465. 120036.3873,
  174466. 151011.0158,
  174467. 156091.1953,
  174468. 203849.3112,
  174469. 274866.9803,
  174470. 319916.3149,
  174471. 493552.0528,
  174472. 628733.5874
  174473. ];
  174474. var densityTable = [
  174475. 2e-5,
  174476. 2e-4,
  174477. 1e-4,
  174478. 7e-5,
  174479. 5e-5,
  174480. 4e-5,
  174481. 3e-5,
  174482. 19e-6,
  174483. 1e-5,
  174484. 85e-7,
  174485. 62e-7,
  174486. 58e-7,
  174487. 53e-7,
  174488. 52e-7,
  174489. 51e-7,
  174490. 42e-7,
  174491. 4e-6,
  174492. 34e-7,
  174493. 26e-7,
  174494. 22e-7
  174495. ];
  174496. for (let i2 = 0; i2 < densityTable.length; ++i2) {
  174497. densityTable[i2] *= 1e6;
  174498. }
  174499. var tableStartDensity = densityTable[1];
  174500. var tableEndDensity = densityTable[densityTable.length - 1];
  174501. for (let j = 0; j < densityTable.length; ++j) {
  174502. densityTable[j] = (densityTable[j] - tableEndDensity) / (tableStartDensity - tableEndDensity);
  174503. }
  174504. var tableLastIndex = 0;
  174505. function findInterval(height) {
  174506. const heights = heightsTable;
  174507. const length3 = heights.length;
  174508. if (height < heights[0]) {
  174509. tableLastIndex = 0;
  174510. return tableLastIndex;
  174511. } else if (height > heights[length3 - 1]) {
  174512. tableLastIndex = length3 - 2;
  174513. return tableLastIndex;
  174514. }
  174515. if (height >= heights[tableLastIndex]) {
  174516. if (tableLastIndex + 1 < length3 && height < heights[tableLastIndex + 1]) {
  174517. return tableLastIndex;
  174518. } else if (tableLastIndex + 2 < length3 && height < heights[tableLastIndex + 2]) {
  174519. ++tableLastIndex;
  174520. return tableLastIndex;
  174521. }
  174522. } else if (tableLastIndex - 1 >= 0 && height >= heights[tableLastIndex - 1]) {
  174523. --tableLastIndex;
  174524. return tableLastIndex;
  174525. }
  174526. let i2;
  174527. for (i2 = 0; i2 < length3 - 2; ++i2) {
  174528. if (height >= heights[i2] && height < heights[i2 + 1]) {
  174529. break;
  174530. }
  174531. }
  174532. tableLastIndex = i2;
  174533. return tableLastIndex;
  174534. }
  174535. var scratchPositionNormal2 = new Cartesian3_default();
  174536. Fog.prototype.update = function(frameState) {
  174537. const enabled = frameState.fog.enabled = this.enabled;
  174538. if (!enabled) {
  174539. return;
  174540. }
  174541. frameState.fog.renderable = this.renderable;
  174542. const camera = frameState.camera;
  174543. const positionCartographic = camera.positionCartographic;
  174544. if (!defined_default(positionCartographic) || positionCartographic.height > 8e5 || frameState.mode !== SceneMode_default.SCENE3D) {
  174545. frameState.fog.enabled = false;
  174546. return;
  174547. }
  174548. const height = positionCartographic.height;
  174549. const i2 = findInterval(height);
  174550. const t = Math_default.clamp(
  174551. (height - heightsTable[i2]) / (heightsTable[i2 + 1] - heightsTable[i2]),
  174552. 0,
  174553. 1
  174554. );
  174555. let density = Math_default.lerp(densityTable[i2], densityTable[i2 + 1], t);
  174556. const startDensity = this.density * 1e6;
  174557. const endDensity = startDensity / tableStartDensity * tableEndDensity;
  174558. density = density * (startDensity - endDensity) * 1e-6;
  174559. const positionNormal = Cartesian3_default.normalize(
  174560. camera.positionWC,
  174561. scratchPositionNormal2
  174562. );
  174563. const dot2 = Math.abs(Cartesian3_default.dot(camera.directionWC, positionNormal));
  174564. density *= 1 - dot2;
  174565. frameState.fog.density = density;
  174566. frameState.fog.sse = this.screenSpaceErrorFactor;
  174567. frameState.fog.minimumBrightness = this.minimumBrightness;
  174568. };
  174569. var Fog_default = Fog;
  174570. // node_modules/cesium/Source/Scene/FrameRateMonitor.js
  174571. function FrameRateMonitor(options) {
  174572. if (!defined_default(options) || !defined_default(options.scene)) {
  174573. throw new DeveloperError_default("options.scene is required.");
  174574. }
  174575. this._scene = options.scene;
  174576. this.samplingWindow = defaultValue_default(
  174577. options.samplingWindow,
  174578. FrameRateMonitor.defaultSettings.samplingWindow
  174579. );
  174580. this.quietPeriod = defaultValue_default(
  174581. options.quietPeriod,
  174582. FrameRateMonitor.defaultSettings.quietPeriod
  174583. );
  174584. this.warmupPeriod = defaultValue_default(
  174585. options.warmupPeriod,
  174586. FrameRateMonitor.defaultSettings.warmupPeriod
  174587. );
  174588. this.minimumFrameRateDuringWarmup = defaultValue_default(
  174589. options.minimumFrameRateDuringWarmup,
  174590. FrameRateMonitor.defaultSettings.minimumFrameRateDuringWarmup
  174591. );
  174592. this.minimumFrameRateAfterWarmup = defaultValue_default(
  174593. options.minimumFrameRateAfterWarmup,
  174594. FrameRateMonitor.defaultSettings.minimumFrameRateAfterWarmup
  174595. );
  174596. this._lowFrameRate = new Event_default();
  174597. this._nominalFrameRate = new Event_default();
  174598. this._frameTimes = [];
  174599. this._needsQuietPeriod = true;
  174600. this._quietPeriodEndTime = 0;
  174601. this._warmupPeriodEndTime = 0;
  174602. this._frameRateIsLow = false;
  174603. this._lastFramesPerSecond = void 0;
  174604. this._pauseCount = 0;
  174605. const that = this;
  174606. this._preUpdateRemoveListener = this._scene.preUpdate.addEventListener(
  174607. function(scene, time) {
  174608. update6(that, time);
  174609. }
  174610. );
  174611. this._hiddenPropertyName = document.hidden !== void 0 ? "hidden" : document.mozHidden !== void 0 ? "mozHidden" : document.msHidden !== void 0 ? "msHidden" : document.webkitHidden !== void 0 ? "webkitHidden" : void 0;
  174612. const visibilityChangeEventName = document.hidden !== void 0 ? "visibilitychange" : document.mozHidden !== void 0 ? "mozvisibilitychange" : document.msHidden !== void 0 ? "msvisibilitychange" : document.webkitHidden !== void 0 ? "webkitvisibilitychange" : void 0;
  174613. function visibilityChangeListener() {
  174614. visibilityChanged(that);
  174615. }
  174616. this._visibilityChangeRemoveListener = void 0;
  174617. if (defined_default(visibilityChangeEventName)) {
  174618. document.addEventListener(
  174619. visibilityChangeEventName,
  174620. visibilityChangeListener,
  174621. false
  174622. );
  174623. this._visibilityChangeRemoveListener = function() {
  174624. document.removeEventListener(
  174625. visibilityChangeEventName,
  174626. visibilityChangeListener,
  174627. false
  174628. );
  174629. };
  174630. }
  174631. }
  174632. FrameRateMonitor.defaultSettings = {
  174633. samplingWindow: 5,
  174634. quietPeriod: 2,
  174635. warmupPeriod: 5,
  174636. minimumFrameRateDuringWarmup: 4,
  174637. minimumFrameRateAfterWarmup: 8
  174638. };
  174639. FrameRateMonitor.fromScene = function(scene) {
  174640. if (!defined_default(scene)) {
  174641. throw new DeveloperError_default("scene is required.");
  174642. }
  174643. if (!defined_default(scene._frameRateMonitor) || scene._frameRateMonitor.isDestroyed()) {
  174644. scene._frameRateMonitor = new FrameRateMonitor({
  174645. scene
  174646. });
  174647. }
  174648. return scene._frameRateMonitor;
  174649. };
  174650. Object.defineProperties(FrameRateMonitor.prototype, {
  174651. scene: {
  174652. get: function() {
  174653. return this._scene;
  174654. }
  174655. },
  174656. lowFrameRate: {
  174657. get: function() {
  174658. return this._lowFrameRate;
  174659. }
  174660. },
  174661. nominalFrameRate: {
  174662. get: function() {
  174663. return this._nominalFrameRate;
  174664. }
  174665. },
  174666. lastFramesPerSecond: {
  174667. get: function() {
  174668. return this._lastFramesPerSecond;
  174669. }
  174670. }
  174671. });
  174672. FrameRateMonitor.prototype.pause = function() {
  174673. ++this._pauseCount;
  174674. if (this._pauseCount === 1) {
  174675. this._frameTimes.length = 0;
  174676. this._lastFramesPerSecond = void 0;
  174677. }
  174678. };
  174679. FrameRateMonitor.prototype.unpause = function() {
  174680. --this._pauseCount;
  174681. if (this._pauseCount <= 0) {
  174682. this._pauseCount = 0;
  174683. this._needsQuietPeriod = true;
  174684. }
  174685. };
  174686. FrameRateMonitor.prototype.isDestroyed = function() {
  174687. return false;
  174688. };
  174689. FrameRateMonitor.prototype.destroy = function() {
  174690. this._preUpdateRemoveListener();
  174691. if (defined_default(this._visibilityChangeRemoveListener)) {
  174692. this._visibilityChangeRemoveListener();
  174693. }
  174694. return destroyObject_default(this);
  174695. };
  174696. function update6(monitor, time) {
  174697. if (monitor._pauseCount > 0) {
  174698. return;
  174699. }
  174700. const timeStamp = getTimestamp_default();
  174701. if (monitor._needsQuietPeriod) {
  174702. monitor._needsQuietPeriod = false;
  174703. monitor._frameTimes.length = 0;
  174704. monitor._quietPeriodEndTime = timeStamp + monitor.quietPeriod / TimeConstants_default.SECONDS_PER_MILLISECOND;
  174705. monitor._warmupPeriodEndTime = monitor._quietPeriodEndTime + (monitor.warmupPeriod + monitor.samplingWindow) / TimeConstants_default.SECONDS_PER_MILLISECOND;
  174706. } else if (timeStamp >= monitor._quietPeriodEndTime) {
  174707. monitor._frameTimes.push(timeStamp);
  174708. const beginningOfWindow = timeStamp - monitor.samplingWindow / TimeConstants_default.SECONDS_PER_MILLISECOND;
  174709. if (monitor._frameTimes.length >= 2 && monitor._frameTimes[0] <= beginningOfWindow) {
  174710. while (monitor._frameTimes.length >= 2 && monitor._frameTimes[1] < beginningOfWindow) {
  174711. monitor._frameTimes.shift();
  174712. }
  174713. const averageTimeBetweenFrames = (timeStamp - monitor._frameTimes[0]) / (monitor._frameTimes.length - 1);
  174714. monitor._lastFramesPerSecond = 1e3 / averageTimeBetweenFrames;
  174715. const maximumFrameTime = 1e3 / (timeStamp > monitor._warmupPeriodEndTime ? monitor.minimumFrameRateAfterWarmup : monitor.minimumFrameRateDuringWarmup);
  174716. if (averageTimeBetweenFrames > maximumFrameTime) {
  174717. if (!monitor._frameRateIsLow) {
  174718. monitor._frameRateIsLow = true;
  174719. monitor._needsQuietPeriod = true;
  174720. monitor.lowFrameRate.raiseEvent(
  174721. monitor.scene,
  174722. monitor._lastFramesPerSecond
  174723. );
  174724. }
  174725. } else if (monitor._frameRateIsLow) {
  174726. monitor._frameRateIsLow = false;
  174727. monitor._needsQuietPeriod = true;
  174728. monitor.nominalFrameRate.raiseEvent(
  174729. monitor.scene,
  174730. monitor._lastFramesPerSecond
  174731. );
  174732. }
  174733. }
  174734. }
  174735. }
  174736. function visibilityChanged(monitor) {
  174737. if (document[monitor._hiddenPropertyName]) {
  174738. monitor.pause();
  174739. } else {
  174740. monitor.unpause();
  174741. }
  174742. }
  174743. var FrameRateMonitor_default = FrameRateMonitor;
  174744. // node_modules/cesium/Source/Scene/FrameState.js
  174745. function FrameState(context, creditDisplay, jobScheduler) {
  174746. this.context = context;
  174747. this.commandList = [];
  174748. this.shadowMaps = [];
  174749. this.brdfLutGenerator = void 0;
  174750. this.environmentMap = void 0;
  174751. this.sphericalHarmonicCoefficients = void 0;
  174752. this.specularEnvironmentMaps = void 0;
  174753. this.specularEnvironmentMapsMaximumLOD = void 0;
  174754. this.mode = SceneMode_default.SCENE3D;
  174755. this.morphTime = SceneMode_default.getMorphTime(SceneMode_default.SCENE3D);
  174756. this.frameNumber = 0;
  174757. this.newFrame = false;
  174758. this.time = void 0;
  174759. this.jobScheduler = jobScheduler;
  174760. this.mapProjection = void 0;
  174761. this.camera = void 0;
  174762. this.cameraUnderground = false;
  174763. this.globeTranslucencyState = void 0;
  174764. this.cullingVolume = void 0;
  174765. this.occluder = void 0;
  174766. this.maximumScreenSpaceError = void 0;
  174767. this.pixelRatio = 1;
  174768. this.passes = {
  174769. render: false,
  174770. pick: false,
  174771. depth: false,
  174772. postProcess: false,
  174773. offscreen: false
  174774. };
  174775. this.creditDisplay = creditDisplay;
  174776. this.afterRender = [];
  174777. this.scene3DOnly = false;
  174778. this.fog = {
  174779. enabled: false,
  174780. density: void 0,
  174781. sse: void 0,
  174782. minimumBrightness: void 0
  174783. };
  174784. this.terrainExaggeration = 1;
  174785. this.terrainExaggerationRelativeHeight = 0;
  174786. this.shadowState = {
  174787. shadowsEnabled: true,
  174788. shadowMaps: [],
  174789. lightShadowMaps: [],
  174790. nearPlane: 1,
  174791. farPlane: 5e3,
  174792. closestObjectSize: 1e3,
  174793. lastDirtyTime: 0,
  174794. outOfView: true
  174795. };
  174796. this.splitPosition = 0;
  174797. this.frustumSplits = [];
  174798. this.backgroundColor = void 0;
  174799. this.light = void 0;
  174800. this.minimumDisableDepthTestDistance = void 0;
  174801. this.invertClassification = false;
  174802. this.invertClassificationColor = void 0;
  174803. this.useLogDepth = false;
  174804. this.tilesetPassState = void 0;
  174805. this.minimumTerrainHeight = 0;
  174806. }
  174807. var FrameState_default = FrameState;
  174808. // node_modules/cesium/Source/Scene/FrustumCommands.js
  174809. function FrustumCommands(near, far) {
  174810. this.near = defaultValue_default(near, 0);
  174811. this.far = defaultValue_default(far, 0);
  174812. const numPasses = Pass_default.NUMBER_OF_PASSES;
  174813. const commands = new Array(numPasses);
  174814. const indices2 = new Array(numPasses);
  174815. for (let i2 = 0; i2 < numPasses; ++i2) {
  174816. commands[i2] = [];
  174817. indices2[i2] = 0;
  174818. }
  174819. this.commands = commands;
  174820. this.indices = indices2;
  174821. }
  174822. var FrustumCommands_default = FrustumCommands;
  174823. // node_modules/cesium/Source/Scene/GetFeatureInfoFormat.js
  174824. function GetFeatureInfoFormat(type, format, callback) {
  174825. if (!defined_default(type)) {
  174826. throw new DeveloperError_default("type is required.");
  174827. }
  174828. this.type = type;
  174829. if (!defined_default(format)) {
  174830. if (type === "json") {
  174831. format = "application/json";
  174832. } else if (type === "xml") {
  174833. format = "text/xml";
  174834. } else if (type === "html") {
  174835. format = "text/html";
  174836. } else if (type === "text") {
  174837. format = "text/plain";
  174838. } else {
  174839. throw new DeveloperError_default(
  174840. 'format is required when type is not "json", "xml", "html", or "text".'
  174841. );
  174842. }
  174843. }
  174844. this.format = format;
  174845. if (!defined_default(callback)) {
  174846. if (type === "json") {
  174847. callback = geoJsonToFeatureInfo;
  174848. } else if (type === "xml") {
  174849. callback = xmlToFeatureInfo;
  174850. } else if (type === "html") {
  174851. callback = textToFeatureInfo;
  174852. } else if (type === "text") {
  174853. callback = textToFeatureInfo;
  174854. } else {
  174855. throw new DeveloperError_default(
  174856. 'callback is required when type is not "json", "xml", "html", or "text".'
  174857. );
  174858. }
  174859. }
  174860. this.callback = callback;
  174861. }
  174862. function geoJsonToFeatureInfo(json) {
  174863. const result = [];
  174864. const features = json.features;
  174865. for (let i2 = 0; i2 < features.length; ++i2) {
  174866. const feature2 = features[i2];
  174867. const featureInfo = new ImageryLayerFeatureInfo_default();
  174868. featureInfo.data = feature2;
  174869. featureInfo.properties = feature2.properties;
  174870. featureInfo.configureNameFromProperties(feature2.properties);
  174871. featureInfo.configureDescriptionFromProperties(feature2.properties);
  174872. if (defined_default(feature2.geometry) && feature2.geometry.type === "Point") {
  174873. const longitude = feature2.geometry.coordinates[0];
  174874. const latitude = feature2.geometry.coordinates[1];
  174875. featureInfo.position = Cartographic_default.fromDegrees(longitude, latitude);
  174876. }
  174877. result.push(featureInfo);
  174878. }
  174879. return result;
  174880. }
  174881. var mapInfoMxpNamespace = "http://www.mapinfo.com/mxp";
  174882. var esriWmsNamespace = "http://www.esri.com/wms";
  174883. var wfsNamespace = "http://www.opengis.net/wfs";
  174884. var gmlNamespace = "http://www.opengis.net/gml";
  174885. function xmlToFeatureInfo(xml2) {
  174886. const documentElement = xml2.documentElement;
  174887. if (documentElement.localName === "MultiFeatureCollection" && documentElement.namespaceURI === mapInfoMxpNamespace) {
  174888. return mapInfoXmlToFeatureInfo(xml2);
  174889. } else if (documentElement.localName === "FeatureInfoResponse" && documentElement.namespaceURI === esriWmsNamespace) {
  174890. return esriXmlToFeatureInfo(xml2);
  174891. } else if (documentElement.localName === "FeatureCollection" && documentElement.namespaceURI === wfsNamespace) {
  174892. return gmlToFeatureInfo(xml2);
  174893. } else if (documentElement.localName === "ServiceExceptionReport") {
  174894. throw new RuntimeError_default(
  174895. new XMLSerializer().serializeToString(documentElement)
  174896. );
  174897. } else if (documentElement.localName === "msGMLOutput") {
  174898. return msGmlToFeatureInfo(xml2);
  174899. } else {
  174900. return unknownXmlToFeatureInfo(xml2);
  174901. }
  174902. }
  174903. function mapInfoXmlToFeatureInfo(xml2) {
  174904. const result = [];
  174905. const multiFeatureCollection = xml2.documentElement;
  174906. const features = multiFeatureCollection.getElementsByTagNameNS(
  174907. mapInfoMxpNamespace,
  174908. "Feature"
  174909. );
  174910. for (let featureIndex = 0; featureIndex < features.length; ++featureIndex) {
  174911. const feature2 = features[featureIndex];
  174912. const properties = {};
  174913. const propertyElements = feature2.getElementsByTagNameNS(
  174914. mapInfoMxpNamespace,
  174915. "Val"
  174916. );
  174917. for (let propertyIndex = 0; propertyIndex < propertyElements.length; ++propertyIndex) {
  174918. const propertyElement = propertyElements[propertyIndex];
  174919. if (propertyElement.hasAttribute("ref")) {
  174920. const name = propertyElement.getAttribute("ref");
  174921. const value = propertyElement.textContent.trim();
  174922. properties[name] = value;
  174923. }
  174924. }
  174925. const featureInfo = new ImageryLayerFeatureInfo_default();
  174926. featureInfo.data = feature2;
  174927. featureInfo.properties = properties;
  174928. featureInfo.configureNameFromProperties(properties);
  174929. featureInfo.configureDescriptionFromProperties(properties);
  174930. result.push(featureInfo);
  174931. }
  174932. return result;
  174933. }
  174934. function esriXmlToFeatureInfo(xml2) {
  174935. const featureInfoResponse = xml2.documentElement;
  174936. const result = [];
  174937. let properties;
  174938. const features = featureInfoResponse.getElementsByTagNameNS("*", "FIELDS");
  174939. if (features.length > 0) {
  174940. for (let featureIndex = 0; featureIndex < features.length; ++featureIndex) {
  174941. const feature2 = features[featureIndex];
  174942. properties = {};
  174943. const propertyAttributes = feature2.attributes;
  174944. for (let attributeIndex = 0; attributeIndex < propertyAttributes.length; ++attributeIndex) {
  174945. const attribute = propertyAttributes[attributeIndex];
  174946. properties[attribute.name] = attribute.value;
  174947. }
  174948. result.push(
  174949. imageryLayerFeatureInfoFromDataAndProperties(feature2, properties)
  174950. );
  174951. }
  174952. } else {
  174953. const featureInfoElements = featureInfoResponse.getElementsByTagNameNS(
  174954. "*",
  174955. "FeatureInfo"
  174956. );
  174957. for (let featureInfoElementIndex = 0; featureInfoElementIndex < featureInfoElements.length; ++featureInfoElementIndex) {
  174958. const featureInfoElement = featureInfoElements[featureInfoElementIndex];
  174959. properties = {};
  174960. const featureInfoChildren = featureInfoElement.childNodes;
  174961. for (let childIndex = 0; childIndex < featureInfoChildren.length; ++childIndex) {
  174962. const child = featureInfoChildren[childIndex];
  174963. if (child.nodeType === Node.ELEMENT_NODE) {
  174964. properties[child.localName] = child.textContent;
  174965. }
  174966. }
  174967. result.push(
  174968. imageryLayerFeatureInfoFromDataAndProperties(
  174969. featureInfoElement,
  174970. properties
  174971. )
  174972. );
  174973. }
  174974. }
  174975. return result;
  174976. }
  174977. function gmlToFeatureInfo(xml2) {
  174978. const result = [];
  174979. const featureCollection = xml2.documentElement;
  174980. const featureMembers = featureCollection.getElementsByTagNameNS(
  174981. gmlNamespace,
  174982. "featureMember"
  174983. );
  174984. for (let featureIndex = 0; featureIndex < featureMembers.length; ++featureIndex) {
  174985. const featureMember = featureMembers[featureIndex];
  174986. const properties = {};
  174987. getGmlPropertiesRecursively(featureMember, properties);
  174988. result.push(
  174989. imageryLayerFeatureInfoFromDataAndProperties(featureMember, properties)
  174990. );
  174991. }
  174992. return result;
  174993. }
  174994. function msGmlToFeatureInfo(xml2) {
  174995. const result = [];
  174996. let layer;
  174997. const children = xml2.documentElement.childNodes;
  174998. for (let i2 = 0; i2 < children.length; i2++) {
  174999. if (children[i2].nodeType === Node.ELEMENT_NODE) {
  175000. layer = children[i2];
  175001. break;
  175002. }
  175003. }
  175004. if (!defined_default(layer)) {
  175005. throw new RuntimeError_default(
  175006. "Unable to find first child of the feature info xml document"
  175007. );
  175008. }
  175009. const featureMembers = layer.childNodes;
  175010. for (let featureIndex = 0; featureIndex < featureMembers.length; ++featureIndex) {
  175011. const featureMember = featureMembers[featureIndex];
  175012. if (featureMember.nodeType === Node.ELEMENT_NODE) {
  175013. const properties = {};
  175014. getGmlPropertiesRecursively(featureMember, properties);
  175015. result.push(
  175016. imageryLayerFeatureInfoFromDataAndProperties(featureMember, properties)
  175017. );
  175018. }
  175019. }
  175020. return result;
  175021. }
  175022. function getGmlPropertiesRecursively(gmlNode, properties) {
  175023. let isSingleValue = true;
  175024. for (let i2 = 0; i2 < gmlNode.childNodes.length; ++i2) {
  175025. const child = gmlNode.childNodes[i2];
  175026. if (child.nodeType === Node.ELEMENT_NODE) {
  175027. isSingleValue = false;
  175028. }
  175029. if (child.localName === "Point" || child.localName === "LineString" || child.localName === "Polygon" || child.localName === "boundedBy") {
  175030. continue;
  175031. }
  175032. if (child.hasChildNodes() && getGmlPropertiesRecursively(child, properties)) {
  175033. properties[child.localName] = child.textContent;
  175034. }
  175035. }
  175036. return isSingleValue;
  175037. }
  175038. function imageryLayerFeatureInfoFromDataAndProperties(data, properties) {
  175039. const featureInfo = new ImageryLayerFeatureInfo_default();
  175040. featureInfo.data = data;
  175041. featureInfo.properties = properties;
  175042. featureInfo.configureNameFromProperties(properties);
  175043. featureInfo.configureDescriptionFromProperties(properties);
  175044. return featureInfo;
  175045. }
  175046. function unknownXmlToFeatureInfo(xml2) {
  175047. const xmlText = new XMLSerializer().serializeToString(xml2);
  175048. const element = document.createElement("div");
  175049. const pre = document.createElement("pre");
  175050. pre.textContent = xmlText;
  175051. element.appendChild(pre);
  175052. const featureInfo = new ImageryLayerFeatureInfo_default();
  175053. featureInfo.data = xml2;
  175054. featureInfo.description = element.innerHTML;
  175055. return [featureInfo];
  175056. }
  175057. var emptyBodyRegex = /<body>\s*<\/body>/im;
  175058. var wmsServiceExceptionReportRegex = /<ServiceExceptionReport([\s\S]*)<\/ServiceExceptionReport>/im;
  175059. var titleRegex = /<title>([\s\S]*)<\/title>/im;
  175060. function textToFeatureInfo(text2) {
  175061. if (emptyBodyRegex.test(text2)) {
  175062. return void 0;
  175063. }
  175064. if (wmsServiceExceptionReportRegex.test(text2)) {
  175065. return void 0;
  175066. }
  175067. let name;
  175068. const title = titleRegex.exec(text2);
  175069. if (title && title.length > 1) {
  175070. name = title[1];
  175071. }
  175072. const featureInfo = new ImageryLayerFeatureInfo_default();
  175073. featureInfo.name = name;
  175074. featureInfo.description = text2;
  175075. featureInfo.data = text2;
  175076. return [featureInfo];
  175077. }
  175078. var GetFeatureInfoFormat_default = GetFeatureInfoFormat;
  175079. // node_modules/cesium/Source/Shaders/GlobeFS.js
  175080. var GlobeFS_default = `uniform vec4 u_initialColor;
  175081. #if TEXTURE_UNITS > 0
  175082. uniform sampler2D u_dayTextures[TEXTURE_UNITS];
  175083. uniform vec4 u_dayTextureTranslationAndScale[TEXTURE_UNITS];
  175084. uniform bool u_dayTextureUseWebMercatorT[TEXTURE_UNITS];
  175085. #ifdef APPLY_ALPHA
  175086. uniform float u_dayTextureAlpha[TEXTURE_UNITS];
  175087. #endif
  175088. #ifdef APPLY_DAY_NIGHT_ALPHA
  175089. uniform float u_dayTextureNightAlpha[TEXTURE_UNITS];
  175090. uniform float u_dayTextureDayAlpha[TEXTURE_UNITS];
  175091. #endif
  175092. #ifdef APPLY_SPLIT
  175093. uniform float u_dayTextureSplit[TEXTURE_UNITS];
  175094. #endif
  175095. #ifdef APPLY_BRIGHTNESS
  175096. uniform float u_dayTextureBrightness[TEXTURE_UNITS];
  175097. #endif
  175098. #ifdef APPLY_CONTRAST
  175099. uniform float u_dayTextureContrast[TEXTURE_UNITS];
  175100. #endif
  175101. #ifdef APPLY_HUE
  175102. uniform float u_dayTextureHue[TEXTURE_UNITS];
  175103. #endif
  175104. #ifdef APPLY_SATURATION
  175105. uniform float u_dayTextureSaturation[TEXTURE_UNITS];
  175106. #endif
  175107. #ifdef APPLY_GAMMA
  175108. uniform float u_dayTextureOneOverGamma[TEXTURE_UNITS];
  175109. #endif
  175110. #ifdef APPLY_IMAGERY_CUTOUT
  175111. uniform vec4 u_dayTextureCutoutRectangles[TEXTURE_UNITS];
  175112. #endif
  175113. #ifdef APPLY_COLOR_TO_ALPHA
  175114. uniform vec4 u_colorsToAlpha[TEXTURE_UNITS];
  175115. #endif
  175116. uniform vec4 u_dayTextureTexCoordsRectangle[TEXTURE_UNITS];
  175117. #endif
  175118. #ifdef SHOW_REFLECTIVE_OCEAN
  175119. uniform sampler2D u_waterMask;
  175120. uniform vec4 u_waterMaskTranslationAndScale;
  175121. uniform float u_zoomedOutOceanSpecularIntensity;
  175122. #endif
  175123. #ifdef SHOW_OCEAN_WAVES
  175124. uniform sampler2D u_oceanNormalMap;
  175125. #endif
  175126. #if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE)
  175127. uniform vec2 u_lightingFadeDistance;
  175128. #endif
  175129. #ifdef TILE_LIMIT_RECTANGLE
  175130. uniform vec4 u_cartographicLimitRectangle;
  175131. #endif
  175132. #ifdef GROUND_ATMOSPHERE
  175133. uniform vec2 u_nightFadeDistance;
  175134. #endif
  175135. #ifdef ENABLE_CLIPPING_PLANES
  175136. uniform highp sampler2D u_clippingPlanes;
  175137. uniform mat4 u_clippingPlanesMatrix;
  175138. uniform vec4 u_clippingPlanesEdgeStyle;
  175139. #endif
  175140. #if defined(GROUND_ATMOSPHERE) || defined(FOG) && defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))
  175141. uniform float u_minimumBrightness;
  175142. #endif
  175143. #ifdef COLOR_CORRECT
  175144. uniform vec3 u_hsbShift; // Hue, saturation, brightness
  175145. #endif
  175146. #ifdef HIGHLIGHT_FILL_TILE
  175147. uniform vec4 u_fillHighlightColor;
  175148. #endif
  175149. #ifdef TRANSLUCENT
  175150. uniform vec4 u_frontFaceAlphaByDistance;
  175151. uniform vec4 u_backFaceAlphaByDistance;
  175152. uniform vec4 u_translucencyRectangle;
  175153. #endif
  175154. #ifdef UNDERGROUND_COLOR
  175155. uniform vec4 u_undergroundColor;
  175156. uniform vec4 u_undergroundColorAlphaByDistance;
  175157. #endif
  175158. #ifdef ENABLE_VERTEX_LIGHTING
  175159. uniform float u_lambertDiffuseMultiplier;
  175160. #endif
  175161. varying vec3 v_positionMC;
  175162. varying vec3 v_positionEC;
  175163. varying vec3 v_textureCoordinates;
  175164. varying vec3 v_normalMC;
  175165. varying vec3 v_normalEC;
  175166. #ifdef APPLY_MATERIAL
  175167. varying float v_height;
  175168. varying float v_slope;
  175169. varying float v_aspect;
  175170. #endif
  175171. #if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)
  175172. varying float v_distance;
  175173. #endif
  175174. #if defined(GROUND_ATMOSPHERE) || defined(FOG)
  175175. varying vec3 v_atmosphereRayleighColor;
  175176. varying vec3 v_atmosphereMieColor;
  175177. varying float v_atmosphereOpacity;
  175178. #endif
  175179. #if defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)
  175180. float interpolateByDistance(vec4 nearFarScalar, float distance)
  175181. {
  175182. float startDistance = nearFarScalar.x;
  175183. float startValue = nearFarScalar.y;
  175184. float endDistance = nearFarScalar.z;
  175185. float endValue = nearFarScalar.w;
  175186. float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);
  175187. return mix(startValue, endValue, t);
  175188. }
  175189. #endif
  175190. #if defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT) || defined(APPLY_MATERIAL)
  175191. vec4 alphaBlend(vec4 sourceColor, vec4 destinationColor)
  175192. {
  175193. return sourceColor * vec4(sourceColor.aaa, 1.0) + destinationColor * (1.0 - sourceColor.a);
  175194. }
  175195. #endif
  175196. #ifdef TRANSLUCENT
  175197. bool inTranslucencyRectangle()
  175198. {
  175199. return
  175200. v_textureCoordinates.x > u_translucencyRectangle.x &&
  175201. v_textureCoordinates.x < u_translucencyRectangle.z &&
  175202. v_textureCoordinates.y > u_translucencyRectangle.y &&
  175203. v_textureCoordinates.y < u_translucencyRectangle.w;
  175204. }
  175205. #endif
  175206. vec4 sampleAndBlend(
  175207. vec4 previousColor,
  175208. sampler2D textureToSample,
  175209. vec2 tileTextureCoordinates,
  175210. vec4 textureCoordinateRectangle,
  175211. vec4 textureCoordinateTranslationAndScale,
  175212. float textureAlpha,
  175213. float textureNightAlpha,
  175214. float textureDayAlpha,
  175215. float textureBrightness,
  175216. float textureContrast,
  175217. float textureHue,
  175218. float textureSaturation,
  175219. float textureOneOverGamma,
  175220. float split,
  175221. vec4 colorToAlpha,
  175222. float nightBlend)
  175223. {
  175224. // This crazy step stuff sets the alpha to 0.0 if this following condition is true:
  175225. // tileTextureCoordinates.s < textureCoordinateRectangle.s ||
  175226. // tileTextureCoordinates.s > textureCoordinateRectangle.p ||
  175227. // tileTextureCoordinates.t < textureCoordinateRectangle.t ||
  175228. // tileTextureCoordinates.t > textureCoordinateRectangle.q
  175229. // In other words, the alpha is zero if the fragment is outside the rectangle
  175230. // covered by this texture. Would an actual 'if' yield better performance?
  175231. vec2 alphaMultiplier = step(textureCoordinateRectangle.st, tileTextureCoordinates);
  175232. textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;
  175233. alphaMultiplier = step(vec2(0.0), textureCoordinateRectangle.pq - tileTextureCoordinates);
  175234. textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;
  175235. #if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING)
  175236. textureAlpha *= mix(textureDayAlpha, textureNightAlpha, nightBlend);
  175237. #endif
  175238. vec2 translation = textureCoordinateTranslationAndScale.xy;
  175239. vec2 scale = textureCoordinateTranslationAndScale.zw;
  175240. vec2 textureCoordinates = tileTextureCoordinates * scale + translation;
  175241. vec4 value = texture2D(textureToSample, textureCoordinates);
  175242. vec3 color = value.rgb;
  175243. float alpha = value.a;
  175244. #ifdef APPLY_COLOR_TO_ALPHA
  175245. vec3 colorDiff = abs(color.rgb - colorToAlpha.rgb);
  175246. colorDiff.r = max(max(colorDiff.r, colorDiff.g), colorDiff.b);
  175247. alpha = czm_branchFreeTernary(colorDiff.r < colorToAlpha.a, 0.0, alpha);
  175248. #endif
  175249. #if !defined(APPLY_GAMMA)
  175250. vec4 tempColor = czm_gammaCorrect(vec4(color, alpha));
  175251. color = tempColor.rgb;
  175252. alpha = tempColor.a;
  175253. #else
  175254. color = pow(color, vec3(textureOneOverGamma));
  175255. #endif
  175256. #ifdef APPLY_SPLIT
  175257. float splitPosition = czm_splitPosition;
  175258. // Split to the left
  175259. if (split < 0.0 && gl_FragCoord.x > splitPosition) {
  175260. alpha = 0.0;
  175261. }
  175262. // Split to the right
  175263. else if (split > 0.0 && gl_FragCoord.x < splitPosition) {
  175264. alpha = 0.0;
  175265. }
  175266. #endif
  175267. #ifdef APPLY_BRIGHTNESS
  175268. color = mix(vec3(0.0), color, textureBrightness);
  175269. #endif
  175270. #ifdef APPLY_CONTRAST
  175271. color = mix(vec3(0.5), color, textureContrast);
  175272. #endif
  175273. #ifdef APPLY_HUE
  175274. color = czm_hue(color, textureHue);
  175275. #endif
  175276. #ifdef APPLY_SATURATION
  175277. color = czm_saturation(color, textureSaturation);
  175278. #endif
  175279. float sourceAlpha = alpha * textureAlpha;
  175280. float outAlpha = mix(previousColor.a, 1.0, sourceAlpha);
  175281. outAlpha += sign(outAlpha) - 1.0;
  175282. vec3 outColor = mix(previousColor.rgb * previousColor.a, color, sourceAlpha) / outAlpha;
  175283. // When rendering imagery for a tile in multiple passes,
  175284. // some GPU/WebGL implementation combinations will not blend fragments in
  175285. // additional passes correctly if their computation includes an unmasked
  175286. // divide-by-zero operation,
  175287. // even if it's not in the output or if the output has alpha zero.
  175288. //
  175289. // For example, without sanitization for outAlpha,
  175290. // this renders without artifacts:
  175291. // if (outAlpha == 0.0) { outColor = vec3(0.0); }
  175292. //
  175293. // but using czm_branchFreeTernary will cause portions of the tile that are
  175294. // alpha-zero in the additional pass to render as black instead of blending
  175295. // with the previous pass:
  175296. // outColor = czm_branchFreeTernary(outAlpha == 0.0, vec3(0.0), outColor);
  175297. //
  175298. // So instead, sanitize against divide-by-zero,
  175299. // store this state on the sign of outAlpha, and correct on return.
  175300. return vec4(outColor, max(outAlpha, 0.0));
  175301. }
  175302. vec3 colorCorrect(vec3 rgb) {
  175303. #ifdef COLOR_CORRECT
  175304. // Convert rgb color to hsb
  175305. vec3 hsb = czm_RGBToHSB(rgb);
  175306. // Perform hsb shift
  175307. hsb.x += u_hsbShift.x; // hue
  175308. hsb.y = clamp(hsb.y + u_hsbShift.y, 0.0, 1.0); // saturation
  175309. hsb.z = hsb.z > czm_epsilon7 ? hsb.z + u_hsbShift.z : 0.0; // brightness
  175310. // Convert shifted hsb back to rgb
  175311. rgb = czm_HSBToRGB(hsb);
  175312. #endif
  175313. return rgb;
  175314. }
  175315. vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend);
  175316. vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float specularMapValue, float fade);
  175317. const float fExposure = 2.0;
  175318. vec3 computeEllipsoidPosition()
  175319. {
  175320. float mpp = czm_metersPerPixel(vec4(0.0, 0.0, -czm_currentFrustum.x, 1.0), 1.0);
  175321. vec2 xy = gl_FragCoord.xy / czm_viewport.zw * 2.0 - vec2(1.0);
  175322. xy *= czm_viewport.zw * mpp * 0.5;
  175323. vec3 direction = normalize(vec3(xy, -czm_currentFrustum.x));
  175324. czm_ray ray = czm_ray(vec3(0.0), direction);
  175325. vec3 ellipsoid_center = czm_view[3].xyz;
  175326. czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid_center, czm_ellipsoidInverseRadii);
  175327. vec3 ellipsoidPosition = czm_pointAlongRay(ray, intersection.start);
  175328. return (czm_inverseView * vec4(ellipsoidPosition, 1.0)).xyz;
  175329. }
  175330. void main()
  175331. {
  175332. #ifdef TILE_LIMIT_RECTANGLE
  175333. if (v_textureCoordinates.x < u_cartographicLimitRectangle.x || u_cartographicLimitRectangle.z < v_textureCoordinates.x ||
  175334. v_textureCoordinates.y < u_cartographicLimitRectangle.y || u_cartographicLimitRectangle.w < v_textureCoordinates.y)
  175335. {
  175336. discard;
  175337. }
  175338. #endif
  175339. #ifdef ENABLE_CLIPPING_PLANES
  175340. float clipDistance = clip(gl_FragCoord, u_clippingPlanes, u_clippingPlanesMatrix);
  175341. #endif
  175342. #if defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING) || defined(HDR)
  175343. vec3 normalMC = czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)); // normalized surface normal in model coordinates
  175344. vec3 normalEC = czm_normal3D * normalMC; // normalized surface normal in eye coordiantes
  175345. #endif
  175346. #if defined(APPLY_DAY_NIGHT_ALPHA) && defined(ENABLE_DAYNIGHT_SHADING)
  175347. float nightBlend = 1.0 - clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0, 0.0, 1.0);
  175348. #else
  175349. float nightBlend = 0.0;
  175350. #endif
  175351. // The clamp below works around an apparent bug in Chrome Canary v23.0.1241.0
  175352. // where the fragment shader sees textures coordinates < 0.0 and > 1.0 for the
  175353. // fragments on the edges of tiles even though the vertex shader is outputting
  175354. // coordinates strictly in the 0-1 range.
  175355. vec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0), nightBlend);
  175356. #ifdef SHOW_TILE_BOUNDARIES
  175357. if (v_textureCoordinates.x < (1.0/256.0) || v_textureCoordinates.x > (255.0/256.0) ||
  175358. v_textureCoordinates.y < (1.0/256.0) || v_textureCoordinates.y > (255.0/256.0))
  175359. {
  175360. color = vec4(1.0, 0.0, 0.0, 1.0);
  175361. }
  175362. #endif
  175363. #if defined(ENABLE_DAYNIGHT_SHADING) || defined(GROUND_ATMOSPHERE)
  175364. float cameraDist;
  175365. if (czm_sceneMode == czm_sceneMode2D)
  175366. {
  175367. cameraDist = max(czm_frustumPlanes.x - czm_frustumPlanes.y, czm_frustumPlanes.w - czm_frustumPlanes.z) * 0.5;
  175368. }
  175369. else if (czm_sceneMode == czm_sceneModeColumbusView)
  175370. {
  175371. cameraDist = -czm_view[3].z;
  175372. }
  175373. else
  175374. {
  175375. cameraDist = length(czm_view[3]);
  175376. }
  175377. float fadeOutDist = u_lightingFadeDistance.x;
  175378. float fadeInDist = u_lightingFadeDistance.y;
  175379. if (czm_sceneMode != czm_sceneMode3D) {
  175380. vec3 radii = czm_ellipsoidRadii;
  175381. float maxRadii = max(radii.x, max(radii.y, radii.z));
  175382. fadeOutDist -= maxRadii;
  175383. fadeInDist -= maxRadii;
  175384. }
  175385. float fade = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0);
  175386. #else
  175387. float fade = 0.0;
  175388. #endif
  175389. #ifdef SHOW_REFLECTIVE_OCEAN
  175390. vec2 waterMaskTranslation = u_waterMaskTranslationAndScale.xy;
  175391. vec2 waterMaskScale = u_waterMaskTranslationAndScale.zw;
  175392. vec2 waterMaskTextureCoordinates = v_textureCoordinates.xy * waterMaskScale + waterMaskTranslation;
  175393. waterMaskTextureCoordinates.y = 1.0 - waterMaskTextureCoordinates.y;
  175394. float mask = texture2D(u_waterMask, waterMaskTextureCoordinates).r;
  175395. if (mask > 0.0)
  175396. {
  175397. mat3 enuToEye = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalEC);
  175398. vec2 ellipsoidTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC);
  175399. vec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC.zyx);
  175400. vec2 textureCoordinates = mix(ellipsoidTextureCoordinates, ellipsoidFlippedTextureCoordinates, czm_morphTime * smoothstep(0.9, 0.95, normalMC.z));
  175401. color = computeWaterColor(v_positionEC, textureCoordinates, enuToEye, color, mask, fade);
  175402. }
  175403. #endif
  175404. #ifdef APPLY_MATERIAL
  175405. czm_materialInput materialInput;
  175406. materialInput.st = v_textureCoordinates.st;
  175407. materialInput.normalEC = normalize(v_normalEC);
  175408. materialInput.positionToEyeEC = -v_positionEC;
  175409. materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalize(v_normalEC));
  175410. materialInput.slope = v_slope;
  175411. materialInput.height = v_height;
  175412. materialInput.aspect = v_aspect;
  175413. czm_material material = czm_getMaterial(materialInput);
  175414. vec4 materialColor = vec4(material.diffuse, material.alpha);
  175415. color = alphaBlend(materialColor, color);
  175416. #endif
  175417. #ifdef ENABLE_VERTEX_LIGHTING
  175418. float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalize(v_normalEC)) * u_lambertDiffuseMultiplier + 0.3, 0.0, 1.0);
  175419. vec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a);
  175420. #elif defined(ENABLE_DAYNIGHT_SHADING)
  175421. float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * 5.0 + 0.3, 0.0, 1.0);
  175422. diffuseIntensity = mix(1.0, diffuseIntensity, fade);
  175423. vec4 finalColor = vec4(color.rgb * czm_lightColor * diffuseIntensity, color.a);
  175424. #else
  175425. vec4 finalColor = color;
  175426. #endif
  175427. #ifdef ENABLE_CLIPPING_PLANES
  175428. vec4 clippingPlanesEdgeColor = vec4(1.0);
  175429. clippingPlanesEdgeColor.rgb = u_clippingPlanesEdgeStyle.rgb;
  175430. float clippingPlanesEdgeWidth = u_clippingPlanesEdgeStyle.a;
  175431. if (clipDistance < clippingPlanesEdgeWidth)
  175432. {
  175433. finalColor = clippingPlanesEdgeColor;
  175434. }
  175435. #endif
  175436. #ifdef HIGHLIGHT_FILL_TILE
  175437. finalColor = vec4(mix(finalColor.rgb, u_fillHighlightColor.rgb, u_fillHighlightColor.a), finalColor.a);
  175438. #endif
  175439. #if defined(DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN)
  175440. vec3 atmosphereLightDirection = czm_sunDirectionWC;
  175441. #else
  175442. vec3 atmosphereLightDirection = czm_lightDirectionWC;
  175443. #endif
  175444. #if defined(GROUND_ATMOSPHERE) || defined(FOG)
  175445. if (!czm_backFacing())
  175446. {
  175447. bool dynamicLighting = false;
  175448. #if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_DAYNIGHT_SHADING) || defined(ENABLE_VERTEX_LIGHTING))
  175449. dynamicLighting = true;
  175450. #endif
  175451. vec3 rayleighColor;
  175452. vec3 mieColor;
  175453. float opacity;
  175454. vec3 positionWC;
  175455. vec3 lightDirection;
  175456. // When the camera is far away (camera distance > nightFadeOutDistance), the scattering is computed in the fragment shader.
  175457. // Otherwise, the scattering is computed in the vertex shader.
  175458. #ifdef PER_FRAGMENT_GROUND_ATMOSPHERE
  175459. positionWC = computeEllipsoidPosition();
  175460. lightDirection = czm_branchFreeTernary(dynamicLighting, atmosphereLightDirection, normalize(positionWC));
  175461. computeAtmosphereScattering(
  175462. positionWC,
  175463. lightDirection,
  175464. rayleighColor,
  175465. mieColor,
  175466. opacity
  175467. );
  175468. #else
  175469. positionWC = v_positionMC;
  175470. lightDirection = czm_branchFreeTernary(dynamicLighting, atmosphereLightDirection, normalize(positionWC));
  175471. rayleighColor = v_atmosphereRayleighColor;
  175472. mieColor = v_atmosphereMieColor;
  175473. opacity = v_atmosphereOpacity;
  175474. #endif
  175475. rayleighColor = colorCorrect(rayleighColor);
  175476. mieColor = colorCorrect(mieColor);
  175477. vec4 groundAtmosphereColor = computeAtmosphereColor(positionWC, lightDirection, rayleighColor, mieColor, opacity);
  175478. // Fog is applied to tiles selected for fog, close to the Earth.
  175479. #ifdef FOG
  175480. vec3 fogColor = groundAtmosphereColor.rgb;
  175481. // If there is lighting, apply that to the fog.
  175482. #if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))
  175483. float darken = clamp(dot(normalize(czm_viewerPositionWC), atmosphereLightDirection), u_minimumBrightness, 1.0);
  175484. fogColor *= darken;
  175485. #endif
  175486. #ifndef HDR
  175487. fogColor.rgb = czm_acesTonemapping(fogColor.rgb);
  175488. fogColor.rgb = czm_inverseGamma(fogColor.rgb);
  175489. #endif
  175490. const float modifier = 0.15;
  175491. finalColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor.rgb, modifier), finalColor.a);
  175492. #else
  175493. // The transmittance is based on optical depth i.e. the length of segment of the ray inside the atmosphere.
  175494. // This value is larger near the "circumference", as it is further away from the camera. We use it to
  175495. // brighten up that area of the ground atmosphere.
  175496. const float transmittanceModifier = 0.5;
  175497. float transmittance = transmittanceModifier + clamp(1.0 - groundAtmosphereColor.a, 0.0, 1.0);
  175498. vec3 finalAtmosphereColor = finalColor.rgb + groundAtmosphereColor.rgb * transmittance;
  175499. #if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))
  175500. float fadeInDist = u_nightFadeDistance.x;
  175501. float fadeOutDist = u_nightFadeDistance.y;
  175502. float sunlitAtmosphereIntensity = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.05, 1.0);
  175503. float darken = clamp(dot(normalize(positionWC), atmosphereLightDirection), 0.0, 1.0);
  175504. vec3 darkenendGroundAtmosphereColor = mix(groundAtmosphereColor.rgb, finalAtmosphereColor.rgb, darken);
  175505. finalAtmosphereColor = mix(darkenendGroundAtmosphereColor, finalAtmosphereColor, sunlitAtmosphereIntensity);
  175506. #endif
  175507. #ifndef HDR
  175508. finalAtmosphereColor.rgb = vec3(1.0) - exp(-fExposure * finalAtmosphereColor.rgb);
  175509. #else
  175510. finalAtmosphereColor.rgb = czm_saturation(finalAtmosphereColor.rgb, 1.6);
  175511. #endif
  175512. finalColor.rgb = mix(finalColor.rgb, finalAtmosphereColor.rgb, fade);
  175513. #endif
  175514. }
  175515. #endif
  175516. #ifdef UNDERGROUND_COLOR
  175517. if (czm_backFacing())
  175518. {
  175519. float distanceFromEllipsoid = max(czm_eyeHeight, 0.0);
  175520. float distance = max(v_distance - distanceFromEllipsoid, 0.0);
  175521. float blendAmount = interpolateByDistance(u_undergroundColorAlphaByDistance, distance);
  175522. vec4 undergroundColor = vec4(u_undergroundColor.rgb, u_undergroundColor.a * blendAmount);
  175523. finalColor = alphaBlend(undergroundColor, finalColor);
  175524. }
  175525. #endif
  175526. #ifdef TRANSLUCENT
  175527. if (inTranslucencyRectangle())
  175528. {
  175529. vec4 alphaByDistance = gl_FrontFacing ? u_frontFaceAlphaByDistance : u_backFaceAlphaByDistance;
  175530. finalColor.a *= interpolateByDistance(alphaByDistance, v_distance);
  175531. }
  175532. #endif
  175533. gl_FragColor = finalColor;
  175534. }
  175535. #ifdef SHOW_REFLECTIVE_OCEAN
  175536. float waveFade(float edge0, float edge1, float x)
  175537. {
  175538. float y = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
  175539. return pow(1.0 - y, 5.0);
  175540. }
  175541. float linearFade(float edge0, float edge1, float x)
  175542. {
  175543. return clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);
  175544. }
  175545. // Based on water rendering by Jonas Wagner:
  175546. // http://29a.ch/2012/7/19/webgl-terrain-rendering-water-fog
  175547. // low altitude wave settings
  175548. const float oceanFrequencyLowAltitude = 825000.0;
  175549. const float oceanAnimationSpeedLowAltitude = 0.004;
  175550. const float oceanOneOverAmplitudeLowAltitude = 1.0 / 2.0;
  175551. const float oceanSpecularIntensity = 0.5;
  175552. // high altitude wave settings
  175553. const float oceanFrequencyHighAltitude = 125000.0;
  175554. const float oceanAnimationSpeedHighAltitude = 0.008;
  175555. const float oceanOneOverAmplitudeHighAltitude = 1.0 / 2.0;
  175556. vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float maskValue, float fade)
  175557. {
  175558. vec3 positionToEyeEC = -positionEyeCoordinates;
  175559. float positionToEyeECLength = length(positionToEyeEC);
  175560. // The double normalize below works around a bug in Firefox on Android devices.
  175561. vec3 normalizedPositionToEyeEC = normalize(normalize(positionToEyeEC));
  175562. // Fade out the waves as the camera moves far from the surface.
  175563. float waveIntensity = waveFade(70000.0, 1000000.0, positionToEyeECLength);
  175564. #ifdef SHOW_OCEAN_WAVES
  175565. // high altitude waves
  175566. float time = czm_frameNumber * oceanAnimationSpeedHighAltitude;
  175567. vec4 noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyHighAltitude, time, 0.0);
  175568. vec3 normalTangentSpaceHighAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeHighAltitude);
  175569. // low altitude waves
  175570. time = czm_frameNumber * oceanAnimationSpeedLowAltitude;
  175571. noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyLowAltitude, time, 0.0);
  175572. vec3 normalTangentSpaceLowAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeLowAltitude);
  175573. // blend the 2 wave layers based on distance to surface
  175574. float highAltitudeFade = linearFade(0.0, 60000.0, positionToEyeECLength);
  175575. float lowAltitudeFade = 1.0 - linearFade(20000.0, 60000.0, positionToEyeECLength);
  175576. vec3 normalTangentSpace =
  175577. (highAltitudeFade * normalTangentSpaceHighAltitude) +
  175578. (lowAltitudeFade * normalTangentSpaceLowAltitude);
  175579. normalTangentSpace = normalize(normalTangentSpace);
  175580. // fade out the normal perturbation as we move farther from the water surface
  175581. normalTangentSpace.xy *= waveIntensity;
  175582. normalTangentSpace = normalize(normalTangentSpace);
  175583. #else
  175584. vec3 normalTangentSpace = vec3(0.0, 0.0, 1.0);
  175585. #endif
  175586. vec3 normalEC = enuToEye * normalTangentSpace;
  175587. const vec3 waveHighlightColor = vec3(0.3, 0.45, 0.6);
  175588. // Use diffuse light to highlight the waves
  175589. float diffuseIntensity = czm_getLambertDiffuse(czm_lightDirectionEC, normalEC) * maskValue;
  175590. vec3 diffuseHighlight = waveHighlightColor * diffuseIntensity * (1.0 - fade);
  175591. #ifdef SHOW_OCEAN_WAVES
  175592. // Where diffuse light is low or non-existent, use wave highlights based solely on
  175593. // the wave bumpiness and no particular light direction.
  175594. float tsPerturbationRatio = normalTangentSpace.z;
  175595. vec3 nonDiffuseHighlight = mix(waveHighlightColor * 5.0 * (1.0 - tsPerturbationRatio), vec3(0.0), diffuseIntensity);
  175596. #else
  175597. vec3 nonDiffuseHighlight = vec3(0.0);
  175598. #endif
  175599. // Add specular highlights in 3D, and in all modes when zoomed in.
  175600. float specularIntensity = czm_getSpecular(czm_lightDirectionEC, normalizedPositionToEyeEC, normalEC, 10.0);
  175601. float surfaceReflectance = mix(0.0, mix(u_zoomedOutOceanSpecularIntensity, oceanSpecularIntensity, waveIntensity), maskValue);
  175602. float specular = specularIntensity * surfaceReflectance;
  175603. #ifdef HDR
  175604. specular *= 1.4;
  175605. float e = 0.2;
  175606. float d = 3.3;
  175607. float c = 1.7;
  175608. vec3 color = imageryColor.rgb + (c * (vec3(e) + imageryColor.rgb * d) * (diffuseHighlight + nonDiffuseHighlight + specular));
  175609. #else
  175610. vec3 color = imageryColor.rgb + diffuseHighlight + nonDiffuseHighlight + specular;
  175611. #endif
  175612. return vec4(color, imageryColor.a);
  175613. }
  175614. #endif // #ifdef SHOW_REFLECTIVE_OCEAN
  175615. `;
  175616. // node_modules/cesium/Source/Shaders/GlobeVS.js
  175617. var GlobeVS_default = "#ifdef QUANTIZATION_BITS12\nattribute vec4 compressed0;\nattribute float compressed1;\n#else\nattribute vec4 position3DAndHeight;\nattribute vec4 textureCoordAndEncodedNormals;\n#endif\n\n#ifdef GEODETIC_SURFACE_NORMALS\nattribute vec3 geodeticSurfaceNormal;\n#endif\n\n#ifdef EXAGGERATION\nuniform vec2 u_terrainExaggerationAndRelativeHeight;\n#endif\n\nuniform vec3 u_center3D;\nuniform mat4 u_modifiedModelView;\nuniform mat4 u_modifiedModelViewProjection;\nuniform vec4 u_tileRectangle;\n\n// Uniforms for 2D Mercator projection\nuniform vec2 u_southAndNorthLatitude;\nuniform vec2 u_southMercatorYAndOneOverHeight;\n\nvarying vec3 v_positionMC;\nvarying vec3 v_positionEC;\n\nvarying vec3 v_textureCoordinates;\nvarying vec3 v_normalMC;\nvarying vec3 v_normalEC;\n\n#ifdef APPLY_MATERIAL\nvarying float v_slope;\nvarying float v_aspect;\nvarying float v_height;\n#endif\n\n#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)\nvarying float v_distance;\n#endif\n\n#if defined(FOG) || defined(GROUND_ATMOSPHERE)\nvarying vec3 v_atmosphereRayleighColor;\nvarying vec3 v_atmosphereMieColor;\nvarying float v_atmosphereOpacity;\n#endif\n\n// These functions are generated at runtime.\nvec4 getPosition(vec3 position, float height, vec2 textureCoordinates);\nfloat get2DYPositionFraction(vec2 textureCoordinates);\n\nvec4 getPosition3DMode(vec3 position, float height, vec2 textureCoordinates)\n{\n return u_modifiedModelViewProjection * vec4(position, 1.0);\n}\n\nfloat get2DMercatorYPositionFraction(vec2 textureCoordinates)\n{\n // The width of a tile at level 11, in radians and assuming a single root tile, is\n // 2.0 * czm_pi / pow(2.0, 11.0)\n // We want to just linearly interpolate the 2D position from the texture coordinates\n // when we're at this level or higher. The constant below is the expression\n // above evaluated and then rounded up at the 4th significant digit.\n const float maxTileWidth = 0.003068;\n float positionFraction = textureCoordinates.y;\n float southLatitude = u_southAndNorthLatitude.x;\n float northLatitude = u_southAndNorthLatitude.y;\n if (northLatitude - southLatitude > maxTileWidth)\n {\n float southMercatorY = u_southMercatorYAndOneOverHeight.x;\n float oneOverMercatorHeight = u_southMercatorYAndOneOverHeight.y;\n\n float currentLatitude = mix(southLatitude, northLatitude, textureCoordinates.y);\n currentLatitude = clamp(currentLatitude, -czm_webMercatorMaxLatitude, czm_webMercatorMaxLatitude);\n positionFraction = czm_latitudeToWebMercatorFraction(currentLatitude, southMercatorY, oneOverMercatorHeight);\n }\n return positionFraction;\n}\n\nfloat get2DGeographicYPositionFraction(vec2 textureCoordinates)\n{\n return textureCoordinates.y;\n}\n\nvec4 getPositionPlanarEarth(vec3 position, float height, vec2 textureCoordinates)\n{\n float yPositionFraction = get2DYPositionFraction(textureCoordinates);\n vec4 rtcPosition2D = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\n return u_modifiedModelViewProjection * rtcPosition2D;\n}\n\nvec4 getPosition2DMode(vec3 position, float height, vec2 textureCoordinates)\n{\n return getPositionPlanarEarth(position, 0.0, textureCoordinates);\n}\n\nvec4 getPositionColumbusViewMode(vec3 position, float height, vec2 textureCoordinates)\n{\n return getPositionPlanarEarth(position, height, textureCoordinates);\n}\n\nvec4 getPositionMorphingMode(vec3 position, float height, vec2 textureCoordinates)\n{\n // We do not do RTC while morphing, so there is potential for jitter.\n // This is unlikely to be noticeable, though.\n vec3 position3DWC = position + u_center3D;\n float yPositionFraction = get2DYPositionFraction(textureCoordinates);\n vec4 position2DWC = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\n vec4 morphPosition = czm_columbusViewMorph(position2DWC, vec4(position3DWC, 1.0), czm_morphTime);\n return czm_modelViewProjection * morphPosition;\n}\n\n#ifdef QUANTIZATION_BITS12\nuniform vec2 u_minMaxHeight;\nuniform mat4 u_scaleAndBias;\n#endif\n\nvoid main()\n{\n#ifdef QUANTIZATION_BITS12\n vec2 xy = czm_decompressTextureCoordinates(compressed0.x);\n vec2 zh = czm_decompressTextureCoordinates(compressed0.y);\n vec3 position = vec3(xy, zh.x);\n float height = zh.y;\n vec2 textureCoordinates = czm_decompressTextureCoordinates(compressed0.z);\n\n height = height * (u_minMaxHeight.y - u_minMaxHeight.x) + u_minMaxHeight.x;\n position = (u_scaleAndBias * vec4(position, 1.0)).xyz;\n\n#if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)) && defined(INCLUDE_WEB_MERCATOR_Y)\n float webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;\n float encodedNormal = compressed1;\n#elif defined(INCLUDE_WEB_MERCATOR_Y)\n float webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;\n float encodedNormal = 0.0;\n#elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)\n float webMercatorT = textureCoordinates.y;\n float encodedNormal = compressed0.w;\n#else\n float webMercatorT = textureCoordinates.y;\n float encodedNormal = 0.0;\n#endif\n\n#else\n // A single float per element\n vec3 position = position3DAndHeight.xyz;\n float height = position3DAndHeight.w;\n vec2 textureCoordinates = textureCoordAndEncodedNormals.xy;\n\n#if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)) && defined(INCLUDE_WEB_MERCATOR_Y)\n float webMercatorT = textureCoordAndEncodedNormals.z;\n float encodedNormal = textureCoordAndEncodedNormals.w;\n#elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)\n float webMercatorT = textureCoordinates.y;\n float encodedNormal = textureCoordAndEncodedNormals.z;\n#elif defined(INCLUDE_WEB_MERCATOR_Y)\n float webMercatorT = textureCoordAndEncodedNormals.z;\n float encodedNormal = 0.0;\n#else\n float webMercatorT = textureCoordinates.y;\n float encodedNormal = 0.0;\n#endif\n\n#endif\n\n vec3 position3DWC = position + u_center3D;\n\n#ifdef GEODETIC_SURFACE_NORMALS\n vec3 ellipsoidNormal = geodeticSurfaceNormal;\n#else\n vec3 ellipsoidNormal = normalize(position3DWC);\n#endif\n\n#if defined(EXAGGERATION) && defined(GEODETIC_SURFACE_NORMALS)\n float exaggeration = u_terrainExaggerationAndRelativeHeight.x;\n float relativeHeight = u_terrainExaggerationAndRelativeHeight.y;\n float newHeight = (height - relativeHeight) * exaggeration + relativeHeight;\n\n // stop from going through center of earth\n float minRadius = min(min(czm_ellipsoidRadii.x, czm_ellipsoidRadii.y), czm_ellipsoidRadii.z);\n newHeight = max(newHeight, -minRadius);\n\n vec3 offset = ellipsoidNormal * (newHeight - height);\n position += offset;\n position3DWC += offset;\n height = newHeight;\n#endif\n\n gl_Position = getPosition(position, height, textureCoordinates);\n\n v_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz;\n v_positionMC = position3DWC; // position in model coordinates\n\n v_textureCoordinates = vec3(textureCoordinates, webMercatorT);\n\n#if defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)\n vec3 normalMC = czm_octDecode(encodedNormal);\n\n#if defined(EXAGGERATION) && defined(GEODETIC_SURFACE_NORMALS)\n vec3 projection = dot(normalMC, ellipsoidNormal) * ellipsoidNormal;\n vec3 rejection = normalMC - projection;\n normalMC = normalize(projection + rejection * exaggeration);\n#endif\n\n v_normalMC = normalMC;\n v_normalEC = czm_normal3D * v_normalMC;\n#endif\n\n#if defined(FOG) || (defined(GROUND_ATMOSPHERE) && !defined(PER_FRAGMENT_GROUND_ATMOSPHERE))\n\n bool dynamicLighting = false;\n\n #if defined(DYNAMIC_ATMOSPHERE_LIGHTING) && (defined(ENABLE_DAYNIGHT_SHADING) || defined(ENABLE_VERTEX_LIGHTING))\n dynamicLighting = true;\n #endif\n\n#if defined(DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN)\n vec3 atmosphereLightDirection = czm_sunDirectionWC;\n#else\n vec3 atmosphereLightDirection = czm_lightDirectionWC;\n#endif\n\n vec3 lightDirection = czm_branchFreeTernary(dynamicLighting, atmosphereLightDirection, normalize(position3DWC));\n\n computeAtmosphereScattering(\n position3DWC,\n lightDirection,\n v_atmosphereRayleighColor,\n v_atmosphereMieColor,\n v_atmosphereOpacity\n );\n#endif\n\n#if defined(FOG) || defined(GROUND_ATMOSPHERE) || defined(UNDERGROUND_COLOR) || defined(TRANSLUCENT)\n v_distance = length((czm_modelView3D * vec4(position3DWC, 1.0)).xyz);\n#endif\n\n#ifdef APPLY_MATERIAL\n float northPoleZ = czm_ellipsoidRadii.z;\n vec3 northPolePositionMC = vec3(0.0, 0.0, northPoleZ);\n vec3 vectorEastMC = normalize(cross(northPolePositionMC - v_positionMC, ellipsoidNormal));\n float dotProd = abs(dot(ellipsoidNormal, v_normalMC));\n v_slope = acos(dotProd);\n vec3 normalRejected = ellipsoidNormal * dotProd;\n vec3 normalProjected = v_normalMC - normalRejected;\n vec3 aspectVector = normalize(normalProjected);\n v_aspect = acos(dot(aspectVector, vectorEastMC));\n float determ = dot(cross(vectorEastMC, aspectVector), ellipsoidNormal);\n v_aspect = czm_branchFreeTernary(determ < 0.0, 2.0 * czm_pi - v_aspect, v_aspect);\n v_height = height;\n#endif\n}\n";
  175618. // node_modules/cesium/Source/Shaders/AtmosphereCommon.js
  175619. var AtmosphereCommon_default = "uniform vec3 u_radiiAndDynamicAtmosphereColor;\n\nuniform float u_atmosphereLightIntensity;\nuniform float u_atmosphereRayleighScaleHeight;\nuniform float u_atmosphereMieScaleHeight;\nuniform float u_atmosphereMieAnisotropy;\nuniform vec3 u_atmosphereRayleighCoefficient;\nuniform vec3 u_atmosphereMieCoefficient;\n\nconst float ATMOSPHERE_THICKNESS = 111e3; // The thickness of the atmosphere in meters.\nconst int PRIMARY_STEPS = 16; // Number of times the ray from the camera to the world position (primary ray) is sampled.\nconst int LIGHT_STEPS = 4; // Number of times the light is sampled from the light source's intersection with the atmosphere to a sample position on the primary ray.\n\n/**\n * This function computes the colors contributed by Rayliegh and Mie scattering on a given ray, as well as\n * the transmittance value for the ray.\n *\n * @param {czm_ray} primaryRay The ray from the camera to the position.\n * @param {float} primaryRayLength The length of the primary ray.\n * @param {vec3} lightDirection The direction of the light to calculate the scattering from.\n * @param {vec3} rayleighColor The variable the Rayleigh scattering will be written to.\n * @param {vec3} mieColor The variable the Mie scattering will be written to.\n * @param {float} opacity The variable the transmittance will be written to.\n * @glslFunction\n */\nvoid computeScattering(\n czm_ray primaryRay,\n float primaryRayLength,\n vec3 lightDirection,\n float atmosphereInnerRadius,\n out vec3 rayleighColor,\n out vec3 mieColor,\n out float opacity\n) {\n\n // Initialize the default scattering amounts to 0.\n rayleighColor = vec3(0.0);\n mieColor = vec3(0.0);\n opacity = 0.0;\n\n float atmosphereOuterRadius = atmosphereInnerRadius + ATMOSPHERE_THICKNESS;\n\n vec3 origin = vec3(0.0);\n\n // Calculate intersection from the camera to the outer ring of the atmosphere.\n czm_raySegment primaryRayAtmosphereIntersect = czm_raySphereIntersectionInterval(primaryRay, origin, atmosphereOuterRadius);\n\n // Return empty colors if no intersection with the atmosphere geometry.\n if (primaryRayAtmosphereIntersect == czm_emptyRaySegment) {\n return;\n }\n\n // The ray should start from the first intersection with the outer atmopshere, or from the camera position, if it is inside the atmosphere.\n primaryRayAtmosphereIntersect.start = max(primaryRayAtmosphereIntersect.start, 0.0);\n // The ray should end at the exit from the atmosphere or at the distance to the vertex, whichever is smaller.\n primaryRayAtmosphereIntersect.stop = min(primaryRayAtmosphereIntersect.stop, length(primaryRayLength));\n\n // Setup for sampling positions along the ray - starting from the intersection with the outer ring of the atmosphere.\n float rayStepLength = (primaryRayAtmosphereIntersect.stop - primaryRayAtmosphereIntersect.start) / float(PRIMARY_STEPS);\n float rayPositionLength = primaryRayAtmosphereIntersect.start;\n\n vec3 rayleighAccumulation = vec3(0.0);\n vec3 mieAccumulation = vec3(0.0);\n vec2 opticalDepth = vec2(0.0);\n vec2 heightScale = vec2(u_atmosphereRayleighScaleHeight, u_atmosphereMieScaleHeight);\n\n // Sample positions on the primary ray.\n for (int i = 0; i < PRIMARY_STEPS; i++) {\n // Calculate sample position along viewpoint ray.\n vec3 samplePosition = primaryRay.origin + primaryRay.direction * (rayPositionLength + rayStepLength);\n \n // Calculate height of sample position above ellipsoid.\n float sampleHeight = length(samplePosition) - atmosphereInnerRadius;\n\n // Calculate and accumulate density of particles at the sample position.\n vec2 sampleDensity = exp(-sampleHeight / heightScale) * rayStepLength;\n opticalDepth += sampleDensity;\n\n // Generate ray from the sample position segment to the light source, up to the outer ring of the atmosphere.\n czm_ray lightRay = czm_ray(samplePosition, lightDirection);\n czm_raySegment lightRayAtmosphereIntersect = czm_raySphereIntersectionInterval(lightRay, origin, atmosphereOuterRadius);\n \n float lightStepLength = lightRayAtmosphereIntersect.stop / float(LIGHT_STEPS);\n float lightPositionLength = 0.0;\n\n vec2 lightOpticalDepth = vec2(0.0);\n\n // Sample positions along the light ray, to accumulate incidence of light on the latest sample segment.\n for (int j = 0; j < LIGHT_STEPS; j++) {\n\n // Calculate sample position along light ray.\n vec3 lightPosition = samplePosition + lightDirection * (lightPositionLength + lightStepLength * 0.5);\n\n // Calculate height of the light sample position above ellipsoid.\n float lightHeight = length(lightPosition) - atmosphereInnerRadius;\n\n // Calculate density of photons at the light sample position.\n lightOpticalDepth += exp(-lightHeight / heightScale) * lightStepLength;\n\n // Increment distance on light ray.\n lightPositionLength += lightStepLength;\n }\n\n // Compute attenuation via the primary ray and the light ray.\n vec3 attenuation = exp(-((u_atmosphereMieCoefficient * (opticalDepth.y + lightOpticalDepth.y)) + (u_atmosphereRayleighCoefficient * (opticalDepth.x + lightOpticalDepth.x))));\n\n // Accumulate the scattering.\n rayleighAccumulation += sampleDensity.x * attenuation;\n mieAccumulation += sampleDensity.y * attenuation;\n\n // Increment distance on primary ray.\n rayPositionLength += rayStepLength;\n }\n\n // Compute the scattering amount.\n rayleighColor = u_atmosphereRayleighCoefficient * rayleighAccumulation;\n mieColor = u_atmosphereMieCoefficient * mieAccumulation;\n\n // Compute the transmittance i.e. how much light is passing through the atmosphere.\n opacity = length(exp(-((u_atmosphereMieCoefficient * opticalDepth.y) + (u_atmosphereRayleighCoefficient * opticalDepth.x))));\n}\n\nvec4 computeAtmosphereColor(\n vec3 positionWC,\n vec3 lightDirection,\n vec3 rayleighColor,\n vec3 mieColor,\n float opacity\n) {\n // Setup the primary ray: from the camera position to the vertex position.\n vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;\n vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);\n\n float cosAngle = dot(cameraToPositionWCDirection, lightDirection);\n float cosAngleSq = cosAngle * cosAngle;\n\n float G = u_atmosphereMieAnisotropy;\n float GSq = G * G;\n\n // The Rayleigh phase function.\n float rayleighPhase = 3.0 / (50.2654824574) * (1.0 + cosAngleSq);\n // The Mie phase function.\n float miePhase = 3.0 / (25.1327412287) * ((1.0 - GSq) * (cosAngleSq + 1.0)) / (pow(1.0 + GSq - 2.0 * cosAngle * G, 1.5) * (2.0 + GSq));\n\n // The final color is generated by combining the effects of the Rayleigh and Mie scattering.\n vec3 rayleigh = rayleighPhase * rayleighColor;\n vec3 mie = miePhase * mieColor;\n\n vec3 color = (rayleigh + mie) * u_atmosphereLightIntensity;\n\n return vec4(color, opacity);\n}\n";
  175620. // node_modules/cesium/Source/Shaders/GroundAtmosphere.js
  175621. var GroundAtmosphere_default = "void computeAtmosphereScattering(vec3 positionWC, vec3 lightDirection, out vec3 rayleighColor, out vec3 mieColor, out float opacity) {\n\n vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;\n vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);\n czm_ray primaryRay = czm_ray(czm_viewerPositionWC, cameraToPositionWCDirection);\n \n float atmosphereInnerRadius = length(positionWC);\n\n computeScattering(\n primaryRay,\n length(cameraToPositionWC),\n lightDirection,\n atmosphereInnerRadius,\n rayleighColor,\n mieColor,\n opacity\n );\n}\n";
  175622. // node_modules/cesium/Source/Scene/GlobeSurfaceShaderSet.js
  175623. function GlobeSurfaceShader(numberOfDayTextures, flags, material, shaderProgram, clippingShaderState) {
  175624. this.numberOfDayTextures = numberOfDayTextures;
  175625. this.flags = flags;
  175626. this.material = material;
  175627. this.shaderProgram = shaderProgram;
  175628. this.clippingShaderState = clippingShaderState;
  175629. }
  175630. function GlobeSurfaceShaderSet() {
  175631. this.baseVertexShaderSource = void 0;
  175632. this.baseFragmentShaderSource = void 0;
  175633. this._shadersByTexturesFlags = [];
  175634. this.material = void 0;
  175635. }
  175636. function getPositionMode(sceneMode) {
  175637. const getPosition3DMode = "vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPosition3DMode(position, height, textureCoordinates); }";
  175638. const getPositionColumbusViewAnd2DMode = "vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionColumbusViewMode(position, height, textureCoordinates); }";
  175639. const getPositionMorphingMode = "vec4 getPosition(vec3 position, float height, vec2 textureCoordinates) { return getPositionMorphingMode(position, height, textureCoordinates); }";
  175640. let positionMode;
  175641. switch (sceneMode) {
  175642. case SceneMode_default.SCENE3D:
  175643. positionMode = getPosition3DMode;
  175644. break;
  175645. case SceneMode_default.SCENE2D:
  175646. case SceneMode_default.COLUMBUS_VIEW:
  175647. positionMode = getPositionColumbusViewAnd2DMode;
  175648. break;
  175649. case SceneMode_default.MORPHING:
  175650. positionMode = getPositionMorphingMode;
  175651. break;
  175652. }
  175653. return positionMode;
  175654. }
  175655. function get2DYPositionFraction(useWebMercatorProjection) {
  175656. const get2DYPositionFractionGeographicProjection = "float get2DYPositionFraction(vec2 textureCoordinates) { return get2DGeographicYPositionFraction(textureCoordinates); }";
  175657. const get2DYPositionFractionMercatorProjection = "float get2DYPositionFraction(vec2 textureCoordinates) { return get2DMercatorYPositionFraction(textureCoordinates); }";
  175658. return useWebMercatorProjection ? get2DYPositionFractionMercatorProjection : get2DYPositionFractionGeographicProjection;
  175659. }
  175660. GlobeSurfaceShaderSet.prototype.getShaderProgram = function(options) {
  175661. const frameState = options.frameState;
  175662. const surfaceTile = options.surfaceTile;
  175663. const numberOfDayTextures = options.numberOfDayTextures;
  175664. const applyBrightness = options.applyBrightness;
  175665. const applyContrast = options.applyContrast;
  175666. const applyHue = options.applyHue;
  175667. const applySaturation = options.applySaturation;
  175668. const applyGamma = options.applyGamma;
  175669. const applyAlpha = options.applyAlpha;
  175670. const applyDayNightAlpha = options.applyDayNightAlpha;
  175671. const applySplit = options.applySplit;
  175672. const showReflectiveOcean = options.showReflectiveOcean;
  175673. const showOceanWaves = options.showOceanWaves;
  175674. const enableLighting = options.enableLighting;
  175675. const dynamicAtmosphereLighting = options.dynamicAtmosphereLighting;
  175676. const dynamicAtmosphereLightingFromSun = options.dynamicAtmosphereLightingFromSun;
  175677. const showGroundAtmosphere = options.showGroundAtmosphere;
  175678. const perFragmentGroundAtmosphere = options.perFragmentGroundAtmosphere;
  175679. const hasVertexNormals = options.hasVertexNormals;
  175680. const useWebMercatorProjection = options.useWebMercatorProjection;
  175681. const enableFog = options.enableFog;
  175682. const enableClippingPlanes = options.enableClippingPlanes;
  175683. const clippingPlanes = options.clippingPlanes;
  175684. const clippedByBoundaries = options.clippedByBoundaries;
  175685. const hasImageryLayerCutout = options.hasImageryLayerCutout;
  175686. const colorCorrect = options.colorCorrect;
  175687. const highlightFillTile = options.highlightFillTile;
  175688. const colorToAlpha = options.colorToAlpha;
  175689. const hasGeodeticSurfaceNormals = options.hasGeodeticSurfaceNormals;
  175690. const hasExaggeration = options.hasExaggeration;
  175691. const showUndergroundColor = options.showUndergroundColor;
  175692. const translucent = options.translucent;
  175693. let quantization = 0;
  175694. let quantizationDefine = "";
  175695. const mesh2 = surfaceTile.renderedMesh;
  175696. const terrainEncoding = mesh2.encoding;
  175697. const quantizationMode = terrainEncoding.quantization;
  175698. if (quantizationMode === TerrainQuantization_default.BITS12) {
  175699. quantization = 1;
  175700. quantizationDefine = "QUANTIZATION_BITS12";
  175701. }
  175702. let cartographicLimitRectangleFlag = 0;
  175703. let cartographicLimitRectangleDefine = "";
  175704. if (clippedByBoundaries) {
  175705. cartographicLimitRectangleFlag = 1;
  175706. cartographicLimitRectangleDefine = "TILE_LIMIT_RECTANGLE";
  175707. }
  175708. let imageryCutoutFlag = 0;
  175709. let imageryCutoutDefine = "";
  175710. if (hasImageryLayerCutout) {
  175711. imageryCutoutFlag = 1;
  175712. imageryCutoutDefine = "APPLY_IMAGERY_CUTOUT";
  175713. }
  175714. const sceneMode = frameState.mode;
  175715. const flags = sceneMode | applyBrightness << 2 | applyContrast << 3 | applyHue << 4 | applySaturation << 5 | applyGamma << 6 | applyAlpha << 7 | showReflectiveOcean << 8 | showOceanWaves << 9 | enableLighting << 10 | dynamicAtmosphereLighting << 11 | dynamicAtmosphereLightingFromSun << 12 | showGroundAtmosphere << 13 | perFragmentGroundAtmosphere << 14 | hasVertexNormals << 15 | useWebMercatorProjection << 16 | enableFog << 17 | quantization << 18 | applySplit << 19 | enableClippingPlanes << 20 | cartographicLimitRectangleFlag << 21 | imageryCutoutFlag << 22 | colorCorrect << 23 | highlightFillTile << 24 | colorToAlpha << 25 | hasGeodeticSurfaceNormals << 26 | hasExaggeration << 27 | showUndergroundColor << 28 | translucent << 29 | applyDayNightAlpha << 30;
  175716. let currentClippingShaderState = 0;
  175717. if (defined_default(clippingPlanes) && clippingPlanes.length > 0) {
  175718. currentClippingShaderState = enableClippingPlanes ? clippingPlanes.clippingPlanesState : 0;
  175719. }
  175720. let surfaceShader = surfaceTile.surfaceShader;
  175721. if (defined_default(surfaceShader) && surfaceShader.numberOfDayTextures === numberOfDayTextures && surfaceShader.flags === flags && surfaceShader.material === this.material && surfaceShader.clippingShaderState === currentClippingShaderState) {
  175722. return surfaceShader.shaderProgram;
  175723. }
  175724. let shadersByFlags = this._shadersByTexturesFlags[numberOfDayTextures];
  175725. if (!defined_default(shadersByFlags)) {
  175726. shadersByFlags = this._shadersByTexturesFlags[numberOfDayTextures] = [];
  175727. }
  175728. surfaceShader = shadersByFlags[flags];
  175729. if (!defined_default(surfaceShader) || surfaceShader.material !== this.material || surfaceShader.clippingShaderState !== currentClippingShaderState) {
  175730. const vs = this.baseVertexShaderSource.clone();
  175731. const fs = this.baseFragmentShaderSource.clone();
  175732. if (currentClippingShaderState !== 0) {
  175733. fs.sources.unshift(
  175734. getClippingFunction_default(clippingPlanes, frameState.context)
  175735. );
  175736. }
  175737. vs.defines.push(quantizationDefine);
  175738. fs.defines.push(
  175739. `TEXTURE_UNITS ${numberOfDayTextures}`,
  175740. cartographicLimitRectangleDefine,
  175741. imageryCutoutDefine
  175742. );
  175743. if (applyBrightness) {
  175744. fs.defines.push("APPLY_BRIGHTNESS");
  175745. }
  175746. if (applyContrast) {
  175747. fs.defines.push("APPLY_CONTRAST");
  175748. }
  175749. if (applyHue) {
  175750. fs.defines.push("APPLY_HUE");
  175751. }
  175752. if (applySaturation) {
  175753. fs.defines.push("APPLY_SATURATION");
  175754. }
  175755. if (applyGamma) {
  175756. fs.defines.push("APPLY_GAMMA");
  175757. }
  175758. if (applyAlpha) {
  175759. fs.defines.push("APPLY_ALPHA");
  175760. }
  175761. if (applyDayNightAlpha) {
  175762. fs.defines.push("APPLY_DAY_NIGHT_ALPHA");
  175763. }
  175764. if (showReflectiveOcean) {
  175765. fs.defines.push("SHOW_REFLECTIVE_OCEAN");
  175766. vs.defines.push("SHOW_REFLECTIVE_OCEAN");
  175767. }
  175768. if (showOceanWaves) {
  175769. fs.defines.push("SHOW_OCEAN_WAVES");
  175770. }
  175771. if (colorToAlpha) {
  175772. fs.defines.push("APPLY_COLOR_TO_ALPHA");
  175773. }
  175774. if (showUndergroundColor) {
  175775. vs.defines.push("UNDERGROUND_COLOR");
  175776. fs.defines.push("UNDERGROUND_COLOR");
  175777. }
  175778. if (translucent) {
  175779. vs.defines.push("TRANSLUCENT");
  175780. fs.defines.push("TRANSLUCENT");
  175781. }
  175782. if (enableLighting) {
  175783. if (hasVertexNormals) {
  175784. vs.defines.push("ENABLE_VERTEX_LIGHTING");
  175785. fs.defines.push("ENABLE_VERTEX_LIGHTING");
  175786. } else {
  175787. vs.defines.push("ENABLE_DAYNIGHT_SHADING");
  175788. fs.defines.push("ENABLE_DAYNIGHT_SHADING");
  175789. }
  175790. }
  175791. if (dynamicAtmosphereLighting) {
  175792. vs.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING");
  175793. fs.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING");
  175794. if (dynamicAtmosphereLightingFromSun) {
  175795. vs.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN");
  175796. fs.defines.push("DYNAMIC_ATMOSPHERE_LIGHTING_FROM_SUN");
  175797. }
  175798. }
  175799. if (showGroundAtmosphere) {
  175800. vs.defines.push("GROUND_ATMOSPHERE");
  175801. fs.defines.push("GROUND_ATMOSPHERE");
  175802. if (perFragmentGroundAtmosphere) {
  175803. vs.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE");
  175804. fs.defines.push("PER_FRAGMENT_GROUND_ATMOSPHERE");
  175805. }
  175806. }
  175807. vs.defines.push("INCLUDE_WEB_MERCATOR_Y");
  175808. fs.defines.push("INCLUDE_WEB_MERCATOR_Y");
  175809. if (enableFog) {
  175810. vs.defines.push("FOG");
  175811. fs.defines.push("FOG");
  175812. }
  175813. if (applySplit) {
  175814. fs.defines.push("APPLY_SPLIT");
  175815. }
  175816. if (enableClippingPlanes) {
  175817. fs.defines.push("ENABLE_CLIPPING_PLANES");
  175818. }
  175819. if (colorCorrect) {
  175820. fs.defines.push("COLOR_CORRECT");
  175821. }
  175822. if (highlightFillTile) {
  175823. fs.defines.push("HIGHLIGHT_FILL_TILE");
  175824. }
  175825. if (hasGeodeticSurfaceNormals) {
  175826. vs.defines.push("GEODETIC_SURFACE_NORMALS");
  175827. }
  175828. if (hasExaggeration) {
  175829. vs.defines.push("EXAGGERATION");
  175830. }
  175831. let computeDayColor = " vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates, float nightBlend)\n {\n vec4 color = initialColor;\n";
  175832. if (hasImageryLayerCutout) {
  175833. computeDayColor += " vec4 cutoutAndColorResult;\n bool texelUnclipped;\n";
  175834. }
  175835. for (let i2 = 0; i2 < numberOfDayTextures; ++i2) {
  175836. if (hasImageryLayerCutout) {
  175837. computeDayColor += ` cutoutAndColorResult = u_dayTextureCutoutRectangles[${i2}];
  175838. texelUnclipped = v_textureCoordinates.x < cutoutAndColorResult.x || cutoutAndColorResult.z < v_textureCoordinates.x || v_textureCoordinates.y < cutoutAndColorResult.y || cutoutAndColorResult.w < v_textureCoordinates.y;
  175839. cutoutAndColorResult = sampleAndBlend(
  175840. `;
  175841. } else {
  175842. computeDayColor += " color = sampleAndBlend(\n";
  175843. }
  175844. computeDayColor += ` color,
  175845. u_dayTextures[${i2}],
  175846. u_dayTextureUseWebMercatorT[${i2}] ? textureCoordinates.xz : textureCoordinates.xy,
  175847. u_dayTextureTexCoordsRectangle[${i2}],
  175848. u_dayTextureTranslationAndScale[${i2}],
  175849. ${applyAlpha ? `u_dayTextureAlpha[${i2}]` : "1.0"},
  175850. ${applyDayNightAlpha ? `u_dayTextureNightAlpha[${i2}]` : "1.0"},
  175851. ${applyDayNightAlpha ? `u_dayTextureDayAlpha[${i2}]` : "1.0"},
  175852. ${applyBrightness ? `u_dayTextureBrightness[${i2}]` : "0.0"},
  175853. ${applyContrast ? `u_dayTextureContrast[${i2}]` : "0.0"},
  175854. ${applyHue ? `u_dayTextureHue[${i2}]` : "0.0"},
  175855. ${applySaturation ? `u_dayTextureSaturation[${i2}]` : "0.0"},
  175856. ${applyGamma ? `u_dayTextureOneOverGamma[${i2}]` : "0.0"},
  175857. ${applySplit ? `u_dayTextureSplit[${i2}]` : "0.0"},
  175858. ${colorToAlpha ? `u_colorsToAlpha[${i2}]` : "vec4(0.0)"},
  175859. nightBlend );
  175860. `;
  175861. if (hasImageryLayerCutout) {
  175862. computeDayColor += " color = czm_branchFreeTernary(texelUnclipped, cutoutAndColorResult, color);\n";
  175863. }
  175864. }
  175865. computeDayColor += " return color;\n }";
  175866. fs.sources.push(computeDayColor);
  175867. vs.sources.push(getPositionMode(sceneMode));
  175868. vs.sources.push(get2DYPositionFraction(useWebMercatorProjection));
  175869. const shader = ShaderProgram_default.fromCache({
  175870. context: frameState.context,
  175871. vertexShaderSource: vs,
  175872. fragmentShaderSource: fs,
  175873. attributeLocations: terrainEncoding.getAttributeLocations()
  175874. });
  175875. surfaceShader = shadersByFlags[flags] = new GlobeSurfaceShader(
  175876. numberOfDayTextures,
  175877. flags,
  175878. this.material,
  175879. shader,
  175880. currentClippingShaderState
  175881. );
  175882. }
  175883. surfaceTile.surfaceShader = surfaceShader;
  175884. return surfaceShader.shaderProgram;
  175885. };
  175886. GlobeSurfaceShaderSet.prototype.destroy = function() {
  175887. let flags;
  175888. let shader;
  175889. const shadersByTexturesFlags = this._shadersByTexturesFlags;
  175890. for (const textureCount in shadersByTexturesFlags) {
  175891. if (shadersByTexturesFlags.hasOwnProperty(textureCount)) {
  175892. const shadersByFlags = shadersByTexturesFlags[textureCount];
  175893. if (!defined_default(shadersByFlags)) {
  175894. continue;
  175895. }
  175896. for (flags in shadersByFlags) {
  175897. if (shadersByFlags.hasOwnProperty(flags)) {
  175898. shader = shadersByFlags[flags];
  175899. if (defined_default(shader)) {
  175900. shader.shaderProgram.destroy();
  175901. }
  175902. }
  175903. }
  175904. }
  175905. }
  175906. return destroyObject_default(this);
  175907. };
  175908. var GlobeSurfaceShaderSet_default = GlobeSurfaceShaderSet;
  175909. // node_modules/cesium/Source/Scene/ImageryState.js
  175910. var ImageryState = {
  175911. UNLOADED: 0,
  175912. TRANSITIONING: 1,
  175913. RECEIVED: 2,
  175914. TEXTURE_LOADED: 3,
  175915. READY: 4,
  175916. FAILED: 5,
  175917. INVALID: 6,
  175918. PLACEHOLDER: 7
  175919. };
  175920. var ImageryState_default = Object.freeze(ImageryState);
  175921. // node_modules/cesium/Source/Scene/QuadtreeTileLoadState.js
  175922. var QuadtreeTileLoadState = {
  175923. START: 0,
  175924. LOADING: 1,
  175925. DONE: 2,
  175926. FAILED: 3
  175927. };
  175928. var QuadtreeTileLoadState_default = Object.freeze(QuadtreeTileLoadState);
  175929. // node_modules/cesium/Source/Scene/TerrainState.js
  175930. var TerrainState2 = {
  175931. FAILED: 0,
  175932. UNLOADED: 1,
  175933. RECEIVING: 2,
  175934. RECEIVED: 3,
  175935. TRANSFORMING: 4,
  175936. TRANSFORMED: 5,
  175937. READY: 6
  175938. };
  175939. var TerrainState_default = Object.freeze(TerrainState2);
  175940. // node_modules/cesium/Source/Scene/GlobeSurfaceTile.js
  175941. function GlobeSurfaceTile() {
  175942. this.imagery = [];
  175943. this.waterMaskTexture = void 0;
  175944. this.waterMaskTranslationAndScale = new Cartesian4_default(0, 0, 1, 1);
  175945. this.terrainData = void 0;
  175946. this.vertexArray = void 0;
  175947. this.tileBoundingRegion = void 0;
  175948. this.occludeePointInScaledSpace = new Cartesian3_default();
  175949. this.boundingVolumeSourceTile = void 0;
  175950. this.boundingVolumeIsFromMesh = false;
  175951. this.terrainState = TerrainState_default.UNLOADED;
  175952. this.mesh = void 0;
  175953. this.fill = void 0;
  175954. this.pickBoundingSphere = new BoundingSphere_default();
  175955. this.surfaceShader = void 0;
  175956. this.isClipped = true;
  175957. this.clippedByBoundaries = false;
  175958. }
  175959. Object.defineProperties(GlobeSurfaceTile.prototype, {
  175960. eligibleForUnloading: {
  175961. get: function() {
  175962. const terrainState = this.terrainState;
  175963. const loadingIsTransitioning = terrainState === TerrainState_default.RECEIVING || terrainState === TerrainState_default.TRANSFORMING;
  175964. let shouldRemoveTile = !loadingIsTransitioning;
  175965. const imagery = this.imagery;
  175966. for (let i2 = 0, len = imagery.length; shouldRemoveTile && i2 < len; ++i2) {
  175967. const tileImagery = imagery[i2];
  175968. shouldRemoveTile = !defined_default(tileImagery.loadingImagery) || tileImagery.loadingImagery.state !== ImageryState_default.TRANSITIONING;
  175969. }
  175970. return shouldRemoveTile;
  175971. }
  175972. },
  175973. renderedMesh: {
  175974. get: function() {
  175975. if (defined_default(this.vertexArray)) {
  175976. return this.mesh;
  175977. } else if (defined_default(this.fill)) {
  175978. return this.fill.mesh;
  175979. }
  175980. return void 0;
  175981. }
  175982. }
  175983. });
  175984. var scratchCartographic17 = new Cartographic_default();
  175985. function getPosition3(encoding, mode2, projection, vertices, index2, result) {
  175986. let position = encoding.getExaggeratedPosition(vertices, index2, result);
  175987. if (defined_default(mode2) && mode2 !== SceneMode_default.SCENE3D) {
  175988. const ellipsoid = projection.ellipsoid;
  175989. const positionCartographic = ellipsoid.cartesianToCartographic(
  175990. position,
  175991. scratchCartographic17
  175992. );
  175993. position = projection.project(positionCartographic, result);
  175994. position = Cartesian3_default.fromElements(
  175995. position.z,
  175996. position.x,
  175997. position.y,
  175998. result
  175999. );
  176000. }
  176001. return position;
  176002. }
  176003. var scratchV0 = new Cartesian3_default();
  176004. var scratchV1 = new Cartesian3_default();
  176005. var scratchV2 = new Cartesian3_default();
  176006. GlobeSurfaceTile.prototype.pick = function(ray, mode2, projection, cullBackFaces, result) {
  176007. const mesh2 = this.renderedMesh;
  176008. if (!defined_default(mesh2)) {
  176009. return void 0;
  176010. }
  176011. const vertices = mesh2.vertices;
  176012. const indices2 = mesh2.indices;
  176013. const encoding = mesh2.encoding;
  176014. const indicesLength = indices2.length;
  176015. let minT = Number.MAX_VALUE;
  176016. for (let i2 = 0; i2 < indicesLength; i2 += 3) {
  176017. const i0 = indices2[i2];
  176018. const i1 = indices2[i2 + 1];
  176019. const i22 = indices2[i2 + 2];
  176020. const v02 = getPosition3(encoding, mode2, projection, vertices, i0, scratchV0);
  176021. const v13 = getPosition3(encoding, mode2, projection, vertices, i1, scratchV1);
  176022. const v23 = getPosition3(encoding, mode2, projection, vertices, i22, scratchV2);
  176023. const t = IntersectionTests_default.rayTriangleParametric(
  176024. ray,
  176025. v02,
  176026. v13,
  176027. v23,
  176028. cullBackFaces
  176029. );
  176030. if (defined_default(t) && t < minT && t >= 0) {
  176031. minT = t;
  176032. }
  176033. }
  176034. return minT !== Number.MAX_VALUE ? Ray_default.getPoint(ray, minT, result) : void 0;
  176035. };
  176036. GlobeSurfaceTile.prototype.freeResources = function() {
  176037. if (defined_default(this.waterMaskTexture)) {
  176038. --this.waterMaskTexture.referenceCount;
  176039. if (this.waterMaskTexture.referenceCount === 0) {
  176040. this.waterMaskTexture.destroy();
  176041. }
  176042. this.waterMaskTexture = void 0;
  176043. }
  176044. this.terrainData = void 0;
  176045. this.terrainState = TerrainState_default.UNLOADED;
  176046. this.mesh = void 0;
  176047. this.fill = this.fill && this.fill.destroy();
  176048. const imageryList = this.imagery;
  176049. for (let i2 = 0, len = imageryList.length; i2 < len; ++i2) {
  176050. imageryList[i2].freeResources();
  176051. }
  176052. this.imagery.length = 0;
  176053. this.freeVertexArray();
  176054. };
  176055. GlobeSurfaceTile.prototype.freeVertexArray = function() {
  176056. GlobeSurfaceTile._freeVertexArray(this.vertexArray);
  176057. this.vertexArray = void 0;
  176058. GlobeSurfaceTile._freeVertexArray(this.wireframeVertexArray);
  176059. this.wireframeVertexArray = void 0;
  176060. };
  176061. GlobeSurfaceTile.initialize = function(tile, terrainProvider, imageryLayerCollection) {
  176062. let surfaceTile = tile.data;
  176063. if (!defined_default(surfaceTile)) {
  176064. surfaceTile = tile.data = new GlobeSurfaceTile();
  176065. }
  176066. if (tile.state === QuadtreeTileLoadState_default.START) {
  176067. prepareNewTile(tile, terrainProvider, imageryLayerCollection);
  176068. tile.state = QuadtreeTileLoadState_default.LOADING;
  176069. }
  176070. };
  176071. GlobeSurfaceTile.processStateMachine = function(tile, frameState, terrainProvider, imageryLayerCollection, quadtree, vertexArraysToDestroy, terrainOnly) {
  176072. GlobeSurfaceTile.initialize(tile, terrainProvider, imageryLayerCollection);
  176073. const surfaceTile = tile.data;
  176074. if (tile.state === QuadtreeTileLoadState_default.LOADING) {
  176075. processTerrainStateMachine(
  176076. tile,
  176077. frameState,
  176078. terrainProvider,
  176079. imageryLayerCollection,
  176080. quadtree,
  176081. vertexArraysToDestroy
  176082. );
  176083. }
  176084. if (terrainOnly) {
  176085. return;
  176086. }
  176087. const wasAlreadyRenderable = tile.renderable;
  176088. tile.renderable = defined_default(surfaceTile.vertexArray);
  176089. const isTerrainDoneLoading = surfaceTile.terrainState === TerrainState_default.READY;
  176090. tile.upsampledFromParent = defined_default(surfaceTile.terrainData) && surfaceTile.terrainData.wasCreatedByUpsampling();
  176091. const isImageryDoneLoading = surfaceTile.processImagery(
  176092. tile,
  176093. terrainProvider,
  176094. frameState
  176095. );
  176096. if (isTerrainDoneLoading && isImageryDoneLoading) {
  176097. const callbacks = tile._loadedCallbacks;
  176098. const newCallbacks = {};
  176099. for (const layerId in callbacks) {
  176100. if (callbacks.hasOwnProperty(layerId)) {
  176101. if (!callbacks[layerId](tile)) {
  176102. newCallbacks[layerId] = callbacks[layerId];
  176103. }
  176104. }
  176105. }
  176106. tile._loadedCallbacks = newCallbacks;
  176107. tile.state = QuadtreeTileLoadState_default.DONE;
  176108. }
  176109. if (wasAlreadyRenderable) {
  176110. tile.renderable = true;
  176111. }
  176112. };
  176113. GlobeSurfaceTile.prototype.processImagery = function(tile, terrainProvider, frameState, skipLoading) {
  176114. const surfaceTile = tile.data;
  176115. let isUpsampledOnly = tile.upsampledFromParent;
  176116. let isAnyTileLoaded = false;
  176117. let isDoneLoading = true;
  176118. const tileImageryCollection = surfaceTile.imagery;
  176119. let i2, len;
  176120. for (i2 = 0, len = tileImageryCollection.length; i2 < len; ++i2) {
  176121. const tileImagery = tileImageryCollection[i2];
  176122. if (!defined_default(tileImagery.loadingImagery)) {
  176123. isUpsampledOnly = false;
  176124. continue;
  176125. }
  176126. if (tileImagery.loadingImagery.state === ImageryState_default.PLACEHOLDER) {
  176127. const imageryLayer = tileImagery.loadingImagery.imageryLayer;
  176128. if (imageryLayer.imageryProvider.ready) {
  176129. tileImagery.freeResources();
  176130. tileImageryCollection.splice(i2, 1);
  176131. imageryLayer._createTileImagerySkeletons(tile, terrainProvider, i2);
  176132. --i2;
  176133. len = tileImageryCollection.length;
  176134. continue;
  176135. } else {
  176136. isUpsampledOnly = false;
  176137. }
  176138. }
  176139. const thisTileDoneLoading = tileImagery.processStateMachine(
  176140. tile,
  176141. frameState,
  176142. skipLoading
  176143. );
  176144. isDoneLoading = isDoneLoading && thisTileDoneLoading;
  176145. isAnyTileLoaded = isAnyTileLoaded || thisTileDoneLoading || defined_default(tileImagery.readyImagery);
  176146. isUpsampledOnly = isUpsampledOnly && defined_default(tileImagery.loadingImagery) && (tileImagery.loadingImagery.state === ImageryState_default.FAILED || tileImagery.loadingImagery.state === ImageryState_default.INVALID);
  176147. }
  176148. tile.upsampledFromParent = isUpsampledOnly;
  176149. tile.renderable = tile.renderable && (isAnyTileLoaded || isDoneLoading);
  176150. return isDoneLoading;
  176151. };
  176152. function toggleGeodeticSurfaceNormals(surfaceTile, enabled, ellipsoid, frameState) {
  176153. const renderedMesh = surfaceTile.renderedMesh;
  176154. const vertexBuffer = renderedMesh.vertices;
  176155. const encoding = renderedMesh.encoding;
  176156. const vertexCount = vertexBuffer.length / encoding.stride;
  176157. let newEncoding = TerrainEncoding_default.clone(encoding);
  176158. newEncoding.hasGeodeticSurfaceNormals = enabled;
  176159. newEncoding = TerrainEncoding_default.clone(newEncoding);
  176160. const newStride = newEncoding.stride;
  176161. const newVertexBuffer = new Float32Array(vertexCount * newStride);
  176162. if (enabled) {
  176163. encoding.addGeodeticSurfaceNormals(
  176164. vertexBuffer,
  176165. newVertexBuffer,
  176166. ellipsoid
  176167. );
  176168. } else {
  176169. encoding.removeGeodeticSurfaceNormals(vertexBuffer, newVertexBuffer);
  176170. }
  176171. renderedMesh.vertices = newVertexBuffer;
  176172. renderedMesh.stride = newStride;
  176173. const isFill = renderedMesh !== surfaceTile.mesh;
  176174. if (isFill) {
  176175. GlobeSurfaceTile._freeVertexArray(surfaceTile.fill.vertexArray);
  176176. surfaceTile.fill.vertexArray = GlobeSurfaceTile._createVertexArrayForMesh(
  176177. frameState.context,
  176178. renderedMesh
  176179. );
  176180. } else {
  176181. GlobeSurfaceTile._freeVertexArray(surfaceTile.vertexArray);
  176182. surfaceTile.vertexArray = GlobeSurfaceTile._createVertexArrayForMesh(
  176183. frameState.context,
  176184. renderedMesh
  176185. );
  176186. }
  176187. GlobeSurfaceTile._freeVertexArray(surfaceTile.wireframeVertexArray);
  176188. surfaceTile.wireframeVertexArray = void 0;
  176189. }
  176190. GlobeSurfaceTile.prototype.addGeodeticSurfaceNormals = function(ellipsoid, frameState) {
  176191. toggleGeodeticSurfaceNormals(this, true, ellipsoid, frameState);
  176192. };
  176193. GlobeSurfaceTile.prototype.removeGeodeticSurfaceNormals = function(frameState) {
  176194. toggleGeodeticSurfaceNormals(this, false, void 0, frameState);
  176195. };
  176196. GlobeSurfaceTile.prototype.updateExaggeration = function(tile, frameState, quadtree) {
  176197. const surfaceTile = this;
  176198. const mesh2 = surfaceTile.renderedMesh;
  176199. if (mesh2 === void 0) {
  176200. return;
  176201. }
  176202. const exaggeration = frameState.terrainExaggeration;
  176203. const exaggerationRelativeHeight = frameState.terrainExaggerationRelativeHeight;
  176204. const hasExaggerationScale = exaggeration !== 1;
  176205. const encoding = mesh2.encoding;
  176206. const encodingExaggerationScaleChanged = encoding.exaggeration !== exaggeration;
  176207. const encodingRelativeHeightChanged = encoding.exaggerationRelativeHeight !== exaggerationRelativeHeight;
  176208. if (encodingExaggerationScaleChanged || encodingRelativeHeightChanged) {
  176209. if (encodingExaggerationScaleChanged) {
  176210. if (hasExaggerationScale && !encoding.hasGeodeticSurfaceNormals) {
  176211. const ellipsoid = tile.tilingScheme.ellipsoid;
  176212. surfaceTile.addGeodeticSurfaceNormals(ellipsoid, frameState);
  176213. } else if (!hasExaggerationScale && encoding.hasGeodeticSurfaceNormals) {
  176214. surfaceTile.removeGeodeticSurfaceNormals(frameState);
  176215. }
  176216. }
  176217. encoding.exaggeration = exaggeration;
  176218. encoding.exaggerationRelativeHeight = exaggerationRelativeHeight;
  176219. if (quadtree !== void 0) {
  176220. quadtree._tileToUpdateHeights.push(tile);
  176221. const customData = tile.customData;
  176222. const customDataLength = customData.length;
  176223. for (let i2 = 0; i2 < customDataLength; i2++) {
  176224. const data = customData[i2];
  176225. data.level = -1;
  176226. }
  176227. }
  176228. }
  176229. };
  176230. function prepareNewTile(tile, terrainProvider, imageryLayerCollection) {
  176231. let available = terrainProvider.getTileDataAvailable(
  176232. tile.x,
  176233. tile.y,
  176234. tile.level
  176235. );
  176236. if (!defined_default(available) && defined_default(tile.parent)) {
  176237. const parent = tile.parent;
  176238. const parentSurfaceTile = parent.data;
  176239. if (defined_default(parentSurfaceTile) && defined_default(parentSurfaceTile.terrainData)) {
  176240. available = parentSurfaceTile.terrainData.isChildAvailable(
  176241. parent.x,
  176242. parent.y,
  176243. tile.x,
  176244. tile.y
  176245. );
  176246. }
  176247. }
  176248. if (available === false) {
  176249. tile.data.terrainState = TerrainState_default.FAILED;
  176250. }
  176251. for (let i2 = 0, len = imageryLayerCollection.length; i2 < len; ++i2) {
  176252. const layer = imageryLayerCollection.get(i2);
  176253. if (layer.show) {
  176254. layer._createTileImagerySkeletons(tile, terrainProvider);
  176255. }
  176256. }
  176257. }
  176258. function processTerrainStateMachine(tile, frameState, terrainProvider, imageryLayerCollection, quadtree, vertexArraysToDestroy) {
  176259. const surfaceTile = tile.data;
  176260. const parent = tile.parent;
  176261. if (surfaceTile.terrainState === TerrainState_default.FAILED && parent !== void 0) {
  176262. const parentReady = parent.data !== void 0 && parent.data.terrainData !== void 0 && parent.data.terrainData.canUpsample !== false;
  176263. if (!parentReady) {
  176264. GlobeSurfaceTile.processStateMachine(
  176265. parent,
  176266. frameState,
  176267. terrainProvider,
  176268. imageryLayerCollection,
  176269. quadtree,
  176270. vertexArraysToDestroy,
  176271. true
  176272. );
  176273. }
  176274. }
  176275. if (surfaceTile.terrainState === TerrainState_default.FAILED) {
  176276. upsample(
  176277. surfaceTile,
  176278. tile,
  176279. frameState,
  176280. terrainProvider,
  176281. tile.x,
  176282. tile.y,
  176283. tile.level
  176284. );
  176285. }
  176286. if (surfaceTile.terrainState === TerrainState_default.UNLOADED) {
  176287. requestTileGeometry2(
  176288. surfaceTile,
  176289. terrainProvider,
  176290. tile.x,
  176291. tile.y,
  176292. tile.level
  176293. );
  176294. }
  176295. if (surfaceTile.terrainState === TerrainState_default.RECEIVED) {
  176296. transform3(
  176297. surfaceTile,
  176298. frameState,
  176299. terrainProvider,
  176300. tile.x,
  176301. tile.y,
  176302. tile.level
  176303. );
  176304. }
  176305. if (surfaceTile.terrainState === TerrainState_default.TRANSFORMED) {
  176306. createResources5(
  176307. surfaceTile,
  176308. frameState.context,
  176309. terrainProvider,
  176310. tile.x,
  176311. tile.y,
  176312. tile.level,
  176313. vertexArraysToDestroy
  176314. );
  176315. surfaceTile.updateExaggeration(tile, frameState, quadtree);
  176316. }
  176317. if (surfaceTile.terrainState >= TerrainState_default.RECEIVED && surfaceTile.waterMaskTexture === void 0 && terrainProvider.hasWaterMask) {
  176318. const terrainData = surfaceTile.terrainData;
  176319. if (terrainData.waterMask !== void 0) {
  176320. createWaterMaskTextureIfNeeded(frameState.context, surfaceTile);
  176321. } else {
  176322. const sourceTile = surfaceTile._findAncestorTileWithTerrainData(tile);
  176323. if (defined_default(sourceTile) && defined_default(sourceTile.data.waterMaskTexture)) {
  176324. surfaceTile.waterMaskTexture = sourceTile.data.waterMaskTexture;
  176325. ++surfaceTile.waterMaskTexture.referenceCount;
  176326. surfaceTile._computeWaterMaskTranslationAndScale(
  176327. tile,
  176328. sourceTile,
  176329. surfaceTile.waterMaskTranslationAndScale
  176330. );
  176331. }
  176332. }
  176333. }
  176334. }
  176335. function upsample(surfaceTile, tile, frameState, terrainProvider, x, y, level) {
  176336. const parent = tile.parent;
  176337. if (!parent) {
  176338. tile.state = QuadtreeTileLoadState_default.FAILED;
  176339. return;
  176340. }
  176341. const sourceData = parent.data.terrainData;
  176342. const sourceX = parent.x;
  176343. const sourceY = parent.y;
  176344. const sourceLevel = parent.level;
  176345. if (!defined_default(sourceData)) {
  176346. return;
  176347. }
  176348. const terrainDataPromise = sourceData.upsample(
  176349. terrainProvider.tilingScheme,
  176350. sourceX,
  176351. sourceY,
  176352. sourceLevel,
  176353. x,
  176354. y,
  176355. level
  176356. );
  176357. if (!defined_default(terrainDataPromise)) {
  176358. return;
  176359. }
  176360. surfaceTile.terrainState = TerrainState_default.RECEIVING;
  176361. Promise.resolve(terrainDataPromise).then(function(terrainData) {
  176362. surfaceTile.terrainData = terrainData;
  176363. surfaceTile.terrainState = TerrainState_default.RECEIVED;
  176364. }).catch(function() {
  176365. surfaceTile.terrainState = TerrainState_default.FAILED;
  176366. });
  176367. }
  176368. function requestTileGeometry2(surfaceTile, terrainProvider, x, y, level) {
  176369. function success(terrainData) {
  176370. surfaceTile.terrainData = terrainData;
  176371. surfaceTile.terrainState = TerrainState_default.RECEIVED;
  176372. surfaceTile.request = void 0;
  176373. }
  176374. function failure(error) {
  176375. if (surfaceTile.request.state === RequestState_default.CANCELLED) {
  176376. surfaceTile.terrainData = void 0;
  176377. surfaceTile.terrainState = TerrainState_default.UNLOADED;
  176378. surfaceTile.request = void 0;
  176379. return;
  176380. }
  176381. surfaceTile.terrainState = TerrainState_default.FAILED;
  176382. surfaceTile.request = void 0;
  176383. const message = `Failed to obtain terrain tile X: ${x} Y: ${y} Level: ${level}. Error message: "${error}"`;
  176384. terrainProvider._requestError = TileProviderError_default.handleError(
  176385. terrainProvider._requestError,
  176386. terrainProvider,
  176387. terrainProvider.errorEvent,
  176388. message,
  176389. x,
  176390. y,
  176391. level,
  176392. doRequest
  176393. );
  176394. }
  176395. function doRequest() {
  176396. const request = new Request_default({
  176397. throttle: false,
  176398. throttleByServer: true,
  176399. type: RequestType_default.TERRAIN
  176400. });
  176401. surfaceTile.request = request;
  176402. const requestPromise = terrainProvider.requestTileGeometry(
  176403. x,
  176404. y,
  176405. level,
  176406. request
  176407. );
  176408. if (defined_default(requestPromise)) {
  176409. surfaceTile.terrainState = TerrainState_default.RECEIVING;
  176410. Promise.resolve(requestPromise).then(function(terrainData) {
  176411. success(terrainData);
  176412. }).catch(function(e2) {
  176413. failure(e2);
  176414. });
  176415. } else {
  176416. surfaceTile.terrainState = TerrainState_default.UNLOADED;
  176417. surfaceTile.request = void 0;
  176418. }
  176419. }
  176420. doRequest();
  176421. }
  176422. var scratchCreateMeshOptions = {
  176423. tilingScheme: void 0,
  176424. x: 0,
  176425. y: 0,
  176426. level: 0,
  176427. exaggeration: 1,
  176428. exaggerationRelativeHeight: 0,
  176429. throttle: true
  176430. };
  176431. function transform3(surfaceTile, frameState, terrainProvider, x, y, level) {
  176432. const tilingScheme2 = terrainProvider.tilingScheme;
  176433. const createMeshOptions = scratchCreateMeshOptions;
  176434. createMeshOptions.tilingScheme = tilingScheme2;
  176435. createMeshOptions.x = x;
  176436. createMeshOptions.y = y;
  176437. createMeshOptions.level = level;
  176438. createMeshOptions.exaggeration = frameState.terrainExaggeration;
  176439. createMeshOptions.exaggerationRelativeHeight = frameState.terrainExaggerationRelativeHeight;
  176440. createMeshOptions.throttle = true;
  176441. const terrainData = surfaceTile.terrainData;
  176442. const meshPromise = terrainData.createMesh(createMeshOptions);
  176443. if (!defined_default(meshPromise)) {
  176444. return;
  176445. }
  176446. surfaceTile.terrainState = TerrainState_default.TRANSFORMING;
  176447. Promise.resolve(meshPromise).then(function(mesh2) {
  176448. surfaceTile.mesh = mesh2;
  176449. surfaceTile.terrainState = TerrainState_default.TRANSFORMED;
  176450. }).catch(function() {
  176451. surfaceTile.terrainState = TerrainState_default.FAILED;
  176452. });
  176453. }
  176454. GlobeSurfaceTile._createVertexArrayForMesh = function(context, mesh2) {
  176455. const typedArray = mesh2.vertices;
  176456. const buffer = Buffer_default.createVertexBuffer({
  176457. context,
  176458. typedArray,
  176459. usage: BufferUsage_default.STATIC_DRAW
  176460. });
  176461. const attributes = mesh2.encoding.getAttributes(buffer);
  176462. const indexBuffers = mesh2.indices.indexBuffers || {};
  176463. let indexBuffer = indexBuffers[context.id];
  176464. if (!defined_default(indexBuffer) || indexBuffer.isDestroyed()) {
  176465. const indices2 = mesh2.indices;
  176466. indexBuffer = Buffer_default.createIndexBuffer({
  176467. context,
  176468. typedArray: indices2,
  176469. usage: BufferUsage_default.STATIC_DRAW,
  176470. indexDatatype: IndexDatatype_default.fromSizeInBytes(indices2.BYTES_PER_ELEMENT)
  176471. });
  176472. indexBuffer.vertexArrayDestroyable = false;
  176473. indexBuffer.referenceCount = 1;
  176474. indexBuffers[context.id] = indexBuffer;
  176475. mesh2.indices.indexBuffers = indexBuffers;
  176476. } else {
  176477. ++indexBuffer.referenceCount;
  176478. }
  176479. return new VertexArray_default({
  176480. context,
  176481. attributes,
  176482. indexBuffer
  176483. });
  176484. };
  176485. GlobeSurfaceTile._freeVertexArray = function(vertexArray) {
  176486. if (defined_default(vertexArray)) {
  176487. const indexBuffer = vertexArray.indexBuffer;
  176488. if (!vertexArray.isDestroyed()) {
  176489. vertexArray.destroy();
  176490. }
  176491. if (defined_default(indexBuffer) && !indexBuffer.isDestroyed() && defined_default(indexBuffer.referenceCount)) {
  176492. --indexBuffer.referenceCount;
  176493. if (indexBuffer.referenceCount === 0) {
  176494. indexBuffer.destroy();
  176495. }
  176496. }
  176497. }
  176498. };
  176499. function createResources5(surfaceTile, context, terrainProvider, x, y, level, vertexArraysToDestroy) {
  176500. surfaceTile.vertexArray = GlobeSurfaceTile._createVertexArrayForMesh(
  176501. context,
  176502. surfaceTile.mesh
  176503. );
  176504. surfaceTile.terrainState = TerrainState_default.READY;
  176505. surfaceTile.fill = surfaceTile.fill && surfaceTile.fill.destroy(vertexArraysToDestroy);
  176506. }
  176507. function getContextWaterMaskData(context) {
  176508. let data = context.cache.tile_waterMaskData;
  176509. if (!defined_default(data)) {
  176510. const allWaterTexture = Texture_default.create({
  176511. context,
  176512. pixelFormat: PixelFormat_default.LUMINANCE,
  176513. pixelDatatype: PixelDatatype_default.UNSIGNED_BYTE,
  176514. source: {
  176515. arrayBufferView: new Uint8Array([255]),
  176516. width: 1,
  176517. height: 1
  176518. }
  176519. });
  176520. allWaterTexture.referenceCount = 1;
  176521. const sampler = new Sampler_default({
  176522. wrapS: TextureWrap_default.CLAMP_TO_EDGE,
  176523. wrapT: TextureWrap_default.CLAMP_TO_EDGE,
  176524. minificationFilter: TextureMinificationFilter_default.LINEAR,
  176525. magnificationFilter: TextureMagnificationFilter_default.LINEAR
  176526. });
  176527. data = {
  176528. allWaterTexture,
  176529. sampler,
  176530. destroy: function() {
  176531. this.allWaterTexture.destroy();
  176532. }
  176533. };
  176534. context.cache.tile_waterMaskData = data;
  176535. }
  176536. return data;
  176537. }
  176538. function createWaterMaskTextureIfNeeded(context, surfaceTile) {
  176539. const waterMask = surfaceTile.terrainData.waterMask;
  176540. const waterMaskData = getContextWaterMaskData(context);
  176541. let texture;
  176542. const waterMaskLength = waterMask.length;
  176543. if (waterMaskLength === 1) {
  176544. if (waterMask[0] !== 0) {
  176545. texture = waterMaskData.allWaterTexture;
  176546. } else {
  176547. return;
  176548. }
  176549. } else {
  176550. const textureSize = Math.sqrt(waterMaskLength);
  176551. texture = Texture_default.create({
  176552. context,
  176553. pixelFormat: PixelFormat_default.LUMINANCE,
  176554. pixelDatatype: PixelDatatype_default.UNSIGNED_BYTE,
  176555. source: {
  176556. width: textureSize,
  176557. height: textureSize,
  176558. arrayBufferView: waterMask
  176559. },
  176560. sampler: waterMaskData.sampler,
  176561. flipY: false
  176562. });
  176563. texture.referenceCount = 0;
  176564. }
  176565. ++texture.referenceCount;
  176566. surfaceTile.waterMaskTexture = texture;
  176567. Cartesian4_default.fromElements(
  176568. 0,
  176569. 0,
  176570. 1,
  176571. 1,
  176572. surfaceTile.waterMaskTranslationAndScale
  176573. );
  176574. }
  176575. GlobeSurfaceTile.prototype._findAncestorTileWithTerrainData = function(tile) {
  176576. let sourceTile = tile.parent;
  176577. while (defined_default(sourceTile) && (!defined_default(sourceTile.data) || !defined_default(sourceTile.data.terrainData) || sourceTile.data.terrainData.wasCreatedByUpsampling())) {
  176578. sourceTile = sourceTile.parent;
  176579. }
  176580. return sourceTile;
  176581. };
  176582. GlobeSurfaceTile.prototype._computeWaterMaskTranslationAndScale = function(tile, sourceTile, result) {
  176583. const sourceTileRectangle = sourceTile.rectangle;
  176584. const tileRectangle = tile.rectangle;
  176585. const tileWidth = tileRectangle.width;
  176586. const tileHeight = tileRectangle.height;
  176587. const scaleX = tileWidth / sourceTileRectangle.width;
  176588. const scaleY = tileHeight / sourceTileRectangle.height;
  176589. result.x = scaleX * (tileRectangle.west - sourceTileRectangle.west) / tileWidth;
  176590. result.y = scaleY * (tileRectangle.south - sourceTileRectangle.south) / tileHeight;
  176591. result.z = scaleX;
  176592. result.w = scaleY;
  176593. return result;
  176594. };
  176595. var GlobeSurfaceTile_default = GlobeSurfaceTile;
  176596. // node_modules/cesium/Source/Shaders/ReprojectWebMercatorFS.js
  176597. var ReprojectWebMercatorFS_default = "uniform sampler2D u_texture;\n\nvarying vec2 v_textureCoordinates;\n\nvoid main()\n{\n gl_FragColor = texture2D(u_texture, v_textureCoordinates);\n}\n";
  176598. // node_modules/cesium/Source/Shaders/ReprojectWebMercatorVS.js
  176599. var ReprojectWebMercatorVS_default = "attribute vec4 position;\nattribute float webMercatorT;\n\nuniform vec2 u_textureDimensions;\n\nvarying vec2 v_textureCoordinates;\n\nvoid main()\n{\n v_textureCoordinates = vec2(position.x, webMercatorT);\n gl_Position = czm_viewportOrthographic * (position * vec4(u_textureDimensions, 1.0, 1.0));\n}\n";
  176600. // node_modules/cesium/Source/Scene/Imagery.js
  176601. function Imagery(imageryLayer, x, y, level, rectangle) {
  176602. this.imageryLayer = imageryLayer;
  176603. this.x = x;
  176604. this.y = y;
  176605. this.level = level;
  176606. this.request = void 0;
  176607. if (level !== 0) {
  176608. const parentX = x / 2 | 0;
  176609. const parentY = y / 2 | 0;
  176610. const parentLevel = level - 1;
  176611. this.parent = imageryLayer.getImageryFromCache(
  176612. parentX,
  176613. parentY,
  176614. parentLevel
  176615. );
  176616. }
  176617. this.state = ImageryState_default.UNLOADED;
  176618. this.imageUrl = void 0;
  176619. this.image = void 0;
  176620. this.texture = void 0;
  176621. this.textureWebMercator = void 0;
  176622. this.credits = void 0;
  176623. this.referenceCount = 0;
  176624. if (!defined_default(rectangle) && imageryLayer.imageryProvider.ready) {
  176625. const tilingScheme2 = imageryLayer.imageryProvider.tilingScheme;
  176626. rectangle = tilingScheme2.tileXYToRectangle(x, y, level);
  176627. }
  176628. this.rectangle = rectangle;
  176629. }
  176630. Imagery.createPlaceholder = function(imageryLayer) {
  176631. const result = new Imagery(imageryLayer, 0, 0, 0);
  176632. result.addReference();
  176633. result.state = ImageryState_default.PLACEHOLDER;
  176634. return result;
  176635. };
  176636. Imagery.prototype.addReference = function() {
  176637. ++this.referenceCount;
  176638. };
  176639. Imagery.prototype.releaseReference = function() {
  176640. --this.referenceCount;
  176641. if (this.referenceCount === 0) {
  176642. this.imageryLayer.removeImageryFromCache(this);
  176643. if (defined_default(this.parent)) {
  176644. this.parent.releaseReference();
  176645. }
  176646. if (defined_default(this.image) && defined_default(this.image.destroy)) {
  176647. this.image.destroy();
  176648. }
  176649. if (defined_default(this.texture)) {
  176650. this.texture.destroy();
  176651. }
  176652. if (defined_default(this.textureWebMercator) && this.texture !== this.textureWebMercator) {
  176653. this.textureWebMercator.destroy();
  176654. }
  176655. destroyObject_default(this);
  176656. return 0;
  176657. }
  176658. return this.referenceCount;
  176659. };
  176660. Imagery.prototype.processStateMachine = function(frameState, needGeographicProjection, skipLoading) {
  176661. if (this.state === ImageryState_default.UNLOADED && !skipLoading) {
  176662. this.state = ImageryState_default.TRANSITIONING;
  176663. this.imageryLayer._requestImagery(this);
  176664. }
  176665. if (this.state === ImageryState_default.RECEIVED) {
  176666. this.state = ImageryState_default.TRANSITIONING;
  176667. this.imageryLayer._createTexture(frameState.context, this);
  176668. }
  176669. const needsReprojection = this.state === ImageryState_default.READY && needGeographicProjection && !this.texture;
  176670. if (this.state === ImageryState_default.TEXTURE_LOADED || needsReprojection) {
  176671. this.state = ImageryState_default.TRANSITIONING;
  176672. this.imageryLayer._reprojectTexture(
  176673. frameState,
  176674. this,
  176675. needGeographicProjection
  176676. );
  176677. }
  176678. };
  176679. var Imagery_default = Imagery;
  176680. // node_modules/cesium/Source/Scene/TileImagery.js
  176681. function TileImagery(imagery, textureCoordinateRectangle, useWebMercatorT) {
  176682. this.readyImagery = void 0;
  176683. this.loadingImagery = imagery;
  176684. this.textureCoordinateRectangle = textureCoordinateRectangle;
  176685. this.textureTranslationAndScale = void 0;
  176686. this.useWebMercatorT = useWebMercatorT;
  176687. }
  176688. TileImagery.prototype.freeResources = function() {
  176689. if (defined_default(this.readyImagery)) {
  176690. this.readyImagery.releaseReference();
  176691. }
  176692. if (defined_default(this.loadingImagery)) {
  176693. this.loadingImagery.releaseReference();
  176694. }
  176695. };
  176696. TileImagery.prototype.processStateMachine = function(tile, frameState, skipLoading) {
  176697. const loadingImagery = this.loadingImagery;
  176698. const imageryLayer = loadingImagery.imageryLayer;
  176699. loadingImagery.processStateMachine(
  176700. frameState,
  176701. !this.useWebMercatorT,
  176702. skipLoading
  176703. );
  176704. if (loadingImagery.state === ImageryState_default.READY) {
  176705. if (defined_default(this.readyImagery)) {
  176706. this.readyImagery.releaseReference();
  176707. }
  176708. this.readyImagery = this.loadingImagery;
  176709. this.loadingImagery = void 0;
  176710. this.textureTranslationAndScale = imageryLayer._calculateTextureTranslationAndScale(
  176711. tile,
  176712. this
  176713. );
  176714. return true;
  176715. }
  176716. let ancestor = loadingImagery.parent;
  176717. let closestAncestorThatNeedsLoading;
  176718. while (defined_default(ancestor) && (ancestor.state !== ImageryState_default.READY || !this.useWebMercatorT && !defined_default(ancestor.texture))) {
  176719. if (ancestor.state !== ImageryState_default.FAILED && ancestor.state !== ImageryState_default.INVALID) {
  176720. closestAncestorThatNeedsLoading = closestAncestorThatNeedsLoading || ancestor;
  176721. }
  176722. ancestor = ancestor.parent;
  176723. }
  176724. if (this.readyImagery !== ancestor) {
  176725. if (defined_default(this.readyImagery)) {
  176726. this.readyImagery.releaseReference();
  176727. }
  176728. this.readyImagery = ancestor;
  176729. if (defined_default(ancestor)) {
  176730. ancestor.addReference();
  176731. this.textureTranslationAndScale = imageryLayer._calculateTextureTranslationAndScale(
  176732. tile,
  176733. this
  176734. );
  176735. }
  176736. }
  176737. if (loadingImagery.state === ImageryState_default.FAILED || loadingImagery.state === ImageryState_default.INVALID) {
  176738. if (defined_default(closestAncestorThatNeedsLoading)) {
  176739. closestAncestorThatNeedsLoading.processStateMachine(
  176740. frameState,
  176741. !this.useWebMercatorT,
  176742. skipLoading
  176743. );
  176744. return false;
  176745. }
  176746. return true;
  176747. }
  176748. return false;
  176749. };
  176750. var TileImagery_default = TileImagery;
  176751. // node_modules/cesium/Source/Scene/ImageryLayer.js
  176752. function ImageryLayer(imageryProvider, options) {
  176753. this._imageryProvider = imageryProvider;
  176754. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  176755. this.alpha = defaultValue_default(
  176756. options.alpha,
  176757. defaultValue_default(imageryProvider.defaultAlpha, 1)
  176758. );
  176759. this.nightAlpha = defaultValue_default(
  176760. options.nightAlpha,
  176761. defaultValue_default(imageryProvider.defaultNightAlpha, 1)
  176762. );
  176763. this.dayAlpha = defaultValue_default(
  176764. options.dayAlpha,
  176765. defaultValue_default(imageryProvider.defaultDayAlpha, 1)
  176766. );
  176767. this.brightness = defaultValue_default(
  176768. options.brightness,
  176769. defaultValue_default(
  176770. imageryProvider.defaultBrightness,
  176771. ImageryLayer.DEFAULT_BRIGHTNESS
  176772. )
  176773. );
  176774. this.contrast = defaultValue_default(
  176775. options.contrast,
  176776. defaultValue_default(imageryProvider.defaultContrast, ImageryLayer.DEFAULT_CONTRAST)
  176777. );
  176778. this.hue = defaultValue_default(
  176779. options.hue,
  176780. defaultValue_default(imageryProvider.defaultHue, ImageryLayer.DEFAULT_HUE)
  176781. );
  176782. this.saturation = defaultValue_default(
  176783. options.saturation,
  176784. defaultValue_default(
  176785. imageryProvider.defaultSaturation,
  176786. ImageryLayer.DEFAULT_SATURATION
  176787. )
  176788. );
  176789. this.gamma = defaultValue_default(
  176790. options.gamma,
  176791. defaultValue_default(imageryProvider.defaultGamma, ImageryLayer.DEFAULT_GAMMA)
  176792. );
  176793. this.splitDirection = defaultValue_default(
  176794. options.splitDirection,
  176795. defaultValue_default(imageryProvider.defaultSplit, ImageryLayer.DEFAULT_SPLIT)
  176796. );
  176797. this.minificationFilter = defaultValue_default(
  176798. options.minificationFilter,
  176799. defaultValue_default(
  176800. imageryProvider.defaultMinificationFilter,
  176801. ImageryLayer.DEFAULT_MINIFICATION_FILTER
  176802. )
  176803. );
  176804. this.magnificationFilter = defaultValue_default(
  176805. options.magnificationFilter,
  176806. defaultValue_default(
  176807. imageryProvider.defaultMagnificationFilter,
  176808. ImageryLayer.DEFAULT_MAGNIFICATION_FILTER
  176809. )
  176810. );
  176811. this.show = defaultValue_default(options.show, true);
  176812. this._minimumTerrainLevel = options.minimumTerrainLevel;
  176813. this._maximumTerrainLevel = options.maximumTerrainLevel;
  176814. this._rectangle = defaultValue_default(options.rectangle, Rectangle_default.MAX_VALUE);
  176815. this._maximumAnisotropy = options.maximumAnisotropy;
  176816. this._imageryCache = {};
  176817. this._skeletonPlaceholder = new TileImagery_default(Imagery_default.createPlaceholder(this));
  176818. this._show = true;
  176819. this._layerIndex = -1;
  176820. this._isBaseLayer = false;
  176821. this._requestImageError = void 0;
  176822. this._reprojectComputeCommands = [];
  176823. this.cutoutRectangle = options.cutoutRectangle;
  176824. this.colorToAlpha = options.colorToAlpha;
  176825. this.colorToAlphaThreshold = defaultValue_default(
  176826. options.colorToAlphaThreshold,
  176827. ImageryLayer.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD
  176828. );
  176829. }
  176830. Object.defineProperties(ImageryLayer.prototype, {
  176831. imageryProvider: {
  176832. get: function() {
  176833. return this._imageryProvider;
  176834. }
  176835. },
  176836. rectangle: {
  176837. get: function() {
  176838. return this._rectangle;
  176839. }
  176840. }
  176841. });
  176842. ImageryLayer.DEFAULT_BRIGHTNESS = 1;
  176843. ImageryLayer.DEFAULT_CONTRAST = 1;
  176844. ImageryLayer.DEFAULT_HUE = 0;
  176845. ImageryLayer.DEFAULT_SATURATION = 1;
  176846. ImageryLayer.DEFAULT_GAMMA = 1;
  176847. ImageryLayer.DEFAULT_SPLIT = SplitDirection_default.NONE;
  176848. ImageryLayer.DEFAULT_MINIFICATION_FILTER = TextureMinificationFilter_default.LINEAR;
  176849. ImageryLayer.DEFAULT_MAGNIFICATION_FILTER = TextureMagnificationFilter_default.LINEAR;
  176850. ImageryLayer.DEFAULT_APPLY_COLOR_TO_ALPHA_THRESHOLD = 4e-3;
  176851. ImageryLayer.prototype.isBaseLayer = function() {
  176852. return this._isBaseLayer;
  176853. };
  176854. ImageryLayer.prototype.isDestroyed = function() {
  176855. return false;
  176856. };
  176857. ImageryLayer.prototype.destroy = function() {
  176858. return destroyObject_default(this);
  176859. };
  176860. var imageryBoundsScratch = new Rectangle_default();
  176861. var tileImageryBoundsScratch = new Rectangle_default();
  176862. var clippedRectangleScratch = new Rectangle_default();
  176863. var terrainRectangleScratch = new Rectangle_default();
  176864. ImageryLayer.prototype.getViewableRectangle = function() {
  176865. const imageryProvider = this._imageryProvider;
  176866. const rectangle = this._rectangle;
  176867. return imageryProvider.readyPromise.then(function() {
  176868. return Rectangle_default.intersection(imageryProvider.rectangle, rectangle);
  176869. });
  176870. };
  176871. ImageryLayer.prototype._createTileImagerySkeletons = function(tile, terrainProvider, insertionPoint) {
  176872. const surfaceTile = tile.data;
  176873. if (defined_default(this._minimumTerrainLevel) && tile.level < this._minimumTerrainLevel) {
  176874. return false;
  176875. }
  176876. if (defined_default(this._maximumTerrainLevel) && tile.level > this._maximumTerrainLevel) {
  176877. return false;
  176878. }
  176879. const imageryProvider = this._imageryProvider;
  176880. if (!defined_default(insertionPoint)) {
  176881. insertionPoint = surfaceTile.imagery.length;
  176882. }
  176883. if (!imageryProvider.ready) {
  176884. this._skeletonPlaceholder.loadingImagery.addReference();
  176885. surfaceTile.imagery.splice(insertionPoint, 0, this._skeletonPlaceholder);
  176886. return true;
  176887. }
  176888. const useWebMercatorT = imageryProvider.tilingScheme.projection instanceof WebMercatorProjection_default && tile.rectangle.north < WebMercatorProjection_default.MaximumLatitude && tile.rectangle.south > -WebMercatorProjection_default.MaximumLatitude;
  176889. const imageryBounds = Rectangle_default.intersection(
  176890. imageryProvider.rectangle,
  176891. this._rectangle,
  176892. imageryBoundsScratch
  176893. );
  176894. let rectangle = Rectangle_default.intersection(
  176895. tile.rectangle,
  176896. imageryBounds,
  176897. tileImageryBoundsScratch
  176898. );
  176899. if (!defined_default(rectangle)) {
  176900. if (!this.isBaseLayer()) {
  176901. return false;
  176902. }
  176903. const baseImageryRectangle = imageryBounds;
  176904. const baseTerrainRectangle = tile.rectangle;
  176905. rectangle = tileImageryBoundsScratch;
  176906. if (baseTerrainRectangle.south >= baseImageryRectangle.north) {
  176907. rectangle.north = rectangle.south = baseImageryRectangle.north;
  176908. } else if (baseTerrainRectangle.north <= baseImageryRectangle.south) {
  176909. rectangle.north = rectangle.south = baseImageryRectangle.south;
  176910. } else {
  176911. rectangle.south = Math.max(
  176912. baseTerrainRectangle.south,
  176913. baseImageryRectangle.south
  176914. );
  176915. rectangle.north = Math.min(
  176916. baseTerrainRectangle.north,
  176917. baseImageryRectangle.north
  176918. );
  176919. }
  176920. if (baseTerrainRectangle.west >= baseImageryRectangle.east) {
  176921. rectangle.west = rectangle.east = baseImageryRectangle.east;
  176922. } else if (baseTerrainRectangle.east <= baseImageryRectangle.west) {
  176923. rectangle.west = rectangle.east = baseImageryRectangle.west;
  176924. } else {
  176925. rectangle.west = Math.max(
  176926. baseTerrainRectangle.west,
  176927. baseImageryRectangle.west
  176928. );
  176929. rectangle.east = Math.min(
  176930. baseTerrainRectangle.east,
  176931. baseImageryRectangle.east
  176932. );
  176933. }
  176934. }
  176935. let latitudeClosestToEquator = 0;
  176936. if (rectangle.south > 0) {
  176937. latitudeClosestToEquator = rectangle.south;
  176938. } else if (rectangle.north < 0) {
  176939. latitudeClosestToEquator = rectangle.north;
  176940. }
  176941. const errorRatio = 1;
  176942. const targetGeometricError = errorRatio * terrainProvider.getLevelMaximumGeometricError(tile.level);
  176943. let imageryLevel = getLevelWithMaximumTexelSpacing(
  176944. this,
  176945. targetGeometricError,
  176946. latitudeClosestToEquator
  176947. );
  176948. imageryLevel = Math.max(0, imageryLevel);
  176949. const maximumLevel = imageryProvider.maximumLevel;
  176950. if (imageryLevel > maximumLevel) {
  176951. imageryLevel = maximumLevel;
  176952. }
  176953. if (defined_default(imageryProvider.minimumLevel)) {
  176954. const minimumLevel = imageryProvider.minimumLevel;
  176955. if (imageryLevel < minimumLevel) {
  176956. imageryLevel = minimumLevel;
  176957. }
  176958. }
  176959. const imageryTilingScheme = imageryProvider.tilingScheme;
  176960. const northwestTileCoordinates = imageryTilingScheme.positionToTileXY(
  176961. Rectangle_default.northwest(rectangle),
  176962. imageryLevel
  176963. );
  176964. const southeastTileCoordinates = imageryTilingScheme.positionToTileXY(
  176965. Rectangle_default.southeast(rectangle),
  176966. imageryLevel
  176967. );
  176968. let veryCloseX = tile.rectangle.width / 512;
  176969. let veryCloseY = tile.rectangle.height / 512;
  176970. const northwestTileRectangle = imageryTilingScheme.tileXYToRectangle(
  176971. northwestTileCoordinates.x,
  176972. northwestTileCoordinates.y,
  176973. imageryLevel
  176974. );
  176975. if (Math.abs(northwestTileRectangle.south - tile.rectangle.north) < veryCloseY && northwestTileCoordinates.y < southeastTileCoordinates.y) {
  176976. ++northwestTileCoordinates.y;
  176977. }
  176978. if (Math.abs(northwestTileRectangle.east - tile.rectangle.west) < veryCloseX && northwestTileCoordinates.x < southeastTileCoordinates.x) {
  176979. ++northwestTileCoordinates.x;
  176980. }
  176981. const southeastTileRectangle = imageryTilingScheme.tileXYToRectangle(
  176982. southeastTileCoordinates.x,
  176983. southeastTileCoordinates.y,
  176984. imageryLevel
  176985. );
  176986. if (Math.abs(southeastTileRectangle.north - tile.rectangle.south) < veryCloseY && southeastTileCoordinates.y > northwestTileCoordinates.y) {
  176987. --southeastTileCoordinates.y;
  176988. }
  176989. if (Math.abs(southeastTileRectangle.west - tile.rectangle.east) < veryCloseX && southeastTileCoordinates.x > northwestTileCoordinates.x) {
  176990. --southeastTileCoordinates.x;
  176991. }
  176992. const terrainRectangle = Rectangle_default.clone(
  176993. tile.rectangle,
  176994. terrainRectangleScratch
  176995. );
  176996. let imageryRectangle = imageryTilingScheme.tileXYToRectangle(
  176997. northwestTileCoordinates.x,
  176998. northwestTileCoordinates.y,
  176999. imageryLevel
  177000. );
  177001. let clippedImageryRectangle = Rectangle_default.intersection(
  177002. imageryRectangle,
  177003. imageryBounds,
  177004. clippedRectangleScratch
  177005. );
  177006. let imageryTileXYToRectangle;
  177007. if (useWebMercatorT) {
  177008. imageryTilingScheme.rectangleToNativeRectangle(
  177009. terrainRectangle,
  177010. terrainRectangle
  177011. );
  177012. imageryTilingScheme.rectangleToNativeRectangle(
  177013. imageryRectangle,
  177014. imageryRectangle
  177015. );
  177016. imageryTilingScheme.rectangleToNativeRectangle(
  177017. clippedImageryRectangle,
  177018. clippedImageryRectangle
  177019. );
  177020. imageryTilingScheme.rectangleToNativeRectangle(
  177021. imageryBounds,
  177022. imageryBounds
  177023. );
  177024. imageryTileXYToRectangle = imageryTilingScheme.tileXYToNativeRectangle.bind(
  177025. imageryTilingScheme
  177026. );
  177027. veryCloseX = terrainRectangle.width / 512;
  177028. veryCloseY = terrainRectangle.height / 512;
  177029. } else {
  177030. imageryTileXYToRectangle = imageryTilingScheme.tileXYToRectangle.bind(
  177031. imageryTilingScheme
  177032. );
  177033. }
  177034. let minU;
  177035. let maxU = 0;
  177036. let minV = 1;
  177037. let maxV;
  177038. if (!this.isBaseLayer() && Math.abs(clippedImageryRectangle.west - terrainRectangle.west) >= veryCloseX) {
  177039. maxU = Math.min(
  177040. 1,
  177041. (clippedImageryRectangle.west - terrainRectangle.west) / terrainRectangle.width
  177042. );
  177043. }
  177044. if (!this.isBaseLayer() && Math.abs(clippedImageryRectangle.north - terrainRectangle.north) >= veryCloseY) {
  177045. minV = Math.max(
  177046. 0,
  177047. (clippedImageryRectangle.north - terrainRectangle.south) / terrainRectangle.height
  177048. );
  177049. }
  177050. const initialMinV = minV;
  177051. for (let i2 = northwestTileCoordinates.x; i2 <= southeastTileCoordinates.x; i2++) {
  177052. minU = maxU;
  177053. imageryRectangle = imageryTileXYToRectangle(
  177054. i2,
  177055. northwestTileCoordinates.y,
  177056. imageryLevel
  177057. );
  177058. clippedImageryRectangle = Rectangle_default.simpleIntersection(
  177059. imageryRectangle,
  177060. imageryBounds,
  177061. clippedRectangleScratch
  177062. );
  177063. if (!defined_default(clippedImageryRectangle)) {
  177064. continue;
  177065. }
  177066. maxU = Math.min(
  177067. 1,
  177068. (clippedImageryRectangle.east - terrainRectangle.west) / terrainRectangle.width
  177069. );
  177070. if (i2 === southeastTileCoordinates.x && (this.isBaseLayer() || Math.abs(clippedImageryRectangle.east - terrainRectangle.east) < veryCloseX)) {
  177071. maxU = 1;
  177072. }
  177073. minV = initialMinV;
  177074. for (let j = northwestTileCoordinates.y; j <= southeastTileCoordinates.y; j++) {
  177075. maxV = minV;
  177076. imageryRectangle = imageryTileXYToRectangle(i2, j, imageryLevel);
  177077. clippedImageryRectangle = Rectangle_default.simpleIntersection(
  177078. imageryRectangle,
  177079. imageryBounds,
  177080. clippedRectangleScratch
  177081. );
  177082. if (!defined_default(clippedImageryRectangle)) {
  177083. continue;
  177084. }
  177085. minV = Math.max(
  177086. 0,
  177087. (clippedImageryRectangle.south - terrainRectangle.south) / terrainRectangle.height
  177088. );
  177089. if (j === southeastTileCoordinates.y && (this.isBaseLayer() || Math.abs(clippedImageryRectangle.south - terrainRectangle.south) < veryCloseY)) {
  177090. minV = 0;
  177091. }
  177092. const texCoordsRectangle = new Cartesian4_default(minU, minV, maxU, maxV);
  177093. const imagery = this.getImageryFromCache(i2, j, imageryLevel);
  177094. surfaceTile.imagery.splice(
  177095. insertionPoint,
  177096. 0,
  177097. new TileImagery_default(imagery, texCoordsRectangle, useWebMercatorT)
  177098. );
  177099. ++insertionPoint;
  177100. }
  177101. }
  177102. return true;
  177103. };
  177104. ImageryLayer.prototype._calculateTextureTranslationAndScale = function(tile, tileImagery) {
  177105. let imageryRectangle = tileImagery.readyImagery.rectangle;
  177106. let terrainRectangle = tile.rectangle;
  177107. if (tileImagery.useWebMercatorT) {
  177108. const tilingScheme2 = tileImagery.readyImagery.imageryLayer.imageryProvider.tilingScheme;
  177109. imageryRectangle = tilingScheme2.rectangleToNativeRectangle(
  177110. imageryRectangle,
  177111. imageryBoundsScratch
  177112. );
  177113. terrainRectangle = tilingScheme2.rectangleToNativeRectangle(
  177114. terrainRectangle,
  177115. terrainRectangleScratch
  177116. );
  177117. }
  177118. const terrainWidth = terrainRectangle.width;
  177119. const terrainHeight = terrainRectangle.height;
  177120. const scaleX = terrainWidth / imageryRectangle.width;
  177121. const scaleY = terrainHeight / imageryRectangle.height;
  177122. return new Cartesian4_default(
  177123. scaleX * (terrainRectangle.west - imageryRectangle.west) / terrainWidth,
  177124. scaleY * (terrainRectangle.south - imageryRectangle.south) / terrainHeight,
  177125. scaleX,
  177126. scaleY
  177127. );
  177128. };
  177129. ImageryLayer.prototype._requestImagery = function(imagery) {
  177130. const imageryProvider = this._imageryProvider;
  177131. const that = this;
  177132. function success(image) {
  177133. if (!defined_default(image)) {
  177134. return failure();
  177135. }
  177136. imagery.image = image;
  177137. imagery.state = ImageryState_default.RECEIVED;
  177138. imagery.request = void 0;
  177139. TileProviderError_default.handleSuccess(that._requestImageError);
  177140. }
  177141. function failure(e2) {
  177142. if (imagery.request.state === RequestState_default.CANCELLED) {
  177143. imagery.state = ImageryState_default.UNLOADED;
  177144. imagery.request = void 0;
  177145. return;
  177146. }
  177147. imagery.state = ImageryState_default.FAILED;
  177148. imagery.request = void 0;
  177149. const message = `Failed to obtain image tile X: ${imagery.x} Y: ${imagery.y} Level: ${imagery.level}.`;
  177150. that._requestImageError = TileProviderError_default.handleError(
  177151. that._requestImageError,
  177152. imageryProvider,
  177153. imageryProvider.errorEvent,
  177154. message,
  177155. imagery.x,
  177156. imagery.y,
  177157. imagery.level,
  177158. doRequest,
  177159. e2
  177160. );
  177161. }
  177162. function doRequest() {
  177163. const request = new Request_default({
  177164. throttle: false,
  177165. throttleByServer: true,
  177166. type: RequestType_default.IMAGERY
  177167. });
  177168. imagery.request = request;
  177169. imagery.state = ImageryState_default.TRANSITIONING;
  177170. const imagePromise = imageryProvider.requestImage(
  177171. imagery.x,
  177172. imagery.y,
  177173. imagery.level,
  177174. request
  177175. );
  177176. if (!defined_default(imagePromise)) {
  177177. imagery.state = ImageryState_default.UNLOADED;
  177178. imagery.request = void 0;
  177179. return;
  177180. }
  177181. if (defined_default(imageryProvider.getTileCredits)) {
  177182. imagery.credits = imageryProvider.getTileCredits(
  177183. imagery.x,
  177184. imagery.y,
  177185. imagery.level
  177186. );
  177187. }
  177188. imagePromise.then(function(image) {
  177189. success(image);
  177190. }).catch(function(e2) {
  177191. failure(e2);
  177192. });
  177193. }
  177194. doRequest();
  177195. };
  177196. ImageryLayer.prototype._createTextureWebGL = function(context, imagery) {
  177197. const sampler = new Sampler_default({
  177198. minificationFilter: this.minificationFilter,
  177199. magnificationFilter: this.magnificationFilter
  177200. });
  177201. const image = imagery.image;
  177202. if (defined_default(image.internalFormat)) {
  177203. return new Texture_default({
  177204. context,
  177205. pixelFormat: image.internalFormat,
  177206. width: image.width,
  177207. height: image.height,
  177208. source: {
  177209. arrayBufferView: image.bufferView
  177210. },
  177211. sampler
  177212. });
  177213. }
  177214. return new Texture_default({
  177215. context,
  177216. source: image,
  177217. pixelFormat: this._imageryProvider.hasAlphaChannel ? PixelFormat_default.RGBA : PixelFormat_default.RGB,
  177218. sampler
  177219. });
  177220. };
  177221. ImageryLayer.prototype._createTexture = function(context, imagery) {
  177222. const imageryProvider = this._imageryProvider;
  177223. const image = imagery.image;
  177224. if (defined_default(imageryProvider.tileDiscardPolicy)) {
  177225. const discardPolicy = imageryProvider.tileDiscardPolicy;
  177226. if (defined_default(discardPolicy)) {
  177227. if (!discardPolicy.isReady()) {
  177228. imagery.state = ImageryState_default.RECEIVED;
  177229. return;
  177230. }
  177231. if (discardPolicy.shouldDiscardImage(image)) {
  177232. imagery.state = ImageryState_default.INVALID;
  177233. return;
  177234. }
  177235. }
  177236. }
  177237. if (this.minificationFilter !== TextureMinificationFilter_default.NEAREST && this.minificationFilter !== TextureMinificationFilter_default.LINEAR) {
  177238. throw new DeveloperError_default(
  177239. "ImageryLayer minification filter must be NEAREST or LINEAR"
  177240. );
  177241. }
  177242. const texture = this._createTextureWebGL(context, imagery);
  177243. if (imageryProvider.tilingScheme.projection instanceof WebMercatorProjection_default) {
  177244. imagery.textureWebMercator = texture;
  177245. } else {
  177246. imagery.texture = texture;
  177247. }
  177248. imagery.image = void 0;
  177249. imagery.state = ImageryState_default.TEXTURE_LOADED;
  177250. };
  177251. function getSamplerKey(minificationFilter, magnificationFilter, maximumAnisotropy) {
  177252. return `${minificationFilter}:${magnificationFilter}:${maximumAnisotropy}`;
  177253. }
  177254. ImageryLayer.prototype._finalizeReprojectTexture = function(context, texture) {
  177255. let minificationFilter = this.minificationFilter;
  177256. const magnificationFilter = this.magnificationFilter;
  177257. const usesLinearTextureFilter = minificationFilter === TextureMinificationFilter_default.LINEAR && magnificationFilter === TextureMagnificationFilter_default.LINEAR;
  177258. if (usesLinearTextureFilter && !PixelFormat_default.isCompressedFormat(texture.pixelFormat) && Math_default.isPowerOfTwo(texture.width) && Math_default.isPowerOfTwo(texture.height)) {
  177259. minificationFilter = TextureMinificationFilter_default.LINEAR_MIPMAP_LINEAR;
  177260. const maximumSupportedAnisotropy = ContextLimits_default.maximumTextureFilterAnisotropy;
  177261. const maximumAnisotropy = Math.min(
  177262. maximumSupportedAnisotropy,
  177263. defaultValue_default(this._maximumAnisotropy, maximumSupportedAnisotropy)
  177264. );
  177265. const mipmapSamplerKey = getSamplerKey(
  177266. minificationFilter,
  177267. magnificationFilter,
  177268. maximumAnisotropy
  177269. );
  177270. let mipmapSamplers = context.cache.imageryLayerMipmapSamplers;
  177271. if (!defined_default(mipmapSamplers)) {
  177272. mipmapSamplers = {};
  177273. context.cache.imageryLayerMipmapSamplers = mipmapSamplers;
  177274. }
  177275. let mipmapSampler = mipmapSamplers[mipmapSamplerKey];
  177276. if (!defined_default(mipmapSampler)) {
  177277. mipmapSampler = mipmapSamplers[mipmapSamplerKey] = new Sampler_default({
  177278. wrapS: TextureWrap_default.CLAMP_TO_EDGE,
  177279. wrapT: TextureWrap_default.CLAMP_TO_EDGE,
  177280. minificationFilter,
  177281. magnificationFilter,
  177282. maximumAnisotropy
  177283. });
  177284. }
  177285. texture.generateMipmap(MipmapHint_default.NICEST);
  177286. texture.sampler = mipmapSampler;
  177287. } else {
  177288. const nonMipmapSamplerKey = getSamplerKey(
  177289. minificationFilter,
  177290. magnificationFilter,
  177291. 0
  177292. );
  177293. let nonMipmapSamplers = context.cache.imageryLayerNonMipmapSamplers;
  177294. if (!defined_default(nonMipmapSamplers)) {
  177295. nonMipmapSamplers = {};
  177296. context.cache.imageryLayerNonMipmapSamplers = nonMipmapSamplers;
  177297. }
  177298. let nonMipmapSampler = nonMipmapSamplers[nonMipmapSamplerKey];
  177299. if (!defined_default(nonMipmapSampler)) {
  177300. nonMipmapSampler = nonMipmapSamplers[nonMipmapSamplerKey] = new Sampler_default({
  177301. wrapS: TextureWrap_default.CLAMP_TO_EDGE,
  177302. wrapT: TextureWrap_default.CLAMP_TO_EDGE,
  177303. minificationFilter,
  177304. magnificationFilter
  177305. });
  177306. }
  177307. texture.sampler = nonMipmapSampler;
  177308. }
  177309. };
  177310. ImageryLayer.prototype._reprojectTexture = function(frameState, imagery, needGeographicProjection) {
  177311. const texture = imagery.textureWebMercator || imagery.texture;
  177312. const rectangle = imagery.rectangle;
  177313. const context = frameState.context;
  177314. needGeographicProjection = defaultValue_default(needGeographicProjection, true);
  177315. if (needGeographicProjection && !(this._imageryProvider.tilingScheme.projection instanceof GeographicProjection_default) && rectangle.width / texture.width > 1e-5) {
  177316. const that = this;
  177317. imagery.addReference();
  177318. const computeCommand = new ComputeCommand_default({
  177319. persists: true,
  177320. owner: this,
  177321. preExecute: function(command) {
  177322. reprojectToGeographic(command, context, texture, imagery.rectangle);
  177323. },
  177324. postExecute: function(outputTexture) {
  177325. imagery.texture = outputTexture;
  177326. that._finalizeReprojectTexture(context, outputTexture);
  177327. imagery.state = ImageryState_default.READY;
  177328. imagery.releaseReference();
  177329. },
  177330. canceled: function() {
  177331. imagery.state = ImageryState_default.TEXTURE_LOADED;
  177332. imagery.releaseReference();
  177333. }
  177334. });
  177335. this._reprojectComputeCommands.push(computeCommand);
  177336. } else {
  177337. if (needGeographicProjection) {
  177338. imagery.texture = texture;
  177339. }
  177340. this._finalizeReprojectTexture(context, texture);
  177341. imagery.state = ImageryState_default.READY;
  177342. }
  177343. };
  177344. ImageryLayer.prototype.queueReprojectionCommands = function(frameState) {
  177345. const computeCommands = this._reprojectComputeCommands;
  177346. const length3 = computeCommands.length;
  177347. for (let i2 = 0; i2 < length3; ++i2) {
  177348. frameState.commandList.push(computeCommands[i2]);
  177349. }
  177350. computeCommands.length = 0;
  177351. };
  177352. ImageryLayer.prototype.cancelReprojections = function() {
  177353. this._reprojectComputeCommands.forEach(function(command) {
  177354. if (defined_default(command.canceled)) {
  177355. command.canceled();
  177356. }
  177357. });
  177358. this._reprojectComputeCommands.length = 0;
  177359. };
  177360. ImageryLayer.prototype.getImageryFromCache = function(x, y, level, imageryRectangle) {
  177361. const cacheKey = getImageryCacheKey(x, y, level);
  177362. let imagery = this._imageryCache[cacheKey];
  177363. if (!defined_default(imagery)) {
  177364. imagery = new Imagery_default(this, x, y, level, imageryRectangle);
  177365. this._imageryCache[cacheKey] = imagery;
  177366. }
  177367. imagery.addReference();
  177368. return imagery;
  177369. };
  177370. ImageryLayer.prototype.removeImageryFromCache = function(imagery) {
  177371. const cacheKey = getImageryCacheKey(imagery.x, imagery.y, imagery.level);
  177372. delete this._imageryCache[cacheKey];
  177373. };
  177374. function getImageryCacheKey(x, y, level) {
  177375. return JSON.stringify([x, y, level]);
  177376. }
  177377. var uniformMap = {
  177378. u_textureDimensions: function() {
  177379. return this.textureDimensions;
  177380. },
  177381. u_texture: function() {
  177382. return this.texture;
  177383. },
  177384. textureDimensions: new Cartesian2_default(),
  177385. texture: void 0
  177386. };
  177387. var float32ArrayScratch = FeatureDetection_default.supportsTypedArrays() ? new Float32Array(2 * 64) : void 0;
  177388. function reprojectToGeographic(command, context, texture, rectangle) {
  177389. let reproject = context.cache.imageryLayer_reproject;
  177390. if (!defined_default(reproject)) {
  177391. reproject = context.cache.imageryLayer_reproject = {
  177392. vertexArray: void 0,
  177393. shaderProgram: void 0,
  177394. sampler: void 0,
  177395. destroy: function() {
  177396. if (defined_default(this.framebuffer)) {
  177397. this.framebuffer.destroy();
  177398. }
  177399. if (defined_default(this.vertexArray)) {
  177400. this.vertexArray.destroy();
  177401. }
  177402. if (defined_default(this.shaderProgram)) {
  177403. this.shaderProgram.destroy();
  177404. }
  177405. }
  177406. };
  177407. const positions = new Float32Array(2 * 64 * 2);
  177408. let index2 = 0;
  177409. for (let j = 0; j < 64; ++j) {
  177410. const y = j / 63;
  177411. positions[index2++] = 0;
  177412. positions[index2++] = y;
  177413. positions[index2++] = 1;
  177414. positions[index2++] = y;
  177415. }
  177416. const reprojectAttributeIndices = {
  177417. position: 0,
  177418. webMercatorT: 1
  177419. };
  177420. const indices2 = TerrainProvider_default.getRegularGridIndices(2, 64);
  177421. const indexBuffer = Buffer_default.createIndexBuffer({
  177422. context,
  177423. typedArray: indices2,
  177424. usage: BufferUsage_default.STATIC_DRAW,
  177425. indexDatatype: IndexDatatype_default.UNSIGNED_SHORT
  177426. });
  177427. reproject.vertexArray = new VertexArray_default({
  177428. context,
  177429. attributes: [
  177430. {
  177431. index: reprojectAttributeIndices.position,
  177432. vertexBuffer: Buffer_default.createVertexBuffer({
  177433. context,
  177434. typedArray: positions,
  177435. usage: BufferUsage_default.STATIC_DRAW
  177436. }),
  177437. componentsPerAttribute: 2
  177438. },
  177439. {
  177440. index: reprojectAttributeIndices.webMercatorT,
  177441. vertexBuffer: Buffer_default.createVertexBuffer({
  177442. context,
  177443. sizeInBytes: 64 * 2 * 4,
  177444. usage: BufferUsage_default.STREAM_DRAW
  177445. }),
  177446. componentsPerAttribute: 1
  177447. }
  177448. ],
  177449. indexBuffer
  177450. });
  177451. const vs = new ShaderSource_default({
  177452. sources: [ReprojectWebMercatorVS_default]
  177453. });
  177454. reproject.shaderProgram = ShaderProgram_default.fromCache({
  177455. context,
  177456. vertexShaderSource: vs,
  177457. fragmentShaderSource: ReprojectWebMercatorFS_default,
  177458. attributeLocations: reprojectAttributeIndices
  177459. });
  177460. reproject.sampler = new Sampler_default({
  177461. wrapS: TextureWrap_default.CLAMP_TO_EDGE,
  177462. wrapT: TextureWrap_default.CLAMP_TO_EDGE,
  177463. minificationFilter: TextureMinificationFilter_default.LINEAR,
  177464. magnificationFilter: TextureMagnificationFilter_default.LINEAR
  177465. });
  177466. }
  177467. texture.sampler = reproject.sampler;
  177468. const width = texture.width;
  177469. const height = texture.height;
  177470. uniformMap.textureDimensions.x = width;
  177471. uniformMap.textureDimensions.y = height;
  177472. uniformMap.texture = texture;
  177473. let sinLatitude = Math.sin(rectangle.south);
  177474. const southMercatorY = 0.5 * Math.log((1 + sinLatitude) / (1 - sinLatitude));
  177475. sinLatitude = Math.sin(rectangle.north);
  177476. const northMercatorY = 0.5 * Math.log((1 + sinLatitude) / (1 - sinLatitude));
  177477. const oneOverMercatorHeight = 1 / (northMercatorY - southMercatorY);
  177478. const outputTexture = new Texture_default({
  177479. context,
  177480. width,
  177481. height,
  177482. pixelFormat: texture.pixelFormat,
  177483. pixelDatatype: texture.pixelDatatype,
  177484. preMultiplyAlpha: texture.preMultiplyAlpha
  177485. });
  177486. if (Math_default.isPowerOfTwo(width) && Math_default.isPowerOfTwo(height)) {
  177487. outputTexture.generateMipmap(MipmapHint_default.NICEST);
  177488. }
  177489. const south = rectangle.south;
  177490. const north = rectangle.north;
  177491. const webMercatorT = float32ArrayScratch;
  177492. let outputIndex = 0;
  177493. for (let webMercatorTIndex = 0; webMercatorTIndex < 64; ++webMercatorTIndex) {
  177494. const fraction = webMercatorTIndex / 63;
  177495. const latitude = Math_default.lerp(south, north, fraction);
  177496. sinLatitude = Math.sin(latitude);
  177497. const mercatorY = 0.5 * Math.log((1 + sinLatitude) / (1 - sinLatitude));
  177498. const mercatorFraction = (mercatorY - southMercatorY) * oneOverMercatorHeight;
  177499. webMercatorT[outputIndex++] = mercatorFraction;
  177500. webMercatorT[outputIndex++] = mercatorFraction;
  177501. }
  177502. reproject.vertexArray.getAttribute(1).vertexBuffer.copyFromArrayView(webMercatorT);
  177503. command.shaderProgram = reproject.shaderProgram;
  177504. command.outputTexture = outputTexture;
  177505. command.uniformMap = uniformMap;
  177506. command.vertexArray = reproject.vertexArray;
  177507. }
  177508. function getLevelWithMaximumTexelSpacing(layer, texelSpacing, latitudeClosestToEquator) {
  177509. const imageryProvider = layer._imageryProvider;
  177510. const tilingScheme2 = imageryProvider.tilingScheme;
  177511. const ellipsoid = tilingScheme2.ellipsoid;
  177512. const latitudeFactor = !(layer._imageryProvider.tilingScheme.projection instanceof GeographicProjection_default) ? Math.cos(latitudeClosestToEquator) : 1;
  177513. const tilingSchemeRectangle = tilingScheme2.rectangle;
  177514. const levelZeroMaximumTexelSpacing = ellipsoid.maximumRadius * tilingSchemeRectangle.width * latitudeFactor / (imageryProvider.tileWidth * tilingScheme2.getNumberOfXTilesAtLevel(0));
  177515. const twoToTheLevelPower = levelZeroMaximumTexelSpacing / texelSpacing;
  177516. const level = Math.log(twoToTheLevelPower) / Math.log(2);
  177517. const rounded = Math.round(level);
  177518. return rounded | 0;
  177519. }
  177520. var ImageryLayer_default = ImageryLayer;
  177521. // node_modules/cesium/Source/Scene/TileSelectionResult.js
  177522. var TileSelectionResult = {
  177523. NONE: 0,
  177524. CULLED: 1,
  177525. RENDERED: 2,
  177526. REFINED: 3,
  177527. RENDERED_AND_KICKED: 2 | 4,
  177528. REFINED_AND_KICKED: 3 | 4,
  177529. CULLED_BUT_NEEDED: 1 | 8,
  177530. wasKicked: function(value) {
  177531. return value >= TileSelectionResult.RENDERED_AND_KICKED;
  177532. },
  177533. originalResult: function(value) {
  177534. return value & 3;
  177535. },
  177536. kick: function(value) {
  177537. return value | 4;
  177538. }
  177539. };
  177540. var TileSelectionResult_default = TileSelectionResult;
  177541. // node_modules/cesium/Source/Scene/TerrainFillMesh.js
  177542. function TerrainFillMesh(tile) {
  177543. this.tile = tile;
  177544. this.frameLastUpdated = void 0;
  177545. this.westMeshes = [];
  177546. this.westTiles = [];
  177547. this.southMeshes = [];
  177548. this.southTiles = [];
  177549. this.eastMeshes = [];
  177550. this.eastTiles = [];
  177551. this.northMeshes = [];
  177552. this.northTiles = [];
  177553. this.southwestMesh = void 0;
  177554. this.southwestTile = void 0;
  177555. this.southeastMesh = void 0;
  177556. this.southeastTile = void 0;
  177557. this.northwestMesh = void 0;
  177558. this.northwestTile = void 0;
  177559. this.northeastMesh = void 0;
  177560. this.northeastTile = void 0;
  177561. this.changedThisFrame = true;
  177562. this.visitedFrame = void 0;
  177563. this.enqueuedFrame = void 0;
  177564. this.mesh = void 0;
  177565. this.vertexArray = void 0;
  177566. this.waterMaskTexture = void 0;
  177567. this.waterMaskTranslationAndScale = new Cartesian4_default();
  177568. }
  177569. TerrainFillMesh.prototype.update = function(tileProvider, frameState, vertexArraysToDestroy) {
  177570. if (this.changedThisFrame) {
  177571. createFillMesh(tileProvider, frameState, this.tile, vertexArraysToDestroy);
  177572. this.changedThisFrame = false;
  177573. }
  177574. };
  177575. TerrainFillMesh.prototype.destroy = function(vertexArraysToDestroy) {
  177576. this._destroyVertexArray(vertexArraysToDestroy);
  177577. if (defined_default(this.waterMaskTexture)) {
  177578. --this.waterMaskTexture.referenceCount;
  177579. if (this.waterMaskTexture.referenceCount === 0) {
  177580. this.waterMaskTexture.destroy();
  177581. }
  177582. this.waterMaskTexture = void 0;
  177583. }
  177584. return void 0;
  177585. };
  177586. TerrainFillMesh.prototype._destroyVertexArray = function(vertexArraysToDestroy) {
  177587. if (defined_default(this.vertexArray)) {
  177588. if (defined_default(vertexArraysToDestroy)) {
  177589. vertexArraysToDestroy.push(this.vertexArray);
  177590. } else {
  177591. GlobeSurfaceTile_default._freeVertexArray(this.vertexArray);
  177592. }
  177593. this.vertexArray = void 0;
  177594. }
  177595. };
  177596. var traversalQueueScratch = new Queue_default();
  177597. TerrainFillMesh.updateFillTiles = function(tileProvider, renderedTiles, frameState, vertexArraysToDestroy) {
  177598. const quadtree = tileProvider._quadtree;
  177599. const levelZeroTiles = quadtree._levelZeroTiles;
  177600. const lastSelectionFrameNumber = quadtree._lastSelectionFrameNumber;
  177601. const traversalQueue = traversalQueueScratch;
  177602. traversalQueue.clear();
  177603. for (let i2 = 0; i2 < renderedTiles.length; ++i2) {
  177604. const renderedTile = renderedTiles[i2];
  177605. if (defined_default(renderedTile.data.vertexArray)) {
  177606. traversalQueue.enqueue(renderedTiles[i2]);
  177607. }
  177608. }
  177609. let tile = traversalQueue.dequeue();
  177610. while (tile !== void 0) {
  177611. const tileToWest = tile.findTileToWest(levelZeroTiles);
  177612. const tileToSouth = tile.findTileToSouth(levelZeroTiles);
  177613. const tileToEast = tile.findTileToEast(levelZeroTiles);
  177614. const tileToNorth = tile.findTileToNorth(levelZeroTiles);
  177615. visitRenderedTiles(
  177616. tileProvider,
  177617. frameState,
  177618. tile,
  177619. tileToWest,
  177620. lastSelectionFrameNumber,
  177621. TileEdge_default.EAST,
  177622. false,
  177623. traversalQueue,
  177624. vertexArraysToDestroy
  177625. );
  177626. visitRenderedTiles(
  177627. tileProvider,
  177628. frameState,
  177629. tile,
  177630. tileToSouth,
  177631. lastSelectionFrameNumber,
  177632. TileEdge_default.NORTH,
  177633. false,
  177634. traversalQueue,
  177635. vertexArraysToDestroy
  177636. );
  177637. visitRenderedTiles(
  177638. tileProvider,
  177639. frameState,
  177640. tile,
  177641. tileToEast,
  177642. lastSelectionFrameNumber,
  177643. TileEdge_default.WEST,
  177644. false,
  177645. traversalQueue,
  177646. vertexArraysToDestroy
  177647. );
  177648. visitRenderedTiles(
  177649. tileProvider,
  177650. frameState,
  177651. tile,
  177652. tileToNorth,
  177653. lastSelectionFrameNumber,
  177654. TileEdge_default.SOUTH,
  177655. false,
  177656. traversalQueue,
  177657. vertexArraysToDestroy
  177658. );
  177659. const tileToNorthwest = tileToWest.findTileToNorth(levelZeroTiles);
  177660. const tileToSouthwest = tileToWest.findTileToSouth(levelZeroTiles);
  177661. const tileToNortheast = tileToEast.findTileToNorth(levelZeroTiles);
  177662. const tileToSoutheast = tileToEast.findTileToSouth(levelZeroTiles);
  177663. visitRenderedTiles(
  177664. tileProvider,
  177665. frameState,
  177666. tile,
  177667. tileToNorthwest,
  177668. lastSelectionFrameNumber,
  177669. TileEdge_default.SOUTHEAST,
  177670. false,
  177671. traversalQueue,
  177672. vertexArraysToDestroy
  177673. );
  177674. visitRenderedTiles(
  177675. tileProvider,
  177676. frameState,
  177677. tile,
  177678. tileToNortheast,
  177679. lastSelectionFrameNumber,
  177680. TileEdge_default.SOUTHWEST,
  177681. false,
  177682. traversalQueue,
  177683. vertexArraysToDestroy
  177684. );
  177685. visitRenderedTiles(
  177686. tileProvider,
  177687. frameState,
  177688. tile,
  177689. tileToSouthwest,
  177690. lastSelectionFrameNumber,
  177691. TileEdge_default.NORTHEAST,
  177692. false,
  177693. traversalQueue,
  177694. vertexArraysToDestroy
  177695. );
  177696. visitRenderedTiles(
  177697. tileProvider,
  177698. frameState,
  177699. tile,
  177700. tileToSoutheast,
  177701. lastSelectionFrameNumber,
  177702. TileEdge_default.NORTHWEST,
  177703. false,
  177704. traversalQueue,
  177705. vertexArraysToDestroy
  177706. );
  177707. tile = traversalQueue.dequeue();
  177708. }
  177709. };
  177710. function visitRenderedTiles(tileProvider, frameState, sourceTile, startTile, currentFrameNumber, tileEdge, downOnly, traversalQueue, vertexArraysToDestroy) {
  177711. if (startTile === void 0) {
  177712. return;
  177713. }
  177714. let tile = startTile;
  177715. while (tile && (tile._lastSelectionResultFrame !== currentFrameNumber || TileSelectionResult_default.wasKicked(tile._lastSelectionResult) || TileSelectionResult_default.originalResult(tile._lastSelectionResult) === TileSelectionResult_default.CULLED)) {
  177716. if (downOnly) {
  177717. return;
  177718. }
  177719. const parent = tile.parent;
  177720. if (tileEdge >= TileEdge_default.NORTHWEST && parent !== void 0) {
  177721. switch (tileEdge) {
  177722. case TileEdge_default.NORTHWEST:
  177723. tile = tile === parent.northwestChild ? parent : void 0;
  177724. break;
  177725. case TileEdge_default.NORTHEAST:
  177726. tile = tile === parent.northeastChild ? parent : void 0;
  177727. break;
  177728. case TileEdge_default.SOUTHWEST:
  177729. tile = tile === parent.southwestChild ? parent : void 0;
  177730. break;
  177731. case TileEdge_default.SOUTHEAST:
  177732. tile = tile === parent.southeastChild ? parent : void 0;
  177733. break;
  177734. }
  177735. } else {
  177736. tile = parent;
  177737. }
  177738. }
  177739. if (tile === void 0) {
  177740. return;
  177741. }
  177742. if (tile._lastSelectionResult === TileSelectionResult_default.RENDERED) {
  177743. if (defined_default(tile.data.vertexArray)) {
  177744. return;
  177745. }
  177746. visitTile3(
  177747. tileProvider,
  177748. frameState,
  177749. sourceTile,
  177750. tile,
  177751. tileEdge,
  177752. currentFrameNumber,
  177753. traversalQueue,
  177754. vertexArraysToDestroy
  177755. );
  177756. return;
  177757. }
  177758. if (TileSelectionResult_default.originalResult(startTile._lastSelectionResult) === TileSelectionResult_default.CULLED) {
  177759. return;
  177760. }
  177761. switch (tileEdge) {
  177762. case TileEdge_default.WEST:
  177763. visitRenderedTiles(
  177764. tileProvider,
  177765. frameState,
  177766. sourceTile,
  177767. startTile.northwestChild,
  177768. currentFrameNumber,
  177769. tileEdge,
  177770. true,
  177771. traversalQueue,
  177772. vertexArraysToDestroy
  177773. );
  177774. visitRenderedTiles(
  177775. tileProvider,
  177776. frameState,
  177777. sourceTile,
  177778. startTile.southwestChild,
  177779. currentFrameNumber,
  177780. tileEdge,
  177781. true,
  177782. traversalQueue,
  177783. vertexArraysToDestroy
  177784. );
  177785. break;
  177786. case TileEdge_default.EAST:
  177787. visitRenderedTiles(
  177788. tileProvider,
  177789. frameState,
  177790. sourceTile,
  177791. startTile.southeastChild,
  177792. currentFrameNumber,
  177793. tileEdge,
  177794. true,
  177795. traversalQueue,
  177796. vertexArraysToDestroy
  177797. );
  177798. visitRenderedTiles(
  177799. tileProvider,
  177800. frameState,
  177801. sourceTile,
  177802. startTile.northeastChild,
  177803. currentFrameNumber,
  177804. tileEdge,
  177805. true,
  177806. traversalQueue,
  177807. vertexArraysToDestroy
  177808. );
  177809. break;
  177810. case TileEdge_default.SOUTH:
  177811. visitRenderedTiles(
  177812. tileProvider,
  177813. frameState,
  177814. sourceTile,
  177815. startTile.southwestChild,
  177816. currentFrameNumber,
  177817. tileEdge,
  177818. true,
  177819. traversalQueue,
  177820. vertexArraysToDestroy
  177821. );
  177822. visitRenderedTiles(
  177823. tileProvider,
  177824. frameState,
  177825. sourceTile,
  177826. startTile.southeastChild,
  177827. currentFrameNumber,
  177828. tileEdge,
  177829. true,
  177830. traversalQueue,
  177831. vertexArraysToDestroy
  177832. );
  177833. break;
  177834. case TileEdge_default.NORTH:
  177835. visitRenderedTiles(
  177836. tileProvider,
  177837. frameState,
  177838. sourceTile,
  177839. startTile.northeastChild,
  177840. currentFrameNumber,
  177841. tileEdge,
  177842. true,
  177843. traversalQueue,
  177844. vertexArraysToDestroy
  177845. );
  177846. visitRenderedTiles(
  177847. tileProvider,
  177848. frameState,
  177849. sourceTile,
  177850. startTile.northwestChild,
  177851. currentFrameNumber,
  177852. tileEdge,
  177853. true,
  177854. traversalQueue,
  177855. vertexArraysToDestroy
  177856. );
  177857. break;
  177858. case TileEdge_default.NORTHWEST:
  177859. visitRenderedTiles(
  177860. tileProvider,
  177861. frameState,
  177862. sourceTile,
  177863. startTile.northwestChild,
  177864. currentFrameNumber,
  177865. tileEdge,
  177866. true,
  177867. traversalQueue,
  177868. vertexArraysToDestroy
  177869. );
  177870. break;
  177871. case TileEdge_default.NORTHEAST:
  177872. visitRenderedTiles(
  177873. tileProvider,
  177874. frameState,
  177875. sourceTile,
  177876. startTile.northeastChild,
  177877. currentFrameNumber,
  177878. tileEdge,
  177879. true,
  177880. traversalQueue,
  177881. vertexArraysToDestroy
  177882. );
  177883. break;
  177884. case TileEdge_default.SOUTHWEST:
  177885. visitRenderedTiles(
  177886. tileProvider,
  177887. frameState,
  177888. sourceTile,
  177889. startTile.southwestChild,
  177890. currentFrameNumber,
  177891. tileEdge,
  177892. true,
  177893. traversalQueue,
  177894. vertexArraysToDestroy
  177895. );
  177896. break;
  177897. case TileEdge_default.SOUTHEAST:
  177898. visitRenderedTiles(
  177899. tileProvider,
  177900. frameState,
  177901. sourceTile,
  177902. startTile.southeastChild,
  177903. currentFrameNumber,
  177904. tileEdge,
  177905. true,
  177906. traversalQueue,
  177907. vertexArraysToDestroy
  177908. );
  177909. break;
  177910. default:
  177911. throw new DeveloperError_default("Invalid edge");
  177912. }
  177913. }
  177914. function visitTile3(tileProvider, frameState, sourceTile, destinationTile, tileEdge, frameNumber, traversalQueue, vertexArraysToDestroy) {
  177915. const destinationSurfaceTile = destinationTile.data;
  177916. if (destinationSurfaceTile.fill === void 0) {
  177917. destinationSurfaceTile.fill = new TerrainFillMesh(destinationTile);
  177918. } else if (destinationSurfaceTile.fill.visitedFrame === frameNumber) {
  177919. return;
  177920. }
  177921. if (destinationSurfaceTile.fill.enqueuedFrame !== frameNumber) {
  177922. destinationSurfaceTile.fill.enqueuedFrame = frameNumber;
  177923. destinationSurfaceTile.fill.changedThisFrame = false;
  177924. traversalQueue.enqueue(destinationTile);
  177925. }
  177926. propagateEdge(
  177927. tileProvider,
  177928. frameState,
  177929. sourceTile,
  177930. destinationTile,
  177931. tileEdge,
  177932. vertexArraysToDestroy
  177933. );
  177934. }
  177935. function propagateEdge(tileProvider, frameState, sourceTile, destinationTile, tileEdge, vertexArraysToDestroy) {
  177936. const destinationFill = destinationTile.data.fill;
  177937. let sourceMesh;
  177938. const sourceFill = sourceTile.data.fill;
  177939. if (defined_default(sourceFill)) {
  177940. sourceFill.visitedFrame = frameState.frameNumber;
  177941. if (sourceFill.changedThisFrame) {
  177942. createFillMesh(
  177943. tileProvider,
  177944. frameState,
  177945. sourceTile,
  177946. vertexArraysToDestroy
  177947. );
  177948. sourceFill.changedThisFrame = false;
  177949. }
  177950. sourceMesh = sourceTile.data.fill.mesh;
  177951. } else {
  177952. sourceMesh = sourceTile.data.mesh;
  177953. }
  177954. let edgeMeshes;
  177955. let edgeTiles;
  177956. switch (tileEdge) {
  177957. case TileEdge_default.WEST:
  177958. edgeMeshes = destinationFill.westMeshes;
  177959. edgeTiles = destinationFill.westTiles;
  177960. break;
  177961. case TileEdge_default.SOUTH:
  177962. edgeMeshes = destinationFill.southMeshes;
  177963. edgeTiles = destinationFill.southTiles;
  177964. break;
  177965. case TileEdge_default.EAST:
  177966. edgeMeshes = destinationFill.eastMeshes;
  177967. edgeTiles = destinationFill.eastTiles;
  177968. break;
  177969. case TileEdge_default.NORTH:
  177970. edgeMeshes = destinationFill.northMeshes;
  177971. edgeTiles = destinationFill.northTiles;
  177972. break;
  177973. case TileEdge_default.NORTHWEST:
  177974. destinationFill.changedThisFrame = destinationFill.changedThisFrame || destinationFill.northwestMesh !== sourceMesh;
  177975. destinationFill.northwestMesh = sourceMesh;
  177976. destinationFill.northwestTile = sourceTile;
  177977. return;
  177978. case TileEdge_default.NORTHEAST:
  177979. destinationFill.changedThisFrame = destinationFill.changedThisFrame || destinationFill.northeastMesh !== sourceMesh;
  177980. destinationFill.northeastMesh = sourceMesh;
  177981. destinationFill.northeastTile = sourceTile;
  177982. return;
  177983. case TileEdge_default.SOUTHWEST:
  177984. destinationFill.changedThisFrame = destinationFill.changedThisFrame || destinationFill.southwestMesh !== sourceMesh;
  177985. destinationFill.southwestMesh = sourceMesh;
  177986. destinationFill.southwestTile = sourceTile;
  177987. return;
  177988. case TileEdge_default.SOUTHEAST:
  177989. destinationFill.changedThisFrame = destinationFill.changedThisFrame || destinationFill.southeastMesh !== sourceMesh;
  177990. destinationFill.southeastMesh = sourceMesh;
  177991. destinationFill.southeastTile = sourceTile;
  177992. return;
  177993. }
  177994. if (sourceTile.level <= destinationTile.level) {
  177995. destinationFill.changedThisFrame = destinationFill.changedThisFrame || edgeMeshes[0] !== sourceMesh || edgeMeshes.length !== 1;
  177996. edgeMeshes[0] = sourceMesh;
  177997. edgeTiles[0] = sourceTile;
  177998. edgeMeshes.length = 1;
  177999. edgeTiles.length = 1;
  178000. return;
  178001. }
  178002. let startIndex, endIndex, existingTile, existingRectangle;
  178003. const sourceRectangle = sourceTile.rectangle;
  178004. let epsilon;
  178005. const destinationRectangle = destinationTile.rectangle;
  178006. switch (tileEdge) {
  178007. case TileEdge_default.WEST:
  178008. epsilon = (destinationRectangle.north - destinationRectangle.south) * Math_default.EPSILON5;
  178009. for (startIndex = 0; startIndex < edgeTiles.length; ++startIndex) {
  178010. existingTile = edgeTiles[startIndex];
  178011. existingRectangle = existingTile.rectangle;
  178012. if (Math_default.greaterThan(
  178013. sourceRectangle.north,
  178014. existingRectangle.south,
  178015. epsilon
  178016. )) {
  178017. break;
  178018. }
  178019. }
  178020. for (endIndex = startIndex; endIndex < edgeTiles.length; ++endIndex) {
  178021. existingTile = edgeTiles[endIndex];
  178022. existingRectangle = existingTile.rectangle;
  178023. if (Math_default.greaterThanOrEquals(
  178024. sourceRectangle.south,
  178025. existingRectangle.north,
  178026. epsilon
  178027. )) {
  178028. break;
  178029. }
  178030. }
  178031. break;
  178032. case TileEdge_default.SOUTH:
  178033. epsilon = (destinationRectangle.east - destinationRectangle.west) * Math_default.EPSILON5;
  178034. for (startIndex = 0; startIndex < edgeTiles.length; ++startIndex) {
  178035. existingTile = edgeTiles[startIndex];
  178036. existingRectangle = existingTile.rectangle;
  178037. if (Math_default.lessThan(
  178038. sourceRectangle.west,
  178039. existingRectangle.east,
  178040. epsilon
  178041. )) {
  178042. break;
  178043. }
  178044. }
  178045. for (endIndex = startIndex; endIndex < edgeTiles.length; ++endIndex) {
  178046. existingTile = edgeTiles[endIndex];
  178047. existingRectangle = existingTile.rectangle;
  178048. if (Math_default.lessThanOrEquals(
  178049. sourceRectangle.east,
  178050. existingRectangle.west,
  178051. epsilon
  178052. )) {
  178053. break;
  178054. }
  178055. }
  178056. break;
  178057. case TileEdge_default.EAST:
  178058. epsilon = (destinationRectangle.north - destinationRectangle.south) * Math_default.EPSILON5;
  178059. for (startIndex = 0; startIndex < edgeTiles.length; ++startIndex) {
  178060. existingTile = edgeTiles[startIndex];
  178061. existingRectangle = existingTile.rectangle;
  178062. if (Math_default.lessThan(
  178063. sourceRectangle.south,
  178064. existingRectangle.north,
  178065. epsilon
  178066. )) {
  178067. break;
  178068. }
  178069. }
  178070. for (endIndex = startIndex; endIndex < edgeTiles.length; ++endIndex) {
  178071. existingTile = edgeTiles[endIndex];
  178072. existingRectangle = existingTile.rectangle;
  178073. if (Math_default.lessThanOrEquals(
  178074. sourceRectangle.north,
  178075. existingRectangle.south,
  178076. epsilon
  178077. )) {
  178078. break;
  178079. }
  178080. }
  178081. break;
  178082. case TileEdge_default.NORTH:
  178083. epsilon = (destinationRectangle.east - destinationRectangle.west) * Math_default.EPSILON5;
  178084. for (startIndex = 0; startIndex < edgeTiles.length; ++startIndex) {
  178085. existingTile = edgeTiles[startIndex];
  178086. existingRectangle = existingTile.rectangle;
  178087. if (Math_default.greaterThan(
  178088. sourceRectangle.east,
  178089. existingRectangle.west,
  178090. epsilon
  178091. )) {
  178092. break;
  178093. }
  178094. }
  178095. for (endIndex = startIndex; endIndex < edgeTiles.length; ++endIndex) {
  178096. existingTile = edgeTiles[endIndex];
  178097. existingRectangle = existingTile.rectangle;
  178098. if (Math_default.greaterThanOrEquals(
  178099. sourceRectangle.west,
  178100. existingRectangle.east,
  178101. epsilon
  178102. )) {
  178103. break;
  178104. }
  178105. }
  178106. break;
  178107. }
  178108. if (endIndex - startIndex === 1) {
  178109. destinationFill.changedThisFrame = destinationFill.changedThisFrame || edgeMeshes[startIndex] !== sourceMesh;
  178110. edgeMeshes[startIndex] = sourceMesh;
  178111. edgeTiles[startIndex] = sourceTile;
  178112. } else {
  178113. destinationFill.changedThisFrame = true;
  178114. edgeMeshes.splice(startIndex, endIndex - startIndex, sourceMesh);
  178115. edgeTiles.splice(startIndex, endIndex - startIndex, sourceTile);
  178116. }
  178117. }
  178118. var cartographicScratch4 = new Cartographic_default();
  178119. var centerCartographicScratch2 = new Cartographic_default();
  178120. var cartesianScratch = new Cartesian3_default();
  178121. var normalScratch6 = new Cartesian3_default();
  178122. var octEncodedNormalScratch = new Cartesian2_default();
  178123. var uvScratch2 = new Cartesian2_default();
  178124. var uvScratch = new Cartesian2_default();
  178125. function HeightAndNormal() {
  178126. this.height = 0;
  178127. this.encodedNormal = new Cartesian2_default();
  178128. }
  178129. function fillMissingCorner(fill, ellipsoid, u3, v7, corner, adjacentCorner1, adjacentCorner2, oppositeCorner, vertex) {
  178130. if (defined_default(corner)) {
  178131. return corner;
  178132. }
  178133. let height;
  178134. if (defined_default(adjacentCorner1) && defined_default(adjacentCorner2)) {
  178135. height = (adjacentCorner1.height + adjacentCorner2.height) * 0.5;
  178136. } else if (defined_default(adjacentCorner1)) {
  178137. height = adjacentCorner1.height;
  178138. } else if (defined_default(adjacentCorner2)) {
  178139. height = adjacentCorner2.height;
  178140. } else if (defined_default(oppositeCorner)) {
  178141. height = oppositeCorner.height;
  178142. } else {
  178143. const surfaceTile = fill.tile.data;
  178144. const tileBoundingRegion = surfaceTile.tileBoundingRegion;
  178145. let minimumHeight = 0;
  178146. let maximumHeight = 0;
  178147. if (defined_default(tileBoundingRegion)) {
  178148. minimumHeight = tileBoundingRegion.minimumHeight;
  178149. maximumHeight = tileBoundingRegion.maximumHeight;
  178150. }
  178151. height = (minimumHeight + maximumHeight) * 0.5;
  178152. }
  178153. getVertexWithHeightAtCorner(fill, ellipsoid, u3, v7, height, vertex);
  178154. return vertex;
  178155. }
  178156. var heightRangeScratch = {
  178157. minimumHeight: 0,
  178158. maximumHeight: 0
  178159. };
  178160. var scratchCenter7 = new Cartesian3_default();
  178161. var swVertexScratch = new HeightAndNormal();
  178162. var seVertexScratch = new HeightAndNormal();
  178163. var nwVertexScratch = new HeightAndNormal();
  178164. var neVertexScratch = new HeightAndNormal();
  178165. var heightmapBuffer = typeof Uint8Array !== "undefined" ? new Uint8Array(9 * 9) : void 0;
  178166. var scratchCreateMeshSyncOptions = {
  178167. tilingScheme: void 0,
  178168. x: 0,
  178169. y: 0,
  178170. level: 0,
  178171. exaggeration: 1,
  178172. exaggerationRelativeHeight: 0
  178173. };
  178174. function createFillMesh(tileProvider, frameState, tile, vertexArraysToDestroy) {
  178175. GlobeSurfaceTile_default.initialize(
  178176. tile,
  178177. tileProvider.terrainProvider,
  178178. tileProvider._imageryLayers
  178179. );
  178180. const surfaceTile = tile.data;
  178181. const fill = surfaceTile.fill;
  178182. const rectangle = tile.rectangle;
  178183. const exaggeration = frameState.terrainExaggeration;
  178184. const exaggerationRelativeHeight = frameState.terrainExaggerationRelativeHeight;
  178185. const hasExaggeration = exaggeration !== 1;
  178186. const ellipsoid = tile.tilingScheme.ellipsoid;
  178187. let nwCorner = getCorner(
  178188. fill,
  178189. ellipsoid,
  178190. 0,
  178191. 1,
  178192. fill.northwestTile,
  178193. fill.northwestMesh,
  178194. fill.northTiles,
  178195. fill.northMeshes,
  178196. fill.westTiles,
  178197. fill.westMeshes,
  178198. nwVertexScratch
  178199. );
  178200. let swCorner = getCorner(
  178201. fill,
  178202. ellipsoid,
  178203. 0,
  178204. 0,
  178205. fill.southwestTile,
  178206. fill.southwestMesh,
  178207. fill.westTiles,
  178208. fill.westMeshes,
  178209. fill.southTiles,
  178210. fill.southMeshes,
  178211. swVertexScratch
  178212. );
  178213. let seCorner = getCorner(
  178214. fill,
  178215. ellipsoid,
  178216. 1,
  178217. 0,
  178218. fill.southeastTile,
  178219. fill.southeastMesh,
  178220. fill.southTiles,
  178221. fill.southMeshes,
  178222. fill.eastTiles,
  178223. fill.eastMeshes,
  178224. seVertexScratch
  178225. );
  178226. let neCorner = getCorner(
  178227. fill,
  178228. ellipsoid,
  178229. 1,
  178230. 1,
  178231. fill.northeastTile,
  178232. fill.northeastMesh,
  178233. fill.eastTiles,
  178234. fill.eastMeshes,
  178235. fill.northTiles,
  178236. fill.northMeshes,
  178237. neVertexScratch
  178238. );
  178239. nwCorner = fillMissingCorner(
  178240. fill,
  178241. ellipsoid,
  178242. 0,
  178243. 1,
  178244. nwCorner,
  178245. swCorner,
  178246. neCorner,
  178247. seCorner,
  178248. nwVertexScratch
  178249. );
  178250. swCorner = fillMissingCorner(
  178251. fill,
  178252. ellipsoid,
  178253. 0,
  178254. 0,
  178255. swCorner,
  178256. nwCorner,
  178257. seCorner,
  178258. neCorner,
  178259. swVertexScratch
  178260. );
  178261. seCorner = fillMissingCorner(
  178262. fill,
  178263. ellipsoid,
  178264. 1,
  178265. 1,
  178266. seCorner,
  178267. swCorner,
  178268. neCorner,
  178269. nwCorner,
  178270. seVertexScratch
  178271. );
  178272. neCorner = fillMissingCorner(
  178273. fill,
  178274. ellipsoid,
  178275. 1,
  178276. 1,
  178277. neCorner,
  178278. seCorner,
  178279. nwCorner,
  178280. swCorner,
  178281. neVertexScratch
  178282. );
  178283. const southwestHeight = swCorner.height;
  178284. const southeastHeight = seCorner.height;
  178285. const northwestHeight = nwCorner.height;
  178286. const northeastHeight = neCorner.height;
  178287. let minimumHeight = Math.min(
  178288. southwestHeight,
  178289. southeastHeight,
  178290. northwestHeight,
  178291. northeastHeight
  178292. );
  178293. let maximumHeight = Math.max(
  178294. southwestHeight,
  178295. southeastHeight,
  178296. northwestHeight,
  178297. northeastHeight
  178298. );
  178299. const middleHeight = (minimumHeight + maximumHeight) * 0.5;
  178300. let i2;
  178301. let len;
  178302. const geometricError = tileProvider.getLevelMaximumGeometricError(tile.level);
  178303. const minCutThroughRadius = ellipsoid.maximumRadius - geometricError;
  178304. let maxTileWidth = Math.acos(minCutThroughRadius / ellipsoid.maximumRadius) * 4;
  178305. maxTileWidth *= 1.5;
  178306. if (rectangle.width > maxTileWidth && maximumHeight - minimumHeight <= geometricError) {
  178307. const terrainData = new HeightmapTerrainData_default({
  178308. width: 9,
  178309. height: 9,
  178310. buffer: heightmapBuffer,
  178311. structure: {
  178312. heightOffset: maximumHeight
  178313. }
  178314. });
  178315. const createMeshSyncOptions = scratchCreateMeshSyncOptions;
  178316. createMeshSyncOptions.tilingScheme = tile.tilingScheme;
  178317. createMeshSyncOptions.x = tile.x;
  178318. createMeshSyncOptions.y = tile.y;
  178319. createMeshSyncOptions.level = tile.level;
  178320. createMeshSyncOptions.exaggeration = exaggeration;
  178321. createMeshSyncOptions.exaggerationRelativeHeight = exaggerationRelativeHeight;
  178322. fill.mesh = terrainData._createMeshSync(createMeshSyncOptions);
  178323. } else {
  178324. const hasGeodeticSurfaceNormals = hasExaggeration;
  178325. const centerCartographic = Rectangle_default.center(
  178326. rectangle,
  178327. centerCartographicScratch2
  178328. );
  178329. centerCartographic.height = middleHeight;
  178330. const center = ellipsoid.cartographicToCartesian(
  178331. centerCartographic,
  178332. scratchCenter7
  178333. );
  178334. const encoding = new TerrainEncoding_default(
  178335. center,
  178336. void 0,
  178337. void 0,
  178338. void 0,
  178339. void 0,
  178340. true,
  178341. true,
  178342. hasGeodeticSurfaceNormals,
  178343. exaggeration,
  178344. exaggerationRelativeHeight
  178345. );
  178346. let maxVertexCount = 5;
  178347. let meshes;
  178348. meshes = fill.westMeshes;
  178349. for (i2 = 0, len = meshes.length; i2 < len; ++i2) {
  178350. maxVertexCount += meshes[i2].eastIndicesNorthToSouth.length;
  178351. }
  178352. meshes = fill.southMeshes;
  178353. for (i2 = 0, len = meshes.length; i2 < len; ++i2) {
  178354. maxVertexCount += meshes[i2].northIndicesWestToEast.length;
  178355. }
  178356. meshes = fill.eastMeshes;
  178357. for (i2 = 0, len = meshes.length; i2 < len; ++i2) {
  178358. maxVertexCount += meshes[i2].westIndicesSouthToNorth.length;
  178359. }
  178360. meshes = fill.northMeshes;
  178361. for (i2 = 0, len = meshes.length; i2 < len; ++i2) {
  178362. maxVertexCount += meshes[i2].southIndicesEastToWest.length;
  178363. }
  178364. const heightRange = heightRangeScratch;
  178365. heightRange.minimumHeight = minimumHeight;
  178366. heightRange.maximumHeight = maximumHeight;
  178367. const stride = encoding.stride;
  178368. let typedArray = new Float32Array(maxVertexCount * stride);
  178369. let nextIndex = 0;
  178370. const northwestIndex = nextIndex;
  178371. nextIndex = addVertexWithComputedPosition(
  178372. ellipsoid,
  178373. rectangle,
  178374. encoding,
  178375. typedArray,
  178376. nextIndex,
  178377. 0,
  178378. 1,
  178379. nwCorner.height,
  178380. nwCorner.encodedNormal,
  178381. 1,
  178382. heightRange
  178383. );
  178384. nextIndex = addEdge(
  178385. fill,
  178386. ellipsoid,
  178387. encoding,
  178388. typedArray,
  178389. nextIndex,
  178390. fill.westTiles,
  178391. fill.westMeshes,
  178392. TileEdge_default.EAST,
  178393. heightRange
  178394. );
  178395. const southwestIndex = nextIndex;
  178396. nextIndex = addVertexWithComputedPosition(
  178397. ellipsoid,
  178398. rectangle,
  178399. encoding,
  178400. typedArray,
  178401. nextIndex,
  178402. 0,
  178403. 0,
  178404. swCorner.height,
  178405. swCorner.encodedNormal,
  178406. 0,
  178407. heightRange
  178408. );
  178409. nextIndex = addEdge(
  178410. fill,
  178411. ellipsoid,
  178412. encoding,
  178413. typedArray,
  178414. nextIndex,
  178415. fill.southTiles,
  178416. fill.southMeshes,
  178417. TileEdge_default.NORTH,
  178418. heightRange
  178419. );
  178420. const southeastIndex = nextIndex;
  178421. nextIndex = addVertexWithComputedPosition(
  178422. ellipsoid,
  178423. rectangle,
  178424. encoding,
  178425. typedArray,
  178426. nextIndex,
  178427. 1,
  178428. 0,
  178429. seCorner.height,
  178430. seCorner.encodedNormal,
  178431. 0,
  178432. heightRange
  178433. );
  178434. nextIndex = addEdge(
  178435. fill,
  178436. ellipsoid,
  178437. encoding,
  178438. typedArray,
  178439. nextIndex,
  178440. fill.eastTiles,
  178441. fill.eastMeshes,
  178442. TileEdge_default.WEST,
  178443. heightRange
  178444. );
  178445. const northeastIndex = nextIndex;
  178446. nextIndex = addVertexWithComputedPosition(
  178447. ellipsoid,
  178448. rectangle,
  178449. encoding,
  178450. typedArray,
  178451. nextIndex,
  178452. 1,
  178453. 1,
  178454. neCorner.height,
  178455. neCorner.encodedNormal,
  178456. 1,
  178457. heightRange
  178458. );
  178459. nextIndex = addEdge(
  178460. fill,
  178461. ellipsoid,
  178462. encoding,
  178463. typedArray,
  178464. nextIndex,
  178465. fill.northTiles,
  178466. fill.northMeshes,
  178467. TileEdge_default.SOUTH,
  178468. heightRange
  178469. );
  178470. minimumHeight = heightRange.minimumHeight;
  178471. maximumHeight = heightRange.maximumHeight;
  178472. const obb = OrientedBoundingBox_default.fromRectangle(
  178473. rectangle,
  178474. minimumHeight,
  178475. maximumHeight,
  178476. tile.tilingScheme.ellipsoid
  178477. );
  178478. const southMercatorY = WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(
  178479. rectangle.south
  178480. );
  178481. const oneOverMercatorHeight = 1 / (WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(rectangle.north) - southMercatorY);
  178482. const centerWebMercatorT = (WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(
  178483. centerCartographic.latitude
  178484. ) - southMercatorY) * oneOverMercatorHeight;
  178485. const geodeticSurfaceNormal = ellipsoid.geodeticSurfaceNormalCartographic(
  178486. cartographicScratch4,
  178487. normalScratch6
  178488. );
  178489. const centerEncodedNormal = AttributeCompression_default.octEncode(
  178490. geodeticSurfaceNormal,
  178491. octEncodedNormalScratch
  178492. );
  178493. const centerIndex = nextIndex;
  178494. encoding.encode(
  178495. typedArray,
  178496. nextIndex * stride,
  178497. obb.center,
  178498. Cartesian2_default.fromElements(0.5, 0.5, uvScratch),
  178499. middleHeight,
  178500. centerEncodedNormal,
  178501. centerWebMercatorT,
  178502. geodeticSurfaceNormal
  178503. );
  178504. ++nextIndex;
  178505. const vertexCount = nextIndex;
  178506. const bytesPerIndex = vertexCount < 256 ? 1 : 2;
  178507. const indexCount = (vertexCount - 1) * 3;
  178508. const indexDataBytes = indexCount * bytesPerIndex;
  178509. const availableBytesInBuffer = (typedArray.length - vertexCount * stride) * Float32Array.BYTES_PER_ELEMENT;
  178510. let indices2;
  178511. if (availableBytesInBuffer >= indexDataBytes) {
  178512. const startIndex = vertexCount * stride * Float32Array.BYTES_PER_ELEMENT;
  178513. indices2 = vertexCount < 256 ? new Uint8Array(typedArray.buffer, startIndex, indexCount) : new Uint16Array(typedArray.buffer, startIndex, indexCount);
  178514. } else {
  178515. indices2 = vertexCount < 256 ? new Uint8Array(indexCount) : new Uint16Array(indexCount);
  178516. }
  178517. typedArray = new Float32Array(typedArray.buffer, 0, vertexCount * stride);
  178518. let indexOut = 0;
  178519. for (i2 = 0; i2 < vertexCount - 2; ++i2) {
  178520. indices2[indexOut++] = centerIndex;
  178521. indices2[indexOut++] = i2;
  178522. indices2[indexOut++] = i2 + 1;
  178523. }
  178524. indices2[indexOut++] = centerIndex;
  178525. indices2[indexOut++] = i2;
  178526. indices2[indexOut++] = 0;
  178527. const westIndicesSouthToNorth = [];
  178528. for (i2 = southwestIndex; i2 >= northwestIndex; --i2) {
  178529. westIndicesSouthToNorth.push(i2);
  178530. }
  178531. const southIndicesEastToWest = [];
  178532. for (i2 = southeastIndex; i2 >= southwestIndex; --i2) {
  178533. southIndicesEastToWest.push(i2);
  178534. }
  178535. const eastIndicesNorthToSouth = [];
  178536. for (i2 = northeastIndex; i2 >= southeastIndex; --i2) {
  178537. eastIndicesNorthToSouth.push(i2);
  178538. }
  178539. const northIndicesWestToEast = [];
  178540. northIndicesWestToEast.push(0);
  178541. for (i2 = centerIndex - 1; i2 >= northeastIndex; --i2) {
  178542. northIndicesWestToEast.push(i2);
  178543. }
  178544. fill.mesh = new TerrainMesh_default(
  178545. encoding.center,
  178546. typedArray,
  178547. indices2,
  178548. indexCount,
  178549. vertexCount,
  178550. minimumHeight,
  178551. maximumHeight,
  178552. BoundingSphere_default.fromOrientedBoundingBox(obb),
  178553. computeOccludeePoint(
  178554. tileProvider,
  178555. obb.center,
  178556. rectangle,
  178557. minimumHeight,
  178558. maximumHeight
  178559. ),
  178560. encoding.stride,
  178561. obb,
  178562. encoding,
  178563. westIndicesSouthToNorth,
  178564. southIndicesEastToWest,
  178565. eastIndicesNorthToSouth,
  178566. northIndicesWestToEast
  178567. );
  178568. }
  178569. const context = frameState.context;
  178570. fill._destroyVertexArray(vertexArraysToDestroy);
  178571. fill.vertexArray = GlobeSurfaceTile_default._createVertexArrayForMesh(
  178572. context,
  178573. fill.mesh
  178574. );
  178575. surfaceTile.processImagery(
  178576. tile,
  178577. tileProvider.terrainProvider,
  178578. frameState,
  178579. true
  178580. );
  178581. const oldTexture = fill.waterMaskTexture;
  178582. fill.waterMaskTexture = void 0;
  178583. if (tileProvider.terrainProvider.hasWaterMask) {
  178584. const waterSourceTile = surfaceTile._findAncestorTileWithTerrainData(tile);
  178585. if (defined_default(waterSourceTile) && defined_default(waterSourceTile.data.waterMaskTexture)) {
  178586. fill.waterMaskTexture = waterSourceTile.data.waterMaskTexture;
  178587. ++fill.waterMaskTexture.referenceCount;
  178588. surfaceTile._computeWaterMaskTranslationAndScale(
  178589. tile,
  178590. waterSourceTile,
  178591. fill.waterMaskTranslationAndScale
  178592. );
  178593. }
  178594. }
  178595. if (defined_default(oldTexture)) {
  178596. --oldTexture.referenceCount;
  178597. if (oldTexture.referenceCount === 0) {
  178598. oldTexture.destroy();
  178599. }
  178600. }
  178601. }
  178602. function addVertexWithComputedPosition(ellipsoid, rectangle, encoding, buffer, index2, u3, v7, height, encodedNormal, webMercatorT, heightRange) {
  178603. const cartographic2 = cartographicScratch4;
  178604. cartographic2.longitude = Math_default.lerp(rectangle.west, rectangle.east, u3);
  178605. cartographic2.latitude = Math_default.lerp(rectangle.south, rectangle.north, v7);
  178606. cartographic2.height = height;
  178607. const position = ellipsoid.cartographicToCartesian(
  178608. cartographic2,
  178609. cartesianScratch
  178610. );
  178611. let geodeticSurfaceNormal;
  178612. if (encoding.hasGeodeticSurfaceNormals) {
  178613. geodeticSurfaceNormal = ellipsoid.geodeticSurfaceNormal(
  178614. position,
  178615. normalScratch6
  178616. );
  178617. }
  178618. const uv = uvScratch2;
  178619. uv.x = u3;
  178620. uv.y = v7;
  178621. encoding.encode(
  178622. buffer,
  178623. index2 * encoding.stride,
  178624. position,
  178625. uv,
  178626. height,
  178627. encodedNormal,
  178628. webMercatorT,
  178629. geodeticSurfaceNormal
  178630. );
  178631. heightRange.minimumHeight = Math.min(heightRange.minimumHeight, height);
  178632. heightRange.maximumHeight = Math.max(heightRange.maximumHeight, height);
  178633. return index2 + 1;
  178634. }
  178635. var sourceRectangleScratch = new Rectangle_default();
  178636. function transformTextureCoordinates(sourceTile, targetTile, coordinates, result) {
  178637. let sourceRectangle = sourceTile.rectangle;
  178638. const targetRectangle = targetTile.rectangle;
  178639. if (targetTile.x === 0 && coordinates.x === 1 && sourceTile.x === sourceTile.tilingScheme.getNumberOfXTilesAtLevel(sourceTile.level) - 1) {
  178640. sourceRectangle = Rectangle_default.clone(
  178641. sourceTile.rectangle,
  178642. sourceRectangleScratch
  178643. );
  178644. sourceRectangle.west -= Math_default.TWO_PI;
  178645. sourceRectangle.east -= Math_default.TWO_PI;
  178646. } else if (sourceTile.x === 0 && coordinates.x === 0 && targetTile.x === targetTile.tilingScheme.getNumberOfXTilesAtLevel(targetTile.level) - 1) {
  178647. sourceRectangle = Rectangle_default.clone(
  178648. sourceTile.rectangle,
  178649. sourceRectangleScratch
  178650. );
  178651. sourceRectangle.west += Math_default.TWO_PI;
  178652. sourceRectangle.east += Math_default.TWO_PI;
  178653. }
  178654. const sourceWidth = sourceRectangle.east - sourceRectangle.west;
  178655. const umin = (targetRectangle.west - sourceRectangle.west) / sourceWidth;
  178656. const umax = (targetRectangle.east - sourceRectangle.west) / sourceWidth;
  178657. const sourceHeight = sourceRectangle.north - sourceRectangle.south;
  178658. const vmin = (targetRectangle.south - sourceRectangle.south) / sourceHeight;
  178659. const vmax = (targetRectangle.north - sourceRectangle.south) / sourceHeight;
  178660. let u3 = (coordinates.x - umin) / (umax - umin);
  178661. let v7 = (coordinates.y - vmin) / (vmax - vmin);
  178662. if (Math.abs(u3) < Math.EPSILON5) {
  178663. u3 = 0;
  178664. } else if (Math.abs(u3 - 1) < Math.EPSILON5) {
  178665. u3 = 1;
  178666. }
  178667. if (Math.abs(v7) < Math.EPSILON5) {
  178668. v7 = 0;
  178669. } else if (Math.abs(v7 - 1) < Math.EPSILON5) {
  178670. v7 = 1;
  178671. }
  178672. result.x = u3;
  178673. result.y = v7;
  178674. return result;
  178675. }
  178676. var encodedNormalScratch = new Cartesian2_default();
  178677. function getVertexFromTileAtCorner(sourceMesh, sourceIndex, u3, v7, vertex) {
  178678. const sourceEncoding = sourceMesh.encoding;
  178679. const sourceVertices = sourceMesh.vertices;
  178680. vertex.height = sourceEncoding.decodeHeight(sourceVertices, sourceIndex);
  178681. if (sourceEncoding.hasVertexNormals) {
  178682. sourceEncoding.getOctEncodedNormal(
  178683. sourceVertices,
  178684. sourceIndex,
  178685. vertex.encodedNormal
  178686. );
  178687. } else {
  178688. const normal2 = vertex.encodedNormal;
  178689. normal2.x = 0;
  178690. normal2.y = 0;
  178691. }
  178692. }
  178693. var encodedNormalScratch2 = new Cartesian2_default();
  178694. var cartesianScratch2 = new Cartesian3_default();
  178695. function getInterpolatedVertexAtCorner(ellipsoid, sourceTile, targetTile, sourceMesh, previousIndex, nextIndex, u3, v7, interpolateU, vertex) {
  178696. const sourceEncoding = sourceMesh.encoding;
  178697. const sourceVertices = sourceMesh.vertices;
  178698. const previousUv = transformTextureCoordinates(
  178699. sourceTile,
  178700. targetTile,
  178701. sourceEncoding.decodeTextureCoordinates(
  178702. sourceVertices,
  178703. previousIndex,
  178704. uvScratch
  178705. ),
  178706. uvScratch
  178707. );
  178708. const nextUv = transformTextureCoordinates(
  178709. sourceTile,
  178710. targetTile,
  178711. sourceEncoding.decodeTextureCoordinates(
  178712. sourceVertices,
  178713. nextIndex,
  178714. uvScratch2
  178715. ),
  178716. uvScratch2
  178717. );
  178718. let ratio;
  178719. if (interpolateU) {
  178720. ratio = (u3 - previousUv.x) / (nextUv.x - previousUv.x);
  178721. } else {
  178722. ratio = (v7 - previousUv.y) / (nextUv.y - previousUv.y);
  178723. }
  178724. const height1 = sourceEncoding.decodeHeight(sourceVertices, previousIndex);
  178725. const height2 = sourceEncoding.decodeHeight(sourceVertices, nextIndex);
  178726. const targetRectangle = targetTile.rectangle;
  178727. cartographicScratch4.longitude = Math_default.lerp(
  178728. targetRectangle.west,
  178729. targetRectangle.east,
  178730. u3
  178731. );
  178732. cartographicScratch4.latitude = Math_default.lerp(
  178733. targetRectangle.south,
  178734. targetRectangle.north,
  178735. v7
  178736. );
  178737. vertex.height = cartographicScratch4.height = Math_default.lerp(
  178738. height1,
  178739. height2,
  178740. ratio
  178741. );
  178742. let normal2;
  178743. if (sourceEncoding.hasVertexNormals) {
  178744. const encodedNormal1 = sourceEncoding.getOctEncodedNormal(
  178745. sourceVertices,
  178746. previousIndex,
  178747. encodedNormalScratch
  178748. );
  178749. const encodedNormal2 = sourceEncoding.getOctEncodedNormal(
  178750. sourceVertices,
  178751. nextIndex,
  178752. encodedNormalScratch2
  178753. );
  178754. const normal1 = AttributeCompression_default.octDecode(
  178755. encodedNormal1.x,
  178756. encodedNormal1.y,
  178757. cartesianScratch
  178758. );
  178759. const normal22 = AttributeCompression_default.octDecode(
  178760. encodedNormal2.x,
  178761. encodedNormal2.y,
  178762. cartesianScratch2
  178763. );
  178764. normal2 = Cartesian3_default.lerp(normal1, normal22, ratio, cartesianScratch);
  178765. Cartesian3_default.normalize(normal2, normal2);
  178766. AttributeCompression_default.octEncode(normal2, vertex.encodedNormal);
  178767. } else {
  178768. normal2 = ellipsoid.geodeticSurfaceNormalCartographic(
  178769. cartographicScratch4,
  178770. cartesianScratch
  178771. );
  178772. AttributeCompression_default.octEncode(normal2, vertex.encodedNormal);
  178773. }
  178774. }
  178775. function getVertexWithHeightAtCorner(terrainFillMesh, ellipsoid, u3, v7, height, vertex) {
  178776. vertex.height = height;
  178777. const normal2 = ellipsoid.geodeticSurfaceNormalCartographic(
  178778. cartographicScratch4,
  178779. cartesianScratch
  178780. );
  178781. AttributeCompression_default.octEncode(normal2, vertex.encodedNormal);
  178782. }
  178783. function getCorner(terrainFillMesh, ellipsoid, u3, v7, cornerTile, cornerMesh, previousEdgeTiles, previousEdgeMeshes, nextEdgeTiles, nextEdgeMeshes, vertex) {
  178784. const gotCorner = getCornerFromEdge(
  178785. terrainFillMesh,
  178786. ellipsoid,
  178787. previousEdgeMeshes,
  178788. previousEdgeTiles,
  178789. false,
  178790. u3,
  178791. v7,
  178792. vertex
  178793. ) || getCornerFromEdge(
  178794. terrainFillMesh,
  178795. ellipsoid,
  178796. nextEdgeMeshes,
  178797. nextEdgeTiles,
  178798. true,
  178799. u3,
  178800. v7,
  178801. vertex
  178802. );
  178803. if (gotCorner) {
  178804. return vertex;
  178805. }
  178806. let vertexIndex;
  178807. if (meshIsUsable(cornerTile, cornerMesh)) {
  178808. if (u3 === 0) {
  178809. if (v7 === 0) {
  178810. vertexIndex = cornerMesh.eastIndicesNorthToSouth[0];
  178811. } else {
  178812. vertexIndex = cornerMesh.southIndicesEastToWest[0];
  178813. }
  178814. } else if (v7 === 0) {
  178815. vertexIndex = cornerMesh.northIndicesWestToEast[0];
  178816. } else {
  178817. vertexIndex = cornerMesh.westIndicesSouthToNorth[0];
  178818. }
  178819. getVertexFromTileAtCorner(cornerMesh, vertexIndex, u3, v7, vertex);
  178820. return vertex;
  178821. }
  178822. let height;
  178823. if (u3 === 0) {
  178824. if (v7 === 0) {
  178825. height = getClosestHeightToCorner(
  178826. terrainFillMesh.westMeshes,
  178827. terrainFillMesh.westTiles,
  178828. TileEdge_default.EAST,
  178829. terrainFillMesh.southMeshes,
  178830. terrainFillMesh.southTiles,
  178831. TileEdge_default.NORTH,
  178832. u3,
  178833. v7
  178834. );
  178835. } else {
  178836. height = getClosestHeightToCorner(
  178837. terrainFillMesh.northMeshes,
  178838. terrainFillMesh.northTiles,
  178839. TileEdge_default.SOUTH,
  178840. terrainFillMesh.westMeshes,
  178841. terrainFillMesh.westTiles,
  178842. TileEdge_default.EAST,
  178843. u3,
  178844. v7
  178845. );
  178846. }
  178847. } else if (v7 === 0) {
  178848. height = getClosestHeightToCorner(
  178849. terrainFillMesh.southMeshes,
  178850. terrainFillMesh.southTiles,
  178851. TileEdge_default.NORTH,
  178852. terrainFillMesh.eastMeshes,
  178853. terrainFillMesh.eastTiles,
  178854. TileEdge_default.WEST,
  178855. u3,
  178856. v7
  178857. );
  178858. } else {
  178859. height = getClosestHeightToCorner(
  178860. terrainFillMesh.eastMeshes,
  178861. terrainFillMesh.eastTiles,
  178862. TileEdge_default.WEST,
  178863. terrainFillMesh.northMeshes,
  178864. terrainFillMesh.northTiles,
  178865. TileEdge_default.SOUTH,
  178866. u3,
  178867. v7
  178868. );
  178869. }
  178870. if (defined_default(height)) {
  178871. getVertexWithHeightAtCorner(
  178872. terrainFillMesh,
  178873. ellipsoid,
  178874. u3,
  178875. v7,
  178876. height,
  178877. vertex
  178878. );
  178879. return vertex;
  178880. }
  178881. return void 0;
  178882. }
  178883. function getClosestHeightToCorner(previousMeshes, previousTiles, previousEdge, nextMeshes, nextTiles, nextEdge, u3, v7) {
  178884. const height1 = getNearestHeightOnEdge(
  178885. previousMeshes,
  178886. previousTiles,
  178887. false,
  178888. previousEdge,
  178889. u3,
  178890. v7
  178891. );
  178892. const height2 = getNearestHeightOnEdge(
  178893. nextMeshes,
  178894. nextTiles,
  178895. true,
  178896. nextEdge,
  178897. u3,
  178898. v7
  178899. );
  178900. if (defined_default(height1) && defined_default(height2)) {
  178901. return (height1 + height2) * 0.5;
  178902. } else if (defined_default(height1)) {
  178903. return height1;
  178904. }
  178905. return height2;
  178906. }
  178907. function addEdge(terrainFillMesh, ellipsoid, encoding, typedArray, nextIndex, edgeTiles, edgeMeshes, tileEdge, heightRange) {
  178908. for (let i2 = 0; i2 < edgeTiles.length; ++i2) {
  178909. nextIndex = addEdgeMesh(
  178910. terrainFillMesh,
  178911. ellipsoid,
  178912. encoding,
  178913. typedArray,
  178914. nextIndex,
  178915. edgeTiles[i2],
  178916. edgeMeshes[i2],
  178917. tileEdge,
  178918. heightRange
  178919. );
  178920. }
  178921. return nextIndex;
  178922. }
  178923. function addEdgeMesh(terrainFillMesh, ellipsoid, encoding, typedArray, nextIndex, edgeTile, edgeMesh, tileEdge, heightRange) {
  178924. let sourceRectangle = edgeTile.rectangle;
  178925. if (tileEdge === TileEdge_default.EAST && terrainFillMesh.tile.x === 0) {
  178926. sourceRectangle = Rectangle_default.clone(
  178927. edgeTile.rectangle,
  178928. sourceRectangleScratch
  178929. );
  178930. sourceRectangle.west -= Math_default.TWO_PI;
  178931. sourceRectangle.east -= Math_default.TWO_PI;
  178932. } else if (tileEdge === TileEdge_default.WEST && edgeTile.x === 0) {
  178933. sourceRectangle = Rectangle_default.clone(
  178934. edgeTile.rectangle,
  178935. sourceRectangleScratch
  178936. );
  178937. sourceRectangle.west += Math_default.TWO_PI;
  178938. sourceRectangle.east += Math_default.TWO_PI;
  178939. }
  178940. const targetRectangle = terrainFillMesh.tile.rectangle;
  178941. let lastU;
  178942. let lastV;
  178943. if (nextIndex > 0) {
  178944. encoding.decodeTextureCoordinates(typedArray, nextIndex - 1, uvScratch);
  178945. lastU = uvScratch.x;
  178946. lastV = uvScratch.y;
  178947. }
  178948. let indices2;
  178949. let compareU;
  178950. switch (tileEdge) {
  178951. case TileEdge_default.WEST:
  178952. indices2 = edgeMesh.westIndicesSouthToNorth;
  178953. compareU = false;
  178954. break;
  178955. case TileEdge_default.NORTH:
  178956. indices2 = edgeMesh.northIndicesWestToEast;
  178957. compareU = true;
  178958. break;
  178959. case TileEdge_default.EAST:
  178960. indices2 = edgeMesh.eastIndicesNorthToSouth;
  178961. compareU = false;
  178962. break;
  178963. case TileEdge_default.SOUTH:
  178964. indices2 = edgeMesh.southIndicesEastToWest;
  178965. compareU = true;
  178966. break;
  178967. }
  178968. const sourceTile = edgeTile;
  178969. const targetTile = terrainFillMesh.tile;
  178970. const sourceEncoding = edgeMesh.encoding;
  178971. const sourceVertices = edgeMesh.vertices;
  178972. const targetStride = encoding.stride;
  178973. let southMercatorY;
  178974. let oneOverMercatorHeight;
  178975. if (sourceEncoding.hasWebMercatorT) {
  178976. southMercatorY = WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(
  178977. targetRectangle.south
  178978. );
  178979. oneOverMercatorHeight = 1 / (WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(
  178980. targetRectangle.north
  178981. ) - southMercatorY);
  178982. }
  178983. for (let i2 = 0; i2 < indices2.length; ++i2) {
  178984. const index2 = indices2[i2];
  178985. const uv = sourceEncoding.decodeTextureCoordinates(
  178986. sourceVertices,
  178987. index2,
  178988. uvScratch
  178989. );
  178990. transformTextureCoordinates(sourceTile, targetTile, uv, uv);
  178991. const u3 = uv.x;
  178992. const v7 = uv.y;
  178993. const uOrV = compareU ? u3 : v7;
  178994. if (uOrV < 0 || uOrV > 1) {
  178995. continue;
  178996. }
  178997. if (Math.abs(u3 - lastU) < Math_default.EPSILON5 && Math.abs(v7 - lastV) < Math_default.EPSILON5) {
  178998. continue;
  178999. }
  179000. const nearlyEdgeU = Math.abs(u3) < Math_default.EPSILON5 || Math.abs(u3 - 1) < Math_default.EPSILON5;
  179001. const nearlyEdgeV = Math.abs(v7) < Math_default.EPSILON5 || Math.abs(v7 - 1) < Math_default.EPSILON5;
  179002. if (nearlyEdgeU && nearlyEdgeV) {
  179003. continue;
  179004. }
  179005. const position = sourceEncoding.decodePosition(
  179006. sourceVertices,
  179007. index2,
  179008. cartesianScratch
  179009. );
  179010. const height = sourceEncoding.decodeHeight(sourceVertices, index2);
  179011. let normal2;
  179012. if (sourceEncoding.hasVertexNormals) {
  179013. normal2 = sourceEncoding.getOctEncodedNormal(
  179014. sourceVertices,
  179015. index2,
  179016. octEncodedNormalScratch
  179017. );
  179018. } else {
  179019. normal2 = octEncodedNormalScratch;
  179020. normal2.x = 0;
  179021. normal2.y = 0;
  179022. }
  179023. let webMercatorT = v7;
  179024. if (sourceEncoding.hasWebMercatorT) {
  179025. const latitude = Math_default.lerp(
  179026. targetRectangle.south,
  179027. targetRectangle.north,
  179028. v7
  179029. );
  179030. webMercatorT = (WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(latitude) - southMercatorY) * oneOverMercatorHeight;
  179031. }
  179032. let geodeticSurfaceNormal;
  179033. if (encoding.hasGeodeticSurfaceNormals) {
  179034. geodeticSurfaceNormal = ellipsoid.geodeticSurfaceNormal(
  179035. position,
  179036. normalScratch6
  179037. );
  179038. }
  179039. encoding.encode(
  179040. typedArray,
  179041. nextIndex * targetStride,
  179042. position,
  179043. uv,
  179044. height,
  179045. normal2,
  179046. webMercatorT,
  179047. geodeticSurfaceNormal
  179048. );
  179049. heightRange.minimumHeight = Math.min(heightRange.minimumHeight, height);
  179050. heightRange.maximumHeight = Math.max(heightRange.maximumHeight, height);
  179051. ++nextIndex;
  179052. }
  179053. return nextIndex;
  179054. }
  179055. function getNearestHeightOnEdge(meshes, tiles, isNext, edge, u3, v7) {
  179056. let meshStart;
  179057. let meshEnd;
  179058. let meshStep;
  179059. if (isNext) {
  179060. meshStart = 0;
  179061. meshEnd = meshes.length;
  179062. meshStep = 1;
  179063. } else {
  179064. meshStart = meshes.length - 1;
  179065. meshEnd = -1;
  179066. meshStep = -1;
  179067. }
  179068. for (let meshIndex = meshStart; meshIndex !== meshEnd; meshIndex += meshStep) {
  179069. const mesh2 = meshes[meshIndex];
  179070. const tile = tiles[meshIndex];
  179071. if (!meshIsUsable(tile, mesh2)) {
  179072. continue;
  179073. }
  179074. let indices2;
  179075. switch (edge) {
  179076. case TileEdge_default.WEST:
  179077. indices2 = mesh2.westIndicesSouthToNorth;
  179078. break;
  179079. case TileEdge_default.SOUTH:
  179080. indices2 = mesh2.southIndicesEastToWest;
  179081. break;
  179082. case TileEdge_default.EAST:
  179083. indices2 = mesh2.eastIndicesNorthToSouth;
  179084. break;
  179085. case TileEdge_default.NORTH:
  179086. indices2 = mesh2.northIndicesWestToEast;
  179087. break;
  179088. }
  179089. const index2 = indices2[isNext ? 0 : indices2.length - 1];
  179090. if (defined_default(index2)) {
  179091. return mesh2.encoding.decodeHeight(mesh2.vertices, index2);
  179092. }
  179093. }
  179094. return void 0;
  179095. }
  179096. function meshIsUsable(tile, mesh2) {
  179097. return defined_default(mesh2) && (!defined_default(tile.data.fill) || !tile.data.fill.changedThisFrame);
  179098. }
  179099. function getCornerFromEdge(terrainFillMesh, ellipsoid, edgeMeshes, edgeTiles, isNext, u3, v7, vertex) {
  179100. let edgeVertices;
  179101. let compareU;
  179102. let increasing;
  179103. let vertexIndexIndex;
  179104. let vertexIndex;
  179105. const sourceTile = edgeTiles[isNext ? 0 : edgeMeshes.length - 1];
  179106. const sourceMesh = edgeMeshes[isNext ? 0 : edgeMeshes.length - 1];
  179107. if (meshIsUsable(sourceTile, sourceMesh)) {
  179108. if (u3 === 0) {
  179109. if (v7 === 0) {
  179110. edgeVertices = isNext ? sourceMesh.northIndicesWestToEast : sourceMesh.eastIndicesNorthToSouth;
  179111. compareU = isNext;
  179112. increasing = isNext;
  179113. } else {
  179114. edgeVertices = isNext ? sourceMesh.eastIndicesNorthToSouth : sourceMesh.southIndicesEastToWest;
  179115. compareU = !isNext;
  179116. increasing = false;
  179117. }
  179118. } else if (v7 === 0) {
  179119. edgeVertices = isNext ? sourceMesh.westIndicesSouthToNorth : sourceMesh.northIndicesWestToEast;
  179120. compareU = !isNext;
  179121. increasing = true;
  179122. } else {
  179123. edgeVertices = isNext ? sourceMesh.southIndicesEastToWest : sourceMesh.westIndicesSouthToNorth;
  179124. compareU = isNext;
  179125. increasing = !isNext;
  179126. }
  179127. if (edgeVertices.length > 0) {
  179128. vertexIndexIndex = isNext ? 0 : edgeVertices.length - 1;
  179129. vertexIndex = edgeVertices[vertexIndexIndex];
  179130. sourceMesh.encoding.decodeTextureCoordinates(
  179131. sourceMesh.vertices,
  179132. vertexIndex,
  179133. uvScratch
  179134. );
  179135. const targetUv = transformTextureCoordinates(
  179136. sourceTile,
  179137. terrainFillMesh.tile,
  179138. uvScratch,
  179139. uvScratch
  179140. );
  179141. if (targetUv.x === u3 && targetUv.y === v7) {
  179142. getVertexFromTileAtCorner(sourceMesh, vertexIndex, u3, v7, vertex);
  179143. return true;
  179144. }
  179145. vertexIndexIndex = binarySearch_default(edgeVertices, compareU ? u3 : v7, function(vertexIndex2, textureCoordinate) {
  179146. sourceMesh.encoding.decodeTextureCoordinates(
  179147. sourceMesh.vertices,
  179148. vertexIndex2,
  179149. uvScratch
  179150. );
  179151. const targetUv2 = transformTextureCoordinates(
  179152. sourceTile,
  179153. terrainFillMesh.tile,
  179154. uvScratch,
  179155. uvScratch
  179156. );
  179157. if (increasing) {
  179158. if (compareU) {
  179159. return targetUv2.x - u3;
  179160. }
  179161. return targetUv2.y - v7;
  179162. } else if (compareU) {
  179163. return u3 - targetUv2.x;
  179164. }
  179165. return v7 - targetUv2.y;
  179166. });
  179167. if (vertexIndexIndex < 0) {
  179168. vertexIndexIndex = ~vertexIndexIndex;
  179169. if (vertexIndexIndex > 0 && vertexIndexIndex < edgeVertices.length) {
  179170. getInterpolatedVertexAtCorner(
  179171. ellipsoid,
  179172. sourceTile,
  179173. terrainFillMesh.tile,
  179174. sourceMesh,
  179175. edgeVertices[vertexIndexIndex - 1],
  179176. edgeVertices[vertexIndexIndex],
  179177. u3,
  179178. v7,
  179179. compareU,
  179180. vertex
  179181. );
  179182. return true;
  179183. }
  179184. } else {
  179185. getVertexFromTileAtCorner(
  179186. sourceMesh,
  179187. edgeVertices[vertexIndexIndex],
  179188. u3,
  179189. v7,
  179190. vertex
  179191. );
  179192. return true;
  179193. }
  179194. }
  179195. }
  179196. return false;
  179197. }
  179198. var cornerPositionsScratch = [
  179199. new Cartesian3_default(),
  179200. new Cartesian3_default(),
  179201. new Cartesian3_default(),
  179202. new Cartesian3_default()
  179203. ];
  179204. function computeOccludeePoint(tileProvider, center, rectangle, minimumHeight, maximumHeight, result) {
  179205. const ellipsoidalOccluder = tileProvider.quadtree._occluders.ellipsoid;
  179206. const ellipsoid = ellipsoidalOccluder.ellipsoid;
  179207. const cornerPositions = cornerPositionsScratch;
  179208. Cartesian3_default.fromRadians(
  179209. rectangle.west,
  179210. rectangle.south,
  179211. maximumHeight,
  179212. ellipsoid,
  179213. cornerPositions[0]
  179214. );
  179215. Cartesian3_default.fromRadians(
  179216. rectangle.east,
  179217. rectangle.south,
  179218. maximumHeight,
  179219. ellipsoid,
  179220. cornerPositions[1]
  179221. );
  179222. Cartesian3_default.fromRadians(
  179223. rectangle.west,
  179224. rectangle.north,
  179225. maximumHeight,
  179226. ellipsoid,
  179227. cornerPositions[2]
  179228. );
  179229. Cartesian3_default.fromRadians(
  179230. rectangle.east,
  179231. rectangle.north,
  179232. maximumHeight,
  179233. ellipsoid,
  179234. cornerPositions[3]
  179235. );
  179236. return ellipsoidalOccluder.computeHorizonCullingPointPossiblyUnderEllipsoid(
  179237. center,
  179238. cornerPositions,
  179239. minimumHeight,
  179240. result
  179241. );
  179242. }
  179243. var TerrainFillMesh_default = TerrainFillMesh;
  179244. // node_modules/cesium/Source/Scene/GlobeSurfaceTileProvider.js
  179245. function GlobeSurfaceTileProvider(options) {
  179246. if (!defined_default(options)) {
  179247. throw new DeveloperError_default("options is required.");
  179248. }
  179249. if (!defined_default(options.terrainProvider)) {
  179250. throw new DeveloperError_default("options.terrainProvider is required.");
  179251. } else if (!defined_default(options.imageryLayers)) {
  179252. throw new DeveloperError_default("options.imageryLayers is required.");
  179253. } else if (!defined_default(options.surfaceShaderSet)) {
  179254. throw new DeveloperError_default("options.surfaceShaderSet is required.");
  179255. }
  179256. this.lightingFadeOutDistance = 65e5;
  179257. this.lightingFadeInDistance = 9e6;
  179258. this.hasWaterMask = false;
  179259. this.oceanNormalMap = void 0;
  179260. this.zoomedOutOceanSpecularIntensity = 0.5;
  179261. this.enableLighting = false;
  179262. this.dynamicAtmosphereLighting = false;
  179263. this.dynamicAtmosphereLightingFromSun = false;
  179264. this.showGroundAtmosphere = false;
  179265. this.shadows = ShadowMode_default.RECEIVE_ONLY;
  179266. this.fillHighlightColor = void 0;
  179267. this.hueShift = 0;
  179268. this.saturationShift = 0;
  179269. this.brightnessShift = 0;
  179270. this.showSkirts = true;
  179271. this.backFaceCulling = true;
  179272. this.undergroundColor = void 0;
  179273. this.undergroundColorAlphaByDistance = void 0;
  179274. this.lambertDiffuseMultiplier = 0;
  179275. this.materialUniformMap = void 0;
  179276. this._materialUniformMap = void 0;
  179277. this._quadtree = void 0;
  179278. this._terrainProvider = options.terrainProvider;
  179279. this._imageryLayers = options.imageryLayers;
  179280. this._surfaceShaderSet = options.surfaceShaderSet;
  179281. this._renderState = void 0;
  179282. this._blendRenderState = void 0;
  179283. this._disableCullingRenderState = void 0;
  179284. this._disableCullingBlendRenderState = void 0;
  179285. this._errorEvent = new Event_default();
  179286. this._imageryLayers.layerAdded.addEventListener(
  179287. GlobeSurfaceTileProvider.prototype._onLayerAdded,
  179288. this
  179289. );
  179290. this._imageryLayers.layerRemoved.addEventListener(
  179291. GlobeSurfaceTileProvider.prototype._onLayerRemoved,
  179292. this
  179293. );
  179294. this._imageryLayers.layerMoved.addEventListener(
  179295. GlobeSurfaceTileProvider.prototype._onLayerMoved,
  179296. this
  179297. );
  179298. this._imageryLayers.layerShownOrHidden.addEventListener(
  179299. GlobeSurfaceTileProvider.prototype._onLayerShownOrHidden,
  179300. this
  179301. );
  179302. this._imageryLayersUpdatedEvent = new Event_default();
  179303. this._layerOrderChanged = false;
  179304. this._tilesToRenderByTextureCount = [];
  179305. this._drawCommands = [];
  179306. this._uniformMaps = [];
  179307. this._usedDrawCommands = 0;
  179308. this._vertexArraysToDestroy = [];
  179309. this._debug = {
  179310. wireframe: false,
  179311. boundingSphereTile: void 0
  179312. };
  179313. this._baseColor = void 0;
  179314. this._firstPassInitialColor = void 0;
  179315. this.baseColor = new Color_default(0, 0, 0.5, 1);
  179316. this._clippingPlanes = void 0;
  179317. this.cartographicLimitRectangle = Rectangle_default.clone(Rectangle_default.MAX_VALUE);
  179318. this._hasLoadedTilesThisFrame = false;
  179319. this._hasFillTilesThisFrame = false;
  179320. this._oldTerrainExaggeration = void 0;
  179321. this._oldTerrainExaggerationRelativeHeight = void 0;
  179322. }
  179323. Object.defineProperties(GlobeSurfaceTileProvider.prototype, {
  179324. baseColor: {
  179325. get: function() {
  179326. return this._baseColor;
  179327. },
  179328. set: function(value) {
  179329. if (!defined_default(value)) {
  179330. throw new DeveloperError_default("value is required.");
  179331. }
  179332. this._baseColor = value;
  179333. this._firstPassInitialColor = Cartesian4_default.fromColor(
  179334. value,
  179335. this._firstPassInitialColor
  179336. );
  179337. }
  179338. },
  179339. quadtree: {
  179340. get: function() {
  179341. return this._quadtree;
  179342. },
  179343. set: function(value) {
  179344. if (!defined_default(value)) {
  179345. throw new DeveloperError_default("value is required.");
  179346. }
  179347. this._quadtree = value;
  179348. }
  179349. },
  179350. ready: {
  179351. get: function() {
  179352. return this._terrainProvider.ready && (this._imageryLayers.length === 0 || this._imageryLayers.get(0).imageryProvider.ready);
  179353. }
  179354. },
  179355. tilingScheme: {
  179356. get: function() {
  179357. return this._terrainProvider.tilingScheme;
  179358. }
  179359. },
  179360. errorEvent: {
  179361. get: function() {
  179362. return this._errorEvent;
  179363. }
  179364. },
  179365. imageryLayersUpdatedEvent: {
  179366. get: function() {
  179367. return this._imageryLayersUpdatedEvent;
  179368. }
  179369. },
  179370. terrainProvider: {
  179371. get: function() {
  179372. return this._terrainProvider;
  179373. },
  179374. set: function(terrainProvider) {
  179375. if (this._terrainProvider === terrainProvider) {
  179376. return;
  179377. }
  179378. if (!defined_default(terrainProvider)) {
  179379. throw new DeveloperError_default("terrainProvider is required.");
  179380. }
  179381. this._terrainProvider = terrainProvider;
  179382. if (defined_default(this._quadtree)) {
  179383. this._quadtree.invalidateAllTiles();
  179384. }
  179385. }
  179386. },
  179387. clippingPlanes: {
  179388. get: function() {
  179389. return this._clippingPlanes;
  179390. },
  179391. set: function(value) {
  179392. ClippingPlaneCollection_default.setOwner(value, this, "_clippingPlanes");
  179393. }
  179394. }
  179395. });
  179396. function sortTileImageryByLayerIndex(a4, b) {
  179397. let aImagery = a4.loadingImagery;
  179398. if (!defined_default(aImagery)) {
  179399. aImagery = a4.readyImagery;
  179400. }
  179401. let bImagery = b.loadingImagery;
  179402. if (!defined_default(bImagery)) {
  179403. bImagery = b.readyImagery;
  179404. }
  179405. return aImagery.imageryLayer._layerIndex - bImagery.imageryLayer._layerIndex;
  179406. }
  179407. GlobeSurfaceTileProvider.prototype.update = function(frameState) {
  179408. this._imageryLayers._update();
  179409. };
  179410. function updateCredits(surface, frameState) {
  179411. const creditDisplay = frameState.creditDisplay;
  179412. if (surface._terrainProvider.ready && defined_default(surface._terrainProvider.credit)) {
  179413. creditDisplay.addCredit(surface._terrainProvider.credit);
  179414. }
  179415. const imageryLayers = surface._imageryLayers;
  179416. for (let i2 = 0, len = imageryLayers.length; i2 < len; ++i2) {
  179417. const imageryProvider = imageryLayers.get(i2).imageryProvider;
  179418. if (imageryProvider.ready && defined_default(imageryProvider.credit)) {
  179419. creditDisplay.addCredit(imageryProvider.credit);
  179420. }
  179421. }
  179422. }
  179423. GlobeSurfaceTileProvider.prototype.initialize = function(frameState) {
  179424. this._imageryLayers.queueReprojectionCommands(frameState);
  179425. if (this._layerOrderChanged) {
  179426. this._layerOrderChanged = false;
  179427. this._quadtree.forEachLoadedTile(function(tile) {
  179428. tile.data.imagery.sort(sortTileImageryByLayerIndex);
  179429. });
  179430. }
  179431. updateCredits(this, frameState);
  179432. const vertexArraysToDestroy = this._vertexArraysToDestroy;
  179433. const length3 = vertexArraysToDestroy.length;
  179434. for (let j = 0; j < length3; ++j) {
  179435. GlobeSurfaceTile_default._freeVertexArray(vertexArraysToDestroy[j]);
  179436. }
  179437. vertexArraysToDestroy.length = 0;
  179438. };
  179439. GlobeSurfaceTileProvider.prototype.beginUpdate = function(frameState) {
  179440. const tilesToRenderByTextureCount = this._tilesToRenderByTextureCount;
  179441. for (let i2 = 0, len = tilesToRenderByTextureCount.length; i2 < len; ++i2) {
  179442. const tiles = tilesToRenderByTextureCount[i2];
  179443. if (defined_default(tiles)) {
  179444. tiles.length = 0;
  179445. }
  179446. }
  179447. const clippingPlanes = this._clippingPlanes;
  179448. if (defined_default(clippingPlanes) && clippingPlanes.enabled) {
  179449. clippingPlanes.update(frameState);
  179450. }
  179451. this._usedDrawCommands = 0;
  179452. this._hasLoadedTilesThisFrame = false;
  179453. this._hasFillTilesThisFrame = false;
  179454. };
  179455. GlobeSurfaceTileProvider.prototype.endUpdate = function(frameState) {
  179456. if (!defined_default(this._renderState)) {
  179457. this._renderState = RenderState_default.fromCache({
  179458. cull: {
  179459. enabled: true
  179460. },
  179461. depthTest: {
  179462. enabled: true,
  179463. func: DepthFunction_default.LESS
  179464. }
  179465. });
  179466. this._blendRenderState = RenderState_default.fromCache({
  179467. cull: {
  179468. enabled: true
  179469. },
  179470. depthTest: {
  179471. enabled: true,
  179472. func: DepthFunction_default.LESS_OR_EQUAL
  179473. },
  179474. blending: BlendingState_default.ALPHA_BLEND
  179475. });
  179476. let rs = clone_default(this._renderState, true);
  179477. rs.cull.enabled = false;
  179478. this._disableCullingRenderState = RenderState_default.fromCache(rs);
  179479. rs = clone_default(this._blendRenderState, true);
  179480. rs.cull.enabled = false;
  179481. this._disableCullingBlendRenderState = RenderState_default.fromCache(rs);
  179482. }
  179483. if (this._hasFillTilesThisFrame && this._hasLoadedTilesThisFrame) {
  179484. TerrainFillMesh_default.updateFillTiles(
  179485. this,
  179486. this._quadtree._tilesToRender,
  179487. frameState,
  179488. this._vertexArraysToDestroy
  179489. );
  179490. }
  179491. const quadtree = this.quadtree;
  179492. const exaggeration = frameState.terrainExaggeration;
  179493. const exaggerationRelativeHeight = frameState.terrainExaggerationRelativeHeight;
  179494. const exaggerationChanged = this._oldTerrainExaggeration !== exaggeration || this._oldTerrainExaggerationRelativeHeight !== exaggerationRelativeHeight;
  179495. this._oldTerrainExaggeration = exaggeration;
  179496. this._oldTerrainExaggerationRelativeHeight = exaggerationRelativeHeight;
  179497. if (exaggerationChanged) {
  179498. quadtree.forEachLoadedTile(function(tile) {
  179499. const surfaceTile = tile.data;
  179500. surfaceTile.updateExaggeration(tile, frameState, quadtree);
  179501. });
  179502. }
  179503. const tilesToRenderByTextureCount = this._tilesToRenderByTextureCount;
  179504. for (let textureCountIndex = 0, textureCountLength = tilesToRenderByTextureCount.length; textureCountIndex < textureCountLength; ++textureCountIndex) {
  179505. const tilesToRender = tilesToRenderByTextureCount[textureCountIndex];
  179506. if (!defined_default(tilesToRender)) {
  179507. continue;
  179508. }
  179509. for (let tileIndex = 0, tileLength = tilesToRender.length; tileIndex < tileLength; ++tileIndex) {
  179510. const tile = tilesToRender[tileIndex];
  179511. const tileBoundingRegion = tile.data.tileBoundingRegion;
  179512. addDrawCommandsForTile(this, tile, frameState);
  179513. frameState.minimumTerrainHeight = Math.min(
  179514. frameState.minimumTerrainHeight,
  179515. tileBoundingRegion.minimumHeight
  179516. );
  179517. }
  179518. }
  179519. };
  179520. function pushCommand(command, frameState) {
  179521. const globeTranslucencyState = frameState.globeTranslucencyState;
  179522. if (globeTranslucencyState.translucent) {
  179523. const isBlendCommand = command.renderState.blending.enabled;
  179524. globeTranslucencyState.pushDerivedCommands(
  179525. command,
  179526. isBlendCommand,
  179527. frameState
  179528. );
  179529. } else {
  179530. frameState.commandList.push(command);
  179531. }
  179532. }
  179533. GlobeSurfaceTileProvider.prototype.updateForPick = function(frameState) {
  179534. const drawCommands = this._drawCommands;
  179535. for (let i2 = 0, length3 = this._usedDrawCommands; i2 < length3; ++i2) {
  179536. pushCommand(drawCommands[i2], frameState);
  179537. }
  179538. };
  179539. GlobeSurfaceTileProvider.prototype.cancelReprojections = function() {
  179540. this._imageryLayers.cancelReprojections();
  179541. };
  179542. GlobeSurfaceTileProvider.prototype.getLevelMaximumGeometricError = function(level) {
  179543. return this._terrainProvider.getLevelMaximumGeometricError(level);
  179544. };
  179545. GlobeSurfaceTileProvider.prototype.loadTile = function(frameState, tile) {
  179546. let surfaceTile = tile.data;
  179547. let terrainOnly = true;
  179548. let terrainStateBefore;
  179549. if (defined_default(surfaceTile)) {
  179550. terrainOnly = surfaceTile.boundingVolumeSourceTile !== tile || tile._lastSelectionResult === TileSelectionResult_default.CULLED_BUT_NEEDED;
  179551. terrainStateBefore = surfaceTile.terrainState;
  179552. }
  179553. GlobeSurfaceTile_default.processStateMachine(
  179554. tile,
  179555. frameState,
  179556. this.terrainProvider,
  179557. this._imageryLayers,
  179558. this.quadtree,
  179559. this._vertexArraysToDestroy,
  179560. terrainOnly
  179561. );
  179562. surfaceTile = tile.data;
  179563. if (terrainOnly && terrainStateBefore !== tile.data.terrainState) {
  179564. if (this.computeTileVisibility(tile, frameState, this.quadtree.occluders) !== Visibility_default.NONE && surfaceTile.boundingVolumeSourceTile === tile) {
  179565. terrainOnly = false;
  179566. GlobeSurfaceTile_default.processStateMachine(
  179567. tile,
  179568. frameState,
  179569. this.terrainProvider,
  179570. this._imageryLayers,
  179571. this.quadtree,
  179572. this._vertexArraysToDestroy,
  179573. terrainOnly
  179574. );
  179575. }
  179576. }
  179577. };
  179578. var boundingSphereScratch3 = new BoundingSphere_default();
  179579. var rectangleIntersectionScratch = new Rectangle_default();
  179580. var splitCartographicLimitRectangleScratch = new Rectangle_default();
  179581. var rectangleCenterScratch4 = new Cartographic_default();
  179582. function clipRectangleAntimeridian(tileRectangle, cartographicLimitRectangle) {
  179583. if (cartographicLimitRectangle.west < cartographicLimitRectangle.east) {
  179584. return cartographicLimitRectangle;
  179585. }
  179586. const splitRectangle = Rectangle_default.clone(
  179587. cartographicLimitRectangle,
  179588. splitCartographicLimitRectangleScratch
  179589. );
  179590. const tileCenter = Rectangle_default.center(tileRectangle, rectangleCenterScratch4);
  179591. if (tileCenter.longitude > 0) {
  179592. splitRectangle.east = Math_default.PI;
  179593. } else {
  179594. splitRectangle.west = -Math_default.PI;
  179595. }
  179596. return splitRectangle;
  179597. }
  179598. function isUndergroundVisible(tileProvider, frameState) {
  179599. if (frameState.cameraUnderground) {
  179600. return true;
  179601. }
  179602. if (frameState.globeTranslucencyState.translucent) {
  179603. return true;
  179604. }
  179605. if (tileProvider.backFaceCulling) {
  179606. return false;
  179607. }
  179608. const clippingPlanes = tileProvider._clippingPlanes;
  179609. if (defined_default(clippingPlanes) && clippingPlanes.enabled) {
  179610. return true;
  179611. }
  179612. if (!Rectangle_default.equals(
  179613. tileProvider.cartographicLimitRectangle,
  179614. Rectangle_default.MAX_VALUE
  179615. )) {
  179616. return true;
  179617. }
  179618. return false;
  179619. }
  179620. GlobeSurfaceTileProvider.prototype.computeTileVisibility = function(tile, frameState, occluders) {
  179621. const distance2 = this.computeDistanceToTile(tile, frameState);
  179622. tile._distance = distance2;
  179623. const undergroundVisible = isUndergroundVisible(this, frameState);
  179624. if (frameState.fog.enabled && !undergroundVisible) {
  179625. if (Math_default.fog(distance2, frameState.fog.density) >= 1) {
  179626. return Visibility_default.NONE;
  179627. }
  179628. }
  179629. const surfaceTile = tile.data;
  179630. const tileBoundingRegion = surfaceTile.tileBoundingRegion;
  179631. if (surfaceTile.boundingVolumeSourceTile === void 0) {
  179632. return Visibility_default.PARTIAL;
  179633. }
  179634. const cullingVolume = frameState.cullingVolume;
  179635. let boundingVolume = tileBoundingRegion.boundingVolume;
  179636. if (!defined_default(boundingVolume)) {
  179637. boundingVolume = tileBoundingRegion.boundingSphere;
  179638. }
  179639. surfaceTile.clippedByBoundaries = false;
  179640. const clippedCartographicLimitRectangle = clipRectangleAntimeridian(
  179641. tile.rectangle,
  179642. this.cartographicLimitRectangle
  179643. );
  179644. const areaLimitIntersection = Rectangle_default.simpleIntersection(
  179645. clippedCartographicLimitRectangle,
  179646. tile.rectangle,
  179647. rectangleIntersectionScratch
  179648. );
  179649. if (!defined_default(areaLimitIntersection)) {
  179650. return Visibility_default.NONE;
  179651. }
  179652. if (!Rectangle_default.equals(areaLimitIntersection, tile.rectangle)) {
  179653. surfaceTile.clippedByBoundaries = true;
  179654. }
  179655. if (frameState.mode !== SceneMode_default.SCENE3D) {
  179656. boundingVolume = boundingSphereScratch3;
  179657. BoundingSphere_default.fromRectangleWithHeights2D(
  179658. tile.rectangle,
  179659. frameState.mapProjection,
  179660. tileBoundingRegion.minimumHeight,
  179661. tileBoundingRegion.maximumHeight,
  179662. boundingVolume
  179663. );
  179664. Cartesian3_default.fromElements(
  179665. boundingVolume.center.z,
  179666. boundingVolume.center.x,
  179667. boundingVolume.center.y,
  179668. boundingVolume.center
  179669. );
  179670. if (frameState.mode === SceneMode_default.MORPHING && defined_default(surfaceTile.renderedMesh)) {
  179671. boundingVolume = BoundingSphere_default.union(
  179672. tileBoundingRegion.boundingSphere,
  179673. boundingVolume,
  179674. boundingVolume
  179675. );
  179676. }
  179677. }
  179678. if (!defined_default(boundingVolume)) {
  179679. return Visibility_default.PARTIAL;
  179680. }
  179681. const clippingPlanes = this._clippingPlanes;
  179682. if (defined_default(clippingPlanes) && clippingPlanes.enabled) {
  179683. const planeIntersection = clippingPlanes.computeIntersectionWithBoundingVolume(
  179684. boundingVolume
  179685. );
  179686. tile.isClipped = planeIntersection !== Intersect_default.INSIDE;
  179687. if (planeIntersection === Intersect_default.OUTSIDE) {
  179688. return Visibility_default.NONE;
  179689. }
  179690. }
  179691. let visibility;
  179692. const intersection = cullingVolume.computeVisibility(boundingVolume);
  179693. if (intersection === Intersect_default.OUTSIDE) {
  179694. visibility = Visibility_default.NONE;
  179695. } else if (intersection === Intersect_default.INTERSECTING) {
  179696. visibility = Visibility_default.PARTIAL;
  179697. } else if (intersection === Intersect_default.INSIDE) {
  179698. visibility = Visibility_default.FULL;
  179699. }
  179700. if (visibility === Visibility_default.NONE) {
  179701. return visibility;
  179702. }
  179703. const ortho3D = frameState.mode === SceneMode_default.SCENE3D && frameState.camera.frustum instanceof OrthographicFrustum_default;
  179704. if (frameState.mode === SceneMode_default.SCENE3D && !ortho3D && defined_default(occluders) && !undergroundVisible) {
  179705. const occludeePointInScaledSpace = surfaceTile.occludeePointInScaledSpace;
  179706. if (!defined_default(occludeePointInScaledSpace)) {
  179707. return visibility;
  179708. }
  179709. if (occluders.ellipsoid.isScaledSpacePointVisiblePossiblyUnderEllipsoid(
  179710. occludeePointInScaledSpace,
  179711. tileBoundingRegion.minimumHeight
  179712. )) {
  179713. return visibility;
  179714. }
  179715. return Visibility_default.NONE;
  179716. }
  179717. return visibility;
  179718. };
  179719. GlobeSurfaceTileProvider.prototype.canRefine = function(tile) {
  179720. if (defined_default(tile.data.terrainData)) {
  179721. return true;
  179722. }
  179723. const childAvailable = this.terrainProvider.getTileDataAvailable(
  179724. tile.x * 2,
  179725. tile.y * 2,
  179726. tile.level + 1
  179727. );
  179728. return childAvailable !== void 0;
  179729. };
  179730. var readyImageryScratch = [];
  179731. var canRenderTraversalStack = [];
  179732. GlobeSurfaceTileProvider.prototype.canRenderWithoutLosingDetail = function(tile, frameState) {
  179733. const surfaceTile = tile.data;
  179734. const readyImagery = readyImageryScratch;
  179735. readyImagery.length = this._imageryLayers.length;
  179736. let terrainReady = false;
  179737. let initialImageryState = false;
  179738. let imagery;
  179739. if (defined_default(surfaceTile)) {
  179740. terrainReady = surfaceTile.terrainState === TerrainState_default.READY;
  179741. initialImageryState = true;
  179742. imagery = surfaceTile.imagery;
  179743. }
  179744. let i2;
  179745. let len;
  179746. for (i2 = 0, len = readyImagery.length; i2 < len; ++i2) {
  179747. readyImagery[i2] = initialImageryState;
  179748. }
  179749. if (defined_default(imagery)) {
  179750. for (i2 = 0, len = imagery.length; i2 < len; ++i2) {
  179751. const tileImagery = imagery[i2];
  179752. const loadingImagery = tileImagery.loadingImagery;
  179753. const isReady = !defined_default(loadingImagery) || loadingImagery.state === ImageryState_default.FAILED || loadingImagery.state === ImageryState_default.INVALID;
  179754. const layerIndex = (tileImagery.loadingImagery || tileImagery.readyImagery).imageryLayer._layerIndex;
  179755. readyImagery[layerIndex] = isReady && readyImagery[layerIndex];
  179756. }
  179757. }
  179758. const lastFrame = this.quadtree._lastSelectionFrameNumber;
  179759. const stack = canRenderTraversalStack;
  179760. stack.length = 0;
  179761. stack.push(
  179762. tile.southwestChild,
  179763. tile.southeastChild,
  179764. tile.northwestChild,
  179765. tile.northeastChild
  179766. );
  179767. while (stack.length > 0) {
  179768. const descendant = stack.pop();
  179769. const lastFrameSelectionResult = descendant._lastSelectionResultFrame === lastFrame ? descendant._lastSelectionResult : TileSelectionResult_default.NONE;
  179770. if (lastFrameSelectionResult === TileSelectionResult_default.RENDERED) {
  179771. const descendantSurface = descendant.data;
  179772. if (!defined_default(descendantSurface)) {
  179773. continue;
  179774. }
  179775. if (!terrainReady && descendant.data.terrainState === TerrainState_default.READY) {
  179776. return false;
  179777. }
  179778. const descendantImagery = descendant.data.imagery;
  179779. for (i2 = 0, len = descendantImagery.length; i2 < len; ++i2) {
  179780. const descendantTileImagery = descendantImagery[i2];
  179781. const descendantLoadingImagery = descendantTileImagery.loadingImagery;
  179782. const descendantIsReady = !defined_default(descendantLoadingImagery) || descendantLoadingImagery.state === ImageryState_default.FAILED || descendantLoadingImagery.state === ImageryState_default.INVALID;
  179783. const descendantLayerIndex = (descendantTileImagery.loadingImagery || descendantTileImagery.readyImagery).imageryLayer._layerIndex;
  179784. if (descendantIsReady && !readyImagery[descendantLayerIndex]) {
  179785. return false;
  179786. }
  179787. }
  179788. } else if (lastFrameSelectionResult === TileSelectionResult_default.REFINED) {
  179789. stack.push(
  179790. descendant.southwestChild,
  179791. descendant.southeastChild,
  179792. descendant.northwestChild,
  179793. descendant.northeastChild
  179794. );
  179795. }
  179796. }
  179797. return true;
  179798. };
  179799. var tileDirectionScratch = new Cartesian3_default();
  179800. GlobeSurfaceTileProvider.prototype.computeTileLoadPriority = function(tile, frameState) {
  179801. const surfaceTile = tile.data;
  179802. if (surfaceTile === void 0) {
  179803. return 0;
  179804. }
  179805. const obb = surfaceTile.tileBoundingRegion.boundingVolume;
  179806. if (obb === void 0) {
  179807. return 0;
  179808. }
  179809. const cameraPosition = frameState.camera.positionWC;
  179810. const cameraDirection = frameState.camera.directionWC;
  179811. const tileDirection = Cartesian3_default.subtract(
  179812. obb.center,
  179813. cameraPosition,
  179814. tileDirectionScratch
  179815. );
  179816. const magnitude = Cartesian3_default.magnitude(tileDirection);
  179817. if (magnitude < Math_default.EPSILON5) {
  179818. return 0;
  179819. }
  179820. Cartesian3_default.divideByScalar(tileDirection, magnitude, tileDirection);
  179821. return (1 - Cartesian3_default.dot(tileDirection, cameraDirection)) * tile._distance;
  179822. };
  179823. var modifiedModelViewScratch5 = new Matrix4_default();
  179824. var modifiedModelViewProjectionScratch = new Matrix4_default();
  179825. var tileRectangleScratch = new Cartesian4_default();
  179826. var localizedCartographicLimitRectangleScratch = new Cartesian4_default();
  179827. var localizedTranslucencyRectangleScratch = new Cartesian4_default();
  179828. var rtcScratch5 = new Cartesian3_default();
  179829. var centerEyeScratch = new Cartesian3_default();
  179830. var southwestScratch = new Cartesian3_default();
  179831. var northeastScratch = new Cartesian3_default();
  179832. GlobeSurfaceTileProvider.prototype.showTileThisFrame = function(tile, frameState) {
  179833. let readyTextureCount = 0;
  179834. const tileImageryCollection = tile.data.imagery;
  179835. for (let i2 = 0, len = tileImageryCollection.length; i2 < len; ++i2) {
  179836. const tileImagery = tileImageryCollection[i2];
  179837. if (defined_default(tileImagery.readyImagery) && tileImagery.readyImagery.imageryLayer.alpha !== 0) {
  179838. ++readyTextureCount;
  179839. }
  179840. }
  179841. let tileSet = this._tilesToRenderByTextureCount[readyTextureCount];
  179842. if (!defined_default(tileSet)) {
  179843. tileSet = [];
  179844. this._tilesToRenderByTextureCount[readyTextureCount] = tileSet;
  179845. }
  179846. tileSet.push(tile);
  179847. const surfaceTile = tile.data;
  179848. if (!defined_default(surfaceTile.vertexArray)) {
  179849. this._hasFillTilesThisFrame = true;
  179850. } else {
  179851. this._hasLoadedTilesThisFrame = true;
  179852. }
  179853. const debug = this._debug;
  179854. ++debug.tilesRendered;
  179855. debug.texturesRendered += readyTextureCount;
  179856. };
  179857. var cornerPositionsScratch2 = [
  179858. new Cartesian3_default(),
  179859. new Cartesian3_default(),
  179860. new Cartesian3_default(),
  179861. new Cartesian3_default()
  179862. ];
  179863. function computeOccludeePoint2(tileProvider, center, rectangle, minimumHeight, maximumHeight, result) {
  179864. const ellipsoidalOccluder = tileProvider.quadtree._occluders.ellipsoid;
  179865. const ellipsoid = ellipsoidalOccluder.ellipsoid;
  179866. const cornerPositions = cornerPositionsScratch2;
  179867. Cartesian3_default.fromRadians(
  179868. rectangle.west,
  179869. rectangle.south,
  179870. maximumHeight,
  179871. ellipsoid,
  179872. cornerPositions[0]
  179873. );
  179874. Cartesian3_default.fromRadians(
  179875. rectangle.east,
  179876. rectangle.south,
  179877. maximumHeight,
  179878. ellipsoid,
  179879. cornerPositions[1]
  179880. );
  179881. Cartesian3_default.fromRadians(
  179882. rectangle.west,
  179883. rectangle.north,
  179884. maximumHeight,
  179885. ellipsoid,
  179886. cornerPositions[2]
  179887. );
  179888. Cartesian3_default.fromRadians(
  179889. rectangle.east,
  179890. rectangle.north,
  179891. maximumHeight,
  179892. ellipsoid,
  179893. cornerPositions[3]
  179894. );
  179895. return ellipsoidalOccluder.computeHorizonCullingPointPossiblyUnderEllipsoid(
  179896. center,
  179897. cornerPositions,
  179898. minimumHeight,
  179899. result
  179900. );
  179901. }
  179902. GlobeSurfaceTileProvider.prototype.computeDistanceToTile = function(tile, frameState) {
  179903. updateTileBoundingRegion(tile, this, frameState);
  179904. const surfaceTile = tile.data;
  179905. const boundingVolumeSourceTile = surfaceTile.boundingVolumeSourceTile;
  179906. if (boundingVolumeSourceTile === void 0) {
  179907. return 9999999999;
  179908. }
  179909. const tileBoundingRegion = surfaceTile.tileBoundingRegion;
  179910. const min3 = tileBoundingRegion.minimumHeight;
  179911. const max3 = tileBoundingRegion.maximumHeight;
  179912. if (surfaceTile.boundingVolumeSourceTile !== tile) {
  179913. const cameraHeight = frameState.camera.positionCartographic.height;
  179914. const distanceToMin = Math.abs(cameraHeight - min3);
  179915. const distanceToMax = Math.abs(cameraHeight - max3);
  179916. if (distanceToMin > distanceToMax) {
  179917. tileBoundingRegion.minimumHeight = min3;
  179918. tileBoundingRegion.maximumHeight = min3;
  179919. } else {
  179920. tileBoundingRegion.minimumHeight = max3;
  179921. tileBoundingRegion.maximumHeight = max3;
  179922. }
  179923. }
  179924. const result = tileBoundingRegion.distanceToCamera(frameState);
  179925. tileBoundingRegion.minimumHeight = min3;
  179926. tileBoundingRegion.maximumHeight = max3;
  179927. return result;
  179928. };
  179929. function updateTileBoundingRegion(tile, tileProvider, frameState) {
  179930. let surfaceTile = tile.data;
  179931. if (surfaceTile === void 0) {
  179932. surfaceTile = tile.data = new GlobeSurfaceTile_default();
  179933. }
  179934. const ellipsoid = tile.tilingScheme.ellipsoid;
  179935. if (surfaceTile.tileBoundingRegion === void 0) {
  179936. surfaceTile.tileBoundingRegion = new TileBoundingRegion_default({
  179937. computeBoundingVolumes: false,
  179938. rectangle: tile.rectangle,
  179939. ellipsoid,
  179940. minimumHeight: 0,
  179941. maximumHeight: 0
  179942. });
  179943. }
  179944. const tileBoundingRegion = surfaceTile.tileBoundingRegion;
  179945. const oldMinimumHeight = tileBoundingRegion.minimumHeight;
  179946. const oldMaximumHeight = tileBoundingRegion.maximumHeight;
  179947. let hasBoundingVolumesFromMesh = false;
  179948. let sourceTile = tile;
  179949. const mesh2 = surfaceTile.mesh;
  179950. const terrainData = surfaceTile.terrainData;
  179951. if (mesh2 !== void 0 && mesh2.minimumHeight !== void 0 && mesh2.maximumHeight !== void 0) {
  179952. tileBoundingRegion.minimumHeight = mesh2.minimumHeight;
  179953. tileBoundingRegion.maximumHeight = mesh2.maximumHeight;
  179954. hasBoundingVolumesFromMesh = true;
  179955. } else if (terrainData !== void 0 && terrainData._minimumHeight !== void 0 && terrainData._maximumHeight !== void 0) {
  179956. tileBoundingRegion.minimumHeight = terrainData._minimumHeight;
  179957. tileBoundingRegion.maximumHeight = terrainData._maximumHeight;
  179958. } else {
  179959. tileBoundingRegion.minimumHeight = Number.NaN;
  179960. tileBoundingRegion.maximumHeight = Number.NaN;
  179961. let ancestorTile = tile.parent;
  179962. while (ancestorTile !== void 0) {
  179963. const ancestorSurfaceTile = ancestorTile.data;
  179964. if (ancestorSurfaceTile !== void 0) {
  179965. const ancestorMesh = ancestorSurfaceTile.mesh;
  179966. const ancestorTerrainData = ancestorSurfaceTile.terrainData;
  179967. if (ancestorMesh !== void 0 && ancestorMesh.minimumHeight !== void 0 && ancestorMesh.maximumHeight !== void 0) {
  179968. tileBoundingRegion.minimumHeight = ancestorMesh.minimumHeight;
  179969. tileBoundingRegion.maximumHeight = ancestorMesh.maximumHeight;
  179970. break;
  179971. } else if (ancestorTerrainData !== void 0 && ancestorTerrainData._minimumHeight !== void 0 && ancestorTerrainData._maximumHeight !== void 0) {
  179972. tileBoundingRegion.minimumHeight = ancestorTerrainData._minimumHeight;
  179973. tileBoundingRegion.maximumHeight = ancestorTerrainData._maximumHeight;
  179974. break;
  179975. }
  179976. }
  179977. ancestorTile = ancestorTile.parent;
  179978. }
  179979. sourceTile = ancestorTile;
  179980. }
  179981. if (sourceTile !== void 0) {
  179982. const exaggeration = frameState.terrainExaggeration;
  179983. const exaggerationRelativeHeight = frameState.terrainExaggerationRelativeHeight;
  179984. const hasExaggeration = exaggeration !== 1;
  179985. if (hasExaggeration) {
  179986. hasBoundingVolumesFromMesh = false;
  179987. tileBoundingRegion.minimumHeight = TerrainExaggeration_default.getHeight(
  179988. tileBoundingRegion.minimumHeight,
  179989. exaggeration,
  179990. exaggerationRelativeHeight
  179991. );
  179992. tileBoundingRegion.maximumHeight = TerrainExaggeration_default.getHeight(
  179993. tileBoundingRegion.maximumHeight,
  179994. exaggeration,
  179995. exaggerationRelativeHeight
  179996. );
  179997. }
  179998. if (hasBoundingVolumesFromMesh) {
  179999. if (!surfaceTile.boundingVolumeIsFromMesh) {
  180000. tileBoundingRegion._orientedBoundingBox = OrientedBoundingBox_default.clone(
  180001. mesh2.orientedBoundingBox,
  180002. tileBoundingRegion._orientedBoundingBox
  180003. );
  180004. tileBoundingRegion._boundingSphere = BoundingSphere_default.clone(
  180005. mesh2.boundingSphere3D,
  180006. tileBoundingRegion._boundingSphere
  180007. );
  180008. surfaceTile.occludeePointInScaledSpace = Cartesian3_default.clone(
  180009. mesh2.occludeePointInScaledSpace,
  180010. surfaceTile.occludeePointInScaledSpace
  180011. );
  180012. if (!defined_default(surfaceTile.occludeePointInScaledSpace)) {
  180013. surfaceTile.occludeePointInScaledSpace = computeOccludeePoint2(
  180014. tileProvider,
  180015. tileBoundingRegion._orientedBoundingBox.center,
  180016. tile.rectangle,
  180017. tileBoundingRegion.minimumHeight,
  180018. tileBoundingRegion.maximumHeight,
  180019. surfaceTile.occludeePointInScaledSpace
  180020. );
  180021. }
  180022. }
  180023. } else {
  180024. const needsBounds = tileBoundingRegion._orientedBoundingBox === void 0 || tileBoundingRegion._boundingSphere === void 0;
  180025. const heightChanged = tileBoundingRegion.minimumHeight !== oldMinimumHeight || tileBoundingRegion.maximumHeight !== oldMaximumHeight;
  180026. if (heightChanged || needsBounds) {
  180027. tileBoundingRegion.computeBoundingVolumes(ellipsoid);
  180028. surfaceTile.occludeePointInScaledSpace = computeOccludeePoint2(
  180029. tileProvider,
  180030. tileBoundingRegion._orientedBoundingBox.center,
  180031. tile.rectangle,
  180032. tileBoundingRegion.minimumHeight,
  180033. tileBoundingRegion.maximumHeight,
  180034. surfaceTile.occludeePointInScaledSpace
  180035. );
  180036. }
  180037. }
  180038. surfaceTile.boundingVolumeSourceTile = sourceTile;
  180039. surfaceTile.boundingVolumeIsFromMesh = hasBoundingVolumesFromMesh;
  180040. } else {
  180041. surfaceTile.boundingVolumeSourceTile = void 0;
  180042. surfaceTile.boundingVolumeIsFromMesh = false;
  180043. }
  180044. }
  180045. GlobeSurfaceTileProvider.prototype.isDestroyed = function() {
  180046. return false;
  180047. };
  180048. GlobeSurfaceTileProvider.prototype.destroy = function() {
  180049. this._tileProvider = this._tileProvider && this._tileProvider.destroy();
  180050. this._clippingPlanes = this._clippingPlanes && this._clippingPlanes.destroy();
  180051. return destroyObject_default(this);
  180052. };
  180053. function getTileReadyCallback(tileImageriesToFree, layer, terrainProvider) {
  180054. return function(tile) {
  180055. let tileImagery;
  180056. let imagery;
  180057. let startIndex = -1;
  180058. const tileImageryCollection = tile.data.imagery;
  180059. const length3 = tileImageryCollection.length;
  180060. let i2;
  180061. for (i2 = 0; i2 < length3; ++i2) {
  180062. tileImagery = tileImageryCollection[i2];
  180063. imagery = defaultValue_default(
  180064. tileImagery.readyImagery,
  180065. tileImagery.loadingImagery
  180066. );
  180067. if (imagery.imageryLayer === layer) {
  180068. startIndex = i2;
  180069. break;
  180070. }
  180071. }
  180072. if (startIndex !== -1) {
  180073. const endIndex = startIndex + tileImageriesToFree;
  180074. tileImagery = tileImageryCollection[endIndex];
  180075. imagery = defined_default(tileImagery) ? defaultValue_default(tileImagery.readyImagery, tileImagery.loadingImagery) : void 0;
  180076. if (!defined_default(imagery) || imagery.imageryLayer !== layer) {
  180077. return !layer._createTileImagerySkeletons(
  180078. tile,
  180079. terrainProvider,
  180080. endIndex
  180081. );
  180082. }
  180083. for (i2 = startIndex; i2 < endIndex; ++i2) {
  180084. tileImageryCollection[i2].freeResources();
  180085. }
  180086. tileImageryCollection.splice(startIndex, tileImageriesToFree);
  180087. }
  180088. return true;
  180089. };
  180090. }
  180091. GlobeSurfaceTileProvider.prototype._onLayerAdded = function(layer, index2) {
  180092. if (layer.show) {
  180093. const terrainProvider = this._terrainProvider;
  180094. const that = this;
  180095. const imageryProvider = layer.imageryProvider;
  180096. const tileImageryUpdatedEvent = this._imageryLayersUpdatedEvent;
  180097. imageryProvider._reload = function() {
  180098. layer._imageryCache = {};
  180099. that._quadtree.forEachLoadedTile(function(tile) {
  180100. if (defined_default(tile._loadedCallbacks[layer._layerIndex])) {
  180101. return;
  180102. }
  180103. let i2;
  180104. const tileImageryCollection = tile.data.imagery;
  180105. const length3 = tileImageryCollection.length;
  180106. let startIndex = -1;
  180107. let tileImageriesToFree = 0;
  180108. for (i2 = 0; i2 < length3; ++i2) {
  180109. const tileImagery = tileImageryCollection[i2];
  180110. const imagery = defaultValue_default(
  180111. tileImagery.readyImagery,
  180112. tileImagery.loadingImagery
  180113. );
  180114. if (imagery.imageryLayer === layer) {
  180115. if (startIndex === -1) {
  180116. startIndex = i2;
  180117. }
  180118. ++tileImageriesToFree;
  180119. } else if (startIndex !== -1) {
  180120. break;
  180121. }
  180122. }
  180123. if (startIndex === -1) {
  180124. return;
  180125. }
  180126. const insertionPoint = startIndex + tileImageriesToFree;
  180127. if (layer._createTileImagerySkeletons(
  180128. tile,
  180129. terrainProvider,
  180130. insertionPoint
  180131. )) {
  180132. tile._loadedCallbacks[layer._layerIndex] = getTileReadyCallback(
  180133. tileImageriesToFree,
  180134. layer,
  180135. terrainProvider
  180136. );
  180137. tile.state = QuadtreeTileLoadState_default.LOADING;
  180138. }
  180139. });
  180140. };
  180141. this._quadtree.forEachLoadedTile(function(tile) {
  180142. if (layer._createTileImagerySkeletons(tile, terrainProvider)) {
  180143. tile.state = QuadtreeTileLoadState_default.LOADING;
  180144. if (tile.level !== 0 && (tile._lastSelectionResultFrame !== that.quadtree._lastSelectionFrameNumber || tile._lastSelectionResult !== TileSelectionResult_default.RENDERED)) {
  180145. tile.renderable = false;
  180146. }
  180147. }
  180148. });
  180149. this._layerOrderChanged = true;
  180150. tileImageryUpdatedEvent.raiseEvent();
  180151. }
  180152. };
  180153. GlobeSurfaceTileProvider.prototype._onLayerRemoved = function(layer, index2) {
  180154. this._quadtree.forEachLoadedTile(function(tile) {
  180155. const tileImageryCollection = tile.data.imagery;
  180156. let startIndex = -1;
  180157. let numDestroyed = 0;
  180158. for (let i2 = 0, len = tileImageryCollection.length; i2 < len; ++i2) {
  180159. const tileImagery = tileImageryCollection[i2];
  180160. let imagery = tileImagery.loadingImagery;
  180161. if (!defined_default(imagery)) {
  180162. imagery = tileImagery.readyImagery;
  180163. }
  180164. if (imagery.imageryLayer === layer) {
  180165. if (startIndex === -1) {
  180166. startIndex = i2;
  180167. }
  180168. tileImagery.freeResources();
  180169. ++numDestroyed;
  180170. } else if (startIndex !== -1) {
  180171. break;
  180172. }
  180173. }
  180174. if (startIndex !== -1) {
  180175. tileImageryCollection.splice(startIndex, numDestroyed);
  180176. }
  180177. });
  180178. if (defined_default(layer.imageryProvider)) {
  180179. layer.imageryProvider._reload = void 0;
  180180. }
  180181. this._imageryLayersUpdatedEvent.raiseEvent();
  180182. };
  180183. GlobeSurfaceTileProvider.prototype._onLayerMoved = function(layer, newIndex, oldIndex) {
  180184. this._layerOrderChanged = true;
  180185. this._imageryLayersUpdatedEvent.raiseEvent();
  180186. };
  180187. GlobeSurfaceTileProvider.prototype._onLayerShownOrHidden = function(layer, index2, show) {
  180188. if (show) {
  180189. this._onLayerAdded(layer, index2);
  180190. } else {
  180191. this._onLayerRemoved(layer, index2);
  180192. }
  180193. };
  180194. var scratchClippingPlanesMatrix4 = new Matrix4_default();
  180195. var scratchInverseTransposeClippingPlanesMatrix2 = new Matrix4_default();
  180196. function createTileUniformMap(frameState, globeSurfaceTileProvider) {
  180197. const uniformMap2 = {
  180198. u_initialColor: function() {
  180199. return this.properties.initialColor;
  180200. },
  180201. u_fillHighlightColor: function() {
  180202. return this.properties.fillHighlightColor;
  180203. },
  180204. u_zoomedOutOceanSpecularIntensity: function() {
  180205. return this.properties.zoomedOutOceanSpecularIntensity;
  180206. },
  180207. u_oceanNormalMap: function() {
  180208. return this.properties.oceanNormalMap;
  180209. },
  180210. u_atmosphereLightIntensity: function() {
  180211. return this.properties.atmosphereLightIntensity;
  180212. },
  180213. u_atmosphereRayleighCoefficient: function() {
  180214. return this.properties.atmosphereRayleighCoefficient;
  180215. },
  180216. u_atmosphereMieCoefficient: function() {
  180217. return this.properties.atmosphereMieCoefficient;
  180218. },
  180219. u_atmosphereRayleighScaleHeight: function() {
  180220. return this.properties.atmosphereRayleighScaleHeight;
  180221. },
  180222. u_atmosphereMieScaleHeight: function() {
  180223. return this.properties.atmosphereMieScaleHeight;
  180224. },
  180225. u_atmosphereMieAnisotropy: function() {
  180226. return this.properties.atmosphereMieAnisotropy;
  180227. },
  180228. u_lightingFadeDistance: function() {
  180229. return this.properties.lightingFadeDistance;
  180230. },
  180231. u_nightFadeDistance: function() {
  180232. return this.properties.nightFadeDistance;
  180233. },
  180234. u_center3D: function() {
  180235. return this.properties.center3D;
  180236. },
  180237. u_terrainExaggerationAndRelativeHeight: function() {
  180238. return this.properties.terrainExaggerationAndRelativeHeight;
  180239. },
  180240. u_tileRectangle: function() {
  180241. return this.properties.tileRectangle;
  180242. },
  180243. u_modifiedModelView: function() {
  180244. const viewMatrix = frameState.context.uniformState.view;
  180245. const centerEye = Matrix4_default.multiplyByPoint(
  180246. viewMatrix,
  180247. this.properties.rtc,
  180248. centerEyeScratch
  180249. );
  180250. Matrix4_default.setTranslation(viewMatrix, centerEye, modifiedModelViewScratch5);
  180251. return modifiedModelViewScratch5;
  180252. },
  180253. u_modifiedModelViewProjection: function() {
  180254. const viewMatrix = frameState.context.uniformState.view;
  180255. const projectionMatrix = frameState.context.uniformState.projection;
  180256. const centerEye = Matrix4_default.multiplyByPoint(
  180257. viewMatrix,
  180258. this.properties.rtc,
  180259. centerEyeScratch
  180260. );
  180261. Matrix4_default.setTranslation(
  180262. viewMatrix,
  180263. centerEye,
  180264. modifiedModelViewProjectionScratch
  180265. );
  180266. Matrix4_default.multiply(
  180267. projectionMatrix,
  180268. modifiedModelViewProjectionScratch,
  180269. modifiedModelViewProjectionScratch
  180270. );
  180271. return modifiedModelViewProjectionScratch;
  180272. },
  180273. u_dayTextures: function() {
  180274. return this.properties.dayTextures;
  180275. },
  180276. u_dayTextureTranslationAndScale: function() {
  180277. return this.properties.dayTextureTranslationAndScale;
  180278. },
  180279. u_dayTextureTexCoordsRectangle: function() {
  180280. return this.properties.dayTextureTexCoordsRectangle;
  180281. },
  180282. u_dayTextureUseWebMercatorT: function() {
  180283. return this.properties.dayTextureUseWebMercatorT;
  180284. },
  180285. u_dayTextureAlpha: function() {
  180286. return this.properties.dayTextureAlpha;
  180287. },
  180288. u_dayTextureNightAlpha: function() {
  180289. return this.properties.dayTextureNightAlpha;
  180290. },
  180291. u_dayTextureDayAlpha: function() {
  180292. return this.properties.dayTextureDayAlpha;
  180293. },
  180294. u_dayTextureBrightness: function() {
  180295. return this.properties.dayTextureBrightness;
  180296. },
  180297. u_dayTextureContrast: function() {
  180298. return this.properties.dayTextureContrast;
  180299. },
  180300. u_dayTextureHue: function() {
  180301. return this.properties.dayTextureHue;
  180302. },
  180303. u_dayTextureSaturation: function() {
  180304. return this.properties.dayTextureSaturation;
  180305. },
  180306. u_dayTextureOneOverGamma: function() {
  180307. return this.properties.dayTextureOneOverGamma;
  180308. },
  180309. u_dayIntensity: function() {
  180310. return this.properties.dayIntensity;
  180311. },
  180312. u_southAndNorthLatitude: function() {
  180313. return this.properties.southAndNorthLatitude;
  180314. },
  180315. u_southMercatorYAndOneOverHeight: function() {
  180316. return this.properties.southMercatorYAndOneOverHeight;
  180317. },
  180318. u_waterMask: function() {
  180319. return this.properties.waterMask;
  180320. },
  180321. u_waterMaskTranslationAndScale: function() {
  180322. return this.properties.waterMaskTranslationAndScale;
  180323. },
  180324. u_minMaxHeight: function() {
  180325. return this.properties.minMaxHeight;
  180326. },
  180327. u_scaleAndBias: function() {
  180328. return this.properties.scaleAndBias;
  180329. },
  180330. u_dayTextureSplit: function() {
  180331. return this.properties.dayTextureSplit;
  180332. },
  180333. u_dayTextureCutoutRectangles: function() {
  180334. return this.properties.dayTextureCutoutRectangles;
  180335. },
  180336. u_clippingPlanes: function() {
  180337. const clippingPlanes = globeSurfaceTileProvider._clippingPlanes;
  180338. if (defined_default(clippingPlanes) && defined_default(clippingPlanes.texture)) {
  180339. return clippingPlanes.texture;
  180340. }
  180341. return frameState.context.defaultTexture;
  180342. },
  180343. u_cartographicLimitRectangle: function() {
  180344. return this.properties.localizedCartographicLimitRectangle;
  180345. },
  180346. u_clippingPlanesMatrix: function() {
  180347. const clippingPlanes = globeSurfaceTileProvider._clippingPlanes;
  180348. const transform4 = defined_default(clippingPlanes) ? Matrix4_default.multiply(
  180349. frameState.context.uniformState.view,
  180350. clippingPlanes.modelMatrix,
  180351. scratchClippingPlanesMatrix4
  180352. ) : Matrix4_default.IDENTITY;
  180353. return Matrix4_default.inverseTranspose(
  180354. transform4,
  180355. scratchInverseTransposeClippingPlanesMatrix2
  180356. );
  180357. },
  180358. u_clippingPlanesEdgeStyle: function() {
  180359. const style = this.properties.clippingPlanesEdgeColor;
  180360. style.alpha = this.properties.clippingPlanesEdgeWidth;
  180361. return style;
  180362. },
  180363. u_minimumBrightness: function() {
  180364. return frameState.fog.minimumBrightness;
  180365. },
  180366. u_hsbShift: function() {
  180367. return this.properties.hsbShift;
  180368. },
  180369. u_colorsToAlpha: function() {
  180370. return this.properties.colorsToAlpha;
  180371. },
  180372. u_frontFaceAlphaByDistance: function() {
  180373. return this.properties.frontFaceAlphaByDistance;
  180374. },
  180375. u_backFaceAlphaByDistance: function() {
  180376. return this.properties.backFaceAlphaByDistance;
  180377. },
  180378. u_translucencyRectangle: function() {
  180379. return this.properties.localizedTranslucencyRectangle;
  180380. },
  180381. u_undergroundColor: function() {
  180382. return this.properties.undergroundColor;
  180383. },
  180384. u_undergroundColorAlphaByDistance: function() {
  180385. return this.properties.undergroundColorAlphaByDistance;
  180386. },
  180387. u_lambertDiffuseMultiplier: function() {
  180388. return this.properties.lambertDiffuseMultiplier;
  180389. },
  180390. properties: {
  180391. initialColor: new Cartesian4_default(0, 0, 0.5, 1),
  180392. fillHighlightColor: new Color_default(0, 0, 0, 0),
  180393. zoomedOutOceanSpecularIntensity: 0.5,
  180394. oceanNormalMap: void 0,
  180395. lightingFadeDistance: new Cartesian2_default(65e5, 9e6),
  180396. nightFadeDistance: new Cartesian2_default(1e7, 4e7),
  180397. atmosphereLightIntensity: 10,
  180398. atmosphereRayleighCoefficient: new Cartesian3_default(55e-7, 13e-6, 284e-7),
  180399. atmosphereMieCoefficient: new Cartesian3_default(21e-6, 21e-6, 21e-6),
  180400. atmosphereRayleighScaleHeight: 1e4,
  180401. atmosphereMieScaleHeight: 3200,
  180402. atmosphereMieAnisotropy: 0.9,
  180403. hsbShift: new Cartesian3_default(),
  180404. center3D: void 0,
  180405. rtc: new Cartesian3_default(),
  180406. modifiedModelView: new Matrix4_default(),
  180407. tileRectangle: new Cartesian4_default(),
  180408. terrainExaggerationAndRelativeHeight: new Cartesian2_default(1, 0),
  180409. dayTextures: [],
  180410. dayTextureTranslationAndScale: [],
  180411. dayTextureTexCoordsRectangle: [],
  180412. dayTextureUseWebMercatorT: [],
  180413. dayTextureAlpha: [],
  180414. dayTextureNightAlpha: [],
  180415. dayTextureDayAlpha: [],
  180416. dayTextureBrightness: [],
  180417. dayTextureContrast: [],
  180418. dayTextureHue: [],
  180419. dayTextureSaturation: [],
  180420. dayTextureOneOverGamma: [],
  180421. dayTextureSplit: [],
  180422. dayTextureCutoutRectangles: [],
  180423. dayIntensity: 0,
  180424. colorsToAlpha: [],
  180425. southAndNorthLatitude: new Cartesian2_default(),
  180426. southMercatorYAndOneOverHeight: new Cartesian2_default(),
  180427. waterMask: void 0,
  180428. waterMaskTranslationAndScale: new Cartesian4_default(),
  180429. minMaxHeight: new Cartesian2_default(),
  180430. scaleAndBias: new Matrix4_default(),
  180431. clippingPlanesEdgeColor: Color_default.clone(Color_default.WHITE),
  180432. clippingPlanesEdgeWidth: 0,
  180433. localizedCartographicLimitRectangle: new Cartesian4_default(),
  180434. frontFaceAlphaByDistance: new Cartesian4_default(),
  180435. backFaceAlphaByDistance: new Cartesian4_default(),
  180436. localizedTranslucencyRectangle: new Cartesian4_default(),
  180437. undergroundColor: Color_default.clone(Color_default.TRANSPARENT),
  180438. undergroundColorAlphaByDistance: new Cartesian4_default(),
  180439. lambertDiffuseMultiplier: 0
  180440. }
  180441. };
  180442. if (defined_default(globeSurfaceTileProvider.materialUniformMap)) {
  180443. return combine_default(uniformMap2, globeSurfaceTileProvider.materialUniformMap);
  180444. }
  180445. return uniformMap2;
  180446. }
  180447. function createWireframeVertexArrayIfNecessary(context, provider, tile) {
  180448. const surfaceTile = tile.data;
  180449. let mesh2;
  180450. let vertexArray;
  180451. if (defined_default(surfaceTile.vertexArray)) {
  180452. mesh2 = surfaceTile.mesh;
  180453. vertexArray = surfaceTile.vertexArray;
  180454. } else if (defined_default(surfaceTile.fill) && defined_default(surfaceTile.fill.vertexArray)) {
  180455. mesh2 = surfaceTile.fill.mesh;
  180456. vertexArray = surfaceTile.fill.vertexArray;
  180457. }
  180458. if (!defined_default(mesh2) || !defined_default(vertexArray)) {
  180459. return;
  180460. }
  180461. if (defined_default(surfaceTile.wireframeVertexArray)) {
  180462. if (surfaceTile.wireframeVertexArray.mesh === mesh2) {
  180463. return;
  180464. }
  180465. surfaceTile.wireframeVertexArray.destroy();
  180466. surfaceTile.wireframeVertexArray = void 0;
  180467. }
  180468. surfaceTile.wireframeVertexArray = createWireframeVertexArray(
  180469. context,
  180470. vertexArray,
  180471. mesh2
  180472. );
  180473. surfaceTile.wireframeVertexArray.mesh = mesh2;
  180474. }
  180475. function createWireframeVertexArray(context, vertexArray, terrainMesh) {
  180476. const indices2 = terrainMesh.indices;
  180477. const geometry = {
  180478. indices: indices2,
  180479. primitiveType: PrimitiveType_default.TRIANGLES
  180480. };
  180481. GeometryPipeline_default.toWireframe(geometry);
  180482. const wireframeIndices = geometry.indices;
  180483. const wireframeIndexBuffer = Buffer_default.createIndexBuffer({
  180484. context,
  180485. typedArray: wireframeIndices,
  180486. usage: BufferUsage_default.STATIC_DRAW,
  180487. indexDatatype: IndexDatatype_default.fromSizeInBytes(
  180488. wireframeIndices.BYTES_PER_ELEMENT
  180489. )
  180490. });
  180491. return new VertexArray_default({
  180492. context,
  180493. attributes: vertexArray._attributes,
  180494. indexBuffer: wireframeIndexBuffer
  180495. });
  180496. }
  180497. var getDebugOrientedBoundingBox;
  180498. var getDebugBoundingSphere;
  180499. var debugDestroyPrimitive;
  180500. (function() {
  180501. const instanceOBB = new GeometryInstance_default({
  180502. geometry: BoxOutlineGeometry_default.fromDimensions({
  180503. dimensions: new Cartesian3_default(2, 2, 2)
  180504. })
  180505. });
  180506. const instanceSphere = new GeometryInstance_default({
  180507. geometry: new SphereOutlineGeometry_default({ radius: 1 })
  180508. });
  180509. let modelMatrix = new Matrix4_default();
  180510. let previousVolume;
  180511. let primitive;
  180512. function createDebugPrimitive(instance) {
  180513. return new Primitive_default({
  180514. geometryInstances: instance,
  180515. appearance: new PerInstanceColorAppearance_default({
  180516. translucent: false,
  180517. flat: true
  180518. }),
  180519. asynchronous: false
  180520. });
  180521. }
  180522. getDebugOrientedBoundingBox = function(obb, color) {
  180523. if (obb === previousVolume) {
  180524. return primitive;
  180525. }
  180526. debugDestroyPrimitive();
  180527. previousVolume = obb;
  180528. modelMatrix = Matrix4_default.fromRotationTranslation(
  180529. obb.halfAxes,
  180530. obb.center,
  180531. modelMatrix
  180532. );
  180533. instanceOBB.modelMatrix = modelMatrix;
  180534. instanceOBB.attributes.color = ColorGeometryInstanceAttribute_default.fromColor(
  180535. color
  180536. );
  180537. primitive = createDebugPrimitive(instanceOBB);
  180538. return primitive;
  180539. };
  180540. getDebugBoundingSphere = function(sphere, color) {
  180541. if (sphere === previousVolume) {
  180542. return primitive;
  180543. }
  180544. debugDestroyPrimitive();
  180545. previousVolume = sphere;
  180546. modelMatrix = Matrix4_default.fromTranslation(sphere.center, modelMatrix);
  180547. modelMatrix = Matrix4_default.multiplyByUniformScale(
  180548. modelMatrix,
  180549. sphere.radius,
  180550. modelMatrix
  180551. );
  180552. instanceSphere.modelMatrix = modelMatrix;
  180553. instanceSphere.attributes.color = ColorGeometryInstanceAttribute_default.fromColor(
  180554. color
  180555. );
  180556. primitive = createDebugPrimitive(instanceSphere);
  180557. return primitive;
  180558. };
  180559. debugDestroyPrimitive = function() {
  180560. if (defined_default(primitive)) {
  180561. primitive.destroy();
  180562. primitive = void 0;
  180563. previousVolume = void 0;
  180564. }
  180565. };
  180566. })();
  180567. var otherPassesInitialColor = new Cartesian4_default(0, 0, 0, 0);
  180568. var surfaceShaderSetOptionsScratch = {
  180569. frameState: void 0,
  180570. surfaceTile: void 0,
  180571. numberOfDayTextures: void 0,
  180572. applyBrightness: void 0,
  180573. applyContrast: void 0,
  180574. applyHue: void 0,
  180575. applySaturation: void 0,
  180576. applyGamma: void 0,
  180577. applyAlpha: void 0,
  180578. applyDayNightAlpha: void 0,
  180579. applySplit: void 0,
  180580. showReflectiveOcean: void 0,
  180581. showOceanWaves: void 0,
  180582. enableLighting: void 0,
  180583. dynamicAtmosphereLighting: void 0,
  180584. dynamicAtmosphereLightingFromSun: void 0,
  180585. showGroundAtmosphere: void 0,
  180586. perFragmentGroundAtmosphere: void 0,
  180587. hasVertexNormals: void 0,
  180588. useWebMercatorProjection: void 0,
  180589. enableFog: void 0,
  180590. enableClippingPlanes: void 0,
  180591. clippingPlanes: void 0,
  180592. clippedByBoundaries: void 0,
  180593. hasImageryLayerCutout: void 0,
  180594. colorCorrect: void 0,
  180595. colorToAlpha: void 0,
  180596. hasGeodeticSurfaceNormals: void 0,
  180597. hasExaggeration: void 0
  180598. };
  180599. var defaultUndergroundColor = Color_default.TRANSPARENT;
  180600. var defaultUndergroundColorAlphaByDistance = new NearFarScalar_default();
  180601. function addDrawCommandsForTile(tileProvider, tile, frameState) {
  180602. const surfaceTile = tile.data;
  180603. if (!defined_default(surfaceTile.vertexArray)) {
  180604. if (surfaceTile.fill === void 0) {
  180605. surfaceTile.fill = new TerrainFillMesh_default(tile);
  180606. }
  180607. surfaceTile.fill.update(tileProvider, frameState);
  180608. }
  180609. const creditDisplay = frameState.creditDisplay;
  180610. const terrainData = surfaceTile.terrainData;
  180611. if (defined_default(terrainData) && defined_default(terrainData.credits)) {
  180612. const tileCredits = terrainData.credits;
  180613. for (let tileCreditIndex = 0, tileCreditLength = tileCredits.length; tileCreditIndex < tileCreditLength; ++tileCreditIndex) {
  180614. creditDisplay.addCredit(tileCredits[tileCreditIndex]);
  180615. }
  180616. }
  180617. let maxTextures = ContextLimits_default.maximumTextureImageUnits;
  180618. let waterMaskTexture = surfaceTile.waterMaskTexture;
  180619. let waterMaskTranslationAndScale = surfaceTile.waterMaskTranslationAndScale;
  180620. if (!defined_default(waterMaskTexture) && defined_default(surfaceTile.fill)) {
  180621. waterMaskTexture = surfaceTile.fill.waterMaskTexture;
  180622. waterMaskTranslationAndScale = surfaceTile.fill.waterMaskTranslationAndScale;
  180623. }
  180624. const cameraUnderground = frameState.cameraUnderground;
  180625. const globeTranslucencyState = frameState.globeTranslucencyState;
  180626. const translucent = globeTranslucencyState.translucent;
  180627. const frontFaceAlphaByDistance = globeTranslucencyState.frontFaceAlphaByDistance;
  180628. const backFaceAlphaByDistance = globeTranslucencyState.backFaceAlphaByDistance;
  180629. const translucencyRectangle = globeTranslucencyState.rectangle;
  180630. const undergroundColor = defaultValue_default(
  180631. tileProvider.undergroundColor,
  180632. defaultUndergroundColor
  180633. );
  180634. const undergroundColorAlphaByDistance = defaultValue_default(
  180635. tileProvider.undergroundColorAlphaByDistance,
  180636. defaultUndergroundColorAlphaByDistance
  180637. );
  180638. const showUndergroundColor = isUndergroundVisible(tileProvider, frameState) && frameState.mode === SceneMode_default.SCENE3D && undergroundColor.alpha > 0 && (undergroundColorAlphaByDistance.nearValue > 0 || undergroundColorAlphaByDistance.farValue > 0);
  180639. const lambertDiffuseMultiplier = tileProvider.lambertDiffuseMultiplier;
  180640. const showReflectiveOcean = tileProvider.hasWaterMask && defined_default(waterMaskTexture);
  180641. const oceanNormalMap = tileProvider.oceanNormalMap;
  180642. const showOceanWaves = showReflectiveOcean && defined_default(oceanNormalMap);
  180643. const hasVertexNormals = tileProvider.terrainProvider.ready && tileProvider.terrainProvider.hasVertexNormals;
  180644. const enableFog = frameState.fog.enabled && frameState.fog.renderable && !cameraUnderground;
  180645. const showGroundAtmosphere = tileProvider.showGroundAtmosphere && frameState.mode === SceneMode_default.SCENE3D;
  180646. const castShadows = ShadowMode_default.castShadows(tileProvider.shadows) && !translucent;
  180647. const receiveShadows = ShadowMode_default.receiveShadows(tileProvider.shadows) && !translucent;
  180648. const hueShift = tileProvider.hueShift;
  180649. const saturationShift = tileProvider.saturationShift;
  180650. const brightnessShift = tileProvider.brightnessShift;
  180651. let colorCorrect = !(Math_default.equalsEpsilon(hueShift, 0, Math_default.EPSILON7) && Math_default.equalsEpsilon(saturationShift, 0, Math_default.EPSILON7) && Math_default.equalsEpsilon(brightnessShift, 0, Math_default.EPSILON7));
  180652. let perFragmentGroundAtmosphere = false;
  180653. if (showGroundAtmosphere) {
  180654. const cameraDistance = Cartesian3_default.magnitude(frameState.camera.positionWC);
  180655. const fadeOutDistance = tileProvider.nightFadeOutDistance;
  180656. perFragmentGroundAtmosphere = cameraDistance > fadeOutDistance;
  180657. }
  180658. if (showReflectiveOcean) {
  180659. --maxTextures;
  180660. }
  180661. if (showOceanWaves) {
  180662. --maxTextures;
  180663. }
  180664. if (defined_default(frameState.shadowState) && frameState.shadowState.shadowsEnabled) {
  180665. --maxTextures;
  180666. }
  180667. if (defined_default(tileProvider.clippingPlanes) && tileProvider.clippingPlanes.enabled) {
  180668. --maxTextures;
  180669. }
  180670. maxTextures -= globeTranslucencyState.numberOfTextureUniforms;
  180671. const mesh2 = surfaceTile.renderedMesh;
  180672. let rtc = mesh2.center;
  180673. const encoding = mesh2.encoding;
  180674. const tileBoundingRegion = surfaceTile.tileBoundingRegion;
  180675. const exaggeration = frameState.terrainExaggeration;
  180676. const exaggerationRelativeHeight = frameState.terrainExaggerationRelativeHeight;
  180677. const hasExaggeration = exaggeration !== 1;
  180678. const hasGeodeticSurfaceNormals = encoding.hasGeodeticSurfaceNormals;
  180679. const tileRectangle = tileRectangleScratch;
  180680. let southLatitude = 0;
  180681. let northLatitude = 0;
  180682. let southMercatorY = 0;
  180683. let oneOverMercatorHeight = 0;
  180684. let useWebMercatorProjection = false;
  180685. if (frameState.mode !== SceneMode_default.SCENE3D) {
  180686. const projection = frameState.mapProjection;
  180687. const southwest = projection.project(
  180688. Rectangle_default.southwest(tile.rectangle),
  180689. southwestScratch
  180690. );
  180691. const northeast = projection.project(
  180692. Rectangle_default.northeast(tile.rectangle),
  180693. northeastScratch
  180694. );
  180695. tileRectangle.x = southwest.x;
  180696. tileRectangle.y = southwest.y;
  180697. tileRectangle.z = northeast.x;
  180698. tileRectangle.w = northeast.y;
  180699. if (frameState.mode !== SceneMode_default.MORPHING) {
  180700. rtc = rtcScratch5;
  180701. rtc.x = 0;
  180702. rtc.y = (tileRectangle.z + tileRectangle.x) * 0.5;
  180703. rtc.z = (tileRectangle.w + tileRectangle.y) * 0.5;
  180704. tileRectangle.x -= rtc.y;
  180705. tileRectangle.y -= rtc.z;
  180706. tileRectangle.z -= rtc.y;
  180707. tileRectangle.w -= rtc.z;
  180708. }
  180709. if (frameState.mode === SceneMode_default.SCENE2D && encoding.quantization === TerrainQuantization_default.BITS12) {
  180710. const epsilon = 1 / (Math.pow(2, 12) - 1) * 0.5;
  180711. const widthEpsilon = (tileRectangle.z - tileRectangle.x) * epsilon;
  180712. const heightEpsilon = (tileRectangle.w - tileRectangle.y) * epsilon;
  180713. tileRectangle.x -= widthEpsilon;
  180714. tileRectangle.y -= heightEpsilon;
  180715. tileRectangle.z += widthEpsilon;
  180716. tileRectangle.w += heightEpsilon;
  180717. }
  180718. if (projection instanceof WebMercatorProjection_default) {
  180719. southLatitude = tile.rectangle.south;
  180720. northLatitude = tile.rectangle.north;
  180721. southMercatorY = WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(
  180722. southLatitude
  180723. );
  180724. oneOverMercatorHeight = 1 / (WebMercatorProjection_default.geodeticLatitudeToMercatorAngle(northLatitude) - southMercatorY);
  180725. useWebMercatorProjection = true;
  180726. }
  180727. }
  180728. const surfaceShaderSetOptions = surfaceShaderSetOptionsScratch;
  180729. surfaceShaderSetOptions.frameState = frameState;
  180730. surfaceShaderSetOptions.surfaceTile = surfaceTile;
  180731. surfaceShaderSetOptions.showReflectiveOcean = showReflectiveOcean;
  180732. surfaceShaderSetOptions.showOceanWaves = showOceanWaves;
  180733. surfaceShaderSetOptions.enableLighting = tileProvider.enableLighting;
  180734. surfaceShaderSetOptions.dynamicAtmosphereLighting = tileProvider.dynamicAtmosphereLighting;
  180735. surfaceShaderSetOptions.dynamicAtmosphereLightingFromSun = tileProvider.dynamicAtmosphereLightingFromSun;
  180736. surfaceShaderSetOptions.showGroundAtmosphere = showGroundAtmosphere;
  180737. surfaceShaderSetOptions.atmosphereLightIntensity = tileProvider.atmosphereLightIntensity;
  180738. surfaceShaderSetOptions.atmosphereRayleighCoefficient = tileProvider.atmosphereRayleighCoefficient;
  180739. surfaceShaderSetOptions.atmosphereMieCoefficient = tileProvider.atmosphereMieCoefficient;
  180740. surfaceShaderSetOptions.atmosphereRayleighScaleHeight = tileProvider.atmosphereRayleighScaleHeight;
  180741. surfaceShaderSetOptions.atmosphereMieScaleHeight = tileProvider.atmosphereMieScaleHeight;
  180742. surfaceShaderSetOptions.atmosphereMieAnisotropy = tileProvider.atmosphereMieAnisotropy;
  180743. surfaceShaderSetOptions.perFragmentGroundAtmosphere = perFragmentGroundAtmosphere;
  180744. surfaceShaderSetOptions.hasVertexNormals = hasVertexNormals;
  180745. surfaceShaderSetOptions.useWebMercatorProjection = useWebMercatorProjection;
  180746. surfaceShaderSetOptions.clippedByBoundaries = surfaceTile.clippedByBoundaries;
  180747. surfaceShaderSetOptions.hasGeodeticSurfaceNormals = hasGeodeticSurfaceNormals;
  180748. surfaceShaderSetOptions.hasExaggeration = hasExaggeration;
  180749. const tileImageryCollection = surfaceTile.imagery;
  180750. let imageryIndex = 0;
  180751. const imageryLen = tileImageryCollection.length;
  180752. const showSkirts = tileProvider.showSkirts && !cameraUnderground && !translucent;
  180753. const backFaceCulling = tileProvider.backFaceCulling && !cameraUnderground && !translucent;
  180754. const firstPassRenderState = backFaceCulling ? tileProvider._renderState : tileProvider._disableCullingRenderState;
  180755. const otherPassesRenderState = backFaceCulling ? tileProvider._blendRenderState : tileProvider._disableCullingBlendRenderState;
  180756. let renderState = firstPassRenderState;
  180757. let initialColor = tileProvider._firstPassInitialColor;
  180758. const context = frameState.context;
  180759. if (!defined_default(tileProvider._debug.boundingSphereTile)) {
  180760. debugDestroyPrimitive();
  180761. }
  180762. const materialUniformMapChanged = tileProvider._materialUniformMap !== tileProvider.materialUniformMap;
  180763. if (materialUniformMapChanged) {
  180764. tileProvider._materialUniformMap = tileProvider.materialUniformMap;
  180765. const drawCommandsLength = tileProvider._drawCommands.length;
  180766. for (let i2 = 0; i2 < drawCommandsLength; ++i2) {
  180767. tileProvider._uniformMaps[i2] = createTileUniformMap(
  180768. frameState,
  180769. tileProvider
  180770. );
  180771. }
  180772. }
  180773. do {
  180774. let numberOfDayTextures = 0;
  180775. let command;
  180776. let uniformMap2;
  180777. if (tileProvider._drawCommands.length <= tileProvider._usedDrawCommands) {
  180778. command = new DrawCommand_default();
  180779. command.owner = tile;
  180780. command.cull = false;
  180781. command.boundingVolume = new BoundingSphere_default();
  180782. command.orientedBoundingBox = void 0;
  180783. uniformMap2 = createTileUniformMap(frameState, tileProvider);
  180784. tileProvider._drawCommands.push(command);
  180785. tileProvider._uniformMaps.push(uniformMap2);
  180786. } else {
  180787. command = tileProvider._drawCommands[tileProvider._usedDrawCommands];
  180788. uniformMap2 = tileProvider._uniformMaps[tileProvider._usedDrawCommands];
  180789. }
  180790. command.owner = tile;
  180791. ++tileProvider._usedDrawCommands;
  180792. if (tile === tileProvider._debug.boundingSphereTile) {
  180793. const obb = tileBoundingRegion.boundingVolume;
  180794. const boundingSphere = tileBoundingRegion.boundingSphere;
  180795. if (defined_default(obb)) {
  180796. getDebugOrientedBoundingBox(obb, Color_default.RED).update(frameState);
  180797. } else if (defined_default(boundingSphere)) {
  180798. getDebugBoundingSphere(boundingSphere, Color_default.RED).update(frameState);
  180799. }
  180800. }
  180801. const uniformMapProperties = uniformMap2.properties;
  180802. Cartesian4_default.clone(initialColor, uniformMapProperties.initialColor);
  180803. uniformMapProperties.oceanNormalMap = oceanNormalMap;
  180804. uniformMapProperties.lightingFadeDistance.x = tileProvider.lightingFadeOutDistance;
  180805. uniformMapProperties.lightingFadeDistance.y = tileProvider.lightingFadeInDistance;
  180806. uniformMapProperties.nightFadeDistance.x = tileProvider.nightFadeOutDistance;
  180807. uniformMapProperties.nightFadeDistance.y = tileProvider.nightFadeInDistance;
  180808. uniformMapProperties.atmosphereLightIntensity = tileProvider.atmosphereLightIntensity;
  180809. uniformMapProperties.atmosphereRayleighCoefficient = tileProvider.atmosphereRayleighCoefficient;
  180810. uniformMapProperties.atmosphereMieCoefficient = tileProvider.atmosphereMieCoefficient;
  180811. uniformMapProperties.atmosphereRayleighScaleHeight = tileProvider.atmosphereRayleighScaleHeight;
  180812. uniformMapProperties.atmosphereMieScaleHeight = tileProvider.atmosphereMieScaleHeight;
  180813. uniformMapProperties.atmosphereMieAnisotropy = tileProvider.atmosphereMieAnisotropy;
  180814. uniformMapProperties.zoomedOutOceanSpecularIntensity = tileProvider.zoomedOutOceanSpecularIntensity;
  180815. const frontFaceAlphaByDistanceFinal = cameraUnderground ? backFaceAlphaByDistance : frontFaceAlphaByDistance;
  180816. const backFaceAlphaByDistanceFinal = cameraUnderground ? frontFaceAlphaByDistance : backFaceAlphaByDistance;
  180817. if (defined_default(frontFaceAlphaByDistanceFinal)) {
  180818. Cartesian4_default.fromElements(
  180819. frontFaceAlphaByDistanceFinal.near,
  180820. frontFaceAlphaByDistanceFinal.nearValue,
  180821. frontFaceAlphaByDistanceFinal.far,
  180822. frontFaceAlphaByDistanceFinal.farValue,
  180823. uniformMapProperties.frontFaceAlphaByDistance
  180824. );
  180825. Cartesian4_default.fromElements(
  180826. backFaceAlphaByDistanceFinal.near,
  180827. backFaceAlphaByDistanceFinal.nearValue,
  180828. backFaceAlphaByDistanceFinal.far,
  180829. backFaceAlphaByDistanceFinal.farValue,
  180830. uniformMapProperties.backFaceAlphaByDistance
  180831. );
  180832. }
  180833. Cartesian4_default.fromElements(
  180834. undergroundColorAlphaByDistance.near,
  180835. undergroundColorAlphaByDistance.nearValue,
  180836. undergroundColorAlphaByDistance.far,
  180837. undergroundColorAlphaByDistance.farValue,
  180838. uniformMapProperties.undergroundColorAlphaByDistance
  180839. );
  180840. Color_default.clone(undergroundColor, uniformMapProperties.undergroundColor);
  180841. uniformMapProperties.lambertDiffuseMultiplier = lambertDiffuseMultiplier;
  180842. const highlightFillTile = !defined_default(surfaceTile.vertexArray) && defined_default(tileProvider.fillHighlightColor) && tileProvider.fillHighlightColor.alpha > 0;
  180843. if (highlightFillTile) {
  180844. Color_default.clone(
  180845. tileProvider.fillHighlightColor,
  180846. uniformMapProperties.fillHighlightColor
  180847. );
  180848. }
  180849. uniformMapProperties.terrainExaggerationAndRelativeHeight.x = exaggeration;
  180850. uniformMapProperties.terrainExaggerationAndRelativeHeight.y = exaggerationRelativeHeight;
  180851. uniformMapProperties.center3D = mesh2.center;
  180852. Cartesian3_default.clone(rtc, uniformMapProperties.rtc);
  180853. Cartesian4_default.clone(tileRectangle, uniformMapProperties.tileRectangle);
  180854. uniformMapProperties.southAndNorthLatitude.x = southLatitude;
  180855. uniformMapProperties.southAndNorthLatitude.y = northLatitude;
  180856. uniformMapProperties.southMercatorYAndOneOverHeight.x = southMercatorY;
  180857. uniformMapProperties.southMercatorYAndOneOverHeight.y = oneOverMercatorHeight;
  180858. const localizedCartographicLimitRectangle = localizedCartographicLimitRectangleScratch;
  180859. const cartographicLimitRectangle = clipRectangleAntimeridian(
  180860. tile.rectangle,
  180861. tileProvider.cartographicLimitRectangle
  180862. );
  180863. const localizedTranslucencyRectangle = localizedTranslucencyRectangleScratch;
  180864. const clippedTranslucencyRectangle = clipRectangleAntimeridian(
  180865. tile.rectangle,
  180866. translucencyRectangle
  180867. );
  180868. Cartesian3_default.fromElements(
  180869. hueShift,
  180870. saturationShift,
  180871. brightnessShift,
  180872. uniformMapProperties.hsbShift
  180873. );
  180874. const cartographicTileRectangle = tile.rectangle;
  180875. const inverseTileWidth = 1 / cartographicTileRectangle.width;
  180876. const inverseTileHeight = 1 / cartographicTileRectangle.height;
  180877. localizedCartographicLimitRectangle.x = (cartographicLimitRectangle.west - cartographicTileRectangle.west) * inverseTileWidth;
  180878. localizedCartographicLimitRectangle.y = (cartographicLimitRectangle.south - cartographicTileRectangle.south) * inverseTileHeight;
  180879. localizedCartographicLimitRectangle.z = (cartographicLimitRectangle.east - cartographicTileRectangle.west) * inverseTileWidth;
  180880. localizedCartographicLimitRectangle.w = (cartographicLimitRectangle.north - cartographicTileRectangle.south) * inverseTileHeight;
  180881. Cartesian4_default.clone(
  180882. localizedCartographicLimitRectangle,
  180883. uniformMapProperties.localizedCartographicLimitRectangle
  180884. );
  180885. localizedTranslucencyRectangle.x = (clippedTranslucencyRectangle.west - cartographicTileRectangle.west) * inverseTileWidth;
  180886. localizedTranslucencyRectangle.y = (clippedTranslucencyRectangle.south - cartographicTileRectangle.south) * inverseTileHeight;
  180887. localizedTranslucencyRectangle.z = (clippedTranslucencyRectangle.east - cartographicTileRectangle.west) * inverseTileWidth;
  180888. localizedTranslucencyRectangle.w = (clippedTranslucencyRectangle.north - cartographicTileRectangle.south) * inverseTileHeight;
  180889. Cartesian4_default.clone(
  180890. localizedTranslucencyRectangle,
  180891. uniformMapProperties.localizedTranslucencyRectangle
  180892. );
  180893. const applyFog = enableFog && Math_default.fog(tile._distance, frameState.fog.density) > Math_default.EPSILON3;
  180894. colorCorrect = colorCorrect && (applyFog || showGroundAtmosphere);
  180895. let applyBrightness = false;
  180896. let applyContrast = false;
  180897. let applyHue = false;
  180898. let applySaturation = false;
  180899. let applyGamma = false;
  180900. let applyAlpha = false;
  180901. let applyDayNightAlpha = false;
  180902. let applySplit = false;
  180903. let applyCutout = false;
  180904. let applyColorToAlpha = false;
  180905. while (numberOfDayTextures < maxTextures && imageryIndex < imageryLen) {
  180906. const tileImagery = tileImageryCollection[imageryIndex];
  180907. const imagery = tileImagery.readyImagery;
  180908. ++imageryIndex;
  180909. if (!defined_default(imagery) || imagery.imageryLayer.alpha === 0) {
  180910. continue;
  180911. }
  180912. const texture = tileImagery.useWebMercatorT ? imagery.textureWebMercator : imagery.texture;
  180913. if (!defined_default(texture)) {
  180914. throw new DeveloperError_default("readyImagery is not actually ready!");
  180915. }
  180916. const imageryLayer = imagery.imageryLayer;
  180917. if (!defined_default(tileImagery.textureTranslationAndScale)) {
  180918. tileImagery.textureTranslationAndScale = imageryLayer._calculateTextureTranslationAndScale(
  180919. tile,
  180920. tileImagery
  180921. );
  180922. }
  180923. uniformMapProperties.dayTextures[numberOfDayTextures] = texture;
  180924. uniformMapProperties.dayTextureTranslationAndScale[numberOfDayTextures] = tileImagery.textureTranslationAndScale;
  180925. uniformMapProperties.dayTextureTexCoordsRectangle[numberOfDayTextures] = tileImagery.textureCoordinateRectangle;
  180926. uniformMapProperties.dayTextureUseWebMercatorT[numberOfDayTextures] = tileImagery.useWebMercatorT;
  180927. uniformMapProperties.dayTextureAlpha[numberOfDayTextures] = imageryLayer.alpha;
  180928. applyAlpha = applyAlpha || uniformMapProperties.dayTextureAlpha[numberOfDayTextures] !== 1;
  180929. uniformMapProperties.dayTextureNightAlpha[numberOfDayTextures] = imageryLayer.nightAlpha;
  180930. applyDayNightAlpha = applyDayNightAlpha || uniformMapProperties.dayTextureNightAlpha[numberOfDayTextures] !== 1;
  180931. uniformMapProperties.dayTextureDayAlpha[numberOfDayTextures] = imageryLayer.dayAlpha;
  180932. applyDayNightAlpha = applyDayNightAlpha || uniformMapProperties.dayTextureDayAlpha[numberOfDayTextures] !== 1;
  180933. uniformMapProperties.dayTextureBrightness[numberOfDayTextures] = imageryLayer.brightness;
  180934. applyBrightness = applyBrightness || uniformMapProperties.dayTextureBrightness[numberOfDayTextures] !== ImageryLayer_default.DEFAULT_BRIGHTNESS;
  180935. uniformMapProperties.dayTextureContrast[numberOfDayTextures] = imageryLayer.contrast;
  180936. applyContrast = applyContrast || uniformMapProperties.dayTextureContrast[numberOfDayTextures] !== ImageryLayer_default.DEFAULT_CONTRAST;
  180937. uniformMapProperties.dayTextureHue[numberOfDayTextures] = imageryLayer.hue;
  180938. applyHue = applyHue || uniformMapProperties.dayTextureHue[numberOfDayTextures] !== ImageryLayer_default.DEFAULT_HUE;
  180939. uniformMapProperties.dayTextureSaturation[numberOfDayTextures] = imageryLayer.saturation;
  180940. applySaturation = applySaturation || uniformMapProperties.dayTextureSaturation[numberOfDayTextures] !== ImageryLayer_default.DEFAULT_SATURATION;
  180941. uniformMapProperties.dayTextureOneOverGamma[numberOfDayTextures] = 1 / imageryLayer.gamma;
  180942. applyGamma = applyGamma || uniformMapProperties.dayTextureOneOverGamma[numberOfDayTextures] !== 1 / ImageryLayer_default.DEFAULT_GAMMA;
  180943. uniformMapProperties.dayTextureSplit[numberOfDayTextures] = imageryLayer.splitDirection;
  180944. applySplit = applySplit || uniformMapProperties.dayTextureSplit[numberOfDayTextures] !== 0;
  180945. let dayTextureCutoutRectangle = uniformMapProperties.dayTextureCutoutRectangles[numberOfDayTextures];
  180946. if (!defined_default(dayTextureCutoutRectangle)) {
  180947. dayTextureCutoutRectangle = uniformMapProperties.dayTextureCutoutRectangles[numberOfDayTextures] = new Cartesian4_default();
  180948. }
  180949. Cartesian4_default.clone(Cartesian4_default.ZERO, dayTextureCutoutRectangle);
  180950. if (defined_default(imageryLayer.cutoutRectangle)) {
  180951. const cutoutRectangle = clipRectangleAntimeridian(
  180952. cartographicTileRectangle,
  180953. imageryLayer.cutoutRectangle
  180954. );
  180955. const intersection = Rectangle_default.simpleIntersection(
  180956. cutoutRectangle,
  180957. cartographicTileRectangle,
  180958. rectangleIntersectionScratch
  180959. );
  180960. applyCutout = defined_default(intersection) || applyCutout;
  180961. dayTextureCutoutRectangle.x = (cutoutRectangle.west - cartographicTileRectangle.west) * inverseTileWidth;
  180962. dayTextureCutoutRectangle.y = (cutoutRectangle.south - cartographicTileRectangle.south) * inverseTileHeight;
  180963. dayTextureCutoutRectangle.z = (cutoutRectangle.east - cartographicTileRectangle.west) * inverseTileWidth;
  180964. dayTextureCutoutRectangle.w = (cutoutRectangle.north - cartographicTileRectangle.south) * inverseTileHeight;
  180965. }
  180966. let colorToAlpha = uniformMapProperties.colorsToAlpha[numberOfDayTextures];
  180967. if (!defined_default(colorToAlpha)) {
  180968. colorToAlpha = uniformMapProperties.colorsToAlpha[numberOfDayTextures] = new Cartesian4_default();
  180969. }
  180970. const hasColorToAlpha = defined_default(imageryLayer.colorToAlpha) && imageryLayer.colorToAlphaThreshold > 0;
  180971. applyColorToAlpha = applyColorToAlpha || hasColorToAlpha;
  180972. if (hasColorToAlpha) {
  180973. const color = imageryLayer.colorToAlpha;
  180974. colorToAlpha.x = color.red;
  180975. colorToAlpha.y = color.green;
  180976. colorToAlpha.z = color.blue;
  180977. colorToAlpha.w = imageryLayer.colorToAlphaThreshold;
  180978. } else {
  180979. colorToAlpha.w = -1;
  180980. }
  180981. if (defined_default(imagery.credits)) {
  180982. const credits = imagery.credits;
  180983. for (let creditIndex = 0, creditLength = credits.length; creditIndex < creditLength; ++creditIndex) {
  180984. creditDisplay.addCredit(credits[creditIndex]);
  180985. }
  180986. }
  180987. ++numberOfDayTextures;
  180988. }
  180989. uniformMapProperties.dayTextures.length = numberOfDayTextures;
  180990. uniformMapProperties.waterMask = waterMaskTexture;
  180991. Cartesian4_default.clone(
  180992. waterMaskTranslationAndScale,
  180993. uniformMapProperties.waterMaskTranslationAndScale
  180994. );
  180995. uniformMapProperties.minMaxHeight.x = encoding.minimumHeight;
  180996. uniformMapProperties.minMaxHeight.y = encoding.maximumHeight;
  180997. Matrix4_default.clone(encoding.matrix, uniformMapProperties.scaleAndBias);
  180998. const clippingPlanes = tileProvider._clippingPlanes;
  180999. const clippingPlanesEnabled = defined_default(clippingPlanes) && clippingPlanes.enabled && tile.isClipped;
  181000. if (clippingPlanesEnabled) {
  181001. uniformMapProperties.clippingPlanesEdgeColor = Color_default.clone(
  181002. clippingPlanes.edgeColor,
  181003. uniformMapProperties.clippingPlanesEdgeColor
  181004. );
  181005. uniformMapProperties.clippingPlanesEdgeWidth = clippingPlanes.edgeWidth;
  181006. }
  181007. surfaceShaderSetOptions.numberOfDayTextures = numberOfDayTextures;
  181008. surfaceShaderSetOptions.applyBrightness = applyBrightness;
  181009. surfaceShaderSetOptions.applyContrast = applyContrast;
  181010. surfaceShaderSetOptions.applyHue = applyHue;
  181011. surfaceShaderSetOptions.applySaturation = applySaturation;
  181012. surfaceShaderSetOptions.applyGamma = applyGamma;
  181013. surfaceShaderSetOptions.applyAlpha = applyAlpha;
  181014. surfaceShaderSetOptions.applyDayNightAlpha = applyDayNightAlpha;
  181015. surfaceShaderSetOptions.applySplit = applySplit;
  181016. surfaceShaderSetOptions.enableFog = applyFog;
  181017. surfaceShaderSetOptions.enableClippingPlanes = clippingPlanesEnabled;
  181018. surfaceShaderSetOptions.clippingPlanes = clippingPlanes;
  181019. surfaceShaderSetOptions.hasImageryLayerCutout = applyCutout;
  181020. surfaceShaderSetOptions.colorCorrect = colorCorrect;
  181021. surfaceShaderSetOptions.highlightFillTile = highlightFillTile;
  181022. surfaceShaderSetOptions.colorToAlpha = applyColorToAlpha;
  181023. surfaceShaderSetOptions.showUndergroundColor = showUndergroundColor;
  181024. surfaceShaderSetOptions.translucent = translucent;
  181025. let count = surfaceTile.renderedMesh.indices.length;
  181026. if (!showSkirts) {
  181027. count = surfaceTile.renderedMesh.indexCountWithoutSkirts;
  181028. }
  181029. command.shaderProgram = tileProvider._surfaceShaderSet.getShaderProgram(
  181030. surfaceShaderSetOptions
  181031. );
  181032. command.castShadows = castShadows;
  181033. command.receiveShadows = receiveShadows;
  181034. command.renderState = renderState;
  181035. command.primitiveType = PrimitiveType_default.TRIANGLES;
  181036. command.vertexArray = surfaceTile.vertexArray || surfaceTile.fill.vertexArray;
  181037. command.count = count;
  181038. command.uniformMap = uniformMap2;
  181039. command.pass = Pass_default.GLOBE;
  181040. if (tileProvider._debug.wireframe) {
  181041. createWireframeVertexArrayIfNecessary(context, tileProvider, tile);
  181042. if (defined_default(surfaceTile.wireframeVertexArray)) {
  181043. command.vertexArray = surfaceTile.wireframeVertexArray;
  181044. command.primitiveType = PrimitiveType_default.LINES;
  181045. command.count = count * 2;
  181046. }
  181047. }
  181048. let boundingVolume = command.boundingVolume;
  181049. const orientedBoundingBox = command.orientedBoundingBox;
  181050. if (frameState.mode !== SceneMode_default.SCENE3D) {
  181051. BoundingSphere_default.fromRectangleWithHeights2D(
  181052. tile.rectangle,
  181053. frameState.mapProjection,
  181054. tileBoundingRegion.minimumHeight,
  181055. tileBoundingRegion.maximumHeight,
  181056. boundingVolume
  181057. );
  181058. Cartesian3_default.fromElements(
  181059. boundingVolume.center.z,
  181060. boundingVolume.center.x,
  181061. boundingVolume.center.y,
  181062. boundingVolume.center
  181063. );
  181064. if (frameState.mode === SceneMode_default.MORPHING) {
  181065. boundingVolume = BoundingSphere_default.union(
  181066. tileBoundingRegion.boundingSphere,
  181067. boundingVolume,
  181068. boundingVolume
  181069. );
  181070. }
  181071. } else {
  181072. command.boundingVolume = BoundingSphere_default.clone(
  181073. tileBoundingRegion.boundingSphere,
  181074. boundingVolume
  181075. );
  181076. command.orientedBoundingBox = OrientedBoundingBox_default.clone(
  181077. tileBoundingRegion.boundingVolume,
  181078. orientedBoundingBox
  181079. );
  181080. }
  181081. command.dirty = true;
  181082. if (translucent) {
  181083. globeTranslucencyState.updateDerivedCommands(command, frameState);
  181084. }
  181085. pushCommand(command, frameState);
  181086. renderState = otherPassesRenderState;
  181087. initialColor = otherPassesInitialColor;
  181088. } while (imageryIndex < imageryLen);
  181089. }
  181090. var GlobeSurfaceTileProvider_default = GlobeSurfaceTileProvider;
  181091. // node_modules/cesium/Source/Scene/GlobeTranslucency.js
  181092. function GlobeTranslucency() {
  181093. this._enabled = false;
  181094. this._frontFaceAlpha = 1;
  181095. this._frontFaceAlphaByDistance = void 0;
  181096. this._backFaceAlpha = 1;
  181097. this._backFaceAlphaByDistance = void 0;
  181098. this._rectangle = Rectangle_default.clone(Rectangle_default.MAX_VALUE);
  181099. }
  181100. Object.defineProperties(GlobeTranslucency.prototype, {
  181101. enabled: {
  181102. get: function() {
  181103. return this._enabled;
  181104. },
  181105. set: function(value) {
  181106. Check_default.typeOf.bool("enabled", value);
  181107. this._enabled = value;
  181108. }
  181109. },
  181110. frontFaceAlpha: {
  181111. get: function() {
  181112. return this._frontFaceAlpha;
  181113. },
  181114. set: function(value) {
  181115. Check_default.typeOf.number.greaterThanOrEquals("frontFaceAlpha", value, 0);
  181116. Check_default.typeOf.number.lessThanOrEquals("frontFaceAlpha", value, 1);
  181117. this._frontFaceAlpha = value;
  181118. }
  181119. },
  181120. frontFaceAlphaByDistance: {
  181121. get: function() {
  181122. return this._frontFaceAlphaByDistance;
  181123. },
  181124. set: function(value) {
  181125. if (defined_default(value) && value.far < value.near) {
  181126. throw new DeveloperError_default(
  181127. "far distance must be greater than near distance."
  181128. );
  181129. }
  181130. this._frontFaceAlphaByDistance = NearFarScalar_default.clone(
  181131. value,
  181132. this._frontFaceAlphaByDistance
  181133. );
  181134. }
  181135. },
  181136. backFaceAlpha: {
  181137. get: function() {
  181138. return this._backFaceAlpha;
  181139. },
  181140. set: function(value) {
  181141. Check_default.typeOf.number.greaterThanOrEquals("backFaceAlpha", value, 0);
  181142. Check_default.typeOf.number.lessThanOrEquals("backFaceAlpha", value, 1);
  181143. this._backFaceAlpha = value;
  181144. }
  181145. },
  181146. backFaceAlphaByDistance: {
  181147. get: function() {
  181148. return this._backFaceAlphaByDistance;
  181149. },
  181150. set: function(value) {
  181151. if (defined_default(value) && value.far < value.near) {
  181152. throw new DeveloperError_default(
  181153. "far distance must be greater than near distance."
  181154. );
  181155. }
  181156. this._backFaceAlphaByDistance = NearFarScalar_default.clone(
  181157. value,
  181158. this._backFaceAlphaByDistance
  181159. );
  181160. }
  181161. },
  181162. rectangle: {
  181163. get: function() {
  181164. return this._rectangle;
  181165. },
  181166. set: function(value) {
  181167. if (!defined_default(value)) {
  181168. value = Rectangle_default.clone(Rectangle_default.MAX_VALUE);
  181169. }
  181170. Rectangle_default.clone(value, this._rectangle);
  181171. }
  181172. }
  181173. });
  181174. var GlobeTranslucency_default = GlobeTranslucency;
  181175. // node_modules/cesium/Source/Scene/ImageryLayerCollection.js
  181176. function ImageryLayerCollection() {
  181177. this._layers = [];
  181178. this.layerAdded = new Event_default();
  181179. this.layerRemoved = new Event_default();
  181180. this.layerMoved = new Event_default();
  181181. this.layerShownOrHidden = new Event_default();
  181182. }
  181183. Object.defineProperties(ImageryLayerCollection.prototype, {
  181184. length: {
  181185. get: function() {
  181186. return this._layers.length;
  181187. }
  181188. }
  181189. });
  181190. ImageryLayerCollection.prototype.add = function(layer, index2) {
  181191. const hasIndex = defined_default(index2);
  181192. if (!defined_default(layer)) {
  181193. throw new DeveloperError_default("layer is required.");
  181194. }
  181195. if (hasIndex) {
  181196. if (index2 < 0) {
  181197. throw new DeveloperError_default("index must be greater than or equal to zero.");
  181198. } else if (index2 > this._layers.length) {
  181199. throw new DeveloperError_default(
  181200. "index must be less than or equal to the number of layers."
  181201. );
  181202. }
  181203. }
  181204. if (!hasIndex) {
  181205. index2 = this._layers.length;
  181206. this._layers.push(layer);
  181207. } else {
  181208. this._layers.splice(index2, 0, layer);
  181209. }
  181210. this._update();
  181211. this.layerAdded.raiseEvent(layer, index2);
  181212. };
  181213. ImageryLayerCollection.prototype.addImageryProvider = function(imageryProvider, index2) {
  181214. if (!defined_default(imageryProvider)) {
  181215. throw new DeveloperError_default("imageryProvider is required.");
  181216. }
  181217. const layer = new ImageryLayer_default(imageryProvider);
  181218. this.add(layer, index2);
  181219. return layer;
  181220. };
  181221. ImageryLayerCollection.prototype.remove = function(layer, destroy2) {
  181222. destroy2 = defaultValue_default(destroy2, true);
  181223. const index2 = this._layers.indexOf(layer);
  181224. if (index2 !== -1) {
  181225. this._layers.splice(index2, 1);
  181226. this._update();
  181227. this.layerRemoved.raiseEvent(layer, index2);
  181228. if (destroy2) {
  181229. layer.destroy();
  181230. }
  181231. return true;
  181232. }
  181233. return false;
  181234. };
  181235. ImageryLayerCollection.prototype.removeAll = function(destroy2) {
  181236. destroy2 = defaultValue_default(destroy2, true);
  181237. const layers = this._layers;
  181238. for (let i2 = 0, len = layers.length; i2 < len; i2++) {
  181239. const layer = layers[i2];
  181240. this.layerRemoved.raiseEvent(layer, i2);
  181241. if (destroy2) {
  181242. layer.destroy();
  181243. }
  181244. }
  181245. this._layers = [];
  181246. };
  181247. ImageryLayerCollection.prototype.contains = function(layer) {
  181248. return this.indexOf(layer) !== -1;
  181249. };
  181250. ImageryLayerCollection.prototype.indexOf = function(layer) {
  181251. return this._layers.indexOf(layer);
  181252. };
  181253. ImageryLayerCollection.prototype.get = function(index2) {
  181254. if (!defined_default(index2)) {
  181255. throw new DeveloperError_default("index is required.", "index");
  181256. }
  181257. return this._layers[index2];
  181258. };
  181259. function getLayerIndex(layers, layer) {
  181260. if (!defined_default(layer)) {
  181261. throw new DeveloperError_default("layer is required.");
  181262. }
  181263. const index2 = layers.indexOf(layer);
  181264. if (index2 === -1) {
  181265. throw new DeveloperError_default("layer is not in this collection.");
  181266. }
  181267. return index2;
  181268. }
  181269. function swapLayers(collection, i2, j) {
  181270. const arr = collection._layers;
  181271. i2 = Math_default.clamp(i2, 0, arr.length - 1);
  181272. j = Math_default.clamp(j, 0, arr.length - 1);
  181273. if (i2 === j) {
  181274. return;
  181275. }
  181276. const temp = arr[i2];
  181277. arr[i2] = arr[j];
  181278. arr[j] = temp;
  181279. collection._update();
  181280. collection.layerMoved.raiseEvent(temp, j, i2);
  181281. }
  181282. ImageryLayerCollection.prototype.raise = function(layer) {
  181283. const index2 = getLayerIndex(this._layers, layer);
  181284. swapLayers(this, index2, index2 + 1);
  181285. };
  181286. ImageryLayerCollection.prototype.lower = function(layer) {
  181287. const index2 = getLayerIndex(this._layers, layer);
  181288. swapLayers(this, index2, index2 - 1);
  181289. };
  181290. ImageryLayerCollection.prototype.raiseToTop = function(layer) {
  181291. const index2 = getLayerIndex(this._layers, layer);
  181292. if (index2 === this._layers.length - 1) {
  181293. return;
  181294. }
  181295. this._layers.splice(index2, 1);
  181296. this._layers.push(layer);
  181297. this._update();
  181298. this.layerMoved.raiseEvent(layer, this._layers.length - 1, index2);
  181299. };
  181300. ImageryLayerCollection.prototype.lowerToBottom = function(layer) {
  181301. const index2 = getLayerIndex(this._layers, layer);
  181302. if (index2 === 0) {
  181303. return;
  181304. }
  181305. this._layers.splice(index2, 1);
  181306. this._layers.splice(0, 0, layer);
  181307. this._update();
  181308. this.layerMoved.raiseEvent(layer, 0, index2);
  181309. };
  181310. var applicableRectangleScratch = new Rectangle_default();
  181311. function pickImageryHelper(scene, pickedLocation, pickFeatures2, callback) {
  181312. const tilesToRender = scene.globe._surface._tilesToRender;
  181313. let pickedTile;
  181314. for (let textureIndex = 0; !defined_default(pickedTile) && textureIndex < tilesToRender.length; ++textureIndex) {
  181315. const tile = tilesToRender[textureIndex];
  181316. if (Rectangle_default.contains(tile.rectangle, pickedLocation)) {
  181317. pickedTile = tile;
  181318. }
  181319. }
  181320. if (!defined_default(pickedTile)) {
  181321. return;
  181322. }
  181323. const imageryTiles = pickedTile.data.imagery;
  181324. for (let i2 = imageryTiles.length - 1; i2 >= 0; --i2) {
  181325. const terrainImagery = imageryTiles[i2];
  181326. const imagery = terrainImagery.readyImagery;
  181327. if (!defined_default(imagery)) {
  181328. continue;
  181329. }
  181330. const provider = imagery.imageryLayer.imageryProvider;
  181331. if (pickFeatures2 && !defined_default(provider.pickFeatures)) {
  181332. continue;
  181333. }
  181334. if (!Rectangle_default.contains(imagery.rectangle, pickedLocation)) {
  181335. continue;
  181336. }
  181337. const applicableRectangle = applicableRectangleScratch;
  181338. const epsilon = 1 / 1024;
  181339. applicableRectangle.west = Math_default.lerp(
  181340. pickedTile.rectangle.west,
  181341. pickedTile.rectangle.east,
  181342. terrainImagery.textureCoordinateRectangle.x - epsilon
  181343. );
  181344. applicableRectangle.east = Math_default.lerp(
  181345. pickedTile.rectangle.west,
  181346. pickedTile.rectangle.east,
  181347. terrainImagery.textureCoordinateRectangle.z + epsilon
  181348. );
  181349. applicableRectangle.south = Math_default.lerp(
  181350. pickedTile.rectangle.south,
  181351. pickedTile.rectangle.north,
  181352. terrainImagery.textureCoordinateRectangle.y - epsilon
  181353. );
  181354. applicableRectangle.north = Math_default.lerp(
  181355. pickedTile.rectangle.south,
  181356. pickedTile.rectangle.north,
  181357. terrainImagery.textureCoordinateRectangle.w + epsilon
  181358. );
  181359. if (!Rectangle_default.contains(applicableRectangle, pickedLocation)) {
  181360. continue;
  181361. }
  181362. callback(imagery);
  181363. }
  181364. }
  181365. ImageryLayerCollection.prototype.pickImageryLayers = function(ray, scene) {
  181366. const pickedPosition = scene.globe.pick(ray, scene);
  181367. if (!defined_default(pickedPosition)) {
  181368. return;
  181369. }
  181370. const pickedLocation = scene.globe.ellipsoid.cartesianToCartographic(
  181371. pickedPosition
  181372. );
  181373. const imageryLayers = [];
  181374. pickImageryHelper(scene, pickedLocation, false, function(imagery) {
  181375. imageryLayers.push(imagery.imageryLayer);
  181376. });
  181377. if (imageryLayers.length === 0) {
  181378. return void 0;
  181379. }
  181380. return imageryLayers;
  181381. };
  181382. ImageryLayerCollection.prototype.pickImageryLayerFeatures = function(ray, scene) {
  181383. const pickedPosition = scene.globe.pick(ray, scene);
  181384. if (!defined_default(pickedPosition)) {
  181385. return;
  181386. }
  181387. const pickedLocation = scene.globe.ellipsoid.cartesianToCartographic(
  181388. pickedPosition
  181389. );
  181390. const promises = [];
  181391. const imageryLayers = [];
  181392. pickImageryHelper(scene, pickedLocation, true, function(imagery) {
  181393. const provider = imagery.imageryLayer.imageryProvider;
  181394. const promise = provider.pickFeatures(
  181395. imagery.x,
  181396. imagery.y,
  181397. imagery.level,
  181398. pickedLocation.longitude,
  181399. pickedLocation.latitude
  181400. );
  181401. if (defined_default(promise)) {
  181402. promises.push(promise);
  181403. imageryLayers.push(imagery.imageryLayer);
  181404. }
  181405. });
  181406. if (promises.length === 0) {
  181407. return void 0;
  181408. }
  181409. return Promise.all(promises).then(function(results) {
  181410. const features = [];
  181411. for (let resultIndex = 0; resultIndex < results.length; ++resultIndex) {
  181412. const result = results[resultIndex];
  181413. const image = imageryLayers[resultIndex];
  181414. if (defined_default(result) && result.length > 0) {
  181415. for (let featureIndex = 0; featureIndex < result.length; ++featureIndex) {
  181416. const feature2 = result[featureIndex];
  181417. feature2.imageryLayer = image;
  181418. if (!defined_default(feature2.position)) {
  181419. feature2.position = pickedLocation;
  181420. }
  181421. features.push(feature2);
  181422. }
  181423. }
  181424. }
  181425. return features;
  181426. });
  181427. };
  181428. ImageryLayerCollection.prototype.queueReprojectionCommands = function(frameState) {
  181429. const layers = this._layers;
  181430. for (let i2 = 0, len = layers.length; i2 < len; ++i2) {
  181431. layers[i2].queueReprojectionCommands(frameState);
  181432. }
  181433. };
  181434. ImageryLayerCollection.prototype.cancelReprojections = function() {
  181435. const layers = this._layers;
  181436. for (let i2 = 0, len = layers.length; i2 < len; ++i2) {
  181437. layers[i2].cancelReprojections();
  181438. }
  181439. };
  181440. ImageryLayerCollection.prototype.isDestroyed = function() {
  181441. return false;
  181442. };
  181443. ImageryLayerCollection.prototype.destroy = function() {
  181444. this.removeAll(true);
  181445. return destroyObject_default(this);
  181446. };
  181447. ImageryLayerCollection.prototype._update = function() {
  181448. let isBaseLayer = true;
  181449. const layers = this._layers;
  181450. let layersShownOrHidden;
  181451. let layer;
  181452. let i2, len;
  181453. for (i2 = 0, len = layers.length; i2 < len; ++i2) {
  181454. layer = layers[i2];
  181455. layer._layerIndex = i2;
  181456. if (layer.show) {
  181457. layer._isBaseLayer = isBaseLayer;
  181458. isBaseLayer = false;
  181459. } else {
  181460. layer._isBaseLayer = false;
  181461. }
  181462. if (layer.show !== layer._show) {
  181463. if (defined_default(layer._show)) {
  181464. if (!defined_default(layersShownOrHidden)) {
  181465. layersShownOrHidden = [];
  181466. }
  181467. layersShownOrHidden.push(layer);
  181468. }
  181469. layer._show = layer.show;
  181470. }
  181471. }
  181472. if (defined_default(layersShownOrHidden)) {
  181473. for (i2 = 0, len = layersShownOrHidden.length; i2 < len; ++i2) {
  181474. layer = layersShownOrHidden[i2];
  181475. this.layerShownOrHidden.raiseEvent(layer, layer._layerIndex, layer.show);
  181476. }
  181477. }
  181478. };
  181479. var ImageryLayerCollection_default = ImageryLayerCollection;
  181480. // node_modules/cesium/Source/Scene/QuadtreeOccluders.js
  181481. function QuadtreeOccluders(options) {
  181482. this._ellipsoid = new EllipsoidalOccluder_default(options.ellipsoid, Cartesian3_default.ZERO);
  181483. }
  181484. Object.defineProperties(QuadtreeOccluders.prototype, {
  181485. ellipsoid: {
  181486. get: function() {
  181487. return this._ellipsoid;
  181488. }
  181489. }
  181490. });
  181491. var QuadtreeOccluders_default = QuadtreeOccluders;
  181492. // node_modules/cesium/Source/Scene/QuadtreeTile.js
  181493. function QuadtreeTile(options) {
  181494. if (!defined_default(options)) {
  181495. throw new DeveloperError_default("options is required.");
  181496. }
  181497. if (!defined_default(options.x)) {
  181498. throw new DeveloperError_default("options.x is required.");
  181499. } else if (!defined_default(options.y)) {
  181500. throw new DeveloperError_default("options.y is required.");
  181501. } else if (options.x < 0 || options.y < 0) {
  181502. throw new DeveloperError_default(
  181503. "options.x and options.y must be greater than or equal to zero."
  181504. );
  181505. }
  181506. if (!defined_default(options.level)) {
  181507. throw new DeveloperError_default(
  181508. "options.level is required and must be greater than or equal to zero."
  181509. );
  181510. }
  181511. if (!defined_default(options.tilingScheme)) {
  181512. throw new DeveloperError_default("options.tilingScheme is required.");
  181513. }
  181514. this._tilingScheme = options.tilingScheme;
  181515. this._x = options.x;
  181516. this._y = options.y;
  181517. this._level = options.level;
  181518. this._parent = options.parent;
  181519. this._rectangle = this._tilingScheme.tileXYToRectangle(
  181520. this._x,
  181521. this._y,
  181522. this._level
  181523. );
  181524. this._southwestChild = void 0;
  181525. this._southeastChild = void 0;
  181526. this._northwestChild = void 0;
  181527. this._northeastChild = void 0;
  181528. this.replacementPrevious = void 0;
  181529. this.replacementNext = void 0;
  181530. this._distance = 0;
  181531. this._loadPriority = 0;
  181532. this._customData = [];
  181533. this._frameUpdated = void 0;
  181534. this._lastSelectionResult = TileSelectionResult_default.NONE;
  181535. this._lastSelectionResultFrame = void 0;
  181536. this._loadedCallbacks = {};
  181537. this.state = QuadtreeTileLoadState_default.START;
  181538. this.renderable = false;
  181539. this.upsampledFromParent = false;
  181540. this.data = void 0;
  181541. }
  181542. QuadtreeTile.createLevelZeroTiles = function(tilingScheme2) {
  181543. if (!defined_default(tilingScheme2)) {
  181544. throw new DeveloperError_default("tilingScheme is required.");
  181545. }
  181546. const numberOfLevelZeroTilesX = tilingScheme2.getNumberOfXTilesAtLevel(0);
  181547. const numberOfLevelZeroTilesY = tilingScheme2.getNumberOfYTilesAtLevel(0);
  181548. const result = new Array(numberOfLevelZeroTilesX * numberOfLevelZeroTilesY);
  181549. let index2 = 0;
  181550. for (let y = 0; y < numberOfLevelZeroTilesY; ++y) {
  181551. for (let x = 0; x < numberOfLevelZeroTilesX; ++x) {
  181552. result[index2++] = new QuadtreeTile({
  181553. tilingScheme: tilingScheme2,
  181554. x,
  181555. y,
  181556. level: 0
  181557. });
  181558. }
  181559. }
  181560. return result;
  181561. };
  181562. QuadtreeTile.prototype._updateCustomData = function(frameNumber, added, removed) {
  181563. let customData = this.customData;
  181564. let i2;
  181565. let data;
  181566. let rectangle;
  181567. if (defined_default(added) && defined_default(removed)) {
  181568. customData = customData.filter(function(value) {
  181569. return removed.indexOf(value) === -1;
  181570. });
  181571. this._customData = customData;
  181572. rectangle = this._rectangle;
  181573. for (i2 = 0; i2 < added.length; ++i2) {
  181574. data = added[i2];
  181575. if (Rectangle_default.contains(rectangle, data.positionCartographic)) {
  181576. customData.push(data);
  181577. }
  181578. }
  181579. this._frameUpdated = frameNumber;
  181580. } else {
  181581. const parent = this._parent;
  181582. if (defined_default(parent) && this._frameUpdated !== parent._frameUpdated) {
  181583. customData.length = 0;
  181584. rectangle = this._rectangle;
  181585. const parentCustomData = parent.customData;
  181586. for (i2 = 0; i2 < parentCustomData.length; ++i2) {
  181587. data = parentCustomData[i2];
  181588. if (Rectangle_default.contains(rectangle, data.positionCartographic)) {
  181589. customData.push(data);
  181590. }
  181591. }
  181592. this._frameUpdated = parent._frameUpdated;
  181593. }
  181594. }
  181595. };
  181596. Object.defineProperties(QuadtreeTile.prototype, {
  181597. tilingScheme: {
  181598. get: function() {
  181599. return this._tilingScheme;
  181600. }
  181601. },
  181602. x: {
  181603. get: function() {
  181604. return this._x;
  181605. }
  181606. },
  181607. y: {
  181608. get: function() {
  181609. return this._y;
  181610. }
  181611. },
  181612. level: {
  181613. get: function() {
  181614. return this._level;
  181615. }
  181616. },
  181617. parent: {
  181618. get: function() {
  181619. return this._parent;
  181620. }
  181621. },
  181622. rectangle: {
  181623. get: function() {
  181624. return this._rectangle;
  181625. }
  181626. },
  181627. children: {
  181628. get: function() {
  181629. return [
  181630. this.northwestChild,
  181631. this.northeastChild,
  181632. this.southwestChild,
  181633. this.southeastChild
  181634. ];
  181635. }
  181636. },
  181637. southwestChild: {
  181638. get: function() {
  181639. if (!defined_default(this._southwestChild)) {
  181640. this._southwestChild = new QuadtreeTile({
  181641. tilingScheme: this.tilingScheme,
  181642. x: this.x * 2,
  181643. y: this.y * 2 + 1,
  181644. level: this.level + 1,
  181645. parent: this
  181646. });
  181647. }
  181648. return this._southwestChild;
  181649. }
  181650. },
  181651. southeastChild: {
  181652. get: function() {
  181653. if (!defined_default(this._southeastChild)) {
  181654. this._southeastChild = new QuadtreeTile({
  181655. tilingScheme: this.tilingScheme,
  181656. x: this.x * 2 + 1,
  181657. y: this.y * 2 + 1,
  181658. level: this.level + 1,
  181659. parent: this
  181660. });
  181661. }
  181662. return this._southeastChild;
  181663. }
  181664. },
  181665. northwestChild: {
  181666. get: function() {
  181667. if (!defined_default(this._northwestChild)) {
  181668. this._northwestChild = new QuadtreeTile({
  181669. tilingScheme: this.tilingScheme,
  181670. x: this.x * 2,
  181671. y: this.y * 2,
  181672. level: this.level + 1,
  181673. parent: this
  181674. });
  181675. }
  181676. return this._northwestChild;
  181677. }
  181678. },
  181679. northeastChild: {
  181680. get: function() {
  181681. if (!defined_default(this._northeastChild)) {
  181682. this._northeastChild = new QuadtreeTile({
  181683. tilingScheme: this.tilingScheme,
  181684. x: this.x * 2 + 1,
  181685. y: this.y * 2,
  181686. level: this.level + 1,
  181687. parent: this
  181688. });
  181689. }
  181690. return this._northeastChild;
  181691. }
  181692. },
  181693. customData: {
  181694. get: function() {
  181695. return this._customData;
  181696. }
  181697. },
  181698. needsLoading: {
  181699. get: function() {
  181700. return this.state < QuadtreeTileLoadState_default.DONE;
  181701. }
  181702. },
  181703. eligibleForUnloading: {
  181704. get: function() {
  181705. let result = true;
  181706. if (defined_default(this.data)) {
  181707. result = this.data.eligibleForUnloading;
  181708. if (!defined_default(result)) {
  181709. result = true;
  181710. }
  181711. }
  181712. return result;
  181713. }
  181714. }
  181715. });
  181716. QuadtreeTile.prototype.findLevelZeroTile = function(levelZeroTiles, x, y) {
  181717. const xTiles = this.tilingScheme.getNumberOfXTilesAtLevel(0);
  181718. if (x < 0) {
  181719. x += xTiles;
  181720. } else if (x >= xTiles) {
  181721. x -= xTiles;
  181722. }
  181723. if (y < 0 || y >= this.tilingScheme.getNumberOfYTilesAtLevel(0)) {
  181724. return void 0;
  181725. }
  181726. return levelZeroTiles.filter(function(tile) {
  181727. return tile.x === x && tile.y === y;
  181728. })[0];
  181729. };
  181730. QuadtreeTile.prototype.findTileToWest = function(levelZeroTiles) {
  181731. const parent = this.parent;
  181732. if (parent === void 0) {
  181733. return this.findLevelZeroTile(levelZeroTiles, this.x - 1, this.y);
  181734. }
  181735. if (parent.southeastChild === this) {
  181736. return parent.southwestChild;
  181737. } else if (parent.northeastChild === this) {
  181738. return parent.northwestChild;
  181739. }
  181740. const westOfParent = parent.findTileToWest(levelZeroTiles);
  181741. if (westOfParent === void 0) {
  181742. return void 0;
  181743. } else if (parent.southwestChild === this) {
  181744. return westOfParent.southeastChild;
  181745. }
  181746. return westOfParent.northeastChild;
  181747. };
  181748. QuadtreeTile.prototype.findTileToEast = function(levelZeroTiles) {
  181749. const parent = this.parent;
  181750. if (parent === void 0) {
  181751. return this.findLevelZeroTile(levelZeroTiles, this.x + 1, this.y);
  181752. }
  181753. if (parent.southwestChild === this) {
  181754. return parent.southeastChild;
  181755. } else if (parent.northwestChild === this) {
  181756. return parent.northeastChild;
  181757. }
  181758. const eastOfParent = parent.findTileToEast(levelZeroTiles);
  181759. if (eastOfParent === void 0) {
  181760. return void 0;
  181761. } else if (parent.southeastChild === this) {
  181762. return eastOfParent.southwestChild;
  181763. }
  181764. return eastOfParent.northwestChild;
  181765. };
  181766. QuadtreeTile.prototype.findTileToSouth = function(levelZeroTiles) {
  181767. const parent = this.parent;
  181768. if (parent === void 0) {
  181769. return this.findLevelZeroTile(levelZeroTiles, this.x, this.y + 1);
  181770. }
  181771. if (parent.northwestChild === this) {
  181772. return parent.southwestChild;
  181773. } else if (parent.northeastChild === this) {
  181774. return parent.southeastChild;
  181775. }
  181776. const southOfParent = parent.findTileToSouth(levelZeroTiles);
  181777. if (southOfParent === void 0) {
  181778. return void 0;
  181779. } else if (parent.southwestChild === this) {
  181780. return southOfParent.northwestChild;
  181781. }
  181782. return southOfParent.northeastChild;
  181783. };
  181784. QuadtreeTile.prototype.findTileToNorth = function(levelZeroTiles) {
  181785. const parent = this.parent;
  181786. if (parent === void 0) {
  181787. return this.findLevelZeroTile(levelZeroTiles, this.x, this.y - 1);
  181788. }
  181789. if (parent.southwestChild === this) {
  181790. return parent.northwestChild;
  181791. } else if (parent.southeastChild === this) {
  181792. return parent.northeastChild;
  181793. }
  181794. const northOfParent = parent.findTileToNorth(levelZeroTiles);
  181795. if (northOfParent === void 0) {
  181796. return void 0;
  181797. } else if (parent.northwestChild === this) {
  181798. return northOfParent.southwestChild;
  181799. }
  181800. return northOfParent.southeastChild;
  181801. };
  181802. QuadtreeTile.prototype.freeResources = function() {
  181803. this.state = QuadtreeTileLoadState_default.START;
  181804. this.renderable = false;
  181805. this.upsampledFromParent = false;
  181806. if (defined_default(this.data) && defined_default(this.data.freeResources)) {
  181807. this.data.freeResources();
  181808. }
  181809. freeTile(this._southwestChild);
  181810. this._southwestChild = void 0;
  181811. freeTile(this._southeastChild);
  181812. this._southeastChild = void 0;
  181813. freeTile(this._northwestChild);
  181814. this._northwestChild = void 0;
  181815. freeTile(this._northeastChild);
  181816. this._northeastChild = void 0;
  181817. };
  181818. function freeTile(tile) {
  181819. if (defined_default(tile)) {
  181820. tile.freeResources();
  181821. }
  181822. }
  181823. var QuadtreeTile_default = QuadtreeTile;
  181824. // node_modules/cesium/Source/Scene/TileReplacementQueue.js
  181825. function TileReplacementQueue() {
  181826. this.head = void 0;
  181827. this.tail = void 0;
  181828. this.count = 0;
  181829. this._lastBeforeStartOfFrame = void 0;
  181830. }
  181831. TileReplacementQueue.prototype.markStartOfRenderFrame = function() {
  181832. this._lastBeforeStartOfFrame = this.head;
  181833. };
  181834. TileReplacementQueue.prototype.trimTiles = function(maximumTiles) {
  181835. let tileToTrim = this.tail;
  181836. let keepTrimming = true;
  181837. while (keepTrimming && defined_default(this._lastBeforeStartOfFrame) && this.count > maximumTiles && defined_default(tileToTrim)) {
  181838. keepTrimming = tileToTrim !== this._lastBeforeStartOfFrame;
  181839. const previous = tileToTrim.replacementPrevious;
  181840. if (tileToTrim.eligibleForUnloading) {
  181841. tileToTrim.freeResources();
  181842. remove3(this, tileToTrim);
  181843. }
  181844. tileToTrim = previous;
  181845. }
  181846. };
  181847. function remove3(tileReplacementQueue, item) {
  181848. const previous = item.replacementPrevious;
  181849. const next = item.replacementNext;
  181850. if (item === tileReplacementQueue._lastBeforeStartOfFrame) {
  181851. tileReplacementQueue._lastBeforeStartOfFrame = next;
  181852. }
  181853. if (item === tileReplacementQueue.head) {
  181854. tileReplacementQueue.head = next;
  181855. } else {
  181856. previous.replacementNext = next;
  181857. }
  181858. if (item === tileReplacementQueue.tail) {
  181859. tileReplacementQueue.tail = previous;
  181860. } else {
  181861. next.replacementPrevious = previous;
  181862. }
  181863. item.replacementPrevious = void 0;
  181864. item.replacementNext = void 0;
  181865. --tileReplacementQueue.count;
  181866. }
  181867. TileReplacementQueue.prototype.markTileRendered = function(item) {
  181868. const head = this.head;
  181869. if (head === item) {
  181870. if (item === this._lastBeforeStartOfFrame) {
  181871. this._lastBeforeStartOfFrame = item.replacementNext;
  181872. }
  181873. return;
  181874. }
  181875. ++this.count;
  181876. if (!defined_default(head)) {
  181877. item.replacementPrevious = void 0;
  181878. item.replacementNext = void 0;
  181879. this.head = item;
  181880. this.tail = item;
  181881. return;
  181882. }
  181883. if (defined_default(item.replacementPrevious) || defined_default(item.replacementNext)) {
  181884. remove3(this, item);
  181885. }
  181886. item.replacementPrevious = void 0;
  181887. item.replacementNext = head;
  181888. head.replacementPrevious = item;
  181889. this.head = item;
  181890. };
  181891. var TileReplacementQueue_default = TileReplacementQueue;
  181892. // node_modules/cesium/Source/Scene/QuadtreePrimitive.js
  181893. function QuadtreePrimitive(options) {
  181894. if (!defined_default(options) || !defined_default(options.tileProvider)) {
  181895. throw new DeveloperError_default("options.tileProvider is required.");
  181896. }
  181897. if (defined_default(options.tileProvider.quadtree)) {
  181898. throw new DeveloperError_default(
  181899. "A QuadtreeTileProvider can only be used with a single QuadtreePrimitive"
  181900. );
  181901. }
  181902. this._tileProvider = options.tileProvider;
  181903. this._tileProvider.quadtree = this;
  181904. this._debug = {
  181905. enableDebugOutput: false,
  181906. maxDepth: 0,
  181907. maxDepthVisited: 0,
  181908. tilesVisited: 0,
  181909. tilesCulled: 0,
  181910. tilesRendered: 0,
  181911. tilesWaitingForChildren: 0,
  181912. lastMaxDepth: -1,
  181913. lastMaxDepthVisited: -1,
  181914. lastTilesVisited: -1,
  181915. lastTilesCulled: -1,
  181916. lastTilesRendered: -1,
  181917. lastTilesWaitingForChildren: -1,
  181918. suspendLodUpdate: false
  181919. };
  181920. const tilingScheme2 = this._tileProvider.tilingScheme;
  181921. const ellipsoid = tilingScheme2.ellipsoid;
  181922. this._tilesToRender = [];
  181923. this._tileLoadQueueHigh = [];
  181924. this._tileLoadQueueMedium = [];
  181925. this._tileLoadQueueLow = [];
  181926. this._tileReplacementQueue = new TileReplacementQueue_default();
  181927. this._levelZeroTiles = void 0;
  181928. this._loadQueueTimeSlice = 5;
  181929. this._tilesInvalidated = false;
  181930. this._addHeightCallbacks = [];
  181931. this._removeHeightCallbacks = [];
  181932. this._tileToUpdateHeights = [];
  181933. this._lastTileIndex = 0;
  181934. this._updateHeightsTimeSlice = 2;
  181935. this._cameraPositionCartographic = void 0;
  181936. this._cameraReferenceFrameOriginCartographic = void 0;
  181937. this.maximumScreenSpaceError = defaultValue_default(
  181938. options.maximumScreenSpaceError,
  181939. 2
  181940. );
  181941. this.tileCacheSize = defaultValue_default(options.tileCacheSize, 100);
  181942. this.loadingDescendantLimit = 20;
  181943. this.preloadAncestors = true;
  181944. this.preloadSiblings = false;
  181945. this._occluders = new QuadtreeOccluders_default({
  181946. ellipsoid
  181947. });
  181948. this._tileLoadProgressEvent = new Event_default();
  181949. this._lastTileLoadQueueLength = 0;
  181950. this._lastSelectionFrameNumber = void 0;
  181951. }
  181952. Object.defineProperties(QuadtreePrimitive.prototype, {
  181953. tileProvider: {
  181954. get: function() {
  181955. return this._tileProvider;
  181956. }
  181957. },
  181958. tileLoadProgressEvent: {
  181959. get: function() {
  181960. return this._tileLoadProgressEvent;
  181961. }
  181962. },
  181963. occluders: {
  181964. get: function() {
  181965. return this._occluders;
  181966. }
  181967. }
  181968. });
  181969. QuadtreePrimitive.prototype.invalidateAllTiles = function() {
  181970. this._tilesInvalidated = true;
  181971. };
  181972. function invalidateAllTiles(primitive) {
  181973. const replacementQueue = primitive._tileReplacementQueue;
  181974. replacementQueue.head = void 0;
  181975. replacementQueue.tail = void 0;
  181976. replacementQueue.count = 0;
  181977. clearTileLoadQueue(primitive);
  181978. const levelZeroTiles = primitive._levelZeroTiles;
  181979. if (defined_default(levelZeroTiles)) {
  181980. for (let i2 = 0; i2 < levelZeroTiles.length; ++i2) {
  181981. const tile = levelZeroTiles[i2];
  181982. const customData = tile.customData;
  181983. const customDataLength = customData.length;
  181984. for (let j = 0; j < customDataLength; ++j) {
  181985. const data = customData[j];
  181986. data.level = 0;
  181987. primitive._addHeightCallbacks.push(data);
  181988. }
  181989. levelZeroTiles[i2].freeResources();
  181990. }
  181991. }
  181992. primitive._levelZeroTiles = void 0;
  181993. primitive._tileProvider.cancelReprojections();
  181994. }
  181995. QuadtreePrimitive.prototype.forEachLoadedTile = function(tileFunction) {
  181996. let tile = this._tileReplacementQueue.head;
  181997. while (defined_default(tile)) {
  181998. if (tile.state !== QuadtreeTileLoadState_default.START) {
  181999. tileFunction(tile);
  182000. }
  182001. tile = tile.replacementNext;
  182002. }
  182003. };
  182004. QuadtreePrimitive.prototype.forEachRenderedTile = function(tileFunction) {
  182005. const tilesRendered = this._tilesToRender;
  182006. for (let i2 = 0, len = tilesRendered.length; i2 < len; ++i2) {
  182007. tileFunction(tilesRendered[i2]);
  182008. }
  182009. };
  182010. QuadtreePrimitive.prototype.updateHeight = function(cartographic2, callback) {
  182011. const primitive = this;
  182012. const object2 = {
  182013. positionOnEllipsoidSurface: void 0,
  182014. positionCartographic: cartographic2,
  182015. level: -1,
  182016. callback
  182017. };
  182018. object2.removeFunc = function() {
  182019. const addedCallbacks = primitive._addHeightCallbacks;
  182020. const length3 = addedCallbacks.length;
  182021. for (let i2 = 0; i2 < length3; ++i2) {
  182022. if (addedCallbacks[i2] === object2) {
  182023. addedCallbacks.splice(i2, 1);
  182024. break;
  182025. }
  182026. }
  182027. primitive._removeHeightCallbacks.push(object2);
  182028. if (object2.callback) {
  182029. object2.callback = void 0;
  182030. }
  182031. };
  182032. primitive._addHeightCallbacks.push(object2);
  182033. return object2.removeFunc;
  182034. };
  182035. QuadtreePrimitive.prototype.update = function(frameState) {
  182036. if (defined_default(this._tileProvider.update)) {
  182037. this._tileProvider.update(frameState);
  182038. }
  182039. };
  182040. function clearTileLoadQueue(primitive) {
  182041. const debug = primitive._debug;
  182042. debug.maxDepth = 0;
  182043. debug.maxDepthVisited = 0;
  182044. debug.tilesVisited = 0;
  182045. debug.tilesCulled = 0;
  182046. debug.tilesRendered = 0;
  182047. debug.tilesWaitingForChildren = 0;
  182048. primitive._tileLoadQueueHigh.length = 0;
  182049. primitive._tileLoadQueueMedium.length = 0;
  182050. primitive._tileLoadQueueLow.length = 0;
  182051. }
  182052. QuadtreePrimitive.prototype.beginFrame = function(frameState) {
  182053. const passes = frameState.passes;
  182054. if (!passes.render) {
  182055. return;
  182056. }
  182057. if (this._tilesInvalidated) {
  182058. invalidateAllTiles(this);
  182059. this._tilesInvalidated = false;
  182060. }
  182061. this._tileProvider.initialize(frameState);
  182062. clearTileLoadQueue(this);
  182063. if (this._debug.suspendLodUpdate) {
  182064. return;
  182065. }
  182066. this._tileReplacementQueue.markStartOfRenderFrame();
  182067. };
  182068. QuadtreePrimitive.prototype.render = function(frameState) {
  182069. const passes = frameState.passes;
  182070. const tileProvider = this._tileProvider;
  182071. if (passes.render) {
  182072. tileProvider.beginUpdate(frameState);
  182073. selectTilesForRendering(this, frameState);
  182074. createRenderCommandsForSelectedTiles(this, frameState);
  182075. tileProvider.endUpdate(frameState);
  182076. }
  182077. if (passes.pick && this._tilesToRender.length > 0) {
  182078. tileProvider.updateForPick(frameState);
  182079. }
  182080. };
  182081. function updateTileLoadProgress(primitive, frameState) {
  182082. const currentLoadQueueLength = primitive._tileLoadQueueHigh.length + primitive._tileLoadQueueMedium.length + primitive._tileLoadQueueLow.length;
  182083. if (currentLoadQueueLength !== primitive._lastTileLoadQueueLength || primitive._tilesInvalidated) {
  182084. frameState.afterRender.push(
  182085. Event_default.prototype.raiseEvent.bind(
  182086. primitive._tileLoadProgressEvent,
  182087. currentLoadQueueLength
  182088. )
  182089. );
  182090. primitive._lastTileLoadQueueLength = currentLoadQueueLength;
  182091. }
  182092. const debug = primitive._debug;
  182093. if (debug.enableDebugOutput && !debug.suspendLodUpdate) {
  182094. debug.maxDepth = primitive._tilesToRender.reduce(function(max3, tile) {
  182095. return Math.max(max3, tile.level);
  182096. }, -1);
  182097. debug.tilesRendered = primitive._tilesToRender.length;
  182098. if (debug.tilesVisited !== debug.lastTilesVisited || debug.tilesRendered !== debug.lastTilesRendered || debug.tilesCulled !== debug.lastTilesCulled || debug.maxDepth !== debug.lastMaxDepth || debug.tilesWaitingForChildren !== debug.lastTilesWaitingForChildren || debug.maxDepthVisited !== debug.lastMaxDepthVisited) {
  182099. console.log(
  182100. `Visited ${debug.tilesVisited}, Rendered: ${debug.tilesRendered}, Culled: ${debug.tilesCulled}, Max Depth Rendered: ${debug.maxDepth}, Max Depth Visited: ${debug.maxDepthVisited}, Waiting for children: ${debug.tilesWaitingForChildren}`
  182101. );
  182102. debug.lastTilesVisited = debug.tilesVisited;
  182103. debug.lastTilesRendered = debug.tilesRendered;
  182104. debug.lastTilesCulled = debug.tilesCulled;
  182105. debug.lastMaxDepth = debug.maxDepth;
  182106. debug.lastTilesWaitingForChildren = debug.tilesWaitingForChildren;
  182107. debug.lastMaxDepthVisited = debug.maxDepthVisited;
  182108. }
  182109. }
  182110. }
  182111. QuadtreePrimitive.prototype.endFrame = function(frameState) {
  182112. const passes = frameState.passes;
  182113. if (!passes.render || frameState.mode === SceneMode_default.MORPHING) {
  182114. return;
  182115. }
  182116. processTileLoadQueue(this, frameState);
  182117. updateHeights2(this, frameState);
  182118. updateTileLoadProgress(this, frameState);
  182119. };
  182120. QuadtreePrimitive.prototype.isDestroyed = function() {
  182121. return false;
  182122. };
  182123. QuadtreePrimitive.prototype.destroy = function() {
  182124. this._tileProvider = this._tileProvider && this._tileProvider.destroy();
  182125. };
  182126. var comparisonPoint;
  182127. var centerScratch6 = new Cartographic_default();
  182128. function compareDistanceToPoint(a4, b) {
  182129. let center = Rectangle_default.center(a4.rectangle, centerScratch6);
  182130. const alon = center.longitude - comparisonPoint.longitude;
  182131. const alat = center.latitude - comparisonPoint.latitude;
  182132. center = Rectangle_default.center(b.rectangle, centerScratch6);
  182133. const blon = center.longitude - comparisonPoint.longitude;
  182134. const blat = center.latitude - comparisonPoint.latitude;
  182135. return alon * alon + alat * alat - (blon * blon + blat * blat);
  182136. }
  182137. var cameraOriginScratch = new Cartesian3_default();
  182138. var rootTraversalDetails = [];
  182139. function selectTilesForRendering(primitive, frameState) {
  182140. const debug = primitive._debug;
  182141. if (debug.suspendLodUpdate) {
  182142. return;
  182143. }
  182144. const tilesToRender = primitive._tilesToRender;
  182145. tilesToRender.length = 0;
  182146. let i2;
  182147. const tileProvider = primitive._tileProvider;
  182148. if (!defined_default(primitive._levelZeroTiles)) {
  182149. if (tileProvider.ready) {
  182150. const tilingScheme2 = tileProvider.tilingScheme;
  182151. primitive._levelZeroTiles = QuadtreeTile_default.createLevelZeroTiles(
  182152. tilingScheme2
  182153. );
  182154. const numberOfRootTiles = primitive._levelZeroTiles.length;
  182155. if (rootTraversalDetails.length < numberOfRootTiles) {
  182156. rootTraversalDetails = new Array(numberOfRootTiles);
  182157. for (i2 = 0; i2 < numberOfRootTiles; ++i2) {
  182158. if (rootTraversalDetails[i2] === void 0) {
  182159. rootTraversalDetails[i2] = new TraversalDetails();
  182160. }
  182161. }
  182162. }
  182163. } else {
  182164. return;
  182165. }
  182166. }
  182167. primitive._occluders.ellipsoid.cameraPosition = frameState.camera.positionWC;
  182168. let tile;
  182169. const levelZeroTiles = primitive._levelZeroTiles;
  182170. const occluders = levelZeroTiles.length > 1 ? primitive._occluders : void 0;
  182171. comparisonPoint = frameState.camera.positionCartographic;
  182172. levelZeroTiles.sort(compareDistanceToPoint);
  182173. const customDataAdded = primitive._addHeightCallbacks;
  182174. const customDataRemoved = primitive._removeHeightCallbacks;
  182175. const frameNumber = frameState.frameNumber;
  182176. let len;
  182177. if (customDataAdded.length > 0 || customDataRemoved.length > 0) {
  182178. for (i2 = 0, len = levelZeroTiles.length; i2 < len; ++i2) {
  182179. tile = levelZeroTiles[i2];
  182180. tile._updateCustomData(frameNumber, customDataAdded, customDataRemoved);
  182181. }
  182182. customDataAdded.length = 0;
  182183. customDataRemoved.length = 0;
  182184. }
  182185. const camera = frameState.camera;
  182186. primitive._cameraPositionCartographic = camera.positionCartographic;
  182187. const cameraFrameOrigin = Matrix4_default.getTranslation(
  182188. camera.transform,
  182189. cameraOriginScratch
  182190. );
  182191. primitive._cameraReferenceFrameOriginCartographic = primitive.tileProvider.tilingScheme.ellipsoid.cartesianToCartographic(
  182192. cameraFrameOrigin,
  182193. primitive._cameraReferenceFrameOriginCartographic
  182194. );
  182195. for (i2 = 0, len = levelZeroTiles.length; i2 < len; ++i2) {
  182196. tile = levelZeroTiles[i2];
  182197. primitive._tileReplacementQueue.markTileRendered(tile);
  182198. if (!tile.renderable) {
  182199. queueTileLoad(primitive, primitive._tileLoadQueueHigh, tile, frameState);
  182200. ++debug.tilesWaitingForChildren;
  182201. } else {
  182202. visitIfVisible(
  182203. primitive,
  182204. tile,
  182205. tileProvider,
  182206. frameState,
  182207. occluders,
  182208. false,
  182209. rootTraversalDetails[i2]
  182210. );
  182211. }
  182212. }
  182213. primitive._lastSelectionFrameNumber = frameNumber;
  182214. }
  182215. function queueTileLoad(primitive, queue, tile, frameState) {
  182216. if (!tile.needsLoading) {
  182217. return;
  182218. }
  182219. if (primitive.tileProvider.computeTileLoadPriority !== void 0) {
  182220. tile._loadPriority = primitive.tileProvider.computeTileLoadPriority(
  182221. tile,
  182222. frameState
  182223. );
  182224. }
  182225. queue.push(tile);
  182226. }
  182227. function TraversalDetails() {
  182228. this.allAreRenderable = true;
  182229. this.anyWereRenderedLastFrame = false;
  182230. this.notYetRenderableCount = 0;
  182231. }
  182232. function TraversalQuadDetails() {
  182233. this.southwest = new TraversalDetails();
  182234. this.southeast = new TraversalDetails();
  182235. this.northwest = new TraversalDetails();
  182236. this.northeast = new TraversalDetails();
  182237. }
  182238. TraversalQuadDetails.prototype.combine = function(result) {
  182239. const southwest = this.southwest;
  182240. const southeast = this.southeast;
  182241. const northwest = this.northwest;
  182242. const northeast = this.northeast;
  182243. result.allAreRenderable = southwest.allAreRenderable && southeast.allAreRenderable && northwest.allAreRenderable && northeast.allAreRenderable;
  182244. result.anyWereRenderedLastFrame = southwest.anyWereRenderedLastFrame || southeast.anyWereRenderedLastFrame || northwest.anyWereRenderedLastFrame || northeast.anyWereRenderedLastFrame;
  182245. result.notYetRenderableCount = southwest.notYetRenderableCount + southeast.notYetRenderableCount + northwest.notYetRenderableCount + northeast.notYetRenderableCount;
  182246. };
  182247. var traversalQuadsByLevel = new Array(31);
  182248. for (let i2 = 0; i2 < traversalQuadsByLevel.length; ++i2) {
  182249. traversalQuadsByLevel[i2] = new TraversalQuadDetails();
  182250. }
  182251. function visitTile4(primitive, frameState, tile, ancestorMeetsSse, traversalDetails) {
  182252. const debug = primitive._debug;
  182253. ++debug.tilesVisited;
  182254. primitive._tileReplacementQueue.markTileRendered(tile);
  182255. tile._updateCustomData(frameState.frameNumber);
  182256. if (tile.level > debug.maxDepthVisited) {
  182257. debug.maxDepthVisited = tile.level;
  182258. }
  182259. const meetsSse = screenSpaceError(primitive, frameState, tile) < primitive.maximumScreenSpaceError;
  182260. const southwestChild = tile.southwestChild;
  182261. const southeastChild = tile.southeastChild;
  182262. const northwestChild = tile.northwestChild;
  182263. const northeastChild = tile.northeastChild;
  182264. const lastFrame = primitive._lastSelectionFrameNumber;
  182265. const lastFrameSelectionResult = tile._lastSelectionResultFrame === lastFrame ? tile._lastSelectionResult : TileSelectionResult_default.NONE;
  182266. const tileProvider = primitive.tileProvider;
  182267. if (meetsSse || ancestorMeetsSse) {
  182268. const oneRenderedLastFrame = TileSelectionResult_default.originalResult(lastFrameSelectionResult) === TileSelectionResult_default.RENDERED;
  182269. const twoCulledOrNotVisited = TileSelectionResult_default.originalResult(lastFrameSelectionResult) === TileSelectionResult_default.CULLED || lastFrameSelectionResult === TileSelectionResult_default.NONE;
  182270. const threeCompletelyLoaded = tile.state === QuadtreeTileLoadState_default.DONE;
  182271. let renderable = oneRenderedLastFrame || twoCulledOrNotVisited || threeCompletelyLoaded;
  182272. if (!renderable) {
  182273. if (defined_default(tileProvider.canRenderWithoutLosingDetail)) {
  182274. renderable = tileProvider.canRenderWithoutLosingDetail(tile);
  182275. }
  182276. }
  182277. if (renderable) {
  182278. if (meetsSse) {
  182279. queueTileLoad(
  182280. primitive,
  182281. primitive._tileLoadQueueMedium,
  182282. tile,
  182283. frameState
  182284. );
  182285. }
  182286. addTileToRenderList(primitive, tile);
  182287. traversalDetails.allAreRenderable = tile.renderable;
  182288. traversalDetails.anyWereRenderedLastFrame = lastFrameSelectionResult === TileSelectionResult_default.RENDERED;
  182289. traversalDetails.notYetRenderableCount = tile.renderable ? 0 : 1;
  182290. tile._lastSelectionResultFrame = frameState.frameNumber;
  182291. tile._lastSelectionResult = TileSelectionResult_default.RENDERED;
  182292. if (!traversalDetails.anyWereRenderedLastFrame) {
  182293. primitive._tileToUpdateHeights.push(tile);
  182294. }
  182295. return;
  182296. }
  182297. ancestorMeetsSse = true;
  182298. if (meetsSse) {
  182299. queueTileLoad(primitive, primitive._tileLoadQueueHigh, tile, frameState);
  182300. }
  182301. }
  182302. if (tileProvider.canRefine(tile)) {
  182303. const allAreUpsampled = southwestChild.upsampledFromParent && southeastChild.upsampledFromParent && northwestChild.upsampledFromParent && northeastChild.upsampledFromParent;
  182304. if (allAreUpsampled) {
  182305. addTileToRenderList(primitive, tile);
  182306. queueTileLoad(
  182307. primitive,
  182308. primitive._tileLoadQueueMedium,
  182309. tile,
  182310. frameState
  182311. );
  182312. primitive._tileReplacementQueue.markTileRendered(southwestChild);
  182313. primitive._tileReplacementQueue.markTileRendered(southeastChild);
  182314. primitive._tileReplacementQueue.markTileRendered(northwestChild);
  182315. primitive._tileReplacementQueue.markTileRendered(northeastChild);
  182316. traversalDetails.allAreRenderable = tile.renderable;
  182317. traversalDetails.anyWereRenderedLastFrame = lastFrameSelectionResult === TileSelectionResult_default.RENDERED;
  182318. traversalDetails.notYetRenderableCount = tile.renderable ? 0 : 1;
  182319. tile._lastSelectionResultFrame = frameState.frameNumber;
  182320. tile._lastSelectionResult = TileSelectionResult_default.RENDERED;
  182321. if (!traversalDetails.anyWereRenderedLastFrame) {
  182322. primitive._tileToUpdateHeights.push(tile);
  182323. }
  182324. return;
  182325. }
  182326. tile._lastSelectionResultFrame = frameState.frameNumber;
  182327. tile._lastSelectionResult = TileSelectionResult_default.REFINED;
  182328. const firstRenderedDescendantIndex = primitive._tilesToRender.length;
  182329. const loadIndexLow = primitive._tileLoadQueueLow.length;
  182330. const loadIndexMedium = primitive._tileLoadQueueMedium.length;
  182331. const loadIndexHigh = primitive._tileLoadQueueHigh.length;
  182332. const tilesToUpdateHeightsIndex = primitive._tileToUpdateHeights.length;
  182333. visitVisibleChildrenNearToFar(
  182334. primitive,
  182335. southwestChild,
  182336. southeastChild,
  182337. northwestChild,
  182338. northeastChild,
  182339. frameState,
  182340. ancestorMeetsSse,
  182341. traversalDetails
  182342. );
  182343. if (firstRenderedDescendantIndex !== primitive._tilesToRender.length) {
  182344. const allAreRenderable = traversalDetails.allAreRenderable;
  182345. const anyWereRenderedLastFrame = traversalDetails.anyWereRenderedLastFrame;
  182346. const notYetRenderableCount = traversalDetails.notYetRenderableCount;
  182347. let queuedForLoad = false;
  182348. if (!allAreRenderable && !anyWereRenderedLastFrame) {
  182349. const renderList = primitive._tilesToRender;
  182350. for (let i2 = firstRenderedDescendantIndex; i2 < renderList.length; ++i2) {
  182351. let workTile = renderList[i2];
  182352. while (workTile !== void 0 && workTile._lastSelectionResult !== TileSelectionResult_default.KICKED && workTile !== tile) {
  182353. workTile._lastSelectionResult = TileSelectionResult_default.kick(
  182354. workTile._lastSelectionResult
  182355. );
  182356. workTile = workTile.parent;
  182357. }
  182358. }
  182359. primitive._tilesToRender.length = firstRenderedDescendantIndex;
  182360. primitive._tileToUpdateHeights.length = tilesToUpdateHeightsIndex;
  182361. addTileToRenderList(primitive, tile);
  182362. tile._lastSelectionResult = TileSelectionResult_default.RENDERED;
  182363. const wasRenderedLastFrame = lastFrameSelectionResult === TileSelectionResult_default.RENDERED;
  182364. if (!wasRenderedLastFrame && notYetRenderableCount > primitive.loadingDescendantLimit) {
  182365. primitive._tileLoadQueueLow.length = loadIndexLow;
  182366. primitive._tileLoadQueueMedium.length = loadIndexMedium;
  182367. primitive._tileLoadQueueHigh.length = loadIndexHigh;
  182368. queueTileLoad(
  182369. primitive,
  182370. primitive._tileLoadQueueMedium,
  182371. tile,
  182372. frameState
  182373. );
  182374. traversalDetails.notYetRenderableCount = tile.renderable ? 0 : 1;
  182375. queuedForLoad = true;
  182376. }
  182377. traversalDetails.allAreRenderable = tile.renderable;
  182378. traversalDetails.anyWereRenderedLastFrame = wasRenderedLastFrame;
  182379. if (!wasRenderedLastFrame) {
  182380. primitive._tileToUpdateHeights.push(tile);
  182381. }
  182382. ++debug.tilesWaitingForChildren;
  182383. }
  182384. if (primitive.preloadAncestors && !queuedForLoad) {
  182385. queueTileLoad(primitive, primitive._tileLoadQueueLow, tile, frameState);
  182386. }
  182387. }
  182388. return;
  182389. }
  182390. tile._lastSelectionResultFrame = frameState.frameNumber;
  182391. tile._lastSelectionResult = TileSelectionResult_default.RENDERED;
  182392. addTileToRenderList(primitive, tile);
  182393. queueTileLoad(primitive, primitive._tileLoadQueueHigh, tile, frameState);
  182394. traversalDetails.allAreRenderable = tile.renderable;
  182395. traversalDetails.anyWereRenderedLastFrame = lastFrameSelectionResult === TileSelectionResult_default.RENDERED;
  182396. traversalDetails.notYetRenderableCount = tile.renderable ? 0 : 1;
  182397. }
  182398. function visitVisibleChildrenNearToFar(primitive, southwest, southeast, northwest, northeast, frameState, ancestorMeetsSse, traversalDetails) {
  182399. const cameraPosition = frameState.camera.positionCartographic;
  182400. const tileProvider = primitive._tileProvider;
  182401. const occluders = primitive._occluders;
  182402. const quadDetails = traversalQuadsByLevel[southwest.level];
  182403. const southwestDetails = quadDetails.southwest;
  182404. const southeastDetails = quadDetails.southeast;
  182405. const northwestDetails = quadDetails.northwest;
  182406. const northeastDetails = quadDetails.northeast;
  182407. if (cameraPosition.longitude < southwest.rectangle.east) {
  182408. if (cameraPosition.latitude < southwest.rectangle.north) {
  182409. visitIfVisible(
  182410. primitive,
  182411. southwest,
  182412. tileProvider,
  182413. frameState,
  182414. occluders,
  182415. ancestorMeetsSse,
  182416. southwestDetails
  182417. );
  182418. visitIfVisible(
  182419. primitive,
  182420. southeast,
  182421. tileProvider,
  182422. frameState,
  182423. occluders,
  182424. ancestorMeetsSse,
  182425. southeastDetails
  182426. );
  182427. visitIfVisible(
  182428. primitive,
  182429. northwest,
  182430. tileProvider,
  182431. frameState,
  182432. occluders,
  182433. ancestorMeetsSse,
  182434. northwestDetails
  182435. );
  182436. visitIfVisible(
  182437. primitive,
  182438. northeast,
  182439. tileProvider,
  182440. frameState,
  182441. occluders,
  182442. ancestorMeetsSse,
  182443. northeastDetails
  182444. );
  182445. } else {
  182446. visitIfVisible(
  182447. primitive,
  182448. northwest,
  182449. tileProvider,
  182450. frameState,
  182451. occluders,
  182452. ancestorMeetsSse,
  182453. northwestDetails
  182454. );
  182455. visitIfVisible(
  182456. primitive,
  182457. southwest,
  182458. tileProvider,
  182459. frameState,
  182460. occluders,
  182461. ancestorMeetsSse,
  182462. southwestDetails
  182463. );
  182464. visitIfVisible(
  182465. primitive,
  182466. northeast,
  182467. tileProvider,
  182468. frameState,
  182469. occluders,
  182470. ancestorMeetsSse,
  182471. northeastDetails
  182472. );
  182473. visitIfVisible(
  182474. primitive,
  182475. southeast,
  182476. tileProvider,
  182477. frameState,
  182478. occluders,
  182479. ancestorMeetsSse,
  182480. southeastDetails
  182481. );
  182482. }
  182483. } else if (cameraPosition.latitude < southwest.rectangle.north) {
  182484. visitIfVisible(
  182485. primitive,
  182486. southeast,
  182487. tileProvider,
  182488. frameState,
  182489. occluders,
  182490. ancestorMeetsSse,
  182491. southeastDetails
  182492. );
  182493. visitIfVisible(
  182494. primitive,
  182495. southwest,
  182496. tileProvider,
  182497. frameState,
  182498. occluders,
  182499. ancestorMeetsSse,
  182500. southwestDetails
  182501. );
  182502. visitIfVisible(
  182503. primitive,
  182504. northeast,
  182505. tileProvider,
  182506. frameState,
  182507. occluders,
  182508. ancestorMeetsSse,
  182509. northeastDetails
  182510. );
  182511. visitIfVisible(
  182512. primitive,
  182513. northwest,
  182514. tileProvider,
  182515. frameState,
  182516. occluders,
  182517. ancestorMeetsSse,
  182518. northwestDetails
  182519. );
  182520. } else {
  182521. visitIfVisible(
  182522. primitive,
  182523. northeast,
  182524. tileProvider,
  182525. frameState,
  182526. occluders,
  182527. ancestorMeetsSse,
  182528. northeastDetails
  182529. );
  182530. visitIfVisible(
  182531. primitive,
  182532. northwest,
  182533. tileProvider,
  182534. frameState,
  182535. occluders,
  182536. ancestorMeetsSse,
  182537. northwestDetails
  182538. );
  182539. visitIfVisible(
  182540. primitive,
  182541. southeast,
  182542. tileProvider,
  182543. frameState,
  182544. occluders,
  182545. ancestorMeetsSse,
  182546. southeastDetails
  182547. );
  182548. visitIfVisible(
  182549. primitive,
  182550. southwest,
  182551. tileProvider,
  182552. frameState,
  182553. occluders,
  182554. ancestorMeetsSse,
  182555. southwestDetails
  182556. );
  182557. }
  182558. quadDetails.combine(traversalDetails);
  182559. }
  182560. function containsNeededPosition(primitive, tile) {
  182561. const rectangle = tile.rectangle;
  182562. return defined_default(primitive._cameraPositionCartographic) && Rectangle_default.contains(rectangle, primitive._cameraPositionCartographic) || defined_default(primitive._cameraReferenceFrameOriginCartographic) && Rectangle_default.contains(
  182563. rectangle,
  182564. primitive._cameraReferenceFrameOriginCartographic
  182565. );
  182566. }
  182567. function visitIfVisible(primitive, tile, tileProvider, frameState, occluders, ancestorMeetsSse, traversalDetails) {
  182568. if (tileProvider.computeTileVisibility(tile, frameState, occluders) !== Visibility_default.NONE) {
  182569. return visitTile4(
  182570. primitive,
  182571. frameState,
  182572. tile,
  182573. ancestorMeetsSse,
  182574. traversalDetails
  182575. );
  182576. }
  182577. ++primitive._debug.tilesCulled;
  182578. primitive._tileReplacementQueue.markTileRendered(tile);
  182579. traversalDetails.allAreRenderable = true;
  182580. traversalDetails.anyWereRenderedLastFrame = false;
  182581. traversalDetails.notYetRenderableCount = 0;
  182582. if (containsNeededPosition(primitive, tile)) {
  182583. if (!defined_default(tile.data) || !defined_default(tile.data.vertexArray)) {
  182584. queueTileLoad(
  182585. primitive,
  182586. primitive._tileLoadQueueMedium,
  182587. tile,
  182588. frameState
  182589. );
  182590. }
  182591. const lastFrame = primitive._lastSelectionFrameNumber;
  182592. const lastFrameSelectionResult = tile._lastSelectionResultFrame === lastFrame ? tile._lastSelectionResult : TileSelectionResult_default.NONE;
  182593. if (lastFrameSelectionResult !== TileSelectionResult_default.CULLED_BUT_NEEDED && lastFrameSelectionResult !== TileSelectionResult_default.RENDERED) {
  182594. primitive._tileToUpdateHeights.push(tile);
  182595. }
  182596. tile._lastSelectionResult = TileSelectionResult_default.CULLED_BUT_NEEDED;
  182597. } else if (primitive.preloadSiblings || tile.level === 0) {
  182598. queueTileLoad(primitive, primitive._tileLoadQueueLow, tile, frameState);
  182599. tile._lastSelectionResult = TileSelectionResult_default.CULLED;
  182600. } else {
  182601. tile._lastSelectionResult = TileSelectionResult_default.CULLED;
  182602. }
  182603. tile._lastSelectionResultFrame = frameState.frameNumber;
  182604. }
  182605. function screenSpaceError(primitive, frameState, tile) {
  182606. if (frameState.mode === SceneMode_default.SCENE2D || frameState.camera.frustum instanceof OrthographicFrustum_default || frameState.camera.frustum instanceof OrthographicOffCenterFrustum_default) {
  182607. return screenSpaceError2D(primitive, frameState, tile);
  182608. }
  182609. const maxGeometricError = primitive._tileProvider.getLevelMaximumGeometricError(
  182610. tile.level
  182611. );
  182612. const distance2 = tile._distance;
  182613. const height = frameState.context.drawingBufferHeight;
  182614. const sseDenominator = frameState.camera.frustum.sseDenominator;
  182615. let error = maxGeometricError * height / (distance2 * sseDenominator);
  182616. if (frameState.fog.enabled) {
  182617. error -= Math_default.fog(distance2, frameState.fog.density) * frameState.fog.sse;
  182618. }
  182619. error /= frameState.pixelRatio;
  182620. return error;
  182621. }
  182622. function screenSpaceError2D(primitive, frameState, tile) {
  182623. const camera = frameState.camera;
  182624. let frustum = camera.frustum;
  182625. if (defined_default(frustum._offCenterFrustum)) {
  182626. frustum = frustum._offCenterFrustum;
  182627. }
  182628. const context = frameState.context;
  182629. const width = context.drawingBufferWidth;
  182630. const height = context.drawingBufferHeight;
  182631. const maxGeometricError = primitive._tileProvider.getLevelMaximumGeometricError(
  182632. tile.level
  182633. );
  182634. const pixelSize = Math.max(frustum.top - frustum.bottom, frustum.right - frustum.left) / Math.max(width, height);
  182635. let error = maxGeometricError / pixelSize;
  182636. if (frameState.fog.enabled && frameState.mode !== SceneMode_default.SCENE2D) {
  182637. error -= Math_default.fog(tile._distance, frameState.fog.density) * frameState.fog.sse;
  182638. }
  182639. error /= frameState.pixelRatio;
  182640. return error;
  182641. }
  182642. function addTileToRenderList(primitive, tile) {
  182643. primitive._tilesToRender.push(tile);
  182644. }
  182645. function processTileLoadQueue(primitive, frameState) {
  182646. const tileLoadQueueHigh = primitive._tileLoadQueueHigh;
  182647. const tileLoadQueueMedium = primitive._tileLoadQueueMedium;
  182648. const tileLoadQueueLow = primitive._tileLoadQueueLow;
  182649. if (tileLoadQueueHigh.length === 0 && tileLoadQueueMedium.length === 0 && tileLoadQueueLow.length === 0) {
  182650. return;
  182651. }
  182652. primitive._tileReplacementQueue.trimTiles(primitive.tileCacheSize);
  182653. const endTime = getTimestamp_default() + primitive._loadQueueTimeSlice;
  182654. const tileProvider = primitive._tileProvider;
  182655. let didSomeLoading = processSinglePriorityLoadQueue(
  182656. primitive,
  182657. frameState,
  182658. tileProvider,
  182659. endTime,
  182660. tileLoadQueueHigh,
  182661. false
  182662. );
  182663. didSomeLoading = processSinglePriorityLoadQueue(
  182664. primitive,
  182665. frameState,
  182666. tileProvider,
  182667. endTime,
  182668. tileLoadQueueMedium,
  182669. didSomeLoading
  182670. );
  182671. processSinglePriorityLoadQueue(
  182672. primitive,
  182673. frameState,
  182674. tileProvider,
  182675. endTime,
  182676. tileLoadQueueLow,
  182677. didSomeLoading
  182678. );
  182679. }
  182680. function sortByLoadPriority(a4, b) {
  182681. return a4._loadPriority - b._loadPriority;
  182682. }
  182683. function processSinglePriorityLoadQueue(primitive, frameState, tileProvider, endTime, loadQueue, didSomeLoading) {
  182684. if (tileProvider.computeTileLoadPriority !== void 0) {
  182685. loadQueue.sort(sortByLoadPriority);
  182686. }
  182687. for (let i2 = 0, len = loadQueue.length; i2 < len && (getTimestamp_default() < endTime || !didSomeLoading); ++i2) {
  182688. const tile = loadQueue[i2];
  182689. primitive._tileReplacementQueue.markTileRendered(tile);
  182690. tileProvider.loadTile(frameState, tile);
  182691. didSomeLoading = true;
  182692. }
  182693. return didSomeLoading;
  182694. }
  182695. var scratchRay = new Ray_default();
  182696. var scratchCartographic18 = new Cartographic_default();
  182697. var scratchPosition14 = new Cartesian3_default();
  182698. var scratchArray = [];
  182699. function updateHeights2(primitive, frameState) {
  182700. if (!primitive.tileProvider.ready) {
  182701. return;
  182702. }
  182703. const tryNextFrame = scratchArray;
  182704. tryNextFrame.length = 0;
  182705. const tilesToUpdateHeights = primitive._tileToUpdateHeights;
  182706. const startTime = getTimestamp_default();
  182707. const timeSlice = primitive._updateHeightsTimeSlice;
  182708. const endTime = startTime + timeSlice;
  182709. const mode2 = frameState.mode;
  182710. const projection = frameState.mapProjection;
  182711. const ellipsoid = primitive.tileProvider.tilingScheme.ellipsoid;
  182712. let i2;
  182713. while (tilesToUpdateHeights.length > 0) {
  182714. const tile = tilesToUpdateHeights[0];
  182715. if (!defined_default(tile.data) || !defined_default(tile.data.mesh)) {
  182716. const selectionResult = tile._lastSelectionResultFrame === primitive._lastSelectionFrameNumber ? tile._lastSelectionResult : TileSelectionResult_default.NONE;
  182717. if (selectionResult === TileSelectionResult_default.RENDERED || selectionResult === TileSelectionResult_default.CULLED_BUT_NEEDED) {
  182718. tryNextFrame.push(tile);
  182719. }
  182720. tilesToUpdateHeights.shift();
  182721. primitive._lastTileIndex = 0;
  182722. continue;
  182723. }
  182724. const customData = tile.customData;
  182725. const customDataLength = customData.length;
  182726. let timeSliceMax = false;
  182727. for (i2 = primitive._lastTileIndex; i2 < customDataLength; ++i2) {
  182728. const data = customData[i2];
  182729. const terrainData = tile.data.terrainData;
  182730. const upsampledGeometryFromParent = defined_default(terrainData) && terrainData.wasCreatedByUpsampling();
  182731. if (tile.level > data.level && !upsampledGeometryFromParent) {
  182732. if (!defined_default(data.positionOnEllipsoidSurface)) {
  182733. data.positionOnEllipsoidSurface = Cartesian3_default.fromRadians(
  182734. data.positionCartographic.longitude,
  182735. data.positionCartographic.latitude,
  182736. 0,
  182737. ellipsoid
  182738. );
  182739. }
  182740. if (mode2 === SceneMode_default.SCENE3D) {
  182741. const surfaceNormal = ellipsoid.geodeticSurfaceNormal(
  182742. data.positionOnEllipsoidSurface,
  182743. scratchRay.direction
  182744. );
  182745. const rayOrigin = ellipsoid.getSurfaceNormalIntersectionWithZAxis(
  182746. data.positionOnEllipsoidSurface,
  182747. 11500,
  182748. scratchRay.origin
  182749. );
  182750. if (!defined_default(rayOrigin)) {
  182751. let minimumHeight = 0;
  182752. if (defined_default(tile.data.tileBoundingRegion)) {
  182753. minimumHeight = tile.data.tileBoundingRegion.minimumHeight;
  182754. }
  182755. const magnitude = Math.min(minimumHeight, -11500);
  182756. const vectorToMinimumPoint = Cartesian3_default.multiplyByScalar(
  182757. surfaceNormal,
  182758. Math.abs(magnitude) + 1,
  182759. scratchPosition14
  182760. );
  182761. Cartesian3_default.subtract(
  182762. data.positionOnEllipsoidSurface,
  182763. vectorToMinimumPoint,
  182764. scratchRay.origin
  182765. );
  182766. }
  182767. } else {
  182768. Cartographic_default.clone(data.positionCartographic, scratchCartographic18);
  182769. scratchCartographic18.height = -11500;
  182770. projection.project(scratchCartographic18, scratchPosition14);
  182771. Cartesian3_default.fromElements(
  182772. scratchPosition14.z,
  182773. scratchPosition14.x,
  182774. scratchPosition14.y,
  182775. scratchPosition14
  182776. );
  182777. Cartesian3_default.clone(scratchPosition14, scratchRay.origin);
  182778. Cartesian3_default.clone(Cartesian3_default.UNIT_X, scratchRay.direction);
  182779. }
  182780. const position = tile.data.pick(
  182781. scratchRay,
  182782. mode2,
  182783. projection,
  182784. false,
  182785. scratchPosition14
  182786. );
  182787. if (defined_default(position)) {
  182788. if (defined_default(data.callback)) {
  182789. data.callback(position);
  182790. }
  182791. data.level = tile.level;
  182792. }
  182793. }
  182794. if (getTimestamp_default() >= endTime) {
  182795. timeSliceMax = true;
  182796. break;
  182797. }
  182798. }
  182799. if (timeSliceMax) {
  182800. primitive._lastTileIndex = i2;
  182801. break;
  182802. } else {
  182803. primitive._lastTileIndex = 0;
  182804. tilesToUpdateHeights.shift();
  182805. }
  182806. }
  182807. for (i2 = 0; i2 < tryNextFrame.length; i2++) {
  182808. tilesToUpdateHeights.push(tryNextFrame[i2]);
  182809. }
  182810. }
  182811. function createRenderCommandsForSelectedTiles(primitive, frameState) {
  182812. const tileProvider = primitive._tileProvider;
  182813. const tilesToRender = primitive._tilesToRender;
  182814. for (let i2 = 0, len = tilesToRender.length; i2 < len; ++i2) {
  182815. const tile = tilesToRender[i2];
  182816. tileProvider.showTileThisFrame(tile, frameState);
  182817. }
  182818. }
  182819. var QuadtreePrimitive_default = QuadtreePrimitive;
  182820. // node_modules/cesium/Source/Scene/Globe.js
  182821. function Globe(ellipsoid) {
  182822. ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  182823. const terrainProvider = new EllipsoidTerrainProvider_default({
  182824. ellipsoid
  182825. });
  182826. const imageryLayerCollection = new ImageryLayerCollection_default();
  182827. this._ellipsoid = ellipsoid;
  182828. this._imageryLayerCollection = imageryLayerCollection;
  182829. this._surfaceShaderSet = new GlobeSurfaceShaderSet_default();
  182830. this._material = void 0;
  182831. this._surface = new QuadtreePrimitive_default({
  182832. tileProvider: new GlobeSurfaceTileProvider_default({
  182833. terrainProvider,
  182834. imageryLayers: imageryLayerCollection,
  182835. surfaceShaderSet: this._surfaceShaderSet
  182836. })
  182837. });
  182838. this._terrainProvider = terrainProvider;
  182839. this._terrainProviderChanged = new Event_default();
  182840. this._undergroundColor = Color_default.clone(Color_default.BLACK);
  182841. this._undergroundColorAlphaByDistance = new NearFarScalar_default(
  182842. ellipsoid.maximumRadius / 1e3,
  182843. 0,
  182844. ellipsoid.maximumRadius / 5,
  182845. 1
  182846. );
  182847. this._translucency = new GlobeTranslucency_default();
  182848. makeShadersDirty(this);
  182849. this.show = true;
  182850. this._oceanNormalMapResourceDirty = true;
  182851. this._oceanNormalMapResource = new Resource_default({
  182852. url: buildModuleUrl_default("Assets/Textures/waterNormalsSmall.jpg")
  182853. });
  182854. this.maximumScreenSpaceError = 2;
  182855. this.tileCacheSize = 100;
  182856. this.loadingDescendantLimit = 20;
  182857. this.preloadAncestors = true;
  182858. this.preloadSiblings = false;
  182859. this.fillHighlightColor = void 0;
  182860. this.enableLighting = false;
  182861. this.lambertDiffuseMultiplier = 0.9;
  182862. this.dynamicAtmosphereLighting = true;
  182863. this.dynamicAtmosphereLightingFromSun = false;
  182864. this.showGroundAtmosphere = true;
  182865. this.atmosphereLightIntensity = 10;
  182866. this.atmosphereRayleighCoefficient = new Cartesian3_default(55e-7, 13e-6, 284e-7);
  182867. this.atmosphereMieCoefficient = new Cartesian3_default(21e-6, 21e-6, 21e-6);
  182868. this.atmosphereRayleighScaleHeight = 1e4;
  182869. this.atmosphereMieScaleHeight = 3200;
  182870. this.atmosphereMieAnisotropy = 0.9;
  182871. this.lightingFadeOutDistance = 1e7;
  182872. this.lightingFadeInDistance = 2e7;
  182873. this.nightFadeOutDistance = 1e7;
  182874. this.nightFadeInDistance = 5e7;
  182875. this.showWaterEffect = true;
  182876. this.depthTestAgainstTerrain = false;
  182877. this.shadows = ShadowMode_default.RECEIVE_ONLY;
  182878. this.atmosphereHueShift = 0;
  182879. this.atmosphereSaturationShift = 0;
  182880. this.atmosphereBrightnessShift = 0;
  182881. this.terrainExaggeration = 1;
  182882. this.terrainExaggerationRelativeHeight = 0;
  182883. this.showSkirts = true;
  182884. this.backFaceCulling = true;
  182885. this._oceanNormalMap = void 0;
  182886. this._zoomedOutOceanSpecularIntensity = void 0;
  182887. }
  182888. Object.defineProperties(Globe.prototype, {
  182889. ellipsoid: {
  182890. get: function() {
  182891. return this._ellipsoid;
  182892. }
  182893. },
  182894. imageryLayers: {
  182895. get: function() {
  182896. return this._imageryLayerCollection;
  182897. }
  182898. },
  182899. imageryLayersUpdatedEvent: {
  182900. get: function() {
  182901. return this._surface.tileProvider.imageryLayersUpdatedEvent;
  182902. }
  182903. },
  182904. tilesLoaded: {
  182905. get: function() {
  182906. if (!defined_default(this._surface)) {
  182907. return true;
  182908. }
  182909. return this._surface.tileProvider.ready && this._surface._tileLoadQueueHigh.length === 0 && this._surface._tileLoadQueueMedium.length === 0 && this._surface._tileLoadQueueLow.length === 0;
  182910. }
  182911. },
  182912. baseColor: {
  182913. get: function() {
  182914. return this._surface.tileProvider.baseColor;
  182915. },
  182916. set: function(value) {
  182917. this._surface.tileProvider.baseColor = value;
  182918. }
  182919. },
  182920. clippingPlanes: {
  182921. get: function() {
  182922. return this._surface.tileProvider.clippingPlanes;
  182923. },
  182924. set: function(value) {
  182925. this._surface.tileProvider.clippingPlanes = value;
  182926. }
  182927. },
  182928. cartographicLimitRectangle: {
  182929. get: function() {
  182930. return this._surface.tileProvider.cartographicLimitRectangle;
  182931. },
  182932. set: function(value) {
  182933. if (!defined_default(value)) {
  182934. value = Rectangle_default.clone(Rectangle_default.MAX_VALUE);
  182935. }
  182936. this._surface.tileProvider.cartographicLimitRectangle = value;
  182937. }
  182938. },
  182939. oceanNormalMapUrl: {
  182940. get: function() {
  182941. return this._oceanNormalMapResource.url;
  182942. },
  182943. set: function(value) {
  182944. this._oceanNormalMapResource.url = value;
  182945. this._oceanNormalMapResourceDirty = true;
  182946. }
  182947. },
  182948. terrainProvider: {
  182949. get: function() {
  182950. return this._terrainProvider;
  182951. },
  182952. set: function(value) {
  182953. if (value !== this._terrainProvider) {
  182954. this._terrainProvider = value;
  182955. this._terrainProviderChanged.raiseEvent(value);
  182956. if (defined_default(this._material)) {
  182957. makeShadersDirty(this);
  182958. }
  182959. }
  182960. }
  182961. },
  182962. terrainProviderChanged: {
  182963. get: function() {
  182964. return this._terrainProviderChanged;
  182965. }
  182966. },
  182967. tileLoadProgressEvent: {
  182968. get: function() {
  182969. return this._surface.tileLoadProgressEvent;
  182970. }
  182971. },
  182972. material: {
  182973. get: function() {
  182974. return this._material;
  182975. },
  182976. set: function(material) {
  182977. if (this._material !== material) {
  182978. this._material = material;
  182979. makeShadersDirty(this);
  182980. }
  182981. }
  182982. },
  182983. undergroundColor: {
  182984. get: function() {
  182985. return this._undergroundColor;
  182986. },
  182987. set: function(value) {
  182988. this._undergroundColor = Color_default.clone(value, this._undergroundColor);
  182989. }
  182990. },
  182991. undergroundColorAlphaByDistance: {
  182992. get: function() {
  182993. return this._undergroundColorAlphaByDistance;
  182994. },
  182995. set: function(value) {
  182996. if (defined_default(value) && value.far < value.near) {
  182997. throw new DeveloperError_default(
  182998. "far distance must be greater than near distance."
  182999. );
  183000. }
  183001. this._undergroundColorAlphaByDistance = NearFarScalar_default.clone(
  183002. value,
  183003. this._undergroundColorAlphaByDistance
  183004. );
  183005. }
  183006. },
  183007. translucency: {
  183008. get: function() {
  183009. return this._translucency;
  183010. }
  183011. }
  183012. });
  183013. function makeShadersDirty(globe) {
  183014. const defines = [];
  183015. const requireNormals = defined_default(globe._material) && (globe._material.shaderSource.match(/slope/) || globe._material.shaderSource.match("normalEC"));
  183016. const fragmentSources = [AtmosphereCommon_default, GroundAtmosphere_default];
  183017. if (defined_default(globe._material) && (!requireNormals || globe._terrainProvider.requestVertexNormals)) {
  183018. fragmentSources.push(globe._material.shaderSource);
  183019. defines.push("APPLY_MATERIAL");
  183020. globe._surface._tileProvider.materialUniformMap = globe._material._uniforms;
  183021. } else {
  183022. globe._surface._tileProvider.materialUniformMap = void 0;
  183023. }
  183024. fragmentSources.push(GlobeFS_default);
  183025. globe._surfaceShaderSet.baseVertexShaderSource = new ShaderSource_default({
  183026. sources: [AtmosphereCommon_default, GroundAtmosphere_default, GlobeVS_default],
  183027. defines
  183028. });
  183029. globe._surfaceShaderSet.baseFragmentShaderSource = new ShaderSource_default({
  183030. sources: fragmentSources,
  183031. defines
  183032. });
  183033. globe._surfaceShaderSet.material = globe._material;
  183034. }
  183035. function createComparePickTileFunction(rayOrigin) {
  183036. return function(a4, b) {
  183037. const aDist = BoundingSphere_default.distanceSquaredTo(
  183038. a4.pickBoundingSphere,
  183039. rayOrigin
  183040. );
  183041. const bDist = BoundingSphere_default.distanceSquaredTo(
  183042. b.pickBoundingSphere,
  183043. rayOrigin
  183044. );
  183045. return aDist - bDist;
  183046. };
  183047. }
  183048. var scratchArray3 = [];
  183049. var scratchSphereIntersectionResult = {
  183050. start: 0,
  183051. stop: 0
  183052. };
  183053. Globe.prototype.pickWorldCoordinates = function(ray, scene, cullBackFaces, result) {
  183054. if (!defined_default(ray)) {
  183055. throw new DeveloperError_default("ray is required");
  183056. }
  183057. if (!defined_default(scene)) {
  183058. throw new DeveloperError_default("scene is required");
  183059. }
  183060. cullBackFaces = defaultValue_default(cullBackFaces, true);
  183061. const mode2 = scene.mode;
  183062. const projection = scene.mapProjection;
  183063. const sphereIntersections = scratchArray3;
  183064. sphereIntersections.length = 0;
  183065. const tilesToRender = this._surface._tilesToRender;
  183066. let length3 = tilesToRender.length;
  183067. let tile;
  183068. let i2;
  183069. for (i2 = 0; i2 < length3; ++i2) {
  183070. tile = tilesToRender[i2];
  183071. const surfaceTile = tile.data;
  183072. if (!defined_default(surfaceTile)) {
  183073. continue;
  183074. }
  183075. let boundingVolume = surfaceTile.pickBoundingSphere;
  183076. if (mode2 !== SceneMode_default.SCENE3D) {
  183077. surfaceTile.pickBoundingSphere = boundingVolume = BoundingSphere_default.fromRectangleWithHeights2D(
  183078. tile.rectangle,
  183079. projection,
  183080. surfaceTile.tileBoundingRegion.minimumHeight,
  183081. surfaceTile.tileBoundingRegion.maximumHeight,
  183082. boundingVolume
  183083. );
  183084. Cartesian3_default.fromElements(
  183085. boundingVolume.center.z,
  183086. boundingVolume.center.x,
  183087. boundingVolume.center.y,
  183088. boundingVolume.center
  183089. );
  183090. } else if (defined_default(surfaceTile.renderedMesh)) {
  183091. BoundingSphere_default.clone(
  183092. surfaceTile.tileBoundingRegion.boundingSphere,
  183093. boundingVolume
  183094. );
  183095. } else {
  183096. continue;
  183097. }
  183098. const boundingSphereIntersection = IntersectionTests_default.raySphere(
  183099. ray,
  183100. boundingVolume,
  183101. scratchSphereIntersectionResult
  183102. );
  183103. if (defined_default(boundingSphereIntersection)) {
  183104. sphereIntersections.push(surfaceTile);
  183105. }
  183106. }
  183107. sphereIntersections.sort(createComparePickTileFunction(ray.origin));
  183108. let intersection;
  183109. length3 = sphereIntersections.length;
  183110. for (i2 = 0; i2 < length3; ++i2) {
  183111. intersection = sphereIntersections[i2].pick(
  183112. ray,
  183113. scene.mode,
  183114. scene.mapProjection,
  183115. cullBackFaces,
  183116. result
  183117. );
  183118. if (defined_default(intersection)) {
  183119. break;
  183120. }
  183121. }
  183122. return intersection;
  183123. };
  183124. var cartoScratch3 = new Cartographic_default();
  183125. Globe.prototype.pick = function(ray, scene, result) {
  183126. result = this.pickWorldCoordinates(ray, scene, true, result);
  183127. if (defined_default(result) && scene.mode !== SceneMode_default.SCENE3D) {
  183128. result = Cartesian3_default.fromElements(result.y, result.z, result.x, result);
  183129. const carto = scene.mapProjection.unproject(result, cartoScratch3);
  183130. result = scene.globe.ellipsoid.cartographicToCartesian(carto, result);
  183131. }
  183132. return result;
  183133. };
  183134. var scratchGetHeightCartesian = new Cartesian3_default();
  183135. var scratchGetHeightIntersection = new Cartesian3_default();
  183136. var scratchGetHeightCartographic = new Cartographic_default();
  183137. var scratchGetHeightRay = new Ray_default();
  183138. function tileIfContainsCartographic(tile, cartographic2) {
  183139. return defined_default(tile) && Rectangle_default.contains(tile.rectangle, cartographic2) ? tile : void 0;
  183140. }
  183141. Globe.prototype.getHeight = function(cartographic2) {
  183142. if (!defined_default(cartographic2)) {
  183143. throw new DeveloperError_default("cartographic is required");
  183144. }
  183145. const levelZeroTiles = this._surface._levelZeroTiles;
  183146. if (!defined_default(levelZeroTiles)) {
  183147. return;
  183148. }
  183149. let tile;
  183150. let i2;
  183151. const length3 = levelZeroTiles.length;
  183152. for (i2 = 0; i2 < length3; ++i2) {
  183153. tile = levelZeroTiles[i2];
  183154. if (Rectangle_default.contains(tile.rectangle, cartographic2)) {
  183155. break;
  183156. }
  183157. }
  183158. if (i2 >= length3) {
  183159. return void 0;
  183160. }
  183161. let tileWithMesh = tile;
  183162. while (defined_default(tile)) {
  183163. tile = tileIfContainsCartographic(tile._southwestChild, cartographic2) || tileIfContainsCartographic(tile._southeastChild, cartographic2) || tileIfContainsCartographic(tile._northwestChild, cartographic2) || tile._northeastChild;
  183164. if (defined_default(tile) && defined_default(tile.data) && defined_default(tile.data.renderedMesh)) {
  183165. tileWithMesh = tile;
  183166. }
  183167. }
  183168. tile = tileWithMesh;
  183169. if (!defined_default(tile) || !defined_default(tile.data) || !defined_default(tile.data.renderedMesh)) {
  183170. return void 0;
  183171. }
  183172. const projection = this._surface._tileProvider.tilingScheme.projection;
  183173. const ellipsoid = this._surface._tileProvider.tilingScheme.ellipsoid;
  183174. const cartesian11 = Cartesian3_default.fromRadians(
  183175. cartographic2.longitude,
  183176. cartographic2.latitude,
  183177. 0,
  183178. ellipsoid,
  183179. scratchGetHeightCartesian
  183180. );
  183181. const ray = scratchGetHeightRay;
  183182. const surfaceNormal = ellipsoid.geodeticSurfaceNormal(
  183183. cartesian11,
  183184. ray.direction
  183185. );
  183186. const rayOrigin = ellipsoid.getSurfaceNormalIntersectionWithZAxis(
  183187. cartesian11,
  183188. 11500,
  183189. ray.origin
  183190. );
  183191. if (!defined_default(rayOrigin)) {
  183192. let minimumHeight;
  183193. if (defined_default(tile.data.tileBoundingRegion)) {
  183194. minimumHeight = tile.data.tileBoundingRegion.minimumHeight;
  183195. }
  183196. const magnitude = Math.min(defaultValue_default(minimumHeight, 0), -11500);
  183197. const vectorToMinimumPoint = Cartesian3_default.multiplyByScalar(
  183198. surfaceNormal,
  183199. Math.abs(magnitude) + 1,
  183200. scratchGetHeightIntersection
  183201. );
  183202. Cartesian3_default.subtract(cartesian11, vectorToMinimumPoint, ray.origin);
  183203. }
  183204. const intersection = tile.data.pick(
  183205. ray,
  183206. void 0,
  183207. projection,
  183208. false,
  183209. scratchGetHeightIntersection
  183210. );
  183211. if (!defined_default(intersection)) {
  183212. return void 0;
  183213. }
  183214. return ellipsoid.cartesianToCartographic(
  183215. intersection,
  183216. scratchGetHeightCartographic
  183217. ).height;
  183218. };
  183219. Globe.prototype.update = function(frameState) {
  183220. if (!this.show) {
  183221. return;
  183222. }
  183223. if (frameState.passes.render) {
  183224. this._surface.update(frameState);
  183225. }
  183226. };
  183227. Globe.prototype.beginFrame = function(frameState) {
  183228. const surface = this._surface;
  183229. const tileProvider = surface.tileProvider;
  183230. const terrainProvider = this.terrainProvider;
  183231. const hasWaterMask = this.showWaterEffect && terrainProvider.ready && terrainProvider.hasWaterMask;
  183232. if (hasWaterMask && this._oceanNormalMapResourceDirty) {
  183233. this._oceanNormalMapResourceDirty = false;
  183234. const oceanNormalMapResource = this._oceanNormalMapResource;
  183235. const oceanNormalMapUrl = oceanNormalMapResource.url;
  183236. if (defined_default(oceanNormalMapUrl)) {
  183237. const that = this;
  183238. oceanNormalMapResource.fetchImage().then(function(image) {
  183239. if (oceanNormalMapUrl !== that._oceanNormalMapResource.url) {
  183240. return;
  183241. }
  183242. that._oceanNormalMap = that._oceanNormalMap && that._oceanNormalMap.destroy();
  183243. that._oceanNormalMap = new Texture_default({
  183244. context: frameState.context,
  183245. source: image
  183246. });
  183247. });
  183248. } else {
  183249. this._oceanNormalMap = this._oceanNormalMap && this._oceanNormalMap.destroy();
  183250. }
  183251. }
  183252. const pass = frameState.passes;
  183253. const mode2 = frameState.mode;
  183254. if (pass.render) {
  183255. if (this.showGroundAtmosphere) {
  183256. this._zoomedOutOceanSpecularIntensity = 0.4;
  183257. } else {
  183258. this._zoomedOutOceanSpecularIntensity = 0.5;
  183259. }
  183260. surface.maximumScreenSpaceError = this.maximumScreenSpaceError;
  183261. surface.tileCacheSize = this.tileCacheSize;
  183262. surface.loadingDescendantLimit = this.loadingDescendantLimit;
  183263. surface.preloadAncestors = this.preloadAncestors;
  183264. surface.preloadSiblings = this.preloadSiblings;
  183265. tileProvider.terrainProvider = this.terrainProvider;
  183266. tileProvider.lightingFadeOutDistance = this.lightingFadeOutDistance;
  183267. tileProvider.lightingFadeInDistance = this.lightingFadeInDistance;
  183268. tileProvider.nightFadeOutDistance = this.nightFadeOutDistance;
  183269. tileProvider.nightFadeInDistance = this.nightFadeInDistance;
  183270. tileProvider.zoomedOutOceanSpecularIntensity = mode2 === SceneMode_default.SCENE3D ? this._zoomedOutOceanSpecularIntensity : 0;
  183271. tileProvider.hasWaterMask = hasWaterMask;
  183272. tileProvider.oceanNormalMap = this._oceanNormalMap;
  183273. tileProvider.enableLighting = this.enableLighting;
  183274. tileProvider.dynamicAtmosphereLighting = this.dynamicAtmosphereLighting;
  183275. tileProvider.dynamicAtmosphereLightingFromSun = this.dynamicAtmosphereLightingFromSun;
  183276. tileProvider.showGroundAtmosphere = this.showGroundAtmosphere;
  183277. tileProvider.atmosphereLightIntensity = this.atmosphereLightIntensity;
  183278. tileProvider.atmosphereRayleighCoefficient = this.atmosphereRayleighCoefficient;
  183279. tileProvider.atmosphereMieCoefficient = this.atmosphereMieCoefficient;
  183280. tileProvider.atmosphereRayleighScaleHeight = this.atmosphereRayleighScaleHeight;
  183281. tileProvider.atmosphereMieScaleHeight = this.atmosphereMieScaleHeight;
  183282. tileProvider.atmosphereMieAnisotropy = this.atmosphereMieAnisotropy;
  183283. tileProvider.shadows = this.shadows;
  183284. tileProvider.hueShift = this.atmosphereHueShift;
  183285. tileProvider.saturationShift = this.atmosphereSaturationShift;
  183286. tileProvider.brightnessShift = this.atmosphereBrightnessShift;
  183287. tileProvider.fillHighlightColor = this.fillHighlightColor;
  183288. tileProvider.showSkirts = this.showSkirts;
  183289. tileProvider.backFaceCulling = this.backFaceCulling;
  183290. tileProvider.undergroundColor = this._undergroundColor;
  183291. tileProvider.undergroundColorAlphaByDistance = this._undergroundColorAlphaByDistance;
  183292. tileProvider.lambertDiffuseMultiplier = this.lambertDiffuseMultiplier;
  183293. surface.beginFrame(frameState);
  183294. }
  183295. };
  183296. Globe.prototype.render = function(frameState) {
  183297. if (!this.show) {
  183298. return;
  183299. }
  183300. if (defined_default(this._material)) {
  183301. this._material.update(frameState.context);
  183302. }
  183303. this._surface.render(frameState);
  183304. };
  183305. Globe.prototype.endFrame = function(frameState) {
  183306. if (!this.show) {
  183307. return;
  183308. }
  183309. if (frameState.passes.render) {
  183310. this._surface.endFrame(frameState);
  183311. }
  183312. };
  183313. Globe.prototype.isDestroyed = function() {
  183314. return false;
  183315. };
  183316. Globe.prototype.destroy = function() {
  183317. this._surfaceShaderSet = this._surfaceShaderSet && this._surfaceShaderSet.destroy();
  183318. this._surface = this._surface && this._surface.destroy();
  183319. this._oceanNormalMap = this._oceanNormalMap && this._oceanNormalMap.destroy();
  183320. return destroyObject_default(this);
  183321. };
  183322. var Globe_default = Globe;
  183323. // node_modules/cesium/Source/Shaders/PostProcessStages/PassThrough.js
  183324. var PassThrough_default = "uniform sampler2D colorTexture;\n\nvarying vec2 v_textureCoordinates;\n\nvoid main()\n{\n gl_FragColor = texture2D(colorTexture, v_textureCoordinates);\n}\n";
  183325. // node_modules/cesium/Source/Shaders/PostProcessStages/PassThroughDepth.js
  183326. var PassThroughDepth_default = "uniform highp sampler2D u_depthTexture;\n\nvarying vec2 v_textureCoordinates;\n\nvoid main()\n{\n gl_FragColor = czm_packDepth(texture2D(u_depthTexture, v_textureCoordinates).r);\n}\n";
  183327. // node_modules/cesium/Source/Scene/GlobeDepth.js
  183328. function GlobeDepth() {
  183329. this._picking = false;
  183330. this._numSamples = 1;
  183331. this._tempCopyDepthTexture = void 0;
  183332. this._pickColorFramebuffer = new FramebufferManager_default({
  183333. depthStencil: true,
  183334. supportsDepthTexture: true
  183335. });
  183336. this._outputFramebuffer = new FramebufferManager_default({
  183337. depthStencil: true,
  183338. supportsDepthTexture: true
  183339. });
  183340. this._copyDepthFramebuffer = new FramebufferManager_default();
  183341. this._tempCopyDepthFramebuffer = new FramebufferManager_default();
  183342. this._updateDepthFramebuffer = new FramebufferManager_default({
  183343. createColorAttachments: false,
  183344. createDepthAttachments: false,
  183345. depthStencil: true
  183346. });
  183347. this._clearGlobeColorCommand = void 0;
  183348. this._copyColorCommand = void 0;
  183349. this._copyDepthCommand = void 0;
  183350. this._tempCopyDepthCommand = void 0;
  183351. this._updateDepthCommand = void 0;
  183352. this._viewport = new BoundingRectangle_default();
  183353. this._rs = void 0;
  183354. this._rsBlend = void 0;
  183355. this._rsUpdate = void 0;
  183356. this._useScissorTest = false;
  183357. this._scissorRectangle = void 0;
  183358. this._useHdr = void 0;
  183359. this._clearGlobeDepth = void 0;
  183360. }
  183361. Object.defineProperties(GlobeDepth.prototype, {
  183362. colorFramebufferManager: {
  183363. get: function() {
  183364. return this._picking ? this._pickColorFramebuffer : this._outputFramebuffer;
  183365. }
  183366. },
  183367. framebuffer: {
  183368. get: function() {
  183369. return this.colorFramebufferManager.framebuffer;
  183370. }
  183371. },
  183372. depthStencilTexture: {
  183373. get: function() {
  183374. return this.colorFramebufferManager.getDepthStencilTexture();
  183375. }
  183376. },
  183377. picking: {
  183378. get: function() {
  183379. return this._picking;
  183380. },
  183381. set: function(value) {
  183382. this._picking = value;
  183383. }
  183384. }
  183385. });
  183386. function destroyFramebuffers2(globeDepth) {
  183387. globeDepth._pickColorFramebuffer.destroy();
  183388. globeDepth._outputFramebuffer.destroy();
  183389. globeDepth._copyDepthFramebuffer.destroy();
  183390. globeDepth._tempCopyDepthFramebuffer.destroy();
  183391. globeDepth._updateDepthFramebuffer.destroy();
  183392. }
  183393. function updateCopyCommands(globeDepth, context, width, height, passState) {
  183394. globeDepth._viewport.width = width;
  183395. globeDepth._viewport.height = height;
  183396. const useScissorTest = !BoundingRectangle_default.equals(
  183397. globeDepth._viewport,
  183398. passState.viewport
  183399. );
  183400. let updateScissor = useScissorTest !== globeDepth._useScissorTest;
  183401. globeDepth._useScissorTest = useScissorTest;
  183402. if (!BoundingRectangle_default.equals(globeDepth._scissorRectangle, passState.viewport)) {
  183403. globeDepth._scissorRectangle = BoundingRectangle_default.clone(
  183404. passState.viewport,
  183405. globeDepth._scissorRectangle
  183406. );
  183407. updateScissor = true;
  183408. }
  183409. if (!defined_default(globeDepth._rs) || !BoundingRectangle_default.equals(globeDepth._viewport, globeDepth._rs.viewport) || updateScissor) {
  183410. globeDepth._rs = RenderState_default.fromCache({
  183411. viewport: globeDepth._viewport,
  183412. scissorTest: {
  183413. enabled: globeDepth._useScissorTest,
  183414. rectangle: globeDepth._scissorRectangle
  183415. }
  183416. });
  183417. globeDepth._rsBlend = RenderState_default.fromCache({
  183418. viewport: globeDepth._viewport,
  183419. scissorTest: {
  183420. enabled: globeDepth._useScissorTest,
  183421. rectangle: globeDepth._scissorRectangle
  183422. },
  183423. blending: BlendingState_default.ALPHA_BLEND
  183424. });
  183425. globeDepth._rsUpdate = RenderState_default.fromCache({
  183426. viewport: globeDepth._viewport,
  183427. scissorTest: {
  183428. enabled: globeDepth._useScissorTest,
  183429. rectangle: globeDepth._scissorRectangle
  183430. },
  183431. stencilTest: {
  183432. enabled: true,
  183433. frontFunction: StencilFunction_default.EQUAL,
  183434. frontOperation: {
  183435. fail: StencilOperation_default.KEEP,
  183436. zFail: StencilOperation_default.KEEP,
  183437. zPass: StencilOperation_default.KEEP
  183438. },
  183439. backFunction: StencilFunction_default.NEVER,
  183440. reference: StencilConstants_default.CESIUM_3D_TILE_MASK,
  183441. mask: StencilConstants_default.CESIUM_3D_TILE_MASK
  183442. }
  183443. });
  183444. }
  183445. if (!defined_default(globeDepth._copyDepthCommand)) {
  183446. globeDepth._copyDepthCommand = context.createViewportQuadCommand(
  183447. PassThroughDepth_default,
  183448. {
  183449. uniformMap: {
  183450. u_depthTexture: function() {
  183451. return globeDepth.colorFramebufferManager.getDepthStencilTexture();
  183452. }
  183453. },
  183454. owner: globeDepth
  183455. }
  183456. );
  183457. }
  183458. globeDepth._copyDepthCommand.framebuffer = globeDepth._copyDepthFramebuffer.framebuffer;
  183459. globeDepth._copyDepthCommand.renderState = globeDepth._rs;
  183460. if (!defined_default(globeDepth._copyColorCommand)) {
  183461. globeDepth._copyColorCommand = context.createViewportQuadCommand(
  183462. PassThrough_default,
  183463. {
  183464. uniformMap: {
  183465. colorTexture: function() {
  183466. return globeDepth.colorFramebufferManager.getColorTexture();
  183467. }
  183468. },
  183469. owner: globeDepth
  183470. }
  183471. );
  183472. }
  183473. globeDepth._copyColorCommand.renderState = globeDepth._rs;
  183474. if (!defined_default(globeDepth._tempCopyDepthCommand)) {
  183475. globeDepth._tempCopyDepthCommand = context.createViewportQuadCommand(
  183476. PassThroughDepth_default,
  183477. {
  183478. uniformMap: {
  183479. u_depthTexture: function() {
  183480. return globeDepth._tempCopyDepthTexture;
  183481. }
  183482. },
  183483. owner: globeDepth
  183484. }
  183485. );
  183486. }
  183487. globeDepth._tempCopyDepthCommand.framebuffer = globeDepth._tempCopyDepthFramebuffer.framebuffer;
  183488. globeDepth._tempCopyDepthCommand.renderState = globeDepth._rs;
  183489. if (!defined_default(globeDepth._updateDepthCommand)) {
  183490. globeDepth._updateDepthCommand = context.createViewportQuadCommand(
  183491. PassThrough_default,
  183492. {
  183493. uniformMap: {
  183494. colorTexture: function() {
  183495. return globeDepth._tempCopyDepthFramebuffer.getColorTexture();
  183496. }
  183497. },
  183498. owner: globeDepth
  183499. }
  183500. );
  183501. }
  183502. globeDepth._updateDepthCommand.framebuffer = globeDepth._updateDepthFramebuffer.framebuffer;
  183503. globeDepth._updateDepthCommand.renderState = globeDepth._rsUpdate;
  183504. if (!defined_default(globeDepth._clearGlobeColorCommand)) {
  183505. globeDepth._clearGlobeColorCommand = new ClearCommand_default({
  183506. color: new Color_default(0, 0, 0, 0),
  183507. stencil: 0,
  183508. owner: globeDepth
  183509. });
  183510. }
  183511. globeDepth._clearGlobeColorCommand.framebuffer = globeDepth.framebuffer;
  183512. }
  183513. GlobeDepth.prototype.update = function(context, passState, viewport, numSamples, hdr, clearGlobeDepth) {
  183514. const width = viewport.width;
  183515. const height = viewport.height;
  183516. const pixelDatatype = hdr ? context.halfFloatingPointTexture ? PixelDatatype_default.HALF_FLOAT : PixelDatatype_default.FLOAT : PixelDatatype_default.UNSIGNED_BYTE;
  183517. this._numSamples = numSamples;
  183518. if (this.picking) {
  183519. this._pickColorFramebuffer.update(context, width, height);
  183520. } else {
  183521. this._outputFramebuffer.update(
  183522. context,
  183523. width,
  183524. height,
  183525. numSamples,
  183526. pixelDatatype
  183527. );
  183528. }
  183529. this._copyDepthFramebuffer.update(context, width, height);
  183530. updateCopyCommands(this, context, width, height, passState);
  183531. context.uniformState.globeDepthTexture = void 0;
  183532. this._useHdr = hdr;
  183533. this._clearGlobeDepth = clearGlobeDepth;
  183534. };
  183535. GlobeDepth.prototype.prepareColorTextures = function(context, blitStencil) {
  183536. if (!this.picking && this._numSamples > 1) {
  183537. this._outputFramebuffer.prepareTextures(context, blitStencil);
  183538. }
  183539. };
  183540. GlobeDepth.prototype.executeCopyDepth = function(context, passState) {
  183541. if (defined_default(this._copyDepthCommand)) {
  183542. this.prepareColorTextures(context);
  183543. this._copyDepthCommand.execute(context, passState);
  183544. context.uniformState.globeDepthTexture = this._copyDepthFramebuffer.getColorTexture();
  183545. }
  183546. };
  183547. GlobeDepth.prototype.executeUpdateDepth = function(context, passState, clearGlobeDepth, depthTexture) {
  183548. const depthTextureToCopy = defined_default(depthTexture) ? depthTexture : passState.framebuffer.depthStencilTexture;
  183549. if (clearGlobeDepth || depthTextureToCopy !== this.colorFramebufferManager.getDepthStencilTexture()) {
  183550. if (defined_default(this._updateDepthCommand)) {
  183551. if (!defined_default(this._updateDepthFramebuffer.framebuffer) || this._updateDepthFramebuffer.getDepthStencilTexture() !== depthTextureToCopy || this._updateDepthFramebuffer.getColorTexture() !== this._copyDepthFramebuffer.getColorTexture()) {
  183552. const width = this._copyDepthFramebuffer.getColorTexture().width;
  183553. const height = this._copyDepthFramebuffer.getColorTexture().height;
  183554. this._tempCopyDepthFramebuffer.destroy();
  183555. this._tempCopyDepthFramebuffer.update(context, width, height);
  183556. const colorTexture = this._copyDepthFramebuffer.getColorTexture();
  183557. this._updateDepthFramebuffer.setColorTexture(colorTexture, 0);
  183558. this._updateDepthFramebuffer.setDepthStencilTexture(depthTextureToCopy);
  183559. this._updateDepthFramebuffer.update(context, width, height);
  183560. updateCopyCommands(this, context, width, height, passState);
  183561. }
  183562. this._tempCopyDepthTexture = depthTextureToCopy;
  183563. this._tempCopyDepthCommand.execute(context, passState);
  183564. this._updateDepthCommand.execute(context, passState);
  183565. }
  183566. return;
  183567. }
  183568. if (defined_default(this._copyDepthCommand)) {
  183569. this._copyDepthCommand.execute(context, passState);
  183570. }
  183571. };
  183572. GlobeDepth.prototype.executeCopyColor = function(context, passState) {
  183573. if (defined_default(this._copyColorCommand)) {
  183574. this._copyColorCommand.execute(context, passState);
  183575. }
  183576. };
  183577. GlobeDepth.prototype.clear = function(context, passState, clearColor) {
  183578. const clear2 = this._clearGlobeColorCommand;
  183579. if (defined_default(clear2)) {
  183580. Color_default.clone(clearColor, clear2.color);
  183581. this.colorFramebufferManager.clear(context, clear2, passState);
  183582. }
  183583. };
  183584. GlobeDepth.prototype.isDestroyed = function() {
  183585. return false;
  183586. };
  183587. GlobeDepth.prototype.destroy = function() {
  183588. destroyFramebuffers2(this);
  183589. if (defined_default(this._copyColorCommand)) {
  183590. this._copyColorCommand.shaderProgram = this._copyColorCommand.shaderProgram.destroy();
  183591. }
  183592. if (defined_default(this._copyDepthCommand)) {
  183593. this._copyDepthCommand.shaderProgram = this._copyDepthCommand.shaderProgram.destroy();
  183594. }
  183595. if (defined_default(this._tempCopyDepthCommand)) {
  183596. this._tempCopyDepthCommand.shaderProgram = this._tempCopyDepthCommand.shaderProgram.destroy();
  183597. }
  183598. if (defined_default(this._updateDepthCommand)) {
  183599. this._updateDepthCommand.shaderProgram = this._updateDepthCommand.shaderProgram.destroy();
  183600. }
  183601. return destroyObject_default(this);
  183602. };
  183603. var GlobeDepth_default = GlobeDepth;
  183604. // node_modules/cesium/Source/Scene/GlobeTranslucencyFramebuffer.js
  183605. function GlobeTranslucencyFramebuffer() {
  183606. this._framebuffer = new FramebufferManager_default({
  183607. depthStencil: true,
  183608. supportsDepthTexture: true
  183609. });
  183610. this._packedDepthFramebuffer = new FramebufferManager_default();
  183611. this._renderState = void 0;
  183612. this._packedDepthCommand = void 0;
  183613. this._clearCommand = void 0;
  183614. this._viewport = new BoundingRectangle_default();
  183615. this._useScissorTest = false;
  183616. this._scissorRectangle = void 0;
  183617. this._useHdr = void 0;
  183618. }
  183619. Object.defineProperties(GlobeTranslucencyFramebuffer.prototype, {
  183620. classificationTexture: {
  183621. get: function() {
  183622. return this._framebuffer.getColorTexture();
  183623. }
  183624. },
  183625. classificationFramebuffer: {
  183626. get: function() {
  183627. return this._framebuffer.framebuffer;
  183628. }
  183629. },
  183630. packedDepthFramebuffer: {
  183631. get: function() {
  183632. return this._packedDepthFramebuffer.framebuffer;
  183633. }
  183634. },
  183635. depthStencilTexture: {
  183636. get: function() {
  183637. return this._framebuffer.getDepthStencilTexture();
  183638. }
  183639. },
  183640. depthStencilRenderbuffer: {
  183641. get: function() {
  183642. return this._framebuffer.getDepthStencilRenderbuffer();
  183643. }
  183644. },
  183645. packedDepthTexture: {
  183646. get: function() {
  183647. return this._packedDepthFramebuffer.getColorTexture();
  183648. }
  183649. }
  183650. });
  183651. function destroyResources(globeTranslucency) {
  183652. globeTranslucency._framebuffer.destroy();
  183653. globeTranslucency._packedDepthFramebuffer.destroy();
  183654. }
  183655. function updateResources(globeTranslucency, context, width, height, hdr) {
  183656. const pixelDatatype = hdr ? context.halfFloatingPointTexture ? PixelDatatype_default.HALF_FLOAT : PixelDatatype_default.FLOAT : PixelDatatype_default.UNSIGNED_BYTE;
  183657. globeTranslucency._framebuffer.update(
  183658. context,
  183659. width,
  183660. height,
  183661. 1,
  183662. pixelDatatype
  183663. );
  183664. globeTranslucency._packedDepthFramebuffer.update(context, width, height);
  183665. }
  183666. function updateCommands(globeTranslucency, context, width, height, passState) {
  183667. globeTranslucency._viewport.width = width;
  183668. globeTranslucency._viewport.height = height;
  183669. const useScissorTest = !BoundingRectangle_default.equals(
  183670. globeTranslucency._viewport,
  183671. passState.viewport
  183672. );
  183673. let updateScissor = useScissorTest !== globeTranslucency._useScissorTest;
  183674. globeTranslucency._useScissorTest = useScissorTest;
  183675. if (!BoundingRectangle_default.equals(
  183676. globeTranslucency._scissorRectangle,
  183677. passState.viewport
  183678. )) {
  183679. globeTranslucency._scissorRectangle = BoundingRectangle_default.clone(
  183680. passState.viewport,
  183681. globeTranslucency._scissorRectangle
  183682. );
  183683. updateScissor = true;
  183684. }
  183685. if (!defined_default(globeTranslucency._renderState) || !BoundingRectangle_default.equals(
  183686. globeTranslucency._viewport,
  183687. globeTranslucency._renderState.viewport
  183688. ) || updateScissor) {
  183689. globeTranslucency._renderState = RenderState_default.fromCache({
  183690. viewport: globeTranslucency._viewport,
  183691. scissorTest: {
  183692. enabled: globeTranslucency._useScissorTest,
  183693. rectangle: globeTranslucency._scissorRectangle
  183694. }
  183695. });
  183696. }
  183697. if (!defined_default(globeTranslucency._packedDepthCommand)) {
  183698. globeTranslucency._packedDepthCommand = context.createViewportQuadCommand(
  183699. PassThroughDepth_default,
  183700. {
  183701. uniformMap: {
  183702. u_depthTexture: function() {
  183703. return globeTranslucency.depthStencilTexture;
  183704. }
  183705. },
  183706. owner: globeTranslucency
  183707. }
  183708. );
  183709. }
  183710. if (!defined_default(globeTranslucency._clearCommand)) {
  183711. globeTranslucency._clearCommand = new ClearCommand_default({
  183712. color: new Color_default(0, 0, 0, 0),
  183713. depth: 1,
  183714. stencil: 0,
  183715. owner: globeTranslucency
  183716. });
  183717. }
  183718. globeTranslucency._packedDepthCommand.framebuffer = globeTranslucency._packedDepthFramebuffer.framebuffer;
  183719. globeTranslucency._packedDepthCommand.renderState = globeTranslucency._renderState;
  183720. globeTranslucency._clearCommand.framebuffer = globeTranslucency.classificationFramebuffer;
  183721. globeTranslucency._clearCommand.renderState = globeTranslucency._renderState;
  183722. }
  183723. GlobeTranslucencyFramebuffer.prototype.updateAndClear = function(hdr, viewport, context, passState) {
  183724. const width = viewport.width;
  183725. const height = viewport.height;
  183726. updateResources(this, context, width, height, hdr);
  183727. updateCommands(this, context, width, height, passState);
  183728. this._useHdr = hdr;
  183729. };
  183730. GlobeTranslucencyFramebuffer.prototype.clearClassification = function(context, passState) {
  183731. this._clearCommand.execute(context, passState);
  183732. };
  183733. GlobeTranslucencyFramebuffer.prototype.packDepth = function(context, passState) {
  183734. this._packedDepthCommand.execute(context, passState);
  183735. return this.packedDepthTexture;
  183736. };
  183737. GlobeTranslucencyFramebuffer.prototype.isDestroyed = function() {
  183738. return false;
  183739. };
  183740. GlobeTranslucencyFramebuffer.prototype.destroy = function() {
  183741. destroyResources(this);
  183742. return destroyObject_default(this);
  183743. };
  183744. var GlobeTranslucencyFramebuffer_default = GlobeTranslucencyFramebuffer;
  183745. // node_modules/cesium/Source/Scene/GlobeTranslucencyState.js
  183746. var DerivedCommandType = {
  183747. OPAQUE_FRONT_FACE: 0,
  183748. OPAQUE_BACK_FACE: 1,
  183749. DEPTH_ONLY_FRONT_FACE: 2,
  183750. DEPTH_ONLY_BACK_FACE: 3,
  183751. DEPTH_ONLY_FRONT_AND_BACK_FACE: 4,
  183752. TRANSLUCENT_FRONT_FACE: 5,
  183753. TRANSLUCENT_BACK_FACE: 6,
  183754. TRANSLUCENT_FRONT_FACE_MANUAL_DEPTH_TEST: 7,
  183755. TRANSLUCENT_BACK_FACE_MANUAL_DEPTH_TEST: 8,
  183756. PICK_FRONT_FACE: 9,
  183757. PICK_BACK_FACE: 10,
  183758. DERIVED_COMMANDS_MAXIMUM_LENGTH: 11
  183759. };
  183760. var derivedCommandsMaximumLength = DerivedCommandType.DERIVED_COMMANDS_MAXIMUM_LENGTH;
  183761. var DerivedCommandNames = [
  183762. "opaqueFrontFaceCommand",
  183763. "opaqueBackFaceCommand",
  183764. "depthOnlyFrontFaceCommand",
  183765. "depthOnlyBackFaceCommand",
  183766. "depthOnlyFrontAndBackFaceCommand",
  183767. "translucentFrontFaceCommand",
  183768. "translucentBackFaceCommand",
  183769. "translucentFrontFaceManualDepthTestCommand",
  183770. "translucentBackFaceManualDepthTestCommand",
  183771. "pickFrontFaceCommand",
  183772. "pickBackFaceCommand"
  183773. ];
  183774. function GlobeTranslucencyState() {
  183775. this._frontFaceAlphaByDistance = new NearFarScalar_default(0, 1, 0, 1);
  183776. this._backFaceAlphaByDistance = new NearFarScalar_default(0, 1, 0, 1);
  183777. this._frontFaceTranslucent = false;
  183778. this._backFaceTranslucent = false;
  183779. this._requiresManualDepthTest = false;
  183780. this._sunVisibleThroughGlobe = false;
  183781. this._environmentVisible = false;
  183782. this._useDepthPlane = false;
  183783. this._numberOfTextureUniforms = 0;
  183784. this._globeTranslucencyFramebuffer = void 0;
  183785. this._rectangle = Rectangle_default.clone(Rectangle_default.MAX_VALUE);
  183786. this._derivedCommandKey = 0;
  183787. this._derivedCommandsDirty = false;
  183788. this._derivedCommandPacks = void 0;
  183789. this._derivedCommandTypes = new Array(derivedCommandsMaximumLength);
  183790. this._derivedBlendCommandTypes = new Array(derivedCommandsMaximumLength);
  183791. this._derivedPickCommandTypes = new Array(derivedCommandsMaximumLength);
  183792. this._derivedCommandTypesToUpdate = new Array(derivedCommandsMaximumLength);
  183793. this._derivedCommandsLength = 0;
  183794. this._derivedBlendCommandsLength = 0;
  183795. this._derivedPickCommandsLength = 0;
  183796. this._derivedCommandsToUpdateLength = 0;
  183797. }
  183798. Object.defineProperties(GlobeTranslucencyState.prototype, {
  183799. frontFaceAlphaByDistance: {
  183800. get: function() {
  183801. return this._frontFaceAlphaByDistance;
  183802. }
  183803. },
  183804. backFaceAlphaByDistance: {
  183805. get: function() {
  183806. return this._backFaceAlphaByDistance;
  183807. }
  183808. },
  183809. translucent: {
  183810. get: function() {
  183811. return this._frontFaceTranslucent;
  183812. }
  183813. },
  183814. sunVisibleThroughGlobe: {
  183815. get: function() {
  183816. return this._sunVisibleThroughGlobe;
  183817. }
  183818. },
  183819. environmentVisible: {
  183820. get: function() {
  183821. return this._environmentVisible;
  183822. }
  183823. },
  183824. useDepthPlane: {
  183825. get: function() {
  183826. return this._useDepthPlane;
  183827. }
  183828. },
  183829. numberOfTextureUniforms: {
  183830. get: function() {
  183831. return this._numberOfTextureUniforms;
  183832. }
  183833. },
  183834. rectangle: {
  183835. get: function() {
  183836. return this._rectangle;
  183837. }
  183838. }
  183839. });
  183840. GlobeTranslucencyState.prototype.update = function(scene) {
  183841. const globe = scene.globe;
  183842. if (!defined_default(globe) || !globe.show) {
  183843. this._frontFaceTranslucent = false;
  183844. this._backFaceTranslucent = false;
  183845. this._sunVisibleThroughGlobe = true;
  183846. this._environmentVisible = true;
  183847. this._useDepthPlane = false;
  183848. return;
  183849. }
  183850. this._frontFaceAlphaByDistance = updateAlphaByDistance(
  183851. globe.translucency.enabled,
  183852. globe.translucency.frontFaceAlpha,
  183853. globe.translucency.frontFaceAlphaByDistance,
  183854. this._frontFaceAlphaByDistance
  183855. );
  183856. this._backFaceAlphaByDistance = updateAlphaByDistance(
  183857. globe.translucency.enabled,
  183858. globe.translucency.backFaceAlpha,
  183859. globe.translucency.backFaceAlphaByDistance,
  183860. this._backFaceAlphaByDistance
  183861. );
  183862. this._frontFaceTranslucent = isFaceTranslucent(
  183863. globe.translucency.enabled,
  183864. this._frontFaceAlphaByDistance,
  183865. globe
  183866. );
  183867. this._backFaceTranslucent = isFaceTranslucent(
  183868. globe.translucency.enabled,
  183869. this._backFaceAlphaByDistance,
  183870. globe
  183871. );
  183872. this._requiresManualDepthTest = requiresManualDepthTest(this, scene, globe);
  183873. this._sunVisibleThroughGlobe = isSunVisibleThroughGlobe(this, scene);
  183874. this._environmentVisible = isEnvironmentVisible(this, scene);
  183875. this._useDepthPlane = useDepthPlane(this, scene);
  183876. this._numberOfTextureUniforms = getNumberOfTextureUniforms(this);
  183877. this._rectangle = Rectangle_default.clone(
  183878. globe.translucency.rectangle,
  183879. this._rectangle
  183880. );
  183881. gatherDerivedCommandRequirements(this, scene);
  183882. };
  183883. function updateAlphaByDistance(enabled, alpha, alphaByDistance, result) {
  183884. if (!enabled) {
  183885. result.nearValue = 1;
  183886. result.farValue = 1;
  183887. return result;
  183888. }
  183889. if (!defined_default(alphaByDistance)) {
  183890. result.nearValue = alpha;
  183891. result.farValue = alpha;
  183892. return result;
  183893. }
  183894. NearFarScalar_default.clone(alphaByDistance, result);
  183895. result.nearValue *= alpha;
  183896. result.farValue *= alpha;
  183897. return result;
  183898. }
  183899. function isFaceTranslucent(translucencyEnabled, alphaByDistance, globe) {
  183900. return translucencyEnabled && (globe.baseColor.alpha < 1 || alphaByDistance.nearValue < 1 || alphaByDistance.farValue < 1);
  183901. }
  183902. function isSunVisibleThroughGlobe(state, scene) {
  183903. const frontTranslucent = state._frontFaceTranslucent;
  183904. const backTranslucent = state._backFaceTranslucent;
  183905. return frontTranslucent && (scene.cameraUnderground || backTranslucent);
  183906. }
  183907. function isEnvironmentVisible(state, scene) {
  183908. return !scene.cameraUnderground || state._frontFaceTranslucent;
  183909. }
  183910. function useDepthPlane(state, scene) {
  183911. return !scene.cameraUnderground && !state._frontFaceTranslucent;
  183912. }
  183913. function requiresManualDepthTest(state, scene, globe) {
  183914. return state._frontFaceTranslucent && !state._backFaceTranslucent && !globe.depthTestAgainstTerrain && scene.mode !== SceneMode_default.SCENE2D && scene.context.depthTexture;
  183915. }
  183916. function getNumberOfTextureUniforms(state) {
  183917. let numberOfTextureUniforms = 0;
  183918. if (state._frontFaceTranslucent) {
  183919. ++numberOfTextureUniforms;
  183920. }
  183921. if (state._requiresManualDepthTest) {
  183922. ++numberOfTextureUniforms;
  183923. }
  183924. return numberOfTextureUniforms;
  183925. }
  183926. function gatherDerivedCommandRequirements(state, scene) {
  183927. state._derivedCommandsLength = getDerivedCommandTypes(
  183928. state,
  183929. scene,
  183930. false,
  183931. false,
  183932. state._derivedCommandTypes
  183933. );
  183934. state._derivedBlendCommandsLength = getDerivedCommandTypes(
  183935. state,
  183936. scene,
  183937. true,
  183938. false,
  183939. state._derivedBlendCommandTypes
  183940. );
  183941. state._derivedPickCommandsLength = getDerivedCommandTypes(
  183942. state,
  183943. scene,
  183944. false,
  183945. true,
  183946. state._derivedPickCommandTypes
  183947. );
  183948. let i2;
  183949. let derivedCommandKey = 0;
  183950. for (i2 = 0; i2 < state._derivedCommandsLength; ++i2) {
  183951. derivedCommandKey |= 1 << state._derivedCommandTypes[i2];
  183952. }
  183953. for (i2 = 0; i2 < state._derivedBlendCommandsLength; ++i2) {
  183954. derivedCommandKey |= 1 << state._derivedBlendCommandTypes[i2];
  183955. }
  183956. for (i2 = 0; i2 < state._derivedPickCommandsLength; ++i2) {
  183957. derivedCommandKey |= 1 << state._derivedPickCommandTypes[i2];
  183958. }
  183959. let derivedCommandsToUpdateLength = 0;
  183960. for (i2 = 0; i2 < derivedCommandsMaximumLength; ++i2) {
  183961. if ((derivedCommandKey & 1 << i2) > 0) {
  183962. state._derivedCommandTypesToUpdate[derivedCommandsToUpdateLength++] = i2;
  183963. }
  183964. }
  183965. state._derivedCommandsToUpdateLength = derivedCommandsToUpdateLength;
  183966. const derivedCommandsDirty = derivedCommandKey !== state._derivedCommandKey;
  183967. state._derivedCommandKey = derivedCommandKey;
  183968. state._derivedCommandsDirty = derivedCommandsDirty;
  183969. if (!defined_default(state._derivedCommandPacks) && state._frontFaceTranslucent) {
  183970. state._derivedCommandPacks = createDerivedCommandPacks();
  183971. }
  183972. }
  183973. function getDerivedCommandTypes(state, scene, isBlendCommand, isPickCommand, types) {
  183974. let length3 = 0;
  183975. const frontTranslucent = state._frontFaceTranslucent;
  183976. const backTranslucent = state._backFaceTranslucent;
  183977. if (!frontTranslucent) {
  183978. return length3;
  183979. }
  183980. const cameraUnderground = scene.cameraUnderground;
  183981. const requiresManualDepthTest2 = state._requiresManualDepthTest;
  183982. const translucentFrontFaceCommandType = isPickCommand ? DerivedCommandType.PICK_FRONT_FACE : requiresManualDepthTest2 ? DerivedCommandType.TRANSLUCENT_FRONT_FACE_MANUAL_DEPTH_TEST : DerivedCommandType.TRANSLUCENT_FRONT_FACE;
  183983. const translucentBackFaceCommandType = isPickCommand ? DerivedCommandType.PICK_BACK_FACE : requiresManualDepthTest2 ? DerivedCommandType.TRANSLUCENT_BACK_FACE_MANUAL_DEPTH_TEST : DerivedCommandType.TRANSLUCENT_BACK_FACE;
  183984. if (scene.mode === SceneMode_default.SCENE2D) {
  183985. types[length3++] = DerivedCommandType.DEPTH_ONLY_FRONT_FACE;
  183986. types[length3++] = translucentFrontFaceCommandType;
  183987. return length3;
  183988. }
  183989. if (backTranslucent) {
  183990. if (!isBlendCommand) {
  183991. types[length3++] = DerivedCommandType.DEPTH_ONLY_FRONT_AND_BACK_FACE;
  183992. }
  183993. if (cameraUnderground) {
  183994. types[length3++] = translucentFrontFaceCommandType;
  183995. types[length3++] = translucentBackFaceCommandType;
  183996. } else {
  183997. types[length3++] = translucentBackFaceCommandType;
  183998. types[length3++] = translucentFrontFaceCommandType;
  183999. }
  184000. } else {
  184001. if (cameraUnderground) {
  184002. if (!isBlendCommand) {
  184003. types[length3++] = DerivedCommandType.DEPTH_ONLY_BACK_FACE;
  184004. }
  184005. types[length3++] = DerivedCommandType.OPAQUE_FRONT_FACE;
  184006. types[length3++] = translucentBackFaceCommandType;
  184007. } else {
  184008. if (!isBlendCommand) {
  184009. types[length3++] = DerivedCommandType.DEPTH_ONLY_FRONT_FACE;
  184010. }
  184011. types[length3++] = DerivedCommandType.OPAQUE_BACK_FACE;
  184012. types[length3++] = translucentFrontFaceCommandType;
  184013. }
  184014. }
  184015. return length3;
  184016. }
  184017. function removeDefine(defines, defineToRemove) {
  184018. const index2 = defines.indexOf(defineToRemove);
  184019. if (index2 > -1) {
  184020. defines.splice(index2, 1);
  184021. }
  184022. }
  184023. function hasDefine(defines, define2) {
  184024. return defines.indexOf(define2) > -1;
  184025. }
  184026. function getOpaqueFrontFaceShaderProgram(vs, fs) {
  184027. removeDefine(vs.defines, "TRANSLUCENT");
  184028. removeDefine(fs.defines, "TRANSLUCENT");
  184029. }
  184030. function getOpaqueBackFaceShaderProgram(vs, fs) {
  184031. removeDefine(vs.defines, "GROUND_ATMOSPHERE");
  184032. removeDefine(fs.defines, "GROUND_ATMOSPHERE");
  184033. removeDefine(vs.defines, "FOG");
  184034. removeDefine(fs.defines, "FOG");
  184035. removeDefine(vs.defines, "TRANSLUCENT");
  184036. removeDefine(fs.defines, "TRANSLUCENT");
  184037. }
  184038. function getDepthOnlyShaderProgram2(vs, fs) {
  184039. if (hasDefine(fs.defines, "TILE_LIMIT_RECTANGLE") || hasDefine(fs.defines, "ENABLE_CLIPPING_PLANES")) {
  184040. return;
  184041. }
  184042. const depthOnlyShader = "void main() \n{ \n gl_FragColor = vec4(1.0); \n} \n";
  184043. fs.sources = [depthOnlyShader];
  184044. }
  184045. function getTranslucentShaderProgram(vs, fs) {
  184046. const sources = fs.sources;
  184047. const length3 = sources.length;
  184048. for (let i2 = 0; i2 < length3; ++i2) {
  184049. sources[i2] = ShaderSource_default.replaceMain(
  184050. sources[i2],
  184051. "czm_globe_translucency_main"
  184052. );
  184053. }
  184054. const globeTranslucencyMain = "\n\nuniform sampler2D u_classificationTexture; \nvoid main() \n{ \n vec2 st = gl_FragCoord.xy / czm_viewport.zw; \n#ifdef MANUAL_DEPTH_TEST \n float logDepthOrDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, st)); \n if (logDepthOrDepth != 0.0) \n { \n vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth); \n float depthEC = eyeCoordinate.z / eyeCoordinate.w; \n if (v_positionEC.z < depthEC) \n { \n discard; \n } \n } \n#endif \n czm_globe_translucency_main(); \n vec4 classificationColor = texture2D(u_classificationTexture, st); \n if (classificationColor.a > 0.0) \n { \n // Reverse premultiplication process to get the correct composited result of the classification primitives \n classificationColor.rgb /= classificationColor.a; \n } \n gl_FragColor = classificationColor * vec4(classificationColor.aaa, 1.0) + gl_FragColor * (1.0 - classificationColor.a); \n} \n";
  184055. sources.push(globeTranslucencyMain);
  184056. }
  184057. function getTranslucentBackFaceShaderProgram(vs, fs) {
  184058. getTranslucentShaderProgram(vs, fs);
  184059. removeDefine(vs.defines, "GROUND_ATMOSPHERE");
  184060. removeDefine(fs.defines, "GROUND_ATMOSPHERE");
  184061. removeDefine(vs.defines, "FOG");
  184062. removeDefine(fs.defines, "FOG");
  184063. }
  184064. function getTranslucentFrontFaceManualDepthTestShaderProgram(vs, fs) {
  184065. getTranslucentShaderProgram(vs, fs);
  184066. vs.defines.push("GENERATE_POSITION");
  184067. fs.defines.push("MANUAL_DEPTH_TEST");
  184068. }
  184069. function getTranslucentBackFaceManualDepthTestShaderProgram(vs, fs) {
  184070. getTranslucentBackFaceShaderProgram(vs, fs);
  184071. vs.defines.push("GENERATE_POSITION");
  184072. fs.defines.push("MANUAL_DEPTH_TEST");
  184073. }
  184074. function getPickShaderProgram2(vs, fs) {
  184075. const pickShader = "uniform sampler2D u_classificationTexture; \nvoid main() \n{ \n vec2 st = gl_FragCoord.xy / czm_viewport.zw; \n vec4 pickColor = texture2D(u_classificationTexture, st); \n if (pickColor == vec4(0.0)) \n { \n discard; \n } \n gl_FragColor = pickColor; \n} \n";
  184076. fs.sources = [pickShader];
  184077. }
  184078. function getDerivedShaderProgram(context, shaderProgram, derivedShaderProgram, shaderProgramDirty, getShaderProgramFunction, cacheName) {
  184079. if (!defined_default(getShaderProgramFunction)) {
  184080. return shaderProgram;
  184081. }
  184082. if (!shaderProgramDirty && defined_default(derivedShaderProgram)) {
  184083. return derivedShaderProgram;
  184084. }
  184085. let shader = context.shaderCache.getDerivedShaderProgram(
  184086. shaderProgram,
  184087. cacheName
  184088. );
  184089. if (!defined_default(shader)) {
  184090. const attributeLocations8 = shaderProgram._attributeLocations;
  184091. const vs = shaderProgram.vertexShaderSource.clone();
  184092. const fs = shaderProgram.fragmentShaderSource.clone();
  184093. vs.defines = defined_default(vs.defines) ? vs.defines.slice(0) : [];
  184094. fs.defines = defined_default(fs.defines) ? fs.defines.slice(0) : [];
  184095. getShaderProgramFunction(vs, fs);
  184096. shader = context.shaderCache.createDerivedShaderProgram(
  184097. shaderProgram,
  184098. cacheName,
  184099. {
  184100. vertexShaderSource: vs,
  184101. fragmentShaderSource: fs,
  184102. attributeLocations: attributeLocations8
  184103. }
  184104. );
  184105. }
  184106. return shader;
  184107. }
  184108. function getOpaqueFrontFaceRenderState(renderState) {
  184109. renderState.cull.face = CullFace_default.BACK;
  184110. renderState.cull.enabled = true;
  184111. }
  184112. function getOpaqueBackFaceRenderState(renderState) {
  184113. renderState.cull.face = CullFace_default.FRONT;
  184114. renderState.cull.enabled = true;
  184115. }
  184116. function getDepthOnlyFrontFaceRenderState(renderState) {
  184117. renderState.cull.face = CullFace_default.BACK;
  184118. renderState.cull.enabled = true;
  184119. renderState.colorMask = {
  184120. red: false,
  184121. green: false,
  184122. blue: false,
  184123. alpha: false
  184124. };
  184125. }
  184126. function getDepthOnlyBackFaceRenderState(renderState) {
  184127. renderState.cull.face = CullFace_default.FRONT;
  184128. renderState.cull.enabled = true;
  184129. renderState.colorMask = {
  184130. red: false,
  184131. green: false,
  184132. blue: false,
  184133. alpha: false
  184134. };
  184135. }
  184136. function getDepthOnlyFrontAndBackFaceRenderState(renderState) {
  184137. renderState.cull.enabled = false;
  184138. renderState.colorMask = {
  184139. red: false,
  184140. green: false,
  184141. blue: false,
  184142. alpha: false
  184143. };
  184144. }
  184145. function getTranslucentFrontFaceRenderState(renderState) {
  184146. renderState.cull.face = CullFace_default.BACK;
  184147. renderState.cull.enabled = true;
  184148. renderState.depthMask = false;
  184149. renderState.blending = BlendingState_default.ALPHA_BLEND;
  184150. }
  184151. function getTranslucentBackFaceRenderState(renderState) {
  184152. renderState.cull.face = CullFace_default.FRONT;
  184153. renderState.cull.enabled = true;
  184154. renderState.depthMask = false;
  184155. renderState.blending = BlendingState_default.ALPHA_BLEND;
  184156. }
  184157. function getPickFrontFaceRenderState(renderState) {
  184158. renderState.cull.face = CullFace_default.BACK;
  184159. renderState.cull.enabled = true;
  184160. renderState.blending.enabled = false;
  184161. }
  184162. function getPickBackFaceRenderState(renderState) {
  184163. renderState.cull.face = CullFace_default.FRONT;
  184164. renderState.cull.enabled = true;
  184165. renderState.blending.enabled = false;
  184166. }
  184167. function getDerivedRenderState(renderState, derivedRenderState, renderStateDirty, getRenderStateFunction, cache) {
  184168. if (!defined_default(getRenderStateFunction)) {
  184169. return renderState;
  184170. }
  184171. if (!renderStateDirty && defined_default(derivedRenderState)) {
  184172. return derivedRenderState;
  184173. }
  184174. let cachedRenderState = cache[renderState.id];
  184175. if (!defined_default(cachedRenderState)) {
  184176. const rs = RenderState_default.getState(renderState);
  184177. getRenderStateFunction(rs);
  184178. cachedRenderState = RenderState_default.fromCache(rs);
  184179. cache[renderState.id] = cachedRenderState;
  184180. }
  184181. return cachedRenderState;
  184182. }
  184183. function getTranslucencyUniformMap(state) {
  184184. return {
  184185. u_classificationTexture: function() {
  184186. return state._globeTranslucencyFramebuffer.classificationTexture;
  184187. }
  184188. };
  184189. }
  184190. function getDerivedUniformMap(state, uniformMap2, derivedUniformMap, uniformMapDirty, getDerivedUniformMapFunction) {
  184191. if (!defined_default(getDerivedUniformMapFunction)) {
  184192. return uniformMap2;
  184193. }
  184194. if (!uniformMapDirty && defined_default(derivedUniformMap)) {
  184195. return derivedUniformMap;
  184196. }
  184197. return combine_default(uniformMap2, getDerivedUniformMapFunction(state), false);
  184198. }
  184199. function DerivedCommandPack(options) {
  184200. this.pass = options.pass;
  184201. this.pickOnly = options.pickOnly;
  184202. this.getShaderProgramFunction = options.getShaderProgramFunction;
  184203. this.getRenderStateFunction = options.getRenderStateFunction;
  184204. this.getUniformMapFunction = options.getUniformMapFunction;
  184205. this.renderStateCache = {};
  184206. }
  184207. function createDerivedCommandPacks() {
  184208. return [
  184209. new DerivedCommandPack({
  184210. pass: Pass_default.GLOBE,
  184211. pickOnly: false,
  184212. getShaderProgramFunction: getOpaqueFrontFaceShaderProgram,
  184213. getRenderStateFunction: getOpaqueFrontFaceRenderState,
  184214. getUniformMapFunction: void 0
  184215. }),
  184216. new DerivedCommandPack({
  184217. pass: Pass_default.GLOBE,
  184218. pickOnly: false,
  184219. getShaderProgramFunction: getOpaqueBackFaceShaderProgram,
  184220. getRenderStateFunction: getOpaqueBackFaceRenderState,
  184221. getUniformMapFunction: void 0
  184222. }),
  184223. new DerivedCommandPack({
  184224. pass: Pass_default.GLOBE,
  184225. pickOnly: false,
  184226. getShaderProgramFunction: getDepthOnlyShaderProgram2,
  184227. getRenderStateFunction: getDepthOnlyFrontFaceRenderState,
  184228. getUniformMapFunction: void 0
  184229. }),
  184230. new DerivedCommandPack({
  184231. pass: Pass_default.GLOBE,
  184232. pickOnly: false,
  184233. getShaderProgramFunction: getDepthOnlyShaderProgram2,
  184234. getRenderStateFunction: getDepthOnlyBackFaceRenderState,
  184235. getUniformMapFunction: void 0
  184236. }),
  184237. new DerivedCommandPack({
  184238. pass: Pass_default.GLOBE,
  184239. pickOnly: false,
  184240. getShaderProgramFunction: getDepthOnlyShaderProgram2,
  184241. getRenderStateFunction: getDepthOnlyFrontAndBackFaceRenderState,
  184242. getUniformMapFunction: void 0
  184243. }),
  184244. new DerivedCommandPack({
  184245. pass: Pass_default.TRANSLUCENT,
  184246. pickOnly: false,
  184247. getShaderProgramFunction: getTranslucentShaderProgram,
  184248. getRenderStateFunction: getTranslucentFrontFaceRenderState,
  184249. getUniformMapFunction: getTranslucencyUniformMap
  184250. }),
  184251. new DerivedCommandPack({
  184252. pass: Pass_default.TRANSLUCENT,
  184253. pickOnly: false,
  184254. getShaderProgramFunction: getTranslucentBackFaceShaderProgram,
  184255. getRenderStateFunction: getTranslucentBackFaceRenderState,
  184256. getUniformMapFunction: getTranslucencyUniformMap
  184257. }),
  184258. new DerivedCommandPack({
  184259. pass: Pass_default.TRANSLUCENT,
  184260. pickOnly: false,
  184261. getShaderProgramFunction: getTranslucentFrontFaceManualDepthTestShaderProgram,
  184262. getRenderStateFunction: getTranslucentFrontFaceRenderState,
  184263. getUniformMapFunction: getTranslucencyUniformMap
  184264. }),
  184265. new DerivedCommandPack({
  184266. pass: Pass_default.TRANSLUCENT,
  184267. pickOnly: false,
  184268. getShaderProgramFunction: getTranslucentBackFaceManualDepthTestShaderProgram,
  184269. getRenderStateFunction: getTranslucentBackFaceRenderState,
  184270. getUniformMapFunction: getTranslucencyUniformMap
  184271. }),
  184272. new DerivedCommandPack({
  184273. pass: Pass_default.TRANSLUCENT,
  184274. pickOnly: true,
  184275. getShaderProgramFunction: getPickShaderProgram2,
  184276. getRenderStateFunction: getPickFrontFaceRenderState,
  184277. getUniformMapFunction: getTranslucencyUniformMap
  184278. }),
  184279. new DerivedCommandPack({
  184280. pass: Pass_default.TRANSLUCENT,
  184281. pickOnly: true,
  184282. getShaderProgramFunction: getPickShaderProgram2,
  184283. getRenderStateFunction: getPickBackFaceRenderState,
  184284. getUniformMapFunction: getTranslucencyUniformMap
  184285. })
  184286. ];
  184287. }
  184288. var derivedCommandNames = new Array(derivedCommandsMaximumLength);
  184289. var derivedCommandPacks = new Array(derivedCommandsMaximumLength);
  184290. GlobeTranslucencyState.prototype.updateDerivedCommands = function(command, frameState) {
  184291. const derivedCommandTypes = this._derivedCommandTypesToUpdate;
  184292. const derivedCommandsLength = this._derivedCommandsToUpdateLength;
  184293. if (derivedCommandsLength === 0) {
  184294. return;
  184295. }
  184296. for (let i2 = 0; i2 < derivedCommandsLength; ++i2) {
  184297. derivedCommandPacks[i2] = this._derivedCommandPacks[derivedCommandTypes[i2]];
  184298. derivedCommandNames[i2] = DerivedCommandNames[derivedCommandTypes[i2]];
  184299. }
  184300. updateDerivedCommands(
  184301. this,
  184302. command,
  184303. derivedCommandsLength,
  184304. derivedCommandTypes,
  184305. derivedCommandNames,
  184306. derivedCommandPacks,
  184307. frameState
  184308. );
  184309. };
  184310. function updateDerivedCommands(state, command, derivedCommandsLength, derivedCommandTypes, derivedCommandNames2, derivedCommandPacks2, frameState) {
  184311. let derivedCommandsObject = command.derivedCommands.globeTranslucency;
  184312. const derivedCommandsDirty = state._derivedCommandsDirty;
  184313. if (command.dirty || !defined_default(derivedCommandsObject) || derivedCommandsDirty) {
  184314. command.dirty = false;
  184315. if (!defined_default(derivedCommandsObject)) {
  184316. derivedCommandsObject = {};
  184317. command.derivedCommands.globeTranslucency = derivedCommandsObject;
  184318. }
  184319. const frameNumber = frameState.frameNumber;
  184320. const uniformMapDirtyFrame = defaultValue_default(
  184321. derivedCommandsObject.uniformMapDirtyFrame,
  184322. 0
  184323. );
  184324. const shaderProgramDirtyFrame = defaultValue_default(
  184325. derivedCommandsObject.shaderProgramDirtyFrame,
  184326. 0
  184327. );
  184328. const renderStateDirtyFrame = defaultValue_default(
  184329. derivedCommandsObject.renderStateDirtyFrame,
  184330. 0
  184331. );
  184332. const uniformMapDirty = derivedCommandsObject.uniformMap !== command.uniformMap;
  184333. const shaderProgramDirty = derivedCommandsObject.shaderProgramId !== command.shaderProgram.id;
  184334. const renderStateDirty = derivedCommandsObject.renderStateId !== command.renderState.id;
  184335. if (uniformMapDirty) {
  184336. derivedCommandsObject.uniformMapDirtyFrame = frameNumber;
  184337. }
  184338. if (shaderProgramDirty) {
  184339. derivedCommandsObject.shaderProgramDirtyFrame = frameNumber;
  184340. }
  184341. if (renderStateDirty) {
  184342. derivedCommandsObject.renderStateDirtyFrame = frameNumber;
  184343. }
  184344. derivedCommandsObject.uniformMap = command.uniformMap;
  184345. derivedCommandsObject.shaderProgramId = command.shaderProgram.id;
  184346. derivedCommandsObject.renderStateId = command.renderState.id;
  184347. for (let i2 = 0; i2 < derivedCommandsLength; ++i2) {
  184348. const derivedCommandPack = derivedCommandPacks2[i2];
  184349. const derivedCommandType = derivedCommandTypes[i2];
  184350. const derivedCommandName = derivedCommandNames2[i2];
  184351. let derivedCommand = derivedCommandsObject[derivedCommandName];
  184352. let derivedUniformMap;
  184353. let derivedShaderProgram;
  184354. let derivedRenderState;
  184355. if (defined_default(derivedCommand)) {
  184356. derivedUniformMap = derivedCommand.uniformMap;
  184357. derivedShaderProgram = derivedCommand.shaderProgram;
  184358. derivedRenderState = derivedCommand.renderState;
  184359. } else {
  184360. derivedUniformMap = void 0;
  184361. derivedShaderProgram = void 0;
  184362. derivedRenderState = void 0;
  184363. }
  184364. derivedCommand = DrawCommand_default.shallowClone(command, derivedCommand);
  184365. derivedCommandsObject[derivedCommandName] = derivedCommand;
  184366. const derivedUniformMapDirtyFrame = defaultValue_default(
  184367. derivedCommand.derivedCommands.uniformMapDirtyFrame,
  184368. 0
  184369. );
  184370. const derivedShaderProgramDirtyFrame = defaultValue_default(
  184371. derivedCommand.derivedCommands.shaderProgramDirtyFrame,
  184372. 0
  184373. );
  184374. const derivedRenderStateDirtyFrame = defaultValue_default(
  184375. derivedCommand.derivedCommands.renderStateDirtyFrame,
  184376. 0
  184377. );
  184378. const derivedUniformMapDirty = uniformMapDirty || derivedUniformMapDirtyFrame < uniformMapDirtyFrame;
  184379. const derivedShaderProgramDirty = shaderProgramDirty || derivedShaderProgramDirtyFrame < shaderProgramDirtyFrame;
  184380. const derivedRenderStateDirty = renderStateDirty || derivedRenderStateDirtyFrame < renderStateDirtyFrame;
  184381. if (derivedUniformMapDirty) {
  184382. derivedCommand.derivedCommands.uniformMapDirtyFrame = frameNumber;
  184383. }
  184384. if (derivedShaderProgramDirty) {
  184385. derivedCommand.derivedCommands.shaderProgramDirtyFrame = frameNumber;
  184386. }
  184387. if (derivedRenderStateDirty) {
  184388. derivedCommand.derivedCommands.renderStateDirtyFrame = frameNumber;
  184389. }
  184390. derivedCommand.derivedCommands.type = derivedCommandType;
  184391. derivedCommand.pass = derivedCommandPack.pass;
  184392. derivedCommand.pickOnly = derivedCommandPack.pickOnly;
  184393. derivedCommand.uniformMap = getDerivedUniformMap(
  184394. state,
  184395. command.uniformMap,
  184396. derivedUniformMap,
  184397. derivedUniformMapDirty,
  184398. derivedCommandPack.getUniformMapFunction
  184399. );
  184400. derivedCommand.shaderProgram = getDerivedShaderProgram(
  184401. frameState.context,
  184402. command.shaderProgram,
  184403. derivedShaderProgram,
  184404. derivedShaderProgramDirty,
  184405. derivedCommandPack.getShaderProgramFunction,
  184406. derivedCommandName
  184407. );
  184408. derivedCommand.renderState = getDerivedRenderState(
  184409. command.renderState,
  184410. derivedRenderState,
  184411. derivedRenderStateDirty,
  184412. derivedCommandPack.getRenderStateFunction,
  184413. derivedCommandPack.renderStateCache
  184414. );
  184415. }
  184416. }
  184417. }
  184418. GlobeTranslucencyState.prototype.pushDerivedCommands = function(command, isBlendCommand, frameState) {
  184419. const picking = frameState.passes.pick;
  184420. if (picking && isBlendCommand) {
  184421. return;
  184422. }
  184423. let derivedCommandTypes = this._derivedCommandTypes;
  184424. let derivedCommandsLength = this._derivedCommandsLength;
  184425. if (picking) {
  184426. derivedCommandTypes = this._derivedPickCommandTypes;
  184427. derivedCommandsLength = this._derivedPickCommandsLength;
  184428. } else if (isBlendCommand) {
  184429. derivedCommandTypes = this._derivedBlendCommandTypes;
  184430. derivedCommandsLength = this._derivedBlendCommandsLength;
  184431. }
  184432. if (derivedCommandsLength === 0) {
  184433. frameState.commandList.push(command);
  184434. return;
  184435. }
  184436. const derivedCommands = command.derivedCommands.globeTranslucency;
  184437. for (let i2 = 0; i2 < derivedCommandsLength; ++i2) {
  184438. const derivedCommandName = DerivedCommandNames[derivedCommandTypes[i2]];
  184439. frameState.commandList.push(derivedCommands[derivedCommandName]);
  184440. }
  184441. };
  184442. function executeCommandsMatchingType(commands, commandsLength, executeCommandFunction, scene, context, passState, types) {
  184443. for (let i2 = 0; i2 < commandsLength; ++i2) {
  184444. const command = commands[i2];
  184445. const type = command.derivedCommands.type;
  184446. if (!defined_default(types) || types.indexOf(type) > -1) {
  184447. executeCommandFunction(command, scene, context, passState);
  184448. }
  184449. }
  184450. }
  184451. function executeCommands(commands, commandsLength, executeCommandFunction, scene, context, passState) {
  184452. for (let i2 = 0; i2 < commandsLength; ++i2) {
  184453. executeCommandFunction(commands[i2], scene, context, passState);
  184454. }
  184455. }
  184456. var opaqueTypes = [
  184457. DerivedCommandType.OPAQUE_FRONT_FACE,
  184458. DerivedCommandType.OPAQUE_BACK_FACE
  184459. ];
  184460. var depthOnlyTypes = [
  184461. DerivedCommandType.DEPTH_ONLY_FRONT_FACE,
  184462. DerivedCommandType.DEPTH_ONLY_BACK_FACE,
  184463. DerivedCommandType.DEPTH_ONLY_FRONT_AND_BACK_FACE
  184464. ];
  184465. GlobeTranslucencyState.prototype.executeGlobeCommands = function(frustumCommands, executeCommandFunction, globeTranslucencyFramebuffer, scene, passState) {
  184466. const context = scene.context;
  184467. const globeCommands = frustumCommands.commands[Pass_default.GLOBE];
  184468. const globeCommandsLength = frustumCommands.indices[Pass_default.GLOBE];
  184469. if (globeCommandsLength === 0) {
  184470. return;
  184471. }
  184472. this._globeTranslucencyFramebuffer = globeTranslucencyFramebuffer;
  184473. globeTranslucencyFramebuffer.clearClassification(context, passState);
  184474. executeCommandsMatchingType(
  184475. globeCommands,
  184476. globeCommandsLength,
  184477. executeCommandFunction,
  184478. scene,
  184479. context,
  184480. passState,
  184481. opaqueTypes
  184482. );
  184483. };
  184484. GlobeTranslucencyState.prototype.executeGlobeClassificationCommands = function(frustumCommands, executeCommandFunction, globeTranslucencyFramebuffer, scene, passState) {
  184485. const context = scene.context;
  184486. const globeCommands = frustumCommands.commands[Pass_default.GLOBE];
  184487. const globeCommandsLength = frustumCommands.indices[Pass_default.GLOBE];
  184488. const classificationCommands = frustumCommands.commands[Pass_default.TERRAIN_CLASSIFICATION];
  184489. const classificationCommandsLength = frustumCommands.indices[Pass_default.TERRAIN_CLASSIFICATION];
  184490. if (globeCommandsLength === 0 || classificationCommandsLength === 0) {
  184491. return;
  184492. }
  184493. const frontTranslucent = this._frontFaceTranslucent;
  184494. const backTranslucent = this._backFaceTranslucent;
  184495. if (!frontTranslucent || !backTranslucent) {
  184496. executeCommands(
  184497. classificationCommands,
  184498. classificationCommandsLength,
  184499. executeCommandFunction,
  184500. scene,
  184501. context,
  184502. passState
  184503. );
  184504. }
  184505. if (!frontTranslucent && !backTranslucent) {
  184506. return;
  184507. }
  184508. this._globeTranslucencyFramebuffer = globeTranslucencyFramebuffer;
  184509. const originalGlobeDepthTexture = context.uniformState.globeDepthTexture;
  184510. const originalFramebuffer = passState.framebuffer;
  184511. passState.framebuffer = globeTranslucencyFramebuffer.classificationFramebuffer;
  184512. executeCommandsMatchingType(
  184513. globeCommands,
  184514. globeCommandsLength,
  184515. executeCommandFunction,
  184516. scene,
  184517. context,
  184518. passState,
  184519. depthOnlyTypes
  184520. );
  184521. if (context.depthTexture) {
  184522. const packedDepthTexture = globeTranslucencyFramebuffer.packDepth(
  184523. context,
  184524. passState
  184525. );
  184526. context.uniformState.globeDepthTexture = packedDepthTexture;
  184527. }
  184528. executeCommands(
  184529. classificationCommands,
  184530. classificationCommandsLength,
  184531. executeCommandFunction,
  184532. scene,
  184533. context,
  184534. passState
  184535. );
  184536. context.uniformState.globeDepthTexture = originalGlobeDepthTexture;
  184537. passState.framebuffer = originalFramebuffer;
  184538. };
  184539. var GlobeTranslucencyState_default = GlobeTranslucencyState;
  184540. // node_modules/cesium/Source/Scene/GoogleEarthEnterpriseImageryProvider.js
  184541. function GoogleEarthEnterpriseDiscardPolicy() {
  184542. this._image = new Image();
  184543. }
  184544. GoogleEarthEnterpriseDiscardPolicy.prototype.isReady = function() {
  184545. return true;
  184546. };
  184547. GoogleEarthEnterpriseDiscardPolicy.prototype.shouldDiscardImage = function(image) {
  184548. return image === this._image;
  184549. };
  184550. function GoogleEarthEnterpriseImageryProvider(options) {
  184551. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  184552. if (!(defined_default(options.url) || defined_default(options.metadata))) {
  184553. throw new DeveloperError_default("options.url or options.metadata is required.");
  184554. }
  184555. this.defaultAlpha = void 0;
  184556. this.defaultNightAlpha = void 0;
  184557. this.defaultDayAlpha = void 0;
  184558. this.defaultBrightness = void 0;
  184559. this.defaultContrast = void 0;
  184560. this.defaultHue = void 0;
  184561. this.defaultSaturation = void 0;
  184562. this.defaultGamma = void 0;
  184563. this.defaultMinificationFilter = void 0;
  184564. this.defaultMagnificationFilter = void 0;
  184565. let metadata;
  184566. if (defined_default(options.metadata)) {
  184567. metadata = options.metadata;
  184568. } else {
  184569. const resource = Resource_default.createIfNeeded(options.url);
  184570. metadata = new GoogleEarthEnterpriseMetadata_default(resource);
  184571. }
  184572. this._metadata = metadata;
  184573. this._tileDiscardPolicy = options.tileDiscardPolicy;
  184574. this._tilingScheme = new GeographicTilingScheme_default({
  184575. numberOfLevelZeroTilesX: 2,
  184576. numberOfLevelZeroTilesY: 2,
  184577. rectangle: new Rectangle_default(
  184578. -Math_default.PI,
  184579. -Math_default.PI,
  184580. Math_default.PI,
  184581. Math_default.PI
  184582. ),
  184583. ellipsoid: options.ellipsoid
  184584. });
  184585. let credit = options.credit;
  184586. if (typeof credit === "string") {
  184587. credit = new Credit_default(credit);
  184588. }
  184589. this._credit = credit;
  184590. this._tileWidth = 256;
  184591. this._tileHeight = 256;
  184592. this._maximumLevel = 23;
  184593. if (!defined_default(this._tileDiscardPolicy)) {
  184594. this._tileDiscardPolicy = new GoogleEarthEnterpriseDiscardPolicy();
  184595. }
  184596. this._errorEvent = new Event_default();
  184597. this._ready = false;
  184598. const that = this;
  184599. let metadataError;
  184600. this._readyPromise = metadata.readyPromise.then(function(result) {
  184601. if (!metadata.imageryPresent) {
  184602. const e2 = new RuntimeError_default(
  184603. `The server ${metadata.url} doesn't have imagery`
  184604. );
  184605. metadataError = TileProviderError_default.handleError(
  184606. metadataError,
  184607. that,
  184608. that._errorEvent,
  184609. e2.message,
  184610. void 0,
  184611. void 0,
  184612. void 0,
  184613. e2
  184614. );
  184615. return Promise.reject(e2);
  184616. }
  184617. TileProviderError_default.handleSuccess(metadataError);
  184618. that._ready = result;
  184619. return result;
  184620. }).catch(function(e2) {
  184621. metadataError = TileProviderError_default.handleError(
  184622. metadataError,
  184623. that,
  184624. that._errorEvent,
  184625. e2.message,
  184626. void 0,
  184627. void 0,
  184628. void 0,
  184629. e2
  184630. );
  184631. return Promise.reject(e2);
  184632. });
  184633. }
  184634. Object.defineProperties(GoogleEarthEnterpriseImageryProvider.prototype, {
  184635. url: {
  184636. get: function() {
  184637. return this._metadata.url;
  184638. }
  184639. },
  184640. proxy: {
  184641. get: function() {
  184642. return this._metadata.proxy;
  184643. }
  184644. },
  184645. tileWidth: {
  184646. get: function() {
  184647. if (!this._ready) {
  184648. throw new DeveloperError_default(
  184649. "tileWidth must not be called before the imagery provider is ready."
  184650. );
  184651. }
  184652. return this._tileWidth;
  184653. }
  184654. },
  184655. tileHeight: {
  184656. get: function() {
  184657. if (!this._ready) {
  184658. throw new DeveloperError_default(
  184659. "tileHeight must not be called before the imagery provider is ready."
  184660. );
  184661. }
  184662. return this._tileHeight;
  184663. }
  184664. },
  184665. maximumLevel: {
  184666. get: function() {
  184667. if (!this._ready) {
  184668. throw new DeveloperError_default(
  184669. "maximumLevel must not be called before the imagery provider is ready."
  184670. );
  184671. }
  184672. return this._maximumLevel;
  184673. }
  184674. },
  184675. minimumLevel: {
  184676. get: function() {
  184677. if (!this._ready) {
  184678. throw new DeveloperError_default(
  184679. "minimumLevel must not be called before the imagery provider is ready."
  184680. );
  184681. }
  184682. return 0;
  184683. }
  184684. },
  184685. tilingScheme: {
  184686. get: function() {
  184687. if (!this._ready) {
  184688. throw new DeveloperError_default(
  184689. "tilingScheme must not be called before the imagery provider is ready."
  184690. );
  184691. }
  184692. return this._tilingScheme;
  184693. }
  184694. },
  184695. rectangle: {
  184696. get: function() {
  184697. if (!this._ready) {
  184698. throw new DeveloperError_default(
  184699. "rectangle must not be called before the imagery provider is ready."
  184700. );
  184701. }
  184702. return this._tilingScheme.rectangle;
  184703. }
  184704. },
  184705. tileDiscardPolicy: {
  184706. get: function() {
  184707. if (!this._ready) {
  184708. throw new DeveloperError_default(
  184709. "tileDiscardPolicy must not be called before the imagery provider is ready."
  184710. );
  184711. }
  184712. return this._tileDiscardPolicy;
  184713. }
  184714. },
  184715. errorEvent: {
  184716. get: function() {
  184717. return this._errorEvent;
  184718. }
  184719. },
  184720. ready: {
  184721. get: function() {
  184722. return this._ready;
  184723. }
  184724. },
  184725. readyPromise: {
  184726. get: function() {
  184727. return this._readyPromise;
  184728. }
  184729. },
  184730. credit: {
  184731. get: function() {
  184732. return this._credit;
  184733. }
  184734. },
  184735. hasAlphaChannel: {
  184736. get: function() {
  184737. return false;
  184738. }
  184739. }
  184740. });
  184741. GoogleEarthEnterpriseImageryProvider.prototype.getTileCredits = function(x, y, level) {
  184742. if (!this._ready) {
  184743. throw new DeveloperError_default(
  184744. "getTileCredits must not be called before the imagery provider is ready."
  184745. );
  184746. }
  184747. const metadata = this._metadata;
  184748. const info = metadata.getTileInformation(x, y, level);
  184749. if (defined_default(info)) {
  184750. const credit = metadata.providers[info.imageryProvider];
  184751. if (defined_default(credit)) {
  184752. return [credit];
  184753. }
  184754. }
  184755. return void 0;
  184756. };
  184757. GoogleEarthEnterpriseImageryProvider.prototype.requestImage = function(x, y, level, request) {
  184758. if (!this._ready) {
  184759. throw new DeveloperError_default(
  184760. "requestImage must not be called before the imagery provider is ready."
  184761. );
  184762. }
  184763. const invalidImage = this._tileDiscardPolicy._image;
  184764. const metadata = this._metadata;
  184765. const quadKey = GoogleEarthEnterpriseMetadata_default.tileXYToQuadKey(x, y, level);
  184766. const info = metadata.getTileInformation(x, y, level);
  184767. if (!defined_default(info)) {
  184768. if (metadata.isValid(quadKey)) {
  184769. const metadataRequest = new Request_default({
  184770. throttle: request.throttle,
  184771. throttleByServer: request.throttleByServer,
  184772. type: request.type,
  184773. priorityFunction: request.priorityFunction
  184774. });
  184775. metadata.populateSubtree(x, y, level, metadataRequest);
  184776. return void 0;
  184777. }
  184778. return Promise.resolve(invalidImage);
  184779. }
  184780. if (!info.hasImagery()) {
  184781. return Promise.resolve(invalidImage);
  184782. }
  184783. const promise = buildImageResource3(
  184784. this,
  184785. info,
  184786. x,
  184787. y,
  184788. level,
  184789. request
  184790. ).fetchArrayBuffer();
  184791. if (!defined_default(promise)) {
  184792. return void 0;
  184793. }
  184794. return promise.then(function(image) {
  184795. decodeGoogleEarthEnterpriseData_default(metadata.key, image);
  184796. let a4 = new Uint8Array(image);
  184797. let type;
  184798. const protoImagery = metadata.protoImagery;
  184799. if (!defined_default(protoImagery) || !protoImagery) {
  184800. type = getImageType(a4);
  184801. }
  184802. if (!defined_default(type) && (!defined_default(protoImagery) || protoImagery)) {
  184803. const message = decodeEarthImageryPacket(a4);
  184804. type = message.imageType;
  184805. a4 = message.imageData;
  184806. }
  184807. if (!defined_default(type) || !defined_default(a4)) {
  184808. return invalidImage;
  184809. }
  184810. return loadImageFromTypedArray_default({
  184811. uint8Array: a4,
  184812. format: type,
  184813. flipY: true
  184814. });
  184815. });
  184816. };
  184817. GoogleEarthEnterpriseImageryProvider.prototype.pickFeatures = function(x, y, level, longitude, latitude) {
  184818. return void 0;
  184819. };
  184820. function buildImageResource3(imageryProvider, info, x, y, level, request) {
  184821. const quadKey = GoogleEarthEnterpriseMetadata_default.tileXYToQuadKey(x, y, level);
  184822. let version = info.imageryVersion;
  184823. version = defined_default(version) && version > 0 ? version : 1;
  184824. return imageryProvider._metadata.resource.getDerivedResource({
  184825. url: `flatfile?f1-0${quadKey}-i.${version.toString()}`,
  184826. request
  184827. });
  184828. }
  184829. function getImageType(image) {
  184830. const jpeg = "JFIF";
  184831. if (image[6] === jpeg.charCodeAt(0) && image[7] === jpeg.charCodeAt(1) && image[8] === jpeg.charCodeAt(2) && image[9] === jpeg.charCodeAt(3)) {
  184832. return "image/jpeg";
  184833. }
  184834. const png = "PNG";
  184835. if (image[1] === png.charCodeAt(0) && image[2] === png.charCodeAt(1) && image[3] === png.charCodeAt(2)) {
  184836. return "image/png";
  184837. }
  184838. return void 0;
  184839. }
  184840. function decodeEarthImageryPacket(data) {
  184841. const reader = protobuf$1.Reader.create(data);
  184842. const end = reader.len;
  184843. const message = {};
  184844. while (reader.pos < end) {
  184845. const tag = reader.uint32();
  184846. let copyrightIds;
  184847. switch (tag >>> 3) {
  184848. case 1:
  184849. message.imageType = reader.uint32();
  184850. break;
  184851. case 2:
  184852. message.imageData = reader.bytes();
  184853. break;
  184854. case 3:
  184855. message.alphaType = reader.uint32();
  184856. break;
  184857. case 4:
  184858. message.imageAlpha = reader.bytes();
  184859. break;
  184860. case 5:
  184861. copyrightIds = message.copyrightIds;
  184862. if (!defined_default(copyrightIds)) {
  184863. copyrightIds = message.copyrightIds = [];
  184864. }
  184865. if ((tag & 7) === 2) {
  184866. const end2 = reader.uint32() + reader.pos;
  184867. while (reader.pos < end2) {
  184868. copyrightIds.push(reader.uint32());
  184869. }
  184870. } else {
  184871. copyrightIds.push(reader.uint32());
  184872. }
  184873. break;
  184874. default:
  184875. reader.skipType(tag & 7);
  184876. break;
  184877. }
  184878. }
  184879. const imageType = message.imageType;
  184880. if (defined_default(imageType)) {
  184881. switch (imageType) {
  184882. case 0:
  184883. message.imageType = "image/jpeg";
  184884. break;
  184885. case 4:
  184886. message.imageType = "image/png";
  184887. break;
  184888. default:
  184889. throw new RuntimeError_default(
  184890. "GoogleEarthEnterpriseImageryProvider: Unsupported image type."
  184891. );
  184892. }
  184893. }
  184894. const alphaType = message.alphaType;
  184895. if (defined_default(alphaType) && alphaType !== 0) {
  184896. console.log(
  184897. "GoogleEarthEnterpriseImageryProvider: External alpha not supported."
  184898. );
  184899. delete message.alphaType;
  184900. delete message.imageAlpha;
  184901. }
  184902. return message;
  184903. }
  184904. var GoogleEarthEnterpriseImageryProvider_default = GoogleEarthEnterpriseImageryProvider;
  184905. // node_modules/cesium/Source/Scene/GoogleEarthEnterpriseMapsProvider.js
  184906. function GoogleEarthEnterpriseMapsProvider(options) {
  184907. options = defaultValue_default(options, {});
  184908. if (!defined_default(options.url)) {
  184909. throw new DeveloperError_default("options.url is required.");
  184910. }
  184911. if (!defined_default(options.channel)) {
  184912. throw new DeveloperError_default("options.channel is required.");
  184913. }
  184914. this.defaultAlpha = void 0;
  184915. this.defaultNightAlpha = void 0;
  184916. this.defaultDayAlpha = void 0;
  184917. this.defaultBrightness = void 0;
  184918. this.defaultContrast = void 0;
  184919. this.defaultHue = void 0;
  184920. this.defaultSaturation = void 0;
  184921. this.defaultGamma = 1.9;
  184922. this.defaultMinificationFilter = void 0;
  184923. this.defaultMagnificationFilter = void 0;
  184924. const url2 = options.url;
  184925. const path = defaultValue_default(options.path, "/default_map");
  184926. const resource = Resource_default.createIfNeeded(url2).getDerivedResource({
  184927. url: path[0] === "/" ? path.substring(1) : path
  184928. });
  184929. resource.appendForwardSlash();
  184930. this._resource = resource;
  184931. this._url = url2;
  184932. this._path = path;
  184933. this._tileDiscardPolicy = options.tileDiscardPolicy;
  184934. this._channel = options.channel;
  184935. this._requestType = "ImageryMaps";
  184936. this._credit = new Credit_default(
  184937. `<a href="http://www.google.com/enterprise/mapsearth/products/earthenterprise.html"><img src="${GoogleEarthEnterpriseMapsProvider.logoUrl}" title="Google Imagery"/></a>`
  184938. );
  184939. this._tilingScheme = void 0;
  184940. this._version = void 0;
  184941. this._tileWidth = 256;
  184942. this._tileHeight = 256;
  184943. this._maximumLevel = options.maximumLevel;
  184944. this._errorEvent = new Event_default();
  184945. this._ready = false;
  184946. this._readyPromise = defer_default();
  184947. const metadataResource = resource.getDerivedResource({
  184948. url: "query",
  184949. queryParameters: {
  184950. request: "Json",
  184951. vars: "geeServerDefs",
  184952. is2d: "t"
  184953. }
  184954. });
  184955. const that = this;
  184956. let metadataError;
  184957. function metadataSuccess(text2) {
  184958. let data;
  184959. try {
  184960. data = JSON.parse(text2);
  184961. } catch (e2) {
  184962. data = JSON.parse(
  184963. text2.replace(/([\[\{,])[\n\r ]*([A-Za-z0-9]+)[\n\r ]*:/g, '$1"$2":')
  184964. );
  184965. }
  184966. let layer;
  184967. for (let i2 = 0; i2 < data.layers.length; i2++) {
  184968. if (data.layers[i2].id === that._channel) {
  184969. layer = data.layers[i2];
  184970. break;
  184971. }
  184972. }
  184973. let message;
  184974. if (!defined_default(layer)) {
  184975. message = `Could not find layer with channel (id) of ${that._channel}.`;
  184976. metadataError = TileProviderError_default.handleError(
  184977. metadataError,
  184978. that,
  184979. that._errorEvent,
  184980. message,
  184981. void 0,
  184982. void 0,
  184983. void 0,
  184984. requestMetadata
  184985. );
  184986. throw new RuntimeError_default(message);
  184987. }
  184988. if (!defined_default(layer.version)) {
  184989. message = `Could not find a version in channel (id) ${that._channel}.`;
  184990. metadataError = TileProviderError_default.handleError(
  184991. metadataError,
  184992. that,
  184993. that._errorEvent,
  184994. message,
  184995. void 0,
  184996. void 0,
  184997. void 0,
  184998. requestMetadata
  184999. );
  185000. throw new RuntimeError_default(message);
  185001. }
  185002. that._version = layer.version;
  185003. if (defined_default(data.projection) && data.projection === "flat") {
  185004. that._tilingScheme = new GeographicTilingScheme_default({
  185005. numberOfLevelZeroTilesX: 2,
  185006. numberOfLevelZeroTilesY: 2,
  185007. rectangle: new Rectangle_default(-Math.PI, -Math.PI, Math.PI, Math.PI),
  185008. ellipsoid: options.ellipsoid
  185009. });
  185010. } else if (!defined_default(data.projection) || data.projection === "mercator") {
  185011. that._tilingScheme = new WebMercatorTilingScheme_default({
  185012. numberOfLevelZeroTilesX: 2,
  185013. numberOfLevelZeroTilesY: 2,
  185014. ellipsoid: options.ellipsoid
  185015. });
  185016. } else {
  185017. message = `Unsupported projection ${data.projection}.`;
  185018. metadataError = TileProviderError_default.handleError(
  185019. metadataError,
  185020. that,
  185021. that._errorEvent,
  185022. message,
  185023. void 0,
  185024. void 0,
  185025. void 0,
  185026. requestMetadata
  185027. );
  185028. throw new RuntimeError_default(message);
  185029. }
  185030. that._ready = true;
  185031. that._readyPromise.resolve(true);
  185032. TileProviderError_default.handleSuccess(metadataError);
  185033. }
  185034. function metadataFailure(e2) {
  185035. const message = defaultValue_default(
  185036. e2.message,
  185037. `An error occurred while accessing ${metadataResource.url}.`
  185038. );
  185039. metadataError = TileProviderError_default.handleError(
  185040. metadataError,
  185041. that,
  185042. that._errorEvent,
  185043. message,
  185044. void 0,
  185045. void 0,
  185046. void 0,
  185047. requestMetadata
  185048. );
  185049. that._readyPromise.reject(new RuntimeError_default(message));
  185050. }
  185051. function requestMetadata() {
  185052. metadataResource.fetchText().then(function(text2) {
  185053. metadataSuccess(text2);
  185054. }).catch(function(e2) {
  185055. metadataFailure(e2);
  185056. });
  185057. }
  185058. requestMetadata();
  185059. }
  185060. Object.defineProperties(GoogleEarthEnterpriseMapsProvider.prototype, {
  185061. url: {
  185062. get: function() {
  185063. return this._url;
  185064. }
  185065. },
  185066. path: {
  185067. get: function() {
  185068. return this._path;
  185069. }
  185070. },
  185071. proxy: {
  185072. get: function() {
  185073. return this._resource.proxy;
  185074. }
  185075. },
  185076. channel: {
  185077. get: function() {
  185078. return this._channel;
  185079. }
  185080. },
  185081. tileWidth: {
  185082. get: function() {
  185083. if (!this._ready) {
  185084. throw new DeveloperError_default(
  185085. "tileWidth must not be called before the imagery provider is ready."
  185086. );
  185087. }
  185088. return this._tileWidth;
  185089. }
  185090. },
  185091. tileHeight: {
  185092. get: function() {
  185093. if (!this._ready) {
  185094. throw new DeveloperError_default(
  185095. "tileHeight must not be called before the imagery provider is ready."
  185096. );
  185097. }
  185098. return this._tileHeight;
  185099. }
  185100. },
  185101. maximumLevel: {
  185102. get: function() {
  185103. if (!this._ready) {
  185104. throw new DeveloperError_default(
  185105. "maximumLevel must not be called before the imagery provider is ready."
  185106. );
  185107. }
  185108. return this._maximumLevel;
  185109. }
  185110. },
  185111. minimumLevel: {
  185112. get: function() {
  185113. if (!this._ready) {
  185114. throw new DeveloperError_default(
  185115. "minimumLevel must not be called before the imagery provider is ready."
  185116. );
  185117. }
  185118. return 0;
  185119. }
  185120. },
  185121. tilingScheme: {
  185122. get: function() {
  185123. if (!this._ready) {
  185124. throw new DeveloperError_default(
  185125. "tilingScheme must not be called before the imagery provider is ready."
  185126. );
  185127. }
  185128. return this._tilingScheme;
  185129. }
  185130. },
  185131. version: {
  185132. get: function() {
  185133. if (!this._ready) {
  185134. throw new DeveloperError_default(
  185135. "version must not be called before the imagery provider is ready."
  185136. );
  185137. }
  185138. return this._version;
  185139. }
  185140. },
  185141. requestType: {
  185142. get: function() {
  185143. if (!this._ready) {
  185144. throw new DeveloperError_default(
  185145. "requestType must not be called before the imagery provider is ready."
  185146. );
  185147. }
  185148. return this._requestType;
  185149. }
  185150. },
  185151. rectangle: {
  185152. get: function() {
  185153. if (!this._ready) {
  185154. throw new DeveloperError_default(
  185155. "rectangle must not be called before the imagery provider is ready."
  185156. );
  185157. }
  185158. return this._tilingScheme.rectangle;
  185159. }
  185160. },
  185161. tileDiscardPolicy: {
  185162. get: function() {
  185163. if (!this._ready) {
  185164. throw new DeveloperError_default(
  185165. "tileDiscardPolicy must not be called before the imagery provider is ready."
  185166. );
  185167. }
  185168. return this._tileDiscardPolicy;
  185169. }
  185170. },
  185171. errorEvent: {
  185172. get: function() {
  185173. return this._errorEvent;
  185174. }
  185175. },
  185176. ready: {
  185177. get: function() {
  185178. return this._ready;
  185179. }
  185180. },
  185181. readyPromise: {
  185182. get: function() {
  185183. return this._readyPromise.promise;
  185184. }
  185185. },
  185186. credit: {
  185187. get: function() {
  185188. return this._credit;
  185189. }
  185190. },
  185191. hasAlphaChannel: {
  185192. get: function() {
  185193. return true;
  185194. }
  185195. }
  185196. });
  185197. GoogleEarthEnterpriseMapsProvider.prototype.getTileCredits = function(x, y, level) {
  185198. return void 0;
  185199. };
  185200. GoogleEarthEnterpriseMapsProvider.prototype.requestImage = function(x, y, level, request) {
  185201. if (!this._ready) {
  185202. throw new DeveloperError_default(
  185203. "requestImage must not be called before the imagery provider is ready."
  185204. );
  185205. }
  185206. const resource = this._resource.getDerivedResource({
  185207. url: "query",
  185208. request,
  185209. queryParameters: {
  185210. request: this._requestType,
  185211. channel: this._channel,
  185212. version: this._version,
  185213. x,
  185214. y,
  185215. z: level + 1
  185216. }
  185217. });
  185218. return ImageryProvider_default.loadImage(this, resource);
  185219. };
  185220. GoogleEarthEnterpriseMapsProvider.prototype.pickFeatures = function(x, y, level, longitude, latitude) {
  185221. return void 0;
  185222. };
  185223. GoogleEarthEnterpriseMapsProvider._logoUrl = void 0;
  185224. Object.defineProperties(GoogleEarthEnterpriseMapsProvider, {
  185225. logoUrl: {
  185226. get: function() {
  185227. if (!defined_default(GoogleEarthEnterpriseMapsProvider._logoUrl)) {
  185228. GoogleEarthEnterpriseMapsProvider._logoUrl = buildModuleUrl_default(
  185229. "Assets/Images/google_earth_credit.png"
  185230. );
  185231. }
  185232. return GoogleEarthEnterpriseMapsProvider._logoUrl;
  185233. },
  185234. set: function(value) {
  185235. Check_default.defined("value", value);
  185236. GoogleEarthEnterpriseMapsProvider._logoUrl = value;
  185237. }
  185238. }
  185239. });
  185240. var GoogleEarthEnterpriseMapsProvider_default = GoogleEarthEnterpriseMapsProvider;
  185241. // node_modules/cesium/Source/Scene/GridImageryProvider.js
  185242. var defaultColor9 = new Color_default(1, 1, 1, 0.4);
  185243. var defaultGlowColor = new Color_default(0, 1, 0, 0.05);
  185244. var defaultBackgroundColor3 = new Color_default(0, 0.5, 0, 0.2);
  185245. function GridImageryProvider(options) {
  185246. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  185247. this.defaultAlpha = void 0;
  185248. this.defaultNightAlpha = void 0;
  185249. this.defaultDayAlpha = void 0;
  185250. this.defaultBrightness = void 0;
  185251. this.defaultContrast = void 0;
  185252. this.defaultHue = void 0;
  185253. this.defaultSaturation = void 0;
  185254. this.defaultGamma = void 0;
  185255. this.defaultMinificationFilter = void 0;
  185256. this.defaultMagnificationFilter = void 0;
  185257. this._tilingScheme = defined_default(options.tilingScheme) ? options.tilingScheme : new GeographicTilingScheme_default({ ellipsoid: options.ellipsoid });
  185258. this._cells = defaultValue_default(options.cells, 8);
  185259. this._color = defaultValue_default(options.color, defaultColor9);
  185260. this._glowColor = defaultValue_default(options.glowColor, defaultGlowColor);
  185261. this._glowWidth = defaultValue_default(options.glowWidth, 6);
  185262. this._backgroundColor = defaultValue_default(
  185263. options.backgroundColor,
  185264. defaultBackgroundColor3
  185265. );
  185266. this._errorEvent = new Event_default();
  185267. this._tileWidth = defaultValue_default(options.tileWidth, 256);
  185268. this._tileHeight = defaultValue_default(options.tileHeight, 256);
  185269. this._canvasSize = defaultValue_default(options.canvasSize, 256);
  185270. this._canvas = this._createGridCanvas();
  185271. this._readyPromise = Promise.resolve(true);
  185272. }
  185273. Object.defineProperties(GridImageryProvider.prototype, {
  185274. proxy: {
  185275. get: function() {
  185276. return void 0;
  185277. }
  185278. },
  185279. tileWidth: {
  185280. get: function() {
  185281. return this._tileWidth;
  185282. }
  185283. },
  185284. tileHeight: {
  185285. get: function() {
  185286. return this._tileHeight;
  185287. }
  185288. },
  185289. maximumLevel: {
  185290. get: function() {
  185291. return void 0;
  185292. }
  185293. },
  185294. minimumLevel: {
  185295. get: function() {
  185296. return void 0;
  185297. }
  185298. },
  185299. tilingScheme: {
  185300. get: function() {
  185301. return this._tilingScheme;
  185302. }
  185303. },
  185304. rectangle: {
  185305. get: function() {
  185306. return this._tilingScheme.rectangle;
  185307. }
  185308. },
  185309. tileDiscardPolicy: {
  185310. get: function() {
  185311. return void 0;
  185312. }
  185313. },
  185314. errorEvent: {
  185315. get: function() {
  185316. return this._errorEvent;
  185317. }
  185318. },
  185319. ready: {
  185320. get: function() {
  185321. return true;
  185322. }
  185323. },
  185324. readyPromise: {
  185325. get: function() {
  185326. return this._readyPromise;
  185327. }
  185328. },
  185329. credit: {
  185330. get: function() {
  185331. return void 0;
  185332. }
  185333. },
  185334. hasAlphaChannel: {
  185335. get: function() {
  185336. return true;
  185337. }
  185338. }
  185339. });
  185340. GridImageryProvider.prototype._drawGrid = function(context) {
  185341. const minPixel = 0;
  185342. const maxPixel = this._canvasSize;
  185343. for (let x = 0; x <= this._cells; ++x) {
  185344. const nx = x / this._cells;
  185345. const val = 1 + nx * (maxPixel - 1);
  185346. context.moveTo(val, minPixel);
  185347. context.lineTo(val, maxPixel);
  185348. context.moveTo(minPixel, val);
  185349. context.lineTo(maxPixel, val);
  185350. }
  185351. context.stroke();
  185352. };
  185353. GridImageryProvider.prototype._createGridCanvas = function() {
  185354. const canvas = document.createElement("canvas");
  185355. canvas.width = this._canvasSize;
  185356. canvas.height = this._canvasSize;
  185357. const minPixel = 0;
  185358. const maxPixel = this._canvasSize;
  185359. const context = canvas.getContext("2d");
  185360. const cssBackgroundColor = this._backgroundColor.toCssColorString();
  185361. context.fillStyle = cssBackgroundColor;
  185362. context.fillRect(minPixel, minPixel, maxPixel, maxPixel);
  185363. const cssGlowColor = this._glowColor.toCssColorString();
  185364. context.strokeStyle = cssGlowColor;
  185365. context.lineWidth = this._glowWidth;
  185366. context.strokeRect(minPixel, minPixel, maxPixel, maxPixel);
  185367. this._drawGrid(context);
  185368. context.lineWidth = this._glowWidth * 0.5;
  185369. context.strokeRect(minPixel, minPixel, maxPixel, maxPixel);
  185370. this._drawGrid(context);
  185371. const cssColor = this._color.toCssColorString();
  185372. context.strokeStyle = cssColor;
  185373. context.lineWidth = 2;
  185374. context.strokeRect(minPixel, minPixel, maxPixel, maxPixel);
  185375. context.lineWidth = 1;
  185376. this._drawGrid(context);
  185377. return canvas;
  185378. };
  185379. GridImageryProvider.prototype.getTileCredits = function(x, y, level) {
  185380. return void 0;
  185381. };
  185382. GridImageryProvider.prototype.requestImage = function(x, y, level, request) {
  185383. return Promise.resolve(this._canvas);
  185384. };
  185385. GridImageryProvider.prototype.pickFeatures = function(x, y, level, longitude, latitude) {
  185386. return void 0;
  185387. };
  185388. var GridImageryProvider_default = GridImageryProvider;
  185389. // node_modules/cesium/Source/Scene/ImagerySplitDirection.js
  185390. var ImagerySplitDirection = {};
  185391. function warnDeprecated() {
  185392. deprecationWarning_default(
  185393. "ImagerySplitDirection",
  185394. "ImagerySplitDirection was deprecated in Cesium 1.92. It will be removed in 1.94. Use SplitDirection instead."
  185395. );
  185396. }
  185397. Object.defineProperties(ImagerySplitDirection, {
  185398. LEFT: {
  185399. get: function() {
  185400. warnDeprecated();
  185401. return SplitDirection_default.LEFT;
  185402. }
  185403. },
  185404. NONE: {
  185405. get: function() {
  185406. warnDeprecated();
  185407. return SplitDirection_default.NONE;
  185408. }
  185409. },
  185410. RIGHT: {
  185411. get: function() {
  185412. warnDeprecated();
  185413. return SplitDirection_default.RIGHT;
  185414. }
  185415. }
  185416. });
  185417. var ImagerySplitDirection_default = Object.freeze(ImagerySplitDirection);
  185418. // node_modules/cesium/Source/Scene/InvertClassification.js
  185419. function InvertClassification() {
  185420. this._numSamples = 1;
  185421. this.previousFramebuffer = void 0;
  185422. this._previousFramebuffer = void 0;
  185423. this._depthStencilTexture = void 0;
  185424. this._depthStencilRenderbuffer = void 0;
  185425. this._fbo = new FramebufferManager_default({
  185426. depthStencil: true,
  185427. createDepthAttachments: false
  185428. });
  185429. this._fboClassified = new FramebufferManager_default({
  185430. depthStencil: true,
  185431. createDepthAttachments: false
  185432. });
  185433. this._rsUnclassified = void 0;
  185434. this._rsClassified = void 0;
  185435. this._unclassifiedCommand = void 0;
  185436. this._classifiedCommand = void 0;
  185437. this._translucentCommand = void 0;
  185438. this._clearColorCommand = new ClearCommand_default({
  185439. color: new Color_default(0, 0, 0, 0),
  185440. owner: this
  185441. });
  185442. this._clearCommand = new ClearCommand_default({
  185443. color: new Color_default(0, 0, 0, 0),
  185444. depth: 1,
  185445. stencil: 0
  185446. });
  185447. const that = this;
  185448. this._uniformMap = {
  185449. colorTexture: function() {
  185450. return that._fbo.getColorTexture();
  185451. },
  185452. depthTexture: function() {
  185453. return that._depthStencilTexture;
  185454. },
  185455. classifiedTexture: function() {
  185456. return that._fboClassified.getColorTexture();
  185457. }
  185458. };
  185459. }
  185460. Object.defineProperties(InvertClassification.prototype, {
  185461. unclassifiedCommand: {
  185462. get: function() {
  185463. return this._unclassifiedCommand;
  185464. }
  185465. }
  185466. });
  185467. InvertClassification.isTranslucencySupported = function(context) {
  185468. return context.depthTexture && context.fragmentDepth;
  185469. };
  185470. var rsUnclassified = {
  185471. depthMask: false,
  185472. stencilTest: {
  185473. enabled: true,
  185474. frontFunction: StencilFunction_default.EQUAL,
  185475. frontOperation: {
  185476. fail: StencilOperation_default.KEEP,
  185477. zFail: StencilOperation_default.KEEP,
  185478. zPass: StencilOperation_default.KEEP
  185479. },
  185480. backFunction: StencilFunction_default.NEVER,
  185481. reference: 0,
  185482. mask: StencilConstants_default.CLASSIFICATION_MASK
  185483. },
  185484. blending: BlendingState_default.ALPHA_BLEND
  185485. };
  185486. var rsClassified = {
  185487. depthMask: false,
  185488. stencilTest: {
  185489. enabled: true,
  185490. frontFunction: StencilFunction_default.NOT_EQUAL,
  185491. frontOperation: {
  185492. fail: StencilOperation_default.KEEP,
  185493. zFail: StencilOperation_default.KEEP,
  185494. zPass: StencilOperation_default.KEEP
  185495. },
  185496. backFunction: StencilFunction_default.NEVER,
  185497. reference: 0,
  185498. mask: StencilConstants_default.CLASSIFICATION_MASK
  185499. },
  185500. blending: BlendingState_default.ALPHA_BLEND
  185501. };
  185502. var rsDefault = {
  185503. depthMask: true,
  185504. depthTest: {
  185505. enabled: true
  185506. },
  185507. stencilTest: StencilConstants_default.setCesium3DTileBit(),
  185508. stencilMask: StencilConstants_default.CESIUM_3D_TILE_MASK,
  185509. blending: BlendingState_default.ALPHA_BLEND
  185510. };
  185511. var translucentFS = "#extension GL_EXT_frag_depth : enable\nuniform sampler2D colorTexture;\nuniform sampler2D depthTexture;\nuniform sampler2D classifiedTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n vec4 color = texture2D(colorTexture, v_textureCoordinates);\n if (color.a == 0.0)\n {\n discard;\n }\n bool isClassified = all(equal(texture2D(classifiedTexture, v_textureCoordinates), vec4(0.0)));\n#ifdef UNCLASSIFIED\n vec4 highlightColor = czm_invertClassificationColor;\n if (isClassified)\n {\n discard;\n }\n#else\n vec4 highlightColor = vec4(1.0);\n if (!isClassified)\n {\n discard;\n }\n#endif\n gl_FragColor = color * highlightColor;\n gl_FragDepthEXT = texture2D(depthTexture, v_textureCoordinates).r;\n}\n";
  185512. var opaqueFS = "uniform sampler2D colorTexture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n vec4 color = texture2D(colorTexture, v_textureCoordinates);\n if (color.a == 0.0)\n {\n discard;\n }\n#ifdef UNCLASSIFIED\n gl_FragColor = color * czm_invertClassificationColor;\n#else\n gl_FragColor = color;\n#endif\n}\n";
  185513. InvertClassification.prototype.update = function(context, numSamples, globeFramebuffer) {
  185514. const texture = this._fbo.getColorTexture();
  185515. const previousFramebufferChanged = this.previousFramebuffer !== this._previousFramebuffer;
  185516. this._previousFramebuffer = this.previousFramebuffer;
  185517. const samplesChanged = this._numSamples !== numSamples;
  185518. const width = context.drawingBufferWidth;
  185519. const height = context.drawingBufferHeight;
  185520. const textureChanged = !defined_default(texture) || texture.width !== width || texture.height !== height;
  185521. if (textureChanged || previousFramebufferChanged || samplesChanged) {
  185522. this._numSamples = numSamples;
  185523. this._depthStencilTexture = this._depthStencilTexture && this._depthStencilTexture.destroy();
  185524. this._depthStencilRenderbuffer = this._depthStencilRenderbuffer && this._depthStencilRenderbuffer.destroy();
  185525. if (!defined_default(this._previousFramebuffer)) {
  185526. this._depthStencilTexture = new Texture_default({
  185527. context,
  185528. width,
  185529. height,
  185530. pixelFormat: PixelFormat_default.DEPTH_STENCIL,
  185531. pixelDatatype: PixelDatatype_default.UNSIGNED_INT_24_8
  185532. });
  185533. if (numSamples > 1) {
  185534. this._depthStencilRenderbuffer = new Renderbuffer_default({
  185535. context,
  185536. width,
  185537. height,
  185538. format: RenderbufferFormat_default.DEPTH24_STENCIL8,
  185539. numSamples
  185540. });
  185541. }
  185542. }
  185543. }
  185544. if (!defined_default(this._fbo.framebuffer) || textureChanged || previousFramebufferChanged || samplesChanged) {
  185545. this._fbo.destroy();
  185546. this._fboClassified.destroy();
  185547. let depthStencilTexture;
  185548. let depthStencilRenderbuffer;
  185549. if (defined_default(this._previousFramebuffer)) {
  185550. depthStencilTexture = globeFramebuffer.getDepthStencilTexture();
  185551. depthStencilRenderbuffer = globeFramebuffer.getDepthStencilRenderbuffer();
  185552. } else {
  185553. depthStencilTexture = this._depthStencilTexture;
  185554. depthStencilRenderbuffer = this._depthStencilRenderbuffer;
  185555. }
  185556. this._fbo.setDepthStencilTexture(depthStencilTexture);
  185557. if (defined_default(depthStencilRenderbuffer)) {
  185558. this._fbo.setDepthStencilRenderbuffer(depthStencilRenderbuffer);
  185559. }
  185560. this._fbo.update(context, width, height, numSamples);
  185561. if (!defined_default(this._previousFramebuffer)) {
  185562. this._fboClassified.setDepthStencilTexture(depthStencilTexture);
  185563. this._fboClassified.update(context, width, height);
  185564. }
  185565. }
  185566. if (!defined_default(this._rsUnclassified)) {
  185567. this._rsUnclassified = RenderState_default.fromCache(rsUnclassified);
  185568. this._rsClassified = RenderState_default.fromCache(rsClassified);
  185569. this._rsDefault = RenderState_default.fromCache(rsDefault);
  185570. }
  185571. if (!defined_default(this._unclassifiedCommand) || previousFramebufferChanged || samplesChanged) {
  185572. if (defined_default(this._unclassifiedCommand)) {
  185573. this._unclassifiedCommand.shaderProgram = this._unclassifiedCommand.shaderProgram && this._unclassifiedCommand.shaderProgram.destroy();
  185574. this._classifiedCommand.shaderProgram = this._classifiedCommand.shaderProgram && this._classifiedCommand.shaderProgram.destroy();
  185575. }
  185576. const fs = defined_default(this._previousFramebuffer) ? opaqueFS : translucentFS;
  185577. const unclassifiedFSSource = new ShaderSource_default({
  185578. defines: ["UNCLASSIFIED"],
  185579. sources: [fs]
  185580. });
  185581. const classifiedFSSource = new ShaderSource_default({
  185582. sources: [fs]
  185583. });
  185584. this._unclassifiedCommand = context.createViewportQuadCommand(
  185585. unclassifiedFSSource,
  185586. {
  185587. renderState: defined_default(this._previousFramebuffer) ? this._rsUnclassified : this._rsDefault,
  185588. uniformMap: this._uniformMap,
  185589. owner: this
  185590. }
  185591. );
  185592. this._classifiedCommand = context.createViewportQuadCommand(
  185593. classifiedFSSource,
  185594. {
  185595. renderState: defined_default(this._previousFramebuffer) ? this._rsClassified : this._rsDefault,
  185596. uniformMap: this._uniformMap,
  185597. owner: this
  185598. }
  185599. );
  185600. if (defined_default(this._translucentCommand)) {
  185601. this._translucentCommand.shaderProgram = this._translucentCommand.shaderProgram && this._translucentCommand.shaderProgram.destroy();
  185602. }
  185603. if (!defined_default(this._previousFramebuffer)) {
  185604. this._translucentCommand = context.createViewportQuadCommand(
  185605. PassThrough_default,
  185606. {
  185607. renderState: this._rsUnclassified,
  185608. uniformMap: this._uniformMap,
  185609. owner: this
  185610. }
  185611. );
  185612. }
  185613. }
  185614. };
  185615. InvertClassification.prototype.prepareTextures = function(context, blitStencil) {
  185616. if (this._fbo._numSamples > 1) {
  185617. this._fbo.prepareTextures(context, blitStencil);
  185618. }
  185619. };
  185620. InvertClassification.prototype.clear = function(context, passState) {
  185621. if (defined_default(this._previousFramebuffer)) {
  185622. this._fbo.clear(context, this._clearColorCommand, passState);
  185623. } else {
  185624. this._fbo.clear(context, this._clearCommand, passState);
  185625. this._fboClassified.clear(context, this._clearCommand, passState);
  185626. }
  185627. };
  185628. InvertClassification.prototype.executeClassified = function(context, passState) {
  185629. if (!defined_default(this._previousFramebuffer)) {
  185630. const framebuffer = passState.framebuffer;
  185631. this.prepareTextures(context, true);
  185632. passState.framebuffer = this._fboClassified.framebuffer;
  185633. this._translucentCommand.execute(context, passState);
  185634. passState.framebuffer = framebuffer;
  185635. }
  185636. this._classifiedCommand.execute(context, passState);
  185637. };
  185638. InvertClassification.prototype.executeUnclassified = function(context, passState) {
  185639. this._unclassifiedCommand.execute(context, passState);
  185640. };
  185641. InvertClassification.prototype.isDestroyed = function() {
  185642. return false;
  185643. };
  185644. InvertClassification.prototype.destroy = function() {
  185645. this._fbo.destroy();
  185646. this._fboClassified.destroy();
  185647. this._depthStencilTexture = this._depthStencilTexture && this._depthStencilTexture.destroy();
  185648. this._depthStencilRenderbuffer = this._depthStencilRenderbuffer && this._depthStencilRenderbuffer.destroy();
  185649. if (defined_default(this._unclassifiedCommand)) {
  185650. this._unclassifiedCommand.shaderProgram = this._unclassifiedCommand.shaderProgram && this._unclassifiedCommand.shaderProgram.destroy();
  185651. this._classifiedCommand.shaderProgram = this._classifiedCommand.shaderProgram && this._classifiedCommand.shaderProgram.destroy();
  185652. }
  185653. return destroyObject_default(this);
  185654. };
  185655. var InvertClassification_default = InvertClassification;
  185656. // node_modules/cesium/Source/Scene/UrlTemplateImageryProvider.js
  185657. var templateRegex = /{[^}]+}/g;
  185658. var tags = {
  185659. x: xTag,
  185660. y: yTag,
  185661. z: zTag,
  185662. s: sTag,
  185663. reverseX: reverseXTag,
  185664. reverseY: reverseYTag,
  185665. reverseZ: reverseZTag,
  185666. westDegrees: westDegreesTag,
  185667. southDegrees: southDegreesTag,
  185668. eastDegrees: eastDegreesTag,
  185669. northDegrees: northDegreesTag,
  185670. westProjected: westProjectedTag,
  185671. southProjected: southProjectedTag,
  185672. eastProjected: eastProjectedTag,
  185673. northProjected: northProjectedTag,
  185674. width: widthTag,
  185675. height: heightTag
  185676. };
  185677. var pickFeaturesTags = combine_default(tags, {
  185678. i: iTag,
  185679. j: jTag,
  185680. reverseI: reverseITag,
  185681. reverseJ: reverseJTag,
  185682. longitudeDegrees: longitudeDegreesTag,
  185683. latitudeDegrees: latitudeDegreesTag,
  185684. longitudeProjected: longitudeProjectedTag,
  185685. latitudeProjected: latitudeProjectedTag,
  185686. format: formatTag
  185687. });
  185688. function UrlTemplateImageryProvider(options) {
  185689. if (!defined_default(options)) {
  185690. throw new DeveloperError_default("options is required.");
  185691. }
  185692. if (!defined_default(options.then) && !defined_default(options.url)) {
  185693. throw new DeveloperError_default("options is required.");
  185694. }
  185695. this._errorEvent = new Event_default();
  185696. this._resource = void 0;
  185697. this._urlSchemeZeroPadding = void 0;
  185698. this._pickFeaturesResource = void 0;
  185699. this._tileWidth = void 0;
  185700. this._tileHeight = void 0;
  185701. this._maximumLevel = void 0;
  185702. this._minimumLevel = void 0;
  185703. this._tilingScheme = void 0;
  185704. this._rectangle = void 0;
  185705. this._tileDiscardPolicy = void 0;
  185706. this._credit = void 0;
  185707. this._hasAlphaChannel = void 0;
  185708. this._readyPromise = void 0;
  185709. this._tags = void 0;
  185710. this._pickFeaturesTags = void 0;
  185711. this.defaultAlpha = void 0;
  185712. this.defaultNightAlpha = void 0;
  185713. this.defaultDayAlpha = void 0;
  185714. this.defaultBrightness = void 0;
  185715. this.defaultContrast = void 0;
  185716. this.defaultHue = void 0;
  185717. this.defaultSaturation = void 0;
  185718. this.defaultGamma = void 0;
  185719. this.defaultMinificationFilter = void 0;
  185720. this.defaultMagnificationFilter = void 0;
  185721. this.enablePickFeatures = true;
  185722. this.reinitialize(options);
  185723. }
  185724. Object.defineProperties(UrlTemplateImageryProvider.prototype, {
  185725. url: {
  185726. get: function() {
  185727. return this._resource.url;
  185728. }
  185729. },
  185730. urlSchemeZeroPadding: {
  185731. get: function() {
  185732. return this._urlSchemeZeroPadding;
  185733. }
  185734. },
  185735. pickFeaturesUrl: {
  185736. get: function() {
  185737. return this._pickFeaturesResource.url;
  185738. }
  185739. },
  185740. proxy: {
  185741. get: function() {
  185742. return this._resource.proxy;
  185743. }
  185744. },
  185745. tileWidth: {
  185746. get: function() {
  185747. if (!this.ready) {
  185748. throw new DeveloperError_default(
  185749. "tileWidth must not be called before the imagery provider is ready."
  185750. );
  185751. }
  185752. return this._tileWidth;
  185753. }
  185754. },
  185755. tileHeight: {
  185756. get: function() {
  185757. if (!this.ready) {
  185758. throw new DeveloperError_default(
  185759. "tileHeight must not be called before the imagery provider is ready."
  185760. );
  185761. }
  185762. return this._tileHeight;
  185763. }
  185764. },
  185765. maximumLevel: {
  185766. get: function() {
  185767. if (!this.ready) {
  185768. throw new DeveloperError_default(
  185769. "maximumLevel must not be called before the imagery provider is ready."
  185770. );
  185771. }
  185772. return this._maximumLevel;
  185773. }
  185774. },
  185775. minimumLevel: {
  185776. get: function() {
  185777. if (!this.ready) {
  185778. throw new DeveloperError_default(
  185779. "minimumLevel must not be called before the imagery provider is ready."
  185780. );
  185781. }
  185782. return this._minimumLevel;
  185783. }
  185784. },
  185785. tilingScheme: {
  185786. get: function() {
  185787. if (!this.ready) {
  185788. throw new DeveloperError_default(
  185789. "tilingScheme must not be called before the imagery provider is ready."
  185790. );
  185791. }
  185792. return this._tilingScheme;
  185793. }
  185794. },
  185795. rectangle: {
  185796. get: function() {
  185797. if (!this.ready) {
  185798. throw new DeveloperError_default(
  185799. "rectangle must not be called before the imagery provider is ready."
  185800. );
  185801. }
  185802. return this._rectangle;
  185803. }
  185804. },
  185805. tileDiscardPolicy: {
  185806. get: function() {
  185807. if (!this.ready) {
  185808. throw new DeveloperError_default(
  185809. "tileDiscardPolicy must not be called before the imagery provider is ready."
  185810. );
  185811. }
  185812. return this._tileDiscardPolicy;
  185813. }
  185814. },
  185815. errorEvent: {
  185816. get: function() {
  185817. return this._errorEvent;
  185818. }
  185819. },
  185820. ready: {
  185821. get: function() {
  185822. return defined_default(this._resource);
  185823. }
  185824. },
  185825. readyPromise: {
  185826. get: function() {
  185827. return this._readyPromise;
  185828. }
  185829. },
  185830. credit: {
  185831. get: function() {
  185832. if (!this.ready) {
  185833. throw new DeveloperError_default(
  185834. "credit must not be called before the imagery provider is ready."
  185835. );
  185836. }
  185837. return this._credit;
  185838. }
  185839. },
  185840. hasAlphaChannel: {
  185841. get: function() {
  185842. if (!this.ready) {
  185843. throw new DeveloperError_default(
  185844. "hasAlphaChannel must not be called before the imagery provider is ready."
  185845. );
  185846. }
  185847. return this._hasAlphaChannel;
  185848. }
  185849. }
  185850. });
  185851. UrlTemplateImageryProvider.prototype.reinitialize = function(options) {
  185852. const that = this;
  185853. that._readyPromise = Promise.resolve(options).then(function(properties) {
  185854. if (!defined_default(properties)) {
  185855. throw new DeveloperError_default("options is required.");
  185856. }
  185857. if (!defined_default(properties.url)) {
  185858. throw new DeveloperError_default("options.url is required.");
  185859. }
  185860. const customTags = properties.customTags;
  185861. const allTags = combine_default(tags, customTags);
  185862. const allPickFeaturesTags = combine_default(pickFeaturesTags, customTags);
  185863. const resource = Resource_default.createIfNeeded(properties.url);
  185864. const pickFeaturesResource = Resource_default.createIfNeeded(
  185865. properties.pickFeaturesUrl
  185866. );
  185867. that.enablePickFeatures = defaultValue_default(
  185868. properties.enablePickFeatures,
  185869. that.enablePickFeatures
  185870. );
  185871. that._urlSchemeZeroPadding = defaultValue_default(
  185872. properties.urlSchemeZeroPadding,
  185873. that.urlSchemeZeroPadding
  185874. );
  185875. that._tileDiscardPolicy = properties.tileDiscardPolicy;
  185876. that._getFeatureInfoFormats = properties.getFeatureInfoFormats;
  185877. that._subdomains = properties.subdomains;
  185878. if (Array.isArray(that._subdomains)) {
  185879. that._subdomains = that._subdomains.slice();
  185880. } else if (defined_default(that._subdomains) && that._subdomains.length > 0) {
  185881. that._subdomains = that._subdomains.split("");
  185882. } else {
  185883. that._subdomains = ["a", "b", "c"];
  185884. }
  185885. that._tileWidth = defaultValue_default(properties.tileWidth, 256);
  185886. that._tileHeight = defaultValue_default(properties.tileHeight, 256);
  185887. that._minimumLevel = defaultValue_default(properties.minimumLevel, 0);
  185888. that._maximumLevel = properties.maximumLevel;
  185889. that._tilingScheme = defaultValue_default(
  185890. properties.tilingScheme,
  185891. new WebMercatorTilingScheme_default({ ellipsoid: properties.ellipsoid })
  185892. );
  185893. that._rectangle = defaultValue_default(
  185894. properties.rectangle,
  185895. that._tilingScheme.rectangle
  185896. );
  185897. that._rectangle = Rectangle_default.intersection(
  185898. that._rectangle,
  185899. that._tilingScheme.rectangle
  185900. );
  185901. that._hasAlphaChannel = defaultValue_default(properties.hasAlphaChannel, true);
  185902. let credit = properties.credit;
  185903. if (typeof credit === "string") {
  185904. credit = new Credit_default(credit);
  185905. }
  185906. that._credit = credit;
  185907. that._resource = resource;
  185908. that._tags = allTags;
  185909. that._pickFeaturesResource = pickFeaturesResource;
  185910. that._pickFeaturesTags = allPickFeaturesTags;
  185911. return true;
  185912. });
  185913. };
  185914. UrlTemplateImageryProvider.prototype.getTileCredits = function(x, y, level) {
  185915. if (!this.ready) {
  185916. throw new DeveloperError_default(
  185917. "getTileCredits must not be called before the imagery provider is ready."
  185918. );
  185919. }
  185920. return void 0;
  185921. };
  185922. UrlTemplateImageryProvider.prototype.requestImage = function(x, y, level, request) {
  185923. if (!this.ready) {
  185924. throw new DeveloperError_default(
  185925. "requestImage must not be called before the imagery provider is ready."
  185926. );
  185927. }
  185928. return ImageryProvider_default.loadImage(
  185929. this,
  185930. buildImageResource4(this, x, y, level, request)
  185931. );
  185932. };
  185933. UrlTemplateImageryProvider.prototype.pickFeatures = function(x, y, level, longitude, latitude) {
  185934. if (!this.ready) {
  185935. throw new DeveloperError_default(
  185936. "pickFeatures must not be called before the imagery provider is ready."
  185937. );
  185938. }
  185939. if (!this.enablePickFeatures || !defined_default(this._pickFeaturesResource) || this._getFeatureInfoFormats.length === 0) {
  185940. return void 0;
  185941. }
  185942. let formatIndex = 0;
  185943. const that = this;
  185944. function handleResponse(format, data) {
  185945. return format.callback(data);
  185946. }
  185947. function doRequest() {
  185948. if (formatIndex >= that._getFeatureInfoFormats.length) {
  185949. return Promise.resolve([]);
  185950. }
  185951. const format = that._getFeatureInfoFormats[formatIndex];
  185952. const resource = buildPickFeaturesResource(
  185953. that,
  185954. x,
  185955. y,
  185956. level,
  185957. longitude,
  185958. latitude,
  185959. format.format
  185960. );
  185961. ++formatIndex;
  185962. if (format.type === "json") {
  185963. return resource.fetchJson().then(format.callback).catch(doRequest);
  185964. } else if (format.type === "xml") {
  185965. return resource.fetchXML().then(format.callback).catch(doRequest);
  185966. } else if (format.type === "text" || format.type === "html") {
  185967. return resource.fetchText().then(format.callback).catch(doRequest);
  185968. }
  185969. return resource.fetch({
  185970. responseType: format.format
  185971. }).then(handleResponse.bind(void 0, format)).catch(doRequest);
  185972. }
  185973. return doRequest();
  185974. };
  185975. var degreesScratchComputed = false;
  185976. var degreesScratch = new Rectangle_default();
  185977. var projectedScratchComputed = false;
  185978. var projectedScratch = new Rectangle_default();
  185979. function buildImageResource4(imageryProvider, x, y, level, request) {
  185980. degreesScratchComputed = false;
  185981. projectedScratchComputed = false;
  185982. const resource = imageryProvider._resource;
  185983. const url2 = resource.getUrlComponent(true);
  185984. const allTags = imageryProvider._tags;
  185985. const templateValues = {};
  185986. const match = url2.match(templateRegex);
  185987. if (defined_default(match)) {
  185988. match.forEach(function(tag) {
  185989. const key = tag.substring(1, tag.length - 1);
  185990. if (defined_default(allTags[key])) {
  185991. templateValues[key] = allTags[key](imageryProvider, x, y, level);
  185992. }
  185993. });
  185994. }
  185995. return resource.getDerivedResource({
  185996. request,
  185997. templateValues
  185998. });
  185999. }
  186000. var ijScratchComputed = false;
  186001. var ijScratch = new Cartesian2_default();
  186002. var longitudeLatitudeProjectedScratchComputed = false;
  186003. function buildPickFeaturesResource(imageryProvider, x, y, level, longitude, latitude, format) {
  186004. degreesScratchComputed = false;
  186005. projectedScratchComputed = false;
  186006. ijScratchComputed = false;
  186007. longitudeLatitudeProjectedScratchComputed = false;
  186008. const resource = imageryProvider._pickFeaturesResource;
  186009. const url2 = resource.getUrlComponent(true);
  186010. const allTags = imageryProvider._pickFeaturesTags;
  186011. const templateValues = {};
  186012. const match = url2.match(templateRegex);
  186013. if (defined_default(match)) {
  186014. match.forEach(function(tag) {
  186015. const key = tag.substring(1, tag.length - 1);
  186016. if (defined_default(allTags[key])) {
  186017. templateValues[key] = allTags[key](
  186018. imageryProvider,
  186019. x,
  186020. y,
  186021. level,
  186022. longitude,
  186023. latitude,
  186024. format
  186025. );
  186026. }
  186027. });
  186028. }
  186029. return resource.getDerivedResource({
  186030. templateValues
  186031. });
  186032. }
  186033. function padWithZerosIfNecessary(imageryProvider, key, value) {
  186034. if (imageryProvider && imageryProvider.urlSchemeZeroPadding && imageryProvider.urlSchemeZeroPadding.hasOwnProperty(key)) {
  186035. const paddingTemplate = imageryProvider.urlSchemeZeroPadding[key];
  186036. if (typeof paddingTemplate === "string") {
  186037. const paddingTemplateWidth = paddingTemplate.length;
  186038. if (paddingTemplateWidth > 1) {
  186039. value = value.length >= paddingTemplateWidth ? value : new Array(
  186040. paddingTemplateWidth - value.toString().length + 1
  186041. ).join("0") + value;
  186042. }
  186043. }
  186044. }
  186045. return value;
  186046. }
  186047. function xTag(imageryProvider, x, y, level) {
  186048. return padWithZerosIfNecessary(imageryProvider, "{x}", x);
  186049. }
  186050. function reverseXTag(imageryProvider, x, y, level) {
  186051. const reverseX = imageryProvider.tilingScheme.getNumberOfXTilesAtLevel(level) - x - 1;
  186052. return padWithZerosIfNecessary(imageryProvider, "{reverseX}", reverseX);
  186053. }
  186054. function yTag(imageryProvider, x, y, level) {
  186055. return padWithZerosIfNecessary(imageryProvider, "{y}", y);
  186056. }
  186057. function reverseYTag(imageryProvider, x, y, level) {
  186058. const reverseY = imageryProvider.tilingScheme.getNumberOfYTilesAtLevel(level) - y - 1;
  186059. return padWithZerosIfNecessary(imageryProvider, "{reverseY}", reverseY);
  186060. }
  186061. function reverseZTag(imageryProvider, x, y, level) {
  186062. const maximumLevel = imageryProvider.maximumLevel;
  186063. const reverseZ = defined_default(maximumLevel) && level < maximumLevel ? maximumLevel - level - 1 : level;
  186064. return padWithZerosIfNecessary(imageryProvider, "{reverseZ}", reverseZ);
  186065. }
  186066. function zTag(imageryProvider, x, y, level) {
  186067. return padWithZerosIfNecessary(imageryProvider, "{z}", level);
  186068. }
  186069. function sTag(imageryProvider, x, y, level) {
  186070. const index2 = (x + y + level) % imageryProvider._subdomains.length;
  186071. return imageryProvider._subdomains[index2];
  186072. }
  186073. function computeDegrees(imageryProvider, x, y, level) {
  186074. if (degreesScratchComputed) {
  186075. return;
  186076. }
  186077. imageryProvider.tilingScheme.tileXYToRectangle(x, y, level, degreesScratch);
  186078. degreesScratch.west = Math_default.toDegrees(degreesScratch.west);
  186079. degreesScratch.south = Math_default.toDegrees(degreesScratch.south);
  186080. degreesScratch.east = Math_default.toDegrees(degreesScratch.east);
  186081. degreesScratch.north = Math_default.toDegrees(degreesScratch.north);
  186082. degreesScratchComputed = true;
  186083. }
  186084. function westDegreesTag(imageryProvider, x, y, level) {
  186085. computeDegrees(imageryProvider, x, y, level);
  186086. return degreesScratch.west;
  186087. }
  186088. function southDegreesTag(imageryProvider, x, y, level) {
  186089. computeDegrees(imageryProvider, x, y, level);
  186090. return degreesScratch.south;
  186091. }
  186092. function eastDegreesTag(imageryProvider, x, y, level) {
  186093. computeDegrees(imageryProvider, x, y, level);
  186094. return degreesScratch.east;
  186095. }
  186096. function northDegreesTag(imageryProvider, x, y, level) {
  186097. computeDegrees(imageryProvider, x, y, level);
  186098. return degreesScratch.north;
  186099. }
  186100. function computeProjected(imageryProvider, x, y, level) {
  186101. if (projectedScratchComputed) {
  186102. return;
  186103. }
  186104. imageryProvider.tilingScheme.tileXYToNativeRectangle(
  186105. x,
  186106. y,
  186107. level,
  186108. projectedScratch
  186109. );
  186110. projectedScratchComputed = true;
  186111. }
  186112. function westProjectedTag(imageryProvider, x, y, level) {
  186113. computeProjected(imageryProvider, x, y, level);
  186114. return projectedScratch.west;
  186115. }
  186116. function southProjectedTag(imageryProvider, x, y, level) {
  186117. computeProjected(imageryProvider, x, y, level);
  186118. return projectedScratch.south;
  186119. }
  186120. function eastProjectedTag(imageryProvider, x, y, level) {
  186121. computeProjected(imageryProvider, x, y, level);
  186122. return projectedScratch.east;
  186123. }
  186124. function northProjectedTag(imageryProvider, x, y, level) {
  186125. computeProjected(imageryProvider, x, y, level);
  186126. return projectedScratch.north;
  186127. }
  186128. function widthTag(imageryProvider, x, y, level) {
  186129. return imageryProvider.tileWidth;
  186130. }
  186131. function heightTag(imageryProvider, x, y, level) {
  186132. return imageryProvider.tileHeight;
  186133. }
  186134. function iTag(imageryProvider, x, y, level, longitude, latitude, format) {
  186135. computeIJ(imageryProvider, x, y, level, longitude, latitude);
  186136. return ijScratch.x;
  186137. }
  186138. function jTag(imageryProvider, x, y, level, longitude, latitude, format) {
  186139. computeIJ(imageryProvider, x, y, level, longitude, latitude);
  186140. return ijScratch.y;
  186141. }
  186142. function reverseITag(imageryProvider, x, y, level, longitude, latitude, format) {
  186143. computeIJ(imageryProvider, x, y, level, longitude, latitude);
  186144. return imageryProvider.tileWidth - ijScratch.x - 1;
  186145. }
  186146. function reverseJTag(imageryProvider, x, y, level, longitude, latitude, format) {
  186147. computeIJ(imageryProvider, x, y, level, longitude, latitude);
  186148. return imageryProvider.tileHeight - ijScratch.y - 1;
  186149. }
  186150. var rectangleScratch7 = new Rectangle_default();
  186151. var longitudeLatitudeProjectedScratch = new Cartesian3_default();
  186152. function computeIJ(imageryProvider, x, y, level, longitude, latitude, format) {
  186153. if (ijScratchComputed) {
  186154. return;
  186155. }
  186156. computeLongitudeLatitudeProjected(
  186157. imageryProvider,
  186158. x,
  186159. y,
  186160. level,
  186161. longitude,
  186162. latitude
  186163. );
  186164. const projected = longitudeLatitudeProjectedScratch;
  186165. const rectangle = imageryProvider.tilingScheme.tileXYToNativeRectangle(
  186166. x,
  186167. y,
  186168. level,
  186169. rectangleScratch7
  186170. );
  186171. ijScratch.x = imageryProvider.tileWidth * (projected.x - rectangle.west) / rectangle.width | 0;
  186172. ijScratch.y = imageryProvider.tileHeight * (rectangle.north - projected.y) / rectangle.height | 0;
  186173. ijScratchComputed = true;
  186174. }
  186175. function longitudeDegreesTag(imageryProvider, x, y, level, longitude, latitude, format) {
  186176. return Math_default.toDegrees(longitude);
  186177. }
  186178. function latitudeDegreesTag(imageryProvider, x, y, level, longitude, latitude, format) {
  186179. return Math_default.toDegrees(latitude);
  186180. }
  186181. function longitudeProjectedTag(imageryProvider, x, y, level, longitude, latitude, format) {
  186182. computeLongitudeLatitudeProjected(
  186183. imageryProvider,
  186184. x,
  186185. y,
  186186. level,
  186187. longitude,
  186188. latitude
  186189. );
  186190. return longitudeLatitudeProjectedScratch.x;
  186191. }
  186192. function latitudeProjectedTag(imageryProvider, x, y, level, longitude, latitude, format) {
  186193. computeLongitudeLatitudeProjected(
  186194. imageryProvider,
  186195. x,
  186196. y,
  186197. level,
  186198. longitude,
  186199. latitude
  186200. );
  186201. return longitudeLatitudeProjectedScratch.y;
  186202. }
  186203. var cartographicScratch5 = new Cartographic_default();
  186204. function computeLongitudeLatitudeProjected(imageryProvider, x, y, level, longitude, latitude, format) {
  186205. if (longitudeLatitudeProjectedScratchComputed) {
  186206. return;
  186207. }
  186208. if (imageryProvider.tilingScheme.projection instanceof GeographicProjection_default) {
  186209. longitudeLatitudeProjectedScratch.x = Math_default.toDegrees(longitude);
  186210. longitudeLatitudeProjectedScratch.y = Math_default.toDegrees(latitude);
  186211. } else {
  186212. const cartographic2 = cartographicScratch5;
  186213. cartographic2.longitude = longitude;
  186214. cartographic2.latitude = latitude;
  186215. imageryProvider.tilingScheme.projection.project(
  186216. cartographic2,
  186217. longitudeLatitudeProjectedScratch
  186218. );
  186219. }
  186220. longitudeLatitudeProjectedScratchComputed = true;
  186221. }
  186222. function formatTag(imageryProvider, x, y, level, longitude, latitude, format) {
  186223. return format;
  186224. }
  186225. var UrlTemplateImageryProvider_default = UrlTemplateImageryProvider;
  186226. // node_modules/cesium/Source/Scene/TileMapServiceImageryProvider.js
  186227. function TileMapServiceImageryProvider(options) {
  186228. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  186229. if (!defined_default(options.url)) {
  186230. throw new DeveloperError_default("options.url is required.");
  186231. }
  186232. const deferred = defer_default();
  186233. UrlTemplateImageryProvider_default.call(this, deferred.promise);
  186234. this._tmsResource = void 0;
  186235. this._xmlResource = void 0;
  186236. this._options = options;
  186237. this._deferred = deferred;
  186238. this._metadataError = void 0;
  186239. this._metadataSuccess = this._metadataSuccess.bind(this);
  186240. this._metadataFailure = this._metadataFailure.bind(this);
  186241. this._requestMetadata = this._requestMetadata.bind(this);
  186242. let resource;
  186243. const that = this;
  186244. Promise.resolve(options.url).then(function(url2) {
  186245. resource = Resource_default.createIfNeeded(url2);
  186246. resource.appendForwardSlash();
  186247. that._tmsResource = resource;
  186248. that._xmlResource = resource.getDerivedResource({
  186249. url: "tilemapresource.xml"
  186250. });
  186251. that._requestMetadata();
  186252. }).catch(function(e2) {
  186253. deferred.reject(e2);
  186254. });
  186255. }
  186256. if (defined_default(Object.create)) {
  186257. TileMapServiceImageryProvider.prototype = Object.create(
  186258. UrlTemplateImageryProvider_default.prototype
  186259. );
  186260. TileMapServiceImageryProvider.prototype.constructor = TileMapServiceImageryProvider;
  186261. }
  186262. TileMapServiceImageryProvider.prototype._requestMetadata = function() {
  186263. this._xmlResource.fetchXML().then(this._metadataSuccess).catch(this._metadataFailure);
  186264. };
  186265. function confineRectangleToTilingScheme(rectangle, tilingScheme2) {
  186266. if (rectangle.west < tilingScheme2.rectangle.west) {
  186267. rectangle.west = tilingScheme2.rectangle.west;
  186268. }
  186269. if (rectangle.east > tilingScheme2.rectangle.east) {
  186270. rectangle.east = tilingScheme2.rectangle.east;
  186271. }
  186272. if (rectangle.south < tilingScheme2.rectangle.south) {
  186273. rectangle.south = tilingScheme2.rectangle.south;
  186274. }
  186275. if (rectangle.north > tilingScheme2.rectangle.north) {
  186276. rectangle.north = tilingScheme2.rectangle.north;
  186277. }
  186278. return rectangle;
  186279. }
  186280. function calculateSafeMinimumDetailLevel(tilingScheme2, rectangle, minimumLevel) {
  186281. const swTile = tilingScheme2.positionToTileXY(
  186282. Rectangle_default.southwest(rectangle),
  186283. minimumLevel
  186284. );
  186285. const neTile = tilingScheme2.positionToTileXY(
  186286. Rectangle_default.northeast(rectangle),
  186287. minimumLevel
  186288. );
  186289. const tileCount = (Math.abs(neTile.x - swTile.x) + 1) * (Math.abs(neTile.y - swTile.y) + 1);
  186290. if (tileCount > 4) {
  186291. return 0;
  186292. }
  186293. return minimumLevel;
  186294. }
  186295. TileMapServiceImageryProvider.prototype._metadataSuccess = function(xml2) {
  186296. const tileFormatRegex = /tileformat/i;
  186297. const tileSetRegex = /tileset/i;
  186298. const tileSetsRegex = /tilesets/i;
  186299. const bboxRegex = /boundingbox/i;
  186300. let format, bbox2, tilesets;
  186301. const tilesetsList = [];
  186302. const xmlResource = this._xmlResource;
  186303. let metadataError = this._metadataError;
  186304. const deferred = this._deferred;
  186305. const requestMetadata = this._requestMetadata;
  186306. const nodeList = xml2.childNodes[0].childNodes;
  186307. for (let i2 = 0; i2 < nodeList.length; i2++) {
  186308. if (tileFormatRegex.test(nodeList.item(i2).nodeName)) {
  186309. format = nodeList.item(i2);
  186310. } else if (tileSetsRegex.test(nodeList.item(i2).nodeName)) {
  186311. tilesets = nodeList.item(i2);
  186312. const tileSetNodes = nodeList.item(i2).childNodes;
  186313. for (let j = 0; j < tileSetNodes.length; j++) {
  186314. if (tileSetRegex.test(tileSetNodes.item(j).nodeName)) {
  186315. tilesetsList.push(tileSetNodes.item(j));
  186316. }
  186317. }
  186318. } else if (bboxRegex.test(nodeList.item(i2).nodeName)) {
  186319. bbox2 = nodeList.item(i2);
  186320. }
  186321. }
  186322. let message;
  186323. if (!defined_default(tilesets) || !defined_default(bbox2)) {
  186324. message = `Unable to find expected tilesets or bbox attributes in ${xmlResource.url}.`;
  186325. metadataError = TileProviderError_default.handleError(
  186326. metadataError,
  186327. this,
  186328. this.errorEvent,
  186329. message,
  186330. void 0,
  186331. void 0,
  186332. void 0,
  186333. requestMetadata
  186334. );
  186335. if (!metadataError.retry) {
  186336. deferred.reject(new RuntimeError_default(message));
  186337. }
  186338. this._metadataError = metadataError;
  186339. return;
  186340. }
  186341. const options = this._options;
  186342. const fileExtension = defaultValue_default(
  186343. options.fileExtension,
  186344. format.getAttribute("extension")
  186345. );
  186346. const tileWidth = defaultValue_default(
  186347. options.tileWidth,
  186348. parseInt(format.getAttribute("width"), 10)
  186349. );
  186350. const tileHeight = defaultValue_default(
  186351. options.tileHeight,
  186352. parseInt(format.getAttribute("height"), 10)
  186353. );
  186354. let minimumLevel = defaultValue_default(
  186355. options.minimumLevel,
  186356. parseInt(tilesetsList[0].getAttribute("order"), 10)
  186357. );
  186358. const maximumLevel = defaultValue_default(
  186359. options.maximumLevel,
  186360. parseInt(tilesetsList[tilesetsList.length - 1].getAttribute("order"), 10)
  186361. );
  186362. const tilingSchemeName = tilesets.getAttribute("profile");
  186363. let tilingScheme2 = options.tilingScheme;
  186364. if (!defined_default(tilingScheme2)) {
  186365. if (tilingSchemeName === "geodetic" || tilingSchemeName === "global-geodetic") {
  186366. tilingScheme2 = new GeographicTilingScheme_default({
  186367. ellipsoid: options.ellipsoid
  186368. });
  186369. } else if (tilingSchemeName === "mercator" || tilingSchemeName === "global-mercator") {
  186370. tilingScheme2 = new WebMercatorTilingScheme_default({
  186371. ellipsoid: options.ellipsoid
  186372. });
  186373. } else {
  186374. message = `${xmlResource.url}specifies an unsupported profile attribute, ${tilingSchemeName}.`;
  186375. metadataError = TileProviderError_default.handleError(
  186376. metadataError,
  186377. this,
  186378. this.errorEvent,
  186379. message,
  186380. void 0,
  186381. void 0,
  186382. void 0,
  186383. requestMetadata
  186384. );
  186385. if (!metadataError.retry) {
  186386. deferred.reject(new RuntimeError_default(message));
  186387. }
  186388. this._metadataError = metadataError;
  186389. return;
  186390. }
  186391. }
  186392. let rectangle = Rectangle_default.clone(options.rectangle);
  186393. if (!defined_default(rectangle)) {
  186394. let sw;
  186395. let ne;
  186396. let swXY;
  186397. let neXY;
  186398. const flipXY = defaultValue_default(options.flipXY, false);
  186399. if (flipXY) {
  186400. swXY = new Cartesian2_default(
  186401. parseFloat(bbox2.getAttribute("miny")),
  186402. parseFloat(bbox2.getAttribute("minx"))
  186403. );
  186404. neXY = new Cartesian2_default(
  186405. parseFloat(bbox2.getAttribute("maxy")),
  186406. parseFloat(bbox2.getAttribute("maxx"))
  186407. );
  186408. } else {
  186409. swXY = new Cartesian2_default(
  186410. parseFloat(bbox2.getAttribute("minx")),
  186411. parseFloat(bbox2.getAttribute("miny"))
  186412. );
  186413. neXY = new Cartesian2_default(
  186414. parseFloat(bbox2.getAttribute("maxx")),
  186415. parseFloat(bbox2.getAttribute("maxy"))
  186416. );
  186417. }
  186418. const isGdal2tiles = tilingSchemeName === "geodetic" || tilingSchemeName === "mercator";
  186419. if (tilingScheme2.projection instanceof GeographicProjection_default || isGdal2tiles) {
  186420. sw = Cartographic_default.fromDegrees(swXY.x, swXY.y);
  186421. ne = Cartographic_default.fromDegrees(neXY.x, neXY.y);
  186422. } else {
  186423. const projection = tilingScheme2.projection;
  186424. sw = projection.unproject(swXY);
  186425. ne = projection.unproject(neXY);
  186426. }
  186427. rectangle = new Rectangle_default(
  186428. sw.longitude,
  186429. sw.latitude,
  186430. ne.longitude,
  186431. ne.latitude
  186432. );
  186433. }
  186434. rectangle = confineRectangleToTilingScheme(rectangle, tilingScheme2);
  186435. minimumLevel = calculateSafeMinimumDetailLevel(
  186436. tilingScheme2,
  186437. rectangle,
  186438. minimumLevel
  186439. );
  186440. const templateResource = this._tmsResource.getDerivedResource({
  186441. url: `{z}/{x}/{reverseY}.${fileExtension}`
  186442. });
  186443. deferred.resolve({
  186444. url: templateResource,
  186445. tilingScheme: tilingScheme2,
  186446. rectangle,
  186447. tileWidth,
  186448. tileHeight,
  186449. minimumLevel,
  186450. maximumLevel,
  186451. tileDiscardPolicy: options.tileDiscardPolicy,
  186452. credit: options.credit
  186453. });
  186454. };
  186455. TileMapServiceImageryProvider.prototype._metadataFailure = function(error) {
  186456. const options = this._options;
  186457. const fileExtension = defaultValue_default(options.fileExtension, "png");
  186458. const tileWidth = defaultValue_default(options.tileWidth, 256);
  186459. const tileHeight = defaultValue_default(options.tileHeight, 256);
  186460. const maximumLevel = options.maximumLevel;
  186461. const tilingScheme2 = defined_default(options.tilingScheme) ? options.tilingScheme : new WebMercatorTilingScheme_default({ ellipsoid: options.ellipsoid });
  186462. let rectangle = defaultValue_default(options.rectangle, tilingScheme2.rectangle);
  186463. rectangle = confineRectangleToTilingScheme(rectangle, tilingScheme2);
  186464. const minimumLevel = calculateSafeMinimumDetailLevel(
  186465. tilingScheme2,
  186466. rectangle,
  186467. options.minimumLevel
  186468. );
  186469. const templateResource = this._tmsResource.getDerivedResource({
  186470. url: `{z}/{x}/{reverseY}.${fileExtension}`
  186471. });
  186472. this._deferred.resolve({
  186473. url: templateResource,
  186474. tilingScheme: tilingScheme2,
  186475. rectangle,
  186476. tileWidth,
  186477. tileHeight,
  186478. minimumLevel,
  186479. maximumLevel,
  186480. tileDiscardPolicy: options.tileDiscardPolicy,
  186481. credit: options.credit
  186482. });
  186483. };
  186484. var TileMapServiceImageryProvider_default = TileMapServiceImageryProvider;
  186485. // node_modules/cesium/Source/Scene/MapboxImageryProvider.js
  186486. var trailingSlashRegex = /\/$/;
  186487. var defaultCredit2 = new Credit_default(
  186488. '&copy; <a href="https://www.mapbox.com/about/maps/">Mapbox</a> &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/">Improve this map</a></strong>'
  186489. );
  186490. function MapboxImageryProvider(options) {
  186491. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  186492. const mapId = options.mapId;
  186493. if (!defined_default(mapId)) {
  186494. throw new DeveloperError_default("options.mapId is required.");
  186495. }
  186496. const accessToken = options.accessToken;
  186497. if (!defined_default(accessToken)) {
  186498. throw new DeveloperError_default("options.accessToken is required.");
  186499. }
  186500. this.defaultAlpha = void 0;
  186501. this.defaultNightAlpha = void 0;
  186502. this.defaultDayAlpha = void 0;
  186503. this.defaultBrightness = void 0;
  186504. this.defaultContrast = void 0;
  186505. this.defaultHue = void 0;
  186506. this.defaultSaturation = void 0;
  186507. this.defaultGamma = void 0;
  186508. this.defaultMinificationFilter = void 0;
  186509. this.defaultMagnificationFilter = void 0;
  186510. const resource = Resource_default.createIfNeeded(
  186511. defaultValue_default(options.url, "https://{s}.tiles.mapbox.com/v4/")
  186512. );
  186513. this._mapId = mapId;
  186514. this._accessToken = accessToken;
  186515. let format = defaultValue_default(options.format, "png");
  186516. if (!/\./.test(format)) {
  186517. format = `.${format}`;
  186518. }
  186519. this._format = format;
  186520. let templateUrl = resource.getUrlComponent();
  186521. if (!trailingSlashRegex.test(templateUrl)) {
  186522. templateUrl += "/";
  186523. }
  186524. templateUrl += `${mapId}/{z}/{x}/{y}${this._format}`;
  186525. resource.url = templateUrl;
  186526. resource.setQueryParameters({
  186527. access_token: accessToken
  186528. });
  186529. let credit;
  186530. if (defined_default(options.credit)) {
  186531. credit = options.credit;
  186532. if (typeof credit === "string") {
  186533. credit = new Credit_default(credit);
  186534. }
  186535. } else {
  186536. credit = defaultCredit2;
  186537. }
  186538. this._resource = resource;
  186539. this._imageryProvider = new UrlTemplateImageryProvider_default({
  186540. url: resource,
  186541. credit,
  186542. ellipsoid: options.ellipsoid,
  186543. minimumLevel: options.minimumLevel,
  186544. maximumLevel: options.maximumLevel,
  186545. rectangle: options.rectangle
  186546. });
  186547. }
  186548. Object.defineProperties(MapboxImageryProvider.prototype, {
  186549. url: {
  186550. get: function() {
  186551. return this._imageryProvider.url;
  186552. }
  186553. },
  186554. ready: {
  186555. get: function() {
  186556. return this._imageryProvider.ready;
  186557. }
  186558. },
  186559. readyPromise: {
  186560. get: function() {
  186561. return this._imageryProvider.readyPromise;
  186562. }
  186563. },
  186564. rectangle: {
  186565. get: function() {
  186566. return this._imageryProvider.rectangle;
  186567. }
  186568. },
  186569. tileWidth: {
  186570. get: function() {
  186571. return this._imageryProvider.tileWidth;
  186572. }
  186573. },
  186574. tileHeight: {
  186575. get: function() {
  186576. return this._imageryProvider.tileHeight;
  186577. }
  186578. },
  186579. maximumLevel: {
  186580. get: function() {
  186581. return this._imageryProvider.maximumLevel;
  186582. }
  186583. },
  186584. minimumLevel: {
  186585. get: function() {
  186586. return this._imageryProvider.minimumLevel;
  186587. }
  186588. },
  186589. tilingScheme: {
  186590. get: function() {
  186591. return this._imageryProvider.tilingScheme;
  186592. }
  186593. },
  186594. tileDiscardPolicy: {
  186595. get: function() {
  186596. return this._imageryProvider.tileDiscardPolicy;
  186597. }
  186598. },
  186599. errorEvent: {
  186600. get: function() {
  186601. return this._imageryProvider.errorEvent;
  186602. }
  186603. },
  186604. credit: {
  186605. get: function() {
  186606. return this._imageryProvider.credit;
  186607. }
  186608. },
  186609. proxy: {
  186610. get: function() {
  186611. return this._imageryProvider.proxy;
  186612. }
  186613. },
  186614. hasAlphaChannel: {
  186615. get: function() {
  186616. return this._imageryProvider.hasAlphaChannel;
  186617. }
  186618. }
  186619. });
  186620. MapboxImageryProvider.prototype.getTileCredits = function(x, y, level) {
  186621. return void 0;
  186622. };
  186623. MapboxImageryProvider.prototype.requestImage = function(x, y, level, request) {
  186624. return this._imageryProvider.requestImage(x, y, level, request);
  186625. };
  186626. MapboxImageryProvider.prototype.pickFeatures = function(x, y, level, longitude, latitude) {
  186627. return this._imageryProvider.pickFeatures(x, y, level, longitude, latitude);
  186628. };
  186629. MapboxImageryProvider._defaultCredit = defaultCredit2;
  186630. var MapboxImageryProvider_default = MapboxImageryProvider;
  186631. // node_modules/cesium/Source/Scene/SingleTileImageryProvider.js
  186632. function SingleTileImageryProvider(options) {
  186633. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  186634. if (!defined_default(options.url)) {
  186635. throw new DeveloperError_default("options.url is required.");
  186636. }
  186637. this.defaultAlpha = void 0;
  186638. this.defaultNightAlpha = void 0;
  186639. this.defaultDayAlpha = void 0;
  186640. this.defaultBrightness = void 0;
  186641. this.defaultContrast = void 0;
  186642. this.defaultHue = void 0;
  186643. this.defaultSaturation = void 0;
  186644. this.defaultGamma = void 0;
  186645. this.defaultMinificationFilter = void 0;
  186646. this.defaultMagnificationFilter = void 0;
  186647. const resource = Resource_default.createIfNeeded(options.url);
  186648. const rectangle = defaultValue_default(options.rectangle, Rectangle_default.MAX_VALUE);
  186649. const tilingScheme2 = new GeographicTilingScheme_default({
  186650. rectangle,
  186651. numberOfLevelZeroTilesX: 1,
  186652. numberOfLevelZeroTilesY: 1,
  186653. ellipsoid: options.ellipsoid
  186654. });
  186655. this._tilingScheme = tilingScheme2;
  186656. this._resource = resource;
  186657. this._image = void 0;
  186658. this._texture = void 0;
  186659. this._tileWidth = 0;
  186660. this._tileHeight = 0;
  186661. this._errorEvent = new Event_default();
  186662. this._ready = false;
  186663. this._readyPromise = defer_default();
  186664. let credit = options.credit;
  186665. if (typeof credit === "string") {
  186666. credit = new Credit_default(credit);
  186667. }
  186668. this._credit = credit;
  186669. const that = this;
  186670. let error;
  186671. function success(image) {
  186672. that._image = image;
  186673. that._tileWidth = image.width;
  186674. that._tileHeight = image.height;
  186675. that._ready = true;
  186676. that._readyPromise.resolve(true);
  186677. TileProviderError_default.handleSuccess(that._errorEvent);
  186678. }
  186679. function failure(e2) {
  186680. const message = `Failed to load image ${resource.url}.`;
  186681. error = TileProviderError_default.handleError(
  186682. error,
  186683. that,
  186684. that._errorEvent,
  186685. message,
  186686. 0,
  186687. 0,
  186688. 0,
  186689. doRequest,
  186690. e2
  186691. );
  186692. if (!error.retry) {
  186693. that._readyPromise.reject(new RuntimeError_default(message));
  186694. }
  186695. }
  186696. function doRequest() {
  186697. ImageryProvider_default.loadImage(null, resource).then(success).catch(failure);
  186698. }
  186699. doRequest();
  186700. }
  186701. Object.defineProperties(SingleTileImageryProvider.prototype, {
  186702. url: {
  186703. get: function() {
  186704. return this._resource.url;
  186705. }
  186706. },
  186707. proxy: {
  186708. get: function() {
  186709. return this._resource.proxy;
  186710. }
  186711. },
  186712. tileWidth: {
  186713. get: function() {
  186714. if (!this._ready) {
  186715. throw new DeveloperError_default(
  186716. "tileWidth must not be called before the imagery provider is ready."
  186717. );
  186718. }
  186719. return this._tileWidth;
  186720. }
  186721. },
  186722. tileHeight: {
  186723. get: function() {
  186724. if (!this._ready) {
  186725. throw new DeveloperError_default(
  186726. "tileHeight must not be called before the imagery provider is ready."
  186727. );
  186728. }
  186729. return this._tileHeight;
  186730. }
  186731. },
  186732. maximumLevel: {
  186733. get: function() {
  186734. if (!this._ready) {
  186735. throw new DeveloperError_default(
  186736. "maximumLevel must not be called before the imagery provider is ready."
  186737. );
  186738. }
  186739. return 0;
  186740. }
  186741. },
  186742. minimumLevel: {
  186743. get: function() {
  186744. if (!this._ready) {
  186745. throw new DeveloperError_default(
  186746. "minimumLevel must not be called before the imagery provider is ready."
  186747. );
  186748. }
  186749. return 0;
  186750. }
  186751. },
  186752. tilingScheme: {
  186753. get: function() {
  186754. if (!this._ready) {
  186755. throw new DeveloperError_default(
  186756. "tilingScheme must not be called before the imagery provider is ready."
  186757. );
  186758. }
  186759. return this._tilingScheme;
  186760. }
  186761. },
  186762. rectangle: {
  186763. get: function() {
  186764. return this._tilingScheme.rectangle;
  186765. }
  186766. },
  186767. tileDiscardPolicy: {
  186768. get: function() {
  186769. if (!this._ready) {
  186770. throw new DeveloperError_default(
  186771. "tileDiscardPolicy must not be called before the imagery provider is ready."
  186772. );
  186773. }
  186774. return void 0;
  186775. }
  186776. },
  186777. errorEvent: {
  186778. get: function() {
  186779. return this._errorEvent;
  186780. }
  186781. },
  186782. ready: {
  186783. get: function() {
  186784. return this._ready;
  186785. }
  186786. },
  186787. readyPromise: {
  186788. get: function() {
  186789. return this._readyPromise.promise;
  186790. }
  186791. },
  186792. credit: {
  186793. get: function() {
  186794. return this._credit;
  186795. }
  186796. },
  186797. hasAlphaChannel: {
  186798. get: function() {
  186799. return true;
  186800. }
  186801. }
  186802. });
  186803. SingleTileImageryProvider.prototype.getTileCredits = function(x, y, level) {
  186804. return void 0;
  186805. };
  186806. SingleTileImageryProvider.prototype.requestImage = function(x, y, level, request) {
  186807. if (!this._ready) {
  186808. throw new DeveloperError_default(
  186809. "requestImage must not be called before the imagery provider is ready."
  186810. );
  186811. }
  186812. if (!defined_default(this._image)) {
  186813. return;
  186814. }
  186815. return Promise.resolve(this._image);
  186816. };
  186817. SingleTileImageryProvider.prototype.pickFeatures = function(x, y, level, longitude, latitude) {
  186818. return void 0;
  186819. };
  186820. var SingleTileImageryProvider_default = SingleTileImageryProvider;
  186821. // node_modules/cesium/Source/Scene/TimeDynamicImagery.js
  186822. function TimeDynamicImagery(options) {
  186823. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  186824. Check_default.typeOf.object("options.clock", options.clock);
  186825. Check_default.typeOf.object("options.times", options.times);
  186826. Check_default.typeOf.func(
  186827. "options.requestImageFunction",
  186828. options.requestImageFunction
  186829. );
  186830. Check_default.typeOf.func("options.reloadFunction", options.reloadFunction);
  186831. this._tileCache = {};
  186832. this._tilesRequestedForInterval = [];
  186833. const clock = this._clock = options.clock;
  186834. this._times = options.times;
  186835. this._requestImageFunction = options.requestImageFunction;
  186836. this._reloadFunction = options.reloadFunction;
  186837. this._currentIntervalIndex = -1;
  186838. clock.onTick.addEventListener(this._clockOnTick, this);
  186839. this._clockOnTick(clock);
  186840. }
  186841. Object.defineProperties(TimeDynamicImagery.prototype, {
  186842. clock: {
  186843. get: function() {
  186844. return this._clock;
  186845. },
  186846. set: function(value) {
  186847. if (!defined_default(value)) {
  186848. throw new DeveloperError_default("value is required.");
  186849. }
  186850. if (this._clock !== value) {
  186851. this._clock = value;
  186852. this._clockOnTick(value);
  186853. this._reloadFunction();
  186854. }
  186855. }
  186856. },
  186857. times: {
  186858. get: function() {
  186859. return this._times;
  186860. },
  186861. set: function(value) {
  186862. if (!defined_default(value)) {
  186863. throw new DeveloperError_default("value is required.");
  186864. }
  186865. if (this._times !== value) {
  186866. this._times = value;
  186867. this._clockOnTick(this._clock);
  186868. this._reloadFunction();
  186869. }
  186870. }
  186871. },
  186872. currentInterval: {
  186873. get: function() {
  186874. return this._times.get(this._currentIntervalIndex);
  186875. }
  186876. }
  186877. });
  186878. TimeDynamicImagery.prototype.getFromCache = function(x, y, level, request) {
  186879. const key = getKey2(x, y, level);
  186880. let result;
  186881. const cache = this._tileCache[this._currentIntervalIndex];
  186882. if (defined_default(cache) && defined_default(cache[key])) {
  186883. const item = cache[key];
  186884. result = item.promise.catch(function(e2) {
  186885. request.state = item.request.state;
  186886. throw e2;
  186887. });
  186888. delete cache[key];
  186889. }
  186890. return result;
  186891. };
  186892. TimeDynamicImagery.prototype.checkApproachingInterval = function(x, y, level, request) {
  186893. const key = getKey2(x, y, level);
  186894. const tilesRequestedForInterval = this._tilesRequestedForInterval;
  186895. const approachingInterval = getApproachingInterval(this);
  186896. const tile = {
  186897. key,
  186898. priorityFunction: request.priorityFunction
  186899. };
  186900. if (!defined_default(approachingInterval) || !addToCache(this, tile, approachingInterval)) {
  186901. tilesRequestedForInterval.push(tile);
  186902. }
  186903. if (tilesRequestedForInterval.length >= 512) {
  186904. tilesRequestedForInterval.splice(0, 256);
  186905. }
  186906. };
  186907. TimeDynamicImagery.prototype._clockOnTick = function(clock) {
  186908. const time = clock.currentTime;
  186909. const times = this._times;
  186910. const index2 = times.indexOf(time);
  186911. const currentIntervalIndex = this._currentIntervalIndex;
  186912. if (index2 !== currentIntervalIndex) {
  186913. const currentCache = this._tileCache[currentIntervalIndex];
  186914. for (const t in currentCache) {
  186915. if (currentCache.hasOwnProperty(t)) {
  186916. currentCache[t].request.cancel();
  186917. }
  186918. }
  186919. delete this._tileCache[currentIntervalIndex];
  186920. this._tilesRequestedForInterval = [];
  186921. this._currentIntervalIndex = index2;
  186922. this._reloadFunction();
  186923. return;
  186924. }
  186925. const approachingInterval = getApproachingInterval(this);
  186926. if (defined_default(approachingInterval)) {
  186927. const tilesRequested = this._tilesRequestedForInterval;
  186928. let success = true;
  186929. while (success) {
  186930. if (tilesRequested.length === 0) {
  186931. break;
  186932. }
  186933. const tile = tilesRequested.pop();
  186934. success = addToCache(this, tile, approachingInterval);
  186935. if (!success) {
  186936. tilesRequested.push(tile);
  186937. }
  186938. }
  186939. }
  186940. };
  186941. function getKey2(x, y, level) {
  186942. return `${x}-${y}-${level}`;
  186943. }
  186944. function getKeyElements(key) {
  186945. const s2 = key.split("-");
  186946. if (s2.length !== 3) {
  186947. return void 0;
  186948. }
  186949. return {
  186950. x: Number(s2[0]),
  186951. y: Number(s2[1]),
  186952. level: Number(s2[2])
  186953. };
  186954. }
  186955. function getApproachingInterval(that) {
  186956. const times = that._times;
  186957. if (!defined_default(times)) {
  186958. return void 0;
  186959. }
  186960. const clock = that._clock;
  186961. const time = clock.currentTime;
  186962. const isAnimating = clock.canAnimate && clock.shouldAnimate;
  186963. const multiplier = clock.multiplier;
  186964. if (!isAnimating && multiplier !== 0) {
  186965. return void 0;
  186966. }
  186967. let seconds;
  186968. let index2 = times.indexOf(time);
  186969. if (index2 < 0) {
  186970. return void 0;
  186971. }
  186972. const interval = times.get(index2);
  186973. if (multiplier > 0) {
  186974. seconds = JulianDate_default.secondsDifference(interval.stop, time);
  186975. ++index2;
  186976. } else {
  186977. seconds = JulianDate_default.secondsDifference(interval.start, time);
  186978. --index2;
  186979. }
  186980. seconds /= multiplier;
  186981. return index2 >= 0 && seconds <= 5 ? times.get(index2) : void 0;
  186982. }
  186983. function addToCache(that, tile, interval) {
  186984. const index2 = that._times.indexOf(interval.start);
  186985. const tileCache = that._tileCache;
  186986. let intervalTileCache = tileCache[index2];
  186987. if (!defined_default(intervalTileCache)) {
  186988. intervalTileCache = tileCache[index2] = {};
  186989. }
  186990. const key = tile.key;
  186991. if (defined_default(intervalTileCache[key])) {
  186992. return true;
  186993. }
  186994. const keyElements = getKeyElements(key);
  186995. const request = new Request_default({
  186996. throttle: false,
  186997. throttleByServer: true,
  186998. type: RequestType_default.IMAGERY,
  186999. priorityFunction: tile.priorityFunction
  187000. });
  187001. const promise = that._requestImageFunction(
  187002. keyElements.x,
  187003. keyElements.y,
  187004. keyElements.level,
  187005. request,
  187006. interval
  187007. );
  187008. if (!defined_default(promise)) {
  187009. return false;
  187010. }
  187011. intervalTileCache[key] = {
  187012. promise,
  187013. request
  187014. };
  187015. return true;
  187016. }
  187017. var TimeDynamicImagery_default = TimeDynamicImagery;
  187018. // node_modules/cesium/Source/Scene/WebMapServiceImageryProvider.js
  187019. var includesReverseAxis = [
  187020. 3034,
  187021. 3035,
  187022. 3042,
  187023. 3043,
  187024. 3044
  187025. ];
  187026. var excludesReverseAxis = [
  187027. 4471,
  187028. 4559
  187029. ];
  187030. function WebMapServiceImageryProvider(options) {
  187031. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  187032. if (!defined_default(options.url)) {
  187033. throw new DeveloperError_default("options.url is required.");
  187034. }
  187035. if (!defined_default(options.layers)) {
  187036. throw new DeveloperError_default("options.layers is required.");
  187037. }
  187038. if (defined_default(options.times) && !defined_default(options.clock)) {
  187039. throw new DeveloperError_default(
  187040. "options.times was specified, so options.clock is required."
  187041. );
  187042. }
  187043. this.defaultAlpha = void 0;
  187044. this.defaultNightAlpha = void 0;
  187045. this.defaultDayAlpha = void 0;
  187046. this.defaultBrightness = void 0;
  187047. this.defaultContrast = void 0;
  187048. this.defaultHue = void 0;
  187049. this.defaultSaturation = void 0;
  187050. this.defaultGamma = void 0;
  187051. this.defaultMinificationFilter = void 0;
  187052. this.defaultMagnificationFilter = void 0;
  187053. this._getFeatureInfoUrl = defaultValue_default(
  187054. options.getFeatureInfoUrl,
  187055. options.url
  187056. );
  187057. const resource = Resource_default.createIfNeeded(options.url);
  187058. const pickFeatureResource = Resource_default.createIfNeeded(this._getFeatureInfoUrl);
  187059. resource.setQueryParameters(
  187060. WebMapServiceImageryProvider.DefaultParameters,
  187061. true
  187062. );
  187063. pickFeatureResource.setQueryParameters(
  187064. WebMapServiceImageryProvider.GetFeatureInfoDefaultParameters,
  187065. true
  187066. );
  187067. if (defined_default(options.parameters)) {
  187068. resource.setQueryParameters(objectToLowercase(options.parameters));
  187069. }
  187070. if (defined_default(options.getFeatureInfoParameters)) {
  187071. pickFeatureResource.setQueryParameters(
  187072. objectToLowercase(options.getFeatureInfoParameters)
  187073. );
  187074. }
  187075. const that = this;
  187076. this._reload = void 0;
  187077. if (defined_default(options.times)) {
  187078. this._timeDynamicImagery = new TimeDynamicImagery_default({
  187079. clock: options.clock,
  187080. times: options.times,
  187081. requestImageFunction: function(x, y, level, request, interval) {
  187082. return requestImage(that, x, y, level, request, interval);
  187083. },
  187084. reloadFunction: function() {
  187085. if (defined_default(that._reload)) {
  187086. that._reload();
  187087. }
  187088. }
  187089. });
  187090. }
  187091. const parameters = {};
  187092. parameters.layers = options.layers;
  187093. parameters.bbox = "{westProjected},{southProjected},{eastProjected},{northProjected}";
  187094. parameters.width = "{width}";
  187095. parameters.height = "{height}";
  187096. if (parseFloat(resource.queryParameters.version) >= 1.3) {
  187097. parameters.crs = defaultValue_default(
  187098. options.crs,
  187099. options.tilingScheme && options.tilingScheme.projection instanceof WebMercatorProjection_default ? "EPSG:3857" : "CRS:84"
  187100. );
  187101. const parts = parameters.crs.split(":");
  187102. if (parts[0] === "EPSG" && parts.length === 2) {
  187103. const code = Number(parts[1]);
  187104. if (code >= 4e3 && code < 5e3 && !excludesReverseAxis.includes(code) || includesReverseAxis.includes(code)) {
  187105. parameters.bbox = "{southProjected},{westProjected},{northProjected},{eastProjected}";
  187106. }
  187107. }
  187108. } else {
  187109. parameters.srs = defaultValue_default(
  187110. options.srs,
  187111. options.tilingScheme && options.tilingScheme.projection instanceof WebMercatorProjection_default ? "EPSG:3857" : "EPSG:4326"
  187112. );
  187113. }
  187114. resource.setQueryParameters(parameters, true);
  187115. pickFeatureResource.setQueryParameters(parameters, true);
  187116. const pickFeatureParams = {
  187117. query_layers: options.layers,
  187118. info_format: "{format}"
  187119. };
  187120. if (parseFloat(pickFeatureResource.queryParameters.version) >= 1.3) {
  187121. pickFeatureParams.i = "{i}";
  187122. pickFeatureParams.j = "{j}";
  187123. } else {
  187124. pickFeatureParams.x = "{i}";
  187125. pickFeatureParams.y = "{j}";
  187126. }
  187127. pickFeatureResource.setQueryParameters(pickFeatureParams, true);
  187128. this._resource = resource;
  187129. this._pickFeaturesResource = pickFeatureResource;
  187130. this._layers = options.layers;
  187131. this._tileProvider = new UrlTemplateImageryProvider_default({
  187132. url: resource,
  187133. pickFeaturesUrl: pickFeatureResource,
  187134. tilingScheme: defaultValue_default(
  187135. options.tilingScheme,
  187136. new GeographicTilingScheme_default({ ellipsoid: options.ellipsoid })
  187137. ),
  187138. rectangle: options.rectangle,
  187139. tileWidth: options.tileWidth,
  187140. tileHeight: options.tileHeight,
  187141. minimumLevel: options.minimumLevel,
  187142. maximumLevel: options.maximumLevel,
  187143. subdomains: options.subdomains,
  187144. tileDiscardPolicy: options.tileDiscardPolicy,
  187145. credit: options.credit,
  187146. getFeatureInfoFormats: defaultValue_default(
  187147. options.getFeatureInfoFormats,
  187148. WebMapServiceImageryProvider.DefaultGetFeatureInfoFormats
  187149. ),
  187150. enablePickFeatures: options.enablePickFeatures
  187151. });
  187152. }
  187153. function requestImage(imageryProvider, col, row, level, request, interval) {
  187154. const dynamicIntervalData = defined_default(interval) ? interval.data : void 0;
  187155. const tileProvider = imageryProvider._tileProvider;
  187156. if (defined_default(dynamicIntervalData)) {
  187157. tileProvider._resource.setQueryParameters(dynamicIntervalData);
  187158. }
  187159. return tileProvider.requestImage(col, row, level, request);
  187160. }
  187161. function pickFeatures(imageryProvider, x, y, level, longitude, latitude, interval) {
  187162. const dynamicIntervalData = defined_default(interval) ? interval.data : void 0;
  187163. const tileProvider = imageryProvider._tileProvider;
  187164. if (defined_default(dynamicIntervalData)) {
  187165. tileProvider._pickFeaturesResource.setQueryParameters(dynamicIntervalData);
  187166. }
  187167. return tileProvider.pickFeatures(x, y, level, longitude, latitude);
  187168. }
  187169. Object.defineProperties(WebMapServiceImageryProvider.prototype, {
  187170. url: {
  187171. get: function() {
  187172. return this._resource._url;
  187173. }
  187174. },
  187175. proxy: {
  187176. get: function() {
  187177. return this._resource.proxy;
  187178. }
  187179. },
  187180. layers: {
  187181. get: function() {
  187182. return this._layers;
  187183. }
  187184. },
  187185. tileWidth: {
  187186. get: function() {
  187187. return this._tileProvider.tileWidth;
  187188. }
  187189. },
  187190. tileHeight: {
  187191. get: function() {
  187192. return this._tileProvider.tileHeight;
  187193. }
  187194. },
  187195. maximumLevel: {
  187196. get: function() {
  187197. return this._tileProvider.maximumLevel;
  187198. }
  187199. },
  187200. minimumLevel: {
  187201. get: function() {
  187202. return this._tileProvider.minimumLevel;
  187203. }
  187204. },
  187205. tilingScheme: {
  187206. get: function() {
  187207. return this._tileProvider.tilingScheme;
  187208. }
  187209. },
  187210. rectangle: {
  187211. get: function() {
  187212. return this._tileProvider.rectangle;
  187213. }
  187214. },
  187215. tileDiscardPolicy: {
  187216. get: function() {
  187217. return this._tileProvider.tileDiscardPolicy;
  187218. }
  187219. },
  187220. errorEvent: {
  187221. get: function() {
  187222. return this._tileProvider.errorEvent;
  187223. }
  187224. },
  187225. ready: {
  187226. get: function() {
  187227. return this._tileProvider.ready;
  187228. }
  187229. },
  187230. readyPromise: {
  187231. get: function() {
  187232. return this._tileProvider.readyPromise;
  187233. }
  187234. },
  187235. credit: {
  187236. get: function() {
  187237. return this._tileProvider.credit;
  187238. }
  187239. },
  187240. hasAlphaChannel: {
  187241. get: function() {
  187242. return this._tileProvider.hasAlphaChannel;
  187243. }
  187244. },
  187245. enablePickFeatures: {
  187246. get: function() {
  187247. return this._tileProvider.enablePickFeatures;
  187248. },
  187249. set: function(enablePickFeatures) {
  187250. this._tileProvider.enablePickFeatures = enablePickFeatures;
  187251. }
  187252. },
  187253. clock: {
  187254. get: function() {
  187255. return this._timeDynamicImagery.clock;
  187256. },
  187257. set: function(value) {
  187258. this._timeDynamicImagery.clock = value;
  187259. }
  187260. },
  187261. times: {
  187262. get: function() {
  187263. return this._timeDynamicImagery.times;
  187264. },
  187265. set: function(value) {
  187266. this._timeDynamicImagery.times = value;
  187267. }
  187268. },
  187269. getFeatureInfoUrl: {
  187270. get: function() {
  187271. return this._getFeatureInfoUrl;
  187272. }
  187273. }
  187274. });
  187275. WebMapServiceImageryProvider.prototype.getTileCredits = function(x, y, level) {
  187276. return this._tileProvider.getTileCredits(x, y, level);
  187277. };
  187278. WebMapServiceImageryProvider.prototype.requestImage = function(x, y, level, request) {
  187279. let result;
  187280. const timeDynamicImagery = this._timeDynamicImagery;
  187281. let currentInterval;
  187282. if (defined_default(timeDynamicImagery)) {
  187283. currentInterval = timeDynamicImagery.currentInterval;
  187284. result = timeDynamicImagery.getFromCache(x, y, level, request);
  187285. }
  187286. if (!defined_default(result)) {
  187287. result = requestImage(this, x, y, level, request, currentInterval);
  187288. }
  187289. if (defined_default(result) && defined_default(timeDynamicImagery)) {
  187290. timeDynamicImagery.checkApproachingInterval(x, y, level, request);
  187291. }
  187292. return result;
  187293. };
  187294. WebMapServiceImageryProvider.prototype.pickFeatures = function(x, y, level, longitude, latitude) {
  187295. const timeDynamicImagery = this._timeDynamicImagery;
  187296. const currentInterval = defined_default(timeDynamicImagery) ? timeDynamicImagery.currentInterval : void 0;
  187297. return pickFeatures(this, x, y, level, longitude, latitude, currentInterval);
  187298. };
  187299. WebMapServiceImageryProvider.DefaultParameters = Object.freeze({
  187300. service: "WMS",
  187301. version: "1.1.1",
  187302. request: "GetMap",
  187303. styles: "",
  187304. format: "image/jpeg"
  187305. });
  187306. WebMapServiceImageryProvider.GetFeatureInfoDefaultParameters = Object.freeze({
  187307. service: "WMS",
  187308. version: "1.1.1",
  187309. request: "GetFeatureInfo"
  187310. });
  187311. WebMapServiceImageryProvider.DefaultGetFeatureInfoFormats = Object.freeze([
  187312. Object.freeze(new GetFeatureInfoFormat_default("json", "application/json")),
  187313. Object.freeze(new GetFeatureInfoFormat_default("xml", "text/xml")),
  187314. Object.freeze(new GetFeatureInfoFormat_default("text", "text/html"))
  187315. ]);
  187316. function objectToLowercase(obj) {
  187317. const result = {};
  187318. for (const key in obj) {
  187319. if (obj.hasOwnProperty(key)) {
  187320. result[key.toLowerCase()] = obj[key];
  187321. }
  187322. }
  187323. return result;
  187324. }
  187325. var WebMapServiceImageryProvider_default = WebMapServiceImageryProvider;
  187326. // node_modules/cesium/Source/Scene/WebMapTileServiceImageryProvider.js
  187327. var defaultParameters = Object.freeze({
  187328. service: "WMTS",
  187329. version: "1.0.0",
  187330. request: "GetTile"
  187331. });
  187332. function WebMapTileServiceImageryProvider(options) {
  187333. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  187334. if (!defined_default(options.url)) {
  187335. throw new DeveloperError_default("options.url is required.");
  187336. }
  187337. if (!defined_default(options.layer)) {
  187338. throw new DeveloperError_default("options.layer is required.");
  187339. }
  187340. if (!defined_default(options.style)) {
  187341. throw new DeveloperError_default("options.style is required.");
  187342. }
  187343. if (!defined_default(options.tileMatrixSetID)) {
  187344. throw new DeveloperError_default("options.tileMatrixSetID is required.");
  187345. }
  187346. if (defined_default(options.times) && !defined_default(options.clock)) {
  187347. throw new DeveloperError_default(
  187348. "options.times was specified, so options.clock is required."
  187349. );
  187350. }
  187351. this.defaultAlpha = void 0;
  187352. this.defaultNightAlpha = void 0;
  187353. this.defaultDayAlpha = void 0;
  187354. this.defaultBrightness = void 0;
  187355. this.defaultContrast = void 0;
  187356. this.defaultHue = void 0;
  187357. this.defaultSaturation = void 0;
  187358. this.defaultGamma = void 0;
  187359. this.defaultMinificationFilter = void 0;
  187360. this.defaultMagnificationFilter = void 0;
  187361. const resource = Resource_default.createIfNeeded(options.url);
  187362. const style = options.style;
  187363. const tileMatrixSetID = options.tileMatrixSetID;
  187364. const url2 = resource.url;
  187365. const bracketMatch = url2.match(/{/g);
  187366. if (!defined_default(bracketMatch) || bracketMatch.length === 1 && /{s}/.test(url2)) {
  187367. resource.setQueryParameters(defaultParameters);
  187368. this._useKvp = true;
  187369. } else {
  187370. const templateValues = {
  187371. style,
  187372. Style: style,
  187373. TileMatrixSet: tileMatrixSetID
  187374. };
  187375. resource.setTemplateValues(templateValues);
  187376. this._useKvp = false;
  187377. }
  187378. this._resource = resource;
  187379. this._layer = options.layer;
  187380. this._style = style;
  187381. this._tileMatrixSetID = tileMatrixSetID;
  187382. this._tileMatrixLabels = options.tileMatrixLabels;
  187383. this._format = defaultValue_default(options.format, "image/jpeg");
  187384. this._tileDiscardPolicy = options.tileDiscardPolicy;
  187385. this._tilingScheme = defined_default(options.tilingScheme) ? options.tilingScheme : new WebMercatorTilingScheme_default({ ellipsoid: options.ellipsoid });
  187386. this._tileWidth = defaultValue_default(options.tileWidth, 256);
  187387. this._tileHeight = defaultValue_default(options.tileHeight, 256);
  187388. this._minimumLevel = defaultValue_default(options.minimumLevel, 0);
  187389. this._maximumLevel = options.maximumLevel;
  187390. this._rectangle = defaultValue_default(
  187391. options.rectangle,
  187392. this._tilingScheme.rectangle
  187393. );
  187394. this._dimensions = options.dimensions;
  187395. const that = this;
  187396. this._reload = void 0;
  187397. if (defined_default(options.times)) {
  187398. this._timeDynamicImagery = new TimeDynamicImagery_default({
  187399. clock: options.clock,
  187400. times: options.times,
  187401. requestImageFunction: function(x, y, level, request, interval) {
  187402. return requestImage2(that, x, y, level, request, interval);
  187403. },
  187404. reloadFunction: function() {
  187405. if (defined_default(that._reload)) {
  187406. that._reload();
  187407. }
  187408. }
  187409. });
  187410. }
  187411. this._readyPromise = Promise.resolve(true);
  187412. const swTile = this._tilingScheme.positionToTileXY(
  187413. Rectangle_default.southwest(this._rectangle),
  187414. this._minimumLevel
  187415. );
  187416. const neTile = this._tilingScheme.positionToTileXY(
  187417. Rectangle_default.northeast(this._rectangle),
  187418. this._minimumLevel
  187419. );
  187420. const tileCount = (Math.abs(neTile.x - swTile.x) + 1) * (Math.abs(neTile.y - swTile.y) + 1);
  187421. if (tileCount > 4) {
  187422. throw new DeveloperError_default(
  187423. `The imagery provider's rectangle and minimumLevel indicate that there are ${tileCount} tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.`
  187424. );
  187425. }
  187426. this._errorEvent = new Event_default();
  187427. const credit = options.credit;
  187428. this._credit = typeof credit === "string" ? new Credit_default(credit) : credit;
  187429. this._subdomains = options.subdomains;
  187430. if (Array.isArray(this._subdomains)) {
  187431. this._subdomains = this._subdomains.slice();
  187432. } else if (defined_default(this._subdomains) && this._subdomains.length > 0) {
  187433. this._subdomains = this._subdomains.split("");
  187434. } else {
  187435. this._subdomains = ["a", "b", "c"];
  187436. }
  187437. }
  187438. function requestImage2(imageryProvider, col, row, level, request, interval) {
  187439. const labels = imageryProvider._tileMatrixLabels;
  187440. const tileMatrix = defined_default(labels) ? labels[level] : level.toString();
  187441. const subdomains = imageryProvider._subdomains;
  187442. const staticDimensions = imageryProvider._dimensions;
  187443. const dynamicIntervalData = defined_default(interval) ? interval.data : void 0;
  187444. let resource;
  187445. let templateValues;
  187446. if (!imageryProvider._useKvp) {
  187447. templateValues = {
  187448. TileMatrix: tileMatrix,
  187449. TileRow: row.toString(),
  187450. TileCol: col.toString(),
  187451. s: subdomains[(col + row + level) % subdomains.length]
  187452. };
  187453. resource = imageryProvider._resource.getDerivedResource({
  187454. request
  187455. });
  187456. resource.setTemplateValues(templateValues);
  187457. if (defined_default(staticDimensions)) {
  187458. resource.setTemplateValues(staticDimensions);
  187459. }
  187460. if (defined_default(dynamicIntervalData)) {
  187461. resource.setTemplateValues(dynamicIntervalData);
  187462. }
  187463. } else {
  187464. let query = {};
  187465. query.tilematrix = tileMatrix;
  187466. query.layer = imageryProvider._layer;
  187467. query.style = imageryProvider._style;
  187468. query.tilerow = row;
  187469. query.tilecol = col;
  187470. query.tilematrixset = imageryProvider._tileMatrixSetID;
  187471. query.format = imageryProvider._format;
  187472. if (defined_default(staticDimensions)) {
  187473. query = combine_default(query, staticDimensions);
  187474. }
  187475. if (defined_default(dynamicIntervalData)) {
  187476. query = combine_default(query, dynamicIntervalData);
  187477. }
  187478. templateValues = {
  187479. s: subdomains[(col + row + level) % subdomains.length]
  187480. };
  187481. resource = imageryProvider._resource.getDerivedResource({
  187482. queryParameters: query,
  187483. request
  187484. });
  187485. resource.setTemplateValues(templateValues);
  187486. }
  187487. return ImageryProvider_default.loadImage(imageryProvider, resource);
  187488. }
  187489. Object.defineProperties(WebMapTileServiceImageryProvider.prototype, {
  187490. url: {
  187491. get: function() {
  187492. return this._resource.url;
  187493. }
  187494. },
  187495. proxy: {
  187496. get: function() {
  187497. return this._resource.proxy;
  187498. }
  187499. },
  187500. tileWidth: {
  187501. get: function() {
  187502. return this._tileWidth;
  187503. }
  187504. },
  187505. tileHeight: {
  187506. get: function() {
  187507. return this._tileHeight;
  187508. }
  187509. },
  187510. maximumLevel: {
  187511. get: function() {
  187512. return this._maximumLevel;
  187513. }
  187514. },
  187515. minimumLevel: {
  187516. get: function() {
  187517. return this._minimumLevel;
  187518. }
  187519. },
  187520. tilingScheme: {
  187521. get: function() {
  187522. return this._tilingScheme;
  187523. }
  187524. },
  187525. rectangle: {
  187526. get: function() {
  187527. return this._rectangle;
  187528. }
  187529. },
  187530. tileDiscardPolicy: {
  187531. get: function() {
  187532. return this._tileDiscardPolicy;
  187533. }
  187534. },
  187535. errorEvent: {
  187536. get: function() {
  187537. return this._errorEvent;
  187538. }
  187539. },
  187540. format: {
  187541. get: function() {
  187542. return this._format;
  187543. }
  187544. },
  187545. ready: {
  187546. value: true
  187547. },
  187548. readyPromise: {
  187549. get: function() {
  187550. return this._readyPromise;
  187551. }
  187552. },
  187553. credit: {
  187554. get: function() {
  187555. return this._credit;
  187556. }
  187557. },
  187558. hasAlphaChannel: {
  187559. get: function() {
  187560. return true;
  187561. }
  187562. },
  187563. clock: {
  187564. get: function() {
  187565. return this._timeDynamicImagery.clock;
  187566. },
  187567. set: function(value) {
  187568. this._timeDynamicImagery.clock = value;
  187569. }
  187570. },
  187571. times: {
  187572. get: function() {
  187573. return this._timeDynamicImagery.times;
  187574. },
  187575. set: function(value) {
  187576. this._timeDynamicImagery.times = value;
  187577. }
  187578. },
  187579. dimensions: {
  187580. get: function() {
  187581. return this._dimensions;
  187582. },
  187583. set: function(value) {
  187584. if (this._dimensions !== value) {
  187585. this._dimensions = value;
  187586. if (defined_default(this._reload)) {
  187587. this._reload();
  187588. }
  187589. }
  187590. }
  187591. }
  187592. });
  187593. WebMapTileServiceImageryProvider.prototype.getTileCredits = function(x, y, level) {
  187594. return void 0;
  187595. };
  187596. WebMapTileServiceImageryProvider.prototype.requestImage = function(x, y, level, request) {
  187597. let result;
  187598. const timeDynamicImagery = this._timeDynamicImagery;
  187599. let currentInterval;
  187600. if (defined_default(timeDynamicImagery)) {
  187601. currentInterval = timeDynamicImagery.currentInterval;
  187602. result = timeDynamicImagery.getFromCache(x, y, level, request);
  187603. }
  187604. if (!defined_default(result)) {
  187605. result = requestImage2(this, x, y, level, request, currentInterval);
  187606. }
  187607. if (defined_default(result) && defined_default(timeDynamicImagery)) {
  187608. timeDynamicImagery.checkApproachingInterval(x, y, level, request);
  187609. }
  187610. return result;
  187611. };
  187612. WebMapTileServiceImageryProvider.prototype.pickFeatures = function(x, y, level, longitude, latitude) {
  187613. return void 0;
  187614. };
  187615. var WebMapTileServiceImageryProvider_default = WebMapTileServiceImageryProvider;
  187616. // node_modules/cesium/Source/Scene/IonImageryProvider.js
  187617. function createFactory(Type) {
  187618. return function(options) {
  187619. return new Type(options);
  187620. };
  187621. }
  187622. var ImageryProviderMapping = {
  187623. ARCGIS_MAPSERVER: createFactory(ArcGisMapServerImageryProvider_default),
  187624. BING: createFactory(BingMapsImageryProvider_default),
  187625. GOOGLE_EARTH: createFactory(GoogleEarthEnterpriseMapsProvider_default),
  187626. MAPBOX: createFactory(MapboxImageryProvider_default),
  187627. SINGLE_TILE: createFactory(SingleTileImageryProvider_default),
  187628. TMS: createFactory(TileMapServiceImageryProvider_default),
  187629. URL_TEMPLATE: createFactory(UrlTemplateImageryProvider_default),
  187630. WMS: createFactory(WebMapServiceImageryProvider_default),
  187631. WMTS: createFactory(WebMapTileServiceImageryProvider_default)
  187632. };
  187633. function IonImageryProvider(options) {
  187634. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  187635. const assetId = options.assetId;
  187636. Check_default.typeOf.number("options.assetId", assetId);
  187637. this.defaultAlpha = void 0;
  187638. this.defaultNightAlpha = void 0;
  187639. this.defaultDayAlpha = void 0;
  187640. this.defaultBrightness = void 0;
  187641. this.defaultContrast = void 0;
  187642. this.defaultHue = void 0;
  187643. this.defaultSaturation = void 0;
  187644. this.defaultGamma = void 0;
  187645. this.defaultMinificationFilter = void 0;
  187646. this.defaultMagnificationFilter = void 0;
  187647. this._ready = false;
  187648. this._tileCredits = void 0;
  187649. this._errorEvent = new Event_default();
  187650. const that = this;
  187651. const endpointResource = IonResource_default._createEndpointResource(
  187652. assetId,
  187653. options
  187654. );
  187655. const cacheKey = options.assetId.toString() + options.accessToken + options.server;
  187656. let promise = IonImageryProvider._endpointCache[cacheKey];
  187657. if (!defined_default(promise)) {
  187658. promise = endpointResource.fetchJson();
  187659. IonImageryProvider._endpointCache[cacheKey] = promise;
  187660. }
  187661. this._readyPromise = promise.then(function(endpoint) {
  187662. if (endpoint.type !== "IMAGERY") {
  187663. return Promise.reject(
  187664. new RuntimeError_default(`Cesium ion asset ${assetId} is not an imagery asset.`)
  187665. );
  187666. }
  187667. let imageryProvider;
  187668. const externalType = endpoint.externalType;
  187669. if (!defined_default(externalType)) {
  187670. imageryProvider = new TileMapServiceImageryProvider_default({
  187671. url: new IonResource_default(endpoint, endpointResource)
  187672. });
  187673. } else {
  187674. const factory = ImageryProviderMapping[externalType];
  187675. if (!defined_default(factory)) {
  187676. return Promise.reject(
  187677. new RuntimeError_default(
  187678. `Unrecognized Cesium ion imagery type: ${externalType}`
  187679. )
  187680. );
  187681. }
  187682. imageryProvider = factory(endpoint.options);
  187683. }
  187684. that._tileCredits = IonResource_default.getCreditsFromEndpoint(
  187685. endpoint,
  187686. endpointResource
  187687. );
  187688. imageryProvider.errorEvent.addEventListener(function(tileProviderError) {
  187689. tileProviderError.provider = that;
  187690. that._errorEvent.raiseEvent(tileProviderError);
  187691. });
  187692. that._imageryProvider = imageryProvider;
  187693. return imageryProvider.readyPromise.then(function() {
  187694. that._ready = true;
  187695. return true;
  187696. });
  187697. });
  187698. }
  187699. Object.defineProperties(IonImageryProvider.prototype, {
  187700. ready: {
  187701. get: function() {
  187702. return this._ready;
  187703. }
  187704. },
  187705. readyPromise: {
  187706. get: function() {
  187707. return this._readyPromise;
  187708. }
  187709. },
  187710. rectangle: {
  187711. get: function() {
  187712. if (!this._ready) {
  187713. throw new DeveloperError_default(
  187714. "tileHeight must not be called before the imagery provider is ready."
  187715. );
  187716. }
  187717. return this._imageryProvider.rectangle;
  187718. }
  187719. },
  187720. tileWidth: {
  187721. get: function() {
  187722. if (!this._ready) {
  187723. throw new DeveloperError_default(
  187724. "tileWidth must not be called before the imagery provider is ready."
  187725. );
  187726. }
  187727. return this._imageryProvider.tileWidth;
  187728. }
  187729. },
  187730. tileHeight: {
  187731. get: function() {
  187732. if (!this._ready) {
  187733. throw new DeveloperError_default(
  187734. "tileHeight must not be called before the imagery provider is ready."
  187735. );
  187736. }
  187737. return this._imageryProvider.tileHeight;
  187738. }
  187739. },
  187740. maximumLevel: {
  187741. get: function() {
  187742. if (!this._ready) {
  187743. throw new DeveloperError_default(
  187744. "maximumLevel must not be called before the imagery provider is ready."
  187745. );
  187746. }
  187747. return this._imageryProvider.maximumLevel;
  187748. }
  187749. },
  187750. minimumLevel: {
  187751. get: function() {
  187752. if (!this._ready) {
  187753. throw new DeveloperError_default(
  187754. "minimumLevel must not be called before the imagery provider is ready."
  187755. );
  187756. }
  187757. return this._imageryProvider.minimumLevel;
  187758. }
  187759. },
  187760. tilingScheme: {
  187761. get: function() {
  187762. if (!this._ready) {
  187763. throw new DeveloperError_default(
  187764. "tilingScheme must not be called before the imagery provider is ready."
  187765. );
  187766. }
  187767. return this._imageryProvider.tilingScheme;
  187768. }
  187769. },
  187770. tileDiscardPolicy: {
  187771. get: function() {
  187772. if (!this._ready) {
  187773. throw new DeveloperError_default(
  187774. "tileDiscardPolicy must not be called before the imagery provider is ready."
  187775. );
  187776. }
  187777. return this._imageryProvider.tileDiscardPolicy;
  187778. }
  187779. },
  187780. errorEvent: {
  187781. get: function() {
  187782. return this._errorEvent;
  187783. }
  187784. },
  187785. credit: {
  187786. get: function() {
  187787. if (!this._ready) {
  187788. throw new DeveloperError_default(
  187789. "credit must not be called before the imagery provider is ready."
  187790. );
  187791. }
  187792. return this._imageryProvider.credit;
  187793. }
  187794. },
  187795. hasAlphaChannel: {
  187796. get: function() {
  187797. if (!this._ready) {
  187798. throw new DeveloperError_default(
  187799. "hasAlphaChannel must not be called before the imagery provider is ready."
  187800. );
  187801. }
  187802. return this._imageryProvider.hasAlphaChannel;
  187803. },
  187804. proxy: {
  187805. get: function() {
  187806. return void 0;
  187807. }
  187808. }
  187809. }
  187810. });
  187811. IonImageryProvider.prototype.getTileCredits = function(x, y, level) {
  187812. if (!this._ready) {
  187813. throw new DeveloperError_default(
  187814. "getTileCredits must not be called before the imagery provider is ready."
  187815. );
  187816. }
  187817. const innerCredits = this._imageryProvider.getTileCredits(x, y, level);
  187818. if (!defined_default(innerCredits)) {
  187819. return this._tileCredits;
  187820. }
  187821. return this._tileCredits.concat(innerCredits);
  187822. };
  187823. IonImageryProvider.prototype.requestImage = function(x, y, level, request) {
  187824. if (!this._ready) {
  187825. throw new DeveloperError_default(
  187826. "requestImage must not be called before the imagery provider is ready."
  187827. );
  187828. }
  187829. return this._imageryProvider.requestImage(x, y, level, request);
  187830. };
  187831. IonImageryProvider.prototype.pickFeatures = function(x, y, level, longitude, latitude) {
  187832. if (!this._ready) {
  187833. throw new DeveloperError_default(
  187834. "pickFeatures must not be called before the imagery provider is ready."
  187835. );
  187836. }
  187837. return this._imageryProvider.pickFeatures(x, y, level, longitude, latitude);
  187838. };
  187839. IonImageryProvider._endpointCache = {};
  187840. var IonImageryProvider_default = IonImageryProvider;
  187841. // node_modules/cesium/Source/Scene/IonWorldImageryStyle.js
  187842. var IonWorldImageryStyle = {
  187843. AERIAL: 2,
  187844. AERIAL_WITH_LABELS: 3,
  187845. ROAD: 4
  187846. };
  187847. var IonWorldImageryStyle_default = Object.freeze(IonWorldImageryStyle);
  187848. // node_modules/cesium/Source/Scene/JobScheduler.js
  187849. function JobTypeBudget(total) {
  187850. this._total = total;
  187851. this.usedThisFrame = 0;
  187852. this.stolenFromMeThisFrame = 0;
  187853. this.starvedThisFrame = false;
  187854. this.starvedLastFrame = false;
  187855. }
  187856. Object.defineProperties(JobTypeBudget.prototype, {
  187857. total: {
  187858. get: function() {
  187859. return this._total;
  187860. }
  187861. }
  187862. });
  187863. function JobScheduler(budgets) {
  187864. if (defined_default(budgets) && budgets.length !== JobType_default.NUMBER_OF_JOB_TYPES) {
  187865. throw new DeveloperError_default(
  187866. "A budget must be specified for each job type; budgets.length should equal JobType.NUMBER_OF_JOB_TYPES."
  187867. );
  187868. }
  187869. const jobBudgets = new Array(JobType_default.NUMBER_OF_JOB_TYPES);
  187870. jobBudgets[JobType_default.TEXTURE] = new JobTypeBudget(
  187871. defined_default(budgets) ? budgets[JobType_default.TEXTURE] : 10
  187872. );
  187873. jobBudgets[JobType_default.PROGRAM] = new JobTypeBudget(
  187874. defined_default(budgets) ? budgets[JobType_default.PROGRAM] : 10
  187875. );
  187876. jobBudgets[JobType_default.BUFFER] = new JobTypeBudget(
  187877. defined_default(budgets) ? budgets[JobType_default.BUFFER] : 30
  187878. );
  187879. const length3 = jobBudgets.length;
  187880. let i2;
  187881. let totalBudget = 0;
  187882. for (i2 = 0; i2 < length3; ++i2) {
  187883. totalBudget += jobBudgets[i2].total;
  187884. }
  187885. const executedThisFrame = new Array(length3);
  187886. for (i2 = 0; i2 < length3; ++i2) {
  187887. executedThisFrame[i2] = false;
  187888. }
  187889. this._totalBudget = totalBudget;
  187890. this._totalUsedThisFrame = 0;
  187891. this._budgets = jobBudgets;
  187892. this._executedThisFrame = executedThisFrame;
  187893. }
  187894. JobScheduler.getTimestamp = getTimestamp_default;
  187895. Object.defineProperties(JobScheduler.prototype, {
  187896. totalBudget: {
  187897. get: function() {
  187898. return this._totalBudget;
  187899. }
  187900. }
  187901. });
  187902. JobScheduler.prototype.disableThisFrame = function() {
  187903. this._totalUsedThisFrame = this._totalBudget;
  187904. };
  187905. JobScheduler.prototype.resetBudgets = function() {
  187906. const budgets = this._budgets;
  187907. const length3 = budgets.length;
  187908. for (let i2 = 0; i2 < length3; ++i2) {
  187909. const budget = budgets[i2];
  187910. budget.starvedLastFrame = budget.starvedThisFrame;
  187911. budget.starvedThisFrame = false;
  187912. budget.usedThisFrame = 0;
  187913. budget.stolenFromMeThisFrame = 0;
  187914. }
  187915. this._totalUsedThisFrame = 0;
  187916. };
  187917. JobScheduler.prototype.execute = function(job, jobType) {
  187918. const budgets = this._budgets;
  187919. const budget = budgets[jobType];
  187920. const progressThisFrame = this._executedThisFrame[jobType];
  187921. if (this._totalUsedThisFrame >= this._totalBudget && progressThisFrame) {
  187922. budget.starvedThisFrame = true;
  187923. return false;
  187924. }
  187925. let stolenBudget;
  187926. if (budget.usedThisFrame + budget.stolenFromMeThisFrame >= budget.total) {
  187927. const length3 = budgets.length;
  187928. let i2;
  187929. for (i2 = 0; i2 < length3; ++i2) {
  187930. stolenBudget = budgets[i2];
  187931. if (stolenBudget.usedThisFrame + stolenBudget.stolenFromMeThisFrame < stolenBudget.total && !stolenBudget.starvedLastFrame) {
  187932. break;
  187933. }
  187934. }
  187935. if (i2 === length3 && progressThisFrame) {
  187936. return false;
  187937. }
  187938. if (progressThisFrame) {
  187939. budget.starvedThisFrame = true;
  187940. }
  187941. }
  187942. const startTime = JobScheduler.getTimestamp();
  187943. job.execute();
  187944. const duration = JobScheduler.getTimestamp() - startTime;
  187945. this._totalUsedThisFrame += duration;
  187946. if (stolenBudget) {
  187947. stolenBudget.stolenFromMeThisFrame += duration;
  187948. } else {
  187949. budget.usedThisFrame += duration;
  187950. }
  187951. this._executedThisFrame[jobType] = true;
  187952. return true;
  187953. };
  187954. var JobScheduler_default = JobScheduler;
  187955. // node_modules/cesium/Source/Scene/Light.js
  187956. function Light() {
  187957. }
  187958. Object.defineProperties(Light.prototype, {
  187959. color: {
  187960. get: DeveloperError_default.throwInstantiationError
  187961. },
  187962. intensity: {
  187963. get: DeveloperError_default.throwInstantiationError
  187964. }
  187965. });
  187966. var Light_default = Light;
  187967. // node_modules/cesium/Source/Scene/MapboxStyleImageryProvider.js
  187968. var trailingSlashRegex2 = /\/$/;
  187969. var defaultCredit3 = new Credit_default(
  187970. '&copy; <a href="https://www.mapbox.com/about/maps/">Mapbox</a> &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/">Improve this map</a></strong>'
  187971. );
  187972. function MapboxStyleImageryProvider(options) {
  187973. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  187974. const styleId = options.styleId;
  187975. if (!defined_default(styleId)) {
  187976. throw new DeveloperError_default("options.styleId is required.");
  187977. }
  187978. const accessToken = options.accessToken;
  187979. if (!defined_default(accessToken)) {
  187980. throw new DeveloperError_default("options.accessToken is required.");
  187981. }
  187982. this.defaultAlpha = void 0;
  187983. this.defaultNightAlpha = void 0;
  187984. this.defaultDayAlpha = void 0;
  187985. this.defaultBrightness = void 0;
  187986. this.defaultContrast = void 0;
  187987. this.defaultHue = void 0;
  187988. this.defaultSaturation = void 0;
  187989. this.defaultGamma = void 0;
  187990. this.defaultMinificationFilter = void 0;
  187991. this.defaultMagnificationFilter = void 0;
  187992. const resource = Resource_default.createIfNeeded(
  187993. defaultValue_default(options.url, "https://api.mapbox.com/styles/v1/")
  187994. );
  187995. this._styleId = styleId;
  187996. this._accessToken = accessToken;
  187997. const tilesize = defaultValue_default(options.tilesize, 512);
  187998. this._tilesize = tilesize;
  187999. const username = defaultValue_default(options.username, "mapbox");
  188000. this._username = username;
  188001. const scaleFactor = defined_default(options.scaleFactor) ? "@2x" : "";
  188002. let templateUrl = resource.getUrlComponent();
  188003. if (!trailingSlashRegex2.test(templateUrl)) {
  188004. templateUrl += "/";
  188005. }
  188006. templateUrl += `${this._username}/${styleId}/tiles/${this._tilesize}/{z}/{x}/{y}${scaleFactor}`;
  188007. resource.url = templateUrl;
  188008. resource.setQueryParameters({
  188009. access_token: accessToken
  188010. });
  188011. let credit;
  188012. if (defined_default(options.credit)) {
  188013. credit = options.credit;
  188014. if (typeof credit === "string") {
  188015. credit = new Credit_default(credit);
  188016. }
  188017. } else {
  188018. credit = defaultCredit3;
  188019. }
  188020. this._resource = resource;
  188021. this._imageryProvider = new UrlTemplateImageryProvider_default({
  188022. url: resource,
  188023. credit,
  188024. ellipsoid: options.ellipsoid,
  188025. minimumLevel: options.minimumLevel,
  188026. maximumLevel: options.maximumLevel,
  188027. rectangle: options.rectangle
  188028. });
  188029. }
  188030. Object.defineProperties(MapboxStyleImageryProvider.prototype, {
  188031. url: {
  188032. get: function() {
  188033. return this._imageryProvider.url;
  188034. }
  188035. },
  188036. ready: {
  188037. get: function() {
  188038. return this._imageryProvider.ready;
  188039. }
  188040. },
  188041. readyPromise: {
  188042. get: function() {
  188043. return this._imageryProvider.readyPromise;
  188044. }
  188045. },
  188046. rectangle: {
  188047. get: function() {
  188048. return this._imageryProvider.rectangle;
  188049. }
  188050. },
  188051. tileWidth: {
  188052. get: function() {
  188053. return this._imageryProvider.tileWidth;
  188054. }
  188055. },
  188056. tileHeight: {
  188057. get: function() {
  188058. return this._imageryProvider.tileHeight;
  188059. }
  188060. },
  188061. maximumLevel: {
  188062. get: function() {
  188063. return this._imageryProvider.maximumLevel;
  188064. }
  188065. },
  188066. minimumLevel: {
  188067. get: function() {
  188068. return this._imageryProvider.minimumLevel;
  188069. }
  188070. },
  188071. tilingScheme: {
  188072. get: function() {
  188073. return this._imageryProvider.tilingScheme;
  188074. }
  188075. },
  188076. tileDiscardPolicy: {
  188077. get: function() {
  188078. return this._imageryProvider.tileDiscardPolicy;
  188079. }
  188080. },
  188081. errorEvent: {
  188082. get: function() {
  188083. return this._imageryProvider.errorEvent;
  188084. }
  188085. },
  188086. credit: {
  188087. get: function() {
  188088. return this._imageryProvider.credit;
  188089. }
  188090. },
  188091. proxy: {
  188092. get: function() {
  188093. return this._imageryProvider.proxy;
  188094. }
  188095. },
  188096. hasAlphaChannel: {
  188097. get: function() {
  188098. return this._imageryProvider.hasAlphaChannel;
  188099. }
  188100. }
  188101. });
  188102. MapboxStyleImageryProvider.prototype.getTileCredits = function(x, y, level) {
  188103. return void 0;
  188104. };
  188105. MapboxStyleImageryProvider.prototype.requestImage = function(x, y, level, request) {
  188106. return this._imageryProvider.requestImage(x, y, level, request);
  188107. };
  188108. MapboxStyleImageryProvider.prototype.pickFeatures = function(x, y, level, longitude, latitude) {
  188109. return this._imageryProvider.pickFeatures(x, y, level, longitude, latitude);
  188110. };
  188111. MapboxStyleImageryProvider._defaultCredit = defaultCredit3;
  188112. var MapboxStyleImageryProvider_default = MapboxStyleImageryProvider;
  188113. // node_modules/cesium/Source/Scene/Moon.js
  188114. function Moon(options) {
  188115. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  188116. let url2 = options.textureUrl;
  188117. if (!defined_default(url2)) {
  188118. url2 = buildModuleUrl_default("Assets/Textures/moonSmall.jpg");
  188119. }
  188120. this.show = defaultValue_default(options.show, true);
  188121. this.textureUrl = url2;
  188122. this._ellipsoid = defaultValue_default(options.ellipsoid, Ellipsoid_default.MOON);
  188123. this.onlySunLighting = defaultValue_default(options.onlySunLighting, true);
  188124. this._ellipsoidPrimitive = new EllipsoidPrimitive_default({
  188125. radii: this.ellipsoid.radii,
  188126. material: Material_default.fromType(Material_default.ImageType),
  188127. depthTestEnabled: false,
  188128. _owner: this
  188129. });
  188130. this._ellipsoidPrimitive.material.translucent = false;
  188131. this._axes = new IauOrientationAxes_default();
  188132. }
  188133. Object.defineProperties(Moon.prototype, {
  188134. ellipsoid: {
  188135. get: function() {
  188136. return this._ellipsoid;
  188137. }
  188138. }
  188139. });
  188140. var icrfToFixed = new Matrix3_default();
  188141. var rotationScratch3 = new Matrix3_default();
  188142. var translationScratch2 = new Cartesian3_default();
  188143. var scratchCommandList2 = [];
  188144. Moon.prototype.update = function(frameState) {
  188145. if (!this.show) {
  188146. return;
  188147. }
  188148. const ellipsoidPrimitive = this._ellipsoidPrimitive;
  188149. ellipsoidPrimitive.material.uniforms.image = this.textureUrl;
  188150. ellipsoidPrimitive.onlySunLighting = this.onlySunLighting;
  188151. const date = frameState.time;
  188152. if (!defined_default(Transforms_default.computeIcrfToFixedMatrix(date, icrfToFixed))) {
  188153. Transforms_default.computeTemeToPseudoFixedMatrix(date, icrfToFixed);
  188154. }
  188155. const rotation = this._axes.evaluate(date, rotationScratch3);
  188156. Matrix3_default.transpose(rotation, rotation);
  188157. Matrix3_default.multiply(icrfToFixed, rotation, rotation);
  188158. const translation3 = Simon1994PlanetaryPositions_default.computeMoonPositionInEarthInertialFrame(
  188159. date,
  188160. translationScratch2
  188161. );
  188162. Matrix3_default.multiplyByVector(icrfToFixed, translation3, translation3);
  188163. Matrix4_default.fromRotationTranslation(
  188164. rotation,
  188165. translation3,
  188166. ellipsoidPrimitive.modelMatrix
  188167. );
  188168. const savedCommandList = frameState.commandList;
  188169. frameState.commandList = scratchCommandList2;
  188170. scratchCommandList2.length = 0;
  188171. ellipsoidPrimitive.update(frameState);
  188172. frameState.commandList = savedCommandList;
  188173. return scratchCommandList2.length === 1 ? scratchCommandList2[0] : void 0;
  188174. };
  188175. Moon.prototype.isDestroyed = function() {
  188176. return false;
  188177. };
  188178. Moon.prototype.destroy = function() {
  188179. this._ellipsoidPrimitive = this._ellipsoidPrimitive && this._ellipsoidPrimitive.destroy();
  188180. return destroyObject_default(this);
  188181. };
  188182. var Moon_default = Moon;
  188183. // node_modules/cesium/Source/Scene/NeverTileDiscardPolicy.js
  188184. function NeverTileDiscardPolicy(options) {
  188185. }
  188186. NeverTileDiscardPolicy.prototype.isReady = function() {
  188187. return true;
  188188. };
  188189. NeverTileDiscardPolicy.prototype.shouldDiscardImage = function(image) {
  188190. return false;
  188191. };
  188192. var NeverTileDiscardPolicy_default = NeverTileDiscardPolicy;
  188193. // node_modules/cesium/Source/Shaders/AdjustTranslucentFS.js
  188194. var AdjustTranslucentFS_default = "#ifdef MRT\n#extension GL_EXT_draw_buffers : enable\n#endif\n\nuniform vec4 u_bgColor;\nuniform sampler2D u_depthTexture;\n\nvarying vec2 v_textureCoordinates;\n\nvoid main()\n{\n if (texture2D(u_depthTexture, v_textureCoordinates).r < 1.0)\n {\n#ifdef MRT\n gl_FragData[0] = u_bgColor;\n gl_FragData[1] = vec4(u_bgColor.a);\n#else\n gl_FragColor = u_bgColor;\n#endif\n return;\n }\n \n discard;\n}\n";
  188195. // node_modules/cesium/Source/Shaders/CompositeOITFS.js
  188196. var CompositeOITFS_default = "/**\n * Compositing for Weighted Blended Order-Independent Transparency. See:\n * - http://jcgt.org/published/0002/02/09/\n * - http://casual-effects.blogspot.com/2014/03/weighted-blended-order-independent.html\n */\n\nuniform sampler2D u_opaque;\nuniform sampler2D u_accumulation;\nuniform sampler2D u_revealage;\n\nvarying vec2 v_textureCoordinates;\n\nvoid main()\n{\n vec4 opaque = texture2D(u_opaque, v_textureCoordinates);\n vec4 accum = texture2D(u_accumulation, v_textureCoordinates);\n float r = texture2D(u_revealage, v_textureCoordinates).r;\n\n#ifdef MRT\n vec4 transparent = vec4(accum.rgb / clamp(r, 1e-4, 5e4), accum.a);\n#else\n vec4 transparent = vec4(accum.rgb / clamp(accum.a, 1e-4, 5e4), r);\n#endif\n\n gl_FragColor = (1.0 - transparent.a) * transparent + transparent.a * opaque;\n\n if (opaque != czm_backgroundColor)\n {\n gl_FragColor.a = 1.0;\n }\n}\n";
  188197. // node_modules/cesium/Source/Scene/OIT.js
  188198. function OIT(context) {
  188199. this._numSamples = 1;
  188200. this._translucentMultipassSupport = false;
  188201. this._translucentMRTSupport = false;
  188202. const extensionsSupported = context.colorBufferFloat && context.depthTexture;
  188203. this._translucentMRTSupport = context.drawBuffers && extensionsSupported;
  188204. this._translucentMultipassSupport = !this._translucentMRTSupport && extensionsSupported;
  188205. this._opaqueFBO = void 0;
  188206. this._opaqueTexture = void 0;
  188207. this._depthStencilTexture = void 0;
  188208. this._accumulationTexture = void 0;
  188209. this._translucentFBO = new FramebufferManager_default({
  188210. colorAttachmentsLength: this._translucentMRTSupport ? 2 : 1,
  188211. createColorAttachments: false,
  188212. createDepthAttachments: false,
  188213. depth: true
  188214. });
  188215. this._alphaFBO = new FramebufferManager_default({
  188216. createColorAttachments: false,
  188217. createDepthAttachments: false,
  188218. depth: true
  188219. });
  188220. this._adjustTranslucentFBO = new FramebufferManager_default({
  188221. colorAttachmentsLength: this._translucentMRTSupport ? 2 : 1,
  188222. createColorAttachments: false
  188223. });
  188224. this._adjustAlphaFBO = new FramebufferManager_default({
  188225. createColorAttachments: false
  188226. });
  188227. this._opaqueClearCommand = new ClearCommand_default({
  188228. color: new Color_default(0, 0, 0, 0),
  188229. owner: this
  188230. });
  188231. this._translucentMRTClearCommand = new ClearCommand_default({
  188232. color: new Color_default(0, 0, 0, 1),
  188233. owner: this
  188234. });
  188235. this._translucentMultipassClearCommand = new ClearCommand_default({
  188236. color: new Color_default(0, 0, 0, 0),
  188237. owner: this
  188238. });
  188239. this._alphaClearCommand = new ClearCommand_default({
  188240. color: new Color_default(1, 1, 1, 1),
  188241. owner: this
  188242. });
  188243. this._translucentRenderStateCache = {};
  188244. this._alphaRenderStateCache = {};
  188245. this._compositeCommand = void 0;
  188246. this._adjustTranslucentCommand = void 0;
  188247. this._adjustAlphaCommand = void 0;
  188248. this._viewport = new BoundingRectangle_default();
  188249. this._rs = void 0;
  188250. this._useScissorTest = false;
  188251. this._scissorRectangle = void 0;
  188252. this._useHDR = false;
  188253. }
  188254. function destroyTextures(oit) {
  188255. oit._accumulationTexture = oit._accumulationTexture && !oit._accumulationTexture.isDestroyed() && oit._accumulationTexture.destroy();
  188256. oit._revealageTexture = oit._revealageTexture && !oit._revealageTexture.isDestroyed() && oit._revealageTexture.destroy();
  188257. }
  188258. function destroyFramebuffers3(oit) {
  188259. oit._translucentFBO.destroy();
  188260. oit._alphaFBO.destroy();
  188261. oit._adjustTranslucentFBO.destroy();
  188262. oit._adjustAlphaFBO.destroy();
  188263. }
  188264. function destroyResources2(oit) {
  188265. destroyTextures(oit);
  188266. destroyFramebuffers3(oit);
  188267. }
  188268. function updateTextures(oit, context, width, height) {
  188269. destroyTextures(oit);
  188270. oit._accumulationTexture = new Texture_default({
  188271. context,
  188272. width,
  188273. height,
  188274. pixelFormat: PixelFormat_default.RGBA,
  188275. pixelDatatype: PixelDatatype_default.FLOAT
  188276. });
  188277. const source = new Float32Array(width * height * 4);
  188278. oit._revealageTexture = new Texture_default({
  188279. context,
  188280. pixelFormat: PixelFormat_default.RGBA,
  188281. pixelDatatype: PixelDatatype_default.FLOAT,
  188282. source: {
  188283. arrayBufferView: source,
  188284. width,
  188285. height
  188286. },
  188287. flipY: false
  188288. });
  188289. }
  188290. function updateFramebuffers(oit, context) {
  188291. destroyFramebuffers3(oit);
  188292. const completeFBO = WebGLConstants_default.FRAMEBUFFER_COMPLETE;
  188293. let supported = true;
  188294. const width = oit._accumulationTexture.width;
  188295. const height = oit._accumulationTexture.height;
  188296. if (oit._translucentMRTSupport) {
  188297. oit._translucentFBO.setColorTexture(oit._accumulationTexture, 0);
  188298. oit._translucentFBO.setColorTexture(oit._revealageTexture, 1);
  188299. oit._translucentFBO.setDepthStencilTexture(oit._depthStencilTexture);
  188300. oit._translucentFBO.update(context, width, height);
  188301. oit._adjustTranslucentFBO.setColorTexture(oit._accumulationTexture, 0);
  188302. oit._adjustTranslucentFBO.setColorTexture(oit._revealageTexture, 1);
  188303. oit._adjustTranslucentFBO.update(context, width, height);
  188304. if (oit._translucentFBO.status !== completeFBO || oit._adjustTranslucentFBO.status !== completeFBO) {
  188305. destroyFramebuffers3(oit);
  188306. oit._translucentMRTSupport = false;
  188307. }
  188308. }
  188309. if (!oit._translucentMRTSupport) {
  188310. oit._translucentFBO.setColorTexture(oit._accumulationTexture);
  188311. oit._translucentFBO.setDepthStencilTexture(oit._depthStencilTexture);
  188312. oit._translucentFBO.update(context, width, height);
  188313. oit._alphaFBO.setColorTexture(oit._revealageTexture);
  188314. oit._alphaFBO.setDepthStencilTexture(oit._depthStencilTexture);
  188315. oit._alphaFBO.update(context, width, height);
  188316. oit._adjustTranslucentFBO.setColorTexture(oit._accumulationTexture);
  188317. oit._adjustTranslucentFBO.update(context, width, height);
  188318. oit._adjustAlphaFBO.setColorTexture(oit._revealageTexture);
  188319. oit._adjustAlphaFBO.update(context, width, height);
  188320. const translucentComplete = oit._translucentFBO.status === completeFBO;
  188321. const alphaComplete = oit._alphaFBO.status === completeFBO;
  188322. const adjustTranslucentComplete = oit._adjustTranslucentFBO.status === completeFBO;
  188323. const adjustAlphaComplete = oit._adjustAlphaFBO.status === completeFBO;
  188324. if (!translucentComplete || !alphaComplete || !adjustTranslucentComplete || !adjustAlphaComplete) {
  188325. destroyResources2(oit);
  188326. oit._translucentMultipassSupport = false;
  188327. supported = false;
  188328. }
  188329. }
  188330. return supported;
  188331. }
  188332. OIT.prototype.update = function(context, passState, framebuffer, useHDR, numSamples) {
  188333. if (!this.isSupported()) {
  188334. return;
  188335. }
  188336. this._opaqueFBO = framebuffer;
  188337. this._opaqueTexture = framebuffer.getColorTexture(0);
  188338. this._depthStencilTexture = framebuffer.getDepthStencilTexture();
  188339. const width = this._opaqueTexture.width;
  188340. const height = this._opaqueTexture.height;
  188341. const accumulationTexture = this._accumulationTexture;
  188342. const textureChanged = !defined_default(accumulationTexture) || accumulationTexture.width !== width || accumulationTexture.height !== height || useHDR !== this._useHDR;
  188343. const samplesChanged = this._numSamples !== numSamples;
  188344. if (textureChanged || samplesChanged) {
  188345. this._numSamples = numSamples;
  188346. updateTextures(this, context, width, height);
  188347. }
  188348. if (!defined_default(this._translucentFBO.framebuffer) || textureChanged || samplesChanged) {
  188349. if (!updateFramebuffers(this, context)) {
  188350. return;
  188351. }
  188352. }
  188353. this._useHDR = useHDR;
  188354. const that = this;
  188355. let fs;
  188356. let uniformMap2;
  188357. if (!defined_default(this._compositeCommand)) {
  188358. fs = new ShaderSource_default({
  188359. sources: [CompositeOITFS_default]
  188360. });
  188361. if (this._translucentMRTSupport) {
  188362. fs.defines.push("MRT");
  188363. }
  188364. uniformMap2 = {
  188365. u_opaque: function() {
  188366. return that._opaqueTexture;
  188367. },
  188368. u_accumulation: function() {
  188369. return that._accumulationTexture;
  188370. },
  188371. u_revealage: function() {
  188372. return that._revealageTexture;
  188373. }
  188374. };
  188375. this._compositeCommand = context.createViewportQuadCommand(fs, {
  188376. uniformMap: uniformMap2,
  188377. owner: this
  188378. });
  188379. }
  188380. if (!defined_default(this._adjustTranslucentCommand)) {
  188381. if (this._translucentMRTSupport) {
  188382. fs = new ShaderSource_default({
  188383. defines: ["MRT"],
  188384. sources: [AdjustTranslucentFS_default]
  188385. });
  188386. uniformMap2 = {
  188387. u_bgColor: function() {
  188388. return that._translucentMRTClearCommand.color;
  188389. },
  188390. u_depthTexture: function() {
  188391. return that._depthStencilTexture;
  188392. }
  188393. };
  188394. this._adjustTranslucentCommand = context.createViewportQuadCommand(fs, {
  188395. uniformMap: uniformMap2,
  188396. owner: this
  188397. });
  188398. } else if (this._translucentMultipassSupport) {
  188399. fs = new ShaderSource_default({
  188400. sources: [AdjustTranslucentFS_default]
  188401. });
  188402. uniformMap2 = {
  188403. u_bgColor: function() {
  188404. return that._translucentMultipassClearCommand.color;
  188405. },
  188406. u_depthTexture: function() {
  188407. return that._depthStencilTexture;
  188408. }
  188409. };
  188410. this._adjustTranslucentCommand = context.createViewportQuadCommand(fs, {
  188411. uniformMap: uniformMap2,
  188412. owner: this
  188413. });
  188414. uniformMap2 = {
  188415. u_bgColor: function() {
  188416. return that._alphaClearCommand.color;
  188417. },
  188418. u_depthTexture: function() {
  188419. return that._depthStencilTexture;
  188420. }
  188421. };
  188422. this._adjustAlphaCommand = context.createViewportQuadCommand(fs, {
  188423. uniformMap: uniformMap2,
  188424. owner: this
  188425. });
  188426. }
  188427. }
  188428. this._viewport.width = width;
  188429. this._viewport.height = height;
  188430. const useScissorTest = !BoundingRectangle_default.equals(
  188431. this._viewport,
  188432. passState.viewport
  188433. );
  188434. let updateScissor = useScissorTest !== this._useScissorTest;
  188435. this._useScissorTest = useScissorTest;
  188436. if (!BoundingRectangle_default.equals(this._scissorRectangle, passState.viewport)) {
  188437. this._scissorRectangle = BoundingRectangle_default.clone(
  188438. passState.viewport,
  188439. this._scissorRectangle
  188440. );
  188441. updateScissor = true;
  188442. }
  188443. if (!defined_default(this._rs) || !BoundingRectangle_default.equals(this._viewport, this._rs.viewport) || updateScissor) {
  188444. this._rs = RenderState_default.fromCache({
  188445. viewport: this._viewport,
  188446. scissorTest: {
  188447. enabled: this._useScissorTest,
  188448. rectangle: this._scissorRectangle
  188449. }
  188450. });
  188451. }
  188452. if (defined_default(this._compositeCommand)) {
  188453. this._compositeCommand.renderState = this._rs;
  188454. }
  188455. if (this._adjustTranslucentCommand) {
  188456. this._adjustTranslucentCommand.renderState = this._rs;
  188457. }
  188458. if (defined_default(this._adjustAlphaCommand)) {
  188459. this._adjustAlphaCommand.renderState = this._rs;
  188460. }
  188461. };
  188462. var translucentMRTBlend = {
  188463. enabled: true,
  188464. color: new Color_default(0, 0, 0, 0),
  188465. equationRgb: BlendEquation_default.ADD,
  188466. equationAlpha: BlendEquation_default.ADD,
  188467. functionSourceRgb: BlendFunction_default.ONE,
  188468. functionDestinationRgb: BlendFunction_default.ONE,
  188469. functionSourceAlpha: BlendFunction_default.ZERO,
  188470. functionDestinationAlpha: BlendFunction_default.ONE_MINUS_SOURCE_ALPHA
  188471. };
  188472. var translucentColorBlend = {
  188473. enabled: true,
  188474. color: new Color_default(0, 0, 0, 0),
  188475. equationRgb: BlendEquation_default.ADD,
  188476. equationAlpha: BlendEquation_default.ADD,
  188477. functionSourceRgb: BlendFunction_default.ONE,
  188478. functionDestinationRgb: BlendFunction_default.ONE,
  188479. functionSourceAlpha: BlendFunction_default.ONE,
  188480. functionDestinationAlpha: BlendFunction_default.ONE
  188481. };
  188482. var translucentAlphaBlend = {
  188483. enabled: true,
  188484. color: new Color_default(0, 0, 0, 0),
  188485. equationRgb: BlendEquation_default.ADD,
  188486. equationAlpha: BlendEquation_default.ADD,
  188487. functionSourceRgb: BlendFunction_default.ZERO,
  188488. functionDestinationRgb: BlendFunction_default.ONE_MINUS_SOURCE_ALPHA,
  188489. functionSourceAlpha: BlendFunction_default.ZERO,
  188490. functionDestinationAlpha: BlendFunction_default.ONE_MINUS_SOURCE_ALPHA
  188491. };
  188492. function getTranslucentRenderState3(context, translucentBlending, cache, renderState) {
  188493. let translucentState = cache[renderState.id];
  188494. if (!defined_default(translucentState)) {
  188495. const rs = RenderState_default.getState(renderState);
  188496. rs.depthMask = false;
  188497. rs.blending = translucentBlending;
  188498. translucentState = RenderState_default.fromCache(rs);
  188499. cache[renderState.id] = translucentState;
  188500. }
  188501. return translucentState;
  188502. }
  188503. function getTranslucentMRTRenderState(oit, context, renderState) {
  188504. return getTranslucentRenderState3(
  188505. context,
  188506. translucentMRTBlend,
  188507. oit._translucentRenderStateCache,
  188508. renderState
  188509. );
  188510. }
  188511. function getTranslucentColorRenderState(oit, context, renderState) {
  188512. return getTranslucentRenderState3(
  188513. context,
  188514. translucentColorBlend,
  188515. oit._translucentRenderStateCache,
  188516. renderState
  188517. );
  188518. }
  188519. function getTranslucentAlphaRenderState(oit, context, renderState) {
  188520. return getTranslucentRenderState3(
  188521. context,
  188522. translucentAlphaBlend,
  188523. oit._alphaRenderStateCache,
  188524. renderState
  188525. );
  188526. }
  188527. var mrtShaderSource = " vec3 Ci = czm_gl_FragColor.rgb * czm_gl_FragColor.a;\n float ai = czm_gl_FragColor.a;\n float wzi = czm_alphaWeight(ai);\n gl_FragData[0] = vec4(Ci * wzi, ai);\n gl_FragData[1] = vec4(ai * wzi);\n";
  188528. var colorShaderSource = " vec3 Ci = czm_gl_FragColor.rgb * czm_gl_FragColor.a;\n float ai = czm_gl_FragColor.a;\n float wzi = czm_alphaWeight(ai);\n gl_FragColor = vec4(Ci, ai) * wzi;\n";
  188529. var alphaShaderSource = " float ai = czm_gl_FragColor.a;\n gl_FragColor = vec4(ai);\n";
  188530. function getTranslucentShaderProgram2(context, shaderProgram, keyword, source) {
  188531. let shader = context.shaderCache.getDerivedShaderProgram(
  188532. shaderProgram,
  188533. keyword
  188534. );
  188535. if (!defined_default(shader)) {
  188536. const attributeLocations8 = shaderProgram._attributeLocations;
  188537. const fs = shaderProgram.fragmentShaderSource.clone();
  188538. fs.sources = fs.sources.map(function(source2) {
  188539. source2 = ShaderSource_default.replaceMain(source2, "czm_translucent_main");
  188540. source2 = source2.replace(/gl_FragColor/g, "czm_gl_FragColor");
  188541. source2 = source2.replace(/\bdiscard\b/g, "czm_discard = true");
  188542. source2 = source2.replace(/czm_phong/g, "czm_translucentPhong");
  188543. return source2;
  188544. });
  188545. fs.sources.splice(
  188546. 0,
  188547. 0,
  188548. `${source.indexOf("gl_FragData") !== -1 ? "#extension GL_EXT_draw_buffers : enable \n" : ""}vec4 czm_gl_FragColor;
  188549. bool czm_discard = false;
  188550. `
  188551. );
  188552. fs.sources.push(
  188553. `${"void main()\n{\n czm_translucent_main();\n if (czm_discard)\n {\n discard;\n }\n"}${source}}
  188554. `
  188555. );
  188556. shader = context.shaderCache.createDerivedShaderProgram(
  188557. shaderProgram,
  188558. keyword,
  188559. {
  188560. vertexShaderSource: shaderProgram.vertexShaderSource,
  188561. fragmentShaderSource: fs,
  188562. attributeLocations: attributeLocations8
  188563. }
  188564. );
  188565. }
  188566. return shader;
  188567. }
  188568. function getTranslucentMRTShaderProgram(context, shaderProgram) {
  188569. return getTranslucentShaderProgram2(
  188570. context,
  188571. shaderProgram,
  188572. "translucentMRT",
  188573. mrtShaderSource
  188574. );
  188575. }
  188576. function getTranslucentColorShaderProgram(context, shaderProgram) {
  188577. return getTranslucentShaderProgram2(
  188578. context,
  188579. shaderProgram,
  188580. "translucentMultipass",
  188581. colorShaderSource
  188582. );
  188583. }
  188584. function getTranslucentAlphaShaderProgram(context, shaderProgram) {
  188585. return getTranslucentShaderProgram2(
  188586. context,
  188587. shaderProgram,
  188588. "alphaMultipass",
  188589. alphaShaderSource
  188590. );
  188591. }
  188592. OIT.prototype.createDerivedCommands = function(command, context, result) {
  188593. if (!defined_default(result)) {
  188594. result = {};
  188595. }
  188596. if (this._translucentMRTSupport) {
  188597. let translucentShader;
  188598. let translucentRenderState;
  188599. if (defined_default(result.translucentCommand)) {
  188600. translucentShader = result.translucentCommand.shaderProgram;
  188601. translucentRenderState = result.translucentCommand.renderState;
  188602. }
  188603. result.translucentCommand = DrawCommand_default.shallowClone(
  188604. command,
  188605. result.translucentCommand
  188606. );
  188607. if (!defined_default(translucentShader) || result.shaderProgramId !== command.shaderProgram.id) {
  188608. result.translucentCommand.shaderProgram = getTranslucentMRTShaderProgram(
  188609. context,
  188610. command.shaderProgram
  188611. );
  188612. result.translucentCommand.renderState = getTranslucentMRTRenderState(
  188613. this,
  188614. context,
  188615. command.renderState
  188616. );
  188617. result.shaderProgramId = command.shaderProgram.id;
  188618. } else {
  188619. result.translucentCommand.shaderProgram = translucentShader;
  188620. result.translucentCommand.renderState = translucentRenderState;
  188621. }
  188622. } else {
  188623. let colorShader;
  188624. let colorRenderState2;
  188625. let alphaShader;
  188626. let alphaRenderState;
  188627. if (defined_default(result.translucentCommand)) {
  188628. colorShader = result.translucentCommand.shaderProgram;
  188629. colorRenderState2 = result.translucentCommand.renderState;
  188630. alphaShader = result.alphaCommand.shaderProgram;
  188631. alphaRenderState = result.alphaCommand.renderState;
  188632. }
  188633. result.translucentCommand = DrawCommand_default.shallowClone(
  188634. command,
  188635. result.translucentCommand
  188636. );
  188637. result.alphaCommand = DrawCommand_default.shallowClone(
  188638. command,
  188639. result.alphaCommand
  188640. );
  188641. if (!defined_default(colorShader) || result.shaderProgramId !== command.shaderProgram.id) {
  188642. result.translucentCommand.shaderProgram = getTranslucentColorShaderProgram(
  188643. context,
  188644. command.shaderProgram
  188645. );
  188646. result.translucentCommand.renderState = getTranslucentColorRenderState(
  188647. this,
  188648. context,
  188649. command.renderState
  188650. );
  188651. result.alphaCommand.shaderProgram = getTranslucentAlphaShaderProgram(
  188652. context,
  188653. command.shaderProgram
  188654. );
  188655. result.alphaCommand.renderState = getTranslucentAlphaRenderState(
  188656. this,
  188657. context,
  188658. command.renderState
  188659. );
  188660. result.shaderProgramId = command.shaderProgram.id;
  188661. } else {
  188662. result.translucentCommand.shaderProgram = colorShader;
  188663. result.translucentCommand.renderState = colorRenderState2;
  188664. result.alphaCommand.shaderProgram = alphaShader;
  188665. result.alphaCommand.renderState = alphaRenderState;
  188666. }
  188667. }
  188668. return result;
  188669. };
  188670. function executeTranslucentCommandsSortedMultipass(oit, scene, executeFunction, passState, commands, invertClassification) {
  188671. let command;
  188672. let derivedCommand;
  188673. let j;
  188674. const context = scene.context;
  188675. const useLogDepth = scene.frameState.useLogDepth;
  188676. const useHdr = scene._hdr;
  188677. const framebuffer = passState.framebuffer;
  188678. const length3 = commands.length;
  188679. const lightShadowsEnabled = scene.frameState.shadowState.lightShadowsEnabled;
  188680. passState.framebuffer = oit._adjustTranslucentFBO.framebuffer;
  188681. oit._adjustTranslucentCommand.execute(context, passState);
  188682. passState.framebuffer = oit._adjustAlphaFBO.framebuffer;
  188683. oit._adjustAlphaCommand.execute(context, passState);
  188684. const debugFramebuffer = oit._opaqueFBO.framebuffer;
  188685. passState.framebuffer = oit._translucentFBO.framebuffer;
  188686. for (j = 0; j < length3; ++j) {
  188687. command = commands[j];
  188688. command = useLogDepth ? command.derivedCommands.logDepth.command : command;
  188689. command = useHdr ? command.derivedCommands.hdr.command : command;
  188690. derivedCommand = lightShadowsEnabled && command.receiveShadows ? command.derivedCommands.oit.shadows.translucentCommand : command.derivedCommands.oit.translucentCommand;
  188691. executeFunction(
  188692. derivedCommand,
  188693. scene,
  188694. context,
  188695. passState,
  188696. debugFramebuffer
  188697. );
  188698. }
  188699. if (defined_default(invertClassification)) {
  188700. command = invertClassification.unclassifiedCommand;
  188701. derivedCommand = lightShadowsEnabled && command.receiveShadows ? command.derivedCommands.oit.shadows.translucentCommand : command.derivedCommands.oit.translucentCommand;
  188702. executeFunction(
  188703. derivedCommand,
  188704. scene,
  188705. context,
  188706. passState,
  188707. debugFramebuffer
  188708. );
  188709. }
  188710. passState.framebuffer = oit._alphaFBO.framebuffer;
  188711. for (j = 0; j < length3; ++j) {
  188712. command = commands[j];
  188713. command = useLogDepth ? command.derivedCommands.logDepth.command : command;
  188714. command = useHdr ? command.derivedCommands.hdr.command : command;
  188715. derivedCommand = lightShadowsEnabled && command.receiveShadows ? command.derivedCommands.oit.shadows.alphaCommand : command.derivedCommands.oit.alphaCommand;
  188716. executeFunction(
  188717. derivedCommand,
  188718. scene,
  188719. context,
  188720. passState,
  188721. debugFramebuffer
  188722. );
  188723. }
  188724. if (defined_default(invertClassification)) {
  188725. command = invertClassification.unclassifiedCommand;
  188726. derivedCommand = lightShadowsEnabled && command.receiveShadows ? command.derivedCommands.oit.shadows.alphaCommand : command.derivedCommands.oit.alphaCommand;
  188727. executeFunction(
  188728. derivedCommand,
  188729. scene,
  188730. context,
  188731. passState,
  188732. debugFramebuffer
  188733. );
  188734. }
  188735. passState.framebuffer = framebuffer;
  188736. }
  188737. function executeTranslucentCommandsSortedMRT(oit, scene, executeFunction, passState, commands, invertClassification) {
  188738. const context = scene.context;
  188739. const useLogDepth = scene.frameState.useLogDepth;
  188740. const useHdr = scene._hdr;
  188741. const framebuffer = passState.framebuffer;
  188742. const length3 = commands.length;
  188743. const lightShadowsEnabled = scene.frameState.shadowState.lightShadowsEnabled;
  188744. passState.framebuffer = oit._adjustTranslucentFBO.framebuffer;
  188745. oit._adjustTranslucentCommand.execute(context, passState);
  188746. const debugFramebuffer = oit._opaqueFBO.framebuffer;
  188747. passState.framebuffer = oit._translucentFBO.framebuffer;
  188748. let command;
  188749. let derivedCommand;
  188750. for (let j = 0; j < length3; ++j) {
  188751. command = commands[j];
  188752. command = useLogDepth ? command.derivedCommands.logDepth.command : command;
  188753. command = useHdr ? command.derivedCommands.hdr.command : command;
  188754. derivedCommand = lightShadowsEnabled && command.receiveShadows ? command.derivedCommands.oit.shadows.translucentCommand : command.derivedCommands.oit.translucentCommand;
  188755. executeFunction(
  188756. derivedCommand,
  188757. scene,
  188758. context,
  188759. passState,
  188760. debugFramebuffer
  188761. );
  188762. }
  188763. if (defined_default(invertClassification)) {
  188764. command = invertClassification.unclassifiedCommand;
  188765. derivedCommand = lightShadowsEnabled && command.receiveShadows ? command.derivedCommands.oit.shadows.translucentCommand : command.derivedCommands.oit.translucentCommand;
  188766. executeFunction(
  188767. derivedCommand,
  188768. scene,
  188769. context,
  188770. passState,
  188771. debugFramebuffer
  188772. );
  188773. }
  188774. passState.framebuffer = framebuffer;
  188775. }
  188776. OIT.prototype.executeCommands = function(scene, executeFunction, passState, commands, invertClassification) {
  188777. if (this._translucentMRTSupport) {
  188778. executeTranslucentCommandsSortedMRT(
  188779. this,
  188780. scene,
  188781. executeFunction,
  188782. passState,
  188783. commands,
  188784. invertClassification
  188785. );
  188786. return;
  188787. }
  188788. executeTranslucentCommandsSortedMultipass(
  188789. this,
  188790. scene,
  188791. executeFunction,
  188792. passState,
  188793. commands,
  188794. invertClassification
  188795. );
  188796. };
  188797. OIT.prototype.execute = function(context, passState) {
  188798. this._compositeCommand.execute(context, passState);
  188799. };
  188800. OIT.prototype.clear = function(context, passState, clearColor) {
  188801. const framebuffer = passState.framebuffer;
  188802. passState.framebuffer = this._opaqueFBO.framebuffer;
  188803. Color_default.clone(clearColor, this._opaqueClearCommand.color);
  188804. this._opaqueClearCommand.execute(context, passState);
  188805. passState.framebuffer = this._translucentFBO.framebuffer;
  188806. const translucentClearCommand = this._translucentMRTSupport ? this._translucentMRTClearCommand : this._translucentMultipassClearCommand;
  188807. translucentClearCommand.execute(context, passState);
  188808. if (this._translucentMultipassSupport) {
  188809. passState.framebuffer = this._alphaFBO.framebuffer;
  188810. this._alphaClearCommand.execute(context, passState);
  188811. }
  188812. passState.framebuffer = framebuffer;
  188813. };
  188814. OIT.prototype.isSupported = function() {
  188815. return this._translucentMRTSupport || this._translucentMultipassSupport;
  188816. };
  188817. OIT.prototype.isDestroyed = function() {
  188818. return false;
  188819. };
  188820. OIT.prototype.destroy = function() {
  188821. destroyResources2(this);
  188822. if (defined_default(this._compositeCommand)) {
  188823. this._compositeCommand.shaderProgram = this._compositeCommand.shaderProgram && this._compositeCommand.shaderProgram.destroy();
  188824. }
  188825. if (defined_default(this._adjustTranslucentCommand)) {
  188826. this._adjustTranslucentCommand.shaderProgram = this._adjustTranslucentCommand.shaderProgram && this._adjustTranslucentCommand.shaderProgram.destroy();
  188827. }
  188828. if (defined_default(this._adjustAlphaCommand)) {
  188829. this._adjustAlphaCommand.shaderProgram = this._adjustAlphaCommand.shaderProgram && this._adjustAlphaCommand.shaderProgram.destroy();
  188830. }
  188831. return destroyObject_default(this);
  188832. };
  188833. var OIT_default = OIT;
  188834. // node_modules/cesium/Source/Scene/OpenStreetMapImageryProvider.js
  188835. var defaultCredit4 = new Credit_default(
  188836. "MapQuest, Open Street Map and contributors, CC-BY-SA"
  188837. );
  188838. function OpenStreetMapImageryProvider(options) {
  188839. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  188840. const resource = Resource_default.createIfNeeded(
  188841. defaultValue_default(options.url, "https://a.tile.openstreetmap.org/")
  188842. );
  188843. resource.appendForwardSlash();
  188844. resource.url += `{z}/{x}/{y}.${defaultValue_default(options.fileExtension, "png")}`;
  188845. const tilingScheme2 = new WebMercatorTilingScheme_default({
  188846. ellipsoid: options.ellipsoid
  188847. });
  188848. const tileWidth = 256;
  188849. const tileHeight = 256;
  188850. const minimumLevel = defaultValue_default(options.minimumLevel, 0);
  188851. const maximumLevel = options.maximumLevel;
  188852. const rectangle = defaultValue_default(options.rectangle, tilingScheme2.rectangle);
  188853. const swTile = tilingScheme2.positionToTileXY(
  188854. Rectangle_default.southwest(rectangle),
  188855. minimumLevel
  188856. );
  188857. const neTile = tilingScheme2.positionToTileXY(
  188858. Rectangle_default.northeast(rectangle),
  188859. minimumLevel
  188860. );
  188861. const tileCount = (Math.abs(neTile.x - swTile.x) + 1) * (Math.abs(neTile.y - swTile.y) + 1);
  188862. if (tileCount > 4) {
  188863. throw new DeveloperError_default(
  188864. `The rectangle and minimumLevel indicate that there are ${tileCount} tiles at the minimum level. Imagery providers with more than four tiles at the minimum level are not supported.`
  188865. );
  188866. }
  188867. let credit = defaultValue_default(options.credit, defaultCredit4);
  188868. if (typeof credit === "string") {
  188869. credit = new Credit_default(credit);
  188870. }
  188871. UrlTemplateImageryProvider_default.call(this, {
  188872. url: resource,
  188873. credit,
  188874. tilingScheme: tilingScheme2,
  188875. tileWidth,
  188876. tileHeight,
  188877. minimumLevel,
  188878. maximumLevel,
  188879. rectangle
  188880. });
  188881. }
  188882. if (defined_default(Object.create)) {
  188883. OpenStreetMapImageryProvider.prototype = Object.create(
  188884. UrlTemplateImageryProvider_default.prototype
  188885. );
  188886. OpenStreetMapImageryProvider.prototype.constructor = OpenStreetMapImageryProvider;
  188887. }
  188888. var OpenStreetMapImageryProvider_default = OpenStreetMapImageryProvider;
  188889. // node_modules/cesium/Source/Scene/Particle.js
  188890. var defaultSize = new Cartesian2_default(1, 1);
  188891. function Particle(options) {
  188892. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  188893. this.mass = defaultValue_default(options.mass, 1);
  188894. this.position = Cartesian3_default.clone(
  188895. defaultValue_default(options.position, Cartesian3_default.ZERO)
  188896. );
  188897. this.velocity = Cartesian3_default.clone(
  188898. defaultValue_default(options.velocity, Cartesian3_default.ZERO)
  188899. );
  188900. this.life = defaultValue_default(options.life, Number.MAX_VALUE);
  188901. this.image = options.image;
  188902. this.startColor = Color_default.clone(defaultValue_default(options.startColor, Color_default.WHITE));
  188903. this.endColor = Color_default.clone(defaultValue_default(options.endColor, Color_default.WHITE));
  188904. this.startScale = defaultValue_default(options.startScale, 1);
  188905. this.endScale = defaultValue_default(options.endScale, 1);
  188906. this.imageSize = Cartesian2_default.clone(
  188907. defaultValue_default(options.imageSize, defaultSize)
  188908. );
  188909. this._age = 0;
  188910. this._normalizedAge = 0;
  188911. this._billboard = void 0;
  188912. }
  188913. Object.defineProperties(Particle.prototype, {
  188914. age: {
  188915. get: function() {
  188916. return this._age;
  188917. }
  188918. },
  188919. normalizedAge: {
  188920. get: function() {
  188921. return this._normalizedAge;
  188922. }
  188923. }
  188924. });
  188925. var deltaScratch = new Cartesian3_default();
  188926. Particle.prototype.update = function(dt, particleUpdateFunction) {
  188927. Cartesian3_default.multiplyByScalar(this.velocity, dt, deltaScratch);
  188928. Cartesian3_default.add(this.position, deltaScratch, this.position);
  188929. if (defined_default(particleUpdateFunction)) {
  188930. particleUpdateFunction(this, dt);
  188931. }
  188932. this._age += dt;
  188933. if (this.life === Number.MAX_VALUE) {
  188934. this._normalizedAge = 0;
  188935. } else {
  188936. this._normalizedAge = this._age / this.life;
  188937. }
  188938. return this._age <= this.life;
  188939. };
  188940. var Particle_default = Particle;
  188941. // node_modules/cesium/Source/Scene/ParticleBurst.js
  188942. function ParticleBurst(options) {
  188943. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  188944. this.time = defaultValue_default(options.time, 0);
  188945. this.minimum = defaultValue_default(options.minimum, 0);
  188946. this.maximum = defaultValue_default(options.maximum, 50);
  188947. this._complete = false;
  188948. }
  188949. Object.defineProperties(ParticleBurst.prototype, {
  188950. complete: {
  188951. get: function() {
  188952. return this._complete;
  188953. }
  188954. }
  188955. });
  188956. var ParticleBurst_default = ParticleBurst;
  188957. // node_modules/cesium/Source/Scene/ParticleEmitter.js
  188958. function ParticleEmitter(options) {
  188959. throw new DeveloperError_default(
  188960. "This type should not be instantiated directly. Instead, use BoxEmitter, CircleEmitter, ConeEmitter or SphereEmitter."
  188961. );
  188962. }
  188963. ParticleEmitter.prototype.emit = function(particle) {
  188964. DeveloperError_default.throwInstantiationError();
  188965. };
  188966. var ParticleEmitter_default = ParticleEmitter;
  188967. // node_modules/cesium/Source/Scene/ParticleSystem.js
  188968. var defaultImageSize = new Cartesian2_default(1, 1);
  188969. function ParticleSystem(options) {
  188970. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  188971. this.show = defaultValue_default(options.show, true);
  188972. this.updateCallback = options.updateCallback;
  188973. this.loop = defaultValue_default(options.loop, true);
  188974. this.image = defaultValue_default(options.image, void 0);
  188975. let emitter = options.emitter;
  188976. if (!defined_default(emitter)) {
  188977. emitter = new CircleEmitter_default(0.5);
  188978. }
  188979. this._emitter = emitter;
  188980. this._bursts = options.bursts;
  188981. this._modelMatrix = Matrix4_default.clone(
  188982. defaultValue_default(options.modelMatrix, Matrix4_default.IDENTITY)
  188983. );
  188984. this._emitterModelMatrix = Matrix4_default.clone(
  188985. defaultValue_default(options.emitterModelMatrix, Matrix4_default.IDENTITY)
  188986. );
  188987. this._matrixDirty = true;
  188988. this._combinedMatrix = new Matrix4_default();
  188989. this._startColor = Color_default.clone(
  188990. defaultValue_default(options.color, defaultValue_default(options.startColor, Color_default.WHITE))
  188991. );
  188992. this._endColor = Color_default.clone(
  188993. defaultValue_default(options.color, defaultValue_default(options.endColor, Color_default.WHITE))
  188994. );
  188995. this._startScale = defaultValue_default(
  188996. options.scale,
  188997. defaultValue_default(options.startScale, 1)
  188998. );
  188999. this._endScale = defaultValue_default(
  189000. options.scale,
  189001. defaultValue_default(options.endScale, 1)
  189002. );
  189003. this._emissionRate = defaultValue_default(options.emissionRate, 5);
  189004. this._minimumSpeed = defaultValue_default(
  189005. options.speed,
  189006. defaultValue_default(options.minimumSpeed, 1)
  189007. );
  189008. this._maximumSpeed = defaultValue_default(
  189009. options.speed,
  189010. defaultValue_default(options.maximumSpeed, 1)
  189011. );
  189012. this._minimumParticleLife = defaultValue_default(
  189013. options.particleLife,
  189014. defaultValue_default(options.minimumParticleLife, 5)
  189015. );
  189016. this._maximumParticleLife = defaultValue_default(
  189017. options.particleLife,
  189018. defaultValue_default(options.maximumParticleLife, 5)
  189019. );
  189020. this._minimumMass = defaultValue_default(
  189021. options.mass,
  189022. defaultValue_default(options.minimumMass, 1)
  189023. );
  189024. this._maximumMass = defaultValue_default(
  189025. options.mass,
  189026. defaultValue_default(options.maximumMass, 1)
  189027. );
  189028. this._minimumImageSize = Cartesian2_default.clone(
  189029. defaultValue_default(
  189030. options.imageSize,
  189031. defaultValue_default(options.minimumImageSize, defaultImageSize)
  189032. )
  189033. );
  189034. this._maximumImageSize = Cartesian2_default.clone(
  189035. defaultValue_default(
  189036. options.imageSize,
  189037. defaultValue_default(options.maximumImageSize, defaultImageSize)
  189038. )
  189039. );
  189040. this._sizeInMeters = defaultValue_default(options.sizeInMeters, false);
  189041. this._lifetime = defaultValue_default(options.lifetime, Number.MAX_VALUE);
  189042. this._billboardCollection = void 0;
  189043. this._particles = [];
  189044. this._particlePool = [];
  189045. this._previousTime = void 0;
  189046. this._currentTime = 0;
  189047. this._carryOver = 0;
  189048. this._complete = new Event_default();
  189049. this._isComplete = false;
  189050. this._updateParticlePool = true;
  189051. this._particleEstimate = 0;
  189052. }
  189053. Object.defineProperties(ParticleSystem.prototype, {
  189054. emitter: {
  189055. get: function() {
  189056. return this._emitter;
  189057. },
  189058. set: function(value) {
  189059. Check_default.defined("value", value);
  189060. this._emitter = value;
  189061. }
  189062. },
  189063. bursts: {
  189064. get: function() {
  189065. return this._bursts;
  189066. },
  189067. set: function(value) {
  189068. this._bursts = value;
  189069. this._updateParticlePool = true;
  189070. }
  189071. },
  189072. modelMatrix: {
  189073. get: function() {
  189074. return this._modelMatrix;
  189075. },
  189076. set: function(value) {
  189077. Check_default.defined("value", value);
  189078. this._matrixDirty = this._matrixDirty || !Matrix4_default.equals(this._modelMatrix, value);
  189079. Matrix4_default.clone(value, this._modelMatrix);
  189080. }
  189081. },
  189082. emitterModelMatrix: {
  189083. get: function() {
  189084. return this._emitterModelMatrix;
  189085. },
  189086. set: function(value) {
  189087. Check_default.defined("value", value);
  189088. this._matrixDirty = this._matrixDirty || !Matrix4_default.equals(this._emitterModelMatrix, value);
  189089. Matrix4_default.clone(value, this._emitterModelMatrix);
  189090. }
  189091. },
  189092. startColor: {
  189093. get: function() {
  189094. return this._startColor;
  189095. },
  189096. set: function(value) {
  189097. Check_default.defined("value", value);
  189098. Color_default.clone(value, this._startColor);
  189099. }
  189100. },
  189101. endColor: {
  189102. get: function() {
  189103. return this._endColor;
  189104. },
  189105. set: function(value) {
  189106. Check_default.defined("value", value);
  189107. Color_default.clone(value, this._endColor);
  189108. }
  189109. },
  189110. startScale: {
  189111. get: function() {
  189112. return this._startScale;
  189113. },
  189114. set: function(value) {
  189115. Check_default.typeOf.number.greaterThanOrEquals("value", value, 0);
  189116. this._startScale = value;
  189117. }
  189118. },
  189119. endScale: {
  189120. get: function() {
  189121. return this._endScale;
  189122. },
  189123. set: function(value) {
  189124. Check_default.typeOf.number.greaterThanOrEquals("value", value, 0);
  189125. this._endScale = value;
  189126. }
  189127. },
  189128. emissionRate: {
  189129. get: function() {
  189130. return this._emissionRate;
  189131. },
  189132. set: function(value) {
  189133. Check_default.typeOf.number.greaterThanOrEquals("value", value, 0);
  189134. this._emissionRate = value;
  189135. this._updateParticlePool = true;
  189136. }
  189137. },
  189138. minimumSpeed: {
  189139. get: function() {
  189140. return this._minimumSpeed;
  189141. },
  189142. set: function(value) {
  189143. Check_default.typeOf.number.greaterThanOrEquals("value", value, 0);
  189144. this._minimumSpeed = value;
  189145. }
  189146. },
  189147. maximumSpeed: {
  189148. get: function() {
  189149. return this._maximumSpeed;
  189150. },
  189151. set: function(value) {
  189152. Check_default.typeOf.number.greaterThanOrEquals("value", value, 0);
  189153. this._maximumSpeed = value;
  189154. }
  189155. },
  189156. minimumParticleLife: {
  189157. get: function() {
  189158. return this._minimumParticleLife;
  189159. },
  189160. set: function(value) {
  189161. Check_default.typeOf.number.greaterThanOrEquals("value", value, 0);
  189162. this._minimumParticleLife = value;
  189163. }
  189164. },
  189165. maximumParticleLife: {
  189166. get: function() {
  189167. return this._maximumParticleLife;
  189168. },
  189169. set: function(value) {
  189170. Check_default.typeOf.number.greaterThanOrEquals("value", value, 0);
  189171. this._maximumParticleLife = value;
  189172. this._updateParticlePool = true;
  189173. }
  189174. },
  189175. minimumMass: {
  189176. get: function() {
  189177. return this._minimumMass;
  189178. },
  189179. set: function(value) {
  189180. Check_default.typeOf.number.greaterThanOrEquals("value", value, 0);
  189181. this._minimumMass = value;
  189182. }
  189183. },
  189184. maximumMass: {
  189185. get: function() {
  189186. return this._maximumMass;
  189187. },
  189188. set: function(value) {
  189189. Check_default.typeOf.number.greaterThanOrEquals("value", value, 0);
  189190. this._maximumMass = value;
  189191. }
  189192. },
  189193. minimumImageSize: {
  189194. get: function() {
  189195. return this._minimumImageSize;
  189196. },
  189197. set: function(value) {
  189198. Check_default.typeOf.object("value", value);
  189199. Check_default.typeOf.number.greaterThanOrEquals("value.x", value.x, 0);
  189200. Check_default.typeOf.number.greaterThanOrEquals("value.y", value.y, 0);
  189201. this._minimumImageSize = value;
  189202. }
  189203. },
  189204. maximumImageSize: {
  189205. get: function() {
  189206. return this._maximumImageSize;
  189207. },
  189208. set: function(value) {
  189209. Check_default.typeOf.object("value", value);
  189210. Check_default.typeOf.number.greaterThanOrEquals("value.x", value.x, 0);
  189211. Check_default.typeOf.number.greaterThanOrEquals("value.y", value.y, 0);
  189212. this._maximumImageSize = value;
  189213. }
  189214. },
  189215. sizeInMeters: {
  189216. get: function() {
  189217. return this._sizeInMeters;
  189218. },
  189219. set: function(value) {
  189220. Check_default.typeOf.bool("value", value);
  189221. this._sizeInMeters = value;
  189222. }
  189223. },
  189224. lifetime: {
  189225. get: function() {
  189226. return this._lifetime;
  189227. },
  189228. set: function(value) {
  189229. Check_default.typeOf.number.greaterThanOrEquals("value", value, 0);
  189230. this._lifetime = value;
  189231. }
  189232. },
  189233. complete: {
  189234. get: function() {
  189235. return this._complete;
  189236. }
  189237. },
  189238. isComplete: {
  189239. get: function() {
  189240. return this._isComplete;
  189241. }
  189242. }
  189243. });
  189244. function updateParticlePool(system) {
  189245. const emissionRate = system._emissionRate;
  189246. const life = system._maximumParticleLife;
  189247. let burstAmount = 0;
  189248. const bursts = system._bursts;
  189249. if (defined_default(bursts)) {
  189250. const length3 = bursts.length;
  189251. for (let i2 = 0; i2 < length3; ++i2) {
  189252. burstAmount += bursts[i2].maximum;
  189253. }
  189254. }
  189255. const billboardCollection = system._billboardCollection;
  189256. const image = system.image;
  189257. const particleEstimate = Math.ceil(emissionRate * life + burstAmount);
  189258. const particles = system._particles;
  189259. const particlePool = system._particlePool;
  189260. const numToAdd = Math.max(
  189261. particleEstimate - particles.length - particlePool.length,
  189262. 0
  189263. );
  189264. for (let j = 0; j < numToAdd; ++j) {
  189265. const particle = new Particle_default();
  189266. particle._billboard = billboardCollection.add({
  189267. image
  189268. });
  189269. particlePool.push(particle);
  189270. }
  189271. system._particleEstimate = particleEstimate;
  189272. }
  189273. function getOrCreateParticle(system) {
  189274. let particle = system._particlePool.pop();
  189275. if (!defined_default(particle)) {
  189276. particle = new Particle_default();
  189277. }
  189278. return particle;
  189279. }
  189280. function addParticleToPool(system, particle) {
  189281. system._particlePool.push(particle);
  189282. }
  189283. function freeParticlePool(system) {
  189284. const particles = system._particles;
  189285. const particlePool = system._particlePool;
  189286. const billboardCollection = system._billboardCollection;
  189287. const numParticles = particles.length;
  189288. const numInPool = particlePool.length;
  189289. const estimate = system._particleEstimate;
  189290. const start = numInPool - Math.max(estimate - numParticles - numInPool, 0);
  189291. for (let i2 = start; i2 < numInPool; ++i2) {
  189292. const p2 = particlePool[i2];
  189293. billboardCollection.remove(p2._billboard);
  189294. }
  189295. particlePool.length = start;
  189296. }
  189297. function removeBillboard(particle) {
  189298. if (defined_default(particle._billboard)) {
  189299. particle._billboard.show = false;
  189300. }
  189301. }
  189302. function updateBillboard(system, particle) {
  189303. let billboard = particle._billboard;
  189304. if (!defined_default(billboard)) {
  189305. billboard = particle._billboard = system._billboardCollection.add({
  189306. image: particle.image
  189307. });
  189308. }
  189309. billboard.width = particle.imageSize.x;
  189310. billboard.height = particle.imageSize.y;
  189311. billboard.position = particle.position;
  189312. billboard.sizeInMeters = system.sizeInMeters;
  189313. billboard.show = true;
  189314. const r2 = Math_default.lerp(
  189315. particle.startColor.red,
  189316. particle.endColor.red,
  189317. particle.normalizedAge
  189318. );
  189319. const g = Math_default.lerp(
  189320. particle.startColor.green,
  189321. particle.endColor.green,
  189322. particle.normalizedAge
  189323. );
  189324. const b = Math_default.lerp(
  189325. particle.startColor.blue,
  189326. particle.endColor.blue,
  189327. particle.normalizedAge
  189328. );
  189329. const a4 = Math_default.lerp(
  189330. particle.startColor.alpha,
  189331. particle.endColor.alpha,
  189332. particle.normalizedAge
  189333. );
  189334. billboard.color = new Color_default(r2, g, b, a4);
  189335. billboard.scale = Math_default.lerp(
  189336. particle.startScale,
  189337. particle.endScale,
  189338. particle.normalizedAge
  189339. );
  189340. }
  189341. function addParticle(system, particle) {
  189342. particle.startColor = Color_default.clone(system._startColor, particle.startColor);
  189343. particle.endColor = Color_default.clone(system._endColor, particle.endColor);
  189344. particle.startScale = system._startScale;
  189345. particle.endScale = system._endScale;
  189346. particle.image = system.image;
  189347. particle.life = Math_default.randomBetween(
  189348. system._minimumParticleLife,
  189349. system._maximumParticleLife
  189350. );
  189351. particle.mass = Math_default.randomBetween(
  189352. system._minimumMass,
  189353. system._maximumMass
  189354. );
  189355. particle.imageSize.x = Math_default.randomBetween(
  189356. system._minimumImageSize.x,
  189357. system._maximumImageSize.x
  189358. );
  189359. particle.imageSize.y = Math_default.randomBetween(
  189360. system._minimumImageSize.y,
  189361. system._maximumImageSize.y
  189362. );
  189363. particle._normalizedAge = 0;
  189364. particle._age = 0;
  189365. const speed = Math_default.randomBetween(
  189366. system._minimumSpeed,
  189367. system._maximumSpeed
  189368. );
  189369. Cartesian3_default.multiplyByScalar(particle.velocity, speed, particle.velocity);
  189370. system._particles.push(particle);
  189371. }
  189372. function calculateNumberToEmit(system, dt) {
  189373. if (system._isComplete) {
  189374. return 0;
  189375. }
  189376. dt = Math_default.mod(dt, system._lifetime);
  189377. const v7 = dt * system._emissionRate;
  189378. let numToEmit = Math.floor(v7);
  189379. system._carryOver += v7 - numToEmit;
  189380. if (system._carryOver > 1) {
  189381. numToEmit++;
  189382. system._carryOver -= 1;
  189383. }
  189384. if (defined_default(system.bursts)) {
  189385. const length3 = system.bursts.length;
  189386. for (let i2 = 0; i2 < length3; i2++) {
  189387. const burst = system.bursts[i2];
  189388. const currentTime = system._currentTime;
  189389. if (defined_default(burst) && !burst._complete && currentTime > burst.time) {
  189390. numToEmit += Math_default.randomBetween(burst.minimum, burst.maximum);
  189391. burst._complete = true;
  189392. }
  189393. }
  189394. }
  189395. return numToEmit;
  189396. }
  189397. var rotatedVelocityScratch = new Cartesian3_default();
  189398. ParticleSystem.prototype.update = function(frameState) {
  189399. if (!this.show) {
  189400. return;
  189401. }
  189402. if (!defined_default(this._billboardCollection)) {
  189403. this._billboardCollection = new BillboardCollection_default();
  189404. }
  189405. if (this._updateParticlePool) {
  189406. updateParticlePool(this);
  189407. this._updateParticlePool = false;
  189408. }
  189409. let dt = 0;
  189410. if (this._previousTime) {
  189411. dt = JulianDate_default.secondsDifference(frameState.time, this._previousTime);
  189412. }
  189413. if (dt < 0) {
  189414. dt = 0;
  189415. }
  189416. const particles = this._particles;
  189417. const emitter = this._emitter;
  189418. const updateCallback = this.updateCallback;
  189419. let i2;
  189420. let particle;
  189421. let length3 = particles.length;
  189422. for (i2 = 0; i2 < length3; ++i2) {
  189423. particle = particles[i2];
  189424. if (!particle.update(dt, updateCallback)) {
  189425. removeBillboard(particle);
  189426. addParticleToPool(this, particle);
  189427. particles[i2] = particles[length3 - 1];
  189428. --i2;
  189429. --length3;
  189430. } else {
  189431. updateBillboard(this, particle);
  189432. }
  189433. }
  189434. particles.length = length3;
  189435. const numToEmit = calculateNumberToEmit(this, dt);
  189436. if (numToEmit > 0 && defined_default(emitter)) {
  189437. if (this._matrixDirty) {
  189438. this._combinedMatrix = Matrix4_default.multiply(
  189439. this.modelMatrix,
  189440. this.emitterModelMatrix,
  189441. this._combinedMatrix
  189442. );
  189443. this._matrixDirty = false;
  189444. }
  189445. const combinedMatrix = this._combinedMatrix;
  189446. for (i2 = 0; i2 < numToEmit; i2++) {
  189447. particle = getOrCreateParticle(this);
  189448. this._emitter.emit(particle);
  189449. Cartesian3_default.add(
  189450. particle.position,
  189451. particle.velocity,
  189452. rotatedVelocityScratch
  189453. );
  189454. Matrix4_default.multiplyByPoint(
  189455. combinedMatrix,
  189456. rotatedVelocityScratch,
  189457. rotatedVelocityScratch
  189458. );
  189459. particle.position = Matrix4_default.multiplyByPoint(
  189460. combinedMatrix,
  189461. particle.position,
  189462. particle.position
  189463. );
  189464. Cartesian3_default.subtract(
  189465. rotatedVelocityScratch,
  189466. particle.position,
  189467. particle.velocity
  189468. );
  189469. Cartesian3_default.normalize(particle.velocity, particle.velocity);
  189470. addParticle(this, particle);
  189471. updateBillboard(this, particle);
  189472. }
  189473. }
  189474. this._billboardCollection.update(frameState);
  189475. this._previousTime = JulianDate_default.clone(frameState.time, this._previousTime);
  189476. this._currentTime += dt;
  189477. if (this._lifetime !== Number.MAX_VALUE && this._currentTime > this._lifetime) {
  189478. if (this.loop) {
  189479. this._currentTime = Math_default.mod(this._currentTime, this._lifetime);
  189480. if (this.bursts) {
  189481. const burstLength = this.bursts.length;
  189482. for (i2 = 0; i2 < burstLength; i2++) {
  189483. this.bursts[i2]._complete = false;
  189484. }
  189485. }
  189486. } else {
  189487. this._isComplete = true;
  189488. this._complete.raiseEvent(this);
  189489. }
  189490. }
  189491. if (frameState.frameNumber % 120 === 0) {
  189492. freeParticlePool(this);
  189493. }
  189494. };
  189495. ParticleSystem.prototype.isDestroyed = function() {
  189496. return false;
  189497. };
  189498. ParticleSystem.prototype.destroy = function() {
  189499. this._billboardCollection = this._billboardCollection && this._billboardCollection.destroy();
  189500. return destroyObject_default(this);
  189501. };
  189502. var ParticleSystem_default = ParticleSystem;
  189503. // node_modules/cesium/Source/Scene/PerformanceDisplay.js
  189504. function PerformanceDisplay(options) {
  189505. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  189506. const container = getElement_default(options.container);
  189507. if (!defined_default(container)) {
  189508. throw new DeveloperError_default("container is required");
  189509. }
  189510. this._container = container;
  189511. const display = document.createElement("div");
  189512. display.className = "cesium-performanceDisplay";
  189513. const fpsElement = document.createElement("div");
  189514. fpsElement.className = "cesium-performanceDisplay-fps";
  189515. this._fpsText = document.createTextNode("");
  189516. fpsElement.appendChild(this._fpsText);
  189517. const msElement = document.createElement("div");
  189518. msElement.className = "cesium-performanceDisplay-ms";
  189519. this._msText = document.createTextNode("");
  189520. msElement.appendChild(this._msText);
  189521. display.appendChild(msElement);
  189522. display.appendChild(fpsElement);
  189523. this._container.appendChild(display);
  189524. this._lastFpsSampleTime = getTimestamp_default();
  189525. this._lastMsSampleTime = getTimestamp_default();
  189526. this._fpsFrameCount = 0;
  189527. this._msFrameCount = 0;
  189528. this._throttled = false;
  189529. const throttledElement = document.createElement("div");
  189530. throttledElement.className = "cesium-performanceDisplay-throttled";
  189531. this._throttledText = document.createTextNode("");
  189532. throttledElement.appendChild(this._throttledText);
  189533. display.appendChild(throttledElement);
  189534. }
  189535. Object.defineProperties(PerformanceDisplay.prototype, {
  189536. throttled: {
  189537. get: function() {
  189538. return this._throttled;
  189539. },
  189540. set: function(value) {
  189541. if (this._throttled === value) {
  189542. return;
  189543. }
  189544. if (value) {
  189545. this._throttledText.nodeValue = "(throttled)";
  189546. } else {
  189547. this._throttledText.nodeValue = "";
  189548. }
  189549. this._throttled = value;
  189550. }
  189551. }
  189552. });
  189553. PerformanceDisplay.prototype.update = function(renderedThisFrame) {
  189554. const time = getTimestamp_default();
  189555. const updateDisplay = defaultValue_default(renderedThisFrame, true);
  189556. this._fpsFrameCount++;
  189557. const fpsElapsedTime = time - this._lastFpsSampleTime;
  189558. if (fpsElapsedTime > 1e3) {
  189559. let fps = "N/A";
  189560. if (updateDisplay) {
  189561. fps = this._fpsFrameCount * 1e3 / fpsElapsedTime | 0;
  189562. }
  189563. this._fpsText.nodeValue = `${fps} FPS`;
  189564. this._lastFpsSampleTime = time;
  189565. this._fpsFrameCount = 0;
  189566. }
  189567. this._msFrameCount++;
  189568. const msElapsedTime = time - this._lastMsSampleTime;
  189569. if (msElapsedTime > 200) {
  189570. let ms = "N/A";
  189571. if (updateDisplay) {
  189572. ms = (msElapsedTime / this._msFrameCount).toFixed(2);
  189573. }
  189574. this._msText.nodeValue = `${ms} MS`;
  189575. this._lastMsSampleTime = time;
  189576. this._msFrameCount = 0;
  189577. }
  189578. };
  189579. PerformanceDisplay.prototype.destroy = function() {
  189580. return destroyObject_default(this);
  189581. };
  189582. var PerformanceDisplay_default = PerformanceDisplay;
  189583. // node_modules/cesium/Source/Scene/PickDepth.js
  189584. function PickDepth() {
  189585. this._framebuffer = new FramebufferManager_default();
  189586. this._textureToCopy = void 0;
  189587. this._copyDepthCommand = void 0;
  189588. }
  189589. Object.defineProperties(PickDepth.prototype, {
  189590. framebuffer: {
  189591. get: function() {
  189592. return this._framebuffer.framebuffer;
  189593. }
  189594. }
  189595. });
  189596. function updateFramebuffers2(pickDepth, context, depthTexture) {
  189597. const width = depthTexture.width;
  189598. const height = depthTexture.height;
  189599. pickDepth._framebuffer.update(context, width, height);
  189600. }
  189601. function updateCopyCommands2(pickDepth, context, depthTexture) {
  189602. if (!defined_default(pickDepth._copyDepthCommand)) {
  189603. const fs = "uniform highp sampler2D u_texture;\nvarying vec2 v_textureCoordinates;\nvoid main()\n{\n gl_FragColor = czm_packDepth(texture2D(u_texture, v_textureCoordinates).r);\n}\n";
  189604. pickDepth._copyDepthCommand = context.createViewportQuadCommand(fs, {
  189605. renderState: RenderState_default.fromCache(),
  189606. uniformMap: {
  189607. u_texture: function() {
  189608. return pickDepth._textureToCopy;
  189609. }
  189610. },
  189611. owner: pickDepth
  189612. });
  189613. }
  189614. pickDepth._textureToCopy = depthTexture;
  189615. pickDepth._copyDepthCommand.framebuffer = pickDepth.framebuffer;
  189616. }
  189617. PickDepth.prototype.update = function(context, depthTexture) {
  189618. updateFramebuffers2(this, context, depthTexture);
  189619. updateCopyCommands2(this, context, depthTexture);
  189620. };
  189621. var scratchPackedDepth = new Cartesian4_default();
  189622. var packedDepthScale = new Cartesian4_default(
  189623. 1,
  189624. 1 / 255,
  189625. 1 / 65025,
  189626. 1 / 16581375
  189627. );
  189628. PickDepth.prototype.getDepth = function(context, x, y) {
  189629. if (!defined_default(this.framebuffer)) {
  189630. return void 0;
  189631. }
  189632. const pixels = context.readPixels({
  189633. x,
  189634. y,
  189635. width: 1,
  189636. height: 1,
  189637. framebuffer: this.framebuffer
  189638. });
  189639. const packedDepth = Cartesian4_default.unpack(pixels, 0, scratchPackedDepth);
  189640. Cartesian4_default.divideByScalar(packedDepth, 255, packedDepth);
  189641. return Cartesian4_default.dot(packedDepth, packedDepthScale);
  189642. };
  189643. PickDepth.prototype.executeCopyDepth = function(context, passState) {
  189644. this._copyDepthCommand.execute(context, passState);
  189645. };
  189646. PickDepth.prototype.isDestroyed = function() {
  189647. return false;
  189648. };
  189649. PickDepth.prototype.destroy = function() {
  189650. this._framebuffer.destroy();
  189651. if (defined_default(this._copyDepthCommand)) {
  189652. this._copyDepthCommand.shaderProgram = defined_default(this._copyDepthCommand.shaderProgram) && this._copyDepthCommand.shaderProgram.destroy();
  189653. }
  189654. return destroyObject_default(this);
  189655. };
  189656. var PickDepth_default = PickDepth;
  189657. // node_modules/cesium/Source/Scene/PickDepthFramebuffer.js
  189658. function PickDepthFramebuffer() {
  189659. this._framebuffer = new FramebufferManager_default({
  189660. color: false,
  189661. depthStencil: true,
  189662. supportsDepthTexture: true
  189663. });
  189664. this._passState = void 0;
  189665. }
  189666. Object.defineProperties(PickDepthFramebuffer.prototype, {
  189667. framebuffer: {
  189668. get: function() {
  189669. return this._framebuffer.framebuffer;
  189670. }
  189671. }
  189672. });
  189673. function destroyResources3(pickDepth) {
  189674. pickDepth._framebuffer.destroy();
  189675. }
  189676. function createResources6(pickDepth, context) {
  189677. const width = context.drawingBufferWidth;
  189678. const height = context.drawingBufferHeight;
  189679. pickDepth._framebuffer.update(context, width, height);
  189680. const passState = new PassState_default(context);
  189681. passState.blendingEnabled = false;
  189682. passState.scissorTest = {
  189683. enabled: true,
  189684. rectangle: new BoundingRectangle_default()
  189685. };
  189686. passState.viewport = new BoundingRectangle_default();
  189687. pickDepth._passState = passState;
  189688. }
  189689. PickDepthFramebuffer.prototype.update = function(context, drawingBufferPosition, viewport) {
  189690. const width = viewport.width;
  189691. const height = viewport.height;
  189692. if (this._framebuffer.isDirty(width, height)) {
  189693. createResources6(this, context);
  189694. }
  189695. const framebuffer = this.framebuffer;
  189696. const passState = this._passState;
  189697. passState.framebuffer = framebuffer;
  189698. passState.viewport.width = width;
  189699. passState.viewport.height = height;
  189700. passState.scissorTest.rectangle.x = drawingBufferPosition.x;
  189701. passState.scissorTest.rectangle.y = height - drawingBufferPosition.y;
  189702. passState.scissorTest.rectangle.width = 1;
  189703. passState.scissorTest.rectangle.height = 1;
  189704. return passState;
  189705. };
  189706. PickDepthFramebuffer.prototype.isDestroyed = function() {
  189707. return false;
  189708. };
  189709. PickDepthFramebuffer.prototype.destroy = function() {
  189710. destroyResources3(this);
  189711. return destroyObject_default(this);
  189712. };
  189713. var PickDepthFramebuffer_default = PickDepthFramebuffer;
  189714. // node_modules/cesium/Source/Scene/PickFramebuffer.js
  189715. function PickFramebuffer(context) {
  189716. const passState = new PassState_default(context);
  189717. passState.blendingEnabled = false;
  189718. passState.scissorTest = {
  189719. enabled: true,
  189720. rectangle: new BoundingRectangle_default()
  189721. };
  189722. passState.viewport = new BoundingRectangle_default();
  189723. this._context = context;
  189724. this._fb = new FramebufferManager_default({
  189725. depthStencil: true
  189726. });
  189727. this._passState = passState;
  189728. this._width = 0;
  189729. this._height = 0;
  189730. }
  189731. PickFramebuffer.prototype.begin = function(screenSpaceRectangle, viewport) {
  189732. const context = this._context;
  189733. const width = viewport.width;
  189734. const height = viewport.height;
  189735. BoundingRectangle_default.clone(
  189736. screenSpaceRectangle,
  189737. this._passState.scissorTest.rectangle
  189738. );
  189739. this._width = width;
  189740. this._height = height;
  189741. this._fb.update(context, width, height);
  189742. this._passState.framebuffer = this._fb.framebuffer;
  189743. this._passState.viewport.width = width;
  189744. this._passState.viewport.height = height;
  189745. return this._passState;
  189746. };
  189747. var colorScratch8 = new Color_default();
  189748. PickFramebuffer.prototype.end = function(screenSpaceRectangle) {
  189749. const width = defaultValue_default(screenSpaceRectangle.width, 1);
  189750. const height = defaultValue_default(screenSpaceRectangle.height, 1);
  189751. const context = this._context;
  189752. const pixels = context.readPixels({
  189753. x: screenSpaceRectangle.x,
  189754. y: screenSpaceRectangle.y,
  189755. width,
  189756. height,
  189757. framebuffer: this._fb.framebuffer
  189758. });
  189759. const max3 = Math.max(width, height);
  189760. const length3 = max3 * max3;
  189761. const halfWidth = Math.floor(width * 0.5);
  189762. const halfHeight = Math.floor(height * 0.5);
  189763. let x = 0;
  189764. let y = 0;
  189765. let dx = 0;
  189766. let dy = -1;
  189767. for (let i2 = 0; i2 < length3; ++i2) {
  189768. if (-halfWidth <= x && x <= halfWidth && -halfHeight <= y && y <= halfHeight) {
  189769. const index2 = 4 * ((halfHeight - y) * width + x + halfWidth);
  189770. colorScratch8.red = Color_default.byteToFloat(pixels[index2]);
  189771. colorScratch8.green = Color_default.byteToFloat(pixels[index2 + 1]);
  189772. colorScratch8.blue = Color_default.byteToFloat(pixels[index2 + 2]);
  189773. colorScratch8.alpha = Color_default.byteToFloat(pixels[index2 + 3]);
  189774. const object2 = context.getObjectByPickColor(colorScratch8);
  189775. if (defined_default(object2)) {
  189776. return object2;
  189777. }
  189778. }
  189779. if (x === y || x < 0 && -x === y || x > 0 && x === 1 - y) {
  189780. const temp = dx;
  189781. dx = -dy;
  189782. dy = temp;
  189783. }
  189784. x += dx;
  189785. y += dy;
  189786. }
  189787. return void 0;
  189788. };
  189789. PickFramebuffer.prototype.isDestroyed = function() {
  189790. return false;
  189791. };
  189792. PickFramebuffer.prototype.destroy = function() {
  189793. this._fb.destroy();
  189794. return destroyObject_default(this);
  189795. };
  189796. var PickFramebuffer_default = PickFramebuffer;
  189797. // node_modules/cesium/Source/Scene/SceneFramebuffer.js
  189798. function SceneFramebuffer() {
  189799. this._numSamples = 1;
  189800. this._colorFramebuffer = new FramebufferManager_default({
  189801. depthStencil: true,
  189802. supportsDepthTexture: true
  189803. });
  189804. this._idFramebuffer = new FramebufferManager_default({
  189805. depthStencil: true,
  189806. supportsDepthTexture: true
  189807. });
  189808. this._idClearColor = new Color_default(0, 0, 0, 0);
  189809. this._clearCommand = new ClearCommand_default({
  189810. color: new Color_default(0, 0, 0, 0),
  189811. depth: 1,
  189812. owner: this
  189813. });
  189814. }
  189815. function destroyResources4(post) {
  189816. post._colorFramebuffer.destroy();
  189817. post._idFramebuffer.destroy();
  189818. }
  189819. Object.defineProperties(SceneFramebuffer.prototype, {
  189820. framebuffer: {
  189821. get: function() {
  189822. return this._colorFramebuffer.framebuffer;
  189823. }
  189824. },
  189825. idFramebuffer: {
  189826. get: function() {
  189827. return this._idFramebuffer.framebuffer;
  189828. }
  189829. },
  189830. depthStencilTexture: {
  189831. get: function() {
  189832. return this._colorFramebuffer.getDepthStencilTexture();
  189833. }
  189834. }
  189835. });
  189836. SceneFramebuffer.prototype.update = function(context, viewport, hdr, numSamples) {
  189837. const width = viewport.width;
  189838. const height = viewport.height;
  189839. const pixelDatatype = hdr ? context.halfFloatingPointTexture ? PixelDatatype_default.HALF_FLOAT : PixelDatatype_default.FLOAT : PixelDatatype_default.UNSIGNED_BYTE;
  189840. this._numSamples = numSamples;
  189841. this._colorFramebuffer.update(
  189842. context,
  189843. width,
  189844. height,
  189845. numSamples,
  189846. pixelDatatype
  189847. );
  189848. this._idFramebuffer.update(context, width, height);
  189849. };
  189850. SceneFramebuffer.prototype.clear = function(context, passState, clearColor) {
  189851. Color_default.clone(clearColor, this._clearCommand.color);
  189852. Color_default.clone(this._idClearColor, this._clearCommand.color);
  189853. this._colorFramebuffer.clear(context, this._clearCommand, passState);
  189854. this._idFramebuffer.clear(context, this._clearCommand, passState);
  189855. };
  189856. SceneFramebuffer.prototype.getFramebuffer = function() {
  189857. return this._colorFramebuffer.framebuffer;
  189858. };
  189859. SceneFramebuffer.prototype.getIdFramebuffer = function() {
  189860. return this._idFramebuffer.framebuffer;
  189861. };
  189862. SceneFramebuffer.prototype.prepareColorTextures = function(context) {
  189863. if (this._numSamples > 1) {
  189864. this._colorFramebuffer.prepareTextures(context);
  189865. }
  189866. };
  189867. SceneFramebuffer.prototype.isDestroyed = function() {
  189868. return false;
  189869. };
  189870. SceneFramebuffer.prototype.destroy = function() {
  189871. destroyResources4(this);
  189872. return destroyObject_default(this);
  189873. };
  189874. var SceneFramebuffer_default = SceneFramebuffer;
  189875. // node_modules/cesium/Source/Scene/ShadowMapShader.js
  189876. function ShadowMapShader() {
  189877. }
  189878. ShadowMapShader.getShadowCastShaderKeyword = function(isPointLight, isTerrain, usesDepthTexture, isOpaque) {
  189879. return `castShadow ${isPointLight} ${isTerrain} ${usesDepthTexture} ${isOpaque}`;
  189880. };
  189881. ShadowMapShader.createShadowCastVertexShader = function(vs, isPointLight, isTerrain) {
  189882. const defines = vs.defines.slice(0);
  189883. const sources = vs.sources.slice(0);
  189884. defines.push("SHADOW_MAP");
  189885. if (isTerrain) {
  189886. defines.push("GENERATE_POSITION");
  189887. }
  189888. const positionVaryingName = ShaderSource_default.findPositionVarying(vs);
  189889. const hasPositionVarying = defined_default(positionVaryingName);
  189890. if (isPointLight && !hasPositionVarying) {
  189891. const length3 = sources.length;
  189892. for (let j = 0; j < length3; ++j) {
  189893. sources[j] = ShaderSource_default.replaceMain(sources[j], "czm_shadow_cast_main");
  189894. }
  189895. const shadowVS = "varying vec3 v_positionEC; \nvoid main() \n{ \n czm_shadow_cast_main(); \n v_positionEC = (czm_inverseProjection * gl_Position).xyz; \n}";
  189896. sources.push(shadowVS);
  189897. }
  189898. return new ShaderSource_default({
  189899. defines,
  189900. sources
  189901. });
  189902. };
  189903. ShadowMapShader.createShadowCastFragmentShader = function(fs, isPointLight, usesDepthTexture, opaque) {
  189904. const defines = fs.defines.slice(0);
  189905. const sources = fs.sources.slice(0);
  189906. defines.push("SHADOW_MAP");
  189907. let positionVaryingName = ShaderSource_default.findPositionVarying(fs);
  189908. const hasPositionVarying = defined_default(positionVaryingName);
  189909. if (!hasPositionVarying) {
  189910. positionVaryingName = "v_positionEC";
  189911. }
  189912. const length3 = sources.length;
  189913. for (let i2 = 0; i2 < length3; ++i2) {
  189914. sources[i2] = ShaderSource_default.replaceMain(sources[i2], "czm_shadow_cast_main");
  189915. }
  189916. let fsSource = "";
  189917. if (isPointLight) {
  189918. if (!hasPositionVarying) {
  189919. fsSource += "varying vec3 v_positionEC; \n";
  189920. }
  189921. fsSource += "uniform vec4 shadowMap_lightPositionEC; \n";
  189922. }
  189923. if (opaque) {
  189924. fsSource += "void main() \n{ \n";
  189925. } else {
  189926. fsSource += "void main() \n{ \n czm_shadow_cast_main(); \n if (gl_FragColor.a == 0.0) \n { \n discard; \n } \n";
  189927. }
  189928. if (isPointLight) {
  189929. fsSource += ` float distance = length(${positionVaryingName});
  189930. if (distance >= shadowMap_lightPositionEC.w)
  189931. {
  189932. discard;
  189933. }
  189934. distance /= shadowMap_lightPositionEC.w; // radius
  189935. gl_FragColor = czm_packDepth(distance);
  189936. `;
  189937. } else if (usesDepthTexture) {
  189938. fsSource += " gl_FragColor = vec4(1.0); \n";
  189939. } else {
  189940. fsSource += " gl_FragColor = czm_packDepth(gl_FragCoord.z); \n";
  189941. }
  189942. fsSource += "} \n";
  189943. sources.push(fsSource);
  189944. return new ShaderSource_default({
  189945. defines,
  189946. sources
  189947. });
  189948. };
  189949. ShadowMapShader.getShadowReceiveShaderKeyword = function(shadowMap, castShadows, isTerrain, hasTerrainNormal) {
  189950. const usesDepthTexture = shadowMap._usesDepthTexture;
  189951. const polygonOffsetSupported = shadowMap._polygonOffsetSupported;
  189952. const isPointLight = shadowMap._isPointLight;
  189953. const isSpotLight = shadowMap._isSpotLight;
  189954. const hasCascades = shadowMap._numberOfCascades > 1;
  189955. const debugCascadeColors = shadowMap.debugCascadeColors;
  189956. const softShadows = shadowMap.softShadows;
  189957. return `receiveShadow ${usesDepthTexture}${polygonOffsetSupported}${isPointLight}${isSpotLight}${hasCascades}${debugCascadeColors}${softShadows}${castShadows}${isTerrain}${hasTerrainNormal}`;
  189958. };
  189959. ShadowMapShader.createShadowReceiveVertexShader = function(vs, isTerrain, hasTerrainNormal) {
  189960. const defines = vs.defines.slice(0);
  189961. const sources = vs.sources.slice(0);
  189962. defines.push("SHADOW_MAP");
  189963. if (isTerrain) {
  189964. if (hasTerrainNormal) {
  189965. defines.push("GENERATE_POSITION_AND_NORMAL");
  189966. } else {
  189967. defines.push("GENERATE_POSITION");
  189968. }
  189969. }
  189970. return new ShaderSource_default({
  189971. defines,
  189972. sources
  189973. });
  189974. };
  189975. ShadowMapShader.createShadowReceiveFragmentShader = function(fs, shadowMap, castShadows, isTerrain, hasTerrainNormal) {
  189976. const normalVaryingName = ShaderSource_default.findNormalVarying(fs);
  189977. const hasNormalVarying = !isTerrain && defined_default(normalVaryingName) || isTerrain && hasTerrainNormal;
  189978. const positionVaryingName = ShaderSource_default.findPositionVarying(fs);
  189979. const hasPositionVarying = defined_default(positionVaryingName);
  189980. const usesDepthTexture = shadowMap._usesDepthTexture;
  189981. const polygonOffsetSupported = shadowMap._polygonOffsetSupported;
  189982. const isPointLight = shadowMap._isPointLight;
  189983. const isSpotLight = shadowMap._isSpotLight;
  189984. const hasCascades = shadowMap._numberOfCascades > 1;
  189985. const debugCascadeColors = shadowMap.debugCascadeColors;
  189986. const softShadows = shadowMap.softShadows;
  189987. const bias = isPointLight ? shadowMap._pointBias : isTerrain ? shadowMap._terrainBias : shadowMap._primitiveBias;
  189988. const defines = fs.defines.slice(0);
  189989. const sources = fs.sources.slice(0);
  189990. const length3 = sources.length;
  189991. for (let i2 = 0; i2 < length3; ++i2) {
  189992. sources[i2] = ShaderSource_default.replaceMain(
  189993. sources[i2],
  189994. "czm_shadow_receive_main"
  189995. );
  189996. }
  189997. if (isPointLight) {
  189998. defines.push("USE_CUBE_MAP_SHADOW");
  189999. } else if (usesDepthTexture) {
  190000. defines.push("USE_SHADOW_DEPTH_TEXTURE");
  190001. }
  190002. if (softShadows && !isPointLight) {
  190003. defines.push("USE_SOFT_SHADOWS");
  190004. }
  190005. if (hasCascades && castShadows && isTerrain) {
  190006. if (hasNormalVarying) {
  190007. defines.push("ENABLE_VERTEX_LIGHTING");
  190008. } else {
  190009. defines.push("ENABLE_DAYNIGHT_SHADING");
  190010. }
  190011. }
  190012. if (castShadows && bias.normalShading && hasNormalVarying) {
  190013. defines.push("USE_NORMAL_SHADING");
  190014. if (bias.normalShadingSmooth > 0) {
  190015. defines.push("USE_NORMAL_SHADING_SMOOTH");
  190016. }
  190017. }
  190018. let fsSource = "";
  190019. if (isPointLight) {
  190020. fsSource += "uniform samplerCube shadowMap_textureCube; \n";
  190021. } else {
  190022. fsSource += "uniform sampler2D shadowMap_texture; \n";
  190023. }
  190024. let returnPositionEC;
  190025. if (hasPositionVarying) {
  190026. returnPositionEC = ` return vec4(${positionVaryingName}, 1.0);
  190027. `;
  190028. } else {
  190029. returnPositionEC = "#ifndef LOG_DEPTH \n return czm_windowToEyeCoordinates(gl_FragCoord); \n#else \n return vec4(v_logPositionEC, 1.0); \n#endif \n";
  190030. }
  190031. fsSource += `${"uniform mat4 shadowMap_matrix; \nuniform vec3 shadowMap_lightDirectionEC; \nuniform vec4 shadowMap_lightPositionEC; \nuniform vec4 shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness; \nuniform vec4 shadowMap_texelSizeDepthBiasAndNormalShadingSmooth; \n#ifdef LOG_DEPTH \nvarying vec3 v_logPositionEC; \n#endif \nvec4 getPositionEC() \n{ \n"}${returnPositionEC}}
  190032. vec3 getNormalEC()
  190033. {
  190034. ${hasNormalVarying ? ` return normalize(${normalVaryingName});
  190035. ` : " return vec3(1.0); \n"}}
  190036. void applyNormalOffset(inout vec4 positionEC, vec3 normalEC, float nDotL)
  190037. {
  190038. ${bias.normalOffset && hasNormalVarying ? " float normalOffset = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.x; \n float normalOffsetScale = 1.0 - nDotL; \n vec3 offset = normalOffset * normalOffsetScale * normalEC; \n positionEC.xyz += offset; \n" : ""}}
  190039. `;
  190040. fsSource += "void main() \n{ \n czm_shadow_receive_main(); \n vec4 positionEC = getPositionEC(); \n vec3 normalEC = getNormalEC(); \n float depth = -positionEC.z; \n";
  190041. fsSource += " czm_shadowParameters shadowParameters; \n shadowParameters.texelStepSize = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.xy; \n shadowParameters.depthBias = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.z; \n shadowParameters.normalShadingSmooth = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.w; \n shadowParameters.darkness = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.w; \n";
  190042. if (isTerrain) {
  190043. fsSource += " shadowParameters.depthBias *= max(depth * 0.01, 1.0); \n";
  190044. } else if (!polygonOffsetSupported) {
  190045. fsSource += " shadowParameters.depthBias *= mix(1.0, 100.0, depth * 0.0015); \n";
  190046. }
  190047. if (isPointLight) {
  190048. fsSource += " vec3 directionEC = positionEC.xyz - shadowMap_lightPositionEC.xyz; \n float distance = length(directionEC); \n directionEC = normalize(directionEC); \n float radius = shadowMap_lightPositionEC.w; \n // Stop early if the fragment is beyond the point light radius \n if (distance > radius) \n { \n return; \n } \n vec3 directionWC = czm_inverseViewRotation * directionEC; \n shadowParameters.depth = distance / radius; \n shadowParameters.nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0); \n shadowParameters.texCoords = directionWC; \n float visibility = czm_shadowVisibility(shadowMap_textureCube, shadowParameters); \n";
  190049. } else if (isSpotLight) {
  190050. fsSource += " vec3 directionEC = normalize(positionEC.xyz - shadowMap_lightPositionEC.xyz); \n float nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0); \n applyNormalOffset(positionEC, normalEC, nDotL); \n vec4 shadowPosition = shadowMap_matrix * positionEC; \n // Spot light uses a perspective projection, so perform the perspective divide \n shadowPosition /= shadowPosition.w; \n // Stop early if the fragment is not in the shadow bounds \n if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0)))) \n { \n return; \n } \n shadowParameters.texCoords = shadowPosition.xy; \n shadowParameters.depth = shadowPosition.z; \n shadowParameters.nDotL = nDotL; \n float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters); \n";
  190051. } else if (hasCascades) {
  190052. fsSource += `${" float maxDepth = shadowMap_cascadeSplits[1].w; \n // Stop early if the eye depth exceeds the last cascade \n if (depth > maxDepth) \n { \n return; \n } \n // Get the cascade based on the eye-space depth \n vec4 weights = czm_cascadeWeights(depth); \n // Apply normal offset \n float nDotL = clamp(dot(normalEC, shadowMap_lightDirectionEC), 0.0, 1.0); \n applyNormalOffset(positionEC, normalEC, nDotL); \n // Transform position into the cascade \n vec4 shadowPosition = czm_cascadeMatrix(weights) * positionEC; \n // Get visibility \n shadowParameters.texCoords = shadowPosition.xy; \n shadowParameters.depth = shadowPosition.z; \n shadowParameters.nDotL = nDotL; \n float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters); \n // Fade out shadows that are far away \n float shadowMapMaximumDistance = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.z; \n float fade = max((depth - shadowMapMaximumDistance * 0.8) / (shadowMapMaximumDistance * 0.2), 0.0); \n visibility = mix(visibility, 1.0, fade); \n"}${debugCascadeColors ? " // Draw cascade colors for debugging \n gl_FragColor *= czm_cascadeColor(weights); \n" : ""}`;
  190053. } else {
  190054. fsSource += " float nDotL = clamp(dot(normalEC, shadowMap_lightDirectionEC), 0.0, 1.0); \n applyNormalOffset(positionEC, normalEC, nDotL); \n vec4 shadowPosition = shadowMap_matrix * positionEC; \n // Stop early if the fragment is not in the shadow bounds \n if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0)))) \n { \n return; \n } \n shadowParameters.texCoords = shadowPosition.xy; \n shadowParameters.depth = shadowPosition.z; \n shadowParameters.nDotL = nDotL; \n float visibility = czm_shadowVisibility(shadowMap_texture, shadowParameters); \n";
  190055. }
  190056. fsSource += " gl_FragColor.rgb *= visibility; \n} \n";
  190057. sources.push(fsSource);
  190058. return new ShaderSource_default({
  190059. defines,
  190060. sources
  190061. });
  190062. };
  190063. var ShadowMapShader_default = ShadowMapShader;
  190064. // node_modules/cesium/Source/Scene/ShadowMap.js
  190065. function ShadowMap(options) {
  190066. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  190067. const context = options.context;
  190068. if (!defined_default(context)) {
  190069. throw new DeveloperError_default("context is required.");
  190070. }
  190071. if (!defined_default(options.lightCamera)) {
  190072. throw new DeveloperError_default("lightCamera is required.");
  190073. }
  190074. if (defined_default(options.numberOfCascades) && options.numberOfCascades !== 1 && options.numberOfCascades !== 4) {
  190075. throw new DeveloperError_default("Only one or four cascades are supported.");
  190076. }
  190077. this._enabled = defaultValue_default(options.enabled, true);
  190078. this._softShadows = defaultValue_default(options.softShadows, false);
  190079. this._normalOffset = defaultValue_default(options.normalOffset, true);
  190080. this.dirty = true;
  190081. this.fromLightSource = defaultValue_default(options.fromLightSource, true);
  190082. this.darkness = defaultValue_default(options.darkness, 0.3);
  190083. this._darkness = this.darkness;
  190084. this.fadingEnabled = defaultValue_default(options.fadingEnabled, true);
  190085. this.maximumDistance = defaultValue_default(options.maximumDistance, 5e3);
  190086. this._outOfView = false;
  190087. this._outOfViewPrevious = false;
  190088. this._needsUpdate = true;
  190089. let polygonOffsetSupported = true;
  190090. if (FeatureDetection_default.isInternetExplorer() || FeatureDetection_default.isEdge() || (FeatureDetection_default.isChrome() || FeatureDetection_default.isFirefox()) && FeatureDetection_default.isWindows() && !context.depthTexture) {
  190091. polygonOffsetSupported = false;
  190092. }
  190093. this._polygonOffsetSupported = polygonOffsetSupported;
  190094. this._terrainBias = {
  190095. polygonOffset: polygonOffsetSupported,
  190096. polygonOffsetFactor: 1.1,
  190097. polygonOffsetUnits: 4,
  190098. normalOffset: this._normalOffset,
  190099. normalOffsetScale: 0.5,
  190100. normalShading: true,
  190101. normalShadingSmooth: 0.3,
  190102. depthBias: 1e-4
  190103. };
  190104. this._primitiveBias = {
  190105. polygonOffset: polygonOffsetSupported,
  190106. polygonOffsetFactor: 1.1,
  190107. polygonOffsetUnits: 4,
  190108. normalOffset: this._normalOffset,
  190109. normalOffsetScale: 0.1,
  190110. normalShading: true,
  190111. normalShadingSmooth: 0.05,
  190112. depthBias: 2e-5
  190113. };
  190114. this._pointBias = {
  190115. polygonOffset: false,
  190116. polygonOffsetFactor: 1.1,
  190117. polygonOffsetUnits: 4,
  190118. normalOffset: this._normalOffset,
  190119. normalOffsetScale: 0,
  190120. normalShading: true,
  190121. normalShadingSmooth: 0.1,
  190122. depthBias: 5e-4
  190123. };
  190124. this._depthAttachment = void 0;
  190125. this._colorAttachment = void 0;
  190126. this._shadowMapMatrix = new Matrix4_default();
  190127. this._shadowMapTexture = void 0;
  190128. this._lightDirectionEC = new Cartesian3_default();
  190129. this._lightPositionEC = new Cartesian4_default();
  190130. this._distance = 0;
  190131. this._lightCamera = options.lightCamera;
  190132. this._shadowMapCamera = new ShadowMapCamera();
  190133. this._shadowMapCullingVolume = void 0;
  190134. this._sceneCamera = void 0;
  190135. this._boundingSphere = new BoundingSphere_default();
  190136. this._isPointLight = defaultValue_default(options.isPointLight, false);
  190137. this._pointLightRadius = defaultValue_default(options.pointLightRadius, 100);
  190138. this._cascadesEnabled = this._isPointLight ? false : defaultValue_default(options.cascadesEnabled, true);
  190139. this._numberOfCascades = !this._cascadesEnabled ? 0 : defaultValue_default(options.numberOfCascades, 4);
  190140. this._fitNearFar = true;
  190141. this._maximumCascadeDistances = [25, 150, 700, Number.MAX_VALUE];
  190142. this._textureSize = new Cartesian2_default();
  190143. this._isSpotLight = false;
  190144. if (this._cascadesEnabled) {
  190145. this._shadowMapCamera.frustum = new OrthographicOffCenterFrustum_default();
  190146. } else if (defined_default(this._lightCamera.frustum.fov)) {
  190147. this._isSpotLight = true;
  190148. }
  190149. this._cascadeSplits = [new Cartesian4_default(), new Cartesian4_default()];
  190150. this._cascadeMatrices = [
  190151. new Matrix4_default(),
  190152. new Matrix4_default(),
  190153. new Matrix4_default(),
  190154. new Matrix4_default()
  190155. ];
  190156. this._cascadeDistances = new Cartesian4_default();
  190157. let numberOfPasses;
  190158. if (this._isPointLight) {
  190159. numberOfPasses = 6;
  190160. } else if (!this._cascadesEnabled) {
  190161. numberOfPasses = 1;
  190162. } else {
  190163. numberOfPasses = this._numberOfCascades;
  190164. }
  190165. this._passes = new Array(numberOfPasses);
  190166. for (let i2 = 0; i2 < numberOfPasses; ++i2) {
  190167. this._passes[i2] = new ShadowPass(context);
  190168. }
  190169. this.debugShow = false;
  190170. this.debugFreezeFrame = false;
  190171. this._debugFreezeFrame = false;
  190172. this._debugCascadeColors = false;
  190173. this._debugLightFrustum = void 0;
  190174. this._debugCameraFrustum = void 0;
  190175. this._debugCascadeFrustums = new Array(this._numberOfCascades);
  190176. this._debugShadowViewCommand = void 0;
  190177. this._usesDepthTexture = context.depthTexture;
  190178. if (this._isPointLight) {
  190179. this._usesDepthTexture = false;
  190180. }
  190181. this._primitiveRenderState = void 0;
  190182. this._terrainRenderState = void 0;
  190183. this._pointRenderState = void 0;
  190184. createRenderStates7(this);
  190185. this._clearCommand = new ClearCommand_default({
  190186. depth: 1,
  190187. color: new Color_default()
  190188. });
  190189. this._clearPassState = new PassState_default(context);
  190190. this._size = defaultValue_default(options.size, 2048);
  190191. this.size = this._size;
  190192. }
  190193. ShadowMap.MAXIMUM_DISTANCE = 2e4;
  190194. function ShadowPass(context) {
  190195. this.camera = new ShadowMapCamera();
  190196. this.passState = new PassState_default(context);
  190197. this.framebuffer = void 0;
  190198. this.textureOffsets = void 0;
  190199. this.commandList = [];
  190200. this.cullingVolume = void 0;
  190201. }
  190202. function createRenderState2(colorMask, bias) {
  190203. return RenderState_default.fromCache({
  190204. cull: {
  190205. enabled: true,
  190206. face: CullFace_default.BACK
  190207. },
  190208. depthTest: {
  190209. enabled: true
  190210. },
  190211. colorMask: {
  190212. red: colorMask,
  190213. green: colorMask,
  190214. blue: colorMask,
  190215. alpha: colorMask
  190216. },
  190217. depthMask: true,
  190218. polygonOffset: {
  190219. enabled: bias.polygonOffset,
  190220. factor: bias.polygonOffsetFactor,
  190221. units: bias.polygonOffsetUnits
  190222. }
  190223. });
  190224. }
  190225. function createRenderStates7(shadowMap) {
  190226. const colorMask = !shadowMap._usesDepthTexture;
  190227. shadowMap._primitiveRenderState = createRenderState2(
  190228. colorMask,
  190229. shadowMap._primitiveBias
  190230. );
  190231. shadowMap._terrainRenderState = createRenderState2(
  190232. colorMask,
  190233. shadowMap._terrainBias
  190234. );
  190235. shadowMap._pointRenderState = createRenderState2(
  190236. colorMask,
  190237. shadowMap._pointBias
  190238. );
  190239. }
  190240. ShadowMap.prototype.debugCreateRenderStates = function() {
  190241. createRenderStates7(this);
  190242. };
  190243. Object.defineProperties(ShadowMap.prototype, {
  190244. enabled: {
  190245. get: function() {
  190246. return this._enabled;
  190247. },
  190248. set: function(value) {
  190249. this.dirty = this._enabled !== value;
  190250. this._enabled = value;
  190251. }
  190252. },
  190253. normalOffset: {
  190254. get: function() {
  190255. return this._normalOffset;
  190256. },
  190257. set: function(value) {
  190258. this.dirty = this._normalOffset !== value;
  190259. this._normalOffset = value;
  190260. this._terrainBias.normalOffset = value;
  190261. this._primitiveBias.normalOffset = value;
  190262. this._pointBias.normalOffset = value;
  190263. }
  190264. },
  190265. softShadows: {
  190266. get: function() {
  190267. return this._softShadows;
  190268. },
  190269. set: function(value) {
  190270. this.dirty = this._softShadows !== value;
  190271. this._softShadows = value;
  190272. }
  190273. },
  190274. size: {
  190275. get: function() {
  190276. return this._size;
  190277. },
  190278. set: function(value) {
  190279. resize(this, value);
  190280. }
  190281. },
  190282. outOfView: {
  190283. get: function() {
  190284. return this._outOfView;
  190285. }
  190286. },
  190287. shadowMapCullingVolume: {
  190288. get: function() {
  190289. return this._shadowMapCullingVolume;
  190290. }
  190291. },
  190292. passes: {
  190293. get: function() {
  190294. return this._passes;
  190295. }
  190296. },
  190297. isPointLight: {
  190298. get: function() {
  190299. return this._isPointLight;
  190300. }
  190301. },
  190302. debugCascadeColors: {
  190303. get: function() {
  190304. return this._debugCascadeColors;
  190305. },
  190306. set: function(value) {
  190307. this.dirty = this._debugCascadeColors !== value;
  190308. this._debugCascadeColors = value;
  190309. }
  190310. }
  190311. });
  190312. function destroyFramebuffer2(shadowMap) {
  190313. const length3 = shadowMap._passes.length;
  190314. for (let i2 = 0; i2 < length3; ++i2) {
  190315. const pass = shadowMap._passes[i2];
  190316. const framebuffer = pass.framebuffer;
  190317. if (defined_default(framebuffer) && !framebuffer.isDestroyed()) {
  190318. framebuffer.destroy();
  190319. }
  190320. pass.framebuffer = void 0;
  190321. }
  190322. shadowMap._depthAttachment = shadowMap._depthAttachment && shadowMap._depthAttachment.destroy();
  190323. shadowMap._colorAttachment = shadowMap._colorAttachment && shadowMap._colorAttachment.destroy();
  190324. }
  190325. function createFramebufferColor(shadowMap, context) {
  190326. const depthRenderbuffer = new Renderbuffer_default({
  190327. context,
  190328. width: shadowMap._textureSize.x,
  190329. height: shadowMap._textureSize.y,
  190330. format: RenderbufferFormat_default.DEPTH_COMPONENT16
  190331. });
  190332. const colorTexture = new Texture_default({
  190333. context,
  190334. width: shadowMap._textureSize.x,
  190335. height: shadowMap._textureSize.y,
  190336. pixelFormat: PixelFormat_default.RGBA,
  190337. pixelDatatype: PixelDatatype_default.UNSIGNED_BYTE,
  190338. sampler: Sampler_default.NEAREST
  190339. });
  190340. const framebuffer = new Framebuffer_default({
  190341. context,
  190342. depthRenderbuffer,
  190343. colorTextures: [colorTexture],
  190344. destroyAttachments: false
  190345. });
  190346. const length3 = shadowMap._passes.length;
  190347. for (let i2 = 0; i2 < length3; ++i2) {
  190348. const pass = shadowMap._passes[i2];
  190349. pass.framebuffer = framebuffer;
  190350. pass.passState.framebuffer = framebuffer;
  190351. }
  190352. shadowMap._shadowMapTexture = colorTexture;
  190353. shadowMap._depthAttachment = depthRenderbuffer;
  190354. shadowMap._colorAttachment = colorTexture;
  190355. }
  190356. function createFramebufferDepth(shadowMap, context) {
  190357. const depthStencilTexture = new Texture_default({
  190358. context,
  190359. width: shadowMap._textureSize.x,
  190360. height: shadowMap._textureSize.y,
  190361. pixelFormat: PixelFormat_default.DEPTH_STENCIL,
  190362. pixelDatatype: PixelDatatype_default.UNSIGNED_INT_24_8,
  190363. sampler: Sampler_default.NEAREST
  190364. });
  190365. const framebuffer = new Framebuffer_default({
  190366. context,
  190367. depthStencilTexture,
  190368. destroyAttachments: false
  190369. });
  190370. const length3 = shadowMap._passes.length;
  190371. for (let i2 = 0; i2 < length3; ++i2) {
  190372. const pass = shadowMap._passes[i2];
  190373. pass.framebuffer = framebuffer;
  190374. pass.passState.framebuffer = framebuffer;
  190375. }
  190376. shadowMap._shadowMapTexture = depthStencilTexture;
  190377. shadowMap._depthAttachment = depthStencilTexture;
  190378. }
  190379. function createFramebufferCube(shadowMap, context) {
  190380. const depthRenderbuffer = new Renderbuffer_default({
  190381. context,
  190382. width: shadowMap._textureSize.x,
  190383. height: shadowMap._textureSize.y,
  190384. format: RenderbufferFormat_default.DEPTH_COMPONENT16
  190385. });
  190386. const cubeMap = new CubeMap_default({
  190387. context,
  190388. width: shadowMap._textureSize.x,
  190389. height: shadowMap._textureSize.y,
  190390. pixelFormat: PixelFormat_default.RGBA,
  190391. pixelDatatype: PixelDatatype_default.UNSIGNED_BYTE,
  190392. sampler: Sampler_default.NEAREST
  190393. });
  190394. const faces2 = [
  190395. cubeMap.negativeX,
  190396. cubeMap.negativeY,
  190397. cubeMap.negativeZ,
  190398. cubeMap.positiveX,
  190399. cubeMap.positiveY,
  190400. cubeMap.positiveZ
  190401. ];
  190402. for (let i2 = 0; i2 < 6; ++i2) {
  190403. const framebuffer = new Framebuffer_default({
  190404. context,
  190405. depthRenderbuffer,
  190406. colorTextures: [faces2[i2]],
  190407. destroyAttachments: false
  190408. });
  190409. const pass = shadowMap._passes[i2];
  190410. pass.framebuffer = framebuffer;
  190411. pass.passState.framebuffer = framebuffer;
  190412. }
  190413. shadowMap._shadowMapTexture = cubeMap;
  190414. shadowMap._depthAttachment = depthRenderbuffer;
  190415. shadowMap._colorAttachment = cubeMap;
  190416. }
  190417. function createFramebuffer2(shadowMap, context) {
  190418. if (shadowMap._isPointLight) {
  190419. createFramebufferCube(shadowMap, context);
  190420. } else if (shadowMap._usesDepthTexture) {
  190421. createFramebufferDepth(shadowMap, context);
  190422. } else {
  190423. createFramebufferColor(shadowMap, context);
  190424. }
  190425. }
  190426. function checkFramebuffer(shadowMap, context) {
  190427. if (shadowMap._usesDepthTexture && shadowMap._passes[0].framebuffer.status !== WebGLConstants_default.FRAMEBUFFER_COMPLETE) {
  190428. shadowMap._usesDepthTexture = false;
  190429. createRenderStates7(shadowMap);
  190430. destroyFramebuffer2(shadowMap);
  190431. createFramebuffer2(shadowMap, context);
  190432. }
  190433. }
  190434. function updateFramebuffer(shadowMap, context) {
  190435. if (!defined_default(shadowMap._passes[0].framebuffer) || shadowMap._shadowMapTexture.width !== shadowMap._textureSize.x) {
  190436. destroyFramebuffer2(shadowMap);
  190437. createFramebuffer2(shadowMap, context);
  190438. checkFramebuffer(shadowMap, context);
  190439. clearFramebuffer(shadowMap, context);
  190440. }
  190441. }
  190442. function clearFramebuffer(shadowMap, context, shadowPass) {
  190443. shadowPass = defaultValue_default(shadowPass, 0);
  190444. if (shadowMap._isPointLight || shadowPass === 0) {
  190445. shadowMap._clearCommand.framebuffer = shadowMap._passes[shadowPass].framebuffer;
  190446. shadowMap._clearCommand.execute(context, shadowMap._clearPassState);
  190447. }
  190448. }
  190449. function resize(shadowMap, size) {
  190450. shadowMap._size = size;
  190451. const passes = shadowMap._passes;
  190452. const numberOfPasses = passes.length;
  190453. const textureSize = shadowMap._textureSize;
  190454. if (shadowMap._isPointLight) {
  190455. size = ContextLimits_default.maximumCubeMapSize >= size ? size : ContextLimits_default.maximumCubeMapSize;
  190456. textureSize.x = size;
  190457. textureSize.y = size;
  190458. const faceViewport = new BoundingRectangle_default(0, 0, size, size);
  190459. passes[0].passState.viewport = faceViewport;
  190460. passes[1].passState.viewport = faceViewport;
  190461. passes[2].passState.viewport = faceViewport;
  190462. passes[3].passState.viewport = faceViewport;
  190463. passes[4].passState.viewport = faceViewport;
  190464. passes[5].passState.viewport = faceViewport;
  190465. } else if (numberOfPasses === 1) {
  190466. size = ContextLimits_default.maximumTextureSize >= size ? size : ContextLimits_default.maximumTextureSize;
  190467. textureSize.x = size;
  190468. textureSize.y = size;
  190469. passes[0].passState.viewport = new BoundingRectangle_default(0, 0, size, size);
  190470. } else if (numberOfPasses === 4) {
  190471. size = ContextLimits_default.maximumTextureSize >= size * 2 ? size : ContextLimits_default.maximumTextureSize / 2;
  190472. textureSize.x = size * 2;
  190473. textureSize.y = size * 2;
  190474. passes[0].passState.viewport = new BoundingRectangle_default(0, 0, size, size);
  190475. passes[1].passState.viewport = new BoundingRectangle_default(size, 0, size, size);
  190476. passes[2].passState.viewport = new BoundingRectangle_default(0, size, size, size);
  190477. passes[3].passState.viewport = new BoundingRectangle_default(
  190478. size,
  190479. size,
  190480. size,
  190481. size
  190482. );
  190483. }
  190484. shadowMap._clearPassState.viewport = new BoundingRectangle_default(
  190485. 0,
  190486. 0,
  190487. textureSize.x,
  190488. textureSize.y
  190489. );
  190490. for (let i2 = 0; i2 < numberOfPasses; ++i2) {
  190491. const pass = passes[i2];
  190492. const viewport = pass.passState.viewport;
  190493. const biasX = viewport.x / textureSize.x;
  190494. const biasY = viewport.y / textureSize.y;
  190495. const scaleX = viewport.width / textureSize.x;
  190496. const scaleY = viewport.height / textureSize.y;
  190497. pass.textureOffsets = new Matrix4_default(
  190498. scaleX,
  190499. 0,
  190500. 0,
  190501. biasX,
  190502. 0,
  190503. scaleY,
  190504. 0,
  190505. biasY,
  190506. 0,
  190507. 0,
  190508. 1,
  190509. 0,
  190510. 0,
  190511. 0,
  190512. 0,
  190513. 1
  190514. );
  190515. }
  190516. }
  190517. var scratchViewport3 = new BoundingRectangle_default();
  190518. function createDebugShadowViewCommand(shadowMap, context) {
  190519. let fs;
  190520. if (shadowMap._isPointLight) {
  190521. fs = "uniform samplerCube shadowMap_textureCube; \nvarying vec2 v_textureCoordinates; \nvoid main() \n{ \n vec2 uv = v_textureCoordinates; \n vec3 dir; \n \n if (uv.y < 0.5) \n { \n if (uv.x < 0.333) \n { \n dir.x = -1.0; \n dir.y = uv.x * 6.0 - 1.0; \n dir.z = uv.y * 4.0 - 1.0; \n } \n else if (uv.x < 0.666) \n { \n dir.y = -1.0; \n dir.x = uv.x * 6.0 - 3.0; \n dir.z = uv.y * 4.0 - 1.0; \n } \n else \n { \n dir.z = -1.0; \n dir.x = uv.x * 6.0 - 5.0; \n dir.y = uv.y * 4.0 - 1.0; \n } \n } \n else \n { \n if (uv.x < 0.333) \n { \n dir.x = 1.0; \n dir.y = uv.x * 6.0 - 1.0; \n dir.z = uv.y * 4.0 - 3.0; \n } \n else if (uv.x < 0.666) \n { \n dir.y = 1.0; \n dir.x = uv.x * 6.0 - 3.0; \n dir.z = uv.y * 4.0 - 3.0; \n } \n else \n { \n dir.z = 1.0; \n dir.x = uv.x * 6.0 - 5.0; \n dir.y = uv.y * 4.0 - 3.0; \n } \n } \n \n float shadow = czm_unpackDepth(textureCube(shadowMap_textureCube, dir)); \n gl_FragColor = vec4(vec3(shadow), 1.0); \n} \n";
  190522. } else {
  190523. fs = `${"uniform sampler2D shadowMap_texture; \nvarying vec2 v_textureCoordinates; \nvoid main() \n{ \n"}${shadowMap._usesDepthTexture ? " float shadow = texture2D(shadowMap_texture, v_textureCoordinates).r; \n" : " float shadow = czm_unpackDepth(texture2D(shadowMap_texture, v_textureCoordinates)); \n"} gl_FragColor = vec4(vec3(shadow), 1.0);
  190524. }
  190525. `;
  190526. }
  190527. const drawCommand = context.createViewportQuadCommand(fs, {
  190528. uniformMap: {
  190529. shadowMap_texture: function() {
  190530. return shadowMap._shadowMapTexture;
  190531. },
  190532. shadowMap_textureCube: function() {
  190533. return shadowMap._shadowMapTexture;
  190534. }
  190535. }
  190536. });
  190537. drawCommand.pass = Pass_default.OVERLAY;
  190538. return drawCommand;
  190539. }
  190540. function updateDebugShadowViewCommand(shadowMap, frameState) {
  190541. const context = frameState.context;
  190542. const screenWidth = frameState.context.drawingBufferWidth;
  190543. const screenHeight = frameState.context.drawingBufferHeight;
  190544. const size = Math.min(screenWidth, screenHeight) * 0.3;
  190545. const viewport = scratchViewport3;
  190546. viewport.x = screenWidth - size;
  190547. viewport.y = 0;
  190548. viewport.width = size;
  190549. viewport.height = size;
  190550. let debugCommand = shadowMap._debugShadowViewCommand;
  190551. if (!defined_default(debugCommand)) {
  190552. debugCommand = createDebugShadowViewCommand(shadowMap, context);
  190553. shadowMap._debugShadowViewCommand = debugCommand;
  190554. }
  190555. if (!defined_default(debugCommand.renderState) || !BoundingRectangle_default.equals(debugCommand.renderState.viewport, viewport)) {
  190556. debugCommand.renderState = RenderState_default.fromCache({
  190557. viewport: BoundingRectangle_default.clone(viewport)
  190558. });
  190559. }
  190560. frameState.commandList.push(shadowMap._debugShadowViewCommand);
  190561. }
  190562. var frustumCornersNDC2 = new Array(8);
  190563. frustumCornersNDC2[0] = new Cartesian4_default(-1, -1, -1, 1);
  190564. frustumCornersNDC2[1] = new Cartesian4_default(1, -1, -1, 1);
  190565. frustumCornersNDC2[2] = new Cartesian4_default(1, 1, -1, 1);
  190566. frustumCornersNDC2[3] = new Cartesian4_default(-1, 1, -1, 1);
  190567. frustumCornersNDC2[4] = new Cartesian4_default(-1, -1, 1, 1);
  190568. frustumCornersNDC2[5] = new Cartesian4_default(1, -1, 1, 1);
  190569. frustumCornersNDC2[6] = new Cartesian4_default(1, 1, 1, 1);
  190570. frustumCornersNDC2[7] = new Cartesian4_default(-1, 1, 1, 1);
  190571. var scratchMatrix6 = new Matrix4_default();
  190572. var scratchFrustumCorners2 = new Array(8);
  190573. for (let i2 = 0; i2 < 8; ++i2) {
  190574. scratchFrustumCorners2[i2] = new Cartesian4_default();
  190575. }
  190576. function createDebugPointLight(modelMatrix, color) {
  190577. const box = new GeometryInstance_default({
  190578. geometry: new BoxOutlineGeometry_default({
  190579. minimum: new Cartesian3_default(-0.5, -0.5, -0.5),
  190580. maximum: new Cartesian3_default(0.5, 0.5, 0.5)
  190581. }),
  190582. attributes: {
  190583. color: ColorGeometryInstanceAttribute_default.fromColor(color)
  190584. }
  190585. });
  190586. const sphere = new GeometryInstance_default({
  190587. geometry: new SphereOutlineGeometry_default({
  190588. radius: 0.5
  190589. }),
  190590. attributes: {
  190591. color: ColorGeometryInstanceAttribute_default.fromColor(color)
  190592. }
  190593. });
  190594. return new Primitive_default({
  190595. geometryInstances: [box, sphere],
  190596. appearance: new PerInstanceColorAppearance_default({
  190597. translucent: false,
  190598. flat: true
  190599. }),
  190600. asynchronous: false,
  190601. modelMatrix
  190602. });
  190603. }
  190604. var debugOutlineColors = [Color_default.RED, Color_default.GREEN, Color_default.BLUE, Color_default.MAGENTA];
  190605. var scratchScale6 = new Cartesian3_default();
  190606. function applyDebugSettings2(shadowMap, frameState) {
  190607. updateDebugShadowViewCommand(shadowMap, frameState);
  190608. const enterFreezeFrame = shadowMap.debugFreezeFrame && !shadowMap._debugFreezeFrame;
  190609. shadowMap._debugFreezeFrame = shadowMap.debugFreezeFrame;
  190610. if (shadowMap.debugFreezeFrame) {
  190611. if (enterFreezeFrame) {
  190612. shadowMap._debugCameraFrustum = shadowMap._debugCameraFrustum && shadowMap._debugCameraFrustum.destroy();
  190613. shadowMap._debugCameraFrustum = new DebugCameraPrimitive_default({
  190614. camera: shadowMap._sceneCamera,
  190615. color: Color_default.CYAN,
  190616. updateOnChange: false
  190617. });
  190618. }
  190619. shadowMap._debugCameraFrustum.update(frameState);
  190620. }
  190621. if (shadowMap._cascadesEnabled) {
  190622. if (shadowMap.debugFreezeFrame) {
  190623. if (enterFreezeFrame) {
  190624. shadowMap._debugLightFrustum = shadowMap._debugLightFrustum && shadowMap._debugLightFrustum.destroy();
  190625. shadowMap._debugLightFrustum = new DebugCameraPrimitive_default({
  190626. camera: shadowMap._shadowMapCamera,
  190627. color: Color_default.YELLOW,
  190628. updateOnChange: false
  190629. });
  190630. }
  190631. shadowMap._debugLightFrustum.update(frameState);
  190632. for (let i2 = 0; i2 < shadowMap._numberOfCascades; ++i2) {
  190633. if (enterFreezeFrame) {
  190634. shadowMap._debugCascadeFrustums[i2] = shadowMap._debugCascadeFrustums[i2] && shadowMap._debugCascadeFrustums[i2].destroy();
  190635. shadowMap._debugCascadeFrustums[i2] = new DebugCameraPrimitive_default({
  190636. camera: shadowMap._passes[i2].camera,
  190637. color: debugOutlineColors[i2],
  190638. updateOnChange: false
  190639. });
  190640. }
  190641. shadowMap._debugCascadeFrustums[i2].update(frameState);
  190642. }
  190643. }
  190644. } else if (shadowMap._isPointLight) {
  190645. if (!defined_default(shadowMap._debugLightFrustum) || shadowMap._needsUpdate) {
  190646. const translation3 = shadowMap._shadowMapCamera.positionWC;
  190647. const rotation = Quaternion_default.IDENTITY;
  190648. const uniformScale = shadowMap._pointLightRadius * 2;
  190649. const scale = Cartesian3_default.fromElements(
  190650. uniformScale,
  190651. uniformScale,
  190652. uniformScale,
  190653. scratchScale6
  190654. );
  190655. const modelMatrix = Matrix4_default.fromTranslationQuaternionRotationScale(
  190656. translation3,
  190657. rotation,
  190658. scale,
  190659. scratchMatrix6
  190660. );
  190661. shadowMap._debugLightFrustum = shadowMap._debugLightFrustum && shadowMap._debugLightFrustum.destroy();
  190662. shadowMap._debugLightFrustum = createDebugPointLight(
  190663. modelMatrix,
  190664. Color_default.YELLOW
  190665. );
  190666. }
  190667. shadowMap._debugLightFrustum.update(frameState);
  190668. } else {
  190669. if (!defined_default(shadowMap._debugLightFrustum) || shadowMap._needsUpdate) {
  190670. shadowMap._debugLightFrustum = new DebugCameraPrimitive_default({
  190671. camera: shadowMap._shadowMapCamera,
  190672. color: Color_default.YELLOW,
  190673. updateOnChange: false
  190674. });
  190675. }
  190676. shadowMap._debugLightFrustum.update(frameState);
  190677. }
  190678. }
  190679. function ShadowMapCamera() {
  190680. this.viewMatrix = new Matrix4_default();
  190681. this.inverseViewMatrix = new Matrix4_default();
  190682. this.frustum = void 0;
  190683. this.positionCartographic = new Cartographic_default();
  190684. this.positionWC = new Cartesian3_default();
  190685. this.directionWC = Cartesian3_default.clone(Cartesian3_default.UNIT_Z);
  190686. this.upWC = Cartesian3_default.clone(Cartesian3_default.UNIT_Y);
  190687. this.rightWC = Cartesian3_default.clone(Cartesian3_default.UNIT_X);
  190688. this.viewProjectionMatrix = new Matrix4_default();
  190689. }
  190690. ShadowMapCamera.prototype.clone = function(camera) {
  190691. Matrix4_default.clone(camera.viewMatrix, this.viewMatrix);
  190692. Matrix4_default.clone(camera.inverseViewMatrix, this.inverseViewMatrix);
  190693. this.frustum = camera.frustum.clone(this.frustum);
  190694. Cartographic_default.clone(camera.positionCartographic, this.positionCartographic);
  190695. Cartesian3_default.clone(camera.positionWC, this.positionWC);
  190696. Cartesian3_default.clone(camera.directionWC, this.directionWC);
  190697. Cartesian3_default.clone(camera.upWC, this.upWC);
  190698. Cartesian3_default.clone(camera.rightWC, this.rightWC);
  190699. };
  190700. var scaleBiasMatrix = new Matrix4_default(
  190701. 0.5,
  190702. 0,
  190703. 0,
  190704. 0.5,
  190705. 0,
  190706. 0.5,
  190707. 0,
  190708. 0.5,
  190709. 0,
  190710. 0,
  190711. 0.5,
  190712. 0.5,
  190713. 0,
  190714. 0,
  190715. 0,
  190716. 1
  190717. );
  190718. ShadowMapCamera.prototype.getViewProjection = function() {
  190719. const view = this.viewMatrix;
  190720. const projection = this.frustum.projectionMatrix;
  190721. Matrix4_default.multiply(projection, view, this.viewProjectionMatrix);
  190722. Matrix4_default.multiply(
  190723. scaleBiasMatrix,
  190724. this.viewProjectionMatrix,
  190725. this.viewProjectionMatrix
  190726. );
  190727. return this.viewProjectionMatrix;
  190728. };
  190729. var scratchSplits2 = new Array(5);
  190730. var scratchFrustum = new PerspectiveFrustum_default();
  190731. var scratchCascadeDistances = new Array(4);
  190732. var scratchMin5 = new Cartesian3_default();
  190733. var scratchMax5 = new Cartesian3_default();
  190734. function computeCascades(shadowMap, frameState) {
  190735. const shadowMapCamera = shadowMap._shadowMapCamera;
  190736. const sceneCamera = shadowMap._sceneCamera;
  190737. const cameraNear = sceneCamera.frustum.near;
  190738. const cameraFar = sceneCamera.frustum.far;
  190739. const numberOfCascades = shadowMap._numberOfCascades;
  190740. let i2;
  190741. const range2 = cameraFar - cameraNear;
  190742. const ratio = cameraFar / cameraNear;
  190743. let lambda = 0.9;
  190744. let clampCascadeDistances = false;
  190745. if (frameState.shadowState.closestObjectSize < 200) {
  190746. clampCascadeDistances = true;
  190747. lambda = 0.9;
  190748. }
  190749. const cascadeDistances = scratchCascadeDistances;
  190750. const splits = scratchSplits2;
  190751. splits[0] = cameraNear;
  190752. splits[numberOfCascades] = cameraFar;
  190753. for (i2 = 0; i2 < numberOfCascades; ++i2) {
  190754. const p2 = (i2 + 1) / numberOfCascades;
  190755. const logScale = cameraNear * Math.pow(ratio, p2);
  190756. const uniformScale = cameraNear + range2 * p2;
  190757. const split = Math_default.lerp(uniformScale, logScale, lambda);
  190758. splits[i2 + 1] = split;
  190759. cascadeDistances[i2] = split - splits[i2];
  190760. }
  190761. if (clampCascadeDistances) {
  190762. for (i2 = 0; i2 < numberOfCascades; ++i2) {
  190763. cascadeDistances[i2] = Math.min(
  190764. cascadeDistances[i2],
  190765. shadowMap._maximumCascadeDistances[i2]
  190766. );
  190767. }
  190768. let distance2 = splits[0];
  190769. for (i2 = 0; i2 < numberOfCascades - 1; ++i2) {
  190770. distance2 += cascadeDistances[i2];
  190771. splits[i2 + 1] = distance2;
  190772. }
  190773. }
  190774. Cartesian4_default.unpack(splits, 0, shadowMap._cascadeSplits[0]);
  190775. Cartesian4_default.unpack(splits, 1, shadowMap._cascadeSplits[1]);
  190776. Cartesian4_default.unpack(cascadeDistances, 0, shadowMap._cascadeDistances);
  190777. const shadowFrustum = shadowMapCamera.frustum;
  190778. const left = shadowFrustum.left;
  190779. const right = shadowFrustum.right;
  190780. const bottom = shadowFrustum.bottom;
  190781. const top = shadowFrustum.top;
  190782. const near = shadowFrustum.near;
  190783. const far = shadowFrustum.far;
  190784. const position = shadowMapCamera.positionWC;
  190785. const direction2 = shadowMapCamera.directionWC;
  190786. const up = shadowMapCamera.upWC;
  190787. const cascadeSubFrustum = sceneCamera.frustum.clone(scratchFrustum);
  190788. const shadowViewProjection = shadowMapCamera.getViewProjection();
  190789. for (i2 = 0; i2 < numberOfCascades; ++i2) {
  190790. cascadeSubFrustum.near = splits[i2];
  190791. cascadeSubFrustum.far = splits[i2 + 1];
  190792. const viewProjection = Matrix4_default.multiply(
  190793. cascadeSubFrustum.projectionMatrix,
  190794. sceneCamera.viewMatrix,
  190795. scratchMatrix6
  190796. );
  190797. const inverseViewProjection = Matrix4_default.inverse(
  190798. viewProjection,
  190799. scratchMatrix6
  190800. );
  190801. const shadowMapMatrix = Matrix4_default.multiply(
  190802. shadowViewProjection,
  190803. inverseViewProjection,
  190804. scratchMatrix6
  190805. );
  190806. const min3 = Cartesian3_default.fromElements(
  190807. Number.MAX_VALUE,
  190808. Number.MAX_VALUE,
  190809. Number.MAX_VALUE,
  190810. scratchMin5
  190811. );
  190812. const max3 = Cartesian3_default.fromElements(
  190813. -Number.MAX_VALUE,
  190814. -Number.MAX_VALUE,
  190815. -Number.MAX_VALUE,
  190816. scratchMax5
  190817. );
  190818. for (let k = 0; k < 8; ++k) {
  190819. const corner = Cartesian4_default.clone(
  190820. frustumCornersNDC2[k],
  190821. scratchFrustumCorners2[k]
  190822. );
  190823. Matrix4_default.multiplyByVector(shadowMapMatrix, corner, corner);
  190824. Cartesian3_default.divideByScalar(corner, corner.w, corner);
  190825. Cartesian3_default.minimumByComponent(corner, min3, min3);
  190826. Cartesian3_default.maximumByComponent(corner, max3, max3);
  190827. }
  190828. min3.x = Math.max(min3.x, 0);
  190829. min3.y = Math.max(min3.y, 0);
  190830. min3.z = 0;
  190831. max3.x = Math.min(max3.x, 1);
  190832. max3.y = Math.min(max3.y, 1);
  190833. max3.z = Math.min(max3.z, 1);
  190834. const pass = shadowMap._passes[i2];
  190835. const cascadeCamera = pass.camera;
  190836. cascadeCamera.clone(shadowMapCamera);
  190837. const frustum = cascadeCamera.frustum;
  190838. frustum.left = left + min3.x * (right - left);
  190839. frustum.right = left + max3.x * (right - left);
  190840. frustum.bottom = bottom + min3.y * (top - bottom);
  190841. frustum.top = bottom + max3.y * (top - bottom);
  190842. frustum.near = near + min3.z * (far - near);
  190843. frustum.far = near + max3.z * (far - near);
  190844. pass.cullingVolume = cascadeCamera.frustum.computeCullingVolume(
  190845. position,
  190846. direction2,
  190847. up
  190848. );
  190849. const cascadeMatrix = shadowMap._cascadeMatrices[i2];
  190850. Matrix4_default.multiply(
  190851. cascadeCamera.getViewProjection(),
  190852. sceneCamera.inverseViewMatrix,
  190853. cascadeMatrix
  190854. );
  190855. Matrix4_default.multiply(pass.textureOffsets, cascadeMatrix, cascadeMatrix);
  190856. }
  190857. }
  190858. var scratchLightView = new Matrix4_default();
  190859. var scratchRight3 = new Cartesian3_default();
  190860. var scratchUp2 = new Cartesian3_default();
  190861. var scratchTranslation2 = new Cartesian3_default();
  190862. function fitShadowMapToScene(shadowMap, frameState) {
  190863. const shadowMapCamera = shadowMap._shadowMapCamera;
  190864. const sceneCamera = shadowMap._sceneCamera;
  190865. const viewProjection = Matrix4_default.multiply(
  190866. sceneCamera.frustum.projectionMatrix,
  190867. sceneCamera.viewMatrix,
  190868. scratchMatrix6
  190869. );
  190870. const inverseViewProjection = Matrix4_default.inverse(viewProjection, scratchMatrix6);
  190871. const lightDir = shadowMapCamera.directionWC;
  190872. let lightUp = sceneCamera.directionWC;
  190873. if (Cartesian3_default.equalsEpsilon(lightDir, lightUp, Math_default.EPSILON10)) {
  190874. lightUp = sceneCamera.upWC;
  190875. }
  190876. const lightRight = Cartesian3_default.cross(lightDir, lightUp, scratchRight3);
  190877. lightUp = Cartesian3_default.cross(lightRight, lightDir, scratchUp2);
  190878. Cartesian3_default.normalize(lightUp, lightUp);
  190879. Cartesian3_default.normalize(lightRight, lightRight);
  190880. const lightPosition = Cartesian3_default.fromElements(
  190881. 0,
  190882. 0,
  190883. 0,
  190884. scratchTranslation2
  190885. );
  190886. let lightView = Matrix4_default.computeView(
  190887. lightPosition,
  190888. lightDir,
  190889. lightUp,
  190890. lightRight,
  190891. scratchLightView
  190892. );
  190893. const cameraToLight = Matrix4_default.multiply(
  190894. lightView,
  190895. inverseViewProjection,
  190896. scratchMatrix6
  190897. );
  190898. const min3 = Cartesian3_default.fromElements(
  190899. Number.MAX_VALUE,
  190900. Number.MAX_VALUE,
  190901. Number.MAX_VALUE,
  190902. scratchMin5
  190903. );
  190904. const max3 = Cartesian3_default.fromElements(
  190905. -Number.MAX_VALUE,
  190906. -Number.MAX_VALUE,
  190907. -Number.MAX_VALUE,
  190908. scratchMax5
  190909. );
  190910. for (let i2 = 0; i2 < 8; ++i2) {
  190911. const corner = Cartesian4_default.clone(
  190912. frustumCornersNDC2[i2],
  190913. scratchFrustumCorners2[i2]
  190914. );
  190915. Matrix4_default.multiplyByVector(cameraToLight, corner, corner);
  190916. Cartesian3_default.divideByScalar(corner, corner.w, corner);
  190917. Cartesian3_default.minimumByComponent(corner, min3, min3);
  190918. Cartesian3_default.maximumByComponent(corner, max3, max3);
  190919. }
  190920. max3.z += 1e3;
  190921. min3.z -= 10;
  190922. const translation3 = scratchTranslation2;
  190923. translation3.x = -(0.5 * (min3.x + max3.x));
  190924. translation3.y = -(0.5 * (min3.y + max3.y));
  190925. translation3.z = -max3.z;
  190926. const translationMatrix = Matrix4_default.fromTranslation(translation3, scratchMatrix6);
  190927. lightView = Matrix4_default.multiply(translationMatrix, lightView, lightView);
  190928. const halfWidth = 0.5 * (max3.x - min3.x);
  190929. const halfHeight = 0.5 * (max3.y - min3.y);
  190930. const depth = max3.z - min3.z;
  190931. const frustum = shadowMapCamera.frustum;
  190932. frustum.left = -halfWidth;
  190933. frustum.right = halfWidth;
  190934. frustum.bottom = -halfHeight;
  190935. frustum.top = halfHeight;
  190936. frustum.near = 0.01;
  190937. frustum.far = depth;
  190938. Matrix4_default.clone(lightView, shadowMapCamera.viewMatrix);
  190939. Matrix4_default.inverse(lightView, shadowMapCamera.inverseViewMatrix);
  190940. Matrix4_default.getTranslation(
  190941. shadowMapCamera.inverseViewMatrix,
  190942. shadowMapCamera.positionWC
  190943. );
  190944. frameState.mapProjection.ellipsoid.cartesianToCartographic(
  190945. shadowMapCamera.positionWC,
  190946. shadowMapCamera.positionCartographic
  190947. );
  190948. Cartesian3_default.clone(lightDir, shadowMapCamera.directionWC);
  190949. Cartesian3_default.clone(lightUp, shadowMapCamera.upWC);
  190950. Cartesian3_default.clone(lightRight, shadowMapCamera.rightWC);
  190951. }
  190952. var directions = [
  190953. new Cartesian3_default(-1, 0, 0),
  190954. new Cartesian3_default(0, -1, 0),
  190955. new Cartesian3_default(0, 0, -1),
  190956. new Cartesian3_default(1, 0, 0),
  190957. new Cartesian3_default(0, 1, 0),
  190958. new Cartesian3_default(0, 0, 1)
  190959. ];
  190960. var ups = [
  190961. new Cartesian3_default(0, -1, 0),
  190962. new Cartesian3_default(0, 0, -1),
  190963. new Cartesian3_default(0, -1, 0),
  190964. new Cartesian3_default(0, -1, 0),
  190965. new Cartesian3_default(0, 0, 1),
  190966. new Cartesian3_default(0, -1, 0)
  190967. ];
  190968. var rights = [
  190969. new Cartesian3_default(0, 0, 1),
  190970. new Cartesian3_default(1, 0, 0),
  190971. new Cartesian3_default(-1, 0, 0),
  190972. new Cartesian3_default(0, 0, -1),
  190973. new Cartesian3_default(1, 0, 0),
  190974. new Cartesian3_default(1, 0, 0)
  190975. ];
  190976. function computeOmnidirectional(shadowMap, frameState) {
  190977. const frustum = new PerspectiveFrustum_default();
  190978. frustum.fov = Math_default.PI_OVER_TWO;
  190979. frustum.near = 1;
  190980. frustum.far = shadowMap._pointLightRadius;
  190981. frustum.aspectRatio = 1;
  190982. for (let i2 = 0; i2 < 6; ++i2) {
  190983. const camera = shadowMap._passes[i2].camera;
  190984. camera.positionWC = shadowMap._shadowMapCamera.positionWC;
  190985. camera.positionCartographic = frameState.mapProjection.ellipsoid.cartesianToCartographic(
  190986. camera.positionWC,
  190987. camera.positionCartographic
  190988. );
  190989. camera.directionWC = directions[i2];
  190990. camera.upWC = ups[i2];
  190991. camera.rightWC = rights[i2];
  190992. Matrix4_default.computeView(
  190993. camera.positionWC,
  190994. camera.directionWC,
  190995. camera.upWC,
  190996. camera.rightWC,
  190997. camera.viewMatrix
  190998. );
  190999. Matrix4_default.inverse(camera.viewMatrix, camera.inverseViewMatrix);
  191000. camera.frustum = frustum;
  191001. }
  191002. }
  191003. var scratchCartesian111 = new Cartesian3_default();
  191004. var scratchCartesian213 = new Cartesian3_default();
  191005. var scratchBoundingSphere6 = new BoundingSphere_default();
  191006. var scratchCenter8 = scratchBoundingSphere6.center;
  191007. function checkVisibility(shadowMap, frameState) {
  191008. const sceneCamera = shadowMap._sceneCamera;
  191009. const shadowMapCamera = shadowMap._shadowMapCamera;
  191010. const boundingSphere = scratchBoundingSphere6;
  191011. if (shadowMap._cascadesEnabled) {
  191012. if (sceneCamera.frustum.near >= shadowMap.maximumDistance) {
  191013. shadowMap._outOfView = true;
  191014. shadowMap._needsUpdate = false;
  191015. return;
  191016. }
  191017. const surfaceNormal = frameState.mapProjection.ellipsoid.geodeticSurfaceNormal(
  191018. sceneCamera.positionWC,
  191019. scratchCartesian111
  191020. );
  191021. const lightDirection = Cartesian3_default.negate(
  191022. shadowMapCamera.directionWC,
  191023. scratchCartesian213
  191024. );
  191025. const dot2 = Cartesian3_default.dot(surfaceNormal, lightDirection);
  191026. if (shadowMap.fadingEnabled) {
  191027. const darknessAmount = Math_default.clamp(dot2 / 0.1, 0, 1);
  191028. shadowMap._darkness = Math_default.lerp(
  191029. 1,
  191030. shadowMap.darkness,
  191031. darknessAmount
  191032. );
  191033. } else {
  191034. shadowMap._darkness = shadowMap.darkness;
  191035. }
  191036. if (dot2 < 0) {
  191037. shadowMap._outOfView = true;
  191038. shadowMap._needsUpdate = false;
  191039. return;
  191040. }
  191041. shadowMap._needsUpdate = true;
  191042. shadowMap._outOfView = false;
  191043. } else if (shadowMap._isPointLight) {
  191044. boundingSphere.center = shadowMapCamera.positionWC;
  191045. boundingSphere.radius = shadowMap._pointLightRadius;
  191046. shadowMap._outOfView = frameState.cullingVolume.computeVisibility(boundingSphere) === Intersect_default.OUTSIDE;
  191047. shadowMap._needsUpdate = !shadowMap._outOfView && !shadowMap._boundingSphere.equals(boundingSphere);
  191048. BoundingSphere_default.clone(boundingSphere, shadowMap._boundingSphere);
  191049. } else {
  191050. const frustumRadius = shadowMapCamera.frustum.far / 2;
  191051. const frustumCenter = Cartesian3_default.add(
  191052. shadowMapCamera.positionWC,
  191053. Cartesian3_default.multiplyByScalar(
  191054. shadowMapCamera.directionWC,
  191055. frustumRadius,
  191056. scratchCenter8
  191057. ),
  191058. scratchCenter8
  191059. );
  191060. boundingSphere.center = frustumCenter;
  191061. boundingSphere.radius = frustumRadius;
  191062. shadowMap._outOfView = frameState.cullingVolume.computeVisibility(boundingSphere) === Intersect_default.OUTSIDE;
  191063. shadowMap._needsUpdate = !shadowMap._outOfView && !shadowMap._boundingSphere.equals(boundingSphere);
  191064. BoundingSphere_default.clone(boundingSphere, shadowMap._boundingSphere);
  191065. }
  191066. }
  191067. function updateCameras(shadowMap, frameState) {
  191068. const camera = frameState.camera;
  191069. const lightCamera = shadowMap._lightCamera;
  191070. const sceneCamera = shadowMap._sceneCamera;
  191071. const shadowMapCamera = shadowMap._shadowMapCamera;
  191072. if (shadowMap._cascadesEnabled) {
  191073. Cartesian3_default.clone(lightCamera.directionWC, shadowMapCamera.directionWC);
  191074. } else if (shadowMap._isPointLight) {
  191075. Cartesian3_default.clone(lightCamera.positionWC, shadowMapCamera.positionWC);
  191076. } else {
  191077. shadowMapCamera.clone(lightCamera);
  191078. }
  191079. const lightDirection = shadowMap._lightDirectionEC;
  191080. Matrix4_default.multiplyByPointAsVector(
  191081. camera.viewMatrix,
  191082. shadowMapCamera.directionWC,
  191083. lightDirection
  191084. );
  191085. Cartesian3_default.normalize(lightDirection, lightDirection);
  191086. Cartesian3_default.negate(lightDirection, lightDirection);
  191087. Matrix4_default.multiplyByPoint(
  191088. camera.viewMatrix,
  191089. shadowMapCamera.positionWC,
  191090. shadowMap._lightPositionEC
  191091. );
  191092. shadowMap._lightPositionEC.w = shadowMap._pointLightRadius;
  191093. let near;
  191094. let far;
  191095. if (shadowMap._fitNearFar) {
  191096. near = Math.min(
  191097. frameState.shadowState.nearPlane,
  191098. shadowMap.maximumDistance
  191099. );
  191100. far = Math.min(frameState.shadowState.farPlane, shadowMap.maximumDistance);
  191101. far = Math.max(far, near + 1);
  191102. } else {
  191103. near = camera.frustum.near;
  191104. far = shadowMap.maximumDistance;
  191105. }
  191106. shadowMap._sceneCamera = Camera_default.clone(camera, sceneCamera);
  191107. camera.frustum.clone(shadowMap._sceneCamera.frustum);
  191108. shadowMap._sceneCamera.frustum.near = near;
  191109. shadowMap._sceneCamera.frustum.far = far;
  191110. shadowMap._distance = far - near;
  191111. checkVisibility(shadowMap, frameState);
  191112. if (!shadowMap._outOfViewPrevious && shadowMap._outOfView) {
  191113. shadowMap._needsUpdate = true;
  191114. }
  191115. shadowMap._outOfViewPrevious = shadowMap._outOfView;
  191116. }
  191117. ShadowMap.prototype.update = function(frameState) {
  191118. updateCameras(this, frameState);
  191119. if (this._needsUpdate) {
  191120. updateFramebuffer(this, frameState.context);
  191121. if (this._isPointLight) {
  191122. computeOmnidirectional(this, frameState);
  191123. }
  191124. if (this._cascadesEnabled) {
  191125. fitShadowMapToScene(this, frameState);
  191126. if (this._numberOfCascades > 1) {
  191127. computeCascades(this, frameState);
  191128. }
  191129. }
  191130. if (!this._isPointLight) {
  191131. const shadowMapCamera = this._shadowMapCamera;
  191132. const position = shadowMapCamera.positionWC;
  191133. const direction2 = shadowMapCamera.directionWC;
  191134. const up = shadowMapCamera.upWC;
  191135. this._shadowMapCullingVolume = shadowMapCamera.frustum.computeCullingVolume(
  191136. position,
  191137. direction2,
  191138. up
  191139. );
  191140. if (this._passes.length === 1) {
  191141. this._passes[0].camera.clone(shadowMapCamera);
  191142. }
  191143. } else {
  191144. this._shadowMapCullingVolume = CullingVolume_default.fromBoundingSphere(
  191145. this._boundingSphere
  191146. );
  191147. }
  191148. }
  191149. if (this._passes.length === 1) {
  191150. const inverseView = this._sceneCamera.inverseViewMatrix;
  191151. Matrix4_default.multiply(
  191152. this._shadowMapCamera.getViewProjection(),
  191153. inverseView,
  191154. this._shadowMapMatrix
  191155. );
  191156. }
  191157. if (this.debugShow) {
  191158. applyDebugSettings2(this, frameState);
  191159. }
  191160. };
  191161. ShadowMap.prototype.updatePass = function(context, shadowPass) {
  191162. clearFramebuffer(this, context, shadowPass);
  191163. };
  191164. var scratchTexelStepSize = new Cartesian2_default();
  191165. function combineUniforms(shadowMap, uniforms, isTerrain) {
  191166. const bias = shadowMap._isPointLight ? shadowMap._pointBias : isTerrain ? shadowMap._terrainBias : shadowMap._primitiveBias;
  191167. const mapUniforms = {
  191168. shadowMap_texture: function() {
  191169. return shadowMap._shadowMapTexture;
  191170. },
  191171. shadowMap_textureCube: function() {
  191172. return shadowMap._shadowMapTexture;
  191173. },
  191174. shadowMap_matrix: function() {
  191175. return shadowMap._shadowMapMatrix;
  191176. },
  191177. shadowMap_cascadeSplits: function() {
  191178. return shadowMap._cascadeSplits;
  191179. },
  191180. shadowMap_cascadeMatrices: function() {
  191181. return shadowMap._cascadeMatrices;
  191182. },
  191183. shadowMap_lightDirectionEC: function() {
  191184. return shadowMap._lightDirectionEC;
  191185. },
  191186. shadowMap_lightPositionEC: function() {
  191187. return shadowMap._lightPositionEC;
  191188. },
  191189. shadowMap_cascadeDistances: function() {
  191190. return shadowMap._cascadeDistances;
  191191. },
  191192. shadowMap_texelSizeDepthBiasAndNormalShadingSmooth: function() {
  191193. const texelStepSize = scratchTexelStepSize;
  191194. texelStepSize.x = 1 / shadowMap._textureSize.x;
  191195. texelStepSize.y = 1 / shadowMap._textureSize.y;
  191196. return Cartesian4_default.fromElements(
  191197. texelStepSize.x,
  191198. texelStepSize.y,
  191199. bias.depthBias,
  191200. bias.normalShadingSmooth,
  191201. this.combinedUniforms1
  191202. );
  191203. },
  191204. shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness: function() {
  191205. return Cartesian4_default.fromElements(
  191206. bias.normalOffsetScale,
  191207. shadowMap._distance,
  191208. shadowMap.maximumDistance,
  191209. shadowMap._darkness,
  191210. this.combinedUniforms2
  191211. );
  191212. },
  191213. combinedUniforms1: new Cartesian4_default(),
  191214. combinedUniforms2: new Cartesian4_default()
  191215. };
  191216. return combine_default(uniforms, mapUniforms, false);
  191217. }
  191218. function createCastDerivedCommand(shadowMap, shadowsDirty, command, context, oldShaderId, result) {
  191219. let castShader;
  191220. let castRenderState;
  191221. let castUniformMap;
  191222. if (defined_default(result)) {
  191223. castShader = result.shaderProgram;
  191224. castRenderState = result.renderState;
  191225. castUniformMap = result.uniformMap;
  191226. }
  191227. result = DrawCommand_default.shallowClone(command, result);
  191228. result.castShadows = true;
  191229. result.receiveShadows = false;
  191230. if (!defined_default(castShader) || oldShaderId !== command.shaderProgram.id || shadowsDirty) {
  191231. const shaderProgram = command.shaderProgram;
  191232. const isTerrain = command.pass === Pass_default.GLOBE;
  191233. const isOpaque = command.pass !== Pass_default.TRANSLUCENT;
  191234. const isPointLight = shadowMap._isPointLight;
  191235. const usesDepthTexture = shadowMap._usesDepthTexture;
  191236. const keyword = ShadowMapShader_default.getShadowCastShaderKeyword(
  191237. isPointLight,
  191238. isTerrain,
  191239. usesDepthTexture,
  191240. isOpaque
  191241. );
  191242. castShader = context.shaderCache.getDerivedShaderProgram(
  191243. shaderProgram,
  191244. keyword
  191245. );
  191246. if (!defined_default(castShader)) {
  191247. const vertexShaderSource = shaderProgram.vertexShaderSource;
  191248. const fragmentShaderSource = shaderProgram.fragmentShaderSource;
  191249. const castVS = ShadowMapShader_default.createShadowCastVertexShader(
  191250. vertexShaderSource,
  191251. isPointLight,
  191252. isTerrain
  191253. );
  191254. const castFS = ShadowMapShader_default.createShadowCastFragmentShader(
  191255. fragmentShaderSource,
  191256. isPointLight,
  191257. usesDepthTexture,
  191258. isOpaque
  191259. );
  191260. castShader = context.shaderCache.createDerivedShaderProgram(
  191261. shaderProgram,
  191262. keyword,
  191263. {
  191264. vertexShaderSource: castVS,
  191265. fragmentShaderSource: castFS,
  191266. attributeLocations: shaderProgram._attributeLocations
  191267. }
  191268. );
  191269. }
  191270. castRenderState = shadowMap._primitiveRenderState;
  191271. if (isPointLight) {
  191272. castRenderState = shadowMap._pointRenderState;
  191273. } else if (isTerrain) {
  191274. castRenderState = shadowMap._terrainRenderState;
  191275. }
  191276. const cullEnabled = command.renderState.cull.enabled;
  191277. if (!cullEnabled) {
  191278. castRenderState = clone_default(castRenderState, false);
  191279. castRenderState.cull = clone_default(castRenderState.cull, false);
  191280. castRenderState.cull.enabled = false;
  191281. castRenderState = RenderState_default.fromCache(castRenderState);
  191282. }
  191283. castUniformMap = combineUniforms(shadowMap, command.uniformMap, isTerrain);
  191284. }
  191285. result.shaderProgram = castShader;
  191286. result.renderState = castRenderState;
  191287. result.uniformMap = castUniformMap;
  191288. return result;
  191289. }
  191290. ShadowMap.createReceiveDerivedCommand = function(lightShadowMaps, command, shadowsDirty, context, result) {
  191291. if (!defined_default(result)) {
  191292. result = {};
  191293. }
  191294. const lightShadowMapsEnabled = lightShadowMaps.length > 0;
  191295. const shaderProgram = command.shaderProgram;
  191296. const vertexShaderSource = shaderProgram.vertexShaderSource;
  191297. const fragmentShaderSource = shaderProgram.fragmentShaderSource;
  191298. const isTerrain = command.pass === Pass_default.GLOBE;
  191299. let hasTerrainNormal = false;
  191300. if (isTerrain) {
  191301. hasTerrainNormal = command.owner.data.renderedMesh.encoding.hasVertexNormals;
  191302. }
  191303. if (command.receiveShadows && lightShadowMapsEnabled) {
  191304. let receiveShader;
  191305. let receiveUniformMap;
  191306. if (defined_default(result.receiveCommand)) {
  191307. receiveShader = result.receiveCommand.shaderProgram;
  191308. receiveUniformMap = result.receiveCommand.uniformMap;
  191309. }
  191310. result.receiveCommand = DrawCommand_default.shallowClone(
  191311. command,
  191312. result.receiveCommand
  191313. );
  191314. result.castShadows = false;
  191315. result.receiveShadows = true;
  191316. const castShadowsDirty = result.receiveShaderCastShadows !== command.castShadows;
  191317. const shaderDirty = result.receiveShaderProgramId !== command.shaderProgram.id;
  191318. if (!defined_default(receiveShader) || shaderDirty || shadowsDirty || castShadowsDirty) {
  191319. const keyword = ShadowMapShader_default.getShadowReceiveShaderKeyword(
  191320. lightShadowMaps[0],
  191321. command.castShadows,
  191322. isTerrain,
  191323. hasTerrainNormal
  191324. );
  191325. receiveShader = context.shaderCache.getDerivedShaderProgram(
  191326. shaderProgram,
  191327. keyword
  191328. );
  191329. if (!defined_default(receiveShader)) {
  191330. const receiveVS = ShadowMapShader_default.createShadowReceiveVertexShader(
  191331. vertexShaderSource,
  191332. isTerrain,
  191333. hasTerrainNormal
  191334. );
  191335. const receiveFS = ShadowMapShader_default.createShadowReceiveFragmentShader(
  191336. fragmentShaderSource,
  191337. lightShadowMaps[0],
  191338. command.castShadows,
  191339. isTerrain,
  191340. hasTerrainNormal
  191341. );
  191342. receiveShader = context.shaderCache.createDerivedShaderProgram(
  191343. shaderProgram,
  191344. keyword,
  191345. {
  191346. vertexShaderSource: receiveVS,
  191347. fragmentShaderSource: receiveFS,
  191348. attributeLocations: shaderProgram._attributeLocations
  191349. }
  191350. );
  191351. }
  191352. receiveUniformMap = combineUniforms(
  191353. lightShadowMaps[0],
  191354. command.uniformMap,
  191355. isTerrain
  191356. );
  191357. }
  191358. result.receiveCommand.shaderProgram = receiveShader;
  191359. result.receiveCommand.uniformMap = receiveUniformMap;
  191360. result.receiveShaderProgramId = command.shaderProgram.id;
  191361. result.receiveShaderCastShadows = command.castShadows;
  191362. }
  191363. return result;
  191364. };
  191365. ShadowMap.createCastDerivedCommand = function(shadowMaps, command, shadowsDirty, context, result) {
  191366. if (!defined_default(result)) {
  191367. result = {};
  191368. }
  191369. if (command.castShadows) {
  191370. let castCommands = result.castCommands;
  191371. if (!defined_default(castCommands)) {
  191372. castCommands = result.castCommands = [];
  191373. }
  191374. const oldShaderId = result.castShaderProgramId;
  191375. const shadowMapLength = shadowMaps.length;
  191376. castCommands.length = shadowMapLength;
  191377. for (let i2 = 0; i2 < shadowMapLength; ++i2) {
  191378. castCommands[i2] = createCastDerivedCommand(
  191379. shadowMaps[i2],
  191380. shadowsDirty,
  191381. command,
  191382. context,
  191383. oldShaderId,
  191384. castCommands[i2]
  191385. );
  191386. }
  191387. result.castShaderProgramId = command.shaderProgram.id;
  191388. }
  191389. return result;
  191390. };
  191391. ShadowMap.prototype.isDestroyed = function() {
  191392. return false;
  191393. };
  191394. ShadowMap.prototype.destroy = function() {
  191395. destroyFramebuffer2(this);
  191396. this._debugLightFrustum = this._debugLightFrustum && this._debugLightFrustum.destroy();
  191397. this._debugCameraFrustum = this._debugCameraFrustum && this._debugCameraFrustum.destroy();
  191398. this._debugShadowViewCommand = this._debugShadowViewCommand && this._debugShadowViewCommand.shaderProgram && this._debugShadowViewCommand.shaderProgram.destroy();
  191399. for (let i2 = 0; i2 < this._numberOfCascades; ++i2) {
  191400. this._debugCascadeFrustums[i2] = this._debugCascadeFrustums[i2] && this._debugCascadeFrustums[i2].destroy();
  191401. }
  191402. return destroyObject_default(this);
  191403. };
  191404. var ShadowMap_default = ShadowMap;
  191405. // node_modules/cesium/Source/Shaders/CompareAndPackTranslucentDepth.js
  191406. var CompareAndPackTranslucentDepth_default = "uniform sampler2D u_opaqueDepthTexture;\nuniform sampler2D u_translucentDepthTexture;\n\nvarying vec2 v_textureCoordinates;\n\nvoid main()\n{\n float opaqueDepth = texture2D(u_opaqueDepthTexture, v_textureCoordinates).r;\n float translucentDepth = texture2D(u_translucentDepthTexture, v_textureCoordinates).r;\n translucentDepth = czm_branchFreeTernary(translucentDepth > opaqueDepth, 1.0, translucentDepth);\n gl_FragColor = czm_packDepth(translucentDepth);\n}\n";
  191407. // node_modules/cesium/Source/Shaders/PostProcessStages/CompositeTranslucentClassification.js
  191408. var CompositeTranslucentClassification_default = "uniform sampler2D colorTexture;\n\n#ifdef DEBUG_SHOW_DEPTH\nuniform sampler2D u_packedTranslucentDepth;\n#endif\n\nvarying vec2 v_textureCoordinates;\n\nvoid main()\n{\n#ifdef DEBUG_SHOW_DEPTH\n if (v_textureCoordinates.x < 0.5)\n {\n gl_FragColor.rgb = vec3(czm_unpackDepth(texture2D(u_packedTranslucentDepth, v_textureCoordinates)));\n gl_FragColor.a = 1.0;\n }\n#else\n vec4 color = texture2D(colorTexture, v_textureCoordinates);\n\n#ifdef PICK\n if (color == vec4(0.0))\n {\n discard;\n }\n#else\n // Reverse premultiplication process to get the correct composited result of the classification primitives\n color.rgb /= color.a;\n#endif\n gl_FragColor = color;\n#endif\n}\n";
  191409. // node_modules/cesium/Source/Scene/TranslucentTileClassification.js
  191410. var debugShowPackedDepth = false;
  191411. function TranslucentTileClassification(context) {
  191412. this._drawClassificationFBO = new FramebufferManager_default({
  191413. createDepthAttachments: false
  191414. });
  191415. this._accumulationFBO = new FramebufferManager_default({
  191416. createDepthAttachments: false
  191417. });
  191418. this._packFBO = new FramebufferManager_default();
  191419. this._opaqueDepthStencilTexture = void 0;
  191420. this._textureToComposite = void 0;
  191421. this._translucentDepthStencilTexture = void 0;
  191422. this._packDepthCommand = void 0;
  191423. this._accumulateCommand = void 0;
  191424. this._compositeCommand = void 0;
  191425. this._copyCommand = void 0;
  191426. this._clearColorCommand = new ClearCommand_default({
  191427. color: new Color_default(0, 0, 0, 0),
  191428. owner: this
  191429. });
  191430. this._clearDepthStencilCommand = new ClearCommand_default({
  191431. depth: 1,
  191432. stencil: 0,
  191433. owner: this
  191434. });
  191435. this._supported = context.depthTexture;
  191436. this._viewport = new BoundingRectangle_default();
  191437. this._rsDepth = void 0;
  191438. this._rsAccumulate = void 0;
  191439. this._rsComp = void 0;
  191440. this._useScissorTest = void 0;
  191441. this._scissorRectangle = void 0;
  191442. this._hasTranslucentDepth = false;
  191443. this._frustumsDrawn = 0;
  191444. }
  191445. Object.defineProperties(TranslucentTileClassification.prototype, {
  191446. hasTranslucentDepth: {
  191447. get: function() {
  191448. return this._hasTranslucentDepth;
  191449. }
  191450. }
  191451. });
  191452. function destroyTextures2(transpClass) {
  191453. transpClass._textureToComposite = void 0;
  191454. transpClass._translucentDepthStencilTexture = transpClass._translucentDepthStencilTexture && !transpClass._translucentDepthStencilTexture.isDestroyed() && transpClass._translucentDepthStencilTexture.destroy();
  191455. }
  191456. function destroyFramebuffers4(transpClass) {
  191457. transpClass._drawClassificationFBO.destroy();
  191458. transpClass._accumulationFBO.destroy();
  191459. transpClass._packFBO.destroy();
  191460. }
  191461. function updateTextures2(transpClass, context, width, height) {
  191462. destroyTextures2(transpClass);
  191463. transpClass._translucentDepthStencilTexture = new Texture_default({
  191464. context,
  191465. width,
  191466. height,
  191467. pixelFormat: PixelFormat_default.DEPTH_STENCIL,
  191468. pixelDatatype: PixelDatatype_default.UNSIGNED_INT_24_8,
  191469. sampler: Sampler_default.NEAREST
  191470. });
  191471. }
  191472. function updateFramebuffers3(transpClass, context, width, height) {
  191473. destroyFramebuffers4(transpClass);
  191474. transpClass._drawClassificationFBO.setDepthStencilTexture(
  191475. transpClass._translucentDepthStencilTexture
  191476. );
  191477. transpClass._drawClassificationFBO.update(context, width, height);
  191478. transpClass._accumulationFBO.setDepthStencilTexture(
  191479. transpClass._translucentDepthStencilTexture
  191480. );
  191481. transpClass._accumulationFBO.update(context, width, height);
  191482. transpClass._packFBO.update(context, width, height);
  191483. }
  191484. function updateResources2(transpClass, context, passState, globeDepthStencilTexture) {
  191485. if (!transpClass.isSupported()) {
  191486. return;
  191487. }
  191488. transpClass._opaqueDepthStencilTexture = globeDepthStencilTexture;
  191489. const width = transpClass._opaqueDepthStencilTexture.width;
  191490. const height = transpClass._opaqueDepthStencilTexture.height;
  191491. if (transpClass._drawClassificationFBO.isDirty(width, height)) {
  191492. updateTextures2(transpClass, context, width, height);
  191493. updateFramebuffers3(transpClass, context, width, height);
  191494. }
  191495. let fs;
  191496. let uniformMap2;
  191497. if (!defined_default(transpClass._packDepthCommand)) {
  191498. fs = new ShaderSource_default({
  191499. sources: [CompareAndPackTranslucentDepth_default]
  191500. });
  191501. uniformMap2 = {
  191502. u_opaqueDepthTexture: function() {
  191503. return transpClass._opaqueDepthStencilTexture;
  191504. },
  191505. u_translucentDepthTexture: function() {
  191506. return transpClass._translucentDepthStencilTexture;
  191507. }
  191508. };
  191509. transpClass._packDepthCommand = context.createViewportQuadCommand(fs, {
  191510. uniformMap: uniformMap2,
  191511. owner: transpClass
  191512. });
  191513. }
  191514. if (!defined_default(transpClass._compositeCommand)) {
  191515. fs = new ShaderSource_default({
  191516. sources: [CompositeTranslucentClassification_default]
  191517. });
  191518. uniformMap2 = {
  191519. colorTexture: function() {
  191520. return transpClass._textureToComposite;
  191521. }
  191522. };
  191523. if (debugShowPackedDepth) {
  191524. fs.defines = ["DEBUG_SHOW_DEPTH"];
  191525. uniformMap2.u_packedTranslucentDepth = function() {
  191526. return transpClass._packFBO.getColorTexture();
  191527. };
  191528. }
  191529. transpClass._compositeCommand = context.createViewportQuadCommand(fs, {
  191530. uniformMap: uniformMap2,
  191531. owner: transpClass
  191532. });
  191533. const compositeCommand = transpClass._compositeCommand;
  191534. const compositeProgram = compositeCommand.shaderProgram;
  191535. const compositePickProgram = context.shaderCache.createDerivedShaderProgram(
  191536. compositeProgram,
  191537. "pick",
  191538. {
  191539. vertexShaderSource: compositeProgram.vertexShaderSource,
  191540. fragmentShaderSource: new ShaderSource_default({
  191541. sources: fs.sources,
  191542. defines: ["PICK"]
  191543. }),
  191544. attributeLocations: compositeProgram._attributeLocations
  191545. }
  191546. );
  191547. const compositePickCommand = DrawCommand_default.shallowClone(compositeCommand);
  191548. compositePickCommand.shaderProgram = compositePickProgram;
  191549. compositeCommand.derivedCommands.pick = compositePickCommand;
  191550. }
  191551. if (!defined_default(transpClass._copyCommand)) {
  191552. fs = new ShaderSource_default({
  191553. sources: [CompositeTranslucentClassification_default]
  191554. });
  191555. uniformMap2 = {
  191556. colorTexture: function() {
  191557. return transpClass._drawClassificationFBO.getColorTexture();
  191558. }
  191559. };
  191560. transpClass._copyCommand = context.createViewportQuadCommand(fs, {
  191561. uniformMap: uniformMap2,
  191562. owner: transpClass
  191563. });
  191564. }
  191565. if (!defined_default(transpClass._accumulateCommand)) {
  191566. fs = new ShaderSource_default({
  191567. sources: [CompositeTranslucentClassification_default]
  191568. });
  191569. uniformMap2 = {
  191570. colorTexture: function() {
  191571. return transpClass._drawClassificationFBO.getColorTexture();
  191572. }
  191573. };
  191574. transpClass._accumulateCommand = context.createViewportQuadCommand(fs, {
  191575. uniformMap: uniformMap2,
  191576. owner: transpClass
  191577. });
  191578. }
  191579. transpClass._viewport.width = width;
  191580. transpClass._viewport.height = height;
  191581. const useScissorTest = !BoundingRectangle_default.equals(
  191582. transpClass._viewport,
  191583. passState.viewport
  191584. );
  191585. let updateScissor = useScissorTest !== transpClass._useScissorTest;
  191586. transpClass._useScissorTest = useScissorTest;
  191587. if (!BoundingRectangle_default.equals(transpClass._scissorRectangle, passState.viewport)) {
  191588. transpClass._scissorRectangle = BoundingRectangle_default.clone(
  191589. passState.viewport,
  191590. transpClass._scissorRectangle
  191591. );
  191592. updateScissor = true;
  191593. }
  191594. if (!defined_default(transpClass._rsDepth) || !BoundingRectangle_default.equals(
  191595. transpClass._viewport,
  191596. transpClass._rsDepth.viewport
  191597. ) || updateScissor) {
  191598. transpClass._rsDepth = RenderState_default.fromCache({
  191599. viewport: transpClass._viewport,
  191600. scissorTest: {
  191601. enabled: transpClass._useScissorTest,
  191602. rectangle: transpClass._scissorRectangle
  191603. }
  191604. });
  191605. }
  191606. if (defined_default(transpClass._packDepthCommand)) {
  191607. transpClass._packDepthCommand.renderState = transpClass._rsDepth;
  191608. }
  191609. if (!defined_default(transpClass._rsAccumulate) || !BoundingRectangle_default.equals(
  191610. transpClass._viewport,
  191611. transpClass._rsAccumulate.viewport
  191612. ) || updateScissor) {
  191613. transpClass._rsAccumulate = RenderState_default.fromCache({
  191614. viewport: transpClass._viewport,
  191615. scissorTest: {
  191616. enabled: transpClass._useScissorTest,
  191617. rectangle: transpClass._scissorRectangle
  191618. },
  191619. stencilTest: {
  191620. enabled: true,
  191621. frontFunction: StencilFunction_default.EQUAL,
  191622. reference: StencilConstants_default.CESIUM_3D_TILE_MASK
  191623. }
  191624. });
  191625. }
  191626. if (defined_default(transpClass._accumulateCommand)) {
  191627. transpClass._accumulateCommand.renderState = transpClass._rsAccumulate;
  191628. }
  191629. if (!defined_default(transpClass._rsComp) || !BoundingRectangle_default.equals(
  191630. transpClass._viewport,
  191631. transpClass._rsComp.viewport
  191632. ) || updateScissor) {
  191633. transpClass._rsComp = RenderState_default.fromCache({
  191634. viewport: transpClass._viewport,
  191635. scissorTest: {
  191636. enabled: transpClass._useScissorTest,
  191637. rectangle: transpClass._scissorRectangle
  191638. },
  191639. blending: BlendingState_default.ALPHA_BLEND
  191640. });
  191641. }
  191642. if (defined_default(transpClass._compositeCommand)) {
  191643. transpClass._compositeCommand.renderState = transpClass._rsComp;
  191644. transpClass._compositeCommand.derivedCommands.pick.renderState = transpClass._rsComp;
  191645. }
  191646. }
  191647. TranslucentTileClassification.prototype.executeTranslucentCommands = function(scene, executeCommand2, passState, commands, globeDepthStencilTexture) {
  191648. const length3 = commands.length;
  191649. let command;
  191650. let i2;
  191651. const useLogDepth = scene.frameState.useLogDepth;
  191652. const context = scene.context;
  191653. const framebuffer = passState.framebuffer;
  191654. for (i2 = 0; i2 < length3; ++i2) {
  191655. command = commands[i2];
  191656. command = useLogDepth ? command.derivedCommands.logDepth.command : command;
  191657. if (command.depthForTranslucentClassification) {
  191658. this._hasTranslucentDepth = true;
  191659. break;
  191660. }
  191661. }
  191662. if (!this._hasTranslucentDepth) {
  191663. return;
  191664. }
  191665. updateResources2(this, context, passState, globeDepthStencilTexture);
  191666. passState.framebuffer = this._drawClassificationFBO.framebuffer;
  191667. this._clearDepthStencilCommand.execute(context, passState);
  191668. for (i2 = 0; i2 < length3; ++i2) {
  191669. command = commands[i2];
  191670. command = useLogDepth ? command.derivedCommands.logDepth.command : command;
  191671. if (!command.depthForTranslucentClassification) {
  191672. continue;
  191673. }
  191674. const depthOnlyCommand = command.derivedCommands.depth.depthOnlyCommand;
  191675. executeCommand2(depthOnlyCommand, scene, context, passState);
  191676. }
  191677. this._frustumsDrawn += this._hasTranslucentDepth ? 1 : 0;
  191678. if (this._hasTranslucentDepth) {
  191679. passState.framebuffer = this._packFBO.framebuffer;
  191680. this._packDepthCommand.execute(context, passState);
  191681. }
  191682. passState.framebuffer = framebuffer;
  191683. };
  191684. TranslucentTileClassification.prototype.executeClassificationCommands = function(scene, executeCommand2, passState, frustumCommands) {
  191685. if (!this._hasTranslucentDepth) {
  191686. return;
  191687. }
  191688. const context = scene.context;
  191689. const us = context.uniformState;
  191690. const framebuffer = passState.framebuffer;
  191691. if (this._frustumsDrawn === 2) {
  191692. passState.framebuffer = this._accumulationFBO.framebuffer;
  191693. this._copyCommand.execute(context, passState);
  191694. }
  191695. passState.framebuffer = this._drawClassificationFBO.framebuffer;
  191696. if (this._frustumsDrawn > 1) {
  191697. this._clearColorCommand.execute(context, passState);
  191698. }
  191699. us.updatePass(Pass_default.CESIUM_3D_TILE_CLASSIFICATION);
  191700. const swapGlobeDepth = us.globeDepthTexture;
  191701. us.globeDepthTexture = this._packFBO.getColorTexture();
  191702. const commands = frustumCommands.commands[Pass_default.CESIUM_3D_TILE_CLASSIFICATION];
  191703. const length3 = frustumCommands.indices[Pass_default.CESIUM_3D_TILE_CLASSIFICATION];
  191704. for (let i2 = 0; i2 < length3; ++i2) {
  191705. executeCommand2(commands[i2], scene, context, passState);
  191706. }
  191707. us.globeDepthTexture = swapGlobeDepth;
  191708. passState.framebuffer = framebuffer;
  191709. if (this._frustumsDrawn === 1) {
  191710. return;
  191711. }
  191712. passState.framebuffer = this._accumulationFBO.framebuffer;
  191713. this._accumulateCommand.execute(context, passState);
  191714. passState.framebuffer = framebuffer;
  191715. };
  191716. TranslucentTileClassification.prototype.execute = function(scene, passState) {
  191717. if (!this._hasTranslucentDepth) {
  191718. return;
  191719. }
  191720. if (this._frustumsDrawn === 1) {
  191721. this._textureToComposite = this._drawClassificationFBO.getColorTexture();
  191722. } else {
  191723. this._textureToComposite = this._accumulationFBO.getColorTexture();
  191724. }
  191725. const command = scene.frameState.passes.pick ? this._compositeCommand.derivedCommands.pick : this._compositeCommand;
  191726. command.execute(scene.context, passState);
  191727. clear(this, scene, passState);
  191728. };
  191729. function clear(translucentTileClassification, scene, passState) {
  191730. if (!translucentTileClassification._hasTranslucentDepth) {
  191731. return;
  191732. }
  191733. const framebuffer = passState.framebuffer;
  191734. passState.framebuffer = translucentTileClassification._drawClassificationFBO.framebuffer;
  191735. translucentTileClassification._clearColorCommand.execute(
  191736. scene._context,
  191737. passState
  191738. );
  191739. passState.framebuffer = framebuffer;
  191740. if (translucentTileClassification._frustumsDrawn > 1) {
  191741. passState.framebuffer = translucentTileClassification._accumulationFBO.framebuffer;
  191742. translucentTileClassification._clearColorCommand.execute(
  191743. scene._context,
  191744. passState
  191745. );
  191746. }
  191747. translucentTileClassification._hasTranslucentDepth = false;
  191748. translucentTileClassification._frustumsDrawn = 0;
  191749. }
  191750. TranslucentTileClassification.prototype.isSupported = function() {
  191751. return this._supported;
  191752. };
  191753. TranslucentTileClassification.prototype.isDestroyed = function() {
  191754. return false;
  191755. };
  191756. TranslucentTileClassification.prototype.destroy = function() {
  191757. destroyTextures2(this);
  191758. destroyFramebuffers4(this);
  191759. if (defined_default(this._compositeCommand)) {
  191760. this._compositeCommand.shaderProgram = this._compositeCommand.shaderProgram && this._compositeCommand.shaderProgram.destroy();
  191761. }
  191762. if (defined_default(this._packDepthCommand)) {
  191763. this._packDepthCommand.shaderProgram = this._packDepthCommand.shaderProgram && this._packDepthCommand.shaderProgram.destroy();
  191764. }
  191765. return destroyObject_default(this);
  191766. };
  191767. var TranslucentTileClassification_default = TranslucentTileClassification;
  191768. // node_modules/cesium/Source/Scene/View.js
  191769. function CommandExtent() {
  191770. this.command = void 0;
  191771. this.near = void 0;
  191772. this.far = void 0;
  191773. }
  191774. function View(scene, camera, viewport) {
  191775. const context = scene.context;
  191776. let globeDepth;
  191777. if (context.depthTexture) {
  191778. globeDepth = new GlobeDepth_default();
  191779. }
  191780. let oit;
  191781. if (scene._useOIT && context.depthTexture) {
  191782. oit = new OIT_default(context);
  191783. }
  191784. const passState = new PassState_default(context);
  191785. passState.viewport = BoundingRectangle_default.clone(viewport);
  191786. this.camera = camera;
  191787. this._cameraClone = Camera_default.clone(camera);
  191788. this._cameraStartFired = false;
  191789. this._cameraMovedTime = void 0;
  191790. this.viewport = viewport;
  191791. this.passState = passState;
  191792. this.pickFramebuffer = new PickFramebuffer_default(context);
  191793. this.pickDepthFramebuffer = new PickDepthFramebuffer_default();
  191794. this.sceneFramebuffer = new SceneFramebuffer_default();
  191795. this.globeDepth = globeDepth;
  191796. this.globeTranslucencyFramebuffer = new GlobeTranslucencyFramebuffer_default();
  191797. this.oit = oit;
  191798. this.translucentTileClassification = new TranslucentTileClassification_default(
  191799. context
  191800. );
  191801. this.pickDepths = [];
  191802. this.frustumCommandsList = [];
  191803. this.debugFrustumStatistics = void 0;
  191804. this._commandExtents = [];
  191805. }
  191806. var scratchPosition0 = new Cartesian3_default();
  191807. var scratchPosition1 = new Cartesian3_default();
  191808. function maxComponent(a4, b) {
  191809. const x = Math.max(Math.abs(a4.x), Math.abs(b.x));
  191810. const y = Math.max(Math.abs(a4.y), Math.abs(b.y));
  191811. const z = Math.max(Math.abs(a4.z), Math.abs(b.z));
  191812. return Math.max(Math.max(x, y), z);
  191813. }
  191814. function cameraEqual(camera0, camera1, epsilon) {
  191815. const scalar = 1 / Math.max(1, maxComponent(camera0.position, camera1.position));
  191816. Cartesian3_default.multiplyByScalar(camera0.position, scalar, scratchPosition0);
  191817. Cartesian3_default.multiplyByScalar(camera1.position, scalar, scratchPosition1);
  191818. return Cartesian3_default.equalsEpsilon(scratchPosition0, scratchPosition1, epsilon) && Cartesian3_default.equalsEpsilon(camera0.direction, camera1.direction, epsilon) && Cartesian3_default.equalsEpsilon(camera0.up, camera1.up, epsilon) && Cartesian3_default.equalsEpsilon(camera0.right, camera1.right, epsilon) && Matrix4_default.equalsEpsilon(camera0.transform, camera1.transform, epsilon) && camera0.frustum.equalsEpsilon(camera1.frustum, epsilon);
  191819. }
  191820. View.prototype.checkForCameraUpdates = function(scene) {
  191821. const camera = this.camera;
  191822. const cameraClone = this._cameraClone;
  191823. if (!cameraEqual(camera, cameraClone, Math_default.EPSILON15)) {
  191824. if (!this._cameraStartFired) {
  191825. camera.moveStart.raiseEvent();
  191826. this._cameraStartFired = true;
  191827. }
  191828. this._cameraMovedTime = getTimestamp_default();
  191829. Camera_default.clone(camera, cameraClone);
  191830. return true;
  191831. }
  191832. if (this._cameraStartFired && getTimestamp_default() - this._cameraMovedTime > scene.cameraEventWaitTime) {
  191833. camera.moveEnd.raiseEvent();
  191834. this._cameraStartFired = false;
  191835. }
  191836. return false;
  191837. };
  191838. function updateFrustums(view, scene, near, far) {
  191839. const frameState = scene.frameState;
  191840. const camera = frameState.camera;
  191841. const farToNearRatio = frameState.useLogDepth ? scene.logarithmicDepthFarToNearRatio : scene.farToNearRatio;
  191842. const is2D = scene.mode === SceneMode_default.SCENE2D;
  191843. const nearToFarDistance2D = scene.nearToFarDistance2D;
  191844. far *= 1 + Math_default.EPSILON2;
  191845. near = Math.min(Math.max(near, camera.frustum.near), camera.frustum.far);
  191846. far = Math.max(Math.min(far, camera.frustum.far), near);
  191847. let numFrustums;
  191848. if (is2D) {
  191849. far = Math.min(far, camera.position.z + scene.nearToFarDistance2D);
  191850. near = Math.min(near, far);
  191851. numFrustums = Math.ceil(
  191852. Math.max(1, far - near) / scene.nearToFarDistance2D
  191853. );
  191854. } else {
  191855. numFrustums = Math.ceil(Math.log(far / near) / Math.log(farToNearRatio));
  191856. }
  191857. const frustumCommandsList = view.frustumCommandsList;
  191858. frustumCommandsList.length = numFrustums;
  191859. for (let m = 0; m < numFrustums; ++m) {
  191860. let curNear;
  191861. let curFar;
  191862. if (is2D) {
  191863. curNear = Math.min(
  191864. far - nearToFarDistance2D,
  191865. near + m * nearToFarDistance2D
  191866. );
  191867. curFar = Math.min(far, curNear + nearToFarDistance2D);
  191868. } else {
  191869. curNear = Math.max(near, Math.pow(farToNearRatio, m) * near);
  191870. curFar = Math.min(far, farToNearRatio * curNear);
  191871. }
  191872. let frustumCommands = frustumCommandsList[m];
  191873. if (!defined_default(frustumCommands)) {
  191874. frustumCommands = frustumCommandsList[m] = new FrustumCommands_default(
  191875. curNear,
  191876. curFar
  191877. );
  191878. } else {
  191879. frustumCommands.near = curNear;
  191880. frustumCommands.far = curFar;
  191881. }
  191882. }
  191883. }
  191884. function insertIntoBin(view, scene, command, commandNear, commandFar) {
  191885. if (scene.debugShowFrustums) {
  191886. command.debugOverlappingFrustums = 0;
  191887. }
  191888. const frustumCommandsList = view.frustumCommandsList;
  191889. const length3 = frustumCommandsList.length;
  191890. for (let i2 = 0; i2 < length3; ++i2) {
  191891. const frustumCommands = frustumCommandsList[i2];
  191892. const curNear = frustumCommands.near;
  191893. const curFar = frustumCommands.far;
  191894. if (commandNear > curFar) {
  191895. continue;
  191896. }
  191897. if (commandFar < curNear) {
  191898. break;
  191899. }
  191900. const pass = command.pass;
  191901. const index2 = frustumCommands.indices[pass]++;
  191902. frustumCommands.commands[pass][index2] = command;
  191903. if (scene.debugShowFrustums) {
  191904. command.debugOverlappingFrustums |= 1 << i2;
  191905. }
  191906. if (command.executeInClosestFrustum) {
  191907. break;
  191908. }
  191909. }
  191910. if (scene.debugShowFrustums) {
  191911. const cf = view.debugFrustumStatistics.commandsInFrustums;
  191912. cf[command.debugOverlappingFrustums] = defined_default(
  191913. cf[command.debugOverlappingFrustums]
  191914. ) ? cf[command.debugOverlappingFrustums] + 1 : 1;
  191915. ++view.debugFrustumStatistics.totalCommands;
  191916. }
  191917. scene.updateDerivedCommands(command);
  191918. }
  191919. var scratchCullingVolume = new CullingVolume_default();
  191920. var scratchNearFarInterval = new Interval_default();
  191921. View.prototype.createPotentiallyVisibleSet = function(scene) {
  191922. const frameState = scene.frameState;
  191923. const camera = frameState.camera;
  191924. const direction2 = camera.directionWC;
  191925. const position = camera.positionWC;
  191926. const computeList = scene._computeCommandList;
  191927. const overlayList = scene._overlayCommandList;
  191928. const commandList = frameState.commandList;
  191929. if (scene.debugShowFrustums) {
  191930. this.debugFrustumStatistics = {
  191931. totalCommands: 0,
  191932. commandsInFrustums: {}
  191933. };
  191934. }
  191935. const frustumCommandsList = this.frustumCommandsList;
  191936. const numberOfFrustums = frustumCommandsList.length;
  191937. const numberOfPasses = Pass_default.NUMBER_OF_PASSES;
  191938. for (let n2 = 0; n2 < numberOfFrustums; ++n2) {
  191939. for (let p2 = 0; p2 < numberOfPasses; ++p2) {
  191940. frustumCommandsList[n2].indices[p2] = 0;
  191941. }
  191942. }
  191943. computeList.length = 0;
  191944. overlayList.length = 0;
  191945. const commandExtents = this._commandExtents;
  191946. const commandExtentCapacity = commandExtents.length;
  191947. let commandExtentCount = 0;
  191948. let near = +Number.MAX_VALUE;
  191949. let far = -Number.MAX_VALUE;
  191950. const shadowsEnabled = frameState.shadowState.shadowsEnabled;
  191951. let shadowNear = +Number.MAX_VALUE;
  191952. let shadowFar = -Number.MAX_VALUE;
  191953. let shadowClosestObjectSize = Number.MAX_VALUE;
  191954. const occluder = frameState.mode === SceneMode_default.SCENE3D ? frameState.occluder : void 0;
  191955. let cullingVolume = frameState.cullingVolume;
  191956. const planes = scratchCullingVolume.planes;
  191957. for (let k = 0; k < 5; ++k) {
  191958. planes[k] = cullingVolume.planes[k];
  191959. }
  191960. cullingVolume = scratchCullingVolume;
  191961. const length3 = commandList.length;
  191962. for (let i2 = 0; i2 < length3; ++i2) {
  191963. const command = commandList[i2];
  191964. const pass = command.pass;
  191965. if (pass === Pass_default.COMPUTE) {
  191966. computeList.push(command);
  191967. } else if (pass === Pass_default.OVERLAY) {
  191968. overlayList.push(command);
  191969. } else {
  191970. let commandNear;
  191971. let commandFar;
  191972. const boundingVolume = command.boundingVolume;
  191973. if (defined_default(boundingVolume)) {
  191974. if (!scene.isVisible(command, cullingVolume, occluder)) {
  191975. continue;
  191976. }
  191977. const nearFarInterval = boundingVolume.computePlaneDistances(
  191978. position,
  191979. direction2,
  191980. scratchNearFarInterval
  191981. );
  191982. commandNear = nearFarInterval.start;
  191983. commandFar = nearFarInterval.stop;
  191984. near = Math.min(near, commandNear);
  191985. far = Math.max(far, commandFar);
  191986. if (shadowsEnabled && command.receiveShadows && commandNear < ShadowMap_default.MAXIMUM_DISTANCE && !(pass === Pass_default.GLOBE && commandNear < -100 && commandFar > 100)) {
  191987. const size = commandFar - commandNear;
  191988. if (pass !== Pass_default.GLOBE && commandNear < 100) {
  191989. shadowClosestObjectSize = Math.min(shadowClosestObjectSize, size);
  191990. }
  191991. shadowNear = Math.min(shadowNear, commandNear);
  191992. shadowFar = Math.max(shadowFar, commandFar);
  191993. }
  191994. } else if (command instanceof ClearCommand_default) {
  191995. commandNear = camera.frustum.near;
  191996. commandFar = camera.frustum.far;
  191997. } else {
  191998. commandNear = camera.frustum.near;
  191999. commandFar = camera.frustum.far;
  192000. near = Math.min(near, commandNear);
  192001. far = Math.max(far, commandFar);
  192002. }
  192003. let extent = commandExtents[commandExtentCount];
  192004. if (!defined_default(extent)) {
  192005. extent = commandExtents[commandExtentCount] = new CommandExtent();
  192006. }
  192007. extent.command = command;
  192008. extent.near = commandNear;
  192009. extent.far = commandFar;
  192010. commandExtentCount++;
  192011. }
  192012. }
  192013. if (shadowsEnabled) {
  192014. shadowNear = Math.min(
  192015. Math.max(shadowNear, camera.frustum.near),
  192016. camera.frustum.far
  192017. );
  192018. shadowFar = Math.max(Math.min(shadowFar, camera.frustum.far), shadowNear);
  192019. }
  192020. if (shadowsEnabled) {
  192021. frameState.shadowState.nearPlane = shadowNear;
  192022. frameState.shadowState.farPlane = shadowFar;
  192023. frameState.shadowState.closestObjectSize = shadowClosestObjectSize;
  192024. }
  192025. updateFrustums(this, scene, near, far);
  192026. let c14;
  192027. let ce;
  192028. for (c14 = 0; c14 < commandExtentCount; c14++) {
  192029. ce = commandExtents[c14];
  192030. insertIntoBin(this, scene, ce.command, ce.near, ce.far);
  192031. }
  192032. if (commandExtentCount < commandExtentCapacity) {
  192033. for (c14 = commandExtentCount; c14 < commandExtentCapacity; c14++) {
  192034. ce = commandExtents[c14];
  192035. if (!defined_default(ce.command)) {
  192036. break;
  192037. }
  192038. ce.command = void 0;
  192039. }
  192040. }
  192041. const numFrustums = frustumCommandsList.length;
  192042. const frustumSplits2 = frameState.frustumSplits;
  192043. frustumSplits2.length = numFrustums + 1;
  192044. for (let j = 0; j < numFrustums; ++j) {
  192045. frustumSplits2[j] = frustumCommandsList[j].near;
  192046. if (j === numFrustums - 1) {
  192047. frustumSplits2[j + 1] = frustumCommandsList[j].far;
  192048. }
  192049. }
  192050. };
  192051. View.prototype.destroy = function() {
  192052. this.pickFramebuffer = this.pickFramebuffer && this.pickFramebuffer.destroy();
  192053. this.pickDepthFramebuffer = this.pickDepthFramebuffer && this.pickDepthFramebuffer.destroy();
  192054. this.sceneFramebuffer = this.sceneFramebuffer && this.sceneFramebuffer.destroy();
  192055. this.globeDepth = this.globeDepth && this.globeDepth.destroy();
  192056. this.oit = this.oit && this.oit.destroy();
  192057. this.translucentTileClassification = this.translucentTileClassification && this.translucentTileClassification.destroy();
  192058. this.globeTranslucencyFramebuffer = this.globeTranslucencyFramebuffer && this.globeTranslucencyFramebuffer.destroy();
  192059. let i2;
  192060. const pickDepths = this.pickDepths;
  192061. const length3 = pickDepths.length;
  192062. for (i2 = 0; i2 < length3; ++i2) {
  192063. pickDepths[i2].destroy();
  192064. }
  192065. };
  192066. var View_default = View;
  192067. // node_modules/cesium/Source/Scene/Picking.js
  192068. var offscreenDefaultWidth = 0.1;
  192069. var mostDetailedPreloadTilesetPassState = new Cesium3DTilePassState_default({
  192070. pass: Cesium3DTilePass_default.MOST_DETAILED_PRELOAD
  192071. });
  192072. var mostDetailedPickTilesetPassState = new Cesium3DTilePassState_default({
  192073. pass: Cesium3DTilePass_default.MOST_DETAILED_PICK
  192074. });
  192075. var pickTilesetPassState = new Cesium3DTilePassState_default({
  192076. pass: Cesium3DTilePass_default.PICK
  192077. });
  192078. function Picking(scene) {
  192079. this._mostDetailedRayPicks = [];
  192080. this.pickRenderStateCache = {};
  192081. this._pickPositionCache = {};
  192082. this._pickPositionCacheDirty = false;
  192083. const pickOffscreenViewport = new BoundingRectangle_default(0, 0, 1, 1);
  192084. const pickOffscreenCamera = new Camera_default(scene);
  192085. pickOffscreenCamera.frustum = new OrthographicFrustum_default({
  192086. width: offscreenDefaultWidth,
  192087. aspectRatio: 1,
  192088. near: 0.1
  192089. });
  192090. this._pickOffscreenView = new View_default(
  192091. scene,
  192092. pickOffscreenCamera,
  192093. pickOffscreenViewport
  192094. );
  192095. }
  192096. Picking.prototype.update = function() {
  192097. this._pickPositionCacheDirty = true;
  192098. };
  192099. Picking.prototype.getPickDepth = function(scene, index2) {
  192100. const pickDepths = scene.view.pickDepths;
  192101. let pickDepth = pickDepths[index2];
  192102. if (!defined_default(pickDepth)) {
  192103. pickDepth = new PickDepth_default();
  192104. pickDepths[index2] = pickDepth;
  192105. }
  192106. return pickDepth;
  192107. };
  192108. var scratchOrthoPickingFrustum = new OrthographicOffCenterFrustum_default();
  192109. var scratchOrthoOrigin = new Cartesian3_default();
  192110. var scratchOrthoDirection = new Cartesian3_default();
  192111. var scratchOrthoPixelSize = new Cartesian2_default();
  192112. var scratchOrthoPickVolumeMatrix4 = new Matrix4_default();
  192113. function getPickOrthographicCullingVolume(scene, drawingBufferPosition, width, height, viewport) {
  192114. const camera = scene.camera;
  192115. let frustum = camera.frustum;
  192116. if (defined_default(frustum._offCenterFrustum)) {
  192117. frustum = frustum._offCenterFrustum;
  192118. }
  192119. let x = 2 * (drawingBufferPosition.x - viewport.x) / viewport.width - 1;
  192120. x *= (frustum.right - frustum.left) * 0.5;
  192121. let y = 2 * (viewport.height - drawingBufferPosition.y - viewport.y) / viewport.height - 1;
  192122. y *= (frustum.top - frustum.bottom) * 0.5;
  192123. const transform4 = Matrix4_default.clone(
  192124. camera.transform,
  192125. scratchOrthoPickVolumeMatrix4
  192126. );
  192127. camera._setTransform(Matrix4_default.IDENTITY);
  192128. const origin = Cartesian3_default.clone(camera.position, scratchOrthoOrigin);
  192129. Cartesian3_default.multiplyByScalar(camera.right, x, scratchOrthoDirection);
  192130. Cartesian3_default.add(scratchOrthoDirection, origin, origin);
  192131. Cartesian3_default.multiplyByScalar(camera.up, y, scratchOrthoDirection);
  192132. Cartesian3_default.add(scratchOrthoDirection, origin, origin);
  192133. camera._setTransform(transform4);
  192134. if (scene.mode === SceneMode_default.SCENE2D) {
  192135. Cartesian3_default.fromElements(origin.z, origin.x, origin.y, origin);
  192136. }
  192137. const pixelSize = frustum.getPixelDimensions(
  192138. viewport.width,
  192139. viewport.height,
  192140. 1,
  192141. 1,
  192142. scratchOrthoPixelSize
  192143. );
  192144. const ortho = scratchOrthoPickingFrustum;
  192145. ortho.right = pixelSize.x * 0.5;
  192146. ortho.left = -ortho.right;
  192147. ortho.top = pixelSize.y * 0.5;
  192148. ortho.bottom = -ortho.top;
  192149. ortho.near = frustum.near;
  192150. ortho.far = frustum.far;
  192151. return ortho.computeCullingVolume(origin, camera.directionWC, camera.upWC);
  192152. }
  192153. var scratchPerspPickingFrustum = new PerspectiveOffCenterFrustum_default();
  192154. var scratchPerspPixelSize = new Cartesian2_default();
  192155. function getPickPerspectiveCullingVolume(scene, drawingBufferPosition, width, height, viewport) {
  192156. const camera = scene.camera;
  192157. const frustum = camera.frustum;
  192158. const near = frustum.near;
  192159. const tanPhi = Math.tan(frustum.fovy * 0.5);
  192160. const tanTheta = frustum.aspectRatio * tanPhi;
  192161. const x = 2 * (drawingBufferPosition.x - viewport.x) / viewport.width - 1;
  192162. const y = 2 * (viewport.height - drawingBufferPosition.y - viewport.y) / viewport.height - 1;
  192163. const xDir = x * near * tanTheta;
  192164. const yDir = y * near * tanPhi;
  192165. const pixelSize = frustum.getPixelDimensions(
  192166. viewport.width,
  192167. viewport.height,
  192168. 1,
  192169. 1,
  192170. scratchPerspPixelSize
  192171. );
  192172. const pickWidth = pixelSize.x * width * 0.5;
  192173. const pickHeight = pixelSize.y * height * 0.5;
  192174. const offCenter = scratchPerspPickingFrustum;
  192175. offCenter.top = yDir + pickHeight;
  192176. offCenter.bottom = yDir - pickHeight;
  192177. offCenter.right = xDir + pickWidth;
  192178. offCenter.left = xDir - pickWidth;
  192179. offCenter.near = near;
  192180. offCenter.far = frustum.far;
  192181. return offCenter.computeCullingVolume(
  192182. camera.positionWC,
  192183. camera.directionWC,
  192184. camera.upWC
  192185. );
  192186. }
  192187. function getPickCullingVolume(scene, drawingBufferPosition, width, height, viewport) {
  192188. const frustum = scene.camera.frustum;
  192189. if (frustum instanceof OrthographicFrustum_default || frustum instanceof OrthographicOffCenterFrustum_default) {
  192190. return getPickOrthographicCullingVolume(
  192191. scene,
  192192. drawingBufferPosition,
  192193. width,
  192194. height,
  192195. viewport
  192196. );
  192197. }
  192198. return getPickPerspectiveCullingVolume(
  192199. scene,
  192200. drawingBufferPosition,
  192201. width,
  192202. height,
  192203. viewport
  192204. );
  192205. }
  192206. var scratchRectangleWidth = 3;
  192207. var scratchRectangleHeight = 3;
  192208. var scratchRectangle9 = new BoundingRectangle_default(
  192209. 0,
  192210. 0,
  192211. scratchRectangleWidth,
  192212. scratchRectangleHeight
  192213. );
  192214. var scratchPosition15 = new Cartesian2_default();
  192215. var scratchColorZero = new Color_default(0, 0, 0, 0);
  192216. Picking.prototype.pick = function(scene, windowPosition, width, height) {
  192217. if (!defined_default(windowPosition)) {
  192218. throw new DeveloperError_default("windowPosition is undefined.");
  192219. }
  192220. scratchRectangleWidth = defaultValue_default(width, 3);
  192221. scratchRectangleHeight = defaultValue_default(height, scratchRectangleWidth);
  192222. const context = scene.context;
  192223. const us = context.uniformState;
  192224. const frameState = scene.frameState;
  192225. const view = scene.defaultView;
  192226. scene.view = view;
  192227. const viewport = view.viewport;
  192228. viewport.x = 0;
  192229. viewport.y = 0;
  192230. viewport.width = context.drawingBufferWidth;
  192231. viewport.height = context.drawingBufferHeight;
  192232. let passState = view.passState;
  192233. passState.viewport = BoundingRectangle_default.clone(viewport, passState.viewport);
  192234. const drawingBufferPosition = SceneTransforms_default.transformWindowToDrawingBuffer(
  192235. scene,
  192236. windowPosition,
  192237. scratchPosition15
  192238. );
  192239. scene.jobScheduler.disableThisFrame();
  192240. scene.updateFrameState();
  192241. frameState.cullingVolume = getPickCullingVolume(
  192242. scene,
  192243. drawingBufferPosition,
  192244. scratchRectangleWidth,
  192245. scratchRectangleHeight,
  192246. viewport
  192247. );
  192248. frameState.invertClassification = false;
  192249. frameState.passes.pick = true;
  192250. frameState.tilesetPassState = pickTilesetPassState;
  192251. us.update(frameState);
  192252. scene.updateEnvironment();
  192253. scratchRectangle9.x = drawingBufferPosition.x - (scratchRectangleWidth - 1) * 0.5;
  192254. scratchRectangle9.y = scene.drawingBufferHeight - drawingBufferPosition.y - (scratchRectangleHeight - 1) * 0.5;
  192255. scratchRectangle9.width = scratchRectangleWidth;
  192256. scratchRectangle9.height = scratchRectangleHeight;
  192257. passState = view.pickFramebuffer.begin(scratchRectangle9, view.viewport);
  192258. scene.updateAndExecuteCommands(passState, scratchColorZero);
  192259. scene.resolveFramebuffers(passState);
  192260. const object2 = view.pickFramebuffer.end(scratchRectangle9);
  192261. context.endFrame();
  192262. return object2;
  192263. };
  192264. function renderTranslucentDepthForPick(scene, drawingBufferPosition) {
  192265. const context = scene.context;
  192266. const frameState = scene.frameState;
  192267. const environmentState = scene.environmentState;
  192268. const view = scene.defaultView;
  192269. scene.view = view;
  192270. const viewport = view.viewport;
  192271. viewport.x = 0;
  192272. viewport.y = 0;
  192273. viewport.width = context.drawingBufferWidth;
  192274. viewport.height = context.drawingBufferHeight;
  192275. let passState = view.passState;
  192276. passState.viewport = BoundingRectangle_default.clone(viewport, passState.viewport);
  192277. scene.clearPasses(frameState.passes);
  192278. frameState.passes.pick = true;
  192279. frameState.passes.depth = true;
  192280. frameState.cullingVolume = getPickCullingVolume(
  192281. scene,
  192282. drawingBufferPosition,
  192283. 1,
  192284. 1,
  192285. viewport
  192286. );
  192287. frameState.tilesetPassState = pickTilesetPassState;
  192288. scene.updateEnvironment();
  192289. environmentState.renderTranslucentDepthForPick = true;
  192290. passState = view.pickDepthFramebuffer.update(
  192291. context,
  192292. drawingBufferPosition,
  192293. viewport
  192294. );
  192295. scene.updateAndExecuteCommands(passState, scratchColorZero);
  192296. scene.resolveFramebuffers(passState);
  192297. context.endFrame();
  192298. }
  192299. var scratchPerspectiveFrustum = new PerspectiveFrustum_default();
  192300. var scratchPerspectiveOffCenterFrustum = new PerspectiveOffCenterFrustum_default();
  192301. var scratchOrthographicFrustum = new OrthographicFrustum_default();
  192302. var scratchOrthographicOffCenterFrustum = new OrthographicOffCenterFrustum_default();
  192303. Picking.prototype.pickPositionWorldCoordinates = function(scene, windowPosition, result) {
  192304. if (!scene.useDepthPicking) {
  192305. return void 0;
  192306. }
  192307. if (!defined_default(windowPosition)) {
  192308. throw new DeveloperError_default("windowPosition is undefined.");
  192309. }
  192310. if (!scene.context.depthTexture) {
  192311. throw new DeveloperError_default(
  192312. "Picking from the depth buffer is not supported. Check pickPositionSupported."
  192313. );
  192314. }
  192315. const cacheKey = windowPosition.toString();
  192316. if (this._pickPositionCacheDirty) {
  192317. this._pickPositionCache = {};
  192318. this._pickPositionCacheDirty = false;
  192319. } else if (this._pickPositionCache.hasOwnProperty(cacheKey)) {
  192320. return Cartesian3_default.clone(this._pickPositionCache[cacheKey], result);
  192321. }
  192322. const frameState = scene.frameState;
  192323. const context = scene.context;
  192324. const uniformState = context.uniformState;
  192325. const view = scene.defaultView;
  192326. scene.view = view;
  192327. const drawingBufferPosition = SceneTransforms_default.transformWindowToDrawingBuffer(
  192328. scene,
  192329. windowPosition,
  192330. scratchPosition15
  192331. );
  192332. if (scene.pickTranslucentDepth) {
  192333. renderTranslucentDepthForPick(scene, drawingBufferPosition);
  192334. } else {
  192335. scene.updateFrameState();
  192336. uniformState.update(frameState);
  192337. scene.updateEnvironment();
  192338. }
  192339. drawingBufferPosition.y = scene.drawingBufferHeight - drawingBufferPosition.y;
  192340. const camera = scene.camera;
  192341. let frustum;
  192342. if (defined_default(camera.frustum.fov)) {
  192343. frustum = camera.frustum.clone(scratchPerspectiveFrustum);
  192344. } else if (defined_default(camera.frustum.infiniteProjectionMatrix)) {
  192345. frustum = camera.frustum.clone(scratchPerspectiveOffCenterFrustum);
  192346. } else if (defined_default(camera.frustum.width)) {
  192347. frustum = camera.frustum.clone(scratchOrthographicFrustum);
  192348. } else {
  192349. frustum = camera.frustum.clone(scratchOrthographicOffCenterFrustum);
  192350. }
  192351. const frustumCommandsList = view.frustumCommandsList;
  192352. const numFrustums = frustumCommandsList.length;
  192353. for (let i2 = 0; i2 < numFrustums; ++i2) {
  192354. const pickDepth = this.getPickDepth(scene, i2);
  192355. const depth = pickDepth.getDepth(
  192356. context,
  192357. drawingBufferPosition.x,
  192358. drawingBufferPosition.y
  192359. );
  192360. if (!defined_default(depth)) {
  192361. continue;
  192362. }
  192363. if (depth > 0 && depth < 1) {
  192364. const renderedFrustum = frustumCommandsList[i2];
  192365. let height2D;
  192366. if (scene.mode === SceneMode_default.SCENE2D) {
  192367. height2D = camera.position.z;
  192368. camera.position.z = height2D - renderedFrustum.near + 1;
  192369. frustum.far = Math.max(1, renderedFrustum.far - renderedFrustum.near);
  192370. frustum.near = 1;
  192371. uniformState.update(frameState);
  192372. uniformState.updateFrustum(frustum);
  192373. } else {
  192374. frustum.near = renderedFrustum.near * (i2 !== 0 ? scene.opaqueFrustumNearOffset : 1);
  192375. frustum.far = renderedFrustum.far;
  192376. uniformState.updateFrustum(frustum);
  192377. }
  192378. result = SceneTransforms_default.drawingBufferToWgs84Coordinates(
  192379. scene,
  192380. drawingBufferPosition,
  192381. depth,
  192382. result
  192383. );
  192384. if (scene.mode === SceneMode_default.SCENE2D) {
  192385. camera.position.z = height2D;
  192386. uniformState.update(frameState);
  192387. }
  192388. this._pickPositionCache[cacheKey] = Cartesian3_default.clone(result);
  192389. return result;
  192390. }
  192391. }
  192392. this._pickPositionCache[cacheKey] = void 0;
  192393. return void 0;
  192394. };
  192395. var scratchPickPositionCartographic = new Cartographic_default();
  192396. Picking.prototype.pickPosition = function(scene, windowPosition, result) {
  192397. result = this.pickPositionWorldCoordinates(scene, windowPosition, result);
  192398. if (defined_default(result) && scene.mode !== SceneMode_default.SCENE3D) {
  192399. Cartesian3_default.fromElements(result.y, result.z, result.x, result);
  192400. const projection = scene.mapProjection;
  192401. const ellipsoid = projection.ellipsoid;
  192402. const cart = projection.unproject(result, scratchPickPositionCartographic);
  192403. ellipsoid.cartographicToCartesian(cart, result);
  192404. }
  192405. return result;
  192406. };
  192407. function drillPick(limit, pickCallback) {
  192408. let i2;
  192409. let attributes;
  192410. const result = [];
  192411. const pickedPrimitives = [];
  192412. const pickedAttributes = [];
  192413. const pickedFeatures = [];
  192414. if (!defined_default(limit)) {
  192415. limit = Number.MAX_VALUE;
  192416. }
  192417. let pickedResult = pickCallback();
  192418. while (defined_default(pickedResult)) {
  192419. const object2 = pickedResult.object;
  192420. const position = pickedResult.position;
  192421. const exclude = pickedResult.exclude;
  192422. if (defined_default(position) && !defined_default(object2)) {
  192423. result.push(pickedResult);
  192424. break;
  192425. }
  192426. if (!defined_default(object2) || !defined_default(object2.primitive)) {
  192427. break;
  192428. }
  192429. if (!exclude) {
  192430. result.push(pickedResult);
  192431. if (0 >= --limit) {
  192432. break;
  192433. }
  192434. }
  192435. const primitive = object2.primitive;
  192436. let hasShowAttribute = false;
  192437. if (typeof primitive.getGeometryInstanceAttributes === "function") {
  192438. if (defined_default(object2.id)) {
  192439. attributes = primitive.getGeometryInstanceAttributes(object2.id);
  192440. if (defined_default(attributes) && defined_default(attributes.show)) {
  192441. hasShowAttribute = true;
  192442. attributes.show = ShowGeometryInstanceAttribute_default.toValue(
  192443. false,
  192444. attributes.show
  192445. );
  192446. pickedAttributes.push(attributes);
  192447. }
  192448. }
  192449. }
  192450. if (object2 instanceof Cesium3DTileFeature_default) {
  192451. hasShowAttribute = true;
  192452. object2.show = false;
  192453. pickedFeatures.push(object2);
  192454. }
  192455. if (!hasShowAttribute) {
  192456. primitive.show = false;
  192457. pickedPrimitives.push(primitive);
  192458. }
  192459. pickedResult = pickCallback();
  192460. }
  192461. for (i2 = 0; i2 < pickedPrimitives.length; ++i2) {
  192462. pickedPrimitives[i2].show = true;
  192463. }
  192464. for (i2 = 0; i2 < pickedAttributes.length; ++i2) {
  192465. attributes = pickedAttributes[i2];
  192466. attributes.show = ShowGeometryInstanceAttribute_default.toValue(
  192467. true,
  192468. attributes.show
  192469. );
  192470. }
  192471. for (i2 = 0; i2 < pickedFeatures.length; ++i2) {
  192472. pickedFeatures[i2].show = true;
  192473. }
  192474. return result;
  192475. }
  192476. Picking.prototype.drillPick = function(scene, windowPosition, limit, width, height) {
  192477. const that = this;
  192478. const pickCallback = function() {
  192479. const object2 = that.pick(scene, windowPosition, width, height);
  192480. if (defined_default(object2)) {
  192481. return {
  192482. object: object2,
  192483. position: void 0,
  192484. exclude: false
  192485. };
  192486. }
  192487. };
  192488. const objects = drillPick(limit, pickCallback);
  192489. return objects.map(function(element) {
  192490. return element.object;
  192491. });
  192492. };
  192493. var scratchRight4 = new Cartesian3_default();
  192494. var scratchUp3 = new Cartesian3_default();
  192495. function MostDetailedRayPick(ray, width, tilesets) {
  192496. this.ray = ray;
  192497. this.width = width;
  192498. this.tilesets = tilesets;
  192499. this.ready = false;
  192500. this.deferred = defer_default();
  192501. this.promise = this.deferred.promise;
  192502. }
  192503. function updateOffscreenCameraFromRay(picking, ray, width, camera) {
  192504. const direction2 = ray.direction;
  192505. const orthogonalAxis = Cartesian3_default.mostOrthogonalAxis(direction2, scratchRight4);
  192506. const right = Cartesian3_default.cross(direction2, orthogonalAxis, scratchRight4);
  192507. const up = Cartesian3_default.cross(direction2, right, scratchUp3);
  192508. camera.position = ray.origin;
  192509. camera.direction = direction2;
  192510. camera.up = up;
  192511. camera.right = right;
  192512. camera.frustum.width = defaultValue_default(width, offscreenDefaultWidth);
  192513. return camera.frustum.computeCullingVolume(
  192514. camera.positionWC,
  192515. camera.directionWC,
  192516. camera.upWC
  192517. );
  192518. }
  192519. function updateMostDetailedRayPick(picking, scene, rayPick) {
  192520. const frameState = scene.frameState;
  192521. const ray = rayPick.ray;
  192522. const width = rayPick.width;
  192523. const tilesets = rayPick.tilesets;
  192524. const camera = picking._pickOffscreenView.camera;
  192525. const cullingVolume = updateOffscreenCameraFromRay(
  192526. picking,
  192527. ray,
  192528. width,
  192529. camera
  192530. );
  192531. const tilesetPassState = mostDetailedPreloadTilesetPassState;
  192532. tilesetPassState.camera = camera;
  192533. tilesetPassState.cullingVolume = cullingVolume;
  192534. let ready = true;
  192535. const tilesetsLength = tilesets.length;
  192536. for (let i2 = 0; i2 < tilesetsLength; ++i2) {
  192537. const tileset = tilesets[i2];
  192538. if (tileset.show && scene.primitives.contains(tileset)) {
  192539. tileset.updateForPass(frameState, tilesetPassState);
  192540. ready = ready && tilesetPassState.ready;
  192541. }
  192542. }
  192543. if (ready) {
  192544. rayPick.deferred.resolve();
  192545. }
  192546. return ready;
  192547. }
  192548. Picking.prototype.updateMostDetailedRayPicks = function(scene) {
  192549. const rayPicks = this._mostDetailedRayPicks;
  192550. for (let i2 = 0; i2 < rayPicks.length; ++i2) {
  192551. if (updateMostDetailedRayPick(this, scene, rayPicks[i2])) {
  192552. rayPicks.splice(i2--, 1);
  192553. }
  192554. }
  192555. };
  192556. function getTilesets(primitives, objectsToExclude, tilesets) {
  192557. const length3 = primitives.length;
  192558. for (let i2 = 0; i2 < length3; ++i2) {
  192559. const primitive = primitives.get(i2);
  192560. if (primitive.show) {
  192561. if (defined_default(primitive.isCesium3DTileset)) {
  192562. if (!defined_default(objectsToExclude) || objectsToExclude.indexOf(primitive) === -1) {
  192563. tilesets.push(primitive);
  192564. }
  192565. } else if (primitive instanceof PrimitiveCollection_default) {
  192566. getTilesets(primitive, objectsToExclude, tilesets);
  192567. }
  192568. }
  192569. }
  192570. }
  192571. function launchMostDetailedRayPick(picking, scene, ray, objectsToExclude, width, callback) {
  192572. const tilesets = [];
  192573. getTilesets(scene.primitives, objectsToExclude, tilesets);
  192574. if (tilesets.length === 0) {
  192575. return Promise.resolve(callback());
  192576. }
  192577. const rayPick = new MostDetailedRayPick(ray, width, tilesets);
  192578. picking._mostDetailedRayPicks.push(rayPick);
  192579. return rayPick.promise.then(function() {
  192580. return callback();
  192581. });
  192582. }
  192583. function isExcluded(object2, objectsToExclude) {
  192584. if (!defined_default(object2) || !defined_default(objectsToExclude) || objectsToExclude.length === 0) {
  192585. return false;
  192586. }
  192587. return objectsToExclude.indexOf(object2) > -1 || objectsToExclude.indexOf(object2.primitive) > -1 || objectsToExclude.indexOf(object2.id) > -1;
  192588. }
  192589. function getRayIntersection(picking, scene, ray, objectsToExclude, width, requirePosition, mostDetailed) {
  192590. const context = scene.context;
  192591. const uniformState = context.uniformState;
  192592. const frameState = scene.frameState;
  192593. const view = picking._pickOffscreenView;
  192594. scene.view = view;
  192595. updateOffscreenCameraFromRay(picking, ray, width, view.camera);
  192596. scratchRectangle9 = BoundingRectangle_default.clone(view.viewport, scratchRectangle9);
  192597. const passState = view.pickFramebuffer.begin(scratchRectangle9, view.viewport);
  192598. scene.jobScheduler.disableThisFrame();
  192599. scene.updateFrameState();
  192600. frameState.invertClassification = false;
  192601. frameState.passes.pick = true;
  192602. frameState.passes.offscreen = true;
  192603. if (mostDetailed) {
  192604. frameState.tilesetPassState = mostDetailedPickTilesetPassState;
  192605. } else {
  192606. frameState.tilesetPassState = pickTilesetPassState;
  192607. }
  192608. uniformState.update(frameState);
  192609. scene.updateEnvironment();
  192610. scene.updateAndExecuteCommands(passState, scratchColorZero);
  192611. scene.resolveFramebuffers(passState);
  192612. let position;
  192613. const object2 = view.pickFramebuffer.end(scratchRectangle9);
  192614. if (scene.context.depthTexture) {
  192615. const numFrustums = view.frustumCommandsList.length;
  192616. for (let i2 = 0; i2 < numFrustums; ++i2) {
  192617. const pickDepth = picking.getPickDepth(scene, i2);
  192618. const depth = pickDepth.getDepth(context, 0, 0);
  192619. if (!defined_default(depth)) {
  192620. continue;
  192621. }
  192622. if (depth > 0 && depth < 1) {
  192623. const renderedFrustum = view.frustumCommandsList[i2];
  192624. const near = renderedFrustum.near * (i2 !== 0 ? scene.opaqueFrustumNearOffset : 1);
  192625. const far = renderedFrustum.far;
  192626. const distance2 = near + depth * (far - near);
  192627. position = Ray_default.getPoint(ray, distance2);
  192628. break;
  192629. }
  192630. }
  192631. }
  192632. scene.view = scene.defaultView;
  192633. context.endFrame();
  192634. if (defined_default(object2) || defined_default(position)) {
  192635. return {
  192636. object: object2,
  192637. position,
  192638. exclude: !defined_default(position) && requirePosition || isExcluded(object2, objectsToExclude)
  192639. };
  192640. }
  192641. }
  192642. function getRayIntersections(picking, scene, ray, limit, objectsToExclude, width, requirePosition, mostDetailed) {
  192643. const pickCallback = function() {
  192644. return getRayIntersection(
  192645. picking,
  192646. scene,
  192647. ray,
  192648. objectsToExclude,
  192649. width,
  192650. requirePosition,
  192651. mostDetailed
  192652. );
  192653. };
  192654. return drillPick(limit, pickCallback);
  192655. }
  192656. function pickFromRay(picking, scene, ray, objectsToExclude, width, requirePosition, mostDetailed) {
  192657. const results = getRayIntersections(
  192658. picking,
  192659. scene,
  192660. ray,
  192661. 1,
  192662. objectsToExclude,
  192663. width,
  192664. requirePosition,
  192665. mostDetailed
  192666. );
  192667. if (results.length > 0) {
  192668. return results[0];
  192669. }
  192670. }
  192671. function drillPickFromRay(picking, scene, ray, limit, objectsToExclude, width, requirePosition, mostDetailed) {
  192672. return getRayIntersections(
  192673. picking,
  192674. scene,
  192675. ray,
  192676. limit,
  192677. objectsToExclude,
  192678. width,
  192679. requirePosition,
  192680. mostDetailed
  192681. );
  192682. }
  192683. function deferPromiseUntilPostRender(scene, promise) {
  192684. const deferred = defer_default();
  192685. promise.then(function(result) {
  192686. const removeCallback = scene.postRender.addEventListener(function() {
  192687. deferred.resolve(result);
  192688. removeCallback();
  192689. });
  192690. scene.requestRender();
  192691. }).catch(function(error) {
  192692. deferred.reject(error);
  192693. });
  192694. return deferred.promise;
  192695. }
  192696. Picking.prototype.pickFromRay = function(scene, ray, objectsToExclude, width) {
  192697. Check_default.defined("ray", ray);
  192698. if (scene.mode !== SceneMode_default.SCENE3D) {
  192699. throw new DeveloperError_default(
  192700. "Ray intersections are only supported in 3D mode."
  192701. );
  192702. }
  192703. return pickFromRay(this, scene, ray, objectsToExclude, width, false, false);
  192704. };
  192705. Picking.prototype.drillPickFromRay = function(scene, ray, limit, objectsToExclude, width) {
  192706. Check_default.defined("ray", ray);
  192707. if (scene.mode !== SceneMode_default.SCENE3D) {
  192708. throw new DeveloperError_default(
  192709. "Ray intersections are only supported in 3D mode."
  192710. );
  192711. }
  192712. return drillPickFromRay(
  192713. this,
  192714. scene,
  192715. ray,
  192716. limit,
  192717. objectsToExclude,
  192718. width,
  192719. false,
  192720. false
  192721. );
  192722. };
  192723. Picking.prototype.pickFromRayMostDetailed = function(scene, ray, objectsToExclude, width) {
  192724. Check_default.defined("ray", ray);
  192725. if (scene.mode !== SceneMode_default.SCENE3D) {
  192726. throw new DeveloperError_default(
  192727. "Ray intersections are only supported in 3D mode."
  192728. );
  192729. }
  192730. const that = this;
  192731. ray = Ray_default.clone(ray);
  192732. objectsToExclude = defined_default(objectsToExclude) ? objectsToExclude.slice() : objectsToExclude;
  192733. return deferPromiseUntilPostRender(
  192734. scene,
  192735. launchMostDetailedRayPick(
  192736. that,
  192737. scene,
  192738. ray,
  192739. objectsToExclude,
  192740. width,
  192741. function() {
  192742. return pickFromRay(
  192743. that,
  192744. scene,
  192745. ray,
  192746. objectsToExclude,
  192747. width,
  192748. false,
  192749. true
  192750. );
  192751. }
  192752. )
  192753. );
  192754. };
  192755. Picking.prototype.drillPickFromRayMostDetailed = function(scene, ray, limit, objectsToExclude, width) {
  192756. Check_default.defined("ray", ray);
  192757. if (scene.mode !== SceneMode_default.SCENE3D) {
  192758. throw new DeveloperError_default(
  192759. "Ray intersections are only supported in 3D mode."
  192760. );
  192761. }
  192762. const that = this;
  192763. ray = Ray_default.clone(ray);
  192764. objectsToExclude = defined_default(objectsToExclude) ? objectsToExclude.slice() : objectsToExclude;
  192765. return deferPromiseUntilPostRender(
  192766. scene,
  192767. launchMostDetailedRayPick(
  192768. that,
  192769. scene,
  192770. ray,
  192771. objectsToExclude,
  192772. width,
  192773. function() {
  192774. return drillPickFromRay(
  192775. that,
  192776. scene,
  192777. ray,
  192778. limit,
  192779. objectsToExclude,
  192780. width,
  192781. false,
  192782. true
  192783. );
  192784. }
  192785. )
  192786. );
  192787. };
  192788. var scratchSurfacePosition = new Cartesian3_default();
  192789. var scratchSurfaceNormal = new Cartesian3_default();
  192790. var scratchSurfaceRay = new Ray_default();
  192791. var scratchCartographic19 = new Cartographic_default();
  192792. function getRayForSampleHeight(scene, cartographic2) {
  192793. const globe = scene.globe;
  192794. const ellipsoid = defined_default(globe) ? globe.ellipsoid : scene.mapProjection.ellipsoid;
  192795. const height = ApproximateTerrainHeights_default._defaultMaxTerrainHeight;
  192796. const surfaceNormal = ellipsoid.geodeticSurfaceNormalCartographic(
  192797. cartographic2,
  192798. scratchSurfaceNormal
  192799. );
  192800. const surfacePosition = Cartographic_default.toCartesian(
  192801. cartographic2,
  192802. ellipsoid,
  192803. scratchSurfacePosition
  192804. );
  192805. const surfaceRay = scratchSurfaceRay;
  192806. surfaceRay.origin = surfacePosition;
  192807. surfaceRay.direction = surfaceNormal;
  192808. const ray = new Ray_default();
  192809. Ray_default.getPoint(surfaceRay, height, ray.origin);
  192810. Cartesian3_default.negate(surfaceNormal, ray.direction);
  192811. return ray;
  192812. }
  192813. function getRayForClampToHeight(scene, cartesian11) {
  192814. const globe = scene.globe;
  192815. const ellipsoid = defined_default(globe) ? globe.ellipsoid : scene.mapProjection.ellipsoid;
  192816. const cartographic2 = Cartographic_default.fromCartesian(
  192817. cartesian11,
  192818. ellipsoid,
  192819. scratchCartographic19
  192820. );
  192821. return getRayForSampleHeight(scene, cartographic2);
  192822. }
  192823. function getHeightFromCartesian(scene, cartesian11) {
  192824. const globe = scene.globe;
  192825. const ellipsoid = defined_default(globe) ? globe.ellipsoid : scene.mapProjection.ellipsoid;
  192826. const cartographic2 = Cartographic_default.fromCartesian(
  192827. cartesian11,
  192828. ellipsoid,
  192829. scratchCartographic19
  192830. );
  192831. return cartographic2.height;
  192832. }
  192833. function sampleHeightMostDetailed(picking, scene, cartographic2, objectsToExclude, width) {
  192834. const ray = getRayForSampleHeight(scene, cartographic2);
  192835. return launchMostDetailedRayPick(
  192836. picking,
  192837. scene,
  192838. ray,
  192839. objectsToExclude,
  192840. width,
  192841. function() {
  192842. const pickResult = pickFromRay(
  192843. picking,
  192844. scene,
  192845. ray,
  192846. objectsToExclude,
  192847. width,
  192848. true,
  192849. true
  192850. );
  192851. if (defined_default(pickResult)) {
  192852. return getHeightFromCartesian(scene, pickResult.position);
  192853. }
  192854. }
  192855. );
  192856. }
  192857. function clampToHeightMostDetailed(picking, scene, cartesian11, objectsToExclude, width, result) {
  192858. const ray = getRayForClampToHeight(scene, cartesian11);
  192859. return launchMostDetailedRayPick(
  192860. picking,
  192861. scene,
  192862. ray,
  192863. objectsToExclude,
  192864. width,
  192865. function() {
  192866. const pickResult = pickFromRay(
  192867. picking,
  192868. scene,
  192869. ray,
  192870. objectsToExclude,
  192871. width,
  192872. true,
  192873. true
  192874. );
  192875. if (defined_default(pickResult)) {
  192876. return Cartesian3_default.clone(pickResult.position, result);
  192877. }
  192878. }
  192879. );
  192880. }
  192881. Picking.prototype.sampleHeight = function(scene, position, objectsToExclude, width) {
  192882. Check_default.defined("position", position);
  192883. if (scene.mode !== SceneMode_default.SCENE3D) {
  192884. throw new DeveloperError_default("sampleHeight is only supported in 3D mode.");
  192885. }
  192886. if (!scene.sampleHeightSupported) {
  192887. throw new DeveloperError_default(
  192888. "sampleHeight requires depth texture support. Check sampleHeightSupported."
  192889. );
  192890. }
  192891. const ray = getRayForSampleHeight(scene, position);
  192892. const pickResult = pickFromRay(
  192893. this,
  192894. scene,
  192895. ray,
  192896. objectsToExclude,
  192897. width,
  192898. true,
  192899. false
  192900. );
  192901. if (defined_default(pickResult)) {
  192902. return getHeightFromCartesian(scene, pickResult.position);
  192903. }
  192904. };
  192905. Picking.prototype.clampToHeight = function(scene, cartesian11, objectsToExclude, width, result) {
  192906. Check_default.defined("cartesian", cartesian11);
  192907. if (scene.mode !== SceneMode_default.SCENE3D) {
  192908. throw new DeveloperError_default("clampToHeight is only supported in 3D mode.");
  192909. }
  192910. if (!scene.clampToHeightSupported) {
  192911. throw new DeveloperError_default(
  192912. "clampToHeight requires depth texture support. Check clampToHeightSupported."
  192913. );
  192914. }
  192915. const ray = getRayForClampToHeight(scene, cartesian11);
  192916. const pickResult = pickFromRay(
  192917. this,
  192918. scene,
  192919. ray,
  192920. objectsToExclude,
  192921. width,
  192922. true,
  192923. false
  192924. );
  192925. if (defined_default(pickResult)) {
  192926. return Cartesian3_default.clone(pickResult.position, result);
  192927. }
  192928. };
  192929. Picking.prototype.sampleHeightMostDetailed = function(scene, positions, objectsToExclude, width) {
  192930. Check_default.defined("positions", positions);
  192931. if (scene.mode !== SceneMode_default.SCENE3D) {
  192932. throw new DeveloperError_default(
  192933. "sampleHeightMostDetailed is only supported in 3D mode."
  192934. );
  192935. }
  192936. if (!scene.sampleHeightSupported) {
  192937. throw new DeveloperError_default(
  192938. "sampleHeightMostDetailed requires depth texture support. Check sampleHeightSupported."
  192939. );
  192940. }
  192941. objectsToExclude = defined_default(objectsToExclude) ? objectsToExclude.slice() : objectsToExclude;
  192942. const length3 = positions.length;
  192943. const promises = new Array(length3);
  192944. for (let i2 = 0; i2 < length3; ++i2) {
  192945. promises[i2] = sampleHeightMostDetailed(
  192946. this,
  192947. scene,
  192948. positions[i2],
  192949. objectsToExclude,
  192950. width
  192951. );
  192952. }
  192953. return deferPromiseUntilPostRender(
  192954. scene,
  192955. Promise.all(promises).then(function(heights) {
  192956. const length4 = heights.length;
  192957. for (let i2 = 0; i2 < length4; ++i2) {
  192958. positions[i2].height = heights[i2];
  192959. }
  192960. return positions;
  192961. })
  192962. );
  192963. };
  192964. Picking.prototype.clampToHeightMostDetailed = function(scene, cartesians, objectsToExclude, width) {
  192965. Check_default.defined("cartesians", cartesians);
  192966. if (scene.mode !== SceneMode_default.SCENE3D) {
  192967. throw new DeveloperError_default(
  192968. "clampToHeightMostDetailed is only supported in 3D mode."
  192969. );
  192970. }
  192971. if (!scene.clampToHeightSupported) {
  192972. throw new DeveloperError_default(
  192973. "clampToHeightMostDetailed requires depth texture support. Check clampToHeightSupported."
  192974. );
  192975. }
  192976. objectsToExclude = defined_default(objectsToExclude) ? objectsToExclude.slice() : objectsToExclude;
  192977. const length3 = cartesians.length;
  192978. const promises = new Array(length3);
  192979. for (let i2 = 0; i2 < length3; ++i2) {
  192980. promises[i2] = clampToHeightMostDetailed(
  192981. this,
  192982. scene,
  192983. cartesians[i2],
  192984. objectsToExclude,
  192985. width,
  192986. cartesians[i2]
  192987. );
  192988. }
  192989. return deferPromiseUntilPostRender(
  192990. scene,
  192991. Promise.all(promises).then(function(clampedCartesians) {
  192992. const length4 = clampedCartesians.length;
  192993. for (let i2 = 0; i2 < length4; ++i2) {
  192994. cartesians[i2] = clampedCartesians[i2];
  192995. }
  192996. return cartesians;
  192997. })
  192998. );
  192999. };
  193000. Picking.prototype.destroy = function() {
  193001. this._pickOffscreenView = this._pickOffscreenView && this._pickOffscreenView.destroy();
  193002. };
  193003. var Picking_default = Picking;
  193004. // node_modules/cesium/Source/Scene/PostProcessStageSampleMode.js
  193005. var PostProcessStageSampleMode = {
  193006. NEAREST: 0,
  193007. LINEAR: 1
  193008. };
  193009. var PostProcessStageSampleMode_default = PostProcessStageSampleMode;
  193010. // node_modules/cesium/Source/Scene/PostProcessStage.js
  193011. function PostProcessStage(options) {
  193012. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  193013. const fragmentShader = options.fragmentShader;
  193014. const textureScale = defaultValue_default(options.textureScale, 1);
  193015. const pixelFormat = defaultValue_default(options.pixelFormat, PixelFormat_default.RGBA);
  193016. Check_default.typeOf.string("options.fragmentShader", fragmentShader);
  193017. Check_default.typeOf.number.greaterThan("options.textureScale", textureScale, 0);
  193018. Check_default.typeOf.number.lessThanOrEquals(
  193019. "options.textureScale",
  193020. textureScale,
  193021. 1
  193022. );
  193023. if (!PixelFormat_default.isColorFormat(pixelFormat)) {
  193024. throw new DeveloperError_default("options.pixelFormat must be a color format.");
  193025. }
  193026. this._fragmentShader = fragmentShader;
  193027. this._uniforms = options.uniforms;
  193028. this._textureScale = textureScale;
  193029. this._forcePowerOfTwo = defaultValue_default(options.forcePowerOfTwo, false);
  193030. this._sampleMode = defaultValue_default(
  193031. options.sampleMode,
  193032. PostProcessStageSampleMode_default.NEAREST
  193033. );
  193034. this._pixelFormat = pixelFormat;
  193035. this._pixelDatatype = defaultValue_default(
  193036. options.pixelDatatype,
  193037. PixelDatatype_default.UNSIGNED_BYTE
  193038. );
  193039. this._clearColor = defaultValue_default(options.clearColor, Color_default.BLACK);
  193040. this._uniformMap = void 0;
  193041. this._command = void 0;
  193042. this._colorTexture = void 0;
  193043. this._depthTexture = void 0;
  193044. this._idTexture = void 0;
  193045. this._actualUniforms = {};
  193046. this._dirtyUniforms = [];
  193047. this._texturesToRelease = [];
  193048. this._texturesToCreate = [];
  193049. this._texturePromise = void 0;
  193050. const passState = new PassState_default();
  193051. passState.scissorTest = {
  193052. enabled: true,
  193053. rectangle: defined_default(options.scissorRectangle) ? BoundingRectangle_default.clone(options.scissorRectangle) : new BoundingRectangle_default()
  193054. };
  193055. this._passState = passState;
  193056. this._ready = false;
  193057. let name = options.name;
  193058. if (!defined_default(name)) {
  193059. name = createGuid_default();
  193060. }
  193061. this._name = name;
  193062. this._logDepthChanged = void 0;
  193063. this._useLogDepth = void 0;
  193064. this._selectedIdTexture = void 0;
  193065. this._selected = void 0;
  193066. this._selectedShadow = void 0;
  193067. this._parentSelected = void 0;
  193068. this._parentSelectedShadow = void 0;
  193069. this._combinedSelected = void 0;
  193070. this._combinedSelectedShadow = void 0;
  193071. this._selectedLength = 0;
  193072. this._parentSelectedLength = 0;
  193073. this._selectedDirty = true;
  193074. this._textureCache = void 0;
  193075. this._index = void 0;
  193076. this.enabled = true;
  193077. this._enabled = true;
  193078. }
  193079. Object.defineProperties(PostProcessStage.prototype, {
  193080. ready: {
  193081. get: function() {
  193082. return this._ready;
  193083. }
  193084. },
  193085. name: {
  193086. get: function() {
  193087. return this._name;
  193088. }
  193089. },
  193090. fragmentShader: {
  193091. get: function() {
  193092. return this._fragmentShader;
  193093. }
  193094. },
  193095. uniforms: {
  193096. get: function() {
  193097. return this._uniforms;
  193098. }
  193099. },
  193100. textureScale: {
  193101. get: function() {
  193102. return this._textureScale;
  193103. }
  193104. },
  193105. forcePowerOfTwo: {
  193106. get: function() {
  193107. return this._forcePowerOfTwo;
  193108. }
  193109. },
  193110. sampleMode: {
  193111. get: function() {
  193112. return this._sampleMode;
  193113. }
  193114. },
  193115. pixelFormat: {
  193116. get: function() {
  193117. return this._pixelFormat;
  193118. }
  193119. },
  193120. pixelDatatype: {
  193121. get: function() {
  193122. return this._pixelDatatype;
  193123. }
  193124. },
  193125. clearColor: {
  193126. get: function() {
  193127. return this._clearColor;
  193128. }
  193129. },
  193130. scissorRectangle: {
  193131. get: function() {
  193132. return this._passState.scissorTest.rectangle;
  193133. }
  193134. },
  193135. outputTexture: {
  193136. get: function() {
  193137. if (defined_default(this._textureCache)) {
  193138. const framebuffer = this._textureCache.getFramebuffer(this._name);
  193139. if (defined_default(framebuffer)) {
  193140. return framebuffer.getColorTexture(0);
  193141. }
  193142. }
  193143. return void 0;
  193144. }
  193145. },
  193146. selected: {
  193147. get: function() {
  193148. return this._selected;
  193149. },
  193150. set: function(value) {
  193151. this._selected = value;
  193152. }
  193153. },
  193154. parentSelected: {
  193155. get: function() {
  193156. return this._parentSelected;
  193157. },
  193158. set: function(value) {
  193159. this._parentSelected = value;
  193160. }
  193161. }
  193162. });
  193163. var depthTextureRegex = /uniform\s+sampler2D\s+depthTexture/g;
  193164. PostProcessStage.prototype._isSupported = function(context) {
  193165. return !depthTextureRegex.test(this._fragmentShader) || context.depthTexture;
  193166. };
  193167. function getUniformValueGetterAndSetter(stage, uniforms, name) {
  193168. const currentValue = uniforms[name];
  193169. if (typeof currentValue === "string" || currentValue instanceof HTMLCanvasElement || currentValue instanceof HTMLImageElement || currentValue instanceof HTMLVideoElement || currentValue instanceof ImageData) {
  193170. stage._dirtyUniforms.push(name);
  193171. }
  193172. return {
  193173. get: function() {
  193174. return uniforms[name];
  193175. },
  193176. set: function(value) {
  193177. const currentValue2 = uniforms[name];
  193178. uniforms[name] = value;
  193179. const actualUniforms = stage._actualUniforms;
  193180. const actualValue = actualUniforms[name];
  193181. if (defined_default(actualValue) && actualValue !== currentValue2 && actualValue instanceof Texture_default && !defined_default(stage._textureCache.getStageByName(name))) {
  193182. stage._texturesToRelease.push(actualValue);
  193183. delete actualUniforms[name];
  193184. delete actualUniforms[`${name}Dimensions`];
  193185. }
  193186. if (currentValue2 instanceof Texture_default) {
  193187. stage._texturesToRelease.push(currentValue2);
  193188. }
  193189. if (typeof value === "string" || value instanceof HTMLCanvasElement || value instanceof HTMLImageElement || value instanceof HTMLVideoElement || value instanceof ImageData) {
  193190. stage._dirtyUniforms.push(name);
  193191. } else {
  193192. actualUniforms[name] = value;
  193193. }
  193194. }
  193195. };
  193196. }
  193197. function getUniformMapFunction(stage, name) {
  193198. return function() {
  193199. const value = stage._actualUniforms[name];
  193200. if (typeof value === "function") {
  193201. return value();
  193202. }
  193203. return value;
  193204. };
  193205. }
  193206. function getUniformMapDimensionsFunction(uniformMap2, name) {
  193207. return function() {
  193208. const texture = uniformMap2[name]();
  193209. if (defined_default(texture)) {
  193210. return texture.dimensions;
  193211. }
  193212. return void 0;
  193213. };
  193214. }
  193215. function createUniformMap7(stage) {
  193216. if (defined_default(stage._uniformMap)) {
  193217. return;
  193218. }
  193219. const uniformMap2 = {};
  193220. const newUniforms = {};
  193221. const uniforms = stage._uniforms;
  193222. const actualUniforms = stage._actualUniforms;
  193223. for (const name in uniforms) {
  193224. if (uniforms.hasOwnProperty(name)) {
  193225. if (typeof uniforms[name] !== "function") {
  193226. uniformMap2[name] = getUniformMapFunction(stage, name);
  193227. newUniforms[name] = getUniformValueGetterAndSetter(
  193228. stage,
  193229. uniforms,
  193230. name
  193231. );
  193232. } else {
  193233. uniformMap2[name] = uniforms[name];
  193234. newUniforms[name] = uniforms[name];
  193235. }
  193236. actualUniforms[name] = uniforms[name];
  193237. const value = uniformMap2[name]();
  193238. if (typeof value === "string" || value instanceof Texture_default || value instanceof HTMLImageElement || value instanceof HTMLCanvasElement || value instanceof HTMLVideoElement) {
  193239. uniformMap2[`${name}Dimensions`] = getUniformMapDimensionsFunction(
  193240. uniformMap2,
  193241. name
  193242. );
  193243. }
  193244. }
  193245. }
  193246. stage._uniforms = {};
  193247. Object.defineProperties(stage._uniforms, newUniforms);
  193248. stage._uniformMap = combine_default(uniformMap2, {
  193249. colorTexture: function() {
  193250. return stage._colorTexture;
  193251. },
  193252. colorTextureDimensions: function() {
  193253. return stage._colorTexture.dimensions;
  193254. },
  193255. depthTexture: function() {
  193256. return stage._depthTexture;
  193257. },
  193258. depthTextureDimensions: function() {
  193259. return stage._depthTexture.dimensions;
  193260. },
  193261. czm_idTexture: function() {
  193262. return stage._idTexture;
  193263. },
  193264. czm_selectedIdTexture: function() {
  193265. return stage._selectedIdTexture;
  193266. },
  193267. czm_selectedIdTextureStep: function() {
  193268. return 1 / stage._selectedIdTexture.width;
  193269. }
  193270. });
  193271. }
  193272. function createDrawCommand(stage, context) {
  193273. if (defined_default(stage._command) && !stage._logDepthChanged && !stage._selectedDirty) {
  193274. return;
  193275. }
  193276. let fs = stage._fragmentShader;
  193277. if (defined_default(stage._selectedIdTexture)) {
  193278. const width = stage._selectedIdTexture.width;
  193279. fs = fs.replace(/varying\s+vec2\s+v_textureCoordinates;/g, "");
  193280. fs = `${"#define CZM_SELECTED_FEATURE \nuniform sampler2D czm_idTexture; \nuniform sampler2D czm_selectedIdTexture; \nuniform float czm_selectedIdTextureStep; \nvarying vec2 v_textureCoordinates; \nbool czm_selected(vec2 offset) \n{ \n bool selected = false;\n vec4 id = texture2D(czm_idTexture, v_textureCoordinates + offset); \n for (int i = 0; i < "}${width}; ++i)
  193281. {
  193282. vec4 selectedId = texture2D(czm_selectedIdTexture, vec2((float(i) + 0.5) * czm_selectedIdTextureStep, 0.5));
  193283. if (all(equal(id, selectedId)))
  193284. {
  193285. return true;
  193286. }
  193287. }
  193288. return false;
  193289. }
  193290. bool czm_selected()
  193291. {
  193292. return czm_selected(vec2(0.0));
  193293. }
  193294. ${fs}`;
  193295. }
  193296. const fragmentShader = new ShaderSource_default({
  193297. defines: [stage._useLogDepth ? "LOG_DEPTH" : ""],
  193298. sources: [fs]
  193299. });
  193300. stage._command = context.createViewportQuadCommand(fragmentShader, {
  193301. uniformMap: stage._uniformMap,
  193302. owner: stage
  193303. });
  193304. }
  193305. function createSampler(stage) {
  193306. const mode2 = stage._sampleMode;
  193307. let minFilter;
  193308. let magFilter;
  193309. if (mode2 === PostProcessStageSampleMode_default.LINEAR) {
  193310. minFilter = TextureMinificationFilter_default.LINEAR;
  193311. magFilter = TextureMagnificationFilter_default.LINEAR;
  193312. } else {
  193313. minFilter = TextureMinificationFilter_default.NEAREST;
  193314. magFilter = TextureMagnificationFilter_default.NEAREST;
  193315. }
  193316. const sampler = stage._sampler;
  193317. if (!defined_default(sampler) || sampler.minificationFilter !== minFilter || sampler.magnificationFilter !== magFilter) {
  193318. stage._sampler = new Sampler_default({
  193319. wrapS: TextureWrap_default.CLAMP_TO_EDGE,
  193320. wrapT: TextureWrap_default.CLAMP_TO_EDGE,
  193321. minificationFilter: minFilter,
  193322. magnificationFilter: magFilter
  193323. });
  193324. }
  193325. }
  193326. function createLoadImageFunction(stage, name) {
  193327. return function(image) {
  193328. stage._texturesToCreate.push({
  193329. name,
  193330. source: image
  193331. });
  193332. };
  193333. }
  193334. function createStageOutputTextureFunction(stage, name) {
  193335. return function() {
  193336. return stage._textureCache.getOutputTexture(name);
  193337. };
  193338. }
  193339. function updateUniformTextures(stage, context) {
  193340. let i2;
  193341. let texture;
  193342. let name;
  193343. const texturesToRelease = stage._texturesToRelease;
  193344. let length3 = texturesToRelease.length;
  193345. for (i2 = 0; i2 < length3; ++i2) {
  193346. texture = texturesToRelease[i2];
  193347. texture = texture && texture.destroy();
  193348. }
  193349. texturesToRelease.length = 0;
  193350. const texturesToCreate = stage._texturesToCreate;
  193351. length3 = texturesToCreate.length;
  193352. for (i2 = 0; i2 < length3; ++i2) {
  193353. const textureToCreate = texturesToCreate[i2];
  193354. name = textureToCreate.name;
  193355. const source = textureToCreate.source;
  193356. stage._actualUniforms[name] = new Texture_default({
  193357. context,
  193358. source
  193359. });
  193360. }
  193361. texturesToCreate.length = 0;
  193362. const dirtyUniforms = stage._dirtyUniforms;
  193363. if (dirtyUniforms.length === 0 && !defined_default(stage._texturePromise)) {
  193364. stage._ready = true;
  193365. return;
  193366. }
  193367. if (dirtyUniforms.length === 0 || defined_default(stage._texturePromise)) {
  193368. return;
  193369. }
  193370. length3 = dirtyUniforms.length;
  193371. const uniforms = stage._uniforms;
  193372. const promises = [];
  193373. for (i2 = 0; i2 < length3; ++i2) {
  193374. name = dirtyUniforms[i2];
  193375. const stageNameUrlOrImage = uniforms[name];
  193376. const stageWithName = stage._textureCache.getStageByName(
  193377. stageNameUrlOrImage
  193378. );
  193379. if (defined_default(stageWithName)) {
  193380. stage._actualUniforms[name] = createStageOutputTextureFunction(
  193381. stage,
  193382. stageNameUrlOrImage
  193383. );
  193384. } else if (typeof stageNameUrlOrImage === "string") {
  193385. const resource = new Resource_default({
  193386. url: stageNameUrlOrImage
  193387. });
  193388. promises.push(
  193389. resource.fetchImage().then(createLoadImageFunction(stage, name))
  193390. );
  193391. } else {
  193392. stage._texturesToCreate.push({
  193393. name,
  193394. source: stageNameUrlOrImage
  193395. });
  193396. }
  193397. }
  193398. dirtyUniforms.length = 0;
  193399. if (promises.length > 0) {
  193400. stage._ready = false;
  193401. stage._texturePromise = Promise.all(promises).then(function() {
  193402. stage._ready = true;
  193403. stage._texturePromise = void 0;
  193404. });
  193405. } else {
  193406. stage._ready = true;
  193407. }
  193408. }
  193409. function releaseResources(stage) {
  193410. if (defined_default(stage._command)) {
  193411. stage._command.shaderProgram = stage._command.shaderProgram && stage._command.shaderProgram.destroy();
  193412. stage._command = void 0;
  193413. }
  193414. stage._selectedIdTexture = stage._selectedIdTexture && stage._selectedIdTexture.destroy();
  193415. const textureCache = stage._textureCache;
  193416. if (!defined_default(textureCache)) {
  193417. return;
  193418. }
  193419. const uniforms = stage._uniforms;
  193420. const actualUniforms = stage._actualUniforms;
  193421. for (const name in actualUniforms) {
  193422. if (actualUniforms.hasOwnProperty(name)) {
  193423. if (actualUniforms[name] instanceof Texture_default) {
  193424. if (!defined_default(textureCache.getStageByName(uniforms[name]))) {
  193425. actualUniforms[name].destroy();
  193426. }
  193427. stage._dirtyUniforms.push(name);
  193428. }
  193429. }
  193430. }
  193431. }
  193432. function isSelectedTextureDirty(stage) {
  193433. let length3 = defined_default(stage._selected) ? stage._selected.length : 0;
  193434. const parentLength = defined_default(stage._parentSelected) ? stage._parentSelected : 0;
  193435. let dirty = stage._selected !== stage._selectedShadow || length3 !== stage._selectedLength;
  193436. dirty = dirty || stage._parentSelected !== stage._parentSelectedShadow || parentLength !== stage._parentSelectedLength;
  193437. if (defined_default(stage._selected) && defined_default(stage._parentSelected)) {
  193438. stage._combinedSelected = stage._selected.concat(stage._parentSelected);
  193439. } else if (defined_default(stage._parentSelected)) {
  193440. stage._combinedSelected = stage._parentSelected;
  193441. } else {
  193442. stage._combinedSelected = stage._selected;
  193443. }
  193444. if (!dirty && defined_default(stage._combinedSelected)) {
  193445. if (!defined_default(stage._combinedSelectedShadow)) {
  193446. return true;
  193447. }
  193448. length3 = stage._combinedSelected.length;
  193449. for (let i2 = 0; i2 < length3; ++i2) {
  193450. if (stage._combinedSelected[i2] !== stage._combinedSelectedShadow[i2]) {
  193451. return true;
  193452. }
  193453. }
  193454. }
  193455. return dirty;
  193456. }
  193457. function createSelectedTexture(stage, context) {
  193458. if (!stage._selectedDirty) {
  193459. return;
  193460. }
  193461. stage._selectedIdTexture = stage._selectedIdTexture && stage._selectedIdTexture.destroy();
  193462. stage._selectedIdTexture = void 0;
  193463. const features = stage._combinedSelected;
  193464. if (!defined_default(features)) {
  193465. return;
  193466. }
  193467. let i2;
  193468. let feature2;
  193469. let textureLength = 0;
  193470. const length3 = features.length;
  193471. for (i2 = 0; i2 < length3; ++i2) {
  193472. feature2 = features[i2];
  193473. if (defined_default(feature2.pickIds)) {
  193474. textureLength += feature2.pickIds.length;
  193475. } else if (defined_default(feature2.pickId)) {
  193476. ++textureLength;
  193477. }
  193478. }
  193479. if (length3 === 0 || textureLength === 0) {
  193480. const empty = new Uint8Array(4);
  193481. empty[0] = 255;
  193482. empty[1] = 255;
  193483. empty[2] = 255;
  193484. empty[3] = 255;
  193485. stage._selectedIdTexture = new Texture_default({
  193486. context,
  193487. pixelFormat: PixelFormat_default.RGBA,
  193488. pixelDatatype: PixelDatatype_default.UNSIGNED_BYTE,
  193489. source: {
  193490. arrayBufferView: empty,
  193491. width: 1,
  193492. height: 1
  193493. },
  193494. sampler: Sampler_default.NEAREST
  193495. });
  193496. return;
  193497. }
  193498. let pickColor;
  193499. let offset2 = 0;
  193500. const ids = new Uint8Array(textureLength * 4);
  193501. for (i2 = 0; i2 < length3; ++i2) {
  193502. feature2 = features[i2];
  193503. if (defined_default(feature2.pickIds)) {
  193504. const pickIds = feature2.pickIds;
  193505. const pickIdsLength = pickIds.length;
  193506. for (let j = 0; j < pickIdsLength; ++j) {
  193507. pickColor = pickIds[j].color;
  193508. ids[offset2] = Color_default.floatToByte(pickColor.red);
  193509. ids[offset2 + 1] = Color_default.floatToByte(pickColor.green);
  193510. ids[offset2 + 2] = Color_default.floatToByte(pickColor.blue);
  193511. ids[offset2 + 3] = Color_default.floatToByte(pickColor.alpha);
  193512. offset2 += 4;
  193513. }
  193514. } else if (defined_default(feature2.pickId)) {
  193515. pickColor = feature2.pickId.color;
  193516. ids[offset2] = Color_default.floatToByte(pickColor.red);
  193517. ids[offset2 + 1] = Color_default.floatToByte(pickColor.green);
  193518. ids[offset2 + 2] = Color_default.floatToByte(pickColor.blue);
  193519. ids[offset2 + 3] = Color_default.floatToByte(pickColor.alpha);
  193520. offset2 += 4;
  193521. }
  193522. }
  193523. stage._selectedIdTexture = new Texture_default({
  193524. context,
  193525. pixelFormat: PixelFormat_default.RGBA,
  193526. pixelDatatype: PixelDatatype_default.UNSIGNED_BYTE,
  193527. source: {
  193528. arrayBufferView: ids,
  193529. width: textureLength,
  193530. height: 1
  193531. },
  193532. sampler: Sampler_default.NEAREST
  193533. });
  193534. }
  193535. PostProcessStage.prototype.update = function(context, useLogDepth) {
  193536. if (this.enabled !== this._enabled && !this.enabled) {
  193537. releaseResources(this);
  193538. }
  193539. this._enabled = this.enabled;
  193540. if (!this._enabled) {
  193541. return;
  193542. }
  193543. this._logDepthChanged = useLogDepth !== this._useLogDepth;
  193544. this._useLogDepth = useLogDepth;
  193545. this._selectedDirty = isSelectedTextureDirty(this);
  193546. this._selectedShadow = this._selected;
  193547. this._parentSelectedShadow = this._parentSelected;
  193548. this._combinedSelectedShadow = this._combinedSelected;
  193549. this._selectedLength = defined_default(this._selected) ? this._selected.length : 0;
  193550. this._parentSelectedLength = defined_default(this._parentSelected) ? this._parentSelected.length : 0;
  193551. createSelectedTexture(this, context);
  193552. createUniformMap7(this);
  193553. updateUniformTextures(this, context);
  193554. createDrawCommand(this, context);
  193555. createSampler(this);
  193556. this._selectedDirty = false;
  193557. if (!this._ready) {
  193558. return;
  193559. }
  193560. const framebuffer = this._textureCache.getFramebuffer(this._name);
  193561. this._command.framebuffer = framebuffer;
  193562. if (!defined_default(framebuffer)) {
  193563. return;
  193564. }
  193565. const colorTexture = framebuffer.getColorTexture(0);
  193566. let renderState;
  193567. if (colorTexture.width !== context.drawingBufferWidth || colorTexture.height !== context.drawingBufferHeight) {
  193568. renderState = this._renderState;
  193569. if (!defined_default(renderState) || colorTexture.width !== renderState.viewport.width || colorTexture.height !== renderState.viewport.height) {
  193570. this._renderState = RenderState_default.fromCache({
  193571. viewport: new BoundingRectangle_default(
  193572. 0,
  193573. 0,
  193574. colorTexture.width,
  193575. colorTexture.height
  193576. )
  193577. });
  193578. }
  193579. }
  193580. this._command.renderState = renderState;
  193581. };
  193582. PostProcessStage.prototype.execute = function(context, colorTexture, depthTexture, idTexture) {
  193583. if (!defined_default(this._command) || !defined_default(this._command.framebuffer) || !this._ready || !this._enabled) {
  193584. return;
  193585. }
  193586. this._colorTexture = colorTexture;
  193587. this._depthTexture = depthTexture;
  193588. this._idTexture = idTexture;
  193589. if (!Sampler_default.equals(this._colorTexture.sampler, this._sampler)) {
  193590. this._colorTexture.sampler = this._sampler;
  193591. }
  193592. const passState = this.scissorRectangle.width > 0 && this.scissorRectangle.height > 0 ? this._passState : void 0;
  193593. if (defined_default(passState)) {
  193594. passState.context = context;
  193595. }
  193596. this._command.execute(context, passState);
  193597. };
  193598. PostProcessStage.prototype.isDestroyed = function() {
  193599. return false;
  193600. };
  193601. PostProcessStage.prototype.destroy = function() {
  193602. releaseResources(this);
  193603. return destroyObject_default(this);
  193604. };
  193605. var PostProcessStage_default = PostProcessStage;
  193606. // node_modules/cesium/Source/Shaders/PostProcessStages/AcesTonemappingStage.js
  193607. var AcesTonemappingStage_default = "uniform sampler2D colorTexture;\n\nvarying vec2 v_textureCoordinates;\n\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\n\nvoid main()\n{\n vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);\n vec3 color = fragmentColor.rgb;\n\n#ifdef AUTO_EXPOSURE\n color /= texture2D(autoExposure, vec2(0.5)).r;\n#endif\n color = czm_acesTonemapping(color);\n color = czm_inverseGamma(color);\n\n gl_FragColor = vec4(color, fragmentColor.a);\n}\n";
  193608. // node_modules/cesium/Source/Shaders/PostProcessStages/AmbientOcclusionGenerate.js
  193609. var AmbientOcclusionGenerate_default = "uniform sampler2D randomTexture;\nuniform sampler2D depthTexture;\nuniform float intensity;\nuniform float bias;\nuniform float lengthCap;\nuniform float stepSize;\nuniform float frustumLength;\n\nvarying vec2 v_textureCoordinates;\n\nvec4 clipToEye(vec2 uv, float depth)\n{\n vec2 xy = vec2((uv.x * 2.0 - 1.0), ((1.0 - uv.y) * 2.0 - 1.0));\n vec4 posEC = czm_inverseProjection * vec4(xy, depth, 1.0);\n posEC = posEC / posEC.w;\n return posEC;\n}\n\n//Reconstruct Normal Without Edge Removation\nvec3 getNormalXEdge(vec3 posInCamera, float depthU, float depthD, float depthL, float depthR, vec2 pixelSize)\n{\n vec4 posInCameraUp = clipToEye(v_textureCoordinates - vec2(0.0, pixelSize.y), depthU);\n vec4 posInCameraDown = clipToEye(v_textureCoordinates + vec2(0.0, pixelSize.y), depthD);\n vec4 posInCameraLeft = clipToEye(v_textureCoordinates - vec2(pixelSize.x, 0.0), depthL);\n vec4 posInCameraRight = clipToEye(v_textureCoordinates + vec2(pixelSize.x, 0.0), depthR);\n\n vec3 up = posInCamera.xyz - posInCameraUp.xyz;\n vec3 down = posInCameraDown.xyz - posInCamera.xyz;\n vec3 left = posInCamera.xyz - posInCameraLeft.xyz;\n vec3 right = posInCameraRight.xyz - posInCamera.xyz;\n\n vec3 DX = length(left) < length(right) ? left : right;\n vec3 DY = length(up) < length(down) ? up : down;\n\n return normalize(cross(DY, DX));\n}\n\nvoid main(void)\n{\n float depth = czm_readDepth(depthTexture, v_textureCoordinates);\n vec4 posInCamera = clipToEye(v_textureCoordinates, depth);\n\n if (posInCamera.z > frustumLength)\n {\n gl_FragColor = vec4(1.0);\n return;\n }\n\n vec2 pixelSize = czm_pixelRatio / czm_viewport.zw;\n float depthU = czm_readDepth(depthTexture, v_textureCoordinates - vec2(0.0, pixelSize.y));\n float depthD = czm_readDepth(depthTexture, v_textureCoordinates + vec2(0.0, pixelSize.y));\n float depthL = czm_readDepth(depthTexture, v_textureCoordinates - vec2(pixelSize.x, 0.0));\n float depthR = czm_readDepth(depthTexture, v_textureCoordinates + vec2(pixelSize.x, 0.0));\n vec3 normalInCamera = getNormalXEdge(posInCamera.xyz, depthU, depthD, depthL, depthR, pixelSize);\n\n float ao = 0.0;\n vec2 sampleDirection = vec2(1.0, 0.0);\n float gapAngle = 90.0 * czm_radiansPerDegree;\n\n // RandomNoise\n float randomVal = texture2D(randomTexture, v_textureCoordinates).x;\n\n //Loop for each direction\n for (int i = 0; i < 4; i++)\n {\n float newGapAngle = gapAngle * (float(i) + randomVal);\n float cosVal = cos(newGapAngle);\n float sinVal = sin(newGapAngle);\n\n //Rotate Sampling Direction\n vec2 rotatedSampleDirection = vec2(cosVal * sampleDirection.x - sinVal * sampleDirection.y, sinVal * sampleDirection.x + cosVal * sampleDirection.y);\n float localAO = 0.0;\n float localStepSize = stepSize;\n\n //Loop for each step\n for (int j = 0; j < 6; j++)\n {\n vec2 newCoords = v_textureCoordinates + rotatedSampleDirection * localStepSize * pixelSize;\n\n //Exception Handling\n if(newCoords.x > 1.0 || newCoords.y > 1.0 || newCoords.x < 0.0 || newCoords.y < 0.0)\n {\n break;\n }\n\n float stepDepthInfo = czm_readDepth(depthTexture, newCoords);\n vec4 stepPosInCamera = clipToEye(newCoords, stepDepthInfo);\n vec3 diffVec = stepPosInCamera.xyz - posInCamera.xyz;\n float len = length(diffVec);\n\n if (len > lengthCap)\n {\n break;\n }\n\n float dotVal = clamp(dot(normalInCamera, normalize(diffVec)), 0.0, 1.0 );\n float weight = len / lengthCap;\n weight = 1.0 - weight * weight;\n\n if (dotVal < bias)\n {\n dotVal = 0.0;\n }\n\n localAO = max(localAO, dotVal * weight);\n localStepSize += stepSize;\n }\n ao += localAO;\n }\n\n ao /= 4.0;\n ao = 1.0 - clamp(ao, 0.0, 1.0);\n ao = pow(ao, intensity);\n gl_FragColor = vec4(vec3(ao), 1.0);\n}\n";
  193610. // node_modules/cesium/Source/Shaders/PostProcessStages/AmbientOcclusionModulate.js
  193611. var AmbientOcclusionModulate_default = "uniform sampler2D colorTexture;\nuniform sampler2D ambientOcclusionTexture;\nuniform bool ambientOcclusionOnly;\nvarying vec2 v_textureCoordinates;\n\nvoid main(void)\n{\n vec3 color = texture2D(colorTexture, v_textureCoordinates).rgb;\n vec3 ao = texture2D(ambientOcclusionTexture, v_textureCoordinates).rgb;\n gl_FragColor.rgb = ambientOcclusionOnly ? ao : ao * color;\n}\n";
  193612. // node_modules/cesium/Source/Shaders/PostProcessStages/BlackAndWhite.js
  193613. var BlackAndWhite_default = "uniform sampler2D colorTexture;\nuniform float gradations;\n\nvarying vec2 v_textureCoordinates;\n\nvoid main(void)\n{\n vec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;\n#ifdef CZM_SELECTED_FEATURE\n if (czm_selected()) {\n gl_FragColor = vec4(rgb, 1.0);\n return;\n }\n#endif\n float luminance = czm_luminance(rgb);\n float darkness = luminance * gradations;\n darkness = (darkness - fract(darkness)) / gradations;\n gl_FragColor = vec4(vec3(darkness), 1.0);\n}\n";
  193614. // node_modules/cesium/Source/Shaders/PostProcessStages/BloomComposite.js
  193615. var BloomComposite_default = "uniform sampler2D colorTexture;\nuniform sampler2D bloomTexture;\nuniform bool glowOnly;\n\nvarying vec2 v_textureCoordinates;\n\nvoid main(void)\n{\n vec4 color = texture2D(colorTexture, v_textureCoordinates);\n\n#ifdef CZM_SELECTED_FEATURE\n if (czm_selected()) {\n gl_FragColor = color;\n return;\n }\n#endif\n\n vec4 bloom = texture2D(bloomTexture, v_textureCoordinates);\n gl_FragColor = glowOnly ? bloom : bloom + color;\n}\n";
  193616. // node_modules/cesium/Source/Shaders/PostProcessStages/Brightness.js
  193617. var Brightness_default = "uniform sampler2D colorTexture;\nuniform float brightness;\n\nvarying vec2 v_textureCoordinates;\n\nvoid main(void)\n{\n vec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;\n vec3 target = vec3(0.0);\n gl_FragColor = vec4(mix(target, rgb, brightness), 1.0);\n}\n";
  193618. // node_modules/cesium/Source/Shaders/PostProcessStages/ContrastBias.js
  193619. var ContrastBias_default = "uniform sampler2D colorTexture;\nuniform float contrast;\nuniform float brightness;\n\nvarying vec2 v_textureCoordinates;\n\nvoid main(void)\n{\n vec3 sceneColor = texture2D(colorTexture, v_textureCoordinates).xyz;\n sceneColor = czm_RGBToHSB(sceneColor);\n sceneColor.z += brightness;\n sceneColor = czm_HSBToRGB(sceneColor);\n\n float factor = (259.0 * (contrast + 255.0)) / (255.0 * (259.0 - contrast));\n sceneColor = factor * (sceneColor - vec3(0.5)) + vec3(0.5);\n gl_FragColor = vec4(sceneColor, 1.0);\n}\n";
  193620. // node_modules/cesium/Source/Shaders/PostProcessStages/DepthOfField.js
  193621. var DepthOfField_default = "uniform sampler2D colorTexture;\nuniform sampler2D blurTexture;\nuniform sampler2D depthTexture;\nuniform float focalDistance;\n\nvarying vec2 v_textureCoordinates;\n\nvec4 toEye(vec2 uv, float depth)\n{\n vec2 xy = vec2((uv.x * 2.0 - 1.0), ((1.0 - uv.y) * 2.0 - 1.0));\n vec4 posInCamera = czm_inverseProjection * vec4(xy, depth, 1.0);\n posInCamera = posInCamera / posInCamera.w;\n return posInCamera;\n}\n\nfloat computeDepthBlur(float depth)\n{\n float f;\n if (depth < focalDistance)\n {\n f = (focalDistance - depth) / (focalDistance - czm_currentFrustum.x);\n }\n else\n {\n f = (depth - focalDistance) / (czm_currentFrustum.y - focalDistance);\n f = pow(f, 0.1);\n }\n f *= f;\n f = clamp(f, 0.0, 1.0);\n return pow(f, 0.5);\n}\n\nvoid main(void)\n{\n float depth = czm_readDepth(depthTexture, v_textureCoordinates);\n vec4 posInCamera = toEye(v_textureCoordinates, depth);\n float d = computeDepthBlur(-posInCamera.z);\n gl_FragColor = mix(texture2D(colorTexture, v_textureCoordinates), texture2D(blurTexture, v_textureCoordinates), d);\n}\n";
  193622. // node_modules/cesium/Source/Shaders/PostProcessStages/DepthView.js
  193623. var DepthView_default = "uniform sampler2D depthTexture;\n\nvarying vec2 v_textureCoordinates;\n\nvoid main(void)\n{\n float depth = czm_readDepth(depthTexture, v_textureCoordinates);\n gl_FragColor = vec4(vec3(depth), 1.0);\n}\n";
  193624. // node_modules/cesium/Source/Shaders/PostProcessStages/EdgeDetection.js
  193625. var EdgeDetection_default = "uniform sampler2D depthTexture;\nuniform float length;\nuniform vec4 color;\n\nvarying vec2 v_textureCoordinates;\n\nvoid main(void)\n{\n float directions[3];\n directions[0] = -1.0;\n directions[1] = 0.0;\n directions[2] = 1.0;\n\n float scalars[3];\n scalars[0] = 3.0;\n scalars[1] = 10.0;\n scalars[2] = 3.0;\n\n float padx = czm_pixelRatio / czm_viewport.z;\n float pady = czm_pixelRatio / czm_viewport.w;\n\n#ifdef CZM_SELECTED_FEATURE\n bool selected = false;\n for (int i = 0; i < 3; ++i)\n {\n float dir = directions[i];\n selected = selected || czm_selected(vec2(-padx, dir * pady));\n selected = selected || czm_selected(vec2(padx, dir * pady));\n selected = selected || czm_selected(vec2(dir * padx, -pady));\n selected = selected || czm_selected(vec2(dir * padx, pady));\n if (selected)\n {\n break;\n }\n }\n if (!selected)\n {\n gl_FragColor = vec4(color.rgb, 0.0);\n return;\n }\n#endif\n\n float horizEdge = 0.0;\n float vertEdge = 0.0;\n\n for (int i = 0; i < 3; ++i)\n {\n float dir = directions[i];\n float scale = scalars[i];\n\n horizEdge -= texture2D(depthTexture, v_textureCoordinates + vec2(-padx, dir * pady)).x * scale;\n horizEdge += texture2D(depthTexture, v_textureCoordinates + vec2(padx, dir * pady)).x * scale;\n\n vertEdge -= texture2D(depthTexture, v_textureCoordinates + vec2(dir * padx, -pady)).x * scale;\n vertEdge += texture2D(depthTexture, v_textureCoordinates + vec2(dir * padx, pady)).x * scale;\n }\n\n float len = sqrt(horizEdge * horizEdge + vertEdge * vertEdge);\n gl_FragColor = vec4(color.rgb, len > length ? color.a : 0.0);\n}\n";
  193626. // node_modules/cesium/Source/Shaders/PostProcessStages/FilmicTonemapping.js
  193627. var FilmicTonemapping_default = "uniform sampler2D colorTexture;\n\nvarying vec2 v_textureCoordinates;\n\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\n\n// See slides 142 and 143:\n// http://www.gdcvault.com/play/1012459/Uncharted_2__HDR_Lighting\n\nvoid main()\n{\n vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);\n vec3 color = fragmentColor.rgb;\n\n#ifdef AUTO_EXPOSURE\n float exposure = texture2D(autoExposure, vec2(0.5)).r;\n color /= exposure;\n#endif\n\n const float A = 0.22; // shoulder strength\n const float B = 0.30; // linear strength\n const float C = 0.10; // linear angle\n const float D = 0.20; // toe strength\n const float E = 0.01; // toe numerator\n const float F = 0.30; // toe denominator\n\n const float white = 11.2; // linear white point value\n\n vec3 c = ((color * (A * color + C * B) + D * E) / (color * ( A * color + B) + D * F)) - E / F;\n float w = ((white * (A * white + C * B) + D * E) / (white * ( A * white + B) + D * F)) - E / F;\n\n c = czm_inverseGamma(c / w);\n gl_FragColor = vec4(c, fragmentColor.a);\n}\n";
  193628. // node_modules/cesium/Source/Shaders/PostProcessStages/FXAA.js
  193629. var FXAA_default = "varying vec2 v_textureCoordinates;\n\nuniform sampler2D colorTexture;\n\nconst float fxaaQualitySubpix = 0.5;\nconst float fxaaQualityEdgeThreshold = 0.125;\nconst float fxaaQualityEdgeThresholdMin = 0.0833;\n\nvoid main()\n{\n vec2 fxaaQualityRcpFrame = vec2(1.0) / czm_viewport.zw;\n vec4 color = FxaaPixelShader(\n v_textureCoordinates,\n colorTexture,\n fxaaQualityRcpFrame,\n fxaaQualitySubpix,\n fxaaQualityEdgeThreshold,\n fxaaQualityEdgeThresholdMin);\n float alpha = texture2D(colorTexture, v_textureCoordinates).a;\n gl_FragColor = vec4(color.rgb, alpha);\n}\n";
  193630. // node_modules/cesium/Source/Shaders/PostProcessStages/GaussianBlur1D.js
  193631. var GaussianBlur1D_default = "#define SAMPLES 8\n\nuniform float delta;\nuniform float sigma;\nuniform float direction; // 0.0 for x direction, 1.0 for y direction\n\nuniform sampler2D colorTexture;\n\n#ifdef USE_STEP_SIZE\nuniform float stepSize;\n#else\nuniform vec2 step;\n#endif\n\nvarying vec2 v_textureCoordinates;\n\n// Incremental Computation of the Gaussian:\n// https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch40.html\n\nvoid main()\n{\n vec2 st = v_textureCoordinates;\n vec2 dir = vec2(1.0 - direction, direction);\n\n#ifdef USE_STEP_SIZE\n vec2 step = vec2(stepSize * (czm_pixelRatio / czm_viewport.zw));\n#else\n vec2 step = step;\n#endif\n\n vec3 g;\n g.x = 1.0 / (sqrt(czm_twoPi) * sigma);\n g.y = exp((-0.5 * delta * delta) / (sigma * sigma));\n g.z = g.y * g.y;\n\n vec4 result = texture2D(colorTexture, st) * g.x;\n for (int i = 1; i < SAMPLES; ++i)\n {\n g.xy *= g.yz;\n\n vec2 offset = float(i) * dir * step;\n result += texture2D(colorTexture, st - offset) * g.x;\n result += texture2D(colorTexture, st + offset) * g.x;\n }\n\n gl_FragColor = result;\n}\n";
  193632. // node_modules/cesium/Source/Shaders/PostProcessStages/LensFlare.js
  193633. var LensFlare_default = "uniform sampler2D colorTexture;\nuniform sampler2D dirtTexture;\nuniform sampler2D starTexture;\nuniform vec2 dirtTextureDimensions;\nuniform float distortion;\nuniform float ghostDispersal;\nuniform float haloWidth;\nuniform float dirtAmount;\nuniform float earthRadius;\nuniform float intensity;\n\nvarying vec2 v_textureCoordinates;\n\n// whether it is in space or not\n// 6500000.0 is empirical value\n#define DISTANCE_TO_SPACE 6500000.0\n\n// return ndc from world coordinate biased earthRadius\nvec4 getNDCFromWC(vec3 WC, float earthRadius)\n{\n vec4 positionEC = czm_view * vec4(WC, 1.0);\n positionEC = vec4(positionEC.x + earthRadius, positionEC.y, positionEC.z, 1.0);\n vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\n return czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);\n}\n\n// Check if current pixel is included Earth\n// if then mask it gradually\nfloat isInEarth(vec2 texcoord, vec2 sceneSize)\n{\n vec2 NDC = texcoord * 2.0 - 1.0;\n vec4 earthPosSC = getNDCFromWC(vec3(0.0), 0.0);\n vec4 earthPosSCEdge = getNDCFromWC(vec3(0.0), earthRadius * 1.5);\n NDC.xy -= earthPosSC.xy;\n\n float X = abs(NDC.x) * sceneSize.x;\n float Y = abs(NDC.y) * sceneSize.y;\n\n return clamp(0.0, 1.0, max(sqrt(X * X + Y * Y) / max(abs(earthPosSCEdge.x * sceneSize.x), 1.0) - 0.8 , 0.0));\n}\n\n// For Chromatic effect\nvec4 textureDistorted(sampler2D tex, vec2 texcoord, vec2 direction, vec3 distortion, bool isSpace)\n{\n vec2 sceneSize = czm_viewport.zw;\n vec3 color;\n if(isSpace)\n {\n color.r = isInEarth(texcoord + direction * distortion.r, sceneSize) * texture2D(tex, texcoord + direction * distortion.r).r;\n color.g = isInEarth(texcoord + direction * distortion.g, sceneSize) * texture2D(tex, texcoord + direction * distortion.g).g;\n color.b = isInEarth(texcoord + direction * distortion.b, sceneSize) * texture2D(tex, texcoord + direction * distortion.b).b;\n }\n else\n {\n color.r = texture2D(tex, texcoord + direction * distortion.r).r;\n color.g = texture2D(tex, texcoord + direction * distortion.g).g;\n color.b = texture2D(tex, texcoord + direction * distortion.b).b;\n }\n return vec4(clamp(color, 0.0, 1.0), 0.0);\n}\n\nvoid main(void)\n{\n vec4 originalColor = texture2D(colorTexture, v_textureCoordinates);\n vec3 rgb = originalColor.rgb;\n bool isSpace = length(czm_viewerPositionWC.xyz) > DISTANCE_TO_SPACE;\n\n // Sun position\n vec4 sunPos = czm_morphTime == 1.0 ? vec4(czm_sunPositionWC, 1.0) : vec4(czm_sunPositionColumbusView.zxy, 1.0);\n vec4 sunPositionEC = czm_view * sunPos;\n vec4 sunPositionWC = czm_eyeToWindowCoordinates(sunPositionEC);\n sunPos = czm_viewportOrthographic * vec4(sunPositionWC.xy, -sunPositionWC.z, 1.0);\n\n // If sun is not in the screen space, use original color.\n if(!isSpace || !((sunPos.x >= -1.1 && sunPos.x <= 1.1) && (sunPos.y >= -1.1 && sunPos.y <= 1.1)))\n {\n // Lens flare is disabled when not in space until #5932 is fixed.\n // https://github.com/CesiumGS/cesium/issues/5932\n gl_FragColor = originalColor;\n return;\n }\n\n vec2 texcoord = vec2(1.0) - v_textureCoordinates;\n vec2 pixelSize = czm_pixelRatio / czm_viewport.zw;\n vec2 invPixelSize = 1.0 / pixelSize;\n vec3 distortionVec = pixelSize.x * vec3(-distortion, 0.0, distortion);\n\n // ghost vector to image centre:\n vec2 ghostVec = (vec2(0.5) - texcoord) * ghostDispersal;\n vec3 direction = normalize(vec3(ghostVec, 0.0));\n\n // sample ghosts:\n vec4 result = vec4(0.0);\n vec4 ghost = vec4(0.0);\n for (int i = 0; i < 4; ++i)\n {\n vec2 offset = fract(texcoord + ghostVec * float(i));\n // Only bright spots from the centre of the source image\n ghost += textureDistorted(colorTexture, offset, direction.xy, distortionVec, isSpace);\n }\n result += ghost;\n\n // sample halo\n vec2 haloVec = normalize(ghostVec) * haloWidth;\n float weightForHalo = length(vec2(0.5) - fract(texcoord + haloVec)) / length(vec2(0.5));\n weightForHalo = pow(1.0 - weightForHalo, 5.0);\n\n result += textureDistorted(colorTexture, texcoord + haloVec, direction.xy, distortionVec, isSpace) * weightForHalo * 1.5;\n\n // dirt on lens\n vec2 dirtTexCoords = (v_textureCoordinates * invPixelSize) / dirtTextureDimensions;\n if (dirtTexCoords.x > 1.0)\n {\n dirtTexCoords.x = mod(floor(dirtTexCoords.x), 2.0) == 1.0 ? 1.0 - fract(dirtTexCoords.x) : fract(dirtTexCoords.x);\n }\n if (dirtTexCoords.y > 1.0)\n {\n dirtTexCoords.y = mod(floor(dirtTexCoords.y), 2.0) == 1.0 ? 1.0 - fract(dirtTexCoords.y) : fract(dirtTexCoords.y);\n }\n result += dirtAmount * texture2D(dirtTexture, dirtTexCoords);\n\n // Rotating starburst texture's coordinate\n // dot(czm_view[0].xyz, vec3(0.0, 0.0, 1.0)) + dot(czm_view[1].xyz, vec3(0.0, 1.0, 0.0))\n float camrot = czm_view[0].z + czm_view[1].y;\n float cosValue = cos(camrot);\n float sinValue = sin(camrot);\n mat3 rotation = mat3(\n cosValue, -sinValue, 0.0,\n sinValue, cosValue, 0.0,\n 0.0, 0.0, 1.0\n );\n\n vec3 st1 = vec3(v_textureCoordinates * 2.0 - vec2(1.0), 1.0);\n vec3 st2 = vec3((rotation * st1).xy, 1.0);\n vec3 st3 = st2 * 0.5 + vec3(0.5);\n vec2 lensStarTexcoord = st3.xy;\n float weightForLensFlare = length(vec3(sunPos.xy, 0.0));\n float oneMinusWeightForLensFlare = max(1.0 - weightForLensFlare, 0.0);\n\n if (!isSpace)\n {\n result *= oneMinusWeightForLensFlare * intensity * 0.2;\n }\n else\n {\n result *= oneMinusWeightForLensFlare * intensity;\n result *= texture2D(starTexture, lensStarTexcoord) * pow(weightForLensFlare, 1.0) * max((1.0 - length(vec3(st1.xy, 0.0))), 0.0) * 2.0;\n }\n\n result += texture2D(colorTexture, v_textureCoordinates);\n\n gl_FragColor = result;\n}\n";
  193634. // node_modules/cesium/Source/Shaders/PostProcessStages/ModifiedReinhardTonemapping.js
  193635. var ModifiedReinhardTonemapping_default = "uniform sampler2D colorTexture;\nuniform vec3 white;\n\nvarying vec2 v_textureCoordinates;\n\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\n\n// See equation 4:\n// http://www.cs.utah.edu/~reinhard/cdrom/tonemap.pdf\n\nvoid main()\n{\n vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);\n vec3 color = fragmentColor.rgb;\n#ifdef AUTO_EXPOSURE\n float exposure = texture2D(autoExposure, vec2(0.5)).r;\n color /= exposure;\n#endif\n color = (color * (1.0 + color / white)) / (1.0 + color);\n color = czm_inverseGamma(color);\n gl_FragColor = vec4(color, fragmentColor.a);\n}\n";
  193636. // node_modules/cesium/Source/Shaders/PostProcessStages/NightVision.js
  193637. var NightVision_default = "uniform sampler2D colorTexture;\n\nvarying vec2 v_textureCoordinates;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy ,vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main(void)\n{\n float noiseValue = rand(v_textureCoordinates + sin(czm_frameNumber)) * 0.1;\n vec3 rgb = texture2D(colorTexture, v_textureCoordinates).rgb;\n vec3 green = vec3(0.0, 1.0, 0.0);\n gl_FragColor = vec4((noiseValue + rgb) * green, 1.0);\n}\n";
  193638. // node_modules/cesium/Source/Shaders/PostProcessStages/ReinhardTonemapping.js
  193639. var ReinhardTonemapping_default = "uniform sampler2D colorTexture;\n\nvarying vec2 v_textureCoordinates;\n\n#ifdef AUTO_EXPOSURE\nuniform sampler2D autoExposure;\n#endif\n\n// See equation 3:\n// http://www.cs.utah.edu/~reinhard/cdrom/tonemap.pdf\n\nvoid main()\n{\n vec4 fragmentColor = texture2D(colorTexture, v_textureCoordinates);\n vec3 color = fragmentColor.rgb;\n#ifdef AUTO_EXPOSURE\n float exposure = texture2D(autoExposure, vec2(0.5)).r;\n color /= exposure;\n#endif\n color = color / (1.0 + color);\n color = czm_inverseGamma(color);\n gl_FragColor = vec4(color, fragmentColor.a);\n}\n";
  193640. // node_modules/cesium/Source/Shaders/PostProcessStages/Silhouette.js
  193641. var Silhouette_default = "uniform sampler2D colorTexture;\nuniform sampler2D silhouetteTexture;\n\nvarying vec2 v_textureCoordinates;\n\nvoid main(void)\n{\n vec4 silhouetteColor = texture2D(silhouetteTexture, v_textureCoordinates);\n vec4 color = texture2D(colorTexture, v_textureCoordinates);\n gl_FragColor = mix(color, silhouetteColor, silhouetteColor.a);\n}\n";
  193642. // node_modules/cesium/Source/Shaders/FXAA3_11.js
  193643. var FXAA3_11_default = "/**\n * @license\n * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * * Neither the name of NVIDIA CORPORATION nor the names of its\n * contributors may be used to endorse or promote products derived\n * from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY\n * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n// NVIDIA GameWorks Graphics Samples GitHub link: https://github.com/NVIDIAGameWorks/GraphicsSamples\n// Original FXAA 3.11 shader link: https://github.com/NVIDIAGameWorks/GraphicsSamples/blob/master/samples/es3-kepler/FXAA/FXAA3_11.h\n\n// Steps used to integrate into Cesium:\n// * The following defines are set:\n// #define FXAA_PC 1\n// #define FXAA_WEBGL_1 1\n// #define FXAA_GREEN_AS_LUMA 1\n// #define FXAA_EARLY_EXIT 1\n// #define FXAA_GLSL_120 1\n// * All other preprocessor directives besides the FXAA_QUALITY__P* directives were removed.\n// * Double underscores are invalid for preprocessor directives so replace them with a single underscore. Replace\n// /FXAA_QUALITY__P(.*)/g with /FXAA_QUALITY__P$1/.\n// * There are no implicit conversions from ivec* to vec* so replace:\n// #define FxaaInt2 ivec2\n// with\n// #define FxaaInt2 vec2\n// * The texture2DLod function is only available in vertex shaders so replace:\n// #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)\n// #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)\n// with\n// #define FxaaTexTop(t, p) texture2D(t, p)\n// #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r))\n// * FXAA_QUALITY_PRESET is prepended in the javascript code. We may want to expose that setting in the future.\n// * The following parameters to FxaaPixelShader are unused and can be removed:\n// fxaaConsolePosPos\n// fxaaConsoleRcpFrameOpt\n// fxaaConsoleRcpFrameOpt2\n// fxaaConsole360RcpFrameOpt2\n// fxaaConsoleEdgeSharpness\n// fxaaConsoleEdgeThreshold\n// fxaaConsoleEdgeThresholdMi\n// fxaaConsole360ConstDir\n\n//\n// Choose the quality preset.\n// This needs to be compiled into the shader as it effects code.\n// Best option to include multiple presets is to\n// in each shader define the preset, then include this file.\n//\n// OPTIONS\n// -----------------------------------------------------------------------\n// 10 to 15 - default medium dither (10=fastest, 15=highest quality)\n// 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)\n// 39 - no dither, very expensive\n//\n// NOTES\n// -----------------------------------------------------------------------\n// 12 = slightly faster then FXAA 3.9 and higher edge quality (default)\n// 13 = about same speed as FXAA 3.9 and better than 12\n// 23 = closest to FXAA 3.9 visually and performance wise\n// _ = the lowest digit is directly related to performance\n// _ = the highest digit is directly related to style\n//\n//#define FXAA_QUALITY_PRESET 12\n\n\n#if (FXAA_QUALITY_PRESET == 10)\n #define FXAA_QUALITY_PS 3\n #define FXAA_QUALITY_P0 1.5\n #define FXAA_QUALITY_P1 3.0\n #define FXAA_QUALITY_P2 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 11)\n #define FXAA_QUALITY_PS 4\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 3.0\n #define FXAA_QUALITY_P3 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 12)\n #define FXAA_QUALITY_PS 5\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 4.0\n #define FXAA_QUALITY_P4 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 13)\n #define FXAA_QUALITY_PS 6\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 4.0\n #define FXAA_QUALITY_P5 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 14)\n #define FXAA_QUALITY_PS 7\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 4.0\n #define FXAA_QUALITY_P6 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 15)\n #define FXAA_QUALITY_PS 8\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 4.0\n #define FXAA_QUALITY_P7 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 20)\n #define FXAA_QUALITY_PS 3\n #define FXAA_QUALITY_P0 1.5\n #define FXAA_QUALITY_P1 2.0\n #define FXAA_QUALITY_P2 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 21)\n #define FXAA_QUALITY_PS 4\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 22)\n #define FXAA_QUALITY_PS 5\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 23)\n #define FXAA_QUALITY_PS 6\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 24)\n #define FXAA_QUALITY_PS 7\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 3.0\n #define FXAA_QUALITY_P6 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 25)\n #define FXAA_QUALITY_PS 8\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 4.0\n #define FXAA_QUALITY_P7 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 26)\n #define FXAA_QUALITY_PS 9\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 4.0\n #define FXAA_QUALITY_P8 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 27)\n #define FXAA_QUALITY_PS 10\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 4.0\n #define FXAA_QUALITY_P9 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 28)\n #define FXAA_QUALITY_PS 11\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 4.0\n #define FXAA_QUALITY_P10 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 29)\n #define FXAA_QUALITY_PS 12\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 2.0\n #define FXAA_QUALITY_P10 4.0\n #define FXAA_QUALITY_P11 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 39)\n #define FXAA_QUALITY_PS 12\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.0\n #define FXAA_QUALITY_P2 1.0\n #define FXAA_QUALITY_P3 1.0\n #define FXAA_QUALITY_P4 1.0\n #define FXAA_QUALITY_P5 1.5\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 2.0\n #define FXAA_QUALITY_P10 4.0\n #define FXAA_QUALITY_P11 8.0\n#endif\n\n#define FxaaBool bool\n#define FxaaFloat float\n#define FxaaFloat2 vec2\n#define FxaaFloat3 vec3\n#define FxaaFloat4 vec4\n#define FxaaHalf float\n#define FxaaHalf2 vec2\n#define FxaaHalf3 vec3\n#define FxaaHalf4 vec4\n#define FxaaInt2 vec2\n#define FxaaTex sampler2D\n\n#define FxaaSat(x) clamp(x, 0.0, 1.0)\n#define FxaaTexTop(t, p) texture2D(t, p)\n#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r))\n\nFxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }\n\nFxaaFloat4 FxaaPixelShader(\n //\n // Use noperspective interpolation here (turn off perspective interpolation).\n // {xy} = center of pixel\n FxaaFloat2 pos,\n //\n // Input color texture.\n // {rgb_} = color in linear or perceptual color space\n // if (FXAA_GREEN_AS_LUMA == 0)\n // {___a} = luma in perceptual color space (not linear)\n FxaaTex tex,\n //\n // Only used on FXAA Quality.\n // This must be from a constant/uniform.\n // {x_} = 1.0/screenWidthInPixels\n // {_y} = 1.0/screenHeightInPixels\n FxaaFloat2 fxaaQualityRcpFrame,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY_SUBPIX define.\n // It is here now to allow easier tuning.\n // Choose the amount of sub-pixel aliasing removal.\n // This can effect sharpness.\n // 1.00 - upper limit (softer)\n // 0.75 - default amount of filtering\n // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)\n // 0.25 - almost off\n // 0.00 - completely off\n FxaaFloat fxaaQualitySubpix,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY_EDGE_THRESHOLD define.\n // It is here now to allow easier tuning.\n // The minimum amount of local contrast required to apply algorithm.\n // 0.333 - too little (faster)\n // 0.250 - low quality\n // 0.166 - default\n // 0.125 - high quality\n // 0.063 - overkill (slower)\n FxaaFloat fxaaQualityEdgeThreshold,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY_EDGE_THRESHOLD_MIN define.\n // It is here now to allow easier tuning.\n // Trims the algorithm from processing darks.\n // 0.0833 - upper limit (default, the start of visible unfiltered edges)\n // 0.0625 - high quality (faster)\n // 0.0312 - visible limit (slower)\n // Special notes when using FXAA_GREEN_AS_LUMA,\n // Likely want to set this to zero.\n // As colors that are mostly not-green\n // will appear very dark in the green channel!\n // Tune by looking at mostly non-green content,\n // then start at zero and increase until aliasing is a problem.\n FxaaFloat fxaaQualityEdgeThresholdMin\n) {\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posM;\n posM.x = pos.x;\n posM.y = pos.y;\n FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\n #define lumaM rgbyM.y\n FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));\n/*--------------------------------------------------------------------------*/\n FxaaFloat maxSM = max(lumaS, lumaM);\n FxaaFloat minSM = min(lumaS, lumaM);\n FxaaFloat maxESM = max(lumaE, maxSM);\n FxaaFloat minESM = min(lumaE, minSM);\n FxaaFloat maxWN = max(lumaN, lumaW);\n FxaaFloat minWN = min(lumaN, lumaW);\n FxaaFloat rangeMax = max(maxWN, maxESM);\n FxaaFloat rangeMin = min(minWN, minESM);\n FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\n FxaaFloat range = rangeMax - rangeMin;\n FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\n FxaaBool earlyExit = range < rangeMaxClamped;\n/*--------------------------------------------------------------------------*/\n if(earlyExit)\n return rgbyM;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNS = lumaN + lumaS;\n FxaaFloat lumaWE = lumaW + lumaE;\n FxaaFloat subpixRcpRange = 1.0/range;\n FxaaFloat subpixNSWE = lumaNS + lumaWE;\n FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;\n FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNESE = lumaNE + lumaSE;\n FxaaFloat lumaNWNE = lumaNW + lumaNE;\n FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\n FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNWSW = lumaNW + lumaSW;\n FxaaFloat lumaSWSE = lumaSW + lumaSE;\n FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\n FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\n FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\n FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\n FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;\n FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;\n/*--------------------------------------------------------------------------*/\n FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;\n FxaaFloat lengthSign = fxaaQualityRcpFrame.x;\n FxaaBool horzSpan = edgeHorz >= edgeVert;\n FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\n/*--------------------------------------------------------------------------*/\n if(!horzSpan) lumaN = lumaW;\n if(!horzSpan) lumaS = lumaE;\n if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;\n FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;\n/*--------------------------------------------------------------------------*/\n FxaaFloat gradientN = lumaN - lumaM;\n FxaaFloat gradientS = lumaS - lumaM;\n FxaaFloat lumaNN = lumaN + lumaM;\n FxaaFloat lumaSS = lumaS + lumaM;\n FxaaBool pairN = abs(gradientN) >= abs(gradientS);\n FxaaFloat gradient = max(abs(gradientN), abs(gradientS));\n if(pairN) lengthSign = -lengthSign;\n FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posB;\n posB.x = posM.x;\n posB.y = posM.y;\n FxaaFloat2 offNP;\n offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n if(!horzSpan) posB.x += lengthSign * 0.5;\n if( horzSpan) posB.y += lengthSign * 0.5;\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posN;\n posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;\n posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;\n FxaaFloat2 posP;\n posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;\n posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;\n FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;\n FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));\n FxaaFloat subpixE = subpixC * subpixC;\n FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));\n/*--------------------------------------------------------------------------*/\n if(!pairN) lumaNN = lumaSS;\n FxaaFloat gradientScaled = gradient * 1.0/4.0;\n FxaaFloat lumaMM = lumaM - lumaNN * 0.5;\n FxaaFloat subpixF = subpixD * subpixE;\n FxaaBool lumaMLTZero = lumaMM < 0.0;\n/*--------------------------------------------------------------------------*/\n lumaEndN -= lumaNN * 0.5;\n lumaEndP -= lumaNN * 0.5;\n FxaaBool doneN = abs(lumaEndN) >= gradientScaled;\n FxaaBool doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;\n FxaaBool doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;\n/*--------------------------------------------------------------------------*/\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 3)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 4)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 5)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 6)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 7)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 8)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 9)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 10)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 11)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY_PS > 12)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n/*--------------------------------------------------------------------------*/\n FxaaFloat dstN = posM.x - posN.x;\n FxaaFloat dstP = posP.x - posM.x;\n if(!horzSpan) dstN = posM.y - posN.y;\n if(!horzSpan) dstP = posP.y - posM.y;\n/*--------------------------------------------------------------------------*/\n FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\n FxaaFloat spanLength = (dstP + dstN);\n FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\n FxaaFloat spanLengthRcp = 1.0/spanLength;\n/*--------------------------------------------------------------------------*/\n FxaaBool directionN = dstN < dstP;\n FxaaFloat dst = min(dstN, dstP);\n FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;\n FxaaFloat subpixG = subpixF * subpixF;\n FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\n FxaaFloat subpixH = subpixG * fxaaQualitySubpix;\n/*--------------------------------------------------------------------------*/\n FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\n FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\n if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;\n if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;\n return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);\n}\n";
  193644. // node_modules/cesium/Source/Scene/PostProcessStageComposite.js
  193645. function PostProcessStageComposite(options) {
  193646. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  193647. Check_default.defined("options.stages", options.stages);
  193648. Check_default.typeOf.number.greaterThan(
  193649. "options.stages.length",
  193650. options.stages.length,
  193651. 0
  193652. );
  193653. this._stages = options.stages;
  193654. this._inputPreviousStageTexture = defaultValue_default(
  193655. options.inputPreviousStageTexture,
  193656. true
  193657. );
  193658. let name = options.name;
  193659. if (!defined_default(name)) {
  193660. name = createGuid_default();
  193661. }
  193662. this._name = name;
  193663. this._uniforms = options.uniforms;
  193664. this._textureCache = void 0;
  193665. this._index = void 0;
  193666. this._selected = void 0;
  193667. this._selectedShadow = void 0;
  193668. this._parentSelected = void 0;
  193669. this._parentSelectedShadow = void 0;
  193670. this._combinedSelected = void 0;
  193671. this._combinedSelectedShadow = void 0;
  193672. this._selectedLength = 0;
  193673. this._parentSelectedLength = 0;
  193674. this._selectedDirty = true;
  193675. }
  193676. Object.defineProperties(PostProcessStageComposite.prototype, {
  193677. ready: {
  193678. get: function() {
  193679. const stages = this._stages;
  193680. const length3 = stages.length;
  193681. for (let i2 = 0; i2 < length3; ++i2) {
  193682. if (!stages[i2].ready) {
  193683. return false;
  193684. }
  193685. }
  193686. return true;
  193687. }
  193688. },
  193689. name: {
  193690. get: function() {
  193691. return this._name;
  193692. }
  193693. },
  193694. enabled: {
  193695. get: function() {
  193696. return this._stages[0].enabled;
  193697. },
  193698. set: function(value) {
  193699. const stages = this._stages;
  193700. const length3 = stages.length;
  193701. for (let i2 = 0; i2 < length3; ++i2) {
  193702. stages[i2].enabled = value;
  193703. }
  193704. }
  193705. },
  193706. uniforms: {
  193707. get: function() {
  193708. return this._uniforms;
  193709. }
  193710. },
  193711. inputPreviousStageTexture: {
  193712. get: function() {
  193713. return this._inputPreviousStageTexture;
  193714. }
  193715. },
  193716. length: {
  193717. get: function() {
  193718. return this._stages.length;
  193719. }
  193720. },
  193721. selected: {
  193722. get: function() {
  193723. return this._selected;
  193724. },
  193725. set: function(value) {
  193726. this._selected = value;
  193727. }
  193728. },
  193729. parentSelected: {
  193730. get: function() {
  193731. return this._parentSelected;
  193732. },
  193733. set: function(value) {
  193734. this._parentSelected = value;
  193735. }
  193736. }
  193737. });
  193738. PostProcessStageComposite.prototype._isSupported = function(context) {
  193739. const stages = this._stages;
  193740. const length3 = stages.length;
  193741. for (let i2 = 0; i2 < length3; ++i2) {
  193742. if (!stages[i2]._isSupported(context)) {
  193743. return false;
  193744. }
  193745. }
  193746. return true;
  193747. };
  193748. PostProcessStageComposite.prototype.get = function(index2) {
  193749. Check_default.typeOf.number.greaterThanOrEquals("index", index2, 0);
  193750. Check_default.typeOf.number.lessThan("index", index2, this.length);
  193751. return this._stages[index2];
  193752. };
  193753. function isSelectedTextureDirty2(stage) {
  193754. let length3 = defined_default(stage._selected) ? stage._selected.length : 0;
  193755. const parentLength = defined_default(stage._parentSelected) ? stage._parentSelected : 0;
  193756. let dirty = stage._selected !== stage._selectedShadow || length3 !== stage._selectedLength;
  193757. dirty = dirty || stage._parentSelected !== stage._parentSelectedShadow || parentLength !== stage._parentSelectedLength;
  193758. if (defined_default(stage._selected) && defined_default(stage._parentSelected)) {
  193759. stage._combinedSelected = stage._selected.concat(stage._parentSelected);
  193760. } else if (defined_default(stage._parentSelected)) {
  193761. stage._combinedSelected = stage._parentSelected;
  193762. } else {
  193763. stage._combinedSelected = stage._selected;
  193764. }
  193765. if (!dirty && defined_default(stage._combinedSelected)) {
  193766. if (!defined_default(stage._combinedSelectedShadow)) {
  193767. return true;
  193768. }
  193769. length3 = stage._combinedSelected.length;
  193770. for (let i2 = 0; i2 < length3; ++i2) {
  193771. if (stage._combinedSelected[i2] !== stage._combinedSelectedShadow[i2]) {
  193772. return true;
  193773. }
  193774. }
  193775. }
  193776. return dirty;
  193777. }
  193778. PostProcessStageComposite.prototype.update = function(context, useLogDepth) {
  193779. this._selectedDirty = isSelectedTextureDirty2(this);
  193780. this._selectedShadow = this._selected;
  193781. this._parentSelectedShadow = this._parentSelected;
  193782. this._combinedSelectedShadow = this._combinedSelected;
  193783. this._selectedLength = defined_default(this._selected) ? this._selected.length : 0;
  193784. this._parentSelectedLength = defined_default(this._parentSelected) ? this._parentSelected.length : 0;
  193785. const stages = this._stages;
  193786. const length3 = stages.length;
  193787. for (let i2 = 0; i2 < length3; ++i2) {
  193788. const stage = stages[i2];
  193789. if (this._selectedDirty) {
  193790. stage.parentSelected = this._combinedSelected;
  193791. }
  193792. stage.update(context, useLogDepth);
  193793. }
  193794. };
  193795. PostProcessStageComposite.prototype.isDestroyed = function() {
  193796. return false;
  193797. };
  193798. PostProcessStageComposite.prototype.destroy = function() {
  193799. const stages = this._stages;
  193800. const length3 = stages.length;
  193801. for (let i2 = 0; i2 < length3; ++i2) {
  193802. stages[i2].destroy();
  193803. }
  193804. return destroyObject_default(this);
  193805. };
  193806. var PostProcessStageComposite_default = PostProcessStageComposite;
  193807. // node_modules/cesium/Source/Scene/PostProcessStageLibrary.js
  193808. var PostProcessStageLibrary = {};
  193809. function createBlur(name) {
  193810. const delta = 1;
  193811. const sigma = 2;
  193812. const stepSize = 1;
  193813. const blurShader = `#define USE_STEP_SIZE
  193814. ${GaussianBlur1D_default}`;
  193815. const blurX = new PostProcessStage_default({
  193816. name: `${name}_x_direction`,
  193817. fragmentShader: blurShader,
  193818. uniforms: {
  193819. delta,
  193820. sigma,
  193821. stepSize,
  193822. direction: 0
  193823. },
  193824. sampleMode: PostProcessStageSampleMode_default.LINEAR
  193825. });
  193826. const blurY = new PostProcessStage_default({
  193827. name: `${name}_y_direction`,
  193828. fragmentShader: blurShader,
  193829. uniforms: {
  193830. delta,
  193831. sigma,
  193832. stepSize,
  193833. direction: 1
  193834. },
  193835. sampleMode: PostProcessStageSampleMode_default.LINEAR
  193836. });
  193837. const uniforms = {};
  193838. Object.defineProperties(uniforms, {
  193839. delta: {
  193840. get: function() {
  193841. return blurX.uniforms.delta;
  193842. },
  193843. set: function(value) {
  193844. const blurXUniforms = blurX.uniforms;
  193845. const blurYUniforms = blurY.uniforms;
  193846. blurXUniforms.delta = blurYUniforms.delta = value;
  193847. }
  193848. },
  193849. sigma: {
  193850. get: function() {
  193851. return blurX.uniforms.sigma;
  193852. },
  193853. set: function(value) {
  193854. const blurXUniforms = blurX.uniforms;
  193855. const blurYUniforms = blurY.uniforms;
  193856. blurXUniforms.sigma = blurYUniforms.sigma = value;
  193857. }
  193858. },
  193859. stepSize: {
  193860. get: function() {
  193861. return blurX.uniforms.stepSize;
  193862. },
  193863. set: function(value) {
  193864. const blurXUniforms = blurX.uniforms;
  193865. const blurYUniforms = blurY.uniforms;
  193866. blurXUniforms.stepSize = blurYUniforms.stepSize = value;
  193867. }
  193868. }
  193869. });
  193870. return new PostProcessStageComposite_default({
  193871. name,
  193872. stages: [blurX, blurY],
  193873. uniforms
  193874. });
  193875. }
  193876. PostProcessStageLibrary.createBlurStage = function() {
  193877. return createBlur("czm_blur");
  193878. };
  193879. PostProcessStageLibrary.createDepthOfFieldStage = function() {
  193880. const blur = createBlur("czm_depth_of_field_blur");
  193881. const dof = new PostProcessStage_default({
  193882. name: "czm_depth_of_field_composite",
  193883. fragmentShader: DepthOfField_default,
  193884. uniforms: {
  193885. focalDistance: 5,
  193886. blurTexture: blur.name
  193887. }
  193888. });
  193889. const uniforms = {};
  193890. Object.defineProperties(uniforms, {
  193891. focalDistance: {
  193892. get: function() {
  193893. return dof.uniforms.focalDistance;
  193894. },
  193895. set: function(value) {
  193896. dof.uniforms.focalDistance = value;
  193897. }
  193898. },
  193899. delta: {
  193900. get: function() {
  193901. return blur.uniforms.delta;
  193902. },
  193903. set: function(value) {
  193904. blur.uniforms.delta = value;
  193905. }
  193906. },
  193907. sigma: {
  193908. get: function() {
  193909. return blur.uniforms.sigma;
  193910. },
  193911. set: function(value) {
  193912. blur.uniforms.sigma = value;
  193913. }
  193914. },
  193915. stepSize: {
  193916. get: function() {
  193917. return blur.uniforms.stepSize;
  193918. },
  193919. set: function(value) {
  193920. blur.uniforms.stepSize = value;
  193921. }
  193922. }
  193923. });
  193924. return new PostProcessStageComposite_default({
  193925. name: "czm_depth_of_field",
  193926. stages: [blur, dof],
  193927. inputPreviousStageTexture: false,
  193928. uniforms
  193929. });
  193930. };
  193931. PostProcessStageLibrary.isDepthOfFieldSupported = function(scene) {
  193932. return scene.context.depthTexture;
  193933. };
  193934. PostProcessStageLibrary.createEdgeDetectionStage = function() {
  193935. const name = createGuid_default();
  193936. return new PostProcessStage_default({
  193937. name: `czm_edge_detection_${name}`,
  193938. fragmentShader: EdgeDetection_default,
  193939. uniforms: {
  193940. length: 0.25,
  193941. color: Color_default.clone(Color_default.BLACK)
  193942. }
  193943. });
  193944. };
  193945. PostProcessStageLibrary.isEdgeDetectionSupported = function(scene) {
  193946. return scene.context.depthTexture;
  193947. };
  193948. function getSilhouetteEdgeDetection(edgeDetectionStages) {
  193949. if (!defined_default(edgeDetectionStages)) {
  193950. return PostProcessStageLibrary.createEdgeDetectionStage();
  193951. }
  193952. const edgeDetection = new PostProcessStageComposite_default({
  193953. name: "czm_edge_detection_multiple",
  193954. stages: edgeDetectionStages,
  193955. inputPreviousStageTexture: false
  193956. });
  193957. const compositeUniforms = {};
  193958. let fsDecl = "";
  193959. let fsLoop = "";
  193960. for (let i2 = 0; i2 < edgeDetectionStages.length; ++i2) {
  193961. fsDecl += `uniform sampler2D edgeTexture${i2};
  193962. `;
  193963. fsLoop += ` vec4 edge${i2} = texture2D(edgeTexture${i2}, v_textureCoordinates);
  193964. if (edge${i2}.a > 0.0)
  193965. {
  193966. color = edge${i2};
  193967. break;
  193968. }
  193969. `;
  193970. compositeUniforms[`edgeTexture${i2}`] = edgeDetectionStages[i2].name;
  193971. }
  193972. const fs = `${fsDecl}varying vec2 v_textureCoordinates;
  193973. void main() {
  193974. vec4 color = vec4(0.0);
  193975. for (int i = 0; i < ${edgeDetectionStages.length}; i++)
  193976. {
  193977. ${fsLoop} }
  193978. gl_FragColor = color;
  193979. }
  193980. `;
  193981. const edgeComposite = new PostProcessStage_default({
  193982. name: "czm_edge_detection_combine",
  193983. fragmentShader: fs,
  193984. uniforms: compositeUniforms
  193985. });
  193986. return new PostProcessStageComposite_default({
  193987. name: "czm_edge_detection_composite",
  193988. stages: [edgeDetection, edgeComposite]
  193989. });
  193990. }
  193991. PostProcessStageLibrary.createSilhouetteStage = function(edgeDetectionStages) {
  193992. const edgeDetection = getSilhouetteEdgeDetection(edgeDetectionStages);
  193993. const silhouetteProcess = new PostProcessStage_default({
  193994. name: "czm_silhouette_color_edges",
  193995. fragmentShader: Silhouette_default,
  193996. uniforms: {
  193997. silhouetteTexture: edgeDetection.name
  193998. }
  193999. });
  194000. return new PostProcessStageComposite_default({
  194001. name: "czm_silhouette",
  194002. stages: [edgeDetection, silhouetteProcess],
  194003. inputPreviousStageTexture: false,
  194004. uniforms: edgeDetection.uniforms
  194005. });
  194006. };
  194007. PostProcessStageLibrary.isSilhouetteSupported = function(scene) {
  194008. return scene.context.depthTexture;
  194009. };
  194010. PostProcessStageLibrary.createBloomStage = function() {
  194011. const contrastBias = new PostProcessStage_default({
  194012. name: "czm_bloom_contrast_bias",
  194013. fragmentShader: ContrastBias_default,
  194014. uniforms: {
  194015. contrast: 128,
  194016. brightness: -0.3
  194017. }
  194018. });
  194019. const blur = createBlur("czm_bloom_blur");
  194020. const generateComposite = new PostProcessStageComposite_default({
  194021. name: "czm_bloom_contrast_bias_blur",
  194022. stages: [contrastBias, blur]
  194023. });
  194024. const bloomComposite = new PostProcessStage_default({
  194025. name: "czm_bloom_generate_composite",
  194026. fragmentShader: BloomComposite_default,
  194027. uniforms: {
  194028. glowOnly: false,
  194029. bloomTexture: generateComposite.name
  194030. }
  194031. });
  194032. const uniforms = {};
  194033. Object.defineProperties(uniforms, {
  194034. glowOnly: {
  194035. get: function() {
  194036. return bloomComposite.uniforms.glowOnly;
  194037. },
  194038. set: function(value) {
  194039. bloomComposite.uniforms.glowOnly = value;
  194040. }
  194041. },
  194042. contrast: {
  194043. get: function() {
  194044. return contrastBias.uniforms.contrast;
  194045. },
  194046. set: function(value) {
  194047. contrastBias.uniforms.contrast = value;
  194048. }
  194049. },
  194050. brightness: {
  194051. get: function() {
  194052. return contrastBias.uniforms.brightness;
  194053. },
  194054. set: function(value) {
  194055. contrastBias.uniforms.brightness = value;
  194056. }
  194057. },
  194058. delta: {
  194059. get: function() {
  194060. return blur.uniforms.delta;
  194061. },
  194062. set: function(value) {
  194063. blur.uniforms.delta = value;
  194064. }
  194065. },
  194066. sigma: {
  194067. get: function() {
  194068. return blur.uniforms.sigma;
  194069. },
  194070. set: function(value) {
  194071. blur.uniforms.sigma = value;
  194072. }
  194073. },
  194074. stepSize: {
  194075. get: function() {
  194076. return blur.uniforms.stepSize;
  194077. },
  194078. set: function(value) {
  194079. blur.uniforms.stepSize = value;
  194080. }
  194081. }
  194082. });
  194083. return new PostProcessStageComposite_default({
  194084. name: "czm_bloom",
  194085. stages: [generateComposite, bloomComposite],
  194086. inputPreviousStageTexture: false,
  194087. uniforms
  194088. });
  194089. };
  194090. PostProcessStageLibrary.createAmbientOcclusionStage = function() {
  194091. const generate = new PostProcessStage_default({
  194092. name: "czm_ambient_occlusion_generate",
  194093. fragmentShader: AmbientOcclusionGenerate_default,
  194094. uniforms: {
  194095. intensity: 3,
  194096. bias: 0.1,
  194097. lengthCap: 0.26,
  194098. stepSize: 1.95,
  194099. frustumLength: 1e3,
  194100. randomTexture: void 0
  194101. }
  194102. });
  194103. const blur = createBlur("czm_ambient_occlusion_blur");
  194104. blur.uniforms.stepSize = 0.86;
  194105. const generateAndBlur = new PostProcessStageComposite_default({
  194106. name: "czm_ambient_occlusion_generate_blur",
  194107. stages: [generate, blur]
  194108. });
  194109. const ambientOcclusionModulate = new PostProcessStage_default({
  194110. name: "czm_ambient_occlusion_composite",
  194111. fragmentShader: AmbientOcclusionModulate_default,
  194112. uniforms: {
  194113. ambientOcclusionOnly: false,
  194114. ambientOcclusionTexture: generateAndBlur.name
  194115. }
  194116. });
  194117. const uniforms = {};
  194118. Object.defineProperties(uniforms, {
  194119. intensity: {
  194120. get: function() {
  194121. return generate.uniforms.intensity;
  194122. },
  194123. set: function(value) {
  194124. generate.uniforms.intensity = value;
  194125. }
  194126. },
  194127. bias: {
  194128. get: function() {
  194129. return generate.uniforms.bias;
  194130. },
  194131. set: function(value) {
  194132. generate.uniforms.bias = value;
  194133. }
  194134. },
  194135. lengthCap: {
  194136. get: function() {
  194137. return generate.uniforms.lengthCap;
  194138. },
  194139. set: function(value) {
  194140. generate.uniforms.lengthCap = value;
  194141. }
  194142. },
  194143. stepSize: {
  194144. get: function() {
  194145. return generate.uniforms.stepSize;
  194146. },
  194147. set: function(value) {
  194148. generate.uniforms.stepSize = value;
  194149. }
  194150. },
  194151. frustumLength: {
  194152. get: function() {
  194153. return generate.uniforms.frustumLength;
  194154. },
  194155. set: function(value) {
  194156. generate.uniforms.frustumLength = value;
  194157. }
  194158. },
  194159. randomTexture: {
  194160. get: function() {
  194161. return generate.uniforms.randomTexture;
  194162. },
  194163. set: function(value) {
  194164. generate.uniforms.randomTexture = value;
  194165. }
  194166. },
  194167. delta: {
  194168. get: function() {
  194169. return blur.uniforms.delta;
  194170. },
  194171. set: function(value) {
  194172. blur.uniforms.delta = value;
  194173. }
  194174. },
  194175. sigma: {
  194176. get: function() {
  194177. return blur.uniforms.sigma;
  194178. },
  194179. set: function(value) {
  194180. blur.uniforms.sigma = value;
  194181. }
  194182. },
  194183. blurStepSize: {
  194184. get: function() {
  194185. return blur.uniforms.stepSize;
  194186. },
  194187. set: function(value) {
  194188. blur.uniforms.stepSize = value;
  194189. }
  194190. },
  194191. ambientOcclusionOnly: {
  194192. get: function() {
  194193. return ambientOcclusionModulate.uniforms.ambientOcclusionOnly;
  194194. },
  194195. set: function(value) {
  194196. ambientOcclusionModulate.uniforms.ambientOcclusionOnly = value;
  194197. }
  194198. }
  194199. });
  194200. return new PostProcessStageComposite_default({
  194201. name: "czm_ambient_occlusion",
  194202. stages: [generateAndBlur, ambientOcclusionModulate],
  194203. inputPreviousStageTexture: false,
  194204. uniforms
  194205. });
  194206. };
  194207. PostProcessStageLibrary.isAmbientOcclusionSupported = function(scene) {
  194208. return scene.context.depthTexture;
  194209. };
  194210. var fxaaFS = `#define FXAA_QUALITY_PRESET 39
  194211. ${FXAA3_11_default}
  194212. ${FXAA_default}`;
  194213. PostProcessStageLibrary.createFXAAStage = function() {
  194214. return new PostProcessStage_default({
  194215. name: "czm_FXAA",
  194216. fragmentShader: fxaaFS,
  194217. sampleMode: PostProcessStageSampleMode_default.LINEAR
  194218. });
  194219. };
  194220. PostProcessStageLibrary.createAcesTonemappingStage = function(useAutoExposure) {
  194221. let fs = useAutoExposure ? "#define AUTO_EXPOSURE\n" : "";
  194222. fs += AcesTonemappingStage_default;
  194223. return new PostProcessStage_default({
  194224. name: "czm_aces",
  194225. fragmentShader: fs,
  194226. uniforms: {
  194227. autoExposure: void 0
  194228. }
  194229. });
  194230. };
  194231. PostProcessStageLibrary.createFilmicTonemappingStage = function(useAutoExposure) {
  194232. let fs = useAutoExposure ? "#define AUTO_EXPOSURE\n" : "";
  194233. fs += FilmicTonemapping_default;
  194234. return new PostProcessStage_default({
  194235. name: "czm_filmic",
  194236. fragmentShader: fs,
  194237. uniforms: {
  194238. autoExposure: void 0
  194239. }
  194240. });
  194241. };
  194242. PostProcessStageLibrary.createReinhardTonemappingStage = function(useAutoExposure) {
  194243. let fs = useAutoExposure ? "#define AUTO_EXPOSURE\n" : "";
  194244. fs += ReinhardTonemapping_default;
  194245. return new PostProcessStage_default({
  194246. name: "czm_reinhard",
  194247. fragmentShader: fs,
  194248. uniforms: {
  194249. autoExposure: void 0
  194250. }
  194251. });
  194252. };
  194253. PostProcessStageLibrary.createModifiedReinhardTonemappingStage = function(useAutoExposure) {
  194254. let fs = useAutoExposure ? "#define AUTO_EXPOSURE\n" : "";
  194255. fs += ModifiedReinhardTonemapping_default;
  194256. return new PostProcessStage_default({
  194257. name: "czm_modified_reinhard",
  194258. fragmentShader: fs,
  194259. uniforms: {
  194260. white: Color_default.WHITE,
  194261. autoExposure: void 0
  194262. }
  194263. });
  194264. };
  194265. PostProcessStageLibrary.createAutoExposureStage = function() {
  194266. return new AutoExposure_default();
  194267. };
  194268. PostProcessStageLibrary.createBlackAndWhiteStage = function() {
  194269. return new PostProcessStage_default({
  194270. name: "czm_black_and_white",
  194271. fragmentShader: BlackAndWhite_default,
  194272. uniforms: {
  194273. gradations: 5
  194274. }
  194275. });
  194276. };
  194277. PostProcessStageLibrary.createBrightnessStage = function() {
  194278. return new PostProcessStage_default({
  194279. name: "czm_brightness",
  194280. fragmentShader: Brightness_default,
  194281. uniforms: {
  194282. brightness: 0.5
  194283. }
  194284. });
  194285. };
  194286. PostProcessStageLibrary.createNightVisionStage = function() {
  194287. return new PostProcessStage_default({
  194288. name: "czm_night_vision",
  194289. fragmentShader: NightVision_default
  194290. });
  194291. };
  194292. PostProcessStageLibrary.createDepthViewStage = function() {
  194293. return new PostProcessStage_default({
  194294. name: "czm_depth_view",
  194295. fragmentShader: DepthView_default
  194296. });
  194297. };
  194298. PostProcessStageLibrary.createLensFlareStage = function() {
  194299. return new PostProcessStage_default({
  194300. name: "czm_lens_flare",
  194301. fragmentShader: LensFlare_default,
  194302. uniforms: {
  194303. dirtTexture: buildModuleUrl_default("Assets/Textures/LensFlare/DirtMask.jpg"),
  194304. starTexture: buildModuleUrl_default("Assets/Textures/LensFlare/StarBurst.jpg"),
  194305. intensity: 2,
  194306. distortion: 10,
  194307. ghostDispersal: 0.4,
  194308. haloWidth: 0.4,
  194309. dirtAmount: 0.4,
  194310. earthRadius: Ellipsoid_default.WGS84.maximumRadius
  194311. }
  194312. });
  194313. };
  194314. var PostProcessStageLibrary_default = PostProcessStageLibrary;
  194315. // node_modules/cesium/Source/Scene/PostProcessStageTextureCache.js
  194316. function PostProcessStageTextureCache(postProcessStageCollection) {
  194317. this._collection = postProcessStageCollection;
  194318. this._framebuffers = [];
  194319. this._stageNameToFramebuffer = {};
  194320. this._width = void 0;
  194321. this._height = void 0;
  194322. this._updateDependencies = false;
  194323. }
  194324. function getLastStageName(stage) {
  194325. while (defined_default(stage.length)) {
  194326. stage = stage.get(stage.length - 1);
  194327. }
  194328. return stage.name;
  194329. }
  194330. function getStageDependencies(collection, context, dependencies, stage, previousName) {
  194331. if (!stage.enabled || !stage._isSupported(context)) {
  194332. return previousName;
  194333. }
  194334. const stageDependencies = dependencies[stage.name] = {};
  194335. if (defined_default(previousName)) {
  194336. const previous = collection.getStageByName(previousName);
  194337. stageDependencies[getLastStageName(previous)] = true;
  194338. }
  194339. const uniforms = stage.uniforms;
  194340. if (defined_default(uniforms)) {
  194341. const uniformNames = Object.getOwnPropertyNames(uniforms);
  194342. const uniformNamesLength = uniformNames.length;
  194343. for (let i2 = 0; i2 < uniformNamesLength; ++i2) {
  194344. const value = uniforms[uniformNames[i2]];
  194345. if (typeof value === "string") {
  194346. const dependent = collection.getStageByName(value);
  194347. if (defined_default(dependent)) {
  194348. stageDependencies[getLastStageName(dependent)] = true;
  194349. }
  194350. }
  194351. }
  194352. }
  194353. return stage.name;
  194354. }
  194355. function getCompositeDependencies(collection, context, dependencies, composite, previousName) {
  194356. if (defined_default(composite.enabled) && !composite.enabled || defined_default(composite._isSupported) && !composite._isSupported(context)) {
  194357. return previousName;
  194358. }
  194359. const originalDependency = previousName;
  194360. const inSeries = !defined_default(composite.inputPreviousStageTexture) || composite.inputPreviousStageTexture;
  194361. let currentName = previousName;
  194362. const length3 = composite.length;
  194363. for (let i2 = 0; i2 < length3; ++i2) {
  194364. const stage = composite.get(i2);
  194365. if (defined_default(stage.length)) {
  194366. currentName = getCompositeDependencies(
  194367. collection,
  194368. context,
  194369. dependencies,
  194370. stage,
  194371. previousName
  194372. );
  194373. } else {
  194374. currentName = getStageDependencies(
  194375. collection,
  194376. context,
  194377. dependencies,
  194378. stage,
  194379. previousName
  194380. );
  194381. }
  194382. if (inSeries) {
  194383. previousName = currentName;
  194384. }
  194385. }
  194386. let j;
  194387. let name;
  194388. if (!inSeries) {
  194389. for (j = 1; j < length3; ++j) {
  194390. name = getLastStageName(composite.get(j));
  194391. const currentDependencies = dependencies[name];
  194392. for (let k = 0; k < j; ++k) {
  194393. currentDependencies[getLastStageName(composite.get(k))] = true;
  194394. }
  194395. }
  194396. } else {
  194397. for (j = 1; j < length3; ++j) {
  194398. name = getLastStageName(composite.get(j));
  194399. if (!defined_default(dependencies[name])) {
  194400. dependencies[name] = {};
  194401. }
  194402. dependencies[name][originalDependency] = true;
  194403. }
  194404. }
  194405. return currentName;
  194406. }
  194407. function getDependencies(collection, context) {
  194408. const dependencies = {};
  194409. if (defined_default(collection.ambientOcclusion)) {
  194410. const ao = collection.ambientOcclusion;
  194411. const bloom = collection.bloom;
  194412. const tonemapping = collection._tonemapping;
  194413. const fxaa = collection.fxaa;
  194414. let previousName = getCompositeDependencies(
  194415. collection,
  194416. context,
  194417. dependencies,
  194418. ao,
  194419. void 0
  194420. );
  194421. previousName = getCompositeDependencies(
  194422. collection,
  194423. context,
  194424. dependencies,
  194425. bloom,
  194426. previousName
  194427. );
  194428. previousName = getStageDependencies(
  194429. collection,
  194430. context,
  194431. dependencies,
  194432. tonemapping,
  194433. previousName
  194434. );
  194435. previousName = getCompositeDependencies(
  194436. collection,
  194437. context,
  194438. dependencies,
  194439. collection,
  194440. previousName
  194441. );
  194442. getStageDependencies(collection, context, dependencies, fxaa, previousName);
  194443. } else {
  194444. getCompositeDependencies(
  194445. collection,
  194446. context,
  194447. dependencies,
  194448. collection,
  194449. void 0
  194450. );
  194451. }
  194452. return dependencies;
  194453. }
  194454. function getFramebuffer(cache, stageName, dependencies) {
  194455. const collection = cache._collection;
  194456. const stage = collection.getStageByName(stageName);
  194457. const textureScale = stage._textureScale;
  194458. const forcePowerOfTwo = stage._forcePowerOfTwo;
  194459. const pixelFormat = stage._pixelFormat;
  194460. const pixelDatatype = stage._pixelDatatype;
  194461. const clearColor = stage._clearColor;
  194462. let i2;
  194463. let framebuffer;
  194464. const framebuffers = cache._framebuffers;
  194465. const length3 = framebuffers.length;
  194466. for (i2 = 0; i2 < length3; ++i2) {
  194467. framebuffer = framebuffers[i2];
  194468. if (textureScale !== framebuffer.textureScale || forcePowerOfTwo !== framebuffer.forcePowerOfTwo || pixelFormat !== framebuffer.pixelFormat || pixelDatatype !== framebuffer.pixelDatatype || !Color_default.equals(clearColor, framebuffer.clearColor)) {
  194469. continue;
  194470. }
  194471. const stageNames = framebuffer.stages;
  194472. const stagesLength = stageNames.length;
  194473. let foundConflict = false;
  194474. for (let j = 0; j < stagesLength; ++j) {
  194475. if (dependencies[stageNames[j]]) {
  194476. foundConflict = true;
  194477. break;
  194478. }
  194479. }
  194480. if (!foundConflict) {
  194481. break;
  194482. }
  194483. }
  194484. if (defined_default(framebuffer) && i2 < length3) {
  194485. framebuffer.stages.push(stageName);
  194486. return framebuffer;
  194487. }
  194488. framebuffer = {
  194489. textureScale,
  194490. forcePowerOfTwo,
  194491. pixelFormat,
  194492. pixelDatatype,
  194493. clearColor,
  194494. stages: [stageName],
  194495. buffer: new FramebufferManager_default({
  194496. pixelFormat,
  194497. pixelDatatype
  194498. }),
  194499. clear: void 0
  194500. };
  194501. framebuffers.push(framebuffer);
  194502. return framebuffer;
  194503. }
  194504. function createFramebuffers2(cache, context) {
  194505. const dependencies = getDependencies(cache._collection, context);
  194506. for (const stageName in dependencies) {
  194507. if (dependencies.hasOwnProperty(stageName)) {
  194508. cache._stageNameToFramebuffer[stageName] = getFramebuffer(
  194509. cache,
  194510. stageName,
  194511. dependencies[stageName]
  194512. );
  194513. }
  194514. }
  194515. }
  194516. function releaseResources2(cache) {
  194517. const framebuffers = cache._framebuffers;
  194518. const length3 = framebuffers.length;
  194519. for (let i2 = 0; i2 < length3; ++i2) {
  194520. const framebuffer = framebuffers[i2];
  194521. framebuffer.buffer.destroy();
  194522. }
  194523. }
  194524. function updateFramebuffers4(cache, context) {
  194525. const width = cache._width;
  194526. const height = cache._height;
  194527. const framebuffers = cache._framebuffers;
  194528. const length3 = framebuffers.length;
  194529. for (let i2 = 0; i2 < length3; ++i2) {
  194530. const framebuffer = framebuffers[i2];
  194531. const scale = framebuffer.textureScale;
  194532. let textureWidth = Math.ceil(width * scale);
  194533. let textureHeight = Math.ceil(height * scale);
  194534. let size = Math.min(textureWidth, textureHeight);
  194535. if (framebuffer.forcePowerOfTwo) {
  194536. if (!Math_default.isPowerOfTwo(size)) {
  194537. size = Math_default.nextPowerOfTwo(size);
  194538. }
  194539. textureWidth = size;
  194540. textureHeight = size;
  194541. }
  194542. framebuffer.buffer.update(context, textureWidth, textureHeight);
  194543. framebuffer.clear = new ClearCommand_default({
  194544. color: framebuffer.clearColor,
  194545. framebuffer: framebuffer.buffer.framebuffer
  194546. });
  194547. }
  194548. }
  194549. PostProcessStageTextureCache.prototype.updateDependencies = function() {
  194550. this._updateDependencies = true;
  194551. };
  194552. PostProcessStageTextureCache.prototype.update = function(context) {
  194553. const collection = this._collection;
  194554. const updateDependencies = this._updateDependencies;
  194555. const aoEnabled = defined_default(collection.ambientOcclusion) && collection.ambientOcclusion.enabled && collection.ambientOcclusion._isSupported(context);
  194556. const bloomEnabled = defined_default(collection.bloom) && collection.bloom.enabled && collection.bloom._isSupported(context);
  194557. const tonemappingEnabled = defined_default(collection._tonemapping) && collection._tonemapping.enabled && collection._tonemapping._isSupported(context);
  194558. const fxaaEnabled = defined_default(collection.fxaa) && collection.fxaa.enabled && collection.fxaa._isSupported(context);
  194559. const needsCheckDimensionsUpdate = !defined_default(collection._activeStages) || collection._activeStages.length > 0 || aoEnabled || bloomEnabled || tonemappingEnabled || fxaaEnabled;
  194560. if (updateDependencies || !needsCheckDimensionsUpdate && this._framebuffers.length > 0) {
  194561. releaseResources2(this);
  194562. this._framebuffers.length = 0;
  194563. this._stageNameToFramebuffer = {};
  194564. this._width = void 0;
  194565. this._height = void 0;
  194566. }
  194567. if (!updateDependencies && !needsCheckDimensionsUpdate) {
  194568. return;
  194569. }
  194570. if (this._framebuffers.length === 0) {
  194571. createFramebuffers2(this, context);
  194572. }
  194573. const width = context.drawingBufferWidth;
  194574. const height = context.drawingBufferHeight;
  194575. const dimensionsChanged = this._width !== width || this._height !== height;
  194576. if (!updateDependencies && !dimensionsChanged) {
  194577. return;
  194578. }
  194579. this._width = width;
  194580. this._height = height;
  194581. this._updateDependencies = false;
  194582. releaseResources2(this);
  194583. updateFramebuffers4(this, context);
  194584. };
  194585. PostProcessStageTextureCache.prototype.clear = function(context) {
  194586. const framebuffers = this._framebuffers;
  194587. for (let i2 = 0; i2 < framebuffers.length; ++i2) {
  194588. framebuffers[i2].clear.execute(context);
  194589. }
  194590. };
  194591. PostProcessStageTextureCache.prototype.getStageByName = function(name) {
  194592. return this._collection.getStageByName(name);
  194593. };
  194594. PostProcessStageTextureCache.prototype.getOutputTexture = function(name) {
  194595. return this._collection.getOutputTexture(name);
  194596. };
  194597. PostProcessStageTextureCache.prototype.getFramebuffer = function(name) {
  194598. const framebuffer = this._stageNameToFramebuffer[name];
  194599. if (!defined_default(framebuffer)) {
  194600. return void 0;
  194601. }
  194602. return framebuffer.buffer.framebuffer;
  194603. };
  194604. PostProcessStageTextureCache.prototype.isDestroyed = function() {
  194605. return false;
  194606. };
  194607. PostProcessStageTextureCache.prototype.destroy = function() {
  194608. releaseResources2(this);
  194609. return destroyObject_default(this);
  194610. };
  194611. var PostProcessStageTextureCache_default = PostProcessStageTextureCache;
  194612. // node_modules/cesium/Source/Scene/Tonemapper.js
  194613. var Tonemapper = {
  194614. REINHARD: 0,
  194615. MODIFIED_REINHARD: 1,
  194616. FILMIC: 2,
  194617. ACES: 3,
  194618. validate: function(tonemapper) {
  194619. return tonemapper === Tonemapper.REINHARD || tonemapper === Tonemapper.MODIFIED_REINHARD || tonemapper === Tonemapper.FILMIC || tonemapper === Tonemapper.ACES;
  194620. }
  194621. };
  194622. var Tonemapper_default = Object.freeze(Tonemapper);
  194623. // node_modules/cesium/Source/Scene/PostProcessStageCollection.js
  194624. var stackScratch = [];
  194625. function PostProcessStageCollection() {
  194626. const fxaa = PostProcessStageLibrary_default.createFXAAStage();
  194627. const ao = PostProcessStageLibrary_default.createAmbientOcclusionStage();
  194628. const bloom = PostProcessStageLibrary_default.createBloomStage();
  194629. this._autoExposureEnabled = false;
  194630. this._autoExposure = PostProcessStageLibrary_default.createAutoExposureStage();
  194631. this._tonemapping = void 0;
  194632. this._tonemapper = void 0;
  194633. this.tonemapper = Tonemapper_default.ACES;
  194634. const tonemapping = this._tonemapping;
  194635. fxaa.enabled = false;
  194636. ao.enabled = false;
  194637. bloom.enabled = false;
  194638. tonemapping.enabled = false;
  194639. const textureCache = new PostProcessStageTextureCache_default(this);
  194640. const stageNames = {};
  194641. const stack = stackScratch;
  194642. stack.push(fxaa, ao, bloom, tonemapping);
  194643. while (stack.length > 0) {
  194644. const stage = stack.pop();
  194645. stageNames[stage.name] = stage;
  194646. stage._textureCache = textureCache;
  194647. const length3 = stage.length;
  194648. if (defined_default(length3)) {
  194649. for (let i2 = 0; i2 < length3; ++i2) {
  194650. stack.push(stage.get(i2));
  194651. }
  194652. }
  194653. }
  194654. this._stages = [];
  194655. this._activeStages = [];
  194656. this._previousActiveStages = [];
  194657. this._randomTexture = void 0;
  194658. const that = this;
  194659. ao.uniforms.randomTexture = function() {
  194660. return that._randomTexture;
  194661. };
  194662. this._ao = ao;
  194663. this._bloom = bloom;
  194664. this._fxaa = fxaa;
  194665. this._aoEnabled = void 0;
  194666. this._bloomEnabled = void 0;
  194667. this._tonemappingEnabled = void 0;
  194668. this._fxaaEnabled = void 0;
  194669. this._activeStagesChanged = false;
  194670. this._stagesRemoved = false;
  194671. this._textureCacheDirty = false;
  194672. this._stageNames = stageNames;
  194673. this._textureCache = textureCache;
  194674. }
  194675. Object.defineProperties(PostProcessStageCollection.prototype, {
  194676. ready: {
  194677. get: function() {
  194678. let readyAndEnabled = false;
  194679. const stages = this._stages;
  194680. const length3 = stages.length;
  194681. for (let i2 = length3 - 1; i2 >= 0; --i2) {
  194682. const stage = stages[i2];
  194683. readyAndEnabled = readyAndEnabled || stage.ready && stage.enabled;
  194684. }
  194685. const fxaa = this._fxaa;
  194686. const ao = this._ao;
  194687. const bloom = this._bloom;
  194688. const tonemapping = this._tonemapping;
  194689. readyAndEnabled = readyAndEnabled || fxaa.ready && fxaa.enabled;
  194690. readyAndEnabled = readyAndEnabled || ao.ready && ao.enabled;
  194691. readyAndEnabled = readyAndEnabled || bloom.ready && bloom.enabled;
  194692. readyAndEnabled = readyAndEnabled || tonemapping.ready && tonemapping.enabled;
  194693. return readyAndEnabled;
  194694. }
  194695. },
  194696. fxaa: {
  194697. get: function() {
  194698. return this._fxaa;
  194699. }
  194700. },
  194701. ambientOcclusion: {
  194702. get: function() {
  194703. return this._ao;
  194704. }
  194705. },
  194706. bloom: {
  194707. get: function() {
  194708. return this._bloom;
  194709. }
  194710. },
  194711. length: {
  194712. get: function() {
  194713. removeStages(this);
  194714. return this._stages.length;
  194715. }
  194716. },
  194717. outputTexture: {
  194718. get: function() {
  194719. const fxaa = this._fxaa;
  194720. if (fxaa.enabled && fxaa.ready) {
  194721. return this.getOutputTexture(fxaa.name);
  194722. }
  194723. const stages = this._stages;
  194724. const length3 = stages.length;
  194725. for (let i2 = length3 - 1; i2 >= 0; --i2) {
  194726. const stage = stages[i2];
  194727. if (defined_default(stage) && stage.ready && stage.enabled) {
  194728. return this.getOutputTexture(stage.name);
  194729. }
  194730. }
  194731. const tonemapping = this._tonemapping;
  194732. if (tonemapping.enabled && tonemapping.ready) {
  194733. return this.getOutputTexture(tonemapping.name);
  194734. }
  194735. const bloom = this._bloom;
  194736. if (bloom.enabled && bloom.ready) {
  194737. return this.getOutputTexture(bloom.name);
  194738. }
  194739. const ao = this._ao;
  194740. if (ao.enabled && ao.ready) {
  194741. return this.getOutputTexture(ao.name);
  194742. }
  194743. return void 0;
  194744. }
  194745. },
  194746. hasSelected: {
  194747. get: function() {
  194748. const stages = arraySlice_default(this._stages);
  194749. while (stages.length > 0) {
  194750. const stage = stages.pop();
  194751. if (!defined_default(stage)) {
  194752. continue;
  194753. }
  194754. if (defined_default(stage.selected)) {
  194755. return true;
  194756. }
  194757. const length3 = stage.length;
  194758. if (defined_default(length3)) {
  194759. for (let i2 = 0; i2 < length3; ++i2) {
  194760. stages.push(stage.get(i2));
  194761. }
  194762. }
  194763. }
  194764. return false;
  194765. }
  194766. },
  194767. tonemapper: {
  194768. get: function() {
  194769. return this._tonemapper;
  194770. },
  194771. set: function(value) {
  194772. if (this._tonemapper === value) {
  194773. return;
  194774. }
  194775. if (!Tonemapper_default.validate(value)) {
  194776. throw new DeveloperError_default("tonemapper was set to an invalid value.");
  194777. }
  194778. if (defined_default(this._tonemapping)) {
  194779. delete this._stageNames[this._tonemapping.name];
  194780. this._tonemapping.destroy();
  194781. }
  194782. const useAutoExposure = this._autoExposureEnabled;
  194783. let tonemapper;
  194784. switch (value) {
  194785. case Tonemapper_default.REINHARD:
  194786. tonemapper = PostProcessStageLibrary_default.createReinhardTonemappingStage(
  194787. useAutoExposure
  194788. );
  194789. break;
  194790. case Tonemapper_default.MODIFIED_REINHARD:
  194791. tonemapper = PostProcessStageLibrary_default.createModifiedReinhardTonemappingStage(
  194792. useAutoExposure
  194793. );
  194794. break;
  194795. case Tonemapper_default.FILMIC:
  194796. tonemapper = PostProcessStageLibrary_default.createFilmicTonemappingStage(
  194797. useAutoExposure
  194798. );
  194799. break;
  194800. default:
  194801. tonemapper = PostProcessStageLibrary_default.createAcesTonemappingStage(
  194802. useAutoExposure
  194803. );
  194804. break;
  194805. }
  194806. if (useAutoExposure) {
  194807. const autoexposure = this._autoExposure;
  194808. tonemapper.uniforms.autoExposure = function() {
  194809. return autoexposure.outputTexture;
  194810. };
  194811. }
  194812. this._tonemapper = value;
  194813. this._tonemapping = tonemapper;
  194814. if (defined_default(this._stageNames)) {
  194815. this._stageNames[tonemapper.name] = tonemapper;
  194816. tonemapper._textureCache = this._textureCache;
  194817. }
  194818. this._textureCacheDirty = true;
  194819. }
  194820. }
  194821. });
  194822. function removeStages(collection) {
  194823. if (!collection._stagesRemoved) {
  194824. return;
  194825. }
  194826. collection._stagesRemoved = false;
  194827. const newStages = [];
  194828. const stages = collection._stages;
  194829. const length3 = stages.length;
  194830. for (let i2 = 0, j = 0; i2 < length3; ++i2) {
  194831. const stage = stages[i2];
  194832. if (stage) {
  194833. stage._index = j++;
  194834. newStages.push(stage);
  194835. }
  194836. }
  194837. collection._stages = newStages;
  194838. }
  194839. PostProcessStageCollection.prototype.add = function(stage) {
  194840. Check_default.typeOf.object("stage", stage);
  194841. const stageNames = this._stageNames;
  194842. const stack = stackScratch;
  194843. stack.push(stage);
  194844. while (stack.length > 0) {
  194845. const currentStage = stack.pop();
  194846. if (defined_default(stageNames[currentStage.name])) {
  194847. throw new DeveloperError_default(
  194848. `${currentStage.name} has already been added to the collection or does not have a unique name.`
  194849. );
  194850. }
  194851. stageNames[currentStage.name] = currentStage;
  194852. currentStage._textureCache = this._textureCache;
  194853. const length3 = currentStage.length;
  194854. if (defined_default(length3)) {
  194855. for (let i2 = 0; i2 < length3; ++i2) {
  194856. stack.push(currentStage.get(i2));
  194857. }
  194858. }
  194859. }
  194860. const stages = this._stages;
  194861. stage._index = stages.length;
  194862. stages.push(stage);
  194863. this._textureCacheDirty = true;
  194864. return stage;
  194865. };
  194866. PostProcessStageCollection.prototype.remove = function(stage) {
  194867. if (!this.contains(stage)) {
  194868. return false;
  194869. }
  194870. const stageNames = this._stageNames;
  194871. const stack = stackScratch;
  194872. stack.push(stage);
  194873. while (stack.length > 0) {
  194874. const currentStage = stack.pop();
  194875. delete stageNames[currentStage.name];
  194876. const length3 = currentStage.length;
  194877. if (defined_default(length3)) {
  194878. for (let i2 = 0; i2 < length3; ++i2) {
  194879. stack.push(currentStage.get(i2));
  194880. }
  194881. }
  194882. }
  194883. this._stages[stage._index] = void 0;
  194884. this._stagesRemoved = true;
  194885. this._textureCacheDirty = true;
  194886. stage._index = void 0;
  194887. stage._textureCache = void 0;
  194888. stage.destroy();
  194889. return true;
  194890. };
  194891. PostProcessStageCollection.prototype.contains = function(stage) {
  194892. return defined_default(stage) && defined_default(stage._index) && stage._textureCache === this._textureCache;
  194893. };
  194894. PostProcessStageCollection.prototype.get = function(index2) {
  194895. removeStages(this);
  194896. const stages = this._stages;
  194897. const length3 = stages.length;
  194898. Check_default.typeOf.number.greaterThanOrEquals("stages length", length3, 0);
  194899. Check_default.typeOf.number.greaterThanOrEquals("index", index2, 0);
  194900. Check_default.typeOf.number.lessThan("index", index2, length3);
  194901. return stages[index2];
  194902. };
  194903. PostProcessStageCollection.prototype.removeAll = function() {
  194904. const stages = this._stages;
  194905. const length3 = stages.length;
  194906. for (let i2 = 0; i2 < length3; ++i2) {
  194907. this.remove(stages[i2]);
  194908. }
  194909. stages.length = 0;
  194910. };
  194911. PostProcessStageCollection.prototype.getStageByName = function(name) {
  194912. return this._stageNames[name];
  194913. };
  194914. PostProcessStageCollection.prototype.update = function(context, useLogDepth, useHdr) {
  194915. removeStages(this);
  194916. const previousActiveStages = this._activeStages;
  194917. const activeStages = this._activeStages = this._previousActiveStages;
  194918. this._previousActiveStages = previousActiveStages;
  194919. const stages = this._stages;
  194920. let length3 = activeStages.length = stages.length;
  194921. let i2;
  194922. let stage;
  194923. let count = 0;
  194924. for (i2 = 0; i2 < length3; ++i2) {
  194925. stage = stages[i2];
  194926. if (stage.ready && stage.enabled && stage._isSupported(context)) {
  194927. activeStages[count++] = stage;
  194928. }
  194929. }
  194930. activeStages.length = count;
  194931. let activeStagesChanged = count !== previousActiveStages.length;
  194932. if (!activeStagesChanged) {
  194933. for (i2 = 0; i2 < count; ++i2) {
  194934. if (activeStages[i2] !== previousActiveStages[i2]) {
  194935. activeStagesChanged = true;
  194936. break;
  194937. }
  194938. }
  194939. }
  194940. const ao = this._ao;
  194941. const bloom = this._bloom;
  194942. const autoexposure = this._autoExposure;
  194943. const tonemapping = this._tonemapping;
  194944. const fxaa = this._fxaa;
  194945. tonemapping.enabled = useHdr;
  194946. const aoEnabled = ao.enabled && ao._isSupported(context);
  194947. const bloomEnabled = bloom.enabled && bloom._isSupported(context);
  194948. const tonemappingEnabled = tonemapping.enabled && tonemapping._isSupported(context);
  194949. const fxaaEnabled = fxaa.enabled && fxaa._isSupported(context);
  194950. if (activeStagesChanged || this._textureCacheDirty || aoEnabled !== this._aoEnabled || bloomEnabled !== this._bloomEnabled || tonemappingEnabled !== this._tonemappingEnabled || fxaaEnabled !== this._fxaaEnabled) {
  194951. this._textureCache.updateDependencies();
  194952. this._aoEnabled = aoEnabled;
  194953. this._bloomEnabled = bloomEnabled;
  194954. this._tonemappingEnabled = tonemappingEnabled;
  194955. this._fxaaEnabled = fxaaEnabled;
  194956. this._textureCacheDirty = false;
  194957. }
  194958. if (defined_default(this._randomTexture) && !aoEnabled) {
  194959. this._randomTexture.destroy();
  194960. this._randomTexture = void 0;
  194961. }
  194962. if (!defined_default(this._randomTexture) && aoEnabled) {
  194963. length3 = 256 * 256 * 3;
  194964. const random2 = new Uint8Array(length3);
  194965. for (i2 = 0; i2 < length3; i2 += 3) {
  194966. random2[i2] = Math.floor(Math.random() * 255);
  194967. }
  194968. this._randomTexture = new Texture_default({
  194969. context,
  194970. pixelFormat: PixelFormat_default.RGB,
  194971. pixelDatatype: PixelDatatype_default.UNSIGNED_BYTE,
  194972. source: {
  194973. arrayBufferView: random2,
  194974. width: 256,
  194975. height: 256
  194976. },
  194977. sampler: new Sampler_default({
  194978. wrapS: TextureWrap_default.REPEAT,
  194979. wrapT: TextureWrap_default.REPEAT,
  194980. minificationFilter: TextureMinificationFilter_default.NEAREST,
  194981. magnificationFilter: TextureMagnificationFilter_default.NEAREST
  194982. })
  194983. });
  194984. }
  194985. this._textureCache.update(context);
  194986. fxaa.update(context, useLogDepth);
  194987. ao.update(context, useLogDepth);
  194988. bloom.update(context, useLogDepth);
  194989. tonemapping.update(context, useLogDepth);
  194990. if (this._autoExposureEnabled) {
  194991. autoexposure.update(context, useLogDepth);
  194992. }
  194993. length3 = stages.length;
  194994. for (i2 = 0; i2 < length3; ++i2) {
  194995. stages[i2].update(context, useLogDepth);
  194996. }
  194997. count = 0;
  194998. for (i2 = 0; i2 < length3; ++i2) {
  194999. stage = stages[i2];
  195000. if (stage.ready && stage.enabled && stage._isSupported(context)) {
  195001. count++;
  195002. }
  195003. }
  195004. activeStagesChanged = count !== activeStages.length;
  195005. if (activeStagesChanged) {
  195006. this.update(context, useLogDepth, useHdr);
  195007. }
  195008. };
  195009. PostProcessStageCollection.prototype.clear = function(context) {
  195010. this._textureCache.clear(context);
  195011. if (this._autoExposureEnabled) {
  195012. this._autoExposure.clear(context);
  195013. }
  195014. };
  195015. function getOutputTexture(stage) {
  195016. while (defined_default(stage.length)) {
  195017. stage = stage.get(stage.length - 1);
  195018. }
  195019. return stage.outputTexture;
  195020. }
  195021. PostProcessStageCollection.prototype.getOutputTexture = function(stageName) {
  195022. const stage = this.getStageByName(stageName);
  195023. if (!defined_default(stage)) {
  195024. return void 0;
  195025. }
  195026. return getOutputTexture(stage);
  195027. };
  195028. function execute(stage, context, colorTexture, depthTexture, idTexture) {
  195029. if (defined_default(stage.execute)) {
  195030. stage.execute(context, colorTexture, depthTexture, idTexture);
  195031. return;
  195032. }
  195033. const length3 = stage.length;
  195034. let i2;
  195035. if (stage.inputPreviousStageTexture) {
  195036. execute(stage.get(0), context, colorTexture, depthTexture, idTexture);
  195037. for (i2 = 1; i2 < length3; ++i2) {
  195038. execute(
  195039. stage.get(i2),
  195040. context,
  195041. getOutputTexture(stage.get(i2 - 1)),
  195042. depthTexture,
  195043. idTexture
  195044. );
  195045. }
  195046. } else {
  195047. for (i2 = 0; i2 < length3; ++i2) {
  195048. execute(stage.get(i2), context, colorTexture, depthTexture, idTexture);
  195049. }
  195050. }
  195051. }
  195052. PostProcessStageCollection.prototype.execute = function(context, colorTexture, depthTexture, idTexture) {
  195053. const activeStages = this._activeStages;
  195054. const length3 = activeStages.length;
  195055. const fxaa = this._fxaa;
  195056. const ao = this._ao;
  195057. const bloom = this._bloom;
  195058. const autoexposure = this._autoExposure;
  195059. const tonemapping = this._tonemapping;
  195060. const aoEnabled = ao.enabled && ao._isSupported(context);
  195061. const bloomEnabled = bloom.enabled && bloom._isSupported(context);
  195062. const autoExposureEnabled = this._autoExposureEnabled;
  195063. const tonemappingEnabled = tonemapping.enabled && tonemapping._isSupported(context);
  195064. const fxaaEnabled = fxaa.enabled && fxaa._isSupported(context);
  195065. if (!fxaaEnabled && !aoEnabled && !bloomEnabled && !tonemappingEnabled && length3 === 0) {
  195066. return;
  195067. }
  195068. let initialTexture = colorTexture;
  195069. if (aoEnabled && ao.ready) {
  195070. execute(ao, context, initialTexture, depthTexture, idTexture);
  195071. initialTexture = getOutputTexture(ao);
  195072. }
  195073. if (bloomEnabled && bloom.ready) {
  195074. execute(bloom, context, initialTexture, depthTexture, idTexture);
  195075. initialTexture = getOutputTexture(bloom);
  195076. }
  195077. if (autoExposureEnabled && autoexposure.ready) {
  195078. execute(autoexposure, context, initialTexture, depthTexture, idTexture);
  195079. }
  195080. if (tonemappingEnabled && tonemapping.ready) {
  195081. execute(tonemapping, context, initialTexture, depthTexture, idTexture);
  195082. initialTexture = getOutputTexture(tonemapping);
  195083. }
  195084. let lastTexture = initialTexture;
  195085. if (length3 > 0) {
  195086. execute(activeStages[0], context, initialTexture, depthTexture, idTexture);
  195087. for (let i2 = 1; i2 < length3; ++i2) {
  195088. execute(
  195089. activeStages[i2],
  195090. context,
  195091. getOutputTexture(activeStages[i2 - 1]),
  195092. depthTexture,
  195093. idTexture
  195094. );
  195095. }
  195096. lastTexture = getOutputTexture(activeStages[length3 - 1]);
  195097. }
  195098. if (fxaaEnabled && fxaa.ready) {
  195099. execute(fxaa, context, lastTexture, depthTexture, idTexture);
  195100. }
  195101. };
  195102. PostProcessStageCollection.prototype.copy = function(context, framebuffer) {
  195103. if (!defined_default(this._copyColorCommand)) {
  195104. const that = this;
  195105. this._copyColorCommand = context.createViewportQuadCommand(PassThrough_default, {
  195106. uniformMap: {
  195107. colorTexture: function() {
  195108. return that.outputTexture;
  195109. }
  195110. },
  195111. owner: this
  195112. });
  195113. }
  195114. this._copyColorCommand.framebuffer = framebuffer;
  195115. this._copyColorCommand.execute(context);
  195116. };
  195117. PostProcessStageCollection.prototype.isDestroyed = function() {
  195118. return false;
  195119. };
  195120. PostProcessStageCollection.prototype.destroy = function() {
  195121. this._fxaa.destroy();
  195122. this._ao.destroy();
  195123. this._bloom.destroy();
  195124. this._autoExposure.destroy();
  195125. this._tonemapping.destroy();
  195126. this.removeAll();
  195127. this._textureCache = this._textureCache && this._textureCache.destroy();
  195128. return destroyObject_default(this);
  195129. };
  195130. var PostProcessStageCollection_default = PostProcessStageCollection;
  195131. // node_modules/cesium/Source/Scene/QuadtreeTileProvider.js
  195132. function QuadtreeTileProvider() {
  195133. DeveloperError_default.throwInstantiationError();
  195134. }
  195135. QuadtreeTileProvider.computeDefaultLevelZeroMaximumGeometricError = function(tilingScheme2) {
  195136. return tilingScheme2.ellipsoid.maximumRadius * 2 * Math.PI * 0.25 / (65 * tilingScheme2.getNumberOfXTilesAtLevel(0));
  195137. };
  195138. Object.defineProperties(QuadtreeTileProvider.prototype, {
  195139. quadtree: {
  195140. get: DeveloperError_default.throwInstantiationError,
  195141. set: DeveloperError_default.throwInstantiationError
  195142. },
  195143. ready: {
  195144. get: DeveloperError_default.throwInstantiationError
  195145. },
  195146. tilingScheme: {
  195147. get: DeveloperError_default.throwInstantiationError
  195148. },
  195149. errorEvent: {
  195150. get: DeveloperError_default.throwInstantiationError
  195151. }
  195152. });
  195153. QuadtreeTileProvider.prototype.update = DeveloperError_default.throwInstantiationError;
  195154. QuadtreeTileProvider.prototype.beginUpdate = DeveloperError_default.throwInstantiationError;
  195155. QuadtreeTileProvider.prototype.endUpdate = DeveloperError_default.throwInstantiationError;
  195156. QuadtreeTileProvider.prototype.getLevelMaximumGeometricError = DeveloperError_default.throwInstantiationError;
  195157. QuadtreeTileProvider.prototype.loadTile = DeveloperError_default.throwInstantiationError;
  195158. QuadtreeTileProvider.prototype.computeTileVisibility = DeveloperError_default.throwInstantiationError;
  195159. QuadtreeTileProvider.prototype.showTileThisFrame = DeveloperError_default.throwInstantiationError;
  195160. QuadtreeTileProvider.prototype.computeDistanceToTile = DeveloperError_default.throwInstantiationError;
  195161. QuadtreeTileProvider.prototype.isDestroyed = DeveloperError_default.throwInstantiationError;
  195162. QuadtreeTileProvider.prototype.destroy = DeveloperError_default.throwInstantiationError;
  195163. var QuadtreeTileProvider_default = QuadtreeTileProvider;
  195164. // node_modules/cesium/Source/Scene/SceneTransitioner.js
  195165. function SceneTransitioner(scene) {
  195166. Check_default.typeOf.object("scene", scene);
  195167. this._scene = scene;
  195168. this._currentTweens = [];
  195169. this._morphHandler = void 0;
  195170. this._morphCancelled = false;
  195171. this._completeMorph = void 0;
  195172. this._morphToOrthographic = false;
  195173. }
  195174. SceneTransitioner.prototype.completeMorph = function() {
  195175. if (defined_default(this._completeMorph)) {
  195176. this._completeMorph();
  195177. }
  195178. };
  195179. SceneTransitioner.prototype.morphTo2D = function(duration, ellipsoid) {
  195180. if (defined_default(this._completeMorph)) {
  195181. this._completeMorph();
  195182. }
  195183. const scene = this._scene;
  195184. this._previousMode = scene.mode;
  195185. this._morphToOrthographic = scene.camera.frustum instanceof OrthographicFrustum_default;
  195186. if (this._previousMode === SceneMode_default.SCENE2D || this._previousMode === SceneMode_default.MORPHING) {
  195187. return;
  195188. }
  195189. this._scene.morphStart.raiseEvent(
  195190. this,
  195191. this._previousMode,
  195192. SceneMode_default.SCENE2D,
  195193. true
  195194. );
  195195. scene._mode = SceneMode_default.MORPHING;
  195196. scene.camera._setTransform(Matrix4_default.IDENTITY);
  195197. if (this._previousMode === SceneMode_default.COLUMBUS_VIEW) {
  195198. morphFromColumbusViewTo2D(this, duration);
  195199. } else {
  195200. morphFrom3DTo2D(this, duration, ellipsoid);
  195201. }
  195202. if (duration === 0 && defined_default(this._completeMorph)) {
  195203. this._completeMorph();
  195204. }
  195205. };
  195206. var scratchToCVPosition = new Cartesian3_default();
  195207. var scratchToCVDirection = new Cartesian3_default();
  195208. var scratchToCVUp = new Cartesian3_default();
  195209. var scratchToCVPosition2D = new Cartesian3_default();
  195210. var scratchToCVDirection2D = new Cartesian3_default();
  195211. var scratchToCVUp2D = new Cartesian3_default();
  195212. var scratchToCVSurfacePosition = new Cartesian3_default();
  195213. var scratchToCVCartographic = new Cartographic_default();
  195214. var scratchToCVToENU = new Matrix4_default();
  195215. var scratchToCVFrustumPerspective = new PerspectiveFrustum_default();
  195216. var scratchToCVFrustumOrthographic = new OrthographicFrustum_default();
  195217. var scratchToCVCamera = {
  195218. position: void 0,
  195219. direction: void 0,
  195220. up: void 0,
  195221. position2D: void 0,
  195222. direction2D: void 0,
  195223. up2D: void 0,
  195224. frustum: void 0
  195225. };
  195226. SceneTransitioner.prototype.morphToColumbusView = function(duration, ellipsoid) {
  195227. if (defined_default(this._completeMorph)) {
  195228. this._completeMorph();
  195229. }
  195230. const scene = this._scene;
  195231. this._previousMode = scene.mode;
  195232. if (this._previousMode === SceneMode_default.COLUMBUS_VIEW || this._previousMode === SceneMode_default.MORPHING) {
  195233. return;
  195234. }
  195235. this._scene.morphStart.raiseEvent(
  195236. this,
  195237. this._previousMode,
  195238. SceneMode_default.COLUMBUS_VIEW,
  195239. true
  195240. );
  195241. scene.camera._setTransform(Matrix4_default.IDENTITY);
  195242. let position = scratchToCVPosition;
  195243. const direction2 = scratchToCVDirection;
  195244. const up = scratchToCVUp;
  195245. if (duration > 0) {
  195246. position.x = 0;
  195247. position.y = -1;
  195248. position.z = 1;
  195249. position = Cartesian3_default.multiplyByScalar(
  195250. Cartesian3_default.normalize(position, position),
  195251. 5 * ellipsoid.maximumRadius,
  195252. position
  195253. );
  195254. Cartesian3_default.negate(Cartesian3_default.normalize(position, direction2), direction2);
  195255. Cartesian3_default.cross(Cartesian3_default.UNIT_X, direction2, up);
  195256. } else {
  195257. const camera = scene.camera;
  195258. if (this._previousMode === SceneMode_default.SCENE2D) {
  195259. Cartesian3_default.clone(camera.position, position);
  195260. position.z = camera.frustum.right - camera.frustum.left;
  195261. Cartesian3_default.negate(Cartesian3_default.UNIT_Z, direction2);
  195262. Cartesian3_default.clone(Cartesian3_default.UNIT_Y, up);
  195263. } else {
  195264. Cartesian3_default.clone(camera.positionWC, position);
  195265. Cartesian3_default.clone(camera.directionWC, direction2);
  195266. Cartesian3_default.clone(camera.upWC, up);
  195267. const surfacePoint = ellipsoid.scaleToGeodeticSurface(
  195268. position,
  195269. scratchToCVSurfacePosition
  195270. );
  195271. const toENU = Transforms_default.eastNorthUpToFixedFrame(
  195272. surfacePoint,
  195273. ellipsoid,
  195274. scratchToCVToENU
  195275. );
  195276. Matrix4_default.inverseTransformation(toENU, toENU);
  195277. scene.mapProjection.project(
  195278. ellipsoid.cartesianToCartographic(position, scratchToCVCartographic),
  195279. position
  195280. );
  195281. Matrix4_default.multiplyByPointAsVector(toENU, direction2, direction2);
  195282. Matrix4_default.multiplyByPointAsVector(toENU, up, up);
  195283. }
  195284. }
  195285. let frustum;
  195286. if (this._morphToOrthographic) {
  195287. frustum = scratchToCVFrustumOrthographic;
  195288. frustum.width = scene.camera.frustum.right - scene.camera.frustum.left;
  195289. frustum.aspectRatio = scene.drawingBufferWidth / scene.drawingBufferHeight;
  195290. } else {
  195291. frustum = scratchToCVFrustumPerspective;
  195292. frustum.aspectRatio = scene.drawingBufferWidth / scene.drawingBufferHeight;
  195293. frustum.fov = Math_default.toRadians(60);
  195294. }
  195295. const cameraCV = scratchToCVCamera;
  195296. cameraCV.position = position;
  195297. cameraCV.direction = direction2;
  195298. cameraCV.up = up;
  195299. cameraCV.frustum = frustum;
  195300. const complete = completeColumbusViewCallback(cameraCV);
  195301. createMorphHandler(this, complete);
  195302. if (this._previousMode === SceneMode_default.SCENE2D) {
  195303. morphFrom2DToColumbusView(this, duration, cameraCV, complete);
  195304. } else {
  195305. cameraCV.position2D = Matrix4_default.multiplyByPoint(
  195306. Camera_default.TRANSFORM_2D,
  195307. position,
  195308. scratchToCVPosition2D
  195309. );
  195310. cameraCV.direction2D = Matrix4_default.multiplyByPointAsVector(
  195311. Camera_default.TRANSFORM_2D,
  195312. direction2,
  195313. scratchToCVDirection2D
  195314. );
  195315. cameraCV.up2D = Matrix4_default.multiplyByPointAsVector(
  195316. Camera_default.TRANSFORM_2D,
  195317. up,
  195318. scratchToCVUp2D
  195319. );
  195320. scene._mode = SceneMode_default.MORPHING;
  195321. morphFrom3DToColumbusView(this, duration, cameraCV, complete);
  195322. }
  195323. if (duration === 0 && defined_default(this._completeMorph)) {
  195324. this._completeMorph();
  195325. }
  195326. };
  195327. var scratchCVTo3DCamera = {
  195328. position: new Cartesian3_default(),
  195329. direction: new Cartesian3_default(),
  195330. up: new Cartesian3_default(),
  195331. frustum: void 0
  195332. };
  195333. var scratch2DTo3DFrustumPersp = new PerspectiveFrustum_default();
  195334. SceneTransitioner.prototype.morphTo3D = function(duration, ellipsoid) {
  195335. if (defined_default(this._completeMorph)) {
  195336. this._completeMorph();
  195337. }
  195338. const scene = this._scene;
  195339. this._previousMode = scene.mode;
  195340. if (this._previousMode === SceneMode_default.SCENE3D || this._previousMode === SceneMode_default.MORPHING) {
  195341. return;
  195342. }
  195343. this._scene.morphStart.raiseEvent(
  195344. this,
  195345. this._previousMode,
  195346. SceneMode_default.SCENE3D,
  195347. true
  195348. );
  195349. scene._mode = SceneMode_default.MORPHING;
  195350. scene.camera._setTransform(Matrix4_default.IDENTITY);
  195351. if (this._previousMode === SceneMode_default.SCENE2D) {
  195352. morphFrom2DTo3D(this, duration, ellipsoid);
  195353. } else {
  195354. let camera3D;
  195355. if (duration > 0) {
  195356. camera3D = scratchCVTo3DCamera;
  195357. Cartesian3_default.fromDegrees(
  195358. 0,
  195359. 0,
  195360. 5 * ellipsoid.maximumRadius,
  195361. ellipsoid,
  195362. camera3D.position
  195363. );
  195364. Cartesian3_default.negate(camera3D.position, camera3D.direction);
  195365. Cartesian3_default.normalize(camera3D.direction, camera3D.direction);
  195366. Cartesian3_default.clone(Cartesian3_default.UNIT_Z, camera3D.up);
  195367. } else {
  195368. camera3D = getColumbusViewTo3DCamera(this, ellipsoid);
  195369. }
  195370. let frustum;
  195371. const camera = scene.camera;
  195372. if (camera.frustum instanceof OrthographicFrustum_default) {
  195373. frustum = camera.frustum.clone();
  195374. } else {
  195375. frustum = scratch2DTo3DFrustumPersp;
  195376. frustum.aspectRatio = scene.drawingBufferWidth / scene.drawingBufferHeight;
  195377. frustum.fov = Math_default.toRadians(60);
  195378. }
  195379. camera3D.frustum = frustum;
  195380. const complete = complete3DCallback(camera3D);
  195381. createMorphHandler(this, complete);
  195382. morphFromColumbusViewTo3D(this, duration, camera3D, complete);
  195383. }
  195384. if (duration === 0 && defined_default(this._completeMorph)) {
  195385. this._completeMorph();
  195386. }
  195387. };
  195388. SceneTransitioner.prototype.isDestroyed = function() {
  195389. return false;
  195390. };
  195391. SceneTransitioner.prototype.destroy = function() {
  195392. destroyMorphHandler(this);
  195393. return destroyObject_default(this);
  195394. };
  195395. function createMorphHandler(transitioner, completeMorphFunction) {
  195396. if (transitioner._scene.completeMorphOnUserInput) {
  195397. transitioner._morphHandler = new ScreenSpaceEventHandler_default(
  195398. transitioner._scene.canvas
  195399. );
  195400. const completeMorph = function() {
  195401. transitioner._morphCancelled = true;
  195402. transitioner._scene.camera.cancelFlight();
  195403. completeMorphFunction(transitioner);
  195404. };
  195405. transitioner._completeMorph = completeMorph;
  195406. transitioner._morphHandler.setInputAction(
  195407. completeMorph,
  195408. ScreenSpaceEventType_default.LEFT_DOWN
  195409. );
  195410. transitioner._morphHandler.setInputAction(
  195411. completeMorph,
  195412. ScreenSpaceEventType_default.MIDDLE_DOWN
  195413. );
  195414. transitioner._morphHandler.setInputAction(
  195415. completeMorph,
  195416. ScreenSpaceEventType_default.RIGHT_DOWN
  195417. );
  195418. transitioner._morphHandler.setInputAction(
  195419. completeMorph,
  195420. ScreenSpaceEventType_default.WHEEL
  195421. );
  195422. }
  195423. }
  195424. function destroyMorphHandler(transitioner) {
  195425. const tweens = transitioner._currentTweens;
  195426. for (let i2 = 0; i2 < tweens.length; ++i2) {
  195427. tweens[i2].cancelTween();
  195428. }
  195429. transitioner._currentTweens.length = 0;
  195430. transitioner._morphHandler = transitioner._morphHandler && transitioner._morphHandler.destroy();
  195431. }
  195432. var scratchCVTo3DCartographic = new Cartographic_default();
  195433. var scratchCVTo3DSurfacePoint = new Cartesian3_default();
  195434. var scratchCVTo3DFromENU = new Matrix4_default();
  195435. function getColumbusViewTo3DCamera(transitioner, ellipsoid) {
  195436. const scene = transitioner._scene;
  195437. const camera = scene.camera;
  195438. const camera3D = scratchCVTo3DCamera;
  195439. const position = camera3D.position;
  195440. const direction2 = camera3D.direction;
  195441. const up = camera3D.up;
  195442. const positionCarto = scene.mapProjection.unproject(
  195443. camera.position,
  195444. scratchCVTo3DCartographic
  195445. );
  195446. ellipsoid.cartographicToCartesian(positionCarto, position);
  195447. const surfacePoint = ellipsoid.scaleToGeodeticSurface(
  195448. position,
  195449. scratchCVTo3DSurfacePoint
  195450. );
  195451. const fromENU = Transforms_default.eastNorthUpToFixedFrame(
  195452. surfacePoint,
  195453. ellipsoid,
  195454. scratchCVTo3DFromENU
  195455. );
  195456. Matrix4_default.multiplyByPointAsVector(fromENU, camera.direction, direction2);
  195457. Matrix4_default.multiplyByPointAsVector(fromENU, camera.up, up);
  195458. return camera3D;
  195459. }
  195460. var scratchCVTo3DStartPos = new Cartesian3_default();
  195461. var scratchCVTo3DStartDir = new Cartesian3_default();
  195462. var scratchCVTo3DStartUp = new Cartesian3_default();
  195463. var scratchCVTo3DEndPos = new Cartesian3_default();
  195464. var scratchCVTo3DEndDir = new Cartesian3_default();
  195465. var scratchCVTo3DEndUp = new Cartesian3_default();
  195466. function morphFromColumbusViewTo3D(transitioner, duration, endCamera, complete) {
  195467. duration *= 0.5;
  195468. const scene = transitioner._scene;
  195469. const camera = scene.camera;
  195470. const startPos = Cartesian3_default.clone(camera.position, scratchCVTo3DStartPos);
  195471. const startDir = Cartesian3_default.clone(camera.direction, scratchCVTo3DStartDir);
  195472. const startUp = Cartesian3_default.clone(camera.up, scratchCVTo3DStartUp);
  195473. const endPos = Matrix4_default.multiplyByPoint(
  195474. Camera_default.TRANSFORM_2D_INVERSE,
  195475. endCamera.position,
  195476. scratchCVTo3DEndPos
  195477. );
  195478. const endDir = Matrix4_default.multiplyByPointAsVector(
  195479. Camera_default.TRANSFORM_2D_INVERSE,
  195480. endCamera.direction,
  195481. scratchCVTo3DEndDir
  195482. );
  195483. const endUp = Matrix4_default.multiplyByPointAsVector(
  195484. Camera_default.TRANSFORM_2D_INVERSE,
  195485. endCamera.up,
  195486. scratchCVTo3DEndUp
  195487. );
  195488. function update7(value) {
  195489. columbusViewMorph(startPos, endPos, value.time, camera.position);
  195490. columbusViewMorph(startDir, endDir, value.time, camera.direction);
  195491. columbusViewMorph(startUp, endUp, value.time, camera.up);
  195492. Cartesian3_default.cross(camera.direction, camera.up, camera.right);
  195493. Cartesian3_default.normalize(camera.right, camera.right);
  195494. }
  195495. const tween = scene.tweens.add({
  195496. duration,
  195497. easingFunction: EasingFunction_default.QUARTIC_OUT,
  195498. startObject: {
  195499. time: 0
  195500. },
  195501. stopObject: {
  195502. time: 1
  195503. },
  195504. update: update7,
  195505. complete: function() {
  195506. addMorphTimeAnimations(transitioner, scene, 0, 1, duration, complete);
  195507. }
  195508. });
  195509. transitioner._currentTweens.push(tween);
  195510. }
  195511. var scratch2DTo3DFrustumOrtho = new OrthographicFrustum_default();
  195512. var scratch3DToCVStartPos = new Cartesian3_default();
  195513. var scratch3DToCVStartDir = new Cartesian3_default();
  195514. var scratch3DToCVStartUp = new Cartesian3_default();
  195515. var scratch3DToCVEndPos = new Cartesian3_default();
  195516. var scratch3DToCVEndDir = new Cartesian3_default();
  195517. var scratch3DToCVEndUp = new Cartesian3_default();
  195518. function morphFrom2DTo3D(transitioner, duration, ellipsoid) {
  195519. duration /= 3;
  195520. const scene = transitioner._scene;
  195521. const camera = scene.camera;
  195522. let camera3D;
  195523. if (duration > 0) {
  195524. camera3D = scratchCVTo3DCamera;
  195525. Cartesian3_default.fromDegrees(
  195526. 0,
  195527. 0,
  195528. 5 * ellipsoid.maximumRadius,
  195529. ellipsoid,
  195530. camera3D.position
  195531. );
  195532. Cartesian3_default.negate(camera3D.position, camera3D.direction);
  195533. Cartesian3_default.normalize(camera3D.direction, camera3D.direction);
  195534. Cartesian3_default.clone(Cartesian3_default.UNIT_Z, camera3D.up);
  195535. } else {
  195536. camera.position.z = camera.frustum.right - camera.frustum.left;
  195537. camera3D = getColumbusViewTo3DCamera(transitioner, ellipsoid);
  195538. }
  195539. let frustum;
  195540. if (transitioner._morphToOrthographic) {
  195541. frustum = scratch2DTo3DFrustumOrtho;
  195542. frustum.aspectRatio = scene.drawingBufferWidth / scene.drawingBufferHeight;
  195543. frustum.width = camera.frustum.right - camera.frustum.left;
  195544. } else {
  195545. frustum = scratch2DTo3DFrustumPersp;
  195546. frustum.aspectRatio = scene.drawingBufferWidth / scene.drawingBufferHeight;
  195547. frustum.fov = Math_default.toRadians(60);
  195548. }
  195549. camera3D.frustum = frustum;
  195550. const complete = complete3DCallback(camera3D);
  195551. createMorphHandler(transitioner, complete);
  195552. let morph;
  195553. if (transitioner._morphToOrthographic) {
  195554. morph = function() {
  195555. morphFromColumbusViewTo3D(transitioner, duration, camera3D, complete);
  195556. };
  195557. } else {
  195558. morph = function() {
  195559. morphOrthographicToPerspective(
  195560. transitioner,
  195561. duration,
  195562. camera3D,
  195563. function() {
  195564. morphFromColumbusViewTo3D(transitioner, duration, camera3D, complete);
  195565. }
  195566. );
  195567. };
  195568. }
  195569. if (duration > 0) {
  195570. scene._mode = SceneMode_default.SCENE2D;
  195571. camera.flyTo({
  195572. duration,
  195573. destination: Cartesian3_default.fromDegrees(
  195574. 0,
  195575. 0,
  195576. 5 * ellipsoid.maximumRadius,
  195577. ellipsoid,
  195578. scratch3DToCVEndPos
  195579. ),
  195580. complete: function() {
  195581. scene._mode = SceneMode_default.MORPHING;
  195582. morph();
  195583. }
  195584. });
  195585. } else {
  195586. morph();
  195587. }
  195588. }
  195589. function columbusViewMorph(startPosition, endPosition, time, result) {
  195590. return Cartesian3_default.lerp(startPosition, endPosition, time, result);
  195591. }
  195592. function morphPerspectiveToOrthographic(transitioner, duration, endCamera, updateHeight, complete) {
  195593. const scene = transitioner._scene;
  195594. const camera = scene.camera;
  195595. if (camera.frustum instanceof OrthographicFrustum_default) {
  195596. return;
  195597. }
  195598. const startFOV = camera.frustum.fov;
  195599. const endFOV = Math_default.RADIANS_PER_DEGREE * 0.5;
  195600. const d = endCamera.position.z * Math.tan(startFOV * 0.5);
  195601. camera.frustum.far = d / Math.tan(endFOV * 0.5) + 1e7;
  195602. function update7(value) {
  195603. camera.frustum.fov = Math_default.lerp(startFOV, endFOV, value.time);
  195604. const height = d / Math.tan(camera.frustum.fov * 0.5);
  195605. updateHeight(camera, height);
  195606. }
  195607. const tween = scene.tweens.add({
  195608. duration,
  195609. easingFunction: EasingFunction_default.QUARTIC_OUT,
  195610. startObject: {
  195611. time: 0
  195612. },
  195613. stopObject: {
  195614. time: 1
  195615. },
  195616. update: update7,
  195617. complete: function() {
  195618. camera.frustum = endCamera.frustum.clone();
  195619. complete(transitioner);
  195620. }
  195621. });
  195622. transitioner._currentTweens.push(tween);
  195623. }
  195624. var scratchCVTo2DStartPos = new Cartesian3_default();
  195625. var scratchCVTo2DStartDir = new Cartesian3_default();
  195626. var scratchCVTo2DStartUp = new Cartesian3_default();
  195627. var scratchCVTo2DEndPos = new Cartesian3_default();
  195628. var scratchCVTo2DEndDir = new Cartesian3_default();
  195629. var scratchCVTo2DEndUp = new Cartesian3_default();
  195630. var scratchCVTo2DFrustum = new OrthographicOffCenterFrustum_default();
  195631. var scratchCVTo2DRay = new Ray_default();
  195632. var scratchCVTo2DPickPos = new Cartesian3_default();
  195633. var scratchCVTo2DCamera = {
  195634. position: void 0,
  195635. direction: void 0,
  195636. up: void 0,
  195637. frustum: void 0
  195638. };
  195639. function morphFromColumbusViewTo2D(transitioner, duration) {
  195640. duration *= 0.5;
  195641. const scene = transitioner._scene;
  195642. const camera = scene.camera;
  195643. const startPos = Cartesian3_default.clone(camera.position, scratchCVTo2DStartPos);
  195644. const startDir = Cartesian3_default.clone(camera.direction, scratchCVTo2DStartDir);
  195645. const startUp = Cartesian3_default.clone(camera.up, scratchCVTo2DStartUp);
  195646. const endDir = Cartesian3_default.negate(Cartesian3_default.UNIT_Z, scratchCVTo2DEndDir);
  195647. const endUp = Cartesian3_default.clone(Cartesian3_default.UNIT_Y, scratchCVTo2DEndUp);
  195648. const endPos = scratchCVTo2DEndPos;
  195649. if (duration > 0) {
  195650. Cartesian3_default.clone(Cartesian3_default.ZERO, scratchCVTo2DEndPos);
  195651. endPos.z = 5 * scene.mapProjection.ellipsoid.maximumRadius;
  195652. } else {
  195653. Cartesian3_default.clone(startPos, scratchCVTo2DEndPos);
  195654. const ray = scratchCVTo2DRay;
  195655. Matrix4_default.multiplyByPoint(Camera_default.TRANSFORM_2D, startPos, ray.origin);
  195656. Matrix4_default.multiplyByPointAsVector(
  195657. Camera_default.TRANSFORM_2D,
  195658. startDir,
  195659. ray.direction
  195660. );
  195661. const globe = scene.globe;
  195662. if (defined_default(globe)) {
  195663. const pickPos = globe.pickWorldCoordinates(
  195664. ray,
  195665. scene,
  195666. true,
  195667. scratchCVTo2DPickPos
  195668. );
  195669. if (defined_default(pickPos)) {
  195670. Matrix4_default.multiplyByPoint(Camera_default.TRANSFORM_2D_INVERSE, pickPos, endPos);
  195671. endPos.z += Cartesian3_default.distance(startPos, endPos);
  195672. }
  195673. }
  195674. }
  195675. const frustum = scratchCVTo2DFrustum;
  195676. frustum.right = endPos.z * 0.5;
  195677. frustum.left = -frustum.right;
  195678. frustum.top = frustum.right * (scene.drawingBufferHeight / scene.drawingBufferWidth);
  195679. frustum.bottom = -frustum.top;
  195680. const camera2D = scratchCVTo2DCamera;
  195681. camera2D.position = endPos;
  195682. camera2D.direction = endDir;
  195683. camera2D.up = endUp;
  195684. camera2D.frustum = frustum;
  195685. const complete = complete2DCallback(camera2D);
  195686. createMorphHandler(transitioner, complete);
  195687. function updateCV2(value) {
  195688. columbusViewMorph(startPos, endPos, value.time, camera.position);
  195689. columbusViewMorph(startDir, endDir, value.time, camera.direction);
  195690. columbusViewMorph(startUp, endUp, value.time, camera.up);
  195691. Cartesian3_default.cross(camera.direction, camera.up, camera.right);
  195692. Cartesian3_default.normalize(camera.right, camera.right);
  195693. camera._adjustOrthographicFrustum(true);
  195694. }
  195695. function updateHeight(camera2, height) {
  195696. camera2.position.z = height;
  195697. }
  195698. const tween = scene.tweens.add({
  195699. duration,
  195700. easingFunction: EasingFunction_default.QUARTIC_OUT,
  195701. startObject: {
  195702. time: 0
  195703. },
  195704. stopObject: {
  195705. time: 1
  195706. },
  195707. update: updateCV2,
  195708. complete: function() {
  195709. morphPerspectiveToOrthographic(
  195710. transitioner,
  195711. duration,
  195712. camera2D,
  195713. updateHeight,
  195714. complete
  195715. );
  195716. }
  195717. });
  195718. transitioner._currentTweens.push(tween);
  195719. }
  195720. var scratch3DTo2DCartographic = new Cartographic_default();
  195721. var scratch3DTo2DCamera = {
  195722. position: new Cartesian3_default(),
  195723. direction: new Cartesian3_default(),
  195724. up: new Cartesian3_default(),
  195725. position2D: new Cartesian3_default(),
  195726. direction2D: new Cartesian3_default(),
  195727. up2D: new Cartesian3_default(),
  195728. frustum: new OrthographicOffCenterFrustum_default()
  195729. };
  195730. var scratch3DTo2DEndCamera = {
  195731. position: new Cartesian3_default(),
  195732. direction: new Cartesian3_default(),
  195733. up: new Cartesian3_default(),
  195734. frustum: void 0
  195735. };
  195736. var scratch3DTo2DPickPosition = new Cartesian3_default();
  195737. var scratch3DTo2DRay = new Ray_default();
  195738. var scratch3DTo2DToENU = new Matrix4_default();
  195739. var scratch3DTo2DSurfacePoint = new Cartesian3_default();
  195740. function morphFrom3DTo2D(transitioner, duration, ellipsoid) {
  195741. duration *= 0.5;
  195742. const scene = transitioner._scene;
  195743. const camera = scene.camera;
  195744. const camera2D = scratch3DTo2DCamera;
  195745. if (duration > 0) {
  195746. Cartesian3_default.clone(Cartesian3_default.ZERO, camera2D.position);
  195747. camera2D.position.z = 5 * ellipsoid.maximumRadius;
  195748. Cartesian3_default.negate(Cartesian3_default.UNIT_Z, camera2D.direction);
  195749. Cartesian3_default.clone(Cartesian3_default.UNIT_Y, camera2D.up);
  195750. } else {
  195751. ellipsoid.cartesianToCartographic(
  195752. camera.positionWC,
  195753. scratch3DTo2DCartographic
  195754. );
  195755. scene.mapProjection.project(scratch3DTo2DCartographic, camera2D.position);
  195756. Cartesian3_default.negate(Cartesian3_default.UNIT_Z, camera2D.direction);
  195757. Cartesian3_default.clone(Cartesian3_default.UNIT_Y, camera2D.up);
  195758. const ray = scratch3DTo2DRay;
  195759. Cartesian3_default.clone(camera2D.position2D, ray.origin);
  195760. const rayDirection = Cartesian3_default.clone(camera.directionWC, ray.direction);
  195761. const surfacePoint = ellipsoid.scaleToGeodeticSurface(
  195762. camera.positionWC,
  195763. scratch3DTo2DSurfacePoint
  195764. );
  195765. const toENU = Transforms_default.eastNorthUpToFixedFrame(
  195766. surfacePoint,
  195767. ellipsoid,
  195768. scratch3DTo2DToENU
  195769. );
  195770. Matrix4_default.inverseTransformation(toENU, toENU);
  195771. Matrix4_default.multiplyByPointAsVector(toENU, rayDirection, rayDirection);
  195772. Matrix4_default.multiplyByPointAsVector(
  195773. Camera_default.TRANSFORM_2D,
  195774. rayDirection,
  195775. rayDirection
  195776. );
  195777. const globe = scene.globe;
  195778. if (defined_default(globe)) {
  195779. const pickedPos = globe.pickWorldCoordinates(
  195780. ray,
  195781. scene,
  195782. true,
  195783. scratch3DTo2DPickPosition
  195784. );
  195785. if (defined_default(pickedPos)) {
  195786. const height = Cartesian3_default.distance(camera2D.position2D, pickedPos);
  195787. pickedPos.x += height;
  195788. Cartesian3_default.clone(pickedPos, camera2D.position2D);
  195789. }
  195790. }
  195791. }
  195792. function updateHeight(camera2, height) {
  195793. camera2.position.x = height;
  195794. }
  195795. Matrix4_default.multiplyByPoint(
  195796. Camera_default.TRANSFORM_2D,
  195797. camera2D.position,
  195798. camera2D.position2D
  195799. );
  195800. Matrix4_default.multiplyByPointAsVector(
  195801. Camera_default.TRANSFORM_2D,
  195802. camera2D.direction,
  195803. camera2D.direction2D
  195804. );
  195805. Matrix4_default.multiplyByPointAsVector(
  195806. Camera_default.TRANSFORM_2D,
  195807. camera2D.up,
  195808. camera2D.up2D
  195809. );
  195810. const frustum = camera2D.frustum;
  195811. frustum.right = camera2D.position.z * 0.5;
  195812. frustum.left = -frustum.right;
  195813. frustum.top = frustum.right * (scene.drawingBufferHeight / scene.drawingBufferWidth);
  195814. frustum.bottom = -frustum.top;
  195815. const endCamera = scratch3DTo2DEndCamera;
  195816. Matrix4_default.multiplyByPoint(
  195817. Camera_default.TRANSFORM_2D_INVERSE,
  195818. camera2D.position2D,
  195819. endCamera.position
  195820. );
  195821. Cartesian3_default.clone(camera2D.direction, endCamera.direction);
  195822. Cartesian3_default.clone(camera2D.up, endCamera.up);
  195823. endCamera.frustum = frustum;
  195824. const complete = complete2DCallback(endCamera);
  195825. createMorphHandler(transitioner, complete);
  195826. function completeCallback() {
  195827. morphPerspectiveToOrthographic(
  195828. transitioner,
  195829. duration,
  195830. camera2D,
  195831. updateHeight,
  195832. complete
  195833. );
  195834. }
  195835. morphFrom3DToColumbusView(transitioner, duration, camera2D, completeCallback);
  195836. }
  195837. function morphOrthographicToPerspective(transitioner, duration, cameraCV, complete) {
  195838. const scene = transitioner._scene;
  195839. const camera = scene.camera;
  195840. const height = camera.frustum.right - camera.frustum.left;
  195841. camera.frustum = cameraCV.frustum.clone();
  195842. const endFOV = camera.frustum.fov;
  195843. const startFOV = Math_default.RADIANS_PER_DEGREE * 0.5;
  195844. const d = height * Math.tan(endFOV * 0.5);
  195845. camera.frustum.far = d / Math.tan(startFOV * 0.5) + 1e7;
  195846. camera.frustum.fov = startFOV;
  195847. function update7(value) {
  195848. camera.frustum.fov = Math_default.lerp(startFOV, endFOV, value.time);
  195849. camera.position.z = d / Math.tan(camera.frustum.fov * 0.5);
  195850. }
  195851. const tween = scene.tweens.add({
  195852. duration,
  195853. easingFunction: EasingFunction_default.QUARTIC_OUT,
  195854. startObject: {
  195855. time: 0
  195856. },
  195857. stopObject: {
  195858. time: 1
  195859. },
  195860. update: update7,
  195861. complete: function() {
  195862. complete(transitioner);
  195863. }
  195864. });
  195865. transitioner._currentTweens.push(tween);
  195866. }
  195867. function morphFrom2DToColumbusView(transitioner, duration, cameraCV, complete) {
  195868. duration *= 0.5;
  195869. const scene = transitioner._scene;
  195870. const camera = scene.camera;
  195871. const endPos = Cartesian3_default.clone(cameraCV.position, scratch3DToCVEndPos);
  195872. const endDir = Cartesian3_default.clone(cameraCV.direction, scratch3DToCVEndDir);
  195873. const endUp = Cartesian3_default.clone(cameraCV.up, scratch3DToCVEndUp);
  195874. scene._mode = SceneMode_default.MORPHING;
  195875. function morph() {
  195876. camera.frustum = cameraCV.frustum.clone();
  195877. const startPos = Cartesian3_default.clone(camera.position, scratch3DToCVStartPos);
  195878. const startDir = Cartesian3_default.clone(camera.direction, scratch3DToCVStartDir);
  195879. const startUp = Cartesian3_default.clone(camera.up, scratch3DToCVStartUp);
  195880. startPos.z = endPos.z;
  195881. function update7(value) {
  195882. columbusViewMorph(startPos, endPos, value.time, camera.position);
  195883. columbusViewMorph(startDir, endDir, value.time, camera.direction);
  195884. columbusViewMorph(startUp, endUp, value.time, camera.up);
  195885. Cartesian3_default.cross(camera.direction, camera.up, camera.right);
  195886. Cartesian3_default.normalize(camera.right, camera.right);
  195887. }
  195888. const tween = scene.tweens.add({
  195889. duration,
  195890. easingFunction: EasingFunction_default.QUARTIC_OUT,
  195891. startObject: {
  195892. time: 0
  195893. },
  195894. stopObject: {
  195895. time: 1
  195896. },
  195897. update: update7,
  195898. complete: function() {
  195899. complete(transitioner);
  195900. }
  195901. });
  195902. transitioner._currentTweens.push(tween);
  195903. }
  195904. if (transitioner._morphToOrthographic) {
  195905. morph();
  195906. } else {
  195907. morphOrthographicToPerspective(transitioner, 0, cameraCV, morph);
  195908. }
  195909. }
  195910. function morphFrom3DToColumbusView(transitioner, duration, endCamera, complete) {
  195911. const scene = transitioner._scene;
  195912. const camera = scene.camera;
  195913. const startPos = Cartesian3_default.clone(camera.position, scratch3DToCVStartPos);
  195914. const startDir = Cartesian3_default.clone(camera.direction, scratch3DToCVStartDir);
  195915. const startUp = Cartesian3_default.clone(camera.up, scratch3DToCVStartUp);
  195916. const endPos = Cartesian3_default.clone(endCamera.position2D, scratch3DToCVEndPos);
  195917. const endDir = Cartesian3_default.clone(endCamera.direction2D, scratch3DToCVEndDir);
  195918. const endUp = Cartesian3_default.clone(endCamera.up2D, scratch3DToCVEndUp);
  195919. function update7(value) {
  195920. columbusViewMorph(startPos, endPos, value.time, camera.position);
  195921. columbusViewMorph(startDir, endDir, value.time, camera.direction);
  195922. columbusViewMorph(startUp, endUp, value.time, camera.up);
  195923. Cartesian3_default.cross(camera.direction, camera.up, camera.right);
  195924. Cartesian3_default.normalize(camera.right, camera.right);
  195925. camera._adjustOrthographicFrustum(true);
  195926. }
  195927. const tween = scene.tweens.add({
  195928. duration,
  195929. easingFunction: EasingFunction_default.QUARTIC_OUT,
  195930. startObject: {
  195931. time: 0
  195932. },
  195933. stopObject: {
  195934. time: 1
  195935. },
  195936. update: update7,
  195937. complete: function() {
  195938. addMorphTimeAnimations(transitioner, scene, 1, 0, duration, complete);
  195939. }
  195940. });
  195941. transitioner._currentTweens.push(tween);
  195942. }
  195943. function addMorphTimeAnimations(transitioner, scene, start, stop2, duration, complete) {
  195944. const options = {
  195945. object: scene,
  195946. property: "morphTime",
  195947. startValue: start,
  195948. stopValue: stop2,
  195949. duration,
  195950. easingFunction: EasingFunction_default.QUARTIC_OUT
  195951. };
  195952. if (defined_default(complete)) {
  195953. options.complete = function() {
  195954. complete(transitioner);
  195955. };
  195956. }
  195957. const tween = scene.tweens.addProperty(options);
  195958. transitioner._currentTweens.push(tween);
  195959. }
  195960. function complete3DCallback(camera3D) {
  195961. return function(transitioner) {
  195962. const scene = transitioner._scene;
  195963. scene._mode = SceneMode_default.SCENE3D;
  195964. scene.morphTime = SceneMode_default.getMorphTime(SceneMode_default.SCENE3D);
  195965. destroyMorphHandler(transitioner);
  195966. const camera = scene.camera;
  195967. if (transitioner._previousMode !== SceneMode_default.MORPHING || transitioner._morphCancelled) {
  195968. transitioner._morphCancelled = false;
  195969. Cartesian3_default.clone(camera3D.position, camera.position);
  195970. Cartesian3_default.clone(camera3D.direction, camera.direction);
  195971. Cartesian3_default.clone(camera3D.up, camera.up);
  195972. Cartesian3_default.cross(camera.direction, camera.up, camera.right);
  195973. Cartesian3_default.normalize(camera.right, camera.right);
  195974. camera.frustum = camera3D.frustum.clone();
  195975. }
  195976. const frustum = camera.frustum;
  195977. if (scene.frameState.useLogDepth) {
  195978. frustum.near = 0.1;
  195979. frustum.far = 1e10;
  195980. }
  195981. const wasMorphing = defined_default(transitioner._completeMorph);
  195982. transitioner._completeMorph = void 0;
  195983. scene.camera.update(scene.mode);
  195984. transitioner._scene.morphComplete.raiseEvent(
  195985. transitioner,
  195986. transitioner._previousMode,
  195987. SceneMode_default.SCENE3D,
  195988. wasMorphing
  195989. );
  195990. };
  195991. }
  195992. function complete2DCallback(camera2D) {
  195993. return function(transitioner) {
  195994. const scene = transitioner._scene;
  195995. scene._mode = SceneMode_default.SCENE2D;
  195996. scene.morphTime = SceneMode_default.getMorphTime(SceneMode_default.SCENE2D);
  195997. destroyMorphHandler(transitioner);
  195998. const camera = scene.camera;
  195999. Cartesian3_default.clone(camera2D.position, camera.position);
  196000. camera.position.z = scene.mapProjection.ellipsoid.maximumRadius * 2;
  196001. Cartesian3_default.clone(camera2D.direction, camera.direction);
  196002. Cartesian3_default.clone(camera2D.up, camera.up);
  196003. Cartesian3_default.cross(camera.direction, camera.up, camera.right);
  196004. Cartesian3_default.normalize(camera.right, camera.right);
  196005. camera.frustum = camera2D.frustum.clone();
  196006. const wasMorphing = defined_default(transitioner._completeMorph);
  196007. transitioner._completeMorph = void 0;
  196008. scene.camera.update(scene.mode);
  196009. transitioner._scene.morphComplete.raiseEvent(
  196010. transitioner,
  196011. transitioner._previousMode,
  196012. SceneMode_default.SCENE2D,
  196013. wasMorphing
  196014. );
  196015. };
  196016. }
  196017. function completeColumbusViewCallback(cameraCV) {
  196018. return function(transitioner) {
  196019. const scene = transitioner._scene;
  196020. scene._mode = SceneMode_default.COLUMBUS_VIEW;
  196021. scene.morphTime = SceneMode_default.getMorphTime(SceneMode_default.COLUMBUS_VIEW);
  196022. destroyMorphHandler(transitioner);
  196023. const camera = scene.camera;
  196024. if (transitioner._previousModeMode !== SceneMode_default.MORPHING || transitioner._morphCancelled) {
  196025. transitioner._morphCancelled = false;
  196026. Cartesian3_default.clone(cameraCV.position, camera.position);
  196027. Cartesian3_default.clone(cameraCV.direction, camera.direction);
  196028. Cartesian3_default.clone(cameraCV.up, camera.up);
  196029. Cartesian3_default.cross(camera.direction, camera.up, camera.right);
  196030. Cartesian3_default.normalize(camera.right, camera.right);
  196031. }
  196032. const frustum = camera.frustum;
  196033. if (scene.frameState.useLogDepth) {
  196034. frustum.near = 0.1;
  196035. frustum.far = 1e10;
  196036. }
  196037. const wasMorphing = defined_default(transitioner._completeMorph);
  196038. transitioner._completeMorph = void 0;
  196039. scene.camera.update(scene.mode);
  196040. transitioner._scene.morphComplete.raiseEvent(
  196041. transitioner,
  196042. transitioner._previousMode,
  196043. SceneMode_default.COLUMBUS_VIEW,
  196044. wasMorphing
  196045. );
  196046. };
  196047. }
  196048. var SceneTransitioner_default = SceneTransitioner;
  196049. // node_modules/cesium/Source/Scene/TweenCollection.js
  196050. function Tween2(tweens, tweenjs, startObject, stopObject, duration, delay, easingFunction, update7, complete, cancel) {
  196051. this._tweens = tweens;
  196052. this._tweenjs = tweenjs;
  196053. this._startObject = clone_default(startObject);
  196054. this._stopObject = clone_default(stopObject);
  196055. this._duration = duration;
  196056. this._delay = delay;
  196057. this._easingFunction = easingFunction;
  196058. this._update = update7;
  196059. this._complete = complete;
  196060. this.cancel = cancel;
  196061. this.needsStart = true;
  196062. }
  196063. Object.defineProperties(Tween2.prototype, {
  196064. startObject: {
  196065. get: function() {
  196066. return this._startObject;
  196067. }
  196068. },
  196069. stopObject: {
  196070. get: function() {
  196071. return this._stopObject;
  196072. }
  196073. },
  196074. duration: {
  196075. get: function() {
  196076. return this._duration;
  196077. }
  196078. },
  196079. delay: {
  196080. get: function() {
  196081. return this._delay;
  196082. }
  196083. },
  196084. easingFunction: {
  196085. get: function() {
  196086. return this._easingFunction;
  196087. }
  196088. },
  196089. update: {
  196090. get: function() {
  196091. return this._update;
  196092. }
  196093. },
  196094. complete: {
  196095. get: function() {
  196096. return this._complete;
  196097. }
  196098. },
  196099. tweenjs: {
  196100. get: function() {
  196101. return this._tweenjs;
  196102. }
  196103. }
  196104. });
  196105. Tween2.prototype.cancelTween = function() {
  196106. this._tweens.remove(this);
  196107. };
  196108. function TweenCollection() {
  196109. this._tweens = [];
  196110. }
  196111. Object.defineProperties(TweenCollection.prototype, {
  196112. length: {
  196113. get: function() {
  196114. return this._tweens.length;
  196115. }
  196116. }
  196117. });
  196118. TweenCollection.prototype.add = function(options) {
  196119. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  196120. if (!defined_default(options.startObject) || !defined_default(options.stopObject)) {
  196121. throw new DeveloperError_default(
  196122. "options.startObject and options.stopObject are required."
  196123. );
  196124. }
  196125. if (!defined_default(options.duration) || options.duration < 0) {
  196126. throw new DeveloperError_default(
  196127. "options.duration is required and must be positive."
  196128. );
  196129. }
  196130. if (options.duration === 0) {
  196131. if (defined_default(options.complete)) {
  196132. options.complete();
  196133. }
  196134. return new Tween2(this);
  196135. }
  196136. const duration = options.duration / TimeConstants_default.SECONDS_PER_MILLISECOND;
  196137. const delayInSeconds = defaultValue_default(options.delay, 0);
  196138. const delay = delayInSeconds / TimeConstants_default.SECONDS_PER_MILLISECOND;
  196139. const easingFunction = defaultValue_default(
  196140. options.easingFunction,
  196141. EasingFunction_default.LINEAR_NONE
  196142. );
  196143. const value = options.startObject;
  196144. const tweenjs = new Tween.Tween(value);
  196145. tweenjs.to(clone_default(options.stopObject), duration);
  196146. tweenjs.delay(delay);
  196147. tweenjs.easing(easingFunction);
  196148. if (defined_default(options.update)) {
  196149. tweenjs.onUpdate(function() {
  196150. options.update(value);
  196151. });
  196152. }
  196153. tweenjs.onComplete(defaultValue_default(options.complete, null));
  196154. tweenjs.repeat(defaultValue_default(options._repeat, 0));
  196155. const tween = new Tween2(
  196156. this,
  196157. tweenjs,
  196158. options.startObject,
  196159. options.stopObject,
  196160. options.duration,
  196161. delayInSeconds,
  196162. easingFunction,
  196163. options.update,
  196164. options.complete,
  196165. options.cancel
  196166. );
  196167. this._tweens.push(tween);
  196168. return tween;
  196169. };
  196170. TweenCollection.prototype.addProperty = function(options) {
  196171. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  196172. const object2 = options.object;
  196173. const property = options.property;
  196174. const startValue = options.startValue;
  196175. const stopValue = options.stopValue;
  196176. if (!defined_default(object2) || !defined_default(options.property)) {
  196177. throw new DeveloperError_default(
  196178. "options.object and options.property are required."
  196179. );
  196180. }
  196181. if (!defined_default(object2[property])) {
  196182. throw new DeveloperError_default(
  196183. "options.object must have the specified property."
  196184. );
  196185. }
  196186. if (!defined_default(startValue) || !defined_default(stopValue)) {
  196187. throw new DeveloperError_default(
  196188. "options.startValue and options.stopValue are required."
  196189. );
  196190. }
  196191. function update7(value) {
  196192. object2[property] = value.value;
  196193. }
  196194. return this.add({
  196195. startObject: {
  196196. value: startValue
  196197. },
  196198. stopObject: {
  196199. value: stopValue
  196200. },
  196201. duration: defaultValue_default(options.duration, 3),
  196202. delay: options.delay,
  196203. easingFunction: options.easingFunction,
  196204. update: update7,
  196205. complete: options.complete,
  196206. cancel: options.cancel,
  196207. _repeat: options._repeat
  196208. });
  196209. };
  196210. TweenCollection.prototype.addAlpha = function(options) {
  196211. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  196212. const material = options.material;
  196213. if (!defined_default(material)) {
  196214. throw new DeveloperError_default("options.material is required.");
  196215. }
  196216. const properties = [];
  196217. for (const property in material.uniforms) {
  196218. if (material.uniforms.hasOwnProperty(property) && defined_default(material.uniforms[property]) && defined_default(material.uniforms[property].alpha)) {
  196219. properties.push(property);
  196220. }
  196221. }
  196222. if (properties.length === 0) {
  196223. throw new DeveloperError_default(
  196224. "material has no properties with alpha components."
  196225. );
  196226. }
  196227. function update7(value) {
  196228. const length3 = properties.length;
  196229. for (let i2 = 0; i2 < length3; ++i2) {
  196230. material.uniforms[properties[i2]].alpha = value.alpha;
  196231. }
  196232. }
  196233. return this.add({
  196234. startObject: {
  196235. alpha: defaultValue_default(options.startValue, 0)
  196236. },
  196237. stopObject: {
  196238. alpha: defaultValue_default(options.stopValue, 1)
  196239. },
  196240. duration: defaultValue_default(options.duration, 3),
  196241. delay: options.delay,
  196242. easingFunction: options.easingFunction,
  196243. update: update7,
  196244. complete: options.complete,
  196245. cancel: options.cancel
  196246. });
  196247. };
  196248. TweenCollection.prototype.addOffsetIncrement = function(options) {
  196249. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  196250. const material = options.material;
  196251. if (!defined_default(material)) {
  196252. throw new DeveloperError_default("material is required.");
  196253. }
  196254. if (!defined_default(material.uniforms.offset)) {
  196255. throw new DeveloperError_default("material.uniforms must have an offset property.");
  196256. }
  196257. const uniforms = material.uniforms;
  196258. return this.addProperty({
  196259. object: uniforms,
  196260. property: "offset",
  196261. startValue: uniforms.offset,
  196262. stopValue: uniforms.offset + 1,
  196263. duration: options.duration,
  196264. delay: options.delay,
  196265. easingFunction: options.easingFunction,
  196266. update: options.update,
  196267. cancel: options.cancel,
  196268. _repeat: Infinity
  196269. });
  196270. };
  196271. TweenCollection.prototype.remove = function(tween) {
  196272. if (!defined_default(tween)) {
  196273. return false;
  196274. }
  196275. const index2 = this._tweens.indexOf(tween);
  196276. if (index2 !== -1) {
  196277. tween.tweenjs.stop();
  196278. if (defined_default(tween.cancel)) {
  196279. tween.cancel();
  196280. }
  196281. this._tweens.splice(index2, 1);
  196282. return true;
  196283. }
  196284. return false;
  196285. };
  196286. TweenCollection.prototype.removeAll = function() {
  196287. const tweens = this._tweens;
  196288. for (let i2 = 0; i2 < tweens.length; ++i2) {
  196289. const tween = tweens[i2];
  196290. tween.tweenjs.stop();
  196291. if (defined_default(tween.cancel)) {
  196292. tween.cancel();
  196293. }
  196294. }
  196295. tweens.length = 0;
  196296. };
  196297. TweenCollection.prototype.contains = function(tween) {
  196298. return defined_default(tween) && this._tweens.indexOf(tween) !== -1;
  196299. };
  196300. TweenCollection.prototype.get = function(index2) {
  196301. if (!defined_default(index2)) {
  196302. throw new DeveloperError_default("index is required.");
  196303. }
  196304. return this._tweens[index2];
  196305. };
  196306. TweenCollection.prototype.update = function(time) {
  196307. const tweens = this._tweens;
  196308. let i2 = 0;
  196309. time = defined_default(time) ? time / TimeConstants_default.SECONDS_PER_MILLISECOND : getTimestamp_default();
  196310. while (i2 < tweens.length) {
  196311. const tween = tweens[i2];
  196312. const tweenjs = tween.tweenjs;
  196313. if (tween.needsStart) {
  196314. tween.needsStart = false;
  196315. tweenjs.start(time);
  196316. } else if (tweenjs.update(time)) {
  196317. i2++;
  196318. } else {
  196319. tweenjs.stop();
  196320. tweens.splice(i2, 1);
  196321. }
  196322. }
  196323. };
  196324. var TweenCollection_default = TweenCollection;
  196325. // node_modules/cesium/Source/Scene/ScreenSpaceCameraController.js
  196326. function ScreenSpaceCameraController(scene) {
  196327. if (!defined_default(scene)) {
  196328. throw new DeveloperError_default("scene is required.");
  196329. }
  196330. this.enableInputs = true;
  196331. this.enableTranslate = true;
  196332. this.enableZoom = true;
  196333. this.enableRotate = true;
  196334. this.enableTilt = true;
  196335. this.enableLook = true;
  196336. this.inertiaSpin = 0.9;
  196337. this.inertiaTranslate = 0.9;
  196338. this.inertiaZoom = 0.8;
  196339. this.maximumMovementRatio = 0.1;
  196340. this.bounceAnimationTime = 3;
  196341. this.minimumZoomDistance = 1;
  196342. this.maximumZoomDistance = Number.POSITIVE_INFINITY;
  196343. this.translateEventTypes = CameraEventType_default.LEFT_DRAG;
  196344. this.zoomEventTypes = [
  196345. CameraEventType_default.RIGHT_DRAG,
  196346. CameraEventType_default.WHEEL,
  196347. CameraEventType_default.PINCH
  196348. ];
  196349. this.rotateEventTypes = CameraEventType_default.LEFT_DRAG;
  196350. this.tiltEventTypes = [
  196351. CameraEventType_default.MIDDLE_DRAG,
  196352. CameraEventType_default.PINCH,
  196353. {
  196354. eventType: CameraEventType_default.LEFT_DRAG,
  196355. modifier: KeyboardEventModifier_default.CTRL
  196356. },
  196357. {
  196358. eventType: CameraEventType_default.RIGHT_DRAG,
  196359. modifier: KeyboardEventModifier_default.CTRL
  196360. }
  196361. ];
  196362. this.lookEventTypes = {
  196363. eventType: CameraEventType_default.LEFT_DRAG,
  196364. modifier: KeyboardEventModifier_default.SHIFT
  196365. };
  196366. this.minimumPickingTerrainHeight = 15e4;
  196367. this._minimumPickingTerrainHeight = this.minimumPickingTerrainHeight;
  196368. this.minimumCollisionTerrainHeight = 15e3;
  196369. this._minimumCollisionTerrainHeight = this.minimumCollisionTerrainHeight;
  196370. this.minimumTrackBallHeight = 75e5;
  196371. this._minimumTrackBallHeight = this.minimumTrackBallHeight;
  196372. this.enableCollisionDetection = true;
  196373. this._scene = scene;
  196374. this._globe = void 0;
  196375. this._ellipsoid = void 0;
  196376. this._aggregator = new CameraEventAggregator_default(scene.canvas);
  196377. this._lastInertiaSpinMovement = void 0;
  196378. this._lastInertiaZoomMovement = void 0;
  196379. this._lastInertiaTranslateMovement = void 0;
  196380. this._lastInertiaTiltMovement = void 0;
  196381. this._inertiaDisablers = {
  196382. _lastInertiaZoomMovement: [
  196383. "_lastInertiaSpinMovement",
  196384. "_lastInertiaTranslateMovement",
  196385. "_lastInertiaTiltMovement"
  196386. ],
  196387. _lastInertiaTiltMovement: [
  196388. "_lastInertiaSpinMovement",
  196389. "_lastInertiaTranslateMovement"
  196390. ]
  196391. };
  196392. this._tweens = new TweenCollection_default();
  196393. this._tween = void 0;
  196394. this._horizontalRotationAxis = void 0;
  196395. this._tiltCenterMousePosition = new Cartesian2_default(-1, -1);
  196396. this._tiltCenter = new Cartesian3_default();
  196397. this._rotateMousePosition = new Cartesian2_default(-1, -1);
  196398. this._rotateStartPosition = new Cartesian3_default();
  196399. this._strafeStartPosition = new Cartesian3_default();
  196400. this._strafeMousePosition = new Cartesian2_default();
  196401. this._strafeEndMousePosition = new Cartesian2_default();
  196402. this._zoomMouseStart = new Cartesian2_default(-1, -1);
  196403. this._zoomWorldPosition = new Cartesian3_default();
  196404. this._useZoomWorldPosition = false;
  196405. this._tiltCVOffMap = false;
  196406. this._looking = false;
  196407. this._rotating = false;
  196408. this._strafing = false;
  196409. this._zoomingOnVector = false;
  196410. this._zoomingUnderground = false;
  196411. this._rotatingZoom = false;
  196412. this._adjustedHeightForTerrain = false;
  196413. this._cameraUnderground = false;
  196414. const projection = scene.mapProjection;
  196415. this._maxCoord = projection.project(
  196416. new Cartographic_default(Math.PI, Math_default.PI_OVER_TWO)
  196417. );
  196418. this._zoomFactor = 5;
  196419. this._rotateFactor = void 0;
  196420. this._rotateRateRangeAdjustment = void 0;
  196421. this._maximumRotateRate = 1.77;
  196422. this._minimumRotateRate = 1 / 5e3;
  196423. this._minimumZoomRate = 20;
  196424. this._maximumZoomRate = 5906376272e3;
  196425. this._minimumUndergroundPickDistance = 2e3;
  196426. this._maximumUndergroundPickDistance = 1e4;
  196427. }
  196428. function decay(time, coefficient) {
  196429. if (time < 0) {
  196430. return 0;
  196431. }
  196432. const tau = (1 - coefficient) * 25;
  196433. return Math.exp(-tau * time);
  196434. }
  196435. function sameMousePosition(movement) {
  196436. return Cartesian2_default.equalsEpsilon(
  196437. movement.startPosition,
  196438. movement.endPosition,
  196439. Math_default.EPSILON14
  196440. );
  196441. }
  196442. var inertiaMaxClickTimeThreshold = 0.4;
  196443. function maintainInertia(aggregator, type, modifier, decayCoef, action, object2, lastMovementName) {
  196444. let movementState = object2[lastMovementName];
  196445. if (!defined_default(movementState)) {
  196446. movementState = object2[lastMovementName] = {
  196447. startPosition: new Cartesian2_default(),
  196448. endPosition: new Cartesian2_default(),
  196449. motion: new Cartesian2_default(),
  196450. inertiaEnabled: true
  196451. };
  196452. }
  196453. const ts = aggregator.getButtonPressTime(type, modifier);
  196454. const tr = aggregator.getButtonReleaseTime(type, modifier);
  196455. const threshold = ts && tr && (tr.getTime() - ts.getTime()) / 1e3;
  196456. const now = new Date();
  196457. const fromNow = tr && (now.getTime() - tr.getTime()) / 1e3;
  196458. if (ts && tr && threshold < inertiaMaxClickTimeThreshold) {
  196459. const d = decay(fromNow, decayCoef);
  196460. const lastMovement = aggregator.getLastMovement(type, modifier);
  196461. if (!defined_default(lastMovement) || sameMousePosition(lastMovement) || !movementState.inertiaEnabled) {
  196462. return;
  196463. }
  196464. movementState.motion.x = (lastMovement.endPosition.x - lastMovement.startPosition.x) * 0.5;
  196465. movementState.motion.y = (lastMovement.endPosition.y - lastMovement.startPosition.y) * 0.5;
  196466. movementState.startPosition = Cartesian2_default.clone(
  196467. lastMovement.startPosition,
  196468. movementState.startPosition
  196469. );
  196470. movementState.endPosition = Cartesian2_default.multiplyByScalar(
  196471. movementState.motion,
  196472. d,
  196473. movementState.endPosition
  196474. );
  196475. movementState.endPosition = Cartesian2_default.add(
  196476. movementState.startPosition,
  196477. movementState.endPosition,
  196478. movementState.endPosition
  196479. );
  196480. if (isNaN(movementState.endPosition.x) || isNaN(movementState.endPosition.y) || Cartesian2_default.distance(
  196481. movementState.startPosition,
  196482. movementState.endPosition
  196483. ) < 0.5) {
  196484. return;
  196485. }
  196486. if (!aggregator.isButtonDown(type, modifier)) {
  196487. const startPosition = aggregator.getStartMousePosition(type, modifier);
  196488. action(object2, startPosition, movementState);
  196489. }
  196490. }
  196491. }
  196492. function activateInertia(controller, inertiaStateName) {
  196493. if (defined_default(inertiaStateName)) {
  196494. let movementState = controller[inertiaStateName];
  196495. if (defined_default(movementState)) {
  196496. movementState.inertiaEnabled = true;
  196497. }
  196498. const inertiasToDisable = controller._inertiaDisablers[inertiaStateName];
  196499. if (defined_default(inertiasToDisable)) {
  196500. const length3 = inertiasToDisable.length;
  196501. for (let i2 = 0; i2 < length3; ++i2) {
  196502. movementState = controller[inertiasToDisable[i2]];
  196503. if (defined_default(movementState)) {
  196504. movementState.inertiaEnabled = false;
  196505. }
  196506. }
  196507. }
  196508. }
  196509. }
  196510. var scratchEventTypeArray = [];
  196511. function reactToInput(controller, enabled, eventTypes, action, inertiaConstant, inertiaStateName) {
  196512. if (!defined_default(eventTypes)) {
  196513. return;
  196514. }
  196515. const aggregator = controller._aggregator;
  196516. if (!Array.isArray(eventTypes)) {
  196517. scratchEventTypeArray[0] = eventTypes;
  196518. eventTypes = scratchEventTypeArray;
  196519. }
  196520. const length3 = eventTypes.length;
  196521. for (let i2 = 0; i2 < length3; ++i2) {
  196522. const eventType = eventTypes[i2];
  196523. const type = defined_default(eventType.eventType) ? eventType.eventType : eventType;
  196524. const modifier = eventType.modifier;
  196525. const movement = aggregator.isMoving(type, modifier) && aggregator.getMovement(type, modifier);
  196526. const startPosition = aggregator.getStartMousePosition(type, modifier);
  196527. if (controller.enableInputs && enabled) {
  196528. if (movement) {
  196529. action(controller, startPosition, movement);
  196530. activateInertia(controller, inertiaStateName);
  196531. } else if (inertiaConstant < 1) {
  196532. maintainInertia(
  196533. aggregator,
  196534. type,
  196535. modifier,
  196536. inertiaConstant,
  196537. action,
  196538. controller,
  196539. inertiaStateName
  196540. );
  196541. }
  196542. }
  196543. }
  196544. }
  196545. var scratchZoomPickRay = new Ray_default();
  196546. var scratchPickCartesian = new Cartesian3_default();
  196547. var scratchZoomOffset = new Cartesian2_default();
  196548. var scratchZoomDirection = new Cartesian3_default();
  196549. var scratchCenterPixel = new Cartesian2_default();
  196550. var scratchCenterPosition = new Cartesian3_default();
  196551. var scratchPositionNormal3 = new Cartesian3_default();
  196552. var scratchPickNormal = new Cartesian3_default();
  196553. var scratchZoomAxis = new Cartesian3_default();
  196554. var scratchCameraPositionNormal = new Cartesian3_default();
  196555. var scratchTargetNormal = new Cartesian3_default();
  196556. var scratchCameraPosition2 = new Cartesian3_default();
  196557. var scratchCameraUpNormal = new Cartesian3_default();
  196558. var scratchCameraRightNormal = new Cartesian3_default();
  196559. var scratchForwardNormal = new Cartesian3_default();
  196560. var scratchPositionToTarget = new Cartesian3_default();
  196561. var scratchPositionToTargetNormal = new Cartesian3_default();
  196562. var scratchPan = new Cartesian3_default();
  196563. var scratchCenterMovement = new Cartesian3_default();
  196564. var scratchCenter9 = new Cartesian3_default();
  196565. var scratchCartesian31 = new Cartesian3_default();
  196566. var scratchCartesianTwo = new Cartesian3_default();
  196567. var scratchCartesianThree = new Cartesian3_default();
  196568. var scratchZoomViewOptions = {
  196569. orientation: new HeadingPitchRoll_default()
  196570. };
  196571. function handleZoom(object2, startPosition, movement, zoomFactor, distanceMeasure, unitPositionDotDirection) {
  196572. let percentage = 1;
  196573. if (defined_default(unitPositionDotDirection)) {
  196574. percentage = Math_default.clamp(
  196575. Math.abs(unitPositionDotDirection),
  196576. 0.25,
  196577. 1
  196578. );
  196579. }
  196580. const diff = movement.endPosition.y - movement.startPosition.y;
  196581. const approachingSurface = diff > 0;
  196582. const minHeight = approachingSurface ? object2.minimumZoomDistance * percentage : 0;
  196583. const maxHeight = object2.maximumZoomDistance;
  196584. const minDistance = distanceMeasure - minHeight;
  196585. let zoomRate = zoomFactor * minDistance;
  196586. zoomRate = Math_default.clamp(
  196587. zoomRate,
  196588. object2._minimumZoomRate,
  196589. object2._maximumZoomRate
  196590. );
  196591. let rangeWindowRatio = diff / object2._scene.canvas.clientHeight;
  196592. rangeWindowRatio = Math.min(rangeWindowRatio, object2.maximumMovementRatio);
  196593. let distance2 = zoomRate * rangeWindowRatio;
  196594. if (object2.enableCollisionDetection || object2.minimumZoomDistance === 0 || !defined_default(object2._globe)) {
  196595. if (distance2 > 0 && Math.abs(distanceMeasure - minHeight) < 1) {
  196596. return;
  196597. }
  196598. if (distance2 < 0 && Math.abs(distanceMeasure - maxHeight) < 1) {
  196599. return;
  196600. }
  196601. if (distanceMeasure - distance2 < minHeight) {
  196602. distance2 = distanceMeasure - minHeight - 1;
  196603. } else if (distanceMeasure - distance2 > maxHeight) {
  196604. distance2 = distanceMeasure - maxHeight;
  196605. }
  196606. }
  196607. const scene = object2._scene;
  196608. const camera = scene.camera;
  196609. const mode2 = scene.mode;
  196610. const orientation = scratchZoomViewOptions.orientation;
  196611. orientation.heading = camera.heading;
  196612. orientation.pitch = camera.pitch;
  196613. orientation.roll = camera.roll;
  196614. if (camera.frustum instanceof OrthographicFrustum_default) {
  196615. if (Math.abs(distance2) > 0) {
  196616. camera.zoomIn(distance2);
  196617. camera._adjustOrthographicFrustum();
  196618. }
  196619. return;
  196620. }
  196621. const sameStartPosition = Cartesian2_default.equals(
  196622. startPosition,
  196623. object2._zoomMouseStart
  196624. );
  196625. let zoomingOnVector = object2._zoomingOnVector;
  196626. let rotatingZoom = object2._rotatingZoom;
  196627. let pickedPosition;
  196628. if (!sameStartPosition) {
  196629. object2._zoomMouseStart = Cartesian2_default.clone(
  196630. startPosition,
  196631. object2._zoomMouseStart
  196632. );
  196633. if (defined_default(object2._globe)) {
  196634. if (mode2 === SceneMode_default.SCENE2D) {
  196635. pickedPosition = camera.getPickRay(startPosition, scratchZoomPickRay).origin;
  196636. pickedPosition = Cartesian3_default.fromElements(
  196637. pickedPosition.y,
  196638. pickedPosition.z,
  196639. pickedPosition.x
  196640. );
  196641. } else {
  196642. pickedPosition = pickGlobe(object2, startPosition, scratchPickCartesian);
  196643. }
  196644. }
  196645. if (defined_default(pickedPosition)) {
  196646. object2._useZoomWorldPosition = true;
  196647. object2._zoomWorldPosition = Cartesian3_default.clone(
  196648. pickedPosition,
  196649. object2._zoomWorldPosition
  196650. );
  196651. } else {
  196652. object2._useZoomWorldPosition = false;
  196653. }
  196654. zoomingOnVector = object2._zoomingOnVector = false;
  196655. rotatingZoom = object2._rotatingZoom = false;
  196656. object2._zoomingUnderground = object2._cameraUnderground;
  196657. }
  196658. if (!object2._useZoomWorldPosition) {
  196659. camera.zoomIn(distance2);
  196660. return;
  196661. }
  196662. let zoomOnVector = mode2 === SceneMode_default.COLUMBUS_VIEW;
  196663. if (camera.positionCartographic.height < 2e6) {
  196664. rotatingZoom = true;
  196665. }
  196666. if (!sameStartPosition || rotatingZoom) {
  196667. if (mode2 === SceneMode_default.SCENE2D) {
  196668. const worldPosition = object2._zoomWorldPosition;
  196669. const endPosition = camera.position;
  196670. if (!Cartesian3_default.equals(worldPosition, endPosition) && camera.positionCartographic.height < object2._maxCoord.x * 2) {
  196671. const savedX = camera.position.x;
  196672. const direction2 = Cartesian3_default.subtract(
  196673. worldPosition,
  196674. endPosition,
  196675. scratchZoomDirection
  196676. );
  196677. Cartesian3_default.normalize(direction2, direction2);
  196678. const d = Cartesian3_default.distance(worldPosition, endPosition) * distance2 / (camera.getMagnitude() * 0.5);
  196679. camera.move(direction2, d * 0.5);
  196680. if (camera.position.x < 0 && savedX > 0 || camera.position.x > 0 && savedX < 0) {
  196681. pickedPosition = camera.getPickRay(startPosition, scratchZoomPickRay).origin;
  196682. pickedPosition = Cartesian3_default.fromElements(
  196683. pickedPosition.y,
  196684. pickedPosition.z,
  196685. pickedPosition.x
  196686. );
  196687. object2._zoomWorldPosition = Cartesian3_default.clone(
  196688. pickedPosition,
  196689. object2._zoomWorldPosition
  196690. );
  196691. }
  196692. }
  196693. } else if (mode2 === SceneMode_default.SCENE3D) {
  196694. const cameraPositionNormal = Cartesian3_default.normalize(
  196695. camera.position,
  196696. scratchCameraPositionNormal
  196697. );
  196698. if (object2._cameraUnderground || object2._zoomingUnderground || camera.positionCartographic.height < 3e3 && Math.abs(Cartesian3_default.dot(camera.direction, cameraPositionNormal)) < 0.6) {
  196699. zoomOnVector = true;
  196700. } else {
  196701. const canvas = scene.canvas;
  196702. const centerPixel = scratchCenterPixel;
  196703. centerPixel.x = canvas.clientWidth / 2;
  196704. centerPixel.y = canvas.clientHeight / 2;
  196705. const centerPosition = pickGlobe(
  196706. object2,
  196707. centerPixel,
  196708. scratchCenterPosition
  196709. );
  196710. if (!defined_default(centerPosition)) {
  196711. zoomOnVector = true;
  196712. } else if (camera.positionCartographic.height < 1e6) {
  196713. if (Cartesian3_default.dot(camera.direction, cameraPositionNormal) >= -0.5) {
  196714. zoomOnVector = true;
  196715. } else {
  196716. const cameraPosition = scratchCameraPosition2;
  196717. Cartesian3_default.clone(camera.position, cameraPosition);
  196718. const target = object2._zoomWorldPosition;
  196719. let targetNormal = scratchTargetNormal;
  196720. targetNormal = Cartesian3_default.normalize(target, targetNormal);
  196721. if (Cartesian3_default.dot(targetNormal, cameraPositionNormal) < 0) {
  196722. return;
  196723. }
  196724. const center = scratchCenter9;
  196725. const forward = scratchForwardNormal;
  196726. Cartesian3_default.clone(camera.direction, forward);
  196727. Cartesian3_default.add(
  196728. cameraPosition,
  196729. Cartesian3_default.multiplyByScalar(forward, 1e3, scratchCartesian31),
  196730. center
  196731. );
  196732. const positionToTarget = scratchPositionToTarget;
  196733. const positionToTargetNormal = scratchPositionToTargetNormal;
  196734. Cartesian3_default.subtract(target, cameraPosition, positionToTarget);
  196735. Cartesian3_default.normalize(positionToTarget, positionToTargetNormal);
  196736. const alphaDot = Cartesian3_default.dot(
  196737. cameraPositionNormal,
  196738. positionToTargetNormal
  196739. );
  196740. if (alphaDot >= 0) {
  196741. object2._zoomMouseStart.x = -1;
  196742. return;
  196743. }
  196744. const alpha = Math.acos(-alphaDot);
  196745. const cameraDistance = Cartesian3_default.magnitude(cameraPosition);
  196746. const targetDistance = Cartesian3_default.magnitude(target);
  196747. const remainingDistance = cameraDistance - distance2;
  196748. const positionToTargetDistance = Cartesian3_default.magnitude(
  196749. positionToTarget
  196750. );
  196751. const gamma = Math.asin(
  196752. Math_default.clamp(
  196753. positionToTargetDistance / targetDistance * Math.sin(alpha),
  196754. -1,
  196755. 1
  196756. )
  196757. );
  196758. const delta = Math.asin(
  196759. Math_default.clamp(
  196760. remainingDistance / targetDistance * Math.sin(alpha),
  196761. -1,
  196762. 1
  196763. )
  196764. );
  196765. const beta = gamma - delta + alpha;
  196766. const up = scratchCameraUpNormal;
  196767. Cartesian3_default.normalize(cameraPosition, up);
  196768. let right = scratchCameraRightNormal;
  196769. right = Cartesian3_default.cross(positionToTargetNormal, up, right);
  196770. right = Cartesian3_default.normalize(right, right);
  196771. Cartesian3_default.normalize(
  196772. Cartesian3_default.cross(up, right, scratchCartesian31),
  196773. forward
  196774. );
  196775. Cartesian3_default.multiplyByScalar(
  196776. Cartesian3_default.normalize(center, scratchCartesian31),
  196777. Cartesian3_default.magnitude(center) - distance2,
  196778. center
  196779. );
  196780. Cartesian3_default.normalize(cameraPosition, cameraPosition);
  196781. Cartesian3_default.multiplyByScalar(
  196782. cameraPosition,
  196783. remainingDistance,
  196784. cameraPosition
  196785. );
  196786. const pMid = scratchPan;
  196787. Cartesian3_default.multiplyByScalar(
  196788. Cartesian3_default.add(
  196789. Cartesian3_default.multiplyByScalar(
  196790. up,
  196791. Math.cos(beta) - 1,
  196792. scratchCartesianTwo
  196793. ),
  196794. Cartesian3_default.multiplyByScalar(
  196795. forward,
  196796. Math.sin(beta),
  196797. scratchCartesianThree
  196798. ),
  196799. scratchCartesian31
  196800. ),
  196801. remainingDistance,
  196802. pMid
  196803. );
  196804. Cartesian3_default.add(cameraPosition, pMid, cameraPosition);
  196805. Cartesian3_default.normalize(center, up);
  196806. Cartesian3_default.normalize(
  196807. Cartesian3_default.cross(up, right, scratchCartesian31),
  196808. forward
  196809. );
  196810. const cMid = scratchCenterMovement;
  196811. Cartesian3_default.multiplyByScalar(
  196812. Cartesian3_default.add(
  196813. Cartesian3_default.multiplyByScalar(
  196814. up,
  196815. Math.cos(beta) - 1,
  196816. scratchCartesianTwo
  196817. ),
  196818. Cartesian3_default.multiplyByScalar(
  196819. forward,
  196820. Math.sin(beta),
  196821. scratchCartesianThree
  196822. ),
  196823. scratchCartesian31
  196824. ),
  196825. Cartesian3_default.magnitude(center),
  196826. cMid
  196827. );
  196828. Cartesian3_default.add(center, cMid, center);
  196829. Cartesian3_default.clone(cameraPosition, camera.position);
  196830. Cartesian3_default.normalize(
  196831. Cartesian3_default.subtract(center, cameraPosition, scratchCartesian31),
  196832. camera.direction
  196833. );
  196834. Cartesian3_default.clone(camera.direction, camera.direction);
  196835. Cartesian3_default.cross(camera.direction, camera.up, camera.right);
  196836. Cartesian3_default.cross(camera.right, camera.direction, camera.up);
  196837. camera.setView(scratchZoomViewOptions);
  196838. return;
  196839. }
  196840. } else {
  196841. const positionNormal = Cartesian3_default.normalize(
  196842. centerPosition,
  196843. scratchPositionNormal3
  196844. );
  196845. const pickedNormal = Cartesian3_default.normalize(
  196846. object2._zoomWorldPosition,
  196847. scratchPickNormal
  196848. );
  196849. const dotProduct = Cartesian3_default.dot(pickedNormal, positionNormal);
  196850. if (dotProduct > 0 && dotProduct < 1) {
  196851. const angle = Math_default.acosClamped(dotProduct);
  196852. const axis = Cartesian3_default.cross(
  196853. pickedNormal,
  196854. positionNormal,
  196855. scratchZoomAxis
  196856. );
  196857. const denom = Math.abs(angle) > Math_default.toRadians(20) ? camera.positionCartographic.height * 0.75 : camera.positionCartographic.height - distance2;
  196858. const scalar = distance2 / denom;
  196859. camera.rotate(axis, angle * scalar);
  196860. }
  196861. }
  196862. }
  196863. }
  196864. object2._rotatingZoom = !zoomOnVector;
  196865. }
  196866. if (!sameStartPosition && zoomOnVector || zoomingOnVector) {
  196867. let ray;
  196868. const zoomMouseStart = SceneTransforms_default.wgs84ToWindowCoordinates(
  196869. scene,
  196870. object2._zoomWorldPosition,
  196871. scratchZoomOffset
  196872. );
  196873. if (mode2 !== SceneMode_default.COLUMBUS_VIEW && Cartesian2_default.equals(startPosition, object2._zoomMouseStart) && defined_default(zoomMouseStart)) {
  196874. ray = camera.getPickRay(zoomMouseStart, scratchZoomPickRay);
  196875. } else {
  196876. ray = camera.getPickRay(startPosition, scratchZoomPickRay);
  196877. }
  196878. const rayDirection = ray.direction;
  196879. if (mode2 === SceneMode_default.COLUMBUS_VIEW || mode2 === SceneMode_default.SCENE2D) {
  196880. Cartesian3_default.fromElements(
  196881. rayDirection.y,
  196882. rayDirection.z,
  196883. rayDirection.x,
  196884. rayDirection
  196885. );
  196886. }
  196887. camera.move(rayDirection, distance2);
  196888. object2._zoomingOnVector = true;
  196889. } else {
  196890. camera.zoomIn(distance2);
  196891. }
  196892. if (!object2._cameraUnderground) {
  196893. camera.setView(scratchZoomViewOptions);
  196894. }
  196895. }
  196896. var translate2DStart = new Ray_default();
  196897. var translate2DEnd = new Ray_default();
  196898. var scratchTranslateP0 = new Cartesian3_default();
  196899. function translate2D(controller, startPosition, movement) {
  196900. const scene = controller._scene;
  196901. const camera = scene.camera;
  196902. let start = camera.getPickRay(movement.startPosition, translate2DStart).origin;
  196903. let end = camera.getPickRay(movement.endPosition, translate2DEnd).origin;
  196904. start = Cartesian3_default.fromElements(start.y, start.z, start.x, start);
  196905. end = Cartesian3_default.fromElements(end.y, end.z, end.x, end);
  196906. const direction2 = Cartesian3_default.subtract(start, end, scratchTranslateP0);
  196907. const distance2 = Cartesian3_default.magnitude(direction2);
  196908. if (distance2 > 0) {
  196909. Cartesian3_default.normalize(direction2, direction2);
  196910. camera.move(direction2, distance2);
  196911. }
  196912. }
  196913. function zoom2D2(controller, startPosition, movement) {
  196914. if (defined_default(movement.distance)) {
  196915. movement = movement.distance;
  196916. }
  196917. const scene = controller._scene;
  196918. const camera = scene.camera;
  196919. handleZoom(
  196920. controller,
  196921. startPosition,
  196922. movement,
  196923. controller._zoomFactor,
  196924. camera.getMagnitude()
  196925. );
  196926. }
  196927. var twist2DStart = new Cartesian2_default();
  196928. var twist2DEnd = new Cartesian2_default();
  196929. function twist2D(controller, startPosition, movement) {
  196930. if (defined_default(movement.angleAndHeight)) {
  196931. singleAxisTwist2D(controller, startPosition, movement.angleAndHeight);
  196932. return;
  196933. }
  196934. const scene = controller._scene;
  196935. const camera = scene.camera;
  196936. const canvas = scene.canvas;
  196937. const width = canvas.clientWidth;
  196938. const height = canvas.clientHeight;
  196939. let start = twist2DStart;
  196940. start.x = 2 / width * movement.startPosition.x - 1;
  196941. start.y = 2 / height * (height - movement.startPosition.y) - 1;
  196942. start = Cartesian2_default.normalize(start, start);
  196943. let end = twist2DEnd;
  196944. end.x = 2 / width * movement.endPosition.x - 1;
  196945. end.y = 2 / height * (height - movement.endPosition.y) - 1;
  196946. end = Cartesian2_default.normalize(end, end);
  196947. let startTheta = Math_default.acosClamped(start.x);
  196948. if (start.y < 0) {
  196949. startTheta = Math_default.TWO_PI - startTheta;
  196950. }
  196951. let endTheta = Math_default.acosClamped(end.x);
  196952. if (end.y < 0) {
  196953. endTheta = Math_default.TWO_PI - endTheta;
  196954. }
  196955. const theta = endTheta - startTheta;
  196956. camera.twistRight(theta);
  196957. }
  196958. function singleAxisTwist2D(controller, startPosition, movement) {
  196959. let rotateRate = controller._rotateFactor * controller._rotateRateRangeAdjustment;
  196960. if (rotateRate > controller._maximumRotateRate) {
  196961. rotateRate = controller._maximumRotateRate;
  196962. }
  196963. if (rotateRate < controller._minimumRotateRate) {
  196964. rotateRate = controller._minimumRotateRate;
  196965. }
  196966. const scene = controller._scene;
  196967. const camera = scene.camera;
  196968. const canvas = scene.canvas;
  196969. let phiWindowRatio = (movement.endPosition.x - movement.startPosition.x) / canvas.clientWidth;
  196970. phiWindowRatio = Math.min(phiWindowRatio, controller.maximumMovementRatio);
  196971. const deltaPhi = rotateRate * phiWindowRatio * Math.PI * 4;
  196972. camera.twistRight(deltaPhi);
  196973. }
  196974. function update2D(controller) {
  196975. const rotatable2D = controller._scene.mapMode2D === MapMode2D_default.ROTATE;
  196976. if (!Matrix4_default.equals(Matrix4_default.IDENTITY, controller._scene.camera.transform)) {
  196977. reactToInput(
  196978. controller,
  196979. controller.enableZoom,
  196980. controller.zoomEventTypes,
  196981. zoom2D2,
  196982. controller.inertiaZoom,
  196983. "_lastInertiaZoomMovement"
  196984. );
  196985. if (rotatable2D) {
  196986. reactToInput(
  196987. controller,
  196988. controller.enableRotate,
  196989. controller.translateEventTypes,
  196990. twist2D,
  196991. controller.inertiaSpin,
  196992. "_lastInertiaSpinMovement"
  196993. );
  196994. }
  196995. } else {
  196996. reactToInput(
  196997. controller,
  196998. controller.enableTranslate,
  196999. controller.translateEventTypes,
  197000. translate2D,
  197001. controller.inertiaTranslate,
  197002. "_lastInertiaTranslateMovement"
  197003. );
  197004. reactToInput(
  197005. controller,
  197006. controller.enableZoom,
  197007. controller.zoomEventTypes,
  197008. zoom2D2,
  197009. controller.inertiaZoom,
  197010. "_lastInertiaZoomMovement"
  197011. );
  197012. if (rotatable2D) {
  197013. reactToInput(
  197014. controller,
  197015. controller.enableRotate,
  197016. controller.tiltEventTypes,
  197017. twist2D,
  197018. controller.inertiaSpin,
  197019. "_lastInertiaTiltMovement"
  197020. );
  197021. }
  197022. }
  197023. }
  197024. var pickGlobeScratchRay = new Ray_default();
  197025. var scratchDepthIntersection2 = new Cartesian3_default();
  197026. var scratchRayIntersection2 = new Cartesian3_default();
  197027. function pickGlobe(controller, mousePosition, result) {
  197028. const scene = controller._scene;
  197029. const globe = controller._globe;
  197030. const camera = scene.camera;
  197031. if (!defined_default(globe)) {
  197032. return void 0;
  197033. }
  197034. const cullBackFaces = !controller._cameraUnderground;
  197035. let depthIntersection;
  197036. if (scene.pickPositionSupported) {
  197037. depthIntersection = scene.pickPositionWorldCoordinates(
  197038. mousePosition,
  197039. scratchDepthIntersection2
  197040. );
  197041. }
  197042. const ray = camera.getPickRay(mousePosition, pickGlobeScratchRay);
  197043. const rayIntersection = globe.pickWorldCoordinates(
  197044. ray,
  197045. scene,
  197046. cullBackFaces,
  197047. scratchRayIntersection2
  197048. );
  197049. const pickDistance = defined_default(depthIntersection) ? Cartesian3_default.distance(depthIntersection, camera.positionWC) : Number.POSITIVE_INFINITY;
  197050. const rayDistance = defined_default(rayIntersection) ? Cartesian3_default.distance(rayIntersection, camera.positionWC) : Number.POSITIVE_INFINITY;
  197051. if (pickDistance < rayDistance) {
  197052. return Cartesian3_default.clone(depthIntersection, result);
  197053. }
  197054. return Cartesian3_default.clone(rayIntersection, result);
  197055. }
  197056. var scratchDistanceCartographic = new Cartographic_default();
  197057. function getDistanceFromSurface(controller) {
  197058. const ellipsoid = controller._ellipsoid;
  197059. const scene = controller._scene;
  197060. const camera = scene.camera;
  197061. const mode2 = scene.mode;
  197062. let height = 0;
  197063. if (mode2 === SceneMode_default.SCENE3D) {
  197064. const cartographic2 = ellipsoid.cartesianToCartographic(
  197065. camera.position,
  197066. scratchDistanceCartographic
  197067. );
  197068. if (defined_default(cartographic2)) {
  197069. height = cartographic2.height;
  197070. }
  197071. } else {
  197072. height = camera.position.z;
  197073. }
  197074. const globeHeight = defaultValue_default(controller._scene.globeHeight, 0);
  197075. const distanceFromSurface = Math.abs(globeHeight - height);
  197076. return distanceFromSurface;
  197077. }
  197078. var scratchSurfaceNormal2 = new Cartesian3_default();
  197079. function getZoomDistanceUnderground(controller, ray) {
  197080. const origin = ray.origin;
  197081. const direction2 = ray.direction;
  197082. const distanceFromSurface = getDistanceFromSurface(controller);
  197083. const surfaceNormal = Cartesian3_default.normalize(origin, scratchSurfaceNormal2);
  197084. let strength = Math.abs(Cartesian3_default.dot(surfaceNormal, direction2));
  197085. strength = Math.max(strength, 0.5) * 2;
  197086. return distanceFromSurface * strength;
  197087. }
  197088. function getTiltCenterUnderground(controller, ray, pickedPosition, result) {
  197089. let distance2 = Cartesian3_default.distance(ray.origin, pickedPosition);
  197090. const distanceFromSurface = getDistanceFromSurface(controller);
  197091. const maximumDistance = Math_default.clamp(
  197092. distanceFromSurface * 5,
  197093. controller._minimumUndergroundPickDistance,
  197094. controller._maximumUndergroundPickDistance
  197095. );
  197096. if (distance2 > maximumDistance) {
  197097. distance2 = Math.min(distance2, distanceFromSurface / 5);
  197098. distance2 = Math.max(distance2, 100);
  197099. }
  197100. return Ray_default.getPoint(ray, distance2, result);
  197101. }
  197102. function getStrafeStartPositionUnderground(controller, ray, pickedPosition, result) {
  197103. let distance2;
  197104. if (!defined_default(pickedPosition)) {
  197105. distance2 = getDistanceFromSurface(controller);
  197106. } else {
  197107. distance2 = Cartesian3_default.distance(ray.origin, pickedPosition);
  197108. if (distance2 > controller._maximumUndergroundPickDistance) {
  197109. distance2 = getDistanceFromSurface(controller);
  197110. }
  197111. }
  197112. return Ray_default.getPoint(ray, distance2, result);
  197113. }
  197114. var scratchInertialDelta = new Cartesian2_default();
  197115. function continueStrafing(controller, movement) {
  197116. const originalEndPosition = movement.endPosition;
  197117. const inertialDelta = Cartesian2_default.subtract(
  197118. movement.endPosition,
  197119. movement.startPosition,
  197120. scratchInertialDelta
  197121. );
  197122. const endPosition = controller._strafeEndMousePosition;
  197123. Cartesian2_default.add(endPosition, inertialDelta, endPosition);
  197124. movement.endPosition = endPosition;
  197125. strafe(controller, movement, controller._strafeStartPosition);
  197126. movement.endPosition = originalEndPosition;
  197127. }
  197128. var translateCVStartRay = new Ray_default();
  197129. var translateCVEndRay = new Ray_default();
  197130. var translateCVStartPos = new Cartesian3_default();
  197131. var translateCVEndPos = new Cartesian3_default();
  197132. var translateCVDifference = new Cartesian3_default();
  197133. var translateCVOrigin = new Cartesian3_default();
  197134. var translateCVPlane = new Plane_default(Cartesian3_default.UNIT_X, 0);
  197135. var translateCVStartMouse = new Cartesian2_default();
  197136. var translateCVEndMouse = new Cartesian2_default();
  197137. function translateCV(controller, startPosition, movement) {
  197138. if (!Cartesian3_default.equals(startPosition, controller._translateMousePosition)) {
  197139. controller._looking = false;
  197140. }
  197141. if (!Cartesian3_default.equals(startPosition, controller._strafeMousePosition)) {
  197142. controller._strafing = false;
  197143. }
  197144. if (controller._looking) {
  197145. look3D(controller, startPosition, movement);
  197146. return;
  197147. }
  197148. if (controller._strafing) {
  197149. continueStrafing(controller, movement);
  197150. return;
  197151. }
  197152. const scene = controller._scene;
  197153. const camera = scene.camera;
  197154. const cameraUnderground = controller._cameraUnderground;
  197155. const startMouse = Cartesian2_default.clone(
  197156. movement.startPosition,
  197157. translateCVStartMouse
  197158. );
  197159. const endMouse = Cartesian2_default.clone(movement.endPosition, translateCVEndMouse);
  197160. let startRay = camera.getPickRay(startMouse, translateCVStartRay);
  197161. const origin = Cartesian3_default.clone(Cartesian3_default.ZERO, translateCVOrigin);
  197162. const normal2 = Cartesian3_default.UNIT_X;
  197163. let globePos;
  197164. if (camera.position.z < controller._minimumPickingTerrainHeight) {
  197165. globePos = pickGlobe(controller, startMouse, translateCVStartPos);
  197166. if (defined_default(globePos)) {
  197167. origin.x = globePos.x;
  197168. }
  197169. }
  197170. if (cameraUnderground || origin.x > camera.position.z && defined_default(globePos)) {
  197171. let pickPosition = globePos;
  197172. if (cameraUnderground) {
  197173. pickPosition = getStrafeStartPositionUnderground(
  197174. controller,
  197175. startRay,
  197176. globePos,
  197177. translateCVStartPos
  197178. );
  197179. }
  197180. Cartesian2_default.clone(startPosition, controller._strafeMousePosition);
  197181. Cartesian2_default.clone(startPosition, controller._strafeEndMousePosition);
  197182. Cartesian3_default.clone(pickPosition, controller._strafeStartPosition);
  197183. controller._strafing = true;
  197184. strafe(controller, movement, controller._strafeStartPosition);
  197185. return;
  197186. }
  197187. const plane = Plane_default.fromPointNormal(origin, normal2, translateCVPlane);
  197188. startRay = camera.getPickRay(startMouse, translateCVStartRay);
  197189. const startPlanePos = IntersectionTests_default.rayPlane(
  197190. startRay,
  197191. plane,
  197192. translateCVStartPos
  197193. );
  197194. const endRay = camera.getPickRay(endMouse, translateCVEndRay);
  197195. const endPlanePos = IntersectionTests_default.rayPlane(
  197196. endRay,
  197197. plane,
  197198. translateCVEndPos
  197199. );
  197200. if (!defined_default(startPlanePos) || !defined_default(endPlanePos)) {
  197201. controller._looking = true;
  197202. look3D(controller, startPosition, movement);
  197203. Cartesian2_default.clone(startPosition, controller._translateMousePosition);
  197204. return;
  197205. }
  197206. const diff = Cartesian3_default.subtract(
  197207. startPlanePos,
  197208. endPlanePos,
  197209. translateCVDifference
  197210. );
  197211. const temp = diff.x;
  197212. diff.x = diff.y;
  197213. diff.y = diff.z;
  197214. diff.z = temp;
  197215. const mag = Cartesian3_default.magnitude(diff);
  197216. if (mag > Math_default.EPSILON6) {
  197217. Cartesian3_default.normalize(diff, diff);
  197218. camera.move(diff, mag);
  197219. }
  197220. }
  197221. var rotateCVWindowPos = new Cartesian2_default();
  197222. var rotateCVWindowRay = new Ray_default();
  197223. var rotateCVCenter = new Cartesian3_default();
  197224. var rotateCVVerticalCenter = new Cartesian3_default();
  197225. var rotateCVTransform = new Matrix4_default();
  197226. var rotateCVVerticalTransform = new Matrix4_default();
  197227. var rotateCVOrigin = new Cartesian3_default();
  197228. var rotateCVPlane = new Plane_default(Cartesian3_default.UNIT_X, 0);
  197229. var rotateCVCartesian3 = new Cartesian3_default();
  197230. var rotateCVCart = new Cartographic_default();
  197231. var rotateCVOldTransform = new Matrix4_default();
  197232. var rotateCVQuaternion = new Quaternion_default();
  197233. var rotateCVMatrix = new Matrix3_default();
  197234. var tilt3DCartesian3 = new Cartesian3_default();
  197235. function rotateCV(controller, startPosition, movement) {
  197236. if (defined_default(movement.angleAndHeight)) {
  197237. movement = movement.angleAndHeight;
  197238. }
  197239. if (!Cartesian2_default.equals(startPosition, controller._tiltCenterMousePosition)) {
  197240. controller._tiltCVOffMap = false;
  197241. controller._looking = false;
  197242. }
  197243. if (controller._looking) {
  197244. look3D(controller, startPosition, movement);
  197245. return;
  197246. }
  197247. const scene = controller._scene;
  197248. const camera = scene.camera;
  197249. if (controller._tiltCVOffMap || !controller.onMap() || Math.abs(camera.position.z) > controller._minimumPickingTerrainHeight) {
  197250. controller._tiltCVOffMap = true;
  197251. rotateCVOnPlane(controller, startPosition, movement);
  197252. } else {
  197253. rotateCVOnTerrain(controller, startPosition, movement);
  197254. }
  197255. }
  197256. function rotateCVOnPlane(controller, startPosition, movement) {
  197257. const scene = controller._scene;
  197258. const camera = scene.camera;
  197259. const canvas = scene.canvas;
  197260. const windowPosition = rotateCVWindowPos;
  197261. windowPosition.x = canvas.clientWidth / 2;
  197262. windowPosition.y = canvas.clientHeight / 2;
  197263. const ray = camera.getPickRay(windowPosition, rotateCVWindowRay);
  197264. const normal2 = Cartesian3_default.UNIT_X;
  197265. const position = ray.origin;
  197266. const direction2 = ray.direction;
  197267. let scalar;
  197268. const normalDotDirection = Cartesian3_default.dot(normal2, direction2);
  197269. if (Math.abs(normalDotDirection) > Math_default.EPSILON6) {
  197270. scalar = -Cartesian3_default.dot(normal2, position) / normalDotDirection;
  197271. }
  197272. if (!defined_default(scalar) || scalar <= 0) {
  197273. controller._looking = true;
  197274. look3D(controller, startPosition, movement);
  197275. Cartesian2_default.clone(startPosition, controller._tiltCenterMousePosition);
  197276. return;
  197277. }
  197278. const center = Cartesian3_default.multiplyByScalar(direction2, scalar, rotateCVCenter);
  197279. Cartesian3_default.add(position, center, center);
  197280. const projection = scene.mapProjection;
  197281. const ellipsoid = projection.ellipsoid;
  197282. Cartesian3_default.fromElements(center.y, center.z, center.x, center);
  197283. const cart = projection.unproject(center, rotateCVCart);
  197284. ellipsoid.cartographicToCartesian(cart, center);
  197285. const transform4 = Transforms_default.eastNorthUpToFixedFrame(
  197286. center,
  197287. ellipsoid,
  197288. rotateCVTransform
  197289. );
  197290. const oldGlobe = controller._globe;
  197291. const oldEllipsoid = controller._ellipsoid;
  197292. controller._globe = void 0;
  197293. controller._ellipsoid = Ellipsoid_default.UNIT_SPHERE;
  197294. controller._rotateFactor = 1;
  197295. controller._rotateRateRangeAdjustment = 1;
  197296. const oldTransform = Matrix4_default.clone(camera.transform, rotateCVOldTransform);
  197297. camera._setTransform(transform4);
  197298. rotate3D(controller, startPosition, movement, Cartesian3_default.UNIT_Z);
  197299. camera._setTransform(oldTransform);
  197300. controller._globe = oldGlobe;
  197301. controller._ellipsoid = oldEllipsoid;
  197302. const radius = oldEllipsoid.maximumRadius;
  197303. controller._rotateFactor = 1 / radius;
  197304. controller._rotateRateRangeAdjustment = radius;
  197305. }
  197306. function rotateCVOnTerrain(controller, startPosition, movement) {
  197307. const scene = controller._scene;
  197308. const camera = scene.camera;
  197309. const cameraUnderground = controller._cameraUnderground;
  197310. let center;
  197311. let ray;
  197312. const normal2 = Cartesian3_default.UNIT_X;
  197313. if (Cartesian2_default.equals(startPosition, controller._tiltCenterMousePosition)) {
  197314. center = Cartesian3_default.clone(controller._tiltCenter, rotateCVCenter);
  197315. } else {
  197316. if (camera.position.z < controller._minimumPickingTerrainHeight) {
  197317. center = pickGlobe(controller, startPosition, rotateCVCenter);
  197318. }
  197319. if (!defined_default(center)) {
  197320. ray = camera.getPickRay(startPosition, rotateCVWindowRay);
  197321. const position = ray.origin;
  197322. const direction2 = ray.direction;
  197323. let scalar;
  197324. const normalDotDirection = Cartesian3_default.dot(normal2, direction2);
  197325. if (Math.abs(normalDotDirection) > Math_default.EPSILON6) {
  197326. scalar = -Cartesian3_default.dot(normal2, position) / normalDotDirection;
  197327. }
  197328. if (!defined_default(scalar) || scalar <= 0) {
  197329. controller._looking = true;
  197330. look3D(controller, startPosition, movement);
  197331. Cartesian2_default.clone(startPosition, controller._tiltCenterMousePosition);
  197332. return;
  197333. }
  197334. center = Cartesian3_default.multiplyByScalar(direction2, scalar, rotateCVCenter);
  197335. Cartesian3_default.add(position, center, center);
  197336. }
  197337. if (cameraUnderground) {
  197338. if (!defined_default(ray)) {
  197339. ray = camera.getPickRay(startPosition, rotateCVWindowRay);
  197340. }
  197341. getTiltCenterUnderground(controller, ray, center, center);
  197342. }
  197343. Cartesian2_default.clone(startPosition, controller._tiltCenterMousePosition);
  197344. Cartesian3_default.clone(center, controller._tiltCenter);
  197345. }
  197346. const canvas = scene.canvas;
  197347. const windowPosition = rotateCVWindowPos;
  197348. windowPosition.x = canvas.clientWidth / 2;
  197349. windowPosition.y = controller._tiltCenterMousePosition.y;
  197350. ray = camera.getPickRay(windowPosition, rotateCVWindowRay);
  197351. const origin = Cartesian3_default.clone(Cartesian3_default.ZERO, rotateCVOrigin);
  197352. origin.x = center.x;
  197353. const plane = Plane_default.fromPointNormal(origin, normal2, rotateCVPlane);
  197354. const verticalCenter = IntersectionTests_default.rayPlane(
  197355. ray,
  197356. plane,
  197357. rotateCVVerticalCenter
  197358. );
  197359. const projection = camera._projection;
  197360. const ellipsoid = projection.ellipsoid;
  197361. Cartesian3_default.fromElements(center.y, center.z, center.x, center);
  197362. let cart = projection.unproject(center, rotateCVCart);
  197363. ellipsoid.cartographicToCartesian(cart, center);
  197364. const transform4 = Transforms_default.eastNorthUpToFixedFrame(
  197365. center,
  197366. ellipsoid,
  197367. rotateCVTransform
  197368. );
  197369. let verticalTransform;
  197370. if (defined_default(verticalCenter)) {
  197371. Cartesian3_default.fromElements(
  197372. verticalCenter.y,
  197373. verticalCenter.z,
  197374. verticalCenter.x,
  197375. verticalCenter
  197376. );
  197377. cart = projection.unproject(verticalCenter, rotateCVCart);
  197378. ellipsoid.cartographicToCartesian(cart, verticalCenter);
  197379. verticalTransform = Transforms_default.eastNorthUpToFixedFrame(
  197380. verticalCenter,
  197381. ellipsoid,
  197382. rotateCVVerticalTransform
  197383. );
  197384. } else {
  197385. verticalTransform = transform4;
  197386. }
  197387. const oldGlobe = controller._globe;
  197388. const oldEllipsoid = controller._ellipsoid;
  197389. controller._globe = void 0;
  197390. controller._ellipsoid = Ellipsoid_default.UNIT_SPHERE;
  197391. controller._rotateFactor = 1;
  197392. controller._rotateRateRangeAdjustment = 1;
  197393. let constrainedAxis = Cartesian3_default.UNIT_Z;
  197394. const oldTransform = Matrix4_default.clone(camera.transform, rotateCVOldTransform);
  197395. camera._setTransform(transform4);
  197396. const tangent = Cartesian3_default.cross(
  197397. Cartesian3_default.UNIT_Z,
  197398. Cartesian3_default.normalize(camera.position, rotateCVCartesian3),
  197399. rotateCVCartesian3
  197400. );
  197401. const dot2 = Cartesian3_default.dot(camera.right, tangent);
  197402. rotate3D(controller, startPosition, movement, constrainedAxis, false, true);
  197403. camera._setTransform(verticalTransform);
  197404. if (dot2 < 0) {
  197405. const movementDelta = movement.startPosition.y - movement.endPosition.y;
  197406. if (cameraUnderground && movementDelta < 0 || !cameraUnderground && movementDelta > 0) {
  197407. constrainedAxis = void 0;
  197408. }
  197409. const oldConstrainedAxis = camera.constrainedAxis;
  197410. camera.constrainedAxis = void 0;
  197411. rotate3D(controller, startPosition, movement, constrainedAxis, true, false);
  197412. camera.constrainedAxis = oldConstrainedAxis;
  197413. } else {
  197414. rotate3D(controller, startPosition, movement, constrainedAxis, true, false);
  197415. }
  197416. if (defined_default(camera.constrainedAxis)) {
  197417. const right = Cartesian3_default.cross(
  197418. camera.direction,
  197419. camera.constrainedAxis,
  197420. tilt3DCartesian3
  197421. );
  197422. if (!Cartesian3_default.equalsEpsilon(right, Cartesian3_default.ZERO, Math_default.EPSILON6)) {
  197423. if (Cartesian3_default.dot(right, camera.right) < 0) {
  197424. Cartesian3_default.negate(right, right);
  197425. }
  197426. Cartesian3_default.cross(right, camera.direction, camera.up);
  197427. Cartesian3_default.cross(camera.direction, camera.up, camera.right);
  197428. Cartesian3_default.normalize(camera.up, camera.up);
  197429. Cartesian3_default.normalize(camera.right, camera.right);
  197430. }
  197431. }
  197432. camera._setTransform(oldTransform);
  197433. controller._globe = oldGlobe;
  197434. controller._ellipsoid = oldEllipsoid;
  197435. const radius = oldEllipsoid.maximumRadius;
  197436. controller._rotateFactor = 1 / radius;
  197437. controller._rotateRateRangeAdjustment = radius;
  197438. const originalPosition = Cartesian3_default.clone(
  197439. camera.positionWC,
  197440. rotateCVCartesian3
  197441. );
  197442. if (controller.enableCollisionDetection) {
  197443. adjustHeightForTerrain(controller);
  197444. }
  197445. if (!Cartesian3_default.equals(camera.positionWC, originalPosition)) {
  197446. camera._setTransform(verticalTransform);
  197447. camera.worldToCameraCoordinatesPoint(originalPosition, originalPosition);
  197448. const magSqrd = Cartesian3_default.magnitudeSquared(originalPosition);
  197449. if (Cartesian3_default.magnitudeSquared(camera.position) > magSqrd) {
  197450. Cartesian3_default.normalize(camera.position, camera.position);
  197451. Cartesian3_default.multiplyByScalar(
  197452. camera.position,
  197453. Math.sqrt(magSqrd),
  197454. camera.position
  197455. );
  197456. }
  197457. const angle = Cartesian3_default.angleBetween(originalPosition, camera.position);
  197458. const axis = Cartesian3_default.cross(
  197459. originalPosition,
  197460. camera.position,
  197461. originalPosition
  197462. );
  197463. Cartesian3_default.normalize(axis, axis);
  197464. const quaternion = Quaternion_default.fromAxisAngle(
  197465. axis,
  197466. angle,
  197467. rotateCVQuaternion
  197468. );
  197469. const rotation = Matrix3_default.fromQuaternion(quaternion, rotateCVMatrix);
  197470. Matrix3_default.multiplyByVector(rotation, camera.direction, camera.direction);
  197471. Matrix3_default.multiplyByVector(rotation, camera.up, camera.up);
  197472. Cartesian3_default.cross(camera.direction, camera.up, camera.right);
  197473. Cartesian3_default.cross(camera.right, camera.direction, camera.up);
  197474. camera._setTransform(oldTransform);
  197475. }
  197476. }
  197477. var zoomCVWindowPos = new Cartesian2_default();
  197478. var zoomCVWindowRay = new Ray_default();
  197479. var zoomCVIntersection = new Cartesian3_default();
  197480. function zoomCV(controller, startPosition, movement) {
  197481. if (defined_default(movement.distance)) {
  197482. movement = movement.distance;
  197483. }
  197484. const scene = controller._scene;
  197485. const camera = scene.camera;
  197486. const canvas = scene.canvas;
  197487. const cameraUnderground = controller._cameraUnderground;
  197488. let windowPosition;
  197489. if (cameraUnderground) {
  197490. windowPosition = startPosition;
  197491. } else {
  197492. windowPosition = zoomCVWindowPos;
  197493. windowPosition.x = canvas.clientWidth / 2;
  197494. windowPosition.y = canvas.clientHeight / 2;
  197495. }
  197496. const ray = camera.getPickRay(windowPosition, zoomCVWindowRay);
  197497. const position = ray.origin;
  197498. const direction2 = ray.direction;
  197499. const height = camera.position.z;
  197500. let intersection;
  197501. if (height < controller._minimumPickingTerrainHeight) {
  197502. intersection = pickGlobe(controller, windowPosition, zoomCVIntersection);
  197503. }
  197504. let distance2;
  197505. if (defined_default(intersection)) {
  197506. distance2 = Cartesian3_default.distance(position, intersection);
  197507. }
  197508. if (cameraUnderground) {
  197509. const distanceUnderground = getZoomDistanceUnderground(
  197510. controller,
  197511. ray,
  197512. height
  197513. );
  197514. if (defined_default(distance2)) {
  197515. distance2 = Math.min(distance2, distanceUnderground);
  197516. } else {
  197517. distance2 = distanceUnderground;
  197518. }
  197519. }
  197520. if (!defined_default(distance2)) {
  197521. const normal2 = Cartesian3_default.UNIT_X;
  197522. distance2 = -Cartesian3_default.dot(normal2, position) / Cartesian3_default.dot(normal2, direction2);
  197523. }
  197524. handleZoom(
  197525. controller,
  197526. startPosition,
  197527. movement,
  197528. controller._zoomFactor,
  197529. distance2
  197530. );
  197531. }
  197532. function updateCV(controller) {
  197533. const scene = controller._scene;
  197534. const camera = scene.camera;
  197535. if (!Matrix4_default.equals(Matrix4_default.IDENTITY, camera.transform)) {
  197536. reactToInput(
  197537. controller,
  197538. controller.enableRotate,
  197539. controller.rotateEventTypes,
  197540. rotate3D,
  197541. controller.inertiaSpin,
  197542. "_lastInertiaSpinMovement"
  197543. );
  197544. reactToInput(
  197545. controller,
  197546. controller.enableZoom,
  197547. controller.zoomEventTypes,
  197548. zoom3D2,
  197549. controller.inertiaZoom,
  197550. "_lastInertiaZoomMovement"
  197551. );
  197552. } else {
  197553. const tweens = controller._tweens;
  197554. if (controller._aggregator.anyButtonDown) {
  197555. tweens.removeAll();
  197556. }
  197557. reactToInput(
  197558. controller,
  197559. controller.enableTilt,
  197560. controller.tiltEventTypes,
  197561. rotateCV,
  197562. controller.inertiaSpin,
  197563. "_lastInertiaTiltMovement"
  197564. );
  197565. reactToInput(
  197566. controller,
  197567. controller.enableTranslate,
  197568. controller.translateEventTypes,
  197569. translateCV,
  197570. controller.inertiaTranslate,
  197571. "_lastInertiaTranslateMovement"
  197572. );
  197573. reactToInput(
  197574. controller,
  197575. controller.enableZoom,
  197576. controller.zoomEventTypes,
  197577. zoomCV,
  197578. controller.inertiaZoom,
  197579. "_lastInertiaZoomMovement"
  197580. );
  197581. reactToInput(
  197582. controller,
  197583. controller.enableLook,
  197584. controller.lookEventTypes,
  197585. look3D
  197586. );
  197587. if (!controller._aggregator.anyButtonDown && !tweens.contains(controller._tween)) {
  197588. const tween = camera.createCorrectPositionTween(
  197589. controller.bounceAnimationTime
  197590. );
  197591. if (defined_default(tween)) {
  197592. controller._tween = tweens.add(tween);
  197593. }
  197594. }
  197595. tweens.update();
  197596. }
  197597. }
  197598. var scratchStrafeRay = new Ray_default();
  197599. var scratchStrafePlane = new Plane_default(Cartesian3_default.UNIT_X, 0);
  197600. var scratchStrafeIntersection = new Cartesian3_default();
  197601. var scratchStrafeDirection = new Cartesian3_default();
  197602. var scratchMousePos = new Cartesian3_default();
  197603. function strafe(controller, movement, strafeStartPosition) {
  197604. const scene = controller._scene;
  197605. const camera = scene.camera;
  197606. const ray = camera.getPickRay(movement.endPosition, scratchStrafeRay);
  197607. let direction2 = Cartesian3_default.clone(camera.direction, scratchStrafeDirection);
  197608. if (scene.mode === SceneMode_default.COLUMBUS_VIEW) {
  197609. Cartesian3_default.fromElements(direction2.z, direction2.x, direction2.y, direction2);
  197610. }
  197611. const plane = Plane_default.fromPointNormal(
  197612. strafeStartPosition,
  197613. direction2,
  197614. scratchStrafePlane
  197615. );
  197616. const intersection = IntersectionTests_default.rayPlane(
  197617. ray,
  197618. plane,
  197619. scratchStrafeIntersection
  197620. );
  197621. if (!defined_default(intersection)) {
  197622. return;
  197623. }
  197624. direction2 = Cartesian3_default.subtract(strafeStartPosition, intersection, direction2);
  197625. if (scene.mode === SceneMode_default.COLUMBUS_VIEW) {
  197626. Cartesian3_default.fromElements(direction2.y, direction2.z, direction2.x, direction2);
  197627. }
  197628. Cartesian3_default.add(camera.position, direction2, camera.position);
  197629. }
  197630. var spin3DPick = new Cartesian3_default();
  197631. var scratchCartographic20 = new Cartographic_default();
  197632. var scratchRadii3 = new Cartesian3_default();
  197633. var scratchEllipsoid15 = new Ellipsoid_default();
  197634. var scratchLookUp = new Cartesian3_default();
  197635. var scratchNormal8 = new Cartesian3_default();
  197636. function spin3D(controller, startPosition, movement) {
  197637. const scene = controller._scene;
  197638. const camera = scene.camera;
  197639. const cameraUnderground = controller._cameraUnderground;
  197640. let ellipsoid = controller._ellipsoid;
  197641. if (!Matrix4_default.equals(camera.transform, Matrix4_default.IDENTITY)) {
  197642. rotate3D(controller, startPosition, movement);
  197643. return;
  197644. }
  197645. let magnitude;
  197646. let radii;
  197647. const up = ellipsoid.geodeticSurfaceNormal(camera.position, scratchLookUp);
  197648. if (Cartesian2_default.equals(startPosition, controller._rotateMousePosition)) {
  197649. if (controller._looking) {
  197650. look3D(controller, startPosition, movement, up);
  197651. } else if (controller._rotating) {
  197652. rotate3D(controller, startPosition, movement);
  197653. } else if (controller._strafing) {
  197654. continueStrafing(controller, movement);
  197655. } else {
  197656. if (Cartesian3_default.magnitude(camera.position) < Cartesian3_default.magnitude(controller._rotateStartPosition)) {
  197657. return;
  197658. }
  197659. magnitude = Cartesian3_default.magnitude(controller._rotateStartPosition);
  197660. radii = scratchRadii3;
  197661. radii.x = radii.y = radii.z = magnitude;
  197662. ellipsoid = Ellipsoid_default.fromCartesian3(radii, scratchEllipsoid15);
  197663. pan3D(controller, startPosition, movement, ellipsoid);
  197664. }
  197665. return;
  197666. }
  197667. controller._looking = false;
  197668. controller._rotating = false;
  197669. controller._strafing = false;
  197670. const height = ellipsoid.cartesianToCartographic(
  197671. camera.positionWC,
  197672. scratchCartographic20
  197673. ).height;
  197674. const globe = controller._globe;
  197675. if (defined_default(globe) && height < controller._minimumPickingTerrainHeight) {
  197676. const mousePos = pickGlobe(
  197677. controller,
  197678. movement.startPosition,
  197679. scratchMousePos
  197680. );
  197681. if (defined_default(mousePos)) {
  197682. let strafing = false;
  197683. const ray = camera.getPickRay(
  197684. movement.startPosition,
  197685. pickGlobeScratchRay
  197686. );
  197687. if (cameraUnderground) {
  197688. strafing = true;
  197689. getStrafeStartPositionUnderground(controller, ray, mousePos, mousePos);
  197690. } else {
  197691. const normal2 = ellipsoid.geodeticSurfaceNormal(mousePos, scratchNormal8);
  197692. const tangentPick = Math.abs(Cartesian3_default.dot(ray.direction, normal2)) < 0.05;
  197693. if (tangentPick) {
  197694. strafing = true;
  197695. } else {
  197696. strafing = Cartesian3_default.magnitude(camera.position) < Cartesian3_default.magnitude(mousePos);
  197697. }
  197698. }
  197699. if (strafing) {
  197700. Cartesian2_default.clone(startPosition, controller._strafeEndMousePosition);
  197701. Cartesian3_default.clone(mousePos, controller._strafeStartPosition);
  197702. controller._strafing = true;
  197703. strafe(controller, movement, controller._strafeStartPosition);
  197704. } else {
  197705. magnitude = Cartesian3_default.magnitude(mousePos);
  197706. radii = scratchRadii3;
  197707. radii.x = radii.y = radii.z = magnitude;
  197708. ellipsoid = Ellipsoid_default.fromCartesian3(radii, scratchEllipsoid15);
  197709. pan3D(controller, startPosition, movement, ellipsoid);
  197710. Cartesian3_default.clone(mousePos, controller._rotateStartPosition);
  197711. }
  197712. } else {
  197713. controller._looking = true;
  197714. look3D(controller, startPosition, movement, up);
  197715. }
  197716. } else if (defined_default(
  197717. camera.pickEllipsoid(
  197718. movement.startPosition,
  197719. controller._ellipsoid,
  197720. spin3DPick
  197721. )
  197722. )) {
  197723. pan3D(controller, startPosition, movement, controller._ellipsoid);
  197724. Cartesian3_default.clone(spin3DPick, controller._rotateStartPosition);
  197725. } else if (height > controller._minimumTrackBallHeight) {
  197726. controller._rotating = true;
  197727. rotate3D(controller, startPosition, movement);
  197728. } else {
  197729. controller._looking = true;
  197730. look3D(controller, startPosition, movement, up);
  197731. }
  197732. Cartesian2_default.clone(startPosition, controller._rotateMousePosition);
  197733. }
  197734. function rotate3D(controller, startPosition, movement, constrainedAxis, rotateOnlyVertical, rotateOnlyHorizontal) {
  197735. rotateOnlyVertical = defaultValue_default(rotateOnlyVertical, false);
  197736. rotateOnlyHorizontal = defaultValue_default(rotateOnlyHorizontal, false);
  197737. const scene = controller._scene;
  197738. const camera = scene.camera;
  197739. const canvas = scene.canvas;
  197740. const oldAxis = camera.constrainedAxis;
  197741. if (defined_default(constrainedAxis)) {
  197742. camera.constrainedAxis = constrainedAxis;
  197743. }
  197744. const rho = Cartesian3_default.magnitude(camera.position);
  197745. let rotateRate = controller._rotateFactor * (rho - controller._rotateRateRangeAdjustment);
  197746. if (rotateRate > controller._maximumRotateRate) {
  197747. rotateRate = controller._maximumRotateRate;
  197748. }
  197749. if (rotateRate < controller._minimumRotateRate) {
  197750. rotateRate = controller._minimumRotateRate;
  197751. }
  197752. let phiWindowRatio = (movement.startPosition.x - movement.endPosition.x) / canvas.clientWidth;
  197753. let thetaWindowRatio = (movement.startPosition.y - movement.endPosition.y) / canvas.clientHeight;
  197754. phiWindowRatio = Math.min(phiWindowRatio, controller.maximumMovementRatio);
  197755. thetaWindowRatio = Math.min(
  197756. thetaWindowRatio,
  197757. controller.maximumMovementRatio
  197758. );
  197759. const deltaPhi = rotateRate * phiWindowRatio * Math.PI * 2;
  197760. const deltaTheta = rotateRate * thetaWindowRatio * Math.PI;
  197761. if (!rotateOnlyVertical) {
  197762. camera.rotateRight(deltaPhi);
  197763. }
  197764. if (!rotateOnlyHorizontal) {
  197765. camera.rotateUp(deltaTheta);
  197766. }
  197767. camera.constrainedAxis = oldAxis;
  197768. }
  197769. var pan3DP0 = Cartesian4_default.clone(Cartesian4_default.UNIT_W);
  197770. var pan3DP1 = Cartesian4_default.clone(Cartesian4_default.UNIT_W);
  197771. var pan3DTemp0 = new Cartesian3_default();
  197772. var pan3DTemp1 = new Cartesian3_default();
  197773. var pan3DTemp2 = new Cartesian3_default();
  197774. var pan3DTemp3 = new Cartesian3_default();
  197775. var pan3DStartMousePosition = new Cartesian2_default();
  197776. var pan3DEndMousePosition = new Cartesian2_default();
  197777. function pan3D(controller, startPosition, movement, ellipsoid) {
  197778. const scene = controller._scene;
  197779. const camera = scene.camera;
  197780. const startMousePosition = Cartesian2_default.clone(
  197781. movement.startPosition,
  197782. pan3DStartMousePosition
  197783. );
  197784. const endMousePosition = Cartesian2_default.clone(
  197785. movement.endPosition,
  197786. pan3DEndMousePosition
  197787. );
  197788. let p0 = camera.pickEllipsoid(startMousePosition, ellipsoid, pan3DP0);
  197789. let p1 = camera.pickEllipsoid(endMousePosition, ellipsoid, pan3DP1);
  197790. if (!defined_default(p0) || !defined_default(p1)) {
  197791. controller._rotating = true;
  197792. rotate3D(controller, startPosition, movement);
  197793. return;
  197794. }
  197795. p0 = camera.worldToCameraCoordinates(p0, p0);
  197796. p1 = camera.worldToCameraCoordinates(p1, p1);
  197797. if (!defined_default(camera.constrainedAxis)) {
  197798. Cartesian3_default.normalize(p0, p0);
  197799. Cartesian3_default.normalize(p1, p1);
  197800. const dot2 = Cartesian3_default.dot(p0, p1);
  197801. const axis = Cartesian3_default.cross(p0, p1, pan3DTemp0);
  197802. if (dot2 < 1 && !Cartesian3_default.equalsEpsilon(axis, Cartesian3_default.ZERO, Math_default.EPSILON14)) {
  197803. const angle = Math.acos(dot2);
  197804. camera.rotate(axis, angle);
  197805. }
  197806. } else {
  197807. const basis0 = camera.constrainedAxis;
  197808. const basis1 = Cartesian3_default.mostOrthogonalAxis(basis0, pan3DTemp0);
  197809. Cartesian3_default.cross(basis1, basis0, basis1);
  197810. Cartesian3_default.normalize(basis1, basis1);
  197811. const basis2 = Cartesian3_default.cross(basis0, basis1, pan3DTemp1);
  197812. const startRho = Cartesian3_default.magnitude(p0);
  197813. const startDot = Cartesian3_default.dot(basis0, p0);
  197814. const startTheta = Math.acos(startDot / startRho);
  197815. const startRej = Cartesian3_default.multiplyByScalar(basis0, startDot, pan3DTemp2);
  197816. Cartesian3_default.subtract(p0, startRej, startRej);
  197817. Cartesian3_default.normalize(startRej, startRej);
  197818. const endRho = Cartesian3_default.magnitude(p1);
  197819. const endDot = Cartesian3_default.dot(basis0, p1);
  197820. const endTheta = Math.acos(endDot / endRho);
  197821. const endRej = Cartesian3_default.multiplyByScalar(basis0, endDot, pan3DTemp3);
  197822. Cartesian3_default.subtract(p1, endRej, endRej);
  197823. Cartesian3_default.normalize(endRej, endRej);
  197824. let startPhi = Math.acos(Cartesian3_default.dot(startRej, basis1));
  197825. if (Cartesian3_default.dot(startRej, basis2) < 0) {
  197826. startPhi = Math_default.TWO_PI - startPhi;
  197827. }
  197828. let endPhi = Math.acos(Cartesian3_default.dot(endRej, basis1));
  197829. if (Cartesian3_default.dot(endRej, basis2) < 0) {
  197830. endPhi = Math_default.TWO_PI - endPhi;
  197831. }
  197832. const deltaPhi = startPhi - endPhi;
  197833. let east;
  197834. if (Cartesian3_default.equalsEpsilon(basis0, camera.position, Math_default.EPSILON2)) {
  197835. east = camera.right;
  197836. } else {
  197837. east = Cartesian3_default.cross(basis0, camera.position, pan3DTemp0);
  197838. }
  197839. const planeNormal = Cartesian3_default.cross(basis0, east, pan3DTemp0);
  197840. const side0 = Cartesian3_default.dot(
  197841. planeNormal,
  197842. Cartesian3_default.subtract(p0, basis0, pan3DTemp1)
  197843. );
  197844. const side1 = Cartesian3_default.dot(
  197845. planeNormal,
  197846. Cartesian3_default.subtract(p1, basis0, pan3DTemp1)
  197847. );
  197848. let deltaTheta;
  197849. if (side0 > 0 && side1 > 0) {
  197850. deltaTheta = endTheta - startTheta;
  197851. } else if (side0 > 0 && side1 <= 0) {
  197852. if (Cartesian3_default.dot(camera.position, basis0) > 0) {
  197853. deltaTheta = -startTheta - endTheta;
  197854. } else {
  197855. deltaTheta = startTheta + endTheta;
  197856. }
  197857. } else {
  197858. deltaTheta = startTheta - endTheta;
  197859. }
  197860. camera.rotateRight(deltaPhi);
  197861. camera.rotateUp(deltaTheta);
  197862. }
  197863. }
  197864. var zoom3DUnitPosition = new Cartesian3_default();
  197865. var zoom3DCartographic = new Cartographic_default();
  197866. function zoom3D2(controller, startPosition, movement) {
  197867. if (defined_default(movement.distance)) {
  197868. movement = movement.distance;
  197869. }
  197870. const ellipsoid = controller._ellipsoid;
  197871. const scene = controller._scene;
  197872. const camera = scene.camera;
  197873. const canvas = scene.canvas;
  197874. const cameraUnderground = controller._cameraUnderground;
  197875. let windowPosition;
  197876. if (cameraUnderground) {
  197877. windowPosition = startPosition;
  197878. } else {
  197879. windowPosition = zoomCVWindowPos;
  197880. windowPosition.x = canvas.clientWidth / 2;
  197881. windowPosition.y = canvas.clientHeight / 2;
  197882. }
  197883. const ray = camera.getPickRay(windowPosition, zoomCVWindowRay);
  197884. let intersection;
  197885. const height = ellipsoid.cartesianToCartographic(
  197886. camera.position,
  197887. zoom3DCartographic
  197888. ).height;
  197889. if (height < controller._minimumPickingTerrainHeight) {
  197890. intersection = pickGlobe(controller, windowPosition, zoomCVIntersection);
  197891. }
  197892. let distance2;
  197893. if (defined_default(intersection)) {
  197894. distance2 = Cartesian3_default.distance(ray.origin, intersection);
  197895. }
  197896. if (cameraUnderground) {
  197897. const distanceUnderground = getZoomDistanceUnderground(
  197898. controller,
  197899. ray,
  197900. height
  197901. );
  197902. if (defined_default(distance2)) {
  197903. distance2 = Math.min(distance2, distanceUnderground);
  197904. } else {
  197905. distance2 = distanceUnderground;
  197906. }
  197907. }
  197908. if (!defined_default(distance2)) {
  197909. distance2 = height;
  197910. }
  197911. const unitPosition = Cartesian3_default.normalize(
  197912. camera.position,
  197913. zoom3DUnitPosition
  197914. );
  197915. handleZoom(
  197916. controller,
  197917. startPosition,
  197918. movement,
  197919. controller._zoomFactor,
  197920. distance2,
  197921. Cartesian3_default.dot(unitPosition, camera.direction)
  197922. );
  197923. }
  197924. var tilt3DWindowPos = new Cartesian2_default();
  197925. var tilt3DRay = new Ray_default();
  197926. var tilt3DCenter = new Cartesian3_default();
  197927. var tilt3DVerticalCenter = new Cartesian3_default();
  197928. var tilt3DTransform = new Matrix4_default();
  197929. var tilt3DVerticalTransform = new Matrix4_default();
  197930. var tilt3DOldTransform = new Matrix4_default();
  197931. var tilt3DQuaternion = new Quaternion_default();
  197932. var tilt3DMatrix = new Matrix3_default();
  197933. var tilt3DCart = new Cartographic_default();
  197934. var tilt3DLookUp = new Cartesian3_default();
  197935. function tilt3D(controller, startPosition, movement) {
  197936. const scene = controller._scene;
  197937. const camera = scene.camera;
  197938. if (!Matrix4_default.equals(camera.transform, Matrix4_default.IDENTITY)) {
  197939. return;
  197940. }
  197941. if (defined_default(movement.angleAndHeight)) {
  197942. movement = movement.angleAndHeight;
  197943. }
  197944. if (!Cartesian2_default.equals(startPosition, controller._tiltCenterMousePosition)) {
  197945. controller._tiltOnEllipsoid = false;
  197946. controller._looking = false;
  197947. }
  197948. if (controller._looking) {
  197949. const up = controller._ellipsoid.geodeticSurfaceNormal(
  197950. camera.position,
  197951. tilt3DLookUp
  197952. );
  197953. look3D(controller, startPosition, movement, up);
  197954. return;
  197955. }
  197956. const ellipsoid = controller._ellipsoid;
  197957. const cartographic2 = ellipsoid.cartesianToCartographic(
  197958. camera.position,
  197959. tilt3DCart
  197960. );
  197961. if (controller._tiltOnEllipsoid || cartographic2.height > controller._minimumCollisionTerrainHeight) {
  197962. controller._tiltOnEllipsoid = true;
  197963. tilt3DOnEllipsoid(controller, startPosition, movement);
  197964. } else {
  197965. tilt3DOnTerrain(controller, startPosition, movement);
  197966. }
  197967. }
  197968. var tilt3DOnEllipsoidCartographic = new Cartographic_default();
  197969. function tilt3DOnEllipsoid(controller, startPosition, movement) {
  197970. const ellipsoid = controller._ellipsoid;
  197971. const scene = controller._scene;
  197972. const camera = scene.camera;
  197973. const minHeight = controller.minimumZoomDistance * 0.25;
  197974. const height = ellipsoid.cartesianToCartographic(
  197975. camera.positionWC,
  197976. tilt3DOnEllipsoidCartographic
  197977. ).height;
  197978. if (height - minHeight - 1 < Math_default.EPSILON3 && movement.endPosition.y - movement.startPosition.y < 0) {
  197979. return;
  197980. }
  197981. const canvas = scene.canvas;
  197982. const windowPosition = tilt3DWindowPos;
  197983. windowPosition.x = canvas.clientWidth / 2;
  197984. windowPosition.y = canvas.clientHeight / 2;
  197985. const ray = camera.getPickRay(windowPosition, tilt3DRay);
  197986. let center;
  197987. const intersection = IntersectionTests_default.rayEllipsoid(ray, ellipsoid);
  197988. if (defined_default(intersection)) {
  197989. center = Ray_default.getPoint(ray, intersection.start, tilt3DCenter);
  197990. } else if (height > controller._minimumTrackBallHeight) {
  197991. const grazingAltitudeLocation = IntersectionTests_default.grazingAltitudeLocation(
  197992. ray,
  197993. ellipsoid
  197994. );
  197995. if (!defined_default(grazingAltitudeLocation)) {
  197996. return;
  197997. }
  197998. const grazingAltitudeCart = ellipsoid.cartesianToCartographic(
  197999. grazingAltitudeLocation,
  198000. tilt3DCart
  198001. );
  198002. grazingAltitudeCart.height = 0;
  198003. center = ellipsoid.cartographicToCartesian(
  198004. grazingAltitudeCart,
  198005. tilt3DCenter
  198006. );
  198007. } else {
  198008. controller._looking = true;
  198009. const up = controller._ellipsoid.geodeticSurfaceNormal(
  198010. camera.position,
  198011. tilt3DLookUp
  198012. );
  198013. look3D(controller, startPosition, movement, up);
  198014. Cartesian2_default.clone(startPosition, controller._tiltCenterMousePosition);
  198015. return;
  198016. }
  198017. const transform4 = Transforms_default.eastNorthUpToFixedFrame(
  198018. center,
  198019. ellipsoid,
  198020. tilt3DTransform
  198021. );
  198022. const oldGlobe = controller._globe;
  198023. const oldEllipsoid = controller._ellipsoid;
  198024. controller._globe = void 0;
  198025. controller._ellipsoid = Ellipsoid_default.UNIT_SPHERE;
  198026. controller._rotateFactor = 1;
  198027. controller._rotateRateRangeAdjustment = 1;
  198028. const oldTransform = Matrix4_default.clone(camera.transform, tilt3DOldTransform);
  198029. camera._setTransform(transform4);
  198030. rotate3D(controller, startPosition, movement, Cartesian3_default.UNIT_Z);
  198031. camera._setTransform(oldTransform);
  198032. controller._globe = oldGlobe;
  198033. controller._ellipsoid = oldEllipsoid;
  198034. const radius = oldEllipsoid.maximumRadius;
  198035. controller._rotateFactor = 1 / radius;
  198036. controller._rotateRateRangeAdjustment = radius;
  198037. }
  198038. function tilt3DOnTerrain(controller, startPosition, movement) {
  198039. const ellipsoid = controller._ellipsoid;
  198040. const scene = controller._scene;
  198041. const camera = scene.camera;
  198042. const cameraUnderground = controller._cameraUnderground;
  198043. let center;
  198044. let ray;
  198045. let intersection;
  198046. if (Cartesian2_default.equals(startPosition, controller._tiltCenterMousePosition)) {
  198047. center = Cartesian3_default.clone(controller._tiltCenter, tilt3DCenter);
  198048. } else {
  198049. center = pickGlobe(controller, startPosition, tilt3DCenter);
  198050. if (!defined_default(center)) {
  198051. ray = camera.getPickRay(startPosition, tilt3DRay);
  198052. intersection = IntersectionTests_default.rayEllipsoid(ray, ellipsoid);
  198053. if (!defined_default(intersection)) {
  198054. const cartographic2 = ellipsoid.cartesianToCartographic(
  198055. camera.position,
  198056. tilt3DCart
  198057. );
  198058. if (cartographic2.height <= controller._minimumTrackBallHeight) {
  198059. controller._looking = true;
  198060. const up = controller._ellipsoid.geodeticSurfaceNormal(
  198061. camera.position,
  198062. tilt3DLookUp
  198063. );
  198064. look3D(controller, startPosition, movement, up);
  198065. Cartesian2_default.clone(startPosition, controller._tiltCenterMousePosition);
  198066. }
  198067. return;
  198068. }
  198069. center = Ray_default.getPoint(ray, intersection.start, tilt3DCenter);
  198070. }
  198071. if (cameraUnderground) {
  198072. if (!defined_default(ray)) {
  198073. ray = camera.getPickRay(startPosition, tilt3DRay);
  198074. }
  198075. getTiltCenterUnderground(controller, ray, center, center);
  198076. }
  198077. Cartesian2_default.clone(startPosition, controller._tiltCenterMousePosition);
  198078. Cartesian3_default.clone(center, controller._tiltCenter);
  198079. }
  198080. const canvas = scene.canvas;
  198081. const windowPosition = tilt3DWindowPos;
  198082. windowPosition.x = canvas.clientWidth / 2;
  198083. windowPosition.y = controller._tiltCenterMousePosition.y;
  198084. ray = camera.getPickRay(windowPosition, tilt3DRay);
  198085. const mag = Cartesian3_default.magnitude(center);
  198086. const radii = Cartesian3_default.fromElements(mag, mag, mag, scratchRadii3);
  198087. const newEllipsoid = Ellipsoid_default.fromCartesian3(radii, scratchEllipsoid15);
  198088. intersection = IntersectionTests_default.rayEllipsoid(ray, newEllipsoid);
  198089. if (!defined_default(intersection)) {
  198090. return;
  198091. }
  198092. const t = Cartesian3_default.magnitude(ray.origin) > mag ? intersection.start : intersection.stop;
  198093. const verticalCenter = Ray_default.getPoint(ray, t, tilt3DVerticalCenter);
  198094. const transform4 = Transforms_default.eastNorthUpToFixedFrame(
  198095. center,
  198096. ellipsoid,
  198097. tilt3DTransform
  198098. );
  198099. const verticalTransform = Transforms_default.eastNorthUpToFixedFrame(
  198100. verticalCenter,
  198101. newEllipsoid,
  198102. tilt3DVerticalTransform
  198103. );
  198104. const oldGlobe = controller._globe;
  198105. const oldEllipsoid = controller._ellipsoid;
  198106. controller._globe = void 0;
  198107. controller._ellipsoid = Ellipsoid_default.UNIT_SPHERE;
  198108. controller._rotateFactor = 1;
  198109. controller._rotateRateRangeAdjustment = 1;
  198110. let constrainedAxis = Cartesian3_default.UNIT_Z;
  198111. const oldTransform = Matrix4_default.clone(camera.transform, tilt3DOldTransform);
  198112. camera._setTransform(verticalTransform);
  198113. const tangent = Cartesian3_default.cross(
  198114. verticalCenter,
  198115. camera.positionWC,
  198116. tilt3DCartesian3
  198117. );
  198118. const dot2 = Cartesian3_default.dot(camera.rightWC, tangent);
  198119. if (dot2 < 0) {
  198120. const movementDelta = movement.startPosition.y - movement.endPosition.y;
  198121. if (cameraUnderground && movementDelta < 0 || !cameraUnderground && movementDelta > 0) {
  198122. constrainedAxis = void 0;
  198123. }
  198124. const oldConstrainedAxis = camera.constrainedAxis;
  198125. camera.constrainedAxis = void 0;
  198126. rotate3D(controller, startPosition, movement, constrainedAxis, true, false);
  198127. camera.constrainedAxis = oldConstrainedAxis;
  198128. } else {
  198129. rotate3D(controller, startPosition, movement, constrainedAxis, true, false);
  198130. }
  198131. camera._setTransform(transform4);
  198132. rotate3D(controller, startPosition, movement, constrainedAxis, false, true);
  198133. if (defined_default(camera.constrainedAxis)) {
  198134. const right = Cartesian3_default.cross(
  198135. camera.direction,
  198136. camera.constrainedAxis,
  198137. tilt3DCartesian3
  198138. );
  198139. if (!Cartesian3_default.equalsEpsilon(right, Cartesian3_default.ZERO, Math_default.EPSILON6)) {
  198140. if (Cartesian3_default.dot(right, camera.right) < 0) {
  198141. Cartesian3_default.negate(right, right);
  198142. }
  198143. Cartesian3_default.cross(right, camera.direction, camera.up);
  198144. Cartesian3_default.cross(camera.direction, camera.up, camera.right);
  198145. Cartesian3_default.normalize(camera.up, camera.up);
  198146. Cartesian3_default.normalize(camera.right, camera.right);
  198147. }
  198148. }
  198149. camera._setTransform(oldTransform);
  198150. controller._globe = oldGlobe;
  198151. controller._ellipsoid = oldEllipsoid;
  198152. const radius = oldEllipsoid.maximumRadius;
  198153. controller._rotateFactor = 1 / radius;
  198154. controller._rotateRateRangeAdjustment = radius;
  198155. const originalPosition = Cartesian3_default.clone(
  198156. camera.positionWC,
  198157. tilt3DCartesian3
  198158. );
  198159. if (controller.enableCollisionDetection) {
  198160. adjustHeightForTerrain(controller);
  198161. }
  198162. if (!Cartesian3_default.equals(camera.positionWC, originalPosition)) {
  198163. camera._setTransform(verticalTransform);
  198164. camera.worldToCameraCoordinatesPoint(originalPosition, originalPosition);
  198165. const magSqrd = Cartesian3_default.magnitudeSquared(originalPosition);
  198166. if (Cartesian3_default.magnitudeSquared(camera.position) > magSqrd) {
  198167. Cartesian3_default.normalize(camera.position, camera.position);
  198168. Cartesian3_default.multiplyByScalar(
  198169. camera.position,
  198170. Math.sqrt(magSqrd),
  198171. camera.position
  198172. );
  198173. }
  198174. const angle = Cartesian3_default.angleBetween(originalPosition, camera.position);
  198175. const axis = Cartesian3_default.cross(
  198176. originalPosition,
  198177. camera.position,
  198178. originalPosition
  198179. );
  198180. Cartesian3_default.normalize(axis, axis);
  198181. const quaternion = Quaternion_default.fromAxisAngle(axis, angle, tilt3DQuaternion);
  198182. const rotation = Matrix3_default.fromQuaternion(quaternion, tilt3DMatrix);
  198183. Matrix3_default.multiplyByVector(rotation, camera.direction, camera.direction);
  198184. Matrix3_default.multiplyByVector(rotation, camera.up, camera.up);
  198185. Cartesian3_default.cross(camera.direction, camera.up, camera.right);
  198186. Cartesian3_default.cross(camera.right, camera.direction, camera.up);
  198187. camera._setTransform(oldTransform);
  198188. }
  198189. }
  198190. var look3DStartPos = new Cartesian2_default();
  198191. var look3DEndPos = new Cartesian2_default();
  198192. var look3DStartRay = new Ray_default();
  198193. var look3DEndRay = new Ray_default();
  198194. var look3DNegativeRot = new Cartesian3_default();
  198195. var look3DTan = new Cartesian3_default();
  198196. function look3D(controller, startPosition, movement, rotationAxis) {
  198197. const scene = controller._scene;
  198198. const camera = scene.camera;
  198199. const startPos = look3DStartPos;
  198200. startPos.x = movement.startPosition.x;
  198201. startPos.y = 0;
  198202. const endPos = look3DEndPos;
  198203. endPos.x = movement.endPosition.x;
  198204. endPos.y = 0;
  198205. let startRay = camera.getPickRay(startPos, look3DStartRay);
  198206. let endRay = camera.getPickRay(endPos, look3DEndRay);
  198207. let angle = 0;
  198208. let start;
  198209. let end;
  198210. if (camera.frustum instanceof OrthographicFrustum_default) {
  198211. start = startRay.origin;
  198212. end = endRay.origin;
  198213. Cartesian3_default.add(camera.direction, start, start);
  198214. Cartesian3_default.add(camera.direction, end, end);
  198215. Cartesian3_default.subtract(start, camera.position, start);
  198216. Cartesian3_default.subtract(end, camera.position, end);
  198217. Cartesian3_default.normalize(start, start);
  198218. Cartesian3_default.normalize(end, end);
  198219. } else {
  198220. start = startRay.direction;
  198221. end = endRay.direction;
  198222. }
  198223. let dot2 = Cartesian3_default.dot(start, end);
  198224. if (dot2 < 1) {
  198225. angle = Math.acos(dot2);
  198226. }
  198227. angle = movement.startPosition.x > movement.endPosition.x ? -angle : angle;
  198228. const horizontalRotationAxis = controller._horizontalRotationAxis;
  198229. if (defined_default(rotationAxis)) {
  198230. camera.look(rotationAxis, -angle);
  198231. } else if (defined_default(horizontalRotationAxis)) {
  198232. camera.look(horizontalRotationAxis, -angle);
  198233. } else {
  198234. camera.lookLeft(angle);
  198235. }
  198236. startPos.x = 0;
  198237. startPos.y = movement.startPosition.y;
  198238. endPos.x = 0;
  198239. endPos.y = movement.endPosition.y;
  198240. startRay = camera.getPickRay(startPos, look3DStartRay);
  198241. endRay = camera.getPickRay(endPos, look3DEndRay);
  198242. angle = 0;
  198243. if (camera.frustum instanceof OrthographicFrustum_default) {
  198244. start = startRay.origin;
  198245. end = endRay.origin;
  198246. Cartesian3_default.add(camera.direction, start, start);
  198247. Cartesian3_default.add(camera.direction, end, end);
  198248. Cartesian3_default.subtract(start, camera.position, start);
  198249. Cartesian3_default.subtract(end, camera.position, end);
  198250. Cartesian3_default.normalize(start, start);
  198251. Cartesian3_default.normalize(end, end);
  198252. } else {
  198253. start = startRay.direction;
  198254. end = endRay.direction;
  198255. }
  198256. dot2 = Cartesian3_default.dot(start, end);
  198257. if (dot2 < 1) {
  198258. angle = Math.acos(dot2);
  198259. }
  198260. angle = movement.startPosition.y > movement.endPosition.y ? -angle : angle;
  198261. rotationAxis = defaultValue_default(rotationAxis, horizontalRotationAxis);
  198262. if (defined_default(rotationAxis)) {
  198263. const direction2 = camera.direction;
  198264. const negativeRotationAxis = Cartesian3_default.negate(
  198265. rotationAxis,
  198266. look3DNegativeRot
  198267. );
  198268. const northParallel = Cartesian3_default.equalsEpsilon(
  198269. direction2,
  198270. rotationAxis,
  198271. Math_default.EPSILON2
  198272. );
  198273. const southParallel = Cartesian3_default.equalsEpsilon(
  198274. direction2,
  198275. negativeRotationAxis,
  198276. Math_default.EPSILON2
  198277. );
  198278. if (!northParallel && !southParallel) {
  198279. dot2 = Cartesian3_default.dot(direction2, rotationAxis);
  198280. let angleToAxis = Math_default.acosClamped(dot2);
  198281. if (angle > 0 && angle > angleToAxis) {
  198282. angle = angleToAxis - Math_default.EPSILON4;
  198283. }
  198284. dot2 = Cartesian3_default.dot(direction2, negativeRotationAxis);
  198285. angleToAxis = Math_default.acosClamped(dot2);
  198286. if (angle < 0 && -angle > angleToAxis) {
  198287. angle = -angleToAxis + Math_default.EPSILON4;
  198288. }
  198289. const tangent = Cartesian3_default.cross(rotationAxis, direction2, look3DTan);
  198290. camera.look(tangent, angle);
  198291. } else if (northParallel && angle < 0 || southParallel && angle > 0) {
  198292. camera.look(camera.right, -angle);
  198293. }
  198294. } else {
  198295. camera.lookUp(angle);
  198296. }
  198297. }
  198298. function update3D(controller) {
  198299. reactToInput(
  198300. controller,
  198301. controller.enableRotate,
  198302. controller.rotateEventTypes,
  198303. spin3D,
  198304. controller.inertiaSpin,
  198305. "_lastInertiaSpinMovement"
  198306. );
  198307. reactToInput(
  198308. controller,
  198309. controller.enableZoom,
  198310. controller.zoomEventTypes,
  198311. zoom3D2,
  198312. controller.inertiaZoom,
  198313. "_lastInertiaZoomMovement"
  198314. );
  198315. reactToInput(
  198316. controller,
  198317. controller.enableTilt,
  198318. controller.tiltEventTypes,
  198319. tilt3D,
  198320. controller.inertiaSpin,
  198321. "_lastInertiaTiltMovement"
  198322. );
  198323. reactToInput(
  198324. controller,
  198325. controller.enableLook,
  198326. controller.lookEventTypes,
  198327. look3D
  198328. );
  198329. }
  198330. var scratchAdjustHeightTransform = new Matrix4_default();
  198331. var scratchAdjustHeightCartographic = new Cartographic_default();
  198332. function adjustHeightForTerrain(controller) {
  198333. controller._adjustedHeightForTerrain = true;
  198334. const scene = controller._scene;
  198335. const mode2 = scene.mode;
  198336. const globe = scene.globe;
  198337. if (!defined_default(globe) || mode2 === SceneMode_default.SCENE2D || mode2 === SceneMode_default.MORPHING) {
  198338. return;
  198339. }
  198340. const camera = scene.camera;
  198341. const ellipsoid = globe.ellipsoid;
  198342. const projection = scene.mapProjection;
  198343. let transform4;
  198344. let mag;
  198345. if (!Matrix4_default.equals(camera.transform, Matrix4_default.IDENTITY)) {
  198346. transform4 = Matrix4_default.clone(camera.transform, scratchAdjustHeightTransform);
  198347. mag = Cartesian3_default.magnitude(camera.position);
  198348. camera._setTransform(Matrix4_default.IDENTITY);
  198349. }
  198350. const cartographic2 = scratchAdjustHeightCartographic;
  198351. if (mode2 === SceneMode_default.SCENE3D) {
  198352. ellipsoid.cartesianToCartographic(camera.position, cartographic2);
  198353. } else {
  198354. projection.unproject(camera.position, cartographic2);
  198355. }
  198356. let heightUpdated = false;
  198357. if (cartographic2.height < controller._minimumCollisionTerrainHeight) {
  198358. const globeHeight = controller._scene.globeHeight;
  198359. if (defined_default(globeHeight)) {
  198360. const height = globeHeight + controller.minimumZoomDistance;
  198361. if (cartographic2.height < height) {
  198362. cartographic2.height = height;
  198363. if (mode2 === SceneMode_default.SCENE3D) {
  198364. ellipsoid.cartographicToCartesian(cartographic2, camera.position);
  198365. } else {
  198366. projection.project(cartographic2, camera.position);
  198367. }
  198368. heightUpdated = true;
  198369. }
  198370. }
  198371. }
  198372. if (defined_default(transform4)) {
  198373. camera._setTransform(transform4);
  198374. if (heightUpdated) {
  198375. Cartesian3_default.normalize(camera.position, camera.position);
  198376. Cartesian3_default.negate(camera.position, camera.direction);
  198377. Cartesian3_default.multiplyByScalar(
  198378. camera.position,
  198379. Math.max(mag, controller.minimumZoomDistance),
  198380. camera.position
  198381. );
  198382. Cartesian3_default.normalize(camera.direction, camera.direction);
  198383. Cartesian3_default.cross(camera.direction, camera.up, camera.right);
  198384. Cartesian3_default.cross(camera.right, camera.direction, camera.up);
  198385. }
  198386. }
  198387. }
  198388. ScreenSpaceCameraController.prototype.onMap = function() {
  198389. const scene = this._scene;
  198390. const mode2 = scene.mode;
  198391. const camera = scene.camera;
  198392. if (mode2 === SceneMode_default.COLUMBUS_VIEW) {
  198393. return Math.abs(camera.position.x) - this._maxCoord.x < 0 && Math.abs(camera.position.y) - this._maxCoord.y < 0;
  198394. }
  198395. return true;
  198396. };
  198397. var scratchPreviousPosition = new Cartesian3_default();
  198398. var scratchPreviousDirection = new Cartesian3_default();
  198399. ScreenSpaceCameraController.prototype.update = function() {
  198400. const scene = this._scene;
  198401. const camera = scene.camera;
  198402. const globe = scene.globe;
  198403. const mode2 = scene.mode;
  198404. if (!Matrix4_default.equals(camera.transform, Matrix4_default.IDENTITY)) {
  198405. this._globe = void 0;
  198406. this._ellipsoid = Ellipsoid_default.UNIT_SPHERE;
  198407. } else {
  198408. this._globe = globe;
  198409. this._ellipsoid = defined_default(this._globe) ? this._globe.ellipsoid : scene.mapProjection.ellipsoid;
  198410. }
  198411. const exaggeration = defined_default(this._globe) ? this._globe.terrainExaggeration : 1;
  198412. const exaggerationRelativeHeight = defined_default(this._globe) ? this._globe.terrainExaggerationRelativeHeight : 0;
  198413. this._minimumCollisionTerrainHeight = TerrainExaggeration_default.getHeight(
  198414. this.minimumCollisionTerrainHeight,
  198415. exaggeration,
  198416. exaggerationRelativeHeight
  198417. );
  198418. this._minimumPickingTerrainHeight = TerrainExaggeration_default.getHeight(
  198419. this.minimumPickingTerrainHeight,
  198420. exaggeration,
  198421. exaggerationRelativeHeight
  198422. );
  198423. this._minimumTrackBallHeight = TerrainExaggeration_default.getHeight(
  198424. this.minimumTrackBallHeight,
  198425. exaggeration,
  198426. exaggerationRelativeHeight
  198427. );
  198428. this._cameraUnderground = scene.cameraUnderground && defined_default(this._globe);
  198429. const radius = this._ellipsoid.maximumRadius;
  198430. this._rotateFactor = 1 / radius;
  198431. this._rotateRateRangeAdjustment = radius;
  198432. this._adjustedHeightForTerrain = false;
  198433. const previousPosition = Cartesian3_default.clone(
  198434. camera.positionWC,
  198435. scratchPreviousPosition
  198436. );
  198437. const previousDirection = Cartesian3_default.clone(
  198438. camera.directionWC,
  198439. scratchPreviousDirection
  198440. );
  198441. if (mode2 === SceneMode_default.SCENE2D) {
  198442. update2D(this);
  198443. } else if (mode2 === SceneMode_default.COLUMBUS_VIEW) {
  198444. this._horizontalRotationAxis = Cartesian3_default.UNIT_Z;
  198445. updateCV(this);
  198446. } else if (mode2 === SceneMode_default.SCENE3D) {
  198447. this._horizontalRotationAxis = void 0;
  198448. update3D(this);
  198449. }
  198450. if (this.enableCollisionDetection && !this._adjustedHeightForTerrain) {
  198451. const cameraChanged = !Cartesian3_default.equals(previousPosition, camera.positionWC) || !Cartesian3_default.equals(previousDirection, camera.directionWC);
  198452. if (cameraChanged) {
  198453. adjustHeightForTerrain(this);
  198454. }
  198455. }
  198456. this._aggregator.reset();
  198457. };
  198458. ScreenSpaceCameraController.prototype.isDestroyed = function() {
  198459. return false;
  198460. };
  198461. ScreenSpaceCameraController.prototype.destroy = function() {
  198462. this._tweens.removeAll();
  198463. this._aggregator = this._aggregator && this._aggregator.destroy();
  198464. return destroyObject_default(this);
  198465. };
  198466. var ScreenSpaceCameraController_default = ScreenSpaceCameraController;
  198467. // node_modules/cesium/Source/Shaders/PostProcessStages/AdditiveBlend.js
  198468. var AdditiveBlend_default = "uniform sampler2D colorTexture;\nuniform sampler2D colorTexture2;\n\nuniform vec2 center;\nuniform float radius;\n\nvarying vec2 v_textureCoordinates;\n\nvoid main()\n{\n vec4 color0 = texture2D(colorTexture, v_textureCoordinates);\n vec4 color1 = texture2D(colorTexture2, v_textureCoordinates);\n\n float x = length(gl_FragCoord.xy - center) / radius;\n float t = smoothstep(0.5, 0.8, x);\n gl_FragColor = mix(color0 + color1, color1, t);\n}\n";
  198469. // node_modules/cesium/Source/Shaders/PostProcessStages/BrightPass.js
  198470. var BrightPass_default = 'uniform sampler2D colorTexture;\n\nuniform float avgLuminance;\nuniform float threshold;\nuniform float offset;\n\nvarying vec2 v_textureCoordinates;\n\nfloat key(float avg)\n{\n float guess = 1.5 - (1.5 / (avg * 0.1 + 1.0));\n return max(0.0, guess) + 0.1;\n}\n\n// See section 9. "The bright-pass filter" of Realtime HDR Rendering\n// http://www.cg.tuwien.ac.at/research/publications/2007/Luksch_2007_RHR/Luksch_2007_RHR-RealtimeHDR%20.pdf\n\nvoid main()\n{\n vec4 color = texture2D(colorTexture, v_textureCoordinates);\n vec3 xyz = czm_RGBToXYZ(color.rgb);\n float luminance = xyz.r;\n\n float scaledLum = key(avgLuminance) * luminance / avgLuminance;\n float brightLum = max(scaledLum - threshold, 0.0);\n float brightness = brightLum / (offset + brightLum);\n\n xyz.r = brightness;\n gl_FragColor = vec4(czm_XYZToRGB(xyz), 1.0);\n}\n';
  198471. // node_modules/cesium/Source/Scene/SunPostProcess.js
  198472. function SunPostProcess() {
  198473. this._sceneFramebuffer = new SceneFramebuffer_default();
  198474. const scale = 0.125;
  198475. const stages = new Array(6);
  198476. stages[0] = new PostProcessStage_default({
  198477. fragmentShader: PassThrough_default,
  198478. textureScale: scale,
  198479. forcePowerOfTwo: true,
  198480. sampleMode: PostProcessStageSampleMode_default.LINEAR
  198481. });
  198482. const brightPass = stages[1] = new PostProcessStage_default({
  198483. fragmentShader: BrightPass_default,
  198484. uniforms: {
  198485. avgLuminance: 0.5,
  198486. threshold: 0.25,
  198487. offset: 0.1
  198488. },
  198489. textureScale: scale,
  198490. forcePowerOfTwo: true
  198491. });
  198492. const that = this;
  198493. this._delta = 1;
  198494. this._sigma = 2;
  198495. this._blurStep = new Cartesian2_default();
  198496. stages[2] = new PostProcessStage_default({
  198497. fragmentShader: GaussianBlur1D_default,
  198498. uniforms: {
  198499. step: function() {
  198500. that._blurStep.x = that._blurStep.y = 1 / brightPass.outputTexture.width;
  198501. return that._blurStep;
  198502. },
  198503. delta: function() {
  198504. return that._delta;
  198505. },
  198506. sigma: function() {
  198507. return that._sigma;
  198508. },
  198509. direction: 0
  198510. },
  198511. textureScale: scale,
  198512. forcePowerOfTwo: true
  198513. });
  198514. stages[3] = new PostProcessStage_default({
  198515. fragmentShader: GaussianBlur1D_default,
  198516. uniforms: {
  198517. step: function() {
  198518. that._blurStep.x = that._blurStep.y = 1 / brightPass.outputTexture.width;
  198519. return that._blurStep;
  198520. },
  198521. delta: function() {
  198522. return that._delta;
  198523. },
  198524. sigma: function() {
  198525. return that._sigma;
  198526. },
  198527. direction: 1
  198528. },
  198529. textureScale: scale,
  198530. forcePowerOfTwo: true
  198531. });
  198532. stages[4] = new PostProcessStage_default({
  198533. fragmentShader: PassThrough_default,
  198534. sampleMode: PostProcessStageSampleMode_default.LINEAR
  198535. });
  198536. this._uCenter = new Cartesian2_default();
  198537. this._uRadius = void 0;
  198538. stages[5] = new PostProcessStage_default({
  198539. fragmentShader: AdditiveBlend_default,
  198540. uniforms: {
  198541. center: function() {
  198542. return that._uCenter;
  198543. },
  198544. radius: function() {
  198545. return that._uRadius;
  198546. },
  198547. colorTexture2: function() {
  198548. return that._sceneFramebuffer.framebuffer.getColorTexture(0);
  198549. }
  198550. }
  198551. });
  198552. this._stages = new PostProcessStageComposite_default({
  198553. stages
  198554. });
  198555. const textureCache = new PostProcessStageTextureCache_default(this);
  198556. const length3 = stages.length;
  198557. for (let i2 = 0; i2 < length3; ++i2) {
  198558. stages[i2]._textureCache = textureCache;
  198559. }
  198560. this._textureCache = textureCache;
  198561. this.length = stages.length;
  198562. }
  198563. SunPostProcess.prototype.get = function(index2) {
  198564. return this._stages.get(index2);
  198565. };
  198566. SunPostProcess.prototype.getStageByName = function(name) {
  198567. const length3 = this._stages.length;
  198568. for (let i2 = 0; i2 < length3; ++i2) {
  198569. const stage = this._stages.get(i2);
  198570. if (stage.name === name) {
  198571. return stage;
  198572. }
  198573. }
  198574. return void 0;
  198575. };
  198576. var sunPositionECScratch = new Cartesian4_default();
  198577. var sunPositionWCScratch = new Cartesian2_default();
  198578. var sizeScratch = new Cartesian2_default();
  198579. var postProcessMatrix4Scratch = new Matrix4_default();
  198580. function updateSunPosition(postProcess, context, viewport) {
  198581. const us = context.uniformState;
  198582. const sunPosition = us.sunPositionWC;
  198583. const viewMatrix = us.view;
  198584. const viewProjectionMatrix = us.viewProjection;
  198585. const projectionMatrix = us.projection;
  198586. let viewportTransformation = Matrix4_default.computeViewportTransformation(
  198587. viewport,
  198588. 0,
  198589. 1,
  198590. postProcessMatrix4Scratch
  198591. );
  198592. const sunPositionEC = Matrix4_default.multiplyByPoint(
  198593. viewMatrix,
  198594. sunPosition,
  198595. sunPositionECScratch
  198596. );
  198597. let sunPositionWC = Transforms_default.pointToGLWindowCoordinates(
  198598. viewProjectionMatrix,
  198599. viewportTransformation,
  198600. sunPosition,
  198601. sunPositionWCScratch
  198602. );
  198603. sunPositionEC.x += Math_default.SOLAR_RADIUS;
  198604. const limbWC = Transforms_default.pointToGLWindowCoordinates(
  198605. projectionMatrix,
  198606. viewportTransformation,
  198607. sunPositionEC,
  198608. sunPositionEC
  198609. );
  198610. const sunSize = Cartesian2_default.magnitude(Cartesian2_default.subtract(limbWC, sunPositionWC, limbWC)) * 30 * 2;
  198611. const size = sizeScratch;
  198612. size.x = sunSize;
  198613. size.y = sunSize;
  198614. postProcess._uCenter = Cartesian2_default.clone(sunPositionWC, postProcess._uCenter);
  198615. postProcess._uRadius = Math.max(size.x, size.y) * 0.15;
  198616. const width = context.drawingBufferWidth;
  198617. const height = context.drawingBufferHeight;
  198618. const stages = postProcess._stages;
  198619. const firstStage = stages.get(0);
  198620. const downSampleWidth = firstStage.outputTexture.width;
  198621. const downSampleHeight = firstStage.outputTexture.height;
  198622. const downSampleViewport = new BoundingRectangle_default();
  198623. downSampleViewport.width = downSampleWidth;
  198624. downSampleViewport.height = downSampleHeight;
  198625. viewportTransformation = Matrix4_default.computeViewportTransformation(
  198626. downSampleViewport,
  198627. 0,
  198628. 1,
  198629. postProcessMatrix4Scratch
  198630. );
  198631. sunPositionWC = Transforms_default.pointToGLWindowCoordinates(
  198632. viewProjectionMatrix,
  198633. viewportTransformation,
  198634. sunPosition,
  198635. sunPositionWCScratch
  198636. );
  198637. size.x *= downSampleWidth / width;
  198638. size.y *= downSampleHeight / height;
  198639. const scissorRectangle = firstStage.scissorRectangle;
  198640. scissorRectangle.x = Math.max(sunPositionWC.x - size.x * 0.5, 0);
  198641. scissorRectangle.y = Math.max(sunPositionWC.y - size.y * 0.5, 0);
  198642. scissorRectangle.width = Math.min(size.x, width);
  198643. scissorRectangle.height = Math.min(size.y, height);
  198644. for (let i2 = 1; i2 < 4; ++i2) {
  198645. BoundingRectangle_default.clone(scissorRectangle, stages.get(i2).scissorRectangle);
  198646. }
  198647. }
  198648. SunPostProcess.prototype.clear = function(context, passState, clearColor) {
  198649. this._sceneFramebuffer.clear(context, passState, clearColor);
  198650. this._textureCache.clear(context);
  198651. };
  198652. SunPostProcess.prototype.update = function(passState) {
  198653. const context = passState.context;
  198654. const viewport = passState.viewport;
  198655. const sceneFramebuffer = this._sceneFramebuffer;
  198656. sceneFramebuffer.update(context, viewport);
  198657. const framebuffer = sceneFramebuffer.framebuffer;
  198658. this._textureCache.update(context);
  198659. this._stages.update(context, false);
  198660. updateSunPosition(this, context, viewport);
  198661. return framebuffer;
  198662. };
  198663. SunPostProcess.prototype.execute = function(context) {
  198664. const colorTexture = this._sceneFramebuffer.framebuffer.getColorTexture(0);
  198665. const stages = this._stages;
  198666. const length3 = stages.length;
  198667. stages.get(0).execute(context, colorTexture);
  198668. for (let i2 = 1; i2 < length3; ++i2) {
  198669. stages.get(i2).execute(context, stages.get(i2 - 1).outputTexture);
  198670. }
  198671. };
  198672. SunPostProcess.prototype.copy = function(context, framebuffer) {
  198673. if (!defined_default(this._copyColorCommand)) {
  198674. const that = this;
  198675. this._copyColorCommand = context.createViewportQuadCommand(PassThrough_default, {
  198676. uniformMap: {
  198677. colorTexture: function() {
  198678. return that._stages.get(that._stages.length - 1).outputTexture;
  198679. }
  198680. },
  198681. owner: this
  198682. });
  198683. }
  198684. this._copyColorCommand.framebuffer = framebuffer;
  198685. this._copyColorCommand.execute(context);
  198686. };
  198687. SunPostProcess.prototype.isDestroyed = function() {
  198688. return false;
  198689. };
  198690. SunPostProcess.prototype.destroy = function() {
  198691. this._textureCache.destroy();
  198692. this._stages.destroy();
  198693. return destroyObject_default(this);
  198694. };
  198695. var SunPostProcess_default = SunPostProcess;
  198696. // node_modules/cesium/Source/Scene/Scene.js
  198697. var requestRenderAfterFrame = function(scene) {
  198698. return function() {
  198699. scene.frameState.afterRender.push(function() {
  198700. scene.requestRender();
  198701. });
  198702. };
  198703. };
  198704. function Scene4(options) {
  198705. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  198706. const canvas = options.canvas;
  198707. let creditContainer = options.creditContainer;
  198708. let creditViewport = options.creditViewport;
  198709. let contextOptions = clone_default(options.contextOptions);
  198710. if (!defined_default(contextOptions)) {
  198711. contextOptions = {};
  198712. }
  198713. if (!defined_default(contextOptions.webgl)) {
  198714. contextOptions.webgl = {};
  198715. }
  198716. contextOptions.webgl.powerPreference = defaultValue_default(
  198717. contextOptions.webgl.powerPreference,
  198718. "high-performance"
  198719. );
  198720. if (!defined_default(canvas)) {
  198721. throw new DeveloperError_default("options and options.canvas are required.");
  198722. }
  198723. const hasCreditContainer = defined_default(creditContainer);
  198724. const context = new Context_default(canvas, contextOptions);
  198725. if (!hasCreditContainer) {
  198726. creditContainer = document.createElement("div");
  198727. creditContainer.style.position = "absolute";
  198728. creditContainer.style.bottom = "0";
  198729. creditContainer.style["text-shadow"] = "0 0 2px #000000";
  198730. creditContainer.style.color = "#ffffff";
  198731. creditContainer.style["font-size"] = "10px";
  198732. creditContainer.style["padding-right"] = "5px";
  198733. canvas.parentNode.appendChild(creditContainer);
  198734. }
  198735. if (!defined_default(creditViewport)) {
  198736. creditViewport = canvas.parentNode;
  198737. }
  198738. this._id = createGuid_default();
  198739. this._jobScheduler = new JobScheduler_default();
  198740. this._frameState = new FrameState_default(
  198741. context,
  198742. new CreditDisplay_default(creditContainer, " \u2022 ", creditViewport),
  198743. this._jobScheduler
  198744. );
  198745. this._frameState.scene3DOnly = defaultValue_default(options.scene3DOnly, false);
  198746. this._removeCreditContainer = !hasCreditContainer;
  198747. this._creditContainer = creditContainer;
  198748. this._canvas = canvas;
  198749. this._context = context;
  198750. this._computeEngine = new ComputeEngine_default(context);
  198751. this._globe = void 0;
  198752. this._globeTranslucencyState = new GlobeTranslucencyState_default();
  198753. this._primitives = new PrimitiveCollection_default();
  198754. this._groundPrimitives = new PrimitiveCollection_default();
  198755. this._globeHeight = void 0;
  198756. this._cameraUnderground = false;
  198757. this._logDepthBuffer = context.fragmentDepth;
  198758. this._logDepthBufferDirty = true;
  198759. this._tweens = new TweenCollection_default();
  198760. this._shaderFrameCount = 0;
  198761. this._sunPostProcess = void 0;
  198762. this._computeCommandList = [];
  198763. this._overlayCommandList = [];
  198764. const defaultOIT = !FeatureDetection_default.isIPadOrIOS();
  198765. this._useOIT = defaultValue_default(options.orderIndependentTranslucency, defaultOIT);
  198766. this._executeOITFunction = void 0;
  198767. this._depthPlane = new DepthPlane_default(options.depthPlaneEllipsoidOffset);
  198768. this._clearColorCommand = new ClearCommand_default({
  198769. color: new Color_default(),
  198770. stencil: 0,
  198771. owner: this
  198772. });
  198773. this._depthClearCommand = new ClearCommand_default({
  198774. depth: 1,
  198775. owner: this
  198776. });
  198777. this._stencilClearCommand = new ClearCommand_default({
  198778. stencil: 0
  198779. });
  198780. this._classificationStencilClearCommand = new ClearCommand_default({
  198781. stencil: 0,
  198782. renderState: RenderState_default.fromCache({
  198783. stencilMask: StencilConstants_default.CLASSIFICATION_MASK
  198784. })
  198785. });
  198786. this._depthOnlyRenderStateCache = {};
  198787. this._transitioner = new SceneTransitioner_default(this);
  198788. this._preUpdate = new Event_default();
  198789. this._postUpdate = new Event_default();
  198790. this._renderError = new Event_default();
  198791. this._preRender = new Event_default();
  198792. this._postRender = new Event_default();
  198793. this._minimumDisableDepthTestDistance = 0;
  198794. this._debugInspector = new DebugInspector_default();
  198795. this._msaaSamples = defaultValue_default(options.msaaSamples, 1);
  198796. this.rethrowRenderErrors = false;
  198797. this.completeMorphOnUserInput = true;
  198798. this.morphStart = new Event_default();
  198799. this.morphComplete = new Event_default();
  198800. this.skyBox = void 0;
  198801. this.skyAtmosphere = void 0;
  198802. this.sun = void 0;
  198803. this.sunBloom = true;
  198804. this._sunBloom = void 0;
  198805. this.moon = void 0;
  198806. this.backgroundColor = Color_default.clone(Color_default.BLACK);
  198807. this._mode = SceneMode_default.SCENE3D;
  198808. this._mapProjection = defined_default(options.mapProjection) ? options.mapProjection : new GeographicProjection_default();
  198809. this.morphTime = 1;
  198810. this.farToNearRatio = 1e3;
  198811. this.logarithmicDepthFarToNearRatio = 1e9;
  198812. this.nearToFarDistance2D = 175e4;
  198813. this.debugCommandFilter = void 0;
  198814. this.debugShowCommands = false;
  198815. this.debugShowFrustums = false;
  198816. this.debugShowFramesPerSecond = false;
  198817. this.debugShowDepthFrustum = 1;
  198818. this.debugShowFrustumPlanes = false;
  198819. this._debugShowFrustumPlanes = false;
  198820. this._debugFrustumPlanes = void 0;
  198821. this.useDepthPicking = true;
  198822. this.pickTranslucentDepth = false;
  198823. this.cameraEventWaitTime = 500;
  198824. this.fog = new Fog_default();
  198825. this._shadowMapCamera = new Camera_default(this);
  198826. this.shadowMap = new ShadowMap_default({
  198827. context,
  198828. lightCamera: this._shadowMapCamera,
  198829. enabled: defaultValue_default(options.shadows, false)
  198830. });
  198831. this.invertClassification = false;
  198832. this.invertClassificationColor = Color_default.clone(Color_default.WHITE);
  198833. this._actualInvertClassificationColor = Color_default.clone(
  198834. this._invertClassificationColor
  198835. );
  198836. this._invertClassification = new InvertClassification_default();
  198837. this.focalLength = void 0;
  198838. this.eyeSeparation = void 0;
  198839. this.postProcessStages = new PostProcessStageCollection_default();
  198840. this._brdfLutGenerator = new BrdfLutGenerator_default();
  198841. this._performanceDisplay = void 0;
  198842. this._debugVolume = void 0;
  198843. this._screenSpaceCameraController = new ScreenSpaceCameraController_default(this);
  198844. this._cameraUnderground = false;
  198845. this._mapMode2D = defaultValue_default(options.mapMode2D, MapMode2D_default.INFINITE_SCROLL);
  198846. this._environmentState = {
  198847. skyBoxCommand: void 0,
  198848. skyAtmosphereCommand: void 0,
  198849. sunDrawCommand: void 0,
  198850. sunComputeCommand: void 0,
  198851. moonCommand: void 0,
  198852. isSunVisible: false,
  198853. isMoonVisible: false,
  198854. isReadyForAtmosphere: false,
  198855. isSkyAtmosphereVisible: false,
  198856. clearGlobeDepth: false,
  198857. useDepthPlane: false,
  198858. renderTranslucentDepthForPick: false,
  198859. originalFramebuffer: void 0,
  198860. useGlobeDepthFramebuffer: false,
  198861. useOIT: false,
  198862. useInvertClassification: false,
  198863. usePostProcess: false,
  198864. usePostProcessSelected: false,
  198865. useWebVR: false
  198866. };
  198867. this._useWebVR = false;
  198868. this._cameraVR = void 0;
  198869. this._aspectRatioVR = void 0;
  198870. this.requestRenderMode = defaultValue_default(options.requestRenderMode, false);
  198871. this._renderRequested = true;
  198872. this.maximumRenderTimeChange = defaultValue_default(
  198873. options.maximumRenderTimeChange,
  198874. 0
  198875. );
  198876. this._lastRenderTime = void 0;
  198877. this._frameRateMonitor = void 0;
  198878. this._removeRequestListenerCallback = RequestScheduler_default.requestCompletedEvent.addEventListener(
  198879. requestRenderAfterFrame(this)
  198880. );
  198881. this._removeTaskProcessorListenerCallback = TaskProcessor_default.taskCompletedEvent.addEventListener(
  198882. requestRenderAfterFrame(this)
  198883. );
  198884. this._removeGlobeCallbacks = [];
  198885. const viewport = new BoundingRectangle_default(
  198886. 0,
  198887. 0,
  198888. context.drawingBufferWidth,
  198889. context.drawingBufferHeight
  198890. );
  198891. const camera = new Camera_default(this);
  198892. if (this._logDepthBuffer) {
  198893. camera.frustum.near = 0.1;
  198894. camera.frustum.far = 1e10;
  198895. }
  198896. this.preloadFlightCamera = new Camera_default(this);
  198897. this.preloadFlightCullingVolume = void 0;
  198898. this._picking = new Picking_default(this);
  198899. this._defaultView = new View_default(this, camera, viewport);
  198900. this._view = this._defaultView;
  198901. this._hdr = void 0;
  198902. this._hdrDirty = void 0;
  198903. this.highDynamicRange = false;
  198904. this.gamma = 2.2;
  198905. this.sphericalHarmonicCoefficients = void 0;
  198906. this.specularEnvironmentMaps = void 0;
  198907. this._specularEnvironmentMapAtlas = void 0;
  198908. this.light = new SunLight_default();
  198909. updateFrameNumber(this, 0, JulianDate_default.now());
  198910. this.updateFrameState();
  198911. this.initializeFrame();
  198912. }
  198913. function updateGlobeListeners(scene, globe) {
  198914. for (let i2 = 0; i2 < scene._removeGlobeCallbacks.length; ++i2) {
  198915. scene._removeGlobeCallbacks[i2]();
  198916. }
  198917. scene._removeGlobeCallbacks.length = 0;
  198918. const removeGlobeCallbacks = [];
  198919. if (defined_default(globe)) {
  198920. removeGlobeCallbacks.push(
  198921. globe.imageryLayersUpdatedEvent.addEventListener(
  198922. requestRenderAfterFrame(scene)
  198923. )
  198924. );
  198925. removeGlobeCallbacks.push(
  198926. globe.terrainProviderChanged.addEventListener(
  198927. requestRenderAfterFrame(scene)
  198928. )
  198929. );
  198930. }
  198931. scene._removeGlobeCallbacks = removeGlobeCallbacks;
  198932. }
  198933. Object.defineProperties(Scene4.prototype, {
  198934. canvas: {
  198935. get: function() {
  198936. return this._canvas;
  198937. }
  198938. },
  198939. drawingBufferHeight: {
  198940. get: function() {
  198941. return this._context.drawingBufferHeight;
  198942. }
  198943. },
  198944. drawingBufferWidth: {
  198945. get: function() {
  198946. return this._context.drawingBufferWidth;
  198947. }
  198948. },
  198949. maximumAliasedLineWidth: {
  198950. get: function() {
  198951. return ContextLimits_default.maximumAliasedLineWidth;
  198952. }
  198953. },
  198954. maximumCubeMapSize: {
  198955. get: function() {
  198956. return ContextLimits_default.maximumCubeMapSize;
  198957. }
  198958. },
  198959. pickPositionSupported: {
  198960. get: function() {
  198961. return this._context.depthTexture;
  198962. }
  198963. },
  198964. sampleHeightSupported: {
  198965. get: function() {
  198966. return this._context.depthTexture;
  198967. }
  198968. },
  198969. clampToHeightSupported: {
  198970. get: function() {
  198971. return this._context.depthTexture;
  198972. }
  198973. },
  198974. invertClassificationSupported: {
  198975. get: function() {
  198976. return this._context.depthTexture;
  198977. }
  198978. },
  198979. specularEnvironmentMapsSupported: {
  198980. get: function() {
  198981. return OctahedralProjectedCubeMap_default.isSupported(this._context);
  198982. }
  198983. },
  198984. globe: {
  198985. get: function() {
  198986. return this._globe;
  198987. },
  198988. set: function(globe) {
  198989. this._globe = this._globe && this._globe.destroy();
  198990. this._globe = globe;
  198991. updateGlobeListeners(this, globe);
  198992. }
  198993. },
  198994. primitives: {
  198995. get: function() {
  198996. return this._primitives;
  198997. }
  198998. },
  198999. groundPrimitives: {
  199000. get: function() {
  199001. return this._groundPrimitives;
  199002. }
  199003. },
  199004. camera: {
  199005. get: function() {
  199006. return this._view.camera;
  199007. },
  199008. set: function(camera) {
  199009. this._view.camera = camera;
  199010. }
  199011. },
  199012. view: {
  199013. get: function() {
  199014. return this._view;
  199015. },
  199016. set: function(view) {
  199017. this._view = view;
  199018. }
  199019. },
  199020. defaultView: {
  199021. get: function() {
  199022. return this._defaultView;
  199023. }
  199024. },
  199025. picking: {
  199026. get: function() {
  199027. return this._picking;
  199028. }
  199029. },
  199030. screenSpaceCameraController: {
  199031. get: function() {
  199032. return this._screenSpaceCameraController;
  199033. }
  199034. },
  199035. mapProjection: {
  199036. get: function() {
  199037. return this._mapProjection;
  199038. }
  199039. },
  199040. jobScheduler: {
  199041. get: function() {
  199042. return this._jobScheduler;
  199043. }
  199044. },
  199045. frameState: {
  199046. get: function() {
  199047. return this._frameState;
  199048. }
  199049. },
  199050. environmentState: {
  199051. get: function() {
  199052. return this._environmentState;
  199053. }
  199054. },
  199055. tweens: {
  199056. get: function() {
  199057. return this._tweens;
  199058. }
  199059. },
  199060. imageryLayers: {
  199061. get: function() {
  199062. if (!defined_default(this.globe)) {
  199063. return void 0;
  199064. }
  199065. return this.globe.imageryLayers;
  199066. }
  199067. },
  199068. terrainProvider: {
  199069. get: function() {
  199070. if (!defined_default(this.globe)) {
  199071. return void 0;
  199072. }
  199073. return this.globe.terrainProvider;
  199074. },
  199075. set: function(terrainProvider) {
  199076. if (defined_default(this.globe)) {
  199077. this.globe.terrainProvider = terrainProvider;
  199078. }
  199079. }
  199080. },
  199081. terrainProviderChanged: {
  199082. get: function() {
  199083. if (!defined_default(this.globe)) {
  199084. return void 0;
  199085. }
  199086. return this.globe.terrainProviderChanged;
  199087. }
  199088. },
  199089. preUpdate: {
  199090. get: function() {
  199091. return this._preUpdate;
  199092. }
  199093. },
  199094. postUpdate: {
  199095. get: function() {
  199096. return this._postUpdate;
  199097. }
  199098. },
  199099. renderError: {
  199100. get: function() {
  199101. return this._renderError;
  199102. }
  199103. },
  199104. preRender: {
  199105. get: function() {
  199106. return this._preRender;
  199107. }
  199108. },
  199109. postRender: {
  199110. get: function() {
  199111. return this._postRender;
  199112. }
  199113. },
  199114. lastRenderTime: {
  199115. get: function() {
  199116. return this._lastRenderTime;
  199117. }
  199118. },
  199119. context: {
  199120. get: function() {
  199121. return this._context;
  199122. }
  199123. },
  199124. debugFrustumStatistics: {
  199125. get: function() {
  199126. return this._view.debugFrustumStatistics;
  199127. }
  199128. },
  199129. scene3DOnly: {
  199130. get: function() {
  199131. return this._frameState.scene3DOnly;
  199132. }
  199133. },
  199134. orderIndependentTranslucency: {
  199135. get: function() {
  199136. return this._useOIT;
  199137. }
  199138. },
  199139. id: {
  199140. get: function() {
  199141. return this._id;
  199142. }
  199143. },
  199144. mode: {
  199145. get: function() {
  199146. return this._mode;
  199147. },
  199148. set: function(value) {
  199149. if (this.scene3DOnly && value !== SceneMode_default.SCENE3D) {
  199150. throw new DeveloperError_default(
  199151. "Only SceneMode.SCENE3D is valid when scene3DOnly is true."
  199152. );
  199153. }
  199154. if (value === SceneMode_default.SCENE2D) {
  199155. this.morphTo2D(0);
  199156. } else if (value === SceneMode_default.SCENE3D) {
  199157. this.morphTo3D(0);
  199158. } else if (value === SceneMode_default.COLUMBUS_VIEW) {
  199159. this.morphToColumbusView(0);
  199160. } else {
  199161. throw new DeveloperError_default(
  199162. "value must be a valid SceneMode enumeration."
  199163. );
  199164. }
  199165. this._mode = value;
  199166. }
  199167. },
  199168. frustumCommandsList: {
  199169. get: function() {
  199170. return this._view.frustumCommandsList;
  199171. }
  199172. },
  199173. numberOfFrustums: {
  199174. get: function() {
  199175. return this._view.frustumCommandsList.length;
  199176. }
  199177. },
  199178. useWebVR: {
  199179. get: function() {
  199180. return this._useWebVR;
  199181. },
  199182. set: function(value) {
  199183. if (this.camera.frustum instanceof OrthographicFrustum_default) {
  199184. throw new DeveloperError_default(
  199185. "VR is unsupported with an orthographic projection."
  199186. );
  199187. }
  199188. this._useWebVR = value;
  199189. if (this._useWebVR) {
  199190. this._frameState.creditDisplay.container.style.visibility = "hidden";
  199191. this._cameraVR = new Camera_default(this);
  199192. if (!defined_default(this._deviceOrientationCameraController)) {
  199193. this._deviceOrientationCameraController = new DeviceOrientationCameraController_default(
  199194. this
  199195. );
  199196. }
  199197. this._aspectRatioVR = this.camera.frustum.aspectRatio;
  199198. } else {
  199199. this._frameState.creditDisplay.container.style.visibility = "visible";
  199200. this._cameraVR = void 0;
  199201. this._deviceOrientationCameraController = this._deviceOrientationCameraController && !this._deviceOrientationCameraController.isDestroyed() && this._deviceOrientationCameraController.destroy();
  199202. this.camera.frustum.aspectRatio = this._aspectRatioVR;
  199203. this.camera.frustum.xOffset = 0;
  199204. }
  199205. }
  199206. },
  199207. mapMode2D: {
  199208. get: function() {
  199209. return this._mapMode2D;
  199210. }
  199211. },
  199212. splitPosition: {
  199213. get: function() {
  199214. return this._frameState.splitPosition;
  199215. },
  199216. set: function(value) {
  199217. this._frameState.splitPosition = value;
  199218. }
  199219. },
  199220. imagerySplitPosition: {
  199221. get: function() {
  199222. deprecationWarning_default(
  199223. "Scene.imagerySplitPosition",
  199224. "Scene.imagerySplitPosition has been deprecated in Cesium 1.92. It will be removed in Cesium 1.94. Use splitPosition instead."
  199225. );
  199226. return this._frameState.splitPosition;
  199227. },
  199228. set: function(value) {
  199229. deprecationWarning_default(
  199230. "Scene.imagerySplitPosition",
  199231. "Scene.imagerySplitPosition has been deprecated in Cesium 1.92. It will be removed in Cesium 1.94. Use splitPosition instead."
  199232. );
  199233. this._frameState.splitPosition = value;
  199234. }
  199235. },
  199236. minimumDisableDepthTestDistance: {
  199237. get: function() {
  199238. return this._minimumDisableDepthTestDistance;
  199239. },
  199240. set: function(value) {
  199241. if (!defined_default(value) || value < 0) {
  199242. throw new DeveloperError_default(
  199243. "minimumDisableDepthTestDistance must be greater than or equal to 0.0."
  199244. );
  199245. }
  199246. this._minimumDisableDepthTestDistance = value;
  199247. }
  199248. },
  199249. logarithmicDepthBuffer: {
  199250. get: function() {
  199251. return this._logDepthBuffer;
  199252. },
  199253. set: function(value) {
  199254. value = this._context.fragmentDepth && value;
  199255. if (this._logDepthBuffer !== value) {
  199256. this._logDepthBuffer = value;
  199257. this._logDepthBufferDirty = true;
  199258. }
  199259. }
  199260. },
  199261. gamma: {
  199262. get: function() {
  199263. return this._context.uniformState.gamma;
  199264. },
  199265. set: function(value) {
  199266. this._context.uniformState.gamma = value;
  199267. }
  199268. },
  199269. highDynamicRange: {
  199270. get: function() {
  199271. return this._hdr;
  199272. },
  199273. set: function(value) {
  199274. const context = this._context;
  199275. const hdr = value && context.depthTexture && (context.colorBufferFloat || context.colorBufferHalfFloat);
  199276. this._hdrDirty = hdr !== this._hdr;
  199277. this._hdr = hdr;
  199278. }
  199279. },
  199280. highDynamicRangeSupported: {
  199281. get: function() {
  199282. const context = this._context;
  199283. return context.depthTexture && (context.colorBufferFloat || context.colorBufferHalfFloat);
  199284. }
  199285. },
  199286. cameraUnderground: {
  199287. get: function() {
  199288. return this._cameraUnderground;
  199289. }
  199290. },
  199291. msaaSamples: {
  199292. get: function() {
  199293. return this._msaaSamples;
  199294. },
  199295. set: function(value) {
  199296. value = Math.min(value, ContextLimits_default.maximumSamples);
  199297. this._msaaSamples = value;
  199298. }
  199299. },
  199300. msaaSupported: {
  199301. get: function() {
  199302. return this._context.msaa;
  199303. }
  199304. },
  199305. pixelRatio: {
  199306. get: function() {
  199307. return this._frameState.pixelRatio;
  199308. },
  199309. set: function(value) {
  199310. this._frameState.pixelRatio = value;
  199311. }
  199312. },
  199313. opaqueFrustumNearOffset: {
  199314. get: function() {
  199315. return 0.9999;
  199316. }
  199317. },
  199318. globeHeight: {
  199319. get: function() {
  199320. return this._globeHeight;
  199321. }
  199322. }
  199323. });
  199324. Scene4.prototype.getCompressedTextureFormatSupported = function(format) {
  199325. const context = this.context;
  199326. return (format === "WEBGL_compressed_texture_s3tc" || format === "s3tc") && context.s3tc || (format === "WEBGL_compressed_texture_pvrtc" || format === "pvrtc") && context.pvrtc || (format === "WEBGL_compressed_texture_etc" || format === "etc") && context.etc || (format === "WEBGL_compressed_texture_etc1" || format === "etc1") && context.etc1 || (format === "WEBGL_compressed_texture_astc" || format === "astc") && context.astc || (format === "EXT_texture_compression_bptc" || format === "bc7") && context.bc7;
  199327. };
  199328. function updateDerivedCommands2(scene, command, shadowsDirty) {
  199329. const frameState = scene._frameState;
  199330. const context = scene._context;
  199331. const oit = scene._view.oit;
  199332. const lightShadowMaps = frameState.shadowState.lightShadowMaps;
  199333. const lightShadowsEnabled = frameState.shadowState.lightShadowsEnabled;
  199334. let derivedCommands = command.derivedCommands;
  199335. if (defined_default(command.pickId)) {
  199336. derivedCommands.picking = DerivedCommand_default.createPickDerivedCommand(
  199337. scene,
  199338. command,
  199339. context,
  199340. derivedCommands.picking
  199341. );
  199342. }
  199343. if (!command.pickOnly) {
  199344. derivedCommands.depth = DerivedCommand_default.createDepthOnlyDerivedCommand(
  199345. scene,
  199346. command,
  199347. context,
  199348. derivedCommands.depth
  199349. );
  199350. }
  199351. derivedCommands.originalCommand = command;
  199352. if (scene._hdr) {
  199353. derivedCommands.hdr = DerivedCommand_default.createHdrCommand(
  199354. command,
  199355. context,
  199356. derivedCommands.hdr
  199357. );
  199358. command = derivedCommands.hdr.command;
  199359. derivedCommands = command.derivedCommands;
  199360. }
  199361. if (lightShadowsEnabled && command.receiveShadows) {
  199362. derivedCommands.shadows = ShadowMap_default.createReceiveDerivedCommand(
  199363. lightShadowMaps,
  199364. command,
  199365. shadowsDirty,
  199366. context,
  199367. derivedCommands.shadows
  199368. );
  199369. }
  199370. if (command.pass === Pass_default.TRANSLUCENT && defined_default(oit) && oit.isSupported()) {
  199371. if (lightShadowsEnabled && command.receiveShadows) {
  199372. derivedCommands.oit = defined_default(derivedCommands.oit) ? derivedCommands.oit : {};
  199373. derivedCommands.oit.shadows = oit.createDerivedCommands(
  199374. derivedCommands.shadows.receiveCommand,
  199375. context,
  199376. derivedCommands.oit.shadows
  199377. );
  199378. } else {
  199379. derivedCommands.oit = oit.createDerivedCommands(
  199380. command,
  199381. context,
  199382. derivedCommands.oit
  199383. );
  199384. }
  199385. }
  199386. }
  199387. Scene4.prototype.updateDerivedCommands = function(command) {
  199388. if (!defined_default(command.derivedCommands)) {
  199389. return;
  199390. }
  199391. const frameState = this._frameState;
  199392. const context = this._context;
  199393. let shadowsDirty = false;
  199394. const lastDirtyTime = frameState.shadowState.lastDirtyTime;
  199395. if (command.lastDirtyTime !== lastDirtyTime) {
  199396. command.lastDirtyTime = lastDirtyTime;
  199397. command.dirty = true;
  199398. shadowsDirty = true;
  199399. }
  199400. const useLogDepth = frameState.useLogDepth;
  199401. const useHdr = this._hdr;
  199402. const derivedCommands = command.derivedCommands;
  199403. const hasLogDepthDerivedCommands = defined_default(derivedCommands.logDepth);
  199404. const hasHdrCommands = defined_default(derivedCommands.hdr);
  199405. const hasDerivedCommands = defined_default(derivedCommands.originalCommand);
  199406. const needsLogDepthDerivedCommands = useLogDepth && !hasLogDepthDerivedCommands;
  199407. const needsHdrCommands = useHdr && !hasHdrCommands;
  199408. const needsDerivedCommands = (!useLogDepth || !useHdr) && !hasDerivedCommands;
  199409. command.dirty = command.dirty || needsLogDepthDerivedCommands || needsHdrCommands || needsDerivedCommands;
  199410. if (command.dirty) {
  199411. command.dirty = false;
  199412. const shadowMaps = frameState.shadowState.shadowMaps;
  199413. const shadowsEnabled = frameState.shadowState.shadowsEnabled;
  199414. if (shadowsEnabled && command.castShadows) {
  199415. derivedCommands.shadows = ShadowMap_default.createCastDerivedCommand(
  199416. shadowMaps,
  199417. command,
  199418. shadowsDirty,
  199419. context,
  199420. derivedCommands.shadows
  199421. );
  199422. }
  199423. if (hasLogDepthDerivedCommands || needsLogDepthDerivedCommands) {
  199424. derivedCommands.logDepth = DerivedCommand_default.createLogDepthCommand(
  199425. command,
  199426. context,
  199427. derivedCommands.logDepth
  199428. );
  199429. updateDerivedCommands2(
  199430. this,
  199431. derivedCommands.logDepth.command,
  199432. shadowsDirty
  199433. );
  199434. }
  199435. if (hasDerivedCommands || needsDerivedCommands) {
  199436. updateDerivedCommands2(this, command, shadowsDirty);
  199437. }
  199438. }
  199439. };
  199440. var renderTilesetPassState = new Cesium3DTilePassState_default({
  199441. pass: Cesium3DTilePass_default.RENDER
  199442. });
  199443. var preloadTilesetPassState = new Cesium3DTilePassState_default({
  199444. pass: Cesium3DTilePass_default.PRELOAD
  199445. });
  199446. var preloadFlightTilesetPassState = new Cesium3DTilePassState_default({
  199447. pass: Cesium3DTilePass_default.PRELOAD_FLIGHT
  199448. });
  199449. var requestRenderModeDeferCheckPassState = new Cesium3DTilePassState_default({
  199450. pass: Cesium3DTilePass_default.REQUEST_RENDER_MODE_DEFER_CHECK
  199451. });
  199452. var scratchOccluderBoundingSphere = new BoundingSphere_default();
  199453. var scratchOccluder;
  199454. function getOccluder(scene) {
  199455. const globe = scene.globe;
  199456. if (scene._mode === SceneMode_default.SCENE3D && defined_default(globe) && globe.show && !scene._cameraUnderground && !scene._globeTranslucencyState.translucent) {
  199457. const ellipsoid = globe.ellipsoid;
  199458. const minimumTerrainHeight = scene.frameState.minimumTerrainHeight;
  199459. scratchOccluderBoundingSphere.radius = ellipsoid.minimumRadius + minimumTerrainHeight;
  199460. scratchOccluder = Occluder_default.fromBoundingSphere(
  199461. scratchOccluderBoundingSphere,
  199462. scene.camera.positionWC,
  199463. scratchOccluder
  199464. );
  199465. return scratchOccluder;
  199466. }
  199467. return void 0;
  199468. }
  199469. Scene4.prototype.clearPasses = function(passes) {
  199470. passes.render = false;
  199471. passes.pick = false;
  199472. passes.depth = false;
  199473. passes.postProcess = false;
  199474. passes.offscreen = false;
  199475. };
  199476. function updateFrameNumber(scene, frameNumber, time) {
  199477. const frameState = scene._frameState;
  199478. frameState.frameNumber = frameNumber;
  199479. frameState.time = JulianDate_default.clone(time, frameState.time);
  199480. }
  199481. Scene4.prototype.updateFrameState = function() {
  199482. const camera = this.camera;
  199483. const frameState = this._frameState;
  199484. frameState.commandList.length = 0;
  199485. frameState.shadowMaps.length = 0;
  199486. frameState.brdfLutGenerator = this._brdfLutGenerator;
  199487. frameState.environmentMap = this.skyBox && this.skyBox._cubeMap;
  199488. frameState.mode = this._mode;
  199489. frameState.morphTime = this.morphTime;
  199490. frameState.mapProjection = this.mapProjection;
  199491. frameState.camera = camera;
  199492. frameState.cullingVolume = camera.frustum.computeCullingVolume(
  199493. camera.positionWC,
  199494. camera.directionWC,
  199495. camera.upWC
  199496. );
  199497. frameState.occluder = getOccluder(this);
  199498. frameState.minimumTerrainHeight = 0;
  199499. frameState.minimumDisableDepthTestDistance = this._minimumDisableDepthTestDistance;
  199500. frameState.invertClassification = this.invertClassification;
  199501. frameState.useLogDepth = this._logDepthBuffer && !(this.camera.frustum instanceof OrthographicFrustum_default || this.camera.frustum instanceof OrthographicOffCenterFrustum_default);
  199502. frameState.light = this.light;
  199503. frameState.cameraUnderground = this._cameraUnderground;
  199504. frameState.globeTranslucencyState = this._globeTranslucencyState;
  199505. if (defined_default(this.globe)) {
  199506. frameState.terrainExaggeration = this.globe.terrainExaggeration;
  199507. frameState.terrainExaggerationRelativeHeight = this.globe.terrainExaggerationRelativeHeight;
  199508. }
  199509. if (defined_default(this._specularEnvironmentMapAtlas) && this._specularEnvironmentMapAtlas.ready) {
  199510. frameState.specularEnvironmentMaps = this._specularEnvironmentMapAtlas.texture;
  199511. frameState.specularEnvironmentMapsMaximumLOD = this._specularEnvironmentMapAtlas.maximumMipmapLevel;
  199512. } else {
  199513. frameState.specularEnvironmentMaps = void 0;
  199514. frameState.specularEnvironmentMapsMaximumLOD = void 0;
  199515. }
  199516. frameState.sphericalHarmonicCoefficients = this.sphericalHarmonicCoefficients;
  199517. this._actualInvertClassificationColor = Color_default.clone(
  199518. this.invertClassificationColor,
  199519. this._actualInvertClassificationColor
  199520. );
  199521. if (!InvertClassification_default.isTranslucencySupported(this._context)) {
  199522. this._actualInvertClassificationColor.alpha = 1;
  199523. }
  199524. frameState.invertClassificationColor = this._actualInvertClassificationColor;
  199525. if (defined_default(this.globe)) {
  199526. frameState.maximumScreenSpaceError = this.globe.maximumScreenSpaceError;
  199527. } else {
  199528. frameState.maximumScreenSpaceError = 2;
  199529. }
  199530. this.clearPasses(frameState.passes);
  199531. frameState.tilesetPassState = void 0;
  199532. };
  199533. Scene4.prototype.isVisible = function(command, cullingVolume, occluder) {
  199534. return defined_default(command) && (!defined_default(command.boundingVolume) || !command.cull || cullingVolume.computeVisibility(command.boundingVolume) !== Intersect_default.OUTSIDE && (!defined_default(occluder) || !command.occlude || !command.boundingVolume.isOccluded(occluder)));
  199535. };
  199536. var transformFrom2D = new Matrix4_default(
  199537. 0,
  199538. 0,
  199539. 1,
  199540. 0,
  199541. 1,
  199542. 0,
  199543. 0,
  199544. 0,
  199545. 0,
  199546. 1,
  199547. 0,
  199548. 0,
  199549. 0,
  199550. 0,
  199551. 0,
  199552. 1
  199553. );
  199554. transformFrom2D = Matrix4_default.inverseTransformation(
  199555. transformFrom2D,
  199556. transformFrom2D
  199557. );
  199558. function debugShowBoundingVolume(command, scene, passState, debugFramebuffer) {
  199559. const frameState = scene._frameState;
  199560. const context = frameState.context;
  199561. const boundingVolume = command.boundingVolume;
  199562. if (defined_default(scene._debugVolume)) {
  199563. scene._debugVolume.destroy();
  199564. }
  199565. let geometry;
  199566. let center = Cartesian3_default.clone(boundingVolume.center);
  199567. if (frameState.mode !== SceneMode_default.SCENE3D) {
  199568. center = Matrix4_default.multiplyByPoint(transformFrom2D, center, center);
  199569. const projection = frameState.mapProjection;
  199570. const centerCartographic = projection.unproject(center);
  199571. center = projection.ellipsoid.cartographicToCartesian(centerCartographic);
  199572. }
  199573. if (defined_default(boundingVolume.radius)) {
  199574. const radius = boundingVolume.radius;
  199575. geometry = GeometryPipeline_default.toWireframe(
  199576. EllipsoidGeometry_default.createGeometry(
  199577. new EllipsoidGeometry_default({
  199578. radii: new Cartesian3_default(radius, radius, radius),
  199579. vertexFormat: PerInstanceColorAppearance_default.FLAT_VERTEX_FORMAT
  199580. })
  199581. )
  199582. );
  199583. scene._debugVolume = new Primitive_default({
  199584. geometryInstances: new GeometryInstance_default({
  199585. geometry,
  199586. modelMatrix: Matrix4_default.fromTranslation(center),
  199587. attributes: {
  199588. color: new ColorGeometryInstanceAttribute_default(1, 0, 0, 1)
  199589. }
  199590. }),
  199591. appearance: new PerInstanceColorAppearance_default({
  199592. flat: true,
  199593. translucent: false
  199594. }),
  199595. asynchronous: false
  199596. });
  199597. } else {
  199598. const halfAxes = boundingVolume.halfAxes;
  199599. geometry = GeometryPipeline_default.toWireframe(
  199600. BoxGeometry_default.createGeometry(
  199601. BoxGeometry_default.fromDimensions({
  199602. dimensions: new Cartesian3_default(2, 2, 2),
  199603. vertexFormat: PerInstanceColorAppearance_default.FLAT_VERTEX_FORMAT
  199604. })
  199605. )
  199606. );
  199607. scene._debugVolume = new Primitive_default({
  199608. geometryInstances: new GeometryInstance_default({
  199609. geometry,
  199610. modelMatrix: Matrix4_default.fromRotationTranslation(
  199611. halfAxes,
  199612. center,
  199613. new Matrix4_default()
  199614. ),
  199615. attributes: {
  199616. color: new ColorGeometryInstanceAttribute_default(1, 0, 0, 1)
  199617. }
  199618. }),
  199619. appearance: new PerInstanceColorAppearance_default({
  199620. flat: true,
  199621. translucent: false
  199622. }),
  199623. asynchronous: false
  199624. });
  199625. }
  199626. const savedCommandList = frameState.commandList;
  199627. const commandList = frameState.commandList = [];
  199628. scene._debugVolume.update(frameState);
  199629. command = commandList[0];
  199630. if (frameState.useLogDepth) {
  199631. const logDepth = DerivedCommand_default.createLogDepthCommand(command, context);
  199632. command = logDepth.command;
  199633. }
  199634. let framebuffer;
  199635. if (defined_default(debugFramebuffer)) {
  199636. framebuffer = passState.framebuffer;
  199637. passState.framebuffer = debugFramebuffer;
  199638. }
  199639. command.execute(context, passState);
  199640. if (defined_default(framebuffer)) {
  199641. passState.framebuffer = framebuffer;
  199642. }
  199643. frameState.commandList = savedCommandList;
  199644. }
  199645. function executeCommand(command, scene, context, passState, debugFramebuffer) {
  199646. const frameState = scene._frameState;
  199647. if (defined_default(scene.debugCommandFilter) && !scene.debugCommandFilter(command)) {
  199648. return;
  199649. }
  199650. if (command instanceof ClearCommand_default) {
  199651. command.execute(context, passState);
  199652. return;
  199653. }
  199654. if (command.debugShowBoundingVolume && defined_default(command.boundingVolume)) {
  199655. debugShowBoundingVolume(command, scene, passState, debugFramebuffer);
  199656. }
  199657. if (frameState.useLogDepth && defined_default(command.derivedCommands.logDepth)) {
  199658. command = command.derivedCommands.logDepth.command;
  199659. }
  199660. const passes = frameState.passes;
  199661. if (!passes.pick && !passes.depth && scene._hdr && defined_default(command.derivedCommands) && defined_default(command.derivedCommands.hdr)) {
  199662. command = command.derivedCommands.hdr.command;
  199663. }
  199664. if (passes.pick || passes.depth) {
  199665. if (passes.pick && !passes.depth && defined_default(command.derivedCommands.picking)) {
  199666. command = command.derivedCommands.picking.pickCommand;
  199667. command.execute(context, passState);
  199668. return;
  199669. } else if (defined_default(command.derivedCommands.depth)) {
  199670. command = command.derivedCommands.depth.depthOnlyCommand;
  199671. command.execute(context, passState);
  199672. return;
  199673. }
  199674. }
  199675. if (scene.debugShowCommands || scene.debugShowFrustums) {
  199676. scene._debugInspector.executeDebugShowFrustumsCommand(
  199677. scene,
  199678. command,
  199679. passState
  199680. );
  199681. return;
  199682. }
  199683. if (frameState.shadowState.lightShadowsEnabled && command.receiveShadows && defined_default(command.derivedCommands.shadows)) {
  199684. command.derivedCommands.shadows.receiveCommand.execute(context, passState);
  199685. } else {
  199686. command.execute(context, passState);
  199687. }
  199688. }
  199689. function executeIdCommand(command, scene, context, passState) {
  199690. const frameState = scene._frameState;
  199691. let derivedCommands = command.derivedCommands;
  199692. if (!defined_default(derivedCommands)) {
  199693. return;
  199694. }
  199695. if (frameState.useLogDepth && defined_default(derivedCommands.logDepth)) {
  199696. command = derivedCommands.logDepth.command;
  199697. }
  199698. derivedCommands = command.derivedCommands;
  199699. if (defined_default(derivedCommands.picking)) {
  199700. command = derivedCommands.picking.pickCommand;
  199701. command.execute(context, passState);
  199702. } else if (defined_default(derivedCommands.depth)) {
  199703. command = derivedCommands.depth.depthOnlyCommand;
  199704. command.execute(context, passState);
  199705. }
  199706. }
  199707. function backToFront(a4, b, position) {
  199708. return b.boundingVolume.distanceSquaredTo(position) - a4.boundingVolume.distanceSquaredTo(position);
  199709. }
  199710. function frontToBack(a4, b, position) {
  199711. return a4.boundingVolume.distanceSquaredTo(position) - b.boundingVolume.distanceSquaredTo(position) + Math_default.EPSILON12;
  199712. }
  199713. function executeTranslucentCommandsBackToFront(scene, executeFunction, passState, commands, invertClassification) {
  199714. const context = scene.context;
  199715. mergeSort_default(commands, backToFront, scene.camera.positionWC);
  199716. if (defined_default(invertClassification)) {
  199717. executeFunction(
  199718. invertClassification.unclassifiedCommand,
  199719. scene,
  199720. context,
  199721. passState
  199722. );
  199723. }
  199724. const length3 = commands.length;
  199725. for (let i2 = 0; i2 < length3; ++i2) {
  199726. executeFunction(commands[i2], scene, context, passState);
  199727. }
  199728. }
  199729. function executeTranslucentCommandsFrontToBack(scene, executeFunction, passState, commands, invertClassification) {
  199730. const context = scene.context;
  199731. mergeSort_default(commands, frontToBack, scene.camera.positionWC);
  199732. if (defined_default(invertClassification)) {
  199733. executeFunction(
  199734. invertClassification.unclassifiedCommand,
  199735. scene,
  199736. context,
  199737. passState
  199738. );
  199739. }
  199740. const length3 = commands.length;
  199741. for (let i2 = 0; i2 < length3; ++i2) {
  199742. executeFunction(commands[i2], scene, context, passState);
  199743. }
  199744. }
  199745. var scratchPerspectiveFrustum2 = new PerspectiveFrustum_default();
  199746. var scratchPerspectiveOffCenterFrustum2 = new PerspectiveOffCenterFrustum_default();
  199747. var scratchOrthographicFrustum2 = new OrthographicFrustum_default();
  199748. var scratchOrthographicOffCenterFrustum2 = new OrthographicOffCenterFrustum_default();
  199749. function executeCommands2(scene, passState) {
  199750. const camera = scene.camera;
  199751. const context = scene.context;
  199752. const frameState = scene.frameState;
  199753. const us = context.uniformState;
  199754. us.updateCamera(camera);
  199755. let frustum;
  199756. if (defined_default(camera.frustum.fov)) {
  199757. frustum = camera.frustum.clone(scratchPerspectiveFrustum2);
  199758. } else if (defined_default(camera.frustum.infiniteProjectionMatrix)) {
  199759. frustum = camera.frustum.clone(scratchPerspectiveOffCenterFrustum2);
  199760. } else if (defined_default(camera.frustum.width)) {
  199761. frustum = camera.frustum.clone(scratchOrthographicFrustum2);
  199762. } else {
  199763. frustum = camera.frustum.clone(scratchOrthographicOffCenterFrustum2);
  199764. }
  199765. frustum.near = camera.frustum.near;
  199766. frustum.far = camera.frustum.far;
  199767. us.updateFrustum(frustum);
  199768. us.updatePass(Pass_default.ENVIRONMENT);
  199769. const passes = frameState.passes;
  199770. const picking = passes.pick;
  199771. const environmentState = scene._environmentState;
  199772. const view = scene._view;
  199773. const renderTranslucentDepthForPick2 = environmentState.renderTranslucentDepthForPick;
  199774. const useWebVR = environmentState.useWebVR;
  199775. if (!picking) {
  199776. const skyBoxCommand = environmentState.skyBoxCommand;
  199777. if (defined_default(skyBoxCommand)) {
  199778. executeCommand(skyBoxCommand, scene, context, passState);
  199779. }
  199780. if (environmentState.isSkyAtmosphereVisible) {
  199781. executeCommand(
  199782. environmentState.skyAtmosphereCommand,
  199783. scene,
  199784. context,
  199785. passState
  199786. );
  199787. }
  199788. if (environmentState.isSunVisible) {
  199789. environmentState.sunDrawCommand.execute(context, passState);
  199790. if (scene.sunBloom && !useWebVR) {
  199791. let framebuffer;
  199792. if (environmentState.useGlobeDepthFramebuffer) {
  199793. framebuffer = view.globeDepth.framebuffer;
  199794. } else if (environmentState.usePostProcess) {
  199795. framebuffer = view.sceneFramebuffer.framebuffer;
  199796. } else {
  199797. framebuffer = environmentState.originalFramebuffer;
  199798. }
  199799. scene._sunPostProcess.execute(context);
  199800. scene._sunPostProcess.copy(context, framebuffer);
  199801. passState.framebuffer = framebuffer;
  199802. }
  199803. }
  199804. if (environmentState.isMoonVisible) {
  199805. environmentState.moonCommand.execute(context, passState);
  199806. }
  199807. }
  199808. let executeTranslucentCommands;
  199809. if (environmentState.useOIT) {
  199810. if (!defined_default(scene._executeOITFunction)) {
  199811. scene._executeOITFunction = function(scene2, executeFunction, passState2, commands, invertClassification) {
  199812. view.globeDepth.prepareColorTextures(context);
  199813. view.oit.executeCommands(
  199814. scene2,
  199815. executeFunction,
  199816. passState2,
  199817. commands,
  199818. invertClassification
  199819. );
  199820. };
  199821. }
  199822. executeTranslucentCommands = scene._executeOITFunction;
  199823. } else if (passes.render) {
  199824. executeTranslucentCommands = executeTranslucentCommandsBackToFront;
  199825. } else {
  199826. executeTranslucentCommands = executeTranslucentCommandsFrontToBack;
  199827. }
  199828. const frustumCommandsList = view.frustumCommandsList;
  199829. const numFrustums = frustumCommandsList.length;
  199830. const clearGlobeDepth = environmentState.clearGlobeDepth;
  199831. const useDepthPlane2 = environmentState.useDepthPlane;
  199832. const globeTranslucencyState = scene._globeTranslucencyState;
  199833. const globeTranslucent = globeTranslucencyState.translucent;
  199834. const globeTranslucencyFramebuffer = scene._view.globeTranslucencyFramebuffer;
  199835. const clearDepth = scene._depthClearCommand;
  199836. const clearStencil = scene._stencilClearCommand;
  199837. const clearClassificationStencil = scene._classificationStencilClearCommand;
  199838. const depthPlane = scene._depthPlane;
  199839. const usePostProcessSelected = environmentState.usePostProcessSelected;
  199840. const height2D = camera.position.z;
  199841. let j;
  199842. for (let i2 = 0; i2 < numFrustums; ++i2) {
  199843. const index2 = numFrustums - i2 - 1;
  199844. const frustumCommands = frustumCommandsList[index2];
  199845. if (scene.mode === SceneMode_default.SCENE2D) {
  199846. camera.position.z = height2D - frustumCommands.near + 1;
  199847. frustum.far = Math.max(1, frustumCommands.far - frustumCommands.near);
  199848. frustum.near = 1;
  199849. us.update(frameState);
  199850. us.updateFrustum(frustum);
  199851. } else {
  199852. frustum.near = index2 !== 0 ? frustumCommands.near * scene.opaqueFrustumNearOffset : frustumCommands.near;
  199853. frustum.far = frustumCommands.far;
  199854. us.updateFrustum(frustum);
  199855. }
  199856. clearDepth.execute(context, passState);
  199857. if (context.stencilBuffer) {
  199858. clearStencil.execute(context, passState);
  199859. }
  199860. us.updatePass(Pass_default.GLOBE);
  199861. let commands = frustumCommands.commands[Pass_default.GLOBE];
  199862. let length3 = frustumCommands.indices[Pass_default.GLOBE];
  199863. if (globeTranslucent) {
  199864. globeTranslucencyState.executeGlobeCommands(
  199865. frustumCommands,
  199866. executeCommand,
  199867. globeTranslucencyFramebuffer,
  199868. scene,
  199869. passState
  199870. );
  199871. } else {
  199872. for (j = 0; j < length3; ++j) {
  199873. executeCommand(commands[j], scene, context, passState);
  199874. }
  199875. }
  199876. const globeDepth = view.globeDepth;
  199877. if (defined_default(globeDepth) && environmentState.useGlobeDepthFramebuffer) {
  199878. globeDepth.executeCopyDepth(context, passState);
  199879. }
  199880. if (!environmentState.renderTranslucentDepthForPick) {
  199881. us.updatePass(Pass_default.TERRAIN_CLASSIFICATION);
  199882. commands = frustumCommands.commands[Pass_default.TERRAIN_CLASSIFICATION];
  199883. length3 = frustumCommands.indices[Pass_default.TERRAIN_CLASSIFICATION];
  199884. if (globeTranslucent) {
  199885. globeTranslucencyState.executeGlobeClassificationCommands(
  199886. frustumCommands,
  199887. executeCommand,
  199888. globeTranslucencyFramebuffer,
  199889. scene,
  199890. passState
  199891. );
  199892. } else {
  199893. for (j = 0; j < length3; ++j) {
  199894. executeCommand(commands[j], scene, context, passState);
  199895. }
  199896. }
  199897. }
  199898. if (clearGlobeDepth) {
  199899. clearDepth.execute(context, passState);
  199900. if (useDepthPlane2) {
  199901. depthPlane.execute(context, passState);
  199902. }
  199903. }
  199904. if (!environmentState.useInvertClassification || picking || environmentState.renderTranslucentDepthForPick) {
  199905. us.updatePass(Pass_default.CESIUM_3D_TILE);
  199906. commands = frustumCommands.commands[Pass_default.CESIUM_3D_TILE];
  199907. length3 = frustumCommands.indices[Pass_default.CESIUM_3D_TILE];
  199908. for (j = 0; j < length3; ++j) {
  199909. executeCommand(commands[j], scene, context, passState);
  199910. }
  199911. if (length3 > 0) {
  199912. if (defined_default(globeDepth) && environmentState.useGlobeDepthFramebuffer) {
  199913. globeDepth.prepareColorTextures(context, clearGlobeDepth);
  199914. globeDepth.executeUpdateDepth(
  199915. context,
  199916. passState,
  199917. clearGlobeDepth,
  199918. globeDepth.depthStencilTexture
  199919. );
  199920. }
  199921. if (!environmentState.renderTranslucentDepthForPick) {
  199922. us.updatePass(Pass_default.CESIUM_3D_TILE_CLASSIFICATION);
  199923. commands = frustumCommands.commands[Pass_default.CESIUM_3D_TILE_CLASSIFICATION];
  199924. length3 = frustumCommands.indices[Pass_default.CESIUM_3D_TILE_CLASSIFICATION];
  199925. for (j = 0; j < length3; ++j) {
  199926. executeCommand(commands[j], scene, context, passState);
  199927. }
  199928. }
  199929. }
  199930. } else {
  199931. scene._invertClassification.clear(context, passState);
  199932. const opaqueClassificationFramebuffer = passState.framebuffer;
  199933. passState.framebuffer = scene._invertClassification._fbo.framebuffer;
  199934. us.updatePass(Pass_default.CESIUM_3D_TILE);
  199935. commands = frustumCommands.commands[Pass_default.CESIUM_3D_TILE];
  199936. length3 = frustumCommands.indices[Pass_default.CESIUM_3D_TILE];
  199937. for (j = 0; j < length3; ++j) {
  199938. executeCommand(commands[j], scene, context, passState);
  199939. }
  199940. if (defined_default(globeDepth) && environmentState.useGlobeDepthFramebuffer) {
  199941. scene._invertClassification.prepareTextures(context);
  199942. globeDepth.executeUpdateDepth(
  199943. context,
  199944. passState,
  199945. clearGlobeDepth,
  199946. scene._invertClassification._fbo.getDepthStencilTexture()
  199947. );
  199948. }
  199949. us.updatePass(Pass_default.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW);
  199950. commands = frustumCommands.commands[Pass_default.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW];
  199951. length3 = frustumCommands.indices[Pass_default.CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW];
  199952. for (j = 0; j < length3; ++j) {
  199953. executeCommand(commands[j], scene, context, passState);
  199954. }
  199955. passState.framebuffer = opaqueClassificationFramebuffer;
  199956. scene._invertClassification.executeClassified(context, passState);
  199957. if (frameState.invertClassificationColor.alpha === 1) {
  199958. scene._invertClassification.executeUnclassified(context, passState);
  199959. }
  199960. if (length3 > 0 && context.stencilBuffer) {
  199961. clearClassificationStencil.execute(context, passState);
  199962. }
  199963. us.updatePass(Pass_default.CESIUM_3D_TILE_CLASSIFICATION);
  199964. commands = frustumCommands.commands[Pass_default.CESIUM_3D_TILE_CLASSIFICATION];
  199965. length3 = frustumCommands.indices[Pass_default.CESIUM_3D_TILE_CLASSIFICATION];
  199966. for (j = 0; j < length3; ++j) {
  199967. executeCommand(commands[j], scene, context, passState);
  199968. }
  199969. }
  199970. if (length3 > 0 && context.stencilBuffer) {
  199971. clearStencil.execute(context, passState);
  199972. }
  199973. us.updatePass(Pass_default.OPAQUE);
  199974. commands = frustumCommands.commands[Pass_default.OPAQUE];
  199975. length3 = frustumCommands.indices[Pass_default.OPAQUE];
  199976. for (j = 0; j < length3; ++j) {
  199977. executeCommand(commands[j], scene, context, passState);
  199978. }
  199979. if (index2 !== 0 && scene.mode !== SceneMode_default.SCENE2D) {
  199980. frustum.near = frustumCommands.near;
  199981. us.updateFrustum(frustum);
  199982. }
  199983. let invertClassification;
  199984. if (!picking && environmentState.useInvertClassification && frameState.invertClassificationColor.alpha < 1) {
  199985. invertClassification = scene._invertClassification;
  199986. }
  199987. us.updatePass(Pass_default.TRANSLUCENT);
  199988. commands = frustumCommands.commands[Pass_default.TRANSLUCENT];
  199989. commands.length = frustumCommands.indices[Pass_default.TRANSLUCENT];
  199990. executeTranslucentCommands(
  199991. scene,
  199992. executeCommand,
  199993. passState,
  199994. commands,
  199995. invertClassification
  199996. );
  199997. const has3DTilesClassificationCommands = frustumCommands.indices[Pass_default.CESIUM_3D_TILE_CLASSIFICATION] > 0;
  199998. if (has3DTilesClassificationCommands && view.translucentTileClassification.isSupported()) {
  199999. view.translucentTileClassification.executeTranslucentCommands(
  200000. scene,
  200001. executeCommand,
  200002. passState,
  200003. commands,
  200004. globeDepth.depthStencilTexture
  200005. );
  200006. view.translucentTileClassification.executeClassificationCommands(
  200007. scene,
  200008. executeCommand,
  200009. passState,
  200010. frustumCommands
  200011. );
  200012. }
  200013. if (context.depthTexture && scene.useDepthPicking && (environmentState.useGlobeDepthFramebuffer || renderTranslucentDepthForPick2)) {
  200014. const depthStencilTexture = globeDepth.depthStencilTexture;
  200015. const pickDepth = scene._picking.getPickDepth(scene, index2);
  200016. pickDepth.update(context, depthStencilTexture);
  200017. pickDepth.executeCopyDepth(context, passState);
  200018. }
  200019. if (picking || !usePostProcessSelected) {
  200020. continue;
  200021. }
  200022. const originalFramebuffer = passState.framebuffer;
  200023. passState.framebuffer = view.sceneFramebuffer.getIdFramebuffer();
  200024. frustum.near = index2 !== 0 ? frustumCommands.near * scene.opaqueFrustumNearOffset : frustumCommands.near;
  200025. frustum.far = frustumCommands.far;
  200026. us.updateFrustum(frustum);
  200027. us.updatePass(Pass_default.GLOBE);
  200028. commands = frustumCommands.commands[Pass_default.GLOBE];
  200029. length3 = frustumCommands.indices[Pass_default.GLOBE];
  200030. if (globeTranslucent) {
  200031. globeTranslucencyState.executeGlobeCommands(
  200032. frustumCommands,
  200033. executeIdCommand,
  200034. globeTranslucencyFramebuffer,
  200035. scene,
  200036. passState
  200037. );
  200038. } else {
  200039. for (j = 0; j < length3; ++j) {
  200040. executeIdCommand(commands[j], scene, context, passState);
  200041. }
  200042. }
  200043. if (clearGlobeDepth) {
  200044. clearDepth.framebuffer = passState.framebuffer;
  200045. clearDepth.execute(context, passState);
  200046. clearDepth.framebuffer = void 0;
  200047. }
  200048. if (clearGlobeDepth && useDepthPlane2) {
  200049. depthPlane.execute(context, passState);
  200050. }
  200051. us.updatePass(Pass_default.CESIUM_3D_TILE);
  200052. commands = frustumCommands.commands[Pass_default.CESIUM_3D_TILE];
  200053. length3 = frustumCommands.indices[Pass_default.CESIUM_3D_TILE];
  200054. for (j = 0; j < length3; ++j) {
  200055. executeIdCommand(commands[j], scene, context, passState);
  200056. }
  200057. us.updatePass(Pass_default.OPAQUE);
  200058. commands = frustumCommands.commands[Pass_default.OPAQUE];
  200059. length3 = frustumCommands.indices[Pass_default.OPAQUE];
  200060. for (j = 0; j < length3; ++j) {
  200061. executeIdCommand(commands[j], scene, context, passState);
  200062. }
  200063. us.updatePass(Pass_default.TRANSLUCENT);
  200064. commands = frustumCommands.commands[Pass_default.TRANSLUCENT];
  200065. length3 = frustumCommands.indices[Pass_default.TRANSLUCENT];
  200066. for (j = 0; j < length3; ++j) {
  200067. executeIdCommand(commands[j], scene, context, passState);
  200068. }
  200069. passState.framebuffer = originalFramebuffer;
  200070. }
  200071. }
  200072. function executeComputeCommands(scene) {
  200073. const us = scene.context.uniformState;
  200074. us.updatePass(Pass_default.COMPUTE);
  200075. const sunComputeCommand = scene._environmentState.sunComputeCommand;
  200076. if (defined_default(sunComputeCommand)) {
  200077. sunComputeCommand.execute(scene._computeEngine);
  200078. }
  200079. const commandList = scene._computeCommandList;
  200080. const length3 = commandList.length;
  200081. for (let i2 = 0; i2 < length3; ++i2) {
  200082. commandList[i2].execute(scene._computeEngine);
  200083. }
  200084. }
  200085. function executeOverlayCommands(scene, passState) {
  200086. const us = scene.context.uniformState;
  200087. us.updatePass(Pass_default.OVERLAY);
  200088. const context = scene.context;
  200089. const commandList = scene._overlayCommandList;
  200090. const length3 = commandList.length;
  200091. for (let i2 = 0; i2 < length3; ++i2) {
  200092. commandList[i2].execute(context, passState);
  200093. }
  200094. }
  200095. function insertShadowCastCommands(scene, commandList, shadowMap) {
  200096. const shadowVolume = shadowMap.shadowMapCullingVolume;
  200097. const isPointLight = shadowMap.isPointLight;
  200098. const passes = shadowMap.passes;
  200099. const numberOfPasses = passes.length;
  200100. const length3 = commandList.length;
  200101. for (let i2 = 0; i2 < length3; ++i2) {
  200102. const command = commandList[i2];
  200103. scene.updateDerivedCommands(command);
  200104. if (command.castShadows && (command.pass === Pass_default.GLOBE || command.pass === Pass_default.CESIUM_3D_TILE || command.pass === Pass_default.OPAQUE || command.pass === Pass_default.TRANSLUCENT)) {
  200105. if (scene.isVisible(command, shadowVolume)) {
  200106. if (isPointLight) {
  200107. for (let k = 0; k < numberOfPasses; ++k) {
  200108. passes[k].commandList.push(command);
  200109. }
  200110. } else if (numberOfPasses === 1) {
  200111. passes[0].commandList.push(command);
  200112. } else {
  200113. let wasVisible = false;
  200114. for (let j = numberOfPasses - 1; j >= 0; --j) {
  200115. const cascadeVolume = passes[j].cullingVolume;
  200116. if (scene.isVisible(command, cascadeVolume)) {
  200117. passes[j].commandList.push(command);
  200118. wasVisible = true;
  200119. } else if (wasVisible) {
  200120. break;
  200121. }
  200122. }
  200123. }
  200124. }
  200125. }
  200126. }
  200127. }
  200128. function executeShadowMapCastCommands(scene) {
  200129. const frameState = scene.frameState;
  200130. const shadowMaps = frameState.shadowState.shadowMaps;
  200131. const shadowMapLength = shadowMaps.length;
  200132. if (!frameState.shadowState.shadowsEnabled) {
  200133. return;
  200134. }
  200135. const context = scene.context;
  200136. const uniformState = context.uniformState;
  200137. for (let i2 = 0; i2 < shadowMapLength; ++i2) {
  200138. const shadowMap = shadowMaps[i2];
  200139. if (shadowMap.outOfView) {
  200140. continue;
  200141. }
  200142. const passes = shadowMap.passes;
  200143. const numberOfPasses = passes.length;
  200144. for (let j = 0; j < numberOfPasses; ++j) {
  200145. passes[j].commandList.length = 0;
  200146. }
  200147. const sceneCommands = scene.frameState.commandList;
  200148. insertShadowCastCommands(scene, sceneCommands, shadowMap);
  200149. for (let j = 0; j < numberOfPasses; ++j) {
  200150. const pass = shadowMap.passes[j];
  200151. uniformState.updateCamera(pass.camera);
  200152. shadowMap.updatePass(context, j);
  200153. const numberOfCommands = pass.commandList.length;
  200154. for (let k = 0; k < numberOfCommands; ++k) {
  200155. const command = pass.commandList[k];
  200156. uniformState.updatePass(command.pass);
  200157. executeCommand(
  200158. command.derivedCommands.shadows.castCommands[i2],
  200159. scene,
  200160. context,
  200161. pass.passState
  200162. );
  200163. }
  200164. }
  200165. }
  200166. }
  200167. var scratchEyeTranslation = new Cartesian3_default();
  200168. Scene4.prototype.updateAndExecuteCommands = function(passState, backgroundColor) {
  200169. const frameState = this._frameState;
  200170. const mode2 = frameState.mode;
  200171. const useWebVR = this._environmentState.useWebVR;
  200172. if (useWebVR) {
  200173. executeWebVRCommands(this, passState, backgroundColor);
  200174. } else if (mode2 !== SceneMode_default.SCENE2D || this._mapMode2D === MapMode2D_default.ROTATE) {
  200175. executeCommandsInViewport(true, this, passState, backgroundColor);
  200176. } else {
  200177. updateAndClearFramebuffers(this, passState, backgroundColor);
  200178. execute2DViewportCommands(this, passState);
  200179. }
  200180. };
  200181. function executeWebVRCommands(scene, passState, backgroundColor) {
  200182. const view = scene._view;
  200183. const camera = view.camera;
  200184. const environmentState = scene._environmentState;
  200185. const renderTranslucentDepthForPick2 = environmentState.renderTranslucentDepthForPick;
  200186. updateAndClearFramebuffers(scene, passState, backgroundColor);
  200187. updateAndRenderPrimitives(scene);
  200188. view.createPotentiallyVisibleSet(scene);
  200189. executeComputeCommands(scene);
  200190. if (!renderTranslucentDepthForPick2) {
  200191. executeShadowMapCastCommands(scene);
  200192. }
  200193. const viewport = passState.viewport;
  200194. viewport.x = 0;
  200195. viewport.y = 0;
  200196. viewport.width = viewport.width * 0.5;
  200197. const savedCamera = Camera_default.clone(camera, scene._cameraVR);
  200198. savedCamera.frustum = camera.frustum;
  200199. const near = camera.frustum.near;
  200200. const fo = near * defaultValue_default(scene.focalLength, 5);
  200201. const eyeSeparation = defaultValue_default(scene.eyeSeparation, fo / 30);
  200202. const eyeTranslation = Cartesian3_default.multiplyByScalar(
  200203. savedCamera.right,
  200204. eyeSeparation * 0.5,
  200205. scratchEyeTranslation
  200206. );
  200207. camera.frustum.aspectRatio = viewport.width / viewport.height;
  200208. const offset2 = 0.5 * eyeSeparation * near / fo;
  200209. Cartesian3_default.add(savedCamera.position, eyeTranslation, camera.position);
  200210. camera.frustum.xOffset = offset2;
  200211. executeCommands2(scene, passState);
  200212. viewport.x = viewport.width;
  200213. Cartesian3_default.subtract(savedCamera.position, eyeTranslation, camera.position);
  200214. camera.frustum.xOffset = -offset2;
  200215. executeCommands2(scene, passState);
  200216. Camera_default.clone(savedCamera, camera);
  200217. }
  200218. var scratch2DViewportCartographic = new Cartographic_default(
  200219. Math.PI,
  200220. Math_default.PI_OVER_TWO
  200221. );
  200222. var scratch2DViewportMaxCoord = new Cartesian3_default();
  200223. var scratch2DViewportSavedPosition = new Cartesian3_default();
  200224. var scratch2DViewportTransform = new Matrix4_default();
  200225. var scratch2DViewportCameraTransform = new Matrix4_default();
  200226. var scratch2DViewportEyePoint = new Cartesian3_default();
  200227. var scratch2DViewportWindowCoords = new Cartesian3_default();
  200228. var scratch2DViewport = new BoundingRectangle_default();
  200229. function execute2DViewportCommands(scene, passState) {
  200230. const context = scene.context;
  200231. const frameState = scene.frameState;
  200232. const camera = scene.camera;
  200233. const originalViewport = passState.viewport;
  200234. const viewport = BoundingRectangle_default.clone(originalViewport, scratch2DViewport);
  200235. passState.viewport = viewport;
  200236. const maxCartographic = scratch2DViewportCartographic;
  200237. const maxCoord = scratch2DViewportMaxCoord;
  200238. const projection = scene.mapProjection;
  200239. projection.project(maxCartographic, maxCoord);
  200240. const position = Cartesian3_default.clone(
  200241. camera.position,
  200242. scratch2DViewportSavedPosition
  200243. );
  200244. const transform4 = Matrix4_default.clone(
  200245. camera.transform,
  200246. scratch2DViewportCameraTransform
  200247. );
  200248. const frustum = camera.frustum.clone();
  200249. camera._setTransform(Matrix4_default.IDENTITY);
  200250. const viewportTransformation = Matrix4_default.computeViewportTransformation(
  200251. viewport,
  200252. 0,
  200253. 1,
  200254. scratch2DViewportTransform
  200255. );
  200256. const projectionMatrix = camera.frustum.projectionMatrix;
  200257. const x = camera.positionWC.y;
  200258. const eyePoint = Cartesian3_default.fromElements(
  200259. Math_default.sign(x) * maxCoord.x - x,
  200260. 0,
  200261. -camera.positionWC.x,
  200262. scratch2DViewportEyePoint
  200263. );
  200264. const windowCoordinates = Transforms_default.pointToGLWindowCoordinates(
  200265. projectionMatrix,
  200266. viewportTransformation,
  200267. eyePoint,
  200268. scratch2DViewportWindowCoords
  200269. );
  200270. windowCoordinates.x = Math.floor(windowCoordinates.x);
  200271. const viewportX = viewport.x;
  200272. const viewportWidth = viewport.width;
  200273. if (x === 0 || windowCoordinates.x <= viewportX || windowCoordinates.x >= viewportX + viewportWidth) {
  200274. executeCommandsInViewport(true, scene, passState);
  200275. } else if (Math.abs(viewportX + viewportWidth * 0.5 - windowCoordinates.x) < 1) {
  200276. viewport.width = windowCoordinates.x - viewport.x;
  200277. camera.position.x *= Math_default.sign(camera.position.x);
  200278. camera.frustum.right = 0;
  200279. frameState.cullingVolume = camera.frustum.computeCullingVolume(
  200280. camera.positionWC,
  200281. camera.directionWC,
  200282. camera.upWC
  200283. );
  200284. context.uniformState.update(frameState);
  200285. executeCommandsInViewport(true, scene, passState);
  200286. viewport.x = windowCoordinates.x;
  200287. camera.position.x = -camera.position.x;
  200288. camera.frustum.right = -camera.frustum.left;
  200289. camera.frustum.left = 0;
  200290. frameState.cullingVolume = camera.frustum.computeCullingVolume(
  200291. camera.positionWC,
  200292. camera.directionWC,
  200293. camera.upWC
  200294. );
  200295. context.uniformState.update(frameState);
  200296. executeCommandsInViewport(false, scene, passState);
  200297. } else if (windowCoordinates.x > viewportX + viewportWidth * 0.5) {
  200298. viewport.width = windowCoordinates.x - viewportX;
  200299. const right = camera.frustum.right;
  200300. camera.frustum.right = maxCoord.x - x;
  200301. frameState.cullingVolume = camera.frustum.computeCullingVolume(
  200302. camera.positionWC,
  200303. camera.directionWC,
  200304. camera.upWC
  200305. );
  200306. context.uniformState.update(frameState);
  200307. executeCommandsInViewport(true, scene, passState);
  200308. viewport.x = windowCoordinates.x;
  200309. viewport.width = viewportX + viewportWidth - windowCoordinates.x;
  200310. camera.position.x = -camera.position.x;
  200311. camera.frustum.left = -camera.frustum.right;
  200312. camera.frustum.right = right - camera.frustum.right * 2;
  200313. frameState.cullingVolume = camera.frustum.computeCullingVolume(
  200314. camera.positionWC,
  200315. camera.directionWC,
  200316. camera.upWC
  200317. );
  200318. context.uniformState.update(frameState);
  200319. executeCommandsInViewport(false, scene, passState);
  200320. } else {
  200321. viewport.x = windowCoordinates.x;
  200322. viewport.width = viewportX + viewportWidth - windowCoordinates.x;
  200323. const left = camera.frustum.left;
  200324. camera.frustum.left = -maxCoord.x - x;
  200325. frameState.cullingVolume = camera.frustum.computeCullingVolume(
  200326. camera.positionWC,
  200327. camera.directionWC,
  200328. camera.upWC
  200329. );
  200330. context.uniformState.update(frameState);
  200331. executeCommandsInViewport(true, scene, passState);
  200332. viewport.x = viewportX;
  200333. viewport.width = windowCoordinates.x - viewportX;
  200334. camera.position.x = -camera.position.x;
  200335. camera.frustum.right = -camera.frustum.left;
  200336. camera.frustum.left = left - camera.frustum.left * 2;
  200337. frameState.cullingVolume = camera.frustum.computeCullingVolume(
  200338. camera.positionWC,
  200339. camera.directionWC,
  200340. camera.upWC
  200341. );
  200342. context.uniformState.update(frameState);
  200343. executeCommandsInViewport(false, scene, passState);
  200344. }
  200345. camera._setTransform(transform4);
  200346. Cartesian3_default.clone(position, camera.position);
  200347. camera.frustum = frustum.clone();
  200348. passState.viewport = originalViewport;
  200349. }
  200350. function executeCommandsInViewport(firstViewport, scene, passState, backgroundColor) {
  200351. const environmentState = scene._environmentState;
  200352. const view = scene._view;
  200353. const renderTranslucentDepthForPick2 = environmentState.renderTranslucentDepthForPick;
  200354. if (!firstViewport) {
  200355. scene.frameState.commandList.length = 0;
  200356. }
  200357. updateAndRenderPrimitives(scene);
  200358. view.createPotentiallyVisibleSet(scene);
  200359. if (firstViewport) {
  200360. if (defined_default(backgroundColor)) {
  200361. updateAndClearFramebuffers(scene, passState, backgroundColor);
  200362. }
  200363. executeComputeCommands(scene);
  200364. if (!renderTranslucentDepthForPick2) {
  200365. executeShadowMapCastCommands(scene);
  200366. }
  200367. }
  200368. executeCommands2(scene, passState);
  200369. }
  200370. var scratchCullingVolume2 = new CullingVolume_default();
  200371. Scene4.prototype.updateEnvironment = function() {
  200372. const frameState = this._frameState;
  200373. const view = this._view;
  200374. const environmentState = this._environmentState;
  200375. const renderPass = frameState.passes.render;
  200376. const offscreenPass = frameState.passes.offscreen;
  200377. const skyAtmosphere = this.skyAtmosphere;
  200378. const globe = this.globe;
  200379. const globeTranslucencyState = this._globeTranslucencyState;
  200380. if (!renderPass || this._mode !== SceneMode_default.SCENE2D && view.camera.frustum instanceof OrthographicFrustum_default || !globeTranslucencyState.environmentVisible) {
  200381. environmentState.skyAtmosphereCommand = void 0;
  200382. environmentState.skyBoxCommand = void 0;
  200383. environmentState.sunDrawCommand = void 0;
  200384. environmentState.sunComputeCommand = void 0;
  200385. environmentState.moonCommand = void 0;
  200386. } else {
  200387. if (defined_default(skyAtmosphere)) {
  200388. if (defined_default(globe)) {
  200389. skyAtmosphere.setDynamicAtmosphereColor(
  200390. globe.enableLighting && globe.dynamicAtmosphereLighting,
  200391. globe.dynamicAtmosphereLightingFromSun
  200392. );
  200393. environmentState.isReadyForAtmosphere = environmentState.isReadyForAtmosphere || globe._surface._tilesToRender.length > 0;
  200394. }
  200395. environmentState.skyAtmosphereCommand = skyAtmosphere.update(
  200396. frameState,
  200397. globe
  200398. );
  200399. if (defined_default(environmentState.skyAtmosphereCommand)) {
  200400. this.updateDerivedCommands(environmentState.skyAtmosphereCommand);
  200401. }
  200402. } else {
  200403. environmentState.skyAtmosphereCommand = void 0;
  200404. }
  200405. environmentState.skyBoxCommand = defined_default(this.skyBox) ? this.skyBox.update(frameState, this._hdr) : void 0;
  200406. const sunCommands = defined_default(this.sun) ? this.sun.update(frameState, view.passState, this._hdr) : void 0;
  200407. environmentState.sunDrawCommand = defined_default(sunCommands) ? sunCommands.drawCommand : void 0;
  200408. environmentState.sunComputeCommand = defined_default(sunCommands) ? sunCommands.computeCommand : void 0;
  200409. environmentState.moonCommand = defined_default(this.moon) ? this.moon.update(frameState) : void 0;
  200410. }
  200411. const clearGlobeDepth = environmentState.clearGlobeDepth = defined_default(globe) && globe.show && (!globe.depthTestAgainstTerrain || this.mode === SceneMode_default.SCENE2D);
  200412. const useDepthPlane2 = environmentState.useDepthPlane = clearGlobeDepth && this.mode === SceneMode_default.SCENE3D && globeTranslucencyState.useDepthPlane;
  200413. if (useDepthPlane2) {
  200414. this._depthPlane.update(frameState);
  200415. }
  200416. environmentState.renderTranslucentDepthForPick = false;
  200417. environmentState.useWebVR = this._useWebVR && this.mode !== SceneMode_default.SCENE2D && !offscreenPass;
  200418. const occluder = frameState.mode === SceneMode_default.SCENE3D && !globeTranslucencyState.sunVisibleThroughGlobe ? frameState.occluder : void 0;
  200419. let cullingVolume = frameState.cullingVolume;
  200420. const planes = scratchCullingVolume2.planes;
  200421. for (let k = 0; k < 5; ++k) {
  200422. planes[k] = cullingVolume.planes[k];
  200423. }
  200424. cullingVolume = scratchCullingVolume2;
  200425. environmentState.isSkyAtmosphereVisible = defined_default(environmentState.skyAtmosphereCommand) && environmentState.isReadyForAtmosphere;
  200426. environmentState.isSunVisible = this.isVisible(
  200427. environmentState.sunDrawCommand,
  200428. cullingVolume,
  200429. occluder
  200430. );
  200431. environmentState.isMoonVisible = this.isVisible(
  200432. environmentState.moonCommand,
  200433. cullingVolume,
  200434. occluder
  200435. );
  200436. const envMaps = this.specularEnvironmentMaps;
  200437. let envMapAtlas = this._specularEnvironmentMapAtlas;
  200438. if (defined_default(envMaps) && (!defined_default(envMapAtlas) || envMapAtlas.url !== envMaps)) {
  200439. envMapAtlas = envMapAtlas && envMapAtlas.destroy();
  200440. this._specularEnvironmentMapAtlas = new OctahedralProjectedCubeMap_default(envMaps);
  200441. } else if (!defined_default(envMaps) && defined_default(envMapAtlas)) {
  200442. envMapAtlas.destroy();
  200443. this._specularEnvironmentMapAtlas = void 0;
  200444. }
  200445. if (defined_default(this._specularEnvironmentMapAtlas)) {
  200446. this._specularEnvironmentMapAtlas.update(frameState);
  200447. }
  200448. };
  200449. function updateDebugFrustumPlanes(scene) {
  200450. const frameState = scene._frameState;
  200451. if (scene.debugShowFrustumPlanes !== scene._debugShowFrustumPlanes) {
  200452. if (scene.debugShowFrustumPlanes) {
  200453. scene._debugFrustumPlanes = new DebugCameraPrimitive_default({
  200454. camera: scene.camera,
  200455. updateOnChange: false,
  200456. frustumSplits: frameState.frustumSplits
  200457. });
  200458. } else {
  200459. scene._debugFrustumPlanes = scene._debugFrustumPlanes && scene._debugFrustumPlanes.destroy();
  200460. }
  200461. scene._debugShowFrustumPlanes = scene.debugShowFrustumPlanes;
  200462. }
  200463. if (defined_default(scene._debugFrustumPlanes)) {
  200464. scene._debugFrustumPlanes.update(frameState);
  200465. }
  200466. }
  200467. function updateShadowMaps(scene) {
  200468. const frameState = scene._frameState;
  200469. const shadowMaps = frameState.shadowMaps;
  200470. const length3 = shadowMaps.length;
  200471. const shadowsEnabled = length3 > 0 && !frameState.passes.pick && scene.mode === SceneMode_default.SCENE3D;
  200472. if (shadowsEnabled !== frameState.shadowState.shadowsEnabled) {
  200473. ++frameState.shadowState.lastDirtyTime;
  200474. frameState.shadowState.shadowsEnabled = shadowsEnabled;
  200475. }
  200476. frameState.shadowState.lightShadowsEnabled = false;
  200477. if (!shadowsEnabled) {
  200478. return;
  200479. }
  200480. for (let j = 0; j < length3; ++j) {
  200481. if (shadowMaps[j] !== frameState.shadowState.shadowMaps[j]) {
  200482. ++frameState.shadowState.lastDirtyTime;
  200483. break;
  200484. }
  200485. }
  200486. frameState.shadowState.shadowMaps.length = 0;
  200487. frameState.shadowState.lightShadowMaps.length = 0;
  200488. for (let i2 = 0; i2 < length3; ++i2) {
  200489. const shadowMap = shadowMaps[i2];
  200490. shadowMap.update(frameState);
  200491. frameState.shadowState.shadowMaps.push(shadowMap);
  200492. if (shadowMap.fromLightSource) {
  200493. frameState.shadowState.lightShadowMaps.push(shadowMap);
  200494. frameState.shadowState.lightShadowsEnabled = true;
  200495. }
  200496. if (shadowMap.dirty) {
  200497. ++frameState.shadowState.lastDirtyTime;
  200498. shadowMap.dirty = false;
  200499. }
  200500. }
  200501. }
  200502. function updateAndRenderPrimitives(scene) {
  200503. const frameState = scene._frameState;
  200504. scene._groundPrimitives.update(frameState);
  200505. scene._primitives.update(frameState);
  200506. updateDebugFrustumPlanes(scene);
  200507. updateShadowMaps(scene);
  200508. if (scene._globe) {
  200509. scene._globe.render(frameState);
  200510. }
  200511. }
  200512. function updateAndClearFramebuffers(scene, passState, clearColor) {
  200513. const context = scene._context;
  200514. const frameState = scene._frameState;
  200515. const environmentState = scene._environmentState;
  200516. const view = scene._view;
  200517. const passes = scene._frameState.passes;
  200518. const picking = passes.pick;
  200519. if (defined_default(view.globeDepth)) {
  200520. view.globeDepth.picking = picking;
  200521. }
  200522. const useWebVR = environmentState.useWebVR;
  200523. environmentState.originalFramebuffer = passState.framebuffer;
  200524. if (defined_default(scene.sun) && scene.sunBloom !== scene._sunBloom) {
  200525. if (scene.sunBloom && !useWebVR) {
  200526. scene._sunPostProcess = new SunPostProcess_default();
  200527. } else if (defined_default(scene._sunPostProcess)) {
  200528. scene._sunPostProcess = scene._sunPostProcess.destroy();
  200529. }
  200530. scene._sunBloom = scene.sunBloom;
  200531. } else if (!defined_default(scene.sun) && defined_default(scene._sunPostProcess)) {
  200532. scene._sunPostProcess = scene._sunPostProcess.destroy();
  200533. scene._sunBloom = false;
  200534. }
  200535. const clear2 = scene._clearColorCommand;
  200536. Color_default.clone(clearColor, clear2.color);
  200537. clear2.execute(context, passState);
  200538. const useGlobeDepthFramebuffer = environmentState.useGlobeDepthFramebuffer = defined_default(
  200539. view.globeDepth
  200540. );
  200541. if (useGlobeDepthFramebuffer) {
  200542. view.globeDepth.update(
  200543. context,
  200544. passState,
  200545. view.viewport,
  200546. scene.msaaSamples,
  200547. scene._hdr,
  200548. environmentState.clearGlobeDepth
  200549. );
  200550. view.globeDepth.clear(context, passState, clearColor);
  200551. }
  200552. const oit = view.oit;
  200553. const useOIT = environmentState.useOIT = !picking && defined_default(oit) && oit.isSupported();
  200554. if (useOIT) {
  200555. oit.update(
  200556. context,
  200557. passState,
  200558. view.globeDepth.colorFramebufferManager,
  200559. scene._hdr,
  200560. scene.msaaSamples
  200561. );
  200562. oit.clear(context, passState, clearColor);
  200563. environmentState.useOIT = oit.isSupported();
  200564. }
  200565. const postProcess = scene.postProcessStages;
  200566. let usePostProcess = environmentState.usePostProcess = !picking && (scene._hdr || postProcess.length > 0 || postProcess.ambientOcclusion.enabled || postProcess.fxaa.enabled || postProcess.bloom.enabled);
  200567. environmentState.usePostProcessSelected = false;
  200568. if (usePostProcess) {
  200569. view.sceneFramebuffer.update(
  200570. context,
  200571. view.viewport,
  200572. scene._hdr,
  200573. scene.msaaSamples
  200574. );
  200575. view.sceneFramebuffer.clear(context, passState, clearColor);
  200576. postProcess.update(context, frameState.useLogDepth, scene._hdr);
  200577. postProcess.clear(context);
  200578. usePostProcess = environmentState.usePostProcess = postProcess.ready;
  200579. environmentState.usePostProcessSelected = usePostProcess && postProcess.hasSelected;
  200580. }
  200581. if (environmentState.isSunVisible && scene.sunBloom && !useWebVR) {
  200582. passState.framebuffer = scene._sunPostProcess.update(passState);
  200583. scene._sunPostProcess.clear(context, passState, clearColor);
  200584. } else if (useGlobeDepthFramebuffer) {
  200585. passState.framebuffer = view.globeDepth.framebuffer;
  200586. } else if (usePostProcess) {
  200587. passState.framebuffer = view.sceneFramebuffer.framebuffer;
  200588. }
  200589. if (defined_default(passState.framebuffer)) {
  200590. clear2.execute(context, passState);
  200591. }
  200592. const useInvertClassification = environmentState.useInvertClassification = !picking && defined_default(passState.framebuffer) && scene.invertClassification;
  200593. if (useInvertClassification) {
  200594. let depthFramebuffer;
  200595. if (scene.frameState.invertClassificationColor.alpha === 1) {
  200596. if (environmentState.useGlobeDepthFramebuffer) {
  200597. depthFramebuffer = view.globeDepth.framebuffer;
  200598. }
  200599. }
  200600. if (defined_default(depthFramebuffer) || context.depthTexture) {
  200601. scene._invertClassification.previousFramebuffer = depthFramebuffer;
  200602. scene._invertClassification.update(
  200603. context,
  200604. scene.msaaSamples,
  200605. view.globeDepth.colorFramebufferManager
  200606. );
  200607. scene._invertClassification.clear(context, passState);
  200608. if (scene.frameState.invertClassificationColor.alpha < 1 && useOIT) {
  200609. const command = scene._invertClassification.unclassifiedCommand;
  200610. const derivedCommands = command.derivedCommands;
  200611. derivedCommands.oit = oit.createDerivedCommands(
  200612. command,
  200613. context,
  200614. derivedCommands.oit
  200615. );
  200616. }
  200617. } else {
  200618. environmentState.useInvertClassification = false;
  200619. }
  200620. }
  200621. if (scene._globeTranslucencyState.translucent) {
  200622. view.globeTranslucencyFramebuffer.updateAndClear(
  200623. scene._hdr,
  200624. view.viewport,
  200625. context,
  200626. passState
  200627. );
  200628. }
  200629. }
  200630. Scene4.prototype.resolveFramebuffers = function(passState) {
  200631. const context = this._context;
  200632. const environmentState = this._environmentState;
  200633. const view = this._view;
  200634. const globeDepth = view.globeDepth;
  200635. if (defined_default(globeDepth)) {
  200636. globeDepth.prepareColorTextures(context);
  200637. }
  200638. const useOIT = environmentState.useOIT;
  200639. const useGlobeDepthFramebuffer = environmentState.useGlobeDepthFramebuffer;
  200640. const usePostProcess = environmentState.usePostProcess;
  200641. const defaultFramebuffer = environmentState.originalFramebuffer;
  200642. const globeFramebuffer = useGlobeDepthFramebuffer ? globeDepth.colorFramebufferManager : void 0;
  200643. const sceneFramebuffer = view.sceneFramebuffer._colorFramebuffer;
  200644. const idFramebuffer = view.sceneFramebuffer.idFramebuffer;
  200645. if (useOIT) {
  200646. passState.framebuffer = usePostProcess ? sceneFramebuffer.framebuffer : defaultFramebuffer;
  200647. view.oit.execute(context, passState);
  200648. }
  200649. const translucentTileClassification = view.translucentTileClassification;
  200650. if (translucentTileClassification.hasTranslucentDepth && translucentTileClassification.isSupported()) {
  200651. translucentTileClassification.execute(this, passState);
  200652. }
  200653. if (usePostProcess) {
  200654. view.sceneFramebuffer.prepareColorTextures(context);
  200655. let inputFramebuffer = sceneFramebuffer;
  200656. if (useGlobeDepthFramebuffer && !useOIT) {
  200657. inputFramebuffer = globeFramebuffer;
  200658. }
  200659. const postProcess = this.postProcessStages;
  200660. const colorTexture = inputFramebuffer.getColorTexture(0);
  200661. const idTexture = idFramebuffer.getColorTexture(0);
  200662. const depthTexture = defaultValue_default(
  200663. globeFramebuffer,
  200664. sceneFramebuffer
  200665. ).getDepthStencilTexture();
  200666. postProcess.execute(context, colorTexture, depthTexture, idTexture);
  200667. postProcess.copy(context, defaultFramebuffer);
  200668. }
  200669. if (!useOIT && !usePostProcess && useGlobeDepthFramebuffer) {
  200670. passState.framebuffer = defaultFramebuffer;
  200671. globeDepth.executeCopyColor(context, passState);
  200672. }
  200673. };
  200674. function callAfterRenderFunctions(scene) {
  200675. const functions = scene._frameState.afterRender;
  200676. for (let i2 = 0, length3 = functions.length; i2 < length3; ++i2) {
  200677. functions[i2]();
  200678. scene.requestRender();
  200679. }
  200680. functions.length = 0;
  200681. }
  200682. function getGlobeHeight(scene) {
  200683. const globe = scene._globe;
  200684. const camera = scene.camera;
  200685. const cartographic2 = camera.positionCartographic;
  200686. if (defined_default(globe) && globe.show && defined_default(cartographic2)) {
  200687. return globe.getHeight(cartographic2);
  200688. }
  200689. return void 0;
  200690. }
  200691. function isCameraUnderground(scene) {
  200692. const camera = scene.camera;
  200693. const mode2 = scene._mode;
  200694. const globe = scene.globe;
  200695. const cameraController = scene._screenSpaceCameraController;
  200696. const cartographic2 = camera.positionCartographic;
  200697. if (!defined_default(cartographic2)) {
  200698. return false;
  200699. }
  200700. if (!cameraController.onMap() && cartographic2.height < 0) {
  200701. return true;
  200702. }
  200703. if (!defined_default(globe) || !globe.show || mode2 === SceneMode_default.SCENE2D || mode2 === SceneMode_default.MORPHING) {
  200704. return false;
  200705. }
  200706. const globeHeight = scene._globeHeight;
  200707. return defined_default(globeHeight) && cartographic2.height < globeHeight;
  200708. }
  200709. Scene4.prototype.initializeFrame = function() {
  200710. if (this._shaderFrameCount++ === 120) {
  200711. this._shaderFrameCount = 0;
  200712. this._context.shaderCache.destroyReleasedShaderPrograms();
  200713. this._context.textureCache.destroyReleasedTextures();
  200714. }
  200715. this._tweens.update();
  200716. this._globeHeight = getGlobeHeight(this);
  200717. this._cameraUnderground = isCameraUnderground(this);
  200718. this._globeTranslucencyState.update(this);
  200719. this._screenSpaceCameraController.update();
  200720. if (defined_default(this._deviceOrientationCameraController)) {
  200721. this._deviceOrientationCameraController.update();
  200722. }
  200723. this.camera.update(this._mode);
  200724. this.camera._updateCameraChanged();
  200725. };
  200726. function updateDebugShowFramesPerSecond(scene, renderedThisFrame) {
  200727. if (scene.debugShowFramesPerSecond) {
  200728. if (!defined_default(scene._performanceDisplay)) {
  200729. const performanceContainer = document.createElement("div");
  200730. performanceContainer.className = "cesium-performanceDisplay-defaultContainer";
  200731. const container = scene._canvas.parentNode;
  200732. container.appendChild(performanceContainer);
  200733. const performanceDisplay = new PerformanceDisplay_default({
  200734. container: performanceContainer
  200735. });
  200736. scene._performanceDisplay = performanceDisplay;
  200737. scene._performanceContainer = performanceContainer;
  200738. }
  200739. scene._performanceDisplay.throttled = scene.requestRenderMode;
  200740. scene._performanceDisplay.update(renderedThisFrame);
  200741. } else if (defined_default(scene._performanceDisplay)) {
  200742. scene._performanceDisplay = scene._performanceDisplay && scene._performanceDisplay.destroy();
  200743. scene._performanceContainer.parentNode.removeChild(
  200744. scene._performanceContainer
  200745. );
  200746. }
  200747. }
  200748. function prePassesUpdate(scene) {
  200749. scene._jobScheduler.resetBudgets();
  200750. const frameState = scene._frameState;
  200751. const primitives = scene.primitives;
  200752. primitives.prePassesUpdate(frameState);
  200753. if (defined_default(scene.globe)) {
  200754. scene.globe.update(frameState);
  200755. }
  200756. scene._picking.update();
  200757. frameState.creditDisplay.update();
  200758. }
  200759. function postPassesUpdate(scene) {
  200760. const frameState = scene._frameState;
  200761. const primitives = scene.primitives;
  200762. primitives.postPassesUpdate(frameState);
  200763. RequestScheduler_default.update();
  200764. }
  200765. var scratchBackgroundColor = new Color_default();
  200766. function render(scene) {
  200767. const frameState = scene._frameState;
  200768. const context = scene.context;
  200769. const us = context.uniformState;
  200770. const view = scene._defaultView;
  200771. scene._view = view;
  200772. scene.updateFrameState();
  200773. frameState.passes.render = true;
  200774. frameState.passes.postProcess = scene.postProcessStages.hasSelected;
  200775. frameState.tilesetPassState = renderTilesetPassState;
  200776. let backgroundColor = defaultValue_default(scene.backgroundColor, Color_default.BLACK);
  200777. if (scene._hdr) {
  200778. backgroundColor = Color_default.clone(backgroundColor, scratchBackgroundColor);
  200779. backgroundColor.red = Math.pow(backgroundColor.red, scene.gamma);
  200780. backgroundColor.green = Math.pow(backgroundColor.green, scene.gamma);
  200781. backgroundColor.blue = Math.pow(backgroundColor.blue, scene.gamma);
  200782. }
  200783. frameState.backgroundColor = backgroundColor;
  200784. scene.fog.update(frameState);
  200785. us.update(frameState);
  200786. const shadowMap = scene.shadowMap;
  200787. if (defined_default(shadowMap) && shadowMap.enabled) {
  200788. if (!defined_default(scene.light) || scene.light instanceof SunLight_default) {
  200789. Cartesian3_default.negate(us.sunDirectionWC, scene._shadowMapCamera.direction);
  200790. } else {
  200791. Cartesian3_default.clone(scene.light.direction, scene._shadowMapCamera.direction);
  200792. }
  200793. frameState.shadowMaps.push(shadowMap);
  200794. }
  200795. scene._computeCommandList.length = 0;
  200796. scene._overlayCommandList.length = 0;
  200797. const viewport = view.viewport;
  200798. viewport.x = 0;
  200799. viewport.y = 0;
  200800. viewport.width = context.drawingBufferWidth;
  200801. viewport.height = context.drawingBufferHeight;
  200802. const passState = view.passState;
  200803. passState.framebuffer = void 0;
  200804. passState.blendingEnabled = void 0;
  200805. passState.scissorTest = void 0;
  200806. passState.viewport = BoundingRectangle_default.clone(viewport, passState.viewport);
  200807. if (defined_default(scene.globe)) {
  200808. scene.globe.beginFrame(frameState);
  200809. }
  200810. scene.updateEnvironment();
  200811. scene.updateAndExecuteCommands(passState, backgroundColor);
  200812. scene.resolveFramebuffers(passState);
  200813. passState.framebuffer = void 0;
  200814. executeOverlayCommands(scene, passState);
  200815. if (defined_default(scene.globe)) {
  200816. scene.globe.endFrame(frameState);
  200817. if (!scene.globe.tilesLoaded) {
  200818. scene._renderRequested = true;
  200819. }
  200820. }
  200821. context.endFrame();
  200822. }
  200823. function tryAndCatchError(scene, functionToExecute) {
  200824. try {
  200825. functionToExecute(scene);
  200826. } catch (error) {
  200827. scene._renderError.raiseEvent(scene, error);
  200828. if (scene.rethrowRenderErrors) {
  200829. throw error;
  200830. }
  200831. }
  200832. }
  200833. function updateMostDetailedRayPicks(scene) {
  200834. return scene._picking.updateMostDetailedRayPicks(scene);
  200835. }
  200836. Scene4.prototype.render = function(time) {
  200837. this._preUpdate.raiseEvent(this, time);
  200838. const frameState = this._frameState;
  200839. frameState.newFrame = false;
  200840. if (!defined_default(time)) {
  200841. time = JulianDate_default.now();
  200842. }
  200843. const cameraChanged = this._view.checkForCameraUpdates(this);
  200844. let shouldRender = !this.requestRenderMode || this._renderRequested || cameraChanged || this._logDepthBufferDirty || this._hdrDirty || this.mode === SceneMode_default.MORPHING;
  200845. if (!shouldRender && defined_default(this.maximumRenderTimeChange) && defined_default(this._lastRenderTime)) {
  200846. const difference = Math.abs(
  200847. JulianDate_default.secondsDifference(this._lastRenderTime, time)
  200848. );
  200849. shouldRender = shouldRender || difference > this.maximumRenderTimeChange;
  200850. }
  200851. if (shouldRender) {
  200852. this._lastRenderTime = JulianDate_default.clone(time, this._lastRenderTime);
  200853. this._renderRequested = false;
  200854. this._logDepthBufferDirty = false;
  200855. this._hdrDirty = false;
  200856. const frameNumber = Math_default.incrementWrap(
  200857. frameState.frameNumber,
  200858. 15e6,
  200859. 1
  200860. );
  200861. updateFrameNumber(this, frameNumber, time);
  200862. frameState.newFrame = true;
  200863. }
  200864. tryAndCatchError(this, prePassesUpdate);
  200865. if (this.primitives.show) {
  200866. tryAndCatchError(this, updateMostDetailedRayPicks);
  200867. tryAndCatchError(this, updatePreloadPass);
  200868. tryAndCatchError(this, updatePreloadFlightPass);
  200869. if (!shouldRender) {
  200870. tryAndCatchError(this, updateRequestRenderModeDeferCheckPass);
  200871. }
  200872. }
  200873. this._postUpdate.raiseEvent(this, time);
  200874. if (shouldRender) {
  200875. this._preRender.raiseEvent(this, time);
  200876. frameState.creditDisplay.beginFrame();
  200877. tryAndCatchError(this, render);
  200878. }
  200879. updateDebugShowFramesPerSecond(this, shouldRender);
  200880. tryAndCatchError(this, postPassesUpdate);
  200881. callAfterRenderFunctions(this);
  200882. if (shouldRender) {
  200883. this._postRender.raiseEvent(this, time);
  200884. frameState.creditDisplay.endFrame();
  200885. }
  200886. };
  200887. Scene4.prototype.forceRender = function(time) {
  200888. this._renderRequested = true;
  200889. this.render(time);
  200890. };
  200891. Scene4.prototype.requestRender = function() {
  200892. this._renderRequested = true;
  200893. };
  200894. Scene4.prototype.clampLineWidth = function(width) {
  200895. return Math.max(
  200896. ContextLimits_default.minimumAliasedLineWidth,
  200897. Math.min(width, ContextLimits_default.maximumAliasedLineWidth)
  200898. );
  200899. };
  200900. Scene4.prototype.pick = function(windowPosition, width, height) {
  200901. return this._picking.pick(this, windowPosition, width, height);
  200902. };
  200903. Scene4.prototype.pickPositionWorldCoordinates = function(windowPosition, result) {
  200904. return this._picking.pickPositionWorldCoordinates(
  200905. this,
  200906. windowPosition,
  200907. result
  200908. );
  200909. };
  200910. Scene4.prototype.pickPosition = function(windowPosition, result) {
  200911. return this._picking.pickPosition(this, windowPosition, result);
  200912. };
  200913. Scene4.prototype.drillPick = function(windowPosition, limit, width, height) {
  200914. return this._picking.drillPick(this, windowPosition, limit, width, height);
  200915. };
  200916. function updatePreloadPass(scene) {
  200917. const frameState = scene._frameState;
  200918. preloadTilesetPassState.camera = frameState.camera;
  200919. preloadTilesetPassState.cullingVolume = frameState.cullingVolume;
  200920. const primitives = scene.primitives;
  200921. primitives.updateForPass(frameState, preloadTilesetPassState);
  200922. }
  200923. function updatePreloadFlightPass(scene) {
  200924. const frameState = scene._frameState;
  200925. const camera = frameState.camera;
  200926. if (!camera.canPreloadFlight()) {
  200927. return;
  200928. }
  200929. preloadFlightTilesetPassState.camera = scene.preloadFlightCamera;
  200930. preloadFlightTilesetPassState.cullingVolume = scene.preloadFlightCullingVolume;
  200931. const primitives = scene.primitives;
  200932. primitives.updateForPass(frameState, preloadFlightTilesetPassState);
  200933. }
  200934. function updateRequestRenderModeDeferCheckPass(scene) {
  200935. scene.primitives.updateForPass(
  200936. scene._frameState,
  200937. requestRenderModeDeferCheckPassState
  200938. );
  200939. }
  200940. Scene4.prototype.pickFromRay = function(ray, objectsToExclude, width) {
  200941. return this._picking.pickFromRay(this, ray, objectsToExclude, width);
  200942. };
  200943. Scene4.prototype.drillPickFromRay = function(ray, limit, objectsToExclude, width) {
  200944. return this._picking.drillPickFromRay(
  200945. this,
  200946. ray,
  200947. limit,
  200948. objectsToExclude,
  200949. width
  200950. );
  200951. };
  200952. Scene4.prototype.pickFromRayMostDetailed = function(ray, objectsToExclude, width) {
  200953. return this._picking.pickFromRayMostDetailed(
  200954. this,
  200955. ray,
  200956. objectsToExclude,
  200957. width
  200958. );
  200959. };
  200960. Scene4.prototype.drillPickFromRayMostDetailed = function(ray, limit, objectsToExclude, width) {
  200961. return this._picking.drillPickFromRayMostDetailed(
  200962. this,
  200963. ray,
  200964. limit,
  200965. objectsToExclude,
  200966. width
  200967. );
  200968. };
  200969. Scene4.prototype.sampleHeight = function(position, objectsToExclude, width) {
  200970. return this._picking.sampleHeight(this, position, objectsToExclude, width);
  200971. };
  200972. Scene4.prototype.clampToHeight = function(cartesian11, objectsToExclude, width, result) {
  200973. return this._picking.clampToHeight(
  200974. this,
  200975. cartesian11,
  200976. objectsToExclude,
  200977. width,
  200978. result
  200979. );
  200980. };
  200981. Scene4.prototype.sampleHeightMostDetailed = function(positions, objectsToExclude, width) {
  200982. return this._picking.sampleHeightMostDetailed(
  200983. this,
  200984. positions,
  200985. objectsToExclude,
  200986. width
  200987. );
  200988. };
  200989. Scene4.prototype.clampToHeightMostDetailed = function(cartesians, objectsToExclude, width) {
  200990. return this._picking.clampToHeightMostDetailed(
  200991. this,
  200992. cartesians,
  200993. objectsToExclude,
  200994. width
  200995. );
  200996. };
  200997. Scene4.prototype.cartesianToCanvasCoordinates = function(position, result) {
  200998. return SceneTransforms_default.wgs84ToWindowCoordinates(this, position, result);
  200999. };
  201000. Scene4.prototype.completeMorph = function() {
  201001. this._transitioner.completeMorph();
  201002. };
  201003. Scene4.prototype.morphTo2D = function(duration) {
  201004. let ellipsoid;
  201005. const globe = this.globe;
  201006. if (defined_default(globe)) {
  201007. ellipsoid = globe.ellipsoid;
  201008. } else {
  201009. ellipsoid = this.mapProjection.ellipsoid;
  201010. }
  201011. duration = defaultValue_default(duration, 2);
  201012. this._transitioner.morphTo2D(duration, ellipsoid);
  201013. };
  201014. Scene4.prototype.morphToColumbusView = function(duration) {
  201015. let ellipsoid;
  201016. const globe = this.globe;
  201017. if (defined_default(globe)) {
  201018. ellipsoid = globe.ellipsoid;
  201019. } else {
  201020. ellipsoid = this.mapProjection.ellipsoid;
  201021. }
  201022. duration = defaultValue_default(duration, 2);
  201023. this._transitioner.morphToColumbusView(duration, ellipsoid);
  201024. };
  201025. Scene4.prototype.morphTo3D = function(duration) {
  201026. let ellipsoid;
  201027. const globe = this.globe;
  201028. if (defined_default(globe)) {
  201029. ellipsoid = globe.ellipsoid;
  201030. } else {
  201031. ellipsoid = this.mapProjection.ellipsoid;
  201032. }
  201033. duration = defaultValue_default(duration, 2);
  201034. this._transitioner.morphTo3D(duration, ellipsoid);
  201035. };
  201036. Scene4.prototype.isDestroyed = function() {
  201037. return false;
  201038. };
  201039. Scene4.prototype.destroy = function() {
  201040. this._tweens.removeAll();
  201041. this._computeEngine = this._computeEngine && this._computeEngine.destroy();
  201042. this._screenSpaceCameraController = this._screenSpaceCameraController && this._screenSpaceCameraController.destroy();
  201043. this._deviceOrientationCameraController = this._deviceOrientationCameraController && !this._deviceOrientationCameraController.isDestroyed() && this._deviceOrientationCameraController.destroy();
  201044. this._primitives = this._primitives && this._primitives.destroy();
  201045. this._groundPrimitives = this._groundPrimitives && this._groundPrimitives.destroy();
  201046. this._globe = this._globe && this._globe.destroy();
  201047. this.skyBox = this.skyBox && this.skyBox.destroy();
  201048. this.skyAtmosphere = this.skyAtmosphere && this.skyAtmosphere.destroy();
  201049. this._debugSphere = this._debugSphere && this._debugSphere.destroy();
  201050. this.sun = this.sun && this.sun.destroy();
  201051. this._sunPostProcess = this._sunPostProcess && this._sunPostProcess.destroy();
  201052. this._depthPlane = this._depthPlane && this._depthPlane.destroy();
  201053. this._transitioner = this._transitioner && this._transitioner.destroy();
  201054. this._debugFrustumPlanes = this._debugFrustumPlanes && this._debugFrustumPlanes.destroy();
  201055. this._brdfLutGenerator = this._brdfLutGenerator && this._brdfLutGenerator.destroy();
  201056. this._picking = this._picking && this._picking.destroy();
  201057. this._defaultView = this._defaultView && this._defaultView.destroy();
  201058. this._view = void 0;
  201059. if (this._removeCreditContainer) {
  201060. this._canvas.parentNode.removeChild(this._creditContainer);
  201061. }
  201062. this.postProcessStages = this.postProcessStages && this.postProcessStages.destroy();
  201063. this._context = this._context && this._context.destroy();
  201064. this._frameState.creditDisplay = this._frameState.creditDisplay && this._frameState.creditDisplay.destroy();
  201065. if (defined_default(this._performanceDisplay)) {
  201066. this._performanceDisplay = this._performanceDisplay && this._performanceDisplay.destroy();
  201067. this._performanceContainer.parentNode.removeChild(
  201068. this._performanceContainer
  201069. );
  201070. }
  201071. this._removeRequestListenerCallback();
  201072. this._removeTaskProcessorListenerCallback();
  201073. for (let i2 = 0; i2 < this._removeGlobeCallbacks.length; ++i2) {
  201074. this._removeGlobeCallbacks[i2]();
  201075. }
  201076. this._removeGlobeCallbacks.length = 0;
  201077. return destroyObject_default(this);
  201078. };
  201079. var Scene_default = Scene4;
  201080. // node_modules/cesium/Source/Shaders/SkyAtmosphereCommon.js
  201081. var SkyAtmosphereCommon_default = "float interpolateByDistance(vec4 nearFarScalar, float distance)\n{\n float startDistance = nearFarScalar.x;\n float startValue = nearFarScalar.y;\n float endDistance = nearFarScalar.z;\n float endValue = nearFarScalar.w;\n float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0);\n return mix(startValue, endValue, t);\n}\n\nvec3 getLightDirection(vec3 positionWC)\n{\n float lightEnum = u_radiiAndDynamicAtmosphereColor.z;\n vec3 lightDirection =\n positionWC * float(lightEnum == 0.0) +\n czm_lightDirectionWC * float(lightEnum == 1.0) +\n czm_sunDirectionWC * float(lightEnum == 2.0);\n return normalize(lightDirection);\n}\n\nvoid computeAtmosphereScattering(vec3 positionWC, vec3 lightDirection, out vec3 rayleighColor, out vec3 mieColor, out float opacity, out float underTranslucentGlobe)\n{\n float ellipsoidRadiiDifference = czm_ellipsoidRadii.x - czm_ellipsoidRadii.z;\n\n // Adjustment to the atmosphere radius applied based on the camera height.\n float distanceAdjustMin = czm_ellipsoidRadii.x / 4.0;\n float distanceAdjustMax = czm_ellipsoidRadii.x;\n float distanceAdjustModifier = ellipsoidRadiiDifference / 2.0;\n float distanceAdjust = distanceAdjustModifier * clamp((czm_eyeHeight - distanceAdjustMin) / (distanceAdjustMax - distanceAdjustMin), 0.0, 1.0);\n\n // Since atmosphere scattering assumes the atmosphere is a spherical shell, we compute an inner radius of the atmosphere best fit \n // for the position on the ellipsoid.\n float radiusAdjust = (ellipsoidRadiiDifference / 4.0) + distanceAdjust;\n float atmosphereInnerRadius = (length(czm_viewerPositionWC) - czm_eyeHeight) - radiusAdjust;\n\n // Setup the primary ray: from the camera position to the vertex position.\n vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;\n vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);\n czm_ray primaryRay = czm_ray(czm_viewerPositionWC, cameraToPositionWCDirection);\n\n underTranslucentGlobe = 0.0;\n\n // Brighten the sky atmosphere under the Earth's atmosphere when translucency is enabled.\n #if defined(GLOBE_TRANSLUCENT)\n\n // Check for intersection with the inner radius of the atmopshere.\n czm_raySegment primaryRayEarthIntersect = czm_raySphereIntersectionInterval(primaryRay, vec3(0.0), atmosphereInnerRadius + radiusAdjust);\n if (primaryRayEarthIntersect.start > 0.0 && primaryRayEarthIntersect.stop > 0.0) {\n \n // Compute position on globe.\n vec3 direction = normalize(positionWC);\n czm_ray ellipsoidRay = czm_ray(positionWC, -direction);\n czm_raySegment ellipsoidIntersection = czm_rayEllipsoidIntersectionInterval(ellipsoidRay, vec3(0.0), czm_ellipsoidInverseRadii);\n vec3 onEarth = positionWC - (direction * ellipsoidIntersection.start);\n\n // Control the color using the camera angle.\n float angle = dot(normalize(czm_viewerPositionWC), normalize(onEarth));\n\n // Control the opacity using the distance from Earth.\n opacity = interpolateByDistance(vec4(0.0, 1.0, czm_ellipsoidRadii.x, 0.0), length(czm_viewerPositionWC - onEarth));\n vec3 horizonColor = vec3(0.1, 0.2, 0.3);\n vec3 nearColor = vec3(0.0);\n\n rayleighColor = mix(nearColor, horizonColor, exp(-angle) * opacity);\n \n // Set the traslucent flag to avoid alpha adjustment in computeFinalColor funciton.\n underTranslucentGlobe = 1.0;\n return;\n }\n #endif\n\n computeScattering(\n primaryRay,\n length(cameraToPositionWC),\n lightDirection,\n atmosphereInnerRadius,\n rayleighColor,\n mieColor,\n opacity\n );\n\n // Alter the opacity based on how close the viewer is to the ground.\n // (0.0 = At edge of atmosphere, 1.0 = On ground)\n float cameraHeight = czm_eyeHeight + atmosphereInnerRadius;\n float atmosphereOuterRadius = atmosphereInnerRadius + ATMOSPHERE_THICKNESS;\n opacity = clamp((atmosphereOuterRadius - cameraHeight) / (atmosphereOuterRadius - atmosphereInnerRadius), 0.0, 1.0);\n\n // Alter alpha based on time of day (0.0 = night , 1.0 = day)\n float nightAlpha = (u_radiiAndDynamicAtmosphereColor.z != 0.0) ? clamp(dot(normalize(positionWC), lightDirection), 0.0, 1.0) : 1.0;\n opacity *= pow(nightAlpha, 0.5);\n}\n";
  201082. // node_modules/cesium/Source/Shaders/SkyAtmosphereFS.js
  201083. var SkyAtmosphereFS_default = "varying vec3 v_outerPositionWC;\n\nuniform vec3 u_hsbShift;\n\n#ifndef PER_FRAGMENT_ATMOSPHERE\nvarying vec3 v_mieColor;\nvarying vec3 v_rayleighColor;\nvarying float v_opacity;\nvarying float v_translucent;\n#endif\n\nvoid main (void)\n{\n vec3 lightDirection = getLightDirection(v_outerPositionWC);\n \n vec3 mieColor;\n vec3 rayleighColor;\n float opacity;\n float translucent;\n\n #ifdef PER_FRAGMENT_ATMOSPHERE\n computeAtmosphereScattering(\n v_outerPositionWC,\n lightDirection,\n rayleighColor,\n mieColor,\n opacity,\n translucent\n );\n #else\n mieColor = v_mieColor;\n rayleighColor = v_rayleighColor;\n opacity = v_opacity;\n translucent = v_translucent;\n #endif\n\n vec4 color = computeAtmosphereColor(v_outerPositionWC, lightDirection, rayleighColor, mieColor, opacity);\n\n #ifndef HDR\n color.rgb = czm_acesTonemapping(color.rgb);\n color.rgb = czm_inverseGamma(color.rgb);\n #endif\n\n #ifdef COLOR_CORRECT\n // Convert rgb color to hsb\n vec3 hsb = czm_RGBToHSB(color.rgb);\n // Perform hsb shift\n hsb.x += u_hsbShift.x; // hue\n hsb.y = clamp(hsb.y + u_hsbShift.y, 0.0, 1.0); // saturation\n hsb.z = hsb.z > czm_epsilon7 ? hsb.z + u_hsbShift.z : 0.0; // brightness\n // Convert shifted hsb back to rgb\n color.rgb = czm_HSBToRGB(hsb);\n #endif\n\n // For the parts of the sky atmosphere that are not behind a translucent globe,\n // we mix in the default opacity so that the sky atmosphere still appears at distance.\n // This is needed because the opacity in the sky atmosphere is initially adjusted based\n // on the camera height.\n if (translucent == 0.0) {\n color.a = mix(color.b, 1.0, color.a) * smoothstep(0.0, 1.0, czm_morphTime);\n }\n\n gl_FragColor = color;\n}\n";
  201084. // node_modules/cesium/Source/Shaders/SkyAtmosphereVS.js
  201085. var SkyAtmosphereVS_default = "attribute vec4 position;\n\nvarying vec3 v_outerPositionWC;\n\n#ifndef PER_FRAGMENT_ATMOSPHERE\nvarying vec3 v_mieColor;\nvarying vec3 v_rayleighColor;\nvarying float v_opacity;\nvarying float v_translucent;\n#endif\n\nvoid main(void)\n{\n vec4 positionWC = czm_model * position;\n vec3 lightDirection = getLightDirection(positionWC.xyz);\n\n #ifndef PER_FRAGMENT_ATMOSPHERE\n computeAtmosphereScattering(\n positionWC.xyz,\n lightDirection,\n v_rayleighColor,\n v_mieColor,\n v_opacity,\n v_translucent\n );\n #endif\n \n v_outerPositionWC = positionWC.xyz;\n gl_Position = czm_modelViewProjection * position;\n}\n";
  201086. // node_modules/cesium/Source/Scene/SkyAtmosphere.js
  201087. function SkyAtmosphere(ellipsoid) {
  201088. ellipsoid = defaultValue_default(ellipsoid, Ellipsoid_default.WGS84);
  201089. this.show = true;
  201090. this.perFragmentAtmosphere = false;
  201091. this._ellipsoid = ellipsoid;
  201092. const outerEllipsoidScale = 1.025;
  201093. const scaleVector = Cartesian3_default.multiplyByScalar(
  201094. ellipsoid.radii,
  201095. outerEllipsoidScale,
  201096. new Cartesian3_default()
  201097. );
  201098. this._scaleMatrix = Matrix4_default.fromScale(scaleVector);
  201099. this._modelMatrix = new Matrix4_default();
  201100. this._command = new DrawCommand_default({
  201101. owner: this,
  201102. modelMatrix: this._modelMatrix
  201103. });
  201104. this._spSkyFromSpace = void 0;
  201105. this._spSkyFromAtmosphere = void 0;
  201106. this._flags = void 0;
  201107. this.atmosphereLightIntensity = 50;
  201108. this.atmosphereRayleighCoefficient = new Cartesian3_default(55e-7, 13e-6, 284e-7);
  201109. this.atmosphereMieCoefficient = new Cartesian3_default(21e-6, 21e-6, 21e-6);
  201110. this.atmosphereRayleighScaleHeight = 1e4;
  201111. this.atmosphereMieScaleHeight = 3200;
  201112. this.atmosphereMieAnisotropy = 0.9;
  201113. this.hueShift = 0;
  201114. this.saturationShift = 0;
  201115. this.brightnessShift = 0;
  201116. this._hueSaturationBrightness = new Cartesian3_default();
  201117. const radiiAndDynamicAtmosphereColor = new Cartesian3_default();
  201118. radiiAndDynamicAtmosphereColor.x = ellipsoid.maximumRadius * outerEllipsoidScale;
  201119. radiiAndDynamicAtmosphereColor.y = ellipsoid.maximumRadius;
  201120. radiiAndDynamicAtmosphereColor.z = 0;
  201121. this._radiiAndDynamicAtmosphereColor = radiiAndDynamicAtmosphereColor;
  201122. const that = this;
  201123. this._command.uniformMap = {
  201124. u_radiiAndDynamicAtmosphereColor: function() {
  201125. return that._radiiAndDynamicAtmosphereColor;
  201126. },
  201127. u_hsbShift: function() {
  201128. that._hueSaturationBrightness.x = that.hueShift;
  201129. that._hueSaturationBrightness.y = that.saturationShift;
  201130. that._hueSaturationBrightness.z = that.brightnessShift;
  201131. return that._hueSaturationBrightness;
  201132. },
  201133. u_atmosphereLightIntensity: function() {
  201134. return that.atmosphereLightIntensity;
  201135. },
  201136. u_atmosphereRayleighCoefficient: function() {
  201137. return that.atmosphereRayleighCoefficient;
  201138. },
  201139. u_atmosphereMieCoefficient: function() {
  201140. return that.atmosphereMieCoefficient;
  201141. },
  201142. u_atmosphereRayleighScaleHeight: function() {
  201143. return that.atmosphereRayleighScaleHeight;
  201144. },
  201145. u_atmosphereMieScaleHeight: function() {
  201146. return that.atmosphereMieScaleHeight;
  201147. },
  201148. u_atmosphereMieAnisotropy: function() {
  201149. return that.atmosphereMieAnisotropy;
  201150. }
  201151. };
  201152. }
  201153. Object.defineProperties(SkyAtmosphere.prototype, {
  201154. ellipsoid: {
  201155. get: function() {
  201156. return this._ellipsoid;
  201157. }
  201158. }
  201159. });
  201160. SkyAtmosphere.prototype.setDynamicAtmosphereColor = function(enableLighting, useSunDirection) {
  201161. const lightEnum = enableLighting ? useSunDirection ? 2 : 1 : 0;
  201162. this._radiiAndDynamicAtmosphereColor.z = lightEnum;
  201163. };
  201164. var scratchModelMatrix = new Matrix4_default();
  201165. SkyAtmosphere.prototype.update = function(frameState, globe) {
  201166. if (!this.show) {
  201167. return void 0;
  201168. }
  201169. const mode2 = frameState.mode;
  201170. if (mode2 !== SceneMode_default.SCENE3D && mode2 !== SceneMode_default.MORPHING) {
  201171. return void 0;
  201172. }
  201173. if (!frameState.passes.render) {
  201174. return void 0;
  201175. }
  201176. const rotationMatrix = Matrix4_default.fromRotationTranslation(
  201177. frameState.context.uniformState.inverseViewRotation,
  201178. Cartesian3_default.ZERO,
  201179. scratchModelMatrix
  201180. );
  201181. const rotationOffsetMatrix = Matrix4_default.multiplyTransformation(
  201182. rotationMatrix,
  201183. Axis_default.Y_UP_TO_Z_UP,
  201184. scratchModelMatrix
  201185. );
  201186. const modelMatrix = Matrix4_default.multiply(
  201187. this._scaleMatrix,
  201188. rotationOffsetMatrix,
  201189. scratchModelMatrix
  201190. );
  201191. Matrix4_default.clone(modelMatrix, this._modelMatrix);
  201192. const context = frameState.context;
  201193. const colorCorrect = hasColorCorrection(this);
  201194. const translucent = frameState.globeTranslucencyState.translucent;
  201195. const perFragmentAtmosphere = this.perFragmentAtmosphere || translucent || !defined_default(globe) || !globe.show;
  201196. const command = this._command;
  201197. if (!defined_default(command.vertexArray)) {
  201198. const geometry = EllipsoidGeometry_default.createGeometry(
  201199. new EllipsoidGeometry_default({
  201200. radii: new Cartesian3_default(1, 1, 1),
  201201. slicePartitions: 256,
  201202. stackPartitions: 256,
  201203. vertexFormat: VertexFormat_default.POSITION_ONLY
  201204. })
  201205. );
  201206. command.vertexArray = VertexArray_default.fromGeometry({
  201207. context,
  201208. geometry,
  201209. attributeLocations: GeometryPipeline_default.createAttributeLocations(geometry),
  201210. bufferUsage: BufferUsage_default.STATIC_DRAW
  201211. });
  201212. command.renderState = RenderState_default.fromCache({
  201213. cull: {
  201214. enabled: true,
  201215. face: CullFace_default.FRONT
  201216. },
  201217. blending: BlendingState_default.ALPHA_BLEND,
  201218. depthMask: false
  201219. });
  201220. }
  201221. const flags = colorCorrect | perFragmentAtmosphere << 2 | translucent << 3;
  201222. if (flags !== this._flags) {
  201223. this._flags = flags;
  201224. const defines = [];
  201225. if (colorCorrect) {
  201226. defines.push("COLOR_CORRECT");
  201227. }
  201228. if (perFragmentAtmosphere) {
  201229. defines.push("PER_FRAGMENT_ATMOSPHERE");
  201230. }
  201231. if (translucent) {
  201232. defines.push("GLOBE_TRANSLUCENT");
  201233. }
  201234. const vs = new ShaderSource_default({
  201235. defines,
  201236. sources: [AtmosphereCommon_default, SkyAtmosphereCommon_default, SkyAtmosphereVS_default]
  201237. });
  201238. const fs = new ShaderSource_default({
  201239. defines,
  201240. sources: [AtmosphereCommon_default, SkyAtmosphereCommon_default, SkyAtmosphereFS_default]
  201241. });
  201242. this._spSkyAtmosphere = ShaderProgram_default.fromCache({
  201243. context,
  201244. vertexShaderSource: vs,
  201245. fragmentShaderSource: fs
  201246. });
  201247. command.shaderProgram = this._spSkyAtmosphere;
  201248. }
  201249. return command;
  201250. };
  201251. function hasColorCorrection(skyAtmosphere) {
  201252. return !(Math_default.equalsEpsilon(
  201253. skyAtmosphere.hueShift,
  201254. 0,
  201255. Math_default.EPSILON7
  201256. ) && Math_default.equalsEpsilon(
  201257. skyAtmosphere.saturationShift,
  201258. 0,
  201259. Math_default.EPSILON7
  201260. ) && Math_default.equalsEpsilon(
  201261. skyAtmosphere.brightnessShift,
  201262. 0,
  201263. Math_default.EPSILON7
  201264. ));
  201265. }
  201266. SkyAtmosphere.prototype.isDestroyed = function() {
  201267. return false;
  201268. };
  201269. SkyAtmosphere.prototype.destroy = function() {
  201270. const command = this._command;
  201271. command.vertexArray = command.vertexArray && command.vertexArray.destroy();
  201272. this._spSkyAtmosphere = this._spSkyAtmosphere && this._spSkyAtmosphere.destroy();
  201273. return destroyObject_default(this);
  201274. };
  201275. var SkyAtmosphere_default = SkyAtmosphere;
  201276. // node_modules/cesium/Source/Shaders/SkyBoxFS.js
  201277. var SkyBoxFS_default = "uniform samplerCube u_cubeMap;\n\nvarying vec3 v_texCoord;\n\nvoid main()\n{\n vec4 color = textureCube(u_cubeMap, normalize(v_texCoord));\n gl_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n}\n";
  201278. // node_modules/cesium/Source/Shaders/SkyBoxVS.js
  201279. var SkyBoxVS_default = "attribute vec3 position;\n\nvarying vec3 v_texCoord;\n\nvoid main()\n{\n vec3 p = czm_viewRotation * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));\n gl_Position = czm_projection * vec4(p, 1.0);\n v_texCoord = position.xyz;\n}\n";
  201280. // node_modules/cesium/Source/Scene/SkyBox.js
  201281. function SkyBox(options) {
  201282. this.sources = options.sources;
  201283. this._sources = void 0;
  201284. this.show = defaultValue_default(options.show, true);
  201285. this._command = new DrawCommand_default({
  201286. modelMatrix: Matrix4_default.clone(Matrix4_default.IDENTITY),
  201287. owner: this
  201288. });
  201289. this._cubeMap = void 0;
  201290. this._attributeLocations = void 0;
  201291. this._useHdr = void 0;
  201292. }
  201293. SkyBox.prototype.update = function(frameState, useHdr) {
  201294. const that = this;
  201295. if (!this.show) {
  201296. return void 0;
  201297. }
  201298. if (frameState.mode !== SceneMode_default.SCENE3D && frameState.mode !== SceneMode_default.MORPHING) {
  201299. return void 0;
  201300. }
  201301. if (!frameState.passes.render) {
  201302. return void 0;
  201303. }
  201304. const context = frameState.context;
  201305. if (this._sources !== this.sources) {
  201306. this._sources = this.sources;
  201307. const sources = this.sources;
  201308. if (!defined_default(sources.positiveX) || !defined_default(sources.negativeX) || !defined_default(sources.positiveY) || !defined_default(sources.negativeY) || !defined_default(sources.positiveZ) || !defined_default(sources.negativeZ)) {
  201309. throw new DeveloperError_default(
  201310. "this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties."
  201311. );
  201312. }
  201313. if (typeof sources.positiveX !== typeof sources.negativeX || typeof sources.positiveX !== typeof sources.positiveY || typeof sources.positiveX !== typeof sources.negativeY || typeof sources.positiveX !== typeof sources.positiveZ || typeof sources.positiveX !== typeof sources.negativeZ) {
  201314. throw new DeveloperError_default(
  201315. "this.sources properties must all be the same type."
  201316. );
  201317. }
  201318. if (typeof sources.positiveX === "string") {
  201319. loadCubeMap_default(context, this._sources).then(function(cubeMap) {
  201320. that._cubeMap = that._cubeMap && that._cubeMap.destroy();
  201321. that._cubeMap = cubeMap;
  201322. });
  201323. } else {
  201324. this._cubeMap = this._cubeMap && this._cubeMap.destroy();
  201325. this._cubeMap = new CubeMap_default({
  201326. context,
  201327. source: sources
  201328. });
  201329. }
  201330. }
  201331. const command = this._command;
  201332. if (!defined_default(command.vertexArray)) {
  201333. command.uniformMap = {
  201334. u_cubeMap: function() {
  201335. return that._cubeMap;
  201336. }
  201337. };
  201338. const geometry = BoxGeometry_default.createGeometry(
  201339. BoxGeometry_default.fromDimensions({
  201340. dimensions: new Cartesian3_default(2, 2, 2),
  201341. vertexFormat: VertexFormat_default.POSITION_ONLY
  201342. })
  201343. );
  201344. const attributeLocations8 = this._attributeLocations = GeometryPipeline_default.createAttributeLocations(
  201345. geometry
  201346. );
  201347. command.vertexArray = VertexArray_default.fromGeometry({
  201348. context,
  201349. geometry,
  201350. attributeLocations: attributeLocations8,
  201351. bufferUsage: BufferUsage_default.STATIC_DRAW
  201352. });
  201353. command.renderState = RenderState_default.fromCache({
  201354. blending: BlendingState_default.ALPHA_BLEND
  201355. });
  201356. }
  201357. if (!defined_default(command.shaderProgram) || this._useHdr !== useHdr) {
  201358. const fs = new ShaderSource_default({
  201359. defines: [useHdr ? "HDR" : ""],
  201360. sources: [SkyBoxFS_default]
  201361. });
  201362. command.shaderProgram = ShaderProgram_default.fromCache({
  201363. context,
  201364. vertexShaderSource: SkyBoxVS_default,
  201365. fragmentShaderSource: fs,
  201366. attributeLocations: this._attributeLocations
  201367. });
  201368. this._useHdr = useHdr;
  201369. }
  201370. if (!defined_default(this._cubeMap)) {
  201371. return void 0;
  201372. }
  201373. return command;
  201374. };
  201375. SkyBox.prototype.isDestroyed = function() {
  201376. return false;
  201377. };
  201378. SkyBox.prototype.destroy = function() {
  201379. const command = this._command;
  201380. command.vertexArray = command.vertexArray && command.vertexArray.destroy();
  201381. command.shaderProgram = command.shaderProgram && command.shaderProgram.destroy();
  201382. this._cubeMap = this._cubeMap && this._cubeMap.destroy();
  201383. return destroyObject_default(this);
  201384. };
  201385. var SkyBox_default = SkyBox;
  201386. // node_modules/cesium/Source/Scene/SphereEmitter.js
  201387. function SphereEmitter(radius) {
  201388. radius = defaultValue_default(radius, 1);
  201389. Check_default.typeOf.number.greaterThan("radius", radius, 0);
  201390. this._radius = defaultValue_default(radius, 1);
  201391. }
  201392. Object.defineProperties(SphereEmitter.prototype, {
  201393. radius: {
  201394. get: function() {
  201395. return this._radius;
  201396. },
  201397. set: function(value) {
  201398. Check_default.typeOf.number.greaterThan("value", value, 0);
  201399. this._radius = value;
  201400. }
  201401. }
  201402. });
  201403. SphereEmitter.prototype.emit = function(particle) {
  201404. const theta = Math_default.randomBetween(0, Math_default.TWO_PI);
  201405. const phi = Math_default.randomBetween(0, Math_default.PI);
  201406. const rad = Math_default.randomBetween(0, this._radius);
  201407. const x = rad * Math.cos(theta) * Math.sin(phi);
  201408. const y = rad * Math.sin(theta) * Math.sin(phi);
  201409. const z = rad * Math.cos(phi);
  201410. particle.position = Cartesian3_default.fromElements(x, y, z, particle.position);
  201411. particle.velocity = Cartesian3_default.normalize(
  201412. particle.position,
  201413. particle.velocity
  201414. );
  201415. };
  201416. var SphereEmitter_default = SphereEmitter;
  201417. // node_modules/cesium/Source/Scene/StyleExpression.js
  201418. function StyleExpression() {
  201419. }
  201420. StyleExpression.prototype.evaluate = function(feature2, result) {
  201421. DeveloperError_default.throwInstantiationError();
  201422. };
  201423. StyleExpression.prototype.evaluateColor = function(feature2, result) {
  201424. DeveloperError_default.throwInstantiationError();
  201425. };
  201426. StyleExpression.prototype.getShaderFunction = function(functionSignature, variableSubstitutionMap, shaderState, returnType) {
  201427. DeveloperError_default.throwInstantiationError();
  201428. };
  201429. StyleExpression.prototype.getVariables = function() {
  201430. DeveloperError_default.throwInstantiationError();
  201431. };
  201432. var StyleExpression_default = StyleExpression;
  201433. // node_modules/cesium/Source/Shaders/SunFS.js
  201434. var SunFS_default = "uniform sampler2D u_texture;\n\nvarying vec2 v_textureCoordinates;\n\nvoid main()\n{\n vec4 color = texture2D(u_texture, v_textureCoordinates);\n gl_FragColor = czm_gammaCorrect(color);\n}\n";
  201435. // node_modules/cesium/Source/Shaders/SunTextureFS.js
  201436. var SunTextureFS_default = "uniform float u_radiusTS;\n\nvarying vec2 v_textureCoordinates;\n\nvec2 rotate(vec2 p, vec2 direction)\n{\n return vec2(p.x * direction.x - p.y * direction.y, p.x * direction.y + p.y * direction.x);\n}\n\nvec4 addBurst(vec2 position, vec2 direction, float lengthScalar)\n{\n vec2 rotatedPosition = rotate(position, direction) * vec2(25.0, 0.75);\n float radius = length(rotatedPosition) * lengthScalar;\n float burst = 1.0 - smoothstep(0.0, 0.55, radius);\n return vec4(burst);\n}\n\nvoid main()\n{\n float lengthScalar = 2.0 / sqrt(2.0);\n vec2 position = v_textureCoordinates - vec2(0.5);\n float radius = length(position) * lengthScalar;\n float surface = step(radius, u_radiusTS);\n vec4 color = vec4(vec2(1.0), surface + 0.2, surface);\n\n float glow = 1.0 - smoothstep(0.0, 0.55, radius);\n color.ba += mix(vec2(0.0), vec2(1.0), glow) * 0.75;\n\n vec4 burst = vec4(0.0);\n\n // The following loop has been manually unrolled for speed, to\n // avoid sin() and cos().\n //\n //for (float i = 0.4; i < 3.2; i += 1.047) {\n // vec2 direction = vec2(sin(i), cos(i));\n // burst += 0.4 * addBurst(position, direction, lengthScalar);\n //\n // direction = vec2(sin(i - 0.08), cos(i - 0.08));\n // burst += 0.3 * addBurst(position, direction, lengthScalar);\n //}\n\n burst += 0.4 * addBurst(position, vec2(0.38942, 0.92106), lengthScalar); // angle == 0.4\n burst += 0.4 * addBurst(position, vec2(0.99235, 0.12348), lengthScalar); // angle == 0.4 + 1.047\n burst += 0.4 * addBurst(position, vec2(0.60327, -0.79754), lengthScalar); // angle == 0.4 + 1.047 * 2.0\n\n burst += 0.3 * addBurst(position, vec2(0.31457, 0.94924), lengthScalar); // angle == 0.4 - 0.08\n burst += 0.3 * addBurst(position, vec2(0.97931, 0.20239), lengthScalar); // angle == 0.4 + 1.047 - 0.08\n burst += 0.3 * addBurst(position, vec2(0.66507, -0.74678), lengthScalar); // angle == 0.4 + 1.047 * 2.0 - 0.08\n\n // End of manual loop unrolling.\n\n color += clamp(burst, vec4(0.0), vec4(1.0)) * 0.15;\n\n gl_FragColor = clamp(color, vec4(0.0), vec4(1.0));\n}\n";
  201437. // node_modules/cesium/Source/Shaders/SunVS.js
  201438. var SunVS_default = "attribute vec2 direction;\n\nuniform float u_size;\n\nvarying vec2 v_textureCoordinates;\n\nvoid main() \n{\n vec4 position;\n if (czm_morphTime == 1.0)\n {\n position = vec4(czm_sunPositionWC, 1.0);\n }\n else\n {\n position = vec4(czm_sunPositionColumbusView.zxy, 1.0);\n }\n \n vec4 positionEC = czm_view * position;\n vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\n \n vec2 halfSize = vec2(u_size * 0.5);\n halfSize *= ((direction * 2.0) - 1.0);\n \n gl_Position = czm_viewportOrthographic * vec4(positionWC.xy + halfSize, -positionWC.z, 1.0);\n \n v_textureCoordinates = direction;\n}\n";
  201439. // node_modules/cesium/Source/Scene/Sun.js
  201440. function Sun() {
  201441. this.show = true;
  201442. this._drawCommand = new DrawCommand_default({
  201443. primitiveType: PrimitiveType_default.TRIANGLES,
  201444. boundingVolume: new BoundingSphere_default(),
  201445. owner: this
  201446. });
  201447. this._commands = {
  201448. drawCommand: this._drawCommand,
  201449. computeCommand: void 0
  201450. };
  201451. this._boundingVolume = new BoundingSphere_default();
  201452. this._boundingVolume2D = new BoundingSphere_default();
  201453. this._texture = void 0;
  201454. this._drawingBufferWidth = void 0;
  201455. this._drawingBufferHeight = void 0;
  201456. this._radiusTS = void 0;
  201457. this._size = void 0;
  201458. this.glowFactor = 1;
  201459. this._glowFactorDirty = false;
  201460. this._useHdr = void 0;
  201461. const that = this;
  201462. this._uniformMap = {
  201463. u_texture: function() {
  201464. return that._texture;
  201465. },
  201466. u_size: function() {
  201467. return that._size;
  201468. }
  201469. };
  201470. }
  201471. Object.defineProperties(Sun.prototype, {
  201472. glowFactor: {
  201473. get: function() {
  201474. return this._glowFactor;
  201475. },
  201476. set: function(glowFactor) {
  201477. glowFactor = Math.max(glowFactor, 0);
  201478. this._glowFactor = glowFactor;
  201479. this._glowFactorDirty = true;
  201480. }
  201481. }
  201482. });
  201483. var scratchPositionWC = new Cartesian2_default();
  201484. var scratchLimbWC = new Cartesian2_default();
  201485. var scratchPositionEC = new Cartesian4_default();
  201486. var scratchCartesian47 = new Cartesian4_default();
  201487. Sun.prototype.update = function(frameState, passState, useHdr) {
  201488. if (!this.show) {
  201489. return void 0;
  201490. }
  201491. const mode2 = frameState.mode;
  201492. if (mode2 === SceneMode_default.SCENE2D || mode2 === SceneMode_default.MORPHING) {
  201493. return void 0;
  201494. }
  201495. if (!frameState.passes.render) {
  201496. return void 0;
  201497. }
  201498. const context = frameState.context;
  201499. const drawingBufferWidth = passState.viewport.width;
  201500. const drawingBufferHeight = passState.viewport.height;
  201501. if (!defined_default(this._texture) || drawingBufferWidth !== this._drawingBufferWidth || drawingBufferHeight !== this._drawingBufferHeight || this._glowFactorDirty || useHdr !== this._useHdr) {
  201502. this._texture = this._texture && this._texture.destroy();
  201503. this._drawingBufferWidth = drawingBufferWidth;
  201504. this._drawingBufferHeight = drawingBufferHeight;
  201505. this._glowFactorDirty = false;
  201506. this._useHdr = useHdr;
  201507. let size = Math.max(drawingBufferWidth, drawingBufferHeight);
  201508. size = Math.pow(2, Math.ceil(Math.log(size) / Math.log(2)) - 2);
  201509. size = Math.max(1, size);
  201510. const pixelDatatype = useHdr ? context.halfFloatingPointTexture ? PixelDatatype_default.HALF_FLOAT : PixelDatatype_default.FLOAT : PixelDatatype_default.UNSIGNED_BYTE;
  201511. this._texture = new Texture_default({
  201512. context,
  201513. width: size,
  201514. height: size,
  201515. pixelFormat: PixelFormat_default.RGBA,
  201516. pixelDatatype
  201517. });
  201518. this._glowLengthTS = this._glowFactor * 5;
  201519. this._radiusTS = 1 / (1 + 2 * this._glowLengthTS) * 0.5;
  201520. const that = this;
  201521. const uniformMap2 = {
  201522. u_radiusTS: function() {
  201523. return that._radiusTS;
  201524. }
  201525. };
  201526. this._commands.computeCommand = new ComputeCommand_default({
  201527. fragmentShaderSource: SunTextureFS_default,
  201528. outputTexture: this._texture,
  201529. uniformMap: uniformMap2,
  201530. persists: false,
  201531. owner: this,
  201532. postExecute: function() {
  201533. that._commands.computeCommand = void 0;
  201534. }
  201535. });
  201536. }
  201537. const drawCommand = this._drawCommand;
  201538. if (!defined_default(drawCommand.vertexArray)) {
  201539. const attributeLocations8 = {
  201540. direction: 0
  201541. };
  201542. const directions2 = new Uint8Array(4 * 2);
  201543. directions2[0] = 0;
  201544. directions2[1] = 0;
  201545. directions2[2] = 255;
  201546. directions2[3] = 0;
  201547. directions2[4] = 255;
  201548. directions2[5] = 255;
  201549. directions2[6] = 0;
  201550. directions2[7] = 255;
  201551. const vertexBuffer = Buffer_default.createVertexBuffer({
  201552. context,
  201553. typedArray: directions2,
  201554. usage: BufferUsage_default.STATIC_DRAW
  201555. });
  201556. const attributes = [
  201557. {
  201558. index: attributeLocations8.direction,
  201559. vertexBuffer,
  201560. componentsPerAttribute: 2,
  201561. normalize: true,
  201562. componentDatatype: ComponentDatatype_default.UNSIGNED_BYTE
  201563. }
  201564. ];
  201565. const indexBuffer = Buffer_default.createIndexBuffer({
  201566. context,
  201567. typedArray: new Uint16Array([0, 1, 2, 0, 2, 3]),
  201568. usage: BufferUsage_default.STATIC_DRAW,
  201569. indexDatatype: IndexDatatype_default.UNSIGNED_SHORT
  201570. });
  201571. drawCommand.vertexArray = new VertexArray_default({
  201572. context,
  201573. attributes,
  201574. indexBuffer
  201575. });
  201576. drawCommand.shaderProgram = ShaderProgram_default.fromCache({
  201577. context,
  201578. vertexShaderSource: SunVS_default,
  201579. fragmentShaderSource: SunFS_default,
  201580. attributeLocations: attributeLocations8
  201581. });
  201582. drawCommand.renderState = RenderState_default.fromCache({
  201583. blending: BlendingState_default.ALPHA_BLEND
  201584. });
  201585. drawCommand.uniformMap = this._uniformMap;
  201586. }
  201587. const sunPosition = context.uniformState.sunPositionWC;
  201588. const sunPositionCV = context.uniformState.sunPositionColumbusView;
  201589. const boundingVolume = this._boundingVolume;
  201590. const boundingVolume2D = this._boundingVolume2D;
  201591. Cartesian3_default.clone(sunPosition, boundingVolume.center);
  201592. boundingVolume2D.center.x = sunPositionCV.z;
  201593. boundingVolume2D.center.y = sunPositionCV.x;
  201594. boundingVolume2D.center.z = sunPositionCV.y;
  201595. boundingVolume.radius = Math_default.SOLAR_RADIUS + Math_default.SOLAR_RADIUS * this._glowLengthTS;
  201596. boundingVolume2D.radius = boundingVolume.radius;
  201597. if (mode2 === SceneMode_default.SCENE3D) {
  201598. BoundingSphere_default.clone(boundingVolume, drawCommand.boundingVolume);
  201599. } else if (mode2 === SceneMode_default.COLUMBUS_VIEW) {
  201600. BoundingSphere_default.clone(boundingVolume2D, drawCommand.boundingVolume);
  201601. }
  201602. const position = SceneTransforms_default.computeActualWgs84Position(
  201603. frameState,
  201604. sunPosition,
  201605. scratchCartesian47
  201606. );
  201607. const dist = Cartesian3_default.magnitude(
  201608. Cartesian3_default.subtract(position, frameState.camera.position, scratchCartesian47)
  201609. );
  201610. const projMatrix = context.uniformState.projection;
  201611. const positionEC = scratchPositionEC;
  201612. positionEC.x = 0;
  201613. positionEC.y = 0;
  201614. positionEC.z = -dist;
  201615. positionEC.w = 1;
  201616. const positionCC2 = Matrix4_default.multiplyByVector(
  201617. projMatrix,
  201618. positionEC,
  201619. scratchCartesian47
  201620. );
  201621. const positionWC2 = SceneTransforms_default.clipToGLWindowCoordinates(
  201622. passState.viewport,
  201623. positionCC2,
  201624. scratchPositionWC
  201625. );
  201626. positionEC.x = Math_default.SOLAR_RADIUS;
  201627. const limbCC = Matrix4_default.multiplyByVector(
  201628. projMatrix,
  201629. positionEC,
  201630. scratchCartesian47
  201631. );
  201632. const limbWC = SceneTransforms_default.clipToGLWindowCoordinates(
  201633. passState.viewport,
  201634. limbCC,
  201635. scratchLimbWC
  201636. );
  201637. this._size = Cartesian2_default.magnitude(
  201638. Cartesian2_default.subtract(limbWC, positionWC2, scratchCartesian47)
  201639. );
  201640. this._size = 2 * this._size * (1 + 2 * this._glowLengthTS);
  201641. this._size = Math.ceil(this._size);
  201642. return this._commands;
  201643. };
  201644. Sun.prototype.isDestroyed = function() {
  201645. return false;
  201646. };
  201647. Sun.prototype.destroy = function() {
  201648. const command = this._drawCommand;
  201649. command.vertexArray = command.vertexArray && command.vertexArray.destroy();
  201650. command.shaderProgram = command.shaderProgram && command.shaderProgram.destroy();
  201651. this._texture = this._texture && this._texture.destroy();
  201652. return destroyObject_default(this);
  201653. };
  201654. var Sun_default = Sun;
  201655. // node_modules/cesium/Source/Scene/TileBoundingVolume.js
  201656. function TileBoundingVolume() {
  201657. }
  201658. TileBoundingVolume.prototype.boundingVolume = void 0;
  201659. TileBoundingVolume.prototype.boundingSphere = void 0;
  201660. TileBoundingVolume.prototype.distanceToCamera = function(frameState) {
  201661. DeveloperError_default.throwInstantiationError();
  201662. };
  201663. TileBoundingVolume.prototype.intersectPlane = function(plane) {
  201664. DeveloperError_default.throwInstantiationError();
  201665. };
  201666. TileBoundingVolume.prototype.createDebugVolume = function(color) {
  201667. DeveloperError_default.throwInstantiationError();
  201668. };
  201669. var TileBoundingVolume_default = TileBoundingVolume;
  201670. // node_modules/cesium/Source/Scene/TileCoordinatesImageryProvider.js
  201671. function TileCoordinatesImageryProvider(options) {
  201672. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  201673. this._tilingScheme = defined_default(options.tilingScheme) ? options.tilingScheme : new GeographicTilingScheme_default({ ellipsoid: options.ellipsoid });
  201674. this._color = defaultValue_default(options.color, Color_default.YELLOW);
  201675. this._errorEvent = new Event_default();
  201676. this._tileWidth = defaultValue_default(options.tileWidth, 256);
  201677. this._tileHeight = defaultValue_default(options.tileHeight, 256);
  201678. this._readyPromise = Promise.resolve(true);
  201679. this.defaultAlpha = void 0;
  201680. this.defaultNightAlpha = void 0;
  201681. this.defaultDayAlpha = void 0;
  201682. this.defaultBrightness = void 0;
  201683. this.defaultContrast = void 0;
  201684. this.defaultHue = void 0;
  201685. this.defaultSaturation = void 0;
  201686. this.defaultGamma = void 0;
  201687. this.defaultMinificationFilter = void 0;
  201688. this.defaultMagnificationFilter = void 0;
  201689. }
  201690. Object.defineProperties(TileCoordinatesImageryProvider.prototype, {
  201691. proxy: {
  201692. get: function() {
  201693. return void 0;
  201694. }
  201695. },
  201696. tileWidth: {
  201697. get: function() {
  201698. return this._tileWidth;
  201699. }
  201700. },
  201701. tileHeight: {
  201702. get: function() {
  201703. return this._tileHeight;
  201704. }
  201705. },
  201706. maximumLevel: {
  201707. get: function() {
  201708. return void 0;
  201709. }
  201710. },
  201711. minimumLevel: {
  201712. get: function() {
  201713. return void 0;
  201714. }
  201715. },
  201716. tilingScheme: {
  201717. get: function() {
  201718. return this._tilingScheme;
  201719. }
  201720. },
  201721. rectangle: {
  201722. get: function() {
  201723. return this._tilingScheme.rectangle;
  201724. }
  201725. },
  201726. tileDiscardPolicy: {
  201727. get: function() {
  201728. return void 0;
  201729. }
  201730. },
  201731. errorEvent: {
  201732. get: function() {
  201733. return this._errorEvent;
  201734. }
  201735. },
  201736. ready: {
  201737. get: function() {
  201738. return true;
  201739. }
  201740. },
  201741. readyPromise: {
  201742. get: function() {
  201743. return this._readyPromise;
  201744. }
  201745. },
  201746. credit: {
  201747. get: function() {
  201748. return void 0;
  201749. }
  201750. },
  201751. hasAlphaChannel: {
  201752. get: function() {
  201753. return true;
  201754. }
  201755. }
  201756. });
  201757. TileCoordinatesImageryProvider.prototype.getTileCredits = function(x, y, level) {
  201758. return void 0;
  201759. };
  201760. TileCoordinatesImageryProvider.prototype.requestImage = function(x, y, level, request) {
  201761. const canvas = document.createElement("canvas");
  201762. canvas.width = 256;
  201763. canvas.height = 256;
  201764. const context = canvas.getContext("2d");
  201765. const cssColor = this._color.toCssColorString();
  201766. context.strokeStyle = cssColor;
  201767. context.lineWidth = 2;
  201768. context.strokeRect(1, 1, 255, 255);
  201769. context.font = "bold 25px Arial";
  201770. context.textAlign = "center";
  201771. context.fillStyle = cssColor;
  201772. context.fillText(`L: ${level}`, 124, 86);
  201773. context.fillText(`X: ${x}`, 124, 136);
  201774. context.fillText(`Y: ${y}`, 124, 186);
  201775. return Promise.resolve(canvas);
  201776. };
  201777. TileCoordinatesImageryProvider.prototype.pickFeatures = function(x, y, level, longitude, latitude) {
  201778. return void 0;
  201779. };
  201780. var TileCoordinatesImageryProvider_default = TileCoordinatesImageryProvider;
  201781. // node_modules/cesium/Source/Scene/TileDiscardPolicy.js
  201782. function TileDiscardPolicy(options) {
  201783. DeveloperError_default.throwInstantiationError();
  201784. }
  201785. TileDiscardPolicy.prototype.isReady = DeveloperError_default.throwInstantiationError;
  201786. TileDiscardPolicy.prototype.shouldDiscardImage = DeveloperError_default.throwInstantiationError;
  201787. var TileDiscardPolicy_default = TileDiscardPolicy;
  201788. // node_modules/cesium/Source/Scene/TileState.js
  201789. var TileState = {
  201790. START: 0,
  201791. LOADING: 1,
  201792. READY: 2,
  201793. UPSAMPLED_ONLY: 3
  201794. };
  201795. var TileState_default = Object.freeze(TileState);
  201796. // node_modules/cesium/Source/Scene/TimeDynamicPointCloud.js
  201797. function TimeDynamicPointCloud(options) {
  201798. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  201799. Check_default.typeOf.object("options.clock", options.clock);
  201800. Check_default.typeOf.object("options.intervals", options.intervals);
  201801. this.show = defaultValue_default(options.show, true);
  201802. this.modelMatrix = Matrix4_default.clone(
  201803. defaultValue_default(options.modelMatrix, Matrix4_default.IDENTITY)
  201804. );
  201805. this.shadows = defaultValue_default(options.shadows, ShadowMode_default.ENABLED);
  201806. this.maximumMemoryUsage = defaultValue_default(options.maximumMemoryUsage, 256);
  201807. this.shading = new PointCloudShading_default(options.shading);
  201808. this.style = options.style;
  201809. this.frameFailed = new Event_default();
  201810. this.frameChanged = new Event_default();
  201811. this._clock = options.clock;
  201812. this._intervals = options.intervals;
  201813. this._clippingPlanes = void 0;
  201814. this.clippingPlanes = options.clippingPlanes;
  201815. this._pointCloudEyeDomeLighting = new PointCloudEyeDomeLighting_default2();
  201816. this._loadTimestamp = void 0;
  201817. this._clippingPlanesState = 0;
  201818. this._styleDirty = false;
  201819. this._pickId = void 0;
  201820. this._totalMemoryUsageInBytes = 0;
  201821. this._frames = [];
  201822. this._previousInterval = void 0;
  201823. this._nextInterval = void 0;
  201824. this._lastRenderedFrame = void 0;
  201825. this._clockMultiplier = 0;
  201826. this._readyPromise = defer_default();
  201827. this._runningSum = 0;
  201828. this._runningLength = 0;
  201829. this._runningIndex = 0;
  201830. this._runningSamples = arrayFill_default(new Array(5), 0);
  201831. this._runningAverage = 0;
  201832. }
  201833. Object.defineProperties(TimeDynamicPointCloud.prototype, {
  201834. clippingPlanes: {
  201835. get: function() {
  201836. return this._clippingPlanes;
  201837. },
  201838. set: function(value) {
  201839. ClippingPlaneCollection_default.setOwner(value, this, "_clippingPlanes");
  201840. }
  201841. },
  201842. totalMemoryUsageInBytes: {
  201843. get: function() {
  201844. return this._totalMemoryUsageInBytes;
  201845. }
  201846. },
  201847. boundingSphere: {
  201848. get: function() {
  201849. if (defined_default(this._lastRenderedFrame)) {
  201850. return this._lastRenderedFrame.pointCloud.boundingSphere;
  201851. }
  201852. return void 0;
  201853. }
  201854. },
  201855. readyPromise: {
  201856. get: function() {
  201857. return this._readyPromise.promise;
  201858. }
  201859. }
  201860. });
  201861. function getFragmentShaderLoaded2(fs) {
  201862. return `uniform vec4 czm_pickColor;
  201863. ${fs}`;
  201864. }
  201865. function getUniformMapLoaded2(stream) {
  201866. return function(uniformMap2) {
  201867. return combine_default(uniformMap2, {
  201868. czm_pickColor: function() {
  201869. return stream._pickId.color;
  201870. }
  201871. });
  201872. };
  201873. }
  201874. function getPickIdLoaded2() {
  201875. return "czm_pickColor";
  201876. }
  201877. TimeDynamicPointCloud.prototype.makeStyleDirty = function() {
  201878. this._styleDirty = true;
  201879. };
  201880. TimeDynamicPointCloud.prototype._getAverageLoadTime = function() {
  201881. if (this._runningLength === 0) {
  201882. return 0.05;
  201883. }
  201884. return this._runningAverage;
  201885. };
  201886. var scratchDate2 = new JulianDate_default();
  201887. function getClockMultiplier(that) {
  201888. const clock = that._clock;
  201889. const isAnimating = clock.canAnimate && clock.shouldAnimate;
  201890. const multiplier = clock.multiplier;
  201891. return isAnimating ? multiplier : 0;
  201892. }
  201893. function getIntervalIndex(that, interval) {
  201894. return that._intervals.indexOf(interval.start);
  201895. }
  201896. function getNextInterval(that, currentInterval) {
  201897. const intervals = that._intervals;
  201898. const clock = that._clock;
  201899. const multiplier = getClockMultiplier(that);
  201900. if (multiplier === 0) {
  201901. return void 0;
  201902. }
  201903. const averageLoadTime = that._getAverageLoadTime();
  201904. const time = JulianDate_default.addSeconds(
  201905. clock.currentTime,
  201906. averageLoadTime * multiplier,
  201907. scratchDate2
  201908. );
  201909. let index2 = intervals.indexOf(time);
  201910. const currentIndex = getIntervalIndex(that, currentInterval);
  201911. if (index2 === currentIndex) {
  201912. if (multiplier >= 0) {
  201913. ++index2;
  201914. } else {
  201915. --index2;
  201916. }
  201917. }
  201918. return intervals.get(index2);
  201919. }
  201920. function getCurrentInterval(that) {
  201921. const intervals = that._intervals;
  201922. const clock = that._clock;
  201923. const time = clock.currentTime;
  201924. const index2 = intervals.indexOf(time);
  201925. return intervals.get(index2);
  201926. }
  201927. function reachedInterval(that, currentInterval, nextInterval) {
  201928. const multiplier = getClockMultiplier(that);
  201929. const currentIndex = getIntervalIndex(that, currentInterval);
  201930. const nextIndex = getIntervalIndex(that, nextInterval);
  201931. if (multiplier >= 0) {
  201932. return currentIndex >= nextIndex;
  201933. }
  201934. return currentIndex <= nextIndex;
  201935. }
  201936. function handleFrameFailure(that, uri) {
  201937. return function(error) {
  201938. const message = defined_default(error.message) ? error.message : error.toString();
  201939. if (that.frameFailed.numberOfListeners > 0) {
  201940. that.frameFailed.raiseEvent({
  201941. uri,
  201942. message
  201943. });
  201944. } else {
  201945. console.log(`A frame failed to load: ${uri}`);
  201946. console.log(`Error: ${message}`);
  201947. }
  201948. };
  201949. }
  201950. function requestFrame(that, interval, frameState) {
  201951. const index2 = getIntervalIndex(that, interval);
  201952. const frames = that._frames;
  201953. let frame = frames[index2];
  201954. if (!defined_default(frame)) {
  201955. const transformArray = interval.data.transform;
  201956. const transform4 = defined_default(transformArray) ? Matrix4_default.fromArray(transformArray) : void 0;
  201957. const uri = interval.data.uri;
  201958. frame = {
  201959. pointCloud: void 0,
  201960. transform: transform4,
  201961. timestamp: getTimestamp_default(),
  201962. sequential: true,
  201963. ready: false,
  201964. touchedFrameNumber: frameState.frameNumber
  201965. };
  201966. frames[index2] = frame;
  201967. Resource_default.fetchArrayBuffer({
  201968. url: uri
  201969. }).then(function(arrayBuffer) {
  201970. frame.pointCloud = new PointCloud_default({
  201971. arrayBuffer,
  201972. cull: true,
  201973. fragmentShaderLoaded: getFragmentShaderLoaded2,
  201974. uniformMapLoaded: getUniformMapLoaded2(that),
  201975. pickIdLoaded: getPickIdLoaded2
  201976. });
  201977. return frame.pointCloud.readyPromise;
  201978. }).catch(handleFrameFailure(that, uri));
  201979. }
  201980. return frame;
  201981. }
  201982. function updateAverageLoadTime(that, loadTime) {
  201983. that._runningSum += loadTime;
  201984. that._runningSum -= that._runningSamples[that._runningIndex];
  201985. that._runningSamples[that._runningIndex] = loadTime;
  201986. that._runningLength = Math.min(
  201987. that._runningLength + 1,
  201988. that._runningSamples.length
  201989. );
  201990. that._runningIndex = (that._runningIndex + 1) % that._runningSamples.length;
  201991. that._runningAverage = that._runningSum / that._runningLength;
  201992. }
  201993. function prepareFrame(that, frame, updateState2, frameState) {
  201994. if (frame.touchedFrameNumber < frameState.frameNumber - 1) {
  201995. frame.sequential = false;
  201996. }
  201997. const pointCloud = frame.pointCloud;
  201998. if (defined_default(pointCloud) && !frame.ready) {
  201999. const commandList = frameState.commandList;
  202000. const lengthBeforeUpdate = commandList.length;
  202001. renderFrame(that, frame, updateState2, frameState);
  202002. if (pointCloud.ready) {
  202003. frame.ready = true;
  202004. that._totalMemoryUsageInBytes += pointCloud.geometryByteLength;
  202005. commandList.length = lengthBeforeUpdate;
  202006. if (frame.sequential) {
  202007. const loadTime = (getTimestamp_default() - frame.timestamp) / 1e3;
  202008. updateAverageLoadTime(that, loadTime);
  202009. }
  202010. }
  202011. }
  202012. frame.touchedFrameNumber = frameState.frameNumber;
  202013. }
  202014. var scratchModelMatrix2 = new Matrix4_default();
  202015. function getGeometricError4(that, pointCloud) {
  202016. const shading = that.shading;
  202017. if (defined_default(shading) && defined_default(shading.baseResolution)) {
  202018. return shading.baseResolution;
  202019. } else if (defined_default(pointCloud.boundingSphere)) {
  202020. return Math_default.cbrt(
  202021. pointCloud.boundingSphere.volume() / pointCloud.pointsLength
  202022. );
  202023. }
  202024. return 0;
  202025. }
  202026. function getMaximumAttenuation(that) {
  202027. const shading = that.shading;
  202028. if (defined_default(shading) && defined_default(shading.maximumAttenuation)) {
  202029. return shading.maximumAttenuation;
  202030. }
  202031. return 10;
  202032. }
  202033. var defaultShading2 = new PointCloudShading_default();
  202034. function renderFrame(that, frame, updateState2, frameState) {
  202035. const shading = defaultValue_default(that.shading, defaultShading2);
  202036. const pointCloud = frame.pointCloud;
  202037. const transform4 = defaultValue_default(frame.transform, Matrix4_default.IDENTITY);
  202038. pointCloud.modelMatrix = Matrix4_default.multiplyTransformation(
  202039. that.modelMatrix,
  202040. transform4,
  202041. scratchModelMatrix2
  202042. );
  202043. pointCloud.style = that.style;
  202044. pointCloud.time = updateState2.timeSinceLoad;
  202045. pointCloud.shadows = that.shadows;
  202046. pointCloud.clippingPlanes = that._clippingPlanes;
  202047. pointCloud.isClipped = updateState2.isClipped;
  202048. pointCloud.attenuation = shading.attenuation;
  202049. pointCloud.backFaceCulling = shading.backFaceCulling;
  202050. pointCloud.normalShading = shading.normalShading;
  202051. pointCloud.geometricError = getGeometricError4(that, pointCloud);
  202052. pointCloud.geometricErrorScale = shading.geometricErrorScale;
  202053. pointCloud.maximumAttenuation = getMaximumAttenuation(that);
  202054. pointCloud.update(frameState);
  202055. frame.touchedFrameNumber = frameState.frameNumber;
  202056. }
  202057. function loadFrame(that, interval, updateState2, frameState) {
  202058. const frame = requestFrame(that, interval, frameState);
  202059. prepareFrame(that, frame, updateState2, frameState);
  202060. }
  202061. function getUnloadCondition(frameState) {
  202062. return function(frame) {
  202063. return frame.touchedFrameNumber < frameState.frameNumber;
  202064. };
  202065. }
  202066. function unloadFrames(that, unloadCondition) {
  202067. const frames = that._frames;
  202068. const length3 = frames.length;
  202069. for (let i2 = 0; i2 < length3; ++i2) {
  202070. const frame = frames[i2];
  202071. if (defined_default(frame)) {
  202072. if (!defined_default(unloadCondition) || unloadCondition(frame)) {
  202073. const pointCloud = frame.pointCloud;
  202074. if (frame.ready) {
  202075. that._totalMemoryUsageInBytes -= pointCloud.geometryByteLength;
  202076. }
  202077. if (defined_default(pointCloud)) {
  202078. pointCloud.destroy();
  202079. }
  202080. if (frame === that._lastRenderedFrame) {
  202081. that._lastRenderedFrame = void 0;
  202082. }
  202083. frames[i2] = void 0;
  202084. }
  202085. }
  202086. }
  202087. }
  202088. function getFrame(that, interval) {
  202089. const index2 = getIntervalIndex(that, interval);
  202090. const frame = that._frames[index2];
  202091. if (defined_default(frame) && frame.ready) {
  202092. return frame;
  202093. }
  202094. }
  202095. function updateInterval(that, interval, frame, updateState2, frameState) {
  202096. if (defined_default(frame)) {
  202097. if (frame.ready) {
  202098. return true;
  202099. }
  202100. loadFrame(that, interval, updateState2, frameState);
  202101. return frame.ready;
  202102. }
  202103. return false;
  202104. }
  202105. function getNearestReadyInterval(that, previousInterval, currentInterval, updateState2, frameState) {
  202106. let i2;
  202107. let interval;
  202108. let frame;
  202109. const intervals = that._intervals;
  202110. const frames = that._frames;
  202111. const currentIndex = getIntervalIndex(that, currentInterval);
  202112. const previousIndex = getIntervalIndex(that, previousInterval);
  202113. if (currentIndex >= previousIndex) {
  202114. for (i2 = currentIndex; i2 >= previousIndex; --i2) {
  202115. interval = intervals.get(i2);
  202116. frame = frames[i2];
  202117. if (updateInterval(that, interval, frame, updateState2, frameState)) {
  202118. return interval;
  202119. }
  202120. }
  202121. } else {
  202122. for (i2 = currentIndex; i2 <= previousIndex; ++i2) {
  202123. interval = intervals.get(i2);
  202124. frame = frames[i2];
  202125. if (updateInterval(that, interval, frame, updateState2, frameState)) {
  202126. return interval;
  202127. }
  202128. }
  202129. }
  202130. return previousInterval;
  202131. }
  202132. function setFramesDirty(that, clippingPlanesDirty, styleDirty) {
  202133. const frames = that._frames;
  202134. const framesLength = frames.length;
  202135. for (let i2 = 0; i2 < framesLength; ++i2) {
  202136. const frame = frames[i2];
  202137. if (defined_default(frame) && defined_default(frame.pointCloud)) {
  202138. frame.pointCloud.clippingPlanesDirty = clippingPlanesDirty;
  202139. frame.pointCloud.styleDirty = styleDirty;
  202140. }
  202141. }
  202142. }
  202143. var updateState = {
  202144. timeSinceLoad: 0,
  202145. isClipped: false,
  202146. clippingPlanesDirty: false
  202147. };
  202148. TimeDynamicPointCloud.prototype.update = function(frameState) {
  202149. if (frameState.mode === SceneMode_default.MORPHING) {
  202150. return;
  202151. }
  202152. if (!this.show) {
  202153. return;
  202154. }
  202155. if (!defined_default(this._pickId)) {
  202156. this._pickId = frameState.context.createPickId({
  202157. primitive: this
  202158. });
  202159. }
  202160. if (!defined_default(this._loadTimestamp)) {
  202161. this._loadTimestamp = JulianDate_default.clone(frameState.time);
  202162. }
  202163. const timeSinceLoad = Math.max(
  202164. JulianDate_default.secondsDifference(frameState.time, this._loadTimestamp) * 1e3,
  202165. 0
  202166. );
  202167. const clippingPlanes = this._clippingPlanes;
  202168. let clippingPlanesState = 0;
  202169. let clippingPlanesDirty = false;
  202170. const isClipped = defined_default(clippingPlanes) && clippingPlanes.enabled;
  202171. if (isClipped) {
  202172. clippingPlanes.update(frameState);
  202173. clippingPlanesState = clippingPlanes.clippingPlanesState;
  202174. }
  202175. if (this._clippingPlanesState !== clippingPlanesState) {
  202176. this._clippingPlanesState = clippingPlanesState;
  202177. clippingPlanesDirty = true;
  202178. }
  202179. const styleDirty = this._styleDirty;
  202180. this._styleDirty = false;
  202181. if (clippingPlanesDirty || styleDirty) {
  202182. setFramesDirty(this, clippingPlanesDirty, styleDirty);
  202183. }
  202184. updateState.timeSinceLoad = timeSinceLoad;
  202185. updateState.isClipped = isClipped;
  202186. const shading = this.shading;
  202187. const eyeDomeLighting = this._pointCloudEyeDomeLighting;
  202188. const commandList = frameState.commandList;
  202189. const lengthBeforeUpdate = commandList.length;
  202190. let previousInterval = this._previousInterval;
  202191. let nextInterval = this._nextInterval;
  202192. const currentInterval = getCurrentInterval(this);
  202193. if (!defined_default(currentInterval)) {
  202194. return;
  202195. }
  202196. let clockMultiplierChanged = false;
  202197. const clockMultiplier = getClockMultiplier(this);
  202198. const clockPaused = clockMultiplier === 0;
  202199. if (clockMultiplier !== this._clockMultiplier) {
  202200. clockMultiplierChanged = true;
  202201. this._clockMultiplier = clockMultiplier;
  202202. }
  202203. if (!defined_default(previousInterval) || clockPaused) {
  202204. previousInterval = currentInterval;
  202205. }
  202206. if (!defined_default(nextInterval) || clockMultiplierChanged || reachedInterval(this, currentInterval, nextInterval)) {
  202207. nextInterval = getNextInterval(this, currentInterval);
  202208. }
  202209. previousInterval = getNearestReadyInterval(
  202210. this,
  202211. previousInterval,
  202212. currentInterval,
  202213. updateState,
  202214. frameState
  202215. );
  202216. let frame = getFrame(this, previousInterval);
  202217. if (!defined_default(frame)) {
  202218. loadFrame(this, previousInterval, updateState, frameState);
  202219. frame = this._lastRenderedFrame;
  202220. }
  202221. if (defined_default(frame)) {
  202222. renderFrame(this, frame, updateState, frameState);
  202223. }
  202224. if (defined_default(nextInterval)) {
  202225. loadFrame(this, nextInterval, updateState, frameState);
  202226. }
  202227. const that = this;
  202228. if (defined_default(frame) && !defined_default(this._lastRenderedFrame)) {
  202229. frameState.afterRender.push(function() {
  202230. that._readyPromise.resolve(that);
  202231. });
  202232. }
  202233. if (defined_default(frame) && frame !== this._lastRenderedFrame) {
  202234. if (that.frameChanged.numberOfListeners > 0) {
  202235. frameState.afterRender.push(function() {
  202236. that.frameChanged.raiseEvent(that);
  202237. });
  202238. }
  202239. }
  202240. this._previousInterval = previousInterval;
  202241. this._nextInterval = nextInterval;
  202242. this._lastRenderedFrame = frame;
  202243. const totalMemoryUsageInBytes = this._totalMemoryUsageInBytes;
  202244. const maximumMemoryUsageInBytes = this.maximumMemoryUsage * 1024 * 1024;
  202245. if (totalMemoryUsageInBytes > maximumMemoryUsageInBytes) {
  202246. unloadFrames(this, getUnloadCondition(frameState));
  202247. }
  202248. const lengthAfterUpdate = commandList.length;
  202249. const addedCommandsLength = lengthAfterUpdate - lengthBeforeUpdate;
  202250. if (defined_default(shading) && shading.attenuation && shading.eyeDomeLighting && addedCommandsLength > 0) {
  202251. eyeDomeLighting.update(
  202252. frameState,
  202253. lengthBeforeUpdate,
  202254. shading,
  202255. this.boundingSphere
  202256. );
  202257. }
  202258. };
  202259. TimeDynamicPointCloud.prototype.isDestroyed = function() {
  202260. return false;
  202261. };
  202262. TimeDynamicPointCloud.prototype.destroy = function() {
  202263. unloadFrames(this);
  202264. this._clippingPlanes = this._clippingPlanes && this._clippingPlanes.destroy();
  202265. this._pickId = this._pickId && this._pickId.destroy();
  202266. return destroyObject_default(this);
  202267. };
  202268. var TimeDynamicPointCloud_default = TimeDynamicPointCloud;
  202269. // node_modules/cesium/Source/Shaders/ViewportQuadFS.js
  202270. var ViewportQuadFS_default = "\nvarying vec2 v_textureCoordinates;\n\nvoid main()\n{\n czm_materialInput materialInput;\n \n materialInput.s = v_textureCoordinates.s;\n materialInput.st = v_textureCoordinates;\n materialInput.str = vec3(v_textureCoordinates, 0.0);\n materialInput.normalEC = vec3(0.0, 0.0, -1.0);\n \n czm_material material = czm_getMaterial(materialInput);\n\n gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n}\n";
  202271. // node_modules/cesium/Source/Scene/ViewportQuad.js
  202272. function ViewportQuad(rectangle, material) {
  202273. this.show = true;
  202274. if (!defined_default(rectangle)) {
  202275. rectangle = new BoundingRectangle_default();
  202276. }
  202277. this.rectangle = BoundingRectangle_default.clone(rectangle);
  202278. if (!defined_default(material)) {
  202279. material = Material_default.fromType(Material_default.ColorType, {
  202280. color: new Color_default(1, 1, 1, 1)
  202281. });
  202282. }
  202283. this.material = material;
  202284. this._material = void 0;
  202285. this._overlayCommand = void 0;
  202286. this._rs = void 0;
  202287. }
  202288. ViewportQuad.prototype.update = function(frameState) {
  202289. if (!this.show) {
  202290. return;
  202291. }
  202292. if (!defined_default(this.material)) {
  202293. throw new DeveloperError_default("this.material must be defined.");
  202294. }
  202295. if (!defined_default(this.rectangle)) {
  202296. throw new DeveloperError_default("this.rectangle must be defined.");
  202297. }
  202298. const rs = this._rs;
  202299. if (!defined_default(rs) || !BoundingRectangle_default.equals(rs.viewport, this.rectangle)) {
  202300. this._rs = RenderState_default.fromCache({
  202301. blending: BlendingState_default.ALPHA_BLEND,
  202302. viewport: this.rectangle
  202303. });
  202304. }
  202305. const pass = frameState.passes;
  202306. if (pass.render) {
  202307. const context = frameState.context;
  202308. if (this._material !== this.material || !defined_default(this._overlayCommand)) {
  202309. this._material = this.material;
  202310. if (defined_default(this._overlayCommand)) {
  202311. this._overlayCommand.shaderProgram.destroy();
  202312. }
  202313. const fs = new ShaderSource_default({
  202314. sources: [this._material.shaderSource, ViewportQuadFS_default]
  202315. });
  202316. this._overlayCommand = context.createViewportQuadCommand(fs, {
  202317. renderState: this._rs,
  202318. uniformMap: this._material._uniforms,
  202319. owner: this
  202320. });
  202321. this._overlayCommand.pass = Pass_default.OVERLAY;
  202322. }
  202323. this._material.update(context);
  202324. this._overlayCommand.renderState = this._rs;
  202325. this._overlayCommand.uniformMap = this._material._uniforms;
  202326. frameState.commandList.push(this._overlayCommand);
  202327. }
  202328. };
  202329. ViewportQuad.prototype.isDestroyed = function() {
  202330. return false;
  202331. };
  202332. ViewportQuad.prototype.destroy = function() {
  202333. if (defined_default(this._overlayCommand)) {
  202334. this._overlayCommand.shaderProgram = this._overlayCommand.shaderProgram && this._overlayCommand.shaderProgram.destroy();
  202335. }
  202336. return destroyObject_default(this);
  202337. };
  202338. var ViewportQuad_default = ViewportQuad;
  202339. // node_modules/cesium/Source/Scene/computeFlyToLocationForRectangle.js
  202340. function computeFlyToLocationForRectangle(rectangle, scene) {
  202341. const terrainProvider = scene.terrainProvider;
  202342. const mapProjection = scene.mapProjection;
  202343. const ellipsoid = mapProjection.ellipsoid;
  202344. let positionWithoutTerrain;
  202345. const tmp2 = scene.camera.getRectangleCameraCoordinates(rectangle);
  202346. if (scene.mode === SceneMode_default.SCENE3D) {
  202347. positionWithoutTerrain = ellipsoid.cartesianToCartographic(tmp2);
  202348. } else {
  202349. positionWithoutTerrain = mapProjection.unproject(tmp2);
  202350. }
  202351. if (!defined_default(terrainProvider)) {
  202352. return Promise.resolve(positionWithoutTerrain);
  202353. }
  202354. return terrainProvider.readyPromise.then(function() {
  202355. const availability = terrainProvider.availability;
  202356. if (!defined_default(availability) || scene.mode === SceneMode_default.SCENE2D) {
  202357. return positionWithoutTerrain;
  202358. }
  202359. const cartographics = [
  202360. Rectangle_default.center(rectangle),
  202361. Rectangle_default.southeast(rectangle),
  202362. Rectangle_default.southwest(rectangle),
  202363. Rectangle_default.northeast(rectangle),
  202364. Rectangle_default.northwest(rectangle)
  202365. ];
  202366. return computeFlyToLocationForRectangle._sampleTerrainMostDetailed(terrainProvider, cartographics).then(function(positionsOnTerrain) {
  202367. const maxHeight = positionsOnTerrain.reduce(
  202368. function(currentMax, item) {
  202369. return Math.max(item.height, currentMax);
  202370. },
  202371. -Number.MAX_VALUE
  202372. );
  202373. const finalPosition = positionWithoutTerrain;
  202374. finalPosition.height += maxHeight;
  202375. return finalPosition;
  202376. });
  202377. });
  202378. }
  202379. computeFlyToLocationForRectangle._sampleTerrainMostDetailed = sampleTerrainMostDetailed_default;
  202380. var computeFlyToLocationForRectangle_default = computeFlyToLocationForRectangle;
  202381. // node_modules/cesium/Source/Scene/createElevationBandMaterial.js
  202382. var scratchColor25 = new Color_default();
  202383. var scratchColorAbove = new Color_default();
  202384. var scratchColorBelow = new Color_default();
  202385. var scratchColorBlend = new Color_default();
  202386. var scratchPackedFloat = new Cartesian4_default();
  202387. var scratchColorBytes2 = new Uint8Array(4);
  202388. function lerpEntryColor(height, entryBefore, entryAfter, result) {
  202389. const lerpFactor = entryBefore.height === entryAfter.height ? 0 : (height - entryBefore.height) / (entryAfter.height - entryBefore.height);
  202390. return Color_default.lerp(entryBefore.color, entryAfter.color, lerpFactor, result);
  202391. }
  202392. function createNewEntry(height, color) {
  202393. return {
  202394. height,
  202395. color: Color_default.clone(color)
  202396. };
  202397. }
  202398. function removeDuplicates2(entries) {
  202399. entries = entries.filter(function(entry, index2, array) {
  202400. const hasPrev = index2 > 0;
  202401. const hasNext = index2 < array.length - 1;
  202402. const sameHeightAsPrev = hasPrev ? entry.height === array[index2 - 1].height : true;
  202403. const sameHeightAsNext = hasNext ? entry.height === array[index2 + 1].height : true;
  202404. const keep = !sameHeightAsPrev || !sameHeightAsNext;
  202405. return keep;
  202406. });
  202407. entries = entries.filter(function(entry, index2, array) {
  202408. const hasPrev = index2 > 0;
  202409. const hasNext = index2 < array.length - 1;
  202410. const sameColorAsPrev = hasPrev ? Color_default.equals(entry.color, array[index2 - 1].color) : false;
  202411. const sameColorAsNext = hasNext ? Color_default.equals(entry.color, array[index2 + 1].color) : false;
  202412. const keep = !sameColorAsPrev || !sameColorAsNext;
  202413. return keep;
  202414. });
  202415. entries = entries.filter(function(entry, index2, array) {
  202416. const hasPrev = index2 > 0;
  202417. const sameColorAsPrev = hasPrev ? Color_default.equals(entry.color, array[index2 - 1].color) : false;
  202418. const sameHeightAsPrev = hasPrev ? entry.height === array[index2 - 1].height : true;
  202419. const keep = !sameColorAsPrev || !sameHeightAsPrev;
  202420. return keep;
  202421. });
  202422. return entries;
  202423. }
  202424. function preprocess(layers) {
  202425. let i2, j;
  202426. const layeredEntries = [];
  202427. const layersLength = layers.length;
  202428. for (i2 = 0; i2 < layersLength; i2++) {
  202429. const layer = layers[i2];
  202430. const entriesOrig = layer.entries;
  202431. const entriesLength = entriesOrig.length;
  202432. if (!Array.isArray(entriesOrig) || entriesLength === 0) {
  202433. throw new DeveloperError_default("entries must be an array with size > 0.");
  202434. }
  202435. let entries = [];
  202436. for (j = 0; j < entriesLength; j++) {
  202437. const entryOrig = entriesOrig[j];
  202438. if (!defined_default(entryOrig.height)) {
  202439. throw new DeveloperError_default("entry requires a height.");
  202440. }
  202441. if (!defined_default(entryOrig.color)) {
  202442. throw new DeveloperError_default("entry requires a color.");
  202443. }
  202444. const height = Math_default.clamp(
  202445. entryOrig.height,
  202446. createElevationBandMaterial._minimumHeight,
  202447. createElevationBandMaterial._maximumHeight
  202448. );
  202449. const color = Color_default.clone(entryOrig.color, scratchColor25);
  202450. color.red *= color.alpha;
  202451. color.green *= color.alpha;
  202452. color.blue *= color.alpha;
  202453. entries.push(createNewEntry(height, color));
  202454. }
  202455. let sortedAscending = true;
  202456. let sortedDescending = true;
  202457. for (j = 0; j < entriesLength - 1; j++) {
  202458. const currEntry = entries[j + 0];
  202459. const nextEntry = entries[j + 1];
  202460. sortedAscending = sortedAscending && currEntry.height <= nextEntry.height;
  202461. sortedDescending = sortedDescending && currEntry.height >= nextEntry.height;
  202462. }
  202463. if (sortedDescending) {
  202464. entries = entries.reverse();
  202465. } else if (!sortedAscending) {
  202466. mergeSort_default(entries, function(a4, b) {
  202467. return Math_default.sign(a4.height - b.height);
  202468. });
  202469. }
  202470. let extendDownwards = defaultValue_default(layer.extendDownwards, false);
  202471. let extendUpwards = defaultValue_default(layer.extendUpwards, false);
  202472. if (entries.length === 1 && !extendDownwards && !extendUpwards) {
  202473. extendDownwards = true;
  202474. extendUpwards = true;
  202475. }
  202476. if (extendDownwards) {
  202477. entries.splice(
  202478. 0,
  202479. 0,
  202480. createNewEntry(
  202481. createElevationBandMaterial._minimumHeight,
  202482. entries[0].color
  202483. )
  202484. );
  202485. }
  202486. if (extendUpwards) {
  202487. entries.splice(
  202488. entries.length,
  202489. 0,
  202490. createNewEntry(
  202491. createElevationBandMaterial._maximumHeight,
  202492. entries[entries.length - 1].color
  202493. )
  202494. );
  202495. }
  202496. entries = removeDuplicates2(entries);
  202497. layeredEntries.push(entries);
  202498. }
  202499. return layeredEntries;
  202500. }
  202501. function createLayeredEntries(layers) {
  202502. const layeredEntries = preprocess(layers);
  202503. let entriesAccumNext = [];
  202504. let entriesAccumCurr = [];
  202505. let i2;
  202506. function addEntry(height, color) {
  202507. entriesAccumNext.push(createNewEntry(height, color));
  202508. }
  202509. function addBlendEntry(height, a4, b) {
  202510. let result = Color_default.multiplyByScalar(b, 1 - a4.alpha, scratchColorBlend);
  202511. result = Color_default.add(result, a4, result);
  202512. addEntry(height, result);
  202513. }
  202514. const layerLength = layeredEntries.length;
  202515. for (i2 = 0; i2 < layerLength; i2++) {
  202516. const entries = layeredEntries[i2];
  202517. let idx = 0;
  202518. let accumIdx = 0;
  202519. entriesAccumCurr = entriesAccumNext;
  202520. entriesAccumNext = [];
  202521. const entriesLength = entries.length;
  202522. const entriesAccumLength = entriesAccumCurr.length;
  202523. while (idx < entriesLength || accumIdx < entriesAccumLength) {
  202524. const entry = idx < entriesLength ? entries[idx] : void 0;
  202525. const prevEntry = idx > 0 ? entries[idx - 1] : void 0;
  202526. const nextEntry = idx < entriesLength - 1 ? entries[idx + 1] : void 0;
  202527. const entryAccum = accumIdx < entriesAccumLength ? entriesAccumCurr[accumIdx] : void 0;
  202528. const prevEntryAccum = accumIdx > 0 ? entriesAccumCurr[accumIdx - 1] : void 0;
  202529. const nextEntryAccum = accumIdx < entriesAccumLength - 1 ? entriesAccumCurr[accumIdx + 1] : void 0;
  202530. if (defined_default(entry) && defined_default(entryAccum) && entry.height === entryAccum.height) {
  202531. const isSplitAccum = defined_default(nextEntryAccum) && entryAccum.height === nextEntryAccum.height;
  202532. const isStartAccum = !defined_default(prevEntryAccum);
  202533. const isEndAccum = !defined_default(nextEntryAccum);
  202534. const isSplit = defined_default(nextEntry) && entry.height === nextEntry.height;
  202535. const isStart = !defined_default(prevEntry);
  202536. const isEnd = !defined_default(nextEntry);
  202537. if (isSplitAccum) {
  202538. if (isSplit) {
  202539. addBlendEntry(entry.height, entry.color, entryAccum.color);
  202540. addBlendEntry(entry.height, nextEntry.color, nextEntryAccum.color);
  202541. } else if (isStart) {
  202542. addEntry(entry.height, entryAccum.color);
  202543. addBlendEntry(entry.height, entry.color, nextEntryAccum.color);
  202544. } else if (isEnd) {
  202545. addBlendEntry(entry.height, entry.color, entryAccum.color);
  202546. addEntry(entry.height, nextEntryAccum.color);
  202547. } else {
  202548. addBlendEntry(entry.height, entry.color, entryAccum.color);
  202549. addBlendEntry(entry.height, entry.color, nextEntryAccum.color);
  202550. }
  202551. } else if (isStartAccum) {
  202552. if (isSplit) {
  202553. addEntry(entry.height, entry.color);
  202554. addBlendEntry(entry.height, nextEntry.color, entryAccum.color);
  202555. } else if (isEnd) {
  202556. addEntry(entry.height, entry.color);
  202557. addEntry(entry.height, entryAccum.color);
  202558. } else if (isStart) {
  202559. addBlendEntry(entry.height, entry.color, entryAccum.color);
  202560. } else {
  202561. addEntry(entry.height, entry.color);
  202562. addBlendEntry(entry.height, entry.color, entryAccum.color);
  202563. }
  202564. } else if (isEndAccum) {
  202565. if (isSplit) {
  202566. addBlendEntry(entry.height, entry.color, entryAccum.color);
  202567. addEntry(entry.height, nextEntry.color);
  202568. } else if (isStart) {
  202569. addEntry(entry.height, entryAccum.color);
  202570. addEntry(entry.height, entry.color);
  202571. } else if (isEnd) {
  202572. addBlendEntry(entry.height, entry.color, entryAccum.color);
  202573. } else {
  202574. addBlendEntry(entry.height, entry.color, entryAccum.color);
  202575. addEntry(entry.height, entry.color);
  202576. }
  202577. } else {
  202578. if (isSplit) {
  202579. addBlendEntry(entry.height, entry.color, entryAccum.color);
  202580. addBlendEntry(entry.height, nextEntry.color, entryAccum.color);
  202581. } else if (isStart) {
  202582. addEntry(entry.height, entryAccum.color);
  202583. addBlendEntry(entry.height, entry.color, entryAccum.color);
  202584. } else if (isEnd) {
  202585. addBlendEntry(entry.height, entry.color, entryAccum.color);
  202586. addEntry(entry.height, entryAccum.color);
  202587. } else {
  202588. addBlendEntry(entry.height, entry.color, entryAccum.color);
  202589. }
  202590. }
  202591. idx += isSplit ? 2 : 1;
  202592. accumIdx += isSplitAccum ? 2 : 1;
  202593. } else if (defined_default(entry) && defined_default(entryAccum) && defined_default(prevEntryAccum) && entry.height < entryAccum.height) {
  202594. const colorBelow = lerpEntryColor(
  202595. entry.height,
  202596. prevEntryAccum,
  202597. entryAccum,
  202598. scratchColorBelow
  202599. );
  202600. if (!defined_default(prevEntry)) {
  202601. addEntry(entry.height, colorBelow);
  202602. addBlendEntry(entry.height, entry.color, colorBelow);
  202603. } else if (!defined_default(nextEntry)) {
  202604. addBlendEntry(entry.height, entry.color, colorBelow);
  202605. addEntry(entry.height, colorBelow);
  202606. } else {
  202607. addBlendEntry(entry.height, entry.color, colorBelow);
  202608. }
  202609. idx++;
  202610. } else if (defined_default(entryAccum) && defined_default(entry) && defined_default(prevEntry) && entryAccum.height < entry.height) {
  202611. const colorAbove = lerpEntryColor(
  202612. entryAccum.height,
  202613. prevEntry,
  202614. entry,
  202615. scratchColorAbove
  202616. );
  202617. if (!defined_default(prevEntryAccum)) {
  202618. addEntry(entryAccum.height, colorAbove);
  202619. addBlendEntry(entryAccum.height, colorAbove, entryAccum.color);
  202620. } else if (!defined_default(nextEntryAccum)) {
  202621. addBlendEntry(entryAccum.height, colorAbove, entryAccum.color);
  202622. addEntry(entryAccum.height, colorAbove);
  202623. } else {
  202624. addBlendEntry(entryAccum.height, colorAbove, entryAccum.color);
  202625. }
  202626. accumIdx++;
  202627. } else if (defined_default(entry) && (!defined_default(entryAccum) || entry.height < entryAccum.height)) {
  202628. if (defined_default(entryAccum) && !defined_default(prevEntryAccum) && !defined_default(nextEntry)) {
  202629. addEntry(entry.height, entry.color);
  202630. addEntry(entry.height, createElevationBandMaterial._emptyColor);
  202631. addEntry(entryAccum.height, createElevationBandMaterial._emptyColor);
  202632. } else if (!defined_default(entryAccum) && defined_default(prevEntryAccum) && !defined_default(prevEntry)) {
  202633. addEntry(
  202634. prevEntryAccum.height,
  202635. createElevationBandMaterial._emptyColor
  202636. );
  202637. addEntry(entry.height, createElevationBandMaterial._emptyColor);
  202638. addEntry(entry.height, entry.color);
  202639. } else {
  202640. addEntry(entry.height, entry.color);
  202641. }
  202642. idx++;
  202643. } else if (defined_default(entryAccum) && (!defined_default(entry) || entryAccum.height < entry.height)) {
  202644. addEntry(entryAccum.height, entryAccum.color);
  202645. accumIdx++;
  202646. }
  202647. }
  202648. }
  202649. const allEntries = removeDuplicates2(entriesAccumNext);
  202650. return allEntries;
  202651. }
  202652. function createElevationBandMaterial(options) {
  202653. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  202654. const scene = options.scene;
  202655. const layers = options.layers;
  202656. Check_default.typeOf.object("options.scene", scene);
  202657. Check_default.defined("options.layers", layers);
  202658. Check_default.typeOf.number.greaterThan("options.layers.length", layers.length, 0);
  202659. const entries = createLayeredEntries(layers);
  202660. const entriesLength = entries.length;
  202661. let i2;
  202662. let heightTexBuffer;
  202663. let heightTexDatatype;
  202664. let heightTexFormat;
  202665. const isPackedHeight = !createElevationBandMaterial._useFloatTexture(
  202666. scene.context
  202667. );
  202668. if (isPackedHeight) {
  202669. heightTexDatatype = PixelDatatype_default.UNSIGNED_BYTE;
  202670. heightTexFormat = PixelFormat_default.RGBA;
  202671. heightTexBuffer = new Uint8Array(entriesLength * 4);
  202672. for (i2 = 0; i2 < entriesLength; i2++) {
  202673. Cartesian4_default.packFloat(entries[i2].height, scratchPackedFloat);
  202674. Cartesian4_default.pack(scratchPackedFloat, heightTexBuffer, i2 * 4);
  202675. }
  202676. } else {
  202677. heightTexDatatype = PixelDatatype_default.FLOAT;
  202678. heightTexFormat = PixelFormat_default.LUMINANCE;
  202679. heightTexBuffer = new Float32Array(entriesLength);
  202680. for (i2 = 0; i2 < entriesLength; i2++) {
  202681. heightTexBuffer[i2] = entries[i2].height;
  202682. }
  202683. }
  202684. const heightsTex = Texture_default.create({
  202685. context: scene.context,
  202686. pixelFormat: heightTexFormat,
  202687. pixelDatatype: heightTexDatatype,
  202688. source: {
  202689. arrayBufferView: heightTexBuffer,
  202690. width: entriesLength,
  202691. height: 1
  202692. },
  202693. sampler: new Sampler_default({
  202694. wrapS: TextureWrap_default.CLAMP_TO_EDGE,
  202695. wrapT: TextureWrap_default.CLAMP_TO_EDGE,
  202696. minificationFilter: TextureMinificationFilter_default.NEAREST,
  202697. magnificationFilter: TextureMagnificationFilter_default.NEAREST
  202698. })
  202699. });
  202700. const colorsArray = new Uint8Array(entriesLength * 4);
  202701. for (i2 = 0; i2 < entriesLength; i2++) {
  202702. const color = entries[i2].color;
  202703. color.toBytes(scratchColorBytes2);
  202704. colorsArray[i2 * 4 + 0] = scratchColorBytes2[0];
  202705. colorsArray[i2 * 4 + 1] = scratchColorBytes2[1];
  202706. colorsArray[i2 * 4 + 2] = scratchColorBytes2[2];
  202707. colorsArray[i2 * 4 + 3] = scratchColorBytes2[3];
  202708. }
  202709. const colorsTex = Texture_default.create({
  202710. context: scene.context,
  202711. pixelFormat: PixelFormat_default.RGBA,
  202712. pixelDatatype: PixelDatatype_default.UNSIGNED_BYTE,
  202713. source: {
  202714. arrayBufferView: colorsArray,
  202715. width: entriesLength,
  202716. height: 1
  202717. },
  202718. sampler: new Sampler_default({
  202719. wrapS: TextureWrap_default.CLAMP_TO_EDGE,
  202720. wrapT: TextureWrap_default.CLAMP_TO_EDGE,
  202721. minificationFilter: TextureMinificationFilter_default.LINEAR,
  202722. magnificationFilter: TextureMagnificationFilter_default.LINEAR
  202723. })
  202724. });
  202725. const material = Material_default.fromType("ElevationBand", {
  202726. heights: heightsTex,
  202727. colors: colorsTex
  202728. });
  202729. return material;
  202730. }
  202731. createElevationBandMaterial._useFloatTexture = function(context) {
  202732. return context.floatingPointTexture;
  202733. };
  202734. createElevationBandMaterial._maximumHeight = 5906376425472;
  202735. createElevationBandMaterial._minimumHeight = -5906376425472;
  202736. createElevationBandMaterial._emptyColor = new Color_default(0, 0, 0, 0);
  202737. var createElevationBandMaterial_default = createElevationBandMaterial;
  202738. // node_modules/cesium/Source/Scene/createOsmBuildings.js
  202739. function createOsmBuildings(options) {
  202740. options = combine_default(options, {
  202741. url: IonResource_default.fromAssetId(96188)
  202742. });
  202743. const tileset = new Cesium3DTileset_default(options);
  202744. let style = options.style;
  202745. if (!defined_default(style)) {
  202746. const color = defaultValue_default(
  202747. options.defaultColor,
  202748. Color_default.WHITE
  202749. ).toCssColorString();
  202750. style = new Cesium3DTileStyle_default({
  202751. color: `Boolean(\${feature['cesium#color']}) ? color(\${feature['cesium#color']}) : ${color}`
  202752. });
  202753. }
  202754. tileset.style = style;
  202755. return tileset;
  202756. }
  202757. var createOsmBuildings_default = createOsmBuildings;
  202758. // node_modules/cesium/Source/Scene/createTangentSpaceDebugPrimitive.js
  202759. function createTangentSpaceDebugPrimitive(options) {
  202760. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  202761. const instances = [];
  202762. let geometry = options.geometry;
  202763. if (!defined_default(geometry)) {
  202764. throw new DeveloperError_default("options.geometry is required.");
  202765. }
  202766. if (!defined_default(geometry.attributes) || !defined_default(geometry.primitiveType)) {
  202767. geometry = geometry.constructor.createGeometry(geometry);
  202768. }
  202769. const attributes = geometry.attributes;
  202770. const modelMatrix = Matrix4_default.clone(
  202771. defaultValue_default(options.modelMatrix, Matrix4_default.IDENTITY)
  202772. );
  202773. const length3 = defaultValue_default(options.length, 1e4);
  202774. if (defined_default(attributes.normal)) {
  202775. instances.push(
  202776. new GeometryInstance_default({
  202777. geometry: GeometryPipeline_default.createLineSegmentsForVectors(
  202778. geometry,
  202779. "normal",
  202780. length3
  202781. ),
  202782. attributes: {
  202783. color: new ColorGeometryInstanceAttribute_default(1, 0, 0, 1)
  202784. },
  202785. modelMatrix
  202786. })
  202787. );
  202788. }
  202789. if (defined_default(attributes.tangent)) {
  202790. instances.push(
  202791. new GeometryInstance_default({
  202792. geometry: GeometryPipeline_default.createLineSegmentsForVectors(
  202793. geometry,
  202794. "tangent",
  202795. length3
  202796. ),
  202797. attributes: {
  202798. color: new ColorGeometryInstanceAttribute_default(0, 1, 0, 1)
  202799. },
  202800. modelMatrix
  202801. })
  202802. );
  202803. }
  202804. if (defined_default(attributes.bitangent)) {
  202805. instances.push(
  202806. new GeometryInstance_default({
  202807. geometry: GeometryPipeline_default.createLineSegmentsForVectors(
  202808. geometry,
  202809. "bitangent",
  202810. length3
  202811. ),
  202812. attributes: {
  202813. color: new ColorGeometryInstanceAttribute_default(0, 0, 1, 1)
  202814. },
  202815. modelMatrix
  202816. })
  202817. );
  202818. }
  202819. if (instances.length > 0) {
  202820. return new Primitive_default({
  202821. asynchronous: false,
  202822. geometryInstances: instances,
  202823. appearance: new PerInstanceColorAppearance_default({
  202824. flat: true,
  202825. translucent: false
  202826. })
  202827. });
  202828. }
  202829. return void 0;
  202830. }
  202831. var createTangentSpaceDebugPrimitive_default = createTangentSpaceDebugPrimitive;
  202832. // node_modules/cesium/Source/Scene/createWorldImagery.js
  202833. function createWorldImagery(options) {
  202834. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  202835. const style = defaultValue_default(options.style, IonWorldImageryStyle_default.AERIAL);
  202836. return new IonImageryProvider_default({
  202837. assetId: style
  202838. });
  202839. }
  202840. var createWorldImagery_default = createWorldImagery;
  202841. // node_modules/cesium/Source/ThirdParty/knockout-3.5.1.js
  202842. var oldValue;
  202843. if (typeof ko !== "undefined") {
  202844. oldValue = ko;
  202845. }
  202846. (function() {
  202847. (function() {
  202848. (function(n2) {
  202849. var A = this || (0, eval)("this"), w = A.document, R = A.navigator, v7 = A.jQuery, H = A.JSON;
  202850. v7 || "undefined" === typeof jQuery || (v7 = jQuery);
  202851. (function(n3) {
  202852. n3(A.ko = {});
  202853. })(function(S, T) {
  202854. function K(a5, c14) {
  202855. return null === a5 || typeof a5 in W ? a5 === c14 : false;
  202856. }
  202857. function X(b, c14) {
  202858. var d;
  202859. return function() {
  202860. d || (d = a4.a.setTimeout(function() {
  202861. d = n2;
  202862. b();
  202863. }, c14));
  202864. };
  202865. }
  202866. function Y(b, c14) {
  202867. var d;
  202868. return function() {
  202869. clearTimeout(d);
  202870. d = a4.a.setTimeout(b, c14);
  202871. };
  202872. }
  202873. function Z(a5, c14) {
  202874. c14 && "change" !== c14 ? "beforeChange" === c14 ? this.pc(a5) : this.gb(a5, c14) : this.qc(a5);
  202875. }
  202876. function aa(a5, c14) {
  202877. null !== c14 && c14.s && c14.s();
  202878. }
  202879. function ba(a5, c14) {
  202880. var d = this.qd, e2 = d[r2];
  202881. e2.ra || (this.Qb && this.mb[c14] ? (d.uc(c14, a5, this.mb[c14]), this.mb[c14] = null, --this.Qb) : e2.I[c14] || d.uc(c14, a5, e2.J ? { da: a5 } : d.$c(a5)), a5.Ja && a5.gd());
  202882. }
  202883. var a4 = "undefined" !== typeof S ? S : {};
  202884. a4.b = function(b, c14) {
  202885. for (var d = b.split("."), e2 = a4, f2 = 0; f2 < d.length - 1; f2++)
  202886. e2 = e2[d[f2]];
  202887. e2[d[d.length - 1]] = c14;
  202888. };
  202889. a4.L = function(a5, c14, d) {
  202890. a5[c14] = d;
  202891. };
  202892. a4.version = "3.5.1";
  202893. a4.b(
  202894. "version",
  202895. a4.version
  202896. );
  202897. a4.options = { deferUpdates: false, useOnlyNativeEvents: false, foreachHidesDestroyed: false };
  202898. a4.a = function() {
  202899. function b(a5, b2) {
  202900. for (var c15 in a5)
  202901. f2.call(a5, c15) && b2(c15, a5[c15]);
  202902. }
  202903. function c14(a5, b2) {
  202904. if (b2)
  202905. for (var c15 in b2)
  202906. f2.call(b2, c15) && (a5[c15] = b2[c15]);
  202907. return a5;
  202908. }
  202909. function d(a5, b2) {
  202910. a5.__proto__ = b2;
  202911. return a5;
  202912. }
  202913. function e2(b2, c15, d2, e3) {
  202914. var l3 = b2[c15].match(q) || [];
  202915. a4.a.D(d2.match(q), function(b3) {
  202916. a4.a.Na(l3, b3, e3);
  202917. });
  202918. b2[c15] = l3.join(" ");
  202919. }
  202920. var f2 = Object.prototype.hasOwnProperty, g = { __proto__: [] } instanceof Array, h = "function" === typeof Symbol, m = {}, k = {};
  202921. m[R && /Firefox\/2/i.test(R.userAgent) ? "KeyboardEvent" : "UIEvents"] = ["keyup", "keydown", "keypress"];
  202922. m.MouseEvents = "click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave".split(" ");
  202923. b(m, function(a5, b2) {
  202924. if (b2.length)
  202925. for (var c15 = 0, d2 = b2.length; c15 < d2; c15++)
  202926. k[b2[c15]] = a5;
  202927. });
  202928. var l2 = { propertychange: true }, p2 = w && function() {
  202929. for (var a5 = 3, b2 = w.createElement("div"), c15 = b2.getElementsByTagName("i"); b2.innerHTML = "<!--[if gt IE " + ++a5 + "]><i></i><![endif]-->", c15[0]; )
  202930. ;
  202931. return 4 < a5 ? a5 : n2;
  202932. }(), q = /\S+/g, t;
  202933. return {
  202934. Jc: ["authenticity_token", /^__RequestVerificationToken(_.*)?$/],
  202935. D: function(a5, b2, c15) {
  202936. for (var d2 = 0, e3 = a5.length; d2 < e3; d2++)
  202937. b2.call(c15, a5[d2], d2, a5);
  202938. },
  202939. A: "function" == typeof Array.prototype.indexOf ? function(a5, b2) {
  202940. return Array.prototype.indexOf.call(a5, b2);
  202941. } : function(a5, b2) {
  202942. for (var c15 = 0, d2 = a5.length; c15 < d2; c15++)
  202943. if (a5[c15] === b2)
  202944. return c15;
  202945. return -1;
  202946. },
  202947. Lb: function(a5, b2, c15) {
  202948. for (var d2 = 0, e3 = a5.length; d2 < e3; d2++)
  202949. if (b2.call(c15, a5[d2], d2, a5))
  202950. return a5[d2];
  202951. return n2;
  202952. },
  202953. Pa: function(b2, c15) {
  202954. var d2 = a4.a.A(b2, c15);
  202955. 0 < d2 ? b2.splice(d2, 1) : 0 === d2 && b2.shift();
  202956. },
  202957. wc: function(b2) {
  202958. var c15 = [];
  202959. b2 && a4.a.D(b2, function(b3) {
  202960. 0 > a4.a.A(c15, b3) && c15.push(b3);
  202961. });
  202962. return c15;
  202963. },
  202964. Mb: function(a5, b2, c15) {
  202965. var d2 = [];
  202966. if (a5)
  202967. for (var e3 = 0, l3 = a5.length; e3 < l3; e3++)
  202968. d2.push(b2.call(c15, a5[e3], e3));
  202969. return d2;
  202970. },
  202971. jb: function(a5, b2, c15) {
  202972. var d2 = [];
  202973. if (a5)
  202974. for (var e3 = 0, l3 = a5.length; e3 < l3; e3++)
  202975. b2.call(c15, a5[e3], e3) && d2.push(a5[e3]);
  202976. return d2;
  202977. },
  202978. Nb: function(a5, b2) {
  202979. if (b2 instanceof Array)
  202980. a5.push.apply(a5, b2);
  202981. else
  202982. for (var c15 = 0, d2 = b2.length; c15 < d2; c15++)
  202983. a5.push(b2[c15]);
  202984. return a5;
  202985. },
  202986. Na: function(b2, c15, d2) {
  202987. var e3 = a4.a.A(a4.a.bc(b2), c15);
  202988. 0 > e3 ? d2 && b2.push(c15) : d2 || b2.splice(e3, 1);
  202989. },
  202990. Ba: g,
  202991. extend: c14,
  202992. setPrototypeOf: d,
  202993. Ab: g ? d : c14,
  202994. P: b,
  202995. Ga: function(a5, b2, c15) {
  202996. if (!a5)
  202997. return a5;
  202998. var d2 = {}, e3;
  202999. for (e3 in a5)
  203000. f2.call(a5, e3) && (d2[e3] = b2.call(c15, a5[e3], e3, a5));
  203001. return d2;
  203002. },
  203003. Tb: function(b2) {
  203004. for (; b2.firstChild; )
  203005. a4.removeNode(b2.firstChild);
  203006. },
  203007. Yb: function(b2) {
  203008. b2 = a4.a.la(b2);
  203009. for (var c15 = (b2[0] && b2[0].ownerDocument || w).createElement("div"), d2 = 0, e3 = b2.length; d2 < e3; d2++)
  203010. c15.appendChild(a4.oa(b2[d2]));
  203011. return c15;
  203012. },
  203013. Ca: function(b2, c15) {
  203014. for (var d2 = 0, e3 = b2.length, l3 = []; d2 < e3; d2++) {
  203015. var k2 = b2[d2].cloneNode(true);
  203016. l3.push(c15 ? a4.oa(k2) : k2);
  203017. }
  203018. return l3;
  203019. },
  203020. va: function(b2, c15) {
  203021. a4.a.Tb(b2);
  203022. if (c15)
  203023. for (var d2 = 0, e3 = c15.length; d2 < e3; d2++)
  203024. b2.appendChild(c15[d2]);
  203025. },
  203026. Xc: function(b2, c15) {
  203027. var d2 = b2.nodeType ? [b2] : b2;
  203028. if (0 < d2.length) {
  203029. for (var e3 = d2[0], l3 = e3.parentNode, k2 = 0, f3 = c15.length; k2 < f3; k2++)
  203030. l3.insertBefore(c15[k2], e3);
  203031. k2 = 0;
  203032. for (f3 = d2.length; k2 < f3; k2++)
  203033. a4.removeNode(d2[k2]);
  203034. }
  203035. },
  203036. Ua: function(a5, b2) {
  203037. if (a5.length) {
  203038. for (b2 = 8 === b2.nodeType && b2.parentNode || b2; a5.length && a5[0].parentNode !== b2; )
  203039. a5.splice(0, 1);
  203040. for (; 1 < a5.length && a5[a5.length - 1].parentNode !== b2; )
  203041. a5.length--;
  203042. if (1 < a5.length) {
  203043. var c15 = a5[0], d2 = a5[a5.length - 1];
  203044. for (a5.length = 0; c15 !== d2; )
  203045. a5.push(c15), c15 = c15.nextSibling;
  203046. a5.push(d2);
  203047. }
  203048. }
  203049. return a5;
  203050. },
  203051. Zc: function(a5, b2) {
  203052. 7 > p2 ? a5.setAttribute("selected", b2) : a5.selected = b2;
  203053. },
  203054. Db: function(a5) {
  203055. return null === a5 || a5 === n2 ? "" : a5.trim ? a5.trim() : a5.toString().replace(/^[\s\xa0]+|[\s\xa0]+$/g, "");
  203056. },
  203057. Ud: function(a5, b2) {
  203058. a5 = a5 || "";
  203059. return b2.length > a5.length ? false : a5.substring(0, b2.length) === b2;
  203060. },
  203061. vd: function(a5, b2) {
  203062. if (a5 === b2)
  203063. return true;
  203064. if (11 === a5.nodeType)
  203065. return false;
  203066. if (b2.contains)
  203067. return b2.contains(1 !== a5.nodeType ? a5.parentNode : a5);
  203068. if (b2.compareDocumentPosition)
  203069. return 16 == (b2.compareDocumentPosition(a5) & 16);
  203070. for (; a5 && a5 != b2; )
  203071. a5 = a5.parentNode;
  203072. return !!a5;
  203073. },
  203074. Sb: function(b2) {
  203075. return a4.a.vd(b2, b2.ownerDocument.documentElement);
  203076. },
  203077. kd: function(b2) {
  203078. return !!a4.a.Lb(b2, a4.a.Sb);
  203079. },
  203080. R: function(a5) {
  203081. return a5 && a5.tagName && a5.tagName.toLowerCase();
  203082. },
  203083. Ac: function(b2) {
  203084. return a4.onError ? function() {
  203085. try {
  203086. return b2.apply(this, arguments);
  203087. } catch (c15) {
  203088. throw a4.onError && a4.onError(c15), c15;
  203089. }
  203090. } : b2;
  203091. },
  203092. setTimeout: function(b2, c15) {
  203093. return setTimeout(a4.a.Ac(b2), c15);
  203094. },
  203095. Gc: function(b2) {
  203096. setTimeout(function() {
  203097. a4.onError && a4.onError(b2);
  203098. throw b2;
  203099. }, 0);
  203100. },
  203101. B: function(b2, c15, d2) {
  203102. var e3 = a4.a.Ac(d2);
  203103. d2 = l2[c15];
  203104. if (a4.options.useOnlyNativeEvents || d2 || !v7)
  203105. if (d2 || "function" != typeof b2.addEventListener)
  203106. if ("undefined" != typeof b2.attachEvent) {
  203107. var k2 = function(a5) {
  203108. e3.call(b2, a5);
  203109. }, f3 = "on" + c15;
  203110. b2.attachEvent(
  203111. f3,
  203112. k2
  203113. );
  203114. a4.a.K.za(b2, function() {
  203115. b2.detachEvent(f3, k2);
  203116. });
  203117. } else
  203118. throw Error("Browser doesn't support addEventListener or attachEvent");
  203119. else
  203120. b2.addEventListener(c15, e3, false);
  203121. else
  203122. t || (t = "function" == typeof v7(b2).on ? "on" : "bind"), v7(b2)[t](c15, e3);
  203123. },
  203124. Fb: function(b2, c15) {
  203125. if (!b2 || !b2.nodeType)
  203126. throw Error("element must be a DOM node when calling triggerEvent");
  203127. var d2;
  203128. "input" === a4.a.R(b2) && b2.type && "click" == c15.toLowerCase() ? (d2 = b2.type, d2 = "checkbox" == d2 || "radio" == d2) : d2 = false;
  203129. if (a4.options.useOnlyNativeEvents || !v7 || d2)
  203130. if ("function" == typeof w.createEvent)
  203131. if ("function" == typeof b2.dispatchEvent)
  203132. d2 = w.createEvent(k[c15] || "HTMLEvents"), d2.initEvent(c15, true, true, A, 0, 0, 0, 0, 0, false, false, false, false, 0, b2), b2.dispatchEvent(d2);
  203133. else
  203134. throw Error("The supplied element doesn't support dispatchEvent");
  203135. else if (d2 && b2.click)
  203136. b2.click();
  203137. else if ("undefined" != typeof b2.fireEvent)
  203138. b2.fireEvent("on" + c15);
  203139. else
  203140. throw Error("Browser doesn't support triggering events");
  203141. else
  203142. v7(b2).trigger(c15);
  203143. },
  203144. f: function(b2) {
  203145. return a4.O(b2) ? b2() : b2;
  203146. },
  203147. bc: function(b2) {
  203148. return a4.O(b2) ? b2.v() : b2;
  203149. },
  203150. Eb: function(b2, c15, d2) {
  203151. var l3;
  203152. c15 && ("object" === typeof b2.classList ? (l3 = b2.classList[d2 ? "add" : "remove"], a4.a.D(c15.match(q), function(a5) {
  203153. l3.call(b2.classList, a5);
  203154. })) : "string" === typeof b2.className.baseVal ? e2(b2.className, "baseVal", c15, d2) : e2(b2, "className", c15, d2));
  203155. },
  203156. Bb: function(b2, c15) {
  203157. var d2 = a4.a.f(c15);
  203158. if (null === d2 || d2 === n2)
  203159. d2 = "";
  203160. var e3 = a4.h.firstChild(b2);
  203161. !e3 || 3 != e3.nodeType || a4.h.nextSibling(e3) ? a4.h.va(b2, [b2.ownerDocument.createTextNode(d2)]) : e3.data = d2;
  203162. a4.a.Ad(b2);
  203163. },
  203164. Yc: function(a5, b2) {
  203165. a5.name = b2;
  203166. if (7 >= p2)
  203167. try {
  203168. var c15 = a5.name.replace(/[&<>'"]/g, function(a6) {
  203169. return "&#" + a6.charCodeAt(0) + ";";
  203170. });
  203171. a5.mergeAttributes(w.createElement("<input name='" + c15 + "'/>"), false);
  203172. } catch (d2) {
  203173. }
  203174. },
  203175. Ad: function(a5) {
  203176. 9 <= p2 && (a5 = 1 == a5.nodeType ? a5 : a5.parentNode, a5.style && (a5.style.zoom = a5.style.zoom));
  203177. },
  203178. wd: function(a5) {
  203179. if (p2) {
  203180. var b2 = a5.style.width;
  203181. a5.style.width = 0;
  203182. a5.style.width = b2;
  203183. }
  203184. },
  203185. Pd: function(b2, c15) {
  203186. b2 = a4.a.f(b2);
  203187. c15 = a4.a.f(c15);
  203188. for (var d2 = [], e3 = b2; e3 <= c15; e3++)
  203189. d2.push(e3);
  203190. return d2;
  203191. },
  203192. la: function(a5) {
  203193. for (var b2 = [], c15 = 0, d2 = a5.length; c15 < d2; c15++)
  203194. b2.push(a5[c15]);
  203195. return b2;
  203196. },
  203197. Da: function(a5) {
  203198. return h ? Symbol(a5) : a5;
  203199. },
  203200. Zd: 6 === p2,
  203201. $d: 7 === p2,
  203202. W: p2,
  203203. Lc: function(b2, c15) {
  203204. for (var d2 = a4.a.la(b2.getElementsByTagName("input")).concat(a4.a.la(b2.getElementsByTagName("textarea"))), e3 = "string" == typeof c15 ? function(a5) {
  203205. return a5.name === c15;
  203206. } : function(a5) {
  203207. return c15.test(a5.name);
  203208. }, l3 = [], k2 = d2.length - 1; 0 <= k2; k2--)
  203209. e3(d2[k2]) && l3.push(d2[k2]);
  203210. return l3;
  203211. },
  203212. Nd: function(b2) {
  203213. return "string" == typeof b2 && (b2 = a4.a.Db(b2)) ? H && H.parse ? H.parse(b2) : new Function("return " + b2)() : null;
  203214. },
  203215. hc: function(b2, c15, d2) {
  203216. if (!H || !H.stringify)
  203217. throw Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js");
  203218. return H.stringify(a4.a.f(b2), c15, d2);
  203219. },
  203220. Od: function(c15, d2, e3) {
  203221. e3 = e3 || {};
  203222. var l3 = e3.params || {}, k2 = e3.includeFields || this.Jc, f3 = c15;
  203223. if ("object" == typeof c15 && "form" === a4.a.R(c15))
  203224. for (var f3 = c15.action, h2 = k2.length - 1; 0 <= h2; h2--)
  203225. for (var g2 = a4.a.Lc(c15, k2[h2]), m2 = g2.length - 1; 0 <= m2; m2--)
  203226. l3[g2[m2].name] = g2[m2].value;
  203227. d2 = a4.a.f(d2);
  203228. var p3 = w.createElement("form");
  203229. p3.style.display = "none";
  203230. p3.action = f3;
  203231. p3.method = "post";
  203232. for (var q3 in d2)
  203233. c15 = w.createElement("input"), c15.type = "hidden", c15.name = q3, c15.value = a4.a.hc(a4.a.f(d2[q3])), p3.appendChild(c15);
  203234. b(l3, function(a5, b2) {
  203235. var c16 = w.createElement("input");
  203236. c16.type = "hidden";
  203237. c16.name = a5;
  203238. c16.value = b2;
  203239. p3.appendChild(c16);
  203240. });
  203241. w.body.appendChild(p3);
  203242. e3.submitter ? e3.submitter(p3) : p3.submit();
  203243. setTimeout(function() {
  203244. p3.parentNode.removeChild(p3);
  203245. }, 0);
  203246. }
  203247. };
  203248. }();
  203249. a4.b("utils", a4.a);
  203250. a4.b("utils.arrayForEach", a4.a.D);
  203251. a4.b("utils.arrayFirst", a4.a.Lb);
  203252. a4.b("utils.arrayFilter", a4.a.jb);
  203253. a4.b("utils.arrayGetDistinctValues", a4.a.wc);
  203254. a4.b("utils.arrayIndexOf", a4.a.A);
  203255. a4.b("utils.arrayMap", a4.a.Mb);
  203256. a4.b("utils.arrayPushAll", a4.a.Nb);
  203257. a4.b("utils.arrayRemoveItem", a4.a.Pa);
  203258. a4.b("utils.cloneNodes", a4.a.Ca);
  203259. a4.b(
  203260. "utils.createSymbolOrString",
  203261. a4.a.Da
  203262. );
  203263. a4.b("utils.extend", a4.a.extend);
  203264. a4.b("utils.fieldsIncludedWithJsonPost", a4.a.Jc);
  203265. a4.b("utils.getFormFields", a4.a.Lc);
  203266. a4.b("utils.objectMap", a4.a.Ga);
  203267. a4.b("utils.peekObservable", a4.a.bc);
  203268. a4.b("utils.postJson", a4.a.Od);
  203269. a4.b("utils.parseJson", a4.a.Nd);
  203270. a4.b("utils.registerEventHandler", a4.a.B);
  203271. a4.b("utils.stringifyJson", a4.a.hc);
  203272. a4.b("utils.range", a4.a.Pd);
  203273. a4.b("utils.toggleDomNodeCssClass", a4.a.Eb);
  203274. a4.b("utils.triggerEvent", a4.a.Fb);
  203275. a4.b("utils.unwrapObservable", a4.a.f);
  203276. a4.b("utils.objectForEach", a4.a.P);
  203277. a4.b(
  203278. "utils.addOrRemoveItem",
  203279. a4.a.Na
  203280. );
  203281. a4.b("utils.setTextContent", a4.a.Bb);
  203282. a4.b("unwrap", a4.a.f);
  203283. Function.prototype.bind || (Function.prototype.bind = function(a5) {
  203284. var c14 = this;
  203285. if (1 === arguments.length)
  203286. return function() {
  203287. return c14.apply(a5, arguments);
  203288. };
  203289. var d = Array.prototype.slice.call(arguments, 1);
  203290. return function() {
  203291. var e2 = d.slice(0);
  203292. e2.push.apply(e2, arguments);
  203293. return c14.apply(a5, e2);
  203294. };
  203295. });
  203296. a4.a.g = new function() {
  203297. var b = 0, c14 = "__ko__" + new Date().getTime(), d = {}, e2, f2;
  203298. a4.a.W ? (e2 = function(a5, e3) {
  203299. var f3 = a5[c14];
  203300. if (!f3 || "null" === f3 || !d[f3]) {
  203301. if (!e3)
  203302. return n2;
  203303. f3 = a5[c14] = "ko" + b++;
  203304. d[f3] = {};
  203305. }
  203306. return d[f3];
  203307. }, f2 = function(a5) {
  203308. var b2 = a5[c14];
  203309. return b2 ? (delete d[b2], a5[c14] = null, true) : false;
  203310. }) : (e2 = function(a5, b2) {
  203311. var d2 = a5[c14];
  203312. !d2 && b2 && (d2 = a5[c14] = {});
  203313. return d2;
  203314. }, f2 = function(a5) {
  203315. return a5[c14] ? (delete a5[c14], true) : false;
  203316. });
  203317. return { get: function(a5, b2) {
  203318. var c15 = e2(a5, false);
  203319. return c15 && c15[b2];
  203320. }, set: function(a5, b2, c15) {
  203321. (a5 = e2(a5, c15 !== n2)) && (a5[b2] = c15);
  203322. }, Ub: function(a5, b2, c15) {
  203323. a5 = e2(a5, true);
  203324. return a5[b2] || (a5[b2] = c15);
  203325. }, clear: f2, Z: function() {
  203326. return b++ + c14;
  203327. } };
  203328. }();
  203329. a4.b("utils.domData", a4.a.g);
  203330. a4.b("utils.domData.clear", a4.a.g.clear);
  203331. a4.a.K = new function() {
  203332. function b(b2, c15) {
  203333. var d2 = a4.a.g.get(b2, e2);
  203334. d2 === n2 && c15 && (d2 = [], a4.a.g.set(b2, e2, d2));
  203335. return d2;
  203336. }
  203337. function c14(c15) {
  203338. var e3 = b(c15, false);
  203339. if (e3)
  203340. for (var e3 = e3.slice(0), k = 0; k < e3.length; k++)
  203341. e3[k](c15);
  203342. a4.a.g.clear(c15);
  203343. a4.a.K.cleanExternalData(c15);
  203344. g[c15.nodeType] && d(c15.childNodes, true);
  203345. }
  203346. function d(b2, d2) {
  203347. for (var e3 = [], l2, f3 = 0; f3 < b2.length; f3++)
  203348. if (!d2 || 8 === b2[f3].nodeType) {
  203349. if (c14(e3[e3.length] = l2 = b2[f3]), b2[f3] !== l2)
  203350. for (; f3-- && -1 == a4.a.A(e3, b2[f3]); )
  203351. ;
  203352. }
  203353. }
  203354. var e2 = a4.a.g.Z(), f2 = { 1: true, 8: true, 9: true }, g = { 1: true, 9: true };
  203355. return { za: function(a5, c15) {
  203356. if ("function" != typeof c15)
  203357. throw Error("Callback must be a function");
  203358. b(a5, true).push(c15);
  203359. }, yb: function(c15, d2) {
  203360. var f3 = b(c15, false);
  203361. f3 && (a4.a.Pa(f3, d2), 0 == f3.length && a4.a.g.set(c15, e2, n2));
  203362. }, oa: function(b2) {
  203363. a4.u.G(function() {
  203364. f2[b2.nodeType] && (c14(b2), g[b2.nodeType] && d(b2.getElementsByTagName("*")));
  203365. });
  203366. return b2;
  203367. }, removeNode: function(b2) {
  203368. a4.oa(b2);
  203369. b2.parentNode && b2.parentNode.removeChild(b2);
  203370. }, cleanExternalData: function(a5) {
  203371. v7 && "function" == typeof v7.cleanData && v7.cleanData([a5]);
  203372. } };
  203373. }();
  203374. a4.oa = a4.a.K.oa;
  203375. a4.removeNode = a4.a.K.removeNode;
  203376. a4.b("cleanNode", a4.oa);
  203377. a4.b("removeNode", a4.removeNode);
  203378. a4.b("utils.domNodeDisposal", a4.a.K);
  203379. a4.b(
  203380. "utils.domNodeDisposal.addDisposeCallback",
  203381. a4.a.K.za
  203382. );
  203383. a4.b("utils.domNodeDisposal.removeDisposeCallback", a4.a.K.yb);
  203384. (function() {
  203385. var b = [0, "", ""], c14 = [1, "<table>", "</table>"], d = [3, "<table><tbody><tr>", "</tr></tbody></table>"], e2 = [1, "<select multiple='multiple'>", "</select>"], f2 = { thead: c14, tbody: c14, tfoot: c14, tr: [2, "<table><tbody>", "</tbody></table>"], td: d, th: d, option: e2, optgroup: e2 }, g = 8 >= a4.a.W;
  203386. a4.a.ua = function(c15, d2) {
  203387. var e3;
  203388. if (v7)
  203389. if (v7.parseHTML)
  203390. e3 = v7.parseHTML(c15, d2) || [];
  203391. else {
  203392. if ((e3 = v7.clean([c15], d2)) && e3[0]) {
  203393. for (var l2 = e3[0]; l2.parentNode && 11 !== l2.parentNode.nodeType; )
  203394. l2 = l2.parentNode;
  203395. l2.parentNode && l2.parentNode.removeChild(l2);
  203396. }
  203397. }
  203398. else {
  203399. (e3 = d2) || (e3 = w);
  203400. var l2 = e3.parentWindow || e3.defaultView || A, p2 = a4.a.Db(c15).toLowerCase(), q = e3.createElement("div"), t;
  203401. t = (p2 = p2.match(/^(?:\x3c!--.*?--\x3e\s*?)*?<([a-z]+)[\s>]/)) && f2[p2[1]] || b;
  203402. p2 = t[0];
  203403. t = "ignored<div>" + t[1] + c15 + t[2] + "</div>";
  203404. "function" == typeof l2.innerShiv ? q.appendChild(l2.innerShiv(t)) : (g && e3.body.appendChild(q), q.innerHTML = t, g && q.parentNode.removeChild(q));
  203405. for (; p2--; )
  203406. q = q.lastChild;
  203407. e3 = a4.a.la(q.lastChild.childNodes);
  203408. }
  203409. return e3;
  203410. };
  203411. a4.a.Md = function(b2, c15) {
  203412. var d2 = a4.a.ua(
  203413. b2,
  203414. c15
  203415. );
  203416. return d2.length && d2[0].parentElement || a4.a.Yb(d2);
  203417. };
  203418. a4.a.fc = function(b2, c15) {
  203419. a4.a.Tb(b2);
  203420. c15 = a4.a.f(c15);
  203421. if (null !== c15 && c15 !== n2)
  203422. if ("string" != typeof c15 && (c15 = c15.toString()), v7)
  203423. v7(b2).html(c15);
  203424. else
  203425. for (var d2 = a4.a.ua(c15, b2.ownerDocument), e3 = 0; e3 < d2.length; e3++)
  203426. b2.appendChild(d2[e3]);
  203427. };
  203428. })();
  203429. a4.b("utils.parseHtmlFragment", a4.a.ua);
  203430. a4.b("utils.setHtml", a4.a.fc);
  203431. a4.aa = function() {
  203432. function b(c15, e2) {
  203433. if (c15) {
  203434. if (8 == c15.nodeType) {
  203435. var f2 = a4.aa.Uc(c15.nodeValue);
  203436. null != f2 && e2.push({ ud: c15, Kd: f2 });
  203437. } else if (1 == c15.nodeType)
  203438. for (var f2 = 0, g = c15.childNodes, h = g.length; f2 < h; f2++)
  203439. b(
  203440. g[f2],
  203441. e2
  203442. );
  203443. }
  203444. }
  203445. var c14 = {};
  203446. return { Xb: function(a5) {
  203447. if ("function" != typeof a5)
  203448. throw Error("You can only pass a function to ko.memoization.memoize()");
  203449. var b2 = (4294967296 * (1 + Math.random()) | 0).toString(16).substring(1) + (4294967296 * (1 + Math.random()) | 0).toString(16).substring(1);
  203450. c14[b2] = a5;
  203451. return "<!--[ko_memo:" + b2 + "]-->";
  203452. }, bd: function(a5, b2) {
  203453. var f2 = c14[a5];
  203454. if (f2 === n2)
  203455. throw Error("Couldn't find any memo with ID " + a5 + ". Perhaps it's already been unmemoized.");
  203456. try {
  203457. return f2.apply(null, b2 || []), true;
  203458. } finally {
  203459. delete c14[a5];
  203460. }
  203461. }, cd: function(c15, e2) {
  203462. var f2 = [];
  203463. b(c15, f2);
  203464. for (var g = 0, h = f2.length; g < h; g++) {
  203465. var m = f2[g].ud, k = [m];
  203466. e2 && a4.a.Nb(k, e2);
  203467. a4.aa.bd(f2[g].Kd, k);
  203468. m.nodeValue = "";
  203469. m.parentNode && m.parentNode.removeChild(m);
  203470. }
  203471. }, Uc: function(a5) {
  203472. return (a5 = a5.match(/^\[ko_memo\:(.*?)\]$/)) ? a5[1] : null;
  203473. } };
  203474. }();
  203475. a4.b("memoization", a4.aa);
  203476. a4.b("memoization.memoize", a4.aa.Xb);
  203477. a4.b("memoization.unmemoize", a4.aa.bd);
  203478. a4.b("memoization.parseMemoText", a4.aa.Uc);
  203479. a4.b("memoization.unmemoizeDomNodeAndDescendants", a4.aa.cd);
  203480. a4.na = function() {
  203481. function b() {
  203482. if (f2) {
  203483. for (var b2 = f2, c15 = 0, d2; h < f2; )
  203484. if (d2 = e2[h++]) {
  203485. if (h > b2) {
  203486. if (5e3 <= ++c15) {
  203487. h = f2;
  203488. a4.a.Gc(Error("'Too much recursion' after processing " + c15 + " task groups."));
  203489. break;
  203490. }
  203491. b2 = f2;
  203492. }
  203493. try {
  203494. d2();
  203495. } catch (p2) {
  203496. a4.a.Gc(p2);
  203497. }
  203498. }
  203499. }
  203500. }
  203501. function c14() {
  203502. b();
  203503. h = f2 = e2.length = 0;
  203504. }
  203505. var d, e2 = [], f2 = 0, g = 1, h = 0;
  203506. A.MutationObserver ? d = function(a5) {
  203507. var b2 = w.createElement("div");
  203508. new MutationObserver(a5).observe(b2, { attributes: true });
  203509. return function() {
  203510. b2.classList.toggle("foo");
  203511. };
  203512. }(c14) : d = w && "onreadystatechange" in w.createElement("script") ? function(a5) {
  203513. var b2 = w.createElement("script");
  203514. b2.onreadystatechange = function() {
  203515. b2.onreadystatechange = null;
  203516. w.documentElement.removeChild(b2);
  203517. b2 = null;
  203518. a5();
  203519. };
  203520. w.documentElement.appendChild(b2);
  203521. } : function(a5) {
  203522. setTimeout(a5, 0);
  203523. };
  203524. return { scheduler: d, zb: function(b2) {
  203525. f2 || a4.na.scheduler(c14);
  203526. e2[f2++] = b2;
  203527. return g++;
  203528. }, cancel: function(a5) {
  203529. a5 = a5 - (g - f2);
  203530. a5 >= h && a5 < f2 && (e2[a5] = null);
  203531. }, resetForTesting: function() {
  203532. var a5 = f2 - h;
  203533. h = f2 = e2.length = 0;
  203534. return a5;
  203535. }, Sd: b };
  203536. }();
  203537. a4.b("tasks", a4.na);
  203538. a4.b("tasks.schedule", a4.na.zb);
  203539. a4.b("tasks.runEarly", a4.na.Sd);
  203540. a4.Ta = { throttle: function(b, c14) {
  203541. b.throttleEvaluation = c14;
  203542. var d = null;
  203543. return a4.$({ read: b, write: function(e2) {
  203544. clearTimeout(d);
  203545. d = a4.a.setTimeout(
  203546. function() {
  203547. b(e2);
  203548. },
  203549. c14
  203550. );
  203551. } });
  203552. }, rateLimit: function(a5, c14) {
  203553. var d, e2, f2;
  203554. "number" == typeof c14 ? d = c14 : (d = c14.timeout, e2 = c14.method);
  203555. a5.Hb = false;
  203556. f2 = "function" == typeof e2 ? e2 : "notifyWhenChangesStop" == e2 ? Y : X;
  203557. a5.ub(function(a6) {
  203558. return f2(a6, d, c14);
  203559. });
  203560. }, deferred: function(b, c14) {
  203561. if (true !== c14)
  203562. throw Error("The 'deferred' extender only accepts the value 'true', because it is not supported to turn deferral off once enabled.");
  203563. b.Hb || (b.Hb = true, b.ub(function(c15) {
  203564. var e2, f2 = false;
  203565. return function() {
  203566. if (!f2) {
  203567. a4.na.cancel(e2);
  203568. e2 = a4.na.zb(c15);
  203569. try {
  203570. f2 = true, b.notifySubscribers(n2, "dirty");
  203571. } finally {
  203572. f2 = false;
  203573. }
  203574. }
  203575. };
  203576. }));
  203577. }, notify: function(a5, c14) {
  203578. a5.equalityComparer = "always" == c14 ? null : K;
  203579. } };
  203580. var W = { undefined: 1, "boolean": 1, number: 1, string: 1 };
  203581. a4.b("extenders", a4.Ta);
  203582. a4.ic = function(b, c14, d) {
  203583. this.da = b;
  203584. this.lc = c14;
  203585. this.mc = d;
  203586. this.Ib = false;
  203587. this.fb = this.Jb = null;
  203588. a4.L(this, "dispose", this.s);
  203589. a4.L(this, "disposeWhenNodeIsRemoved", this.l);
  203590. };
  203591. a4.ic.prototype.s = function() {
  203592. this.Ib || (this.fb && a4.a.K.yb(this.Jb, this.fb), this.Ib = true, this.mc(), this.da = this.lc = this.mc = this.Jb = this.fb = null);
  203593. };
  203594. a4.ic.prototype.l = function(b) {
  203595. this.Jb = b;
  203596. a4.a.K.za(b, this.fb = this.s.bind(this));
  203597. };
  203598. a4.T = function() {
  203599. a4.a.Ab(this, D);
  203600. D.qb(this);
  203601. };
  203602. var D = {
  203603. qb: function(a5) {
  203604. a5.U = { change: [] };
  203605. a5.sc = 1;
  203606. },
  203607. subscribe: function(b, c14, d) {
  203608. var e2 = this;
  203609. d = d || "change";
  203610. var f2 = new a4.ic(e2, c14 ? b.bind(c14) : b, function() {
  203611. a4.a.Pa(e2.U[d], f2);
  203612. e2.hb && e2.hb(d);
  203613. });
  203614. e2.Qa && e2.Qa(d);
  203615. e2.U[d] || (e2.U[d] = []);
  203616. e2.U[d].push(f2);
  203617. return f2;
  203618. },
  203619. notifySubscribers: function(b, c14) {
  203620. c14 = c14 || "change";
  203621. "change" === c14 && this.Gb();
  203622. if (this.Wa(c14)) {
  203623. var d = "change" === c14 && this.ed || this.U[c14].slice(0);
  203624. try {
  203625. a4.u.xc();
  203626. for (var e2 = 0, f2; f2 = d[e2]; ++e2)
  203627. f2.Ib || f2.lc(b);
  203628. } finally {
  203629. a4.u.end();
  203630. }
  203631. }
  203632. },
  203633. ob: function() {
  203634. return this.sc;
  203635. },
  203636. Dd: function(a5) {
  203637. return this.ob() !== a5;
  203638. },
  203639. Gb: function() {
  203640. ++this.sc;
  203641. },
  203642. ub: function(b) {
  203643. var c14 = this, d = a4.O(c14), e2, f2, g, h, m;
  203644. c14.gb || (c14.gb = c14.notifySubscribers, c14.notifySubscribers = Z);
  203645. var k = b(function() {
  203646. c14.Ja = false;
  203647. d && h === c14 && (h = c14.nc ? c14.nc() : c14());
  203648. var a5 = f2 || m && c14.sb(g, h);
  203649. m = f2 = e2 = false;
  203650. a5 && c14.gb(g = h);
  203651. });
  203652. c14.qc = function(a5, b2) {
  203653. b2 && c14.Ja || (m = !b2);
  203654. c14.ed = c14.U.change.slice(0);
  203655. c14.Ja = e2 = true;
  203656. h = a5;
  203657. k();
  203658. };
  203659. c14.pc = function(a5) {
  203660. e2 || (g = a5, c14.gb(a5, "beforeChange"));
  203661. };
  203662. c14.rc = function() {
  203663. m = true;
  203664. };
  203665. c14.gd = function() {
  203666. c14.sb(g, c14.v(true)) && (f2 = true);
  203667. };
  203668. },
  203669. Wa: function(a5) {
  203670. return this.U[a5] && this.U[a5].length;
  203671. },
  203672. Bd: function(b) {
  203673. if (b)
  203674. return this.U[b] && this.U[b].length || 0;
  203675. var c14 = 0;
  203676. a4.a.P(this.U, function(a5, b2) {
  203677. "dirty" !== a5 && (c14 += b2.length);
  203678. });
  203679. return c14;
  203680. },
  203681. sb: function(a5, c14) {
  203682. return !this.equalityComparer || !this.equalityComparer(a5, c14);
  203683. },
  203684. toString: function() {
  203685. return "[object Object]";
  203686. },
  203687. extend: function(b) {
  203688. var c14 = this;
  203689. b && a4.a.P(b, function(b2, e2) {
  203690. var f2 = a4.Ta[b2];
  203691. "function" == typeof f2 && (c14 = f2(c14, e2) || c14);
  203692. });
  203693. return c14;
  203694. }
  203695. };
  203696. a4.L(D, "init", D.qb);
  203697. a4.L(D, "subscribe", D.subscribe);
  203698. a4.L(D, "extend", D.extend);
  203699. a4.L(D, "getSubscriptionsCount", D.Bd);
  203700. a4.a.Ba && a4.a.setPrototypeOf(
  203701. D,
  203702. Function.prototype
  203703. );
  203704. a4.T.fn = D;
  203705. a4.Qc = function(a5) {
  203706. return null != a5 && "function" == typeof a5.subscribe && "function" == typeof a5.notifySubscribers;
  203707. };
  203708. a4.b("subscribable", a4.T);
  203709. a4.b("isSubscribable", a4.Qc);
  203710. a4.S = a4.u = function() {
  203711. function b(a5) {
  203712. d.push(e2);
  203713. e2 = a5;
  203714. }
  203715. function c14() {
  203716. e2 = d.pop();
  203717. }
  203718. var d = [], e2, f2 = 0;
  203719. return {
  203720. xc: b,
  203721. end: c14,
  203722. cc: function(b2) {
  203723. if (e2) {
  203724. if (!a4.Qc(b2))
  203725. throw Error("Only subscribable things can act as dependencies");
  203726. e2.od.call(e2.pd, b2, b2.fd || (b2.fd = ++f2));
  203727. }
  203728. },
  203729. G: function(a5, d2, e3) {
  203730. try {
  203731. return b(), a5.apply(d2, e3 || []);
  203732. } finally {
  203733. c14();
  203734. }
  203735. },
  203736. qa: function() {
  203737. if (e2)
  203738. return e2.o.qa();
  203739. },
  203740. Va: function() {
  203741. if (e2)
  203742. return e2.o.Va();
  203743. },
  203744. Ya: function() {
  203745. if (e2)
  203746. return e2.Ya;
  203747. },
  203748. o: function() {
  203749. if (e2)
  203750. return e2.o;
  203751. }
  203752. };
  203753. }();
  203754. a4.b("computedContext", a4.S);
  203755. a4.b("computedContext.getDependenciesCount", a4.S.qa);
  203756. a4.b("computedContext.getDependencies", a4.S.Va);
  203757. a4.b("computedContext.isInitial", a4.S.Ya);
  203758. a4.b("computedContext.registerDependency", a4.S.cc);
  203759. a4.b("ignoreDependencies", a4.Yd = a4.u.G);
  203760. var I = a4.a.Da("_latestValue");
  203761. a4.ta = function(b) {
  203762. function c14() {
  203763. if (0 < arguments.length)
  203764. return c14.sb(c14[I], arguments[0]) && (c14.ya(), c14[I] = arguments[0], c14.xa()), this;
  203765. a4.u.cc(c14);
  203766. return c14[I];
  203767. }
  203768. c14[I] = b;
  203769. a4.a.Ba || a4.a.extend(c14, a4.T.fn);
  203770. a4.T.fn.qb(c14);
  203771. a4.a.Ab(c14, F);
  203772. a4.options.deferUpdates && a4.Ta.deferred(c14, true);
  203773. return c14;
  203774. };
  203775. var F = { equalityComparer: K, v: function() {
  203776. return this[I];
  203777. }, xa: function() {
  203778. this.notifySubscribers(this[I], "spectate");
  203779. this.notifySubscribers(this[I]);
  203780. }, ya: function() {
  203781. this.notifySubscribers(this[I], "beforeChange");
  203782. } };
  203783. a4.a.Ba && a4.a.setPrototypeOf(F, a4.T.fn);
  203784. var G = a4.ta.Ma = "__ko_proto__";
  203785. F[G] = a4.ta;
  203786. a4.O = function(b) {
  203787. if ((b = "function" == typeof b && b[G]) && b !== F[G] && b !== a4.o.fn[G])
  203788. throw Error("Invalid object that looks like an observable; possibly from another Knockout instance");
  203789. return !!b;
  203790. };
  203791. a4.Za = function(b) {
  203792. return "function" == typeof b && (b[G] === F[G] || b[G] === a4.o.fn[G] && b.Nc);
  203793. };
  203794. a4.b("observable", a4.ta);
  203795. a4.b("isObservable", a4.O);
  203796. a4.b("isWriteableObservable", a4.Za);
  203797. a4.b("isWritableObservable", a4.Za);
  203798. a4.b("observable.fn", F);
  203799. a4.L(F, "peek", F.v);
  203800. a4.L(F, "valueHasMutated", F.xa);
  203801. a4.L(F, "valueWillMutate", F.ya);
  203802. a4.Ha = function(b) {
  203803. b = b || [];
  203804. if ("object" != typeof b || !("length" in b))
  203805. throw Error("The argument passed when initializing an observable array must be an array, or null, or undefined.");
  203806. b = a4.ta(b);
  203807. a4.a.Ab(
  203808. b,
  203809. a4.Ha.fn
  203810. );
  203811. return b.extend({ trackArrayChanges: true });
  203812. };
  203813. a4.Ha.fn = { remove: function(b) {
  203814. for (var c14 = this.v(), d = [], e2 = "function" != typeof b || a4.O(b) ? function(a5) {
  203815. return a5 === b;
  203816. } : b, f2 = 0; f2 < c14.length; f2++) {
  203817. var g = c14[f2];
  203818. if (e2(g)) {
  203819. 0 === d.length && this.ya();
  203820. if (c14[f2] !== g)
  203821. throw Error("Array modified during remove; cannot remove item");
  203822. d.push(g);
  203823. c14.splice(f2, 1);
  203824. f2--;
  203825. }
  203826. }
  203827. d.length && this.xa();
  203828. return d;
  203829. }, removeAll: function(b) {
  203830. if (b === n2) {
  203831. var c14 = this.v(), d = c14.slice(0);
  203832. this.ya();
  203833. c14.splice(0, c14.length);
  203834. this.xa();
  203835. return d;
  203836. }
  203837. return b ? this.remove(function(c15) {
  203838. return 0 <= a4.a.A(b, c15);
  203839. }) : [];
  203840. }, destroy: function(b) {
  203841. var c14 = this.v(), d = "function" != typeof b || a4.O(b) ? function(a5) {
  203842. return a5 === b;
  203843. } : b;
  203844. this.ya();
  203845. for (var e2 = c14.length - 1; 0 <= e2; e2--) {
  203846. var f2 = c14[e2];
  203847. d(f2) && (f2._destroy = true);
  203848. }
  203849. this.xa();
  203850. }, destroyAll: function(b) {
  203851. return b === n2 ? this.destroy(function() {
  203852. return true;
  203853. }) : b ? this.destroy(function(c14) {
  203854. return 0 <= a4.a.A(b, c14);
  203855. }) : [];
  203856. }, indexOf: function(b) {
  203857. var c14 = this();
  203858. return a4.a.A(c14, b);
  203859. }, replace: function(a5, c14) {
  203860. var d = this.indexOf(a5);
  203861. 0 <= d && (this.ya(), this.v()[d] = c14, this.xa());
  203862. }, sorted: function(a5) {
  203863. var c14 = this().slice(0);
  203864. return a5 ? c14.sort(a5) : c14.sort();
  203865. }, reversed: function() {
  203866. return this().slice(0).reverse();
  203867. } };
  203868. a4.a.Ba && a4.a.setPrototypeOf(a4.Ha.fn, a4.ta.fn);
  203869. a4.a.D("pop push reverse shift sort splice unshift".split(" "), function(b) {
  203870. a4.Ha.fn[b] = function() {
  203871. var a5 = this.v();
  203872. this.ya();
  203873. this.zc(a5, b, arguments);
  203874. var d = a5[b].apply(a5, arguments);
  203875. this.xa();
  203876. return d === a5 ? this : d;
  203877. };
  203878. });
  203879. a4.a.D(["slice"], function(b) {
  203880. a4.Ha.fn[b] = function() {
  203881. var a5 = this();
  203882. return a5[b].apply(a5, arguments);
  203883. };
  203884. });
  203885. a4.Pc = function(b) {
  203886. return a4.O(b) && "function" == typeof b.remove && "function" == typeof b.push;
  203887. };
  203888. a4.b("observableArray", a4.Ha);
  203889. a4.b("isObservableArray", a4.Pc);
  203890. a4.Ta.trackArrayChanges = function(b, c14) {
  203891. function d() {
  203892. function c15() {
  203893. if (m) {
  203894. var d2 = [].concat(b.v() || []), e3;
  203895. if (b.Wa("arrayChange")) {
  203896. if (!f2 || 1 < m)
  203897. f2 = a4.a.Pb(k, d2, b.Ob);
  203898. e3 = f2;
  203899. }
  203900. k = d2;
  203901. f2 = null;
  203902. m = 0;
  203903. e3 && e3.length && b.notifySubscribers(e3, "arrayChange");
  203904. }
  203905. }
  203906. e2 ? c15() : (e2 = true, h = b.subscribe(function() {
  203907. ++m;
  203908. }, null, "spectate"), k = [].concat(b.v() || []), f2 = null, g = b.subscribe(c15));
  203909. }
  203910. b.Ob = {};
  203911. c14 && "object" == typeof c14 && a4.a.extend(b.Ob, c14);
  203912. b.Ob.sparse = true;
  203913. if (!b.zc) {
  203914. var e2 = false, f2 = null, g, h, m = 0, k, l2 = b.Qa, p2 = b.hb;
  203915. b.Qa = function(a5) {
  203916. l2 && l2.call(b, a5);
  203917. "arrayChange" === a5 && d();
  203918. };
  203919. b.hb = function(a5) {
  203920. p2 && p2.call(b, a5);
  203921. "arrayChange" !== a5 || b.Wa("arrayChange") || (g && g.s(), h && h.s(), h = g = null, e2 = false, k = n2);
  203922. };
  203923. b.zc = function(b2, c15, d2) {
  203924. function l3(a5, b3, c16) {
  203925. return k2[k2.length] = { status: a5, value: b3, index: c16 };
  203926. }
  203927. if (e2 && !m) {
  203928. var k2 = [], p3 = b2.length, g2 = d2.length, h2 = 0;
  203929. switch (c15) {
  203930. case "push":
  203931. h2 = p3;
  203932. case "unshift":
  203933. for (c15 = 0; c15 < g2; c15++)
  203934. l3("added", d2[c15], h2 + c15);
  203935. break;
  203936. case "pop":
  203937. h2 = p3 - 1;
  203938. case "shift":
  203939. p3 && l3("deleted", b2[h2], h2);
  203940. break;
  203941. case "splice":
  203942. c15 = Math.min(Math.max(0, 0 > d2[0] ? p3 + d2[0] : d2[0]), p3);
  203943. for (var p3 = 1 === g2 ? p3 : Math.min(c15 + (d2[1] || 0), p3), g2 = c15 + g2 - 2, h2 = Math.max(p3, g2), U2 = [], L = [], n3 = 2; c15 < h2; ++c15, ++n3)
  203944. c15 < p3 && L.push(l3("deleted", b2[c15], c15)), c15 < g2 && U2.push(l3("added", d2[n3], c15));
  203945. a4.a.Kc(L, U2);
  203946. break;
  203947. default:
  203948. return;
  203949. }
  203950. f2 = k2;
  203951. }
  203952. };
  203953. }
  203954. };
  203955. var r2 = a4.a.Da("_state");
  203956. a4.o = a4.$ = function(b, c14, d) {
  203957. function e2() {
  203958. if (0 < arguments.length) {
  203959. if ("function" === typeof f2)
  203960. f2.apply(g.nb, arguments);
  203961. else
  203962. throw Error("Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");
  203963. return this;
  203964. }
  203965. g.ra || a4.u.cc(e2);
  203966. (g.ka || g.J && e2.Xa()) && e2.ha();
  203967. return g.X;
  203968. }
  203969. "object" === typeof b ? d = b : (d = d || {}, b && (d.read = b));
  203970. if ("function" != typeof d.read)
  203971. throw Error("Pass a function that returns the value of the ko.computed");
  203972. var f2 = d.write, g = { X: n2, sa: true, ka: true, rb: false, jc: false, ra: false, wb: false, J: false, Wc: d.read, nb: c14 || d.owner, l: d.disposeWhenNodeIsRemoved || d.l || null, Sa: d.disposeWhen || d.Sa, Rb: null, I: {}, V: 0, Ic: null };
  203973. e2[r2] = g;
  203974. e2.Nc = "function" === typeof f2;
  203975. a4.a.Ba || a4.a.extend(e2, a4.T.fn);
  203976. a4.T.fn.qb(e2);
  203977. a4.a.Ab(e2, C);
  203978. d.pure ? (g.wb = true, g.J = true, a4.a.extend(e2, da)) : d.deferEvaluation && a4.a.extend(e2, ea);
  203979. a4.options.deferUpdates && a4.Ta.deferred(e2, true);
  203980. g.l && (g.jc = true, g.l.nodeType || (g.l = null));
  203981. g.J || d.deferEvaluation || e2.ha();
  203982. g.l && e2.ja() && a4.a.K.za(g.l, g.Rb = function() {
  203983. e2.s();
  203984. });
  203985. return e2;
  203986. };
  203987. var C = {
  203988. equalityComparer: K,
  203989. qa: function() {
  203990. return this[r2].V;
  203991. },
  203992. Va: function() {
  203993. var b = [];
  203994. a4.a.P(this[r2].I, function(a5, d) {
  203995. b[d.Ka] = d.da;
  203996. });
  203997. return b;
  203998. },
  203999. Vb: function(b) {
  204000. if (!this[r2].V)
  204001. return false;
  204002. var c14 = this.Va();
  204003. return -1 !== a4.a.A(c14, b) ? true : !!a4.a.Lb(c14, function(a5) {
  204004. return a5.Vb && a5.Vb(b);
  204005. });
  204006. },
  204007. uc: function(a5, c14, d) {
  204008. if (this[r2].wb && c14 === this)
  204009. throw Error("A 'pure' computed must not be called recursively");
  204010. this[r2].I[a5] = d;
  204011. d.Ka = this[r2].V++;
  204012. d.La = c14.ob();
  204013. },
  204014. Xa: function() {
  204015. var a5, c14, d = this[r2].I;
  204016. for (a5 in d)
  204017. if (Object.prototype.hasOwnProperty.call(d, a5) && (c14 = d[a5], this.Ia && c14.da.Ja || c14.da.Dd(c14.La)))
  204018. return true;
  204019. },
  204020. Jd: function() {
  204021. this.Ia && !this[r2].rb && this.Ia(false);
  204022. },
  204023. ja: function() {
  204024. var a5 = this[r2];
  204025. return a5.ka || 0 < a5.V;
  204026. },
  204027. Rd: function() {
  204028. this.Ja ? this[r2].ka && (this[r2].sa = true) : this.Hc();
  204029. },
  204030. $c: function(a5) {
  204031. if (a5.Hb) {
  204032. var c14 = a5.subscribe(this.Jd, this, "dirty"), d = a5.subscribe(
  204033. this.Rd,
  204034. this
  204035. );
  204036. return { da: a5, s: function() {
  204037. c14.s();
  204038. d.s();
  204039. } };
  204040. }
  204041. return a5.subscribe(this.Hc, this);
  204042. },
  204043. Hc: function() {
  204044. var b = this, c14 = b.throttleEvaluation;
  204045. c14 && 0 <= c14 ? (clearTimeout(this[r2].Ic), this[r2].Ic = a4.a.setTimeout(function() {
  204046. b.ha(true);
  204047. }, c14)) : b.Ia ? b.Ia(true) : b.ha(true);
  204048. },
  204049. ha: function(b) {
  204050. var c14 = this[r2], d = c14.Sa, e2 = false;
  204051. if (!c14.rb && !c14.ra) {
  204052. if (c14.l && !a4.a.Sb(c14.l) || d && d()) {
  204053. if (!c14.jc) {
  204054. this.s();
  204055. return;
  204056. }
  204057. } else
  204058. c14.jc = false;
  204059. c14.rb = true;
  204060. try {
  204061. e2 = this.zd(b);
  204062. } finally {
  204063. c14.rb = false;
  204064. }
  204065. return e2;
  204066. }
  204067. },
  204068. zd: function(b) {
  204069. var c14 = this[r2], d = false, e2 = c14.wb ? n2 : !c14.V, d = { qd: this, mb: c14.I, Qb: c14.V };
  204070. a4.u.xc({
  204071. pd: d,
  204072. od: ba,
  204073. o: this,
  204074. Ya: e2
  204075. });
  204076. c14.I = {};
  204077. c14.V = 0;
  204078. var f2 = this.yd(c14, d);
  204079. c14.V ? d = this.sb(c14.X, f2) : (this.s(), d = true);
  204080. d && (c14.J ? this.Gb() : this.notifySubscribers(c14.X, "beforeChange"), c14.X = f2, this.notifySubscribers(c14.X, "spectate"), !c14.J && b && this.notifySubscribers(c14.X), this.rc && this.rc());
  204081. e2 && this.notifySubscribers(c14.X, "awake");
  204082. return d;
  204083. },
  204084. yd: function(b, c14) {
  204085. try {
  204086. var d = b.Wc;
  204087. return b.nb ? d.call(b.nb) : d();
  204088. } finally {
  204089. a4.u.end(), c14.Qb && !b.J && a4.a.P(c14.mb, aa), b.sa = b.ka = false;
  204090. }
  204091. },
  204092. v: function(a5) {
  204093. var c14 = this[r2];
  204094. (c14.ka && (a5 || !c14.V) || c14.J && this.Xa()) && this.ha();
  204095. return c14.X;
  204096. },
  204097. ub: function(b) {
  204098. a4.T.fn.ub.call(this, b);
  204099. this.nc = function() {
  204100. this[r2].J || (this[r2].sa ? this.ha() : this[r2].ka = false);
  204101. return this[r2].X;
  204102. };
  204103. this.Ia = function(a5) {
  204104. this.pc(this[r2].X);
  204105. this[r2].ka = true;
  204106. a5 && (this[r2].sa = true);
  204107. this.qc(this, !a5);
  204108. };
  204109. },
  204110. s: function() {
  204111. var b = this[r2];
  204112. !b.J && b.I && a4.a.P(b.I, function(a5, b2) {
  204113. b2.s && b2.s();
  204114. });
  204115. b.l && b.Rb && a4.a.K.yb(b.l, b.Rb);
  204116. b.I = n2;
  204117. b.V = 0;
  204118. b.ra = true;
  204119. b.sa = false;
  204120. b.ka = false;
  204121. b.J = false;
  204122. b.l = n2;
  204123. b.Sa = n2;
  204124. b.Wc = n2;
  204125. this.Nc || (b.nb = n2);
  204126. }
  204127. }, da = { Qa: function(b) {
  204128. var c14 = this, d = c14[r2];
  204129. if (!d.ra && d.J && "change" == b) {
  204130. d.J = false;
  204131. if (d.sa || c14.Xa())
  204132. d.I = null, d.V = 0, c14.ha() && c14.Gb();
  204133. else {
  204134. var e2 = [];
  204135. a4.a.P(d.I, function(a5, b2) {
  204136. e2[b2.Ka] = a5;
  204137. });
  204138. a4.a.D(e2, function(a5, b2) {
  204139. var e3 = d.I[a5], m = c14.$c(e3.da);
  204140. m.Ka = b2;
  204141. m.La = e3.La;
  204142. d.I[a5] = m;
  204143. });
  204144. c14.Xa() && c14.ha() && c14.Gb();
  204145. }
  204146. d.ra || c14.notifySubscribers(d.X, "awake");
  204147. }
  204148. }, hb: function(b) {
  204149. var c14 = this[r2];
  204150. c14.ra || "change" != b || this.Wa("change") || (a4.a.P(c14.I, function(a5, b2) {
  204151. b2.s && (c14.I[a5] = { da: b2.da, Ka: b2.Ka, La: b2.La }, b2.s());
  204152. }), c14.J = true, this.notifySubscribers(n2, "asleep"));
  204153. }, ob: function() {
  204154. var b = this[r2];
  204155. b.J && (b.sa || this.Xa()) && this.ha();
  204156. return a4.T.fn.ob.call(this);
  204157. } }, ea = { Qa: function(a5) {
  204158. "change" != a5 && "beforeChange" != a5 || this.v();
  204159. } };
  204160. a4.a.Ba && a4.a.setPrototypeOf(C, a4.T.fn);
  204161. var N = a4.ta.Ma;
  204162. C[N] = a4.o;
  204163. a4.Oc = function(a5) {
  204164. return "function" == typeof a5 && a5[N] === C[N];
  204165. };
  204166. a4.Fd = function(b) {
  204167. return a4.Oc(b) && b[r2] && b[r2].wb;
  204168. };
  204169. a4.b("computed", a4.o);
  204170. a4.b("dependentObservable", a4.o);
  204171. a4.b("isComputed", a4.Oc);
  204172. a4.b("isPureComputed", a4.Fd);
  204173. a4.b("computed.fn", C);
  204174. a4.L(C, "peek", C.v);
  204175. a4.L(C, "dispose", C.s);
  204176. a4.L(C, "isActive", C.ja);
  204177. a4.L(C, "getDependenciesCount", C.qa);
  204178. a4.L(C, "getDependencies", C.Va);
  204179. a4.xb = function(b, c14) {
  204180. if ("function" === typeof b)
  204181. return a4.o(
  204182. b,
  204183. c14,
  204184. { pure: true }
  204185. );
  204186. b = a4.a.extend({}, b);
  204187. b.pure = true;
  204188. return a4.o(b, c14);
  204189. };
  204190. a4.b("pureComputed", a4.xb);
  204191. (function() {
  204192. function b(a5, f2, g) {
  204193. g = g || new d();
  204194. a5 = f2(a5);
  204195. if ("object" != typeof a5 || null === a5 || a5 === n2 || a5 instanceof RegExp || a5 instanceof Date || a5 instanceof String || a5 instanceof Number || a5 instanceof Boolean)
  204196. return a5;
  204197. var h = a5 instanceof Array ? [] : {};
  204198. g.save(a5, h);
  204199. c14(a5, function(c15) {
  204200. var d2 = f2(a5[c15]);
  204201. switch (typeof d2) {
  204202. case "boolean":
  204203. case "number":
  204204. case "string":
  204205. case "function":
  204206. h[c15] = d2;
  204207. break;
  204208. case "object":
  204209. case "undefined":
  204210. var l2 = g.get(d2);
  204211. h[c15] = l2 !== n2 ? l2 : b(d2, f2, g);
  204212. }
  204213. });
  204214. return h;
  204215. }
  204216. function c14(a5, b2) {
  204217. if (a5 instanceof Array) {
  204218. for (var c15 = 0; c15 < a5.length; c15++)
  204219. b2(c15);
  204220. "function" == typeof a5.toJSON && b2("toJSON");
  204221. } else
  204222. for (c15 in a5)
  204223. b2(c15);
  204224. }
  204225. function d() {
  204226. this.keys = [];
  204227. this.values = [];
  204228. }
  204229. a4.ad = function(c15) {
  204230. if (0 == arguments.length)
  204231. throw Error("When calling ko.toJS, pass the object you want to convert.");
  204232. return b(c15, function(b2) {
  204233. for (var c16 = 0; a4.O(b2) && 10 > c16; c16++)
  204234. b2 = b2();
  204235. return b2;
  204236. });
  204237. };
  204238. a4.toJSON = function(b2, c15, d2) {
  204239. b2 = a4.ad(b2);
  204240. return a4.a.hc(b2, c15, d2);
  204241. };
  204242. d.prototype = { constructor: d, save: function(b2, c15) {
  204243. var d2 = a4.a.A(
  204244. this.keys,
  204245. b2
  204246. );
  204247. 0 <= d2 ? this.values[d2] = c15 : (this.keys.push(b2), this.values.push(c15));
  204248. }, get: function(b2) {
  204249. b2 = a4.a.A(this.keys, b2);
  204250. return 0 <= b2 ? this.values[b2] : n2;
  204251. } };
  204252. })();
  204253. a4.b("toJS", a4.ad);
  204254. a4.b("toJSON", a4.toJSON);
  204255. a4.Wd = function(b, c14, d) {
  204256. function e2(c15) {
  204257. var e3 = a4.xb(b, d).extend({ ma: "always" }), h = e3.subscribe(function(a5) {
  204258. a5 && (h.s(), c15(a5));
  204259. });
  204260. e3.notifySubscribers(e3.v());
  204261. return h;
  204262. }
  204263. return "function" !== typeof Promise || c14 ? e2(c14.bind(d)) : new Promise(e2);
  204264. };
  204265. a4.b("when", a4.Wd);
  204266. (function() {
  204267. a4.w = { M: function(b) {
  204268. switch (a4.a.R(b)) {
  204269. case "option":
  204270. return true === b.__ko__hasDomDataOptionValue__ ? a4.a.g.get(b, a4.c.options.$b) : 7 >= a4.a.W ? b.getAttributeNode("value") && b.getAttributeNode("value").specified ? b.value : b.text : b.value;
  204271. case "select":
  204272. return 0 <= b.selectedIndex ? a4.w.M(b.options[b.selectedIndex]) : n2;
  204273. default:
  204274. return b.value;
  204275. }
  204276. }, cb: function(b, c14, d) {
  204277. switch (a4.a.R(b)) {
  204278. case "option":
  204279. "string" === typeof c14 ? (a4.a.g.set(b, a4.c.options.$b, n2), "__ko__hasDomDataOptionValue__" in b && delete b.__ko__hasDomDataOptionValue__, b.value = c14) : (a4.a.g.set(b, a4.c.options.$b, c14), b.__ko__hasDomDataOptionValue__ = true, b.value = "number" === typeof c14 ? c14 : "");
  204280. break;
  204281. case "select":
  204282. if ("" === c14 || null === c14)
  204283. c14 = n2;
  204284. for (var e2 = -1, f2 = 0, g = b.options.length, h; f2 < g; ++f2)
  204285. if (h = a4.w.M(b.options[f2]), h == c14 || "" === h && c14 === n2) {
  204286. e2 = f2;
  204287. break;
  204288. }
  204289. if (d || 0 <= e2 || c14 === n2 && 1 < b.size)
  204290. b.selectedIndex = e2, 6 === a4.a.W && a4.a.setTimeout(function() {
  204291. b.selectedIndex = e2;
  204292. }, 0);
  204293. break;
  204294. default:
  204295. if (null === c14 || c14 === n2)
  204296. c14 = "";
  204297. b.value = c14;
  204298. }
  204299. } };
  204300. })();
  204301. a4.b("selectExtensions", a4.w);
  204302. a4.b("selectExtensions.readValue", a4.w.M);
  204303. a4.b("selectExtensions.writeValue", a4.w.cb);
  204304. a4.m = function() {
  204305. function b(b2) {
  204306. b2 = a4.a.Db(b2);
  204307. 123 === b2.charCodeAt(0) && (b2 = b2.slice(
  204308. 1,
  204309. -1
  204310. ));
  204311. b2 += "\n,";
  204312. var c15 = [], d2 = b2.match(e2), p2, q = [], h2 = 0;
  204313. if (1 < d2.length) {
  204314. for (var x = 0, B; B = d2[x]; ++x) {
  204315. var u3 = B.charCodeAt(0);
  204316. if (44 === u3) {
  204317. if (0 >= h2) {
  204318. c15.push(p2 && q.length ? { key: p2, value: q.join("") } : { unknown: p2 || q.join("") });
  204319. p2 = h2 = 0;
  204320. q = [];
  204321. continue;
  204322. }
  204323. } else if (58 === u3) {
  204324. if (!h2 && !p2 && 1 === q.length) {
  204325. p2 = q.pop();
  204326. continue;
  204327. }
  204328. } else if (47 === u3 && 1 < B.length && (47 === B.charCodeAt(1) || 42 === B.charCodeAt(1)))
  204329. continue;
  204330. else
  204331. 47 === u3 && x && 1 < B.length ? (u3 = d2[x - 1].match(f2)) && !g[u3[0]] && (b2 = b2.substr(b2.indexOf(B) + 1), d2 = b2.match(e2), x = -1, B = "/") : 40 === u3 || 123 === u3 || 91 === u3 ? ++h2 : 41 === u3 || 125 === u3 || 93 === u3 ? --h2 : p2 || q.length || 34 !== u3 && 39 !== u3 || (B = B.slice(1, -1));
  204332. q.push(B);
  204333. }
  204334. if (0 < h2)
  204335. throw Error("Unbalanced parentheses, braces, or brackets");
  204336. }
  204337. return c15;
  204338. }
  204339. var c14 = ["true", "false", "null", "undefined"], d = /^(?:[$_a-z][$\w]*|(.+)(\.\s*[$_a-z][$\w]*|\[.+\]))$/i, e2 = RegExp("\"(?:\\\\.|[^\"])*\"|'(?:\\\\.|[^'])*'|`(?:\\\\.|[^`])*`|/\\*(?:[^*]|\\*+[^*/])*\\*+/|//.*\n|/(?:\\\\.|[^/])+/w*|[^\\s:,/][^,\"'`{}()/:[\\]]*[^\\s,\"'`{}()/:[\\]]|[^\\s]", "g"), f2 = /[\])"'A-Za-z0-9_$]+$/, g = { "in": 1, "return": 1, "typeof": 1 }, h = {};
  204340. return { Ra: [], wa: h, ac: b, vb: function(e3, f3) {
  204341. function l2(b2, e4) {
  204342. var f4;
  204343. if (!x) {
  204344. var k = a4.getBindingHandler(b2);
  204345. if (k && k.preprocess && !(e4 = k.preprocess(e4, b2, l2)))
  204346. return;
  204347. if (k = h[b2])
  204348. f4 = e4, 0 <= a4.a.A(c14, f4) ? f4 = false : (k = f4.match(d), f4 = null === k ? false : k[1] ? "Object(" + k[1] + ")" + k[2] : f4), k = f4;
  204349. k && q.push("'" + ("string" == typeof h[b2] ? h[b2] : b2) + "':function(_z){" + f4 + "=_z}");
  204350. }
  204351. g2 && (e4 = "function(){return " + e4 + " }");
  204352. p2.push("'" + b2 + "':" + e4);
  204353. }
  204354. f3 = f3 || {};
  204355. var p2 = [], q = [], g2 = f3.valueAccessors, x = f3.bindingParams, B = "string" === typeof e3 ? b(e3) : e3;
  204356. a4.a.D(B, function(a5) {
  204357. l2(
  204358. a5.key || a5.unknown,
  204359. a5.value
  204360. );
  204361. });
  204362. q.length && l2("_ko_property_writers", "{" + q.join(",") + " }");
  204363. return p2.join(",");
  204364. }, Id: function(a5, b2) {
  204365. for (var c15 = 0; c15 < a5.length; c15++)
  204366. if (a5[c15].key == b2)
  204367. return true;
  204368. return false;
  204369. }, eb: function(b2, c15, d2, e3, f3) {
  204370. if (b2 && a4.O(b2))
  204371. !a4.Za(b2) || f3 && b2.v() === e3 || b2(e3);
  204372. else if ((b2 = c15.get("_ko_property_writers")) && b2[d2])
  204373. b2[d2](e3);
  204374. } };
  204375. }();
  204376. a4.b("expressionRewriting", a4.m);
  204377. a4.b("expressionRewriting.bindingRewriteValidators", a4.m.Ra);
  204378. a4.b("expressionRewriting.parseObjectLiteral", a4.m.ac);
  204379. a4.b("expressionRewriting.preProcessBindings", a4.m.vb);
  204380. a4.b(
  204381. "expressionRewriting._twoWayBindings",
  204382. a4.m.wa
  204383. );
  204384. a4.b("jsonExpressionRewriting", a4.m);
  204385. a4.b("jsonExpressionRewriting.insertPropertyAccessorsIntoJson", a4.m.vb);
  204386. (function() {
  204387. function b(a5) {
  204388. return 8 == a5.nodeType && g.test(f2 ? a5.text : a5.nodeValue);
  204389. }
  204390. function c14(a5) {
  204391. return 8 == a5.nodeType && h.test(f2 ? a5.text : a5.nodeValue);
  204392. }
  204393. function d(d2, e3) {
  204394. for (var f3 = d2, h2 = 1, g2 = []; f3 = f3.nextSibling; ) {
  204395. if (c14(f3) && (a4.a.g.set(f3, k, true), h2--, 0 === h2))
  204396. return g2;
  204397. g2.push(f3);
  204398. b(f3) && h2++;
  204399. }
  204400. if (!e3)
  204401. throw Error("Cannot find closing comment tag to match: " + d2.nodeValue);
  204402. return null;
  204403. }
  204404. function e2(a5, b2) {
  204405. var c15 = d(a5, b2);
  204406. return c15 ? 0 < c15.length ? c15[c15.length - 1].nextSibling : a5.nextSibling : null;
  204407. }
  204408. var f2 = w && "<!--test-->" === w.createComment("test").text, g = f2 ? /^\x3c!--\s*ko(?:\s+([\s\S]+))?\s*--\x3e$/ : /^\s*ko(?:\s+([\s\S]+))?\s*$/, h = f2 ? /^\x3c!--\s*\/ko\s*--\x3e$/ : /^\s*\/ko\s*$/, m = { ul: true, ol: true }, k = "__ko_matchedEndComment__";
  204409. a4.h = { ea: {}, childNodes: function(a5) {
  204410. return b(a5) ? d(a5) : a5.childNodes;
  204411. }, Ea: function(c15) {
  204412. if (b(c15)) {
  204413. c15 = a4.h.childNodes(c15);
  204414. for (var d2 = 0, e3 = c15.length; d2 < e3; d2++)
  204415. a4.removeNode(c15[d2]);
  204416. } else
  204417. a4.a.Tb(c15);
  204418. }, va: function(c15, d2) {
  204419. if (b(c15)) {
  204420. a4.h.Ea(c15);
  204421. for (var e3 = c15.nextSibling, f3 = 0, k2 = d2.length; f3 < k2; f3++)
  204422. e3.parentNode.insertBefore(d2[f3], e3);
  204423. } else
  204424. a4.a.va(c15, d2);
  204425. }, Vc: function(a5, c15) {
  204426. var d2;
  204427. b(a5) ? (d2 = a5.nextSibling, a5 = a5.parentNode) : d2 = a5.firstChild;
  204428. d2 ? c15 !== d2 && a5.insertBefore(c15, d2) : a5.appendChild(c15);
  204429. }, Wb: function(c15, d2, e3) {
  204430. e3 ? (e3 = e3.nextSibling, b(c15) && (c15 = c15.parentNode), e3 ? d2 !== e3 && c15.insertBefore(d2, e3) : c15.appendChild(d2)) : a4.h.Vc(c15, d2);
  204431. }, firstChild: function(a5) {
  204432. if (b(a5))
  204433. return !a5.nextSibling || c14(a5.nextSibling) ? null : a5.nextSibling;
  204434. if (a5.firstChild && c14(a5.firstChild))
  204435. throw Error("Found invalid end comment, as the first child of " + a5);
  204436. return a5.firstChild;
  204437. }, nextSibling: function(d2) {
  204438. b(d2) && (d2 = e2(d2));
  204439. if (d2.nextSibling && c14(d2.nextSibling)) {
  204440. var f3 = d2.nextSibling;
  204441. if (c14(f3) && !a4.a.g.get(f3, k))
  204442. throw Error("Found end comment without a matching opening comment, as child of " + d2);
  204443. return null;
  204444. }
  204445. return d2.nextSibling;
  204446. }, Cd: b, Vd: function(a5) {
  204447. return (a5 = (f2 ? a5.text : a5.nodeValue).match(g)) ? a5[1] : null;
  204448. }, Sc: function(d2) {
  204449. if (m[a4.a.R(d2)]) {
  204450. var f3 = d2.firstChild;
  204451. if (f3) {
  204452. do
  204453. if (1 === f3.nodeType) {
  204454. var k2;
  204455. k2 = f3.firstChild;
  204456. var h2 = null;
  204457. if (k2) {
  204458. do
  204459. if (h2)
  204460. h2.push(k2);
  204461. else if (b(k2)) {
  204462. var g2 = e2(k2, true);
  204463. g2 ? k2 = g2 : h2 = [k2];
  204464. } else
  204465. c14(k2) && (h2 = [k2]);
  204466. while (k2 = k2.nextSibling);
  204467. }
  204468. if (k2 = h2)
  204469. for (h2 = f3.nextSibling, g2 = 0; g2 < k2.length; g2++)
  204470. h2 ? d2.insertBefore(k2[g2], h2) : d2.appendChild(k2[g2]);
  204471. }
  204472. while (f3 = f3.nextSibling);
  204473. }
  204474. }
  204475. } };
  204476. })();
  204477. a4.b("virtualElements", a4.h);
  204478. a4.b("virtualElements.allowedBindings", a4.h.ea);
  204479. a4.b("virtualElements.emptyNode", a4.h.Ea);
  204480. a4.b("virtualElements.insertAfter", a4.h.Wb);
  204481. a4.b("virtualElements.prepend", a4.h.Vc);
  204482. a4.b("virtualElements.setDomNodeChildren", a4.h.va);
  204483. (function() {
  204484. a4.ga = function() {
  204485. this.nd = {};
  204486. };
  204487. a4.a.extend(a4.ga.prototype, {
  204488. nodeHasBindings: function(b) {
  204489. switch (b.nodeType) {
  204490. case 1:
  204491. return null != b.getAttribute("data-bind") || a4.j.getComponentNameForNode(b);
  204492. case 8:
  204493. return a4.h.Cd(b);
  204494. default:
  204495. return false;
  204496. }
  204497. },
  204498. getBindings: function(b, c14) {
  204499. var d = this.getBindingsString(b, c14), d = d ? this.parseBindingsString(d, c14, b) : null;
  204500. return a4.j.tc(d, b, c14, false);
  204501. },
  204502. getBindingAccessors: function(b, c14) {
  204503. var d = this.getBindingsString(b, c14), d = d ? this.parseBindingsString(d, c14, b, { valueAccessors: true }) : null;
  204504. return a4.j.tc(d, b, c14, true);
  204505. },
  204506. getBindingsString: function(b) {
  204507. switch (b.nodeType) {
  204508. case 1:
  204509. return b.getAttribute("data-bind");
  204510. case 8:
  204511. return a4.h.Vd(b);
  204512. default:
  204513. return null;
  204514. }
  204515. },
  204516. parseBindingsString: function(b, c14, d, e2) {
  204517. try {
  204518. var f2 = this.nd, g = b + (e2 && e2.valueAccessors || ""), h;
  204519. if (!(h = f2[g])) {
  204520. var m, k = "with($context){with($data||{}){return{" + a4.m.vb(b, e2) + "}}}";
  204521. m = new Function("$context", "$element", k);
  204522. h = f2[g] = m;
  204523. }
  204524. return h(c14, d);
  204525. } catch (l2) {
  204526. throw l2.message = "Unable to parse bindings.\nBindings value: " + b + "\nMessage: " + l2.message, l2;
  204527. }
  204528. }
  204529. });
  204530. a4.ga.instance = new a4.ga();
  204531. })();
  204532. a4.b("bindingProvider", a4.ga);
  204533. (function() {
  204534. function b(b2) {
  204535. var c15 = (b2 = a4.a.g.get(b2, z)) && b2.N;
  204536. c15 && (b2.N = null, c15.Tc());
  204537. }
  204538. function c14(c15, d2, e3) {
  204539. this.node = c15;
  204540. this.yc = d2;
  204541. this.kb = [];
  204542. this.H = false;
  204543. d2.N || a4.a.K.za(c15, b);
  204544. e3 && e3.N && (e3.N.kb.push(c15), this.Kb = e3);
  204545. }
  204546. function d(a5) {
  204547. return function() {
  204548. return a5;
  204549. };
  204550. }
  204551. function e2(a5) {
  204552. return a5();
  204553. }
  204554. function f2(b2) {
  204555. return a4.a.Ga(a4.u.G(b2), function(a5, c15) {
  204556. return function() {
  204557. return b2()[c15];
  204558. };
  204559. });
  204560. }
  204561. function g(b2, c15, e3) {
  204562. return "function" === typeof b2 ? f2(b2.bind(null, c15, e3)) : a4.a.Ga(b2, d);
  204563. }
  204564. function h(a5, b2) {
  204565. return f2(this.getBindings.bind(this, a5, b2));
  204566. }
  204567. function m(b2, c15) {
  204568. var d2 = a4.h.firstChild(c15);
  204569. if (d2) {
  204570. var e3, f3 = a4.ga.instance, l3 = f3.preprocessNode;
  204571. if (l3) {
  204572. for (; e3 = d2; )
  204573. d2 = a4.h.nextSibling(e3), l3.call(f3, e3);
  204574. d2 = a4.h.firstChild(c15);
  204575. }
  204576. for (; e3 = d2; )
  204577. d2 = a4.h.nextSibling(e3), k(b2, e3);
  204578. }
  204579. a4.i.ma(c15, a4.i.H);
  204580. }
  204581. function k(b2, c15) {
  204582. var d2 = b2, e3 = 1 === c15.nodeType;
  204583. e3 && a4.h.Sc(c15);
  204584. if (e3 || a4.ga.instance.nodeHasBindings(c15))
  204585. d2 = p2(c15, null, b2).bindingContextForDescendants;
  204586. d2 && !u3[a4.a.R(c15)] && m(d2, c15);
  204587. }
  204588. function l2(b2) {
  204589. var c15 = [], d2 = {}, e3 = [];
  204590. a4.a.P(b2, function ca(f3) {
  204591. if (!d2[f3]) {
  204592. var k2 = a4.getBindingHandler(f3);
  204593. k2 && (k2.after && (e3.push(f3), a4.a.D(k2.after, function(c16) {
  204594. if (b2[c16]) {
  204595. if (-1 !== a4.a.A(e3, c16))
  204596. throw Error("Cannot combine the following bindings, because they have a cyclic dependency: " + e3.join(", "));
  204597. ca(c16);
  204598. }
  204599. }), e3.length--), c15.push({ key: f3, Mc: k2 }));
  204600. d2[f3] = true;
  204601. }
  204602. });
  204603. return c15;
  204604. }
  204605. function p2(b2, c15, d2) {
  204606. var f3 = a4.a.g.Ub(b2, z, {}), k2 = f3.hd;
  204607. if (!c15) {
  204608. if (k2)
  204609. throw Error("You cannot apply bindings multiple times to the same element.");
  204610. f3.hd = true;
  204611. }
  204612. k2 || (f3.context = d2);
  204613. f3.Zb || (f3.Zb = {});
  204614. var g2;
  204615. if (c15 && "function" !== typeof c15)
  204616. g2 = c15;
  204617. else {
  204618. var p3 = a4.ga.instance, q3 = p3.getBindingAccessors || h, m2 = a4.$(function() {
  204619. if (g2 = c15 ? c15(d2, b2) : q3.call(p3, b2, d2)) {
  204620. if (d2[t])
  204621. d2[t]();
  204622. if (d2[B])
  204623. d2[B]();
  204624. }
  204625. return g2;
  204626. }, null, { l: b2 });
  204627. g2 && m2.ja() || (m2 = null);
  204628. }
  204629. var x2 = d2, u4;
  204630. if (g2) {
  204631. var J2 = function() {
  204632. return a4.a.Ga(m2 ? m2() : g2, e2);
  204633. }, r3 = m2 ? function(a5) {
  204634. return function() {
  204635. return e2(m2()[a5]);
  204636. };
  204637. } : function(a5) {
  204638. return g2[a5];
  204639. };
  204640. J2.get = function(a5) {
  204641. return g2[a5] && e2(r3(a5));
  204642. };
  204643. J2.has = function(a5) {
  204644. return a5 in g2;
  204645. };
  204646. a4.i.H in g2 && a4.i.subscribe(b2, a4.i.H, function() {
  204647. var c16 = (0, g2[a4.i.H])();
  204648. if (c16) {
  204649. var d3 = a4.h.childNodes(b2);
  204650. d3.length && c16(d3, a4.Ec(d3[0]));
  204651. }
  204652. });
  204653. a4.i.pa in g2 && (x2 = a4.i.Cb(b2, d2), a4.i.subscribe(b2, a4.i.pa, function() {
  204654. var c16 = (0, g2[a4.i.pa])();
  204655. c16 && a4.h.firstChild(b2) && c16(b2);
  204656. }));
  204657. f3 = l2(g2);
  204658. a4.a.D(f3, function(c16) {
  204659. var d3 = c16.Mc.init, e3 = c16.Mc.update, f4 = c16.key;
  204660. if (8 === b2.nodeType && !a4.h.ea[f4])
  204661. throw Error("The binding '" + f4 + "' cannot be used with virtual elements");
  204662. try {
  204663. "function" == typeof d3 && a4.u.G(function() {
  204664. var a5 = d3(b2, r3(f4), J2, x2.$data, x2);
  204665. if (a5 && a5.controlsDescendantBindings) {
  204666. if (u4 !== n2)
  204667. throw Error("Multiple bindings (" + u4 + " and " + f4 + ") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.");
  204668. u4 = f4;
  204669. }
  204670. }), "function" == typeof e3 && a4.$(function() {
  204671. e3(b2, r3(f4), J2, x2.$data, x2);
  204672. }, null, { l: b2 });
  204673. } catch (k3) {
  204674. throw k3.message = 'Unable to process binding "' + f4 + ": " + g2[f4] + '"\nMessage: ' + k3.message, k3;
  204675. }
  204676. });
  204677. }
  204678. f3 = u4 === n2;
  204679. return { shouldBindDescendants: f3, bindingContextForDescendants: f3 && x2 };
  204680. }
  204681. function q(b2, c15) {
  204682. return b2 && b2 instanceof a4.fa ? b2 : new a4.fa(b2, n2, n2, c15);
  204683. }
  204684. var t = a4.a.Da("_subscribable"), x = a4.a.Da("_ancestorBindingInfo"), B = a4.a.Da("_dataDependency");
  204685. a4.c = {};
  204686. var u3 = { script: true, textarea: true, template: true };
  204687. a4.getBindingHandler = function(b2) {
  204688. return a4.c[b2];
  204689. };
  204690. var J = {};
  204691. a4.fa = function(b2, c15, d2, e3, f3) {
  204692. function k2() {
  204693. var b3 = p3 ? h2() : h2, f4 = a4.a.f(b3);
  204694. c15 ? (a4.a.extend(l3, c15), x in c15 && (l3[x] = c15[x])) : (l3.$parents = [], l3.$root = f4, l3.ko = a4);
  204695. l3[t] = q3;
  204696. g2 ? f4 = l3.$data : (l3.$rawData = b3, l3.$data = f4);
  204697. d2 && (l3[d2] = f4);
  204698. e3 && e3(l3, c15, f4);
  204699. if (c15 && c15[t] && !a4.S.o().Vb(c15[t]))
  204700. c15[t]();
  204701. m2 && (l3[B] = m2);
  204702. return l3.$data;
  204703. }
  204704. var l3 = this, g2 = b2 === J, h2 = g2 ? n2 : b2, p3 = "function" == typeof h2 && !a4.O(h2), q3, m2 = f3 && f3.dataDependency;
  204705. f3 && f3.exportDependencies ? k2() : (q3 = a4.xb(k2), q3.v(), q3.ja() ? q3.equalityComparer = null : l3[t] = n2);
  204706. };
  204707. a4.fa.prototype.createChildContext = function(b2, c15, d2, e3) {
  204708. !e3 && c15 && "object" == typeof c15 && (e3 = c15, c15 = e3.as, d2 = e3.extend);
  204709. if (c15 && e3 && e3.noChildContext) {
  204710. var f3 = "function" == typeof b2 && !a4.O(b2);
  204711. return new a4.fa(J, this, null, function(a5) {
  204712. d2 && d2(a5);
  204713. a5[c15] = f3 ? b2() : b2;
  204714. }, e3);
  204715. }
  204716. return new a4.fa(
  204717. b2,
  204718. this,
  204719. c15,
  204720. function(a5, b3) {
  204721. a5.$parentContext = b3;
  204722. a5.$parent = b3.$data;
  204723. a5.$parents = (b3.$parents || []).slice(0);
  204724. a5.$parents.unshift(a5.$parent);
  204725. d2 && d2(a5);
  204726. },
  204727. e3
  204728. );
  204729. };
  204730. a4.fa.prototype.extend = function(b2, c15) {
  204731. return new a4.fa(J, this, null, function(c16) {
  204732. a4.a.extend(c16, "function" == typeof b2 ? b2(c16) : b2);
  204733. }, c15);
  204734. };
  204735. var z = a4.a.g.Z();
  204736. c14.prototype.Tc = function() {
  204737. this.Kb && this.Kb.N && this.Kb.N.sd(this.node);
  204738. };
  204739. c14.prototype.sd = function(b2) {
  204740. a4.a.Pa(this.kb, b2);
  204741. !this.kb.length && this.H && this.Cc();
  204742. };
  204743. c14.prototype.Cc = function() {
  204744. this.H = true;
  204745. this.yc.N && !this.kb.length && (this.yc.N = null, a4.a.K.yb(this.node, b), a4.i.ma(this.node, a4.i.pa), this.Tc());
  204746. };
  204747. a4.i = { H: "childrenComplete", pa: "descendantsComplete", subscribe: function(b2, c15, d2, e3, f3) {
  204748. var k2 = a4.a.g.Ub(b2, z, {});
  204749. k2.Fa || (k2.Fa = new a4.T());
  204750. f3 && f3.notifyImmediately && k2.Zb[c15] && a4.u.G(d2, e3, [b2]);
  204751. return k2.Fa.subscribe(d2, e3, c15);
  204752. }, ma: function(b2, c15) {
  204753. var d2 = a4.a.g.get(b2, z);
  204754. if (d2 && (d2.Zb[c15] = true, d2.Fa && d2.Fa.notifySubscribers(b2, c15), c15 == a4.i.H)) {
  204755. if (d2.N)
  204756. d2.N.Cc();
  204757. else if (d2.N === n2 && d2.Fa && d2.Fa.Wa(a4.i.pa))
  204758. throw Error("descendantsComplete event not supported for bindings on this node");
  204759. }
  204760. }, Cb: function(b2, d2) {
  204761. var e3 = a4.a.g.Ub(b2, z, {});
  204762. e3.N || (e3.N = new c14(b2, e3, d2[x]));
  204763. return d2[x] == e3 ? d2 : d2.extend(function(a5) {
  204764. a5[x] = e3;
  204765. });
  204766. } };
  204767. a4.Td = function(b2) {
  204768. return (b2 = a4.a.g.get(b2, z)) && b2.context;
  204769. };
  204770. a4.ib = function(b2, c15, d2) {
  204771. 1 === b2.nodeType && a4.h.Sc(b2);
  204772. return p2(b2, c15, q(d2));
  204773. };
  204774. a4.ld = function(b2, c15, d2) {
  204775. d2 = q(d2);
  204776. return a4.ib(b2, g(c15, d2, b2), d2);
  204777. };
  204778. a4.Oa = function(a5, b2) {
  204779. 1 !== b2.nodeType && 8 !== b2.nodeType || m(q(a5), b2);
  204780. };
  204781. a4.vc = function(a5, b2, c15) {
  204782. !v7 && A.jQuery && (v7 = A.jQuery);
  204783. if (2 > arguments.length) {
  204784. if (b2 = w.body, !b2)
  204785. throw Error("ko.applyBindings: could not find document.body; has the document been loaded?");
  204786. } else if (!b2 || 1 !== b2.nodeType && 8 !== b2.nodeType)
  204787. throw Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node");
  204788. k(q(a5, c15), b2);
  204789. };
  204790. a4.Dc = function(b2) {
  204791. return !b2 || 1 !== b2.nodeType && 8 !== b2.nodeType ? n2 : a4.Td(b2);
  204792. };
  204793. a4.Ec = function(b2) {
  204794. return (b2 = a4.Dc(b2)) ? b2.$data : n2;
  204795. };
  204796. a4.b("bindingHandlers", a4.c);
  204797. a4.b("bindingEvent", a4.i);
  204798. a4.b("bindingEvent.subscribe", a4.i.subscribe);
  204799. a4.b("bindingEvent.startPossiblyAsyncContentBinding", a4.i.Cb);
  204800. a4.b("applyBindings", a4.vc);
  204801. a4.b("applyBindingsToDescendants", a4.Oa);
  204802. a4.b("applyBindingAccessorsToNode", a4.ib);
  204803. a4.b("applyBindingsToNode", a4.ld);
  204804. a4.b("contextFor", a4.Dc);
  204805. a4.b("dataFor", a4.Ec);
  204806. })();
  204807. (function(b) {
  204808. function c14(c15, e3) {
  204809. var k = Object.prototype.hasOwnProperty.call(f2, c15) ? f2[c15] : b, l2;
  204810. k ? k.subscribe(e3) : (k = f2[c15] = new a4.T(), k.subscribe(e3), d(c15, function(b2, d2) {
  204811. var e4 = !(!d2 || !d2.synchronous);
  204812. g[c15] = { definition: b2, Gd: e4 };
  204813. delete f2[c15];
  204814. l2 || e4 ? k.notifySubscribers(b2) : a4.na.zb(function() {
  204815. k.notifySubscribers(b2);
  204816. });
  204817. }), l2 = true);
  204818. }
  204819. function d(a5, b2) {
  204820. e2("getConfig", [a5], function(c15) {
  204821. c15 ? e2("loadComponent", [a5, c15], function(a6) {
  204822. b2(
  204823. a6,
  204824. c15
  204825. );
  204826. }) : b2(null, null);
  204827. });
  204828. }
  204829. function e2(c15, d2, f3, l2) {
  204830. l2 || (l2 = a4.j.loaders.slice(0));
  204831. var g2 = l2.shift();
  204832. if (g2) {
  204833. var q = g2[c15];
  204834. if (q) {
  204835. var t = false;
  204836. if (q.apply(g2, d2.concat(function(a5) {
  204837. t ? f3(null) : null !== a5 ? f3(a5) : e2(c15, d2, f3, l2);
  204838. })) !== b && (t = true, !g2.suppressLoaderExceptions))
  204839. throw Error("Component loaders must supply values by invoking the callback, not by returning values synchronously.");
  204840. } else
  204841. e2(c15, d2, f3, l2);
  204842. } else
  204843. f3(null);
  204844. }
  204845. var f2 = {}, g = {};
  204846. a4.j = { get: function(d2, e3) {
  204847. var f3 = Object.prototype.hasOwnProperty.call(g, d2) ? g[d2] : b;
  204848. f3 ? f3.Gd ? a4.u.G(function() {
  204849. e3(f3.definition);
  204850. }) : a4.na.zb(function() {
  204851. e3(f3.definition);
  204852. }) : c14(d2, e3);
  204853. }, Bc: function(a5) {
  204854. delete g[a5];
  204855. }, oc: e2 };
  204856. a4.j.loaders = [];
  204857. a4.b("components", a4.j);
  204858. a4.b("components.get", a4.j.get);
  204859. a4.b("components.clearCachedDefinition", a4.j.Bc);
  204860. })();
  204861. (function() {
  204862. function b(b2, c15, d2, e3) {
  204863. function g2() {
  204864. 0 === --B && e3(h2);
  204865. }
  204866. var h2 = {}, B = 2, u3 = d2.template;
  204867. d2 = d2.viewModel;
  204868. u3 ? f2(c15, u3, function(c16) {
  204869. a4.j.oc("loadTemplate", [b2, c16], function(a5) {
  204870. h2.template = a5;
  204871. g2();
  204872. });
  204873. }) : g2();
  204874. d2 ? f2(c15, d2, function(c16) {
  204875. a4.j.oc("loadViewModel", [b2, c16], function(a5) {
  204876. h2[m] = a5;
  204877. g2();
  204878. });
  204879. }) : g2();
  204880. }
  204881. function c14(a5, b2, d2) {
  204882. if ("function" === typeof b2)
  204883. d2(function(a6) {
  204884. return new b2(a6);
  204885. });
  204886. else if ("function" === typeof b2[m])
  204887. d2(b2[m]);
  204888. else if ("instance" in b2) {
  204889. var e3 = b2.instance;
  204890. d2(function() {
  204891. return e3;
  204892. });
  204893. } else
  204894. "viewModel" in b2 ? c14(a5, b2.viewModel, d2) : a5("Unknown viewModel value: " + b2);
  204895. }
  204896. function d(b2) {
  204897. switch (a4.a.R(b2)) {
  204898. case "script":
  204899. return a4.a.ua(b2.text);
  204900. case "textarea":
  204901. return a4.a.ua(b2.value);
  204902. case "template":
  204903. if (e2(b2.content))
  204904. return a4.a.Ca(b2.content.childNodes);
  204905. }
  204906. return a4.a.Ca(b2.childNodes);
  204907. }
  204908. function e2(a5) {
  204909. return A.DocumentFragment ? a5 instanceof DocumentFragment : a5 && 11 === a5.nodeType;
  204910. }
  204911. function f2(a5, b2, c15) {
  204912. "string" === typeof b2.require ? T || A.require ? (T || A.require)([b2.require], function(a6) {
  204913. a6 && "object" === typeof a6 && a6.Xd && a6["default"] && (a6 = a6["default"]);
  204914. c15(a6);
  204915. }) : a5("Uses require, but no AMD loader is present") : c15(b2);
  204916. }
  204917. function g(a5) {
  204918. return function(b2) {
  204919. throw Error("Component '" + a5 + "': " + b2);
  204920. };
  204921. }
  204922. var h = {};
  204923. a4.j.register = function(b2, c15) {
  204924. if (!c15)
  204925. throw Error("Invalid configuration for " + b2);
  204926. if (a4.j.tb(b2))
  204927. throw Error("Component " + b2 + " is already registered");
  204928. h[b2] = c15;
  204929. };
  204930. a4.j.tb = function(a5) {
  204931. return Object.prototype.hasOwnProperty.call(h, a5);
  204932. };
  204933. a4.j.unregister = function(b2) {
  204934. delete h[b2];
  204935. a4.j.Bc(b2);
  204936. };
  204937. a4.j.Fc = { getConfig: function(b2, c15) {
  204938. c15(a4.j.tb(b2) ? h[b2] : null);
  204939. }, loadComponent: function(a5, c15, d2) {
  204940. var e3 = g(a5);
  204941. f2(e3, c15, function(c16) {
  204942. b(a5, e3, c16, d2);
  204943. });
  204944. }, loadTemplate: function(b2, c15, f3) {
  204945. b2 = g(b2);
  204946. if ("string" === typeof c15)
  204947. f3(a4.a.ua(c15));
  204948. else if (c15 instanceof Array)
  204949. f3(c15);
  204950. else if (e2(c15))
  204951. f3(a4.a.la(c15.childNodes));
  204952. else if (c15.element)
  204953. if (c15 = c15.element, A.HTMLElement ? c15 instanceof HTMLElement : c15 && c15.tagName && 1 === c15.nodeType)
  204954. f3(d(c15));
  204955. else if ("string" === typeof c15) {
  204956. var h2 = w.getElementById(c15);
  204957. h2 ? f3(d(h2)) : b2("Cannot find element with ID " + c15);
  204958. } else
  204959. b2("Unknown element type: " + c15);
  204960. else
  204961. b2("Unknown template value: " + c15);
  204962. }, loadViewModel: function(a5, b2, d2) {
  204963. c14(g(a5), b2, d2);
  204964. } };
  204965. var m = "createViewModel";
  204966. a4.b("components.register", a4.j.register);
  204967. a4.b("components.isRegistered", a4.j.tb);
  204968. a4.b("components.unregister", a4.j.unregister);
  204969. a4.b("components.defaultLoader", a4.j.Fc);
  204970. a4.j.loaders.push(a4.j.Fc);
  204971. a4.j.dd = h;
  204972. })();
  204973. (function() {
  204974. function b(b2, e2) {
  204975. var f2 = b2.getAttribute("params");
  204976. if (f2) {
  204977. var f2 = c14.parseBindingsString(f2, e2, b2, { valueAccessors: true, bindingParams: true }), f2 = a4.a.Ga(f2, function(c15) {
  204978. return a4.o(c15, null, { l: b2 });
  204979. }), g = a4.a.Ga(
  204980. f2,
  204981. function(c15) {
  204982. var e3 = c15.v();
  204983. return c15.ja() ? a4.o({ read: function() {
  204984. return a4.a.f(c15());
  204985. }, write: a4.Za(e3) && function(a5) {
  204986. c15()(a5);
  204987. }, l: b2 }) : e3;
  204988. }
  204989. );
  204990. Object.prototype.hasOwnProperty.call(g, "$raw") || (g.$raw = f2);
  204991. return g;
  204992. }
  204993. return { $raw: {} };
  204994. }
  204995. a4.j.getComponentNameForNode = function(b2) {
  204996. var c15 = a4.a.R(b2);
  204997. if (a4.j.tb(c15) && (-1 != c15.indexOf("-") || "[object HTMLUnknownElement]" == "" + b2 || 8 >= a4.a.W && b2.tagName === c15))
  204998. return c15;
  204999. };
  205000. a4.j.tc = function(c15, e2, f2, g) {
  205001. if (1 === e2.nodeType) {
  205002. var h = a4.j.getComponentNameForNode(e2);
  205003. if (h) {
  205004. c15 = c15 || {};
  205005. if (c15.component)
  205006. throw Error('Cannot use the "component" binding on a custom element matching a component');
  205007. var m = { name: h, params: b(e2, f2) };
  205008. c15.component = g ? function() {
  205009. return m;
  205010. } : m;
  205011. }
  205012. }
  205013. return c15;
  205014. };
  205015. var c14 = new a4.ga();
  205016. 9 > a4.a.W && (a4.j.register = function(a5) {
  205017. return function(b2) {
  205018. return a5.apply(this, arguments);
  205019. };
  205020. }(a4.j.register), w.createDocumentFragment = function(b2) {
  205021. return function() {
  205022. var c15 = b2(), f2 = a4.j.dd, g;
  205023. for (g in f2)
  205024. ;
  205025. return c15;
  205026. };
  205027. }(w.createDocumentFragment));
  205028. })();
  205029. (function() {
  205030. function b(b2, c15, d2) {
  205031. c15 = c15.template;
  205032. if (!c15)
  205033. throw Error("Component '" + b2 + "' has no template");
  205034. b2 = a4.a.Ca(c15);
  205035. a4.h.va(d2, b2);
  205036. }
  205037. function c14(a5, b2, c15) {
  205038. var d2 = a5.createViewModel;
  205039. return d2 ? d2.call(
  205040. a5,
  205041. b2,
  205042. c15
  205043. ) : b2;
  205044. }
  205045. var d = 0;
  205046. a4.c.component = { init: function(e2, f2, g, h, m) {
  205047. function k() {
  205048. var a5 = l2 && l2.dispose;
  205049. "function" === typeof a5 && a5.call(l2);
  205050. q && q.s();
  205051. p2 = l2 = q = null;
  205052. }
  205053. var l2, p2, q, t = a4.a.la(a4.h.childNodes(e2));
  205054. a4.h.Ea(e2);
  205055. a4.a.K.za(e2, k);
  205056. a4.o(function() {
  205057. var g2 = a4.a.f(f2()), h2, u3;
  205058. "string" === typeof g2 ? h2 = g2 : (h2 = a4.a.f(g2.name), u3 = a4.a.f(g2.params));
  205059. if (!h2)
  205060. throw Error("No component name specified");
  205061. var n3 = a4.i.Cb(e2, m), z = p2 = ++d;
  205062. a4.j.get(h2, function(d2) {
  205063. if (p2 === z) {
  205064. k();
  205065. if (!d2)
  205066. throw Error("Unknown component '" + h2 + "'");
  205067. b(h2, d2, e2);
  205068. var f3 = c14(d2, u3, { element: e2, templateNodes: t });
  205069. d2 = n3.createChildContext(f3, { extend: function(a5) {
  205070. a5.$component = f3;
  205071. a5.$componentTemplateNodes = t;
  205072. } });
  205073. f3 && f3.koDescendantsComplete && (q = a4.i.subscribe(e2, a4.i.pa, f3.koDescendantsComplete, f3));
  205074. l2 = f3;
  205075. a4.Oa(d2, e2);
  205076. }
  205077. });
  205078. }, null, { l: e2 });
  205079. return { controlsDescendantBindings: true };
  205080. } };
  205081. a4.h.ea.component = true;
  205082. })();
  205083. var V = { "class": "className", "for": "htmlFor" };
  205084. a4.c.attr = { update: function(b, c14) {
  205085. var d = a4.a.f(c14()) || {};
  205086. a4.a.P(d, function(c15, d2) {
  205087. d2 = a4.a.f(d2);
  205088. var g = c15.indexOf(":"), g = "lookupNamespaceURI" in b && 0 < g && b.lookupNamespaceURI(c15.substr(0, g)), h = false === d2 || null === d2 || d2 === n2;
  205089. h ? g ? b.removeAttributeNS(g, c15) : b.removeAttribute(c15) : d2 = d2.toString();
  205090. 8 >= a4.a.W && c15 in V ? (c15 = V[c15], h ? b.removeAttribute(c15) : b[c15] = d2) : h || (g ? b.setAttributeNS(g, c15, d2) : b.setAttribute(c15, d2));
  205091. "name" === c15 && a4.a.Yc(b, h ? "" : d2);
  205092. });
  205093. } };
  205094. (function() {
  205095. a4.c.checked = { after: ["value", "attr"], init: function(b, c14, d) {
  205096. function e2() {
  205097. var e3 = b.checked, f3 = g();
  205098. if (!a4.S.Ya() && (e3 || !m && !a4.S.qa())) {
  205099. var k2 = a4.u.G(c14);
  205100. if (l2) {
  205101. var q3 = p2 ? k2.v() : k2, z = t;
  205102. t = f3;
  205103. z !== f3 ? e3 && (a4.a.Na(q3, f3, true), a4.a.Na(q3, z, false)) : a4.a.Na(q3, f3, e3);
  205104. p2 && a4.Za(k2) && k2(q3);
  205105. } else
  205106. h && (f3 === n2 ? f3 = e3 : e3 || (f3 = n2)), a4.m.eb(
  205107. k2,
  205108. d,
  205109. "checked",
  205110. f3,
  205111. true
  205112. );
  205113. }
  205114. }
  205115. function f2() {
  205116. var d2 = a4.a.f(c14()), e3 = g();
  205117. l2 ? (b.checked = 0 <= a4.a.A(d2, e3), t = e3) : b.checked = h && e3 === n2 ? !!d2 : g() === d2;
  205118. }
  205119. var g = a4.xb(function() {
  205120. if (d.has("checkedValue"))
  205121. return a4.a.f(d.get("checkedValue"));
  205122. if (q)
  205123. return d.has("value") ? a4.a.f(d.get("value")) : b.value;
  205124. }), h = "checkbox" == b.type, m = "radio" == b.type;
  205125. if (h || m) {
  205126. var k = c14(), l2 = h && a4.a.f(k) instanceof Array, p2 = !(l2 && k.push && k.splice), q = m || l2, t = l2 ? g() : n2;
  205127. m && !b.name && a4.c.uniqueName.init(b, function() {
  205128. return true;
  205129. });
  205130. a4.o(e2, null, { l: b });
  205131. a4.a.B(b, "click", e2);
  205132. a4.o(f2, null, { l: b });
  205133. k = n2;
  205134. }
  205135. } };
  205136. a4.m.wa.checked = true;
  205137. a4.c.checkedValue = { update: function(b, c14) {
  205138. b.value = a4.a.f(c14());
  205139. } };
  205140. })();
  205141. a4.c["class"] = { update: function(b, c14) {
  205142. var d = a4.a.Db(a4.a.f(c14()));
  205143. a4.a.Eb(b, b.__ko__cssValue, false);
  205144. b.__ko__cssValue = d;
  205145. a4.a.Eb(b, d, true);
  205146. } };
  205147. a4.c.css = { update: function(b, c14) {
  205148. var d = a4.a.f(c14());
  205149. null !== d && "object" == typeof d ? a4.a.P(d, function(c15, d2) {
  205150. d2 = a4.a.f(d2);
  205151. a4.a.Eb(b, c15, d2);
  205152. }) : a4.c["class"].update(b, c14);
  205153. } };
  205154. a4.c.enable = { update: function(b, c14) {
  205155. var d = a4.a.f(c14());
  205156. d && b.disabled ? b.removeAttribute("disabled") : d || b.disabled || (b.disabled = true);
  205157. } };
  205158. a4.c.disable = { update: function(b, c14) {
  205159. a4.c.enable.update(b, function() {
  205160. return !a4.a.f(c14());
  205161. });
  205162. } };
  205163. a4.c.event = { init: function(b, c14, d, e2, f2) {
  205164. var g = c14() || {};
  205165. a4.a.P(g, function(g2) {
  205166. "string" == typeof g2 && a4.a.B(b, g2, function(b2) {
  205167. var k, l2 = c14()[g2];
  205168. if (l2) {
  205169. try {
  205170. var p2 = a4.a.la(arguments);
  205171. e2 = f2.$data;
  205172. p2.unshift(e2);
  205173. k = l2.apply(e2, p2);
  205174. } finally {
  205175. true !== k && (b2.preventDefault ? b2.preventDefault() : b2.returnValue = false);
  205176. }
  205177. false === d.get(g2 + "Bubble") && (b2.cancelBubble = true, b2.stopPropagation && b2.stopPropagation());
  205178. }
  205179. });
  205180. });
  205181. } };
  205182. a4.c.foreach = { Rc: function(b) {
  205183. return function() {
  205184. var c14 = b(), d = a4.a.bc(c14);
  205185. if (!d || "number" == typeof d.length)
  205186. return { foreach: c14, templateEngine: a4.ba.Ma };
  205187. a4.a.f(c14);
  205188. return { foreach: d.data, as: d.as, noChildContext: d.noChildContext, includeDestroyed: d.includeDestroyed, afterAdd: d.afterAdd, beforeRemove: d.beforeRemove, afterRender: d.afterRender, beforeMove: d.beforeMove, afterMove: d.afterMove, templateEngine: a4.ba.Ma };
  205189. };
  205190. }, init: function(b, c14) {
  205191. return a4.c.template.init(b, a4.c.foreach.Rc(c14));
  205192. }, update: function(b, c14, d, e2, f2) {
  205193. return a4.c.template.update(b, a4.c.foreach.Rc(c14), d, e2, f2);
  205194. } };
  205195. a4.m.Ra.foreach = false;
  205196. a4.h.ea.foreach = true;
  205197. a4.c.hasfocus = { init: function(b, c14, d) {
  205198. function e2(e3) {
  205199. b.__ko_hasfocusUpdating = true;
  205200. var f3 = b.ownerDocument;
  205201. if ("activeElement" in f3) {
  205202. var g2;
  205203. try {
  205204. g2 = f3.activeElement;
  205205. } catch (l2) {
  205206. g2 = f3.body;
  205207. }
  205208. e3 = g2 === b;
  205209. }
  205210. f3 = c14();
  205211. a4.m.eb(f3, d, "hasfocus", e3, true);
  205212. b.__ko_hasfocusLastValue = e3;
  205213. b.__ko_hasfocusUpdating = false;
  205214. }
  205215. var f2 = e2.bind(null, true), g = e2.bind(null, false);
  205216. a4.a.B(b, "focus", f2);
  205217. a4.a.B(b, "focusin", f2);
  205218. a4.a.B(b, "blur", g);
  205219. a4.a.B(b, "focusout", g);
  205220. b.__ko_hasfocusLastValue = false;
  205221. }, update: function(b, c14) {
  205222. var d = !!a4.a.f(c14());
  205223. b.__ko_hasfocusUpdating || b.__ko_hasfocusLastValue === d || (d ? b.focus() : b.blur(), !d && b.__ko_hasfocusLastValue && b.ownerDocument.body.focus(), a4.u.G(a4.a.Fb, null, [b, d ? "focusin" : "focusout"]));
  205224. } };
  205225. a4.m.wa.hasfocus = true;
  205226. a4.c.hasFocus = a4.c.hasfocus;
  205227. a4.m.wa.hasFocus = "hasfocus";
  205228. a4.c.html = { init: function() {
  205229. return { controlsDescendantBindings: true };
  205230. }, update: function(b, c14) {
  205231. a4.a.fc(b, c14());
  205232. } };
  205233. (function() {
  205234. function b(b2, d, e2) {
  205235. a4.c[b2] = { init: function(b3, c14, h, m, k) {
  205236. var l2, p2, q = {}, t, x, n3;
  205237. if (d) {
  205238. m = h.get("as");
  205239. var u3 = h.get("noChildContext");
  205240. n3 = !(m && u3);
  205241. q = { as: m, noChildContext: u3, exportDependencies: n3 };
  205242. }
  205243. x = (t = "render" == h.get("completeOn")) || h.has(a4.i.pa);
  205244. a4.o(function() {
  205245. var h2 = a4.a.f(c14()), m2 = !e2 !== !h2, u4 = !p2, r3;
  205246. if (n3 || m2 !== l2) {
  205247. x && (k = a4.i.Cb(b3, k));
  205248. if (m2) {
  205249. if (!d || n3)
  205250. q.dataDependency = a4.S.o();
  205251. r3 = d ? k.createChildContext("function" == typeof h2 ? h2 : c14, q) : a4.S.qa() ? k.extend(null, q) : k;
  205252. }
  205253. u4 && a4.S.qa() && (p2 = a4.a.Ca(a4.h.childNodes(b3), true));
  205254. m2 ? (u4 || a4.h.va(b3, a4.a.Ca(p2)), a4.Oa(r3, b3)) : (a4.h.Ea(b3), t || a4.i.ma(b3, a4.i.H));
  205255. l2 = m2;
  205256. }
  205257. }, null, { l: b3 });
  205258. return { controlsDescendantBindings: true };
  205259. } };
  205260. a4.m.Ra[b2] = false;
  205261. a4.h.ea[b2] = true;
  205262. }
  205263. b("if");
  205264. b("ifnot", false, true);
  205265. b("with", true);
  205266. })();
  205267. a4.c.let = { init: function(b, c14, d, e2, f2) {
  205268. c14 = f2.extend(c14);
  205269. a4.Oa(c14, b);
  205270. return { controlsDescendantBindings: true };
  205271. } };
  205272. a4.h.ea.let = true;
  205273. var Q = {};
  205274. a4.c.options = { init: function(b) {
  205275. if ("select" !== a4.a.R(b))
  205276. throw Error("options binding applies only to SELECT elements");
  205277. for (; 0 < b.length; )
  205278. b.remove(0);
  205279. return { controlsDescendantBindings: true };
  205280. }, update: function(b, c14, d) {
  205281. function e2() {
  205282. return a4.a.jb(b.options, function(a5) {
  205283. return a5.selected;
  205284. });
  205285. }
  205286. function f2(a5, b2, c15) {
  205287. var d2 = typeof b2;
  205288. return "function" == d2 ? b2(a5) : "string" == d2 ? a5[b2] : c15;
  205289. }
  205290. function g(c15, d2) {
  205291. if (x && l2)
  205292. a4.i.ma(b, a4.i.H);
  205293. else if (t.length) {
  205294. var e3 = 0 <= a4.a.A(t, a4.w.M(d2[0]));
  205295. a4.a.Zc(d2[0], e3);
  205296. x && !e3 && a4.u.G(a4.a.Fb, null, [b, "change"]);
  205297. }
  205298. }
  205299. var h = b.multiple, m = 0 != b.length && h ? b.scrollTop : null, k = a4.a.f(c14()), l2 = d.get("valueAllowUnset") && d.has("value"), p2 = d.get("optionsIncludeDestroyed");
  205300. c14 = {};
  205301. var q, t = [];
  205302. l2 || (h ? t = a4.a.Mb(e2(), a4.w.M) : 0 <= b.selectedIndex && t.push(a4.w.M(b.options[b.selectedIndex])));
  205303. k && ("undefined" == typeof k.length && (k = [k]), q = a4.a.jb(k, function(b2) {
  205304. return p2 || b2 === n2 || null === b2 || !a4.a.f(b2._destroy);
  205305. }), d.has("optionsCaption") && (k = a4.a.f(d.get("optionsCaption")), null !== k && k !== n2 && q.unshift(Q)));
  205306. var x = false;
  205307. c14.beforeRemove = function(a5) {
  205308. b.removeChild(a5);
  205309. };
  205310. k = g;
  205311. d.has("optionsAfterRender") && "function" == typeof d.get("optionsAfterRender") && (k = function(b2, c15) {
  205312. g(0, c15);
  205313. a4.u.G(d.get("optionsAfterRender"), null, [c15[0], b2 !== Q ? b2 : n2]);
  205314. });
  205315. a4.a.ec(b, q, function(c15, e3, g2) {
  205316. g2.length && (t = !l2 && g2[0].selected ? [a4.w.M(g2[0])] : [], x = true);
  205317. e3 = b.ownerDocument.createElement("option");
  205318. c15 === Q ? (a4.a.Bb(e3, d.get("optionsCaption")), a4.w.cb(e3, n2)) : (g2 = f2(c15, d.get("optionsValue"), c15), a4.w.cb(e3, a4.a.f(g2)), c15 = f2(c15, d.get("optionsText"), g2), a4.a.Bb(e3, c15));
  205319. return [e3];
  205320. }, c14, k);
  205321. if (!l2) {
  205322. var B;
  205323. h ? B = t.length && e2().length < t.length : B = t.length && 0 <= b.selectedIndex ? a4.w.M(b.options[b.selectedIndex]) !== t[0] : t.length || 0 <= b.selectedIndex;
  205324. B && a4.u.G(a4.a.Fb, null, [b, "change"]);
  205325. }
  205326. (l2 || a4.S.Ya()) && a4.i.ma(b, a4.i.H);
  205327. a4.a.wd(b);
  205328. m && 20 < Math.abs(m - b.scrollTop) && (b.scrollTop = m);
  205329. } };
  205330. a4.c.options.$b = a4.a.g.Z();
  205331. a4.c.selectedOptions = { init: function(b, c14, d) {
  205332. function e2() {
  205333. var e3 = c14(), f3 = [];
  205334. a4.a.D(b.getElementsByTagName("option"), function(b2) {
  205335. b2.selected && f3.push(a4.w.M(b2));
  205336. });
  205337. a4.m.eb(
  205338. e3,
  205339. d,
  205340. "selectedOptions",
  205341. f3
  205342. );
  205343. }
  205344. function f2() {
  205345. var d2 = a4.a.f(c14()), e3 = b.scrollTop;
  205346. d2 && "number" == typeof d2.length && a4.a.D(b.getElementsByTagName("option"), function(b2) {
  205347. var c15 = 0 <= a4.a.A(d2, a4.w.M(b2));
  205348. b2.selected != c15 && a4.a.Zc(b2, c15);
  205349. });
  205350. b.scrollTop = e3;
  205351. }
  205352. if ("select" != a4.a.R(b))
  205353. throw Error("selectedOptions binding applies only to SELECT elements");
  205354. var g;
  205355. a4.i.subscribe(b, a4.i.H, function() {
  205356. g ? e2() : (a4.a.B(b, "change", e2), g = a4.o(f2, null, { l: b }));
  205357. }, null, { notifyImmediately: true });
  205358. }, update: function() {
  205359. } };
  205360. a4.m.wa.selectedOptions = true;
  205361. a4.c.style = { update: function(b, c14) {
  205362. var d = a4.a.f(c14() || {});
  205363. a4.a.P(d, function(c15, d2) {
  205364. d2 = a4.a.f(d2);
  205365. if (null === d2 || d2 === n2 || false === d2)
  205366. d2 = "";
  205367. if (v7)
  205368. v7(b).css(c15, d2);
  205369. else if (/^--/.test(c15))
  205370. b.style.setProperty(c15, d2);
  205371. else {
  205372. c15 = c15.replace(/-(\w)/g, function(a5, b2) {
  205373. return b2.toUpperCase();
  205374. });
  205375. var g = b.style[c15];
  205376. b.style[c15] = d2;
  205377. d2 === g || b.style[c15] != g || isNaN(d2) || (b.style[c15] = d2 + "px");
  205378. }
  205379. });
  205380. } };
  205381. a4.c.submit = { init: function(b, c14, d, e2, f2) {
  205382. if ("function" != typeof c14())
  205383. throw Error("The value for a submit binding must be a function");
  205384. a4.a.B(b, "submit", function(a5) {
  205385. var d2, e3 = c14();
  205386. try {
  205387. d2 = e3.call(f2.$data, b);
  205388. } finally {
  205389. true !== d2 && (a5.preventDefault ? a5.preventDefault() : a5.returnValue = false);
  205390. }
  205391. });
  205392. } };
  205393. a4.c.text = { init: function() {
  205394. return { controlsDescendantBindings: true };
  205395. }, update: function(b, c14) {
  205396. a4.a.Bb(b, c14());
  205397. } };
  205398. a4.h.ea.text = true;
  205399. (function() {
  205400. if (A && A.navigator) {
  205401. var b = function(a5) {
  205402. if (a5)
  205403. return parseFloat(a5[1]);
  205404. }, c14 = A.navigator.userAgent, d, e2, f2, g, h;
  205405. (d = A.opera && A.opera.version && parseInt(A.opera.version())) || (h = b(c14.match(/Edge\/([^ ]+)$/))) || b(c14.match(/Chrome\/([^ ]+)/)) || (e2 = b(c14.match(/Version\/([^ ]+) Safari/))) || (f2 = b(c14.match(/Firefox\/([^ ]+)/))) || (g = a4.a.W || b(c14.match(/MSIE ([^ ]+)/))) || (g = b(c14.match(/rv:([^ )]+)/)));
  205406. }
  205407. if (8 <= g && 10 > g)
  205408. var m = a4.a.g.Z(), k = a4.a.g.Z(), l2 = function(b2) {
  205409. var c15 = this.activeElement;
  205410. (c15 = c15 && a4.a.g.get(c15, k)) && c15(b2);
  205411. }, p2 = function(b2, c15) {
  205412. var d2 = b2.ownerDocument;
  205413. a4.a.g.get(d2, m) || (a4.a.g.set(d2, m, true), a4.a.B(d2, "selectionchange", l2));
  205414. a4.a.g.set(b2, k, c15);
  205415. };
  205416. a4.c.textInput = { init: function(b2, c15, k2) {
  205417. function l3(c16, d2) {
  205418. a4.a.B(b2, c16, d2);
  205419. }
  205420. function m2() {
  205421. var d2 = a4.a.f(c15());
  205422. if (null === d2 || d2 === n2)
  205423. d2 = "";
  205424. L !== n2 && d2 === L ? a4.a.setTimeout(m2, 4) : b2.value !== d2 && (y = true, b2.value = d2, y = false, v8 = b2.value);
  205425. }
  205426. function r3() {
  205427. w2 || (L = b2.value, w2 = a4.a.setTimeout(
  205428. z,
  205429. 4
  205430. ));
  205431. }
  205432. function z() {
  205433. clearTimeout(w2);
  205434. L = w2 = n2;
  205435. var d2 = b2.value;
  205436. v8 !== d2 && (v8 = d2, a4.m.eb(c15(), k2, "textInput", d2));
  205437. }
  205438. var v8 = b2.value, w2, L, A2 = 9 == a4.a.W ? r3 : z, y = false;
  205439. g && l3("keypress", z);
  205440. 11 > g && l3("propertychange", function(a5) {
  205441. y || "value" !== a5.propertyName || A2(a5);
  205442. });
  205443. 8 == g && (l3("keyup", z), l3("keydown", z));
  205444. p2 && (p2(b2, A2), l3("dragend", r3));
  205445. (!g || 9 <= g) && l3("input", A2);
  205446. 5 > e2 && "textarea" === a4.a.R(b2) ? (l3("keydown", r3), l3("paste", r3), l3("cut", r3)) : 11 > d ? l3("keydown", r3) : 4 > f2 ? (l3("DOMAutoComplete", z), l3("dragdrop", z), l3("drop", z)) : h && "number" === b2.type && l3("keydown", r3);
  205447. l3(
  205448. "change",
  205449. z
  205450. );
  205451. l3("blur", z);
  205452. a4.o(m2, null, { l: b2 });
  205453. } };
  205454. a4.m.wa.textInput = true;
  205455. a4.c.textinput = { preprocess: function(a5, b2, c15) {
  205456. c15("textInput", a5);
  205457. } };
  205458. })();
  205459. a4.c.uniqueName = { init: function(b, c14) {
  205460. if (c14()) {
  205461. var d = "ko_unique_" + ++a4.c.uniqueName.rd;
  205462. a4.a.Yc(b, d);
  205463. }
  205464. } };
  205465. a4.c.uniqueName.rd = 0;
  205466. a4.c.using = { init: function(b, c14, d, e2, f2) {
  205467. var g;
  205468. d.has("as") && (g = { as: d.get("as"), noChildContext: d.get("noChildContext") });
  205469. c14 = f2.createChildContext(c14, g);
  205470. a4.Oa(c14, b);
  205471. return { controlsDescendantBindings: true };
  205472. } };
  205473. a4.h.ea.using = true;
  205474. a4.c.value = { init: function(b, c14, d) {
  205475. var e2 = a4.a.R(b), f2 = "input" == e2;
  205476. if (!f2 || "checkbox" != b.type && "radio" != b.type) {
  205477. var g = [], h = d.get("valueUpdate"), m = false, k = null;
  205478. h && ("string" == typeof h ? g = [h] : g = a4.a.wc(h), a4.a.Pa(g, "change"));
  205479. var l2 = function() {
  205480. k = null;
  205481. m = false;
  205482. var e3 = c14(), f3 = a4.w.M(b);
  205483. a4.m.eb(e3, d, "value", f3);
  205484. };
  205485. !a4.a.W || !f2 || "text" != b.type || "off" == b.autocomplete || b.form && "off" == b.form.autocomplete || -1 != a4.a.A(g, "propertychange") || (a4.a.B(b, "propertychange", function() {
  205486. m = true;
  205487. }), a4.a.B(b, "focus", function() {
  205488. m = false;
  205489. }), a4.a.B(b, "blur", function() {
  205490. m && l2();
  205491. }));
  205492. a4.a.D(g, function(c15) {
  205493. var d2 = l2;
  205494. a4.a.Ud(c15, "after") && (d2 = function() {
  205495. k = a4.w.M(b);
  205496. a4.a.setTimeout(l2, 0);
  205497. }, c15 = c15.substring(5));
  205498. a4.a.B(b, c15, d2);
  205499. });
  205500. var p2;
  205501. p2 = f2 && "file" == b.type ? function() {
  205502. var d2 = a4.a.f(c14());
  205503. null === d2 || d2 === n2 || "" === d2 ? b.value = "" : a4.u.G(l2);
  205504. } : function() {
  205505. var f3 = a4.a.f(c14()), g2 = a4.w.M(b);
  205506. if (null !== k && f3 === k)
  205507. a4.a.setTimeout(p2, 0);
  205508. else if (f3 !== g2 || g2 === n2)
  205509. "select" === e2 ? (g2 = d.get("valueAllowUnset"), a4.w.cb(b, f3, g2), g2 || f3 === a4.w.M(b) || a4.u.G(l2)) : a4.w.cb(b, f3);
  205510. };
  205511. if ("select" === e2) {
  205512. var q;
  205513. a4.i.subscribe(
  205514. b,
  205515. a4.i.H,
  205516. function() {
  205517. q ? d.get("valueAllowUnset") ? p2() : l2() : (a4.a.B(b, "change", l2), q = a4.o(p2, null, { l: b }));
  205518. },
  205519. null,
  205520. { notifyImmediately: true }
  205521. );
  205522. } else
  205523. a4.a.B(b, "change", l2), a4.o(p2, null, { l: b });
  205524. } else
  205525. a4.ib(b, { checkedValue: c14 });
  205526. }, update: function() {
  205527. } };
  205528. a4.m.wa.value = true;
  205529. a4.c.visible = { update: function(b, c14) {
  205530. var d = a4.a.f(c14()), e2 = "none" != b.style.display;
  205531. d && !e2 ? b.style.display = "" : !d && e2 && (b.style.display = "none");
  205532. } };
  205533. a4.c.hidden = { update: function(b, c14) {
  205534. a4.c.visible.update(b, function() {
  205535. return !a4.a.f(c14());
  205536. });
  205537. } };
  205538. (function(b) {
  205539. a4.c[b] = { init: function(c14, d, e2, f2, g) {
  205540. return a4.c.event.init.call(this, c14, function() {
  205541. var a5 = {};
  205542. a5[b] = d();
  205543. return a5;
  205544. }, e2, f2, g);
  205545. } };
  205546. })("click");
  205547. a4.ca = function() {
  205548. };
  205549. a4.ca.prototype.renderTemplateSource = function() {
  205550. throw Error("Override renderTemplateSource");
  205551. };
  205552. a4.ca.prototype.createJavaScriptEvaluatorBlock = function() {
  205553. throw Error("Override createJavaScriptEvaluatorBlock");
  205554. };
  205555. a4.ca.prototype.makeTemplateSource = function(b, c14) {
  205556. if ("string" == typeof b) {
  205557. c14 = c14 || w;
  205558. var d = c14.getElementById(b);
  205559. if (!d)
  205560. throw Error("Cannot find template with ID " + b);
  205561. return new a4.C.F(d);
  205562. }
  205563. if (1 == b.nodeType || 8 == b.nodeType)
  205564. return new a4.C.ia(b);
  205565. throw Error("Unknown template type: " + b);
  205566. };
  205567. a4.ca.prototype.renderTemplate = function(a5, c14, d, e2) {
  205568. a5 = this.makeTemplateSource(a5, e2);
  205569. return this.renderTemplateSource(a5, c14, d, e2);
  205570. };
  205571. a4.ca.prototype.isTemplateRewritten = function(a5, c14) {
  205572. return false === this.allowTemplateRewriting ? true : this.makeTemplateSource(a5, c14).data("isRewritten");
  205573. };
  205574. a4.ca.prototype.rewriteTemplate = function(a5, c14, d) {
  205575. a5 = this.makeTemplateSource(a5, d);
  205576. c14 = c14(a5.text());
  205577. a5.text(c14);
  205578. a5.data("isRewritten", true);
  205579. };
  205580. a4.b("templateEngine", a4.ca);
  205581. a4.kc = function() {
  205582. function b(b2, c15, d2, h) {
  205583. b2 = a4.m.ac(b2);
  205584. for (var m = a4.m.Ra, k = 0; k < b2.length; k++) {
  205585. var l2 = b2[k].key;
  205586. if (Object.prototype.hasOwnProperty.call(
  205587. m,
  205588. l2
  205589. )) {
  205590. var p2 = m[l2];
  205591. if ("function" === typeof p2) {
  205592. if (l2 = p2(b2[k].value))
  205593. throw Error(l2);
  205594. } else if (!p2)
  205595. throw Error("This template engine does not support the '" + l2 + "' binding within its templates");
  205596. }
  205597. }
  205598. d2 = "ko.__tr_ambtns(function($context,$element){return(function(){return{ " + a4.m.vb(b2, { valueAccessors: true }) + " } })()},'" + d2.toLowerCase() + "')";
  205599. return h.createJavaScriptEvaluatorBlock(d2) + c15;
  205600. }
  205601. var c14 = /(<([a-z]+\d*)(?:\s+(?!data-bind\s*=\s*)[a-z0-9\-]+(?:=(?:\"[^\"]*\"|\'[^\']*\'|[^>]*))?)*\s+)data-bind\s*=\s*(["'])([\s\S]*?)\3/gi, d = /\x3c!--\s*ko\b\s*([\s\S]*?)\s*--\x3e/g;
  205602. return { xd: function(b2, c15, d2) {
  205603. c15.isTemplateRewritten(b2, d2) || c15.rewriteTemplate(b2, function(b3) {
  205604. return a4.kc.Ld(b3, c15);
  205605. }, d2);
  205606. }, Ld: function(a5, f2) {
  205607. return a5.replace(c14, function(a6, c15, d2, e2, l2) {
  205608. return b(l2, c15, d2, f2);
  205609. }).replace(d, function(a6, c15) {
  205610. return b(c15, "<!-- ko -->", "#comment", f2);
  205611. });
  205612. }, md: function(b2, c15) {
  205613. return a4.aa.Xb(function(d2, h) {
  205614. var m = d2.nextSibling;
  205615. m && m.nodeName.toLowerCase() === c15 && a4.ib(m, b2, h);
  205616. });
  205617. } };
  205618. }();
  205619. a4.b("__tr_ambtns", a4.kc.md);
  205620. (function() {
  205621. a4.C = {};
  205622. a4.C.F = function(b2) {
  205623. if (this.F = b2) {
  205624. var c15 = a4.a.R(b2);
  205625. this.ab = "script" === c15 ? 1 : "textarea" === c15 ? 2 : "template" == c15 && b2.content && 11 === b2.content.nodeType ? 3 : 4;
  205626. }
  205627. };
  205628. a4.C.F.prototype.text = function() {
  205629. var b2 = 1 === this.ab ? "text" : 2 === this.ab ? "value" : "innerHTML";
  205630. if (0 == arguments.length)
  205631. return this.F[b2];
  205632. var c15 = arguments[0];
  205633. "innerHTML" === b2 ? a4.a.fc(this.F, c15) : this.F[b2] = c15;
  205634. };
  205635. var b = a4.a.g.Z() + "_";
  205636. a4.C.F.prototype.data = function(c15) {
  205637. if (1 === arguments.length)
  205638. return a4.a.g.get(this.F, b + c15);
  205639. a4.a.g.set(this.F, b + c15, arguments[1]);
  205640. };
  205641. var c14 = a4.a.g.Z();
  205642. a4.C.F.prototype.nodes = function() {
  205643. var b2 = this.F;
  205644. if (0 == arguments.length) {
  205645. var e2 = a4.a.g.get(b2, c14) || {}, f2 = e2.lb || (3 === this.ab ? b2.content : 4 === this.ab ? b2 : n2);
  205646. if (!f2 || e2.jd) {
  205647. var g = this.text();
  205648. g && g !== e2.bb && (f2 = a4.a.Md(g, b2.ownerDocument), a4.a.g.set(b2, c14, { lb: f2, bb: g, jd: true }));
  205649. }
  205650. return f2;
  205651. }
  205652. e2 = arguments[0];
  205653. this.ab !== n2 && this.text("");
  205654. a4.a.g.set(b2, c14, { lb: e2 });
  205655. };
  205656. a4.C.ia = function(a5) {
  205657. this.F = a5;
  205658. };
  205659. a4.C.ia.prototype = new a4.C.F();
  205660. a4.C.ia.prototype.constructor = a4.C.ia;
  205661. a4.C.ia.prototype.text = function() {
  205662. if (0 == arguments.length) {
  205663. var b2 = a4.a.g.get(this.F, c14) || {};
  205664. b2.bb === n2 && b2.lb && (b2.bb = b2.lb.innerHTML);
  205665. return b2.bb;
  205666. }
  205667. a4.a.g.set(
  205668. this.F,
  205669. c14,
  205670. { bb: arguments[0] }
  205671. );
  205672. };
  205673. a4.b("templateSources", a4.C);
  205674. a4.b("templateSources.domElement", a4.C.F);
  205675. a4.b("templateSources.anonymousTemplate", a4.C.ia);
  205676. })();
  205677. (function() {
  205678. function b(b2, c15, d2) {
  205679. var e3;
  205680. for (c15 = a4.h.nextSibling(c15); b2 && (e3 = b2) !== c15; )
  205681. b2 = a4.h.nextSibling(e3), d2(e3, b2);
  205682. }
  205683. function c14(c15, d2) {
  205684. if (c15.length) {
  205685. var e3 = c15[0], f3 = c15[c15.length - 1], g2 = e3.parentNode, h2 = a4.ga.instance, m2 = h2.preprocessNode;
  205686. if (m2) {
  205687. b(e3, f3, function(a5, b2) {
  205688. var c16 = a5.previousSibling, d3 = m2.call(h2, a5);
  205689. d3 && (a5 === e3 && (e3 = d3[0] || b2), a5 === f3 && (f3 = d3[d3.length - 1] || c16));
  205690. });
  205691. c15.length = 0;
  205692. if (!e3)
  205693. return;
  205694. e3 === f3 ? c15.push(e3) : (c15.push(e3, f3), a4.a.Ua(c15, g2));
  205695. }
  205696. b(e3, f3, function(b2) {
  205697. 1 !== b2.nodeType && 8 !== b2.nodeType || a4.vc(d2, b2);
  205698. });
  205699. b(e3, f3, function(b2) {
  205700. 1 !== b2.nodeType && 8 !== b2.nodeType || a4.aa.cd(b2, [d2]);
  205701. });
  205702. a4.a.Ua(c15, g2);
  205703. }
  205704. }
  205705. function d(a5) {
  205706. return a5.nodeType ? a5 : 0 < a5.length ? a5[0] : null;
  205707. }
  205708. function e2(b2, e3, f3, h2, m2) {
  205709. m2 = m2 || {};
  205710. var n3 = (b2 && d(b2) || f3 || {}).ownerDocument, B = m2.templateEngine || g;
  205711. a4.kc.xd(f3, B, n3);
  205712. f3 = B.renderTemplate(f3, h2, m2, n3);
  205713. if ("number" != typeof f3.length || 0 < f3.length && "number" != typeof f3[0].nodeType)
  205714. throw Error("Template engine must return an array of DOM nodes");
  205715. n3 = false;
  205716. switch (e3) {
  205717. case "replaceChildren":
  205718. a4.h.va(
  205719. b2,
  205720. f3
  205721. );
  205722. n3 = true;
  205723. break;
  205724. case "replaceNode":
  205725. a4.a.Xc(b2, f3);
  205726. n3 = true;
  205727. break;
  205728. case "ignoreTargetNode":
  205729. break;
  205730. default:
  205731. throw Error("Unknown renderMode: " + e3);
  205732. }
  205733. n3 && (c14(f3, h2), m2.afterRender && a4.u.G(m2.afterRender, null, [f3, h2[m2.as || "$data"]]), "replaceChildren" == e3 && a4.i.ma(b2, a4.i.H));
  205734. return f3;
  205735. }
  205736. function f2(b2, c15, d2) {
  205737. return a4.O(b2) ? b2() : "function" === typeof b2 ? b2(c15, d2) : b2;
  205738. }
  205739. var g;
  205740. a4.gc = function(b2) {
  205741. if (b2 != n2 && !(b2 instanceof a4.ca))
  205742. throw Error("templateEngine must inherit from ko.templateEngine");
  205743. g = b2;
  205744. };
  205745. a4.dc = function(b2, c15, h2, m2, t) {
  205746. h2 = h2 || {};
  205747. if ((h2.templateEngine || g) == n2)
  205748. throw Error("Set a template engine before calling renderTemplate");
  205749. t = t || "replaceChildren";
  205750. if (m2) {
  205751. var x = d(m2);
  205752. return a4.$(function() {
  205753. var g2 = c15 && c15 instanceof a4.fa ? c15 : new a4.fa(c15, null, null, null, { exportDependencies: true }), n3 = f2(b2, g2.$data, g2), g2 = e2(m2, t, n3, g2, h2);
  205754. "replaceNode" == t && (m2 = g2, x = d(m2));
  205755. }, null, { Sa: function() {
  205756. return !x || !a4.a.Sb(x);
  205757. }, l: x && "replaceNode" == t ? x.parentNode : x });
  205758. }
  205759. return a4.aa.Xb(function(d2) {
  205760. a4.dc(b2, c15, h2, d2, "replaceNode");
  205761. });
  205762. };
  205763. a4.Qd = function(b2, d2, g2, h2, m2) {
  205764. function x(b3, c15) {
  205765. a4.u.G(a4.a.ec, null, [h2, b3, u3, g2, r3, c15]);
  205766. a4.i.ma(h2, a4.i.H);
  205767. }
  205768. function r3(a5, b3) {
  205769. c14(b3, v8);
  205770. g2.afterRender && g2.afterRender(b3, a5);
  205771. v8 = null;
  205772. }
  205773. function u3(a5, c15) {
  205774. v8 = m2.createChildContext(a5, { as: z, noChildContext: g2.noChildContext, extend: function(a6) {
  205775. a6.$index = c15;
  205776. z && (a6[z + "Index"] = c15);
  205777. } });
  205778. var d3 = f2(b2, a5, v8);
  205779. return e2(h2, "ignoreTargetNode", d3, v8, g2);
  205780. }
  205781. var v8, z = g2.as, w2 = false === g2.includeDestroyed || a4.options.foreachHidesDestroyed && !g2.includeDestroyed;
  205782. if (w2 || g2.beforeRemove || !a4.Pc(d2))
  205783. return a4.$(function() {
  205784. var b3 = a4.a.f(d2) || [];
  205785. "undefined" == typeof b3.length && (b3 = [b3]);
  205786. w2 && (b3 = a4.a.jb(b3, function(b4) {
  205787. return b4 === n2 || null === b4 || !a4.a.f(b4._destroy);
  205788. }));
  205789. x(b3);
  205790. }, null, { l: h2 });
  205791. x(d2.v());
  205792. var A2 = d2.subscribe(function(a5) {
  205793. x(d2(), a5);
  205794. }, null, "arrayChange");
  205795. A2.l(h2);
  205796. return A2;
  205797. };
  205798. var h = a4.a.g.Z(), m = a4.a.g.Z();
  205799. a4.c.template = { init: function(b2, c15) {
  205800. var d2 = a4.a.f(c15());
  205801. if ("string" == typeof d2 || "name" in d2)
  205802. a4.h.Ea(b2);
  205803. else if ("nodes" in d2) {
  205804. d2 = d2.nodes || [];
  205805. if (a4.O(d2))
  205806. throw Error('The "nodes" option must be a plain, non-observable array.');
  205807. var e3 = d2[0] && d2[0].parentNode;
  205808. e3 && a4.a.g.get(e3, m) || (e3 = a4.a.Yb(d2), a4.a.g.set(e3, m, true));
  205809. new a4.C.ia(b2).nodes(e3);
  205810. } else if (d2 = a4.h.childNodes(b2), 0 < d2.length)
  205811. e3 = a4.a.Yb(d2), new a4.C.ia(b2).nodes(e3);
  205812. else
  205813. throw Error("Anonymous template defined, but no template content was provided");
  205814. return { controlsDescendantBindings: true };
  205815. }, update: function(b2, c15, d2, e3, f3) {
  205816. var g2 = c15();
  205817. c15 = a4.a.f(g2);
  205818. d2 = true;
  205819. e3 = null;
  205820. "string" == typeof c15 ? c15 = {} : (g2 = "name" in c15 ? c15.name : b2, "if" in c15 && (d2 = a4.a.f(c15["if"])), d2 && "ifnot" in c15 && (d2 = !a4.a.f(c15.ifnot)), d2 && !g2 && (d2 = false));
  205821. "foreach" in c15 ? e3 = a4.Qd(g2, d2 && c15.foreach || [], c15, b2, f3) : d2 ? (d2 = f3, "data" in c15 && (d2 = f3.createChildContext(c15.data, { as: c15.as, noChildContext: c15.noChildContext, exportDependencies: true })), e3 = a4.dc(g2, d2, c15, b2)) : a4.h.Ea(b2);
  205822. f3 = e3;
  205823. (c15 = a4.a.g.get(b2, h)) && "function" == typeof c15.s && c15.s();
  205824. a4.a.g.set(b2, h, !f3 || f3.ja && !f3.ja() ? n2 : f3);
  205825. } };
  205826. a4.m.Ra.template = function(b2) {
  205827. b2 = a4.m.ac(b2);
  205828. return 1 == b2.length && b2[0].unknown || a4.m.Id(b2, "name") ? null : "This template engine does not support anonymous templates nested within its templates";
  205829. };
  205830. a4.h.ea.template = true;
  205831. })();
  205832. a4.b("setTemplateEngine", a4.gc);
  205833. a4.b("renderTemplate", a4.dc);
  205834. a4.a.Kc = function(a5, c14, d) {
  205835. if (a5.length && c14.length) {
  205836. var e2, f2, g, h, m;
  205837. for (e2 = f2 = 0; (!d || e2 < d) && (h = a5[f2]); ++f2) {
  205838. for (g = 0; m = c14[g]; ++g)
  205839. if (h.value === m.value) {
  205840. h.moved = m.index;
  205841. m.moved = h.index;
  205842. c14.splice(g, 1);
  205843. e2 = g = 0;
  205844. break;
  205845. }
  205846. e2 += g;
  205847. }
  205848. }
  205849. };
  205850. a4.a.Pb = function() {
  205851. function b(b2, d, e2, f2, g) {
  205852. var h = Math.min, m = Math.max, k = [], l2, p2 = b2.length, q, n3 = d.length, r3 = n3 - p2 || 1, v8 = p2 + n3 + 1, u3, w2, z;
  205853. for (l2 = 0; l2 <= p2; l2++)
  205854. for (w2 = u3, k.push(u3 = []), z = h(n3, l2 + r3), q = m(0, l2 - 1); q <= z; q++)
  205855. u3[q] = q ? l2 ? b2[l2 - 1] === d[q - 1] ? w2[q - 1] : h(w2[q] || v8, u3[q - 1] || v8) + 1 : q + 1 : l2 + 1;
  205856. h = [];
  205857. m = [];
  205858. r3 = [];
  205859. l2 = p2;
  205860. for (q = n3; l2 || q; )
  205861. n3 = k[l2][q] - 1, q && n3 === k[l2][q - 1] ? m.push(h[h.length] = { status: e2, value: d[--q], index: q }) : l2 && n3 === k[l2 - 1][q] ? r3.push(h[h.length] = { status: f2, value: b2[--l2], index: l2 }) : (--q, --l2, g.sparse || h.push({ status: "retained", value: d[q] }));
  205862. a4.a.Kc(r3, m, !g.dontLimitMoves && 10 * p2);
  205863. return h.reverse();
  205864. }
  205865. return function(a5, d, e2) {
  205866. e2 = "boolean" === typeof e2 ? { dontLimitMoves: e2 } : e2 || {};
  205867. a5 = a5 || [];
  205868. d = d || [];
  205869. return a5.length < d.length ? b(a5, d, "added", "deleted", e2) : b(d, a5, "deleted", "added", e2);
  205870. };
  205871. }();
  205872. a4.b("utils.compareArrays", a4.a.Pb);
  205873. (function() {
  205874. function b(b2, c15, d2, h, m) {
  205875. var k = [], l2 = a4.$(function() {
  205876. var l3 = c15(d2, m, a4.a.Ua(k, b2)) || [];
  205877. 0 < k.length && (a4.a.Xc(k, l3), h && a4.u.G(h, null, [d2, l3, m]));
  205878. k.length = 0;
  205879. a4.a.Nb(k, l3);
  205880. }, null, { l: b2, Sa: function() {
  205881. return !a4.a.kd(k);
  205882. } });
  205883. return { Y: k, $: l2.ja() ? l2 : n2 };
  205884. }
  205885. var c14 = a4.a.g.Z(), d = a4.a.g.Z();
  205886. a4.a.ec = function(e2, f2, g, h, m, k) {
  205887. function l2(b2) {
  205888. y = { Aa: b2, pb: a4.ta(w2++) };
  205889. v8.push(y);
  205890. r3 || F2.push(y);
  205891. }
  205892. function p2(b2) {
  205893. y = t[b2];
  205894. w2 !== y.pb.v() && D2.push(y);
  205895. y.pb(w2++);
  205896. a4.a.Ua(y.Y, e2);
  205897. v8.push(y);
  205898. }
  205899. function q(b2, c15) {
  205900. if (b2)
  205901. for (var d2 = 0, e3 = c15.length; d2 < e3; d2++)
  205902. a4.a.D(c15[d2].Y, function(a5) {
  205903. b2(a5, d2, c15[d2].Aa);
  205904. });
  205905. }
  205906. f2 = f2 || [];
  205907. "undefined" == typeof f2.length && (f2 = [f2]);
  205908. h = h || {};
  205909. var t = a4.a.g.get(e2, c14), r3 = !t, v8 = [], u3 = 0, w2 = 0, z = [], A2 = [], C2 = [], D2 = [], F2 = [], y, I2 = 0;
  205910. if (r3)
  205911. a4.a.D(f2, l2);
  205912. else {
  205913. if (!k || t && t._countWaitingForRemove) {
  205914. var E = a4.a.Mb(t, function(a5) {
  205915. return a5.Aa;
  205916. });
  205917. k = a4.a.Pb(E, f2, { dontLimitMoves: h.dontLimitMoves, sparse: true });
  205918. }
  205919. for (var E = 0, G2, H2, K2; G2 = k[E]; E++)
  205920. switch (H2 = G2.moved, K2 = G2.index, G2.status) {
  205921. case "deleted":
  205922. for (; u3 < K2; )
  205923. p2(u3++);
  205924. H2 === n2 && (y = t[u3], y.$ && (y.$.s(), y.$ = n2), a4.a.Ua(y.Y, e2).length && (h.beforeRemove && (v8.push(y), I2++, y.Aa === d ? y = null : C2.push(y)), y && z.push.apply(z, y.Y)));
  205925. u3++;
  205926. break;
  205927. case "added":
  205928. for (; w2 < K2; )
  205929. p2(u3++);
  205930. H2 !== n2 ? (A2.push(v8.length), p2(H2)) : l2(G2.value);
  205931. }
  205932. for (; w2 < f2.length; )
  205933. p2(u3++);
  205934. v8._countWaitingForRemove = I2;
  205935. }
  205936. a4.a.g.set(e2, c14, v8);
  205937. q(h.beforeMove, D2);
  205938. a4.a.D(
  205939. z,
  205940. h.beforeRemove ? a4.oa : a4.removeNode
  205941. );
  205942. var M, O, P;
  205943. try {
  205944. P = e2.ownerDocument.activeElement;
  205945. } catch (N2) {
  205946. }
  205947. if (A2.length)
  205948. for (; (E = A2.shift()) != n2; ) {
  205949. y = v8[E];
  205950. for (M = n2; E; )
  205951. if ((O = v8[--E].Y) && O.length) {
  205952. M = O[O.length - 1];
  205953. break;
  205954. }
  205955. for (f2 = 0; u3 = y.Y[f2]; M = u3, f2++)
  205956. a4.h.Wb(e2, u3, M);
  205957. }
  205958. for (E = 0; y = v8[E]; E++) {
  205959. y.Y || a4.a.extend(y, b(e2, g, y.Aa, m, y.pb));
  205960. for (f2 = 0; u3 = y.Y[f2]; M = u3, f2++)
  205961. a4.h.Wb(e2, u3, M);
  205962. !y.Ed && m && (m(y.Aa, y.Y, y.pb), y.Ed = true, M = y.Y[y.Y.length - 1]);
  205963. }
  205964. P && e2.ownerDocument.activeElement != P && P.focus();
  205965. q(h.beforeRemove, C2);
  205966. for (E = 0; E < C2.length; ++E)
  205967. C2[E].Aa = d;
  205968. q(h.afterMove, D2);
  205969. q(h.afterAdd, F2);
  205970. };
  205971. })();
  205972. a4.b("utils.setDomNodeChildrenFromArrayMapping", a4.a.ec);
  205973. a4.ba = function() {
  205974. this.allowTemplateRewriting = false;
  205975. };
  205976. a4.ba.prototype = new a4.ca();
  205977. a4.ba.prototype.constructor = a4.ba;
  205978. a4.ba.prototype.renderTemplateSource = function(b, c14, d, e2) {
  205979. if (c14 = (9 > a4.a.W ? 0 : b.nodes) ? b.nodes() : null)
  205980. return a4.a.la(c14.cloneNode(true).childNodes);
  205981. b = b.text();
  205982. return a4.a.ua(b, e2);
  205983. };
  205984. a4.ba.Ma = new a4.ba();
  205985. a4.gc(a4.ba.Ma);
  205986. a4.b("nativeTemplateEngine", a4.ba);
  205987. (function() {
  205988. a4.$a = function() {
  205989. var a5 = this.Hd = function() {
  205990. if (!v7 || !v7.tmpl)
  205991. return 0;
  205992. try {
  205993. if (0 <= v7.tmpl.tag.tmpl.open.toString().indexOf("__"))
  205994. return 2;
  205995. } catch (a6) {
  205996. }
  205997. return 1;
  205998. }();
  205999. this.renderTemplateSource = function(b2, e2, f2, g) {
  206000. g = g || w;
  206001. f2 = f2 || {};
  206002. if (2 > a5)
  206003. throw Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.");
  206004. var h = b2.data("precompiled");
  206005. h || (h = b2.text() || "", h = v7.template(null, "{{ko_with $item.koBindingContext}}" + h + "{{/ko_with}}"), b2.data("precompiled", h));
  206006. b2 = [e2.$data];
  206007. e2 = v7.extend({ koBindingContext: e2 }, f2.templateOptions);
  206008. e2 = v7.tmpl(h, b2, e2);
  206009. e2.appendTo(g.createElement("div"));
  206010. v7.fragments = {};
  206011. return e2;
  206012. };
  206013. this.createJavaScriptEvaluatorBlock = function(a6) {
  206014. return "{{ko_code ((function() { return " + a6 + " })()) }}";
  206015. };
  206016. this.addTemplate = function(a6, b2) {
  206017. w.write("<script type='text/html' id='" + a6 + "'>" + b2 + "<\/script>");
  206018. };
  206019. 0 < a5 && (v7.tmpl.tag.ko_code = { open: "__.push($1 || '');" }, v7.tmpl.tag.ko_with = { open: "with($1) {", close: "} " });
  206020. };
  206021. a4.$a.prototype = new a4.ca();
  206022. a4.$a.prototype.constructor = a4.$a;
  206023. var b = new a4.$a();
  206024. 0 < b.Hd && a4.gc(b);
  206025. a4.b("jqueryTmplTemplateEngine", a4.$a);
  206026. })();
  206027. });
  206028. })();
  206029. })();
  206030. })();
  206031. var knockout = ko;
  206032. if (typeof window !== "undefined") {
  206033. ko = window.ko;
  206034. if (typeof oldValue !== "undefined") {
  206035. window.ko = oldValue;
  206036. } else {
  206037. delete window.ko;
  206038. }
  206039. } else {
  206040. ko = global.ko;
  206041. if (typeof oldValue !== "undefined") {
  206042. global.ko = oldValue;
  206043. } else {
  206044. delete global.ko;
  206045. }
  206046. }
  206047. var knockout_3_5_1_default = knockout;
  206048. // node_modules/cesium/Source/ThirdParty/knockout-es5.js
  206049. var OBSERVABLES_PROPERTY = "__knockoutObservables";
  206050. var SUBSCRIBABLE_PROPERTY = "__knockoutSubscribable";
  206051. function track(obj, propertyNames) {
  206052. if (!obj) {
  206053. throw new Error("When calling ko.track, you must pass an object as the first parameter.");
  206054. }
  206055. var ko2 = this, allObservablesForObject = getAllObservablesForObject(obj, true);
  206056. propertyNames = propertyNames || Object.getOwnPropertyNames(obj);
  206057. propertyNames.forEach(function(propertyName) {
  206058. if (propertyName === OBSERVABLES_PROPERTY || propertyName === SUBSCRIBABLE_PROPERTY) {
  206059. return;
  206060. }
  206061. if (propertyName in allObservablesForObject) {
  206062. return;
  206063. }
  206064. var origValue = obj[propertyName], isArray = origValue instanceof Array, observable = ko2.isObservable(origValue) ? origValue : isArray ? ko2.observableArray(origValue) : ko2.observable(origValue);
  206065. Object.defineProperty(obj, propertyName, {
  206066. configurable: true,
  206067. enumerable: true,
  206068. get: observable,
  206069. set: ko2.isWriteableObservable(observable) ? observable : void 0
  206070. });
  206071. allObservablesForObject[propertyName] = observable;
  206072. if (isArray) {
  206073. notifyWhenPresentOrFutureArrayValuesMutate(ko2, observable);
  206074. }
  206075. });
  206076. return obj;
  206077. }
  206078. function getAllObservablesForObject(obj, createIfNotDefined) {
  206079. var result = obj[OBSERVABLES_PROPERTY];
  206080. if (!result && createIfNotDefined) {
  206081. result = {};
  206082. Object.defineProperty(obj, OBSERVABLES_PROPERTY, {
  206083. value: result
  206084. });
  206085. }
  206086. return result;
  206087. }
  206088. function defineComputedProperty(obj, propertyName, evaluatorOrOptions) {
  206089. var ko2 = this, computedOptions = { owner: obj, deferEvaluation: true };
  206090. if (typeof evaluatorOrOptions === "function") {
  206091. computedOptions.read = evaluatorOrOptions;
  206092. } else {
  206093. if ("value" in evaluatorOrOptions) {
  206094. throw new Error('For ko.defineProperty, you must not specify a "value" for the property. You must provide a "get" function.');
  206095. }
  206096. if (typeof evaluatorOrOptions.get !== "function") {
  206097. throw new Error('For ko.defineProperty, the third parameter must be either an evaluator function, or an options object containing a function called "get".');
  206098. }
  206099. computedOptions.read = evaluatorOrOptions.get;
  206100. computedOptions.write = evaluatorOrOptions.set;
  206101. }
  206102. obj[propertyName] = ko2.computed(computedOptions);
  206103. track.call(ko2, obj, [propertyName]);
  206104. return obj;
  206105. }
  206106. function notifyWhenPresentOrFutureArrayValuesMutate(ko2, observable) {
  206107. var watchingArraySubscription = null;
  206108. ko2.computed(function() {
  206109. if (watchingArraySubscription) {
  206110. watchingArraySubscription.dispose();
  206111. watchingArraySubscription = null;
  206112. }
  206113. var newArrayInstance = observable();
  206114. if (newArrayInstance instanceof Array) {
  206115. watchingArraySubscription = startWatchingArrayInstance(ko2, observable, newArrayInstance);
  206116. }
  206117. });
  206118. }
  206119. function startWatchingArrayInstance(ko2, observable, arrayInstance) {
  206120. var subscribable = getSubscribableForArray(ko2, arrayInstance);
  206121. return subscribable.subscribe(observable);
  206122. }
  206123. function getSubscribableForArray(ko2, arrayInstance) {
  206124. var subscribable = arrayInstance[SUBSCRIBABLE_PROPERTY];
  206125. if (!subscribable) {
  206126. subscribable = new ko2.subscribable();
  206127. Object.defineProperty(arrayInstance, SUBSCRIBABLE_PROPERTY, {
  206128. value: subscribable
  206129. });
  206130. var notificationPauseSignal = {};
  206131. wrapStandardArrayMutators(arrayInstance, subscribable, notificationPauseSignal);
  206132. addKnockoutArrayMutators(ko2, arrayInstance, subscribable, notificationPauseSignal);
  206133. }
  206134. return subscribable;
  206135. }
  206136. function wrapStandardArrayMutators(arrayInstance, subscribable, notificationPauseSignal) {
  206137. ["pop", "push", "reverse", "shift", "sort", "splice", "unshift"].forEach(function(fnName) {
  206138. var origMutator = arrayInstance[fnName];
  206139. arrayInstance[fnName] = function() {
  206140. var result = origMutator.apply(this, arguments);
  206141. if (notificationPauseSignal.pause !== true) {
  206142. subscribable.notifySubscribers(this);
  206143. }
  206144. return result;
  206145. };
  206146. });
  206147. }
  206148. function addKnockoutArrayMutators(ko2, arrayInstance, subscribable, notificationPauseSignal) {
  206149. ["remove", "removeAll", "destroy", "destroyAll", "replace"].forEach(function(fnName) {
  206150. Object.defineProperty(arrayInstance, fnName, {
  206151. enumerable: false,
  206152. value: function() {
  206153. var result;
  206154. notificationPauseSignal.pause = true;
  206155. try {
  206156. result = ko2.observableArray.fn[fnName].apply(ko2.observableArray(arrayInstance), arguments);
  206157. } finally {
  206158. notificationPauseSignal.pause = false;
  206159. }
  206160. subscribable.notifySubscribers(arrayInstance);
  206161. return result;
  206162. }
  206163. });
  206164. });
  206165. }
  206166. function getObservable(obj, propertyName) {
  206167. if (!obj) {
  206168. return null;
  206169. }
  206170. var allObservablesForObject = getAllObservablesForObject(obj, false);
  206171. return allObservablesForObject && allObservablesForObject[propertyName] || null;
  206172. }
  206173. function valueHasMutated(obj, propertyName) {
  206174. var observable = getObservable(obj, propertyName);
  206175. if (observable) {
  206176. observable.valueHasMutated();
  206177. }
  206178. }
  206179. function attachToKo(ko2) {
  206180. ko2.track = track;
  206181. ko2.getObservable = getObservable;
  206182. ko2.valueHasMutated = valueHasMutated;
  206183. ko2.defineProperty = defineComputedProperty;
  206184. }
  206185. var knockout_es5_default = {
  206186. attachToKo
  206187. };
  206188. // node_modules/cesium/Source/Widgets/SvgPathBindingHandler.js
  206189. var svgNS = "http://www.w3.org/2000/svg";
  206190. var svgClassName = "cesium-svgPath-svg";
  206191. var SvgPathBindingHandler = {
  206192. register: function(knockout2) {
  206193. knockout2.bindingHandlers.cesiumSvgPath = {
  206194. init: function(element, valueAccessor) {
  206195. const svg2 = document.createElementNS(svgNS, "svg:svg");
  206196. svg2.setAttribute("class", svgClassName);
  206197. const pathElement = document.createElementNS(svgNS, "path");
  206198. svg2.appendChild(pathElement);
  206199. knockout2.virtualElements.setDomNodeChildren(element, [svg2]);
  206200. knockout2.computed({
  206201. read: function() {
  206202. const value = knockout2.unwrap(valueAccessor());
  206203. pathElement.setAttribute("d", knockout2.unwrap(value.path));
  206204. const pathWidth = knockout2.unwrap(value.width);
  206205. const pathHeight = knockout2.unwrap(value.height);
  206206. svg2.setAttribute("width", pathWidth);
  206207. svg2.setAttribute("height", pathHeight);
  206208. svg2.setAttribute("viewBox", `0 0 ${pathWidth} ${pathHeight}`);
  206209. if (value.css) {
  206210. svg2.setAttribute(
  206211. "class",
  206212. `${svgClassName} ${knockout2.unwrap(value.css)}`
  206213. );
  206214. }
  206215. },
  206216. disposeWhenNodeIsRemoved: element
  206217. });
  206218. return {
  206219. controlsDescendantBindings: true
  206220. };
  206221. }
  206222. };
  206223. knockout2.virtualElements.allowedBindings.cesiumSvgPath = true;
  206224. }
  206225. };
  206226. var SvgPathBindingHandler_default = SvgPathBindingHandler;
  206227. // node_modules/cesium/Source/ThirdParty/knockout.js
  206228. knockout_es5_default.attachToKo(knockout_3_5_1_default);
  206229. SvgPathBindingHandler_default.register(knockout_3_5_1_default);
  206230. var knockout_default = knockout_3_5_1_default;
  206231. // node_modules/cesium/Source/ThirdParty/ktx-parse.js
  206232. var e = [171, 75, 84, 88, 32, 50, 48, 187, 13, 10, 26, 10];
  206233. var n;
  206234. var i;
  206235. var s;
  206236. var a3;
  206237. var r;
  206238. var o;
  206239. var l;
  206240. var f;
  206241. !function(t) {
  206242. t[t.NONE = 0] = "NONE", t[t.BASISLZ = 1] = "BASISLZ", t[t.ZSTD = 2] = "ZSTD", t[t.ZLIB = 3] = "ZLIB";
  206243. }(n || (n = {})), function(t) {
  206244. t[t.BASICFORMAT = 0] = "BASICFORMAT";
  206245. }(i || (i = {})), function(t) {
  206246. t[t.UNSPECIFIED = 0] = "UNSPECIFIED", t[t.ETC1S = 163] = "ETC1S", t[t.UASTC = 166] = "UASTC";
  206247. }(s || (s = {})), function(t) {
  206248. t[t.UNSPECIFIED = 0] = "UNSPECIFIED", t[t.SRGB = 1] = "SRGB";
  206249. }(a3 || (a3 = {})), function(t) {
  206250. t[t.UNSPECIFIED = 0] = "UNSPECIFIED", t[t.LINEAR = 1] = "LINEAR", t[t.SRGB = 2] = "SRGB", t[t.ITU = 3] = "ITU", t[t.NTSC = 4] = "NTSC", t[t.SLOG = 5] = "SLOG", t[t.SLOG2 = 6] = "SLOG2";
  206251. }(r || (r = {})), function(t) {
  206252. t[t.ALPHA_STRAIGHT = 0] = "ALPHA_STRAIGHT", t[t.ALPHA_PREMULTIPLIED = 1] = "ALPHA_PREMULTIPLIED";
  206253. }(o || (o = {})), function(t) {
  206254. t[t.RGB = 0] = "RGB", t[t.RRR = 3] = "RRR", t[t.GGG = 4] = "GGG", t[t.AAA = 15] = "AAA";
  206255. }(l || (l = {})), function(t) {
  206256. t[t.RGB = 0] = "RGB", t[t.RGBA = 3] = "RGBA", t[t.RRR = 4] = "RRR", t[t.RRRG = 5] = "RRRG";
  206257. }(f || (f = {}));
  206258. var U = class {
  206259. constructor() {
  206260. this.vkFormat = 0, this.typeSize = 1, this.pixelWidth = 0, this.pixelHeight = 0, this.pixelDepth = 0, this.layerCount = 0, this.faceCount = 1, this.supercompressionScheme = n.NONE, this.levels = [], this.dataFormatDescriptor = [{ vendorId: 0, descriptorType: i.BASICFORMAT, versionNumber: 2, descriptorBlockSize: 40, colorModel: s.UNSPECIFIED, colorPrimaries: a3.SRGB, transferFunction: a3.SRGB, flags: o.ALPHA_STRAIGHT, texelBlockDimension: { x: 4, y: 4, z: 1, w: 1 }, bytesPlane: [], samples: [] }], this.keyValue = {}, this.globalData = null;
  206261. }
  206262. };
  206263. var c = class {
  206264. constructor(t, e2, n2, i2) {
  206265. this._dataView = new DataView(t.buffer, t.byteOffset + e2, n2), this._littleEndian = i2, this._offset = 0;
  206266. }
  206267. _nextUint8() {
  206268. const t = this._dataView.getUint8(this._offset);
  206269. return this._offset += 1, t;
  206270. }
  206271. _nextUint16() {
  206272. const t = this._dataView.getUint16(this._offset, this._littleEndian);
  206273. return this._offset += 2, t;
  206274. }
  206275. _nextUint32() {
  206276. const t = this._dataView.getUint32(this._offset, this._littleEndian);
  206277. return this._offset += 4, t;
  206278. }
  206279. _nextUint64() {
  206280. const t = this._dataView.getUint32(this._offset, this._littleEndian) + 2 ** 32 * this._dataView.getUint32(this._offset + 4, this._littleEndian);
  206281. return this._offset += 8, t;
  206282. }
  206283. _skip(t) {
  206284. return this._offset += t, this;
  206285. }
  206286. _scan(t, e2 = 0) {
  206287. const n2 = this._offset;
  206288. let i2 = 0;
  206289. for (; this._dataView.getUint8(this._offset) !== e2 && i2 < t; )
  206290. i2++, this._offset++;
  206291. return i2 < t && this._offset++, new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + n2, i2);
  206292. }
  206293. };
  206294. function _(t) {
  206295. return "undefined" != typeof TextDecoder ? new TextDecoder().decode(t) : Buffer.from(t).toString("utf8");
  206296. }
  206297. function p(t) {
  206298. const n2 = new Uint8Array(t.buffer, t.byteOffset, e.length);
  206299. if (n2[0] !== e[0] || n2[1] !== e[1] || n2[2] !== e[2] || n2[3] !== e[3] || n2[4] !== e[4] || n2[5] !== e[5] || n2[6] !== e[6] || n2[7] !== e[7] || n2[8] !== e[8] || n2[9] !== e[9] || n2[10] !== e[10] || n2[11] !== e[11])
  206300. throw new Error("Missing KTX 2.0 identifier.");
  206301. const i2 = new U(), s2 = 17 * Uint32Array.BYTES_PER_ELEMENT, a4 = new c(t, e.length, s2, true);
  206302. i2.vkFormat = a4._nextUint32(), i2.typeSize = a4._nextUint32(), i2.pixelWidth = a4._nextUint32(), i2.pixelHeight = a4._nextUint32(), i2.pixelDepth = a4._nextUint32(), i2.layerCount = a4._nextUint32(), i2.faceCount = a4._nextUint32();
  206303. const r2 = a4._nextUint32();
  206304. i2.supercompressionScheme = a4._nextUint32();
  206305. const o2 = a4._nextUint32(), l2 = a4._nextUint32(), f2 = a4._nextUint32(), h = a4._nextUint32(), g = a4._nextUint64(), p2 = a4._nextUint64(), x = new c(t, e.length + s2, 3 * r2 * 8, true);
  206306. for (let e2 = 0; e2 < r2; e2++)
  206307. i2.levels.push({ levelData: new Uint8Array(t.buffer, t.byteOffset + x._nextUint64(), x._nextUint64()), uncompressedByteLength: x._nextUint64() });
  206308. const u3 = new c(t, o2, l2, true), y = { vendorId: u3._skip(4)._nextUint16(), descriptorType: u3._nextUint16(), versionNumber: u3._nextUint16(), descriptorBlockSize: u3._nextUint16(), colorModel: u3._nextUint8(), colorPrimaries: u3._nextUint8(), transferFunction: u3._nextUint8(), flags: u3._nextUint8(), texelBlockDimension: { x: u3._nextUint8() + 1, y: u3._nextUint8() + 1, z: u3._nextUint8() + 1, w: u3._nextUint8() + 1 }, bytesPlane: [u3._nextUint8(), u3._nextUint8(), u3._nextUint8(), u3._nextUint8(), u3._nextUint8(), u3._nextUint8(), u3._nextUint8(), u3._nextUint8()], samples: [] }, D = (y.descriptorBlockSize / 4 - 6) / 4;
  206309. for (let t2 = 0; t2 < D; t2++)
  206310. y.samples[t2] = { bitOffset: u3._nextUint16(), bitLength: u3._nextUint8(), channelID: u3._nextUint8(), samplePosition: [u3._nextUint8(), u3._nextUint8(), u3._nextUint8(), u3._nextUint8()], sampleLower: u3._nextUint32(), sampleUpper: u3._nextUint32() };
  206311. i2.dataFormatDescriptor.length = 0, i2.dataFormatDescriptor.push(y);
  206312. const b = new c(t, f2, h, true);
  206313. for (; b._offset < h; ) {
  206314. const t2 = b._nextUint32(), e2 = b._scan(t2), n3 = _(e2), s3 = b._scan(t2 - e2.byteLength);
  206315. i2.keyValue[n3] = n3.match(/^ktx/i) ? _(s3) : s3, b._offset % 4 && b._skip(4 - b._offset % 4);
  206316. }
  206317. if (p2 <= 0)
  206318. return i2;
  206319. const d = new c(t, g, p2, true), B = d._nextUint16(), w = d._nextUint16(), A = d._nextUint32(), S = d._nextUint32(), m = d._nextUint32(), L = d._nextUint32(), I = [];
  206320. for (let t2 = 0; t2 < r2; t2++)
  206321. I.push({ imageFlags: d._nextUint32(), rgbSliceByteOffset: d._nextUint32(), rgbSliceByteLength: d._nextUint32(), alphaSliceByteOffset: d._nextUint32(), alphaSliceByteLength: d._nextUint32() });
  206322. const R = g + d._offset, E = R + A, T = E + S, O = T + m, P = new Uint8Array(t.buffer, t.byteOffset + R, A), C = new Uint8Array(t.buffer, t.byteOffset + E, S), F = new Uint8Array(t.buffer, t.byteOffset + T, m), G = new Uint8Array(t.buffer, t.byteOffset + O, L);
  206323. return i2.globalData = { endpointCount: B, selectorCount: w, imageDescs: I, endpointsData: P, selectorsData: C, tablesData: F, extendedData: G }, i2;
  206324. }
  206325. // node_modules/cesium/Source/ThirdParty/lerc.js
  206326. var LercDecode = createCommonjsModule(function(module2) {
  206327. (function() {
  206328. var LercDecode2 = function() {
  206329. var CntZImage = {};
  206330. CntZImage.defaultNoDataValue = -34027999387901484e22;
  206331. CntZImage.decode = function(input, options) {
  206332. options = options || {};
  206333. var skipMask = options.encodedMaskData || options.encodedMaskData === null;
  206334. var parsedData = parse2(input, options.inputOffset || 0, skipMask);
  206335. var noDataValue = options.noDataValue !== null ? options.noDataValue : CntZImage.defaultNoDataValue;
  206336. var uncompressedData = uncompressPixelValues(
  206337. parsedData,
  206338. options.pixelType || Float32Array,
  206339. options.encodedMaskData,
  206340. noDataValue,
  206341. options.returnMask
  206342. );
  206343. var result = {
  206344. width: parsedData.width,
  206345. height: parsedData.height,
  206346. pixelData: uncompressedData.resultPixels,
  206347. minValue: uncompressedData.minValue,
  206348. maxValue: parsedData.pixels.maxValue,
  206349. noDataValue
  206350. };
  206351. if (uncompressedData.resultMask) {
  206352. result.maskData = uncompressedData.resultMask;
  206353. }
  206354. if (options.returnEncodedMask && parsedData.mask) {
  206355. result.encodedMaskData = parsedData.mask.bitset ? parsedData.mask.bitset : null;
  206356. }
  206357. if (options.returnFileInfo) {
  206358. result.fileInfo = formatFileInfo(parsedData);
  206359. if (options.computeUsedBitDepths) {
  206360. result.fileInfo.bitDepths = computeUsedBitDepths(parsedData);
  206361. }
  206362. }
  206363. return result;
  206364. };
  206365. var uncompressPixelValues = function(data, TypedArrayClass, maskBitset, noDataValue, storeDecodedMask) {
  206366. var blockIdx = 0;
  206367. var numX = data.pixels.numBlocksX;
  206368. var numY = data.pixels.numBlocksY;
  206369. var blockWidth = Math.floor(data.width / numX);
  206370. var blockHeight = Math.floor(data.height / numY);
  206371. var scale = 2 * data.maxZError;
  206372. var minValue = Number.MAX_VALUE, currentValue;
  206373. maskBitset = maskBitset || (data.mask ? data.mask.bitset : null);
  206374. var resultPixels, resultMask;
  206375. resultPixels = new TypedArrayClass(data.width * data.height);
  206376. if (storeDecodedMask && maskBitset) {
  206377. resultMask = new Uint8Array(data.width * data.height);
  206378. }
  206379. var blockDataBuffer = new Float32Array(blockWidth * blockHeight);
  206380. var xx, yy;
  206381. for (var y = 0; y <= numY; y++) {
  206382. var thisBlockHeight = y !== numY ? blockHeight : data.height % numY;
  206383. if (thisBlockHeight === 0) {
  206384. continue;
  206385. }
  206386. for (var x = 0; x <= numX; x++) {
  206387. var thisBlockWidth = x !== numX ? blockWidth : data.width % numX;
  206388. if (thisBlockWidth === 0) {
  206389. continue;
  206390. }
  206391. var outPtr = y * data.width * blockHeight + x * blockWidth;
  206392. var outStride = data.width - thisBlockWidth;
  206393. var block = data.pixels.blocks[blockIdx];
  206394. var blockData, blockPtr, constValue;
  206395. if (block.encoding < 2) {
  206396. if (block.encoding === 0) {
  206397. blockData = block.rawData;
  206398. } else {
  206399. unstuff(block.stuffedData, block.bitsPerPixel, block.numValidPixels, block.offset, scale, blockDataBuffer, data.pixels.maxValue);
  206400. blockData = blockDataBuffer;
  206401. }
  206402. blockPtr = 0;
  206403. } else if (block.encoding === 2) {
  206404. constValue = 0;
  206405. } else {
  206406. constValue = block.offset;
  206407. }
  206408. var maskByte;
  206409. if (maskBitset) {
  206410. for (yy = 0; yy < thisBlockHeight; yy++) {
  206411. if (outPtr & 7) {
  206412. maskByte = maskBitset[outPtr >> 3];
  206413. maskByte <<= outPtr & 7;
  206414. }
  206415. for (xx = 0; xx < thisBlockWidth; xx++) {
  206416. if (!(outPtr & 7)) {
  206417. maskByte = maskBitset[outPtr >> 3];
  206418. }
  206419. if (maskByte & 128) {
  206420. if (resultMask) {
  206421. resultMask[outPtr] = 1;
  206422. }
  206423. currentValue = block.encoding < 2 ? blockData[blockPtr++] : constValue;
  206424. minValue = minValue > currentValue ? currentValue : minValue;
  206425. resultPixels[outPtr++] = currentValue;
  206426. } else {
  206427. if (resultMask) {
  206428. resultMask[outPtr] = 0;
  206429. }
  206430. resultPixels[outPtr++] = noDataValue;
  206431. }
  206432. maskByte <<= 1;
  206433. }
  206434. outPtr += outStride;
  206435. }
  206436. } else {
  206437. if (block.encoding < 2) {
  206438. for (yy = 0; yy < thisBlockHeight; yy++) {
  206439. for (xx = 0; xx < thisBlockWidth; xx++) {
  206440. currentValue = blockData[blockPtr++];
  206441. minValue = minValue > currentValue ? currentValue : minValue;
  206442. resultPixels[outPtr++] = currentValue;
  206443. }
  206444. outPtr += outStride;
  206445. }
  206446. } else {
  206447. minValue = minValue > constValue ? constValue : minValue;
  206448. for (yy = 0; yy < thisBlockHeight; yy++) {
  206449. for (xx = 0; xx < thisBlockWidth; xx++) {
  206450. resultPixels[outPtr++] = constValue;
  206451. }
  206452. outPtr += outStride;
  206453. }
  206454. }
  206455. }
  206456. if (block.encoding === 1 && blockPtr !== block.numValidPixels) {
  206457. throw "Block and Mask do not match";
  206458. }
  206459. blockIdx++;
  206460. }
  206461. }
  206462. return {
  206463. resultPixels,
  206464. resultMask,
  206465. minValue
  206466. };
  206467. };
  206468. var formatFileInfo = function(data) {
  206469. return {
  206470. "fileIdentifierString": data.fileIdentifierString,
  206471. "fileVersion": data.fileVersion,
  206472. "imageType": data.imageType,
  206473. "height": data.height,
  206474. "width": data.width,
  206475. "maxZError": data.maxZError,
  206476. "eofOffset": data.eofOffset,
  206477. "mask": data.mask ? {
  206478. "numBlocksX": data.mask.numBlocksX,
  206479. "numBlocksY": data.mask.numBlocksY,
  206480. "numBytes": data.mask.numBytes,
  206481. "maxValue": data.mask.maxValue
  206482. } : null,
  206483. "pixels": {
  206484. "numBlocksX": data.pixels.numBlocksX,
  206485. "numBlocksY": data.pixels.numBlocksY,
  206486. "numBytes": data.pixels.numBytes,
  206487. "maxValue": data.pixels.maxValue,
  206488. "noDataValue": data.noDataValue
  206489. }
  206490. };
  206491. };
  206492. var computeUsedBitDepths = function(data) {
  206493. var numBlocks = data.pixels.numBlocksX * data.pixels.numBlocksY;
  206494. var bitDepths = {};
  206495. for (var i2 = 0; i2 < numBlocks; i2++) {
  206496. var block = data.pixels.blocks[i2];
  206497. if (block.encoding === 0) {
  206498. bitDepths.float32 = true;
  206499. } else if (block.encoding === 1) {
  206500. bitDepths[block.bitsPerPixel] = true;
  206501. } else {
  206502. bitDepths[0] = true;
  206503. }
  206504. }
  206505. return Object.keys(bitDepths);
  206506. };
  206507. var parse2 = function(input, fp, skipMask) {
  206508. var data = {};
  206509. var fileIdView = new Uint8Array(input, fp, 10);
  206510. data.fileIdentifierString = String.fromCharCode.apply(null, fileIdView);
  206511. if (data.fileIdentifierString.trim() !== "CntZImage") {
  206512. throw "Unexpected file identifier string: " + data.fileIdentifierString;
  206513. }
  206514. fp += 10;
  206515. var view = new DataView(input, fp, 24);
  206516. data.fileVersion = view.getInt32(0, true);
  206517. data.imageType = view.getInt32(4, true);
  206518. data.height = view.getUint32(8, true);
  206519. data.width = view.getUint32(12, true);
  206520. data.maxZError = view.getFloat64(16, true);
  206521. fp += 24;
  206522. if (!skipMask) {
  206523. view = new DataView(input, fp, 16);
  206524. data.mask = {};
  206525. data.mask.numBlocksY = view.getUint32(0, true);
  206526. data.mask.numBlocksX = view.getUint32(4, true);
  206527. data.mask.numBytes = view.getUint32(8, true);
  206528. data.mask.maxValue = view.getFloat32(12, true);
  206529. fp += 16;
  206530. if (data.mask.numBytes > 0) {
  206531. var bitset = new Uint8Array(Math.ceil(data.width * data.height / 8));
  206532. view = new DataView(input, fp, data.mask.numBytes);
  206533. var cnt = view.getInt16(0, true);
  206534. var ip = 2, op = 0;
  206535. do {
  206536. if (cnt > 0) {
  206537. while (cnt--) {
  206538. bitset[op++] = view.getUint8(ip++);
  206539. }
  206540. } else {
  206541. var val = view.getUint8(ip++);
  206542. cnt = -cnt;
  206543. while (cnt--) {
  206544. bitset[op++] = val;
  206545. }
  206546. }
  206547. cnt = view.getInt16(ip, true);
  206548. ip += 2;
  206549. } while (ip < data.mask.numBytes);
  206550. if (cnt !== -32768 || op < bitset.length) {
  206551. throw "Unexpected end of mask RLE encoding";
  206552. }
  206553. data.mask.bitset = bitset;
  206554. fp += data.mask.numBytes;
  206555. } else if ((data.mask.numBytes | data.mask.numBlocksY | data.mask.maxValue) === 0) {
  206556. data.mask.bitset = new Uint8Array(Math.ceil(data.width * data.height / 8));
  206557. }
  206558. }
  206559. view = new DataView(input, fp, 16);
  206560. data.pixels = {};
  206561. data.pixels.numBlocksY = view.getUint32(0, true);
  206562. data.pixels.numBlocksX = view.getUint32(4, true);
  206563. data.pixels.numBytes = view.getUint32(8, true);
  206564. data.pixels.maxValue = view.getFloat32(12, true);
  206565. fp += 16;
  206566. var numBlocksX = data.pixels.numBlocksX;
  206567. var numBlocksY = data.pixels.numBlocksY;
  206568. var actualNumBlocksX = numBlocksX + (data.width % numBlocksX > 0 ? 1 : 0);
  206569. var actualNumBlocksY = numBlocksY + (data.height % numBlocksY > 0 ? 1 : 0);
  206570. data.pixels.blocks = new Array(actualNumBlocksX * actualNumBlocksY);
  206571. var blockI = 0;
  206572. for (var blockY = 0; blockY < actualNumBlocksY; blockY++) {
  206573. for (var blockX = 0; blockX < actualNumBlocksX; blockX++) {
  206574. var size = 0;
  206575. var bytesLeft = input.byteLength - fp;
  206576. view = new DataView(input, fp, Math.min(10, bytesLeft));
  206577. var block = {};
  206578. data.pixels.blocks[blockI++] = block;
  206579. var headerByte = view.getUint8(0);
  206580. size++;
  206581. block.encoding = headerByte & 63;
  206582. if (block.encoding > 3) {
  206583. throw "Invalid block encoding (" + block.encoding + ")";
  206584. }
  206585. if (block.encoding === 2) {
  206586. fp++;
  206587. continue;
  206588. }
  206589. if (headerByte !== 0 && headerByte !== 2) {
  206590. headerByte >>= 6;
  206591. block.offsetType = headerByte;
  206592. if (headerByte === 2) {
  206593. block.offset = view.getInt8(1);
  206594. size++;
  206595. } else if (headerByte === 1) {
  206596. block.offset = view.getInt16(1, true);
  206597. size += 2;
  206598. } else if (headerByte === 0) {
  206599. block.offset = view.getFloat32(1, true);
  206600. size += 4;
  206601. } else {
  206602. throw "Invalid block offset type";
  206603. }
  206604. if (block.encoding === 1) {
  206605. headerByte = view.getUint8(size);
  206606. size++;
  206607. block.bitsPerPixel = headerByte & 63;
  206608. headerByte >>= 6;
  206609. block.numValidPixelsType = headerByte;
  206610. if (headerByte === 2) {
  206611. block.numValidPixels = view.getUint8(size);
  206612. size++;
  206613. } else if (headerByte === 1) {
  206614. block.numValidPixels = view.getUint16(size, true);
  206615. size += 2;
  206616. } else if (headerByte === 0) {
  206617. block.numValidPixels = view.getUint32(size, true);
  206618. size += 4;
  206619. } else {
  206620. throw "Invalid valid pixel count type";
  206621. }
  206622. }
  206623. }
  206624. fp += size;
  206625. if (block.encoding === 3) {
  206626. continue;
  206627. }
  206628. var arrayBuf, store8;
  206629. if (block.encoding === 0) {
  206630. var numPixels = (data.pixels.numBytes - 1) / 4;
  206631. if (numPixels !== Math.floor(numPixels)) {
  206632. throw "uncompressed block has invalid length";
  206633. }
  206634. arrayBuf = new ArrayBuffer(numPixels * 4);
  206635. store8 = new Uint8Array(arrayBuf);
  206636. store8.set(new Uint8Array(input, fp, numPixels * 4));
  206637. var rawData = new Float32Array(arrayBuf);
  206638. block.rawData = rawData;
  206639. fp += numPixels * 4;
  206640. } else if (block.encoding === 1) {
  206641. var dataBytes = Math.ceil(block.numValidPixels * block.bitsPerPixel / 8);
  206642. var dataWords = Math.ceil(dataBytes / 4);
  206643. arrayBuf = new ArrayBuffer(dataWords * 4);
  206644. store8 = new Uint8Array(arrayBuf);
  206645. store8.set(new Uint8Array(input, fp, dataBytes));
  206646. block.stuffedData = new Uint32Array(arrayBuf);
  206647. fp += dataBytes;
  206648. }
  206649. }
  206650. }
  206651. data.eofOffset = fp;
  206652. return data;
  206653. };
  206654. var unstuff = function(src2, bitsPerPixel, numPixels, offset2, scale, dest, maxValue) {
  206655. var bitMask = (1 << bitsPerPixel) - 1;
  206656. var i2 = 0, o2;
  206657. var bitsLeft = 0;
  206658. var n2, buffer;
  206659. var nmax = Math.ceil((maxValue - offset2) / scale);
  206660. var numInvalidTailBytes = src2.length * 4 - Math.ceil(bitsPerPixel * numPixels / 8);
  206661. src2[src2.length - 1] <<= 8 * numInvalidTailBytes;
  206662. for (o2 = 0; o2 < numPixels; o2++) {
  206663. if (bitsLeft === 0) {
  206664. buffer = src2[i2++];
  206665. bitsLeft = 32;
  206666. }
  206667. if (bitsLeft >= bitsPerPixel) {
  206668. n2 = buffer >>> bitsLeft - bitsPerPixel & bitMask;
  206669. bitsLeft -= bitsPerPixel;
  206670. } else {
  206671. var missingBits = bitsPerPixel - bitsLeft;
  206672. n2 = (buffer & bitMask) << missingBits & bitMask;
  206673. buffer = src2[i2++];
  206674. bitsLeft = 32 - missingBits;
  206675. n2 += buffer >>> bitsLeft;
  206676. }
  206677. dest[o2] = n2 < nmax ? offset2 + n2 * scale : maxValue;
  206678. }
  206679. return dest;
  206680. };
  206681. return CntZImage;
  206682. }();
  206683. var Lerc2Decode = function() {
  206684. var BitStuffer = {
  206685. unstuff: function(src2, dest, bitsPerPixel, numPixels, lutArr, offset2, scale, maxValue) {
  206686. var bitMask = (1 << bitsPerPixel) - 1;
  206687. var i2 = 0, o2;
  206688. var bitsLeft = 0;
  206689. var n2, buffer, missingBits, nmax;
  206690. var numInvalidTailBytes = src2.length * 4 - Math.ceil(bitsPerPixel * numPixels / 8);
  206691. src2[src2.length - 1] <<= 8 * numInvalidTailBytes;
  206692. if (lutArr) {
  206693. for (o2 = 0; o2 < numPixels; o2++) {
  206694. if (bitsLeft === 0) {
  206695. buffer = src2[i2++];
  206696. bitsLeft = 32;
  206697. }
  206698. if (bitsLeft >= bitsPerPixel) {
  206699. n2 = buffer >>> bitsLeft - bitsPerPixel & bitMask;
  206700. bitsLeft -= bitsPerPixel;
  206701. } else {
  206702. missingBits = bitsPerPixel - bitsLeft;
  206703. n2 = (buffer & bitMask) << missingBits & bitMask;
  206704. buffer = src2[i2++];
  206705. bitsLeft = 32 - missingBits;
  206706. n2 += buffer >>> bitsLeft;
  206707. }
  206708. dest[o2] = lutArr[n2];
  206709. }
  206710. } else {
  206711. nmax = Math.ceil((maxValue - offset2) / scale);
  206712. for (o2 = 0; o2 < numPixels; o2++) {
  206713. if (bitsLeft === 0) {
  206714. buffer = src2[i2++];
  206715. bitsLeft = 32;
  206716. }
  206717. if (bitsLeft >= bitsPerPixel) {
  206718. n2 = buffer >>> bitsLeft - bitsPerPixel & bitMask;
  206719. bitsLeft -= bitsPerPixel;
  206720. } else {
  206721. missingBits = bitsPerPixel - bitsLeft;
  206722. n2 = (buffer & bitMask) << missingBits & bitMask;
  206723. buffer = src2[i2++];
  206724. bitsLeft = 32 - missingBits;
  206725. n2 += buffer >>> bitsLeft;
  206726. }
  206727. dest[o2] = n2 < nmax ? offset2 + n2 * scale : maxValue;
  206728. }
  206729. }
  206730. },
  206731. unstuffLUT: function(src2, bitsPerPixel, numPixels, offset2, scale, maxValue) {
  206732. var bitMask = (1 << bitsPerPixel) - 1;
  206733. var i2 = 0, o2 = 0, missingBits = 0, bitsLeft = 0, n2 = 0;
  206734. var buffer;
  206735. var dest = [];
  206736. var numInvalidTailBytes = src2.length * 4 - Math.ceil(bitsPerPixel * numPixels / 8);
  206737. src2[src2.length - 1] <<= 8 * numInvalidTailBytes;
  206738. var nmax = Math.ceil((maxValue - offset2) / scale);
  206739. for (o2 = 0; o2 < numPixels; o2++) {
  206740. if (bitsLeft === 0) {
  206741. buffer = src2[i2++];
  206742. bitsLeft = 32;
  206743. }
  206744. if (bitsLeft >= bitsPerPixel) {
  206745. n2 = buffer >>> bitsLeft - bitsPerPixel & bitMask;
  206746. bitsLeft -= bitsPerPixel;
  206747. } else {
  206748. missingBits = bitsPerPixel - bitsLeft;
  206749. n2 = (buffer & bitMask) << missingBits & bitMask;
  206750. buffer = src2[i2++];
  206751. bitsLeft = 32 - missingBits;
  206752. n2 += buffer >>> bitsLeft;
  206753. }
  206754. dest[o2] = n2 < nmax ? offset2 + n2 * scale : maxValue;
  206755. }
  206756. dest.unshift(offset2);
  206757. return dest;
  206758. },
  206759. unstuff2: function(src2, dest, bitsPerPixel, numPixels, lutArr, offset2, scale, maxValue) {
  206760. var bitMask = (1 << bitsPerPixel) - 1;
  206761. var i2 = 0, o2;
  206762. var bitsLeft = 0, bitPos = 0;
  206763. var n2, buffer, missingBits;
  206764. if (lutArr) {
  206765. for (o2 = 0; o2 < numPixels; o2++) {
  206766. if (bitsLeft === 0) {
  206767. buffer = src2[i2++];
  206768. bitsLeft = 32;
  206769. bitPos = 0;
  206770. }
  206771. if (bitsLeft >= bitsPerPixel) {
  206772. n2 = buffer >>> bitPos & bitMask;
  206773. bitsLeft -= bitsPerPixel;
  206774. bitPos += bitsPerPixel;
  206775. } else {
  206776. missingBits = bitsPerPixel - bitsLeft;
  206777. n2 = buffer >>> bitPos & bitMask;
  206778. buffer = src2[i2++];
  206779. bitsLeft = 32 - missingBits;
  206780. n2 |= (buffer & (1 << missingBits) - 1) << bitsPerPixel - missingBits;
  206781. bitPos = missingBits;
  206782. }
  206783. dest[o2] = lutArr[n2];
  206784. }
  206785. } else {
  206786. var nmax = Math.ceil((maxValue - offset2) / scale);
  206787. for (o2 = 0; o2 < numPixels; o2++) {
  206788. if (bitsLeft === 0) {
  206789. buffer = src2[i2++];
  206790. bitsLeft = 32;
  206791. bitPos = 0;
  206792. }
  206793. if (bitsLeft >= bitsPerPixel) {
  206794. n2 = buffer >>> bitPos & bitMask;
  206795. bitsLeft -= bitsPerPixel;
  206796. bitPos += bitsPerPixel;
  206797. } else {
  206798. missingBits = bitsPerPixel - bitsLeft;
  206799. n2 = buffer >>> bitPos & bitMask;
  206800. buffer = src2[i2++];
  206801. bitsLeft = 32 - missingBits;
  206802. n2 |= (buffer & (1 << missingBits) - 1) << bitsPerPixel - missingBits;
  206803. bitPos = missingBits;
  206804. }
  206805. dest[o2] = n2 < nmax ? offset2 + n2 * scale : maxValue;
  206806. }
  206807. }
  206808. return dest;
  206809. },
  206810. unstuffLUT2: function(src2, bitsPerPixel, numPixels, offset2, scale, maxValue) {
  206811. var bitMask = (1 << bitsPerPixel) - 1;
  206812. var i2 = 0, o2 = 0, missingBits = 0, bitsLeft = 0, n2 = 0, bitPos = 0;
  206813. var buffer;
  206814. var dest = [];
  206815. var nmax = Math.ceil((maxValue - offset2) / scale);
  206816. for (o2 = 0; o2 < numPixels; o2++) {
  206817. if (bitsLeft === 0) {
  206818. buffer = src2[i2++];
  206819. bitsLeft = 32;
  206820. bitPos = 0;
  206821. }
  206822. if (bitsLeft >= bitsPerPixel) {
  206823. n2 = buffer >>> bitPos & bitMask;
  206824. bitsLeft -= bitsPerPixel;
  206825. bitPos += bitsPerPixel;
  206826. } else {
  206827. missingBits = bitsPerPixel - bitsLeft;
  206828. n2 = buffer >>> bitPos & bitMask;
  206829. buffer = src2[i2++];
  206830. bitsLeft = 32 - missingBits;
  206831. n2 |= (buffer & (1 << missingBits) - 1) << bitsPerPixel - missingBits;
  206832. bitPos = missingBits;
  206833. }
  206834. dest[o2] = n2 < nmax ? offset2 + n2 * scale : maxValue;
  206835. }
  206836. dest.unshift(offset2);
  206837. return dest;
  206838. },
  206839. originalUnstuff: function(src2, dest, bitsPerPixel, numPixels) {
  206840. var bitMask = (1 << bitsPerPixel) - 1;
  206841. var i2 = 0, o2;
  206842. var bitsLeft = 0;
  206843. var n2, buffer, missingBits;
  206844. var numInvalidTailBytes = src2.length * 4 - Math.ceil(bitsPerPixel * numPixels / 8);
  206845. src2[src2.length - 1] <<= 8 * numInvalidTailBytes;
  206846. for (o2 = 0; o2 < numPixels; o2++) {
  206847. if (bitsLeft === 0) {
  206848. buffer = src2[i2++];
  206849. bitsLeft = 32;
  206850. }
  206851. if (bitsLeft >= bitsPerPixel) {
  206852. n2 = buffer >>> bitsLeft - bitsPerPixel & bitMask;
  206853. bitsLeft -= bitsPerPixel;
  206854. } else {
  206855. missingBits = bitsPerPixel - bitsLeft;
  206856. n2 = (buffer & bitMask) << missingBits & bitMask;
  206857. buffer = src2[i2++];
  206858. bitsLeft = 32 - missingBits;
  206859. n2 += buffer >>> bitsLeft;
  206860. }
  206861. dest[o2] = n2;
  206862. }
  206863. return dest;
  206864. },
  206865. originalUnstuff2: function(src2, dest, bitsPerPixel, numPixels) {
  206866. var bitMask = (1 << bitsPerPixel) - 1;
  206867. var i2 = 0, o2;
  206868. var bitsLeft = 0, bitPos = 0;
  206869. var n2, buffer, missingBits;
  206870. for (o2 = 0; o2 < numPixels; o2++) {
  206871. if (bitsLeft === 0) {
  206872. buffer = src2[i2++];
  206873. bitsLeft = 32;
  206874. bitPos = 0;
  206875. }
  206876. if (bitsLeft >= bitsPerPixel) {
  206877. n2 = buffer >>> bitPos & bitMask;
  206878. bitsLeft -= bitsPerPixel;
  206879. bitPos += bitsPerPixel;
  206880. } else {
  206881. missingBits = bitsPerPixel - bitsLeft;
  206882. n2 = buffer >>> bitPos & bitMask;
  206883. buffer = src2[i2++];
  206884. bitsLeft = 32 - missingBits;
  206885. n2 |= (buffer & (1 << missingBits) - 1) << bitsPerPixel - missingBits;
  206886. bitPos = missingBits;
  206887. }
  206888. dest[o2] = n2;
  206889. }
  206890. return dest;
  206891. }
  206892. };
  206893. var Lerc2Helpers = {
  206894. HUFFMAN_LUT_BITS_MAX: 12,
  206895. computeChecksumFletcher32: function(input) {
  206896. var sum1 = 65535, sum2 = 65535;
  206897. var len = input.length;
  206898. var words = Math.floor(len / 2);
  206899. var i2 = 0;
  206900. while (words) {
  206901. var tlen = words >= 359 ? 359 : words;
  206902. words -= tlen;
  206903. do {
  206904. sum1 += input[i2++] << 8;
  206905. sum2 += sum1 += input[i2++];
  206906. } while (--tlen);
  206907. sum1 = (sum1 & 65535) + (sum1 >>> 16);
  206908. sum2 = (sum2 & 65535) + (sum2 >>> 16);
  206909. }
  206910. if (len & 1) {
  206911. sum2 += sum1 += input[i2] << 8;
  206912. }
  206913. sum1 = (sum1 & 65535) + (sum1 >>> 16);
  206914. sum2 = (sum2 & 65535) + (sum2 >>> 16);
  206915. return (sum2 << 16 | sum1) >>> 0;
  206916. },
  206917. readHeaderInfo: function(input, data) {
  206918. var ptr = data.ptr;
  206919. var fileIdView = new Uint8Array(input, ptr, 6);
  206920. var headerInfo = {};
  206921. headerInfo.fileIdentifierString = String.fromCharCode.apply(null, fileIdView);
  206922. if (headerInfo.fileIdentifierString.lastIndexOf("Lerc2", 0) !== 0) {
  206923. throw "Unexpected file identifier string (expect Lerc2 ): " + headerInfo.fileIdentifierString;
  206924. }
  206925. ptr += 6;
  206926. var view = new DataView(input, ptr, 8);
  206927. var fileVersion = view.getInt32(0, true);
  206928. headerInfo.fileVersion = fileVersion;
  206929. ptr += 4;
  206930. if (fileVersion >= 3) {
  206931. headerInfo.checksum = view.getUint32(4, true);
  206932. ptr += 4;
  206933. }
  206934. view = new DataView(input, ptr, 12);
  206935. headerInfo.height = view.getUint32(0, true);
  206936. headerInfo.width = view.getUint32(4, true);
  206937. ptr += 8;
  206938. if (fileVersion >= 4) {
  206939. headerInfo.numDims = view.getUint32(8, true);
  206940. ptr += 4;
  206941. } else {
  206942. headerInfo.numDims = 1;
  206943. }
  206944. view = new DataView(input, ptr, 40);
  206945. headerInfo.numValidPixel = view.getUint32(0, true);
  206946. headerInfo.microBlockSize = view.getInt32(4, true);
  206947. headerInfo.blobSize = view.getInt32(8, true);
  206948. headerInfo.imageType = view.getInt32(12, true);
  206949. headerInfo.maxZError = view.getFloat64(16, true);
  206950. headerInfo.zMin = view.getFloat64(24, true);
  206951. headerInfo.zMax = view.getFloat64(32, true);
  206952. ptr += 40;
  206953. data.headerInfo = headerInfo;
  206954. data.ptr = ptr;
  206955. var checksum, keyLength;
  206956. if (fileVersion >= 3) {
  206957. keyLength = fileVersion >= 4 ? 52 : 48;
  206958. checksum = this.computeChecksumFletcher32(new Uint8Array(input, ptr - keyLength, headerInfo.blobSize - 14));
  206959. if (checksum !== headerInfo.checksum) {
  206960. throw "Checksum failed.";
  206961. }
  206962. }
  206963. return true;
  206964. },
  206965. checkMinMaxRanges: function(input, data) {
  206966. var headerInfo = data.headerInfo;
  206967. var OutPixelTypeArray = this.getDataTypeArray(headerInfo.imageType);
  206968. var rangeBytes = headerInfo.numDims * this.getDataTypeSize(headerInfo.imageType);
  206969. var minValues = this.readSubArray(input, data.ptr, OutPixelTypeArray, rangeBytes);
  206970. var maxValues = this.readSubArray(input, data.ptr + rangeBytes, OutPixelTypeArray, rangeBytes);
  206971. data.ptr += 2 * rangeBytes;
  206972. var i2, equal = true;
  206973. for (i2 = 0; i2 < headerInfo.numDims; i2++) {
  206974. if (minValues[i2] !== maxValues[i2]) {
  206975. equal = false;
  206976. break;
  206977. }
  206978. }
  206979. headerInfo.minValues = minValues;
  206980. headerInfo.maxValues = maxValues;
  206981. return equal;
  206982. },
  206983. readSubArray: function(input, ptr, OutPixelTypeArray, numBytes) {
  206984. var rawData;
  206985. if (OutPixelTypeArray === Uint8Array) {
  206986. rawData = new Uint8Array(input, ptr, numBytes);
  206987. } else {
  206988. var arrayBuf = new ArrayBuffer(numBytes);
  206989. var store8 = new Uint8Array(arrayBuf);
  206990. store8.set(new Uint8Array(input, ptr, numBytes));
  206991. rawData = new OutPixelTypeArray(arrayBuf);
  206992. }
  206993. return rawData;
  206994. },
  206995. readMask: function(input, data) {
  206996. var ptr = data.ptr;
  206997. var headerInfo = data.headerInfo;
  206998. var numPixels = headerInfo.width * headerInfo.height;
  206999. var numValidPixel = headerInfo.numValidPixel;
  207000. var view = new DataView(input, ptr, 4);
  207001. var mask = {};
  207002. mask.numBytes = view.getUint32(0, true);
  207003. ptr += 4;
  207004. if ((0 === numValidPixel || numPixels === numValidPixel) && 0 !== mask.numBytes) {
  207005. throw "invalid mask";
  207006. }
  207007. var bitset, resultMask;
  207008. if (numValidPixel === 0) {
  207009. bitset = new Uint8Array(Math.ceil(numPixels / 8));
  207010. mask.bitset = bitset;
  207011. resultMask = new Uint8Array(numPixels);
  207012. data.pixels.resultMask = resultMask;
  207013. ptr += mask.numBytes;
  207014. } else if (mask.numBytes > 0) {
  207015. bitset = new Uint8Array(Math.ceil(numPixels / 8));
  207016. view = new DataView(input, ptr, mask.numBytes);
  207017. var cnt = view.getInt16(0, true);
  207018. var ip = 2, op = 0, val = 0;
  207019. do {
  207020. if (cnt > 0) {
  207021. while (cnt--) {
  207022. bitset[op++] = view.getUint8(ip++);
  207023. }
  207024. } else {
  207025. val = view.getUint8(ip++);
  207026. cnt = -cnt;
  207027. while (cnt--) {
  207028. bitset[op++] = val;
  207029. }
  207030. }
  207031. cnt = view.getInt16(ip, true);
  207032. ip += 2;
  207033. } while (ip < mask.numBytes);
  207034. if (cnt !== -32768 || op < bitset.length) {
  207035. throw "Unexpected end of mask RLE encoding";
  207036. }
  207037. resultMask = new Uint8Array(numPixels);
  207038. var mb = 0, k = 0;
  207039. for (k = 0; k < numPixels; k++) {
  207040. if (k & 7) {
  207041. mb = bitset[k >> 3];
  207042. mb <<= k & 7;
  207043. } else {
  207044. mb = bitset[k >> 3];
  207045. }
  207046. if (mb & 128) {
  207047. resultMask[k] = 1;
  207048. }
  207049. }
  207050. data.pixels.resultMask = resultMask;
  207051. mask.bitset = bitset;
  207052. ptr += mask.numBytes;
  207053. }
  207054. data.ptr = ptr;
  207055. data.mask = mask;
  207056. return true;
  207057. },
  207058. readDataOneSweep: function(input, data, OutPixelTypeArray) {
  207059. var ptr = data.ptr;
  207060. var headerInfo = data.headerInfo;
  207061. var numDims = headerInfo.numDims;
  207062. var numPixels = headerInfo.width * headerInfo.height;
  207063. var imageType = headerInfo.imageType;
  207064. var numBytes = headerInfo.numValidPixel * Lerc2Helpers.getDataTypeSize(imageType) * numDims;
  207065. var rawData;
  207066. var mask = data.pixels.resultMask;
  207067. if (OutPixelTypeArray === Uint8Array) {
  207068. rawData = new Uint8Array(input, ptr, numBytes);
  207069. } else {
  207070. var arrayBuf = new ArrayBuffer(numBytes);
  207071. var store8 = new Uint8Array(arrayBuf);
  207072. store8.set(new Uint8Array(input, ptr, numBytes));
  207073. rawData = new OutPixelTypeArray(arrayBuf);
  207074. }
  207075. if (rawData.length === numPixels * numDims) {
  207076. data.pixels.resultPixels = rawData;
  207077. } else {
  207078. data.pixels.resultPixels = new OutPixelTypeArray(numPixels * numDims);
  207079. var z = 0, k = 0, i2 = 0, nStart = 0;
  207080. if (numDims > 1) {
  207081. for (i2 = 0; i2 < numDims; i2++) {
  207082. nStart = i2 * numPixels;
  207083. for (k = 0; k < numPixels; k++) {
  207084. if (mask[k]) {
  207085. data.pixels.resultPixels[nStart + k] = rawData[z++];
  207086. }
  207087. }
  207088. }
  207089. } else {
  207090. for (k = 0; k < numPixels; k++) {
  207091. if (mask[k]) {
  207092. data.pixels.resultPixels[k] = rawData[z++];
  207093. }
  207094. }
  207095. }
  207096. }
  207097. ptr += numBytes;
  207098. data.ptr = ptr;
  207099. return true;
  207100. },
  207101. readHuffmanTree: function(input, data) {
  207102. var BITS_MAX = this.HUFFMAN_LUT_BITS_MAX;
  207103. var view = new DataView(input, data.ptr, 16);
  207104. data.ptr += 16;
  207105. var version = view.getInt32(0, true);
  207106. if (version < 2) {
  207107. throw "unsupported Huffman version";
  207108. }
  207109. var size = view.getInt32(4, true);
  207110. var i0 = view.getInt32(8, true);
  207111. var i1 = view.getInt32(12, true);
  207112. if (i0 >= i1) {
  207113. return false;
  207114. }
  207115. var blockDataBuffer = new Uint32Array(i1 - i0);
  207116. Lerc2Helpers.decodeBits(input, data, blockDataBuffer);
  207117. var codeTable = [];
  207118. var i2, j, k, len;
  207119. for (i2 = i0; i2 < i1; i2++) {
  207120. j = i2 - (i2 < size ? 0 : size);
  207121. codeTable[j] = { first: blockDataBuffer[i2 - i0], second: null };
  207122. }
  207123. var dataBytes = input.byteLength - data.ptr;
  207124. var dataWords = Math.ceil(dataBytes / 4);
  207125. var arrayBuf = new ArrayBuffer(dataWords * 4);
  207126. var store8 = new Uint8Array(arrayBuf);
  207127. store8.set(new Uint8Array(input, data.ptr, dataBytes));
  207128. var stuffedData = new Uint32Array(arrayBuf);
  207129. var bitPos = 0, word, srcPtr = 0;
  207130. word = stuffedData[0];
  207131. for (i2 = i0; i2 < i1; i2++) {
  207132. j = i2 - (i2 < size ? 0 : size);
  207133. len = codeTable[j].first;
  207134. if (len > 0) {
  207135. codeTable[j].second = word << bitPos >>> 32 - len;
  207136. if (32 - bitPos >= len) {
  207137. bitPos += len;
  207138. if (bitPos === 32) {
  207139. bitPos = 0;
  207140. srcPtr++;
  207141. word = stuffedData[srcPtr];
  207142. }
  207143. } else {
  207144. bitPos += len - 32;
  207145. srcPtr++;
  207146. word = stuffedData[srcPtr];
  207147. codeTable[j].second |= word >>> 32 - bitPos;
  207148. }
  207149. }
  207150. }
  207151. var numBitsLUT = 0, numBitsLUTQick = 0;
  207152. var tree = new TreeNode();
  207153. for (i2 = 0; i2 < codeTable.length; i2++) {
  207154. if (codeTable[i2] !== void 0) {
  207155. numBitsLUT = Math.max(numBitsLUT, codeTable[i2].first);
  207156. }
  207157. }
  207158. if (numBitsLUT >= BITS_MAX) {
  207159. numBitsLUTQick = BITS_MAX;
  207160. } else {
  207161. numBitsLUTQick = numBitsLUT;
  207162. }
  207163. if (numBitsLUT >= 30) {
  207164. console.log("WARning, large NUM LUT BITS IS " + numBitsLUT);
  207165. }
  207166. var decodeLut = [], entry, code, numEntries, jj, currentBit, node;
  207167. for (i2 = i0; i2 < i1; i2++) {
  207168. j = i2 - (i2 < size ? 0 : size);
  207169. len = codeTable[j].first;
  207170. if (len > 0) {
  207171. entry = [len, j];
  207172. if (len <= numBitsLUTQick) {
  207173. code = codeTable[j].second << numBitsLUTQick - len;
  207174. numEntries = 1 << numBitsLUTQick - len;
  207175. for (k = 0; k < numEntries; k++) {
  207176. decodeLut[code | k] = entry;
  207177. }
  207178. } else {
  207179. code = codeTable[j].second;
  207180. node = tree;
  207181. for (jj = len - 1; jj >= 0; jj--) {
  207182. currentBit = code >>> jj & 1;
  207183. if (currentBit) {
  207184. if (!node.right) {
  207185. node.right = new TreeNode();
  207186. }
  207187. node = node.right;
  207188. } else {
  207189. if (!node.left) {
  207190. node.left = new TreeNode();
  207191. }
  207192. node = node.left;
  207193. }
  207194. if (jj === 0 && !node.val) {
  207195. node.val = entry[1];
  207196. }
  207197. }
  207198. }
  207199. }
  207200. }
  207201. return {
  207202. decodeLut,
  207203. numBitsLUTQick,
  207204. numBitsLUT,
  207205. tree,
  207206. stuffedData,
  207207. srcPtr,
  207208. bitPos
  207209. };
  207210. },
  207211. readHuffman: function(input, data, OutPixelTypeArray) {
  207212. var headerInfo = data.headerInfo;
  207213. var numDims = headerInfo.numDims;
  207214. var height = data.headerInfo.height;
  207215. var width = data.headerInfo.width;
  207216. var numPixels = width * height;
  207217. var huffmanInfo = this.readHuffmanTree(input, data);
  207218. var decodeLut = huffmanInfo.decodeLut;
  207219. var tree = huffmanInfo.tree;
  207220. var stuffedData = huffmanInfo.stuffedData;
  207221. var srcPtr = huffmanInfo.srcPtr;
  207222. var bitPos = huffmanInfo.bitPos;
  207223. var numBitsLUTQick = huffmanInfo.numBitsLUTQick;
  207224. var numBitsLUT = huffmanInfo.numBitsLUT;
  207225. var offset2 = data.headerInfo.imageType === 0 ? 128 : 0;
  207226. var node, val, delta, mask = data.pixels.resultMask, valTmp, valTmpQuick, currentBit;
  207227. var i2, j, k, ii;
  207228. var prevVal = 0;
  207229. if (bitPos > 0) {
  207230. srcPtr++;
  207231. bitPos = 0;
  207232. }
  207233. var word = stuffedData[srcPtr];
  207234. var deltaEncode = data.encodeMode === 1;
  207235. var resultPixelsAllDim = new OutPixelTypeArray(numPixels * numDims);
  207236. var resultPixels = resultPixelsAllDim;
  207237. var iDim;
  207238. for (iDim = 0; iDim < headerInfo.numDims; iDim++) {
  207239. if (numDims > 1) {
  207240. resultPixels = new OutPixelTypeArray(resultPixelsAllDim.buffer, numPixels * iDim, numPixels);
  207241. prevVal = 0;
  207242. }
  207243. if (data.headerInfo.numValidPixel === width * height) {
  207244. for (k = 0, i2 = 0; i2 < height; i2++) {
  207245. for (j = 0; j < width; j++, k++) {
  207246. val = 0;
  207247. valTmp = word << bitPos >>> 32 - numBitsLUTQick;
  207248. valTmpQuick = valTmp;
  207249. if (32 - bitPos < numBitsLUTQick) {
  207250. valTmp |= stuffedData[srcPtr + 1] >>> 64 - bitPos - numBitsLUTQick;
  207251. valTmpQuick = valTmp;
  207252. }
  207253. if (decodeLut[valTmpQuick]) {
  207254. val = decodeLut[valTmpQuick][1];
  207255. bitPos += decodeLut[valTmpQuick][0];
  207256. } else {
  207257. valTmp = word << bitPos >>> 32 - numBitsLUT;
  207258. valTmpQuick = valTmp;
  207259. if (32 - bitPos < numBitsLUT) {
  207260. valTmp |= stuffedData[srcPtr + 1] >>> 64 - bitPos - numBitsLUT;
  207261. valTmpQuick = valTmp;
  207262. }
  207263. node = tree;
  207264. for (ii = 0; ii < numBitsLUT; ii++) {
  207265. currentBit = valTmp >>> numBitsLUT - ii - 1 & 1;
  207266. node = currentBit ? node.right : node.left;
  207267. if (!(node.left || node.right)) {
  207268. val = node.val;
  207269. bitPos = bitPos + ii + 1;
  207270. break;
  207271. }
  207272. }
  207273. }
  207274. if (bitPos >= 32) {
  207275. bitPos -= 32;
  207276. srcPtr++;
  207277. word = stuffedData[srcPtr];
  207278. }
  207279. delta = val - offset2;
  207280. if (deltaEncode) {
  207281. if (j > 0) {
  207282. delta += prevVal;
  207283. } else if (i2 > 0) {
  207284. delta += resultPixels[k - width];
  207285. } else {
  207286. delta += prevVal;
  207287. }
  207288. delta &= 255;
  207289. resultPixels[k] = delta;
  207290. prevVal = delta;
  207291. } else {
  207292. resultPixels[k] = delta;
  207293. }
  207294. }
  207295. }
  207296. } else {
  207297. for (k = 0, i2 = 0; i2 < height; i2++) {
  207298. for (j = 0; j < width; j++, k++) {
  207299. if (mask[k]) {
  207300. val = 0;
  207301. valTmp = word << bitPos >>> 32 - numBitsLUTQick;
  207302. valTmpQuick = valTmp;
  207303. if (32 - bitPos < numBitsLUTQick) {
  207304. valTmp |= stuffedData[srcPtr + 1] >>> 64 - bitPos - numBitsLUTQick;
  207305. valTmpQuick = valTmp;
  207306. }
  207307. if (decodeLut[valTmpQuick]) {
  207308. val = decodeLut[valTmpQuick][1];
  207309. bitPos += decodeLut[valTmpQuick][0];
  207310. } else {
  207311. valTmp = word << bitPos >>> 32 - numBitsLUT;
  207312. valTmpQuick = valTmp;
  207313. if (32 - bitPos < numBitsLUT) {
  207314. valTmp |= stuffedData[srcPtr + 1] >>> 64 - bitPos - numBitsLUT;
  207315. valTmpQuick = valTmp;
  207316. }
  207317. node = tree;
  207318. for (ii = 0; ii < numBitsLUT; ii++) {
  207319. currentBit = valTmp >>> numBitsLUT - ii - 1 & 1;
  207320. node = currentBit ? node.right : node.left;
  207321. if (!(node.left || node.right)) {
  207322. val = node.val;
  207323. bitPos = bitPos + ii + 1;
  207324. break;
  207325. }
  207326. }
  207327. }
  207328. if (bitPos >= 32) {
  207329. bitPos -= 32;
  207330. srcPtr++;
  207331. word = stuffedData[srcPtr];
  207332. }
  207333. delta = val - offset2;
  207334. if (deltaEncode) {
  207335. if (j > 0 && mask[k - 1]) {
  207336. delta += prevVal;
  207337. } else if (i2 > 0 && mask[k - width]) {
  207338. delta += resultPixels[k - width];
  207339. } else {
  207340. delta += prevVal;
  207341. }
  207342. delta &= 255;
  207343. resultPixels[k] = delta;
  207344. prevVal = delta;
  207345. } else {
  207346. resultPixels[k] = delta;
  207347. }
  207348. }
  207349. }
  207350. }
  207351. }
  207352. data.ptr = data.ptr + (srcPtr + 1) * 4 + (bitPos > 0 ? 4 : 0);
  207353. }
  207354. data.pixels.resultPixels = resultPixelsAllDim;
  207355. },
  207356. decodeBits: function(input, data, blockDataBuffer, offset2, iDim) {
  207357. {
  207358. var headerInfo = data.headerInfo;
  207359. var fileVersion = headerInfo.fileVersion;
  207360. var blockPtr = 0;
  207361. var view = new DataView(input, data.ptr, 5);
  207362. var headerByte = view.getUint8(0);
  207363. blockPtr++;
  207364. var bits67 = headerByte >> 6;
  207365. var n2 = bits67 === 0 ? 4 : 3 - bits67;
  207366. var doLut = (headerByte & 32) > 0 ? true : false;
  207367. var numBits = headerByte & 31;
  207368. var numElements = 0;
  207369. if (n2 === 1) {
  207370. numElements = view.getUint8(blockPtr);
  207371. blockPtr++;
  207372. } else if (n2 === 2) {
  207373. numElements = view.getUint16(blockPtr, true);
  207374. blockPtr += 2;
  207375. } else if (n2 === 4) {
  207376. numElements = view.getUint32(blockPtr, true);
  207377. blockPtr += 4;
  207378. } else {
  207379. throw "Invalid valid pixel count type";
  207380. }
  207381. var scale = 2 * headerInfo.maxZError;
  207382. var stuffedData, arrayBuf, store8, dataBytes, dataWords;
  207383. var lutArr, lutData, lutBytes, bitsPerPixel;
  207384. var zMax = headerInfo.numDims > 1 ? headerInfo.maxValues[iDim] : headerInfo.zMax;
  207385. if (doLut) {
  207386. data.counter.lut++;
  207387. lutBytes = view.getUint8(blockPtr);
  207388. blockPtr++;
  207389. dataBytes = Math.ceil((lutBytes - 1) * numBits / 8);
  207390. dataWords = Math.ceil(dataBytes / 4);
  207391. arrayBuf = new ArrayBuffer(dataWords * 4);
  207392. store8 = new Uint8Array(arrayBuf);
  207393. data.ptr += blockPtr;
  207394. store8.set(new Uint8Array(input, data.ptr, dataBytes));
  207395. lutData = new Uint32Array(arrayBuf);
  207396. data.ptr += dataBytes;
  207397. bitsPerPixel = 0;
  207398. while (lutBytes - 1 >>> bitsPerPixel) {
  207399. bitsPerPixel++;
  207400. }
  207401. dataBytes = Math.ceil(numElements * bitsPerPixel / 8);
  207402. dataWords = Math.ceil(dataBytes / 4);
  207403. arrayBuf = new ArrayBuffer(dataWords * 4);
  207404. store8 = new Uint8Array(arrayBuf);
  207405. store8.set(new Uint8Array(input, data.ptr, dataBytes));
  207406. stuffedData = new Uint32Array(arrayBuf);
  207407. data.ptr += dataBytes;
  207408. if (fileVersion >= 3) {
  207409. lutArr = BitStuffer.unstuffLUT2(lutData, numBits, lutBytes - 1, offset2, scale, zMax);
  207410. } else {
  207411. lutArr = BitStuffer.unstuffLUT(lutData, numBits, lutBytes - 1, offset2, scale, zMax);
  207412. }
  207413. if (fileVersion >= 3) {
  207414. BitStuffer.unstuff2(stuffedData, blockDataBuffer, bitsPerPixel, numElements, lutArr);
  207415. } else {
  207416. BitStuffer.unstuff(stuffedData, blockDataBuffer, bitsPerPixel, numElements, lutArr);
  207417. }
  207418. } else {
  207419. data.counter.bitstuffer++;
  207420. bitsPerPixel = numBits;
  207421. data.ptr += blockPtr;
  207422. if (bitsPerPixel > 0) {
  207423. dataBytes = Math.ceil(numElements * bitsPerPixel / 8);
  207424. dataWords = Math.ceil(dataBytes / 4);
  207425. arrayBuf = new ArrayBuffer(dataWords * 4);
  207426. store8 = new Uint8Array(arrayBuf);
  207427. store8.set(new Uint8Array(input, data.ptr, dataBytes));
  207428. stuffedData = new Uint32Array(arrayBuf);
  207429. data.ptr += dataBytes;
  207430. if (fileVersion >= 3) {
  207431. if (offset2 == null) {
  207432. BitStuffer.originalUnstuff2(stuffedData, blockDataBuffer, bitsPerPixel, numElements);
  207433. } else {
  207434. BitStuffer.unstuff2(stuffedData, blockDataBuffer, bitsPerPixel, numElements, false, offset2, scale, zMax);
  207435. }
  207436. } else {
  207437. if (offset2 == null) {
  207438. BitStuffer.originalUnstuff(stuffedData, blockDataBuffer, bitsPerPixel, numElements);
  207439. } else {
  207440. BitStuffer.unstuff(stuffedData, blockDataBuffer, bitsPerPixel, numElements, false, offset2, scale, zMax);
  207441. }
  207442. }
  207443. }
  207444. }
  207445. }
  207446. },
  207447. readTiles: function(input, data, OutPixelTypeArray) {
  207448. var headerInfo = data.headerInfo;
  207449. var width = headerInfo.width;
  207450. var height = headerInfo.height;
  207451. var microBlockSize = headerInfo.microBlockSize;
  207452. var imageType = headerInfo.imageType;
  207453. var dataTypeSize = Lerc2Helpers.getDataTypeSize(imageType);
  207454. var numBlocksX = Math.ceil(width / microBlockSize);
  207455. var numBlocksY = Math.ceil(height / microBlockSize);
  207456. data.pixels.numBlocksY = numBlocksY;
  207457. data.pixels.numBlocksX = numBlocksX;
  207458. data.pixels.ptr = 0;
  207459. var row = 0, col = 0, blockY = 0, blockX = 0, thisBlockHeight = 0, thisBlockWidth = 0, bytesLeft = 0, headerByte = 0, bits67 = 0, testCode = 0, outPtr = 0, outStride = 0, numBytes = 0, bytesleft = 0, z = 0, blockPtr = 0;
  207460. var view, block, arrayBuf, store8, rawData;
  207461. var blockEncoding;
  207462. var blockDataBuffer = new OutPixelTypeArray(microBlockSize * microBlockSize);
  207463. var lastBlockHeight = height % microBlockSize || microBlockSize;
  207464. var lastBlockWidth = width % microBlockSize || microBlockSize;
  207465. var offsetType, offset2;
  207466. var numDims = headerInfo.numDims, iDim;
  207467. var mask = data.pixels.resultMask;
  207468. var resultPixels = data.pixels.resultPixels;
  207469. for (blockY = 0; blockY < numBlocksY; blockY++) {
  207470. thisBlockHeight = blockY !== numBlocksY - 1 ? microBlockSize : lastBlockHeight;
  207471. for (blockX = 0; blockX < numBlocksX; blockX++) {
  207472. thisBlockWidth = blockX !== numBlocksX - 1 ? microBlockSize : lastBlockWidth;
  207473. outPtr = blockY * width * microBlockSize + blockX * microBlockSize;
  207474. outStride = width - thisBlockWidth;
  207475. for (iDim = 0; iDim < numDims; iDim++) {
  207476. if (numDims > 1) {
  207477. resultPixels = new OutPixelTypeArray(data.pixels.resultPixels.buffer, width * height * iDim * dataTypeSize, width * height);
  207478. }
  207479. bytesLeft = input.byteLength - data.ptr;
  207480. view = new DataView(input, data.ptr, Math.min(10, bytesLeft));
  207481. block = {};
  207482. blockPtr = 0;
  207483. headerByte = view.getUint8(0);
  207484. blockPtr++;
  207485. bits67 = headerByte >> 6 & 255;
  207486. testCode = headerByte >> 2 & 15;
  207487. if (testCode !== (blockX * microBlockSize >> 3 & 15)) {
  207488. throw "integrity issue";
  207489. }
  207490. blockEncoding = headerByte & 3;
  207491. if (blockEncoding > 3) {
  207492. data.ptr += blockPtr;
  207493. throw "Invalid block encoding (" + blockEncoding + ")";
  207494. } else if (blockEncoding === 2) {
  207495. data.counter.constant++;
  207496. data.ptr += blockPtr;
  207497. continue;
  207498. } else if (blockEncoding === 0) {
  207499. data.counter.uncompressed++;
  207500. data.ptr += blockPtr;
  207501. numBytes = thisBlockHeight * thisBlockWidth * dataTypeSize;
  207502. bytesleft = input.byteLength - data.ptr;
  207503. numBytes = numBytes < bytesleft ? numBytes : bytesleft;
  207504. arrayBuf = new ArrayBuffer(numBytes % dataTypeSize === 0 ? numBytes : numBytes + dataTypeSize - numBytes % dataTypeSize);
  207505. store8 = new Uint8Array(arrayBuf);
  207506. store8.set(new Uint8Array(input, data.ptr, numBytes));
  207507. rawData = new OutPixelTypeArray(arrayBuf);
  207508. z = 0;
  207509. if (mask) {
  207510. for (row = 0; row < thisBlockHeight; row++) {
  207511. for (col = 0; col < thisBlockWidth; col++) {
  207512. if (mask[outPtr]) {
  207513. resultPixels[outPtr] = rawData[z++];
  207514. }
  207515. outPtr++;
  207516. }
  207517. outPtr += outStride;
  207518. }
  207519. } else {
  207520. for (row = 0; row < thisBlockHeight; row++) {
  207521. for (col = 0; col < thisBlockWidth; col++) {
  207522. resultPixels[outPtr++] = rawData[z++];
  207523. }
  207524. outPtr += outStride;
  207525. }
  207526. }
  207527. data.ptr += z * dataTypeSize;
  207528. } else {
  207529. offsetType = Lerc2Helpers.getDataTypeUsed(imageType, bits67);
  207530. offset2 = Lerc2Helpers.getOnePixel(block, blockPtr, offsetType, view);
  207531. blockPtr += Lerc2Helpers.getDataTypeSize(offsetType);
  207532. if (blockEncoding === 3) {
  207533. data.ptr += blockPtr;
  207534. data.counter.constantoffset++;
  207535. if (mask) {
  207536. for (row = 0; row < thisBlockHeight; row++) {
  207537. for (col = 0; col < thisBlockWidth; col++) {
  207538. if (mask[outPtr]) {
  207539. resultPixels[outPtr] = offset2;
  207540. }
  207541. outPtr++;
  207542. }
  207543. outPtr += outStride;
  207544. }
  207545. } else {
  207546. for (row = 0; row < thisBlockHeight; row++) {
  207547. for (col = 0; col < thisBlockWidth; col++) {
  207548. resultPixels[outPtr++] = offset2;
  207549. }
  207550. outPtr += outStride;
  207551. }
  207552. }
  207553. } else {
  207554. data.ptr += blockPtr;
  207555. Lerc2Helpers.decodeBits(input, data, blockDataBuffer, offset2, iDim);
  207556. blockPtr = 0;
  207557. if (mask) {
  207558. for (row = 0; row < thisBlockHeight; row++) {
  207559. for (col = 0; col < thisBlockWidth; col++) {
  207560. if (mask[outPtr]) {
  207561. resultPixels[outPtr] = blockDataBuffer[blockPtr++];
  207562. }
  207563. outPtr++;
  207564. }
  207565. outPtr += outStride;
  207566. }
  207567. } else {
  207568. for (row = 0; row < thisBlockHeight; row++) {
  207569. for (col = 0; col < thisBlockWidth; col++) {
  207570. resultPixels[outPtr++] = blockDataBuffer[blockPtr++];
  207571. }
  207572. outPtr += outStride;
  207573. }
  207574. }
  207575. }
  207576. }
  207577. }
  207578. }
  207579. }
  207580. },
  207581. formatFileInfo: function(data) {
  207582. return {
  207583. "fileIdentifierString": data.headerInfo.fileIdentifierString,
  207584. "fileVersion": data.headerInfo.fileVersion,
  207585. "imageType": data.headerInfo.imageType,
  207586. "height": data.headerInfo.height,
  207587. "width": data.headerInfo.width,
  207588. "numValidPixel": data.headerInfo.numValidPixel,
  207589. "microBlockSize": data.headerInfo.microBlockSize,
  207590. "blobSize": data.headerInfo.blobSize,
  207591. "maxZError": data.headerInfo.maxZError,
  207592. "pixelType": Lerc2Helpers.getPixelType(data.headerInfo.imageType),
  207593. "eofOffset": data.eofOffset,
  207594. "mask": data.mask ? {
  207595. "numBytes": data.mask.numBytes
  207596. } : null,
  207597. "pixels": {
  207598. "numBlocksX": data.pixels.numBlocksX,
  207599. "numBlocksY": data.pixels.numBlocksY,
  207600. "maxValue": data.headerInfo.zMax,
  207601. "minValue": data.headerInfo.zMin,
  207602. "noDataValue": data.noDataValue
  207603. }
  207604. };
  207605. },
  207606. constructConstantSurface: function(data) {
  207607. var val = data.headerInfo.zMax;
  207608. var numDims = data.headerInfo.numDims;
  207609. var numPixels = data.headerInfo.height * data.headerInfo.width;
  207610. var numPixelAllDims = numPixels * numDims;
  207611. var i2 = 0, k = 0, nStart = 0;
  207612. var mask = data.pixels.resultMask;
  207613. if (mask) {
  207614. if (numDims > 1) {
  207615. for (i2 = 0; i2 < numDims; i2++) {
  207616. nStart = i2 * numPixels;
  207617. for (k = 0; k < numPixels; k++) {
  207618. if (mask[k]) {
  207619. data.pixels.resultPixels[nStart + k] = val;
  207620. }
  207621. }
  207622. }
  207623. } else {
  207624. for (k = 0; k < numPixels; k++) {
  207625. if (mask[k]) {
  207626. data.pixels.resultPixels[k] = val;
  207627. }
  207628. }
  207629. }
  207630. } else {
  207631. if (data.pixels.resultPixels.fill) {
  207632. data.pixels.resultPixels.fill(val);
  207633. } else {
  207634. for (k = 0; k < numPixelAllDims; k++) {
  207635. data.pixels.resultPixels[k] = val;
  207636. }
  207637. }
  207638. }
  207639. return;
  207640. },
  207641. getDataTypeArray: function(t) {
  207642. var tp;
  207643. switch (t) {
  207644. case 0:
  207645. tp = Int8Array;
  207646. break;
  207647. case 1:
  207648. tp = Uint8Array;
  207649. break;
  207650. case 2:
  207651. tp = Int16Array;
  207652. break;
  207653. case 3:
  207654. tp = Uint16Array;
  207655. break;
  207656. case 4:
  207657. tp = Int32Array;
  207658. break;
  207659. case 5:
  207660. tp = Uint32Array;
  207661. break;
  207662. case 6:
  207663. tp = Float32Array;
  207664. break;
  207665. case 7:
  207666. tp = Float64Array;
  207667. break;
  207668. default:
  207669. tp = Float32Array;
  207670. }
  207671. return tp;
  207672. },
  207673. getPixelType: function(t) {
  207674. var tp;
  207675. switch (t) {
  207676. case 0:
  207677. tp = "S8";
  207678. break;
  207679. case 1:
  207680. tp = "U8";
  207681. break;
  207682. case 2:
  207683. tp = "S16";
  207684. break;
  207685. case 3:
  207686. tp = "U16";
  207687. break;
  207688. case 4:
  207689. tp = "S32";
  207690. break;
  207691. case 5:
  207692. tp = "U32";
  207693. break;
  207694. case 6:
  207695. tp = "F32";
  207696. break;
  207697. case 7:
  207698. tp = "F64";
  207699. break;
  207700. default:
  207701. tp = "F32";
  207702. }
  207703. return tp;
  207704. },
  207705. isValidPixelValue: function(t, val) {
  207706. if (val == null) {
  207707. return false;
  207708. }
  207709. var isValid;
  207710. switch (t) {
  207711. case 0:
  207712. isValid = val >= -128 && val <= 127;
  207713. break;
  207714. case 1:
  207715. isValid = val >= 0 && val <= 255;
  207716. break;
  207717. case 2:
  207718. isValid = val >= -32768 && val <= 32767;
  207719. break;
  207720. case 3:
  207721. isValid = val >= 0 && val <= 65536;
  207722. break;
  207723. case 4:
  207724. isValid = val >= -2147483648 && val <= 2147483647;
  207725. break;
  207726. case 5:
  207727. isValid = val >= 0 && val <= 4294967296;
  207728. break;
  207729. case 6:
  207730. isValid = val >= -34027999387901484e22 && val <= 34027999387901484e22;
  207731. break;
  207732. case 7:
  207733. isValid = val >= 5e-324 && val <= 17976931348623157e292;
  207734. break;
  207735. default:
  207736. isValid = false;
  207737. }
  207738. return isValid;
  207739. },
  207740. getDataTypeSize: function(t) {
  207741. var s2 = 0;
  207742. switch (t) {
  207743. case 0:
  207744. case 1:
  207745. s2 = 1;
  207746. break;
  207747. case 2:
  207748. case 3:
  207749. s2 = 2;
  207750. break;
  207751. case 4:
  207752. case 5:
  207753. case 6:
  207754. s2 = 4;
  207755. break;
  207756. case 7:
  207757. s2 = 8;
  207758. break;
  207759. default:
  207760. s2 = t;
  207761. }
  207762. return s2;
  207763. },
  207764. getDataTypeUsed: function(dt, tc) {
  207765. var t = dt;
  207766. switch (dt) {
  207767. case 2:
  207768. case 4:
  207769. t = dt - tc;
  207770. break;
  207771. case 3:
  207772. case 5:
  207773. t = dt - 2 * tc;
  207774. break;
  207775. case 6:
  207776. if (0 === tc) {
  207777. t = dt;
  207778. } else if (1 === tc) {
  207779. t = 2;
  207780. } else {
  207781. t = 1;
  207782. }
  207783. break;
  207784. case 7:
  207785. if (0 === tc) {
  207786. t = dt;
  207787. } else {
  207788. t = dt - 2 * tc + 1;
  207789. }
  207790. break;
  207791. default:
  207792. t = dt;
  207793. break;
  207794. }
  207795. return t;
  207796. },
  207797. getOnePixel: function(block, blockPtr, offsetType, view) {
  207798. var temp = 0;
  207799. switch (offsetType) {
  207800. case 0:
  207801. temp = view.getInt8(blockPtr);
  207802. break;
  207803. case 1:
  207804. temp = view.getUint8(blockPtr);
  207805. break;
  207806. case 2:
  207807. temp = view.getInt16(blockPtr, true);
  207808. break;
  207809. case 3:
  207810. temp = view.getUint16(blockPtr, true);
  207811. break;
  207812. case 4:
  207813. temp = view.getInt32(blockPtr, true);
  207814. break;
  207815. case 5:
  207816. temp = view.getUInt32(blockPtr, true);
  207817. break;
  207818. case 6:
  207819. temp = view.getFloat32(blockPtr, true);
  207820. break;
  207821. case 7:
  207822. temp = view.getFloat64(blockPtr, true);
  207823. break;
  207824. default:
  207825. throw "the decoder does not understand this pixel type";
  207826. }
  207827. return temp;
  207828. }
  207829. };
  207830. var TreeNode = function(val, left, right) {
  207831. this.val = val;
  207832. this.left = left;
  207833. this.right = right;
  207834. };
  207835. var Lerc2Decode2 = {
  207836. decode: function(input, options) {
  207837. options = options || {};
  207838. var noDataValue = options.noDataValue;
  207839. var i2 = 0, data = {};
  207840. data.ptr = options.inputOffset || 0;
  207841. data.pixels = {};
  207842. if (!Lerc2Helpers.readHeaderInfo(input, data))
  207843. ;
  207844. var headerInfo = data.headerInfo;
  207845. var fileVersion = headerInfo.fileVersion;
  207846. var OutPixelTypeArray = Lerc2Helpers.getDataTypeArray(headerInfo.imageType);
  207847. Lerc2Helpers.readMask(input, data);
  207848. if (headerInfo.numValidPixel !== headerInfo.width * headerInfo.height && !data.pixels.resultMask) {
  207849. data.pixels.resultMask = options.maskData;
  207850. }
  207851. var numPixels = headerInfo.width * headerInfo.height;
  207852. data.pixels.resultPixels = new OutPixelTypeArray(numPixels * headerInfo.numDims);
  207853. data.counter = {
  207854. onesweep: 0,
  207855. uncompressed: 0,
  207856. lut: 0,
  207857. bitstuffer: 0,
  207858. constant: 0,
  207859. constantoffset: 0
  207860. };
  207861. if (headerInfo.numValidPixel !== 0) {
  207862. if (headerInfo.zMax === headerInfo.zMin) {
  207863. Lerc2Helpers.constructConstantSurface(data);
  207864. } else if (fileVersion >= 4 && Lerc2Helpers.checkMinMaxRanges(input, data)) {
  207865. Lerc2Helpers.constructConstantSurface(data);
  207866. } else {
  207867. var view = new DataView(input, data.ptr, 2);
  207868. var bReadDataOneSweep = view.getUint8(0);
  207869. data.ptr++;
  207870. if (bReadDataOneSweep) {
  207871. Lerc2Helpers.readDataOneSweep(input, data, OutPixelTypeArray);
  207872. } else {
  207873. if (fileVersion > 1 && headerInfo.imageType <= 1 && Math.abs(headerInfo.maxZError - 0.5) < 1e-5) {
  207874. var flagHuffman = view.getUint8(1);
  207875. data.ptr++;
  207876. data.encodeMode = flagHuffman;
  207877. if (flagHuffman > 2 || fileVersion < 4 && flagHuffman > 1) {
  207878. throw "Invalid Huffman flag " + flagHuffman;
  207879. }
  207880. if (flagHuffman) {
  207881. Lerc2Helpers.readHuffman(input, data, OutPixelTypeArray);
  207882. } else {
  207883. Lerc2Helpers.readTiles(input, data, OutPixelTypeArray);
  207884. }
  207885. } else {
  207886. Lerc2Helpers.readTiles(input, data, OutPixelTypeArray);
  207887. }
  207888. }
  207889. }
  207890. }
  207891. data.eofOffset = data.ptr;
  207892. var diff;
  207893. if (options.inputOffset) {
  207894. diff = data.headerInfo.blobSize + options.inputOffset - data.ptr;
  207895. if (Math.abs(diff) >= 1) {
  207896. data.eofOffset = options.inputOffset + data.headerInfo.blobSize;
  207897. }
  207898. } else {
  207899. diff = data.headerInfo.blobSize - data.ptr;
  207900. if (Math.abs(diff) >= 1) {
  207901. data.eofOffset = data.headerInfo.blobSize;
  207902. }
  207903. }
  207904. var result = {
  207905. width: headerInfo.width,
  207906. height: headerInfo.height,
  207907. pixelData: data.pixels.resultPixels,
  207908. minValue: headerInfo.zMin,
  207909. maxValue: headerInfo.zMax,
  207910. validPixelCount: headerInfo.numValidPixel,
  207911. dimCount: headerInfo.numDims,
  207912. dimStats: {
  207913. minValues: headerInfo.minValues,
  207914. maxValues: headerInfo.maxValues
  207915. },
  207916. maskData: data.pixels.resultMask
  207917. };
  207918. if (data.pixels.resultMask && Lerc2Helpers.isValidPixelValue(headerInfo.imageType, noDataValue)) {
  207919. var mask = data.pixels.resultMask;
  207920. for (i2 = 0; i2 < numPixels; i2++) {
  207921. if (!mask[i2]) {
  207922. result.pixelData[i2] = noDataValue;
  207923. }
  207924. }
  207925. result.noDataValue = noDataValue;
  207926. }
  207927. data.noDataValue = noDataValue;
  207928. if (options.returnFileInfo) {
  207929. result.fileInfo = Lerc2Helpers.formatFileInfo(data);
  207930. }
  207931. return result;
  207932. },
  207933. getBandCount: function(input) {
  207934. var count = 0;
  207935. var i2 = 0;
  207936. var temp = {};
  207937. temp.ptr = 0;
  207938. temp.pixels = {};
  207939. while (i2 < input.byteLength - 58) {
  207940. Lerc2Helpers.readHeaderInfo(input, temp);
  207941. i2 += temp.headerInfo.blobSize;
  207942. count++;
  207943. temp.ptr = i2;
  207944. }
  207945. return count;
  207946. }
  207947. };
  207948. return Lerc2Decode2;
  207949. }();
  207950. var isPlatformLittleEndian = function() {
  207951. var a4 = new ArrayBuffer(4);
  207952. var b = new Uint8Array(a4);
  207953. var c14 = new Uint32Array(a4);
  207954. c14[0] = 1;
  207955. return b[0] === 1;
  207956. }();
  207957. var Lerc = {
  207958. decode: function(encodedData, options) {
  207959. if (!isPlatformLittleEndian) {
  207960. throw "Big endian system is not supported.";
  207961. }
  207962. options = options || {};
  207963. var inputOffset = options.inputOffset || 0;
  207964. var fileIdView = new Uint8Array(encodedData, inputOffset, 10);
  207965. var fileIdentifierString = String.fromCharCode.apply(null, fileIdView);
  207966. var lerc, majorVersion;
  207967. if (fileIdentifierString.trim() === "CntZImage") {
  207968. lerc = LercDecode2;
  207969. majorVersion = 1;
  207970. } else if (fileIdentifierString.substring(0, 5) === "Lerc2") {
  207971. lerc = Lerc2Decode;
  207972. majorVersion = 2;
  207973. } else {
  207974. throw "Unexpected file identifier string: " + fileIdentifierString;
  207975. }
  207976. var iPlane = 0, eof = encodedData.byteLength - 10, encodedMaskData, bandMasks = [], bandMask, maskData;
  207977. var decodedPixelBlock = {
  207978. width: 0,
  207979. height: 0,
  207980. pixels: [],
  207981. pixelType: options.pixelType,
  207982. mask: null,
  207983. statistics: []
  207984. };
  207985. while (inputOffset < eof) {
  207986. var result = lerc.decode(encodedData, {
  207987. inputOffset,
  207988. encodedMaskData,
  207989. maskData,
  207990. returnMask: iPlane === 0 ? true : false,
  207991. returnEncodedMask: iPlane === 0 ? true : false,
  207992. returnFileInfo: true,
  207993. pixelType: options.pixelType || null,
  207994. noDataValue: options.noDataValue || null
  207995. });
  207996. inputOffset = result.fileInfo.eofOffset;
  207997. if (iPlane === 0) {
  207998. encodedMaskData = result.encodedMaskData;
  207999. maskData = result.maskData;
  208000. decodedPixelBlock.width = result.width;
  208001. decodedPixelBlock.height = result.height;
  208002. decodedPixelBlock.dimCount = result.dimCount || 1;
  208003. decodedPixelBlock.pixelType = result.pixelType || result.fileInfo.pixelType;
  208004. decodedPixelBlock.mask = result.maskData;
  208005. }
  208006. if (majorVersion > 1 && result.fileInfo.mask && result.fileInfo.mask.numBytes > 0) {
  208007. bandMasks.push(result.maskData);
  208008. }
  208009. iPlane++;
  208010. decodedPixelBlock.pixels.push(result.pixelData);
  208011. decodedPixelBlock.statistics.push({
  208012. minValue: result.minValue,
  208013. maxValue: result.maxValue,
  208014. noDataValue: result.noDataValue,
  208015. dimStats: result.dimStats
  208016. });
  208017. }
  208018. var i2, j, numPixels;
  208019. if (majorVersion > 1 && bandMasks.length > 1) {
  208020. numPixels = decodedPixelBlock.width * decodedPixelBlock.height;
  208021. decodedPixelBlock.bandMasks = bandMasks;
  208022. maskData = new Uint8Array(numPixels);
  208023. maskData.set(bandMasks[0]);
  208024. for (i2 = 1; i2 < bandMasks.length; i2++) {
  208025. bandMask = bandMasks[i2];
  208026. for (j = 0; j < numPixels; j++) {
  208027. maskData[j] = maskData[j] & bandMask[j];
  208028. }
  208029. }
  208030. decodedPixelBlock.maskData = maskData;
  208031. }
  208032. return decodedPixelBlock;
  208033. }
  208034. };
  208035. if (module2.exports) {
  208036. module2.exports = Lerc;
  208037. } else {
  208038. this.Lerc = Lerc;
  208039. }
  208040. })();
  208041. });
  208042. // node_modules/cesium/Source/ThirdParty/nosleep.js
  208043. var media = {
  208044. webm: "data:video/webm;base64,GkXfo0AgQoaBAUL3gQFC8oEEQvOBCEKCQAR3ZWJtQoeBAkKFgQIYU4BnQI0VSalmQCgq17FAAw9CQE2AQAZ3aGFtbXlXQUAGd2hhbW15RIlACECPQAAAAAAAFlSua0AxrkAu14EBY8WBAZyBACK1nEADdW5khkAFVl9WUDglhohAA1ZQOIOBAeBABrCBCLqBCB9DtnVAIueBAKNAHIEAAIAwAQCdASoIAAgAAUAmJaQAA3AA/vz0AAA=",
  208045. mp4: "data:video/mp4;base64,AAAAIGZ0eXBtcDQyAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAACKBtZGF0AAAC8wYF///v3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE0MiByMjQ3OSBkZDc5YTYxIC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAxNCAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTEgcmVmPTEgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MToweDExMSBtZT1oZXggc3VibWU9MiBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0wIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MCA4eDhkY3Q9MCBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0wIHRocmVhZHM9NiBsb29rYWhlYWRfdGhyZWFkcz0xIHNsaWNlZF90aHJlYWRzPTAgbnI9MCBkZWNpbWF0ZT0xIGludGVybGFjZWQ9MCBibHVyYXlfY29tcGF0PTAgY29uc3RyYWluZWRfaW50cmE9MCBiZnJhbWVzPTMgYl9weXJhbWlkPTIgYl9hZGFwdD0xIGJfYmlhcz0wIGRpcmVjdD0xIHdlaWdodGI9MSBvcGVuX2dvcD0wIHdlaWdodHA9MSBrZXlpbnQ9MzAwIGtleWludF9taW49MzAgc2NlbmVjdXQ9NDAgaW50cmFfcmVmcmVzaD0wIHJjX2xvb2thaGVhZD0xMCByYz1jcmYgbWJ0cmVlPTEgY3JmPTIwLjAgcWNvbXA9MC42MCBxcG1pbj0wIHFwbWF4PTY5IHFwc3RlcD00IHZidl9tYXhyYXRlPTIwMDAwIHZidl9idWZzaXplPTI1MDAwIGNyZl9tYXg9MC4wIG5hbF9ocmQ9bm9uZSBmaWxsZXI9MCBpcF9yYXRpbz0xLjQwIGFxPTE6MS4wMACAAAAAOWWIhAA3//p+C7v8tDDSTjf97w55i3SbRPO4ZY+hkjD5hbkAkL3zpJ6h/LR1CAABzgB1kqqzUorlhQAAAAxBmiQYhn/+qZYADLgAAAAJQZ5CQhX/AAj5IQADQGgcIQADQGgcAAAACQGeYUQn/wALKCEAA0BoHAAAAAkBnmNEJ/8ACykhAANAaBwhAANAaBwAAAANQZpoNExDP/6plgAMuSEAA0BoHAAAAAtBnoZFESwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBnqVEJ/8ACykhAANAaBwAAAAJAZ6nRCf/AAsoIQADQGgcIQADQGgcAAAADUGarDRMQz/+qZYADLghAANAaBwAAAALQZ7KRRUsK/8ACPkhAANAaBwAAAAJAZ7pRCf/AAsoIQADQGgcIQADQGgcAAAACQGe60Qn/wALKCEAA0BoHAAAAA1BmvA0TEM//qmWAAy5IQADQGgcIQADQGgcAAAAC0GfDkUVLCv/AAj5IQADQGgcAAAACQGfLUQn/wALKSEAA0BoHCEAA0BoHAAAAAkBny9EJ/8ACyghAANAaBwAAAANQZs0NExDP/6plgAMuCEAA0BoHAAAAAtBn1JFFSwr/wAI+SEAA0BoHCEAA0BoHAAAAAkBn3FEJ/8ACyghAANAaBwAAAAJAZ9zRCf/AAsoIQADQGgcIQADQGgcAAAADUGbeDRMQz/+qZYADLkhAANAaBwAAAALQZ+WRRUsK/8ACPghAANAaBwhAANAaBwAAAAJAZ+1RCf/AAspIQADQGgcAAAACQGft0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bm7w0TEM//qmWAAy4IQADQGgcAAAAC0Gf2kUVLCv/AAj5IQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHAAAAAkBn/tEJ/8ACykhAANAaBwAAAANQZvgNExDP/6plgAMuSEAA0BoHCEAA0BoHAAAAAtBnh5FFSwr/wAI+CEAA0BoHAAAAAkBnj1EJ/8ACyghAANAaBwhAANAaBwAAAAJAZ4/RCf/AAspIQADQGgcAAAADUGaJDRMQz/+qZYADLghAANAaBwAAAALQZ5CRRUsK/8ACPkhAANAaBwhAANAaBwAAAAJAZ5hRCf/AAsoIQADQGgcAAAACQGeY0Qn/wALKSEAA0BoHCEAA0BoHAAAAA1Bmmg0TEM//qmWAAy5IQADQGgcAAAAC0GehkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGepUQn/wALKSEAA0BoHAAAAAkBnqdEJ/8ACyghAANAaBwAAAANQZqsNExDP/6plgAMuCEAA0BoHCEAA0BoHAAAAAtBnspFFSwr/wAI+SEAA0BoHAAAAAkBnulEJ/8ACyghAANAaBwhAANAaBwAAAAJAZ7rRCf/AAsoIQADQGgcAAAADUGa8DRMQz/+qZYADLkhAANAaBwhAANAaBwAAAALQZ8ORRUsK/8ACPkhAANAaBwAAAAJAZ8tRCf/AAspIQADQGgcIQADQGgcAAAACQGfL0Qn/wALKCEAA0BoHAAAAA1BmzQ0TEM//qmWAAy4IQADQGgcAAAAC0GfUkUVLCv/AAj5IQADQGgcIQADQGgcAAAACQGfcUQn/wALKCEAA0BoHAAAAAkBn3NEJ/8ACyghAANAaBwhAANAaBwAAAANQZt4NExC//6plgAMuSEAA0BoHAAAAAtBn5ZFFSwr/wAI+CEAA0BoHCEAA0BoHAAAAAkBn7VEJ/8ACykhAANAaBwAAAAJAZ+3RCf/AAspIQADQGgcAAAADUGbuzRMQn/+nhAAYsAhAANAaBwhAANAaBwAAAAJQZ/aQhP/AAspIQADQGgcAAAACQGf+UQn/wALKCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHCEAA0BoHAAACiFtb292AAAAbG12aGQAAAAA1YCCX9WAgl8AAAPoAAAH/AABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAAAGGlvZHMAAAAAEICAgAcAT////v7/AAAF+XRyYWsAAABcdGtoZAAAAAPVgIJf1YCCXwAAAAEAAAAAAAAH0AAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAygAAAMoAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAB9AAABdwAAEAAAAABXFtZGlhAAAAIG1kaGQAAAAA1YCCX9WAgl8AAV+QAAK/IFXEAAAAAAAtaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAFZpZGVvSGFuZGxlcgAAAAUcbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAAE3HN0YmwAAACYc3RzZAAAAAAAAAABAAAAiGF2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAygDKAEgAAABIAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY//8AAAAyYXZjQwFNQCj/4QAbZ01AKOyho3ySTUBAQFAAAAMAEAAr8gDxgxlgAQAEaO+G8gAAABhzdHRzAAAAAAAAAAEAAAA8AAALuAAAABRzdHNzAAAAAAAAAAEAAAABAAAB8GN0dHMAAAAAAAAAPAAAAAEAABdwAAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAADqYAAAAAQAAF3AAAAABAAAAAAAAAAEAAAu4AAAAAQAAOpgAAAABAAAXcAAAAAEAAAAAAAAAAQAAC7gAAAABAAA6mAAAAAEAABdwAAAAAQAAAAAAAAABAAALuAAAAAEAAC7gAAAAAQAAF3AAAAABAAAAAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAEEc3RzegAAAAAAAAAAAAAAPAAAAzQAAAAQAAAADQAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAAPAAAADQAAAA0AAAARAAAADwAAAA0AAAANAAAAEQAAAA8AAAANAAAADQAAABEAAAANAAAADQAAAQBzdGNvAAAAAAAAADwAAAAwAAADZAAAA3QAAAONAAADoAAAA7kAAAPQAAAD6wAAA/4AAAQXAAAELgAABEMAAARcAAAEbwAABIwAAAShAAAEugAABM0AAATkAAAE/wAABRIAAAUrAAAFQgAABV0AAAVwAAAFiQAABaAAAAW1AAAFzgAABeEAAAX+AAAGEwAABiwAAAY/AAAGVgAABnEAAAaEAAAGnQAABrQAAAbPAAAG4gAABvUAAAcSAAAHJwAAB0AAAAdTAAAHcAAAB4UAAAeeAAAHsQAAB8gAAAfjAAAH9gAACA8AAAgmAAAIQQAACFQAAAhnAAAIhAAACJcAAAMsdHJhawAAAFx0a2hkAAAAA9WAgl/VgIJfAAAAAgAAAAAAAAf8AAAAAAAAAAAAAAABAQAAAAABAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAACsm1kaWEAAAAgbWRoZAAAAADVgIJf1YCCXwAArEQAAWAAVcQAAAAAACdoZGxyAAAAAAAAAABzb3VuAAAAAAAAAAAAAAAAU3RlcmVvAAAAAmNtaW5mAAAAEHNtaGQAAAAAAAAAAAAAACRkaW5mAAAAHGRyZWYAAAAAAAAAAQAAAAx1cmwgAAAAAQAAAidzdGJsAAAAZ3N0c2QAAAAAAAAAAQAAAFdtcDRhAAAAAAAAAAEAAAAAAAAAAAACABAAAAAArEQAAAAAADNlc2RzAAAAAAOAgIAiAAIABICAgBRAFQAAAAADDUAAAAAABYCAgAISEAaAgIABAgAAABhzdHRzAAAAAAAAAAEAAABYAAAEAAAAABxzdHNjAAAAAAAAAAEAAAABAAAAAQAAAAEAAAAUc3RzegAAAAAAAAAGAAAAWAAAAXBzdGNvAAAAAAAAAFgAAAOBAAADhwAAA5oAAAOtAAADswAAA8oAAAPfAAAD5QAAA/gAAAQLAAAEEQAABCgAAAQ9AAAEUAAABFYAAARpAAAEgAAABIYAAASbAAAErgAABLQAAATHAAAE3gAABPMAAAT5AAAFDAAABR8AAAUlAAAFPAAABVEAAAVXAAAFagAABX0AAAWDAAAFmgAABa8AAAXCAAAFyAAABdsAAAXyAAAF+AAABg0AAAYgAAAGJgAABjkAAAZQAAAGZQAABmsAAAZ+AAAGkQAABpcAAAauAAAGwwAABskAAAbcAAAG7wAABwYAAAcMAAAHIQAABzQAAAc6AAAHTQAAB2QAAAdqAAAHfwAAB5IAAAeYAAAHqwAAB8IAAAfXAAAH3QAAB/AAAAgDAAAICQAACCAAAAg1AAAIOwAACE4AAAhhAAAIeAAACH4AAAiRAAAIpAAACKoAAAiwAAAItgAACLwAAAjCAAAAFnVkdGEAAAAObmFtZVN0ZXJlbwAAAHB1ZHRhAAAAaG1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAAO2lsc3QAAAAzqXRvbwAAACtkYXRhAAAAAQAAAABIYW5kQnJha2UgMC4xMC4yIDIwMTUwNjExMDA="
  208046. };
  208047. var { webm, mp4 } = media;
  208048. var oldIOS = typeof navigator !== "undefined" && parseFloat(
  208049. ("" + (/CPU.*OS ([0-9_]{3,4})[0-9_]{0,1}|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent) || [0, ""])[1]).replace("undefined", "3_2").replace("_", ".").replace("_", "")
  208050. ) < 10 && !window.MSStream;
  208051. var NoSleep = class {
  208052. constructor() {
  208053. if (oldIOS) {
  208054. this.noSleepTimer = null;
  208055. } else {
  208056. this.noSleepVideo = document.createElement("video");
  208057. this.noSleepVideo.setAttribute("muted", "");
  208058. this.noSleepVideo.setAttribute("title", "No Sleep");
  208059. this.noSleepVideo.setAttribute("playsinline", "");
  208060. this._addSourceToVideo(this.noSleepVideo, "webm", webm);
  208061. this._addSourceToVideo(this.noSleepVideo, "mp4", mp4);
  208062. this.noSleepVideo.addEventListener("loadedmetadata", () => {
  208063. if (this.noSleepVideo.duration <= 1) {
  208064. this.noSleepVideo.setAttribute("loop", "");
  208065. } else {
  208066. this.noSleepVideo.addEventListener("timeupdate", () => {
  208067. if (this.noSleepVideo.currentTime > 0.5) {
  208068. this.noSleepVideo.currentTime = Math.random();
  208069. }
  208070. });
  208071. }
  208072. });
  208073. }
  208074. }
  208075. _addSourceToVideo(element, type, dataURI) {
  208076. var source = document.createElement("source");
  208077. source.src = dataURI;
  208078. source.type = `video/${type}`;
  208079. element.appendChild(source);
  208080. }
  208081. enable() {
  208082. if (oldIOS) {
  208083. this.disable();
  208084. console.warn(`
  208085. NoSleep enabled for older iOS devices. This can interrupt
  208086. active or long-running network requests from completing successfully.
  208087. See https://github.com/richtr/NoSleep.js/issues/15 for more details.
  208088. `);
  208089. this.noSleepTimer = window.setInterval(() => {
  208090. if (!document.hidden) {
  208091. window.location.href = window.location.href.split("#")[0];
  208092. window.setTimeout(window.stop, 0);
  208093. }
  208094. }, 15e3);
  208095. } else {
  208096. this.noSleepVideo.play();
  208097. }
  208098. }
  208099. disable() {
  208100. if (oldIOS) {
  208101. if (this.noSleepTimer) {
  208102. console.warn(`
  208103. NoSleep now disabled for older iOS devices.
  208104. `);
  208105. window.clearInterval(this.noSleepTimer);
  208106. this.noSleepTimer = null;
  208107. }
  208108. } else {
  208109. this.noSleepVideo.pause();
  208110. }
  208111. }
  208112. };
  208113. var src = NoSleep;
  208114. // node_modules/cesium/Source/ThirdParty/pako.js
  208115. var common = createCommonjsModule(function(module2, exports2) {
  208116. var TYPED_OK = typeof Uint8Array !== "undefined" && typeof Uint16Array !== "undefined" && typeof Int32Array !== "undefined";
  208117. function _has(obj, key) {
  208118. return Object.prototype.hasOwnProperty.call(obj, key);
  208119. }
  208120. exports2.assign = function(obj) {
  208121. var sources = Array.prototype.slice.call(arguments, 1);
  208122. while (sources.length) {
  208123. var source = sources.shift();
  208124. if (!source) {
  208125. continue;
  208126. }
  208127. if (typeof source !== "object") {
  208128. throw new TypeError(source + "must be non-object");
  208129. }
  208130. for (var p2 in source) {
  208131. if (_has(source, p2)) {
  208132. obj[p2] = source[p2];
  208133. }
  208134. }
  208135. }
  208136. return obj;
  208137. };
  208138. exports2.shrinkBuf = function(buf, size) {
  208139. if (buf.length === size) {
  208140. return buf;
  208141. }
  208142. if (buf.subarray) {
  208143. return buf.subarray(0, size);
  208144. }
  208145. buf.length = size;
  208146. return buf;
  208147. };
  208148. var fnTyped = {
  208149. arraySet: function(dest, src2, src_offs, len, dest_offs) {
  208150. if (src2.subarray && dest.subarray) {
  208151. dest.set(src2.subarray(src_offs, src_offs + len), dest_offs);
  208152. return;
  208153. }
  208154. for (var i2 = 0; i2 < len; i2++) {
  208155. dest[dest_offs + i2] = src2[src_offs + i2];
  208156. }
  208157. },
  208158. flattenChunks: function(chunks) {
  208159. var i2, l2, len, pos, chunk, result;
  208160. len = 0;
  208161. for (i2 = 0, l2 = chunks.length; i2 < l2; i2++) {
  208162. len += chunks[i2].length;
  208163. }
  208164. result = new Uint8Array(len);
  208165. pos = 0;
  208166. for (i2 = 0, l2 = chunks.length; i2 < l2; i2++) {
  208167. chunk = chunks[i2];
  208168. result.set(chunk, pos);
  208169. pos += chunk.length;
  208170. }
  208171. return result;
  208172. }
  208173. };
  208174. var fnUntyped = {
  208175. arraySet: function(dest, src2, src_offs, len, dest_offs) {
  208176. for (var i2 = 0; i2 < len; i2++) {
  208177. dest[dest_offs + i2] = src2[src_offs + i2];
  208178. }
  208179. },
  208180. flattenChunks: function(chunks) {
  208181. return [].concat.apply([], chunks);
  208182. }
  208183. };
  208184. exports2.setTyped = function(on) {
  208185. if (on) {
  208186. exports2.Buf8 = Uint8Array;
  208187. exports2.Buf16 = Uint16Array;
  208188. exports2.Buf32 = Int32Array;
  208189. exports2.assign(exports2, fnTyped);
  208190. } else {
  208191. exports2.Buf8 = Array;
  208192. exports2.Buf16 = Array;
  208193. exports2.Buf32 = Array;
  208194. exports2.assign(exports2, fnUntyped);
  208195. }
  208196. };
  208197. exports2.setTyped(TYPED_OK);
  208198. });
  208199. function adler32(adler, buf, len, pos) {
  208200. var s1 = adler & 65535 | 0, s2 = adler >>> 16 & 65535 | 0, n2 = 0;
  208201. while (len !== 0) {
  208202. n2 = len > 2e3 ? 2e3 : len;
  208203. len -= n2;
  208204. do {
  208205. s1 = s1 + buf[pos++] | 0;
  208206. s2 = s2 + s1 | 0;
  208207. } while (--n2);
  208208. s1 %= 65521;
  208209. s2 %= 65521;
  208210. }
  208211. return s1 | s2 << 16 | 0;
  208212. }
  208213. var adler32_1 = adler32;
  208214. function makeTable() {
  208215. var c14, table2 = [];
  208216. for (var n2 = 0; n2 < 256; n2++) {
  208217. c14 = n2;
  208218. for (var k = 0; k < 8; k++) {
  208219. c14 = c14 & 1 ? 3988292384 ^ c14 >>> 1 : c14 >>> 1;
  208220. }
  208221. table2[n2] = c14;
  208222. }
  208223. return table2;
  208224. }
  208225. var crcTable = makeTable();
  208226. function crc32(crc, buf, len, pos) {
  208227. var t = crcTable, end = pos + len;
  208228. crc ^= -1;
  208229. for (var i2 = pos; i2 < end; i2++) {
  208230. crc = crc >>> 8 ^ t[(crc ^ buf[i2]) & 255];
  208231. }
  208232. return crc ^ -1;
  208233. }
  208234. var crc32_1 = crc32;
  208235. var BAD$1 = 30;
  208236. var TYPE$1 = 12;
  208237. var inffast = function inflate_fast(strm, start) {
  208238. var state;
  208239. var _in;
  208240. var last;
  208241. var _out;
  208242. var beg;
  208243. var end;
  208244. var dmax;
  208245. var wsize;
  208246. var whave;
  208247. var wnext;
  208248. var s_window;
  208249. var hold;
  208250. var bits;
  208251. var lcode;
  208252. var dcode;
  208253. var lmask;
  208254. var dmask;
  208255. var here;
  208256. var op;
  208257. var len;
  208258. var dist;
  208259. var from;
  208260. var from_source;
  208261. var input, output;
  208262. state = strm.state;
  208263. _in = strm.next_in;
  208264. input = strm.input;
  208265. last = _in + (strm.avail_in - 5);
  208266. _out = strm.next_out;
  208267. output = strm.output;
  208268. beg = _out - (start - strm.avail_out);
  208269. end = _out + (strm.avail_out - 257);
  208270. dmax = state.dmax;
  208271. wsize = state.wsize;
  208272. whave = state.whave;
  208273. wnext = state.wnext;
  208274. s_window = state.window;
  208275. hold = state.hold;
  208276. bits = state.bits;
  208277. lcode = state.lencode;
  208278. dcode = state.distcode;
  208279. lmask = (1 << state.lenbits) - 1;
  208280. dmask = (1 << state.distbits) - 1;
  208281. top:
  208282. do {
  208283. if (bits < 15) {
  208284. hold += input[_in++] << bits;
  208285. bits += 8;
  208286. hold += input[_in++] << bits;
  208287. bits += 8;
  208288. }
  208289. here = lcode[hold & lmask];
  208290. dolen:
  208291. for (; ; ) {
  208292. op = here >>> 24;
  208293. hold >>>= op;
  208294. bits -= op;
  208295. op = here >>> 16 & 255;
  208296. if (op === 0) {
  208297. output[_out++] = here & 65535;
  208298. } else if (op & 16) {
  208299. len = here & 65535;
  208300. op &= 15;
  208301. if (op) {
  208302. if (bits < op) {
  208303. hold += input[_in++] << bits;
  208304. bits += 8;
  208305. }
  208306. len += hold & (1 << op) - 1;
  208307. hold >>>= op;
  208308. bits -= op;
  208309. }
  208310. if (bits < 15) {
  208311. hold += input[_in++] << bits;
  208312. bits += 8;
  208313. hold += input[_in++] << bits;
  208314. bits += 8;
  208315. }
  208316. here = dcode[hold & dmask];
  208317. dodist:
  208318. for (; ; ) {
  208319. op = here >>> 24;
  208320. hold >>>= op;
  208321. bits -= op;
  208322. op = here >>> 16 & 255;
  208323. if (op & 16) {
  208324. dist = here & 65535;
  208325. op &= 15;
  208326. if (bits < op) {
  208327. hold += input[_in++] << bits;
  208328. bits += 8;
  208329. if (bits < op) {
  208330. hold += input[_in++] << bits;
  208331. bits += 8;
  208332. }
  208333. }
  208334. dist += hold & (1 << op) - 1;
  208335. if (dist > dmax) {
  208336. strm.msg = "invalid distance too far back";
  208337. state.mode = BAD$1;
  208338. break top;
  208339. }
  208340. hold >>>= op;
  208341. bits -= op;
  208342. op = _out - beg;
  208343. if (dist > op) {
  208344. op = dist - op;
  208345. if (op > whave) {
  208346. if (state.sane) {
  208347. strm.msg = "invalid distance too far back";
  208348. state.mode = BAD$1;
  208349. break top;
  208350. }
  208351. }
  208352. from = 0;
  208353. from_source = s_window;
  208354. if (wnext === 0) {
  208355. from += wsize - op;
  208356. if (op < len) {
  208357. len -= op;
  208358. do {
  208359. output[_out++] = s_window[from++];
  208360. } while (--op);
  208361. from = _out - dist;
  208362. from_source = output;
  208363. }
  208364. } else if (wnext < op) {
  208365. from += wsize + wnext - op;
  208366. op -= wnext;
  208367. if (op < len) {
  208368. len -= op;
  208369. do {
  208370. output[_out++] = s_window[from++];
  208371. } while (--op);
  208372. from = 0;
  208373. if (wnext < len) {
  208374. op = wnext;
  208375. len -= op;
  208376. do {
  208377. output[_out++] = s_window[from++];
  208378. } while (--op);
  208379. from = _out - dist;
  208380. from_source = output;
  208381. }
  208382. }
  208383. } else {
  208384. from += wnext - op;
  208385. if (op < len) {
  208386. len -= op;
  208387. do {
  208388. output[_out++] = s_window[from++];
  208389. } while (--op);
  208390. from = _out - dist;
  208391. from_source = output;
  208392. }
  208393. }
  208394. while (len > 2) {
  208395. output[_out++] = from_source[from++];
  208396. output[_out++] = from_source[from++];
  208397. output[_out++] = from_source[from++];
  208398. len -= 3;
  208399. }
  208400. if (len) {
  208401. output[_out++] = from_source[from++];
  208402. if (len > 1) {
  208403. output[_out++] = from_source[from++];
  208404. }
  208405. }
  208406. } else {
  208407. from = _out - dist;
  208408. do {
  208409. output[_out++] = output[from++];
  208410. output[_out++] = output[from++];
  208411. output[_out++] = output[from++];
  208412. len -= 3;
  208413. } while (len > 2);
  208414. if (len) {
  208415. output[_out++] = output[from++];
  208416. if (len > 1) {
  208417. output[_out++] = output[from++];
  208418. }
  208419. }
  208420. }
  208421. } else if ((op & 64) === 0) {
  208422. here = dcode[(here & 65535) + (hold & (1 << op) - 1)];
  208423. continue dodist;
  208424. } else {
  208425. strm.msg = "invalid distance code";
  208426. state.mode = BAD$1;
  208427. break top;
  208428. }
  208429. break;
  208430. }
  208431. } else if ((op & 64) === 0) {
  208432. here = lcode[(here & 65535) + (hold & (1 << op) - 1)];
  208433. continue dolen;
  208434. } else if (op & 32) {
  208435. state.mode = TYPE$1;
  208436. break top;
  208437. } else {
  208438. strm.msg = "invalid literal/length code";
  208439. state.mode = BAD$1;
  208440. break top;
  208441. }
  208442. break;
  208443. }
  208444. } while (_in < last && _out < end);
  208445. len = bits >> 3;
  208446. _in -= len;
  208447. bits -= len << 3;
  208448. hold &= (1 << bits) - 1;
  208449. strm.next_in = _in;
  208450. strm.next_out = _out;
  208451. strm.avail_in = _in < last ? 5 + (last - _in) : 5 - (_in - last);
  208452. strm.avail_out = _out < end ? 257 + (end - _out) : 257 - (_out - end);
  208453. state.hold = hold;
  208454. state.bits = bits;
  208455. return;
  208456. };
  208457. var MAXBITS = 15;
  208458. var ENOUGH_LENS$1 = 852;
  208459. var ENOUGH_DISTS$1 = 592;
  208460. var CODES$1 = 0;
  208461. var LENS$1 = 1;
  208462. var DISTS$1 = 2;
  208463. var lbase = [
  208464. 3,
  208465. 4,
  208466. 5,
  208467. 6,
  208468. 7,
  208469. 8,
  208470. 9,
  208471. 10,
  208472. 11,
  208473. 13,
  208474. 15,
  208475. 17,
  208476. 19,
  208477. 23,
  208478. 27,
  208479. 31,
  208480. 35,
  208481. 43,
  208482. 51,
  208483. 59,
  208484. 67,
  208485. 83,
  208486. 99,
  208487. 115,
  208488. 131,
  208489. 163,
  208490. 195,
  208491. 227,
  208492. 258,
  208493. 0,
  208494. 0
  208495. ];
  208496. var lext = [
  208497. 16,
  208498. 16,
  208499. 16,
  208500. 16,
  208501. 16,
  208502. 16,
  208503. 16,
  208504. 16,
  208505. 17,
  208506. 17,
  208507. 17,
  208508. 17,
  208509. 18,
  208510. 18,
  208511. 18,
  208512. 18,
  208513. 19,
  208514. 19,
  208515. 19,
  208516. 19,
  208517. 20,
  208518. 20,
  208519. 20,
  208520. 20,
  208521. 21,
  208522. 21,
  208523. 21,
  208524. 21,
  208525. 16,
  208526. 72,
  208527. 78
  208528. ];
  208529. var dbase = [
  208530. 1,
  208531. 2,
  208532. 3,
  208533. 4,
  208534. 5,
  208535. 7,
  208536. 9,
  208537. 13,
  208538. 17,
  208539. 25,
  208540. 33,
  208541. 49,
  208542. 65,
  208543. 97,
  208544. 129,
  208545. 193,
  208546. 257,
  208547. 385,
  208548. 513,
  208549. 769,
  208550. 1025,
  208551. 1537,
  208552. 2049,
  208553. 3073,
  208554. 4097,
  208555. 6145,
  208556. 8193,
  208557. 12289,
  208558. 16385,
  208559. 24577,
  208560. 0,
  208561. 0
  208562. ];
  208563. var dext = [
  208564. 16,
  208565. 16,
  208566. 16,
  208567. 16,
  208568. 17,
  208569. 17,
  208570. 18,
  208571. 18,
  208572. 19,
  208573. 19,
  208574. 20,
  208575. 20,
  208576. 21,
  208577. 21,
  208578. 22,
  208579. 22,
  208580. 23,
  208581. 23,
  208582. 24,
  208583. 24,
  208584. 25,
  208585. 25,
  208586. 26,
  208587. 26,
  208588. 27,
  208589. 27,
  208590. 28,
  208591. 28,
  208592. 29,
  208593. 29,
  208594. 64,
  208595. 64
  208596. ];
  208597. var inftrees = function inflate_table(type, lens, lens_index, codes, table2, table_index, work, opts) {
  208598. var bits = opts.bits;
  208599. var len = 0;
  208600. var sym = 0;
  208601. var min3 = 0, max3 = 0;
  208602. var root = 0;
  208603. var curr = 0;
  208604. var drop = 0;
  208605. var left = 0;
  208606. var used = 0;
  208607. var huff = 0;
  208608. var incr;
  208609. var fill;
  208610. var low;
  208611. var mask;
  208612. var next;
  208613. var base = null;
  208614. var base_index = 0;
  208615. var end;
  208616. var count = new common.Buf16(MAXBITS + 1);
  208617. var offs = new common.Buf16(MAXBITS + 1);
  208618. var extra = null;
  208619. var extra_index = 0;
  208620. var here_bits, here_op, here_val;
  208621. for (len = 0; len <= MAXBITS; len++) {
  208622. count[len] = 0;
  208623. }
  208624. for (sym = 0; sym < codes; sym++) {
  208625. count[lens[lens_index + sym]]++;
  208626. }
  208627. root = bits;
  208628. for (max3 = MAXBITS; max3 >= 1; max3--) {
  208629. if (count[max3] !== 0) {
  208630. break;
  208631. }
  208632. }
  208633. if (root > max3) {
  208634. root = max3;
  208635. }
  208636. if (max3 === 0) {
  208637. table2[table_index++] = 1 << 24 | 64 << 16 | 0;
  208638. table2[table_index++] = 1 << 24 | 64 << 16 | 0;
  208639. opts.bits = 1;
  208640. return 0;
  208641. }
  208642. for (min3 = 1; min3 < max3; min3++) {
  208643. if (count[min3] !== 0) {
  208644. break;
  208645. }
  208646. }
  208647. if (root < min3) {
  208648. root = min3;
  208649. }
  208650. left = 1;
  208651. for (len = 1; len <= MAXBITS; len++) {
  208652. left <<= 1;
  208653. left -= count[len];
  208654. if (left < 0) {
  208655. return -1;
  208656. }
  208657. }
  208658. if (left > 0 && (type === CODES$1 || max3 !== 1)) {
  208659. return -1;
  208660. }
  208661. offs[1] = 0;
  208662. for (len = 1; len < MAXBITS; len++) {
  208663. offs[len + 1] = offs[len] + count[len];
  208664. }
  208665. for (sym = 0; sym < codes; sym++) {
  208666. if (lens[lens_index + sym] !== 0) {
  208667. work[offs[lens[lens_index + sym]]++] = sym;
  208668. }
  208669. }
  208670. if (type === CODES$1) {
  208671. base = extra = work;
  208672. end = 19;
  208673. } else if (type === LENS$1) {
  208674. base = lbase;
  208675. base_index -= 257;
  208676. extra = lext;
  208677. extra_index -= 257;
  208678. end = 256;
  208679. } else {
  208680. base = dbase;
  208681. extra = dext;
  208682. end = -1;
  208683. }
  208684. huff = 0;
  208685. sym = 0;
  208686. len = min3;
  208687. next = table_index;
  208688. curr = root;
  208689. drop = 0;
  208690. low = -1;
  208691. used = 1 << root;
  208692. mask = used - 1;
  208693. if (type === LENS$1 && used > ENOUGH_LENS$1 || type === DISTS$1 && used > ENOUGH_DISTS$1) {
  208694. return 1;
  208695. }
  208696. for (; ; ) {
  208697. here_bits = len - drop;
  208698. if (work[sym] < end) {
  208699. here_op = 0;
  208700. here_val = work[sym];
  208701. } else if (work[sym] > end) {
  208702. here_op = extra[extra_index + work[sym]];
  208703. here_val = base[base_index + work[sym]];
  208704. } else {
  208705. here_op = 32 + 64;
  208706. here_val = 0;
  208707. }
  208708. incr = 1 << len - drop;
  208709. fill = 1 << curr;
  208710. min3 = fill;
  208711. do {
  208712. fill -= incr;
  208713. table2[next + (huff >> drop) + fill] = here_bits << 24 | here_op << 16 | here_val | 0;
  208714. } while (fill !== 0);
  208715. incr = 1 << len - 1;
  208716. while (huff & incr) {
  208717. incr >>= 1;
  208718. }
  208719. if (incr !== 0) {
  208720. huff &= incr - 1;
  208721. huff += incr;
  208722. } else {
  208723. huff = 0;
  208724. }
  208725. sym++;
  208726. if (--count[len] === 0) {
  208727. if (len === max3) {
  208728. break;
  208729. }
  208730. len = lens[lens_index + work[sym]];
  208731. }
  208732. if (len > root && (huff & mask) !== low) {
  208733. if (drop === 0) {
  208734. drop = root;
  208735. }
  208736. next += min3;
  208737. curr = len - drop;
  208738. left = 1 << curr;
  208739. while (curr + drop < max3) {
  208740. left -= count[curr + drop];
  208741. if (left <= 0) {
  208742. break;
  208743. }
  208744. curr++;
  208745. left <<= 1;
  208746. }
  208747. used += 1 << curr;
  208748. if (type === LENS$1 && used > ENOUGH_LENS$1 || type === DISTS$1 && used > ENOUGH_DISTS$1) {
  208749. return 1;
  208750. }
  208751. low = huff & mask;
  208752. table2[low] = root << 24 | curr << 16 | next - table_index | 0;
  208753. }
  208754. }
  208755. if (huff !== 0) {
  208756. table2[next + huff] = len - drop << 24 | 64 << 16 | 0;
  208757. }
  208758. opts.bits = root;
  208759. return 0;
  208760. };
  208761. var CODES2 = 0;
  208762. var LENS2 = 1;
  208763. var DISTS = 2;
  208764. var Z_FINISH2 = 4;
  208765. var Z_BLOCK = 5;
  208766. var Z_TREES = 6;
  208767. var Z_OK2 = 0;
  208768. var Z_STREAM_END2 = 1;
  208769. var Z_NEED_DICT2 = 2;
  208770. var Z_STREAM_ERROR2 = -2;
  208771. var Z_DATA_ERROR2 = -3;
  208772. var Z_MEM_ERROR2 = -4;
  208773. var Z_BUF_ERROR2 = -5;
  208774. var Z_DEFLATED2 = 8;
  208775. var HEAD = 1;
  208776. var FLAGS = 2;
  208777. var TIME = 3;
  208778. var OS = 4;
  208779. var EXLEN = 5;
  208780. var EXTRA = 6;
  208781. var NAME = 7;
  208782. var COMMENT = 8;
  208783. var HCRC = 9;
  208784. var DICTID = 10;
  208785. var DICT = 11;
  208786. var TYPE2 = 12;
  208787. var TYPEDO = 13;
  208788. var STORED2 = 14;
  208789. var COPY_ = 15;
  208790. var COPY2 = 16;
  208791. var TABLE2 = 17;
  208792. var LENLENS = 18;
  208793. var CODELENS = 19;
  208794. var LEN_ = 20;
  208795. var LEN2 = 21;
  208796. var LENEXT2 = 22;
  208797. var DIST2 = 23;
  208798. var DISTEXT2 = 24;
  208799. var MATCH = 25;
  208800. var LIT2 = 26;
  208801. var CHECK = 27;
  208802. var LENGTH = 28;
  208803. var DONE2 = 29;
  208804. var BAD2 = 30;
  208805. var MEM = 31;
  208806. var SYNC = 32;
  208807. var ENOUGH_LENS = 852;
  208808. var ENOUGH_DISTS = 592;
  208809. var MAX_WBITS = 15;
  208810. var DEF_WBITS = MAX_WBITS;
  208811. function zswap32(q) {
  208812. return (q >>> 24 & 255) + (q >>> 8 & 65280) + ((q & 65280) << 8) + ((q & 255) << 24);
  208813. }
  208814. function InflateState() {
  208815. this.mode = 0;
  208816. this.last = false;
  208817. this.wrap = 0;
  208818. this.havedict = false;
  208819. this.flags = 0;
  208820. this.dmax = 0;
  208821. this.check = 0;
  208822. this.total = 0;
  208823. this.head = null;
  208824. this.wbits = 0;
  208825. this.wsize = 0;
  208826. this.whave = 0;
  208827. this.wnext = 0;
  208828. this.window = null;
  208829. this.hold = 0;
  208830. this.bits = 0;
  208831. this.length = 0;
  208832. this.offset = 0;
  208833. this.extra = 0;
  208834. this.lencode = null;
  208835. this.distcode = null;
  208836. this.lenbits = 0;
  208837. this.distbits = 0;
  208838. this.ncode = 0;
  208839. this.nlen = 0;
  208840. this.ndist = 0;
  208841. this.have = 0;
  208842. this.next = null;
  208843. this.lens = new common.Buf16(320);
  208844. this.work = new common.Buf16(288);
  208845. this.lendyn = null;
  208846. this.distdyn = null;
  208847. this.sane = 0;
  208848. this.back = 0;
  208849. this.was = 0;
  208850. }
  208851. function inflateResetKeep(strm) {
  208852. var state;
  208853. if (!strm || !strm.state) {
  208854. return Z_STREAM_ERROR2;
  208855. }
  208856. state = strm.state;
  208857. strm.total_in = strm.total_out = state.total = 0;
  208858. strm.msg = "";
  208859. if (state.wrap) {
  208860. strm.adler = state.wrap & 1;
  208861. }
  208862. state.mode = HEAD;
  208863. state.last = 0;
  208864. state.havedict = 0;
  208865. state.dmax = 32768;
  208866. state.head = null;
  208867. state.hold = 0;
  208868. state.bits = 0;
  208869. state.lencode = state.lendyn = new common.Buf32(ENOUGH_LENS);
  208870. state.distcode = state.distdyn = new common.Buf32(ENOUGH_DISTS);
  208871. state.sane = 1;
  208872. state.back = -1;
  208873. return Z_OK2;
  208874. }
  208875. function inflateReset(strm) {
  208876. var state;
  208877. if (!strm || !strm.state) {
  208878. return Z_STREAM_ERROR2;
  208879. }
  208880. state = strm.state;
  208881. state.wsize = 0;
  208882. state.whave = 0;
  208883. state.wnext = 0;
  208884. return inflateResetKeep(strm);
  208885. }
  208886. function inflateReset2(strm, windowBits) {
  208887. var wrap;
  208888. var state;
  208889. if (!strm || !strm.state) {
  208890. return Z_STREAM_ERROR2;
  208891. }
  208892. state = strm.state;
  208893. if (windowBits < 0) {
  208894. wrap = 0;
  208895. windowBits = -windowBits;
  208896. } else {
  208897. wrap = (windowBits >> 4) + 1;
  208898. if (windowBits < 48) {
  208899. windowBits &= 15;
  208900. }
  208901. }
  208902. if (windowBits && (windowBits < 8 || windowBits > 15)) {
  208903. return Z_STREAM_ERROR2;
  208904. }
  208905. if (state.window !== null && state.wbits !== windowBits) {
  208906. state.window = null;
  208907. }
  208908. state.wrap = wrap;
  208909. state.wbits = windowBits;
  208910. return inflateReset(strm);
  208911. }
  208912. function inflateInit2(strm, windowBits) {
  208913. var ret;
  208914. var state;
  208915. if (!strm) {
  208916. return Z_STREAM_ERROR2;
  208917. }
  208918. state = new InflateState();
  208919. strm.state = state;
  208920. state.window = null;
  208921. ret = inflateReset2(strm, windowBits);
  208922. if (ret !== Z_OK2) {
  208923. strm.state = null;
  208924. }
  208925. return ret;
  208926. }
  208927. function inflateInit(strm) {
  208928. return inflateInit2(strm, DEF_WBITS);
  208929. }
  208930. var virgin = true;
  208931. var lenfix;
  208932. var distfix;
  208933. function fixedtables(state) {
  208934. if (virgin) {
  208935. var sym;
  208936. lenfix = new common.Buf32(512);
  208937. distfix = new common.Buf32(32);
  208938. sym = 0;
  208939. while (sym < 144) {
  208940. state.lens[sym++] = 8;
  208941. }
  208942. while (sym < 256) {
  208943. state.lens[sym++] = 9;
  208944. }
  208945. while (sym < 280) {
  208946. state.lens[sym++] = 7;
  208947. }
  208948. while (sym < 288) {
  208949. state.lens[sym++] = 8;
  208950. }
  208951. inftrees(LENS2, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 });
  208952. sym = 0;
  208953. while (sym < 32) {
  208954. state.lens[sym++] = 5;
  208955. }
  208956. inftrees(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 });
  208957. virgin = false;
  208958. }
  208959. state.lencode = lenfix;
  208960. state.lenbits = 9;
  208961. state.distcode = distfix;
  208962. state.distbits = 5;
  208963. }
  208964. function updatewindow(strm, src2, end, copy) {
  208965. var dist;
  208966. var state = strm.state;
  208967. if (state.window === null) {
  208968. state.wsize = 1 << state.wbits;
  208969. state.wnext = 0;
  208970. state.whave = 0;
  208971. state.window = new common.Buf8(state.wsize);
  208972. }
  208973. if (copy >= state.wsize) {
  208974. common.arraySet(state.window, src2, end - state.wsize, state.wsize, 0);
  208975. state.wnext = 0;
  208976. state.whave = state.wsize;
  208977. } else {
  208978. dist = state.wsize - state.wnext;
  208979. if (dist > copy) {
  208980. dist = copy;
  208981. }
  208982. common.arraySet(state.window, src2, end - copy, dist, state.wnext);
  208983. copy -= dist;
  208984. if (copy) {
  208985. common.arraySet(state.window, src2, end - copy, copy, 0);
  208986. state.wnext = copy;
  208987. state.whave = state.wsize;
  208988. } else {
  208989. state.wnext += dist;
  208990. if (state.wnext === state.wsize) {
  208991. state.wnext = 0;
  208992. }
  208993. if (state.whave < state.wsize) {
  208994. state.whave += dist;
  208995. }
  208996. }
  208997. }
  208998. return 0;
  208999. }
  209000. function inflate$1(strm, flush) {
  209001. var state;
  209002. var input, output;
  209003. var next;
  209004. var put;
  209005. var have, left;
  209006. var hold;
  209007. var bits;
  209008. var _in, _out;
  209009. var copy;
  209010. var from;
  209011. var from_source;
  209012. var here = 0;
  209013. var here_bits, here_op, here_val;
  209014. var last_bits, last_op, last_val;
  209015. var len;
  209016. var ret;
  209017. var hbuf = new common.Buf8(4);
  209018. var opts;
  209019. var n2;
  209020. var order = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15];
  209021. if (!strm || !strm.state || !strm.output || !strm.input && strm.avail_in !== 0) {
  209022. return Z_STREAM_ERROR2;
  209023. }
  209024. state = strm.state;
  209025. if (state.mode === TYPE2) {
  209026. state.mode = TYPEDO;
  209027. }
  209028. put = strm.next_out;
  209029. output = strm.output;
  209030. left = strm.avail_out;
  209031. next = strm.next_in;
  209032. input = strm.input;
  209033. have = strm.avail_in;
  209034. hold = state.hold;
  209035. bits = state.bits;
  209036. _in = have;
  209037. _out = left;
  209038. ret = Z_OK2;
  209039. inf_leave:
  209040. for (; ; ) {
  209041. switch (state.mode) {
  209042. case HEAD:
  209043. if (state.wrap === 0) {
  209044. state.mode = TYPEDO;
  209045. break;
  209046. }
  209047. while (bits < 16) {
  209048. if (have === 0) {
  209049. break inf_leave;
  209050. }
  209051. have--;
  209052. hold += input[next++] << bits;
  209053. bits += 8;
  209054. }
  209055. if (state.wrap & 2 && hold === 35615) {
  209056. state.check = 0;
  209057. hbuf[0] = hold & 255;
  209058. hbuf[1] = hold >>> 8 & 255;
  209059. state.check = crc32_1(state.check, hbuf, 2, 0);
  209060. hold = 0;
  209061. bits = 0;
  209062. state.mode = FLAGS;
  209063. break;
  209064. }
  209065. state.flags = 0;
  209066. if (state.head) {
  209067. state.head.done = false;
  209068. }
  209069. if (!(state.wrap & 1) || (((hold & 255) << 8) + (hold >> 8)) % 31) {
  209070. strm.msg = "incorrect header check";
  209071. state.mode = BAD2;
  209072. break;
  209073. }
  209074. if ((hold & 15) !== Z_DEFLATED2) {
  209075. strm.msg = "unknown compression method";
  209076. state.mode = BAD2;
  209077. break;
  209078. }
  209079. hold >>>= 4;
  209080. bits -= 4;
  209081. len = (hold & 15) + 8;
  209082. if (state.wbits === 0) {
  209083. state.wbits = len;
  209084. } else if (len > state.wbits) {
  209085. strm.msg = "invalid window size";
  209086. state.mode = BAD2;
  209087. break;
  209088. }
  209089. state.dmax = 1 << len;
  209090. strm.adler = state.check = 1;
  209091. state.mode = hold & 512 ? DICTID : TYPE2;
  209092. hold = 0;
  209093. bits = 0;
  209094. break;
  209095. case FLAGS:
  209096. while (bits < 16) {
  209097. if (have === 0) {
  209098. break inf_leave;
  209099. }
  209100. have--;
  209101. hold += input[next++] << bits;
  209102. bits += 8;
  209103. }
  209104. state.flags = hold;
  209105. if ((state.flags & 255) !== Z_DEFLATED2) {
  209106. strm.msg = "unknown compression method";
  209107. state.mode = BAD2;
  209108. break;
  209109. }
  209110. if (state.flags & 57344) {
  209111. strm.msg = "unknown header flags set";
  209112. state.mode = BAD2;
  209113. break;
  209114. }
  209115. if (state.head) {
  209116. state.head.text = hold >> 8 & 1;
  209117. }
  209118. if (state.flags & 512) {
  209119. hbuf[0] = hold & 255;
  209120. hbuf[1] = hold >>> 8 & 255;
  209121. state.check = crc32_1(state.check, hbuf, 2, 0);
  209122. }
  209123. hold = 0;
  209124. bits = 0;
  209125. state.mode = TIME;
  209126. case TIME:
  209127. while (bits < 32) {
  209128. if (have === 0) {
  209129. break inf_leave;
  209130. }
  209131. have--;
  209132. hold += input[next++] << bits;
  209133. bits += 8;
  209134. }
  209135. if (state.head) {
  209136. state.head.time = hold;
  209137. }
  209138. if (state.flags & 512) {
  209139. hbuf[0] = hold & 255;
  209140. hbuf[1] = hold >>> 8 & 255;
  209141. hbuf[2] = hold >>> 16 & 255;
  209142. hbuf[3] = hold >>> 24 & 255;
  209143. state.check = crc32_1(state.check, hbuf, 4, 0);
  209144. }
  209145. hold = 0;
  209146. bits = 0;
  209147. state.mode = OS;
  209148. case OS:
  209149. while (bits < 16) {
  209150. if (have === 0) {
  209151. break inf_leave;
  209152. }
  209153. have--;
  209154. hold += input[next++] << bits;
  209155. bits += 8;
  209156. }
  209157. if (state.head) {
  209158. state.head.xflags = hold & 255;
  209159. state.head.os = hold >> 8;
  209160. }
  209161. if (state.flags & 512) {
  209162. hbuf[0] = hold & 255;
  209163. hbuf[1] = hold >>> 8 & 255;
  209164. state.check = crc32_1(state.check, hbuf, 2, 0);
  209165. }
  209166. hold = 0;
  209167. bits = 0;
  209168. state.mode = EXLEN;
  209169. case EXLEN:
  209170. if (state.flags & 1024) {
  209171. while (bits < 16) {
  209172. if (have === 0) {
  209173. break inf_leave;
  209174. }
  209175. have--;
  209176. hold += input[next++] << bits;
  209177. bits += 8;
  209178. }
  209179. state.length = hold;
  209180. if (state.head) {
  209181. state.head.extra_len = hold;
  209182. }
  209183. if (state.flags & 512) {
  209184. hbuf[0] = hold & 255;
  209185. hbuf[1] = hold >>> 8 & 255;
  209186. state.check = crc32_1(state.check, hbuf, 2, 0);
  209187. }
  209188. hold = 0;
  209189. bits = 0;
  209190. } else if (state.head) {
  209191. state.head.extra = null;
  209192. }
  209193. state.mode = EXTRA;
  209194. case EXTRA:
  209195. if (state.flags & 1024) {
  209196. copy = state.length;
  209197. if (copy > have) {
  209198. copy = have;
  209199. }
  209200. if (copy) {
  209201. if (state.head) {
  209202. len = state.head.extra_len - state.length;
  209203. if (!state.head.extra) {
  209204. state.head.extra = new Array(state.head.extra_len);
  209205. }
  209206. common.arraySet(
  209207. state.head.extra,
  209208. input,
  209209. next,
  209210. copy,
  209211. len
  209212. );
  209213. }
  209214. if (state.flags & 512) {
  209215. state.check = crc32_1(state.check, input, copy, next);
  209216. }
  209217. have -= copy;
  209218. next += copy;
  209219. state.length -= copy;
  209220. }
  209221. if (state.length) {
  209222. break inf_leave;
  209223. }
  209224. }
  209225. state.length = 0;
  209226. state.mode = NAME;
  209227. case NAME:
  209228. if (state.flags & 2048) {
  209229. if (have === 0) {
  209230. break inf_leave;
  209231. }
  209232. copy = 0;
  209233. do {
  209234. len = input[next + copy++];
  209235. if (state.head && len && state.length < 65536) {
  209236. state.head.name += String.fromCharCode(len);
  209237. }
  209238. } while (len && copy < have);
  209239. if (state.flags & 512) {
  209240. state.check = crc32_1(state.check, input, copy, next);
  209241. }
  209242. have -= copy;
  209243. next += copy;
  209244. if (len) {
  209245. break inf_leave;
  209246. }
  209247. } else if (state.head) {
  209248. state.head.name = null;
  209249. }
  209250. state.length = 0;
  209251. state.mode = COMMENT;
  209252. case COMMENT:
  209253. if (state.flags & 4096) {
  209254. if (have === 0) {
  209255. break inf_leave;
  209256. }
  209257. copy = 0;
  209258. do {
  209259. len = input[next + copy++];
  209260. if (state.head && len && state.length < 65536) {
  209261. state.head.comment += String.fromCharCode(len);
  209262. }
  209263. } while (len && copy < have);
  209264. if (state.flags & 512) {
  209265. state.check = crc32_1(state.check, input, copy, next);
  209266. }
  209267. have -= copy;
  209268. next += copy;
  209269. if (len) {
  209270. break inf_leave;
  209271. }
  209272. } else if (state.head) {
  209273. state.head.comment = null;
  209274. }
  209275. state.mode = HCRC;
  209276. case HCRC:
  209277. if (state.flags & 512) {
  209278. while (bits < 16) {
  209279. if (have === 0) {
  209280. break inf_leave;
  209281. }
  209282. have--;
  209283. hold += input[next++] << bits;
  209284. bits += 8;
  209285. }
  209286. if (hold !== (state.check & 65535)) {
  209287. strm.msg = "header crc mismatch";
  209288. state.mode = BAD2;
  209289. break;
  209290. }
  209291. hold = 0;
  209292. bits = 0;
  209293. }
  209294. if (state.head) {
  209295. state.head.hcrc = state.flags >> 9 & 1;
  209296. state.head.done = true;
  209297. }
  209298. strm.adler = state.check = 0;
  209299. state.mode = TYPE2;
  209300. break;
  209301. case DICTID:
  209302. while (bits < 32) {
  209303. if (have === 0) {
  209304. break inf_leave;
  209305. }
  209306. have--;
  209307. hold += input[next++] << bits;
  209308. bits += 8;
  209309. }
  209310. strm.adler = state.check = zswap32(hold);
  209311. hold = 0;
  209312. bits = 0;
  209313. state.mode = DICT;
  209314. case DICT:
  209315. if (state.havedict === 0) {
  209316. strm.next_out = put;
  209317. strm.avail_out = left;
  209318. strm.next_in = next;
  209319. strm.avail_in = have;
  209320. state.hold = hold;
  209321. state.bits = bits;
  209322. return Z_NEED_DICT2;
  209323. }
  209324. strm.adler = state.check = 1;
  209325. state.mode = TYPE2;
  209326. case TYPE2:
  209327. if (flush === Z_BLOCK || flush === Z_TREES) {
  209328. break inf_leave;
  209329. }
  209330. case TYPEDO:
  209331. if (state.last) {
  209332. hold >>>= bits & 7;
  209333. bits -= bits & 7;
  209334. state.mode = CHECK;
  209335. break;
  209336. }
  209337. while (bits < 3) {
  209338. if (have === 0) {
  209339. break inf_leave;
  209340. }
  209341. have--;
  209342. hold += input[next++] << bits;
  209343. bits += 8;
  209344. }
  209345. state.last = hold & 1;
  209346. hold >>>= 1;
  209347. bits -= 1;
  209348. switch (hold & 3) {
  209349. case 0:
  209350. state.mode = STORED2;
  209351. break;
  209352. case 1:
  209353. fixedtables(state);
  209354. state.mode = LEN_;
  209355. if (flush === Z_TREES) {
  209356. hold >>>= 2;
  209357. bits -= 2;
  209358. break inf_leave;
  209359. }
  209360. break;
  209361. case 2:
  209362. state.mode = TABLE2;
  209363. break;
  209364. case 3:
  209365. strm.msg = "invalid block type";
  209366. state.mode = BAD2;
  209367. }
  209368. hold >>>= 2;
  209369. bits -= 2;
  209370. break;
  209371. case STORED2:
  209372. hold >>>= bits & 7;
  209373. bits -= bits & 7;
  209374. while (bits < 32) {
  209375. if (have === 0) {
  209376. break inf_leave;
  209377. }
  209378. have--;
  209379. hold += input[next++] << bits;
  209380. bits += 8;
  209381. }
  209382. if ((hold & 65535) !== (hold >>> 16 ^ 65535)) {
  209383. strm.msg = "invalid stored block lengths";
  209384. state.mode = BAD2;
  209385. break;
  209386. }
  209387. state.length = hold & 65535;
  209388. hold = 0;
  209389. bits = 0;
  209390. state.mode = COPY_;
  209391. if (flush === Z_TREES) {
  209392. break inf_leave;
  209393. }
  209394. case COPY_:
  209395. state.mode = COPY2;
  209396. case COPY2:
  209397. copy = state.length;
  209398. if (copy) {
  209399. if (copy > have) {
  209400. copy = have;
  209401. }
  209402. if (copy > left) {
  209403. copy = left;
  209404. }
  209405. if (copy === 0) {
  209406. break inf_leave;
  209407. }
  209408. common.arraySet(output, input, next, copy, put);
  209409. have -= copy;
  209410. next += copy;
  209411. left -= copy;
  209412. put += copy;
  209413. state.length -= copy;
  209414. break;
  209415. }
  209416. state.mode = TYPE2;
  209417. break;
  209418. case TABLE2:
  209419. while (bits < 14) {
  209420. if (have === 0) {
  209421. break inf_leave;
  209422. }
  209423. have--;
  209424. hold += input[next++] << bits;
  209425. bits += 8;
  209426. }
  209427. state.nlen = (hold & 31) + 257;
  209428. hold >>>= 5;
  209429. bits -= 5;
  209430. state.ndist = (hold & 31) + 1;
  209431. hold >>>= 5;
  209432. bits -= 5;
  209433. state.ncode = (hold & 15) + 4;
  209434. hold >>>= 4;
  209435. bits -= 4;
  209436. if (state.nlen > 286 || state.ndist > 30) {
  209437. strm.msg = "too many length or distance symbols";
  209438. state.mode = BAD2;
  209439. break;
  209440. }
  209441. state.have = 0;
  209442. state.mode = LENLENS;
  209443. case LENLENS:
  209444. while (state.have < state.ncode) {
  209445. while (bits < 3) {
  209446. if (have === 0) {
  209447. break inf_leave;
  209448. }
  209449. have--;
  209450. hold += input[next++] << bits;
  209451. bits += 8;
  209452. }
  209453. state.lens[order[state.have++]] = hold & 7;
  209454. hold >>>= 3;
  209455. bits -= 3;
  209456. }
  209457. while (state.have < 19) {
  209458. state.lens[order[state.have++]] = 0;
  209459. }
  209460. state.lencode = state.lendyn;
  209461. state.lenbits = 7;
  209462. opts = { bits: state.lenbits };
  209463. ret = inftrees(CODES2, state.lens, 0, 19, state.lencode, 0, state.work, opts);
  209464. state.lenbits = opts.bits;
  209465. if (ret) {
  209466. strm.msg = "invalid code lengths set";
  209467. state.mode = BAD2;
  209468. break;
  209469. }
  209470. state.have = 0;
  209471. state.mode = CODELENS;
  209472. case CODELENS:
  209473. while (state.have < state.nlen + state.ndist) {
  209474. for (; ; ) {
  209475. here = state.lencode[hold & (1 << state.lenbits) - 1];
  209476. here_bits = here >>> 24;
  209477. here_op = here >>> 16 & 255;
  209478. here_val = here & 65535;
  209479. if (here_bits <= bits) {
  209480. break;
  209481. }
  209482. if (have === 0) {
  209483. break inf_leave;
  209484. }
  209485. have--;
  209486. hold += input[next++] << bits;
  209487. bits += 8;
  209488. }
  209489. if (here_val < 16) {
  209490. hold >>>= here_bits;
  209491. bits -= here_bits;
  209492. state.lens[state.have++] = here_val;
  209493. } else {
  209494. if (here_val === 16) {
  209495. n2 = here_bits + 2;
  209496. while (bits < n2) {
  209497. if (have === 0) {
  209498. break inf_leave;
  209499. }
  209500. have--;
  209501. hold += input[next++] << bits;
  209502. bits += 8;
  209503. }
  209504. hold >>>= here_bits;
  209505. bits -= here_bits;
  209506. if (state.have === 0) {
  209507. strm.msg = "invalid bit length repeat";
  209508. state.mode = BAD2;
  209509. break;
  209510. }
  209511. len = state.lens[state.have - 1];
  209512. copy = 3 + (hold & 3);
  209513. hold >>>= 2;
  209514. bits -= 2;
  209515. } else if (here_val === 17) {
  209516. n2 = here_bits + 3;
  209517. while (bits < n2) {
  209518. if (have === 0) {
  209519. break inf_leave;
  209520. }
  209521. have--;
  209522. hold += input[next++] << bits;
  209523. bits += 8;
  209524. }
  209525. hold >>>= here_bits;
  209526. bits -= here_bits;
  209527. len = 0;
  209528. copy = 3 + (hold & 7);
  209529. hold >>>= 3;
  209530. bits -= 3;
  209531. } else {
  209532. n2 = here_bits + 7;
  209533. while (bits < n2) {
  209534. if (have === 0) {
  209535. break inf_leave;
  209536. }
  209537. have--;
  209538. hold += input[next++] << bits;
  209539. bits += 8;
  209540. }
  209541. hold >>>= here_bits;
  209542. bits -= here_bits;
  209543. len = 0;
  209544. copy = 11 + (hold & 127);
  209545. hold >>>= 7;
  209546. bits -= 7;
  209547. }
  209548. if (state.have + copy > state.nlen + state.ndist) {
  209549. strm.msg = "invalid bit length repeat";
  209550. state.mode = BAD2;
  209551. break;
  209552. }
  209553. while (copy--) {
  209554. state.lens[state.have++] = len;
  209555. }
  209556. }
  209557. }
  209558. if (state.mode === BAD2) {
  209559. break;
  209560. }
  209561. if (state.lens[256] === 0) {
  209562. strm.msg = "invalid code -- missing end-of-block";
  209563. state.mode = BAD2;
  209564. break;
  209565. }
  209566. state.lenbits = 9;
  209567. opts = { bits: state.lenbits };
  209568. ret = inftrees(LENS2, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts);
  209569. state.lenbits = opts.bits;
  209570. if (ret) {
  209571. strm.msg = "invalid literal/lengths set";
  209572. state.mode = BAD2;
  209573. break;
  209574. }
  209575. state.distbits = 6;
  209576. state.distcode = state.distdyn;
  209577. opts = { bits: state.distbits };
  209578. ret = inftrees(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts);
  209579. state.distbits = opts.bits;
  209580. if (ret) {
  209581. strm.msg = "invalid distances set";
  209582. state.mode = BAD2;
  209583. break;
  209584. }
  209585. state.mode = LEN_;
  209586. if (flush === Z_TREES) {
  209587. break inf_leave;
  209588. }
  209589. case LEN_:
  209590. state.mode = LEN2;
  209591. case LEN2:
  209592. if (have >= 6 && left >= 258) {
  209593. strm.next_out = put;
  209594. strm.avail_out = left;
  209595. strm.next_in = next;
  209596. strm.avail_in = have;
  209597. state.hold = hold;
  209598. state.bits = bits;
  209599. inffast(strm, _out);
  209600. put = strm.next_out;
  209601. output = strm.output;
  209602. left = strm.avail_out;
  209603. next = strm.next_in;
  209604. input = strm.input;
  209605. have = strm.avail_in;
  209606. hold = state.hold;
  209607. bits = state.bits;
  209608. if (state.mode === TYPE2) {
  209609. state.back = -1;
  209610. }
  209611. break;
  209612. }
  209613. state.back = 0;
  209614. for (; ; ) {
  209615. here = state.lencode[hold & (1 << state.lenbits) - 1];
  209616. here_bits = here >>> 24;
  209617. here_op = here >>> 16 & 255;
  209618. here_val = here & 65535;
  209619. if (here_bits <= bits) {
  209620. break;
  209621. }
  209622. if (have === 0) {
  209623. break inf_leave;
  209624. }
  209625. have--;
  209626. hold += input[next++] << bits;
  209627. bits += 8;
  209628. }
  209629. if (here_op && (here_op & 240) === 0) {
  209630. last_bits = here_bits;
  209631. last_op = here_op;
  209632. last_val = here_val;
  209633. for (; ; ) {
  209634. here = state.lencode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)];
  209635. here_bits = here >>> 24;
  209636. here_op = here >>> 16 & 255;
  209637. here_val = here & 65535;
  209638. if (last_bits + here_bits <= bits) {
  209639. break;
  209640. }
  209641. if (have === 0) {
  209642. break inf_leave;
  209643. }
  209644. have--;
  209645. hold += input[next++] << bits;
  209646. bits += 8;
  209647. }
  209648. hold >>>= last_bits;
  209649. bits -= last_bits;
  209650. state.back += last_bits;
  209651. }
  209652. hold >>>= here_bits;
  209653. bits -= here_bits;
  209654. state.back += here_bits;
  209655. state.length = here_val;
  209656. if (here_op === 0) {
  209657. state.mode = LIT2;
  209658. break;
  209659. }
  209660. if (here_op & 32) {
  209661. state.back = -1;
  209662. state.mode = TYPE2;
  209663. break;
  209664. }
  209665. if (here_op & 64) {
  209666. strm.msg = "invalid literal/length code";
  209667. state.mode = BAD2;
  209668. break;
  209669. }
  209670. state.extra = here_op & 15;
  209671. state.mode = LENEXT2;
  209672. case LENEXT2:
  209673. if (state.extra) {
  209674. n2 = state.extra;
  209675. while (bits < n2) {
  209676. if (have === 0) {
  209677. break inf_leave;
  209678. }
  209679. have--;
  209680. hold += input[next++] << bits;
  209681. bits += 8;
  209682. }
  209683. state.length += hold & (1 << state.extra) - 1;
  209684. hold >>>= state.extra;
  209685. bits -= state.extra;
  209686. state.back += state.extra;
  209687. }
  209688. state.was = state.length;
  209689. state.mode = DIST2;
  209690. case DIST2:
  209691. for (; ; ) {
  209692. here = state.distcode[hold & (1 << state.distbits) - 1];
  209693. here_bits = here >>> 24;
  209694. here_op = here >>> 16 & 255;
  209695. here_val = here & 65535;
  209696. if (here_bits <= bits) {
  209697. break;
  209698. }
  209699. if (have === 0) {
  209700. break inf_leave;
  209701. }
  209702. have--;
  209703. hold += input[next++] << bits;
  209704. bits += 8;
  209705. }
  209706. if ((here_op & 240) === 0) {
  209707. last_bits = here_bits;
  209708. last_op = here_op;
  209709. last_val = here_val;
  209710. for (; ; ) {
  209711. here = state.distcode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)];
  209712. here_bits = here >>> 24;
  209713. here_op = here >>> 16 & 255;
  209714. here_val = here & 65535;
  209715. if (last_bits + here_bits <= bits) {
  209716. break;
  209717. }
  209718. if (have === 0) {
  209719. break inf_leave;
  209720. }
  209721. have--;
  209722. hold += input[next++] << bits;
  209723. bits += 8;
  209724. }
  209725. hold >>>= last_bits;
  209726. bits -= last_bits;
  209727. state.back += last_bits;
  209728. }
  209729. hold >>>= here_bits;
  209730. bits -= here_bits;
  209731. state.back += here_bits;
  209732. if (here_op & 64) {
  209733. strm.msg = "invalid distance code";
  209734. state.mode = BAD2;
  209735. break;
  209736. }
  209737. state.offset = here_val;
  209738. state.extra = here_op & 15;
  209739. state.mode = DISTEXT2;
  209740. case DISTEXT2:
  209741. if (state.extra) {
  209742. n2 = state.extra;
  209743. while (bits < n2) {
  209744. if (have === 0) {
  209745. break inf_leave;
  209746. }
  209747. have--;
  209748. hold += input[next++] << bits;
  209749. bits += 8;
  209750. }
  209751. state.offset += hold & (1 << state.extra) - 1;
  209752. hold >>>= state.extra;
  209753. bits -= state.extra;
  209754. state.back += state.extra;
  209755. }
  209756. if (state.offset > state.dmax) {
  209757. strm.msg = "invalid distance too far back";
  209758. state.mode = BAD2;
  209759. break;
  209760. }
  209761. state.mode = MATCH;
  209762. case MATCH:
  209763. if (left === 0) {
  209764. break inf_leave;
  209765. }
  209766. copy = _out - left;
  209767. if (state.offset > copy) {
  209768. copy = state.offset - copy;
  209769. if (copy > state.whave) {
  209770. if (state.sane) {
  209771. strm.msg = "invalid distance too far back";
  209772. state.mode = BAD2;
  209773. break;
  209774. }
  209775. }
  209776. if (copy > state.wnext) {
  209777. copy -= state.wnext;
  209778. from = state.wsize - copy;
  209779. } else {
  209780. from = state.wnext - copy;
  209781. }
  209782. if (copy > state.length) {
  209783. copy = state.length;
  209784. }
  209785. from_source = state.window;
  209786. } else {
  209787. from_source = output;
  209788. from = put - state.offset;
  209789. copy = state.length;
  209790. }
  209791. if (copy > left) {
  209792. copy = left;
  209793. }
  209794. left -= copy;
  209795. state.length -= copy;
  209796. do {
  209797. output[put++] = from_source[from++];
  209798. } while (--copy);
  209799. if (state.length === 0) {
  209800. state.mode = LEN2;
  209801. }
  209802. break;
  209803. case LIT2:
  209804. if (left === 0) {
  209805. break inf_leave;
  209806. }
  209807. output[put++] = state.length;
  209808. left--;
  209809. state.mode = LEN2;
  209810. break;
  209811. case CHECK:
  209812. if (state.wrap) {
  209813. while (bits < 32) {
  209814. if (have === 0) {
  209815. break inf_leave;
  209816. }
  209817. have--;
  209818. hold |= input[next++] << bits;
  209819. bits += 8;
  209820. }
  209821. _out -= left;
  209822. strm.total_out += _out;
  209823. state.total += _out;
  209824. if (_out) {
  209825. strm.adler = state.check = state.flags ? crc32_1(state.check, output, _out, put - _out) : adler32_1(state.check, output, _out, put - _out);
  209826. }
  209827. _out = left;
  209828. if ((state.flags ? hold : zswap32(hold)) !== state.check) {
  209829. strm.msg = "incorrect data check";
  209830. state.mode = BAD2;
  209831. break;
  209832. }
  209833. hold = 0;
  209834. bits = 0;
  209835. }
  209836. state.mode = LENGTH;
  209837. case LENGTH:
  209838. if (state.wrap && state.flags) {
  209839. while (bits < 32) {
  209840. if (have === 0) {
  209841. break inf_leave;
  209842. }
  209843. have--;
  209844. hold += input[next++] << bits;
  209845. bits += 8;
  209846. }
  209847. if (hold !== (state.total & 4294967295)) {
  209848. strm.msg = "incorrect length check";
  209849. state.mode = BAD2;
  209850. break;
  209851. }
  209852. hold = 0;
  209853. bits = 0;
  209854. }
  209855. state.mode = DONE2;
  209856. case DONE2:
  209857. ret = Z_STREAM_END2;
  209858. break inf_leave;
  209859. case BAD2:
  209860. ret = Z_DATA_ERROR2;
  209861. break inf_leave;
  209862. case MEM:
  209863. return Z_MEM_ERROR2;
  209864. case SYNC:
  209865. default:
  209866. return Z_STREAM_ERROR2;
  209867. }
  209868. }
  209869. strm.next_out = put;
  209870. strm.avail_out = left;
  209871. strm.next_in = next;
  209872. strm.avail_in = have;
  209873. state.hold = hold;
  209874. state.bits = bits;
  209875. if (state.wsize || _out !== strm.avail_out && state.mode < BAD2 && (state.mode < CHECK || flush !== Z_FINISH2)) {
  209876. if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out))
  209877. ;
  209878. }
  209879. _in -= strm.avail_in;
  209880. _out -= strm.avail_out;
  209881. strm.total_in += _in;
  209882. strm.total_out += _out;
  209883. state.total += _out;
  209884. if (state.wrap && _out) {
  209885. strm.adler = state.check = state.flags ? crc32_1(state.check, output, _out, strm.next_out - _out) : adler32_1(state.check, output, _out, strm.next_out - _out);
  209886. }
  209887. strm.data_type = state.bits + (state.last ? 64 : 0) + (state.mode === TYPE2 ? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0);
  209888. if ((_in === 0 && _out === 0 || flush === Z_FINISH2) && ret === Z_OK2) {
  209889. ret = Z_BUF_ERROR2;
  209890. }
  209891. return ret;
  209892. }
  209893. function inflateEnd(strm) {
  209894. if (!strm || !strm.state) {
  209895. return Z_STREAM_ERROR2;
  209896. }
  209897. var state = strm.state;
  209898. if (state.window) {
  209899. state.window = null;
  209900. }
  209901. strm.state = null;
  209902. return Z_OK2;
  209903. }
  209904. function inflateGetHeader(strm, head) {
  209905. var state;
  209906. if (!strm || !strm.state) {
  209907. return Z_STREAM_ERROR2;
  209908. }
  209909. state = strm.state;
  209910. if ((state.wrap & 2) === 0) {
  209911. return Z_STREAM_ERROR2;
  209912. }
  209913. state.head = head;
  209914. head.done = false;
  209915. return Z_OK2;
  209916. }
  209917. function inflateSetDictionary(strm, dictionary) {
  209918. var dictLength = dictionary.length;
  209919. var state;
  209920. var dictid;
  209921. var ret;
  209922. if (!strm || !strm.state) {
  209923. return Z_STREAM_ERROR2;
  209924. }
  209925. state = strm.state;
  209926. if (state.wrap !== 0 && state.mode !== DICT) {
  209927. return Z_STREAM_ERROR2;
  209928. }
  209929. if (state.mode === DICT) {
  209930. dictid = 1;
  209931. dictid = adler32_1(dictid, dictionary, dictLength, 0);
  209932. if (dictid !== state.check) {
  209933. return Z_DATA_ERROR2;
  209934. }
  209935. }
  209936. ret = updatewindow(strm, dictionary, dictLength, dictLength);
  209937. if (ret) {
  209938. state.mode = MEM;
  209939. return Z_MEM_ERROR2;
  209940. }
  209941. state.havedict = 1;
  209942. return Z_OK2;
  209943. }
  209944. var inflateReset_1 = inflateReset;
  209945. var inflateReset2_1 = inflateReset2;
  209946. var inflateResetKeep_1 = inflateResetKeep;
  209947. var inflateInit_1 = inflateInit;
  209948. var inflateInit2_1 = inflateInit2;
  209949. var inflate_2$1 = inflate$1;
  209950. var inflateEnd_1 = inflateEnd;
  209951. var inflateGetHeader_1 = inflateGetHeader;
  209952. var inflateSetDictionary_1 = inflateSetDictionary;
  209953. var inflateInfo = "pako inflate (from Nodeca project)";
  209954. var inflate_1$1 = {
  209955. inflateReset: inflateReset_1,
  209956. inflateReset2: inflateReset2_1,
  209957. inflateResetKeep: inflateResetKeep_1,
  209958. inflateInit: inflateInit_1,
  209959. inflateInit2: inflateInit2_1,
  209960. inflate: inflate_2$1,
  209961. inflateEnd: inflateEnd_1,
  209962. inflateGetHeader: inflateGetHeader_1,
  209963. inflateSetDictionary: inflateSetDictionary_1,
  209964. inflateInfo
  209965. };
  209966. var STR_APPLY_OK = true;
  209967. var STR_APPLY_UIA_OK = true;
  209968. try {
  209969. String.fromCharCode.apply(null, [0]);
  209970. } catch (__) {
  209971. STR_APPLY_OK = false;
  209972. }
  209973. try {
  209974. String.fromCharCode.apply(null, new Uint8Array(1));
  209975. } catch (__) {
  209976. STR_APPLY_UIA_OK = false;
  209977. }
  209978. var _utf8len = new common.Buf8(256);
  209979. for (q = 0; q < 256; q++) {
  209980. _utf8len[q] = q >= 252 ? 6 : q >= 248 ? 5 : q >= 240 ? 4 : q >= 224 ? 3 : q >= 192 ? 2 : 1;
  209981. }
  209982. var q;
  209983. _utf8len[254] = _utf8len[254] = 1;
  209984. var string2buf = function(str) {
  209985. var buf, c14, c22, m_pos, i2, str_len = str.length, buf_len = 0;
  209986. for (m_pos = 0; m_pos < str_len; m_pos++) {
  209987. c14 = str.charCodeAt(m_pos);
  209988. if ((c14 & 64512) === 55296 && m_pos + 1 < str_len) {
  209989. c22 = str.charCodeAt(m_pos + 1);
  209990. if ((c22 & 64512) === 56320) {
  209991. c14 = 65536 + (c14 - 55296 << 10) + (c22 - 56320);
  209992. m_pos++;
  209993. }
  209994. }
  209995. buf_len += c14 < 128 ? 1 : c14 < 2048 ? 2 : c14 < 65536 ? 3 : 4;
  209996. }
  209997. buf = new common.Buf8(buf_len);
  209998. for (i2 = 0, m_pos = 0; i2 < buf_len; m_pos++) {
  209999. c14 = str.charCodeAt(m_pos);
  210000. if ((c14 & 64512) === 55296 && m_pos + 1 < str_len) {
  210001. c22 = str.charCodeAt(m_pos + 1);
  210002. if ((c22 & 64512) === 56320) {
  210003. c14 = 65536 + (c14 - 55296 << 10) + (c22 - 56320);
  210004. m_pos++;
  210005. }
  210006. }
  210007. if (c14 < 128) {
  210008. buf[i2++] = c14;
  210009. } else if (c14 < 2048) {
  210010. buf[i2++] = 192 | c14 >>> 6;
  210011. buf[i2++] = 128 | c14 & 63;
  210012. } else if (c14 < 65536) {
  210013. buf[i2++] = 224 | c14 >>> 12;
  210014. buf[i2++] = 128 | c14 >>> 6 & 63;
  210015. buf[i2++] = 128 | c14 & 63;
  210016. } else {
  210017. buf[i2++] = 240 | c14 >>> 18;
  210018. buf[i2++] = 128 | c14 >>> 12 & 63;
  210019. buf[i2++] = 128 | c14 >>> 6 & 63;
  210020. buf[i2++] = 128 | c14 & 63;
  210021. }
  210022. }
  210023. return buf;
  210024. };
  210025. function buf2binstring(buf, len) {
  210026. if (len < 65534) {
  210027. if (buf.subarray && STR_APPLY_UIA_OK || !buf.subarray && STR_APPLY_OK) {
  210028. return String.fromCharCode.apply(null, common.shrinkBuf(buf, len));
  210029. }
  210030. }
  210031. var result = "";
  210032. for (var i2 = 0; i2 < len; i2++) {
  210033. result += String.fromCharCode(buf[i2]);
  210034. }
  210035. return result;
  210036. }
  210037. var buf2binstring_1 = function(buf) {
  210038. return buf2binstring(buf, buf.length);
  210039. };
  210040. var binstring2buf = function(str) {
  210041. var buf = new common.Buf8(str.length);
  210042. for (var i2 = 0, len = buf.length; i2 < len; i2++) {
  210043. buf[i2] = str.charCodeAt(i2);
  210044. }
  210045. return buf;
  210046. };
  210047. var buf2string = function(buf, max3) {
  210048. var i2, out, c14, c_len;
  210049. var len = max3 || buf.length;
  210050. var utf16buf = new Array(len * 2);
  210051. for (out = 0, i2 = 0; i2 < len; ) {
  210052. c14 = buf[i2++];
  210053. if (c14 < 128) {
  210054. utf16buf[out++] = c14;
  210055. continue;
  210056. }
  210057. c_len = _utf8len[c14];
  210058. if (c_len > 4) {
  210059. utf16buf[out++] = 65533;
  210060. i2 += c_len - 1;
  210061. continue;
  210062. }
  210063. c14 &= c_len === 2 ? 31 : c_len === 3 ? 15 : 7;
  210064. while (c_len > 1 && i2 < len) {
  210065. c14 = c14 << 6 | buf[i2++] & 63;
  210066. c_len--;
  210067. }
  210068. if (c_len > 1) {
  210069. utf16buf[out++] = 65533;
  210070. continue;
  210071. }
  210072. if (c14 < 65536) {
  210073. utf16buf[out++] = c14;
  210074. } else {
  210075. c14 -= 65536;
  210076. utf16buf[out++] = 55296 | c14 >> 10 & 1023;
  210077. utf16buf[out++] = 56320 | c14 & 1023;
  210078. }
  210079. }
  210080. return buf2binstring(utf16buf, out);
  210081. };
  210082. var utf8border = function(buf, max3) {
  210083. var pos;
  210084. max3 = max3 || buf.length;
  210085. if (max3 > buf.length) {
  210086. max3 = buf.length;
  210087. }
  210088. pos = max3 - 1;
  210089. while (pos >= 0 && (buf[pos] & 192) === 128) {
  210090. pos--;
  210091. }
  210092. if (pos < 0) {
  210093. return max3;
  210094. }
  210095. if (pos === 0) {
  210096. return max3;
  210097. }
  210098. return pos + _utf8len[buf[pos]] > max3 ? pos : max3;
  210099. };
  210100. var strings = {
  210101. string2buf,
  210102. buf2binstring: buf2binstring_1,
  210103. binstring2buf,
  210104. buf2string,
  210105. utf8border
  210106. };
  210107. var constants = {
  210108. Z_NO_FLUSH: 0,
  210109. Z_PARTIAL_FLUSH: 1,
  210110. Z_SYNC_FLUSH: 2,
  210111. Z_FULL_FLUSH: 3,
  210112. Z_FINISH: 4,
  210113. Z_BLOCK: 5,
  210114. Z_TREES: 6,
  210115. Z_OK: 0,
  210116. Z_STREAM_END: 1,
  210117. Z_NEED_DICT: 2,
  210118. Z_ERRNO: -1,
  210119. Z_STREAM_ERROR: -2,
  210120. Z_DATA_ERROR: -3,
  210121. Z_BUF_ERROR: -5,
  210122. Z_NO_COMPRESSION: 0,
  210123. Z_BEST_SPEED: 1,
  210124. Z_BEST_COMPRESSION: 9,
  210125. Z_DEFAULT_COMPRESSION: -1,
  210126. Z_FILTERED: 1,
  210127. Z_HUFFMAN_ONLY: 2,
  210128. Z_RLE: 3,
  210129. Z_FIXED: 4,
  210130. Z_DEFAULT_STRATEGY: 0,
  210131. Z_BINARY: 0,
  210132. Z_TEXT: 1,
  210133. Z_UNKNOWN: 2,
  210134. Z_DEFLATED: 8
  210135. };
  210136. var messages = {
  210137. 2: "need dictionary",
  210138. 1: "stream end",
  210139. 0: "",
  210140. "-1": "file error",
  210141. "-2": "stream error",
  210142. "-3": "data error",
  210143. "-4": "insufficient memory",
  210144. "-5": "buffer error",
  210145. "-6": "incompatible version"
  210146. };
  210147. function ZStream2() {
  210148. this.input = null;
  210149. this.next_in = 0;
  210150. this.avail_in = 0;
  210151. this.total_in = 0;
  210152. this.output = null;
  210153. this.next_out = 0;
  210154. this.avail_out = 0;
  210155. this.total_out = 0;
  210156. this.msg = "";
  210157. this.state = null;
  210158. this.data_type = 2;
  210159. this.adler = 0;
  210160. }
  210161. var zstream = ZStream2;
  210162. function GZheader() {
  210163. this.text = 0;
  210164. this.time = 0;
  210165. this.xflags = 0;
  210166. this.os = 0;
  210167. this.extra = null;
  210168. this.extra_len = 0;
  210169. this.name = "";
  210170. this.comment = "";
  210171. this.hcrc = 0;
  210172. this.done = false;
  210173. }
  210174. var gzheader = GZheader;
  210175. var toString = Object.prototype.toString;
  210176. function Inflate2(options) {
  210177. if (!(this instanceof Inflate2))
  210178. return new Inflate2(options);
  210179. this.options = common.assign({
  210180. chunkSize: 16384,
  210181. windowBits: 0,
  210182. to: ""
  210183. }, options || {});
  210184. var opt = this.options;
  210185. if (opt.raw && opt.windowBits >= 0 && opt.windowBits < 16) {
  210186. opt.windowBits = -opt.windowBits;
  210187. if (opt.windowBits === 0) {
  210188. opt.windowBits = -15;
  210189. }
  210190. }
  210191. if (opt.windowBits >= 0 && opt.windowBits < 16 && !(options && options.windowBits)) {
  210192. opt.windowBits += 32;
  210193. }
  210194. if (opt.windowBits > 15 && opt.windowBits < 48) {
  210195. if ((opt.windowBits & 15) === 0) {
  210196. opt.windowBits |= 15;
  210197. }
  210198. }
  210199. this.err = 0;
  210200. this.msg = "";
  210201. this.ended = false;
  210202. this.chunks = [];
  210203. this.strm = new zstream();
  210204. this.strm.avail_out = 0;
  210205. var status = inflate_1$1.inflateInit2(
  210206. this.strm,
  210207. opt.windowBits
  210208. );
  210209. if (status !== constants.Z_OK) {
  210210. throw new Error(messages[status]);
  210211. }
  210212. this.header = new gzheader();
  210213. inflate_1$1.inflateGetHeader(this.strm, this.header);
  210214. if (opt.dictionary) {
  210215. if (typeof opt.dictionary === "string") {
  210216. opt.dictionary = strings.string2buf(opt.dictionary);
  210217. } else if (toString.call(opt.dictionary) === "[object ArrayBuffer]") {
  210218. opt.dictionary = new Uint8Array(opt.dictionary);
  210219. }
  210220. if (opt.raw) {
  210221. status = inflate_1$1.inflateSetDictionary(this.strm, opt.dictionary);
  210222. if (status !== constants.Z_OK) {
  210223. throw new Error(messages[status]);
  210224. }
  210225. }
  210226. }
  210227. }
  210228. Inflate2.prototype.push = function(data, mode2) {
  210229. var strm = this.strm;
  210230. var chunkSize = this.options.chunkSize;
  210231. var dictionary = this.options.dictionary;
  210232. var status, _mode;
  210233. var next_out_utf8, tail, utf8str;
  210234. var allowBufError = false;
  210235. if (this.ended) {
  210236. return false;
  210237. }
  210238. _mode = mode2 === ~~mode2 ? mode2 : mode2 === true ? constants.Z_FINISH : constants.Z_NO_FLUSH;
  210239. if (typeof data === "string") {
  210240. strm.input = strings.binstring2buf(data);
  210241. } else if (toString.call(data) === "[object ArrayBuffer]") {
  210242. strm.input = new Uint8Array(data);
  210243. } else {
  210244. strm.input = data;
  210245. }
  210246. strm.next_in = 0;
  210247. strm.avail_in = strm.input.length;
  210248. do {
  210249. if (strm.avail_out === 0) {
  210250. strm.output = new common.Buf8(chunkSize);
  210251. strm.next_out = 0;
  210252. strm.avail_out = chunkSize;
  210253. }
  210254. status = inflate_1$1.inflate(strm, constants.Z_NO_FLUSH);
  210255. if (status === constants.Z_NEED_DICT && dictionary) {
  210256. status = inflate_1$1.inflateSetDictionary(this.strm, dictionary);
  210257. }
  210258. if (status === constants.Z_BUF_ERROR && allowBufError === true) {
  210259. status = constants.Z_OK;
  210260. allowBufError = false;
  210261. }
  210262. if (status !== constants.Z_STREAM_END && status !== constants.Z_OK) {
  210263. this.onEnd(status);
  210264. this.ended = true;
  210265. return false;
  210266. }
  210267. if (strm.next_out) {
  210268. if (strm.avail_out === 0 || status === constants.Z_STREAM_END || strm.avail_in === 0 && (_mode === constants.Z_FINISH || _mode === constants.Z_SYNC_FLUSH)) {
  210269. if (this.options.to === "string") {
  210270. next_out_utf8 = strings.utf8border(strm.output, strm.next_out);
  210271. tail = strm.next_out - next_out_utf8;
  210272. utf8str = strings.buf2string(strm.output, next_out_utf8);
  210273. strm.next_out = tail;
  210274. strm.avail_out = chunkSize - tail;
  210275. if (tail) {
  210276. common.arraySet(strm.output, strm.output, next_out_utf8, tail, 0);
  210277. }
  210278. this.onData(utf8str);
  210279. } else {
  210280. this.onData(common.shrinkBuf(strm.output, strm.next_out));
  210281. }
  210282. }
  210283. }
  210284. if (strm.avail_in === 0 && strm.avail_out === 0) {
  210285. allowBufError = true;
  210286. }
  210287. } while ((strm.avail_in > 0 || strm.avail_out === 0) && status !== constants.Z_STREAM_END);
  210288. if (status === constants.Z_STREAM_END) {
  210289. _mode = constants.Z_FINISH;
  210290. }
  210291. if (_mode === constants.Z_FINISH) {
  210292. status = inflate_1$1.inflateEnd(this.strm);
  210293. this.onEnd(status);
  210294. this.ended = true;
  210295. return status === constants.Z_OK;
  210296. }
  210297. if (_mode === constants.Z_SYNC_FLUSH) {
  210298. this.onEnd(constants.Z_OK);
  210299. strm.avail_out = 0;
  210300. return true;
  210301. }
  210302. return true;
  210303. };
  210304. Inflate2.prototype.onData = function(chunk) {
  210305. this.chunks.push(chunk);
  210306. };
  210307. Inflate2.prototype.onEnd = function(status) {
  210308. if (status === constants.Z_OK) {
  210309. if (this.options.to === "string") {
  210310. this.result = this.chunks.join("");
  210311. } else {
  210312. this.result = common.flattenChunks(this.chunks);
  210313. }
  210314. }
  210315. this.chunks = [];
  210316. this.err = status;
  210317. this.msg = this.strm.msg;
  210318. };
  210319. function inflate(input, options) {
  210320. var inflator = new Inflate2(options);
  210321. inflator.push(input, true);
  210322. if (inflator.err) {
  210323. throw inflator.msg || messages[inflator.err];
  210324. }
  210325. return inflator.result;
  210326. }
  210327. function inflateRaw(input, options) {
  210328. options = options || {};
  210329. options.raw = true;
  210330. return inflate(input, options);
  210331. }
  210332. var Inflate_1 = Inflate2;
  210333. var inflate_2 = inflate;
  210334. var inflateRaw_1 = inflateRaw;
  210335. var ungzip = inflate;
  210336. var inflate_1 = {
  210337. Inflate: Inflate_1,
  210338. inflate: inflate_2,
  210339. inflateRaw: inflateRaw_1,
  210340. ungzip
  210341. };
  210342. // node_modules/cesium/Source/Widgets/ClockViewModel.js
  210343. function ClockViewModel(clock) {
  210344. if (!defined_default(clock)) {
  210345. clock = new Clock_default();
  210346. }
  210347. this._clock = clock;
  210348. this._eventHelper = new EventHelper_default();
  210349. this._eventHelper.add(clock.onTick, this.synchronize, this);
  210350. this.systemTime = knockout_default.observable(JulianDate_default.now());
  210351. this.systemTime.equalityComparer = JulianDate_default.equals;
  210352. this.startTime = knockout_default.observable(clock.startTime);
  210353. this.startTime.equalityComparer = JulianDate_default.equals;
  210354. this.startTime.subscribe(function(value) {
  210355. clock.startTime = value;
  210356. this.synchronize();
  210357. }, this);
  210358. this.stopTime = knockout_default.observable(clock.stopTime);
  210359. this.stopTime.equalityComparer = JulianDate_default.equals;
  210360. this.stopTime.subscribe(function(value) {
  210361. clock.stopTime = value;
  210362. this.synchronize();
  210363. }, this);
  210364. this.currentTime = knockout_default.observable(clock.currentTime);
  210365. this.currentTime.equalityComparer = JulianDate_default.equals;
  210366. this.currentTime.subscribe(function(value) {
  210367. clock.currentTime = value;
  210368. this.synchronize();
  210369. }, this);
  210370. this.multiplier = knockout_default.observable(clock.multiplier);
  210371. this.multiplier.subscribe(function(value) {
  210372. clock.multiplier = value;
  210373. this.synchronize();
  210374. }, this);
  210375. this.clockStep = knockout_default.observable(clock.clockStep);
  210376. this.clockStep.subscribe(function(value) {
  210377. clock.clockStep = value;
  210378. this.synchronize();
  210379. }, this);
  210380. this.clockRange = knockout_default.observable(clock.clockRange);
  210381. this.clockRange.subscribe(function(value) {
  210382. clock.clockRange = value;
  210383. this.synchronize();
  210384. }, this);
  210385. this.canAnimate = knockout_default.observable(clock.canAnimate);
  210386. this.canAnimate.subscribe(function(value) {
  210387. clock.canAnimate = value;
  210388. this.synchronize();
  210389. }, this);
  210390. this.shouldAnimate = knockout_default.observable(clock.shouldAnimate);
  210391. this.shouldAnimate.subscribe(function(value) {
  210392. clock.shouldAnimate = value;
  210393. this.synchronize();
  210394. }, this);
  210395. knockout_default.track(this, [
  210396. "systemTime",
  210397. "startTime",
  210398. "stopTime",
  210399. "currentTime",
  210400. "multiplier",
  210401. "clockStep",
  210402. "clockRange",
  210403. "canAnimate",
  210404. "shouldAnimate"
  210405. ]);
  210406. }
  210407. Object.defineProperties(ClockViewModel.prototype, {
  210408. clock: {
  210409. get: function() {
  210410. return this._clock;
  210411. }
  210412. }
  210413. });
  210414. ClockViewModel.prototype.synchronize = function() {
  210415. const clock = this._clock;
  210416. this.systemTime = JulianDate_default.now();
  210417. this.startTime = clock.startTime;
  210418. this.stopTime = clock.stopTime;
  210419. this.currentTime = clock.currentTime;
  210420. this.multiplier = clock.multiplier;
  210421. this.clockStep = clock.clockStep;
  210422. this.clockRange = clock.clockRange;
  210423. this.canAnimate = clock.canAnimate;
  210424. this.shouldAnimate = clock.shouldAnimate;
  210425. };
  210426. ClockViewModel.prototype.isDestroyed = function() {
  210427. return false;
  210428. };
  210429. ClockViewModel.prototype.destroy = function() {
  210430. this._eventHelper.removeAll();
  210431. destroyObject_default(this);
  210432. };
  210433. var ClockViewModel_default = ClockViewModel;
  210434. // node_modules/cesium/Source/Widgets/Command.js
  210435. function Command() {
  210436. this.canExecute = void 0;
  210437. this.beforeExecute = void 0;
  210438. this.afterExecute = void 0;
  210439. DeveloperError_default.throwInstantiationError();
  210440. }
  210441. var Command_default = Command;
  210442. // node_modules/cesium/Source/Widgets/InspectorShared.js
  210443. var InspectorShared = {};
  210444. InspectorShared.createCheckbox = function(labelText, checkedBinding, enableBinding) {
  210445. Check_default.typeOf.string("labelText", labelText);
  210446. Check_default.typeOf.string("checkedBinding", checkedBinding);
  210447. const checkboxContainer = document.createElement("div");
  210448. const checkboxLabel = document.createElement("label");
  210449. const checkboxInput = document.createElement("input");
  210450. checkboxInput.type = "checkbox";
  210451. let binding = `checked: ${checkedBinding}`;
  210452. if (defined_default(enableBinding)) {
  210453. binding += `, enable: ${enableBinding}`;
  210454. }
  210455. checkboxInput.setAttribute("data-bind", binding);
  210456. checkboxLabel.appendChild(checkboxInput);
  210457. checkboxLabel.appendChild(document.createTextNode(labelText));
  210458. checkboxContainer.appendChild(checkboxLabel);
  210459. return checkboxContainer;
  210460. };
  210461. InspectorShared.createSection = function(panel, headerText, sectionVisibleBinding, toggleSectionVisibilityBinding) {
  210462. Check_default.defined("panel", panel);
  210463. Check_default.typeOf.string("headerText", headerText);
  210464. Check_default.typeOf.string("sectionVisibleBinding", sectionVisibleBinding);
  210465. Check_default.typeOf.string(
  210466. "toggleSectionVisibilityBinding",
  210467. toggleSectionVisibilityBinding
  210468. );
  210469. const section = document.createElement("div");
  210470. section.className = "cesium-cesiumInspector-section";
  210471. section.setAttribute(
  210472. "data-bind",
  210473. `css: { "cesium-cesiumInspector-section-collapsed": !${sectionVisibleBinding} }`
  210474. );
  210475. panel.appendChild(section);
  210476. const sectionHeader = document.createElement("h3");
  210477. sectionHeader.className = "cesium-cesiumInspector-sectionHeader";
  210478. sectionHeader.appendChild(document.createTextNode(headerText));
  210479. sectionHeader.setAttribute(
  210480. "data-bind",
  210481. `click: ${toggleSectionVisibilityBinding}`
  210482. );
  210483. section.appendChild(sectionHeader);
  210484. const sectionContent = document.createElement("div");
  210485. sectionContent.className = "cesium-cesiumInspector-sectionContent";
  210486. section.appendChild(sectionContent);
  210487. return sectionContent;
  210488. };
  210489. var InspectorShared_default = InspectorShared;
  210490. // node_modules/cesium/Source/Widgets/ToggleButtonViewModel.js
  210491. function ToggleButtonViewModel(command, options) {
  210492. if (!defined_default(command)) {
  210493. throw new DeveloperError_default("command is required.");
  210494. }
  210495. this._command = command;
  210496. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  210497. this.toggled = defaultValue_default(options.toggled, false);
  210498. this.tooltip = defaultValue_default(options.tooltip, "");
  210499. knockout_default.track(this, ["toggled", "tooltip"]);
  210500. }
  210501. Object.defineProperties(ToggleButtonViewModel.prototype, {
  210502. command: {
  210503. get: function() {
  210504. return this._command;
  210505. }
  210506. }
  210507. });
  210508. var ToggleButtonViewModel_default = ToggleButtonViewModel;
  210509. // node_modules/cesium/Source/Widgets/createCommand.js
  210510. function createCommand3(func, canExecute) {
  210511. if (!defined_default(func)) {
  210512. throw new DeveloperError_default("func is required.");
  210513. }
  210514. canExecute = defaultValue_default(canExecute, true);
  210515. const beforeExecute = new Event_default();
  210516. const afterExecute = new Event_default();
  210517. function command() {
  210518. if (!command.canExecute) {
  210519. throw new DeveloperError_default("Cannot execute command, canExecute is false.");
  210520. }
  210521. const commandInfo = {
  210522. args: arguments,
  210523. cancel: false
  210524. };
  210525. let result;
  210526. beforeExecute.raiseEvent(commandInfo);
  210527. if (!commandInfo.cancel) {
  210528. result = func.apply(null, arguments);
  210529. afterExecute.raiseEvent(result);
  210530. }
  210531. return result;
  210532. }
  210533. command.canExecute = canExecute;
  210534. knockout_default.track(command, ["canExecute"]);
  210535. Object.defineProperties(command, {
  210536. beforeExecute: {
  210537. value: beforeExecute
  210538. },
  210539. afterExecute: {
  210540. value: afterExecute
  210541. }
  210542. });
  210543. return command;
  210544. }
  210545. var createCommand_default = createCommand3;
  210546. // node_modules/cesium/Source/Widgets/subscribeAndEvaluate.js
  210547. function subscribeAndEvaluate(owner, observablePropertyName, callback, target, event) {
  210548. callback.call(target, owner[observablePropertyName]);
  210549. return knockout_default.getObservable(owner, observablePropertyName).subscribe(callback, target, event);
  210550. }
  210551. var subscribeAndEvaluate_default = subscribeAndEvaluate;
  210552. // node_modules/cesium/Source/Scene/ModelExperimental/UniformType.js
  210553. var UniformType = {
  210554. FLOAT: "float",
  210555. VEC2: "vec2",
  210556. VEC3: "vec3",
  210557. VEC4: "vec4",
  210558. INT: "int",
  210559. INT_VEC2: "ivec2",
  210560. INT_VEC3: "ivec3",
  210561. INT_VEC4: "ivec4",
  210562. BOOL: "bool",
  210563. BOOL_VEC2: "bvec2",
  210564. BOOL_VEC3: "bvec3",
  210565. BOOL_VEC4: "bvec4",
  210566. MAT2: "mat2",
  210567. MAT3: "mat2",
  210568. MAT4: "mat4",
  210569. SAMPLER_2D: "sampler2D",
  210570. SAMPLER_CUBE: "samplerCube"
  210571. };
  210572. var UniformType_default = Object.freeze(UniformType);
  210573. // node_modules/cesium/Source/Scene/ModelExperimental/TextureManager.js
  210574. function TextureManager() {
  210575. this._defaultTexture = void 0;
  210576. this._textures = {};
  210577. this._loadedImages = [];
  210578. this._lastUpdatedFrame = -1;
  210579. }
  210580. TextureManager.prototype.getTexture = function(textureId) {
  210581. return this._textures[textureId];
  210582. };
  210583. function fetchTexture2D(textureManager, textureId, textureUniform) {
  210584. textureUniform.resource.fetchImage().then(function(image) {
  210585. textureManager._loadedImages.push({
  210586. id: textureId,
  210587. image,
  210588. textureUniform
  210589. });
  210590. }).catch(function() {
  210591. const texture = textureManager._textures[textureId];
  210592. if (defined_default(texture) && texture !== textureManager._defaultTexture) {
  210593. texture.destroy();
  210594. }
  210595. textureManager._textures[textureId] = textureManager._defaultTexture;
  210596. });
  210597. }
  210598. TextureManager.prototype.loadTexture2D = function(textureId, textureUniform) {
  210599. if (defined_default(textureUniform.typedArray)) {
  210600. this._loadedImages.push({
  210601. id: textureId,
  210602. textureUniform
  210603. });
  210604. } else {
  210605. fetchTexture2D(this, textureId, textureUniform);
  210606. }
  210607. };
  210608. function createTexture6(textureManager, loadedImage, context) {
  210609. const id = loadedImage.id;
  210610. const textureUniform = loadedImage.textureUniform;
  210611. const typedArray = textureUniform.typedArray;
  210612. const sampler = textureUniform.sampler;
  210613. let texture;
  210614. if (defined_default(typedArray)) {
  210615. texture = new Texture_default({
  210616. context,
  210617. pixelFormat: textureUniform.pixelFormat,
  210618. pixelDatatype: textureUniform.pixelDatatype,
  210619. source: {
  210620. arrayBufferView: typedArray,
  210621. width: textureUniform.width,
  210622. height: textureUniform.height
  210623. },
  210624. sampler,
  210625. flipY: false
  210626. });
  210627. } else {
  210628. texture = new Texture_default({
  210629. context,
  210630. source: loadedImage.image,
  210631. sampler
  210632. });
  210633. }
  210634. const oldTexture = textureManager._textures[id];
  210635. if (defined_default(oldTexture) && oldTexture !== context.defaultTexture) {
  210636. oldTexture.destroy();
  210637. }
  210638. textureManager._textures[id] = texture;
  210639. }
  210640. TextureManager.prototype.update = function(frameState) {
  210641. if (frameState.frameNumber === this._lastUpdatedFrame) {
  210642. return;
  210643. }
  210644. this._lastUpdatedFrame = frameState.frameNumber;
  210645. const context = frameState.context;
  210646. this._defaultTexture = context.defaultTexture;
  210647. const loadedImages = this._loadedImages;
  210648. for (let i2 = 0; i2 < loadedImages.length; i2++) {
  210649. const loadedImage = loadedImages[i2];
  210650. createTexture6(this, loadedImage, context);
  210651. }
  210652. loadedImages.length = 0;
  210653. };
  210654. TextureManager.prototype.isDestroyed = function() {
  210655. return false;
  210656. };
  210657. TextureManager.prototype.destroy = function() {
  210658. const textures = this._textures;
  210659. for (const texture in textures) {
  210660. if (textures.hasOwnProperty(texture)) {
  210661. const instance = textures[texture];
  210662. if (instance !== this._defaultTexture) {
  210663. instance.destroy();
  210664. }
  210665. }
  210666. }
  210667. return destroyObject_default(this);
  210668. };
  210669. // node_modules/cesium/Source/Scene/ModelExperimental/CustomShader.js
  210670. function CustomShader(options) {
  210671. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  210672. this.mode = defaultValue_default(options.mode, CustomShaderMode_default.MODIFY_MATERIAL);
  210673. this.lightingModel = options.lightingModel;
  210674. this.uniforms = defaultValue_default(options.uniforms, defaultValue_default.EMPTY_OBJECT);
  210675. this.varyings = defaultValue_default(options.varyings, defaultValue_default.EMPTY_OBJECT);
  210676. this.vertexShaderText = options.vertexShaderText;
  210677. this.fragmentShaderText = options.fragmentShaderText;
  210678. this.isTranslucent = defaultValue_default(options.isTranslucent, false);
  210679. this._textureManager = new TextureManager();
  210680. this._defaultTexture = void 0;
  210681. this.uniformMap = buildUniformMap(this);
  210682. this.usedVariablesVertex = {
  210683. attributeSet: {},
  210684. featureIdSet: {},
  210685. metadataSet: {}
  210686. };
  210687. this.usedVariablesFragment = {
  210688. attributeSet: {},
  210689. featureIdSet: {},
  210690. metadataSet: {},
  210691. materialSet: {}
  210692. };
  210693. findUsedVariables(this);
  210694. validateBuiltinVariables(this);
  210695. }
  210696. function buildUniformMap(customShader) {
  210697. const uniforms = customShader.uniforms;
  210698. const uniformMap2 = {};
  210699. for (const uniformName in uniforms) {
  210700. if (uniforms.hasOwnProperty(uniformName)) {
  210701. const uniform = uniforms[uniformName];
  210702. const type = uniform.type;
  210703. if (type === UniformType_default.SAMPLER_CUBE) {
  210704. throw new DeveloperError_default(
  210705. "CustomShader does not support samplerCube uniforms"
  210706. );
  210707. }
  210708. if (type === UniformType_default.SAMPLER_2D) {
  210709. customShader._textureManager.loadTexture2D(uniformName, uniform.value);
  210710. uniformMap2[uniformName] = createUniformTexture2DFunction(
  210711. customShader,
  210712. uniformName
  210713. );
  210714. } else {
  210715. uniformMap2[uniformName] = createUniformFunction(
  210716. customShader,
  210717. uniformName
  210718. );
  210719. }
  210720. }
  210721. }
  210722. return uniformMap2;
  210723. }
  210724. function createUniformTexture2DFunction(customShader, uniformName) {
  210725. return function() {
  210726. return defaultValue_default(
  210727. customShader._textureManager.getTexture(uniformName),
  210728. customShader._defaultTexture
  210729. );
  210730. };
  210731. }
  210732. function createUniformFunction(customShader, uniformName) {
  210733. return function() {
  210734. return customShader.uniforms[uniformName].value;
  210735. };
  210736. }
  210737. function getVariables(shaderText, regex, outputSet) {
  210738. let match;
  210739. while ((match = regex.exec(shaderText)) !== null) {
  210740. const variableName = match[1];
  210741. outputSet[variableName] = true;
  210742. }
  210743. }
  210744. function findUsedVariables(customShader) {
  210745. const attributeRegex = /[vf]sInput\.attributes\.(\w+)/g;
  210746. const featureIdRegex = /[vf]sInput\.featureIds\.(\w+)/g;
  210747. const metadataRegex = /[vf]sInput\.metadata.(\w+)/g;
  210748. let attributeSet;
  210749. const vertexShaderText = customShader.vertexShaderText;
  210750. if (defined_default(vertexShaderText)) {
  210751. attributeSet = customShader.usedVariablesVertex.attributeSet;
  210752. getVariables(vertexShaderText, attributeRegex, attributeSet);
  210753. attributeSet = customShader.usedVariablesVertex.featureIdSet;
  210754. getVariables(vertexShaderText, featureIdRegex, attributeSet);
  210755. attributeSet = customShader.usedVariablesVertex.metadataSet;
  210756. getVariables(vertexShaderText, metadataRegex, attributeSet);
  210757. }
  210758. const fragmentShaderText = customShader.fragmentShaderText;
  210759. if (defined_default(fragmentShaderText)) {
  210760. attributeSet = customShader.usedVariablesFragment.attributeSet;
  210761. getVariables(fragmentShaderText, attributeRegex, attributeSet);
  210762. attributeSet = customShader.usedVariablesFragment.featureIdSet;
  210763. getVariables(fragmentShaderText, featureIdRegex, attributeSet);
  210764. attributeSet = customShader.usedVariablesFragment.metadataSet;
  210765. getVariables(fragmentShaderText, metadataRegex, attributeSet);
  210766. const materialRegex = /material\.(\w+)/g;
  210767. const materialSet = customShader.usedVariablesFragment.materialSet;
  210768. getVariables(fragmentShaderText, materialRegex, materialSet);
  210769. }
  210770. }
  210771. function expandCoordinateAbbreviations(variableName) {
  210772. const modelCoordinatesRegex = /^.*MC$/;
  210773. const worldCoordinatesRegex = /^.*WC$/;
  210774. const eyeCoordinatesRegex = /^.*EC$/;
  210775. if (modelCoordinatesRegex.test(variableName)) {
  210776. return `${variableName} (model coordinates)`;
  210777. }
  210778. if (worldCoordinatesRegex.test(variableName)) {
  210779. return `${variableName} (Cartesian world coordinates)`;
  210780. }
  210781. if (eyeCoordinatesRegex.test(variableName)) {
  210782. return `${variableName} (eye coordinates)`;
  210783. }
  210784. return variableName;
  210785. }
  210786. function validateVariableUsage(variableSet, incorrectVariable, correctVariable, vertexOrFragment) {
  210787. if (variableSet.hasOwnProperty(incorrectVariable)) {
  210788. const message = `${expandCoordinateAbbreviations(
  210789. incorrectVariable
  210790. )} is not available in the ${vertexOrFragment} shader. Did you mean ${expandCoordinateAbbreviations(
  210791. correctVariable
  210792. )} instead?`;
  210793. throw new DeveloperError_default(message);
  210794. }
  210795. }
  210796. function validateBuiltinVariables(customShader) {
  210797. const attributesVS = customShader.usedVariablesVertex.attributeSet;
  210798. validateVariableUsage(attributesVS, "position", "positionMC", "vertex");
  210799. validateVariableUsage(attributesVS, "normal", "normalMC", "vertex");
  210800. validateVariableUsage(attributesVS, "tangent", "tangentMC", "vertex");
  210801. validateVariableUsage(attributesVS, "bitangent", "bitangentMC", "vertex");
  210802. validateVariableUsage(attributesVS, "positionWC", "positionMC", "vertex");
  210803. validateVariableUsage(attributesVS, "positionEC", "positionMC", "vertex");
  210804. validateVariableUsage(attributesVS, "normalEC", "normalMC", "vertex");
  210805. validateVariableUsage(attributesVS, "tangentEC", "tangentMC", "vertex");
  210806. validateVariableUsage(attributesVS, "bitangentEC", "bitangentMC", "vertex");
  210807. const attributesFS = customShader.usedVariablesFragment.attributeSet;
  210808. validateVariableUsage(attributesFS, "position", "positionEC", "fragment");
  210809. validateVariableUsage(attributesFS, "normal", "normalEC", "fragment");
  210810. validateVariableUsage(attributesFS, "tangent", "tangentEC", "fragment");
  210811. validateVariableUsage(attributesFS, "bitangent", "bitangentEC", "fragment");
  210812. validateVariableUsage(attributesFS, "normalMC", "normalEC", "fragment");
  210813. validateVariableUsage(attributesFS, "tangentMC", "tangentEC", "fragment");
  210814. validateVariableUsage(attributesFS, "bitangentMC", "bitangentEC", "fragment");
  210815. }
  210816. CustomShader.prototype.setUniform = function(uniformName, value) {
  210817. Check_default.typeOf.string("uniformName", uniformName);
  210818. Check_default.defined("value", value);
  210819. if (!defined_default(this.uniforms[uniformName])) {
  210820. throw new DeveloperError_default(
  210821. `Uniform ${uniformName} must be declared in the CustomShader constructor.`
  210822. );
  210823. }
  210824. const uniform = this.uniforms[uniformName];
  210825. if (uniform.type === UniformType_default.SAMPLER_2D) {
  210826. this._textureManager.loadTexture2D(uniformName, value);
  210827. } else if (defined_default(value.clone)) {
  210828. uniform.value = value.clone(uniform.value);
  210829. } else {
  210830. uniform.value = value;
  210831. }
  210832. };
  210833. CustomShader.prototype.update = function(frameState) {
  210834. this._defaultTexture = frameState.context.defaultTexture;
  210835. this._textureManager.update(frameState);
  210836. };
  210837. CustomShader.prototype.isDestroyed = function() {
  210838. return false;
  210839. };
  210840. CustomShader.prototype.destroy = function() {
  210841. this._textureManager = this._textureManager && this._textureManager.destroy();
  210842. destroyObject_default(this);
  210843. };
  210844. // node_modules/cesium/Source/Scene/ModelExperimental/TextureUniform.js
  210845. function TextureUniform(options) {
  210846. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  210847. const hasTypedArray = defined_default(options.typedArray);
  210848. const hasUrl = defined_default(options.url);
  210849. if (hasTypedArray === hasUrl) {
  210850. throw new DeveloperError_default(
  210851. "exactly one of options.typedArray, options.url must be defined"
  210852. );
  210853. }
  210854. if (hasTypedArray && (!defined_default(options.width) || !defined_default(options.height))) {
  210855. throw new DeveloperError_default(
  210856. "options.width and options.height are required when options.typedArray is defined"
  210857. );
  210858. }
  210859. this.typedArray = options.typedArray;
  210860. this.width = options.width;
  210861. this.height = options.height;
  210862. this.pixelFormat = defaultValue_default(options.pixelFormat, PixelFormat_default.RGBA);
  210863. this.pixelDatatype = defaultValue_default(
  210864. options.pixelDatatype,
  210865. PixelDatatype_default.UNSIGNED_BYTE
  210866. );
  210867. let resource = options.url;
  210868. if (typeof resource === "string") {
  210869. resource = Resource_default.createIfNeeded(resource);
  210870. }
  210871. this.resource = resource;
  210872. const repeat = defaultValue_default(options.repeat, true);
  210873. const wrap = repeat ? TextureWrap_default.REPEAT : TextureWrap_default.CLAMP_TO_EDGE;
  210874. this.sampler = new Sampler_default({
  210875. wrapS: wrap,
  210876. wrapT: wrap,
  210877. minificationFilter: options.minificationFilter,
  210878. magnificationFilter: options.magnificationFilter,
  210879. maximumAnisotropy: options.maximumAnisotropy
  210880. });
  210881. }
  210882. // node_modules/cesium/Source/Scene/ModelExperimental/VaryingType.js
  210883. var VaryingType = {
  210884. FLOAT: "float",
  210885. VEC2: "vec2",
  210886. VEC3: "vec3",
  210887. VEC4: "vec4",
  210888. MAT2: "mat2",
  210889. MAT3: "mat2",
  210890. MAT4: "mat4"
  210891. };
  210892. var VaryingType_default = Object.freeze(VaryingType);
  210893. // node_modules/cesium/Source/Shaders/PostProcessStages/DepthViewPacked.js
  210894. var DepthViewPacked_default = "uniform sampler2D u_depthTexture;\n\nvarying vec2 v_textureCoordinates;\n\nvoid main()\n{\n float z_window = czm_unpackDepth(texture2D(u_depthTexture, v_textureCoordinates));\n z_window = czm_reverseLogDepth(z_window);\n float n_range = czm_depthRange.near;\n float f_range = czm_depthRange.far;\n float z_ndc = (2.0 * z_window - n_range - f_range) / (f_range - n_range);\n float scale = pow(z_ndc * 0.5 + 0.5, 8.0);\n gl_FragColor = vec4(mix(vec3(0.0), vec3(1.0), scale), 1.0);\n}\n";
  210895. // node_modules/cesium/Source/Widgets/Animation/Animation.js
  210896. var svgNS2 = "http://www.w3.org/2000/svg";
  210897. var xlinkNS = "http://www.w3.org/1999/xlink";
  210898. var widgetForDrag;
  210899. var gradientEnabledColor0 = Color_default.fromCssColorString(
  210900. "rgba(247,250,255,0.384)"
  210901. );
  210902. var gradientEnabledColor1 = Color_default.fromCssColorString(
  210903. "rgba(143,191,255,0.216)"
  210904. );
  210905. var gradientEnabledColor2 = Color_default.fromCssColorString(
  210906. "rgba(153,197,255,0.098)"
  210907. );
  210908. var gradientEnabledColor3 = Color_default.fromCssColorString(
  210909. "rgba(255,255,255,0.086)"
  210910. );
  210911. var gradientDisabledColor0 = Color_default.fromCssColorString(
  210912. "rgba(255,255,255,0.267)"
  210913. );
  210914. var gradientDisabledColor1 = Color_default.fromCssColorString("rgba(255,255,255,0)");
  210915. var gradientKnobColor = Color_default.fromCssColorString("rgba(66,67,68,0.3)");
  210916. var gradientPointerColor = Color_default.fromCssColorString("rgba(0,0,0,0.5)");
  210917. function getElementColor(element) {
  210918. return Color_default.fromCssColorString(
  210919. window.getComputedStyle(element).getPropertyValue("color")
  210920. );
  210921. }
  210922. var svgIconsById = {
  210923. animation_pathReset: {
  210924. tagName: "path",
  210925. transform: "translate(16,16) scale(0.85) translate(-16,-16)",
  210926. d: "M24.316,5.318,9.833,13.682,9.833,5.5,5.5,5.5,5.5,25.5,9.833,25.5,9.833,17.318,24.316,25.682z"
  210927. },
  210928. animation_pathPause: {
  210929. tagName: "path",
  210930. transform: "translate(16,16) scale(0.85) translate(-16,-16)",
  210931. d: "M13,5.5,7.5,5.5,7.5,25.5,13,25.5zM24.5,5.5,19,5.5,19,25.5,24.5,25.5z"
  210932. },
  210933. animation_pathPlay: {
  210934. tagName: "path",
  210935. transform: "translate(16,16) scale(0.85) translate(-16,-16)",
  210936. d: "M6.684,25.682L24.316,15.5L6.684,5.318V25.682z"
  210937. },
  210938. animation_pathPlayReverse: {
  210939. tagName: "path",
  210940. transform: "translate(16,16) scale(-0.85,0.85) translate(-16,-16)",
  210941. d: "M6.684,25.682L24.316,15.5L6.684,5.318V25.682z"
  210942. },
  210943. animation_pathLoop: {
  210944. tagName: "path",
  210945. transform: "translate(16,16) scale(0.85) translate(-16,-16)",
  210946. d: "M24.249,15.499c-0.009,4.832-3.918,8.741-8.75,8.75c-2.515,0-4.768-1.064-6.365-2.763l2.068-1.442l-7.901-3.703l0.744,8.694l2.193-1.529c2.244,2.594,5.562,4.242,9.26,4.242c6.767,0,12.249-5.482,12.249-12.249H24.249zM15.499,6.75c2.516,0,4.769,1.065,6.367,2.764l-2.068,1.443l7.901,3.701l-0.746-8.693l-2.192,1.529c-2.245-2.594-5.562-4.245-9.262-4.245C8.734,3.25,3.25,8.734,3.249,15.499H6.75C6.758,10.668,10.668,6.758,15.499,6.75z"
  210947. },
  210948. animation_pathClock: {
  210949. tagName: "path",
  210950. transform: "translate(16,16) scale(0.85) translate(-16,-15.5)",
  210951. d: "M15.5,2.374C8.251,2.375,2.376,8.251,2.374,15.5C2.376,22.748,8.251,28.623,15.5,28.627c7.249-0.004,13.124-5.879,13.125-13.127C28.624,8.251,22.749,2.375,15.5,2.374zM15.5,25.623C9.909,25.615,5.385,21.09,5.375,15.5C5.385,9.909,9.909,5.384,15.5,5.374c5.59,0.01,10.115,4.535,10.124,10.125C25.615,21.09,21.091,25.615,15.5,25.623zM8.625,15.5c-0.001-0.552-0.448-0.999-1.001-1c-0.553,0-1,0.448-1,1c0,0.553,0.449,1,1,1C8.176,16.5,8.624,16.053,8.625,15.5zM8.179,18.572c-0.478,0.277-0.642,0.889-0.365,1.367c0.275,0.479,0.889,0.641,1.365,0.365c0.479-0.275,0.643-0.887,0.367-1.367C9.27,18.461,8.658,18.297,8.179,18.572zM9.18,10.696c-0.479-0.276-1.09-0.112-1.366,0.366s-0.111,1.09,0.365,1.366c0.479,0.276,1.09,0.113,1.367-0.366C9.821,11.584,9.657,10.973,9.18,10.696zM22.822,12.428c0.478-0.275,0.643-0.888,0.366-1.366c-0.275-0.478-0.89-0.642-1.366-0.366c-0.479,0.278-0.642,0.89-0.366,1.367C21.732,12.54,22.344,12.705,22.822,12.428zM12.062,21.455c-0.478-0.275-1.089-0.111-1.366,0.367c-0.275,0.479-0.111,1.09,0.366,1.365c0.478,0.277,1.091,0.111,1.365-0.365C12.704,22.344,12.54,21.732,12.062,21.455zM12.062,9.545c0.479-0.276,0.642-0.888,0.366-1.366c-0.276-0.478-0.888-0.642-1.366-0.366s-0.642,0.888-0.366,1.366C10.973,9.658,11.584,9.822,12.062,9.545zM22.823,18.572c-0.48-0.275-1.092-0.111-1.367,0.365c-0.275,0.479-0.112,1.092,0.367,1.367c0.477,0.275,1.089,0.113,1.365-0.365C23.464,19.461,23.3,18.848,22.823,18.572zM19.938,7.813c-0.477-0.276-1.091-0.111-1.365,0.366c-0.275,0.48-0.111,1.091,0.366,1.367s1.089,0.112,1.366-0.366C20.581,8.702,20.418,8.089,19.938,7.813zM23.378,14.5c-0.554,0.002-1.001,0.45-1.001,1c0.001,0.552,0.448,1,1.001,1c0.551,0,1-0.447,1-1C24.378,14.949,23.929,14.5,23.378,14.5zM15.501,6.624c-0.552,0-1,0.448-1,1l-0.466,7.343l-3.004,1.96c-0.478,0.277-0.642,0.889-0.365,1.365c0.275,0.479,0.889,0.643,1.365,0.367l3.305-1.676C15.39,16.99,15.444,17,15.501,17c0.828,0,1.5-0.671,1.5-1.5l-0.5-7.876C16.501,7.072,16.053,6.624,15.501,6.624zM15.501,22.377c-0.552,0-1,0.447-1,1s0.448,1,1,1s1-0.447,1-1S16.053,22.377,15.501,22.377zM18.939,21.455c-0.479,0.277-0.643,0.889-0.366,1.367c0.275,0.477,0.888,0.643,1.366,0.365c0.478-0.275,0.642-0.889,0.366-1.365C20.028,21.344,19.417,21.18,18.939,21.455z"
  210952. },
  210953. animation_pathWingButton: {
  210954. tagName: "path",
  210955. d: "m 4.5,0.5 c -2.216,0 -4,1.784 -4,4 l 0,24 c 0,2.216 1.784,4 4,4 l 13.71875,0 C 22.478584,27.272785 27.273681,22.511272 32.5,18.25 l 0,-13.75 c 0,-2.216 -1.784,-4 -4,-4 l -24,0 z"
  210956. },
  210957. animation_pathPointer: {
  210958. tagName: "path",
  210959. d: "M-15,-65,-15,-55,15,-55,15,-65,0,-95z"
  210960. },
  210961. animation_pathSwooshFX: {
  210962. tagName: "path",
  210963. d: "m 85,0 c 0,16.617 -4.813944,35.356 -13.131081,48.4508 h 6.099803 c 8.317138,-13.0948 13.13322,-28.5955 13.13322,-45.2124 0,-46.94483 -38.402714,-85.00262 -85.7743869,-85.00262 -1.0218522,0 -2.0373001,0.0241 -3.0506131,0.0589 45.958443,1.59437 82.723058,35.77285 82.723058,81.70532 z"
  210964. }
  210965. };
  210966. function svgFromObject(obj) {
  210967. const ele = document.createElementNS(svgNS2, obj.tagName);
  210968. for (const field in obj) {
  210969. if (obj.hasOwnProperty(field) && field !== "tagName") {
  210970. if (field === "children") {
  210971. const len = obj.children.length;
  210972. for (let i2 = 0; i2 < len; ++i2) {
  210973. ele.appendChild(svgFromObject(obj.children[i2]));
  210974. }
  210975. } else if (field.indexOf("xlink:") === 0) {
  210976. ele.setAttributeNS(xlinkNS, field.substring(6), obj[field]);
  210977. } else if (field === "textContent") {
  210978. ele.textContent = obj[field];
  210979. } else {
  210980. ele.setAttribute(field, obj[field]);
  210981. }
  210982. }
  210983. }
  210984. return ele;
  210985. }
  210986. function svgText(x, y, msg) {
  210987. const text2 = document.createElementNS(svgNS2, "text");
  210988. text2.setAttribute("x", x);
  210989. text2.setAttribute("y", y);
  210990. text2.setAttribute("class", "cesium-animation-svgText");
  210991. const tspan = document.createElementNS(svgNS2, "tspan");
  210992. tspan.textContent = msg;
  210993. text2.appendChild(tspan);
  210994. return text2;
  210995. }
  210996. function setShuttleRingPointer(shuttleRingPointer, knobOuter, angle) {
  210997. shuttleRingPointer.setAttribute(
  210998. "transform",
  210999. `translate(100,100) rotate(${angle})`
  211000. );
  211001. knobOuter.setAttribute("transform", `rotate(${angle})`);
  211002. }
  211003. var makeColorStringScratch = new Color_default();
  211004. function makeColorString(background, gradient) {
  211005. const gradientAlpha = gradient.alpha;
  211006. const backgroundAlpha = 1 - gradientAlpha;
  211007. makeColorStringScratch.red = background.red * backgroundAlpha + gradient.red * gradientAlpha;
  211008. makeColorStringScratch.green = background.green * backgroundAlpha + gradient.green * gradientAlpha;
  211009. makeColorStringScratch.blue = background.blue * backgroundAlpha + gradient.blue * gradientAlpha;
  211010. return makeColorStringScratch.toCssColorString();
  211011. }
  211012. function rectButton(x, y, path) {
  211013. const iconInfo = svgIconsById[path];
  211014. const button = {
  211015. tagName: "g",
  211016. class: "cesium-animation-rectButton",
  211017. transform: `translate(${x},${y})`,
  211018. children: [
  211019. {
  211020. tagName: "rect",
  211021. class: "cesium-animation-buttonGlow",
  211022. width: 32,
  211023. height: 32,
  211024. rx: 2,
  211025. ry: 2
  211026. },
  211027. {
  211028. tagName: "rect",
  211029. class: "cesium-animation-buttonMain",
  211030. width: 32,
  211031. height: 32,
  211032. rx: 4,
  211033. ry: 4
  211034. },
  211035. {
  211036. class: "cesium-animation-buttonPath",
  211037. id: path,
  211038. tagName: iconInfo.tagName,
  211039. transform: iconInfo.transform,
  211040. d: iconInfo.d
  211041. },
  211042. {
  211043. tagName: "title",
  211044. textContent: ""
  211045. }
  211046. ]
  211047. };
  211048. return svgFromObject(button);
  211049. }
  211050. function wingButton(x, y, path) {
  211051. const buttonIconInfo = svgIconsById[path];
  211052. const wingIconInfo = svgIconsById["animation_pathWingButton"];
  211053. const button = {
  211054. tagName: "g",
  211055. class: "cesium-animation-rectButton",
  211056. transform: `translate(${x},${y})`,
  211057. children: [
  211058. {
  211059. class: "cesium-animation-buttonGlow",
  211060. id: "animation_pathWingButton",
  211061. tagName: wingIconInfo.tagName,
  211062. d: wingIconInfo.d
  211063. },
  211064. {
  211065. class: "cesium-animation-buttonMain",
  211066. id: "animation_pathWingButton",
  211067. tagName: wingIconInfo.tagName,
  211068. d: wingIconInfo.d
  211069. },
  211070. {
  211071. class: "cesium-animation-buttonPath",
  211072. id: path,
  211073. tagName: buttonIconInfo.tagName,
  211074. transform: buttonIconInfo.transform,
  211075. d: buttonIconInfo.d
  211076. },
  211077. {
  211078. tagName: "title",
  211079. textContent: ""
  211080. }
  211081. ]
  211082. };
  211083. return svgFromObject(button);
  211084. }
  211085. function setShuttleRingFromMouseOrTouch(widget, e2) {
  211086. const viewModel = widget._viewModel;
  211087. const shuttleRingDragging = viewModel.shuttleRingDragging;
  211088. if (shuttleRingDragging && widgetForDrag !== widget) {
  211089. return;
  211090. }
  211091. if (e2.type === "mousedown" || shuttleRingDragging && e2.type === "mousemove" || e2.type === "touchstart" && e2.touches.length === 1 || shuttleRingDragging && e2.type === "touchmove" && e2.touches.length === 1) {
  211092. const centerX = widget._centerX;
  211093. const centerY = widget._centerY;
  211094. const svg2 = widget._svgNode;
  211095. const rect = svg2.getBoundingClientRect();
  211096. let clientX;
  211097. let clientY;
  211098. if (e2.type === "touchstart" || e2.type === "touchmove") {
  211099. clientX = e2.touches[0].clientX;
  211100. clientY = e2.touches[0].clientY;
  211101. } else {
  211102. clientX = e2.clientX;
  211103. clientY = e2.clientY;
  211104. }
  211105. if (!shuttleRingDragging && (clientX > rect.right || clientX < rect.left || clientY < rect.top || clientY > rect.bottom)) {
  211106. return;
  211107. }
  211108. const pointerRect = widget._shuttleRingPointer.getBoundingClientRect();
  211109. const x = clientX - centerX - rect.left;
  211110. const y = clientY - centerY - rect.top;
  211111. let angle = Math.atan2(y, x) * 180 / Math.PI + 90;
  211112. if (angle > 180) {
  211113. angle -= 360;
  211114. }
  211115. const shuttleRingAngle = viewModel.shuttleRingAngle;
  211116. if (shuttleRingDragging || clientX < pointerRect.right && clientX > pointerRect.left && clientY > pointerRect.top && clientY < pointerRect.bottom) {
  211117. widgetForDrag = widget;
  211118. viewModel.shuttleRingDragging = true;
  211119. viewModel.shuttleRingAngle = angle;
  211120. } else if (angle < shuttleRingAngle) {
  211121. viewModel.slower();
  211122. } else if (angle > shuttleRingAngle) {
  211123. viewModel.faster();
  211124. }
  211125. e2.preventDefault();
  211126. } else {
  211127. if (widget === widgetForDrag) {
  211128. widgetForDrag = void 0;
  211129. }
  211130. viewModel.shuttleRingDragging = false;
  211131. }
  211132. }
  211133. function SvgButton(svgElement, viewModel) {
  211134. this._viewModel = viewModel;
  211135. this.svgElement = svgElement;
  211136. this._enabled = void 0;
  211137. this._toggled = void 0;
  211138. const that = this;
  211139. this._clickFunction = function() {
  211140. const command = that._viewModel.command;
  211141. if (command.canExecute) {
  211142. command();
  211143. }
  211144. };
  211145. svgElement.addEventListener("click", this._clickFunction, true);
  211146. this._subscriptions = [
  211147. subscribeAndEvaluate_default(viewModel, "toggled", this.setToggled, this),
  211148. subscribeAndEvaluate_default(viewModel, "tooltip", this.setTooltip, this),
  211149. subscribeAndEvaluate_default(
  211150. viewModel.command,
  211151. "canExecute",
  211152. this.setEnabled,
  211153. this
  211154. )
  211155. ];
  211156. }
  211157. SvgButton.prototype.destroy = function() {
  211158. this.svgElement.removeEventListener("click", this._clickFunction, true);
  211159. const subscriptions = this._subscriptions;
  211160. for (let i2 = 0, len = subscriptions.length; i2 < len; i2++) {
  211161. subscriptions[i2].dispose();
  211162. }
  211163. destroyObject_default(this);
  211164. };
  211165. SvgButton.prototype.isDestroyed = function() {
  211166. return false;
  211167. };
  211168. SvgButton.prototype.setEnabled = function(enabled) {
  211169. if (this._enabled !== enabled) {
  211170. this._enabled = enabled;
  211171. if (!enabled) {
  211172. this.svgElement.setAttribute("class", "cesium-animation-buttonDisabled");
  211173. return;
  211174. }
  211175. if (this._toggled) {
  211176. this.svgElement.setAttribute(
  211177. "class",
  211178. "cesium-animation-rectButton cesium-animation-buttonToggled"
  211179. );
  211180. return;
  211181. }
  211182. this.svgElement.setAttribute("class", "cesium-animation-rectButton");
  211183. }
  211184. };
  211185. SvgButton.prototype.setToggled = function(toggled) {
  211186. if (this._toggled !== toggled) {
  211187. this._toggled = toggled;
  211188. if (this._enabled) {
  211189. if (toggled) {
  211190. this.svgElement.setAttribute(
  211191. "class",
  211192. "cesium-animation-rectButton cesium-animation-buttonToggled"
  211193. );
  211194. } else {
  211195. this.svgElement.setAttribute("class", "cesium-animation-rectButton");
  211196. }
  211197. }
  211198. }
  211199. };
  211200. SvgButton.prototype.setTooltip = function(tooltip) {
  211201. this.svgElement.getElementsByTagName("title")[0].textContent = tooltip;
  211202. };
  211203. function Animation3(container, viewModel) {
  211204. if (!defined_default(container)) {
  211205. throw new DeveloperError_default("container is required.");
  211206. }
  211207. if (!defined_default(viewModel)) {
  211208. throw new DeveloperError_default("viewModel is required.");
  211209. }
  211210. container = getElement_default(container);
  211211. this._viewModel = viewModel;
  211212. this._container = container;
  211213. this._centerX = 0;
  211214. this._centerY = 0;
  211215. this._defsElement = void 0;
  211216. this._svgNode = void 0;
  211217. this._topG = void 0;
  211218. this._lastHeight = void 0;
  211219. this._lastWidth = void 0;
  211220. const ownerDocument = container.ownerDocument;
  211221. const cssStyle = document.createElement("style");
  211222. cssStyle.textContent = ".cesium-animation-rectButton .cesium-animation-buttonGlow { filter: url(#animation_blurred); }.cesium-animation-rectButton .cesium-animation-buttonMain { fill: url(#animation_buttonNormal); }.cesium-animation-buttonToggled .cesium-animation-buttonMain { fill: url(#animation_buttonToggled); }.cesium-animation-rectButton:hover .cesium-animation-buttonMain { fill: url(#animation_buttonHovered); }.cesium-animation-buttonDisabled .cesium-animation-buttonMain { fill: url(#animation_buttonDisabled); }.cesium-animation-shuttleRingG .cesium-animation-shuttleRingSwoosh { fill: url(#animation_shuttleRingSwooshGradient); }.cesium-animation-shuttleRingG:hover .cesium-animation-shuttleRingSwoosh { fill: url(#animation_shuttleRingSwooshHovered); }.cesium-animation-shuttleRingPointer { fill: url(#animation_shuttleRingPointerGradient); }.cesium-animation-shuttleRingPausePointer { fill: url(#animation_shuttleRingPointerPaused); }.cesium-animation-knobOuter { fill: url(#animation_knobOuter); }.cesium-animation-knobInner { fill: url(#animation_knobInner); }";
  211223. ownerDocument.head.insertBefore(cssStyle, ownerDocument.head.childNodes[0]);
  211224. const themeEle = document.createElement("div");
  211225. themeEle.className = "cesium-animation-theme";
  211226. themeEle.innerHTML = '<div class="cesium-animation-themeNormal"></div><div class="cesium-animation-themeHover"></div><div class="cesium-animation-themeSelect"></div><div class="cesium-animation-themeDisabled"></div><div class="cesium-animation-themeKnob"></div><div class="cesium-animation-themePointer"></div><div class="cesium-animation-themeSwoosh"></div><div class="cesium-animation-themeSwooshHover"></div>';
  211227. this._theme = themeEle;
  211228. this._themeNormal = themeEle.childNodes[0];
  211229. this._themeHover = themeEle.childNodes[1];
  211230. this._themeSelect = themeEle.childNodes[2];
  211231. this._themeDisabled = themeEle.childNodes[3];
  211232. this._themeKnob = themeEle.childNodes[4];
  211233. this._themePointer = themeEle.childNodes[5];
  211234. this._themeSwoosh = themeEle.childNodes[6];
  211235. this._themeSwooshHover = themeEle.childNodes[7];
  211236. const svg2 = document.createElementNS(svgNS2, "svg:svg");
  211237. this._svgNode = svg2;
  211238. svg2.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", xlinkNS);
  211239. const topG = document.createElementNS(svgNS2, "g");
  211240. this._topG = topG;
  211241. this._realtimeSVG = new SvgButton(
  211242. wingButton(3, 4, "animation_pathClock"),
  211243. viewModel.playRealtimeViewModel
  211244. );
  211245. this._playReverseSVG = new SvgButton(
  211246. rectButton(44, 99, "animation_pathPlayReverse"),
  211247. viewModel.playReverseViewModel
  211248. );
  211249. this._playForwardSVG = new SvgButton(
  211250. rectButton(124, 99, "animation_pathPlay"),
  211251. viewModel.playForwardViewModel
  211252. );
  211253. this._pauseSVG = new SvgButton(
  211254. rectButton(84, 99, "animation_pathPause"),
  211255. viewModel.pauseViewModel
  211256. );
  211257. const buttonsG = document.createElementNS(svgNS2, "g");
  211258. buttonsG.appendChild(this._realtimeSVG.svgElement);
  211259. buttonsG.appendChild(this._playReverseSVG.svgElement);
  211260. buttonsG.appendChild(this._playForwardSVG.svgElement);
  211261. buttonsG.appendChild(this._pauseSVG.svgElement);
  211262. const shuttleRingBackPanel = svgFromObject({
  211263. tagName: "circle",
  211264. class: "cesium-animation-shuttleRingBack",
  211265. cx: 100,
  211266. cy: 100,
  211267. r: 99
  211268. });
  211269. this._shuttleRingBackPanel = shuttleRingBackPanel;
  211270. const swooshIconInfo = svgIconsById["animation_pathSwooshFX"];
  211271. const shuttleRingPointerIconInfo = svgIconsById["animation_pathPointer"];
  211272. const shuttleRingSwooshG = svgFromObject({
  211273. tagName: "g",
  211274. class: "cesium-animation-shuttleRingSwoosh",
  211275. children: [
  211276. {
  211277. tagName: swooshIconInfo.tagName,
  211278. transform: "translate(100,97) scale(-1,1)",
  211279. id: "animation_pathSwooshFX",
  211280. d: swooshIconInfo.d
  211281. },
  211282. {
  211283. tagName: swooshIconInfo.tagName,
  211284. transform: "translate(100,97)",
  211285. id: "animation_pathSwooshFX",
  211286. d: swooshIconInfo.d
  211287. },
  211288. {
  211289. tagName: "line",
  211290. x1: 100,
  211291. y1: 8,
  211292. x2: 100,
  211293. y2: 22
  211294. }
  211295. ]
  211296. });
  211297. this._shuttleRingSwooshG = shuttleRingSwooshG;
  211298. this._shuttleRingPointer = svgFromObject({
  211299. class: "cesium-animation-shuttleRingPointer",
  211300. id: "animation_pathPointer",
  211301. tagName: shuttleRingPointerIconInfo.tagName,
  211302. d: shuttleRingPointerIconInfo.d
  211303. });
  211304. const knobG = svgFromObject({
  211305. tagName: "g",
  211306. transform: "translate(100,100)"
  211307. });
  211308. this._knobOuter = svgFromObject({
  211309. tagName: "circle",
  211310. class: "cesium-animation-knobOuter",
  211311. cx: 0,
  211312. cy: 0,
  211313. r: 71
  211314. });
  211315. const knobInnerAndShieldSize = 61;
  211316. const knobInner = svgFromObject({
  211317. tagName: "circle",
  211318. class: "cesium-animation-knobInner",
  211319. cx: 0,
  211320. cy: 0,
  211321. r: knobInnerAndShieldSize
  211322. });
  211323. this._knobDate = svgText(0, -24, "");
  211324. this._knobTime = svgText(0, -7, "");
  211325. this._knobStatus = svgText(0, -41, "");
  211326. const knobShield = svgFromObject({
  211327. tagName: "circle",
  211328. class: "cesium-animation-blank",
  211329. cx: 0,
  211330. cy: 0,
  211331. r: knobInnerAndShieldSize
  211332. });
  211333. const shuttleRingBackG = document.createElementNS(svgNS2, "g");
  211334. shuttleRingBackG.setAttribute("class", "cesium-animation-shuttleRingG");
  211335. container.appendChild(themeEle);
  211336. topG.appendChild(shuttleRingBackG);
  211337. topG.appendChild(knobG);
  211338. topG.appendChild(buttonsG);
  211339. shuttleRingBackG.appendChild(shuttleRingBackPanel);
  211340. shuttleRingBackG.appendChild(shuttleRingSwooshG);
  211341. shuttleRingBackG.appendChild(this._shuttleRingPointer);
  211342. knobG.appendChild(this._knobOuter);
  211343. knobG.appendChild(knobInner);
  211344. knobG.appendChild(this._knobDate);
  211345. knobG.appendChild(this._knobTime);
  211346. knobG.appendChild(this._knobStatus);
  211347. knobG.appendChild(knobShield);
  211348. svg2.appendChild(topG);
  211349. container.appendChild(svg2);
  211350. const that = this;
  211351. function mouseCallback(e2) {
  211352. setShuttleRingFromMouseOrTouch(that, e2);
  211353. }
  211354. this._mouseCallback = mouseCallback;
  211355. shuttleRingBackPanel.addEventListener("mousedown", mouseCallback, true);
  211356. shuttleRingBackPanel.addEventListener("touchstart", mouseCallback, true);
  211357. shuttleRingSwooshG.addEventListener("mousedown", mouseCallback, true);
  211358. shuttleRingSwooshG.addEventListener("touchstart", mouseCallback, true);
  211359. ownerDocument.addEventListener("mousemove", mouseCallback, true);
  211360. ownerDocument.addEventListener("touchmove", mouseCallback, true);
  211361. ownerDocument.addEventListener("mouseup", mouseCallback, true);
  211362. ownerDocument.addEventListener("touchend", mouseCallback, true);
  211363. ownerDocument.addEventListener("touchcancel", mouseCallback, true);
  211364. this._shuttleRingPointer.addEventListener("mousedown", mouseCallback, true);
  211365. this._shuttleRingPointer.addEventListener("touchstart", mouseCallback, true);
  211366. this._knobOuter.addEventListener("mousedown", mouseCallback, true);
  211367. this._knobOuter.addEventListener("touchstart", mouseCallback, true);
  211368. const timeNode = this._knobTime.childNodes[0];
  211369. const dateNode = this._knobDate.childNodes[0];
  211370. const statusNode = this._knobStatus.childNodes[0];
  211371. let isPaused;
  211372. this._subscriptions = [
  211373. subscribeAndEvaluate_default(viewModel.pauseViewModel, "toggled", function(value) {
  211374. if (isPaused !== value) {
  211375. isPaused = value;
  211376. if (isPaused) {
  211377. that._shuttleRingPointer.setAttribute(
  211378. "class",
  211379. "cesium-animation-shuttleRingPausePointer"
  211380. );
  211381. } else {
  211382. that._shuttleRingPointer.setAttribute(
  211383. "class",
  211384. "cesium-animation-shuttleRingPointer"
  211385. );
  211386. }
  211387. }
  211388. }),
  211389. subscribeAndEvaluate_default(viewModel, "shuttleRingAngle", function(value) {
  211390. setShuttleRingPointer(that._shuttleRingPointer, that._knobOuter, value);
  211391. }),
  211392. subscribeAndEvaluate_default(viewModel, "dateLabel", function(value) {
  211393. if (dateNode.textContent !== value) {
  211394. dateNode.textContent = value;
  211395. }
  211396. }),
  211397. subscribeAndEvaluate_default(viewModel, "timeLabel", function(value) {
  211398. if (timeNode.textContent !== value) {
  211399. timeNode.textContent = value;
  211400. }
  211401. }),
  211402. subscribeAndEvaluate_default(viewModel, "multiplierLabel", function(value) {
  211403. if (statusNode.textContent !== value) {
  211404. statusNode.textContent = value;
  211405. }
  211406. })
  211407. ];
  211408. this.applyThemeChanges();
  211409. this.resize();
  211410. }
  211411. Object.defineProperties(Animation3.prototype, {
  211412. container: {
  211413. get: function() {
  211414. return this._container;
  211415. }
  211416. },
  211417. viewModel: {
  211418. get: function() {
  211419. return this._viewModel;
  211420. }
  211421. }
  211422. });
  211423. Animation3.prototype.isDestroyed = function() {
  211424. return false;
  211425. };
  211426. Animation3.prototype.destroy = function() {
  211427. if (defined_default(this._observer)) {
  211428. this._observer.disconnect();
  211429. this._observer = void 0;
  211430. }
  211431. const doc = this._container.ownerDocument;
  211432. const mouseCallback = this._mouseCallback;
  211433. this._shuttleRingBackPanel.removeEventListener(
  211434. "mousedown",
  211435. mouseCallback,
  211436. true
  211437. );
  211438. this._shuttleRingBackPanel.removeEventListener(
  211439. "touchstart",
  211440. mouseCallback,
  211441. true
  211442. );
  211443. this._shuttleRingSwooshG.removeEventListener(
  211444. "mousedown",
  211445. mouseCallback,
  211446. true
  211447. );
  211448. this._shuttleRingSwooshG.removeEventListener(
  211449. "touchstart",
  211450. mouseCallback,
  211451. true
  211452. );
  211453. doc.removeEventListener("mousemove", mouseCallback, true);
  211454. doc.removeEventListener("touchmove", mouseCallback, true);
  211455. doc.removeEventListener("mouseup", mouseCallback, true);
  211456. doc.removeEventListener("touchend", mouseCallback, true);
  211457. doc.removeEventListener("touchcancel", mouseCallback, true);
  211458. this._shuttleRingPointer.removeEventListener(
  211459. "mousedown",
  211460. mouseCallback,
  211461. true
  211462. );
  211463. this._shuttleRingPointer.removeEventListener(
  211464. "touchstart",
  211465. mouseCallback,
  211466. true
  211467. );
  211468. this._knobOuter.removeEventListener("mousedown", mouseCallback, true);
  211469. this._knobOuter.removeEventListener("touchstart", mouseCallback, true);
  211470. this._container.removeChild(this._svgNode);
  211471. this._container.removeChild(this._theme);
  211472. this._realtimeSVG.destroy();
  211473. this._playReverseSVG.destroy();
  211474. this._playForwardSVG.destroy();
  211475. this._pauseSVG.destroy();
  211476. const subscriptions = this._subscriptions;
  211477. for (let i2 = 0, len = subscriptions.length; i2 < len; i2++) {
  211478. subscriptions[i2].dispose();
  211479. }
  211480. return destroyObject_default(this);
  211481. };
  211482. Animation3.prototype.resize = function() {
  211483. const parentWidth = this._container.clientWidth;
  211484. const parentHeight = this._container.clientHeight;
  211485. if (parentWidth === this._lastWidth && parentHeight === this._lastHeight) {
  211486. return;
  211487. }
  211488. const svg2 = this._svgNode;
  211489. const baseWidth = 200;
  211490. const baseHeight = 132;
  211491. let width = parentWidth;
  211492. let height = parentHeight;
  211493. if (parentWidth === 0 && parentHeight === 0) {
  211494. width = baseWidth;
  211495. height = baseHeight;
  211496. } else if (parentWidth === 0) {
  211497. height = parentHeight;
  211498. width = baseWidth * (parentHeight / baseHeight);
  211499. } else if (parentHeight === 0) {
  211500. width = parentWidth;
  211501. height = baseHeight * (parentWidth / baseWidth);
  211502. }
  211503. const scaleX = width / baseWidth;
  211504. const scaleY = height / baseHeight;
  211505. svg2.style.cssText = `width: ${width}px; height: ${height}px; position: absolute; bottom: 0; left: 0; overflow: hidden;`;
  211506. svg2.setAttribute("width", width);
  211507. svg2.setAttribute("height", height);
  211508. svg2.setAttribute("viewBox", `0 0 ${width} ${height}`);
  211509. this._topG.setAttribute("transform", `scale(${scaleX},${scaleY})`);
  211510. this._centerX = Math.max(1, 100 * scaleX);
  211511. this._centerY = Math.max(1, 100 * scaleY);
  211512. this._lastHeight = parentWidth;
  211513. this._lastWidth = parentHeight;
  211514. };
  211515. Animation3.prototype.applyThemeChanges = function() {
  211516. const doc = this._container.ownerDocument;
  211517. if (!doc.body.contains(this._container)) {
  211518. if (defined_default(this._observer)) {
  211519. return;
  211520. }
  211521. const that = this;
  211522. that._observer = new MutationObserver(function() {
  211523. if (doc.body.contains(that._container)) {
  211524. that._observer.disconnect();
  211525. that._observer = void 0;
  211526. that.applyThemeChanges();
  211527. }
  211528. });
  211529. that._observer.observe(doc, { childList: true, subtree: true });
  211530. return;
  211531. }
  211532. const buttonNormalBackColor = getElementColor(this._themeNormal);
  211533. const buttonHoverBackColor = getElementColor(this._themeHover);
  211534. const buttonToggledBackColor = getElementColor(this._themeSelect);
  211535. const buttonDisabledBackColor = getElementColor(this._themeDisabled);
  211536. const knobBackColor = getElementColor(this._themeKnob);
  211537. const pointerColor = getElementColor(this._themePointer);
  211538. const swooshColor = getElementColor(this._themeSwoosh);
  211539. const swooshHoverColor = getElementColor(this._themeSwooshHover);
  211540. const defsElement = svgFromObject({
  211541. tagName: "defs",
  211542. children: [
  211543. {
  211544. id: "animation_buttonNormal",
  211545. tagName: "linearGradient",
  211546. x1: "50%",
  211547. y1: "0%",
  211548. x2: "50%",
  211549. y2: "100%",
  211550. children: [
  211551. {
  211552. tagName: "stop",
  211553. offset: "0%",
  211554. "stop-color": makeColorString(
  211555. buttonNormalBackColor,
  211556. gradientEnabledColor0
  211557. )
  211558. },
  211559. {
  211560. tagName: "stop",
  211561. offset: "12%",
  211562. "stop-color": makeColorString(
  211563. buttonNormalBackColor,
  211564. gradientEnabledColor1
  211565. )
  211566. },
  211567. {
  211568. tagName: "stop",
  211569. offset: "46%",
  211570. "stop-color": makeColorString(
  211571. buttonNormalBackColor,
  211572. gradientEnabledColor2
  211573. )
  211574. },
  211575. {
  211576. tagName: "stop",
  211577. offset: "81%",
  211578. "stop-color": makeColorString(
  211579. buttonNormalBackColor,
  211580. gradientEnabledColor3
  211581. )
  211582. }
  211583. ]
  211584. },
  211585. {
  211586. id: "animation_buttonHovered",
  211587. tagName: "linearGradient",
  211588. x1: "50%",
  211589. y1: "0%",
  211590. x2: "50%",
  211591. y2: "100%",
  211592. children: [
  211593. {
  211594. tagName: "stop",
  211595. offset: "0%",
  211596. "stop-color": makeColorString(
  211597. buttonHoverBackColor,
  211598. gradientEnabledColor0
  211599. )
  211600. },
  211601. {
  211602. tagName: "stop",
  211603. offset: "12%",
  211604. "stop-color": makeColorString(
  211605. buttonHoverBackColor,
  211606. gradientEnabledColor1
  211607. )
  211608. },
  211609. {
  211610. tagName: "stop",
  211611. offset: "46%",
  211612. "stop-color": makeColorString(
  211613. buttonHoverBackColor,
  211614. gradientEnabledColor2
  211615. )
  211616. },
  211617. {
  211618. tagName: "stop",
  211619. offset: "81%",
  211620. "stop-color": makeColorString(
  211621. buttonHoverBackColor,
  211622. gradientEnabledColor3
  211623. )
  211624. }
  211625. ]
  211626. },
  211627. {
  211628. id: "animation_buttonToggled",
  211629. tagName: "linearGradient",
  211630. x1: "50%",
  211631. y1: "0%",
  211632. x2: "50%",
  211633. y2: "100%",
  211634. children: [
  211635. {
  211636. tagName: "stop",
  211637. offset: "0%",
  211638. "stop-color": makeColorString(
  211639. buttonToggledBackColor,
  211640. gradientEnabledColor0
  211641. )
  211642. },
  211643. {
  211644. tagName: "stop",
  211645. offset: "12%",
  211646. "stop-color": makeColorString(
  211647. buttonToggledBackColor,
  211648. gradientEnabledColor1
  211649. )
  211650. },
  211651. {
  211652. tagName: "stop",
  211653. offset: "46%",
  211654. "stop-color": makeColorString(
  211655. buttonToggledBackColor,
  211656. gradientEnabledColor2
  211657. )
  211658. },
  211659. {
  211660. tagName: "stop",
  211661. offset: "81%",
  211662. "stop-color": makeColorString(
  211663. buttonToggledBackColor,
  211664. gradientEnabledColor3
  211665. )
  211666. }
  211667. ]
  211668. },
  211669. {
  211670. id: "animation_buttonDisabled",
  211671. tagName: "linearGradient",
  211672. x1: "50%",
  211673. y1: "0%",
  211674. x2: "50%",
  211675. y2: "100%",
  211676. children: [
  211677. {
  211678. tagName: "stop",
  211679. offset: "0%",
  211680. "stop-color": makeColorString(
  211681. buttonDisabledBackColor,
  211682. gradientDisabledColor0
  211683. )
  211684. },
  211685. {
  211686. tagName: "stop",
  211687. offset: "75%",
  211688. "stop-color": makeColorString(
  211689. buttonDisabledBackColor,
  211690. gradientDisabledColor1
  211691. )
  211692. }
  211693. ]
  211694. },
  211695. {
  211696. id: "animation_blurred",
  211697. tagName: "filter",
  211698. width: "200%",
  211699. height: "200%",
  211700. x: "-50%",
  211701. y: "-50%",
  211702. children: [
  211703. {
  211704. tagName: "feGaussianBlur",
  211705. stdDeviation: 4,
  211706. in: "SourceGraphic"
  211707. }
  211708. ]
  211709. },
  211710. {
  211711. id: "animation_shuttleRingSwooshGradient",
  211712. tagName: "linearGradient",
  211713. x1: "50%",
  211714. y1: "0%",
  211715. x2: "50%",
  211716. y2: "100%",
  211717. children: [
  211718. {
  211719. tagName: "stop",
  211720. offset: "0%",
  211721. "stop-opacity": 0.2,
  211722. "stop-color": swooshColor.toCssColorString()
  211723. },
  211724. {
  211725. tagName: "stop",
  211726. offset: "85%",
  211727. "stop-opacity": 0.85,
  211728. "stop-color": swooshColor.toCssColorString()
  211729. },
  211730. {
  211731. tagName: "stop",
  211732. offset: "95%",
  211733. "stop-opacity": 0.05,
  211734. "stop-color": swooshColor.toCssColorString()
  211735. }
  211736. ]
  211737. },
  211738. {
  211739. id: "animation_shuttleRingSwooshHovered",
  211740. tagName: "linearGradient",
  211741. x1: "50%",
  211742. y1: "0%",
  211743. x2: "50%",
  211744. y2: "100%",
  211745. children: [
  211746. {
  211747. tagName: "stop",
  211748. offset: "0%",
  211749. "stop-opacity": 0.2,
  211750. "stop-color": swooshHoverColor.toCssColorString()
  211751. },
  211752. {
  211753. tagName: "stop",
  211754. offset: "85%",
  211755. "stop-opacity": 0.85,
  211756. "stop-color": swooshHoverColor.toCssColorString()
  211757. },
  211758. {
  211759. tagName: "stop",
  211760. offset: "95%",
  211761. "stop-opacity": 0.05,
  211762. "stop-color": swooshHoverColor.toCssColorString()
  211763. }
  211764. ]
  211765. },
  211766. {
  211767. id: "animation_shuttleRingPointerGradient",
  211768. tagName: "linearGradient",
  211769. x1: "0%",
  211770. y1: "50%",
  211771. x2: "100%",
  211772. y2: "50%",
  211773. children: [
  211774. {
  211775. tagName: "stop",
  211776. offset: "0%",
  211777. "stop-color": pointerColor.toCssColorString()
  211778. },
  211779. {
  211780. tagName: "stop",
  211781. offset: "40%",
  211782. "stop-color": pointerColor.toCssColorString()
  211783. },
  211784. {
  211785. tagName: "stop",
  211786. offset: "60%",
  211787. "stop-color": makeColorString(pointerColor, gradientPointerColor)
  211788. },
  211789. {
  211790. tagName: "stop",
  211791. offset: "100%",
  211792. "stop-color": makeColorString(pointerColor, gradientPointerColor)
  211793. }
  211794. ]
  211795. },
  211796. {
  211797. id: "animation_shuttleRingPointerPaused",
  211798. tagName: "linearGradient",
  211799. x1: "0%",
  211800. y1: "50%",
  211801. x2: "100%",
  211802. y2: "50%",
  211803. children: [
  211804. {
  211805. tagName: "stop",
  211806. offset: "0%",
  211807. "stop-color": "#CCC"
  211808. },
  211809. {
  211810. tagName: "stop",
  211811. offset: "40%",
  211812. "stop-color": "#CCC"
  211813. },
  211814. {
  211815. tagName: "stop",
  211816. offset: "60%",
  211817. "stop-color": "#555"
  211818. },
  211819. {
  211820. tagName: "stop",
  211821. offset: "100%",
  211822. "stop-color": "#555"
  211823. }
  211824. ]
  211825. },
  211826. {
  211827. id: "animation_knobOuter",
  211828. tagName: "linearGradient",
  211829. x1: "20%",
  211830. y1: "0%",
  211831. x2: "90%",
  211832. y2: "100%",
  211833. children: [
  211834. {
  211835. tagName: "stop",
  211836. offset: "5%",
  211837. "stop-color": makeColorString(knobBackColor, gradientEnabledColor0)
  211838. },
  211839. {
  211840. tagName: "stop",
  211841. offset: "60%",
  211842. "stop-color": makeColorString(knobBackColor, gradientKnobColor)
  211843. },
  211844. {
  211845. tagName: "stop",
  211846. offset: "85%",
  211847. "stop-color": makeColorString(knobBackColor, gradientEnabledColor1)
  211848. }
  211849. ]
  211850. },
  211851. {
  211852. id: "animation_knobInner",
  211853. tagName: "linearGradient",
  211854. x1: "20%",
  211855. y1: "0%",
  211856. x2: "90%",
  211857. y2: "100%",
  211858. children: [
  211859. {
  211860. tagName: "stop",
  211861. offset: "5%",
  211862. "stop-color": makeColorString(knobBackColor, gradientKnobColor)
  211863. },
  211864. {
  211865. tagName: "stop",
  211866. offset: "60%",
  211867. "stop-color": makeColorString(knobBackColor, gradientEnabledColor0)
  211868. },
  211869. {
  211870. tagName: "stop",
  211871. offset: "85%",
  211872. "stop-color": makeColorString(knobBackColor, gradientEnabledColor3)
  211873. }
  211874. ]
  211875. }
  211876. ]
  211877. });
  211878. if (!defined_default(this._defsElement)) {
  211879. this._svgNode.appendChild(defsElement);
  211880. } else {
  211881. this._svgNode.replaceChild(defsElement, this._defsElement);
  211882. }
  211883. this._defsElement = defsElement;
  211884. };
  211885. var Animation_default = Animation3;
  211886. // node_modules/cesium/Source/Widgets/Animation/AnimationViewModel.js
  211887. var monthNames = [
  211888. "Jan",
  211889. "Feb",
  211890. "Mar",
  211891. "Apr",
  211892. "May",
  211893. "Jun",
  211894. "Jul",
  211895. "Aug",
  211896. "Sep",
  211897. "Oct",
  211898. "Nov",
  211899. "Dec"
  211900. ];
  211901. var realtimeShuttleRingAngle = 15;
  211902. var maxShuttleRingAngle = 105;
  211903. function numberComparator(left, right) {
  211904. return left - right;
  211905. }
  211906. function getTypicalMultiplierIndex(multiplier, shuttleRingTicks) {
  211907. const index2 = binarySearch_default(shuttleRingTicks, multiplier, numberComparator);
  211908. return index2 < 0 ? ~index2 : index2;
  211909. }
  211910. function angleToMultiplier(angle, shuttleRingTicks) {
  211911. if (Math.abs(angle) <= realtimeShuttleRingAngle) {
  211912. return angle / realtimeShuttleRingAngle;
  211913. }
  211914. const minp = realtimeShuttleRingAngle;
  211915. const maxp = maxShuttleRingAngle;
  211916. let maxv;
  211917. const minv = 0;
  211918. let scale;
  211919. if (angle > 0) {
  211920. maxv = Math.log(shuttleRingTicks[shuttleRingTicks.length - 1]);
  211921. scale = (maxv - minv) / (maxp - minp);
  211922. return Math.exp(minv + scale * (angle - minp));
  211923. }
  211924. maxv = Math.log(-shuttleRingTicks[0]);
  211925. scale = (maxv - minv) / (maxp - minp);
  211926. return -Math.exp(minv + scale * (Math.abs(angle) - minp));
  211927. }
  211928. function multiplierToAngle(multiplier, shuttleRingTicks, clockViewModel) {
  211929. if (clockViewModel.clockStep === ClockStep_default.SYSTEM_CLOCK) {
  211930. return realtimeShuttleRingAngle;
  211931. }
  211932. if (Math.abs(multiplier) <= 1) {
  211933. return multiplier * realtimeShuttleRingAngle;
  211934. }
  211935. const fastedMultipler = shuttleRingTicks[shuttleRingTicks.length - 1];
  211936. if (multiplier > fastedMultipler) {
  211937. multiplier = fastedMultipler;
  211938. } else if (multiplier < -fastedMultipler) {
  211939. multiplier = -fastedMultipler;
  211940. }
  211941. const minp = realtimeShuttleRingAngle;
  211942. const maxp = maxShuttleRingAngle;
  211943. let maxv;
  211944. const minv = 0;
  211945. let scale;
  211946. if (multiplier > 0) {
  211947. maxv = Math.log(fastedMultipler);
  211948. scale = (maxv - minv) / (maxp - minp);
  211949. return (Math.log(multiplier) - minv) / scale + minp;
  211950. }
  211951. maxv = Math.log(-shuttleRingTicks[0]);
  211952. scale = (maxv - minv) / (maxp - minp);
  211953. return -((Math.log(Math.abs(multiplier)) - minv) / scale + minp);
  211954. }
  211955. function AnimationViewModel(clockViewModel) {
  211956. if (!defined_default(clockViewModel)) {
  211957. throw new DeveloperError_default("clockViewModel is required.");
  211958. }
  211959. const that = this;
  211960. this._clockViewModel = clockViewModel;
  211961. this._allShuttleRingTicks = [];
  211962. this._dateFormatter = AnimationViewModel.defaultDateFormatter;
  211963. this._timeFormatter = AnimationViewModel.defaultTimeFormatter;
  211964. this.shuttleRingDragging = false;
  211965. this.snapToTicks = false;
  211966. knockout_default.track(this, [
  211967. "_allShuttleRingTicks",
  211968. "_dateFormatter",
  211969. "_timeFormatter",
  211970. "shuttleRingDragging",
  211971. "snapToTicks"
  211972. ]);
  211973. this._sortedFilteredPositiveTicks = [];
  211974. this.setShuttleRingTicks(AnimationViewModel.defaultTicks);
  211975. this.timeLabel = void 0;
  211976. knockout_default.defineProperty(this, "timeLabel", function() {
  211977. return that._timeFormatter(that._clockViewModel.currentTime, that);
  211978. });
  211979. this.dateLabel = void 0;
  211980. knockout_default.defineProperty(this, "dateLabel", function() {
  211981. return that._dateFormatter(that._clockViewModel.currentTime, that);
  211982. });
  211983. this.multiplierLabel = void 0;
  211984. knockout_default.defineProperty(this, "multiplierLabel", function() {
  211985. const clockViewModel2 = that._clockViewModel;
  211986. if (clockViewModel2.clockStep === ClockStep_default.SYSTEM_CLOCK) {
  211987. return "Today";
  211988. }
  211989. const multiplier = clockViewModel2.multiplier;
  211990. if (multiplier % 1 === 0) {
  211991. return `${multiplier.toFixed(0)}x`;
  211992. }
  211993. return `${multiplier.toFixed(3).replace(/0{0,3}$/, "")}x`;
  211994. });
  211995. this.shuttleRingAngle = void 0;
  211996. knockout_default.defineProperty(this, "shuttleRingAngle", {
  211997. get: function() {
  211998. return multiplierToAngle(
  211999. clockViewModel.multiplier,
  212000. that._allShuttleRingTicks,
  212001. clockViewModel
  212002. );
  212003. },
  212004. set: function(angle) {
  212005. angle = Math.max(
  212006. Math.min(angle, maxShuttleRingAngle),
  212007. -maxShuttleRingAngle
  212008. );
  212009. const ticks = that._allShuttleRingTicks;
  212010. const clockViewModel2 = that._clockViewModel;
  212011. clockViewModel2.clockStep = ClockStep_default.SYSTEM_CLOCK_MULTIPLIER;
  212012. if (Math.abs(angle) === maxShuttleRingAngle) {
  212013. clockViewModel2.multiplier = angle > 0 ? ticks[ticks.length - 1] : ticks[0];
  212014. return;
  212015. }
  212016. let multiplier = angleToMultiplier(angle, ticks);
  212017. if (that.snapToTicks) {
  212018. multiplier = ticks[getTypicalMultiplierIndex(multiplier, ticks)];
  212019. } else if (multiplier !== 0) {
  212020. const positiveMultiplier = Math.abs(multiplier);
  212021. if (positiveMultiplier > 100) {
  212022. const numDigits = positiveMultiplier.toFixed(0).length - 2;
  212023. const divisor = Math.pow(10, numDigits);
  212024. multiplier = Math.round(multiplier / divisor) * divisor | 0;
  212025. } else if (positiveMultiplier > realtimeShuttleRingAngle) {
  212026. multiplier = Math.round(multiplier);
  212027. } else if (positiveMultiplier > 1) {
  212028. multiplier = +multiplier.toFixed(1);
  212029. } else if (positiveMultiplier > 0) {
  212030. multiplier = +multiplier.toFixed(2);
  212031. }
  212032. }
  212033. clockViewModel2.multiplier = multiplier;
  212034. }
  212035. });
  212036. this._canAnimate = void 0;
  212037. knockout_default.defineProperty(this, "_canAnimate", function() {
  212038. const clockViewModel2 = that._clockViewModel;
  212039. const clockRange = clockViewModel2.clockRange;
  212040. if (that.shuttleRingDragging || clockRange === ClockRange_default.UNBOUNDED) {
  212041. return true;
  212042. }
  212043. const multiplier = clockViewModel2.multiplier;
  212044. const currentTime = clockViewModel2.currentTime;
  212045. const startTime = clockViewModel2.startTime;
  212046. let result = false;
  212047. if (clockRange === ClockRange_default.LOOP_STOP) {
  212048. result = JulianDate_default.greaterThan(currentTime, startTime) || currentTime.equals(startTime) && multiplier > 0;
  212049. } else {
  212050. const stopTime = clockViewModel2.stopTime;
  212051. result = JulianDate_default.greaterThan(currentTime, startTime) && JulianDate_default.lessThan(currentTime, stopTime) || currentTime.equals(startTime) && multiplier > 0 || currentTime.equals(stopTime) && multiplier < 0;
  212052. }
  212053. if (!result) {
  212054. clockViewModel2.shouldAnimate = false;
  212055. }
  212056. return result;
  212057. });
  212058. this._isSystemTimeAvailable = void 0;
  212059. knockout_default.defineProperty(this, "_isSystemTimeAvailable", function() {
  212060. const clockViewModel2 = that._clockViewModel;
  212061. const clockRange = clockViewModel2.clockRange;
  212062. if (clockRange === ClockRange_default.UNBOUNDED) {
  212063. return true;
  212064. }
  212065. const systemTime = clockViewModel2.systemTime;
  212066. return JulianDate_default.greaterThanOrEquals(systemTime, clockViewModel2.startTime) && JulianDate_default.lessThanOrEquals(systemTime, clockViewModel2.stopTime);
  212067. });
  212068. this._isAnimating = void 0;
  212069. knockout_default.defineProperty(this, "_isAnimating", function() {
  212070. return that._clockViewModel.shouldAnimate && (that._canAnimate || that.shuttleRingDragging);
  212071. });
  212072. const pauseCommand = createCommand_default(function() {
  212073. const clockViewModel2 = that._clockViewModel;
  212074. if (clockViewModel2.shouldAnimate) {
  212075. clockViewModel2.shouldAnimate = false;
  212076. } else if (that._canAnimate) {
  212077. clockViewModel2.shouldAnimate = true;
  212078. }
  212079. });
  212080. this._pauseViewModel = new ToggleButtonViewModel_default(pauseCommand, {
  212081. toggled: knockout_default.computed(function() {
  212082. return !that._isAnimating;
  212083. }),
  212084. tooltip: "Pause"
  212085. });
  212086. const playReverseCommand = createCommand_default(function() {
  212087. const clockViewModel2 = that._clockViewModel;
  212088. const multiplier = clockViewModel2.multiplier;
  212089. if (multiplier > 0) {
  212090. clockViewModel2.multiplier = -multiplier;
  212091. }
  212092. clockViewModel2.shouldAnimate = true;
  212093. });
  212094. this._playReverseViewModel = new ToggleButtonViewModel_default(playReverseCommand, {
  212095. toggled: knockout_default.computed(function() {
  212096. return that._isAnimating && clockViewModel.multiplier < 0;
  212097. }),
  212098. tooltip: "Play Reverse"
  212099. });
  212100. const playForwardCommand = createCommand_default(function() {
  212101. const clockViewModel2 = that._clockViewModel;
  212102. const multiplier = clockViewModel2.multiplier;
  212103. if (multiplier < 0) {
  212104. clockViewModel2.multiplier = -multiplier;
  212105. }
  212106. clockViewModel2.shouldAnimate = true;
  212107. });
  212108. this._playForwardViewModel = new ToggleButtonViewModel_default(playForwardCommand, {
  212109. toggled: knockout_default.computed(function() {
  212110. return that._isAnimating && clockViewModel.multiplier > 0 && clockViewModel.clockStep !== ClockStep_default.SYSTEM_CLOCK;
  212111. }),
  212112. tooltip: "Play Forward"
  212113. });
  212114. const playRealtimeCommand = createCommand_default(function() {
  212115. that._clockViewModel.clockStep = ClockStep_default.SYSTEM_CLOCK;
  212116. }, knockout_default.getObservable(this, "_isSystemTimeAvailable"));
  212117. this._playRealtimeViewModel = new ToggleButtonViewModel_default(playRealtimeCommand, {
  212118. toggled: knockout_default.computed(function() {
  212119. return clockViewModel.clockStep === ClockStep_default.SYSTEM_CLOCK;
  212120. }),
  212121. tooltip: knockout_default.computed(function() {
  212122. return that._isSystemTimeAvailable ? "Today (real-time)" : "Current time not in range";
  212123. })
  212124. });
  212125. this._slower = createCommand_default(function() {
  212126. const clockViewModel2 = that._clockViewModel;
  212127. const shuttleRingTicks = that._allShuttleRingTicks;
  212128. const multiplier = clockViewModel2.multiplier;
  212129. const index2 = getTypicalMultiplierIndex(multiplier, shuttleRingTicks) - 1;
  212130. if (index2 >= 0) {
  212131. clockViewModel2.multiplier = shuttleRingTicks[index2];
  212132. }
  212133. });
  212134. this._faster = createCommand_default(function() {
  212135. const clockViewModel2 = that._clockViewModel;
  212136. const shuttleRingTicks = that._allShuttleRingTicks;
  212137. const multiplier = clockViewModel2.multiplier;
  212138. const index2 = getTypicalMultiplierIndex(multiplier, shuttleRingTicks) + 1;
  212139. if (index2 < shuttleRingTicks.length) {
  212140. clockViewModel2.multiplier = shuttleRingTicks[index2];
  212141. }
  212142. });
  212143. }
  212144. AnimationViewModel.defaultDateFormatter = function(date, viewModel) {
  212145. const gregorianDate = JulianDate_default.toGregorianDate(date);
  212146. return `${monthNames[gregorianDate.month - 1]} ${gregorianDate.day} ${gregorianDate.year}`;
  212147. };
  212148. AnimationViewModel.defaultTicks = [
  212149. 1e-3,
  212150. 2e-3,
  212151. 5e-3,
  212152. 0.01,
  212153. 0.02,
  212154. 0.05,
  212155. 0.1,
  212156. 0.25,
  212157. 0.5,
  212158. 1,
  212159. 2,
  212160. 5,
  212161. 10,
  212162. 15,
  212163. 30,
  212164. 60,
  212165. 120,
  212166. 300,
  212167. 600,
  212168. 900,
  212169. 1800,
  212170. 3600,
  212171. 7200,
  212172. 14400,
  212173. 21600,
  212174. 43200,
  212175. 86400,
  212176. 172800,
  212177. 345600,
  212178. 604800
  212179. ];
  212180. AnimationViewModel.defaultTimeFormatter = function(date, viewModel) {
  212181. const gregorianDate = JulianDate_default.toGregorianDate(date);
  212182. const millisecond = Math.round(gregorianDate.millisecond);
  212183. if (Math.abs(viewModel._clockViewModel.multiplier) < 1) {
  212184. return `${gregorianDate.hour.toString().padStart(2, "0")}:${gregorianDate.minute.toString().padStart(2, "0")}:${gregorianDate.second.toString().padStart(2, "0")}.${millisecond.toString().padStart(3, "0")}`;
  212185. }
  212186. return `${gregorianDate.hour.toString().padStart(2, "0")}:${gregorianDate.minute.toString().padStart(2, "0")}:${gregorianDate.second.toString().padStart(2, "0")} UTC`;
  212187. };
  212188. AnimationViewModel.prototype.getShuttleRingTicks = function() {
  212189. return this._sortedFilteredPositiveTicks.slice(0);
  212190. };
  212191. AnimationViewModel.prototype.setShuttleRingTicks = function(positiveTicks) {
  212192. if (!defined_default(positiveTicks)) {
  212193. throw new DeveloperError_default("positiveTicks is required.");
  212194. }
  212195. let i2;
  212196. let len;
  212197. let tick;
  212198. const hash2 = {};
  212199. const sortedFilteredPositiveTicks = this._sortedFilteredPositiveTicks;
  212200. sortedFilteredPositiveTicks.length = 0;
  212201. for (i2 = 0, len = positiveTicks.length; i2 < len; ++i2) {
  212202. tick = positiveTicks[i2];
  212203. if (!hash2.hasOwnProperty(tick)) {
  212204. hash2[tick] = true;
  212205. sortedFilteredPositiveTicks.push(tick);
  212206. }
  212207. }
  212208. sortedFilteredPositiveTicks.sort(numberComparator);
  212209. const allTicks = [];
  212210. for (len = sortedFilteredPositiveTicks.length, i2 = len - 1; i2 >= 0; --i2) {
  212211. tick = sortedFilteredPositiveTicks[i2];
  212212. if (tick !== 0) {
  212213. allTicks.push(-tick);
  212214. }
  212215. }
  212216. Array.prototype.push.apply(allTicks, sortedFilteredPositiveTicks);
  212217. this._allShuttleRingTicks = allTicks;
  212218. };
  212219. Object.defineProperties(AnimationViewModel.prototype, {
  212220. slower: {
  212221. get: function() {
  212222. return this._slower;
  212223. }
  212224. },
  212225. faster: {
  212226. get: function() {
  212227. return this._faster;
  212228. }
  212229. },
  212230. clockViewModel: {
  212231. get: function() {
  212232. return this._clockViewModel;
  212233. }
  212234. },
  212235. pauseViewModel: {
  212236. get: function() {
  212237. return this._pauseViewModel;
  212238. }
  212239. },
  212240. playReverseViewModel: {
  212241. get: function() {
  212242. return this._playReverseViewModel;
  212243. }
  212244. },
  212245. playForwardViewModel: {
  212246. get: function() {
  212247. return this._playForwardViewModel;
  212248. }
  212249. },
  212250. playRealtimeViewModel: {
  212251. get: function() {
  212252. return this._playRealtimeViewModel;
  212253. }
  212254. },
  212255. dateFormatter: {
  212256. get: function() {
  212257. return this._dateFormatter;
  212258. },
  212259. set: function(dateFormatter) {
  212260. if (typeof dateFormatter !== "function") {
  212261. throw new DeveloperError_default("dateFormatter must be a function");
  212262. }
  212263. this._dateFormatter = dateFormatter;
  212264. }
  212265. },
  212266. timeFormatter: {
  212267. get: function() {
  212268. return this._timeFormatter;
  212269. },
  212270. set: function(timeFormatter) {
  212271. if (typeof timeFormatter !== "function") {
  212272. throw new DeveloperError_default("timeFormatter must be a function");
  212273. }
  212274. this._timeFormatter = timeFormatter;
  212275. }
  212276. }
  212277. });
  212278. AnimationViewModel._maxShuttleRingAngle = maxShuttleRingAngle;
  212279. AnimationViewModel._realtimeShuttleRingAngle = realtimeShuttleRingAngle;
  212280. var AnimationViewModel_default = AnimationViewModel;
  212281. // node_modules/cesium/Source/Widgets/BaseLayerPicker/BaseLayerPickerViewModel.js
  212282. function BaseLayerPickerViewModel(options) {
  212283. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  212284. const globe = options.globe;
  212285. const imageryProviderViewModels = defaultValue_default(
  212286. options.imageryProviderViewModels,
  212287. []
  212288. );
  212289. const terrainProviderViewModels = defaultValue_default(
  212290. options.terrainProviderViewModels,
  212291. []
  212292. );
  212293. if (!defined_default(globe)) {
  212294. throw new DeveloperError_default("globe is required");
  212295. }
  212296. this._globe = globe;
  212297. this.imageryProviderViewModels = imageryProviderViewModels.slice(0);
  212298. this.terrainProviderViewModels = terrainProviderViewModels.slice(0);
  212299. this.dropDownVisible = false;
  212300. knockout_default.track(this, [
  212301. "imageryProviderViewModels",
  212302. "terrainProviderViewModels",
  212303. "dropDownVisible"
  212304. ]);
  212305. const imageryObservable = knockout_default.getObservable(
  212306. this,
  212307. "imageryProviderViewModels"
  212308. );
  212309. const imageryProviders = knockout_default.pureComputed(function() {
  212310. const providers = imageryObservable();
  212311. const categories = {};
  212312. let i2;
  212313. for (i2 = 0; i2 < providers.length; i2++) {
  212314. const provider = providers[i2];
  212315. const category = provider.category;
  212316. if (defined_default(categories[category])) {
  212317. categories[category].push(provider);
  212318. } else {
  212319. categories[category] = [provider];
  212320. }
  212321. }
  212322. const allCategoryNames = Object.keys(categories);
  212323. const result = [];
  212324. for (i2 = 0; i2 < allCategoryNames.length; i2++) {
  212325. const name = allCategoryNames[i2];
  212326. result.push({
  212327. name,
  212328. providers: categories[name]
  212329. });
  212330. }
  212331. return result;
  212332. });
  212333. this._imageryProviders = imageryProviders;
  212334. const terrainObservable = knockout_default.getObservable(
  212335. this,
  212336. "terrainProviderViewModels"
  212337. );
  212338. const terrainProviders = knockout_default.pureComputed(function() {
  212339. const providers = terrainObservable();
  212340. const categories = {};
  212341. let i2;
  212342. for (i2 = 0; i2 < providers.length; i2++) {
  212343. const provider = providers[i2];
  212344. const category = provider.category;
  212345. if (defined_default(categories[category])) {
  212346. categories[category].push(provider);
  212347. } else {
  212348. categories[category] = [provider];
  212349. }
  212350. }
  212351. const allCategoryNames = Object.keys(categories);
  212352. const result = [];
  212353. for (i2 = 0; i2 < allCategoryNames.length; i2++) {
  212354. const name = allCategoryNames[i2];
  212355. result.push({
  212356. name,
  212357. providers: categories[name]
  212358. });
  212359. }
  212360. return result;
  212361. });
  212362. this._terrainProviders = terrainProviders;
  212363. this.buttonTooltip = void 0;
  212364. knockout_default.defineProperty(this, "buttonTooltip", function() {
  212365. const selectedImagery = this.selectedImagery;
  212366. const selectedTerrain = this.selectedTerrain;
  212367. const imageryTip = defined_default(selectedImagery) ? selectedImagery.name : void 0;
  212368. const terrainTip = defined_default(selectedTerrain) ? selectedTerrain.name : void 0;
  212369. if (defined_default(imageryTip) && defined_default(terrainTip)) {
  212370. return `${imageryTip}
  212371. ${terrainTip}`;
  212372. } else if (defined_default(imageryTip)) {
  212373. return imageryTip;
  212374. }
  212375. return terrainTip;
  212376. });
  212377. this.buttonImageUrl = void 0;
  212378. knockout_default.defineProperty(this, "buttonImageUrl", function() {
  212379. const selectedImagery = this.selectedImagery;
  212380. if (defined_default(selectedImagery)) {
  212381. return selectedImagery.iconUrl;
  212382. }
  212383. });
  212384. this.selectedImagery = void 0;
  212385. const selectedImageryViewModel = knockout_default.observable();
  212386. this._currentImageryProviders = [];
  212387. knockout_default.defineProperty(this, "selectedImagery", {
  212388. get: function() {
  212389. return selectedImageryViewModel();
  212390. },
  212391. set: function(value) {
  212392. if (selectedImageryViewModel() === value) {
  212393. this.dropDownVisible = false;
  212394. return;
  212395. }
  212396. let i2;
  212397. const currentImageryProviders = this._currentImageryProviders;
  212398. const currentImageryProvidersLength = currentImageryProviders.length;
  212399. const imageryLayers = this._globe.imageryLayers;
  212400. let hadExistingBaseLayer = false;
  212401. for (i2 = 0; i2 < currentImageryProvidersLength; i2++) {
  212402. const layersLength = imageryLayers.length;
  212403. for (let x = 0; x < layersLength; x++) {
  212404. const layer = imageryLayers.get(x);
  212405. if (layer.imageryProvider === currentImageryProviders[i2]) {
  212406. imageryLayers.remove(layer);
  212407. hadExistingBaseLayer = true;
  212408. break;
  212409. }
  212410. }
  212411. }
  212412. if (defined_default(value)) {
  212413. const newProviders = value.creationCommand();
  212414. if (Array.isArray(newProviders)) {
  212415. const newProvidersLength = newProviders.length;
  212416. for (i2 = newProvidersLength - 1; i2 >= 0; i2--) {
  212417. imageryLayers.addImageryProvider(newProviders[i2], 0);
  212418. }
  212419. this._currentImageryProviders = newProviders.slice(0);
  212420. } else {
  212421. this._currentImageryProviders = [newProviders];
  212422. if (hadExistingBaseLayer) {
  212423. imageryLayers.addImageryProvider(newProviders, 0);
  212424. } else {
  212425. const baseLayer = imageryLayers.get(0);
  212426. if (defined_default(baseLayer)) {
  212427. imageryLayers.remove(baseLayer);
  212428. }
  212429. imageryLayers.addImageryProvider(newProviders, 0);
  212430. }
  212431. }
  212432. }
  212433. selectedImageryViewModel(value);
  212434. this.dropDownVisible = false;
  212435. }
  212436. });
  212437. this.selectedTerrain = void 0;
  212438. const selectedTerrainViewModel = knockout_default.observable();
  212439. knockout_default.defineProperty(this, "selectedTerrain", {
  212440. get: function() {
  212441. return selectedTerrainViewModel();
  212442. },
  212443. set: function(value) {
  212444. if (selectedTerrainViewModel() === value) {
  212445. this.dropDownVisible = false;
  212446. return;
  212447. }
  212448. let newProvider;
  212449. if (defined_default(value)) {
  212450. newProvider = value.creationCommand();
  212451. }
  212452. this._globe.depthTestAgainstTerrain = !(newProvider instanceof EllipsoidTerrainProvider_default);
  212453. this._globe.terrainProvider = newProvider;
  212454. selectedTerrainViewModel(value);
  212455. this.dropDownVisible = false;
  212456. }
  212457. });
  212458. const that = this;
  212459. this._toggleDropDown = createCommand_default(function() {
  212460. that.dropDownVisible = !that.dropDownVisible;
  212461. });
  212462. this.selectedImagery = defaultValue_default(
  212463. options.selectedImageryProviderViewModel,
  212464. imageryProviderViewModels[0]
  212465. );
  212466. this.selectedTerrain = defaultValue_default(
  212467. options.selectedTerrainProviderViewModel,
  212468. terrainProviderViewModels[0]
  212469. );
  212470. }
  212471. Object.defineProperties(BaseLayerPickerViewModel.prototype, {
  212472. toggleDropDown: {
  212473. get: function() {
  212474. return this._toggleDropDown;
  212475. }
  212476. },
  212477. globe: {
  212478. get: function() {
  212479. return this._globe;
  212480. }
  212481. }
  212482. });
  212483. var BaseLayerPickerViewModel_default = BaseLayerPickerViewModel;
  212484. // node_modules/cesium/Source/Widgets/BaseLayerPicker/BaseLayerPicker.js
  212485. function BaseLayerPicker(container, options) {
  212486. if (!defined_default(container)) {
  212487. throw new DeveloperError_default("container is required.");
  212488. }
  212489. container = getElement_default(container);
  212490. const viewModel = new BaseLayerPickerViewModel_default(options);
  212491. const element = document.createElement("button");
  212492. element.type = "button";
  212493. element.className = "cesium-button cesium-toolbar-button";
  212494. element.setAttribute(
  212495. "data-bind",
  212496. "attr: { title: buttonTooltip },click: toggleDropDown"
  212497. );
  212498. container.appendChild(element);
  212499. const imgElement = document.createElement("img");
  212500. imgElement.setAttribute("draggable", "false");
  212501. imgElement.className = "cesium-baseLayerPicker-selected";
  212502. imgElement.setAttribute(
  212503. "data-bind",
  212504. "attr: { src: buttonImageUrl }, visible: !!buttonImageUrl"
  212505. );
  212506. element.appendChild(imgElement);
  212507. const dropPanel = document.createElement("div");
  212508. dropPanel.className = "cesium-baseLayerPicker-dropDown";
  212509. dropPanel.setAttribute(
  212510. "data-bind",
  212511. 'css: { "cesium-baseLayerPicker-dropDown-visible" : dropDownVisible }'
  212512. );
  212513. container.appendChild(dropPanel);
  212514. const imageryTitle = document.createElement("div");
  212515. imageryTitle.className = "cesium-baseLayerPicker-sectionTitle";
  212516. imageryTitle.setAttribute(
  212517. "data-bind",
  212518. "visible: imageryProviderViewModels.length > 0"
  212519. );
  212520. imageryTitle.innerHTML = "Imagery";
  212521. dropPanel.appendChild(imageryTitle);
  212522. const imagerySection = document.createElement("div");
  212523. imagerySection.className = "cesium-baseLayerPicker-section";
  212524. imagerySection.setAttribute("data-bind", "foreach: _imageryProviders");
  212525. dropPanel.appendChild(imagerySection);
  212526. const imageryCategories = document.createElement("div");
  212527. imageryCategories.className = "cesium-baseLayerPicker-category";
  212528. imagerySection.appendChild(imageryCategories);
  212529. const categoryTitle = document.createElement("div");
  212530. categoryTitle.className = "cesium-baseLayerPicker-categoryTitle";
  212531. categoryTitle.setAttribute("data-bind", "text: name");
  212532. imageryCategories.appendChild(categoryTitle);
  212533. const imageryChoices = document.createElement("div");
  212534. imageryChoices.className = "cesium-baseLayerPicker-choices";
  212535. imageryChoices.setAttribute("data-bind", "foreach: providers");
  212536. imageryCategories.appendChild(imageryChoices);
  212537. const imageryProvider = document.createElement("div");
  212538. imageryProvider.className = "cesium-baseLayerPicker-item";
  212539. imageryProvider.setAttribute(
  212540. "data-bind",
  212541. 'css: { "cesium-baseLayerPicker-selectedItem" : $data === $parents[1].selectedImagery },attr: { title: tooltip },visible: creationCommand.canExecute,click: function($data) { $parents[1].selectedImagery = $data; }'
  212542. );
  212543. imageryChoices.appendChild(imageryProvider);
  212544. const providerIcon = document.createElement("img");
  212545. providerIcon.className = "cesium-baseLayerPicker-itemIcon";
  212546. providerIcon.setAttribute("data-bind", "attr: { src: iconUrl }");
  212547. providerIcon.setAttribute("draggable", "false");
  212548. imageryProvider.appendChild(providerIcon);
  212549. const providerLabel = document.createElement("div");
  212550. providerLabel.className = "cesium-baseLayerPicker-itemLabel";
  212551. providerLabel.setAttribute("data-bind", "text: name");
  212552. imageryProvider.appendChild(providerLabel);
  212553. const terrainTitle = document.createElement("div");
  212554. terrainTitle.className = "cesium-baseLayerPicker-sectionTitle";
  212555. terrainTitle.setAttribute(
  212556. "data-bind",
  212557. "visible: terrainProviderViewModels.length > 0"
  212558. );
  212559. terrainTitle.innerHTML = "Terrain";
  212560. dropPanel.appendChild(terrainTitle);
  212561. const terrainSection = document.createElement("div");
  212562. terrainSection.className = "cesium-baseLayerPicker-section";
  212563. terrainSection.setAttribute("data-bind", "foreach: _terrainProviders");
  212564. dropPanel.appendChild(terrainSection);
  212565. const terrainCategories = document.createElement("div");
  212566. terrainCategories.className = "cesium-baseLayerPicker-category";
  212567. terrainSection.appendChild(terrainCategories);
  212568. const terrainCategoryTitle = document.createElement("div");
  212569. terrainCategoryTitle.className = "cesium-baseLayerPicker-categoryTitle";
  212570. terrainCategoryTitle.setAttribute("data-bind", "text: name");
  212571. terrainCategories.appendChild(terrainCategoryTitle);
  212572. const terrainChoices = document.createElement("div");
  212573. terrainChoices.className = "cesium-baseLayerPicker-choices";
  212574. terrainChoices.setAttribute("data-bind", "foreach: providers");
  212575. terrainCategories.appendChild(terrainChoices);
  212576. const terrainProvider = document.createElement("div");
  212577. terrainProvider.className = "cesium-baseLayerPicker-item";
  212578. terrainProvider.setAttribute(
  212579. "data-bind",
  212580. 'css: { "cesium-baseLayerPicker-selectedItem" : $data === $parents[1].selectedTerrain },attr: { title: tooltip },visible: creationCommand.canExecute,click: function($data) { $parents[1].selectedTerrain = $data; }'
  212581. );
  212582. terrainChoices.appendChild(terrainProvider);
  212583. const terrainProviderIcon = document.createElement("img");
  212584. terrainProviderIcon.className = "cesium-baseLayerPicker-itemIcon";
  212585. terrainProviderIcon.setAttribute("data-bind", "attr: { src: iconUrl }");
  212586. terrainProviderIcon.setAttribute("draggable", "false");
  212587. terrainProvider.appendChild(terrainProviderIcon);
  212588. const terrainProviderLabel = document.createElement("div");
  212589. terrainProviderLabel.className = "cesium-baseLayerPicker-itemLabel";
  212590. terrainProviderLabel.setAttribute("data-bind", "text: name");
  212591. terrainProvider.appendChild(terrainProviderLabel);
  212592. knockout_default.applyBindings(viewModel, element);
  212593. knockout_default.applyBindings(viewModel, dropPanel);
  212594. this._viewModel = viewModel;
  212595. this._container = container;
  212596. this._element = element;
  212597. this._dropPanel = dropPanel;
  212598. this._closeDropDown = function(e2) {
  212599. if (!(element.contains(e2.target) || dropPanel.contains(e2.target))) {
  212600. viewModel.dropDownVisible = false;
  212601. }
  212602. };
  212603. if (FeatureDetection_default.supportsPointerEvents()) {
  212604. document.addEventListener("pointerdown", this._closeDropDown, true);
  212605. } else {
  212606. document.addEventListener("mousedown", this._closeDropDown, true);
  212607. document.addEventListener("touchstart", this._closeDropDown, true);
  212608. }
  212609. }
  212610. Object.defineProperties(BaseLayerPicker.prototype, {
  212611. container: {
  212612. get: function() {
  212613. return this._container;
  212614. }
  212615. },
  212616. viewModel: {
  212617. get: function() {
  212618. return this._viewModel;
  212619. }
  212620. }
  212621. });
  212622. BaseLayerPicker.prototype.isDestroyed = function() {
  212623. return false;
  212624. };
  212625. BaseLayerPicker.prototype.destroy = function() {
  212626. if (FeatureDetection_default.supportsPointerEvents()) {
  212627. document.removeEventListener("pointerdown", this._closeDropDown, true);
  212628. } else {
  212629. document.removeEventListener("mousedown", this._closeDropDown, true);
  212630. document.removeEventListener("touchstart", this._closeDropDown, true);
  212631. }
  212632. knockout_default.cleanNode(this._element);
  212633. knockout_default.cleanNode(this._dropPanel);
  212634. this._container.removeChild(this._element);
  212635. this._container.removeChild(this._dropPanel);
  212636. return destroyObject_default(this);
  212637. };
  212638. var BaseLayerPicker_default = BaseLayerPicker;
  212639. // node_modules/cesium/Source/Widgets/BaseLayerPicker/ProviderViewModel.js
  212640. function ProviderViewModel(options) {
  212641. if (!defined_default(options.name)) {
  212642. throw new DeveloperError_default("options.name is required.");
  212643. }
  212644. if (!defined_default(options.tooltip)) {
  212645. throw new DeveloperError_default("options.tooltip is required.");
  212646. }
  212647. if (!defined_default(options.iconUrl)) {
  212648. throw new DeveloperError_default("options.iconUrl is required.");
  212649. }
  212650. if (typeof options.creationFunction !== "function") {
  212651. throw new DeveloperError_default("options.creationFunction is required.");
  212652. }
  212653. let creationCommand = options.creationFunction;
  212654. if (!defined_default(creationCommand.canExecute)) {
  212655. creationCommand = createCommand_default(creationCommand);
  212656. }
  212657. this._creationCommand = creationCommand;
  212658. this.name = options.name;
  212659. this.tooltip = options.tooltip;
  212660. this.iconUrl = options.iconUrl;
  212661. this._category = defaultValue_default(options.category, "");
  212662. knockout_default.track(this, ["name", "tooltip", "iconUrl"]);
  212663. }
  212664. Object.defineProperties(ProviderViewModel.prototype, {
  212665. creationCommand: {
  212666. get: function() {
  212667. return this._creationCommand;
  212668. }
  212669. },
  212670. category: {
  212671. get: function() {
  212672. return this._category;
  212673. }
  212674. }
  212675. });
  212676. var ProviderViewModel_default = ProviderViewModel;
  212677. // node_modules/cesium/Source/Widgets/BaseLayerPicker/createDefaultImageryProviderViewModels.js
  212678. function createDefaultImageryProviderViewModels() {
  212679. const providerViewModels = [];
  212680. providerViewModels.push(
  212681. new ProviderViewModel_default({
  212682. name: "Bing Maps Aerial",
  212683. iconUrl: buildModuleUrl_default("Widgets/Images/ImageryProviders/bingAerial.png"),
  212684. tooltip: "Bing Maps aerial imagery, provided by Cesium ion",
  212685. category: "Cesium ion",
  212686. creationFunction: function() {
  212687. return createWorldImagery_default({
  212688. style: IonWorldImageryStyle_default.AERIAL
  212689. });
  212690. }
  212691. })
  212692. );
  212693. providerViewModels.push(
  212694. new ProviderViewModel_default({
  212695. name: "Bing Maps Aerial with Labels",
  212696. iconUrl: buildModuleUrl_default(
  212697. "Widgets/Images/ImageryProviders/bingAerialLabels.png"
  212698. ),
  212699. tooltip: "Bing Maps aerial imagery with labels, provided by Cesium ion",
  212700. category: "Cesium ion",
  212701. creationFunction: function() {
  212702. return createWorldImagery_default({
  212703. style: IonWorldImageryStyle_default.AERIAL_WITH_LABELS
  212704. });
  212705. }
  212706. })
  212707. );
  212708. providerViewModels.push(
  212709. new ProviderViewModel_default({
  212710. name: "Bing Maps Roads",
  212711. iconUrl: buildModuleUrl_default("Widgets/Images/ImageryProviders/bingRoads.png"),
  212712. tooltip: "Bing Maps standard road maps, provided by Cesium ion",
  212713. category: "Cesium ion",
  212714. creationFunction: function() {
  212715. return createWorldImagery_default({
  212716. style: IonWorldImageryStyle_default.ROAD
  212717. });
  212718. }
  212719. })
  212720. );
  212721. providerViewModels.push(
  212722. new ProviderViewModel_default({
  212723. name: "ESRI World Imagery",
  212724. iconUrl: buildModuleUrl_default(
  212725. "Widgets/Images/ImageryProviders/esriWorldImagery.png"
  212726. ),
  212727. tooltip: "World Imagery provides one meter or better satellite and aerial imagery in many parts of the world and lower resolution satellite imagery worldwide. The map includes NASA Blue Marble: Next Generation 500m resolution imagery at small scales (above 1:1,000,000), i-cubed 15m eSAT imagery at medium-to-large scales (down to 1:70,000) for the world, and USGS 15m Landsat imagery for Antarctica. The map features 0.3m resolution imagery in the continental United States and 0.6m resolution imagery in parts of Western Europe from DigitalGlobe. In other parts of the world, 1 meter resolution imagery is available from GeoEye IKONOS, i-cubed Nationwide Prime, Getmapping, AeroGRID, IGN Spain, and IGP Portugal. Additionally, imagery at different resolutions has been contributed by the GIS User Community.\nhttp://www.esri.com",
  212728. category: "Other",
  212729. creationFunction: function() {
  212730. return new ArcGisMapServerImageryProvider_default({
  212731. url: "https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer",
  212732. enablePickFeatures: false
  212733. });
  212734. }
  212735. })
  212736. );
  212737. providerViewModels.push(
  212738. new ProviderViewModel_default({
  212739. name: "ESRI World Street Map",
  212740. iconUrl: buildModuleUrl_default(
  212741. "Widgets/Images/ImageryProviders/esriWorldStreetMap.png"
  212742. ),
  212743. tooltip: "This worldwide street map presents highway-level data for the world. Street-level data includes the United States; much of Canada; Japan; most countries in Europe; Australia and New Zealand; India; parts of South America including Argentina, Brazil, Chile, Colombia, and Venezuela; Ghana; and parts of southern Africa including Botswana, Lesotho, Namibia, South Africa, and Swaziland.\nhttp://www.esri.com",
  212744. category: "Other",
  212745. creationFunction: function() {
  212746. return new ArcGisMapServerImageryProvider_default({
  212747. url: "https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer",
  212748. enablePickFeatures: false
  212749. });
  212750. }
  212751. })
  212752. );
  212753. providerViewModels.push(
  212754. new ProviderViewModel_default({
  212755. name: "ESRI National Geographic",
  212756. iconUrl: buildModuleUrl_default(
  212757. "Widgets/Images/ImageryProviders/esriNationalGeographic.png"
  212758. ),
  212759. tooltip: "This web map contains the National Geographic World Map service. This map service is designed to be used as a general reference map for informational and educational purposes as well as a basemap by GIS professionals and other users for creating web maps and web mapping applications.\nhttp://www.esri.com",
  212760. category: "Other",
  212761. creationFunction: function() {
  212762. return new ArcGisMapServerImageryProvider_default({
  212763. url: "https://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/",
  212764. enablePickFeatures: false
  212765. });
  212766. }
  212767. })
  212768. );
  212769. providerViewModels.push(
  212770. new ProviderViewModel_default({
  212771. name: "Open\xADStreet\xADMap",
  212772. iconUrl: buildModuleUrl_default(
  212773. "Widgets/Images/ImageryProviders/openStreetMap.png"
  212774. ),
  212775. tooltip: "OpenStreetMap (OSM) is a collaborative project to create a free editable map of the world.\nhttp://www.openstreetmap.org",
  212776. category: "Other",
  212777. creationFunction: function() {
  212778. return new OpenStreetMapImageryProvider_default({
  212779. url: "https://a.tile.openstreetmap.org/"
  212780. });
  212781. }
  212782. })
  212783. );
  212784. providerViewModels.push(
  212785. new ProviderViewModel_default({
  212786. name: "Stamen Watercolor",
  212787. iconUrl: buildModuleUrl_default(
  212788. "Widgets/Images/ImageryProviders/stamenWatercolor.png"
  212789. ),
  212790. tooltip: "Reminiscent of hand drawn maps, Stamen watercolor maps apply raster effect area washes and organic edges over a paper texture to add warm pop to any map.\nhttp://maps.stamen.com",
  212791. category: "Other",
  212792. creationFunction: function() {
  212793. return new OpenStreetMapImageryProvider_default({
  212794. url: "https://stamen-tiles.a.ssl.fastly.net/watercolor/",
  212795. credit: "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA."
  212796. });
  212797. }
  212798. })
  212799. );
  212800. providerViewModels.push(
  212801. new ProviderViewModel_default({
  212802. name: "Stamen Toner",
  212803. iconUrl: buildModuleUrl_default(
  212804. "Widgets/Images/ImageryProviders/stamenToner.png"
  212805. ),
  212806. tooltip: "A high contrast black and white map.\nhttp://maps.stamen.com",
  212807. category: "Other",
  212808. creationFunction: function() {
  212809. return new OpenStreetMapImageryProvider_default({
  212810. url: "https://stamen-tiles.a.ssl.fastly.net/toner/",
  212811. credit: "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under CC BY SA."
  212812. });
  212813. }
  212814. })
  212815. );
  212816. providerViewModels.push(
  212817. new ProviderViewModel_default({
  212818. name: "Sentinel-2",
  212819. iconUrl: buildModuleUrl_default("Widgets/Images/ImageryProviders/sentinel-2.png"),
  212820. tooltip: "Sentinel-2 cloudless by EOX IT Services GmbH (Contains modified Copernicus Sentinel data 2016 and 2017).",
  212821. category: "Cesium ion",
  212822. creationFunction: function() {
  212823. return new IonImageryProvider_default({ assetId: 3954 });
  212824. }
  212825. })
  212826. );
  212827. providerViewModels.push(
  212828. new ProviderViewModel_default({
  212829. name: "Blue Marble",
  212830. iconUrl: buildModuleUrl_default("Widgets/Images/ImageryProviders/blueMarble.png"),
  212831. tooltip: "Blue Marble Next Generation July, 2004 imagery from NASA.",
  212832. category: "Cesium ion",
  212833. creationFunction: function() {
  212834. return new IonImageryProvider_default({ assetId: 3845 });
  212835. }
  212836. })
  212837. );
  212838. providerViewModels.push(
  212839. new ProviderViewModel_default({
  212840. name: "Earth at night",
  212841. iconUrl: buildModuleUrl_default(
  212842. "Widgets/Images/ImageryProviders/earthAtNight.png"
  212843. ),
  212844. tooltip: "The Earth at night, also known as The Black Marble, is a 500 meter resolution global composite imagery layer released by NASA.",
  212845. category: "Cesium ion",
  212846. creationFunction: function() {
  212847. return new IonImageryProvider_default({ assetId: 3812 });
  212848. }
  212849. })
  212850. );
  212851. providerViewModels.push(
  212852. new ProviderViewModel_default({
  212853. name: "Natural Earth\xA0II",
  212854. iconUrl: buildModuleUrl_default(
  212855. "Widgets/Images/ImageryProviders/naturalEarthII.png"
  212856. ),
  212857. tooltip: "Natural Earth II, darkened for contrast.\nhttp://www.naturalearthdata.com/",
  212858. category: "Cesium ion",
  212859. creationFunction: function() {
  212860. return new TileMapServiceImageryProvider_default({
  212861. url: buildModuleUrl_default("Assets/Textures/NaturalEarthII")
  212862. });
  212863. }
  212864. })
  212865. );
  212866. return providerViewModels;
  212867. }
  212868. var createDefaultImageryProviderViewModels_default = createDefaultImageryProviderViewModels;
  212869. // node_modules/cesium/Source/Widgets/BaseLayerPicker/createDefaultTerrainProviderViewModels.js
  212870. function createDefaultTerrainProviderViewModels() {
  212871. const providerViewModels = [];
  212872. providerViewModels.push(
  212873. new ProviderViewModel_default({
  212874. name: "WGS84 Ellipsoid",
  212875. iconUrl: buildModuleUrl_default("Widgets/Images/TerrainProviders/Ellipsoid.png"),
  212876. tooltip: "WGS84 standard ellipsoid, also known as EPSG:4326",
  212877. category: "Cesium ion",
  212878. creationFunction: function() {
  212879. return new EllipsoidTerrainProvider_default();
  212880. }
  212881. })
  212882. );
  212883. providerViewModels.push(
  212884. new ProviderViewModel_default({
  212885. name: "Cesium World Terrain",
  212886. iconUrl: buildModuleUrl_default(
  212887. "Widgets/Images/TerrainProviders/CesiumWorldTerrain.png"
  212888. ),
  212889. tooltip: "High-resolution global terrain tileset curated from several datasources and hosted by Cesium ion",
  212890. category: "Cesium ion",
  212891. creationFunction: function() {
  212892. return createWorldTerrain_default({
  212893. requestWaterMask: true,
  212894. requestVertexNormals: true
  212895. });
  212896. }
  212897. })
  212898. );
  212899. return providerViewModels;
  212900. }
  212901. var createDefaultTerrainProviderViewModels_default = createDefaultTerrainProviderViewModels;
  212902. // node_modules/cesium/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js
  212903. function getPickTileset(viewModel) {
  212904. return function(e2) {
  212905. const pick = viewModel._scene.pick(e2.position);
  212906. if (defined_default(pick) && pick.primitive instanceof Cesium3DTileset_default) {
  212907. viewModel.tileset = pick.primitive;
  212908. }
  212909. viewModel.pickActive = false;
  212910. };
  212911. }
  212912. function selectTilesetOnHover(viewModel, value) {
  212913. if (value) {
  212914. viewModel._eventHandler.setInputAction(function(e2) {
  212915. const pick = viewModel._scene.pick(e2.endPosition);
  212916. if (defined_default(pick) && pick.primitive instanceof Cesium3DTileset_default) {
  212917. viewModel.tileset = pick.primitive;
  212918. }
  212919. }, ScreenSpaceEventType_default.MOUSE_MOVE);
  212920. } else {
  212921. viewModel._eventHandler.removeInputAction(ScreenSpaceEventType_default.MOUSE_MOVE);
  212922. viewModel.picking = viewModel.picking;
  212923. }
  212924. }
  212925. var stringOptions2 = {
  212926. maximumFractionDigits: 3
  212927. };
  212928. function formatMemoryString2(memorySizeInBytes) {
  212929. const memoryInMegabytes = memorySizeInBytes / 1048576;
  212930. if (memoryInMegabytes < 1) {
  212931. return memoryInMegabytes.toLocaleString(void 0, stringOptions2);
  212932. }
  212933. return Math.round(memoryInMegabytes).toLocaleString();
  212934. }
  212935. function getStatistics(tileset, isPick) {
  212936. if (!defined_default(tileset)) {
  212937. return "";
  212938. }
  212939. const statistics2 = isPick ? tileset._statisticsPerPass[Cesium3DTilePass_default.PICK] : tileset._statisticsPerPass[Cesium3DTilePass_default.RENDER];
  212940. let s2 = '<ul class="cesium-cesiumInspector-statistics">';
  212941. s2 += `<li><strong>Visited: </strong>${statistics2.visited.toLocaleString()}</li><li><strong>Selected: </strong>${statistics2.selected.toLocaleString()}</li><li><strong>Commands: </strong>${statistics2.numberOfCommands.toLocaleString()}</li>`;
  212942. s2 += "</ul>";
  212943. if (!isPick) {
  212944. s2 += '<ul class="cesium-cesiumInspector-statistics">';
  212945. s2 += `<li><strong>Requests: </strong>${statistics2.numberOfPendingRequests.toLocaleString()}</li><li><strong>Attempted: </strong>${statistics2.numberOfAttemptedRequests.toLocaleString()}</li><li><strong>Processing: </strong>${statistics2.numberOfTilesProcessing.toLocaleString()}</li><li><strong>Content Ready: </strong>${statistics2.numberOfTilesWithContentReady.toLocaleString()}</li><li><strong>Total: </strong>${statistics2.numberOfTilesTotal.toLocaleString()}</li>`;
  212946. s2 += "</ul>";
  212947. s2 += '<ul class="cesium-cesiumInspector-statistics">';
  212948. s2 += `<li><strong>Features Selected: </strong>${statistics2.numberOfFeaturesSelected.toLocaleString()}</li><li><strong>Features Loaded: </strong>${statistics2.numberOfFeaturesLoaded.toLocaleString()}</li><li><strong>Points Selected: </strong>${statistics2.numberOfPointsSelected.toLocaleString()}</li><li><strong>Points Loaded: </strong>${statistics2.numberOfPointsLoaded.toLocaleString()}</li><li><strong>Triangles Selected: </strong>${statistics2.numberOfTrianglesSelected.toLocaleString()}</li>`;
  212949. s2 += "</ul>";
  212950. s2 += '<ul class="cesium-cesiumInspector-statistics">';
  212951. s2 += `<li><strong>Tiles styled: </strong>${statistics2.numberOfTilesStyled.toLocaleString()}</li><li><strong>Features styled: </strong>${statistics2.numberOfFeaturesStyled.toLocaleString()}</li>`;
  212952. s2 += "</ul>";
  212953. s2 += '<ul class="cesium-cesiumInspector-statistics">';
  212954. s2 += `<li><strong>Children Union Culled: </strong>${statistics2.numberOfTilesCulledWithChildrenUnion.toLocaleString()}</li>`;
  212955. s2 += "</ul>";
  212956. s2 += '<ul class="cesium-cesiumInspector-statistics">';
  212957. s2 += `<li><strong>Geometry Memory (MB): </strong>${formatMemoryString2(
  212958. statistics2.geometryByteLength
  212959. )}</li><li><strong>Texture Memory (MB): </strong>${formatMemoryString2(
  212960. statistics2.texturesByteLength
  212961. )}</li><li><strong>Batch Table Memory (MB): </strong>${formatMemoryString2(
  212962. statistics2.batchTableByteLength
  212963. )}</li>`;
  212964. s2 += "</ul>";
  212965. }
  212966. return s2;
  212967. }
  212968. var colorBlendModes = [
  212969. {
  212970. text: "Highlight",
  212971. value: Cesium3DTileColorBlendMode_default.HIGHLIGHT
  212972. },
  212973. {
  212974. text: "Replace",
  212975. value: Cesium3DTileColorBlendMode_default.REPLACE
  212976. },
  212977. {
  212978. text: "Mix",
  212979. value: Cesium3DTileColorBlendMode_default.MIX
  212980. }
  212981. ];
  212982. var highlightColor2 = new Color_default(1, 1, 0, 0.4);
  212983. var scratchColor26 = new Color_default();
  212984. var oldColor = new Color_default();
  212985. function Cesium3DTilesInspectorViewModel(scene, performanceContainer) {
  212986. Check_default.typeOf.object("scene", scene);
  212987. Check_default.typeOf.object("performanceContainer", performanceContainer);
  212988. const that = this;
  212989. const canvas = scene.canvas;
  212990. this._eventHandler = new ScreenSpaceEventHandler_default(canvas);
  212991. this._scene = scene;
  212992. this._performanceContainer = performanceContainer;
  212993. this._canvas = canvas;
  212994. this._performanceDisplay = new PerformanceDisplay_default({
  212995. container: performanceContainer
  212996. });
  212997. this._statisticsText = "";
  212998. this._pickStatisticsText = "";
  212999. this._editorError = "";
  213000. this.performance = false;
  213001. this.showStatistics = true;
  213002. this.showPickStatistics = true;
  213003. this.inspectorVisible = true;
  213004. this.tilesetVisible = false;
  213005. this.displayVisible = false;
  213006. this.updateVisible = false;
  213007. this.loggingVisible = false;
  213008. this.styleVisible = false;
  213009. this.tileDebugLabelsVisible = false;
  213010. this.optimizationVisible = false;
  213011. this.styleString = "{}";
  213012. this._tileset = void 0;
  213013. this._feature = void 0;
  213014. this._tile = void 0;
  213015. knockout_default.track(this, [
  213016. "performance",
  213017. "inspectorVisible",
  213018. "_statisticsText",
  213019. "_pickStatisticsText",
  213020. "_editorError",
  213021. "showPickStatistics",
  213022. "showStatistics",
  213023. "tilesetVisible",
  213024. "displayVisible",
  213025. "updateVisible",
  213026. "loggingVisible",
  213027. "styleVisible",
  213028. "optimizationVisible",
  213029. "tileDebugLabelsVisible",
  213030. "styleString",
  213031. "_feature",
  213032. "_tile"
  213033. ]);
  213034. this._properties = knockout_default.observable({});
  213035. this.properties = [];
  213036. knockout_default.defineProperty(this, "properties", function() {
  213037. const names = [];
  213038. const properties = that._properties();
  213039. for (const prop in properties) {
  213040. if (properties.hasOwnProperty(prop)) {
  213041. names.push(prop);
  213042. }
  213043. }
  213044. return names;
  213045. });
  213046. const dynamicScreenSpaceError = knockout_default.observable();
  213047. knockout_default.defineProperty(this, "dynamicScreenSpaceError", {
  213048. get: function() {
  213049. return dynamicScreenSpaceError();
  213050. },
  213051. set: function(value) {
  213052. dynamicScreenSpaceError(value);
  213053. if (defined_default(that._tileset)) {
  213054. that._tileset.dynamicScreenSpaceError = value;
  213055. }
  213056. }
  213057. });
  213058. this.dynamicScreenSpaceError = false;
  213059. const colorBlendMode = knockout_default.observable();
  213060. knockout_default.defineProperty(this, "colorBlendMode", {
  213061. get: function() {
  213062. return colorBlendMode();
  213063. },
  213064. set: function(value) {
  213065. colorBlendMode(value);
  213066. if (defined_default(that._tileset)) {
  213067. that._tileset.colorBlendMode = value;
  213068. that._scene.requestRender();
  213069. }
  213070. }
  213071. });
  213072. this.colorBlendMode = Cesium3DTileColorBlendMode_default.HIGHLIGHT;
  213073. const showOnlyPickedTileDebugLabel = knockout_default.observable();
  213074. const picking = knockout_default.observable();
  213075. knockout_default.defineProperty(this, "picking", {
  213076. get: function() {
  213077. return picking();
  213078. },
  213079. set: function(value) {
  213080. picking(value);
  213081. if (value) {
  213082. that._eventHandler.setInputAction(function(e2) {
  213083. const picked = scene.pick(e2.endPosition);
  213084. if (picked instanceof Cesium3DTileFeature_default) {
  213085. that.feature = picked;
  213086. that.tile = picked.content.tile;
  213087. } else if (defined_default(picked) && defined_default(picked.content)) {
  213088. that.feature = void 0;
  213089. that.tile = picked.content.tile;
  213090. } else {
  213091. that.feature = void 0;
  213092. that.tile = void 0;
  213093. }
  213094. if (!defined_default(that._tileset)) {
  213095. return;
  213096. }
  213097. if (showOnlyPickedTileDebugLabel && defined_default(picked) && defined_default(picked.content)) {
  213098. let position;
  213099. if (scene.pickPositionSupported) {
  213100. position = scene.pickPosition(e2.endPosition);
  213101. if (defined_default(position)) {
  213102. that._tileset.debugPickPosition = position;
  213103. }
  213104. }
  213105. that._tileset.debugPickedTile = picked.content.tile;
  213106. } else {
  213107. that._tileset.debugPickedTile = void 0;
  213108. }
  213109. that._scene.requestRender();
  213110. }, ScreenSpaceEventType_default.MOUSE_MOVE);
  213111. } else {
  213112. that.feature = void 0;
  213113. that.tile = void 0;
  213114. that._eventHandler.removeInputAction(ScreenSpaceEventType_default.MOUSE_MOVE);
  213115. }
  213116. }
  213117. });
  213118. this.picking = true;
  213119. const colorize = knockout_default.observable();
  213120. knockout_default.defineProperty(this, "colorize", {
  213121. get: function() {
  213122. return colorize();
  213123. },
  213124. set: function(value) {
  213125. colorize(value);
  213126. if (defined_default(that._tileset)) {
  213127. that._tileset.debugColorizeTiles = value;
  213128. that._scene.requestRender();
  213129. }
  213130. }
  213131. });
  213132. this.colorize = false;
  213133. const wireframe = knockout_default.observable();
  213134. knockout_default.defineProperty(this, "wireframe", {
  213135. get: function() {
  213136. return wireframe();
  213137. },
  213138. set: function(value) {
  213139. wireframe(value);
  213140. if (defined_default(that._tileset)) {
  213141. that._tileset.debugWireframe = value;
  213142. that._scene.requestRender();
  213143. }
  213144. }
  213145. });
  213146. this.wireframe = false;
  213147. const showBoundingVolumes = knockout_default.observable();
  213148. knockout_default.defineProperty(this, "showBoundingVolumes", {
  213149. get: function() {
  213150. return showBoundingVolumes();
  213151. },
  213152. set: function(value) {
  213153. showBoundingVolumes(value);
  213154. if (defined_default(that._tileset)) {
  213155. that._tileset.debugShowBoundingVolume = value;
  213156. that._scene.requestRender();
  213157. }
  213158. }
  213159. });
  213160. this.showBoundingVolumes = false;
  213161. const showContentBoundingVolumes = knockout_default.observable();
  213162. knockout_default.defineProperty(this, "showContentBoundingVolumes", {
  213163. get: function() {
  213164. return showContentBoundingVolumes();
  213165. },
  213166. set: function(value) {
  213167. showContentBoundingVolumes(value);
  213168. if (defined_default(that._tileset)) {
  213169. that._tileset.debugShowContentBoundingVolume = value;
  213170. that._scene.requestRender();
  213171. }
  213172. }
  213173. });
  213174. this.showContentBoundingVolumes = false;
  213175. const showRequestVolumes = knockout_default.observable();
  213176. knockout_default.defineProperty(this, "showRequestVolumes", {
  213177. get: function() {
  213178. return showRequestVolumes();
  213179. },
  213180. set: function(value) {
  213181. showRequestVolumes(value);
  213182. if (defined_default(that._tileset)) {
  213183. that._tileset.debugShowViewerRequestVolume = value;
  213184. that._scene.requestRender();
  213185. }
  213186. }
  213187. });
  213188. this.showRequestVolumes = false;
  213189. const freezeFrame = knockout_default.observable();
  213190. knockout_default.defineProperty(this, "freezeFrame", {
  213191. get: function() {
  213192. return freezeFrame();
  213193. },
  213194. set: function(value) {
  213195. freezeFrame(value);
  213196. if (defined_default(that._tileset)) {
  213197. that._tileset.debugFreezeFrame = value;
  213198. that._scene.debugShowFrustumPlanes = value;
  213199. that._scene.requestRender();
  213200. }
  213201. }
  213202. });
  213203. this.freezeFrame = false;
  213204. knockout_default.defineProperty(this, "showOnlyPickedTileDebugLabel", {
  213205. get: function() {
  213206. return showOnlyPickedTileDebugLabel();
  213207. },
  213208. set: function(value) {
  213209. showOnlyPickedTileDebugLabel(value);
  213210. if (defined_default(that._tileset)) {
  213211. that._tileset.debugPickedTileLabelOnly = value;
  213212. that._scene.requestRender();
  213213. }
  213214. }
  213215. });
  213216. this.showOnlyPickedTileDebugLabel = false;
  213217. const showGeometricError = knockout_default.observable();
  213218. knockout_default.defineProperty(this, "showGeometricError", {
  213219. get: function() {
  213220. return showGeometricError();
  213221. },
  213222. set: function(value) {
  213223. showGeometricError(value);
  213224. if (defined_default(that._tileset)) {
  213225. that._tileset.debugShowGeometricError = value;
  213226. that._scene.requestRender();
  213227. }
  213228. }
  213229. });
  213230. this.showGeometricError = false;
  213231. const showRenderingStatistics = knockout_default.observable();
  213232. knockout_default.defineProperty(this, "showRenderingStatistics", {
  213233. get: function() {
  213234. return showRenderingStatistics();
  213235. },
  213236. set: function(value) {
  213237. showRenderingStatistics(value);
  213238. if (defined_default(that._tileset)) {
  213239. that._tileset.debugShowRenderingStatistics = value;
  213240. that._scene.requestRender();
  213241. }
  213242. }
  213243. });
  213244. this.showRenderingStatistics = false;
  213245. const showMemoryUsage = knockout_default.observable();
  213246. knockout_default.defineProperty(this, "showMemoryUsage", {
  213247. get: function() {
  213248. return showMemoryUsage();
  213249. },
  213250. set: function(value) {
  213251. showMemoryUsage(value);
  213252. if (defined_default(that._tileset)) {
  213253. that._tileset.debugShowMemoryUsage = value;
  213254. that._scene.requestRender();
  213255. }
  213256. }
  213257. });
  213258. this.showMemoryUsage = false;
  213259. const showUrl = knockout_default.observable();
  213260. knockout_default.defineProperty(this, "showUrl", {
  213261. get: function() {
  213262. return showUrl();
  213263. },
  213264. set: function(value) {
  213265. showUrl(value);
  213266. if (defined_default(that._tileset)) {
  213267. that._tileset.debugShowUrl = value;
  213268. that._scene.requestRender();
  213269. }
  213270. }
  213271. });
  213272. this.showUrl = false;
  213273. const maximumScreenSpaceError = knockout_default.observable();
  213274. knockout_default.defineProperty(this, "maximumScreenSpaceError", {
  213275. get: function() {
  213276. return maximumScreenSpaceError();
  213277. },
  213278. set: function(value) {
  213279. value = Number(value);
  213280. if (!isNaN(value)) {
  213281. maximumScreenSpaceError(value);
  213282. if (defined_default(that._tileset)) {
  213283. that._tileset.maximumScreenSpaceError = value;
  213284. }
  213285. }
  213286. }
  213287. });
  213288. this.maximumScreenSpaceError = 16;
  213289. const dynamicScreenSpaceErrorDensity = knockout_default.observable();
  213290. knockout_default.defineProperty(this, "dynamicScreenSpaceErrorDensity", {
  213291. get: function() {
  213292. return dynamicScreenSpaceErrorDensity();
  213293. },
  213294. set: function(value) {
  213295. value = Number(value);
  213296. if (!isNaN(value)) {
  213297. dynamicScreenSpaceErrorDensity(value);
  213298. if (defined_default(that._tileset)) {
  213299. that._tileset.dynamicScreenSpaceErrorDensity = value;
  213300. }
  213301. }
  213302. }
  213303. });
  213304. this.dynamicScreenSpaceErrorDensity = 278e-5;
  213305. this.dynamicScreenSpaceErrorDensitySliderValue = void 0;
  213306. knockout_default.defineProperty(this, "dynamicScreenSpaceErrorDensitySliderValue", {
  213307. get: function() {
  213308. return Math.pow(dynamicScreenSpaceErrorDensity(), 1 / 6);
  213309. },
  213310. set: function(value) {
  213311. dynamicScreenSpaceErrorDensity(Math.pow(value, 6));
  213312. }
  213313. });
  213314. const dynamicScreenSpaceErrorFactor = knockout_default.observable();
  213315. knockout_default.defineProperty(this, "dynamicScreenSpaceErrorFactor", {
  213316. get: function() {
  213317. return dynamicScreenSpaceErrorFactor();
  213318. },
  213319. set: function(value) {
  213320. value = Number(value);
  213321. if (!isNaN(value)) {
  213322. dynamicScreenSpaceErrorFactor(value);
  213323. if (defined_default(that._tileset)) {
  213324. that._tileset.dynamicScreenSpaceErrorFactor = value;
  213325. }
  213326. }
  213327. }
  213328. });
  213329. this.dynamicScreenSpaceErrorFactor = 4;
  213330. const pickTileset = getPickTileset(this);
  213331. const pickActive = knockout_default.observable();
  213332. knockout_default.defineProperty(this, "pickActive", {
  213333. get: function() {
  213334. return pickActive();
  213335. },
  213336. set: function(value) {
  213337. pickActive(value);
  213338. if (value) {
  213339. that._eventHandler.setInputAction(
  213340. pickTileset,
  213341. ScreenSpaceEventType_default.LEFT_CLICK
  213342. );
  213343. } else {
  213344. that._eventHandler.removeInputAction(ScreenSpaceEventType_default.LEFT_CLICK);
  213345. }
  213346. }
  213347. });
  213348. const pointCloudShading = knockout_default.observable();
  213349. knockout_default.defineProperty(this, "pointCloudShading", {
  213350. get: function() {
  213351. return pointCloudShading();
  213352. },
  213353. set: function(value) {
  213354. pointCloudShading(value);
  213355. if (defined_default(that._tileset)) {
  213356. that._tileset.pointCloudShading.attenuation = value;
  213357. }
  213358. }
  213359. });
  213360. this.pointCloudShading = false;
  213361. const geometricErrorScale = knockout_default.observable();
  213362. knockout_default.defineProperty(this, "geometricErrorScale", {
  213363. get: function() {
  213364. return geometricErrorScale();
  213365. },
  213366. set: function(value) {
  213367. value = Number(value);
  213368. if (!isNaN(value)) {
  213369. geometricErrorScale(value);
  213370. if (defined_default(that._tileset)) {
  213371. that._tileset.pointCloudShading.geometricErrorScale = value;
  213372. }
  213373. }
  213374. }
  213375. });
  213376. this.geometricErrorScale = 1;
  213377. const maximumAttenuation = knockout_default.observable();
  213378. knockout_default.defineProperty(this, "maximumAttenuation", {
  213379. get: function() {
  213380. return maximumAttenuation();
  213381. },
  213382. set: function(value) {
  213383. value = Number(value);
  213384. if (!isNaN(value)) {
  213385. maximumAttenuation(value);
  213386. if (defined_default(that._tileset)) {
  213387. that._tileset.pointCloudShading.maximumAttenuation = value === 0 ? void 0 : value;
  213388. }
  213389. }
  213390. }
  213391. });
  213392. this.maximumAttenuation = 0;
  213393. const baseResolution = knockout_default.observable();
  213394. knockout_default.defineProperty(this, "baseResolution", {
  213395. get: function() {
  213396. return baseResolution();
  213397. },
  213398. set: function(value) {
  213399. value = Number(value);
  213400. if (!isNaN(value)) {
  213401. baseResolution(value);
  213402. if (defined_default(that._tileset)) {
  213403. that._tileset.pointCloudShading.baseResolution = value === 0 ? void 0 : value;
  213404. }
  213405. }
  213406. }
  213407. });
  213408. this.baseResolution = 0;
  213409. const eyeDomeLighting = knockout_default.observable();
  213410. knockout_default.defineProperty(this, "eyeDomeLighting", {
  213411. get: function() {
  213412. return eyeDomeLighting();
  213413. },
  213414. set: function(value) {
  213415. eyeDomeLighting(value);
  213416. if (defined_default(that._tileset)) {
  213417. that._tileset.pointCloudShading.eyeDomeLighting = value;
  213418. }
  213419. }
  213420. });
  213421. this.eyeDomeLighting = false;
  213422. const eyeDomeLightingStrength = knockout_default.observable();
  213423. knockout_default.defineProperty(this, "eyeDomeLightingStrength", {
  213424. get: function() {
  213425. return eyeDomeLightingStrength();
  213426. },
  213427. set: function(value) {
  213428. value = Number(value);
  213429. if (!isNaN(value)) {
  213430. eyeDomeLightingStrength(value);
  213431. if (defined_default(that._tileset)) {
  213432. that._tileset.pointCloudShading.eyeDomeLightingStrength = value;
  213433. }
  213434. }
  213435. }
  213436. });
  213437. this.eyeDomeLightingStrength = 1;
  213438. const eyeDomeLightingRadius = knockout_default.observable();
  213439. knockout_default.defineProperty(this, "eyeDomeLightingRadius", {
  213440. get: function() {
  213441. return eyeDomeLightingRadius();
  213442. },
  213443. set: function(value) {
  213444. value = Number(value);
  213445. if (!isNaN(value)) {
  213446. eyeDomeLightingRadius(value);
  213447. if (defined_default(that._tileset)) {
  213448. that._tileset.pointCloudShading.eyeDomeLightingRadius = value;
  213449. }
  213450. }
  213451. }
  213452. });
  213453. this.eyeDomeLightingRadius = 1;
  213454. this.pickActive = false;
  213455. const skipLevelOfDetail2 = knockout_default.observable();
  213456. knockout_default.defineProperty(this, "skipLevelOfDetail", {
  213457. get: function() {
  213458. return skipLevelOfDetail2();
  213459. },
  213460. set: function(value) {
  213461. skipLevelOfDetail2(value);
  213462. if (defined_default(that._tileset)) {
  213463. that._tileset.skipLevelOfDetail = value;
  213464. }
  213465. }
  213466. });
  213467. this.skipLevelOfDetail = true;
  213468. const skipScreenSpaceErrorFactor = knockout_default.observable();
  213469. knockout_default.defineProperty(this, "skipScreenSpaceErrorFactor", {
  213470. get: function() {
  213471. return skipScreenSpaceErrorFactor();
  213472. },
  213473. set: function(value) {
  213474. value = Number(value);
  213475. if (!isNaN(value)) {
  213476. skipScreenSpaceErrorFactor(value);
  213477. if (defined_default(that._tileset)) {
  213478. that._tileset.skipScreenSpaceErrorFactor = value;
  213479. }
  213480. }
  213481. }
  213482. });
  213483. this.skipScreenSpaceErrorFactor = 16;
  213484. const baseScreenSpaceError = knockout_default.observable();
  213485. knockout_default.defineProperty(this, "baseScreenSpaceError", {
  213486. get: function() {
  213487. return baseScreenSpaceError();
  213488. },
  213489. set: function(value) {
  213490. value = Number(value);
  213491. if (!isNaN(value)) {
  213492. baseScreenSpaceError(value);
  213493. if (defined_default(that._tileset)) {
  213494. that._tileset.baseScreenSpaceError = value;
  213495. }
  213496. }
  213497. }
  213498. });
  213499. this.baseScreenSpaceError = 1024;
  213500. const skipLevels = knockout_default.observable();
  213501. knockout_default.defineProperty(this, "skipLevels", {
  213502. get: function() {
  213503. return skipLevels();
  213504. },
  213505. set: function(value) {
  213506. value = Number(value);
  213507. if (!isNaN(value)) {
  213508. skipLevels(value);
  213509. if (defined_default(that._tileset)) {
  213510. that._tileset.skipLevels = value;
  213511. }
  213512. }
  213513. }
  213514. });
  213515. this.skipLevels = 1;
  213516. const immediatelyLoadDesiredLevelOfDetail = knockout_default.observable();
  213517. knockout_default.defineProperty(this, "immediatelyLoadDesiredLevelOfDetail", {
  213518. get: function() {
  213519. return immediatelyLoadDesiredLevelOfDetail();
  213520. },
  213521. set: function(value) {
  213522. immediatelyLoadDesiredLevelOfDetail(value);
  213523. if (defined_default(that._tileset)) {
  213524. that._tileset.immediatelyLoadDesiredLevelOfDetail = value;
  213525. }
  213526. }
  213527. });
  213528. this.immediatelyLoadDesiredLevelOfDetail = false;
  213529. const loadSiblings = knockout_default.observable();
  213530. knockout_default.defineProperty(this, "loadSiblings", {
  213531. get: function() {
  213532. return loadSiblings();
  213533. },
  213534. set: function(value) {
  213535. loadSiblings(value);
  213536. if (defined_default(that._tileset)) {
  213537. that._tileset.loadSiblings = value;
  213538. }
  213539. }
  213540. });
  213541. this.loadSiblings = false;
  213542. this._style = void 0;
  213543. this._shouldStyle = false;
  213544. this._definedProperties = [
  213545. "properties",
  213546. "dynamicScreenSpaceError",
  213547. "colorBlendMode",
  213548. "picking",
  213549. "colorize",
  213550. "wireframe",
  213551. "showBoundingVolumes",
  213552. "showContentBoundingVolumes",
  213553. "showRequestVolumes",
  213554. "freezeFrame",
  213555. "maximumScreenSpaceError",
  213556. "dynamicScreenSpaceErrorDensity",
  213557. "baseScreenSpaceError",
  213558. "skipScreenSpaceErrorFactor",
  213559. "skipLevelOfDetail",
  213560. "skipLevels",
  213561. "immediatelyLoadDesiredLevelOfDetail",
  213562. "loadSiblings",
  213563. "dynamicScreenSpaceErrorDensitySliderValue",
  213564. "dynamicScreenSpaceErrorFactor",
  213565. "pickActive",
  213566. "showOnlyPickedTileDebugLabel",
  213567. "showGeometricError",
  213568. "showRenderingStatistics",
  213569. "showMemoryUsage",
  213570. "showUrl",
  213571. "pointCloudShading",
  213572. "geometricErrorScale",
  213573. "maximumAttenuation",
  213574. "baseResolution",
  213575. "eyeDomeLighting",
  213576. "eyeDomeLightingStrength",
  213577. "eyeDomeLightingRadius"
  213578. ];
  213579. this._removePostRenderEvent = scene.postRender.addEventListener(function() {
  213580. that._update();
  213581. });
  213582. if (!defined_default(this._tileset)) {
  213583. selectTilesetOnHover(this, true);
  213584. }
  213585. }
  213586. Object.defineProperties(Cesium3DTilesInspectorViewModel.prototype, {
  213587. scene: {
  213588. get: function() {
  213589. return this._scene;
  213590. }
  213591. },
  213592. performanceContainer: {
  213593. get: function() {
  213594. return this._performanceContainer;
  213595. }
  213596. },
  213597. statisticsText: {
  213598. get: function() {
  213599. return this._statisticsText;
  213600. }
  213601. },
  213602. pickStatisticsText: {
  213603. get: function() {
  213604. return this._pickStatisticsText;
  213605. }
  213606. },
  213607. colorBlendModes: {
  213608. get: function() {
  213609. return colorBlendModes;
  213610. }
  213611. },
  213612. editorError: {
  213613. get: function() {
  213614. return this._editorError;
  213615. }
  213616. },
  213617. tileset: {
  213618. get: function() {
  213619. return this._tileset;
  213620. },
  213621. set: function(tileset) {
  213622. this._tileset = tileset;
  213623. this._style = void 0;
  213624. this.styleString = "{}";
  213625. this.feature = void 0;
  213626. this.tile = void 0;
  213627. if (defined_default(tileset)) {
  213628. const that = this;
  213629. tileset.readyPromise.then(function(t) {
  213630. if (!that.isDestroyed()) {
  213631. that._properties(t.properties);
  213632. }
  213633. });
  213634. const settings = [
  213635. "colorize",
  213636. "wireframe",
  213637. "showBoundingVolumes",
  213638. "showContentBoundingVolumes",
  213639. "showRequestVolumes",
  213640. "freezeFrame",
  213641. "showOnlyPickedTileDebugLabel",
  213642. "showGeometricError",
  213643. "showRenderingStatistics",
  213644. "showMemoryUsage",
  213645. "showUrl"
  213646. ];
  213647. const length3 = settings.length;
  213648. for (let i2 = 0; i2 < length3; ++i2) {
  213649. const setting = settings[i2];
  213650. this[setting] = this[setting];
  213651. }
  213652. this.maximumScreenSpaceError = tileset.maximumScreenSpaceError;
  213653. this.dynamicScreenSpaceError = tileset.dynamicScreenSpaceError;
  213654. this.dynamicScreenSpaceErrorDensity = tileset.dynamicScreenSpaceErrorDensity;
  213655. this.dynamicScreenSpaceErrorFactor = tileset.dynamicScreenSpaceErrorFactor;
  213656. this.colorBlendMode = tileset.colorBlendMode;
  213657. this.skipLevelOfDetail = tileset.skipLevelOfDetail;
  213658. this.skipScreenSpaceErrorFactor = tileset.skipScreenSpaceErrorFactor;
  213659. this.baseScreenSpaceError = tileset.baseScreenSpaceError;
  213660. this.skipLevels = tileset.skipLevels;
  213661. this.immediatelyLoadDesiredLevelOfDetail = tileset.immediatelyLoadDesiredLevelOfDetail;
  213662. this.loadSiblings = tileset.loadSiblings;
  213663. const pointCloudShading = tileset.pointCloudShading;
  213664. this.pointCloudShading = pointCloudShading.attenuation;
  213665. this.geometricErrorScale = pointCloudShading.geometricErrorScale;
  213666. this.maximumAttenuation = pointCloudShading.maximumAttenuation ? pointCloudShading.maximumAttenuation : 0;
  213667. this.baseResolution = pointCloudShading.baseResolution ? pointCloudShading.baseResolution : 0;
  213668. this.eyeDomeLighting = pointCloudShading.eyeDomeLighting;
  213669. this.eyeDomeLightingStrength = pointCloudShading.eyeDomeLightingStrength;
  213670. this.eyeDomeLightingRadius = pointCloudShading.eyeDomeLightingRadius;
  213671. this._scene.requestRender();
  213672. } else {
  213673. this._properties({});
  213674. }
  213675. this._statisticsText = getStatistics(tileset, false);
  213676. this._pickStatisticsText = getStatistics(tileset, true);
  213677. selectTilesetOnHover(this, false);
  213678. }
  213679. },
  213680. feature: {
  213681. get: function() {
  213682. return this._feature;
  213683. },
  213684. set: function(feature2) {
  213685. if (this._feature === feature2) {
  213686. return;
  213687. }
  213688. const currentFeature = this._feature;
  213689. if (defined_default(currentFeature) && !currentFeature.content.isDestroyed()) {
  213690. if (!this.colorize && defined_default(this._style)) {
  213691. currentFeature.color = defined_default(this._style.color) ? this._style.color.evaluateColor(currentFeature, scratchColor26) : Color_default.WHITE;
  213692. } else {
  213693. currentFeature.color = oldColor;
  213694. }
  213695. this._scene.requestRender();
  213696. }
  213697. if (defined_default(feature2)) {
  213698. Color_default.clone(feature2.color, oldColor);
  213699. feature2.color = highlightColor2;
  213700. this._scene.requestRender();
  213701. }
  213702. this._feature = feature2;
  213703. }
  213704. },
  213705. tile: {
  213706. get: function() {
  213707. return this._tile;
  213708. },
  213709. set: function(tile) {
  213710. if (this._tile === tile) {
  213711. return;
  213712. }
  213713. const currentTile = this._tile;
  213714. if (defined_default(currentTile) && !currentTile.isDestroyed() && !hasFeatures(currentTile.content)) {
  213715. currentTile.color = oldColor;
  213716. this._scene.requestRender();
  213717. }
  213718. if (defined_default(tile) && !hasFeatures(tile.content)) {
  213719. Color_default.clone(tile.color, oldColor);
  213720. tile.color = highlightColor2;
  213721. this._scene.requestRender();
  213722. }
  213723. this._tile = tile;
  213724. }
  213725. }
  213726. });
  213727. function hasFeatures(content) {
  213728. if (content.featuresLength > 0) {
  213729. return true;
  213730. }
  213731. const innerContents = content.innerContents;
  213732. if (defined_default(innerContents)) {
  213733. const length3 = innerContents.length;
  213734. for (let i2 = 0; i2 < length3; ++i2) {
  213735. if (!hasFeatures(innerContents[i2])) {
  213736. return false;
  213737. }
  213738. }
  213739. return true;
  213740. }
  213741. return false;
  213742. }
  213743. Cesium3DTilesInspectorViewModel.prototype.togglePickTileset = function() {
  213744. this.pickActive = !this.pickActive;
  213745. };
  213746. Cesium3DTilesInspectorViewModel.prototype.toggleInspector = function() {
  213747. this.inspectorVisible = !this.inspectorVisible;
  213748. };
  213749. Cesium3DTilesInspectorViewModel.prototype.toggleTileset = function() {
  213750. this.tilesetVisible = !this.tilesetVisible;
  213751. };
  213752. Cesium3DTilesInspectorViewModel.prototype.toggleDisplay = function() {
  213753. this.displayVisible = !this.displayVisible;
  213754. };
  213755. Cesium3DTilesInspectorViewModel.prototype.toggleUpdate = function() {
  213756. this.updateVisible = !this.updateVisible;
  213757. };
  213758. Cesium3DTilesInspectorViewModel.prototype.toggleLogging = function() {
  213759. this.loggingVisible = !this.loggingVisible;
  213760. };
  213761. Cesium3DTilesInspectorViewModel.prototype.toggleStyle = function() {
  213762. this.styleVisible = !this.styleVisible;
  213763. };
  213764. Cesium3DTilesInspectorViewModel.prototype.toggleTileDebugLabels = function() {
  213765. this.tileDebugLabelsVisible = !this.tileDebugLabelsVisible;
  213766. };
  213767. Cesium3DTilesInspectorViewModel.prototype.toggleOptimization = function() {
  213768. this.optimizationVisible = !this.optimizationVisible;
  213769. };
  213770. Cesium3DTilesInspectorViewModel.prototype.trimTilesCache = function() {
  213771. if (defined_default(this._tileset)) {
  213772. this._tileset.trimLoadedTiles();
  213773. }
  213774. };
  213775. Cesium3DTilesInspectorViewModel.prototype.compileStyle = function() {
  213776. const tileset = this._tileset;
  213777. if (!defined_default(tileset) || this.styleString === JSON.stringify(tileset.style)) {
  213778. return;
  213779. }
  213780. this._editorError = "";
  213781. try {
  213782. if (this.styleString.length === 0) {
  213783. this.styleString = "{}";
  213784. }
  213785. this._style = new Cesium3DTileStyle_default(JSON.parse(this.styleString));
  213786. this._shouldStyle = true;
  213787. this._scene.requestRender();
  213788. } catch (err) {
  213789. this._editorError = err.toString();
  213790. }
  213791. this.feature = this._feature;
  213792. this.tile = this._tile;
  213793. };
  213794. Cesium3DTilesInspectorViewModel.prototype.styleEditorKeyPress = function(sender, event) {
  213795. if (event.keyCode === 9) {
  213796. event.preventDefault();
  213797. const textArea = event.target;
  213798. const start = textArea.selectionStart;
  213799. const end = textArea.selectionEnd;
  213800. let newEnd = end;
  213801. const selected = textArea.value.slice(start, end);
  213802. const lines = selected.split("\n");
  213803. const length3 = lines.length;
  213804. let i2;
  213805. if (!event.shiftKey) {
  213806. for (i2 = 0; i2 < length3; ++i2) {
  213807. lines[i2] = ` ${lines[i2]}`;
  213808. newEnd += 2;
  213809. }
  213810. } else {
  213811. for (i2 = 0; i2 < length3; ++i2) {
  213812. if (lines[i2][0] === " ") {
  213813. if (lines[i2][1] === " ") {
  213814. lines[i2] = lines[i2].substr(2);
  213815. newEnd -= 2;
  213816. } else {
  213817. lines[i2] = lines[i2].substr(1);
  213818. newEnd -= 1;
  213819. }
  213820. }
  213821. }
  213822. }
  213823. const newText = lines.join("\n");
  213824. textArea.value = textArea.value.slice(0, start) + newText + textArea.value.slice(end);
  213825. textArea.selectionStart = start !== end ? start : newEnd;
  213826. textArea.selectionEnd = newEnd;
  213827. } else if (event.ctrlKey && (event.keyCode === 10 || event.keyCode === 13)) {
  213828. this.compileStyle();
  213829. }
  213830. return true;
  213831. };
  213832. Cesium3DTilesInspectorViewModel.prototype._update = function() {
  213833. const tileset = this._tileset;
  213834. if (this.performance) {
  213835. this._performanceDisplay.update();
  213836. }
  213837. if (defined_default(tileset)) {
  213838. if (tileset.isDestroyed()) {
  213839. this.tile = void 0;
  213840. this.feature = void 0;
  213841. this.tileset = void 0;
  213842. return;
  213843. }
  213844. const style = tileset.style;
  213845. if (this._style !== tileset.style) {
  213846. if (this._shouldStyle) {
  213847. tileset.style = this._style;
  213848. this._shouldStyle = false;
  213849. } else {
  213850. this._style = style;
  213851. this.styleString = JSON.stringify(style.style, null, " ");
  213852. }
  213853. }
  213854. }
  213855. if (this.showStatistics) {
  213856. this._statisticsText = getStatistics(tileset, false);
  213857. this._pickStatisticsText = getStatistics(tileset, true);
  213858. }
  213859. };
  213860. Cesium3DTilesInspectorViewModel.prototype.isDestroyed = function() {
  213861. return false;
  213862. };
  213863. Cesium3DTilesInspectorViewModel.prototype.destroy = function() {
  213864. this._eventHandler.destroy();
  213865. this._removePostRenderEvent();
  213866. const that = this;
  213867. this._definedProperties.forEach(function(property) {
  213868. knockout_default.getObservable(that, property).dispose();
  213869. });
  213870. return destroyObject_default(this);
  213871. };
  213872. Cesium3DTilesInspectorViewModel.getStatistics = getStatistics;
  213873. var Cesium3DTilesInspectorViewModel_default = Cesium3DTilesInspectorViewModel;
  213874. // node_modules/cesium/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector.js
  213875. function Cesium3DTilesInspector(container, scene) {
  213876. Check_default.defined("container", container);
  213877. Check_default.typeOf.object("scene", scene);
  213878. container = getElement_default(container);
  213879. const element = document.createElement("div");
  213880. const performanceContainer = document.createElement("div");
  213881. performanceContainer.setAttribute("data-bind", "visible: performance");
  213882. const viewModel = new Cesium3DTilesInspectorViewModel_default(
  213883. scene,
  213884. performanceContainer
  213885. );
  213886. this._viewModel = viewModel;
  213887. this._container = container;
  213888. this._element = element;
  213889. const text2 = document.createElement("div");
  213890. text2.textContent = "3D Tiles Inspector";
  213891. text2.className = "cesium-cesiumInspector-button";
  213892. text2.setAttribute("data-bind", "click: toggleInspector");
  213893. element.appendChild(text2);
  213894. element.className = "cesium-cesiumInspector cesium-3DTilesInspector";
  213895. element.setAttribute(
  213896. "data-bind",
  213897. 'css: { "cesium-cesiumInspector-visible" : inspectorVisible, "cesium-cesiumInspector-hidden" : !inspectorVisible}'
  213898. );
  213899. container.appendChild(element);
  213900. const panel = document.createElement("div");
  213901. this._panel = panel;
  213902. panel.className = "cesium-cesiumInspector-dropDown";
  213903. element.appendChild(panel);
  213904. const createSection = InspectorShared_default.createSection;
  213905. const createCheckbox = InspectorShared_default.createCheckbox;
  213906. const tilesetPanelContents = createSection(
  213907. panel,
  213908. "Tileset",
  213909. "tilesetVisible",
  213910. "toggleTileset"
  213911. );
  213912. const displayPanelContents = createSection(
  213913. panel,
  213914. "Display",
  213915. "displayVisible",
  213916. "toggleDisplay"
  213917. );
  213918. const updatePanelContents = createSection(
  213919. panel,
  213920. "Update",
  213921. "updateVisible",
  213922. "toggleUpdate"
  213923. );
  213924. const loggingPanelContents = createSection(
  213925. panel,
  213926. "Logging",
  213927. "loggingVisible",
  213928. "toggleLogging"
  213929. );
  213930. const tileDebugLabelsPanelContents = createSection(
  213931. panel,
  213932. "Tile Debug Labels",
  213933. "tileDebugLabelsVisible",
  213934. "toggleTileDebugLabels"
  213935. );
  213936. const stylePanelContents = createSection(
  213937. panel,
  213938. "Style",
  213939. "styleVisible",
  213940. "toggleStyle"
  213941. );
  213942. const optimizationPanelContents = createSection(
  213943. panel,
  213944. "Optimization",
  213945. "optimizationVisible",
  213946. "toggleOptimization"
  213947. );
  213948. const properties = document.createElement("div");
  213949. properties.className = "field-group";
  213950. const propertiesLabel = document.createElement("label");
  213951. propertiesLabel.className = "field-label";
  213952. propertiesLabel.appendChild(document.createTextNode("Properties: "));
  213953. const propertiesField = document.createElement("div");
  213954. propertiesField.setAttribute("data-bind", "text: properties");
  213955. properties.appendChild(propertiesLabel);
  213956. properties.appendChild(propertiesField);
  213957. tilesetPanelContents.appendChild(properties);
  213958. tilesetPanelContents.appendChild(
  213959. makeButton("togglePickTileset", "Pick Tileset", "pickActive")
  213960. );
  213961. tilesetPanelContents.appendChild(
  213962. makeButton("trimTilesCache", "Trim Tiles Cache")
  213963. );
  213964. tilesetPanelContents.appendChild(createCheckbox("Enable Picking", "picking"));
  213965. displayPanelContents.appendChild(createCheckbox("Colorize", "colorize"));
  213966. displayPanelContents.appendChild(createCheckbox("Wireframe", "wireframe"));
  213967. displayPanelContents.appendChild(
  213968. createCheckbox("Bounding Volumes", "showBoundingVolumes")
  213969. );
  213970. displayPanelContents.appendChild(
  213971. createCheckbox("Content Volumes", "showContentBoundingVolumes")
  213972. );
  213973. displayPanelContents.appendChild(
  213974. createCheckbox("Request Volumes", "showRequestVolumes")
  213975. );
  213976. displayPanelContents.appendChild(
  213977. createCheckbox("Point Cloud Shading", "pointCloudShading")
  213978. );
  213979. const pointCloudShadingContainer = document.createElement("div");
  213980. pointCloudShadingContainer.setAttribute(
  213981. "data-bind",
  213982. "visible: pointCloudShading"
  213983. );
  213984. pointCloudShadingContainer.appendChild(
  213985. makeRangeInput("geometricErrorScale", 0, 2, 0.01, "Geometric Error Scale")
  213986. );
  213987. pointCloudShadingContainer.appendChild(
  213988. makeRangeInput("maximumAttenuation", 0, 32, 1, "Maximum Attenuation")
  213989. );
  213990. pointCloudShadingContainer.appendChild(
  213991. makeRangeInput("baseResolution", 0, 1, 0.01, "Base Resolution")
  213992. );
  213993. pointCloudShadingContainer.appendChild(
  213994. createCheckbox("Eye Dome Lighting (EDL)", "eyeDomeLighting")
  213995. );
  213996. displayPanelContents.appendChild(pointCloudShadingContainer);
  213997. const edlContainer = document.createElement("div");
  213998. edlContainer.setAttribute("data-bind", "visible: eyeDomeLighting");
  213999. edlContainer.appendChild(
  214000. makeRangeInput("eyeDomeLightingStrength", 0, 2, 0.1, "EDL Strength")
  214001. );
  214002. edlContainer.appendChild(
  214003. makeRangeInput("eyeDomeLightingRadius", 0, 4, 0.1, "EDL Radius")
  214004. );
  214005. pointCloudShadingContainer.appendChild(edlContainer);
  214006. updatePanelContents.appendChild(
  214007. createCheckbox("Freeze Frame", "freezeFrame")
  214008. );
  214009. updatePanelContents.appendChild(
  214010. createCheckbox("Dynamic Screen Space Error", "dynamicScreenSpaceError")
  214011. );
  214012. const sseContainer = document.createElement("div");
  214013. sseContainer.appendChild(
  214014. makeRangeInput(
  214015. "maximumScreenSpaceError",
  214016. 0,
  214017. 128,
  214018. 1,
  214019. "Maximum Screen Space Error"
  214020. )
  214021. );
  214022. updatePanelContents.appendChild(sseContainer);
  214023. const dynamicScreenSpaceErrorContainer = document.createElement("div");
  214024. dynamicScreenSpaceErrorContainer.setAttribute(
  214025. "data-bind",
  214026. "visible: dynamicScreenSpaceError"
  214027. );
  214028. dynamicScreenSpaceErrorContainer.appendChild(
  214029. makeRangeInput(
  214030. "dynamicScreenSpaceErrorDensitySliderValue",
  214031. 0,
  214032. 1,
  214033. 5e-3,
  214034. "Screen Space Error Density",
  214035. "dynamicScreenSpaceErrorDensity"
  214036. )
  214037. );
  214038. dynamicScreenSpaceErrorContainer.appendChild(
  214039. makeRangeInput(
  214040. "dynamicScreenSpaceErrorFactor",
  214041. 1,
  214042. 10,
  214043. 0.1,
  214044. "Screen Space Error Factor"
  214045. )
  214046. );
  214047. updatePanelContents.appendChild(dynamicScreenSpaceErrorContainer);
  214048. loggingPanelContents.appendChild(
  214049. createCheckbox("Performance", "performance")
  214050. );
  214051. loggingPanelContents.appendChild(performanceContainer);
  214052. loggingPanelContents.appendChild(
  214053. createCheckbox("Statistics", "showStatistics")
  214054. );
  214055. const statistics2 = document.createElement("div");
  214056. statistics2.className = "cesium-3dTilesInspector-statistics";
  214057. statistics2.setAttribute(
  214058. "data-bind",
  214059. "html: statisticsText, visible: showStatistics"
  214060. );
  214061. loggingPanelContents.appendChild(statistics2);
  214062. loggingPanelContents.appendChild(
  214063. createCheckbox("Pick Statistics", "showPickStatistics")
  214064. );
  214065. const pickStatistics = document.createElement("div");
  214066. pickStatistics.className = "cesium-3dTilesInspector-statistics";
  214067. pickStatistics.setAttribute(
  214068. "data-bind",
  214069. "html: pickStatisticsText, visible: showPickStatistics"
  214070. );
  214071. loggingPanelContents.appendChild(pickStatistics);
  214072. const stylePanelEditor = document.createElement("div");
  214073. stylePanelContents.appendChild(stylePanelEditor);
  214074. stylePanelEditor.appendChild(document.createTextNode("Color Blend Mode: "));
  214075. const blendDropdown = document.createElement("select");
  214076. blendDropdown.setAttribute(
  214077. "data-bind",
  214078. 'options: colorBlendModes, optionsText: "text", optionsValue: "value", value: colorBlendMode'
  214079. );
  214080. stylePanelEditor.appendChild(blendDropdown);
  214081. const styleEditor = document.createElement("textarea");
  214082. styleEditor.setAttribute(
  214083. "data-bind",
  214084. "textInput: styleString, event: { keydown: styleEditorKeyPress }"
  214085. );
  214086. stylePanelEditor.className = "cesium-cesiumInspector-styleEditor";
  214087. stylePanelEditor.appendChild(styleEditor);
  214088. const closeStylesBtn = makeButton("compileStyle", "Compile (Ctrl+Enter)");
  214089. stylePanelEditor.appendChild(closeStylesBtn);
  214090. const errorBox = document.createElement("div");
  214091. errorBox.className = "cesium-cesiumInspector-error";
  214092. errorBox.setAttribute("data-bind", "text: editorError");
  214093. stylePanelEditor.appendChild(errorBox);
  214094. tileDebugLabelsPanelContents.appendChild(
  214095. createCheckbox("Show Picked Only", "showOnlyPickedTileDebugLabel")
  214096. );
  214097. tileDebugLabelsPanelContents.appendChild(
  214098. createCheckbox("Geometric Error", "showGeometricError")
  214099. );
  214100. tileDebugLabelsPanelContents.appendChild(
  214101. createCheckbox("Rendering Statistics", "showRenderingStatistics")
  214102. );
  214103. tileDebugLabelsPanelContents.appendChild(
  214104. createCheckbox("Memory Usage (MB)", "showMemoryUsage")
  214105. );
  214106. tileDebugLabelsPanelContents.appendChild(createCheckbox("Url", "showUrl"));
  214107. optimizationPanelContents.appendChild(
  214108. createCheckbox("Skip Tile LODs", "skipLevelOfDetail")
  214109. );
  214110. const skipScreenSpaceErrorFactorContainer = document.createElement("div");
  214111. skipScreenSpaceErrorFactorContainer.appendChild(
  214112. makeRangeInput("skipScreenSpaceErrorFactor", 1, 50, 1, "Skip SSE Factor")
  214113. );
  214114. optimizationPanelContents.appendChild(skipScreenSpaceErrorFactorContainer);
  214115. const baseScreenSpaceError = document.createElement("div");
  214116. baseScreenSpaceError.appendChild(
  214117. makeRangeInput(
  214118. "baseScreenSpaceError",
  214119. 0,
  214120. 4096,
  214121. 1,
  214122. "SSE before skipping LOD"
  214123. )
  214124. );
  214125. optimizationPanelContents.appendChild(baseScreenSpaceError);
  214126. const skipLevelsContainer = document.createElement("div");
  214127. skipLevelsContainer.appendChild(
  214128. makeRangeInput("skipLevels", 0, 10, 1, "Min. levels to skip")
  214129. );
  214130. optimizationPanelContents.appendChild(skipLevelsContainer);
  214131. optimizationPanelContents.appendChild(
  214132. createCheckbox(
  214133. "Load only tiles that meet the max SSE.",
  214134. "immediatelyLoadDesiredLevelOfDetail"
  214135. )
  214136. );
  214137. optimizationPanelContents.appendChild(
  214138. createCheckbox("Load siblings of visible tiles", "loadSiblings")
  214139. );
  214140. knockout_default.applyBindings(viewModel, element);
  214141. }
  214142. Object.defineProperties(Cesium3DTilesInspector.prototype, {
  214143. container: {
  214144. get: function() {
  214145. return this._container;
  214146. }
  214147. },
  214148. viewModel: {
  214149. get: function() {
  214150. return this._viewModel;
  214151. }
  214152. }
  214153. });
  214154. Cesium3DTilesInspector.prototype.isDestroyed = function() {
  214155. return false;
  214156. };
  214157. Cesium3DTilesInspector.prototype.destroy = function() {
  214158. knockout_default.cleanNode(this._element);
  214159. this._container.removeChild(this._element);
  214160. this.viewModel.destroy();
  214161. return destroyObject_default(this);
  214162. };
  214163. function makeRangeInput(property, min3, max3, step2, text2, displayProperty) {
  214164. displayProperty = defaultValue_default(displayProperty, property);
  214165. const input = document.createElement("input");
  214166. input.setAttribute("data-bind", `value: ${displayProperty}`);
  214167. input.type = "number";
  214168. const slider = document.createElement("input");
  214169. slider.type = "range";
  214170. slider.min = min3;
  214171. slider.max = max3;
  214172. slider.step = step2;
  214173. slider.setAttribute("data-bind", `valueUpdate: "input", value: ${property}`);
  214174. const wrapper = document.createElement("div");
  214175. wrapper.appendChild(slider);
  214176. const container = document.createElement("div");
  214177. container.className = "cesium-cesiumInspector-slider";
  214178. container.appendChild(document.createTextNode(text2));
  214179. container.appendChild(input);
  214180. container.appendChild(wrapper);
  214181. return container;
  214182. }
  214183. function makeButton(action, text2, active) {
  214184. const button = document.createElement("button");
  214185. button.type = "button";
  214186. button.textContent = text2;
  214187. button.className = "cesium-cesiumInspector-pickButton";
  214188. let binding = `click: ${action}`;
  214189. if (defined_default(active)) {
  214190. binding += `, css: {"cesium-cesiumInspector-pickButtonHighlight" : ${active}}`;
  214191. }
  214192. button.setAttribute("data-bind", binding);
  214193. return button;
  214194. }
  214195. var Cesium3DTilesInspector_default = Cesium3DTilesInspector;
  214196. // node_modules/cesium/Source/Widgets/CesiumInspector/CesiumInspectorViewModel.js
  214197. function frustumStatisticsToString(statistics2) {
  214198. let str;
  214199. if (defined_default(statistics2)) {
  214200. str = "Command Statistics";
  214201. const com = statistics2.commandsInFrustums;
  214202. for (const n2 in com) {
  214203. if (com.hasOwnProperty(n2)) {
  214204. let num = parseInt(n2, 10);
  214205. let s2;
  214206. if (num === 7) {
  214207. s2 = "1, 2 and 3";
  214208. } else {
  214209. const f2 = [];
  214210. for (let i2 = 2; i2 >= 0; i2--) {
  214211. const p2 = Math.pow(2, i2);
  214212. if (num >= p2) {
  214213. f2.push(i2 + 1);
  214214. num -= p2;
  214215. }
  214216. }
  214217. s2 = f2.reverse().join(" and ");
  214218. }
  214219. str += `<br>&nbsp;&nbsp;&nbsp;&nbsp;${com[n2]} in frustum ${s2}`;
  214220. }
  214221. }
  214222. str += `<br>Total: ${statistics2.totalCommands}`;
  214223. }
  214224. return str;
  214225. }
  214226. function boundDepthFrustum(lower, upper, proposed) {
  214227. let bounded = Math.min(proposed, upper);
  214228. bounded = Math.max(bounded, lower);
  214229. return bounded;
  214230. }
  214231. var scratchPickRay2 = new Ray_default();
  214232. var scratchPickCartesian3 = new Cartesian3_default();
  214233. function CesiumInspectorViewModel(scene, performanceContainer) {
  214234. if (!defined_default(scene)) {
  214235. throw new DeveloperError_default("scene is required");
  214236. }
  214237. if (!defined_default(performanceContainer)) {
  214238. throw new DeveloperError_default("performanceContainer is required");
  214239. }
  214240. const that = this;
  214241. const canvas = scene.canvas;
  214242. const eventHandler = new ScreenSpaceEventHandler_default(canvas);
  214243. this._eventHandler = eventHandler;
  214244. this._scene = scene;
  214245. this._canvas = canvas;
  214246. this._primitive = void 0;
  214247. this._tile = void 0;
  214248. this._modelMatrixPrimitive = void 0;
  214249. this._performanceDisplay = void 0;
  214250. this._performanceContainer = performanceContainer;
  214251. const globe = this._scene.globe;
  214252. globe.depthTestAgainstTerrain = true;
  214253. this.frustums = false;
  214254. this.frustumPlanes = false;
  214255. this.performance = false;
  214256. this.shaderCacheText = "";
  214257. this.primitiveBoundingSphere = false;
  214258. this.primitiveReferenceFrame = false;
  214259. this.filterPrimitive = false;
  214260. this.tileBoundingSphere = false;
  214261. this.filterTile = false;
  214262. this.wireframe = false;
  214263. this.depthFrustum = 1;
  214264. this._numberOfFrustums = 1;
  214265. this.suspendUpdates = false;
  214266. this.tileCoordinates = false;
  214267. this.frustumStatisticText = false;
  214268. this.tileText = "";
  214269. this.hasPickedPrimitive = false;
  214270. this.hasPickedTile = false;
  214271. this.pickPrimitiveActive = false;
  214272. this.pickTileActive = false;
  214273. this.dropDownVisible = true;
  214274. this.generalVisible = true;
  214275. this.primitivesVisible = false;
  214276. this.terrainVisible = false;
  214277. this.depthFrustumText = "";
  214278. knockout_default.track(this, [
  214279. "frustums",
  214280. "frustumPlanes",
  214281. "performance",
  214282. "shaderCacheText",
  214283. "primitiveBoundingSphere",
  214284. "primitiveReferenceFrame",
  214285. "filterPrimitive",
  214286. "tileBoundingSphere",
  214287. "filterTile",
  214288. "wireframe",
  214289. "depthFrustum",
  214290. "suspendUpdates",
  214291. "tileCoordinates",
  214292. "frustumStatisticText",
  214293. "tileText",
  214294. "hasPickedPrimitive",
  214295. "hasPickedTile",
  214296. "pickPrimitiveActive",
  214297. "pickTileActive",
  214298. "dropDownVisible",
  214299. "generalVisible",
  214300. "primitivesVisible",
  214301. "terrainVisible",
  214302. "depthFrustumText"
  214303. ]);
  214304. this._toggleDropDown = createCommand_default(function() {
  214305. that.dropDownVisible = !that.dropDownVisible;
  214306. });
  214307. this._toggleGeneral = createCommand_default(function() {
  214308. that.generalVisible = !that.generalVisible;
  214309. });
  214310. this._togglePrimitives = createCommand_default(function() {
  214311. that.primitivesVisible = !that.primitivesVisible;
  214312. });
  214313. this._toggleTerrain = createCommand_default(function() {
  214314. that.terrainVisible = !that.terrainVisible;
  214315. });
  214316. this._frustumsSubscription = knockout_default.getObservable(this, "frustums").subscribe(function(val) {
  214317. that._scene.debugShowFrustums = val;
  214318. that._scene.requestRender();
  214319. });
  214320. this._frustumPlanesSubscription = knockout_default.getObservable(this, "frustumPlanes").subscribe(function(val) {
  214321. that._scene.debugShowFrustumPlanes = val;
  214322. that._scene.requestRender();
  214323. });
  214324. this._performanceSubscription = knockout_default.getObservable(this, "performance").subscribe(function(val) {
  214325. if (val) {
  214326. that._performanceDisplay = new PerformanceDisplay_default({
  214327. container: that._performanceContainer
  214328. });
  214329. } else {
  214330. that._performanceContainer.innerHTML = "";
  214331. }
  214332. });
  214333. this._showPrimitiveBoundingSphere = createCommand_default(function() {
  214334. that._primitive.debugShowBoundingVolume = that.primitiveBoundingSphere;
  214335. that._scene.requestRender();
  214336. return true;
  214337. });
  214338. this._primitiveBoundingSphereSubscription = knockout_default.getObservable(this, "primitiveBoundingSphere").subscribe(function() {
  214339. that._showPrimitiveBoundingSphere();
  214340. });
  214341. this._showPrimitiveReferenceFrame = createCommand_default(function() {
  214342. if (that.primitiveReferenceFrame) {
  214343. const modelMatrix = that._primitive.modelMatrix;
  214344. that._modelMatrixPrimitive = new DebugModelMatrixPrimitive_default({
  214345. modelMatrix
  214346. });
  214347. that._scene.primitives.add(that._modelMatrixPrimitive);
  214348. } else if (defined_default(that._modelMatrixPrimitive)) {
  214349. that._scene.primitives.remove(that._modelMatrixPrimitive);
  214350. that._modelMatrixPrimitive = void 0;
  214351. }
  214352. that._scene.requestRender();
  214353. return true;
  214354. });
  214355. this._primitiveReferenceFrameSubscription = knockout_default.getObservable(this, "primitiveReferenceFrame").subscribe(function() {
  214356. that._showPrimitiveReferenceFrame();
  214357. });
  214358. this._doFilterPrimitive = createCommand_default(function() {
  214359. if (that.filterPrimitive) {
  214360. that._scene.debugCommandFilter = function(command) {
  214361. if (defined_default(that._modelMatrixPrimitive) && command.owner === that._modelMatrixPrimitive._primitive) {
  214362. return true;
  214363. } else if (defined_default(that._primitive)) {
  214364. return command.owner === that._primitive || command.owner === that._primitive._billboardCollection || command.owner.primitive === that._primitive;
  214365. }
  214366. return false;
  214367. };
  214368. } else {
  214369. that._scene.debugCommandFilter = void 0;
  214370. }
  214371. return true;
  214372. });
  214373. this._filterPrimitiveSubscription = knockout_default.getObservable(this, "filterPrimitive").subscribe(function() {
  214374. that._doFilterPrimitive();
  214375. that._scene.requestRender();
  214376. });
  214377. this._wireframeSubscription = knockout_default.getObservable(this, "wireframe").subscribe(function(val) {
  214378. globe._surface.tileProvider._debug.wireframe = val;
  214379. that._scene.requestRender();
  214380. });
  214381. this._depthFrustumSubscription = knockout_default.getObservable(this, "depthFrustum").subscribe(function(val) {
  214382. that._scene.debugShowDepthFrustum = val;
  214383. that._scene.requestRender();
  214384. });
  214385. this._incrementDepthFrustum = createCommand_default(function() {
  214386. const next = that.depthFrustum + 1;
  214387. that.depthFrustum = boundDepthFrustum(1, that._numberOfFrustums, next);
  214388. that._scene.requestRender();
  214389. return true;
  214390. });
  214391. this._decrementDepthFrustum = createCommand_default(function() {
  214392. const next = that.depthFrustum - 1;
  214393. that.depthFrustum = boundDepthFrustum(1, that._numberOfFrustums, next);
  214394. that._scene.requestRender();
  214395. return true;
  214396. });
  214397. this._suspendUpdatesSubscription = knockout_default.getObservable(this, "suspendUpdates").subscribe(function(val) {
  214398. globe._surface._debug.suspendLodUpdate = val;
  214399. if (!val) {
  214400. that.filterTile = false;
  214401. }
  214402. });
  214403. let tileBoundariesLayer;
  214404. this._showTileCoordinates = createCommand_default(function() {
  214405. if (that.tileCoordinates && !defined_default(tileBoundariesLayer)) {
  214406. tileBoundariesLayer = scene.imageryLayers.addImageryProvider(
  214407. new TileCoordinatesImageryProvider_default({
  214408. tilingScheme: scene.terrainProvider.tilingScheme
  214409. })
  214410. );
  214411. } else if (!that.tileCoordinates && defined_default(tileBoundariesLayer)) {
  214412. scene.imageryLayers.remove(tileBoundariesLayer);
  214413. tileBoundariesLayer = void 0;
  214414. }
  214415. return true;
  214416. });
  214417. this._tileCoordinatesSubscription = knockout_default.getObservable(this, "tileCoordinates").subscribe(function() {
  214418. that._showTileCoordinates();
  214419. that._scene.requestRender();
  214420. });
  214421. this._tileBoundingSphereSubscription = knockout_default.getObservable(this, "tileBoundingSphere").subscribe(function() {
  214422. that._showTileBoundingSphere();
  214423. that._scene.requestRender();
  214424. });
  214425. this._showTileBoundingSphere = createCommand_default(function() {
  214426. if (that.tileBoundingSphere) {
  214427. globe._surface.tileProvider._debug.boundingSphereTile = that._tile;
  214428. } else {
  214429. globe._surface.tileProvider._debug.boundingSphereTile = void 0;
  214430. }
  214431. that._scene.requestRender();
  214432. return true;
  214433. });
  214434. this._doFilterTile = createCommand_default(function() {
  214435. if (!that.filterTile) {
  214436. that.suspendUpdates = false;
  214437. } else {
  214438. that.suspendUpdates = true;
  214439. globe._surface._tilesToRender = [];
  214440. if (defined_default(that._tile) && that._tile.renderable) {
  214441. globe._surface._tilesToRender.push(that._tile);
  214442. }
  214443. }
  214444. return true;
  214445. });
  214446. this._filterTileSubscription = knockout_default.getObservable(this, "filterTile").subscribe(function() {
  214447. that.doFilterTile();
  214448. that._scene.requestRender();
  214449. });
  214450. function pickPrimitive(e2) {
  214451. const newPick = that._scene.pick({
  214452. x: e2.position.x,
  214453. y: e2.position.y
  214454. });
  214455. if (defined_default(newPick)) {
  214456. that.primitive = defined_default(newPick.collection) ? newPick.collection : newPick.primitive;
  214457. }
  214458. that._scene.requestRender();
  214459. that.pickPrimitiveActive = false;
  214460. }
  214461. this._pickPrimitive = createCommand_default(function() {
  214462. that.pickPrimitiveActive = !that.pickPrimitiveActive;
  214463. });
  214464. this._pickPrimitiveActiveSubscription = knockout_default.getObservable(this, "pickPrimitiveActive").subscribe(function(val) {
  214465. if (val) {
  214466. eventHandler.setInputAction(
  214467. pickPrimitive,
  214468. ScreenSpaceEventType_default.LEFT_CLICK
  214469. );
  214470. } else {
  214471. eventHandler.removeInputAction(ScreenSpaceEventType_default.LEFT_CLICK);
  214472. }
  214473. });
  214474. function selectTile2(e2) {
  214475. let selectedTile;
  214476. const ellipsoid = globe.ellipsoid;
  214477. const ray = that._scene.camera.getPickRay(e2.position, scratchPickRay2);
  214478. const cartesian11 = globe.pick(ray, that._scene, scratchPickCartesian3);
  214479. if (defined_default(cartesian11)) {
  214480. const cartographic2 = ellipsoid.cartesianToCartographic(cartesian11);
  214481. const tilesRendered = globe._surface.tileProvider._tilesToRenderByTextureCount;
  214482. for (let textureCount = 0; !selectedTile && textureCount < tilesRendered.length; ++textureCount) {
  214483. const tilesRenderedByTextureCount = tilesRendered[textureCount];
  214484. if (!defined_default(tilesRenderedByTextureCount)) {
  214485. continue;
  214486. }
  214487. for (let tileIndex = 0; !selectedTile && tileIndex < tilesRenderedByTextureCount.length; ++tileIndex) {
  214488. const tile = tilesRenderedByTextureCount[tileIndex];
  214489. if (Rectangle_default.contains(tile.rectangle, cartographic2)) {
  214490. selectedTile = tile;
  214491. }
  214492. }
  214493. }
  214494. }
  214495. that.tile = selectedTile;
  214496. that.pickTileActive = false;
  214497. }
  214498. this._pickTile = createCommand_default(function() {
  214499. that.pickTileActive = !that.pickTileActive;
  214500. });
  214501. this._pickTileActiveSubscription = knockout_default.getObservable(this, "pickTileActive").subscribe(function(val) {
  214502. if (val) {
  214503. eventHandler.setInputAction(
  214504. selectTile2,
  214505. ScreenSpaceEventType_default.LEFT_CLICK
  214506. );
  214507. } else {
  214508. eventHandler.removeInputAction(ScreenSpaceEventType_default.LEFT_CLICK);
  214509. }
  214510. });
  214511. this._removePostRenderEvent = scene.postRender.addEventListener(function() {
  214512. that._update();
  214513. });
  214514. }
  214515. Object.defineProperties(CesiumInspectorViewModel.prototype, {
  214516. scene: {
  214517. get: function() {
  214518. return this._scene;
  214519. }
  214520. },
  214521. performanceContainer: {
  214522. get: function() {
  214523. return this._performanceContainer;
  214524. }
  214525. },
  214526. toggleDropDown: {
  214527. get: function() {
  214528. return this._toggleDropDown;
  214529. }
  214530. },
  214531. showPrimitiveBoundingSphere: {
  214532. get: function() {
  214533. return this._showPrimitiveBoundingSphere;
  214534. }
  214535. },
  214536. showPrimitiveReferenceFrame: {
  214537. get: function() {
  214538. return this._showPrimitiveReferenceFrame;
  214539. }
  214540. },
  214541. doFilterPrimitive: {
  214542. get: function() {
  214543. return this._doFilterPrimitive;
  214544. }
  214545. },
  214546. incrementDepthFrustum: {
  214547. get: function() {
  214548. return this._incrementDepthFrustum;
  214549. }
  214550. },
  214551. decrementDepthFrustum: {
  214552. get: function() {
  214553. return this._decrementDepthFrustum;
  214554. }
  214555. },
  214556. showTileCoordinates: {
  214557. get: function() {
  214558. return this._showTileCoordinates;
  214559. }
  214560. },
  214561. showTileBoundingSphere: {
  214562. get: function() {
  214563. return this._showTileBoundingSphere;
  214564. }
  214565. },
  214566. doFilterTile: {
  214567. get: function() {
  214568. return this._doFilterTile;
  214569. }
  214570. },
  214571. toggleGeneral: {
  214572. get: function() {
  214573. return this._toggleGeneral;
  214574. }
  214575. },
  214576. togglePrimitives: {
  214577. get: function() {
  214578. return this._togglePrimitives;
  214579. }
  214580. },
  214581. toggleTerrain: {
  214582. get: function() {
  214583. return this._toggleTerrain;
  214584. }
  214585. },
  214586. pickPrimitive: {
  214587. get: function() {
  214588. return this._pickPrimitive;
  214589. }
  214590. },
  214591. pickTile: {
  214592. get: function() {
  214593. return this._pickTile;
  214594. }
  214595. },
  214596. selectParent: {
  214597. get: function() {
  214598. const that = this;
  214599. return createCommand_default(function() {
  214600. that.tile = that.tile.parent;
  214601. });
  214602. }
  214603. },
  214604. selectNW: {
  214605. get: function() {
  214606. const that = this;
  214607. return createCommand_default(function() {
  214608. that.tile = that.tile.northwestChild;
  214609. });
  214610. }
  214611. },
  214612. selectNE: {
  214613. get: function() {
  214614. const that = this;
  214615. return createCommand_default(function() {
  214616. that.tile = that.tile.northeastChild;
  214617. });
  214618. }
  214619. },
  214620. selectSW: {
  214621. get: function() {
  214622. const that = this;
  214623. return createCommand_default(function() {
  214624. that.tile = that.tile.southwestChild;
  214625. });
  214626. }
  214627. },
  214628. selectSE: {
  214629. get: function() {
  214630. const that = this;
  214631. return createCommand_default(function() {
  214632. that.tile = that.tile.southeastChild;
  214633. });
  214634. }
  214635. },
  214636. primitive: {
  214637. get: function() {
  214638. return this._primitive;
  214639. },
  214640. set: function(newPrimitive) {
  214641. const oldPrimitive = this._primitive;
  214642. if (newPrimitive !== oldPrimitive) {
  214643. this.hasPickedPrimitive = true;
  214644. if (defined_default(oldPrimitive)) {
  214645. oldPrimitive.debugShowBoundingVolume = false;
  214646. }
  214647. this._scene.debugCommandFilter = void 0;
  214648. if (defined_default(this._modelMatrixPrimitive)) {
  214649. this._scene.primitives.remove(this._modelMatrixPrimitive);
  214650. this._modelMatrixPrimitive = void 0;
  214651. }
  214652. this._primitive = newPrimitive;
  214653. newPrimitive.show = false;
  214654. setTimeout(function() {
  214655. newPrimitive.show = true;
  214656. }, 50);
  214657. this.showPrimitiveBoundingSphere();
  214658. this.showPrimitiveReferenceFrame();
  214659. this.doFilterPrimitive();
  214660. }
  214661. }
  214662. },
  214663. tile: {
  214664. get: function() {
  214665. return this._tile;
  214666. },
  214667. set: function(newTile) {
  214668. if (defined_default(newTile)) {
  214669. this.hasPickedTile = true;
  214670. const oldTile = this._tile;
  214671. if (newTile !== oldTile) {
  214672. this.tileText = `L: ${newTile.level} X: ${newTile.x} Y: ${newTile.y}`;
  214673. this.tileText += `<br>SW corner: ${newTile.rectangle.west}, ${newTile.rectangle.south}`;
  214674. this.tileText += `<br>NE corner: ${newTile.rectangle.east}, ${newTile.rectangle.north}`;
  214675. const data = newTile.data;
  214676. if (defined_default(data) && defined_default(data.tileBoundingRegion)) {
  214677. this.tileText += `<br>Min: ${data.tileBoundingRegion.minimumHeight} Max: ${data.tileBoundingRegion.maximumHeight}`;
  214678. } else {
  214679. this.tileText += "<br>(Tile is not loaded)";
  214680. }
  214681. }
  214682. this._tile = newTile;
  214683. this.showTileBoundingSphere();
  214684. this.doFilterTile();
  214685. } else {
  214686. this.hasPickedTile = false;
  214687. this._tile = void 0;
  214688. }
  214689. }
  214690. }
  214691. });
  214692. CesiumInspectorViewModel.prototype._update = function() {
  214693. if (this.frustums) {
  214694. this.frustumStatisticText = frustumStatisticsToString(
  214695. this._scene.debugFrustumStatistics
  214696. );
  214697. }
  214698. const numberOfFrustums = this._scene.numberOfFrustums;
  214699. this._numberOfFrustums = numberOfFrustums;
  214700. this.depthFrustum = boundDepthFrustum(1, numberOfFrustums, this.depthFrustum);
  214701. this.depthFrustumText = `${this.depthFrustum} of ${numberOfFrustums}`;
  214702. if (this.performance) {
  214703. this._performanceDisplay.update();
  214704. }
  214705. if (this.primitiveReferenceFrame) {
  214706. this._modelMatrixPrimitive.modelMatrix = this._primitive.modelMatrix;
  214707. }
  214708. this.shaderCacheText = `Cached shaders: ${this._scene.context.shaderCache.numberOfShaders}`;
  214709. };
  214710. CesiumInspectorViewModel.prototype.isDestroyed = function() {
  214711. return false;
  214712. };
  214713. CesiumInspectorViewModel.prototype.destroy = function() {
  214714. this._eventHandler.destroy();
  214715. this._removePostRenderEvent();
  214716. this._frustumsSubscription.dispose();
  214717. this._frustumPlanesSubscription.dispose();
  214718. this._performanceSubscription.dispose();
  214719. this._primitiveBoundingSphereSubscription.dispose();
  214720. this._primitiveReferenceFrameSubscription.dispose();
  214721. this._filterPrimitiveSubscription.dispose();
  214722. this._wireframeSubscription.dispose();
  214723. this._depthFrustumSubscription.dispose();
  214724. this._suspendUpdatesSubscription.dispose();
  214725. this._tileCoordinatesSubscription.dispose();
  214726. this._tileBoundingSphereSubscription.dispose();
  214727. this._filterTileSubscription.dispose();
  214728. this._pickPrimitiveActiveSubscription.dispose();
  214729. this._pickTileActiveSubscription.dispose();
  214730. return destroyObject_default(this);
  214731. };
  214732. var CesiumInspectorViewModel_default = CesiumInspectorViewModel;
  214733. // node_modules/cesium/Source/Widgets/CesiumInspector/CesiumInspector.js
  214734. function CesiumInspector(container, scene) {
  214735. if (!defined_default(container)) {
  214736. throw new DeveloperError_default("container is required.");
  214737. }
  214738. if (!defined_default(scene)) {
  214739. throw new DeveloperError_default("scene is required.");
  214740. }
  214741. container = getElement_default(container);
  214742. const performanceContainer = document.createElement("div");
  214743. const viewModel = new CesiumInspectorViewModel_default(scene, performanceContainer);
  214744. this._viewModel = viewModel;
  214745. this._container = container;
  214746. const element = document.createElement("div");
  214747. this._element = element;
  214748. const text2 = document.createElement("div");
  214749. text2.textContent = "Cesium Inspector";
  214750. text2.className = "cesium-cesiumInspector-button";
  214751. text2.setAttribute("data-bind", "click: toggleDropDown");
  214752. element.appendChild(text2);
  214753. element.className = "cesium-cesiumInspector";
  214754. element.setAttribute(
  214755. "data-bind",
  214756. 'css: { "cesium-cesiumInspector-visible" : dropDownVisible, "cesium-cesiumInspector-hidden" : !dropDownVisible }'
  214757. );
  214758. container.appendChild(this._element);
  214759. const panel = document.createElement("div");
  214760. this._panel = panel;
  214761. panel.className = "cesium-cesiumInspector-dropDown";
  214762. element.appendChild(panel);
  214763. const createSection = InspectorShared_default.createSection;
  214764. const createCheckbox = InspectorShared_default.createCheckbox;
  214765. const generalSection = createSection(
  214766. panel,
  214767. "General",
  214768. "generalVisible",
  214769. "toggleGeneral"
  214770. );
  214771. const debugShowFrustums = createCheckbox("Show Frustums", "frustums");
  214772. const frustumStatistics = document.createElement("div");
  214773. frustumStatistics.className = "cesium-cesiumInspector-frustumStatistics";
  214774. frustumStatistics.setAttribute(
  214775. "data-bind",
  214776. "visible: frustums, html: frustumStatisticText"
  214777. );
  214778. debugShowFrustums.appendChild(frustumStatistics);
  214779. generalSection.appendChild(debugShowFrustums);
  214780. generalSection.appendChild(
  214781. createCheckbox("Show Frustum Planes", "frustumPlanes")
  214782. );
  214783. generalSection.appendChild(
  214784. createCheckbox("Performance Display", "performance")
  214785. );
  214786. performanceContainer.className = "cesium-cesiumInspector-performanceDisplay";
  214787. generalSection.appendChild(performanceContainer);
  214788. const shaderCacheDisplay = document.createElement("div");
  214789. shaderCacheDisplay.className = "cesium-cesiumInspector-shaderCache";
  214790. shaderCacheDisplay.setAttribute("data-bind", "html: shaderCacheText");
  214791. generalSection.appendChild(shaderCacheDisplay);
  214792. const depthFrustum = document.createElement("div");
  214793. generalSection.appendChild(depthFrustum);
  214794. const gLabel = document.createElement("span");
  214795. gLabel.setAttribute(
  214796. "data-bind",
  214797. 'html: "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Frustum:"'
  214798. );
  214799. depthFrustum.appendChild(gLabel);
  214800. const gText = document.createElement("span");
  214801. gText.setAttribute("data-bind", "text: depthFrustumText");
  214802. depthFrustum.appendChild(gText);
  214803. const gMinusButton = document.createElement("input");
  214804. gMinusButton.type = "button";
  214805. gMinusButton.value = "-";
  214806. gMinusButton.className = "cesium-cesiumInspector-pickButton";
  214807. gMinusButton.setAttribute("data-bind", "click: decrementDepthFrustum");
  214808. depthFrustum.appendChild(gMinusButton);
  214809. const gPlusButton = document.createElement("input");
  214810. gPlusButton.type = "button";
  214811. gPlusButton.value = "+";
  214812. gPlusButton.className = "cesium-cesiumInspector-pickButton";
  214813. gPlusButton.setAttribute("data-bind", "click: incrementDepthFrustum");
  214814. depthFrustum.appendChild(gPlusButton);
  214815. const primSection = createSection(
  214816. panel,
  214817. "Primitives",
  214818. "primitivesVisible",
  214819. "togglePrimitives"
  214820. );
  214821. const pickPrimRequired = document.createElement("div");
  214822. pickPrimRequired.className = "cesium-cesiumInspector-pickSection";
  214823. primSection.appendChild(pickPrimRequired);
  214824. const pickPrimitiveButton = document.createElement("input");
  214825. pickPrimitiveButton.type = "button";
  214826. pickPrimitiveButton.value = "Pick a primitive";
  214827. pickPrimitiveButton.className = "cesium-cesiumInspector-pickButton";
  214828. pickPrimitiveButton.setAttribute(
  214829. "data-bind",
  214830. 'css: {"cesium-cesiumInspector-pickButtonHighlight" : pickPrimitiveActive}, click: pickPrimitive'
  214831. );
  214832. let buttonWrap = document.createElement("div");
  214833. buttonWrap.className = "cesium-cesiumInspector-center";
  214834. buttonWrap.appendChild(pickPrimitiveButton);
  214835. pickPrimRequired.appendChild(buttonWrap);
  214836. pickPrimRequired.appendChild(
  214837. createCheckbox(
  214838. "Show bounding sphere",
  214839. "primitiveBoundingSphere",
  214840. "hasPickedPrimitive"
  214841. )
  214842. );
  214843. pickPrimRequired.appendChild(
  214844. createCheckbox(
  214845. "Show reference frame",
  214846. "primitiveReferenceFrame",
  214847. "hasPickedPrimitive"
  214848. )
  214849. );
  214850. this._primitiveOnly = createCheckbox(
  214851. "Show only selected",
  214852. "filterPrimitive",
  214853. "hasPickedPrimitive"
  214854. );
  214855. pickPrimRequired.appendChild(this._primitiveOnly);
  214856. const terrainSection = createSection(
  214857. panel,
  214858. "Terrain",
  214859. "terrainVisible",
  214860. "toggleTerrain"
  214861. );
  214862. const pickTileRequired = document.createElement("div");
  214863. pickTileRequired.className = "cesium-cesiumInspector-pickSection";
  214864. terrainSection.appendChild(pickTileRequired);
  214865. const pickTileButton = document.createElement("input");
  214866. pickTileButton.type = "button";
  214867. pickTileButton.value = "Pick a tile";
  214868. pickTileButton.className = "cesium-cesiumInspector-pickButton";
  214869. pickTileButton.setAttribute(
  214870. "data-bind",
  214871. 'css: {"cesium-cesiumInspector-pickButtonHighlight" : pickTileActive}, click: pickTile'
  214872. );
  214873. buttonWrap = document.createElement("div");
  214874. buttonWrap.appendChild(pickTileButton);
  214875. buttonWrap.className = "cesium-cesiumInspector-center";
  214876. pickTileRequired.appendChild(buttonWrap);
  214877. const tileInfo = document.createElement("div");
  214878. pickTileRequired.appendChild(tileInfo);
  214879. const parentTile = document.createElement("input");
  214880. parentTile.type = "button";
  214881. parentTile.value = "Parent";
  214882. parentTile.className = "cesium-cesiumInspector-pickButton";
  214883. parentTile.setAttribute("data-bind", "click: selectParent");
  214884. const nwTile = document.createElement("input");
  214885. nwTile.type = "button";
  214886. nwTile.value = "NW";
  214887. nwTile.className = "cesium-cesiumInspector-pickButton";
  214888. nwTile.setAttribute("data-bind", "click: selectNW");
  214889. const neTile = document.createElement("input");
  214890. neTile.type = "button";
  214891. neTile.value = "NE";
  214892. neTile.className = "cesium-cesiumInspector-pickButton";
  214893. neTile.setAttribute("data-bind", "click: selectNE");
  214894. const swTile = document.createElement("input");
  214895. swTile.type = "button";
  214896. swTile.value = "SW";
  214897. swTile.className = "cesium-cesiumInspector-pickButton";
  214898. swTile.setAttribute("data-bind", "click: selectSW");
  214899. const seTile = document.createElement("input");
  214900. seTile.type = "button";
  214901. seTile.value = "SE";
  214902. seTile.className = "cesium-cesiumInspector-pickButton";
  214903. seTile.setAttribute("data-bind", "click: selectSE");
  214904. const tileText = document.createElement("div");
  214905. tileText.className = "cesium-cesiumInspector-tileText";
  214906. tileInfo.className = "cesium-cesiumInspector-frustumStatistics";
  214907. tileInfo.appendChild(tileText);
  214908. tileInfo.setAttribute("data-bind", "visible: hasPickedTile");
  214909. tileText.setAttribute("data-bind", "html: tileText");
  214910. const relativeText = document.createElement("div");
  214911. relativeText.className = "cesium-cesiumInspector-relativeText";
  214912. relativeText.textContent = "Select relative:";
  214913. tileInfo.appendChild(relativeText);
  214914. const table2 = document.createElement("table");
  214915. const tr1 = document.createElement("tr");
  214916. const tr2 = document.createElement("tr");
  214917. const td1 = document.createElement("td");
  214918. td1.appendChild(parentTile);
  214919. const td2 = document.createElement("td");
  214920. td2.appendChild(nwTile);
  214921. const td3 = document.createElement("td");
  214922. td3.appendChild(neTile);
  214923. tr1.appendChild(td1);
  214924. tr1.appendChild(td2);
  214925. tr1.appendChild(td3);
  214926. const td4 = document.createElement("td");
  214927. const td5 = document.createElement("td");
  214928. td5.appendChild(swTile);
  214929. const td6 = document.createElement("td");
  214930. td6.appendChild(seTile);
  214931. tr2.appendChild(td4);
  214932. tr2.appendChild(td5);
  214933. tr2.appendChild(td6);
  214934. table2.appendChild(tr1);
  214935. table2.appendChild(tr2);
  214936. tileInfo.appendChild(table2);
  214937. pickTileRequired.appendChild(
  214938. createCheckbox(
  214939. "Show bounding volume",
  214940. "tileBoundingSphere",
  214941. "hasPickedTile"
  214942. )
  214943. );
  214944. pickTileRequired.appendChild(
  214945. createCheckbox("Show only selected", "filterTile", "hasPickedTile")
  214946. );
  214947. terrainSection.appendChild(createCheckbox("Wireframe", "wireframe"));
  214948. terrainSection.appendChild(
  214949. createCheckbox("Suspend LOD update", "suspendUpdates")
  214950. );
  214951. terrainSection.appendChild(
  214952. createCheckbox("Show tile coordinates", "tileCoordinates")
  214953. );
  214954. knockout_default.applyBindings(viewModel, this._element);
  214955. }
  214956. Object.defineProperties(CesiumInspector.prototype, {
  214957. container: {
  214958. get: function() {
  214959. return this._container;
  214960. }
  214961. },
  214962. viewModel: {
  214963. get: function() {
  214964. return this._viewModel;
  214965. }
  214966. }
  214967. });
  214968. CesiumInspector.prototype.isDestroyed = function() {
  214969. return false;
  214970. };
  214971. CesiumInspector.prototype.destroy = function() {
  214972. knockout_default.cleanNode(this._element);
  214973. this._container.removeChild(this._element);
  214974. this.viewModel.destroy();
  214975. return destroyObject_default(this);
  214976. };
  214977. var CesiumInspector_default = CesiumInspector;
  214978. // node_modules/cesium/Source/Widgets/CesiumWidget/CesiumWidget.js
  214979. function getDefaultSkyBoxUrl(suffix) {
  214980. return buildModuleUrl_default(`Assets/Textures/SkyBox/tycho2t3_80_${suffix}.jpg`);
  214981. }
  214982. function startRenderLoop(widget) {
  214983. widget._renderLoopRunning = true;
  214984. let lastFrameTime = 0;
  214985. function render2(frameTime) {
  214986. if (widget.isDestroyed()) {
  214987. return;
  214988. }
  214989. if (widget._useDefaultRenderLoop) {
  214990. try {
  214991. const targetFrameRate = widget._targetFrameRate;
  214992. if (!defined_default(targetFrameRate)) {
  214993. widget.resize();
  214994. widget.render();
  214995. requestAnimationFrame_default(render2);
  214996. } else {
  214997. const interval = 1e3 / targetFrameRate;
  214998. const delta = frameTime - lastFrameTime;
  214999. if (delta > interval) {
  215000. widget.resize();
  215001. widget.render();
  215002. lastFrameTime = frameTime - delta % interval;
  215003. }
  215004. requestAnimationFrame_default(render2);
  215005. }
  215006. } catch (error) {
  215007. widget._useDefaultRenderLoop = false;
  215008. widget._renderLoopRunning = false;
  215009. if (widget._showRenderLoopErrors) {
  215010. const title = "An error occurred while rendering. Rendering has stopped.";
  215011. widget.showErrorPanel(title, void 0, error);
  215012. }
  215013. }
  215014. } else {
  215015. widget._renderLoopRunning = false;
  215016. }
  215017. }
  215018. requestAnimationFrame_default(render2);
  215019. }
  215020. function configurePixelRatio(widget) {
  215021. let pixelRatio = widget._useBrowserRecommendedResolution ? 1 : window.devicePixelRatio;
  215022. pixelRatio *= widget._resolutionScale;
  215023. if (defined_default(widget._scene)) {
  215024. widget._scene.pixelRatio = pixelRatio;
  215025. }
  215026. return pixelRatio;
  215027. }
  215028. function configureCanvasSize(widget) {
  215029. const canvas = widget._canvas;
  215030. let width = canvas.clientWidth;
  215031. let height = canvas.clientHeight;
  215032. const pixelRatio = configurePixelRatio(widget);
  215033. widget._canvasClientWidth = width;
  215034. widget._canvasClientHeight = height;
  215035. width *= pixelRatio;
  215036. height *= pixelRatio;
  215037. canvas.width = width;
  215038. canvas.height = height;
  215039. widget._canRender = width !== 0 && height !== 0;
  215040. widget._lastDevicePixelRatio = window.devicePixelRatio;
  215041. }
  215042. function configureCameraFrustum(widget) {
  215043. const canvas = widget._canvas;
  215044. const width = canvas.width;
  215045. const height = canvas.height;
  215046. if (width !== 0 && height !== 0) {
  215047. const frustum = widget._scene.camera.frustum;
  215048. if (defined_default(frustum.aspectRatio)) {
  215049. frustum.aspectRatio = width / height;
  215050. } else {
  215051. frustum.top = frustum.right * (height / width);
  215052. frustum.bottom = -frustum.top;
  215053. }
  215054. }
  215055. }
  215056. function CesiumWidget(container, options) {
  215057. if (!defined_default(container)) {
  215058. throw new DeveloperError_default("container is required.");
  215059. }
  215060. container = getElement_default(container);
  215061. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  215062. const element = document.createElement("div");
  215063. element.className = "cesium-widget";
  215064. container.appendChild(element);
  215065. const canvas = document.createElement("canvas");
  215066. const supportsImageRenderingPixelated2 = FeatureDetection_default.supportsImageRenderingPixelated();
  215067. this._supportsImageRenderingPixelated = supportsImageRenderingPixelated2;
  215068. if (supportsImageRenderingPixelated2) {
  215069. canvas.style.imageRendering = FeatureDetection_default.imageRenderingValue();
  215070. }
  215071. canvas.oncontextmenu = function() {
  215072. return false;
  215073. };
  215074. canvas.onselectstart = function() {
  215075. return false;
  215076. };
  215077. function blurActiveElement() {
  215078. if (canvas !== canvas.ownerDocument.activeElement) {
  215079. canvas.ownerDocument.activeElement.blur();
  215080. }
  215081. }
  215082. canvas.addEventListener("mousedown", blurActiveElement);
  215083. canvas.addEventListener("pointerdown", blurActiveElement);
  215084. element.appendChild(canvas);
  215085. const innerCreditContainer = document.createElement("div");
  215086. innerCreditContainer.className = "cesium-widget-credits";
  215087. const creditContainer = defined_default(options.creditContainer) ? getElement_default(options.creditContainer) : element;
  215088. creditContainer.appendChild(innerCreditContainer);
  215089. const creditViewport = defined_default(options.creditViewport) ? getElement_default(options.creditViewport) : element;
  215090. const showRenderLoopErrors = defaultValue_default(options.showRenderLoopErrors, true);
  215091. const useBrowserRecommendedResolution = defaultValue_default(
  215092. options.useBrowserRecommendedResolution,
  215093. true
  215094. );
  215095. this._element = element;
  215096. this._container = container;
  215097. this._canvas = canvas;
  215098. this._canvasClientWidth = 0;
  215099. this._canvasClientHeight = 0;
  215100. this._lastDevicePixelRatio = 0;
  215101. this._creditViewport = creditViewport;
  215102. this._creditContainer = creditContainer;
  215103. this._innerCreditContainer = innerCreditContainer;
  215104. this._canRender = false;
  215105. this._renderLoopRunning = false;
  215106. this._showRenderLoopErrors = showRenderLoopErrors;
  215107. this._resolutionScale = 1;
  215108. this._useBrowserRecommendedResolution = useBrowserRecommendedResolution;
  215109. this._forceResize = false;
  215110. this._clock = defined_default(options.clock) ? options.clock : new Clock_default();
  215111. configureCanvasSize(this);
  215112. try {
  215113. const scene = new Scene_default({
  215114. canvas,
  215115. contextOptions: options.contextOptions,
  215116. creditContainer: innerCreditContainer,
  215117. creditViewport,
  215118. mapProjection: options.mapProjection,
  215119. orderIndependentTranslucency: options.orderIndependentTranslucency,
  215120. scene3DOnly: defaultValue_default(options.scene3DOnly, false),
  215121. shadows: options.shadows,
  215122. mapMode2D: options.mapMode2D,
  215123. requestRenderMode: options.requestRenderMode,
  215124. maximumRenderTimeChange: options.maximumRenderTimeChange,
  215125. depthPlaneEllipsoidOffset: options.depthPlaneEllipsoidOffset,
  215126. msaaSamples: options.msaaSamples
  215127. });
  215128. this._scene = scene;
  215129. scene.camera.constrainedAxis = Cartesian3_default.UNIT_Z;
  215130. configurePixelRatio(this);
  215131. configureCameraFrustum(this);
  215132. const ellipsoid = defaultValue_default(
  215133. scene.mapProjection.ellipsoid,
  215134. Ellipsoid_default.WGS84
  215135. );
  215136. let globe = options.globe;
  215137. if (!defined_default(globe)) {
  215138. globe = new Globe_default(ellipsoid);
  215139. }
  215140. if (globe !== false) {
  215141. scene.globe = globe;
  215142. scene.globe.shadows = defaultValue_default(
  215143. options.terrainShadows,
  215144. ShadowMode_default.RECEIVE_ONLY
  215145. );
  215146. }
  215147. let skyBox = options.skyBox;
  215148. if (!defined_default(skyBox)) {
  215149. skyBox = new SkyBox_default({
  215150. sources: {
  215151. positiveX: getDefaultSkyBoxUrl("px"),
  215152. negativeX: getDefaultSkyBoxUrl("mx"),
  215153. positiveY: getDefaultSkyBoxUrl("py"),
  215154. negativeY: getDefaultSkyBoxUrl("my"),
  215155. positiveZ: getDefaultSkyBoxUrl("pz"),
  215156. negativeZ: getDefaultSkyBoxUrl("mz")
  215157. }
  215158. });
  215159. }
  215160. if (skyBox !== false) {
  215161. scene.skyBox = skyBox;
  215162. scene.sun = new Sun_default();
  215163. scene.moon = new Moon_default();
  215164. }
  215165. let skyAtmosphere = options.skyAtmosphere;
  215166. if (!defined_default(skyAtmosphere)) {
  215167. skyAtmosphere = new SkyAtmosphere_default(ellipsoid);
  215168. }
  215169. if (skyAtmosphere !== false) {
  215170. scene.skyAtmosphere = skyAtmosphere;
  215171. }
  215172. let imageryProvider = options.globe === false ? false : options.imageryProvider;
  215173. if (!defined_default(imageryProvider)) {
  215174. imageryProvider = createWorldImagery_default();
  215175. }
  215176. if (imageryProvider !== false) {
  215177. scene.imageryLayers.addImageryProvider(imageryProvider);
  215178. }
  215179. if (defined_default(options.terrainProvider) && options.globe !== false) {
  215180. scene.terrainProvider = options.terrainProvider;
  215181. }
  215182. this._screenSpaceEventHandler = new ScreenSpaceEventHandler_default(canvas);
  215183. if (defined_default(options.sceneMode)) {
  215184. if (options.sceneMode === SceneMode_default.SCENE2D) {
  215185. this._scene.morphTo2D(0);
  215186. }
  215187. if (options.sceneMode === SceneMode_default.COLUMBUS_VIEW) {
  215188. this._scene.morphToColumbusView(0);
  215189. }
  215190. }
  215191. this._useDefaultRenderLoop = void 0;
  215192. this.useDefaultRenderLoop = defaultValue_default(
  215193. options.useDefaultRenderLoop,
  215194. true
  215195. );
  215196. this._targetFrameRate = void 0;
  215197. this.targetFrameRate = options.targetFrameRate;
  215198. const that = this;
  215199. this._onRenderError = function(scene2, error) {
  215200. that._useDefaultRenderLoop = false;
  215201. that._renderLoopRunning = false;
  215202. if (that._showRenderLoopErrors) {
  215203. const title = "An error occurred while rendering. Rendering has stopped.";
  215204. that.showErrorPanel(title, void 0, error);
  215205. }
  215206. };
  215207. scene.renderError.addEventListener(this._onRenderError);
  215208. } catch (error) {
  215209. if (showRenderLoopErrors) {
  215210. const title = "Error constructing CesiumWidget.";
  215211. const message = 'Visit <a href="http://get.webgl.org">http://get.webgl.org</a> to verify that your web browser and hardware support WebGL. Consider trying a different web browser or updating your video drivers. Detailed error information is below:';
  215212. this.showErrorPanel(title, message, error);
  215213. }
  215214. throw error;
  215215. }
  215216. }
  215217. Object.defineProperties(CesiumWidget.prototype, {
  215218. container: {
  215219. get: function() {
  215220. return this._container;
  215221. }
  215222. },
  215223. canvas: {
  215224. get: function() {
  215225. return this._canvas;
  215226. }
  215227. },
  215228. creditContainer: {
  215229. get: function() {
  215230. return this._creditContainer;
  215231. }
  215232. },
  215233. creditViewport: {
  215234. get: function() {
  215235. return this._creditViewport;
  215236. }
  215237. },
  215238. scene: {
  215239. get: function() {
  215240. return this._scene;
  215241. }
  215242. },
  215243. imageryLayers: {
  215244. get: function() {
  215245. return this._scene.imageryLayers;
  215246. }
  215247. },
  215248. terrainProvider: {
  215249. get: function() {
  215250. return this._scene.terrainProvider;
  215251. },
  215252. set: function(terrainProvider) {
  215253. this._scene.terrainProvider = terrainProvider;
  215254. }
  215255. },
  215256. camera: {
  215257. get: function() {
  215258. return this._scene.camera;
  215259. }
  215260. },
  215261. clock: {
  215262. get: function() {
  215263. return this._clock;
  215264. }
  215265. },
  215266. screenSpaceEventHandler: {
  215267. get: function() {
  215268. return this._screenSpaceEventHandler;
  215269. }
  215270. },
  215271. targetFrameRate: {
  215272. get: function() {
  215273. return this._targetFrameRate;
  215274. },
  215275. set: function(value) {
  215276. if (value <= 0) {
  215277. throw new DeveloperError_default(
  215278. "targetFrameRate must be greater than 0, or undefined."
  215279. );
  215280. }
  215281. this._targetFrameRate = value;
  215282. }
  215283. },
  215284. useDefaultRenderLoop: {
  215285. get: function() {
  215286. return this._useDefaultRenderLoop;
  215287. },
  215288. set: function(value) {
  215289. if (this._useDefaultRenderLoop !== value) {
  215290. this._useDefaultRenderLoop = value;
  215291. if (value && !this._renderLoopRunning) {
  215292. startRenderLoop(this);
  215293. }
  215294. }
  215295. }
  215296. },
  215297. resolutionScale: {
  215298. get: function() {
  215299. return this._resolutionScale;
  215300. },
  215301. set: function(value) {
  215302. if (value <= 0) {
  215303. throw new DeveloperError_default("resolutionScale must be greater than 0.");
  215304. }
  215305. if (this._resolutionScale !== value) {
  215306. this._resolutionScale = value;
  215307. this._forceResize = true;
  215308. }
  215309. }
  215310. },
  215311. useBrowserRecommendedResolution: {
  215312. get: function() {
  215313. return this._useBrowserRecommendedResolution;
  215314. },
  215315. set: function(value) {
  215316. if (this._useBrowserRecommendedResolution !== value) {
  215317. this._useBrowserRecommendedResolution = value;
  215318. this._forceResize = true;
  215319. }
  215320. }
  215321. }
  215322. });
  215323. CesiumWidget.prototype.showErrorPanel = function(title, message, error) {
  215324. const element = this._element;
  215325. const overlay = document.createElement("div");
  215326. overlay.className = "cesium-widget-errorPanel";
  215327. const content = document.createElement("div");
  215328. content.className = "cesium-widget-errorPanel-content";
  215329. overlay.appendChild(content);
  215330. const errorHeader = document.createElement("div");
  215331. errorHeader.className = "cesium-widget-errorPanel-header";
  215332. errorHeader.appendChild(document.createTextNode(title));
  215333. content.appendChild(errorHeader);
  215334. const errorPanelScroller = document.createElement("div");
  215335. errorPanelScroller.className = "cesium-widget-errorPanel-scroll";
  215336. content.appendChild(errorPanelScroller);
  215337. function resizeCallback() {
  215338. errorPanelScroller.style.maxHeight = `${Math.max(
  215339. Math.round(element.clientHeight * 0.9 - 100),
  215340. 30
  215341. )}px`;
  215342. }
  215343. resizeCallback();
  215344. if (defined_default(window.addEventListener)) {
  215345. window.addEventListener("resize", resizeCallback, false);
  215346. }
  215347. const hasMessage = defined_default(message);
  215348. const hasError = defined_default(error);
  215349. if (hasMessage || hasError) {
  215350. const errorMessage = document.createElement("div");
  215351. errorMessage.className = "cesium-widget-errorPanel-message";
  215352. errorPanelScroller.appendChild(errorMessage);
  215353. if (hasError) {
  215354. let errorDetails = formatError_default(error);
  215355. if (!hasMessage) {
  215356. if (typeof error === "string") {
  215357. error = new Error(error);
  215358. }
  215359. message = formatError_default({
  215360. name: error.name,
  215361. message: error.message
  215362. });
  215363. errorDetails = error.stack;
  215364. }
  215365. if (typeof console !== "undefined") {
  215366. console.error(`${title}
  215367. ${message}
  215368. ${errorDetails}`);
  215369. }
  215370. const errorMessageDetails = document.createElement("div");
  215371. errorMessageDetails.className = "cesium-widget-errorPanel-message-details collapsed";
  215372. const moreDetails = document.createElement("span");
  215373. moreDetails.className = "cesium-widget-errorPanel-more-details";
  215374. moreDetails.appendChild(document.createTextNode("See more..."));
  215375. errorMessageDetails.appendChild(moreDetails);
  215376. errorMessageDetails.onclick = function(e2) {
  215377. errorMessageDetails.removeChild(moreDetails);
  215378. errorMessageDetails.appendChild(document.createTextNode(errorDetails));
  215379. errorMessageDetails.className = "cesium-widget-errorPanel-message-details";
  215380. content.className = "cesium-widget-errorPanel-content expanded";
  215381. errorMessageDetails.onclick = void 0;
  215382. };
  215383. errorPanelScroller.appendChild(errorMessageDetails);
  215384. }
  215385. errorMessage.innerHTML = `<p>${message}</p>`;
  215386. }
  215387. const buttonPanel = document.createElement("div");
  215388. buttonPanel.className = "cesium-widget-errorPanel-buttonPanel";
  215389. content.appendChild(buttonPanel);
  215390. const okButton = document.createElement("button");
  215391. okButton.setAttribute("type", "button");
  215392. okButton.className = "cesium-button";
  215393. okButton.appendChild(document.createTextNode("OK"));
  215394. okButton.onclick = function() {
  215395. if (defined_default(resizeCallback) && defined_default(window.removeEventListener)) {
  215396. window.removeEventListener("resize", resizeCallback, false);
  215397. }
  215398. element.removeChild(overlay);
  215399. };
  215400. buttonPanel.appendChild(okButton);
  215401. element.appendChild(overlay);
  215402. };
  215403. CesiumWidget.prototype.isDestroyed = function() {
  215404. return false;
  215405. };
  215406. CesiumWidget.prototype.destroy = function() {
  215407. if (defined_default(this._scene)) {
  215408. this._scene.renderError.removeEventListener(this._onRenderError);
  215409. this._scene = this._scene.destroy();
  215410. }
  215411. this._container.removeChild(this._element);
  215412. this._creditContainer.removeChild(this._innerCreditContainer);
  215413. destroyObject_default(this);
  215414. };
  215415. CesiumWidget.prototype.resize = function() {
  215416. const canvas = this._canvas;
  215417. if (!this._forceResize && this._canvasClientWidth === canvas.clientWidth && this._canvasClientHeight === canvas.clientHeight && this._lastDevicePixelRatio === window.devicePixelRatio) {
  215418. return;
  215419. }
  215420. this._forceResize = false;
  215421. configureCanvasSize(this);
  215422. configureCameraFrustum(this);
  215423. this._scene.requestRender();
  215424. };
  215425. CesiumWidget.prototype.render = function() {
  215426. if (this._canRender) {
  215427. this._scene.initializeFrame();
  215428. const currentTime = this._clock.tick();
  215429. this._scene.render(currentTime);
  215430. } else {
  215431. this._clock.tick();
  215432. }
  215433. };
  215434. var CesiumWidget_default = CesiumWidget;
  215435. // node_modules/cesium/Source/Widgets/FullscreenButton/FullscreenButtonViewModel.js
  215436. function FullscreenButtonViewModel(fullscreenElement, container) {
  215437. if (!defined_default(container)) {
  215438. container = document.body;
  215439. }
  215440. container = getElement_default(container);
  215441. const that = this;
  215442. const tmpIsFullscreen = knockout_default.observable(Fullscreen_default.fullscreen);
  215443. const tmpIsEnabled = knockout_default.observable(Fullscreen_default.enabled);
  215444. const ownerDocument = container.ownerDocument;
  215445. this.isFullscreen = void 0;
  215446. knockout_default.defineProperty(this, "isFullscreen", {
  215447. get: function() {
  215448. return tmpIsFullscreen();
  215449. }
  215450. });
  215451. this.isFullscreenEnabled = void 0;
  215452. knockout_default.defineProperty(this, "isFullscreenEnabled", {
  215453. get: function() {
  215454. return tmpIsEnabled();
  215455. },
  215456. set: function(value) {
  215457. tmpIsEnabled(value && Fullscreen_default.enabled);
  215458. }
  215459. });
  215460. this.tooltip = void 0;
  215461. knockout_default.defineProperty(this, "tooltip", function() {
  215462. if (!this.isFullscreenEnabled) {
  215463. return "Full screen unavailable";
  215464. }
  215465. return tmpIsFullscreen() ? "Exit full screen" : "Full screen";
  215466. });
  215467. this._command = createCommand_default(function() {
  215468. if (Fullscreen_default.fullscreen) {
  215469. Fullscreen_default.exitFullscreen();
  215470. } else {
  215471. Fullscreen_default.requestFullscreen(that._fullscreenElement);
  215472. }
  215473. }, knockout_default.getObservable(this, "isFullscreenEnabled"));
  215474. this._fullscreenElement = defaultValue_default(
  215475. getElement_default(fullscreenElement),
  215476. ownerDocument.body
  215477. );
  215478. this._callback = function() {
  215479. tmpIsFullscreen(Fullscreen_default.fullscreen);
  215480. };
  215481. ownerDocument.addEventListener(Fullscreen_default.changeEventName, this._callback);
  215482. }
  215483. Object.defineProperties(FullscreenButtonViewModel.prototype, {
  215484. fullscreenElement: {
  215485. get: function() {
  215486. return this._fullscreenElement;
  215487. },
  215488. set: function(value) {
  215489. if (!(value instanceof Element)) {
  215490. throw new DeveloperError_default("value must be a valid Element.");
  215491. }
  215492. this._fullscreenElement = value;
  215493. }
  215494. },
  215495. command: {
  215496. get: function() {
  215497. return this._command;
  215498. }
  215499. }
  215500. });
  215501. FullscreenButtonViewModel.prototype.isDestroyed = function() {
  215502. return false;
  215503. };
  215504. FullscreenButtonViewModel.prototype.destroy = function() {
  215505. document.removeEventListener(Fullscreen_default.changeEventName, this._callback);
  215506. destroyObject_default(this);
  215507. };
  215508. var FullscreenButtonViewModel_default = FullscreenButtonViewModel;
  215509. // node_modules/cesium/Source/Widgets/FullscreenButton/FullscreenButton.js
  215510. var enterFullScreenPath = "M 83.96875 17.5625 L 83.96875 17.59375 L 76.65625 24.875 L 97.09375 24.96875 L 76.09375 45.96875 L 81.9375 51.8125 L 102.78125 30.9375 L 102.875 51.15625 L 110.15625 43.875 L 110.1875 17.59375 L 83.96875 17.5625 z M 44.125 17.59375 L 17.90625 17.625 L 17.9375 43.90625 L 25.21875 51.1875 L 25.3125 30.96875 L 46.15625 51.8125 L 52 45.96875 L 31 25 L 51.4375 24.90625 L 44.125 17.59375 z M 46.0625 76.03125 L 25.1875 96.875 L 25.09375 76.65625 L 17.8125 83.9375 L 17.8125 110.21875 L 44 110.25 L 51.3125 102.9375 L 30.90625 102.84375 L 51.875 81.875 L 46.0625 76.03125 z M 82 76.15625 L 76.15625 82 L 97.15625 103 L 76.71875 103.0625 L 84.03125 110.375 L 110.25 110.34375 L 110.21875 84.0625 L 102.9375 76.8125 L 102.84375 97 L 82 76.15625 z";
  215511. var exitFullScreenPath = "M 104.34375 17.5625 L 83.5 38.4375 L 83.40625 18.21875 L 76.125 25.5 L 76.09375 51.78125 L 102.3125 51.8125 L 102.3125 51.78125 L 109.625 44.5 L 89.1875 44.40625 L 110.1875 23.40625 L 104.34375 17.5625 z M 23.75 17.59375 L 17.90625 23.4375 L 38.90625 44.4375 L 18.5 44.53125 L 25.78125 51.8125 L 52 51.78125 L 51.96875 25.53125 L 44.6875 18.25 L 44.625 38.46875 L 23.75 17.59375 z M 25.6875 76.03125 L 18.375 83.3125 L 38.78125 83.40625 L 17.8125 104.40625 L 23.625 110.25 L 44.5 89.375 L 44.59375 109.59375 L 51.875 102.3125 L 51.875 76.0625 L 25.6875 76.03125 z M 102.375 76.15625 L 76.15625 76.1875 L 76.1875 102.4375 L 83.46875 109.71875 L 83.5625 89.53125 L 104.40625 110.375 L 110.25 104.53125 L 89.25 83.53125 L 109.6875 83.46875 L 102.375 76.15625 z";
  215512. function FullscreenButton(container, fullscreenElement) {
  215513. if (!defined_default(container)) {
  215514. throw new DeveloperError_default("container is required.");
  215515. }
  215516. container = getElement_default(container);
  215517. const viewModel = new FullscreenButtonViewModel_default(fullscreenElement, container);
  215518. viewModel._exitFullScreenPath = exitFullScreenPath;
  215519. viewModel._enterFullScreenPath = enterFullScreenPath;
  215520. const element = document.createElement("button");
  215521. element.type = "button";
  215522. element.className = "cesium-button cesium-fullscreenButton";
  215523. element.setAttribute(
  215524. "data-bind",
  215525. "attr: { title: tooltip },click: command,enable: isFullscreenEnabled,cesiumSvgPath: { path: isFullscreen ? _exitFullScreenPath : _enterFullScreenPath, width: 128, height: 128 }"
  215526. );
  215527. container.appendChild(element);
  215528. knockout_default.applyBindings(viewModel, element);
  215529. this._container = container;
  215530. this._viewModel = viewModel;
  215531. this._element = element;
  215532. }
  215533. Object.defineProperties(FullscreenButton.prototype, {
  215534. container: {
  215535. get: function() {
  215536. return this._container;
  215537. }
  215538. },
  215539. viewModel: {
  215540. get: function() {
  215541. return this._viewModel;
  215542. }
  215543. }
  215544. });
  215545. FullscreenButton.prototype.isDestroyed = function() {
  215546. return false;
  215547. };
  215548. FullscreenButton.prototype.destroy = function() {
  215549. this._viewModel.destroy();
  215550. knockout_default.cleanNode(this._element);
  215551. this._container.removeChild(this._element);
  215552. return destroyObject_default(this);
  215553. };
  215554. var FullscreenButton_default = FullscreenButton;
  215555. // node_modules/cesium/Source/Widgets/Geocoder/GeocoderViewModel.js
  215556. var DEFAULT_HEIGHT = 1e3;
  215557. function GeocoderViewModel(options) {
  215558. if (!defined_default(options) || !defined_default(options.scene)) {
  215559. throw new DeveloperError_default("options.scene is required.");
  215560. }
  215561. if (defined_default(options.geocoderServices)) {
  215562. this._geocoderServices = options.geocoderServices;
  215563. } else {
  215564. this._geocoderServices = [
  215565. new CartographicGeocoderService_default(),
  215566. new IonGeocoderService_default({ scene: options.scene })
  215567. ];
  215568. }
  215569. this._viewContainer = options.container;
  215570. this._scene = options.scene;
  215571. this._flightDuration = options.flightDuration;
  215572. this._searchText = "";
  215573. this._isSearchInProgress = false;
  215574. this._geocodePromise = void 0;
  215575. this._complete = new Event_default();
  215576. this._suggestions = [];
  215577. this._selectedSuggestion = void 0;
  215578. this._showSuggestions = true;
  215579. this._handleArrowDown = handleArrowDown;
  215580. this._handleArrowUp = handleArrowUp;
  215581. const that = this;
  215582. this._suggestionsVisible = knockout_default.pureComputed(function() {
  215583. const suggestions = knockout_default.getObservable(that, "_suggestions");
  215584. const suggestionsNotEmpty = suggestions().length > 0;
  215585. const showSuggestions = knockout_default.getObservable(that, "_showSuggestions")();
  215586. return suggestionsNotEmpty && showSuggestions;
  215587. });
  215588. this._searchCommand = createCommand_default(function(geocodeType) {
  215589. geocodeType = defaultValue_default(geocodeType, GeocodeType_default.SEARCH);
  215590. that._focusTextbox = false;
  215591. if (defined_default(that._selectedSuggestion)) {
  215592. that.activateSuggestion(that._selectedSuggestion);
  215593. return false;
  215594. }
  215595. that.hideSuggestions();
  215596. if (that.isSearchInProgress) {
  215597. cancelGeocode(that);
  215598. } else {
  215599. geocode(that, that._geocoderServices, geocodeType);
  215600. }
  215601. });
  215602. this.deselectSuggestion = function() {
  215603. that._selectedSuggestion = void 0;
  215604. };
  215605. this.handleKeyDown = function(data, event) {
  215606. const downKey = event.key === "ArrowDown" || event.key === "Down" || event.keyCode === 40;
  215607. const upKey = event.key === "ArrowUp" || event.key === "Up" || event.keyCode === 38;
  215608. if (downKey || upKey) {
  215609. event.preventDefault();
  215610. }
  215611. return true;
  215612. };
  215613. this.handleKeyUp = function(data, event) {
  215614. const downKey = event.key === "ArrowDown" || event.key === "Down" || event.keyCode === 40;
  215615. const upKey = event.key === "ArrowUp" || event.key === "Up" || event.keyCode === 38;
  215616. const enterKey = event.key === "Enter" || event.keyCode === 13;
  215617. if (upKey) {
  215618. handleArrowUp(that);
  215619. } else if (downKey) {
  215620. handleArrowDown(that);
  215621. } else if (enterKey) {
  215622. that._searchCommand();
  215623. }
  215624. return true;
  215625. };
  215626. this.activateSuggestion = function(data) {
  215627. that.hideSuggestions();
  215628. that._searchText = data.displayName;
  215629. const destination = data.destination;
  215630. clearSuggestions(that);
  215631. that.destinationFound(that, destination);
  215632. };
  215633. this.hideSuggestions = function() {
  215634. that._showSuggestions = false;
  215635. that._selectedSuggestion = void 0;
  215636. };
  215637. this.showSuggestions = function() {
  215638. that._showSuggestions = true;
  215639. };
  215640. this.handleMouseover = function(data, event) {
  215641. if (data !== that._selectedSuggestion) {
  215642. that._selectedSuggestion = data;
  215643. }
  215644. };
  215645. this.keepExpanded = false;
  215646. this.autoComplete = defaultValue_default(options.autocomplete, true);
  215647. this.destinationFound = defaultValue_default(
  215648. options.destinationFound,
  215649. GeocoderViewModel.flyToDestination
  215650. );
  215651. this._focusTextbox = false;
  215652. knockout_default.track(this, [
  215653. "_searchText",
  215654. "_isSearchInProgress",
  215655. "keepExpanded",
  215656. "_suggestions",
  215657. "_selectedSuggestion",
  215658. "_showSuggestions",
  215659. "_focusTextbox"
  215660. ]);
  215661. const searchTextObservable = knockout_default.getObservable(this, "_searchText");
  215662. searchTextObservable.extend({ rateLimit: { timeout: 500 } });
  215663. this._suggestionSubscription = searchTextObservable.subscribe(function() {
  215664. GeocoderViewModel._updateSearchSuggestions(that);
  215665. });
  215666. this.isSearchInProgress = void 0;
  215667. knockout_default.defineProperty(this, "isSearchInProgress", {
  215668. get: function() {
  215669. return this._isSearchInProgress;
  215670. }
  215671. });
  215672. this.searchText = void 0;
  215673. knockout_default.defineProperty(this, "searchText", {
  215674. get: function() {
  215675. if (this.isSearchInProgress) {
  215676. return "Searching...";
  215677. }
  215678. return this._searchText;
  215679. },
  215680. set: function(value) {
  215681. if (typeof value !== "string") {
  215682. throw new DeveloperError_default("value must be a valid string.");
  215683. }
  215684. this._searchText = value;
  215685. }
  215686. });
  215687. this.flightDuration = void 0;
  215688. knockout_default.defineProperty(this, "flightDuration", {
  215689. get: function() {
  215690. return this._flightDuration;
  215691. },
  215692. set: function(value) {
  215693. if (defined_default(value) && value < 0) {
  215694. throw new DeveloperError_default("value must be positive.");
  215695. }
  215696. this._flightDuration = value;
  215697. }
  215698. });
  215699. }
  215700. Object.defineProperties(GeocoderViewModel.prototype, {
  215701. complete: {
  215702. get: function() {
  215703. return this._complete;
  215704. }
  215705. },
  215706. scene: {
  215707. get: function() {
  215708. return this._scene;
  215709. }
  215710. },
  215711. search: {
  215712. get: function() {
  215713. return this._searchCommand;
  215714. }
  215715. },
  215716. selectedSuggestion: {
  215717. get: function() {
  215718. return this._selectedSuggestion;
  215719. }
  215720. },
  215721. suggestions: {
  215722. get: function() {
  215723. return this._suggestions;
  215724. }
  215725. }
  215726. });
  215727. GeocoderViewModel.prototype.destroy = function() {
  215728. this._suggestionSubscription.dispose();
  215729. };
  215730. function handleArrowUp(viewModel) {
  215731. if (viewModel._suggestions.length === 0) {
  215732. return;
  215733. }
  215734. const currentIndex = viewModel._suggestions.indexOf(
  215735. viewModel._selectedSuggestion
  215736. );
  215737. if (currentIndex === -1 || currentIndex === 0) {
  215738. viewModel._selectedSuggestion = void 0;
  215739. return;
  215740. }
  215741. const next = currentIndex - 1;
  215742. viewModel._selectedSuggestion = viewModel._suggestions[next];
  215743. GeocoderViewModel._adjustSuggestionsScroll(viewModel, next);
  215744. }
  215745. function handleArrowDown(viewModel) {
  215746. if (viewModel._suggestions.length === 0) {
  215747. return;
  215748. }
  215749. const numberOfSuggestions = viewModel._suggestions.length;
  215750. const currentIndex = viewModel._suggestions.indexOf(
  215751. viewModel._selectedSuggestion
  215752. );
  215753. const next = (currentIndex + 1) % numberOfSuggestions;
  215754. viewModel._selectedSuggestion = viewModel._suggestions[next];
  215755. GeocoderViewModel._adjustSuggestionsScroll(viewModel, next);
  215756. }
  215757. function computeFlyToLocationForCartographic(cartographic2, terrainProvider) {
  215758. const availability = defined_default(terrainProvider) ? terrainProvider.availability : void 0;
  215759. if (!defined_default(availability)) {
  215760. cartographic2.height += DEFAULT_HEIGHT;
  215761. return Promise.resolve(cartographic2);
  215762. }
  215763. return sampleTerrainMostDetailed_default(terrainProvider, [cartographic2]).then(
  215764. function(positionOnTerrain) {
  215765. cartographic2 = positionOnTerrain[0];
  215766. cartographic2.height += DEFAULT_HEIGHT;
  215767. return cartographic2;
  215768. }
  215769. );
  215770. }
  215771. function flyToDestination(viewModel, destination) {
  215772. const scene = viewModel._scene;
  215773. const mapProjection = scene.mapProjection;
  215774. const ellipsoid = mapProjection.ellipsoid;
  215775. const camera = scene.camera;
  215776. const terrainProvider = scene.terrainProvider;
  215777. let finalDestination = destination;
  215778. let promise;
  215779. if (destination instanceof Rectangle_default) {
  215780. if (Math_default.equalsEpsilon(
  215781. destination.south,
  215782. destination.north,
  215783. Math_default.EPSILON7
  215784. ) && Math_default.equalsEpsilon(
  215785. destination.east,
  215786. destination.west,
  215787. Math_default.EPSILON7
  215788. )) {
  215789. destination = Rectangle_default.center(destination);
  215790. } else {
  215791. promise = computeFlyToLocationForRectangle_default(destination, scene);
  215792. }
  215793. } else {
  215794. destination = ellipsoid.cartesianToCartographic(destination);
  215795. }
  215796. if (!defined_default(promise)) {
  215797. promise = computeFlyToLocationForCartographic(destination, terrainProvider);
  215798. }
  215799. return promise.then(function(result) {
  215800. finalDestination = ellipsoid.cartographicToCartesian(result);
  215801. }).finally(function() {
  215802. camera.flyTo({
  215803. destination: finalDestination,
  215804. complete: function() {
  215805. viewModel._complete.raiseEvent();
  215806. },
  215807. duration: viewModel._flightDuration,
  215808. endTransform: Matrix4_default.IDENTITY
  215809. });
  215810. });
  215811. }
  215812. function chainPromise(promise, geocoderService, query, geocodeType) {
  215813. return promise.then(function(result) {
  215814. if (defined_default(result) && result.state === "fulfilled" && result.value.length > 0) {
  215815. return result;
  215816. }
  215817. const nextPromise = geocoderService.geocode(query, geocodeType).then(function(result2) {
  215818. return { state: "fulfilled", value: result2 };
  215819. }).catch(function(err) {
  215820. return { state: "rejected", reason: err };
  215821. });
  215822. return nextPromise;
  215823. });
  215824. }
  215825. function geocode(viewModel, geocoderServices, geocodeType) {
  215826. const query = viewModel._searchText;
  215827. if (hasOnlyWhitespace(query)) {
  215828. viewModel.showSuggestions();
  215829. return;
  215830. }
  215831. viewModel._isSearchInProgress = true;
  215832. let promise = Promise.resolve();
  215833. for (let i2 = 0; i2 < geocoderServices.length; i2++) {
  215834. promise = chainPromise(promise, geocoderServices[i2], query, geocodeType);
  215835. }
  215836. viewModel._geocodePromise = promise;
  215837. promise.then(function(result) {
  215838. if (promise.cancel) {
  215839. return;
  215840. }
  215841. viewModel._isSearchInProgress = false;
  215842. const geocoderResults = result.value;
  215843. if (result.state === "fulfilled" && defined_default(geocoderResults) && geocoderResults.length > 0) {
  215844. viewModel._searchText = geocoderResults[0].displayName;
  215845. viewModel.destinationFound(viewModel, geocoderResults[0].destination);
  215846. return;
  215847. }
  215848. viewModel._searchText = `${query} (not found)`;
  215849. });
  215850. }
  215851. function adjustSuggestionsScroll(viewModel, focusedItemIndex) {
  215852. const container = getElement_default(viewModel._viewContainer);
  215853. const searchResults = container.getElementsByClassName("search-results")[0];
  215854. const listItems = container.getElementsByTagName("li");
  215855. const element = listItems[focusedItemIndex];
  215856. if (focusedItemIndex === 0) {
  215857. searchResults.scrollTop = 0;
  215858. return;
  215859. }
  215860. const offsetTop = element.offsetTop;
  215861. if (offsetTop + element.clientHeight > searchResults.clientHeight) {
  215862. searchResults.scrollTop = offsetTop + element.clientHeight;
  215863. } else if (offsetTop < searchResults.scrollTop) {
  215864. searchResults.scrollTop = offsetTop;
  215865. }
  215866. }
  215867. function cancelGeocode(viewModel) {
  215868. viewModel._isSearchInProgress = false;
  215869. if (defined_default(viewModel._geocodePromise)) {
  215870. viewModel._geocodePromise.cancel = true;
  215871. viewModel._geocodePromise = void 0;
  215872. }
  215873. }
  215874. function hasOnlyWhitespace(string) {
  215875. return /^\s*$/.test(string);
  215876. }
  215877. function clearSuggestions(viewModel) {
  215878. knockout_default.getObservable(viewModel, "_suggestions").removeAll();
  215879. }
  215880. function updateSearchSuggestions(viewModel) {
  215881. if (!viewModel.autoComplete) {
  215882. return;
  215883. }
  215884. const query = viewModel._searchText;
  215885. clearSuggestions(viewModel);
  215886. if (hasOnlyWhitespace(query)) {
  215887. return;
  215888. }
  215889. let promise = Promise.resolve([]);
  215890. viewModel._geocoderServices.forEach(function(service) {
  215891. promise = promise.then(function(results) {
  215892. if (results.length >= 5) {
  215893. return results;
  215894. }
  215895. return service.geocode(query, GeocodeType_default.AUTOCOMPLETE).then(function(newResults) {
  215896. results = results.concat(newResults);
  215897. return results;
  215898. });
  215899. });
  215900. });
  215901. return promise.then(function(results) {
  215902. const suggestions = viewModel._suggestions;
  215903. for (let i2 = 0; i2 < results.length; i2++) {
  215904. suggestions.push(results[i2]);
  215905. }
  215906. });
  215907. }
  215908. GeocoderViewModel.flyToDestination = flyToDestination;
  215909. GeocoderViewModel._updateSearchSuggestions = updateSearchSuggestions;
  215910. GeocoderViewModel._adjustSuggestionsScroll = adjustSuggestionsScroll;
  215911. var GeocoderViewModel_default = GeocoderViewModel;
  215912. // node_modules/cesium/Source/Widgets/Geocoder/Geocoder.js
  215913. var startSearchPath = "M29.772,26.433l-7.126-7.126c0.96-1.583,1.523-3.435,1.524-5.421C24.169,8.093,19.478,3.401,13.688,3.399C7.897,3.401,3.204,8.093,3.204,13.885c0,5.789,4.693,10.481,10.484,10.481c1.987,0,3.839-0.563,5.422-1.523l7.128,7.127L29.772,26.433zM7.203,13.885c0.006-3.582,2.903-6.478,6.484-6.486c3.579,0.008,6.478,2.904,6.484,6.486c-0.007,3.58-2.905,6.476-6.484,6.484C10.106,20.361,7.209,17.465,7.203,13.885z";
  215914. var stopSearchPath = "M24.778,21.419 19.276,15.917 24.777,10.415 21.949,7.585 16.447,13.087 10.945,7.585 8.117,10.415 13.618,15.917 8.116,21.419 10.946,24.248 16.447,18.746 21.948,24.248z";
  215915. function Geocoder(options) {
  215916. if (!defined_default(options) || !defined_default(options.container)) {
  215917. throw new DeveloperError_default("options.container is required.");
  215918. }
  215919. if (!defined_default(options.scene)) {
  215920. throw new DeveloperError_default("options.scene is required.");
  215921. }
  215922. const container = getElement_default(options.container);
  215923. const viewModel = new GeocoderViewModel_default(options);
  215924. viewModel._startSearchPath = startSearchPath;
  215925. viewModel._stopSearchPath = stopSearchPath;
  215926. const form = document.createElement("form");
  215927. form.setAttribute("data-bind", "submit: search");
  215928. const textBox = document.createElement("input");
  215929. textBox.type = "search";
  215930. textBox.className = "cesium-geocoder-input";
  215931. textBox.setAttribute("placeholder", "Enter an address or landmark...");
  215932. textBox.setAttribute(
  215933. "data-bind",
  215934. 'textInput: searchText,disable: isSearchInProgress,event: { keyup: handleKeyUp, keydown: handleKeyDown, mouseover: deselectSuggestion },css: { "cesium-geocoder-input-wide" : keepExpanded || searchText.length > 0 },hasFocus: _focusTextbox'
  215935. );
  215936. this._onTextBoxFocus = function() {
  215937. setTimeout(function() {
  215938. textBox.select();
  215939. }, 0);
  215940. };
  215941. textBox.addEventListener("focus", this._onTextBoxFocus, false);
  215942. form.appendChild(textBox);
  215943. this._textBox = textBox;
  215944. const searchButton = document.createElement("span");
  215945. searchButton.className = "cesium-geocoder-searchButton";
  215946. searchButton.setAttribute(
  215947. "data-bind",
  215948. "click: search,cesiumSvgPath: { path: isSearchInProgress ? _stopSearchPath : _startSearchPath, width: 32, height: 32 }"
  215949. );
  215950. form.appendChild(searchButton);
  215951. container.appendChild(form);
  215952. const searchSuggestionsContainer = document.createElement("div");
  215953. searchSuggestionsContainer.className = "search-results";
  215954. searchSuggestionsContainer.setAttribute(
  215955. "data-bind",
  215956. "visible: _suggestionsVisible"
  215957. );
  215958. const suggestionsList = document.createElement("ul");
  215959. suggestionsList.setAttribute("data-bind", "foreach: _suggestions");
  215960. const suggestions = document.createElement("li");
  215961. suggestionsList.appendChild(suggestions);
  215962. suggestions.setAttribute(
  215963. "data-bind",
  215964. "text: $data.displayName, click: $parent.activateSuggestion, event: { mouseover: $parent.handleMouseover}, css: { active: $data === $parent._selectedSuggestion }"
  215965. );
  215966. searchSuggestionsContainer.appendChild(suggestionsList);
  215967. container.appendChild(searchSuggestionsContainer);
  215968. knockout_default.applyBindings(viewModel, form);
  215969. knockout_default.applyBindings(viewModel, searchSuggestionsContainer);
  215970. this._container = container;
  215971. this._searchSuggestionsContainer = searchSuggestionsContainer;
  215972. this._viewModel = viewModel;
  215973. this._form = form;
  215974. this._onInputBegin = function(e2) {
  215975. let target = e2.target;
  215976. if (typeof e2.composedPath === "function") {
  215977. target = e2.composedPath()[0];
  215978. }
  215979. if (!container.contains(target)) {
  215980. viewModel._focusTextbox = false;
  215981. viewModel.hideSuggestions();
  215982. }
  215983. };
  215984. this._onInputEnd = function(e2) {
  215985. viewModel._focusTextbox = true;
  215986. viewModel.showSuggestions();
  215987. };
  215988. if (FeatureDetection_default.supportsPointerEvents()) {
  215989. document.addEventListener("pointerdown", this._onInputBegin, true);
  215990. container.addEventListener("pointerup", this._onInputEnd, true);
  215991. container.addEventListener("pointercancel", this._onInputEnd, true);
  215992. } else {
  215993. document.addEventListener("mousedown", this._onInputBegin, true);
  215994. container.addEventListener("mouseup", this._onInputEnd, true);
  215995. document.addEventListener("touchstart", this._onInputBegin, true);
  215996. container.addEventListener("touchend", this._onInputEnd, true);
  215997. container.addEventListener("touchcancel", this._onInputEnd, true);
  215998. }
  215999. }
  216000. Object.defineProperties(Geocoder.prototype, {
  216001. container: {
  216002. get: function() {
  216003. return this._container;
  216004. }
  216005. },
  216006. searchSuggestionsContainer: {
  216007. get: function() {
  216008. return this._searchSuggestionsContainer;
  216009. }
  216010. },
  216011. viewModel: {
  216012. get: function() {
  216013. return this._viewModel;
  216014. }
  216015. }
  216016. });
  216017. Geocoder.prototype.isDestroyed = function() {
  216018. return false;
  216019. };
  216020. Geocoder.prototype.destroy = function() {
  216021. const container = this._container;
  216022. if (FeatureDetection_default.supportsPointerEvents()) {
  216023. document.removeEventListener("pointerdown", this._onInputBegin, true);
  216024. container.removeEventListener("pointerup", this._onInputEnd, true);
  216025. } else {
  216026. document.removeEventListener("mousedown", this._onInputBegin, true);
  216027. container.removeEventListener("mouseup", this._onInputEnd, true);
  216028. document.removeEventListener("touchstart", this._onInputBegin, true);
  216029. container.removeEventListener("touchend", this._onInputEnd, true);
  216030. }
  216031. this._viewModel.destroy();
  216032. knockout_default.cleanNode(this._form);
  216033. knockout_default.cleanNode(this._searchSuggestionsContainer);
  216034. container.removeChild(this._form);
  216035. container.removeChild(this._searchSuggestionsContainer);
  216036. this._textBox.removeEventListener("focus", this._onTextBoxFocus, false);
  216037. return destroyObject_default(this);
  216038. };
  216039. var Geocoder_default = Geocoder;
  216040. // node_modules/cesium/Source/Widgets/HomeButton/HomeButtonViewModel.js
  216041. function HomeButtonViewModel(scene, duration) {
  216042. if (!defined_default(scene)) {
  216043. throw new DeveloperError_default("scene is required.");
  216044. }
  216045. this._scene = scene;
  216046. this._duration = duration;
  216047. const that = this;
  216048. this._command = createCommand_default(function() {
  216049. that._scene.camera.flyHome(that._duration);
  216050. });
  216051. this.tooltip = "View Home";
  216052. knockout_default.track(this, ["tooltip"]);
  216053. }
  216054. Object.defineProperties(HomeButtonViewModel.prototype, {
  216055. scene: {
  216056. get: function() {
  216057. return this._scene;
  216058. }
  216059. },
  216060. command: {
  216061. get: function() {
  216062. return this._command;
  216063. }
  216064. },
  216065. duration: {
  216066. get: function() {
  216067. return this._duration;
  216068. },
  216069. set: function(value) {
  216070. if (defined_default(value) && value < 0) {
  216071. throw new DeveloperError_default("value must be positive.");
  216072. }
  216073. this._duration = value;
  216074. }
  216075. }
  216076. });
  216077. var HomeButtonViewModel_default = HomeButtonViewModel;
  216078. // node_modules/cesium/Source/Widgets/HomeButton/HomeButton.js
  216079. function HomeButton(container, scene, duration) {
  216080. if (!defined_default(container)) {
  216081. throw new DeveloperError_default("container is required.");
  216082. }
  216083. container = getElement_default(container);
  216084. const viewModel = new HomeButtonViewModel_default(scene, duration);
  216085. viewModel._svgPath = "M14,4l-10,8.75h20l-4.25-3.7188v-4.6562h-2.812v2.1875l-2.938-2.5625zm-7.0938,9.906v10.094h14.094v-10.094h-14.094zm2.1876,2.313h3.3122v4.25h-3.3122v-4.25zm5.8442,1.281h3.406v6.438h-3.406v-6.438z";
  216086. const element = document.createElement("button");
  216087. element.type = "button";
  216088. element.className = "cesium-button cesium-toolbar-button cesium-home-button";
  216089. element.setAttribute(
  216090. "data-bind",
  216091. "attr: { title: tooltip },click: command,cesiumSvgPath: { path: _svgPath, width: 28, height: 28 }"
  216092. );
  216093. container.appendChild(element);
  216094. knockout_default.applyBindings(viewModel, element);
  216095. this._container = container;
  216096. this._viewModel = viewModel;
  216097. this._element = element;
  216098. }
  216099. Object.defineProperties(HomeButton.prototype, {
  216100. container: {
  216101. get: function() {
  216102. return this._container;
  216103. }
  216104. },
  216105. viewModel: {
  216106. get: function() {
  216107. return this._viewModel;
  216108. }
  216109. }
  216110. });
  216111. HomeButton.prototype.isDestroyed = function() {
  216112. return false;
  216113. };
  216114. HomeButton.prototype.destroy = function() {
  216115. knockout_default.cleanNode(this._element);
  216116. this._container.removeChild(this._element);
  216117. return destroyObject_default(this);
  216118. };
  216119. var HomeButton_default = HomeButton;
  216120. // node_modules/cesium/Source/Widgets/InfoBox/InfoBoxViewModel.js
  216121. var cameraEnabledPath = "M 13.84375 7.03125 C 11.412798 7.03125 9.46875 8.975298 9.46875 11.40625 L 9.46875 11.59375 L 2.53125 7.21875 L 2.53125 24.0625 L 9.46875 19.6875 C 9.4853444 22.104033 11.423165 24.0625 13.84375 24.0625 L 25.875 24.0625 C 28.305952 24.0625 30.28125 22.087202 30.28125 19.65625 L 30.28125 11.40625 C 30.28125 8.975298 28.305952 7.03125 25.875 7.03125 L 13.84375 7.03125 z";
  216122. var cameraDisabledPath = "M 27.34375 1.65625 L 5.28125 27.9375 L 8.09375 30.3125 L 30.15625 4.03125 L 27.34375 1.65625 z M 13.84375 7.03125 C 11.412798 7.03125 9.46875 8.975298 9.46875 11.40625 L 9.46875 11.59375 L 2.53125 7.21875 L 2.53125 24.0625 L 9.46875 19.6875 C 9.4724893 20.232036 9.5676108 20.7379 9.75 21.21875 L 21.65625 7.03125 L 13.84375 7.03125 z M 28.21875 7.71875 L 14.53125 24.0625 L 25.875 24.0625 C 28.305952 24.0625 30.28125 22.087202 30.28125 19.65625 L 30.28125 11.40625 C 30.28125 9.8371439 29.456025 8.4902779 28.21875 7.71875 z";
  216123. function InfoBoxViewModel() {
  216124. this._cameraClicked = new Event_default();
  216125. this._closeClicked = new Event_default();
  216126. this.maxHeight = 500;
  216127. this.enableCamera = false;
  216128. this.isCameraTracking = false;
  216129. this.showInfo = false;
  216130. this.titleText = "";
  216131. this.description = "";
  216132. knockout_default.track(this, [
  216133. "showInfo",
  216134. "titleText",
  216135. "description",
  216136. "maxHeight",
  216137. "enableCamera",
  216138. "isCameraTracking"
  216139. ]);
  216140. this._loadingIndicatorHtml = '<div class="cesium-infoBox-loadingContainer"><span class="cesium-infoBox-loading"></span></div>';
  216141. this.cameraIconPath = void 0;
  216142. knockout_default.defineProperty(this, "cameraIconPath", {
  216143. get: function() {
  216144. return !this.enableCamera || this.isCameraTracking ? cameraDisabledPath : cameraEnabledPath;
  216145. }
  216146. });
  216147. knockout_default.defineProperty(this, "_bodyless", {
  216148. get: function() {
  216149. return !defined_default(this.description) || this.description.length === 0;
  216150. }
  216151. });
  216152. }
  216153. InfoBoxViewModel.prototype.maxHeightOffset = function(offset2) {
  216154. return `${this.maxHeight - offset2}px`;
  216155. };
  216156. Object.defineProperties(InfoBoxViewModel.prototype, {
  216157. cameraClicked: {
  216158. get: function() {
  216159. return this._cameraClicked;
  216160. }
  216161. },
  216162. closeClicked: {
  216163. get: function() {
  216164. return this._closeClicked;
  216165. }
  216166. }
  216167. });
  216168. var InfoBoxViewModel_default = InfoBoxViewModel;
  216169. // node_modules/cesium/Source/Widgets/InfoBox/InfoBox.js
  216170. function InfoBox(container) {
  216171. Check_default.defined("container", container);
  216172. container = getElement_default(container);
  216173. const infoElement = document.createElement("div");
  216174. infoElement.className = "cesium-infoBox";
  216175. infoElement.setAttribute(
  216176. "data-bind",
  216177. 'css: { "cesium-infoBox-visible" : showInfo, "cesium-infoBox-bodyless" : _bodyless }'
  216178. );
  216179. container.appendChild(infoElement);
  216180. const titleElement = document.createElement("div");
  216181. titleElement.className = "cesium-infoBox-title";
  216182. titleElement.setAttribute("data-bind", "text: titleText");
  216183. infoElement.appendChild(titleElement);
  216184. const cameraElement = document.createElement("button");
  216185. cameraElement.type = "button";
  216186. cameraElement.className = "cesium-button cesium-infoBox-camera";
  216187. cameraElement.setAttribute(
  216188. "data-bind",
  216189. 'attr: { title: "Focus camera on object" },click: function () { cameraClicked.raiseEvent(this); },enable: enableCamera,cesiumSvgPath: { path: cameraIconPath, width: 32, height: 32 }'
  216190. );
  216191. infoElement.appendChild(cameraElement);
  216192. const closeElement = document.createElement("button");
  216193. closeElement.type = "button";
  216194. closeElement.className = "cesium-infoBox-close";
  216195. closeElement.setAttribute(
  216196. "data-bind",
  216197. "click: function () { closeClicked.raiseEvent(this); }"
  216198. );
  216199. closeElement.innerHTML = "&times;";
  216200. infoElement.appendChild(closeElement);
  216201. const frame = document.createElement("iframe");
  216202. frame.className = "cesium-infoBox-iframe";
  216203. frame.setAttribute("sandbox", "allow-same-origin allow-popups allow-forms");
  216204. frame.setAttribute(
  216205. "data-bind",
  216206. "style : { maxHeight : maxHeightOffset(40) }"
  216207. );
  216208. frame.setAttribute("allowfullscreen", true);
  216209. infoElement.appendChild(frame);
  216210. const viewModel = new InfoBoxViewModel_default();
  216211. knockout_default.applyBindings(viewModel, infoElement);
  216212. this._container = container;
  216213. this._element = infoElement;
  216214. this._frame = frame;
  216215. this._viewModel = viewModel;
  216216. this._descriptionSubscription = void 0;
  216217. const that = this;
  216218. frame.addEventListener("load", function() {
  216219. const frameDocument = frame.contentDocument;
  216220. const cssLink = frameDocument.createElement("link");
  216221. cssLink.href = buildModuleUrl_default("Widgets/InfoBox/InfoBoxDescription.css");
  216222. cssLink.rel = "stylesheet";
  216223. cssLink.type = "text/css";
  216224. const frameContent = frameDocument.createElement("div");
  216225. frameContent.className = "cesium-infoBox-description";
  216226. frameDocument.head.appendChild(cssLink);
  216227. frameDocument.body.appendChild(frameContent);
  216228. that._descriptionSubscription = subscribeAndEvaluate_default(
  216229. viewModel,
  216230. "description",
  216231. function(value) {
  216232. frame.style.height = "5px";
  216233. frameContent.innerHTML = value;
  216234. let background = null;
  216235. const firstElementChild = frameContent.firstElementChild;
  216236. if (firstElementChild !== null && frameContent.childNodes.length === 1) {
  216237. const style = window.getComputedStyle(firstElementChild);
  216238. if (style !== null) {
  216239. const backgroundColor = style["background-color"];
  216240. const color = Color_default.fromCssColorString(backgroundColor);
  216241. if (defined_default(color) && color.alpha !== 0) {
  216242. background = style["background-color"];
  216243. }
  216244. }
  216245. }
  216246. infoElement.style["background-color"] = background;
  216247. const height = frameContent.getBoundingClientRect().height;
  216248. frame.style.height = `${height}px`;
  216249. }
  216250. );
  216251. });
  216252. frame.setAttribute("src", "about:blank");
  216253. }
  216254. Object.defineProperties(InfoBox.prototype, {
  216255. container: {
  216256. get: function() {
  216257. return this._container;
  216258. }
  216259. },
  216260. viewModel: {
  216261. get: function() {
  216262. return this._viewModel;
  216263. }
  216264. },
  216265. frame: {
  216266. get: function() {
  216267. return this._frame;
  216268. }
  216269. }
  216270. });
  216271. InfoBox.prototype.isDestroyed = function() {
  216272. return false;
  216273. };
  216274. InfoBox.prototype.destroy = function() {
  216275. const container = this._container;
  216276. knockout_default.cleanNode(this._element);
  216277. container.removeChild(this._element);
  216278. if (defined_default(this._descriptionSubscription)) {
  216279. this._descriptionSubscription.dispose();
  216280. }
  216281. return destroyObject_default(this);
  216282. };
  216283. var InfoBox_default = InfoBox;
  216284. // node_modules/cesium/Source/Widgets/NavigationHelpButton/NavigationHelpButtonViewModel.js
  216285. function NavigationHelpButtonViewModel() {
  216286. this.showInstructions = false;
  216287. const that = this;
  216288. this._command = createCommand_default(function() {
  216289. that.showInstructions = !that.showInstructions;
  216290. });
  216291. this._showClick = createCommand_default(function() {
  216292. that._touch = false;
  216293. });
  216294. this._showTouch = createCommand_default(function() {
  216295. that._touch = true;
  216296. });
  216297. this._touch = false;
  216298. this.tooltip = "Navigation Instructions";
  216299. knockout_default.track(this, ["tooltip", "showInstructions", "_touch"]);
  216300. }
  216301. Object.defineProperties(NavigationHelpButtonViewModel.prototype, {
  216302. command: {
  216303. get: function() {
  216304. return this._command;
  216305. }
  216306. },
  216307. showClick: {
  216308. get: function() {
  216309. return this._showClick;
  216310. }
  216311. },
  216312. showTouch: {
  216313. get: function() {
  216314. return this._showTouch;
  216315. }
  216316. }
  216317. });
  216318. var NavigationHelpButtonViewModel_default = NavigationHelpButtonViewModel;
  216319. // node_modules/cesium/Source/Widgets/NavigationHelpButton/NavigationHelpButton.js
  216320. function NavigationHelpButton(options) {
  216321. if (!defined_default(options) || !defined_default(options.container)) {
  216322. throw new DeveloperError_default("options.container is required.");
  216323. }
  216324. const container = getElement_default(options.container);
  216325. const viewModel = new NavigationHelpButtonViewModel_default();
  216326. const showInsructionsDefault = defaultValue_default(
  216327. options.instructionsInitiallyVisible,
  216328. false
  216329. );
  216330. viewModel.showInstructions = showInsructionsDefault;
  216331. viewModel._svgPath = "M16,1.466C7.973,1.466,1.466,7.973,1.466,16c0,8.027,6.507,14.534,14.534,14.534c8.027,0,14.534-6.507,14.534-14.534C30.534,7.973,24.027,1.466,16,1.466z M17.328,24.371h-2.707v-2.596h2.707V24.371zM17.328,19.003v0.858h-2.707v-1.057c0-3.19,3.63-3.696,3.63-5.963c0-1.034-0.924-1.826-2.134-1.826c-1.254,0-2.354,0.924-2.354,0.924l-1.541-1.915c0,0,1.519-1.584,4.137-1.584c2.487,0,4.796,1.54,4.796,4.136C21.156,16.208,17.328,16.627,17.328,19.003z";
  216332. const wrapper = document.createElement("span");
  216333. wrapper.className = "cesium-navigationHelpButton-wrapper";
  216334. container.appendChild(wrapper);
  216335. const button = document.createElement("button");
  216336. button.type = "button";
  216337. button.className = "cesium-button cesium-toolbar-button cesium-navigation-help-button";
  216338. button.setAttribute(
  216339. "data-bind",
  216340. "attr: { title: tooltip },click: command,cesiumSvgPath: { path: _svgPath, width: 32, height: 32 }"
  216341. );
  216342. wrapper.appendChild(button);
  216343. const instructionContainer = document.createElement("div");
  216344. instructionContainer.className = "cesium-navigation-help";
  216345. instructionContainer.setAttribute(
  216346. "data-bind",
  216347. 'css: { "cesium-navigation-help-visible" : showInstructions}'
  216348. );
  216349. wrapper.appendChild(instructionContainer);
  216350. const mouseButton = document.createElement("button");
  216351. mouseButton.type = "button";
  216352. mouseButton.className = "cesium-navigation-button cesium-navigation-button-left";
  216353. mouseButton.setAttribute(
  216354. "data-bind",
  216355. 'click: showClick, css: {"cesium-navigation-button-selected": !_touch, "cesium-navigation-button-unselected": _touch}'
  216356. );
  216357. const mouseIcon = document.createElement("img");
  216358. mouseIcon.src = buildModuleUrl_default("Widgets/Images/NavigationHelp/Mouse.svg");
  216359. mouseIcon.className = "cesium-navigation-button-icon";
  216360. mouseIcon.style.width = "25px";
  216361. mouseIcon.style.height = "25px";
  216362. mouseButton.appendChild(mouseIcon);
  216363. mouseButton.appendChild(document.createTextNode("Mouse"));
  216364. const touchButton = document.createElement("button");
  216365. touchButton.type = "button";
  216366. touchButton.className = "cesium-navigation-button cesium-navigation-button-right";
  216367. touchButton.setAttribute(
  216368. "data-bind",
  216369. 'click: showTouch, css: {"cesium-navigation-button-selected": _touch, "cesium-navigation-button-unselected": !_touch}'
  216370. );
  216371. const touchIcon = document.createElement("img");
  216372. touchIcon.src = buildModuleUrl_default("Widgets/Images/NavigationHelp/Touch.svg");
  216373. touchIcon.className = "cesium-navigation-button-icon";
  216374. touchIcon.style.width = "25px";
  216375. touchIcon.style.height = "25px";
  216376. touchButton.appendChild(touchIcon);
  216377. touchButton.appendChild(document.createTextNode("Touch"));
  216378. instructionContainer.appendChild(mouseButton);
  216379. instructionContainer.appendChild(touchButton);
  216380. const clickInstructions = document.createElement("div");
  216381. clickInstructions.className = "cesium-click-navigation-help cesium-navigation-help-instructions";
  216382. clickInstructions.setAttribute(
  216383. "data-bind",
  216384. 'css: { "cesium-click-navigation-help-visible" : !_touch}'
  216385. );
  216386. clickInstructions.innerHTML = ` <table> <tr> <td><img src="${buildModuleUrl_default(
  216387. "Widgets/Images/NavigationHelp/MouseLeft.svg"
  216388. )}" width="48" height="48" /></td> <td> <div class="cesium-navigation-help-pan">Pan view</div> <div class="cesium-navigation-help-details">Left click + drag</div> </td> </tr> <tr> <td><img src="${buildModuleUrl_default(
  216389. "Widgets/Images/NavigationHelp/MouseRight.svg"
  216390. )}" width="48" height="48" /></td> <td> <div class="cesium-navigation-help-zoom">Zoom view</div> <div class="cesium-navigation-help-details">Right click + drag, or</div> <div class="cesium-navigation-help-details">Mouse wheel scroll</div> </td> </tr> <tr> <td><img src="${buildModuleUrl_default(
  216391. "Widgets/Images/NavigationHelp/MouseMiddle.svg"
  216392. )}" width="48" height="48" /></td> <td> <div class="cesium-navigation-help-rotate">Rotate view</div> <div class="cesium-navigation-help-details">Middle click + drag, or</div> <div class="cesium-navigation-help-details">CTRL + Left/Right click + drag</div> </td> </tr> </table>`;
  216393. instructionContainer.appendChild(clickInstructions);
  216394. const touchInstructions = document.createElement("div");
  216395. touchInstructions.className = "cesium-touch-navigation-help cesium-navigation-help-instructions";
  216396. touchInstructions.setAttribute(
  216397. "data-bind",
  216398. 'css: { "cesium-touch-navigation-help-visible" : _touch}'
  216399. );
  216400. touchInstructions.innerHTML = ` <table> <tr> <td><img src="${buildModuleUrl_default(
  216401. "Widgets/Images/NavigationHelp/TouchDrag.svg"
  216402. )}" width="70" height="48" /></td> <td> <div class="cesium-navigation-help-pan">Pan view</div> <div class="cesium-navigation-help-details">One finger drag</div> </td> </tr> <tr> <td><img src="${buildModuleUrl_default(
  216403. "Widgets/Images/NavigationHelp/TouchZoom.svg"
  216404. )}" width="70" height="48" /></td> <td> <div class="cesium-navigation-help-zoom">Zoom view</div> <div class="cesium-navigation-help-details">Two finger pinch</div> </td> </tr> <tr> <td><img src="${buildModuleUrl_default(
  216405. "Widgets/Images/NavigationHelp/TouchTilt.svg"
  216406. )}" width="70" height="48" /></td> <td> <div class="cesium-navigation-help-rotate">Tilt view</div> <div class="cesium-navigation-help-details">Two finger drag, same direction</div> </td> </tr> <tr> <td><img src="${buildModuleUrl_default(
  216407. "Widgets/Images/NavigationHelp/TouchRotate.svg"
  216408. )}" width="70" height="48" /></td> <td> <div class="cesium-navigation-help-tilt">Rotate view</div> <div class="cesium-navigation-help-details">Two finger drag, opposite direction</div> </td> </tr> </table>`;
  216409. instructionContainer.appendChild(touchInstructions);
  216410. knockout_default.applyBindings(viewModel, wrapper);
  216411. this._container = container;
  216412. this._viewModel = viewModel;
  216413. this._wrapper = wrapper;
  216414. this._closeInstructions = function(e2) {
  216415. if (!wrapper.contains(e2.target)) {
  216416. viewModel.showInstructions = false;
  216417. }
  216418. };
  216419. if (FeatureDetection_default.supportsPointerEvents()) {
  216420. document.addEventListener("pointerdown", this._closeInstructions, true);
  216421. } else {
  216422. document.addEventListener("mousedown", this._closeInstructions, true);
  216423. document.addEventListener("touchstart", this._closeInstructions, true);
  216424. }
  216425. }
  216426. Object.defineProperties(NavigationHelpButton.prototype, {
  216427. container: {
  216428. get: function() {
  216429. return this._container;
  216430. }
  216431. },
  216432. viewModel: {
  216433. get: function() {
  216434. return this._viewModel;
  216435. }
  216436. }
  216437. });
  216438. NavigationHelpButton.prototype.isDestroyed = function() {
  216439. return false;
  216440. };
  216441. NavigationHelpButton.prototype.destroy = function() {
  216442. if (FeatureDetection_default.supportsPointerEvents()) {
  216443. document.removeEventListener("pointerdown", this._closeInstructions, true);
  216444. } else {
  216445. document.removeEventListener("mousedown", this._closeInstructions, true);
  216446. document.removeEventListener("touchstart", this._closeInstructions, true);
  216447. }
  216448. knockout_default.cleanNode(this._wrapper);
  216449. this._container.removeChild(this._wrapper);
  216450. return destroyObject_default(this);
  216451. };
  216452. var NavigationHelpButton_default = NavigationHelpButton;
  216453. // node_modules/cesium/Source/Widgets/PerformanceWatchdog/PerformanceWatchdogViewModel.js
  216454. function PerformanceWatchdogViewModel(options) {
  216455. if (!defined_default(options) || !defined_default(options.scene)) {
  216456. throw new DeveloperError_default("options.scene is required.");
  216457. }
  216458. this._scene = options.scene;
  216459. this.lowFrameRateMessage = defaultValue_default(
  216460. options.lowFrameRateMessage,
  216461. "This application appears to be performing poorly on your system. Please try using a different web browser or updating your video drivers."
  216462. );
  216463. this.lowFrameRateMessageDismissed = false;
  216464. this.showingLowFrameRateMessage = false;
  216465. knockout_default.track(this, [
  216466. "lowFrameRateMessage",
  216467. "lowFrameRateMessageDismissed",
  216468. "showingLowFrameRateMessage"
  216469. ]);
  216470. const that = this;
  216471. this._dismissMessage = createCommand_default(function() {
  216472. that.showingLowFrameRateMessage = false;
  216473. that.lowFrameRateMessageDismissed = true;
  216474. });
  216475. const monitor = FrameRateMonitor_default.fromScene(options.scene);
  216476. this._unsubscribeLowFrameRate = monitor.lowFrameRate.addEventListener(
  216477. function() {
  216478. if (!that.lowFrameRateMessageDismissed) {
  216479. that.showingLowFrameRateMessage = true;
  216480. }
  216481. }
  216482. );
  216483. this._unsubscribeNominalFrameRate = monitor.nominalFrameRate.addEventListener(
  216484. function() {
  216485. that.showingLowFrameRateMessage = false;
  216486. }
  216487. );
  216488. }
  216489. Object.defineProperties(PerformanceWatchdogViewModel.prototype, {
  216490. scene: {
  216491. get: function() {
  216492. return this._scene;
  216493. }
  216494. },
  216495. dismissMessage: {
  216496. get: function() {
  216497. return this._dismissMessage;
  216498. }
  216499. }
  216500. });
  216501. PerformanceWatchdogViewModel.prototype.destroy = function() {
  216502. this._unsubscribeLowFrameRate();
  216503. this._unsubscribeNominalFrameRate();
  216504. return destroyObject_default(this);
  216505. };
  216506. var PerformanceWatchdogViewModel_default = PerformanceWatchdogViewModel;
  216507. // node_modules/cesium/Source/Widgets/PerformanceWatchdog/PerformanceWatchdog.js
  216508. function PerformanceWatchdog(options) {
  216509. if (!defined_default(options) || !defined_default(options.container)) {
  216510. throw new DeveloperError_default("options.container is required.");
  216511. }
  216512. if (!defined_default(options.scene)) {
  216513. throw new DeveloperError_default("options.scene is required.");
  216514. }
  216515. const container = getElement_default(options.container);
  216516. const viewModel = new PerformanceWatchdogViewModel_default(options);
  216517. const element = document.createElement("div");
  216518. element.className = "cesium-performance-watchdog-message-area";
  216519. element.setAttribute("data-bind", "visible: showingLowFrameRateMessage");
  216520. const dismissButton = document.createElement("button");
  216521. dismissButton.setAttribute("type", "button");
  216522. dismissButton.className = "cesium-performance-watchdog-message-dismiss";
  216523. dismissButton.innerHTML = "&times;";
  216524. dismissButton.setAttribute("data-bind", "click: dismissMessage");
  216525. element.appendChild(dismissButton);
  216526. const message = document.createElement("div");
  216527. message.className = "cesium-performance-watchdog-message";
  216528. message.setAttribute("data-bind", "html: lowFrameRateMessage");
  216529. element.appendChild(message);
  216530. container.appendChild(element);
  216531. knockout_default.applyBindings(viewModel, element);
  216532. this._container = container;
  216533. this._viewModel = viewModel;
  216534. this._element = element;
  216535. }
  216536. Object.defineProperties(PerformanceWatchdog.prototype, {
  216537. container: {
  216538. get: function() {
  216539. return this._container;
  216540. }
  216541. },
  216542. viewModel: {
  216543. get: function() {
  216544. return this._viewModel;
  216545. }
  216546. }
  216547. });
  216548. PerformanceWatchdog.prototype.isDestroyed = function() {
  216549. return false;
  216550. };
  216551. PerformanceWatchdog.prototype.destroy = function() {
  216552. this._viewModel.destroy();
  216553. knockout_default.cleanNode(this._element);
  216554. this._container.removeChild(this._element);
  216555. return destroyObject_default(this);
  216556. };
  216557. var PerformanceWatchdog_default = PerformanceWatchdog;
  216558. // node_modules/cesium/Source/Widgets/ProjectionPicker/ProjectionPickerViewModel.js
  216559. function ProjectionPickerViewModel(scene) {
  216560. if (!defined_default(scene)) {
  216561. throw new DeveloperError_default("scene is required.");
  216562. }
  216563. this._scene = scene;
  216564. this._orthographic = scene.camera.frustum instanceof OrthographicFrustum_default;
  216565. this._flightInProgress = false;
  216566. this.dropDownVisible = false;
  216567. this.tooltipPerspective = "Perspective Projection";
  216568. this.tooltipOrthographic = "Orthographic Projection";
  216569. this.selectedTooltip = void 0;
  216570. this.sceneMode = scene.mode;
  216571. knockout_default.track(this, [
  216572. "_orthographic",
  216573. "_flightInProgress",
  216574. "sceneMode",
  216575. "dropDownVisible",
  216576. "tooltipPerspective",
  216577. "tooltipOrthographic"
  216578. ]);
  216579. const that = this;
  216580. knockout_default.defineProperty(this, "selectedTooltip", function() {
  216581. if (that._orthographic) {
  216582. return that.tooltipOrthographic;
  216583. }
  216584. return that.tooltipPerspective;
  216585. });
  216586. this._toggleDropDown = createCommand_default(function() {
  216587. if (that.sceneMode === SceneMode_default.SCENE2D || that._flightInProgress) {
  216588. return;
  216589. }
  216590. that.dropDownVisible = !that.dropDownVisible;
  216591. });
  216592. this._eventHelper = new EventHelper_default();
  216593. this._eventHelper.add(scene.morphComplete, function(transitioner, oldMode, newMode, isMorphing) {
  216594. that.sceneMode = newMode;
  216595. that._orthographic = newMode === SceneMode_default.SCENE2D || that._scene.camera.frustum instanceof OrthographicFrustum_default;
  216596. });
  216597. this._eventHelper.add(scene.preRender, function() {
  216598. that._flightInProgress = defined_default(scene.camera._currentFlight);
  216599. });
  216600. this._switchToPerspective = createCommand_default(function() {
  216601. if (that.sceneMode === SceneMode_default.SCENE2D) {
  216602. return;
  216603. }
  216604. that._scene.camera.switchToPerspectiveFrustum();
  216605. that._orthographic = false;
  216606. that.dropDownVisible = false;
  216607. });
  216608. this._switchToOrthographic = createCommand_default(function() {
  216609. if (that.sceneMode === SceneMode_default.SCENE2D) {
  216610. return;
  216611. }
  216612. that._scene.camera.switchToOrthographicFrustum();
  216613. that._orthographic = true;
  216614. that.dropDownVisible = false;
  216615. });
  216616. this._sceneMode = SceneMode_default;
  216617. }
  216618. Object.defineProperties(ProjectionPickerViewModel.prototype, {
  216619. scene: {
  216620. get: function() {
  216621. return this._scene;
  216622. }
  216623. },
  216624. toggleDropDown: {
  216625. get: function() {
  216626. return this._toggleDropDown;
  216627. }
  216628. },
  216629. switchToPerspective: {
  216630. get: function() {
  216631. return this._switchToPerspective;
  216632. }
  216633. },
  216634. switchToOrthographic: {
  216635. get: function() {
  216636. return this._switchToOrthographic;
  216637. }
  216638. },
  216639. isOrthographicProjection: {
  216640. get: function() {
  216641. return this._orthographic;
  216642. }
  216643. }
  216644. });
  216645. ProjectionPickerViewModel.prototype.isDestroyed = function() {
  216646. return false;
  216647. };
  216648. ProjectionPickerViewModel.prototype.destroy = function() {
  216649. this._eventHelper.removeAll();
  216650. destroyObject_default(this);
  216651. };
  216652. var ProjectionPickerViewModel_default = ProjectionPickerViewModel;
  216653. // node_modules/cesium/Source/Widgets/ProjectionPicker/ProjectionPicker.js
  216654. var perspectivePath = "M 28.15625,10.4375 9.125,13.21875 13.75,43.25 41.75,55.09375 50.8125,37 54.5,11.9375 z m 0.125,3 19.976451,0.394265 L 43.03125,16.875 22.6875,14.28125 z M 50.971746,15.705477 47.90625,36.03125 42.53125,46 44.84375,19.3125 z M 12.625,16.03125 l 29.15625,3.6875 -2.65625,31 L 16.4375,41.125 z";
  216655. var orthographicPath = "m 31.560594,6.5254438 -20.75,12.4687502 0.1875,24.5625 22.28125,11.8125 19.5,-12 0.65625,-0.375 0,-0.75 0.0312,-23.21875 z m 0.0625,3.125 16.65625,9.5000002 -16.125,10.28125 -17.34375,-9.71875 z m 18.96875,11.1875002 0.15625,20.65625 -17.46875,10.59375 0.15625,-20.28125 z m -37.0625,1.25 17.21875,9.625 -0.15625,19.21875 -16.9375,-9 z";
  216656. function ProjectionPicker(container, scene) {
  216657. if (!defined_default(container)) {
  216658. throw new DeveloperError_default("container is required.");
  216659. }
  216660. if (!defined_default(scene)) {
  216661. throw new DeveloperError_default("scene is required.");
  216662. }
  216663. container = getElement_default(container);
  216664. const viewModel = new ProjectionPickerViewModel_default(scene);
  216665. viewModel._perspectivePath = perspectivePath;
  216666. viewModel._orthographicPath = orthographicPath;
  216667. const wrapper = document.createElement("span");
  216668. wrapper.className = "cesium-projectionPicker-wrapper cesium-toolbar-button";
  216669. container.appendChild(wrapper);
  216670. const button = document.createElement("button");
  216671. button.type = "button";
  216672. button.className = "cesium-button cesium-toolbar-button";
  216673. button.setAttribute(
  216674. "data-bind",
  216675. 'css: { "cesium-projectionPicker-buttonPerspective": !_orthographic, "cesium-projectionPicker-buttonOrthographic": _orthographic, "cesium-button-disabled" : sceneMode === _sceneMode.SCENE2D || _flightInProgress, "cesium-projectionPicker-selected": dropDownVisible },attr: { title: selectedTooltip },click: toggleDropDown'
  216676. );
  216677. button.innerHTML = '<!-- ko cesiumSvgPath: { path: _perspectivePath, width: 64, height: 64, css: "cesium-projectionPicker-iconPerspective" } --><!-- /ko --><!-- ko cesiumSvgPath: { path: _orthographicPath, width: 64, height: 64, css: "cesium-projectionPicker-iconOrthographic" } --><!-- /ko -->';
  216678. wrapper.appendChild(button);
  216679. const perspectiveButton = document.createElement("button");
  216680. perspectiveButton.type = "button";
  216681. perspectiveButton.className = "cesium-button cesium-toolbar-button cesium-projectionPicker-dropDown-icon";
  216682. perspectiveButton.setAttribute(
  216683. "data-bind",
  216684. 'css: { "cesium-projectionPicker-visible" : (dropDownVisible && _orthographic), "cesium-projectionPicker-none" : !_orthographic, "cesium-projectionPicker-hidden" : !dropDownVisible },attr: { title: tooltipPerspective },click: switchToPerspective,cesiumSvgPath: { path: _perspectivePath, width: 64, height: 64 }'
  216685. );
  216686. wrapper.appendChild(perspectiveButton);
  216687. const orthographicButton = document.createElement("button");
  216688. orthographicButton.type = "button";
  216689. orthographicButton.className = "cesium-button cesium-toolbar-button cesium-projectionPicker-dropDown-icon";
  216690. orthographicButton.setAttribute(
  216691. "data-bind",
  216692. 'css: { "cesium-projectionPicker-visible" : (dropDownVisible && !_orthographic), "cesium-projectionPicker-none" : _orthographic, "cesium-projectionPicker-hidden" : !dropDownVisible},attr: { title: tooltipOrthographic },click: switchToOrthographic,cesiumSvgPath: { path: _orthographicPath, width: 64, height: 64 }'
  216693. );
  216694. wrapper.appendChild(orthographicButton);
  216695. knockout_default.applyBindings(viewModel, wrapper);
  216696. this._viewModel = viewModel;
  216697. this._container = container;
  216698. this._wrapper = wrapper;
  216699. this._closeDropDown = function(e2) {
  216700. if (!wrapper.contains(e2.target)) {
  216701. viewModel.dropDownVisible = false;
  216702. }
  216703. };
  216704. if (FeatureDetection_default.supportsPointerEvents()) {
  216705. document.addEventListener("pointerdown", this._closeDropDown, true);
  216706. } else {
  216707. document.addEventListener("mousedown", this._closeDropDown, true);
  216708. document.addEventListener("touchstart", this._closeDropDown, true);
  216709. }
  216710. }
  216711. Object.defineProperties(ProjectionPicker.prototype, {
  216712. container: {
  216713. get: function() {
  216714. return this._container;
  216715. }
  216716. },
  216717. viewModel: {
  216718. get: function() {
  216719. return this._viewModel;
  216720. }
  216721. }
  216722. });
  216723. ProjectionPicker.prototype.isDestroyed = function() {
  216724. return false;
  216725. };
  216726. ProjectionPicker.prototype.destroy = function() {
  216727. this._viewModel.destroy();
  216728. if (FeatureDetection_default.supportsPointerEvents()) {
  216729. document.removeEventListener("pointerdown", this._closeDropDown, true);
  216730. } else {
  216731. document.removeEventListener("mousedown", this._closeDropDown, true);
  216732. document.removeEventListener("touchstart", this._closeDropDown, true);
  216733. }
  216734. knockout_default.cleanNode(this._wrapper);
  216735. this._container.removeChild(this._wrapper);
  216736. return destroyObject_default(this);
  216737. };
  216738. var ProjectionPicker_default = ProjectionPicker;
  216739. // node_modules/cesium/Source/Widgets/SceneModePicker/SceneModePickerViewModel.js
  216740. function SceneModePickerViewModel(scene, duration) {
  216741. if (!defined_default(scene)) {
  216742. throw new DeveloperError_default("scene is required.");
  216743. }
  216744. this._scene = scene;
  216745. const that = this;
  216746. const morphStart = function(transitioner, oldMode, newMode, isMorphing) {
  216747. that.sceneMode = newMode;
  216748. that.dropDownVisible = false;
  216749. };
  216750. this._eventHelper = new EventHelper_default();
  216751. this._eventHelper.add(scene.morphStart, morphStart);
  216752. this._duration = defaultValue_default(duration, 2);
  216753. this.sceneMode = scene.mode;
  216754. this.dropDownVisible = false;
  216755. this.tooltip2D = "2D";
  216756. this.tooltip3D = "3D";
  216757. this.tooltipColumbusView = "Columbus View";
  216758. knockout_default.track(this, [
  216759. "sceneMode",
  216760. "dropDownVisible",
  216761. "tooltip2D",
  216762. "tooltip3D",
  216763. "tooltipColumbusView"
  216764. ]);
  216765. this.selectedTooltip = void 0;
  216766. knockout_default.defineProperty(this, "selectedTooltip", function() {
  216767. const mode2 = that.sceneMode;
  216768. if (mode2 === SceneMode_default.SCENE2D) {
  216769. return that.tooltip2D;
  216770. }
  216771. if (mode2 === SceneMode_default.SCENE3D) {
  216772. return that.tooltip3D;
  216773. }
  216774. return that.tooltipColumbusView;
  216775. });
  216776. this._toggleDropDown = createCommand_default(function() {
  216777. that.dropDownVisible = !that.dropDownVisible;
  216778. });
  216779. this._morphTo2D = createCommand_default(function() {
  216780. scene.morphTo2D(that._duration);
  216781. });
  216782. this._morphTo3D = createCommand_default(function() {
  216783. scene.morphTo3D(that._duration);
  216784. });
  216785. this._morphToColumbusView = createCommand_default(function() {
  216786. scene.morphToColumbusView(that._duration);
  216787. });
  216788. this._sceneMode = SceneMode_default;
  216789. }
  216790. Object.defineProperties(SceneModePickerViewModel.prototype, {
  216791. scene: {
  216792. get: function() {
  216793. return this._scene;
  216794. }
  216795. },
  216796. duration: {
  216797. get: function() {
  216798. return this._duration;
  216799. },
  216800. set: function(value) {
  216801. if (value < 0) {
  216802. throw new DeveloperError_default("duration value must be positive.");
  216803. }
  216804. this._duration = value;
  216805. }
  216806. },
  216807. toggleDropDown: {
  216808. get: function() {
  216809. return this._toggleDropDown;
  216810. }
  216811. },
  216812. morphTo2D: {
  216813. get: function() {
  216814. return this._morphTo2D;
  216815. }
  216816. },
  216817. morphTo3D: {
  216818. get: function() {
  216819. return this._morphTo3D;
  216820. }
  216821. },
  216822. morphToColumbusView: {
  216823. get: function() {
  216824. return this._morphToColumbusView;
  216825. }
  216826. }
  216827. });
  216828. SceneModePickerViewModel.prototype.isDestroyed = function() {
  216829. return false;
  216830. };
  216831. SceneModePickerViewModel.prototype.destroy = function() {
  216832. this._eventHelper.removeAll();
  216833. destroyObject_default(this);
  216834. };
  216835. var SceneModePickerViewModel_default = SceneModePickerViewModel;
  216836. // node_modules/cesium/Source/Widgets/SceneModePicker/SceneModePicker.js
  216837. var globePath = "m 32.401392,4.9330437 c -7.087603,0 -14.096095,2.884602 -19.10793,7.8946843 -5.0118352,5.010083 -7.9296167,11.987468 -7.9296167,19.072999 0,7.085531 2.9177815,14.097848 7.9296167,19.107931 4.837653,4.835961 11.541408,7.631372 18.374354,7.82482 0.05712,0.01231 0.454119,0.139729 0.454119,0.139729 l 0.03493,-0.104797 c 0.08246,7.84e-4 0.162033,0.03493 0.244525,0.03493 0.08304,0 0.161515,-0.03414 0.244526,-0.03493 l 0.03493,0.104797 c 0,0 0.309474,-0.129487 0.349323,-0.139729 6.867765,-0.168094 13.582903,-2.965206 18.444218,-7.82482 2.558195,-2.5573 4.551081,-5.638134 5.903547,-8.977584 1.297191,-3.202966 2.02607,-6.661489 2.02607,-10.130347 0,-6.237309 -2.366261,-12.31219 -6.322734,-17.116794 -0.0034,-0.02316 0.0049,-0.04488 0,-0.06986 -0.01733,-0.08745 -0.104529,-0.278855 -0.104797,-0.279458 -5.31e-4,-0.0012 -0.522988,-0.628147 -0.523984,-0.62878 -3.47e-4,-2.2e-4 -0.133444,-0.03532 -0.244525,-0.06987 C 51.944299,13.447603 51.751076,13.104317 51.474391,12.827728 46.462556,7.8176457 39.488996,4.9330437 32.401392,4.9330437 z m -2.130866,3.5281554 0.104797,9.6762289 c -4.111695,-0.08361 -7.109829,-0.423664 -9.257041,-0.943171 1.198093,-2.269271 2.524531,-4.124404 3.91241,-5.414496 2.167498,-2.0147811 3.950145,-2.8540169 5.239834,-3.3185619 z m 2.794579,0 c 1.280302,0.4754953 3.022186,1.3285948 5.065173,3.2486979 1.424667,1.338973 2.788862,3.303645 3.982275,5.728886 -2.29082,0.403367 -5.381258,0.621049 -8.942651,0.698645 L 33.065105,8.4611991 z m 5.728886,0.2445256 c 4.004072,1.1230822 7.793098,3.1481363 10.724195,6.0782083 0.03468,0.03466 0.07033,0.06991 0.104797,0.104797 -0.45375,0.313891 -0.923054,0.663002 -1.956205,1.082899 -0.647388,0.263114 -1.906242,0.477396 -2.829511,0.733577 -1.382296,-2.988132 -3.027146,-5.368585 -4.785716,-7.0213781 -0.422866,-0.397432 -0.835818,-0.6453247 -1.25756,-0.9781032 z m -15.33525,0.7685092 c -0.106753,0.09503 -0.207753,0.145402 -0.31439,0.244526 -1.684973,1.5662541 -3.298068,3.8232211 -4.680919,6.5672591 -0.343797,-0.14942 -1.035052,-0.273198 -1.292493,-0.419186 -0.956528,-0.542427 -1.362964,-1.022024 -1.537018,-1.292493 -0.0241,-0.03745 -0.01868,-0.0401 -0.03493,-0.06986 2.250095,-2.163342 4.948824,-3.869984 7.859752,-5.0302421 z m -9.641296,7.0912431 c 0.464973,0.571618 0.937729,1.169056 1.956205,1.746612 0.349907,0.198425 1.107143,0.335404 1.537018,0.523983 -1.20166,3.172984 -1.998037,7.051901 -2.165798,11.772162 C 14.256557,30.361384 12.934823,30.161483 12.280427,29.90959 10.644437,29.279855 9.6888882,28.674891 9.1714586,28.267775 8.6540289,27.860658 8.6474751,27.778724 8.6474751,27.778724 l -0.069864,0.03493 C 9.3100294,23.691285 11.163248,19.798527 13.817445,16.565477 z m 37.552149,0.523984 c 2.548924,3.289983 4.265057,7.202594 4.890513,11.318043 -0.650428,0.410896 -1.756876,1.001936 -3.563088,1.606882 -1.171552,0.392383 -3.163859,0.759153 -4.960377,1.117832 -0.04367,-4.752703 -0.784809,-8.591423 -1.88634,-11.807094 0.917574,-0.263678 2.170552,-0.486495 2.864443,-0.76851 1.274693,-0.518066 2.003942,-1.001558 2.654849,-1.467153 z m -31.439008,2.619917 c 2.487341,0.672766 5.775813,1.137775 10.479669,1.222628 l 0.104797,10.689263 0,0.03493 0,0.733577 c -5.435005,-0.09059 -9.512219,-0.519044 -12.610536,-1.117831 0.106127,-4.776683 0.879334,-8.55791 2.02607,-11.562569 z m 23.264866,0.31439 c 1.073459,3.067541 1.833795,6.821314 1.816476,11.702298 -3.054474,0.423245 -7.062018,0.648559 -11.702298,0.698644 l 0,-0.838373 -0.104796,-10.654331 c 4.082416,-0.0864 7.404468,-0.403886 9.990618,-0.908238 z M 8.2632205,30.922625 c 0.7558676,0.510548 1.5529563,1.013339 3.0041715,1.57195 0.937518,0.360875 2.612202,0.647642 3.91241,0.978102 0.112814,3.85566 0.703989,7.107756 1.606883,9.920754 -1.147172,-0.324262 -2.644553,-0.640648 -3.423359,-0.978102 -1.516688,-0.657177 -2.386627,-1.287332 -2.864443,-1.71168 -0.477816,-0.424347 -0.489051,-0.489051 -0.489051,-0.489051 L 9.8002387,40.319395 C 8.791691,37.621767 8.1584238,34.769583 8.1584238,31.900727 c 0,-0.330153 0.090589,-0.648169 0.1047967,-0.978102 z m 48.2763445,0.419186 c 0.0047,0.188973 0.06986,0.36991 0.06986,0.558916 0,2.938869 -0.620228,5.873558 -1.676747,8.628261 -0.07435,0.07583 -0.06552,0.07411 -0.454119,0.349323 -0.606965,0.429857 -1.631665,1.042044 -3.318562,1.676747 -1.208528,0.454713 -3.204964,0.850894 -5.135038,1.25756 0.84593,-2.765726 1.41808,-6.005357 1.606883,-9.815957 2.232369,-0.413371 4.483758,-0.840201 5.938479,-1.327425 1.410632,-0.472457 2.153108,-0.89469 2.96924,-1.327425 z m -38.530252,2.864443 c 3.208141,0.56697 7.372279,0.898588 12.575603,0.978103 l 0.174662,9.885821 c -4.392517,-0.06139 -8.106722,-0.320566 -10.863925,-0.803441 -1.051954,-2.664695 -1.692909,-6.043794 -1.88634,-10.060483 z m 26.793022,0.31439 c -0.246298,3.923551 -0.877762,7.263679 -1.816476,9.885822 -2.561957,0.361954 -5.766249,0.560708 -9.431703,0.62878 l -0.174661,-9.815957 c 4.491734,-0.04969 8.334769,-0.293032 11.42284,-0.698645 z M 12.035901,44.860585 c 0.09977,0.04523 0.105535,0.09465 0.209594,0.139729 1.337656,0.579602 3.441099,1.058072 5.589157,1.537018 1.545042,3.399208 3.548524,5.969402 5.589157,7.789888 -3.034411,-1.215537 -5.871615,-3.007978 -8.174142,-5.309699 -1.245911,-1.245475 -2.271794,-2.662961 -3.213766,-4.156936 z m 40.69605,0 c -0.941972,1.493975 -1.967855,2.911461 -3.213765,4.156936 -2.74253,2.741571 -6.244106,4.696717 -9.955686,5.868615 0.261347,-0.241079 0.507495,-0.394491 0.768509,-0.663713 1.674841,-1.727516 3.320792,-4.181056 4.645987,-7.265904 2.962447,-0.503021 5.408965,-1.122293 7.161107,-1.781544 0.284034,-0.106865 0.337297,-0.207323 0.593848,-0.31439 z m -31.404076,2.305527 c 2.645807,0.376448 5.701178,0.649995 9.466635,0.698645 l 0.139729,7.789888 c -1.38739,-0.480844 -3.316218,-1.29837 -5.659022,-3.388427 -1.388822,-1.238993 -2.743668,-3.0113 -3.947342,-5.100106 z m 20.365491,0.104797 c -1.04872,2.041937 -2.174337,3.779068 -3.353494,4.995309 -1.853177,1.911459 -3.425515,2.82679 -4.611055,3.353494 l -0.139729,-7.789887 c 3.13091,-0.05714 5.728238,-0.278725 8.104278,-0.558916 z";
  216838. var flatMapPath = "m 2.9825053,17.550598 0,1.368113 0,26.267766 0,1.368113 1.36811,0 54.9981397,0 1.36811,0 0,-1.368113 0,-26.267766 0,-1.368113 -1.36811,0 -54.9981397,0 -1.36811,0 z m 2.73623,2.736226 10.3292497,0 0,10.466063 -10.3292497,0 0,-10.466063 z m 13.0654697,0 11.69737,0 0,10.466063 -11.69737,0 0,-10.466063 z m 14.43359,0 11.69737,0 0,10.466063 -11.69737,0 0,-10.466063 z m 14.43359,0 10.32926,0 0,10.466063 -10.32926,0 0,-10.466063 z m -41.9326497,13.202288 10.3292497,0 0,10.329252 -10.3292497,0 0,-10.329252 z m 13.0654697,0 11.69737,0 0,10.329252 -11.69737,0 0,-10.329252 z m 14.43359,0 11.69737,0 0,10.329252 -11.69737,0 0,-10.329252 z m 14.43359,0 10.32926,0 0,10.329252 -10.32926,0 0,-10.329252 z";
  216839. var columbusViewPath = "m 14.723969,17.675598 -0.340489,0.817175 -11.1680536,26.183638 -0.817175,1.872692 2.076986,0 54.7506996,0 2.07698,0 -0.81717,-1.872692 -11.16805,-26.183638 -0.34049,-0.817175 -0.91933,0 -32.414586,0 -0.919322,0 z m 1.838643,2.723916 6.196908,0 -2.928209,10.418977 -7.729111,0 4.460412,-10.418977 z m 9.02297,0 4.903049,0 0,10.418977 -7.831258,0 2.928209,-10.418977 z m 7.626964,0 5.584031,0 2.62176,10.418977 -8.205791,0 0,-10.418977 z m 8.410081,0 5.51593,0 4.46042,10.418977 -7.38863,0 -2.58772,-10.418977 z m -30.678091,13.142892 8.103649,0 -2.89416,10.282782 -9.6018026,0 4.3923136,-10.282782 z m 10.929711,0 8.614384,0 0,10.282782 -11.508544,0 2.89416,-10.282782 z m 11.338299,0 8.852721,0 2.58772,10.282782 -11.440441,0 0,-10.282782 z m 11.678781,0 7.86531,0 4.39231,10.282782 -9.6699,0 -2.58772,-10.282782 z";
  216840. function SceneModePicker(container, scene, duration) {
  216841. if (!defined_default(container)) {
  216842. throw new DeveloperError_default("container is required.");
  216843. }
  216844. if (!defined_default(scene)) {
  216845. throw new DeveloperError_default("scene is required.");
  216846. }
  216847. container = getElement_default(container);
  216848. const viewModel = new SceneModePickerViewModel_default(scene, duration);
  216849. viewModel._globePath = globePath;
  216850. viewModel._flatMapPath = flatMapPath;
  216851. viewModel._columbusViewPath = columbusViewPath;
  216852. const wrapper = document.createElement("span");
  216853. wrapper.className = "cesium-sceneModePicker-wrapper cesium-toolbar-button";
  216854. container.appendChild(wrapper);
  216855. const button = document.createElement("button");
  216856. button.type = "button";
  216857. button.className = "cesium-button cesium-toolbar-button";
  216858. button.setAttribute(
  216859. "data-bind",
  216860. 'css: { "cesium-sceneModePicker-button2D": sceneMode === _sceneMode.SCENE2D, "cesium-sceneModePicker-button3D": sceneMode === _sceneMode.SCENE3D, "cesium-sceneModePicker-buttonColumbusView": sceneMode === _sceneMode.COLUMBUS_VIEW, "cesium-sceneModePicker-selected": dropDownVisible },attr: { title: selectedTooltip },click: toggleDropDown'
  216861. );
  216862. button.innerHTML = '<!-- ko cesiumSvgPath: { path: _globePath, width: 64, height: 64, css: "cesium-sceneModePicker-slide-svg cesium-sceneModePicker-icon3D" } --><!-- /ko --><!-- ko cesiumSvgPath: { path: _flatMapPath, width: 64, height: 64, css: "cesium-sceneModePicker-slide-svg cesium-sceneModePicker-icon2D" } --><!-- /ko --><!-- ko cesiumSvgPath: { path: _columbusViewPath, width: 64, height: 64, css: "cesium-sceneModePicker-slide-svg cesium-sceneModePicker-iconColumbusView" } --><!-- /ko -->';
  216863. wrapper.appendChild(button);
  216864. const morphTo3DButton = document.createElement("button");
  216865. morphTo3DButton.type = "button";
  216866. morphTo3DButton.className = "cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon";
  216867. morphTo3DButton.setAttribute(
  216868. "data-bind",
  216869. 'css: { "cesium-sceneModePicker-visible" : (dropDownVisible && (sceneMode !== _sceneMode.SCENE3D)) || (!dropDownVisible && (sceneMode === _sceneMode.SCENE3D)), "cesium-sceneModePicker-none" : sceneMode === _sceneMode.SCENE3D, "cesium-sceneModePicker-hidden" : !dropDownVisible },attr: { title: tooltip3D },click: morphTo3D,cesiumSvgPath: { path: _globePath, width: 64, height: 64 }'
  216870. );
  216871. wrapper.appendChild(morphTo3DButton);
  216872. const morphTo2DButton = document.createElement("button");
  216873. morphTo2DButton.type = "button";
  216874. morphTo2DButton.className = "cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon";
  216875. morphTo2DButton.setAttribute(
  216876. "data-bind",
  216877. 'css: { "cesium-sceneModePicker-visible" : (dropDownVisible && (sceneMode !== _sceneMode.SCENE2D)), "cesium-sceneModePicker-none" : sceneMode === _sceneMode.SCENE2D, "cesium-sceneModePicker-hidden" : !dropDownVisible },attr: { title: tooltip2D },click: morphTo2D,cesiumSvgPath: { path: _flatMapPath, width: 64, height: 64 }'
  216878. );
  216879. wrapper.appendChild(morphTo2DButton);
  216880. const morphToCVButton = document.createElement("button");
  216881. morphToCVButton.type = "button";
  216882. morphToCVButton.className = "cesium-button cesium-toolbar-button cesium-sceneModePicker-dropDown-icon";
  216883. morphToCVButton.setAttribute(
  216884. "data-bind",
  216885. 'css: { "cesium-sceneModePicker-visible" : (dropDownVisible && (sceneMode !== _sceneMode.COLUMBUS_VIEW)) || (!dropDownVisible && (sceneMode === _sceneMode.COLUMBUS_VIEW)), "cesium-sceneModePicker-none" : sceneMode === _sceneMode.COLUMBUS_VIEW, "cesium-sceneModePicker-hidden" : !dropDownVisible},attr: { title: tooltipColumbusView },click: morphToColumbusView,cesiumSvgPath: { path: _columbusViewPath, width: 64, height: 64 }'
  216886. );
  216887. wrapper.appendChild(morphToCVButton);
  216888. knockout_default.applyBindings(viewModel, wrapper);
  216889. this._viewModel = viewModel;
  216890. this._container = container;
  216891. this._wrapper = wrapper;
  216892. this._closeDropDown = function(e2) {
  216893. if (!wrapper.contains(e2.target)) {
  216894. viewModel.dropDownVisible = false;
  216895. }
  216896. };
  216897. if (FeatureDetection_default.supportsPointerEvents()) {
  216898. document.addEventListener("pointerdown", this._closeDropDown, true);
  216899. } else {
  216900. document.addEventListener("mousedown", this._closeDropDown, true);
  216901. document.addEventListener("touchstart", this._closeDropDown, true);
  216902. }
  216903. }
  216904. Object.defineProperties(SceneModePicker.prototype, {
  216905. container: {
  216906. get: function() {
  216907. return this._container;
  216908. }
  216909. },
  216910. viewModel: {
  216911. get: function() {
  216912. return this._viewModel;
  216913. }
  216914. }
  216915. });
  216916. SceneModePicker.prototype.isDestroyed = function() {
  216917. return false;
  216918. };
  216919. SceneModePicker.prototype.destroy = function() {
  216920. this._viewModel.destroy();
  216921. if (FeatureDetection_default.supportsPointerEvents()) {
  216922. document.removeEventListener("pointerdown", this._closeDropDown, true);
  216923. } else {
  216924. document.removeEventListener("mousedown", this._closeDropDown, true);
  216925. document.removeEventListener("touchstart", this._closeDropDown, true);
  216926. }
  216927. knockout_default.cleanNode(this._wrapper);
  216928. this._container.removeChild(this._wrapper);
  216929. return destroyObject_default(this);
  216930. };
  216931. var SceneModePicker_default = SceneModePicker;
  216932. // node_modules/cesium/Source/Widgets/SelectionIndicator/SelectionIndicatorViewModel.js
  216933. var screenSpacePos = new Cartesian2_default();
  216934. var offScreen = "-1000px";
  216935. function SelectionIndicatorViewModel(scene, selectionIndicatorElement, container) {
  216936. if (!defined_default(scene)) {
  216937. throw new DeveloperError_default("scene is required.");
  216938. }
  216939. if (!defined_default(selectionIndicatorElement)) {
  216940. throw new DeveloperError_default("selectionIndicatorElement is required.");
  216941. }
  216942. if (!defined_default(container)) {
  216943. throw new DeveloperError_default("container is required.");
  216944. }
  216945. this._scene = scene;
  216946. this._screenPositionX = offScreen;
  216947. this._screenPositionY = offScreen;
  216948. this._tweens = scene.tweens;
  216949. this._container = defaultValue_default(container, document.body);
  216950. this._selectionIndicatorElement = selectionIndicatorElement;
  216951. this._scale = 1;
  216952. this.position = void 0;
  216953. this.showSelection = false;
  216954. knockout_default.track(this, [
  216955. "position",
  216956. "_screenPositionX",
  216957. "_screenPositionY",
  216958. "_scale",
  216959. "showSelection"
  216960. ]);
  216961. this.isVisible = void 0;
  216962. knockout_default.defineProperty(this, "isVisible", {
  216963. get: function() {
  216964. return this.showSelection && defined_default(this.position);
  216965. }
  216966. });
  216967. knockout_default.defineProperty(this, "_transform", {
  216968. get: function() {
  216969. return `scale(${this._scale})`;
  216970. }
  216971. });
  216972. this.computeScreenSpacePosition = function(position, result) {
  216973. return SceneTransforms_default.wgs84ToWindowCoordinates(scene, position, result);
  216974. };
  216975. }
  216976. SelectionIndicatorViewModel.prototype.update = function() {
  216977. if (this.showSelection && defined_default(this.position)) {
  216978. const screenPosition = this.computeScreenSpacePosition(
  216979. this.position,
  216980. screenSpacePos
  216981. );
  216982. if (!defined_default(screenPosition)) {
  216983. this._screenPositionX = offScreen;
  216984. this._screenPositionY = offScreen;
  216985. } else {
  216986. const container = this._container;
  216987. const containerWidth = container.parentNode.clientWidth;
  216988. const containerHeight = container.parentNode.clientHeight;
  216989. const indicatorSize = this._selectionIndicatorElement.clientWidth;
  216990. const halfSize = indicatorSize * 0.5;
  216991. screenPosition.x = Math.min(
  216992. Math.max(screenPosition.x, -indicatorSize),
  216993. containerWidth + indicatorSize
  216994. ) - halfSize;
  216995. screenPosition.y = Math.min(
  216996. Math.max(screenPosition.y, -indicatorSize),
  216997. containerHeight + indicatorSize
  216998. ) - halfSize;
  216999. this._screenPositionX = `${Math.floor(screenPosition.x + 0.25)}px`;
  217000. this._screenPositionY = `${Math.floor(screenPosition.y + 0.25)}px`;
  217001. }
  217002. }
  217003. };
  217004. SelectionIndicatorViewModel.prototype.animateAppear = function() {
  217005. this._tweens.addProperty({
  217006. object: this,
  217007. property: "_scale",
  217008. startValue: 2,
  217009. stopValue: 1,
  217010. duration: 0.8,
  217011. easingFunction: EasingFunction_default.EXPONENTIAL_OUT
  217012. });
  217013. };
  217014. SelectionIndicatorViewModel.prototype.animateDepart = function() {
  217015. this._tweens.addProperty({
  217016. object: this,
  217017. property: "_scale",
  217018. startValue: this._scale,
  217019. stopValue: 1.5,
  217020. duration: 0.8,
  217021. easingFunction: EasingFunction_default.EXPONENTIAL_OUT
  217022. });
  217023. };
  217024. Object.defineProperties(SelectionIndicatorViewModel.prototype, {
  217025. container: {
  217026. get: function() {
  217027. return this._container;
  217028. }
  217029. },
  217030. selectionIndicatorElement: {
  217031. get: function() {
  217032. return this._selectionIndicatorElement;
  217033. }
  217034. },
  217035. scene: {
  217036. get: function() {
  217037. return this._scene;
  217038. }
  217039. }
  217040. });
  217041. var SelectionIndicatorViewModel_default = SelectionIndicatorViewModel;
  217042. // node_modules/cesium/Source/Widgets/SelectionIndicator/SelectionIndicator.js
  217043. function SelectionIndicator(container, scene) {
  217044. if (!defined_default(container)) {
  217045. throw new DeveloperError_default("container is required.");
  217046. }
  217047. container = getElement_default(container);
  217048. this._container = container;
  217049. const el = document.createElement("div");
  217050. el.className = "cesium-selection-wrapper";
  217051. el.setAttribute(
  217052. "data-bind",
  217053. 'style: { "top" : _screenPositionY, "left" : _screenPositionX },css: { "cesium-selection-wrapper-visible" : isVisible }'
  217054. );
  217055. container.appendChild(el);
  217056. this._element = el;
  217057. const svgNS3 = "http://www.w3.org/2000/svg";
  217058. const path = "M -34 -34 L -34 -11.25 L -30 -15.25 L -30 -30 L -15.25 -30 L -11.25 -34 L -34 -34 z M 11.25 -34 L 15.25 -30 L 30 -30 L 30 -15.25 L 34 -11.25 L 34 -34 L 11.25 -34 z M -34 11.25 L -34 34 L -11.25 34 L -15.25 30 L -30 30 L -30 15.25 L -34 11.25 z M 34 11.25 L 30 15.25 L 30 30 L 15.25 30 L 11.25 34 L 34 34 L 34 11.25 z";
  217059. const svg2 = document.createElementNS(svgNS3, "svg:svg");
  217060. svg2.setAttribute("width", 160);
  217061. svg2.setAttribute("height", 160);
  217062. svg2.setAttribute("viewBox", "0 0 160 160");
  217063. const group = document.createElementNS(svgNS3, "g");
  217064. group.setAttribute("transform", "translate(80,80)");
  217065. svg2.appendChild(group);
  217066. const pathElement = document.createElementNS(svgNS3, "path");
  217067. pathElement.setAttribute("data-bind", "attr: { transform: _transform }");
  217068. pathElement.setAttribute("d", path);
  217069. group.appendChild(pathElement);
  217070. el.appendChild(svg2);
  217071. const viewModel = new SelectionIndicatorViewModel_default(
  217072. scene,
  217073. this._element,
  217074. this._container
  217075. );
  217076. this._viewModel = viewModel;
  217077. knockout_default.applyBindings(this._viewModel, this._element);
  217078. }
  217079. Object.defineProperties(SelectionIndicator.prototype, {
  217080. container: {
  217081. get: function() {
  217082. return this._container;
  217083. }
  217084. },
  217085. viewModel: {
  217086. get: function() {
  217087. return this._viewModel;
  217088. }
  217089. }
  217090. });
  217091. SelectionIndicator.prototype.isDestroyed = function() {
  217092. return false;
  217093. };
  217094. SelectionIndicator.prototype.destroy = function() {
  217095. const container = this._container;
  217096. knockout_default.cleanNode(this._element);
  217097. container.removeChild(this._element);
  217098. return destroyObject_default(this);
  217099. };
  217100. var SelectionIndicator_default = SelectionIndicator;
  217101. // node_modules/cesium/Source/Widgets/Timeline/TimelineHighlightRange.js
  217102. function TimelineHighlightRange(color, heightInPx, base) {
  217103. this._color = color;
  217104. this._height = heightInPx;
  217105. this._base = defaultValue_default(base, 0);
  217106. }
  217107. TimelineHighlightRange.prototype.getHeight = function() {
  217108. return this._height;
  217109. };
  217110. TimelineHighlightRange.prototype.getBase = function() {
  217111. return this._base;
  217112. };
  217113. TimelineHighlightRange.prototype.getStartTime = function() {
  217114. return this._start;
  217115. };
  217116. TimelineHighlightRange.prototype.getStopTime = function() {
  217117. return this._stop;
  217118. };
  217119. TimelineHighlightRange.prototype.setRange = function(start, stop2) {
  217120. this._start = start;
  217121. this._stop = stop2;
  217122. };
  217123. TimelineHighlightRange.prototype.render = function(renderState) {
  217124. let range2 = "";
  217125. if (this._start && this._stop && this._color) {
  217126. const highlightStart = JulianDate_default.secondsDifference(
  217127. this._start,
  217128. renderState.epochJulian
  217129. );
  217130. let highlightLeft = Math.round(
  217131. renderState.timeBarWidth * renderState.getAlpha(highlightStart)
  217132. );
  217133. const highlightStop = JulianDate_default.secondsDifference(
  217134. this._stop,
  217135. renderState.epochJulian
  217136. );
  217137. let highlightWidth = Math.round(
  217138. renderState.timeBarWidth * renderState.getAlpha(highlightStop)
  217139. ) - highlightLeft;
  217140. if (highlightLeft < 0) {
  217141. highlightWidth += highlightLeft;
  217142. highlightLeft = 0;
  217143. }
  217144. if (highlightLeft + highlightWidth > renderState.timeBarWidth) {
  217145. highlightWidth = renderState.timeBarWidth - highlightLeft;
  217146. }
  217147. if (highlightWidth > 0) {
  217148. range2 = `<span class="cesium-timeline-highlight" style="left: ${highlightLeft.toString()}px; width: ${highlightWidth.toString()}px; bottom: ${this._base.toString()}px; height: ${this._height}px; background-color: ${this._color};"></span>`;
  217149. }
  217150. }
  217151. return range2;
  217152. };
  217153. var TimelineHighlightRange_default = TimelineHighlightRange;
  217154. // node_modules/cesium/Source/Widgets/Timeline/TimelineTrack.js
  217155. function TimelineTrack(interval, pixelHeight, color, backgroundColor) {
  217156. this.interval = interval;
  217157. this.height = pixelHeight;
  217158. this.color = color || new Color_default(0.5, 0.5, 0.5, 1);
  217159. this.backgroundColor = backgroundColor || new Color_default(0, 0, 0, 0);
  217160. }
  217161. TimelineTrack.prototype.render = function(context, renderState) {
  217162. const startInterval = this.interval.start;
  217163. const stopInterval = this.interval.stop;
  217164. const spanStart = renderState.startJulian;
  217165. const spanStop = JulianDate_default.addSeconds(
  217166. renderState.startJulian,
  217167. renderState.duration,
  217168. new JulianDate_default()
  217169. );
  217170. if (JulianDate_default.lessThan(startInterval, spanStart) && JulianDate_default.greaterThan(stopInterval, spanStop)) {
  217171. context.fillStyle = this.color.toCssColorString();
  217172. context.fillRect(0, renderState.y, renderState.timeBarWidth, this.height);
  217173. } else if (JulianDate_default.lessThanOrEquals(startInterval, spanStop) && JulianDate_default.greaterThanOrEquals(stopInterval, spanStart)) {
  217174. let x;
  217175. let start, stop2;
  217176. for (x = 0; x < renderState.timeBarWidth; ++x) {
  217177. const currentTime = JulianDate_default.addSeconds(
  217178. renderState.startJulian,
  217179. x / renderState.timeBarWidth * renderState.duration,
  217180. new JulianDate_default()
  217181. );
  217182. if (!defined_default(start) && JulianDate_default.greaterThanOrEquals(currentTime, startInterval)) {
  217183. start = x;
  217184. } else if (!defined_default(stop2) && JulianDate_default.greaterThanOrEquals(currentTime, stopInterval)) {
  217185. stop2 = x;
  217186. }
  217187. }
  217188. context.fillStyle = this.backgroundColor.toCssColorString();
  217189. context.fillRect(0, renderState.y, renderState.timeBarWidth, this.height);
  217190. if (defined_default(start)) {
  217191. if (!defined_default(stop2)) {
  217192. stop2 = renderState.timeBarWidth;
  217193. }
  217194. context.fillStyle = this.color.toCssColorString();
  217195. context.fillRect(
  217196. start,
  217197. renderState.y,
  217198. Math.max(stop2 - start, 1),
  217199. this.height
  217200. );
  217201. }
  217202. }
  217203. };
  217204. var TimelineTrack_default = TimelineTrack;
  217205. // node_modules/cesium/Source/Widgets/Timeline/Timeline.js
  217206. var timelineWheelDelta = 1e12;
  217207. var timelineMouseMode = {
  217208. none: 0,
  217209. scrub: 1,
  217210. slide: 2,
  217211. zoom: 3,
  217212. touchOnly: 4
  217213. };
  217214. var timelineTouchMode = {
  217215. none: 0,
  217216. scrub: 1,
  217217. slideZoom: 2,
  217218. singleTap: 3,
  217219. ignore: 4
  217220. };
  217221. var timelineTicScales = [
  217222. 1e-3,
  217223. 2e-3,
  217224. 5e-3,
  217225. 0.01,
  217226. 0.02,
  217227. 0.05,
  217228. 0.1,
  217229. 0.25,
  217230. 0.5,
  217231. 1,
  217232. 2,
  217233. 5,
  217234. 10,
  217235. 15,
  217236. 30,
  217237. 60,
  217238. 120,
  217239. 300,
  217240. 600,
  217241. 900,
  217242. 1800,
  217243. 3600,
  217244. 7200,
  217245. 14400,
  217246. 21600,
  217247. 43200,
  217248. 86400,
  217249. 172800,
  217250. 345600,
  217251. 604800,
  217252. 1296e3,
  217253. 2592e3,
  217254. 5184e3,
  217255. 7776e3,
  217256. 15552e3,
  217257. 31536e3,
  217258. 63072e3,
  217259. 126144e3,
  217260. 15768e4,
  217261. 31536e4,
  217262. 63072e4,
  217263. 126144e4,
  217264. 15768e5,
  217265. 31536e5,
  217266. 63072e5,
  217267. 126144e5,
  217268. 15768e6,
  217269. 31536e6
  217270. ];
  217271. var timelineMonthNames = [
  217272. "Jan",
  217273. "Feb",
  217274. "Mar",
  217275. "Apr",
  217276. "May",
  217277. "Jun",
  217278. "Jul",
  217279. "Aug",
  217280. "Sep",
  217281. "Oct",
  217282. "Nov",
  217283. "Dec"
  217284. ];
  217285. function Timeline(container, clock) {
  217286. if (!defined_default(container)) {
  217287. throw new DeveloperError_default("container is required.");
  217288. }
  217289. if (!defined_default(clock)) {
  217290. throw new DeveloperError_default("clock is required.");
  217291. }
  217292. container = getElement_default(container);
  217293. const ownerDocument = container.ownerDocument;
  217294. this.container = container;
  217295. const topDiv = ownerDocument.createElement("div");
  217296. topDiv.className = "cesium-timeline-main";
  217297. container.appendChild(topDiv);
  217298. this._topDiv = topDiv;
  217299. this._endJulian = void 0;
  217300. this._epochJulian = void 0;
  217301. this._lastXPos = void 0;
  217302. this._scrubElement = void 0;
  217303. this._startJulian = void 0;
  217304. this._timeBarSecondsSpan = void 0;
  217305. this._clock = clock;
  217306. this._scrubJulian = clock.currentTime;
  217307. this._mainTicSpan = -1;
  217308. this._mouseMode = timelineMouseMode.none;
  217309. this._touchMode = timelineTouchMode.none;
  217310. this._touchState = {
  217311. centerX: 0,
  217312. spanX: 0
  217313. };
  217314. this._mouseX = 0;
  217315. this._timelineDrag = 0;
  217316. this._timelineDragLocation = void 0;
  217317. this._lastHeight = void 0;
  217318. this._lastWidth = void 0;
  217319. this._topDiv.innerHTML = '<div class="cesium-timeline-bar"></div><div class="cesium-timeline-trackContainer"><canvas class="cesium-timeline-tracks" width="10" height="1"></canvas></div><div class="cesium-timeline-needle"></div><span class="cesium-timeline-ruler"></span>';
  217320. this._timeBarEle = this._topDiv.childNodes[0];
  217321. this._trackContainer = this._topDiv.childNodes[1];
  217322. this._trackListEle = this._topDiv.childNodes[1].childNodes[0];
  217323. this._needleEle = this._topDiv.childNodes[2];
  217324. this._rulerEle = this._topDiv.childNodes[3];
  217325. this._context = this._trackListEle.getContext("2d");
  217326. this._trackList = [];
  217327. this._highlightRanges = [];
  217328. this.zoomTo(clock.startTime, clock.stopTime);
  217329. this._onMouseDown = createMouseDownCallback(this);
  217330. this._onMouseUp = createMouseUpCallback(this);
  217331. this._onMouseMove = createMouseMoveCallback(this);
  217332. this._onMouseWheel = createMouseWheelCallback(this);
  217333. this._onTouchStart = createTouchStartCallback(this);
  217334. this._onTouchMove = createTouchMoveCallback(this);
  217335. this._onTouchEnd = createTouchEndCallback(this);
  217336. const timeBarEle = this._timeBarEle;
  217337. ownerDocument.addEventListener("mouseup", this._onMouseUp, false);
  217338. ownerDocument.addEventListener("mousemove", this._onMouseMove, false);
  217339. timeBarEle.addEventListener("mousedown", this._onMouseDown, false);
  217340. timeBarEle.addEventListener("DOMMouseScroll", this._onMouseWheel, false);
  217341. timeBarEle.addEventListener("mousewheel", this._onMouseWheel, false);
  217342. timeBarEle.addEventListener("touchstart", this._onTouchStart, false);
  217343. timeBarEle.addEventListener("touchmove", this._onTouchMove, false);
  217344. timeBarEle.addEventListener("touchend", this._onTouchEnd, false);
  217345. timeBarEle.addEventListener("touchcancel", this._onTouchEnd, false);
  217346. this._topDiv.oncontextmenu = function() {
  217347. return false;
  217348. };
  217349. clock.onTick.addEventListener(this.updateFromClock, this);
  217350. this.updateFromClock();
  217351. }
  217352. Timeline.prototype.addEventListener = function(type, listener, useCapture) {
  217353. this._topDiv.addEventListener(type, listener, useCapture);
  217354. };
  217355. Timeline.prototype.removeEventListener = function(type, listener, useCapture) {
  217356. this._topDiv.removeEventListener(type, listener, useCapture);
  217357. };
  217358. Timeline.prototype.isDestroyed = function() {
  217359. return false;
  217360. };
  217361. Timeline.prototype.destroy = function() {
  217362. this._clock.onTick.removeEventListener(this.updateFromClock, this);
  217363. const doc = this.container.ownerDocument;
  217364. doc.removeEventListener("mouseup", this._onMouseUp, false);
  217365. doc.removeEventListener("mousemove", this._onMouseMove, false);
  217366. const timeBarEle = this._timeBarEle;
  217367. timeBarEle.removeEventListener("mousedown", this._onMouseDown, false);
  217368. timeBarEle.removeEventListener("DOMMouseScroll", this._onMouseWheel, false);
  217369. timeBarEle.removeEventListener("mousewheel", this._onMouseWheel, false);
  217370. timeBarEle.removeEventListener("touchstart", this._onTouchStart, false);
  217371. timeBarEle.removeEventListener("touchmove", this._onTouchMove, false);
  217372. timeBarEle.removeEventListener("touchend", this._onTouchEnd, false);
  217373. timeBarEle.removeEventListener("touchcancel", this._onTouchEnd, false);
  217374. this.container.removeChild(this._topDiv);
  217375. destroyObject_default(this);
  217376. };
  217377. Timeline.prototype.addHighlightRange = function(color, heightInPx, base) {
  217378. const newHighlightRange = new TimelineHighlightRange_default(color, heightInPx, base);
  217379. this._highlightRanges.push(newHighlightRange);
  217380. this.resize();
  217381. return newHighlightRange;
  217382. };
  217383. Timeline.prototype.addTrack = function(interval, heightInPx, color, backgroundColor) {
  217384. const newTrack = new TimelineTrack_default(
  217385. interval,
  217386. heightInPx,
  217387. color,
  217388. backgroundColor
  217389. );
  217390. this._trackList.push(newTrack);
  217391. this._lastHeight = void 0;
  217392. this.resize();
  217393. return newTrack;
  217394. };
  217395. Timeline.prototype.zoomTo = function(startTime, stopTime) {
  217396. if (!defined_default(startTime)) {
  217397. throw new DeveloperError_default("startTime is required.");
  217398. }
  217399. if (!defined_default(stopTime)) {
  217400. throw new DeveloperError_default("stopTime is required");
  217401. }
  217402. if (JulianDate_default.lessThanOrEquals(stopTime, startTime)) {
  217403. throw new DeveloperError_default("Start time must come before end time.");
  217404. }
  217405. this._startJulian = startTime;
  217406. this._endJulian = stopTime;
  217407. this._timeBarSecondsSpan = JulianDate_default.secondsDifference(stopTime, startTime);
  217408. if (this._clock && this._clock.clockRange !== ClockRange_default.UNBOUNDED) {
  217409. const clockStart = this._clock.startTime;
  217410. const clockEnd = this._clock.stopTime;
  217411. const clockSpan = JulianDate_default.secondsDifference(clockEnd, clockStart);
  217412. const startOffset = JulianDate_default.secondsDifference(
  217413. clockStart,
  217414. this._startJulian
  217415. );
  217416. const endOffset = JulianDate_default.secondsDifference(clockEnd, this._endJulian);
  217417. if (this._timeBarSecondsSpan >= clockSpan) {
  217418. this._timeBarSecondsSpan = clockSpan;
  217419. this._startJulian = this._clock.startTime;
  217420. this._endJulian = this._clock.stopTime;
  217421. } else if (startOffset > 0) {
  217422. this._endJulian = JulianDate_default.addSeconds(
  217423. this._endJulian,
  217424. startOffset,
  217425. new JulianDate_default()
  217426. );
  217427. this._startJulian = clockStart;
  217428. this._timeBarSecondsSpan = JulianDate_default.secondsDifference(
  217429. this._endJulian,
  217430. this._startJulian
  217431. );
  217432. } else if (endOffset < 0) {
  217433. this._startJulian = JulianDate_default.addSeconds(
  217434. this._startJulian,
  217435. endOffset,
  217436. new JulianDate_default()
  217437. );
  217438. this._endJulian = clockEnd;
  217439. this._timeBarSecondsSpan = JulianDate_default.secondsDifference(
  217440. this._endJulian,
  217441. this._startJulian
  217442. );
  217443. }
  217444. }
  217445. this._makeTics();
  217446. const evt = document.createEvent("Event");
  217447. evt.initEvent("setzoom", true, true);
  217448. evt.startJulian = this._startJulian;
  217449. evt.endJulian = this._endJulian;
  217450. evt.epochJulian = this._epochJulian;
  217451. evt.totalSpan = this._timeBarSecondsSpan;
  217452. evt.mainTicSpan = this._mainTicSpan;
  217453. this._topDiv.dispatchEvent(evt);
  217454. };
  217455. Timeline.prototype.zoomFrom = function(amount) {
  217456. let centerSec = JulianDate_default.secondsDifference(
  217457. this._scrubJulian,
  217458. this._startJulian
  217459. );
  217460. if (amount > 1 || centerSec < 0 || centerSec > this._timeBarSecondsSpan) {
  217461. centerSec = this._timeBarSecondsSpan * 0.5;
  217462. } else {
  217463. centerSec += centerSec - this._timeBarSecondsSpan * 0.5;
  217464. }
  217465. const centerSecFlip = this._timeBarSecondsSpan - centerSec;
  217466. this.zoomTo(
  217467. JulianDate_default.addSeconds(
  217468. this._startJulian,
  217469. centerSec - centerSec * amount,
  217470. new JulianDate_default()
  217471. ),
  217472. JulianDate_default.addSeconds(
  217473. this._endJulian,
  217474. centerSecFlip * amount - centerSecFlip,
  217475. new JulianDate_default()
  217476. )
  217477. );
  217478. };
  217479. function twoDigits(num) {
  217480. return num < 10 ? `0${num.toString()}` : num.toString();
  217481. }
  217482. Timeline.prototype.makeLabel = function(time) {
  217483. const gregorian = JulianDate_default.toGregorianDate(time);
  217484. const millisecond = gregorian.millisecond;
  217485. let millisecondString = " UTC";
  217486. if (millisecond > 0 && this._timeBarSecondsSpan < 3600) {
  217487. millisecondString = Math.floor(millisecond).toString();
  217488. while (millisecondString.length < 3) {
  217489. millisecondString = `0${millisecondString}`;
  217490. }
  217491. millisecondString = `.${millisecondString}`;
  217492. }
  217493. return `${timelineMonthNames[gregorian.month - 1]} ${gregorian.day} ${gregorian.year} ${twoDigits(gregorian.hour)}:${twoDigits(gregorian.minute)}:${twoDigits(
  217494. gregorian.second
  217495. )}${millisecondString}`;
  217496. };
  217497. Timeline.prototype.smallestTicInPixels = 7;
  217498. Timeline.prototype._makeTics = function() {
  217499. const timeBar = this._timeBarEle;
  217500. const seconds = JulianDate_default.secondsDifference(
  217501. this._scrubJulian,
  217502. this._startJulian
  217503. );
  217504. const xPos = Math.round(
  217505. seconds * this._topDiv.clientWidth / this._timeBarSecondsSpan
  217506. );
  217507. const scrubX = xPos - 8;
  217508. let tic;
  217509. const widget = this;
  217510. this._needleEle.style.left = `${xPos.toString()}px`;
  217511. let tics = "";
  217512. const minimumDuration = 0.01;
  217513. const maximumDuration = 31536e6;
  217514. const epsilon = 1e-10;
  217515. let minSize = 0;
  217516. let duration = this._timeBarSecondsSpan;
  217517. if (duration < minimumDuration) {
  217518. duration = minimumDuration;
  217519. this._timeBarSecondsSpan = minimumDuration;
  217520. this._endJulian = JulianDate_default.addSeconds(
  217521. this._startJulian,
  217522. minimumDuration,
  217523. new JulianDate_default()
  217524. );
  217525. } else if (duration > maximumDuration) {
  217526. duration = maximumDuration;
  217527. this._timeBarSecondsSpan = maximumDuration;
  217528. this._endJulian = JulianDate_default.addSeconds(
  217529. this._startJulian,
  217530. maximumDuration,
  217531. new JulianDate_default()
  217532. );
  217533. }
  217534. let timeBarWidth = this._timeBarEle.clientWidth;
  217535. if (timeBarWidth < 10) {
  217536. timeBarWidth = 10;
  217537. }
  217538. const startJulian = this._startJulian;
  217539. const epsilonTime = Math.min(duration / timeBarWidth * 1e-5, 0.4);
  217540. let epochJulian;
  217541. const gregorianDate = JulianDate_default.toGregorianDate(startJulian);
  217542. if (duration > 31536e4) {
  217543. epochJulian = JulianDate_default.fromDate(
  217544. new Date(Date.UTC(Math.floor(gregorianDate.year / 100) * 100, 0))
  217545. );
  217546. } else if (duration > 31536e3) {
  217547. epochJulian = JulianDate_default.fromDate(
  217548. new Date(Date.UTC(Math.floor(gregorianDate.year / 10) * 10, 0))
  217549. );
  217550. } else if (duration > 86400) {
  217551. epochJulian = JulianDate_default.fromDate(
  217552. new Date(Date.UTC(gregorianDate.year, 0))
  217553. );
  217554. } else {
  217555. epochJulian = JulianDate_default.fromDate(
  217556. new Date(
  217557. Date.UTC(gregorianDate.year, gregorianDate.month, gregorianDate.day)
  217558. )
  217559. );
  217560. }
  217561. const startTime = JulianDate_default.secondsDifference(
  217562. this._startJulian,
  217563. JulianDate_default.addSeconds(epochJulian, epsilonTime, new JulianDate_default())
  217564. );
  217565. let endTime = startTime + duration;
  217566. this._epochJulian = epochJulian;
  217567. function getStartTic(ticScale) {
  217568. return Math.floor(startTime / ticScale) * ticScale;
  217569. }
  217570. function getNextTic(tic2, ticScale) {
  217571. return Math.ceil(tic2 / ticScale + 0.5) * ticScale;
  217572. }
  217573. function getAlpha(time) {
  217574. return (time - startTime) / duration;
  217575. }
  217576. function remainder(x, y) {
  217577. return x - y * Math.round(x / y);
  217578. }
  217579. this._rulerEle.innerHTML = this.makeLabel(
  217580. JulianDate_default.addSeconds(this._endJulian, -minimumDuration, new JulianDate_default())
  217581. );
  217582. let sampleWidth = this._rulerEle.offsetWidth + 20;
  217583. if (sampleWidth < 30) {
  217584. sampleWidth = 180;
  217585. }
  217586. const origMinSize = minSize;
  217587. minSize -= epsilon;
  217588. const renderState = {
  217589. startTime,
  217590. startJulian,
  217591. epochJulian,
  217592. duration,
  217593. timeBarWidth,
  217594. getAlpha
  217595. };
  217596. this._highlightRanges.forEach(function(highlightRange) {
  217597. tics += highlightRange.render(renderState);
  217598. });
  217599. let mainTic = 0, subTic = 0, tinyTic = 0;
  217600. let idealTic = sampleWidth / timeBarWidth;
  217601. if (idealTic > 1) {
  217602. idealTic = 1;
  217603. }
  217604. idealTic *= this._timeBarSecondsSpan;
  217605. let ticIndex = -1, smallestIndex = -1;
  217606. const ticScaleLen = timelineTicScales.length;
  217607. let i2;
  217608. for (i2 = 0; i2 < ticScaleLen; ++i2) {
  217609. const sc = timelineTicScales[i2];
  217610. ++ticIndex;
  217611. mainTic = sc;
  217612. if (sc > idealTic && sc > minSize) {
  217613. break;
  217614. }
  217615. if (smallestIndex < 0 && timeBarWidth * (sc / this._timeBarSecondsSpan) >= this.smallestTicInPixels) {
  217616. smallestIndex = ticIndex;
  217617. }
  217618. }
  217619. if (ticIndex > 0) {
  217620. while (ticIndex > 0) {
  217621. --ticIndex;
  217622. if (Math.abs(remainder(mainTic, timelineTicScales[ticIndex])) < 1e-5) {
  217623. if (timelineTicScales[ticIndex] >= minSize) {
  217624. subTic = timelineTicScales[ticIndex];
  217625. }
  217626. break;
  217627. }
  217628. }
  217629. if (smallestIndex >= 0) {
  217630. while (smallestIndex < ticIndex) {
  217631. if (Math.abs(remainder(subTic, timelineTicScales[smallestIndex])) < 1e-5 && timelineTicScales[smallestIndex] >= minSize) {
  217632. tinyTic = timelineTicScales[smallestIndex];
  217633. break;
  217634. }
  217635. ++smallestIndex;
  217636. }
  217637. }
  217638. }
  217639. minSize = origMinSize;
  217640. if (minSize > epsilon && tinyTic < 1e-5 && Math.abs(minSize - mainTic) > epsilon) {
  217641. tinyTic = minSize;
  217642. if (minSize <= mainTic + epsilon) {
  217643. subTic = 0;
  217644. }
  217645. }
  217646. let lastTextLeft = -999999, textWidth;
  217647. if (timeBarWidth * (tinyTic / this._timeBarSecondsSpan) >= 3) {
  217648. for (tic = getStartTic(tinyTic); tic <= endTime; tic = getNextTic(tic, tinyTic)) {
  217649. tics += `<span class="cesium-timeline-ticTiny" style="left: ${Math.round(
  217650. timeBarWidth * getAlpha(tic)
  217651. ).toString()}px;"></span>`;
  217652. }
  217653. }
  217654. if (timeBarWidth * (subTic / this._timeBarSecondsSpan) >= 3) {
  217655. for (tic = getStartTic(subTic); tic <= endTime; tic = getNextTic(tic, subTic)) {
  217656. tics += `<span class="cesium-timeline-ticSub" style="left: ${Math.round(
  217657. timeBarWidth * getAlpha(tic)
  217658. ).toString()}px;"></span>`;
  217659. }
  217660. }
  217661. if (timeBarWidth * (mainTic / this._timeBarSecondsSpan) >= 2) {
  217662. this._mainTicSpan = mainTic;
  217663. endTime += mainTic;
  217664. tic = getStartTic(mainTic);
  217665. const leapSecond = JulianDate_default.computeTaiMinusUtc(epochJulian);
  217666. while (tic <= endTime) {
  217667. let ticTime = JulianDate_default.addSeconds(
  217668. startJulian,
  217669. tic - startTime,
  217670. new JulianDate_default()
  217671. );
  217672. if (mainTic > 2.1) {
  217673. const ticLeap = JulianDate_default.computeTaiMinusUtc(ticTime);
  217674. if (Math.abs(ticLeap - leapSecond) > 0.1) {
  217675. tic += ticLeap - leapSecond;
  217676. ticTime = JulianDate_default.addSeconds(
  217677. startJulian,
  217678. tic - startTime,
  217679. new JulianDate_default()
  217680. );
  217681. }
  217682. }
  217683. const ticLeft = Math.round(timeBarWidth * getAlpha(tic));
  217684. const ticLabel = this.makeLabel(ticTime);
  217685. this._rulerEle.innerHTML = ticLabel;
  217686. textWidth = this._rulerEle.offsetWidth;
  217687. if (textWidth < 10) {
  217688. textWidth = sampleWidth;
  217689. }
  217690. const labelLeft = ticLeft - (textWidth / 2 - 1);
  217691. if (labelLeft > lastTextLeft) {
  217692. lastTextLeft = labelLeft + textWidth + 5;
  217693. tics += `<span class="cesium-timeline-ticMain" style="left: ${ticLeft.toString()}px;"></span><span class="cesium-timeline-ticLabel" style="left: ${labelLeft.toString()}px;">${ticLabel}</span>`;
  217694. } else {
  217695. tics += `<span class="cesium-timeline-ticSub" style="left: ${ticLeft.toString()}px;"></span>`;
  217696. }
  217697. tic = getNextTic(tic, mainTic);
  217698. }
  217699. } else {
  217700. this._mainTicSpan = -1;
  217701. }
  217702. tics += `<span class="cesium-timeline-icon16" style="left:${scrubX}px;bottom:0;background-position: 0 0;"></span>`;
  217703. timeBar.innerHTML = tics;
  217704. this._scrubElement = timeBar.lastChild;
  217705. this._context.clearRect(
  217706. 0,
  217707. 0,
  217708. this._trackListEle.width,
  217709. this._trackListEle.height
  217710. );
  217711. renderState.y = 0;
  217712. this._trackList.forEach(function(track2) {
  217713. track2.render(widget._context, renderState);
  217714. renderState.y += track2.height;
  217715. });
  217716. };
  217717. Timeline.prototype.updateFromClock = function() {
  217718. this._scrubJulian = this._clock.currentTime;
  217719. const scrubElement = this._scrubElement;
  217720. if (defined_default(this._scrubElement)) {
  217721. const seconds = JulianDate_default.secondsDifference(
  217722. this._scrubJulian,
  217723. this._startJulian
  217724. );
  217725. const xPos = Math.round(
  217726. seconds * this._topDiv.clientWidth / this._timeBarSecondsSpan
  217727. );
  217728. if (this._lastXPos !== xPos) {
  217729. this._lastXPos = xPos;
  217730. scrubElement.style.left = `${xPos - 8}px`;
  217731. this._needleEle.style.left = `${xPos}px`;
  217732. }
  217733. }
  217734. if (defined_default(this._timelineDragLocation)) {
  217735. this._setTimeBarTime(
  217736. this._timelineDragLocation,
  217737. this._timelineDragLocation * this._timeBarSecondsSpan / this._topDiv.clientWidth
  217738. );
  217739. this.zoomTo(
  217740. JulianDate_default.addSeconds(
  217741. this._startJulian,
  217742. this._timelineDrag,
  217743. new JulianDate_default()
  217744. ),
  217745. JulianDate_default.addSeconds(
  217746. this._endJulian,
  217747. this._timelineDrag,
  217748. new JulianDate_default()
  217749. )
  217750. );
  217751. }
  217752. };
  217753. Timeline.prototype._setTimeBarTime = function(xPos, seconds) {
  217754. xPos = Math.round(xPos);
  217755. this._scrubJulian = JulianDate_default.addSeconds(
  217756. this._startJulian,
  217757. seconds,
  217758. new JulianDate_default()
  217759. );
  217760. if (this._scrubElement) {
  217761. const scrubX = xPos - 8;
  217762. this._scrubElement.style.left = `${scrubX.toString()}px`;
  217763. this._needleEle.style.left = `${xPos.toString()}px`;
  217764. }
  217765. const evt = document.createEvent("Event");
  217766. evt.initEvent("settime", true, true);
  217767. evt.clientX = xPos;
  217768. evt.timeSeconds = seconds;
  217769. evt.timeJulian = this._scrubJulian;
  217770. evt.clock = this._clock;
  217771. this._topDiv.dispatchEvent(evt);
  217772. };
  217773. function createMouseDownCallback(timeline) {
  217774. return function(e2) {
  217775. if (timeline._mouseMode !== timelineMouseMode.touchOnly) {
  217776. if (e2.button === 0) {
  217777. timeline._mouseMode = timelineMouseMode.scrub;
  217778. if (timeline._scrubElement) {
  217779. timeline._scrubElement.style.backgroundPosition = "-16px 0";
  217780. }
  217781. timeline._onMouseMove(e2);
  217782. } else {
  217783. timeline._mouseX = e2.clientX;
  217784. if (e2.button === 2) {
  217785. timeline._mouseMode = timelineMouseMode.zoom;
  217786. } else {
  217787. timeline._mouseMode = timelineMouseMode.slide;
  217788. }
  217789. }
  217790. }
  217791. e2.preventDefault();
  217792. };
  217793. }
  217794. function createMouseUpCallback(timeline) {
  217795. return function(e2) {
  217796. timeline._mouseMode = timelineMouseMode.none;
  217797. if (timeline._scrubElement) {
  217798. timeline._scrubElement.style.backgroundPosition = "0 0";
  217799. }
  217800. timeline._timelineDrag = 0;
  217801. timeline._timelineDragLocation = void 0;
  217802. };
  217803. }
  217804. function createMouseMoveCallback(timeline) {
  217805. return function(e2) {
  217806. let dx;
  217807. if (timeline._mouseMode === timelineMouseMode.scrub) {
  217808. e2.preventDefault();
  217809. const x = e2.clientX - timeline._topDiv.getBoundingClientRect().left;
  217810. if (x < 0) {
  217811. timeline._timelineDragLocation = 0;
  217812. timeline._timelineDrag = -0.01 * timeline._timeBarSecondsSpan;
  217813. } else if (x > timeline._topDiv.clientWidth) {
  217814. timeline._timelineDragLocation = timeline._topDiv.clientWidth;
  217815. timeline._timelineDrag = 0.01 * timeline._timeBarSecondsSpan;
  217816. } else {
  217817. timeline._timelineDragLocation = void 0;
  217818. timeline._setTimeBarTime(
  217819. x,
  217820. x * timeline._timeBarSecondsSpan / timeline._topDiv.clientWidth
  217821. );
  217822. }
  217823. } else if (timeline._mouseMode === timelineMouseMode.slide) {
  217824. dx = timeline._mouseX - e2.clientX;
  217825. timeline._mouseX = e2.clientX;
  217826. if (dx !== 0) {
  217827. const dsec = dx * timeline._timeBarSecondsSpan / timeline._topDiv.clientWidth;
  217828. timeline.zoomTo(
  217829. JulianDate_default.addSeconds(timeline._startJulian, dsec, new JulianDate_default()),
  217830. JulianDate_default.addSeconds(timeline._endJulian, dsec, new JulianDate_default())
  217831. );
  217832. }
  217833. } else if (timeline._mouseMode === timelineMouseMode.zoom) {
  217834. dx = timeline._mouseX - e2.clientX;
  217835. timeline._mouseX = e2.clientX;
  217836. if (dx !== 0) {
  217837. timeline.zoomFrom(Math.pow(1.01, dx));
  217838. }
  217839. }
  217840. };
  217841. }
  217842. function createMouseWheelCallback(timeline) {
  217843. return function(e2) {
  217844. let dy = e2.wheelDeltaY || e2.wheelDelta || -e2.detail;
  217845. timelineWheelDelta = Math.max(
  217846. Math.min(Math.abs(dy), timelineWheelDelta),
  217847. 1
  217848. );
  217849. dy /= timelineWheelDelta;
  217850. timeline.zoomFrom(Math.pow(1.05, -dy));
  217851. };
  217852. }
  217853. function createTouchStartCallback(timeline) {
  217854. return function(e2) {
  217855. const len = e2.touches.length;
  217856. let seconds, xPos;
  217857. const leftX = timeline._topDiv.getBoundingClientRect().left;
  217858. e2.preventDefault();
  217859. timeline._mouseMode = timelineMouseMode.touchOnly;
  217860. if (len === 1) {
  217861. seconds = JulianDate_default.secondsDifference(
  217862. timeline._scrubJulian,
  217863. timeline._startJulian
  217864. );
  217865. xPos = Math.round(
  217866. seconds * timeline._topDiv.clientWidth / timeline._timeBarSecondsSpan + leftX
  217867. );
  217868. if (Math.abs(e2.touches[0].clientX - xPos) < 50) {
  217869. timeline._touchMode = timelineTouchMode.scrub;
  217870. if (timeline._scrubElement) {
  217871. timeline._scrubElement.style.backgroundPosition = len === 1 ? "-16px 0" : "0 0";
  217872. }
  217873. } else {
  217874. timeline._touchMode = timelineTouchMode.singleTap;
  217875. timeline._touchState.centerX = e2.touches[0].clientX - leftX;
  217876. }
  217877. } else if (len === 2) {
  217878. timeline._touchMode = timelineTouchMode.slideZoom;
  217879. timeline._touchState.centerX = (e2.touches[0].clientX + e2.touches[1].clientX) * 0.5 - leftX;
  217880. timeline._touchState.spanX = Math.abs(
  217881. e2.touches[0].clientX - e2.touches[1].clientX
  217882. );
  217883. } else {
  217884. timeline._touchMode = timelineTouchMode.ignore;
  217885. }
  217886. };
  217887. }
  217888. function createTouchEndCallback(timeline) {
  217889. return function(e2) {
  217890. const len = e2.touches.length, leftX = timeline._topDiv.getBoundingClientRect().left;
  217891. if (timeline._touchMode === timelineTouchMode.singleTap) {
  217892. timeline._touchMode = timelineTouchMode.scrub;
  217893. timeline._onTouchMove(e2);
  217894. } else if (timeline._touchMode === timelineTouchMode.scrub) {
  217895. timeline._onTouchMove(e2);
  217896. }
  217897. timeline._mouseMode = timelineMouseMode.touchOnly;
  217898. if (len !== 1) {
  217899. timeline._touchMode = len > 0 ? timelineTouchMode.ignore : timelineTouchMode.none;
  217900. } else if (timeline._touchMode === timelineTouchMode.slideZoom) {
  217901. timeline._touchState.centerX = e2.touches[0].clientX - leftX;
  217902. }
  217903. if (timeline._scrubElement) {
  217904. timeline._scrubElement.style.backgroundPosition = "0 0";
  217905. }
  217906. };
  217907. }
  217908. function createTouchMoveCallback(timeline) {
  217909. return function(e2) {
  217910. let dx, x, len, newCenter, newSpan, newStartTime, zoom = 1;
  217911. const leftX = timeline._topDiv.getBoundingClientRect().left;
  217912. if (timeline._touchMode === timelineTouchMode.singleTap) {
  217913. timeline._touchMode = timelineTouchMode.slideZoom;
  217914. }
  217915. timeline._mouseMode = timelineMouseMode.touchOnly;
  217916. if (timeline._touchMode === timelineTouchMode.scrub) {
  217917. e2.preventDefault();
  217918. if (e2.changedTouches.length === 1) {
  217919. x = e2.changedTouches[0].clientX - leftX;
  217920. if (x >= 0 && x <= timeline._topDiv.clientWidth) {
  217921. timeline._setTimeBarTime(
  217922. x,
  217923. x * timeline._timeBarSecondsSpan / timeline._topDiv.clientWidth
  217924. );
  217925. }
  217926. }
  217927. } else if (timeline._touchMode === timelineTouchMode.slideZoom) {
  217928. len = e2.touches.length;
  217929. if (len === 2) {
  217930. newCenter = (e2.touches[0].clientX + e2.touches[1].clientX) * 0.5 - leftX;
  217931. newSpan = Math.abs(e2.touches[0].clientX - e2.touches[1].clientX);
  217932. } else if (len === 1) {
  217933. newCenter = e2.touches[0].clientX - leftX;
  217934. newSpan = 0;
  217935. }
  217936. if (defined_default(newCenter)) {
  217937. if (newSpan > 0 && timeline._touchState.spanX > 0) {
  217938. zoom = timeline._touchState.spanX / newSpan;
  217939. newStartTime = JulianDate_default.addSeconds(
  217940. timeline._startJulian,
  217941. (timeline._touchState.centerX * timeline._timeBarSecondsSpan - newCenter * timeline._timeBarSecondsSpan * zoom) / timeline._topDiv.clientWidth,
  217942. new JulianDate_default()
  217943. );
  217944. } else {
  217945. dx = timeline._touchState.centerX - newCenter;
  217946. newStartTime = JulianDate_default.addSeconds(
  217947. timeline._startJulian,
  217948. dx * timeline._timeBarSecondsSpan / timeline._topDiv.clientWidth,
  217949. new JulianDate_default()
  217950. );
  217951. }
  217952. timeline.zoomTo(
  217953. newStartTime,
  217954. JulianDate_default.addSeconds(
  217955. newStartTime,
  217956. timeline._timeBarSecondsSpan * zoom,
  217957. new JulianDate_default()
  217958. )
  217959. );
  217960. timeline._touchState.centerX = newCenter;
  217961. timeline._touchState.spanX = newSpan;
  217962. }
  217963. }
  217964. };
  217965. }
  217966. Timeline.prototype.resize = function() {
  217967. const width = this.container.clientWidth;
  217968. const height = this.container.clientHeight;
  217969. if (width === this._lastWidth && height === this._lastHeight) {
  217970. return;
  217971. }
  217972. this._trackContainer.style.height = `${height}px`;
  217973. let trackListHeight = 1;
  217974. this._trackList.forEach(function(track2) {
  217975. trackListHeight += track2.height;
  217976. });
  217977. this._trackListEle.style.height = `${trackListHeight.toString()}px`;
  217978. this._trackListEle.width = this._trackListEle.clientWidth;
  217979. this._trackListEle.height = trackListHeight;
  217980. this._makeTics();
  217981. this._lastXPos = void 0;
  217982. this._lastWidth = width;
  217983. this._lastHeight = height;
  217984. };
  217985. var Timeline_default = Timeline;
  217986. // node_modules/cesium/Source/Widgets/VRButton/VRButtonViewModel.js
  217987. function lockScreen(orientation) {
  217988. let locked = false;
  217989. const screen = window.screen;
  217990. if (defined_default(screen)) {
  217991. if (defined_default(screen.lockOrientation)) {
  217992. locked = screen.lockOrientation(orientation);
  217993. } else if (defined_default(screen.mozLockOrientation)) {
  217994. locked = screen.mozLockOrientation(orientation);
  217995. } else if (defined_default(screen.msLockOrientation)) {
  217996. locked = screen.msLockOrientation(orientation);
  217997. } else if (defined_default(screen.orientation && screen.orientation.lock)) {
  217998. locked = screen.orientation.lock(orientation);
  217999. }
  218000. }
  218001. return locked;
  218002. }
  218003. function unlockScreen() {
  218004. const screen = window.screen;
  218005. if (defined_default(screen)) {
  218006. if (defined_default(screen.unlockOrientation)) {
  218007. screen.unlockOrientation();
  218008. } else if (defined_default(screen.mozUnlockOrientation)) {
  218009. screen.mozUnlockOrientation();
  218010. } else if (defined_default(screen.msUnlockOrientation)) {
  218011. screen.msUnlockOrientation();
  218012. } else if (defined_default(screen.orientation && screen.orientation.unlock)) {
  218013. screen.orientation.unlock();
  218014. }
  218015. }
  218016. }
  218017. function toggleVR(viewModel, scene, isVRMode, isOrthographic) {
  218018. if (isOrthographic()) {
  218019. return;
  218020. }
  218021. if (isVRMode()) {
  218022. scene.useWebVR = false;
  218023. if (viewModel._locked) {
  218024. unlockScreen();
  218025. viewModel._locked = false;
  218026. }
  218027. viewModel._noSleep.disable();
  218028. Fullscreen_default.exitFullscreen();
  218029. isVRMode(false);
  218030. } else {
  218031. if (!Fullscreen_default.fullscreen) {
  218032. Fullscreen_default.requestFullscreen(viewModel._vrElement);
  218033. }
  218034. viewModel._noSleep.enable();
  218035. if (!viewModel._locked) {
  218036. viewModel._locked = lockScreen("landscape");
  218037. }
  218038. scene.useWebVR = true;
  218039. isVRMode(true);
  218040. }
  218041. }
  218042. function VRButtonViewModel(scene, vrElement) {
  218043. if (!defined_default(scene)) {
  218044. throw new DeveloperError_default("scene is required.");
  218045. }
  218046. const that = this;
  218047. const isEnabled = knockout_default.observable(Fullscreen_default.enabled);
  218048. const isVRMode = knockout_default.observable(false);
  218049. this.isVRMode = void 0;
  218050. knockout_default.defineProperty(this, "isVRMode", {
  218051. get: function() {
  218052. return isVRMode();
  218053. }
  218054. });
  218055. this.isVREnabled = void 0;
  218056. knockout_default.defineProperty(this, "isVREnabled", {
  218057. get: function() {
  218058. return isEnabled();
  218059. },
  218060. set: function(value) {
  218061. isEnabled(value && Fullscreen_default.enabled);
  218062. }
  218063. });
  218064. this.tooltip = void 0;
  218065. knockout_default.defineProperty(this, "tooltip", function() {
  218066. if (!isEnabled()) {
  218067. return "VR mode is unavailable";
  218068. }
  218069. return isVRMode() ? "Exit VR mode" : "Enter VR mode";
  218070. });
  218071. const isOrthographic = knockout_default.observable(false);
  218072. this._isOrthographic = void 0;
  218073. knockout_default.defineProperty(this, "_isOrthographic", {
  218074. get: function() {
  218075. return isOrthographic();
  218076. }
  218077. });
  218078. this._eventHelper = new EventHelper_default();
  218079. this._eventHelper.add(scene.preRender, function() {
  218080. isOrthographic(scene.camera.frustum instanceof OrthographicFrustum_default);
  218081. });
  218082. this._locked = false;
  218083. this._noSleep = new src();
  218084. this._command = createCommand_default(function() {
  218085. toggleVR(that, scene, isVRMode, isOrthographic);
  218086. }, knockout_default.getObservable(this, "isVREnabled"));
  218087. this._vrElement = defaultValue_default(getElement_default(vrElement), document.body);
  218088. this._callback = function() {
  218089. if (!Fullscreen_default.fullscreen && isVRMode()) {
  218090. scene.useWebVR = false;
  218091. if (that._locked) {
  218092. unlockScreen();
  218093. that._locked = false;
  218094. }
  218095. that._noSleep.disable();
  218096. isVRMode(false);
  218097. }
  218098. };
  218099. document.addEventListener(Fullscreen_default.changeEventName, this._callback);
  218100. }
  218101. Object.defineProperties(VRButtonViewModel.prototype, {
  218102. vrElement: {
  218103. get: function() {
  218104. return this._vrElement;
  218105. },
  218106. set: function(value) {
  218107. if (!(value instanceof Element)) {
  218108. throw new DeveloperError_default("value must be a valid Element.");
  218109. }
  218110. this._vrElement = value;
  218111. }
  218112. },
  218113. command: {
  218114. get: function() {
  218115. return this._command;
  218116. }
  218117. }
  218118. });
  218119. VRButtonViewModel.prototype.isDestroyed = function() {
  218120. return false;
  218121. };
  218122. VRButtonViewModel.prototype.destroy = function() {
  218123. this._eventHelper.removeAll();
  218124. document.removeEventListener(Fullscreen_default.changeEventName, this._callback);
  218125. destroyObject_default(this);
  218126. };
  218127. var VRButtonViewModel_default = VRButtonViewModel;
  218128. // node_modules/cesium/Source/Widgets/VRButton/VRButton.js
  218129. var enterVRPath = "M 5.3125 6.375 C 4.008126 6.375 2.96875 7.4141499 2.96875 8.71875 L 2.96875 19.5 C 2.96875 20.8043 4.008126 21.875 5.3125 21.875 L 13.65625 21.875 C 13.71832 20.0547 14.845166 18.59375 16.21875 18.59375 C 17.592088 18.59375 18.71881 20.0552 18.78125 21.875 L 27.09375 21.875 C 28.398125 21.875 29.4375 20.8043 29.4375 19.5 L 29.4375 8.71875 C 29.4375 7.4141499 28.398125 6.375 27.09375 6.375 L 5.3125 6.375 z M 9.625 10.4375 C 11.55989 10.4375 13.125 12.03385 13.125 13.96875 C 13.125 15.90365 11.55989 17.46875 9.625 17.46875 C 7.69011 17.46875 6.125 15.90365 6.125 13.96875 C 6.125 12.03385 7.69011 10.4375 9.625 10.4375 z M 22.46875 10.4375 C 24.40364 10.4375 25.96875 12.03385 25.96875 13.96875 C 25.96875 15.90365 24.40364 17.46875 22.46875 17.46875 C 20.53386 17.46875 18.96875 15.90365 18.96875 13.96875 C 18.96875 12.03385 20.53386 10.4375 22.46875 10.4375 z";
  218130. var exitVRPath = "M 25.770585,2.4552065 C 15.72282,13.962707 10.699956,19.704407 8.1768352,22.580207 c -1.261561,1.4379 -1.902282,2.1427 -2.21875,2.5 -0.141624,0.1599 -0.208984,0.2355 -0.25,0.2813 l 0.6875,0.75 c 10e-5,-10e-5 0.679191,0.727 0.6875,0.7187 0.01662,-0.016 0.02451,-0.024 0.03125,-0.031 0.01348,-0.014 0.04013,-0.038 0.0625,-0.062 0.04474,-0.05 0.120921,-0.1315 0.28125,-0.3126 0.320657,-0.3619 0.956139,-1.0921 2.2187499,-2.5312 2.5252219,-2.8781 7.5454589,-8.6169 17.5937499,-20.1250005 l -1.5,-1.3125 z m -20.5624998,3.9063 c -1.304375,0 -2.34375,1.0391 -2.34375,2.3437 l 0,10.8125005 c 0,1.3043 1.039375,2.375 2.34375,2.375 l 2.25,0 c 1.9518039,-2.2246 7.4710958,-8.5584 13.5624998,-15.5312005 l -15.8124998,0 z m 21.1249998,0 c -1.855467,2.1245 -2.114296,2.4005 -3.59375,4.0936995 1.767282,0.1815 3.15625,1.685301 3.15625,3.500001 0,1.9349 -1.56511,3.5 -3.5,3.5 -1.658043,0 -3.043426,-1.1411 -3.40625,-2.6875 -1.089617,1.2461 -2.647139,2.9988 -3.46875,3.9375 0.191501,-0.062 0.388502,-0.094 0.59375,-0.094 1.373338,0 2.50006,1.4614 2.5625,3.2812 l 8.3125,0 c 1.304375,0 2.34375,-1.0707 2.34375,-2.375 l 0,-10.8125005 c 0,-1.3046 -1.039375,-2.3437 -2.34375,-2.3437 l -0.65625,0 z M 9.5518351,10.423906 c 1.9348899,0 3.4999999,1.596401 3.4999999,3.531301 0,1.9349 -1.56511,3.5 -3.4999999,3.5 -1.9348899,0 -3.4999999,-1.5651 -3.4999999,-3.5 0,-1.9349 1.56511,-3.531301 3.4999999,-3.531301 z m 4.2187499,10.312601 c -0.206517,0.2356 -0.844218,0.9428 -1.03125,1.1562 l 0.8125,0 c 0.01392,-0.4081 0.107026,-0.7968 0.21875,-1.1562 z";
  218131. function VRButton(container, scene, vrElement) {
  218132. if (!defined_default(container)) {
  218133. throw new DeveloperError_default("container is required.");
  218134. }
  218135. if (!defined_default(scene)) {
  218136. throw new DeveloperError_default("scene is required.");
  218137. }
  218138. container = getElement_default(container);
  218139. const viewModel = new VRButtonViewModel_default(scene, vrElement);
  218140. viewModel._exitVRPath = exitVRPath;
  218141. viewModel._enterVRPath = enterVRPath;
  218142. const element = document.createElement("button");
  218143. element.type = "button";
  218144. element.className = "cesium-button cesium-vrButton";
  218145. element.setAttribute(
  218146. "data-bind",
  218147. 'css: { "cesium-button-disabled" : _isOrthographic }, attr: { title: tooltip },click: command,enable: isVREnabled,cesiumSvgPath: { path: isVRMode ? _exitVRPath : _enterVRPath, width: 32, height: 32 }'
  218148. );
  218149. container.appendChild(element);
  218150. knockout_default.applyBindings(viewModel, element);
  218151. this._container = container;
  218152. this._viewModel = viewModel;
  218153. this._element = element;
  218154. }
  218155. Object.defineProperties(VRButton.prototype, {
  218156. container: {
  218157. get: function() {
  218158. return this._container;
  218159. }
  218160. },
  218161. viewModel: {
  218162. get: function() {
  218163. return this._viewModel;
  218164. }
  218165. }
  218166. });
  218167. VRButton.prototype.isDestroyed = function() {
  218168. return false;
  218169. };
  218170. VRButton.prototype.destroy = function() {
  218171. this._viewModel.destroy();
  218172. knockout_default.cleanNode(this._element);
  218173. this._container.removeChild(this._element);
  218174. return destroyObject_default(this);
  218175. };
  218176. var VRButton_default = VRButton;
  218177. // node_modules/cesium/Source/Widgets/Viewer/Viewer.js
  218178. var boundingSphereScratch4 = new BoundingSphere_default();
  218179. function onTimelineScrubfunction(e2) {
  218180. const clock = e2.clock;
  218181. clock.currentTime = e2.timeJulian;
  218182. clock.shouldAnimate = false;
  218183. }
  218184. function getCesium3DTileFeatureDescription(feature2) {
  218185. const propertyNames = feature2.getPropertyNames();
  218186. let html2 = "";
  218187. propertyNames.forEach(function(propertyName) {
  218188. const value = feature2.getProperty(propertyName);
  218189. if (defined_default(value)) {
  218190. html2 += `<tr><th>${propertyName}</th><td>${value}</td></tr>`;
  218191. }
  218192. });
  218193. if (html2.length > 0) {
  218194. html2 = `<table class="cesium-infoBox-defaultTable"><tbody>${html2}</tbody></table>`;
  218195. }
  218196. return html2;
  218197. }
  218198. function getCesium3DTileFeatureName(feature2) {
  218199. let i2;
  218200. const possibleNames = [];
  218201. const propertyNames = feature2.getPropertyNames();
  218202. for (i2 = 0; i2 < propertyNames.length; i2++) {
  218203. const propertyName = propertyNames[i2];
  218204. if (/^name$/i.test(propertyName)) {
  218205. possibleNames[0] = feature2.getProperty(propertyName);
  218206. } else if (/name/i.test(propertyName)) {
  218207. possibleNames[1] = feature2.getProperty(propertyName);
  218208. } else if (/^title$/i.test(propertyName)) {
  218209. possibleNames[2] = feature2.getProperty(propertyName);
  218210. } else if (/^(id|identifier)$/i.test(propertyName)) {
  218211. possibleNames[3] = feature2.getProperty(propertyName);
  218212. } else if (/element/i.test(propertyName)) {
  218213. possibleNames[4] = feature2.getProperty(propertyName);
  218214. } else if (/(id|identifier)$/i.test(propertyName)) {
  218215. possibleNames[5] = feature2.getProperty(propertyName);
  218216. }
  218217. }
  218218. const length3 = possibleNames.length;
  218219. for (i2 = 0; i2 < length3; i2++) {
  218220. const item = possibleNames[i2];
  218221. if (defined_default(item) && item !== "") {
  218222. return item;
  218223. }
  218224. }
  218225. return "Unnamed Feature";
  218226. }
  218227. function pickEntity(viewer, e2) {
  218228. const picked = viewer.scene.pick(e2.position);
  218229. if (defined_default(picked)) {
  218230. const id = defaultValue_default(picked.id, picked.primitive.id);
  218231. if (id instanceof Entity_default) {
  218232. return id;
  218233. }
  218234. if (picked instanceof Cesium3DTileFeature_default) {
  218235. return new Entity_default({
  218236. name: getCesium3DTileFeatureName(picked),
  218237. description: getCesium3DTileFeatureDescription(picked),
  218238. feature: picked
  218239. });
  218240. }
  218241. }
  218242. if (defined_default(viewer.scene.globe)) {
  218243. return pickImageryLayerFeature(viewer, e2.position);
  218244. }
  218245. }
  218246. var scratchStopTime = new JulianDate_default();
  218247. function trackDataSourceClock(timeline, clock, dataSource) {
  218248. if (defined_default(dataSource)) {
  218249. const dataSourceClock = dataSource.clock;
  218250. if (defined_default(dataSourceClock)) {
  218251. dataSourceClock.getValue(clock);
  218252. if (defined_default(timeline)) {
  218253. const startTime = dataSourceClock.startTime;
  218254. let stopTime = dataSourceClock.stopTime;
  218255. if (JulianDate_default.equals(startTime, stopTime)) {
  218256. stopTime = JulianDate_default.addSeconds(
  218257. startTime,
  218258. Math_default.EPSILON2,
  218259. scratchStopTime
  218260. );
  218261. }
  218262. timeline.updateFromClock();
  218263. timeline.zoomTo(startTime, stopTime);
  218264. }
  218265. }
  218266. }
  218267. }
  218268. var cartesian3Scratch8 = new Cartesian3_default();
  218269. function pickImageryLayerFeature(viewer, windowPosition) {
  218270. const scene = viewer.scene;
  218271. const pickRay = scene.camera.getPickRay(windowPosition);
  218272. const imageryLayerFeaturePromise = scene.imageryLayers.pickImageryLayerFeatures(
  218273. pickRay,
  218274. scene
  218275. );
  218276. if (!defined_default(imageryLayerFeaturePromise)) {
  218277. return;
  218278. }
  218279. const loadingMessage = new Entity_default({
  218280. id: "Loading...",
  218281. description: "Loading feature information..."
  218282. });
  218283. imageryLayerFeaturePromise.then(
  218284. function(features) {
  218285. if (viewer.selectedEntity !== loadingMessage) {
  218286. return;
  218287. }
  218288. if (!defined_default(features) || features.length === 0) {
  218289. viewer.selectedEntity = createNoFeaturesEntity();
  218290. return;
  218291. }
  218292. const feature2 = features[0];
  218293. const entity = new Entity_default({
  218294. id: feature2.name,
  218295. description: feature2.description
  218296. });
  218297. if (defined_default(feature2.position)) {
  218298. const ecfPosition = viewer.scene.globe.ellipsoid.cartographicToCartesian(
  218299. feature2.position,
  218300. cartesian3Scratch8
  218301. );
  218302. entity.position = new ConstantPositionProperty_default(ecfPosition);
  218303. }
  218304. viewer.selectedEntity = entity;
  218305. },
  218306. function() {
  218307. if (viewer.selectedEntity !== loadingMessage) {
  218308. return;
  218309. }
  218310. viewer.selectedEntity = createNoFeaturesEntity();
  218311. }
  218312. );
  218313. return loadingMessage;
  218314. }
  218315. function createNoFeaturesEntity() {
  218316. return new Entity_default({
  218317. id: "None",
  218318. description: "No features found."
  218319. });
  218320. }
  218321. function enableVRUI(viewer, enabled) {
  218322. const geocoder = viewer._geocoder;
  218323. const homeButton = viewer._homeButton;
  218324. const sceneModePicker = viewer._sceneModePicker;
  218325. const projectionPicker = viewer._projectionPicker;
  218326. const baseLayerPicker = viewer._baseLayerPicker;
  218327. const animation = viewer._animation;
  218328. const timeline = viewer._timeline;
  218329. const fullscreenButton = viewer._fullscreenButton;
  218330. const infoBox = viewer._infoBox;
  218331. const selectionIndicator = viewer._selectionIndicator;
  218332. const visibility = enabled ? "hidden" : "visible";
  218333. if (defined_default(geocoder)) {
  218334. geocoder.container.style.visibility = visibility;
  218335. }
  218336. if (defined_default(homeButton)) {
  218337. homeButton.container.style.visibility = visibility;
  218338. }
  218339. if (defined_default(sceneModePicker)) {
  218340. sceneModePicker.container.style.visibility = visibility;
  218341. }
  218342. if (defined_default(projectionPicker)) {
  218343. projectionPicker.container.style.visibility = visibility;
  218344. }
  218345. if (defined_default(baseLayerPicker)) {
  218346. baseLayerPicker.container.style.visibility = visibility;
  218347. }
  218348. if (defined_default(animation)) {
  218349. animation.container.style.visibility = visibility;
  218350. }
  218351. if (defined_default(timeline)) {
  218352. timeline.container.style.visibility = visibility;
  218353. }
  218354. if (defined_default(fullscreenButton) && fullscreenButton.viewModel.isFullscreenEnabled) {
  218355. fullscreenButton.container.style.visibility = visibility;
  218356. }
  218357. if (defined_default(infoBox)) {
  218358. infoBox.container.style.visibility = visibility;
  218359. }
  218360. if (defined_default(selectionIndicator)) {
  218361. selectionIndicator.container.style.visibility = visibility;
  218362. }
  218363. if (viewer._container) {
  218364. const right = enabled || !defined_default(fullscreenButton) ? 0 : fullscreenButton.container.clientWidth;
  218365. viewer._vrButton.container.style.right = `${right}px`;
  218366. viewer.forceResize();
  218367. }
  218368. }
  218369. function Viewer(container, options) {
  218370. if (!defined_default(container)) {
  218371. throw new DeveloperError_default("container is required.");
  218372. }
  218373. container = getElement_default(container);
  218374. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  218375. const createBaseLayerPicker = (!defined_default(options.globe) || options.globe !== false) && (!defined_default(options.baseLayerPicker) || options.baseLayerPicker !== false);
  218376. if (!createBaseLayerPicker && defined_default(options.selectedImageryProviderViewModel)) {
  218377. throw new DeveloperError_default(
  218378. "options.selectedImageryProviderViewModel is not available when not using the BaseLayerPicker widget. Either specify options.imageryProvider instead or set options.baseLayerPicker to true."
  218379. );
  218380. }
  218381. if (!createBaseLayerPicker && defined_default(options.selectedTerrainProviderViewModel)) {
  218382. throw new DeveloperError_default(
  218383. "options.selectedTerrainProviderViewModel is not available when not using the BaseLayerPicker widget. Either specify options.terrainProvider instead or set options.baseLayerPicker to true."
  218384. );
  218385. }
  218386. const that = this;
  218387. const viewerContainer = document.createElement("div");
  218388. viewerContainer.className = "cesium-viewer";
  218389. container.appendChild(viewerContainer);
  218390. const cesiumWidgetContainer = document.createElement("div");
  218391. cesiumWidgetContainer.className = "cesium-viewer-cesiumWidgetContainer";
  218392. viewerContainer.appendChild(cesiumWidgetContainer);
  218393. const bottomContainer = document.createElement("div");
  218394. bottomContainer.className = "cesium-viewer-bottom";
  218395. viewerContainer.appendChild(bottomContainer);
  218396. const scene3DOnly = defaultValue_default(options.scene3DOnly, false);
  218397. let clock;
  218398. let clockViewModel;
  218399. let destroyClockViewModel = false;
  218400. if (defined_default(options.clockViewModel)) {
  218401. clockViewModel = options.clockViewModel;
  218402. clock = clockViewModel.clock;
  218403. } else {
  218404. clock = new Clock_default();
  218405. clockViewModel = new ClockViewModel_default(clock);
  218406. destroyClockViewModel = true;
  218407. }
  218408. if (defined_default(options.shouldAnimate)) {
  218409. clock.shouldAnimate = options.shouldAnimate;
  218410. }
  218411. const cesiumWidget = new CesiumWidget_default(cesiumWidgetContainer, {
  218412. imageryProvider: createBaseLayerPicker || defined_default(options.imageryProvider) ? false : void 0,
  218413. clock,
  218414. skyBox: options.skyBox,
  218415. skyAtmosphere: options.skyAtmosphere,
  218416. sceneMode: options.sceneMode,
  218417. mapProjection: options.mapProjection,
  218418. globe: options.globe,
  218419. orderIndependentTranslucency: options.orderIndependentTranslucency,
  218420. contextOptions: options.contextOptions,
  218421. useDefaultRenderLoop: options.useDefaultRenderLoop,
  218422. targetFrameRate: options.targetFrameRate,
  218423. showRenderLoopErrors: options.showRenderLoopErrors,
  218424. useBrowserRecommendedResolution: options.useBrowserRecommendedResolution,
  218425. creditContainer: defined_default(options.creditContainer) ? options.creditContainer : bottomContainer,
  218426. creditViewport: options.creditViewport,
  218427. scene3DOnly,
  218428. shadows: options.shadows,
  218429. terrainShadows: options.terrainShadows,
  218430. mapMode2D: options.mapMode2D,
  218431. requestRenderMode: options.requestRenderMode,
  218432. maximumRenderTimeChange: options.maximumRenderTimeChange,
  218433. depthPlaneEllipsoidOffset: options.depthPlaneEllipsoidOffset,
  218434. msaaSamples: options.msaaSamples
  218435. });
  218436. let dataSourceCollection = options.dataSources;
  218437. let destroyDataSourceCollection = false;
  218438. if (!defined_default(dataSourceCollection)) {
  218439. dataSourceCollection = new DataSourceCollection_default();
  218440. destroyDataSourceCollection = true;
  218441. }
  218442. const scene = cesiumWidget.scene;
  218443. const dataSourceDisplay = new DataSourceDisplay_default({
  218444. scene,
  218445. dataSourceCollection
  218446. });
  218447. const eventHelper = new EventHelper_default();
  218448. eventHelper.add(clock.onTick, Viewer.prototype._onTick, this);
  218449. eventHelper.add(scene.morphStart, Viewer.prototype._clearTrackedObject, this);
  218450. let selectionIndicator;
  218451. if (!defined_default(options.selectionIndicator) || options.selectionIndicator !== false) {
  218452. const selectionIndicatorContainer = document.createElement("div");
  218453. selectionIndicatorContainer.className = "cesium-viewer-selectionIndicatorContainer";
  218454. viewerContainer.appendChild(selectionIndicatorContainer);
  218455. selectionIndicator = new SelectionIndicator_default(
  218456. selectionIndicatorContainer,
  218457. scene
  218458. );
  218459. }
  218460. let infoBox;
  218461. if (!defined_default(options.infoBox) || options.infoBox !== false) {
  218462. const infoBoxContainer = document.createElement("div");
  218463. infoBoxContainer.className = "cesium-viewer-infoBoxContainer";
  218464. viewerContainer.appendChild(infoBoxContainer);
  218465. infoBox = new InfoBox_default(infoBoxContainer);
  218466. const infoBoxViewModel = infoBox.viewModel;
  218467. eventHelper.add(
  218468. infoBoxViewModel.cameraClicked,
  218469. Viewer.prototype._onInfoBoxCameraClicked,
  218470. this
  218471. );
  218472. eventHelper.add(
  218473. infoBoxViewModel.closeClicked,
  218474. Viewer.prototype._onInfoBoxClockClicked,
  218475. this
  218476. );
  218477. }
  218478. const toolbar = document.createElement("div");
  218479. toolbar.className = "cesium-viewer-toolbar";
  218480. viewerContainer.appendChild(toolbar);
  218481. let geocoder;
  218482. if (!defined_default(options.geocoder) || options.geocoder !== false) {
  218483. const geocoderContainer = document.createElement("div");
  218484. geocoderContainer.className = "cesium-viewer-geocoderContainer";
  218485. toolbar.appendChild(geocoderContainer);
  218486. let geocoderService;
  218487. if (defined_default(options.geocoder) && typeof options.geocoder !== "boolean") {
  218488. geocoderService = Array.isArray(options.geocoder) ? options.geocoder : [options.geocoder];
  218489. }
  218490. geocoder = new Geocoder_default({
  218491. container: geocoderContainer,
  218492. geocoderServices: geocoderService,
  218493. scene
  218494. });
  218495. eventHelper.add(
  218496. geocoder.viewModel.search.beforeExecute,
  218497. Viewer.prototype._clearObjects,
  218498. this
  218499. );
  218500. }
  218501. let homeButton;
  218502. if (!defined_default(options.homeButton) || options.homeButton !== false) {
  218503. homeButton = new HomeButton_default(toolbar, scene);
  218504. if (defined_default(geocoder)) {
  218505. eventHelper.add(homeButton.viewModel.command.afterExecute, function() {
  218506. const viewModel = geocoder.viewModel;
  218507. viewModel.searchText = "";
  218508. if (viewModel.isSearchInProgress) {
  218509. viewModel.search();
  218510. }
  218511. });
  218512. }
  218513. eventHelper.add(
  218514. homeButton.viewModel.command.beforeExecute,
  218515. Viewer.prototype._clearTrackedObject,
  218516. this
  218517. );
  218518. }
  218519. if (options.sceneModePicker === true && scene3DOnly) {
  218520. throw new DeveloperError_default(
  218521. "options.sceneModePicker is not available when options.scene3DOnly is set to true."
  218522. );
  218523. }
  218524. let sceneModePicker;
  218525. if (!scene3DOnly && (!defined_default(options.sceneModePicker) || options.sceneModePicker !== false)) {
  218526. sceneModePicker = new SceneModePicker_default(toolbar, scene);
  218527. }
  218528. let projectionPicker;
  218529. if (options.projectionPicker) {
  218530. projectionPicker = new ProjectionPicker_default(toolbar, scene);
  218531. }
  218532. let baseLayerPicker;
  218533. let baseLayerPickerDropDown;
  218534. if (createBaseLayerPicker) {
  218535. const imageryProviderViewModels = defaultValue_default(
  218536. options.imageryProviderViewModels,
  218537. createDefaultImageryProviderViewModels_default()
  218538. );
  218539. const terrainProviderViewModels = defaultValue_default(
  218540. options.terrainProviderViewModels,
  218541. createDefaultTerrainProviderViewModels_default()
  218542. );
  218543. baseLayerPicker = new BaseLayerPicker_default(toolbar, {
  218544. globe: scene.globe,
  218545. imageryProviderViewModels,
  218546. selectedImageryProviderViewModel: options.selectedImageryProviderViewModel,
  218547. terrainProviderViewModels,
  218548. selectedTerrainProviderViewModel: options.selectedTerrainProviderViewModel
  218549. });
  218550. const elements = toolbar.getElementsByClassName(
  218551. "cesium-baseLayerPicker-dropDown"
  218552. );
  218553. baseLayerPickerDropDown = elements[0];
  218554. }
  218555. if (defined_default(options.imageryProvider) && options.imageryProvider !== false) {
  218556. if (createBaseLayerPicker) {
  218557. baseLayerPicker.viewModel.selectedImagery = void 0;
  218558. }
  218559. scene.imageryLayers.removeAll();
  218560. scene.imageryLayers.addImageryProvider(options.imageryProvider);
  218561. }
  218562. if (defined_default(options.terrainProvider)) {
  218563. if (createBaseLayerPicker) {
  218564. baseLayerPicker.viewModel.selectedTerrain = void 0;
  218565. }
  218566. scene.terrainProvider = options.terrainProvider;
  218567. }
  218568. let navigationHelpButton;
  218569. if (!defined_default(options.navigationHelpButton) || options.navigationHelpButton !== false) {
  218570. let showNavHelp = true;
  218571. try {
  218572. if (defined_default(window.localStorage)) {
  218573. const hasSeenNavHelp = window.localStorage.getItem(
  218574. "cesium-hasSeenNavHelp"
  218575. );
  218576. if (defined_default(hasSeenNavHelp) && Boolean(hasSeenNavHelp)) {
  218577. showNavHelp = false;
  218578. } else {
  218579. window.localStorage.setItem("cesium-hasSeenNavHelp", "true");
  218580. }
  218581. }
  218582. } catch (e2) {
  218583. }
  218584. navigationHelpButton = new NavigationHelpButton_default({
  218585. container: toolbar,
  218586. instructionsInitiallyVisible: defaultValue_default(
  218587. options.navigationInstructionsInitiallyVisible,
  218588. showNavHelp
  218589. )
  218590. });
  218591. }
  218592. let animation;
  218593. if (!defined_default(options.animation) || options.animation !== false) {
  218594. const animationContainer = document.createElement("div");
  218595. animationContainer.className = "cesium-viewer-animationContainer";
  218596. viewerContainer.appendChild(animationContainer);
  218597. animation = new Animation_default(
  218598. animationContainer,
  218599. new AnimationViewModel_default(clockViewModel)
  218600. );
  218601. }
  218602. let timeline;
  218603. if (!defined_default(options.timeline) || options.timeline !== false) {
  218604. const timelineContainer = document.createElement("div");
  218605. timelineContainer.className = "cesium-viewer-timelineContainer";
  218606. viewerContainer.appendChild(timelineContainer);
  218607. timeline = new Timeline_default(timelineContainer, clock);
  218608. timeline.addEventListener("settime", onTimelineScrubfunction, false);
  218609. timeline.zoomTo(clock.startTime, clock.stopTime);
  218610. }
  218611. let fullscreenButton;
  218612. let fullscreenSubscription;
  218613. let fullscreenContainer;
  218614. if (!defined_default(options.fullscreenButton) || options.fullscreenButton !== false) {
  218615. fullscreenContainer = document.createElement("div");
  218616. fullscreenContainer.className = "cesium-viewer-fullscreenContainer";
  218617. viewerContainer.appendChild(fullscreenContainer);
  218618. fullscreenButton = new FullscreenButton_default(
  218619. fullscreenContainer,
  218620. options.fullscreenElement
  218621. );
  218622. fullscreenSubscription = subscribeAndEvaluate_default(
  218623. fullscreenButton.viewModel,
  218624. "isFullscreenEnabled",
  218625. function(isFullscreenEnabled) {
  218626. fullscreenContainer.style.display = isFullscreenEnabled ? "block" : "none";
  218627. if (defined_default(timeline)) {
  218628. timeline.container.style.right = `${fullscreenContainer.clientWidth}px`;
  218629. timeline.resize();
  218630. }
  218631. }
  218632. );
  218633. }
  218634. let vrButton;
  218635. let vrSubscription;
  218636. let vrModeSubscription;
  218637. if (options.vrButton) {
  218638. const vrContainer = document.createElement("div");
  218639. vrContainer.className = "cesium-viewer-vrContainer";
  218640. viewerContainer.appendChild(vrContainer);
  218641. vrButton = new VRButton_default(vrContainer, scene, options.fullScreenElement);
  218642. vrSubscription = subscribeAndEvaluate_default(
  218643. vrButton.viewModel,
  218644. "isVREnabled",
  218645. function(isVREnabled) {
  218646. vrContainer.style.display = isVREnabled ? "block" : "none";
  218647. if (defined_default(fullscreenButton)) {
  218648. vrContainer.style.right = `${fullscreenContainer.clientWidth}px`;
  218649. }
  218650. if (defined_default(timeline)) {
  218651. timeline.container.style.right = `${vrContainer.clientWidth}px`;
  218652. timeline.resize();
  218653. }
  218654. }
  218655. );
  218656. vrModeSubscription = subscribeAndEvaluate_default(
  218657. vrButton.viewModel,
  218658. "isVRMode",
  218659. function(isVRMode) {
  218660. enableVRUI(that, isVRMode);
  218661. }
  218662. );
  218663. }
  218664. this._baseLayerPickerDropDown = baseLayerPickerDropDown;
  218665. this._fullscreenSubscription = fullscreenSubscription;
  218666. this._vrSubscription = vrSubscription;
  218667. this._vrModeSubscription = vrModeSubscription;
  218668. this._dataSourceChangedListeners = {};
  218669. this._automaticallyTrackDataSourceClocks = defaultValue_default(
  218670. options.automaticallyTrackDataSourceClocks,
  218671. true
  218672. );
  218673. this._container = container;
  218674. this._bottomContainer = bottomContainer;
  218675. this._element = viewerContainer;
  218676. this._cesiumWidget = cesiumWidget;
  218677. this._selectionIndicator = selectionIndicator;
  218678. this._infoBox = infoBox;
  218679. this._dataSourceCollection = dataSourceCollection;
  218680. this._destroyDataSourceCollection = destroyDataSourceCollection;
  218681. this._dataSourceDisplay = dataSourceDisplay;
  218682. this._clockViewModel = clockViewModel;
  218683. this._destroyClockViewModel = destroyClockViewModel;
  218684. this._toolbar = toolbar;
  218685. this._homeButton = homeButton;
  218686. this._sceneModePicker = sceneModePicker;
  218687. this._projectionPicker = projectionPicker;
  218688. this._baseLayerPicker = baseLayerPicker;
  218689. this._navigationHelpButton = navigationHelpButton;
  218690. this._animation = animation;
  218691. this._timeline = timeline;
  218692. this._fullscreenButton = fullscreenButton;
  218693. this._vrButton = vrButton;
  218694. this._geocoder = geocoder;
  218695. this._eventHelper = eventHelper;
  218696. this._lastWidth = 0;
  218697. this._lastHeight = 0;
  218698. this._allowDataSourcesToSuspendAnimation = true;
  218699. this._entityView = void 0;
  218700. this._enableInfoOrSelection = defined_default(infoBox) || defined_default(selectionIndicator);
  218701. this._clockTrackedDataSource = void 0;
  218702. this._trackedEntity = void 0;
  218703. this._needTrackedEntityUpdate = false;
  218704. this._selectedEntity = void 0;
  218705. this._zoomIsFlight = false;
  218706. this._zoomTarget = void 0;
  218707. this._zoomPromise = void 0;
  218708. this._zoomOptions = void 0;
  218709. this._selectedEntityChanged = new Event_default();
  218710. this._trackedEntityChanged = new Event_default();
  218711. knockout_default.track(this, [
  218712. "_trackedEntity",
  218713. "_selectedEntity",
  218714. "_clockTrackedDataSource"
  218715. ]);
  218716. eventHelper.add(
  218717. dataSourceCollection.dataSourceAdded,
  218718. Viewer.prototype._onDataSourceAdded,
  218719. this
  218720. );
  218721. eventHelper.add(
  218722. dataSourceCollection.dataSourceRemoved,
  218723. Viewer.prototype._onDataSourceRemoved,
  218724. this
  218725. );
  218726. eventHelper.add(scene.postUpdate, Viewer.prototype.resize, this);
  218727. eventHelper.add(scene.postRender, Viewer.prototype._postRender, this);
  218728. const dataSourceLength = dataSourceCollection.length;
  218729. for (let i2 = 0; i2 < dataSourceLength; i2++) {
  218730. this._dataSourceAdded(dataSourceCollection, dataSourceCollection.get(i2));
  218731. }
  218732. this._dataSourceAdded(void 0, dataSourceDisplay.defaultDataSource);
  218733. eventHelper.add(
  218734. dataSourceCollection.dataSourceAdded,
  218735. Viewer.prototype._dataSourceAdded,
  218736. this
  218737. );
  218738. eventHelper.add(
  218739. dataSourceCollection.dataSourceRemoved,
  218740. Viewer.prototype._dataSourceRemoved,
  218741. this
  218742. );
  218743. function pickAndTrackObject(e2) {
  218744. const entity = pickEntity(that, e2);
  218745. if (defined_default(entity)) {
  218746. if (Property_default.getValueOrUndefined(entity.position, that.clock.currentTime)) {
  218747. that.trackedEntity = entity;
  218748. } else {
  218749. that.zoomTo(entity);
  218750. }
  218751. } else if (defined_default(that.trackedEntity)) {
  218752. that.trackedEntity = void 0;
  218753. }
  218754. }
  218755. function pickAndSelectObject(e2) {
  218756. that.selectedEntity = pickEntity(that, e2);
  218757. }
  218758. cesiumWidget.screenSpaceEventHandler.setInputAction(
  218759. pickAndSelectObject,
  218760. ScreenSpaceEventType_default.LEFT_CLICK
  218761. );
  218762. cesiumWidget.screenSpaceEventHandler.setInputAction(
  218763. pickAndTrackObject,
  218764. ScreenSpaceEventType_default.LEFT_DOUBLE_CLICK
  218765. );
  218766. }
  218767. Object.defineProperties(Viewer.prototype, {
  218768. container: {
  218769. get: function() {
  218770. return this._container;
  218771. }
  218772. },
  218773. bottomContainer: {
  218774. get: function() {
  218775. return this._bottomContainer;
  218776. }
  218777. },
  218778. cesiumWidget: {
  218779. get: function() {
  218780. return this._cesiumWidget;
  218781. }
  218782. },
  218783. selectionIndicator: {
  218784. get: function() {
  218785. return this._selectionIndicator;
  218786. }
  218787. },
  218788. infoBox: {
  218789. get: function() {
  218790. return this._infoBox;
  218791. }
  218792. },
  218793. geocoder: {
  218794. get: function() {
  218795. return this._geocoder;
  218796. }
  218797. },
  218798. homeButton: {
  218799. get: function() {
  218800. return this._homeButton;
  218801. }
  218802. },
  218803. sceneModePicker: {
  218804. get: function() {
  218805. return this._sceneModePicker;
  218806. }
  218807. },
  218808. projectionPicker: {
  218809. get: function() {
  218810. return this._projectionPicker;
  218811. }
  218812. },
  218813. baseLayerPicker: {
  218814. get: function() {
  218815. return this._baseLayerPicker;
  218816. }
  218817. },
  218818. navigationHelpButton: {
  218819. get: function() {
  218820. return this._navigationHelpButton;
  218821. }
  218822. },
  218823. animation: {
  218824. get: function() {
  218825. return this._animation;
  218826. }
  218827. },
  218828. timeline: {
  218829. get: function() {
  218830. return this._timeline;
  218831. }
  218832. },
  218833. fullscreenButton: {
  218834. get: function() {
  218835. return this._fullscreenButton;
  218836. }
  218837. },
  218838. vrButton: {
  218839. get: function() {
  218840. return this._vrButton;
  218841. }
  218842. },
  218843. dataSourceDisplay: {
  218844. get: function() {
  218845. return this._dataSourceDisplay;
  218846. }
  218847. },
  218848. entities: {
  218849. get: function() {
  218850. return this._dataSourceDisplay.defaultDataSource.entities;
  218851. }
  218852. },
  218853. dataSources: {
  218854. get: function() {
  218855. return this._dataSourceCollection;
  218856. }
  218857. },
  218858. canvas: {
  218859. get: function() {
  218860. return this._cesiumWidget.canvas;
  218861. }
  218862. },
  218863. scene: {
  218864. get: function() {
  218865. return this._cesiumWidget.scene;
  218866. }
  218867. },
  218868. shadows: {
  218869. get: function() {
  218870. return this.scene.shadowMap.enabled;
  218871. },
  218872. set: function(value) {
  218873. this.scene.shadowMap.enabled = value;
  218874. }
  218875. },
  218876. terrainShadows: {
  218877. get: function() {
  218878. return this.scene.globe.shadows;
  218879. },
  218880. set: function(value) {
  218881. this.scene.globe.shadows = value;
  218882. }
  218883. },
  218884. shadowMap: {
  218885. get: function() {
  218886. return this.scene.shadowMap;
  218887. }
  218888. },
  218889. imageryLayers: {
  218890. get: function() {
  218891. return this.scene.imageryLayers;
  218892. }
  218893. },
  218894. terrainProvider: {
  218895. get: function() {
  218896. return this.scene.terrainProvider;
  218897. },
  218898. set: function(terrainProvider) {
  218899. this.scene.terrainProvider = terrainProvider;
  218900. }
  218901. },
  218902. camera: {
  218903. get: function() {
  218904. return this.scene.camera;
  218905. }
  218906. },
  218907. postProcessStages: {
  218908. get: function() {
  218909. return this.scene.postProcessStages;
  218910. }
  218911. },
  218912. clock: {
  218913. get: function() {
  218914. return this._clockViewModel.clock;
  218915. }
  218916. },
  218917. clockViewModel: {
  218918. get: function() {
  218919. return this._clockViewModel;
  218920. }
  218921. },
  218922. screenSpaceEventHandler: {
  218923. get: function() {
  218924. return this._cesiumWidget.screenSpaceEventHandler;
  218925. }
  218926. },
  218927. targetFrameRate: {
  218928. get: function() {
  218929. return this._cesiumWidget.targetFrameRate;
  218930. },
  218931. set: function(value) {
  218932. this._cesiumWidget.targetFrameRate = value;
  218933. }
  218934. },
  218935. useDefaultRenderLoop: {
  218936. get: function() {
  218937. return this._cesiumWidget.useDefaultRenderLoop;
  218938. },
  218939. set: function(value) {
  218940. this._cesiumWidget.useDefaultRenderLoop = value;
  218941. }
  218942. },
  218943. resolutionScale: {
  218944. get: function() {
  218945. return this._cesiumWidget.resolutionScale;
  218946. },
  218947. set: function(value) {
  218948. this._cesiumWidget.resolutionScale = value;
  218949. }
  218950. },
  218951. useBrowserRecommendedResolution: {
  218952. get: function() {
  218953. return this._cesiumWidget.useBrowserRecommendedResolution;
  218954. },
  218955. set: function(value) {
  218956. this._cesiumWidget.useBrowserRecommendedResolution = value;
  218957. }
  218958. },
  218959. allowDataSourcesToSuspendAnimation: {
  218960. get: function() {
  218961. return this._allowDataSourcesToSuspendAnimation;
  218962. },
  218963. set: function(value) {
  218964. this._allowDataSourcesToSuspendAnimation = value;
  218965. }
  218966. },
  218967. trackedEntity: {
  218968. get: function() {
  218969. return this._trackedEntity;
  218970. },
  218971. set: function(value) {
  218972. if (this._trackedEntity !== value) {
  218973. this._trackedEntity = value;
  218974. cancelZoom(this);
  218975. const scene = this.scene;
  218976. const sceneMode = scene.mode;
  218977. if (!defined_default(value) || !defined_default(value.position)) {
  218978. this._needTrackedEntityUpdate = false;
  218979. if (sceneMode === SceneMode_default.COLUMBUS_VIEW || sceneMode === SceneMode_default.SCENE2D) {
  218980. scene.screenSpaceCameraController.enableTranslate = true;
  218981. }
  218982. if (sceneMode === SceneMode_default.COLUMBUS_VIEW || sceneMode === SceneMode_default.SCENE3D) {
  218983. scene.screenSpaceCameraController.enableTilt = true;
  218984. }
  218985. this._entityView = void 0;
  218986. this.camera.lookAtTransform(Matrix4_default.IDENTITY);
  218987. } else {
  218988. this._needTrackedEntityUpdate = true;
  218989. }
  218990. this._trackedEntityChanged.raiseEvent(value);
  218991. this.scene.requestRender();
  218992. }
  218993. }
  218994. },
  218995. selectedEntity: {
  218996. get: function() {
  218997. return this._selectedEntity;
  218998. },
  218999. set: function(value) {
  219000. if (this._selectedEntity !== value) {
  219001. this._selectedEntity = value;
  219002. const selectionIndicatorViewModel = defined_default(this._selectionIndicator) ? this._selectionIndicator.viewModel : void 0;
  219003. if (defined_default(value)) {
  219004. if (defined_default(selectionIndicatorViewModel)) {
  219005. selectionIndicatorViewModel.animateAppear();
  219006. }
  219007. } else if (defined_default(selectionIndicatorViewModel)) {
  219008. selectionIndicatorViewModel.animateDepart();
  219009. }
  219010. this._selectedEntityChanged.raiseEvent(value);
  219011. }
  219012. }
  219013. },
  219014. selectedEntityChanged: {
  219015. get: function() {
  219016. return this._selectedEntityChanged;
  219017. }
  219018. },
  219019. trackedEntityChanged: {
  219020. get: function() {
  219021. return this._trackedEntityChanged;
  219022. }
  219023. },
  219024. clockTrackedDataSource: {
  219025. get: function() {
  219026. return this._clockTrackedDataSource;
  219027. },
  219028. set: function(value) {
  219029. if (this._clockTrackedDataSource !== value) {
  219030. this._clockTrackedDataSource = value;
  219031. trackDataSourceClock(this._timeline, this.clock, value);
  219032. }
  219033. }
  219034. }
  219035. });
  219036. Viewer.prototype.extend = function(mixin, options) {
  219037. if (!defined_default(mixin)) {
  219038. throw new DeveloperError_default("mixin is required.");
  219039. }
  219040. mixin(this, options);
  219041. };
  219042. Viewer.prototype.resize = function() {
  219043. const cesiumWidget = this._cesiumWidget;
  219044. const container = this._container;
  219045. const width = container.clientWidth;
  219046. const height = container.clientHeight;
  219047. const animationExists = defined_default(this._animation);
  219048. const timelineExists = defined_default(this._timeline);
  219049. cesiumWidget.resize();
  219050. if (width === this._lastWidth && height === this._lastHeight) {
  219051. return;
  219052. }
  219053. const panelMaxHeight = height - 125;
  219054. const baseLayerPickerDropDown = this._baseLayerPickerDropDown;
  219055. if (defined_default(baseLayerPickerDropDown)) {
  219056. baseLayerPickerDropDown.style.maxHeight = `${panelMaxHeight}px`;
  219057. }
  219058. if (defined_default(this._geocoder)) {
  219059. const geocoderSuggestions = this._geocoder.searchSuggestionsContainer;
  219060. geocoderSuggestions.style.maxHeight = `${panelMaxHeight}px`;
  219061. }
  219062. if (defined_default(this._infoBox)) {
  219063. this._infoBox.viewModel.maxHeight = panelMaxHeight;
  219064. }
  219065. const timeline = this._timeline;
  219066. let animationContainer;
  219067. let animationWidth = 0;
  219068. let creditLeft = 0;
  219069. let creditBottom = 0;
  219070. if (animationExists && window.getComputedStyle(this._animation.container).visibility !== "hidden") {
  219071. const lastWidth = this._lastWidth;
  219072. animationContainer = this._animation.container;
  219073. if (width > 900) {
  219074. animationWidth = 169;
  219075. if (lastWidth <= 900) {
  219076. animationContainer.style.width = "169px";
  219077. animationContainer.style.height = "112px";
  219078. this._animation.resize();
  219079. }
  219080. } else if (width >= 600) {
  219081. animationWidth = 136;
  219082. if (lastWidth < 600 || lastWidth > 900) {
  219083. animationContainer.style.width = "136px";
  219084. animationContainer.style.height = "90px";
  219085. this._animation.resize();
  219086. }
  219087. } else {
  219088. animationWidth = 106;
  219089. if (lastWidth > 600 || lastWidth === 0) {
  219090. animationContainer.style.width = "106px";
  219091. animationContainer.style.height = "70px";
  219092. this._animation.resize();
  219093. }
  219094. }
  219095. creditLeft = animationWidth + 5;
  219096. }
  219097. if (timelineExists && window.getComputedStyle(this._timeline.container).visibility !== "hidden") {
  219098. const fullscreenButton = this._fullscreenButton;
  219099. const vrButton = this._vrButton;
  219100. const timelineContainer = timeline.container;
  219101. const timelineStyle = timelineContainer.style;
  219102. creditBottom = timelineContainer.clientHeight + 3;
  219103. timelineStyle.left = `${animationWidth}px`;
  219104. let pixels = 0;
  219105. if (defined_default(fullscreenButton)) {
  219106. pixels += fullscreenButton.container.clientWidth;
  219107. }
  219108. if (defined_default(vrButton)) {
  219109. pixels += vrButton.container.clientWidth;
  219110. }
  219111. timelineStyle.right = `${pixels}px`;
  219112. timeline.resize();
  219113. }
  219114. this._bottomContainer.style.left = `${creditLeft}px`;
  219115. this._bottomContainer.style.bottom = `${creditBottom}px`;
  219116. this._lastWidth = width;
  219117. this._lastHeight = height;
  219118. };
  219119. Viewer.prototype.forceResize = function() {
  219120. this._lastWidth = 0;
  219121. this.resize();
  219122. };
  219123. Viewer.prototype.render = function() {
  219124. this._cesiumWidget.render();
  219125. };
  219126. Viewer.prototype.isDestroyed = function() {
  219127. return false;
  219128. };
  219129. Viewer.prototype.destroy = function() {
  219130. let i2;
  219131. this.screenSpaceEventHandler.removeInputAction(
  219132. ScreenSpaceEventType_default.LEFT_CLICK
  219133. );
  219134. this.screenSpaceEventHandler.removeInputAction(
  219135. ScreenSpaceEventType_default.LEFT_DOUBLE_CLICK
  219136. );
  219137. const dataSources = this.dataSources;
  219138. const dataSourceLength = dataSources.length;
  219139. for (i2 = 0; i2 < dataSourceLength; i2++) {
  219140. this._dataSourceRemoved(dataSources, dataSources.get(i2));
  219141. }
  219142. this._dataSourceRemoved(void 0, this._dataSourceDisplay.defaultDataSource);
  219143. this._container.removeChild(this._element);
  219144. this._element.removeChild(this._toolbar);
  219145. this._eventHelper.removeAll();
  219146. if (defined_default(this._geocoder)) {
  219147. this._geocoder = this._geocoder.destroy();
  219148. }
  219149. if (defined_default(this._homeButton)) {
  219150. this._homeButton = this._homeButton.destroy();
  219151. }
  219152. if (defined_default(this._sceneModePicker)) {
  219153. this._sceneModePicker = this._sceneModePicker.destroy();
  219154. }
  219155. if (defined_default(this._projectionPicker)) {
  219156. this._projectionPicker = this._projectionPicker.destroy();
  219157. }
  219158. if (defined_default(this._baseLayerPicker)) {
  219159. this._baseLayerPicker = this._baseLayerPicker.destroy();
  219160. }
  219161. if (defined_default(this._animation)) {
  219162. this._element.removeChild(this._animation.container);
  219163. this._animation = this._animation.destroy();
  219164. }
  219165. if (defined_default(this._timeline)) {
  219166. this._timeline.removeEventListener(
  219167. "settime",
  219168. onTimelineScrubfunction,
  219169. false
  219170. );
  219171. this._element.removeChild(this._timeline.container);
  219172. this._timeline = this._timeline.destroy();
  219173. }
  219174. if (defined_default(this._fullscreenButton)) {
  219175. this._fullscreenSubscription.dispose();
  219176. this._element.removeChild(this._fullscreenButton.container);
  219177. this._fullscreenButton = this._fullscreenButton.destroy();
  219178. }
  219179. if (defined_default(this._vrButton)) {
  219180. this._vrSubscription.dispose();
  219181. this._vrModeSubscription.dispose();
  219182. this._element.removeChild(this._vrButton.container);
  219183. this._vrButton = this._vrButton.destroy();
  219184. }
  219185. if (defined_default(this._infoBox)) {
  219186. this._element.removeChild(this._infoBox.container);
  219187. this._infoBox = this._infoBox.destroy();
  219188. }
  219189. if (defined_default(this._selectionIndicator)) {
  219190. this._element.removeChild(this._selectionIndicator.container);
  219191. this._selectionIndicator = this._selectionIndicator.destroy();
  219192. }
  219193. if (this._destroyClockViewModel) {
  219194. this._clockViewModel = this._clockViewModel.destroy();
  219195. }
  219196. this._dataSourceDisplay = this._dataSourceDisplay.destroy();
  219197. this._cesiumWidget = this._cesiumWidget.destroy();
  219198. if (this._destroyDataSourceCollection) {
  219199. this._dataSourceCollection = this._dataSourceCollection.destroy();
  219200. }
  219201. return destroyObject_default(this);
  219202. };
  219203. Viewer.prototype._dataSourceAdded = function(dataSourceCollection, dataSource) {
  219204. const entityCollection = dataSource.entities;
  219205. entityCollection.collectionChanged.addEventListener(
  219206. Viewer.prototype._onEntityCollectionChanged,
  219207. this
  219208. );
  219209. };
  219210. Viewer.prototype._dataSourceRemoved = function(dataSourceCollection, dataSource) {
  219211. const entityCollection = dataSource.entities;
  219212. entityCollection.collectionChanged.removeEventListener(
  219213. Viewer.prototype._onEntityCollectionChanged,
  219214. this
  219215. );
  219216. if (defined_default(this.trackedEntity)) {
  219217. if (entityCollection.getById(this.trackedEntity.id) === this.trackedEntity) {
  219218. this.trackedEntity = void 0;
  219219. }
  219220. }
  219221. if (defined_default(this.selectedEntity)) {
  219222. if (entityCollection.getById(this.selectedEntity.id) === this.selectedEntity) {
  219223. this.selectedEntity = void 0;
  219224. }
  219225. }
  219226. };
  219227. Viewer.prototype._onTick = function(clock) {
  219228. const time = clock.currentTime;
  219229. const isUpdated = this._dataSourceDisplay.update(time);
  219230. if (this._allowDataSourcesToSuspendAnimation) {
  219231. this._clockViewModel.canAnimate = isUpdated;
  219232. }
  219233. const entityView = this._entityView;
  219234. if (defined_default(entityView)) {
  219235. const trackedEntity = this._trackedEntity;
  219236. const trackedState = this._dataSourceDisplay.getBoundingSphere(
  219237. trackedEntity,
  219238. false,
  219239. boundingSphereScratch4
  219240. );
  219241. if (trackedState === BoundingSphereState_default.DONE) {
  219242. entityView.update(time, boundingSphereScratch4);
  219243. }
  219244. }
  219245. let position;
  219246. let enableCamera = false;
  219247. const selectedEntity = this.selectedEntity;
  219248. const showSelection = defined_default(selectedEntity) && this._enableInfoOrSelection;
  219249. if (showSelection && selectedEntity.isShowing && selectedEntity.isAvailable(time)) {
  219250. const state = this._dataSourceDisplay.getBoundingSphere(
  219251. selectedEntity,
  219252. true,
  219253. boundingSphereScratch4
  219254. );
  219255. if (state !== BoundingSphereState_default.FAILED) {
  219256. position = boundingSphereScratch4.center;
  219257. } else if (defined_default(selectedEntity.position)) {
  219258. position = selectedEntity.position.getValue(time, position);
  219259. }
  219260. enableCamera = defined_default(position);
  219261. }
  219262. const selectionIndicatorViewModel = defined_default(this._selectionIndicator) ? this._selectionIndicator.viewModel : void 0;
  219263. if (defined_default(selectionIndicatorViewModel)) {
  219264. selectionIndicatorViewModel.position = Cartesian3_default.clone(
  219265. position,
  219266. selectionIndicatorViewModel.position
  219267. );
  219268. selectionIndicatorViewModel.showSelection = showSelection && enableCamera;
  219269. selectionIndicatorViewModel.update();
  219270. }
  219271. const infoBoxViewModel = defined_default(this._infoBox) ? this._infoBox.viewModel : void 0;
  219272. if (defined_default(infoBoxViewModel)) {
  219273. infoBoxViewModel.showInfo = showSelection;
  219274. infoBoxViewModel.enableCamera = enableCamera;
  219275. infoBoxViewModel.isCameraTracking = this.trackedEntity === this.selectedEntity;
  219276. if (showSelection) {
  219277. infoBoxViewModel.titleText = defaultValue_default(
  219278. selectedEntity.name,
  219279. selectedEntity.id
  219280. );
  219281. infoBoxViewModel.description = Property_default.getValueOrDefault(
  219282. selectedEntity.description,
  219283. time,
  219284. ""
  219285. );
  219286. } else {
  219287. infoBoxViewModel.titleText = "";
  219288. infoBoxViewModel.description = "";
  219289. }
  219290. }
  219291. };
  219292. Viewer.prototype._onEntityCollectionChanged = function(collection, added, removed) {
  219293. const length3 = removed.length;
  219294. for (let i2 = 0; i2 < length3; i2++) {
  219295. const removedObject = removed[i2];
  219296. if (this.trackedEntity === removedObject) {
  219297. this.trackedEntity = void 0;
  219298. }
  219299. if (this.selectedEntity === removedObject) {
  219300. this.selectedEntity = void 0;
  219301. }
  219302. }
  219303. };
  219304. Viewer.prototype._onInfoBoxCameraClicked = function(infoBoxViewModel) {
  219305. if (infoBoxViewModel.isCameraTracking && this.trackedEntity === this.selectedEntity) {
  219306. this.trackedEntity = void 0;
  219307. } else {
  219308. const selectedEntity = this.selectedEntity;
  219309. const position = selectedEntity.position;
  219310. if (defined_default(position)) {
  219311. this.trackedEntity = this.selectedEntity;
  219312. } else {
  219313. this.zoomTo(this.selectedEntity);
  219314. }
  219315. }
  219316. };
  219317. Viewer.prototype._clearTrackedObject = function() {
  219318. this.trackedEntity = void 0;
  219319. };
  219320. Viewer.prototype._onInfoBoxClockClicked = function(infoBoxViewModel) {
  219321. this.selectedEntity = void 0;
  219322. };
  219323. Viewer.prototype._clearObjects = function() {
  219324. this.trackedEntity = void 0;
  219325. this.selectedEntity = void 0;
  219326. };
  219327. Viewer.prototype._onDataSourceChanged = function(dataSource) {
  219328. if (this.clockTrackedDataSource === dataSource) {
  219329. trackDataSourceClock(this.timeline, this.clock, dataSource);
  219330. }
  219331. };
  219332. Viewer.prototype._onDataSourceAdded = function(dataSourceCollection, dataSource) {
  219333. if (this._automaticallyTrackDataSourceClocks) {
  219334. this.clockTrackedDataSource = dataSource;
  219335. }
  219336. const id = dataSource.entities.id;
  219337. const removalFunc = this._eventHelper.add(
  219338. dataSource.changedEvent,
  219339. Viewer.prototype._onDataSourceChanged,
  219340. this
  219341. );
  219342. this._dataSourceChangedListeners[id] = removalFunc;
  219343. };
  219344. Viewer.prototype._onDataSourceRemoved = function(dataSourceCollection, dataSource) {
  219345. const resetClock = this.clockTrackedDataSource === dataSource;
  219346. const id = dataSource.entities.id;
  219347. this._dataSourceChangedListeners[id]();
  219348. this._dataSourceChangedListeners[id] = void 0;
  219349. if (resetClock) {
  219350. const numDataSources = dataSourceCollection.length;
  219351. if (this._automaticallyTrackDataSourceClocks && numDataSources > 0) {
  219352. this.clockTrackedDataSource = dataSourceCollection.get(
  219353. numDataSources - 1
  219354. );
  219355. } else {
  219356. this.clockTrackedDataSource = void 0;
  219357. }
  219358. }
  219359. };
  219360. Viewer.prototype.zoomTo = function(target, offset2) {
  219361. const options = {
  219362. offset: offset2
  219363. };
  219364. return zoomToOrFly(this, target, options, false);
  219365. };
  219366. Viewer.prototype.flyTo = function(target, options) {
  219367. return zoomToOrFly(this, target, options, true);
  219368. };
  219369. function zoomToOrFly(that, zoomTarget, options, isFlight) {
  219370. if (!defined_default(zoomTarget)) {
  219371. throw new DeveloperError_default("zoomTarget is required.");
  219372. }
  219373. cancelZoom(that);
  219374. const zoomPromise = defer_default();
  219375. that._zoomPromise = zoomPromise;
  219376. that._zoomIsFlight = isFlight;
  219377. that._zoomOptions = options;
  219378. Promise.resolve(zoomTarget).then(function(zoomTarget2) {
  219379. if (that._zoomPromise !== zoomPromise) {
  219380. return;
  219381. }
  219382. if (zoomTarget2 instanceof ImageryLayer_default) {
  219383. zoomTarget2.getViewableRectangle().then(function(rectangle) {
  219384. return computeFlyToLocationForRectangle_default(rectangle, that.scene);
  219385. }).then(function(position) {
  219386. if (that._zoomPromise === zoomPromise) {
  219387. that._zoomTarget = position;
  219388. }
  219389. });
  219390. return;
  219391. }
  219392. if (zoomTarget2 instanceof Cesium3DTileset_default) {
  219393. that._zoomTarget = zoomTarget2;
  219394. return;
  219395. }
  219396. if (zoomTarget2 instanceof TimeDynamicPointCloud_default) {
  219397. that._zoomTarget = zoomTarget2;
  219398. return;
  219399. }
  219400. if (zoomTarget2.isLoading && defined_default(zoomTarget2.loadingEvent)) {
  219401. const removeEvent = zoomTarget2.loadingEvent.addEventListener(function() {
  219402. removeEvent();
  219403. if (that._zoomPromise === zoomPromise) {
  219404. that._zoomTarget = zoomTarget2.entities.values.slice(0);
  219405. }
  219406. });
  219407. return;
  219408. }
  219409. if (Array.isArray(zoomTarget2)) {
  219410. that._zoomTarget = zoomTarget2.slice(0);
  219411. return;
  219412. }
  219413. zoomTarget2 = defaultValue_default(zoomTarget2.values, zoomTarget2);
  219414. if (defined_default(zoomTarget2.entities)) {
  219415. zoomTarget2 = zoomTarget2.entities.values;
  219416. }
  219417. if (Array.isArray(zoomTarget2)) {
  219418. that._zoomTarget = zoomTarget2.slice(0);
  219419. } else {
  219420. that._zoomTarget = [zoomTarget2];
  219421. }
  219422. });
  219423. that.scene.requestRender();
  219424. return zoomPromise.promise;
  219425. }
  219426. function clearZoom(viewer) {
  219427. viewer._zoomPromise = void 0;
  219428. viewer._zoomTarget = void 0;
  219429. viewer._zoomOptions = void 0;
  219430. }
  219431. function cancelZoom(viewer) {
  219432. const zoomPromise = viewer._zoomPromise;
  219433. if (defined_default(zoomPromise)) {
  219434. clearZoom(viewer);
  219435. zoomPromise.resolve(false);
  219436. }
  219437. }
  219438. Viewer.prototype._postRender = function() {
  219439. updateZoomTarget(this);
  219440. updateTrackedEntity(this);
  219441. };
  219442. function updateZoomTarget(viewer) {
  219443. const target = viewer._zoomTarget;
  219444. if (!defined_default(target) || viewer.scene.mode === SceneMode_default.MORPHING) {
  219445. return;
  219446. }
  219447. const scene = viewer.scene;
  219448. const camera = scene.camera;
  219449. const zoomPromise = viewer._zoomPromise;
  219450. const zoomOptions = defaultValue_default(viewer._zoomOptions, {});
  219451. let options;
  219452. if (target instanceof Cesium3DTileset_default) {
  219453. return target.readyPromise.then(function() {
  219454. const boundingSphere2 = target.boundingSphere;
  219455. if (!defined_default(zoomOptions.offset)) {
  219456. zoomOptions.offset = new HeadingPitchRange_default(
  219457. 0,
  219458. -0.5,
  219459. boundingSphere2.radius
  219460. );
  219461. }
  219462. options = {
  219463. offset: zoomOptions.offset,
  219464. duration: zoomOptions.duration,
  219465. maximumHeight: zoomOptions.maximumHeight,
  219466. complete: function() {
  219467. zoomPromise.resolve(true);
  219468. },
  219469. cancel: function() {
  219470. zoomPromise.resolve(false);
  219471. }
  219472. };
  219473. if (viewer._zoomIsFlight) {
  219474. camera.flyToBoundingSphere(target.boundingSphere, options);
  219475. } else {
  219476. camera.viewBoundingSphere(boundingSphere2, zoomOptions.offset);
  219477. camera.lookAtTransform(Matrix4_default.IDENTITY);
  219478. zoomPromise.resolve(true);
  219479. }
  219480. clearZoom(viewer);
  219481. });
  219482. }
  219483. if (target instanceof TimeDynamicPointCloud_default) {
  219484. return target.readyPromise.then(function() {
  219485. const boundingSphere2 = target.boundingSphere;
  219486. if (!defined_default(zoomOptions.offset)) {
  219487. zoomOptions.offset = new HeadingPitchRange_default(
  219488. 0,
  219489. -0.5,
  219490. boundingSphere2.radius
  219491. );
  219492. }
  219493. options = {
  219494. offset: zoomOptions.offset,
  219495. duration: zoomOptions.duration,
  219496. maximumHeight: zoomOptions.maximumHeight,
  219497. complete: function() {
  219498. zoomPromise.resolve(true);
  219499. },
  219500. cancel: function() {
  219501. zoomPromise.resolve(false);
  219502. }
  219503. };
  219504. if (viewer._zoomIsFlight) {
  219505. camera.flyToBoundingSphere(boundingSphere2, options);
  219506. } else {
  219507. camera.viewBoundingSphere(boundingSphere2, zoomOptions.offset);
  219508. camera.lookAtTransform(Matrix4_default.IDENTITY);
  219509. zoomPromise.resolve(true);
  219510. }
  219511. clearZoom(viewer);
  219512. });
  219513. }
  219514. if (target instanceof Cartographic_default) {
  219515. options = {
  219516. destination: scene.mapProjection.ellipsoid.cartographicToCartesian(
  219517. target
  219518. ),
  219519. duration: zoomOptions.duration,
  219520. maximumHeight: zoomOptions.maximumHeight,
  219521. complete: function() {
  219522. zoomPromise.resolve(true);
  219523. },
  219524. cancel: function() {
  219525. zoomPromise.resolve(false);
  219526. }
  219527. };
  219528. if (viewer._zoomIsFlight) {
  219529. camera.flyTo(options);
  219530. } else {
  219531. camera.setView(options);
  219532. zoomPromise.resolve(true);
  219533. }
  219534. clearZoom(viewer);
  219535. return;
  219536. }
  219537. const entities = target;
  219538. const boundingSpheres = [];
  219539. for (let i2 = 0, len = entities.length; i2 < len; i2++) {
  219540. const state = viewer._dataSourceDisplay.getBoundingSphere(
  219541. entities[i2],
  219542. false,
  219543. boundingSphereScratch4
  219544. );
  219545. if (state === BoundingSphereState_default.PENDING) {
  219546. return;
  219547. } else if (state !== BoundingSphereState_default.FAILED) {
  219548. boundingSpheres.push(BoundingSphere_default.clone(boundingSphereScratch4));
  219549. }
  219550. }
  219551. if (boundingSpheres.length === 0) {
  219552. cancelZoom(viewer);
  219553. return;
  219554. }
  219555. viewer.trackedEntity = void 0;
  219556. const boundingSphere = BoundingSphere_default.fromBoundingSpheres(boundingSpheres);
  219557. if (!viewer._zoomIsFlight) {
  219558. camera.viewBoundingSphere(boundingSphere, zoomOptions.offset);
  219559. camera.lookAtTransform(Matrix4_default.IDENTITY);
  219560. clearZoom(viewer);
  219561. zoomPromise.resolve(true);
  219562. } else {
  219563. clearZoom(viewer);
  219564. camera.flyToBoundingSphere(boundingSphere, {
  219565. duration: zoomOptions.duration,
  219566. maximumHeight: zoomOptions.maximumHeight,
  219567. complete: function() {
  219568. zoomPromise.resolve(true);
  219569. },
  219570. cancel: function() {
  219571. zoomPromise.resolve(false);
  219572. },
  219573. offset: zoomOptions.offset
  219574. });
  219575. }
  219576. }
  219577. function updateTrackedEntity(viewer) {
  219578. if (!viewer._needTrackedEntityUpdate) {
  219579. return;
  219580. }
  219581. const trackedEntity = viewer._trackedEntity;
  219582. const currentTime = viewer.clock.currentTime;
  219583. const currentPosition = Property_default.getValueOrUndefined(
  219584. trackedEntity.position,
  219585. currentTime
  219586. );
  219587. if (!defined_default(currentPosition)) {
  219588. return;
  219589. }
  219590. const scene = viewer.scene;
  219591. const state = viewer._dataSourceDisplay.getBoundingSphere(
  219592. trackedEntity,
  219593. false,
  219594. boundingSphereScratch4
  219595. );
  219596. if (state === BoundingSphereState_default.PENDING) {
  219597. return;
  219598. }
  219599. const sceneMode = scene.mode;
  219600. if (sceneMode === SceneMode_default.COLUMBUS_VIEW || sceneMode === SceneMode_default.SCENE2D) {
  219601. scene.screenSpaceCameraController.enableTranslate = false;
  219602. }
  219603. if (sceneMode === SceneMode_default.COLUMBUS_VIEW || sceneMode === SceneMode_default.SCENE3D) {
  219604. scene.screenSpaceCameraController.enableTilt = false;
  219605. }
  219606. const bs = state !== BoundingSphereState_default.FAILED ? boundingSphereScratch4 : void 0;
  219607. viewer._entityView = new EntityView_default(
  219608. trackedEntity,
  219609. scene,
  219610. scene.mapProjection.ellipsoid
  219611. );
  219612. viewer._entityView.update(currentTime, bs);
  219613. viewer._needTrackedEntityUpdate = false;
  219614. }
  219615. var Viewer_default = Viewer;
  219616. // node_modules/cesium/Source/Widgets/Viewer/viewerCesium3DTilesInspectorMixin.js
  219617. function viewerCesium3DTilesInspectorMixin(viewer) {
  219618. Check_default.typeOf.object("viewer", viewer);
  219619. const container = document.createElement("div");
  219620. container.className = "cesium-viewer-cesium3DTilesInspectorContainer";
  219621. viewer.container.appendChild(container);
  219622. const cesium3DTilesInspector = new Cesium3DTilesInspector_default(
  219623. container,
  219624. viewer.scene
  219625. );
  219626. Object.defineProperties(viewer, {
  219627. cesium3DTilesInspector: {
  219628. get: function() {
  219629. return cesium3DTilesInspector;
  219630. }
  219631. }
  219632. });
  219633. }
  219634. var viewerCesium3DTilesInspectorMixin_default = viewerCesium3DTilesInspectorMixin;
  219635. // node_modules/cesium/Source/Widgets/Viewer/viewerCesiumInspectorMixin.js
  219636. function viewerCesiumInspectorMixin(viewer) {
  219637. if (!defined_default(viewer)) {
  219638. throw new DeveloperError_default("viewer is required.");
  219639. }
  219640. const cesiumInspectorContainer = document.createElement("div");
  219641. cesiumInspectorContainer.className = "cesium-viewer-cesiumInspectorContainer";
  219642. viewer.container.appendChild(cesiumInspectorContainer);
  219643. const cesiumInspector = new CesiumInspector_default(
  219644. cesiumInspectorContainer,
  219645. viewer.scene
  219646. );
  219647. Object.defineProperties(viewer, {
  219648. cesiumInspector: {
  219649. get: function() {
  219650. return cesiumInspector;
  219651. }
  219652. }
  219653. });
  219654. }
  219655. var viewerCesiumInspectorMixin_default = viewerCesiumInspectorMixin;
  219656. // node_modules/cesium/Source/Widgets/Viewer/viewerDragDropMixin.js
  219657. function viewerDragDropMixin(viewer, options) {
  219658. if (!defined_default(viewer)) {
  219659. throw new DeveloperError_default("viewer is required.");
  219660. }
  219661. if (viewer.hasOwnProperty("dropTarget")) {
  219662. throw new DeveloperError_default("dropTarget is already defined by another mixin.");
  219663. }
  219664. if (viewer.hasOwnProperty("dropEnabled")) {
  219665. throw new DeveloperError_default(
  219666. "dropEnabled is already defined by another mixin."
  219667. );
  219668. }
  219669. if (viewer.hasOwnProperty("dropError")) {
  219670. throw new DeveloperError_default("dropError is already defined by another mixin.");
  219671. }
  219672. if (viewer.hasOwnProperty("clearOnDrop")) {
  219673. throw new DeveloperError_default(
  219674. "clearOnDrop is already defined by another mixin."
  219675. );
  219676. }
  219677. if (viewer.hasOwnProperty("flyToOnDrop")) {
  219678. throw new DeveloperError_default(
  219679. "flyToOnDrop is already defined by another mixin."
  219680. );
  219681. }
  219682. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  219683. let dropEnabled = true;
  219684. let flyToOnDrop = defaultValue_default(options.flyToOnDrop, true);
  219685. const dropError = new Event_default();
  219686. let clearOnDrop = defaultValue_default(options.clearOnDrop, true);
  219687. let dropTarget = defaultValue_default(options.dropTarget, viewer.container);
  219688. let clampToGround = defaultValue_default(options.clampToGround, true);
  219689. let proxy = options.proxy;
  219690. dropTarget = getElement_default(dropTarget);
  219691. Object.defineProperties(viewer, {
  219692. dropTarget: {
  219693. get: function() {
  219694. return dropTarget;
  219695. },
  219696. set: function(value) {
  219697. if (!defined_default(value)) {
  219698. throw new DeveloperError_default("value is required.");
  219699. }
  219700. unsubscribe(dropTarget, handleDrop);
  219701. dropTarget = value;
  219702. subscribe(dropTarget, handleDrop);
  219703. }
  219704. },
  219705. dropEnabled: {
  219706. get: function() {
  219707. return dropEnabled;
  219708. },
  219709. set: function(value) {
  219710. if (value !== dropEnabled) {
  219711. if (value) {
  219712. subscribe(dropTarget, handleDrop);
  219713. } else {
  219714. unsubscribe(dropTarget, handleDrop);
  219715. }
  219716. dropEnabled = value;
  219717. }
  219718. }
  219719. },
  219720. dropError: {
  219721. get: function() {
  219722. return dropError;
  219723. }
  219724. },
  219725. clearOnDrop: {
  219726. get: function() {
  219727. return clearOnDrop;
  219728. },
  219729. set: function(value) {
  219730. clearOnDrop = value;
  219731. }
  219732. },
  219733. flyToOnDrop: {
  219734. get: function() {
  219735. return flyToOnDrop;
  219736. },
  219737. set: function(value) {
  219738. flyToOnDrop = value;
  219739. }
  219740. },
  219741. proxy: {
  219742. get: function() {
  219743. return proxy;
  219744. },
  219745. set: function(value) {
  219746. proxy = value;
  219747. }
  219748. },
  219749. clampToGround: {
  219750. get: function() {
  219751. return clampToGround;
  219752. },
  219753. set: function(value) {
  219754. clampToGround = value;
  219755. }
  219756. }
  219757. });
  219758. function handleDrop(event) {
  219759. stop(event);
  219760. if (clearOnDrop) {
  219761. viewer.entities.removeAll();
  219762. viewer.dataSources.removeAll();
  219763. }
  219764. const files = event.dataTransfer.files;
  219765. const length3 = files.length;
  219766. for (let i2 = 0; i2 < length3; i2++) {
  219767. const file = files[i2];
  219768. const reader = new FileReader();
  219769. reader.onload = createOnLoadCallback(viewer, file, proxy, clampToGround);
  219770. reader.onerror = createDropErrorCallback(viewer, file);
  219771. reader.readAsText(file);
  219772. }
  219773. }
  219774. subscribe(dropTarget, handleDrop);
  219775. viewer.destroy = wrapFunction_default(viewer, viewer.destroy, function() {
  219776. viewer.dropEnabled = false;
  219777. });
  219778. viewer._handleDrop = handleDrop;
  219779. }
  219780. function stop(event) {
  219781. event.stopPropagation();
  219782. event.preventDefault();
  219783. }
  219784. function unsubscribe(dropTarget, handleDrop) {
  219785. const currentTarget = dropTarget;
  219786. if (defined_default(currentTarget)) {
  219787. currentTarget.removeEventListener("drop", handleDrop, false);
  219788. currentTarget.removeEventListener("dragenter", stop, false);
  219789. currentTarget.removeEventListener("dragover", stop, false);
  219790. currentTarget.removeEventListener("dragexit", stop, false);
  219791. }
  219792. }
  219793. function subscribe(dropTarget, handleDrop) {
  219794. dropTarget.addEventListener("drop", handleDrop, false);
  219795. dropTarget.addEventListener("dragenter", stop, false);
  219796. dropTarget.addEventListener("dragover", stop, false);
  219797. dropTarget.addEventListener("dragexit", stop, false);
  219798. }
  219799. function createOnLoadCallback(viewer, file, proxy, clampToGround) {
  219800. const scene = viewer.scene;
  219801. return function(evt) {
  219802. const fileName = file.name;
  219803. try {
  219804. let loadPromise;
  219805. if (/\.czml$/i.test(fileName)) {
  219806. loadPromise = CzmlDataSource_default.load(JSON.parse(evt.target.result), {
  219807. sourceUri: fileName
  219808. });
  219809. } else if (/\.geojson$/i.test(fileName) || /\.json$/i.test(fileName) || /\.topojson$/i.test(fileName)) {
  219810. loadPromise = GeoJsonDataSource_default.load(JSON.parse(evt.target.result), {
  219811. sourceUri: fileName,
  219812. clampToGround
  219813. });
  219814. } else if (/\.(kml|kmz)$/i.test(fileName)) {
  219815. loadPromise = KmlDataSource_default.load(file, {
  219816. sourceUri: fileName,
  219817. proxy,
  219818. camera: scene.camera,
  219819. canvas: scene.canvas,
  219820. clampToGround,
  219821. screenOverlayContainer: viewer.container
  219822. });
  219823. } else if (/\.gpx$/i.test(fileName)) {
  219824. loadPromise = GpxDataSource_default.load(file, {
  219825. sourceUri: fileName,
  219826. proxy
  219827. });
  219828. } else {
  219829. viewer.dropError.raiseEvent(
  219830. viewer,
  219831. fileName,
  219832. `Unrecognized file: ${fileName}`
  219833. );
  219834. return;
  219835. }
  219836. if (defined_default(loadPromise)) {
  219837. viewer.dataSources.add(loadPromise).then(function(dataSource) {
  219838. if (viewer.flyToOnDrop) {
  219839. viewer.flyTo(dataSource);
  219840. }
  219841. }).catch(function(error) {
  219842. viewer.dropError.raiseEvent(viewer, fileName, error);
  219843. });
  219844. }
  219845. } catch (error) {
  219846. viewer.dropError.raiseEvent(viewer, fileName, error);
  219847. }
  219848. };
  219849. }
  219850. function createDropErrorCallback(viewer, file) {
  219851. return function(evt) {
  219852. viewer.dropError.raiseEvent(viewer, file.name, evt.target.error);
  219853. };
  219854. }
  219855. var viewerDragDropMixin_default = viewerDragDropMixin;
  219856. // node_modules/cesium/Source/Widgets/Viewer/viewerPerformanceWatchdogMixin.js
  219857. function viewerPerformanceWatchdogMixin(viewer, options) {
  219858. if (!defined_default(viewer)) {
  219859. throw new DeveloperError_default("viewer is required.");
  219860. }
  219861. options = defaultValue_default(options, defaultValue_default.EMPTY_OBJECT);
  219862. const performanceWatchdog = new PerformanceWatchdog_default({
  219863. scene: viewer.scene,
  219864. container: viewer.bottomContainer,
  219865. lowFrameRateMessage: options.lowFrameRateMessage
  219866. });
  219867. Object.defineProperties(viewer, {
  219868. performanceWatchdog: {
  219869. get: function() {
  219870. return performanceWatchdog;
  219871. }
  219872. }
  219873. });
  219874. }
  219875. var viewerPerformanceWatchdogMixin_default = viewerPerformanceWatchdogMixin;
  219876. // node_modules/cesium/Source/WorkersES6/createTaskProcessorWorker.js
  219877. function callAndWrap(workerFunction, parameters, transferableObjects) {
  219878. let resultOrPromise;
  219879. try {
  219880. resultOrPromise = workerFunction(parameters, transferableObjects);
  219881. return resultOrPromise;
  219882. } catch (e2) {
  219883. return Promise.reject(e2);
  219884. }
  219885. }
  219886. function createTaskProcessorWorker(workerFunction) {
  219887. let postMessage;
  219888. return function(event) {
  219889. const data = event.data;
  219890. const transferableObjects = [];
  219891. const responseMessage = {
  219892. id: data.id,
  219893. result: void 0,
  219894. error: void 0
  219895. };
  219896. return Promise.resolve(
  219897. callAndWrap(workerFunction, data.parameters, transferableObjects)
  219898. ).then(function(result) {
  219899. responseMessage.result = result;
  219900. }).catch(function(e2) {
  219901. if (e2 instanceof Error) {
  219902. responseMessage.error = {
  219903. name: e2.name,
  219904. message: e2.message,
  219905. stack: e2.stack
  219906. };
  219907. } else {
  219908. responseMessage.error = e2;
  219909. }
  219910. }).finally(function() {
  219911. if (!defined_default(postMessage)) {
  219912. postMessage = defaultValue_default(self.webkitPostMessage, self.postMessage);
  219913. }
  219914. if (!data.canTransferArrayBuffer) {
  219915. transferableObjects.length = 0;
  219916. }
  219917. try {
  219918. postMessage(responseMessage, transferableObjects);
  219919. } catch (e2) {
  219920. responseMessage.result = void 0;
  219921. responseMessage.error = `postMessage failed with error: ${formatError_default(
  219922. e2
  219923. )}
  219924. with responseMessage: ${JSON.stringify(responseMessage)}`;
  219925. postMessage(responseMessage);
  219926. }
  219927. });
  219928. };
  219929. }
  219930. var createTaskProcessorWorker_default = createTaskProcessorWorker;
  219931. // node_modules/cesium/Source/Cesium.js
  219932. var VERSION = "1.93";
  219933. export {
  219934. AlphaMode_default as AlphaMode,
  219935. AlphaPipelineStage_default as AlphaPipelineStage,
  219936. Animation_default as Animation,
  219937. AnimationViewModel_default as AnimationViewModel,
  219938. Appearance_default as Appearance,
  219939. ApproximateTerrainHeights_default as ApproximateTerrainHeights,
  219940. ArcGISTiledElevationTerrainProvider_default as ArcGISTiledElevationTerrainProvider,
  219941. ArcGisMapServerImageryProvider_default as ArcGisMapServerImageryProvider,
  219942. ArcType_default as ArcType,
  219943. AssociativeArray_default as AssociativeArray,
  219944. AttributeCompression_default as AttributeCompression,
  219945. AttributeType_default as AttributeType,
  219946. AutoExposure_default as AutoExposure,
  219947. Autolinker,
  219948. AutomaticUniforms_default as AutomaticUniforms,
  219949. Axis_default as Axis,
  219950. AxisAlignedBoundingBox_default as AxisAlignedBoundingBox,
  219951. B3dmLoader_default as B3dmLoader,
  219952. B3dmParser_default as B3dmParser,
  219953. BaseLayerPicker_default as BaseLayerPicker,
  219954. BaseLayerPickerViewModel_default as BaseLayerPickerViewModel,
  219955. BatchTable_default as BatchTable,
  219956. BatchTableHierarchy,
  219957. BatchTexture,
  219958. BatchTexturePipelineStage_default as BatchTexturePipelineStage,
  219959. Batched3DModel3DTileContent_default as Batched3DModel3DTileContent,
  219960. Billboard_default as Billboard,
  219961. BillboardCollection_default as BillboardCollection,
  219962. BillboardGraphics_default as BillboardGraphics,
  219963. BillboardVisualizer_default as BillboardVisualizer,
  219964. BingMapsGeocoderService_default as BingMapsGeocoderService,
  219965. BingMapsImageryProvider_default as BingMapsImageryProvider,
  219966. BingMapsStyle_default as BingMapsStyle,
  219967. BlendEquation_default as BlendEquation,
  219968. BlendFunction_default as BlendFunction,
  219969. BlendOption_default as BlendOption,
  219970. BlendingState_default as BlendingState,
  219971. BoundingRectangle_default as BoundingRectangle,
  219972. BoundingSphere_default as BoundingSphere,
  219973. BoundingSphereState_default as BoundingSphereState,
  219974. BoxEmitter_default as BoxEmitter,
  219975. BoxGeometry_default as BoxGeometry,
  219976. BoxGeometryUpdater_default as BoxGeometryUpdater,
  219977. BoxGraphics_default as BoxGraphics,
  219978. BoxOutlineGeometry_default as BoxOutlineGeometry,
  219979. BrdfLutGenerator_default as BrdfLutGenerator,
  219980. Buffer_default as Buffer,
  219981. BufferLoader,
  219982. BufferUsage_default as BufferUsage,
  219983. CPUStylingPipelineStage_default as CPUStylingPipelineStage,
  219984. CallbackProperty_default as CallbackProperty,
  219985. Camera_default as Camera,
  219986. CameraEventAggregator_default as CameraEventAggregator,
  219987. CameraEventType_default as CameraEventType,
  219988. CameraFlightPath_default as CameraFlightPath,
  219989. Cartesian2_default as Cartesian2,
  219990. Cartesian3_default as Cartesian3,
  219991. Cartesian4_default as Cartesian4,
  219992. Cartographic_default as Cartographic,
  219993. CartographicGeocoderService_default as CartographicGeocoderService,
  219994. CatmullRomSpline_default as CatmullRomSpline,
  219995. Cesium3DContentGroup,
  219996. Cesium3DTile_default as Cesium3DTile,
  219997. Cesium3DTileBatchTable_default as Cesium3DTileBatchTable,
  219998. Cesium3DTileColorBlendMode_default as Cesium3DTileColorBlendMode,
  219999. Cesium3DTileContent_default as Cesium3DTileContent,
  220000. Cesium3DTileContentFactory_default as Cesium3DTileContentFactory,
  220001. Cesium3DTileContentState_default as Cesium3DTileContentState,
  220002. Cesium3DTileContentType_default as Cesium3DTileContentType,
  220003. Cesium3DTileFeature_default as Cesium3DTileFeature,
  220004. Cesium3DTileFeatureTable_default as Cesium3DTileFeatureTable,
  220005. Cesium3DTileOptimizationHint_default as Cesium3DTileOptimizationHint,
  220006. Cesium3DTileOptimizations_default as Cesium3DTileOptimizations,
  220007. Cesium3DTilePass_default as Cesium3DTilePass,
  220008. Cesium3DTilePassState_default as Cesium3DTilePassState,
  220009. Cesium3DTilePointFeature_default as Cesium3DTilePointFeature,
  220010. Cesium3DTileRefine_default as Cesium3DTileRefine,
  220011. Cesium3DTileStyle_default as Cesium3DTileStyle,
  220012. Cesium3DTileStyleEngine_default as Cesium3DTileStyleEngine,
  220013. Cesium3DTilesInspector_default as Cesium3DTilesInspector,
  220014. Cesium3DTilesInspectorViewModel_default as Cesium3DTilesInspectorViewModel,
  220015. Cesium3DTileset_default as Cesium3DTileset,
  220016. Cesium3DTilesetCache_default as Cesium3DTilesetCache,
  220017. Cesium3DTilesetGraphics_default as Cesium3DTilesetGraphics,
  220018. Cesium3DTilesetHeatmap_default as Cesium3DTilesetHeatmap,
  220019. Cesium3DTilesetMetadata_default as Cesium3DTilesetMetadata,
  220020. Cesium3DTilesetMostDetailedTraversal_default as Cesium3DTilesetMostDetailedTraversal,
  220021. Cesium3DTilesetStatistics_default as Cesium3DTilesetStatistics,
  220022. Cesium3DTilesetTraversal_default as Cesium3DTilesetTraversal,
  220023. Cesium3DTilesetVisualizer_default as Cesium3DTilesetVisualizer,
  220024. CesiumInspector_default as CesiumInspector,
  220025. CesiumInspectorViewModel_default as CesiumInspectorViewModel,
  220026. CesiumTerrainProvider_default as CesiumTerrainProvider,
  220027. CesiumWidget_default as CesiumWidget,
  220028. Check_default as Check,
  220029. CheckerboardMaterialProperty_default as CheckerboardMaterialProperty,
  220030. CircleEmitter_default as CircleEmitter,
  220031. CircleGeometry_default as CircleGeometry,
  220032. CircleOutlineGeometry_default as CircleOutlineGeometry,
  220033. ClassificationModel_default as ClassificationModel,
  220034. ClassificationPrimitive_default as ClassificationPrimitive,
  220035. ClassificationType_default as ClassificationType,
  220036. ClearCommand_default as ClearCommand,
  220037. ClippingPlane_default as ClippingPlane,
  220038. ClippingPlaneCollection_default as ClippingPlaneCollection,
  220039. Clock_default as Clock,
  220040. ClockRange_default as ClockRange,
  220041. ClockStep_default as ClockStep,
  220042. ClockViewModel_default as ClockViewModel,
  220043. CloudCollection_default as CloudCollection,
  220044. CloudType_default as CloudType,
  220045. Color_default as Color,
  220046. ColorBlendMode_default as ColorBlendMode,
  220047. ColorGeometryInstanceAttribute_default as ColorGeometryInstanceAttribute,
  220048. ColorMaterialProperty_default as ColorMaterialProperty,
  220049. Command_default as Command,
  220050. ComponentDatatype_default as ComponentDatatype,
  220051. Composite3DTileContent_default as Composite3DTileContent,
  220052. CompositeEntityCollection_default as CompositeEntityCollection,
  220053. CompositeMaterialProperty_default as CompositeMaterialProperty,
  220054. CompositePositionProperty_default as CompositePositionProperty,
  220055. CompositeProperty_default as CompositeProperty,
  220056. CompressedTextureBuffer_default as CompressedTextureBuffer,
  220057. ComputeCommand_default as ComputeCommand,
  220058. ComputeEngine_default as ComputeEngine,
  220059. ConditionsExpression_default as ConditionsExpression,
  220060. ConeEmitter_default as ConeEmitter,
  220061. ConstantPositionProperty_default as ConstantPositionProperty,
  220062. ConstantProperty_default as ConstantProperty,
  220063. ConstantSpline_default as ConstantSpline,
  220064. ContentMetadata,
  220065. Context_default as Context,
  220066. ContextLimits_default as ContextLimits,
  220067. CoplanarPolygonGeometry_default as CoplanarPolygonGeometry,
  220068. CoplanarPolygonGeometryLibrary_default as CoplanarPolygonGeometryLibrary,
  220069. CoplanarPolygonOutlineGeometry_default as CoplanarPolygonOutlineGeometry,
  220070. CornerType_default as CornerType,
  220071. CorridorGeometry_default as CorridorGeometry,
  220072. CorridorGeometryLibrary_default as CorridorGeometryLibrary,
  220073. CorridorGeometryUpdater_default as CorridorGeometryUpdater,
  220074. CorridorGraphics_default as CorridorGraphics,
  220075. CorridorOutlineGeometry_default as CorridorOutlineGeometry,
  220076. Credit_default as Credit,
  220077. CreditDisplay_default as CreditDisplay,
  220078. CubeMap_default as CubeMap,
  220079. CubeMapFace_default as CubeMapFace,
  220080. CubicRealPolynomial_default as CubicRealPolynomial,
  220081. CullFace_default as CullFace,
  220082. CullingVolume_default as CullingVolume,
  220083. CumulusCloud_default as CumulusCloud,
  220084. CustomDataSource_default as CustomDataSource,
  220085. CustomHeightmapTerrainProvider_default as CustomHeightmapTerrainProvider,
  220086. CustomShader,
  220087. CustomShaderMode_default as CustomShaderMode,
  220088. CustomShaderPipelineStage_default as CustomShaderPipelineStage,
  220089. CylinderGeometry_default as CylinderGeometry,
  220090. CylinderGeometryLibrary_default as CylinderGeometryLibrary,
  220091. CylinderGeometryUpdater_default as CylinderGeometryUpdater,
  220092. CylinderGraphics_default as CylinderGraphics,
  220093. CylinderOutlineGeometry_default as CylinderOutlineGeometry,
  220094. CzmlDataSource_default as CzmlDataSource,
  220095. DataSource_default as DataSource,
  220096. DataSourceClock_default as DataSourceClock,
  220097. DataSourceCollection_default as DataSourceCollection,
  220098. DataSourceDisplay_default as DataSourceDisplay,
  220099. DebugAppearance_default as DebugAppearance,
  220100. DebugCameraPrimitive_default as DebugCameraPrimitive,
  220101. DebugInspector_default as DebugInspector,
  220102. DebugModelMatrixPrimitive_default as DebugModelMatrixPrimitive,
  220103. DefaultProxy_default as DefaultProxy,
  220104. DepthFunction_default as DepthFunction,
  220105. DepthPlane_default as DepthPlane,
  220106. DequantizationPipelineStage_default as DequantizationPipelineStage,
  220107. DerivedCommand_default as DerivedCommand,
  220108. DeveloperError_default as DeveloperError,
  220109. DeviceOrientationCameraController_default as DeviceOrientationCameraController,
  220110. DirectionalLight_default as DirectionalLight,
  220111. DiscardEmptyTileImagePolicy_default as DiscardEmptyTileImagePolicy,
  220112. DiscardMissingTileImagePolicy_default as DiscardMissingTileImagePolicy,
  220113. DistanceDisplayCondition_default as DistanceDisplayCondition,
  220114. DistanceDisplayConditionGeometryInstanceAttribute_default as DistanceDisplayConditionGeometryInstanceAttribute,
  220115. DoubleEndedPriorityQueue_default as DoubleEndedPriorityQueue,
  220116. DoublyLinkedList_default as DoublyLinkedList,
  220117. DracoLoader_default as DracoLoader,
  220118. DrawCommand_default as DrawCommand,
  220119. DynamicGeometryBatch_default as DynamicGeometryBatch,
  220120. DynamicGeometryUpdater_default as DynamicGeometryUpdater,
  220121. EarthOrientationParameters_default as EarthOrientationParameters,
  220122. EarthOrientationParametersSample_default as EarthOrientationParametersSample,
  220123. EasingFunction_default as EasingFunction,
  220124. EllipseGeometry_default as EllipseGeometry,
  220125. EllipseGeometryLibrary_default as EllipseGeometryLibrary,
  220126. EllipseGeometryUpdater_default as EllipseGeometryUpdater,
  220127. EllipseGraphics_default as EllipseGraphics,
  220128. EllipseOutlineGeometry_default as EllipseOutlineGeometry,
  220129. Ellipsoid_default as Ellipsoid,
  220130. EllipsoidGeodesic_default as EllipsoidGeodesic,
  220131. EllipsoidGeometry_default as EllipsoidGeometry,
  220132. EllipsoidGeometryUpdater_default as EllipsoidGeometryUpdater,
  220133. EllipsoidGraphics_default as EllipsoidGraphics,
  220134. EllipsoidOutlineGeometry_default as EllipsoidOutlineGeometry,
  220135. EllipsoidPrimitive_default as EllipsoidPrimitive,
  220136. EllipsoidRhumbLine_default as EllipsoidRhumbLine,
  220137. EllipsoidSurfaceAppearance_default as EllipsoidSurfaceAppearance,
  220138. EllipsoidTangentPlane_default as EllipsoidTangentPlane,
  220139. EllipsoidTerrainProvider_default as EllipsoidTerrainProvider,
  220140. EllipsoidalOccluder_default as EllipsoidalOccluder,
  220141. Empty3DTileContent_default as Empty3DTileContent,
  220142. EncodedCartesian3_default as EncodedCartesian3,
  220143. Entity_default as Entity,
  220144. EntityCluster_default as EntityCluster,
  220145. EntityCollection_default as EntityCollection,
  220146. EntityView_default as EntityView,
  220147. Event_default as Event,
  220148. EventHelper_default as EventHelper,
  220149. ExperimentalFeatures_default as ExperimentalFeatures,
  220150. Expression_default as Expression,
  220151. ExpressionNodeType_default as ExpressionNodeType,
  220152. ExtrapolationType_default as ExtrapolationType,
  220153. FeatureDetection_default as FeatureDetection,
  220154. FeatureIdPipelineStage_default as FeatureIdPipelineStage,
  220155. Fog_default as Fog,
  220156. ForEach_default as ForEach,
  220157. FrameRateMonitor_default as FrameRateMonitor,
  220158. FrameState_default as FrameState,
  220159. Framebuffer_default as Framebuffer,
  220160. FramebufferManager_default as FramebufferManager,
  220161. FrustumCommands_default as FrustumCommands,
  220162. FrustumGeometry_default as FrustumGeometry,
  220163. FrustumOutlineGeometry_default as FrustumOutlineGeometry,
  220164. Fullscreen_default as Fullscreen,
  220165. FullscreenButton_default as FullscreenButton,
  220166. FullscreenButtonViewModel_default as FullscreenButtonViewModel,
  220167. GeoJsonDataSource_default as GeoJsonDataSource,
  220168. GeocodeType_default as GeocodeType,
  220169. Geocoder_default as Geocoder,
  220170. GeocoderService_default as GeocoderService,
  220171. GeocoderViewModel_default as GeocoderViewModel,
  220172. GeographicProjection_default as GeographicProjection,
  220173. GeographicTilingScheme_default as GeographicTilingScheme,
  220174. Geometry_default as Geometry,
  220175. Geometry3DTileContent_default as Geometry3DTileContent,
  220176. GeometryAttribute_default as GeometryAttribute,
  220177. GeometryAttributes_default as GeometryAttributes,
  220178. GeometryFactory_default as GeometryFactory,
  220179. GeometryInstance_default as GeometryInstance,
  220180. GeometryInstanceAttribute_default as GeometryInstanceAttribute,
  220181. GeometryOffsetAttribute_default as GeometryOffsetAttribute,
  220182. GeometryPipeline_default as GeometryPipeline,
  220183. GeometryPipelineStage_default as GeometryPipelineStage,
  220184. GeometryType_default as GeometryType,
  220185. GeometryUpdater_default as GeometryUpdater,
  220186. GeometryVisualizer_default as GeometryVisualizer,
  220187. GetFeatureInfoFormat_default as GetFeatureInfoFormat,
  220188. Globe_default as Globe,
  220189. GlobeDepth_default as GlobeDepth,
  220190. GlobeSurfaceShaderSet_default as GlobeSurfaceShaderSet,
  220191. GlobeSurfaceTile_default as GlobeSurfaceTile,
  220192. GlobeSurfaceTileProvider_default as GlobeSurfaceTileProvider,
  220193. GlobeTranslucency_default as GlobeTranslucency,
  220194. GlobeTranslucencyFramebuffer_default as GlobeTranslucencyFramebuffer,
  220195. GlobeTranslucencyState_default as GlobeTranslucencyState,
  220196. GltfBufferViewLoader,
  220197. GltfDracoLoader,
  220198. GltfImageLoader,
  220199. GltfIndexBufferLoader,
  220200. GltfJsonLoader,
  220201. GltfLoader,
  220202. GltfLoaderUtil_default as GltfLoaderUtil,
  220203. GltfStructuralMetadataLoader,
  220204. GltfTextureLoader,
  220205. GltfVertexBufferLoader,
  220206. GoogleEarthEnterpriseImageryProvider_default as GoogleEarthEnterpriseImageryProvider,
  220207. GoogleEarthEnterpriseMapsProvider_default as GoogleEarthEnterpriseMapsProvider,
  220208. GoogleEarthEnterpriseMetadata_default as GoogleEarthEnterpriseMetadata,
  220209. GoogleEarthEnterpriseTerrainData_default as GoogleEarthEnterpriseTerrainData,
  220210. GoogleEarthEnterpriseTerrainProvider_default as GoogleEarthEnterpriseTerrainProvider,
  220211. GoogleEarthEnterpriseTileInformation_default as GoogleEarthEnterpriseTileInformation,
  220212. GpxDataSource_default as GpxDataSource,
  220213. GregorianDate_default as GregorianDate,
  220214. GridImageryProvider_default as GridImageryProvider,
  220215. GridMaterialProperty_default as GridMaterialProperty,
  220216. GroundGeometryUpdater_default as GroundGeometryUpdater,
  220217. GroundPolylineGeometry_default as GroundPolylineGeometry,
  220218. GroundPolylinePrimitive_default as GroundPolylinePrimitive,
  220219. GroundPrimitive_default as GroundPrimitive,
  220220. GroupMetadata_default as GroupMetadata,
  220221. HeadingPitchRange_default as HeadingPitchRange,
  220222. HeadingPitchRoll_default as HeadingPitchRoll,
  220223. Heap_default as Heap,
  220224. HeightReference_default as HeightReference,
  220225. HeightmapEncoding_default as HeightmapEncoding,
  220226. HeightmapTerrainData_default as HeightmapTerrainData,
  220227. HeightmapTessellator_default as HeightmapTessellator,
  220228. HermitePolynomialApproximation_default as HermitePolynomialApproximation,
  220229. HermiteSpline_default as HermiteSpline,
  220230. HilbertOrder_default as HilbertOrder,
  220231. HomeButton_default as HomeButton,
  220232. HomeButtonViewModel_default as HomeButtonViewModel,
  220233. HorizontalOrigin_default as HorizontalOrigin,
  220234. I3dmLoader_default as I3dmLoader,
  220235. I3dmParser_default as I3dmParser,
  220236. Iau2000Orientation_default as Iau2000Orientation,
  220237. Iau2006XysData_default as Iau2006XysData,
  220238. Iau2006XysSample_default as Iau2006XysSample,
  220239. IauOrientationAxes_default as IauOrientationAxes,
  220240. IauOrientationParameters_default as IauOrientationParameters,
  220241. ImageBasedLighting,
  220242. ImageBasedLightingPipelineStage_default as ImageBasedLightingPipelineStage,
  220243. ImageMaterialProperty_default as ImageMaterialProperty,
  220244. Imagery_default as Imagery,
  220245. ImageryLayer_default as ImageryLayer,
  220246. ImageryLayerCollection_default as ImageryLayerCollection,
  220247. ImageryLayerFeatureInfo_default as ImageryLayerFeatureInfo,
  220248. ImageryProvider_default as ImageryProvider,
  220249. ImagerySplitDirection_default as ImagerySplitDirection,
  220250. ImageryState_default as ImageryState,
  220251. Implicit3DTileContent,
  220252. ImplicitAvailabilityBitstream,
  220253. ImplicitMetadataView,
  220254. ImplicitSubdivisionScheme_default as ImplicitSubdivisionScheme,
  220255. ImplicitSubtree,
  220256. ImplicitSubtreeMetadata_default as ImplicitSubtreeMetadata,
  220257. ImplicitTileCoordinates,
  220258. ImplicitTileset,
  220259. IndexDatatype_default as IndexDatatype,
  220260. InfoBox_default as InfoBox,
  220261. InfoBoxViewModel_default as InfoBoxViewModel,
  220262. InspectorShared_default as InspectorShared,
  220263. InstanceAttributeSemantic_default as InstanceAttributeSemantic,
  220264. Instanced3DModel3DTileContent_default as Instanced3DModel3DTileContent,
  220265. InstancingPipelineStage_default as InstancingPipelineStage,
  220266. InterpolationAlgorithm_default as InterpolationAlgorithm,
  220267. InterpolationType_default as InterpolationType,
  220268. Intersect_default as Intersect,
  220269. IntersectionTests_default as IntersectionTests,
  220270. Intersections2D_default as Intersections2D,
  220271. Interval_default as Interval,
  220272. InvertClassification_default as InvertClassification,
  220273. Ion_default as Ion,
  220274. IonGeocoderService_default as IonGeocoderService,
  220275. IonImageryProvider_default as IonImageryProvider,
  220276. IonResource_default as IonResource,
  220277. IonWorldImageryStyle_default as IonWorldImageryStyle,
  220278. Iso8601_default as Iso8601,
  220279. JobScheduler_default as JobScheduler,
  220280. JobType_default as JobType,
  220281. JsonMetadataTable,
  220282. JulianDate_default as JulianDate,
  220283. KTX2Transcoder_default as KTX2Transcoder,
  220284. KeyboardEventModifier_default as KeyboardEventModifier,
  220285. KmlCamera_default as KmlCamera,
  220286. KmlDataSource_default as KmlDataSource,
  220287. KmlLookAt_default as KmlLookAt,
  220288. KmlTour_default as KmlTour,
  220289. KmlTourFlyTo_default as KmlTourFlyTo,
  220290. KmlTourWait_default as KmlTourWait,
  220291. Label_default as Label,
  220292. LabelCollection_default as LabelCollection,
  220293. LabelGraphics_default as LabelGraphics,
  220294. LabelStyle_default as LabelStyle,
  220295. LabelVisualizer_default as LabelVisualizer,
  220296. LagrangePolynomialApproximation_default as LagrangePolynomialApproximation,
  220297. LeapSecond_default as LeapSecond,
  220298. Light_default as Light,
  220299. LightingModel_default as LightingModel,
  220300. LightingPipelineStage_default as LightingPipelineStage,
  220301. LinearApproximation_default as LinearApproximation,
  220302. LinearSpline_default as LinearSpline,
  220303. ManagedArray_default as ManagedArray,
  220304. MapMode2D_default as MapMode2D,
  220305. MapProjection_default as MapProjection,
  220306. MapboxImageryProvider_default as MapboxImageryProvider,
  220307. MapboxStyleImageryProvider_default as MapboxStyleImageryProvider,
  220308. Material_default as Material,
  220309. MaterialAppearance_default as MaterialAppearance,
  220310. MaterialPipelineStage_default as MaterialPipelineStage,
  220311. MaterialProperty_default as MaterialProperty,
  220312. Math_default as Math,
  220313. Matrix2_default as Matrix2,
  220314. Matrix3_default as Matrix3,
  220315. Matrix4_default as Matrix4,
  220316. MetadataClass_default as MetadataClass,
  220317. MetadataClassProperty_default as MetadataClassProperty,
  220318. MetadataComponentType_default as MetadataComponentType,
  220319. MetadataEntity_default as MetadataEntity,
  220320. MetadataEnum_default as MetadataEnum,
  220321. MetadataEnumValue_default as MetadataEnumValue,
  220322. MetadataPipelineStage_default as MetadataPipelineStage,
  220323. MetadataSchema_default as MetadataSchema,
  220324. MetadataSchemaLoader,
  220325. MetadataSemantic_default as MetadataSemantic,
  220326. MetadataTable_default as MetadataTable,
  220327. MetadataTableProperty_default as MetadataTableProperty,
  220328. MetadataType_default as MetadataType,
  220329. MipmapHint_default as MipmapHint,
  220330. Model_default as Model,
  220331. ModelAlphaOptions,
  220332. ModelAnimation_default as ModelAnimation,
  220333. ModelAnimationCache_default as ModelAnimationCache,
  220334. ModelAnimationCollection_default as ModelAnimationCollection,
  220335. ModelAnimationLoop_default as ModelAnimationLoop,
  220336. ModelAnimationState_default as ModelAnimationState,
  220337. ModelClippingPlanesPipelineStage_default as ModelClippingPlanesPipelineStage,
  220338. ModelColorPipelineStage_default as ModelColorPipelineStage,
  220339. ModelComponents_default as ModelComponents,
  220340. ModelExperimental,
  220341. ModelExperimental3DTileContent,
  220342. ModelExperimentalAnimation_default as ModelExperimentalAnimation,
  220343. ModelExperimentalAnimationChannel_default as ModelExperimentalAnimationChannel,
  220344. ModelExperimentalAnimationCollection_default as ModelExperimentalAnimationCollection,
  220345. ModelExperimentalNode,
  220346. ModelExperimentalPrimitive,
  220347. ModelExperimentalSceneGraph,
  220348. ModelExperimentalSkin,
  220349. ModelExperimentalType_default as ModelExperimentalType,
  220350. ModelExperimentalUtility,
  220351. ModelFeature,
  220352. ModelFeatureTable,
  220353. ModelGraphics_default as ModelGraphics,
  220354. ModelInstance_default as ModelInstance,
  220355. ModelInstanceCollection_default as ModelInstanceCollection,
  220356. ModelLightingOptions,
  220357. ModelLoadResources_default as ModelLoadResources,
  220358. ModelMaterial_default as ModelMaterial,
  220359. ModelMatrixUpdateStage_default as ModelMatrixUpdateStage,
  220360. ModelMesh_default as ModelMesh,
  220361. ModelNode_default as ModelNode,
  220362. ModelOutlineLoader_default as ModelOutlineLoader,
  220363. ModelRenderResources,
  220364. ModelSplitterPipelineStage_default as ModelSplitterPipelineStage,
  220365. ModelUtility_default as ModelUtility,
  220366. ModelVisualizer_default as ModelVisualizer,
  220367. Moon_default as Moon,
  220368. MorphTargetsPipelineStage_default as MorphTargetsPipelineStage,
  220369. MorphWeightSpline_default as MorphWeightSpline,
  220370. MortonOrder_default as MortonOrder,
  220371. Multiple3DTileContent,
  220372. MultisampleFramebuffer_default as MultisampleFramebuffer,
  220373. NavigationHelpButton_default as NavigationHelpButton,
  220374. NavigationHelpButtonViewModel_default as NavigationHelpButtonViewModel,
  220375. NearFarScalar_default as NearFarScalar,
  220376. NeverTileDiscardPolicy_default as NeverTileDiscardPolicy,
  220377. NodeRenderResources,
  220378. NodeTransformationProperty_default as NodeTransformationProperty,
  220379. OIT_default as OIT,
  220380. Occluder_default as Occluder,
  220381. OctahedralProjectedCubeMap_default as OctahedralProjectedCubeMap,
  220382. OffsetGeometryInstanceAttribute_default as OffsetGeometryInstanceAttribute,
  220383. OpenCageGeocoderService_default as OpenCageGeocoderService,
  220384. OpenStreetMapImageryProvider_default as OpenStreetMapImageryProvider,
  220385. OrderedGroundPrimitiveCollection_default as OrderedGroundPrimitiveCollection,
  220386. OrientedBoundingBox_default as OrientedBoundingBox,
  220387. OrthographicFrustum_default as OrthographicFrustum,
  220388. OrthographicOffCenterFrustum_default as OrthographicOffCenterFrustum,
  220389. Packable_default as Packable,
  220390. PackableForInterpolation_default as PackableForInterpolation,
  220391. Particle_default as Particle,
  220392. ParticleBurst_default as ParticleBurst,
  220393. ParticleEmitter_default as ParticleEmitter,
  220394. ParticleSystem_default as ParticleSystem,
  220395. Pass_default as Pass,
  220396. PassState_default as PassState,
  220397. PathGraphics_default as PathGraphics,
  220398. PathVisualizer_default as PathVisualizer,
  220399. PeliasGeocoderService_default as PeliasGeocoderService,
  220400. PerInstanceColorAppearance_default as PerInstanceColorAppearance,
  220401. PerformanceDisplay_default as PerformanceDisplay,
  220402. PerformanceWatchdog_default as PerformanceWatchdog,
  220403. PerformanceWatchdogViewModel_default as PerformanceWatchdogViewModel,
  220404. PerspectiveFrustum_default as PerspectiveFrustum,
  220405. PerspectiveOffCenterFrustum_default as PerspectiveOffCenterFrustum,
  220406. PickDepth_default as PickDepth,
  220407. PickDepthFramebuffer_default as PickDepthFramebuffer,
  220408. PickFramebuffer_default as PickFramebuffer,
  220409. Picking_default as Picking,
  220410. PickingPipelineStage_default as PickingPipelineStage,
  220411. PinBuilder_default as PinBuilder,
  220412. PixelDatatype_default as PixelDatatype,
  220413. PixelFormat_default as PixelFormat,
  220414. Plane_default as Plane,
  220415. PlaneGeometry_default as PlaneGeometry,
  220416. PlaneGeometryUpdater_default as PlaneGeometryUpdater,
  220417. PlaneGraphics_default as PlaneGraphics,
  220418. PlaneOutlineGeometry_default as PlaneOutlineGeometry,
  220419. PntsLoader,
  220420. PntsParser_default as PntsParser,
  220421. PointCloud_default as PointCloud,
  220422. PointCloud3DTileContent_default as PointCloud3DTileContent,
  220423. PointCloudAttenuationPipelineStage_default as PointCloudAttenuationPipelineStage,
  220424. PointCloudEyeDomeLighting_default2 as PointCloudEyeDomeLighting,
  220425. PointCloudShading_default as PointCloudShading,
  220426. PointGraphics_default as PointGraphics,
  220427. PointPrimitive_default as PointPrimitive,
  220428. PointPrimitiveCollection_default as PointPrimitiveCollection,
  220429. PointVisualizer_default as PointVisualizer,
  220430. PolygonGeometry_default as PolygonGeometry,
  220431. PolygonGeometryLibrary_default as PolygonGeometryLibrary,
  220432. PolygonGeometryUpdater_default as PolygonGeometryUpdater,
  220433. PolygonGraphics_default as PolygonGraphics,
  220434. PolygonHierarchy_default as PolygonHierarchy,
  220435. PolygonOutlineGeometry_default as PolygonOutlineGeometry,
  220436. PolygonPipeline_default as PolygonPipeline,
  220437. Polyline_default as Polyline,
  220438. PolylineArrowMaterialProperty_default as PolylineArrowMaterialProperty,
  220439. PolylineCollection_default as PolylineCollection,
  220440. PolylineColorAppearance_default as PolylineColorAppearance,
  220441. PolylineDashMaterialProperty_default as PolylineDashMaterialProperty,
  220442. PolylineGeometry_default as PolylineGeometry,
  220443. PolylineGeometryUpdater_default as PolylineGeometryUpdater,
  220444. PolylineGlowMaterialProperty_default as PolylineGlowMaterialProperty,
  220445. PolylineGraphics_default as PolylineGraphics,
  220446. PolylineMaterialAppearance_default as PolylineMaterialAppearance,
  220447. PolylineOutlineMaterialProperty_default as PolylineOutlineMaterialProperty,
  220448. PolylinePipeline_default as PolylinePipeline,
  220449. PolylineVisualizer_default as PolylineVisualizer,
  220450. PolylineVolumeGeometry_default as PolylineVolumeGeometry,
  220451. PolylineVolumeGeometryLibrary_default as PolylineVolumeGeometryLibrary,
  220452. PolylineVolumeGeometryUpdater_default as PolylineVolumeGeometryUpdater,
  220453. PolylineVolumeGraphics_default as PolylineVolumeGraphics,
  220454. PolylineVolumeOutlineGeometry_default as PolylineVolumeOutlineGeometry,
  220455. PositionProperty_default as PositionProperty,
  220456. PositionPropertyArray_default as PositionPropertyArray,
  220457. PostProcessStage_default as PostProcessStage,
  220458. PostProcessStageCollection_default as PostProcessStageCollection,
  220459. PostProcessStageComposite_default as PostProcessStageComposite,
  220460. PostProcessStageLibrary_default as PostProcessStageLibrary,
  220461. PostProcessStageSampleMode_default as PostProcessStageSampleMode,
  220462. PostProcessStageTextureCache_default as PostProcessStageTextureCache,
  220463. Primitive_default as Primitive,
  220464. PrimitiveCollection_default as PrimitiveCollection,
  220465. PrimitivePipeline_default as PrimitivePipeline,
  220466. PrimitiveRenderResources,
  220467. PrimitiveState_default as PrimitiveState,
  220468. PrimitiveType_default as PrimitiveType,
  220469. ProjectionPicker_default as ProjectionPicker,
  220470. ProjectionPickerViewModel_default as ProjectionPickerViewModel,
  220471. Property_default as Property,
  220472. PropertyArray_default as PropertyArray,
  220473. PropertyAttribute,
  220474. PropertyAttributeProperty,
  220475. PropertyBag_default as PropertyBag,
  220476. PropertyTable_default as PropertyTable,
  220477. PropertyTexture_default as PropertyTexture,
  220478. PropertyTextureProperty_default as PropertyTextureProperty,
  220479. ProviderViewModel_default as ProviderViewModel,
  220480. Proxy_default as Proxy,
  220481. QuadraticRealPolynomial_default as QuadraticRealPolynomial,
  220482. QuadtreeOccluders_default as QuadtreeOccluders,
  220483. QuadtreePrimitive_default as QuadtreePrimitive,
  220484. QuadtreeTile_default as QuadtreeTile,
  220485. QuadtreeTileLoadState_default as QuadtreeTileLoadState,
  220486. QuadtreeTileProvider_default as QuadtreeTileProvider,
  220487. QuantizedMeshTerrainData_default as QuantizedMeshTerrainData,
  220488. QuarticRealPolynomial_default as QuarticRealPolynomial,
  220489. Quaternion_default as Quaternion,
  220490. QuaternionSpline_default as QuaternionSpline,
  220491. Queue_default as Queue,
  220492. Ray_default as Ray,
  220493. Rectangle_default as Rectangle,
  220494. RectangleCollisionChecker_default as RectangleCollisionChecker,
  220495. RectangleGeometry_default as RectangleGeometry,
  220496. RectangleGeometryLibrary_default as RectangleGeometryLibrary,
  220497. RectangleGeometryUpdater_default as RectangleGeometryUpdater,
  220498. RectangleGraphics_default as RectangleGraphics,
  220499. RectangleOutlineGeometry_default as RectangleOutlineGeometry,
  220500. ReferenceFrame_default as ReferenceFrame,
  220501. ReferenceProperty_default as ReferenceProperty,
  220502. RenderState_default as RenderState,
  220503. Renderbuffer_default as Renderbuffer,
  220504. RenderbufferFormat_default as RenderbufferFormat,
  220505. Request_default as Request,
  220506. RequestErrorEvent_default as RequestErrorEvent,
  220507. RequestScheduler_default as RequestScheduler,
  220508. RequestState_default as RequestState,
  220509. RequestType_default as RequestType,
  220510. Resource_default as Resource,
  220511. ResourceCache_default as ResourceCache,
  220512. ResourceCacheKey_default as ResourceCacheKey,
  220513. ResourceLoader,
  220514. ResourceLoaderState_default as ResourceLoaderState,
  220515. Rotation_default as Rotation,
  220516. RuntimeError_default as RuntimeError,
  220517. S2Cell_default as S2Cell,
  220518. SDFSettings_default as SDFSettings,
  220519. SampledPositionProperty_default as SampledPositionProperty,
  220520. SampledProperty_default as SampledProperty,
  220521. Sampler_default as Sampler,
  220522. ScaledPositionProperty_default as ScaledPositionProperty,
  220523. Scene_default as Scene,
  220524. SceneFramebuffer_default as SceneFramebuffer,
  220525. SceneMode_default as SceneMode,
  220526. SceneModePicker_default as SceneModePicker,
  220527. SceneModePickerViewModel_default as SceneModePickerViewModel,
  220528. SceneTransforms_default as SceneTransforms,
  220529. SceneTransitioner_default as SceneTransitioner,
  220530. ScreenSpaceCameraController_default as ScreenSpaceCameraController,
  220531. ScreenSpaceEventHandler_default as ScreenSpaceEventHandler,
  220532. ScreenSpaceEventType_default as ScreenSpaceEventType,
  220533. SelectedFeatureIdPipelineStage_default as SelectedFeatureIdPipelineStage,
  220534. SelectionIndicator_default as SelectionIndicator,
  220535. SelectionIndicatorViewModel_default as SelectionIndicatorViewModel,
  220536. ShaderBuilder,
  220537. ShaderCache_default as ShaderCache,
  220538. ShaderDestination_default as ShaderDestination,
  220539. ShaderFunction,
  220540. ShaderProgram_default as ShaderProgram,
  220541. ShaderSource_default as ShaderSource,
  220542. ShaderStruct,
  220543. ShadowMap_default as ShadowMap,
  220544. ShadowMapShader_default as ShadowMapShader,
  220545. ShadowMode_default as ShadowMode,
  220546. ShadowVolumeAppearance_default as ShadowVolumeAppearance,
  220547. ShowGeometryInstanceAttribute_default as ShowGeometryInstanceAttribute,
  220548. Simon1994PlanetaryPositions_default as Simon1994PlanetaryPositions,
  220549. SimplePolylineGeometry_default as SimplePolylineGeometry,
  220550. SingleTileImageryProvider_default as SingleTileImageryProvider,
  220551. SkinningPipelineStage_default as SkinningPipelineStage,
  220552. SkyAtmosphere_default as SkyAtmosphere,
  220553. SkyBox_default as SkyBox,
  220554. SphereEmitter_default as SphereEmitter,
  220555. SphereGeometry_default as SphereGeometry,
  220556. SphereOutlineGeometry_default as SphereOutlineGeometry,
  220557. Spherical_default as Spherical,
  220558. Spline_default as Spline,
  220559. SplitDirection_default as SplitDirection,
  220560. Splitter_default as Splitter,
  220561. StaticGeometryColorBatch_default as StaticGeometryColorBatch,
  220562. StaticGeometryPerMaterialBatch_default as StaticGeometryPerMaterialBatch,
  220563. StaticGroundGeometryColorBatch_default as StaticGroundGeometryColorBatch,
  220564. StaticGroundGeometryPerMaterialBatch_default as StaticGroundGeometryPerMaterialBatch,
  220565. StaticGroundPolylinePerMaterialBatch_default as StaticGroundPolylinePerMaterialBatch,
  220566. StaticOutlineGeometryBatch_default as StaticOutlineGeometryBatch,
  220567. StencilConstants_default as StencilConstants,
  220568. StencilFunction_default as StencilFunction,
  220569. StencilOperation_default as StencilOperation,
  220570. SteppedSpline_default as SteppedSpline,
  220571. StripeMaterialProperty_default as StripeMaterialProperty,
  220572. StripeOrientation_default as StripeOrientation,
  220573. StructuralMetadata_default as StructuralMetadata,
  220574. StyleCommandsNeeded_default as StyleCommandsNeeded,
  220575. StyleExpression_default as StyleExpression,
  220576. Sun_default as Sun,
  220577. SunLight_default as SunLight,
  220578. SunPostProcess_default as SunPostProcess,
  220579. SupportedImageFormats,
  220580. SvgPathBindingHandler_default as SvgPathBindingHandler,
  220581. TaskProcessor_default as TaskProcessor,
  220582. TerrainData_default as TerrainData,
  220583. TerrainEncoding_default as TerrainEncoding,
  220584. TerrainExaggeration_default as TerrainExaggeration,
  220585. TerrainFillMesh_default as TerrainFillMesh,
  220586. TerrainMesh_default as TerrainMesh,
  220587. TerrainOffsetProperty_default as TerrainOffsetProperty,
  220588. TerrainProvider_default as TerrainProvider,
  220589. TerrainQuantization_default as TerrainQuantization,
  220590. TerrainState_default as TerrainState,
  220591. Texture_default as Texture,
  220592. TextureAtlas_default as TextureAtlas,
  220593. TextureCache_default as TextureCache,
  220594. TextureMagnificationFilter_default as TextureMagnificationFilter,
  220595. TextureManager,
  220596. TextureMinificationFilter_default as TextureMinificationFilter,
  220597. TextureUniform,
  220598. TextureWrap_default as TextureWrap,
  220599. TileAvailability_default as TileAvailability,
  220600. TileBoundingRegion_default as TileBoundingRegion,
  220601. TileBoundingS2Cell_default as TileBoundingS2Cell,
  220602. TileBoundingSphere_default as TileBoundingSphere,
  220603. TileBoundingVolume_default as TileBoundingVolume,
  220604. TileCoordinatesImageryProvider_default as TileCoordinatesImageryProvider,
  220605. TileDiscardPolicy_default as TileDiscardPolicy,
  220606. TileEdge_default as TileEdge,
  220607. TileImagery_default as TileImagery,
  220608. TileMapServiceImageryProvider_default as TileMapServiceImageryProvider,
  220609. TileMetadata,
  220610. TileOrientedBoundingBox_default as TileOrientedBoundingBox,
  220611. TileProviderError_default as TileProviderError,
  220612. TileReplacementQueue_default as TileReplacementQueue,
  220613. TileSelectionResult_default as TileSelectionResult,
  220614. TileState_default as TileState,
  220615. Tileset3DTileContent_default as Tileset3DTileContent,
  220616. TilesetMetadata_default as TilesetMetadata,
  220617. TilingScheme_default as TilingScheme,
  220618. TimeConstants_default as TimeConstants,
  220619. TimeDynamicImagery_default as TimeDynamicImagery,
  220620. TimeDynamicPointCloud_default as TimeDynamicPointCloud,
  220621. TimeInterval_default as TimeInterval,
  220622. TimeIntervalCollection_default as TimeIntervalCollection,
  220623. TimeIntervalCollectionPositionProperty_default as TimeIntervalCollectionPositionProperty,
  220624. TimeIntervalCollectionProperty_default as TimeIntervalCollectionProperty,
  220625. TimeStandard_default as TimeStandard,
  220626. Timeline_default as Timeline,
  220627. TimelineHighlightRange_default as TimelineHighlightRange,
  220628. TimelineTrack_default as TimelineTrack,
  220629. Tipsify_default as Tipsify,
  220630. ToggleButtonViewModel_default as ToggleButtonViewModel,
  220631. Tonemapper_default as Tonemapper,
  220632. Transforms_default as Transforms,
  220633. TranslationRotationScale_default as TranslationRotationScale,
  220634. TranslucentTileClassification_default as TranslucentTileClassification,
  220635. TridiagonalSystemSolver_default as TridiagonalSystemSolver,
  220636. TrustedServers_default as TrustedServers,
  220637. Tween,
  220638. TweenCollection_default as TweenCollection,
  220639. UniformState_default as UniformState,
  220640. UniformType_default as UniformType,
  220641. URI as Uri,
  220642. UrlTemplateImageryProvider_default as UrlTemplateImageryProvider,
  220643. VERSION,
  220644. VRButton_default as VRButton,
  220645. VRButtonViewModel_default as VRButtonViewModel,
  220646. VRTheWorldTerrainProvider_default as VRTheWorldTerrainProvider,
  220647. VaryingType_default as VaryingType,
  220648. Vector3DTileBatch_default as Vector3DTileBatch,
  220649. Vector3DTileClampedPolylines_default as Vector3DTileClampedPolylines,
  220650. Vector3DTileContent_default as Vector3DTileContent,
  220651. Vector3DTileGeometry_default as Vector3DTileGeometry,
  220652. Vector3DTilePoints_default as Vector3DTilePoints,
  220653. Vector3DTilePolygons_default as Vector3DTilePolygons,
  220654. Vector3DTilePolylines_default as Vector3DTilePolylines,
  220655. Vector3DTilePrimitive_default as Vector3DTilePrimitive,
  220656. VelocityOrientationProperty_default as VelocityOrientationProperty,
  220657. VelocityVectorProperty_default as VelocityVectorProperty,
  220658. VertexArray_default as VertexArray,
  220659. VertexArrayFacade_default as VertexArrayFacade,
  220660. VertexAttributeSemantic_default as VertexAttributeSemantic,
  220661. VertexFormat_default as VertexFormat,
  220662. VerticalOrigin_default as VerticalOrigin,
  220663. VideoSynchronizer_default as VideoSynchronizer,
  220664. View_default as View,
  220665. Viewer_default as Viewer,
  220666. ViewportQuad_default as ViewportQuad,
  220667. Visibility_default as Visibility,
  220668. Visualizer_default as Visualizer,
  220669. VulkanConstants_default as VulkanConstants,
  220670. WallGeometry_default as WallGeometry,
  220671. WallGeometryLibrary_default as WallGeometryLibrary,
  220672. WallGeometryUpdater_default as WallGeometryUpdater,
  220673. WallGraphics_default as WallGraphics,
  220674. WallOutlineGeometry_default as WallOutlineGeometry,
  220675. WebGLConstants_default as WebGLConstants,
  220676. WebMapServiceImageryProvider_default as WebMapServiceImageryProvider,
  220677. WebMapTileServiceImageryProvider_default as WebMapTileServiceImageryProvider,
  220678. WebMercatorProjection_default as WebMercatorProjection,
  220679. WebMercatorTilingScheme_default as WebMercatorTilingScheme,
  220680. WindingOrder_default as WindingOrder,
  220681. WireframeIndexGenerator_default as WireframeIndexGenerator,
  220682. AcesTonemappingStage_default as _shadersAcesTonemappingStage,
  220683. AdditiveBlend_default as _shadersAdditiveBlend,
  220684. AdjustTranslucentFS_default as _shadersAdjustTranslucentFS,
  220685. AllMaterialAppearanceFS_default as _shadersAllMaterialAppearanceFS,
  220686. AllMaterialAppearanceVS_default as _shadersAllMaterialAppearanceVS,
  220687. AmbientOcclusionGenerate_default as _shadersAmbientOcclusionGenerate,
  220688. AmbientOcclusionModulate_default as _shadersAmbientOcclusionModulate,
  220689. AspectRampMaterial_default as _shadersAspectRampMaterial,
  220690. AtmosphereCommon_default as _shadersAtmosphereCommon,
  220691. BasicMaterialAppearanceFS_default as _shadersBasicMaterialAppearanceFS,
  220692. BasicMaterialAppearanceVS_default as _shadersBasicMaterialAppearanceVS,
  220693. BillboardCollectionFS_default as _shadersBillboardCollectionFS,
  220694. BillboardCollectionVS_default as _shadersBillboardCollectionVS,
  220695. BlackAndWhite_default as _shadersBlackAndWhite,
  220696. BloomComposite_default as _shadersBloomComposite,
  220697. BrdfLutGeneratorFS_default as _shadersBrdfLutGeneratorFS,
  220698. BrightPass_default as _shadersBrightPass,
  220699. Brightness_default as _shadersBrightness,
  220700. BumpMapMaterial_default as _shadersBumpMapMaterial,
  220701. CPUStylingStageFS_default as _shadersCPUStylingStageFS,
  220702. CPUStylingStageVS_default as _shadersCPUStylingStageVS,
  220703. CheckerboardMaterial_default as _shadersCheckerboardMaterial,
  220704. CloudCollectionFS_default as _shadersCloudCollectionFS,
  220705. CloudCollectionVS_default as _shadersCloudCollectionVS,
  220706. CloudNoiseFS_default as _shadersCloudNoiseFS,
  220707. CloudNoiseVS_default as _shadersCloudNoiseVS,
  220708. CompareAndPackTranslucentDepth_default as _shadersCompareAndPackTranslucentDepth,
  220709. CompositeOITFS_default as _shadersCompositeOITFS,
  220710. CompositeTranslucentClassification_default as _shadersCompositeTranslucentClassification,
  220711. ContrastBias_default as _shadersContrastBias,
  220712. CustomShaderStageFS_default as _shadersCustomShaderStageFS,
  220713. CustomShaderStageVS_default as _shadersCustomShaderStageVS,
  220714. CzmBuiltins_default as _shadersCzmBuiltins,
  220715. DepthOfField_default as _shadersDepthOfField,
  220716. DepthPlaneFS_default as _shadersDepthPlaneFS,
  220717. DepthPlaneVS_default as _shadersDepthPlaneVS,
  220718. DepthView_default as _shadersDepthView,
  220719. DepthViewPacked_default as _shadersDepthViewPacked,
  220720. DotMaterial_default as _shadersDotMaterial,
  220721. EdgeDetection_default as _shadersEdgeDetection,
  220722. ElevationBandMaterial_default as _shadersElevationBandMaterial,
  220723. ElevationContourMaterial_default as _shadersElevationContourMaterial,
  220724. ElevationRampMaterial_default as _shadersElevationRampMaterial,
  220725. EllipsoidFS_default as _shadersEllipsoidFS,
  220726. EllipsoidSurfaceAppearanceFS_default as _shadersEllipsoidSurfaceAppearanceFS,
  220727. EllipsoidSurfaceAppearanceVS_default as _shadersEllipsoidSurfaceAppearanceVS,
  220728. EllipsoidVS_default as _shadersEllipsoidVS,
  220729. FXAA_default as _shadersFXAA,
  220730. FXAA3_11_default as _shadersFXAA3_11,
  220731. FadeMaterial_default as _shadersFadeMaterial,
  220732. FeatureIdStageFS_default as _shadersFeatureIdStageFS,
  220733. FeatureIdStageVS_default as _shadersFeatureIdStageVS,
  220734. FilmicTonemapping_default as _shadersFilmicTonemapping,
  220735. GaussianBlur1D_default as _shadersGaussianBlur1D,
  220736. GeometryStageFS_default as _shadersGeometryStageFS,
  220737. GeometryStageVS_default as _shadersGeometryStageVS,
  220738. GlobeFS_default as _shadersGlobeFS,
  220739. GlobeVS_default as _shadersGlobeVS,
  220740. GridMaterial_default as _shadersGridMaterial,
  220741. GroundAtmosphere_default as _shadersGroundAtmosphere,
  220742. HSBToRGB_default as _shadersHSBToRGB,
  220743. HSLToRGB_default as _shadersHSLToRGB,
  220744. ImageBasedLightingStageFS_default as _shadersImageBasedLightingStageFS,
  220745. InstancingStageCommon_default as _shadersInstancingStageCommon,
  220746. InstancingStageVS_default as _shadersInstancingStageVS,
  220747. LegacyInstancingStageVS_default as _shadersLegacyInstancingStageVS,
  220748. LensFlare_default as _shadersLensFlare,
  220749. LightingStageFS_default as _shadersLightingStageFS,
  220750. MaterialStageFS_default as _shadersMaterialStageFS,
  220751. MetadataStageFS_default as _shadersMetadataStageFS,
  220752. MetadataStageVS_default as _shadersMetadataStageVS,
  220753. ModelClippingPlanesStageFS_default as _shadersModelClippingPlanesStageFS,
  220754. ModelColorStageFS_default as _shadersModelColorStageFS,
  220755. ModelExperimentalFS_default as _shadersModelExperimentalFS,
  220756. ModelExperimentalVS_default as _shadersModelExperimentalVS,
  220757. ModelSplitterStageFS_default as _shadersModelSplitterStageFS,
  220758. ModifiedReinhardTonemapping_default as _shadersModifiedReinhardTonemapping,
  220759. MorphTargetsStageVS_default as _shadersMorphTargetsStageVS,
  220760. NightVision_default as _shadersNightVision,
  220761. NormalMapMaterial_default as _shadersNormalMapMaterial,
  220762. OctahedralProjectionAtlasFS_default as _shadersOctahedralProjectionAtlasFS,
  220763. OctahedralProjectionFS_default as _shadersOctahedralProjectionFS,
  220764. OctahedralProjectionVS_default as _shadersOctahedralProjectionVS,
  220765. PassThrough_default as _shadersPassThrough,
  220766. PassThroughDepth_default as _shadersPassThroughDepth,
  220767. PerInstanceColorAppearanceFS_default as _shadersPerInstanceColorAppearanceFS,
  220768. PerInstanceColorAppearanceVS_default as _shadersPerInstanceColorAppearanceVS,
  220769. PerInstanceFlatColorAppearanceFS_default as _shadersPerInstanceFlatColorAppearanceFS,
  220770. PerInstanceFlatColorAppearanceVS_default as _shadersPerInstanceFlatColorAppearanceVS,
  220771. PointCloudAttenuationStageVS_default as _shadersPointCloudAttenuationStageVS,
  220772. PointCloudEyeDomeLighting_default as _shadersPointCloudEyeDomeLighting,
  220773. PointPrimitiveCollectionFS_default as _shadersPointPrimitiveCollectionFS,
  220774. PointPrimitiveCollectionVS_default as _shadersPointPrimitiveCollectionVS,
  220775. PolylineArrowMaterial_default as _shadersPolylineArrowMaterial,
  220776. PolylineColorAppearanceVS_default as _shadersPolylineColorAppearanceVS,
  220777. PolylineCommon_default as _shadersPolylineCommon,
  220778. PolylineDashMaterial_default as _shadersPolylineDashMaterial,
  220779. PolylineFS_default as _shadersPolylineFS,
  220780. PolylineGlowMaterial_default as _shadersPolylineGlowMaterial,
  220781. PolylineMaterialAppearanceVS_default as _shadersPolylineMaterialAppearanceVS,
  220782. PolylineOutlineMaterial_default as _shadersPolylineOutlineMaterial,
  220783. PolylineShadowVolumeFS_default as _shadersPolylineShadowVolumeFS,
  220784. PolylineShadowVolumeMorphFS_default as _shadersPolylineShadowVolumeMorphFS,
  220785. PolylineShadowVolumeMorphVS_default as _shadersPolylineShadowVolumeMorphVS,
  220786. PolylineShadowVolumeVS_default as _shadersPolylineShadowVolumeVS,
  220787. PolylineVS_default as _shadersPolylineVS,
  220788. RGBToHSB_default as _shadersRGBToHSB,
  220789. RGBToHSL_default as _shadersRGBToHSL,
  220790. RGBToXYZ_default as _shadersRGBToXYZ,
  220791. ReinhardTonemapping_default as _shadersReinhardTonemapping,
  220792. ReprojectWebMercatorFS_default as _shadersReprojectWebMercatorFS,
  220793. ReprojectWebMercatorVS_default as _shadersReprojectWebMercatorVS,
  220794. RimLightingMaterial_default as _shadersRimLightingMaterial,
  220795. SelectedFeatureIdStageCommon_default as _shadersSelectedFeatureIdStageCommon,
  220796. ShadowVolumeAppearanceFS_default as _shadersShadowVolumeAppearanceFS,
  220797. ShadowVolumeAppearanceVS_default as _shadersShadowVolumeAppearanceVS,
  220798. ShadowVolumeFS_default as _shadersShadowVolumeFS,
  220799. Silhouette_default as _shadersSilhouette,
  220800. SkinningStageVS_default as _shadersSkinningStageVS,
  220801. SkyAtmosphereCommon_default as _shadersSkyAtmosphereCommon,
  220802. SkyAtmosphereFS_default as _shadersSkyAtmosphereFS,
  220803. SkyAtmosphereVS_default as _shadersSkyAtmosphereVS,
  220804. SkyBoxFS_default as _shadersSkyBoxFS,
  220805. SkyBoxVS_default as _shadersSkyBoxVS,
  220806. SlopeRampMaterial_default as _shadersSlopeRampMaterial,
  220807. StripeMaterial_default as _shadersStripeMaterial,
  220808. SunFS_default as _shadersSunFS,
  220809. SunTextureFS_default as _shadersSunTextureFS,
  220810. SunVS_default as _shadersSunVS,
  220811. TexturedMaterialAppearanceFS_default as _shadersTexturedMaterialAppearanceFS,
  220812. TexturedMaterialAppearanceVS_default as _shadersTexturedMaterialAppearanceVS,
  220813. Vector3DTileClampedPolylinesFS_default as _shadersVector3DTileClampedPolylinesFS,
  220814. Vector3DTileClampedPolylinesVS_default as _shadersVector3DTileClampedPolylinesVS,
  220815. Vector3DTilePolylinesVS_default as _shadersVector3DTilePolylinesVS,
  220816. VectorTileVS_default as _shadersVectorTileVS,
  220817. ViewportQuadFS_default as _shadersViewportQuadFS,
  220818. ViewportQuadVS_default as _shadersViewportQuadVS,
  220819. Water_default as _shadersWater,
  220820. XYZToRGB_default as _shadersXYZToRGB,
  220821. acesTonemapping_default as _shadersacesTonemapping,
  220822. alphaWeight_default as _shadersalphaWeight,
  220823. antialias_default as _shadersantialias,
  220824. approximateSphericalCoordinates_default as _shadersapproximateSphericalCoordinates,
  220825. backFacing_default as _shadersbackFacing,
  220826. branchFreeTernary_default as _shadersbranchFreeTernary,
  220827. cascadeColor_default as _shaderscascadeColor,
  220828. cascadeDistance_default as _shaderscascadeDistance,
  220829. cascadeMatrix_default as _shaderscascadeMatrix,
  220830. cascadeWeights_default as _shaderscascadeWeights,
  220831. columbusViewMorph_default as _shaderscolumbusViewMorph,
  220832. computePosition_default as _shaderscomputePosition,
  220833. cosineAndSine_default as _shaderscosineAndSine,
  220834. decompressTextureCoordinates_default as _shadersdecompressTextureCoordinates,
  220835. defaultPbrMaterial_default as _shadersdefaultPbrMaterial,
  220836. degreesPerRadian_default as _shadersdegreesPerRadian,
  220837. depthClamp_default as _shadersdepthClamp,
  220838. depthRange_default as _shadersdepthRange,
  220839. depthRangeStruct_default as _shadersdepthRangeStruct,
  220840. eastNorthUpToEyeCoordinates_default as _shaderseastNorthUpToEyeCoordinates,
  220841. ellipsoidContainsPoint_default as _shadersellipsoidContainsPoint,
  220842. ellipsoidWgs84TextureCoordinates_default as _shadersellipsoidWgs84TextureCoordinates,
  220843. epsilon1_default as _shadersepsilon1,
  220844. epsilon2_default as _shadersepsilon2,
  220845. epsilon3_default as _shadersepsilon3,
  220846. epsilon4_default as _shadersepsilon4,
  220847. epsilon5_default as _shadersepsilon5,
  220848. epsilon6_default as _shadersepsilon6,
  220849. epsilon7_default as _shadersepsilon7,
  220850. equalsEpsilon_default as _shadersequalsEpsilon,
  220851. eyeOffset_default as _shaderseyeOffset,
  220852. eyeToWindowCoordinates_default as _shaderseyeToWindowCoordinates,
  220853. fastApproximateAtan_default as _shadersfastApproximateAtan,
  220854. fog_default as _shadersfog,
  220855. gammaCorrect_default as _shadersgammaCorrect,
  220856. geodeticSurfaceNormal_default as _shadersgeodeticSurfaceNormal,
  220857. getDefaultMaterial_default as _shadersgetDefaultMaterial,
  220858. getLambertDiffuse_default as _shadersgetLambertDiffuse,
  220859. getSpecular_default as _shadersgetSpecular,
  220860. getWaterNoise_default as _shadersgetWaterNoise,
  220861. hue_default as _shadershue,
  220862. infinity_default as _shadersinfinity,
  220863. inverseGamma_default as _shadersinverseGamma,
  220864. isEmpty_default as _shadersisEmpty,
  220865. isFull_default as _shadersisFull,
  220866. latitudeToWebMercatorFraction_default as _shaderslatitudeToWebMercatorFraction,
  220867. lineDistance_default as _shaderslineDistance,
  220868. linearToSrgb_default as _shaderslinearToSrgb,
  220869. luminance_default as _shadersluminance,
  220870. material_default as _shadersmaterial,
  220871. materialInput_default as _shadersmaterialInput,
  220872. metersPerPixel_default as _shadersmetersPerPixel,
  220873. modelMaterial_default as _shadersmodelMaterial,
  220874. modelToWindowCoordinates_default as _shadersmodelToWindowCoordinates,
  220875. modelVertexOutput_default as _shadersmodelVertexOutput,
  220876. multiplyWithColorBalance_default as _shadersmultiplyWithColorBalance,
  220877. nearFarScalar_default as _shadersnearFarScalar,
  220878. octDecode_default as _shadersoctDecode,
  220879. oneOverPi_default as _shadersoneOverPi,
  220880. oneOverTwoPi_default as _shadersoneOverTwoPi,
  220881. packDepth_default as _shaderspackDepth,
  220882. passCesium3DTile_default as _shaderspassCesium3DTile,
  220883. passCesium3DTileClassification_default as _shaderspassCesium3DTileClassification,
  220884. passCesium3DTileClassificationIgnoreShow_default as _shaderspassCesium3DTileClassificationIgnoreShow,
  220885. passClassification_default as _shaderspassClassification,
  220886. passCompute_default as _shaderspassCompute,
  220887. passEnvironment_default as _shaderspassEnvironment,
  220888. passGlobe_default as _shaderspassGlobe,
  220889. passOpaque_default as _shaderspassOpaque,
  220890. passOverlay_default as _shaderspassOverlay,
  220891. passTerrainClassification_default as _shaderspassTerrainClassification,
  220892. passTranslucent_default as _shaderspassTranslucent,
  220893. pbrLighting_default as _shaderspbrLighting,
  220894. pbrMetallicRoughnessMaterial_default as _shaderspbrMetallicRoughnessMaterial,
  220895. pbrParameters_default as _shaderspbrParameters,
  220896. pbrSpecularGlossinessMaterial_default as _shaderspbrSpecularGlossinessMaterial,
  220897. phong_default as _shadersphong,
  220898. pi_default as _shaderspi,
  220899. piOverFour_default as _shaderspiOverFour,
  220900. piOverSix_default as _shaderspiOverSix,
  220901. piOverThree_default as _shaderspiOverThree,
  220902. piOverTwo_default as _shaderspiOverTwo,
  220903. planeDistance_default as _shadersplaneDistance,
  220904. pointAlongRay_default as _shaderspointAlongRay,
  220905. radiansPerDegree_default as _shadersradiansPerDegree,
  220906. ray_default as _shadersray,
  220907. rayEllipsoidIntersectionInterval_default as _shadersrayEllipsoidIntersectionInterval,
  220908. raySegment_default as _shadersraySegment,
  220909. raySphereIntersectionInterval_default as _shadersraySphereIntersectionInterval,
  220910. readDepth_default as _shadersreadDepth,
  220911. readNonPerspective_default as _shadersreadNonPerspective,
  220912. reverseLogDepth_default as _shadersreverseLogDepth,
  220913. round_default as _shadersround,
  220914. sampleOctahedralProjection_default as _shaderssampleOctahedralProjection,
  220915. saturation_default as _shaderssaturation,
  220916. sceneMode2D_default as _shaderssceneMode2D,
  220917. sceneMode3D_default as _shaderssceneMode3D,
  220918. sceneModeColumbusView_default as _shaderssceneModeColumbusView,
  220919. sceneModeMorphing_default as _shaderssceneModeMorphing,
  220920. shadowDepthCompare_default as _shadersshadowDepthCompare,
  220921. shadowParameters_default as _shadersshadowParameters,
  220922. shadowVisibility_default as _shadersshadowVisibility,
  220923. signNotZero_default as _shaderssignNotZero,
  220924. solarRadius_default as _shaderssolarRadius,
  220925. sphericalHarmonics_default as _shaderssphericalHarmonics,
  220926. srgbToLinear_default as _shaderssrgbToLinear,
  220927. tangentToEyeSpaceMatrix_default as _shaderstangentToEyeSpaceMatrix,
  220928. threePiOver2_default as _shadersthreePiOver2,
  220929. transformPlane_default as _shaderstransformPlane,
  220930. translateRelativeToEye_default as _shaderstranslateRelativeToEye,
  220931. translucentPhong_default as _shaderstranslucentPhong,
  220932. transpose_default as _shaderstranspose,
  220933. twoPi_default as _shaderstwoPi,
  220934. unpackDepth_default as _shadersunpackDepth,
  220935. unpackFloat_default as _shadersunpackFloat,
  220936. unpackUint_default as _shadersunpackUint,
  220937. valueTransform_default as _shadersvalueTransform,
  220938. vertexLogDepth_default as _shadersvertexLogDepth,
  220939. webMercatorMaxLatitude_default as _shaderswebMercatorMaxLatitude,
  220940. windowToEyeCoordinates_default as _shaderswindowToEyeCoordinates,
  220941. writeDepthClamp_default as _shaderswriteDepthClamp,
  220942. writeLogDepth_default as _shaderswriteLogDepth,
  220943. writeNonPerspective_default as _shaderswriteNonPerspective,
  220944. addBuffer_default as addBuffer,
  220945. addDefaults_default as addDefaults,
  220946. addExtensionsRequired_default as addExtensionsRequired,
  220947. addExtensionsUsed_default as addExtensionsUsed,
  220948. addPipelineExtras_default as addPipelineExtras,
  220949. addToArray_default as addToArray,
  220950. appendForwardSlash_default as appendForwardSlash,
  220951. arrayFill_default as arrayFill,
  220952. arrayRemoveDuplicates_default as arrayRemoveDuplicates,
  220953. arraySlice_default as arraySlice,
  220954. barycentricCoordinates_default as barycentricCoordinates,
  220955. binarySearch_default as binarySearch,
  220956. bitmapSdf as bitmap_sdf,
  220957. buildDrawCommands,
  220958. buildModuleUrl_default as buildModuleUrl,
  220959. cancelAnimationFrame_default as cancelAnimationFrame,
  220960. clone_default as clone,
  220961. combine_default as combine,
  220962. computeFlyToLocationForRectangle_default as computeFlyToLocationForRectangle,
  220963. createBillboardPointCallback_default as createBillboardPointCallback,
  220964. createCommand_default as createCommand,
  220965. createDefaultImageryProviderViewModels_default as createDefaultImageryProviderViewModels,
  220966. createDefaultTerrainProviderViewModels_default as createDefaultTerrainProviderViewModels,
  220967. createElevationBandMaterial_default as createElevationBandMaterial,
  220968. createGuid_default as createGuid,
  220969. createMaterialPropertyDescriptor_default as createMaterialPropertyDescriptor,
  220970. createOsmBuildings_default as createOsmBuildings,
  220971. createPropertyDescriptor_default as createPropertyDescriptor,
  220972. createRawPropertyDescriptor_default as createRawPropertyDescriptor,
  220973. createTangentSpaceDebugPrimitive_default as createTangentSpaceDebugPrimitive,
  220974. createTaskProcessorWorker_default as createTaskProcessorWorker,
  220975. createUniform_default as createUniform,
  220976. createUniformArray_default as createUniformArray,
  220977. createWorldImagery_default as createWorldImagery,
  220978. createWorldTerrain_default as createWorldTerrain,
  220979. decodeGoogleEarthEnterpriseData_default as decodeGoogleEarthEnterpriseData,
  220980. decodeVectorPolylinePositions_default as decodeVectorPolylinePositions,
  220981. defaultValue_default as defaultValue,
  220982. defer_default as defer,
  220983. defined_default as defined,
  220984. deprecationWarning_default as deprecationWarning,
  220985. destroyObject_default as destroyObject,
  220986. purify as dompurify,
  220987. earcut_1 as earcut,
  220988. exportKml_default as exportKml,
  220989. findAccessorMinMax_default as findAccessorMinMax,
  220990. findContentMetadata,
  220991. findGroupMetadata,
  220992. findTileMetadata,
  220993. forEachTextureInMaterial_default as forEachTextureInMaterial,
  220994. formatError_default as formatError,
  220995. freezeRenderState_default as freezeRenderState,
  220996. getAbsoluteUri_default as getAbsoluteUri,
  220997. getAccessorByteStride_default as getAccessorByteStride,
  220998. getBaseUri_default as getBaseUri,
  220999. getBinaryAccessor_default as getBinaryAccessor,
  221000. getClipAndStyleCode_default as getClipAndStyleCode,
  221001. getClippingFunction_default as getClippingFunction,
  221002. getComponentReader_default as getComponentReader,
  221003. getElement_default as getElement,
  221004. getExtensionFromUri_default as getExtensionFromUri,
  221005. getFilenameFromUri_default as getFilenameFromUri,
  221006. getImagePixels_default as getImagePixels,
  221007. getJsonFromTypedArray_default as getJsonFromTypedArray,
  221008. getMagic_default as getMagic,
  221009. getStringFromTypedArray_default as getStringFromTypedArray,
  221010. getTimestamp_default as getTimestamp,
  221011. graphemeSplitter as grapheme_splitter,
  221012. hasExtension,
  221013. heightReferenceOnEntityPropertyChanged_default as heightReferenceOnEntityPropertyChanged,
  221014. isBitSet_default as isBitSet,
  221015. isBlobUri_default as isBlobUri,
  221016. isCrossOriginUrl_default as isCrossOriginUrl,
  221017. isDataUri_default as isDataUri,
  221018. isLeapYear_default as isLeapYear,
  221019. jsep,
  221020. KDBush as kdbush,
  221021. knockout_default as knockout,
  221022. knockout_3_5_1_default as knockout_3_5_1,
  221023. knockout_es5_default as knockout_es5,
  221024. p as ktx_parse,
  221025. LercDecode as lerc,
  221026. loadAndExecuteScript_default as loadAndExecuteScript,
  221027. loadCubeMap_default as loadCubeMap,
  221028. loadImageFromTypedArray_default as loadImageFromTypedArray,
  221029. loadKTX2_default as loadKTX2,
  221030. mergeSort_default as mergeSort,
  221031. mersenneTwister as mersenne_twister,
  221032. MeshoptDecoder as meshoptimizer,
  221033. modernizeShader_default as modernizeShader,
  221034. moveTechniqueRenderStates_default as moveTechniqueRenderStates,
  221035. moveTechniquesToExtension_default as moveTechniquesToExtension,
  221036. src as nosleep,
  221037. numberOfComponentsForType_default as numberOfComponentsForType,
  221038. objectToQuery_default as objectToQuery,
  221039. oneTimeWarning_default as oneTimeWarning,
  221040. inflate_1 as pako,
  221041. parseBatchTable,
  221042. parseBoundingVolumeSemantics,
  221043. parseFeatureMetadataLegacy,
  221044. parseGlb_default as parseGlb,
  221045. parseResponseHeaders_default as parseResponseHeaders,
  221046. parseStructuralMetadata,
  221047. pointInsideTriangle_default as pointInsideTriangle,
  221048. preprocess3DTileContent,
  221049. processModelMaterialsCommon_default as processModelMaterialsCommon,
  221050. processPbrMaterials_default as processPbrMaterials,
  221051. protobuf$1 as protobufjs,
  221052. queryToObject_default as queryToObject,
  221053. RBush as rbush,
  221054. readAccessorPacked_default as readAccessorPacked,
  221055. removeExtensionsRequired_default as removeExtensionsRequired,
  221056. removeExtensionsUsed_default as removeExtensionsUsed,
  221057. removePipelineExtras_default as removePipelineExtras,
  221058. removeUnusedElements_default as removeUnusedElements,
  221059. requestAnimationFrame_default as requestAnimationFrame,
  221060. sampleTerrain_default as sampleTerrain,
  221061. sampleTerrainMostDetailed_default as sampleTerrainMostDetailed,
  221062. scaleToGeodeticSurface_default as scaleToGeodeticSurface,
  221063. subdivideArray_default as subdivideArray,
  221064. subscribeAndEvaluate_default as subscribeAndEvaluate,
  221065. index as topojson,
  221066. updateAccessorComponentTypes_default as updateAccessorComponentTypes,
  221067. updateVersion_default as updateVersion,
  221068. usesExtension_default as usesExtension,
  221069. viewerCesium3DTilesInspectorMixin_default as viewerCesium3DTilesInspectorMixin,
  221070. viewerCesiumInspectorMixin_default as viewerCesiumInspectorMixin,
  221071. viewerDragDropMixin_default as viewerDragDropMixin,
  221072. viewerPerformanceWatchdogMixin_default as viewerPerformanceWatchdogMixin,
  221073. webGLConstantToGlslType_default as webGLConstantToGlslType,
  221074. wrapFunction_default as wrapFunction,
  221075. writeTextToCanvas_default as writeTextToCanvas,
  221076. zipNoWorker as zip
  221077. };
  221078. /* Copyright 2015-2018 Esri. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 @preserve */
  221079. /*!
  221080. * Knockout JavaScript library v3.5.1
  221081. * (c) The Knockout.js team - http://knockoutjs.com/
  221082. * License: MIT (http://www.opensource.org/licenses/mit-license.php)
  221083. */
  221084. /*!
  221085. * URI.js - Mutating URLs
  221086. *
  221087. * Version: 1.19.11
  221088. *
  221089. * Author: Rodney Rehm
  221090. * Web: http://medialize.github.io/URI.js/
  221091. *
  221092. * Licensed under
  221093. * MIT License http://www.opensource.org/licenses/mit-license
  221094. *
  221095. */
  221096. /*!
  221097. * URI.js - Mutating URLs
  221098. * IPv6 Support
  221099. *
  221100. * Version: 1.19.11
  221101. *
  221102. * Author: Rodney Rehm
  221103. * Web: http://medialize.github.io/URI.js/
  221104. *
  221105. * Licensed under
  221106. * MIT License http://www.opensource.org/licenses/mit-license
  221107. *
  221108. */
  221109. /*!
  221110. * URI.js - Mutating URLs
  221111. * Second Level Domain (SLD) Support
  221112. *
  221113. * Version: 1.19.11
  221114. *
  221115. * Author: Rodney Rehm
  221116. * Web: http://medialize.github.io/URI.js/
  221117. *
  221118. * Licensed under
  221119. * MIT License http://www.opensource.org/licenses/mit-license
  221120. *
  221121. */
  221122. /*!
  221123. * protobuf.js v6.7.0 (c) 2016, Daniel Wirtz
  221124. * Compiled Sun, 02 Apr 2017 11:28:29 UTC
  221125. * Licensed under the BSD-3-Clause License
  221126. * see: https://github.com/dcodeIO/protobuf.js for details
  221127. */
  221128. /*! @license DOMPurify 2.3.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.6/LICENSE */
  221129. /*! https://mths.be/punycode v1.3.2 by @mathias */
  221130. /**
  221131. * @license
  221132. * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
  221133. *
  221134. * Redistribution and use in source and binary forms, with or without
  221135. * modification, are permitted provided that the following conditions
  221136. * are met:
  221137. * * Redistributions of source code must retain the above copyright
  221138. * notice, this list of conditions and the following disclaimer.
  221139. * * Redistributions in binary form must reproduce the above copyright
  221140. * notice, this list of conditions and the following disclaimer in the
  221141. * documentation and/or other materials provided with the distribution.
  221142. * * Neither the name of NVIDIA CORPORATION nor the names of its
  221143. * contributors may be used to endorse or promote products derived
  221144. * from this software without specific prior written permission.
  221145. *
  221146. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
  221147. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  221148. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  221149. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  221150. * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  221151. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  221152. * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  221153. * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  221154. * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  221155. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  221156. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  221157. */
  221158. /**
  221159. * @license
  221160. * Knockout ES5 plugin - https://github.com/SteveSanderson/knockout-es5
  221161. * Copyright (c) Steve Sanderson
  221162. * MIT license
  221163. */
  221164. //# sourceMappingURL=cesium.js.map